comparison mm7_5.cpp @ 978:9334a8c59c8d

uGameState
author Ritor1
date Thu, 09 May 2013 02:26:04 +0600
parents ac85898f5903
children a079c489118d
comparison
equal deleted inserted replaced
977:ac85898f5903 978:9334a8c59c8d
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
74 unsigned int v25; // ecx@165 74 unsigned int v25; // ecx@165
75 GUIWindow *pWindow; // eax@204 75 GUIWindow *pWindow; // eax@204
76 unsigned int v27; // edx@204 76 unsigned int v27; // edx@204
77 unsigned int v28; // ecx@204 77 unsigned int v28; // ecx@204
78 GUIWindow *pWindow2; // ecx@248 78 GUIWindow *pWindow2; // ecx@248
79 int v30; // edx@258 79 //int v30; // edx@258
80 const char *v31; // ecx@262 80 //const char *v31; // ecx@262
81 signed int v32; // eax@269 81 signed int v32; // eax@269
82 unsigned int v33; // eax@277 82 unsigned int v33; // eax@277
83 unsigned __int8 v34; // al@279 83 unsigned __int8 v34; // al@279
84 unsigned __int8 v35; // al@280 84 unsigned __int8 v35; // al@280
85 GUIWindow *pWindow3; // ecx@332 85 GUIWindow *pWindow3; // ecx@332
212 //int v163; // [sp+0h] [bp-5FCh]@59 212 //int v163; // [sp+0h] [bp-5FCh]@59
213 Texture *pTexture; // [sp+0h] [bp-5FCh]@86 213 Texture *pTexture; // [sp+0h] [bp-5FCh]@86
214 //int v165; // [sp+0h] [bp-5FCh]@107 214 //int v165; // [sp+0h] [bp-5FCh]@107
215 int v166; // [sp+0h] [bp-5FCh]@121 215 int v166; // [sp+0h] [bp-5FCh]@121
216 int v167; // [sp+0h] [bp-5FCh]@135 216 int v167; // [sp+0h] [bp-5FCh]@135
217 int v168; // [sp+0h] [bp-5FCh]@149 217 //int v168; // [sp+0h] [bp-5FCh]@149
218 int v169; // [sp+0h] [bp-5FCh]@165 218 int v169; // [sp+0h] [bp-5FCh]@165
219 int v170; // [sp+0h] [bp-5FCh]@204 219 int v170; // [sp+0h] [bp-5FCh]@204
220 signed int v171; // [sp+0h] [bp-5FCh]@259 220 //signed int v171; // [sp+0h] [bp-5FCh]@259
221 KeyToggleType pKeyToggleType; // [sp+0h] [bp-5FCh]@287 221 KeyToggleType pKeyToggleType; // [sp+0h] [bp-5FCh]@287
222 char *v173; // [sp+0h] [bp-5FCh]@444 222 char *v173; // [sp+0h] [bp-5FCh]@444
223 char *v174; // [sp+0h] [bp-5FCh]@449 223 char *v174; // [sp+0h] [bp-5FCh]@449
224 //int v175; // [sp+0h] [bp-5FCh]@550 224 //int v175; // [sp+0h] [bp-5FCh]@550
225 int v176; // [sp+0h] [bp-5FCh]@599 225 int v176; // [sp+0h] [bp-5FCh]@599
284 actor.InitializeDialogue(0); 284 actor.InitializeDialogue(0);
285 bDialogueUI_InitializeActor_NPC_ID = 0; 285 bDialogueUI_InitializeActor_NPC_ID = 0;
286 } 286 }
287 if ( pMessageQueue_50CBD0->uNumMessages ) 287 if ( pMessageQueue_50CBD0->uNumMessages )
288 { 288 {
289 v0 = 1; 289 //v0 = 1;
290 v1 = ""; 290 v1 = "";
291 while ( 2 ) 291 while ( 2 )
292 { 292 {
293 if ( !pMessageQueue_50CBD0->uNumMessages ) 293 if ( !pMessageQueue_50CBD0->uNumMessages )
294 break; 294 break;
295 295
296 pMessageQueue_50CBD0->PopMessage(&uMessage, &uMessageParam, (int *)&v199); 296 pMessageQueue_50CBD0->PopMessage(&uMessage, &uMessageParam, (int *)&v199);
297 switch ( uMessage ) 297 switch ( uMessage )
298 { 298 {
299 case UIMSG_ChangeGameState: 299 case UIMSG_ChangeGameState:
300 uGameState = v0; 300 uGameState = GAME_FINISHED;
301 continue; 301 continue;
302 case UIMSG_PlayArcomage: 302 case UIMSG_PlayArcomage:
303 pVideoPlayer->_4BF5B2(); 303 pVideoPlayer->_4BF5B2();
304 pArcomageGame->bGameInProgress = 1; 304 pArcomageGame->bGameInProgress = 1;
305 PrepareArcomage(); 305 PrepareArcomage();
306 continue; 306 continue;
307 case UIMSG_StartNPCDialogue: 307 case UIMSG_StartNPCDialogue:
308 if ( !uActiveCharacter ) 308 if ( !uActiveCharacter )
309 continue; 309 continue;
310 viewparams->field_48 = v0; 310 viewparams->field_48 = 1;
311 if ( pMessageQueue_50CBD0->uNumMessages ) 311 if ( pMessageQueue_50CBD0->uNumMessages )
312 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; 312 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
313 dword_5B65D0_dialogue_actor_npc_id = pActors[uMessageParam].sNPC_ID; 313 dword_5B65D0_dialogue_actor_npc_id = pActors[uMessageParam].sNPC_ID;
314 pActor = &pActors[uMessageParam]; 314 pActor = &pActors[uMessageParam];
315 //goto _actor_init_dlg; 315 //goto _actor_init_dlg;
316 pActor->InitializeDialogue(v0); 316 pActor->InitializeDialogue(1);
317 continue; 317 continue;
318 case UIMSG_StartHireling1Dialogue: 318 case UIMSG_StartHireling1Dialogue:
319 case UIMSG_StartHireling2Dialogue: 319 case UIMSG_StartHireling2Dialogue:
320 { 320 {
321 if (bNoNPCHiring || pCurrentScreen) 321 if (bNoNPCHiring || pCurrentScreen)
364 { 364 {
365 //Actor::Actor(&actor); 365 //Actor::Actor(&actor);
366 memset(&actor, 0, 0x344u); 366 memset(&actor, 0, 0x344u);
367 actor.sNPC_ID += -1 - (unsigned __int8)pParty->field_709 - hireling_idx; 367 actor.sNPC_ID += -1 - (unsigned __int8)pParty->field_709 - hireling_idx;
368 pActor = &actor; 368 pActor = &actor;
369 pActor->InitializeDialogue(v0); 369 pActor->InitializeDialogue(1);
370 } 370 }
371 } 371 }
372 continue; 372 continue;
373 373
374 case UIMSG_BuyInShop_Identify_Repair: 374 case UIMSG_BuyInShop_Identify_Repair:
392 pIcons_LOD->_40F9C5(); 392 pIcons_LOD->_40F9C5();
393 pIcons_LOD->_4114F2(); 393 pIcons_LOD->_4114F2();
394 if ( pMessageQueue_50CBD0->uNumMessages ) 394 if ( pMessageQueue_50CBD0->uNumMessages )
395 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; 395 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
396 pGUIWindow_CurrentMenu->Release(); 396 pGUIWindow_CurrentMenu->Release();
397 uGameState = 4; 397 uGameState = GAME_STATE_NEWGAME_OUT_GAMEMENU;
398 pCurrentScreen = SCREEN_GAME; 398 pCurrentScreen = SCREEN_GAME;
399 viewparams->bRedrawGameUI = v0; 399 viewparams->bRedrawGameUI = 1;
400 } 400 }
401 else 401 else
402 { 402 {
403 ShowStatusBarString(pGlobalTXT_LocalizationStrings[201], 2u);// "Are you sure? Click again to start a New Game" 403 ShowStatusBarString(pGlobalTXT_LocalizationStrings[201], 2u);// "Are you sure? Click again to start a New Game"
404 pAudioPlayer->PlaySound(SOUND_20001, 0, 0, -1, 0, 0, 0, 0); 404 pAudioPlayer->PlaySound(SOUND_20001, 0, 0, -1, 0, 0, 0, 0);
411 pIcons_LOD->_4114F2(); 411 pIcons_LOD->_4114F2();
412 if ( pMessageQueue_50CBD0->uNumMessages ) 412 if ( pMessageQueue_50CBD0->uNumMessages )
413 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; 413 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
414 pGUIWindow_CurrentMenu->Release(); 414 pGUIWindow_CurrentMenu->Release();
415 pCurrentScreen = SCREEN_LOADGAME; 415 pCurrentScreen = SCREEN_LOADGAME;
416 GameUI_DrawLoadMenu(v0); 416 GameUI_DrawLoadMenu(1);
417 continue; 417 continue;
418 case UIMSG_Quit: 418 case UIMSG_Quit:
419 if ( dword_6BE138 == 132 || uMessageParam ) 419 if ( dword_6BE138 == 132 || uMessageParam )
420 { 420 {
421 pIcons_LOD->_40F9C5(); 421 pIcons_LOD->_40F9C5();
422 pIcons_LOD->_4114F2(); 422 pIcons_LOD->_4114F2();
423 if ( pMessageQueue_50CBD0->uNumMessages ) 423 if ( pMessageQueue_50CBD0->uNumMessages )
424 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; 424 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
425 pGUIWindow_CurrentMenu->Release(); 425 pGUIWindow_CurrentMenu->Release();
426 pCurrentScreen = SCREEN_GAME; 426 pCurrentScreen = SCREEN_GAME;
427 viewparams->bRedrawGameUI = v0; 427 viewparams->bRedrawGameUI = 1;
428 if ( !uMessageParam ) 428 if ( !uMessageParam )
429 pAudioPlayer->PlaySound((SoundID)(SOUND_EnteringAHouse|0x1), 0, 0, -1, 0, 0, 0, 0); 429 pAudioPlayer->PlaySound((SoundID)(SOUND_EnteringAHouse|0x1), 0, 0, -1, 0, 0, 0, 0);
430 uGameState = 7; 430 uGameState = GAME_STATE_GAME_QUITTING_TO_MAIN_MENU;
431 } 431 }
432 else 432 else
433 { 433 {
434 ShowStatusBarString(pGlobalTXT_LocalizationStrings[82], 2);// "Are you sure? Click again to quit" 434 ShowStatusBarString(pGlobalTXT_LocalizationStrings[82], 2);// "Are you sure? Click again to quit"
435 pAudioPlayer->PlaySound(SOUND_20001, 0, 0, -1, 0, 0, 0, 0); 435 pAudioPlayer->PlaySound(SOUND_20001, 0, 0, -1, 0, 0, 0, 0);
461 continue; 461 continue;
462 case UIMSG_SaveLoadBtn: 462 case UIMSG_SaveLoadBtn:
463 GUIWindow::Create(241, 302, 106, 42, WINDOW_SaveLoadBtn, (int)pBtnLoadSlot, 0); 463 GUIWindow::Create(241, 302, 106, 42, WINDOW_SaveLoadBtn, (int)pBtnLoadSlot, 0);
464 continue; 464 continue;
465 case UIMSG_SelectLoadSlot: 465 case UIMSG_SelectLoadSlot:
466 if ( pGUIWindow_CurrentMenu->field_40 == v0 ) 466 if ( pGUIWindow_CurrentMenu->field_40 == 1 )
467 pKeyActionMap->_459ED1(0); 467 pKeyActionMap->_459ED1(0);
468 if ( pCurrentScreen != SCREEN_SAVEGAME || uLoadGameUI_SelectedSlot != pSaveListPosition + uMessageParam ) 468 if ( pCurrentScreen != SCREEN_SAVEGAME || uLoadGameUI_SelectedSlot != pSaveListPosition + uMessageParam )
469 { 469 {
470 v10 = pSaveListPosition + uMessageParam; 470 v10 = pSaveListPosition + uMessageParam;
471 if ( dword_6BE138 == pSaveListPosition + uMessageParam ) 471 if ( dword_6BE138 == pSaveListPosition + uMessageParam )
503 continue; 503 continue;
504 case UIMSG_LoadGame: 504 case UIMSG_LoadGame:
505 if ( pSavegameUsedSlots[uLoadGameUI_SelectedSlot] ) 505 if ( pSavegameUsedSlots[uLoadGameUI_SelectedSlot] )
506 { 506 {
507 LoadGame(uLoadGameUI_SelectedSlot); 507 LoadGame(uLoadGameUI_SelectedSlot);
508 uGameState = 3; 508 uGameState = GAME_STATE_3;
509 } 509 }
510 stru_506E40.Release(); 510 stru_506E40.Release();
511 continue; 511 continue;
512 case UIMSG_SaveGame: 512 case UIMSG_SaveGame:
513 if ( pGUIWindow_CurrentMenu->field_40 == v0 ) 513 if ( pGUIWindow_CurrentMenu->field_40 == 1 )
514 { 514 {
515 pKeyActionMap->_459ED1(0); 515 pKeyActionMap->_459ED1(0);
516 strcpy((char *)&pSavegameHeader[uLoadGameUI_SelectedSlot], (const char *)pKeyActionMap->pPressedKeysBuffer); 516 strcpy((char *)&pSavegameHeader[uLoadGameUI_SelectedSlot], (const char *)pKeyActionMap->pPressedKeysBuffer);
517 } 517 }
518 DoSavegame(uLoadGameUI_SelectedSlot); 518 DoSavegame(uLoadGameUI_SelectedSlot);
525 continue; 525 continue;
526 case UIMSG_Game_OpenOptionsDialog://Open 526 case UIMSG_Game_OpenOptionsDialog://Open
527 if ( pMessageQueue_50CBD0->uNumMessages ) 527 if ( pMessageQueue_50CBD0->uNumMessages )
528 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; 528 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
529 pGUIWindow_CurrentMenu->Release(); 529 pGUIWindow_CurrentMenu->Release();
530 viewparams->field_48 = v0; 530 viewparams->field_48 = 1;
531 pCurrentScreen = SCREEN_OPTIONS; 531 pCurrentScreen = SCREEN_OPTIONS;
532 532
533 options_menu_skin.uTextureID_Background = pIcons_LOD->LoadTexture("ControlBG", TEXTURE_16BIT_PALETTE); 533 options_menu_skin.uTextureID_Background = pIcons_LOD->LoadTexture("ControlBG", TEXTURE_16BIT_PALETTE);
534 options_menu_skin.uTextureID_TurnSpeed[2] = pIcons_LOD->LoadTexture("con_16x", TEXTURE_16BIT_PALETTE); 534 options_menu_skin.uTextureID_TurnSpeed[2] = pIcons_LOD->LoadTexture("con_16x", TEXTURE_16BIT_PALETTE);
535 options_menu_skin.uTextureID_TurnSpeed[1] = pIcons_LOD->LoadTexture("con_32x", TEXTURE_16BIT_PALETTE); 535 options_menu_skin.uTextureID_TurnSpeed[1] = pIcons_LOD->LoadTexture("con_32x", TEXTURE_16BIT_PALETTE);
553 553
554 pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_Options, 0, 0); 554 pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_Options, 0, 0);
555 pGUIWindow_CurrentMenu->CreateButton(22, 270, 555 pGUIWindow_CurrentMenu->CreateButton(22, 270,
556 pIcons_LOD->GetTexture(options_menu_skin.uTextureID_TurnSpeed[2])->uTextureWidth, 556 pIcons_LOD->GetTexture(options_menu_skin.uTextureID_TurnSpeed[2])->uTextureWidth,
557 pIcons_LOD->GetTexture(options_menu_skin.uTextureID_TurnSpeed[2])->uTextureHeight, 557 pIcons_LOD->GetTexture(options_menu_skin.uTextureID_TurnSpeed[2])->uTextureHeight,
558 v0, 0, UIMSG_SetTurnSpeed, 0x80, 0, v1, 0); 558 1, 0, UIMSG_SetTurnSpeed, 0x80, 0, v1, 0);
559 pGUIWindow_CurrentMenu->CreateButton(93, 270, 559 pGUIWindow_CurrentMenu->CreateButton(93, 270,
560 pIcons_LOD->GetTexture(options_menu_skin.uTextureID_TurnSpeed[1])->uTextureWidth, 560 pIcons_LOD->GetTexture(options_menu_skin.uTextureID_TurnSpeed[1])->uTextureWidth,
561 pIcons_LOD->GetTexture(options_menu_skin.uTextureID_TurnSpeed[1])->uTextureHeight, 561 pIcons_LOD->GetTexture(options_menu_skin.uTextureID_TurnSpeed[1])->uTextureHeight,
562 v0, 0, UIMSG_SetTurnSpeed, 0x40u, 0, v1, 0); 562 1, 0, UIMSG_SetTurnSpeed, 0x40u, 0, v1, 0);
563 pGUIWindow_CurrentMenu->CreateButton(164, 270, 563 pGUIWindow_CurrentMenu->CreateButton(164, 270,
564 pIcons_LOD->GetTexture(options_menu_skin.uTextureID_TurnSpeed[0])->uTextureWidth, 564 pIcons_LOD->GetTexture(options_menu_skin.uTextureID_TurnSpeed[0])->uTextureWidth,
565 pIcons_LOD->GetTexture(options_menu_skin.uTextureID_TurnSpeed[0])->uTextureHeight, 565 pIcons_LOD->GetTexture(options_menu_skin.uTextureID_TurnSpeed[0])->uTextureHeight,
566 v0, 0, UIMSG_SetTurnSpeed, 0, 0, v1, 0); 566 1, 0, UIMSG_SetTurnSpeed, 0, 0, v1, 0);
567 567
568 pGUIWindow_CurrentMenu->CreateButton(20, 303, 568 pGUIWindow_CurrentMenu->CreateButton(20, 303,
569 pIcons_LOD->GetTexture(options_menu_skin.uTextureID_WalkSound)->uTextureWidth, 569 pIcons_LOD->GetTexture(options_menu_skin.uTextureID_WalkSound)->uTextureWidth,
570 pIcons_LOD->GetTexture(options_menu_skin.uTextureID_WalkSound)->uTextureHeight, 570 pIcons_LOD->GetTexture(options_menu_skin.uTextureID_WalkSound)->uTextureHeight,
571 v0, 0, UIMSG_ToggleWalkSound, 0, 0, v1, 0); 571 1, 0, UIMSG_ToggleWalkSound, 0, 0, v1, 0);
572 pGUIWindow_CurrentMenu->CreateButton(128, 303, 572 pGUIWindow_CurrentMenu->CreateButton(128, 303,
573 pIcons_LOD->GetTexture(options_menu_skin.uTextureID_ShowDamage)->uTextureWidth, 573 pIcons_LOD->GetTexture(options_menu_skin.uTextureID_ShowDamage)->uTextureWidth,
574 pIcons_LOD->GetTexture(options_menu_skin.uTextureID_ShowDamage)->uTextureHeight, 574 pIcons_LOD->GetTexture(options_menu_skin.uTextureID_ShowDamage)->uTextureHeight,
575 v0, 0, UIMSG_ToggleShowDamage, 0, 0, v1, 0); 575 1, 0, UIMSG_ToggleShowDamage, 0, 0, v1, 0);
576 pGUIWindow_CurrentMenu->CreateButton(20, 325, 576 pGUIWindow_CurrentMenu->CreateButton(20, 325,
577 pIcons_LOD->GetTexture(options_menu_skin.uTextureID_AlwaysRun)->uTextureWidth, 577 pIcons_LOD->GetTexture(options_menu_skin.uTextureID_AlwaysRun)->uTextureWidth,
578 pIcons_LOD->GetTexture(options_menu_skin.uTextureID_AlwaysRun)->uTextureHeight, 578 pIcons_LOD->GetTexture(options_menu_skin.uTextureID_AlwaysRun)->uTextureHeight,
579 v0, 0, UIMSG_ToggleAlwaysRun, 0, 0, v1, 0); 579 1, 0, UIMSG_ToggleAlwaysRun, 0, 0, v1, 0);
580 pGUIWindow_CurrentMenu->CreateButton(128, 325, 580 pGUIWindow_CurrentMenu->CreateButton(128, 325,
581 pIcons_LOD->GetTexture(options_menu_skin.uTextureID_FlipOnExit)->uTextureWidth, 581 pIcons_LOD->GetTexture(options_menu_skin.uTextureID_FlipOnExit)->uTextureWidth,
582 pIcons_LOD->GetTexture(options_menu_skin.uTextureID_FlipOnExit)->uTextureHeight, 582 pIcons_LOD->GetTexture(options_menu_skin.uTextureID_FlipOnExit)->uTextureHeight,
583 v0, 0, UIMSG_ToggleFlipOnExit, 0, 0, v1, 0); 583 1, 0, UIMSG_ToggleFlipOnExit, 0, 0, v1, 0);
584 584
585 pBtn_SliderLeft = pGUIWindow_CurrentMenu->CreateButton(243, 162, 16, 16, v0, 0, UIMSG_ChangeSoundVolume, 4, 0, v1, pIcons_LOD->GetTexture(options_menu_skin.uTextureID_ArrowLeft), 0); 585 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);
586 pBtn_SliderRight = pGUIWindow_CurrentMenu->CreateButton(435, 162, 16, 16, v0, 0, UIMSG_ChangeSoundVolume, 5, 0, v1, pIcons_LOD->GetTexture(options_menu_skin.uTextureID_ArrowRight), 0); 586 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);
587 pGUIWindow_CurrentMenu->CreateButton(263, 162, 172, 17, v0, 0, UIMSG_ChangeSoundVolume, 0, 0, v1, 0); 587 pGUIWindow_CurrentMenu->CreateButton(263, 162, 172, 17, 1, 0, UIMSG_ChangeSoundVolume, 0, 0, v1, 0);
588 588
589 pBtn_SliderLeft = pGUIWindow_CurrentMenu->CreateButton(243, 216, 16, 16, v0, 0, UIMSG_ChangeMusicVolume, 4, 0, v1, pIcons_LOD->GetTexture(options_menu_skin.uTextureID_ArrowLeft), 0); 589 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);
590 pBtn_SliderRight = pGUIWindow_CurrentMenu->CreateButton(435, 216, 16, 16, v0, 0, UIMSG_ChangeMusicVolume, 5, 0, v1, pIcons_LOD->GetTexture(options_menu_skin.uTextureID_ArrowRight), 0); 590 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);
591 pGUIWindow_CurrentMenu->CreateButton(263, 216, 172, 17, v0, 0, UIMSG_ChangeMusicVolume, 0, 0, v1, 0); 591 pGUIWindow_CurrentMenu->CreateButton(263, 216, 172, 17, 1, 0, UIMSG_ChangeMusicVolume, 0, 0, v1, 0);
592 592
593 pBtn_SliderLeft = pGUIWindow_CurrentMenu->CreateButton(243, 270, 16, 16, v0, 0, UIMSG_ChangeVoiceVolume, 4, 0, v1, pIcons_LOD->GetTexture(options_menu_skin.uTextureID_ArrowLeft), 0); 593 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);
594 pBtn_SliderRight = pGUIWindow_CurrentMenu->CreateButton(435, 270, 16, 16, v0, 0, UIMSG_ChangeVoiceVolume, 5, 0, v1, pIcons_LOD->GetTexture(options_menu_skin.uTextureID_ArrowRight), 0); 594 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);
595 pGUIWindow_CurrentMenu->CreateButton(263, 270, 172, 17, v0, 0, UIMSG_ChangeVoiceVolume, 0, 0, v1, 0); 595 pGUIWindow_CurrentMenu->CreateButton(263, 270, 172, 17, 1, 0, UIMSG_ChangeVoiceVolume, 0, 0, v1, 0);
596 596
597 pGUIWindow_CurrentMenu->CreateButton(241, 302, 214, 40, v0, 0, UIMSG_Escape, 0, 0, pGlobalTXT_LocalizationStrings[619], 0); // "Return to Game" 597 pGUIWindow_CurrentMenu->CreateButton(241, 302, 214, 40, 1, 0, UIMSG_Escape, 0, 0, pGlobalTXT_LocalizationStrings[619], 0); // "Return to Game"
598 pGUIWindow_CurrentMenu->CreateButton( 19, 140, 214, 40, v0, 0, UIMSG_OpenKeyMappingOptions, 0, 0x4Bu, v1, 0); 598 pGUIWindow_CurrentMenu->CreateButton( 19, 140, 214, 40, 1, 0, UIMSG_OpenKeyMappingOptions, 0, 0x4Bu, v1, 0);
599 pGUIWindow_CurrentMenu->CreateButton( 19, 194, 214, 40, v0, 0, UIMSG_OpenVideoOptions, 0, 86, v1, 0); 599 pGUIWindow_CurrentMenu->CreateButton( 19, 194, 214, 40, 1, 0, UIMSG_OpenVideoOptions, 0, 86, v1, 0);
600 continue; 600 continue;
601 601
602 case UIMSG_OpenKeyMappingOptions://Open 602 case UIMSG_OpenKeyMappingOptions://Open
603 if ( pMessageQueue_50CBD0->uNumMessages ) 603 if ( pMessageQueue_50CBD0->uNumMessages )
604 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; 604 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
634 KeyboardPageNum = 1; 634 KeyboardPageNum = 1;
635 memset(KeyButtonFlagChangesArray, 0, sizeof(KeyButtonFlagChangesArray)); 635 memset(KeyButtonFlagChangesArray, 0, sizeof(KeyButtonFlagChangesArray));
636 //*(_WORD *)KeyButtonArray[28] = 0; 636 //*(_WORD *)KeyButtonArray[28] = 0;
637 memcpy(pPrevVirtualCidesMapping, pKeyActionMap->pVirtualKeyCodesMapping, 0x78u); 637 memcpy(pPrevVirtualCidesMapping, pKeyActionMap->pVirtualKeyCodesMapping, 0x78u);
638 v1 = ""; 638 v1 = "";
639 v0 = 1; 639 //v0 = 1;
640 continue; 640 continue;
641 case UIMSG_ChangeKeyButton: 641 case UIMSG_ChangeKeyButton:
642 if ( dword_506E68 != -1 ) 642 if ( dword_506E68 != -1 )
643 { 643 {
644 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); 644 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0);
645 continue; 645 continue;
646 } 646 }
647 v14 = uMessageParam; 647 v14 = uMessageParam;
648 if ( KeyboardPageNum != v0 ) 648 if ( KeyboardPageNum != 1 )
649 v14 = uMessageParam + 14; 649 v14 = uMessageParam + 14;
650 dword_506E68 = v14; 650 dword_506E68 = v14;
651 pKeyActionMap->EnterText(0, v0, pGUIWindow_CurrentMenu); 651 pKeyActionMap->EnterText(0, 1, pGUIWindow_CurrentMenu);
652 continue; 652 continue;
653 case UIMSG_ResetKeyMapping: 653 case UIMSG_ResetKeyMapping:
654 v197 = 1; 654 v197 = 1;
655 pKeyActionMap->SetDefaultMapping(); 655 pKeyActionMap->SetDefaultMapping();
656 uAction = 0; 656 uAction = 0;
660 if ( v15 != pPrevVirtualCidesMapping[uAction] ) 660 if ( v15 != pPrevVirtualCidesMapping[uAction] )
661 { 661 {
662 if ( v197 ) 662 if ( v197 )
663 { 663 {
664 v16 = pKeyActionMap->GetActionVKey((enum InputAction)uAction); 664 v16 = pKeyActionMap->GetActionVKey((enum InputAction)uAction);
665 GUI_ReplaceHotkey(LOBYTE(pPrevVirtualCidesMapping[uAction]), v16, v0); 665 GUI_ReplaceHotkey(LOBYTE(pPrevVirtualCidesMapping[uAction]), v16, 1);
666 v197 = 0; 666 v197 = 0;
667 } 667 }
668 else 668 else
669 { 669 {
670 v17 = pKeyActionMap->GetActionVKey((enum InputAction)uAction); 670 v17 = pKeyActionMap->GetActionVKey((enum InputAction)uAction);
679 } 679 }
680 while ( v12 ^ v13 ); 680 while ( v12 ^ v13 );
681 pAudioPlayer->PlaySound((SoundID)219, 0, 0, -1, 0, 0, 0, 0); 681 pAudioPlayer->PlaySound((SoundID)219, 0, 0, -1, 0, 0, 0, 0);
682 continue; 682 continue;
683 case UIMSG_SelectKeyPage1: 683 case UIMSG_SelectKeyPage1:
684 KeyboardPageNum = v0; 684 KeyboardPageNum = 1;
685 continue; 685 continue;
686 case UIMSG_SelectKeyPage2: 686 case UIMSG_SelectKeyPage2:
687 KeyboardPageNum = 2; 687 KeyboardPageNum = 2;
688 continue; 688 continue;
689 case UIMSG_OpenVideoOptions: 689 case UIMSG_OpenVideoOptions:
690 if ( pMessageQueue_50CBD0->uNumMessages ) 690 if ( pMessageQueue_50CBD0->uNumMessages )
691 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; 691 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
692 pGUIWindow_CurrentMenu->Release(); 692 pGUIWindow_CurrentMenu->Release();
693 viewparams->field_48 = v0; 693 viewparams->field_48 = 1;
694 pCurrentScreen = SCREEN_VIDEO_OPTIONS; 694 pCurrentScreen = SCREEN_VIDEO_OPTIONS;
695 uTextureID_507C10 = pIcons_LOD->LoadTexture("optvid", TEXTURE_16BIT_PALETTE); 695 uTextureID_507C10 = pIcons_LOD->LoadTexture("optvid", TEXTURE_16BIT_PALETTE);
696 uTextureID_507C14 = pIcons_LOD->LoadTexture("opvdH-bs", TEXTURE_16BIT_PALETTE); 696 uTextureID_507C14 = pIcons_LOD->LoadTexture("opvdH-bs", TEXTURE_16BIT_PALETTE);
697 uTextureID_507C18 = pIcons_LOD->LoadTexture("opvdH-cl", TEXTURE_16BIT_PALETTE); 697 uTextureID_507C18 = pIcons_LOD->LoadTexture("opvdH-cl", TEXTURE_16BIT_PALETTE);
698 uTextureID_507C1C = pIcons_LOD->LoadTexture("opvdH-tn", TEXTURE_16BIT_PALETTE); 698 uTextureID_507C1C = pIcons_LOD->LoadTexture("opvdH-tn", TEXTURE_16BIT_PALETTE);
710 pTextureIDs_GammaPositions[9] = pIcons_LOD->LoadTexture("convol00", TEXTURE_16BIT_PALETTE); 710 pTextureIDs_GammaPositions[9] = pIcons_LOD->LoadTexture("convol00", TEXTURE_16BIT_PALETTE);
711 uTextureID_507C50 = pIcons_LOD->LoadTexture("opvdG-bs", TEXTURE_16BIT_PALETTE); 711 uTextureID_507C50 = pIcons_LOD->LoadTexture("opvdG-bs", TEXTURE_16BIT_PALETTE);
712 uTextureID_507C54 = pIcons_LOD->LoadTexture("opvdG-cl", TEXTURE_16BIT_PALETTE); 712 uTextureID_507C54 = pIcons_LOD->LoadTexture("opvdG-cl", TEXTURE_16BIT_PALETTE);
713 uTextureID_507C58 = pIcons_LOD->LoadTexture("opvdG-tn", TEXTURE_16BIT_PALETTE); 713 uTextureID_507C58 = pIcons_LOD->LoadTexture("opvdG-tn", TEXTURE_16BIT_PALETTE);
714 pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_VideoOptions, 0, 0); 714 pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_VideoOptions, 0, 0);
715 pGUIWindow_CurrentMenu->CreateButton(0xF1u, 0x12Eu, 0xD6u, 0x28u, v0, 0, UIMSG_Escape, 0, 0, v1, 0); 715 pGUIWindow_CurrentMenu->CreateButton(0xF1u, 0x12Eu, 0xD6u, 0x28u, 1, 0, UIMSG_Escape, 0, 0, v1, 0);
716 if ( pRenderer->pRenderD3D ) 716 if ( pRenderer->pRenderD3D )
717 { 717 {
718 pGUIWindow_CurrentMenu->CreateButton(0x13u, 0x118u, 0xD6u, 0x12u, v0, 0, UIMSG_ToggleBloodsplats, 0, 0, v1, 0); 718 pGUIWindow_CurrentMenu->CreateButton(0x13u, 0x118u, 0xD6u, 0x12u, 1, 0, UIMSG_ToggleBloodsplats, 0, 0, v1, 0);
719 pGUIWindow_CurrentMenu->CreateButton(0x13u, 0x12Eu, 0xD6u, 0x12u, v0, 0, UIMSG_ToggleColoredLights, 0, 0, v1, 0); 719 pGUIWindow_CurrentMenu->CreateButton(0x13u, 0x12Eu, 0xD6u, 0x12u, 1, 0, UIMSG_ToggleColoredLights, 0, 0, v1, 0);
720 pGUIWindow_CurrentMenu->CreateButton(0x13u, 0x144u, 0xD6u, 0x12u, v0, 0, UIMSG_ToggleTint, 0, 0, v1, 0); 720 pGUIWindow_CurrentMenu->CreateButton(0x13u, 0x144u, 0xD6u, 0x12u, 1, 0, UIMSG_ToggleTint, 0, 0, v1, 0);
721 } 721 }
722 if ( !pRenderer->bWindowMode ) 722 if ( !pRenderer->bWindowMode )
723 { 723 {
724 v0 = 1; 724 //v0 = 1;
725 if ( GammaController::IsGammaSupported() ) 725 if ( GammaController::IsGammaSupported() )
726 { 726 {
727 pBtn_SliderLeft = pGUIWindow_CurrentMenu->CreateButton(0x15u, 0xA1u, 0x10u, 0x10u, 1, 0, UIMSG_1A9, 4u, 0, v1, pIcons_LOD->GetTexture(uTextureID_507C20), 0); 727 pBtn_SliderLeft = pGUIWindow_CurrentMenu->CreateButton(0x15u, 0xA1u, 0x10u, 0x10u, 1, 0, UIMSG_1A9, 4u, 0, v1, pIcons_LOD->GetTexture(uTextureID_507C20), 0);
728 pBtn_SliderRight = pGUIWindow_CurrentMenu->CreateButton(0xD5u, 0xA1u, 0x10u, 0x10u, 1, 0, UIMSG_1A9, 5u, 0, v1, pIcons_LOD->GetTexture(uTextureID_507C24), 0); 728 pBtn_SliderRight = pGUIWindow_CurrentMenu->CreateButton(0xD5u, 0xA1u, 0x10u, 0x10u, 1, 0, UIMSG_1A9, 5u, 0, v1, pIcons_LOD->GetTexture(uTextureID_507C24), 0);
729 pGUIWindow_CurrentMenu->CreateButton(42, 162, 170, 18, 1, 0, UIMSG_1A9, 0, 0, v1, 0); 729 pGUIWindow_CurrentMenu->CreateButton(42, 162, 170, 18, 1, 0, UIMSG_1A9, 0, 0, v1, 0);
740 pAudioPlayer->PlaySound((SoundID)21, 0, 0, -1, 0, 0, 0, 0); 740 pAudioPlayer->PlaySound((SoundID)21, 0, 0, -1, 0, 0, 0, 0);
741 continue; 741 continue;
742 } 742 }
743 v19 = (double)(signed int)uGammaPos * 0.1 + 0.6; 743 v19 = (double)(signed int)uGammaPos * 0.1 + 0.6;
744 pGame->pGammaController->Initialize(v19); 744 pGame->pGammaController->Initialize(v19);
745 GUIWindow::Create(21, 161, 0, 0, WINDOW_PressedButton2, (int)pBtn_SliderLeft, v0); 745 GUIWindow::Create(21, 161, 0, 0, WINDOW_PressedButton2, (int)pBtn_SliderLeft, 1);
746 pAudioPlayer->PlaySound((SoundID)21, 0, 0, -1, 0, 0, 0, 0); 746 pAudioPlayer->PlaySound((SoundID)21, 0, 0, -1, 0, 0, 0, 0);
747 continue; 747 continue;
748 } 748 }
749 if ( uMessageParam == 5 ) 749 if ( uMessageParam == 5 )
750 { 750 {
751 ++uGammaPos; 751 ++uGammaPos;
752 if ( (signed int)uGammaPos <= 9 ) 752 if ( (signed int)uGammaPos <= 9 )
753 { 753 {
754 v21 = (double)(signed int)uGammaPos * 0.1 + 0.6; 754 v21 = (double)(signed int)uGammaPos * 0.1 + 0.6;
755 pGame->pGammaController->Initialize(v21); 755 pGame->pGammaController->Initialize(v21);
756 GUIWindow::Create(213, 161, 0, 0, WINDOW_PressedButton2, (int)pBtn_SliderRight, v0); 756 GUIWindow::Create(213, 161, 0, 0, WINDOW_PressedButton2, (int)pBtn_SliderRight, 1);
757 pAudioPlayer->PlaySound((SoundID)21, 0, 0, -1, 0, 0, 0, 0); 757 pAudioPlayer->PlaySound((SoundID)21, 0, 0, -1, 0, 0, 0, 0);
758 continue; 758 continue;
759 } 759 }
760 uGammaPos = 9; 760 uGammaPos = 9;
761 } 761 }
780 if ( uMessageParam == 4 ) 780 if ( uMessageParam == 4 )
781 { 781 {
782 --uMusicVolimeMultiplier; 782 --uMusicVolimeMultiplier;
783 if ( (char)uMusicVolimeMultiplier < 1 ) 783 if ( (char)uMusicVolimeMultiplier < 1 )
784 uMusicVolimeMultiplier = 0; 784 uMusicVolimeMultiplier = 0;
785 GUIWindow::Create(243, 0xD8u, 0, 0, WINDOW_PressedButton2, (int)pBtn_SliderLeft, v0); 785 GUIWindow::Create(243, 0xD8u, 0, 0, WINDOW_PressedButton2, (int)pBtn_SliderLeft, 1);
786 if ( uMusicVolimeMultiplier ) 786 if ( uMusicVolimeMultiplier )
787 pAudioPlayer->PlaySound(SOUND_Bell, -1, 0, -1, 0, 0, pSoundVolumeLevels[(char)uMusicVolimeMultiplier] * 64.0f, 0); 787 pAudioPlayer->PlaySound(SOUND_Bell, -1, 0, -1, 0, 0, pSoundVolumeLevels[(char)uMusicVolimeMultiplier] * 64.0f, 0);
788 pAudioPlayer->SetMusicVolume(pSoundVolumeLevels[(char)uMusicVolimeMultiplier] * 64.0f); 788 pAudioPlayer->SetMusicVolume(pSoundVolumeLevels[(char)uMusicVolimeMultiplier] * 64.0f);
789 continue; 789 continue;
790 } 790 }
791 if ( uMessageParam == 5 ) 791 if ( uMessageParam == 5 )
792 { 792 {
793 ++uMusicVolimeMultiplier; 793 ++uMusicVolimeMultiplier;
794 if ( (char)uMusicVolimeMultiplier > 9 ) 794 if ( (char)uMusicVolimeMultiplier > 9 )
795 uMusicVolimeMultiplier = 9; 795 uMusicVolimeMultiplier = 9;
796 GUIWindow::Create(435, 0xD8u, 0, 0, WINDOW_PressedButton2, (int)pBtn_SliderRight, v0); 796 GUIWindow::Create(435, 0xD8u, 0, 0, WINDOW_PressedButton2, (int)pBtn_SliderRight, 1);
797 if ( uMusicVolimeMultiplier ) 797 if ( uMusicVolimeMultiplier )
798 pAudioPlayer->PlaySound(SOUND_Bell, -1, 0, -1, 0, 0, pSoundVolumeLevels[(char)uMusicVolimeMultiplier] * 64.0f, 0); 798 pAudioPlayer->PlaySound(SOUND_Bell, -1, 0, -1, 0, 0, pSoundVolumeLevels[(char)uMusicVolimeMultiplier] * 64.0f, 0);
799 pAudioPlayer->SetMusicVolume(pSoundVolumeLevels[(char)uMusicVolimeMultiplier] * 64.0f); 799 pAudioPlayer->SetMusicVolume(pSoundVolumeLevels[(char)uMusicVolimeMultiplier] * 64.0f);
800 continue; 800 continue;
801 } 801 }
810 if ( uMessageParam == 4 )//reduce sound level button left 810 if ( uMessageParam == 4 )//reduce sound level button left
811 { 811 {
812 --uSoundVolumeMultiplier; 812 --uSoundVolumeMultiplier;
813 if ( (char)uSoundVolumeMultiplier < 1 ) 813 if ( (char)uSoundVolumeMultiplier < 1 )
814 uSoundVolumeMultiplier = 0; 814 uSoundVolumeMultiplier = 0;
815 GUIWindow::Create(243, 162, 0, 0, WINDOW_PressedButton2, (int)pBtn_SliderLeft, v0); 815 GUIWindow::Create(243, 162, 0, 0, WINDOW_PressedButton2, (int)pBtn_SliderLeft, 1);
816 pAudioPlayer->SetMasterVolume(pSoundVolumeLevels[uSoundVolumeMultiplier] * 128.0f); 816 pAudioPlayer->SetMasterVolume(pSoundVolumeLevels[uSoundVolumeMultiplier] * 128.0f);
817 pAudioPlayer->PlaySound((SoundID)218, -1, 0, -1, 0, 0, 0, 0); 817 pAudioPlayer->PlaySound((SoundID)218, -1, 0, -1, 0, 0, 0, 0);
818 continue; 818 continue;
819 } 819 }
820 if ( uMessageParam == 5 )//Increase sound level button right 820 if ( uMessageParam == 5 )//Increase sound level button right
821 { 821 {
822 ++uSoundVolumeMultiplier; 822 ++uSoundVolumeMultiplier;
823 if ( (char)uSoundVolumeMultiplier > 8 ) 823 if ( (char)uSoundVolumeMultiplier > 8 )
824 uSoundVolumeMultiplier = 9; 824 uSoundVolumeMultiplier = 9;
825 v168 = v0; 825 //v168 = 1;
826 v24 = 435; 826 v24 = 435;
827 //v154 = (int)pBtn_SliderRight; 827 //v154 = (int)pBtn_SliderRight;
828 GUIWindow::Create(v24, 0xA2u, 0, 0, WINDOW_PressedButton2, (int)pBtn_SliderRight, v168); 828 GUIWindow::Create(v24, 0xA2u, 0, 0, WINDOW_PressedButton2, (int)pBtn_SliderRight, 1);
829 pAudioPlayer->SetMasterVolume(pSoundVolumeLevels[uSoundVolumeMultiplier] * 128.0f); 829 pAudioPlayer->SetMasterVolume(pSoundVolumeLevels[uSoundVolumeMultiplier] * 128.0f);
830 pAudioPlayer->PlaySound((SoundID)218, -1, 0, -1, 0, 0, 0, 0); 830 pAudioPlayer->PlaySound((SoundID)218, -1, 0, -1, 0, 0, 0, 0);
831 continue; 831 continue;
832 } 832 }
833 uSoundVolumeMultiplier = (pMouse->GetCursorPos(&v207)->x - 263) / 17; 833 uSoundVolumeMultiplier = (pMouse->GetCursorPos(&v207)->x - 263) / 17;
852 if ( uMessageParam == 4 ) 852 if ( uMessageParam == 4 )
853 { 853 {
854 --uVoicesVolumeMultiplier; 854 --uVoicesVolumeMultiplier;
855 if ( (char)uVoicesVolumeMultiplier < 1 ) 855 if ( (char)uVoicesVolumeMultiplier < 1 )
856 uVoicesVolumeMultiplier = 0; 856 uVoicesVolumeMultiplier = 0;
857 GUIWindow::Create(243, 270, 0, 0, WINDOW_PressedButton2, (int)pBtn_SliderLeft, v0); 857 GUIWindow::Create(243, 270, 0, 0, WINDOW_PressedButton2, (int)pBtn_SliderLeft, 1);
858 if ( !uVoicesVolumeMultiplier ) 858 if ( !uVoicesVolumeMultiplier )
859 continue; 859 continue;
860 pAudioPlayer->PlaySound((SoundID)5788, -1, 0, -1, 0, 0, pSoundVolumeLevels[uVoicesVolumeMultiplier] * 128.0f, 0); 860 pAudioPlayer->PlaySound((SoundID)5788, -1, 0, -1, 0, 0, pSoundVolumeLevels[uVoicesVolumeMultiplier] * 128.0f, 0);
861 continue; 861 continue;
862 } 862 }
863 if ( uMessageParam == 5 ) 863 if ( uMessageParam == 5 )
864 { 864 {
865 ++uVoicesVolumeMultiplier; 865 ++uVoicesVolumeMultiplier;
866 if ( (char)uVoicesVolumeMultiplier > 8 ) 866 if ( (char)uVoicesVolumeMultiplier > 8 )
867 uVoicesVolumeMultiplier = 9; 867 uVoicesVolumeMultiplier = 9;
868 GUIWindow::Create(435, 270, 0, 0, WINDOW_PressedButton2, (int)pBtn_SliderRight, v0); 868 GUIWindow::Create(435, 270, 0, 0, WINDOW_PressedButton2, (int)pBtn_SliderRight, 1);
869 if ( !uVoicesVolumeMultiplier ) 869 if ( !uVoicesVolumeMultiplier )
870 continue; 870 continue;
871 pAudioPlayer->PlaySound((SoundID)5788, -1, 0, -1, 0, 0, pSoundVolumeLevels[uVoicesVolumeMultiplier] * 128.0f, 0); 871 pAudioPlayer->PlaySound((SoundID)5788, -1, 0, -1, 0, 0, pSoundVolumeLevels[uVoicesVolumeMultiplier] * 128.0f, 0);
872 continue; 872 continue;
873 } 873 }
909 continue; 909 continue;
910 case UIMSG_GameMenu_ReturnToGame: 910 case UIMSG_GameMenu_ReturnToGame:
911 pGUIWindow_CurrentMenu->Release(); 911 pGUIWindow_CurrentMenu->Release();
912 pEventTimer->Resume(); 912 pEventTimer->Resume();
913 pCurrentScreen = SCREEN_GAME; 913 pCurrentScreen = SCREEN_GAME;
914 viewparams->bRedrawGameUI = v0; 914 viewparams->bRedrawGameUI = 1;
915 stru_506E40.Release(); 915 stru_506E40.Release();
916 continue; 916 continue;
917 case UIMSG_OpenQuestBook: 917 case UIMSG_OpenQuestBook:
918 if ( pMessageQueue_50CBD0->uNumMessages ) 918 if ( pMessageQueue_50CBD0->uNumMessages )
919 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; 919 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
978 if ( pCurrentScreen >= SCREEN_CHANGE_LOCATION && (pCurrentScreen <= SCREEN_INPUT_BLV || pCurrentScreen == SCREEN_QUICK_REFERENCE) ) 978 if ( pCurrentScreen >= SCREEN_CHANGE_LOCATION && (pCurrentScreen <= SCREEN_INPUT_BLV || pCurrentScreen == SCREEN_QUICK_REFERENCE) )
979 { 979 {
980 if ( dword_50CDC8 ) 980 if ( dword_50CDC8 )
981 goto LABEL_232; 981 goto LABEL_232;
982 CloseWindowBackground(); 982 CloseWindowBackground();
983 uMessageParam = v0; 983 uMessageParam = 1;
984 goto LABEL_232; 984 goto LABEL_232;
985 } 985 }
986 } 986 }
987 else 987 else
988 { 988 {
989 if ( pCurrentScreen >= SCREEN_E || pCurrentScreen == SCREEN_NPC_DIALOGUE || pCurrentScreen == SCREEN_CHEST ) 989 if ( pCurrentScreen >= SCREEN_E || pCurrentScreen == SCREEN_NPC_DIALOGUE || pCurrentScreen == SCREEN_CHEST )
990 { 990 {
991 if ( dword_50CDC8 ) 991 if ( dword_50CDC8 )
992 goto LABEL_232; 992 goto LABEL_232;
993 CloseWindowBackground(); 993 CloseWindowBackground();
994 uMessageParam = v0; 994 uMessageParam = 1;
995 goto LABEL_232; 995 goto LABEL_232;
996 } 996 }
997 if ( pCurrentScreen == SCREEN_HOUSE && !dword_50CDC8 && !dword_5C35C8 ) 997 if ( pCurrentScreen == SCREEN_HOUSE && !dword_50CDC8 && !dword_5C35C8 )
998 { 998 {
999 CloseWindowBackground(); 999 CloseWindowBackground();
1000 dword_5C35C8 = 0; 1000 dword_5C35C8 = 0;
1001 uMessageParam = v0; 1001 uMessageParam = 1;
1002 } 1002 }
1003 } 1003 }
1004 LABEL_232: 1004 LABEL_232:
1005 if ( !ptr_507BDC ) 1005 if ( !ptr_507BDC )
1006 { 1006 {
1007 pRenderer->ClearZBuffer(0, 479); 1007 pRenderer->ClearZBuffer(0, 479);
1008 viewparams->bRedrawGameUI = v0; 1008 viewparams->bRedrawGameUI = 1;
1009 viewparams->field_48 = v0; 1009 viewparams->field_48 = 1;
1010 if ( pCurrentScreen ) 1010 if ( pCurrentScreen )
1011 { 1011 {
1012 if ( pCurrentScreen > SCREEN_67 ) 1012 if ( pCurrentScreen > SCREEN_67 )
1013 { 1013 {
1014 if ( pCurrentScreen == SCREEN_QUICK_REFERENCE ) 1014 if ( pCurrentScreen == SCREEN_QUICK_REFERENCE )
1053 GameUI_Footer_TimeLeft = 0; 1053 GameUI_Footer_TimeLeft = 0;
1054 unk_50C9A0 = 0; 1054 unk_50C9A0 = 0;
1055 back_to_game(); 1055 back_to_game();
1056 } 1056 }
1057 } 1057 }
1058 if ( (signed int)uActiveCharacter < v0 || (signed int)uActiveCharacter > 4 ) 1058 if ( (signed int)uActiveCharacter < 1 || (signed int)uActiveCharacter > 4 )
1059 uActiveCharacter = pParty->GetNextActiveCharacter(); 1059 uActiveCharacter = pParty->GetNextActiveCharacter();
1060 pGUIWindow_CurrentMenu->Release(); 1060 pGUIWindow_CurrentMenu->Release();
1061 if ( pGUIWindow_CurrentMenu == window_SpeakInHouse ) 1061 if ( pGUIWindow_CurrentMenu == window_SpeakInHouse )
1062 window_SpeakInHouse = 0; 1062 window_SpeakInHouse = 0;
1063 pGUIWindow_CurrentMenu = 0; 1063 pGUIWindow_CurrentMenu = 0;
1064 pEventTimer->Resume(); 1064 pEventTimer->Resume();
1065 pCurrentScreen = SCREEN_GAME; 1065 pCurrentScreen = SCREEN_GAME;
1066 viewparams->bRedrawGameUI = v0; 1066 viewparams->bRedrawGameUI = 1;
1067 pIcons_LOD->_4355F7(); 1067 pIcons_LOD->_4355F7();
1068 continue; 1068 continue;
1069 case SCREEN_BOOKS: 1069 case SCREEN_BOOKS:
1070 pBooksWindow->Release(); 1070 pBooksWindow->Release();
1071 //crt_deconstruct_ptr_6A0118(); 1071 //crt_deconstruct_ptr_6A0118();
1085 GameUI_Footer_TimeLeft = 0; 1085 GameUI_Footer_TimeLeft = 0;
1086 unk_50C9A0 = 0; 1086 unk_50C9A0 = 0;
1087 back_to_game(); 1087 back_to_game();
1088 } 1088 }
1089 } 1089 }
1090 if ( (signed int)uActiveCharacter < v0 || (signed int)uActiveCharacter > 4 ) 1090 if ( (signed int)uActiveCharacter < 1 || (signed int)uActiveCharacter > 4 )
1091 uActiveCharacter = pParty->GetNextActiveCharacter(); 1091 uActiveCharacter = pParty->GetNextActiveCharacter();
1092 pGUIWindow_CurrentMenu->Release(); 1092 pGUIWindow_CurrentMenu->Release();
1093 if ( pGUIWindow_CurrentMenu == window_SpeakInHouse ) 1093 if ( pGUIWindow_CurrentMenu == window_SpeakInHouse )
1094 window_SpeakInHouse = 0; 1094 window_SpeakInHouse = 0;
1095 pGUIWindow_CurrentMenu = 0; 1095 pGUIWindow_CurrentMenu = 0;
1096 pEventTimer->Resume(); 1096 pEventTimer->Resume();
1097 pCurrentScreen = SCREEN_GAME; 1097 pCurrentScreen = SCREEN_GAME;
1098 viewparams->bRedrawGameUI = v0; 1098 viewparams->bRedrawGameUI = 1;
1099 pIcons_LOD->_4355F7(); 1099 pIcons_LOD->_4355F7();
1100 continue; 1100 continue;
1101 case SCREEN_SAVEGAME: 1101 case SCREEN_SAVEGAME:
1102 case SCREEN_LOADGAME: 1102 case SCREEN_LOADGAME:
1103 pIcons_LOD->_4114F2(); 1103 pIcons_LOD->_4114F2();
1110 case SCREEN_CHEST: 1110 case SCREEN_CHEST:
1111 pWindow2 = pChestWindow; 1111 pWindow2 = pChestWindow;
1112 pWindow2->Release(); 1112 pWindow2->Release();
1113 pIcons_LOD->_4114F2(); 1113 pIcons_LOD->_4114F2();
1114 pCurrentScreen = SCREEN_GAME; 1114 pCurrentScreen = SCREEN_GAME;
1115 viewparams->bRedrawGameUI = v0; 1115 viewparams->bRedrawGameUI = 1;
1116 pEventTimer->Resume(); 1116 pEventTimer->Resume();
1117 continue; 1117 continue;
1118 case SCREEN_19: 1118 case SCREEN_19:
1119 pWindow2 = ptr_507BC8; 1119 pWindow2 = ptr_507BC8;
1120 pWindow2->Release(); 1120 pWindow2->Release();
1121 pIcons_LOD->_4114F2(); 1121 pIcons_LOD->_4114F2();
1122 pCurrentScreen = SCREEN_GAME; 1122 pCurrentScreen = SCREEN_GAME;
1123 viewparams->bRedrawGameUI = v0; 1123 viewparams->bRedrawGameUI = 1;
1124 pEventTimer->Resume(); 1124 pEventTimer->Resume();
1125 continue; 1125 continue;
1126 case SCREEN_OPTIONS://Close 1126 case SCREEN_OPTIONS://Close
1127 options_menu_skin.Relaease(); 1127 options_menu_skin.Relaease();
1128 1128
1135 WriteWindowsRegistryInt("graphicsmode", (unsigned __int8)byte_6BE388_graphicsmode); 1135 WriteWindowsRegistryInt("graphicsmode", (unsigned __int8)byte_6BE388_graphicsmode);
1136 WriteWindowsRegistryInt("valAlwaysRun", bAlwaysRun); 1136 WriteWindowsRegistryInt("valAlwaysRun", bAlwaysRun);
1137 WriteWindowsRegistryInt("FlipOnExit", bFlipOnExit); 1137 WriteWindowsRegistryInt("FlipOnExit", bFlipOnExit);
1138 if ( !uTurnSpeed ) 1138 if ( !uTurnSpeed )
1139 { 1139 {
1140 v171 = 3; 1140 //v171 = 3;
1141 v30 = v171; 1141 //v30 = v171;
1142 v31 = "TurnDelta"; 1142 //v31 = "TurnDelta";
1143 WriteWindowsRegistryInt(v31, v30); 1143 WriteWindowsRegistryInt("TurnDelta", 3);
1144 stru_506E40.Release(); 1144 stru_506E40.Release();
1145 break; 1145 break;
1146 } 1146 }
1147 if ( uTurnSpeed == 64 ) 1147 if ( uTurnSpeed == 64 )
1148 { 1148 {
1149 v171 = 2; 1149 //v171 = 2;
1150 v30 = v171; 1150 //v30 = v171;
1151 v31 = "TurnDelta"; 1151 //v31 = "TurnDelta";
1152 WriteWindowsRegistryInt(v31, v30); 1152 WriteWindowsRegistryInt("TurnDelta", 2);
1153 stru_506E40.Release(); 1153 stru_506E40.Release();
1154 break; 1154 break;
1155 } 1155 }
1156 if ( uTurnSpeed != 128 ) 1156 if ( uTurnSpeed != 128 )
1157 { 1157 {
1158 stru_506E40.Release(); 1158 stru_506E40.Release();
1159 break; 1159 break;
1160 } 1160 }
1161 v30 = v0; 1161 //v30 = v0;
1162 v31 = "TurnDelta"; 1162 //v31 = "TurnDelta";
1163 WriteWindowsRegistryInt(v31, v30); 1163 WriteWindowsRegistryInt("TurnDelta", 1);
1164 stru_506E40.Release(); 1164 stru_506E40.Release();
1165 break; 1165 break;
1166 case SCREEN_MENU: 1166 case SCREEN_MENU:
1167 pIcons_LOD->_40F9C5(); 1167 pIcons_LOD->_40F9C5();
1168 pIcons_LOD->_4114F2(); 1168 pIcons_LOD->_4114F2();
1180 if ( pRenderer->bWindowMode ) 1180 if ( pRenderer->bWindowMode )
1181 { 1181 {
1182 stru_506E40.Release(); 1182 stru_506E40.Release();
1183 break; 1183 break;
1184 } 1184 }
1185 v30 = uGammaPos; 1185 //v30 = uGammaPos;
1186 v31 = "GammaPos"; 1186 //v31 = "GammaPos";
1187 WriteWindowsRegistryInt(v31, v30); 1187 WriteWindowsRegistryInt("GammaPos", uGammaPos);
1188 stru_506E40.Release(); 1188 stru_506E40.Release();
1189 break; 1189 break;
1190 case SCREEN_KEYBOARD_OPTIONS://Return to game 1190 case SCREEN_KEYBOARD_OPTIONS://Return to game
1191 v197 = 1; 1191 v197 = 1;
1192 v32 = 0; 1192 v32 = 0;
1212 if ( v33 != pPrevVirtualCidesMapping[uAction] ) 1212 if ( v33 != pPrevVirtualCidesMapping[uAction] )
1213 { 1213 {
1214 if ( v197 ) 1214 if ( v197 )
1215 { 1215 {
1216 v34 = pKeyActionMap->GetActionVKey((enum InputAction)uAction); 1216 v34 = pKeyActionMap->GetActionVKey((enum InputAction)uAction);
1217 GUI_ReplaceHotkey(v34, LOBYTE(pPrevVirtualCidesMapping[uAction]), v0); 1217 GUI_ReplaceHotkey(v34, LOBYTE(pPrevVirtualCidesMapping[uAction]), 1);
1218 v197 = 0; 1218 v197 = 0;
1219 } 1219 }
1220 else 1220 else
1221 { 1221 {
1222 v35 = pKeyActionMap->GetActionVKey((enum InputAction)uAction); 1222 v35 = pKeyActionMap->GetActionVKey((enum InputAction)uAction);
1223 GUI_ReplaceHotkey(v35, LOBYTE(pPrevVirtualCidesMapping[uAction]), 0); 1223 GUI_ReplaceHotkey(v35, LOBYTE(pPrevVirtualCidesMapping[uAction]), 0);
1224 } 1224 }
1225 } 1225 }
1226 if ( uAction && uAction != 2 && uAction != 3 && uAction != v0 && uAction != 25 && uAction != 26 ) 1226 if ( uAction && uAction != 2 && uAction != 3 && uAction != 1 && uAction != 25 && uAction != 26 )
1227 pKeyToggleType = (KeyToggleType)v0; 1227 pKeyToggleType = (KeyToggleType)1;
1228 else 1228 else
1229 pKeyToggleType = (KeyToggleType)0; 1229 pKeyToggleType = (KeyToggleType)0;
1230 pKeyActionMap->SetKeyMapping(uAction, pPrevVirtualCidesMapping[uAction], pKeyToggleType); 1230 pKeyActionMap->SetKeyMapping(uAction, pPrevVirtualCidesMapping[uAction], pKeyToggleType);
1231 ++uAction; 1231 ++uAction;
1232 } 1232 }
1252 pTexture_RestUI_CurrentSkyFrame = 0; 1252 pTexture_RestUI_CurrentSkyFrame = 0;
1253 pIcons_LOD->_40F9C5(); 1253 pIcons_LOD->_40F9C5();
1254 pIcons_LOD->_4114F2(); 1254 pIcons_LOD->_4114F2();
1255 _506F18_num_hours_to_sleep = 0; 1255 _506F18_num_hours_to_sleep = 0;
1256 dword_506F14 = 0; 1256 dword_506F14 = 0;
1257 dword_507B94 = v0; 1257 dword_507B94 = 1;
1258 if ( pGUIWindow_Settings ) 1258 if ( pGUIWindow_Settings )
1259 { 1259 {
1260 if ( pCurrentScreen == SCREEN_CHARACTERS ) 1260 if ( pCurrentScreen == SCREEN_CHARACTERS )
1261 { 1261 {
1262 pMouse->SetCursorBitmap("MICON2"); 1262 pMouse->SetCursorBitmap("MICON2");
1269 GameUI_Footer_TimeLeft = 0; 1269 GameUI_Footer_TimeLeft = 0;
1270 unk_50C9A0 = 0; 1270 unk_50C9A0 = 0;
1271 back_to_game(); 1271 back_to_game();
1272 } 1272 }
1273 } 1273 }
1274 if ( (signed int)uActiveCharacter < v0 || (signed int)uActiveCharacter > 4 ) 1274 if ( (signed int)uActiveCharacter < 1 || (signed int)uActiveCharacter > 4 )
1275 uActiveCharacter = pParty->GetNextActiveCharacter(); 1275 uActiveCharacter = pParty->GetNextActiveCharacter();
1276 pGUIWindow_CurrentMenu->Release(); 1276 pGUIWindow_CurrentMenu->Release();
1277 if ( pGUIWindow_CurrentMenu == window_SpeakInHouse ) 1277 if ( pGUIWindow_CurrentMenu == window_SpeakInHouse )
1278 window_SpeakInHouse = 0; 1278 window_SpeakInHouse = 0;
1279 pGUIWindow_CurrentMenu = 0; 1279 pGUIWindow_CurrentMenu = 0;
1280 pEventTimer->Resume(); 1280 pEventTimer->Resume();
1281 pCurrentScreen = SCREEN_GAME; 1281 pCurrentScreen = SCREEN_GAME;
1282 viewparams->bRedrawGameUI = v0; 1282 viewparams->bRedrawGameUI = 1;
1283 pIcons_LOD->_4355F7(); 1283 pIcons_LOD->_4355F7();
1284 continue; 1284 continue;
1285 case SCREEN_E: 1285 case SCREEN_E:
1286 pGUIWindow_CurrentMenu->Release(); 1286 pGUIWindow_CurrentMenu->Release();
1287 pCurrentScreen = SCREEN_HOUSE; 1287 pCurrentScreen = SCREEN_HOUSE;
1288 pIcons_LOD->_4114F2(); 1288 pIcons_LOD->_4114F2();
1289 continue; 1289 continue;
1290 case SCREEN_HOUSE: 1290 case SCREEN_HOUSE:
1291 if ( uDialogueType ) 1291 if ( uDialogueType )
1292 uDialogueType = 0; 1292 uDialogueType = 0;
1293 if ( uGameState == 2 ) 1293 if ( uGameState == GAME_STATE_2 )
1294 { 1294 {
1295 while ( sub_4BD8B5() ) 1295 while ( sub_4BD8B5() )
1296 ; 1296 ;
1297 } 1297 }
1298 else 1298 else
1299 { 1299 {
1300 if ( sub_4BD8B5() ) 1300 if ( sub_4BD8B5() )
1301 continue; 1301 continue;
1302 } 1302 }
1303 sub_4B1D27(); 1303 sub_4B1D27();
1304 pAudioPlayer->PlaySound((SoundID)(SOUND_EnteringAHouse|0x1), 814, 0, -1, 0, 0, 0, 0); 1304 pAudioPlayer->PlaySound(SOUND_7, 814, 0, -1, 0, 0, 0, 0);
1305 pVideoPlayer->Unload(); 1305 pVideoPlayer->Unload();
1306 pGUIWindow_CurrentMenu = window_SpeakInHouse; 1306 pGUIWindow_CurrentMenu = window_SpeakInHouse;
1307 if ( pGUIWindow_Settings ) 1307 if ( pGUIWindow_Settings )
1308 { 1308 {
1309 if ( pCurrentScreen == SCREEN_CHARACTERS ) 1309 if ( pCurrentScreen == SCREEN_CHARACTERS )
1318 GameUI_Footer_TimeLeft = 0; 1318 GameUI_Footer_TimeLeft = 0;
1319 unk_50C9A0 = 0; 1319 unk_50C9A0 = 0;
1320 back_to_game(); 1320 back_to_game();
1321 } 1321 }
1322 } 1322 }
1323 if ( (signed int)uActiveCharacter < v0 || (signed int)uActiveCharacter > 4 ) 1323 if ( (signed int)uActiveCharacter < 1 || (signed int)uActiveCharacter > 4 )
1324 uActiveCharacter = pParty->GetNextActiveCharacter(); 1324 uActiveCharacter = pParty->GetNextActiveCharacter();
1325 pGUIWindow_CurrentMenu->Release(); 1325 pGUIWindow_CurrentMenu->Release();
1326 if ( pGUIWindow_CurrentMenu == window_SpeakInHouse ) 1326 if ( pGUIWindow_CurrentMenu == window_SpeakInHouse )
1327 window_SpeakInHouse = 0; 1327 window_SpeakInHouse = 0;
1328 pGUIWindow_CurrentMenu = 0; 1328 pGUIWindow_CurrentMenu = 0;
1329 pEventTimer->Resume(); 1329 pEventTimer->Resume();
1330 pCurrentScreen = SCREEN_GAME; 1330 pCurrentScreen = SCREEN_GAME;
1331 viewparams->bRedrawGameUI = v0; 1331 viewparams->bRedrawGameUI = 1;
1332 pIcons_LOD->_4355F7(); 1332 pIcons_LOD->_4355F7();
1333 continue; 1333 continue;
1334 case SCREEN_INPUT_BLV: 1334 case SCREEN_INPUT_BLV:
1335 if ( uCurrentHouse_Animation == 153 ) 1335 if ( uCurrentHouse_Animation == 153 )
1336 PlayHouseSound(0x99u, HouseSound_Greeting_2); 1336 PlayHouseSound(0x99u, HouseSound_Greeting_2);
1338 if ( dword_5B65CC ) 1338 if ( dword_5B65CC )
1339 { 1339 {
1340 pParty->field_709 = 0; 1340 pParty->field_709 = 0;
1341 LOBYTE(pNPCStats->pNewNPCData[dword_5B65CC].uFlags) &= 0x7Fu; 1341 LOBYTE(pNPCStats->pNewNPCData[dword_5B65CC].uFlags) &= 0x7Fu;
1342 Party__CountHirelings(); 1342 Party__CountHirelings();
1343 viewparams->bRedrawGameUI = v0; 1343 viewparams->bRedrawGameUI = 1;
1344 dword_5B65CC = 0; 1344 dword_5B65CC = 0;
1345 } 1345 }
1346 goto LABEL_317; 1346 goto LABEL_317;
1347 case SCREEN_NPC_DIALOGUE: 1347 case SCREEN_NPC_DIALOGUE:
1348 if ( dword_5B65CC ) 1348 if ( dword_5B65CC )
1349 { 1349 {
1350 pParty->field_709 = 0; 1350 pParty->field_709 = 0;
1351 LOBYTE(pNPCStats->pNewNPCData[dword_5B65CC].uFlags) &= 0x7Fu; 1351 LOBYTE(pNPCStats->pNewNPCData[dword_5B65CC].uFlags) &= 0x7Fu;
1352 Party__CountHirelings(); 1352 Party__CountHirelings();
1353 viewparams->bRedrawGameUI = v0; 1353 viewparams->bRedrawGameUI = 1;
1354 dword_5B65CC = 0; 1354 dword_5B65CC = 0;
1355 } 1355 }
1356 goto LABEL_317; 1356 goto LABEL_317;
1357 case SCREEN_BRANCHLESS_NPC_DIALOG: 1357 case SCREEN_BRANCHLESS_NPC_DIALOG:
1358 memset(GameUI_Footer_TimedString, 0, 0xC8u); 1358 memset(GameUI_Footer_TimedString, 0, 0xC8u);
1388 GameUI_Footer_TimeLeft = 0; 1388 GameUI_Footer_TimeLeft = 0;
1389 unk_50C9A0 = 0; 1389 unk_50C9A0 = 0;
1390 back_to_game(); 1390 back_to_game();
1391 } 1391 }
1392 } 1392 }
1393 if ( (signed int)uActiveCharacter < v0 || (signed int)uActiveCharacter > 4 ) 1393 if ( (signed int)uActiveCharacter < 1 || (signed int)uActiveCharacter > 4 )
1394 uActiveCharacter = pParty->GetNextActiveCharacter(); 1394 uActiveCharacter = pParty->GetNextActiveCharacter();
1395 pGUIWindow_CurrentMenu->Release(); 1395 pGUIWindow_CurrentMenu->Release();
1396 if ( pGUIWindow_CurrentMenu == window_SpeakInHouse ) 1396 if ( pGUIWindow_CurrentMenu == window_SpeakInHouse )
1397 window_SpeakInHouse = 0; 1397 window_SpeakInHouse = 0;
1398 pGUIWindow_CurrentMenu = 0; 1398 pGUIWindow_CurrentMenu = 0;
1399 pEventTimer->Resume(); 1399 pEventTimer->Resume();
1400 pCurrentScreen = SCREEN_GAME; 1400 pCurrentScreen = SCREEN_GAME;
1401 viewparams->bRedrawGameUI = v0; 1401 viewparams->bRedrawGameUI = 1;
1402 pIcons_LOD->_4355F7(); 1402 pIcons_LOD->_4355F7();
1403 continue; 1403 continue;
1404 } 1404 }
1405 if ( pGUIWindow_Settings ) 1405 if ( pGUIWindow_Settings )
1406 { 1406 {
1416 GameUI_Footer_TimeLeft = 0; 1416 GameUI_Footer_TimeLeft = 0;
1417 unk_50C9A0 = 0; 1417 unk_50C9A0 = 0;
1418 back_to_game(); 1418 back_to_game();
1419 } 1419 }
1420 } 1420 }
1421 if ( (signed int)uActiveCharacter < v0 || (signed int)uActiveCharacter > 4 ) 1421 if ( (signed int)uActiveCharacter < 1 || (signed int)uActiveCharacter > 4 )
1422 uActiveCharacter = pParty->GetNextActiveCharacter(); 1422 uActiveCharacter = pParty->GetNextActiveCharacter();
1423 pGUIWindow_CurrentMenu->Release(); 1423 pGUIWindow_CurrentMenu->Release();
1424 if ( pGUIWindow_CurrentMenu == window_SpeakInHouse ) 1424 if ( pGUIWindow_CurrentMenu == window_SpeakInHouse )
1425 window_SpeakInHouse = 0; 1425 window_SpeakInHouse = 0;
1426 pGUIWindow_CurrentMenu = 0; 1426 pGUIWindow_CurrentMenu = 0;
1427 pEventTimer->Resume(); 1427 pEventTimer->Resume();
1428 pCurrentScreen = SCREEN_GAME; 1428 pCurrentScreen = SCREEN_GAME;
1429 viewparams->bRedrawGameUI = v0; 1429 viewparams->bRedrawGameUI = 1;
1430 pIcons_LOD->_4355F7(); 1430 pIcons_LOD->_4355F7();
1431 continue; 1431 continue;
1432 } 1432 }
1433 LABEL_319: 1433 LABEL_319:
1434 sub_4196A0(); 1434 sub_4196A0();
1450 GameUI_Footer_TimeLeft = 0; 1450 GameUI_Footer_TimeLeft = 0;
1451 unk_50C9A0 = 0; 1451 unk_50C9A0 = 0;
1452 back_to_game(); 1452 back_to_game();
1453 } 1453 }
1454 } 1454 }
1455 if ( (signed int)uActiveCharacter < v0 || (signed int)uActiveCharacter > 4 ) 1455 if ( (signed int)uActiveCharacter < 1 || (signed int)uActiveCharacter > 4 )
1456 uActiveCharacter = pParty->GetNextActiveCharacter(); 1456 uActiveCharacter = pParty->GetNextActiveCharacter();
1457 pGUIWindow_CurrentMenu->Release(); 1457 pGUIWindow_CurrentMenu->Release();
1458 if ( pGUIWindow_CurrentMenu == window_SpeakInHouse ) 1458 if ( pGUIWindow_CurrentMenu == window_SpeakInHouse )
1459 window_SpeakInHouse = 0; 1459 window_SpeakInHouse = 0;
1460 pGUIWindow_CurrentMenu = 0; 1460 pGUIWindow_CurrentMenu = 0;
1461 pEventTimer->Resume(); 1461 pEventTimer->Resume();
1462 pCurrentScreen = SCREEN_GAME; 1462 pCurrentScreen = SCREEN_GAME;
1463 viewparams->bRedrawGameUI = v0; 1463 viewparams->bRedrawGameUI = 1;
1464 pIcons_LOD->_4355F7(); 1464 pIcons_LOD->_4355F7();
1465 continue; 1465 continue;
1466 } 1466 }
1467 pWindow3 = pGUIWindow_Settings; 1467 pWindow3 = pGUIWindow_Settings;
1468 if ( !pGUIWindow_Settings )//Draw Menu 1468 if ( !pGUIWindow_Settings )//Draw Menu
1469 { 1469 {
1470 dword_6BE138 = -1; 1470 dword_6BE138 = -1;
1471 GUIWindow::Create(0x25Au, 0x1C2u, 0, 0, WINDOW_PressedButton2, (int)pBtn_GameSettings, v0); 1471 GUIWindow::Create(0x25Au, 0x1C2u, 0, 0, WINDOW_PressedButton2, (int)pBtn_GameSettings, 1);
1472 pEventTimer->Pause(); 1472 pEventTimer->Pause();
1473 pAudioPlayer->StopChannels(-1, -1); 1473 pAudioPlayer->StopChannels(-1, -1);
1474 ++pIcons_LOD->uTexturePacksCount; 1474 ++pIcons_LOD->uTexturePacksCount;
1475 pCurrentScreen = v0; 1475 pCurrentScreen = 1;
1476 if ( !pIcons_LOD->uNumPrevLoadedFiles ) 1476 if ( !pIcons_LOD->uNumPrevLoadedFiles )
1477 pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles; 1477 pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles;
1478 pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_OptionsButtons, 0, 0); 1478 pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_OptionsButtons, 0, 0);
1479 uTextureID_Options = pIcons_LOD->LoadTexture("options", TEXTURE_16BIT_PALETTE); 1479 uTextureID_Options = pIcons_LOD->LoadTexture("options", TEXTURE_16BIT_PALETTE);
1480 uTextureID_New1 = pIcons_LOD->LoadTexture("new1", TEXTURE_16BIT_PALETTE); 1480 uTextureID_New1 = pIcons_LOD->LoadTexture("new1", TEXTURE_16BIT_PALETTE);
1481 uTextureID_Load1 = pIcons_LOD->LoadTexture("load1", TEXTURE_16BIT_PALETTE); 1481 uTextureID_Load1 = pIcons_LOD->LoadTexture("load1", TEXTURE_16BIT_PALETTE);
1482 uTextureID_Save1 = pIcons_LOD->LoadTexture("save1", TEXTURE_16BIT_PALETTE); 1482 uTextureID_Save1 = pIcons_LOD->LoadTexture("save1", TEXTURE_16BIT_PALETTE);
1483 uTextureID_Controls1 = pIcons_LOD->LoadTexture("controls1", TEXTURE_16BIT_PALETTE); 1483 uTextureID_Controls1 = pIcons_LOD->LoadTexture("controls1", TEXTURE_16BIT_PALETTE);
1484 uTextureID_Resume1 = pIcons_LOD->LoadTexture("resume1", TEXTURE_16BIT_PALETTE); 1484 uTextureID_Resume1 = pIcons_LOD->LoadTexture("resume1", TEXTURE_16BIT_PALETTE);
1485 uTextureID_Quit1 = pIcons_LOD->LoadTexture("quit1", TEXTURE_16BIT_PALETTE); 1485 uTextureID_Quit1 = pIcons_LOD->LoadTexture("quit1", TEXTURE_16BIT_PALETTE);
1486 pBtn_NewGame = pGUIWindow_CurrentMenu->CreateButton(0x13u, 0x9Bu, 0xD6u, 0x28u, v0, 0, UIMSG_StartNewGame, 0, 0x4Eu, 1486 pBtn_NewGame = pGUIWindow_CurrentMenu->CreateButton(0x13u, 0x9Bu, 0xD6u, 0x28u, 1, 0, UIMSG_StartNewGame, 0, 0x4Eu,
1487 pGlobalTXT_LocalizationStrings[614],// "New Game" 1487 pGlobalTXT_LocalizationStrings[614],// "New Game"
1488 pIcons_LOD->GetTexture(uTextureID_New1), 0); 1488 pIcons_LOD->GetTexture(uTextureID_New1), 0);
1489 pBtn_SaveGame = pGUIWindow_CurrentMenu->CreateButton(0x13u, 0xD1u, 0xD6u, 0x28u, v0, 0, UIMSG_Game_OpenSaveGameDialog, 0, 0x53u, 1489 pBtn_SaveGame = pGUIWindow_CurrentMenu->CreateButton(0x13u, 0xD1u, 0xD6u, 0x28u, 1, 0, UIMSG_Game_OpenSaveGameDialog, 0, 0x53u,
1490 pGlobalTXT_LocalizationStrings[615],// "Save Game" 1490 pGlobalTXT_LocalizationStrings[615],// "Save Game"
1491 pIcons_LOD->GetTexture(uTextureID_Save1), 0); 1491 pIcons_LOD->GetTexture(uTextureID_Save1), 0);
1492 pBtn_LoadGame = pGUIWindow_CurrentMenu->CreateButton(19, 263, 0xD6u, 0x28u, v0, 0, UIMSG_Game_OpenLoadGameDialog, 0, 0x4Cu, 1492 pBtn_LoadGame = pGUIWindow_CurrentMenu->CreateButton(19, 263, 0xD6u, 0x28u, 1, 0, UIMSG_Game_OpenLoadGameDialog, 0, 0x4Cu,
1493 pGlobalTXT_LocalizationStrings[616],// "Load Game" 1493 pGlobalTXT_LocalizationStrings[616],// "Load Game"
1494 pIcons_LOD->GetTexture(uTextureID_Load1), 0); 1494 pIcons_LOD->GetTexture(uTextureID_Load1), 0);
1495 pBtn_GameControls = pGUIWindow_CurrentMenu->CreateButton(241, 155, 214, 40, v0, 0, UIMSG_Game_OpenOptionsDialog, 0, 0x43u, 1495 pBtn_GameControls = pGUIWindow_CurrentMenu->CreateButton(241, 155, 214, 40, 1, 0, UIMSG_Game_OpenOptionsDialog, 0, 0x43u,
1496 pGlobalTXT_LocalizationStrings[617],// ""Sound, Keyboard, Game Options:"" 1496 pGlobalTXT_LocalizationStrings[617],// ""Sound, Keyboard, Game Options:""
1497 pIcons_LOD->GetTexture(uTextureID_Controls1), 0); 1497 pIcons_LOD->GetTexture(uTextureID_Controls1), 0);
1498 pBtn_QuitGame = pGUIWindow_CurrentMenu->CreateButton(241, 209, 214, 40, v0, 0, UIMSG_Quit, 0, 0x51u, 1498 pBtn_QuitGame = pGUIWindow_CurrentMenu->CreateButton(241, 209, 214, 40, 1, 0, UIMSG_Quit, 0, 0x51u,
1499 pGlobalTXT_LocalizationStrings[618],// "Quit" 1499 pGlobalTXT_LocalizationStrings[618],// "Quit"
1500 pIcons_LOD->GetTexture(uTextureID_Quit1), 0); 1500 pIcons_LOD->GetTexture(uTextureID_Quit1), 0);
1501 pBtn_Resume = pGUIWindow_CurrentMenu->CreateButton(241, 263, 214, 40, v0, 0, UIMSG_GameMenu_ReturnToGame, 0, 0x52u, 1501 pBtn_Resume = pGUIWindow_CurrentMenu->CreateButton(241, 263, 214, 40, 1, 0, UIMSG_GameMenu_ReturnToGame, 0, 0x52u,
1502 pGlobalTXT_LocalizationStrings[619],// "Return to Game" 1502 pGlobalTXT_LocalizationStrings[619],// "Return to Game"
1503 pIcons_LOD->GetTexture(uTextureID_Resume1), 0); 1503 pIcons_LOD->GetTexture(uTextureID_Resume1), 0);
1504 pGUIWindow_CurrentMenu->_41D08F_set_keyboard_control_group(6, v0, 0, 0); 1504 pGUIWindow_CurrentMenu->_41D08F_set_keyboard_control_group(6, 1, 0, 0);
1505 viewparams->field_48 = v0; 1505 viewparams->field_48 = 1;
1506 stru_506E40.Release(); 1506 stru_506E40.Release();
1507 uNumSeconds = (unsigned int)MakeScreenshot(155, 117); 1507 uNumSeconds = (unsigned int)MakeScreenshot(155, 117);
1508 pRenderer->SavePCXImage("gamma.pcx", (char *)uNumSeconds, 155, 117); 1508 pRenderer->SavePCXImage("gamma.pcx", (char *)uNumSeconds, 155, 117);
1509 free((void *)uNumSeconds); 1509 free((void *)uNumSeconds);
1510 stru_506E40._40E55E("gamma.pcx", 0); 1510 stru_506E40._40E55E("gamma.pcx", 0);
1545 DrawHiredNPCs(); 1545 DrawHiredNPCs();
1546 continue; 1546 continue;
1547 case UIMSG_TransitionUI_Confirm: 1547 case UIMSG_TransitionUI_Confirm:
1548 if ( pMessageQueue_50CBD0->uNumMessages ) 1548 if ( pMessageQueue_50CBD0->uNumMessages )
1549 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; 1549 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
1550 dword_50CDC8 = v0; 1550 dword_50CDC8 = 1;
1551 sub_42FBDD(); 1551 sub_42FBDD();
1552 PlayHouseSound(uCurrentHouse_Animation, HouseSound_NotEnoughMoney_TrainingSuccessful); 1552 PlayHouseSound(uCurrentHouse_Animation, HouseSound_NotEnoughMoney_TrainingSuccessful);
1553 pVideoPlayer->Unload(); 1553 pVideoPlayer->Unload();
1554 DialogueEnding(); 1554 DialogueEnding();
1555 viewparams->bRedrawGameUI = v0; 1555 viewparams->bRedrawGameUI = 1;
1556 if ( dword_59117C_teleportx | dword_591178_teleporty | dword_591174_teleportz | dword_591170_teleport_directiony | dword_59116C_teleport_directionx | dword_591168_teleport_speedz ) 1556 if ( dword_59117C_teleportx | dword_591178_teleporty | dword_591174_teleportz | dword_591170_teleport_directiony | dword_59116C_teleport_directionx | dword_591168_teleport_speedz )
1557 { 1557 {
1558 if ( dword_59117C_teleportx ) 1558 if ( dword_59117C_teleportx )
1559 { 1559 {
1560 pParty->vPosition.x = dword_59117C_teleportx; 1560 pParty->vPosition.x = dword_59117C_teleportx;
1597 } 1597 }
1598 } 1598 }
1599 else 1599 else
1600 { 1600 {
1601 start_event_seq_number = dword_5C341C; 1601 start_event_seq_number = dword_5C341C;
1602 EventProcessor(dword_5C3418, 0, v0); 1602 EventProcessor(dword_5C3418, 0, 1);
1603 } 1603 }
1604 start_event_seq_number = 0; 1604 start_event_seq_number = 0;
1605 if ( !_strcmpi(byte_6BE3B0, "d05.blv") ) 1605 if ( !_strcmpi(byte_6BE3B0, "d05.blv") )
1606 pParty->uTimePlayed += 1474560i64; 1606 pParty->uTimePlayed += 1474560i64;
1607 continue; 1607 continue;
1608 case UIMSG_TransitionWindowCloseBtn: 1608 case UIMSG_TransitionWindowCloseBtn:
1609 CloseWindowBackground(); 1609 CloseWindowBackground();
1610 pVideoPlayer->Unload(); 1610 pVideoPlayer->Unload();
1611 DialogueEnding(); 1611 DialogueEnding();
1612 start_event_seq_number = 0; 1612 start_event_seq_number = 0;
1613 viewparams->bRedrawGameUI = v0; 1613 viewparams->bRedrawGameUI = 1;
1614 continue; 1614 continue;
1615 case UIMSG_CycleCharacters: 1615 case UIMSG_CycleCharacters:
1616 v39 = GetAsyncKeyState(VK_SHIFT); 1616 v39 = GetAsyncKeyState(VK_SHIFT);
1617 uActiveCharacter = CycleCharacter(v39); 1617 uActiveCharacter = CycleCharacter(v39);
1618 viewparams->bRedrawGameUI = v0; 1618 viewparams->bRedrawGameUI = 1;
1619 continue; 1619 continue;
1620 case UIMSG_OnTravelByFoot: 1620 case UIMSG_OnTravelByFoot:
1621 if ( pMessageQueue_50CBD0->uNumMessages ) 1621 if ( pMessageQueue_50CBD0->uNumMessages )
1622 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; 1622 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
1623 dword_50CDC8 = v0; 1623 dword_50CDC8 = 1;
1624 sub_42FBDD(); 1624 sub_42FBDD();
1625 pNPCData4 = (NPCData *)GetTravelTime(); 1625 pNPCData4 = (NPCData *)GetTravelTime();
1626 strcpy(pOutdoor->pLevelFilename, pCurrentMapName); 1626 strcpy(pOutdoor->pLevelFilename, pCurrentMapName);
1627 if ( bUnderwater != 1 && pParty->bFlying 1627 if ( bUnderwater != 1 && pParty->bFlying
1628 || pOutdoor->GetTravelDestination(pParty->vPosition.x, pParty->vPosition.y, pOut, 20) != v0 ) 1628 || pOutdoor->GetTravelDestination(pParty->vPosition.x, pParty->vPosition.y, pOut, 20) != 1 )
1629 { 1629 {
1630 viewparams->bRedrawGameUI = v0; 1630 viewparams->bRedrawGameUI = 1;
1631 LABEL_387: 1631 LABEL_387:
1632 CloseWindowBackground(); 1632 CloseWindowBackground();
1633 if ( pParty->vPosition.x < -22528 ) 1633 if ( pParty->vPosition.x < -22528 )
1634 pParty->vPosition.x = -22528; 1634 pParty->vPosition.x = -22528;
1635 if ( pParty->vPosition.x > 22528 ) 1635 if ( pParty->vPosition.x > 22528 )
1644 } 1644 }
1645 else 1645 else
1646 { 1646 {
1647 pParty->field_6E4 = 0; 1647 pParty->field_6E4 = 0;
1648 pParty->field_6E0 = 0; 1648 pParty->field_6E0 = 0;
1649 pCastSpellInfo->_427D48(v0); 1649 pCastSpellInfo->_427D48(1);
1650 DialogueEnding(); 1650 DialogueEnding();
1651 pEventTimer->Pause(); 1651 pEventTimer->Pause();
1652 pGameLoadingUI_ProgressBar->Initialize(GUIProgressBar::TYPE_Box); 1652 pGameLoadingUI_ProgressBar->Initialize(GUIProgressBar::TYPE_Box);
1653 ++pGameLoadingUI_ProgressBar->uProgressMax; 1653 ++pGameLoadingUI_ProgressBar->uProgressMax;
1654 SaveGame(v0, 0); 1654 SaveGame(1, 0);
1655 pGameLoadingUI_ProgressBar->Progress(); 1655 pGameLoadingUI_ProgressBar->Progress();
1656 RestAndHeal(1440 * (signed int)pNPCData4); 1656 RestAndHeal(1440 * (signed int)pNPCData4);
1657 if ( pParty->uNumFoodRations ) 1657 if ( pParty->uNumFoodRations )
1658 { 1658 {
1659 pParty->RestAndHeal(); 1659 pParty->RestAndHeal();
1660 if ( ((pParty->uNumFoodRations - (signed int)pNPCData4) & 0x80000000u) != 0 ) 1660 if ( ((pParty->uNumFoodRations - (signed int)pNPCData4) & 0x80000000u) != 0 )
1661 { 1661 {
1662 pPlayer7 = pParty->pPlayers; 1662 pPlayer7 = pParty->pPlayers;
1663 do 1663 do
1664 { 1664 {
1665 pPlayer7->SetCondition(v0, 0); 1665 pPlayer7->SetCondition(1, 0);
1666 ++pPlayer7; 1666 ++pPlayer7;
1667 } 1667 }
1668 while ( (signed int)pPlayer7 < (signed int)pParty->pHirelings ); 1668 while ( (signed int)pPlayer7 < (signed int)pParty->pHirelings );
1669 ++pParty->days_played_without_rest; 1669 ++pParty->days_played_without_rest;
1670 } 1670 }
1673 else 1673 else
1674 { 1674 {
1675 pPlayer8 = pParty->pPlayers; 1675 pPlayer8 = pParty->pPlayers;
1676 do 1676 do
1677 { 1677 {
1678 pPlayer8->SetCondition(v0, 0); 1678 pPlayer8->SetCondition(1, 0);
1679 ++pPlayer8; 1679 ++pPlayer8;
1680 } 1680 }
1681 while ( (signed int)pPlayer8 < (signed int)pParty->pHirelings ); 1681 while ( (signed int)pPlayer8 < (signed int)pParty->pHirelings );
1682 ++pParty->days_played_without_rest; 1682 ++pParty->days_played_without_rest;
1683 } 1683 }
1699 bUnderwater = 1; 1699 bUnderwater = 1;
1700 pGame->uFlags2 |= 8u; 1700 pGame->uFlags2 |= 8u;
1701 } 1701 }
1702 if ( !_strcmpi(pCurrentMapName, "out15.odm") || !_strcmpi(pCurrentMapName, "d47.blv") ) 1702 if ( !_strcmpi(pCurrentMapName, "out15.odm") || !_strcmpi(pCurrentMapName, "d47.blv") )
1703 bNoNPCHiring = 1; 1703 bNoNPCHiring = 1;
1704 v0 = 1; 1704 //v0 = 1;
1705 PrepareToLoadODM(1u, (OutdoorCamera *)1); 1705 PrepareToLoadODM(1u, (OutdoorCamera *)1);
1706 pAudioPlayer->SetMapEAX(); 1706 pAudioPlayer->SetMapEAX();
1707 bDialogueUI_InitializeActor_NPC_ID = 0; 1707 bDialogueUI_InitializeActor_NPC_ID = 0;
1708 OnMapLoad(); 1708 OnMapLoad();
1709 pOutdoor->SetFog(); 1709 pOutdoor->SetFog();
1714 pEventTimer->Resume(); 1714 pEventTimer->Resume();
1715 viewparams->bRedrawGameUI = 1; 1715 viewparams->bRedrawGameUI = 1;
1716 pCurrentScreen = SCREEN_GAME; 1716 pCurrentScreen = SCREEN_GAME;
1717 pGameLoadingUI_ProgressBar->Release(); 1717 pGameLoadingUI_ProgressBar->Release();
1718 } 1718 }
1719 viewparams->bRedrawGameUI = v0; 1719 viewparams->bRedrawGameUI = 1;
1720 continue; 1720 continue;
1721 case UIMSG_5B: 1721 case UIMSG_5B:
1722 goto LABEL_387; 1722 goto LABEL_387;
1723 case UIMSG_CastSpell_BE: 1723 case UIMSG_CastSpell_BE:
1724 if ( pRenderer->pRenderD3D ) 1724 if ( pRenderer->pRenderD3D )
1779 } 1779 }
1780 else 1780 else
1781 { 1781 {
1782 if ( v45 != 6 ) 1782 if ( v45 != 6 )
1783 continue; 1783 continue;
1784 if ( uCurrentlyLoadedLevelType != v0 ) 1784 if ( uCurrentlyLoadedLevelType != 1 )
1785 { 1785 {
1786 pODMFace = &pOutdoor->pBModels[v44 >> 9].pFaces[v46 & 0x3F]; 1786 pODMFace = &pOutdoor->pBModels[v44 >> 9].pFaces[v46 & 0x3F];
1787 if ( !(pODMFace->uAttributes & 0x02000000) || !pODMFace->sCogTriggeredID ) 1787 if ( !(pODMFace->uAttributes & 0x02000000) || !pODMFace->sCogTriggeredID )
1788 continue; 1788 continue;
1789 v44 = uNumSeconds; 1789 v44 = uNumSeconds;
1831 if ( pMessageQueue_50CBD0->uNumMessages ) 1831 if ( pMessageQueue_50CBD0->uNumMessages )
1832 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; 1832 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
1833 if ( unk_50C9A0 ) 1833 if ( unk_50C9A0 )
1834 { 1834 {
1835 uActiveCharacter = uMessageParam; 1835 uActiveCharacter = uMessageParam;
1836 viewparams->bRedrawGameUI = v0; 1836 viewparams->bRedrawGameUI = 1;
1837 } 1837 }
1838 else 1838 else
1839 { 1839 {
1840 if ( pGUIWindow_Settings ) 1840 if ( pGUIWindow_Settings )
1841 { 1841 {
1862 unk_50C9A0 = 0; 1862 unk_50C9A0 = 0;
1863 } 1863 }
1864 } 1864 }
1865 continue; 1865 continue;
1866 case UIMSG_BF: 1866 case UIMSG_BF:
1867 dword_50CDC8 = v0; 1867 dword_50CDC8 = 1;
1868 sub_42FBDD(); 1868 sub_42FBDD();
1869 SaveGame(v0, 0); 1869 SaveGame(1, 0);
1870 strcpy(pCurrentMapName, pMapStats->pInfos[uHouse_ExitPic].pFilename); 1870 strcpy(pCurrentMapName, pMapStats->pInfos[uHouse_ExitPic].pFilename);
1871 dword_6BE364_game_settings_1 |= v0; 1871 dword_6BE364_game_settings_1 |= 1;
1872 uGameState = 2; 1872 uGameState = GAME_STATE_2;
1873 //v53 = p2DEvents_minus1_::30[26 * (unsigned int)ptr_507BC0->ptr_1C]; 1873 //v53 = p2DEvents_minus1_::30[26 * (unsigned int)ptr_507BC0->ptr_1C];
1874 v53 = p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1]._quest_related; 1874 v53 = p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1]._quest_related;
1875 if ( v53 < 0 ) 1875 if ( v53 < 0 )
1876 { 1876 {
1877 v54 = abs(v53) - 1; 1877 v54 = abs(v53) - 1;
1893 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)113; 1893 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)113;
1894 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = v0; 1894 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = v0;
1895 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; 1895 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0;
1896 ++pMessageQueue_50CBD0->uNumMessages; 1896 ++pMessageQueue_50CBD0->uNumMessages;
1897 }*/ 1897 }*/
1898 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, v0, 0); 1898 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0);
1899 continue; 1899 continue;
1900 1900
1901 case UIMSG_OnCastTownPortal: 1901 case UIMSG_OnCastTownPortal:
1902 pAudioPlayer->StopChannels(-1, -1); 1902 pAudioPlayer->StopChannels(-1, -1);
1903 pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_Book, WINDOW_TownPortal, uMessageParam); 1903 pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_Book, WINDOW_TownPortal, uMessageParam);
1941 v158 = (unsigned int)thise; 1941 v158 = (unsigned int)thise;
1942 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[475], v158, v174);// "Set %s over %s" 1942 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[475], v158, v174);// "Set %s over %s"
1943 sub_41C0B8_set_status_string(pTmpBuf); 1943 sub_41C0B8_set_status_string(pTmpBuf);
1944 continue; 1944 continue;
1945 case UIMSG_CloseAfterInstallBeacon: 1945 case UIMSG_CloseAfterInstallBeacon:
1946 dword_50CDC8 = v0; 1946 dword_50CDC8 = 1;
1947 //goto LABEL_453; 1947 //goto LABEL_453;
1948 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); 1948 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0);
1949 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages >= 40 ) 1949 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages >= 40 )
1950 continue; 1950 continue;
1951 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)113; 1951 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)113;
1974 pAudioPlayer->PlaySound((SoundID)word_4EE088_sound_ids[dword_506338], 0, 0, -1, 0, dword_50633C, 0, 0); 1974 pAudioPlayer->PlaySound((SoundID)word_4EE088_sound_ids[dword_506338], 0, 0, -1, 0, dword_50633C, 0, 0);
1975 if ( bRecallingBeacon ) 1975 if ( bRecallingBeacon )
1976 { 1976 {
1977 if ( _strcmpi(pCurrentMapName, (const char *)&pGames_LOD->pSubIndices[HIWORD(pNPCData4->uProfession)]) ) 1977 if ( _strcmpi(pCurrentMapName, (const char *)&pGames_LOD->pSubIndices[HIWORD(pNPCData4->uProfession)]) )
1978 { 1978 {
1979 SaveGame(v0, 0); 1979 SaveGame(1, 0);
1980 OnMapLeave(); 1980 OnMapLeave();
1981 strcpy(pCurrentMapName, (const char *)&pGames_LOD->pSubIndices[HIWORD(pNPCData4->uProfession)]); 1981 strcpy(pCurrentMapName, (const char *)&pGames_LOD->pSubIndices[HIWORD(pNPCData4->uProfession)]);
1982 dword_6BE364_game_settings_1 |= v0; 1982 dword_6BE364_game_settings_1 |= 1;
1983 uGameState = 2; 1983 uGameState = GAME_STATE_2;
1984 _5B65A8_npcdata_uflags_or_other = pNPCData4->uFlags; 1984 _5B65A8_npcdata_uflags_or_other = pNPCData4->uFlags;
1985 _5B65AC_npcdata_fame_or_other = pNPCData4->fame; 1985 _5B65AC_npcdata_fame_or_other = pNPCData4->fame;
1986 _5B65B0_npcdata_rep_or_other = pNPCData4->rep; 1986 _5B65B0_npcdata_rep_or_other = pNPCData4->rep;
1987 _5B65B4_npcdata_loword_house_or_other = LOWORD(pNPCData4->Location2D); 1987 _5B65B4_npcdata_loword_house_or_other = LOWORD(pNPCData4->Location2D);
1988 _5B65B8_npcdata_hiword_house_or_other = HIWORD(pNPCData4->Location2D); 1988 _5B65B8_npcdata_hiword_house_or_other = HIWORD(pNPCData4->Location2D);
1989 dword_5B65C0 = v0; 1989 dword_5B65C0 = 1;
1990 } 1990 }
1991 else 1991 else
1992 { 1992 {
1993 pParty->vPosition.x = pNPCData4->uFlags; 1993 pParty->vPosition.x = pNPCData4->uFlags;
1994 pParty->vPosition.y = pNPCData4->fame; 1994 pParty->vPosition.y = pNPCData4->fame;
1995 pParty->vPosition.z = pNPCData4->rep; 1995 pParty->vPosition.z = pNPCData4->rep;
1996 pParty->uFallStartY = pParty->vPosition.z; 1996 pParty->uFallStartY = pParty->vPosition.z;
1997 pParty->sRotationY = LOWORD(pNPCData4->Location2D); 1997 pParty->sRotationY = LOWORD(pNPCData4->Location2D);
1998 pParty->sRotationX = HIWORD(pNPCData4->Location2D); 1998 pParty->sRotationX = HIWORD(pNPCData4->Location2D);
1999 } 1999 }
2000 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, v0, 0); 2000 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0);
2001 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) 2001 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 )
2002 { 2002 {
2003 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape; 2003 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape;
2004 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = v0; 2004 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = v0;
2005 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; 2005 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0;
2059 break; 2059 break;
2060 default: 2060 default:
2061 if ( uMessageParam != 5 ) 2061 if ( uMessageParam != 5 )
2062 { 2062 {
2063 LABEL_486: 2063 LABEL_486:
2064 SaveGame(v0, 0); 2064 SaveGame(1, 0);
2065 v64 = pMapStats->GetMapInfo(pCurrentMapName); 2065 v64 = pMapStats->GetMapInfo(pCurrentMapName);
2066 v65 = uMessageParam; 2066 v65 = uMessageParam;
2067 if ( v64 == TownPortalList[uMessageParam].uMapInfoID ) 2067 if ( v64 == TownPortalList[uMessageParam].uMapInfoID )
2068 { 2068 {
2069 pParty->vPosition.x = TownPortalList[v65].pos.x; 2069 pParty->vPosition.x = TownPortalList[v65].pos.x;
2073 pParty->sRotationY = TownPortalList[v65].rot_y; 2073 pParty->sRotationY = TownPortalList[v65].rot_y;
2074 pParty->sRotationX = TownPortalList[v65].rot_x; 2074 pParty->sRotationX = TownPortalList[v65].rot_x;
2075 } 2075 }
2076 else 2076 else
2077 { 2077 {
2078 SaveGame(v0, 0); 2078 SaveGame(1, 0);
2079 OnMapLeave(); 2079 OnMapLeave();
2080 dword_6BE364_game_settings_1 |= v0; 2080 dword_6BE364_game_settings_1 |= 1;
2081 uGameState = 2; 2081 uGameState = GAME_STATE_2;
2082 strcpy(pCurrentMapName, pMapStats->pInfos[TownPortalList[uMessageParam].uMapInfoID].pFilename); 2082 strcpy(pCurrentMapName, pMapStats->pInfos[TownPortalList[uMessageParam].uMapInfoID].pFilename);
2083 dword_5B65C0 = v0; 2083 dword_5B65C0 = 1;
2084 _5B65A8_npcdata_uflags_or_other = TownPortalList[uMessageParam].pos.x; 2084 _5B65A8_npcdata_uflags_or_other = TownPortalList[uMessageParam].pos.x;
2085 _5B65AC_npcdata_fame_or_other = TownPortalList[uMessageParam].pos.y; 2085 _5B65AC_npcdata_fame_or_other = TownPortalList[uMessageParam].pos.y;
2086 _5B65B0_npcdata_rep_or_other = TownPortalList[uMessageParam].pos.z; 2086 _5B65B0_npcdata_rep_or_other = TownPortalList[uMessageParam].pos.z;
2087 v66 = TownPortalList[uMessageParam].rot_x; 2087 v66 = TownPortalList[uMessageParam].rot_x;
2088 _5B65B4_npcdata_loword_house_or_other = TownPortalList[uMessageParam].rot_y; 2088 _5B65B4_npcdata_loword_house_or_other = TownPortalList[uMessageParam].rot_y;
2089 _5B65B8_npcdata_hiword_house_or_other = v66; 2089 _5B65B8_npcdata_hiword_house_or_other = v66;
2090 InitializeActors(); 2090 InitializeActors();
2091 } 2091 }
2092 v67 = pGUIWindow_CurrentMenu->Hint; 2092 v67 = pGUIWindow_CurrentMenu->Hint;
2093 if ( v67 ) 2093 if ( v67 )
2094 *((int *)v67 + 17) = v0; 2094 *((int *)v67 + 17) = 1;
2095 else 2095 else
2096 pParty->pPlayers[(unsigned __int8)town_portal_caster_id].CanCastSpell(0x14u); 2096 pParty->pPlayers[(unsigned __int8)town_portal_caster_id].CanCastSpell(0x14u);
2097 //LABEL_434: 2097 //LABEL_434:
2098 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) 2098 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 )
2099 { 2099 {
2101 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = v0; 2101 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = v0;
2102 //LABEL_771: 2102 //LABEL_771:
2103 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; 2103 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0;
2104 ++pMessageQueue_50CBD0->uNumMessages; 2104 ++pMessageQueue_50CBD0->uNumMessages;
2105 }*/ 2105 }*/
2106 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, v0, 0); 2106 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0);
2107 continue; 2107 continue;
2108 } 2108 }
2109 v63 = 210; 2109 v63 = 210;
2110 break; 2110 break;
2111 } 2111 }
2229 ModalWindow(pFinalMessage, 196); 2229 ModalWindow(pFinalMessage, 196);
2230 uGameState = GAME_STATE_FINAL_WINDOW; 2230 uGameState = GAME_STATE_FINAL_WINDOW;
2231 continue; 2231 continue;
2232 case UIMSG_C4: 2232 case UIMSG_C4:
2233 __debugbreak; 2233 __debugbreak;
2234 uGameState = 0; 2234 uGameState = GAME_STATE_0;
2235 strcpy((char *)pKeyActionMap->pPressedKeysBuffer, "2"); 2235 strcpy((char *)pKeyActionMap->pPressedKeysBuffer, "2");
2236 goto LABEL_524; 2236 goto LABEL_524;
2237 case UIMSG_DD: 2237 case UIMSG_DD:
2238 LABEL_524: 2238 LABEL_524:
2239 sprintf(pTmpBuf, "%s", pKeyActionMap->pPressedKeysBuffer); 2239 sprintf(pTmpBuf, "%s", pKeyActionMap->pPressedKeysBuffer);
2245 if ( v70 <= 0 || v70 >= 77 ) 2245 if ( v70 <= 0 || v70 >= 77 )
2246 { 2246 {
2247 //LABEL_90: 2247 //LABEL_90:
2248 v1 = ""; 2248 v1 = "";
2249 //LABEL_91: 2249 //LABEL_91:
2250 v0 = 1; 2250 //v0 = 1;
2251 continue; 2251 continue;
2252 } 2252 }
2253 v71 = v70; 2253 v71 = v70;
2254 strcpy(Str2, pMapStats->pInfos[v70].pFilename); 2254 strcpy(Str2, pMapStats->pInfos[v70].pFilename);
2255 pNPCData3 = 0; 2255 pNPCData3 = 0;
2266 while ( (signed int)pNPCData3 < (signed int)pNPCData4 ); 2266 while ( (signed int)pNPCData3 < (signed int)pNPCData4 );
2267 if ( (signed int)pNPCData3 < (signed int)pNPCData4 ) 2267 if ( (signed int)pNPCData3 < (signed int)pNPCData4 )
2268 { 2268 {
2269 strcpy(pCurrentMapName, (const char *)&pGames_LOD->pSubIndices[(int)pNPCData3]); 2269 strcpy(pCurrentMapName, (const char *)&pGames_LOD->pSubIndices[(int)pNPCData3]);
2270 dword_6BE364_game_settings_1 |= 1u; 2270 dword_6BE364_game_settings_1 |= 1u;
2271 uGameState = 2; 2271 uGameState = GAME_STATE_2;
2272 OnMapLeave(); 2272 OnMapLeave();
2273 //goto LABEL_90; 2273 //goto LABEL_90;
2274 v1 = ""; 2274 v1 = "";
2275 v0 = 1; 2275 //v0 = 1;
2276 continue; 2276 continue;
2277 } 2277 }
2278 } 2278 }
2279 sprintf(Str2, "No map found for %s", pMapStats->pInfos[v71].pName); 2279 sprintf(Str2, "No map found for %s", pMapStats->pInfos[v71].pName);
2280 v73 = Str2; 2280 v73 = Str2;
2283 { 2283 {
2284 if ( v216.uPropCount != 3 ) 2284 if ( v216.uPropCount != 3 )
2285 //goto LABEL_90; 2285 //goto LABEL_90;
2286 { 2286 {
2287 v1 = ""; 2287 v1 = "";
2288 v0 = 1; 2288 //v0 = 1;
2289 continue; 2289 continue;
2290 } 2290 }
2291 v74 = atoi(v216.pProperties[0]); 2291 v74 = atoi(v216.pProperties[0]);
2292 thisi = atoi(v216.pProperties[1]); 2292 thisi = atoi(v216.pProperties[1]);
2293 v75 = atoi(v216.pProperties[2]); 2293 v75 = atoi(v216.pProperties[2]);
2302 pParty->vPosition.y = v77; 2302 pParty->vPosition.y = v77;
2303 pParty->vPosition.z = v76; 2303 pParty->vPosition.z = v76;
2304 pParty->uFallStartY = v76; 2304 pParty->uFallStartY = v76;
2305 //goto LABEL_90; 2305 //goto LABEL_90;
2306 v1 = ""; 2306 v1 = "";
2307 v0 = 1; 2307 //v0 = 1;
2308 continue; 2308 continue;
2309 } 2309 }
2310 } 2310 }
2311 else 2311 else
2312 { 2312 {
2324 pParty->vPosition.y = v77; 2324 pParty->vPosition.y = v77;
2325 pParty->vPosition.z = v76; 2325 pParty->vPosition.z = v76;
2326 pParty->uFallStartY = v76; 2326 pParty->uFallStartY = v76;
2327 //goto LABEL_90; 2327 //goto LABEL_90;
2328 v1 = ""; 2328 v1 = "";
2329 v0 = 1; 2329 //v0 = 1;
2330 continue; 2330 continue;
2331 } 2331 }
2332 } 2332 }
2333 } 2333 }
2334 } 2334 }
2337 v73 = "Can't jump to that location!"; 2337 v73 = "Can't jump to that location!";
2338 } 2338 }
2339 ShowStatusBarString(v73, 6u); 2339 ShowStatusBarString(v73, 6u);
2340 //goto LABEL_90; 2340 //goto LABEL_90;
2341 v1 = ""; 2341 v1 = "";
2342 v0 = 1; 2342 //v0 = 1;
2343 continue; 2343 continue;
2344 case UIMSG_CastQuickSpell: 2344 case UIMSG_CastQuickSpell:
2345 if ( bUnderwater == 1 ) 2345 if ( bUnderwater == 1 )
2346 { 2346 {
2347 ShowStatusBarString(pGlobalTXT_LocalizationStrings[652], 2);// "You can not do that while you are underwater!" 2347 ShowStatusBarString(pGlobalTXT_LocalizationStrings[652], 2);// "You can not do that while you are underwater!"
2350 } 2350 }
2351 if ( !uActiveCharacter || (pPlayer2 = pPlayers[uActiveCharacter], pPlayer2->uTimeToRecovery) ) 2351 if ( !uActiveCharacter || (pPlayer2 = pPlayers[uActiveCharacter], pPlayer2->uTimeToRecovery) )
2352 //goto LABEL_90; 2352 //goto LABEL_90;
2353 { 2353 {
2354 v1 = ""; 2354 v1 = "";
2355 v0 = 1; 2355 //v0 = 1;
2356 continue; 2356 continue;
2357 } 2357 }
2358 _42777D_CastSpell_UseWand_ShootArrow(pPlayer2->uQuickSpell, uActiveCharacter - 1, 0, 0, uActiveCharacter); 2358 _42777D_CastSpell_UseWand_ShootArrow(pPlayer2->uQuickSpell, uActiveCharacter - 1, 0, 0, uActiveCharacter);
2359 continue; 2359 continue;
2360 case UIMSG_CastSpell_SmallShot://FireBlow, Lightning, Ice Lightning, Swarm, hand hammer 2360 case UIMSG_CastSpell_SmallShot://FireBlow, Lightning, Ice Lightning, Swarm, hand hammer
2374 v84 = v83 >> 16; 2374 v84 = v83 >> 16;
2375 if ( PID_TYPE(v44) != 3 || v84 >= 5120 ) 2375 if ( PID_TYPE(v44) != 3 || v84 >= 5120 )
2376 //goto LABEL_90; 2376 //goto LABEL_90;
2377 { 2377 {
2378 v1 = ""; 2378 v1 = "";
2379 v0 = 1; 2379 //v0 = 1;
2380 continue; 2380 continue;
2381 } 2381 }
2382 v51 = pGUIWindow_Settings->ptr_1C; 2382 v51 = pGUIWindow_Settings->ptr_1C;
2383 if ( uMessage == 70 ) 2383 if ( uMessage == 70 )
2384 { 2384 {
2406 case UIMSG_1C: 2406 case UIMSG_1C:
2407 if ( !uActiveCharacter || pCurrentScreen ) 2407 if ( !uActiveCharacter || pCurrentScreen )
2408 //goto LABEL_90; 2408 //goto LABEL_90;
2409 { 2409 {
2410 v1 = ""; 2410 v1 = "";
2411 v0 = 1; 2411 //v0 = 1;
2412 continue; 2412 continue;
2413 } 2413 }
2414 ptr_507BC8 = GUIWindow::Create(0, 0, 640, 480, WINDOW_68, uMessageParam, 0); 2414 ptr_507BC8 = GUIWindow::Create(0, 0, 640, 480, WINDOW_68, uMessageParam, 0);
2415 pCurrentScreen = SCREEN_19; 2415 pCurrentScreen = SCREEN_19;
2416 pEventTimer->Pause(); 2416 pEventTimer->Pause();
2418 case UIMSG_1B: 2418 case UIMSG_1B:
2419 if ( !uActiveCharacter ) 2419 if ( !uActiveCharacter )
2420 //goto LABEL_90; 2420 //goto LABEL_90;
2421 { 2421 {
2422 v1 = ""; 2422 v1 = "";
2423 v0 = 1; 2423 //v0 = 1;
2424 continue; 2424 continue;
2425 } 2425 }
2426 if ( pParty->bTurnBasedModeOn != v0 ) 2426 if ( pParty->bTurnBasedModeOn != 1 )
2427 //goto LABEL_569; 2427 //goto LABEL_569;
2428 { 2428 {
2429 if ( pActors[uMessageParam].uAIState == 5 ) 2429 if ( pActors[uMessageParam].uAIState == 5 )
2430 stru_50C198.LootActor(&pActors[uMessageParam]); 2430 stru_50C198.LootActor(&pActors[uMessageParam]);
2431 else 2431 else
2432 Actor::StealFrom(uMessageParam); 2432 Actor::StealFrom(uMessageParam);
2433 continue; 2433 continue;
2434 } 2434 }
2435 if ( pTurnEngine->field_4 == v0 || pTurnEngine->field_4 == 3 ) 2435 if ( pTurnEngine->field_4 == 1 || pTurnEngine->field_4 == 3 )
2436 //goto LABEL_90; 2436 //goto LABEL_90;
2437 { 2437 {
2438 v1 = ""; 2438 v1 = "";
2439 v0 = 1; 2439 //v0 = 1;
2440 continue; 2440 continue;
2441 } 2441 }
2442 if ( !(pTurnEngine->field_18 & 2) ) 2442 if ( !(pTurnEngine->field_18 & 2) )
2443 { 2443 {
2444 //LABEL_569: 2444 //LABEL_569:
2452 case UIMSG_Attack: 2452 case UIMSG_Attack:
2453 if ( !uActiveCharacter ) 2453 if ( !uActiveCharacter )
2454 //goto LABEL_90; 2454 //goto LABEL_90;
2455 { 2455 {
2456 v1 = ""; 2456 v1 = "";
2457 v0 = 1; 2457 //v0 = 1;
2458 continue; 2458 continue;
2459 } 2459 }
2460 if ( pParty->bTurnBasedModeOn != v0 ) 2460 if ( pParty->bTurnBasedModeOn != 1 )
2461 //goto LABEL_577; 2461 //goto LABEL_577;
2462 { 2462 {
2463 _42ECB5_PlayerAttacksActor(); 2463 _42ECB5_PlayerAttacksActor();
2464 continue; 2464 continue;
2465 } 2465 }
2466 if ( pTurnEngine->field_4 == v0 || pTurnEngine->field_4 == 3 ) 2466 if ( pTurnEngine->field_4 == 1 || pTurnEngine->field_4 == 3 )
2467 //goto LABEL_90; 2467 //goto LABEL_90;
2468 { 2468 {
2469 v1 = ""; 2469 v1 = "";
2470 v0 = 1; 2470 //v0 = 1;
2471 continue; 2471 continue;
2472 } 2472 }
2473 if ( !(pTurnEngine->field_18 & 2) ) 2473 if ( !(pTurnEngine->field_18 & 2) )
2474 //LABEL_577: 2474 //LABEL_577:
2475 _42ECB5_PlayerAttacksActor(); 2475 _42ECB5_PlayerAttacksActor();
2484 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); 2484 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0);
2485 continue; 2485 continue;
2486 } 2486 }
2487 GUIWindow::Create(pButton_RestUI_Wait5Minutes->uX, pButton_RestUI_Wait5Minutes->uY, 0, 0, WINDOW_PressedButton2, 2487 GUIWindow::Create(pButton_RestUI_Wait5Minutes->uX, pButton_RestUI_Wait5Minutes->uY, 0, 0, WINDOW_PressedButton2,
2488 (int)pButton_RestUI_Wait5Minutes, (int)pGlobalTXT_LocalizationStrings[238]);// "Wait 5 Minutes" 2488 (int)pButton_RestUI_Wait5Minutes, (int)pGlobalTXT_LocalizationStrings[238]);// "Wait 5 Minutes"
2489 dword_506F14 = v0; 2489 dword_506F14 = 1;
2490 _506F18_num_hours_to_sleep = 5; 2490 _506F18_num_hours_to_sleep = 5;
2491 continue; 2491 continue;
2492 case UIMSG_Wait1Hour: 2492 case UIMSG_Wait1Hour:
2493 if ( dword_506F14 == 2 ) 2493 if ( dword_506F14 == 2 )
2494 { 2494 {
2496 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); 2496 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0);
2497 continue; 2497 continue;
2498 } 2498 }
2499 GUIWindow::Create(pButton_RestUI_Wait1Hour->uX, pButton_RestUI_Wait1Hour->uY, 0, 0, WINDOW_PressedButton2, 2499 GUIWindow::Create(pButton_RestUI_Wait1Hour->uX, pButton_RestUI_Wait1Hour->uY, 0, 0, WINDOW_PressedButton2,
2500 (int)pButton_RestUI_Wait1Hour, (int)pGlobalTXT_LocalizationStrings[239]);// "Wait 1 Hour" 2500 (int)pButton_RestUI_Wait1Hour, (int)pGlobalTXT_LocalizationStrings[239]);// "Wait 1 Hour"
2501 dword_506F14 = v0; 2501 dword_506F14 = 1;
2502 _506F18_num_hours_to_sleep = 60; 2502 _506F18_num_hours_to_sleep = 60;
2503 continue; 2503 continue;
2504 case UIMSG_RentRoom: 2504 case UIMSG_RentRoom:
2505 dword_506F14 = 2; 2505 dword_506F14 = 2;
2506 RestUI_Initialize(); 2506 RestUI_Initialize();
2521 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; 2521 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
2522 if ( pCurrentScreen ) 2522 if ( pCurrentScreen )
2523 continue; 2523 continue;
2524 if ( sub_42F4DA() ) 2524 if ( sub_42F4DA() )
2525 { 2525 {
2526 if ( pParty->bTurnBasedModeOn == v0 ) 2526 if ( pParty->bTurnBasedModeOn == 1 )
2527 { 2527 {
2528 ShowStatusBarString(pGlobalTXT_LocalizationStrings[478], 2);// "You can't rest in turn-based mode!" 2528 ShowStatusBarString(pGlobalTXT_LocalizationStrings[478], 2);// "You can't rest in turn-based mode!"
2529 continue; 2529 continue;
2530 } 2530 }
2531 v88 = pGlobalTXT_LocalizationStrings[480];// "There are hostile enemies near!" 2531 v88 = pGlobalTXT_LocalizationStrings[480];// "There are hostile enemies near!"
2533 v88 = pGlobalTXT_LocalizationStrings[479];// "You can't rest here!" 2533 v88 = pGlobalTXT_LocalizationStrings[479];// "You can't rest here!"
2534 ShowStatusBarString(v88, 2); 2534 ShowStatusBarString(v88, 2);
2535 if ( !uActiveCharacter ) 2535 if ( !uActiveCharacter )
2536 { 2536 {
2537 v1 = ""; 2537 v1 = "";
2538 v0 = 1; 2538 //v0 = 1;
2539 continue; 2539 continue;
2540 } 2540 }
2541 pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)13, 0); 2541 pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)13, 0);
2542 continue; 2542 continue;
2543 } 2543 }
2544 if ( pParty->bTurnBasedModeOn == v0 ) 2544 if ( pParty->bTurnBasedModeOn == 1 )
2545 { 2545 {
2546 ShowStatusBarString(pGlobalTXT_LocalizationStrings[478], 2);// "You can't rest in turn-based mode!" 2546 ShowStatusBarString(pGlobalTXT_LocalizationStrings[478], 2);// "You can't rest in turn-based mode!"
2547 continue; 2547 continue;
2548 } 2548 }
2549 if ( !(pParty->uFlags & 0x88) ) 2549 if ( !(pParty->uFlags & 0x88) )
2550 { 2550 {
2551 RestUI_Initialize(); 2551 RestUI_Initialize();
2552 continue; 2552 continue;
2553 } 2553 }
2554 if ( pParty->bTurnBasedModeOn == v0 ) 2554 if ( pParty->bTurnBasedModeOn == 1 )
2555 { 2555 {
2556 ShowStatusBarString(pGlobalTXT_LocalizationStrings[478], 2);// "You can't rest in turn-based mode!" 2556 ShowStatusBarString(pGlobalTXT_LocalizationStrings[478], 2);// "You can't rest in turn-based mode!"
2557 continue; 2557 continue;
2558 } 2558 }
2559 v88 = pGlobalTXT_LocalizationStrings[480];// "There are hostile enemies near!" 2559 v88 = pGlobalTXT_LocalizationStrings[480];// "There are hostile enemies near!"
2561 v88 = pGlobalTXT_LocalizationStrings[479];// "You can't rest here!" 2561 v88 = pGlobalTXT_LocalizationStrings[479];// "You can't rest here!"
2562 ShowStatusBarString(v88, 2u); 2562 ShowStatusBarString(v88, 2u);
2563 if ( !uActiveCharacter ) 2563 if ( !uActiveCharacter )
2564 { 2564 {
2565 v1 = ""; 2565 v1 = "";
2566 v0 = 1; 2566 //v0 = 1;
2567 continue; 2567 continue;
2568 } 2568 }
2569 pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)13, 0); 2569 pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)13, 0);
2570 continue; 2570 continue;
2571 case UIMSG_Rest8Hour: 2571 case UIMSG_Rest8Hour:
2597 v92 = pMapInfo->EncM1percent; 2597 v92 = pMapInfo->EncM1percent;
2598 v93 = v91 + 1; 2598 v93 = v91 + 1;
2599 if ( v93 > v92 ) 2599 if ( v93 > v92 )
2600 pNPCData4 = (NPCData *)((v93 > v92 + pMapInfo->EncM2percent) + 2); 2600 pNPCData4 = (NPCData *)((v93 > v92 + pMapInfo->EncM2percent) + 2);
2601 else 2601 else
2602 pNPCData4 = (NPCData *)v0; 2602 pNPCData4 = (NPCData *)1;
2603 if ( !sub_45063B(pMapInfo, (int)pNPCData4) ) 2603 if ( !sub_45063B(pMapInfo, (int)pNPCData4) )
2604 pNPCData4 = 0; 2604 pNPCData4 = 0;
2605 if ( pNPCData4 ) 2605 if ( pNPCData4 )
2606 { 2606 {
2607 pPlayerNum = rand() % 4; 2607 pPlayerNum = rand() % 4;
2643 continue; 2643 continue;
2644 } 2644 }
2645 GUIWindow::Create(pButton_RestUI_WaitUntilDawn->uX, pButton_RestUI_WaitUntilDawn->uY, 0, 0, WINDOW_PressedButton2, 2645 GUIWindow::Create(pButton_RestUI_WaitUntilDawn->uX, pButton_RestUI_WaitUntilDawn->uY, 0, 0, WINDOW_PressedButton2,
2646 (int)pButton_RestUI_WaitUntilDawn, (int)pGlobalTXT_LocalizationStrings[237]);// "Wait until Dawn" 2646 (int)pButton_RestUI_WaitUntilDawn, (int)pGlobalTXT_LocalizationStrings[237]);// "Wait until Dawn"
2647 v97 = _494820_training_time(pParty->uCurrentHour); 2647 v97 = _494820_training_time(pParty->uCurrentHour);
2648 dword_506F14 = v0; 2648 dword_506F14 = 1;
2649 _506F18_num_hours_to_sleep = 60 * v97 - pParty->uCurrentMinute; 2649 _506F18_num_hours_to_sleep = 60 * v97 - pParty->uCurrentMinute;
2650 continue; 2650 continue;
2651 case UIMSG_HintSelectRemoveQuickSpellBtn: 2651 case UIMSG_HintSelectRemoveQuickSpellBtn:
2652 if ( quick_spell_at_page && byte_506550 ) 2652 if ( quick_spell_at_page && byte_506550 )
2653 { 2653 {
2681 v178 = pSpellStats->pInfos[uMessageParam + 11 * v98 + 1].pName; 2681 v178 = pSpellStats->pInfos[uMessageParam + 11 * v98 + 1].pName;
2682 v161 = pGlobalTXT_LocalizationStrings[486]; 2682 v161 = pGlobalTXT_LocalizationStrings[486];
2683 } 2683 }
2684 sprintfex(pTmpBuf, v161, v178); 2684 sprintfex(pTmpBuf, v161, v178);
2685 sub_41C0B8_set_status_string(pTmpBuf); 2685 sub_41C0B8_set_status_string(pTmpBuf);
2686 v0 = 1; 2686 //v0 = 1;
2687 continue; 2687 continue;
2688 case UIMSG_ClickInstallRemoveQuickSpellBtn: 2688 case UIMSG_ClickInstallRemoveQuickSpellBtn:
2689 GUIWindow::Create(pBtn_InstallRemoveSpell->uX, pBtn_InstallRemoveSpell->uY, 0, 0, WINDOW_PressedButton2, (int)pBtn_InstallRemoveSpell, 0); 2689 GUIWindow::Create(pBtn_InstallRemoveSpell->uX, pBtn_InstallRemoveSpell->uY, 0, 0, WINDOW_PressedButton2, (int)pBtn_InstallRemoveSpell, 0);
2690 if ( !uActiveCharacter ) 2690 if ( !uActiveCharacter )
2691 continue; 2691 continue;
2773 { 2773 {
2774 if ( quick_spell_at_page - 1 == uMessageParam ) 2774 if ( quick_spell_at_page - 1 == uMessageParam )
2775 { 2775 {
2776 pGUIWindow_CurrentMenu->Release(); 2776 pGUIWindow_CurrentMenu->Release();
2777 pEventTimer->Resume(); 2777 pEventTimer->Resume();
2778 viewparams->bRedrawGameUI = v0; 2778 viewparams->bRedrawGameUI = 1;
2779 pCurrentScreen = SCREEN_GAME; 2779 pCurrentScreen = SCREEN_GAME;
2780 pIcons_LOD->_4114F2(); 2780 pIcons_LOD->_4114F2();
2781 v103 = quick_spell_at_page + 11 * player->lastOpenedSpellbookPage; 2781 v103 = quick_spell_at_page + 11 * player->lastOpenedSpellbookPage;
2782 if ( dword_50C9E8 < 40 ) 2782 if ( dword_50C9E8 < 40 )
2783 { 2783 {
2801 _42777D_CastSpell_UseWand_ShootArrow(uMessageParam, v199, 0, 0, 0); 2801 _42777D_CastSpell_UseWand_ShootArrow(uMessageParam, v199, 0, 0, 0);
2802 continue; 2802 continue;
2803 2803
2804 case UIMSG_92: 2804 case UIMSG_92:
2805 if ( pTurnEngine->field_4 != 3 ) 2805 if ( pTurnEngine->field_4 != 3 )
2806 _42777D_CastSpell_UseWand_ShootArrow(uMessageParam, v199, 133, v0, 0); 2806 _42777D_CastSpell_UseWand_ShootArrow(uMessageParam, v199, 133, 1, 0);
2807 continue; 2807 continue;
2808 case UIMSG_SpellBookWindow: 2808 case UIMSG_SpellBookWindow:
2809 if ( pTurnEngine->field_4 == 3 ) 2809 if ( pTurnEngine->field_4 == 3 )
2810 continue; 2810 continue;
2811 if ( bUnderwater == 1 ) 2811 if ( bUnderwater == 1 )
2825 GUIWindow::Create(0x1DCu, 0x1C2u, 0, 0, WINDOW_PressedButton2, (int)pBtn_CastSpell, 0); 2825 GUIWindow::Create(0x1DCu, 0x1C2u, 0, 0, WINDOW_PressedButton2, (int)pBtn_CastSpell, 0);
2826 pCurrentScreen = SCREEN_SPELL_BOOK; 2826 pCurrentScreen = SCREEN_SPELL_BOOK;
2827 pEventTimer->Pause(); 2827 pEventTimer->Pause();
2828 pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_SpellBook, 0, 0); 2828 pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_SpellBook, 0, 0);
2829 pAudioPlayer->PlaySound((SoundID)48, 0, 0, -1, 0, 0, 0, 0); 2829 pAudioPlayer->PlaySound((SoundID)48, 0, 0, -1, 0, 0, 0, 0);
2830 viewparams->field_48 = v0; 2830 viewparams->field_48 = 1;
2831 continue; 2831 continue;
2832 } 2832 }
2833 if ( pCurrentScreen != SCREEN_REST 2833 if ( pCurrentScreen != SCREEN_REST
2834 && pCurrentScreen != SCREEN_CHARACTERS 2834 && pCurrentScreen != SCREEN_CHARACTERS
2835 && (pCurrentScreen <= SCREEN_63 2835 && (pCurrentScreen <= SCREEN_63
2839 GUIWindow::Create(0x1DCu, 0x1C2u, 0, 0, WINDOW_PressedButton2, (int)pBtn_CastSpell, 0); 2839 GUIWindow::Create(0x1DCu, 0x1C2u, 0, 0, WINDOW_PressedButton2, (int)pBtn_CastSpell, 0);
2840 pCurrentScreen = SCREEN_SPELL_BOOK; 2840 pCurrentScreen = SCREEN_SPELL_BOOK;
2841 pEventTimer->Pause(); 2841 pEventTimer->Pause();
2842 pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_SpellBook, 0, 0); 2842 pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_SpellBook, 0, 0);
2843 pAudioPlayer->PlaySound((SoundID)48, 0, 0, -1, 0, 0, 0, 0); 2843 pAudioPlayer->PlaySound((SoundID)48, 0, 0, -1, 0, 0, 0, 0);
2844 viewparams->field_48 = v0; 2844 viewparams->field_48 = 1;
2845 continue; 2845 continue;
2846 } 2846 }
2847 } 2847 }
2848 } 2848 }
2849 continue; 2849 continue;
2854 pGUIWindow_CurrentMenu->Release(); 2854 pGUIWindow_CurrentMenu->Release();
2855 ++pIcons_LOD->uTexturePacksCount; 2855 ++pIcons_LOD->uTexturePacksCount;
2856 if ( !pIcons_LOD->uNumPrevLoadedFiles ) 2856 if ( !pIcons_LOD->uNumPrevLoadedFiles )
2857 pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles; 2857 pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles;
2858 GUIWindow::Create(0x230u, 0x1C2u, 0, 0, WINDOW_PressedButton2, (int)pBtn_QuickReference, 0); 2858 GUIWindow::Create(0x230u, 0x1C2u, 0, 0, WINDOW_PressedButton2, (int)pBtn_QuickReference, 0);
2859 viewparams->bRedrawGameUI = v0; 2859 viewparams->bRedrawGameUI = 1;
2860 pEventTimer->Pause(); 2860 pEventTimer->Pause();
2861 pAudioPlayer->StopChannels(-1, -1); 2861 pAudioPlayer->StopChannels(-1, -1);
2862 pCurrentScreen = SCREEN_QUICK_REFERENCE; 2862 pCurrentScreen = SCREEN_QUICK_REFERENCE;
2863 pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_QuickReference, 5, 0); 2863 pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_QuickReference, 5, 0);
2864 papredoll_dbrds[2] = pIcons_LOD->LoadTexture("BUTTEXI1", TEXTURE_16BIT_PALETTE); 2864 papredoll_dbrds[2] = pIcons_LOD->LoadTexture("BUTTEXI1", TEXTURE_16BIT_PALETTE);
2865 pBtn_ExitCancel = pGUIWindow_CurrentMenu->CreateButton(0x187u, 0x13Cu, 0x4Bu, 0x21u, v0, 0, UIMSG_Escape, 0, 0, 2865 pBtn_ExitCancel = pGUIWindow_CurrentMenu->CreateButton(0x187u, 0x13Cu, 0x4Bu, 0x21u, 1, 0, UIMSG_Escape, 0, 0,
2866 pGlobalTXT_LocalizationStrings[79],// "Exit" 2866 pGlobalTXT_LocalizationStrings[79],// "Exit"
2867 pIcons_LOD->GetTexture(uTextureID_BUTTDESC2), 0); //, v179); 2867 pIcons_LOD->GetTexture(uTextureID_BUTTDESC2), 0); //, v179);
2868 continue; 2868 continue;
2869 case UIMSG_GameMenuButton: 2869 case UIMSG_GameMenuButton:
2870 if ( pCurrentScreen ) 2870 if ( pCurrentScreen )
2871 { 2871 {
2872 pGUIWindow_CurrentMenu->Release(); 2872 pGUIWindow_CurrentMenu->Release();
2873 pEventTimer->Resume(); 2873 pEventTimer->Resume();
2874 pCurrentScreen = SCREEN_GAME; 2874 pCurrentScreen = SCREEN_GAME;
2875 viewparams->bRedrawGameUI = v0; 2875 viewparams->bRedrawGameUI = 1;
2876 } 2876 }
2877 stru_506E40.Release(); 2877 stru_506E40.Release();
2878 uNumSeconds = (unsigned int)MakeScreenshot(155, 117); 2878 uNumSeconds = (unsigned int)MakeScreenshot(155, 117);
2879 pRenderer->SavePCXImage("gamma.pcx", (char *)uNumSeconds, 155, 117); 2879 pRenderer->SavePCXImage("gamma.pcx", (char *)uNumSeconds, 155, 117);
2880 free((void *)uNumSeconds); 2880 free((void *)uNumSeconds);
2889 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; 2889 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0;
2890 ++pMessageQueue_50CBD0->uNumMessages;*/ 2890 ++pMessageQueue_50CBD0->uNumMessages;*/
2891 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); 2891 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0);
2892 continue; 2892 continue;
2893 case UIMSG_C0: 2893 case UIMSG_C0:
2894 dword_50651C = v0; 2894 dword_50651C = 1;
2895 if ( pMouse->GetCursorPos(&v211)->y > 178 ) 2895 if ( pMouse->GetCursorPos(&v211)->y > 178 )
2896 dword_50651C = -1; 2896 dword_50651C = -1;
2897 continue; 2897 continue;
2898 case UIMSG_ClickAwardsUpBtn: 2898 case UIMSG_ClickAwardsUpBtn:
2899 GUIWindow::Create(pBtn_Up->uX, pBtn_Up->uY, 0, 0, WINDOW_CharactersPressedButton, (int)pBtn_Up, 0); 2899 GUIWindow::Create(pBtn_Up->uX, pBtn_Up->uY, 0, 0, WINDOW_CharactersPressedButton, (int)pBtn_Up, 0);
2900 dword_506548 = v0; 2900 dword_506548 = 1;
2901 continue; 2901 continue;
2902 case UIMSG_ClickAwardsDownBtn: 2902 case UIMSG_ClickAwardsDownBtn:
2903 GUIWindow::Create(pBtn_Down->uX, pBtn_Down->uY, 0, 0, WINDOW_CharactersPressedButton, (int)pBtn_Down, 0); 2903 GUIWindow::Create(pBtn_Down->uX, pBtn_Down->uY, 0, 0, WINDOW_CharactersPressedButton, (int)pBtn_Down, 0);
2904 dword_506544 = v0; 2904 dword_506544 = 1;
2905 continue; 2905 continue;
2906 case UIMSG_ChangeDetaliz: 2906 case UIMSG_ChangeDetaliz:
2907 bRingsShownInCharScreen ^= v0; 2907 bRingsShownInCharScreen ^= 1;
2908 pCharacterScreen_DetalizBtn->Release(); 2908 pCharacterScreen_DetalizBtn->Release();
2909 pCharacterScreen_DollBtn->Release(); 2909 pCharacterScreen_DollBtn->Release();
2910 if ( bRingsShownInCharScreen ) 2910 if ( bRingsShownInCharScreen )
2911 { 2911 {
2912 v128 = pIcons_LOD->GetTexture(uTextureID_detaliz_close_button)->uTextureHeight; 2912 v128 = pIcons_LOD->GetTexture(uTextureID_detaliz_close_button)->uTextureHeight;
2919 v128 = 30; 2919 v128 = 30;
2920 v125 = 30; 2920 v125 = 30;
2921 v123 = 300; 2921 v123 = 300;
2922 v121 = 600; 2922 v121 = 600;
2923 } 2923 }
2924 pCharacterScreen_DetalizBtn = pGUIWindow_CurrentMenu->CreateButton(v121, v123, v125, v128, v0, 0, UIMSG_ChangeDetaliz, 0, 0, 2924 pCharacterScreen_DetalizBtn = pGUIWindow_CurrentMenu->CreateButton(v121, v123, v125, v128, 1, 0, UIMSG_ChangeDetaliz, 0, 0,
2925 pGlobalTXT_LocalizationStrings[64],// "Detail Toggle" 2925 pGlobalTXT_LocalizationStrings[64],// "Detail Toggle"
2926 0); 2926 0);
2927 pCharacterScreen_DollBtn = pGUIWindow_CurrentMenu->CreateButton(0x1DCu, 0, 0xA4u, 0x159u, v0, 0, UIMSG_ClickPaperdoll, 0, 0, v1, 0); 2927 pCharacterScreen_DollBtn = pGUIWindow_CurrentMenu->CreateButton(0x1DCu, 0, 0xA4u, 0x159u, 1, 0, UIMSG_ClickPaperdoll, 0, 0, v1, 0);
2928 viewparams->bRedrawGameUI = v0; 2928 viewparams->bRedrawGameUI = 1;
2929 continue; 2929 continue;
2930 case UIMSG_ClickPaperdoll: 2930 case UIMSG_ClickPaperdoll:
2931 OnPaperdollLeftClick(); 2931 OnPaperdollLeftClick();
2932 continue; 2932 continue;
2933 case UIMSG_ClickStatsBtn: 2933 case UIMSG_ClickStatsBtn:
2987 switch ( uMessageParam ) 2987 switch ( uMessageParam )
2988 { 2988 {
2989 default: 2989 default:
2990 continue; 2990 continue;
2991 case 11: 2991 case 11:
2992 dword_506548 = v0; 2992 dword_506548 = 1;
2993 continue; 2993 continue;
2994 case 10: 2994 case 10:
2995 dword_506544 = v0; 2995 dword_506544 = 1;
2996 continue; 2996 continue;
2997 case 0: 2997 case 0:
2998 pButton = pBtn_Book_1; 2998 pButton = pBtn_Book_1;
2999 dword_506544 = v0; 2999 dword_506544 = 1;
3000 break; 3000 break;
3001 case 1: 3001 case 1:
3002 pButton = pBtn_Book_2; 3002 pButton = pBtn_Book_2;
3003 dword_506548 = v0; 3003 dword_506548 = 1;
3004 break; 3004 break;
3005 case 2: 3005 case 2:
3006 dword_506540 = v0; 3006 dword_506540 = 1;
3007 if ( dword_506364 ) 3007 if ( dword_506364 )
3008 continue; 3008 continue;
3009 pButton = pBtn_Book_3; 3009 pButton = pBtn_Book_3;
3010 break; 3010 break;
3011 case 3: 3011 case 3:
3012 dword_50653C = v0; 3012 dword_50653C = 1;
3013 if ( dword_506364 ) 3013 if ( dword_506364 )
3014 continue; 3014 continue;
3015 pButton = pBtn_Book_4; 3015 pButton = pBtn_Book_4;
3016 break; 3016 break;
3017 case 4: 3017 case 4:
3018 dword_506538 = v0; 3018 dword_506538 = 1;
3019 if ( dword_506364 ) 3019 if ( dword_506364 )
3020 continue; 3020 continue;
3021 pButton = pBtn_Book_5; 3021 pButton = pBtn_Book_5;
3022 break; 3022 break;
3023 case 5: 3023 case 5:
3024 dword_506534 = v0; 3024 dword_506534 = 1;
3025 if ( dword_506364 ) 3025 if ( dword_506364 )
3026 continue; 3026 continue;
3027 pButton = pBtn_Book_6; 3027 pButton = pBtn_Book_6;
3028 break; 3028 break;
3029 case 6: 3029 case 6:
3030 pButton = pBtn_Autonotes_Misc; 3030 pButton = pBtn_Autonotes_Misc;
3031 dword_506530 = v0; 3031 dword_506530 = 1;
3032 break; 3032 break;
3033 case 7: 3033 case 7:
3034 pButton = pBtn_Autonotes_Instructors; 3034 pButton = pBtn_Autonotes_Instructors;
3035 dword_50652C = v0; 3035 dword_50652C = 1;
3036 break; 3036 break;
3037 } 3037 }
3038 GUIWindow::Create(pButton->uX, pButton->uY, 0, 0, WINDOW_PressedButton, (int)pButton, v0); 3038 GUIWindow::Create(pButton->uX, pButton->uY, 0, 0, WINDOW_PressedButton, (int)pButton, 1);
3039 continue; 3039 continue;
3040 case UIMSG_SelectCharacter: 3040 case UIMSG_SelectCharacter:
3041 if ( pMessageQueue_50CBD0->uNumMessages ) 3041 if ( pMessageQueue_50CBD0->uNumMessages )
3042 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; 3042 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
3043 GameUI_OnPlayerPortraitLeftClick(uMessageParam); 3043 GameUI_OnPlayerPortraitLeftClick(uMessageParam);
3057 } 3057 }
3058 else 3058 else
3059 { 3059 {
3060 pNPCData4 = (NPCData *)((char *)pNPCData4 - 12); 3060 pNPCData4 = (NPCData *)((char *)pNPCData4 - 12);
3061 } 3061 }
3062 if ( pParty->uCurrentHour < 0xC || (uNumSeconds = v0, pParty->uCurrentHour >= 0x18) ) 3062 if ( pParty->uCurrentHour < 0xC || (uNumSeconds = 1, pParty->uCurrentHour >= 0x18) )
3063 uNumSeconds = 0; 3063 uNumSeconds = 0;
3064 sprintf(pTmpBuf, "%d:%02d%s %s %d %s %d", pNPCData4, pParty->uCurrentMinute, aAMPMNames[uNumSeconds], aDayNames[pParty->uDaysPlayed % 7], 3064 sprintf(pTmpBuf, "%d:%02d%s %s %d %s %d", pNPCData4, pParty->uCurrentMinute, aAMPMNames[uNumSeconds], aDayNames[pParty->uDaysPlayed % 7],
3065 7 * pParty->uCurrentMonthWeek + pParty->uDaysPlayed % 7 + 1, aMonthNames[pParty->uCurrentMonth], pParty->uCurrentYear); 3065 7 * pParty->uCurrentMonthWeek + pParty->uDaysPlayed % 7 + 1, aMonthNames[pParty->uCurrentMonth], pParty->uCurrentYear);
3066 sub_41C0B8_set_status_string(pTmpBuf); 3066 sub_41C0B8_set_status_string(pTmpBuf);
3067 continue; 3067 continue;
3125 }*/ 3125 }*/
3126 continue; 3126 continue;
3127 } 3127 }
3128 if ( pMessageQueue_50CBD0->pMessages[0].field_8 ) 3128 if ( pMessageQueue_50CBD0->pMessages[0].field_8 )
3129 { 3129 {
3130 pMessageQueue_50CBD0->uNumMessages = v0; 3130 pMessageQueue_50CBD0->uNumMessages = 1;
3131 pMessageQueue_50CBD0->AddMessage(UIMSG_E, 0, 0); 3131 pMessageQueue_50CBD0->AddMessage(UIMSG_E, 0, 0);
3132 /*v115 = v0; 3132 /*v115 = v0;
3133 pMessageQueue_50CBD0->uNumMessages = v0; 3133 pMessageQueue_50CBD0->uNumMessages = v0;
3134 pMessageQueue_50CBD0->pMessages[v115].eType = (UIMessageType)14; 3134 pMessageQueue_50CBD0->pMessages[v115].eType = (UIMessageType)14;
3135 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; 3135 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0;
3433 case UIMSG_PlayerCreationClickOK: 3433 case UIMSG_PlayerCreationClickOK:
3434 GUIWindow::Create(580, 431, 0, 0, WINDOW_PressedButton2, (int)pPlayerCreationUI_BtnOK, 0); 3434 GUIWindow::Create(580, 431, 0, 0, WINDOW_PressedButton2, (int)pPlayerCreationUI_BtnOK, 0);
3435 if ( PlayerCreation_ComputeAttributeBonus() || !PlayerCreation_Chose4Skills() ) 3435 if ( PlayerCreation_ComputeAttributeBonus() || !PlayerCreation_Chose4Skills() )
3436 GameUI_Footer_TimeLeft = GetTickCount() + 4000; 3436 GameUI_Footer_TimeLeft = GetTickCount() + 4000;
3437 else 3437 else
3438 uGameState = 6; 3438 uGameState = GAME_STATE_6;
3439 break; 3439 break;
3440 case UIMSG_PlayerCreationClickReset: 3440 case UIMSG_PlayerCreationClickReset:
3441 GUIWindow::Create(527, 431, 0, 0, WINDOW_PressedButton2, (int)pPlayerCreationUI_BtnReset, 0); 3441 GUIWindow::Create(527, 431, 0, 0, WINDOW_PressedButton2, (int)pPlayerCreationUI_BtnReset, 0);
3442 pParty->Reset(); 3442 pParty->Reset();
3443 break; 3443 break;
3457 uPlayerCreationUI_SelectedCharacter = pParam; 3457 uPlayerCreationUI_SelectedCharacter = pParam;
3458 pKeyActionMap->EnterText(0, 15, pGUIWindow_CurrentMenu); 3458 pKeyActionMap->EnterText(0, 15, pGUIWindow_CurrentMenu);
3459 pGUIWindow_CurrentMenu->ptr_1C = v3; 3459 pGUIWindow_CurrentMenu->ptr_1C = v3;
3460 break; 3460 break;
3461 case UIMSG_ChangeGameState: 3461 case UIMSG_ChangeGameState:
3462 uGameState = 1; 3462 uGameState = GAME_FINISHED;
3463 break; 3463 break;
3464 case UIMSG_11: 3464 case UIMSG_11:
3465 pMouse->SetCursorBitmap("MICON2"); 3465 pMouse->SetCursorBitmap("MICON2");
3466 break; 3466 break;
3467 case UIMSG_3A: 3467 case UIMSG_3A: