ref: 6c2ca988a8d874fcb2c85a28294312484025ac0b
parent: 9513a04f45fb0c8ed89b2a5efc8082853a341177
author: Clownacy <Clownacy@users.noreply.github.com>
date: Fri Nov 15 13:31:48 EST 2019
Clean-up Main.cpp Found an ASM-inaccuracy. Yay.
--- a/src/Main.cpp
+++ b/src/Main.cpp
@@ -182,7 +182,7 @@
}
// Set gamepad inputs
- for (i = 0; i < 8; i++)
+ for (i = 0; i < 8; ++i)
{
switch (conf.joystick_button[i])
{
@@ -237,6 +237,7 @@
case 1:
case 2:
wndclassex.lpszMenuName = "MENU_MAIN";
+
if (RegisterClassExA(&wndclassex) == 0)
{
ReleaseMutex(hMutex);
@@ -255,8 +256,8 @@
windowHeight = WINDOW_HEIGHT * 2;
}
- nWidth = windowWidth + 2 * GetSystemMetrics(SM_CXFIXEDFRAME) + 2;
- nHeight = (2 * GetSystemMetrics(SM_CYFIXEDFRAME) + GetSystemMetrics(SM_CYCAPTION)) + GetSystemMetrics(SM_CYMENU) + windowHeight + 2;
+ nWidth = (GetSystemMetrics(SM_CXFIXEDFRAME) * 2) + windowWidth + 2;
+ nHeight = (GetSystemMetrics(SM_CYFIXEDFRAME) * 2) + GetSystemMetrics(SM_CYCAPTION) + GetSystemMetrics(SM_CYMENU) + windowHeight + 2;
x = (GetSystemMetrics(SM_CXSCREEN) - nWidth) / 2;
y = (GetSystemMetrics(SM_CYSCREEN) - nHeight) / 2;
@@ -320,7 +321,7 @@
break;
}
- StartDirectDraw(ghWnd, 2, depth);
+ StartDirectDraw(hWnd, 2, depth);
bFullscreen = TRUE;
ShowCursor(FALSE);
@@ -338,7 +339,7 @@
// Draw loading screen
CortBox(&rcFull, 0x000000);
- PutBitmap3(&rcFull, (WINDOW_WIDTH - 64) / 2, (WINDOW_HEIGHT - 8) / 2, &rcLoading, SURFACE_ID_LOADING);
+ PutBitmap3(&rcFull, (WINDOW_WIDTH / 2) - 32, (WINDOW_HEIGHT / 2) - 4, &rcLoading, SURFACE_ID_LOADING);
// Draw to screen
if (!Flip_SystemTask(ghWnd))
@@ -346,33 +347,31 @@
ReleaseMutex(hMutex);
return 1;
}
- else
- {
- // Initialize sound
- InitDirectSound(hWnd);
- // Initialize joystick
- if (conf.bJoystick && InitDirectInput(hInstance, hWnd))
- {
- ResetJoystickStatus();
- gbUseJoystick = TRUE;
- }
+ // Initialize sound
+ InitDirectSound(hWnd);
- // Initialize stuff
- InitTextObject(conf.font_name);
- InitTriangleTable();
+ // Initialize joystick
+ if (conf.bJoystick && InitDirectInput(hInstance, hWnd))
+ {
+ ResetJoystickStatus();
+ gbUseJoystick = TRUE;
+ }
- // Run game code
- Game(hWnd);
+ // Initialize stuff
+ InitTextObject(conf.font_name);
+ InitTriangleTable();
- // End stuff
- EndTextObject();
- EndDirectSound();
- EndDirectDraw(hWnd);
+ // Run game code
+ Game(hWnd);
- ReleaseMutex(hMutex);
- }
+ // End stuff
+ EndTextObject();
+ EndDirectSound();
+ EndDirectDraw(hWnd);
+ ReleaseMutex(hMutex);
+
return 1;
}
@@ -772,13 +771,11 @@
gKey &= ~gKeyDown;
// Clear held buttons
- for (i = 0; i < 8; i++)
+ for (i = 0; i < 8; ++i)
gKey &= ~gJoystickButtonTable[i];
// Set held buttons
- for (i = 0; i < 8; i++)
- {
+ for (i = 0; i < 8; ++i)
if (status.bButton[i])
gKey |= gJoystickButtonTable[i];
- }
}