Mercurial > mm7
comparison 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 |
comparison
equal
deleted
inserted
replaced
1248:d3bf0d4fb753 | 1249:bbde4964e9b7 |
---|---|
5605 } | 5605 } |
5606 pWindow_MainMenu->Release(); | 5606 pWindow_MainMenu->Release(); |
5607 pIcons_LOD->_4114F2(); | 5607 pIcons_LOD->_4114F2(); |
5608 } | 5608 } |
5609 | 5609 |
5610 void set_stru1_field_8_InArcomage(int inValue) | |
5611 { | |
5612 switch(inValue) | |
5613 { | |
5614 case 91:LOBYTE(pArcomageGame->stru1.field_8) = 123;break; | |
5615 case 92:LOBYTE(pArcomageGame->stru1.field_8) = 124;break; | |
5616 case 93:LOBYTE(pArcomageGame->stru1.field_8) = 125;break; | |
5617 case 96:LOBYTE(pArcomageGame->stru1.field_8) = 126;break; | |
5618 case 61:LOBYTE(pArcomageGame->stru1.field_8) = 43;break; | |
5619 case 55:LOBYTE(pArcomageGame->stru1.field_8) = 38;break; | |
5620 case 56:LOBYTE(pArcomageGame->stru1.field_8) = 42;break; | |
5621 case 57:LOBYTE(pArcomageGame->stru1.field_8) = 40;break; | |
5622 case 59:LOBYTE(pArcomageGame->stru1.field_8) = 58;break; | |
5623 case 54:LOBYTE(pArcomageGame->stru1.field_8) = 94;break; | |
5624 case 50:LOBYTE(pArcomageGame->stru1.field_8) = 64;break; | |
5625 case 51:LOBYTE(pArcomageGame->stru1.field_8) = 35;break; | |
5626 case 52:LOBYTE(pArcomageGame->stru1.field_8) = 36;break; | |
5627 case 53:LOBYTE(pArcomageGame->stru1.field_8) = 37;break; | |
5628 case 49:LOBYTE(pArcomageGame->stru1.field_8) = 33;break; | |
5629 case 39:LOBYTE(pArcomageGame->stru1.field_8) = 34;break; | |
5630 case 44:LOBYTE(pArcomageGame->stru1.field_8) = 60;break; | |
5631 case 46:LOBYTE(pArcomageGame->stru1.field_8) = 62;break; | |
5632 case 47:LOBYTE(pArcomageGame->stru1.field_8) = 63;break; | |
5633 case 48:LOBYTE(pArcomageGame->stru1.field_8) = 41;break; | |
5634 default:LOBYTE(pArcomageGame->stru1.field_8) = inValue;break; | |
5635 } | |
5636 } | |
5637 | |
5638 | |
5610 //----- (004637EB) -------------------------------------------------------- | 5639 //----- (004637EB) -------------------------------------------------------- |
5611 int __stdcall aWinProc(HWND hWnd, UINT Msg, WPARAM wParam, unsigned int lParam) | 5640 int __stdcall aWinProc(HWND hWnd, UINT Msg, WPARAM wParam, unsigned int lParam) |
5612 { | 5641 { |
5613 //unsigned int v4; // esi@1 | 5642 //unsigned int v4; // esi@1 |
5614 Render *v5; // ecx@14 | 5643 Render *v5; // ecx@14 |
6074 if ( pCurrentScreen != SCREEN_GAME && pCurrentScreen != SCREEN_PRESS_ESCAPE_MESSAGE ) | 6103 if ( pCurrentScreen != SCREEN_GAME && pCurrentScreen != SCREEN_PRESS_ESCAPE_MESSAGE ) |
6075 return 0; | 6104 return 0; |
6076 } | 6105 } |
6077 | 6106 |
6078 pArcomageGame->stru1.field_0 = 1; | 6107 pArcomageGame->stru1.field_0 = 1; |
6079 if ( GetAsyncKeyState(VK_SHIFT) & 32768 ) // originally (char)((unsigned __int16)GetAsyncKeyState(VK_SHIFT) >> 8) >= 0 | 6108 |
6080 v27 = MapVirtualKeyA((unsigned __int16)wParam, 2u); | 6109 v13 = (unsigned __int16)MapVirtualKeyA((unsigned __int16)wParam, 2u); |
6081 else | 6110 set_stru1_field_8_InArcomage(v13); |
6082 { | |
6083 v13 = (unsigned __int16)MapVirtualKeyA((unsigned __int16)wParam, 2u); | |
6084 bool valSet = false; | |
6085 if ( v13 == 91 ) | |
6086 { | |
6087 LOBYTE(pArcomageGame->stru1.field_8) = 123; | |
6088 valSet = true; | |
6089 } | |
6090 if ( v13 == 92 ) | |
6091 { | |
6092 LOBYTE(pArcomageGame->stru1.field_8) = 124; | |
6093 valSet = true; | |
6094 } | |
6095 if ( v13 == 93 ) | |
6096 { | |
6097 LOBYTE(pArcomageGame->stru1.field_8) = 125; | |
6098 valSet = true; | |
6099 } | |
6100 if ( v13 == 96 ) | |
6101 { | |
6102 LOBYTE(pArcomageGame->stru1.field_8) = 126; | |
6103 valSet = true; | |
6104 } | |
6105 if ( v13 == 61 ) | |
6106 { | |
6107 LOBYTE(pArcomageGame->stru1.field_8) = 43; | |
6108 valSet = false; | |
6109 } | |
6110 if ( v13 == 55 ) | |
6111 { | |
6112 LOBYTE(pArcomageGame->stru1.field_8) = 38; | |
6113 valSet = false; | |
6114 } | |
6115 if ( v13 == 56 ) | |
6116 { | |
6117 LOBYTE(pArcomageGame->stru1.field_8) = 42; | |
6118 valSet = false; | |
6119 } | |
6120 if ( v13 == 57 ) | |
6121 { | |
6122 LOBYTE(pArcomageGame->stru1.field_8) = 40; | |
6123 valSet = false; | |
6124 } | |
6125 if ( v13 == 59 ) | |
6126 { | |
6127 LOBYTE(pArcomageGame->stru1.field_8) = 58; | |
6128 valSet = false; | |
6129 } | |
6130 if ( v13 == 54 ) | |
6131 { | |
6132 LOBYTE(pArcomageGame->stru1.field_8) = 94; | |
6133 valSet = true; | |
6134 } | |
6135 if ( v13 == 50 ) | |
6136 { | |
6137 LOBYTE(pArcomageGame->stru1.field_8) = 64; | |
6138 valSet = true; | |
6139 } | |
6140 if ( v13 == 51 ) | |
6141 { | |
6142 LOBYTE(pArcomageGame->stru1.field_8) = 35; | |
6143 valSet = true; | |
6144 } | |
6145 if ( v13 == 52 ) | |
6146 { | |
6147 LOBYTE(pArcomageGame->stru1.field_8) = 36; | |
6148 valSet = true; | |
6149 } | |
6150 if ( v13 == 53 ) | |
6151 { | |
6152 LOBYTE(pArcomageGame->stru1.field_8) = 37; | |
6153 valSet = true; | |
6154 } | |
6155 if ( v13 == 49 ) | |
6156 { | |
6157 LOBYTE(pArcomageGame->stru1.field_8) = 33; | |
6158 valSet = true; | |
6159 } | |
6160 if ( v13 == 39 ) | |
6161 { | |
6162 LOBYTE(pArcomageGame->stru1.field_8) = 34; | |
6163 valSet = true; | |
6164 } | |
6165 if ( v13 == 44 ) | |
6166 { | |
6167 LOBYTE(pArcomageGame->stru1.field_8) = 60; | |
6168 valSet = true; | |
6169 } | |
6170 if ( v13 == 46 ) | |
6171 { | |
6172 LOBYTE(pArcomageGame->stru1.field_8) = 62; | |
6173 valSet = true; | |
6174 } | |
6175 if ( v13 == 47 ) | |
6176 { | |
6177 LOBYTE(pArcomageGame->stru1.field_8) = 63; | |
6178 valSet = true; | |
6179 } | |
6180 if ( v13 == 48 ) | |
6181 { | |
6182 LOBYTE(pArcomageGame->stru1.field_8) = 41; | |
6183 valSet = true; | |
6184 } | |
6185 if (valSet) | |
6186 { | |
6187 if ( wParam == 27 ) | |
6188 { | |
6189 pArcomageGame->GameOver = 1; | |
6190 pArcomageGame->field_F4 = 1; | |
6191 pArcomageGame->uGameResult = 2; | |
6192 pArcomageGame->field_B0 = -2; | |
6193 //goto _def_wnd_proc; | |
6194 return DefWindowProcA(hWnd, Msg, wParam, lParam); | |
6195 } | |
6196 if ( wParam != 114 ) | |
6197 { | |
6198 if ( wParam == 115 && !pVideoPlayer->AnyMovieLoaded() ) | |
6199 SendMessageA(hWnd, 0x111u, 0x68u, 0); | |
6200 //goto _def_wnd_proc; | |
6201 return DefWindowProcA(hWnd, Msg, wParam, lParam); | |
6202 } | |
6203 SendMessageA(hWnd, WM_COMMAND, 103, 0); | |
6204 return 0; | |
6205 } | |
6206 } | |
6207 v27 = MapVirtualKeyA((unsigned __int16)wParam, 2u); | |
6208 LOBYTE(pArcomageGame->stru1.field_8) = v27; | |
6209 //goto LABEL_181; | |
6210 if ( wParam == 27 ) | 6111 if ( wParam == 27 ) |
6211 { | 6112 { |
6212 pArcomageGame->GameOver = 1; | 6113 pArcomageGame->GameOver = 1; |
6213 pArcomageGame->field_F4 = 1; | 6114 pArcomageGame->field_F4 = 1; |
6214 pArcomageGame->uGameResult = 2; | 6115 pArcomageGame->uGameResult = 2; |
6215 pArcomageGame->field_B0 = -2; | 6116 pArcomageGame->field_B0 = -2; |
6216 //goto _def_wnd_proc; | |
6217 return DefWindowProcA(hWnd, Msg, wParam, lParam); | 6117 return DefWindowProcA(hWnd, Msg, wParam, lParam); |
6218 } | 6118 } |
6219 if ( wParam != 114 ) | 6119 if ( wParam != 114 ) |
6220 { | 6120 { |
6221 if ( wParam == 115 && !pVideoPlayer->AnyMovieLoaded() ) | 6121 if ( wParam == 115 && !pVideoPlayer->AnyMovieLoaded() ) |
6222 SendMessageA(hWnd, 0x111u, 0x68u, 0); | 6122 SendMessageA(hWnd, 0x111u, 0x68u, 0); |
6223 //goto _def_wnd_proc; | |
6224 return DefWindowProcA(hWnd, Msg, wParam, lParam); | 6123 return DefWindowProcA(hWnd, Msg, wParam, lParam); |
6225 } | 6124 } |
6226 SendMessageA(hWnd, WM_COMMAND, 103, 0); | 6125 SendMessageA(hWnd, WM_COMMAND, 103, 0); |
6227 return 0; | 6126 return 0; |
6228 } | 6127 } |