I spent an hour of debugging and trying to understand what the hell is happening and why on this strange thing:
// hit->distance = calcFirstIntersection(player, angle, intersection_type);\
hit->distance = 512;
It was supposed to print 512 but it was printing 32765 and 34. I realized that something was going completely wrong because I have mistakenly typed the character '\' after the commented line (probably because those stupid keyboards have this character over half the 'Enter' key).
After trying to understand why that character even when it's commented have such result and what is actually happening, I found out that it cancelled my next line. Not exactly. It actually cancels CR+LF or something like that.
Simply, if I type:
It is like I am typing:
So, the accidentally typed '\', even after a comment, brought my next line in the same commented line, thus I wasn't loading hit->distance with anything and my printf got what was on the init of this value or something random anyway.
I know I have seen this '\' symbol used somewhere before. When people write inline assembly in some C compilers. Oh, also in some code that passed a GLSL shader as a string. The whole thing was probably needed to be given in the same line but \ would make it possible to have it line after line I guess.
I know this is old story for some of you but the only reason I am writting this post is because I was sooooo frustrated and actually perplexed by this very very strange thing (it is strange when you didn't know it's use before and it even worked after the comment) that I wanted to write anything.
p.s. Ok,. back to code. Lot's of work was done in the wolfenstein CPC engine the last few days. I have something that works on PC, almost doesn't work on CPC and it's slow like hell. If I manage to make it work there, I will need another pair of effort to optimize it. It's gonna be a hell of a hard work.