shithub: cstory

Download patch

ref: daa858f09cac0319b6699c3d55780bb2d8a3c001
parent: 56d249283dcc74a1ae4dc3c83b0518d4a15183d9
author: Clownacy <Clownacy@users.noreply.github.com>
date: Mon Jan 28 06:11:35 EST 2019

More First Cave objects (also Kazuma's shelter ones)

--- a/Makefile
+++ b/Makefile
@@ -58,8 +58,10 @@
 	MycParam \
 	NpcAct000 \
 	NpcAct020 \
+	NpcAct040 \
 	NpcAct060 \
 	NpcAct200 \
+	NpcAct340 \
 	NpChar \
 	NpcHit \
 	NpcTbl \
--- a/src/NpcAct.h
+++ b/src/NpcAct.h
@@ -17,10 +17,22 @@
 
 void ActNpc020(NPCHAR *npc);
 void ActNpc021(NPCHAR *npc);
+void ActNpc022(NPCHAR *npc);
+void ActNpc023(NPCHAR *npc);
 
+void ActNpc039(NPCHAR *npc);
+
+void ActNpc059(NPCHAR *npc);
+
+void ActNpc062(NPCHAR *npc);
+
 void ActNpc032(NPCHAR *npc);
 
 void ActNpc064(NPCHAR *npc);
 void ActNpc065(NPCHAR *npc);
 
+void ActNpc073(NPCHAR *npc);
+
 void ActNpc211(NPCHAR *npc);
+
+void ActNpc359(NPCHAR *npc);
--- a/src/NpcAct020.cpp
+++ b/src/NpcAct020.cpp
@@ -57,6 +57,56 @@
 	npc->rect = rect[0];
 }
 
+//Teleporter
+void ActNpc022(NPCHAR *npc)
+{
+	RECT rect[2];
+
+	rect[0] = {240, 16, 264, 48};
+	rect[1] = {248, 152, 272, 184};
+
+	switch (npc->act_no)
+	{
+		case 0:
+			npc->ani_no = 0;
+			break;
+
+		case 1:
+			if (++npc->ani_no > 1)
+				npc->ani_no = 0;
+
+			break;
+	}
+
+	npc->rect = rect[npc->ani_no];
+}
+
+//Teleporter lights
+void ActNpc023(NPCHAR *npc)
+{
+	RECT rect[8];
+
+	rect[0] = {264, 16, 288, 20};
+	rect[1] = {264, 20, 288, 24};
+	rect[2] = {264, 24, 288, 28};
+	rect[3] = {264, 28, 288, 32};
+	rect[4] = {264, 32, 288, 36};
+	rect[5] = {264, 36, 288, 40};
+	rect[6] = {264, 40, 288, 44};
+	rect[7] = {264, 44, 288, 48};
+
+	if (++npc->ani_wait > 1)
+	{
+		npc->ani_wait = 0;
+		++npc->ani_no;
+	}
+
+	if (npc->ani_no > 7)
+		npc->ani_no = 0;
+
+	npc->rect = rect[npc->ani_no];
+}
+
 //Life capsule
 void ActNpc032(NPCHAR *npc)
 {
@@ -74,4 +124,21 @@
 		npc->ani_no = 0;
 	
 	npc->rect = rect[npc->ani_no];
-}
\ No newline at end of file
+}
+
+//Save sign
+void ActNpc039(NPCHAR *npc)
+{
+	RECT rect[2];
+
+	rect[0] = {224, 64, 240, 80};
+	rect[1] = {240, 64, 256, 80};
+
+	if (npc->direct == 0)
+		npc->ani_no = 0;
+	else
+		npc->ani_no = 1;
+
+	npc->rect = rect[npc->ani_no];
+}
+>>>>>>> More First Cave objects (also Kazuma's shelter ones)
--- /dev/null
+++ b/src/NpcAct040.cpp
@@ -1,0 +1,75 @@
+#include "WindowsWrapper.h"
+
+#include "NpcAct.h"
+
+#include "MyChar.h"
+#include "NpChar.h"
+#include "Game.h"
+#include "Sound.h"
+#include "Back.h"
+#include "Triangle.h"
+
+//Eye door
+void ActNpc059(NPCHAR *npc)
+{
+	RECT rcLeft[4];
+
+	rcLeft[0] = {224, 16, 240, 40};
+	rcLeft[1] = {208, 80, 224, 104};
+	rcLeft[2] = {224, 80, 240, 104};
+	rcLeft[3] = {240, 80, 256, 104};
+
+	switch (npc->act_no)
+	{
+		case 0:
+			npc->act_no = 1;
+			// Fallthrough
+
+		case 1:
+			if (npc->x - 0x8000 < gMC.x && npc->x + 0x8000 > gMC.x && npc->y - 0x8000 < gMC.y && npc->y + 0x8000 > gMC.y)
+			{
+				npc->act_no = 2;
+				npc->ani_wait = 0;
+			}
+
+			break;
+
+		case 2:
+			if (++npc->ani_wait > 2)
+			{
+				npc->ani_wait = 0;
+				++npc->ani_no;
+			}
+
+			if (npc->ani_no == 2)
+				npc->act_no = 3;
+
+			break;
+
+		case 3:
+			if (npc->x - 0x8000 >= gMC.x || npc->x + 0x8000 <= gMC.x || npc->y - 0x8000 >= gMC.y || npc->y + 0x8000 <= gMC.y)
+			{
+				npc->act_no = 4;
+				npc->ani_wait = 0;
+			}
+
+			break;
+
+		case 4:
+			if (++npc->ani_wait > 2)
+			{
+				npc->ani_wait = 0;
+				--npc->ani_no;
+			}
+
+			if (npc->ani_no == 0)
+				npc->act_no = 1;
+
+			break;
+	}
+
+	if (npc->shock)
+		npc->rect = rcLeft[3];
+	else
+		npc->rect = rcLeft[npc->ani_no];
+}
--- a/src/NpcAct060.cpp
+++ b/src/NpcAct060.cpp
@@ -8,7 +8,76 @@
 #include "Sound.h"
 #include "Back.h"
 #include "Triangle.h"
+#include "Map.h"
 
+//Kazuma at computer
+void ActNpc062(NPCHAR *npc)
+{
+	RECT rcLeft[3];
+
+	rcLeft[0] = {272, 192, 288, 216};
+	rcLeft[1] = {288, 192, 304, 216};
+	rcLeft[2] = {304, 192, 320, 216};
+
+	switch ( npc->act_no )
+	{
+		case 0:
+			npc->x -= 0x800;
+			npc->y += 0x2000;
+			npc->act_no = 1;
+			npc->ani_no = 0;
+			npc->ani_wait = 0;
+			// Fallthrough
+
+		case 1:
+			if (++npc->ani_wait > 2)
+			{
+				npc->ani_wait = 0;
+				++npc->ani_no;
+			}
+
+			if (npc->ani_no > 1)
+				npc->ani_no = 0;
+
+			if (Random(0, 80) == 1)
+			{
+				npc->act_no = 2;
+				npc->act_wait = 0;
+				npc->ani_no = 1;
+			}
+
+			if (Random(0, 120) == 10)
+			{
+				npc->act_no = 3;
+				npc->act_wait = 0;
+				npc->ani_no = 2;
+			}
+
+			break;
+
+		case 2:
+			if (++npc->act_wait > 40)
+			{
+				npc->act_no = 3;
+				npc->act_wait = 0;
+				npc->ani_no = 2;
+			}
+
+			break;
+
+		case 3:
+			if (++npc->act_wait > 80)
+			{
+				npc->act_no = 1;
+				npc->ani_no = 0;
+			}
+
+			break;
+	}
+
+	npc->rect = rcLeft[npc->ani_no];
+}
+
 //First Cave Critter
 void ActNpc064(NPCHAR *npc)
 {
@@ -116,7 +185,6 @@
 		npc->rect = rcRight[npc->ani_no];
 }
 
-
 //First Cave Bat
 void ActNpc065(NPCHAR *npc)
 {
@@ -188,4 +256,47 @@
 	else
 		npc->rect = rect_right[npc->ani_no];
 }
-	
\ No newline at end of file
+
+//Water droplet
+void ActNpc073(NPCHAR *npc)
+{
+	RECT rect[5];
+
+	rect[0] = {72, 16, 74, 18};
+	rect[1] = {74, 16, 76, 18};
+	rect[2] = {76, 16, 78, 18};
+	rect[3] = {78, 16, 80, 18};
+	rect[4] = {80, 16, 82, 18};
+
+	npc->ym += 0x20;
+	npc->ani_no = Random(0, 4);
+
+	if (npc->ym > 0x5FF)
+		npc->ym = 0x5FF;
+
+	npc->x += npc->xm;
+	npc->y += npc->ym;
+
+	npc->rect = rect[npc->ani_no];
+
+	if (npc->direct == 2)
+	{
+		npc->rect.top += 2;
+		npc->rect.bottom += 2;
+	}
+
+	if (++npc->act_wait > 10)
+	{
+		if (npc->flag & 1)
+			npc->cond = 0;
+		if (npc->flag & 4)
+			npc->cond = 0;
+		if (npc->flag & 8)
+			npc->cond = 0;
+		if (npc->flag & 0x100)
+			npc->cond = 0;
+	}
+
+	if (npc->y > gMap.length * 0x10 * 0x200)
+		npc->cond = 0;
+}
--- a/src/NpcAct200.cpp
+++ b/src/NpcAct200.cpp
@@ -21,4 +21,3 @@
 
 	npc->rect = rects[npc->code_event];
 }
-	
\ No newline at end of file
--- /dev/null
+++ b/src/NpcAct340.cpp
@@ -1,0 +1,18 @@
+#include "WindowsWrapper.h"
+
+#include "NpcAct.h"
+
+#include "CommonDefines.h"
+#include "MyChar.h"
+#include "NpChar.h"
+#include "Game.h"
+#include "Sound.h"
+#include "Back.h"
+#include "Triangle.h"
+
+//Water droplet generator
+void ActNpc359(NPCHAR *npc)
+{
+	if (gMC.x < npc->x + (((WINDOW_WIDTH / 2) + 160) * 0x200) && gMC.x > npc->x - (((WINDOW_WIDTH / 2) + 160) * 0x200) && gMC.y < npc->y + (((WINDOW_HEIGHT / 2) + 200) * 0x200) && gMC.y > npc->y - (((WINDOW_HEIGHT / 2) + 40) * 0x200) && Random(0, 100) == 2)
+		SetNpChar(73, npc->x + (Random(-6, 6) * 0x200), npc->y - 0xE00, 0, 0, 0, 0, 0);
+}
--- a/src/NpcTbl.cpp
+++ b/src/NpcTbl.cpp
@@ -54,7 +54,7 @@
 }
 
 //Npc function table
-NPCFUNCTION gpNpcFuncTbl[] =
+NPCFUNCTION gpNpcFuncTbl[361] =
 {
 	ActNpc000,
 	ActNpc001,
@@ -78,6 +78,8 @@
 	nullptr,
 	ActNpc020,
 	ActNpc021,
+	ActNpc022,
+	ActNpc023,
 	nullptr,
 	nullptr,
 	nullptr,
@@ -93,6 +95,7 @@
 	nullptr,
 	nullptr,
 	nullptr,
+	ActNpc039,
 	nullptr,
 	nullptr,
 	nullptr,
@@ -112,14 +115,11 @@
 	nullptr,
 	nullptr,
 	nullptr,
+	ActNpc059,
 	nullptr,
 	nullptr,
+	ActNpc062,
 	nullptr,
-	nullptr,
-	nullptr,
-	nullptr,
-	nullptr,
-	nullptr,
 	ActNpc064,
 	ActNpc065,
 	nullptr,
@@ -129,6 +129,7 @@
 	nullptr,
 	nullptr,
 	nullptr,
+	ActNpc073,
 	nullptr,
 	nullptr,
 	nullptr,
@@ -266,7 +267,6 @@
 	nullptr,
 	nullptr,
 	nullptr,
-	nullptr,
 	ActNpc211,
 	nullptr,
 	nullptr,
@@ -415,5 +415,6 @@
 	nullptr,
 	nullptr,
 	nullptr,
+	ActNpc359,
 	nullptr,
 };
--