I get this: Code (Text): obj01.c: In function `Floor_ChkTile': obj01.c:3081: parse error before `short' obj01.c:3087: `x' undeclared (first use in this function) obj01.c:3087: (Each undeclared identifier is reported only once obj01.c:3087: for each function it appears in.) obj01.c:3088: `y' undeclared (first use in this function) The code it's reading is this: Code (Text): int Floor_ChkTile(){ WriteLog("Floor_ChkTile()"); TabLog(1); RegLog(); short x = (((short)d3)>>4); short y = (((short)d2)>>4); // this function is customized for ProSonic // d3 is a modified 'p->x_pos' // d2 is a modified 'p->y_pos' if(x < 0) x = ((z.TMAP[tmap_ptr-2]+1) * (2<<tilesize)) - x; if(y < 0) y = ((z.TMAP[tmap_ptr-1]+1) * (2<<tilesize)) - y; a1 = COMPILED_MAP[ (x % ((z.TMAP[tmap_ptr-2]+1) * (2<<tilesize))) + ((y % ((z.TMAP[tmap_ptr-1]+1) * (2<<tilesize))) * ((z.TMAP[tmap_ptr-2]+1) * (2<<tilesize)))]; //a1 = ReadBlock(&z, (short)d3, (short)d2); RegLog(); TabLog(-1); return 0; } What the heck is going on?! If I take out the WriteLog("Floor_ChkTile()"); TabLog(1); RegLog(); line, it works compiles just fine. I use WriteLog(), TabLog(), and RegLog() in my other functions just the same way without any issues, but it complains about it in the Floor_ChkTile() function. Is there something I'm going wrong, or is the compiler being retarded?
It's pure C, right? Because C doesn't allow variables to be declared after any code. Maybe the newest standards (didn't check that), but of course not all compilers follow that.
Basically, what Sik said. It looks like you're using Microsoft Visual C++, which still doesn't support variable declarations after the start of a block when compiling C code. It does support it when compiling C++ code, though.
Oh shoot, you're right. I completely forgot about that. I didn't even realize I was doing it. Thanks for pointing that out! Issue resolved.