ref: adffe17cb7dac78f44ef674b5ffa0fb58f5b23a3
parent: 9be37f62e0944b48912bc71e44a2ec2c5050eead
author: Clownacy <[email protected]>
date: Sun Feb 3 19:08:07 EST 2019
Added some Grasstown NPCs
--- a/src/NpcAct.h
+++ b/src/NpcAct.h
@@ -28,11 +28,12 @@
void ActNpc023(NPCHAR *npc);
void ActNpc024(NPCHAR *npc);
void ActNpc025(NPCHAR *npc);
-
+void ActNpc026(NPCHAR *npc);
+void ActNpc027(NPCHAR *npc);
void ActNpc028(NPCHAR *npc);
void ActNpc029(NPCHAR *npc);
void ActNpc030(NPCHAR *npc);
-
+void ActNpc031(NPCHAR *npc);
void ActNpc032(NPCHAR *npc);
void ActNpc034(NPCHAR *npc);
@@ -84,6 +85,9 @@
void ActNpc090(NPCHAR *npc);
void ActNpc091(NPCHAR *npc);
void ActNpc092(NPCHAR *npc);
+void ActNpc093(NPCHAR *npc);
+
+void ActNpc095(NPCHAR *npc);
void ActNpc111(NPCHAR *npc);
void ActNpc112(NPCHAR *npc);
--- a/src/NpcAct020.cpp
+++ b/src/NpcAct020.cpp
@@ -413,6 +413,131 @@
npc->rect = rcLeft[npc->ani_no];
}
+//Bat (Grasstown, flying)
+void ActNpc026(NPCHAR *npc)
+{
+ unsigned char deg;
+
+ switch (npc->act_no)
+ {
+ case 0:
+ deg = Random(0, 0xFF);
+ npc->xm = GetCos(deg);
+ npc->tgt_x = npc->x + 8 * GetCos(deg + 0x40);
+ deg = Random(0, 0xFF);
+ npc->ym = GetSin(deg);
+ npc->tgt_y = npc->y + 8 * GetSin(deg + 0x40);
+ npc->act_no = 1;
+ npc->count1 = 120;
+ // Fallthrough
+ case 1:
+ if (gMC.x < npc->x)
+ npc->direct = 0;
+ else
+ npc->direct = 2;
+
+ if (npc->tgt_x < npc->x)
+ npc->xm -= 0x10;
+ if (npc->tgt_x > npc->x)
+ npc->xm += 0x10;
+
+ if (npc->tgt_y < npc->y)
+ npc->ym -= 0x10;
+ if (npc->tgt_y > npc->y)
+ npc->ym += 0x10;
+
+ if (npc->xm > 0x200)
+ npc->xm = 0x200;
+ if (npc->xm < -0x200)
+ npc->xm = -0x200;
+
+ if (npc->ym > 0x200)
+ npc->ym = 0x200;
+ if (npc->ym < -0x200)
+ npc->ym = -0x200;
+
+ 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 + 0xC000)
+ {
+ npc->xm /= 2;
+ 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 rect_left[4];
+ RECT rect_right[4];
+
+ rect_left[0] = {32, 80, 48, 96};
+ rect_left[1] = {48, 80, 64, 96};
+ rect_left[2] = {64, 80, 80, 96};
+ rect_left[3] = {80, 80, 96, 96};
+
+ rect_right[0] = {32, 96, 48, 112};
+ rect_right[1] = {48, 96, 64, 112};
+ rect_right[2] = {64, 96, 80, 112};
+ rect_right[3] = {80, 96, 96, 112};
+
+ 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 = rect_left[npc->ani_no];
+ else
+ npc->rect = rect_right[npc->ani_no];
+}
+
+//Death trap
+void ActNpc027(NPCHAR *npc)
+{
+ RECT rcLeft[1];
+
+ rcLeft[0] = {96, 64, 128, 88};
+
+ npc->rect = rcLeft[npc->ani_no];
+}
+
//Flying Critter (Grasstown)
void ActNpc028(NPCHAR *npc)
{
@@ -685,6 +810,137 @@
}
npc->rect = rc[npc->ani_no];
+}
+
+//Bat (Grasstown, hanging)
+void ActNpc031(NPCHAR *npc)
+{
+ RECT rcLeft[5];
+ RECT rcRight[5];
+
+ rcLeft[0] = {0, 80, 16, 96};
+ rcLeft[1] = {16, 80, 32, 96};
+ rcLeft[2] = {32, 80, 48, 96};
+ rcLeft[3] = {48, 80, 64, 96};
+ rcLeft[4] = {64, 80, 80, 96};
+
+ rcRight[0] = {0, 96, 16, 112};
+ rcRight[1] = {16, 96, 32, 112};
+ rcRight[2] = {32, 96, 48, 112};
+ rcRight[3] = {48, 96, 64, 112};
+ rcRight[4] = {64, 96, 80, 112};
+
+ switch (npc->act_no)
+ {
+ case 0:
+ npc->act_no = 1;
+ // 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 - 0x1000 && gMC.x < npc->x + 0x1000 && gMC.y > npc->y - 0x1000 && gMC.y < npc->y + 0xC000)
+ {
+ npc->ani_no = 0;
+ npc->act_no = 3;
+ }
+
+ break;
+
+ case 2:
+ if (++npc->act_wait > 8)
+ {
+ npc->act_no = 1;
+ npc->ani_no = 0;
+ }
+
+ break;
+
+ case 3:
+ npc->ani_no = 0;
+
+ if (npc->shock || gMC.x < npc->x - 0x2800 || gMC.x > npc->x + 0x2800)
+ {
+ npc->ani_no = 1;
+ npc->ani_wait = 0;
+ npc->act_no = 4;
+ npc->act_wait = 0;
+ }
+
+ break;
+
+ case 4:
+ npc->ym += 0x20;
+ if (npc->ym > 0x5FF)
+ npc->ym = 0x5FF;
+
+ if ((++npc->act_wait >= 20 || npc->flag & 8) && (npc->flag & 8 || npc->y > gMC.y - 0x2000))
+ {
+ npc->ani_wait = 0;
+ npc->ani_no = 2;
+ npc->act_no = 5;
+ npc->tgt_y = npc->y;
+
+ if (npc->flag & 8)
+ npc->ym = -0x200;
+ }
+
+ break;
+
+ case 5:
+ if (++npc->ani_wait > 1)
+ {
+ npc->ani_wait = 0;
+ ++npc->ani_no;
+ }
+
+ if (npc->ani_no > 4)
+ npc->ani_no = 2;
+
+ if (gMC.x < npc->x)
+ npc->direct = 0;
+ else
+ npc->direct = 2;
+
+ if (gMC.x < npc->x)
+ npc->xm -= 0x10;
+ if (gMC.x > npc->x)
+ npc->xm += 0x10;
+
+ if (npc->tgt_y < npc->y)
+ npc->ym -= 0x10;
+ if (npc->tgt_y > npc->y)
+ npc->ym += 0x10;
+
+ if (npc->xm > 0x200)
+ npc->xm = 0x200;
+ if (npc->xm < -0x200)
+ npc->xm = -0x200;
+
+ if (npc->ym > 0x200)
+ npc->ym = 0x200;
+ if (npc->ym < -0x200)
+ npc->ym = -0x200;
+
+ if (npc->flag & 8)
+ npc->ym = -0x200;
+ if (npc->flag & 2)
+ npc->ym = 0x200;
+
+ break;
+ }
+
+ 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];
}
//Life capsule
--- a/src/NpcAct080.cpp
+++ b/src/NpcAct080.cpp
@@ -1303,3 +1303,231 @@
npc->rect = rcLeft[npc->ani_no];
}
+
+//Chaco
+void ActNpc093(NPCHAR *npc)
+{
+ RECT rcLeft[7];
+ RECT rcRight[7];
+
+ rcLeft[0] = {128, 0, 144, 16};
+ rcLeft[1] = {144, 0, 160, 16};
+ rcLeft[2] = {160, 0, 176, 16};
+ rcLeft[3] = {128, 0, 144, 16};
+ rcLeft[4] = {176, 0, 192, 16};
+ rcLeft[5] = {128, 0, 144, 16};
+ rcLeft[6] = {32, 32, 48, 48};
+
+ rcRight[0] = {128, 16, 144, 32};
+ rcRight[1] = {144, 16, 160, 32};
+ rcRight[2] = {160, 16, 176, 32};
+ rcRight[3] = {128, 16, 144, 32};
+ rcRight[4] = {176, 16, 192, 32};
+ rcRight[5] = {128, 16, 144, 32};
+ rcRight[6] = {32, 32, 48, 48};
+
+ 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 - 0x4000 && gMC.x < npc->x + 0x4000 && gMC.y > npc->y - 0x4000 && gMC.y < npc->y + 0x2000)
+ {
+ 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 3:
+ npc->act_no = 4;
+ npc->ani_no = 2;
+ npc->ani_wait = 0;
+ // Fallthrough
+ case 4:
+ if (++npc->ani_wait > 4)
+ {
+ npc->ani_wait = 0;
+ ++npc->ani_no;
+ }
+
+ if (npc->ani_no > 5)
+ npc->ani_no = 2;
+
+ if (npc->direct == 0)
+ npc->x -= 0x200;
+ else
+ npc->x += 0x200;
+
+ break;
+
+ case 10:
+ npc->ani_no = 6;
+
+ if (++npc->act_wait > 200)
+ {
+ npc->act_wait = 0;
+ SetCaret(npc->x, npc->y, 5, 0);
+ }
+
+ break;
+ }
+
+ if (npc->direct == 0)
+ npc->rect = rcLeft[npc->ani_no];
+ else
+ npc->rect = rcRight[npc->ani_no];
+}
+
+//Jelly
+void ActNpc095(NPCHAR *npc)
+{
+ RECT rcLeft[4];
+ RECT rcRight[4];
+
+ rcLeft[0] = {208, 64, 224, 80};
+ rcLeft[1] = {224, 64, 240, 80};
+ rcLeft[2] = {240, 64, 256, 80};
+ rcLeft[3] = {256, 64, 272, 80};
+
+ rcRight[0] = {208, 80, 224, 96};
+ rcRight[1] = {224, 80, 240, 96};
+ rcRight[2] = {240, 80, 256, 96};
+ rcRight[3] = {256, 80, 272, 96};
+
+ switch (npc->act_no)
+ {
+ case 0:
+ npc->act_no = 1;
+ npc->act_wait = Random(0, 50);
+ npc->tgt_y = npc->y;
+ npc->tgt_x = npc->x;
+
+ if (npc->direct == 0)
+ npc->xm = 0x200;
+ else
+ npc->xm = -0x200;
+ // Fallthrough
+ case 1:
+ if (--npc->act_wait > 0)
+ break;
+
+ npc->act_no = 10;
+ // Fallthrough
+ case 10:
+ if (++npc->act_wait > 10)
+ {
+ npc->act_wait = 0;
+ npc->ani_wait = 0;
+ npc->act_no = 11;
+ }
+
+ break;
+
+ case 11:
+ if (++npc->ani_wait > 5)
+ {
+ npc->ani_wait = 0;
+ ++npc->ani_no;
+ }
+
+ if (npc->ani_no == 2)
+ {
+ if (npc->direct == 0)
+ npc->xm -= 0x100;
+ else
+ npc->xm += 0x100;
+
+ npc->ym -= 0x200;
+ }
+
+ if (npc->ani_no > 2)
+ {
+ npc->act_no = 12;
+ npc->ani_no = 3;
+ }
+
+ break;
+
+ case 12:
+ ++npc->act_wait;
+
+ if (npc->y > npc->tgt_y && npc->act_wait > 10)
+ {
+ npc->act_wait = 0;
+ npc->act_no = 10;
+ npc->ani_no = 0;
+ }
+
+ break;
+ }
+
+ if (npc->x > npc->tgt_x)
+ npc->direct = 0;
+ else
+ npc->direct = 2;
+
+ if (npc->flag & 1)
+ {
+ npc->count1 = 50;
+ npc->direct = 2;
+ }
+
+ if (npc->flag & 4)
+ {
+ npc->count1 = 50;
+ npc->direct = 0;
+ }
+
+ npc->ym += 0x20;
+
+ if (npc->flag & 8)
+ npc->ym = -0x400;
+
+ if (npc->xm > 0x100)
+ npc->xm = 0x100;
+ if (npc->xm < -0x100)
+ npc->xm = -0x100;
+
+ if (npc->ym > 0x200)
+ npc->ym = 0x200;
+ if (npc->ym < -0x200)
+ npc->ym = -0x200;
+
+ if (npc->shock)
+ {
+ npc->x += npc->xm / 2;
+ npc->y += npc->ym / 2;
+ }
+ else
+ {
+ 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/NpcTbl.cpp
+++ b/src/NpcTbl.cpp
@@ -82,12 +82,12 @@
ActNpc023,
ActNpc024,
ActNpc025,
- nullptr,
- nullptr,
+ ActNpc026,
+ ActNpc027,
ActNpc028,
ActNpc029,
ActNpc030,
- nullptr,
+ ActNpc031,
ActNpc032,
nullptr,
ActNpc034,
@@ -149,9 +149,9 @@
ActNpc090,
ActNpc091,
ActNpc092,
+ ActNpc093,
nullptr,
- nullptr,
- nullptr,
+ ActNpc095,
nullptr,
nullptr,
nullptr,