ref: 1b09256c40aad4e19dcb820c43c43b34459e8fbf
parent: 28fed460effbfa0310d2bd63fa994f9a3b7db275
parent: 8650af1d9e5d3dac61b0efff23a31465884843fc
author: Cucky <44537737+cuckydev@users.noreply.github.com>
date: Thu Feb 7 15:23:19 EST 2019
Merge pull request #44 from Clownacy/master Plantation NPCs and the ZAM TSC command
--- a/src/Bullet.cpp
+++ b/src/Bullet.cpp
@@ -2331,3 +2331,35 @@
}
}
}
+
+bool IsActiveSomeBullet(void)
+{
+ for (int i = 0; i < 0x40; ++i)
+ {
+ if (gBul[i].cond & 0x80)
+ {
+ switch (gBul[i].code_bullet)
+ {
+ case 0xD:
+ case 0xE:
+ case 0xF:
+ case 0x10:
+ case 0x11:
+ case 0x12:
+ case 0x17:
+ case 0x19:
+ case 0x1A:
+ case 0x1B:
+ case 0x1C:
+ case 0x1D:
+ case 0x1E:
+ case 0x1F:
+ case 0x20:
+ case 0x21:
+ return true;
+ }
+ }
+ }
+
+ return false;
+}
\ No newline at end of file
--- a/src/Bullet.h
+++ b/src/Bullet.h
@@ -56,3 +56,4 @@
void PutBullet(int fx, int fy);
void SetBullet(int no, int x, int y, int dir);
void ActBullet();
+bool IsActiveSomeBullet(void);
--- a/src/NpcAct.h
+++ b/src/NpcAct.h
@@ -231,11 +231,26 @@
void ActNpc226(NPCHAR *npc);
void ActNpc227(NPCHAR *npc);
void ActNpc228(NPCHAR *npc);
+void ActNpc229(NPCHAR *npc);
+void ActNpc230(NPCHAR *npc);
+void ActNpc231(NPCHAR *npc);
+void ActNpc232(NPCHAR *npc);
+void ActNpc233(NPCHAR *npc);
+void ActNpc234(NPCHAR *npc);
+void ActNpc235(NPCHAR *npc);
+void ActNpc236(NPCHAR *npc);
+void ActNpc237(NPCHAR *npc);
+void ActNpc238(NPCHAR *npc);
+void ActNpc239(NPCHAR *npc);
+void ActNpc240(NPCHAR *npc);
void ActNpc259(NPCHAR *npc);
void ActNpc271(NPCHAR *npc);
void ActNpc272(NPCHAR *npc);
+void ActNpc273(NPCHAR *npc);
+void ActNpc274(NPCHAR *npc);
+void ActNpc275(NPCHAR *npc);
void ActNpc278(NPCHAR *npc);
@@ -247,13 +262,22 @@
void ActNpc302(NPCHAR *npc);
+void ActNpc308(NPCHAR *npc);
+
+void ActNpc313(NPCHAR *npc);
+void ActNpc314(NPCHAR *npc);
+void ActNpc315(NPCHAR *npc);
+
void ActNpc334(NPCHAR *npc);
void ActNpc335(NPCHAR *npc);
void ActNpc336(NPCHAR *npc);
+void ActNpc337(NPCHAR *npc);
void ActNpc347(NPCHAR *npc);
void ActNpc349(NPCHAR *npc);
+
+void ActNpc351(NPCHAR *npc);
void ActNpc355(NPCHAR *npc);
--- a/src/NpcAct220.cpp
+++ b/src/NpcAct220.cpp
@@ -510,3 +510,763 @@
else
npc->rect = rcRight[npc->ani_no];
}
+
+//Red Flowers (sprouts)
+void ActNpc229(NPCHAR *npc)
+{
+ RECT rc[2];
+
+ rc[0] = {0, 96, 48, 112};
+ rc[1] = {0, 112, 48, 128};
+
+ if (npc->act_no == 0)
+ {
+ npc->act_no = 1;
+ npc->y -= 0x2000;
+ }
+
+ if (npc->direct == 0)
+ npc->rect = rc[0];
+ else
+ npc->rect = rc[1];
+}
+
+//Red Flowers (blooming)
+void ActNpc230(NPCHAR *npc)
+{
+ RECT rc[2];
+
+ rc[0] = {48, 96, 96, 128};
+ rc[1] = {96, 96, 144, 128};
+
+ if (npc->act_no == 0)
+ {
+ npc->act_no = 1;
+ npc->x -= 0x2000;
+ npc->y -= 0x2000;
+ }
+
+ if (npc->direct == 0)
+ npc->rect = rc[0];
+ else
+ npc->rect = rc[1];
+}
+
+//Rocket
+void ActNpc231(NPCHAR *npc)
+{
+ RECT rc[2];
+
+ rc[0] = {176, 32, 208, 48};
+ rc[1] = {176, 48, 208, 64};
+
+ switch (npc->act_no)
+ {
+ case 0:
+ npc->act_no = 1;
+ // Fallthrough
+ case 1:
+ npc->ani_no = 0;
+ break;
+
+ case 10:
+ npc->act_no = 11;
+ npc->act_wait = 0;
+ // Fallthrough
+ case 11:
+ ++npc->act_wait;
+ npc->ym += 8;
+
+ if (npc->flag & 8)
+ {
+ if (npc->act_wait < 10)
+ npc->act_no = 12;
+ else
+ npc->act_no = 1;
+ }
+
+ break;
+
+ case 12:
+ npc->bits &= ~0x2000;
+ npc->act_no = 13;
+ npc->act_wait = 0;
+ npc->ani_no = 1;
+
+ for (int i = 0; i < 10; ++i)
+ {
+ SetNpChar(4, npc->x + (Random(-16, 16) * 0x200), npc->y + (Random(-8, 8) * 0x200), 0, 0, 0, 0, 0x100);
+ PlaySoundObject(12, 1); // Wait, it does this in a loop?
+ }
+ // Fallthrough
+ case 13:
+ npc->ym -= 8;
+
+ ++npc->act_wait;
+
+ if (npc->act_wait % 2 == 0)
+ SetCaret(npc->x - 0x1400, npc->y + 0x1000, 7, 3);
+ if (npc->act_wait % 2 == 1)
+ SetCaret(npc->x + 0x1400, npc->y + 0x1000, 7, 3);
+
+ if (npc->act_wait % 4 == 1)
+ PlaySoundObject(34, 1);
+
+ if (npc->flag & 2 || gMC.flag & 2 || npc->act_wait > 450)
+ {
+ if (npc->flag & 2 || gMC.flag & 2)
+ npc->ym = 0;
+
+ npc->act_no = 15;
+
+ for (int i = 0; i < 6; ++i)
+ {
+ SetNpChar(4, npc->x + (Random(-16, 16) * 0x200), npc->y + (Random(-8, 8) * 0x200), 0, 0, 0, 0, 0x100);
+ PlaySoundObject(12, 1);
+ }
+ }
+
+ break;
+
+ case 15:
+ npc->ym += 8;
+ ++npc->act_wait;
+
+ if (npc->ym < 0)
+ {
+ if (npc->act_wait % 8 == 0)
+ SetCaret(npc->x - 5120, npc->y + 0x1000, 7, 3);
+ if (npc->act_wait % 8 == 4)
+ SetCaret(npc->x + 5120, npc->y + 0x1000, 7, 3);
+ if (npc->act_wait % 16 == 1)
+ PlaySoundObject(34, 1);
+ }
+
+ if (npc->flag & 8)
+ {
+ npc->bits |= 0x2000;
+ npc->act_no = 1;
+ npc->ani_no = 0;
+ }
+
+ break;
+ }
+
+ if (npc->ym < -0x5FF)
+ npc->ym = -0x5FF;
+ if (npc->ym > 0x5FF)
+ npc->ym = 0x5FF;
+
+ npc->y += npc->ym;
+
+ npc->rect = rc[npc->ani_no];
+}
+
+//Orangebell
+void ActNpc232(NPCHAR *npc)
+{
+ switch (npc->act_no)
+ {
+ case 0:
+ npc->act_no = 1;
+ npc->tgt_x = npc->x;
+ npc->tgt_y = npc->y;
+ npc->ym = 0x200;
+
+ for (int i = 0; i < 8; ++i)
+ SetNpChar(233, npc->x, npc->y, 0, 0, npc->direct, npc, 0x100);
+ // Fallthrough
+ case 1:
+ if (npc->xm < 0 && npc->flag & 1)
+ npc->direct = 2;
+ if (npc->xm > 0 && npc->flag & 4)
+ npc->direct = 0;
+
+ if (npc->direct == 0)
+ npc->xm = -0x100;
+ else
+ npc->xm = 0x100;
+
+ if (npc->tgt_y > npc->y)
+ npc->ym += 8;
+ else
+ npc->ym -= 8;
+
+ if (npc->ym > 0x200)
+ npc->ym = 0x200;
+ if (npc->ym < -0x200)
+ npc->ym = -0x200;
+
+ if (++npc->ani_wait > 5)
+ {
+ npc->ani_wait = 0;
+ ++npc->ani_no;
+ }
+
+ if (npc->ani_no > 2)
+ npc->ani_no = 0;
+
+ break;
+ }
+
+ npc->y += npc->ym;
+ npc->x += npc->xm;
+
+ RECT rcLeft[3];
+ RECT rcRight[3];
+
+ rcLeft[0] = {128, 0, 160, 32};
+ rcLeft[1] = {160, 0, 192, 32};
+ rcLeft[2] = {192, 0, 224, 32};
+
+ rcRight[0] = {128, 32, 160, 64};
+ rcRight[1] = {160, 32, 192, 64};
+ rcRight[2] = {192, 32, 224, 64};
+
+ if (npc->direct == 0)
+ npc->rect = rcLeft[npc->ani_no];
+ else
+ npc->rect = rcRight[npc->ani_no];
+}
+
+//Orangebell bat
+void ActNpc233(NPCHAR *npc)
+{
+ unsigned char deg;
+
+ switch (npc->act_no)
+ {
+ case 0:
+ npc->act_no = 1;
+ deg = Random(0, 0xFF);
+ npc->xm = GetCos(deg);
+ deg = Random(0, 0xFF);
+ npc->ym = GetSin(deg);
+ npc->count1 = 120;
+ npc->count2 = Random(-0x20, 0x20) * 0x200;
+ // Fallthrough
+ case 1:
+ if (npc->pNpc->code_char == 232)
+ {
+ npc->tgt_x = npc->pNpc->x;
+ npc->tgt_y = npc->pNpc->y;
+ npc->direct = npc->pNpc->direct;
+ }
+
+ if (npc->tgt_x < npc->x)
+ npc->xm -= 8;
+ if (npc->tgt_x > npc->x)
+ npc->xm += 8;
+
+ if (npc->count2 + npc->tgt_y < npc->y)
+ npc->ym -= 0x20;
+ if (npc->count2 + npc->tgt_y > npc->y)
+ npc->ym += 0x20;
+
+ if (npc->xm > 0x400)
+ npc->xm = 0x400;
+ if (npc->xm < -0x400)
+ npc->xm = -0x400;
+
+ if (npc->ym > 0x400)
+ npc->ym = 0x400;
+ if (npc->ym < -0x400)
+ npc->ym = -0x400;
+
+ if (npc->count1 < 120)
+ {
+ ++npc->count1;
+ }
+ else
+ {
+ if (gMC.x > npc->x - 0x1000 && gMC.x < npc->x + 0x1000 && gMC.y > npc->y && gMC.y < npc->y + 0x16000)
+ {
+ npc->xm /= 4;
+ npc->ym = 0;
+ npc->act_no = 3;
+ npc->bits &= ~8;
+ }
+ }
+
+ break;
+
+ case 3:
+ npc->ym += 0x40;
+ if (npc->ym > 0x5FF)
+ npc->ym = 0x5FF;
+
+ if (npc->flag & 8)
+ {
+ npc->ym = 0;
+ npc->xm *= 2;
+ npc->count1 = 0;
+ npc->act_no = 1;
+ npc->bits |= 8;
+ }
+
+ break;
+ }
+
+ npc->x += npc->xm;
+ npc->y += npc->ym;
+
+ RECT rcLeft[4];
+ RECT rcRight[4];
+
+ rcLeft[0] = {256, 0, 272, 16};
+ rcLeft[1] = {272, 0, 288, 16};
+ rcLeft[2] = {288, 0, 304, 16};
+ rcLeft[3] = {304, 0, 320, 16};
+
+ rcRight[0] = {256, 16, 272, 32};
+ rcRight[1] = {272, 16, 288, 32};
+ rcRight[2] = {288, 16, 304, 32};
+ rcRight[3] = {304, 16, 320, 32};
+
+ if (npc->act_no == 3)
+ {
+ npc->ani_no = 3;
+ }
+ else
+ {
+ if (++npc->ani_wait > 1)
+ {
+ npc->ani_wait = 0;
+ ++npc->ani_no;
+ }
+
+ if (npc->ani_no > 2)
+ npc->ani_no = 0;
+ }
+
+ if ( npc->direct == 0)
+ npc->rect = rcLeft[npc->ani_no];
+ else
+ npc->rect = rcRight[npc->ani_no];
+}
+
+//Red Flowers (picked)
+void ActNpc234(NPCHAR *npc)
+{
+ RECT rc[2];
+
+ rc[0] = {144, 96, 192, 112};
+ rc[1] = {144, 112, 192, 128};
+
+ if (npc->act_no == 0)
+ {
+ npc->act_no = 1;
+ npc->y += 0x2000;
+ }
+
+ if (npc->direct == 0)
+ npc->rect = rc[0];
+ else
+ npc->rect = rc[1];
+}
+
+//Midorin
+void ActNpc235(NPCHAR *npc)
+{
+ RECT rcLeft[4];
+ RECT rcRight[4];
+
+ rcLeft[0] = {192, 96, 208, 112};
+ rcLeft[1] = {208, 96, 224, 112};
+ rcLeft[2] = {224, 96, 240, 112};
+ rcLeft[3] = {192, 96, 208, 112};
+
+ rcRight[0] = {192, 112, 208, 128};
+ rcRight[1] = {208, 112, 224, 128};
+ rcRight[2] = {224, 112, 240, 128};
+ rcRight[3] = {192, 112, 208, 128};
+
+ switch (npc->act_no)
+ {
+ case 0:
+ npc->act_no = 1;
+ npc->ani_no = 0;
+ npc->ani_wait = 0;
+ npc->xm = 0;
+ // Fallthrough
+ case 1:
+ if (Random(0, 30) == 1)
+ {
+ npc->act_no = 2;
+ npc->act_wait = 0;
+ npc->ani_no = 1;
+ }
+
+ if (Random(0, 30) == 1)
+ {
+ npc->act_no = 10;
+ npc->act_wait = 0;
+ npc->ani_no = 1;
+ }
+
+ break;
+
+ case 2:
+ if (++npc->act_wait > 8)
+ {
+ npc->act_no = 1;
+ npc->ani_no = 0;
+ }
+
+ break;
+
+ case 10:
+ npc->act_no = 11;
+ npc->act_wait = Random(0, 16);
+ npc->ani_no = 2;
+ npc->ani_wait = 0;
+
+ if (Random(0, 9) % 2)
+ npc->direct = 0;
+ else
+ npc->direct = 2;
+ // Fallthrough
+ case 11:
+ if (npc->direct == 0 && npc->flag & 1)
+ npc->direct = 2;
+ else if (npc->direct == 2 && npc->flag & 4)
+ npc->direct = 0;
+
+ if (npc->direct == 0)
+ npc->xm = -0x400u;
+ else
+ npc->xm = 0x400;
+
+ if (++npc->ani_wait > 1)
+ {
+ npc->ani_wait = 0;
+ ++npc->ani_no;
+ }
+
+ if (npc->ani_no > 3)
+ npc->ani_no = 2;
+
+ if (++npc->act_wait > 64)
+ npc->act_no = 0;
+
+ break;
+ }
+
+ npc->ym += 0x20;
+ if (npc->ym > 0x5FF)
+ npc->ym = 0x5FF;
+
+ npc->x += npc->xm;
+ npc->y += npc->ym;
+
+ if (npc->ani_no == 2)
+ npc->hit.top = 0xA00;
+ else
+ npc->hit.top = 0x800;
+
+ if (npc->direct == 0)
+ npc->rect = rcLeft[npc->ani_no];
+ else
+ npc->rect = rcRight[npc->ani_no];
+}
+
+//Gunfish
+void ActNpc236(NPCHAR *npc)
+{
+ RECT rcLeft[6];
+ RECT rcRight[6];
+
+ rcLeft[0] = {128, 64, 152, 88};
+ rcLeft[1] = {152, 64, 176, 88};
+ rcLeft[2] = {176, 64, 200, 88};
+ rcLeft[3] = {200, 64, 224, 88};
+ rcLeft[4] = {224, 64, 248, 88};
+ rcLeft[5] = {248, 64, 272, 88};
+
+ rcRight[0] = {128, 88, 152, 112};
+ rcRight[1] = {152, 88, 176, 112};
+ rcRight[2] = {176, 88, 200, 112};
+ rcRight[3] = {200, 88, 224, 112};
+ rcRight[4] = {224, 88, 248, 112};
+ rcRight[5] = {248, 88, 272, 112};
+
+ switch (npc->act_no)
+ {
+ case 0:
+ npc->act_no = 1;
+ npc->act_wait = Random(0, 50);
+ npc->tgt_x = npc->x;
+ npc->tgt_y = npc->y;
+ npc->ym = 0;
+ // Fallthrough
+ case 1:
+ if (npc->act_wait)
+ {
+ --npc->act_wait;
+ }
+ else
+ {
+ npc->ym = 0x200;
+ npc->act_no = 2;
+ }
+
+ break;
+
+ case 2:
+ if (gMC.x > npc->x)
+ npc->direct = 2;
+ else
+ npc->direct = 0;
+
+ if (gMC.x < npc->x + 0x10000 && gMC.x > npc->x - 0x10000 && gMC.y < npc->y + 0x4000 && gMC.y > npc->y - 0x14000)
+ ++npc->act_wait;
+
+ if (npc->act_wait > 80)
+ {
+ npc->act_no = 10;
+ npc->act_wait = 0;
+ }
+
+ if (++npc->ani_wait > 1)
+ {
+ npc->ani_wait = 0;
+ ++npc->ani_no;
+ }
+
+ if (npc->ani_no > 1)
+ npc->ani_no = 0;
+
+ break;
+
+ case 10:
+ if (++npc->act_wait > 20)
+ {
+ npc->act_wait = 0;
+ npc->act_no = 20;
+ }
+
+ if (++npc->ani_wait > 1)
+ {
+ npc->ani_wait = 0;
+ ++npc->ani_no;
+ }
+
+ if (npc->ani_no > 3)
+ npc->ani_no = 2;
+
+ break;
+
+ case 20:
+ if (++npc->act_wait > 60)
+ {
+ npc->act_wait = 0;
+ npc->act_no = 2;
+ }
+
+ if (npc->act_wait % 10 == 3)
+ {
+ PlaySoundObject(39, 1);
+
+ if (npc->direct == 0)
+ SetNpChar(237, npc->x - 0x1000, npc->y - 0x1000, -0x400, -0x400, 0, 0, 0x100);
+ else
+ SetNpChar(237, npc->x + 0x1000, npc->y - 0x1000, 0x400, -0x400, 0, 0, 0x100);
+ }
+
+ if (++npc->ani_wait > 1)
+ {
+ npc->ani_wait = 0;
+ ++npc->ani_no;
+ }
+
+ if (npc->ani_no > 5)
+ npc->ani_no = 4;
+
+ break;
+ }
+
+ if (npc->tgt_y > npc->y)
+ npc->ym += 0x10;
+ else
+ npc->ym -= 0x10;
+
+ if (npc->ym > 0x100)
+ npc->ym = 0x100;
+ if (npc->ym < -0x100)
+ npc->ym = -0x100;
+
+ npc->y += npc->ym;
+
+ if (npc->direct == 0)
+ npc->rect = rcLeft[npc->ani_no];
+ else
+ npc->rect = rcRight[npc->ani_no];
+}
+
+//Gunfish projectile
+void ActNpc237(NPCHAR *npc)
+{
+ RECT rc = {312, 32, 320, 40};
+
+ switch (npc->act_no)
+ {
+ case 0:
+ npc->act_no = 1;
+ // Fallthrough
+ case 1:
+ bool bHit = false;
+ ++npc->act_wait;
+
+ if (npc->flag & 0xFF)
+ bHit = true;
+ if (npc->act_wait > 10 && npc->flag & 0x100)
+ bHit = true;
+
+ if (bHit)
+ {
+ for (int i = 0; i < 5; ++i)
+ SetCaret(npc->x, npc->y, 1, 0);
+
+ PlaySoundObject(21, 1);
+ npc->cond = 0;
+ }
+
+ break;
+ }
+
+ npc->ym += 0x20;
+ if (npc->ym > 0x5FF)
+ npc->ym = 0x5FF;
+
+ npc->x += npc->xm;
+ npc->y += npc->ym;
+
+ npc->rect = rc;
+}
+
+// Press (sideways)
+void ActNpc238(NPCHAR *npc)
+{
+ RECT rc[3];
+
+ rc[0] = {184, 200, 208, 216};
+ rc[1] = {208, 200, 232, 216};
+ rc[2] = {232, 200, 256, 216};
+
+ switch (npc->act_no)
+ {
+ case 0:
+ npc->act_no = 1;
+ npc->tgt_x = npc->x;
+ npc->tgt_y = npc->y;
+ npc->view.front = 0x2000;
+ npc->view.back = 0x1000;
+ // Fallthrough
+ case 1:
+ if (npc->direct == 0 && gMC.x < npc->x && gMC.x > npc->x - 0x18000 && gMC.y > npc->y - 0x800 && gMC.y < npc->y + 0x1000)
+ {
+ npc->act_no = 10;
+ npc->act_wait = 0;
+ npc->ani_no = 2;
+ }
+
+ if (npc->direct == 2 && gMC.x > npc->x && gMC.x < npc->x + 0x18000 && gMC.y > npc->y - 0x800 && gMC.y < npc->y + 0x1000)
+ {
+ npc->act_no = 10;
+ npc->act_wait = 0;
+ npc->ani_no = 2;
+ }
+
+ break;
+
+ case 10:
+ npc->damage = 0x7F;
+
+ if (npc->direct == 0)
+ npc->x -= 0xC00;
+ else
+ npc->x += 0xC00;
+
+ if (++npc->act_wait == 8)
+ {
+ npc->act_no = 20;
+ npc->act_wait = 0;
+
+ for (int i = 0; i < 4; ++i)
+ {
+ SetNpChar(4, npc->x + (Random(-16, 16) * 0x200), npc->y + (Random(-8, 8) * 0x200), 0, 0, 0, 0, 0x100);
+ PlaySoundObject(12, 1);
+ }
+ }
+
+ break;
+
+ case 20:
+ npc->damage = 0;
+
+ if (++npc->act_wait > 50)
+ {
+ npc->act_wait = 0;
+ npc->act_no = 30;
+ }
+
+ break;
+
+ case 30:
+ npc->damage = 0;
+ npc->ani_no = 1;
+
+ if (++npc->act_wait == 12)
+ {
+ npc->act_no = 1;
+ npc->act_wait = 0;
+ npc->ani_no = 0;
+ }
+
+ if (npc->direct == 0)
+ npc->x += 0x800;
+ else
+ npc->x -= 0x800;
+
+ break;
+ }
+
+ if (npc->direct == 0 && gMC.x < npc->x)
+ npc->hit.back = 0x2000;
+ else if (npc->direct == 2 && gMC.x > npc->x)
+ npc->hit.back = 0x2000;
+ else
+ npc->hit.back = 0x1000;
+
+ npc->rect = rc[npc->ani_no];
+}
+
+//Cage bars
+void ActNpc239(NPCHAR *npc)
+{
+ RECT rcLeft = {192, 48, 256, 80};
+ RECT rcRight = {96, 112, 144, 144};
+
+ if (npc->act_no == 0)
+ {
+ npc->act_no = 1;
+
+ if (npc->direct == 0)
+ {
+ npc->x += 0x1000;
+ npc->y += 0x2000;
+ }
+ else
+ {
+ npc->view.front = 0x3000;
+ npc->view.back = 0x3000;
+ npc->view.top = 0x1000;
+ npc->view.back = 0x3000;
+ }
+ }
+
+ if (npc->direct == 0)
+ npc->rect = rcLeft;
+ else
+ npc->rect = rcRight;
+}
--- a/src/NpcAct240.cpp
+++ b/src/NpcAct240.cpp
@@ -9,6 +9,110 @@
#include "Back.h"
#include "Triangle.h"
+//Mimiga (jailed)
+void ActNpc240(NPCHAR *npc)
+{
+ RECT rcLeft[6];
+ RECT rcRight[6];
+
+ rcLeft[0] = {160, 64, 176, 80};
+ rcLeft[1] = {176, 64, 192, 80};
+ rcLeft[2] = {192, 64, 208, 80};
+ rcLeft[3] = {160, 64, 176, 80};
+ rcLeft[4] = {208, 64, 224, 80};
+ rcLeft[5] = {160, 64, 176, 80};
+
+ rcRight[0] = {160, 80, 176, 96};
+ rcRight[1] = {176, 80, 192, 96};
+ rcRight[2] = {192, 80, 208, 96};
+ rcRight[3] = {160, 80, 176, 96};
+ rcRight[4] = {208, 80, 224, 96};
+ rcRight[5] = {160, 80, 176, 96};
+
+ switch (npc->act_no)
+ {
+ case 0:
+ npc->act_no = 1;
+ npc->ani_no = 0;
+ npc->ani_wait = 0;
+ npc->xm = 0;
+ // Fallthrough
+ case 1:
+ if (Random(0, 60) == 1)
+ {
+ npc->act_no = 2;
+ npc->act_wait = 0;
+ npc->ani_no = 1;
+ }
+
+ if (Random(0, 60) == 1)
+ {
+ npc->act_no = 10;
+ npc->act_wait = 0;
+ npc->ani_no = 1;
+ }
+
+ break;
+
+ case 2:
+ if (++npc->act_wait > 8)
+ {
+ npc->act_no = 1;
+ npc->ani_no = 0;
+ }
+
+ break;
+
+ case 10:
+ npc->act_no = 11;
+ npc->act_wait = Random(0, 16);
+ npc->ani_no = 2;
+ npc->ani_wait = 0;
+
+ if (Random(0, 9) % 2)
+ npc->direct = 0;
+ else
+ npc->direct = 2;
+ // Fallthrough
+ case 11:
+ if (npc->direct == 0 && npc->flag & 1)
+ npc->direct = 2;
+ else if (npc->direct == 2 && npc->flag & 4)
+ npc->direct = 0;
+
+ if (npc->direct == 0)
+ npc->xm = -0x200u;
+ else
+ npc->xm = 0x200;
+
+ if (++npc->ani_wait > 4)
+ {
+ npc->ani_wait = 0;
+ ++npc->ani_no;
+ }
+
+ if (npc->ani_no > 5)
+ npc->ani_no = 2;
+
+ if (++npc->act_wait > 32)
+ npc->act_no = 0;
+
+ break;
+ }
+
+ 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];
+}
+
//Curly (carried and unconcious)
void ActNpc259(NPCHAR *npc)
{
--- a/src/NpcAct260.cpp
+++ b/src/NpcAct260.cpp
@@ -106,6 +106,228 @@
}
}
+//Droll projectile
+void ActNpc273(NPCHAR *npc)
+{
+ RECT rc[3];
+
+ rc[0] = {248, 40, 272, 64};
+ rc[1] = {272, 40, 296, 64};
+ rc[2] = {296, 40, 320, 64};
+
+ switch (npc->act_no)
+ {
+ case 0:
+ npc->act_no = 1;
+ // Fallthrough
+ case 1:
+ npc->x += npc->xm;
+ npc->y += npc->ym;
+
+ if (npc->flag & 0xFF)
+ {
+ SetNpChar(4, npc->x, npc->y, 0, 0, 0, 0, 0x100);
+ SetNpChar(4, npc->x, npc->y, 0, 0, 0, 0, 0x100);
+ SetNpChar(4, npc->x, npc->y, 0, 0, 0, 0, 0x100);
+ VanishNpChar(npc);
+ return;
+ }
+
+ if (++npc->act_wait % 5 == 0)
+ PlaySoundObject(110, 1);
+
+ if (++npc->ani_no > 2)
+ npc->ani_no = 0;
+
+ break;
+ }
+
+ npc->rect = rc[npc->ani_no];
+}
+
+//Droll
+void ActNpc274(NPCHAR *npc)
+{
+ RECT rcLeft[6];
+ RECT rcRight[6];
+
+ rcLeft[0] = {0, 0, 32, 40};
+ rcLeft[1] = {32, 0, 64, 40};
+ rcLeft[2] = {64, 0, 96, 40};
+ rcLeft[3] = {64, 80, 96, 120};
+ rcLeft[4] = {96, 80, 128, 120};
+ rcLeft[5] = {96, 0, 128, 40};
+
+ rcRight[0] = {0, 40, 32, 80};
+ rcRight[1] = {32, 40, 64, 80};
+ rcRight[2] = {64, 40, 96, 80};
+ rcRight[3] = {64, 120, 96, 160};
+ rcRight[4] = {96, 120, 128, 160};
+ rcRight[5] = {96, 40, 128, 80};
+
+ switch (npc->act_no)
+ {
+ case 0:
+ npc->act_no = 1;
+ npc->y -= 0x1000;
+ npc->tgt_x = npc->x;
+ // Fallthrough
+ case 1:
+ npc->xm = 0;
+ npc->act_no = 2;
+ npc->ani_no = 0;
+ // Fallthrough
+ case 2:
+ if (gMC.x < npc->x)
+ npc->direct = 0;
+ else
+ npc->direct = 2;
+
+ if (++npc->ani_wait > 40)
+ {
+ npc->ani_wait = 0;
+ ++npc->ani_no;
+ }
+
+ if (npc->ani_no > 1)
+ npc->ani_no = 0;
+
+ if (npc->shock)
+ npc->act_no = 10;
+
+ break;
+
+ case 10:
+ npc->act_no = 11;
+ npc->ani_no = 2;
+ npc->act_wait = 0;
+ // Fallthrough
+ case 11:
+ if (++npc->act_wait > 10)
+ {
+ npc->act_no = 12;
+ npc->ani_no = 3;
+ npc->ym = -0x600u;
+ npc->count1 = 0;
+
+ if (npc->tgt_x > npc->x)
+ npc->xm = 0x200;
+ else
+ npc->xm = -0x200;
+ }
+
+ break;
+
+ case 12:
+ if (npc->ym > 0)
+ {
+ npc->ani_no = 4;
+
+ if (npc->count1 == 0)
+ {
+ ++npc->count1;
+ const unsigned char deg = GetArktan(npc->x - gMC.x, npc->y - 0x1400 - gMC.y);
+ const int ym = 4 * GetSin(deg);
+ const int xm = 4 * GetCos(deg);
+ SetNpChar(273, npc->x, npc->y - 0x1400, xm, ym, 0, 0, 0x100);
+ PlaySoundObject(39, 1);
+ }
+ }
+
+ if (npc->ym > 0x200)
+ npc->ani_no = 5;
+
+ if (npc->flag & 8)
+ {
+ npc->ani_no = 2;
+ npc->act_no = 13;
+ npc->act_wait = 0;
+ npc->xm = 0;
+ }
+
+ break;
+
+ case 13:
+ npc->xm /= 2;
+
+ if (++npc->act_wait > 10)
+ npc->act_no = 1;
+
+ break;
+ }
+
+ npc->ym += 0x55;
+ 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];
+}
+
+//Puppy (plantation)
+void ActNpc275(NPCHAR *npc)
+{
+ RECT rcRight[4];
+
+ rcRight[0] = {272, 80, 288, 96};
+ rcRight[1] = {288, 80, 304, 96};
+ rcRight[2] = {272, 80, 288, 96};
+ rcRight[3] = {304, 80, 320, 96};
+
+ switch (npc->act_no)
+ {
+ case 0:
+ npc->act_no = 1;
+ npc->ani_no = 0;
+ npc->ani_wait = 0;
+ // Fallthrough
+ case 1:
+ if (Random(0, 120) == 10)
+ {
+ npc->act_no = 2;
+ npc->act_wait = 0;
+ npc->ani_no = 1;
+ }
+
+ if (gMC.x > npc->x - 0x8000 && gMC.x < npc->x + 0x8000 && gMC.y > npc->y - 0x4000 && gMC.y < npc->y + 0x2000)
+ {
+ if (++npc->ani_wait > 3)
+ {
+ npc->ani_wait = 0;
+ ++npc->ani_no;
+ }
+
+ if (npc->ani_no > 3)
+ npc->ani_no = 2;
+ }
+
+ break;
+
+ case 2:
+ if (++npc->act_wait > 8)
+ {
+ npc->act_no = 1;
+ npc->ani_no = 0;
+ }
+
+ break;
+ }
+
+ npc->ym += 0x40;
+ if (npc->ym > 0x5FF)
+ npc->ym = 0x5FF;
+
+ npc->x += npc->xm;
+ npc->y += npc->ym;
+
+ npc->rect = rcRight[npc->ani_no];
+}
+
//Little family
void ActNpc278(NPCHAR *npc)
{
--- a/src/NpcAct300.cpp
+++ b/src/NpcAct300.cpp
@@ -10,6 +10,9 @@
#include "Triangle.h"
#include "Caret.h"
#include "Boss.h"
+#include "Frame.h"
+#include "Map.h"
+#include "Bullet.h"
//Demon crown (opening)
void ActNpc300(NPCHAR *npc)
@@ -97,5 +100,673 @@
npc->x = (npc->pNpc->x + gMC.x) / 2;
npc->y = (npc->pNpc->y + gMC.y) / 2;
break;
+ }
+}
+
+//Stumpy
+void ActNpc308(NPCHAR *npc)
+{
+ RECT rcLeft[2];
+ RECT rcRight[2];
+
+ rcLeft[0] = {128, 112, 144, 128};
+ rcLeft[1] = {144, 112, 160, 128};
+
+ rcRight[0] = {128, 128, 144, 144};
+ rcRight[1] = {144, 128, 160, 144};
+
+ unsigned char deg;
+
+ switch (npc->act_no)
+ {
+ case 0:
+ npc->act_no = 1;
+ // Fallthrough
+ case 1:
+ if (gMC.x < npc->x + 0x1E000 && gMC.x > npc->x - 0x1E000 && gMC.y < npc->y + 0x18000 && gMC.y > npc->y - 0x18000)
+ npc->act_no = 10;
+
+ break;
+
+ case 10:
+ npc->act_no = 11;
+ npc->act_wait = 0;
+ npc->xm2 = 0;
+ npc->ym2 = 0;
+
+ if (gMC.x < npc->x)
+ npc->direct = 0;
+ else
+ npc->direct = 2;
+ // Fallthrough
+ case 11:
+ if (++npc->act_wait > 50)
+ npc->act_no = 20;
+
+ ++npc->ani_wait;
+
+ if (npc->act_wait > 1)
+ {
+ npc->ani_wait = 0;
+
+ if (++npc->ani_no > 1)
+ npc->ani_no = 0;
+ }
+
+ if (gMC.x > npc->x + 0x28000 || gMC.x < npc->x - 0x28000 || gMC.y > npc->y + 0x1E000 || gMC.y < npc->y - 0x1E000)
+ npc->act_no = 0;
+
+ break;
+
+ case 20:
+ npc->act_no = 21;
+ npc->act_wait = 0;
+
+ deg = GetArktan(npc->x - gMC.x, npc->y - gMC.y) + Random(-3, 3);
+ npc->ym2 = 2 * GetSin(deg);
+ npc->xm2 = 2 * GetCos(deg);
+
+ if (npc->xm2 < 0)
+ npc->direct = 0;
+ else
+ npc->direct = 2;
+ // Fallthrough
+ case 21:
+ if (npc->xm2 < 0 && npc->flag & 1)
+ {
+ npc->direct = 2;
+ npc->xm2 = -npc->xm2;
+ }
+
+ if (npc->xm2 > 0 && npc->flag & 4)
+ {
+ npc->direct = 0;
+ npc->xm2 = -npc->xm2;
+ }
+
+ if (npc->ym2 < 0 && npc->flag & 2)
+ npc->ym2 = -npc->ym2;
+ if (npc->ym2 > 0 && npc->flag & 8)
+ npc->ym2 = -npc->ym2;
+
+ if (npc->flag & 0x100)
+ npc->ym2 = -0x200;
+
+ npc->x += npc->xm2;
+ npc->y += npc->ym2;
+
+ if (++npc->act_wait > 50)
+ npc->act_no = 10;
+
+ if (++npc->ani_no > 1)
+ npc->ani_no = 0;
+
+ break;
+ }
+
+ if (npc->direct == 0)
+ npc->rect = rcLeft[npc->ani_no];
+ else
+ npc->rect = rcRight[npc->ani_no];
+}
+
+//Ma Pignon
+void ActNpc313(NPCHAR *npc)
+{
+ RECT rcLeft[14];
+ RECT rcRight[14];
+
+ rcLeft[0] = {128, 0, 144, 16};
+ rcLeft[1] = {144, 0, 160, 16};
+ rcLeft[2] = {160, 0, 176, 16};
+ rcLeft[3] = {176, 0, 192, 16};
+ rcLeft[4] = {192, 0, 208, 16};
+ rcLeft[5] = {208, 0, 224, 16};
+ rcLeft[6] = {224, 0, 240, 16};
+ rcLeft[7] = {240, 0, 256, 16};
+ rcLeft[8] = {256, 0, 272, 16};
+ rcLeft[9] = {272, 0, 288, 16};
+ rcLeft[10] = {288, 0, 304, 16};
+ rcLeft[11] = {128, 0, 144, 16};
+ rcLeft[12] = {176, 0, 192, 16};
+ rcLeft[13] = {304, 0, 320, 16};
+
+ rcRight[0] = {128, 16, 144, 32};
+ rcRight[1] = {144, 16, 160, 32};
+ rcRight[2] = {160, 16, 176, 32};
+ rcRight[3] = {176, 16, 192, 32};
+ rcRight[4] = {192, 16, 208, 32};
+ rcRight[5] = {208, 16, 224, 32};
+ rcRight[6] = {224, 16, 240, 32};
+ rcRight[7] = {240, 16, 256, 32};
+ rcRight[8] = {256, 16, 272, 32};
+ rcRight[9] = {272, 16, 288, 32};
+ rcRight[10] = {288, 16, 304, 32};
+ rcRight[11] = {128, 16, 144, 32};
+ rcRight[12] = {176, 16, 192, 32};
+ rcRight[13] = {304, 16, 320, 32};
+
+ switch (npc->act_no)
+ {
+ case 0:
+ npc->act_no = 1;
+ npc->ani_no = 0;
+ npc->ani_wait = 0;
+ npc->y += 0x800;
+ // Fallthrough
+ case 1:
+ npc->ym += 0x40;
+
+ if (Random(0, 120) == 10)
+ {
+ npc->act_no = 2;
+ npc->act_wait = 0;
+ npc->ani_no = 1;
+ }
+
+ if (gMC.x > npc->x - 0x4000 && gMC.x < npc->x + 0x4000)
+ {
+ if (gMC.x < npc->x)
+ npc->direct = 0;
+ else
+ npc->direct = 2;
+ }
+
+ break;
+
+ case 2:
+ if (++npc->act_wait > 8)
+ {
+ npc->act_no = 1;
+ npc->ani_no = 0;
+ }
+
+ break;
+
+ case 100:
+ npc->act_no = 110;
+ npc->act_wait = 0;
+ npc->count1 = 0;
+ npc->bits |= 0x20;
+ // Fallthrough
+ case 110:
+ npc->damage = 1;
+
+ if (gMC.x < npc->x)
+ npc->direct = 0;
+ else
+ npc->direct = 2;
+
+ npc->ani_no = 0;
+
+ if (++npc->act_wait > 4)
+ {
+ npc->act_wait = 0;
+ npc->act_no = 120;
+
+ if (++npc->count2 > 12)
+ {
+ npc->count2 = 0;
+ npc->act_no = 300;
+ }
+ }
+
+ break;
+
+ case 120:
+ npc->ani_no = 2;
+
+ if (++npc->act_wait > 4)
+ {
+ npc->act_no = 130;
+ npc->ani_no = 3;
+ npc->xm = 2 * Random(-0x200, 0x200);
+ npc->ym = -0x800;
+ PlaySoundObject(30, 1);
+ ++npc->count1;
+ }
+
+ break;
+
+ case 130:
+ npc->ym += 0x80;
+
+ if (npc->y > 0x10000)
+ npc->bits &= ~8;
+
+ if (npc->xm < 0 && npc->flag & 1)
+ npc->xm = -npc->xm;
+ if (npc->xm > 0 && npc->flag & 4)
+ npc->xm = -npc->xm;
+
+ if (gMC.x < npc->x)
+ npc->direct = 0;
+ else
+ npc->direct = 2;
+
+ if (npc->ym < -0x200)
+ npc->ani_no = 3;
+ else if (npc->ym > 0x200)
+ npc->ani_no = 4;
+ else
+ npc->ani_no = 0;
+
+ if (npc->flag & 8)
+ {
+ npc->act_no = 140;
+ npc->act_wait = 0;
+ npc->ani_no = 2;
+ npc->xm = 0;
+ }
+
+ if (npc->count1 > 4 && gMC.y < npc->y + 0x800)
+ {
+ npc->act_no = 200;
+ npc->act_wait = 0;
+ npc->xm = 0;
+ npc->ym = 0;
+ }
+
+ break;
+
+ case 140:
+ npc->ani_no = 2;
+
+ if (++npc->act_wait > 4)
+ npc->act_no = 110;
+
+ break;
+
+ case 200:
+ npc->ani_no = 5;
+
+ if (++npc->act_wait > 10)
+ {
+ npc->act_no = 210;
+ npc->ani_no = 6;
+
+ if (npc->direct == 0)
+ npc->xm = -0x5FF;
+ else
+ npc->xm = 0x5FF;
+
+ PlaySoundObject(25, 1);
+ npc->bits &= ~0x20;
+ npc->bits |= 4;
+ npc->damage = 10;
+ }
+
+ break;
+
+ case 210:
+ if (++npc->ani_no > 7)
+ npc->ani_no = 6;
+
+ if (npc->xm < 0 && npc->flag & 1)
+ npc->act_no = 220;
+ if (npc->xm > 0 && npc->flag & 4)
+ npc->act_no = 220;
+
+ break;
+
+ case 220:
+ npc->act_no = 221;
+ npc->act_wait = 0;
+ SetQuake(16);
+ PlaySoundObject(26, 1);
+ npc->damage = 4;
+ // Fallthrough
+ case 221:
+ if (++npc->ani_no > 7)
+ npc->ani_no = 6;
+
+ if (++npc->act_wait % 6 == 0)
+ SetNpChar(314, Random(4, 16) * 0x2000, 0x2000, 0, 0, 0, 0, 0x100);
+
+ if (npc->act_wait > 30)
+ {
+ npc->count1 = 0;
+ npc->act_no = 130;
+ npc->bits |= 0x20;
+ npc->bits &= ~4;
+ npc->damage = 3;
+ }
+
+ break;
+
+ case 300:
+ npc->act_no = 301;
+ npc->ani_no = 9;
+
+ if (gMC.x < npc->x)
+ npc->direct = 0;
+ else
+ npc->direct = 2;
+ // Fallthrough
+ case 301:
+ if (++npc->ani_no > 11)
+ npc->ani_no = 9;
+
+ if (npc->direct == 0)
+ npc->xm = -0x400;
+ else
+ npc->xm = 0x400;
+
+ if (gMC.x > npc->x - 0x800 && gMC.x < npc->x + 0x800)
+ {
+ npc->act_no = 310;
+ npc->act_wait = 0;
+ npc->ani_no = 2;
+ npc->xm = 0;
+ }
+
+ break;
+
+ case 310:
+ npc->ani_no = 2;
+
+ if (++npc->act_wait > 4)
+ {
+ npc->act_no = 320;
+ npc->ani_no = 12;
+ npc->ym = -0x800;
+ PlaySoundObject(25, 1);
+ npc->bits |= 8;
+ npc->bits &= ~0x20;
+ npc->bits |= 4;
+ npc->damage = 10;
+ }
+
+ break;
+
+ case 320:
+ if (++npc->ani_no > 13)
+ npc->ani_no = 12;
+
+ if (npc->y < 0x2000)
+ npc->act_no = 330;
+
+ break;
+
+ case 330:
+ npc->ym = 0;
+ npc->act_no = 331;
+ npc->act_wait = 0;
+ SetQuake(16);
+ PlaySoundObject(26, 1);
+ // Fallthrough
+ case 331:
+ if (++npc->ani_no > 13)
+ npc->ani_no = 12;
+
+ if (++npc->act_wait % 6 == 0)
+ SetNpChar(315, Random(4, 16) * 0x2000, 0, 0, 0, 0, 0, 0x100);
+
+ if (npc->act_wait > 30)
+ {
+ npc->count1 = 0;
+ npc->act_no = 130;
+ npc->bits |= 0x20;
+ npc->bits &= ~4;
+ npc->damage = 3;
+ }
+
+ break;
+
+ case 500:
+ npc->bits &= ~0x20;
+ npc->act_no = 501;
+ npc->act_wait = 0;
+ npc->ani_no = 8;
+ npc->tgt_x = npc->x;
+ npc->damage = 0;
+ DeleteNpCharCode(315, 1);
+ // Fallthrough
+ case 501:
+ npc->ym += 0x20;
+
+ if (++npc->act_wait % 2)
+ npc->x = npc->tgt_x;
+ else
+ npc->x = npc->tgt_x + 0x200;
+
+ break;
+ }
+
+ if (npc->act_no > 100 && npc->act_no < 500 && npc->act_no != 210 && npc->act_no != 320)
+ {
+ if (IsActiveSomeBullet())
+ {
+ npc->bits &= ~0x20;
+ npc->bits |= 4;
+ }
+ else
+ {
+ npc->bits |= 0x20;
+ npc->bits &= ~4;
+ }
+ }
+
+ 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];
+}
+
+//Ma Pignon rock
+void ActNpc314(NPCHAR *npc)
+{
+ RECT rc[3];
+
+ rc[0] = {64, 64, 80, 80};
+ rc[1] = {80, 64, 96, 80};
+ rc[2] = {96, 64, 112, 80};
+
+ switch (npc->act_no)
+ {
+ case 0:
+ npc->count2 = 0;
+ npc->act_no = 100;
+ npc->bits |= 4;
+ npc->ani_no = Random(0, 2);
+ // Fallthrough
+ case 100:
+ npc->ym += 0x40;
+
+ if (npc->ym > 0x700)
+ npc->ym = 0x700;
+
+ if (npc->y > 0x10000)
+ npc->bits &= ~8;
+
+ if (npc->flag & 8)
+ {
+ npc->ym = -0x200;
+ npc->act_no = 110;
+ npc->bits |= 8;
+ PlaySoundObject(12, 1);
+ SetQuake(10);
+
+ for (int i = 0; i < 2; ++i)
+ SetNpChar(4, npc->x + (Random(-12, 12) * 0x200), npc->y + 0x2000, Random(-341, 341), Random(-0x600, 0), 0, 0, 0x100);
+ }
+
+ break;
+
+ case 110:
+ npc->ym += 0x40;
+
+ if (npc->y > (gMap.length * 0x2000) + 0x4000)
+ {
+ npc->cond = 0;
+ return;
+ }
+
+ break;
+ }
+
+ if (++npc->ani_wait > 6)
+ {
+ ++npc->ani_wait;
+ ++npc->ani_no;
+ }
+
+ if (npc->ani_no > 2)
+ npc->ani_no = 0;
+
+ if (gMC.y > npc->y)
+ npc->damage = 10;
+ else
+ npc->damage = 0;
+
+ npc->y += npc->ym;
+
+ npc->rect = rc[npc->ani_no];
+}
+
+//Ma Pignon clone
+void ActNpc315(NPCHAR *npc)
+{
+ RECT rcLeft[4];
+ RECT rcRight[4];
+
+ rcLeft[0] = {128, 0, 144, 16};
+ rcLeft[1] = {160, 0, 176, 16};
+ rcLeft[2] = {176, 0, 192, 16};
+ rcLeft[3] = {192, 0, 208, 16};
+
+ rcRight[0] = {128, 16, 144, 32};
+ rcRight[1] = {160, 16, 176, 32};
+ rcRight[2] = {176, 16, 192, 32};
+ rcRight[3] = {192, 16, 208, 32};
+
+ switch (npc->act_no)
+ {
+ case 0:
+ npc->ani_no = 3;
+ npc->ym += 0x80;
+
+ if (npc->y > 0x10000)
+ {
+ npc->act_no = 130;
+ npc->bits &= ~8;
+ }
+
+ break;
+
+ case 100:
+ npc->act_no = 110;
+ npc->act_wait = 0;
+ npc->count1 = 0;
+ npc->bits |= 0x20;
+ // Fallthrough
+ case 110:
+ if (gMC.x < npc->x)
+ npc->direct = 0;
+ else
+ npc->direct = 2;
+
+ npc->ani_no = 0;
+
+ if (++npc->act_wait > 4)
+ {
+ npc->act_wait = 0;
+ npc->act_no = 120;
+ }
+
+ break;
+
+ case 120:
+ npc->ani_no = 1;
+
+ if (++npc->act_wait > 4)
+ {
+ npc->act_no = 130;
+ npc->ani_no = 3;
+ npc->xm = 2 * Random(-0x200, 0x200);
+ npc->ym = -0x800;
+ PlaySoundObject(30, 1);
+ }
+
+ break;
+
+ case 130:
+ npc->ym += 0x80;
+
+ if (npc->xm < 0 && npc->flag & 1)
+ npc->xm = -npc->xm;
+ if (npc->xm > 0 && npc->flag & 4)
+ npc->xm = -npc->xm;
+
+ if (gMC.x < npc->x)
+ npc->direct = 0;
+ else
+ npc->direct = 2;
+
+ if (npc->ym < -0x200)
+ npc->ani_no = 2;
+ else if (npc->ym > 0x200)
+ npc->ani_no = 0;
+ else
+ npc->ani_no = 3;
+
+ if (npc->flag & 8)
+ {
+ npc->act_no = 140;
+ npc->act_wait = 0;
+ npc->ani_no = 1;
+ npc->xm = 0;
+ }
+
+ break;
+
+ case 140:
+ npc->ani_no = 1;
+
+ if (++npc->act_wait > 4)
+ {
+ npc->act_no = 110;
+ npc->bits |= 0x20;
+ }
+
+ break;
+ }
+
+ if (npc->act_no > 100)
+ {
+ if (IsActiveSomeBullet())
+ {
+ npc->bits &= ~0x20;
+ npc->bits |= 4;
+ }
+ else
+ {
+ npc->bits |= 0x20;
+ npc->bits &= ~4;
+ }
+ }
+
+ if (++npc->count2 > 300)
+ {
+ VanishNpChar(npc);
+ }
+ else
+ {
+ 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];
}
}
--- a/src/NpcAct320.cpp
+++ b/src/NpcAct320.cpp
@@ -129,3 +129,45 @@
break;
}
}
+
+//Numhachi
+void ActNpc337(NPCHAR *npc)
+{
+ RECT rcLeft[2];
+
+ rcLeft[0] = {256, 112, 288, 152};
+ rcLeft[1] = {288, 112, 320, 152};
+
+ switch (npc->act_no)
+ {
+ case 0:
+ npc->act_no = 1;
+ npc->y -= 0x1000;
+ // Fallthrough
+ case 1:
+ npc->xm = 0;
+ npc->act_no = 2;
+ npc->ani_no = 0;
+ // Fallthrough
+ case 2:
+ if (++npc->ani_wait > 50)
+ {
+ npc->ani_wait = 0;
+ ++npc->ani_no;
+ }
+
+ if (npc->ani_no > 1)
+ npc->ani_no = 0;
+
+ break;
+ }
+
+ npc->ym += 0x40;
+ if (npc->ym > 0x5FF)
+ npc->ym = 0x5FF;
+
+ npc->x += npc->xm;
+ npc->y += npc->ym;
+
+ npc->rect = rcLeft[npc->ani_no];
+}
--- a/src/NpcAct340.cpp
+++ b/src/NpcAct340.cpp
@@ -9,6 +9,7 @@
#include "Sound.h"
#include "Back.h"
#include "Triangle.h"
+#include "Flags.h"
//Hoppy
void ActNpc347(NPCHAR *npc)
@@ -112,6 +113,59 @@
}
npc->rect = rect;
+}
+
+//Statue (shootable)
+void ActNpc351(NPCHAR *npc)
+{
+ RECT rc[9];
+
+ rc[0] = {0, 96, 32, 136};
+ rc[1] = {32, 96, 64, 136};
+ rc[2] = {64, 96, 96, 136};
+ rc[3] = {96, 96, 128, 136};
+ rc[4] = {128, 96, 160, 136};
+ rc[5] = {0, 176, 32, 216};
+ rc[6] = {32, 176, 64, 216};
+ rc[7] = {64, 176, 96, 216};
+ rc[8] = {96, 176, 128, 216};
+
+ switch (npc->act_no)
+ {
+ case 0:
+ npc->act_no = 1;
+ npc->ani_no = npc->direct / 10;
+ npc->x += 0x1000;
+ npc->y += 0x1800;
+ break;
+
+ case 10:
+ if (GetNPCFlag(npc->code_flag))
+ {
+ npc->act_no = 20;
+ }
+ else
+ {
+ npc->act_no = 11;
+ npc->bits |= 0x20;
+ }
+ // Fallthrough
+ case 11:
+ if (npc->life <= 900)
+ {
+ SetNpChar(351, npc->x - 0x1000, npc->y - 0x1800, 0, 0, 10 * (npc->ani_no + 4), 0, 0);
+ npc->cond |= 8;
+ }
+
+ break;
+
+ case 20:
+ npc->ani_no += 4;
+ npc->act_no = 1;
+ break;
+ }
+
+ npc->rect = rc[npc->ani_no];
}
//Quote and Curly on Balrog's back
--- a/src/NpcTbl.cpp
+++ b/src/NpcTbl.cpp
@@ -285,6 +285,18 @@
ActNpc226,
ActNpc227,
ActNpc228,
+ ActNpc229,
+ ActNpc230,
+ ActNpc231,
+ ActNpc232,
+ ActNpc233,
+ ActNpc234,
+ ActNpc235,
+ ActNpc236,
+ ActNpc237,
+ ActNpc238,
+ ActNpc239,
+ ActNpc240,
nullptr,
nullptr,
nullptr,
@@ -303,18 +315,6 @@
nullptr,
nullptr,
nullptr,
- nullptr,
- nullptr,
- nullptr,
- nullptr,
- nullptr,
- nullptr,
- nullptr,
- nullptr,
- nullptr,
- nullptr,
- nullptr,
- nullptr,
ActNpc259,
nullptr,
nullptr,
@@ -327,13 +327,13 @@
nullptr,
nullptr,
nullptr,
+ ActNpc271,
+ ActNpc272,
+ ActNpc273,
+ ActNpc274,
+ ActNpc275,
nullptr,
nullptr,
- nullptr,
- nullptr,
- nullptr,
- nullptr,
- nullptr,
ActNpc278,
nullptr,
nullptr,
@@ -364,10 +364,14 @@
nullptr,
nullptr,
nullptr,
+ ActNpc308,
nullptr,
nullptr,
nullptr,
nullptr,
+ ActNpc313,
+ ActNpc314,
+ ActNpc315,
nullptr,
nullptr,
nullptr,
@@ -386,13 +390,10 @@
nullptr,
nullptr,
nullptr,
- nullptr,
- nullptr,
- nullptr,
- nullptr,
ActNpc334,
ActNpc335,
ActNpc336,
+ ActNpc337,
nullptr,
nullptr,
nullptr,
@@ -402,12 +403,11 @@
nullptr,
nullptr,
nullptr,
- nullptr,
ActNpc347,
nullptr,
ActNpc349,
nullptr,
- nullptr,
+ ActNpc351,
nullptr,
nullptr,
nullptr,
--- a/src/TextScr.cpp
+++ b/src/TextScr.cpp
@@ -674,6 +674,11 @@
SubArmsData(z);
gTS.p_read += 8;
}
+ else if (IS_COMMAND('Z','A','M'))
+ {
+ ZeroArmsEnergy_All();
+ gTS.p_read += 4;
+ }
else if (IS_COMMAND('T','A','M'))
{
x = GetTextScriptNo(gTS.p_read + 4);