From 22ccaf76b01138621863a485de1f18e5baff39f8 Mon Sep 17 00:00:00 2001 From: Clownacy Date: Sat, 9 Feb 2019 20:36:59 +0000 Subject: [PATCH] Hell NPCs --- src/NpcAct.h | 15 +- src/NpcAct300.cpp | 827 ++++++++++++++++++++++++++++++++++++++++++++++ src/NpcAct320.cpp | 417 +++++++++++++++++++++++ src/NpcTbl.cpp | 28 +- 4 files changed, 1272 insertions(+), 15 deletions(-) diff --git a/src/NpcAct.h b/src/NpcAct.h index 47c15459..b9b3a3b8 100644 --- a/src/NpcAct.h +++ b/src/NpcAct.h @@ -311,10 +311,23 @@ void ActNpc305(NPCHAR *npc); void ActNpc306(NPCHAR *npc); void ActNpc307(NPCHAR *npc); void ActNpc308(NPCHAR *npc); - +void ActNpc309(NPCHAR *npc); +void ActNpc310(NPCHAR *npc); +void ActNpc311(NPCHAR *npc); +void ActNpc312(NPCHAR *npc); void ActNpc313(NPCHAR *npc); void ActNpc314(NPCHAR *npc); void ActNpc315(NPCHAR *npc); +void ActNpc316(NPCHAR *npc); +void ActNpc317(NPCHAR *npc); +void ActNpc318(NPCHAR *npc); +void ActNpc319(NPCHAR *npc); +void ActNpc320(NPCHAR *npc); +void ActNpc321(NPCHAR *npc); +void ActNpc322(NPCHAR *npc); +void ActNpc323(NPCHAR *npc); +void ActNpc324(NPCHAR *npc); +void ActNpc325(NPCHAR *npc); void ActNpc334(NPCHAR *npc); void ActNpc335(NPCHAR *npc); diff --git a/src/NpcAct300.cpp b/src/NpcAct300.cpp index 0e2f7078..49e62188 100644 --- a/src/NpcAct300.cpp +++ b/src/NpcAct300.cpp @@ -483,6 +483,518 @@ void ActNpc308(NPCHAR *npc) npc->rect = rcRight[npc->ani_no]; } +//Bute +void ActNpc309(NPCHAR *npc) +{ + RECT rcLeft[2]; + RECT rcRight[2]; + + rcLeft[0] = {0, 0, 16, 16}; + rcLeft[1] = {16, 0, 32, 16}; + + rcRight[0] = {0, 16, 16, 32}; + rcRight[1] = {16, 16, 32, 32}; + + switch (npc->act_no) + { + case 0: + npc->act_no = 1; + // Fallthrough + case 1: + if (npc->direct == 0) + { + if (gMC.x <= npc->x - 0x24000 || gMC.x >= npc->x - 0x22000) + return; + + npc->act_no = 10; + } + else + { + if (gMC.x >= npc->x + 0x24000 || gMC.x <= npc->x + 0x22000) + return; + + npc->act_no = 10; + } + + break; + + case 10: + npc->act_no = 11; + npc->bits |= 0x20; + npc->damage = 5; + // Fallthrough + case 11: + if (gMC.x < npc->x) + npc->direct = 0; + else + npc->direct = 2; + + if (npc->direct == 0) + npc->xm2 -= 0x10; + else + npc->xm2 += 0x10; + + if (gMC.y < npc->y) + npc->ym2 -= 0x10; + else + npc->ym2 += 0x10; + + if (npc->xm2 < 0 && npc->flag & 1) + npc->xm2 = -npc->xm2; + if (npc->xm2 > 0 && npc->flag & 4) + 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->xm2 < -0x5FF) + npc->xm2 = -0x5FF; + if (npc->xm2 > 0x5FF) + npc->xm2 = 0x5FF; + + if (npc->ym2 < -0x5FF) + npc->ym2 = -0x5FF; + if (npc->ym2 > 0x5FF) + npc->ym2 = 0x5FF; + + npc->x += npc->xm2; + npc->y += npc->ym2; + + if (++npc->ani_wait > 1) + { + npc->ani_wait = 0; + ++npc->ani_no; + } + + 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]; + + if (npc->life <= 996) + { + npc->code_char = 316; + npc->act_no = 0; + } +} + +//Bute (with sword) +void ActNpc310(NPCHAR *npc) +{ + RECT rcLeft[5]; + RECT rcRight[5]; + + rcLeft[0] = {32, 0, 56, 16}; + rcLeft[1] = {56, 0, 80, 16}; + rcLeft[2] = {80, 0, 104, 16}; + rcLeft[3] = {104, 0, 128, 16}; + rcLeft[4] = {128, 0, 152, 16}; + + rcRight[0] = {32, 16, 56, 32}; + rcRight[1] = {56, 16, 80, 32}; + rcRight[2] = {80, 16, 104, 32}; + rcRight[3] = {104, 16, 128, 32}; + rcRight[4] = {128, 16, 152, 32}; + + switch (npc->act_no) + { + case 0: + npc->act_no = 1; + npc->bits &= ~0x20; + npc->bits |= 4; + npc->damage = 0; + // Fallthrough + case 1: + if (gMC.x < npc->x) + npc->direct = 0; + else + npc->direct = 2; + + npc->ani_no = 0; + + if (gMC.x > npc->x - 0x10000 && gMC.x < npc->x + 0x10000 && gMC.y > npc->y - 0x10000 && gMC.y < npc->y + 0x2000) + npc->act_no = 10; + + break; + + case 10: + npc->xm = 0; + npc->act_no = 11; + npc->act_wait = 0; + npc->bits &= ~0x20; + npc->bits |= 4; + npc->damage = 0; + npc->ani_no = 0; + // Fallthrough + case 11: + if (++npc->act_wait > 30) + npc->act_no = 20; + + break; + + case 20: + npc->act_no = 21; + npc->act_wait = 0; + npc->bits &= ~4; + npc->bits |= 0x20; + npc->damage = 0; + + if (gMC.x < npc->x) + npc->direct = 0; + else + npc->direct = 2; + // Fallthrough + case 21: + if (npc->direct == 0) + npc->xm = -0x400; + else + npc->xm = 0x400; + + if (++npc->ani_wait > 3) + { + npc->ani_wait = 0; + ++npc->ani_no; + } + + if (npc->ani_no > 1) + npc->ani_no = 0; + + if (++npc->act_wait > 50) + npc->act_no = 10; + + if (npc->x < gMC.x + 0x5000 && npc->x > gMC.x - 0x5000) + { + npc->ym = -0x300; + npc->xm /= 2; + npc->ani_no = 2; + npc->act_no = 30; + PlaySoundObject(30, 1); + } + + break; + + case 30: + if (npc->ym > -0x80) + { + npc->act_no = 31; + npc->ani_wait = 0; + npc->ani_no = 3; + npc->damage = 9; + } + + break; + + case 31: + if (++npc->ani_wait > 2) + { + npc->ani_wait = 0; + npc->ani_no = 4; + } + + if (npc->flag & 8) + { + npc->act_no = 32; + npc->act_wait = 0; + npc->xm = 0; + npc->damage = 3; + } + + break; + + case 32: + if (++npc->act_wait > 30) + { + npc->act_no = 10; + npc->damage = 0; + } + + break; + } + + npc->ym += 0x20; + + 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]; + + if (npc->life <= 996) + { + npc->code_char = 316; + npc->act_no = 0; + } +} + +//Bute archer +void ActNpc311(NPCHAR *npc) +{ + RECT rcLeft[7]; + RECT rcRight[7]; + + rcLeft[0] = {0, 32, 24, 56}; + rcLeft[1] = {24, 32, 48, 56}; + rcLeft[2] = {48, 32, 72, 56}; + rcLeft[3] = {72, 32, 96, 56}; + rcLeft[4] = {96, 32, 120, 56}; + rcLeft[5] = {120, 32, 144, 56}; + rcLeft[6] = {144, 32, 168, 56}; + + rcRight[0] = {0, 56, 24, 80}; + rcRight[1] = {24, 56, 48, 80}; + rcRight[2] = {48, 56, 72, 80}; + rcRight[3] = {72, 56, 96, 80}; + rcRight[4] = {96, 56, 120, 80}; + rcRight[5] = {120, 56, 144, 80}; + rcRight[6] = {144, 56, 168, 80}; + + switch (npc->act_no) + { + case 0: + npc->act_no = 1; + // Fallthrough + case 1: + if (npc->direct == 0) + { + if (gMC.x > npc->x - 0x28000 && gMC.x < npc->x && gMC.y > npc->y - 0x14000 && gMC.y < npc->y + 0x14000) + npc->act_no = 10; + } + else + { + if (gMC.x > npc->x && gMC.x < npc->x + 0x28000 && gMC.y > npc->y - 0x14000 && gMC.y < npc->y + 0x14000) + npc->act_no = 10; + } + + break; + + case 10: + npc->act_no = 11; + // Fallthrough + case 11: + if (gMC.x < npc->x) + npc->direct = 0; + else + npc->direct = 2; + + if (gMC.x > npc->x - 0x1C000 && gMC.x < npc->x + 0x1C000 && gMC.y > npc->y - 0x1000) + { + npc->ani_no = 1; + npc->count1 = 0; + } + else + { + npc->ani_no = 4; + npc->count1 = 1; + } + + if (++npc->act_wait > 10) + npc->act_no = 20; + + break; + + case 20: + npc->act_no = 21; + npc->act_wait = 0; + // Fallthrough + case 21: + if (npc->count1) + { + if (++npc->ani_no > 5) + npc->ani_no = 4; + } + else + { + if (++npc->ani_no > 2) + npc->ani_no = 1; + } + + if (++npc->act_wait > 30) + npc->act_no = 30; + + break; + + case 30: + npc->act_no = 31; + npc->act_wait = 0; + + if (npc->count1) + { + if (npc->direct == 0) + SetNpChar(312, npc->x, npc->y, -0x600, -0x600, 0, 0, 0x100); + else + SetNpChar(312, npc->x, npc->y, 0x600, -0x600, 2, 0, 0x100); + + npc->ani_no = 6; + } + else + { + if (npc->direct == 0) + SetNpChar(312, npc->x, npc->y, -0x600, 0, 0, 0, 0x100); + else + SetNpChar(312, npc->x, npc->y, 0x600, 0, 2, 0, 0x100); + + npc->ani_no = 3; + } + // Fallthrough + case 31: + if (++npc->act_wait > 30) + { + npc->act_no = 40; + npc->act_wait = Random(0, 100); + } + + break; + + case 40: + npc->ani_no = 0; + + if (++npc->act_wait > 150) + npc->act_no = 10; + + if (gMC.x < npc->x - 0x2C000 || gMC.x > npc->x + 0x2C000 || gMC.y < npc->y - 0x1E000 || gMC.y > npc->y + 0x1E000) + { + npc->act_no = 40; + npc->act_wait = 0; + } + + break; + } + + if (npc->direct == 0) + npc->rect = rcLeft[npc->ani_no]; + else + npc->rect = rcRight[npc->ani_no]; + + if (npc->life <= 992) + { + npc->code_char = 316; + npc->act_no = 0; + } +} + +//Bute arrow projectile +void ActNpc312(NPCHAR *npc) +{ + RECT rcLeft[5]; + RECT rcRight[5]; + + rcLeft[0] = {0, 160, 16, 176}; + rcLeft[1] = {16, 160, 32, 176}; + rcLeft[2] = {32, 160, 48, 176}; + rcLeft[3] = {48, 160, 64, 176}; + rcLeft[4] = {64, 160, 80, 176}; + + rcRight[0] = {0, 176, 16, 192}; + rcRight[1] = {16, 176, 32, 192}; + rcRight[2] = {32, 176, 48, 192}; + rcRight[3] = {48, 176, 64, 192}; + rcRight[4] = {64, 176, 80, 192}; + + if (npc->act_no > 0 && npc->act_no < 20 && npc->flag & 0xFF) + npc->act_no = 20; + + switch (npc->act_no) + { + case 0: + npc->act_no = 1; + npc->act_wait = 0; + + if (npc->xm < 0) + npc->direct = 0; + else + npc->direct = 2; + + if (npc->ym < 0) + npc->ani_no = 0; + else + npc->ani_no = 2; + // Fallthrough + case 1: + ++npc->act_wait; + + if (npc->act_wait == 4) + npc->bits &= ~8; + + if (npc->act_wait > 10) + npc->act_no = 10; + + break; + + case 10: + npc->act_no = 11; + npc->ani_wait = 0; + npc->xm = 3 * npc->xm / 4; + npc->ym = 3 * npc->ym / 4; + // Fallthrough + case 11: + npc->ym += 0x20; + + if (++npc->ani_wait > 10) + { + npc->ani_wait = 0; + ++npc->ani_no; + } + + if (npc->ani_no > 4) + npc->ani_no = 4; + + break; + + case 20: + npc->act_no = 21; + npc->act_wait = 0; + npc->xm = 0; + npc->ym = 0; + npc->damage = 0; + // Fallthrough + case 21: + if (++npc->act_wait > 30) + npc->act_no = 30; + + break; + + case 30: + npc->act_no = 31; + npc->act_wait = 0; + // Fallthrough + case 31: + if (++npc->act_wait > 30) + npc->cond = 0; + + 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]; + + if (npc->act_no == 31) + { + if (npc->act_wait / 2 & 1) + { + npc->rect.left = 0; + npc->rect.right = 0; + } + } +} + //Ma Pignon void ActNpc313(NPCHAR *npc) { @@ -1043,3 +1555,318 @@ void ActNpc315(NPCHAR *npc) npc->rect = rcRight[npc->ani_no]; } } + +//Bute (dead) +void ActNpc316(NPCHAR *npc) +{ + RECT rcLeft[3]; + RECT rcRight[3]; + + rcLeft[0] = {248, 32, 272, 56}; + rcLeft[1] = {272, 32, 296, 56}; + rcLeft[2] = {296, 32, 320, 56}; + + rcRight[0] = {248, 56, 272, 80}; + rcRight[1] = {272, 56, 296, 80}; + rcRight[2] = {296, 56, 320, 80}; + + switch (npc->act_no) + { + case 0: + npc->bits &= ~0x20; + npc->bits &= ~8; + npc->damage = 0; + npc->act_no = 1; + npc->ani_no = 0; + npc->view.front = 0x1800; + npc->view.back = 0x1800; + npc->view.top = 0x1800; + npc->ym = -0x200; + + if (npc->direct == 0) + npc->xm = 0x100; + else + npc->xm = -0x100; + + PlaySoundObject(50, 1); + + break; + + case 1: + if (npc->flag & 8) + { + npc->ani_no = 1; + npc->ani_wait = 0; + npc->act_no = 2; + npc->act_wait = 0; + } + + break; + + case 2: + npc->xm = 8 * npc->xm / 9; + + if (++npc->ani_wait > 3) + { + npc->ani_wait = 0; + ++npc->ani_no; + } + + if (npc->ani_no > 2) + npc->ani_no = 1; + + if (++npc->act_wait > 50) + npc->cond |= 8; + + 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]; +} + +//Mesa +void ActNpc317(NPCHAR *npc) +{ + RECT rcLeft[4]; + RECT rcRight[4]; + + rcLeft[0] = {0, 80, 32, 120}; + rcLeft[1] = {32, 80, 64, 120}; + rcLeft[2] = {64, 80, 96, 120}; + rcLeft[3] = {96, 80, 128, 120}; + + rcRight[0] = {0, 120, 32, 160}; + rcRight[1] = {32, 120, 64, 160}; + rcRight[2] = {64, 120, 96, 160}; + rcRight[3] = {96, 120, 128, 160}; + + 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; + npc->count1 = 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 (gMC.x > npc->x - 0x28000 && gMC.x < npc->x + 0x28000 && gMC.y > npc->y - 0x14000 && gMC.y < npc->y + 0x14000 && ++npc->count1 > 50 ) + { + npc->act_no = 10; + } + + break; + + case 10: + npc->act_no = 11; + npc->act_wait = 0; + npc->ani_no = 2; + SetNpChar(319, npc->x, npc->y, 0, 0, 0, npc, 0x100); + // Fallthrough + case 11: + if (++npc->act_wait > 50) + { + npc->act_wait = 0; + npc->act_no = 12; + npc->ani_no = 3; + PlaySoundObject(39, 1); + } + + break; + + case 12: + if (++npc->act_wait > 20) + 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]; + + if (npc->life <= 936) + { + npc->code_char = 318; + npc->act_no = 0; + } +} + +//Mesa (dead) +void ActNpc318(NPCHAR *npc) +{ + RECT rcLeft[3]; + RECT rcRight[3]; + + rcLeft[0] = {224, 80, 256, 120}; + rcLeft[1] = {256, 80, 288, 120}; + rcLeft[2] = {288, 80, 320, 120}; + + rcRight[0] = {224, 120, 256, 160}; + rcRight[1] = {256, 120, 288, 160}; + rcRight[2] = {288, 120, 320, 160}; + + switch (npc->act_no) + { + case 0: + npc->bits &= ~0x20; + npc->bits &= ~8; + npc->bits &= ~1; + npc->damage = 0; + npc->act_no = 1; + npc->ani_no = 0; + npc->ym = -0x200; + + if (npc->direct == 0) + npc->xm = 0x40; + else + npc->xm = -0x40; + + PlaySoundObject(54, 1); + break; + + case 1: + if (npc->flag & 8) + { + npc->ani_no = 1; + npc->ani_wait = 0; + npc->act_no = 2; + npc->act_wait = 0; + } + + break; + + case 2: + npc->xm = 8 * npc->xm / 9; + + if (++npc->ani_wait > 3) + { + npc->ani_wait = 0; + ++npc->ani_no; + } + + if (npc->ani_no > 2) + npc->ani_no = 1; + + if (++npc->act_wait > 50) + npc->cond |= 8; + + 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]; +} + +//Mesa block +void ActNpc319(NPCHAR *npc) +{ + RECT rc[3]; + + rc[0] = {16, 0, 32, 16}; + rc[1] = {16, 0, 32, 16}; + rc[2] = {96, 80, 112, 96}; + + switch (npc->act_no) + { + case 0: + npc->y = npc->pNpc->y + 0x1400; + + if (npc->pNpc->direct == 0) + npc->x = npc->pNpc->x + 0xE00; + else + npc->x = npc->pNpc->x - 0xE00; + + if (npc->pNpc->code_char == 318) + { + SetDestroyNpChar(npc->x, npc->y, 0, 3); + npc->cond = 0; + return; + } + + if (npc->pNpc->ani_no != 2) + { + npc->act_no = 2; + npc->act_wait = 0; + npc->ym = -0x400; + npc->y = npc->pNpc->y - 0x800; + + if (npc->pNpc->direct == 0) + npc->xm = -0x400; + else + npc->xm = 0x400; + } + + break; + + case 2: + if (++npc->act_wait == 4) + npc->bits &= ~8; + + npc->ym += 0x2A; + if (npc->ym > 0x5FF) + npc->ym = 0x5FF; + + npc->x += npc->xm; + npc->y += npc->ym; + + if (npc->flag & 8) + { + PlaySoundObject(12, 1); + SetDestroyNpChar(npc->x, npc->y, 0, 3); + npc->cond = 0; + } + + break; + } + + if (++npc->ani_no > 2) + npc->ani_no = 0; + + npc->rect = rc[npc->ani_no]; +} diff --git a/src/NpcAct320.cpp b/src/NpcAct320.cpp index f293f87a..40c278e3 100644 --- a/src/NpcAct320.cpp +++ b/src/NpcAct320.cpp @@ -8,6 +8,423 @@ #include "Sound.h" #include "Back.h" #include "Triangle.h" +#include "Frame.h" +#include "Map.h" +#include "Caret.h" +#include "Bullet.h" +#include "KeyControl.h" + +//Curly (carried, shooting) +void ActNpc320(NPCHAR *npc) +{ + RECT rcLeft[3]; + RECT rcRight[3]; + + rcLeft[0] = {16, 96, 32, 112}; + rcLeft[1] = {48, 96, 64, 112}; + rcLeft[2] = {96, 96, 112, 112}; + + rcRight[0] = {16, 112, 32, 128}; + rcRight[1] = {48, 112, 64, 128}; + rcRight[2] = {96, 112, 112, 128}; + + if (npc->act_no == 0) + { + npc->act_no = 1; + npc->x = gMC.x; + npc->y = gMC.y; + SetNpChar(321, 0, 0, 0, 0, 0, npc, 0x100); + } + + if (gMC.flag & 8) + { + if (gMC.up) + { + npc->tgt_x = gMC.x; + npc->tgt_y = gMC.y - 0x1400; + npc->ani_no = 1; + } + else + { + npc->ani_no = 0; + + if (gMC.direct == 0) + { + npc->tgt_x = gMC.x + 0xE00; + npc->tgt_y = gMC.y - 0x600; + } + else + { + npc->tgt_x = gMC.x - 0xE00; + npc->tgt_y = gMC.y - 0x600; + } + } + } + else + { + if (gMC.up) + { + npc->tgt_x = gMC.x; + npc->tgt_y = gMC.y + 0x1000; + npc->ani_no = 2; + } + else if (gMC.down) + { + npc->tgt_x = gMC.x; + npc->tgt_y = gMC.y - 0x1000; + npc->ani_no = 1; + } + else + { + npc->ani_no = 0; + + if (gMC.direct == 0) + { + npc->tgt_x = gMC.x + 0xE00; + npc->tgt_y = gMC.y - 0x600; + } + else + { + npc->tgt_x = gMC.x - 0xE00; + npc->tgt_y = gMC.y - 0x600; + } + } + } + + npc->x += (npc->tgt_x - npc->x) / 2; + npc->y += (npc->tgt_y - npc->y) / 2; + + if (gMC.ani_no & 1) + npc->y -= 0x200; + + if (gMC.direct == 0) + npc->rect = rcRight[npc->ani_no]; + else + npc->rect = rcLeft[npc->ani_no]; +} + +//Curly's Nemesis +void ActNpc321(NPCHAR *npc) +{ + RECT rcLeft[3]; + RECT rcRight[3]; + + rcLeft[0] = {136, 152, 152, 168}; + rcLeft[1] = {152, 152, 168, 168}; + rcLeft[2] = {168, 152, 184, 168}; + + rcRight[0] = {136, 168, 152, 184}; + rcRight[1] = {152, 168, 168, 184}; + rcRight[2] = {168, 168, 184, 184}; + + char direct; + + if (npc->pNpc) + { + switch (npc->pNpc->ani_no) + { + case 0: + if (gMC.direct == 0) + { + npc->x = npc->pNpc->x + 0x1000; + direct = 2; + } + else + { + npc->x = npc->pNpc->x - 0x1000; + direct = 0; + } + + npc->y = npc->pNpc->y; + break; + + case 1: + npc->x = npc->pNpc->x; + direct = 1; + npc->y = npc->pNpc->y - 0x1400; + break; + + case 2: + npc->x = npc->pNpc->x; + direct = 3; + npc->y = npc->pNpc->y + 0x1400; + break; + } + + npc->ani_no = npc->pNpc->ani_no; + + if (g_GameFlags & 2 && CountBulletNum(43) < 2 && gKeyTrg & gKeyShot) + { + SetBullet(43, npc->pNpc->x, npc->pNpc->y, direct); + SetCaret(npc->pNpc->x, npc->pNpc->y, 3, 0); + PlaySoundObject(117, 1); + } + + if (gMC.direct == 0) + npc->rect = rcRight[npc->ani_no]; + else + npc->rect = rcLeft[npc->ani_no]; + } +} + +//Deleet +void ActNpc322(NPCHAR *npc) +{ + RECT rc[3]; + + rc[0] = {272, 216, 296, 240}; + rc[1] = {296, 216, 320, 240}; + rc[2] = {160, 216, 184, 240}; + + if (npc->act_no < 2 && npc->life <= 968) + { + npc->act_no = 2; + npc->act_wait = 0; + npc->bits &= ~0x20; + npc->bits |= 4; + PlaySoundObject(22, 1); + } + + switch (npc->act_no) + { + case 0: + npc->act_no = 1; + + if (npc->direct == 0) + npc->y += 0x1000; + else + npc->x += 0x1000; + // Fallthrough + case 1: + if (npc->shock) + ++npc->count1; + else + npc->count1 = 0; + + npc->rect = rc[npc->count1 / 2 & 1]; + break; + + case 2: + npc->ani_no = 2; + + switch (npc->act_wait) + { + case 0: + SetNpChar(207, npc->x + 0x800, npc->y, 0, 0, 0, 0, 0x180); + break; + case 50: + SetNpChar(207, npc->x + 0x800, npc->y, 0, 0, 1, 0, 0x180); + break; + case 100: + SetNpChar(207, npc->x + 0x800, npc->y, 0, 0, 2, 0, 0x180); + break; + case 150: + SetNpChar(207, npc->x + 0x800, npc->y, 0, 0, 3, 0, 0x180); + break; + case 200: + SetNpChar(207, npc->x + 0x800, npc->y, 0, 0, 4, 0, 0x180); + break; + case 250: + npc->hit.back = 0x6000; + npc->hit.front = 0x6000; + npc->hit.top = 0x6000; + npc->hit.bottom = 0x6000; + npc->damage = 12; + PlaySoundObject(26, 1); + SetDestroyNpChar(npc->x, npc->y, 0x6000, 40); + SetQuake(10); + + if (npc->direct == 0) + { + DeleteMapParts(npc->x / 0x2000, (npc->y - 0x1000) / 0x2000); + DeleteMapParts(npc->x / 0x2000, (npc->y + 0x1000) / 0x2000); + } + else + { + DeleteMapParts((npc->x - 0x1000) / 0x2000, npc->y / 0x2000); + DeleteMapParts((npc->x + 0x1000) / 0x2000, npc->y / 0x2000); + } + + npc->cond |= 8; + break; + } + + ++npc->act_wait; + npc->rect = rc[2]; + break; + } +} + +//Bute (spinning) +void ActNpc323(NPCHAR *npc) +{ + RECT rc[4]; + + rc[0] = {216, 32, 232, 56}; + rc[1] = {232, 32, 248, 56}; + rc[2] = {216, 56, 232, 80}; + rc[3] = {232, 56, 248, 80}; + + if (++npc->ani_wait > 3) + { + npc->ani_wait = 0; + + if (++npc->ani_no > 3) + npc->ani_no = 0; + } + + switch (npc->act_no) + { + case 0: + npc->act_no = 1; + + switch (npc->direct) + { + case 0: + npc->xm = -0x600; + break; + case 2: + npc->xm = 0x600; + break; + case 1: + npc->ym = -0x600; + break; + case 3: + npc->ym = 0x600; + break; + } + // Fallthrough + case 1: + if (++npc->act_wait == 16) + npc->bits &= ~8; + + npc->x += npc->xm; + npc->y += npc->ym; + + if (npc->flag & 0xFF) + npc->act_no = 10; + + if (npc->act_wait > 20) + { + switch (npc->direct) + { + case 0: + if (npc->x <= gMC.x + 0x4000) + npc->act_no = 10; + break; + case 2: + if (npc->x >= gMC.x - 0x4000) + npc->act_no = 10; + break; + case 1: + if (npc->y <= gMC.y + 0x4000) + npc->act_no = 10; + break; + case 3: + if (npc->y >= gMC.y - 0x4000) + npc->act_no = 10; + break; + } + } + + break; + } + + if (npc->act_no == 10) + { + npc->code_char = 309; + npc->ani_no = 0; + npc->act_no = 11; + npc->bits |= 0x20; + npc->bits &= ~8; + npc->damage = 5; + npc->view.top = 0x1000; + } + + npc->rect = rc[npc->ani_no]; +} + +//Bute generator +void ActNpc324(NPCHAR *npc) +{ + switch (npc->act_no) + { + case 10: + npc->act_no = 11; + npc->act_wait = 0; + // Fallthrough + case 11: + if (++npc->act_wait % 50 == 1) + SetNpChar(323, npc->x, npc->y, 0, 0, npc->direct, 0, 0x100); + + if (npc->act_wait > 351) + npc->act_no = 0; + + break; + } +} + +//Heavy Press lightning +void ActNpc325(NPCHAR *npc) +{ + RECT rc[7]; + + rc[0] = {240, 96, 272, 128}; + rc[1] = {272, 96, 304, 128}; + rc[2] = {240, 128, 272, 160}; + rc[3] = {240, 0, 256, 96}; + rc[4] = {256, 0, 272, 96}; + rc[5] = {272, 0, 288, 96}; + rc[6] = {288, 0, 304, 96}; + + switch (npc->act_no) + { + case 0: + npc->act_no = 1; + PlaySoundObject(29, 1); + // Fallthrough + case 1: + if (++npc->ani_wait > 0) + { + npc->ani_wait = 0; + ++npc->ani_no; + } + + if (npc->ani_no > 2) + npc->ani_no = 0; + + if (++npc->act_wait > 50) + { + npc->act_no = 10; + npc->ani_wait = 0; + npc->ani_no = 3; + npc->damage = 10; + npc->view.front = 0x1000; + npc->view.top = 0x1800; + PlaySoundObject(101, 1); + SetDestroyNpChar(npc->x, npc->y + 0xA800, 0, 3); + } + + break; + + case 10: + if (++npc->ani_wait > 2) + { + npc->ani_wait = 0; + ++npc->ani_no; + } + + if (npc->ani_no > 6) + { + npc->cond = 0; + return; + } + + break; + } + + npc->rect = rc[npc->ani_no]; +} //Sweat void ActNpc334(NPCHAR *npc) diff --git a/src/NpcTbl.cpp b/src/NpcTbl.cpp index 11e1e7dd..84977ba4 100644 --- a/src/NpcTbl.cpp +++ b/src/NpcTbl.cpp @@ -365,23 +365,23 @@ NPCFUNCTION gpNpcFuncTbl[361] = ActNpc306, ActNpc307, ActNpc308, - nullptr, - nullptr, - nullptr, - nullptr, + ActNpc309, + ActNpc310, + ActNpc311, + ActNpc312, ActNpc313, ActNpc314, ActNpc315, - nullptr, - nullptr, - nullptr, - nullptr, - nullptr, - nullptr, - nullptr, - nullptr, - nullptr, - nullptr, + ActNpc316, + ActNpc317, + ActNpc318, + ActNpc319, + ActNpc320, + ActNpc321, + ActNpc322, + ActNpc323, + ActNpc324, + ActNpc325, nullptr, nullptr, nullptr,