Mercurial > mm7
diff mm7_2.cpp @ 1249:bbde4964e9b7
aWinProc cleanup - extracting conditions to a separate function
author | Grumpy7 |
---|---|
date | Mon, 10 Jun 2013 03:57:16 +0200 |
parents | d3bf0d4fb753 |
children | c515e406df4a |
line wrap: on
line diff
--- a/mm7_2.cpp Mon Jun 10 03:41:30 2013 +0200 +++ b/mm7_2.cpp Mon Jun 10 03:57:16 2013 +0200 @@ -5607,6 +5607,35 @@ pIcons_LOD->_4114F2(); } +void set_stru1_field_8_InArcomage(int inValue) +{ + switch(inValue) + { + case 91:LOBYTE(pArcomageGame->stru1.field_8) = 123;break; + case 92:LOBYTE(pArcomageGame->stru1.field_8) = 124;break; + case 93:LOBYTE(pArcomageGame->stru1.field_8) = 125;break; + case 96:LOBYTE(pArcomageGame->stru1.field_8) = 126;break; + case 61:LOBYTE(pArcomageGame->stru1.field_8) = 43;break; + case 55:LOBYTE(pArcomageGame->stru1.field_8) = 38;break; + case 56:LOBYTE(pArcomageGame->stru1.field_8) = 42;break; + case 57:LOBYTE(pArcomageGame->stru1.field_8) = 40;break; + case 59:LOBYTE(pArcomageGame->stru1.field_8) = 58;break; + case 54:LOBYTE(pArcomageGame->stru1.field_8) = 94;break; + case 50:LOBYTE(pArcomageGame->stru1.field_8) = 64;break; + case 51:LOBYTE(pArcomageGame->stru1.field_8) = 35;break; + case 52:LOBYTE(pArcomageGame->stru1.field_8) = 36;break; + case 53:LOBYTE(pArcomageGame->stru1.field_8) = 37;break; + case 49:LOBYTE(pArcomageGame->stru1.field_8) = 33;break; + case 39:LOBYTE(pArcomageGame->stru1.field_8) = 34;break; + case 44:LOBYTE(pArcomageGame->stru1.field_8) = 60;break; + case 46:LOBYTE(pArcomageGame->stru1.field_8) = 62;break; + case 47:LOBYTE(pArcomageGame->stru1.field_8) = 63;break; + case 48:LOBYTE(pArcomageGame->stru1.field_8) = 41;break; + default:LOBYTE(pArcomageGame->stru1.field_8) = inValue;break; + } +} + + //----- (004637EB) -------------------------------------------------------- int __stdcall aWinProc(HWND hWnd, UINT Msg, WPARAM wParam, unsigned int lParam) { @@ -6076,151 +6105,21 @@ } pArcomageGame->stru1.field_0 = 1; - if ( GetAsyncKeyState(VK_SHIFT) & 32768 ) // originally (char)((unsigned __int16)GetAsyncKeyState(VK_SHIFT) >> 8) >= 0 - v27 = MapVirtualKeyA((unsigned __int16)wParam, 2u); - else - { - v13 = (unsigned __int16)MapVirtualKeyA((unsigned __int16)wParam, 2u); - bool valSet = false; - if ( v13 == 91 ) - { - LOBYTE(pArcomageGame->stru1.field_8) = 123; - valSet = true; - } - if ( v13 == 92 ) - { - LOBYTE(pArcomageGame->stru1.field_8) = 124; - valSet = true; - } - if ( v13 == 93 ) - { - LOBYTE(pArcomageGame->stru1.field_8) = 125; - valSet = true; - } - if ( v13 == 96 ) - { - LOBYTE(pArcomageGame->stru1.field_8) = 126; - valSet = true; - } - if ( v13 == 61 ) - { - LOBYTE(pArcomageGame->stru1.field_8) = 43; - valSet = false; - } - if ( v13 == 55 ) - { - LOBYTE(pArcomageGame->stru1.field_8) = 38; - valSet = false; - } - if ( v13 == 56 ) - { - LOBYTE(pArcomageGame->stru1.field_8) = 42; - valSet = false; - } - if ( v13 == 57 ) - { - LOBYTE(pArcomageGame->stru1.field_8) = 40; - valSet = false; - } - if ( v13 == 59 ) - { - LOBYTE(pArcomageGame->stru1.field_8) = 58; - valSet = false; - } - if ( v13 == 54 ) - { - LOBYTE(pArcomageGame->stru1.field_8) = 94; - valSet = true; - } - if ( v13 == 50 ) - { - LOBYTE(pArcomageGame->stru1.field_8) = 64; - valSet = true; - } - if ( v13 == 51 ) - { - LOBYTE(pArcomageGame->stru1.field_8) = 35; - valSet = true; - } - if ( v13 == 52 ) - { - LOBYTE(pArcomageGame->stru1.field_8) = 36; - valSet = true; - } - if ( v13 == 53 ) - { - LOBYTE(pArcomageGame->stru1.field_8) = 37; - valSet = true; - } - if ( v13 == 49 ) - { - LOBYTE(pArcomageGame->stru1.field_8) = 33; - valSet = true; - } - if ( v13 == 39 ) - { - LOBYTE(pArcomageGame->stru1.field_8) = 34; - valSet = true; - } - if ( v13 == 44 ) - { - LOBYTE(pArcomageGame->stru1.field_8) = 60; - valSet = true; - } - if ( v13 == 46 ) - { - LOBYTE(pArcomageGame->stru1.field_8) = 62; - valSet = true; - } - if ( v13 == 47 ) - { - LOBYTE(pArcomageGame->stru1.field_8) = 63; - valSet = true; - } - if ( v13 == 48 ) - { - LOBYTE(pArcomageGame->stru1.field_8) = 41; - valSet = true; - } - if (valSet) - { - if ( wParam == 27 ) - { - pArcomageGame->GameOver = 1; - pArcomageGame->field_F4 = 1; - pArcomageGame->uGameResult = 2; - pArcomageGame->field_B0 = -2; - //goto _def_wnd_proc; - return DefWindowProcA(hWnd, Msg, wParam, lParam); - } - if ( wParam != 114 ) - { - if ( wParam == 115 && !pVideoPlayer->AnyMovieLoaded() ) - SendMessageA(hWnd, 0x111u, 0x68u, 0); - //goto _def_wnd_proc; - return DefWindowProcA(hWnd, Msg, wParam, lParam); - } - SendMessageA(hWnd, WM_COMMAND, 103, 0); - return 0; - } - } - v27 = MapVirtualKeyA((unsigned __int16)wParam, 2u); - LOBYTE(pArcomageGame->stru1.field_8) = v27; - //goto LABEL_181; + + v13 = (unsigned __int16)MapVirtualKeyA((unsigned __int16)wParam, 2u); + set_stru1_field_8_InArcomage(v13); if ( wParam == 27 ) { pArcomageGame->GameOver = 1; pArcomageGame->field_F4 = 1; pArcomageGame->uGameResult = 2; pArcomageGame->field_B0 = -2; - //goto _def_wnd_proc; return DefWindowProcA(hWnd, Msg, wParam, lParam); } if ( wParam != 114 ) { if ( wParam == 115 && !pVideoPlayer->AnyMovieLoaded() ) - SendMessageA(hWnd, 0x111u, 0x68u, 0); - //goto _def_wnd_proc; + SendMessageA(hWnd, 0x111u, 0x68u, 0); return DefWindowProcA(hWnd, Msg, wParam, lParam); } SendMessageA(hWnd, WM_COMMAND, 103, 0);