shithub: cstory

Download patch

ref: 1b733b6a1fcb50d4a45c845dd86dcbbab2a16862
parent: daa858f09cac0319b6699c3d55780bb2d8a3c001
author: Clownacy <[email protected]>
date: Mon Jan 28 06:37:53 EST 2019

More First Cave objects. Also added opening objects.

--- a/Makefile
+++ b/Makefile
@@ -61,6 +61,8 @@
 	NpcAct040 \
 	NpcAct060 \
 	NpcAct200 \
+	NpcAct280 \
+	NpcAct300 \
 	NpcAct340 \
 	NpChar \
 	NpcHit \
--- a/src/NpcAct.h
+++ b/src/NpcAct.h
@@ -20,6 +20,8 @@
 void ActNpc022(NPCHAR *npc);
 void ActNpc023(NPCHAR *npc);
 
+void ActNpc032(NPCHAR *npc);
+
 void ActNpc039(NPCHAR *npc);
 
 void ActNpc059(NPCHAR *npc);
@@ -34,5 +36,9 @@
 void ActNpc073(NPCHAR *npc);
 
 void ActNpc211(NPCHAR *npc);
+
+void ActNpc298(NPCHAR *npc);
+void ActNpc299(NPCHAR *npc);
+void ActNpc300(NPCHAR *npc);
 
 void ActNpc359(NPCHAR *npc);
--- a/src/NpcAct020.cpp
+++ b/src/NpcAct020.cpp
@@ -126,6 +126,26 @@
 	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)
 {
--- /dev/null
+++ b/src/NpcAct280.cpp
@@ -1,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];
+}
--- /dev/null
+++ b/src/NpcAct300.cpp
@@ -1,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];
+}
--- a/src/NpcTbl.cpp
+++ b/src/NpcTbl.cpp
@@ -86,10 +86,10 @@
 	nullptr,
 	nullptr,
 	nullptr,
+	ActNpc032,
 	nullptr,
 	nullptr,
 	nullptr,
-	nullptr,
 	ActNpc032,
 	nullptr,
 	nullptr,
@@ -354,9 +354,9 @@
 	nullptr,
 	nullptr,
 	nullptr,
-	nullptr,
-	nullptr,
-	nullptr,
+	ActNpc298,
+	ActNpc299,
+	ActNpc300,
 	nullptr,
 	nullptr,
 	nullptr,