comparison mm7_5.cpp @ 956:e9292c58644a

Слияние
author Ritor1
date Thu, 02 May 2013 11:03:26 +0600
parents 21cc2b274220 c0d0656aa662
children f8dd764fb7d7
comparison
equal deleted inserted replaced
955:21cc2b274220 956:e9292c58644a
30 #include "Time.h" 30 #include "Time.h"
31 #include "IconFrameTable.h" 31 #include "IconFrameTable.h"
32 #include "Awards.h" 32 #include "Awards.h"
33 #include "Autonotes.h" 33 #include "Autonotes.h"
34 #include "stru160.h" 34 #include "stru160.h"
35 #include "stru279.h"
36 #include "TurnEngine.h" 35 #include "TurnEngine.h"
37 #include "stru277.h" 36 #include "CastSpellInfo.h"
38 #include "Weather.h" 37 #include "Weather.h"
39 #include "stru272.h"
40 #include "stru298.h" 38 #include "stru298.h"
41 #include "StorylineTextTable.h" 39 #include "StorylineTextTable.h"
42 #include "Events2D.h" 40 #include "Events2D.h"
43 #include "texts.h" 41 #include "texts.h"
44 #include "Log.h" 42 #include "Log.h"
529 if ( pMessageQueue_50CBD0->uNumMessages ) 527 if ( pMessageQueue_50CBD0->uNumMessages )
530 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; 528 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
531 pGUIWindow_CurrentMenu->Release(); 529 pGUIWindow_CurrentMenu->Release();
532 viewparams->field_48 = v0; 530 viewparams->field_48 = v0;
533 pCurrentScreen = SCREEN_OPTIONS; 531 pCurrentScreen = SCREEN_OPTIONS;
534 uTextureID_ControlBG[0] = pIcons_LOD->LoadTexture("ControlBG", TEXTURE_16BIT_PALETTE); 532
535 uTextureID_ControlBG[3] = pIcons_LOD->LoadTexture("con_16x", TEXTURE_16BIT_PALETTE); 533 options_menu_skin.uTextureID_Background = pIcons_LOD->LoadTexture("ControlBG", TEXTURE_16BIT_PALETTE);
536 uTextureID_ControlBG[2] = pIcons_LOD->LoadTexture("con_32x", TEXTURE_16BIT_PALETTE); 534 options_menu_skin.uTextureID_TurnSpeed[2] = pIcons_LOD->LoadTexture("con_16x", TEXTURE_16BIT_PALETTE);
537 uTextureID_ControlBG[4] = pIcons_LOD->LoadTexture("con_ArrL", TEXTURE_16BIT_PALETTE); 535 options_menu_skin.uTextureID_TurnSpeed[1] = pIcons_LOD->LoadTexture("con_32x", TEXTURE_16BIT_PALETTE);
538 uTextureID_ControlBG[5] = pIcons_LOD->LoadTexture("con_ArrR", TEXTURE_16BIT_PALETTE); 536 options_menu_skin.uTextureID_TurnSpeed[0] = pIcons_LOD->LoadTexture("con_Smoo", TEXTURE_16BIT_PALETTE);
539 uTextureID_ControlBG[1] = pIcons_LOD->LoadTexture("con_Smoo", TEXTURE_16BIT_PALETTE); 537 options_menu_skin.uTextureID_ArrowLeft = pIcons_LOD->LoadTexture("con_ArrL", TEXTURE_16BIT_PALETTE);
540 uTextureID_ControlBG[19] = pIcons_LOD->LoadTexture("convol00", TEXTURE_16BIT_PALETTE); 538 options_menu_skin.uTextureID_ArrowRight = pIcons_LOD->LoadTexture("con_ArrR", TEXTURE_16BIT_PALETTE);
541 uTextureID_ControlBG[10] = pIcons_LOD->LoadTexture("convol10", TEXTURE_16BIT_PALETTE); 539 options_menu_skin.uTextureID_SoundLevels[0] = pIcons_LOD->LoadTexture("convol10", TEXTURE_16BIT_PALETTE);
542 uTextureID_ControlBG[11] = pIcons_LOD->LoadTexture("convol20", TEXTURE_16BIT_PALETTE); 540 options_menu_skin.uTextureID_SoundLevels[1] = pIcons_LOD->LoadTexture("convol20", TEXTURE_16BIT_PALETTE);
543 uTextureID_ControlBG[12] = pIcons_LOD->LoadTexture("convol30", TEXTURE_16BIT_PALETTE); 541 options_menu_skin.uTextureID_SoundLevels[2] = pIcons_LOD->LoadTexture("convol30", TEXTURE_16BIT_PALETTE);
544 uTextureID_ControlBG[13] = pIcons_LOD->LoadTexture("convol40", TEXTURE_16BIT_PALETTE); 542 options_menu_skin.uTextureID_SoundLevels[3] = pIcons_LOD->LoadTexture("convol40", TEXTURE_16BIT_PALETTE);
545 uTextureID_ControlBG[14] = pIcons_LOD->LoadTexture("convol50", TEXTURE_16BIT_PALETTE); 543 options_menu_skin.uTextureID_SoundLevels[4] = pIcons_LOD->LoadTexture("convol50", TEXTURE_16BIT_PALETTE);
546 uTextureID_ControlBG[15] = pIcons_LOD->LoadTexture("convol60", TEXTURE_16BIT_PALETTE); 544 options_menu_skin.uTextureID_SoundLevels[5] = pIcons_LOD->LoadTexture("convol60", TEXTURE_16BIT_PALETTE);
547 uTextureID_ControlBG[16] = pIcons_LOD->LoadTexture("convol70", TEXTURE_16BIT_PALETTE); 545 options_menu_skin.uTextureID_SoundLevels[6] = pIcons_LOD->LoadTexture("convol70", TEXTURE_16BIT_PALETTE);
548 uTextureID_ControlBG[17] = pIcons_LOD->LoadTexture("convol80", TEXTURE_16BIT_PALETTE); 546 options_menu_skin.uTextureID_SoundLevels[7] = pIcons_LOD->LoadTexture("convol80", TEXTURE_16BIT_PALETTE);
549 uTextureID_ControlBG[18] = pIcons_LOD->LoadTexture("convol90", TEXTURE_16BIT_PALETTE); 547 options_menu_skin.uTextureID_SoundLevels[8] = pIcons_LOD->LoadTexture("convol90", TEXTURE_16BIT_PALETTE);
550 uTextureID_ControlBG[9] = pIcons_LOD->LoadTexture("option04", TEXTURE_16BIT_PALETTE); 548 options_menu_skin.uTextureID_SoundLevels[9] = pIcons_LOD->LoadTexture("convol00", TEXTURE_16BIT_PALETTE);
551 uTextureID_ControlBG[20] = pIcons_LOD->LoadTexture("option03", TEXTURE_16BIT_PALETTE); 549 options_menu_skin.uTextureID_FlipOnExit = pIcons_LOD->LoadTexture("option04", TEXTURE_16BIT_PALETTE);
552 uTextureID_ControlBG[22] = pIcons_LOD->LoadTexture("option02", TEXTURE_16BIT_PALETTE); 550 options_menu_skin.uTextureID_AlwaysRun = pIcons_LOD->LoadTexture("option03", TEXTURE_16BIT_PALETTE);
553 uTextureID_ControlBG[21] = pIcons_LOD->LoadTexture("option01", TEXTURE_16BIT_PALETTE); 551 options_menu_skin.uTextureID_ShowDamage = pIcons_LOD->LoadTexture("option02", TEXTURE_16BIT_PALETTE);
552 options_menu_skin.uTextureID_WalkSound = pIcons_LOD->LoadTexture("option01", TEXTURE_16BIT_PALETTE);
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(uTextureID_ControlBG[3])->uTextureWidth, 556 pIcons_LOD->GetTexture(options_menu_skin.uTextureID_TurnSpeed[2])->uTextureWidth,
557 pIcons_LOD->GetTexture(uTextureID_ControlBG[3])->uTextureHeight, 557 pIcons_LOD->GetTexture(options_menu_skin.uTextureID_TurnSpeed[2])->uTextureHeight,
558 v0, 0, 558 v0, 0, UIMSG_SetTurnSpeed, 0x80, 0, v1, 0);
559 UIMSG_SetTurnSpeed, 0x80, 559 pGUIWindow_CurrentMenu->CreateButton(93, 270,
560 0, v1, 0); 560 pIcons_LOD->GetTexture(options_menu_skin.uTextureID_TurnSpeed[1])->uTextureWidth,
561 pGUIWindow_CurrentMenu->CreateButton(0x5Du, 270, 561 pIcons_LOD->GetTexture(options_menu_skin.uTextureID_TurnSpeed[1])->uTextureHeight,
562 pIcons_LOD->GetTexture(uTextureID_ControlBG[2])->uTextureWidth,
563 pIcons_LOD->GetTexture(uTextureID_ControlBG[2])->uTextureHeight,
564 v0, 0, UIMSG_SetTurnSpeed, 0x40u, 0, v1, 0); 562 v0, 0, UIMSG_SetTurnSpeed, 0x40u, 0, v1, 0);
565 pGUIWindow_CurrentMenu->CreateButton(0xA4u, 270, 563 pGUIWindow_CurrentMenu->CreateButton(164, 270,
566 pIcons_LOD->GetTexture(uTextureID_ControlBG[1])->uTextureWidth, 564 pIcons_LOD->GetTexture(options_menu_skin.uTextureID_TurnSpeed[0])->uTextureWidth,
567 pIcons_LOD->GetTexture(uTextureID_ControlBG[1])->uTextureHeight, 565 pIcons_LOD->GetTexture(options_menu_skin.uTextureID_TurnSpeed[0])->uTextureHeight,
568 v0, 0, UIMSG_SetTurnSpeed, 0, 0, v1, 0); 566 v0, 0, UIMSG_SetTurnSpeed, 0, 0, v1, 0);
569 pGUIWindow_CurrentMenu->CreateButton(0x14u, 0x12Fu, 567
570 pIcons_LOD->GetTexture(uTextureID_ControlBG[21])->uTextureWidth, 568 pGUIWindow_CurrentMenu->CreateButton(20, 303,
571 pIcons_LOD->GetTexture(uTextureID_ControlBG[21])->uTextureHeight, 569 pIcons_LOD->GetTexture(options_menu_skin.uTextureID_WalkSound)->uTextureWidth,
570 pIcons_LOD->GetTexture(options_menu_skin.uTextureID_WalkSound)->uTextureHeight,
572 v0, 0, UIMSG_ToggleWalkSound, 0, 0, v1, 0); 571 v0, 0, UIMSG_ToggleWalkSound, 0, 0, v1, 0);
573 pGUIWindow_CurrentMenu->CreateButton(0x80u, 0x12Fu, 572 pGUIWindow_CurrentMenu->CreateButton(128, 303,
574 (uTextureID_ControlBG[22] != -1 ? pIcons_LOD->pTextures[uTextureID_ControlBG[22]].uTextureWidth : 24), 573 pIcons_LOD->GetTexture(options_menu_skin.uTextureID_ShowDamage)->uTextureWidth,
575 (uTextureID_ControlBG[22] != -1 ? pIcons_LOD->pTextures[uTextureID_ControlBG[22]].uTextureHeight : 26), 574 pIcons_LOD->GetTexture(options_menu_skin.uTextureID_ShowDamage)->uTextureHeight,
576 v0, 0, UIMSG_ToggleShowDamage, 0, 0, v1, 0); 575 v0, 0, UIMSG_ToggleShowDamage, 0, 0, v1, 0);
577 pGUIWindow_CurrentMenu->CreateButton(0x14u, 0x145u, 576 pGUIWindow_CurrentMenu->CreateButton(20, 325,
578 (uTextureID_ControlBG[20] != -1 ? pIcons_LOD->pTextures[uTextureID_ControlBG[20]].uTextureWidth : 24), 577 pIcons_LOD->GetTexture(options_menu_skin.uTextureID_AlwaysRun)->uTextureWidth,
579 (uTextureID_ControlBG[20] != -1 ? pIcons_LOD->pTextures[uTextureID_ControlBG[20]].uTextureHeight : 26), 578 pIcons_LOD->GetTexture(options_menu_skin.uTextureID_AlwaysRun)->uTextureHeight,
580 v0, 0, UIMSG_ToggleAlwaysRun, 0, 0, v1, 0); 579 v0, 0, UIMSG_ToggleAlwaysRun, 0, 0, v1, 0);
581 pGUIWindow_CurrentMenu->CreateButton(0x80u, 0x145u, 580 pGUIWindow_CurrentMenu->CreateButton(128, 325,
582 (uTextureID_ControlBG[9] != -1 ? pIcons_LOD->pTextures[uTextureID_ControlBG[9]].uTextureWidth : 24), 581 pIcons_LOD->GetTexture(options_menu_skin.uTextureID_FlipOnExit)->uTextureWidth,
583 (uTextureID_ControlBG[9] != -1 ? pIcons_LOD->pTextures[uTextureID_ControlBG[9]].uTextureHeight : 26), 582 pIcons_LOD->GetTexture(options_menu_skin.uTextureID_FlipOnExit)->uTextureHeight,
584 v0, 0, UIMSG_ToggleFlipOnExit, 0, 0, v1, 0); 583 v0, 0, UIMSG_ToggleFlipOnExit, 0, 0, v1, 0);
585 pBtn_SliderLeft = pGUIWindow_CurrentMenu->CreateButton(243, 162, 16, 16, v0, 0, UIMSG_ChangeSoundVolume, 4, 0, v1, 584
586 &pIcons_LOD->pTextures[uTextureID_ControlBG[4]], 0); 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);
587 pBtn_SliderRight = pGUIWindow_CurrentMenu->CreateButton(0x1B3u, 0xA2u, 0x10u, 0x10u, v0, 0, UIMSG_ChangeSoundVolume, 5, 0, v1, 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);
588 &pIcons_LOD->pTextures[uTextureID_ControlBG[5]], 0); 587 pGUIWindow_CurrentMenu->CreateButton(263, 162, 172, 17, v0, 0, UIMSG_ChangeSoundVolume, 0, 0, v1, 0);
589 pGUIWindow_CurrentMenu->CreateButton(0x107u, 0xA2u, 0xACu, 0x11u, v0, 0, UIMSG_ChangeSoundVolume, 0, 0, v1, 0); 588
590 pBtn_SliderLeft = pGUIWindow_CurrentMenu->CreateButton(0xF3u, 0xD8u, 0x10u, 0x10u, v0, 0, UIMSG_ChangeMusicVolume, 4, 0, v1, 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);
591 &pIcons_LOD->pTextures[uTextureID_ControlBG[4]], 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);
592 pBtn_SliderRight = pGUIWindow_CurrentMenu->CreateButton(0x1B3u, 0xD8u, 0x10u, 0x10u, v0, 0, UIMSG_ChangeMusicVolume, 5, 0, v1, 591 pGUIWindow_CurrentMenu->CreateButton(263, 216, 172, 17, v0, 0, UIMSG_ChangeMusicVolume, 0, 0, v1, 0);
593 &pIcons_LOD->pTextures[uTextureID_ControlBG[5]], 0); 592
594 pGUIWindow_CurrentMenu->CreateButton(0x107u, 0xD8u, 0xACu, 0x11u, v0, 0, UIMSG_ChangeMusicVolume, 0, 0, v1, 0); 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);
595 pBtn_SliderLeft = pGUIWindow_CurrentMenu->CreateButton(0xF3u, 0x10Eu, 0x10u, 0x10u, v0, 0, UIMSG_ChangeVoiceVolume, 4, 0, v1, 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);
596 &pIcons_LOD->pTextures[uTextureID_ControlBG[4]], 0); 595 pGUIWindow_CurrentMenu->CreateButton(263, 270, 172, 17, v0, 0, UIMSG_ChangeVoiceVolume, 0, 0, v1, 0);
597 pBtn_SliderRight = pGUIWindow_CurrentMenu->CreateButton(0x1B3u, 0x10Eu, 0x10u, 0x10u, v0, 0, UIMSG_ChangeVoiceVolume, 5u, 0, v1, 596
598 &pIcons_LOD->pTextures[uTextureID_ControlBG[5]], 0); 597 pGUIWindow_CurrentMenu->CreateButton(241, 302, 214, 40, v0, 0, UIMSG_Escape, 0, 0, pGlobalTXT_LocalizationStrings[619], 0); // "Return to Game"
599 pGUIWindow_CurrentMenu->CreateButton(0x107u, 0x10Eu, 0xACu, 0x11u, v0, 0, UIMSG_ChangeVoiceVolume, 0, 0, v1, 0); 598 pGUIWindow_CurrentMenu->CreateButton( 19, 140, 214, 40, v0, 0, UIMSG_OpenKeyMappingOptions, 0, 0x4Bu, v1, 0);
600 pGUIWindow_CurrentMenu->CreateButton(0xF1u, 0x12Eu, 0xD6u, 0x28u, v0, 0, UIMSG_Escape, 0, 0, 599 pGUIWindow_CurrentMenu->CreateButton( 19, 194, 214, 40, v0, 0, UIMSG_OpenVideoOptions, 0, 86, v1, 0);
601 pGlobalTXT_LocalizationStrings[619],// "Return to Game"
602 0);
603 pGUIWindow_CurrentMenu->CreateButton(0x13u, 0x8Cu, 0xD6u, 0x28u, v0, 0, UIMSG_OpenKeyMappingOptions, 0, 0x4Bu, v1, 0);
604 pGUIWindow_CurrentMenu->CreateButton(19, 194, 214, 40, v0, 0, UIMSG_OpenVideoOptions, 0, 86, v1, 0);
605 continue; 600 continue;
601
606 case UIMSG_OpenKeyMappingOptions://Open 602 case UIMSG_OpenKeyMappingOptions://Open
607 if ( pMessageQueue_50CBD0->uNumMessages ) 603 if ( pMessageQueue_50CBD0->uNumMessages )
608 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; 604 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
609 pGUIWindow_CurrentMenu->Release(); 605 pGUIWindow_CurrentMenu->Release();
610 viewparams->field_48 = 1; 606 viewparams->field_48 = 1;
1126 pCurrentScreen = SCREEN_GAME; 1122 pCurrentScreen = SCREEN_GAME;
1127 viewparams->bRedrawGameUI = v0; 1123 viewparams->bRedrawGameUI = v0;
1128 pEventTimer->Resume(); 1124 pEventTimer->Resume();
1129 continue; 1125 continue;
1130 case SCREEN_OPTIONS://Close 1126 case SCREEN_OPTIONS://Close
1131 thisa = (signed int)&uTextureID_ControlBG; 1127 options_menu_skin.Relaease();
1132 do 1128
1133 {
1134 if ( *(int *)thisa )
1135 pIcons_LOD->pTextures[*(int *)thisa].Release();
1136 thisa += 4;
1137 }
1138 while ( thisa < (signed int)&dword_507CBC );
1139 memset(&uTextureID_ControlBG, 0, 0x5Cu);
1140 pIcons_LOD->_40F9C5(); 1129 pIcons_LOD->_40F9C5();
1141 WriteWindowsRegistryInt("soundflag", (char)uSoundVolumeMultiplier); 1130 WriteWindowsRegistryInt("soundflag", (char)uSoundVolumeMultiplier);
1142 WriteWindowsRegistryInt("musicflag", (char)uMusicVolimeMultiplier); 1131 WriteWindowsRegistryInt("musicflag", (char)uMusicVolimeMultiplier);
1143 WriteWindowsRegistryInt("CharVoices", (char)uVoicesVolumeMultiplier); 1132 WriteWindowsRegistryInt("CharVoices", (char)uVoicesVolumeMultiplier);
1144 WriteWindowsRegistryInt("WalkSound", bWalkSound); 1133 WriteWindowsRegistryInt("WalkSound", bWalkSound);
1655 } 1644 }
1656 else 1645 else
1657 { 1646 {
1658 pParty->field_6E4 = 0; 1647 pParty->field_6E4 = 0;
1659 pParty->field_6E0 = 0; 1648 pParty->field_6E0 = 0;
1660 pStru277->_427D48(v0); 1649 pCastSpellInfo->_427D48(v0);
1661 sub_44603D(); 1650 sub_44603D();
1662 pEventTimer->Pause(); 1651 pEventTimer->Pause();
1663 pGameLoadingUI_ProgressBar->Initialize(GUIProgressBar::TYPE_Box); 1652 pGameLoadingUI_ProgressBar->Initialize(GUIProgressBar::TYPE_Box);
1664 ++pGameLoadingUI_ProgressBar->uProgressMax; 1653 ++pGameLoadingUI_ProgressBar->uProgressMax;
1665 SaveGame(v0, 0); 1654 SaveGame(v0, 0);
3307 dword_50C9D4 = 0; 3296 dword_50C9D4 = 0;
3308 dword_50C9D8 = 0; 3297 dword_50C9D8 = 0;
3309 } 3298 }
3310 } 3299 }
3311 } 3300 }
3312 pStru277->_427E01_cast_spell(); 3301 pCastSpellInfo->_427E01_cast_spell();
3313 } 3302 }
3314 3303
3315 //----- (004356FF) -------------------------------------------------------- 3304 //----- (004356FF) --------------------------------------------------------
3316 void __cdecl back_to_game() 3305 void __cdecl back_to_game()
3317 { 3306 {
3460 continue; 3449 continue;
3461 3450
3462 case UIMSG_PlayerCreation_FacePrev: 3451 case UIMSG_PlayerCreation_FacePrev:
3463 { 3452 {
3464 pPlayer = &pParty->pPlayers[uNum]; 3453 pPlayer = &pParty->pPlayers[uNum];
3465 unsigned char v12 = (char)((int)pPlayer->uFace - 1) < 0; 3454 if (!pPlayer->uFace)
3466 --pPlayer->uFace;
3467 if ( v12 )
3468 pPlayer->uFace = 19; 3455 pPlayer->uFace = 19;
3456 else
3457 pPlayer->uFace -= 1;
3469 pPlayer->uVoiceID = pPlayer->uFace; 3458 pPlayer->uVoiceID = pPlayer->uFace;
3470 pPlayer->SetInitialStats(); 3459 pPlayer->SetInitialStats();
3471 pPlayer->SetSexByVoice(); 3460 pPlayer->SetSexByVoice();
3472 pPlayer->RandomizeName(); 3461 pPlayer->RandomizeName();
3473 v25 = uNum; 3462 v25 = uNum;
4593 //int v55; // [sp+40h] [bp-2Ch]@12 4582 //int v55; // [sp+40h] [bp-2Ch]@12
4594 signed int a4; // [sp+44h] [bp-28h]@1 4583 signed int a4; // [sp+44h] [bp-28h]@1
4595 PlayerEquipment *v57; // [sp+48h] [bp-24h]@10 4584 PlayerEquipment *v57; // [sp+48h] [bp-24h]@10
4596 //int v58; // [sp+4Ch] [bp-20h]@10 4585 //int v58; // [sp+4Ch] [bp-20h]@10
4597 int v59; // [sp+50h] [bp-1Ch]@1 4586 int v59; // [sp+50h] [bp-1Ch]@1
4598 //unsigned int uActorID_Monster_; // [sp+54h] [bp-18h]@1 4587 unsigned int uActorID_Monster_; // [sp+54h] [bp-18h]@1
4599 int v61; // [sp+58h] [bp-14h]@1 4588 int v61; // [sp+58h] [bp-14h]@1
4600 bool v62; // [sp+5Ch] [bp-10h]@1 4589 bool v62; // [sp+5Ch] [bp-10h]@1
4601 int uDamageAmount; // [sp+60h] [bp-Ch]@1 4590 int uDamageAmount; // [sp+60h] [bp-Ch]@1
4602 int a2; // [sp+64h] [bp-8h]@27 4591 int a2; // [sp+64h] [bp-8h]@27
4603 int a3; // [sp+6Bh] [bp-1h]@6 4592 int a3; // [sp+6Bh] [bp-1h]@6
4604 4593
4605 //v3 = a1; 4594 //v3 = a1;
4606 v4 = 0; 4595 v4 = 0;
4607 //uActorID_Monster_ = uActorID_Monster; 4596 uActorID_Monster_ = uActorID_Monster;
4608 //v54 = a1; 4597 //v54 = a1;
4609 uDamageAmount = 0; 4598 uDamageAmount = 0;
4610 a4 = 0; 4599 a4 = 0;
4611 v61 = 0; 4600 v61 = 0;
4612 v59 = 0; 4601 v59 = 0;
4624 if (PID_TYPE(a1) != OBJECT_Player) 4613 if (PID_TYPE(a1) != OBJECT_Player)
4625 return; 4614 return;
4626 4615
4627 assert(PID_ID(abs(a1)) < 4); 4616 assert(PID_ID(abs(a1)) < 4);
4628 auto player = &pParty->pPlayers[PID_ID(a1)]; 4617 auto player = &pParty->pPlayers[PID_ID(a1)];
4629 pMonster = &pActors[uActorID_Monster]; 4618 pMonster = &pActors[uActorID_Monster_];
4630 //uPlayerID = pMonster->IsAlive(); 4619 //uPlayerID = pMonster->IsAlive();
4631 if (pMonster->IsNotAlive()) 4620 if (pMonster->IsNotAlive())
4632 return; 4621 return;
4633 4622
4634 BYTE1(pMonster->uAttributes) |= 0xC0u; 4623 BYTE1(pMonster->uAttributes) |= 0xC0u;
4673 hit_will_paralyze = true; 4662 hit_will_paralyze = true;
4674 } 4663 }
4675 break; 4664 break;
4676 } 4665 }
4677 } 4666 }
4678 //v50 = pMonster->pMonsterInfo.uID; 4667 v50 = pMonster->pMonsterInfo.uID;
4679 a2 = 4; 4668 a2 = 4;
4680 //v27 = player->CalculateMeleeDamageTo(0, 0, v50); 4669 //v27 = player->CalculateMeleeDamageTo(0, 0, v50);
4681 uDamageAmount = player->CalculateMeleeDamageTo(0, 0, pMonster->pMonsterInfo.uID); 4670 uDamageAmount = player->CalculateMeleeDamageTo(0, 0, v50);
4682 //if ( !v57 ) 4671 //if ( !v57 )
4683 goto LABEL_67; 4672 goto LABEL_67;
4684 //goto LABEL_69; 4673 //goto LABEL_69;
4685 } 4674 }
4686 4675
4687 4676
4688 v19 = v4->spell_id == SPELL_DARK_SOULDRINKER; 4677 v19 = v4->spell_id == SPELL_DARK_SOULDRINKER;
4689 v61 = v4->field_60_distance_related_prolly_lod; 4678 v61 = v4->field_60_distance_related_prolly_lod;
4690 if ( !v19 ) 4679 if ( !v19 )
4691 { 4680 {
4692 //v9 = v4; 4681 //v9 = (SpriteObject *)uDamageAmount;
4693 v50 = pParty->vPosition.x - v4->vPosition.x; 4682 v50 = pParty->vPosition.x - v4->vPosition.x;
4694 //v55 = abs(v50); 4683 //v55 = abs(v50);
4695 pMonsterName = (char *)(pParty->vPosition.y - v4->vPosition.y); 4684 pMonsterName = (char *)(pParty->vPosition.y - v4->vPosition.y);
4696 //v51 = (unsigned __int64 *)abs((int)pMonsterName); 4685 //v51 = (unsigned __int64 *)abs((int)pMonsterName);
4697 pPlayerName = (char *)(pParty->vPosition.z - v4->vPosition.z); 4686 pPlayerName = (char *)(pParty->vPosition.z - v4->vPosition.z);
4880 player->PlaySound(SPEECH_52, 0); 4869 player->PlaySound(SPEECH_52, 0);
4881 return; 4870 return;
4882 } 4871 }
4883 if ( pMonster->sCurrentHP > 0 ) 4872 if ( pMonster->sCurrentHP > 0 )
4884 { 4873 {
4885 Actor::Stun(uActorID_Monster, a1, 0); 4874 Actor::Stun(uActorID_Monster_, a1, 0);
4886 Actor::AggroSurroundingPeasants(uActorID_Monster, 1); 4875 Actor::AggroSurroundingPeasants(uActorID_Monster_, 1);
4887 if ( bShowDamage ) 4876 if ( bShowDamage )
4888 { 4877 {
4889 v50 = uDamageAmount; 4878 v50 = uDamageAmount;
4890 pMonsterName = (char *)pMonster; 4879 pMonsterName = (char *)pMonster;
4891 pPlayerName = player->pName; 4880 pPlayerName = player->pName;
4925 v39 = (double)(signed int)pMonster->vPosition.x; 4914 v39 = (double)(signed int)pMonster->vPosition.x;
4926 pDecalBuilder->AddBloodsplat(v39, v38, v37, 1.0, 0.0, 0.0, *(float *)&pPlayerName, 0, 0); 4915 pDecalBuilder->AddBloodsplat(v39, v38, v37, 1.0, 0.0, 0.0, *(float *)&pPlayerName, 0, 0);
4927 } 4916 }
4928 } 4917 }
4929 } 4918 }
4930 Actor::Die(uActorID_Monster); 4919 Actor::Die(uActorID_Monster_);
4931 Actor::ApplyFineForKillingPeasant(uActorID_Monster); 4920 Actor::ApplyFineForKillingPeasant(uActorID_Monster_);
4932 Actor::AggroSurroundingPeasants(uActorID_Monster, 1); 4921 Actor::AggroSurroundingPeasants(uActorID_Monster_, 1);
4933 if ( pMonster->pMonsterInfo.uExp ) 4922 if ( pMonster->pMonsterInfo.uExp )
4934 GivePartyExp(pMonsterStats->pInfos[pMonster->pMonsterInfo.uID].uExp); 4923 GivePartyExp(pMonsterStats->pInfos[pMonster->pMonsterInfo.uID].uExp);
4935 v40 = SPEECH_51; 4924 v40 = SPEECH_51;
4936 if ( rand() % 100 < 20 ) 4925 if ( rand() % 100 < 20 )
4937 v40 = ((signed int)pMonster->pMonsterInfo.uHP >= 100) + 1; 4926 v40 = ((signed int)pMonster->pMonsterInfo.uHP >= 100) + 1;
5000 pVelocity->z = (unsigned __int64)(v59 * (signed __int64)pVelocity->z) >> 16; 4989 pVelocity->z = (unsigned __int64)(v59 * (signed __int64)pVelocity->z) >> 16;
5001 pMonster->vVelocity.x = 50 * LOWORD(pVelocity->x); 4990 pMonster->vVelocity.x = 50 * LOWORD(pVelocity->x);
5002 pMonster->vVelocity.y = 50 * LOWORD(pVelocity->y); 4991 pMonster->vVelocity.y = 50 * LOWORD(pVelocity->y);
5003 pMonster->vVelocity.z = 50 * LOWORD(pVelocity->z); 4992 pMonster->vVelocity.z = 50 * LOWORD(pVelocity->z);
5004 } 4993 }
5005 Actor::AddBloodsplatOnDamageOverlay(uActorID_Monster, 1, v61); 4994 Actor::AddBloodsplatOnDamageOverlay(uActorID_Monster_, 1, v61);
5006 } 4995 }
5007 // 4D864C: using guessed type char byte_4D864C; 4996 // 4D864C: using guessed type char byte_4D864C;
5008 4997
5009 //----- (00439FCB) -------------------------------------------------------- 4998 //----- (00439FCB) --------------------------------------------------------
5010 void __fastcall DamagePlayerFromMonster(unsigned int uObjID, int a2, Vec3_int_ *pPos, unsigned int a4) 4999 void __fastcall DamagePlayerFromMonster(unsigned int uObjID, int a2, Vec3_int_ *pPos, unsigned int a4)
9317 v5 = 1; 9306 v5 = 1;
9318 } 9307 }
9319 return v5; 9308 return v5;
9320 } 9309 }
9321 9310
9322 //----- (00409BE8) --------------------------------------------------------
9323 void __cdecl sub_409BE8()
9324 {
9325 void *v0; // eax@1
9326 stru348 *v1; // eax@1
9327 int v2; // ecx@1
9328 int v3; // eax@1
9329
9330 v0 = window_SpeakInHouse->ptr_1C;
9331 dword_4E1874 = 5;
9332 v1 = &stru_4E1890[(int)((char *)v0 - 108)];
9333 amuint_4E1860 = v1->field_4;
9334 amuint_4E1864 = v1->field_6;
9335 amuint_4E1868 = v1->field_8 - 1;
9336 amuint_4E186C = v1->field_A - 1;
9337 amuint_4E1870 = v1->field_C - 1;
9338 amuint_505884 = v1->field_E;
9339 amuint_505888 = v1->field_10;
9340 amuint_50588C = v1->field_12;
9341 dword_4E1878 = 1;
9342 dword_4E187C = 1;
9343 dword_4E1880 = 1;
9344 dword_4E1884 = v1->field_0;
9345 v2 = v1->field_2;
9346 v3 = v1->field_14;
9347 dword_4E1888 = v2;
9348 dword_4DF3A4 = v3;
9349 }
9350 // 4DF3A4: using guessed type int dword_4DF3A4;
9351 // 4E1860: using guessed type int amuint_4E1860;
9352 // 4E1864: using guessed type int amuint_4E1864;
9353 // 4E1868: using guessed type int amuint_4E1868;
9354 // 4E186C: using guessed type int amuint_4E186C;
9355 // 4E1870: using guessed type int amuint_4E1870;
9356 // 4E1874: using guessed type int dword_4E1874;
9357 // 4E1878: using guessed type int dword_4E1878;
9358 // 4E187C: using guessed type int dword_4E187C;
9359 // 4E1880: using guessed type int dword_4E1880;
9360 // 4E1884: using guessed type int dword_4E1884;
9361 // 4E1888: using guessed type int dword_4E1888;
9362 // 505884: using guessed type int amuint_505884;
9363 // 505888: using guessed type int amuint_505888;
9364 // 50588C: using guessed type int amuint_50588C;
9365 9311
9366 //----- (0040D75D) -------------------------------------------------------- 9312 //----- (0040D75D) --------------------------------------------------------
9367 char __fastcall pPrimaryWindow_draws_text(int a1, const char *pText, int *pXY) 9313 char __fastcall pPrimaryWindow_draws_text(int a1, const char *pText, int *pXY)
9368 { 9314 {
9369 const char *v3; // ST0C_4@1 9315 const char *v3; // ST0C_4@1
9433 } 9379 }
9434 9380
9435 //----- (0040DEDB) -------------------------------------------------------- 9381 //----- (0040DEDB) --------------------------------------------------------
9436 unsigned int __stdcall R8G8B8_to_TargetFormat(int uColor) 9382 unsigned int __stdcall R8G8B8_to_TargetFormat(int uColor)
9437 { 9383 {
9438 return GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat((unsigned __int8)uColor, BYTE1(uColor), BYTE2(uColor)); 9384 return TargetColor((unsigned __int8)uColor, BYTE1(uColor), BYTE2(uColor));
9439 } 9385 }
9440 9386
9441 //----- (0040DEF3) -------------------------------------------------------- 9387 //----- (0040DEF3) --------------------------------------------------------
9442 unsigned short GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat( unsigned __int16 r, unsigned __int16 g, unsigned __int16 b ) 9388 unsigned short TargetColor( unsigned __int16 r, unsigned __int16 g, unsigned __int16 b )
9443 { 9389 {
9444 return ((unsigned int)b >> (8 - LOBYTE(pRenderer->uTargetBBits))) | pRenderer->uTargetGMask & (g << (LOBYTE(pRenderer->uTargetGBits) + 9390 return ((unsigned int)b >> (8 - LOBYTE(pRenderer->uTargetBBits))) | pRenderer->uTargetGMask & (g << (LOBYTE(pRenderer->uTargetGBits) +
9445 LOBYTE(pRenderer->uTargetBBits) - 8)) | pRenderer->uTargetRMask & (r << (LOBYTE(pRenderer->uTargetGBits) + 9391 LOBYTE(pRenderer->uTargetBBits) - 8)) | pRenderer->uTargetRMask & (r << (LOBYTE(pRenderer->uTargetGBits) +
9446 LOBYTE(pRenderer->uTargetRBits) + LOBYTE(pRenderer->uTargetBBits) - 8)); 9392 LOBYTE(pRenderer->uTargetRBits) + LOBYTE(pRenderer->uTargetBBits) - 8));
9447 } 9393 }
10202 int v7; // [sp+64h] [bp-8h]@1 10148 int v7; // [sp+64h] [bp-8h]@1
10203 int a5; // [sp+68h] [bp-4h]@1 10149 int a5; // [sp+68h] [bp-4h]@1
10204 10150
10205 v0 = pParty->uCurrentHour; 10151 v0 = pParty->uCurrentHour;
10206 v6 = pMapStats->GetMapInfo(pCurrentMapName); 10152 v6 = pMapStats->GetMapInfo(pCurrentMapName);
10207 a5 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0x4Bu, 0x4Bu, 0x4Bu); 10153 a5 = TargetColor(0x4Bu, 0x4Bu, 0x4Bu);
10208 pRenderer->DrawTextureIndexed(pViewport->uViewportTL_X, pViewport->uViewportTL_Y, pSpellBookPagesTextr_13); 10154 pRenderer->DrawTextureIndexed(pViewport->uViewportTL_X, pViewport->uViewportTL_Y, pSpellBookPagesTextr_13);
10209 v7 = (unsigned __int8)pDayMoonPhase[pParty->uDaysPlayed]; 10155 v7 = (unsigned __int8)pDayMoonPhase[pParty->uDaysPlayed];
10210 if ( (signed int)v0 <= 12 ) 10156 if ( (signed int)v0 <= 12 )
10211 { 10157 {
10212 if ( !v0 ) 10158 if ( !v0 )
10324 } 10270 }
10325 10271
10326 //----- (00414162) -------------------------------------------------------- 10272 //----- (00414162) --------------------------------------------------------
10327 void __cdecl uGameUIFontMain_initialize() 10273 void __cdecl uGameUIFontMain_initialize()
10328 { 10274 {
10329 uGameUIFontMain = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xAu, 0, 0); 10275 uGameUIFontMain = TargetColor(0xAu, 0, 0);
10330 } 10276 }
10331 10277
10332 //----- (00414174) -------------------------------------------------------- 10278 //----- (00414174) --------------------------------------------------------
10333 void __cdecl uGameUIFontShadow_initialize() 10279 void __cdecl uGameUIFontShadow_initialize()
10334 { 10280 {
10335 uGameUIFontShadow = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xE6u, 214u, 193u); 10281 uGameUIFontShadow = TargetColor(0xE6u, 214u, 193u);
10336 } 10282 }
10337 10283
10338 10284
10339 10285
10340 10286
10529 DrawGameOptions(); 10475 DrawGameOptions();
10530 break; 10476 break;
10531 } 10477 }
10532 case WINDOW_Book: 10478 case WINDOW_Book:
10533 { 10479 {
10534 SellectDrawBook((unsigned int)pWindow->ptr_1C); 10480 DrawCurrentBook((unsigned int)pWindow->ptr_1C);
10535 break; 10481 break;
10536 } 10482 }
10537 case WINDOW_QuickReference: 10483 case WINDOW_QuickReference:
10538 { 10484 {
10539 QuickRefDraw(); 10485 QuickRefDraw();
11282 { 11228 {
11283 v12 = v6->pName; 11229 v12 = v6->pName;
11284 v11 = pTmpBuf; 11230 v11 = pTmpBuf;
11285 strcpy(pTmpBuf, v12); 11231 strcpy(pTmpBuf, v12);
11286 } 11232 }
11287 v13 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu); 11233 v13 = TargetColor(0xFFu, 0xFFu, 0x9Bu);
11288 a1.DrawTitleText(pFontArrus, 0, 0xCu, v13, v11, 3u); 11234 a1.DrawTitleText(pFontArrus, 0, 0xCu, v13, v11, 3u);
11289 a1.uFrameWidth -= 24; 11235 a1.uFrameWidth -= 24;
11290 a1.uFrameZ = a1.uFrameX + a1.uFrameWidth - 1; 11236 a1.uFrameZ = a1.uFrameX + a1.uFrameWidth - 1;
11291 v14 = BuilDialogueString((char *)lpsz, uActiveCharacter - 1, 0, 0, 0, 0); 11237 v14 = BuilDialogueString((char *)lpsz, uActiveCharacter - 1, 0, 0, 0, 0);
11292 a1.DrawText(pFontArrus, 100, 36, 0, v14, 0, 0, 0); 11238 a1.DrawText(pFontArrus, 100, 36, 0, v14, 0, 0, 0);
11503 { 11449 {
11504 v6 = 0; 11450 v6 = 0;
11505 v2 = 255; 11451 v2 = 255;
11506 v3 = 0; 11452 v3 = 0;
11507 } 11453 }
11508 return GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(v3, v2, v6); 11454 return TargetColor(v3, v2, v6);
11509 } 11455 }
11510 11456
11511 //----- (00417939) -------------------------------------------------------- 11457 //----- (00417939) --------------------------------------------------------
11512 signed int __thiscall GetConditionDrawColor(unsigned int uConditionIdx) 11458 signed int __thiscall GetConditionDrawColor(unsigned int uConditionIdx)
11513 { 11459 {
11517 unsigned int v4; // eax@1 11463 unsigned int v4; // eax@1
11518 unsigned int v6; // [sp+Ch] [bp-4h]@1 11464 unsigned int v6; // [sp+Ch] [bp-4h]@1
11519 11465
11520 v1 = uConditionIdx; 11466 v1 = uConditionIdx;
11521 v2 = 65535; 11467 v2 = 65535;
11522 v3 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xE1u, 0xCDu, 0x23u); 11468 v3 = TargetColor(0xE1u, 0xCDu, 0x23u);
11523 v6 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0x23u, 0); 11469 v6 = TargetColor(0xFFu, 0x23u, 0);
11524 v4 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0, 0xFFu, 0); 11470 v4 = TargetColor(0, 0xFFu, 0);
11525 switch ( v1 ) 11471 switch ( v1 )
11526 { 11472 {
11527 case 0u: 11473 case 0u:
11528 case 1u: 11474 case 1u:
11529 case 3u: 11475 case 3u:
11577 Dst.uFrameWidth -= 24; 11523 Dst.uFrameWidth -= 24;
11578 Dst.uFrameY += 12; 11524 Dst.uFrameY += 12;
11579 Dst.uFrameHeight -= 12; 11525 Dst.uFrameHeight -= 12;
11580 Dst.uFrameZ = Dst.uFrameX + Dst.uFrameWidth - 1; 11526 Dst.uFrameZ = Dst.uFrameX + Dst.uFrameWidth - 1;
11581 Dst.uFrameW = Dst.uFrameY + Dst.uFrameHeight - 1; 11527 Dst.uFrameW = Dst.uFrameY + Dst.uFrameHeight - 1;
11582 v4 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu); 11528 v4 = TargetColor(0xFFu, 0xFFu, 0x9Bu);
11583 sprintf(pTmpBuf, format_4E2D80, v4, v3); 11529 sprintf(pTmpBuf, format_4E2D80, v4, v3);
11584 Dst.DrawTitleText(pFontCreate, 0, 0, 0, pTmpBuf, 3u); 11530 Dst.DrawTitleText(pFontCreate, 0, 0, 0, pTmpBuf, 3u);
11585 return Dst.DrawText(pFontSmallnum, 1, LOBYTE(pFontLucida->uFontHeight), 0, v2, 0, 0, 0); 11531 return Dst.DrawText(pFontSmallnum, 1, LOBYTE(pFontLucida->uFontHeight), 0, v2, 0, 0, 0);
11586 } 11532 }
11587 11533
11592 int v12; // eax@14 11538 int v12; // eax@14
11593 unsigned int yellow; // [sp+Ch] [bp-Ch]@1 11539 unsigned int yellow; // [sp+Ch] [bp-Ch]@1
11594 unsigned int red; // [sp+10h] [bp-8h]@1 11540 unsigned int red; // [sp+10h] [bp-8h]@1
11595 unsigned int white; // [sp+14h] [bp-4h]@1 11541 unsigned int white; // [sp+14h] [bp-4h]@1
11596 11542
11597 white = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu); 11543 white = TargetColor(0xFFu, 0xFFu, 0xFFu);
11598 red = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0, 0); 11544 red = TargetColor(0xFFu, 0, 0);
11599 yellow = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0); 11545 yellow = TargetColor(0xFFu, 0xFFu, 0);
11600 if ( !(uPlayerClass % 4) ) 11546 if ( !(uPlayerClass % 4) )
11601 { 11547 {
11602 if ( byte_4ED970_skill_learn_ability_by_class_table[uPlayerClass][uPlayerSkillType] >= skill_level ) 11548 if ( byte_4ED970_skill_learn_ability_by_class_table[uPlayerClass][uPlayerSkillType] >= skill_level )
11603 return white; 11549 return white;
11604 if ( byte_4ED970_skill_learn_ability_by_class_table[uPlayerClass + 1][uPlayerSkillType] < skill_level 11550 if ( byte_4ED970_skill_learn_ability_by_class_table[uPlayerClass + 1][uPlayerSkillType] < skill_level