From 517d39533ae576e3f8a167ef7d08c9df27ac33a7 Mon Sep 17 00:00:00 2001 From: Clownacy Date: Wed, 6 Feb 2019 21:23:16 +0000 Subject: [PATCH 1/3] More NPCs --- src/NpcAct.h | 4 +- src/NpcAct160.cpp | 174 ++++++++++++++++++++++++++++++++++++++++++++++ src/NpcHit.h | 1 + src/NpcTbl.cpp | 6 +- 4 files changed, 181 insertions(+), 4 deletions(-) diff --git a/src/NpcAct.h b/src/NpcAct.h index b32e8cc8..e731624c 100644 --- a/src/NpcAct.h +++ b/src/NpcAct.h @@ -173,9 +173,11 @@ void ActNpc167(NPCHAR *npc); void ActNpc168(NPCHAR *npc); void ActNpc169(NPCHAR *npc); void ActNpc170(NPCHAR *npc); - +void ActNpc171(NPCHAR *npc); +void ActNpc172(NPCHAR *npc); void ActNpc173(NPCHAR *npc); void ActNpc174(NPCHAR *npc); +void ActNpc175(NPCHAR *npc); void ActNpc192(NPCHAR *npc); void ActNpc193(NPCHAR *npc); diff --git a/src/NpcAct160.cpp b/src/NpcAct160.cpp index 19912819..a5fc8995 100644 --- a/src/NpcAct160.cpp +++ b/src/NpcAct160.cpp @@ -12,6 +12,7 @@ #include "Caret.h" #include "MycParam.h" #include "CommonDefines.h" +#include "NpcHit.h" //Puu Black void ActNpc160(NPCHAR *npc) @@ -908,6 +909,134 @@ void ActNpc170(NPCHAR *npc) npc->rect = rcRight[npc->ani_no]; } +//Fire Whirrr +void ActNpc171(NPCHAR *npc) +{ + RECT rcLeft[2]; + RECT rcRight[2]; + + rcLeft[0] = {120, 48, 152, 80}; + rcLeft[1] = {152, 48, 184, 80}; + + rcRight[0] = {184, 48, 216, 80}; + rcRight[1] = {216, 48, 248, 80}; + + if (gMC.x < npc->x) + npc->direct = 0; + else + npc->direct = 2; + + switch (npc->act_no) + { + case 0: + npc->act_no = 1; + npc->act_wait = Random(0, 50); + npc->tgt_y = npc->y; + // Fallthrough + case 1: + if (npc->act_wait) + { + --npc->act_wait; + } + else + { + npc->act_no = 10; + npc->ym = 0x200; + } + // Fallthrough + case 10: + if (++npc->ani_wait > 0) + { + npc->ani_wait = 0; + ++npc->ani_no; + } + + if (npc->ani_no > 1) + npc->ani_no = 0; + + if (npc->tgt_y > npc->y) + npc->ym += 0x10; + else + npc->ym -= 0x10; + + if (npc->ym > 0x200) + npc->ym = 0x200; + if (npc->ym < -0x200) + npc->ym = -0x200; + + npc->y += npc->ym; + + if (npc->direct == 0) + { + if (gMC.y < npc->y + 0xA000 && gMC.y > npc->y - 0xA000 && gMC.x < npc->x && gMC.x > npc->x - 0x14000) + ++npc->count1; + } + else + { + if (gMC.y < npc->y + 0xA000 && gMC.y > npc->y - 0xA000 && gMC.x < npc->x + 0x14000 && gMC.x > npc->x) + ++npc->count1; + } + + if (npc->count1 > 20) + { + SetNpChar(172, npc->x, npc->y, 0, 0, npc->direct, 0, 0x100); + npc->count1 = -100; + gCurlyShoot_wait = Random(80, 100); + gCurlyShoot_x = npc->x; + gCurlyShoot_y = npc->y; + } + + break; + } + + if (npc->direct == 0) + npc->rect = rcLeft[npc->ani_no]; + else + npc->rect = rcRight[npc->ani_no]; +} + +//Fire Whirr projectile +void ActNpc172(NPCHAR *npc) +{ + RECT rect[3]; + + rect[0] = {248, 48, 264, 80}; + rect[1] = {264, 48, 280, 80}; + rect[2] = {280, 48, 296, 80}; + + switch (npc->act_no) + { + case 0: + npc->act_no = 1; + // Fallthrough + case 1: + 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->x -= 0x200; + else + npc->x += 0x200; + + if (npc->flag & 1 || npc->flag & 4) + { + SetCaret(npc->x, npc->y, 2, 0); + VanishNpChar(npc); + return; + } + + break; + } + + npc->rect = rect[npc->ani_no]; +} + //Gaudi (armoured) void ActNpc173(NPCHAR *npc) { @@ -1152,3 +1281,48 @@ void ActNpc174(NPCHAR *npc) npc->rect = rect_left[npc->ani_no]; } + +//Gaudi egg +void ActNpc175(NPCHAR *npc) +{ + RECT rcLeft[2]; + RECT rcRight[2]; + + rcLeft[0] = {168, 80, 192, 104}; + rcLeft[1] = {192, 80, 216, 104}; + + rcRight[0] = {216, 80, 240, 104}; + rcRight[1] = {240, 80, 264, 104}; + + if (npc->act_no < 3 && npc->life < 90) + { + LoseNpChar(npc, 0); + npc->act_no = 10; + npc->ani_no = 1; + npc->bits &= ~0x20; + npc->damage = 0; + } + + if (npc->act_no == 0) + { + npc->ani_no = 0; + npc->act_no = 1; + } + + if (npc->direct == 0) + npc->ym += 0x20; + else + npc->ym -= 0x20; + + if (npc->ym < -0x5FF) + npc->ym = -0x5FF; + if (npc->ym > 0x5FF) + npc->ym = 0x5FF; + + npc->y += npc->ym; + + if (npc->direct == 0) + npc->rect = rcLeft[npc->ani_no]; + else + npc->rect = rcRight[npc->ani_no]; +} diff --git a/src/NpcHit.h b/src/NpcHit.h index 2ddf26fe..2a36f40a 100644 --- a/src/NpcHit.h +++ b/src/NpcHit.h @@ -12,4 +12,5 @@ void JudgeHitNpCharTriangleG(NPCHAR *npc, int x, int y); void JudgeHitNpCharTriangleH(NPCHAR *npc, int x, int y); void JudgeHitNpCharWater(NPCHAR *npc, int x, int y); void HitNpCharMap(); +void LoseNpChar(NPCHAR *npc, bool bVanish); void HitNpCharBullet(); diff --git a/src/NpcTbl.cpp b/src/NpcTbl.cpp index db21d811..2d458b52 100644 --- a/src/NpcTbl.cpp +++ b/src/NpcTbl.cpp @@ -227,11 +227,11 @@ NPCFUNCTION gpNpcFuncTbl[361] = ActNpc168, ActNpc169, ActNpc170, - nullptr, - nullptr, + ActNpc171, + ActNpc172, ActNpc173, ActNpc174, - nullptr, + ActNpc175, nullptr, nullptr, nullptr, From 613d2262b4298b3e6af6d6d40f210db8df6f8239 Mon Sep 17 00:00:00 2001 From: Clownacy Date: Wed, 6 Feb 2019 22:26:14 +0000 Subject: [PATCH 2/3] More NPCs --- src/NpcAct.h | 7 + src/NpcAct160.cpp | 191 +++++++++++++++++ src/NpcAct180.cpp | 531 ++++++++++++++++++++++++++++++++++++++++++++++ src/NpcTbl.cpp | 12 +- 4 files changed, 735 insertions(+), 6 deletions(-) diff --git a/src/NpcAct.h b/src/NpcAct.h index e731624c..6b498942 100644 --- a/src/NpcAct.h +++ b/src/NpcAct.h @@ -178,6 +178,13 @@ void ActNpc172(NPCHAR *npc); void ActNpc173(NPCHAR *npc); void ActNpc174(NPCHAR *npc); void ActNpc175(NPCHAR *npc); +void ActNpc176(NPCHAR *npc); +void ActNpc177(NPCHAR *npc); + +void ActNpc180(NPCHAR *npc); +void ActNpc181(NPCHAR *npc); +void ActNpc182(NPCHAR *npc); +void ActNpc183(NPCHAR *npc); void ActNpc192(NPCHAR *npc); void ActNpc193(NPCHAR *npc); diff --git a/src/NpcAct160.cpp b/src/NpcAct160.cpp index a5fc8995..77d14cde 100644 --- a/src/NpcAct160.cpp +++ b/src/NpcAct160.cpp @@ -1326,3 +1326,194 @@ void ActNpc175(NPCHAR *npc) else npc->rect = rcRight[npc->ani_no]; } + +//BuyoBuyo Base +void ActNpc176(NPCHAR *npc) +{ + RECT rcLeft[3]; + RECT rcRight[3]; + + rcLeft[0] = {96, 128, 128, 144}; + rcLeft[1] = {128, 128, 160, 144}; + rcLeft[2] = {160, 128, 192, 144}; + + rcRight[0] = {96, 144, 128, 160}; + rcRight[1] = {128, 144, 160, 160}; + rcRight[2] = {160, 144, 192, 160}; + + if (npc->act_no < 3 && npc->life < 940) + { + LoseNpChar(npc, 0); + npc->act_no = 10; + npc->ani_no = 2; + npc->bits &= ~0x20; + npc->damage = 0; + } + + switch (npc->act_no) + { + case 0: + npc->act_no = 1; + npc->ani_no = 0; + npc->ani_wait = 0; + // Fallthrough + case 1: + if (npc->direct == 0) + { + if (npc->x < gMC.x + 0x14000 && npc->x > gMC.x - 0x14000 && npc->y < gMC.y + 0x14000 && npc->y > gMC.y - 0x2000) + ++npc->count1; + } + else + { + if (npc->x < gMC.x + 0x14000 && npc->x > gMC.x - 0x14000 && npc->y < gMC.y + 0x2000 && npc->y > gMC.y - 0x14000) + ++npc->count1; + } + + if (npc->count1 > 10) + { + npc->act_no = 2; + npc->act_wait = 0; + } + + break; + + case 2: + 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 > 10) + { + if (++npc->count2 > 2) + { + npc->count2 = 0; + npc->count1 = -90; + } + else + { + npc->count1 = -10; + } + + if (npc->direct == 0) + SetNpChar(177, npc->x, npc->y - 0x1000, 0, 0, 0, 0, 0x100); + else + SetNpChar(177, npc->x, npc->y + 0x1000, 0, 0, 2, 0, 0x100); + + PlaySoundObject(39, 1); + + npc->act_no = 0; + npc->ani_no = 0; + + gCurlyShoot_wait = Random(80, 100); + gCurlyShoot_x = npc->x; + gCurlyShoot_y = npc->y; + } + + break; + } + + if (npc->direct == 0) + npc->rect = rcLeft[npc->ani_no]; + else + npc->rect = rcRight[npc->ani_no]; +} + +//BuyoBuyo +void ActNpc177(NPCHAR *npc) +{ + RECT rc[2]; + + rc[0] = {192, 128, 208, 144}; + rc[1] = {208, 128, 224, 144}; + + if (npc->flag & 0xFF) + { + SetCaret(npc->x, npc->y, 3, 0); + npc->cond = 0; + return; + } + + switch (npc->act_no) + { + case 0: + npc->act_no = 1; + + if (npc->direct == 0) + npc->ym = -0x600; + else + npc->ym = 0x600; + // Fallthrough + case 1: + if (npc->y < gMC.y + 0x2000 && npc->y > gMC.y - 0x2000) + { + npc->act_no = 10; + + npc->tgt_x = npc->x; + npc->tgt_y = npc->y; + + if (gMC.x < npc->x) + npc->direct = 0; + else + npc->direct = 2; + + npc->xm = (Random(0, 1) * 0x400) - 0x200; + npc->ym = (Random(0, 1) * 0x400) - 0x200; + } + + break; + + case 10: + if (npc->tgt_x > npc->x) + npc->xm += 0x20; + else + npc->xm -= 0x20; + + if (npc->tgt_y > npc->y) + npc->ym += 0x20; + else + npc->ym -= 0x20; + + if (++npc->act_wait > 300) + { + SetCaret(npc->x, npc->y, 3, 0); + npc->cond = 0; + return; + } + + if (npc->direct == 0) + npc->tgt_x -= 0x200; + else + npc->tgt_x += 0x200; + + break; + } + + 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; + + npc->x += npc->xm; + npc->y += npc->ym; + + if (++npc->ani_wait > 6) + { + npc->ani_wait = 0; + ++npc->ani_no; + } + + if (npc->ani_no > 1) + npc->ani_no = 0; + + npc->rect = rc[npc->ani_no]; +} diff --git a/src/NpcAct180.cpp b/src/NpcAct180.cpp index bbf25573..b6484ff5 100644 --- a/src/NpcAct180.cpp +++ b/src/NpcAct180.cpp @@ -9,6 +9,537 @@ #include "Back.h" #include "Triangle.h" #include "Caret.h" +#include "Bullet.h" +#include "Flags.h" + +//Curly AI +void ActNpc180(NPCHAR *npc) +{ + RECT rcLeft[11]; + RECT rcRight[11]; + + 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] = {48, 96, 64, 112}; + rcLeft[6] = {64, 96, 80, 112}; + rcLeft[7] = {48, 96, 64, 112}; + rcLeft[8] = {80, 96, 96, 112}; + rcLeft[9] = {48, 96, 64, 112}; + rcLeft[10] = {144, 96, 160, 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] = {48, 112, 64, 128}; + rcRight[6] = {64, 112, 80, 128}; + rcRight[7] = {48, 112, 64, 128}; + rcRight[8] = {80, 112, 96, 128}; + rcRight[9] = {48, 112, 64, 128}; + rcRight[10] = {144, 112, 160, 128}; + + if (npc->y < gMC.y - 0x14000) + { + if ( npc->y >= 0x20000 ) + { + npc->tgt_x = 0; + npc->tgt_y = npc->y; + } + else + { + npc->tgt_x = 0x280000; + npc->tgt_y = npc->y; + } + } + else + { + if (gCurlyShoot_wait) + { + npc->tgt_x = gCurlyShoot_x; + npc->tgt_y = gCurlyShoot_y; + } + else + { + npc->tgt_x = gMC.x; + npc->tgt_y = gMC.y; + } + } + + if (npc->xm < 0 && npc->flag & 1) + npc->xm = 0; + if (npc->xm > 0 && npc->flag & 4) + npc->xm = 0; + + switch (npc->act_no) + { + case 20: + npc->x = gMC.x; + npc->y = gMC.y; + npc->act_no = 100; + npc->ani_no = 0; + SetNpChar(183, 0, 0, 0, 0, 0, npc, 0x100); + + if (GetNPCFlag(563)) + SetNpChar(182, 0, 0, 0, 0, 0, npc, 0x100); + else + SetNpChar(181, 0, 0, 0, 0, 0, npc, 0x100); + + break; + + case 40: + npc->act_no = 41; + npc->act_wait = 0; + npc->ani_no = 10; + // Fallthrough + case 41: + if (++npc->act_wait == 750) + { + npc->bits &= ~0x2000; + npc->ani_no = 0; + } + + if (npc->act_wait > 1000) + { + npc->act_no = 100; + npc->ani_no = 0; + SetNpChar(183, 0, 0, 0, 0, 0, npc, 0x100); + + if (GetNPCFlag(563)) + SetNpChar(182, 0, 0, 0, 0, 0, npc, 0x100); + else + SetNpChar(181, 0, 0, 0, 0, 0, npc, 0x100); + } + + break; + + case 100: + npc->ani_no = 0; + npc->xm = 7 * npc->xm / 8; + npc->count1 = 0; + + if (npc->x > npc->tgt_x + 0x2000) + { + npc->act_no = 200; + npc->ani_no = 1; + npc->direct = 0; + npc->act_wait = Random(20, 60); + } + else if (npc->x < npc->tgt_x - 0x2000) + { + npc->act_no = 300; + npc->ani_no = 1; + npc->direct = 2; + npc->act_wait = Random(20, 60); + } + + break; + + case 200: + npc->xm -= 0x20; + npc->direct = 0; + + if (npc->flag & 1) + ++npc->count1; + else + npc->count1 = 0; + + break; + + case 210: + npc->xm -= 0x20; + npc->direct = 0; + + if (npc->flag & 8) + npc->act_no = 100; + + break; + + case 300: + npc->xm += 0x20; + npc->direct = 2; + + if (npc->flag & 4) + ++npc->count1; + else + npc->count1 = 0; + + break; + + case 310: + npc->xm += 0x20; + npc->direct = 2; + + if (npc->flag & 8) + npc->act_no = 100; + + break; + } + + if (gCurlyShoot_wait) + --gCurlyShoot_wait; + + if (gCurlyShoot_wait == 70) + npc->count2 = 10; + + if (gCurlyShoot_wait == 60 && npc->flag & 8 && Random(0, 2)) + { + npc->count1 = 0; + npc->ym = -0x600; + npc->ani_no = 1; + PlaySoundObject(15, 1); + + if (npc->tgt_x < npc->x) + npc->act_no = 210; + else + npc->act_no = 310; + } + + int xx = npc->x - npc->tgt_x; + int yy = npc->y - npc->tgt_y; + + if ( xx < 0 ) + xx = -xx; + + if (npc->act_no == 100) + { + if (xx + 0x400 < yy) + npc->ani_no = 5; + else + npc->ani_no = 0; + } + + if (npc->act_no == 210 || npc->act_no == 310) + { + if ( xx + 0x400 < yy ) + npc->ani_no = 6; + else + npc->ani_no = 1; + } + + if (npc->act_no == 200 || npc->act_no == 300) + { + ++npc->ani_wait; + + if (xx + 0x400 < yy) + npc->ani_no = 6 + (npc->ani_wait / 4 % 4); + else + npc->ani_no = 1 + (npc->ani_wait / 4 % 4); + + if (npc->act_wait) + { + --npc->act_wait; + + if (npc->flag && npc->count1 > 10) + { + npc->count1 = 0; + npc->ym = -0x600; + npc->act_no += 10; + npc->ani_no = 1; + PlaySoundObject(15, 1); + } + } + else + { + npc->act_no = 100; + npc->ani_no = 0; + } + } + + if (npc->act_no >= 100 && npc->act_no < 500) + { + if (npc->x >= gMC.x - 0xA000 && npc->x <= gMC.x + 0xA000) + { + npc->ym += 0x33; + } + else + { + if (npc->flag) + npc->ym += 0x10; + else + npc->ym += 0x33; + } + } + + if (npc->xm > 0x300) + npc->xm = 0x300; + if (npc->xm < -0x300) + npc->xm = -0x300u; + + if (npc->ym > 0x5FF) + npc->ym = 0x5FF; + + npc->x += npc->xm; + npc->y += npc->ym; + + if (npc->act_no >= 100 && (npc->flag & 8) == 0 && npc->ani_no != 1000) + { + if (xx + 0x400 < yy) + npc->ani_no = 6; + else + npc->ani_no = 1; + } + + if (npc->direct == 0) + npc->rect = rcLeft[npc->ani_no]; + else + npc->rect = rcRight[npc->ani_no]; +} + +//Curly AI Machine Gun +void ActNpc181(NPCHAR *npc) +{ + RECT rcLeft[2]; + RECT rcRight[2]; + + rcLeft[0] = {216, 152, 232, 168}; + rcLeft[1] = {232, 152, 248, 168}; + + rcRight[0] = {216, 168, 232, 184}; + rcRight[1] = {232, 168, 248, 184}; + + if (npc->pNpc) + { + if (npc->pNpc->ani_no < 5) + { + if (npc->pNpc->direct == 0) + { + npc->direct = 0; + npc->x = npc->pNpc->x - 0x1000; + } + else + { + npc->direct = 2; + npc->x = npc->pNpc->x + 0x1000; + } + + npc->y = npc->pNpc->y; + npc->ani_no = 0; + } + else + { + if (npc->pNpc->direct == 0) + { + npc->direct = 0; + npc->x = npc->pNpc->x; + } + else + { + npc->direct = 2; + npc->x = npc->pNpc->x; + } + + npc->y = npc->pNpc->y - 0x1400; + npc->ani_no = 1; + } + + if (npc->pNpc->ani_no == 1 || npc->pNpc->ani_no == 3 || npc->pNpc->ani_no == 6 || npc->pNpc->ani_no == 8) + npc->y -= 0x200; + + switch (npc->act_no) + { + case 0: + if (npc->pNpc->count2 == 10) + { + npc->pNpc->count2 = 0; + npc->act_no = 10; + npc->act_wait = 0; + } + + break; + + case 10: + if (++npc->act_wait % 6 == 1) + { + if (npc->ani_no) + { + if (npc->direct == 0) + { + SetBullet(12, npc->x - 0x400, npc->y - 0x800, 1); + SetCaret(npc->x - 0x400, npc->y - 0x800, 3, 0); + } + else + { + SetBullet(12, npc->x + 0x400, npc->y - 0x800, 1); + SetCaret(npc->x + 0x400, npc->y - 0x800, 3, 0); + } + } + else + { + if (npc->direct == 0) + { + SetBullet(12, npc->x - 0x800, npc->y + 0x600, 0); + SetCaret(npc->x - 0x800, npc->y + 0x600, 3, 0); + } + else + { + SetBullet(12, npc->x + 0x800, npc->y + 0x600, 2); + SetCaret(npc->x + 0x800, npc->y + 0x600, 3, 0); + } + } + } + + if (npc->act_wait == 60) + npc->act_no = 0; + + break; + } + + if (npc->direct == 0) + npc->rect = rcLeft[npc->ani_no]; + else + npc->rect = rcRight[npc->ani_no]; + } +} + +//Curly AI Polar Star +void ActNpc182(NPCHAR *npc) +{ + RECT rcLeft[2]; + RECT rcRight[2]; + + rcLeft[0] = {184, 152, 200, 168}; + rcLeft[1] = {200, 152, 216, 168}; + + rcRight[0] = {184, 168, 200, 184}; + rcRight[1] = {200, 168, 216, 184}; + + if (npc->pNpc) + { + if (npc->pNpc->ani_no < 5) + { + if (npc->pNpc->direct == 0) + { + npc->direct = 0; + npc->x = npc->pNpc->x - 0x1000; + } + else + { + npc->direct = 2; + npc->x = npc->pNpc->x + 0x1000; + } + + npc->y = npc->pNpc->y; + npc->ani_no = 0; + } + else + { + if (npc->pNpc->direct == 0) + { + npc->direct = 0; + npc->x = npc->pNpc->x; + } + else + { + npc->direct = 2; + npc->x = npc->pNpc->x; + } + + npc->y = npc->pNpc->y - 0x1400; + npc->ani_no = 1; + } + + if (npc->pNpc->ani_no == 1 || npc->pNpc->ani_no == 3 || npc->pNpc->ani_no == 6 || npc->pNpc->ani_no == 8) + npc->y -= 0x200; + + switch (npc->act_no) + { + case 0: + if (npc->pNpc->count2 == 10) + { + npc->pNpc->count2 = 0; + npc->act_no = 10; + npc->act_wait = 0; + } + + break; + + case 10: + if (++npc->act_wait % 12 == 1) + { + if (npc->ani_no) + { + if (npc->direct == 0) + { + SetBullet(6, npc->x - 0x400, npc->y - 0x800, 1); + SetCaret(npc->x - 0x400, npc->y - 0x800, 3, 0); + } + else + { + SetBullet(6, npc->x + 0x400, npc->y - 0x800, 1); + SetCaret(npc->x + 0x400, npc->y - 0x800, 3, 0); + } + } + else + { + if (npc->direct == 0) + { + SetBullet(6, npc->x - 0x800, npc->y + 0x600, 0); + SetCaret(npc->x - 0x800, npc->y + 0x600, 3, 0); + } + else + { + SetBullet(6, npc->x + 0x800, npc->y + 0x600, 2); + SetCaret(npc->x + 0x800, npc->y + 0x600, 3, 0); + } + } + } + + if (npc->act_wait == 60) + npc->act_no = 0; + + break; + } + + if (npc->direct == 0) + npc->rect = rcLeft[npc->ani_no]; + else + npc->rect = rcRight[npc->ani_no]; + } +} + +//Curly Air Tank Bubble +void ActNpc183(NPCHAR *npc) +{ + RECT rect[2]; + + rect[0] = {56, 96, 80, 120}; + rect[1] = {80, 96, 104, 120}; + + if (npc->pNpc) + { + if (npc->act_no == 0) + { + npc->x = npc->pNpc->x; + npc->y = npc->pNpc->y; + npc->act_no = 1; + } + + npc->x += (npc->pNpc->x - npc->x) / 2; + npc->y += (npc->pNpc->y - npc->y) / 2; + + if (++npc->ani_wait > 1) + { + npc->ani_wait = 0; + ++npc->ani_no; + } + + if (npc->ani_no > 1) + npc->ani_no = 0; + + if (npc->pNpc->flag & 0x100) + { + npc->rect = rect[npc->ani_no]; + } + else + { + npc->rect.right = 0; + } + } +} //Scooter void ActNpc192(NPCHAR *npc) diff --git a/src/NpcTbl.cpp b/src/NpcTbl.cpp index 2d458b52..700f95ff 100644 --- a/src/NpcTbl.cpp +++ b/src/NpcTbl.cpp @@ -232,14 +232,14 @@ NPCFUNCTION gpNpcFuncTbl[361] = ActNpc173, ActNpc174, ActNpc175, + ActNpc176, + ActNpc177, nullptr, nullptr, - nullptr, - nullptr, - nullptr, - nullptr, - nullptr, - nullptr, + ActNpc180, + ActNpc181, + ActNpc182, + ActNpc183, nullptr, nullptr, nullptr, From 66d9de157240e2fcf6b3b1403ce1db9acb277532 Mon Sep 17 00:00:00 2001 From: Clownacy Date: Wed, 6 Feb 2019 22:46:28 +0000 Subject: [PATCH 3/3] 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,