shithub: cstory

Download patch

ref: a5bf854408b35310569b22d294642e007d4a5782
parent: d9e01225a9036be962b781a2ab2704bb60a9d3c0
author: Clownacy <Clownacy@users.noreply.github.com>
date: Sat Jun 27 13:32:09 EDT 2020

Document gMC.equip

All raw values have been replaced with enums

--- a/src/Game.cpp
+++ b/src/Game.cpp
@@ -335,7 +335,7 @@
 #endif
 
 	g_GameFlags = 0;
-	gMC.equip |= 0x100;
+	gMC.equip |= EQUIP_NIKUMARU_COUNTER;	// Give the player the Nikumaru Counter so the timer appears on-screen
 
 	// Start loop
 	wait = 0;
@@ -617,7 +617,7 @@
 
 				gMC.cond &= ~1;
 			}
-			else if (gMC.equip & 2 && gKeyTrg & gKeyMap)
+			else if (gMC.equip & EQUIP_MAP && gKeyTrg & gKeyMap)
 			{
 				BackupSurface(SURFACE_ID_SCREEN_GRAB, &grcGame);
 
--- a/src/MyChar.cpp
+++ b/src/MyChar.cpp
@@ -217,7 +217,7 @@
 
 	// Draw player
 	RECT rect = gMC.rect;
-	if (gMC.equip & 0x40)
+	if (gMC.equip & EQUIP_MIMIGA_MASK)
 	{
 		rect.top += 32;
 		rect.bottom += 32;
@@ -232,7 +232,7 @@
 	};
 
 	++gMC.bubble;
-	if (gMC.equip & 0x10 && gMC.flag & 0x100)
+	if (gMC.equip & EQUIP_AIR_TANK && gMC.flag & 0x100)
 		PutBitmap3(&grcGame, (gMC.x / 0x200) - 12 - (fx / 0x200), (gMC.y / 0x200) - 12 - (fy / 0x200), &rcBubble[gMC.bubble / 2 % 2], SURFACE_ID_CARET);
 	else if (gMC.unit == 1)
 		PutBitmap3(&grcGame, (gMC.x / 0x200) - 12 - (fx / 0x200), (gMC.y / 0x200) - 12 - (fy / 0x200), &rcBubble[gMC.bubble / 2 % 2], SURFACE_ID_CARET);
@@ -291,11 +291,11 @@
 		// Stop boosting and refuel
 		gMC.boost_sw = 0;
 
-		if (gMC.equip & 1)
+		if (gMC.equip & EQUIP_BOOSTER_0_8)
 		{
 			gMC.boost_cnt = 50;
 		}
-		else if (gMC.equip & 0x20)
+		else if (gMC.equip & EQUIP_BOOSTER_2_0)
 		{
 			gMC.boost_cnt = 50;
 		}
@@ -354,10 +354,10 @@
 		// Start boosting
 		if (bKey)
 		{
-			if (gMC.equip & 0x21 && gKeyTrg & gKeyJump && gMC.boost_cnt != 0)
+			if (gMC.equip & (EQUIP_BOOSTER_0_8 | EQUIP_BOOSTER_2_0) && gKeyTrg & gKeyJump && gMC.boost_cnt != 0)
 			{
 				// Booster 0.8
-				if (gMC.equip & 1)
+				if (gMC.equip & EQUIP_BOOSTER_0_8)
 				{
 					gMC.boost_sw = 1;
 
@@ -366,7 +366,7 @@
 				}
 
 				// Booster 2.0
-				if (gMC.equip & 0x20)
+				if (gMC.equip & EQUIP_BOOSTER_2_0)
 				{
 					if (gKey & gKeyUp)
 					{
@@ -414,7 +414,7 @@
 		}
 
 		// Slow down when stopped boosting (Booster 2.0)
-		if (gMC.equip & 0x20 && gMC.boost_sw != 0 && (!(gKey & gKeyJump) || gMC.boost_cnt == 0))
+		if (gMC.equip & EQUIP_BOOSTER_2_0 && gMC.boost_sw != 0 && (!(gKey & gKeyJump) || gMC.boost_cnt == 0))
 		{
 			if (gMC.boost_sw == 1)
 				gMC.xm /= 2;
@@ -475,7 +475,7 @@
 		gMC.ym += 0x55;
 
 	// Booster 2.0 forces and effects
-	if (gMC.equip & 0x20 && gMC.boost_sw != 0)
+	if (gMC.equip & EQUIP_BOOSTER_2_0 && gMC.boost_sw != 0)
 	{
 		if (gMC.boost_sw == 1)
 		{
@@ -525,7 +525,7 @@
 		gMC.ym += gravity1;
 	}
 	// Booster 0.8
-	else if (gMC.equip & 1 && gMC.boost_sw != 0 && gMC.ym > -0x400)
+	else if (gMC.equip & EQUIP_BOOSTER_0_8 && gMC.boost_sw != 0 && gMC.ym > -0x400)
 	{
 		// Upwards force
 		gMC.ym -= 0x20;
@@ -809,7 +809,7 @@
 
 void AirProcess(void)
 {
-	if (gMC.equip & 0x10)
+	if (gMC.equip & EQUIP_AIR_TANK)
 	{
 		gMC.air = 1000;
 		gMC.air_get = 0;
--- a/src/MyChar.h
+++ b/src/MyChar.h
@@ -5,6 +5,20 @@
 // TODO - When I add bitmask constants for gMC.flags...
 // 0x100 is a 'player is underwater' flag
 
+// gMC.equip
+enum
+{
+	EQUIP_BOOSTER_0_8 = 1,
+	EQUIP_MAP = 2,
+	EQUIP_ARMS_BARRIER = 4,
+	EQUIP_TURBOCHARGE = 8,
+	EQUIP_AIR_TANK = 0x10,
+	EQUIP_BOOSTER_2_0 = 0x20,
+	EQUIP_MIMIGA_MASK = 0x40,
+	EQUIP_WHIMSICAL_STAR = 0x80,
+	EQUIP_NIKUMARU_COUNTER = 0x100
+};
+
 typedef struct MYCHAR
 {
 	unsigned char cond;
--- a/src/MycParam.cpp
+++ b/src/MycParam.cpp
@@ -47,7 +47,7 @@
 		{
 			gArmsData[gSelectedArms].exp = gArmsLevelTable[arms_code].exp[lv];
 
-			if (gMC.equip & 0x80)
+			if (gMC.equip & EQUIP_WHIMSICAL_STAR)
 			{
 				if (gMC.star < 3)
 					++gMC.star;
@@ -135,11 +135,11 @@
 	gMC.life -= (short)damage;
 
 	// Lose a whimsical star
-	if (gMC.equip & 0x80 && gMC.star > 0)
+	if (gMC.equip & EQUIP_WHIMSICAL_STAR && gMC.star > 0)
 		gMC.star = (short)gMC.star - 1;	// For some reason, this does a cast to short. Might not be accurate to the original source code (possibly, Pixel was just being careful about int size/conversion, or this is from some weird macro)
 
 	// Lose experience
-	if (gMC.equip & 4)
+	if (gMC.equip & EQUIP_ARMS_BARRIER)
 		gArmsData[gSelectedArms].exp -= damage;
 	else
 		gArmsData[gSelectedArms].exp -= damage * 2;
@@ -370,7 +370,7 @@
 		{112, 80, 144, 88},
 	};
 
-	if (gMC.equip & 0x10)
+	if (gMC.equip & EQUIP_AIR_TANK)
 		return;
 
 	if (gMC.air_get != 0)
@@ -397,7 +397,7 @@
 		{128, 104, 160, 112},
 	};
 
-	if (gMC.equip & 0x100)
+	if (gMC.equip & EQUIP_NIKUMARU_COUNTER)
 	{
 		// Draw clock and increase time
 		if (g_GameFlags & 2)
@@ -436,7 +436,7 @@
 	char path[MAX_PATH];
 
 	// Quit if player doesn't have the Nikumaru Counter
-	if (!(gMC.equip & 0x100))
+	if (!(gMC.equip & EQUIP_NIKUMARU_COUNTER))
 		return TRUE;
 
 	// Get last time
--- a/src/NpcAct100.cpp
+++ b/src/NpcAct100.cpp
@@ -842,7 +842,7 @@
 		npc->rect = rcRight[npc->ani_no];
 
 	// Use a different sprite if the player is wearing the Mimiga Mask
-	if (gMC.equip & 0x40)
+	if (gMC.equip & EQUIP_MIMIGA_MASK)
 	{
 		npc->rect.top += 32;
 		npc->rect.bottom += 32;
@@ -919,7 +919,7 @@
 		npc->rect = rcRight[npc->ani_no];
 
 	// Use a different sprite if the player is wearing the Mimiga Mask
-	if (gMC.equip & 0x40)
+	if (gMC.equip & EQUIP_MIMIGA_MASK)
 	{
 		npc->rect.top += 32;
 		npc->rect.bottom += 32;
--- a/src/NpcAct140.cpp
+++ b/src/NpcAct140.cpp
@@ -1277,7 +1277,7 @@
 	}
 
 	// Use a different sprite if the player is wearing the Mimiga Mask
-	if (gMC.equip & 0x40)
+	if (gMC.equip & EQUIP_MIMIGA_MASK)
 	{
 		npc->rect.top += 32;
 		npc->rect.bottom += 32;
--- a/src/NpcAct200.cpp
+++ b/src/NpcAct200.cpp
@@ -999,7 +999,7 @@
 	npc->rect = rcRight[npc->ani_no];
 
 	// Use different sprite if player is wearing the Mimiga Mask
-	if (gMC.equip & 0x40)
+	if (gMC.equip & EQUIP_MIMIGA_MASK)
 	{
 		if (npc->ani_no > 1)
 		{
--- a/src/NpcAct280.cpp
+++ b/src/NpcAct280.cpp
@@ -443,7 +443,7 @@
 			else
 				npc->ani_no = 5;
 
-			if (gMC.equip & 0x20)
+			if (gMC.equip & EQUIP_BOOSTER_2_0)
 			{
 				if (npc->act_wait % 10 == 1)
 				{
@@ -1436,7 +1436,7 @@
 		case 1:
 			++npc->act_wait;
 
-			if (gMC.equip & 0x20)
+			if (gMC.equip & EQUIP_BOOSTER_2_0)
 			{
 				npc->x = gMC.x + (64 * 0x200);
 
@@ -1456,7 +1456,7 @@
 
 			if (npc->act_wait > 24)
 			{
-				if (gMC.equip & 0x20)
+				if (gMC.equip & EQUIP_BOOSTER_2_0)
 					x = npc->x + (Random(-14, 14) * 0x200 * 0x10);
 				else
 					x = npc->x + (Random(-11, 11) * 0x200 * 0x10);
--- a/src/Shoot.cpp
+++ b/src/Shoot.cpp
@@ -357,7 +357,7 @@
 	{
 		++wait;
 
-		if (gMC.equip & 8)
+		if (gMC.equip & EQUIP_TURBOCHARGE)
 		{
 			if (wait > 1)
 			{
@@ -915,7 +915,7 @@
 
 	if (gKey & gKeyShot)
 	{
-		if (gMC.equip & 8)
+		if (gMC.equip & EQUIP_TURBOCHARGE)
 			AddExpMyChar(3);
 		else
 			AddExpMyChar(2);
--- a/src/Star.cpp
+++ b/src/Star.cpp
@@ -112,7 +112,7 @@
 		star[i].x += star[i].xm;
 		star[i].y += star[i].ym;
 
-		if (i < gMC.star && (gMC.equip & 0x80) && (g_GameFlags & 2) && a == i)
+		if (i < gMC.star && (gMC.equip & EQUIP_WHIMSICAL_STAR) && (g_GameFlags & 2) && a == i)
 			SetBullet(45, star[a].x, star[a].y, 0);
 	}
 }
@@ -130,7 +130,7 @@
 	if (gMC.cond & 2)
 		return;
 
-	if (!(gMC.equip & 0x80))
+	if (!(gMC.equip & EQUIP_WHIMSICAL_STAR))
 		return;
 
 	for (i = 0; i < 3; ++i)