diff --git a/src/NpcAct020.cpp b/src/NpcAct020.cpp index 8aa60869..831de00a 100644 --- a/src/NpcAct020.cpp +++ b/src/NpcAct020.cpp @@ -1096,10 +1096,9 @@ void ActNpc035(NPCHAR *npc) // Balrog (hover) void ActNpc036(NPCHAR *npc) { - unsigned char deg; - int ym; - int xm; int i; + unsigned char deg; + int xm, ym; switch (npc->act_no) { diff --git a/src/NpcAct040.cpp b/src/NpcAct040.cpp index efa1b44e..05ba33f5 100644 --- a/src/NpcAct040.cpp +++ b/src/NpcAct040.cpp @@ -118,6 +118,8 @@ void ActNpc041(NPCHAR *npc) // Sue void ActNpc042(NPCHAR *npc) { + int n; + RECT rcLeft[13] = { {0, 0, 16, 16}, {16, 0, 32, 16}, @@ -150,8 +152,6 @@ void ActNpc042(NPCHAR *npc) {160, 48, 176, 64}, }; - int n; - switch (npc->act_no) { case 0: @@ -870,8 +870,7 @@ void ActNpc048(NPCHAR *npc) void ActNpc049(NPCHAR *npc) { unsigned char deg; - int ym; - int xm; + int xm, ym; 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 { unsigned char deg; - int ym; int xm; + int ym; deg = GetArktan(npc->x - gMC.x, npc->y - gMC.y); deg += (unsigned char)Random(-6, 6); diff --git a/src/NpcAct060.cpp b/src/NpcAct060.cpp index c9ab0083..df3569e2 100644 --- a/src/NpcAct060.cpp +++ b/src/NpcAct060.cpp @@ -199,6 +199,8 @@ void ActNpc060(NPCHAR *npc) // King void ActNpc061(NPCHAR *npc) { + int i; + RECT rcLeft[11] = { {224, 32, 240, 48}, {240, 32, 256, 48}, @@ -227,8 +229,6 @@ void ActNpc061(NPCHAR *npc) {112, 32, 128, 48}, }; - int i; - switch (npc->act_no) { case 0: diff --git a/src/NpcAct080.cpp b/src/NpcAct080.cpp index 03183775..35c8d9cb 100644 --- a/src/NpcAct080.cpp +++ b/src/NpcAct080.cpp @@ -877,8 +877,7 @@ void ActNpc088(NPCHAR *npc) { int i; unsigned char deg; - int xm; - int ym; + int xm, ym; RECT rcLeft[12] = { {0, 0, 40, 40}, diff --git a/src/NpcAct100.cpp b/src/NpcAct100.cpp index 0c7ec627..2ee69c83 100644 --- a/src/NpcAct100.cpp +++ b/src/NpcAct100.cpp @@ -1068,14 +1068,14 @@ void ActNpc113(NPCHAR *npc) // Press void ActNpc114(NPCHAR *npc) { - int i; - RECT rcLeft[3] = { {144, 112, 160, 136}, {160, 112, 176, 136}, {176, 112, 192, 136}, }; + int i; + switch (npc->act_no) { case 0: @@ -1521,6 +1521,8 @@ void ActNpc117(NPCHAR *npc) // Curly (boss) void ActNpc118(NPCHAR *npc) { + BOOL bUpper; + RECT rcLeft[9] = { {0, 32, 32, 56}, {32, 32, 64, 56}, @@ -1545,7 +1547,7 @@ void ActNpc118(NPCHAR *npc) {160, 56, 192, 80}, }; - BOOL bUpper = FALSE; + bUpper = FALSE; if (npc->direct == 0 && npc->x < gMC.x) bUpper = TRUE; diff --git a/src/NpcAct120.cpp b/src/NpcAct120.cpp index 0d8c1f05..1e0516e5 100644 --- a/src/NpcAct120.cpp +++ b/src/NpcAct120.cpp @@ -1090,8 +1090,7 @@ void ActNpc134(NPCHAR *npc) void ActNpc135(NPCHAR *npc) { unsigned char deg; - int ym; - int xm; + int xm, ym; RECT rcLeft[2] = { {256, 32, 288, 64}, diff --git a/src/NpcAct140.cpp b/src/NpcAct140.cpp index 607fc47d..d2f71171 100644 --- a/src/NpcAct140.cpp +++ b/src/NpcAct140.cpp @@ -764,9 +764,8 @@ void ActNpc146(NPCHAR *npc) // Critter (purple) void ActNpc147(NPCHAR *npc) { + int xm, ym; unsigned char deg; - int xm; - int ym; RECT rcLeft[6] = { {0, 96, 16, 112}, @@ -1349,7 +1348,7 @@ void ActNpc152(NPCHAR *npc) npc->rect = rc; } -static const RECT grcKitL[21] = { +const RECT grcKitL[21] = { {0, 0, 24, 24}, {24, 0, 48, 24}, {48, 0, 72, 24}, @@ -1373,7 +1372,7 @@ static const RECT grcKitL[21] = { {96, 48, 120, 72} }; -static const RECT grcKitR[21] = { +const RECT grcKitR[21] = { {0, 24, 24, 48}, {24, 24, 48, 48}, {48, 24, 72, 48}, @@ -1624,8 +1623,7 @@ void ActNpc154(NPCHAR *npc) void ActNpc155(NPCHAR *npc) { unsigned char deg; - int ym; - int xm; + int xm, ym; 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; diff --git a/src/NpcAct160.cpp b/src/NpcAct160.cpp index fa556095..a4dc6f80 100644 --- a/src/NpcAct160.cpp +++ b/src/NpcAct160.cpp @@ -1071,8 +1071,7 @@ void ActNpc172(NPCHAR *npc) void ActNpc173(NPCHAR *npc) { unsigned char deg; - int xm; - int ym; + int xm, ym; RECT rcLeft[4] = { {0, 128, 24, 152}, diff --git a/src/NpcAct180.cpp b/src/NpcAct180.cpp index 2d362ff3..8e3651c6 100644 --- a/src/NpcAct180.cpp +++ b/src/NpcAct180.cpp @@ -19,8 +19,7 @@ // Curly AI void ActNpc180(NPCHAR *npc) { - int xx; - int yy; + int xx, yy; RECT rcLeft[11] = { {0, 96, 16, 112}, @@ -978,13 +977,13 @@ void ActNpc189(NPCHAR *npc) // Broken robot void ActNpc190(NPCHAR *npc) { - int i; - RECT rect[2] = { {192, 32, 208, 48}, {208, 32, 224, 48}, }; + int i; + switch (npc->act_no) { case 0: diff --git a/src/NpcAct200.cpp b/src/NpcAct200.cpp index 61219dc2..2fdd8be7 100644 --- a/src/NpcAct200.cpp +++ b/src/NpcAct200.cpp @@ -17,8 +17,7 @@ void ActNpc200(NPCHAR *npc) { unsigned char deg; - int ym; - int xm; + int xm, ym; RECT rcLeft[6] = { {0, 0, 40, 40}, @@ -475,8 +474,8 @@ void ActNpc206(NPCHAR *npc) case 3: switch (npc->act_wait) { - // Interestingly, this NPC counts down at 60 frames per second, - // while the NPC322 (Deleet), counts at 50. + // Interestingly, this NPC counts down at 60 frames + // per second, while NPC322 (Deleet) counts at 50. case 60 * 0: SetNpChar(207, npc->x + (16 * 0x200), npc->y + (4 * 0x200), 0, 0, 0, NULL, 0x100); break; diff --git a/src/NpcAct220.cpp b/src/NpcAct220.cpp index d51fbfe7..07628d3a 100644 --- a/src/NpcAct220.cpp +++ b/src/NpcAct220.cpp @@ -1129,11 +1129,11 @@ void ActNpc236(NPCHAR *npc) // Gunfish projectile void ActNpc237(NPCHAR *npc) { + RECT rc = {312, 32, 320, 40}; + int i; BOOL bHit; - RECT rc = {312, 32, 320, 40}; - switch (npc->act_no) { case 0: diff --git a/src/NpcAct240.cpp b/src/NpcAct240.cpp index 957aff0e..a92a310e 100644 --- a/src/NpcAct240.cpp +++ b/src/NpcAct240.cpp @@ -318,12 +318,14 @@ void ActNpc243(NPCHAR *npc) // Lava drop void ActNpc244(NPCHAR *npc) { + RECT rc = {96, 0, 104, 16}; + BOOL bHit; + int i; - RECT rc = {96, 0, 104, 16}; npc->ym += 0x40; - BOOL bHit = FALSE; + bHit = FALSE; if (npc->flag & 0xFF) bHit = TRUE; @@ -411,14 +413,14 @@ void ActNpc245(NPCHAR *npc) // Press (proximity) void ActNpc246(NPCHAR *npc) { - int i; - RECT rcLeft[3] = { {144, 112, 160, 136}, {160, 112, 176, 136}, {176, 112, 192, 136}, }; + int i; + switch (npc->act_no) { case 0: @@ -504,8 +506,7 @@ void ActNpc246(NPCHAR *npc) void ActNpc247(NPCHAR *npc) { unsigned char deg; - int ym; - int xm; + int xm, ym; RECT rcLeft[9] = { {0, 0, 16, 16}, diff --git a/src/NpcAct260.cpp b/src/NpcAct260.cpp index 485c1267..fe7e81e2 100644 --- a/src/NpcAct260.cpp +++ b/src/NpcAct260.cpp @@ -186,8 +186,7 @@ void ActNpc262(NPCHAR *npc) void ActNpc263(NPCHAR *npc) { int deg; - int xm; - int ym; + int xm, ym; RECT rcLeft[9] = { {0, 0, 24, 32}, @@ -469,9 +468,8 @@ void ActNpc263(NPCHAR *npc) // Doctor red wave (projectile) void ActNpc264(NPCHAR *npc) { - unsigned char deg; - RECT rc = {288, 0, 304, 16}; + unsigned char deg; if (npc->x < 0 || npc->x > gMap.width * 0x10 * 0x200) { @@ -597,8 +595,7 @@ void ActNpc267(NPCHAR *npc) {40, 160, 80, 208}, }; - int ym; - int xm; + int xm, ym; int i; switch (npc->act_no) @@ -1133,8 +1130,7 @@ void ActNpc267(NPCHAR *npc) void ActNpc268(NPCHAR *npc) { unsigned char deg; - int ym; - int xm; + int xm, ym; RECT rcLeft[10] = { {0, 0, 40, 40}, @@ -1631,8 +1627,7 @@ void ActNpc274(NPCHAR *npc) }; unsigned char deg; - int ym; - int xm; + int xm, ym; switch (npc->act_no) { @@ -1825,8 +1820,7 @@ void ActNpc276(NPCHAR *npc) }; unsigned char deg; - int ym; - int xm; + int xm, ym; switch (npc->act_no) { @@ -2158,13 +2152,13 @@ void ActNpc278(NPCHAR *npc) // Falling block (large) void ActNpc279(NPCHAR *npc) { - int i; - RECT rc[2] = { {0, 16, 32, 48}, {16, 0, 32, 16}, }; + int i; + switch (npc->act_no) { case 0: diff --git a/src/NpcAct280.cpp b/src/NpcAct280.cpp index 76d89476..111902e3 100644 --- a/src/NpcAct280.cpp +++ b/src/NpcAct280.cpp @@ -129,6 +129,7 @@ void ActNpc281(NPCHAR *npc) // Mini Undead Core (active) void ActNpc282(NPCHAR *npc) { + // Yes, Pixel spelt this wrong (should be 'rc') RECT tc[3] = { {256, 80, 320, 120}, {256, 0, 320, 40}, @@ -203,9 +204,7 @@ void ActNpc282(NPCHAR *npc) // Misery (transformed) void ActNpc283(NPCHAR *npc) { - int x; - int y; - int direct; + int x, y, direct; RECT rcLeft[11] = { {0, 64, 32, 96}, @@ -966,6 +965,7 @@ void ActNpc284(NPCHAR *npc) void ActNpc285(NPCHAR *npc) { RECT rc = {232, 104, 248, 120}; + unsigned char deg; if (npc->x < 0 || npc->x > gMap.width * 0x10 * 0x200) { @@ -973,8 +973,6 @@ void ActNpc285(NPCHAR *npc) return; } - unsigned char deg; - switch (npc->act_no) { case 0: @@ -1422,9 +1420,7 @@ void ActNpc293(NPCHAR *npc) // Quake + falling block generator void ActNpc294(NPCHAR *npc) { - int x; - int y; - int dir; + int x, y, dir; switch (npc->act_no) { @@ -1567,10 +1563,7 @@ void ActNpc295(NPCHAR *npc) // Cloud generator void ActNpc296(NPCHAR *npc) { - int x; - int y; - int dir; - int pri; + int x, y, dir, pri; if (++npc->act_wait > 16) { diff --git a/src/NpcAct300.cpp b/src/NpcAct300.cpp index fa1feaef..3ee8e87e 100644 --- a/src/NpcAct300.cpp +++ b/src/NpcAct300.cpp @@ -35,6 +35,8 @@ void ActNpc300(NPCHAR *npc) // Fish missile (Misery) void ActNpc301(NPCHAR *npc) { + int dir; + RECT rect[8] = { {144, 0, 160, 16}, {160, 0, 176, 16}, @@ -46,8 +48,6 @@ void ActNpc301(NPCHAR *npc) {192, 16, 208, 32}, }; - int dir; - switch (npc->act_no) { case 0: @@ -102,6 +102,8 @@ void ActNpc301(NPCHAR *npc) // Camera focus marker void ActNpc302(NPCHAR *npc) { + int n; + switch (npc->act_no) { case 10: @@ -143,18 +145,16 @@ void ActNpc302(NPCHAR *npc) if (npc->direct != 0) { - int i; - - for (i = 0xAA; i < 0x200; ++i) + for (n = 0xAA; n < 0x200; ++n) { - 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; } } - if (i == 0x200) + if (n == 0x200) { npc->cond = 0; break; @@ -401,6 +401,8 @@ void ActNpc307(NPCHAR *npc) // Stumpy void ActNpc308(NPCHAR *npc) { + unsigned char deg; + RECT rcLeft[2] = { {128, 112, 144, 128}, {144, 112, 160, 128}, @@ -411,8 +413,6 @@ void ActNpc308(NPCHAR *npc) {144, 128, 160, 144}, }; - unsigned char deg; - switch (npc->act_no) { case 0: diff --git a/src/NpcAct320.cpp b/src/NpcAct320.cpp index 7e1cb3c9..89e6f621 100644 --- a/src/NpcAct320.cpp +++ b/src/NpcAct320.cpp @@ -220,7 +220,7 @@ void ActNpc322(NPCHAR *npc) switch (npc->act_wait) { // 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: SetNpChar(207, npc->x + (4 * 0x200), npc->y, 0, 0, 0, NULL, 0x180); break; @@ -801,14 +801,14 @@ void ActNpc331(NPCHAR *npc) // Ballos shockwave void ActNpc332(NPCHAR *npc) { - int xm; - RECT rc[3] = { {144, 96, 168, 120}, {168, 96, 192, 120}, {192, 96, 216, 120}, }; + int xm; + switch (npc->act_no) { case 0: diff --git a/src/NpcAct340.cpp b/src/NpcAct340.cpp index 3b174ef5..32918b9a 100644 --- a/src/NpcAct340.cpp +++ b/src/NpcAct340.cpp @@ -592,7 +592,6 @@ void ActNpc341(NPCHAR *npc) void ActNpc342(NPCHAR *npc) { static int flash; - unsigned char deg; RECT rc[3] = { {240, 48, 280, 88}, @@ -600,6 +599,8 @@ void ActNpc342(NPCHAR *npc) {280, 48, 320, 88}, }; + unsigned char deg; + if (npc->act_no < 1000 && npc->pNpc->act_no >= 1000) npc->act_no = 1000; @@ -905,8 +906,6 @@ void ActNpc344(NPCHAR *npc) // Ballos skull projectile void ActNpc345(NPCHAR *npc) { - int i; - RECT rc[4] = { {128, 176, 144, 192}, {144, 176, 160, 192}, @@ -914,6 +913,8 @@ void ActNpc345(NPCHAR *npc) {176, 176, 192, 192}, }; + int i; + switch (npc->act_no) { case 0: @@ -974,9 +975,8 @@ void ActNpc345(NPCHAR *npc) // Ballos 4 orbiting platform void ActNpc346(NPCHAR *npc) { - unsigned char deg; - RECT rc = {240, 0, 272, 16}; + unsigned char deg; if (npc->act_no < 1000 && npc->pNpc->act_no >= 1000) npc->act_no = 1000; @@ -1724,9 +1724,7 @@ void ActNpc353(NPCHAR *npc) // Invisible deathtrap wall void ActNpc354(NPCHAR *npc) { - int i; - int x; - int y; + int i, x, y; switch (npc->act_no) {