Made NpChar.cpp ASM-accurate

SetBulletObject has a commented-out if, it seems, and the leftover
braces affected the ASM.
This commit is contained in:
Clownacy 2019-06-30 00:57:19 +01:00
parent c162d06f96
commit 5167a341aa

View file

@ -238,12 +238,16 @@ void SetExpObjects(int x, int y, int exp)
BOOL SetBulletObject(int x, int y, int val) BOOL SetBulletObject(int x, int y, int val)
{ {
int t = 0;
int bullet_no;
int tamakazu_ari[10];
int n; int n;
int bullet_no; // The Linux debug data claims there's a 3-line gap between this and the next variable declaration. Just enough space for an 'if' statement.
// if (/* unknown */)
{ // This is necessary for accurate ASM (stack frame layout)
int tamakazu_ari[10];
int t = 0;
memset(tamakazu_ari, 0, sizeof(tamakazu_ari)); memset(tamakazu_ari, 0, sizeof(tamakazu_ari));
for (n = 0; n < 8; ++n) for (n = 0; n < 8; ++n)
{ {
switch (gArmsData[n].code) switch (gArmsData[n].code)
@ -267,6 +271,7 @@ BOOL SetBulletObject(int x, int y, int val)
n = Random(1, 10 * t); n = Random(1, 10 * t);
bullet_no = tamakazu_ari[n % t]; bullet_no = tamakazu_ari[n % t];
n = 0x100; n = 0x100;
while (n < NPC_MAX && gNPC[n].cond) while (n < NPC_MAX && gNPC[n].cond)
++n; ++n;
@ -284,6 +289,8 @@ BOOL SetBulletObject(int x, int y, int val)
gNPC[n].bits = gNpcTable[gNPC[n].code_char].bits; gNPC[n].bits = gNpcTable[gNPC[n].code_char].bits;
gNPC[n].exp = val; gNPC[n].exp = val;
SetUniqueParameter(&gNPC[n]); SetUniqueParameter(&gNPC[n]);
}
return TRUE; return TRUE;
} }