comparison mm7_5.cpp @ 1048:d36681a9e4f8

Слияние
author Ritor1
date Thu, 23 May 2013 11:17:01 +0600
parents d3f4c6584ada 682ba1c83fd3
children 05c62d166182
comparison
equal deleted inserted replaced
1047:76ce871b0076 1048:d36681a9e4f8
273 { 273 {
274 //Actor::Actor(&actor); 274 //Actor::Actor(&actor);
275 memset(&actor, 0, 0x344u); 275 memset(&actor, 0, 0x344u);
276 dword_5B65D0_dialogue_actor_npc_id = bDialogueUI_InitializeActor_NPC_ID; 276 dword_5B65D0_dialogue_actor_npc_id = bDialogueUI_InitializeActor_NPC_ID;
277 actor.sNPC_ID = bDialogueUI_InitializeActor_NPC_ID; 277 actor.sNPC_ID = bDialogueUI_InitializeActor_NPC_ID;
278 actor.InitializeDialogue(0); 278 GameUI_InitializeDialogue(&actor, false);
279 bDialogueUI_InitializeActor_NPC_ID = 0; 279 bDialogueUI_InitializeActor_NPC_ID = 0;
280 } 280 }
281 if ( pMessageQueue_50CBD0->uNumMessages ) 281 if ( pMessageQueue_50CBD0->uNumMessages )
282 { 282 {
283 //v1 = ""; 283 //v1 = "";
304 if ( pMessageQueue_50CBD0->uNumMessages ) 304 if ( pMessageQueue_50CBD0->uNumMessages )
305 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; 305 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
306 dword_5B65D0_dialogue_actor_npc_id = pActors[uMessageParam].sNPC_ID; 306 dword_5B65D0_dialogue_actor_npc_id = pActors[uMessageParam].sNPC_ID;
307 pActor = &pActors[uMessageParam]; 307 pActor = &pActors[uMessageParam];
308 //goto _actor_init_dlg; 308 //goto _actor_init_dlg;
309 pActor->InitializeDialogue(1); 309 GameUI_InitializeDialogue(pActor, true);
310 continue; 310 continue;
311 case UIMSG_StartHireling1Dialogue: 311 case UIMSG_StartHireling1Dialogue:
312 case UIMSG_StartHireling2Dialogue: 312 case UIMSG_StartHireling2Dialogue:
313 { 313 {
314 if (bNoNPCHiring || pCurrentScreen) 314 if (bNoNPCHiring || pCurrentScreen)
357 { 357 {
358 //Actor::Actor(&actor); 358 //Actor::Actor(&actor);
359 memset(&actor, 0, 0x344u); 359 memset(&actor, 0, 0x344u);
360 actor.sNPC_ID += -1 - (unsigned __int8)pParty->field_709 - hireling_idx; 360 actor.sNPC_ID += -1 - (unsigned __int8)pParty->field_709 - hireling_idx;
361 pActor = &actor; 361 pActor = &actor;
362 pActor->InitializeDialogue(1); 362 GameUI_InitializeDialogue(&actor, true);
363 } 363 }
364 } 364 }
365 continue; 365 continue;
366 366
367 case UIMSG_BuyInShop_Identify_Repair: 367 case UIMSG_BuyInShop_Identify_Repair:
404 pIcons_LOD->_4114F2(); 404 pIcons_LOD->_4114F2();
405 if ( pMessageQueue_50CBD0->uNumMessages ) 405 if ( pMessageQueue_50CBD0->uNumMessages )
406 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; 406 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
407 pGUIWindow_CurrentMenu->Release(); 407 pGUIWindow_CurrentMenu->Release();
408 pCurrentScreen = SCREEN_LOADGAME; 408 pCurrentScreen = SCREEN_LOADGAME;
409 GameUI_DrawLoadMenu(1); 409 LoadUI_Load(1);
410 continue; 410 continue;
411 case UIMSG_Quit: 411 case UIMSG_Quit:
412 if ( dword_6BE138 == 132 || uMessageParam ) 412 if ( dword_6BE138 == 132 || uMessageParam )
413 { 413 {
414 pIcons_LOD->SyncLoadedFilesCount(); 414 pIcons_LOD->SyncLoadedFilesCount();
455 continue; 455 continue;
456 case UIMSG_SaveLoadBtn: 456 case UIMSG_SaveLoadBtn:
457 GUIWindow::Create(241, 302, 106, 42, WINDOW_SaveLoadBtn, (int)pBtnLoadSlot, 0); 457 GUIWindow::Create(241, 302, 106, 42, WINDOW_SaveLoadBtn, (int)pBtnLoadSlot, 0);
458 continue; 458 continue;
459 case UIMSG_SelectLoadSlot: 459 case UIMSG_SelectLoadSlot:
460 if ( pGUIWindow_CurrentMenu->field_40 == 1 ) 460 if ( pGUIWindow_CurrentMenu->receives_keyboard_input_2 == WINDOW_INPUT_IN_PROGRESS)
461 pKeyActionMap->_459ED1(0); 461 pKeyActionMap->SetWindowInputStatus(WINDOW_INPUT_NONE);
462 if ( pCurrentScreen != SCREEN_SAVEGAME || uLoadGameUI_SelectedSlot != pSaveListPosition + uMessageParam ) 462 if ( pCurrentScreen != SCREEN_SAVEGAME || uLoadGameUI_SelectedSlot != pSaveListPosition + uMessageParam )
463 { 463 {
464 v10 = pSaveListPosition + uMessageParam; 464 v10 = pSaveListPosition + uMessageParam;
465 if ( dword_6BE138 == pSaveListPosition + uMessageParam ) 465 if ( dword_6BE138 == pSaveListPosition + uMessageParam )
466 { 466 {
467 pMessageQueue_50CBD0->AddMessage(UIMSG_SaveLoadBtn, 0, 0); 467 pMessageQueue_50CBD0->AddMessage(UIMSG_SaveLoadBtn, 0, 0);
468 pMessageQueue_50CBD0->AddMessage(UIMSG_LoadGame, 0, 0); 468 pMessageQueue_50CBD0->AddMessage(UIMSG_LoadGame, 0, 0);
469 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 )
470 {
471 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_SaveLoadBtn;
472 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0;
473 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0;
474 //v11 = pMessageQueue_50CBD0->uNumMessages + 1;
475 //v13 = pMessageQueue_50CBD0->uNumMessages + 1 > 40;
476 //v12 = (signed int)pMessageQueue_50CBD0->uNumMessages - 39 < 0;
477 ++pMessageQueue_50CBD0->uNumMessages;
478 if ( v12 ^ v13 )
479 {
480 pMessageQueue_50CBD0->pMessages[v11].eType = UIMSG_LoadGame;
481 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0;
482 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0;
483 ++pMessageQueue_50CBD0->uNumMessages;
484 }
485 }*/
486 } 469 }
487 uLoadGameUI_SelectedSlot = v10; 470 uLoadGameUI_SelectedSlot = v10;
488 dword_6BE138 = v10; 471 dword_6BE138 = v10;
489 } 472 }
490 else 473 else
502 uGameState = GAME_STATE_3; 485 uGameState = GAME_STATE_3;
503 } 486 }
504 stru_506E40.Release(); 487 stru_506E40.Release();
505 continue; 488 continue;
506 case UIMSG_SaveGame: 489 case UIMSG_SaveGame:
507 if ( pGUIWindow_CurrentMenu->field_40 == 1 ) 490 if ( pGUIWindow_CurrentMenu->receives_keyboard_input_2 == WINDOW_INPUT_IN_PROGRESS)
508 { 491 {
509 pKeyActionMap->_459ED1(0); 492 pKeyActionMap->SetWindowInputStatus(WINDOW_INPUT_NONE);
510 strcpy((char *)&pSavegameHeader[uLoadGameUI_SelectedSlot], (const char *)pKeyActionMap->pPressedKeysBuffer); 493 strcpy((char *)&pSavegameHeader[uLoadGameUI_SelectedSlot], (const char *)pKeyActionMap->pPressedKeysBuffer);
511 } 494 }
512 DoSavegame(uLoadGameUI_SelectedSlot); 495 DoSavegame(uLoadGameUI_SelectedSlot);
513 stru_506E40.Release(); 496 stru_506E40.Release();
514 continue; 497 continue;
515 case UIMSG_Game_OpenSaveGameDialog: 498 case UIMSG_Game_OpenSaveGameDialog:
516 pGUIWindow_CurrentMenu->Release(); 499 pGUIWindow_CurrentMenu->Release();
517 pCurrentScreen = SCREEN_SAVEGAME; 500 pCurrentScreen = SCREEN_SAVEGAME;
518 GameUI_DrawSaveMenu(); 501 SaveUI_Load();
519 continue; 502 continue;
520 case UIMSG_Game_OpenOptionsDialog://Open 503 case UIMSG_Game_OpenOptionsDialog://Open
521 if ( pMessageQueue_50CBD0->uNumMessages ) 504 if ( pMessageQueue_50CBD0->uNumMessages )
522 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; 505 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
523 pGUIWindow_CurrentMenu->Release(); 506 pGUIWindow_CurrentMenu->Release();
622 pGUIWindow_CurrentMenu->CreateButton(350u, 186u, 70u, 0x13u, 1, 0, UIMSG_ChangeKeyButton, 9u, 0, "", 0); 605 pGUIWindow_CurrentMenu->CreateButton(350u, 186u, 70u, 0x13u, 1, 0, UIMSG_ChangeKeyButton, 9u, 0, "", 0);
623 pGUIWindow_CurrentMenu->CreateButton(350u, 205u, 70u, 0x13u, 1, 0, UIMSG_ChangeKeyButton, 0xAu, 0, "", 0); 606 pGUIWindow_CurrentMenu->CreateButton(350u, 205u, 70u, 0x13u, 1, 0, UIMSG_ChangeKeyButton, 0xAu, 0, "", 0);
624 pGUIWindow_CurrentMenu->CreateButton(350u, 224u, 70u, 0x13u, 1, 0, UIMSG_ChangeKeyButton, 0xBu, 0, "", 0); 607 pGUIWindow_CurrentMenu->CreateButton(350u, 224u, 70u, 0x13u, 1, 0, UIMSG_ChangeKeyButton, 0xBu, 0, "", 0);
625 pGUIWindow_CurrentMenu->CreateButton(350u, 243u, 70u, 0x13u, 1, 0, UIMSG_ChangeKeyButton, 0xCu, 0, "", 0); 608 pGUIWindow_CurrentMenu->CreateButton(350u, 243u, 70u, 0x13u, 1, 0, UIMSG_ChangeKeyButton, 0xCu, 0, "", 0);
626 pGUIWindow_CurrentMenu->CreateButton(350u, 262u, 70u, 0x13u, 1, 0, UIMSG_ChangeKeyButton, 0xDu, 0, "", 0); 609 pGUIWindow_CurrentMenu->CreateButton(350u, 262u, 70u, 0x13u, 1, 0, UIMSG_ChangeKeyButton, 0xDu, 0, "", 0);
627 dword_506E68 = -1; 610 uGameMenuUI_CurentlySelectedKeyIdx = -1;
628 KeyboardPageNum = 1; 611 KeyboardPageNum = 1;
629 memset(KeyButtonFlagChangesArray, 0, sizeof(KeyButtonFlagChangesArray)); 612 memset(GameMenuUI_InvaligKeyBindingsFlags, 0, sizeof(GameMenuUI_InvaligKeyBindingsFlags));
630 //*(_WORD *)KeyButtonArray[28] = 0; 613 //*(_WORD *)KeyButtonArray[28] = 0;
631 memcpy(pPrevVirtualCidesMapping, pKeyActionMap->pVirtualKeyCodesMapping, 0x78u); 614 memcpy(pPrevVirtualCidesMapping, pKeyActionMap->pVirtualKeyCodesMapping, 0x78u);
632 //v1 = ""; 615 //v1 = "";
633 //v0 = 1; 616 //v0 = 1;
634 continue; 617 continue;
635 case UIMSG_ChangeKeyButton: 618 case UIMSG_ChangeKeyButton:
636 if ( dword_506E68 != -1 ) 619 if ( uGameMenuUI_CurentlySelectedKeyIdx != -1 )
637 { 620 {
638 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); 621 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0);
639 continue; 622 continue;
640 } 623 }
641 v14 = uMessageParam; 624 v14 = uMessageParam;
642 if ( KeyboardPageNum != 1 ) 625 if ( KeyboardPageNum != 1 )
643 v14 = uMessageParam + 14; 626 v14 = uMessageParam + 14;
644 dword_506E68 = v14; 627 uGameMenuUI_CurentlySelectedKeyIdx = v14;
645 pKeyActionMap->EnterText(0, 1, pGUIWindow_CurrentMenu); 628 pKeyActionMap->EnterText(0, 1, pGUIWindow_CurrentMenu);
646 continue; 629 continue;
647 case UIMSG_ResetKeyMapping: 630 case UIMSG_ResetKeyMapping:
648 v197 = 1; 631 v197 = 1;
649 pKeyActionMap->SetDefaultMapping(); 632 pKeyActionMap->SetDefaultMapping();
667 } 650 }
668 pPrevVirtualCidesMapping[uAction] = pKeyActionMap->GetActionVKey((enum InputAction)uAction); 651 pPrevVirtualCidesMapping[uAction] = pKeyActionMap->GetActionVKey((enum InputAction)uAction);
669 v18 = uAction++; 652 v18 = uAction++;
670 v13 = uAction > 28; 653 v13 = uAction > 28;
671 v12 = uAction - 28 < 0; 654 v12 = uAction - 28 < 0;
672 KeyButtonFlagChangesArray[v18] = 0; 655 GameMenuUI_InvaligKeyBindingsFlags[v18] = 0;
673 } 656 }
674 while ( v12 ^ v13 ); 657 while ( v12 ^ v13 );
675 pAudioPlayer->PlaySound((SoundID)219, 0, 0, -1, 0, 0, 0, 0); 658 pAudioPlayer->PlaySound((SoundID)219, 0, 0, -1, 0, 0, 0, 0);
676 continue; 659 continue;
677 case UIMSG_SelectKeyPage1: 660 case UIMSG_SelectKeyPage1:
1197 //v30 = uGammaPos; 1180 //v30 = uGammaPos;
1198 //v31 = "GammaPos"; 1181 //v31 = "GammaPos";
1199 WriteWindowsRegistryInt("GammaPos", uGammaPos); 1182 WriteWindowsRegistryInt("GammaPos", uGammaPos);
1200 stru_506E40.Release(); 1183 stru_506E40.Release();
1201 break; 1184 break;
1185
1202 case SCREEN_KEYBOARD_OPTIONS://Return to game 1186 case SCREEN_KEYBOARD_OPTIONS://Return to game
1203 v197 = 1; 1187 v197 = 1;
1204 v32 = 0; 1188 v32 = 0;
1205 while ( KeyButtonFlagChangesArray[v32] != 1 ) 1189 while ( !GameMenuUI_InvaligKeyBindingsFlags[v32])
1206 { 1190 {
1207 ++v32; 1191 ++v32;
1208 if ( v32 >= 28 ) 1192 if ( v32 >= 28 )
1209 { 1193 {
1210 thisb = (signed int)&uTextureID_Optkb; 1194 thisb = (signed int)&uTextureID_Optkb;
1195 assert(false && "Invalid condition values");
1211 do 1196 do
1212 { 1197 {
1213 if ( *(int *)thisb ) 1198 if ( *(int *)thisb )
1214 pIcons_LOD->pTextures[*(int *)thisb].Release(); 1199 pIcons_LOD->pTextures[*(int *)thisb].Release();
1215 thisb += 4; 1200 thisb += 4;
1216 } 1201 }
1217 while ( thisb < (signed int)&dword_507C08 ); 1202 while ( thisb < (signed int)0x00507C08 );
1203
1218 memset(&uTextureID_Optkb, 0, 0x14u); 1204 memset(&uTextureID_Optkb, 0, 0x14u);
1219 pIcons_LOD->SyncLoadedFilesCount(); 1205 pIcons_LOD->SyncLoadedFilesCount();
1220 uAction = 0; 1206 uAction = 0;
1221 do 1207 do
1222 { 1208 {
1339 if ( pGUIWindow_CurrentMenu == window_SpeakInHouse ) 1325 if ( pGUIWindow_CurrentMenu == window_SpeakInHouse )
1340 window_SpeakInHouse = 0; 1326 window_SpeakInHouse = 0;
1341 pGUIWindow_CurrentMenu = 0; 1327 pGUIWindow_CurrentMenu = 0;
1342 pEventTimer->Resume(); 1328 pEventTimer->Resume();
1343 pCurrentScreen = SCREEN_GAME; 1329 pCurrentScreen = SCREEN_GAME;
1344 viewparams->bRedrawGameUI = 1; 1330 viewparams->bRedrawGameUI = true;
1345 pIcons_LOD->_4355F7(); 1331 pIcons_LOD->_4355F7();
1346 continue; 1332 continue;
1347 case SCREEN_INPUT_BLV://click escape 1333 case SCREEN_INPUT_BLV://click escape
1348 if ( uCurrentHouse_Animation == 153 ) 1334 if ( uCurrentHouse_Animation == 153 )
1349 PlayHouseSound(0x99u, HouseSound_Greeting_2); 1335 PlayHouseSound(0x99u, HouseSound_Greeting_2);
1350 pVideoPlayer->Unload(); 1336 pVideoPlayer->Unload();
1351 if ( dword_5B65CC ) 1337 if ( dword_5B65CC )
1352 { 1338 {
1353 pParty->field_709 = 0; 1339 pParty->field_709 = 0;
1354 LOBYTE(pNPCStats->pNewNPCData[dword_5B65CC].uFlags) &= 0x7Fu; 1340 LOBYTE(pNPCStats->pNewNPCData[dword_5B65CC].uFlags) &= 0x7Fu;
1355 Party__CountHirelings(); 1341 pParty->CountHirelings();
1356 viewparams->bRedrawGameUI = 1; 1342 viewparams->bRedrawGameUI = true;
1357 dword_5B65CC = 0; 1343 dword_5B65CC = 0;
1358 } 1344 }
1359 DialogueEnding(); 1345 DialogueEnding();
1360 pCurrentScreen = SCREEN_GAME; 1346 pCurrentScreen = SCREEN_GAME;
1361 viewparams->bRedrawGameUI = 1; 1347 viewparams->bRedrawGameUI = true;
1362 continue; 1348 continue;
1363 case SCREEN_NPC_DIALOGUE://click escape 1349 case SCREEN_NPC_DIALOGUE://click escape
1364 if ( dword_5B65CC ) 1350 if ( dword_5B65CC )
1365 { 1351 {
1366 pParty->field_709 = 0; 1352 pParty->field_709 = 0;
1367 LOBYTE(pNPCStats->pNewNPCData[dword_5B65CC].uFlags) &= 0x7Fu; 1353 LOBYTE(pNPCStats->pNewNPCData[dword_5B65CC].uFlags) &= 0x7Fu;
1368 Party__CountHirelings(); 1354 pParty->CountHirelings();
1369 viewparams->bRedrawGameUI = 1; 1355 viewparams->bRedrawGameUI = true;
1370 dword_5B65CC = 0; 1356 dword_5B65CC = 0;
1371 } 1357 }
1372 //goto LABEL_317; 1358 //goto LABEL_317;
1373 DialogueEnding(); 1359 DialogueEnding();
1374 pCurrentScreen = SCREEN_GAME; 1360 pCurrentScreen = SCREEN_GAME;
1375 viewparams->bRedrawGameUI = 1; 1361 viewparams->bRedrawGameUI = true;
1376 continue; 1362 continue;
1377 case SCREEN_BRANCHLESS_NPC_DIALOG://click escape 1363 case SCREEN_BRANCHLESS_NPC_DIALOG://click escape
1378 memset(GameUI_Footer_TimedString, 0, 0xC8u); 1364 memset(GameUI_Footer_TimedString, 0, 0xC8u);
1379 sub_4452BB(); 1365 sub_4452BB();
1380 DialogueEnding(); 1366 DialogueEnding();
1381 pCurrentScreen = SCREEN_GAME; 1367 pCurrentScreen = SCREEN_GAME;
1382 viewparams->bRedrawGameUI = 1; 1368 viewparams->bRedrawGameUI = true;
1383 continue; 1369 continue;
1384 case SCREEN_CHANGE_LOCATION://click escape 1370 case SCREEN_CHANGE_LOCATION://click escape
1385 if ( pParty->vPosition.x < -22528 ) 1371 if ( pParty->vPosition.x < -22528 )
1386 pParty->vPosition.x = -22528; 1372 pParty->vPosition.x = -22528;
1387 if ( pParty->vPosition.x > 22528 ) 1373 if ( pParty->vPosition.x > 22528 )
1390 pParty->vPosition.y = -22528; 1376 pParty->vPosition.y = -22528;
1391 if ( pParty->vPosition.y > 22528 ) 1377 if ( pParty->vPosition.y > 22528 )
1392 pParty->vPosition.y = 22528; 1378 pParty->vPosition.y = 22528;
1393 DialogueEnding(); 1379 DialogueEnding();
1394 pCurrentScreen = SCREEN_GAME; 1380 pCurrentScreen = SCREEN_GAME;
1395 viewparams->bRedrawGameUI = 1; 1381 viewparams->bRedrawGameUI = true;
1396 continue; 1382 continue;
1397 case SCREEN_VIDEO: 1383 case SCREEN_VIDEO:
1398 pVideoPlayer->Unload(); 1384 pVideoPlayer->Unload();
1399 continue; 1385 continue;
1400 case SCREEN_CHARACTERS: 1386 case SCREEN_CHARACTERS:
1423 if ( pGUIWindow_CurrentMenu == window_SpeakInHouse ) 1409 if ( pGUIWindow_CurrentMenu == window_SpeakInHouse )
1424 window_SpeakInHouse = 0; 1410 window_SpeakInHouse = 0;
1425 pGUIWindow_CurrentMenu = 0; 1411 pGUIWindow_CurrentMenu = 0;
1426 pEventTimer->Resume(); 1412 pEventTimer->Resume();
1427 pCurrentScreen = SCREEN_GAME; 1413 pCurrentScreen = SCREEN_GAME;
1428 viewparams->bRedrawGameUI = 1; 1414 viewparams->bRedrawGameUI = true;
1429 pIcons_LOD->_4355F7(); 1415 pIcons_LOD->_4355F7();
1430 continue; 1416 continue;
1431 default: 1417 default:
1432 if ( pGUIWindow_Settings ) 1418 if ( pGUIWindow_Settings )
1433 { 1419 {
1479 if ( pGUIWindow_CurrentMenu == window_SpeakInHouse ) 1465 if ( pGUIWindow_CurrentMenu == window_SpeakInHouse )
1480 window_SpeakInHouse = 0; 1466 window_SpeakInHouse = 0;
1481 pGUIWindow_CurrentMenu = 0; 1467 pGUIWindow_CurrentMenu = 0;
1482 pEventTimer->Resume(); 1468 pEventTimer->Resume();
1483 pCurrentScreen = SCREEN_GAME; 1469 pCurrentScreen = SCREEN_GAME;
1484 viewparams->bRedrawGameUI = 1; 1470 viewparams->bRedrawGameUI = true;
1485 pIcons_LOD->_4355F7(); 1471 pIcons_LOD->_4355F7();
1486 continue; 1472 continue;
1487 } 1473 }
1488 CharacterUI_ReleaseButtons(); 1474 CharacterUI_ReleaseButtons();
1489 sub_419379(); 1475 sub_419379();
1511 if ( pGUIWindow_CurrentMenu == window_SpeakInHouse ) 1497 if ( pGUIWindow_CurrentMenu == window_SpeakInHouse )
1512 window_SpeakInHouse = 0; 1498 window_SpeakInHouse = 0;
1513 pGUIWindow_CurrentMenu = 0; 1499 pGUIWindow_CurrentMenu = 0;
1514 pEventTimer->Resume(); 1500 pEventTimer->Resume();
1515 pCurrentScreen = SCREEN_GAME; 1501 pCurrentScreen = SCREEN_GAME;
1516 viewparams->bRedrawGameUI = 1; 1502 viewparams->bRedrawGameUI = true;
1517 pIcons_LOD->_4355F7(); 1503 pIcons_LOD->_4355F7();
1518 continue; 1504 continue;
1519 } 1505 }
1520 if ( !pGUIWindow_Settings )//Draw Menu 1506 if ( !pGUIWindow_Settings )//Draw Menu
1521 { 1507 {
1522 dword_6BE138 = -1; 1508 dword_6BE138 = -1;
1523 GUIWindow::Create(0x25Au, 0x1C2u, 0, 0, WINDOW_PressedButton2, (int)pBtn_GameSettings, 1); 1509 GUIWindow::Create(0x25Au, 0x1C2u, 0, 0, WINDOW_PressedButton2, (int)pBtn_GameSettings, 1);
1524 pEventTimer->Pause(); 1510 pEventTimer->Pause();
1525 pAudioPlayer->StopChannels(-1, -1); 1511 pAudioPlayer->StopChannels(-1, -1);
1512 pCurrentScreen = SCREEN_MENU;
1513
1526 ++pIcons_LOD->uTexturePacksCount; 1514 ++pIcons_LOD->uTexturePacksCount;
1527 pCurrentScreen = 1;
1528 if ( !pIcons_LOD->uNumPrevLoadedFiles ) 1515 if ( !pIcons_LOD->uNumPrevLoadedFiles )
1529 pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles; 1516 pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles;
1517
1530 pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_OptionsButtons, 0, 0); 1518 pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_OptionsButtons, 0, 0);
1531 uTextureID_Options = pIcons_LOD->LoadTexture("options", TEXTURE_16BIT_PALETTE); 1519 uTextureID_Options = pIcons_LOD->LoadTexture("options", TEXTURE_16BIT_PALETTE);
1532 uTextureID_New1 = pIcons_LOD->LoadTexture("new1", TEXTURE_16BIT_PALETTE); 1520 uTextureID_New1 = pIcons_LOD->LoadTexture("new1", TEXTURE_16BIT_PALETTE);
1533 uTextureID_Load1 = pIcons_LOD->LoadTexture("load1", TEXTURE_16BIT_PALETTE); 1521 uTextureID_Load1 = pIcons_LOD->LoadTexture("load1", TEXTURE_16BIT_PALETTE);
1534 uTextureID_Save1 = pIcons_LOD->LoadTexture("save1", TEXTURE_16BIT_PALETTE); 1522 uTextureID_Save1 = pIcons_LOD->LoadTexture("save1", TEXTURE_16BIT_PALETTE);
1660 case UIMSG_TransitionWindowCloseBtn: 1648 case UIMSG_TransitionWindowCloseBtn:
1661 CloseWindowBackground(); 1649 CloseWindowBackground();
1662 pVideoPlayer->Unload(); 1650 pVideoPlayer->Unload();
1663 DialogueEnding(); 1651 DialogueEnding();
1664 start_event_seq_number = 0; 1652 start_event_seq_number = 0;
1665 viewparams->bRedrawGameUI = 1; 1653 viewparams->bRedrawGameUI = true;
1666 continue; 1654 continue;
1667 case UIMSG_CycleCharacters: 1655 case UIMSG_CycleCharacters:
1668 v39 = GetAsyncKeyState(VK_SHIFT); 1656 v39 = GetAsyncKeyState(VK_SHIFT);
1669 uActiveCharacter = CycleCharacter(v39); 1657 uActiveCharacter = CycleCharacter(v39);
1670 viewparams->bRedrawGameUI = 1; 1658 viewparams->bRedrawGameUI = true;
1671 continue; 1659 continue;
1672 case UIMSG_OnTravelByFoot: 1660 case UIMSG_OnTravelByFoot:
1673 if ( pMessageQueue_50CBD0->uNumMessages ) 1661 if ( pMessageQueue_50CBD0->uNumMessages )
1674 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; 1662 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
1675 dword_50CDC8 = 1; 1663 dword_50CDC8 = 1;
2488 dword_506F14 = 1; 2476 dword_506F14 = 1;
2489 _506F18_num_hours_to_sleep = 60; 2477 _506F18_num_hours_to_sleep = 60;
2490 continue; 2478 continue;
2491 case UIMSG_RentRoom: 2479 case UIMSG_RentRoom:
2492 dword_506F14 = 2; 2480 dword_506F14 = 2;
2493 RestUI_Initialize(); 2481 RestUI_Load();
2494 v86 = 60 * (_494820_training_time(pParty->uCurrentHour) + 1) - pParty->uCurrentMinute; 2482 v86 = 60 * (_494820_training_time(pParty->uCurrentHour) + 1) - pParty->uCurrentMinute;
2495 _506F18_num_hours_to_sleep = v86; 2483 _506F18_num_hours_to_sleep = v86;
2496 if ( uMessageParam == 111 || uMessageParam == 114 || uMessageParam == 116 ) 2484 if ( uMessageParam == 111 || uMessageParam == 114 || uMessageParam == 116 )
2497 _506F18_num_hours_to_sleep = v86 + 720; 2485 _506F18_num_hours_to_sleep = v86 + 720;
2498 dword_506F14 = 2; 2486 dword_506F14 = 2;
2529 ShowStatusBarString(pGlobalTXT_LocalizationStrings[478], 2);// "You can't rest in turn-based mode!" 2517 ShowStatusBarString(pGlobalTXT_LocalizationStrings[478], 2);// "You can't rest in turn-based mode!"
2530 continue; 2518 continue;
2531 } 2519 }
2532 if ( !(pParty->uFlags & 0x88) ) 2520 if ( !(pParty->uFlags & 0x88) )
2533 { 2521 {
2534 RestUI_Initialize(); 2522 RestUI_Load();
2535 continue; 2523 continue;
2536 } 2524 }
2537 if ( pParty->bTurnBasedModeOn == 1 ) 2525 if ( pParty->bTurnBasedModeOn == 1 )
2538 { 2526 {
2539 ShowStatusBarString(pGlobalTXT_LocalizationStrings[478], 2);// "You can't rest in turn-based mode!" 2527 ShowStatusBarString(pGlobalTXT_LocalizationStrings[478], 2);// "You can't rest in turn-based mode!"
3457 break; 3445 break;
3458 SetCurrentMenuID(MENU_LoadingProcInMainMenu); 3446 SetCurrentMenuID(MENU_LoadingProcInMainMenu);
3459 break; 3447 break;
3460 case UIMSG_SelectLoadSlot: 3448 case UIMSG_SelectLoadSlot:
3461 //main menu save/load wnd clicking on savegame lines 3449 //main menu save/load wnd clicking on savegame lines
3462 if (pGUIWindow_CurrentMenu->field_40 == 1) 3450 if (pGUIWindow_CurrentMenu->receives_keyboard_input_2 == WINDOW_INPUT_IN_PROGRESS)
3463 pKeyActionMap->_459ED1(0); 3451 pKeyActionMap->SetWindowInputStatus(WINDOW_INPUT_NONE);
3464 if ( pCurrentScreen != SCREEN_SAVEGAME || uLoadGameUI_SelectedSlot != pParam + pSaveListPosition ) 3452 if ( pCurrentScreen != SCREEN_SAVEGAME || uLoadGameUI_SelectedSlot != pParam + pSaveListPosition )
3465 { 3453 {
3466 //load clicked line 3454 //load clicked line
3467 v26 = pParam + pSaveListPosition; 3455 v26 = pParam + pSaveListPosition;
3468 if ( dword_6BE138 == pParam + pSaveListPosition ) 3456 if ( dword_6BE138 == pParam + pSaveListPosition )
4753 } 4741 }
4754 if ( SHIDWORD(pMonster->pActorBuffs[20].uExpireTime) >= (signed int)v41 4742 if ( SHIDWORD(pMonster->pActorBuffs[20].uExpireTime) >= (signed int)v41
4755 && (SHIDWORD(pMonster->pActorBuffs[20].uExpireTime) > (signed int)v41 4743 && (SHIDWORD(pMonster->pActorBuffs[20].uExpireTime) > (signed int)v41
4756 || LODWORD(pMonster->pActorBuffs[20].uExpireTime) > v41) 4744 || LODWORD(pMonster->pActorBuffs[20].uExpireTime) > v41)
4757 && uDamageAmount != v41 ) 4745 && uDamageAmount != v41 )
4758 player->ReceiveDamage(uDamageAmount, a2); 4746 player->ReceiveDamage(uDamageAmount, (DAMAGE_TYPE)a2);
4759 v50 = 24; 4747 v50 = 24;
4760 v59 = 20 * v61 / (signed int)pMonster->pMonsterInfo.uHP; 4748 v59 = 20 * v61 / (signed int)pMonster->pMonsterInfo.uHP;
4761 if ( (player->_48EA46_calc_special_bonus_by_items(24) || hit_will_stun != v41) 4749 if ( (player->_48EA46_calc_special_bonus_by_items(24) || hit_will_stun != v41)
4762 && stru_50C198.GetMagicalResistance(pMonster, 3u) ) 4750 && stru_50C198.GetMagicalResistance(pMonster, 3u) )
4763 { 4751 {
5005 v22 = v7->pMonsterInfo.uAttack1Type; 4993 v22 = v7->pMonsterInfo.uAttack1Type;
5006 } 4994 }
5007 LABEL_43: 4995 LABEL_43:
5008 if ( !(dword_6BE368_debug_settings_2 & 0x10) ) 4996 if ( !(dword_6BE368_debug_settings_2 & 0x10) )
5009 { 4997 {
5010 v24 = v6->ReceiveDamage(v77, v22); 4998 v24 = v6->ReceiveDamage(v77, (DAMAGE_TYPE)v22);
5011 if ( SHIDWORD(v6->pPlayerBuffs[10].uExpireTime) >= 0 4999 if ( SHIDWORD(v6->pPlayerBuffs[10].uExpireTime) >= 0
5012 && (SHIDWORD(v6->pPlayerBuffs[10].uExpireTime) > 0 || LODWORD(v6->pPlayerBuffs[10].uExpireTime)) ) 5000 && (SHIDWORD(v6->pPlayerBuffs[10].uExpireTime) > 0 || LODWORD(v6->pPlayerBuffs[10].uExpireTime)) )
5013 { 5001 {
5014 v25 = v7->uAIState; 5002 v25 = v7->uAIState;
5015 if ( v25 != 5 ) 5003 if ( v25 != 5 )
5068 v6->_48DCF6(v7->pMonsterInfo.uSpecialAttack, v7); 5056 v6->_48DCF6(v7->pMonsterInfo.uSpecialAttack, v7);
5069 } 5057 }
5070 if ( !pParty->bTurnBasedModeOn ) 5058 if ( !pParty->bTurnBasedModeOn )
5071 { 5059 {
5072 v35 = v6->GetActualEndurance(); 5060 v35 = v6->GetActualEndurance();
5073 v36 = (double)(20 - v6->_48EA1B_get_static_effect(v35)) * flt_6BE3A4_debug_recmod1 * 2.133333333333333; 5061 v36 = (double)(20 - v6->GetParameterBonus(v35)) * flt_6BE3A4_debug_recmod1 * 2.133333333333333;
5074 v6->SetRecoveryTime((signed __int64)v36); 5062 v6->SetRecoveryTime((signed __int64)v36);
5075 } 5063 }
5076 if ( v77 ) 5064 if ( v77 )
5077 { 5065 {
5078 v73 = (double)(signed int)v75; 5066 v73 = (double)(signed int)v75;
5190 else 5178 else
5191 v50 = 4; 5179 v50 = 4;
5192 LABEL_133: 5180 LABEL_133:
5193 if ( !(dword_6BE368_debug_settings_2 & 0x10) ) 5181 if ( !(dword_6BE368_debug_settings_2 & 0x10) )
5194 { 5182 {
5195 v54 = v45->ReceiveDamage(v77, v50); 5183 v54 = v45->ReceiveDamage(v77, (DAMAGE_TYPE)v50);
5196 if ( SHIDWORD(v45->pPlayerBuffs[10].uExpireTime) >= 0 ) 5184 if ( SHIDWORD(v45->pPlayerBuffs[10].uExpireTime) >= 0 )
5197 { 5185 {
5198 if ( SHIDWORD(v45->pPlayerBuffs[10].uExpireTime) > 0 || LODWORD(v45->pPlayerBuffs[10].uExpireTime) ) 5186 if ( SHIDWORD(v45->pPlayerBuffs[10].uExpireTime) > 0 || LODWORD(v45->pPlayerBuffs[10].uExpireTime) )
5199 { 5187 {
5200 v55 = v44->uAIState; 5188 v55 = v44->uAIState;
5256 && rand() % 100 < v44->pMonsterInfo.uLevel * v44->pMonsterInfo.uSpecialAttackType ) 5244 && rand() % 100 < v44->pMonsterInfo.uLevel * v44->pMonsterInfo.uSpecialAttackType )
5257 v45->_48DCF6(v44->pMonsterInfo.uSpecialAttack, v44); 5245 v45->_48DCF6(v44->pMonsterInfo.uSpecialAttack, v44);
5258 if ( !pParty->bTurnBasedModeOn ) 5246 if ( !pParty->bTurnBasedModeOn )
5259 { 5247 {
5260 v65 = v45->GetActualEndurance(); 5248 v65 = v45->GetActualEndurance();
5261 v66 = (double)(20 - v45->_48EA1B_get_static_effect(v65)) 5249 v66 = (double)(20 - v45->GetParameterBonus(v65))
5262 * flt_6BE3A4_debug_recmod1 5250 * flt_6BE3A4_debug_recmod1
5263 * 2.133333333333333; 5251 * 2.133333333333333;
5264 v45->SetRecoveryTime((signed __int64)v66); 5252 v45->SetRecoveryTime((signed __int64)v66);
5265 } 5253 }
5266 return; 5254 return;
5287 else 5275 else
5288 { 5276 {
5289 v68 = pParty->pPlayers[uActorID].CalculateRangedDamageTo(0); 5277 v68 = pParty->pPlayers[uActorID].CalculateRangedDamageTo(0);
5290 v69 = 0; 5278 v69 = 0;
5291 } 5279 }
5292 a4b->ReceiveDamage(v68, v69); 5280 a4b->ReceiveDamage(v68, (DAMAGE_TYPE)v69);
5293 if ( v38 == OBJECT_Player && !qword_A750D8 ) 5281 if ( v38 == OBJECT_Player && !qword_A750D8 )
5294 { 5282 {
5295 qword_A750D8 = 256i64; 5283 qword_A750D8 = 256i64;
5296 word_A750E0 = 44; 5284 word_A750E0 = 44;
5297 word_A750E2 = uActorID + 1; 5285 word_A750E2 = uActorID + 1;
5397 else 5385 else
5398 result = flt_4E4A80[0]; 5386 result = flt_4E4A80[0];
5399 } 5387 }
5400 else 5388 else
5401 { 5389 {
5402 result = (flt_4E4A80[v2] - *(float *)&aAuthenticamd[4 * v2 + 12]) 5390 result = (flt_4E4A80[v2] - flt_4E4A80[v2 - 3]) * (v3 - flt_4E4A80[v2 + 4]) / (flt_4E4A80[v2 + 5] - flt_4E4A80[v2 + 4]) + flt_4E4A80[v2];
5403 * (v3 - flt_4E4A80[v2 + 4])
5404 / (flt_4E4A80[v2 + 5] - flt_4E4A80[v2 + 4])
5405 + flt_4E4A80[v2];
5406 } 5391 }
5407 return result; 5392 return result;
5408 } 5393 }
5409 5394
5410 //----- (0043AFE3) -------------------------------------------------------- 5395 //----- (0043AFE3) --------------------------------------------------------
9749 } 9734 }
9750 return result; 9735 return result;
9751 } 9736 }
9752 9737
9753 9738
9754 //----- (00411150) --------------------------------------------------------
9755 void DrawTownPortalScreen()
9756 {
9757 //signed int v0; // edi@1
9758 //__int16 v1; // dx@8
9759 //POINT *v2; // edi@17
9760 int v3; // edi@17
9761 //__int16 v4; // dx@24
9762 GUIWindow v6; // [sp+Ch] [bp-64h]@1
9763 //POINT v7; // [sp+60h] [bp-10h]@17
9764 POINT a2; // [sp+68h] [bp-8h]@17
9765
9766 pRenderer->ClearZBuffer(0, 479);
9767 pRenderer->DrawTextureTransparent(8, 8, pTexture_CurrentBook);
9768 pRenderer->DrawTextureTransparent(471, 445, pIcons_LOD->GetTexture(uExitCancelTextureId));
9769
9770 v6.uFrameX = game_viewport_x;
9771 v6.uFrameY = game_viewport_y;
9772 v6.uFrameWidth = game_viewport_width;
9773 v6.uFrameHeight = game_viewport_height;
9774 v6.uFrameZ = game_viewport_z;
9775 v6.uFrameW = game_viewport_w;
9776
9777 const uint fountain_bits_lut[] = {PARTY_QUEST_FOUNTAIN_HARMONDALE,
9778 PARTY_QUEST_FOUNTAIN_PIERPONT,
9779 PARTY_QUEST_FOUNTAIN_NIGHON,
9780 PARTY_QUEST_FOUNTAIN_EVENMORN_ISLE,
9781 PARTY_QUEST_FOUNTAIN_CELESTIA,
9782 PARTY_QUEST_FOUNTAIN_THE_PIT};
9783 for (uint i = 0; i < 6; ++i)
9784 {
9785
9786 if (_449B57_test_bit(pParty->_quest_bits, fountain_bits_lut[i]))
9787 pRenderer->DrawMaskToZBuffer(pTownPortalBook_xs[i],
9788 pTownPortalBook_ys[i],
9789 pTexture_TownPortalIcons[i], i + 1);
9790 }
9791
9792 /* v0 = 0;
9793 do
9794 {
9795 if ( !v0 )
9796 {
9797 v1 = 206;
9798 LABEL_14:
9799 if ( !(unsigned __int16)_449B57_test_bit(pParty->_quest_bits, v1) )
9800 goto LABEL_16;
9801 goto LABEL_15;
9802 }
9803 if ( v0 == 1 )
9804 {
9805 v1 = 208;
9806 goto LABEL_14;
9807 }
9808 if ( v0 == 2 )
9809 {
9810 v1 = 207;
9811 goto LABEL_14;
9812 }
9813 if ( v0 == 3 )
9814 {
9815 v1 = 211;
9816 goto LABEL_14;
9817 }
9818 if ( v0 == 4 )
9819 {
9820 v1 = 209;
9821 goto LABEL_14;
9822 }
9823 if ( v0 == 5 )
9824 {
9825 v1 = 210;
9826 goto LABEL_14;
9827 }
9828 LABEL_15:
9829 pRenderer->DrawMaskToZBuffer(
9830 pTownPortalBook_xs[v0],
9831 pTownPortalBook_ys[v0],
9832 *(&pTexture_TownPortalHarmn + v0),
9833 v0 + 1);
9834 LABEL_16:
9835 ++v0;
9836 }
9837 while ( v0 < 6 );*/
9838
9839 pMouse->GetCursorPos(&a2);
9840 //v2 = pMouse->GetCursorPos(&a2);
9841 v3 = pRenderer->pActiveZBuffer[a2.x + pSRZBufferLineOffsets[a2.y]] & 0xFFFF;
9842
9843 if (v3)
9844 {
9845 if (_449B57_test_bit(pParty->_quest_bits, fountain_bits_lut[v3 - 1]))
9846 pRenderer->DrawTextureIndexed(pTownPortalBook_xs[v3 - 1], pTownPortalBook_ys[v3 - 1], pTexture_TownPortalIcons[v3 - 1]);
9847 }
9848 v6.DrawTitleText(pBook2Font, 0, 22u, 0, pGlobalTXT_LocalizationStrings[10], 3u);
9849
9850
9851 /* if ( !v3 ) // Town Portal
9852 {
9853 v6.DrawTitleText(pBook2Font, 0, 22, 0, pGlobalTXT_LocalizationStrings[10], 3); // "Town Portal"
9854 return;
9855 }
9856 if ( v3 == 1 )
9857 {
9858 v4 = 206;
9859 LABEL_30:
9860 if ( (unsigned __int16)_449B57_test_bit(pParty->_quest_bits, v4) )
9861 goto LABEL_31;
9862 v6.DrawTitleText(pBook2Font, 0, 22u, 0, pGlobalTXT_LocalizationStrings[10], 3u); // "Town Portal"
9863 return;
9864 }
9865 if ( v3 == 2 )
9866 {
9867 v4 = 208;
9868 goto LABEL_30;
9869 }
9870 if ( v3 == 3 )
9871 {
9872 v4 = 207;
9873 goto LABEL_30;
9874 }
9875 if ( v3 == 4 )
9876 {
9877 v4 = 211;
9878 goto LABEL_30;
9879 }
9880 if ( v3 == 5 )
9881 {
9882 v4 = 209;
9883 goto LABEL_30;
9884 }
9885 if ( v3 == 6 )
9886 {
9887 v4 = 210;
9888 goto LABEL_30;
9889 }
9890 LABEL_31:
9891 pRenderer->DrawTextureIndexed(word_4E1D3A[v3], pTownPortalBook_xs[v3 + 5], *(&pTex_tab_an_6b__zoom_on + v3));
9892 v6.DrawTitleText(pBook2Font, 0, 22u, 0, pGlobalTXT_LocalizationStrings[10], 3u);*/
9893 }
9894 // 4E1D3A: using guessed type __int16 word_4E1D3A[];
9895
9896
9897 //----- (00413FF1) -------------------------------------------------------- 9739 //----- (00413FF1) --------------------------------------------------------
9898 void SetMonthNames() 9740 void SetMonthNames()
9899 { 9741 {
9900 aMonthNames[0] = pGlobalTXT_LocalizationStrings[415]; 9742 aMonthNames[0] = pGlobalTXT_LocalizationStrings[415];
9901 aMonthNames[1] = pGlobalTXT_LocalizationStrings[416]; 9743 aMonthNames[1] = pGlobalTXT_LocalizationStrings[416];
9962 } 9804 }
9963 9805
9964 9806
9965 9807
9966 9808
9967
9968 //----- (004141CA) --------------------------------------------------------
9969 void ModalWindow(const char *pStr, int a4)
9970 {
9971 pEventTimer->Pause();
9972 dword_506F0C[0] = pCurrentScreen;
9973 ptr_507BDC = GUIWindow::Create(0, 0, 640, 480, WINDOW_FinalWindow, a4, (int)pStr);
9974 pCurrentScreen = SCREEN_PRESS_ESCAPE_MESSAGE;
9975 }
9976 // 4E28F8: using guessed type int pCurrentScreen;
9977
9978 //----- (0041420D) -------------------------------------------------------- 9809 //----- (0041420D) --------------------------------------------------------
9979 void __cdecl sub_41420D_press_esc() 9810 void __cdecl sub_41420D_press_esc()
9980 { 9811 {
9981 GUIWindow v0; // [sp+4h] [bp-54h]@1 9812 GUIWindow v0; // [sp+4h] [bp-54h]@1
9982 9813
9996 { 9827 {
9997 GUIWindow *v0; // ecx@1 9828 GUIWindow *v0; // ecx@1
9998 9829
9999 v0 = ptr_507BDC; 9830 v0 = ptr_507BDC;
10000 pMessageQueue_50CBD0->AddMessage((UIMessageType)(int)ptr_507BDC->ptr_1C, 0, 0); 9831 pMessageQueue_50CBD0->AddMessage((UIMessageType)(int)ptr_507BDC->ptr_1C, 0, 0);
10001 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) 9832
10002 {
10003 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)(int)ptr_507BDC->ptr_1C;
10004 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0;
10005 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0;
10006 ++pMessageQueue_50CBD0->uNumMessages;
10007 }*/
10008 v0->Release(); 9833 v0->Release();
10009 ptr_507BDC = 0; 9834 ptr_507BDC = 0;
10010 pCurrentScreen = dword_506F0C[0]; 9835 pCurrentScreen = dword_506F0C[0];
10011 pEventTimer->Resume(); 9836 pEventTimer->Resume();
10012 } 9837 }
10049 } 9874 }
10050 9875
10051 9876
10052 9877
10053 //----- (004156F0) -------------------------------------------------------- 9878 //----- (004156F0) --------------------------------------------------------
10054 void __cdecl GUI_UpdateWindows() 9879 void GUI_UpdateWindows()
10055 { 9880 {
10056 GUIWindow *pWindow; // esi@4 9881 GUIWindow *pWindow; // esi@4
10057 unsigned int pWindowType; // eax@4 9882 //unsigned int pWindowType; // eax@4
10058 char *pHint; // edx@66 9883 char *pHint; // edx@66
10059 GUIButton *pButtonPtr_1C; // ebp@79 9884 GUIButton *pButtonPtr_1C; // ebp@79
10060 char *pHint1; // edx@80 9885 char *pHint1; // edx@80
10061 int v26; // eax@98 9886 int v26; // eax@98
10062 unsigned int v27; // ebp@106 9887 unsigned int v27; // ebp@106
10080 UI_OnKeyDown(VK_NEXT); 9905 UI_OnKeyDown(VK_NEXT);
10081 9906
10082 for ( i = 1; i <= uNumVisibleWindows; ++i ) 9907 for ( i = 1; i <= uNumVisibleWindows; ++i )
10083 { 9908 {
10084 pWindow = &pWindowList[pVisibleWindowsIdxs[i] - 1]; 9909 pWindow = &pWindowList[pVisibleWindowsIdxs[i] - 1];
10085 pWindowType = pWindow->eWindowType;
10086 switch (pWindow->eWindowType) 9910 switch (pWindow->eWindowType)
10087 { 9911 {
10088 case WINDOW_OptionsButtons: 9912 case WINDOW_OptionsButtons:
10089 { 9913 {
10090 pRenderer->DrawTextureIndexed(pViewport->uViewportTL_Y, 9914 pRenderer->DrawTextureIndexed(pViewport->uViewportTL_Y,
10097 CharacterUI_CharacterScreen_Draw(pPlayers[uActiveCharacter]); 9921 CharacterUI_CharacterScreen_Draw(pPlayers[uActiveCharacter]);
10098 continue; 9922 continue;
10099 } 9923 }
10100 case WINDOW_Options: 9924 case WINDOW_Options:
10101 { 9925 {
10102 DrawGameOptions(); 9926 GameMenuUI_Options_Draw();
10103 continue; 9927 continue;
10104 } 9928 }
10105 case WINDOW_Book: 9929 case WINDOW_Book:
10106 { 9930 {
10107 BookUI_Draw((WindowType)(int)pWindow->ptr_1C); 9931 BookUI_Draw((WindowType)(int)pWindow->ptr_1C);
10108 continue; 9932 continue;
10109 } 9933 }
10110 case WINDOW_Dialogue: 9934 case WINDOW_Dialogue:
10111 { 9935 {
10112 DrawDialogueUI(); 9936 GameUI_DrawDialogue();
10113 continue; 9937 continue;
10114 } 9938 }
10115 case WINDOW_QuickReference: 9939 case WINDOW_QuickReference:
10116 { 9940 {
10117 GameUI_QuickRef_Draw(); 9941 GameUI_QuickRef_Draw();
10132 DrawSpellBookContent(pPlayers[uActiveCharacter]); 9956 DrawSpellBookContent(pPlayers[uActiveCharacter]);
10133 continue; 9957 continue;
10134 } 9958 }
10135 case WINDOW_GreetingNPC: 9959 case WINDOW_GreetingNPC:
10136 { 9960 {
10137 DrawBranchlessDialogueUI(); 9961 GameUI_DrawBranchlessDialogue();
10138 continue; 9962 continue;
10139 } 9963 }
10140 case WINDOW_Chest: 9964 case WINDOW_Chest:
10141 { 9965 {
10142 if ( pCurrentScreen == SCREEN_CHEST ) 9966 if ( pCurrentScreen == SCREEN_CHEST )
10152 } 9976 }
10153 continue; 9977 continue;
10154 } 9978 }
10155 case WINDOW_SaveLoadButtons: 9979 case WINDOW_SaveLoadButtons:
10156 { 9980 {
10157 sub_4606FE(); 9981 SaveUI_Draw();
10158 continue; 9982 continue;
10159 } 9983 }
10160 case WINDOW_MainMenu_Load: 9984 case WINDOW_MainMenu_Load:
10161 { 9985 {
10162 GameUI_MainMenu_DrawLoad(); 9986 LoadUI_Draw();
10163 continue; 9987 continue;
10164 } 9988 }
10165 case WINDOW_HouseInterior: 9989 case WINDOW_HouseInterior:
10166 { 9990 {
10167 pWindowList[pVisibleWindowsIdxs[i] - 1].HouseDialogManager(); 9991 pWindowList[pVisibleWindowsIdxs[i] - 1].HouseDialogManager();
10206 continue; 10030 continue;
10207 } 10031 }
10208 case WINDOW_50: 10032 case WINDOW_50:
10209 { 10033 {
10210 v27 = TargetColor(255, 255, 255); 10034 v27 = TargetColor(255, 255, 255);
10211 if ( ptr_507BD0->field_40 == 1 ) 10035 if ( ptr_507BD0->receives_keyboard_input_2 == WINDOW_INPUT_IN_PROGRESS)
10212 { 10036 {
10213 ptr_507BD0->DrawMessageBox(0); 10037 ptr_507BD0->DrawMessageBox(0);
10214 ptr_507BD0->DrawText(pFontCreate, 30, 40, v27, (const char *)pKeyActionMap->pPressedKeysBuffer, 0, 0, 0); 10038 ptr_507BD0->DrawText(pFontCreate, 30, 40, v27, (const char *)pKeyActionMap->pPressedKeysBuffer, 0, 0, 0);
10215 v31 = pFontCreate->GetLineWidth((const char *)pKeyActionMap->pPressedKeysBuffer); 10039 v31 = pFontCreate->GetLineWidth((const char *)pKeyActionMap->pPressedKeysBuffer);
10216 ptr_507BD0->DrawFlashingInputCursor(v31 + 30, 40, pFontCreate); 10040 ptr_507BD0->DrawFlashingInputCursor(v31 + 30, 40, pFontCreate);
10217 continue; 10041 continue;
10218 } 10042 }
10219 if ( ptr_507BD0->field_40 == 2 ) 10043 if ( ptr_507BD0->receives_keyboard_input_2 == WINDOW_INPUT_CONFIRMED)
10220 { 10044 {
10221 pWindow->field_40 = 0; 10045 pWindow->receives_keyboard_input_2 = WINDOW_INPUT_NONE;
10222 pMessageQueue_50CBD0->AddMessage((UIMessageType)(int)ptr_507BD0->ptr_1C, 0, 0); 10046 pMessageQueue_50CBD0->AddMessage((UIMessageType)(int)ptr_507BD0->ptr_1C, 0, 0);
10223 pEventTimer->Resume(); 10047 pEventTimer->Resume();
10224 ptr_507BD0->Release(); 10048 ptr_507BD0->Release();
10225 pCurrentScreen = 0; 10049 pCurrentScreen = SCREEN_GAME;
10226 viewparams->bRedrawGameUI = 1; 10050 viewparams->bRedrawGameUI = true;
10227 continue; 10051 continue;
10228 } 10052 }
10229 if ( ptr_507BD0->field_40 == 3 ) 10053 if ( ptr_507BD0->receives_keyboard_input_2 == WINDOW_INPUT_CANCELLED)
10230 { 10054 {
10231 pWindow->field_40 = 0; 10055 pWindow->receives_keyboard_input_2 = WINDOW_INPUT_NONE;
10232 pEventTimer->Resume(); 10056 pEventTimer->Resume();
10233 ptr_507BD0->Release(); 10057 ptr_507BD0->Release();
10234 continue; 10058 continue;
10235 } 10059 }
10236 } 10060 }
10243 { 10067 {
10244 ItemGen2.Reset(); 10068 ItemGen2.Reset();
10245 pWindow->Release(); 10069 pWindow->Release();
10246 pEventTimer->Resume(); 10070 pEventTimer->Resume();
10247 pCurrentScreen = 0; 10071 pCurrentScreen = 0;
10248 viewparams->bRedrawGameUI = 1; 10072 viewparams->bRedrawGameUI = true;
10249 v26 = atoi((const char *)pKeyActionMap->pPressedKeysBuffer); 10073 v26 = atoi((const char *)pKeyActionMap->pPressedKeysBuffer);
10250 if ( v26 > 0 ) 10074 if ( v26 > 0 )
10251 { 10075 {
10252 if ( v26 < 800 ) 10076 if ( v26 < 800 )
10253 { 10077 {
10420 case WINDOW_BooksWindow: 10244 case WINDOW_BooksWindow:
10421 { 10245 {
10422 pButton = (GUIButton *)pWindow->ptr_1C; 10246 pButton = (GUIButton *)pWindow->ptr_1C;
10423 pRenderer->DrawTextureIndexed(pWindow->uFrameY, 10247 pRenderer->DrawTextureIndexed(pWindow->uFrameY,
10424 pWindow->uFrameX, pButton->pTextures[0]); 10248 pWindow->uFrameX, pButton->pTextures[0]);
10425 viewparams->bRedrawGameUI = 1; 10249 viewparams->bRedrawGameUI = true;
10426 continue; 10250 continue;
10427 } 10251 }
10428 case WINDOW_CharacterWindow_Inventory: 10252 case WINDOW_CharacterWindow_Inventory:
10429 { 10253 {
10430 pWindow->DrawMessageBox(0); 10254 pWindow->DrawMessageBox(0);
10467 if ( sub_4637E0_is_there_popup_onscreen() ) 10291 if ( sub_4637E0_is_there_popup_onscreen() )
10468 sub_416D62_ShowPopupWindow_MonsterRecord_ItemInfo_etcsub_416D62(0); 10292 sub_416D62_ShowPopupWindow_MonsterRecord_ItemInfo_etcsub_416D62(0);
10469 } 10293 }
10470 10294
10471 //----- (00416196) -------------------------------------------------------- 10295 //----- (00416196) --------------------------------------------------------
10472 void __cdecl identify_item() 10296 void identify_item()
10473 { 10297 {
10474 Player *v0; // esi@2 10298 Player *v0; // esi@2
10475 POINT *v1; // edi@2 10299 POINT *v1; // edi@2
10476 signed int v2; // ecx@5 10300 signed int v2; // ecx@5
10477 signed int v3; // eax@5 10301 signed int v3; // eax@5
10751 } 10575 }
10752 if ( v51 == 1 ) 10576 if ( v51 == 1 )
10753 { 10577 {
10754 v0->RemoveItemAtInventoryIndex(v18); 10578 v0->RemoveItemAtInventoryIndex(v18);
10755 v26 = rand(); 10579 v26 = rand();
10756 v0->ReceiveDamage(v26 % 11 + 10, 0); 10580 v0->ReceiveDamage(v26 % 11 + 10, DMGT_FIRE);
10757 pAudioPlayer->PlaySound(SOUND_8, 0, 0, -1, 0, 0, 0, 0); 10581 pAudioPlayer->PlaySound(SOUND_8, 0, 0, -1, 0, 0, 0, 0);
10758 10582
10759 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); 10583 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0);
10760 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) 10584
10761 {
10762 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape;
10763 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0;
10764 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0;
10765 ++pMessageQueue_50CBD0->uNumMessages;
10766 }*/
10767 v42 = (int *)&a2.y; 10585 v42 = (int *)&a2.y;
10768 v41 = (int *)&y.y; 10586 v41 = (int *)&y.y;
10769 v40 = (int *)&pOut; 10587 v40 = (int *)&pOut;
10770 v39.z = pParty->vPosition.z + pParty->sEyelevel; 10588 v39.z = pParty->vPosition.z + pParty->sEyelevel;
10771 } 10589 }
10773 { 10591 {
10774 if ( v51 == 2 ) 10592 if ( v51 == 2 )
10775 { 10593 {
10776 v0->RemoveItemAtInventoryIndex(v18); 10594 v0->RemoveItemAtInventoryIndex(v18);
10777 v25 = rand(); 10595 v25 = rand();
10778 v0->ReceiveDamage(v25 % 71 + 30, 0); 10596 v0->ReceiveDamage(v25 % 71 + 30, DMGT_FIRE);
10779 v23 = 1; 10597 v23 = 1;
10780 } 10598 }
10781 else 10599 else
10782 { 10600 {
10783 if ( v51 == 3 ) 10601 if ( v51 == 3 )
10784 { 10602 {
10785 v0->RemoveItemAtInventoryIndex(v18); 10603 v0->RemoveItemAtInventoryIndex(v18);
10786 v24 = rand(); 10604 v24 = rand();
10787 v0->ReceiveDamage(v24 % 201 + 50, 0); 10605 v0->ReceiveDamage(v24 % 201 + 50, DMGT_FIRE);
10788 v23 = 5; 10606 v23 = 5;
10789 } 10607 }
10790 else 10608 else
10791 { 10609 {
10792 if ( v51 != 4 ) 10610 if ( v51 != 4 )
10833 } 10651 }
10834 v0->ItemsEnchant(v23); 10652 v0->ItemsEnchant(v23);
10835 pAudioPlayer->PlaySound(SOUND_8, 0, 0, -1, 0, 0, 0, 0); 10653 pAudioPlayer->PlaySound(SOUND_8, 0, 0, -1, 0, 0, 0, 0);
10836 10654
10837 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); 10655 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0);
10838 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) 10656
10839 {
10840 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape;
10841 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0;
10842 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0;
10843 ++pMessageQueue_50CBD0->uNumMessages;
10844 }*/
10845 v42 = (int *)&a2.y; 10657 v42 = (int *)&a2.y;
10846 v41 = (int *)&y.y; 10658 v41 = (int *)&y.y;
10847 v40 = (int *)&pOut; 10659 v40 = (int *)&pOut;
10848 v39.z = pParty->vPosition.z + pParty->sEyelevel; 10660 v39.z = pParty->vPosition.z + pParty->sEyelevel;
10849 } 10661 }
10905 dword_4E455C = 0; 10717 dword_4E455C = 0;
10906 } 10718 }
10907 } 10719 }
10908 10720
10909 10721
10910 //----- (00416B01) --------------------------------------------------------
10911 void __thiscall sub_416B01(void *_this)//PopupWindowForBenefitAndJoinText
10912 {
10913 int v1; // edi@2
10914 int v2; // ecx@2
10915 NPCData *v3; // eax@2
10916 NPCData *v4; // esi@7
10917 NPCData *v5; // eax@16
10918 NPCData *v6; // esi@16
10919 const CHAR *v7; // eax@18
10920 unsigned int v8; // eax@25
10921 unsigned int v9; // eax@25
10922 const char *v10; // ST14_4@26
10923 char *v11; // esi@26
10924 const char *v12; // ST18_4@27
10925 unsigned __int16 v13; // ax@28
10926 char *v14; // eax@28
10927 GUIWindow a1; // [sp+Ch] [bp-60h]@23
10928 int a2; // [sp+60h] [bp-Ch]@16
10929 void *v17; // [sp+64h] [bp-8h]@1
10930 LPCSTR lpsz; // [sp+68h] [bp-4h]@6
10931
10932 v17 = _this;
10933 if ( bNoNPCHiring != 1 )
10934 {
10935 v1 = 0;
10936 v2 = 0;
10937 v3 = pParty->pHirelings;
10938 /*do
10939 {
10940 if ( v3->pName )
10941 pTmpBuf[v1++] = v2;
10942 ++v3;
10943 ++v2;
10944 }
10945 while ( (signed int)v3 < (signed int)&pParty->pPickedItem );*/
10946 for (int i = 0; i < 2; ++i)
10947 {
10948 if (pParty->pHirelings[i].pName)
10949 pTmpBuf[v1++] = i;
10950 }
10951 lpsz = 0;
10952 if ( (signed int)pNPCStats->uNumNewNPCs > 0 )
10953 {
10954 /*v4 = pNPCStats->pNewNPCData;
10955 do
10956 {
10957 if ( v4->uFlags & 0x80
10958 && (!pParty->pHirelings[0].pName || strcmp(v4->pName, pParty->pHirelings[0].pName))
10959 && (!pParty->pHirelings[1].pName || strcmp(v4->pName, pParty->pHirelings[1].pName)) )
10960 pTmpBuf[v1++] = (char)lpsz + 2;
10961 ++lpsz;
10962 ++v4;
10963 }
10964 while ( (signed int)lpsz < (signed int)pNPCStats->uNumNewNPCs );*/
10965 for (int i = 0; i < pNPCStats->uNumNewNPCs; ++i)
10966 {
10967 if (pNPCStats->pNewNPCData[i].Hired())
10968 {
10969 if (!pParty->pHirelings[0].pName || strcmp((char *)pNPCStats->pNewNPCData[i].pName, (char *)pParty->pHirelings[0].pName))
10970 {
10971 if (!pParty->pHirelings[1].pName || strcmp((char *)pNPCStats->pNewNPCData[i].pName, (char *)pParty->pHirelings[1].pName))
10972 pTmpBuf[v1++] = i + 2;
10973 }
10974 }
10975 }
10976 }
10977 if ( (signed int)((char *)v17 + (unsigned __int8)pParty->field_709) < v1 )
10978 {
10979 sDialogue_SpeakingActorNPC_ID = -1 - (unsigned __int8)pParty->field_709 - (int)v17;
10980 v5 = GetNewNPCData(sDialogue_SpeakingActorNPC_ID, (int)&a2);
10981 v6 = v5;
10982 if ( v5 )
10983 {
10984 if ( a2 == 57 )
10985 v7 = pNPCTopics[512].pText; // Baby dragon
10986 else
10987 v7 = (const CHAR *)pNPCStats->pProfessions[v5->uProfession].pBenefits;
10988 lpsz = v7;
10989 if ( !v7 )
10990 {
10991 lpsz = (LPCSTR)pNPCStats->pProfessions[v5->uProfession].pJoinText;
10992 if ( !lpsz )
10993 lpsz = "";
10994 }
10995 a1.Hint = 0;
10996 a1.uFrameX = 38;
10997 a1.uFrameY = 60;
10998 a1.uFrameWidth = 276;
10999 a1.uFrameZ = 313;
11000 a1.uFrameHeight = pFontArrus->CalcTextHeight(lpsz, &a1, 0, 0)
11001 + 2 * LOBYTE(pFontArrus->uFontHeight)
11002 + 24;
11003 if ( (signed int)a1.uFrameHeight < 130 )
11004 a1.uFrameHeight = 130;
11005 a1.uFrameWidth = 400;
11006 a1.uFrameZ = a1.uFrameX + 399;
11007 a1.DrawMessageBox(0);
11008 sprintf(pTmpBuf2, "NPC%03d", v6->uPortraitID);
11009 v8 = pIcons_LOD->LoadTexture(pTmpBuf2, TEXTURE_16BIT_PALETTE);
11010 pRenderer->DrawTextureIndexed(
11011 a1.uFrameX + 22,
11012 a1.uFrameY + 36,
11013 (Texture *)(v8 != -1 ? &pIcons_LOD->pTextures[v8] : 0));
11014 v9 = v6->uProfession;
11015 if ( v9 )
11016 {
11017 v10 = v6->pName;
11018 v11 = pTmpBuf;
11019 sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[429], v10, aNPCProfessionNames[v9]);
11020 }
11021 else
11022 {
11023 v12 = v6->pName;
11024 v11 = pTmpBuf;
11025 strcpy(pTmpBuf, v12);
11026 }
11027 v13 = TargetColor(0xFFu, 0xFFu, 0x9Bu);
11028 a1.DrawTitleText(pFontArrus, 0, 0xCu, v13, v11, 3u);
11029 a1.uFrameWidth -= 24;
11030 a1.uFrameZ = a1.uFrameX + a1.uFrameWidth - 1;
11031 v14 = BuilDialogueString((char *)lpsz, uActiveCharacter - 1, 0, 0, 0, 0);
11032 a1.DrawText(pFontArrus, 100, 36, 0, v14, 0, 0, 0);
11033 }
11034 }
11035 }
11036 }
11037
11038 10722
11039 10723
11040 10724
11041 //----- (004175C0) -------------------------------------------------------- 10725 //----- (004175C0) --------------------------------------------------------
11042 void UI_OnMouseLeftClick(int *pXY) 10726 void UI_OnMouseLeftClick(int *pXY)
11189 { 10873 {
11190 pMouse->GetClickPos(&pX, &pY); 10874 pMouse->GetClickPos(&pX, &pY);
11191 } 10875 }
11192 pMouse->GetCursorPos(&a2); 10876 pMouse->GetCursorPos(&a2);
11193 pMouse->GetCursorPos(&v1); 10877 pMouse->GetCursorPos(&v1);
11194 }
11195 }
11196
11197 //----- (004178C4) --------------------------------------------------------
11198 void __cdecl sub_4178C4()
11199 {
11200 if ( pArcomageGame->bGameInProgress == 1 )
11201 {
11202 if (pAsyncMouse)
11203 pArcomageGame->stru1.field_0 = 7;
11204 }
11205 }
11206
11207 //----- (004178E1) --------------------------------------------------------
11208 void __cdecl sub_4178E1()
11209 {
11210 if ( pArcomageGame->bGameInProgress == 1 )
11211 {
11212 if (pAsyncMouse)
11213 pArcomageGame->stru1.field_0 = 8;
11214 } 10878 }
11215 } 10879 }
11216 10880
11217 //----- (004178FE) -------------------------------------------------------- 10881 //----- (004178FE) --------------------------------------------------------
11218 unsigned int __fastcall UI_GetHealthManaStringColor(signed int a1, signed int a2) 10882 unsigned int __fastcall UI_GetHealthManaStringColor(signed int a1, signed int a2)