Document ActNpc061 (King)

This commit is contained in:
Clownacy 2020-03-27 17:48:08 +00:00
parent db1b1d80f8
commit ca6538561f
3 changed files with 45 additions and 37 deletions

View file

@ -160,7 +160,7 @@ void SetDestroyNpChar(int x, int y, int w, int num)
{ {
offset_x = Random(-w, w) * 0x200; offset_x = Random(-w, w) * 0x200;
offset_y = Random(-w, w) * 0x200; offset_y = Random(-w, w) * 0x200;
SetNpChar(4, x + offset_x, y + offset_y, 0, 0, 0, NULL, 0x100); SetNpChar(NPC_SMOKE, x + offset_x, y + offset_y, 0, 0, 0, NULL, 0x100);
} }
// Flash effect // Flash effect

View file

@ -47,8 +47,9 @@ enum NPCNames
NPC_MALCO_UNDAMAGED = 107, NPC_MALCO_UNDAMAGED = 107,
NPC_PROJECTILE_BALFROG_SPITBALL = 108, NPC_PROJECTILE_BALFROG_SPITBALL = 108,
NPC_MALCO_DAMAGED = 109, NPC_MALCO_DAMAGED = 109,
NPC_ENEMY_PUCHI = 110 NPC_ENEMY_PUCHI = 110,
// To be continued // To be continued
NPC_KINGS_SWORD = 145
}; };
typedef struct NPCHAR typedef struct NPCHAR

View file

@ -202,36 +202,40 @@ void ActNpc061(NPCHAR *npc)
int i; int i;
RECT rcLeft[11] = { RECT rcLeft[11] = {
{224, 32, 240, 48}, // NpcRegu
{240, 32, 256, 48}, {224, 32, 240, 48}, // 0 - Stood
{256, 32, 272, 48}, {240, 32, 256, 48}, // 1 - Blinking
{272, 32, 288, 48}, {256, 32, 272, 48}, // 2 - Injured - falling backwards
{288, 32, 304, 48}, {272, 32, 288, 48}, // 3 - Lying down
{224, 32, 240, 48}, {288, 32, 304, 48}, // 4 - Walking - frame 1
{304, 32, 320, 48}, {224, 32, 240, 48}, // 5 - Walking - frame 2
{224, 32, 240, 48}, {304, 32, 320, 48}, // 6 - Walking - frame 3
{272, 32, 288, 48}, {224, 32, 240, 48}, // 7 - Walking - frame 4
{0, 0, 0, 0}, {272, 32, 288, 48}, // 8 - Dying - frame 1
{112, 32, 128, 48}, {0, 0, 0, 0}, // 9 - Dying - frame 2
// NpcSym
{112, 32, 128, 48}, // 10 - King's sword
}; };
RECT rcRight[11] = { RECT rcRight[11] = {
{224, 48, 240, 64}, // NpcRegu
{240, 48, 256, 64}, {224, 48, 240, 64}, // 0 - Stood
{256, 48, 272, 64}, {240, 48, 256, 64}, // 1 - Blinking
{272, 48, 288, 64}, {256, 48, 272, 64}, // 2 - Injured - falling backwards
{288, 48, 304, 64}, {272, 48, 288, 64}, // 3 - Lying down
{224, 48, 240, 64}, {288, 48, 304, 64}, // 4 - Walking - frame 1
{304, 48, 320, 64}, {224, 48, 240, 64}, // 5 - Walking - frame 2
{224, 48, 240, 64}, {304, 48, 320, 64}, // 6 - Walking - frame 3
{272, 48, 288, 64}, {224, 48, 240, 64}, // 7 - Walking - frame 4
{0, 0, 0, 0}, {272, 48, 288, 64}, // 8 - Dying - frame 1
{112, 32, 128, 48}, {0, 0, 0, 0}, // 9 - Dying - frame 2
// NpcSym
{112, 32, 128, 48}, // 10 - King's sword
}; };
switch (npc->act_no) switch (npc->act_no)
{ {
case 0: case 0: // Stood
npc->act_no = 1; npc->act_no = 1;
npc->ani_no = 0; npc->ani_no = 0;
npc->ani_wait = 0; npc->ani_wait = 0;
@ -247,7 +251,7 @@ void ActNpc061(NPCHAR *npc)
break; break;
case 2: case 2: // Blink
if (++npc->act_wait > 8) if (++npc->act_wait > 8)
{ {
npc->act_no = 1; npc->act_no = 1;
@ -256,12 +260,12 @@ void ActNpc061(NPCHAR *npc)
break; break;
case 5: case 5: // Lying down
npc->ani_no = 3; npc->ani_no = 3;
npc->xm = 0; npc->xm = 0;
break; break;
case 6: case 6: // Being knocked-back
npc->act_no = 7; npc->act_no = 7;
npc->act_wait = 0; npc->act_wait = 0;
npc->ani_wait = 0; npc->ani_wait = 0;
@ -275,12 +279,14 @@ void ActNpc061(NPCHAR *npc)
else else
npc->xm = 0x200; npc->xm = 0x200;
// If touching ground, enter 'lying down' state (the `act_wait` check is probably
// so he doesn't do it before he even leaves the ground in the first place)
if (npc->act_wait++ != 0 && npc->flag & 8) if (npc->act_wait++ != 0 && npc->flag & 8)
npc->act_no = 5; npc->act_no = 5;
break; break;
case 8: case 8: // Walking
npc->act_no = 9; npc->act_no = 9;
npc->ani_no = 4; npc->ani_no = 4;
npc->ani_wait = 0; npc->ani_wait = 0;
@ -302,7 +308,7 @@ void ActNpc061(NPCHAR *npc)
break; break;
case 10: case 10: // Running
npc->act_no = 11; npc->act_no = 11;
npc->ani_no = 4; npc->ani_no = 4;
npc->ani_wait = 0; npc->ani_wait = 0;
@ -324,13 +330,13 @@ void ActNpc061(NPCHAR *npc)
break; break;
case 20: case 20: // Spawn his sword, before entering his 'idle' state
SetNpChar(145, 0, 0, 0, 0, 2, npc, 0x100); SetNpChar(NPC_KINGS_SWORD, 0, 0, 0, 0, 2, npc, 0x100);
npc->ani_no = 0; npc->ani_no = 0;
npc->act_no = 0; npc->act_no = 0;
break; break;
case 30: case 30: // Flying through air after being attacked by Misery
npc->act_no = 31; npc->act_no = 31;
npc->act_wait = 0; npc->act_wait = 0;
npc->ani_wait = 0; npc->ani_wait = 0;
@ -358,7 +364,7 @@ void ActNpc061(NPCHAR *npc)
break; break;
case 40: case 40: // Dying
npc->act_no = 42; npc->act_no = 42;
npc->act_wait = 0; npc->act_wait = 0;
npc->ani_no = 8; npc->ani_no = 8;
@ -371,7 +377,7 @@ void ActNpc061(NPCHAR *npc)
if (++npc->act_wait > 100) if (++npc->act_wait > 100)
{ {
for (i = 0; i < 4; ++i) for (i = 0; i < 4; ++i)
SetNpChar(4, npc->x + (Random(-12, 12) * 0x200), npc->y + (Random(-12, 12) * 0x200), Random(-341, 341), Random(-0x600, 0), 0, NULL, 0x100); SetNpChar(NPC_SMOKE, npc->x + (Random(-12, 12) * 0x200), npc->y + (Random(-12, 12) * 0x200), Random(-341, 341), Random(-0x600, 0), 0, NULL, 0x100);
npc->act_no = 50; npc->act_no = 50;
npc->surf = SURFACE_ID_NPC_SYM; npc->surf = SURFACE_ID_NPC_SYM;
@ -380,7 +386,7 @@ void ActNpc061(NPCHAR *npc)
break; break;
case 60: case 60: // Leap (used to attack Balrog in the Sand Zone storehouse)
npc->ani_no = 6; npc->ani_no = 6;
npc->act_no = 61; npc->act_no = 61;
npc->ym = -0x5FF; npc->ym = -0x5FF;
@ -388,7 +394,7 @@ void ActNpc061(NPCHAR *npc)
npc->count2 = 1; npc->count2 = 1;
break; break;
case 61: case 61: // Leap - part 2
npc->ym += 0x40; npc->ym += 0x40;
if (npc->flag & 8) if (npc->flag & 8)
@ -401,6 +407,7 @@ void ActNpc061(NPCHAR *npc)
break; break;
} }
// Apply gravity and speed-caps during most states
if (npc->act_no < 30 || npc->act_no >= 40) if (npc->act_no < 30 || npc->act_no >= 40)
{ {
npc->ym += 0x40; npc->ym += 0x40;