ref: 91a7c0185c593d0059d5b68c59b54b4df8cad606
parent: 37dcdcda34f6c34dbf40d8053b4769e07258e16f
author: Clownacy <Clownacy@users.noreply.github.com>
date: Mon Feb 4 16:16:41 EST 2019
Added more NPCs Started on Sand Zone NPCs
--- a/src/NpcAct.h
+++ b/src/NpcAct.h
@@ -52,6 +52,7 @@
void ActNpc048(NPCHAR *npc);
void ActNpc055(NPCHAR *npc);
+void ActNpc056(NPCHAR *npc);
void ActNpc058(NPCHAR *npc);
void ActNpc059(NPCHAR *npc);
@@ -112,6 +113,7 @@
void ActNpc114(NPCHAR *npc);
void ActNpc115(NPCHAR *npc);
void ActNpc116(NPCHAR *npc);
+void ActNpc117(NPCHAR *npc);
void ActNpc119(NPCHAR *npc);
@@ -126,9 +128,14 @@
void ActNpc150(NPCHAR *npc);
void ActNpc151(NPCHAR *npc);
+void ActNpc192(NPCHAR *npc);
+void ActNpc193(NPCHAR *npc);
+
void ActNpc199(NPCHAR *npc);
void ActNpc211(NPCHAR *npc);
+
+void ActNpc219(NPCHAR *npc);
void ActNpc278(NPCHAR *npc);
--- a/src/NpcAct040.cpp
+++ b/src/NpcAct040.cpp
@@ -565,6 +565,121 @@
npc->rect = rcRight[npc->ani_no];
}
+//Beetle (Sand Zone)
+void ActNpc056(NPCHAR *npc)
+{
+ RECT rcLeft[3];
+ RECT rcRight[3];
+
+ rcLeft[0] = {0, 144, 16, 160};
+ rcLeft[1] = {16, 144, 32, 160};
+ rcLeft[2] = {32, 144, 48, 160};
+
+ rcRight[0] = {0, 160, 16, 176};
+ rcRight[1] = {16, 160, 32, 176};
+ rcRight[2] = {32, 160, 48, 176};
+
+ switch (npc->act_no)
+ {
+ case 0:
+ npc->act_no = 1;
+
+ if (npc->direct == 0)
+ npc->act_no = 1;
+ else
+ npc->act_no = 3;
+
+ break;
+
+ case 1:
+ npc->xm -= 0x10;
+
+ if (npc->xm < -0x400)
+ npc->xm = -0x400u;
+
+ if (npc->shock)
+ npc->x += npc->xm / 2;
+ else
+ npc->x += npc->xm;
+
+ if (++npc->ani_wait > 1)
+ {
+ npc->ani_wait = 0;
+ ++npc->ani_no;
+ }
+
+ if (npc->ani_no > 2)
+ npc->ani_no = 1;
+
+ if (npc->flag & 1)
+ {
+ npc->act_no = 2;
+ npc->act_wait = 0;
+ npc->ani_no = 0;
+ npc->xm = 0;
+ npc->direct = 2;
+ }
+
+ break;
+
+ case 2:
+ if (npc->x < gMC.x && npc->x > gMC.x - 0x20000 && npc->y < gMC.y + 0x1000 && npc->y > gMC.y - 0x1000)
+ {
+ npc->act_no = 3;
+ npc->ani_wait = 0;
+ npc->ani_no = 1;
+ }
+
+ break;
+
+ case 3:
+ npc->xm += 0x10;
+
+ if (npc->xm > 0x400)
+ npc->xm = 0x400;
+
+ if (npc->shock)
+ npc->x += npc->xm / 2;
+ else
+ npc->x += npc->xm;
+
+ if (++npc->ani_wait > 1)
+ {
+ npc->ani_wait = 0;
+ ++npc->ani_no;
+ }
+
+ if (npc->ani_no > 2)
+ npc->ani_no = 1;
+
+ if (npc->flag & 4)
+ {
+ npc->act_no = 4;
+ npc->act_wait = 0;
+ npc->ani_no = 0;
+ npc->xm = 0;
+ npc->direct = 0;
+ }
+
+ break;
+
+ case 4:
+ if (npc->x < gMC.x + 0x20000 && npc->x > gMC.x && npc->y < gMC.y + 0x1000 && npc->y > gMC.y - 0x1000)
+ {
+ npc->act_no = 1;
+ npc->ani_wait = 0;
+ npc->ani_no = 1;
+ }
+
+ break;
+ }
+
+ if (npc->direct == 0)
+ npc->rect = rcLeft[npc->ani_no];
+ else
+ npc->rect = rcRight[npc->ani_no];
+}
+
//Basu (Egg Corridor)
void ActNpc058(NPCHAR *npc)
{
--- a/src/NpcAct100.cpp
+++ b/src/NpcAct100.cpp
@@ -1273,6 +1273,191 @@
npc->rect = rc[0];
}
+//Curly
+void ActNpc117(NPCHAR *npc)
+{
+ RECT rcLeft[10];
+ RECT rcRight[10];
+
+ rcLeft[0] = {0, 96, 16, 112};
+ rcLeft[1] = {16, 96, 32, 112};
+ rcLeft[2] = {0, 96, 16, 112};
+ rcLeft[3] = {32, 96, 48, 112};
+ rcLeft[4] = {0, 96, 16, 112};
+ rcLeft[5] = {176, 96, 192, 112};
+ rcLeft[6] = {112, 96, 128, 112};
+ rcLeft[7] = {160, 96, 176, 112};
+ rcLeft[8] = {144, 96, 160, 112};
+ rcLeft[9] = {48, 96, 64, 112};
+
+ rcRight[0] = {0, 112, 16, 128};
+ rcRight[1] = {16, 112, 32, 128};
+ rcRight[2] = {0, 112, 16, 128};
+ rcRight[3] = {32, 112, 48, 128};
+ rcRight[4] = {0, 112, 16, 128};
+ rcRight[5] = {176, 112, 192, 128};
+ rcRight[6] = {112, 112, 128, 128};
+ rcRight[7] = {160, 112, 176, 128};
+ rcRight[8] = {144, 112, 160, 128};
+ rcRight[9] = {48, 112, 64, 128};
+
+ switch (npc->act_no)
+ {
+ case 0:
+ if (npc->direct == 4)
+ {
+ if (gMC.x < npc->x)
+ npc->direct = 0;
+ else
+ npc->direct = 2;
+ }
+
+ npc->act_no = 1;
+ npc->ani_no = 0;
+ npc->ani_wait = 0;
+ // Fallthrough
+ case 1:
+ npc->xm = 0;
+ npc->ym += 0x40;
+ break;
+
+ case 3:
+ npc->act_no = 4;
+ npc->ani_no = 1;
+ npc->ani_wait = 0;
+ // Fallthrough
+ case 4:
+ if (++npc->ani_wait > 4)
+ {
+ npc->ani_wait = 0;
+ ++npc->ani_no;
+ }
+
+ if (npc->ani_no > 4)
+ npc->ani_no = 1;
+
+ npc->ym += 0x40;
+
+ if (npc->direct == 0)
+ npc->xm = -0x200;
+ else
+ npc->xm = 0x200;
+
+ break;
+
+ case 5:
+ npc->act_no = 6;
+ npc->ani_no = 5;
+ SetDestroyNpChar(npc->x, npc->y, npc->view.back, 8);
+ break;
+
+ case 6:
+ npc->ani_no = 5;
+ break;
+
+ case 10:
+ npc->act_no = 11;
+ npc->ani_no = 1;
+ npc->ani_wait = 0;
+
+ if (gMC.x < npc->x)
+ npc->direct = 0;
+ else
+ npc->direct = 2;
+
+ // Fallthrough
+ case 11:
+ if (++npc->ani_wait > 4)
+ {
+ npc->ani_wait = 0;
+ ++npc->ani_no;
+ }
+
+ if (npc->ani_no > 4)
+ npc->ani_no = 1;
+
+ if (npc->direct == 0)
+ npc->x -= 0x200;
+ else
+ npc->x += 0x200;
+
+ if (gMC.x < npc->x + 0x2800 && gMC.x > npc->x - 0x2800)
+ npc->act_no = 0;
+
+ break;
+
+ case 20:
+ npc->xm = 0;
+ npc->ani_no = 6;
+ break;
+
+ case 21:
+ npc->xm = 0;
+ npc->ani_no = 9;
+ break;
+
+ case 30:
+ npc->act_no = 31;
+ npc->act_wait = 0;
+ npc->ym = -0x400u;
+ // Fallthrough
+ case 31:
+ npc->ani_no = 7;
+
+ if (npc->direct == 0)
+ npc->xm = 0x200;
+ else
+ npc->xm = -0x200u;
+
+ npc->ym += 0x40;
+
+ if (npc->act_wait++ && npc->flag & 8)
+ npc->act_no = 32;
+
+ break;
+
+ case 32:
+ npc->ym += 0x40;
+ npc->ani_no = 8;
+ npc->xm = 0;
+ break;
+
+ case 70:
+ npc->act_no = 71;
+ npc->act_wait = 0;
+ npc->ani_no = 1;
+ npc->ani_wait = 0;
+ // Fallthrough
+ case 71:
+ if (npc->direct == 0)
+ npc->x += 0x100;
+ else
+ npc->x -= 0x100;
+
+ if (++npc->ani_wait > 8)
+ {
+ npc->ani_wait = 0;
+ ++npc->ani_no;
+ }
+
+ if (npc->ani_no > 4)
+ npc->ani_no = 1;
+
+ break;
+ }
+
+ 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];
+}
+
//Table and chair
void ActNpc119(NPCHAR *npc)
{
--- a/src/NpcAct180.cpp
+++ b/src/NpcAct180.cpp
@@ -8,6 +8,126 @@
#include "Sound.h"
#include "Back.h"
#include "Triangle.h"
+#include "Caret.h"
+
+//Scooter
+void ActNpc192(NPCHAR *npc)
+{
+ switch ( npc->act_no )
+ {
+ case 0:
+ npc->act_no = 1;
+ npc->view.back = 0x2000;
+ npc->view.front = 0x2000;
+ npc->view.top = 0x1000;
+ npc->view.bottom = 0x1000;
+ break;
+
+ case 10:
+ npc->act_no = 11;
+ npc->ani_no = 1;
+ npc->view.top = 0x2000;
+ npc->view.bottom = 0x2000;
+ npc->y -= 0xA00;
+ break;
+
+ case 20:
+ npc->act_no = 21;
+ npc->act_wait = 1;
+ npc->tgt_x = npc->x;
+ npc->tgt_y = npc->y;
+ // Fallthrough
+ case 21:
+ npc->x = npc->tgt_x + (Random(-1, 1) * 0x200);
+ npc->y = npc->tgt_y + (Random(-1, 1) * 0x200);
+
+ if (++npc->act_wait > 30)
+ npc->act_no = 30;
+
+ break;
+
+ case 30:
+ npc->act_no = 31;
+ npc->act_wait = 1;
+ npc->xm = -0x800;
+ npc->x = npc->tgt_x;
+ npc->y = npc->tgt_y;
+ PlaySoundObject(44, 1);
+ // Fallthrough
+ case 31:
+ npc->xm += 0x20;
+ npc->x += npc->xm;
+ ++npc->act_wait;
+ npc->y = npc->tgt_y + (Random(-1, 1) * 0x200);
+
+ if (npc->act_wait > 10)
+ npc->direct = 2;
+
+ if (npc->act_wait > 200)
+ npc->act_no = 40;
+
+ break;
+
+ case 40:
+ npc->act_no = 41;
+ npc->act_wait = 2;
+ npc->direct = 0;
+ npc->y -= 0x6000;
+ npc->xm = -0x1000;
+ // Fallthrough
+ case 41:
+ npc->x += npc->xm;
+ npc->y += npc->ym;
+
+ npc->act_wait += 2;
+
+ if (npc->act_wait > 1200)
+ npc->cond = 0;
+
+ break;
+ }
+
+ if (npc->act_wait % 4 == 0 && npc->act_no >= 20)
+ {
+ PlaySoundObject(34, 1);
+
+ if (npc->direct == 0)
+ SetCaret(npc->x + 5120, npc->y + 5120, 7, 2);
+ else
+ SetCaret(npc->x - 5120, npc->y + 5120, 7, 0);
+ }
+
+ RECT rcLeft[2];
+ RECT rcRight[2];
+
+ rcLeft[0] = {224, 64, 256, 80};
+ rcLeft[1] = {256, 64, 288, 96};
+
+ rcRight[0] = {224, 80, 256, 96};
+ rcRight[1] = {288, 64, 320, 96};
+
+ if (npc->direct == 0)
+ npc->rect = rcLeft[npc->ani_no];
+ else
+ npc->rect = rcRight[npc->ani_no];
+}
+
+//Scooter (broken)
+void ActNpc193(NPCHAR *npc)
+{
+ RECT rc[1];
+
+ rc[0] = {256, 96, 320, 112};
+
+ if (npc->act_no == 0)
+ {
+ npc->act_no = 1;
+ npc->y = npc->y;
+ npc->x += 0x3000;
+ }
+
+ npc->rect = rc[0];
+}
//Water/wind particles
void ActNpc199(NPCHAR *npc)
--- a/src/NpcAct200.cpp
+++ b/src/NpcAct200.cpp
@@ -21,3 +21,18 @@
npc->rect = rects[npc->code_event];
}
+
+//Smoke generator
+void ActNpc219(NPCHAR *npc)
+{
+ RECT rc[1];
+
+ rc[0] = {0, 0, 0, 0};
+
+ if ( npc->direct )
+ SetNpChar(199, npc->x + (Random(-0xA0, 0xA0) * 0x200), npc->y + (Random(-0x80, 0x80) * 0x200), 0, 0, 2, 0, 0x100);
+ else if (Random(0, 40) == 1)
+ SetNpChar(4, npc->x + (Random(-20, 20) * 0x200), npc->y, 0, -0x200, 0, 0, 0x100);
+
+ npc->rect = rc[1];
+}
\ No newline at end of file
--- a/src/NpcTbl.cpp
+++ b/src/NpcTbl.cpp
@@ -112,8 +112,8 @@
nullptr,
nullptr,
ActNpc055,
+ ActNpc056,
nullptr,
- nullptr,
ActNpc058,
ActNpc059,
ActNpc060,
@@ -173,8 +173,8 @@
ActNpc114,
ActNpc115,
ActNpc116,
+ ActNpc117,
nullptr,
- nullptr,
ActNpc119,
nullptr,
nullptr,
@@ -248,13 +248,13 @@
nullptr,
nullptr,
nullptr,
+ ActNpc192,
+ ActNpc193,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
- nullptr,
- nullptr,
ActNpc199,
nullptr,
nullptr,
@@ -275,7 +275,7 @@
nullptr,
nullptr,
nullptr,
- nullptr,
+ ActNpc219,
nullptr,
nullptr,
nullptr,
--
⑨