comparison Game.cpp @ 2445:b10125a9c772

fix crash in keyboard option
author Ritor1
date Thu, 24 Jul 2014 12:44:14 +0600
parents 702cc7e6eefd
children 90349b8048a5
comparison
equal deleted inserted replaced
2442:702cc7e6eefd 2445:b10125a9c772
1087 } 1087 }
1088 } 1088 }
1089 //----- (004304E7) -------------------------------------------------------- 1089 //----- (004304E7) --------------------------------------------------------
1090 void GameUI_MsgProc() 1090 void GameUI_MsgProc()
1091 { 1091 {
1092 //signed int v0; // edi@6
1093 //char *v1; // esi@6
1094 unsigned int v2; // edx@7 1092 unsigned int v2; // edx@7
1095 Actor *pActor; // ecx@13 1093 Actor *pActor; // ecx@13
1096 int v4; // ecx@18 1094 int v4; // ecx@18
1097 //NPCData *pNPCData0; // eax@18
1098 //int v6; // edx@20
1099 //int v7; // ecx@29
1100 //unsigned int v8; // edx@59
1101 //unsigned int v9; // ecx@60
1102 unsigned int v10; // ecx@73 1095 unsigned int v10; // ecx@73
1103 //unsigned int v11; // eax@75
1104 unsigned __int8 v12; // sf@75
1105 unsigned __int8 v13; // of@75
1106 int v14; // eax@98 1096 int v14; // eax@98
1107 unsigned int v15; // eax@102
1108 unsigned __int8 v16; // al@104
1109 unsigned __int8 v17; // al@105
1110 int v18; // eax@106 1097 int v18; // eax@106
1111 float v19; // ST64_4@121 1098 float v19; // ST64_4@121
1112 // unsigned int v20; // ecx@121
1113 float v21; // ST64_4@126 1099 float v21; // ST64_4@126
1114 float v22; // ST64_4@127 1100 float v22; // ST64_4@127
1115 // unsigned int v23; // ecx@135
1116 unsigned int v24; // ecx@149 1101 unsigned int v24; // ecx@149
1117 // unsigned int v25; // ecx@165
1118 // GUIWindow *pWindow; // eax@204
1119 // unsigned int v27; // edx@204
1120 // unsigned int v28; // ecx@204
1121 GUIWindow *pWindow2; // ecx@248 1102 GUIWindow *pWindow2; // ecx@248
1122 //int v30; // edx@258 1103 bool pKeyBindingFlag; // eax@269
1123 //const char *v31; // ecx@262
1124 signed int v32; // eax@269
1125 unsigned int v33; // eax@277 1104 unsigned int v33; // eax@277
1126 unsigned __int8 v34; // al@279
1127 unsigned __int8 v35; // al@280
1128 //GUIWindow *pWindow3; // ecx@332
1129 int v37; // eax@341 1105 int v37; // eax@341
1130 int v38; // eax@358 1106 int v38; // eax@358
1131 SHORT v39; // ax@365 1107 SHORT v39; // ax@365
1132 //signed int v40; // eax@365
1133 char *v41; // eax@380 1108 char *v41; // eax@380
1134 int v42; // eax@396 1109 int v42; // eax@396
1135 // POINT *pPoint; // eax@397
1136 signed int v44; // eax@398 1110 signed int v44; // eax@398
1137 int v45; // edx@398 1111 int v45; // edx@398
1138 signed int v46; // ecx@398 1112 signed int v46; // ecx@398
1139 char v47; // zf@399 1113 char v47; // zf@399
1140 char v48; // zf@405 1114 char v48; // zf@405
1141 BLVFace *pBLVFace; // ecx@410 1115 BLVFace *pBLVFace; // ecx@410
1142 ODMFace *pODMFace; // ecx@412 1116 ODMFace *pODMFace; // ecx@412
1143 CastSpellInfo *pSpellInfo; // ecx@415 1117 CastSpellInfo *pSpellInfo; // ecx@415
1144 // void *v52; // eax@424
1145 __int16 v53; // ax@431 1118 __int16 v53; // ax@431
1146 int v54; // eax@432 1119 int v54; // eax@432
1147 int v55; // ecx@432 1120 int v55; // ecx@432
1148 int v56; // edx@432 1121 int v56; // edx@432
1149 int v57; // eax@432 1122 int v57; // eax@432
1150 Player *pPlayer; // edx@442 1123 Player *pPlayer; // edx@442
1151 unsigned int pMapNum; // eax@445 1124 unsigned int pMapNum; // eax@445
1152 signed int v60; // ST64_4@459 1125 signed int v60; // ST64_4@459
1153 //NPCData *pNPCData2; // eax@467
1154 //unsigned __int64 v62; // kr00_8@467
1155 __int16 v63; // dx@479 1126 __int16 v63; // dx@479
1156 unsigned int v64; // eax@486 1127 unsigned int v64; // eax@486
1157 int v65; // ecx@486 1128 int v65; // ecx@486
1158 int v66; // eax@488 1129 int v66; // eax@488
1159 char *v67; // eax@489 1130 char *v67; // eax@489
1166 signed int v74; // edi@535 1137 signed int v74; // edi@535
1167 int v75; // eax@535 1138 int v75; // eax@535
1168 int v76; // esi@535 1139 int v76; // esi@535
1169 int v77; // eax@537 1140 int v77; // eax@537
1170 Player *pPlayer2; // ecx@549 1141 Player *pPlayer2; // ecx@549
1171 //int v79; // ecx@550
1172 //unsigned int v80; // edx@550
1173 signed int v81; // eax@552 1142 signed int v81; // eax@552
1174 // POINT *pPoint2; // eax@553
1175 signed int v83; // ecx@554 1143 signed int v83; // ecx@554
1176 signed int v84; // ecx@554 1144 signed int v84; // ecx@554
1177 GUIButton *pButton; // eax@578 1145 GUIButton *pButton; // eax@578
1178 unsigned int v86; // eax@583 1146 unsigned int v86; // eax@583
1179 const char *v87; // ecx@595 1147 const char *v87; // ecx@595
1180 const char *v88; // ecx@596 1148 const char *v88; // ecx@596
1181 //unsigned int v89; // eax@598
1182 unsigned int v90; // eax@602 1149 unsigned int v90; // eax@602
1183 int v91; // edx@605 1150 int v91; // edx@605
1184 int v92; // eax@605 1151 int v92; // eax@605
1185 int v93; // edx@605 1152 int v93; // edx@605
1186 int pPlayerNum; // edx@611 1153 int pPlayerNum; // edx@611
1187 int v95; // eax@611 1154 int v95; // eax@611
1188 //const char *v96; // ecx@621
1189 unsigned int v97; // eax@624 1155 unsigned int v97; // eax@624
1190 int v98; // eax@636 1156 int v98; // eax@636
1191 // unsigned __int8 v99; // al@643
1192 // Player *pPlayer3; // eax@648
1193 // int v101; // ecx@648
1194 // int v102; // edx@652
1195 int v103; // eax@671 1157 int v103; // eax@671
1196 Player *pPlayer4; // ecx@718 1158 Player *pPlayer4; // ecx@718
1197 int v105; // eax@718 1159 int v105; // eax@718
1198 Player *pPlayer5; // ST78_4@758 1160 Player *pPlayer5; // ST78_4@758
1199 unsigned int v107; // eax@758 1161 unsigned int v107; // eax@758
1200 unsigned int v108; // eax@758 1162 unsigned int v108; // eax@758
1201 unsigned int v115; // eax@764 1163 unsigned int v115; // eax@764
1202 int v116; // eax@776 1164 int v116; // eax@776
1203 // POINT *pPoint3; // eax@777
1204 unsigned int v118; // eax@785 1165 unsigned int v118; // eax@785
1205 unsigned int v119; // ecx@786 1166 unsigned int v119; // ecx@786
1206 // unsigned int v120; // [sp-28h] [bp-624h]@86
1207 unsigned int v121; // [sp-28h] [bp-624h]@711 1167 unsigned int v121; // [sp-28h] [bp-624h]@711
1208 // unsigned int v122; // [sp-24h] [bp-620h]@86
1209 unsigned int v123; // [sp-24h] [bp-620h]@711 1168 unsigned int v123; // [sp-24h] [bp-620h]@711
1210 // unsigned int v124; // [sp-20h] [bp-61Ch]@86
1211 unsigned int v125; // [sp-20h] [bp-61Ch]@711 1169 unsigned int v125; // [sp-20h] [bp-61Ch]@711
1212 // unsigned int v126; // [sp-1Ch] [bp-618h]@86
1213 int v127; // [sp-1Ch] [bp-618h]@107 1170 int v127; // [sp-1Ch] [bp-618h]@107
1214 unsigned int v128; // [sp-1Ch] [bp-618h]@711 1171 unsigned int v128; // [sp-1Ch] [bp-618h]@711
1215 // int v129; // [sp-18h] [bp-614h]@86
1216 //signed int v130; // [sp-18h] [bp-614h]@107
1217 // int v131; // [sp-14h] [bp-610h]@86
1218 //unsigned int v132; // [sp-14h] [bp-610h]@107
1219 //unsigned int v133; // [sp-10h] [bp-60Ch]@60
1220 // unsigned int v134; // [sp-10h] [bp-60Ch]@86
1221 //signed int v135; // [sp-10h] [bp-60Ch]@107
1222 // unsigned int v136; // [sp-10h] [bp-60Ch]@121
1223 //unsigned int v137; // [sp-Ch] [bp-608h]@60
1224 // unsigned int v138; // [sp-Ch] [bp-608h]@86
1225 //signed int v139; // [sp-Ch] [bp-608h]@107
1226 // unsigned int v140; // [sp-Ch] [bp-608h]@121
1227 // enum WindowType pWindowType; // [sp-8h] [bp-604h]@56
1228 //enum WindowType pWindowType1; // [sp-8h] [bp-604h]@60
1229 // unsigned __int8 v143; // [sp-8h] [bp-604h]@86
1230 //int v144; // [sp-8h] [bp-604h]@107
1231 // enum WindowType pWindowType2; // [sp-8h] [bp-604h]@121
1232 //const char *v146; // [sp-8h] [bp-604h]@449
1233 //unsigned int v147; // [sp-8h] [bp-604h]@550
1234 //int v148; // [sp-4h] [bp-600h]@56
1235 GUIButton *pButton2; // [sp-4h] [bp-600h]@59 1172 GUIButton *pButton2; // [sp-4h] [bp-600h]@59
1236 // const char *v150; // [sp-4h] [bp-600h]@86
1237 //unsigned int v151; // [sp-4h] [bp-600h]@107
1238 // int v152; // [sp-4h] [bp-600h]@121
1239 // int v153; // [sp-4h] [bp-600h]@135
1240 //int v154; // [sp-4h] [bp-600h]@149
1241 // int v155; // [sp-4h] [bp-600h]@165
1242 // int v156; // [sp-4h] [bp-600h]@204
1243 //const char *v157; // [sp-4h] [bp-600h]@444
1244 //unsigned int v158; // [sp-4h] [bp-600h]@449
1245 //__int16 v159; // [sp-4h] [bp-600h]@550
1246 // int v160; // [sp-4h] [bp-600h]@599
1247 const char *v161; // [sp-4h] [bp-600h]@637 1173 const char *v161; // [sp-4h] [bp-600h]@637
1248 //int v162; // [sp+0h] [bp-5FCh]@56
1249 //int v163; // [sp+0h] [bp-5FCh]@59
1250 // Texture *pTexture; // [sp+0h] [bp-5FCh]@86
1251 //int v165; // [sp+0h] [bp-5FCh]@107
1252 // int v166; // [sp+0h] [bp-5FCh]@121
1253 // int v167; // [sp+0h] [bp-5FCh]@135
1254 //int v168; // [sp+0h] [bp-5FCh]@149
1255 // int v169; // [sp+0h] [bp-5FCh]@165
1256 // int v170; // [sp+0h] [bp-5FCh]@204
1257 //signed int v171; // [sp+0h] [bp-5FCh]@259
1258 KeyToggleType pKeyToggleType; // [sp+0h] [bp-5FCh]@287 1174 KeyToggleType pKeyToggleType; // [sp+0h] [bp-5FCh]@287
1259 char *v173; // [sp+0h] [bp-5FCh]@444 1175 char *v173; // [sp+0h] [bp-5FCh]@444
1260 char *v174; // [sp+0h] [bp-5FCh]@449 1176 char *v174; // [sp+0h] [bp-5FCh]@449
1261 //int v175; // [sp+0h] [bp-5FCh]@550
1262 // int v176; // [sp+0h] [bp-5FCh]@599
1263 const char *v177; // [sp+0h] [bp-5FCh]@629 1177 const char *v177; // [sp+0h] [bp-5FCh]@629
1264 char *v178; // [sp+0h] [bp-5FCh]@637 1178 char *v178; // [sp+0h] [bp-5FCh]@637
1265 // int v179; // [sp+4h] [bp-5F8h]@0
1266 //signed int _this; // [sp+14h] [bp-5E8h]@22
1267 // signed int thisa; // [sp+14h] [bp-5E8h]@251
1268 signed int thisb; // [sp+14h] [bp-5E8h]@272 1179 signed int thisb; // [sp+14h] [bp-5E8h]@272
1269 Player *pPlayer7; // [sp+14h] [bp-5E8h]@373 1180 Player *pPlayer7; // [sp+14h] [bp-5E8h]@373
1270 Player *pPlayer8; // [sp+14h] [bp-5E8h]@377 1181 Player *pPlayer8; // [sp+14h] [bp-5E8h]@377
1271 char *pMapName; // [sp+14h] [bp-5E8h]@445 1182 char *pMapName; // [sp+14h] [bp-5E8h]@445
1272 Player *pPlayer9; // [sp+14h] [bp-5E8h]@455 1183 Player *pPlayer9; // [sp+14h] [bp-5E8h]@455
1273 int thisg; // [sp+14h] [bp-5E8h]@467 1184 int thisg; // [sp+14h] [bp-5E8h]@467
1274 int thish; // [sp+14h] [bp-5E8h]@528 1185 int thish; // [sp+14h] [bp-5E8h]@528
1275 signed int thisi; // [sp+14h] [bp-5E8h]@535 1186 signed int thisi; // [sp+14h] [bp-5E8h]@535
1276 MapInfo *pMapInfo; // [sp+14h] [bp-5E8h]@604 1187 MapInfo *pMapInfo; // [sp+14h] [bp-5E8h]@604
1277 Player *pPlayer10; // [sp+14h] [bp-5E8h]@641 1188 Player *pPlayer10; // [sp+14h] [bp-5E8h]@641
1278 // int thisl; // [sp+14h] [bp-5E8h]@648
1279 int uMessageParam; // [sp+18h] [bp-5E4h]@7 1189 int uMessageParam; // [sp+18h] [bp-5E4h]@7
1280 int uAction; // [sp+1Ch] [bp-5E0h]@18 1190 int uAction; // [sp+1Ch] [bp-5E0h]@18
1281 NPCData *pNPCData4; // [sp+20h] [bp-5DCh]@23 1191 NPCData *pNPCData4; // [sp+20h] [bp-5DCh]@23
1282 unsigned int uNumSeconds; // [sp+24h] [bp-5D8h]@18 1192 unsigned int uNumSeconds; // [sp+24h] [bp-5D8h]@18
1283 char v197; // [sp+2Bh] [bp-5D1h]@101 1193 char v197; // [sp+2Bh] [bp-5D1h]@101
1284 enum UIMessageType uMessage; // [sp+2Ch] [bp-5D0h]@7 1194 enum UIMessageType uMessage; // [sp+2Ch] [bp-5D0h]@7
1285 unsigned int v199; // [sp+30h] [bp-5CCh]@7 1195 unsigned int v199; // [sp+30h] [bp-5CCh]@7
1286 char *v200; // [sp+34h] [bp-5C8h]@518 1196 char *v200; // [sp+34h] [bp-5C8h]@518
1287 // POINT v201; // [sp+38h] [bp-5C4h]@553
1288 POINT v202; // [sp+40h] [bp-5BCh]@141 1197 POINT v202; // [sp+40h] [bp-5BCh]@141
1289 POINT a2; // [sp+48h] [bp-5B4h]@127 1198 POINT a2; // [sp+48h] [bp-5B4h]@127
1290 // POINT v204; // [sp+50h] [bp-5ACh]@777
1291 POINT v205; // [sp+58h] [bp-5A4h]@171 1199 POINT v205; // [sp+58h] [bp-5A4h]@171
1292 // POINT v206; // [sp+60h] [bp-59Ch]@553
1293 POINT v207; // [sp+68h] [bp-594h]@155 1200 POINT v207; // [sp+68h] [bp-594h]@155
1294 // POINT v208; // [sp+70h] [bp-58Ch]@397
1295 // POINT v209; // [sp+78h] [bp-584h]@777
1296 // POINT v210; // [sp+80h] [bp-57Ch]@397
1297 POINT v211; // [sp+88h] [bp-574h]@704 1201 POINT v211; // [sp+88h] [bp-574h]@704
1298 //__int64 v212; // [sp+90h] [bp-56Ch]@467
1299 int v213; // [sp+98h] [bp-564h]@385 1202 int v213; // [sp+98h] [bp-564h]@385
1300 char pLevelName[32]; // [sp+9Ch] [bp-560h]@380 1203 char pLevelName[32]; // [sp+9Ch] [bp-560h]@380
1301 char pOut[32]; // [sp+BCh] [bp-540h]@370 1204 char pOut[32]; // [sp+BCh] [bp-540h]@370
1302 FrameTableTxtLine v216; // [sp+DCh] [bp-520h]@524 1205 FrameTableTxtLine v216; // [sp+DCh] [bp-520h]@524
1303 int v217[9]; // [sp+158h] [bp-4A4h]@652 1206 int v217[9]; // [sp+158h] [bp-4A4h]@652
1304 FrameTableTxtLine v218; // [sp+17Ch] [bp-480h]@524 1207 FrameTableTxtLine v218; // [sp+17Ch] [bp-480h]@524
1305 char a1[64]; // [sp+1F8h] [bp-404h]@467 1208 char a1[64]; // [sp+1F8h] [bp-404h]@467
1306 char Str2[128]; // [sp+238h] [bp-3C4h]@527 1209 char Str2[128]; // [sp+238h] [bp-3C4h]@527
1307 Actor actor; // [sp+2B8h] [bp-344h]@4 1210 Actor actor; // [sp+2B8h] [bp-344h]@4
1308 //unsigned short* screenshot;
1309 int currHour; 1211 int currHour;
1310 1212
1311 dword_50CDC8 = 0; 1213 dword_50CDC8 = 0;
1312 if ( !pEventTimer->bPaused ) 1214 if ( !pEventTimer->bPaused )
1313 { 1215 {
1436 pCurrentScreen = SCREEN_GAME; 1338 pCurrentScreen = SCREEN_GAME;
1437 viewparams->bRedrawGameUI = 1; 1339 viewparams->bRedrawGameUI = 1;
1438 } 1340 }
1439 else 1341 else
1440 { 1342 {
1441 ShowStatusBarString(pGlobalTXT_LocalizationStrings[201], 2u);// "Are you sure? Click again to start a New Game" 1343 ShowStatusBarString(pGlobalTXT_LocalizationStrings[201], 2);// "Are you sure? Click again to start a New Game"
1442 pAudioPlayer->PlaySound(SOUND_20001, 0, 0, -1, 0, 0, 0, 0); 1344 pAudioPlayer->PlaySound(SOUND_20001, 0, 0, -1, 0, 0, 0, 0);
1443 dword_6BE138 = 124; 1345 dword_6BE138 = 124;
1444 } 1346 }
1445 stru_506E40.Release(); 1347 stru_506E40.Release();
1446 continue; 1348 continue;
1631 uTextureID_Optkb[1] = pIcons_LOD->LoadTexture("optkb_h", TEXTURE_16BIT_PALETTE); 1533 uTextureID_Optkb[1] = pIcons_LOD->LoadTexture("optkb_h", TEXTURE_16BIT_PALETTE);
1632 uTextureID_Optkb[2] = pIcons_LOD->LoadTexture("resume1", TEXTURE_16BIT_PALETTE); 1534 uTextureID_Optkb[2] = pIcons_LOD->LoadTexture("resume1", TEXTURE_16BIT_PALETTE);
1633 uTextureID_Optkb[3] = pIcons_LOD->LoadTexture("optkb_1", TEXTURE_16BIT_PALETTE); 1535 uTextureID_Optkb[3] = pIcons_LOD->LoadTexture("optkb_1", TEXTURE_16BIT_PALETTE);
1634 uTextureID_Optkb[4] = pIcons_LOD->LoadTexture("optkb_2", TEXTURE_16BIT_PALETTE); 1536 uTextureID_Optkb[4] = pIcons_LOD->LoadTexture("optkb_2", TEXTURE_16BIT_PALETTE);
1635 pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, window->GetWidth(), window->GetHeight(), WINDOW_KeyMappingOptions, 0, 0); 1537 pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, window->GetWidth(), window->GetHeight(), WINDOW_KeyMappingOptions, 0, 0);
1636 pGUIWindow_CurrentMenu->CreateButton(0xF1u, 0x12Eu, 0xD6u, 0x28u, 1, 0, UIMSG_Escape, 0, 0, "", 0); 1538
1637 pGUIWindow_CurrentMenu->CreateButton(19u, 0x12Eu, 0x6Cu, 0x14u, 1, 0, UIMSG_SelectKeyPage1, 0, 0, "", 0); 1539 pGUIWindow_CurrentMenu->CreateButton(241, 302, 214, 40, 1, 0, UIMSG_Escape, 0, 0, "", 0);
1638 pGUIWindow_CurrentMenu->CreateButton(127u, 0x12Eu, 0x6Cu, 0x14u, 1, 0, UIMSG_SelectKeyPage2, 0, 0, "", 0); 1540
1639 pGUIWindow_CurrentMenu->CreateButton(127u, 0x144u, 0x6Cu, 0x14u, 1, 0, UIMSG_ResetKeyMapping, 0, 0, "", 0); 1541 pGUIWindow_CurrentMenu->CreateButton(19, 302, 108, 20, 1, 0, UIMSG_SelectKeyPage1, 0, 0, "", 0);
1640 pGUIWindow_CurrentMenu->CreateButton(19u, 0x144u, 0x6Cu, 0x14u, 1, 0, UIMSG_Game_OpenOptionsDialog, 0, 0, "", 0); 1542 pGUIWindow_CurrentMenu->CreateButton(127, 302, 108, 20, 1, 0, UIMSG_SelectKeyPage2, 0, 0, "", 0);
1641 pGUIWindow_CurrentMenu->CreateButton(129u, 0x94u, 0x46u, 0x13u, 1, 0, UIMSG_ChangeKeyButton, 0, 0, "", 0); 1543 pGUIWindow_CurrentMenu->CreateButton(127, 324, 108, 20, 1, 0, UIMSG_ResetKeyMapping, 0, 0, "", 0);
1642 pGUIWindow_CurrentMenu->CreateButton(129u, 0xA7u, 0x46u, 0x13u, 1, 0, UIMSG_ChangeKeyButton, 1u, 0, "", 0); 1544 pGUIWindow_CurrentMenu->CreateButton(19, 324, 108, 20, 1, 0, UIMSG_Game_OpenOptionsDialog, 0, 0, "", 0);
1643 pGUIWindow_CurrentMenu->CreateButton(129u, 0xBAu, 0x46u, 0x13u, 1, 0, UIMSG_ChangeKeyButton, 2u, 0, "", 0); 1545
1644 pGUIWindow_CurrentMenu->CreateButton(129u, 0xCDu, 0x46u, 0x13u, 1, 0, UIMSG_ChangeKeyButton, 3u, 0, "", 0); 1546 pGUIWindow_CurrentMenu->CreateButton(129, 148, 70, 19, 1, 0, UIMSG_ChangeKeyButton, 0, 0, "", 0);
1645 pGUIWindow_CurrentMenu->CreateButton(129u, 224u, 70u, 19u, 1, 0, UIMSG_ChangeKeyButton, 4u, 0, "", 0); 1547 pGUIWindow_CurrentMenu->CreateButton(129, 167, 70, 19, 1, 0, UIMSG_ChangeKeyButton, 1, 0, "", 0);
1646 pGUIWindow_CurrentMenu->CreateButton(129u, 243u, 70u, 0x13u, 1, 0, UIMSG_ChangeKeyButton, 5u, 0, "", 0); 1548 pGUIWindow_CurrentMenu->CreateButton(129, 186, 70, 19, 1, 0, UIMSG_ChangeKeyButton, 2, 0, "", 0);
1647 pGUIWindow_CurrentMenu->CreateButton(129u, 262u, 70u, 0x13u, 1, 0, UIMSG_ChangeKeyButton, 6u, 0, "", 0); 1549 pGUIWindow_CurrentMenu->CreateButton(129, 205, 70, 19, 1, 0, UIMSG_ChangeKeyButton, 3, 0, "", 0);
1648 pGUIWindow_CurrentMenu->CreateButton(350u, 148u, 70u, 0x13u, 1, 0, UIMSG_ChangeKeyButton, 7u, 0, "", 0); 1550 pGUIWindow_CurrentMenu->CreateButton(129, 224, 70, 19, 1, 0, UIMSG_ChangeKeyButton, 4, 0, "", 0);
1649 pGUIWindow_CurrentMenu->CreateButton(350u, 167u, 70u, 0x13u, 1, 0, UIMSG_ChangeKeyButton, 8u, 0, "", 0); 1551 pGUIWindow_CurrentMenu->CreateButton(129, 243, 70, 19, 1, 0, UIMSG_ChangeKeyButton, 5, 0, "", 0);
1650 pGUIWindow_CurrentMenu->CreateButton(350u, 186u, 70u, 0x13u, 1, 0, UIMSG_ChangeKeyButton, 9u, 0, "", 0); 1552 pGUIWindow_CurrentMenu->CreateButton(129, 262, 70, 19, 1, 0, UIMSG_ChangeKeyButton, 6, 0, "", 0);
1651 pGUIWindow_CurrentMenu->CreateButton(350u, 205u, 70u, 0x13u, 1, 0, UIMSG_ChangeKeyButton, 0xAu, 0, "", 0); 1553 pGUIWindow_CurrentMenu->CreateButton(350, 148, 70, 19, 1, 0, UIMSG_ChangeKeyButton, 7, 0, "", 0);
1652 pGUIWindow_CurrentMenu->CreateButton(350u, 224u, 70u, 0x13u, 1, 0, UIMSG_ChangeKeyButton, 0xBu, 0, "", 0); 1554 pGUIWindow_CurrentMenu->CreateButton(350, 167, 70, 19, 1, 0, UIMSG_ChangeKeyButton, 8, 0, "", 0);
1653 pGUIWindow_CurrentMenu->CreateButton(350u, 243u, 70u, 0x13u, 1, 0, UIMSG_ChangeKeyButton, 0xCu, 0, "", 0); 1555 pGUIWindow_CurrentMenu->CreateButton(350, 186, 70, 19, 1, 0, UIMSG_ChangeKeyButton, 9, 0, "", 0);
1654 pGUIWindow_CurrentMenu->CreateButton(350u, 262u, 70u, 0x13u, 1, 0, UIMSG_ChangeKeyButton, 0xDu, 0, "", 0); 1556 pGUIWindow_CurrentMenu->CreateButton(350, 205, 70, 19, 1, 0, UIMSG_ChangeKeyButton, 10, 0, "", 0);
1557 pGUIWindow_CurrentMenu->CreateButton(350, 224, 70, 19, 1, 0, UIMSG_ChangeKeyButton, 11, 0, "", 0);
1558 pGUIWindow_CurrentMenu->CreateButton(350, 243, 70, 19, 1, 0, UIMSG_ChangeKeyButton, 12, 0, "", 0);
1559 pGUIWindow_CurrentMenu->CreateButton(350, 262, 70, 19, 1, 0, UIMSG_ChangeKeyButton, 13, 0, "", 0);
1560
1655 uGameMenuUI_CurentlySelectedKeyIdx = -1; 1561 uGameMenuUI_CurentlySelectedKeyIdx = -1;
1656 KeyboardPageNum = 1; 1562 KeyboardPageNum = 1;
1657 memset(GameMenuUI_InvaligKeyBindingsFlags.data(), 0, sizeof(GameMenuUI_InvaligKeyBindingsFlags)); 1563 memset(GameMenuUI_InvaligKeyBindingsFlags.data(), 0, sizeof(GameMenuUI_InvaligKeyBindingsFlags));
1658 //*(_WORD *)KeyButtonArray[28] = 0; 1564 //*(_WORD *)KeyButtonArray[28] = 0;
1659 memcpy(pPrevVirtualCidesMapping.data(), pKeyActionMap->pVirtualKeyCodesMapping, 0x78u); 1565 memcpy(pPrevVirtualCidesMapping.data(), pKeyActionMap->pVirtualKeyCodesMapping, 0x78u);
1660 //v1 = "";
1661 //v0 = 1;
1662 continue; 1566 continue;
1663 case UIMSG_ChangeKeyButton: 1567 case UIMSG_ChangeKeyButton:
1664 if ( uGameMenuUI_CurentlySelectedKeyIdx != -1 ) 1568 if ( uGameMenuUI_CurentlySelectedKeyIdx != -1 )
1665 { 1569 {
1666 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); 1570 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0);
1673 pKeyActionMap->EnterText(0, 1, pGUIWindow_CurrentMenu); 1577 pKeyActionMap->EnterText(0, 1, pGUIWindow_CurrentMenu);
1674 continue; 1578 continue;
1675 case UIMSG_ResetKeyMapping: 1579 case UIMSG_ResetKeyMapping:
1676 v197 = 1; 1580 v197 = 1;
1677 pKeyActionMap->SetDefaultMapping(); 1581 pKeyActionMap->SetDefaultMapping();
1678 uAction = 0; 1582 for ( uint i = 0; i < 28; i++ )
1679 do 1583 {
1680 { 1584 if ( pKeyActionMap->GetActionVKey((enum InputAction)i) != pPrevVirtualCidesMapping[i] )
1681 v15 = pKeyActionMap->GetActionVKey((enum InputAction)uAction);
1682 if ( v15 != pPrevVirtualCidesMapping[uAction] )
1683 { 1585 {
1684 if ( v197 ) 1586 if ( v197 )
1685 { 1587 {
1686 v16 = pKeyActionMap->GetActionVKey((enum InputAction)uAction); 1588 GUI_ReplaceHotkey(LOBYTE(pPrevVirtualCidesMapping[i]), pKeyActionMap->GetActionVKey((enum InputAction)i), 1);
1687 GUI_ReplaceHotkey(LOBYTE(pPrevVirtualCidesMapping[uAction]), v16, 1);
1688 v197 = 0; 1589 v197 = 0;
1689 } 1590 }
1690 else 1591 else
1691 { 1592 GUI_ReplaceHotkey(LOBYTE(pPrevVirtualCidesMapping[i]), pKeyActionMap->GetActionVKey((enum InputAction)i), 0);
1692 v17 = pKeyActionMap->GetActionVKey((enum InputAction)uAction); 1593 }
1693 GUI_ReplaceHotkey(LOBYTE(pPrevVirtualCidesMapping[uAction]), v17, 0); 1594 pPrevVirtualCidesMapping[i] = pKeyActionMap->GetActionVKey((enum InputAction)i);
1694 } 1595 GameMenuUI_InvaligKeyBindingsFlags[i] = false;
1695 } 1596 }
1696 pPrevVirtualCidesMapping[uAction] = pKeyActionMap->GetActionVKey((enum InputAction)uAction);
1697 v18 = uAction++;
1698 v13 = uAction > 28;
1699 v12 = uAction - 28 < 0;
1700 GameMenuUI_InvaligKeyBindingsFlags[v18] = 0;
1701 }
1702 while ( v12 ^ v13 );
1703 pAudioPlayer->PlaySound((SoundID)219, 0, 0, -1, 0, 0, 0, 0); 1597 pAudioPlayer->PlaySound((SoundID)219, 0, 0, -1, 0, 0, 0, 0);
1704 continue; 1598 continue;
1705 case UIMSG_SelectKeyPage1: 1599 case UIMSG_SelectKeyPage1:
1706 KeyboardPageNum = 1; 1600 KeyboardPageNum = 1;
1707 continue; 1601 continue;
2219 stru_506E40.Release(); 2113 stru_506E40.Release();
2220 break; 2114 break;
2221 2115
2222 case SCREEN_KEYBOARD_OPTIONS://Return to game 2116 case SCREEN_KEYBOARD_OPTIONS://Return to game
2223 v197 = 1; 2117 v197 = 1;
2224 v32 = 0; 2118 pKeyBindingFlag = false;
2225 while ( !GameMenuUI_InvaligKeyBindingsFlags[v32]) 2119 for ( uint i = 0; i < 28; ++i )
2226 { 2120 {
2227 ++v32; 2121 if ( GameMenuUI_InvaligKeyBindingsFlags[i] )
2228 if ( v32 >= 28 ) 2122 pKeyBindingFlag = true;
2123 }
2124 if ( !pKeyBindingFlag )
2125 {
2126 for ( uint i = 0; i < 5; i++ )
2229 { 2127 {
2230 thisb = (signed int)&uTextureID_Optkb; 2128 if ( uTextureID_Optkb[i] )
2231 assert(false && "Invalid condition values"); 2129 pIcons_LOD->pTextures[uTextureID_Optkb[i]].Release();
2232 do 2130 }
2131 memset(&uTextureID_Optkb, 0, 20);
2132 pIcons_LOD->SyncLoadedFilesCount();
2133 for ( uint i = 0; i < 28; ++i )
2134 {
2135 if ( pKeyActionMap->GetActionVKey((enum InputAction)i) != pPrevVirtualCidesMapping[i] )
2233 { 2136 {
2234 if ( *(int *)thisb ) 2137 if ( v197 )
2235 pIcons_LOD->pTextures[*(int *)thisb].Release(); 2138 {
2236 thisb += 4; 2139 GUI_ReplaceHotkey(pKeyActionMap->GetActionVKey((enum InputAction)i), LOBYTE(pPrevVirtualCidesMapping[i]), 1);
2140 v197 = 0;
2141 }
2142 else
2143 GUI_ReplaceHotkey(pKeyActionMap->GetActionVKey((enum InputAction)i), LOBYTE(pPrevVirtualCidesMapping[i]), 0);
2237 } 2144 }
2238 while ( thisb < (signed int)0x00507C08 ); 2145 if ( i > 3 && i != 25 && i != 26 )
2239 2146 pKeyToggleType = TOGGLE_OneTimePress;
2240 memset(&uTextureID_Optkb, 0, 0x14u); 2147 else
2241 pIcons_LOD->SyncLoadedFilesCount(); 2148 pKeyToggleType = TOGGLE_Continuously;
2242 for ( uAction = 0; uAction < 28; ++uAction ) 2149 pKeyActionMap->SetKeyMapping(i, pPrevVirtualCidesMapping[i], pKeyToggleType);
2243 {
2244 v33 = pKeyActionMap->GetActionVKey((enum InputAction)uAction);
2245 if ( v33 != pPrevVirtualCidesMapping[uAction] )
2246 {
2247 if ( v197 )
2248 {
2249 v34 = pKeyActionMap->GetActionVKey((enum InputAction)uAction);
2250 GUI_ReplaceHotkey(v34, LOBYTE(pPrevVirtualCidesMapping[uAction]), 1);
2251 v197 = 0;
2252 }
2253 else
2254 {
2255 v35 = pKeyActionMap->GetActionVKey((enum InputAction)uAction);
2256 GUI_ReplaceHotkey(v35, LOBYTE(pPrevVirtualCidesMapping[uAction]), 0);
2257 }
2258 }
2259 if ( uAction && uAction != 2 && uAction != 3 && uAction != 1 && uAction != 25 && uAction != 26 )
2260 pKeyToggleType = TOGGLE_OneTimePress;
2261 else
2262 pKeyToggleType = TOGGLE_Continuously;
2263 pKeyActionMap->SetKeyMapping(uAction, pPrevVirtualCidesMapping[uAction], pKeyToggleType);
2264 }
2265 pKeyActionMap->StoreMappings();
2266 stru_506E40.Release();
2267 break;
2268 } 2150 }
2151 pKeyActionMap->StoreMappings();
2152 stru_506E40.Release();
2153 break;
2269 } 2154 }
2155 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0);
2270 break; 2156 break;
2271 case SCREEN_REST://close rest screen 2157 case SCREEN_REST://close rest screen
2272 if ( dword_506F14 ) 2158 if ( dword_506F14 )
2273 { 2159 {
2274 Rest(_506F18_num_minutes_to_sleep); 2160 Rest(_506F18_num_minutes_to_sleep);