This maybe a completely obvious error but I can't figure out why my code below won't work. I'm rather unfamiliar with C, though I have made some programs using it.
I'm using Turbo C (v.3.2), so that might also be the issue; however, I'm not sure.
static struct sector
{
float floor, ceil;
vec2 *verts;
signed char *neighbors;
unsigned npoints;
}*sectors = NULL;
static unsigned NumSectors = 0;
static struct player
{
vec3 position, velocity;
float anlge, anglesin, anglecos, yaw;
unsigned sector;
}player;
void DrawScreen()
{
enum{ MaxQueue = 32 };
unsigned s = 0;
struct item { int sectorno,sx1, sx2; } queue[MaxQueue], *head=queue, *tail=queue;
int ytop[W]={0}, ybottom[W], *renderedsectors = (int*)malloc(NumSectors*sizeof(int));
for(s = 0; s < W; ++s) ybottom[s] = H-1;
for(s = 0; s < NumSectors; ++s) renderedsectors[s] = 0;
//This line causes an Expression syntax error.
//From my understanding the pointer is moved to this structure inside the array.
//Corrections welcome as I want to learn c more in order to
//use it in more projects of mine.
*head = (struct item) { player.sector, 0, W-1 };
if(++head == queue+MaxQueue) head = queue;
do{
const struct item now = *tail;
const struct sector* const sect = §ors[now.sectorno];
if(++tail == queue+MaxQueue) tail = queue;
if(renderedsectors[now.sectorno] & 0x21) continue;
++renderedsectors[now.sectorno];
for(s = 0; s < sect->npoints; ++s)
{
}
}while(head != tail);
}
I'm aware of the age of Turbo C but I have to use it due to it running in DOSBox, where my final executable has to work.
I'm copying the code from this website and I'm pretty sure he used another compiler, which probably was also newer.
I didn't work a lot with C and I mostly either used C++ in my free time or C# on the job, but I need to use it now due to the restrictions I'm facing.