Weed out some usage of C++ bools

Pixel used BOOL, the C89-friendly Windows-specific equivalent
This commit is contained in:
Clownacy 2019-05-14 01:35:04 +01:00
parent 9de26337dc
commit 00ca00f5dd
6 changed files with 41 additions and 39 deletions

View file

@ -324,13 +324,13 @@ void PutCampObject()
PutBitmap3(&rcView, 40 * i + (WINDOW_WIDTH - 224) / 2, (WINDOW_HEIGHT - 192) / 2, &rcArms, SURFACE_ID_ARMS_IMAGE); PutBitmap3(&rcView, 40 * i + (WINDOW_WIDTH - 224) / 2, (WINDOW_HEIGHT - 192) / 2, &rcArms, SURFACE_ID_ARMS_IMAGE);
PutBitmap3(&rcView, 40 * i + (WINDOW_WIDTH - 224) / 2, (WINDOW_HEIGHT - 128) / 2, &rcPer, SURFACE_ID_TEXT_BOX); PutBitmap3(&rcView, 40 * i + (WINDOW_WIDTH - 224) / 2, (WINDOW_HEIGHT - 128) / 2, &rcPer, SURFACE_ID_TEXT_BOX);
PutBitmap3(&rcView, 40 * i + (WINDOW_WIDTH - 224) / 2, (WINDOW_HEIGHT - 160) / 2, &rcLv, SURFACE_ID_TEXT_BOX); PutBitmap3(&rcView, 40 * i + (WINDOW_WIDTH - 224) / 2, (WINDOW_HEIGHT - 160) / 2, &rcLv, SURFACE_ID_TEXT_BOX);
PutNumber4(40 * i + (WINDOW_WIDTH - 224) / 2, (WINDOW_HEIGHT - 160) / 2, gArmsData[i].level, 0); PutNumber4(40 * i + (WINDOW_WIDTH - 224) / 2, (WINDOW_HEIGHT - 160) / 2, gArmsData[i].level, FALSE);
// Draw ammo // Draw ammo
if (gArmsData[i].max_num) if (gArmsData[i].max_num)
{ {
PutNumber4(40 * i + (WINDOW_WIDTH - 224) / 2, (WINDOW_HEIGHT - 144) / 2, gArmsData[i].num, 0); PutNumber4(40 * i + (WINDOW_WIDTH - 224) / 2, (WINDOW_HEIGHT - 144) / 2, gArmsData[i].num, FALSE);
PutNumber4(40 * i + (WINDOW_WIDTH - 224) / 2, (WINDOW_HEIGHT - 128) / 2, gArmsData[i].max_num, 0); PutNumber4(40 * i + (WINDOW_WIDTH - 224) / 2, (WINDOW_HEIGHT - 128) / 2, gArmsData[i].max_num, FALSE);
} }
else else
{ {

View file

@ -56,7 +56,7 @@ int Random(int min, int max)
return min + rep_rand() % (max - min + 1); return min + rep_rand() % (max - min + 1);
} }
void PutNumber4(int x, int y, int value, bool bZero) void PutNumber4(int x, int y, int value, BOOL bZero)
{ {
// Define rects // Define rects
RECT rcClient = grcFull; RECT rcClient = grcFull;
@ -189,7 +189,7 @@ int ModeOpening()
if (tscRet == 2) if (tscRet == 2)
return 1; return 1;
PutMapName(false); PutMapName(FALSE);
PutTextScript(); PutTextScript();
PutFramePerSecound(); PutFramePerSecound();
@ -317,7 +317,7 @@ int ModeTitle()
// Start loop // Start loop
unsigned int wait = 0; unsigned int wait = 0;
while (true) while (1)
{ {
// Don't accept selection for 10 frames // Don't accept selection for 10 frames
if (wait < 10) if (wait < 10)
@ -365,10 +365,10 @@ int ModeTitle()
int v1, v2, v3, v4; int v1, v2, v3, v4;
GetCompileVersion(&v1, &v2, &v3, &v4); GetCompileVersion(&v1, &v2, &v3, &v4);
PutNumber4((WINDOW_WIDTH - 40) / 2, WINDOW_HEIGHT - 24, v1, 0); PutNumber4((WINDOW_WIDTH - 40) / 2, WINDOW_HEIGHT - 24, v1, FALSE);
PutNumber4((WINDOW_WIDTH - 8) / 2, WINDOW_HEIGHT - 24, v2, 0); PutNumber4((WINDOW_WIDTH - 8) / 2, WINDOW_HEIGHT - 24, v2, FALSE);
PutNumber4((WINDOW_WIDTH + 24) / 2, WINDOW_HEIGHT - 24, v3, 0); PutNumber4((WINDOW_WIDTH + 24) / 2, WINDOW_HEIGHT - 24, v3, FALSE);
PutNumber4((WINDOW_WIDTH + 56) / 2, WINDOW_HEIGHT - 24, v4, 0); PutNumber4((WINDOW_WIDTH + 56) / 2, WINDOW_HEIGHT - 24, v4, FALSE);
// Draw main title // Draw main title
PutBitmap3(&grcGame, (WINDOW_WIDTH - 144) / 2, 40, &rcTitle, SURFACE_ID_TITLE); PutBitmap3(&grcGame, (WINDOW_WIDTH - 144) / 2, 40, &rcTitle, SURFACE_ID_TITLE);
@ -447,7 +447,7 @@ int ModeAction()
unsigned long color = GetCortBoxColor(RGB(0, 0, 0x20)); unsigned long color = GetCortBoxColor(RGB(0, 0, 0x20));
bool swPlay = true; unsigned int swPlay = 1;
// Reset stuff // Reset stuff
gCounter = 0; gCounter = 0;
@ -471,7 +471,7 @@ int ModeAction()
if ((bContinue && LoadProfile(NULL)) || InitializeGame()) if ((bContinue && LoadProfile(NULL)) || InitializeGame())
{ {
while (true) while (1)
{ {
// Get pressed keys // Get pressed keys
GetTrg(); GetTrg();
@ -486,12 +486,12 @@ int ModeAction()
return 1; return 1;
} }
if (swPlay & 1 && g_GameFlags & 1) if (swPlay % 2 && g_GameFlags & 1)
{ {
if (g_GameFlags & 2) if (g_GameFlags & 2)
ActMyChar(true); ActMyChar(TRUE);
else else
ActMyChar(false); ActMyChar(FALSE);
ActStar(); ActStar();
ActNpChar(); ActNpChar();
@ -515,9 +515,9 @@ int ModeAction()
ActFlash(frame_x, frame_y); ActFlash(frame_x, frame_y);
if (g_GameFlags & 2) if (g_GameFlags & 2)
AnimationMyChar(true); AnimationMyChar(TRUE);
else else
AnimationMyChar(false); AnimationMyChar(FALSE);
} }
if (g_GameFlags & 8) if (g_GameFlags & 8)
@ -585,7 +585,7 @@ int ModeAction()
RotationArmsRev(); RotationArmsRev();
} }
if (swPlay & 1) if (swPlay % 2)
{ {
int tscRet = TextScriptProc(); int tscRet = TextScriptProc();
if (tscRet == 0) if (tscRet == 0)
@ -594,13 +594,13 @@ int ModeAction()
return 1; return 1;
} }
PutMapName(false); PutMapName(FALSE);
PutTimeCounter(16, 8); PutTimeCounter(16, 8);
if (g_GameFlags & 2) if (g_GameFlags & 2)
{ {
PutMyLife(true); PutMyLife(TRUE);
PutArmsEnergy(true); PutArmsEnergy(TRUE);
PutMyAir((WINDOW_WIDTH - 80) / 2, (WINDOW_HEIGHT - 32) / 2); PutMyAir((WINDOW_WIDTH - 80) / 2, (WINDOW_HEIGHT - 32) / 2);
PutActiveArmsList(); PutActiveArmsList();
} }
@ -623,7 +623,7 @@ int ModeAction()
return 0; return 0;
} }
bool Game() BOOL Game()
{ {
if (LoadGenericData()) if (LoadGenericData())
{ {
@ -655,9 +655,9 @@ bool Game()
} }
else else
{ {
return false; return FALSE;
} }
} }
return true; return TRUE;
} }

View file

@ -1,9 +1,11 @@
#pragma once #pragma once
#include "WindowsWrapper.h"
extern int g_GameFlags; extern int g_GameFlags;
extern int gCounter; extern int gCounter;
int Random(int min, int max); int Random(int min, int max);
void PutNumber4(int x, int y, int value, bool bZero); void PutNumber4(int x, int y, int value, BOOL bZero);
bool Game(); BOOL Game();

View file

@ -62,7 +62,7 @@ void rep_srand(unsigned int seed)
void PutFramePerSecound() void PutFramePerSecound()
{ {
if (bFps) if (bFps)
PutNumber4(WINDOW_WIDTH - 40, 8, GetFramePerSecound(), false); PutNumber4(WINDOW_WIDTH - 40, 8, GetFramePerSecound(), FALSE);
} }
int GetFramePerSecound() int GetFramePerSecound()

View file

@ -111,7 +111,7 @@ int MiniMapLoop()
rcView.top = (WINDOW_HEIGHT / 2) - gMap.length * f / 8 / 2; rcView.top = (WINDOW_HEIGHT / 2) - gMap.length * f / 8 / 2;
rcView.bottom = (WINDOW_HEIGHT / 2) + gMap.length * f / 8 / 2; rcView.bottom = (WINDOW_HEIGHT / 2) + gMap.length * f / 8 / 2;
PutMapName(true); PutMapName(TRUE);
CortBox(&rcView, 0); CortBox(&rcView, 0);
PutFramePerSecound(); PutFramePerSecound();
@ -130,7 +130,7 @@ int MiniMapLoop()
line = 0; line = 0;
my_wait = 0; my_wait = 0;
while (true) while (1)
{ {
GetTrg(); GetTrg();
@ -164,7 +164,7 @@ int MiniMapLoop()
PutBitmap3(&grcGame, rcView.left + 1, rcView.top + 1, &rcMiniMap, SURFACE_ID_MAP); PutBitmap3(&grcGame, rcView.left + 1, rcView.top + 1, &rcMiniMap, SURFACE_ID_MAP);
PutMapName(true); PutMapName(TRUE);
if (++my_wait / 8 % 2) if (++my_wait / 8 % 2)
PutBitmap3(&grcGame, my_x + rcView.left + 1, my_y + rcView.top + 1, &my_rect, SURFACE_ID_TEXT_BOX); PutBitmap3(&grcGame, my_x + rcView.left + 1, my_y + rcView.top + 1, &my_rect, SURFACE_ID_TEXT_BOX);
@ -196,7 +196,7 @@ int MiniMapLoop()
rcView.top = (WINDOW_HEIGHT / 2) - gMap.length * f / 8 / 2; rcView.top = (WINDOW_HEIGHT / 2) - gMap.length * f / 8 / 2;
rcView.bottom = (WINDOW_HEIGHT / 2) + gMap.length * f / 8 / 2; rcView.bottom = (WINDOW_HEIGHT / 2) + gMap.length * f / 8 / 2;
PutMapName(true); PutMapName(TRUE);
CortBox(&rcView, 0); CortBox(&rcView, 0);
PutFramePerSecound(); PutFramePerSecound();

View file

@ -252,8 +252,8 @@ void PutArmsEnergy(BOOL flash)
// Draw max ammo // Draw max ammo
if (gArmsData[gSelectedArms].max_num) if (gArmsData[gSelectedArms].max_num)
{ {
PutNumber4(gArmsEnergyX + 32, 16, gArmsData[gSelectedArms].num, 0); PutNumber4(gArmsEnergyX + 32, 16, gArmsData[gSelectedArms].num, FALSE);
PutNumber4(gArmsEnergyX + 32, 24, gArmsData[gSelectedArms].max_num, 0); PutNumber4(gArmsEnergyX + 32, 24, gArmsData[gSelectedArms].max_num, FALSE);
} }
else else
{ {
@ -267,7 +267,7 @@ void PutArmsEnergy(BOOL flash)
PutBitmap3(&rcView, gArmsEnergyX + 32, 24, &rcPer, SURFACE_ID_TEXT_BOX); PutBitmap3(&rcView, gArmsEnergyX + 32, 24, &rcPer, SURFACE_ID_TEXT_BOX);
PutBitmap3(&rcView, gArmsEnergyX, 32, &rcLv, SURFACE_ID_TEXT_BOX); PutBitmap3(&rcView, gArmsEnergyX, 32, &rcLv, SURFACE_ID_TEXT_BOX);
PutNumber4(gArmsEnergyX - 8, 32, gArmsData[gSelectedArms].level, 0); PutNumber4(gArmsEnergyX - 8, 32, gArmsData[gSelectedArms].level, FALSE);
SET_RECT(rcExpBox, 0, 72, 40, 80) SET_RECT(rcExpBox, 0, 72, 40, 80)
SET_RECT(rcExpVal, 0, 80, 0, 88) SET_RECT(rcExpVal, 0, 80, 0, 88)
@ -366,7 +366,7 @@ void PutMyLife(BOOL flash)
PutBitmap3(&grcGame, 16, 40, &rcCase, SURFACE_ID_TEXT_BOX); PutBitmap3(&grcGame, 16, 40, &rcCase, SURFACE_ID_TEXT_BOX);
PutBitmap3(&grcGame, 40, 40, &rcBr, SURFACE_ID_TEXT_BOX); PutBitmap3(&grcGame, 40, 40, &rcBr, SURFACE_ID_TEXT_BOX);
PutBitmap3(&grcGame, 40, 40, &rcLife, SURFACE_ID_TEXT_BOX); PutBitmap3(&grcGame, 40, 40, &rcLife, SURFACE_ID_TEXT_BOX);
PutNumber4(8, 40, gMC.lifeBr, 0); PutNumber4(8, 40, gMC.lifeBr, FALSE);
} }
void PutMyAir(int x, int y) void PutMyAir(int x, int y)
@ -383,7 +383,7 @@ void PutMyAir(int x, int y)
{ {
// Draw how much air is left // Draw how much air is left
if (gMC.air_get % 6 < 4) if (gMC.air_get % 6 < 4)
PutNumber4(x + 32, y, gMC.air / 10, 0); PutNumber4(x + 32, y, gMC.air / 10, FALSE);
// Draw "AIR" text // Draw "AIR" text
if (gMC.air % 30 > 10) if (gMC.air % 30 > 10)
@ -420,9 +420,9 @@ void PutTimeCounter(int x, int y)
} }
// Draw time // Draw time
PutNumber4(x, y, time_count / (60 * 50), false); PutNumber4(x, y, time_count / (60 * 50), FALSE);
PutNumber4(x + 20, y, time_count / 50 % 60, true); PutNumber4(x + 20, y, time_count / 50 % 60, TRUE);
PutNumber4(x + 32, y, time_count / 5 % 10, false); PutNumber4(x + 32, y, time_count / 5 % 10, FALSE);
PutBitmap3(&grcGame, x + 30, y, &rcTime[2], SURFACE_ID_TEXT_BOX); PutBitmap3(&grcGame, x + 30, y, &rcTime[2], SURFACE_ID_TEXT_BOX);
} }
else else