Sorted out the other NPCs' variables too

This commit is contained in:
Clownacy 2020-01-07 20:35:15 +00:00
parent 6e20f4cc15
commit affaf25e5c
17 changed files with 67 additions and 88 deletions

View file

@ -1096,10 +1096,9 @@ void ActNpc035(NPCHAR *npc)
// Balrog (hover) // Balrog (hover)
void ActNpc036(NPCHAR *npc) void ActNpc036(NPCHAR *npc)
{ {
unsigned char deg;
int ym;
int xm;
int i; int i;
unsigned char deg;
int xm, ym;
switch (npc->act_no) switch (npc->act_no)
{ {

View file

@ -118,6 +118,8 @@ void ActNpc041(NPCHAR *npc)
// Sue // Sue
void ActNpc042(NPCHAR *npc) void ActNpc042(NPCHAR *npc)
{ {
int n;
RECT rcLeft[13] = { RECT rcLeft[13] = {
{0, 0, 16, 16}, {0, 0, 16, 16},
{16, 0, 32, 16}, {16, 0, 32, 16},
@ -150,8 +152,6 @@ void ActNpc042(NPCHAR *npc)
{160, 48, 176, 64}, {160, 48, 176, 64},
}; };
int n;
switch (npc->act_no) switch (npc->act_no)
{ {
case 0: case 0:
@ -870,8 +870,7 @@ void ActNpc048(NPCHAR *npc)
void ActNpc049(NPCHAR *npc) void ActNpc049(NPCHAR *npc)
{ {
unsigned char deg; unsigned char deg;
int ym; int xm, ym;
int xm;
if (npc->act_no >= 10 && npc->pNpc->code_char == 3) if (npc->act_no >= 10 && npc->pNpc->code_char == 3)
{ {
@ -1916,8 +1915,8 @@ void ActNpc058(NPCHAR *npc)
if ((++npc->count2 % 8) == 0 && npc->x < gMC.x + (160 * 0x200) && npc->x > gMC.x - (160 * 0x200)) // TODO: Maybe do something about this for widescreen if ((++npc->count2 % 8) == 0 && npc->x < gMC.x + (160 * 0x200) && npc->x > gMC.x - (160 * 0x200)) // TODO: Maybe do something about this for widescreen
{ {
unsigned char deg; unsigned char deg;
int ym;
int xm; int xm;
int ym;
deg = GetArktan(npc->x - gMC.x, npc->y - gMC.y); deg = GetArktan(npc->x - gMC.x, npc->y - gMC.y);
deg += (unsigned char)Random(-6, 6); deg += (unsigned char)Random(-6, 6);

View file

@ -199,6 +199,8 @@ void ActNpc060(NPCHAR *npc)
// King // King
void ActNpc061(NPCHAR *npc) void ActNpc061(NPCHAR *npc)
{ {
int i;
RECT rcLeft[11] = { RECT rcLeft[11] = {
{224, 32, 240, 48}, {224, 32, 240, 48},
{240, 32, 256, 48}, {240, 32, 256, 48},
@ -227,8 +229,6 @@ void ActNpc061(NPCHAR *npc)
{112, 32, 128, 48}, {112, 32, 128, 48},
}; };
int i;
switch (npc->act_no) switch (npc->act_no)
{ {
case 0: case 0:

View file

@ -877,8 +877,7 @@ void ActNpc088(NPCHAR *npc)
{ {
int i; int i;
unsigned char deg; unsigned char deg;
int xm; int xm, ym;
int ym;
RECT rcLeft[12] = { RECT rcLeft[12] = {
{0, 0, 40, 40}, {0, 0, 40, 40},

View file

@ -1068,14 +1068,14 @@ void ActNpc113(NPCHAR *npc)
// Press // Press
void ActNpc114(NPCHAR *npc) void ActNpc114(NPCHAR *npc)
{ {
int i;
RECT rcLeft[3] = { RECT rcLeft[3] = {
{144, 112, 160, 136}, {144, 112, 160, 136},
{160, 112, 176, 136}, {160, 112, 176, 136},
{176, 112, 192, 136}, {176, 112, 192, 136},
}; };
int i;
switch (npc->act_no) switch (npc->act_no)
{ {
case 0: case 0:
@ -1521,6 +1521,8 @@ void ActNpc117(NPCHAR *npc)
// Curly (boss) // Curly (boss)
void ActNpc118(NPCHAR *npc) void ActNpc118(NPCHAR *npc)
{ {
BOOL bUpper;
RECT rcLeft[9] = { RECT rcLeft[9] = {
{0, 32, 32, 56}, {0, 32, 32, 56},
{32, 32, 64, 56}, {32, 32, 64, 56},
@ -1545,7 +1547,7 @@ void ActNpc118(NPCHAR *npc)
{160, 56, 192, 80}, {160, 56, 192, 80},
}; };
BOOL bUpper = FALSE; bUpper = FALSE;
if (npc->direct == 0 && npc->x < gMC.x) if (npc->direct == 0 && npc->x < gMC.x)
bUpper = TRUE; bUpper = TRUE;

View file

@ -1090,8 +1090,7 @@ void ActNpc134(NPCHAR *npc)
void ActNpc135(NPCHAR *npc) void ActNpc135(NPCHAR *npc)
{ {
unsigned char deg; unsigned char deg;
int ym; int xm, ym;
int xm;
RECT rcLeft[2] = { RECT rcLeft[2] = {
{256, 32, 288, 64}, {256, 32, 288, 64},

View file

@ -764,9 +764,8 @@ void ActNpc146(NPCHAR *npc)
// Critter (purple) // Critter (purple)
void ActNpc147(NPCHAR *npc) void ActNpc147(NPCHAR *npc)
{ {
int xm, ym;
unsigned char deg; unsigned char deg;
int xm;
int ym;
RECT rcLeft[6] = { RECT rcLeft[6] = {
{0, 96, 16, 112}, {0, 96, 16, 112},
@ -1349,7 +1348,7 @@ void ActNpc152(NPCHAR *npc)
npc->rect = rc; npc->rect = rc;
} }
static const RECT grcKitL[21] = { const RECT grcKitL[21] = {
{0, 0, 24, 24}, {0, 0, 24, 24},
{24, 0, 48, 24}, {24, 0, 48, 24},
{48, 0, 72, 24}, {48, 0, 72, 24},
@ -1373,7 +1372,7 @@ static const RECT grcKitL[21] = {
{96, 48, 120, 72} {96, 48, 120, 72}
}; };
static const RECT grcKitR[21] = { const RECT grcKitR[21] = {
{0, 24, 24, 48}, {0, 24, 24, 48},
{24, 24, 48, 48}, {24, 24, 48, 48},
{48, 24, 72, 48}, {48, 24, 72, 48},
@ -1624,8 +1623,7 @@ void ActNpc154(NPCHAR *npc)
void ActNpc155(NPCHAR *npc) void ActNpc155(NPCHAR *npc)
{ {
unsigned char deg; unsigned char deg;
int ym; int xm, ym;
int xm;
if (npc->x > gMC.x + (((WINDOW_WIDTH / 2) + 160) * 0x200) || npc->x < gMC.x - (((WINDOW_WIDTH / 2) + 160) * 0x200) || npc->y > gMC.y + (((WINDOW_HEIGHT / 2) + 120) * 0x200) || npc->y < gMC.y - (((WINDOW_HEIGHT / 2) + 120) * 0x200)) if (npc->x > gMC.x + (((WINDOW_WIDTH / 2) + 160) * 0x200) || npc->x < gMC.x - (((WINDOW_WIDTH / 2) + 160) * 0x200) || npc->y > gMC.y + (((WINDOW_HEIGHT / 2) + 120) * 0x200) || npc->y < gMC.y - (((WINDOW_HEIGHT / 2) + 120) * 0x200))
return; return;

View file

@ -1071,8 +1071,7 @@ void ActNpc172(NPCHAR *npc)
void ActNpc173(NPCHAR *npc) void ActNpc173(NPCHAR *npc)
{ {
unsigned char deg; unsigned char deg;
int xm; int xm, ym;
int ym;
RECT rcLeft[4] = { RECT rcLeft[4] = {
{0, 128, 24, 152}, {0, 128, 24, 152},

View file

@ -19,8 +19,7 @@
// Curly AI // Curly AI
void ActNpc180(NPCHAR *npc) void ActNpc180(NPCHAR *npc)
{ {
int xx; int xx, yy;
int yy;
RECT rcLeft[11] = { RECT rcLeft[11] = {
{0, 96, 16, 112}, {0, 96, 16, 112},
@ -978,13 +977,13 @@ void ActNpc189(NPCHAR *npc)
// Broken robot // Broken robot
void ActNpc190(NPCHAR *npc) void ActNpc190(NPCHAR *npc)
{ {
int i;
RECT rect[2] = { RECT rect[2] = {
{192, 32, 208, 48}, {192, 32, 208, 48},
{208, 32, 224, 48}, {208, 32, 224, 48},
}; };
int i;
switch (npc->act_no) switch (npc->act_no)
{ {
case 0: case 0:

View file

@ -17,8 +17,7 @@
void ActNpc200(NPCHAR *npc) void ActNpc200(NPCHAR *npc)
{ {
unsigned char deg; unsigned char deg;
int ym; int xm, ym;
int xm;
RECT rcLeft[6] = { RECT rcLeft[6] = {
{0, 0, 40, 40}, {0, 0, 40, 40},
@ -475,8 +474,8 @@ void ActNpc206(NPCHAR *npc)
case 3: case 3:
switch (npc->act_wait) switch (npc->act_wait)
{ {
// Interestingly, this NPC counts down at 60 frames per second, // Interestingly, this NPC counts down at 60 frames
// while the NPC322 (Deleet), counts at 50. // per second, while NPC322 (Deleet) counts at 50.
case 60 * 0: case 60 * 0:
SetNpChar(207, npc->x + (16 * 0x200), npc->y + (4 * 0x200), 0, 0, 0, NULL, 0x100); SetNpChar(207, npc->x + (16 * 0x200), npc->y + (4 * 0x200), 0, 0, 0, NULL, 0x100);
break; break;

View file

@ -1129,11 +1129,11 @@ void ActNpc236(NPCHAR *npc)
// Gunfish projectile // Gunfish projectile
void ActNpc237(NPCHAR *npc) void ActNpc237(NPCHAR *npc)
{ {
RECT rc = {312, 32, 320, 40};
int i; int i;
BOOL bHit; BOOL bHit;
RECT rc = {312, 32, 320, 40};
switch (npc->act_no) switch (npc->act_no)
{ {
case 0: case 0:

View file

@ -318,12 +318,14 @@ void ActNpc243(NPCHAR *npc)
// Lava drop // Lava drop
void ActNpc244(NPCHAR *npc) void ActNpc244(NPCHAR *npc)
{ {
RECT rc = {96, 0, 104, 16};
BOOL bHit;
int i; int i;
RECT rc = {96, 0, 104, 16};
npc->ym += 0x40; npc->ym += 0x40;
BOOL bHit = FALSE; bHit = FALSE;
if (npc->flag & 0xFF) if (npc->flag & 0xFF)
bHit = TRUE; bHit = TRUE;
@ -411,14 +413,14 @@ void ActNpc245(NPCHAR *npc)
// Press (proximity) // Press (proximity)
void ActNpc246(NPCHAR *npc) void ActNpc246(NPCHAR *npc)
{ {
int i;
RECT rcLeft[3] = { RECT rcLeft[3] = {
{144, 112, 160, 136}, {144, 112, 160, 136},
{160, 112, 176, 136}, {160, 112, 176, 136},
{176, 112, 192, 136}, {176, 112, 192, 136},
}; };
int i;
switch (npc->act_no) switch (npc->act_no)
{ {
case 0: case 0:
@ -504,8 +506,7 @@ void ActNpc246(NPCHAR *npc)
void ActNpc247(NPCHAR *npc) void ActNpc247(NPCHAR *npc)
{ {
unsigned char deg; unsigned char deg;
int ym; int xm, ym;
int xm;
RECT rcLeft[9] = { RECT rcLeft[9] = {
{0, 0, 16, 16}, {0, 0, 16, 16},

View file

@ -186,8 +186,7 @@ void ActNpc262(NPCHAR *npc)
void ActNpc263(NPCHAR *npc) void ActNpc263(NPCHAR *npc)
{ {
int deg; int deg;
int xm; int xm, ym;
int ym;
RECT rcLeft[9] = { RECT rcLeft[9] = {
{0, 0, 24, 32}, {0, 0, 24, 32},
@ -469,9 +468,8 @@ void ActNpc263(NPCHAR *npc)
// Doctor red wave (projectile) // Doctor red wave (projectile)
void ActNpc264(NPCHAR *npc) void ActNpc264(NPCHAR *npc)
{ {
unsigned char deg;
RECT rc = {288, 0, 304, 16}; RECT rc = {288, 0, 304, 16};
unsigned char deg;
if (npc->x < 0 || npc->x > gMap.width * 0x10 * 0x200) if (npc->x < 0 || npc->x > gMap.width * 0x10 * 0x200)
{ {
@ -597,8 +595,7 @@ void ActNpc267(NPCHAR *npc)
{40, 160, 80, 208}, {40, 160, 80, 208},
}; };
int ym; int xm, ym;
int xm;
int i; int i;
switch (npc->act_no) switch (npc->act_no)
@ -1133,8 +1130,7 @@ void ActNpc267(NPCHAR *npc)
void ActNpc268(NPCHAR *npc) void ActNpc268(NPCHAR *npc)
{ {
unsigned char deg; unsigned char deg;
int ym; int xm, ym;
int xm;
RECT rcLeft[10] = { RECT rcLeft[10] = {
{0, 0, 40, 40}, {0, 0, 40, 40},
@ -1631,8 +1627,7 @@ void ActNpc274(NPCHAR *npc)
}; };
unsigned char deg; unsigned char deg;
int ym; int xm, ym;
int xm;
switch (npc->act_no) switch (npc->act_no)
{ {
@ -1825,8 +1820,7 @@ void ActNpc276(NPCHAR *npc)
}; };
unsigned char deg; unsigned char deg;
int ym; int xm, ym;
int xm;
switch (npc->act_no) switch (npc->act_no)
{ {
@ -2158,13 +2152,13 @@ void ActNpc278(NPCHAR *npc)
// Falling block (large) // Falling block (large)
void ActNpc279(NPCHAR *npc) void ActNpc279(NPCHAR *npc)
{ {
int i;
RECT rc[2] = { RECT rc[2] = {
{0, 16, 32, 48}, {0, 16, 32, 48},
{16, 0, 32, 16}, {16, 0, 32, 16},
}; };
int i;
switch (npc->act_no) switch (npc->act_no)
{ {
case 0: case 0:

View file

@ -129,6 +129,7 @@ void ActNpc281(NPCHAR *npc)
// Mini Undead Core (active) // Mini Undead Core (active)
void ActNpc282(NPCHAR *npc) void ActNpc282(NPCHAR *npc)
{ {
// Yes, Pixel spelt this wrong (should be 'rc')
RECT tc[3] = { RECT tc[3] = {
{256, 80, 320, 120}, {256, 80, 320, 120},
{256, 0, 320, 40}, {256, 0, 320, 40},
@ -203,9 +204,7 @@ void ActNpc282(NPCHAR *npc)
// Misery (transformed) // Misery (transformed)
void ActNpc283(NPCHAR *npc) void ActNpc283(NPCHAR *npc)
{ {
int x; int x, y, direct;
int y;
int direct;
RECT rcLeft[11] = { RECT rcLeft[11] = {
{0, 64, 32, 96}, {0, 64, 32, 96},
@ -966,6 +965,7 @@ void ActNpc284(NPCHAR *npc)
void ActNpc285(NPCHAR *npc) void ActNpc285(NPCHAR *npc)
{ {
RECT rc = {232, 104, 248, 120}; RECT rc = {232, 104, 248, 120};
unsigned char deg;
if (npc->x < 0 || npc->x > gMap.width * 0x10 * 0x200) if (npc->x < 0 || npc->x > gMap.width * 0x10 * 0x200)
{ {
@ -973,8 +973,6 @@ void ActNpc285(NPCHAR *npc)
return; return;
} }
unsigned char deg;
switch (npc->act_no) switch (npc->act_no)
{ {
case 0: case 0:
@ -1422,9 +1420,7 @@ void ActNpc293(NPCHAR *npc)
// Quake + falling block generator // Quake + falling block generator
void ActNpc294(NPCHAR *npc) void ActNpc294(NPCHAR *npc)
{ {
int x; int x, y, dir;
int y;
int dir;
switch (npc->act_no) switch (npc->act_no)
{ {
@ -1567,10 +1563,7 @@ void ActNpc295(NPCHAR *npc)
// Cloud generator // Cloud generator
void ActNpc296(NPCHAR *npc) void ActNpc296(NPCHAR *npc)
{ {
int x; int x, y, dir, pri;
int y;
int dir;
int pri;
if (++npc->act_wait > 16) if (++npc->act_wait > 16)
{ {

View file

@ -35,6 +35,8 @@ void ActNpc300(NPCHAR *npc)
// Fish missile (Misery) // Fish missile (Misery)
void ActNpc301(NPCHAR *npc) void ActNpc301(NPCHAR *npc)
{ {
int dir;
RECT rect[8] = { RECT rect[8] = {
{144, 0, 160, 16}, {144, 0, 160, 16},
{160, 0, 176, 16}, {160, 0, 176, 16},
@ -46,8 +48,6 @@ void ActNpc301(NPCHAR *npc)
{192, 16, 208, 32}, {192, 16, 208, 32},
}; };
int dir;
switch (npc->act_no) switch (npc->act_no)
{ {
case 0: case 0:
@ -102,6 +102,8 @@ void ActNpc301(NPCHAR *npc)
// Camera focus marker // Camera focus marker
void ActNpc302(NPCHAR *npc) void ActNpc302(NPCHAR *npc)
{ {
int n;
switch (npc->act_no) switch (npc->act_no)
{ {
case 10: case 10:
@ -143,18 +145,16 @@ void ActNpc302(NPCHAR *npc)
if (npc->direct != 0) if (npc->direct != 0)
{ {
int i; for (n = 0xAA; n < 0x200; ++n)
for (i = 0xAA; i < 0x200; ++i)
{ {
if (gNPC[i].cond & 0x80 && gNPC[i].code_event == npc->direct) if (gNPC[n].cond & 0x80 && gNPC[n].code_event == npc->direct)
{ {
npc->pNpc = &gNPC[i]; npc->pNpc = &gNPC[n];
break; break;
} }
} }
if (i == 0x200) if (n == 0x200)
{ {
npc->cond = 0; npc->cond = 0;
break; break;
@ -401,6 +401,8 @@ void ActNpc307(NPCHAR *npc)
// Stumpy // Stumpy
void ActNpc308(NPCHAR *npc) void ActNpc308(NPCHAR *npc)
{ {
unsigned char deg;
RECT rcLeft[2] = { RECT rcLeft[2] = {
{128, 112, 144, 128}, {128, 112, 144, 128},
{144, 112, 160, 128}, {144, 112, 160, 128},
@ -411,8 +413,6 @@ void ActNpc308(NPCHAR *npc)
{144, 128, 160, 144}, {144, 128, 160, 144},
}; };
unsigned char deg;
switch (npc->act_no) switch (npc->act_no)
{ {
case 0: case 0:

View file

@ -220,7 +220,7 @@ void ActNpc322(NPCHAR *npc)
switch (npc->act_wait) switch (npc->act_wait)
{ {
// Interestingly, this NPC counts down at 50 frames per second, // Interestingly, this NPC counts down at 50 frames per second,
// while the NPC206 (the Egg Corridor Counter Bomb), counts at 60. // while NPC206 (the Egg Corridor Counter Bomb), counts at 60.
case 50 * 0: case 50 * 0:
SetNpChar(207, npc->x + (4 * 0x200), npc->y, 0, 0, 0, NULL, 0x180); SetNpChar(207, npc->x + (4 * 0x200), npc->y, 0, 0, 0, NULL, 0x180);
break; break;
@ -801,14 +801,14 @@ void ActNpc331(NPCHAR *npc)
// Ballos shockwave // Ballos shockwave
void ActNpc332(NPCHAR *npc) void ActNpc332(NPCHAR *npc)
{ {
int xm;
RECT rc[3] = { RECT rc[3] = {
{144, 96, 168, 120}, {144, 96, 168, 120},
{168, 96, 192, 120}, {168, 96, 192, 120},
{192, 96, 216, 120}, {192, 96, 216, 120},
}; };
int xm;
switch (npc->act_no) switch (npc->act_no)
{ {
case 0: case 0:

View file

@ -592,7 +592,6 @@ void ActNpc341(NPCHAR *npc)
void ActNpc342(NPCHAR *npc) void ActNpc342(NPCHAR *npc)
{ {
static int flash; static int flash;
unsigned char deg;
RECT rc[3] = { RECT rc[3] = {
{240, 48, 280, 88}, {240, 48, 280, 88},
@ -600,6 +599,8 @@ void ActNpc342(NPCHAR *npc)
{280, 48, 320, 88}, {280, 48, 320, 88},
}; };
unsigned char deg;
if (npc->act_no < 1000 && npc->pNpc->act_no >= 1000) if (npc->act_no < 1000 && npc->pNpc->act_no >= 1000)
npc->act_no = 1000; npc->act_no = 1000;
@ -905,8 +906,6 @@ void ActNpc344(NPCHAR *npc)
// Ballos skull projectile // Ballos skull projectile
void ActNpc345(NPCHAR *npc) void ActNpc345(NPCHAR *npc)
{ {
int i;
RECT rc[4] = { RECT rc[4] = {
{128, 176, 144, 192}, {128, 176, 144, 192},
{144, 176, 160, 192}, {144, 176, 160, 192},
@ -914,6 +913,8 @@ void ActNpc345(NPCHAR *npc)
{176, 176, 192, 192}, {176, 176, 192, 192},
}; };
int i;
switch (npc->act_no) switch (npc->act_no)
{ {
case 0: case 0:
@ -974,9 +975,8 @@ void ActNpc345(NPCHAR *npc)
// Ballos 4 orbiting platform // Ballos 4 orbiting platform
void ActNpc346(NPCHAR *npc) void ActNpc346(NPCHAR *npc)
{ {
unsigned char deg;
RECT rc = {240, 0, 272, 16}; RECT rc = {240, 0, 272, 16};
unsigned char deg;
if (npc->act_no < 1000 && npc->pNpc->act_no >= 1000) if (npc->act_no < 1000 && npc->pNpc->act_no >= 1000)
npc->act_no = 1000; npc->act_no = 1000;
@ -1724,9 +1724,7 @@ void ActNpc353(NPCHAR *npc)
// Invisible deathtrap wall // Invisible deathtrap wall
void ActNpc354(NPCHAR *npc) void ActNpc354(NPCHAR *npc)
{ {
int i; int i, x, y;
int x;
int y;
switch (npc->act_no) switch (npc->act_no)
{ {