well I have less than a clue as to whats causeing the vast majority of crashing, I get an assertion error when I try loading a new model after haveing some (but not all) glow point models open, after saveing more than once, going into the debugger mearly confuses me (it seems like glow data may be overwriteing SOBJ data internaly, but that is little more than a guess), I've gone through and looked for things that other chuncks have that glow doesn't but it doesn't seem to have fixed anything and probly only made things worse, and I disabled the 3D veiwer to limet bug sorces, only good I've done is the read write functions (and killed that anoying nag when I want to open a new file)
I added an int for glow type to the HullLights struct, and the needed interface in the gloweditor, so I can do somehting I wanted to do (diferent rendering stiles, point/beam/other)
posting the read/right stuff here if anyone else want to take a shot,
I am not qualified to do much more at this time (I even can't read 73% of the code, let alone bug hunt)
void POF::Parse_Memory_GLOW(char *buffer)
{
//hull_lights
char *localptr = buffer;
memcpy(&hull_lights.num_glows_arrays, localptr, sizeof(int));
localptr += sizeof(int);
hull_lights.lights = new HullLights[hull_lights.num_glows_arrays];
for (int i = 0; i < hull_lights.num_glows_arrays; i++)
{
memcpy(&hull_lights.lights[i].disp_time, localptr, sizeof(int));
localptr += sizeof(int);
memcpy(&hull_lights.lights[i].on_time, localptr, sizeof(int));
localptr += sizeof(int);
memcpy(&hull_lights.lights[i].off_time, localptr, sizeof(int));
localptr += sizeof(int);
memcpy(&hull_lights.lights[i].obj_parent, localptr, sizeof(int));
localptr += sizeof(int);
memcpy(&hull_lights.lights[i].LOD, localptr, sizeof(int));
localptr += sizeof(int);
memcpy(&hull_lights.lights[i].type, localptr, sizeof(int));
localptr += sizeof(int);
memcpy(&hull_lights.lights[i].num_Lights, localptr, sizeof(int));
localptr += sizeof(int);
memcpy(&hull_lights.lights[i].properties.length, localptr, sizeof(int));
localptr += sizeof(int);
hull_lights.lights[i].properties.str = new char[hull_lights.lights[i].properties.length];
memcpy(hull_lights.lights[i].properties.str, localptr, hull_lights.lights[i].properties.length);
localptr += hull_lights.lights[i].properties.length;
hull_lights.lights[i].lights = new HullLightPoint[hull_lights.lights[i].num_Lights];
for (int j = 0; j < hull_lights.lights[i].num_Lights; j++)
{
memcpy(&hull_lights.lights[i].lights[j].point, localptr, sizeof(vector));
localptr += sizeof(vector);
memcpy(&hull_lights.lights[i].lights[j].norm, localptr, sizeof(vector));
localptr += sizeof(vector);
memcpy(&hull_lights.lights[i].lights[j].radius, localptr, sizeof(float));
localptr += sizeof(float);
}
}
}
from within
bool POF::SavePOF(ofstream &outfile)
// 16 GLOW ----------------------------------------
if (hull_lights.num_glows_arrays != 0)
{
//write signature
outfile.write("GLOW", 4);
k = sizeof(int) + (8 * sizeof(int) * hull_lights.num_glows_arrays); // each group in binary format is 7 ints + strlen + size of their point array
for ( i = 0; i < hull_lights.num_glows_arrays; i++)
{
k += ( (hull_lights.lights[i].properties.length) + (sizeof(HullLightPoint) * hull_lights.lights[i].num_Lights));
}
// write size
memcpy(temp_buf, &k, sizeof(int));
outfile.write(temp_buf, sizeof(int));
// write data
memcpy(temp_buf, &hull_lights.num_glows_arrays, sizeof(int));
outfile.write(temp_buf, sizeof(int));
outfile.flush();
for (int i = 0; i < hull_lights.num_glows_arrays; i++)
{
memcpy(temp_buf, &hull_lights.lights[i].disp_time, sizeof(int));
outfile.write(temp_buf, sizeof(int));
outfile.flush();
memcpy(temp_buf, &hull_lights.lights[i].on_time, sizeof(int));
outfile.write(temp_buf, sizeof(int));
outfile.flush();
memcpy(temp_buf, &hull_lights.lights[i].off_time, sizeof(int));
outfile.write(temp_buf, sizeof(int));
outfile.flush();
memcpy(temp_buf, &hull_lights.lights[i].obj_parent, sizeof(int));
outfile.write(temp_buf, sizeof(int));
outfile.flush();
memcpy(temp_buf, &hull_lights.lights[i].LOD, sizeof(int));
outfile.write(temp_buf, sizeof(int));
outfile.flush();
memcpy(temp_buf, &hull_lights.lights[i].type, sizeof(int));
outfile.write(temp_buf, sizeof(int));
outfile.flush();
memcpy(temp_buf, &hull_lights.lights[i].num_Lights, sizeof(int));
outfile.write(temp_buf, sizeof(int));
outfile.flush();
memcpy(temp_buf, &hull_lights.lights[i].properties.length, sizeof(int));
outfile.write(temp_buf, sizeof(int));
outfile.flush();
outfile.write(hull_lights.lights[i].properties.str, hull_lights.lights[i].properties.length);
outfile.flush();
for (int j = 0; j < hull_lights.lights[i].num_Lights; j++)
{
memcpy(vector_buf, &hull_lights.lights[i].lights[j].point, sizeof(vector));
outfile.write(vector_buf, sizeof(vector));
outfile.flush();
memcpy(vector_buf, &hull_lights.lights[i].lights[j].norm, sizeof(vector));
outfile.write(vector_buf, sizeof(vector));
outfile.flush();
memcpy(temp_buf, &hull_lights.lights[i].lights[j].radius, sizeof(float));
outfile.write(temp_buf, sizeof(float));
outfile.flush();
}
}
}
remember I added an int (type) to the HullLights struct
I've got a copy running stable enough for my needs, I can test new code changes and modify models myself, though I wouldn't want to put anyone else through it's buggynes if I didn't have to
I realy hope someone picks this up becase I do not want to be stuck with my crash happy version
we've got to have someone who knows how to use this stile