shithub: cstory

Download patch

ref: 528f77538790d8e66f691582e65fda3b5049f03c
parent: 91a7c0185c593d0059d5b68c59b54b4df8cad606
author: Clownacy <Clownacy@users.noreply.github.com>
date: Tue Feb 5 07:28:58 EST 2019

Completed Curly boss fight

--- a/src/NpcAct.h
+++ b/src/NpcAct.h
@@ -114,8 +114,12 @@
 void ActNpc115(NPCHAR *npc);
 void ActNpc116(NPCHAR *npc);
 void ActNpc117(NPCHAR *npc);
-
+void ActNpc118(NPCHAR *npc);
 void ActNpc119(NPCHAR *npc);
+void ActNpc120(NPCHAR *npc);
+void ActNpc121(NPCHAR *npc);
+void ActNpc122(NPCHAR *npc);
+void ActNpc123(NPCHAR *npc);
 
 void ActNpc125(NPCHAR *npc);
 
--- a/src/NpcAct100.cpp
+++ b/src/NpcAct100.cpp
@@ -10,6 +10,7 @@
 #include "Triangle.h"
 #include "Frame.h"
 #include "Caret.h"
+#include "Bullet.h"
 
 //Grate
 void ActNpc100(NPCHAR *npc)
@@ -1451,6 +1452,206 @@
 
 	npc->x += npc->xm;
 	npc->y += npc->ym;
+
+	if (npc->direct == 0)
+		npc->rect = rcLeft[npc->ani_no];
+	else
+		npc->rect = rcRight[npc->ani_no];
+}
+
+//Curly (boss)
+void ActNpc118(NPCHAR *npc)
+{
+	RECT rcLeft[9];
+	RECT rcRight[9];
+
+	rcLeft[0] = {0, 32, 32, 56};
+	rcLeft[1] = {32, 32, 64, 56};
+	rcLeft[2] = {64, 32, 96, 56};
+	rcLeft[3] = {96, 32, 128, 56};
+	rcLeft[4] = {0, 32, 32, 56};
+	rcLeft[5] = {128, 32, 160, 56};
+	rcLeft[6] = {0, 32, 32, 56};
+	rcLeft[7] = {0, 32, 32, 56};
+	rcLeft[8] = {160, 32, 192, 56};
+
+	rcRight[0] = {0, 56, 32, 80};
+	rcRight[1] = {32, 56, 64, 80};
+	rcRight[2] = {64, 56, 96, 80};
+	rcRight[3] = {96, 56, 128, 80};
+	rcRight[4] = {0, 56, 32, 80};
+	rcRight[5] = {128, 56, 160, 80};
+	rcRight[6] = {0, 56, 32, 80};
+	rcRight[7] = {0, 56, 32, 80};
+	rcRight[8] = {160, 56, 192, 80};
+
+	bool bUpper = false;
+
+	if (npc->direct == 0 && gMC.x > npc->x)
+		bUpper = true;
+	if ( npc->direct == 2 && gMC.x < npc->x)
+		bUpper = true;
+
+	switch (npc->act_no)
+	{
+		case 0:
+			npc->act_no = 1;
+			npc->ani_no = 0;
+			npc->ani_wait = 0;
+			break;
+
+		case 10:
+			npc->act_no = 11;
+			npc->act_wait = Random(50, 100);
+			npc->ani_no = 0;
+
+			if (gMC.x < npc->x)
+				npc->direct = 0;
+			else
+				npc->direct = 2;
+
+			npc->bits |= 0x20u;
+			npc->bits &= ~4u;
+			// Fallthrough
+		case 11:
+			if (npc->act_wait)
+				--npc->act_wait;
+			else
+				npc->act_no = 13;
+
+			break;
+
+		case 13:
+			npc->act_no = 14;
+			npc->ani_no = 3;
+			npc->act_wait = Random(50, 100);
+
+			if (gMC.x < npc->x)
+				npc->direct = 0;
+			else
+				npc->direct = 2;
+			// Fallthrough
+		case 14:
+			if (++npc->ani_wait > 2)
+			{
+				npc->ani_wait = 0;
+				++npc->ani_no;
+			}
+
+			if (npc->ani_no > 6)
+				npc->ani_no = 3;
+
+			if (npc->direct == 0)
+				npc->xm -= 0x40;
+			else
+				npc->xm += 0x40;
+
+			if (npc->act_wait)
+			{
+				--npc->act_wait;
+			}
+			else
+			{
+				npc->bits |= 0x20u;
+				npc->act_no = 20;
+				npc->act_wait = 0;
+				PlaySoundObject(103, 1);
+			}
+
+			break;
+
+		case 20:
+			if (gMC.x < npc->x)
+				npc->direct = 0;
+			else
+				npc->direct = 2;
+
+			npc->xm = 8 * npc->xm / 9;
+
+			if (++npc->ani_no > 1)
+				npc->ani_no = 0;
+
+			if (++npc->act_wait > 50)
+			{
+				npc->act_no = 21;
+				npc->act_wait = 0;
+			}
+
+			break;
+
+		case 21:
+			if (++npc->act_wait % 4 == 1)
+			{
+				if (npc->direct == 0)
+				{
+					if (bUpper)
+					{
+						npc->ani_no = 2;
+						SetNpChar(123, npc->x, npc->y - 0x1000, 0, 0, 1, 0, 0x100);
+					}
+					else
+					{
+						npc->ani_no = 0;
+						SetNpChar(123, npc->x - 0x1000, npc->y + 0x800, 0, 0, 0, 0, 0x100);
+						npc->x += 0x200;
+					}
+				}
+				else
+				{
+					if (bUpper)
+					{
+						npc->ani_no = 2;
+						SetNpChar(123, npc->x, npc->y - 0x1000, 0, 0, 1, 0, 0x100);
+					}
+					else
+					{
+						npc->ani_no = 0;
+						SetNpChar(123, npc->x + 0x1000, npc->y + 0x800, 0, 0, 2, 0, 0x100);
+						npc->x -= 0x200;
+					}
+				}
+			}
+
+			if (npc->act_wait > 30)
+				npc->act_no = 10;
+
+			break;
+
+		case 30:
+			if (++npc->ani_no > 8)
+				npc->ani_no = 7;
+
+			if (++npc->act_wait > 30)
+			{
+				npc->act_no = 10;
+				npc->ani_no = 0;
+			}
+
+			break;
+	}
+
+	if (npc->act_no > 10 && npc->act_no < 30 && CountArmsBullet(6))
+	{
+		npc->act_wait = 0;
+		npc->act_no = 30;
+		npc->ani_no = 7;
+		npc->bits &= ~0x20;
+		npc->bits |= 4;
+		npc->xm = 0;
+	}
+
+	npc->ym += 0x20;
+
+	if (npc->xm > 0x1FF)
+		npc->xm = 0x1FF;
+	if (npc->xm < -0x1FF)
+		npc->xm = -0x1FF;
+
+	if (npc->ym > 0x5FF)
+		npc->ym = 0x5FF;
+
+	npc->y += npc->ym;
+	npc->x += npc->xm;
 
 	if (npc->direct == 0)
 		npc->rect = rcLeft[npc->ani_no];
--- a/src/NpcAct120.cpp
+++ b/src/NpcAct120.cpp
@@ -8,6 +8,336 @@
 #include "Sound.h"
 #include "Back.h"
 #include "Triangle.h"
+#include "Caret.h"
+
+//Colon (1)
+void ActNpc120(NPCHAR *npc)
+{
+	RECT rect[2];
+
+	rect[0] = {64, 0, 80, 16};
+	rect[1] = {64, 16, 80, 32};
+
+	if (npc->direct == 0)
+		npc->rect = rect[0];
+	else
+		npc->rect = rect[1];
+}
+
+//Colon (2)
+void ActNpc121(NPCHAR *npc)
+{
+	RECT rect[3];
+
+	rect[0] = {0, 0, 16, 16};
+	rect[1] = {16, 0, 32, 16};
+	rect[2] = {112, 0, 128, 16};
+
+	if (npc->direct == 0)
+	{
+		switch (npc->act_no)
+		{
+			case 0:
+				npc->act_no = 1;
+				npc->ani_no = 0;
+				npc->ani_wait = 0;
+				// Fallthrough
+			case 1:
+				if (Random(0, 120) == 10)
+				{
+					npc->act_no = 2;
+					npc->act_wait = 0;
+					npc->ani_no = 1;
+				}
+				break;
+
+			case 2:
+				if (++npc->act_wait > 8)
+				{
+					npc->act_no = 1;
+					npc->ani_no = 0;
+				}
+
+				break;
+		}
+
+		npc->rect = rect[npc->ani_no];
+	}
+
+	npc->rect = rect[2];
+
+	if (++npc->act_wait > 100)
+	{
+		npc->act_wait = 0;
+		SetCaret(npc->x, npc->y, 5, 0);
+	}
+}
+
+//Colon (attacking)
+void ActNpc122(NPCHAR *npc)
+{
+	RECT rcLeft[10];
+	RECT rcRight[10];
+
+	rcLeft[0] = {0, 0, 16, 16};
+	rcLeft[1] = {16, 0, 32, 16};
+	rcLeft[2] = {32, 0, 48, 16};
+	rcLeft[3] = {0, 0, 16, 16};
+	rcLeft[4] = {48, 0, 64, 16};
+	rcLeft[5] = {0, 0, 16, 16};
+	rcLeft[6] = {80, 0, 96, 16};
+	rcLeft[7] = {96, 0, 112, 16};
+	rcLeft[8] = {112, 0, 128, 16};
+	rcLeft[9] = {128, 0, 144, 16};
+
+	rcRight[0] = {0, 16, 16, 32};
+	rcRight[1] = {16, 16, 32, 32};
+	rcRight[2] = {32, 16, 48, 32};
+	rcRight[3] = {0, 16, 16, 32};
+	rcRight[4] = {48, 16, 64, 32};
+	rcRight[5] = {0, 16, 16, 32};
+	rcRight[6] = {80, 16, 96, 32};
+	rcRight[7] = {96, 16, 112, 32};
+	rcRight[8] = {112, 16, 128, 32};
+	rcRight[9] = {128, 16, 144, 32};
+
+	switch (npc->act_no)
+	{
+		case 0:
+			npc->act_no = 1;
+			npc->ani_no = 0;
+			npc->ani_wait = 0;
+			// Fallthrough
+		case 1:
+			if (Random(0, 120) == 10)
+			{
+				npc->act_no = 2;
+				npc->act_wait = 0;
+				npc->ani_no = 1;
+			}
+
+			if (gMC.x > npc->x - 0x4000 && gMC.x < npc->x + 0x4000 && gMC.y > npc->y - 0x4000 && gMC.y < npc->y + 0x2000)
+			{
+				if (gMC.x < npc->x)
+					npc->direct = 0;
+				else
+					npc->direct = 2;
+			}
+
+			break;
+
+		case 2:
+			if (++npc->act_wait > 8)
+			{
+				npc->act_no = 1;
+				npc->ani_no = 0;
+			}
+
+			break;
+
+		case 10:
+			npc->life = 1000;
+			npc->act_no = 11;
+			npc->act_wait = Random(0, 50);
+			npc->ani_no = 0;
+			npc->damage = 0;
+			// Fallthrough
+		case 11:
+			if (npc->act_wait)
+				--npc->act_wait;
+			else
+				npc->act_no = 13;
+
+			break;
+
+		case 13:
+			npc->act_no = 14;
+			npc->act_wait = Random(0, 50);
+
+			if (gMC.x < npc->x)
+				npc->direct = 0;
+			else
+				npc->direct = 2;
+			// Fallthrough
+		case 14:
+			if (++npc->ani_wait > 2)
+			{
+				npc->ani_wait = 0;
+				++npc->ani_no;
+			}
+
+			if (npc->ani_no > 5)
+				npc->ani_no = 2;
+
+			if (npc->direct == 0)
+				npc->xm -= 0x40;
+			else
+				npc->xm += 0x40;
+
+			if (npc->act_wait)
+			{
+				--npc->act_wait;
+			}
+			else
+			{
+				npc->bits |= 0x20;
+				npc->act_no = 15;
+				npc->ani_no = 2;
+				npc->ym = -0x200;
+				npc->damage = 2;
+			}
+
+			break;
+
+		case 15:
+			if (npc->flag & 8)
+			{
+				npc->bits |= 0x20;
+				npc->xm = 0;
+				npc->act_no = 10;
+				npc->damage = 0;
+			}
+
+			break;
+
+		case 20:
+			if (npc->flag & 8)
+			{
+				npc->xm = 0;
+				npc->act_no = 21;
+				npc->damage = 0;
+
+				if (npc->ani_no == 6)
+					npc->ani_no = 8;
+				else
+					npc->ani_no = 9;
+
+				npc->act_wait = Random(300, 400);
+			}
+
+			break;
+
+		case 21:
+			if (npc->act_wait)
+			{
+				--npc->act_wait;
+			}
+			else
+			{
+				npc->bits |= 0x20;
+				npc->life = 1000;
+				npc->act_no = 11;
+				npc->act_wait = Random(0, 50);
+				npc->ani_no = 0;
+			}
+
+			break;
+	}
+
+	if (npc->act_no > 10 && npc->act_no < 20 && npc->life != 1000)
+	{
+		npc->act_no = 20;
+		npc->ym = -0x200;
+		npc->ani_no = Random(6, 7);
+		npc->bits &= ~0x20;
+	}
+
+	npc->ym += 0x20;
+
+	if (npc->xm > 0x1FF)
+		npc->xm = 0x1FF;
+	if (npc->xm < -0x1FF)
+		npc->xm = -0x1FF;
+
+	if (npc->ym > 0x5FF )
+		npc->ym = 0x5FF;
+
+	npc->y += npc->ym;
+	npc->x += npc->xm;
+
+	if (npc->direct == 0)
+		npc->rect = rcLeft[npc->ani_no];
+	else
+		npc->rect = rcRight[npc->ani_no];
+}
+
+//Curly boss projectile
+void ActNpc123(NPCHAR *npc)
+{
+	RECT rect[4];
+
+	rect[0] = {192, 0, 208, 16};
+	rect[1] = {208, 0, 224, 16};
+	rect[2] = {224, 0, 240, 16};
+	rect[3] = {240, 0, 256, 16};
+
+	bool bBreak = false;
+
+	switch (npc->act_no)
+	{
+		case 0:
+			npc->act_no = 1;
+			SetCaret(npc->x, npc->y, 3, 0);
+			PlaySoundObject(32, 1);
+
+			switch (npc->direct)
+			{
+				case 0:
+					npc->xm = -0x1000;
+					npc->ym = Random(-0x80, 0x80);
+					break;
+				case 1:
+					npc->ym = -0x1000;
+					npc->xm = Random(-0x80, 0x80);
+					break;
+				case 2:
+					npc->xm = 0x1000;
+					npc->ym = Random(-0x80, 0x80);
+					break;
+				case 3:
+					npc->ym = 0x1000;
+					npc->xm = Random(-0x80, 0x80);
+					break;
+			}
+
+			break;
+
+		case 1:
+			switch (npc->direct)
+			{
+				case 0:
+					if (npc->flag & 1)
+						bBreak = true;
+					break;
+				case 1:
+					if (npc->flag & 2)
+						bBreak = true;
+					break;
+				case 2:
+					if (npc->flag & 4)
+						bBreak = true;
+					break;
+				case 3:
+					if (npc->flag & 8)
+						bBreak = true;
+					break;
+			}
+
+			npc->x += npc->xm;
+			npc->y += npc->ym;
+
+			break;
+	}
+
+	if (bBreak)
+	{
+		SetCaret(npc->x, npc->y, 2, 2);
+		PlaySoundObject(28, 1);
+		npc->cond = 0;
+	}
+
+	npc->rect = rect[npc->direct];
+}
 
 //Hidden item
 void ActNpc125(NPCHAR *npc)
--- a/src/NpcTbl.cpp
+++ b/src/NpcTbl.cpp
@@ -174,12 +174,12 @@
 	ActNpc115,
 	ActNpc116,
 	ActNpc117,
-	nullptr,
+	ActNpc118,
 	ActNpc119,
-	nullptr,
-	nullptr,
-	nullptr,
-	nullptr,
+	ActNpc120,
+	ActNpc121,
+	ActNpc122,
+	ActNpc123,
 	nullptr,
 	ActNpc125,
 	nullptr,