comparison mm7_5.cpp @ 1055:010a844ef4a0

Слияние
author Ritor1
date Wed, 22 May 2013 22:23:04 +0600
parents 5520fdca7a74 306ec23b37df
children 37498d2cceed
comparison
equal deleted inserted replaced
1054:5520fdca7a74 1055:010a844ef4a0
1 #include <assert.h> 1 #include <assert.h>
2 2
3 #include "VideoPlayer.h"
4 #include "Sprites.h"
5 #include "MapInfo.h"
6 #include "BSPModel.h"
7 #include "OutdoorCamera.h"
8 #include "LightmapBuilder.h"
9 #include "DecalBuilder.h"
10 #include "Mouse.h"
11 #include "Keyboard.h"
12 #include "GammaControl.h"
13 #include "stru11.h"
14
15 #include "Vis.h"
3 #include "mm7.h" 16 #include "mm7.h"
4 #include "MapInfo.h"
5 #include "Game.h" 17 #include "Game.h"
6 #include "GUIWindow.h" 18 #include "GUIWindow.h"
7 #include "GUIFont.h" 19 #include "GUIFont.h"
8 #include "GUIProgressBar.h" 20 #include "GUIProgressBar.h"
9 #include "Party.h" 21 #include "Party.h"
10 #include "AudioPlayer.h" 22 #include "AudioPlayer.h"
11 #include "Outdoor.h" 23 #include "Outdoor.h"
12 #include "IndoorCamera.h"
13 #include "Overlays.h"
14 #include "Monsters.h"
15 #include "Arcomage.h" 24 #include "Arcomage.h"
16 #include "LOD.h" 25 #include "LOD.h"
17 #include "Actor.h" 26 #include "Actor.h"
18 #include "Allocator.h"
19 #include "Events.h" 27 #include "Events.h"
20 #include "Viewport.h" 28 #include "Viewport.h"
21 #include "FrameTableInc.h" 29 #include "FrameTableInc.h"
22 #include "Math.h" 30 #include "Math.h"
23 #include "SpriteObject.h" 31 #include "SpriteObject.h"
24 #include "ObjectList.h" 32 #include "ObjectList.h"
25 #include "Chest.h" 33 #include "Chest.h"
26 #include "PaletteManager.h" 34 #include "PaletteManager.h"
27 #include "DecorationList.h"
28 #include "SaveLoad.h" 35 #include "SaveLoad.h"
29 #include "stru123.h"
30 #include "Time.h" 36 #include "Time.h"
31 #include "IconFrameTable.h"
32 #include "Awards.h"
33 #include "Autonotes.h"
34 #include "stru160.h"
35 #include "TurnEngine.h" 37 #include "TurnEngine.h"
36 #include "CastSpellInfo.h" 38 #include "CastSpellInfo.h"
37 #include "Weather.h"
38 #include "stru298.h" 39 #include "stru298.h"
39 #include "StorylineTextTable.h"
40 #include "Events2D.h" 40 #include "Events2D.h"
41 #include "texts.h" 41 #include "texts.h"
42 #include "Log.h" 42 #include "Log.h"
43 #include "UIHouses.h" 43 #include "UIHouses.h"
44 #include "mm7_data.h" 44 #include "mm7_data.h"
45 45
46 //----- (004304E7) -------------------------------------------------------- 46 //----- (004304E7) --------------------------------------------------------
47 void __cdecl GameUI_MsgProc() 47 void __cdecl GameUI_MsgProc()
48 { 48 {
49 //signed int v0; // edi@6 49 //signed int v0; // edi@6
50 char *v1; // esi@6 50 //char *v1; // esi@6
51 unsigned int v2; // edx@7 51 unsigned int v2; // edx@7
52 Actor *pActor; // ecx@13 52 Actor *pActor; // ecx@13
53 int v4; // ecx@18 53 int v4; // ecx@18
54 //NPCData *pNPCData0; // eax@18 54 //NPCData *pNPCData0; // eax@18
55 //int v6; // edx@20 55 //int v6; // edx@20
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 //v0 = 1; 283 //v1 = "";
284 v1 = "";
285 while ( 2 ) 284 while ( 2 )
286 { 285 {
287 if ( !pMessageQueue_50CBD0->uNumMessages ) 286 if ( !pMessageQueue_50CBD0->uNumMessages )
288 break; 287 break;
289 288
305 if ( pMessageQueue_50CBD0->uNumMessages ) 304 if ( pMessageQueue_50CBD0->uNumMessages )
306 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; 305 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
307 dword_5B65D0_dialogue_actor_npc_id = pActors[uMessageParam].sNPC_ID; 306 dword_5B65D0_dialogue_actor_npc_id = pActors[uMessageParam].sNPC_ID;
308 pActor = &pActors[uMessageParam]; 307 pActor = &pActors[uMessageParam];
309 //goto _actor_init_dlg; 308 //goto _actor_init_dlg;
310 pActor->InitializeDialogue(1); 309 GameUI_InitializeDialogue(pActor, true);
311 continue; 310 continue;
312 case UIMSG_StartHireling1Dialogue: 311 case UIMSG_StartHireling1Dialogue:
313 case UIMSG_StartHireling2Dialogue: 312 case UIMSG_StartHireling2Dialogue:
314 { 313 {
315 if (bNoNPCHiring || pCurrentScreen) 314 if (bNoNPCHiring || pCurrentScreen)
358 { 357 {
359 //Actor::Actor(&actor); 358 //Actor::Actor(&actor);
360 memset(&actor, 0, 0x344u); 359 memset(&actor, 0, 0x344u);
361 actor.sNPC_ID += -1 - (unsigned __int8)pParty->field_709 - hireling_idx; 360 actor.sNPC_ID += -1 - (unsigned __int8)pParty->field_709 - hireling_idx;
362 pActor = &actor; 361 pActor = &actor;
363 pActor->InitializeDialogue(1); 362 GameUI_InitializeDialogue(&actor, true);
364 } 363 }
365 } 364 }
366 continue; 365 continue;
367 366
368 case UIMSG_BuyInShop_Identify_Repair: 367 case UIMSG_BuyInShop_Identify_Repair:
381 _4B4224_UpdateNPCTopics(uMessageParam); 380 _4B4224_UpdateNPCTopics(uMessageParam);
382 continue; 381 continue;
383 case UIMSG_StartNewGame: 382 case UIMSG_StartNewGame:
384 if ( dword_6BE138 == 124 || uMessageParam ) 383 if ( dword_6BE138 == 124 || uMessageParam )
385 { 384 {
386 pIcons_LOD->_40F9C5(); 385 pIcons_LOD->SyncLoadedFilesCount();
387 pIcons_LOD->_4114F2(); 386 pIcons_LOD->_4114F2();
388 if ( pMessageQueue_50CBD0->uNumMessages ) 387 if ( pMessageQueue_50CBD0->uNumMessages )
389 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; 388 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
390 pGUIWindow_CurrentMenu->Release(); 389 pGUIWindow_CurrentMenu->Release();
391 uGameState = GAME_STATE_NEWGAME_OUT_GAMEMENU; 390 uGameState = GAME_STATE_NEWGAME_OUT_GAMEMENU;
399 dword_6BE138 = 124; 398 dword_6BE138 = 124;
400 } 399 }
401 stru_506E40.Release(); 400 stru_506E40.Release();
402 continue; 401 continue;
403 case UIMSG_Game_OpenLoadGameDialog: 402 case UIMSG_Game_OpenLoadGameDialog:
404 pIcons_LOD->_40F9C5(); 403 pIcons_LOD->SyncLoadedFilesCount();
405 pIcons_LOD->_4114F2(); 404 pIcons_LOD->_4114F2();
406 if ( pMessageQueue_50CBD0->uNumMessages ) 405 if ( pMessageQueue_50CBD0->uNumMessages )
407 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; 406 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
408 pGUIWindow_CurrentMenu->Release(); 407 pGUIWindow_CurrentMenu->Release();
409 pCurrentScreen = SCREEN_LOADGAME; 408 pCurrentScreen = SCREEN_LOADGAME;
410 GameUI_DrawLoadMenu(1); 409 LoadUI_Load(1);
411 continue; 410 continue;
412 case UIMSG_Quit: 411 case UIMSG_Quit:
413 if ( dword_6BE138 == 132 || uMessageParam ) 412 if ( dword_6BE138 == 132 || uMessageParam )
414 { 413 {
415 pIcons_LOD->_40F9C5(); 414 pIcons_LOD->SyncLoadedFilesCount();
416 pIcons_LOD->_4114F2(); 415 pIcons_LOD->_4114F2();
417 if ( pMessageQueue_50CBD0->uNumMessages ) 416 if ( pMessageQueue_50CBD0->uNumMessages )
418 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; 417 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
419 pGUIWindow_CurrentMenu->Release(); 418 pGUIWindow_CurrentMenu->Release();
420 pCurrentScreen = SCREEN_GAME; 419 pCurrentScreen = SCREEN_GAME;
431 } 430 }
432 stru_506E40.Release(); 431 stru_506E40.Release();
433 continue; 432 continue;
434 case UIMSG_80: 433 case UIMSG_80:
435 __debugbreak(); 434 __debugbreak();
436 pIcons_LOD->_40F9C5(); 435 pIcons_LOD->SyncLoadedFilesCount();
437 pIcons_LOD->_4114F2(); 436 pIcons_LOD->_4114F2();
438 pGUIWindow_CurrentMenu->Release(); 437 pGUIWindow_CurrentMenu->Release();
439 pCurrentScreen = SCREEN_OPTIONS; 438 pCurrentScreen = SCREEN_OPTIONS;
440 pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_8, 0, 0); 439 pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_8, 0, 0);
441 continue; 440 continue;
514 stru_506E40.Release(); 513 stru_506E40.Release();
515 continue; 514 continue;
516 case UIMSG_Game_OpenSaveGameDialog: 515 case UIMSG_Game_OpenSaveGameDialog:
517 pGUIWindow_CurrentMenu->Release(); 516 pGUIWindow_CurrentMenu->Release();
518 pCurrentScreen = SCREEN_SAVEGAME; 517 pCurrentScreen = SCREEN_SAVEGAME;
519 GameUI_DrawSaveMenu(); 518 SaveUI_Load();
520 continue; 519 continue;
521 case UIMSG_Game_OpenOptionsDialog://Open 520 case UIMSG_Game_OpenOptionsDialog://Open
522 if ( pMessageQueue_50CBD0->uNumMessages ) 521 if ( pMessageQueue_50CBD0->uNumMessages )
523 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; 522 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
524 pGUIWindow_CurrentMenu->Release(); 523 pGUIWindow_CurrentMenu->Release();
548 547
549 pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_Options, 0, 0); 548 pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_Options, 0, 0);
550 pGUIWindow_CurrentMenu->CreateButton(22, 270, 549 pGUIWindow_CurrentMenu->CreateButton(22, 270,
551 pIcons_LOD->GetTexture(options_menu_skin.uTextureID_TurnSpeed[2])->uTextureWidth, 550 pIcons_LOD->GetTexture(options_menu_skin.uTextureID_TurnSpeed[2])->uTextureWidth,
552 pIcons_LOD->GetTexture(options_menu_skin.uTextureID_TurnSpeed[2])->uTextureHeight, 551 pIcons_LOD->GetTexture(options_menu_skin.uTextureID_TurnSpeed[2])->uTextureHeight,
553 1, 0, UIMSG_SetTurnSpeed, 0x80, 0, v1, 0); 552 1, 0, UIMSG_SetTurnSpeed, 0x80, 0, "", 0);
554 pGUIWindow_CurrentMenu->CreateButton(93, 270, 553 pGUIWindow_CurrentMenu->CreateButton(93, 270,
555 pIcons_LOD->GetTexture(options_menu_skin.uTextureID_TurnSpeed[1])->uTextureWidth, 554 pIcons_LOD->GetTexture(options_menu_skin.uTextureID_TurnSpeed[1])->uTextureWidth,
556 pIcons_LOD->GetTexture(options_menu_skin.uTextureID_TurnSpeed[1])->uTextureHeight, 555 pIcons_LOD->GetTexture(options_menu_skin.uTextureID_TurnSpeed[1])->uTextureHeight,
557 1, 0, UIMSG_SetTurnSpeed, 0x40u, 0, v1, 0); 556 1, 0, UIMSG_SetTurnSpeed, 0x40u, 0, "", 0);
558 pGUIWindow_CurrentMenu->CreateButton(164, 270, 557 pGUIWindow_CurrentMenu->CreateButton(164, 270,
559 pIcons_LOD->GetTexture(options_menu_skin.uTextureID_TurnSpeed[0])->uTextureWidth, 558 pIcons_LOD->GetTexture(options_menu_skin.uTextureID_TurnSpeed[0])->uTextureWidth,
560 pIcons_LOD->GetTexture(options_menu_skin.uTextureID_TurnSpeed[0])->uTextureHeight, 559 pIcons_LOD->GetTexture(options_menu_skin.uTextureID_TurnSpeed[0])->uTextureHeight,
561 1, 0, UIMSG_SetTurnSpeed, 0, 0, v1, 0); 560 1, 0, UIMSG_SetTurnSpeed, 0, 0, "", 0);
562 561
563 pGUIWindow_CurrentMenu->CreateButton(20, 303, 562 pGUIWindow_CurrentMenu->CreateButton(20, 303,
564 pIcons_LOD->GetTexture(options_menu_skin.uTextureID_WalkSound)->uTextureWidth, 563 pIcons_LOD->GetTexture(options_menu_skin.uTextureID_WalkSound)->uTextureWidth,
565 pIcons_LOD->GetTexture(options_menu_skin.uTextureID_WalkSound)->uTextureHeight, 564 pIcons_LOD->GetTexture(options_menu_skin.uTextureID_WalkSound)->uTextureHeight,
566 1, 0, UIMSG_ToggleWalkSound, 0, 0, v1, 0); 565 1, 0, UIMSG_ToggleWalkSound, 0, 0, "", 0);
567 pGUIWindow_CurrentMenu->CreateButton(128, 303, 566 pGUIWindow_CurrentMenu->CreateButton(128, 303,
568 pIcons_LOD->GetTexture(options_menu_skin.uTextureID_ShowDamage)->uTextureWidth, 567 pIcons_LOD->GetTexture(options_menu_skin.uTextureID_ShowDamage)->uTextureWidth,
569 pIcons_LOD->GetTexture(options_menu_skin.uTextureID_ShowDamage)->uTextureHeight, 568 pIcons_LOD->GetTexture(options_menu_skin.uTextureID_ShowDamage)->uTextureHeight,
570 1, 0, UIMSG_ToggleShowDamage, 0, 0, v1, 0); 569 1, 0, UIMSG_ToggleShowDamage, 0, 0, "", 0);
571 pGUIWindow_CurrentMenu->CreateButton(20, 325, 570 pGUIWindow_CurrentMenu->CreateButton(20, 325,
572 pIcons_LOD->GetTexture(options_menu_skin.uTextureID_AlwaysRun)->uTextureWidth, 571 pIcons_LOD->GetTexture(options_menu_skin.uTextureID_AlwaysRun)->uTextureWidth,
573 pIcons_LOD->GetTexture(options_menu_skin.uTextureID_AlwaysRun)->uTextureHeight, 572 pIcons_LOD->GetTexture(options_menu_skin.uTextureID_AlwaysRun)->uTextureHeight,
574 1, 0, UIMSG_ToggleAlwaysRun, 0, 0, v1, 0); 573 1, 0, UIMSG_ToggleAlwaysRun, 0, 0, "", 0);
575 pGUIWindow_CurrentMenu->CreateButton(128, 325, 574 pGUIWindow_CurrentMenu->CreateButton(128, 325,
576 pIcons_LOD->GetTexture(options_menu_skin.uTextureID_FlipOnExit)->uTextureWidth, 575 pIcons_LOD->GetTexture(options_menu_skin.uTextureID_FlipOnExit)->uTextureWidth,
577 pIcons_LOD->GetTexture(options_menu_skin.uTextureID_FlipOnExit)->uTextureHeight, 576 pIcons_LOD->GetTexture(options_menu_skin.uTextureID_FlipOnExit)->uTextureHeight,
578 1, 0, UIMSG_ToggleFlipOnExit, 0, 0, v1, 0); 577 1, 0, UIMSG_ToggleFlipOnExit, 0, 0, "", 0);
579 578
580 pBtn_SliderLeft = pGUIWindow_CurrentMenu->CreateButton(243, 162, 16, 16, 1, 0, UIMSG_ChangeSoundVolume, 4, 0, v1, pIcons_LOD->GetTexture(options_menu_skin.uTextureID_ArrowLeft), 0); 579 pBtn_SliderLeft = pGUIWindow_CurrentMenu->CreateButton(243, 162, 16, 16, 1, 0, UIMSG_ChangeSoundVolume, 4, 0, "", pIcons_LOD->GetTexture(options_menu_skin.uTextureID_ArrowLeft), 0);
581 pBtn_SliderRight = pGUIWindow_CurrentMenu->CreateButton(435, 162, 16, 16, 1, 0, UIMSG_ChangeSoundVolume, 5, 0, v1, pIcons_LOD->GetTexture(options_menu_skin.uTextureID_ArrowRight), 0); 580 pBtn_SliderRight = pGUIWindow_CurrentMenu->CreateButton(435, 162, 16, 16, 1, 0, UIMSG_ChangeSoundVolume, 5, 0, "", pIcons_LOD->GetTexture(options_menu_skin.uTextureID_ArrowRight), 0);
582 pGUIWindow_CurrentMenu->CreateButton(263, 162, 172, 17, 1, 0, UIMSG_ChangeSoundVolume, 0, 0, v1, 0); 581 pGUIWindow_CurrentMenu->CreateButton(263, 162, 172, 17, 1, 0, UIMSG_ChangeSoundVolume, 0, 0, "", 0);
583 582
584 pBtn_SliderLeft = pGUIWindow_CurrentMenu->CreateButton(243, 216, 16, 16, 1, 0, UIMSG_ChangeMusicVolume, 4, 0, v1, pIcons_LOD->GetTexture(options_menu_skin.uTextureID_ArrowLeft), 0); 583 pBtn_SliderLeft = pGUIWindow_CurrentMenu->CreateButton(243, 216, 16, 16, 1, 0, UIMSG_ChangeMusicVolume, 4, 0, "", pIcons_LOD->GetTexture(options_menu_skin.uTextureID_ArrowLeft), 0);
585 pBtn_SliderRight = pGUIWindow_CurrentMenu->CreateButton(435, 216, 16, 16, 1, 0, UIMSG_ChangeMusicVolume, 5, 0, v1, pIcons_LOD->GetTexture(options_menu_skin.uTextureID_ArrowRight), 0); 584 pBtn_SliderRight = pGUIWindow_CurrentMenu->CreateButton(435, 216, 16, 16, 1, 0, UIMSG_ChangeMusicVolume, 5, 0, "", pIcons_LOD->GetTexture(options_menu_skin.uTextureID_ArrowRight), 0);
586 pGUIWindow_CurrentMenu->CreateButton(263, 216, 172, 17, 1, 0, UIMSG_ChangeMusicVolume, 0, 0, v1, 0); 585 pGUIWindow_CurrentMenu->CreateButton(263, 216, 172, 17, 1, 0, UIMSG_ChangeMusicVolume, 0, 0, "", 0);
587 586
588 pBtn_SliderLeft = pGUIWindow_CurrentMenu->CreateButton(243, 270, 16, 16, 1, 0, UIMSG_ChangeVoiceVolume, 4, 0, v1, pIcons_LOD->GetTexture(options_menu_skin.uTextureID_ArrowLeft), 0); 587 pBtn_SliderLeft = pGUIWindow_CurrentMenu->CreateButton(243, 270, 16, 16, 1, 0, UIMSG_ChangeVoiceVolume, 4, 0, "", pIcons_LOD->GetTexture(options_menu_skin.uTextureID_ArrowLeft), 0);
589 pBtn_SliderRight = pGUIWindow_CurrentMenu->CreateButton(435, 270, 16, 16, 1, 0, UIMSG_ChangeVoiceVolume, 5, 0, v1, pIcons_LOD->GetTexture(options_menu_skin.uTextureID_ArrowRight), 0); 588 pBtn_SliderRight = pGUIWindow_CurrentMenu->CreateButton(435, 270, 16, 16, 1, 0, UIMSG_ChangeVoiceVolume, 5, 0, "", pIcons_LOD->GetTexture(options_menu_skin.uTextureID_ArrowRight), 0);
590 pGUIWindow_CurrentMenu->CreateButton(263, 270, 172, 17, 1, 0, UIMSG_ChangeVoiceVolume, 0, 0, v1, 0); 589 pGUIWindow_CurrentMenu->CreateButton(263, 270, 172, 17, 1, 0, UIMSG_ChangeVoiceVolume, 0, 0, "", 0);
591 590
592 pGUIWindow_CurrentMenu->CreateButton(241, 302, 214, 40, 1, 0, UIMSG_Escape, 0, 0, pGlobalTXT_LocalizationStrings[619], 0); // "Return to Game" 591 pGUIWindow_CurrentMenu->CreateButton(241, 302, 214, 40, 1, 0, UIMSG_Escape, 0, 0, pGlobalTXT_LocalizationStrings[619], 0); // "Return to Game"
593 pGUIWindow_CurrentMenu->CreateButton( 19, 140, 214, 40, 1, 0, UIMSG_OpenKeyMappingOptions, 0, 0x4Bu, v1, 0); 592 pGUIWindow_CurrentMenu->CreateButton( 19, 140, 214, 40, 1, 0, UIMSG_OpenKeyMappingOptions, 0, 0x4Bu, "", 0);
594 pGUIWindow_CurrentMenu->CreateButton( 19, 194, 214, 40, 1, 0, UIMSG_OpenVideoOptions, 0, 86, v1, 0); 593 pGUIWindow_CurrentMenu->CreateButton( 19, 194, 214, 40, 1, 0, UIMSG_OpenVideoOptions, 0, 86, "", 0);
595 continue; 594 continue;
596 595
597 case UIMSG_OpenKeyMappingOptions://Open 596 case UIMSG_OpenKeyMappingOptions://Open
598 if ( pMessageQueue_50CBD0->uNumMessages ) 597 if ( pMessageQueue_50CBD0->uNumMessages )
599 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; 598 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
623 pGUIWindow_CurrentMenu->CreateButton(350u, 186u, 70u, 0x13u, 1, 0, UIMSG_ChangeKeyButton, 9u, 0, "", 0); 622 pGUIWindow_CurrentMenu->CreateButton(350u, 186u, 70u, 0x13u, 1, 0, UIMSG_ChangeKeyButton, 9u, 0, "", 0);
624 pGUIWindow_CurrentMenu->CreateButton(350u, 205u, 70u, 0x13u, 1, 0, UIMSG_ChangeKeyButton, 0xAu, 0, "", 0); 623 pGUIWindow_CurrentMenu->CreateButton(350u, 205u, 70u, 0x13u, 1, 0, UIMSG_ChangeKeyButton, 0xAu, 0, "", 0);
625 pGUIWindow_CurrentMenu->CreateButton(350u, 224u, 70u, 0x13u, 1, 0, UIMSG_ChangeKeyButton, 0xBu, 0, "", 0); 624 pGUIWindow_CurrentMenu->CreateButton(350u, 224u, 70u, 0x13u, 1, 0, UIMSG_ChangeKeyButton, 0xBu, 0, "", 0);
626 pGUIWindow_CurrentMenu->CreateButton(350u, 243u, 70u, 0x13u, 1, 0, UIMSG_ChangeKeyButton, 0xCu, 0, "", 0); 625 pGUIWindow_CurrentMenu->CreateButton(350u, 243u, 70u, 0x13u, 1, 0, UIMSG_ChangeKeyButton, 0xCu, 0, "", 0);
627 pGUIWindow_CurrentMenu->CreateButton(350u, 262u, 70u, 0x13u, 1, 0, UIMSG_ChangeKeyButton, 0xDu, 0, "", 0); 626 pGUIWindow_CurrentMenu->CreateButton(350u, 262u, 70u, 0x13u, 1, 0, UIMSG_ChangeKeyButton, 0xDu, 0, "", 0);
628 dword_506E68 = -1; 627 uGameMenuUI_CurentlySelectedKeyIdx = -1;
629 KeyboardPageNum = 1; 628 KeyboardPageNum = 1;
630 memset(KeyButtonFlagChangesArray, 0, sizeof(KeyButtonFlagChangesArray)); 629 memset(GameMenuUI_InvaligKeyBindingsFlags, 0, sizeof(GameMenuUI_InvaligKeyBindingsFlags));
631 //*(_WORD *)KeyButtonArray[28] = 0; 630 //*(_WORD *)KeyButtonArray[28] = 0;
632 memcpy(pPrevVirtualCidesMapping, pKeyActionMap->pVirtualKeyCodesMapping, 0x78u); 631 memcpy(pPrevVirtualCidesMapping, pKeyActionMap->pVirtualKeyCodesMapping, 0x78u);
633 v1 = ""; 632 //v1 = "";
634 //v0 = 1; 633 //v0 = 1;
635 continue; 634 continue;
636 case UIMSG_ChangeKeyButton: 635 case UIMSG_ChangeKeyButton:
637 if ( dword_506E68 != -1 ) 636 if ( uGameMenuUI_CurentlySelectedKeyIdx != -1 )
638 { 637 {
639 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); 638 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0);
640 continue; 639 continue;
641 } 640 }
642 v14 = uMessageParam; 641 v14 = uMessageParam;
643 if ( KeyboardPageNum != 1 ) 642 if ( KeyboardPageNum != 1 )
644 v14 = uMessageParam + 14; 643 v14 = uMessageParam + 14;
645 dword_506E68 = v14; 644 uGameMenuUI_CurentlySelectedKeyIdx = v14;
646 pKeyActionMap->EnterText(0, 1, pGUIWindow_CurrentMenu); 645 pKeyActionMap->EnterText(0, 1, pGUIWindow_CurrentMenu);
647 continue; 646 continue;
648 case UIMSG_ResetKeyMapping: 647 case UIMSG_ResetKeyMapping:
649 v197 = 1; 648 v197 = 1;
650 pKeyActionMap->SetDefaultMapping(); 649 pKeyActionMap->SetDefaultMapping();
668 } 667 }
669 pPrevVirtualCidesMapping[uAction] = pKeyActionMap->GetActionVKey((enum InputAction)uAction); 668 pPrevVirtualCidesMapping[uAction] = pKeyActionMap->GetActionVKey((enum InputAction)uAction);
670 v18 = uAction++; 669 v18 = uAction++;
671 v13 = uAction > 28; 670 v13 = uAction > 28;
672 v12 = uAction - 28 < 0; 671 v12 = uAction - 28 < 0;
673 KeyButtonFlagChangesArray[v18] = 0; 672 GameMenuUI_InvaligKeyBindingsFlags[v18] = 0;
674 } 673 }
675 while ( v12 ^ v13 ); 674 while ( v12 ^ v13 );
676 pAudioPlayer->PlaySound((SoundID)219, 0, 0, -1, 0, 0, 0, 0); 675 pAudioPlayer->PlaySound((SoundID)219, 0, 0, -1, 0, 0, 0, 0);
677 continue; 676 continue;
678 case UIMSG_SelectKeyPage1: 677 case UIMSG_SelectKeyPage1:
705 pTextureIDs_GammaPositions[9] = pIcons_LOD->LoadTexture("convol00", TEXTURE_16BIT_PALETTE); 704 pTextureIDs_GammaPositions[9] = pIcons_LOD->LoadTexture("convol00", TEXTURE_16BIT_PALETTE);
706 uTextureID_507C50 = pIcons_LOD->LoadTexture("opvdG-bs", TEXTURE_16BIT_PALETTE); 705 uTextureID_507C50 = pIcons_LOD->LoadTexture("opvdG-bs", TEXTURE_16BIT_PALETTE);
707 uTextureID_507C54 = pIcons_LOD->LoadTexture("opvdG-cl", TEXTURE_16BIT_PALETTE); 706 uTextureID_507C54 = pIcons_LOD->LoadTexture("opvdG-cl", TEXTURE_16BIT_PALETTE);
708 uTextureID_507C58 = pIcons_LOD->LoadTexture("opvdG-tn", TEXTURE_16BIT_PALETTE); 707 uTextureID_507C58 = pIcons_LOD->LoadTexture("opvdG-tn", TEXTURE_16BIT_PALETTE);
709 pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_VideoOptions, 0, 0); 708 pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_VideoOptions, 0, 0);
710 pGUIWindow_CurrentMenu->CreateButton(0xF1u, 0x12Eu, 0xD6u, 0x28u, 1, 0, UIMSG_Escape, 0, 0, v1, 0); 709 pGUIWindow_CurrentMenu->CreateButton(0xF1u, 0x12Eu, 0xD6u, 0x28u, 1, 0, UIMSG_Escape, 0, 0, "", 0);
711 if ( pRenderer->pRenderD3D ) 710 if ( pRenderer->pRenderD3D )
712 { 711 {
713 pGUIWindow_CurrentMenu->CreateButton(0x13u, 0x118u, 0xD6u, 0x12u, 1, 0, UIMSG_ToggleBloodsplats, 0, 0, v1, 0); 712 pGUIWindow_CurrentMenu->CreateButton(0x13u, 0x118u, 0xD6u, 0x12u, 1, 0, UIMSG_ToggleBloodsplats, 0, 0, "", 0);
714 pGUIWindow_CurrentMenu->CreateButton(0x13u, 0x12Eu, 0xD6u, 0x12u, 1, 0, UIMSG_ToggleColoredLights, 0, 0, v1, 0); 713 pGUIWindow_CurrentMenu->CreateButton(0x13u, 0x12Eu, 0xD6u, 0x12u, 1, 0, UIMSG_ToggleColoredLights, 0, 0, "", 0);
715 pGUIWindow_CurrentMenu->CreateButton(0x13u, 0x144u, 0xD6u, 0x12u, 1, 0, UIMSG_ToggleTint, 0, 0, v1, 0); 714 pGUIWindow_CurrentMenu->CreateButton(0x13u, 0x144u, 0xD6u, 0x12u, 1, 0, UIMSG_ToggleTint, 0, 0, "", 0);
716 } 715 }
717 if ( !pRenderer->bWindowMode ) 716 if ( !pRenderer->bWindowMode )
718 { 717 {
719 //v0 = 1; 718 //v0 = 1;
720 if ( GammaController::IsGammaSupported() ) 719 if ( GammaController::IsGammaSupported() )
721 { 720 {
722 pBtn_SliderLeft = pGUIWindow_CurrentMenu->CreateButton(0x15u, 0xA1u, 0x10u, 0x10u, 1, 0, UIMSG_1A9, 4u, 0, v1, pIcons_LOD->GetTexture(uTextureID_507C20), 0); 721 pBtn_SliderLeft = pGUIWindow_CurrentMenu->CreateButton(0x15u, 0xA1u, 0x10u, 0x10u, 1, 0, UIMSG_1A9, 4u, 0, "", pIcons_LOD->GetTexture(uTextureID_507C20), 0);
723 pBtn_SliderRight = pGUIWindow_CurrentMenu->CreateButton(0xD5u, 0xA1u, 0x10u, 0x10u, 1, 0, UIMSG_1A9, 5u, 0, v1, pIcons_LOD->GetTexture(uTextureID_507C24), 0); 722 pBtn_SliderRight = pGUIWindow_CurrentMenu->CreateButton(0xD5u, 0xA1u, 0x10u, 0x10u, 1, 0, UIMSG_1A9, 5u, 0, "", pIcons_LOD->GetTexture(uTextureID_507C24), 0);
724 pGUIWindow_CurrentMenu->CreateButton(42, 162, 170, 18, 1, 0, UIMSG_1A9, 0, 0, v1, 0); 723 pGUIWindow_CurrentMenu->CreateButton(42, 162, 170, 18, 1, 0, UIMSG_1A9, 0, 0, "", 0);
725 } 724 }
726 } 725 }
727 continue; 726 continue;
728 case UIMSG_1A9: 727 case UIMSG_1A9:
729 __debugbreak(); 728 __debugbreak();
1145 viewparams->bRedrawGameUI = 1; 1144 viewparams->bRedrawGameUI = 1;
1146 pEventTimer->Resume(); 1145 pEventTimer->Resume();
1147 continue; 1146 continue;
1148 case SCREEN_OPTIONS://Close 1147 case SCREEN_OPTIONS://Close
1149 options_menu_skin.Relaease(); 1148 options_menu_skin.Relaease();
1150 pIcons_LOD->_40F9C5(); 1149 pIcons_LOD->SyncLoadedFilesCount();
1151 WriteWindowsRegistryInt("soundflag", (char)uSoundVolumeMultiplier); 1150 WriteWindowsRegistryInt("soundflag", (char)uSoundVolumeMultiplier);
1152 WriteWindowsRegistryInt("musicflag", (char)uMusicVolimeMultiplier); 1151 WriteWindowsRegistryInt("musicflag", (char)uMusicVolimeMultiplier);
1153 WriteWindowsRegistryInt("CharVoices", (char)uVoicesVolumeMultiplier); 1152 WriteWindowsRegistryInt("CharVoices", (char)uVoicesVolumeMultiplier);
1154 WriteWindowsRegistryInt("WalkSound", bWalkSound); 1153 WriteWindowsRegistryInt("WalkSound", bWalkSound);
1155 WriteWindowsRegistryInt("ShowDamage", bShowDamage); 1154 WriteWindowsRegistryInt("ShowDamage", bShowDamage);
1175 } 1174 }
1176 WriteWindowsRegistryInt("TurnDelta", 1); 1175 WriteWindowsRegistryInt("TurnDelta", 1);
1177 stru_506E40.Release(); 1176 stru_506E40.Release();
1178 break; 1177 break;
1179 case SCREEN_MENU: 1178 case SCREEN_MENU:
1180 pIcons_LOD->_40F9C5(); 1179 pIcons_LOD->SyncLoadedFilesCount();
1181 pIcons_LOD->_4114F2(); 1180 pIcons_LOD->_4114F2();
1182 pIcons_LOD->_40F9C5(); 1181 pIcons_LOD->SyncLoadedFilesCount();
1183 pIcons_LOD->_4114F2(); 1182 pIcons_LOD->_4114F2();
1184 stru_506E40.Release(); 1183 stru_506E40.Release();
1185 break; 1184 break;
1186 case SCREEN_VIDEO_OPTIONS: 1185 case SCREEN_VIDEO_OPTIONS:
1187 if ( pRenderer->pRenderD3D ) 1186 if ( pRenderer->pRenderD3D )
1198 //v30 = uGammaPos; 1197 //v30 = uGammaPos;
1199 //v31 = "GammaPos"; 1198 //v31 = "GammaPos";
1200 WriteWindowsRegistryInt("GammaPos", uGammaPos); 1199 WriteWindowsRegistryInt("GammaPos", uGammaPos);
1201 stru_506E40.Release(); 1200 stru_506E40.Release();
1202 break; 1201 break;
1202
1203 case SCREEN_KEYBOARD_OPTIONS://Return to game 1203 case SCREEN_KEYBOARD_OPTIONS://Return to game
1204 v197 = 1; 1204 v197 = 1;
1205 v32 = 0; 1205 v32 = 0;
1206 while ( KeyButtonFlagChangesArray[v32] != 1 ) 1206 while ( !GameMenuUI_InvaligKeyBindingsFlags[v32])
1207 { 1207 {
1208 ++v32; 1208 ++v32;
1209 if ( v32 >= 28 ) 1209 if ( v32 >= 28 )
1210 { 1210 {
1211 thisb = (signed int)&uTextureID_Optkb; 1211 thisb = (signed int)&uTextureID_Optkb;
1212 assert(false && "Invalid condition values");
1212 do 1213 do
1213 { 1214 {
1214 if ( *(int *)thisb ) 1215 if ( *(int *)thisb )
1215 pIcons_LOD->pTextures[*(int *)thisb].Release(); 1216 pIcons_LOD->pTextures[*(int *)thisb].Release();
1216 thisb += 4; 1217 thisb += 4;
1217 } 1218 }
1218 while ( thisb < (signed int)&dword_507C08 ); 1219 while ( thisb < (signed int)0x00507C08 );
1220
1219 memset(&uTextureID_Optkb, 0, 0x14u); 1221 memset(&uTextureID_Optkb, 0, 0x14u);
1220 pIcons_LOD->_40F9C5(); 1222 pIcons_LOD->SyncLoadedFilesCount();
1221 uAction = 0; 1223 uAction = 0;
1222 do 1224 do
1223 { 1225 {
1224 v33 = pKeyActionMap->GetActionVKey((enum InputAction)uAction); 1226 v33 = pKeyActionMap->GetActionVKey((enum InputAction)uAction);
1225 if ( v33 != pPrevVirtualCidesMapping[uAction] ) 1227 if ( v33 != pPrevVirtualCidesMapping[uAction] )
1261 } 1263 }
1262 pTexture_RestUI_CurrentSkyFrame->Release(); 1264 pTexture_RestUI_CurrentSkyFrame->Release();
1263 pTexture_RestUI_CurrentHourglassFrame->Release(); 1265 pTexture_RestUI_CurrentHourglassFrame->Release();
1264 pTexture_RestUI_CurrentHourglassFrame = 0; 1266 pTexture_RestUI_CurrentHourglassFrame = 0;
1265 pTexture_RestUI_CurrentSkyFrame = 0; 1267 pTexture_RestUI_CurrentSkyFrame = 0;
1266 pIcons_LOD->_40F9C5(); 1268 pIcons_LOD->SyncLoadedFilesCount();
1267 pIcons_LOD->_4114F2(); 1269 pIcons_LOD->_4114F2();
1268 _506F18_num_hours_to_sleep = 0; 1270 _506F18_num_hours_to_sleep = 0;
1269 dword_506F14 = 0; 1271 dword_506F14 = 0;
1270 dword_507B94 = 1; 1272 dword_507B94 = 1;
1271 if ( pGUIWindow_Settings ) 1273 if ( pGUIWindow_Settings )
1340 if ( pGUIWindow_CurrentMenu == window_SpeakInHouse ) 1342 if ( pGUIWindow_CurrentMenu == window_SpeakInHouse )
1341 window_SpeakInHouse = 0; 1343 window_SpeakInHouse = 0;
1342 pGUIWindow_CurrentMenu = 0; 1344 pGUIWindow_CurrentMenu = 0;
1343 pEventTimer->Resume(); 1345 pEventTimer->Resume();
1344 pCurrentScreen = SCREEN_GAME; 1346 pCurrentScreen = SCREEN_GAME;
1345 viewparams->bRedrawGameUI = 1; 1347 viewparams->bRedrawGameUI = true;
1346 pIcons_LOD->_4355F7(); 1348 pIcons_LOD->_4355F7();
1347 continue; 1349 continue;
1348 case SCREEN_INPUT_BLV://click escape 1350 case SCREEN_INPUT_BLV://click escape
1349 if ( uCurrentHouse_Animation == 153 ) 1351 if ( uCurrentHouse_Animation == 153 )
1350 PlayHouseSound(0x99u, HouseSound_Greeting_2); 1352 PlayHouseSound(0x99u, HouseSound_Greeting_2);
1351 pVideoPlayer->Unload(); 1353 pVideoPlayer->Unload();
1352 if ( dword_5B65CC ) 1354 if ( dword_5B65CC )
1353 { 1355 {
1354 pParty->field_709 = 0; 1356 pParty->field_709 = 0;
1355 LOBYTE(pNPCStats->pNewNPCData[dword_5B65CC].uFlags) &= 0x7Fu; 1357 LOBYTE(pNPCStats->pNewNPCData[dword_5B65CC].uFlags) &= 0x7Fu;
1356 Party__CountHirelings(); 1358 pParty->CountHirelings();
1357 viewparams->bRedrawGameUI = 1; 1359 viewparams->bRedrawGameUI = true;
1358 dword_5B65CC = 0; 1360 dword_5B65CC = 0;
1359 } 1361 }
1360 DialogueEnding(); 1362 DialogueEnding();
1361 pCurrentScreen = SCREEN_GAME; 1363 pCurrentScreen = SCREEN_GAME;
1362 viewparams->bRedrawGameUI = 1; 1364 viewparams->bRedrawGameUI = true;
1363 continue; 1365 continue;
1364 case SCREEN_NPC_DIALOGUE://click escape 1366 case SCREEN_NPC_DIALOGUE://click escape
1365 if ( dword_5B65CC ) 1367 if ( dword_5B65CC )
1366 { 1368 {
1367 pParty->field_709 = 0; 1369 pParty->field_709 = 0;
1368 LOBYTE(pNPCStats->pNewNPCData[dword_5B65CC].uFlags) &= 0x7Fu; 1370 LOBYTE(pNPCStats->pNewNPCData[dword_5B65CC].uFlags) &= 0x7Fu;
1369 Party__CountHirelings(); 1371 pParty->CountHirelings();
1370 viewparams->bRedrawGameUI = 1; 1372 viewparams->bRedrawGameUI = true;
1371 dword_5B65CC = 0; 1373 dword_5B65CC = 0;
1372 } 1374 }
1373 //goto LABEL_317; 1375 //goto LABEL_317;
1374 DialogueEnding(); 1376 DialogueEnding();
1375 pCurrentScreen = SCREEN_GAME; 1377 pCurrentScreen = SCREEN_GAME;
1376 viewparams->bRedrawGameUI = 1; 1378 viewparams->bRedrawGameUI = true;
1377 continue; 1379 continue;
1378 case SCREEN_BRANCHLESS_NPC_DIALOG://click escape 1380 case SCREEN_BRANCHLESS_NPC_DIALOG://click escape
1379 memset(GameUI_Footer_TimedString, 0, 0xC8u); 1381 memset(GameUI_Footer_TimedString, 0, 0xC8u);
1380 sub_4452BB(); 1382 sub_4452BB();
1381 DialogueEnding(); 1383 DialogueEnding();
1382 pCurrentScreen = SCREEN_GAME; 1384 pCurrentScreen = SCREEN_GAME;
1383 viewparams->bRedrawGameUI = 1; 1385 viewparams->bRedrawGameUI = true;
1384 continue; 1386 continue;
1385 case SCREEN_CHANGE_LOCATION://click escape 1387 case SCREEN_CHANGE_LOCATION://click escape
1386 if ( pParty->vPosition.x < -22528 ) 1388 if ( pParty->vPosition.x < -22528 )
1387 pParty->vPosition.x = -22528; 1389 pParty->vPosition.x = -22528;
1388 if ( pParty->vPosition.x > 22528 ) 1390 if ( pParty->vPosition.x > 22528 )
1391 pParty->vPosition.y = -22528; 1393 pParty->vPosition.y = -22528;
1392 if ( pParty->vPosition.y > 22528 ) 1394 if ( pParty->vPosition.y > 22528 )
1393 pParty->vPosition.y = 22528; 1395 pParty->vPosition.y = 22528;
1394 DialogueEnding(); 1396 DialogueEnding();
1395 pCurrentScreen = SCREEN_GAME; 1397 pCurrentScreen = SCREEN_GAME;
1396 viewparams->bRedrawGameUI = 1; 1398 viewparams->bRedrawGameUI = true;
1397 continue; 1399 continue;
1398 case SCREEN_VIDEO: 1400 case SCREEN_VIDEO:
1399 pVideoPlayer->Unload(); 1401 pVideoPlayer->Unload();
1400 continue; 1402 continue;
1401 case SCREEN_CHARACTERS: 1403 case SCREEN_CHARACTERS:
1424 if ( pGUIWindow_CurrentMenu == window_SpeakInHouse ) 1426 if ( pGUIWindow_CurrentMenu == window_SpeakInHouse )
1425 window_SpeakInHouse = 0; 1427 window_SpeakInHouse = 0;
1426 pGUIWindow_CurrentMenu = 0; 1428 pGUIWindow_CurrentMenu = 0;
1427 pEventTimer->Resume(); 1429 pEventTimer->Resume();
1428 pCurrentScreen = SCREEN_GAME; 1430 pCurrentScreen = SCREEN_GAME;
1429 viewparams->bRedrawGameUI = 1; 1431 viewparams->bRedrawGameUI = true;
1430 pIcons_LOD->_4355F7(); 1432 pIcons_LOD->_4355F7();
1431 continue; 1433 continue;
1432 default: 1434 default:
1433 if ( pGUIWindow_Settings ) 1435 if ( pGUIWindow_Settings )
1434 { 1436 {
1480 if ( pGUIWindow_CurrentMenu == window_SpeakInHouse ) 1482 if ( pGUIWindow_CurrentMenu == window_SpeakInHouse )
1481 window_SpeakInHouse = 0; 1483 window_SpeakInHouse = 0;
1482 pGUIWindow_CurrentMenu = 0; 1484 pGUIWindow_CurrentMenu = 0;
1483 pEventTimer->Resume(); 1485 pEventTimer->Resume();
1484 pCurrentScreen = SCREEN_GAME; 1486 pCurrentScreen = SCREEN_GAME;
1485 viewparams->bRedrawGameUI = 1; 1487 viewparams->bRedrawGameUI = true;
1486 pIcons_LOD->_4355F7(); 1488 pIcons_LOD->_4355F7();
1487 continue; 1489 continue;
1488 } 1490 }
1489 CharacterUI_ReleaseButtons(); 1491 CharacterUI_ReleaseButtons();
1490 sub_419379(); 1492 sub_419379();
1512 if ( pGUIWindow_CurrentMenu == window_SpeakInHouse ) 1514 if ( pGUIWindow_CurrentMenu == window_SpeakInHouse )
1513 window_SpeakInHouse = 0; 1515 window_SpeakInHouse = 0;
1514 pGUIWindow_CurrentMenu = 0; 1516 pGUIWindow_CurrentMenu = 0;
1515 pEventTimer->Resume(); 1517 pEventTimer->Resume();
1516 pCurrentScreen = SCREEN_GAME; 1518 pCurrentScreen = SCREEN_GAME;
1517 viewparams->bRedrawGameUI = 1; 1519 viewparams->bRedrawGameUI = true;
1518 pIcons_LOD->_4355F7(); 1520 pIcons_LOD->_4355F7();
1519 continue; 1521 continue;
1520 } 1522 }
1521 if ( !pGUIWindow_Settings )//Draw Menu 1523 if ( !pGUIWindow_Settings )//Draw Menu
1522 { 1524 {
1523 dword_6BE138 = -1; 1525 dword_6BE138 = -1;
1524 GUIWindow::Create(0x25Au, 0x1C2u, 0, 0, WINDOW_PressedButton2, (int)pBtn_GameSettings, 1); 1526 GUIWindow::Create(0x25Au, 0x1C2u, 0, 0, WINDOW_PressedButton2, (int)pBtn_GameSettings, 1);
1525 pEventTimer->Pause(); 1527 pEventTimer->Pause();
1526 pAudioPlayer->StopChannels(-1, -1); 1528 pAudioPlayer->StopChannels(-1, -1);
1529 pCurrentScreen = SCREEN_MENU;
1530
1527 ++pIcons_LOD->uTexturePacksCount; 1531 ++pIcons_LOD->uTexturePacksCount;
1528 pCurrentScreen = 1;
1529 if ( !pIcons_LOD->uNumPrevLoadedFiles ) 1532 if ( !pIcons_LOD->uNumPrevLoadedFiles )
1530 pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles; 1533 pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles;
1534
1531 pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_OptionsButtons, 0, 0); 1535 pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_OptionsButtons, 0, 0);
1532 uTextureID_Options = pIcons_LOD->LoadTexture("options", TEXTURE_16BIT_PALETTE); 1536 uTextureID_Options = pIcons_LOD->LoadTexture("options", TEXTURE_16BIT_PALETTE);
1533 uTextureID_New1 = pIcons_LOD->LoadTexture("new1", TEXTURE_16BIT_PALETTE); 1537 uTextureID_New1 = pIcons_LOD->LoadTexture("new1", TEXTURE_16BIT_PALETTE);
1534 uTextureID_Load1 = pIcons_LOD->LoadTexture("load1", TEXTURE_16BIT_PALETTE); 1538 uTextureID_Load1 = pIcons_LOD->LoadTexture("load1", TEXTURE_16BIT_PALETTE);
1535 uTextureID_Save1 = pIcons_LOD->LoadTexture("save1", TEXTURE_16BIT_PALETTE); 1539 uTextureID_Save1 = pIcons_LOD->LoadTexture("save1", TEXTURE_16BIT_PALETTE);
1661 case UIMSG_TransitionWindowCloseBtn: 1665 case UIMSG_TransitionWindowCloseBtn:
1662 CloseWindowBackground(); 1666 CloseWindowBackground();
1663 pVideoPlayer->Unload(); 1667 pVideoPlayer->Unload();
1664 DialogueEnding(); 1668 DialogueEnding();
1665 start_event_seq_number = 0; 1669 start_event_seq_number = 0;
1666 viewparams->bRedrawGameUI = 1; 1670 viewparams->bRedrawGameUI = true;
1667 continue; 1671 continue;
1668 case UIMSG_CycleCharacters: 1672 case UIMSG_CycleCharacters:
1669 v39 = GetAsyncKeyState(VK_SHIFT); 1673 v39 = GetAsyncKeyState(VK_SHIFT);
1670 uActiveCharacter = CycleCharacter(v39); 1674 uActiveCharacter = CycleCharacter(v39);
1671 viewparams->bRedrawGameUI = 1; 1675 viewparams->bRedrawGameUI = true;
1672 continue; 1676 continue;
1673 case UIMSG_OnTravelByFoot: 1677 case UIMSG_OnTravelByFoot:
1674 if ( pMessageQueue_50CBD0->uNumMessages ) 1678 if ( pMessageQueue_50CBD0->uNumMessages )
1675 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; 1679 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
1676 dword_50CDC8 = 1; 1680 dword_50CDC8 = 1;
2293 if ( v216.uPropCount == 1 ) 2297 if ( v216.uPropCount == 1 )
2294 { 2298 {
2295 pNPCData4 = (NPCData *)((signed int)pGames_LOD->uNumSubDirs / 2); 2299 pNPCData4 = (NPCData *)((signed int)pGames_LOD->uNumSubDirs / 2);
2296 v70 = atoi(v216.pProperties[0]); 2300 v70 = atoi(v216.pProperties[0]);
2297 if ( v70 <= 0 || v70 >= 77 ) 2301 if ( v70 <= 0 || v70 >= 77 )
2298 {
2299 v1 = "";
2300 continue; 2302 continue;
2301 }
2302 v71 = v70; 2303 v71 = v70;
2303 strcpy(Str2, pMapStats->pInfos[v70].pFilename); 2304 strcpy(Str2, pMapStats->pInfos[v70].pFilename);
2304 pNPCData3 = 0; 2305 pNPCData3 = 0;
2305 if ( (signed int)pNPCData4 > 0 ) 2306 if ( (signed int)pNPCData4 > 0 )
2306 { 2307 {
2317 { 2318 {
2318 strcpy(pCurrentMapName, (const char *)&pGames_LOD->pSubIndices[(int)pNPCData3]); 2319 strcpy(pCurrentMapName, (const char *)&pGames_LOD->pSubIndices[(int)pNPCData3]);
2319 dword_6BE364_game_settings_1 |= 1u; 2320 dword_6BE364_game_settings_1 |= 1u;
2320 uGameState = GAME_STATE_2; 2321 uGameState = GAME_STATE_2;
2321 OnMapLeave(); 2322 OnMapLeave();
2322 v1 = "";
2323 continue; 2323 continue;
2324 } 2324 }
2325 } 2325 }
2326 sprintf(Str2, "No map found for %s", pMapStats->pInfos[v71].pName); 2326 sprintf(Str2, "No map found for %s", pMapStats->pInfos[v71].pName);
2327 v73 = Str2; 2327 v73 = Str2;
2328 } 2328 }
2329 else 2329 else
2330 { 2330 {
2331 if ( v216.uPropCount != 3 ) 2331 if ( v216.uPropCount != 3 )
2332 {
2333 v1 = "";
2334 continue; 2332 continue;
2335 }
2336 v74 = atoi(v216.pProperties[0]); 2333 v74 = atoi(v216.pProperties[0]);
2337 thisi = atoi(v216.pProperties[1]); 2334 thisi = atoi(v216.pProperties[1]);
2338 v75 = atoi(v216.pProperties[2]); 2335 v75 = atoi(v216.pProperties[2]);
2339 v76 = v75; 2336 v76 = v75;
2340 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor) 2337 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor)
2344 v77 = thisi; 2341 v77 = thisi;
2345 pParty->vPosition.x = v74; 2342 pParty->vPosition.x = v74;
2346 pParty->vPosition.y = v77; 2343 pParty->vPosition.y = v77;
2347 pParty->vPosition.z = v76; 2344 pParty->vPosition.z = v76;
2348 pParty->uFallStartY = v76; 2345 pParty->uFallStartY = v76;
2349 v1 = "";
2350 continue; 2346 continue;
2351 } 2347 }
2352 } 2348 }
2353 else 2349 else
2354 { 2350 {
2363 { 2359 {
2364 pParty->vPosition.x = v74; 2360 pParty->vPosition.x = v74;
2365 pParty->vPosition.y = v77; 2361 pParty->vPosition.y = v77;
2366 pParty->vPosition.z = v76; 2362 pParty->vPosition.z = v76;
2367 pParty->uFallStartY = v76; 2363 pParty->uFallStartY = v76;
2368 v1 = "";
2369 continue; 2364 continue;
2370 } 2365 }
2371 } 2366 }
2372 } 2367 }
2373 } 2368 }
2374 } 2369 }
2375 pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0); 2370 pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0);
2376 v73 = "Can't jump to that location!"; 2371 v73 = "Can't jump to that location!";
2377 } 2372 }
2378 ShowStatusBarString(v73, 6u); 2373 ShowStatusBarString(v73, 6u);
2379 v1 = "";
2380 continue; 2374 continue;
2381 case UIMSG_CastQuickSpell: 2375 case UIMSG_CastQuickSpell:
2382 if ( bUnderwater == 1 ) 2376 if ( bUnderwater == 1 )
2383 { 2377 {
2384 ShowStatusBarString(pGlobalTXT_LocalizationStrings[652], 2);// "You can not do that while you are underwater!" 2378 ShowStatusBarString(pGlobalTXT_LocalizationStrings[652], 2);// "You can not do that while you are underwater!"
2385 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); 2379 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0);
2386 continue; 2380 continue;
2387 } 2381 }
2388 if ( !uActiveCharacter || (pPlayer2 = pPlayers[uActiveCharacter], pPlayer2->uTimeToRecovery) ) 2382 if ( !uActiveCharacter || (pPlayer2 = pPlayers[uActiveCharacter], pPlayer2->uTimeToRecovery) )
2389 {
2390 v1 = "";
2391 continue; 2383 continue;
2392 }
2393 _42777D_CastSpell_UseWand_ShootArrow(pPlayer2->uQuickSpell, uActiveCharacter - 1, 0, 0, uActiveCharacter); 2384 _42777D_CastSpell_UseWand_ShootArrow(pPlayer2->uQuickSpell, uActiveCharacter - 1, 0, 0, uActiveCharacter);
2394 continue; 2385 continue;
2395 case UIMSG_CastSpell_Monster_Improvement: 2386 case UIMSG_CastSpell_Monster_Improvement:
2396 case UIMSG_CastSpell_Shoot_Monster://FireBlow, Lightning, Ice Lightning, Swarm, 2387 case UIMSG_CastSpell_Shoot_Monster://FireBlow, Lightning, Ice Lightning, Swarm,
2397 if ( pRenderer->pRenderD3D ) 2388 if ( pRenderer->pRenderD3D )
2406 } 2397 }
2407 v83 = v81; 2398 v83 = v81;
2408 v44 = (unsigned __int16)v81; 2399 v44 = (unsigned __int16)v81;
2409 v84 = v83 >> 16; 2400 v84 = v83 >> 16;
2410 if ( PID_TYPE(v44) != 3 || v84 >= 5120 ) 2401 if ( PID_TYPE(v44) != 3 || v84 >= 5120 )
2411 {
2412 v1 = "";
2413 continue; 2402 continue;
2414 }
2415 pSpellInfo = (CastSpellInfo *)pGUIWindow_Settings->ptr_1C; 2403 pSpellInfo = (CastSpellInfo *)pGUIWindow_Settings->ptr_1C;
2416 if ( uMessage == UIMSG_CastSpell_Shoot_Monster ) 2404 if ( uMessage == UIMSG_CastSpell_Shoot_Monster )
2417 { 2405 {
2418 LOBYTE(pSpellInfo->field_8) &= 0xF7; 2406 LOBYTE(pSpellInfo->field_8) &= 0xF7;
2419 } 2407 }
2435 back_to_game(); 2423 back_to_game();
2436 continue; 2424 continue;
2437 case UIMSG_1C: 2425 case UIMSG_1C:
2438 __debugbreak(); 2426 __debugbreak();
2439 if ( !uActiveCharacter || pCurrentScreen ) 2427 if ( !uActiveCharacter || pCurrentScreen )
2440 {
2441 v1 = "";
2442 continue; 2428 continue;
2443 }
2444 ptr_507BC8 = GUIWindow::Create(0, 0, 640, 480, WINDOW_68, uMessageParam, 0); 2429 ptr_507BC8 = GUIWindow::Create(0, 0, 640, 480, WINDOW_68, uMessageParam, 0);
2445 pCurrentScreen = SCREEN_19; 2430 pCurrentScreen = SCREEN_19;
2446 pEventTimer->Pause(); 2431 pEventTimer->Pause();
2447 continue; 2432 continue;
2448 case UIMSG_1B: 2433 case UIMSG_1B:
2449 __debugbreak(); 2434 __debugbreak();
2450 if ( !uActiveCharacter ) 2435 if ( !uActiveCharacter )
2451 {
2452 v1 = "";
2453 continue; 2436 continue;
2454 }
2455 if ( pParty->bTurnBasedModeOn != 1 ) 2437 if ( pParty->bTurnBasedModeOn != 1 )
2456 { 2438 {
2457 if ( pActors[uMessageParam].uAIState == 5 ) 2439 if ( pActors[uMessageParam].uAIState == 5 )
2458 stru_50C198.LootActor(&pActors[uMessageParam]); 2440 stru_50C198.LootActor(&pActors[uMessageParam]);
2459 else 2441 else
2460 Actor::StealFrom(uMessageParam); 2442 Actor::StealFrom(uMessageParam);
2461 continue; 2443 continue;
2462 } 2444 }
2463 if ( pTurnEngine->field_4 == 1 || pTurnEngine->field_4 == 3 ) 2445 if ( pTurnEngine->field_4 == 1 || pTurnEngine->field_4 == 3 )
2464 {
2465 v1 = "";
2466 continue; 2446 continue;
2467 }
2468 if ( !(pTurnEngine->field_18 & 2) ) 2447 if ( !(pTurnEngine->field_18 & 2) )
2469 { 2448 {
2470 if ( pActors[uMessageParam].uAIState == 5 ) 2449 if ( pActors[uMessageParam].uAIState == 5 )
2471 stru_50C198.LootActor(&pActors[uMessageParam]); 2450 stru_50C198.LootActor(&pActors[uMessageParam]);
2472 else 2451 else
2474 } 2453 }
2475 continue; 2454 continue;
2476 2455
2477 case UIMSG_Attack: 2456 case UIMSG_Attack:
2478 if ( !uActiveCharacter ) 2457 if ( !uActiveCharacter )
2479 {
2480 v1 = "";
2481 continue; 2458 continue;
2482 }
2483 if ( pParty->bTurnBasedModeOn != 1 ) 2459 if ( pParty->bTurnBasedModeOn != 1 )
2484 { 2460 {
2485 _42ECB5_PlayerAttacksActor(); 2461 _42ECB5_PlayerAttacksActor();
2486 continue; 2462 continue;
2487 } 2463 }
2488 if ( pTurnEngine->field_4 == 1 || pTurnEngine->field_4 == 3 ) 2464 if ( pTurnEngine->field_4 == 1 || pTurnEngine->field_4 == 3 )
2489 {
2490 v1 = "";
2491 continue; 2465 continue;
2492 }
2493 if ( !(pTurnEngine->field_18 & 2) ) 2466 if ( !(pTurnEngine->field_18 & 2) )
2494 _42ECB5_PlayerAttacksActor(); 2467 _42ECB5_PlayerAttacksActor();
2495 continue; 2468 continue;
2496 case UIMSG_ExitRest: 2469 case UIMSG_ExitRest:
2497 GUIWindow::Create(pButton_RestUI_Exit->uX, pButton_RestUI_Exit->uY, 0, 0, WINDOW_CloseRestWindowBtn, (int)pButton_RestUI_Exit, (int)pGlobalTXT_LocalizationStrings[81]);// "Exit Rest" 2470 GUIWindow::Create(pButton_RestUI_Exit->uX, pButton_RestUI_Exit->uY, 0, 0, WINDOW_CloseRestWindowBtn, (int)pButton_RestUI_Exit, (int)pGlobalTXT_LocalizationStrings[81]);// "Exit Rest"
2520 dword_506F14 = 1; 2493 dword_506F14 = 1;
2521 _506F18_num_hours_to_sleep = 60; 2494 _506F18_num_hours_to_sleep = 60;
2522 continue; 2495 continue;
2523 case UIMSG_RentRoom: 2496 case UIMSG_RentRoom:
2524 dword_506F14 = 2; 2497 dword_506F14 = 2;
2525 RestUI_Initialize(); 2498 RestUI_Load();
2526 v86 = 60 * (_494820_training_time(pParty->uCurrentHour) + 1) - pParty->uCurrentMinute; 2499 v86 = 60 * (_494820_training_time(pParty->uCurrentHour) + 1) - pParty->uCurrentMinute;
2527 _506F18_num_hours_to_sleep = v86; 2500 _506F18_num_hours_to_sleep = v86;
2528 if ( uMessageParam == 111 || uMessageParam == 114 || uMessageParam == 116 ) 2501 if ( uMessageParam == 111 || uMessageParam == 114 || uMessageParam == 116 )
2529 _506F18_num_hours_to_sleep = v86 + 720; 2502 _506F18_num_hours_to_sleep = v86 + 720;
2530 dword_506F14 = 2; 2503 dword_506F14 = 2;
2550 v88 = pGlobalTXT_LocalizationStrings[480];// "There are hostile enemies near!" 2523 v88 = pGlobalTXT_LocalizationStrings[480];// "There are hostile enemies near!"
2551 if ( pParty->uFlags & 0x88 ) 2524 if ( pParty->uFlags & 0x88 )
2552 v88 = pGlobalTXT_LocalizationStrings[479];// "You can't rest here!" 2525 v88 = pGlobalTXT_LocalizationStrings[479];// "You can't rest here!"
2553 ShowStatusBarString(v88, 2); 2526 ShowStatusBarString(v88, 2);
2554 if ( !uActiveCharacter ) 2527 if ( !uActiveCharacter )
2555 {
2556 v1 = "";
2557 continue; 2528 continue;
2558 }
2559 pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)13, 0); 2529 pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)13, 0);
2560 continue; 2530 continue;
2561 } 2531 }
2562 if ( pParty->bTurnBasedModeOn == 1 ) 2532 if ( pParty->bTurnBasedModeOn == 1 )
2563 { 2533 {
2564 ShowStatusBarString(pGlobalTXT_LocalizationStrings[478], 2);// "You can't rest in turn-based mode!" 2534 ShowStatusBarString(pGlobalTXT_LocalizationStrings[478], 2);// "You can't rest in turn-based mode!"
2565 continue; 2535 continue;
2566 } 2536 }
2567 if ( !(pParty->uFlags & 0x88) ) 2537 if ( !(pParty->uFlags & 0x88) )
2568 { 2538 {
2569 RestUI_Initialize(); 2539 RestUI_Load();
2570 continue; 2540 continue;
2571 } 2541 }
2572 if ( pParty->bTurnBasedModeOn == 1 ) 2542 if ( pParty->bTurnBasedModeOn == 1 )
2573 { 2543 {
2574 ShowStatusBarString(pGlobalTXT_LocalizationStrings[478], 2);// "You can't rest in turn-based mode!" 2544 ShowStatusBarString(pGlobalTXT_LocalizationStrings[478], 2);// "You can't rest in turn-based mode!"
2577 v88 = pGlobalTXT_LocalizationStrings[480];// "There are hostile enemies near!" 2547 v88 = pGlobalTXT_LocalizationStrings[480];// "There are hostile enemies near!"
2578 if ( pParty->uFlags & 0x88 ) 2548 if ( pParty->uFlags & 0x88 )
2579 v88 = pGlobalTXT_LocalizationStrings[479];// "You can't rest here!" 2549 v88 = pGlobalTXT_LocalizationStrings[479];// "You can't rest here!"
2580 ShowStatusBarString(v88, 2u); 2550 ShowStatusBarString(v88, 2u);
2581 if ( !uActiveCharacter ) 2551 if ( !uActiveCharacter )
2582 {
2583 v1 = "";
2584 continue; 2552 continue;
2585 }
2586 pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)13, 0); 2553 pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)13, 0);
2587 continue; 2554 continue;
2588 case UIMSG_Rest8Hour: 2555 case UIMSG_Rest8Hour:
2589 if ( dword_506F14 ) 2556 if ( dword_506F14 )
2590 { 2557 {
2801 dword_50C9EC[3 * dword_50C9E8] = UIMSG_CastSpellFromBook; 2768 dword_50C9EC[3 * dword_50C9E8] = UIMSG_CastSpellFromBook;
2802 dword_50C9EC[3 * dword_50C9E8 + 1] = v103; 2769 dword_50C9EC[3 * dword_50C9E8 + 1] = v103;
2803 dword_50C9EC[3 * dword_50C9E8 + 2] = uActiveCharacter - 1; 2770 dword_50C9EC[3 * dword_50C9E8 + 2] = uActiveCharacter - 1;
2804 ++dword_50C9E8; 2771 ++dword_50C9E8;
2805 }*/ 2772 }*/
2806 pMessageQueue_50CBD0->AddMessage(UIMSG_CastSpellFromBook, v103, uActiveCharacter - 1); 2773 pMessageQueue_50C9E8->AddMessage(UIMSG_CastSpellFromBook, v103, uActiveCharacter - 1);
2774 // pMessageQueue_50CBD0->AddMessage(UIMSG_CastSpellFromBook, v103, uActiveCharacter - 1);
2807 } 2775 }
2808 else 2776 else
2809 { 2777 {
2810 byte_506550 = 1; 2778 byte_506550 = 1;
2811 quick_spell_at_page = uMessageParam + 1; 2779 quick_spell_at_page = uMessageParam + 1;
2817 case UIMSG_CastSpellFromBook: 2785 case UIMSG_CastSpellFromBook:
2818 if ( pTurnEngine->field_4 != 3 ) 2786 if ( pTurnEngine->field_4 != 3 )
2819 _42777D_CastSpell_UseWand_ShootArrow(uMessageParam, v199, 0, 0, 0); 2787 _42777D_CastSpell_UseWand_ShootArrow(uMessageParam, v199, 0, 0, 0);
2820 continue; 2788 continue;
2821 2789
2822 case UIMSG_92: 2790 case UIMSG_SpellScrollUse:
2823 __debugbreak(); 2791 __debugbreak();
2824 if ( pTurnEngine->field_4 != 3 ) 2792 if ( pTurnEngine->field_4 != 3 )
2825 _42777D_CastSpell_UseWand_ShootArrow(uMessageParam, v199, 133, 1, 0); 2793 _42777D_CastSpell_UseWand_ShootArrow(uMessageParam, v199, 133, 1, 0);
2826 continue; 2794 continue;
2827 case UIMSG_SpellBookWindow: 2795 case UIMSG_SpellBookWindow:
2941 v121 = 600; 2909 v121 = 600;
2942 } 2910 }
2943 pCharacterScreen_DetalizBtn = pGUIWindow_CurrentMenu->CreateButton(v121, v123, v125, v128, 1, 0, UIMSG_ChangeDetaliz, 0, 0, 2911 pCharacterScreen_DetalizBtn = pGUIWindow_CurrentMenu->CreateButton(v121, v123, v125, v128, 1, 0, UIMSG_ChangeDetaliz, 0, 0,
2944 pGlobalTXT_LocalizationStrings[64],// "Detail Toggle" 2912 pGlobalTXT_LocalizationStrings[64],// "Detail Toggle"
2945 0); 2913 0);
2946 pCharacterScreen_DollBtn = pGUIWindow_CurrentMenu->CreateButton(0x1DCu, 0, 0xA4u, 0x159u, 1, 0, UIMSG_ClickPaperdoll, 0, 0, v1, 0); 2914 pCharacterScreen_DollBtn = pGUIWindow_CurrentMenu->CreateButton(0x1DCu, 0, 0xA4u, 0x159u, 1, 0, UIMSG_ClickPaperdoll, 0, 0, "", 0);
2947 viewparams->bRedrawGameUI = 1; 2915 viewparams->bRedrawGameUI = 1;
2948 continue; 2916 continue;
2949 case UIMSG_ClickPaperdoll: 2917 case UIMSG_ClickPaperdoll:
2950 OnPaperdollLeftClick(); 2918 OnPaperdollLeftClick();
2951 continue; 2919 continue;
3259 default: 3227 default:
3260 continue; 3228 continue;
3261 } 3229 }
3262 } 3230 }
3263 } 3231 }
3264 pMessageQueue_50CBD0->uNumMessages = dword_50C9E8; 3232 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50C9E8->uNumMessages;//dword_50C9E8;
3265 memcpy(pMessageQueue_50CBD0->pMessages, dword_50C9EC, 12 * dword_50C9E8); 3233 memcpy(pMessageQueue_50CBD0->pMessages, pMessageQueue_50C9E8->pMessages, sizeof(GUIMessage) * pMessageQueue_50C9E8->uNumMessages);
3266 dword_50C9E8 = 0; 3234 //memcpy(pMessageQueue_50CBD0->pMessages, dword_50C9EC, 12 * dword_50C9E8);
3235 //dword_50C9E8 = 0;
3236
3237
3238 pMessageQueue_50C9E8->uNumMessages=0;
3267 if ( dword_50C9DC ) 3239 if ( dword_50C9DC )
3268 { 3240 {
3269 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) 3241 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 )
3270 { 3242 {
3271 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)dword_50C9DC; 3243 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)dword_50C9DC;
3393 pAudioPlayer->PlaySound(SOUND_Button, 0, 0, -1, 0, 0, 0, 0); 3365 pAudioPlayer->PlaySound(SOUND_Button, 0, 0, -1, 0, 0, 0, 0);
3394 player->PlaySound(SPEECH_PickMe, 0); 3366 player->PlaySound(SPEECH_PickMe, 0);
3395 break; 3367 break;
3396 case UIMSG_PlayerCreation_FacePrev: 3368 case UIMSG_PlayerCreation_FacePrev:
3397 pPlayer = &pParty->pPlayers[pParam]; 3369 pPlayer = &pParty->pPlayers[pParam];
3398 if (!pPlayer->uFace) 3370 if (!pPlayer->uCurrentFace)
3399 pPlayer->uFace = 19; 3371 pPlayer->uCurrentFace = 19;
3400 else 3372 else
3401 pPlayer->uFace -= 1; 3373 pPlayer->uCurrentFace -= 1;
3402 pPlayer->uVoiceID = pPlayer->uFace; 3374 pPlayer->uVoiceID = pPlayer->uCurrentFace;
3403 pPlayer->SetInitialStats(); 3375 pPlayer->SetInitialStats();
3404 pPlayer->SetSexByVoice(); 3376 pPlayer->SetSexByVoice();
3405 pPlayer->RandomizeName(); 3377 pPlayer->RandomizeName();
3406 v25 = pParam; 3378 v25 = pParam;
3407 pGUIWindow_CurrentMenu->pCurrentPosActiveItem = (pGUIWindow_CurrentMenu->pCurrentPosActiveItem - pGUIWindow_CurrentMenu->pStartingPosActiveItem) 3379 pGUIWindow_CurrentMenu->pCurrentPosActiveItem = (pGUIWindow_CurrentMenu->pCurrentPosActiveItem - pGUIWindow_CurrentMenu->pStartingPosActiveItem)
3411 pAudioPlayer->PlaySound(SOUND_Button, 0, 0, -1, 0, 0, 0.0, 0); 3383 pAudioPlayer->PlaySound(SOUND_Button, 0, 0, -1, 0, 0, 0.0, 0);
3412 pPlayer->PlaySound(SPEECH_PickMe, 0); 3384 pPlayer->PlaySound(SPEECH_PickMe, 0);
3413 break; 3385 break;
3414 case UIMSG_PlayerCreation_FaceNext: 3386 case UIMSG_PlayerCreation_FaceNext:
3415 pPlayer = &pParty->pPlayers[pParam]; 3387 pPlayer = &pParty->pPlayers[pParam];
3416 v20 = (char)((int)pPlayer->uFace + 1) % 20; 3388 v20 = (char)((int)pPlayer->uCurrentFace + 1) % 20;
3417 pPlayer->uFace = v20; 3389 pPlayer->uCurrentFace = v20;
3418 pPlayer->uVoiceID = v20; 3390 pPlayer->uVoiceID = v20;
3419 pPlayer->SetInitialStats(); 3391 pPlayer->SetInitialStats();
3420 pPlayer->SetSexByVoice(); 3392 pPlayer->SetSexByVoice();
3421 pPlayer->RandomizeName(); 3393 pPlayer->RandomizeName();
3422 v21 = pParam; 3394 v21 = pParam;
3663 } 3635 }
3664 3636
3665 //----- (004369DB) -------------------------------------------------------- 3637 //----- (004369DB) --------------------------------------------------------
3666 void Vec3_float_::Normalize() 3638 void Vec3_float_::Normalize()
3667 { 3639 {
3668 Vec3_float_ *v1; // esi@1 3640 this->x = (1.0 / sqrt(this->x * this->x + this->y * this->y + this->z * this->z)) * this->x;
3669 double v2; // st7@1 3641 this->y = (1.0 / sqrt(this->x * this->x + this->y * this->y + this->z * this->z)) * this->y;
3670 3642 this->z = (1.0 / sqrt(this->x * this->x + this->y * this->y + this->z * this->z)) * this->z;
3671 auto a1 = this;
3672 v1 = a1;
3673 v2 = 1.0 / sqrt(a1->x * a1->x + a1->y * a1->y + a1->z * a1->z);
3674 v1->x = v2 * v1->x;
3675 v1->y = v2 * v1->y;
3676 v1->z = v2 * v1->z;
3677 } 3643 }
3678 3644
3679 //----- (004385B5) -------------------------------------------------------- 3645 //----- (004385B5) --------------------------------------------------------
3680 void stru11::CheckCPU() 3646 void stru11::CheckCPU()
3681 { 3647 {
5391 } 5357 }
5392 5358
5393 //----- (0043AA99) -------------------------------------------------------- 5359 //----- (0043AA99) --------------------------------------------------------
5394 void __fastcall Vec3_int_::Rotate(int sDepth, int sRotY, int sRotX, Vec3_int_ v, int *outx, int *outy, int *outz) 5360 void __fastcall Vec3_int_::Rotate(int sDepth, int sRotY, int sRotX, Vec3_int_ v, int *outx, int *outy, int *outz)
5395 { 5361 {
5362 /* int v7; // ebx@1
5363 int v8; // ST14_4@1
5364 int v9; // edi@1
5396 int anglea; // [sp+20h] [bp+8h]@1 5365 int anglea; // [sp+20h] [bp+8h]@1
5397 5366
5398 /* anglea = (unsigned __int64)(stru_5C6E00->SinCos(sRotX) * (signed __int64)sDepth) >> 16; 5367 v7 = sRotX;
5368 v8 = sDepth;
5369 v9 = sRotY;
5370 anglea = (unsigned __int64)(stru_5C6E00->SinCos(sRotX) * (signed __int64)sDepth) >> 16;
5399 *outx = v.x + ((unsigned __int64)(stru_5C6E00->SinCos(sRotY) * (signed __int64)anglea) >> 16); 5371 *outx = v.x + ((unsigned __int64)(stru_5C6E00->SinCos(sRotY) * (signed __int64)anglea) >> 16);
5400 *outy = v.y + ((unsigned __int64)(stru_5C6E00->SinCos(sRotY - stru_5C6E00->uIntegerHalfPi) * (signed __int64)anglea) >> 16); 5372 *outy = v.y + ((unsigned __int64)(stru_5C6E00->SinCos(sRotY - stru_5C6E00->uIntegerHalfPi) * (signed __int64)anglea) >> 16);
5401 *outz = v.z + ((unsigned __int64)(stru_5C6E00->SinCos(sRotX - stru_5C6E00->uIntegerHalfPi) * (signed __int64)sDepth) >> 16);*/ 5373 *outz = v.z + ((unsigned __int64)(stru_5C6E00->SinCos(sRotX - stru_5C6E00->uIntegerHalfPi) * (signed __int64)sDepth) >> 16);*/
5402 5374
5403 float cosf_x = cosf(3.14159265f * sRotX / 1024.0f), 5375 float cosf_x = cosf(3.14159265f * sRotX / 1024.0f),
5376 sinf_x = sinf(3.14159265f * sRotX / 1024.0f),
5404 cosf_y = cosf(3.14159265f * sRotY / 1024.0f), 5377 cosf_y = cosf(3.14159265f * sRotY / 1024.0f),
5405 sinf_x = sinf(3.14159265f * sRotX / 1024.0f),
5406 sinf_y = sinf(3.14159265f * sRotY / 1024.0f); 5378 sinf_y = sinf(3.14159265f * sRotY / 1024.0f);
5407 5379 //sDepth = 14000000;
5408 sDepth = 14000000; 5380 *outx = v.x + ((unsigned __int64)(sinf_y * (signed __int64)((unsigned __int64)(cosf_x * (signed __int64)sDepth)>> 16)));
5409 anglea = (unsigned __int64)(cosf_x * (signed __int64)sDepth) >> 16; 5381 *outy = v.y + ((unsigned __int64)(cosf_y * (signed __int64)((unsigned __int64)(cosf_x * (signed __int64)sDepth)>> 16)));
5410 *outx = v.x + (unsigned __int64)(sinf_y * (signed __int64)anglea);
5411 *outy = v.y + (unsigned __int64)(cosf_y * (signed __int64)anglea);
5412 *outz = v.z + ((unsigned __int64)(sinf_x * (signed __int64)sDepth) >> 16); 5382 *outz = v.z + ((unsigned __int64)(sinf_x * (signed __int64)sDepth) >> 16);
5413 5383
5414 } 5384 }
5415 5385
5416 //----- (0043AB61) -------------------------------------------------------- 5386 //----- (0043AB61) --------------------------------------------------------
5417 void Vec3_int_::Normalize(int *x, int *y, int *z) 5387 void Vec3_int_::Normalize(int *x, int *y, int *z)
5418 { 5388 {
5419 int *v3; // edi@1 5389 *x *= 65536 / (integer_sqrt(*y * *y + *z * *z + *x * *x) | 1);
5420 int *v4; // esi@1 5390 *y *= 65536 / (integer_sqrt(*y * *y + *z * *z + *x * *x) | 1);
5421 signed int v5; // eax@1 5391 *z *= 65536 / (integer_sqrt(*y * *y + *z * *z + *x * *x) | 1);
5422
5423 v3 = x;
5424 v4 = y;
5425 v5 = integer_sqrt(*y * *y + *z * *z + *x * *x);
5426 *v3 *= 65536 / (v5 | 1);
5427 *v4 *= 65536 / (v5 | 1);
5428 *z *= 65536 / (v5 | 1);
5429 } 5392 }
5430 5393
5431 //----- (0043AE12) -------------------------------------------------------- 5394 //----- (0043AE12) --------------------------------------------------------
5432 double __fastcall sub_43AE12(signed int a1) 5395 double __fastcall sub_43AE12(signed int a1)
5433 { 5396 {
5453 else 5416 else
5454 result = flt_4E4A80[0]; 5417 result = flt_4E4A80[0];
5455 } 5418 }
5456 else 5419 else
5457 { 5420 {
5458 result = (flt_4E4A80[v2] - *(float *)&aAuthenticamd[4 * v2 + 12]) 5421 result = (flt_4E4A80[v2] - flt_4E4A80[v2 - 3]) * (v3 - flt_4E4A80[v2 + 4]) / (flt_4E4A80[v2 + 5] - flt_4E4A80[v2 + 4]) + flt_4E4A80[v2];
5459 * (v3 - flt_4E4A80[v2 + 4])
5460 / (flt_4E4A80[v2 + 5] - flt_4E4A80[v2 + 4])
5461 + flt_4E4A80[v2];
5462 } 5422 }
5463 return result; 5423 return result;
5464 } 5424 }
5465 5425
5466 //----- (0043AFE3) -------------------------------------------------------- 5426 //----- (0043AFE3) --------------------------------------------------------
6047 papredoll_drhs[v1] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); 6007 papredoll_drhs[v1] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
6048 wsprintfA(pContainer, "pc23v%dlh", v9); 6008 wsprintfA(pContainer, "pc23v%dlh", v9);
6049 papredoll_dlhs[v1] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); 6009 papredoll_dlhs[v1] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
6050 wsprintfA(pContainer, "pc23v%dlhu", v9); 6010 wsprintfA(pContainer, "pc23v%dlhu", v9);
6051 papredoll_dlhus[v1] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); 6011 papredoll_dlhus[v1] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
6052 v6 = pPlayers[v1 + 1]->uFace; 6012 v6 = pPlayers[v1 + 1]->uCurrentFace;
6053 if ( v6 == 12 || v6 == 13 ) 6013 if ( v6 == 12 || v6 == 13 )
6054 papredoll_dbrds[pPlayers[v8]->uFace] = 0; 6014 papredoll_dbrds[pPlayers[v8]->uCurrentFace] = 0;
6055 papredoll_flying_feet[pPlayers[v8]->uFace] = 0; 6015 papredoll_flying_feet[pPlayers[v8]->uCurrentFace] = 0;
6056 IsPlayerWearingWatersuit[v8] = 1; 6016 IsPlayerWearingWatersuit[v8] = 1;
6057 } 6017 }
6058 } 6018 }
6059 6019
6060 //----- (0043F0BD) -------------------------------------------------------- 6020 //----- (0043F0BD) --------------------------------------------------------
6072 v7 = uPlayerID; 6032 v7 = uPlayerID;
6073 if ( ((uPlayerID - 1) & 0x80000000u) == 0 ) 6033 if ( ((uPlayerID - 1) & 0x80000000u) == 0 )
6074 { 6034 {
6075 v2 = &pPlayers[uPlayerID]; 6035 v2 = &pPlayers[uPlayerID];
6076 v3 = uPlayerID - 1; 6036 v3 = uPlayerID - 1;
6077 papredoll_dbods[v3] = pIcons_LOD->LoadTexture(dbod_texnames_by_face[(*v2)->uFace], TEXTURE_16BIT_PALETTE); 6037 papredoll_dbods[v3] = pIcons_LOD->LoadTexture(dbod_texnames_by_face[(*v2)->uCurrentFace], TEXTURE_16BIT_PALETTE);
6078 papredoll_dlads[v3] = pIcons_LOD->LoadTexture(dlad_texnames_by_face[(*v2)->uFace], TEXTURE_16BIT_PALETTE); 6038 papredoll_dlads[v3] = pIcons_LOD->LoadTexture(dlad_texnames_by_face[(*v2)->uCurrentFace], TEXTURE_16BIT_PALETTE);
6079 papredoll_dlaus[v3] = pIcons_LOD->LoadTexture(dlau_texnames_by_face[(*v2)->uFace], TEXTURE_16BIT_PALETTE); 6039 papredoll_dlaus[v3] = pIcons_LOD->LoadTexture(dlau_texnames_by_face[(*v2)->uCurrentFace], TEXTURE_16BIT_PALETTE);
6080 papredoll_drhs[v3] = pIcons_LOD->LoadTexture(drh_texnames_by_face[(*v2)->uFace], TEXTURE_16BIT_PALETTE); 6040 papredoll_drhs[v3] = pIcons_LOD->LoadTexture(drh_texnames_by_face[(*v2)->uCurrentFace], TEXTURE_16BIT_PALETTE);
6081 papredoll_dlhs[v3] = pIcons_LOD->LoadTexture(dlh_texnames_by_face[(*v2)->uFace], TEXTURE_16BIT_PALETTE); 6041 papredoll_dlhs[v3] = pIcons_LOD->LoadTexture(dlh_texnames_by_face[(*v2)->uCurrentFace], TEXTURE_16BIT_PALETTE);
6082 papredoll_dlhus[v3] = pIcons_LOD->LoadTexture(dlhu_texnames_by_face[(*v2)->uFace], TEXTURE_16BIT_PALETTE); 6042 papredoll_dlhus[v3] = pIcons_LOD->LoadTexture(dlhu_texnames_by_face[(*v2)->uCurrentFace], TEXTURE_16BIT_PALETTE);
6083 v4 = (int)&(*v2)->uFace; 6043 v4 = (int)&(*v2)->uCurrentFace;
6084 v5 = *(char *)v4; 6044 v5 = *(char *)v4;
6085 if ( *(char *)v4 == 12 || v5 == 13 ) 6045 if ( *(char *)v4 == 12 || v5 == 13 )
6086 { 6046 {
6087 wsprintfA(pContainer, "pc%02dbrd", v5 + 1); 6047 wsprintfA(pContainer, "pc%02dbrd", v5 + 1);
6088 v4 = (int)&(*v2)->uFace; 6048 v4 = (int)&(*v2)->uCurrentFace;
6089 papredoll_dbrds[*(char *)v4] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); 6049 papredoll_dbrds[*(char *)v4] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
6090 } 6050 }
6091 wsprintfA(pContainer, "item281pc%02d", *(char *)v4 + 1); 6051 wsprintfA(pContainer, "item281pc%02d", *(char *)v4 + 1);
6092 papredoll_flying_feet[(*v2)->uFace] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); 6052 papredoll_flying_feet[(*v2)->uCurrentFace] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
6093 result = v7; 6053 result = v7;
6094 IsPlayerWearingWatersuit[v7] = 0; 6054 IsPlayerWearingWatersuit[v7] = 0;
6095 } 6055 }
6096 return result; 6056 return result;
6097 } 6057 }
9157 return v5; 9117 return v5;
9158 } 9118 }
9159 9119
9160 9120
9161 //----- (0040D75D) -------------------------------------------------------- 9121 //----- (0040D75D) --------------------------------------------------------
9162 char __fastcall pPrimaryWindow_draws_text(int a1, const char *pText, int *pXY) 9122 void pPrimaryWindow_draws_text( int a1, const char *pText, int *pXY )
9163 { 9123 {
9164 const char *v3; // ST0C_4@1 9124 const char *v3; // ST0C_4@1
9165 __int64 v4; // qax@1 9125 __int64 v4; // qax@1
9166 9126
9167 v3 = pText; 9127 v3 = pText;
9168 v4 = LOBYTE(pFontComic->uFontHeight) - 3; 9128 v4 = LOBYTE(pFontComic->uFontHeight) - 3;
9169 return pPrimaryWindow->DrawText( 9129 pPrimaryWindow->DrawText(
9170 pFontComic, 9130 pFontComic,
9171 *pXY, 9131 *pXY,
9172 pXY[1] - (((signed int)v4 - HIDWORD(v4)) >> 1) + 3, 9132 pXY[1] - (((signed int)v4 - HIDWORD(v4)) >> 1) + 3,
9173 0, 9133 0,
9174 v3, 9134 v3,
9948 v6.DrawTitleText(pBook2Font, 0, 22u, 0, pGlobalTXT_LocalizationStrings[10], 3u);*/ 9908 v6.DrawTitleText(pBook2Font, 0, 22u, 0, pGlobalTXT_LocalizationStrings[10], 3u);*/
9949 } 9909 }
9950 // 4E1D3A: using guessed type __int16 word_4E1D3A[]; 9910 // 4E1D3A: using guessed type __int16 word_4E1D3A[];
9951 9911
9952 9912
9953 //----- (00413D3C) --------------------------------------------------------
9954 char *__cdecl GetDayPart()
9955 {
9956 if ( pParty->uCurrentHour > 4 )
9957 {
9958 if ( pParty->uCurrentHour == 5 )
9959 return pGlobalTXT_LocalizationStrings[55];
9960 if ( pParty->uCurrentHour == 20 )
9961 return pGlobalTXT_LocalizationStrings[566];
9962 if ( pParty->uCurrentHour <= 0x14 || pParty->uCurrentHour > 0x17 )
9963 return pGlobalTXT_LocalizationStrings[56];
9964 }
9965 return pGlobalTXT_LocalizationStrings[567];
9966 }
9967
9968 //----- (00413FF1) -------------------------------------------------------- 9913 //----- (00413FF1) --------------------------------------------------------
9969 void SetMonthNames() 9914 void SetMonthNames()
9970 { 9915 {
9971 aMonthNames[0] = pGlobalTXT_LocalizationStrings[415]; 9916 aMonthNames[0] = pGlobalTXT_LocalizationStrings[415];
9972 aMonthNames[1] = pGlobalTXT_LocalizationStrings[416]; 9917 aMonthNames[1] = pGlobalTXT_LocalizationStrings[416];
10105 + 2 * LOBYTE(pFontSmallnum->uFontHeight) 10050 + 2 * LOBYTE(pFontSmallnum->uFontHeight)
10106 + 24; 10051 + 24;
10107 Dst.uFrameY = 470 - Dst.uFrameHeight; 10052 Dst.uFrameY = 470 - Dst.uFrameHeight;
10108 Dst.uFrameZ = Dst.uFrameX + Dst.uFrameWidth - 1; 10053 Dst.uFrameZ = Dst.uFrameX + Dst.uFrameWidth - 1;
10109 Dst.uFrameW = 469; 10054 Dst.uFrameW = 469;
10055 //Dst.Hint = "abcagfdsgsg ljsrengvlkjesnfkjwnef";
10110 Dst.DrawMessageBox(0); 10056 Dst.DrawMessageBox(0);
10057
10111 Dst.uFrameWidth -= 24; 10058 Dst.uFrameWidth -= 24;
10112 Dst.uFrameX += 12; 10059 Dst.uFrameX += 12;
10113 Dst.uFrameY += 12; 10060 Dst.uFrameY += 12;
10114 Dst.uFrameHeight -= 12; 10061 Dst.uFrameHeight -= 12;
10115 Dst.uFrameZ = Dst.uFrameX + Dst.uFrameWidth - 1; 10062 Dst.uFrameZ = Dst.uFrameX + Dst.uFrameWidth - 1;
10116 Dst.uFrameW = Dst.uFrameY + Dst.uFrameHeight - 1; 10063 Dst.uFrameW = Dst.uFrameY + Dst.uFrameHeight - 1;
10117 Dst.DrawTitleText(pFontSmallnum, 0, 0xCu, 0, pGlobalTXT_LocalizationStrings[157], 3u); 10064 Dst.DrawTitleText(pFontSmallnum, 0, 0xCu, ui_mainmenu_copyright_color, pGlobalTXT_LocalizationStrings[157], 3);
10118 } 10065 }
10119 10066
10120 10067
10121 10068
10122 //----- (004156F0) -------------------------------------------------------- 10069 //----- (004156F0) --------------------------------------------------------
10123 void __cdecl GUI_UpdateWindows() 10070 void GUI_UpdateWindows()
10124 { 10071 {
10125 GUIWindow *pWindow; // esi@4 10072 GUIWindow *pWindow; // esi@4
10126 unsigned int pWindowType; // eax@4 10073 //unsigned int pWindowType; // eax@4
10127 char *pHint; // edx@66 10074 char *pHint; // edx@66
10128 GUIButton *pButtonPtr_1C; // ebp@79 10075 GUIButton *pButtonPtr_1C; // ebp@79
10129 char *pHint1; // edx@80 10076 char *pHint1; // edx@80
10130 int v26; // eax@98 10077 int v26; // eax@98
10131 unsigned int v27; // ebp@106 10078 unsigned int v27; // ebp@106
10149 UI_OnKeyDown(VK_NEXT); 10096 UI_OnKeyDown(VK_NEXT);
10150 10097
10151 for ( i = 1; i <= uNumVisibleWindows; ++i ) 10098 for ( i = 1; i <= uNumVisibleWindows; ++i )
10152 { 10099 {
10153 pWindow = &pWindowList[pVisibleWindowsIdxs[i] - 1]; 10100 pWindow = &pWindowList[pVisibleWindowsIdxs[i] - 1];
10154 pWindowType = pWindow->eWindowType;
10155 switch (pWindow->eWindowType) 10101 switch (pWindow->eWindowType)
10156 { 10102 {
10157 case WINDOW_OptionsButtons: 10103 case WINDOW_OptionsButtons:
10158 { 10104 {
10159 pRenderer->DrawTextureIndexed(pViewport->uViewportTL_Y, 10105 pRenderer->DrawTextureIndexed(pViewport->uViewportTL_Y,
10166 CharacterUI_CharacterScreen_Draw(pPlayers[uActiveCharacter]); 10112 CharacterUI_CharacterScreen_Draw(pPlayers[uActiveCharacter]);
10167 continue; 10113 continue;
10168 } 10114 }
10169 case WINDOW_Options: 10115 case WINDOW_Options:
10170 { 10116 {
10171 DrawGameOptions(); 10117 GameMenuUI_Options_Draw();
10172 continue; 10118 continue;
10173 } 10119 }
10174 case WINDOW_Book: 10120 case WINDOW_Book:
10175 { 10121 {
10176 BookUI_Draw((WindowType)(int)pWindow->ptr_1C); 10122 BookUI_Draw((WindowType)(int)pWindow->ptr_1C);
10177 continue; 10123 continue;
10178 } 10124 }
10179 case WINDOW_Dialogue: 10125 case WINDOW_Dialogue:
10180 { 10126 {
10181 DrawDialogueUI(); 10127 GameUI_DrawDialogue();
10182 continue; 10128 continue;
10183 } 10129 }
10184 case WINDOW_QuickReference: 10130 case WINDOW_QuickReference:
10185 { 10131 {
10186 GameUI_QuickRef_Draw(); 10132 GameUI_QuickRef_Draw();
10196 TravelUI_Draw(); 10142 TravelUI_Draw();
10197 continue; 10143 continue;
10198 } 10144 }
10199 case WINDOW_SpellBook: 10145 case WINDOW_SpellBook:
10200 { 10146 {
10201 DrawSpellBookContent(); 10147 DrawSpellBookContent(pPlayers[uActiveCharacter]);
10202 continue; 10148 continue;
10203 } 10149 }
10204 case WINDOW_GreetingNPC: 10150 case WINDOW_GreetingNPC:
10205 { 10151 {
10206 DrawBranchlessDialogueUI(); 10152 GameUI_DrawBranchlessDialogue();
10207 continue; 10153 continue;
10208 } 10154 }
10209 case WINDOW_Chest: 10155 case WINDOW_Chest:
10210 { 10156 {
10211 if ( pCurrentScreen == SCREEN_CHEST ) 10157 if ( pCurrentScreen == SCREEN_CHEST )
10221 } 10167 }
10222 continue; 10168 continue;
10223 } 10169 }
10224 case WINDOW_SaveLoadButtons: 10170 case WINDOW_SaveLoadButtons:
10225 { 10171 {
10226 sub_4606FE(); 10172 SaveUI_Draw();
10227 continue; 10173 continue;
10228 } 10174 }
10229 case WINDOW_MainMenu_Load: 10175 case WINDOW_MainMenu_Load:
10230 { 10176 {
10231 GameUI_MainMenu_DrawLoad(); 10177 LoadUI_Draw();
10232 continue; 10178 continue;
10233 } 10179 }
10234 case WINDOW_HouseInterior: 10180 case WINDOW_HouseInterior:
10235 { 10181 {
10236 pWindowList[pVisibleWindowsIdxs[i] - 1].HouseDialogManager(); 10182 pWindowList[pVisibleWindowsIdxs[i] - 1].HouseDialogManager();
10489 case WINDOW_BooksWindow: 10435 case WINDOW_BooksWindow:
10490 { 10436 {
10491 pButton = (GUIButton *)pWindow->ptr_1C; 10437 pButton = (GUIButton *)pWindow->ptr_1C;
10492 pRenderer->DrawTextureIndexed(pWindow->uFrameY, 10438 pRenderer->DrawTextureIndexed(pWindow->uFrameY,
10493 pWindow->uFrameX, pButton->pTextures[0]); 10439 pWindow->uFrameX, pButton->pTextures[0]);
10494 viewparams->bRedrawGameUI = 1; 10440 viewparams->bRedrawGameUI = true;
10495 continue; 10441 continue;
10496 } 10442 }
10497 case WINDOW_CharacterWindow_Inventory: 10443 case WINDOW_CharacterWindow_Inventory:
10498 { 10444 {
10499 pWindow->DrawMessageBox(0); 10445 pWindow->DrawMessageBox(0);
10536 if ( sub_4637E0_is_there_popup_onscreen() ) 10482 if ( sub_4637E0_is_there_popup_onscreen() )
10537 sub_416D62_ShowPopupWindow_MonsterRecord_ItemInfo_etcsub_416D62(0); 10483 sub_416D62_ShowPopupWindow_MonsterRecord_ItemInfo_etcsub_416D62(0);
10538 } 10484 }
10539 10485
10540 //----- (00416196) -------------------------------------------------------- 10486 //----- (00416196) --------------------------------------------------------
10541 void __cdecl identify_item() 10487 void identify_item()
10542 { 10488 {
10543 Player *v0; // esi@2 10489 Player *v0; // esi@2
10544 POINT *v1; // edi@2 10490 POINT *v1; // edi@2
10545 signed int v2; // ecx@5 10491 signed int v2; // ecx@5
10546 signed int v3; // eax@5 10492 signed int v3; // eax@5
10824 v26 = rand(); 10770 v26 = rand();
10825 v0->ReceiveDamage(v26 % 11 + 10, 0); 10771 v0->ReceiveDamage(v26 % 11 + 10, 0);
10826 pAudioPlayer->PlaySound(SOUND_8, 0, 0, -1, 0, 0, 0, 0); 10772 pAudioPlayer->PlaySound(SOUND_8, 0, 0, -1, 0, 0, 0, 0);
10827 10773
10828 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); 10774 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0);
10829 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) 10775
10830 {
10831 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape;
10832 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0;
10833 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0;
10834 ++pMessageQueue_50CBD0->uNumMessages;
10835 }*/
10836 v42 = (int *)&a2.y; 10776 v42 = (int *)&a2.y;
10837 v41 = (int *)&y.y; 10777 v41 = (int *)&y.y;
10838 v40 = (int *)&pOut; 10778 v40 = (int *)&pOut;
10839 v39.z = pParty->vPosition.z + pParty->sEyelevel; 10779 v39.z = pParty->vPosition.z + pParty->sEyelevel;
10840 } 10780 }
10860 { 10800 {
10861 if ( v51 != 4 ) 10801 if ( v51 != 4 )
10862 { 10802 {
10863 if ( v51 != 5 ) 10803 if ( v51 != 5 )
10864 { 10804 {
10865 v19 = v0->AddItem(0xFFFFFFFFu, 0xDCu); 10805 v19 = v0->AddItem(-1, 0xDCu);
10866 if ( v19 ) 10806 if ( v19 )
10867 *(int *)&v0->field_1F5[36 * v19 + 15] = 1; 10807 // *(int *)&v0->field_1F5[36 * v19 + 15] = 1;
10808 v0->pOwnItems[v19-1].uAttributes=ITEM_IDENTIFIED;
10868 v20 = v47 + 50 * v15; 10809 v20 = v47 + 50 * v15;
10869 v0->pInventoryItems[pOut.z].uItemID = v51; 10810 v0->pInventoryItems[pOut.z].uItemID = v51;
10870 v0->pInventoryItems[pOut.z].uEnchantmentType = (pParty->pPickedItem.uEnchantmentType 10811 v0->pInventoryItems[pOut.z].uEnchantmentType = (pParty->pPickedItem.uEnchantmentType
10871 + v0->pInventoryItems[pOut.z].uEnchantmentType) 10812 + v0->pInventoryItems[pOut.z].uEnchantmentType)
10872 / 2; 10813 / 2;
10884 { 10825 {
10885 if ( *(int *)(a2.y + 532) == 221 ) 10826 if ( *(int *)(a2.y + 532) == 221 )
10886 *(int *)(a2.y + 532) = pParty->pPickedItem.uItemID; 10827 *(int *)(a2.y + 532) = pParty->pPickedItem.uItemID;
10887 else 10828 else
10888 *(int *)(a2.y + 536) = pParty->pPickedItem.uEnchantmentType; 10829 *(int *)(a2.y + 536) = pParty->pPickedItem.uEnchantmentType;
10889 v21 = v0->AddItem(0xFFFFFFFFu, 0xDCu); 10830 v21 = v0->AddItem(-1, 0xDCu);
10890 if ( v21 ) 10831 if ( v21 )
10891 *(int *)&v0->field_1F5[36 * v21 + 15] = 1; 10832 //*(int *)&v0->field_1F5[36 * v21 + 15] = 1;
10833 v0->pOwnItems[v21-1].uAttributes=ITEM_IDENTIFIED;
10892 goto LABEL_74; 10834 goto LABEL_74;
10893 } 10835 }
10894 goto LABEL_115; 10836 goto LABEL_115;
10895 } 10837 }
10896 v0->RemoveItemAtInventoryIndex(v18); 10838 v0->RemoveItemAtInventoryIndex(v18);
10897 v0->SetCondition(0x10u, 0); 10839 v0->SetCondition(0x10u, 0);
10898 v23 = 0; 10840 v23 = 0;
10899 } 10841 }
10900 } 10842 }
10901 v0->_4160CA(v23); 10843 v0->ItemsEnchant(v23);
10902 pAudioPlayer->PlaySound(SOUND_8, 0, 0, -1, 0, 0, 0, 0); 10844 pAudioPlayer->PlaySound(SOUND_8, 0, 0, -1, 0, 0, 0, 0);
10903 10845
10904 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); 10846 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0);
10905 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) 10847
10906 {
10907 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape;
10908 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0;
10909 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0;
10910 ++pMessageQueue_50CBD0->uNumMessages;
10911 }*/
10912 v42 = (int *)&a2.y; 10848 v42 = (int *)&a2.y;
10913 v41 = (int *)&y.y; 10849 v41 = (int *)&y.y;
10914 v40 = (int *)&pOut; 10850 v40 = (int *)&pOut;
10915 v39.z = pParty->vPosition.z + pParty->sEyelevel; 10851 v39.z = pParty->vPosition.z + pParty->sEyelevel;
10916 } 10852 }
10973 } 10909 }
10974 } 10910 }
10975 10911
10976 10912
10977 //----- (00416B01) -------------------------------------------------------- 10913 //----- (00416B01) --------------------------------------------------------
10978 void __thiscall sub_416B01(void *_this)//PopupWindowForBenefitAndJoinText 10914 void GameUI_DrawNPCPopup(void *_this)//PopupWindowForBenefitAndJoinText
10979 { 10915 {
10980 int v1; // edi@2 10916 int v1; // edi@2
10981 int v2; // ecx@2 10917 int v2; // ecx@2
10982 NPCData *v3; // eax@2 10918 NPCData *v3; // eax@2
10983 NPCData *v4; // esi@7 10919 NPCData *v4; // esi@7
11359 } 11295 }
11360 return v2; 11296 return v2;
11361 } 11297 }
11362 11298
11363 //----- (004179BC) -------------------------------------------------------- 11299 //----- (004179BC) --------------------------------------------------------
11364 char __fastcall sub_4179BC_draw_tooltip(const char *a1, const char *a2) 11300 void __fastcall sub_4179BC_draw_tooltip( const char *a1, const char *a2 )
11365 { 11301 {
11366 const char *v2; // ebx@1 11302 const char *v2; // ebx@1
11367 const char *v3; // edi@1 11303 const char *v3; // edi@1
11368 unsigned int v4; // eax@1 11304 unsigned int v4; // eax@1
11369 GUIWindow Dst; // [sp+Ch] [bp-5Ch]@1 11305 GUIWindow Dst; // [sp+Ch] [bp-5Ch]@1
11370 POINT v6; // [sp+60h] [bp-8h]@1 11306 POINT v6; // [sp+60h] [bp-8h]@1
11387 Dst.uFrameZ = Dst.uFrameX + Dst.uFrameWidth - 1; 11323 Dst.uFrameZ = Dst.uFrameX + Dst.uFrameWidth - 1;
11388 Dst.uFrameW = Dst.uFrameY + Dst.uFrameHeight - 1; 11324 Dst.uFrameW = Dst.uFrameY + Dst.uFrameHeight - 1;
11389 v4 = TargetColor(0xFFu, 0xFFu, 0x9Bu); 11325 v4 = TargetColor(0xFFu, 0xFFu, 0x9Bu);
11390 sprintf(pTmpBuf, format_4E2D80, v4, v3); 11326 sprintf(pTmpBuf, format_4E2D80, v4, v3);
11391 Dst.DrawTitleText(pFontCreate, 0, 0, 0, pTmpBuf, 3u); 11327 Dst.DrawTitleText(pFontCreate, 0, 0, 0, pTmpBuf, 3u);
11392 return Dst.DrawText(pFontSmallnum, 1, LOBYTE(pFontLucida->uFontHeight), 0, v2, 0, 0, 0); 11328 Dst.DrawText(pFontSmallnum, 1, LOBYTE(pFontLucida->uFontHeight), 0, v2, 0, 0, 0);
11393 } 11329 }
11394 11330
11395 //----- (00417AD4) -------------------------------------------------------- 11331 //----- (00417AD4) --------------------------------------------------------
11396 unsigned int GetSkillColor(unsigned int uPlayerClass, PLAYER_SKILL_TYPE uPlayerSkillType, signed int skill_level) 11332 unsigned int GetSkillColor(unsigned int uPlayerClass, PLAYER_SKILL_TYPE uPlayerSkillType, signed int skill_level)
11397 { 11333 {