ref: b62471120416b1eaeb1274d0beb08191592a51d6
parent: 74bdbf86ca1ca3f78025ab92c37248419d9e8907
author: Clownacy <[email protected]>
date: Wed Jan 30 13:56:01 EST 2019
Added Grasstown Critters
--- a/src/NpcAct.h
+++ b/src/NpcAct.h
@@ -21,9 +21,10 @@
void ActNpc021(NPCHAR *npc);
void ActNpc022(NPCHAR *npc);
void ActNpc023(NPCHAR *npc);
-
+void ActNpc024(NPCHAR *npc);
void ActNpc025(NPCHAR *npc);
+void ActNpc028(NPCHAR *npc);
void ActNpc029(NPCHAR *npc);
void ActNpc030(NPCHAR *npc);
--- a/src/NpcAct020.cpp
+++ b/src/NpcAct020.cpp
@@ -9,6 +9,7 @@
#include "Back.h"
#include "Triangle.h"
#include "Caret.h"
+#include "Frame.h"
//Computer
void ActNpc020(NPCHAR *npc)
@@ -108,6 +109,184 @@
npc->rect = rect[npc->ani_no];
}
+//Power Critter
+void ActNpc024(NPCHAR *npc)
+{
+ RECT rcLeft[6];
+ RECT rcRight[6];
+
+ rcLeft[0] = {0, 0, 24, 24};
+ rcLeft[1] = {24, 0, 48, 24};
+ rcLeft[2] = {48, 0, 72, 24};
+ rcLeft[3] = {72, 0, 96, 24};
+ rcLeft[4] = {96, 0, 120, 24};
+ rcLeft[5] = {120, 0, 144, 24};
+
+ rcRight[0] = {0, 24, 24, 48};
+ rcRight[1] = {24, 24, 48, 48};
+ rcRight[2] = {48, 24, 72, 48};
+ rcRight[3] = {72, 24, 96, 48};
+ rcRight[4] = {96, 24, 120, 48};
+ rcRight[5] = {120, 24, 144, 48};
+
+ switch (npc->act_no)
+ {
+ case 0:
+ npc->y += 0x600;
+ npc->act_no = 1;
+ // Fallthrough
+ case 1:
+ if (npc->act_wait >= 8 && gMC.x > npc->x - 0x10000 && gMC.x < npc->x + 0x10000 && gMC.y > npc->y - 0x10000 && gMC.y < npc->y + 0x6000)
+ {
+ if (gMC.x < npc->x)
+ npc->direct = 0;
+ else
+ npc->direct = 2;
+
+ npc->ani_no = 1;
+ }
+ else
+ {
+ if (npc->act_wait < 8)
+ ++npc->act_wait;
+
+ npc->ani_no = 0;
+ }
+
+ if (npc->shock)
+ {
+ npc->act_no = 2;
+ npc->ani_no = 0;
+ npc->act_wait = 0;
+ }
+
+ if (npc->act_wait >= 8 && gMC.x > npc->x - 0xC000 && gMC.x < npc->x + 0xC000 && gMC.y > npc->y - 0xC000 && gMC.y < npc->y + 0x6000)
+ {
+ npc->act_no = 2;
+ npc->ani_no = 0;
+ npc->act_wait = 0;
+ }
+
+ break;
+
+ case 2:
+ if (++npc->act_wait > 8)
+ {
+ npc->act_no = 3;
+ npc->ani_no = 2;
+ npc->ym = -0x5FF;
+ PlaySoundObject(108, 1);
+
+ if (gMC.x < npc->x)
+ npc->direct = 0;
+ else
+ npc->direct = 2;
+
+ if (npc->direct == 0)
+ npc->xm = -0x100;
+ else
+ npc->xm = 0x100;
+ }
+
+ break;
+
+ case 3:
+ if (npc->ym > 0x200)
+ {
+ npc->tgt_y = npc->y;
+ npc->act_no = 4;
+ npc->ani_no = 3;
+ npc->act_wait = 0;
+ npc->act_wait = 0;
+ }
+
+ break;
+
+ case 4:
+ if (gMC.x > npc->x)
+ npc->direct = 2;
+ else
+ npc->direct = 0;
+
+ ++npc->act_wait;
+
+ if (npc->flag & 7 || npc->act_wait > 100)
+ {
+ npc->damage = 12;
+ npc->act_no = 5;
+ npc->ani_no = 2;
+ npc->xm /= 2;
+ }
+ else
+ {
+ if (npc->act_wait % 4 == 1)
+ PlaySoundObject(110, 1);
+
+ if (++npc->ani_wait > 0)
+ {
+ npc->ani_wait = 0;
+ ++npc->ani_no;
+ }
+
+ if (npc->ani_no > 5)
+ npc->ani_no = 3;
+ }
+
+ break;
+
+ case 5:
+ if (npc->flag & 8)
+ {
+ npc->damage = 2;
+ npc->xm = 0;
+ npc->act_wait = 0;
+ npc->ani_no = 0;
+ npc->act_no = 1;
+ PlaySoundObject(26, 1);
+ SetQuake(30);
+ }
+
+ break;
+ }
+
+ if (npc->act_no == 4)
+ {
+ if (gMC.x > npc->x)
+ npc->xm += 0x20;
+ else
+ npc->xm -= 0x20;
+
+ if (npc->tgt_y < npc->y)
+ npc->ym -= 0x10;
+ else
+ npc->ym += 0x10;
+
+ if (npc->ym > 0x200)
+ npc->ym = 0x200;
+ if (npc->ym < -0x200)
+ npc->ym = -0x200;
+
+ if (npc->xm > 0x200)
+ npc->xm = 0x200;
+ if (npc->xm < -0x200)
+ npc->xm = -0x200;
+ }
+ else
+ {
+ npc->ym += 0x20;
+ if (npc->ym > 0x5FF)
+ npc->ym = 0x5FF;
+ }
+
+ npc->x += npc->xm;
+ npc->y += npc->ym;
+
+ if (npc->direct == 0)
+ npc->rect = rcLeft[npc->ani_no];
+ else
+ npc->rect = rcRight[npc->ani_no];
+}
+
// Egg Corridor lift
void ActNpc025(NPCHAR *npc)
{
@@ -232,6 +411,186 @@
}
npc->rect = rcLeft[npc->ani_no];
+}
+
+//Flying Critter (Grasstown)
+void ActNpc028(NPCHAR *npc)
+{
+ RECT rcLeft[6];
+ RECT rcRight[6];
+
+ rcLeft[0] = {0, 48, 16, 64};
+ rcLeft[1] = {16, 48, 32, 64};
+ rcLeft[2] = {32, 48, 48, 64};
+ rcLeft[3] = {48, 48, 64, 64};
+ rcLeft[4] = {64, 48, 80, 64};
+ rcLeft[5] = {80, 48, 96, 64};
+
+ rcRight[0] = {0, 64, 16, 80};
+ rcRight[1] = {16, 64, 32, 80};
+ rcRight[2] = {32, 64, 48, 80};
+ rcRight[3] = {48, 64, 64, 80};
+ rcRight[4] = {64, 64, 80, 80};
+ rcRight[5] = {80, 64, 96, 80};
+
+ switch (npc->act_no)
+ {
+ case 0:
+ npc->y += 0x600;
+ npc->act_no = 1;
+ // Fallthrough
+ case 1:
+ if (npc->act_wait >= 8 && gMC.x > npc->x - 0x10000 && gMC.x < npc->x + 0x10000 && gMC.y > npc->y - 0x10000 && gMC.y < npc->y + 0x6000)
+ {
+ if (gMC.x < npc->x)
+ npc->direct = 0;
+ else
+ npc->direct = 2;
+
+ npc->ani_no = 1;
+ }
+ else
+ {
+ if (npc->act_wait < 8)
+ ++npc->act_wait;
+
+ npc->ani_no = 0;
+ }
+
+ if (npc->shock)
+ {
+ npc->act_no = 2;
+ npc->ani_no = 0;
+ npc->act_wait = 0;
+ }
+
+ if ( npc->act_wait >= 8 && gMC.x > npc->x - 0xC000 && gMC.x < npc->x + 0xC000 && gMC.y > npc->y - 0xC000 && gMC.y < npc->y + 0x6000)
+ {
+ npc->act_no = 2;
+ npc->ani_no = 0;
+ npc->act_wait = 0;
+ }
+
+ break;
+
+ case 2:
+ if (++npc->act_wait > 8)
+ {
+ npc->act_no = 3;
+ npc->ani_no = 2;
+ npc->ym = -1228;
+ PlaySoundObject(30, 1);
+
+ if (gMC.x < npc->x)
+ npc->direct = 0;
+ else
+ npc->direct = 2;
+
+ if (npc->direct == 0)
+ npc->xm = -0x100u;
+ else
+ npc->xm = 0x100;
+ }
+
+ break;
+
+ case 3:
+ if (npc->ym > 0x100)
+ {
+ npc->tgt_y = npc->y;
+ npc->act_no = 4;
+ npc->ani_no = 3;
+ npc->act_wait = 0;
+ npc->act_wait = 0;
+ }
+
+ break;
+
+ case 4:
+ if (gMC.x > npc->x)
+ npc->direct = 2;
+ else
+ npc->direct = 0;
+
+ ++npc->act_wait;
+
+ if (npc->flag & 7 || npc->act_wait > 100)
+ {
+ npc->damage = 3;
+ npc->act_no = 5;
+ npc->ani_no = 2;
+ npc->xm /= 2;
+ }
+ else
+ {
+ if (npc->act_wait % 4 == 1)
+ PlaySoundObject(109, 1);
+
+ if (npc->flag & 8)
+ npc->ym = -0x200;
+
+ if (++npc->ani_wait > 0)
+ {
+ npc->ani_wait = 0;
+ ++npc->ani_no;
+ }
+
+ if (npc->ani_no > 5)
+ npc->ani_no = 3;
+ }
+
+ break;
+
+ case 5:
+ if (npc->flag & 8)
+ {
+ npc->damage = 2;
+ npc->xm = 0;
+ npc->act_wait = 0;
+ npc->ani_no = 0;
+ npc->act_no = 1;
+ PlaySoundObject(23, 1);
+ }
+
+ break;
+ }
+
+ if (npc->act_no == 4)
+ {
+ if (gMC.x > npc->x)
+ npc->xm += 0x20;
+ else
+ npc->xm -= 0x20;
+
+ if (npc->tgt_y < npc->y)
+ npc->ym -= 0x10;
+ else
+ npc->ym += 0x10;
+
+ if (npc->ym > 0x200)
+ npc->ym = 0x200;
+ if (npc->ym < -0x200)
+ npc->ym = -0x200;
+
+ if (npc->xm > 0x200)
+ npc->xm = 0x200;
+ if (npc->xm < -0x200)
+ npc->xm = -0x200;
+ }
+ else
+ {
+ npc->ym += 0x40;
+ if (npc->ym > 0x5FF)
+ npc->ym = 0x5FF;
+ }
+
+ npc->x += npc->xm;
+ npc->y += npc->ym;
+
+ if (npc->direct == 0)
+ npc->rect = rcLeft[npc->ani_no];
+ else
+ npc->rect = rcRight[npc->ani_no];
}
//Cthulhu
--- a/src/NpcTbl.cpp
+++ b/src/NpcTbl.cpp
@@ -80,11 +80,11 @@
ActNpc021,
ActNpc022,
ActNpc023,
- nullptr,
+ ActNpc024,
ActNpc025,
nullptr,
nullptr,
- nullptr,
+ ActNpc028,
ActNpc029,
ActNpc030,
nullptr,