Document gMC.equip

All raw values have been replaced with enums
This commit is contained in:
Clownacy 2020-06-27 17:32:09 +01:00
parent d9e01225a9
commit a5bf854408
10 changed files with 44 additions and 30 deletions

View file

@ -335,7 +335,7 @@ static int ModeTitle(HWND hWnd)
#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 @@ static int ModeAction(HWND hWnd)
gMC.cond &= ~1;
}
else if (gMC.equip & 2 && gKeyTrg & gKeyMap)
else if (gMC.equip & EQUIP_MAP && gKeyTrg & gKeyMap)
{
BackupSurface(SURFACE_ID_SCREEN_GRAB, &grcGame);

View file

@ -217,7 +217,7 @@ void PutMyChar(int fx, int fy)
// 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 @@ void PutMyChar(int fx, int fy)
};
++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 @@ void ActMyChar_Normal(BOOL bKey)
// 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 @@ void ActMyChar_Normal(BOOL bKey)
// 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 @@ void ActMyChar_Normal(BOOL bKey)
}
// Booster 2.0
if (gMC.equip & 0x20)
if (gMC.equip & EQUIP_BOOSTER_2_0)
{
if (gKey & gKeyUp)
{
@ -414,7 +414,7 @@ void ActMyChar_Normal(BOOL bKey)
}
// 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 @@ void ActMyChar_Normal(BOOL bKey)
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 @@ void ActMyChar_Normal(BOOL bKey)
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 ActMyChar_Stream(BOOL bKey)
void AirProcess(void)
{
if (gMC.equip & 0x10)
if (gMC.equip & EQUIP_AIR_TANK)
{
gMC.air = 1000;
gMC.air_get = 0;

View file

@ -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;

View file

@ -47,7 +47,7 @@ void AddExpMyChar(int x)
{
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 @@ void DamageMyChar(int damage)
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 @@ void PutMyAir(int x, int y)
{112, 80, 144, 88},
};
if (gMC.equip & 0x10)
if (gMC.equip & EQUIP_AIR_TANK)
return;
if (gMC.air_get != 0)
@ -397,7 +397,7 @@ void PutTimeCounter(int x, int y)
{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 @@ BOOL SaveTimeCounter(void)
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

View file

@ -842,7 +842,7 @@ void ActNpc111(NPCHAR *npc)
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 @@ void ActNpc112(NPCHAR *npc)
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;

View file

@ -1277,7 +1277,7 @@ void ActNpc150(NPCHAR *npc)
}
// 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;

View file

@ -999,7 +999,7 @@ void ActNpc212(NPCHAR *npc)
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)
{

View file

@ -443,7 +443,7 @@ void ActNpc283(NPCHAR *npc)
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 @@ void ActNpc294(NPCHAR *npc)
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 @@ void ActNpc294(NPCHAR *npc)
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);

View file

@ -357,7 +357,7 @@ void ShootBullet_Machinegun1(int level)
{
++wait;
if (gMC.equip & 8)
if (gMC.equip & EQUIP_TURBOCHARGE)
{
if (wait > 1)
{
@ -915,7 +915,7 @@ void ShootBullet_Spur(int level)
if (gKey & gKeyShot)
{
if (gMC.equip & 8)
if (gMC.equip & EQUIP_TURBOCHARGE)
AddExpMyChar(3);
else
AddExpMyChar(2);

View file

@ -112,7 +112,7 @@ void ActStar(void)
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 @@ void PutStar(int fx, int fy)
if (gMC.cond & 2)
return;
if (!(gMC.equip & 0x80))
if (!(gMC.equip & EQUIP_WHIMSICAL_STAR))
return;
for (i = 0; i < 3; ++i)