That was rather embarrassing. See if you can find the error:
int16 StatBaseAddr = 0x298;
for ( x = 0; x < 3; x++ )
{
SceneFile[x * 2] = (int16)ModelIDs[x] && 0xFF;
SceneFile[x * 2 + 1] = ((int16)ModelIDs[x] && 0xFF00) >> 8;
StatBaseAddr += x * 184;
Array.Copy( NewStats[x], 0, SceneFile, StatBaseAddr, 184 );
}
If you see it, good for you. Don't feel bad if you don't get it though. I don't think there's a C++ equiv for Array.Copy( array, int, array, int, int) so I'll just tell you that it copies a certain number of values from one array into another.
See it yet? Follow StatBaseAddr for each loop:
x = 0: StatBaseAddr = 0x298 //first enemy's data
x = 1: StatBaseAddr = 0x350 //second enemy's data
x = 2: StatBaseAddr = 0x4C0 //beginning of attack data!!
So technically, the third enemy's data was getting saved, but in the wrong place. :( I changed that StatBaseAddr += x * 184; to StatBaseAddr += 184 and moved it to below the Array.Copy line and it saves just like it should now. Problem solved. :D
Thursday, June 9, 2011
Wednesday, June 8, 2011
Subscribe to:
Posts (Atom)