Fix parentheses and comments in Game.cpp, Generic.cpp

Also fixed formatting for a break (two spaces instead of a tab)

Signed-off-by: Gabriel Ravier <gabravier@gmail.com>
This commit is contained in:
Gabriel Ravier 2019-05-08 08:49:32 +02:00
parent 71015da19b
commit 3d94702bea
2 changed files with 50 additions and 50 deletions

View file

@ -58,7 +58,7 @@ 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)
{ {
//Define rects // Define rects
RECT rcClient = grcFull; RECT rcClient = grcFull;
RECT rect[10] = { RECT rect[10] = {
@ -74,19 +74,19 @@ void PutNumber4(int x, int y, int value, bool bZero)
{72, 56, 80, 64}, {72, 56, 80, 64},
}; };
//Digits // Digits
int tbl[4] = {1000, 100, 10, 1}; int tbl[4] = {1000, 100, 10, 1};
//Limit value // Limit value
if ( value > 9999 ) if (value > 9999)
value = 9999; value = 9999;
//Go through number and draw digits // Go through number and draw digits
int offset = 0; int offset = 0;
int sw = 0; int sw = 0;
while (offset < 4) while (offset < 4)
{ {
//Get the digit that this is // Get the digit that this is
int a = 0; int a = 0;
while (tbl[offset] <= value) while (tbl[offset] <= value)
@ -96,11 +96,11 @@ void PutNumber4(int x, int y, int value, bool bZero)
++sw; ++sw;
} }
//Draw digit // Draw digit
if ((bZero && offset == 2) || sw != 0 || offset == 3 ) if ((bZero && offset == 2) || sw != 0 || offset == 3)
PutBitmap3(&rcClient, x + 8 * offset, y, &rect[a], SURFACE_ID_TEXT_BOX); PutBitmap3(&rcClient, x + 8 * offset, y, &rect[a], SURFACE_ID_TEXT_BOX);
//Go to next digit // Go to next digit
++offset; ++offset;
} }
} }
@ -118,9 +118,9 @@ int ModeOpening()
SetFrameTargetMyChar(16); SetFrameTargetMyChar(16);
SetFadeMask(); SetFadeMask();
//Reset cliprect and flags // Reset cliprect and flags
grcGame.left = 0; grcGame.left = 0;
//Non-vanilla: these three lines are widescreen-related(?) // Non-vanilla: these three lines are widescreen-related(?)
grcGame.top = 0; grcGame.top = 0;
grcGame.right = WINDOW_WIDTH; grcGame.right = WINDOW_WIDTH;
grcGame.bottom = WINDOW_HEIGHT; grcGame.bottom = WINDOW_HEIGHT;
@ -132,13 +132,13 @@ int ModeOpening()
unsigned int wait = 0; unsigned int wait = 0;
while (wait < 500) while (wait < 500)
{ {
//Increase timer // Increase timer
++wait; ++wait;
//Get pressed keys // Get pressed keys
GetTrg(); GetTrg();
//Escape menu // Escape menu
if (gKey & KEY_ESCAPE) if (gKey & KEY_ESCAPE)
{ {
int escRet = Call_Escape(); int escRet = Call_Escape();
@ -148,11 +148,11 @@ int ModeOpening()
return 1; return 1;
} }
//Skip intro if OK is pressed // Skip intro if OK is pressed
if (gKey & gKeyOk) if (gKey & gKeyOk)
break; break;
//Update everything // Update everything
ActNpChar(); ActNpChar();
ActBossChar(); ActBossChar();
ActBack(); ActBack();
@ -167,7 +167,7 @@ int ModeOpening()
MoveFrame3(); MoveFrame3();
ProcFade(); ProcFade();
//Draw everything // Draw everything
CortBox(&grcFull, 0x000000); CortBox(&grcFull, 0x000000);
int frame_x, frame_y; int frame_x, frame_y;
@ -182,7 +182,7 @@ int ModeOpening()
PutCaret(frame_x, frame_y); PutCaret(frame_x, frame_y);
PutFade(); PutFade();
//Update Text Script // Update Text Script
int tscRet = TextScriptProc(); int tscRet = TextScriptProc();
if (tscRet == 0) if (tscRet == 0)
return 0; return 0;
@ -212,7 +212,7 @@ int ModeOpening()
int ModeTitle() int ModeTitle()
{ {
//Set rects // Set rects
RECT rcTitle = {0, 0, 144, 32}; RECT rcTitle = {0, 0, 144, 32};
RECT rcPixel = {0, 0, 160, 16}; RECT rcPixel = {0, 0, 160, 16};
@ -222,7 +222,7 @@ int ModeTitle()
RECT rcVersion = {152, 80, 208, 88}; RECT rcVersion = {152, 80, 208, 88};
RECT rcPeriod = {152, 88, 208, 96}; RECT rcPeriod = {152, 88, 208, 96};
//Character rects // Character rects
RECT rcMyChar[4] = { RECT rcMyChar[4] = {
{0, 16, 16, 32}, {0, 16, 16, 32},
{16, 16, 32, 32}, {16, 16, 32, 32},
@ -258,21 +258,21 @@ int ModeTitle()
{48, 16, 64, 32}, {48, 16, 64, 32},
}; };
//Reset everything // Reset everything
InitCaret(); InitCaret();
InitStar(); InitStar();
CutNoise(); CutNoise();
//Create variables // Create variables
int anime = 0; int anime = 0;
int char_type = 0; int char_type = 0;
int time_counter = 0; int time_counter = 0;
unsigned long back_color = GetCortBoxColor(RGB(0x20, 0x20, 0x20)); unsigned long back_color = GetCortBoxColor(RGB(0x20, 0x20, 0x20));
//Set state // Set state
bContinue = IsProfile(); bContinue = IsProfile();
//Set character // Set character
time_counter = LoadTimeCounter(); time_counter = LoadTimeCounter();
if (time_counter && time_counter < 18000) if (time_counter && time_counter < 18000)
@ -284,7 +284,7 @@ int ModeTitle()
if (time_counter && time_counter < 9000) if (time_counter && time_counter < 9000)
char_type = 4; char_type = 4;
//Set music to character's specific music // Set music to character's specific music
switch (char_type) switch (char_type)
{ {
case 1: case 1:
@ -304,9 +304,9 @@ int ModeTitle()
break; break;
} }
//Reset cliprect, flags, and give the player the nikumaru counter // Reset cliprect, flags, and give the player the nikumaru counter
grcGame.left = 0; grcGame.left = 0;
//Non-vanilla: these three lines are widescreen-related(?) // Non-vanilla: these three lines are widescreen-related(?)
grcGame.top = 0; grcGame.top = 0;
grcGame.right = WINDOW_WIDTH; grcGame.right = WINDOW_WIDTH;
grcGame.bottom = WINDOW_HEIGHT; grcGame.bottom = WINDOW_HEIGHT;
@ -314,19 +314,19 @@ int ModeTitle()
g_GameFlags = 0; g_GameFlags = 0;
gMC.equip |= 0x100; gMC.equip |= 0x100;
//Start loop // Start loop
unsigned int wait = 0; unsigned int wait = 0;
while (true) while (true)
{ {
//Don't accept selection for 10 frames // Don't accept selection for 10 frames
if (wait < 10) if (wait < 10)
++wait; ++wait;
//Get pressed keys // Get pressed keys
GetTrg(); GetTrg();
//Quit when OK is pressed // Quit when OK is pressed
if (wait >= 10) if (wait >= 10)
{ {
if (gKeyTrg & gKeyOk) if (gKeyTrg & gKeyOk)
@ -342,24 +342,24 @@ int ModeTitle()
return 1; return 1;
} }
//Move cursor // Move cursor
if ((gKeyDown | gKeyUp) & gKeyTrg) if ((gKeyDown | gKeyUp) & gKeyTrg)
{ {
PlaySoundObject(1, 1); PlaySoundObject(1, 1);
bContinue = !bContinue; bContinue = !bContinue;
} }
//Update carets // Update carets
ActCaret(); ActCaret();
//Animate character cursor // Animate character cursor
if ( ++anime >= 40 ) if (++anime >= 40)
anime = 0; anime = 0;
//Draw title // Draw title
CortBox(&grcGame, back_color); CortBox(&grcGame, back_color);
//Draw version // Draw version
PutBitmap3(&grcGame, (WINDOW_WIDTH - 120) / 2, WINDOW_HEIGHT - 24, &rcVersion, SURFACE_ID_TEXT_BOX); PutBitmap3(&grcGame, (WINDOW_WIDTH - 120) / 2, WINDOW_HEIGHT - 24, &rcVersion, SURFACE_ID_TEXT_BOX);
PutBitmap3(&grcGame, (WINDOW_WIDTH - 8) / 2, WINDOW_HEIGHT - 24, &rcPeriod, SURFACE_ID_TEXT_BOX); PutBitmap3(&grcGame, (WINDOW_WIDTH - 8) / 2, WINDOW_HEIGHT - 24, &rcPeriod, SURFACE_ID_TEXT_BOX);
@ -370,17 +370,17 @@ int ModeTitle()
PutNumber4((WINDOW_WIDTH + 24) / 2, WINDOW_HEIGHT - 24, v3, 0); PutNumber4((WINDOW_WIDTH + 24) / 2, WINDOW_HEIGHT - 24, v3, 0);
PutNumber4((WINDOW_WIDTH + 56) / 2, WINDOW_HEIGHT - 24, v4, 0); PutNumber4((WINDOW_WIDTH + 56) / 2, WINDOW_HEIGHT - 24, v4, 0);
//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);
PutBitmap3(&grcGame, (WINDOW_WIDTH - 48) / 2, (WINDOW_HEIGHT + 16) / 2, &rcNew, SURFACE_ID_TITLE); PutBitmap3(&grcGame, (WINDOW_WIDTH - 48) / 2, (WINDOW_HEIGHT + 16) / 2, &rcNew, SURFACE_ID_TITLE);
PutBitmap3(&grcGame, (WINDOW_WIDTH - 48) / 2, (WINDOW_HEIGHT + 56) / 2, &rcContinue, SURFACE_ID_TITLE); PutBitmap3(&grcGame, (WINDOW_WIDTH - 48) / 2, (WINDOW_HEIGHT + 56) / 2, &rcContinue, SURFACE_ID_TITLE);
PutBitmap3(&grcGame, (WINDOW_WIDTH - 160) / 2, WINDOW_HEIGHT - 48, &rcPixel, SURFACE_ID_PIXEL); PutBitmap3(&grcGame, (WINDOW_WIDTH - 160) / 2, WINDOW_HEIGHT - 48, &rcPixel, SURFACE_ID_PIXEL);
//Draw character cursor // Draw character cursor
RECT char_rc; RECT char_rc;
Surface_Ids char_surf; Surface_Ids char_surf;
switch ( char_type ) switch (char_type)
{ {
case 0: case 0:
char_rc = rcMyChar[anime / 10 % 4]; char_rc = rcMyChar[anime / 10 % 4];
@ -412,7 +412,7 @@ int ModeTitle()
PutBitmap3(&grcGame, (WINDOW_WIDTH - 88) / 2, char_y, &char_rc, char_surf); PutBitmap3(&grcGame, (WINDOW_WIDTH - 88) / 2, char_y, &char_rc, char_surf);
//Draw carets // Draw carets
PutCaret(0, 0); PutCaret(0, 0);
if (time_counter) if (time_counter)
@ -427,7 +427,7 @@ int ModeTitle()
PlaySoundObject(18, 1); PlaySoundObject(18, 1);
ChangeMusic(0); ChangeMusic(0);
//Black screen when option is selected // Black screen when option is selected
wait = SDL_GetTicks(); wait = SDL_GetTicks();
while (SDL_GetTicks() < wait + 1000) while (SDL_GetTicks() < wait + 1000)
{ {
@ -449,12 +449,12 @@ int ModeAction()
bool swPlay = true; bool swPlay = true;
//Reset stuff // Reset stuff
gCounter = 0; gCounter = 0;
grcGame.left = 0; grcGame.left = 0;
g_GameFlags = 3; g_GameFlags = 3;
//Initialize everything // Initialize everything
InitMyChar(); InitMyChar();
InitNpChar(); InitNpChar();
InitBullet(); InitBullet();
@ -473,10 +473,10 @@ int ModeAction()
{ {
while (true) while (true)
{ {
//Get pressed keys // Get pressed keys
GetTrg(); GetTrg();
//Escape menu // Escape menu
if (gKey & KEY_ESCAPE) if (gKey & KEY_ESCAPE)
{ {
int escRet = Call_Escape(); int escRet = Call_Escape();
@ -548,7 +548,7 @@ int ModeAction()
if (!(g_GameFlags & 4)) if (!(g_GameFlags & 4))
{ {
//Open inventory // Open inventory
if (gKeyTrg & gKeyItem) if (gKeyTrg & gKeyItem)
{ {
BackupSurface(SURFACE_ID_SCREEN_GRAB, &grcGame); BackupSurface(SURFACE_ID_SCREEN_GRAB, &grcGame);
@ -615,7 +615,7 @@ int ModeAction()
PutFramePerSecound(); PutFramePerSecound();
if (!Flip_SystemTask()) if (!Flip_SystemTask())
break; break;
++gCounter; ++gCounter;
} }
} }

View file

@ -47,9 +47,9 @@ bool CheckFileExists(const char *name)
bool IsShiftJIS(uint8_t c) bool IsShiftJIS(uint8_t c)
{ {
if ( c > 0x80 && c < 0xA0 ) if (c > 0x80 && c < 0xA0)
return true; return true;
if ( c < 0xE0 || c >= 0xF0 ) if (c < 0xE0 || c >= 0xF0)
return false; return false;
return true; return true;
} }