shithub: cstory

Download patch

ref: 3d94702bea267035144836a5929129fd848b4d79
parent: 71015da19b825a3ab3b5db431f737b3fd2e97565
author: Gabriel Ravier <gabravier@gmail.com>
date: Wed May 8 04:49:32 EDT 2019

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>

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