From a26f4b4bce273d36825a3bcf201e0c6cd904de80 Mon Sep 17 00:00:00 2001 From: Clownacy Date: Mon, 28 Jan 2019 11:56:48 +0000 Subject: [PATCH] More First Cave objects --- Makefile | 1 + src/NpcAct.h | 6 ++++ src/NpcAct020.cpp | 81 +++++++++++++++++++++++++++++++++++++++++++++++ src/NpcAct100.cpp | 20 ++++++++++++ src/NpcTbl.cpp | 6 ++-- 5 files changed, 112 insertions(+), 2 deletions(-) create mode 100644 src/NpcAct100.cpp diff --git a/Makefile b/Makefile index caf0a4e3..f60a9b81 100644 --- a/Makefile +++ b/Makefile @@ -60,6 +60,7 @@ SOURCES = \ NpcAct020 \ NpcAct040 \ NpcAct060 \ + NpcAct100 \ NpcAct200 \ NpcAct280 \ NpcAct300 \ diff --git a/src/NpcAct.h b/src/NpcAct.h index 919f4e1c..8c50ce08 100644 --- a/src/NpcAct.h +++ b/src/NpcAct.h @@ -20,8 +20,12 @@ void ActNpc021(NPCHAR *npc); void ActNpc022(NPCHAR *npc); void ActNpc023(NPCHAR *npc); +void ActNpc030(NPCHAR *npc); + void ActNpc032(NPCHAR *npc); +void ActNpc037(NPCHAR *npc); + void ActNpc039(NPCHAR *npc); void ActNpc059(NPCHAR *npc); @@ -35,6 +39,8 @@ void ActNpc065(NPCHAR *npc); void ActNpc073(NPCHAR *npc); +void ActNpc119(NPCHAR *npc); + void ActNpc211(NPCHAR *npc); void ActNpc298(NPCHAR *npc); diff --git a/src/NpcAct020.cpp b/src/NpcAct020.cpp index 7b957da2..fd5bcbc5 100644 --- a/src/NpcAct020.cpp +++ b/src/NpcAct020.cpp @@ -8,6 +8,7 @@ #include "Sound.h" #include "Back.h" #include "Triangle.h" +#include "Caret.h" //Computer void ActNpc020(NPCHAR *npc) @@ -107,6 +108,66 @@ void ActNpc023(NPCHAR *npc) npc->rect = rect[npc->ani_no]; } +//Gunsmith +void ActNpc030(NPCHAR *npc) +{ + RECT rc[3]; + + rc[0] = {48, 0, 64, 16}; + rc[1] = {48, 16, 64, 32}; + rc[2] = {0, 32, 16, 48}; + + if (npc->direct != 0) + { + switch (npc->act_no) + { + case 0: + npc->act_no = 1; + npc->y += 0x2000; + npc->ani_no = 2; + break; + } + + if (++npc->act_wait > 100) + { + npc->act_wait = 0; + SetCaret(npc->x, npc->y - 0x400, 5, 0); + } + } + else + { + switch (npc->act_no) + { + case 0: + npc->act_no = 1; + npc->ani_no = 0; + npc->ani_wait = 0; + // Fallthrough + + case 1: + if (Random(0, 120) == 10) + { + npc->act_no = 2; + npc->act_wait = 0; + npc->ani_no = 1; + } + + break; + + case 2: + if (++npc->act_wait > 8) + { + npc->act_no = 1; + npc->ani_no = 0; + } + + break; + } + } + + npc->rect = rc[npc->ani_no]; +} + //Life capsule void ActNpc032(NPCHAR *npc) { @@ -146,6 +207,26 @@ void ActNpc032(NPCHAR *npc) npc->rect = rect[npc->ani_no]; } +//Signpost +void ActNpc037(NPCHAR *npc) +{ + RECT rect[2]; + + rect[0] = {192, 64, 208, 80}; + rect[1] = {208, 64, 224, 80}; + + if (++npc->ani_wait > 1) + { + 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/NpcAct100.cpp b/src/NpcAct100.cpp new file mode 100644 index 00000000..3c4b8f2f --- /dev/null +++ b/src/NpcAct100.cpp @@ -0,0 +1,20 @@ +#include "WindowsWrapper.h" + +#include "NpcAct.h" + +#include "MyChar.h" +#include "NpChar.h" +#include "Game.h" +#include "Sound.h" +#include "Back.h" +#include "Triangle.h" + +//Table and chair +void ActNpc119(NPCHAR *npc) +{ + RECT rc[1]; + + rc[0] = {248, 184, 272, 200}; + + npc->rect = rc[0]; +} diff --git a/src/NpcTbl.cpp b/src/NpcTbl.cpp index b7eaaf16..f97117c8 100644 --- a/src/NpcTbl.cpp +++ b/src/NpcTbl.cpp @@ -86,6 +86,8 @@ NPCFUNCTION gpNpcFuncTbl[361] = nullptr, nullptr, nullptr, + ActNpc030, + nullptr, ActNpc032, nullptr, nullptr, @@ -93,7 +95,7 @@ NPCFUNCTION gpNpcFuncTbl[361] = ActNpc032, nullptr, nullptr, - nullptr, + ActNpc037, nullptr, ActNpc039, nullptr, @@ -175,7 +177,7 @@ NPCFUNCTION gpNpcFuncTbl[361] = nullptr, nullptr, nullptr, - nullptr, + ActNpc119, nullptr, nullptr, nullptr,