From 1b733b6a1fcb50d4a45c845dd86dcbbab2a16862 Mon Sep 17 00:00:00 2001 From: Clownacy Date: Mon, 28 Jan 2019 11:37:53 +0000 Subject: [PATCH] More First Cave objects. Also added opening objects. --- Makefile | 2 + src/NpcAct.h | 6 ++ src/NpcAct020.cpp | 20 ++++++ src/NpcAct280.cpp | 153 ++++++++++++++++++++++++++++++++++++++++++++++ src/NpcAct300.cpp | 32 ++++++++++ src/NpcTbl.cpp | 8 +-- 6 files changed, 217 insertions(+), 4 deletions(-) create mode 100644 src/NpcAct280.cpp create mode 100644 src/NpcAct300.cpp diff --git a/Makefile b/Makefile index 9d2f51c2..caf0a4e3 100644 --- a/Makefile +++ b/Makefile @@ -61,6 +61,8 @@ SOURCES = \ NpcAct040 \ NpcAct060 \ NpcAct200 \ + NpcAct280 \ + NpcAct300 \ NpcAct340 \ NpChar \ NpcHit \ diff --git a/src/NpcAct.h b/src/NpcAct.h index 3564a298..919f4e1c 100644 --- a/src/NpcAct.h +++ b/src/NpcAct.h @@ -20,6 +20,8 @@ void ActNpc021(NPCHAR *npc); void ActNpc022(NPCHAR *npc); void ActNpc023(NPCHAR *npc); +void ActNpc032(NPCHAR *npc); + void ActNpc039(NPCHAR *npc); void ActNpc059(NPCHAR *npc); @@ -35,4 +37,8 @@ void ActNpc073(NPCHAR *npc); void ActNpc211(NPCHAR *npc); +void ActNpc298(NPCHAR *npc); +void ActNpc299(NPCHAR *npc); +void ActNpc300(NPCHAR *npc); + void ActNpc359(NPCHAR *npc); diff --git a/src/NpcAct020.cpp b/src/NpcAct020.cpp index fadd16a2..7b957da2 100644 --- a/src/NpcAct020.cpp +++ b/src/NpcAct020.cpp @@ -126,6 +126,26 @@ void ActNpc032(NPCHAR *npc) npc->rect = rect[npc->ani_no]; } +//Life capsule +void ActNpc032(NPCHAR *npc) +{ + RECT rect[2]; + + rect[0] = {32, 96, 48, 112}; + rect[1] = {48, 96, 64, 112}; + + if (++npc->ani_wait > 2) + { + npc->ani_wait = 0; + ++npc->ani_no; + } + + if ( npc->ani_no > 1 ) + npc->ani_no = 0; + + npc->rect = rect[npc->ani_no]; +} + //Save sign void ActNpc039(NPCHAR *npc) { diff --git a/src/NpcAct280.cpp b/src/NpcAct280.cpp new file mode 100644 index 00000000..583e4c9d --- /dev/null +++ b/src/NpcAct280.cpp @@ -0,0 +1,153 @@ +#include "WindowsWrapper.h" + +#include "NpcAct.h" + +#include "MyChar.h" +#include "NpChar.h" +#include "Game.h" +#include "Sound.h" +#include "Back.h" +#include "Triangle.h" + +//Doctor (opening) +void ActNpc298(NPCHAR *npc) +{ + RECT rc[8]; + + rc[0] = {72, 128, 88, 160}; + rc[1] = {88, 128, 104, 160}; + rc[2] = {104, 128, 120, 160}; + rc[3] = {72, 128, 88, 160}; + rc[4] = {120, 128, 136, 160}; + rc[5] = {72, 128, 88, 160}; + rc[6] = {104, 160, 120, 192}; + rc[7] = {120, 160, 136, 192}; + + switch (npc->act_no) + { + case 0: + npc->act_no = 1; + npc->y -= 0x1000; + // Fallthrough + + case 1: + npc->ani_no = 0; + break; + + case 10: + npc->act_no = 11; + npc->ani_no = 0; + npc->ani_wait = 0; + npc->count1 = 0; + // Fallthrough + + case 11: + if (++npc->ani_wait > 6) + { + npc->ani_wait = 0; + ++npc->ani_no; + } + + if (npc->ani_no > 1) + { + npc->ani_no = 0; + + if (++npc->count1 > 7) + { + npc->ani_no = 0; + npc->act_no = 1; + } + } + + break; + + case 20: + npc->act_no = 21; + npc->ani_no = 2; + npc->ani_wait = 0; + // Fallthrough + + case 21: + if (++npc->ani_wait > 10) + { + npc->ani_wait = 0; + ++npc->ani_no; + } + + if ( npc->ani_no > 5 ) + npc->ani_no = 2; + + npc->x += 0x100; + + break; + + case 30: + npc->ani_no = 6; + break; + + case 40: + npc->act_no = 41; + npc->ani_no = 6; + npc->ani_wait = 0; + npc->count1 = 0; + // Fallthrough + + case 41: + if (++npc->ani_wait > 6) + { + npc->ani_wait = 0; + ++npc->ani_no; + } + + if (npc->ani_no > 7) + { + npc->ani_no = 6; + + if (++npc->count1 > 7) + { + npc->ani_no = 6; + npc->act_no = 30; + } + } + + break; + } + + npc->rect = rc[npc->ani_no]; +} + +//Balrog/Misery (opening) +void ActNpc299(NPCHAR *npc) +{ + RECT rc[2]; + + rc[0] = {0, 0, 48, 48}; + rc[1] = {48, 0, 96, 48}; + + switch (npc->act_no) + { + case 0: + npc->act_no = 1; + + if (npc->direct == 0) + { + npc->ani_no = 1; + npc->act_wait = 25; + npc->y -= 1600; + } + else + { + npc->ani_no = 0; + npc->act_wait = 0; + } + + break; + } + + if (++npc->act_wait / 50 % 2) + npc->y += 0x40; + else + npc->y -= 0x40; + + npc->rect = rc[npc->ani_no]; +} diff --git a/src/NpcAct300.cpp b/src/NpcAct300.cpp new file mode 100644 index 00000000..fae6fa90 --- /dev/null +++ b/src/NpcAct300.cpp @@ -0,0 +1,32 @@ +#include "WindowsWrapper.h" + +#include "NpcAct.h" + +#include "MyChar.h" +#include "NpChar.h" +#include "Game.h" +#include "Sound.h" +#include "Back.h" +#include "Triangle.h" +#include "Caret.h" + +//Demon crown (opening) +void ActNpc300(NPCHAR *npc) +{ + RECT rc[1]; + + rc[0] = {192, 80, 208, 96}; + + switch (npc->act_no) + { + case 0: + npc->act_no = 1; + npc->y += 0xC00; + break; + } + + if (++npc->ani_wait % 8 == 1) + SetCaret(npc->x + (Random(-8, 8) * 0x200), npc->y + 0x1000, 13, 1); + + npc->rect = rc[0]; +} diff --git a/src/NpcTbl.cpp b/src/NpcTbl.cpp index 3ec44444..b7eaaf16 100644 --- a/src/NpcTbl.cpp +++ b/src/NpcTbl.cpp @@ -86,7 +86,7 @@ NPCFUNCTION gpNpcFuncTbl[361] = nullptr, nullptr, nullptr, - nullptr, + ActNpc032, nullptr, nullptr, nullptr, @@ -354,9 +354,9 @@ NPCFUNCTION gpNpcFuncTbl[361] = nullptr, nullptr, nullptr, - nullptr, - nullptr, - nullptr, + ActNpc298, + ActNpc299, + ActNpc300, nullptr, nullptr, nullptr,