shithub: cstory

Download patch

ref: 1861c02819c9f25ff585382289b3ca0a4e78678e
parent: 70046998c33563b44c28ff7364eb6bb81dd9354a
author: Clownacy <[email protected]>
date: Sun Jan 27 06:16:49 EST 2019

Added NPC016 (save point)

--- a/src/NpcAct.h
+++ b/src/NpcAct.h
@@ -6,3 +6,5 @@
 void ActNpc004(NPCHAR *npc);
 void ActNpc005(NPCHAR *npc);
 void ActNpc006(NPCHAR *npc);
+
+void ActNpc016(NPCHAR *npc);
--- a/src/NpcAct000.cpp
+++ b/src/NpcAct000.cpp
@@ -614,3 +614,58 @@
 	else
 		npc->rect = rcLeft[npc->ani_no];
 }
+
+//Save point
+void ActNpc016(NPCHAR *npc)
+{
+	RECT rects[8];
+
+	rects[0] = {96, 16, 112, 32};
+	rects[1] = {112, 16, 128, 32};
+	rects[2] = {128, 16, 144, 32};
+	rects[3] = {144, 16, 160, 32};
+	rects[4] = {160, 16, 176, 32};
+	rects[5] = {176, 16, 192, 32};
+	rects[6] = {192, 16, 208, 32};
+	rects[7] = {208, 16, 224, 32};
+
+	switch (npc->act_no)
+	{
+		case 0:
+			npc->bits |= 0x2000u;
+			npc->act_no = 1;
+
+			if (npc->direct == 2)
+			{
+				npc->bits &= ~0x2000u;
+				npc->ym = -0x200;
+
+				for (int i = 0; i < 4; ++i)
+					SetNpChar(4, npc->x + (Random(-12, 12) * 0x200), npc->y + (Random(-12, 12) * 0x200), Random(-341, 341), Random(-0x600, 0), 0, 0, 0x100);
+			}
+
+			// Fallthrough
+		case 1:
+			if (npc->flag & 8)
+				npc->bits |= 0x2000u;
+
+			break;
+	}
+
+	if ( ++npc->ani_wait > 2 )
+	{
+		npc->ani_wait = 0;
+		++npc->ani_no;
+	}
+
+	if ( npc->ani_no > 7 )
+		npc->ani_no = 0;
+
+	npc->ym += 0x40;
+	if ( npc->ym > 0x5FF )
+		npc->ym = 0x5FF;
+
+	npc->y += npc->ym;
+
+	npc->rect = rects[npc->ani_no];
+}
--- a/src/NpcTbl.cpp
+++ b/src/NpcTbl.cpp
@@ -72,7 +72,7 @@
 	nullptr,
 	nullptr,
 	nullptr,
-	nullptr,
+	&ActNpc016,
 	nullptr,
 	nullptr,
 	nullptr,