From 66d9de157240e2fcf6b3b1403ce1db9acb277532 Mon Sep 17 00:00:00 2001 From: Clownacy Date: Wed, 6 Feb 2019 22:46:28 +0000 Subject: [PATCH] More NPCs --- src/NpcAct.h | 3 + src/NpcAct180.cpp | 154 ++++++++++++++++++++++++++++++++++++++++++++++ src/NpcTbl.cpp | 4 +- 3 files changed, 159 insertions(+), 2 deletions(-) diff --git a/src/NpcAct.h b/src/NpcAct.h index 6b498942..2720a1c4 100644 --- a/src/NpcAct.h +++ b/src/NpcAct.h @@ -186,6 +186,9 @@ void ActNpc181(NPCHAR *npc); void ActNpc182(NPCHAR *npc); void ActNpc183(NPCHAR *npc); +void ActNpc187(NPCHAR *npc); +void ActNpc188(NPCHAR *npc); + void ActNpc192(NPCHAR *npc); void ActNpc193(NPCHAR *npc); void ActNpc194(NPCHAR *npc); diff --git a/src/NpcAct180.cpp b/src/NpcAct180.cpp index b6484ff5..64db14d7 100644 --- a/src/NpcAct180.cpp +++ b/src/NpcAct180.cpp @@ -541,6 +541,160 @@ void ActNpc183(NPCHAR *npc) } } +//Fuzz Core +void ActNpc187(NPCHAR *npc) +{ + switch (npc->act_no) + { + case 0: + npc->act_no = 1; + npc->tgt_x = npc->x; + npc->tgt_y = npc->y; + npc->count1 = 120; + npc->act_wait = Random(0, 50); + + for (int i = 0; i < 5; ++i) + SetNpChar(188, 0, 0, 0, 0, 51 * i, npc, 0x100); + // Fallthrough + case 1: + if (++npc->act_wait >= 50) + { + npc->act_wait = 0; + npc->act_no = 2; + npc->ym = 0x300; + } + + break; + + case 2: + npc->count1 += 4; + + if (gMC.x < npc->x) + npc->direct = 0; + else + npc->direct = 2; + + if (npc->tgt_y < npc->y) + npc->ym -= 0x10; + if (npc->tgt_y > npc->y) + npc->ym += 0x10; + + if (npc->ym > 0x355) + npc->ym = 0x355; + if (npc->ym < -0x355) + npc->ym = -0x355; + + break; + } + + npc->x += npc->xm; + npc->y += npc->ym; + + RECT rect_left[2]; + RECT rect_right[2]; + + rect_left[0] = {224, 104, 256, 136}; + rect_left[1] = {256, 104, 288, 136}; + + rect_right[0] = {224, 136, 256, 168}; + rect_right[1] = {256, 136, 288, 168}; + + if (++npc->ani_wait > 2) + { + npc->ani_wait = 0; + ++npc->ani_no; + } + + if (npc->ani_no > 1) + npc->ani_no = 0; + + if (npc->direct == 0) + npc->rect = rect_left[npc->ani_no]; + else + npc->rect = rect_right[npc->ani_no]; +} + +//Fuzz +void ActNpc188(NPCHAR *npc) +{ + RECT rect_left[2]; + RECT rect_right[2]; + + switch (npc->act_no) + { + case 0: + npc->act_no = 1; + npc->count1 = npc->direct; + // Fallthrough + case 1: + if (npc->pNpc->code_char == 187 && npc->pNpc->cond & 0x80) + { + const unsigned char deg = npc->count1 + npc->pNpc->count1; + npc->x = npc->pNpc->x + 20 * GetSin(deg); + npc->y = npc->pNpc->y + 0x20 * GetCos(deg); + } + else + { + npc->xm = Random(-0x200, 0x200); + npc->ym = Random(-0x200, 0x200); + npc->act_no = 10; + } + + break; + + case 10: + if (gMC.x < npc->x) + npc->xm -= 0x20; + else + npc->xm += 0x20; + + if (gMC.y < npc->y) + npc->ym -= 0x20; + else + npc->ym += 0x20; + + if (npc->xm > 0x800) + npc->xm = 0x800; + if (npc->xm < -0x800) + npc->xm = -0x800; + + if (npc->ym > 0x200) + npc->ym = 0x200; + if (npc->ym < -0x200) + npc->ym = -0x200; + + npc->x += npc->xm; + npc->y += npc->ym; + + break; + } + + if (gMC.x < npc->x) + npc->direct = 0; + else + npc->direct = 2; + + if (++npc->ani_wait > 2) + { + npc->ani_wait = 0; + ++npc->ani_no; + } + + if (npc->ani_no > 1) + npc->ani_no = 0; + + rect_left[0] = {288, 104, 304, 120}; + rect_left[1] = {304, 104, 320, 120}; + + rect_right[0] = {288, 120, 304, 136}; + rect_right[1] = {304, 120, 320, 136}; + + if (npc->direct == 0) + npc->rect = rect_left[npc->ani_no]; + else + npc->rect = rect_right[npc->ani_no]; +} + //Scooter void ActNpc192(NPCHAR *npc) { diff --git a/src/NpcTbl.cpp b/src/NpcTbl.cpp index 700f95ff..641c3e68 100644 --- a/src/NpcTbl.cpp +++ b/src/NpcTbl.cpp @@ -243,8 +243,8 @@ NPCFUNCTION gpNpcFuncTbl[361] = nullptr, nullptr, nullptr, - nullptr, - nullptr, + ActNpc187, + ActNpc188, nullptr, nullptr, nullptr,