1. I expanded dlightbits from int to 4 ints. (32 bytes x 4 = 128 bits) in gl_model.h
Code: Select all
NEW: int dlightbits[(MAX_DLIGHTS + 31) >> 5]; // mh - 128 dynamic lights
OLD: int dlightbits;
Code: Select all
if (surf->dlightframe != r_dlightframecount) // not dynamic until now
{
surf->dlightbits[0] = surf->dlightbits[1] = surf->dlightbits[2] = surf->dlightbits[3] = 0;
// memset (surf->dlightbits, 0, sizeof (surf->dlightbits));
surf->dlightframe = r_dlightframecount;
}
// mark the surf and ent for this dlight
surf->dlightbits[num >> 5] |= 1 << (num & 31);
Code: Select all
if ( !(surf->dlightbits[lnum >> 5] & (1 << (lnum & 31)))) //MH
msurface_t is the in memory representation of a surface. As far as I know, I should be able to add 12 bytes (3 more ints) and for the most part handle it how I want.
Any thoughts? I'm thinking my problem is related to a memory corruption and looking at gl_model.c to see how msurface_t is getting allocated and seeing how the data is filled in ...