From f47f036e3661b3224ee8f3c7147facc0a6e958c1 Mon Sep 17 00:00:00 2001 From: Clownacy Date: Thu, 7 Feb 2019 14:08:53 +0000 Subject: [PATCH] Added Core and more NPCs --- Makefile | 2 + src/Boss.cpp | 3 +- src/BossAlmo1.cpp | 596 ++++++++++++++++++++++++++++++++++++++++++++++ src/BossAlmo1.h | 3 + src/MyChar.cpp | 127 +++++++++- src/NpcAct.h | 8 +- src/NpcAct160.cpp | 86 +++++++ src/NpcAct180.cpp | 66 +++++ src/NpcAct200.cpp | 26 ++ src/NpcAct240.cpp | 69 ++++++ src/NpcTbl.cpp | 10 +- 11 files changed, 987 insertions(+), 9 deletions(-) create mode 100644 src/BossAlmo1.cpp create mode 100644 src/BossAlmo1.h create mode 100644 src/NpcAct240.cpp diff --git a/Makefile b/Makefile index 65cbfbfd..47e955eb 100644 --- a/Makefile +++ b/Makefile @@ -41,6 +41,7 @@ SOURCES = \ ArmsItem \ Back \ Boss \ + BossAlmo1 \ BossFrog \ BossLife \ BossOhm \ @@ -80,6 +81,7 @@ SOURCES = \ NpcAct160 \ NpcAct180 \ NpcAct200 \ + NpcAct240 \ NpcAct260 \ NpcAct280 \ NpcAct300 \ diff --git a/src/Boss.cpp b/src/Boss.cpp index 16cc4a95..3388b08b 100644 --- a/src/Boss.cpp +++ b/src/Boss.cpp @@ -4,6 +4,7 @@ #include "WindowsWrapper.h" #include "Boss.h" +#include "BossAlmo1.h" #include "BossFrog.h" #include "BossOhm.h" #include "BossX.h" @@ -190,7 +191,7 @@ BOSSFUNCTION gpBossFuncTbl[10] = ActBossChar_Omega, ActBossChar_Frog, ActBossChar_MonstX, - nullptr, //ActBossChar_Core, + ActBossChar_Core, nullptr, //ActBossChar_Ironhead, nullptr, //ActBossChar_Twin, nullptr, //ActBossChar_Undead, diff --git a/src/BossAlmo1.cpp b/src/BossAlmo1.cpp new file mode 100644 index 00000000..cb9e1914 --- /dev/null +++ b/src/BossAlmo1.cpp @@ -0,0 +1,596 @@ +#include "BossAlmo1.h" + +#include "Boss.h" +#include "Frame.h" +#include "Game.h" +#include "Map.h" +#include "MyChar.h" +#include "NpChar.h" +#include "Sound.h" +#include "Triangle.h" + +static void ActBossChar_Core_Face(NPCHAR *npc) +{ + RECT rect[4]; + + rect[0] = {0, 0, 72, 112}; + rect[1] = {0, 112, 72, 224}; + rect[2] = {160, 0, 232, 112}; + rect[3] = {0, 0, 0, 0}; + + switch (npc->act_no) + { + case 10: + npc->act_no = 11; + npc->ani_no = 2; + npc->bits = 8; + npc->view.front = 0x4800; + npc->view.top = 0x7000; + // Fallthrough + case 11: + npc->x = gBoss[0].x - 0x4800; + npc->y = gBoss[0].y; + break; + + case 50: + npc->act_no = 51; + npc->act_wait = 112; + // Fallthrough + case 51: + if (--npc->act_wait == 0) + { + npc->act_no = 100; + npc->ani_no = 3; + } + + npc->x = gBoss[0].x - 0x4800; + npc->y = gBoss[0].y; + break; + + case 100: + npc->ani_no = 3; + break; + } + + npc->rect = rect[npc->ani_no]; + + if (npc->act_no == 51) + npc->rect.bottom = npc->act_wait + npc->rect.top; +} + +static void ActBossChar_Core_Tail(NPCHAR *npc) +{ + RECT rect[3]; + + rect[0] = {72, 0, 160, 112}; + rect[1] = {72, 112, 160, 224}; + rect[2] = {0, 0, 0, 0}; + + switch (npc->act_no) + { + case 10: + npc->act_no = 11; + npc->ani_no = 0; + npc->bits = 8; + npc->view.front = 0x5800; + npc->view.top = 0x7000; + // Fallthrough + case 11: + npc->x = gBoss[0].x + 0x5800; + npc->y = gBoss[0].y; + break; + + case 50: + npc->act_no = 51; + npc->act_wait = 112; + // Fallthrough + case 51: + if (--npc->act_wait == 0) + { + npc->act_no = 100; + npc->ani_no = 2; + } + + npc->x = gBoss[0].x + 0x5800; + npc->y = gBoss[0].y; + break; + + case 100: + npc->ani_no = 2; + break; + } + + npc->rect = rect[npc->ani_no]; + + if (npc->act_no == 51) + npc->rect.bottom = npc->act_wait + npc->rect.top; +} + +static void ActBossChar_Core_Mini(NPCHAR *npc) +{ + RECT rect[3]; + + rect[0] = {256, 0, 320, 40}; + rect[1] = {256, 40, 320, 80}; + rect[2] = {256, 80, 320, 120}; + + npc->life = 1000; + + switch (npc->act_no) + { + case 10: + npc->ani_no = 2; + npc->bits &= ~0x20; + break; + + case 100: + npc->act_no = 101; + npc->ani_no = 2; + npc->act_wait = 0; + npc->tgt_x = gBoss[0].x + (Random(-0x80, 0x20) * 0x200); + npc->tgt_y = gBoss[0].y + (Random(-0x40, 0x40) * 0x200); + npc->bits |= 0x20; + // Fallthrough + case 101: + npc->x += (npc->tgt_x - npc->x) / 16; + npc->y += (npc->tgt_y - npc->y) / 16; + + if (++npc->act_wait > 50) + npc->ani_no = 0; + + break; + + case 120: + npc->act_no = 121; + npc->act_wait = 0; + // Fallthrough + case 121: + if (++npc->act_wait / 2 % 2) + npc->ani_no = 0; + else + npc->ani_no = 1; + + if (npc->act_wait > 20) + npc->act_no = 130; + + break; + + case 130: + npc->act_no = 131; + npc->ani_no = 2; + npc->act_wait = 0; + npc->tgt_x = npc->x + (Random(0x18, 0x30) * 0x200); + npc->tgt_y = npc->y + (Random(-4, 4) * 0x200); + // Fallthrough + case 131: + npc->x += (npc->tgt_x - npc->x) / 16; + npc->y += (npc->tgt_y - npc->y) / 16; + + if (++npc->act_wait > 50) + { + npc->act_no = 140; + npc->ani_no = 0; + } + + if (npc->act_wait == 1 || npc->act_wait == 3) + { + const unsigned char deg = GetArktan(npc->x - gMC.x, npc->y - gMC.y) + Random(-2, 2); + const int ym = 2 * GetSin(deg); + const int xm = 2 * GetCos(deg); + SetNpChar(178, npc->x, npc->y, xm, ym, 0, 0, 0x100); + PlaySoundObject(39, 1); + } + + break; + + case 140: + npc->x += (npc->tgt_x - npc->x) / 16; + npc->y += (npc->tgt_y - npc->y) / 16; + break; + + case 200: + npc->act_no = 201; + npc->ani_no = 2; + npc->xm = 0; + npc->ym = 0; + // Fallthrough + case 201: + npc->xm += 0x20; + npc->x += npc->xm; + + if (npc->x > (gMap.width * 0x2000) + 0x4000) + npc->cond = 0; + + break; + } + + if (npc->shock) + npc->tgt_x += 0x400; + + npc->rect = rect[npc->ani_no]; +} + +static void ActBossChar_Core_Hit(NPCHAR *npc) +{ + switch (npc->count1) + { + case 0: + npc->x = gBoss[0].x; + npc->y = gBoss[0].y - 0x4000; + break; + case 1: + npc->x = gBoss[0].x + 0x3800; + npc->y = gBoss[0].y; + break; + case 2: + npc->x = gBoss[0].x + 0x800; + npc->y = gBoss[0].y + 0x4000; + break; + case 3: + npc->x = gBoss[0].x - 0x3800; + npc->y = gBoss[0].y + 0x800; + break; + } +} + +void ActBossChar_Core(void) +{ + static unsigned char flash; + + bool bShock = false; + + switch (gBoss[0].act_no) + { + case 0: + gBoss[0].act_no = 10; + gBoss[0].exp = 1; + gBoss[0].cond = 0x80; + gBoss[0].bits = 0x800C; + gBoss[0].life = 650; + gBoss[0].hit_voice = 114; + gBoss[0].x = 0x9A000; + gBoss[0].y = 0x1C000; + gBoss[0].xm = 0; + gBoss[0].ym = 0; + gBoss[0].code_event = 1000; + gBoss[0].bits |= 0x200; + + gBoss[4].cond = 0x80; + gBoss[4].act_no = 10; + + gBoss[5].cond = 0x80; + gBoss[5].act_no = 10; + + gBoss[8].cond = 0x80; + gBoss[8].bits = 12; + gBoss[8].view.front = 0; + gBoss[8].view.top = 0; + gBoss[8].hit.back = 0x5000; + gBoss[8].hit.top = 0x2000; + gBoss[8].hit.bottom = 0x2000; + gBoss[8].count1 = 0; + + gBoss[9] = gBoss[8]; + gBoss[9].hit.back = 0x4800; + gBoss[9].hit.top = 0x3000; + gBoss[9].hit.bottom = 0x3000; + gBoss[9].count1 = 1; + + gBoss[10] = gBoss[8]; + gBoss[10].hit.back = 0x5800; + gBoss[10].hit.top = 0x1000; + gBoss[10].hit.bottom = 0x1000; + gBoss[10].count1 = 2; + + gBoss[11] = gBoss[8]; + gBoss[11].cond |= 0x10; + gBoss[11].hit.back = 0x2800; + gBoss[11].hit.top = 0x2800; + gBoss[11].hit.bottom = 0x2800; + gBoss[11].count1 = 3; + + gBoss[1].cond = 0x80; + gBoss[1].act_no = 10; + gBoss[1].bits = 44; + gBoss[1].life = 1000; + gBoss[1].hit_voice = 54; + gBoss[1].hit.back = 0x3000; + gBoss[1].hit.top = 0x2000; + gBoss[1].hit.bottom = 0x2000; + gBoss[1].view.front = 0x4000; + gBoss[1].view.top = 0x2800; + gBoss[1].x = gBoss[0].x - 0x1000; + gBoss[1].y = gBoss[0].y - 0x8000; + + gBoss[2] = gBoss[1]; + gBoss[2].x = gBoss[0].x + 0x2000; + gBoss[2].y = gBoss[0].y; + + gBoss[3] = gBoss[1]; + gBoss[3].x = gBoss[0].x - 0x1000; + gBoss[3].y = gBoss[0].y + 0x8000; + + gBoss[6] = gBoss[1]; + gBoss[6].x = gBoss[0].x - 0x6000; + gBoss[6].y = gBoss[0].y - 0x4000; + + gBoss[7] = gBoss[1]; + gBoss[7].x = gBoss[0].x - 0x6000; + gBoss[7].y = gBoss[0].y + 0x4000; + break; + + case 200: + gBoss[0].act_no = 201; + gBoss[0].act_wait = 0; + gBoss[11].bits &= ~0x20; + gSuperYpos = 0; + CutNoise(); + // Fallthrough + case 201: + gBoss[0].tgt_x = gMC.x; + gBoss[0].tgt_y = gMC.y; + + if (++gBoss[0].act_wait > 400) + { + ++gBoss[0].count1; + PlaySoundObject(115, 1); + + if (gBoss[0].count1 > 3) + { + gBoss[0].count1 = 0; + gBoss[0].act_no = 220; + gBoss[4].ani_no = 0; + gBoss[5].ani_no = 0; + bShock = true; + } + else + { + gBoss[0].act_no = 210; + gBoss[4].ani_no = 0; + gBoss[5].ani_no = 0; + bShock = true; + } + } + + break; + + case 210: + gBoss[0].act_no = 211; + gBoss[0].act_wait = 0; + gBoss[0].count2 = gBoss[0].life; + gBoss[11].bits |= 0x20; + // Fallthrough + case 211: + gBoss[0].tgt_x = gMC.x; + gBoss[0].tgt_y = gMC.y; + + if (gBoss[0].shock) + { + if ((++flash >> 1) % 2) + { + gBoss[4].ani_no = 0; + gBoss[5].ani_no = 0; + } + else + { + gBoss[4].ani_no = 1; + gBoss[5].ani_no = 1; + } + } + else + { + gBoss[4].ani_no = 0; + gBoss[5].ani_no = 0; + } + + if (++gBoss[0].act_wait % 100 == 1) + { + gCurlyShoot_wait = Random(80, 100); + gCurlyShoot_x = gBoss[11].x; + gCurlyShoot_y = gBoss[11].y; + } + + if (gBoss[0].act_wait < 200 && gBoss[0].act_wait % 20 == 1) + SetNpChar(179, gBoss[0].x + (Random(-0x30, -0x10) * 0x200), gBoss[0].y + (Random(-0x40, 0x40) * 0x200), 0, 0, 0, 0, 0x100); + + if (gBoss[0].act_wait > 400 || gBoss[0].life < gBoss[0].count2 - 200) + { + gBoss[0].act_no = 200; + gBoss[4].ani_no = 2; + gBoss[5].ani_no = 0; + bShock = true; + } + + break; + + case 220: + gBoss[0].act_no = 221; + gBoss[0].act_wait = 0; + gSuperYpos = 1; + gBoss[11].bits |= 0x20u; + SetQuake(100); + SetNoise(1, 1000); + // Fallthrough + case 221: + ++gBoss[0].act_wait; + SetNpChar(199, gMC.x + (Random(-50, 150) * 0x400), gMC.y + (Random(-0xA0, 0xA0) * 0x200), 0, 0, 0, 0, 0x100); + gMC.xm -= 0x20; + gMC.cond |= 0x20; + + if (gBoss[0].shock) + { + if ((++flash >> 1) % 2) + { + gBoss[4].ani_no = 0; + gBoss[5].ani_no = 0; + } + else + { + gBoss[4].ani_no = 1; + gBoss[5].ani_no = 1; + } + } + else + { + gBoss[4].ani_no = 0; + gBoss[5].ani_no = 0; + } + + if (gBoss[0].act_wait == 300 || gBoss[0].act_wait == 350 || gBoss[0].act_wait == 400) + { + const unsigned char deg = GetArktan(gBoss[0].x - gMC.x, gBoss[0].y - gMC.y); + const int ym = 3 * GetSin(deg); + const int xm = 3 * GetCos(deg); + SetNpChar(218, gBoss[0].x - 0x5000, gBoss[0].y, xm, ym, 0, 0, 0x100); + PlaySoundObject(101, 1); + } + + if ( gBoss[0].act_wait > 400 ) + { + gBoss[0].act_no = 200; + gBoss[4].ani_no = 2; + gBoss[5].ani_no = 0; + bShock = true; + } + + break; + + case 500: + CutNoise(); + + gBoss[0].act_no = 501; + gBoss[0].act_wait = 0; + gBoss[0].xm = 0; + gBoss[0].ym = 0; + gBoss[4].ani_no = 2; + gBoss[5].ani_no = 0; + gBoss[1].act_no = 200; + gBoss[2].act_no = 200; + gBoss[3].act_no = 200; + gBoss[6].act_no = 200; + gBoss[7].act_no = 200; + + SetQuake(20); + + for (int i = 0; i < 0x20; ++i) + SetNpChar(4, gBoss[0].x + (Random(-0x80, 0x80) * 0x200), gBoss[0].y + (Random(-0x40, 0x40) * 0x200), Random(-0x80, 0x80) * 0x200, Random(-0x80, 0x80) * 0x200, 0, 0, 0x100); + + for (int i = 0; i < 12; ++i) + gBoss[i].bits &= ~0x24; + + // Fallthrough + case 501: + if (++gBoss[0].act_wait % 16) + SetNpChar(4, gBoss[0].x + (Random(-0x40, 0x40) * 0x200), gBoss[0].y + (Random(-0x20, 0x20) * 0x200), Random(-0x80, 0x80) * 0x200, Random(-0x80, 0x80) * 0x200, 0, 0, 0x100); + + if (gBoss[0].act_wait / 2 % 2) + gBoss[0].x -= 0x200; + else + gBoss[0].x += 0x200; + + if (gBoss[0].x < 0x7E000) + gBoss[0].x += 0x80; + else + gBoss[0].x -= 0x80; + + if (gBoss[0].y < 0x16000) + gBoss[0].y += 0x80; + else + gBoss[0].y -= 0x80; + + break; + + case 600: + gBoss[0].act_no = 601; + gBoss[4].act_no = 50; + gBoss[5].act_no = 50; + gBoss[8].bits &= ~4; + gBoss[9].bits &= ~4; + gBoss[10].bits &= ~4; + gBoss[11].bits &= ~4; + // Fallthrough + case 601: + if (++gBoss[0].act_wait / 2 % 2) + gBoss[0].x -= 0x800; + else + gBoss[0].x += 0x800; + + break; + } + + if (bShock) + { + SetQuake(20); + + gBoss[1].act_no = 100; + gBoss[2].act_no = 100; + gBoss[3].act_no = 100; + gBoss[6].act_no = 100; + gBoss[7].act_no = 100; + + PlaySoundObject(26, 1); + + for (int i = 0; i < 8; ++i) + SetNpChar(4, gBoss[4].x + (Random(-0x20, 0x10) * 0x200), gBoss[4].y, Random(-0x200, 0x200), Random(-0x100, 0x100), 0, 0, 0x100); + } + + if (gBoss[0].act_no >= 200 && gBoss[0].act_no < 300) + { + switch (gBoss[0].act_wait) + { + case 80: + gBoss[1].act_no = 120; + break; + case 110: + gBoss[2].act_no = 120; + break; + case 140: + gBoss[3].act_no = 120; + break; + case 170: + gBoss[6].act_no = 120; + break; + case 200: + gBoss[7].act_no = 120; + break; + } + + if (gBoss[0].x < gBoss[0].tgt_x + 0x14000) + gBoss[0].xm += 4; + if (gBoss[0].x > gBoss[0].tgt_x + 0x14000) + gBoss[0].xm -= 4; + + if (gBoss[0].y < gBoss[0].tgt_y) + gBoss[0].ym += 4; + if (gBoss[0].y > gBoss[0].tgt_y) + gBoss[0].ym -= 4; + } + + if (gBoss[0].xm > 0x80) + gBoss[0].xm = 0x80; + if (gBoss[0].xm < -0x80) + gBoss[0].xm = -0x80; + + if (gBoss[0].ym > 0x80) + gBoss[0].ym = 0x80; + if (gBoss[0].ym < -0x80) + gBoss[0].ym = -0x80; + + gBoss[0].x += gBoss[0].xm; + gBoss[0].y += gBoss[0].ym; + + ActBossChar_Core_Face(&gBoss[4]); + + ActBossChar_Core_Tail(&gBoss[5]); + + ActBossChar_Core_Mini(&gBoss[1]); + ActBossChar_Core_Mini(&gBoss[2]); + ActBossChar_Core_Mini(&gBoss[3]); + ActBossChar_Core_Mini(&gBoss[6]); + ActBossChar_Core_Mini(&gBoss[7]); + + ActBossChar_Core_Hit(&gBoss[8]); + ActBossChar_Core_Hit(&gBoss[9]); + ActBossChar_Core_Hit(&gBoss[10]); + ActBossChar_Core_Hit(&gBoss[11]); +} diff --git a/src/BossAlmo1.h b/src/BossAlmo1.h new file mode 100644 index 00000000..5619df1f --- /dev/null +++ b/src/BossAlmo1.h @@ -0,0 +1,3 @@ +#pragma once + +void ActBossChar_Core(void); diff --git a/src/MyChar.cpp b/src/MyChar.cpp index 9fa7f6fb..935a20c4 100644 --- a/src/MyChar.cpp +++ b/src/MyChar.cpp @@ -639,6 +639,131 @@ void ActMyChar_Normal(bool bKey) } } +void ActMyChar_Stream(bool bKey) +{ + gMC.up = false; + gMC.down = false; + + if (bKey) + { + if (gKey & (gKeyRight | gKeyLeft)) + { + if (gKey & gKeyLeft) + gMC.xm -= 0x100; + + if (gKey & gKeyRight) + gMC.xm += 0x100; + } + else if (gMC.xm > 0x7F || gMC.xm < -0x7F) + { + if (gMC.xm > 0) + gMC.xm -= 0x80; + else if (gMC.xm < 0) + gMC.xm += 0x80; + } + else + { + gMC.xm = 0; + } + + if (gKey & (gKeyDown | gKeyUp)) + { + if (gKey & gKeyUp) + gMC.ym -= 0x100; + + if (gKey & gKeyDown) + gMC.ym += 0x100; + } + else if (gMC.ym > 0x7F || gMC.ym < -0x7F) + { + if (gMC.ym > 0) + gMC.ym -= 0x80; + else if (gMC.ym < 0) + gMC.ym += 0x80; + } + else + { + gMC.ym = 0; + } + } + else + { + if (gMC.xm > 0x7F || gMC.xm < -0x3F) + { + if (gMC.xm > 0) + gMC.xm -= 0x80; + else if (gMC.xm < 0) + gMC.xm += 0x80; + } + else + { + gMC.xm = 0; + } + + if (gMC.ym > 0x7F || gMC.ym < -0x3F) + { + if (gMC.ym > 0) + gMC.ym -= 0x80; + else if (gMC.ym < 0) + gMC.ym += 0x80; + } + else + { + gMC.ym = 0; + } + } + + if (gMC.ym < -0x200 && gMC.flag & 2) + SetCaret(gMC.x, gMC.y - gMC.hit.top, 13, 5); + if (gMC.ym > 0x200 && gMC.flag & 8) + SetCaret(gMC.x, gMC.hit.bottom + gMC.y, 13, 5); + + if (gMC.xm > 0x400) + gMC.xm = 0x400; + if (gMC.xm < -0x400) + gMC.xm = -0x400; + + if (gMC.ym > 0x400) + gMC.ym = 0x400; + if (gMC.ym < -0x400) + gMC.ym = -0x400; + + if ((gKey & (gKeyUp | gKeyLeft)) == (gKeyLeft | gKeyUp)) + { + if (gMC.xm < -780) + gMC.xm = -780; + if (gMC.ym < -780) + gMC.ym = -780; + } + + if ((gKey & (gKeyUp | gKeyRight)) == (gKeyRight | gKeyUp)) + { + if (gMC.xm > 780) + gMC.xm = 780; + if (gMC.ym < -780) + gMC.ym = -780; + } + + if ((gKey & (gKeyDown | gKeyLeft)) == (gKeyLeft | gKeyDown)) + { + if (gMC.xm < -780) + gMC.xm = -780; + if (gMC.ym > 780) + gMC.ym = 780; + } + + if ((gKey & (gKeyDown | gKeyRight)) == (gKeyRight | gKeyDown)) + { + if (gMC.xm > 780) + gMC.xm = 780; + if (gMC.ym > 780) + gMC.ym = 780; + } + + gMC.x += gMC.xm; + gMC.y += gMC.ym; +} + void AirProcess() { if (gMC.equip & 0x10) @@ -713,7 +838,7 @@ void ActMyChar(bool bKey) break; case 1: - //ActMyChar_Stream(bKey); + ActMyChar_Stream(bKey); break; default: diff --git a/src/NpcAct.h b/src/NpcAct.h index b999b8ef..62d1414e 100644 --- a/src/NpcAct.h +++ b/src/NpcAct.h @@ -180,7 +180,8 @@ void ActNpc174(NPCHAR *npc); void ActNpc175(NPCHAR *npc); void ActNpc176(NPCHAR *npc); void ActNpc177(NPCHAR *npc); - +void ActNpc178(NPCHAR *npc); +void ActNpc179(NPCHAR *npc); void ActNpc180(NPCHAR *npc); void ActNpc181(NPCHAR *npc); void ActNpc182(NPCHAR *npc); @@ -190,7 +191,7 @@ void ActNpc185(NPCHAR *npc); void ActNpc186(NPCHAR *npc); void ActNpc187(NPCHAR *npc); void ActNpc188(NPCHAR *npc); - +void ActNpc189(NPCHAR *npc); void ActNpc190(NPCHAR *npc); void ActNpc191(NPCHAR *npc); void ActNpc192(NPCHAR *npc); @@ -202,8 +203,11 @@ void ActNpc199(NPCHAR *npc); void ActNpc211(NPCHAR *npc); +void ActNpc218(NPCHAR *npc); void ActNpc219(NPCHAR *npc); +void ActNpc259(NPCHAR *npc); + void ActNpc278(NPCHAR *npc); void ActNpc292(NPCHAR *npc); diff --git a/src/NpcAct160.cpp b/src/NpcAct160.cpp index 77d14cde..6e74a75a 100644 --- a/src/NpcAct160.cpp +++ b/src/NpcAct160.cpp @@ -1517,3 +1517,89 @@ void ActNpc177(NPCHAR *npc) npc->rect = rc[npc->ani_no]; } + +//Core blade projectile +void ActNpc178(NPCHAR *npc) +{ + if (npc->flag & 0xFF) + { + SetCaret(npc->x, npc->y, 2, 0); + npc->cond = 0; + } + + if (npc->flag & 0x100) + { + npc->y += npc->ym / 2; + npc->x += npc->xm / 2; + } + else + { + npc->y += npc->ym; + npc->x += npc->xm; + } + + RECT rect_left[3]; + + rect_left[0] = {0, 224, 16, 240}; + rect_left[1] = {16, 224, 32, 240}; + rect_left[2] = {32, 224, 48, 240}; + + if (++npc->ani_wait > 1) + { + npc->ani_wait = 0; + ++npc->ani_no; + } + + if (npc->ani_no > 2) + npc->ani_no = 0; + + npc->rect = rect_left[npc->ani_no]; + + if (++npc->count1 > 150) + { + VanishNpChar(npc); + SetCaret(npc->x, npc->y, 2, 0); + } +} + +//Core wisp projectile +void ActNpc179(NPCHAR *npc) +{ + if (npc->flag & 0xFF) + { + npc->cond = 0; + SetCaret(npc->x, npc->y, 2, 0); + } + + npc->xm -= 0x20; + npc->ym = 0; + + if (npc->xm < -0x400) + npc->xm = -0x400; + + npc->y += npc->ym; + npc->x += npc->xm; + + RECT rect_left[3]; + + rect_left[0] = {48, 224, 72, 240}; + rect_left[1] = {72, 224, 96, 240}; + rect_left[2] = {96, 224, 120, 240}; + + if (++npc->ani_wait > 1) + { + npc->ani_wait = 0; + ++npc->ani_no; + } + + if (npc->ani_no > 2) + npc->ani_no = 0; + + npc->rect = rect_left[npc->ani_no]; + + if (++npc->count1 > 300) + { + VanishNpChar(npc); + SetCaret(npc->x, npc->y, 2, 0); + } +} diff --git a/src/NpcAct180.cpp b/src/NpcAct180.cpp index 07dcd1ff..70f15505 100644 --- a/src/NpcAct180.cpp +++ b/src/NpcAct180.cpp @@ -858,6 +858,72 @@ void ActNpc188(NPCHAR *npc) npc->rect = rect_right[npc->ani_no]; } +//Unused homing flame object (possibly related to the Core?) +void ActNpc189(NPCHAR *npc) +{ + switch (npc->act_no) + { + case 0: + npc->act_no = 1; + npc->xm = -0x40; + // Fallthrough + case 1: + npc->y += npc->ym; + + if (++npc->act_wait > 0x100) + npc->act_no = 10; + + break; + + case 10: + if (gMC.x < npc->x) + npc->xm -= 8; + else + npc->xm += 8; + + if (gMC.y < npc->y) + npc->ym -= 8; + else + npc->ym += 8; + + 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; + 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 > 2) + npc->ani_no = 0; + + RECT rect[3]; + + rect[0] = {224, 184, 232, 200}; + rect[1] = {232, 184, 240, 200}; + rect[2] = {240, 184, 248, 200}; + + npc->rect = rect[npc->ani_no]; +} + //Broken robot void ActNpc190(NPCHAR *npc) { diff --git a/src/NpcAct200.cpp b/src/NpcAct200.cpp index c2bcc3f6..59603e84 100644 --- a/src/NpcAct200.cpp +++ b/src/NpcAct200.cpp @@ -22,6 +22,32 @@ void ActNpc211(NPCHAR *npc) npc->rect = rects[npc->code_event]; } +// Core giant energy ball projectile +void ActNpc218(NPCHAR *npc) +{ + RECT rc[2]; + + rc[0] = {256, 120, 288, 152}; + rc[1] = {288, 120, 320, 152}; + + npc->x += npc->xm; + npc->y += npc->ym; + + if (++npc->act_wait > 200) + npc->cond = 0; + + if (++npc->ani_wait > 2) + { + npc->ani_wait = 0; + ++npc->ani_no; + } + + if (npc->ani_no > 1) + npc->ani_no = 0; + + npc->rect = rc[npc->ani_no]; +} + //Smoke generator void ActNpc219(NPCHAR *npc) { diff --git a/src/NpcAct240.cpp b/src/NpcAct240.cpp new file mode 100644 index 00000000..a9c01257 --- /dev/null +++ b/src/NpcAct240.cpp @@ -0,0 +1,69 @@ +#include "WindowsWrapper.h" + +#include "NpcAct.h" + +#include "MyChar.h" +#include "NpChar.h" +#include "Game.h" +#include "Sound.h" +#include "Back.h" +#include "Triangle.h" + +//Curly (carried and unconcious) +void ActNpc259(NPCHAR *npc) +{ + RECT rcLeft = {224, 96, 240, 112}; + RECT rcRight = {224, 112, 240, 128}; + + switch (npc->act_no) + { + case 0: + npc->bits &= ~0x2000; + npc->act_no = 1; + // Fallthrough + case 1: + if (gMC.direct == 0) + npc->direct = 0; + else + npc->direct = 2; + + npc->y = gMC.y - 0x800; + + if (npc->direct == 0) + { + npc->x = gMC.x + 0x600; + npc->rect = rcLeft; + } + else + { + npc->x = gMC.x - 0x600; + npc->rect = rcRight; + } + + if (gMC.ani_no % 2) + ++npc->rect.top; + + break; + + case 10: + npc->act_no = 11; + npc->xm = 0x40; + npc->ym = -0x20; + + npc->rect = rcLeft; + break; + + case 11: + if (npc->y < 0x8000) + npc->ym = 0x20; + + npc->x += npc->xm; + npc->y += npc->ym; + break; + + case 20: + VanishNpChar(npc); + SetDestroyNpCharUp(npc->x, npc->y, 0x2000, 0x40); + break; + } +} diff --git a/src/NpcTbl.cpp b/src/NpcTbl.cpp index 2a2885ef..caa2fb3a 100644 --- a/src/NpcTbl.cpp +++ b/src/NpcTbl.cpp @@ -234,8 +234,8 @@ NPCFUNCTION gpNpcFuncTbl[361] = ActNpc175, ActNpc176, ActNpc177, - nullptr, - nullptr, + ActNpc178, + ActNpc179, ActNpc180, ActNpc181, ActNpc182, @@ -245,7 +245,7 @@ NPCFUNCTION gpNpcFuncTbl[361] = ActNpc186, ActNpc187, ActNpc188, - nullptr, + ActNpc189, ActNpc190, ActNpc191, ActNpc192, @@ -274,7 +274,7 @@ NPCFUNCTION gpNpcFuncTbl[361] = nullptr, nullptr, nullptr, - nullptr, + ActNpc218, ActNpc219, nullptr, nullptr, @@ -315,7 +315,7 @@ NPCFUNCTION gpNpcFuncTbl[361] = nullptr, nullptr, nullptr, - nullptr, + ActNpc259, nullptr, nullptr, nullptr,