Clean-up Main.cpp

Found an ASM-inaccuracy. Yay.
This commit is contained in:
Clownacy 2019-11-15 18:31:48 +00:00
parent 9513a04f45
commit 6c2ca988a8

View file

@ -182,7 +182,7 @@ int __stdcall WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdL
} }
// Set gamepad inputs // Set gamepad inputs
for (i = 0; i < 8; i++) for (i = 0; i < 8; ++i)
{ {
switch (conf.joystick_button[i]) switch (conf.joystick_button[i])
{ {
@ -237,6 +237,7 @@ int __stdcall WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdL
case 1: case 1:
case 2: case 2:
wndclassex.lpszMenuName = "MENU_MAIN"; wndclassex.lpszMenuName = "MENU_MAIN";
if (RegisterClassExA(&wndclassex) == 0) if (RegisterClassExA(&wndclassex) == 0)
{ {
ReleaseMutex(hMutex); ReleaseMutex(hMutex);
@ -255,8 +256,8 @@ int __stdcall WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdL
windowHeight = WINDOW_HEIGHT * 2; windowHeight = WINDOW_HEIGHT * 2;
} }
nWidth = windowWidth + 2 * GetSystemMetrics(SM_CXFIXEDFRAME) + 2; nWidth = (GetSystemMetrics(SM_CXFIXEDFRAME) * 2) + windowWidth + 2;
nHeight = (2 * GetSystemMetrics(SM_CYFIXEDFRAME) + GetSystemMetrics(SM_CYCAPTION)) + GetSystemMetrics(SM_CYMENU) + windowHeight + 2; nHeight = (GetSystemMetrics(SM_CYFIXEDFRAME) * 2) + GetSystemMetrics(SM_CYCAPTION) + GetSystemMetrics(SM_CYMENU) + windowHeight + 2;
x = (GetSystemMetrics(SM_CXSCREEN) - nWidth) / 2; x = (GetSystemMetrics(SM_CXSCREEN) - nWidth) / 2;
y = (GetSystemMetrics(SM_CYSCREEN) - nHeight) / 2; y = (GetSystemMetrics(SM_CYSCREEN) - nHeight) / 2;
@ -320,7 +321,7 @@ int __stdcall WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdL
break; break;
} }
StartDirectDraw(ghWnd, 2, depth); StartDirectDraw(hWnd, 2, depth);
bFullscreen = TRUE; bFullscreen = TRUE;
ShowCursor(FALSE); ShowCursor(FALSE);
@ -338,7 +339,7 @@ int __stdcall WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdL
// Draw loading screen // Draw loading screen
CortBox(&rcFull, 0x000000); 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 // Draw to screen
if (!Flip_SystemTask(ghWnd)) if (!Flip_SystemTask(ghWnd))
@ -346,8 +347,7 @@ int __stdcall WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdL
ReleaseMutex(hMutex); ReleaseMutex(hMutex);
return 1; return 1;
} }
else
{
// Initialize sound // Initialize sound
InitDirectSound(hWnd); InitDirectSound(hWnd);
@ -371,7 +371,6 @@ int __stdcall WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdL
EndDirectDraw(hWnd); EndDirectDraw(hWnd);
ReleaseMutex(hMutex); ReleaseMutex(hMutex);
}
return 1; return 1;
} }
@ -772,13 +771,11 @@ void JoystickProc(void)
gKey &= ~gKeyDown; gKey &= ~gKeyDown;
// Clear held buttons // Clear held buttons
for (i = 0; i < 8; i++) for (i = 0; i < 8; ++i)
gKey &= ~gJoystickButtonTable[i]; gKey &= ~gJoystickButtonTable[i];
// Set held buttons // Set held buttons
for (i = 0; i < 8; i++) for (i = 0; i < 8; ++i)
{
if (status.bButton[i]) if (status.bButton[i])
gKey |= gJoystickButtonTable[i]; gKey |= gJoystickButtonTable[i];
} }
}