shithub: cstory

Download patch

ref: 5e49d734c92529b346240b9a7723a084e2e1ceb8
parent: 262fcfbaa3f5babe2e6b052752afe42e2be71f40
author: Clownacy <Clownacy@users.noreply.github.com>
date: Fri Nov 15 15:00:43 EST 2019

Clean-up Game.cpp

--- a/src/Game.cpp
+++ b/src/Game.cpp
@@ -52,7 +52,7 @@
 int Random(int min, int max)
 {
 	const int range = max - min + 1;
-	return min + rand() % range;
+	return (rand() % range) + min;
 }
 
 void PutNumber4(int x, int y, int value, BOOL bZero)
@@ -391,19 +391,19 @@
 		CortBox(&grcGame, back_color);
 
 		// 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);
+		PutBitmap3(&grcGame, (WINDOW_WIDTH / 2) - 60, WINDOW_HEIGHT - 24, &rcVersion, SURFACE_ID_TEXT_BOX);
+		PutBitmap3(&grcGame, (WINDOW_WIDTH / 2) - 4, WINDOW_HEIGHT - 24, &rcPeriod, SURFACE_ID_TEXT_BOX);
 
-		PutNumber4((WINDOW_WIDTH - 40) / 2, WINDOW_HEIGHT - 24, v1, FALSE);
-		PutNumber4((WINDOW_WIDTH - 8) / 2, WINDOW_HEIGHT - 24, v2, FALSE);
-		PutNumber4((WINDOW_WIDTH + 24) / 2, WINDOW_HEIGHT - 24, v3, FALSE);
-		PutNumber4((WINDOW_WIDTH + 56) / 2, WINDOW_HEIGHT - 24, v4, FALSE);
+		PutNumber4((WINDOW_WIDTH / 2) - 20, WINDOW_HEIGHT - 24, v1, FALSE);
+		PutNumber4((WINDOW_WIDTH / 2) - 4, WINDOW_HEIGHT - 24, v2, FALSE);
+		PutNumber4((WINDOW_WIDTH / 2) + 12, WINDOW_HEIGHT - 24, v3, FALSE);
+		PutNumber4((WINDOW_WIDTH / 2) + 28, WINDOW_HEIGHT - 24, v4, FALSE);
 
 		// 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);
+		PutBitmap3(&grcGame, (WINDOW_WIDTH / 2) - 72, 40, &rcTitle, SURFACE_ID_TITLE);
+		PutBitmap3(&grcGame, (WINDOW_WIDTH / 2) - 24, (WINDOW_HEIGHT / 2) + 8, &rcNew, SURFACE_ID_TITLE);
+		PutBitmap3(&grcGame, (WINDOW_WIDTH / 2) - 24, (WINDOW_HEIGHT / 2) + 28, &rcContinue, SURFACE_ID_TITLE);
+		PutBitmap3(&grcGame, (WINDOW_WIDTH / 2) - 80, WINDOW_HEIGHT - 48, &rcPixel, SURFACE_ID_PIXEL);
 
 		// Draw character cursor
 		switch (char_type)
@@ -431,15 +431,15 @@
 		}
 
 		if (!bContinue)
-			char_y = (WINDOW_HEIGHT + 14) / 2;
+			char_y = (WINDOW_HEIGHT / 2) + 7;
 		else
-			char_y = (WINDOW_HEIGHT + 54) / 2;
+			char_y = (WINDOW_HEIGHT / 2) + 27;
 
 		// Pixel being redundant
 		if (!bContinue)
-			PutBitmap3(&grcGame, (WINDOW_WIDTH - 88) / 2, char_y, &char_rc, char_surf);
+			PutBitmap3(&grcGame, (WINDOW_WIDTH / 2) - 44, char_y, &char_rc, char_surf);
 		else
-			PutBitmap3(&grcGame, (WINDOW_WIDTH - 88) / 2, char_y, &char_rc, char_surf);
+			PutBitmap3(&grcGame, (WINDOW_WIDTH / 2) - 44, char_y, &char_rc, char_surf);
 
 		// Draw carets
 		PutCaret(0, 0);
@@ -506,7 +506,7 @@
 
 	if (bContinue)
 	{
-		if (!LoadProfile(NULL) && !InitializeGame(hWnd))	// ...Shouldn't that '&&' be a '||'?
+		if (!LoadProfile(NULL) && !InitializeGame(hWnd))
 			return 0;
 	}
 	else
@@ -653,7 +653,7 @@
 		{
 			PutMyLife(TRUE);
 			PutArmsEnergy(TRUE);
-			PutMyAir((WINDOW_WIDTH - 80) / 2, (WINDOW_HEIGHT - 32) / 2);
+			PutMyAir((WINDOW_WIDTH / 2) - 40, (WINDOW_HEIGHT / 2) - 16);
 			PutActiveArmsList();
 		}