shithub: cstory

Download patch

ref: a6f65f66a6b6384138b655d6a6ad2dc915d59efe
parent: c04092df89cd28cee2240cf75355ae664bed0661
author: cuckydev <cuckydev@users.noreply.github.com>
date: Sat Jan 26 05:47:12 EST 2019

added npc 006, and uhhhhhhhhhhh changed gitignore idkidkidk

--- a/.gitignore
+++ b/.gitignore
@@ -5,6 +5,8 @@
 /obj
 Config.dat
 Profile.dat
+build.7z
+build.zip
 
 # Compiled Object files
 *.slo
--- a/src/NpcAct.h
+++ b/src/NpcAct.h
@@ -5,3 +5,4 @@
 void ActNpc003(NPCHAR *npc);
 void ActNpc004(NPCHAR *npc);
 void ActNpc005(NPCHAR *npc);
+void ActNpc006(NPCHAR *npc);
--- a/src/NpcAct000.cpp
+++ b/src/NpcAct000.cpp
@@ -483,4 +483,130 @@
 		npc->rect = rcRight[npc->ani_no];
 	else
 		npc->rect = rcLeft[npc->ani_no];
-}
\ No newline at end of file
+}
+
+//Beetle (Goes left and right, Egg Corridor)
+void ActNpc006(NPCHAR *npc)
+{
+	RECT rcLeft[5];
+	RECT rcRight[5];
+	
+	rcLeft[0] = {0, 80, 16, 96};
+	rcLeft[1] = {16, 80, 32, 96};
+	rcLeft[2] = {32, 80, 48, 96};
+	rcLeft[3] = {48, 80, 64, 96};
+	rcLeft[4] = {64, 80, 80, 96};
+	
+	rcRight[0] = {0, 96, 16, 112};
+	rcRight[1] = {16, 96, 32, 112};
+	rcRight[2] = {32, 96, 48, 112};
+	rcRight[3] = {48, 96, 64, 112};
+	rcRight[4] = {64, 96, 80, 112};
+	
+	switch (npc->act_no)
+	{
+		case 0: //Init
+			npc->act_no = 1;
+			
+			if (npc->direct)
+				npc->act_no = 3;
+			else
+				npc->act_no = 1;
+			break;
+		
+		case 1:
+			//Accelerate to the left
+			npc->xm -= 0x10;
+			if (npc->xm < -0x400)
+				npc->xm = -0x400;
+			
+			//Move
+			if (npc->shock)
+				npc->x += npc->xm / 2;
+			else
+				npc->x += npc->xm;
+			
+			//Animate
+			if (++npc->ani_wait > 1)
+			{
+				npc->ani_wait = 0;
+				++npc->ani_no;
+			}
+			
+			if ( npc->ani_no > 2 )
+				npc->ani_no = 1;
+			
+			//Stop when hitting a wall
+			if (npc->flag & 1)
+			{
+				npc->act_no = 2;
+				npc->act_wait = 0;
+				npc->ani_no = 0;
+				npc->xm = 0;
+				npc->direct = 2;
+			}
+			break;
+			
+		case 2:
+			//Wait 60 frames then move to the right
+			if (++npc->act_wait > 60)
+			{
+				npc->act_no = 3;
+				npc->ani_wait = 0;
+				npc->ani_no = 1;
+			}
+			break;
+			
+		case 3:
+			//Accelerate to the right
+			npc->xm += 0x10;
+			if (npc->xm > 0x400)
+				npc->xm = 0x400;
+			
+			//Move
+			if (npc->shock)
+				npc->x += npc->xm / 2;
+			else
+				npc->x += npc->xm;
+			
+			//Animate
+			if (++npc->ani_wait > 1)
+			{
+				npc->ani_wait = 0;
+				++npc->ani_no;
+			}
+			
+			if ( npc->ani_no > 2 )
+				npc->ani_no = 1;
+			
+			//Stop when hitting a wall
+			if (npc->flag & 4)
+			{
+				npc->act_no = 4;
+				npc->act_wait = 0;
+				npc->ani_no = 0;
+				npc->xm = 0;
+				npc->direct = 0;
+			}
+			break;
+		
+		case 4:
+			//Wait 60 frames then move to the left
+			if (++npc->act_wait > 60)
+			{
+				npc->act_no = 1;
+				npc->ani_wait = 0;
+				npc->ani_no = 1;
+			}
+			break;
+			
+		default:
+			break;
+	}
+	
+	//Set framerect
+	if (npc->direct)
+		npc->rect = rcRight[npc->ani_no];
+	else
+		npc->rect = rcLeft[npc->ani_no];
+}
--- a/src/NpcTbl.cpp
+++ b/src/NpcTbl.cpp
@@ -62,7 +62,7 @@
 	&ActNpc003,
 	&ActNpc004,
 	&ActNpc005,
-	nullptr,
+	&ActNpc006,
 	nullptr,
 	nullptr,
 	nullptr,