shithub: cstory

Download patch

ref: b915e7315d58f622d3c590e3988ef45d3e09c719
parent: 4ddc1af8315bbc2dccf3d6f2d9183f2d27449439
author: cuckydev <cuckydev@users.noreply.github.com>
date: Sun Feb 3 11:06:09 EST 2019

OMH (oh my heck) ITS SANTA

--- a/src/NpcAct.h
+++ b/src/NpcAct.h
@@ -40,7 +40,7 @@
 void ActNpc037(NPCHAR *npc);
 void ActNpc038(NPCHAR *npc);
 void ActNpc039(NPCHAR *npc);
-
+void ActNpc040(NPCHAR *npc);
 void ActNpc041(NPCHAR *npc);
 void ActNpc042(NPCHAR *npc);
 void ActNpc043(NPCHAR *npc);
--- a/src/NpcAct040.cpp
+++ b/src/NpcAct040.cpp
@@ -10,6 +10,86 @@
 #include "Back.h"
 #include "Triangle.h"
 
+//Santa
+void ActNpc040(NPCHAR *npc)
+{
+	RECT rcLeft[7];
+	RECT rcRight[7];
+	
+	rcLeft[0] = {0, 32, 16, 48};
+	rcLeft[1] = {16, 32, 32, 48};
+	rcLeft[2] = {32, 32, 48, 48};
+	rcLeft[3] = {0, 32, 16, 48};
+	rcLeft[4] = {48, 32, 64, 48};
+	rcLeft[5] = {0, 32, 16, 48};
+	rcLeft[6] = {64, 32, 80, 48};
+	
+	rcRight[0] = {0, 48, 16, 64};
+	rcRight[1] = {16, 48, 32, 64};
+	rcRight[2] = {32, 48, 48, 64};
+	rcRight[3] = {0, 48, 16, 64};
+	rcRight[4] = {48, 48, 64, 64};
+	rcRight[5] = {0, 48, 16, 64};
+	rcRight[6] = {64, 48, 80, 64};
+	
+	switch ( npc->act_no )
+	{
+		case 0:
+			npc->act_no = 1;
+			npc->ani_no = 0;
+			npc->ani_wait = 0;
+		case 1:
+			if (Random(0, 120) == 10)
+			{
+				npc->act_no = 2;
+				npc->act_wait = 0;
+				npc->ani_no = 1;
+			}
+			if (npc->x - 0x4000 < gMC.x && npc->x + 0x4000 > gMC.x && npc->y - 0x4000 < gMC.y && npc->y + 0x2000 > gMC.y)
+			{
+				if (npc->x <= gMC.x)
+					npc->direct = 2;
+				else
+					npc->direct = 0;
+			}
+			break;
+		case 2:
+			if (++npc->act_wait > 8)
+			{
+				npc->act_no = 1;
+				npc->ani_no = 0;
+			}
+			break;
+		case 3:
+			npc->act_no = 4;
+			npc->ani_no = 2;
+			npc->ani_wait = 0;
+		case 4:
+			if (++npc->ani_wait > 4)
+			{
+				npc->ani_wait = 0;
+				npc->ani_no++;
+			}
+			if (npc->ani_no > 5)
+				npc->ani_no = 2;
+			if (npc->direct)
+				npc->x += 0x200;
+			else
+				npc->x -= 0x200;
+			break;
+		case 5:
+			npc->ani_no = 6;
+			break;
+		default:
+			break;
+	}
+	
+	if (npc->direct)
+		npc->rect = rcRight[npc->ani_no];
+	else
+		npc->rect = rcLeft[npc->ani_no];
+}
+
 //Busted Door
 void ActNpc041(NPCHAR *npc)
 {
--- a/src/NpcTbl.cpp
+++ b/src/NpcTbl.cpp
@@ -96,7 +96,7 @@
 	ActNpc037,
 	ActNpc038,
 	ActNpc039,
-	nullptr,
+	ActNpc040,
 	ActNpc041,
 	ActNpc042,
 	ActNpc043,