Mercurial > mm7
changeset 1048:d36681a9e4f8
Слияние
author | Ritor1 |
---|---|
date | Thu, 23 May 2013 11:17:01 +0600 |
parents | 76ce871b0076 (current diff) 0744f8665045 (diff) |
children | efe228ab5003 |
files | Player.cpp Vis.cpp mm7_1.cpp mm7_5.cpp |
diffstat | 45 files changed, 2858 insertions(+), 6607 deletions(-) [+] |
line wrap: on
line diff
--- a/Actor.cpp Thu May 23 11:16:46 2013 +0600 +++ b/Actor.cpp Thu May 23 11:17:01 2013 +0600 @@ -226,107 +226,6 @@ } } -//----- (00445D4A) -------------------------------------------------------- -void Actor::InitializeDialogue(int bPlayerSaysHello) -{ - NPCData *pNPCInfo; // ebp@1 - int v9; // esi@8 - int pNumberContacts; // eax@11 - char pContainer[32]; // [sp+14h] [bp-28h]@3 - - dword_A74CDC = -1; - dword_AE336C = -1; - pEventTimer->Pause(); - pMiscTimer->Pause(); - pAudioPlayer->StopChannels(-1, -1); - uDialogueType = 0; - sDialogue_SpeakingActorNPC_ID = this->sNPC_ID; - pDialogue_SpeakingActor = this; - pNPCInfo = GetNPCData(this->sNPC_ID); - if ( (pNPCInfo->uFlags & 3) != 2 ) - pNPCInfo->uFlags = pNPCInfo->uFlags + 1; - - switch (pParty->alignment) - { - case PartyAlignment_Good: sprintf(pContainer, "evt%02d-b", const_2()); break; - case PartyAlignment_Neutral: sprintf(pContainer, "evt%02d", const_2()); break; - case PartyAlignment_Evil: sprintf(pContainer, "evt%02d-c", const_2()); break; - } - - pDialogueNPCCount = 0; - uNumDialogueNPCPortraits = 1; - pTexture_Dialogue_Background = pIcons_LOD->LoadTexturePtr(pContainer, TEXTURE_16BIT_PALETTE); - sprintf(pContainer, "npc%03u", pNPCInfo->uPortraitID); - v9 = 0; - pDialogueNPCPortraits[0] = pIcons_LOD->LoadTexturePtr(pContainer, TEXTURE_16BIT_PALETTE); - dword_591084 = areWeLoadingTexture; - uTextureID_right_panel_loop = uTextureID_right_panel; - if ( !pNPCInfo->Hired() && pNPCInfo->Location2D >= 0 ) - { - if ( (signed int)pParty->GetPartyFame() <= pNPCInfo->fame - || (pNumberContacts = pNPCInfo->uFlags & 0xFFFFFF7F, (pNumberContacts & 0x80000000u) != 0) ) - { - v9 = 1; - } - else - { - if ( pNumberContacts > 1 ) - { - if ( pNumberContacts == 2 ) - { - v9 = 3; - } - else - { - if ( pNumberContacts != 3 ) - { - if ( pNumberContacts != 4 ) - v9 = 1; - } - else - { - v9 = 2; - } - } - } - else if ( pNPCInfo->rep ) - { - v9 = 2; - } - } - } - if ( (sDialogue_SpeakingActorNPC_ID & 0x80000000u) != 0 ) - v9 = 4; - pDialogueWindow = GUIWindow::Create(0, 0, 640, 480, WINDOW_Dialogue, v9, 0);//pNumberContacts = 1, v9 = 0; pNumberContacts = 2, v9 = 3; - if (pNPCInfo->Hired()) - { - if ( !pNPCInfo->bHasUsedTheAbility ) - { - if ( pNPCInfo->uProfession >= 10 ) - { - if ( pNPCInfo->uProfession <= 12 || pNPCInfo->uProfession > 32 && (pNPCInfo->uProfession <= 34 - || pNPCInfo->uProfession > 38 && (pNPCInfo->uProfession <= 43 || pNPCInfo->uProfession == 52)) ) - { - pDialogueWindow->CreateButton(480, 250, 140, LOBYTE(pFontArrus->uFontHeight) - 3, 1, 0, UIMSG_SelectNPCDialogueOption, 9, 0, "", 0); - pDialogueWindow->_41D08F_set_keyboard_control_group(4, 1, 0, 1); - } - } - } - } - - pDialogueWindow->CreateButton( 61, 424, 31, 40, 2, 94, UIMSG_SelectCharacter, 1, '1', "", 0); - pDialogueWindow->CreateButton(177, 424, 31, 40, 2, 94, UIMSG_SelectCharacter, 2, '2', "", 0); - pDialogueWindow->CreateButton(292, 424, 31, 40, 2, 94, UIMSG_SelectCharacter, 3, '3', "", 0); - pDialogueWindow->CreateButton(407, 424, 31, 40, 2, 94, UIMSG_SelectCharacter, 4, '4', "", 0); - - if (bPlayerSaysHello && uActiveCharacter && !pNPCInfo->Hired()) - { - if (pParty->uCurrentHour < 5 || pParty->uCurrentHour > 21) - pPlayers[uActiveCharacter]->PlaySound(SPEECH_GoodEvening, 0); - else - pPlayers[uActiveCharacter]->PlaySound(SPEECH_GoodDay, 0); - } -} //----- (0040894B) -------------------------------------------------------- bool Actor::CanAct() @@ -1093,11 +992,11 @@ do { v58 = (*v57)->GetActualWillpower(); - v59 = (*v57)->_48EA1B_get_static_effect(v58); + v59 = (*v57)->GetParameterBonus(v58); v60 = (*v57)->GetActualIntelligence(); - v61 = ((*v57)->_48EA1B_get_static_effect(v60) + v59) >> 1; + v61 = ((*v57)->GetParameterBonus(v60) + v59) >> 1; v62 = (*v57)->GetActualLuck(); - v63 = v61 + (*v57)->_48EA1B_get_static_effect(v62) + 30; + v63 = v61 + (*v57)->GetParameterBonus(v62) + 30; if ( rand() % v63 < 30 ) { v64 = 6048; @@ -3215,9 +3114,7 @@ if ( (signed __int64)v2->pActorBuffs[3].uExpireTime <= 0 ) { v12 = 0; - v11 = 0; - v10 = 0; - v9 = 0; + v8 = -1; } else @@ -3243,12 +3140,10 @@ v6 = 33075; } v12 = v6; - v11 = 0; - v10 = 0; - v9 = 0; + v8 = 0; } - pAudioPlayer->PlaySound((SoundID)(signed __int16)v3, PID(OBJECT_Actor, uActorID), 0, v8, v9, v10, v11, v12); + pAudioPlayer->PlaySound((SoundID)(signed __int16)v3, PID(OBJECT_Actor, uActorID), 0, v8, 0, 0, 0, v12); } }
--- a/Actor.h Thu May 23 11:16:46 2013 +0600 +++ b/Actor.h Thu May 23 11:17:01 2013 +0600 @@ -187,7 +187,6 @@ void SetRandomGoldIfTheresNoItem(); bool CanAct(); bool IsNotAlive(); - void InitializeDialogue(int bPlayerSaysHello); bool IsPeasant();
--- a/Arcomage.cpp Thu May 23 11:16:46 2013 +0600 +++ b/Arcomage.cpp Thu May 23 11:17:01 2013 +0600 @@ -1,4 +1,5 @@ #include <string> +#include <assert.h> #include "LightmapBuilder.h" #include "Arcomage.h" @@ -266,7 +267,7 @@ TranslateMessage(&pArcomageGame->msg); DispatchMessageA(&pArcomageGame->msg); } - if (pAsyncMouse) + /*if (pAsyncMouse) { EnterCriticalSection(&pGame->pThreadWardInstance->csAsyncMouse); v4 = *((unsigned int *)pAsyncMouse + 7); @@ -296,7 +297,7 @@ if ( !*((unsigned char *)pAsyncMouse + 90) ) pArcomageGame->field_F6 = 1; LeaveCriticalSection(&pGame->pThreadWardInstance->csAsyncMouse); - } + }*/ memcpy(v2, &pArcomageGame->stru1, 0xCu); return pArcomageGame->stru1.field_0 != 0; } @@ -1422,11 +1423,7 @@ ++v3; } while ( (signed int)v3 < (signed int)&unk_5052C8 ); - if (pAsyncMouse) - { - pAsyncMouse->_409E3D(*((unsigned char *)pAsyncMouse + 103)); - pAsyncMouse->_46B944(); - } + pArcomageGame->pGameBackground.Release(); pArcomageGame->pSprites.Release(); pArcomageGame->bGameInProgress = 0; @@ -2038,7 +2035,8 @@ { //nullsub_1(); //nullsub_1(); - inv_strcpy(pAreYouSureWishToLeave, Dest); + assert(false && "Invalid strcpy params"); + inv_strcpy(nullptr, Dest); v5 = 0;//unk::const_0(&unk_4E19FC, 0); //nullsub_1(); if ( v5 == 1 ) @@ -5752,8 +5750,6 @@ int pXY[2]; // [sp+18h] [bp-Ch]@5 int v10; // [sp+20h] [bp-4h]@3 - if (pAsyncMouse) - pAsyncMouse->_409E3D(1); pAudioPlayer->StopChannels(-1, -1); strcpy(pArcomageGame->pPlayer1Name, pArcomagePlayer1Name); strcpy(pArcomageGame->pPlayer2Name, pArcomagePlayer2Name);
--- a/Bink_Smacker.h Thu May 23 11:16:46 2013 +0600 +++ b/Bink_Smacker.h Thu May 23 11:17:01 2013 +0600 @@ -144,6 +144,13 @@ HDC lastdc; }; +#define SMACKBUFFER555 0x80000000 +#define SMACKBUFFER565 0xC0000000 + +#define SMACKBLIT1X 1 +#define SMACKBLIT2X 2 +#define SMACKBLIT2XSMOOTHING 4 +#define SMACKBLIT2XINTERLACE 8 int __stdcall SmackSoundUseMSS(HDIGDRIVER hDrv);
--- a/CShow.cpp Thu May 23 11:16:46 2013 +0600 +++ b/CShow.cpp Thu May 23 11:17:01 2013 +0600 @@ -1,80 +1,27 @@ +#include <assert.h> + #include "CShow.h" #include "VideoPlayer.h" #include "Mouse.h" -void CShow::PlayMovie( MovieType eVideo, bool bShowMouseAfterPlayback ) +void CShow::PlayMovie(MovieType eVideo, bool bShowMouseAfterPlayback) { - int v3; // edx@5 - const char *Name; // ecx@5 - //std::string v5; // [sp-18h] [bp-24h]@4 - //signed int v6; // [sp-Ch] [bp-18h]@10 - int ScreenSizeFlag; // [sp-8h] [bp-14h]@4 - //int v8; // [sp-4h] [bp-10h]@4 - //char v9; // [sp+0h] [bp-Ch]@14 - //char v10; // [sp+4h] [bp-8h]@4 - //int a3; // [sp+Bh] [bp-1h]@14 - - if (bNoVideo) - return; + if (bNoVideo) return; - if (pAsyncMouse) - pAsyncMouse->Suspend(); - switch ( eVideo ) - { - case MOVIE_Invalid: - MessageBoxW(nullptr, L"No movie", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Show.cpp:40", 0); - break; - case MOVIE_3DOLogo: - ScreenSizeFlag = 0; - v3 = 0; - Name = "3dologo"; - VideoPlayer::MovieLoop(Name, v3, ScreenSizeFlag, 1); - break; - case MOVIE_NWCLogo: - ScreenSizeFlag = 1; - v3 = 0; - Name = "new world logo"; - VideoPlayer::MovieLoop(Name, v3, ScreenSizeFlag, 1); - break; - case MOVIE_JVC: - ScreenSizeFlag = 1; - v3 = 0; - Name = "jvc"; - VideoPlayer::MovieLoop(Name, v3, ScreenSizeFlag, 1); - break; - case MOVIE_Intro: - ScreenSizeFlag = 1; - v3 = 0; - Name = "Intro"; - VideoPlayer::MovieLoop(Name, v3, ScreenSizeFlag, 1); - break; - case MOVIE_Emerald: - ScreenSizeFlag = 1; - v3 = 0; - Name = "Intro Post"; - VideoPlayer::MovieLoop(Name, v3, ScreenSizeFlag, 1); - break; - case MOVIE_Death: - ScreenSizeFlag = 1; - v3 = 2; - Name = "losegame"; - VideoPlayer::MovieLoop(Name, v3, ScreenSizeFlag, 1); - break; - case MOVIE_Outro: - ScreenSizeFlag = 1; - v3 = 20; - Name = "end_seq1"; - VideoPlayer::MovieLoop(Name, v3, ScreenSizeFlag, 1); - break; + switch (eVideo) + { + case MOVIE_3DOLogo: VideoPlayer::MovieLoop("3dologo", 0, 0, 1); break; + case MOVIE_NWCLogo: VideoPlayer::MovieLoop("new world logo", 0, 1, 1); break; + case MOVIE_JVC: VideoPlayer::MovieLoop("jvc", 0, 1, 1); break; + case MOVIE_Intro: VideoPlayer::MovieLoop("Intro", 0, 1, 1); break; + case MOVIE_Emerald: VideoPlayer::MovieLoop("Intro Post", 0, 1, 1); break; + case MOVIE_Death: VideoPlayer::MovieLoop("losegame", 2, 1, 1); break; + case MOVIE_Outro: VideoPlayer::MovieLoop("end_seq1", 20, 1, 1); break; + default: - MessageBoxW(nullptr, L"Invalid movie requested in CShow::Run()", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Show.cpp:72", 0); - break; - } - if ( bShowMouseAfterPlayback ) - { - if (pAsyncMouse) - pAsyncMouse->Resume(); - } + assert(false && "Invalid movie requested in " __FUNCTION__); + break; + } }
--- a/Events.cpp Thu May 23 11:16:46 2013 +0600 +++ b/Events.cpp Thu May 23 11:17:01 2013 +0600 @@ -375,8 +375,7 @@ pVideoPlayer->Unload(); pVideoPlayer->bStopBeforeSchedule = 0; pVideoPlayer->pResetflag = 0; - if (pAsyncMouse) - pAsyncMouse->Suspend(); + v128 = pCurrentScreen; //v13 = &pSomeEVT[v9]; //v14 = (unsigned __int8)v13[5]; @@ -400,8 +399,7 @@ if ( v128 == 13 ) pVideoPlayer->OpenHouseMovie(pAnimatedRooms[uCurrentHouse_Animation].video_name, 1u); } - if (pAsyncMouse) - pAsyncMouse->Resume(); + ++curr_seq_num; v4 = v124; @@ -423,8 +421,6 @@ if ( v128 == 13 ) pVideoPlayer->OpenHouseMovie(pAnimatedRooms[uCurrentHouse_Animation].video_name, 1u); } - if (pAsyncMouse) - pAsyncMouse->Resume(); ++curr_seq_num; v4 = v124; @@ -447,8 +443,6 @@ if ( v128 == 13 ) pVideoPlayer->OpenHouseMovie(pAnimatedRooms[uCurrentHouse_Animation].video_name, 1u); } - if (pAsyncMouse) - pAsyncMouse->Resume(); ++curr_seq_num; v4 = v124; @@ -529,7 +523,7 @@ memset(&Dst, 0, 0x344u); dword_5B65D0_dialogue_actor_npc_id = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((unsigned int)_evt->v8 << 8)) << 8)) << 8); Dst.sNPC_ID = dword_5B65D0_dialogue_actor_npc_id; - Dst.InitializeDialogue(0); + GameUI_InitializeDialogue(&Dst, false); } else { @@ -1037,7 +1031,7 @@ v115 = EVT_DWORD(_evt->v7 ); v89 = (unsigned __int8)v86; v88 = &pParty->pPlayers[v89]; - v88->ReceiveDamage(v115, v119); + v88->ReceiveDamage(v115, (DAMAGE_TYPE)v119); ++curr_seq_num; v4 = v124; break; @@ -1056,7 +1050,7 @@ v119 = _evt->v6; v88 = pPlayers[uActiveCharacter]; v115 = EVT_DWORD(_evt->v7 ); - v88->ReceiveDamage(v115, v119); + v88->ReceiveDamage(v115, (DAMAGE_TYPE)v119); ++curr_seq_num; v4 = v124; break; @@ -1067,7 +1061,7 @@ v115 = EVT_DWORD(_evt->v7 ); v89 = rand() % 4; v88 = &pParty->pPlayers[v89]; - v88->ReceiveDamage(v115, v119); + v88->ReceiveDamage(v115, (DAMAGE_TYPE)v119); ++curr_seq_num; v4 = v124; @@ -1078,7 +1072,7 @@ v87 = pParty->pPlayers; do { - v87->ReceiveDamage(v85, _evt->v6); + v87->ReceiveDamage(v85, (DAMAGE_TYPE)_evt->v6); ++v87; } while ( (signed int)v87 < (signed int)pParty->pHirelings ); @@ -1257,7 +1251,7 @@ { if ( pRenderer->pRenderD3D && !pRenderer->bWindowMode ) pRenderer->_49FD3A(); - sub_444839_move_map(_evt->v29, _evt->v30, v135, v132, v126, v129, v95, v134, (char *)&_evt->v31); + TransitionUI_Load(_evt->v29, _evt->v30, v135, v132, v126, v129, v95, v134, (char *)&_evt->v31); dword_5C3418 = uEventID; dword_5C341C = curr_seq_num + 1; goto LABEL_301;
--- a/GUIProgressBar.cpp Thu May 23 11:16:46 2013 +0600 +++ b/GUIProgressBar.cpp Thu May 23 11:17:01 2013 +0600 @@ -43,8 +43,6 @@ } //v2 = this; - if (pAsyncMouse) - pAsyncMouse->Suspend(); if (pLoadingBg.pPixels) return false; @@ -145,8 +143,6 @@ int v3; // edi@7 v1 = this; - if (pAsyncMouse) - pAsyncMouse->Resume(); if ( v1->uType == 1 ) { if ( !v1->pLoadingBg.pPixels )
--- a/GUIWindow.cpp Thu May 23 11:16:46 2013 +0600 +++ b/GUIWindow.cpp Thu May 23 11:17:01 2013 +0600 @@ -35,6 +35,22 @@ struct GUIMessageQueue *pMessageQueue_50CBD0 = new GUIMessageQueue; struct GUIMessageQueue *pMessageQueue_50C9E8 = new GUIMessageQueue; + + + + + + +//----- (004141CA) -------------------------------------------------------- +void ModalWindow(const char *pStr, int a4) +{ + pEventTimer->Pause(); + dword_506F0C[0] = pCurrentScreen; + ptr_507BDC = GUIWindow::Create(0, 0, 640, 480, WINDOW_FinalWindow, a4, (int)pStr); + pCurrentScreen = SCREEN_PRESS_ESCAPE_MESSAGE; +} +// 4E28F8: using guessed type int pCurrentScreen; + // inlined //----- (mm6c::00420520) -------------------------------------------------- void GUIMessageQueue::Flush() @@ -99,7 +115,6 @@ for ( i = uNumVisibleWindows; i >= 0; --i ) { result = 84 * pVisibleWindowsIdxs[i]; - //for ( j = *(GUIButton **)((char *)pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_ + result); j; j = j->pNext ) for ( j = pWindowList[pVisibleWindowsIdxs[i] - 1].pControlsHead; j; j = j->pNext ) j->field_28 = 0; } @@ -107,7 +122,6 @@ for ( k = uNumVisibleWindows; k >= 0; --k ) { result = 84 * pVisibleWindowsIdxs[k]; - //for ( l = *(GUIButton **)((char *)pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_ + result); l; l = l->pNext ) for ( l = pWindowList[pVisibleWindowsIdxs[k] - 1].pControlsHead; l; l = l->pNext ) { LOBYTE(result) = v10; @@ -298,7 +312,7 @@ { pIcons_LOD->SyncLoadedFilesCount(); pCurrentScreen = pMainScreenNum; - pKeyActionMap->_459ED1(3); + pKeyActionMap->SetWindowInputStatus(3); break; } case WINDOW_HouseInterior:
--- a/GUIWindow.h Thu May 23 11:16:46 2013 +0600 +++ b/GUIWindow.h Thu May 23 11:17:01 2013 +0600 @@ -307,6 +307,12 @@ struct GUIButton; struct Texture; + +#define WINDOW_INPUT_NONE 0 +#define WINDOW_INPUT_IN_PROGRESS 1 +#define WINDOW_INPUT_CONFIRMED 2 +#define WINDOW_INPUT_CANCELLED 3 + /* 155 */ #pragma pack(push, 1) struct GUIWindow @@ -354,7 +360,7 @@ int field_34; int pStartingPosActiveItem; int numVisibleWindows; - int field_40; + int receives_keyboard_input_2; // 0 no input 1 currently typing 2 enter pressed 3 escape pressed int receives_keyboard_input; char *Hint; GUIButton *pControlsHead; @@ -464,7 +470,17 @@ void draw_leather(); +// main menu ui +void MainMenuUI_LoadFontsAndSomeStuff(); +void MainMenuUI_Create(); +MENU_STATE MainMenuUI_Credits_Loop(); +// save & load ui +void SaveUI_Load(); +void SaveUI_Draw(); + +void LoadUI_Draw(); +void LoadUI_Load(unsigned int uDialogueType); // idb // game ui void GameUI_DrawRightPanel(); @@ -479,17 +495,22 @@ void GameUI_Footer_2(); void GameUI_SetFooterString(const char *pStr); void GameUI_DrawMinimap(unsigned int uX, unsigned int uY, unsigned int uZ, unsigned int uW, unsigned int uZoom, unsigned int bRedrawOdmMinimap); +auto GameUI_GetMinimapHintText() -> const char *; void GameUI_DrawPartySpells(); void GameUI_DrawTorchlightAndWizardEye(); void GameUI_DrawCharacterSelectionFrame(); void GameUI_CharacterQuickRecord_Draw(GUIWindow *window, Player *player); +void GameUI_DrawNPCPopup(void *_this); - +void GameUI_InitializeDialogue(Actor *actor, int bPlayerSaysHello); +void GameUI_DrawBranchlessDialogue(); +void GameUI_DrawDialogue(); - - - +// game menu ui +void GameMenuUI_DrawKeyBindings(); +void GameMenuUI_DrawVideoOptions(); +void GameMenuUI_Options_Draw(); @@ -515,7 +536,7 @@ -//book ui +// book ui void BookUI_Draw(WindowType book); void BookUI_Questbook_Draw(); void BookUI_Autonotes_Draw(); @@ -528,7 +549,7 @@ void InitializeBookFonts(); void DrawSpellBookContent(Player *player); unsigned int __cdecl DrawLloydBeaconsScreen(); -void DrawTownPortalScreen(); +void BookUI_DrawTownPortalMap(); void LoadSpellbook(unsigned int uID); // idb void DrawSpellDescriptionPopup(int spell_index); void sub_41140B(); @@ -536,8 +557,17 @@ +// rest ui +void RestUI_Load(); +void RestUI_Draw(); +// transition & travel ui +void TransitionUI_Load(uint anim_id, uint exit_pic_id, int x, int y, int z, int directiony, int directionx, int a8, const char *pLocationName); +void TransitionUI_Draw(); + +void TravelUI_Load(); +void TravelUI_Draw(); @@ -709,6 +739,11 @@ extern unsigned int ui_game_minimap_projectile_color; extern unsigned int ui_game_minimap_treasure_color; extern unsigned int ui_game_character_record_playerbuff_colors[24]; +extern unsigned int ui_gamemenu_video_gamma_title_color; +extern unsigned int ui_gamemenu_keys_action_name_color; +extern unsigned int ui_gamemenu_keys_key_selection_blink_color_1; +extern unsigned int ui_gamemenu_keys_key_selection_blink_color_2; +extern unsigned int ui_gamemenu_keys_key_default_color; extern unsigned int ui_book_quests_title_color; extern unsigned int ui_book_quests_text_color; extern unsigned int ui_book_autonotes_title_color;
--- a/Game.cpp Thu May 23 11:16:46 2013 +0600 +++ b/Game.cpp Thu May 23 11:17:01 2013 +0600 @@ -319,10 +319,7 @@ dword_6BE340 = 2; // uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions = 0; pCurrentScreen = SCREEN_GAME; - if (pAsyncMouse) - pAsyncMouse->Resume(); - if (pGame->pKeyboardInstance->bUsingAsynKeyboard && pAsyncKeyboard ) - pAsyncKeyboard->Resume(); + if ( pRenderer->pRenderD3D ) pGame->pVisInstance->_4C1A02(); @@ -351,8 +348,6 @@ pRenderer->Present(); continue; } - if (pAsyncMouse) - pAsyncMouse->_46B736_consume_click_lists(1); if ( pVideoPlayer->pSmackerMovie && !SmackWait(pVideoPlayer->pSmackerMovie) ) { pRenderer->BeginScene(); @@ -373,11 +368,6 @@ pEventTimer->Update(); pMiscTimer->Update(); - static int gtc_old = GetTickCount(); - int gtc = GetTickCount(); - Log::Warning(L"Evt/Msc/GTC dt: %u/%u/%u", pEventTimer->uTimeElapsed, pMiscTimer->uTimeElapsed, gtc - gtc_old); - gtc_old = gtc; - OnTimer(0); GameUI_StatusBar_UpdateTimedString(0); if ( pMiscTimer->bPaused && !pEventTimer->bPaused ) @@ -765,10 +755,7 @@ { struct tagRECT Rect; // [sp+0h] [bp-10h]@6 - if (pAsyncMouse) - pAsyncMouse->Suspend(); - if (pGame->pKeyboardInstance->bUsingAsynKeyboard && pAsyncKeyboard) - pAsyncKeyboard->Suspend(); + WriteWindowsRegistryInt("startinwindow", pRenderer->bWindowMode); if ( GetWindowRect(hWnd, &Rect) && pRenderer->bWindowMode ) { @@ -778,10 +765,7 @@ WriteWindowsRegistryInt("valAlwaysRun", bAlwaysRun); pItemsTable->Release(); pNPCStats->Release(); - if (pAsyncKeyboard) - pAsyncKeyboard->Release(); - if (pAsyncMouse) - pAsyncMouse->Release(); + if (pMouse) pMouse->Deactivate();
--- a/Items.h Thu May 23 11:16:46 2013 +0600 +++ b/Items.h Thu May 23 11:17:01 2013 +0600 @@ -1,6 +1,18 @@ #pragma once - +enum DAMAGE_TYPE:unsigned int + { + DMGT_FIRE = 0, + DMGT_ELECTR = 1, + DMGT_COLD = 2, + DMGT_3 = 3, + DMGT_PHISYCAL= 4, + DMGT_5 = 5, + DMGT_SPIRIT = 6, + DMGT_MIND = 7, + DMGT_BODY = 8, + DMGT_DARK =10 + };
--- a/Keyboard.cpp Thu May 23 11:16:46 2013 +0600 +++ b/Keyboard.cpp Thu May 23 11:17:01 2013 +0600 @@ -44,9 +44,9 @@ ResetKeys(); - dword_506E68 = -1; + uGameMenuUI_CurentlySelectedKeyIdx = -1; } -// 506E68: using guessed type int dword_506E68; +// 506E68: using guessed type int uGameMenuUI_CurentlySelectedKeyIdx; //----- (00459CC4) -------------------------------------------------------- void KeyboardActionMapping::SetDefaultMapping() @@ -113,7 +113,7 @@ } //----- (00459E5A) -------------------------------------------------------- -void KeyboardActionMapping::EnterText(int a2, int pNumWord, GUIWindow *pWindow) +void KeyboardActionMapping::EnterText(int a2, int max_string_len, GUIWindow *pWindow) { KeyboardActionMapping *v4; // esi@1 @@ -124,29 +124,17 @@ v4->field_204 = 2; else v4->field_204 = 1; - v4->field_FC = pNumWord; + v4->max_input_string_len = max_string_len; v4->pWindow = pWindow; - pWindow->field_40 = 1; - if ( LOBYTE(pGame->pKeyboardInstance->bUsingAsynKeyboard) ) - { - if ( pAsyncKeyboard ) - pAsyncKeyboard->Suspend(); - } + pWindow->receives_keyboard_input_2 = WINDOW_INPUT_IN_PROGRESS; } //----- (00459ED1) -------------------------------------------------------- -void KeyboardActionMapping::_459ED1(int a2) +void KeyboardActionMapping::SetWindowInputStatus(int a2) { - KeyboardActionMapping *v2; // esi@1 - GUIWindow *v3; // esi@4 - - v2 = this; - if (pGame->pKeyboardInstance->bUsingAsynKeyboard && pAsyncKeyboard) - pAsyncKeyboard->Resume(); - v2->field_204 = 0; - v3 = v2->pWindow; - if ( v3 ) - v3->field_40 = a2; + field_204 = 0; + if ( pWindow ) + pWindow->receives_keyboard_input_2 = a2; } //----- (00459F10) -------------------------------------------------------- @@ -155,7 +143,7 @@ int v3; // [sp-4h] [bp-4h]@3 pKeyActionMap->uLastKeyPressed = a2; - if ( dword_506E68 == -1 ) + if ( uGameMenuUI_CurentlySelectedKeyIdx == -1 ) { if ( pKeyActionMap->field_204 == 1 ) { @@ -167,7 +155,7 @@ goto LABEL_3; if ( a2 == 27 ) goto LABEL_15; - if ( this->uNumKeysPressed >= this->field_FC ) + if ( this->uNumKeysPressed >= this->max_input_string_len ) return 1; pKeyActionMap->pPressedKeysBuffer[pKeyActionMap->uNumKeysPressed] = a2; ++pKeyActionMap->uNumKeysPressed; @@ -188,7 +176,7 @@ { if ( (signed int)a2 >= 48 && (signed int)a2 <= 57 ) { - if ( pKeyActionMap->uNumKeysPressed < this->field_FC ) + if ( pKeyActionMap->uNumKeysPressed < this->max_input_string_len ) { pKeyActionMap->pPressedKeysBuffer[pKeyActionMap->uNumKeysPressed] = a2; ++pKeyActionMap->uNumKeysPressed; @@ -212,10 +200,10 @@ LABEL_3: v3 = 2; LABEL_4: - pKeyActionMap->_459ED1(v3); + pKeyActionMap->SetWindowInputStatus(v3); return 1; } -// 506E68: using guessed type int dword_506E68; +// 506E68: using guessed type int uGameMenuUI_CurentlySelectedKeyIdx; //----- (00459FFC) -------------------------------------------------------- void KeyboardActionMapping::ReadMappings() @@ -651,7 +639,7 @@ const char *v28; // eax@1 const char *v29; // eax@1 - v2 = GetVKeyDisplayName(this->pVirtualKeyCodesMapping[0]); + v2 = GetVKeyDisplayName(pVirtualKeyCodesMapping[0]); WriteWindowsRegistryString("KEY_FORWARD", v2); v3 = GetVKeyDisplayName(pVirtualKeyCodesMapping[1]); WriteWindowsRegistryString("KEY_BACKWARD", v3); @@ -948,893 +936,22 @@ //----- (0045B019) -------------------------------------------------------- void Keyboard::EnterCriticalSection() { - if (bUsingAsynKeyboard) - AsyncKeyboard::EnterCriticalSection(); } //----- (0045B06E) -------------------------------------------------------- bool Keyboard::IsShiftHeld() { - if (bUsingAsynKeyboard) - { - if ( pAsyncKeyboard->_45B4EC(0x2Au) ) - { - return true; - } - return pAsyncKeyboard->_45B4EC(0x36u) != 0; - } - else - return GetAsyncKeyState(VK_SHIFT); + return GetAsyncKeyState(VK_SHIFT); } //----- (0045B0A9) -------------------------------------------------------- bool Keyboard::IsKeyBeingHeld(int vKey) { - void *v2; // esi@2 - char v3; // bl@2 - bool result; - - if (bUsingAsynKeyboard) - { - __debugbreak(); - /* - v2 = pAsyncKeyboard; - EnterCriticalSection(&pGame->pThreadWardInstance->csAsyncKeyboard); - v3 = *((unsigned char *)v2 + (unsigned __int8)AsyncKeyboard::map_key(v2, vKey) + 265) >> 7; - LeaveCriticalSection(&pGame->pThreadWardInstance->csAsyncKeyboard); - return v3;*/ - } - else - //return (GetAsyncKeyState(vKey) & 0x8001) != 0; - result = GetAsyncKeyState(vKey); - return result; + return GetAsyncKeyState(vKey) & 0x8001; } //----- (0045B0CE) -------------------------------------------------------- bool Keyboard::WasKeyPressed(int vKey) { - void *v2; // esi@2 - char v3; // bl@2 - bool result; // eax@2 - - if ( this->bUsingAsynKeyboard ) - { - __debugbreak(); - /*v2 = pAsyncKeyboard; - EnterCriticalSection(&pGame->pThreadWardInstance->csAsyncKeyboard); - v3 = *((unsigned char *)v2 + (unsigned __int8)AsyncKeyboard::map_key(v2, vKey) + 521) >> 7; - LeaveCriticalSection(&pGame->pThreadWardInstance->csAsyncKeyboard); - LOBYTE(result) = v3;*/ - } - else - { - result = GetAsyncKeyState(vKey); - //LOBYTE(result) = result & 1; - } - return result; -} - -//----- (0045B10A) -------------------------------------------------------- -AsyncKeyboard::AsyncKeyboard() -{ - *(unsigned int *)(this + 4) = 0; - *(unsigned char *)(this + 8) = 0; - - if (!Initialize()) - MessageBoxW(nullptr, L"Could not initialize asynchronos keyboard object", nullptr, 0); -} -// 4D86B8: using guessed type int (__stdcall *AsyncKeyboard_pvdtor)(char); -// 4DBD94: using guessed type int dword_4DBD94; - - -//----- (0045B15E) -------------------------------------------------------- -AsyncKeyboard::~AsyncKeyboard() -{ - __debugbreak(); - /* - void *v1; // esi@1 - char *v2; // edi@1 - int v3; // ecx@1 - - v1 = this; - v2 = (char *)this + 1804; - v3 = *((unsigned int *)this + 451); - if ( v3 ) - (**(void (__stdcall ***)(unsigned int))v3)(1); - *(unsigned int *)v2 = 0; - return TerminateThread(*((HANDLE *)v1 + 1), 0x1F4u);*/ -} -// 4D86B8: using guessed type int (__stdcall *AsyncKeyboard_pvdtor)(char); - -//----- (0045B18E) -------------------------------------------------------- -bool AsyncKeyboard::Initialize() -{ - _45B1B1(); - if (_45B229()) - return CreateDirectInputKeyboard() != 0; - return false; -} - -//----- (0045B1B1) -------------------------------------------------------- -void AsyncKeyboard::_45B1B1() -{ - void *v1; // esi@1 - - v1 = this; - memset((char *)this + 9, 0, 0x100u); - memset((char *)v1 + 265, 0, 0x100u); - memset((char *)v1 + 521, 0, 0x100u); - memset((char *)v1 + 780, 0, 0x400u); -} - -//----- (0045B1FD) -------------------------------------------------------- -void AsyncKeyboard::EnterCriticalSection() -{ - __debugbreak(); - //EnterCriticalSection(&pGame->pThreadWardInstance->csAsyncKeyboard); -} - -//----- (0045B213) -------------------------------------------------------- -void AsyncKeyboard::LeaveCriticalSection() -{ - __debugbreak(); - //LeaveCriticalSection(&pGame->pThreadWardInstance->csAsyncKeyboard); -} - -//----- (0045B229) -------------------------------------------------------- -char AsyncKeyboard::_45B229() -{ - __debugbreak(); - return 0; - /*void *v1; // esi@1 - HANDLE v2; // eax@1 - char result; // al@2 - DWORD ThreadId; // [sp+0h] [bp-4h]@1 - - ThreadId = (DWORD)this; - v1 = this; - v2 = CreateThread(0, 0, (LPTHREAD_START_ROUTINE)AsyncKeyboardThread, this, 4u, &ThreadId); - *((unsigned int *)v1 + 1) = v2; - if ( v2 ) - result = SetThreadPriority(v2, 15) != 0; - else - result = 0; - return result;*/ -} - -//----- (0045B260) -------------------------------------------------------- -char AsyncKeyboard::CreateDirectInputKeyboard() -{ - __debugbreak(); - return 0; - /*v1 = this; - v2 = new DirectInputKeyboard; - *((void **)v1 + 451) = v2; - - return v2 != 0;*/ -} - -//----- (0045B2A7) -------------------------------------------------------- -void AsyncKeyboard::Resume() -{ - __debugbreak(); - /*void *v1; // esi@1 - std::string v2; // [sp-18h] [bp-24h]@2 - const char *v3; // [sp-8h] [bp-14h]@2 - int v4; // [sp-4h] [bp-10h]@2 - std::string *v5; // [sp+4h] [bp-8h]@2 - int a3; // [sp+Bh] [bp-1h]@2 - - v1 = this; - if ( *((unsigned int *)this + 451) ) - { - EnterCriticalSection(&pGame->pThreadWardInstance->csAsyncKeyboard); - _45B1B1(); - DirectInputKeyboard::set_acquire(*((DirectInputKeyboard **)v1 + 451), (int *)1); - ResumeThread(*((HANDLE *)v1 + 1)); - LeaveCriticalSection(&pGame->pThreadWardInstance->csAsyncKeyboard); - } - else - { - MessageBoxW(nullptr, L"Invalid DI_Keyboard, bailing out of resume()", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\KeyboardAsync.cpp:97", 0); - }*/ -} - -//----- (0045B329) -------------------------------------------------------- -void AsyncKeyboard::Suspend() -{ - __debugbreak(); - /*void *v1; // esi@1 - std::string v2; // [sp-18h] [bp-24h]@2 - const char *v3; // [sp-8h] [bp-14h]@2 - int v4; // [sp-4h] [bp-10h]@2 - std::string *v5; // [sp+4h] [bp-8h]@2 - int a3; // [sp+Bh] [bp-1h]@2 - - v1 = this; - if ( *((unsigned int *)this + 451) ) - { - EnterCriticalSection(&pGame->pThreadWardInstance->csAsyncKeyboard); - SuspendThread(*((HANDLE *)v1 + 1)); - DirectInputKeyboard::set_acquire(*((DirectInputKeyboard **)v1 + 451), 0); - LeaveCriticalSection(&pGame->pThreadWardInstance->csAsyncKeyboard); - } - else - { - MessageBoxW(nullptr, L"Invalid DI_Keyboard, bailing out of suspend()", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\KeyboardAsync.cpp:115", 0); - }*/ -} - -//----- (0045B3A4) -------------------------------------------------------- -char AsyncKeyboard::_45B3A4() -{ - __debugbreak(); - return 0; - /**((unsigned char *)this + 8) = 1; - Sleep(0x85u); - return 1;*/ -} - - -//----- (00465C53) -------------------------------------------------------- -void AsyncKeyboard::Release() -{ - __debugbreak(); - /*if ( LOBYTE(pGame->pKeyboardInstance->bUsingAsynKeyboard) ) - { - if ( pAsyncKeyboard ) - { - pAsyncKeyboard->Suspend(); - if ( pAsyncKeyboard ) - (**(void (__stdcall ***)(int))pAsyncKeyboard)(1); - } - pAsyncKeyboard = 0; - }*/ -} - -//----- (0045B3B6) -------------------------------------------------------- -void AsyncKeyboard::Thread() -{ - __debugbreak(); - /*void *v1; // esi@1 - signed int v2; // ecx@3 - int v3; // eax@3 - DWORD v4; // edx@6 - std::string v5; // [sp-18h] [bp-2Ch]@2 - const char *v6; // [sp-8h] [bp-1Ch]@2 - int v7; // [sp-4h] [bp-18h]@2 - DWORD v8; // [sp+Ch] [bp-8h]@2 - int a3; // [sp+13h] [bp-1h]@2 - - v1 = this; - if ( *((unsigned int *)this + 451) ) - { - ::EnterCriticalSection(&pGame->pThreadWardInstance->csAsyncKeyboard); - v8 = timeGetTime(); - memcpy((char *)v1 + 9, (const void *)(*((unsigned int *)v1 + 451) + 29), 0x100u); - (*((DirectInputKeyboard **)v1 + 451)->_43B8EC(); - memcpy((char *)v1 + 265, (const void *)(*((unsigned int *)v1 + 451) + 29), 0x100u); - v2 = 0; - v3 = (int)((char *)v1 + 780); - do - { - if ( *((unsigned char *)v1 + v2 + 265) & 0x80 ) - { - if ( v8 - *(unsigned int *)v3 > 0xC8 ) - { - v4 = v8; - *((unsigned char *)v1 + v2 + 521) |= 0x80u; - *(unsigned int *)v3 = v4; - } - } - ++v2; - v3 += 4; - } - while ( v2 < 256 ); - ::LeaveCriticalSection(&pGame->pThreadWardInstance->csAsyncKeyboard); - } - else - { - MessageBoxW(nullptr, L"Invalid DI_Keyboard, bailing out of update_keyboard_data()", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\KeyboardAsync.cpp:169", 0); - }*/ -} - -//----- (0045B4EC) -------------------------------------------------------- -char AsyncKeyboard::_45B4EC(unsigned __int8 a2) -{ - __debugbreak(); - return 0; - /*void *v2; // esi@1 - char v3; // bl@1 - - v2 = this; - EnterCriticalSection(&pGame->pThreadWardInstance->csAsyncKeyboard); - v3 = *((unsigned char *)v2 + a2 + 265) >> 7; - LeaveCriticalSection(&pGame->pThreadWardInstance->csAsyncKeyboard); - return v3;*/ + return GetAsyncKeyState(vKey) & 1; } - -//----- (0045B57D) -------------------------------------------------------- -char AsyncKeyboard::map_key(int key) -{ - __debugbreak(); - return 0; - /*char result; // al@2 - std::string v3; // [sp-18h] [bp-1Ch]@99 - const char *v4; // [sp-8h] [bp-Ch]@99 - int v5; // [sp-4h] [bp-8h]@99 - void *v6; // [sp+0h] [bp-4h]@1 - - v6 = this; - switch ( key ) - { - case 8: - result = 14; - break; - case 9: - result = 15; - break; - case 13: - result = 28; - break; - case 16: - case 161: - result = 54; - break; - case 160: - result = 42; - break; - case 17: - case 163: - result = -99; - break; - case 162: - result = 29; - break; - case 18: - result = -72; - break; - case 20: - result = 58; - break; - case 21: - result = 112; - break; - case 25: - result = -108; - break; - case 27: - result = 1; - break; - case 28: - result = 121; - break; - case 29: - result = 123; - break; - case 32: - result = 57; - break; - case 33: - result = -55; - break; - case 34: - result = -47; - break; - case 35: - result = -49; - break; - case 36: - result = -57; - break; - case 37: - result = -53; - break; - case 38: - result = -56; - break; - case 39: - result = -51; - break; - case 40: - result = -48; - break; - case 42: - result = -73; - break; - case 45: - result = -46; - break; - case 46: - result = -45; - break; - case 48: - result = 11; - break; - case 49: - result = 2; - break; - case 50: - result = 3; - break; - case 51: - result = 4; - break; - case 52: - result = 5; - break; - case 53: - result = 6; - break; - case 54: - result = 7; - break; - case 55: - result = 8; - break; - case 56: - result = 9; - break; - case 57: - result = 10; - break; - case 65: - result = 30; - break; - case 66: - result = 48; - break; - case 67: - result = 46; - break; - case 68: - result = 32; - break; - case 69: - result = 18; - break; - case 70: - result = 33; - break; - case 71: - result = 34; - break; - case 72: - result = 35; - break; - case 73: - result = 23; - break; - case 74: - result = 36; - break; - case 75: - result = 37; - break; - case 76: - result = 38; - break; - case 77: - result = 50; - break; - case 78: - result = 49; - break; - case 79: - result = 24; - break; - case 80: - result = 25; - break; - case 81: - result = 16; - break; - case 82: - result = 19; - break; - case 83: - result = 31; - break; - case 84: - result = 20; - break; - case 85: - result = 22; - break; - case 86: - result = 47; - break; - case 87: - result = 17; - break; - case 88: - result = 45; - break; - case 89: - result = 21; - break; - case 90: - result = 44; - break; - case 91: - result = -37; - break; - case 92: - result = -36; - break; - case 93: - result = -35; - break; - case 96: - result = 82; - break; - case 97: - result = 79; - break; - case 98: - result = 80; - break; - case 99: - result = 81; - break; - case 100: - result = 75; - break; - case 101: - result = 76; - break; - case 102: - result = 77; - break; - case 103: - result = 71; - break; - case 104: - result = 72; - break; - case 105: - result = 73; - break; - case 106: - result = 55; - break; - case 107: - result = 78; - break; - case 109: - result = 74; - break; - case 110: - result = 83; - break; - case 111: - result = -75; - break; - case 112: - result = 59; - break; - case 113: - result = 60; - break; - case 114: - result = 61; - break; - case 115: - result = 62; - break; - case 116: - result = 63; - break; - case 117: - result = 64; - break; - case 118: - result = 65; - break; - case 119: - result = 66; - break; - case 120: - result = 67; - break; - case 121: - result = 68; - break; - case 122: - result = 87; - break; - case 123: - result = 88; - break; - case 124: - result = 100; - break; - case 125: - result = 101; - break; - case 126: - result = 102; - break; - case 144: - result = 69; - break; - case 145: - result = 70; - break; - default: - MessageBoxW(nullptr, L"Uknown key detected!", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\KeyboardAsync.cpp:999", 0); - goto LABEL_100; - case 1: - case 2: - case 3: - case 4: - case 12: - case 19: - case 23: - case 24: - case 30: - case 31: - case 41: - case 43: - case 44: - case 47: - case 108: - case 127: - case 128: - case 129: - case 130: - case 131: - case 132: - case 133: - case 134: - case 135: -LABEL_100: - result = -1; - break; - } - return result;*/ -} - -//----- (0045BA60) -------------------------------------------------------- -int __stdcall AsyncKeyboard::ThreadStarter(AsyncKeyboard *pInstance) -{ - __debugbreak(); - return 0; - /*while ( 1 ) - { - while ( !pAsyncKeyboard ) - ; - if ( *((unsigned char *)pAsyncKeyboard + 8) ) - ExitThread(0); - pAsyncKeyboard->Thread(); - Sleep(0x21u); - }*/ -} - - - - - - - - -/* -//----- (0043B76D) -------------------------------------------------------- -DirectInputKeyboard *__thiscall DirectInputKeyboard::DirectInputKeyboard(DirectInputKeyboard *this) -{ - DirectInputKeyboard *v1; // esi@1 - HRESULT v2; // eax@5 - unsigned int uVersion; // [sp-18h] [bp-20h]@3 - IDirectInput **ppDirectInput; // [sp-14h] [bp-1Ch]@3 - int v6; // [sp-10h] [bp-18h]@3 - const char *v7; // [sp-Ch] [bp-14h]@3 - int v8; // [sp-8h] [bp-10h]@3 - unsigned int v9; // [sp-4h] [bp-Ch]@3 - CheckHRESULT_stru0 v10; // [sp+4h] [bp-4h]@5 - - v1 = this; - this->field_8 = 0; - LOBYTE(this->field_1C) = 0; - this->vdestructor_ptr = &pDirectInputKeyboard_pvdtor; - if ( pVersion->pVersionInfo.dwPlatformId != VER_PLATFORM_WIN32_NT || pVersion->pVersionInfo.dwMajorVersion != 4 ) - { - v9 = 1; - v8 = 28; - v7 = "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\DirectInputKeyboard.cpp"; - v6 = 0; - ppDirectInput = &this->pDirectInput; - uVersion = 0x500u; - } - else - { - v9 = 1; - v8 = 26; - v7 = "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\DirectInputKeyboard.cpp"; - v6 = 0; - ppDirectInput = &this->pDirectInput; - uVersion = 0x300u; - } - v2 = DirectInputCreateA(hInstance, uVersion, ppDirectInput, v6); - CheckHRESULT(&v10, v2, v7, v8, v9); - DirectInputKeyboard::CreateDevice(v1); - DirectInputKeyboard::43B87B(v1); - return v1; -} -// 4C8880: using guessed type int __stdcall DirectInputCreateA(int, int, int, int); - -//----- (0043B7E3) -------------------------------------------------------- -void __thiscall DirectInputKeyboard::vdtor(DirectInputKeyboard *this, bool a2) -{ - void *v2; // esi@1 - - v2 = this; - DirectInputKeyboard::dtor(this); - if ( a2 & 1 ) - free(v2); -} - -//----- (0043B7FF) -------------------------------------------------------- -void __thiscall DirectInputKeyboard::dtor(DirectInputKeyboard *this) -{ - DirectInputKeyboard *v1; // esi@1 - int v2; // eax@1 - - v1 = this; - v2 = this->field_8; - this->vdestructor_ptr = &pDirectInputKeyboard_pvdtor; - if ( v2 ) - { - (*(void (__stdcall **)(int))(*(int *)v2 + 32))(v2); - (*(void (__stdcall **)(int))(*(int *)v1->field_8 + 8))(v1->field_8); - v1->field_8 = 0; - } - v1->pDirectInput->lpVtbl->Release(v1->pDirectInput); - v1->pDirectInput = 0; -} - -//----- (0043B831) -------------------------------------------------------- -void __thiscall DirectInputKeyboard::CreateDevice(DirectInputKeyboard *this) -{ - DirectInputKeyboard *v1; // esi@1 - HRESULT v2; // eax@1 - int v3; // [sp+4h] [bp-4h]@1 - - v1 = this; - v2 = ((int (__stdcall *)(IDirectInput *, signed int, int (__stdcall *)(int, int), DirectInputKeyboard *, signed int))this->pDirectInput->lpVtbl->field_10)( - this->pDirectInput, - 3, - DirectInputKeyboard_enumerator_43B9B9, - this, - 1); - CheckHRESULT((CheckHRESULT_stru0 *)&v3, v2, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\DirectInputKeyboard.cpp", 52, 1u); - if ( !LOBYTE(v1->field_1C) ) - { - v3 = (int)"Error: No keyboard found"; - _CxxThrowException((int)&v3, (int)&dword_4DBD94); - } -} -// 43B9B9: using guessed type int __stdcall DirectInputKeyboard_enumerator_43B9B9(int, int); -// 4DBD94: using guessed type int dword_4DBD94; - -//----- (0043B87B) -------------------------------------------------------- -void __thiscall DirectInputKeyboard::43B87B(DirectInputKeyboard *ecx0) -{ - char *v1; // esi@1 - HRESULT v2; // eax@1 - HRESULT v3; // eax@1 - HRESULT v4; // eax@1 - unsigned int v5; // [sp+0h] [bp-Ch]@0 - char this; // [sp+8h] [bp-4h]@1 - - v1 = (char *)&ecx0->field_8; - v2 = ((int (__stdcall *)(IDirectInput *, int *, int *, int, int))ecx0->pDirectInput->lpVtbl->field_C)( - ecx0->pDirectInput, - &ecx0->field_C, - &ecx0->field_8, - 0, - "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\DirectInputKeyboard.cpp"); - CheckHRESULT((CheckHRESULT_stru0 *)&this, v2, (const char *)0x3C, 1, v5); - v3 = (*(int (__stdcall **)(int, int))(**(int **)v1 + 44))(*(int *)v1, dword_4C9890); - CheckHRESULT((CheckHRESULT_stru0 *)&this, v3, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\DirectInputKeyboard.cpp", 63, 1u); - v4 = (*(int (__stdcall **)(int, HWND, signed int))(**(int **)v1 + 52))(*(int *)v1, hWnd, 6); - CheckHRESULT((CheckHRESULT_stru0 *)&this, v4, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\DirectInputKeyboard.cpp", 64, 1u); - (*(void (__cdecl **)(int))(**(int **)v1 + 28))(*(int *)v1); -} -// 4C9890: using guessed type int dword_4C9890[10]; - -//----- (0043B8EC) -------------------------------------------------------- -char __thiscall DirectInputKeyboard::43B8EC(DirectInputKeyboard *this) -{ - DirectInputKeyboard *v1; // esi@1 - int v2; // eax@1 - char result; // al@2 - char *v4; // ebx@3 - int v5; // esi@5 - HRESULT v6; // eax@5 - std::string v7; // [sp-18h] [bp-2Ch]@2 - int v8; // [sp-Ch] [bp-20h]@5 - const char *v9; // [sp-8h] [bp-1Ch]@2 - int v10; // [sp-4h] [bp-18h]@2 - std::string *v13; // [sp+Ch] [bp-8h]@2 - int a3; // [sp+13h] [bp-1h]@2 - - v1 = this; - v2 = this->field_8; - if ( v2 ) - { - v4 = (char *)&this->field_1C + 1; - if ( (*(int (__stdcall **)(int, signed int, char *))(*(int *)v2 + 36))(v2, 256, (char *)&this->field_1C + 1) == -2147024866 ) - { - if ( !(*(int (__stdcall **)(int))(*(int *)v1->field_8 + 28))(v1->field_8) ) - { - v5 = v1->field_8; - v10 = 1; - v9 = (const char *)79; - v8 = (int)"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\DirectInputKeyboard.cpp"; - v6 = (*(int (__stdcall **)(int, signed int, char *))(*(int *)v5 + 36))(v5, 256, v4); - CheckHRESULT((CheckHRESULT_stru0 *)&v13, v6, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\DirectInputKeyboard.cpp", 79, 1u); - } - } - result = 1; - } - else - { - MessageBoxW(nullptr, L"Invalid Device pointer, bailing out of update_data()", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\DirectInputKeyboard.cpp:72", 0); - result = 0; - } - return result; -} - -//----- (0043B96E) -------------------------------------------------------- -char __thiscall DirectInputKeyboard::set_acquire(DirectInputKeyboard *this, int *a2) -{ - int v2; // eax@1 - char result; // al@2 - int v4; // ecx@3 - std::string v5; // [sp-18h] [bp-1Ch]@2 - const char *v6; // [sp-8h] [bp-Ch]@2 - int v7; // [sp-4h] [bp-8h]@2 - DirectInputKeyboard *v8; // [sp+0h] [bp-4h]@1 - - v8 = this; - v2 = this->field_8; - if ( v2 ) - { - v4 = *(int *)v2; - v7 = v2; - if ( (char)a2 ) - (*(void (__stdcall **)(int))(v4 + 28))(v7); - else - (*(void (__stdcall **)(int))(v4 + 32))(v7); - result = 1; - } - else - { - MessageBoxW(nullptr, L"Invalid Device pointer, bailing out of set_acquire()", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\DirectInputKeyboard.cpp:89", 0); - result = 0; - } - return result; -} - -//----- (0043B9B9) -------------------------------------------------------- -signed int __stdcall DirectInputKeyboard_enumerator_43B9B9(int a1, int a2) -{ - signed int result; // eax@2 - - if ( *(char *)(a1 + 36) & 3 ) - { - *(int *)(a2 + 12) = *(int *)(a1 + 4); - *(int *)(a2 + 16) = *(int *)(a1 + 8); - *(int *)(a2 + 20) = *(int *)(a1 + 12); - *(int *)(a2 + 24) = *(int *)(a1 + 16); - *(char *)(a2 + 28) = 1; - result = 0; - } - else - { - result = 1; - } - return result; -} -// 43B9B9: using guessed type int __stdcall DirectInputKeyboard_enumerator_43B9B9(int, int); -*/ \ No newline at end of file
--- a/Keyboard.h Thu May 23 11:16:46 2013 +0600 +++ b/Keyboard.h Thu May 23 11:17:01 2013 +0600 @@ -56,8 +56,8 @@ void ReadMappings(); void StoreMappings(); bool _459F10(unsigned int a2); - void _459ED1(int a2); - void EnterText(int a2, int a3, struct GUIWindow *pWindow); + void SetWindowInputStatus(int a2); + void EnterText(int a2, int max_string_len, struct GUIWindow *pWindow); void ResetKeys(); void SetDefaultMapping(); @@ -66,7 +66,7 @@ int field_8; unsigned int pVirtualKeyCodesMapping[30]; KeyToggleType pToggleTypes[30]; - int field_FC; + int max_input_string_len; unsigned __int8 pPressedKeysBuffer[257]; unsigned __int8 uNumKeysPressed; char field_202; @@ -91,30 +91,6 @@ #pragma pack(pop) -#pragma pack(push, 1) -struct AsyncKeyboard -{ - AsyncKeyboard(); - ~AsyncKeyboard(); - - bool Initialize(); - char map_key(int key); - char _45B4EC(unsigned __int8 a2); - void Thread(); - char _45B3A4(); - void Suspend(); - void Resume(); - char CreateDirectInputKeyboard(); - char _45B229(); - void _45B1B1(); - void Release(); - - static int __stdcall ThreadStarter(AsyncKeyboard *pInstance); - static void EnterCriticalSection(); - static void LeaveCriticalSection(); -}; -#pragma pack(pop) -extern struct KeyboardActionMapping *pKeyActionMap; -extern struct AsyncKeyboard *pAsyncKeyboard; \ No newline at end of file +extern struct KeyboardActionMapping *pKeyActionMap; \ No newline at end of file
--- a/Mouse.cpp Thu May 23 11:16:46 2013 +0600 +++ b/Mouse.cpp Thu May 23 11:17:01 2013 +0600 @@ -15,7 +15,6 @@ Mouse *pMouse; -AsyncMouse *pAsyncMouse; @@ -24,19 +23,8 @@ //----- (00469860) -------------------------------------------------------- void Mouse::GetClickPos(unsigned int *pX, unsigned int *pY) { - unsigned int v3; // eax@2 - - if (pAsyncMouse) - { - *pX = *((int *)pAsyncMouse + 6); - v3 = *((int *)pAsyncMouse + 7); - } - else - { - *pX = this->uMouseClickX; - v3 = this->uMouseClickY; - } - *pY = v3; + *pX = uMouseClickX; + *pY = uMouseClickY; } //----- (004698A6) -------------------------------------------------------- @@ -64,7 +52,7 @@ { Mouse *v2; // esi@1 HCURSOR v3; // eax@10 - int v4; // ecx@10 + //int v4; // ecx@10 double v5; // st7@11 float v6; // ST04_4@12 LONG v7; // eax@14 @@ -106,21 +94,18 @@ { v3 = LoadCursorA(GetModuleHandleW(nullptr), "Arrow"); SetClassLongA(hWnd, GCL_HCURSOR, (LONG)v3); - v4 = (int)pAsyncMouse; - if (pAsyncMouse) + /*if (pAsyncMouse) { v10 = 0.0; v5 = 0.0; //LABEL_12: v6 = v5; - pAsyncMouse->SetHotspot(v6, v10); - if ( !pAsyncMouse || (pAsyncMouse->LoadCursor(pName), !pAsyncMouse) ) - { + GetCursorPos(&Point); SetCursorPos(Point.x, Point.y); - } + return; - } + }*/ GetCursorPos(&Point); ClientToScreen(hWnd,&Point); SetCursorPos(Point.x, Point.y); @@ -130,8 +115,7 @@ { v7 = (LONG)LoadCursorA(GetModuleHandleW(nullptr), "Target"); SetClassLongA(hWnd, -12, v7); - v4 = (int)pAsyncMouse; - if (pAsyncMouse) + /*if (pAsyncMouse) { v10 = 14.0; v5 = 14.0; @@ -143,7 +127,7 @@ SetCursorPos(Point.x, Point.y); } return; - } + }*/ //LABEL_20: GetCursorPos(&Point); SetCursorPos(Point.x, Point.y); @@ -155,11 +139,9 @@ SetClassLongA(hWnd, -12, v8); } //LABEL_18: - if ( !pAsyncMouse || (pAsyncMouse->LoadCursor(pName), !pAsyncMouse) ) - { + GetCursorPos(&Point); SetCursorPos(Point.x, Point.y); - } } // 506128: using guessed type int areWeLoadingTexture; @@ -173,26 +155,26 @@ v1 = this; this->field_8 = 1; - if (pAsyncMouse) + /*if (pAsyncMouse) { v2 = *((int *)pAsyncMouse + 6); Point.x = *((int *)pAsyncMouse + 6); result = *((int *)pAsyncMouse + 7); } else - { + {*/ GetCursorPos(&Point); if ( pRenderer->bWindowMode ) ScreenToClient(hWnd, &Point); result = Point.y; v2 = Point.x; - } + //} v1->uMouseClickX = v2; v1->uMouseClickY = result; if ( pRenderer->bWindowMode ) goto LABEL_16; - if (pAsyncMouse) - goto LABEL_24; + //if (pAsyncMouse) + // goto LABEL_24; if ( v2 < 0 ) v2 = 0; if ( result < 0 ) @@ -203,8 +185,8 @@ { result = 479; LABEL_16: - if (pAsyncMouse) - goto LABEL_24; + //if (pAsyncMouse) + // goto LABEL_24; if ( pRenderer->bWindowMode && (v2 < 0 || result < 0 || v2 > 639 || result > 479) ) goto LABEL_23; } @@ -262,26 +244,9 @@ //----- (00469C39) -------------------------------------------------------- POINT *Mouse::GetCursorPos(POINT *a2) { - void *v2; // edx@1 - POINT *result; // eax@1 - unsigned int v4; // ecx@2 - unsigned int v5; // edx@3 - - v2 = pAsyncMouse; - result = a2; - if (pAsyncMouse) - { - a2->x = *((int *)pAsyncMouse + 6); - v4 = *((int *)v2 + 7); - } - else - { - v5 = this->uMouseClickX; - v4 = this->uMouseClickY; - a2->x = v5; - } - a2->y = v4; - return result; + a2->x = this->uMouseClickX; + a2->y = this->uMouseClickY; + return a2; } //----- (00469C65) -------------------------------------------------------- @@ -458,16 +423,10 @@ { pTextureID = pIcons_LOD->LoadTexture(pItemsTable->pItems[pParty->pPickedItem.uItemID].pIconName, TEXTURE_16BIT_PALETTE); pTexture = (Texture *)(pTextureID != -1 ? (int)&pIcons_LOD->pTextures[pTextureID] : 0); - if (pAsyncMouse) - { - v4 = *((int *)pAsyncMouse + 6); - v5 = *((int *)pAsyncMouse + 7); - } - else - { + v4 = pMouse->uMouseClickX; v5 = pMouse->uMouseClickY; - } + v6 = v5; a2 = v4; v15 = v5; @@ -572,1492 +531,3 @@ uMouseClickY = y; } - -//----- (00409E3D) -------------------------------------------------------- -void AsyncMouse::_409E3D(char a2) -{ - if ( *((unsigned char *)this + 128) & 1 ) - *((unsigned char *)this + 103) = 1; - else - *((unsigned char *)this + 103) = 0; - if ( a2 ) - *((unsigned int *)this + 32) |= 1u; - else - *((unsigned int *)this + 32) &= 0xFFFFFFFEu; -} - -//----- (00465C2C) -------------------------------------------------------- -void AsyncMouse::Release() -{ - if (pAsyncMouse) - { - pAsyncMouse->Suspend(); - if (pAsyncMouse) - (**(void (__stdcall ***)(int))pAsyncMouse)(1); - } - pAsyncMouse = 0; -} - - - - -//----- (0046ACA9) -------------------------------------------------------- -AsyncMouse::AsyncMouse(IDirectDrawSurface *a2) -{ - IDirectDrawSurface *v2; // eax@1 - void *v3; // esi@1 - char *v4; // edi@1 - double v5; // ST14_8@3 - double v6; // ST14_8@3 - - v2 = a2; - v3 = this; - *((int *)this + 16) = -1; - *((int *)this + 3) = (int)v2; - LOBYTE(v2) = BYTE3(a2); - v4 = (char *)this + 104; - *((int *)this + 1) = 0; - *((char *)this + 20) = 0; - *((int *)this + 17) = 0; - *((int *)this + 18) = 0; - *((char *)this + 88) = 1; - *((char *)this + 91) = 0; - *((char *)this + 93) = 0; - *((char *)this + 94) = 0; - *((char *)this + 95) = 0; - *((char *)this + 96) = 0; - *((char *)this + 97) = 0; - *((char *)this + 98) = 0; - *((char *)this + 99) = 0; - *((char *)this + 100) = 0; - *((char *)this + 101) = 0; - *((char *)this + 102) = 0; - *((char *)this + 104) = (char)v2; - *((int *)this + 27) = (int)AsyncMouse::unk_46BD09(0, 0); - *((int *)v4 + 2) = 0; - *((char *)v3 + 116) = BYTE3(a2); - *((int *)v3 + 30) = (int)AsyncMouse::unk_46BD09(0, 0); - *((int *)v3 + 31) = 0; - *((int *)v3 + 32) = 0; - *((int *)v3 + 33) = 0; - *(int *)v3 = 5080880; - if ( !Initialize(this) ) - { - MessageBoxW(nullptr, L"Could not initialize CMouseAsync object", nullptr, 0); - } - *((int *)v3 + 12) = 0; - *((int *)v3 + 13) = 0; - *((int *)v3 + 14) = 0; - *((int *)v3 + 15) = 0; - v5 = (float)0.0 + 6.7553994e15; - *((int *)v3 + 10) = LODWORD(v5); - v6 = (float)0.0 + 6.7553994e15; - a2 = (IDirectDrawSurface *)LODWORD(v6); - *((int *)v3 + 32) |= 1u; - *((int *)v3 + 11) = LODWORD(v6); - *((char *)v3 + 103) = 1; -} -// 4DBD94: using guessed type int dword_4DBD94; - - - -//----- (0046ADE2) -------------------------------------------------------- -AsyncMouse::~AsyncMouse() -{ - void *v1; // esi@1 - char *v2; // edi@1 - int v3; // ecx@1 - - v1 = this; - //*(int *)this = AsyncMouse_pvdtor; - v2 = (char *)this + 132; - v3 = *((int *)this + 33); - if ( v3 ) - (**(void (__stdcall ***)(int))v3)(1); - *(int *)v2 = 0; - TerminateThread(*((HANDLE *)v1 + 4), 0xFAu); - SetWindowPos(hWnd, (HWND)0xFFFFFFFE, uWindowX, uWindowY, 640, 480, 0); - //AsyncMouse::dtor_sub_46BC73((int)((char *)v1 + 116)); - //AsyncMouse::dtor_sub_46BC73((int)((char *)v1 + 104)); -} -// 4D8730: using guessed type int (__stdcall *AsyncMouse_pvdtor[2])(char); - - - - - - - - - - - - - -//----- (0046AE6E) -------------------------------------------------------- -char AsyncMouse::Initialize(LPVOID lpParameter) -{ - void *v1; // esi@1 - char result; // al@2 - - v1 = lpParameter; - if ( LoadCursorImage() && _46B072() ) - result = CreateDisrectInputMouse() != 0; - else - result = 0; - return result; -} - -//----- (0046AE97) -------------------------------------------------------- -char AsyncMouse::LoadCursor(const char *pContainer) -{ - __debugbreak(); - return 0; - /* - void *v2; // esi@1 - int v3; // eax@1 - HRESULT v4; // eax@1 - char result; // al@3 - HRESULT a2; // [sp+8h] [bp-B0h]@1 - int v7; // [sp+58h] [bp-60h]@1 - char v9; // [sp+B4h] [bp-4h]@1 - - v2 = this; - EnterCriticalSection(&pGame->pThreadWardInstance->cs2); - v3 = *((int *)v2 + 1); - a2 = 100; - v7 = 0; - v4 = (*(int (__stdcall **)(int, int, int, int, signed int, HRESULT *))(*(int *)v3 + 20))( - v3, - 0, - 0, - 0, - 1024, - &a2); - ErrHR(v4, "DirectInput", __FUNCTION__, __FILE__, __LINE__); - - Texture thisa; // [sp+6Ch] [bp-4Ch]@1 - //Texture::Texture(&thisa); - - if ( pIcons_LOD->LoadTextureFromLOD(&thisa, pContainer, TEXTURE_16BIT_PALETTE) != -1 - && DrawCursor(&thisa, *((IDirectDrawSurface4 **)v2 + 1), 0) ) - { - thisa.Release(); - LeaveCriticalSection(&pGame->pThreadWardInstance->cs2); - result = 1; - } - else - { - result = 0; - } - return result;*/ -} - -//----- (0046AF50) -------------------------------------------------------- -char AsyncMouse::LoadCursorImage() -{ - void *v1; // ebx@1 - int v2; // eax@2 - int v3; // esi@4 - char result; // al@5 - //const char *v5; // eax@6 - //std::string v6; // [sp-18h] [bp-12Ch]@9 - const char *v7; // [sp-8h] [bp-11Ch]@9 - int v8; // [sp-4h] [bp-118h]@9 - DDSURFACEDESC2 Dst; // [sp+Ch] [bp-108h]@1 - int v10; // [sp+88h] [bp-8Ch]@2 - int v11; // [sp+8Ch] [bp-88h]@2 - int v12; // [sp+90h] [bp-84h]@2 - int v13; // [sp+94h] [bp-80h]@2 - char v14; // [sp+D0h] [bp-44h]@2 - int v15; // [sp+F0h] [bp-24h]@2 - int v16; // [sp+104h] [bp-10h]@4 - int v17; // [sp+108h] [bp-Ch]@4 - std::string *v18; // [sp+10Ch] [bp-8h]@9 - int a3; // [sp+113h] [bp-1h]@9 - - v1 = this; - memset(&Dst, 0, 0x7Cu); - Dst.dwSize = 124; - if ( pRenderer->pDirectDraw4->GetDisplayMode(&Dst) - || (memset(&v10, 0, 0x7Cu), - v10 = 124, - v11 = 4103, - v15 = 2112, - v12 = 32, - v13 = 32, - v2 = *((int *)v1 + 3), - memcpy(&v14, &Dst.ddpfPixelFormat, 0x20u), - (*(int (__stdcall **)(int, int *, char *, int))(**(int **)v2 + 24))( - *(int *)v2, - &v10, - (char *)v1 + 4, - 0)) - || (*(int (__stdcall **)(int, int *, char *, int))(***((int ***)v1 + 3) + 24))( - **((int **)v1 + 3), - &v10, - (char *)v1 + 8, - 0) - || (v3 = *((int *)v1 + 1), - v16 = 0, - v17 = 0, - (*(int (__stdcall **)(int, signed int, int *))(*(int *)v3 + 116))(v3, 8, &v16)) ) - { - result = 0; - return false; - } - else - { - if ( !LoadCursor("micon1") ) - { - MessageBoxW(nullptr, L"Could not load async mouse cursor image", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\MouseAsync.cpp:182", 0); - } - result = 1; - return true; - } - return result; -} -// 4D86F0: using guessed type int dword_4D86F0; - -//----- (0046B072) -------------------------------------------------------- -char AsyncMouse::_46B072() -{ - DWORD v1; // esi@1 - HANDLE v2; // eax@1 - char result; // al@2 - DWORD ThreadId; // [sp+0h] [bp-4h]@1 - - ThreadId = (DWORD)this; - v1 = (DWORD)this; - v2 = CreateThread(0, 0, (LPTHREAD_START_ROUTINE)AsyncMouseThread, this, 4u, &ThreadId); - *(int *)(v1 + 16) = (int)v2; - if ( v2 ) - result = SetThreadPriority(v2, 15) != 0; - else - result = 0; - return result; -} - -//----- (0046B0A9) -------------------------------------------------------- -char AsyncMouse::CreateDisrectInputMouse() -{ - __debugbreak(); - /* - void *v1; // esi@1 - DirectInputMouse *v2; // ecx@1 - DirectInputMouse *v3; // eax@2 - - v1 = this; - v2 = (DirectInputMouse *)operator new(0x2Cu); - if ( v2 ) - v3 = DirectInputMouse::DirectInputMouse(v2); - else - v3 = 0; - *((int *)v1 + 33) = v3; - return v3 != 0;*/ - return 0; -} - -//----- (0046B0ED) -------------------------------------------------------- -int AsyncMouse::_46B0ED() -{ - __debugbreak(); - /* - int v1; // esi@1 - int v2; // ecx@1 - int result; // eax@2 - - v1 = this + 132; - v2 = *(int *)(this + 132); - if ( v2 ) - result = (**(int (__stdcall ***)(int))v2)(1); - *(int *)v1 = 0; - return result;*/ - return 0; -} -// 46B0ED: using guessed type int __thiscall AsyncMouse__46B0ED(int); - -//----- (0046B105) -------------------------------------------------------- -void AsyncMouse::Resume() -{ - __debugbreak(); - /* - void *v1; // esi@1 - - v1 = this; - EnterCriticalSection(&pGame->pThreadWardInstance->cs3); - AsyncMouse::CreateDisrectInputMouse(v1); - AsyncMouse::Clip(); - ResumeThread(*((HANDLE *)v1 + 4)); - *((char *)v1 + 88) = 0; - LeaveCriticalSection(&pGame->pThreadWardInstance->cs3);*/ -} - -//----- (0046B14F) -------------------------------------------------------- -void AsyncMouse::Suspend() -{ - void *v1; // esi@1 - //Vis *v2; // eax@3 - std::string v3; // [sp-18h] [bp-24h]@2 - const char *v4; // [sp-8h] [bp-14h]@2 - int v5; // [sp-4h] [bp-10h]@2 - std::string *v6; // [sp+4h] [bp-8h]@2 - int a3; // [sp+Bh] [bp-1h]@2 - - v1 = this; - if ( *((int *)this + 33) ) - { - //v2 = pGame->pVisInstance; - if (pGame->pVisInstance) - pGame->pVisInstance->default_list.uNumPointers = 0; - - EnterCriticalSection(&pGame->pThreadWardInstance->cs3); - SuspendThread(*((HANDLE *)v1 + 4)); - _46B0ED(); - LeaveCriticalSection(&pGame->pThreadWardInstance->cs3); - } - else - { - MessageBoxW(nullptr, L"DI_Mouse pointer invalid; bailing out from suspend()", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\MouseAsync.cpp:233", 0); - } -} -// 46B0ED: using guessed type int __thiscall AsyncMouse__46B0ED(int); - -//----- (0046B1DD) -------------------------------------------------------- -char AsyncMouse::_46B1DD() -{ - *((char *)this + 20) = 1; - Sleep(118); - return 1; -} - -//----- (0046B1EC) -------------------------------------------------------- -bool AsyncMouse::DrawCursor(Texture *a1, IDirectDrawSurface4 *a2, int a3) -{ - __debugbreak(); - /* - bool result; // eax@1 - unsigned __int16 *v5; // ebx@2 - unsigned __int8 *v6; // edx@2 - int v7; // esi@2 - int v8; // ecx@2 - LPVOID v9; // edi@2 - int v10; // ecx@5 - DDSURFACEDESC2 Dst; // [sp+0h] [bp-84h]@1 - __int32 v12; // [sp+7Ch] [bp-8h]@3 - int v13; // [sp+80h] [bp-4h]@3 - - Dst.dwSize = 124; - result = pRenderer->LockSurface_DDraw4(a2, &Dst, DDLOCK_WAIT); - if ( result ) - { - v5 = a1->pPalette16; - v6 = a1->pLevelOfDetail0_prolly_alpha_mask; - v7 = a1->uTextureWidth; - v8 = a1->uTextureHeight; - v9 = Dst.lpSurface; - if ( v8 > 0 ) - { - v12 = 2 * (Dst.lPitch / 2 - v7); - v13 = v8; - do - { - if ( v7 > 0 ) - { - v10 = v7; - do - { - if ( v5[*v6] ) - *(short *)v9 = v5[*v6]; - v9 = (char *)v9 + 2; - ++v6; - --v10; - } - while ( v10 ); - } - v9 = (char *)v9 + v12; - --v13; - } - while ( v13 ); - } - result = a2->Unlock( - v6, - a2, - a3); - } - LOBYTE(result) = 1; - return result;*/ - return 0; -} - -//----- (0046B289) -------------------------------------------------------- -bool AsyncMouse::_46B289(int a2, char a3) -{ - char v3; // dl@1 - bool result; // eax@33 - char v5; // [sp+2h] [bp-2h]@1 - char v6; // [sp+3h] [bp-1h]@1 - - v3 = *((char *)this + 93); - v6 = *((char *)this + 94); - v5 = *((char *)this + 95); - if ( a3 & 1 ) - { - *((char *)this + 93) = 1; - } - else - { - if ( v3 ) - *((char *)this + 99) = 1; - else - *((char *)this + 99) = 0; - *((char *)this + 93) = 0; - } - if ( a3 & 2 ) - { - *((char *)this + 94) = 1; - } - else - { - if ( v6 ) - *((char *)this + 100) = 1; - else - *((char *)this + 100) = 0; - *((char *)this + 94) = 0; - } - if ( a3 & 4 ) - { - *((char *)this + 95) = 1; - } - else - { - if ( v5 ) - *((char *)this + 101) = 1; - else - *((char *)this + 101) = 0; - *((char *)this + 95) = 0; - } - *((char *)this + 96) = v3 != *((char *)this + 93); - *((char *)this + 97) = v6 != *((char *)this + 94); - *((char *)this + 98) = v5 != *((char *)this + 95); - if ( *((char *)this + 99) && *((char *)this + 96) || *((char *)this + 100) && *((char *)this + 97) ) - *((char *)this + 102) = 1; - LOBYTE(result) = 1; - return result; -} - -//----- (0046B342) -------------------------------------------------------- -void AsyncMouse::SetHotspot(float hotspotx, float hotspoty) -{ - double v3; // ST00_8@1 - double v4; // ST00_8@1 - - v3 = hotspotx + 6.7553994e15; - *(int *)(this + 40) = LODWORD(v3); - v4 = hotspoty + 6.7553994e15; - *(int *)(this + 44) = LODWORD(v4); -} - -//----- (0046B37C) -------------------------------------------------------- -int AsyncMouse::UpdateData(int a2) -{ - __debugbreak(); - /* - void *v2; // edi@1 - int result; // eax@2 - int v4; // eax@3 - int v5; // esi@3 - std::string v6; // [sp-18h] [bp-28h]@2 - const char *v7; // [sp-8h] [bp-18h]@2 - int v8; // [sp-4h] [bp-14h]@2 - std::string *v9; // [sp+8h] [bp-8h]@2 - int a3; // [sp+Fh] [bp-1h]@2 - - v2 = this; - if ( *((int *)this + 33) ) - { - EnterCriticalSection(&pGame->pThreadWardInstance->cs3); - DirectInputMouse::_43BB89(*((DirectInputMouse **)v2 + 33)); - v4 = *((int *)v2 + 33); - v5 = v4 + 32; - _46B289(v4 + 32, *(int *)(v4 + 40)); - LeaveCriticalSection(&pGame->pThreadWardInstance->cs3); - result = a2; - *(int *)a2 = *(int *)v5; - *(int *)(a2 + 4) = *(int *)(v5 + 4); - } - else - { - MessageBoxW(nullptr, L"DI_Mouse pointer invalid bailing out from update_mouse_data()", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\MouseAsync.cpp:446", 0); - result = a2; - *(int *)a2 = 0; - *(int *)(a2 + 4) = 0; - } - return result;*/ - return 0; -} - -//----- (0046B420) -------------------------------------------------------- -char AsyncMouse::Thread() -{ - void *v1; // esi@1 - char result; // al@2 - int v3; // eax@3 - int v4; // ecx@3 - int v5; // eax@3 - int v6; // ecx@3 - int v7; // [sp+4h] [bp-8h]@3 - int v8; // [sp+8h] [bp-4h]@3 - - v1 = this; - if ( *((char *)this + 20) ) - { - result = 0; - } - else - { - UpdateData((int)&v7); - _46BA8D(v7, v8); - _46B958(v7 - *((int *)v1 + 10), v8 - *((int *)v1 + 11)); - _46B492((int)&v7); - _46B5D5((int)&v7); - v3 = v7; - v4 = v8; - *((int *)v1 + 6) = v7; - v5 = v3 - *((int *)v1 + 10); - *((int *)v1 + 7) = v4; - v6 = v4 - *((int *)v1 + 11); - *((int *)v1 + 8) = v5; - result = 1; - *((int *)v1 + 9) = v6; - } - return result; -} - -//----- (0046B492) -------------------------------------------------------- -void AsyncMouse::_46B492(int a2) -{ - __debugbreak(); - /* - void *v2; // edi@1 - int v3; // esi@3 - int v4; // eax@5 - int v5; // ecx@5 - int v6; // eax@8 - int v7; // ecx@8 - int v8; // eax@11 - int v9; // esi@11 - int v10; // [sp+Ch] [bp-1Ch]@5 - int v11; // [sp+10h] [bp-18h]@5 - int v12; // [sp+14h] [bp-14h]@5 - int v13; // [sp+18h] [bp-10h]@5 - int v14; // [sp+24h] [bp-4h]@5 - - v2 = this; - EnterCriticalSection(&pGame->pThreadWardInstance->csAsyncMouse); - if ( *((int *)v2 + 28) > 0x80u ) - _46BCAB((char *)v2 + 104); - v3 = a2; - if ( *((char *)v2 + 93) && *((char *)v2 + 96) ) - { - v4 = *(int *)a2; - v5 = *(int *)(a2 + 4); - v13 = 1; - v10 = 5080884; - v11 = v4; - v12 = v5; - v14 = 0; - AsyncMouse::unk_46BCD2((char *)v2 + 104, (int)&a2, *((int *)v2 + 27), (int)&v10); - v14 = -1; - } - if ( *((char *)v2 + 94) && *((char *)v2 + 97) ) - { - v6 = *(int *)v3; - v7 = *(int *)(v3 + 4); - v13 = 2; - v10 = 5080884; - v11 = v6; - v12 = v7; - v14 = 1; - AsyncMouse::unk_46BCD2((char *)v2 + 104, (int)&a2, *((int *)v2 + 27), (int)&v10); - v14 = -1; - } - if ( *((char *)v2 + 95) && *((char *)v2 + 98) ) - { - v8 = *(int *)v3; - v9 = *(int *)(v3 + 4); - v13 = 4; - v10 = 5080884; - v11 = v8; - v12 = v9; - v14 = 2; - AsyncMouse::unk_46BCD2((char *)v2 + 104, (int)&a2, *((int *)v2 + 27), (int)&v10); - } - LeaveCriticalSection(&pGame->pThreadWardInstance->csAsyncMouse);*/ -} - -//----- (0046B5D5) -------------------------------------------------------- -void AsyncMouse::_46B5D5(int a2) -{ - __debugbreak(); - /* - void *v2; // esi@1 - DWORD v3; // eax@3 - char v4; // zf@3 - int v5; // edi@3 - int v6; // eax@6 - int v7; // ecx@6 - int v8; // eax@11 - int v9; // ecx@11 - int v10; // eax@16 - int v11; // edi@16 - int (__stdcall **v12)(char); // [sp+Ch] [bp-20h]@6 - int v13; // [sp+10h] [bp-1Ch]@6 - int v14; // [sp+14h] [bp-18h]@6 - int v15; // [sp+18h] [bp-14h]@6 - DWORD v16; // [sp+1Ch] [bp-10h]@3 - int v17; // [sp+28h] [bp-4h]@6 - - v2 = this; - EnterCriticalSection(&pGame->pThreadWardInstance->csAsyncMouse); - if ( *((int *)v2 + 31) > 0x80u ) - _46BCAB((char *)v2 + 116); - v3 = timeGetTime(); - v4 = *((char *)v2 + 93) == 0; - v5 = a2; - v16 = v3; - if ( !v4 && *((char *)v2 + 96) ) - { - if ( v3 - *((int *)v2 + 19) < 0xFA ) - { - v6 = *(int *)a2; - v7 = *(int *)(a2 + 4); - v15 = 1; - v12 = &AsyncMouse::unk::vdtor_ptr; - v13 = v6; - v14 = v7; - v17 = 0; - AsyncMouse::unk_46BCD2((char *)v2 + 116, (int)&a2, *((int *)v2 + 30), (int)&v12); - v17 = -1; - v3 = v16; - } - *((int *)v2 + 19) = v3; - } - if ( *((char *)v2 + 94) && *((char *)v2 + 97) ) - { - if ( v3 - *((int *)v2 + 20) < 0xFA ) - { - v8 = *(int *)v5; - v9 = *(int *)(v5 + 4); - v15 = 2; - //v12 = &AsyncMouse::unk::vdtor_ptr; - v13 = v8; - v14 = v9; - v17 = 1; - AsyncMouse::unk_46BCD2((char *)v2 + 116, (int)&a2, *((int *)v2 + 30), (int)&v12); - v17 = -1; - v3 = v16; - } - *((int *)v2 + 20) = v3; - } - if ( *((char *)v2 + 95) && *((char *)v2 + 98) ) - { - if ( v3 - *((int *)v2 + 21) < 0xFA ) - { - v10 = *(int *)v5; - v11 = *(int *)(v5 + 4); - v15 = 4; - //v12 = &AsyncMouse::unk::vdtor_ptr; - v13 = v10; - v14 = v11; - v17 = 2; - AsyncMouse::unk_46BCD2((char *)v2 + 116, (int)&a2, *((int *)v2 + 30), (int)&v12); - v3 = v16; - } - *((int *)v2 + 21) = v3; - } - LeaveCriticalSection(&pGame->pThreadWardInstance->csAsyncMouse);*/ -} - -//----- (0046B736) -------------------------------------------------------- -void AsyncMouse::_46B736_consume_click_lists(char a2) -{ - __debugbreak(); - /* - void *v2; // esi@1 - - v2 = this; - _46B76F(); - _46B879(); - if ( a2 ) - { - _46BCAB((char *)v2 + 104); - _46BCAB((char *)v2 + 116); - } - if ( *((char *)v2 + 102) ) - { - back_to_game(); - *((char *)v2 + 102) = 0; - }*/ -} - -//----- (0046B76F) -------------------------------------------------------- -void AsyncMouse::_46B76F() -{ - __debugbreak(); - /* - char *v0; // ebx@1 - int v1; // eax@1 - int v2; // edi@1 - int v3; // eax@2 - unsigned int *v4; // esi@2 - unsigned int v5; // ST08_4@7 - unsigned int v6; // ST04_4@7 - float v7; // ST00_4@7 - unsigned int v8; // ST08_4@9 - unsigned int v9; // ST04_4@9 - float v10; // ST00_4@9 - - EnterCriticalSection(&pGame->pThreadWardInstance->csAsyncMouse); - v0 = (char *)pAsyncMouse + 108; - v1 = *((int *)pAsyncMouse + 27); - v2 = *(int *)v1; - if ( *(int *)v1 != v1 ) - { - do - { - v3 = *(int *)(v2 + 20); - v4 = (unsigned int *)(v2 + 12); - if ( v3 & 1 ) - { - pGame->PickMouse(512.0, *v4, *(int *)(v2 + 16), 0, &a3, &a4); - if ( GetCurrentMenuID() == 6 ) - UI_OnKeyDown(VK_SELECT); - UI_OnMouseLeftClick((int *)(v2 + 12)); - } - else - { - if ( v3 & 2 ) - { - v5 = *(int *)(v2 + 16); - v6 = *v4; - v7 = GetPickDepth(); - pGame->PickMouse(v7, v6, v5, 0, &stru_F93E30, &a5); - sub_416D62_ShowPopupWindow_MonsterRecord_ItemInfo_etcsub_416D62((Vec2_int_ *)(v2 + 12)); - } - else - { - if ( v3 & 4 ) - { - v8 = *(int *)(v2 + 16); - v9 = *v4; - v10 = GetPickDepth(); - pGame->PickMouse(v10, v9, v8, 1, &a3, &a5); - } - } - } - v2 = *(int *)v2; - } - while ( v2 != *(int *)v0 ); - } - LeaveCriticalSection(&pGame->pThreadWardInstance->csAsyncMouse);*/ -} - -//----- (0046B879) -------------------------------------------------------- -void AsyncMouse::_46B879() -{ - __debugbreak(); - /* - char *v0; // ebx@1 - int v1; // eax@1 - int v2; // edi@1 - int v3; // eax@2 - unsigned int *v4; // esi@2 - unsigned int v5; // ST08_4@5 - unsigned int v6; // ST04_4@5 - float v7; // ST00_4@5 - - EnterCriticalSection(&pGame->pThreadWardInstance->csAsyncMouse); - v0 = (char *)pAsyncMouse + 120; - v1 = *((int *)pAsyncMouse + 30); - v2 = *(int *)v1; - if ( *(int *)v1 != v1 ) - { - do - { - v3 = *(int *)(v2 + 20); - v4 = (unsigned int *)(v2 + 12); - if ( v3 & 1 ) - { - pGame->PickMouse(512.0, *v4, *(int *)(v2 + 16), 0, &a3, &a4); - sub_4178C4(); - } - else - { - if ( v3 & 2 ) - { - v5 = *(int *)(v2 + 16); - v6 = *v4; - v7 = GetPickDepth(); - pGame->PickMouse(v7, v6, v5, 0, &stru_F93E30, &a4); - sub_4178E1(); - } - else - { - if ( v3 & 4 ) - nullsub_1(); - } - } - v2 = *(int *)v2; - } - while ( v2 != *(int *)v0 ); - } - LeaveCriticalSection(&pGame->pThreadWardInstance->csAsyncMouse);*/ -} - -//----- (0046B944) -------------------------------------------------------- -int AsyncMouse::_46B944() -{ - __debugbreak(); - /* - void *v1; // esi@1 - - v1 = this; - _46BCAB((char *)this + 104); - return _46BCAB((char *)v1 + 116);*/ - return 0; -} -// 46BCAB: using guessed type int __thiscall AsyncMouse__46BCAB(int); - -//----- (0046B958) -------------------------------------------------------- -char AsyncMouse::_46B958(int a2, int a3) -{ - __debugbreak(); - /* - void *v3; // esi@1 - char result; // al@3 - int v5; // edx@6 - int v6; // eax@6 - int v7; // eax@12 - int v8; // edi@13 - int v9; // eax@19 - struct IDirectDrawSurface4 *v10; // ST08_4@21 - DDBLTFX v11; // [sp+4h] [bp-74h]@21 - RECT v12; // [sp+68h] [bp-10h]@19 - - v3 = this; - if ( pRenderer->pFrontBuffer4 && !pRenderer->pFrontBuffer4->IsLost() ) - { - EnterCriticalSection(&pGame->pThreadWardInstance->cs2); - if ( *((char *)v3 + 88) ) - pRenderer->pFrontBuffer4->BltFast( - *((int *)v3 + 8), - *((int *)v3 + 9), - (LPDIRECTDRAWSURFACE4)*((int *)v3 + 2), - (LPRECT)((char *)v3 + 48), - 16u); - v5 = 640 - a2; - v6 = 640 - a2; - if ( 640 - a2 >= 31 ) - v6 = 31; - if ( v6 >= 0 ) - { - if ( v5 >= 31 ) - v5 = 31; - } - else - { - v5 = 0; - } - v7 = 480 - a3; - if ( 480 - a3 >= 31 ) - v8 = 31; - else - v8 = 480 - a3; - if ( v8 >= 0 ) - { - if ( v7 >= 31 ) - v7 = 31; - } - else - { - v7 = 0; - } - *((int *)v3 + 13) = 0; - *((int *)v3 + 14) = v5; - v12.right = a2 + v5; - *((int *)v3 + 12) = 0; - *((int *)v3 + 15) = v7; - v12.left = a2; - v12.bottom = a3 + v7; - v9 = *((int *)v3 + 2); - v12.top = a3; - (*(void (__stdcall **)(int, int, int, IDirectDrawSurface4 *, RECT *, signed int))(*(int *)v9 + 28))( - v9, - 0, - 0, - pRenderer->pFrontBuffer4, - &v12, - 16); - if ( !*((char *)v3 + 90) || *((char *)v3 + 128) & 1 ) - { - v10 = (struct IDirectDrawSurface4 *)*((int *)v3 + 1); - v11.dwSize = 100; - v11.dwDDFX = 8; - pRenderer->pFrontBuffer4->Blt( - &v12, - v10, - (LPRECT)((char *)v3 + 48), - 16812032u, - &v11); - } - *((char *)v3 + 88) = 1; - LeaveCriticalSection(&pGame->pThreadWardInstance->cs2); - result = 1; - } - else - { - result = 0; - } - return result;*/ - return 0; -} - -//----- (0046BA8D) -------------------------------------------------------- -char AsyncMouse::_46BA8D(int a2, int a3) -{ - __debugbreak(); - /* - void *v3; // esi@1 - DWORD v4; // eax@1 - - v3 = this; - v4 = timeGetTime(); - if ( v4 - *((int *)v3 + 16) <= 0x32 ) - { - *((char *)v3 + 91) = *((char *)v3 + 90) == 1; - *((char *)v3 + 90) = 0; - } - else - { - if ( *((char *)v3 + 90) ) - *((char *)v3 + 91) = 0; - else - *((char *)v3 + 91) = 1; - *((char *)v3 + 90) = 1; - } - if ( a2 != *((int *)v3 + 17) || a3 != *((int *)v3 + 18) ) - { - *((int *)v3 + 16) = v4; - *((int *)v3 + 17) = a2; - *((int *)v3 + 18) = a3; - } - return *((char *)v3 + 90);*/ - return 0; -} - -//----- (0046BAEC) -------------------------------------------------------- -void AsyncMouse::_46BAEC() -{ - void *v1; // esi@1 - - v1 = this; - EnterCriticalSection(&pGame->pThreadWardInstance->cs2); - *((char *)v1 + 88) = 0; -} - -//----- (0046BB0A) -------------------------------------------------------- -void AsyncMouse::_46BB0A() -{ - __debugbreak(); - /* - void *v1; // esi@1 - int v2; // eax@1 - int v3; // edx@1 - int v4; // ecx@1 - int v5; // edx@1 - int v6; // eax@1 - char v7; // zf@1 - struct IDirectDrawSurface4 *v8; // ST08_4@8 - int v9; // [sp+8h] [bp-74h]@8 - int v10; // [sp+Ch] [bp-70h]@8 - int v11; // [sp+6Ch] [bp-10h]@1 - int v12; // [sp+70h] [bp-Ch]@1 - int v13; // [sp+74h] [bp-8h]@1 - int v14; // [sp+78h] [bp-4h]@1 - - v1 = this; - v2 = *((int *)this + 17) - *((int *)this + 10); - v3 = *((int *)this + 14); - v4 = *((int *)this + 18) - *((int *)this + 11); - v11 = v2; - v5 = v2 + v3; - v6 = *((int *)v1 + 15); - v12 = v4; - v7 = *((char *)v1 + 90) == 0; - v13 = v5; - v14 = v4 + v6; - if ( v7 || *((char *)v1 + 128) & 1 ) - { - if ( *((char *)v1 + 88) ) - pRenderer->pFrontBuffer4->BltFast( - *((int *)v1 + 8), - *((int *)v1 + 9), - (LPDIRECTDRAWSURFACE4)*((int *)v1 + 2), - (LPRECT)((char *)v1 + 48), - 16u); - (*(void (__stdcall **)(int, int, int, IDirectDrawSurface4 *, int *, signed int))(**((int **)v1 + 2) + 28))( - *((int *)v1 + 2), - 0, - 0, - pRenderer->pFrontBuffer4, - &v11, - 16); - } - if ( *((char *)v1 + 90) && !(*((char *)v1 + 128) & 1) ) - { - v8 = (struct IDirectDrawSurface4 *)*((int *)v1 + 1); - v9 = 100; - v10 = 8; - pRenderer->pFrontBuffer4->Blt( - (LPRECT)&v11, - v8, - (LPRECT)((char *)v1 + 48), - 16812032u, - (LPDDBLTFX)&v9); - } - LeaveCriticalSection(&pGame->pThreadWardInstance->cs2);*/ -} - -//----- (0046BBD0) -------------------------------------------------------- -void *AsyncMouse::Clip() -{ - __debugbreak(); - /* - void *result; // eax@1 - std::string v1; // [sp-18h] [bp-30h]@2 - const char *v2; // [sp-8h] [bp-20h]@2 - int v3; // [sp-4h] [bp-1Ch]@2 - RECT Rect; // [sp+0h] [bp-18h]@1 - std::string *v5; // [sp+10h] [bp-8h]@2 - int a3; // [sp+17h] [bp-1h]@2 - - SetWindowPos(hWnd, HWND_MESSAGE|0x2, 320, 240, 640, 480, 0); - Rect.left = 325; - Rect.top = 245; - Rect.right = 326; - Rect.bottom = 246; - result = (void *)ClipCursor(&Rect); - if ( !result ) - { - MessageBoxW(nullptr, L"Could not clip cursor to screen!", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\MouseAsync.cpp:827", 0); - } - return result;*/ - return 0; -} - -//----- (0046BC4E) -------------------------------------------------------- -void __stdcall AsyncMouse::AsyncMouseThread(int a1) -{ - __debugbreak(); - /* - while ( 1 ) - { - while ( !pAsyncMouse ) - Sleep(1); - if ( !AsyncMouse::Thread(pAsyncMouse) ) - ExitThread(0); - Sleep(18); - }*/ -} - -//----- (0046BC73) -------------------------------------------------------- -void AsyncMouse::dtor_sub_46BC73() -{ - __debugbreak(); - /* - int v1; // edi@1 - void **v2; // ebx@1 - void *v3; // esi@1 - void *v4; // eax@2 - int v5; // [sp+0h] [bp-4h]@1 - - v5 = this; - v1 = this; - v2 = *(void ***)(this + 4); - v3 = *v2; - while ( v3 != v2 ) - { - v4 = v3; - v3 = *(void **)v3; - AsyncMouse::unk_46BD2D((void *)v1, (int)&v5, v4); - } - free(*(void **)(v1 + 4)); - *(int *)(v1 + 4) = 0; - *(int *)(v1 + 8) = 0;*/ -} - -//----- (0046BCAB) -------------------------------------------------------- -int AsyncMouse::_46BCAB() -{ - __debugbreak(); - /* - void *v1; // ebx@1 - void **v2; // edi@1 - void *v3; // esi@1 - void *v4; // eax@2 - int result; // eax@2 - int v6; // [sp+0h] [bp-4h]@1 - - v6 = this; - v1 = (void *)this; - v2 = *(void ***)(this + 4); - v3 = *v2; - while ( v3 != v2 ) - { - v4 = v3; - v3 = *(void **)v3; - result = AsyncMouse::unk_46BD2D(v1, (int)&v6, v4); - } - return result;*/ - return 0; -} -// 46BCAB: using guessed type int __thiscall AsyncMouse__46BCAB(int); - -//----- (0046BCD2) -------------------------------------------------------- -int AsyncMouse::unk_46BCD2(int a2, int a3, int a4) -{ - __debugbreak(); - /* - void *v4; // edi@1 - void *v5; // eax@1 - void *v6; // esi@1 - int result; // eax@1 - - v4 = this; - v5 = AsyncMouse::unk_46BD09((void *)a3, *(void **)(a3 + 4)); - v6 = v5; - *(int *)(a3 + 4) = v5; - **((int **)v5 + 1) = v5; - AsyncMouse::unk_46BD66((char *)v5 + 8, a4); - result = a2; - ++*((int *)v4 + 2); - *(int *)a2 = v6; - return result;*/ - return 0; -} -// 46BD66: using guessed type int __fastcall AsyncMouse__unk__46BD66(int, int); - -//----- (0046BD09) -------------------------------------------------------- -void *AsyncMouse::unk_46BD09(void *a1, void *a2) -{ - __debugbreak(); - /* - void *result; // eax@1 - void *v3; // ecx@1 - void *v4; // ecx@3 - - result = operator new(0x18u); - v3 = a1; - if ( !a1 ) - v3 = result; - *(int *)result = v3; - v4 = a2; - if ( !a2 ) - v4 = result; - *((int *)result + 1) = v4; - return result;*/ - return 0; -} - -//----- (0046BD2D) -------------------------------------------------------- -int AsyncMouse::unk_46BD2D(int a2, void *a3) -{ - __debugbreak(); - /* - void *v3; // edi@1 - int v4; // ebx@1 - int result; // eax@1 - - v3 = this; - v4 = *(int *)a3; - **((int **)a3 + 1) = *(int *)a3; - *(int *)(*(int *)a3 + 4) = *((int *)a3 + 1); - (**((void (__stdcall ***)(int))a3 + 2))(0); - free(a3); - result = a2; - --*((int *)v3 + 2); - *(int *)a2 = v4; - return result;*/ - return 0; -} - -//----- (0046BD66) -------------------------------------------------------- -int AsyncMouse::unk_46BD66(int a1, int a2) -{ - int result; // eax@2 - - if ( a1 ) - { - *(int *)(a1 + 4) = *(int *)(a2 + 4); - *(int *)(a1 + 8) = *(int *)(a2 + 8); - result = *(int *)(a2 + 12); - *(int *)(a1 + 12) = result; - //*(int *)a1 = &AsyncMouse::unk::vdtor_ptr; - } - return result; -} -// 46BD66: using guessed type int __fastcall AsyncMouse__unk__46BD66(int, int); -// 4D8734: using guessed type int (__stdcall *AsyncMouse__unk__vdtor_ptr)(char); - - - - - - - - - - - - - - - - - - - -/* -//----- (0043B9FF) -------------------------------------------------------- -DirectInputMouse *__thiscall DirectInputMouse::DirectInputMouse(DirectInputMouse *this) -{ - DirectInputMouse *v1; // esi@1 - HRESULT v2; // eax@5 - signed int v4; // [sp-18h] [bp-24h]@3 - char *v5; // [sp-14h] [bp-20h]@3 - int v6; // [sp-10h] [bp-1Ch]@3 - const char *v7; // [sp-Ch] [bp-18h]@3 - int v8; // [sp-8h] [bp-14h]@3 - unsigned int v9; // [sp-4h] [bp-10h]@3 - CheckHRESULT_stru0 v10; // [sp+8h] [bp-4h]@5 - - v1 = this; - this->field_8 = 0; - LOBYTE(this->field_1C) = 0; - this->field_28 = 0; - this->vdestructor_ptr = (int)&DirectInputMouse_pvdtor; - if ( pVersion->pVersionInfo.dwPlatformId != VER_PLATFORM_WIN32_NT || pVersion->pVersionInfo.dwMajorVersion != 4 ) - { - v9 = 1; - v8 = 30; - v7 = "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\DirectInputMouse.cpp"; - v6 = 0; - v5 = (char *)&this->pDirectInput; - v4 = 1280; - } - else - { - v9 = 1; - v8 = 28; - v7 = "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\DirectInputMouse.cpp"; - v6 = 0; - v5 = (char *)&this->pDirectInput; - v4 = 768; - } - v2 = DirectInputCreateA(hInstance, v4, v5, v6); - CheckHRESULT(&v10, v2, v7, v8, v9); - DirectInputMouse::CreateDevice(v1); - DirectInputMouse::43BB18(v1); - v1->field_20 = 0; - v1->field_24 = 0; - return v1; -} -// 4C8880: using guessed type int __stdcall DirectInputCreateA(int, int, int, int); -// 4D8608: using guessed type int (__stdcall *DirectInputMouse_pvdtor)(char); - -//----- (0043BA80) -------------------------------------------------------- -void *__thiscall DirectInputMouse::vdtor(void *this, bool a2) -{ - void *v2; // esi@1 - - v2 = this; - DirectInputMouse::dtor(this); - if ( a2 & 1 ) - free(v2); - return v2; -} - -//----- (0043BA9C) -------------------------------------------------------- -int __thiscall DirectInputMouse::dtor(void *this) -{ - void *v1; // esi@1 - int v2; // eax@1 - int result; // eax@3 - - v1 = this; - v2 = *((int *)this + 2); - *(int *)this = &DirectInputMouse_pvdtor; - if ( v2 ) - { - (*(void (__stdcall **)(int))(*(int *)v2 + 32))(v2); - (*(void (__stdcall **)(int))(**((int **)v1 + 2) + 8))(*((int *)v1 + 2)); - *((int *)v1 + 2) = 0; - } - result = (*(int (__stdcall **)(int))(**((int **)v1 + 1) + 8))(*((int *)v1 + 1)); - *((int *)v1 + 1) = 0; - return result; -} -// 4D8608: using guessed type int (__stdcall *DirectInputMouse_pvdtor)(char); - -//----- (0043BACE) -------------------------------------------------------- -void __thiscall DirectInputMouse::CreateDevice(DirectInputMouse *this) -{ - DirectInputMouse *v1; // esi@1 - HRESULT v2; // eax@1 - CheckHRESULT_stru0 v3; // [sp+4h] [bp-4h]@1 - - v1 = this; - v2 = ((int (__stdcall *)(int, int, int, int, int))this->pDirectInput->lpVtbl->field_10)( - this->pDirectInput, - 2, - DirectInputMouse_enumerator, - this, - 1); - CheckHRESULT(&v3, v2, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\DirectInputMouse.cpp", 57, 1u); - if ( !LOBYTE(v1->field_1C) ) - { - v3.vdestructor_ptr = (void (__thiscall ***)(CheckHRESULT_stru0 *, bool))"Error: No mouse found"; - _CxxThrowException((int)&v3, (int)&dword_4DBD94); - } -} -// 43BC61: using guessed type int __stdcall DirectInputMouse_enumerator(int, int); -// 4DBD94: using guessed type int dword_4DBD94; - -//----- (0043BB18) -------------------------------------------------------- -int __thiscall DirectInputMouse::43BB18(DirectInputMouse *this) -{ - char *v1; // esi@1 - HRESULT v2; // eax@1 - HRESULT v3; // eax@1 - HRESULT v4; // eax@1 - unsigned int v6; // [sp+0h] [bp-Ch]@0 - CheckHRESULT_stru0 v7; // [sp+8h] [bp-4h]@1 - - v1 = (char *)&this->field_8; - v2 = ((int (__stdcall *)(int, int, int, int, int))this->pDirectInput->lpVtbl->field_C)( - this->pDirectInput, - &this->field_C, - &this->field_8, - 0, - "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\DirectInputMouse.cpp"); - CheckHRESULT(&v7, v2, (const char *)0x40, 1, v6); - v3 = (*(int (__stdcall **)(int, int))(**(int **)v1 + 44))(*(int *)v1, dword_4C9920); - CheckHRESULT(&v7, v3, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\DirectInputMouse.cpp", 65, 1u); - v4 = (*(int (__stdcall **)(int, int, int))(**(int **)v1 + 52))(*(int *)v1, hWnd, 6); - CheckHRESULT(&v7, v4, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\DirectInputMouse.cpp", 66, 1u); - return (*(int (__cdecl **)(int))(**(int **)v1 + 28))(*(int *)v1); -} -// 4C9920: using guessed type int dword_4C9920[16]; - -//----- (0043BB89) -------------------------------------------------------- -bool __thiscall DirectInputMouse::43BB89(DirectInputMouse *this) -{ - DirectInputMouse *v1; // esi@1 - bool result; // eax@1 - HRESULT v3; // eax@5 - __int32 v4; // ecx@6 - __int32 v5; // eax@6 - __int32 v6; // edx@6 - int v7; // ecx@12 - bool v8; // ecx@12 - signed int v9; // edx@12 - HRESULT a2; // [sp+4h] [bp-14h]@3 - int v11; // [sp+8h] [bp-10h]@12 - char v12; // [sp+10h] [bp-8h]@18 - char v13; // [sp+11h] [bp-7h]@20 - char v14; // [sp+12h] [bp-6h]@22 - char v15; // [sp+13h] [bp-5h]@24 - char v18; // [sp+14h] [bp-4h]@5 - - v1 = this; - result = this->field_8; - if ( result ) - { - if ( (*(int (__stdcall **)(bool, signed int, HRESULT *))(*(int *)result + 36))(result, 16, &a2) == -2147024866 - && !(*(int (__stdcall **)(int))(*(int *)v1->field_8 + 28))(v1->field_8) ) - { - v3 = (*(int (__stdcall **)(int, signed int, HRESULT *))(*(int *)v1->field_8 + 36))(v1->field_8, 16, &a2); - CheckHRESULT((CheckHRESULT_stru0 *)&v18, v3, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\DirectInputMouse.cpp", 80, 1u); - } - v4 = v1->field_20 + a2; - v5 = 640; - v6 = v1->field_20 + a2; - if ( v4 >= 640 ) - v6 = 640; - if ( v6 >= 0 ) - { - if ( v4 < 640 ) - v5 = v1->field_20 + a2; - } - else - { - v5 = 0; - } - v7 = v11; - v1->field_20 = v5; - v8 = v1->field_24 + v7; - result = 480; - v9 = v8; - if ( v8 >= 480 ) - v9 = 480; - if ( v9 >= 0 ) - { - if ( v8 < 480 ) - result = v8; - } - else - { - result = 0; - } - v1->field_28 = 0; - v1->field_24 = result; - if ( v12 & 0x80 ) - v1->field_28 = 1; - if ( v13 & 0x80 ) - v1->field_28 |= 2u; - if ( v14 & 0x80 ) - v1->field_28 |= 4u; - if ( v15 & 0x80 ) - v1->field_28 |= 8u; - LOBYTE(result) = 1; - } - else - { - LOBYTE(result) = 0; - } - return result; -} - -//----- (0043BC61) -------------------------------------------------------- -signed int __stdcall DirectInputMouse_enumerator(int a1, int a2) -{ - signed int result; // eax@2 - - if ( *(char *)(a1 + 36) & 2 ) - { - *(int *)(a2 + 12) = *(int *)(a1 + 4); - *(int *)(a2 + 16) = *(int *)(a1 + 8); - *(int *)(a2 + 20) = *(int *)(a1 + 12); - *(int *)(a2 + 24) = *(int *)(a1 + 16); - *(char *)(a2 + 28) = 1; - result = 0; - } - else - { - result = 1; - } - return result; -} -// 43BC61: using guessed type int __stdcall DirectInputMouse_enumerator(int, int); -*/ \ No newline at end of file
--- a/Mouse.h Thu May 23 11:16:46 2013 +0600 +++ b/Mouse.h Thu May 23 11:17:01 2013 +0600 @@ -135,53 +135,7 @@ #pragma pack(pop) -#pragma pack(push, 1) -struct AsyncMouse -{ - AsyncMouse(struct IDirectDrawSurface *); - ~AsyncMouse(); - - char Initialize(LPVOID lpParameter); - char LoadCursor(const char *pContainer); - char LoadCursorImage(); - char _46B072(); - char CreateDisrectInputMouse(); - int _46B0ED(); - void Resume(); - void Suspend(); - char _46B1DD(); - bool DrawCursor(struct Texture *a1, struct IDirectDrawSurface4 *a2, int a3); - bool _46B289(int a2, char a3); - void SetHotspot(float hotspotx, float hotspoty); - int UpdateData(int a2); - char Thread(); - void _46B492(int a2); - void _46B5D5(int a2); - void _46B736_consume_click_lists(char a2); - void _46B76F(); - void _46B879(); - int _46B944(); - char _46B958(int a2, int a3); - char _46BA8D(int a2, int a3); - void _46BAEC(); - void _46BB0A(); - void *Clip(); - void dtor_sub_46BC73(); - int _46BCAB(); - int unk_46BCD2(int a2, int a3, int a4); - void *unk_46BD09(void *a1, void *a2); - int unk_46BD2D(int a2, void *a3); - int unk_46BD66(int a1, int a2); - - static void __stdcall AsyncMouseThread(int a1); - - void _409E3D(char a2); - void Release(); -}; -#pragma pack(pop) - -extern Mouse *pMouse; -extern AsyncMouse *pAsyncMouse; \ No newline at end of file +extern Mouse *pMouse; \ No newline at end of file
--- a/OSAPI.cpp Thu May 23 11:16:46 2013 +0600 +++ b/OSAPI.cpp Thu May 23 11:17:01 2013 +0600 @@ -6,6 +6,7 @@ OSVersion *pVersion = nullptr; + //----- (00462C94) -------------------------------------------------------- int __stdcall wWinMain(HINSTANCE hInstance, HINSTANCE, wchar_t *lpCmdLine, int nShowCmd) {
--- a/Party.cpp Thu May 23 11:16:46 2013 +0600 +++ b/Party.cpp Thu May 23 11:17:01 2013 +0600 @@ -28,6 +28,26 @@ + + +//----- (0044A56A) -------------------------------------------------------- +void Party::CountHirelings() +{ + field_70A = 0; + + for (int i = 0; i < pNPCStats->uNumNewNPCs; ++i) + { + auto npc = pNPCStats->pNewNPCData + i; + if (npc->Hired() && + (!pHirelings[0].pName || strcmp(npc->pName, pHirelings[0].pName))) + { + if (!pHirelings[1].pName || strcmp(npc->pName, pHirelings[1].pName)) + ++field_70A; + } + } +} + + // inlined //----- (mm6c::004858D0) -------------------------------------------------- void Party::Zero() @@ -786,17 +806,17 @@ pPartyBuffs[i].Reset(); - pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 100; + pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 100; // default character ui - stats uFlags = 0; memset(_autonote_bits, 0, 12); memset(_quest_bits, 0, 64); memset(pIsArtifactFound, 0, 29); - _449B7E_toggle_bit(_quest_bits, 1, 1); - _449B7E_toggle_bit(_quest_bits, 2, 1); - _449B7E_toggle_bit(_quest_bits, 3, 1); - _449B7E_toggle_bit(_quest_bits, 4, 1); - _449B7E_toggle_bit(_quest_bits, 5, 1); - _449B7E_toggle_bit(_quest_bits, 6, 1); + _449B7E_toggle_bit(_quest_bits, PARTY_QUEST_EMERALD_RED_POTION_ACTIVE, 1); + _449B7E_toggle_bit(_quest_bits, PARTY_QUEST_EMERALD_SEASHELL_ACTIVE, 1); + _449B7E_toggle_bit(_quest_bits, PARTY_QUEST_EMERALD_LONGBOW_ACTIVE, 1); + _449B7E_toggle_bit(_quest_bits, PARTY_QUEST_EMERALD_PLATE_ACTIVE, 1); + _449B7E_toggle_bit(_quest_bits, PARTY_QUEST_EMERALD_LUTE_ACTIVE, 1); + _449B7E_toggle_bit(_quest_bits, PARTY_QUEST_EMERALD_HAT_ACTIVE, 1); memset(field_3C._shop_ban_times,0,53*sizeof(__int64)); @@ -828,7 +848,7 @@ v0 = pActors;//[0].pMonsterInfo.uMovementType; do { - if ( v0->Actor::CanAct() && v0->pMonsterInfo.uHostilityType != 4 && v0->pMonsterInfo.uMovementType != 5 ) + if ( v0->Actor::CanAct() && v0->pMonsterInfo.uHostilityType != MonsterInfo::Hostility_Long && v0->pMonsterInfo.uMovementType != 5 ) { v1 = abs(v0->vPosition.x - pParty->vPosition.x); v2 = abs(v0->vPosition.y - pParty->vPosition.y); @@ -1015,8 +1035,8 @@ memset(hireling, 0, sizeof(*hireling)); pParty->field_709 = 0; - Party__CountHirelings(); - viewparams->bRedrawGameUI = 1; + pParty->CountHirelings(); + viewparams->bRedrawGameUI = true; } } }
--- a/Party.h Thu May 23 11:16:46 2013 +0600 +++ b/Party.h Thu May 23 11:17:01 2013 +0600 @@ -10,6 +10,13 @@ enum PARTY_QUEST_BITS: unsigned __int32 { + PARTY_QUEST_EMERALD_RED_POTION_ACTIVE = 1, + PARTY_QUEST_EMERALD_SEASHELL_ACTIVE = 2, + PARTY_QUEST_EMERALD_LONGBOW_ACTIVE = 3, + PARTY_QUEST_EMERALD_PLATE_ACTIVE = 4, + PARTY_QUEST_EMERALD_LUTE_ACTIVE = 5, + PARTY_QUEST_EMERALD_HAT_ACTIVE = 6, + PARTY_QUEST_EVENMORN_MAP_FOUND = 64, PARTY_QUEST_FINISHED_EMERALD_ISLE = 136, PARTY_QUEST_FOUNTAIN_HARMONDALE = 206, @@ -163,6 +170,7 @@ bool _497FC5_check_party_perception_against_level(); bool AddItem(ItemGen *pItem); void Yell(); + void CountHirelings(); static void SetGold(unsigned int uNumGold); static void TakeGold(unsigned int uNumGold);
--- a/Player.cpp Thu May 23 11:16:46 2013 +0600 +++ b/Player.cpp Thu May 23 11:17:01 2013 +0600 @@ -103,14 +103,14 @@ unsigned char pAgeingSpeedMultiplier[4] = {100, 100, 40, 10}; unsigned char pAgeingLuckMultiplier[4] = {100, 100, 100, 100}; -unsigned int pAgeingTable[4] = {50, 100, 150, 65535}; +signed int pAgeingTable[4] = {50, 100, 150, 0xFFFF}; unsigned int pConditionImportancyTable[18] = {16, 15, 14, 17, 13, 2, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 1, 0}; -short word_4EDFFC[30] = {500, 400, 350, 300, 275, 250, 225, 200, 175, +short param_to_bonus_table[29] = {500, 400, 350, 300, 275, 250, 225, 200, 175, 150, 125, 100, 75, 50, 40, 35, 30, 25, 21, - 19, 17, 15, 13, 11, 9, 7, 5, 3, 0, 0}; -signed int player_stat_bonuses[30] = {30, 25, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, -1, -2, -3, -4, -5, -6, 0}; + 19, 17, 15, 13, 11, 9, 7, 5, 3, 0}; +signed int parameter_to_bonus_value[29] = {30, 25, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, -1, -2, -3, -4, -5, -6}; unsigned char pEquipTypeToBodyAnchor[20] = {1, 1, 2, 3, 0, 4, 5, 6, 7, 8, 10, 9, 1, 0, 0, 0, 0, 0, 0, 0}; @@ -264,9 +264,9 @@ //----- (004B8040) -------------------------------------------------------- -int Player::_4B8040_condition_time(unsigned int uCondition) -{ - return (unsigned int)((signed __int64)((double)this->pConditions[uCondition] * 0.234375) / 60 / 60) / 0x18 % 7 + 1; +int Player::GetConditionDayOfWeek( unsigned int uCondition ) + { + return (unsigned int)(((signed __int64)((double)this->pConditions[uCondition] * 0.234375) / 60 / 60) / 24) % 7 + 1; } //----- (004B807C) -------------------------------------------------------- @@ -298,7 +298,7 @@ v10 = 10; v9 = 16; LABEL_6: - v11 = _4B8040_condition_time(v9); + v11 = GetConditionDayOfWeek(v9); goto LABEL_13; } } @@ -306,7 +306,7 @@ v5 = 0; do { - v6 = _4B8040_condition_time(v5); + v6 = GetConditionDayOfWeek(v5); if ( v6 > v4 ) v4 = v6; ++v5; @@ -2574,42 +2574,41 @@ //----- (0048CC33) -------------------------------------------------------- int Player::GetActualLuck() { - Player *v1; // esi@1 - unsigned int v2; // eax@7 - signed int v3; // ecx@7 - signed int v4; // ebx@10 - int v5; // edi@11 - int v6; // ebp@11 - signed int v8; // [sp+10h] [bp-4h]@1 - - v8 = 0; - v1 = this; + signed int curr_age; // eax@7 + signed int i; // ecx@7 + signed int age_luck_pc; // ebx@10 + int condition_luck_pc; // edi@11 + int items_luck_bonus; // ebp@11 + signed int npc_luck_bonus; // [sp+10h] [bp-4h]@1 + signed int magic_luck_bonus; // [sp+10h] [bp-4h]@1 + int full_luck; + + npc_luck_bonus = 0; if ( CheckHiredNPCSpeciality(Fool) ) - v8 = 5; + npc_luck_bonus = 5; if ( CheckHiredNPCSpeciality(ChimneySweep) ) - v8 += 20; + npc_luck_bonus += 20; if ( CheckHiredNPCSpeciality(Psychic) ) - v8 += 10; - v2 = v1->sAgeModifier + GetBaseAge(); - v3 = 0; - while ( (signed int)v2 >= (signed int)pAgeingTable[v3] ) - { - ++v3; - if ( v3 >= 4 ) - { - v4 = 100; - goto LABEL_11; - } - } - v4 = pAgeingLuckMultiplier[v3]; -LABEL_11: - v5 = pConditionLuckMultiplier[GetMajorConditionIdx()]; - v6 = GetItemsBonus(CHARACTER_ATTRIBUTE_LUCK, 0); - return GetMagicalBonus(CHARACTER_ATTRIBUTE_LUCK) - + v6 - + v8 - + v5 * v4 * v1->uLuck / 100 / 100 - + v1->uLuckBonus; + npc_luck_bonus += 10; + curr_age = sAgeModifier + GetBaseAge(); + i = 0; + while ( curr_age >= pAgeingTable[i] ) + { + ++i; + if ( i >= 4 ) + break; + } + if (i < 4) + age_luck_pc = pAgeingLuckMultiplier[i]; + else + age_luck_pc = 100; + + condition_luck_pc = pConditionLuckMultiplier[GetMajorConditionIdx()]; + items_luck_bonus = GetItemsBonus(CHARACTER_ATTRIBUTE_LUCK, 0); + magic_luck_bonus = GetMagicalBonus(CHARACTER_ATTRIBUTE_LUCK); + full_luck = magic_luck_bonus + items_luck_bonus + npc_luck_bonus+ uLuckBonus + + condition_luck_pc * age_luck_pc * uLuck / 100 / 100; + return full_luck; } //----- (0048CCF5) -------------------------------------------------------- @@ -2623,7 +2622,7 @@ v2 = this; v3 = GetActualAccuracy(); - v4 = _48EA1B_get_static_effect(v3); + v4 = GetParameterBonus(v3); v5 = GetSkillBonus(CHARACTER_ATTRIBUTE_ATTACK); v6 = GetItemsBonus(CHARACTER_ATTRIBUTE_ATTACK, a2); return v4 + v5 + v6 + GetMagicalBonus(CHARACTER_ATTRIBUTE_ATTACK) + v2->_some_attack_bonus; @@ -2640,15 +2639,14 @@ int v6; // esi@1 signed int result; // eax@1 - v1 = this; + v2 = GetActualMight(); - v3 = _48EA1B_get_static_effect(v2); + v3 = GetParameterBonus(v2); v4 = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MIN, 0) + v3; v5 = GetSkillBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS) + v4; - v6 = v1->_melee_dmg_bonus + GetMagicalBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS) + v5; - result = 1; - if ( v6 >= 1 ) - result = v6; + result = _melee_dmg_bonus + GetMagicalBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS) + v5; + if ( result < 1 ) + result = 1; return result; } @@ -2665,7 +2663,7 @@ v1 = this; v2 = GetActualMight(); - v3 = _48EA1B_get_static_effect(v2); + v3 = GetParameterBonus(v2); v4 = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MAX, 0) + v3; v5 = GetSkillBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS) + v4; v6 = v1->_melee_dmg_bonus + GetMagicalBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS) + v5; @@ -2868,7 +2866,7 @@ if ( !a2 ) { v22 = GetActualMight(); - v23 = _48EA1B_get_static_effect(v22); + v23 = GetParameterBonus(v22); v24 = GetSkillBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS) + v23; v21 += v5->_melee_dmg_bonus + GetMagicalBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS) + v24; } @@ -2894,7 +2892,7 @@ if ( v2 < 64 || v2 > 65 ) { v4 = GetActualAccuracy(); - v5 = _48EA1B_get_static_effect(v4); + v5 = GetParameterBonus(v4); v6 = GetItemsBonus(CHARACTER_ATTRIBUTE_RANGED_ATTACK, 0) + v5; v7 = GetSkillBonus(CHARACTER_ATTRIBUTE_RANGED_ATTACK) + v6; v3 = v1->_ranged_atk_bonus + GetMagicalBonus(CHARACTER_ATTRIBUTE_RANGED_ATTACK) + v7; @@ -2917,9 +2915,9 @@ int result; // eax@6 v1 = this; - v2 = GetItemsBonus(CHARACTER_ATTRIBUTE_RANGED_DAMAGE_MIN, 0); - v3 = GetSkillBonus(CHARACTER_ATTRIBUTE_RANGED_DAMAGE_BONUS) + v2; - v4 = v1->_ranged_dmg_bonus + GetMagicalBonus(CHARACTER_ATTRIBUTE_RANGED_DAMAGE_BONUS) + v3; + v2 = GetItemsBonus(CHARACTER_ATTRIBUTE_RANGED_DMG_MIN, 0); + v3 = GetSkillBonus(CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS) + v2; + v4 = v1->_ranged_dmg_bonus + GetMagicalBonus(CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS) + v3; v5 = v1->pActiveSkills[5]; if ( v5 && (signed int)SkillToMastery(v5) >= 4 && HasItemEquipped(EQUIP_BOW) ) v4 += v1->pActiveSkills[5] & 0x3F; @@ -2941,9 +2939,9 @@ int result; // eax@6 v1 = this; - v2 = GetItemsBonus(CHARACTER_ATTRIBUTE_RANGED_DAMAGE_MAX, 0); - v3 = GetSkillBonus(CHARACTER_ATTRIBUTE_RANGED_DAMAGE_BONUS) + v2; - v4 = v1->_ranged_dmg_bonus + GetMagicalBonus(CHARACTER_ATTRIBUTE_RANGED_DAMAGE_BONUS) + v3; + v2 = GetItemsBonus(CHARACTER_ATTRIBUTE_RANGED_DMG_MAX, 0); + v3 = GetSkillBonus(CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS) + v2; + v4 = v1->_ranged_dmg_bonus + GetMagicalBonus(CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS) + v3; v5 = v1->pActiveSkills[5]; if ( v5 && (signed int)SkillToMastery(v5) >= 4 && HasItemEquipped(EQUIP_BOW) ) v4 += v1->pActiveSkills[5] & 0x3F; @@ -3038,114 +3036,97 @@ //----- (0048D2EA) -------------------------------------------------------- char *Player::GetMeleeDamageString() { - Player *v1; // esi@1 - signed int v2; // eax@1 - signed int v3; // edi@3 - signed int v4; // eax@3 - signed int v5; // ST0C_4@6 - char *v6; // edi@6 - signed int v7; // ST08_4@7 - unsigned int v8; // eax@8 - signed int v9; // esi@9 +signed int itemid; // eax@1 +int min_damage; // edi@3 +int max_damage; // eax@3 static char player__getmeleedamagestring_static_buff[40]; // idb - v1 = this; - v2 = *(int *)&this->pInventoryItems[this->pEquipment.uMainHand-1]; - if ( v2 < 64 || v2 > 65 ) - { - v3 = GetMeleeDamageMinimal(); - v4 = GetMeleeDamageMaximal(); - } + if ( pEquipment.uMainHand) + { + itemid= pOwnItems[this->pEquipment.uMainHand-1].uItemID; + if ( itemid < 64 || itemid > 65 ) //blasters + { + min_damage = GetMeleeDamageMinimal(); + max_damage = GetMeleeDamageMaximal(); + } + else + { //for blasters + min_damage = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MIN, 0); + max_damage = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MAX, 0); + } + if ( max_damage ) + { + if ( min_damage == max_damage ) + { + sprintf(player__getmeleedamagestring_static_buff, "%d", min_damage); + } + else + { + sprintf(player__getmeleedamagestring_static_buff, "%d - %d", min_damage, max_damage); + } + } + else + { + strcpy(player__getmeleedamagestring_static_buff, "N/A"); + } + + if (( itemid >= 135 )&&( itemid <= 159 )) //wands + { + strcpy(player__getmeleedamagestring_static_buff, pGlobalTXT_LocalizationStrings[595]); //"Wand" + } + } else - { - v3 = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MIN, 0); - v4 = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MAX, 0); - } - if ( v3 == v4 ) - { - v5 = v3; - v6 = player__getmeleedamagestring_static_buff; - sprintf(player__getmeleedamagestring_static_buff, "%d", v5); - } - else - { - v7 = v3; - v6 = player__getmeleedamagestring_static_buff; - sprintf(player__getmeleedamagestring_static_buff, "%d - %d", v7, v4); - } - v8 = v1->pEquipment.uMainHand; - if ( v8 ) - { - v9 = *(int *)&v1->pInventoryItems[v8-1]; - if ( v9 >= 135 ) - { - if ( v9 <= 159 ) - strcpy(v6, pGlobalTXT_LocalizationStrings[595]); - } - } - return v6; + strcpy(player__getmeleedamagestring_static_buff, "N/A"); + return player__getmeleedamagestring_static_buff; } //----- (0048D396) -------------------------------------------------------- char *Player::GetRangedDamageString() -{ - Player *v1; // esi@1 - signed int v2; // eax@1 - int v3; // edi@3 - int v4; // eax@3 - char *v5; // edi@6 - int v6; // ST0C_4@8 - int v7; // ST08_4@9 - unsigned int v8; // eax@10 - signed int v9; // esi@11 - - static char player__getrangeddamagestring_static_buff[40]; // idb - - v1 = this; - v2 = *(int *)&this->pInventoryItems[this->pEquipment.uMainHand-1]; - if ( v2 < 64 || v2 > 65 ) - { - v3 = GetRangedDamageMin(); - v4 = GetRangedDamageMax(); - } - else - { - v3 = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MIN, 1); - v4 = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MAX, 1); - } - if ( v4 ) - { - if ( v3 == v4 ) - { - v6 = v3; - v5 = player__getrangeddamagestring_static_buff; - sprintf(player__getrangeddamagestring_static_buff, "%d", v6); - } + { + signed int itemid; // eax@1 + int min_damage; // edi@3 + int max_damage; // eax@3 + + static char player__getrangeddamagestring_static_buff[40]; // idb + if ( pEquipment.uMainHand) + { + itemid= pOwnItems[this->pEquipment.uMainHand-1].uItemID; + if ( itemid < 64 || itemid > 65 ) //blasters + { + min_damage = GetRangedDamageMin(); + max_damage = GetRangedDamageMax(); + } + else + { //for blasters + min_damage = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MIN, 1); + max_damage = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MAX, 1); + } + if ( max_damage ) + { + if ( min_damage == max_damage ) + { + sprintf(player__getrangeddamagestring_static_buff, "%d", min_damage); + } + else + { + sprintf(player__getrangeddamagestring_static_buff, "%d - %d", min_damage, max_damage); + } + } + else + { + strcpy(player__getrangeddamagestring_static_buff, "N/A"); + } + + if (( itemid >= 135 )&&( itemid <= 159 )) //wands + { + strcpy(player__getrangeddamagestring_static_buff, pGlobalTXT_LocalizationStrings[595]); //"Wand" + } + } else - { - v7 = v3; - v5 = player__getrangeddamagestring_static_buff; - sprintf(player__getrangeddamagestring_static_buff, "%d - %d", v7, v4); - } - } - else - { - v5 = player__getrangeddamagestring_static_buff; - strcpy(player__getrangeddamagestring_static_buff, "N/A"); - } - v8 = v1->pEquipment.uMainHand; - if ( v8 ) - { - v9 = *(int *)&v1->pInventoryItems[v8-1]; - if ( v9 >= 135 ) - { - if ( v9 <= 159 ) - strcpy(v5, pGlobalTXT_LocalizationStrings[595]); - } - } - return v5; -} + strcpy(player__getrangeddamagestring_static_buff, "N/A"); + return player__getrangeddamagestring_static_buff; + } //----- (0048D45A) -------------------------------------------------------- bool Player::CanTrainToNextLevel() @@ -3174,117 +3155,74 @@ } //----- (0048D4B3) -------------------------------------------------------- -int Player::CalculateIncommingDamage(int resistance, signed int type) -{ - Player *v3; // esi@1 - int v4; // edi@8 - int v6; // eax@21 - signed int v7; // ebx@21 - int v8; // eax@22 - signed int v9; // ebx@22 - int v10; // eax@23 - signed int v11; // ebx@23 - int v12; // eax@24 - signed int v13; // edi@24 - unsigned int v14; // eax@27 - int v15; // eax@29 - double v16; // st7@32 - enum CHARACTER_ATTRIBUTE_TYPE v17; // [sp-4h] [bp-10h]@9 - signed int v18; // [sp+8h] [bp-4h]@17 - - v3 = this; - if ( !resistance ) - { - v17 = (CHARACTER_ATTRIBUTE_TYPE)10; - goto LABEL_16; - } - if ( resistance == 1 ) - { - v17 = (CHARACTER_ATTRIBUTE_TYPE)11; - goto LABEL_16; - } - if ( resistance == 2 ) - { - v17 = (CHARACTER_ATTRIBUTE_TYPE)12; - goto LABEL_16; - } - if ( resistance == 3 ) - { - v17 = (CHARACTER_ATTRIBUTE_TYPE)13; - goto LABEL_16; - } - if ( resistance == 6 ) - { - v17 = (CHARACTER_ATTRIBUTE_TYPE)33; - goto LABEL_16; - } - if ( resistance == 7 ) - { - v17 = (CHARACTER_ATTRIBUTE_TYPE)14; - goto LABEL_16; - } - if ( resistance == 8 ) - { - v17 = (CHARACTER_ATTRIBUTE_TYPE)15; -LABEL_16: - v4 = GetActualResistance(v17); - goto LABEL_17; - } - v4 = 0; -LABEL_17: - v18 = type; - if ( v3->classType == PLAYER_CLASS_LICH && v4 >= 200 ) +int Player::CalculateIncommingDamage( DAMAGE_TYPE dmg_type, int amount ) + { + + int resist_value; // edi@8 + int player_luck; // eax@21 + signed int res_rand_divider; // ebx@2 + int armor_skill; // eax@29 + enum CHARACTER_ATTRIBUTE_TYPE player_resist; // [sp-4h] [bp-10h]@9 + signed int result_amount_dmg; // [sp+8h] [bp-4h]@17 + + player_resist=CHARACTER_ATTRIBUTE_STRENGTH; + switch(dmg_type) + { + case DMGT_FIRE: player_resist=CHARACTER_ATTRIBUTE_RESIST_FIRE; break; + case DMGT_ELECTR: player_resist=CHARACTER_ATTRIBUTE_RESIST_AIR; break; + case DMGT_COLD: player_resist=CHARACTER_ATTRIBUTE_RESIST_WATER; break; + case DMGT_3: player_resist=CHARACTER_ATTRIBUTE_RESIST_EARTH; break; + + case DMGT_SPIRIT: player_resist=CHARACTER_ATTRIBUTE_RESIST_SPIRIT;break; + case DMGT_MIND: player_resist=CHARACTER_ATTRIBUTE_RESIST_MIND; break; + case DMGT_BODY: player_resist=CHARACTER_ATTRIBUTE_RESIST_BODY; break; + } + if (player_resist) + resist_value = GetActualResistance(player_resist); + else + resist_value = 0; + + result_amount_dmg = amount; + if ( classType == PLAYER_CLASS_LICH && resist_value >= 200 ) return 0; - if ( v4 ) - { - v6 = GetActualLuck(); - v7 = _48EA1B_get_static_effect(v6) + v4 + 30; - if ( rand() % v7 >= 30 ) - { - v18 = type >> 1; - v8 = GetActualLuck(); - v9 = _48EA1B_get_static_effect(v8) + v4 + 30; - if ( rand() % v9 >= 30 ) + player_luck = GetActualLuck(); + res_rand_divider = GetParameterBonus(player_luck) + resist_value + 30; + + if ( resist_value ) + { + if ( rand() % res_rand_divider >= 30 ) + { + result_amount_dmg = amount >> 1; + if ( rand() % res_rand_divider >= 30 ) { - v18 = type >> 2; - v10 = GetActualLuck(); - v11 = _48EA1B_get_static_effect(v10) + v4 + 30; - if ( rand() % v11 >= 30 ) + result_amount_dmg = amount >> 2; + if ( rand() % res_rand_divider >= 30 ) { - v18 = type >> 3; - v12 = GetActualLuck(); - v13 = _48EA1B_get_static_effect(v12) + v4 + 30; - if ( rand() % v13 >= 30 ) - v18 = type >> 4; + result_amount_dmg = amount >> 3; + if ( rand() % res_rand_divider >= 30 ) + result_amount_dmg = amount >> 4; } } } } - if ( resistance == 4 ) - { - v14 = v3->pEquipment.uArmor; - if ( v14 ) - { - // if ( !(v3->field_1F5[36 * v14 + 15] & 2) ) - if (v3->pOwnItems[v14-1].uAttributes&2) + if (( dmg_type == DMGT_PHISYCAL )&&( pEquipment.uArmor )) + { + if (!pOwnItems[pEquipment.uArmor-1].Broken()) { - v15 = GetEquippedItemSkillType(EQUIP_ARMOUR) - 10; - if ( v15 ) + armor_skill = GetEquippedItemSkillType(EQUIP_ARMOUR); + if ( armor_skill==PLAYER_SKILL_PLATE ) { - if ( v15 != 1 || (signed int)SkillToMastery(v3->pActiveSkills[11]) < 3 ) - return v18; - v16 = (double)v18 * 0.5; - return (signed __int64)v16; + if ( SkillToMastery(pActiveSkills[PLAYER_SKILL_PLATE]) >= 3 ) + return (int)(double)result_amount_dmg * 0.5; } - if ( (signed int)SkillToMastery(v3->pActiveSkills[10]) >= 4 ) + if (armor_skill==PLAYER_SKILL_CHAIN ) { - v16 = (double)v18 * 0.66670001; - return (signed __int64)v16; + if (SkillToMastery(pActiveSkills[PLAYER_SKILL_CHAIN]) == 4) + return (int)(double)result_amount_dmg * 0.66670001; } } - } - } - return v18; + } + return result_amount_dmg; } //----- (0048D62C) -------------------------------------------------------- @@ -3311,8 +3249,9 @@ { auto i = pEquipment.pIndices[uEquipIndex]; if (i) - return ~pInventoryItems[i - 1].uAttributes & 0x02; - else return false; + return ~(pInventoryItems[i - 1].uAttributes & ITEM_BROKEN); + else + return false; } //----- (0048D6D0) -------------------------------------------------------- @@ -3588,58 +3527,45 @@ } //----- (0048DC1E) -------------------------------------------------------- -int Player::ReceiveDamage(signed int type, int resistance) -{ - Player *v3; // esi@1 - signed int v4; // eax@1 - int v5; // eax@1 - bool v6; // ebx@1 - unsigned int v7; // eax@8 - char *v8; // ecx@9 - int v9; // eax@9 - //signed int typea; // [sp+14h] [bp+8h]@1 - - v3 = this; - this->pConditions[Condition_Sleep] = 0i64; - v4 = CalculateIncommingDamage(resistance, type); - v3->sHealth -= v4; - //typea = v4; - v5 = v3->sHealth; - v6 = v5 < -10; - LOBYTE(v6) = v5 <= -10; - if ( v5 < 1 ) - { - if ( v3->sHealth + v3->uEndurance + GetItemsBonus(CHARACTER_ATTRIBUTE_ENDURANCE, 0) >= 1 - || (signed __int64)v3->pPlayerBuffs[PLAYER_BUFF_PRESERVATION].uExpireTime > 0 ) +int Player::ReceiveDamage( signed int amount, DAMAGE_TYPE dmg_type ) + { + signed int recieved_dmg; // eax@1 + unsigned int armor_indx; // eax@8 + bool broke_armor; + + pConditions[Condition_Sleep] = 0i64; + recieved_dmg = CalculateIncommingDamage(dmg_type, amount); + sHealth -= recieved_dmg; + broke_armor = sHealth <= -10; + if ( sHealth < 1 ) // + { + if ( (sHealth + uEndurance + GetItemsBonus(CHARACTER_ATTRIBUTE_ENDURANCE, 0) >= 1) + || pPlayerBuffs[PLAYER_BUFF_PRESERVATION].uExpireTime > 0i64 ) { SetCondition(Condition_Unconcious, 0); } else { SetCondition(Condition_Dead, 0); - v6 = LODWORD(pParty->uTimePlayed); - if ( v3->sHealth > 0 ) - v3->sHealth = 0; - } - if ( v6 ) - { - v7 = v3->pEquipment.uArmor; - if ( v7 ) + //v6 = LODWORD(pParty->uTimePlayed); ???? if equals 0 do not broke armor? + if ( sHealth > 0 ) + sHealth = 0; + } + if (broke_armor ) + { + armor_indx = pEquipment.uArmor; + if ( armor_indx ) { -// v8 = &v3->field_1F5[36 * v7 + 15]; - v8=(char*)&v3->pOwnItems[v7-1].uAttributes; - v9 = *(int *)v8; - if ( !(BYTE1(v9) & 2) ) + if ( !pOwnItems[armor_indx-1].uAttributes & ITEM_ENCHANTED) { - LOBYTE(v9) = v9 | 2; - *(int *)v8 = v9; + pOwnItems[armor_indx-1].uAttributes|=ITEM_BROKEN; } } } } - if ( v4 && CanAct() ) + if ( recieved_dmg && CanAct() ) PlaySound(SPEECH_24, 0); - return v4; + return recieved_dmg; } //----- (0048DCF6) -------------------------------------------------------- @@ -3730,9 +3656,9 @@ goto LABEL_47; case 22: v8 = GetActualWillpower(); - v9 = _48EA1B_get_static_effect(v8); + v9 = GetParameterBonus(v8); v10 = GetActualIntelligence(); - v11 = (_48EA1B_get_static_effect(v10) + v9) >> 1; + v11 = (GetParameterBonus(v10) + v9) >> 1; break; case 17: v12 = 0; @@ -3805,7 +3731,7 @@ v47 = (unsigned __int8)v46[rand() % v4]; v6 = GetActualAccuracy(); LABEL_46: - v7 = _48EA1B_get_static_effect(v6); + v7 = GetParameterBonus(v6); LABEL_47: v11 = v7; break; @@ -3814,7 +3740,7 @@ break; } v22 = GetActualLuck(); - v23 = _48EA1B_get_static_effect(v22) + v11 + 30; + v23 = GetParameterBonus(v22) + v11 + 30; if ( rand() % v23 >= 30 ) { LABEL_87: @@ -4110,7 +4036,7 @@ shield_recovery = shield_base_recovery * SkillToMastery(pActiveSkills[skill_type]); } - uint player_speed_recovery_reduction = _48EA1B_get_static_effect(GetActualSpeed()), + uint player_speed_recovery_reduction = GetParameterBonus(GetActualSpeed()), sword_axe_bow_recovery_reduction = 0; bool shooting_laser = false; if (weapon_desc) @@ -4171,7 +4097,7 @@ int v4; // esi@1 int v6; // esi@1 - v3 = _48EA1B_get_static_effect(GetActualEndurance()); + v3 = GetParameterBonus(GetActualEndurance()); v4 = pBaseHealthPerLevelByClass[classType] * (GetActualLevel() + v3); v6 = uFullHealthBonus + pBaseHealthByClass[classType / 4] @@ -4209,7 +4135,7 @@ case 0x22u: case 0x23u: v2 = GetActualIntelligence(); - v3 = _48EA1B_get_static_effect(v2); + v3 = GetParameterBonus(v2); goto LABEL_6; case 9u: case 0xAu: @@ -4223,7 +4149,7 @@ case 0x1Au: case 0x1Bu: v2 = GetActualWillpower(); - v3 = _48EA1B_get_static_effect(v2); + v3 = GetParameterBonus(v2); goto LABEL_6; case 0x15u: case 0x16u: @@ -4233,9 +4159,9 @@ case 0x1Eu: case 0x1Fu: v4 = GetActualWillpower(); - v5 = _48EA1B_get_static_effect(v4); + v5 = GetParameterBonus(v4); v6 = GetActualIntelligence(); - v3 = _48EA1B_get_static_effect(v6) + v5; + v3 = GetParameterBonus(v6) + v5; LABEL_6: v7 = pBaseManaPerLevelByClass[classType] * (GetActualLevel() + v3); v8 = GetItemsBonus(CHARACTER_ATTRIBUTE_MANA, 0) + v7; @@ -4267,7 +4193,7 @@ v1 = this; v2 = GetActualSpeed(); - v3 = _48EA1B_get_static_effect(v2); + v3 = GetParameterBonus(v2); v4 = GetItemsBonus(CHARACTER_ATTRIBUTE_AC_BONUS, 0) + v3; v5 = GetSkillBonus(CHARACTER_ATTRIBUTE_AC_BONUS) + v4; if ( v5 >= 1 ) @@ -4290,7 +4216,7 @@ v1 = this; v2 = GetActualSpeed(); - v3 = _48EA1B_get_static_effect(v2); + v3 = GetParameterBonus(v2); v4 = GetItemsBonus(CHARACTER_ATTRIBUTE_AC_BONUS, 0) + v3; v5 = GetSkillBonus(CHARACTER_ATTRIBUTE_AC_BONUS) + v4; v6 = v1->sACModifier + GetMagicalBonus(CHARACTER_ATTRIBUTE_AC_BONUS) + v5; @@ -4516,53 +4442,48 @@ } //----- (0048EA1B) -------------------------------------------------------- -int Player::_48EA1B_get_static_effect(int a2) -{ - __int16 v2; // cx@1 - int v3; // eax@1 - - v2 = word_4EDFFC[0]; - v3 = 0; - while ( a2 < v2 && v2 ) - v2 = word_4EDFFC[v3++ + 1]; - return player_stat_bonuses[v3]; +int Player::GetParameterBonus( int player_parameter ) + { + int i; // eax@1 + i = 0; + while (param_to_bonus_table[i]) + { + if (player_parameter >= param_to_bonus_table[i]) + break; + ++i; + } + return parameter_to_bonus_value[i]; } //----- (0048EA46) -------------------------------------------------------- int Player::_48EA46_calc_special_bonus_by_items(int a2) { - int v3; // esi@1 - int v4; // edx@2 - int v5; // eax@3 - char *v6; // eax@4 - - v3 = 0; - while ( 1 ) - { - if ( !HasItemEquipped((ITEM_EQUIP_TYPE)v3) ) - goto LABEL_11; - v5 = pEquipment.pIndices[v3] - 1; - if ( a2 != 17 ) - { - if ( a2 != 24 || this->pInventoryItems[v5].uSpecEnchantmentType != 24 ) - goto LABEL_11; - return 5; - } - v6 = (char *)this + 36 * v5; - if ( *((int *)v6 + 133) == 533 || *((int *)v6 + 136) == 17 ) - return 50; -LABEL_11: - ++v3; - if ( (signed int)v3 >= 16 ) - return 0; - } + int inv_indx; // eax@3 + + for (int i=EQUIP_OFF_HAND; i<EQUIP_BOOK; ++i ) + { + if ( !HasItemEquipped((ITEM_EQUIP_TYPE)i) ) + continue; + inv_indx = pEquipment.pIndices[i] - 1; + if (a2==17) + { + if ((pInventoryItems[inv_indx].uSpecEnchantmentType==17)||(pInventoryItems[inv_indx].uItemID=533)) //Elven Chainmail+Increases rate of Recovery + return 50; + } + if (a2==24) + { + if (pInventoryItems[inv_indx].uSpecEnchantmentType==24) //Increased Knockback. + return 5; + } + } + return 0; } //----- (0048EAAE) -------------------------------------------------------- int Player::GetItemsBonus(CHARACTER_ATTRIBUTE_TYPE attr, int a3) { CHARACTER_ATTRIBUTE_TYPE v3; // esi@1 - signed int v4; // eax@1 + // signed int v4; // eax@1 int v5; // edi@1 Player *v6; // ebx@1 Player *v8; // ecx@48 @@ -4623,145 +4544,73 @@ int v63; // [sp+18h] [bp-4h]@101 ItemGen *attra; // [sp+20h] [bp+4h]@101 unsigned int v65; // [sp+24h] [bp+8h]@95 + bool no_skills; v3 = attr; - v4 = 36; v5 = 0; v6 = this; v62 = 0; v61 = 0; + + no_skills=false; switch (attr) - { - case CHARACTER_ATTRIBUTE_LEVEL: - if (HasEnchantedItemEquipped(25)) - return 5; - return 0; - }; - - if ( (signed int)attr > 36 ) - { - switch ( attr ) - { - case 37: - v58 = 15; - goto LABEL_35; - case 38: - v58 = 16; - goto LABEL_35; - case 39: - v58 = 17; - goto LABEL_35; - case 40: - v58 = 18; - goto LABEL_35; - case 41: - v58 = 19; - goto LABEL_35; - case 42: - v58 = 20; - goto LABEL_35; - case 43: - v58 = 25; - goto LABEL_35; - case 44: - v58 = 5; - goto LABEL_35; - case 45: - v58 = 8; - goto LABEL_35; - case 46: - goto LABEL_36; - default: - break; - } - } - else - { - if ( attr == 36 ) - { - v58 = 14; - } - else - { - if ( (signed int)attr > 21 ) { - switch ( attr ) - { - case 22: - v58 = 30; - break; - case 23: - v58 = 31; - break; - case 34: - v58 = 12; - break; - default: - if ( attr != 35 ) - goto LABEL_38; - v58 = 13; - break; - } + case CHARACTER_ATTRIBUTE_SKILL_ALCHEMY: v58 = PLAYER_SKILL_ALCHEMY; break; + case CHARACTER_ATTRIBUTE_SKILL_STEALING: v58 = PLAYER_SKILL_STEALING; break; + case CHARACTER_ATTRIBUTE_SKILL_TRAP_DISARM: v58 = PLAYER_SKILL_TRAP_DISARM; break; + case CHARACTER_ATTRIBUTE_SKILL_ITEM_ID: v58 = PLAYER_SKILL_ITEM_ID; break; + case CHARACTER_ATTRIBUTE_SKILL_MONSTER_ID: v58 = PLAYER_SKILL_MONSTER_ID; break; + case CHARACTER_ATTRIBUTE_SKILL_ARMSMASTER: v58 = PLAYER_SKILL_ARMSMASTER; break; + case CHARACTER_ATTRIBUTE_SKILL_DODGE: v58 = PLAYER_SKILL_DODGE; break; + case CHARACTER_ATTRIBUTE_SKILL_UNARMED: v58 = PLAYER_SKILL_UNARMED; break; + case CHARACTER_ATTRIBUTE_SKILL_FIRE: v58 = PLAYER_SKILL_FIRE; break; + case CHARACTER_ATTRIBUTE_SKILL_AIR: v58 = PLAYER_SKILL_AIR; break; + case CHARACTER_ATTRIBUTE_SKILL_WATER: v58 = PLAYER_SKILL_WATER; break; + case CHARACTER_ATTRIBUTE_SKILL_EARTH: v58 = PLAYER_SKILL_EARTH; break; + case CHARACTER_ATTRIBUTE_SKILL_SPIRIT: v58 = PLAYER_SKILL_SPIRIT; break; + case CHARACTER_ATTRIBUTE_SKILL_MIND: v58 = PLAYER_SKILL_MIND; break; + case CHARACTER_ATTRIBUTE_SKILL_BODY: v58 = PLAYER_SKILL_BODY; break; + case CHARACTER_ATTRIBUTE_SKILL_LIGHT: v58 = PLAYER_SKILL_LIGHT; break; + case CHARACTER_ATTRIBUTE_SKILL_DARK: v58 = PLAYER_SKILL_DARK; break; + case CHARACTER_ATTRIBUTE_SKILL_MEDITATION: v58 = PLAYER_SKILL_MEDITATION; break; + case CHARACTER_ATTRIBUTE_SKILL_BOW: v58 = PLAYER_SKILL_BOW; break; + case CHARACTER_ATTRIBUTE_SKILL_SHIELD: v58 = PLAYER_SKILL_SHIELD; break; + case CHARACTER_ATTRIBUTE_SKILL_LEARNING: v58 = PLAYER_SKILL_LEARNING; break; + default: + no_skills=true; } - else + if (!no_skills) { - switch ( attr ) - { - case 21: - v58 = 33; - break; - case 16: - v58 = 35; - break; - case 17: - v58 = 34; - break; - case 18: - v58 = 29; - break; - case 19: - v58 = 21; - break; - default: - if ( attr != 20 ) - goto LABEL_38; - v58 = 32; - break; - } + if ( !this->pActiveSkills[v58] ) + return 0; } - } -LABEL_35: - v4 = v58; -LABEL_36: - if ( !this->pActiveSkills[v4] ) - return 0; - } -LABEL_38: + if ( (signed int)attr > 28 ) { if ( (signed int)attr < 29 ) return v5 + v62 + v61; - if ( (signed int)attr <= 30 ) + if ( (signed int)attr <= CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS ) { if ( HasItemEquipped(EQUIP_BOW) ) - v5 = pItemsTable->pItems[*(int *)&v6->pInventoryItems[v6->pEquipment.uBow-1]].uDamageMod; + v5 = pItemsTable->pItems[v6->pOwnItems[v6->pEquipment.uBow-1].uItemID].uDamageMod; return v5 + v62 + v61; } - if ( attr == 31 ) + if ( attr == CHARACTER_ATTRIBUTE_RANGED_DMG_MIN ) { if ( !HasItemEquipped(EQUIP_BOW) ) return v5 + v62 + v61; - v57 = *(int *)&v6->pInventoryItems[v6->pEquipment.uBow-1]; + v57 = v6->pOwnItems[v6->pEquipment.uBow-1].uItemID; v5 = pItemsTable->pItems[v57].uDamageMod; v56 = pItemsTable->pItems[v57].uDamageDice; - goto LABEL_366; - } - if ( attr == 32 ) + v5 += v56; + return v5 + v62 + v61; + } + if ( attr == CHARACTER_ATTRIBUTE_RANGED_DMG_MAX ) { if ( !HasItemEquipped(EQUIP_BOW) ) return v5 + v62 + v61; - v20 = *(int *)&v6->pInventoryItems[v6->pEquipment.uBow-1]; + v20 = v6->pOwnItems[v6->pEquipment.uBow-1].uItemID; v5 = pItemsTable->pItems[v20].uDamageDice * pItemsTable->pItems[v20].uDamageRoll; LABEL_365: v56 = pItemsTable->pItems[v20].uDamageMod; @@ -5337,7 +5186,7 @@ return v5 + v62 + v61; } } - if ( attr == 28 ) + if ( attr == CHARACTER_ATTRIBUTE_MELEE_DMG_MAX ) { if ( IsUnarmed() != 1 ) { @@ -5348,7 +5197,7 @@ { if ( v22 <= 2 ) { - v23 = this->pInventoryItems[this->pEquipment.uMainHand].uItemID; + v23 = this->pOwnItems[this->pEquipment.uMainHand].uItemID; if ( v6->pEquipment.uShield || pItemsTable->pItems[v23].uSkillType != 4 ) { v24 = v23; @@ -5364,11 +5213,18 @@ } } } - if ( a3 || !v6->HasItemEquipped(EQUIP_OFF_HAND) || (v28 = v6->GetEquippedItemEquipType(EQUIP_OFF_HAND), v28 < 0) || v28 > 2 ) - return v5 + v62 + v61; + + if ( a3 || !v6->HasItemEquipped(EQUIP_OFF_HAND) ) + { + + v28 = v6->GetEquippedItemEquipType(EQUIP_OFF_HAND); + if ((v28 < 0) || v28 > 2 ) + return v5 + v62 + v61; + } v15 = pItemsTable->pItems[v29].uDamageMod; v14 = pItemsTable->pItems[v29].uDamageDice * pItemsTable->pItems[v29].uDamageRoll; - goto LABEL_88; + v5 += v15 + v14; + return v5 + v62 + v61 } v59 = 3; LABEL_74: @@ -5377,11 +5233,18 @@ } if ( (signed int)attr < 0 ) return v5 + v62 + v61; - if ( (signed int)attr <= 23 ) + if ( (signed int)attr <= CHARACTER_ATTRIBUTE_SKILL_UNARMED ) goto LABEL_95; - if ( (signed int)attr <= 24 ) + if ( attr == CHARACTER_ATTRIBUTE_LEVEL ) + { + if ( !Player::HasEnchantedItemEquipped(25) ) + return v5 + v62 + v61; + v5 = 5; + return v5 + v62 + v61; + } + if ( (signed int)attr <= CHARACTER_ATTRIBUTE_LEVEL ) return v5 + v62 + v61; - if ( (signed int)attr <= 26 ) + if ( (signed int)attr <= CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS ) { if ( IsUnarmed() == 1 ) { @@ -5394,15 +5257,17 @@ if ( v17 >= 0 ) { if ( v17 <= 2 ) - v5 = pItemsTable->pItems[*(int *)&v6->pInventoryItems[v6->pEquipment.uMainHand-1]].uDamageMod; + v5 = pItemsTable->pItems[v6->pOwnItems[v6->pEquipment.uMainHand-1].uItemID].uDamageMod; } } if ( a3 || !v6->HasItemEquipped(EQUIP_OFF_HAND) || (v19 = v6->GetEquippedItemEquipType(EQUIP_OFF_HAND), v19 < 0) || v19 > 2 ) return v5 + v62 + v61; - v20 = *(int *)&v6->pInventoryItems[v6->pEquipment.uShield - 1]; - goto LABEL_365; - } - if ( attr == 27 ) + v20 = v6->pOwnItems[v6->pEquipment.uShield - 1].uItemID; + v56 = pItemsTable->pItems[v20].uDamageMod; + v5 += v56; + return v5 + v62 + v61; + } + if ( attr == CHARACTER_ATTRIBUTE_MELEE_DMG_MIN ) { if ( IsUnarmed() == 1 ) { @@ -5416,20 +5281,25 @@ { if ( v9 <= 2 ) { - v5 = pItemsTable->pItems[this->pInventoryItems[this->pEquipment.uMainHand].uItemID].uDamageDice + - pItemsTable->pItems[this->pInventoryItems[this->pEquipment.uMainHand].uItemID].uDamageMod; + v5 = pItemsTable->pItems[this->pOwnItems[this->pEquipment.uMainHand].uItemID].uDamageDice + + pItemsTable->pItems[this->pOwnItems[this->pEquipment.uMainHand].uItemID].uDamageMod; if ( !v6->pEquipment.uShield ) { - if ( pItemsTable->pItems[this->pInventoryItems[this->pEquipment.uMainHand].uItemID].uSkillType == 4 ) + if ( pItemsTable->pItems[this->pOwnItems[this->pEquipment.uMainHand].uItemID].uSkillType == 4 ) ++v5; } } } } - if ( a3 || !v6->HasItemEquipped(EQUIP_OFF_HAND) || (v12 = v6->GetEquippedItemEquipType(EQUIP_OFF_HAND), v12 < 0) || v12 > 2 ) - return v5 + v62 + v61; - v14 = pItemsTable->pItems[this->pInventoryItems[this->pEquipment.uShield].uItemID].uDamageMod; - v15 = pItemsTable->pItems[this->pInventoryItems[this->pEquipment.uShield].uItemID].uDamageDice; + + if ( a3 || !v6->HasItemEquipped(EQUIP_OFF_HAND)) + { + v12 = v6->GetEquippedItemEquipType(EQUIP_OFF_HAND); + if ((v12 < 0) || v12 > 2 ) + return v5 + v62 + v61; + } + v14 = pItemsTable->pItems[this->pOwnItems[this->pEquipment.uShield].uItemID].uDamageMod; + v15 = pItemsTable->pItems[this->pOwnItems[this->pEquipment.uShield].uItemID].uDamageDice; LABEL_88: v5 += v15 + v14; } @@ -5555,8 +5425,7 @@ v2 = 6; if ( CheckHiredNPCSpeciality(Sage) ) v2 += 6; - v8 = (CHARACTER_ATTRIBUTE_TYPE)20; - v2 += GetItemsBonus(v8, 0); + v2 += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_MONSTER_ID, 0); } break; @@ -5566,8 +5435,7 @@ v2 = 2; if ( CheckHiredNPCSpeciality(Weaponsmaster) ) v2 += 3; - v8 = (CHARACTER_ATTRIBUTE_TYPE)21; - v2 += GetItemsBonus(v8, 0); + v2 += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_ARMSMASTER, 0); } break; @@ -5575,8 +5443,7 @@ { if (CheckHiredNPCSpeciality(Burglar)) v2 = 8; - v8 = (CHARACTER_ATTRIBUTE_TYPE)17; - v2 += GetItemsBonus(v8, 0); + v2 += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_STEALING, 0); } break; @@ -5587,8 +5454,7 @@ v2 = 4; if ( CheckHiredNPCSpeciality(Apothecary) ) v2 += 8; - v8 = (CHARACTER_ATTRIBUTE_TYPE)16; - v2 += GetItemsBonus(v8, 0); + v2 += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_ALCHEMY, 0); } break; @@ -5600,8 +5466,7 @@ v2 += 15; if ( CheckHiredNPCSpeciality(Scholar) ) v2 += 5; - v8 = (CHARACTER_ATTRIBUTE_TYPE)46; - v2 += GetItemsBonus(v8, 0); + v2 += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_LEARNING, 0); } break; @@ -5609,8 +5474,7 @@ { if (CheckHiredNPCSpeciality(Monk) ) v2 = 2; - v8 = (CHARACTER_ATTRIBUTE_TYPE)23; - v2 += GetItemsBonus(v8, 0); + v2 += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_UNARMED, 0); } break; @@ -5618,18 +5482,15 @@ { if ( CheckHiredNPCSpeciality(Monk) ) v2 = 2; - v8 = (CHARACTER_ATTRIBUTE_TYPE)22; - v2 += GetItemsBonus(v8, 0); + v2 += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_DODGE, 0); } break; case PLAYER_SKILL_BOW: - v8 = (CHARACTER_ATTRIBUTE_TYPE)44; - v2 += GetItemsBonus(v8, 0); + v2 += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_BOW, 0); break; case PLAYER_SKILL_SHIELD: - v8 = (CHARACTER_ATTRIBUTE_TYPE)45; - v2 += GetItemsBonus(v8, 0); + v2 += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_SHIELD, 0); break; case PLAYER_SKILL_EARTH: @@ -5641,8 +5502,7 @@ v2 += 4; if ( classType == PLAYER_CLASS_WARLOCK && PartyHasDragon() ) v2 += 3; - v8 = (CHARACTER_ATTRIBUTE_TYPE)37; - v2 += GetItemsBonus(v8, 0); + v2 += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_EARTH, 0); break; case PLAYER_SKILL_FIRE: if ( CheckHiredNPCSpeciality(Apprentice) ) @@ -5653,8 +5513,7 @@ v2 += 4; if ( classType == PLAYER_CLASS_WARLOCK && PartyHasDragon() ) v2 += 3; - v8 = (CHARACTER_ATTRIBUTE_TYPE)34; - v2 += GetItemsBonus(v8, 0); + v2 += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_FIRE, 0); break; case PLAYER_SKILL_AIR: if ( CheckHiredNPCSpeciality(Apprentice) ) @@ -5665,8 +5524,7 @@ v2 += 4; if ( classType == PLAYER_CLASS_WARLOCK && PartyHasDragon() ) v2 += 3; - v8 = (CHARACTER_ATTRIBUTE_TYPE)35; - v2 += GetItemsBonus(v8, 0); + v2 += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_AIR, 0); break; case PLAYER_SKILL_WATER: if ( CheckHiredNPCSpeciality(Apprentice) ) @@ -5677,8 +5535,7 @@ v2 += 4; if ( classType == PLAYER_CLASS_WARLOCK && PartyHasDragon() ) v2 += 3; - v8 = (CHARACTER_ATTRIBUTE_TYPE)36; - v2 += GetItemsBonus(v8, 0); + v2 += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_WATER, 0); break; case PLAYER_SKILL_SPIRIT: if ( CheckHiredNPCSpeciality(Acolyte2) ) @@ -5687,8 +5544,7 @@ v2 += 3; if ( CheckHiredNPCSpeciality(Prelate) ) v2 += 4; - v8 = (CHARACTER_ATTRIBUTE_TYPE)38; - v2 += GetItemsBonus(v8, 0); + v2 += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_SPIRIT, 0); break; case PLAYER_SKILL_MIND: if ( CheckHiredNPCSpeciality(Acolyte2) ) @@ -5697,8 +5553,7 @@ v2 += 3; if ( CheckHiredNPCSpeciality(Prelate) ) v2 += 4; - v8 = (CHARACTER_ATTRIBUTE_TYPE)39; - v2 += GetItemsBonus(v8, 0); + v2 += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_MIND, 0); break; case PLAYER_SKILL_BODY: if ( CheckHiredNPCSpeciality(Acolyte2) ) @@ -5707,17 +5562,14 @@ v2 += 3; if ( CheckHiredNPCSpeciality(Prelate) ) v2 += 4; - v8 = (CHARACTER_ATTRIBUTE_TYPE)40; - v2 += GetItemsBonus(v8, 0); + v2 += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_BODY, 0); break; case PLAYER_SKILL_LIGHT: - v8 = (CHARACTER_ATTRIBUTE_TYPE)41; - v2 += GetItemsBonus(v8, 0); + v2 += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_LIGHT, 0); break; case PLAYER_SKILL_DARK: { - v8 = (CHARACTER_ATTRIBUTE_TYPE)42; - v2 += GetItemsBonus(v8, 0); + v2 += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_DARK, 0); } break; @@ -5744,12 +5596,10 @@ break; case PLAYER_SKILL_ITEM_ID: - v8 = (CHARACTER_ATTRIBUTE_TYPE)19; - v2 += GetItemsBonus(v8, 0); + v2 += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_ITEM_ID, 0); break; case PLAYER_SKILL_MEDITATION: - v8 = (CHARACTER_ATTRIBUTE_TYPE)43; - v2 += GetItemsBonus(v8, 0); + v2 += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_MEDITATION, 0); break; case PLAYER_SKILL_TRAP_DISARM: { @@ -5759,8 +5609,7 @@ v2 += 6; if ( CheckHiredNPCSpeciality(Burglar) ) v2 += 8; - v8 = (CHARACTER_ATTRIBUTE_TYPE)18; - v2 += GetItemsBonus(v8, 0); + v2 += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_TRAP_DISARM, 0); } break; } @@ -6605,43 +6454,43 @@ pStep = StatTable[0][v2].uBaseStep; switch ( eAttribute ) { - case CHARACTER_MIGHT: + case CHARACTER_ATTRIBUTE_STRENGTH: if ( this->uMight <= pBaseValue ) pStep = pDroppedStep; if ( this->uMight - pStep >= uMinValue ) this->uMight -= pStep; break; - case CHARACTER_INTELLIGANCE: + case CHARACTER_ATTRIBUTE_INTELLIGENCE: if ( this->uIntelligence <= pBaseValue ) pStep = pDroppedStep; if ( this->uIntelligence - pStep >= uMinValue ) this->uIntelligence -= pStep; break; - case CHARACTER_WILLPOWER: + case CHARACTER_ATTRIBUTE_WILLPOWER: if ( this->uWillpower <= pBaseValue ) pStep = pDroppedStep; if ( this->uWillpower - pStep >= uMinValue ) this->uWillpower -= pStep; break; - case CHARACTER_ENDURANCE: + case CHARACTER_ATTRIBUTE_ENDURANCE: if ( this->uEndurance <= pBaseValue ) pStep = pDroppedStep; if ( this->uEndurance - pStep >= uMinValue ) this->uEndurance -= pStep; break; - case CHARACTER_ACCURACY: + case CHARACTER_ATTRIBUTE_ACCURACY: if ( this->uAccuracy <= pBaseValue ) pStep = pDroppedStep; if ( this->uAccuracy - pStep >= uMinValue ) this->uAccuracy -= pStep; break; - case CHARACTER_SPEED: + case CHARACTER_ATTRIBUTE_SPEED: if ( this->uSpeed <= pBaseValue ) pStep = pDroppedStep; if ( this->uSpeed - pStep >= uMinValue ) this->uSpeed -= pStep; break; - case CHARACTER_LUCK: + case CHARACTER_ATTRIBUTE_LUCK: if ( this->uLuck <= pBaseValue ) pStep = pDroppedStep; if ( this->uLuck - pStep >= uMinValue ) @@ -6836,78 +6685,29 @@ void Player::UseItem_DrinkPotion_etc(signed int player_num, int a3) { Player *v3; // esi@1 - unsigned int v4; // ebx@4 signed int v5; // eax@17 - unsigned int v6; // eax@26 - unsigned __int8 v7; // cf@37 int v8; // edx@39 - int v9; // edx@40 - int v10; // edx@41 - int v11; // edx@42 - int v12; // edx@43 char *v13; // eax@45 - AudioPlayer *v14; // ecx@62 signed int v15; // edi@68 int v16; // edx@73 unsigned __int16 v17; // edi@73 unsigned int v18; // eax@73 - int v19; // eax@74 - int v20; // eax@75 - signed int v21; // eax@81 const char *v22; // eax@84 - char *v23; // ecx@90 int scroll_id; // esi@96 int v25; // eax@109 int v26; // eax@113 int new_mana_val; // edi@114 signed __int64 v28; // qax@120 - char *v29; // ecx@120 __int64 v30; // edi@137 - int v31; // ST30_4@137 __int64 v32; // ST3C_4@137 - int v33; // ST40_4@137 __int64 v34; // ST34_4@137 - int v35; // ST38_4@137 - unsigned __int8 v36; // al@173 - SoundID v37; // [sp-20h] [bp-4Ch]@18 - SoundID v38; // [sp-20h] [bp-4Ch]@174 - signed int v39; // [sp-1Ch] [bp-48h]@18 - signed int v40; // [sp-1Ch] [bp-48h]@174 - unsigned int v41; // [sp-18h] [bp-44h]@18 - unsigned int v42; // [sp-18h] [bp-44h]@174 - signed int v43; // [sp-14h] [bp-40h]@18 - signed int v44; // [sp-14h] [bp-40h]@174 - signed int v45; // [sp-10h] [bp-3Ch]@18 - unsigned __int16 v46; // [sp-10h] [bp-3Ch]@120 - signed int v47; // [sp-10h] [bp-3Ch]@174 - int v48; // [sp-Ch] [bp-38h]@18 - unsigned int v49; // [sp-Ch] [bp-38h]@33 unsigned __int16 v50; // [sp-Ch] [bp-38h]@120 - int v51; // [sp-Ch] [bp-38h]@174 - unsigned int v52; // [sp-8h] [bp-34h]@18 - char *v53; // [sp-8h] [bp-34h]@33 - int v54; // [sp-8h] [bp-34h]@34 - unsigned int v55; // [sp-8h] [bp-34h]@60 - int v56; // [sp-8h] [bp-34h]@66 - const char *v57; // [sp-8h] [bp-34h]@69 - const char *v58; // [sp-8h] [bp-34h]@89 - int v59; // [sp-8h] [bp-34h]@120 - unsigned int v60; // [sp-8h] [bp-34h]@174 - int v61; // [sp-4h] [bp-30h]@18 - char *v62; // [sp-4h] [bp-30h]@33 - char *v63; // [sp-4h] [bp-30h]@34 - int v64; // [sp-4h] [bp-30h]@60 - int v65; // [sp-4h] [bp-30h]@66 const char *v66; // [sp-4h] [bp-30h]@69 signed int v67; // [sp-4h] [bp-30h]@77 const char *v68; // [sp-4h] [bp-30h]@89 - int v69; // [sp-4h] [bp-30h]@110 - unsigned __int8 v70; // [sp-4h] [bp-30h]@120 - int v71; // [sp-4h] [bp-30h]@174 char v72; // [sp+20h] [bp-Ch]@68 signed int v73; // [sp+24h] [bp-8h]@1 - char *v74; // [sp+24h] [bp-8h]@23 - int v75; // [sp+24h] [bp-8h]@73 + char* v74; // [sp+24h] [bp-8h]@23 Player *thisb; // [sp+28h] [bp-4h]@1 unsigned int thisa; // [sp+28h] [bp-4h]@22 @@ -6916,7 +6716,6 @@ v73 = 1; if ( pParty->bTurnBasedModeOn == 1 && (pTurnEngine->field_4 == 1 || pTurnEngine->field_4 == 3) ) return; - v4 = 0; if ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType == EQUIP_REAGENT ) { if ( pParty->pPickedItem.uItemID == 160 ) @@ -6940,13 +6739,33 @@ else { v68 = pParty->pPickedItem.GetDisplayName(); - v58 = pGlobalTXT_LocalizationStrings[36];//"%s can not be used that way" - sprintfex(pTmpBuf, v58, v68); + sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[36], v68);//"%s can not be used that way" ShowStatusBarString(pTmpBuf, 2); pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); return; } - goto LABEL_173; + pAudioPlayer->PlaySound((SoundID)211, 0, 0, -1, 0, 0, 0, 0); + + if ( pGUIWindow_CurrentMenu && pGUIWindow_CurrentMenu->eWindowType != WINDOW_null) + { + pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); + } + if ( v73 ) + { + if ( pParty->bTurnBasedModeOn ) + { + pParty->pTurnBasedPlayerRecoveryTimes[player_num-1] = 100; + thisb->SetRecoveryTime(100); + pTurnEngine->_40471C(); + } + else + { + thisb->SetRecoveryTime((signed __int64)(flt_6BE3A4_debug_recmod1 * 213.3333333333333)); + } + } + pMouse->RemoveHoldingItem(); + return; + } if ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType == EQUIP_POTION ) @@ -7008,13 +6827,13 @@ v3->PlaySound(SPEECH_36, 0); break; case 231: //Preservation - v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); + v50 = 3 * pParty->pPickedItem.uEnchantmentType; v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); v3->pPlayerBuffs[11].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); v3->PlaySound(SPEECH_36, 0); break; case 232: //Shield - v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); + v50 = 3 * pParty->pPickedItem.uEnchantmentType; v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); v3->pPlayerBuffs[13].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); v3->PlaySound(SPEECH_36, 0); @@ -7041,37 +6860,37 @@ v3->PlaySound(SPEECH_36, 0); break; case 240: //Might Boost - v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); + v50 = 3 * pParty->pPickedItem.uEnchantmentType; v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); v3->pPlayerBuffs[19].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); v3->PlaySound(SPEECH_36, 0); break; case 241: //Intellect Boost - v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); + v50 = 3 * pParty->pPickedItem.uEnchantmentType; v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); v3->pPlayerBuffs[17].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); v3->PlaySound(SPEECH_36, 0); break; case 242: //Personality Boost - v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); + v50 = 3 * pParty->pPickedItem.uEnchantmentType; v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); v3->pPlayerBuffs[20].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); v3->PlaySound(SPEECH_36, 0); break; case 243://Endurance Boost - v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); + v50 = 3 * pParty->pPickedItem.uEnchantmentType; v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); v3->pPlayerBuffs[16].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); v3->PlaySound(SPEECH_36, 0); break; case 244: //Speed Boost - v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); + v50 = 3 * pParty->pPickedItem.uEnchantmentType; v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); v3->pPlayerBuffs[21].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); v3->PlaySound(SPEECH_36, 0); break; case 245: //Accuracy Boost - v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); + v50 = 3 * pParty->pPickedItem.uEnchantmentType; v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); v3->pPlayerBuffs[15].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); v3->PlaySound(SPEECH_36, 0); @@ -7104,43 +6923,43 @@ v3->PlaySound(SPEECH_36, 0); break; case 255: //Luck Boost - v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); + v50 = 3 * pParty->pPickedItem.uEnchantmentType; v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); v3->pPlayerBuffs[18].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); v3->PlaySound(SPEECH_36, 0); break; case 256: //Fire Resistance - v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); + v50 = 3 * pParty->pPickedItem.uEnchantmentType; v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); v3->pPlayerBuffs[5].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); v3->PlaySound(SPEECH_36, 0); - goto LABEL_173; + break; case 257: //Air Resistance - v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); + v50 = 3 * pParty->pPickedItem.uEnchantmentType; v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); v3->pPlayerBuffs[0].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); v3->PlaySound(SPEECH_36, 0); break; case 258: //Water Resistance - v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); + v50 = 3 * pParty->pPickedItem.uEnchantmentType; v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); v3->pPlayerBuffs[22].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); v3->PlaySound(SPEECH_36, 0); break; case 259: //Earth Resistance - v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); + v50 = 3 * pParty->pPickedItem.uEnchantmentType; v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); v3->pPlayerBuffs[3].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); v3->PlaySound(SPEECH_36, 0); break; case 260: //Mind Resistance - v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); + v50 = 3 * pParty->pPickedItem.uEnchantmentType; v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); v3->pPlayerBuffs[9].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); v3->PlaySound(SPEECH_36, 0); break; case 261: //Body Resistance - v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); + v50 = 3 * pParty->pPickedItem.uEnchantmentType; v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); v3->pPlayerBuffs[2].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); v3->PlaySound(SPEECH_36, 0); @@ -7212,15 +7031,37 @@ default: v68 = pParty->pPickedItem.GetDisplayName(); - v58 = pGlobalTXT_LocalizationStrings[36]; //"%s can not be used that way" - sprintfex(pTmpBuf, v58, v68); + sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[36], v68);//"%s can not be used that way" ShowStatusBarString(pTmpBuf, 2u); pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); return; - + } + pAudioPlayer->PlaySound((SoundID)210, 0, 0, -1, 0, 0, 0, 0); + if ( pGUIWindow_CurrentMenu && pGUIWindow_CurrentMenu->eWindowType != WINDOW_null) + { + if ( !v73 ) + { + pMouse->RemoveHoldingItem(); + return; + } + pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); } - // pParty->pPlayers[player_num-1].SetCondition(Condition_Poison1, 1); - goto LABEL_173; + if ( v73 ) + { + if ( pParty->bTurnBasedModeOn ) + { + pParty->pTurnBasedPlayerRecoveryTimes[player_num-1] = 100; + thisb->SetRecoveryTime(100); + pTurnEngine->_40471C(); + } + else + { + thisb->SetRecoveryTime((signed __int64)(flt_6BE3A4_debug_recmod1 * 213.3333333333333)); + } + } + pMouse->RemoveHoldingItem(); + return; + } @@ -7233,39 +7074,16 @@ if ( !pParty->pPlayers[player_num-1].CanAct() ) { - v68 = aCharacterConditionNames[v3->GetMajorConditionIdx()]; - v58 = pGlobalTXT_LocalizationStrings[382]; - sprintfex(pTmpBuf, v58, v68); - v23 = pTmpBuf; - - ShowStatusBarString(v23, 2u); - v4 = 0; - v61 = v4; - v52 = v4; - v48 = v4; - v45 = v4; - v43 = -1; - v41 = v4; - v39 = v4; - v37 = (SoundID)27; - pAudioPlayer->PlaySound(v37, v39, v41, v43, v45, v48, v52, v61); + sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[382], v68); + ShowStatusBarString(pTmpBuf, 2u); + pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); return; } if ( bUnderwater == 1 ) { - v23 = pGlobalTXT_LocalizationStrings[652]; //"You can not do that while you are underwater!" - ShowStatusBarString(v23, 2u); - v4 = 0; - v61 = v4; - v52 = v4; - v48 = v4; - v45 = v4; - v43 = -1; - v41 = v4; - v39 = v4; - v37 = (SoundID)27; - pAudioPlayer->PlaySound(v37, v39, v41, v43, v45, v48, v52, v61); + ShowStatusBarString(pGlobalTXT_LocalizationStrings[652], 2u);//"You can not do that while you are underwater!" + pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); return; } dword_50C9AC = 1; @@ -7301,143 +7119,70 @@ if ( v72 ) { v66 = pParty->pPickedItem.GetDisplayName(); - v57 = pGlobalTXT_LocalizationStrings[380];//"You already know the %s spell" -LABEL_72: - sprintf(pTmpBuf, v57, v66); + sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[380], v66);//"You already know the %s spell" ShowStatusBarString(pTmpBuf, 2u); -LABEL_92: - v61 = v4; - v52 = v4; - v48 = v4; - v45 = v4; - v43 = -1; - v41 = v4; - v39 = v4; - v37 = (SoundID)27; -LABEL_93: - v14 = pAudioPlayer; -LABEL_63: - pAudioPlayer->PlaySound(v37, v39, v41, v43, v45, v48, v52, v61); + pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); return; } if ( !pParty->pPlayers[player_num-1].CanAct() ) { v66 = aCharacterConditionNames[v3->GetMajorConditionIdx()]; - v57 = pGlobalTXT_LocalizationStrings[382];//"That player is %s" - sprintf(pTmpBuf, v57, v66); + sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[382], v66);//"That player is %s" ShowStatusBarString(pTmpBuf, 2u); - v61 = v4; - v52 = v4; - v48 = v4; - v45 = v4; - v43 = -1; - v41 = v4; - v39 = v4; - v37 = (SoundID)27; - v14 = pAudioPlayer; - pAudioPlayer->PlaySound(v37, v39, v41, v43, v45, v48, v52, v61); + pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); return; } v16 = v15 % 11 + 1; v17 = v3->pActiveSkills[v15 / 11 + 12]; - v75 = v16; v18 = SkillToMastery(v17) - 1; - if ( v18 ) + switch (v18) + { + case 0: v67 = 4; break; + case 1: v67 = 7; break; + case 2: v67 = 10; break; + case 3: v67 = 11; break; + default: + v67 = player_num; + } + + if ( v16 > v67 || !v17 ) { - v19 = v18 - 1; - if ( v19 ) + v22 = pParty->pPickedItem.GetDisplayName(); + sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[381], v22); //"You don't have the skill to learn %s" + ShowStatusBarString(pTmpBuf, 2u); + v3->PlaySound((PlayerSpeech)20, 0); + return; + } + // v72 = 1; + v3->PlaySound(SPEECH_21, 0); + v73 = 0; + + + if ( pGUIWindow_CurrentMenu && pGUIWindow_CurrentMenu->eWindowType != WINDOW_null) + { + if ( !v73 ) { - v20 = v19 - 1; - if ( v20 ) - { - if ( v20 != 1 ) - { - v21 = player_num; -LABEL_83: - if ( v75 > v21 || !v17 ) - { - v22 = pParty->pPickedItem.GetDisplayName(); - sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[381], v22); - ShowStatusBarString(pTmpBuf, 2u); - v3->PlaySound((PlayerSpeech)20, 0); - return; - } - v72 = 1; - v3->PlaySound(SPEECH_21, 0); - v73 = 0; -LABEL_173: - v36 = pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType; - if ( v36 == EQUIP_POTION ) - { - v71 = 0; - v60 = 0; - v51 = 0; - v47 = 0; - v44 = -1; - v42 = 0; - v40 = 0; - v38 = (SoundID)210; - } - else - { - if ( v36 != EQUIP_REAGENT ) - { -LABEL_178: - if ( pGUIWindow_CurrentMenu && pGUIWindow_CurrentMenu->eWindowType != WINDOW_null) - { - if ( !v73 ) - { - pMouse->RemoveHoldingItem(); - return; - } - pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); - } - if ( v73 ) - { - if ( pParty->bTurnBasedModeOn ) - { - *(&pParty->field_16140 + player_num) = 100; - thisb->SetRecoveryTime(100); - pTurnEngine->_40471C(); - } - else - { - thisb->SetRecoveryTime((signed __int64)(flt_6BE3A4_debug_recmod1 * 213.3333333333333)); - } - } - pMouse->RemoveHoldingItem(); - return; - } - v71 = 0; - v60 = 0; - v51 = 0; - v47 = 0; - v44 = -1; - v42 = 0; - v40 = 0; - v38 = (SoundID)211; - } - pAudioPlayer->PlaySound(v38, v40, v42, v44, v47, v51, v60, v71); - goto LABEL_178; - } - v67 = 11; - } - else - { - v67 = 10; - } + pMouse->RemoveHoldingItem(); + return; + } + pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); + } + if ( v73 ) + { + if ( pParty->bTurnBasedModeOn ) + { + pParty->pTurnBasedPlayerRecoveryTimes[player_num-1] = 100; + thisb->SetRecoveryTime(100); + pTurnEngine->_40471C(); } else { - v67 = 7; + thisb->SetRecoveryTime((signed __int64)(flt_6BE3A4_debug_recmod1 * 213.3333333333333)); } } - else - { - v67 = 4; - } - v21 = v67; - goto LABEL_83; + pMouse->RemoveHoldingItem(); + return; + } if ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType == EQUIP_MESSAGE_SCROLL ) @@ -7446,30 +7191,13 @@ if ( pParty->pPlayers[player_num-1].CanAct() ) { CreateMsgScrollWindow(pParty->pPickedItem.uItemID); - v65 = 0; - v56 = SPEECH_37; -LABEL_67: - v3->PlaySound((PlayerSpeech)v56, v65); + v3->PlaySound(SPEECH_37, 0); return; } -LABEL_89: v68 = aCharacterConditionNames[v3->GetMajorConditionIdx()]; - v58 = pGlobalTXT_LocalizationStrings[382]; -LABEL_90: - sprintfex(pTmpBuf, v58, v68); - v23 = pTmpBuf; -LABEL_91: - ShowStatusBarString(v23, 2u); - v4 = 0; - v61 = v4; - v52 = v4; - v48 = v4; - v45 = v4; - v43 = -1; - v41 = v4; - v39 = v4; - v37 = (SoundID)27; - pAudioPlayer->PlaySound(v37, v39, v41, v43, v45, v48, v52, v61); + sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[382], v68); + ShowStatusBarString(pTmpBuf, 2u); + pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); return; } else @@ -7478,90 +7206,54 @@ { thisa = pParty->uCurrentMonthWeek + 1; if ( pParty->uCurrentMonth >= 7 ) - v74 = 0; + v74 = NULL; else v74 = aAttributeNames[pParty->uCurrentMonth]; switch ( pParty->uCurrentMonth ) { case 0: - v6 = pParty->uCurrentMonthWeek + 1; v3->uMight += thisa; - v62 = pGlobalTXT_LocalizationStrings[121]; //"Permanent" - v53 = v74; - v49 = v6; - sprintf(pTmpBuf, "+%u %s %s", v49, v53, v62); + sprintf(pTmpBuf, "+%u %s %s", thisa, v74, pGlobalTXT_LocalizationStrings[121]);//"Permanent" break; case 1: - v6 = pParty->uCurrentMonthWeek + 1; v3->uIntelligence += thisa; - v62 = pGlobalTXT_LocalizationStrings[121]; - v53 = v74; - v49 = v6; - sprintf(pTmpBuf, "+%u %s %s", v49, v53, v62); + sprintf(pTmpBuf, "+%u %s %s", thisa, v74, pGlobalTXT_LocalizationStrings[121]);//"Permanent" break; case 2: - v6 = pParty->uCurrentMonthWeek + 1; v3->uWillpower += thisa; - v62 = pGlobalTXT_LocalizationStrings[121]; - v53 = v74; - v49 = v6; - sprintf(pTmpBuf, "+%u %s %s", v49, v53, v62); + sprintf(pTmpBuf, "+%u %s %s", thisa, v74, pGlobalTXT_LocalizationStrings[121]);//"Permanent" break; case 3: - v6 = pParty->uCurrentMonthWeek + 1; v3->uEndurance += thisa; - v62 = pGlobalTXT_LocalizationStrings[121]; - v53 = v74; - v49 = v6; - sprintf(pTmpBuf, "+%u %s %s", v49, v53, v62); + sprintf(pTmpBuf, "+%u %s %s", thisa, v74, pGlobalTXT_LocalizationStrings[121]);//"Permanent" break; case 4: - v6 = pParty->uCurrentMonthWeek + 1; v3->uAccuracy += thisa; - v62 = pGlobalTXT_LocalizationStrings[121]; - v53 = v74; - v49 = v6; - sprintf(pTmpBuf, "+%u %s %s", v49, v53, v62); + sprintf(pTmpBuf, "+%u %s %s", thisa, v74, pGlobalTXT_LocalizationStrings[121]);//"Permanent" break; case 5: - v6 = pParty->uCurrentMonthWeek + 1; v3->uSpeed += thisa; - v62 = pGlobalTXT_LocalizationStrings[121]; - v53 = v74; - v49 = v6; - sprintf(pTmpBuf, "+%u %s %s", v49, v53, v62); + sprintf(pTmpBuf, "+%u %s %s", thisa, v74, pGlobalTXT_LocalizationStrings[121]);//"Permanent" break; case 6: - v6 = pParty->uCurrentMonthWeek + 1; v3->uLuck += thisa; - v62 = pGlobalTXT_LocalizationStrings[121]; - v53 = v74; - v49 = v6; - sprintf(pTmpBuf, "+%u %s %s", v49, v53, v62); + sprintf(pTmpBuf, "+%u %s %s", thisa, v74, pGlobalTXT_LocalizationStrings[121]);//"Permanent" break; case 7: party_finds_gold(1000 * thisa, 0); - v63 = pGlobalTXT_LocalizationStrings[97];//"Gold" - v54 = 1000 * thisa; - sprintf(pTmpBuf, "+%u %s", v54, v63); + sprintf(pTmpBuf, "+%u %s", 1000 * thisa, pGlobalTXT_LocalizationStrings[97]);//"Gold" break; case 8: Party::GiveFood(5 * thisa); - v63 = pGlobalTXT_LocalizationStrings[653]; //"Food" - v54 = 5 * thisa; - sprintf(pTmpBuf, "+%u %s", v54, v63); + sprintf(pTmpBuf, "+%u %s",5 * thisa , pGlobalTXT_LocalizationStrings[653]);//"Food" break; case 9u: - v63 = pGlobalTXT_LocalizationStrings[LOCSTR_SKILL_POINTS]; v3->uSkillPoints += 2 * thisa; - v54 = 2 * thisa; - sprintf(pTmpBuf, "+%u %s", v54, v63); + sprintf(pTmpBuf, "+%u %s", 2 * thisa, pGlobalTXT_LocalizationStrings[LOCSTR_SKILL_POINTS]); break; case 10: - v63 = pGlobalTXT_LocalizationStrings[LOCSTR_EXPIRIENCE]; - v54 = 2500 * thisa; v3->uExperience += 2500 * thisa; - sprintf(pTmpBuf, "+%u %s", v54, v63); + sprintf(pTmpBuf, "+%u %s", 2500 * thisa, pGlobalTXT_LocalizationStrings[LOCSTR_EXPIRIENCE]); break; case 11: v8 = rand() % 6; @@ -7592,10 +7284,7 @@ v13 = pGlobalTXT_LocalizationStrings[29]; break; } - v62 = pGlobalTXT_LocalizationStrings[121]; - v53 = v13; - v49 = thisa; - sprintf(pTmpBuf, "+%u %s %s", v49, v53, v62); + sprintf(pTmpBuf, "+%u %s %s", thisa, v13, pGlobalTXT_LocalizationStrings[121]); break; } @@ -7603,7 +7292,7 @@ pMouse->RemoveHoldingItem(); pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, player_num - 1); v3->PlaySound(SPEECH_93, 0); - pAudioPlayer->PlaySound((SoundID)(SOUND_Bell|0x2), 0, 0, -1, 0, 0, 0, 0); + pAudioPlayer->PlaySound((SoundID)219, 0, 0, -1, 0, 0, 0, 0); if ( pParty->uDaysPlayed == 6 || pParty->uDaysPlayed == 20 ) { v3->SetCondition(Condition_Eradicated, 0); @@ -7642,11 +7331,10 @@ pAudioPlayer->PlaySound((SoundID)135, 0, 0, -1, 0, 0, 0, 0); return; } - else if ( pParty->pPickedItem.uItemID == 646 ) + else if ( pParty->pPickedItem.uItemID == 646 ) //Horseshoe { pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, player_num - 1); - v5 = 8 * player_num + 392; - LOBYTE(v5) = PID(OBJECT_Player,player_num - 120); + v5 = PID(OBJECT_Player,player_num + 49); pAudioPlayer->PlaySound(SOUND_20001, v5, 0, -1, 0, 0, 0, 0); v3->AddVariable(VAR_NumSkillPoints, 2); } @@ -7659,24 +7347,12 @@ { v68 = pParty->pPickedItem.GetDisplayName(); - v58 = pGlobalTXT_LocalizationStrings[36]; - sprintfex(pTmpBuf, v58, v68); - v23 = pTmpBuf; - ShowStatusBarString(v23, 2u); - v4 = 0; - v61 = v4; - v52 = v4; - v48 = v4; - v45 = v4; - v43 = -1; - v41 = v4; - v39 = v4; - v37 = (SoundID)27; - pAudioPlayer->PlaySound(v37, v39, v41, v43, v45, v48, v52, v61); + sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[36],v68);//"%s can not be used that way" + ShowStatusBarString(pTmpBuf, 2u); + pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); return; } - -LABEL_187: + pMouse->RemoveHoldingItem(); return; } @@ -7685,7 +7361,7 @@ //----- (00449BB4) -------------------------------------------------------- bool Player::CompareVariable( enum VariableType VarNum, signed int pValue ) - { +{ Player *v3; // esi@1 signed int v4; // edi@1 unsigned int v5; // eax@8 @@ -7820,8 +7496,8 @@ case VAR_NPCs2: return pNPCStats->pNewNPCData[pValue].Hired(); case VAR_MonthEquals|VAR_CurrentSP: - test_bit_value = 0x80u >> ((signed __int16)a1 - 1) % 8; - our_bit_value = this->field_1A50[((signed __int16)a1 - 1)/8]; + test_bit_value = 0x80u >> ((signed __int16)pValue - 1) % 8; + our_bit_value = this->field_1A50[((signed __int16)pValue - 1)/8]; if ( !((unsigned __int8)test_bit_value & our_bit_value) ) return v4 >= pValue; v4 = pValue; @@ -7882,8 +7558,8 @@ } if ( VarNum == VAR_AutoNotes ) { - test_bit_value = 0x80u >> ((signed __int16)(a1 - 1) - 1) % 8; - our_bit_value = pParty->_autonote_bits[((signed __int16)(a1 - 1) - 1) /8]; + test_bit_value = 0x80u >> ((signed __int16)(pValue - 1) - 1) % 8; + our_bit_value = pParty->_autonote_bits[((signed __int16)(pValue - 1) - 1) /8]; if ( !((unsigned __int8)test_bit_value & our_bit_value) ) return false; return true; @@ -7952,8 +7628,8 @@ v12 = GetActualAge(); goto _j_cmp_against_arg; case VAR_Award: - test_bit_value = 0x80u >> ((signed __int16)a1 - 1) % 8; - our_bit_value = this->_guilds_member_bits[((signed __int16)a1 - 1) /8]; + test_bit_value = 0x80u >> ((signed __int16)pValue - 1) % 8; + our_bit_value = this->_guilds_member_bits[((signed __int16)pValue - 1) /8]; if ( !((unsigned __int8)test_bit_value & our_bit_value) ) return true; return false; @@ -8253,8 +7929,8 @@ case VAR_NPCs2: pParty->field_709 = 0; LOBYTE(pNPCStats->pNewNPCData[var_value].uFlags) |= 0x80u; - Party__CountHirelings(); - viewparams->bRedrawGameUI = 1; + pParty->CountHirelings(); + viewparams->bRedrawGameUI = true; break; case VAR_NumSkillPoints: this->uSkillPoints = var_value; @@ -9209,8 +8885,8 @@ case VAR_NPCs2: pParty->field_709 = 0; LOBYTE(pNPCStats->pNewNPCData[val].uFlags) |= 0x80u; - Party__CountHirelings(); - viewparams->bRedrawGameUI = 1; + pParty->CountHirelings(); + viewparams->bRedrawGameUI = true; break; case VAR_NumSkillPoints: Dst->uSkillPoints += val; @@ -9325,8 +9001,8 @@ { pParty->field_709 = 0; LOBYTE(pNPCStats->pNewNPCData[(int)pValue].uFlags) &= 0x7Fu; - Party__CountHirelings(); - viewparams->bRedrawGameUI = 1; + pParty->CountHirelings(); + viewparams->bRedrawGameUI = true; } break; case 241: @@ -9352,7 +9028,7 @@ if ( pParty->pHirelings[1].uProfession == pValue ) memset(&pParty->pHirelings[1], 0, 0x4Cu); pParty->field_709 = 0; - Party__CountHirelings(); + pParty->CountHirelings(); break; case 243: v17 = (char *)&this->uSkillPoints; @@ -9454,7 +9130,7 @@ pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); return result; case VAR_CurrentHP: - ReceiveDamage((signed int)pValue, 4); + ReceiveDamage((signed int)pValue, DMGT_PHISYCAL); pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); v8 = 8 * v4 + 400; LOBYTE(v8) = PID(OBJECT_Player,v4 - 112);
--- a/Player.h Thu May 23 11:16:46 2013 +0600 +++ b/Player.h Thu May 23 11:17:01 2013 +0600 @@ -143,47 +143,61 @@ CHARACTER_RACE_GOBLIN = 2, CHARACTER_RACE_DWARF = 3, }; -enum CHARACTER_ATTRIBUTE -{ - CHARACTER_MIGHT = 0x0, - CHARACTER_INTELLIGANCE = 0x1, - CHARACTER_WILLPOWER = 0x2, - CHARACTER_ENDURANCE = 0x3, - CHARACTER_ACCURACY = 0x4, - CHARACTER_SPEED = 0x5, - CHARACTER_LUCK = 0x6, -}; - - /* 332 */ enum CHARACTER_ATTRIBUTE_TYPE { - CHARACTER_ATTRIBUTE_STRENGTH = 0x0, - CHARACTER_ATTRIBUTE_INTELLIGENCE = 0x1, - CHARACTER_ATTRIBUTE_WILLPOWER = 0x2, - CHARACTER_ATTRIBUTE_ENDURANCE = 0x3, - CHARACTER_ATTRIBUTE_ACCURACY = 0x4, - CHARACTER_ATTRIBUTE_SPEED = 0x5, - CHARACTER_ATTRIBUTE_LUCK = 0x6, - CHARACTER_ATTRIBUTE_HEALTH = 0x7, - CHARACTER_ATTRIBUTE_MANA = 0x8, - CHARACTER_ATTRIBUTE_AC_BONUS = 0x9, - CHARACTER_ATTRIBUTE_RESIST_FIRE = 0xA, - CHARACTER_ATTRIBUTE_RESIST_AIR = 0xB, - CHARACTER_ATTRIBUTE_RESIST_WATER = 0xC, - CHARACTER_ATTRIBUTE_RESIST_EARTH = 0xD, - CHARACTER_ATTRIBUTE_RESIST_MIND = 0xE, - CHARACTER_ATTRIBUTE_RESIST_BODY = 0xF, - CHARACTER_ATTRIBUTE_LEVEL = 0x18, - CHARACTER_ATTRIBUTE_ATTACK = 0x19, - CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS = 0x1A, - CHARACTER_ATTRIBUTE_MELEE_DMG_MIN = 0x1B, - CHARACTER_ATTRIBUTE_MELEE_DMG_MAX = 0x1C, - CHARACTER_ATTRIBUTE_RANGED_ATTACK = 0x1D, - CHARACTER_ATTRIBUTE_RANGED_DAMAGE_BONUS = 0x1E, - CHARACTER_ATTRIBUTE_RANGED_DAMAGE_MIN = 0x1F, - CHARACTER_ATTRIBUTE_RANGED_DAMAGE_MAX = 0x20, + CHARACTER_ATTRIBUTE_STRENGTH = 0, + CHARACTER_ATTRIBUTE_INTELLIGENCE = 1, + CHARACTER_ATTRIBUTE_WILLPOWER = 2, + CHARACTER_ATTRIBUTE_ENDURANCE = 3, + CHARACTER_ATTRIBUTE_ACCURACY = 4, + CHARACTER_ATTRIBUTE_SPEED = 5, + CHARACTER_ATTRIBUTE_LUCK = 6, + CHARACTER_ATTRIBUTE_HEALTH = 7, + CHARACTER_ATTRIBUTE_MANA = 8, + CHARACTER_ATTRIBUTE_AC_BONUS = 9, + + CHARACTER_ATTRIBUTE_RESIST_FIRE = 10, + CHARACTER_ATTRIBUTE_RESIST_AIR = 11, + CHARACTER_ATTRIBUTE_RESIST_WATER = 12, + CHARACTER_ATTRIBUTE_RESIST_EARTH = 13, + CHARACTER_ATTRIBUTE_RESIST_MIND = 14, + CHARACTER_ATTRIBUTE_RESIST_BODY = 15, + + CHARACTER_ATTRIBUTE_SKILL_ALCHEMY = 16, + CHARACTER_ATTRIBUTE_SKILL_STEALING = 17, + CHARACTER_ATTRIBUTE_SKILL_TRAP_DISARM = 18, + CHARACTER_ATTRIBUTE_SKILL_ITEM_ID = 19, + CHARACTER_ATTRIBUTE_SKILL_MONSTER_ID = 20, + CHARACTER_ATTRIBUTE_SKILL_ARMSMASTER = 21, + CHARACTER_ATTRIBUTE_SKILL_DODGE = 22, + CHARACTER_ATTRIBUTE_SKILL_UNARMED = 23, + + CHARACTER_ATTRIBUTE_LEVEL = 24, + CHARACTER_ATTRIBUTE_ATTACK = 25, + CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS = 26, + CHARACTER_ATTRIBUTE_MELEE_DMG_MIN = 27, + CHARACTER_ATTRIBUTE_MELEE_DMG_MAX = 28, + CHARACTER_ATTRIBUTE_RANGED_ATTACK = 29, + CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS = 30, + CHARACTER_ATTRIBUTE_RANGED_DMG_MIN = 31, + CHARACTER_ATTRIBUTE_RANGED_DMG_MAX = 32, + CHARACTER_ATTRIBUTE_RESIST_SPIRIT = 33, + + CHARACTER_ATTRIBUTE_SKILL_FIRE = 34, + CHARACTER_ATTRIBUTE_SKILL_AIR = 35, + CHARACTER_ATTRIBUTE_SKILL_WATER = 36, + CHARACTER_ATTRIBUTE_SKILL_EARTH = 37, + CHARACTER_ATTRIBUTE_SKILL_SPIRIT = 38, + CHARACTER_ATTRIBUTE_SKILL_MIND = 39, + CHARACTER_ATTRIBUTE_SKILL_BODY = 40, + CHARACTER_ATTRIBUTE_SKILL_LIGHT = 41, + CHARACTER_ATTRIBUTE_SKILL_DARK = 42, + CHARACTER_ATTRIBUTE_SKILL_MEDITATION = 43, + CHARACTER_ATTRIBUTE_SKILL_BOW = 44, + CHARACTER_ATTRIBUTE_SKILL_SHIELD = 45, + CHARACTER_ATTRIBUTE_SKILL_LEARNING = 46 }; /* 328 */ @@ -491,7 +505,7 @@ char *GetRangedDamageString(); bool CanTrainToNextLevel(); unsigned int GetExperienceDisplayColor(); - int CalculateIncommingDamage(int resistance, signed int type); + int CalculateIncommingDamage(DAMAGE_TYPE dmg_type, int amount); ITEM_EQUIP_TYPE GetEquippedItemEquipType(ITEM_EQUIP_TYPE uEquipSlot); PLAYER_SKILL_TYPE GetEquippedItemSkillType(ITEM_EQUIP_TYPE uEquipSlot); bool IsUnarmed(); @@ -501,7 +515,7 @@ bool StealFromShop(struct ItemGen *a2, int a3, int a4, int a5, int *a6); int StealFromActor(unsigned int uActorID, int _steal_perm, int reputation); void Heal(int amount); - int ReceiveDamage(signed int type, int resistance); + int ReceiveDamage(signed int amount, DAMAGE_TYPE dmg_type); int _48DCF6(int a2, struct Actor *pActor); unsigned int GetSpellSchool(unsigned int uSpellID); int GetAttackRecoveryTime(bool bRangedAttack); @@ -516,7 +530,7 @@ void SetRecoveryTime(signed int sRecoveryTime); void RandomizeName(); unsigned int GetMajorConditionIdx(); - int _48EA1B_get_static_effect(int a2); + int GetParameterBonus(int player_parameter); int _48EA46_calc_special_bonus_by_items(int a2); int GetItemsBonus(enum CHARACTER_ATTRIBUTE_TYPE attr, int a3); int GetMagicalBonus(enum CHARACTER_ATTRIBUTE_TYPE a2); @@ -571,7 +585,7 @@ int GetBuyingPrice(unsigned int uRealValue, float price_multiplier); int GetPriceSell(int uRealValue, float price_multiplier); int _4B807C(float a2); - int _4B8040_condition_time(unsigned int uCondition); + int GetConditionDayOfWeek(unsigned int uCondition); bool _43EEF3(); void SalesProcess(unsigned int inventory_idnx, int item_index, int _2devent_idx);//0x4BE2DD bool Recover(signed int a2);
--- a/Render.cpp Thu May 23 11:16:46 2013 +0600 +++ b/Render.cpp Thu May 23 11:17:01 2013 +0600 @@ -5549,11 +5549,7 @@ { if ( v1->field_40110 ) { - if (pAsyncMouse) - pAsyncMouse->_46BAEC(); pRenderD3D->Present(false); - if (pAsyncMouse) - pAsyncMouse->_46BB0A(); } } else @@ -6518,8 +6514,6 @@ result = pSurface->Lock(0, pDesc, uLockFlags, 0); if ( result == DDERR_SURFACELOST ) { - if (pAsyncMouse) - pAsyncMouse->Suspend(); v6 = v4->Restore(); if ( v6 ) { @@ -6548,8 +6542,6 @@ if ( pRenderer->pRenderD3D ) pRenderD3D->HandleLostResources(); result = pRenderer->pDirectDraw4->RestoreAllSurfaces(); - if (pAsyncMouse) - pAsyncMouse->Resume(); } else { @@ -10923,10 +10915,6 @@ BYTE1(dword_6BE364_game_settings_1) &= 0xEFu; else pMiscTimer->Resume(); - pAsyncMouse->Release(); - CreateAsyncMouse(); - if (pAsyncMouse) - pAsyncMouse->Clip(); } } // 6BE364: using guessed type int dword_6BE364_game_settings_1;
--- a/SpriteObject.cpp Thu May 23 11:16:46 2013 +0600 +++ b/SpriteObject.cpp Thu May 23 11:17:01 2013 +0600 @@ -1080,7 +1080,7 @@ if ( (*v12)->CanAct() && (v13 = (*v12)->GetPerception() + 20, rand() % v13 > 20) ) (*v12)->PlaySound(SPEECH_6, 0); else - (*v12)->ReceiveDamage(v11, v18); + (*v12)->ReceiveDamage(v11, (DAMAGE_TYPE)v18); ++v12; } while ( (signed int)v12 <= (signed int)&pPlayers[4] );
--- a/Time.cpp Thu May 23 11:16:46 2013 +0600 +++ b/Time.cpp Thu May 23 11:17:01 2013 +0600 @@ -21,7 +21,7 @@ //----- (00426317) -------------------------------------------------------- unsigned __int64 Timer::Time() { - uint v2 = (timeGetTime() * 128) / 1000; + uint v2 = TimeQuant * timeGetTime() / 1000; if (v2 < uStartTime) uStartTime = 0; return v2;
--- a/Time.h Thu May 23 11:16:46 2013 +0600 +++ b/Time.h Thu May 23 11:17:01 2013 +0600 @@ -40,6 +40,14 @@ unsigned int uTimeElapsed; int dt_in_some_format; unsigned int uTotalGameTimeElapsed; + + static const unsigned int TimeQuant = 128; + static const unsigned int Minute = 2 * TimeQuant; + static const unsigned int Hour = 60 * Minute; + static const unsigned int Day = 24 * Hour; + static const unsigned int Week = 7 * Day; + static const unsigned int Month = 4 * Week; + static const unsigned int Year = 12 * Month; }; #pragma pack(pop) @@ -47,11 +55,4 @@ extern Timer *pMiscTimer; -extern Timer *pEventTimer; - -const unsigned int Minute = 256; -const unsigned int Hour = 60 * Minute; -const unsigned int Day = 24 * Hour; -const unsigned int Week = 7 * Day; -const unsigned int Month = 4 * Week; -const unsigned int Year = 12 * Month; \ No newline at end of file +extern Timer *pEventTimer; \ No newline at end of file
--- a/UIBooks.cpp Thu May 23 11:16:46 2013 +0600 +++ b/UIBooks.cpp Thu May 23 11:17:01 2013 +0600 @@ -27,6 +27,151 @@ +//----- (00411150) -------------------------------------------------------- +void BookUI_DrawTownPortalMap() +{ + //signed int v0; // edi@1 + //__int16 v1; // dx@8 + //POINT *v2; // edi@17 + int v3; // edi@17 + //__int16 v4; // dx@24 + GUIWindow v6; // [sp+Ch] [bp-64h]@1 + //POINT v7; // [sp+60h] [bp-10h]@17 + POINT a2; // [sp+68h] [bp-8h]@17 + + pRenderer->ClearZBuffer(0, 479); + pRenderer->DrawTextureTransparent(8, 8, pTexture_CurrentBook); + pRenderer->DrawTextureTransparent(471, 445, pIcons_LOD->GetTexture(uExitCancelTextureId)); + + v6.uFrameX = game_viewport_x; + v6.uFrameY = game_viewport_y; + v6.uFrameWidth = game_viewport_width; + v6.uFrameHeight = game_viewport_height; + v6.uFrameZ = game_viewport_z; + v6.uFrameW = game_viewport_w; + + const uint fountain_bits_lut[] = {PARTY_QUEST_FOUNTAIN_HARMONDALE, + PARTY_QUEST_FOUNTAIN_PIERPONT, + PARTY_QUEST_FOUNTAIN_NIGHON, + PARTY_QUEST_FOUNTAIN_EVENMORN_ISLE, + PARTY_QUEST_FOUNTAIN_CELESTIA, + PARTY_QUEST_FOUNTAIN_THE_PIT}; + for (uint i = 0; i < 6; ++i) + { + + if (_449B57_test_bit(pParty->_quest_bits, fountain_bits_lut[i])) + pRenderer->DrawMaskToZBuffer(pTownPortalBook_xs[i], + pTownPortalBook_ys[i], + pTexture_TownPortalIcons[i], i + 1); + } + +/* v0 = 0; + do + { + if ( !v0 ) + { + v1 = 206; +LABEL_14: + if ( !(unsigned __int16)_449B57_test_bit(pParty->_quest_bits, v1) ) + goto LABEL_16; + goto LABEL_15; + } + if ( v0 == 1 ) + { + v1 = 208; + goto LABEL_14; + } + if ( v0 == 2 ) + { + v1 = 207; + goto LABEL_14; + } + if ( v0 == 3 ) + { + v1 = 211; + goto LABEL_14; + } + if ( v0 == 4 ) + { + v1 = 209; + goto LABEL_14; + } + if ( v0 == 5 ) + { + v1 = 210; + goto LABEL_14; + } +LABEL_15: + pRenderer->DrawMaskToZBuffer( + pTownPortalBook_xs[v0], + pTownPortalBook_ys[v0], + *(&pTexture_TownPortalHarmn + v0), + v0 + 1); +LABEL_16: + ++v0; + } + while ( v0 < 6 );*/ + + pMouse->GetCursorPos(&a2); + //v2 = pMouse->GetCursorPos(&a2); + v3 = pRenderer->pActiveZBuffer[a2.x + pSRZBufferLineOffsets[a2.y]] & 0xFFFF; + + if (v3) + { + if (_449B57_test_bit(pParty->_quest_bits, fountain_bits_lut[v3 - 1])) + pRenderer->DrawTextureIndexed(pTownPortalBook_xs[v3 - 1], pTownPortalBook_ys[v3 - 1], pTexture_TownPortalIcons[v3 - 1]); + } + v6.DrawTitleText(pBook2Font, 0, 22u, 0, pGlobalTXT_LocalizationStrings[10], 3u); + + +/* if ( !v3 ) // Town Portal + { + v6.DrawTitleText(pBook2Font, 0, 22, 0, pGlobalTXT_LocalizationStrings[10], 3); // "Town Portal" + return; + } + if ( v3 == 1 ) + { + v4 = 206; +LABEL_30: + if ( (unsigned __int16)_449B57_test_bit(pParty->_quest_bits, v4) ) + goto LABEL_31; + v6.DrawTitleText(pBook2Font, 0, 22u, 0, pGlobalTXT_LocalizationStrings[10], 3u); // "Town Portal" + return; + } + if ( v3 == 2 ) + { + v4 = 208; + goto LABEL_30; + } + if ( v3 == 3 ) + { + v4 = 207; + goto LABEL_30; + } + if ( v3 == 4 ) + { + v4 = 211; + goto LABEL_30; + } + if ( v3 == 5 ) + { + v4 = 209; + goto LABEL_30; + } + if ( v3 == 6 ) + { + v4 = 210; + goto LABEL_30; + } +LABEL_31: + pRenderer->DrawTextureIndexed(word_4E1D3A[v3], pTownPortalBook_xs[v3 + 5], *(&pTex_tab_an_6b__zoom_on + v3)); + v6.DrawTitleText(pBook2Font, 0, 22u, 0, pGlobalTXT_LocalizationStrings[10], 3u);*/ +} +// 4E1D3A: using guessed type __int16 word_4E1D3A[]; + + + + //----- (00413CC6) -------------------------------------------------------- void BookUI_Draw(WindowType book) { @@ -40,7 +185,7 @@ case WINDOW_JournalBook: BookUI_Journal_Draw(); break; case WINDOW_LloydsBeacon: DrawLloydBeaconsScreen(); break; - case WINDOW_TownPortal: DrawTownPortalScreen(); break; + case WINDOW_TownPortal: BookUI_DrawTownPortalMap(); break; } }
--- a/UICharacter.cpp Thu May 23 11:16:46 2013 +0600 +++ b/UICharacter.cpp Thu May 23 11:17:01 2013 +0600 @@ -46,6 +46,12 @@ unsigned int ui_game_minimap_treasure_color; unsigned int ui_game_character_record_playerbuff_colors[24]; +unsigned int ui_gamemenu_video_gamma_title_color; +unsigned int ui_gamemenu_keys_action_name_color; +unsigned int ui_gamemenu_keys_key_selection_blink_color_1; +unsigned int ui_gamemenu_keys_key_selection_blink_color_2; +unsigned int ui_gamemenu_keys_key_default_color; + unsigned int ui_book_quests_title_color; unsigned int ui_book_quests_text_color; unsigned int ui_book_autonotes_title_color; @@ -118,6 +124,12 @@ ui_game_character_record_playerbuff_colors[22] = TargetColor(0, 128, 255); ui_game_character_record_playerbuff_colors[23] = TargetColor(0, 128, 255); + ui_gamemenu_video_gamma_title_color = TargetColor(255, 255, 155); + ui_gamemenu_keys_action_name_color = TargetColor(255, 255, 255); + ui_gamemenu_keys_key_selection_blink_color_1 = TargetColor(50, 0, 0); + ui_gamemenu_keys_key_selection_blink_color_2 = TargetColor(225, 205, 35); + ui_gamemenu_keys_key_default_color = TargetColor(255, 255, 255); + ui_book_quests_title_color = TargetColor(255, 255, 255); ui_book_quests_text_color = TargetColor(255, 255, 255); ui_book_autonotes_title_color = TargetColor(255, 255, 255);
--- a/UIHouses.cpp Thu May 23 11:16:46 2013 +0600 +++ b/UIHouses.cpp Thu May 23 11:17:01 2013 +0600 @@ -476,7 +476,7 @@ pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; viewparams->bRedrawGameUI = 1; uDialogueType = 0; - pKeyActionMap->_459ED1(3); + pKeyActionMap->SetWindowInputStatus(3); pKeyActionMap->ResetKeys(); if (uHouseID == HOUSE_600 || uHouseID == HOUSE_601) { @@ -2097,7 +2097,7 @@ v6 = TargetColor(0xFFu, 0xFFu, 0xFFu); v7 = v5->pName; v8 = TargetColor(0xFFu, 0xFFu, 0x9Bu); - sprintf(pTmpBuf, &byte_4F0F98, v8, v7, v6); + sprintf(pTmpBuf, "\f%05d%s\f%05d", v8, v7, v6); sprintf(pTmpBuf2, dword_F8B1A4, pTmpBuf, 100 * v5->uLevel); current_npc_text = pTmpBuf2; memcpy(&a1, pDialogueWindow, sizeof(a1)); @@ -2121,31 +2121,23 @@ case HOUSE_DIALOGUE_TOWNHALL_100: { v0 = window_SpeakInHouse; - if ( window_SpeakInHouse->field_40 == 1 ) + if ( window_SpeakInHouse->receives_keyboard_input_2 == WINDOW_INPUT_IN_PROGRESS) { - sprintf(pTmpBuf, "%s\n%s", pGlobalTXT_LocalizationStrings[606], pGlobalTXT_LocalizationStrings[112]); + sprintfex(pTmpBuf, "%s\n%s", pGlobalTXT_LocalizationStrings[606], pGlobalTXT_LocalizationStrings[112]); // "Pay" "How Much?" _this.DrawTitleText(pFontArrus, 0, 0x92u, v30, pTmpBuf, 3u); - _this.DrawTitleText(pFontArrus, 0, 0xBAu, v28, (const char *)pKeyActionMap->pPressedKeysBuffer, 3u); + _this.DrawTitleText(pFontArrus, 0, 0xBAu, v28, (const char *)pKeyActionMap->pPressedKeysBuffer, 3); v3 = pFontArrus; v4 = pFontArrus->GetLineWidth((const char *)pKeyActionMap->pPressedKeysBuffer); _this.DrawFlashingInputCursor(v4 / 2 + 80, 185, v3); return; } - if ( window_SpeakInHouse->field_40 == 2 ) + if ( window_SpeakInHouse->receives_keyboard_input_2 == WINDOW_INPUT_CONFIRMED) { v1 = atoi((const char *)pKeyActionMap->pPressedKeysBuffer); v2 = v1; if ( v1 <= 0 ) { - //LABEL_8: pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); - /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) - { - pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape; - pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 1; - *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; - ++pMessageQueue_50CBD0->uNumMessages; - }*/ return; } if ( v1 > pParty->uNumGold ) @@ -2163,9 +2155,9 @@ pPlayers[uActiveCharacter]->PlaySound(SPEECH_81, 0); v0 = window_SpeakInHouse; } - if ( window_SpeakInHouse->field_40 == 3 ) + if ( window_SpeakInHouse->receives_keyboard_input_2 == WINDOW_INPUT_CANCELLED) { - v0->field_40 = 0; + v0->receives_keyboard_input_2 = WINDOW_INPUT_NONE; pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); } break; @@ -2177,14 +2169,14 @@ } return; } -// F8B19C: using guessed type int dword_F8B19C; -// F8B1A0: using guessed type __int16 word_F8B1A0; + + //----- (004B7D7E) -------------------------------------------------------- void __cdecl BankDialog() { GUIWindow *v0; // eax@4 - int v1; // ecx@5 + //int v1; // ecx@5 int v2; // eax@6 unsigned int v3; // esi@6 GUIFont *v4; // ST10_4@12 @@ -2224,24 +2216,15 @@ case HOUSE_DIALOGUE_BANK_7: { v0 = window_SpeakInHouse; - if ( window_SpeakInHouse->field_40 != 1 ) + if ( window_SpeakInHouse->receives_keyboard_input_2 != WINDOW_INPUT_IN_PROGRESS) { - v1 = window_SpeakInHouse->field_40 - 2; - if ( window_SpeakInHouse->field_40 == 2 ) + if ( window_SpeakInHouse->receives_keyboard_input_2 == WINDOW_INPUT_CONFIRMED) { v6 = atoi((const char *)pKeyActionMap->pPressedKeysBuffer); v7 = v6; if ( !v6 ) { -//LABEL_17: pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); - /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) - { - pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape; - pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 1; - *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; - ++pMessageQueue_50CBD0->uNumMessages; - }*/ return; } if ( v6 > pParty->uNumGold ) @@ -2257,13 +2240,13 @@ pPlayers[uActiveCharacter]->PlaySound(SPEECH_81, 0); } v0 = window_SpeakInHouse; - v0->field_40 = 0; + v0->receives_keyboard_input_2 = WINDOW_INPUT_NONE; pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); return; } - if ( v1 != 1 ) + if (window_SpeakInHouse->receives_keyboard_input_2 != WINDOW_INPUT_CANCELLED) return; - v0->field_40 = 0; + v0->receives_keyboard_input_2 = WINDOW_INPUT_NONE; pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); return; } @@ -2281,12 +2264,11 @@ case HOUSE_DIALOGUE_BANK_8: { v0 = window_SpeakInHouse; - if ( window_SpeakInHouse->field_40 != 1 ) + if ( window_SpeakInHouse->receives_keyboard_input_2 != WINDOW_INPUT_IN_PROGRESS) { - v1 = window_SpeakInHouse->field_40 - 2; - if ( window_SpeakInHouse->field_40 == 2 ) + if ( window_SpeakInHouse->receives_keyboard_input_2 == WINDOW_INPUT_CONFIRMED) { - window_SpeakInHouse->field_40 = 0; + window_SpeakInHouse->receives_keyboard_input_2 = WINDOW_INPUT_NONE; v2 = atoi((const char *)pKeyActionMap->pPressedKeysBuffer); v3 = v2; if ( v2 ) @@ -2302,18 +2284,19 @@ pParty->uNumGoldInBank -= v3; } } + v0->receives_keyboard_input_2 = WINDOW_INPUT_NONE; pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); return; } - if ( v1 != 1 ) + if ( window_SpeakInHouse->receives_keyboard_input_2 != WINDOW_INPUT_CANCELLED) return; - v0->field_40 = 0; + v0->receives_keyboard_input_2 = WINDOW_INPUT_NONE; pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); return; } v11 = pGlobalTXT_LocalizationStrings[112]; v10 = pGlobalTXT_LocalizationStrings[244]; - sprintf(pTmpBuf, "%s\n%s", v10, v11); + sprintfex(pTmpBuf, "%s\n%s", v10, v11); _this.DrawTitleText(pFontArrus, 0, 0x92u, v14[0], pTmpBuf, 3u); _this.DrawTitleText(pFontArrus, 0, 0xBAu, v13[0], (const char *)pKeyActionMap->pPressedKeysBuffer, 3u); v4 = pFontArrus; @@ -4805,7 +4788,7 @@ HIDWORD(v59) = TargetColor(0xFFu, 0xFFu, 0x9Bu); v1 = pPlayers[uActiveCharacter]; //v2 = pPlayers[uActiveCharacter]->_4B807C(p2DEvents_minus1__20[13 * (unsigned int)v0->ptr_1C]); - v2 = pPlayers[uActiveCharacter]->_4B807C(p2DEvents[(unsigned int)v0->ptr_1C - 1].fPriceMultiplier); + v2 = pPlayers[uActiveCharacter]->_4B807C(p2DEvents[v0->par1C - 1].fPriceMultiplier); HIDWORD(v60) = v2; if ( dialog_menu_id != HOUSE_DIALOGUE_MAIN ) {
--- a/UIMainMenu.cpp Thu May 23 11:16:46 2013 +0600 +++ b/UIMainMenu.cpp Thu May 23 11:17:01 2013 +0600 @@ -49,40 +49,44 @@ //----- (0041B578) -------------------------------------------------------- -void __cdecl MainMenuUI_LoadFontsAndSomeStuff() - { - pIcons_LOD->SetupPalettes(pRenderer->uTargetRBits, - pRenderer->uTargetGBits, - pRenderer->uTargetBBits); - pPaletteManager->SetColorChannelInfo(pRenderer->uTargetRBits, - pRenderer->uTargetGBits, - pRenderer->uTargetBBits); - pPaletteManager->RecalculateAll(); +void MainMenuUI_LoadFontsAndSomeStuff() +{ + pIcons_LOD->SetupPalettes(pRenderer->uTargetRBits, + pRenderer->uTargetGBits, + pRenderer->uTargetBBits); + pPaletteManager->SetColorChannelInfo(pRenderer->uTargetRBits, + pRenderer->uTargetGBits, + pRenderer->uTargetBBits); + pPaletteManager->RecalculateAll(); - for (uint i = 0; i < 480; ++i) - pSRZBufferLineOffsets[i] = 640 * i; + for (uint i = 0; i < 480; ++i) + pSRZBufferLineOffsets[i] = 640 * i; - pRenderer->ResetTextureClipRect(); + pRenderer->ResetTextureClipRect(); + + uTextureID_FONTPAL = pIcons_LOD->LoadTexture("FONTPAL", TEXTURE_16BIT_PALETTE); - uTextureID_FONTPAL = pIcons_LOD->LoadTexture("FONTPAL", TEXTURE_16BIT_PALETTE); - pFontArrus = LoadFont("arrus.fnt", "FONTPAL", NULL); - pFontLucida = LoadFont("lucida.fnt", "FONTPAL", NULL); - pFontCreate = LoadFont("create.fnt", "FONTPAL", NULL); - pFontSmallnum = LoadFont("smallnum.fnt", "FONTPAL", NULL); - pFontComic = LoadFont("comic.fnt", "FONTPAL", NULL); - pFontArrus->field_3 = 0; - pFontLucida->field_3 = 0; - pFontCreate->field_3 = 0; + pFontArrus = LoadFont("arrus.fnt", "FONTPAL", nullptr); + pFontArrus->field_3 = 0; + + pFontLucida = LoadFont("lucida.fnt", "FONTPAL", nullptr); + pFontLucida->field_3 = 0; + + pFontCreate = LoadFont("create.fnt", "FONTPAL", nullptr); + pFontCreate->field_3 = 0; - for (uint i = 0; i < 20; ++i) - pWindowList[i].eWindowType = WINDOW_null; + pFontSmallnum = LoadFont("smallnum.fnt", "FONTPAL", nullptr); + pFontComic = LoadFont("comic.fnt", "FONTPAL", nullptr); - uNumVisibleWindows = -1; - memset(pVisibleWindowsIdxs, 0, sizeof(pVisibleWindowsIdxs)); - } + for (uint i = 0; i < 20; ++i) + pWindowList[i].eWindowType = WINDOW_null; + + uNumVisibleWindows = -1; + memset(pVisibleWindowsIdxs, 0, sizeof(pVisibleWindowsIdxs)); +} //----- (004415C5) -------------------------------------------------------- -void LoadPartyBuffIcons() +static void LoadPartyBuffIcons() { for (uint i = 0; i < 14; ++i) { @@ -96,8 +100,8 @@ } //----- (0041B690) -------------------------------------------------------- -void __cdecl MainMenuUI_Create() - { +void MainMenuUI_Create() +{ //unsigned int v0; // eax@1 //unsigned int v1; // eax@1 //unsigned int v2; // eax@1 @@ -173,14 +177,14 @@ pPrimaryWindow->CreateButton(0xB1u, 0x1A8u, 0x1Fu, 0x28u, 2, 94, UIMSG_SelectCharacter, 2, '2', "", 0); pPrimaryWindow->CreateButton(0x124u, 0x1A8u, 0x1Fu, 0x28u, 2, 94, UIMSG_SelectCharacter, 3, '3', "", 0); pPrimaryWindow->CreateButton(0x197u, 0x1A8u, 0x1Fu, 0x28u, 2, 94, UIMSG_SelectCharacter, 4, '4', "", 0); - pPrimaryWindow->CreateButton(0x18u, 0x194u, 5u, 0x31u, 1, 93, UIMSG_0, 1u, 0, "", 0); - pPrimaryWindow->CreateButton(0x8Bu, 0x194u, 5u, 0x31u, 1, 93, UIMSG_0, 2u, 0, "", 0); - pPrimaryWindow->CreateButton(0xFFu, 0x194u, 5u, 0x31u, 1, 93, UIMSG_0, 3u, 0, "", 0); - pPrimaryWindow->CreateButton(0x172u, 0x194u, 5u, 0x31u, 1, 93, UIMSG_0, 4u, 0, "", 0); - pPrimaryWindow->CreateButton(0x61u, 0x194u, 5u, 0x31u, 1, 93, UIMSG_0, 1u, 0, "", 0); - pPrimaryWindow->CreateButton(0xD4u, 0x194u, 5u, 0x31u, 1, 93, UIMSG_0, 2u, 0, "", 0); - pPrimaryWindow->CreateButton(0x148u, 0x194u, 5u, 0x31u, 1, 93, UIMSG_0, 3u, 0, "", 0); - pPrimaryWindow->CreateButton(0x1BBu, 0x194u, 5u, 0x31u, 1, 93, UIMSG_0, 4u, 0, "", 0); + pPrimaryWindow->CreateButton(0x18u, 0x194u, 5u, 0x31u, 1, 93, UIMSG_0, 1, 0, "", 0); + pPrimaryWindow->CreateButton(0x8Bu, 0x194u, 5u, 0x31u, 1, 93, UIMSG_0, 2, 0, "", 0); + pPrimaryWindow->CreateButton(0xFFu, 0x194u, 5u, 0x31u, 1, 93, UIMSG_0, 3, 0, "", 0); + pPrimaryWindow->CreateButton(0x172u, 0x194u, 5u, 0x31u, 1, 93, UIMSG_0, 4, 0, "", 0); + pPrimaryWindow->CreateButton(0x61u, 0x194u, 5u, 0x31u, 1, 93, UIMSG_0, 1, 0, "", 0); + pPrimaryWindow->CreateButton(0xD4u, 0x194u, 5u, 0x31u, 1, 93, UIMSG_0, 2, 0, "", 0); + pPrimaryWindow->CreateButton(0x148u, 0x194u, 5u, 0x31u, 1, 93, UIMSG_0, 3, 0, "", 0); + pPrimaryWindow->CreateButton(0x1BBu, 0x194u, 5u, 0x31u, 1, 93, UIMSG_0, 4, 0, "", 0); uTextureID_ib_td1_A = pIcons_LOD->LoadTexture("ib-td1-A", TEXTURE_16BIT_PALETTE); v6 = pIcons_LOD->GetTexture(uTextureID_ib_td1_A); @@ -257,7 +261,7 @@ } //----- (004979D2) -------------------------------------------------------- -MENU_STATE __cdecl CreditsMenu__Loop() +MENU_STATE MainMenuUI_Credits_Loop() { char *v0; // eax@5 char *v1; // edi@5 @@ -355,8 +359,6 @@ } else { - if (pAsyncMouse) - pAsyncMouse->_46B736_consume_click_lists(1); pRenderer->BeginScene(); pRenderer->DrawTextureRGB(0, 0, &pTexture); pRenderer->SetTextureClipRect(pX, pY, pX + v20, pY + a4);
--- a/UIOptions.cpp Thu May 23 11:16:46 2013 +0600 +++ b/UIOptions.cpp Thu May 23 11:17:01 2013 +0600 @@ -56,98 +56,43 @@ OptionsMenuSkin options_menu_skin; // 507C60 +bool GameMenuUI_InvaligKeyBindingsFlags[28]; // 506E6C +//----- (00414D24) -------------------------------------------------------- +static unsigned int GameMenuUI_GetKeyBindingColor(int key_index) +{ + if (uGameMenuUI_CurentlySelectedKeyIdx == key_index) + { + if (GetTickCount() % 1000 < 500) + return ui_gamemenu_keys_key_selection_blink_color_1; + else + return ui_gamemenu_keys_key_selection_blink_color_2; + } + else if (GameMenuUI_InvaligKeyBindingsFlags[key_index]) + { + int intensity; + int time = GetTickCount() % 800; + if (time < 400) + intensity = - 70 + 70 * time / 400; + else + intensity = + 70 - 70 * time / 800; + + return TargetColor(185 + intensity, 40 + intensity / 4, 40 + intensity / 4); + } + + return ui_gamemenu_keys_key_default_color; +} //----- (004142D3) -------------------------------------------------------- void GameMenuUI_DrawKeyBindings() - { - unsigned int v0; // ebp@1 - int v1; // ecx@2 - unsigned int v2; // eax@6 - GUIWindow *v3; // edx@6 +{ signed int v4; // ecx@7 signed int v5; // eax@8 - const char *v6; // ST0C_4@16 - unsigned int v7; // eax@16 - const char *v8; // ST0C_4@16 - unsigned int v9; // eax@16 - const char *v10; // ST0C_4@16 - unsigned int v11; // eax@16 - const char *v12; // ST0C_4@16 - unsigned int v13; // eax@16 - const char *v14; // ST0C_4@16 - unsigned int v15; // eax@16 - const char *v16; // ST0C_4@16 - unsigned int v17; // eax@16 - const char *v18; // ST0C_4@16 - unsigned int v19; // eax@16 - const char *v20; // ST0C_4@16 - unsigned int v21; // eax@16 - signed int v22; // ebp@16 - const char *v23; // ST0C_4@16 - unsigned int v24; // eax@16 - const char *v25; // ST0C_4@16 - unsigned int v26; // eax@16 - const char *v27; // ST0C_4@16 - unsigned int v28; // eax@16 - const char *v29; // ST0C_4@16 - unsigned int v30; // eax@16 - const char *v31; // ST0C_4@16 - unsigned int v32; // eax@16 - const char *v33; // ST0C_4@17 - unsigned int v34; // eax@17 - const char *v35; // ST0C_4@17 - unsigned int v36; // eax@17 - const char *v37; // ST0C_4@17 - unsigned int v38; // eax@17 - const char *v39; // ST0C_4@17 - unsigned int v40; // eax@17 - const char *v41; // ST0C_4@17 - unsigned int v42; // eax@17 - const char *v43; // ST0C_4@17 - unsigned int v44; // eax@17 - const char *v45; // ST0C_4@17 - unsigned int v46; // eax@17 - const char *v47; // ST0C_4@17 - unsigned int v48; // eax@17 - const char *v49; // ST0C_4@17 - unsigned int v50; // eax@17 - const char *v51; // ST0C_4@17 - unsigned int v52; // eax@17 - const char *v53; // ST0C_4@17 - unsigned int v54; // eax@17 - const char *v55; // ST0C_4@17 - unsigned int v56; // eax@17 - const char *v57; // ST0C_4@17 - unsigned int v58; // eax@17 - unsigned int v59; // eax@18 - //int v61; // [sp-14h] [bp-28h]@16 - const char *v62; // [sp-10h] [bp-24h]@16 - unsigned int a5; // [sp+10h] [bp-4h]@1 - - v0 = TargetColor(0xFFu, 0xFFu, 0xFFu); - a5 = v0; - if ( byte_4E28FC ) + + if ( pGUIWindow_CurrentMenu->receives_keyboard_input_2 == WINDOW_INPUT_CONFIRMED) { - v1 = dword_507C0C + 15; - dword_507C0C = v1; - if ( v1 == 255 ) - byte_4E28FC = 0; - } - else - { - v1 = dword_507C0C - 15; - dword_507C0C = v1; - if ( v1 == 15 ) - byte_4E28FC = 1; - } - v2 = TargetColor(v1, 0, 0); - v3 = pGUIWindow_CurrentMenu; - dword_507C08 = v2; - if ( pGUIWindow_CurrentMenu->field_40 == 2 ) - { - pPrevVirtualCidesMapping[dword_506E68] = pKeyActionMap->pPressedKeysBuffer[0]; - memset(&KeyButtonFlagChangesArray, 0, sizeof(KeyButtonFlagChangesArray)); + pPrevVirtualCidesMapping[uGameMenuUI_CurentlySelectedKeyIdx] = pKeyActionMap->pPressedKeysBuffer[0]; + memset(GameMenuUI_InvaligKeyBindingsFlags, 0, sizeof(GameMenuUI_InvaligKeyBindingsFlags)); v4 = 0; do { @@ -156,8 +101,8 @@ { if ( v4 != v5 && pPrevVirtualCidesMapping[v4] == pPrevVirtualCidesMapping[v5] ) { - KeyButtonFlagChangesArray[v4] = 1; - KeyButtonFlagChangesArray[v5] = 1; + GameMenuUI_InvaligKeyBindingsFlags[v4] = true; + GameMenuUI_InvaligKeyBindingsFlags[v5] = true; } ++v5; } @@ -165,168 +110,86 @@ ++v4; } while ( v4 < 28 ); - dword_506E68 = -1; - v3->field_40 = 0; + uGameMenuUI_CurentlySelectedKeyIdx = -1; + pGUIWindow_CurrentMenu->receives_keyboard_input_2 = WINDOW_INPUT_NONE; } pRenderer->DrawTextureIndexed(8, 8, pIcons_LOD->GetTexture(uTextureID_Optkb[0])); if ( KeyboardPageNum == 1 ) { pRenderer->DrawTextureIndexed(0x13, 0x12E, pIcons_LOD->GetTexture(uTextureID_Optkb[3])); - pGUIWindow_CurrentMenu->DrawText(pFontLucida, 23, 142, v0, "Ш", 0, 0, 0); - v6 = pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[0]); - v7 = sub_414D24(0); - pGUIWindow_CurrentMenu->DrawText(pFontLucida, 127, 142, v7, v6, 0, 0, 0); - pGUIWindow_CurrentMenu->DrawText(pFontLucida, 23, 163, v0, "", 0, 0, 0); - v8 = pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[1]); - v9 = sub_414D24(1); - pGUIWindow_CurrentMenu->DrawText(pFontLucida, 127, 163, v9, v8, 0, 0, 0); - pGUIWindow_CurrentMenu->DrawText(pFontLucida, 23, 184, v0, "", 0, 0, 0); - v10 = pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[2]); - v11 = sub_414D24(2); - pGUIWindow_CurrentMenu->DrawText(pFontLucida, 127, 184, v11, v10, 0, 0, 0); - pGUIWindow_CurrentMenu->DrawText(pFontLucida, 23, 205, v0, "", 0, 0, 0); - v12 = pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[3]); - v13 = sub_414D24(3); - pGUIWindow_CurrentMenu->DrawText(pFontLucida, 127, 205, v13, v12, 0, 0, 0); - pGUIWindow_CurrentMenu->DrawText(pFontLucida, 23, 226, v0, "", 0, 0, 0); - v14 = pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[4]); - v15 = sub_414D24(4); - pGUIWindow_CurrentMenu->DrawText(pFontLucida, 127, 226, v15, v14, 0, 0, 0); - pGUIWindow_CurrentMenu->DrawText(pFontLucida, 23, 247, v0, "", 0, 0, 0); - v16 = pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[5]); - v17 = sub_414D24(5); - pGUIWindow_CurrentMenu->DrawText(pFontLucida, 127, 247, v17, v16, 0, 0, 0); - pGUIWindow_CurrentMenu->DrawText(pFontLucida, 23, 268, v0, ".", 0, 0, 0); - v18 = pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[6]); - v19 = sub_414D24(6); - pGUIWindow_CurrentMenu->DrawText(pFontLucida, 127, 268, v19, v18, 0, 0, 0); - pGUIWindow_CurrentMenu->DrawText(pFontLucida, 247, 142, v0, ". .", 0, 0, 0); - v20 = pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[7]); - v21 = sub_414D24(7); - v22 = 350; - pGUIWindow_CurrentMenu->DrawText(pFontLucida, 350, 142, v21, v20, 0, 0, 0); - pGUIWindow_CurrentMenu->DrawText(pFontLucida, 247, 163, a5, "", 0, 0, 0); - v23 = pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[8]); - v24 = sub_414D24(8); - pGUIWindow_CurrentMenu->DrawText(pFontLucida, 350, 163, v24, v23, 0, 0, 0); - pGUIWindow_CurrentMenu->DrawText(pFontLucida, 247, 184, a5, ".", 0, 0, 0); - v25 = pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[9]); - v26 = sub_414D24(9); - pGUIWindow_CurrentMenu->DrawText(pFontLucida, 350, 184, v26, v25, 0, 0, 0); - pGUIWindow_CurrentMenu->DrawText(pFontLucida, 247, 205, a5, ".", 0, 0, 0); - v27 = pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[10]); - v28 = sub_414D24(10); - pGUIWindow_CurrentMenu->DrawText(pFontLucida, 350, 205, v28, v27, 0, 0, 0); - pGUIWindow_CurrentMenu->DrawText(pFontLucida, 247, 226, a5, "", 0, 0, 0); - v29 = pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[11]); - v30 = sub_414D24(11); - pGUIWindow_CurrentMenu->DrawText(pFontLucida, 350, 226, v30, v29, 0, 0, 0); - pGUIWindow_CurrentMenu->DrawText(pFontLucida, 247, 247, a5, ". ", 0, 0, 0); - v31 = pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[12]); - v32 = sub_414D24(12); - pGUIWindow_CurrentMenu->DrawText(pFontLucida, 350, 247, v32, v31, 0, 0, 0); - pGUIWindow_CurrentMenu->DrawText(pFontLucida, 247, 268, a5, "", 0, 0, 0); - v62 = pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[13]); - v59 = sub_414D24(13); - } + pGUIWindow_CurrentMenu->DrawText(pFontLucida, 23, 142, ui_gamemenu_keys_action_name_color, "Ш", 0, 0, 0); + pGUIWindow_CurrentMenu->DrawText(pFontLucida, 127, 142, GameMenuUI_GetKeyBindingColor(0), pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[0]), 0, 0, 0); + pGUIWindow_CurrentMenu->DrawText(pFontLucida, 23, 163, ui_gamemenu_keys_action_name_color, "", 0, 0, 0); + pGUIWindow_CurrentMenu->DrawText(pFontLucida, 127, 163, GameMenuUI_GetKeyBindingColor(1), pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[1]), 0, 0, 0); + pGUIWindow_CurrentMenu->DrawText(pFontLucida, 23, 184, ui_gamemenu_keys_action_name_color, "", 0, 0, 0); + pGUIWindow_CurrentMenu->DrawText(pFontLucida, 127, 184, GameMenuUI_GetKeyBindingColor(2), pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[2]), 0, 0, 0); + pGUIWindow_CurrentMenu->DrawText(pFontLucida, 23, 205, ui_gamemenu_keys_action_name_color, "", 0, 0, 0); + pGUIWindow_CurrentMenu->DrawText(pFontLucida, 127, 205, GameMenuUI_GetKeyBindingColor(3), pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[3]), 0, 0, 0); + pGUIWindow_CurrentMenu->DrawText(pFontLucida, 23, 226, ui_gamemenu_keys_action_name_color, "", 0, 0, 0); + pGUIWindow_CurrentMenu->DrawText(pFontLucida, 127, 226, GameMenuUI_GetKeyBindingColor(4), pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[4]), 0, 0, 0); + pGUIWindow_CurrentMenu->DrawText(pFontLucida, 23, 247, ui_gamemenu_keys_action_name_color, "", 0, 0, 0); + pGUIWindow_CurrentMenu->DrawText(pFontLucida, 127, 247, GameMenuUI_GetKeyBindingColor(5), pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[5]), 0, 0, 0); + pGUIWindow_CurrentMenu->DrawText(pFontLucida, 23, 268, ui_gamemenu_keys_action_name_color, ".", 0, 0, 0); + pGUIWindow_CurrentMenu->DrawText(pFontLucida, 127, 268, GameMenuUI_GetKeyBindingColor(6), pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[6]), 0, 0, 0); + pGUIWindow_CurrentMenu->DrawText(pFontLucida, 247, 142, ui_gamemenu_keys_action_name_color, ". .", 0, 0, 0); + pGUIWindow_CurrentMenu->DrawText(pFontLucida, 350, 142, GameMenuUI_GetKeyBindingColor(7), pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[7]), 0, 0, 0); + pGUIWindow_CurrentMenu->DrawText(pFontLucida, 247, 163, ui_gamemenu_keys_action_name_color, "", 0, 0, 0); + pGUIWindow_CurrentMenu->DrawText(pFontLucida, 350, 163, GameMenuUI_GetKeyBindingColor(8), pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[8]), 0, 0, 0); + pGUIWindow_CurrentMenu->DrawText(pFontLucida, 247, 184, ui_gamemenu_keys_action_name_color, ".", 0, 0, 0); + pGUIWindow_CurrentMenu->DrawText(pFontLucida, 350, 184, GameMenuUI_GetKeyBindingColor(9), pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[9]), 0, 0, 0); + pGUIWindow_CurrentMenu->DrawText(pFontLucida, 247, 205, ui_gamemenu_keys_action_name_color, ".", 0, 0, 0); + pGUIWindow_CurrentMenu->DrawText(pFontLucida, 350, 205, GameMenuUI_GetKeyBindingColor(10), pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[10]), 0, 0, 0); + pGUIWindow_CurrentMenu->DrawText(pFontLucida, 247, 226, ui_gamemenu_keys_action_name_color, "", 0, 0, 0); + pGUIWindow_CurrentMenu->DrawText(pFontLucida, 350, 226, GameMenuUI_GetKeyBindingColor(11), pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[11]), 0, 0, 0); + pGUIWindow_CurrentMenu->DrawText(pFontLucida, 247, 247, ui_gamemenu_keys_action_name_color, ". ", 0, 0, 0); + pGUIWindow_CurrentMenu->DrawText(pFontLucida, 350, 247, GameMenuUI_GetKeyBindingColor(12), pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[12]), 0, 0, 0); + pGUIWindow_CurrentMenu->DrawText(pFontLucida, 247, 268, ui_gamemenu_keys_action_name_color, "", 0, 0, 0); + pGUIWindow_CurrentMenu->DrawText(pFontLucida, 350, 268, GameMenuUI_GetKeyBindingColor(13), pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[13]), 0, 0, 0); + } else - { + { pRenderer->DrawTextureIndexed(0x7F, 0x12E, pIcons_LOD->GetTexture(uTextureID_Optkb[4])); - pGUIWindow_CurrentMenu->DrawText(pFontLucida, 23, 142, v0, ". ", 0, 0, 0); - v33 = pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[14]); - v34 = sub_414D24(14); - pGUIWindow_CurrentMenu->DrawText(pFontLucida, 127, 142, v34, v33, 0, 0, 0); - pGUIWindow_CurrentMenu->DrawText(pFontLucida, 23, 163, v0, "", 0, 0, 0); - v35 = pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[15]); - v36 = sub_414D24(15); - pGUIWindow_CurrentMenu->DrawText(pFontLucida, 127, 163, v36, v35, 0, 0, 0); - pGUIWindow_CurrentMenu->DrawText(pFontLucida, 23, 184, v0, ". ", 0, 0, 0); - v37 = pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[16]); - v38 = sub_414D24(16); - pGUIWindow_CurrentMenu->DrawText(pFontLucida, 127, 184, v38, v37, 0, 0, 0); - pGUIWindow_CurrentMenu->DrawText(pFontLucida, 23, 205, v0, "", 0, 0, 0); - v39 = pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[17]); - v40 = sub_414D24(17); - pGUIWindow_CurrentMenu->DrawText(pFontLucida, 127, 205, v40, v39, 0, 0, 0); - pGUIWindow_CurrentMenu->DrawText(pFontLucida, 23, 226, v0, "", 0, 0, 0); - v41 = pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[18]); - v42 = sub_414D24(18); - pGUIWindow_CurrentMenu->DrawText(pFontLucida, 127, 226, v42, v41, 0, 0, 0); - pGUIWindow_CurrentMenu->DrawText(pFontLucida, 23, 247, v0, "", 0, 0, 0); - v43 = pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[19]); - v44 = sub_414D24(19); - pGUIWindow_CurrentMenu->DrawText(pFontLucida, 127, 247, v44, v43, 0, 0, 0); - pGUIWindow_CurrentMenu->DrawText(pFontLucida, 23, 268, v0, ". ", 0, 0, 0); - v45 = pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[20]); - v46 = sub_414D24(20); - pGUIWindow_CurrentMenu->DrawText(pFontLucida, 127, 268, v46, v45, 0, 0, 0); - pGUIWindow_CurrentMenu->DrawText(pFontLucida, 247, 142, v0, ". ", 0, 0, 0); - v47 = pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[21]); - v48 = sub_414D24(21); - v22 = 350; - pGUIWindow_CurrentMenu->DrawText(pFontLucida, 350, 142, v48, v47, 0, 0, 0); - pGUIWindow_CurrentMenu->DrawText(pFontLucida, 247, 163, a5, ". Ш", 0, 0, 0); - v49 = pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[22]); - v50 = sub_414D24(22); - pGUIWindow_CurrentMenu->DrawText(pFontLucida, 350, 163, v50, v49, 0, 0, 0); - pGUIWindow_CurrentMenu->DrawText(pFontLucida, 247, 184, a5, "", 0, 0, 0); - v51 = pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[23]); - v52 = sub_414D24(23); - pGUIWindow_CurrentMenu->DrawText(pFontLucida, 350, 184, v52, v51, 0, 0, 0); - pGUIWindow_CurrentMenu->DrawText(pFontLucida, 247, 205, a5, "", 0, 0, 0); - v53 = pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[24]); - v54 = sub_414D24(24); - pGUIWindow_CurrentMenu->DrawText(pFontLucida, 350, 205, v54, v53, 0, 0, 0); - pGUIWindow_CurrentMenu->DrawText(pFontLucida, 247, 226, a5, ". ", 0, 0, 0); - v55 = pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[25]); - v56 = sub_414D24(25); - pGUIWindow_CurrentMenu->DrawText(pFontLucida, 350, 226, v56, v55, 0, 0, 0); - pGUIWindow_CurrentMenu->DrawText(pFontLucida, 247, 247, a5, ". ", 0, 0, 0); - v57 = pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[26]); - v58 = sub_414D24(26); - pGUIWindow_CurrentMenu->DrawText(pFontLucida, 350, 247, v58, v57, 0, 0, 0); - pGUIWindow_CurrentMenu->DrawText(pFontLucida, 247, 268, a5, "", 0, 0, 0); - v62 = pKeyActionMap->GetVKeyDisplayName(pWindowList_at_506F50_minus1_indexing[0]); - v59 = sub_414D24(27); - } - pGUIWindow_CurrentMenu->DrawText(pFontLucida, v22, 268, v59, v62, 0, 0, 0); + pGUIWindow_CurrentMenu->DrawText(pFontLucida, 23, 142, ui_gamemenu_keys_action_name_color, ". ", 0, 0, 0); + pGUIWindow_CurrentMenu->DrawText(pFontLucida, 127, 142, GameMenuUI_GetKeyBindingColor(14), pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[14]), 0, 0, 0); + pGUIWindow_CurrentMenu->DrawText(pFontLucida, 23, 163, ui_gamemenu_keys_action_name_color, "", 0, 0, 0); + pGUIWindow_CurrentMenu->DrawText(pFontLucida, 127, 163, GameMenuUI_GetKeyBindingColor(15), pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[15]), 0, 0, 0); + pGUIWindow_CurrentMenu->DrawText(pFontLucida, 23, 184, ui_gamemenu_keys_action_name_color, ". ", 0, 0, 0); + pGUIWindow_CurrentMenu->DrawText(pFontLucida, 127, 184, GameMenuUI_GetKeyBindingColor(16), pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[16]), 0, 0, 0); + pGUIWindow_CurrentMenu->DrawText(pFontLucida, 23, 205, ui_gamemenu_keys_action_name_color, "", 0, 0, 0); + pGUIWindow_CurrentMenu->DrawText(pFontLucida, 127, 205, GameMenuUI_GetKeyBindingColor(17), pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[17]), 0, 0, 0); + pGUIWindow_CurrentMenu->DrawText(pFontLucida, 23, 226, ui_gamemenu_keys_action_name_color, "", 0, 0, 0); + pGUIWindow_CurrentMenu->DrawText(pFontLucida, 127, 226, GameMenuUI_GetKeyBindingColor(18), pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[18]), 0, 0, 0); + pGUIWindow_CurrentMenu->DrawText(pFontLucida, 23, 247, ui_gamemenu_keys_action_name_color, "", 0, 0, 0); + pGUIWindow_CurrentMenu->DrawText(pFontLucida, 127, 247, GameMenuUI_GetKeyBindingColor(19), pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[19]), 0, 0, 0); + pGUIWindow_CurrentMenu->DrawText(pFontLucida, 23, 268, ui_gamemenu_keys_action_name_color, ". ", 0, 0, 0); + pGUIWindow_CurrentMenu->DrawText(pFontLucida, 127, 268, GameMenuUI_GetKeyBindingColor(20), pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[20]), 0, 0, 0); + pGUIWindow_CurrentMenu->DrawText(pFontLucida, 247, 142, ui_gamemenu_keys_action_name_color, ". ", 0, 0, 0); + pGUIWindow_CurrentMenu->DrawText(pFontLucida, 350, 142, GameMenuUI_GetKeyBindingColor(21), pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[21]), 0, 0, 0); + pGUIWindow_CurrentMenu->DrawText(pFontLucida, 247, 163, ui_gamemenu_keys_action_name_color, ". Ш", 0, 0, 0); + pGUIWindow_CurrentMenu->DrawText(pFontLucida, 350, 163, GameMenuUI_GetKeyBindingColor(22), pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[22]), 0, 0, 0); + pGUIWindow_CurrentMenu->DrawText(pFontLucida, 247, 184, ui_gamemenu_keys_action_name_color, "", 0, 0, 0); + pGUIWindow_CurrentMenu->DrawText(pFontLucida, 350, 184, GameMenuUI_GetKeyBindingColor(23), pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[23]), 0, 0, 0); + pGUIWindow_CurrentMenu->DrawText(pFontLucida, 247, 205, ui_gamemenu_keys_action_name_color, "", 0, 0, 0); + pGUIWindow_CurrentMenu->DrawText(pFontLucida, 350, 205, GameMenuUI_GetKeyBindingColor(24), pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[24]), 0, 0, 0); + pGUIWindow_CurrentMenu->DrawText(pFontLucida, 247, 226, ui_gamemenu_keys_action_name_color, ". ", 0, 0, 0); + pGUIWindow_CurrentMenu->DrawText(pFontLucida, 350, 226, GameMenuUI_GetKeyBindingColor(25), pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[25]), 0, 0, 0); + pGUIWindow_CurrentMenu->DrawText(pFontLucida, 247, 247, ui_gamemenu_keys_action_name_color, ". ", 0, 0, 0); + pGUIWindow_CurrentMenu->DrawText(pFontLucida, 350, 247, GameMenuUI_GetKeyBindingColor(26), pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[26]), 0, 0, 0); + pGUIWindow_CurrentMenu->DrawText(pFontLucida, 247, 268, ui_gamemenu_keys_action_name_color, "", 0, 0, 0); + pGUIWindow_CurrentMenu->DrawText(pFontLucida, 350, 268, GameMenuUI_GetKeyBindingColor(27), pKeyActionMap->GetVKeyDisplayName(pWindowList_at_506F50_minus1_indexing[0]), 0, 0, 0); } +} -//----- (00414D24) -------------------------------------------------------- -unsigned int __thiscall sub_414D24(int _this) - { - int v1; // esi@1 - unsigned int v2; // edi@1 - unsigned int v3; // ebx@1 - unsigned int result; // eax@1 - v1 = _this; - v2 = TargetColor(0xE1u, 0xCDu, 0x23u); - v3 = TargetColor(0xFu, 0, 0); - result = TargetColor(0xFFu, 0xFFu, 0xFFu); - if ( dword_506E68 == v1 ) - { - if ( GetTickCount() % 0x3E8 <= 0x1F4 ) - result = v3; - else - result = v2; - } - else - { - if ( KeyButtonFlagChangesArray[v1] ) - result = dword_507C08; - } - return result; - } //----- (00414D9A) -------------------------------------------------------- void GameMenuUI_DrawVideoOptions() { const char *v0; // ST0C_4@3 - unsigned __int16 v1; // ax@3 + //unsigned __int16 v1; // ax@3 //int v2; // eax@10 GUIWindow v3; // [sp+8h] [bp-54h]@3 @@ -345,8 +208,8 @@ v3.uFrameHeight = 79; v3.uFrameZ = 232; v3.uFrameW = 268; - v1 = TargetColor(0xFFu, 0xFFu, 0x9Bu); - v3.DrawTitleText(pFontSmallnum, 0, 0, v1, v0, 3u); + //v1 = TargetColor(0xFFu, 0xFFu, 0x9Bu); + v3.DrawTitleText(pFontSmallnum, 0, 0, ui_gamemenu_video_gamma_title_color, v0, 3u); } if (!pRenderer->pRenderD3D) @@ -369,7 +232,7 @@ //----- (00414F82) -------------------------------------------------------- -void DrawGameOptions() +void GameMenuUI_Options_Draw() { pRenderer->DrawTextureIndexed(8, 8, pIcons_LOD->GetTexture(uTextureID_Options)); pRenderer->DrawTextureIndexed(8, 132, pIcons_LOD->GetTexture(options_menu_skin.uTextureID_Background));
--- a/UIPartyCreation.cpp Thu May 23 11:16:46 2013 +0600 +++ b/UIPartyCreation.cpp Thu May 23 11:17:01 2013 +0600 @@ -257,16 +257,16 @@ pGUIWindow_CurrentMenu->DrawText(pFontCreate, pIntervalX + 73, 100, 0, pClassNames[player->classType], 0, 0, 0); pRenderer->DrawTextureTransparent(pIntervalX + 77, 50, pTexture_IC_KNIGHT[player->classType / 4]); - if ( pGUIWindow_CurrentMenu->field_40 && pGUIWindow_CurrentMenu->ptr_1C == (void *)i ) + if ( pGUIWindow_CurrentMenu->receives_keyboard_input_2 != WINDOW_INPUT_NONE && pGUIWindow_CurrentMenu->ptr_1C == (void *)i ) { - switch ( pGUIWindow_CurrentMenu->field_40 ) + switch ( pGUIWindow_CurrentMenu->receives_keyboard_input_2 ) { - case 1://press name panel + case WINDOW_INPUT_IN_PROGRESS://press name panel v17 = pGUIWindow_CurrentMenu->DrawTextInRect(pFontCreate, 159 * (int)pGUIWindow_CurrentMenu->ptr_1C + 18, 124, 0, (const char *)pKeyActionMap->pPressedKeysBuffer, 120, 1); pGUIWindow_CurrentMenu->DrawFlashingInputCursor(159 * (unsigned int)pGUIWindow_CurrentMenu->ptr_1C + v17 + 20, 124, pFontCreate); break; - case 2: // press enter - pGUIWindow_CurrentMenu->field_40 = 0; + case WINDOW_INPUT_CONFIRMED: // press enter + pGUIWindow_CurrentMenu->receives_keyboard_input_2 = WINDOW_INPUT_NONE; v120 = strlen((const char *)pKeyActionMap->pPressedKeysBuffer); v126 = 0; v133 = 0; @@ -286,8 +286,8 @@ pGUIWindow_CurrentMenu->DrawTextInRect(pFontCreate, pIntervalX, 124, 0, player->pName, 130, 0); *(short *)&player->field_1988[27] = 1; break; - case 3: // press escape - pGUIWindow_CurrentMenu->field_40 = 0; + case WINDOW_INPUT_CANCELLED: // press escape + pGUIWindow_CurrentMenu->receives_keyboard_input_2 = WINDOW_INPUT_NONE; pGUIWindow_CurrentMenu->DrawTextInRect(pFontCreate, pIntervalX, 124, 0, player->pName, 130, 0); SetCurrentMenuID(MENU_NAMEPANELESC); break; @@ -708,16 +708,13 @@ v26 = 0; pTexture_PCX.Release(); pTexture_PCX.Load("makeme.pcx", 0); - if (pAsyncMouse) - pAsyncMouse->Resume(); + v2 = 6; - pGUIWindow_CurrentMenu->field_40 = 0; + pGUIWindow_CurrentMenu->receives_keyboard_input_2 = WINDOW_INPUT_NONE; //LABEL_27: SetCurrentMenuID((MENU_STATE)v2); while ( GetCurrentMenuID() == MENU_CREATEPARTY ) { - if (pAsyncMouse) - pAsyncMouse->_46B736_consume_click_lists(1); uMouseX = pMouse->GetCursorPos(&v25)->x; uMouseY = pMouse->GetCursorPos(&v25)->y; pControlsHead = pGUIWindow_CurrentMenu->pControlsHead; @@ -911,7 +908,5 @@ } pAudioPlayer->StopChannels(-1, -1); - if (pAsyncMouse) - pAsyncMouse->Suspend(); return v26; } \ No newline at end of file
--- a/UIPopup.cpp Thu May 23 11:16:46 2013 +0600 +++ b/UIPopup.cpp Thu May 23 11:17:01 2013 +0600 @@ -2002,12 +2002,12 @@ { pAudioPlayer->StopChannels(-1, -1); v3 = 0; - sub_416B01(v3); + GameUI_DrawNPCPopup(v3); } } else { - pWindow.Hint = _4443D5_GetMinimapRightClickText(); + pWindow.Hint = (char *)GameUI_GetMinimapHintText(); pWindow.uFrameWidth = 256; pWindow.uFrameX = 130; pWindow.uFrameY = 140;
--- a/UIRest.cpp Thu May 23 11:16:46 2013 +0600 +++ b/UIRest.cpp Thu May 23 11:17:01 2013 +0600 @@ -47,18 +47,18 @@ //----- (0041F6C1) -------------------------------------------------------- -void __cdecl RestUI_Initialize() +void RestUI_Load() { Player *v0; // eax@10 if ( !dword_506F14 ) pAudioPlayer->StopChannels(-1, -1); - if ( pCurrentScreen ) - { + if ( pCurrentScreen != SCREEN_GAME) + { pGUIWindow_CurrentMenu->Release(); pCurrentScreen = SCREEN_GAME; - viewparams->bRedrawGameUI = 1; - } + viewparams->bRedrawGameUI = true; + } pEventTimer->Pause(); if ( dword_506F14 != 2 ) GUIWindow::Create(518, 450, 0, 0, WINDOW_PressedButton2, (int)pBtn_Rest, 0); @@ -87,11 +87,13 @@ --uRestUI_FoodRequiredToRest; if ( uRestUI_FoodRequiredToRest < 1 ) uRestUI_FoodRequiredToRest = 1; - if ( !_strcmpi(pCurrentMapName, "d29.blv") && (unsigned __int16)_449B57_test_bit(pParty->_quest_bits, 98) ) + if ( !_strcmpi(pCurrentMapName, "d29.blv") && _449B57_test_bit(pParty->_quest_bits, 98) ) uRestUI_FoodRequiredToRest = 0; + ++pIcons_LOD->uTexturePacksCount; if ( !pIcons_LOD->uNumPrevLoadedFiles ) pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles; + pCurrentScreen = SCREEN_REST; _507CD4_RestUI_hourglass_anim_controller = 0; uTextureID_RestUI_restmain = pIcons_LOD->LoadTexture("restmain", TEXTURE_16BIT_PALETTE); @@ -104,16 +106,16 @@ LoadActualSkyFrame(); pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640u, 480u, WINDOW_Rest, 0, 0); - pButton_RestUI_Exit = pGUIWindow_CurrentMenu->CreateButton(280, 297, 154, 37, 1, 0, UIMSG_ExitRest, 0, 0, "", pIcons_LOD->GetTexture(uTextureID_RestUI_restexit), 0); - pButton_RestUI_Main = pGUIWindow_CurrentMenu->CreateButton( 24, 154, 225, 37, 1, 0, UIMSG_Rest8Hour, 0, 0x52u, "", pIcons_LOD->GetTexture(uTextureID_RestUI_restb4), 0); - pButton_RestUI_WaitUntilDawn = pGUIWindow_CurrentMenu->CreateButton( 61, 232, 154, 33, 1, 0, UIMSG_AlreadyResting, 0, 0x44u, "", pIcons_LOD->GetTexture(uTextureID_RestUI_restb1), 0); - pButton_RestUI_Wait1Hour = pGUIWindow_CurrentMenu->CreateButton( 61, 264, 154, 33, 1, 0, UIMSG_Wait1Hour, 0, 0x48u, "", pIcons_LOD->GetTexture(uTextureID_RestUI_restb2), 0); - pButton_RestUI_Wait5Minutes = pGUIWindow_CurrentMenu->CreateButton( 61, 296, 154, 33, 1, 0, UIMSG_Wait5Minutes, 0, 0x4Du, "", pIcons_LOD->GetTexture(uTextureID_RestUI_restb3), 0); + pButton_RestUI_Exit = pGUIWindow_CurrentMenu->CreateButton(280, 297, 154, 37, 1, 0, UIMSG_ExitRest, 0, 0, "", pIcons_LOD->GetTexture(uTextureID_RestUI_restexit), 0); + pButton_RestUI_Main = pGUIWindow_CurrentMenu->CreateButton( 24, 154, 225, 37, 1, 0, UIMSG_Rest8Hour, 0, 'R', "", pIcons_LOD->GetTexture(uTextureID_RestUI_restb4), 0); + pButton_RestUI_WaitUntilDawn = pGUIWindow_CurrentMenu->CreateButton( 61, 232, 154, 33, 1, 0, UIMSG_AlreadyResting, 0, 'D', "", pIcons_LOD->GetTexture(uTextureID_RestUI_restb1), 0); + pButton_RestUI_Wait1Hour = pGUIWindow_CurrentMenu->CreateButton( 61, 264, 154, 33, 1, 0, UIMSG_Wait1Hour, 0, 'H', "", pIcons_LOD->GetTexture(uTextureID_RestUI_restb2), 0); + pButton_RestUI_Wait5Minutes = pGUIWindow_CurrentMenu->CreateButton( 61, 296, 154, 33, 1, 0, UIMSG_Wait5Minutes, 0, 'M', "", pIcons_LOD->GetTexture(uTextureID_RestUI_restb3), 0); } //----- (0041FA01) -------------------------------------------------------- -void __cdecl RestUI_Draw() - { +void RestUI_Draw() +{ int live_characters; // esi@1 unsigned int v3; // eax@15 //char v4; // al@17 @@ -217,8 +219,5 @@ Sleep6Hours(); } else - { - GUIWindow::Create(pButton_RestUI_Exit->uX, pButton_RestUI_Exit->uY, 0, 0, WINDOW_CloseRestWindowBtn, - (int)pButton_RestUI_Exit, (int)pGlobalTXT_LocalizationStrings[81]); - } + GUIWindow::Create(pButton_RestUI_Exit->uX, pButton_RestUI_Exit->uY, 0, 0, WINDOW_CloseRestWindowBtn, (int)pButton_RestUI_Exit, (int)pGlobalTXT_LocalizationStrings[81]); // "Exit Rest" } \ No newline at end of file
--- a/UISaveLoad.cpp Thu May 23 11:16:46 2013 +0600 +++ b/UISaveLoad.cpp Thu May 23 11:17:01 2013 +0600 @@ -48,7 +48,7 @@ //----- (004601B7) -------------------------------------------------------- -void GameUI_MainMenu_DoDrawLoad(int a1) +static void UI_DrawSaveLoad(bool save) { unsigned __int16 v1; // bx@1 unsigned int v2; // edi@4 @@ -87,18 +87,17 @@ unsigned int pSaveFiles; // [sp+70h] [bp-14h]@10 __int64 pAMPM2; // [sp+74h] [bp-10h]@10 int pYear; // [sp+7Ch] [bp-8h]@10 - int a4; // [sp+80h] [bp-4h]@1 + //int a4; // [sp+80h] [bp-4h]@1 int pFilesID; v1 = 255; - a4 = a1; TargetColor(0xFF, 0xFF, 0xFF); TargetColor(0xFF, 0xFF, 0x9B); pRenderer->BeginScene(); if ( GetCurrentMenuID() != MENU_SAVELOAD && GetCurrentMenuID() != MENU_LoadingProcInMainMenu ) { pRenderer->DrawTextureIndexed(8, 8, pIcons_LOD->GetTexture(uTextureID_loadsave)); - if ( a4 ) + if (save) { v2 = uTextureID_save_up; v3 = uTextureID_LS_saveU; @@ -181,23 +180,16 @@ pWindow.DrawTitleText(pFontSmallnum, 0, 0, 0, pTmpBuf, 3u); v1 = 255; } - if ( pGUIWindow_CurrentMenu->field_40 == 2 ) + if ( pGUIWindow_CurrentMenu->receives_keyboard_input_2 == WINDOW_INPUT_CONFIRMED) { - pGUIWindow_CurrentMenu->field_40 = 0; + pGUIWindow_CurrentMenu->receives_keyboard_input_2 = WINDOW_INPUT_NONE; strcpy((char *)&pSavegameHeader + 100 * uLoadGameUI_SelectedSlot, (const char *)pKeyActionMap->pPressedKeysBuffer); - /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) - { - pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_SaveGame; - pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; - *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; - ++pMessageQueue_50CBD0->uNumMessages; - }*/ pMessageQueue_50CBD0->AddMessage(UIMSG_SaveGame, 0, 0); } else { - if ( pGUIWindow_CurrentMenu->field_40 == 3 ) - pGUIWindow_CurrentMenu->field_40 = 0; + if ( pGUIWindow_CurrentMenu->receives_keyboard_input_2 == WINDOW_INPUT_CANCELLED) + pGUIWindow_CurrentMenu->receives_keyboard_input_2 = WINDOW_INPUT_NONE; } if (GetCurrentMenuID() == MENU_LoadingProcInMainMenu) { @@ -213,11 +205,11 @@ } else { - if ( a4 ) + if ( save ) pSaveFiles = 40; else pSaveFiles = uNumSavegameFiles; - a4 = 199; + int a4 = 199; pFilesID = pSaveListPosition; pSlotName = (const char *)(&pSavegameHeader[pSaveListPosition]);//draw name for save slot do @@ -226,7 +218,7 @@ break; short clr; HIDWORD(pAMPM2) = clr = (pFilesID == uLoadGameUI_SelectedSlot ? TargetColor(v1, v1, 0x64) : 0); - if ( pGUIWindow_CurrentMenu->field_40 != 1 || pFilesID != uLoadGameUI_SelectedSlot ) + if ( pGUIWindow_CurrentMenu->receives_keyboard_input_2 != WINDOW_INPUT_IN_PROGRESS || pFilesID != uLoadGameUI_SelectedSlot ) { pGUIWindow_CurrentMenu->DrawTextInRect(pFontSmallnum, 0x1B, a4, clr, pSlotName, 185, 0); } @@ -246,27 +238,20 @@ // 6A0C9C: using guessed type int dword_6A0C9C; //----- (004606F7) -------------------------------------------------------- -void __cdecl GameUI_MainMenu_DrawLoad() +void LoadUI_Draw() { - GameUI_MainMenu_DoDrawLoad(0); + UI_DrawSaveLoad(false); } //----- (004606FE) -------------------------------------------------------- -void __cdecl sub_4606FE() +void SaveUI_Draw() { - GameUI_MainMenu_DoDrawLoad(1); + UI_DrawSaveLoad(true); } -void __cdecl FreeSavegameThumbnails() - { - for (int i = 0; i < 40; ++i) - //pAllocator->FreeChunk(pSavegameThumbnails[i].pPixels); - pSavegameThumbnails[i].Release(); - } - //----- (0045E361) -------------------------------------------------------- -void __fastcall GameUI_DrawLoadMenu(unsigned int uDialogueType) +void LoadUI_Load(unsigned int uDialogueType) { unsigned int v1; // ebp@5 unsigned int v2; // eax@5 @@ -389,7 +374,7 @@ } //----- (0045E93E) -------------------------------------------------------- -void GameUI_DrawSaveMenu() +void SaveUI_Load() { unsigned int v0; // ebp@4 unsigned int v1; // eax@4
--- a/UITransition.cpp Thu May 23 11:16:46 2013 +0600 +++ b/UITransition.cpp Thu May 23 11:17:01 2013 +0600 @@ -0,0 +1,280 @@ +#include <assert.h> +#include <io.h> + +#include "Mouse.h" +#include "Keyboard.h" +#include "VideoPlayer.h" +#include "MapInfo.h" +#include "Game.h" +#include "GUIWindow.h" +#include "GUIFont.h" +#include "GUIProgressBar.h" +#include "Party.h" +#include "AudioPlayer.h" +#include "Outdoor.h" +#include "IndoorCamera.h" +#include "Overlays.h" +#include "Monsters.h" +#include "Arcomage.h" +#include "LOD.h" +#include "Actor.h" +#include "Allocator.h" +#include "Events.h" +#include "Viewport.h" +#include "FrameTableInc.h" +#include "Math.h" +#include "SpriteObject.h" +#include "ObjectList.h" +#include "Chest.h" +#include "PaletteManager.h" +#include "DecorationList.h" +#include "SaveLoad.h" +#include "stru123.h" +#include "Time.h" +#include "IconFrameTable.h" +#include "Awards.h" +#include "Autonotes.h" +#include "stru159.h" +#include "stru160.h" +#include "TurnEngine.h" +#include "CastSpellInfo.h" +#include "Weather.h" +#include "stru298.h" +#include "StorylineTextTable.h" +#include "Events2D.h" +#include "texts.h" +#include "UIHouses.h" + +#include "mm7_data.h" + + + + + +//----- (00444839) -------------------------------------------------------- +void TransitionUI_Load(uint anim_id, uint exit_pic_id, int x, int y, int z, int directiony, int directionx, int a8, const char *pLocationName) +{ + //unsigned int v9; // ebx@1 + //int v10; // edi@1 + //signed int v11; // eax@1 + unsigned int v12; // eax@6 + const char *v13; // ST0C_4@6 + unsigned int v14; // eax@8 + const char *v15; // eax@14 + unsigned int v16; // eax@16 + //unsigned int result; // eax@26 + const char *v18; // [sp-8h] [bp-40h]@9 + //const char *v19; // [sp-4h] [bp-3Ch]@2 + char *v20; // [sp-4h] [bp-3Ch]@9 + const char *v21; // [sp-4h] [bp-3Ch]@11 + char pContainer[40]; // [sp+Ch] [bp-2Ch]@1 + unsigned int v23; // [sp+34h] [bp-4h]@1 + + //v9 = a1; + //v10 = a2; + v23 = IndoorLocation::GetLocationIndex(pLocationName); + dword_59117C_teleportx = x; + dword_591178_teleporty = y; + dword_591174_teleportz = z; + dword_591170_teleport_directiony = directiony; + dword_59116C_teleport_directionx = directionx; + dword_591168_teleport_speedz = a8; + dword_591164_teleport_map_name = (char *)pLocationName; + uCurrentHouse_Animation = anim_id; + pEventTimer->Pause(); + pAudioPlayer->StopChannels(-1, -1); + + switch (pParty->alignment) + { + case PartyAlignment_Good: sprintfex(pContainer, "evt%02d-b", const_2()); break; + case PartyAlignment_Neutral: sprintfex(pContainer, "evt%02d", const_2()); break; + case PartyAlignment_Evil: sprintfex(pContainer, "evt%02d-c", const_2()); break; + default: assert(false); + } + + v12 = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); + v13 = pHouse_ExitPictures[exit_pic_id]; + pTexture_Dialogue_Background = &pIcons_LOD->pTextures[v12]; + pTexture_outside = pIcons_LOD->LoadTexturePtr(v13, TEXTURE_16BIT_PALETTE); + if (anim_id) + { + if ( !v23 ) + //pVideoPlayer->OpenHouseMovie(pAnimatedRooms[p2DEvents_minus1___02[26 * v9]].field_0, 1u); + pVideoPlayer->OpenHouseMovie(pAnimatedRooms[p2DEvents[anim_id - 1].uAnimationID].video_name, 1); + } + else if ( !v23 ) + { + v14 = pMapStats->GetMapInfo(pCurrentMapName); + if ( v14 ) + { + sprintfex(sHouseName, pGlobalTXT_LocalizationStrings[410], pMapStats->pInfos[v14].pName); // "Leave %s" + goto LABEL_20; + } + v21 = pGlobalTXT_LocalizationStrings[79]; + goto LABEL_19; + } + v15 = pLocationName; + if ( *pLocationName == 48 ) + v15 = pCurrentMapName; + v16 = pMapStats->GetMapInfo(v15); + if ( v16 ) + { + sprintfex(sHouseName, pGlobalTXT_LocalizationStrings[411], pMapStats->pInfos[v16].pName); + goto LABEL_20; + } + v21 = pGlobalTXT_LocalizationStrings[73]; +LABEL_19: + strcpy(sHouseName, v21); +LABEL_20: + pDialogueWindow = GUIWindow::Create(0, 0, 640, 480, WINDOW_Transition, 0, (int)sHouseName); + //if ( BYTE1(pAnimatedRooms[p2DEvents_minus1___02[26 * v9]].field_C) ) + if ( pAnimatedRooms[p2DEvents[anim_id - 1].uAnimationID].uRoomSoundId ) + PlayHouseSound(anim_id, HouseSound_Greeting); + if ( uCurrentlyLoadedLevelType == LEVEL_Indoor && uActiveCharacter && pParty->uFlags & 0x30 ) + pPlayers[uActiveCharacter]->PlaySound(SPEECH_47, 0); + if ( v23 ) + uCurrentHouse_Animation = v23; +} + + + + +//----- (00444C8F) -------------------------------------------------------- +void TravelUI_Load() +{ + //signed int v0; // eax@1 + unsigned int v1; // eax@6 + GUIWindow *result; // eax@9 + //const char *v3; // [sp-4h] [bp-2Ch]@2 + char pContainer[32]; // [sp+0h] [bp-28h]@1 + + pEventTimer->Pause(); + + switch (pParty->alignment) + { + case PartyAlignment_Good: sprintfex(pContainer, "evt%02d-b", const_2()); break; + case PartyAlignment_Neutral: sprintfex(pContainer, "evt%02d", const_2()); break; + case PartyAlignment_Evil: sprintfex(pContainer, "evt%02d-c", const_2()); break; + default: assert(false); + } + + pTexture_Dialogue_Background = pIcons_LOD->LoadTexturePtr(pContainer, TEXTURE_16BIT_PALETTE); + pTexture_outside = pIcons_LOD->LoadTexturePtr("outside", TEXTURE_16BIT_PALETTE); + v1 = pMapStats->GetMapInfo(pCurrentMapName); + if ( v1 ) + sprintfex(sHouseName, pGlobalTXT_LocalizationStrings[410], pMapStats->pInfos[v1].pName);// "Leave %s" + else + strcpy(sHouseName, pGlobalTXT_LocalizationStrings[79]);// "Exit" + pDialogueWindow = GUIWindow::Create(0, 0, 640, 480, WINDOW_ChangeLocation, 0, (int)sHouseName); +} + + + +//----- (00444DCA) -------------------------------------------------------- +void TravelUI_Draw() +{ + unsigned int v0; // edi@1 + MapInfo *v1; // edi@2 + signed int v3; // eax@2 + int v4; // eax@5 + const char *v5; // [sp-Ch] [bp-90h]@3 + signed int v6; // [sp-8h] [bp-8Ch]@3 + GUIWindow v7; // [sp+Ch] [bp-78h]@1 + char pDestinationMapName[32]; // [sp+60h] [bp-24h]@1 + unsigned int v9; // [sp+80h] [bp-4h]@1 + + memcpy(&v7, pPrimaryWindow, sizeof(v7)); + v9 = pMapStats->GetMapInfo(pCurrentMapName); + pOutdoor->GetTravelDestination(pParty->vPosition.x, pParty->vPosition.y, pDestinationMapName, 20); + v0 = pMapStats->GetMapInfo(pDestinationMapName); + pRenderer->DrawTextureIndexed(0x1DDu, 0, pTexture_Dialogue_Background); + pRenderer->DrawTextureTransparent(0x1D4u, 0, &pIcons_LOD->pTextures[uTextureID_right_panel_loop]); + pRenderer->DrawTextureIndexed(pNPCPortraits_x[0][0], pNPCPortraits_y[0][0], pTexture_outside); + pRenderer->DrawTextureIndexed(0x22Cu, 0x1C3u, pIcons_LOD->GetTexture(uTextureID_x_x_u)); + pRenderer->DrawTextureIndexed(0x1DCu, 0x1C3u, pIcons_LOD->GetTexture(uTextureID_x_ok_u)); + if ( v0 ) + { + v1 = &pMapStats->pInfos[v0]; + v7.uFrameX = 493; + v7.uFrameWidth = 126; + v7.uFrameZ = 366; + v7.DrawTitleText(pFontCreate, 0, 4u, 0, v1->pName, 3); + v7.uFrameX = 483; + v7.uFrameWidth = 148; + v7.uFrameZ = 334; + v3 = GetTravelTime(); + if ( v3 == 1 ) + { + v6 = 1; + v5 = pGlobalTXT_LocalizationStrings[663]; // "It will take %d day to cross to %s." + } + else + { + v6 = v3; + v5 = pGlobalTXT_LocalizationStrings[128]; // "It will take %d days to travel to %s." + } + sprintfex(pTmpBuf, v5, v6, v1->pName); + strcat(pTmpBuf, "\n \n"); + sprintfex(pTmpBuf2, pGlobalTXT_LocalizationStrings[126], pMapStats->pInfos[v9].pName); + strcat(pTmpBuf, pTmpBuf2); + v4 = pFontCreate->CalcTextHeight(pTmpBuf, &v7, 0, 0); + v7.DrawTitleText(pFontCreate, 0, (212 - v4) / 2 + 101, 0, pTmpBuf, 3); + _unused_5B5924_is_travel_ui_drawn = 1; + } +} + + + +//----- (00444A51) -------------------------------------------------------- +void TransitionUI_Draw() +{ + MapInfo *pMapInfo; // esi@5 + char *v1; // eax@6 + std::string v3; // [sp-18h] [bp-84h]@11 + unsigned int v4; // [sp-10h] [bp-7Ch]@12 + int v5; // [sp-Ch] [bp-78h]@12 + const char *v6; // [sp-8h] [bp-74h]@11 + signed int v7; // [sp-4h] [bp-70h]@11 + GUIWindow v8; // [sp+Ch] [bp-60h]@1 + unsigned int v9; // [sp+60h] [bp-Ch]@1 + unsigned int v10; // [sp+64h] [bp-8h]@1 + int a3; // [sp+6Bh] [bp-1h]@11 + + memcpy(&v8, pPrimaryWindow, sizeof(v8)); + v10 = pMapStats->GetMapInfo(pCurrentMapName); + v9 = IndoorLocation::GetLocationIndex(dword_591164_teleport_map_name); + pRenderer->DrawTextureIndexed(0x1DDu, 0, pTexture_Dialogue_Background); + pRenderer->DrawTextureIndexed(pNPCPortraits_x[0][0] - 4, pNPCPortraits_y[0][0] - 4, pIcons_LOD->GetTexture(uTextureID_50795C)); + pRenderer->DrawTextureIndexed(pNPCPortraits_x[0][0], pNPCPortraits_y[0][0], pTexture_outside); + uTextureID_right_panel_loop = uTextureID_right_panel; + pRenderer->DrawTextureTransparent(468, 0, pIcons_LOD->GetTexture(uTextureID_right_panel)); + pRenderer->DrawTextureIndexed(556, 451, pIcons_LOD->GetTexture(uTextureID_x_x_u)); + pRenderer->DrawTextureIndexed(476, 451, pIcons_LOD->GetTexture(uTextureID_x_ok_u)); + if ( (pVideoPlayer->AnyMovieLoaded() || v9) && *dword_591164_teleport_map_name != ' ' ) + v10 = pMapStats->GetMapInfo(dword_591164_teleport_map_name); + pMapInfo = &pMapStats->pInfos[v10]; + v8.uFrameX = 493; + v8.uFrameWidth = 126; + v8.uFrameZ = 366; + v8.DrawTitleText(pFontCreate, 0, 5u, 0, pMapInfo->pName, 3); + v8.uFrameX = 483; + v8.uFrameWidth = 148; + v8.uFrameZ = 334; + + v1 = ""; + if ( uCurrentHouse_Animation ) + { + v1 = pTransitionStrings[uCurrentHouse_Animation]; + v4 = (212 - pFontCreate->CalcTextHeight(v1, &v8, 0, 0)) / 2 + 101; + v8.DrawTitleText(pFontCreate, 0, v4, 0, v1, 3); + } + else if ( v10 ) + { + sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[409], pMapInfo->pName);// "Do you wish to leave %s?" + v4 = (212 - pFontCreate->CalcTextHeight(pTmpBuf, &v8, 0, 0)) / 2 + 101; + v8.DrawTitleText(pFontCreate, 0, v4, 0, pTmpBuf, 3); + } + else assert(false); + + _unused_5B5924_is_travel_ui_drawn = true; +}
--- a/UiGame.cpp Thu May 23 11:16:46 2013 +0600 +++ b/UiGame.cpp Thu May 23 11:17:01 2013 +0600 @@ -67,6 +67,893 @@ int uTextureID_GameUI_CharSelectionFrame; // 50C98C + + + +//----- (00421D00) -------------------------------------------------------- +void __fastcall GameUI_OnPlayerPortraitLeftClick(unsigned int uPlayerID) +{ + //unsigned int v1; // esi@1 + //int v2; // eax@2 + //Player *v3; // ecx@2 + //Player *v4; // ecx@5 + unsigned int v5; // [sp-4h] [bp-10h]@21 + + //v1 = uPlayerID; + auto player = &pParty->pPlayers[uPlayerID - 1]; + if (pParty->pPickedItem.uItemID) + { + //v3 = player; + if (auto slot = player->AddItem(-1, pParty->pPickedItem.uItemID)) + { + memcpy(&player->pInventoryItems[slot-1], &pParty->pPickedItem, 0x24u); + viewparams->bRedrawGameUI = true; + pMouse->RemoveHoldingItem(); + return; + } + + if (!player->CanAct()) + { + player = pPlayers[uActiveCharacter]; + } + if(player->CanAct() || !pPlayers[uActiveCharacter]->CanAct()) + player->PlaySound(SPEECH_NoRoom, 0); + } + +//LABEL_9: + if (pCurrentScreen == SCREEN_GAME) + { + viewparams->bRedrawGameUI = true; + if ( uActiveCharacter != uPlayerID ) + //goto LABEL_27; + { + if ( pPlayers[uPlayerID]->uTimeToRecovery ) + return; + + uActiveCharacter = uPlayerID; + return; + } + v5 = 7; +//LABEL_22: + pGUIWindow_CurrentMenu = CharacterUI_Initialize(v5); + return; + } + if ( pCurrentScreen == SCREEN_SPELL_BOOK ) + return; + if ( pCurrentScreen == SCREEN_CHEST ) + { +//LABEL_23: + viewparams->bRedrawGameUI = true; + if ( uActiveCharacter == uPlayerID ) + { + pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 103; + pCurrentScreen = SCREEN_CHEST_INVENTORY; + //goto LABEL_28; + uActiveCharacter = uPlayerID; + return; + } +//LABEL_27: + if ( pPlayers[uPlayerID]->uTimeToRecovery ) + return; + //goto LABEL_28; + uActiveCharacter = uPlayerID; + return; + } + if ( pCurrentScreen != SCREEN_HOUSE ) + { + if ( pCurrentScreen == SCREEN_E ) + { +//LABEL_28: + uActiveCharacter = uPlayerID; + return; + } + if ( pCurrentScreen != SCREEN_CHEST_INVENTORY ) + { + viewparams->bRedrawGameUI = true; + uActiveCharacter = uPlayerID; + if ( pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] == 102 ) + FillAwardsData(); + return; + } + //goto LABEL_23; + viewparams->bRedrawGameUI = true; + if ( uActiveCharacter == uPlayerID ) + { + pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 103; + pCurrentScreen = SCREEN_CHEST_INVENTORY; + //goto LABEL_28; + uActiveCharacter = uPlayerID; + return; + } +//LABEL_27: + if ( pPlayers[uPlayerID]->uTimeToRecovery ) + return; + //goto LABEL_28; + uActiveCharacter = uPlayerID; + return; + } + if ( window_SpeakInHouse->receives_keyboard_input_2 == WINDOW_INPUT_IN_PROGRESS) + return; + viewparams->bRedrawGameUI = true; + if ( uActiveCharacter != uPlayerID ) + //goto LABEL_28; + uActiveCharacter = uPlayerID; + return; + if (dialog_menu_id == HOUSE_DIALOGUE_SHOP_BUY_STANDARD || dialog_menu_id == HOUSE_DIALOGUE_SHOP_6) + { + __debugbreak(); // fix indexing + pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 103; + v5 = 14; + //goto LABEL_22; + pGUIWindow_CurrentMenu = CharacterUI_Initialize(v5); + return; + } +} +// 4E28F8: using guessed type int pCurrentScreen; +// F8B19C: using guessed type int dword_F8B19C; + +//----- (00416B01) -------------------------------------------------------- +void GameUI_DrawNPCPopup(void *_this)//PopupWindowForBenefitAndJoinText +{ + int v1; // edi@2 + int v2; // ecx@2 + NPCData *v3; // eax@2 + NPCData *v4; // esi@7 + NPCData *v5; // eax@16 + NPCData *v6; // esi@16 + const CHAR *v7; // eax@18 + unsigned int v8; // eax@25 + unsigned int v9; // eax@25 + const char *v10; // ST14_4@26 + char *v11; // esi@26 + const char *v12; // ST18_4@27 + unsigned __int16 v13; // ax@28 + char *v14; // eax@28 + GUIWindow a1; // [sp+Ch] [bp-60h]@23 + int a2; // [sp+60h] [bp-Ch]@16 + void *v17; // [sp+64h] [bp-8h]@1 + LPCSTR lpsz; // [sp+68h] [bp-4h]@6 + + v17 = _this; + if ( bNoNPCHiring != 1 ) + { + v1 = 0; + v2 = 0; + v3 = pParty->pHirelings; + /*do + { + if ( v3->pName ) + pTmpBuf[v1++] = v2; + ++v3; + ++v2; + } + while ( (signed int)v3 < (signed int)&pParty->pPickedItem );*/ + for (int i = 0; i < 2; ++i) + { + if (pParty->pHirelings[i].pName) + pTmpBuf[v1++] = i; + } + lpsz = 0; + if ( (signed int)pNPCStats->uNumNewNPCs > 0 ) + { + /*v4 = pNPCStats->pNewNPCData; + do + { + if ( v4->uFlags & 0x80 + && (!pParty->pHirelings[0].pName || strcmp(v4->pName, pParty->pHirelings[0].pName)) + && (!pParty->pHirelings[1].pName || strcmp(v4->pName, pParty->pHirelings[1].pName)) ) + pTmpBuf[v1++] = (char)lpsz + 2; + ++lpsz; + ++v4; + } + while ( (signed int)lpsz < (signed int)pNPCStats->uNumNewNPCs );*/ + for (int i = 0; i < pNPCStats->uNumNewNPCs; ++i) + { + if (pNPCStats->pNewNPCData[i].Hired()) + { + if (!pParty->pHirelings[0].pName || strcmp((char *)pNPCStats->pNewNPCData[i].pName, (char *)pParty->pHirelings[0].pName)) + { + if (!pParty->pHirelings[1].pName || strcmp((char *)pNPCStats->pNewNPCData[i].pName, (char *)pParty->pHirelings[1].pName)) + pTmpBuf[v1++] = i + 2; + } + } + } + } + if ( (signed int)((char *)v17 + (unsigned __int8)pParty->field_709) < v1 ) + { + sDialogue_SpeakingActorNPC_ID = -1 - (unsigned __int8)pParty->field_709 - (int)v17; + v5 = GetNewNPCData(sDialogue_SpeakingActorNPC_ID, (int)&a2); + v6 = v5; + if ( v5 ) + { + if ( a2 == 57 ) + v7 = pNPCTopics[512].pText; // Baby dragon + else + v7 = (const CHAR *)pNPCStats->pProfessions[v5->uProfession].pBenefits; + lpsz = v7; + if ( !v7 ) + { + lpsz = (LPCSTR)pNPCStats->pProfessions[v5->uProfession].pJoinText; + if ( !lpsz ) + lpsz = ""; + } + a1.Hint = 0; + a1.uFrameX = 38; + a1.uFrameY = 60; + a1.uFrameWidth = 276; + a1.uFrameZ = 313; + a1.uFrameHeight = pFontArrus->CalcTextHeight(lpsz, &a1, 0, 0) + + 2 * LOBYTE(pFontArrus->uFontHeight) + + 24; + if ( (signed int)a1.uFrameHeight < 130 ) + a1.uFrameHeight = 130; + a1.uFrameWidth = 400; + a1.uFrameZ = a1.uFrameX + 399; + a1.DrawMessageBox(0); + sprintfex(pTmpBuf2, "NPC%03d", v6->uPortraitID); + v8 = pIcons_LOD->LoadTexture(pTmpBuf2, TEXTURE_16BIT_PALETTE); + pRenderer->DrawTextureIndexed( + a1.uFrameX + 22, + a1.uFrameY + 36, + (Texture *)(v8 != -1 ? &pIcons_LOD->pTextures[v8] : 0)); + v9 = v6->uProfession; + if ( v9 ) + { + v10 = v6->pName; + v11 = pTmpBuf; + sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[429], v10, aNPCProfessionNames[v9]); + } + else + { + v12 = v6->pName; + v11 = pTmpBuf; + strcpy(pTmpBuf, v12); + } + v13 = TargetColor(0xFFu, 0xFFu, 0x9Bu); + a1.DrawTitleText(pFontArrus, 0, 0xCu, v13, v11, 3u); + a1.uFrameWidth -= 24; + a1.uFrameZ = a1.uFrameX + a1.uFrameWidth - 1; + v14 = BuilDialogueString((char *)lpsz, uActiveCharacter - 1, 0, 0, 0, 0); + a1.DrawText(pFontArrus, 100, 36, 0, v14, 0, 0, 0); + } + } + } +} + + + +//----- (00445D4A) -------------------------------------------------------- +void GameUI_InitializeDialogue(Actor *actor, int bPlayerSaysHello) +{ + NPCData *pNPCInfo; // ebp@1 + int v9; // esi@8 + int pNumberContacts; // eax@11 + char pContainer[32]; // [sp+14h] [bp-28h]@3 + + dword_A74CDC = -1; + dword_AE336C = -1; + pEventTimer->Pause(); + pMiscTimer->Pause(); + pAudioPlayer->StopChannels(-1, -1); + uDialogueType = 0; + sDialogue_SpeakingActorNPC_ID = actor->sNPC_ID; + pDialogue_SpeakingActor = actor; + pNPCInfo = GetNPCData(actor->sNPC_ID); + if ( (pNPCInfo->uFlags & 3) != 2 ) + pNPCInfo->uFlags = pNPCInfo->uFlags + 1; + + switch (pParty->alignment) + { + case PartyAlignment_Good: sprintfex(pContainer, "evt%02d-b", const_2()); break; + case PartyAlignment_Neutral: sprintfex(pContainer, "evt%02d", const_2()); break; + case PartyAlignment_Evil: sprintfex(pContainer, "evt%02d-c", const_2()); break; + } + + pDialogueNPCCount = 0; + uNumDialogueNPCPortraits = 1; + pTexture_Dialogue_Background = pIcons_LOD->LoadTexturePtr(pContainer, TEXTURE_16BIT_PALETTE); + sprintfex(pContainer, "npc%03u", pNPCInfo->uPortraitID); + v9 = 0; + pDialogueNPCPortraits[0] = pIcons_LOD->LoadTexturePtr(pContainer, TEXTURE_16BIT_PALETTE); + dword_591084 = areWeLoadingTexture; + uTextureID_right_panel_loop = uTextureID_right_panel; + if ( !pNPCInfo->Hired() && pNPCInfo->Location2D >= 0 ) + { + if ( (signed int)pParty->GetPartyFame() <= pNPCInfo->fame + || (pNumberContacts = pNPCInfo->uFlags & 0xFFFFFF7F, (pNumberContacts & 0x80000000u) != 0) ) + { + v9 = 1; + } + else + { + if ( pNumberContacts > 1 ) + { + if ( pNumberContacts == 2 ) + { + v9 = 3; + } + else + { + if ( pNumberContacts != 3 ) + { + if ( pNumberContacts != 4 ) + v9 = 1; + } + else + { + v9 = 2; + } + } + } + else if ( pNPCInfo->rep ) + { + v9 = 2; + } + } + } + if (sDialogue_SpeakingActorNPC_ID < 0) + v9 = 4; + pDialogueWindow = GUIWindow::Create(0, 0, 640, 480, WINDOW_Dialogue, v9, 0);//pNumberContacts = 1, v9 = 0; pNumberContacts = 2, v9 = 3; + if (pNPCInfo->Hired()) + { + if ( !pNPCInfo->bHasUsedTheAbility ) + { + if ( pNPCInfo->uProfession >= 10 ) + { + if ( pNPCInfo->uProfession <= 12 || pNPCInfo->uProfession > 32 && (pNPCInfo->uProfession <= 34 + || pNPCInfo->uProfession > 38 && (pNPCInfo->uProfession <= 43 || pNPCInfo->uProfession == 52)) ) + { + pDialogueWindow->CreateButton(480, 250, 140, LOBYTE(pFontArrus->uFontHeight) - 3, 1, 0, UIMSG_SelectNPCDialogueOption, 9, 0, "", 0); + pDialogueWindow->_41D08F_set_keyboard_control_group(4, 1, 0, 1); + } + } + } + } + + pDialogueWindow->CreateButton( 61, 424, 31, 40, 2, 94, UIMSG_SelectCharacter, 1, '1', "", 0); + pDialogueWindow->CreateButton(177, 424, 31, 40, 2, 94, UIMSG_SelectCharacter, 2, '2', "", 0); + pDialogueWindow->CreateButton(292, 424, 31, 40, 2, 94, UIMSG_SelectCharacter, 3, '3', "", 0); + pDialogueWindow->CreateButton(407, 424, 31, 40, 2, 94, UIMSG_SelectCharacter, 4, '4', "", 0); + + if (bPlayerSaysHello && uActiveCharacter && !pNPCInfo->Hired()) + { + if (pParty->uCurrentHour < 5 || pParty->uCurrentHour > 21) + pPlayers[uActiveCharacter]->PlaySound(SPEECH_GoodEvening, 0); + else + pPlayers[uActiveCharacter]->PlaySound(SPEECH_GoodDay, 0); + } +} + +//----- (00445350) -------------------------------------------------------- +void GameUI_DrawDialogue() +{ + NPCData *pNPC; // ebx@2 + int pGreetType; // eax@2 + unsigned __int16 v2; // di@2 + //unsigned int v3; // eax@2 + char *v4; // esi@3 + //int v5; // eax@11 + //char *v6; // ecx@13 + //char *v7; // eax@16 + //unsigned int v8; // edi@19 + //char *v9; // ecx@27 + char *v10; // eax@29 + //int v11; // eax@30 + int v12; // esi@39 + char *v13; // eax@41 + GUIButton *v14; // eax@43 + //GUIButton *v15; // edi@43 + signed int v16; // eax@44 + //unsigned int v23; // eax@53 + //const char *v24; // eax@59 + //unsigned __int16 v30; // cx@83 + int v31; // ecx@86 + int v32; // ebx@93 + unsigned int v33; // eax@93 + GUIWindow *v34; // ecx@93 + int v35; // esi@93 + int i; // eax@93 + GUIButton *v37; // eax@94 + int v38; // eax@95 + signed int v39; // esi@99 + signed int v40; // eax@102 + unsigned int v41; // ebx@102 + int v42; // edi@102 + GUIButton *v43; // esi@103 + int v44; // eax@104 + unsigned int v45; // ecx@104 + unsigned __int16 *v46; // edx@104 + unsigned __int16 v47; // ax@104 + GUIWindow pWindow; // [sp+4h] [bp-110h]@39 + int v49; // [sp+Ch] [bp-108h]@39 + int v50; // [sp+14h] [bp-100h]@39 + GUIWindow v51; // [sp+58h] [bp-BCh]@2 + GUIWindow v52; // [sp+ACh] [bp-68h]@42 + char *Str; // [sp+100h] [bp-14h]@104 + //int v54; // [sp+104h] [bp-10h]@2 + //unsigned __int16 *v55; // [sp+108h] [bp-Ch]@82 + GUIFont *pOutString; // [sp+10Ch] [bp-8h]@39 + char *pInString=NULL; // [sp+110h] [bp-4h]@32 + + if ( !pDialogueWindow ) + return; + + memcpy(&v51, pDialogueWindow, sizeof(v51)); + pNPC = GetNPCData(sDialogue_SpeakingActorNPC_ID); + pGreetType = GetGreetType(sDialogue_SpeakingActorNPC_ID); + v51.uFrameWidth -= 10; + v51.uFrameZ -= 10; + //v54 = v1; + TargetColor(0xFFu, 0xFFu, 0xFFu); + TargetColor(0xE1u, 0xCDu, 0x23u); + v2 = TargetColor(0x15u, 0x99u, 0xE9u); + pRenderer->DrawTextureIndexed(477, 0, pTexture_Dialogue_Background); + pRenderer->DrawTextureTransparent(468, 0, (Texture *)(uTextureID_right_panel_loop != -1 ? &pIcons_LOD->pTextures[uTextureID_right_panel_loop] : 0)); + pRenderer->DrawTextureIndexed(pNPCPortraits_x[0][0] - 4, pNPCPortraits_y[0][0] - 4, (Texture *)(uTextureID_50795C != -1 ? &pIcons_LOD->pTextures[uTextureID_50795C] : 0)); + pRenderer->DrawTextureIndexed(pNPCPortraits_x[0][0], pNPCPortraits_y[0][0], pDialogueNPCPortraits[0]); + + if (pNPC->uProfession) + { + assert(pNPC->uProfession < sizeof(aNPCProfessionNames) / sizeof(*aNPCProfessionNames)); // sometimes buffer overflows; errors emerge both here and in dialogue text + sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[429], pNPC->pName, aNPCProfessionNames[pNPC->uProfession]);//^Pi[%s] %s + } + else + strcpy(pTmpBuf, pNPC->pName); + + v51.DrawTitleText(pFontArrus, 483, 112, v2, pTmpBuf, 3); + pParty->GetPartyFame(); + + pInString = nullptr; + switch (uDialogueType) + { + case DIALOGUE_13: + pInString = BuilDialogueString(pNPCStats->pProfessions[pNPC->uProfession - 1].pJoinText, uActiveCharacter - 1, 0, 0, 0, 0); + break; + + case DIALOGUE_PROFESSION_DETAILS: + { + auto prof = pNPCStats->pProfessions + pNPC->uProfession - 1; + + if (dialogue_show_profession_details) + pInString = BuilDialogueString(prof->pBenefits, uActiveCharacter - 1, 0, 0, 0, 0); + else if (pNPC->Hired()) + pInString = BuilDialogueString(prof->pDismissText, uActiveCharacter - 1, 0, 0, 0, 0); + else + pInString = BuilDialogueString(prof->pJoinText, uActiveCharacter - 1, 0, 0, 0, 0); + } + break; + + + case DIALOGUE_ARENA_WELCOME: + pInString = pGlobalTXT_LocalizationStrings[574]; // "Welcome to the Arena of Life and Death. Remember, you are only allowed one arena combat per visit. To fight an arena battle, select the option that best describes your abilities and return to me- if you survive:" + break; + + case DIALOGUE_ARENA_FIGHT_NOT_OVER_YET: + pInString = pGlobalTXT_LocalizationStrings[577]; //"Get back in there you wimps:" + break; + + case DIALOGUE_ARENA_REWARD: + sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[576], gold_transaction_amount);// "Congratulations on your win: here's your stuff: %u gold." + pInString = pTmpBuf; + break; + + case DIALOGUE_ARENA_ALREADY_WON: + pInString = pGlobalTXT_LocalizationStrings[582]; // "You already won this trip to the Arena:" + break; + + default: + if (uDialogueType > DIALOGUE_18 && uDialogueType < DIALOGUE_23 && !byte_5B0938[0]) + { + pInString = (char *)current_npc_text; + } + else if (pGreetType == 1)//QuestNPC_greet + { + if (pNPC->greet) + { + if ((pNPC->uFlags & 3) == 2) + pInString = pNPCStats->pNPCGreetings[pNPC->greet - 1].pGreeting2; + else + pInString = pNPCStats->pNPCGreetings[pNPC->greet - 1].pGreeting1; + } + } + else if (pGreetType == 2)//HiredNPC_greet + { + auto prof = pNPCStats->pProfessions + pNPC->uProfession - 1; + + if (pNPC->Hired()) + pInString = BuilDialogueString(prof->pDismissText, uActiveCharacter - 1, 0, 0, 0, 0); + else + pInString = BuilDialogueString(prof->pJoinText, uActiveCharacter - 1, 0, 0, 0, 0); + } + break; + } + + if (pInString) + { + pWindow.uFrameWidth = game_viewport_width; + pWindow.uFrameZ = 452; + auto font = pFontArrus; + v12 = pFontArrus->CalcTextHeight(pInString, &pWindow, 13, 0) + 7; + if ( 352 - v12 < 8 ) + { + font = pFontCreate; + v12 = pFontCreate->CalcTextHeight(pInString, &pWindow, 13, 0) + 7; + } + if (uTextureID_Leather != -1) + pRenderer->_4A6A68(8, 352 - v12, &pIcons_LOD->pTextures[uTextureID_Leather], pIcons_LOD->pTextures[uTextureID_Leather].uTextureHeight - v12); + pRenderer->DrawTextureIndexed(8u, 347 - v12, pTexture_591428); + v13 = FitTextInAWindow(pInString, font, &pWindow, 0xDu, 0); + pDialogueWindow->DrawText(font, 13, 354 - v12, 0, v13, 0, 0, 0); + } + + + memcpy(&v52, pDialogueWindow, sizeof(v52)); + v52.uFrameX = 483; + v52.uFrameWidth = 148; + v52.uFrameZ = 334; + for (int i = v52.pStartingPosActiveItem; + i < v52.pStartingPosActiveItem + v52.pNumPresenceButton; ++i) + { + v14 = v52.GetControl(i); + //v15 = v14; + if ( !v14 ) + break; + v16 = v14->msg_param; + + if ( v16 > 88 ) + v14->pButtonName[0] = 0; + else if (v16 == 88) + strcpy(v14->pButtonName, pGlobalTXT_LocalizationStrings[581]); // Lord + else if (v16 == 87) + strcpy(v14->pButtonName, pGlobalTXT_LocalizationStrings[580]); // Knight + else if (v16 == 86) + strcpy(v14->pButtonName, pGlobalTXT_LocalizationStrings[579]); // Squire + else if (v16 == 85) + strcpy(v14->pButtonName, pGlobalTXT_LocalizationStrings[578]); // Page + else if (v16 == 77) + strcpy(v14->pButtonName, pGlobalTXT_LocalizationStrings[407]); // Details + else if (v16 == 76) + { + if (pNPC->Hired()) + sprintf(v14->pButtonName, (const char*)pGlobalTXT_LocalizationStrings[408], pNPC->pName); // Release %s + else + strcpy(v14->pButtonName, pGlobalTXT_LocalizationStrings[406]); // Hire + } + else if (v16 == 24) + { + __debugbreak(); // learn conditions of this event + auto topic = pNPCTopics[pNPC->evt_F - 1].pTopic;//(&dword_721660)[8 * v23]; + if (!topic) + { + v14->pButtonName[0] = 0; + v14->msg_param = 0; + } + else + strcpy(v14->pButtonName, topic); + } + else if (v16 == 9) + strcpy(v14->pButtonName, GetProfessionActionText(pNPC->uProfession)); + else if (v16 == 19) + { + // __debugbreak(); // learn conditions of this event Scavenger Hunt + auto topic = pNPCTopics[pNPC->evt_A - 1].pTopic;//(&dword_721660)[8 * v23]; + if (!topic) + { + v14->pButtonName[0] = 0; + v14->msg_param = 0; + } + else strcpy(v14->pButtonName, topic); + } + else if (v16 == 20) + { + //__debugbreak(); // learn conditions of this event instruments + auto topic = pNPCTopics[pNPC->evt_B - 1].pTopic;//(&dword_721660)[8 * v23]; + if (!topic) + { + v14->pButtonName[0] = 0; + v14->msg_param = 0; + } + else strcpy(v14->pButtonName, topic); + } + else if (v16 == 21) + { + //__debugbreak(); // learn conditions of this event + auto topic = pNPCTopics[pNPC->evt_C - 1].pTopic;//(&dword_721660)[8 * v23]; + if (!topic) + { + v14->pButtonName[0] = 0; + v14->msg_param = 0; + } + else strcpy(v14->pButtonName, topic); + } + else if (v16 == 22) + { + //__debugbreak(); // learn conditions of this event + auto topic = pNPCTopics[pNPC->evt_D - 1].pTopic;//(&dword_721660)[8 * v23]; + if (!topic) + { + v14->pButtonName[0] = 0; + v14->msg_param = 0; + } + else strcpy(v14->pButtonName, topic); + } + else if (v16 == 23) + { + //__debugbreak(); // learn conditions of this event + auto topic = pNPCTopics[pNPC->evt_E - 1].pTopic;//(&dword_721660)[8 * v23]; + if (!topic) + { + v14->pButtonName[0] = 0; + v14->msg_param = 0; + } + else strcpy(v14->pButtonName, topic); + } + else if (v16 == 13) + { + if (pNPC->Hired()) + sprintf(v14->pButtonName, pGlobalTXT_LocalizationStrings[408], pNPC->pName); // Release %s + else + strcpy(v14->pButtonName, pGlobalTXT_LocalizationStrings[122]); // Join + } + else + v14->pButtonName[0] = 0; + + + if (pParty->field_7B5_in_arena_quest && pParty->field_7B5_in_arena_quest != -1) + { + int num_dead_actors = 0; + pInString = 0; + for (uint i = 0; i < uNumActors; ++i) + { + if (pActors[i].uAIState == Dead || pActors[i].uAIState == Removed || + pActors[i].uAIState == Disabled) + ++num_dead_actors; + else + { + int sumonner_type = PID_TYPE(pActors[i].uSummonerID); + if (sumonner_type == OBJECT_Player) + ++num_dead_actors; + } + } + if (num_dead_actors == uNumActors) + strcpy(v14->pButtonName, pGlobalTXT_LocalizationStrings[658]); // Collect Prize + } + } + + + v32 = 0; + //pInString = (char *)TargetColor(0xFFu, 0xFFu, 0xFFu); + v33 = TargetColor(0xE1u, 0xCDu, 0x23u); + v34 = pDialogueWindow; + //v54 = v33; + v35 = pDialogueWindow->pStartingPosActiveItem; + for ( i = v35 + pDialogueWindow->pNumPresenceButton; v35 < i; i = pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem ) + { + v37 = v34->GetControl(v35); + if ( !v37 ) + { + v34 = pDialogueWindow; + break; + } + v38 = pFontArrus->CalcTextHeight(v37->pButtonName, &v52, 0, 0); + v34 = pDialogueWindow; + v32 += v38; + ++v35; + } + v39 = v34->pNumPresenceButton; + if ( v39 ) + { + pOutString = (GUIFont *)((174 - v32) / v39); + if ( (174 - v32) / v39 > 32 ) + pOutString = (GUIFont *)32; + int v55 = 1; + v40 = 174 - (int)pOutString * v39 - v32; + v41 = v34->pStartingPosActiveItem; + v42 = v40 / 2 - (signed int)pOutString / 2 + 138; + if ( (signed int)v41 < (signed int)(v41 + v39) ) + { + do + { + v43 = v34->GetControl(v41); + if ( !v43 ) + break; + v43->uY = (unsigned int)((char *)pOutString + v42); + Str = v43->pButtonName; + v44 = pFontArrus->CalcTextHeight(v43->pButtonName, &v52, 0, 0); + v45 = v43->uY; + v46 = (unsigned short *)v55; + v43->uHeight = v44; + v42 = v45 + v44 - 1; + v43->uW = v42; + v47 = v33; + if ( (unsigned __int16 *)pDialogueWindow->pCurrentPosActiveItem != v46 ) + v47 = TargetColor(0xFFu, 0xFFu, 0xFFu); + v52.DrawTitleText(pFontArrus, 0, v45, v47, Str, 3u); + v34 = pDialogueWindow; + ++v55; + ++v41; + } + while ( (signed int)v41 < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem ); + } + } + pRenderer->DrawTextureIndexed(471, 445, pIcons_LOD->GetTexture(uExitCancelTextureId)); +} + + + +//----- (00444FBE) -------------------------------------------------------- +void GameUI_DrawBranchlessDialogue() +{ + //GUIFont *v0; // esi@1 + int v1; // esi@4 + char *v2; // eax@6 + int v3; // edi@12 + char Str[200]; // [sp+Ch] [bp-120h]@12 + GUIWindow v5; // [sp+D4h] [bp-58h]@4 + GUIFont *pFont; // [sp+128h] [bp-4h]@1 + + pFont = pFontArrus; + if ( current_npc_text && !byte_5B0938[0] ) + strcpy(byte_5B0938, current_npc_text); + v5.uFrameWidth = game_viewport_width; + v5.uFrameZ = 452; + v1 = pFontArrus->CalcTextHeight(byte_5B0938, &v5, 12, 0) + 7; + if ( 352 - v1 < 8 ) + { + pFont = pFontCreate; + v1 = pFontCreate->CalcTextHeight(byte_5B0938, &v5, 12, 0) + 7; + } + pRenderer->_4A6A68(8, 352 - v1, + pIcons_LOD->GetTexture(uTextureID_Leather), + pIcons_LOD->GetTexture(uTextureID_Leather)->uTextureHeight - v1); + pRenderer->DrawTextureIndexed(8, 347 - v1, pTexture_591428); + v2 = FitTextInAWindow(byte_5B0938, pFont, &v5, 0xCu, 0); + pGUIWindow2->DrawText(pFont, 12, 354 - v1, 0, v2, 0, 0, 0); + pRenderer->DrawTextureRGB(0, 0x160u, pTexture_StatusBar); + if ( pGUIWindow2->receives_keyboard_input_2 != WINDOW_INPUT_IN_PROGRESS) + { + if ( pGUIWindow2->receives_keyboard_input_2 == WINDOW_INPUT_CONFIRMED) + { + pGUIWindow2->receives_keyboard_input_2 = WINDOW_INPUT_NONE; + strcpy(GameUI_Footer_TimedString, (const char *)pKeyActionMap->pPressedKeysBuffer); +LABEL_16: + sub_4452BB(); + return; + } + if ( pGUIWindow2->receives_keyboard_input_2 != WINDOW_INPUT_CANCELLED) + return; + pGUIWindow2->receives_keyboard_input_2 = WINDOW_INPUT_NONE; +LABEL_15: + memset(GameUI_Footer_TimedString, 0, 0xC8u); + goto LABEL_16; + } + if ( pGUIWindow2->ptr_1C == (void *)26 ) + { + sprintf(Str, "%s %s", GameUI_Footer_TimedString, pKeyActionMap->pPressedKeysBuffer); + v3 = pFontLucida->GetLineWidth(Str); + pGUIWindow2->DrawText(pFontLucida, 13, 357, 0, Str, 0, 0, 0); + pGUIWindow2->DrawFlashingInputCursor(v3 + 13, 357, pFontLucida); + return; + } + if ( pKeyActionMap->pPressedKeysBuffer[0] ) + { + pKeyActionMap->SetWindowInputStatus(0); + goto LABEL_15; + } +} + + +//----- (004443D5) -------------------------------------------------------- +const char *GameUI_GetMinimapHintText() +{ + int v0; // ST20_4@1 + unsigned int v1; // esi@1 + signed int v2; // ebx@1 + double v3; // st7@1 + int v4; // esi@3 + int v5; // edi@4 + int v6; // eax@4 + int v7; // eax@4 + BSPModel *v8; // ecx@4 + unsigned __int8 v9; // zf@5 + char v10; // sf@5 + unsigned __int8 v11; // of@5 + ODMFace *v12; // eax@6 + __int16 v13; // cx@6 + const char *v14; // eax@8 + const char *v15; // edi@8 + char *result; // eax@12 + unsigned int v17; // eax@14 + unsigned int v18; // [sp+Ch] [bp-20h]@1 + int v19; // [sp+10h] [bp-1Ch]@1 + int v20; // [sp+14h] [bp-18h]@1 + char *v21; // [sp+18h] [bp-14h]@1 + unsigned int pY; // [sp+1Ch] [bp-10h]@1 + int v23; // [sp+20h] [bp-Ch]@1 + int v24; // [sp+24h] [bp-8h]@1 + int pX; // [sp+28h] [bp-4h]@1 + + v24 = pParty->vPosition.x; + v0 = pParty->vPosition.y; + v1 = pOutdoor->uNumBModels; + *(float *)&v23 = (double)(signed int)viewparams->uMinimapZoom * 0.000015258789; + v2 = 0; + v18 = pOutdoor->uNumBModels; + v21 = 0; + pMouse->GetClickPos((unsigned int *)&pX, &pY); + v3 = 1.0 / *(float *)&v23; + v23 = pX - 557; + v19 = (signed __int64)((double)(pX - 557) * v3 + (double)v24); + v20 = (signed __int64)((double)v0 - (double)(signed int)(pY - 74) * v3); + if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor || (*(float *)&v23 = 0.0, (signed int)v1 <= 0) ) + { +LABEL_14: + v17 = pMapStats->GetMapInfo(pCurrentMapName); + if ( v17 == v2 ) + result = "No Maze Info for this maze on file!"; + else + result = pMapStats->pInfos[v17].pName; + } + else + { + v4 = 0; + while ( 1 ) + { + pX = pOutdoor->pBModels[v4].vBoundingCenter.x - v19; + pY = pOutdoor->pBModels[v4].vBoundingCenter.y - v20; + v5 = abs((signed)pY); + v6 = abs((signed)pX); + v7 = int_get_vector_length(v6, v5, v2); + v8 = &pOutdoor->pBModels[0]; + if ( v7 < 2 * pOutdoor->pBModels[v4].sBoundingRadius ) + { + v11 = __OFSUB__(pOutdoor->pBModels[v4].uNumFaces, v2); + v9 = pOutdoor->pBModels[v4].uNumFaces == v2; + v10 = ((pOutdoor->pBModels[v4].uNumFaces - v2) & 0x80000000u) != 0; + v24 = v2; + if ( !((unsigned __int8)(v10 ^ v11) | v9) ) + { + do + { + v12 = &v8[v4].pFaces[v2 / 0x134u]; + v13 = v12->sCogTriggeredID; + if ( v13 ) + { + if ( !(BYTE2(v12->uAttributes) & 0x10) ) + { + v14 = GetEventHintString(v13); + v15 = v14; + if ( v14 ) + { + if ( _strcmpi(v14, "") ) + v21 = (char *)v15; + } + } + } + ++v24; + v8 = pOutdoor->pBModels; + v2 += 308; + } + while ( v24 < (signed int)pOutdoor->pBModels[v4].uNumFaces ); + } + result = v21; + v2 = 0; + if ( v21 ) + break; + } + ++v23; + ++v4; + if ( v23 >= (signed int)v18 ) + goto LABEL_14; + } + } + return result; +} + + + + + //----- (0041D3B7) -------------------------------------------------------- void GameUI_CharacterQuickRecord_Draw(GUIWindow *window, Player *player) {
--- a/VideoPlayer.cpp Thu May 23 11:16:46 2013 +0600 +++ b/VideoPlayer.cpp Thu May 23 11:17:01 2013 +0600 @@ -453,14 +453,14 @@ if ( a2.dwRBitMask == 0xF800 ) { if ( a2.dwGBitMask == 0x7E0 && a2.dwBBitMask == 0x1F ) - return 0xC0000000u; + return SMACKBUFFER565; } else { if ( a2.dwRBitMask == 0x7C00 && a2.dwGBitMask == 0x3E0 && a2.dwBBitMask == 0x1F ) - return 0x80000000u; + return SMACKBUFFER555; } MessageBoxA(0, "Unsupported pixel format.", "Smacker Error", 0); } @@ -816,12 +816,7 @@ Unload(); } } -// 4D83D8: using guessed type int __stdcall SmackBlitSetPalette(int, int, int); -// 4D83DC: using guessed type int __stdcall SmackBlitClear(int, int, int, int, int, int, int, int); -// 4D83E0: using guessed type int __stdcall SmackToBufferRect(int, int); -// 4D83E4: using guessed type int __stdcall SmackDoFrame(int); -// 4D83E8: using guessed type int __stdcall SmackNextFrame(int); -// 4D8404: using guessed type int __stdcall SmackBlit(int, int, int, int, int, int, int, int, int, int, int); + //----- (004BF08B) -------------------------------------------------------- void VideoPlayer::SmackUpdatePalette(HWND hWnd) @@ -1068,23 +1063,18 @@ return; } SmackToBuffer(pVideoPlayer->pSmackerMovie, 0, 0, pVideoPlayer->pSmackerMovie->Width, pVideoPlayer->pSmackerMovie->Height, v9, 0); + + v10 = SmackCheckSurfaceFromat(); if ( a4 ) { - if ( (unsigned int)uCPUSpeed < 165 ) - { - Log::Warning(L"Smacker seems to use lower resolution because it thinks CPU is slow"); - v10 = SmackCheckSurfaceFromat() | 2; - } + v10 |= SMACKBLIT2X; + + if (uCPUSpeed >= 165 ) + v10 |= SMACKBLIT2XSMOOTHING; else - { - v10 = SmackCheckSurfaceFromat(); - LOBYTE(v10) = v10 | 6; - } + Log::Warning(L"Smacker seems to use lower resolution because it thinks CPU is slow"); } - else - { - v10 = SmackCheckSurfaceFromat(); - } + v11 = SmackBlitOpen(v10); pVideoPlayer->pSmackMovieBlit = v11; if ( !v11 )
--- a/Vis.cpp Thu May 23 11:16:46 2013 +0600 +++ b/Vis.cpp Thu May 23 11:17:01 2013 +0600 @@ -6,7 +6,9 @@ #include "Game.h" #include "Actor.h" #include "IndoorCamera.h" +#include "OutdoorCamera.h" #include "Viewport.h" +#include "Math.h" #include "Log.h" #include "mm7_data.h" @@ -367,6 +369,8 @@ auto bmodel = &pOutdoor->pBModels[i]; for (uint j = 0; j < bmodel->uNumFaces; ++j) { + //if ( i == 77 && j == 17 )// + //__debugbreak();// auto face = &bmodel->pFaces[j]; if (is_part_of_selection(face, filter)) { @@ -545,63 +549,144 @@ //----- (004C1C0C) -------------------------------------------------------- bool Vis::Intersect_Ray_Face(RenderVertexSoft *pRayStart, RenderVertexSoft *pRayEnd, float *pDepth, RenderVertexSoft *Intersection, BLVFace *pFace, unsigned int pBModelID) { - float c1; // st5@6 - float c2; // st7@11 - Vec3_short_ IntersectPoint; // ST04_6@11 + //BLVFace *v7; // ebx@1 + //bool result; // eax@1 + double v9; // st7@3 + //__int16 v10; // fps@3 + //char v11; // c0@3 + //char v12; // c2@3 + //char v13; // c3@3 + //__int16 v14; // fps@5 + //char v15; // c0@5 + //char v16; // c2@5 + //char v17; // c3@5 + double c1; // st5@6 + //__int16 v19; // fps@6 + //char v20; // c0@6 + //char v21; // c2@6 + //char v22; // c3@6 + //unsigned __int8 v23; // c0@6 + //char v24; // c2@6 + //unsigned __int8 v25; // c3@6 + //char v26; // zf@6 + double v27; // st6@10 + //__int16 v28; // fps@10 + //unsigned __int8 v29; // c0@10 + //char v30; // c2@10 + //unsigned __int8 v31; // c3@10 + double c2; // st7@11 + //Vec2_short_ v33; // ST1E_4@11 + Vec3_short_ v34; // ST04_6@11 + //float a5a; // [sp+30h] [bp+18h]@10 + //float a5b; // [sp+30h] [bp+18h]@13 if (pFace->Portal() || pFace->Invisible()) return false; - int ray_dir_x = pRayEnd->vWorldPosition.x - pRayStart->vWorldPosition.x,//calculate the direction vector of the line( ) - ray_dir_y = pRayEnd->vWorldPosition.y - pRayStart->vWorldPosition.y, + int ray_dir_x = pRayEnd->vWorldPosition.x - pRayStart->vWorldPosition.x,//dir_x y z + ray_dir_y = pRayEnd->vWorldPosition.y - pRayStart->vWorldPosition.y,// - = ray_dir_z = pRayEnd->vWorldPosition.z - pRayStart->vWorldPosition.z; + /*v9 = ray_dir_z * pFace->pFacePlane.vNormal.z + + ray_dir_y * pFace->pFacePlane.vNormal.y// + + ray_dir_x * pFace->pFacePlane.vNormal.x;//= + if (v9 >= 0) // ray faces face's normal ( > 0) or parallel ( == 0) + return false;*/ + +//ray = t dir + start +//plane = (p - vertex) normal = -d +// +// +//(t dir + start - vertex) normal = -d +// +// -d - (start - vertex) norm +//t = -------------------- +// dir norm + + + /*float dir_mag = sqrtf(ray_dir_x * ray_dir_x + ray_dir_y * ray_dir_y + ray_dir_z * ray_dir_z);// + float ndir_x = ray_dir_x / dir_mag,//ndir - + ndir_y = ray_dir_y / dir_mag,// , , ( ). + ndir_z = ray_dir_z / dir_mag;// , + + int face_center_x = (pFace->pBounding.x1 + pFace->pBounding.x2) / 2,// + face_center_y = (pFace->pBounding.y1 + pFace->pBounding.y2) / 2, + face_center_z = (pFace->pBounding.z1 + pFace->pBounding.z2) / 2; + + int to_plane_x = pRayStart->vWorldPosition.x - face_center_x,// + to_plane_y = pRayStart->vWorldPosition.y - face_center_y, + to_plane_z = pRayStart->vWorldPosition.z - face_center_z;*/ + + //float t = /*-pFace->pFacePlane.dist*/ - (to_plane_x * pFace->pFacePlane.vNormal.x + to_plane_y * pFace->pFacePlane.vNormal.y + to_plane_y * pFace->pFacePlane.vNormal.z) / + // (ndir_x * pFace->pFacePlane.vNormal.x + ndir_y * pFace->pFacePlane.vNormal.y + ndir_z * pFace->pFacePlane.vNormal.z);// +/* if (t <= *pDepth) + { + int intersection_x = pRayStart->vWorldPosition.x + ndir_x * t, + intersection_y = pRayStart->vWorldPosition.y + ndir_y * t, + intersection_z = pRayStart->vWorldPosition.z + ndir_z * t; + + if (intersection_x < pFace->pBounding.x1 || intersection_x > pFace->pBounding.x2 || + intersection_y < pFace->pBounding.y1 || intersection_y > pFace->pBounding.y2 || + intersection_z < pFace->pBounding.z1 || intersection_z > pFace->pBounding.z2) + return false; + + pFace->uAttributes |= 0x80000000; + return true; + } + + return false;*/ + + //c1 = -d-(n*p0) c1 = -pFace->pFacePlane.dist -(pFace->pFacePlane.vNormal.x * pRayStart->vWorldPosition.x + pFace->pFacePlane.vNormal.y * pRayStart->vWorldPosition.y + pFace->pFacePlane.vNormal.z * pRayStart->vWorldPosition.z); - if (c1 > 0) - return false; - #define EPSILON 1e-6 - + //if (c1 > 0) + //return false; +#define EPSILON 0.000001 //c2 = n*u - c2 = pFace->pFacePlane.vNormal.x * ray_dir_y// get length of the line( ) + c2 = pFace->pFacePlane.vNormal.x * ray_dir_y + pFace->pFacePlane.vNormal.y * ray_dir_x + pFace->pFacePlane.vNormal.z * ray_dir_z; if (c2 > -EPSILON && c2 < EPSILON) // ray faces face's normal ( > 0) or parallel ( == 0) return false; //t = -d-(n*p0)/n*u - float t = c1 / c2;//How far is crossing the line in percent for 0 to 1( 0 1 ) + double t = c1 / c2;// + + //if (t < 0 || t > 1) + //return false; - if (t < 0 || t > 1) + // p(t) = p0 + tu; + // p(t) - + // p0 - , , + // t - + // u - + Intersection->vWorldPosition.x = pRayStart->vWorldPosition.x + t * ray_dir_y;//12432 < X < 12656 + Intersection->vWorldPosition.y = pRayStart->vWorldPosition.y + t * ray_dir_x;//-96 < Y < 1088 + Intersection->vWorldPosition.z = pRayStart->vWorldPosition.z + t * ray_dir_z;//Z == 192 + + v34.x = (signed __int64)Intersection->vWorldPosition.x; + v34.y = (signed __int64)Intersection->vWorldPosition.y; + v34.z = (signed __int64)Intersection->vWorldPosition.z; + + if ( !_4C1D2B(pFace, v34, pBModelID) ) return false; -// p(t) = p0 + tu; - Intersection->vWorldPosition.x = pRayStart->vWorldPosition.x + t * ray_dir_y;// add the interest to the start line( ) - Intersection->vWorldPosition.y = pRayStart->vWorldPosition.y + t * ray_dir_x; - Intersection->vWorldPosition.z = pRayStart->vWorldPosition.z + t * ray_dir_z; - - IntersectPoint.x = (signed __int64)Intersection->vWorldPosition.x; - IntersectPoint.y = (signed __int64)Intersection->vWorldPosition.y; - IntersectPoint.z = (signed __int64)Intersection->vWorldPosition.z; - - if ( !IntersectBModel_sub(pFace, IntersectPoint, pBModelID) ) - return false; - - *pDepth = t;//Record the distance from the origin of the ray ( ) + //a5b = v27; + //*pDepth = t; return true; } //----- (004C1D2B) -------------------------------------------------------- -bool Vis::IntersectBModel_sub(BLVFace *pFace, Vec3_short_ IntersectPoint, unsigned int uModelID) +bool Vis::_4C1D2B(BLVFace *pFace, Vec3_short_ a2, unsigned int uModelID) { //BLVFace *v4; // esi@1 int v5; // esi@10 bool v6; // edi@10 - //int v7; // ecx@12 - //signed int v8; // edx@12 - //signed int v9; // eax@13 + int v7; // ecx@12 + signed int v8; // edx@12 + signed int v9; // eax@13 signed int v10; // ebx@14 int v11; // edi@16 signed int v12; // ST28_4@18 @@ -610,55 +695,67 @@ int v15; // [sp+10h] [bp-Ch]@10 signed int v16; // [sp+18h] [bp-4h]@10 - if (IntersectPoint.x < pFace->pBounding.x1 || IntersectPoint.x > pFace->pBounding.x2 || - IntersectPoint.y < pFace->pBounding.y1 || IntersectPoint.y > pFace->pBounding.y2 || - IntersectPoint.z < pFace->pBounding.z1 || IntersectPoint.z > pFace->pBounding.z2 ) + //v4 = pFace; + if (a2.x < pFace->pBounding.x1 || a2.x > pFace->pBounding.x2 || + a2.y < pFace->pBounding.y1 || a2.y > pFace->pBounding.y2 || + a2.z < pFace->pBounding.z1 || a2.z > pFace->pBounding.z2 ) return false; pFace->uAttributes |= 0x80000000; return true; if (uModelID != -1) - _4C2186_BLV_IntersectBModel(pFace, uModelID, word_F8BC48_displaced_face_intersect_plane_coords_a, - word_F8BD18_displaced_face_intersect_plane_coords_b, &IntersectPoint, pFace, uModelID); + _4C2186_BLV_IntersectBModel(pFace, uModelID, + word_F8BC48_displaced_face_intersect_plane_coords_a, + word_F8BD18_displaced_face_intersect_plane_coords_b, + &a2, pFace, uModelID); else - _4C1EE5_BLV_IntersectBModel_2((int *)&pFace, (int *)&uModelID, word_F8BC48_displaced_face_intersect_plane_coords_a, - word_F8BD18_displaced_face_intersect_plane_coords_b, &IntersectPoint, pFace); + _4C1EE5_BLV_IntersectBModel_2((int *)&pFace, (int *)&uModelID, + word_F8BC48_displaced_face_intersect_plane_coords_a, + word_F8BD18_displaced_face_intersect_plane_coords_b, + &a2, pFace); v5 = 2 * pFace->uNumVertices; v16 = 0; word_F8BC48_displaced_face_intersect_plane_coords_a[v5] = word_F8BC48_displaced_face_intersect_plane_coords_a[0]; word_F8BD18_displaced_face_intersect_plane_coords_b[v5] = word_F8BD18_displaced_face_intersect_plane_coords_b[0]; + v15 = 0; v6 = word_F8BD18_displaced_face_intersect_plane_coords_b[0] >= (signed int)uModelID; if (v5 <= 0) return false; - for ( v15 = 0; v15 < v5; ++v15 ) + do { if ( v16 >= 2 ) break; - if ( v6 ^ word_F8BD18_displaced_face_intersect_plane_coords_b[v15 + 1] >= (signed int)uModelID ) + v7 = 2 * v15; + v8 = word_F8BD18_displaced_face_intersect_plane_coords_b[ + v15 + 1]; + if ( v6 ^ v8 >= (signed int)uModelID ) { - if ( word_F8BC48_displaced_face_intersect_plane_coords_a[v15 + 1] >= (signed int)pFace ) + v9 = word_F8BC48_displaced_face_intersect_plane_coords_a[v7/2 + 1]; + if ( v9 >= (signed int)pFace ) v10 = 0; else v10 = 2; - v11 = v10 | word_F8BC48_displaced_face_intersect_plane_coords_a[v15] < (signed int)pFace; + v11 = v10 | word_F8BC48_displaced_face_intersect_plane_coords_a[v7/2] < (signed int)pFace; if ( v11 != 3 ) { if ( !v11 - || (v12 = word_F8BC48_displaced_face_intersect_plane_coords_a[v15 + 1] - word_F8BC48_displaced_face_intersect_plane_coords_a[v15], + || (v12 = v9 - word_F8BC48_displaced_face_intersect_plane_coords_a[v7/2], LODWORD(v13) = v12 << 16, HIDWORD(v13) = v12 >> 16, - word_F8BC48_displaced_face_intersect_plane_coords_a[v15] - + ((signed int)(((unsigned __int64)(v13 / (word_F8BD18_displaced_face_intersect_plane_coords_b[v15 + 1] - word_F8BD18_displaced_face_intersect_plane_coords_b[v15]) - * (signed int)((uModelID - word_F8BD18_displaced_face_intersect_plane_coords_b[v15]) << 16)) >> 16) + 32768) >> 16) >= (signed int)pFace) ) + word_F8BC48_displaced_face_intersect_plane_coords_a[v7/2] + + ((signed int)(((unsigned __int64)(v13 / (v8 - word_F8BD18_displaced_face_intersect_plane_coords_b[v7/2]) + * (signed int)((uModelID - word_F8BD18_displaced_face_intersect_plane_coords_b[v7/2]) << 16)) >> 16) + 32768) >> 16) >= (signed int)pFace) ) ++v16; } } - v6 = word_F8BD18_displaced_face_intersect_plane_coords_b[v15 + 1] >= (signed int)uModelID; + ++v15; + v6 = v8 >= (signed int)uModelID; } + while ( v15 < v5 ); result = 1; if ( v16 != 1 ) +LABEL_25: result = 0; return result; } @@ -666,113 +763,67 @@ //----- (004C1EE5) -------------------------------------------------------- bool Vis::_4C1EE5_BLV_IntersectBModel_2(int *a1, int *a2, __int16 *a3, __int16 *a4, Vec3_short_ *a5, BLVFace *pFace) { - bool result; // eax@1 - unsigned int v8; // ecx@1 - Vec3_short_ *v9; // ecx@2 - __int16 *v10; // edx@3 - signed int v11; // ecx@4 - char v12; // zf@6 - Vec3_short_ *v13; // ecx@6 - int v14; // edx@7 - __int16 *v15; // edx@8 - signed int v16; // ecx@9 - int v17; // edx@11 - __int16 *v18; // edx@12 - signed int v19; // ecx@13 - signed int a5a; // [sp+24h] [bp+18h]@2 - signed int a5b; // [sp+24h] [bp+18h]@7 - signed int a5c; // [sp+24h] [bp+18h]@11 + if (pFace->uAttributes & FACE_XY_PLANE) + { + *a1 = a5->x; + *a2 = a5->y; + + for (uint i = 0; i < pFace->uNumVertices; ++i) + { + a3[2 * i] = pFace->pXInterceptDisplacements[i] + pIndoor->pVertices[pFace->pVertexIDs[i]].x; + a3[2 * i + 1] = pFace->pXInterceptDisplacements[i + 1] + pIndoor->pVertices[pFace->pVertexIDs[i + 1]].x; + + a4[2 * i] = pFace->pYInterceptDisplacements[i] + pIndoor->pVertices[pFace->pVertexIDs[i]].y; + a4[2 * i + 1] = pFace->pYInterceptDisplacements[i + 1] + pIndoor->pVertices[pFace->pVertexIDs[i + 1]].y; + } + } + else if (pFace->uAttributes & FACE_XZ_PLANE) + { + *a1 = a5->x; + *a2 = a5->z; - result = (bool)pFace; - v8 = pFace->uAttributes; - if ( BYTE1(v8) & 1 ) - { - v9 = a5; - a5a = 0; - *a1 = v9->x; - *a2 = v9->y; - if ( pFace->uNumVertices ) + for (uint i = 0; i < pFace->uNumVertices; ++i) { - v10 = a4 + 1; - do - { - v11 = a5a; - a3[2 * a5a] = pFace->pXInterceptDisplacements[a5a] + pIndoor->pVertices[pFace->pVertexIDs[a5a]].x; - *(v10 - 1) = pFace->pYInterceptDisplacements[v11] + pIndoor->pVertices[pFace->pVertexIDs[v11]].y; - *(__int16 *)((char *)v10 + (int)a3 - (int)a4) = pFace->pXInterceptDisplacements[v11 + 1] - + pIndoor->pVertices[pFace->pVertexIDs[v11 + 1]].x; - ++a5a; - *v10 = pFace->pYInterceptDisplacements[v11 + 1] + pIndoor->pVertices[pFace->pVertexIDs[v11 + 1]].y; - v10 += 2; - } - while ( a5a < pFace->uNumVertices ); + a3[2 * i] = pFace->pXInterceptDisplacements[i] + pIndoor->pVertices[pFace->pVertexIDs[i]].x; + a3[2 * i + 1] = pFace->pXInterceptDisplacements[i + 1] + pIndoor->pVertices[pFace->pVertexIDs[i + 1]].x; + + a4[2 * i] = pFace->pZInterceptDisplacements[i] + pIndoor->pVertices[pFace->pVertexIDs[i]].z; + a4[2 * i + 1] = pFace->pZInterceptDisplacements[i + 1] + pIndoor->pVertices[pFace->pVertexIDs[i + 1]].z; + } + } + else if (pFace->uAttributes & FACE_YZ_PLANE) + { + *a1 = a5->y; + *a2 = a5->z; + + for (uint i = 0; i < pFace->uNumVertices; ++i) + { + a3[2 * i] = pFace->pYInterceptDisplacements[i] + pIndoor->pVertices[pFace->pVertexIDs[i]].y; + a3[2 * i + 1] = pFace->pYInterceptDisplacements[i + 1] + pIndoor->pVertices[pFace->pVertexIDs[i + 1]].y; + + a4[2 * i] = pFace->pZInterceptDisplacements[i] + pIndoor->pVertices[pFace->pVertexIDs[i]].z; + a4[2 * i + 1] = pFace->pZInterceptDisplacements[i + 1] + pIndoor->pVertices[pFace->pVertexIDs[i + 1]].z; } } else { - v12 = (BYTE1(v8) & 2) == 0; - v13 = a5; - if ( v12 ) - { - v17 = a5->y; - a5c = 0; - *a1 = v17; - *a2 = v13->z; - if ( pFace->uNumVertices ) - { - v18 = a4 + 1; - do - { - v19 = a5c; - a3[2 * a5c] = pFace->pYInterceptDisplacements[a5c] + pIndoor->pVertices[pFace->pVertexIDs[a5c]].y; - *(v18 - 1) = pFace->pZInterceptDisplacements[v19] + pIndoor->pVertices[pFace->pVertexIDs[v19]].z; - *(__int16 *)((char *)v18 + (int)(char *)a3 - (char *)a4) = pFace->pYInterceptDisplacements[v19 + 1] - + pIndoor->pVertices[pFace->pVertexIDs[v19 + 1]].y; - ++a5c; - *v18 = pFace->pZInterceptDisplacements[v19 + 1] + pIndoor->pVertices[pFace->pVertexIDs[v19 + 1]].z; - v18 += 2; - } - while ( a5c < pFace->uNumVertices ); - } - } - else - { - v14 = a5->x; - a5b = 0; - *a1 = v14; - *a2 = v13->z; - if ( pFace->uNumVertices ) - { - v15 = a4 + 1; - do - { - v16 = a5b; - a3[2 * a5b] = pFace->pXInterceptDisplacements[a5b] + pIndoor->pVertices[pFace->pVertexIDs[a5b]].x; - *(v15 - 1) = pFace->pZInterceptDisplacements[v16] + pIndoor->pVertices[pFace->pVertexIDs[v16]].z; - *(__int16 *)((char *)v15 + (int)a3 - (int)a4) = pFace->pXInterceptDisplacements[v16 + 1] - + pIndoor->pVertices[pFace->pVertexIDs[v16 + 1]].x; - ++a5b; - *v15 = pFace->pZInterceptDisplacements[v16 + 1] + pIndoor->pVertices[pFace->pVertexIDs[v16 + 1]].z; - v15 += 2; - } - while ( a5b < pFace->uNumVertices ); - } - } + assert(false); + return false; } - LOBYTE(result) = 1; - return result; + + return true; } //----- (004C2186) -------------------------------------------------------- -bool Vis::_4C2186_BLV_IntersectBModel(BLVFace *pFace, unsigned int ModelID, __int16 *displaced_face_intersect_plane_coords_a, __int16 *displaced_face_intersect_plane_coords_b, Vec3_short_ *IntersectPoint, BLVFace *face, unsigned int uModelID) +bool Vis::_4C2186_BLV_IntersectBModel(BLVFace *pFace, unsigned int ModelID, __int16 *displaced_face_intersect_plane_coords_a, __int16 *displaced_face_intersect_plane_coords_b, Vec3_short_ *a5, BLVFace *face, unsigned int uModelID) { bool result; // eax@1 //int *v9; // esi@1 //unsigned int v10; // ecx@1 //unsigned int v11; // edx@3 //signed int v12; // ecx@4 - __int16 v13; // si@4 - __int16 *v14; // ecx@4 + //__int16 v13; // si@4 + //__int16 *v14; // ecx@4 unsigned int v15; // edx@8 //signed int v16; // ecx@9 __int16 v17; // si@9 @@ -782,7 +833,7 @@ __int16 v21; // si@13 __int16 *v22; // ecx@13 //signed int a1a; // [sp+14h] [bp+8h]@1 - __int16 *a5a; // [sp+24h] [bp+18h]@3 + //__int16 *a5a; // [sp+24h] [bp+18h]@3 __int16 *a5b; // [sp+24h] [bp+18h]@8 __int16 *a5c; // [sp+24h] [bp+18h]@12 @@ -790,73 +841,93 @@ //v9 = pFace; //v10 = pFace->uAttributes; //a1a = 0; - if ( BYTE1(pFace->uAttributes) & 1 ) + if (pFace->uAttributes & FACE_XY_PLANE) { - pFace->pFacePlane.vNormal.x = IntersectPoint->x; - pFace->pFacePlane.vNormal.y = IntersectPoint->y; - if ( pFace->uNumVertices ) + pFace->pFacePlane.vNormal.x = a5->x; + pFace->pFacePlane.vNormal.y = a5->y; + + for (int i = 0; i < pFace->uNumVertices; ++i) + { + displaced_face_intersect_plane_coords_a[2 * i] = pFace->pXInterceptDisplacements[i] + pOutdoor->pBModels[ModelID].pVertices.pVertices[pFace->pVertexIDs[i]].x; + displaced_face_intersect_plane_coords_a[i * 2 + 1] = pFace->pXInterceptDisplacements[i + 1] + pOutdoor->pBModels[ModelID].pVertices.pVertices[pFace->pVertexIDs[i + 1]].x; + + displaced_face_intersect_plane_coords_b[2 * i] = pFace->pYInterceptDisplacements[i] + pOutdoor->pBModels[ModelID].pVertices.pVertices[pFace->pVertexIDs[i]].y; + displaced_face_intersect_plane_coords_b[i * 2 + 1] = pFace->pYInterceptDisplacements[i + 1] + pOutdoor->pBModels[ModelID].pVertices.pVertices[pFace->pVertexIDs[i + 1]].y; + } + } + else if (pFace->uAttributes & FACE_XZ_PLANE) + { + pFace->pFacePlane.vNormal.x = a5->x; + pFace->pFacePlane.vNormal.z = a5->z; + + for (int i = 0; i < pFace->uNumVertices; ++i) { - //v11 = 188 * ModelID + 72; - a5a = displaced_face_intersect_plane_coords_b + 1; - for ( uint i = 0; i < pFace->uNumVertices; ++i ) - { - displaced_face_intersect_plane_coords_a[2 * i] = pFace->pXInterceptDisplacements[i] + pOutdoor->pBModels[ModelID].pVertices.pVertices[pFace->pVertexIDs[i]].x; - displaced_face_intersect_plane_coords_b[2 * i] = pFace->pYInterceptDisplacements[i] + pOutdoor->pBModels[ModelID].pVertices.pVertices[pFace->pVertexIDs[i]].y; - *(__int16 *)((char *)a5a + (int)(char *)displaced_face_intersect_plane_coords_a - (char *)displaced_face_intersect_plane_coords_b) = - pFace->pXInterceptDisplacements[i + 1] + pOutdoor->pBModels[ModelID].pVertices.pVertices[pFace->pVertexIDs[i + 1]].x; - v13 = pFace->pYInterceptDisplacements[i + 1] + pOutdoor->pBModels[ModelID].pVertices.pVertices[pFace->pVertexIDs[i + 1]].y; - v14 = a5a; - a5a += 2; - *v14 = v13; - } + displaced_face_intersect_plane_coords_a[2 * i] = pFace->pXInterceptDisplacements[i] + pOutdoor->pBModels[ModelID].pVertices.pVertices[pFace->pVertexIDs[i]].x; + displaced_face_intersect_plane_coords_a[i * 2 + 1] = pFace->pXInterceptDisplacements[i + 1] + pOutdoor->pBModels[ModelID].pVertices.pVertices[pFace->pVertexIDs[i + 1]].x; + + displaced_face_intersect_plane_coords_b[2 * i] = pFace->pZInterceptDisplacements[i] + pOutdoor->pBModels[ModelID].pVertices.pVertices[pFace->pVertexIDs[i]].z; + displaced_face_intersect_plane_coords_b[i * 2 + 1] = pFace->pZInterceptDisplacements[i + 1] + pOutdoor->pBModels[ModelID].pVertices.pVertices[pFace->pVertexIDs[i + 1]].z; + } + } + else if (pFace->uAttributes & FACE_YZ_PLANE) + { + pFace->pFacePlane.vNormal.y = a5->y; + pFace->pFacePlane.vNormal.z = a5->z; + + for (int i = 0; i < pFace->uNumVertices; ++i) + { + displaced_face_intersect_plane_coords_a[2 * i] = pFace->pYInterceptDisplacements[i] + pOutdoor->pBModels[ModelID].pVertices.pVertices[pFace->pVertexIDs[i]].y; + displaced_face_intersect_plane_coords_a[i * 2 + 1] = pFace->pYInterceptDisplacements[i + 1] + pOutdoor->pBModels[ModelID].pVertices.pVertices[pFace->pVertexIDs[i + 1]].y; + + displaced_face_intersect_plane_coords_b[2 * i] = pFace->pZInterceptDisplacements[i] + pOutdoor->pBModels[ModelID].pVertices.pVertices[pFace->pVertexIDs[i]].z; + displaced_face_intersect_plane_coords_b[i * 2 + 1] = pFace->pZInterceptDisplacements[i + 1] + pOutdoor->pBModels[ModelID].pVertices.pVertices[pFace->pVertexIDs[i + 1]].z; } } + else assert(false); + + return true; +} + + + + + +//----- (0046A0A1) -------------------------------------------------------- +int UnprojectX(int x) +{ + int v3; // [sp-4h] [bp-8h]@5 + + if ( uCurrentlyLoadedLevelType == LEVEL_Indoor ) + { + if ( pRenderer->pRenderD3D ) + v3 = pGame->pIndoorCameraD3D->fov; + else + v3 = pIndoorCamera->flt_1C_fov; + } else { - if ( BYTE1(pFace->uAttributes) & 2 ) - { - pFace->pFacePlane.vNormal.x = IntersectPoint->x; - pFace->pFacePlane.vNormal.z = IntersectPoint->z; - if ( pFace->uNumVertices ) - { - v15 = 188 * uModelID + 72; - a5b = displaced_face_intersect_plane_coords_b + 1; - for ( uint i = 0; i < pFace->uNumVertices; ++i ) - { - displaced_face_intersect_plane_coords_a[2 * i] = pFace->pXInterceptDisplacements[i] + pOutdoor->pBModels[uModelID].pVertices.pVertices[pFace->pVertexIDs[i]].x; - displaced_face_intersect_plane_coords_b[2 * i] = pFace->pZInterceptDisplacements[i] + pOutdoor->pBModels[uModelID].pVertices.pVertices[pFace->pVertexIDs[i]].y; - *(__int16 *)((char *)a5b + (int)displaced_face_intersect_plane_coords_a - (int)displaced_face_intersect_plane_coords_b) = pFace->pXInterceptDisplacements[i + 1] - + pOutdoor->pBModels[uModelID].pVertices.pVertices[pFace->pVertexIDs[i + 1]].x; - v17 = pFace->pZInterceptDisplacements[i + 1] + pOutdoor->pBModels[uModelID].pVertices.pVertices[pFace->pVertexIDs[i + 1]].z; - v18 = a5b; - a5b += 2; - *v18 = v17; - } - } - } + v3 = pOutdoorCamera->int_fov_rad; + } + return stru_5C6E00->Atan2(x - pViewport->uScreenCenterX, v3) - stru_5C6E00->uIntegerHalfPi; +} + +//----- (0046A0F6) -------------------------------------------------------- +int UnprojectY(int y) +{ + int v3; // [sp-4h] [bp-8h]@5 + + if ( uCurrentlyLoadedLevelType == LEVEL_Indoor ) + { + if ( pRenderer->pRenderD3D ) + v3 = pGame->pIndoorCameraD3D->fov; else - { - pFace->pFacePlane.vNormal.y = IntersectPoint->y; - pFace->pFacePlane.vNormal.z = IntersectPoint->z; - if ( pFace->uNumVertices ) - { - v19 = 188 * uModelID + 72; - a5c = displaced_face_intersect_plane_coords_b + 1; - for ( uint i = 0; i < pFace->uNumVertices; ++i ) - { - displaced_face_intersect_plane_coords_a[2 * i] = pFace->pYInterceptDisplacements[i] + pOutdoor->pBModels[uModelID].pVertices.pVertices[pFace->pVertexIDs[i]].y; - displaced_face_intersect_plane_coords_b[2 * i] = pFace->pZInterceptDisplacements[i] + pOutdoor->pBModels[uModelID].pVertices.pVertices[pFace->pVertexIDs[i]].z; - *(__int16 *)((char *)a5c + (int)(char *)displaced_face_intersect_plane_coords_a - (char *)displaced_face_intersect_plane_coords_b) = pFace->pYInterceptDisplacements[i + 1] - + pOutdoor->pBModels[uModelID].pVertices.pVertices[pFace->pVertexIDs[i + 1]].y; - v21 = pFace->pZInterceptDisplacements[i + 1] + pOutdoor->pBModels[uModelID].pVertices.pVertices[pFace->pVertexIDs[i + 1]].z; - v22 = a5c; - a5c += 2; - *v22 = v21; - } - } - } + v3 = pIndoorCamera->flt_1C_fov; } - return true; + else + { + v3 = pOutdoorCamera->int_fov_rad; + } + return stru_5C6E00->Atan2(y - pViewport->uScreenCenterY, v3) - stru_5C6E00->uIntegerHalfPi; } //----- (004C248E) -------------------------------------------------------- @@ -876,7 +947,7 @@ pStartR.x = pIndoorCamera->pos.x; pStartR.y = pIndoorCamera->pos.y; pRotX = pIndoorCamera->sRotationX + UnprojectY((signed __int64)fMouseY); - pDepth = fixpoint_from_float(/*(int)&fMouseX, */fPickDepth); + pDepth = fixpoint_from_float(fPickDepth); Vec3_int_::Rotate(pDepth, pRotY, pRotX, pStartR, &outx, &outy, &outz); v11[0].flt_2C = 0.0;
--- a/mm7_1.cpp Thu May 23 11:16:46 2013 +0600 +++ b/mm7_1.cpp Thu May 23 11:17:01 2013 +0600 @@ -384,7 +384,7 @@ v10 = pGlobalTXT_LocalizationStrings[57]; // Days if ( v19 <= 1 ) v10 = pGlobalTXT_LocalizationStrings[56]; // Day - sprintf(pTmpBuf2, "%d %s ", v19, v10); + sprintfex(pTmpBuf2, "%d %s ", v19, v10); strcat(pTmpBuf, pTmpBuf2); } if ( v9 ) @@ -393,7 +393,7 @@ v11 = pGlobalTXT_LocalizationStrings[109];// Hour else v11 = pGlobalTXT_LocalizationStrings[110];// Hours - sprintf(pTmpBuf2, "%d %s ", v9, v11); + sprintfex(pTmpBuf2, "%d %s ", v9, v11); strcat(pTmpBuf, pTmpBuf2); } if ( v17 && !v19 ) @@ -402,7 +402,7 @@ v12 = pGlobalTXT_LocalizationStrings[437];// Minute else v12 = pGlobalTXT_LocalizationStrings[436];// Minutes - sprintf(pTmpBuf2, "%d %s ", v17, v12); + sprintfex(pTmpBuf2, "%d %s ", v17, v12); strcat(pTmpBuf, pTmpBuf2); } if ( v18 && !v9 ) @@ -411,7 +411,7 @@ v13 = pGlobalTXT_LocalizationStrings[439];// Second else v13 = pGlobalTXT_LocalizationStrings[438];// Seconds - sprintf(pTmpBuf2, "%d %s ", v18, v13); + sprintfex(pTmpBuf2, "%d %s ", v18, v13); strcat(pTmpBuf, pTmpBuf2); } a1->DrawText(a2, 32, uY, 0, pTmpBuf, 0, 0, 0); @@ -434,10 +434,10 @@ { if ( _506F18_num_hours_to_sleep < 6 ) { - pParty->pPlayers[3].pConditions[2] = 0i64; - pParty->pPlayers[2].pConditions[2] = 0i64; - pParty->pPlayers[1].pConditions[2] = 0i64; - pParty->pPlayers[0].pConditions[2] = 0i64; + pParty->pPlayers[3].SetAsleep(false); + pParty->pPlayers[2].SetAsleep(false); + pParty->pPlayers[1].SetAsleep(false); + pParty->pPlayers[0].SetAsleep(false); if ( _506F18_num_hours_to_sleep ) { Rest(_506F18_num_hours_to_sleep); @@ -484,6 +484,7 @@ POINT v3; // [sp+0h] [bp-10h]@2 POINT a2; // [sp+8h] [bp-8h]@1 + __debugbreak(); // invalid indexing if ( pMouse->GetCursorPos(&a2)->y < 350 ) { v0 = pMouse->GetCursorPos(&a2); @@ -755,127 +756,6 @@ return 1; } -//----- (00421D00) -------------------------------------------------------- -void __fastcall GameUI_OnPlayerPortraitLeftClick(unsigned int uPlayerID) -{ - //unsigned int v1; // esi@1 - //int v2; // eax@2 - //Player *v3; // ecx@2 - //Player *v4; // ecx@5 - unsigned int v5; // [sp-4h] [bp-10h]@21 - - //v1 = uPlayerID; - auto player = &pParty->pPlayers[uPlayerID - 1]; - if (pParty->pPickedItem.uItemID) - { - //v3 = player; - if (auto slot = player->AddItem(-1, pParty->pPickedItem.uItemID)) - { - memcpy(&player->pInventoryItems[slot-1], &pParty->pPickedItem, 0x24u); - viewparams->bRedrawGameUI = true; - pMouse->RemoveHoldingItem(); - return; - } - - if (!player->CanAct()) - { - player = pPlayers[uActiveCharacter]; - } - if(player->CanAct() || !pPlayers[uActiveCharacter]->CanAct()) - player->PlaySound(SPEECH_NoRoom, 0); - } - -//LABEL_9: - if (pCurrentScreen == SCREEN_GAME) - { - viewparams->bRedrawGameUI = true; - if ( uActiveCharacter != uPlayerID ) - //goto LABEL_27; - { - if ( pPlayers[uPlayerID]->uTimeToRecovery ) - return; - - uActiveCharacter = uPlayerID; - return; - } - v5 = 7; -//LABEL_22: - pGUIWindow_CurrentMenu = CharacterUI_Initialize(v5); - return; - } - if ( pCurrentScreen == SCREEN_SPELL_BOOK ) - return; - if ( pCurrentScreen == SCREEN_CHEST ) - { -//LABEL_23: - viewparams->bRedrawGameUI = true; - if ( uActiveCharacter == uPlayerID ) - { - pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 103; - pCurrentScreen = SCREEN_CHEST_INVENTORY; - //goto LABEL_28; - uActiveCharacter = uPlayerID; - return; - } -//LABEL_27: - if ( pPlayers[uPlayerID]->uTimeToRecovery ) - return; - //goto LABEL_28; - uActiveCharacter = uPlayerID; - return; - } - if ( pCurrentScreen != SCREEN_HOUSE ) - { - if ( pCurrentScreen == SCREEN_E ) - { -//LABEL_28: - uActiveCharacter = uPlayerID; - return; - } - if ( pCurrentScreen != SCREEN_CHEST_INVENTORY ) - { - viewparams->bRedrawGameUI = true; - uActiveCharacter = uPlayerID; - if ( pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] == 102 ) - FillAwardsData(); - return; - } - //goto LABEL_23; - viewparams->bRedrawGameUI = true; - if ( uActiveCharacter == uPlayerID ) - { - pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 103; - pCurrentScreen = SCREEN_CHEST_INVENTORY; - //goto LABEL_28; - uActiveCharacter = uPlayerID; - return; - } -//LABEL_27: - if ( pPlayers[uPlayerID]->uTimeToRecovery ) - return; - //goto LABEL_28; - uActiveCharacter = uPlayerID; - return; - } - if ( window_SpeakInHouse->field_40 == 1 ) - return; - viewparams->bRedrawGameUI = true; - if ( uActiveCharacter != uPlayerID ) - //goto LABEL_28; - uActiveCharacter = uPlayerID; - return; - if (dialog_menu_id == HOUSE_DIALOGUE_SHOP_BUY_STANDARD || dialog_menu_id == HOUSE_DIALOGUE_SHOP_6) - { - __debugbreak(); // fix indexing - pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 103; - v5 = 14; - //goto LABEL_22; - pGUIWindow_CurrentMenu = CharacterUI_Initialize(v5); - return; - } -} -// 4E28F8: using guessed type int pCurrentScreen; -// F8B19C: using guessed type int dword_F8B19C; //----- (00421EA6) -------------------------------------------------------- void __cdecl OnInventoryLeftClick() @@ -994,7 +874,7 @@ unsigned __int16 v5; // dx@14 signed int v6; // eax@14 char *v7; // esi@15 - int *v8; // eax@19 + //int *v8; // eax@19 int v9; // eax@19 unsigned int v10; // eax@19 int v11; // ecx@21 @@ -1011,7 +891,7 @@ ItemGen *v22; // esi@62 unsigned int v23; // eax@62 SpriteObject a1; // [sp+Ch] [bp-80h]@1 - POINT v25; // [sp+7Ch] [bp-10h]@3 + //POINT v25; // [sp+7Ch] [bp-10h]@3 POINT a2; // [sp+84h] [bp-8h]@3 if ( pRenderer->pRenderD3D ) @@ -1019,8 +899,9 @@ else { v1 = pMouse->GetCursorPos(&a2); - v0 = pRenderer->pActiveZBuffer[v1->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v25)->y]]; + v0 = pRenderer->pActiveZBuffer[v1->x + pSRZBufferLineOffsets[v1->y]]; } + if ( PID_TYPE(v0) == OBJECT_Item) { a2.y = (signed int)(unsigned __int16)v0 >> 3; @@ -1135,8 +1016,9 @@ a1.uSectorID = pIndoor->GetSector(pParty->vPosition.x, pParty->vPosition.y, pParty->sEyelevel + pParty->vPosition.z); a1.uSpriteFrameID = 0; memcpy(&a1.stru_24, &pParty->pPickedItem, 0x24u); - v8 = (int *)pMouse->GetCursorPos(&v25); - v9 = UnprojectX(*v8); + + extern int UnprojectX(int); + v9 = UnprojectX(v1->x); a1.Create(pParty->sRotationY + v9, 184, 200, 0); v10 = pIcons_LOD->LoadTexture(pItemsTable->pItems[pParty->pPickedItem.uItemID].pIconName, TEXTURE_16BIT_PALETTE); if (v10 != -1) @@ -1515,6 +1397,10 @@ uGameUIFontShadow = TargetColor(v5, v4, v6); } + + + + //----- (00423AEE) -------------------------------------------------------- void __cdecl reset_some_strus_flt_2Cs() {
--- a/mm7_2.cpp Thu May 23 11:16:46 2013 +0600 +++ b/mm7_2.cpp Thu May 23 11:17:01 2013 +0600 @@ -802,7 +802,7 @@ if ( pMessageQueue_50CBD0->uNumMessages ) pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; - pKeyActionMap->_459ED1(3); + pKeyActionMap->SetWindowInputStatus(3); pKeyActionMap->ResetKeys(); activeLevelDecoration = NULL; current_npc_text = 0; @@ -6634,10 +6634,7 @@ GUIWindow *pWindow; // [sp+4h] [bp-38h]@11 pCurrentScreen = SCREEN_GAME; - if (pAsyncMouse) - pAsyncMouse->Resume(); - if ( LOBYTE(pGame->pKeyboardInstance->bUsingAsynKeyboard) && pAsyncKeyboard ) - pAsyncKeyboard->Resume(); + pGUIWindow2 = 0; pAudioPlayer->StopChannels(-1, -1); pMouse->RemoveHoldingItem(); @@ -6673,7 +6670,7 @@ pTexture_PCX.Load("lsave640.pcx", 0); pGUIWindow2 = GUIWindow::Create(0, 0, 640, 480, WINDOW_MainMenu, 0, 0); pCurrentScreen = SCREEN_LOADGAME; - GameUI_DrawLoadMenu(0); + LoadUI_Load(0); } pWindow = pGUIWindow_CurrentMenu; } @@ -6694,12 +6691,10 @@ { pRenderer->BeginScene(); pRenderer->DrawTextureRGB(0, 0, &pTexture_PCX); - if (pAsyncMouse) - pAsyncMouse->_46B736_consume_click_lists(1); + GUI_MainMenuMessageProc(); GUI_UpdateWindows(); - if (pAsyncMouse) - pAsyncMouse->_46B736_consume_click_lists(1); + if (GetCurrentMenuID() != MENU_MAIN) { if (GetCurrentMenuID() == MENU_LoadingProcInMainMenu) @@ -6886,10 +6881,10 @@ return 0; //SubMenu "Time" - case 40009: pParty->uTimePlayed += Day; return 0; - case 40010: pParty->uTimePlayed += Week; return 0; - case 40011: pParty->uTimePlayed += Month; return 0; - case 40012: pParty->uTimePlayed += Year; return 0; + case 40009: pParty->uTimePlayed += Timer::Day; return 0; + case 40010: pParty->uTimePlayed += Timer::Week; return 0; + case 40011: pParty->uTimePlayed += Timer::Month; return 0; + case 40012: pParty->uTimePlayed += Timer::Year; return 0; //SubMenu "Items" case 40015: @@ -7016,8 +7011,6 @@ case WM_LBUTTONDOWN: if ( pArcomageGame->bGameInProgress ) { - if (pAsyncMouse) - return DefWindowProcA(hWnd, Msg, wParam, lParam); pArcomageGame->stru1.field_0 = 7; ArcomageGame::OnMouseClick(0, 1); return DefWindowProcA(hWnd, Msg, wParam, lParam); @@ -7031,27 +7024,19 @@ { if ( pVideoPlayer->pVideoFrame.pPixels != (unsigned __int16 *)v31 ) pVideoPlayer->bStopBeforeSchedule = 1; - if (!pAsyncMouse) - pMouse->SetMouseClick((unsigned __int16)lParam, lParam >> 16); + + pMouse->SetMouseClick((unsigned __int16)lParam, lParam >> 16); if (pGame) { - if (pAsyncMouse) - //goto _def_wnd_proc; - return DefWindowProcA(hWnd, Msg, wParam, lParam); v33 = pGame->pIndoorCameraD3D->GetPickDepth(); pGame->PickMouse(v33, (unsigned __int16)lParam, lParam >> 16, v31, &vis_sprite_filter_2, &vis_door_filter); } - if (!pAsyncMouse) - { + sub_416D62_ShowPopupWindow_MonsterRecord_ItemInfo_etcsub_416D62(0); return DefWindowProcA(hWnd, Msg, wParam, lParam); - } - //goto _def_wnd_proc; - return DefWindowProcA(hWnd, Msg, wParam, lParam); - } - if (pAsyncMouse) - //goto _def_wnd_proc; - return DefWindowProcA(hWnd, Msg, wParam, lParam); + + } + pArcomageGame->stru1.field_0 = 8; ArcomageGame::OnMouseClick(1, 1); return DefWindowProcA(hWnd, Msg, wParam, lParam); @@ -7060,14 +7045,9 @@ if ( !pArcomageGame->bGameInProgress ) //goto LABEL_218; { - if ( pAsyncMouse != v32 ) - return DefWindowProcA(hWnd, Msg, wParam, lParam); back_to_game(); return DefWindowProcA(hWnd, Msg, wParam, lParam); } - if (pAsyncMouse) - //goto _def_wnd_proc; - return DefWindowProcA(hWnd, Msg, wParam, lParam); pArcomageGame->stru1.field_0 = 3; ArcomageGame::OnMouseClick(0, 0); return DefWindowProcA(hWnd, Msg, wParam, lParam); @@ -7076,15 +7056,10 @@ if ( !pArcomageGame->bGameInProgress ) { //LABEL_218: - if ( pAsyncMouse != v32 ) - //goto _def_wnd_proc; - return DefWindowProcA(hWnd, Msg, wParam, lParam); + back_to_game(); return DefWindowProcA(hWnd, Msg, wParam, lParam); } - if (pAsyncMouse) - //goto _def_wnd_proc; - return DefWindowProcA(hWnd, Msg, wParam, lParam); pArcomageGame->stru1.field_0 = 4; v29 = 0; //goto LABEL_262; @@ -7095,9 +7070,6 @@ case WM_LBUTTONDBLCLK: if ( pArcomageGame->bGameInProgress ) { - if (pAsyncMouse) - //goto _def_wnd_proc; - return DefWindowProcA(hWnd, Msg, wParam, lParam); pArcomageGame->stru1.field_0 = 7; return DefWindowProcA(hWnd, Msg, wParam, lParam); } @@ -7106,7 +7078,6 @@ if ( pVideoPlayer->pVideoFrame.pPixels ) pVideoPlayer->bStopBeforeSchedule = 1; - if ( !pAsyncMouse ) pMouse->SetMouseClick((unsigned __int16)lParam, lParam >> 16); if (GetCurrentMenuID() != MENU_CREATEPARTY) @@ -7117,13 +7088,12 @@ pMouse->SetMouseClick((unsigned __int16)lParam, lParam >> 16); } - if (!pAsyncMouse) - { + if (pGame) pGame->PickMouse(512.0, (unsigned __int16)lParam, lParam >> 16, false, &vis_sprite_filter_3, &vis_door_filter); UI_OnMouseLeftClick(0); - } + return DefWindowProcA(hWnd, Msg, wParam, lParam); case WM_RBUTTONDBLCLK: @@ -7133,40 +7103,29 @@ //LABEL_240: if ( pVideoPlayer->pVideoFrame.pPixels != (unsigned __int16 *)v31 ) pVideoPlayer->bStopBeforeSchedule = 1; - if (!pAsyncMouse) + pMouse->SetMouseClick((unsigned __int16)lParam, lParam >> 16); if (pGame) { - if (pAsyncMouse) - //goto _def_wnd_proc; - return DefWindowProcA(hWnd, Msg, wParam, lParam); v33 = pGame->pIndoorCameraD3D->GetPickDepth(); pGame->PickMouse(v33, (unsigned __int16)lParam, lParam >> 16, v31, &vis_sprite_filter_2, &vis_door_filter); } - if (!pAsyncMouse) - { + sub_416D62_ShowPopupWindow_MonsterRecord_ItemInfo_etcsub_416D62(0); return DefWindowProcA(hWnd, Msg, wParam, lParam); - } - //goto _def_wnd_proc; - return DefWindowProcA(hWnd, Msg, wParam, lParam); - } - if (pAsyncMouse) - //goto _def_wnd_proc; - return DefWindowProcA(hWnd, Msg, wParam, lParam); + + } pArcomageGame->stru1.field_0 = 8; return DefWindowProcA(hWnd, Msg, wParam, lParam); case WM_MBUTTONDOWN: if ( pRenderer->pRenderD3D ) { - if ( pGame && !pAsyncMouse ) + if ( pGame ) { v34 = pGame->pIndoorCameraD3D->GetPickDepth(); pGame->PickMouse(v34, (unsigned __int16)lParam, lParam >> 16, 1, &vis_sprite_filter_3, &vis_face_filter); return DefWindowProcA(hWnd, Msg, wParam, lParam); } - //goto _def_wnd_proc; - return DefWindowProcA(hWnd, Msg, wParam, lParam); } if ( !pGame ) //goto _def_wnd_proc; @@ -7176,9 +7135,6 @@ case WM_MOUSEMOVE: if ( pArcomageGame->bGameInProgress ) { - if (pAsyncMouse) - //goto _def_wnd_proc; - return DefWindowProcA(hWnd, Msg, wParam, lParam); pXY[0] = (unsigned __int16)lParam; pXY[1] = lParam >> 16; ArcomageGame::OnMouseMove((POINT *)pXY); @@ -7188,9 +7144,6 @@ } else { - if (pAsyncMouse) - //goto _def_wnd_proc; - return DefWindowProcA(hWnd, Msg, wParam, lParam); pMouse->SetMouseClick((unsigned __int16)lParam, lParam >> 16); } return DefWindowProcA(hWnd, Msg, wParam, lParam); @@ -7235,7 +7188,7 @@ } return DefWindowProcA(hWnd, Msg, wParam, lParam); } - if ( dword_506E68 != -1 ) + if ( uGameMenuUI_CurentlySelectedKeyIdx != -1 ) { pKeyActionMap->_459F10(wParam); return DefWindowProcA(hWnd, Msg, wParam, lParam); @@ -7930,8 +7883,7 @@ Abortf(pGlobalTXT_LocalizationStrings[62]); } BYTE1(dword_6BE364_game_settings_1) &= 0xFEu; - if (pAsyncMouse) - pAsyncMouse->Resume(); + if ( pArcomageGame->bGameInProgress ) { pArcomageGame->field_F9 = 1; @@ -7946,9 +7898,8 @@ BYTE1(dword_6BE364_game_settings_1) &= 0xFBu; else pMiscTimer->Resume(); - if ( LOBYTE(pGame->pKeyboardInstance->bUsingAsynKeyboard) && pAsyncKeyboard ) - pAsyncKeyboard->Resume(); - viewparams->bRedrawGameUI = 1; + + viewparams->bRedrawGameUI = true; if ( pVideoPlayer->pSmackerMovie ) { pRenderer->RestoreFrontBuffer(); @@ -7968,8 +7919,7 @@ dword_4E98BC_bApplicationActive = 0; if ( (pVideoPlayer->pSmackerMovie || pVideoPlayer->pBinkMovie) && pVideoPlayer->bPlayingMovie ) pVideoPlayer->bStopBeforeSchedule = 1; - if (pAsyncMouse) - pAsyncMouse->Suspend(); + if ( pRenderer->bUserDirect3D && pRenderer->uAcquiredDirect3DDevice == 1 ) SetWindowPos(::hWnd, (HWND)0xFFFFFFFE, 0, 0, 0, 0, 0x18u); ClipCursor(0); @@ -7982,8 +7932,7 @@ BYTE1(dword_6BE364_game_settings_1) |= 4u; else pMiscTimer->Pause(); - if ( pGame && LOBYTE(pGame->pKeyboardInstance->bUsingAsynKeyboard) && pAsyncKeyboard ) - pAsyncKeyboard->Suspend(); + pAudioPlayer->StopChannels(-1, -1); if ( pAudioPlayer->hAILRedbook ) AIL_redbook_pause(pAudioPlayer->hAILRedbook); @@ -8011,15 +7960,9 @@ SetPriorityClass(v6, 0x20u); if ( pGame ) { - v7 = pGame->pKeyboardInstance; - if ( v7 ) - { - if ( LOBYTE(v7->bUsingAsynKeyboard) && pAsyncKeyboard ) - pAsyncKeyboard->_45B3A4(); - } - } - if (pAsyncMouse) - pAsyncMouse->_46B1DD(); + + } + PostQuitMessage(0); return 0; } @@ -8031,11 +7974,7 @@ if ( pRenderer->bUserDirect3D && pRenderer->uAcquiredDirect3DDevice == 1 ) SetWindowPos(::hWnd, (HWND)0xFFFFFFFE, 0, 0, 0, 0, 0x18u); ClipCursor(0); - if (pAsyncMouse) - { - pAsyncMouse->Suspend(); - return DefWindowProcA(hWnd, Msg, wParam, lParam); - } + } //_def_wnd_proc: return DefWindowProcA(hWnd, Msg, wParam, lParam); @@ -8070,14 +8009,9 @@ //goto _def_wnd_proc; return DefWindowProcA(hWnd, Msg, wParam, lParam); } - if ( ::hWnd != (HWND)wParam || (dword_4E98BC_bApplicationActive = 1, pRenderer->bWindowMode) || !pAsyncMouse ) + if ( ::hWnd != (HWND)wParam || (dword_4E98BC_bApplicationActive = 1, pRenderer->bWindowMode) || true ) return DefWindowProcA(hWnd, Msg, wParam, lParam); - pAsyncMouse->Resume(); - if ( !pAsyncMouse ) - //goto _def_wnd_proc; - return DefWindowProcA(hWnd, Msg, wParam, lParam); - pAsyncMouse->Clip(); - return DefWindowProcA(hWnd, Msg, wParam, lParam); + } //----- (00464479) -------------------------------------------------------- @@ -9073,8 +9007,6 @@ SetMenu(hWnd, 0); SetWindowLongA(hWnd, GWL_EXSTYLE, 0); SetWindowLongA(hWnd, GWL_STYLE, WS_VISIBLE); - if (pAsyncMouse) - pAsyncMouse->Clip(); pRenderer->InitializeFullscreen(hWnd); } else @@ -9155,8 +9087,6 @@ char pContainer[32]; // [sp+10h] [bp-Ch]@9 pMouse->Initialize(hWnd); - CreateAsyncMouse(); - CreateAsyncKeyboard(); pItemsTable = new ItemsTable; pItemsTable->Initialize(); @@ -9511,8 +9441,7 @@ { if ( pAudioPlayer->hAILRedbook ) AIL_redbook_stop(pAudioPlayer->hAILRedbook); - extern MENU_STATE __cdecl CreditsMenu__Loop(); - CreditsMenu__Loop(); + MainMenuUI_Credits_Loop(); break; } if (GetCurrentMenuID() == MENU_5 || GetCurrentMenuID() == MENU_LoadingProcInMainMenu) @@ -9524,10 +9453,7 @@ if (GetCurrentMenuID() != MENU_10) goto LABEL_49; pMouse->Activate(0); - if (pAsyncMouse) - pAsyncMouse->Suspend(); - if ( LOBYTE(pGame->pKeyboardInstance->bUsingAsynKeyboard) && pAsyncKeyboard ) - pAsyncKeyboard->Suspend(); + pParty->Reset(); pParty->CreateDefaultParty(1); crt_init_globals_46271C(); @@ -9535,19 +9461,12 @@ if ( !GetOpenFileNameA((LPOPENFILENAMEA)&ofn) ) { pMouse->Activate(1); - if (pAsyncMouse) - pAsyncMouse->Resume(); - if ( LOBYTE(pGame->pKeyboardInstance->bUsingAsynKeyboard) && pAsyncKeyboard ) - pAsyncKeyboard->Resume(); + break; } _chdir("..\\"); strcpy(pCurrentMapName, ofn.lpstrFileTitle); pMouse->Activate(1); - if (pAsyncMouse) - pAsyncMouse->Resume(); - if ( LOBYTE(pGame->pKeyboardInstance->bUsingAsynKeyboard) && pAsyncKeyboard ) - pAsyncKeyboard->Resume(); } //LABEL_48: pGame->Loop(); @@ -9592,35 +9511,6 @@ } // 507BF0: using guessed type int dword_507BF0_is_there_popup_onscreen; -//----- (00465F5A) -------------------------------------------------------- -void __cdecl CreateAsyncMouse() -{ - LOG_DECOMPILATION_WARNING(); - /* - if (!pAsyncMouse && - pRenderer->bUserDirect3D && - pRenderer->uAcquiredDirect3DDevice == 1) - { - pAsyncMouse = new AsyncMouse(&pRenderer->pDirectDraw4); - if (pAsyncMouse) - pAsyncMouse->Resume(); - }*/ -} - -//----- (00465FF0) -------------------------------------------------------- -void __cdecl CreateAsyncKeyboard() -{ - LOG_DECOMPILATION_WARNING(); - /* - if (!pAsyncKeyboard && - pGame->pKeyboardInstance->bUsingAsynKeyboard) - { - pAsyncKeyboard = new AsyncKeyboard; - if (pAsyncKeyboard) - pAsyncKeyboard->Resume(); - }*/ -} - //----- (00466082) -------------------------------------------------------- void MM6_Initialize(const wchar_t *pIniFilename) { @@ -9863,11 +9753,6 @@ }; void SetCurrentMenuID(MENU_STATE uMenu) { - if ((int)uCurrentMenuID != -1) - { - if (pGame->pKeyboardInstance->bUsingAsynKeyboard && pAsyncKeyboard) - pAsyncKeyboard->Resume(); - } uCurrentMenuID = uMenu; Log::Warning(L"CurrentMenu = %s", MENU_STATE_to_string(uMenu)); @@ -9879,33 +9764,60 @@ return uCurrentMenuID; } -//----- (00467D5D) -------------------------------------------------------- -int __thiscall sub_467D5D(int _this) -{ - return *(int *)(_this + 7204); -} //----- (00467E7F) -------------------------------------------------------- -void __thiscall sub_467E7F_EquipBody(unsigned int uEquipType) -{ - unsigned int v1; // esi@1 +void sub_467E7F_EquipBody(ITEM_EQUIP_TYPE uEquipType) +{ + //unsigned int v1; // esi@1 int v2; // ebx@1 Player *v3; // eax@1 int v4; // edx@1 int v5; // esi@2 - int v6; // eax@2 + //int v6; // eax@2 unsigned int v7; // eax@3 ItemGen _this; // [sp+Ch] [bp-30h]@1 - Player *v9; // [sp+30h] [bp-Ch]@1 + //Player *v9; // [sp+30h] [bp-Ch]@1 int v10; // [sp+34h] [bp-8h]@1 int *v11; // [sp+38h] [bp-4h]@1 - v1 = uEquipType; + static unsigned char byte_4E8398[200] = // 4E8398 + { + 1, // EQUIP_OFF_HAND + 1, // EQUIP_MAIN_HAND + 2, // EQUIP_BOW + 3, // EQUIP_ARMOUR + 0, // EQUIP_SHIELD + 4, // EQUIP_HELMET + 5, // EQUIP_BELT + 6, // EQUIP_CLOAK + 7, // EQUIP_GAUNTLETS + 8, // EQUIP_BOOTS + 10, // EQUIP_RING + 9, // EQUIP_AMULET + 1, // EQUIP_WAND + 0, // EQUIP_REAGENT + 0, // EQUIP_POTION + 0, // EQUIP_SPELL_SCROLL + 0, // EQUIP_BOOK + 0, // EQUIP_MESSAGE_SCROLL + 0, // EQUIP_GOLD + 0, // EQUIP_GEM + 0, // EQUIP_NONE + // ??? + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, + 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 1, 0, 0, + 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3, 3, 1, 1, 1, + 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0 +}; + _this.Reset(); - v2 = (unsigned __int8)byte_4E8394[v1 + 4]; + v2 = byte_4E8398[uEquipType]; v3 = pPlayers[uActiveCharacter]; - v9 = v3; - v11 = (int *)((char *)&v3->pEquipment + 4 * v2); + v11 = (int *)&v3->pEquipment.pIndices[v2]; v4 = *v11; v10 = *v11; if ( v10 ) @@ -9915,18 +9827,17 @@ *(char *)(v5 + 556) = 0; pParty->pPickedItem.Reset(); pParty->SetHoldingItem((ItemGen *)(v5 + 532)); - v6 = v10; _this.uBodyAnchor = v2 + 1; memcpy((void *)(v5 + 532), &_this, 0x24u); - *v11 = v6; + *v11 = v10; } else { v7 = v3->FindFreeInventorySlot(); - if ( (v7 & 0x80000000u) == 0 ) + if (v7 >= 0) { pParty->pPickedItem.uBodyAnchor = v2 + 1; - memcpy(&v9->pInventoryItems[v7], &pParty->pPickedItem, sizeof(v9->pInventoryItems[v7])); + memcpy(&v3->pInventoryItems[v7], &pParty->pPickedItem, sizeof(v3->pInventoryItems[v7])); *v11 = v7 + 1; pMouse->RemoveHoldingItem(); } @@ -10106,7 +10017,7 @@ } if ( pParty->pPickedItem.uItemID == 604 ) { - sub_467E7F_EquipBody(3); + sub_467E7F_EquipBody((ITEM_EQUIP_TYPE)3); WetsuitOn(uActiveCharacter); return; } @@ -10131,7 +10042,7 @@ pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0); return; } - sub_467E7F_EquipBody(v6); + sub_467E7F_EquipBody((ITEM_EQUIP_TYPE)v6); if ( pParty->pPickedItem.uItemID == 604 ) WetsuitOff(uActiveCharacter); return; @@ -10248,16 +10159,10 @@ if ( pSkillType == 2 && (unsigned __int16)(pPlayers[uActiveCharacter]->pActiveSkills[2] & 0xFFC0) || pSkillType == 1 && (signed int)SkillToMastery(pPlayers[uActiveCharacter]->pActiveSkills[1]) >= 3 ) { - if (pAsyncMouse) - { - v18 = *((int *)pAsyncMouse + 6); - v19 = *((int *)pAsyncMouse + 7); - } - else - { + v18 = pMouse->uMouseClickX; v19 = pMouse->uMouseClickY; - } + v49 = v19; if ( (signed int)v18 >= 560 ) { @@ -10414,18 +10319,10 @@ } return; } - if (pAsyncMouse) - { - v32 = *((int *)pAsyncMouse + 6); - v33 = *((int *)pAsyncMouse + 7); - v49 = *((int *)pAsyncMouse + 7); - v48 = v32; - } - else - { + v32 = pMouse->uMouseClickX; v33 = pMouse->uMouseClickY; - } + v34 = pRenderer->pActiveZBuffer[v32 + pSRZBufferLineOffsets[v33]] & 0xFFFF; if ( v34 ) { @@ -10483,47 +10380,6 @@ } } -//----- (0046A0A1) -------------------------------------------------------- -int __thiscall UnprojectX(int x) -{ - double v1; // st7@3 - int v3; // [sp-4h] [bp-8h]@5 - - if ( uCurrentlyLoadedLevelType == LEVEL_Indoor ) - { - if ( pRenderer->pRenderD3D ) - v1 = pGame->pIndoorCameraD3D->fov; - else - v1 = pIndoorCamera->flt_1C_fov; - v3 = (signed __int64)v1; - } - else - { - v3 = pOutdoorCamera->int_fov_rad; - } - return stru_5C6E00->Atan2(x - pViewport->uScreenCenterX, v3) - stru_5C6E00->uIntegerHalfPi; -} - -//----- (0046A0F6) -------------------------------------------------------- -int __thiscall UnprojectY(int _this) -{ - double v1; // st7@3 - int v3; // [sp-4h] [bp-8h]@5 - - if ( uCurrentlyLoadedLevelType == LEVEL_Indoor ) - { - if ( pRenderer->pRenderD3D ) - v1 = pGame->pIndoorCameraD3D->fov; - else - v1 = pIndoorCamera->flt_1C_fov; - v3 = (signed __int64)v1; - } - else - { - v3 = pOutdoorCamera->int_fov_rad; - } - return stru_5C6E00->Atan2(_this - pViewport->uScreenCenterY, v3) - stru_5C6E00->uIntegerHalfPi; -} //----- (0046A14B) -------------------------------------------------------- void OnPressSpace() @@ -10557,7 +10413,14 @@ auto pid = pGame->pVisInstance->get_picked_object_zbuf_val(); if ( pid != -1 ) DoInteractionWithTopmostZObject(pid & 0xFFFF, PID_ID(pid)); - } + return; + } + + + // software render stuff following + + static int dword_720660[100]; // 720660 + static int dword_7207F0[100]; // 7207F0 v22 = 0; v1 = (int *)((signed int)(viewparams->uScreen_BttmR_X + viewparams->uScreen_topL_X) >> 1);//wrong pointer @@ -10603,8 +10466,8 @@ ++v22; ++v4; v8 = *v21; - dword_7207EC[v4] = v7; - dword_72065C[v4] = v8; + dword_7207F0[v4 - 1] = v7; + dword_720660[v4 - 1] = v8; } } else if ( (unsigned int)*v21 <= 0x2000000 ) @@ -10614,8 +10477,8 @@ ++v22; ++v4; v8 = *v21; - dword_7207EC[v4] = v7; - dword_72065C[v4] = v8; + dword_7207F0[v4 - 1] = v7; + dword_720660[v4 - 1] = v8; } } v1 = v21 + 2; @@ -10745,13 +10608,6 @@ if ( v13->sNPC_ID ) { pMessageQueue_50CBD0->AddMessage(UIMSG_StartNPCDialogue, v12, 0); - /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) - { - pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_StartNPCDialogue; - pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = v12; - *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; - ++pMessageQueue_50CBD0->uNumMessages; - }*/ } else { @@ -10948,15 +10804,15 @@ v6 = PID_ID(v5); v7 = v6; v8 = pActors[v6].uAIState; - if ( v8 != 5 ) - { - if ( v8 != 4 ) - { - if ( v8 != 11 ) + if ( v8 != Dead ) + { + if ( v8 != Dying ) + { + if ( v8 != Removed ) { - if ( v8 != 19 ) + if ( v8 != Disabled ) { - if ( v8 != 17 ) + if ( v8 != Summoned ) { v9 = (double)a3; if ( pGame->pVisInstance->DoesRayIntersectBillboard(v9, a1a) ) @@ -11335,7 +11191,7 @@ else { pAudioPlayer->StopChannels(-1, -1); - UI_CreateTravelDialogue(); + TravelUI_Load(); } } UpdateActors_ODM();
--- a/mm7_3.cpp Thu May 23 11:16:46 2013 +0600 +++ b/mm7_3.cpp Thu May 23 11:17:01 2013 +0600 @@ -1662,8 +1662,8 @@ auto player = pParty->pPlayers + i; if (!player->HasEnchantedItemEquipped(72) && !player->WearsItem(ITEM_ARTIFACT_HERMES_SANDALS, 8)) { - player->ReceiveDamage((pParty->uFallStartY - party_z) * (0.1f * player->GetMaxHealth()) / 256, 4); - v10 = (double)(20 - player->_48EA1B_get_static_effect(player->GetActualEndurance())) * flt_6BE3A4_debug_recmod1 * 2.133333333333333; + player->ReceiveDamage((pParty->uFallStartY - party_z) * (0.1f * player->GetMaxHealth()) / 256, DMGT_PHISYCAL); + v10 = (double)(20 - player->GetParameterBonus(player->GetActualEndurance())) * flt_6BE3A4_debug_recmod1 * 2.133333333333333; player->SetRecoveryTime((signed __int64)v10); } } @@ -2301,8 +2301,8 @@ { player->ReceiveDamage( (signed int)((pParty->uFallStartY - pZ) * (unsigned __int64)(player->GetMaxHealth() / 10)) / 256, - 4); - v105 = 20 - player->_48EA1B_get_static_effect(player->GetActualEndurance()); + DMGT_PHISYCAL); + v105 = 20 - player->GetParameterBonus(player->GetActualEndurance()); player->SetRecoveryTime((signed __int64)((double)v105 * flt_6BE3A4_debug_recmod1 * 2.133333333333333)); } //} @@ -3081,9 +3081,9 @@ v110 = (*v74)->GetMaxHealth(); (*v74)->ReceiveDamage( (signed int)((pParty->uFallStartY - v70) * (unsigned __int64)(signed __int64)((double)v110 * 0.1)) / 256, - 4); + DMGT_PHISYCAL); v75 = (*v74)->GetActualEndurance(); - v110 = 20 - (*v74)->_48EA1B_get_static_effect(v75); + v110 = 20 - (*v74)->GetParameterBonus(v75); (*v74)->SetRecoveryTime( (signed __int64)((double)v110 * flt_6BE3A4_debug_recmod1 * 2.133333333333333)); ++v74; @@ -3203,9 +3203,9 @@ v110 = (*v84)->GetMaxHealth(); (*v84)->ReceiveDamage( (signed int)((pParty->uFallStartY - v81) * (unsigned __int64)(signed __int64)((double)v110 * 0.1)) / 256, - 4); + DMGT_PHISYCAL); v85 = (*v84)->GetActualEndurance(); - v110 = 20 - (*v84)->_48EA1B_get_static_effect(v85); + v110 = 20 - (*v84)->GetParameterBonus(v85); (*v84)->SetRecoveryTime((signed __int64)((double)v110 * flt_6BE3A4_debug_recmod1 * 2.133333333333333)); ++v84; } @@ -12041,113 +12041,6 @@ LoadLevel_InitializeLevelStr(); } -//----- (004443D5) -------------------------------------------------------- -char *__cdecl _4443D5_GetMinimapRightClickText() -{ - int v0; // ST20_4@1 - unsigned int v1; // esi@1 - signed int v2; // ebx@1 - double v3; // st7@1 - int v4; // esi@3 - int v5; // edi@4 - int v6; // eax@4 - int v7; // eax@4 - BSPModel *v8; // ecx@4 - unsigned __int8 v9; // zf@5 - char v10; // sf@5 - unsigned __int8 v11; // of@5 - ODMFace *v12; // eax@6 - __int16 v13; // cx@6 - const char *v14; // eax@8 - const char *v15; // edi@8 - char *result; // eax@12 - unsigned int v17; // eax@14 - unsigned int v18; // [sp+Ch] [bp-20h]@1 - int v19; // [sp+10h] [bp-1Ch]@1 - int v20; // [sp+14h] [bp-18h]@1 - char *v21; // [sp+18h] [bp-14h]@1 - unsigned int pY; // [sp+1Ch] [bp-10h]@1 - int v23; // [sp+20h] [bp-Ch]@1 - int v24; // [sp+24h] [bp-8h]@1 - int pX; // [sp+28h] [bp-4h]@1 - - v24 = pParty->vPosition.x; - v0 = pParty->vPosition.y; - v1 = pOutdoor->uNumBModels; - *(float *)&v23 = (double)(signed int)viewparams->uMinimapZoom * 0.000015258789; - v2 = 0; - v18 = pOutdoor->uNumBModels; - v21 = 0; - pMouse->GetClickPos((unsigned int *)&pX, &pY); - v3 = 1.0 / *(float *)&v23; - v23 = pX - 557; - v19 = (signed __int64)((double)(pX - 557) * v3 + (double)v24); - v20 = (signed __int64)((double)v0 - (double)(signed int)(pY - 74) * v3); - if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor || (*(float *)&v23 = 0.0, (signed int)v1 <= 0) ) - { -LABEL_14: - v17 = pMapStats->GetMapInfo(pCurrentMapName); - if ( v17 == v2 ) - result = "No Maze Info for this maze on file!"; - else - result = pMapStats->pInfos[v17].pName; - } - else - { - v4 = 0; - while ( 1 ) - { - pX = pOutdoor->pBModels[v4].vBoundingCenter.x - v19; - pY = pOutdoor->pBModels[v4].vBoundingCenter.y - v20; - v5 = abs((signed)pY); - v6 = abs((signed)pX); - v7 = int_get_vector_length(v6, v5, v2); - v8 = &pOutdoor->pBModels[0]; - if ( v7 < 2 * pOutdoor->pBModels[v4].sBoundingRadius ) - { - v11 = __OFSUB__(pOutdoor->pBModels[v4].uNumFaces, v2); - v9 = pOutdoor->pBModels[v4].uNumFaces == v2; - v10 = ((pOutdoor->pBModels[v4].uNumFaces - v2) & 0x80000000u) != 0; - v24 = v2; - if ( !((unsigned __int8)(v10 ^ v11) | v9) ) - { - do - { - v12 = &v8[v4].pFaces[v2 / 0x134u]; - v13 = v12->sCogTriggeredID; - if ( v13 ) - { - if ( !(BYTE2(v12->uAttributes) & 0x10) ) - { - v14 = GetEventHintString(v13); - v15 = v14; - if ( v14 ) - { - if ( _strcmpi(v14, "") ) - v21 = (char *)v15; - } - } - } - ++v24; - v8 = pOutdoor->pBModels; - v2 += 308; - } - while ( v24 < (signed int)pOutdoor->pBModels[v4].uNumFaces ); - } - result = v21; - v2 = 0; - if ( v21 ) - break; - } - ++v23; - ++v4; - if ( v23 >= (signed int)v18 ) - goto LABEL_14; - } - } - return result; -} - //----- (00444564) -------------------------------------------------------- const char *__cdecl sub_444564() { @@ -12232,102 +12125,6 @@ return result; } -//----- (00444A51) -------------------------------------------------------- -void TransitionUI_Draw() -{ - MapInfo *pMapInfo; // esi@5 - char *v1; // eax@6 - std::string v3; // [sp-18h] [bp-84h]@11 - unsigned int v4; // [sp-10h] [bp-7Ch]@12 - int v5; // [sp-Ch] [bp-78h]@12 - const char *v6; // [sp-8h] [bp-74h]@11 - signed int v7; // [sp-4h] [bp-70h]@11 - GUIWindow v8; // [sp+Ch] [bp-60h]@1 - unsigned int v9; // [sp+60h] [bp-Ch]@1 - unsigned int v10; // [sp+64h] [bp-8h]@1 - int a3; // [sp+6Bh] [bp-1h]@11 - - memcpy(&v8, pPrimaryWindow, sizeof(v8)); - v10 = pMapStats->GetMapInfo(pCurrentMapName); - v9 = IndoorLocation::GetLocationIndex(dword_591164_teleport_map_name); - pRenderer->DrawTextureIndexed(0x1DDu, 0, pTexture_Dialogue_Background); - pRenderer->DrawTextureIndexed(pNPCPortraits_x[0][0] - 4, pNPCPortraits_y[0][0] - 4, pIcons_LOD->GetTexture(uTextureID_50795C)); - pRenderer->DrawTextureIndexed(pNPCPortraits_x[0][0], pNPCPortraits_y[0][0], pTexture_outside); - uTextureID_right_panel_loop = uTextureID_right_panel; - pRenderer->DrawTextureTransparent(468, 0, pIcons_LOD->GetTexture(uTextureID_right_panel)); - pRenderer->DrawTextureIndexed(556, 451, pIcons_LOD->GetTexture(uTextureID_x_x_u)); - pRenderer->DrawTextureIndexed(476, 451, pIcons_LOD->GetTexture(uTextureID_x_ok_u)); - if ( (pVideoPlayer->AnyMovieLoaded() || v9) && *dword_591164_teleport_map_name != ' ' ) - v10 = pMapStats->GetMapInfo(dword_591164_teleport_map_name); - pMapInfo = &pMapStats->pInfos[v10]; - v8.uFrameX = 493; - v8.uFrameWidth = 126; - v8.uFrameZ = 366; - v8.DrawTitleText(pFontCreate, 0, 5u, 0, pMapInfo->pName, 3); - v8.uFrameX = 483; - v8.uFrameWidth = 148; - v8.uFrameZ = 334; - - v1 = ""; - if ( uCurrentHouse_Animation ) - { - v1 = pTransitionStrings[uCurrentHouse_Animation]; - v4 = (212 - pFontCreate->CalcTextHeight(v1, &v8, 0, 0)) / 2 + 101; - v8.DrawTitleText(pFontCreate, 0, v4, 0, v1, 3); - } - else if ( v10 ) - { - sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[409], pMapInfo->pName);// "Do you wish to leave %s?" - v4 = (212 - pFontCreate->CalcTextHeight(pTmpBuf, &v8, 0, 0)) / 2 + 101; - v8.DrawTitleText(pFontCreate, 0, v4, 0, pTmpBuf, 3); - } - else assert(false); - - _unused_5B5924_is_travel_ui_drawn = true; -} - -//----- (00444C8F) -------------------------------------------------------- -void UI_CreateTravelDialogue() -{ - //signed int v0; // eax@1 - unsigned int v1; // eax@6 - GUIWindow *result; // eax@9 - //const char *v3; // [sp-4h] [bp-2Ch]@2 - char pContainer[32]; // [sp+0h] [bp-28h]@1 - - pEventTimer->Pause(); - /*v0 = const_2(); - sprintf(pContainer, "evt%02d", v0); - if ( pParty->uAlignment ) - { - if ( pParty->uAlignment != 2 ) - goto LABEL_6; - v3 = "-c"; - } - else - { - v3 = "-b"; - } - strcat(pContainer, v3); -LABEL_6:*/ - switch (pParty->alignment) - { - case PartyAlignment_Good: sprintf(pContainer, "evt%02d-b", const_2()); break; - case PartyAlignment_Neutral: sprintf(pContainer, "evt%02d", const_2()); break; - case PartyAlignment_Evil: sprintf(pContainer, "evt%02d-c", const_2()); break; - default: assert(false); - } - - pTexture_Dialogue_Background = pIcons_LOD->LoadTexturePtr(pContainer, TEXTURE_16BIT_PALETTE); - pTexture_outside = pIcons_LOD->LoadTexturePtr("outside", TEXTURE_16BIT_PALETTE); - v1 = pMapStats->GetMapInfo(pCurrentMapName); - if ( v1 ) - sprintfex(sHouseName, pGlobalTXT_LocalizationStrings[410], pMapStats->pInfos[v1].pName);// "Leave %s" - else - strcpy(sHouseName, pGlobalTXT_LocalizationStrings[79]);// "Exit" - pDialogueWindow = GUIWindow::Create(0, 0, 640, 480, WINDOW_ChangeLocation, 0, (int)sHouseName); -} - //----- (00444D80) -------------------------------------------------------- signed int __cdecl GetTravelTime() { @@ -12348,123 +12145,6 @@ } // 6BD07C: using guessed type int uDefaultTravelTime_ByFoot; -//----- (00444DCA) -------------------------------------------------------- -void __cdecl TravelUI_Draw() -{ - unsigned int v0; // edi@1 - MapInfo *v1; // edi@2 - signed int v3; // eax@2 - int v4; // eax@5 - const char *v5; // [sp-Ch] [bp-90h]@3 - signed int v6; // [sp-8h] [bp-8Ch]@3 - GUIWindow v7; // [sp+Ch] [bp-78h]@1 - char pDestinationMapName[32]; // [sp+60h] [bp-24h]@1 - unsigned int v9; // [sp+80h] [bp-4h]@1 - - memcpy(&v7, pPrimaryWindow, sizeof(v7)); - v9 = pMapStats->GetMapInfo(pCurrentMapName); - pOutdoor->GetTravelDestination(pParty->vPosition.x, pParty->vPosition.y, pDestinationMapName, 20); - v0 = pMapStats->GetMapInfo(pDestinationMapName); - pRenderer->DrawTextureIndexed(0x1DDu, 0, pTexture_Dialogue_Background); - pRenderer->DrawTextureTransparent(0x1D4u, 0, &pIcons_LOD->pTextures[uTextureID_right_panel_loop]); - pRenderer->DrawTextureIndexed(pNPCPortraits_x[0][0], pNPCPortraits_y[0][0], pTexture_outside); - pRenderer->DrawTextureIndexed(0x22Cu, 0x1C3u, pIcons_LOD->GetTexture(uTextureID_x_x_u)); - pRenderer->DrawTextureIndexed(0x1DCu, 0x1C3u, pIcons_LOD->GetTexture(uTextureID_x_ok_u)); - if ( v0 ) - { - v1 = &pMapStats->pInfos[v0]; - v7.uFrameX = 493; - v7.uFrameWidth = 126; - v7.uFrameZ = 366; - v7.DrawTitleText(pFontCreate, 0, 4u, 0, v1->pName, 3); - v7.uFrameX = 483; - v7.uFrameWidth = 148; - v7.uFrameZ = 334; - v3 = GetTravelTime(); - if ( v3 == 1 ) - { - v6 = 1; - v5 = pGlobalTXT_LocalizationStrings[663]; // "It will take %d day to cross to %s." - } - else - { - v6 = v3; - v5 = pGlobalTXT_LocalizationStrings[128]; // "It will take %d days to travel to %s." - } - sprintfex(pTmpBuf, v5, v6, v1->pName); - strcat(pTmpBuf, "\n \n"); - sprintfex(pTmpBuf2, pGlobalTXT_LocalizationStrings[126], pMapStats->pInfos[v9].pName); - strcat(pTmpBuf, pTmpBuf2); - v4 = pFontCreate->CalcTextHeight(pTmpBuf, &v7, 0, 0); - v7.DrawTitleText(pFontCreate, 0, (212 - v4) / 2 + 101, 0, pTmpBuf, 3u); - _unused_5B5924_is_travel_ui_drawn = 1; - } -} - -//----- (00444FBE) -------------------------------------------------------- -void __cdecl DrawBranchlessDialogueUI() -{ - GUIFont *v0; // esi@1 - int v1; // esi@4 - char *v2; // eax@6 - int v3; // edi@12 - char Str[200]; // [sp+Ch] [bp-120h]@12 - GUIWindow v5; // [sp+D4h] [bp-58h]@4 - GUIFont *pFont; // [sp+128h] [bp-4h]@1 - - v0 = pFontArrus; - pFont = pFontArrus; - if ( current_npc_text && !byte_5B0938[0] ) - strcpy(byte_5B0938, current_npc_text); - v5.uFrameWidth = game_viewport_width; - v5.uFrameZ = 452; - v1 = pFontArrus->CalcTextHeight(byte_5B0938, &v5, 12, 0) + 7; - if ( 352 - v1 < 8 ) - { - pFont = pFontCreate; - v1 = pFontCreate->CalcTextHeight(byte_5B0938, &v5, 12, 0) + 7; - } - pRenderer->_4A6A68( - 8u, - 352 - v1, - (Texture *)(uTextureID_Leather != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_Leather] : 0), - (uTextureID_Leather != -1 ? pIcons_LOD->pTextures[uTextureID_Leather].uTextureHeight : 26) - v1); - pRenderer->DrawTextureIndexed(8u, 347 - v1, pTexture_591428); - v2 = FitTextInAWindow(byte_5B0938, pFont, &v5, 0xCu, 0); - pGUIWindow2->DrawText(pFont, 12, 354 - v1, 0, v2, 0, 0, 0); - pRenderer->DrawTextureRGB(0, 0x160u, pTexture_StatusBar); - if ( pGUIWindow2->field_40 != 1 ) - { - if ( pGUIWindow2->field_40 == 2 ) - { - pGUIWindow2->field_40 = 0; - strcpy(GameUI_Footer_TimedString, (const char *)pKeyActionMap->pPressedKeysBuffer); -LABEL_16: - sub_4452BB(); - return; - } - if ( pGUIWindow2->field_40 != 3 ) - return; - pGUIWindow2->field_40 = 0; -LABEL_15: - memset(GameUI_Footer_TimedString, 0, 0xC8u); - goto LABEL_16; - } - if ( pGUIWindow2->ptr_1C == (void *)26 ) - { - sprintf(Str, "%s %s", GameUI_Footer_TimedString, pKeyActionMap->pPressedKeysBuffer); - v3 = pFontLucida->GetLineWidth(Str); - pGUIWindow2->DrawText(pFontLucida, 13, 357, 0, Str, 0, 0, 0); - pGUIWindow2->DrawFlashingInputCursor(v3 + 13, 357, pFontLucida); - return; - } - if ( pKeyActionMap->pPressedKeysBuffer[0] ) - { - pKeyActionMap->_459ED1(0); - goto LABEL_15; - } -} - //----- (004451A8) -------------------------------------------------------- void __fastcall sub_4451A8_press_any_key(int a1, int a2, int a4) { @@ -12524,359 +12204,6 @@ return pNPCTopics[407].pTopic; } -//----- (00445350) -------------------------------------------------------- -void __cdecl DrawDialogueUI() -{ - NPCData *pNPC; // ebx@2 - int pGreetType; // eax@2 - unsigned __int16 v2; // di@2 - //unsigned int v3; // eax@2 - char *v4; // esi@3 - //int v5; // eax@11 - //char *v6; // ecx@13 - //char *v7; // eax@16 - //unsigned int v8; // edi@19 - //char *v9; // ecx@27 - char *v10; // eax@29 - //int v11; // eax@30 - int v12; // esi@39 - char *v13; // eax@41 - GUIButton *v14; // eax@43 - //GUIButton *v15; // edi@43 - signed int v16; // eax@44 - //unsigned int v23; // eax@53 - //const char *v24; // eax@59 - //unsigned __int16 v30; // cx@83 - int v31; // ecx@86 - int v32; // ebx@93 - unsigned int v33; // eax@93 - GUIWindow *v34; // ecx@93 - int v35; // esi@93 - int i; // eax@93 - GUIButton *v37; // eax@94 - int v38; // eax@95 - signed int v39; // esi@99 - signed int v40; // eax@102 - unsigned int v41; // ebx@102 - int v42; // edi@102 - GUIButton *v43; // esi@103 - int v44; // eax@104 - unsigned int v45; // ecx@104 - unsigned __int16 *v46; // edx@104 - unsigned __int16 v47; // ax@104 - GUIWindow pWindow; // [sp+4h] [bp-110h]@39 - int v49; // [sp+Ch] [bp-108h]@39 - int v50; // [sp+14h] [bp-100h]@39 - GUIWindow v51; // [sp+58h] [bp-BCh]@2 - GUIWindow v52; // [sp+ACh] [bp-68h]@42 - char *Str; // [sp+100h] [bp-14h]@104 - //int v54; // [sp+104h] [bp-10h]@2 - //unsigned __int16 *v55; // [sp+108h] [bp-Ch]@82 - GUIFont *pOutString; // [sp+10Ch] [bp-8h]@39 - char *pInString=NULL; // [sp+110h] [bp-4h]@32 - - if ( !pDialogueWindow ) - return; - memcpy(&v51, pDialogueWindow, sizeof(v51)); - pNPC = GetNPCData(sDialogue_SpeakingActorNPC_ID); - pGreetType = GetGreetType(sDialogue_SpeakingActorNPC_ID); - v51.uFrameWidth -= 10; - v51.uFrameZ -= 10; - //v54 = v1; - TargetColor(0xFFu, 0xFFu, 0xFFu); - TargetColor(0xE1u, 0xCDu, 0x23u); - v2 = TargetColor(0x15u, 0x99u, 0xE9u); - pRenderer->DrawTextureIndexed(477, 0, pTexture_Dialogue_Background); - pRenderer->DrawTextureTransparent(468, 0, (Texture *)(uTextureID_right_panel_loop != -1 ? &pIcons_LOD->pTextures[uTextureID_right_panel_loop] : 0)); - pRenderer->DrawTextureIndexed(pNPCPortraits_x[0][0] - 4, pNPCPortraits_y[0][0] - 4, (Texture *)(uTextureID_50795C != -1 ? &pIcons_LOD->pTextures[uTextureID_50795C] : 0)); - pRenderer->DrawTextureIndexed(pNPCPortraits_x[0][0], pNPCPortraits_y[0][0], pDialogueNPCPortraits[0]); - - if (pNPC->uProfession) - { - assert(pNPC->uProfession < sizeof(aNPCProfessionNames) / sizeof(*aNPCProfessionNames)); // sometimes buffer overflows; errors emerge both here and in dialogue text - sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[429], pNPC->pName, aNPCProfessionNames[pNPC->uProfession]);//^Pi[%s] %s - } - else - strcpy(pTmpBuf, pNPC->pName); - - v51.DrawTitleText(pFontArrus, 483, 112, v2, pTmpBuf, 3); - pParty->GetPartyFame(); - - pInString = nullptr; - switch (uDialogueType) - { - case DIALOGUE_13: - pInString = BuilDialogueString(pNPCStats->pProfessions[pNPC->uProfession - 1].pJoinText, uActiveCharacter - 1, 0, 0, 0, 0); - break; - - case DIALOGUE_PROFESSION_DETAILS: - { - auto prof = pNPCStats->pProfessions + pNPC->uProfession - 1; - - if (dialogue_show_profession_details) - pInString = BuilDialogueString(prof->pBenefits, uActiveCharacter - 1, 0, 0, 0, 0); - else if (pNPC->Hired()) - pInString = BuilDialogueString(prof->pDismissText, uActiveCharacter - 1, 0, 0, 0, 0); - else - pInString = BuilDialogueString(prof->pJoinText, uActiveCharacter - 1, 0, 0, 0, 0); - } - break; - - - case DIALOGUE_ARENA_WELCOME: - pInString = pGlobalTXT_LocalizationStrings[574]; // "Welcome to the Arena of Life and Death. Remember, you are only allowed one arena combat per visit. To fight an arena battle, select the option that best describes your abilities and return to me- if you survive:" - break; - - case DIALOGUE_ARENA_FIGHT_NOT_OVER_YET: - pInString = pGlobalTXT_LocalizationStrings[577]; //"Get back in there you wimps:" - break; - - case DIALOGUE_ARENA_REWARD: - sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[576], gold_transaction_amount);// "Congratulations on your win: here's your stuff: %u gold." - pInString = pTmpBuf; - break; - - case DIALOGUE_ARENA_ALREADY_WON: - pInString = pGlobalTXT_LocalizationStrings[582]; // "You already won this trip to the Arena:" - break; - - default: - if (uDialogueType > DIALOGUE_18 && uDialogueType < DIALOGUE_23 && !byte_5B0938[0]) - { - pInString = (char *)current_npc_text; - } - else if (pGreetType == 1)//QuestNPC_greet - { - if (pNPC->greet) - { - if ((pNPC->uFlags & 3) == 2) - pInString = pNPCStats->pNPCGreetings[pNPC->greet - 1].pGreeting2; - else - pInString = pNPCStats->pNPCGreetings[pNPC->greet - 1].pGreeting1; - } - } - else if (pGreetType == 2)//HiredNPC_greet - { - auto prof = pNPCStats->pProfessions + pNPC->uProfession - 1; - - if (pNPC->Hired()) - pInString = BuilDialogueString(prof->pDismissText, uActiveCharacter - 1, 0, 0, 0, 0); - else - pInString = BuilDialogueString(prof->pJoinText, uActiveCharacter - 1, 0, 0, 0, 0); - } - break; - } - - if (pInString) - { - pWindow.uFrameWidth = game_viewport_width; - pWindow.uFrameZ = 452; - auto font = pFontArrus; - v12 = pFontArrus->CalcTextHeight(pInString, &pWindow, 13, 0) + 7; - if ( 352 - v12 < 8 ) - { - font = pFontCreate; - v12 = pFontCreate->CalcTextHeight(pInString, &pWindow, 13, 0) + 7; - } - if (uTextureID_Leather != -1) - pRenderer->_4A6A68(8, 352 - v12, &pIcons_LOD->pTextures[uTextureID_Leather], pIcons_LOD->pTextures[uTextureID_Leather].uTextureHeight - v12); - pRenderer->DrawTextureIndexed(8u, 347 - v12, pTexture_591428); - v13 = FitTextInAWindow(pInString, font, &pWindow, 0xDu, 0); - pDialogueWindow->DrawText(font, 13, 354 - v12, 0, v13, 0, 0, 0); - } - - - memcpy(&v52, pDialogueWindow, sizeof(v52)); - v52.uFrameX = 483; - v52.uFrameWidth = 148; - v52.uFrameZ = 334; - for (int i = v52.pStartingPosActiveItem; - i < v52.pStartingPosActiveItem + v52.pNumPresenceButton; ++i) - { - v14 = v52.GetControl(i); - //v15 = v14; - if ( !v14 ) - break; - v16 = v14->msg_param; - - if ( v16 > 88 ) - v14->pButtonName[0] = 0; - else if (v16 == 88) - strcpy(v14->pButtonName, pGlobalTXT_LocalizationStrings[581]); // Lord - else if (v16 == 87) - strcpy(v14->pButtonName, pGlobalTXT_LocalizationStrings[580]); // Knight - else if (v16 == 86) - strcpy(v14->pButtonName, pGlobalTXT_LocalizationStrings[579]); // Squire - else if (v16 == 85) - strcpy(v14->pButtonName, pGlobalTXT_LocalizationStrings[578]); // Page - else if (v16 == 77) - strcpy(v14->pButtonName, pGlobalTXT_LocalizationStrings[407]); // Details - else if (v16 == 76) - { - if (pNPC->Hired()) - sprintf(v14->pButtonName, (const char*)pGlobalTXT_LocalizationStrings[408], pNPC->pName); // Release %s - else - strcpy(v14->pButtonName, pGlobalTXT_LocalizationStrings[406]); // Hire - } - else if (v16 == 24) - { - __debugbreak(); // learn conditions of this event - auto topic = pNPCTopics[pNPC->evt_F - 1].pTopic;//(&dword_721660)[8 * v23]; - if (!topic) - { - v14->pButtonName[0] = 0; - v14->msg_param = 0; - } - else - strcpy(v14->pButtonName, topic); - } - else if (v16 == 9) - strcpy(v14->pButtonName, GetProfessionActionText(pNPC->uProfession)); - else if (v16 == 19) - { - // __debugbreak(); // learn conditions of this event Scavenger Hunt - auto topic = pNPCTopics[pNPC->evt_A - 1].pTopic;//(&dword_721660)[8 * v23]; - if (!topic) - { - v14->pButtonName[0] = 0; - v14->msg_param = 0; - } - else strcpy(v14->pButtonName, topic); - } - else if (v16 == 20) - { - //__debugbreak(); // learn conditions of this event instruments - auto topic = pNPCTopics[pNPC->evt_B - 1].pTopic;//(&dword_721660)[8 * v23]; - if (!topic) - { - v14->pButtonName[0] = 0; - v14->msg_param = 0; - } - else strcpy(v14->pButtonName, topic); - } - else if (v16 == 21) - { - //__debugbreak(); // learn conditions of this event - auto topic = pNPCTopics[pNPC->evt_C - 1].pTopic;//(&dword_721660)[8 * v23]; - if (!topic) - { - v14->pButtonName[0] = 0; - v14->msg_param = 0; - } - else strcpy(v14->pButtonName, topic); - } - else if (v16 == 22) - { - //__debugbreak(); // learn conditions of this event - auto topic = pNPCTopics[pNPC->evt_D - 1].pTopic;//(&dword_721660)[8 * v23]; - if (!topic) - { - v14->pButtonName[0] = 0; - v14->msg_param = 0; - } - else strcpy(v14->pButtonName, topic); - } - else if (v16 == 23) - { - //__debugbreak(); // learn conditions of this event - auto topic = pNPCTopics[pNPC->evt_E - 1].pTopic;//(&dword_721660)[8 * v23]; - if (!topic) - { - v14->pButtonName[0] = 0; - v14->msg_param = 0; - } - else strcpy(v14->pButtonName, topic); - } - else if (v16 == 13) - { - if (pNPC->Hired()) - sprintf(v14->pButtonName, pGlobalTXT_LocalizationStrings[408], pNPC->pName); // Release %s - else - strcpy(v14->pButtonName, pGlobalTXT_LocalizationStrings[122]); // Join - } - else - v14->pButtonName[0] = 0; - - - if (pParty->field_7B5_in_arena_quest && pParty->field_7B5_in_arena_quest != -1) - { - int num_dead_actors = 0; - pInString = 0; - for (uint i = 0; i < uNumActors; ++i) - { - if (pActors[i].uAIState == Dead || pActors[i].uAIState == Removed || - pActors[i].uAIState == Disabled) - ++num_dead_actors; - else - { - int sumonner_type = PID_TYPE(pActors[i].uSummonerID); - if (sumonner_type == OBJECT_Player) - ++num_dead_actors; - } - } - if (num_dead_actors == uNumActors) - strcpy(v14->pButtonName, pGlobalTXT_LocalizationStrings[658]); // Collect Prize - } - } - - - v32 = 0; - //pInString = (char *)TargetColor(0xFFu, 0xFFu, 0xFFu); - v33 = TargetColor(0xE1u, 0xCDu, 0x23u); - v34 = pDialogueWindow; - //v54 = v33; - v35 = pDialogueWindow->pStartingPosActiveItem; - for ( i = v35 + pDialogueWindow->pNumPresenceButton; v35 < i; i = pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem ) - { - v37 = v34->GetControl(v35); - if ( !v37 ) - { - v34 = pDialogueWindow; - break; - } - v38 = pFontArrus->CalcTextHeight(v37->pButtonName, &v52, 0, 0); - v34 = pDialogueWindow; - v32 += v38; - ++v35; - } - v39 = v34->pNumPresenceButton; - if ( v39 ) - { - pOutString = (GUIFont *)((174 - v32) / v39); - if ( (174 - v32) / v39 > 32 ) - pOutString = (GUIFont *)32; - int v55 = 1; - v40 = 174 - (int)pOutString * v39 - v32; - v41 = v34->pStartingPosActiveItem; - v42 = v40 / 2 - (signed int)pOutString / 2 + 138; - if ( (signed int)v41 < (signed int)(v41 + v39) ) - { - do - { - v43 = v34->GetControl(v41); - if ( !v43 ) - break; - v43->uY = (unsigned int)((char *)pOutString + v42); - Str = v43->pButtonName; - v44 = pFontArrus->CalcTextHeight(v43->pButtonName, &v52, 0, 0); - v45 = v43->uY; - v46 = (unsigned short *)v55; - v43->uHeight = v44; - v42 = v45 + v44 - 1; - v43->uW = v42; - v47 = v33; - if ( (unsigned __int16 *)pDialogueWindow->pCurrentPosActiveItem != v46 ) - v47 = TargetColor(0xFFu, 0xFFu, 0xFFu); - v52.DrawTitleText(pFontArrus, 0, v45, v47, Str, 3u); - v34 = pDialogueWindow; - ++v55; - ++v41; - } - while ( (signed int)v41 < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem ); - } - } - pRenderer->DrawTextureIndexed(471, 445, pIcons_LOD->GetTexture(uExitCancelTextureId)); -} //----- (00445C8B) -------------------------------------------------------- int __fastcall GetGreetType(signed int SpeakingNPC_ID) @@ -14429,13 +13756,8 @@ _5B65A8_npcdata_uflags_or_other = 0; } } -// 5B65A8: using guessed type int _5B65A8_npcdata_uflags_or_other; -// 5B65AC: using guessed type int _5B65AC_npcdata_fame_or_other; -// 5B65B0: using guessed type int _5B65B0_npcdata_rep_or_other; -// 5B65B4: using guessed type int _5B65B4_npcdata_loword_house_or_other; -// 5B65B8: using guessed type int _5B65B8_npcdata_hiword_house_or_other; -// 5B65BC: using guessed type int dword_5B65BC; -// 5B65C0: using guessed type int dword_5B65C0; + + //----- (00449A49) -------------------------------------------------------- __int16 __fastcall sub_449A49_door_switch_animation(unsigned int uDoorID, int a2) @@ -14532,7 +13854,7 @@ //----- (00449B57) -------------------------------------------------------- bool _449B57_test_bit( unsigned __int8 *a1, __int16 a2 ) - { +{ return a1[(a2 - 1) >> 3] & (0x80u >> (a2 - 1) % 8); } @@ -14550,23 +13872,6 @@ pArray[v3 / 8] &= ~set_bit; } -//----- (0044A56A) -------------------------------------------------------- -void __cdecl Party__CountHirelings() -{ - pParty->field_70A = 0; - - for (int i = 0; i < pNPCStats->uNumNewNPCs; ++i) - { - auto npc = pNPCStats->pNewNPCData + i; - if (npc->Hired() && - (!pParty->pHirelings[0].pName || strcmp(npc->pName, pParty->pHirelings[0].pName))) - { - if (!pParty->pHirelings[1].pName || strcmp(npc->pName, pParty->pHirelings[1].pName)) - ++pParty->field_70A; - } - } -} - //----- (0044C175) -------------------------------------------------------- void __fastcall ShowStatusBarString(const char *pString, unsigned int uNumSeconds) { @@ -14583,7 +13888,7 @@ } //----- (0044C1D0) -------------------------------------------------------- -void __cdecl ShowNothingHereStatus() +void ShowNothingHereStatus() { if ( !GameUI_Footer_TimeLeft ) ShowStatusBarString(pGlobalTXT_LocalizationStrings[521], 2u);// Nothing here @@ -14621,20 +13926,27 @@ //----- (0044C2F4) -------------------------------------------------------- int LevelDecoration::IsInteractive() { - signed int v1; // eax@1 - - v1 = this->uDecorationDescID; - if ( v1 > 34 ) - { - if ( v1 == 184 || v1 == 187 || v1 == 190 || v1 > 205 && v1 <= 221 ) - return 1; - } - else - { - if ( v1 == 34 || v1 >= 4 && (v1 <= 6 || v1 == 11 || v1 > 12 && (v1 <= 14 || v1 == 24)) ) - return 1; - } - return 0; + switch (uDecorationDescID) + { + case 4: // trash pile + case 5: // campfire + case 6: // cauldron + case 11: // fruit plate + case 13: // trash pile + case 14: // dirt + case 24: // keg + case 184: // fire + case 187: // fire + case 190: // fire + return true; + } + + if (uDecorationDescID >= 206 && uDecorationDescID <= 209) // lighthouse fire + return true; + if (uDecorationDescID >= 210 && uDecorationDescID <= 221) // magic pedistal + return true; + + return false; } //----- (0044C362) -------------------------------------------------------- @@ -14655,6 +13967,7 @@ float v13; // ST14_4@1 double v14; // ST0C_8@1 + assert(false); //v1 = this; v2 = (double)this->x * 0.000015258789; v3 = v2; @@ -15239,7 +14552,7 @@ { pPlayer = *v8; if ( !(*v8)->pConditions[14] && !pPlayer->pConditions[15] && !pPlayer->pConditions[16] ) - pPlayer->ReceiveDamage(v4, 5); + pPlayer->ReceiveDamage(v4, DMGT_5); ++v8; } while ( (signed int)v8 <= (signed int)&pPlayers[4] );
--- a/mm7_4.cpp Thu May 23 11:16:46 2013 +0600 +++ b/mm7_4.cpp Thu May 23 11:17:01 2013 +0600 @@ -2245,7 +2245,7 @@ } //----- (00494035) -------------------------------------------------------- -void __cdecl _494035_timed_effects__water_walking_damage__etc() +void _494035_timed_effects__water_walking_damage__etc() { signed __int64 v0; // qax@1 signed __int64 v1; // ST30_8@1 @@ -2395,7 +2395,7 @@ { v14 = pPlayers[v12]; v15 = (double)pPlayers[v12]->GetMaxHealth() * 0.1; - v14->ReceiveDamage((signed __int64)v15, 0); + v14->ReceiveDamage((signed __int64)v15, DMGT_FIRE); if ( pParty->uFlags & 4 ) { strcpy(GameUI_Footer_TimedString, pGlobalTXT_LocalizationStrings[660]); @@ -2424,7 +2424,7 @@ { v17 = *v16; v18 = (double)(*v16)->GetMaxHealth() * 0.1; - v17->ReceiveDamage((signed __int64)v18, 0); + v17->ReceiveDamage((signed __int64)v18, DMGT_FIRE); if ( pParty->uFlags & 0x200 ) { strcpy(GameUI_Footer_TimedString, pGlobalTXT_LocalizationStrings[661]); @@ -6680,7 +6680,7 @@ //LOBYTE(v2->uFlags) |= 0x80u; pCurrentNPCInfo->uFlags |= 128; pParty->field_709 = 0; - Party__CountHirelings(); + pParty->CountHirelings(); if ( pParty->pHirelings[0].pName ) { memcpy(&pParty->pHirelings[1], pCurrentNPCInfo, sizeof(pParty->pHirelings[1])); @@ -6695,7 +6695,7 @@ } strcpy(v22, v24); pParty->field_709 = 0; - Party__CountHirelings(); + pParty->CountHirelings(); PrepareHouse((HOUSE_ID)(int)window_SpeakInHouse->ptr_1C); dialog_menu_id = HOUSE_DIALOGUE_MAIN; @@ -7288,8 +7288,8 @@ v30 = TargetColor(0xFFu, 0xFFu, 0xFFu); v31 = *(int *)v29; v32 = TargetColor(0xFFu, 0xFFu, 0x9Bu); - sprintf(pTmpBuf, &byte_4F0F98, v32, v31, v30); - sprintf(pTmpBuf2, dword_F8B1A4, pTmpBuf, 100 * (unsigned __int8)v29[8]); + sprintfex(pTmpBuf, "\f%05d%s\f%05d", v32, v31, v30); + sprintfex(pTmpBuf2, dword_F8B1A4, pTmpBuf, 100 * (unsigned __int8)v29[8]); current_npc_text = pTmpBuf2; v15 = ""; goto LABEL_45; @@ -7979,7 +7979,7 @@ memset(v11, 0, sizeof(NPCData)); } pParty->field_709 = 0; - Party__CountHirelings(); + pParty->CountHirelings(); dword_591084 = 0; pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); dword_7241C8 = 0; @@ -8027,7 +8027,7 @@ } strcpy(v13, v15); pParty->field_709 = 0; - Party__CountHirelings(); + pParty->CountHirelings(); pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); @@ -8090,7 +8090,7 @@ memset(v11, 0, sizeof(NPCData)); } pParty->field_709 = 0; - Party__CountHirelings(); + pParty->CountHirelings(); dword_591084 = 0; pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); dword_7241C8 = 0; @@ -8960,107 +8960,3 @@ return result; } - -//----- (00444839) -------------------------------------------------------- -unsigned int __fastcall sub_444839_move_map(unsigned int a1, int a2, int x, int y, int z, int directiony, int directionx, int a8, const char *pLocationName) -{ - unsigned int v9; // ebx@1 - int v10; // edi@1 - //signed int v11; // eax@1 - unsigned int v12; // eax@6 - const char *v13; // ST0C_4@6 - unsigned int v14; // eax@8 - const char *v15; // eax@14 - unsigned int v16; // eax@16 - unsigned int result; // eax@26 - const char *v18; // [sp-8h] [bp-40h]@9 - //const char *v19; // [sp-4h] [bp-3Ch]@2 - char *v20; // [sp-4h] [bp-3Ch]@9 - const char *v21; // [sp-4h] [bp-3Ch]@11 - char pContainer[40]; // [sp+Ch] [bp-2Ch]@1 - unsigned int v23; // [sp+34h] [bp-4h]@1 - - v9 = a1; - v10 = a2; - v23 = IndoorLocation::GetLocationIndex(pLocationName); - dword_59117C_teleportx = x; - dword_591178_teleporty = y; - dword_591174_teleportz = z; - dword_591170_teleport_directiony = directiony; - dword_59116C_teleport_directionx = directionx; - dword_591168_teleport_speedz = a8; - dword_591164_teleport_map_name = (char *)pLocationName; - uCurrentHouse_Animation = v9; - pEventTimer->Pause(); - pAudioPlayer->StopChannels(-1, -1); - - switch (pParty->alignment) - { - case PartyAlignment_Good: sprintf(pContainer, "evt%02d-b", const_2()); break; - case PartyAlignment_Neutral: sprintf(pContainer, "evt%02d", const_2()); break; - case PartyAlignment_Evil: sprintf(pContainer, "evt%02d-c", const_2()); break; - default: assert(false); - } - /*v11 = const_2(); - sprintf(pContainer, "evt%02d", v11); - if ( pParty->uAlignment ) - { - if ( pParty->uAlignment != 2 ) - goto LABEL_6; - v19 = "-c"; - } - else - { - v19 = "-b"; - } - strcat(pContainer, v19);*/ - -//LABEL_6: - v12 = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); - v13 = pHouse_ExitPictures[v10]; - pTexture_Dialogue_Background = &pIcons_LOD->pTextures[v12]; - pTexture_outside = pIcons_LOD->LoadTexturePtr(v13, TEXTURE_16BIT_PALETTE); - if ( v9 ) - { - if ( !v23 ) - //pVideoPlayer->OpenHouseMovie(pAnimatedRooms[p2DEvents_minus1___02[26 * v9]].field_0, 1u); - pVideoPlayer->OpenHouseMovie(pAnimatedRooms[p2DEvents[v9 - 1].uAnimationID].video_name, 1u); - } - else - { - if ( !v23 ) - { - v14 = pMapStats->GetMapInfo(pCurrentMapName); - if ( v14 ) - { - sprintfex(sHouseName, pGlobalTXT_LocalizationStrings[410], pMapStats->pInfos[v14].pName); - goto LABEL_20; - } - v21 = pGlobalTXT_LocalizationStrings[79]; - goto LABEL_19; - } - } - v15 = pLocationName; - if ( *pLocationName == 48 ) - v15 = pCurrentMapName; - v16 = pMapStats->GetMapInfo(v15); - if ( v16 ) - { - sprintfex(sHouseName, pGlobalTXT_LocalizationStrings[411], pMapStats->pInfos[v16].pName); - goto LABEL_20; - } - v21 = pGlobalTXT_LocalizationStrings[73]; -LABEL_19: - strcpy(sHouseName, v21); -LABEL_20: - pDialogueWindow = GUIWindow::Create(0, 0, 640, 480, WINDOW_Transition, 0, (int)sHouseName); - //if ( BYTE1(pAnimatedRooms[p2DEvents_minus1___02[26 * v9]].field_C) ) - if ( pAnimatedRooms[p2DEvents[v9 - 1].uAnimationID].uRoomSoundId ) - PlayHouseSound(v9, HouseSound_Greeting); - if ( uCurrentlyLoadedLevelType == LEVEL_Indoor && uActiveCharacter && pParty->uFlags & 0x30 ) - pPlayers[uActiveCharacter]->PlaySound(SPEECH_47, 0); - result = v23; - if ( v23 ) - uCurrentHouse_Animation = v23; - return result; -}
--- a/mm7_5.cpp Thu May 23 11:16:46 2013 +0600 +++ b/mm7_5.cpp Thu May 23 11:17:01 2013 +0600 @@ -275,7 +275,7 @@ memset(&actor, 0, 0x344u); dword_5B65D0_dialogue_actor_npc_id = bDialogueUI_InitializeActor_NPC_ID; actor.sNPC_ID = bDialogueUI_InitializeActor_NPC_ID; - actor.InitializeDialogue(0); + GameUI_InitializeDialogue(&actor, false); bDialogueUI_InitializeActor_NPC_ID = 0; } if ( pMessageQueue_50CBD0->uNumMessages ) @@ -306,7 +306,7 @@ dword_5B65D0_dialogue_actor_npc_id = pActors[uMessageParam].sNPC_ID; pActor = &pActors[uMessageParam]; //goto _actor_init_dlg; - pActor->InitializeDialogue(1); + GameUI_InitializeDialogue(pActor, true); continue; case UIMSG_StartHireling1Dialogue: case UIMSG_StartHireling2Dialogue: @@ -359,7 +359,7 @@ memset(&actor, 0, 0x344u); actor.sNPC_ID += -1 - (unsigned __int8)pParty->field_709 - hireling_idx; pActor = &actor; - pActor->InitializeDialogue(1); + GameUI_InitializeDialogue(&actor, true); } } continue; @@ -406,7 +406,7 @@ pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; pGUIWindow_CurrentMenu->Release(); pCurrentScreen = SCREEN_LOADGAME; - GameUI_DrawLoadMenu(1); + LoadUI_Load(1); continue; case UIMSG_Quit: if ( dword_6BE138 == 132 || uMessageParam ) @@ -457,8 +457,8 @@ GUIWindow::Create(241, 302, 106, 42, WINDOW_SaveLoadBtn, (int)pBtnLoadSlot, 0); continue; case UIMSG_SelectLoadSlot: - if ( pGUIWindow_CurrentMenu->field_40 == 1 ) - pKeyActionMap->_459ED1(0); + if ( pGUIWindow_CurrentMenu->receives_keyboard_input_2 == WINDOW_INPUT_IN_PROGRESS) + pKeyActionMap->SetWindowInputStatus(WINDOW_INPUT_NONE); if ( pCurrentScreen != SCREEN_SAVEGAME || uLoadGameUI_SelectedSlot != pSaveListPosition + uMessageParam ) { v10 = pSaveListPosition + uMessageParam; @@ -466,23 +466,6 @@ { pMessageQueue_50CBD0->AddMessage(UIMSG_SaveLoadBtn, 0, 0); pMessageQueue_50CBD0->AddMessage(UIMSG_LoadGame, 0, 0); - /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) - { - pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_SaveLoadBtn; - pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; - *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; - //v11 = pMessageQueue_50CBD0->uNumMessages + 1; - //v13 = pMessageQueue_50CBD0->uNumMessages + 1 > 40; - //v12 = (signed int)pMessageQueue_50CBD0->uNumMessages - 39 < 0; - ++pMessageQueue_50CBD0->uNumMessages; - if ( v12 ^ v13 ) - { - pMessageQueue_50CBD0->pMessages[v11].eType = UIMSG_LoadGame; - pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; - *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; - ++pMessageQueue_50CBD0->uNumMessages; - } - }*/ } uLoadGameUI_SelectedSlot = v10; dword_6BE138 = v10; @@ -504,9 +487,9 @@ stru_506E40.Release(); continue; case UIMSG_SaveGame: - if ( pGUIWindow_CurrentMenu->field_40 == 1 ) - { - pKeyActionMap->_459ED1(0); + if ( pGUIWindow_CurrentMenu->receives_keyboard_input_2 == WINDOW_INPUT_IN_PROGRESS) + { + pKeyActionMap->SetWindowInputStatus(WINDOW_INPUT_NONE); strcpy((char *)&pSavegameHeader[uLoadGameUI_SelectedSlot], (const char *)pKeyActionMap->pPressedKeysBuffer); } DoSavegame(uLoadGameUI_SelectedSlot); @@ -515,7 +498,7 @@ case UIMSG_Game_OpenSaveGameDialog: pGUIWindow_CurrentMenu->Release(); pCurrentScreen = SCREEN_SAVEGAME; - GameUI_DrawSaveMenu(); + SaveUI_Load(); continue; case UIMSG_Game_OpenOptionsDialog://Open if ( pMessageQueue_50CBD0->uNumMessages ) @@ -624,16 +607,16 @@ pGUIWindow_CurrentMenu->CreateButton(350u, 224u, 70u, 0x13u, 1, 0, UIMSG_ChangeKeyButton, 0xBu, 0, "", 0); pGUIWindow_CurrentMenu->CreateButton(350u, 243u, 70u, 0x13u, 1, 0, UIMSG_ChangeKeyButton, 0xCu, 0, "", 0); pGUIWindow_CurrentMenu->CreateButton(350u, 262u, 70u, 0x13u, 1, 0, UIMSG_ChangeKeyButton, 0xDu, 0, "", 0); - dword_506E68 = -1; + uGameMenuUI_CurentlySelectedKeyIdx = -1; KeyboardPageNum = 1; - memset(KeyButtonFlagChangesArray, 0, sizeof(KeyButtonFlagChangesArray)); + memset(GameMenuUI_InvaligKeyBindingsFlags, 0, sizeof(GameMenuUI_InvaligKeyBindingsFlags)); //*(_WORD *)KeyButtonArray[28] = 0; memcpy(pPrevVirtualCidesMapping, pKeyActionMap->pVirtualKeyCodesMapping, 0x78u); //v1 = ""; //v0 = 1; continue; case UIMSG_ChangeKeyButton: - if ( dword_506E68 != -1 ) + if ( uGameMenuUI_CurentlySelectedKeyIdx != -1 ) { pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); continue; @@ -641,7 +624,7 @@ v14 = uMessageParam; if ( KeyboardPageNum != 1 ) v14 = uMessageParam + 14; - dword_506E68 = v14; + uGameMenuUI_CurentlySelectedKeyIdx = v14; pKeyActionMap->EnterText(0, 1, pGUIWindow_CurrentMenu); continue; case UIMSG_ResetKeyMapping: @@ -669,7 +652,7 @@ v18 = uAction++; v13 = uAction > 28; v12 = uAction - 28 < 0; - KeyButtonFlagChangesArray[v18] = 0; + GameMenuUI_InvaligKeyBindingsFlags[v18] = 0; } while ( v12 ^ v13 ); pAudioPlayer->PlaySound((SoundID)219, 0, 0, -1, 0, 0, 0, 0); @@ -1199,22 +1182,25 @@ WriteWindowsRegistryInt("GammaPos", uGammaPos); stru_506E40.Release(); break; + case SCREEN_KEYBOARD_OPTIONS://Return to game v197 = 1; v32 = 0; - while ( KeyButtonFlagChangesArray[v32] != 1 ) + while ( !GameMenuUI_InvaligKeyBindingsFlags[v32]) { ++v32; if ( v32 >= 28 ) { thisb = (signed int)&uTextureID_Optkb; + assert(false && "Invalid condition values"); do { if ( *(int *)thisb ) pIcons_LOD->pTextures[*(int *)thisb].Release(); thisb += 4; } - while ( thisb < (signed int)&dword_507C08 ); + while ( thisb < (signed int)0x00507C08 ); + memset(&uTextureID_Optkb, 0, 0x14u); pIcons_LOD->SyncLoadedFilesCount(); uAction = 0; @@ -1341,7 +1327,7 @@ pGUIWindow_CurrentMenu = 0; pEventTimer->Resume(); pCurrentScreen = SCREEN_GAME; - viewparams->bRedrawGameUI = 1; + viewparams->bRedrawGameUI = true; pIcons_LOD->_4355F7(); continue; case SCREEN_INPUT_BLV://click escape @@ -1352,34 +1338,34 @@ { pParty->field_709 = 0; LOBYTE(pNPCStats->pNewNPCData[dword_5B65CC].uFlags) &= 0x7Fu; - Party__CountHirelings(); - viewparams->bRedrawGameUI = 1; + pParty->CountHirelings(); + viewparams->bRedrawGameUI = true; dword_5B65CC = 0; } DialogueEnding(); pCurrentScreen = SCREEN_GAME; - viewparams->bRedrawGameUI = 1; + viewparams->bRedrawGameUI = true; continue; case SCREEN_NPC_DIALOGUE://click escape if ( dword_5B65CC ) { pParty->field_709 = 0; LOBYTE(pNPCStats->pNewNPCData[dword_5B65CC].uFlags) &= 0x7Fu; - Party__CountHirelings(); - viewparams->bRedrawGameUI = 1; + pParty->CountHirelings(); + viewparams->bRedrawGameUI = true; dword_5B65CC = 0; } //goto LABEL_317; DialogueEnding(); pCurrentScreen = SCREEN_GAME; - viewparams->bRedrawGameUI = 1; + viewparams->bRedrawGameUI = true; continue; case SCREEN_BRANCHLESS_NPC_DIALOG://click escape memset(GameUI_Footer_TimedString, 0, 0xC8u); sub_4452BB(); DialogueEnding(); pCurrentScreen = SCREEN_GAME; - viewparams->bRedrawGameUI = 1; + viewparams->bRedrawGameUI = true; continue; case SCREEN_CHANGE_LOCATION://click escape if ( pParty->vPosition.x < -22528 ) @@ -1392,7 +1378,7 @@ pParty->vPosition.y = 22528; DialogueEnding(); pCurrentScreen = SCREEN_GAME; - viewparams->bRedrawGameUI = 1; + viewparams->bRedrawGameUI = true; continue; case SCREEN_VIDEO: pVideoPlayer->Unload(); @@ -1425,7 +1411,7 @@ pGUIWindow_CurrentMenu = 0; pEventTimer->Resume(); pCurrentScreen = SCREEN_GAME; - viewparams->bRedrawGameUI = 1; + viewparams->bRedrawGameUI = true; pIcons_LOD->_4355F7(); continue; default: @@ -1481,7 +1467,7 @@ pGUIWindow_CurrentMenu = 0; pEventTimer->Resume(); pCurrentScreen = SCREEN_GAME; - viewparams->bRedrawGameUI = 1; + viewparams->bRedrawGameUI = true; pIcons_LOD->_4355F7(); continue; } @@ -1513,7 +1499,7 @@ pGUIWindow_CurrentMenu = 0; pEventTimer->Resume(); pCurrentScreen = SCREEN_GAME; - viewparams->bRedrawGameUI = 1; + viewparams->bRedrawGameUI = true; pIcons_LOD->_4355F7(); continue; } @@ -1523,10 +1509,12 @@ GUIWindow::Create(0x25Au, 0x1C2u, 0, 0, WINDOW_PressedButton2, (int)pBtn_GameSettings, 1); pEventTimer->Pause(); pAudioPlayer->StopChannels(-1, -1); + pCurrentScreen = SCREEN_MENU; + ++pIcons_LOD->uTexturePacksCount; - pCurrentScreen = 1; if ( !pIcons_LOD->uNumPrevLoadedFiles ) pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles; + pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_OptionsButtons, 0, 0); uTextureID_Options = pIcons_LOD->LoadTexture("options", TEXTURE_16BIT_PALETTE); uTextureID_New1 = pIcons_LOD->LoadTexture("new1", TEXTURE_16BIT_PALETTE); @@ -1662,12 +1650,12 @@ pVideoPlayer->Unload(); DialogueEnding(); start_event_seq_number = 0; - viewparams->bRedrawGameUI = 1; + viewparams->bRedrawGameUI = true; continue; case UIMSG_CycleCharacters: v39 = GetAsyncKeyState(VK_SHIFT); uActiveCharacter = CycleCharacter(v39); - viewparams->bRedrawGameUI = 1; + viewparams->bRedrawGameUI = true; continue; case UIMSG_OnTravelByFoot: if ( pMessageQueue_50CBD0->uNumMessages ) @@ -2490,7 +2478,7 @@ continue; case UIMSG_RentRoom: dword_506F14 = 2; - RestUI_Initialize(); + RestUI_Load(); v86 = 60 * (_494820_training_time(pParty->uCurrentHour) + 1) - pParty->uCurrentMinute; _506F18_num_hours_to_sleep = v86; if ( uMessageParam == 111 || uMessageParam == 114 || uMessageParam == 116 ) @@ -2531,7 +2519,7 @@ } if ( !(pParty->uFlags & 0x88) ) { - RestUI_Initialize(); + RestUI_Load(); continue; } if ( pParty->bTurnBasedModeOn == 1 ) @@ -3459,8 +3447,8 @@ break; case UIMSG_SelectLoadSlot: //main menu save/load wnd clicking on savegame lines - if (pGUIWindow_CurrentMenu->field_40 == 1) - pKeyActionMap->_459ED1(0); + if (pGUIWindow_CurrentMenu->receives_keyboard_input_2 == WINDOW_INPUT_IN_PROGRESS) + pKeyActionMap->SetWindowInputStatus(WINDOW_INPUT_NONE); if ( pCurrentScreen != SCREEN_SAVEGAME || uLoadGameUI_SelectedSlot != pParam + pSaveListPosition ) { //load clicked line @@ -4755,7 +4743,7 @@ && (SHIDWORD(pMonster->pActorBuffs[20].uExpireTime) > (signed int)v41 || LODWORD(pMonster->pActorBuffs[20].uExpireTime) > v41) && uDamageAmount != v41 ) - player->ReceiveDamage(uDamageAmount, a2); + player->ReceiveDamage(uDamageAmount, (DAMAGE_TYPE)a2); v50 = 24; v59 = 20 * v61 / (signed int)pMonster->pMonsterInfo.uHP; if ( (player->_48EA46_calc_special_bonus_by_items(24) || hit_will_stun != v41) @@ -5007,7 +4995,7 @@ LABEL_43: if ( !(dword_6BE368_debug_settings_2 & 0x10) ) { - v24 = v6->ReceiveDamage(v77, v22); + v24 = v6->ReceiveDamage(v77, (DAMAGE_TYPE)v22); if ( SHIDWORD(v6->pPlayerBuffs[10].uExpireTime) >= 0 && (SHIDWORD(v6->pPlayerBuffs[10].uExpireTime) > 0 || LODWORD(v6->pPlayerBuffs[10].uExpireTime)) ) { @@ -5070,7 +5058,7 @@ if ( !pParty->bTurnBasedModeOn ) { v35 = v6->GetActualEndurance(); - v36 = (double)(20 - v6->_48EA1B_get_static_effect(v35)) * flt_6BE3A4_debug_recmod1 * 2.133333333333333; + v36 = (double)(20 - v6->GetParameterBonus(v35)) * flt_6BE3A4_debug_recmod1 * 2.133333333333333; v6->SetRecoveryTime((signed __int64)v36); } if ( v77 ) @@ -5192,7 +5180,7 @@ LABEL_133: if ( !(dword_6BE368_debug_settings_2 & 0x10) ) { - v54 = v45->ReceiveDamage(v77, v50); + v54 = v45->ReceiveDamage(v77, (DAMAGE_TYPE)v50); if ( SHIDWORD(v45->pPlayerBuffs[10].uExpireTime) >= 0 ) { if ( SHIDWORD(v45->pPlayerBuffs[10].uExpireTime) > 0 || LODWORD(v45->pPlayerBuffs[10].uExpireTime) ) @@ -5258,7 +5246,7 @@ if ( !pParty->bTurnBasedModeOn ) { v65 = v45->GetActualEndurance(); - v66 = (double)(20 - v45->_48EA1B_get_static_effect(v65)) + v66 = (double)(20 - v45->GetParameterBonus(v65)) * flt_6BE3A4_debug_recmod1 * 2.133333333333333; v45->SetRecoveryTime((signed __int64)v66); @@ -5289,7 +5277,7 @@ v68 = pParty->pPlayers[uActorID].CalculateRangedDamageTo(0); v69 = 0; } - a4b->ReceiveDamage(v68, v69); + a4b->ReceiveDamage(v68, (DAMAGE_TYPE)v69); if ( v38 == OBJECT_Player && !qword_A750D8 ) { qword_A750D8 = 256i64; @@ -5399,10 +5387,7 @@ } else { - result = (flt_4E4A80[v2] - *(float *)&aAuthenticamd[4 * v2 + 12]) - * (v3 - flt_4E4A80[v2 + 4]) - / (flt_4E4A80[v2 + 5] - flt_4E4A80[v2 + 4]) - + flt_4E4A80[v2]; + result = (flt_4E4A80[v2] - flt_4E4A80[v2 - 3]) * (v3 - flt_4E4A80[v2 + 4]) / (flt_4E4A80[v2 + 5] - flt_4E4A80[v2 + 4]) + flt_4E4A80[v2]; } return result; } @@ -9751,149 +9736,6 @@ } -//----- (00411150) -------------------------------------------------------- -void DrawTownPortalScreen() -{ - //signed int v0; // edi@1 - //__int16 v1; // dx@8 - //POINT *v2; // edi@17 - int v3; // edi@17 - //__int16 v4; // dx@24 - GUIWindow v6; // [sp+Ch] [bp-64h]@1 - //POINT v7; // [sp+60h] [bp-10h]@17 - POINT a2; // [sp+68h] [bp-8h]@17 - - pRenderer->ClearZBuffer(0, 479); - pRenderer->DrawTextureTransparent(8, 8, pTexture_CurrentBook); - pRenderer->DrawTextureTransparent(471, 445, pIcons_LOD->GetTexture(uExitCancelTextureId)); - - v6.uFrameX = game_viewport_x; - v6.uFrameY = game_viewport_y; - v6.uFrameWidth = game_viewport_width; - v6.uFrameHeight = game_viewport_height; - v6.uFrameZ = game_viewport_z; - v6.uFrameW = game_viewport_w; - - const uint fountain_bits_lut[] = {PARTY_QUEST_FOUNTAIN_HARMONDALE, - PARTY_QUEST_FOUNTAIN_PIERPONT, - PARTY_QUEST_FOUNTAIN_NIGHON, - PARTY_QUEST_FOUNTAIN_EVENMORN_ISLE, - PARTY_QUEST_FOUNTAIN_CELESTIA, - PARTY_QUEST_FOUNTAIN_THE_PIT}; - for (uint i = 0; i < 6; ++i) - { - - if (_449B57_test_bit(pParty->_quest_bits, fountain_bits_lut[i])) - pRenderer->DrawMaskToZBuffer(pTownPortalBook_xs[i], - pTownPortalBook_ys[i], - pTexture_TownPortalIcons[i], i + 1); - } - -/* v0 = 0; - do - { - if ( !v0 ) - { - v1 = 206; -LABEL_14: - if ( !(unsigned __int16)_449B57_test_bit(pParty->_quest_bits, v1) ) - goto LABEL_16; - goto LABEL_15; - } - if ( v0 == 1 ) - { - v1 = 208; - goto LABEL_14; - } - if ( v0 == 2 ) - { - v1 = 207; - goto LABEL_14; - } - if ( v0 == 3 ) - { - v1 = 211; - goto LABEL_14; - } - if ( v0 == 4 ) - { - v1 = 209; - goto LABEL_14; - } - if ( v0 == 5 ) - { - v1 = 210; - goto LABEL_14; - } -LABEL_15: - pRenderer->DrawMaskToZBuffer( - pTownPortalBook_xs[v0], - pTownPortalBook_ys[v0], - *(&pTexture_TownPortalHarmn + v0), - v0 + 1); -LABEL_16: - ++v0; - } - while ( v0 < 6 );*/ - - pMouse->GetCursorPos(&a2); - //v2 = pMouse->GetCursorPos(&a2); - v3 = pRenderer->pActiveZBuffer[a2.x + pSRZBufferLineOffsets[a2.y]] & 0xFFFF; - - if (v3) - { - if (_449B57_test_bit(pParty->_quest_bits, fountain_bits_lut[v3 - 1])) - pRenderer->DrawTextureIndexed(pTownPortalBook_xs[v3 - 1], pTownPortalBook_ys[v3 - 1], pTexture_TownPortalIcons[v3 - 1]); - } - v6.DrawTitleText(pBook2Font, 0, 22u, 0, pGlobalTXT_LocalizationStrings[10], 3u); - - -/* if ( !v3 ) // Town Portal - { - v6.DrawTitleText(pBook2Font, 0, 22, 0, pGlobalTXT_LocalizationStrings[10], 3); // "Town Portal" - return; - } - if ( v3 == 1 ) - { - v4 = 206; -LABEL_30: - if ( (unsigned __int16)_449B57_test_bit(pParty->_quest_bits, v4) ) - goto LABEL_31; - v6.DrawTitleText(pBook2Font, 0, 22u, 0, pGlobalTXT_LocalizationStrings[10], 3u); // "Town Portal" - return; - } - if ( v3 == 2 ) - { - v4 = 208; - goto LABEL_30; - } - if ( v3 == 3 ) - { - v4 = 207; - goto LABEL_30; - } - if ( v3 == 4 ) - { - v4 = 211; - goto LABEL_30; - } - if ( v3 == 5 ) - { - v4 = 209; - goto LABEL_30; - } - if ( v3 == 6 ) - { - v4 = 210; - goto LABEL_30; - } -LABEL_31: - pRenderer->DrawTextureIndexed(word_4E1D3A[v3], pTownPortalBook_xs[v3 + 5], *(&pTex_tab_an_6b__zoom_on + v3)); - v6.DrawTitleText(pBook2Font, 0, 22u, 0, pGlobalTXT_LocalizationStrings[10], 3u);*/ -} -// 4E1D3A: using guessed type __int16 word_4E1D3A[]; - - //----- (00413FF1) -------------------------------------------------------- void SetMonthNames() { @@ -9964,17 +9806,6 @@ - -//----- (004141CA) -------------------------------------------------------- -void ModalWindow(const char *pStr, int a4) -{ - pEventTimer->Pause(); - dword_506F0C[0] = pCurrentScreen; - ptr_507BDC = GUIWindow::Create(0, 0, 640, 480, WINDOW_FinalWindow, a4, (int)pStr); - pCurrentScreen = SCREEN_PRESS_ESCAPE_MESSAGE; -} -// 4E28F8: using guessed type int pCurrentScreen; - //----- (0041420D) -------------------------------------------------------- void __cdecl sub_41420D_press_esc() { @@ -9998,13 +9829,7 @@ v0 = ptr_507BDC; pMessageQueue_50CBD0->AddMessage((UIMessageType)(int)ptr_507BDC->ptr_1C, 0, 0); - /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) - { - pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)(int)ptr_507BDC->ptr_1C; - pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; - *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; - ++pMessageQueue_50CBD0->uNumMessages; - }*/ + v0->Release(); ptr_507BDC = 0; pCurrentScreen = dword_506F0C[0]; @@ -10051,10 +9876,10 @@ //----- (004156F0) -------------------------------------------------------- -void __cdecl GUI_UpdateWindows() +void GUI_UpdateWindows() { GUIWindow *pWindow; // esi@4 - unsigned int pWindowType; // eax@4 + //unsigned int pWindowType; // eax@4 char *pHint; // edx@66 GUIButton *pButtonPtr_1C; // ebp@79 char *pHint1; // edx@80 @@ -10082,7 +9907,6 @@ for ( i = 1; i <= uNumVisibleWindows; ++i ) { pWindow = &pWindowList[pVisibleWindowsIdxs[i] - 1]; - pWindowType = pWindow->eWindowType; switch (pWindow->eWindowType) { case WINDOW_OptionsButtons: @@ -10099,7 +9923,7 @@ } case WINDOW_Options: { - DrawGameOptions(); + GameMenuUI_Options_Draw(); continue; } case WINDOW_Book: @@ -10109,7 +9933,7 @@ } case WINDOW_Dialogue: { - DrawDialogueUI(); + GameUI_DrawDialogue(); continue; } case WINDOW_QuickReference: @@ -10134,7 +9958,7 @@ } case WINDOW_GreetingNPC: { - DrawBranchlessDialogueUI(); + GameUI_DrawBranchlessDialogue(); continue; } case WINDOW_Chest: @@ -10154,12 +9978,12 @@ } case WINDOW_SaveLoadButtons: { - sub_4606FE(); + SaveUI_Draw(); continue; } case WINDOW_MainMenu_Load: { - GameUI_MainMenu_DrawLoad(); + LoadUI_Draw(); continue; } case WINDOW_HouseInterior: @@ -10208,7 +10032,7 @@ case WINDOW_50: { v27 = TargetColor(255, 255, 255); - if ( ptr_507BD0->field_40 == 1 ) + if ( ptr_507BD0->receives_keyboard_input_2 == WINDOW_INPUT_IN_PROGRESS) { ptr_507BD0->DrawMessageBox(0); ptr_507BD0->DrawText(pFontCreate, 30, 40, v27, (const char *)pKeyActionMap->pPressedKeysBuffer, 0, 0, 0); @@ -10216,19 +10040,19 @@ ptr_507BD0->DrawFlashingInputCursor(v31 + 30, 40, pFontCreate); continue; } - if ( ptr_507BD0->field_40 == 2 ) + if ( ptr_507BD0->receives_keyboard_input_2 == WINDOW_INPUT_CONFIRMED) { - pWindow->field_40 = 0; + pWindow->receives_keyboard_input_2 = WINDOW_INPUT_NONE; pMessageQueue_50CBD0->AddMessage((UIMessageType)(int)ptr_507BD0->ptr_1C, 0, 0); pEventTimer->Resume(); ptr_507BD0->Release(); - pCurrentScreen = 0; - viewparams->bRedrawGameUI = 1; + pCurrentScreen = SCREEN_GAME; + viewparams->bRedrawGameUI = true; continue; } - if ( ptr_507BD0->field_40 == 3 ) + if ( ptr_507BD0->receives_keyboard_input_2 == WINDOW_INPUT_CANCELLED) { - pWindow->field_40 = 0; + pWindow->receives_keyboard_input_2 = WINDOW_INPUT_NONE; pEventTimer->Resume(); ptr_507BD0->Release(); continue; @@ -10245,7 +10069,7 @@ pWindow->Release(); pEventTimer->Resume(); pCurrentScreen = 0; - viewparams->bRedrawGameUI = 1; + viewparams->bRedrawGameUI = true; v26 = atoi((const char *)pKeyActionMap->pPressedKeysBuffer); if ( v26 > 0 ) { @@ -10422,7 +10246,7 @@ pButton = (GUIButton *)pWindow->ptr_1C; pRenderer->DrawTextureIndexed(pWindow->uFrameY, pWindow->uFrameX, pButton->pTextures[0]); - viewparams->bRedrawGameUI = 1; + viewparams->bRedrawGameUI = true; continue; } case WINDOW_CharacterWindow_Inventory: @@ -10469,7 +10293,7 @@ } //----- (00416196) -------------------------------------------------------- -void __cdecl identify_item() +void identify_item() { Player *v0; // esi@2 POINT *v1; // edi@2 @@ -10753,17 +10577,11 @@ { v0->RemoveItemAtInventoryIndex(v18); v26 = rand(); - v0->ReceiveDamage(v26 % 11 + 10, 0); + v0->ReceiveDamage(v26 % 11 + 10, DMGT_FIRE); pAudioPlayer->PlaySound(SOUND_8, 0, 0, -1, 0, 0, 0, 0); pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); - /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) - { - pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape; - pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; - *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; - ++pMessageQueue_50CBD0->uNumMessages; - }*/ + v42 = (int *)&a2.y; v41 = (int *)&y.y; v40 = (int *)&pOut; @@ -10775,7 +10593,7 @@ { v0->RemoveItemAtInventoryIndex(v18); v25 = rand(); - v0->ReceiveDamage(v25 % 71 + 30, 0); + v0->ReceiveDamage(v25 % 71 + 30, DMGT_FIRE); v23 = 1; } else @@ -10784,7 +10602,7 @@ { v0->RemoveItemAtInventoryIndex(v18); v24 = rand(); - v0->ReceiveDamage(v24 % 201 + 50, 0); + v0->ReceiveDamage(v24 % 201 + 50, DMGT_FIRE); v23 = 5; } else @@ -10835,13 +10653,7 @@ pAudioPlayer->PlaySound(SOUND_8, 0, 0, -1, 0, 0, 0, 0); pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); - /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) - { - pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape; - pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; - *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; - ++pMessageQueue_50CBD0->uNumMessages; - }*/ + v42 = (int *)&a2.y; v41 = (int *)&y.y; v40 = (int *)&pOut; @@ -10907,134 +10719,6 @@ } -//----- (00416B01) -------------------------------------------------------- -void __thiscall sub_416B01(void *_this)//PopupWindowForBenefitAndJoinText -{ - int v1; // edi@2 - int v2; // ecx@2 - NPCData *v3; // eax@2 - NPCData *v4; // esi@7 - NPCData *v5; // eax@16 - NPCData *v6; // esi@16 - const CHAR *v7; // eax@18 - unsigned int v8; // eax@25 - unsigned int v9; // eax@25 - const char *v10; // ST14_4@26 - char *v11; // esi@26 - const char *v12; // ST18_4@27 - unsigned __int16 v13; // ax@28 - char *v14; // eax@28 - GUIWindow a1; // [sp+Ch] [bp-60h]@23 - int a2; // [sp+60h] [bp-Ch]@16 - void *v17; // [sp+64h] [bp-8h]@1 - LPCSTR lpsz; // [sp+68h] [bp-4h]@6 - - v17 = _this; - if ( bNoNPCHiring != 1 ) - { - v1 = 0; - v2 = 0; - v3 = pParty->pHirelings; - /*do - { - if ( v3->pName ) - pTmpBuf[v1++] = v2; - ++v3; - ++v2; - } - while ( (signed int)v3 < (signed int)&pParty->pPickedItem );*/ - for (int i = 0; i < 2; ++i) - { - if (pParty->pHirelings[i].pName) - pTmpBuf[v1++] = i; - } - lpsz = 0; - if ( (signed int)pNPCStats->uNumNewNPCs > 0 ) - { - /*v4 = pNPCStats->pNewNPCData; - do - { - if ( v4->uFlags & 0x80 - && (!pParty->pHirelings[0].pName || strcmp(v4->pName, pParty->pHirelings[0].pName)) - && (!pParty->pHirelings[1].pName || strcmp(v4->pName, pParty->pHirelings[1].pName)) ) - pTmpBuf[v1++] = (char)lpsz + 2; - ++lpsz; - ++v4; - } - while ( (signed int)lpsz < (signed int)pNPCStats->uNumNewNPCs );*/ - for (int i = 0; i < pNPCStats->uNumNewNPCs; ++i) - { - if (pNPCStats->pNewNPCData[i].Hired()) - { - if (!pParty->pHirelings[0].pName || strcmp((char *)pNPCStats->pNewNPCData[i].pName, (char *)pParty->pHirelings[0].pName)) - { - if (!pParty->pHirelings[1].pName || strcmp((char *)pNPCStats->pNewNPCData[i].pName, (char *)pParty->pHirelings[1].pName)) - pTmpBuf[v1++] = i + 2; - } - } - } - } - if ( (signed int)((char *)v17 + (unsigned __int8)pParty->field_709) < v1 ) - { - sDialogue_SpeakingActorNPC_ID = -1 - (unsigned __int8)pParty->field_709 - (int)v17; - v5 = GetNewNPCData(sDialogue_SpeakingActorNPC_ID, (int)&a2); - v6 = v5; - if ( v5 ) - { - if ( a2 == 57 ) - v7 = pNPCTopics[512].pText; // Baby dragon - else - v7 = (const CHAR *)pNPCStats->pProfessions[v5->uProfession].pBenefits; - lpsz = v7; - if ( !v7 ) - { - lpsz = (LPCSTR)pNPCStats->pProfessions[v5->uProfession].pJoinText; - if ( !lpsz ) - lpsz = ""; - } - a1.Hint = 0; - a1.uFrameX = 38; - a1.uFrameY = 60; - a1.uFrameWidth = 276; - a1.uFrameZ = 313; - a1.uFrameHeight = pFontArrus->CalcTextHeight(lpsz, &a1, 0, 0) - + 2 * LOBYTE(pFontArrus->uFontHeight) - + 24; - if ( (signed int)a1.uFrameHeight < 130 ) - a1.uFrameHeight = 130; - a1.uFrameWidth = 400; - a1.uFrameZ = a1.uFrameX + 399; - a1.DrawMessageBox(0); - sprintf(pTmpBuf2, "NPC%03d", v6->uPortraitID); - v8 = pIcons_LOD->LoadTexture(pTmpBuf2, TEXTURE_16BIT_PALETTE); - pRenderer->DrawTextureIndexed( - a1.uFrameX + 22, - a1.uFrameY + 36, - (Texture *)(v8 != -1 ? &pIcons_LOD->pTextures[v8] : 0)); - v9 = v6->uProfession; - if ( v9 ) - { - v10 = v6->pName; - v11 = pTmpBuf; - sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[429], v10, aNPCProfessionNames[v9]); - } - else - { - v12 = v6->pName; - v11 = pTmpBuf; - strcpy(pTmpBuf, v12); - } - v13 = TargetColor(0xFFu, 0xFFu, 0x9Bu); - a1.DrawTitleText(pFontArrus, 0, 0xCu, v13, v11, 3u); - a1.uFrameWidth -= 24; - a1.uFrameZ = a1.uFrameX + a1.uFrameWidth - 1; - v14 = BuilDialogueString((char *)lpsz, uActiveCharacter - 1, 0, 0, 0, 0); - a1.DrawText(pFontArrus, 100, 36, 0, v14, 0, 0, 0); - } - } - } -} - @@ -11194,26 +10878,6 @@ } } -//----- (004178C4) -------------------------------------------------------- -void __cdecl sub_4178C4() -{ - if ( pArcomageGame->bGameInProgress == 1 ) - { - if (pAsyncMouse) - pArcomageGame->stru1.field_0 = 7; - } -} - -//----- (004178E1) -------------------------------------------------------- -void __cdecl sub_4178E1() -{ - if ( pArcomageGame->bGameInProgress == 1 ) - { - if (pAsyncMouse) - pArcomageGame->stru1.field_0 = 8; - } -} - //----- (004178FE) -------------------------------------------------------- unsigned int __fastcall UI_GetHealthManaStringColor(signed int a1, signed int a2) {
--- a/mm7_6.cpp Thu May 23 11:16:46 2013 +0600 +++ b/mm7_6.cpp Thu May 23 11:17:01 2013 +0600 @@ -7819,12 +7819,4 @@ } } } - if (pGame->pKeyboardInstance->bUsingAsynKeyboard) - { - AsyncKeyboard::LeaveCriticalSection(); - //v16 = pAsyncKeyboard; - AsyncKeyboard::EnterCriticalSection(); - memset((char *)pAsyncKeyboard + 521, 0, 0x100u); - AsyncKeyboard::LeaveCriticalSection(); - } }
--- a/mm7_data.cpp Thu May 23 11:16:46 2013 +0600 +++ b/mm7_data.cpp Thu May 23 11:17:01 2013 +0600 @@ -386,14 +386,6 @@ char pDeckMaster[12]; char aIxf[4]; // idb _UNKNOWN unk_4E19FC; // weak -char pAreYouSureWishToLeave[32]; -char asc_4E1A28[4]; // idb -char aUsxfs[13]; -char aLayout_pcx[11]; // weak -char aSprites_pcx[12]; // weak -char aProblemInBlit_[777]; // idb -char aEWorkMsdevMm7M[777]; // idb -char aProblemInBli_0[777]; // idb char aD[777]; // idb char asc_4E1AB0[777]; // idb char aWb_0[777]; // idb @@ -495,7 +487,6 @@ char aS100110DS[777]; // idb char aS100110D02dSS[777]; // idb int pCurrentScreen = SCREEN_VIDEO; // 004E28F8 -char byte_4E28FC; // weak unsigned int uGammaPos; int BtnTurnCoord[8] = { @@ -526,123 +517,22 @@ const char *format_4E2D80 = "\f%05d%s\f00000\n"; -char format_4E2D90[8]; -char aS03d03dS000_0[777]; // idb -char aS03d03dS000[777]; // idb //const char *format_4E2DC8 = "\f%05d"; -char aS[777]; // idb -char aLuSLuS[777]; // idb const char *format_4E2DE8 = "\f%05d%s\f00000 - "; -char asc_4E2DFC[3]; // idb const char *format_4E2E00 = "%s\f%05u\xD\r180%s\n"; // idb const char *format_4E2E10 = "%s\f%05u\t110%d\f00000 / %d\n"; -char aS100S_0[777]; // idb -char aS100S[777]; // idb -char aS100D[777]; // idb -char aS180[6]; // idb -char aS_6[2]; // idb -char aSS_0[777]; // idb -char aS_5[4]; // idb -char string_4E3294[8]; -char Format[777]; // idb -char aMem03i_txt[777]; // idb -char aMemory[777]; // idb -char aIdSSizeI[16]; // idb __int16 word_4E3C66[777]; // idb int dword_4E455C; // weak int dword_4E4560[6]; int dword_4E4578[6]; int dword_4E4590[6]; int dword_4E45A8[6]; -char aDDSDDS[777]; // idb -char asc_4E45DC[777]; // idb -char aD02dSSDSD[777]; // idb -char aButtexi1[777]; // idb -char aCanTJumpToThat[777]; // idb -char aNoMapFoundForS[777]; // idb -char global_a2[777]; // idb -char aSSS[777]; // idb -char aNotInMapStats[17]; // weak -char aD47_blv[777]; // idb -char aOut15_odm[777]; // idb -char Delim[777]; // idb -char aGamma_pcx[777]; -char aQuit1[777]; // idb -char aControls1[777]; // idb -char aSave1[777]; // idb -char aLoad1[777]; // idb -char aNew1[777]; // idb -char aOptions[777]; // idb -char aGammapos[9]; // weak -char aBloodsplats[777]; // idb -char aTinting[777]; // idb -char aColoredLights[777]; // idb -char aTurndelta[777]; // idb -char aFliponexit[777]; // idb -char pKey[777]; // idb -char aGraphicsmode[777]; // idb -char aShowdamage[777]; // idb -char aWalksound[777]; // idb -char aCharvoices[777]; // idb -char aMusicflag[777]; // idb -char aSoundflag[777]; // idb -char aOpvdgTn[777]; // idb -char aOpvdgCl[777]; // idb -char aOpvdgBs[777]; // idb -char aOpvdhTn[777]; // idb -char aOpvdhCl[777]; // idb -char aOpvdhBs[777]; // idb -char aOptvid[777]; // idb -char aOptkb_2[777]; // idb -char aOptkb_1[777]; // idb -char aResume1[777]; // idb -char aOptkb_h[777]; // idb -char aOptkb[777]; // idb -char aOption01[777]; // idb -char aOption02[777]; // idb -char aOption03[777]; // idb -char aOption04[777]; // idb -char aConvol90[777]; // idb -char aConvol80[777]; // idb -char aConvol70[777]; // idb -char aConvol60[777]; // idb -char aConvol50[777]; // idb -char aConvol40[777]; // idb -char aConvol30[777]; // idb -char aConvol20[777]; // idb -char aConvol10[777]; // idb -char aConvol00[777]; // idb -char aCon_smoo[777]; // idb -char aCon_arrr[777]; // idb -char aCon_arrl[777]; // idb -char aCon_32x[777]; // idb -char aCon_16x[777]; // idb -char aControlbg[777]; // idb -char aTitle_pcx[10]; // weak -char aEWorkMsdevMm_0[777]; // idb -char aDraw_debug_lin[777]; // idb -char aGenuineintel[13]; // weak -char asc_4E4938[13]; // weak -int dword_4E4948[777]; // weak -int dword_4E494C[777]; // weak -int dword_4E49D0[777]; // weak _UNKNOWN dword_4E49D4; // idb int dword_4E4A18[777]; // weak int dword_4E4A1C[777]; // weak int dword_4E4A40[777]; // weak int dword_4E4A44[777]; // weak -char aCentaurhauls[13]; // weak -char aCyrixinstead[13]; // weak -char aAuthenticamd[13]; // weak float flt_4E4A80[10]; -char aInvalidPlayerI[777]; // idb -char aEWorkMsdevMm_1[777]; // idb -char aEWorkMsdevMm_2[777]; // idb -char aErrorNoKeyboar[25]; // weak -char aInvalidDeviceP[777]; // idb -char aInvalidDevic_0[777]; // idb -char aEWorkMsdevMm_3[777]; // idb -char aErrorNoMouseFo[22]; // weak int pPaperdoll_BodyX = 481; // 004E4C28 int pPaperdoll_BodyY = 0; // 004E4C2C int paperdoll_Armor[4][17][2] = //4E4E30 @@ -749,24 +639,6 @@ 0x83, 0xD8, 0x7B, 0xD8, }; -char aItem092v3[777]; // idb -char aIbCd5D[777]; // idb -char aItem281pc02d[777]; // idb -char aPc02dbrd[777]; // idb -char aPc23vDlhu[777]; // idb -char aPc23vDlh[777]; // idb -char aPc23vDrh[777]; // idb -char aPc23vDlau[777]; // idb -char aPc23vDlad[777]; // idb -char aPc23vDbod[777]; // idb -char aBackhand[777]; // idb -char aBackdoll[777]; // idb -char aMagnifB[777]; // idb -char aItem3_3dvDa2[777]; // idb -char aItem3_3dvDa1[15]; // weak -char aItem3_3dvD[13]; // weak -char aItem64v1[9]; // weak -char aEffpar01[777]; // idb int pPartySpellbuffsUI_XYs[14][2] = { @@ -784,14 +656,6 @@ 3, 6, 15, 8, 3, 12, 0 }; -char aSpell27[777]; // idb -char aSpell21[777]; // idb -char aIsn02d[777]; // idb -char aBardataB[777]; // idb -char aBardata[8]; // weak -char aBardataC[10]; // weak -char aLoadprog[777]; // idb -char aLoadingD_pcx[777]; // idb int pNPCPortraits_x[6][6] = // 004E5E50 { {521, 0, 0, 0, 0, 0}, @@ -825,121 +689,9 @@ "isecdoor" }; -char aMer[777]; // idb -char aMir[777]; // idb -char aSel[777]; // idb -char aEle[777]; // idb -char aDar[777]; // idb -char aLig[777]; // idb -char aBod[777]; // idb -char aMin[777]; // idb -char aSpi[777]; // idb -char aEar[777]; // idb -char aWat[777]; // idb -char aAir[777]; // idb -char aFir[777]; // idb -char aBan[777]; // idb -char aTav[777]; // idb -char aTow[777]; // idb -char aTra[777]; // idb -char aTem[777]; // idb -char aBoa[777]; // idb -char aSta[777]; // idb -char aAlc[777]; // idb -char aMag[777]; // idb -char aArm[777]; // idb -char aWea[777]; // idb -char asc_4E7BD4[2]; // idb -char a2devents_txt[777]; // idb -char aFileSSizeLuBuf[777]; // idb -char aGlobal_evt[777]; // idb -char aMax_event_text[777]; // idb -char aS_str[777]; // idb -char aS_evt[777]; // idb -char aNoMazeInfoForT[36]; // weak -char aC[777]; // idb -char aB[3]; // weak -char aEvt02d[777]; // idb -char aNoTransitionTe[777]; // idb -char aEWorkMsdevMm_4[777]; // idb -char asc_4E7CD4[777]; // idb -char aSS_1[777]; // idb -char aNpcIdExceedsMa[777]; // idb -char aNpc03u[777]; // idb -char aPcout01[777]; // idb -char aArbiterEvil[777]; // idb -char aArbiterGood[777]; // idb -char a0[777]; // idb -char aPartyStart[777]; // idb -char aNorthStart[12]; // weak -char aSouthStart[12]; // weak -char aEastStart[11]; // weak -char aWestStart[11]; // weak -char aUnableToFindDo[777]; // idb -char aNwc_blv[777]; // idb -char aUnableToOpenS[777]; // idb -char aInvalidStringP[777]; // idb -char aEWorkMsdevMm_5[777]; // idb -char aNull[777]; // idb -char aInvalidStrin_0[777]; // idb -char aSI[777]; // idb -char aS7[4]; // weak -char aS6[777]; // idb -char aS5[4]; // weak -char aS1[777]; // idb -char aS3[4]; // weak -char aS0[777]; // idb -char aS2[4]; // weak -char aS4[4]; // weak -char aUnableToSaveDs[777]; // idb -char aDataDsft_bin[777]; // idb -char aPFrames[777]; // idb -char aEFrames[777]; // idb -char aSFrames[777]; // idb -char aMirror7[777]; // idb -char aMirror6[777]; // idb -char aMirror5[777]; // idb -char aMirror4[777]; // idb -char aMirror3[777]; // idb -char aMirror2[777]; // idb -char aMirror1[777]; // idb -char aMirror0[777]; // idb -char aLuminous[777]; // idb -char a1[777]; // idb -char aNew[777]; // idb -char pMessag[777]; // idb -char aCspriteframeta[777]; // idb -char aR[777]; // idb -char aNew_0[777]; // idb -char aUnableToSaveDt[777]; // idb -char aDataDtft_bin[777]; // idb -char aTxtFrames[777]; // idb -char aCtexturefram_1[777]; // idb -char aCtexturefram_0[777]; // idb -char aCtextureframet[777]; // idb int bWinNT4_0; // weak -char aEWorkMsdevMm_6[777]; // idb -char aTheVisObjectPo[777]; // idb -char aSpriteOutlineC[777]; // idb -char aUndefinedCobje[777]; // idb -char aEWorkMsdevMm_7[777]; // idb -char aGammaControlNo[777]; // idb __int16 word_4E8152[11] = {0, 0, 0, 90, 8, 2, 70, 20, 10, 50, 30}; -char aD3dTextureName[777]; // idb -char aLogd3d_txt[777]; // idb -char byte_4E8394[204] = -{ - 0, 0, 0, 0, 1, 1, 2, 3, 0, 4, 5, 6, 7, 8, 10, 9, 1, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 1, - 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3, 3, 1, - 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0 -}; stru355 stru_4E82A4 = {0x20, 0x41, 0, 0x20, 0xFF0000, 0xFF00, 0xFF, 0xFF000000}; stru355 stru_4EFCBC = {0x20, 0x41, 0, 0x10, 0x7C00, 0x3E0, 0x1F, 0x8000}; char byte_4E94D0 = 5; // weak @@ -1261,59 +1013,13 @@ "MAGSHELF", "MAGSHELF", "MAGSHELF", "MAGSHELF", "MAGSHELF", "MAGSHELF", "MAGSHELF" }; -//__int16 word_4F03FE[777]; // weak -//__int16 word_4F0400[777]; // weak -/*__int16 word_4F0404[] = -{ - 0, 0, 1, 0x17, 0x1B, 0x14, 0x14, 1, 0x17, 0x18, 0x1C, - 0x14, 2, 0x17, 0x18, 0x19, 0x14, 2, 0x1B, 0x1B, 0x1A, 0x1A, - 4, 0x18, 0x1E, 0x19, 0x1B, 4, 0x18, 0x1E, 0x19, 0x1B, 3, 0x1E, - 0x18, 0x14, 0x14, 2, 0x14, 0x14, 0x14, 0x14, 3, 0x1B, 0x1B, 0x1A, 0x1A, - 3, 0x1C, 0x1C, 0x19, 0x19, 2, 0x17, 0x17, 0x18, 0x18, - 3, 0x17, 0x17, 0x1A, 0x1A, 2, 0x1E, 0x1A, 0x1A, 0x1A, 2, 0x1C, - 0x19, 0x1C, 0x1D, 0, 0 -};*/ -//__int16 word_4F0498[777]; // weak -/*__int16 word_4F0498[] = -{ -1, 0x23, 0x23, 0x26, 0x26, 1, 0x1F, 0x1F, 0x1F, 0x22, 1, 0x23, 0x23, -0x26, 0x26, 1, 0x1F, 0x1F, 0x20, 0x22, 2, 0x23, 0x23, -0x26, 0x26, 2, 0x1F, 0x20, 0x20, 0x21, 2, 0x23, 0x23, -0x26, 0x26, 2, 0x1F, 0x1F, 0x20, 0x20, 4, 0x23, 0x23, -0x26, 0x26, 4, 0x1F, 0x20, 0x21, 0x22, 4, 0x23, 0x23, 0x26, 0x26, -4, 0x1F, 0x20, 0x21, 0x22, 3, 0x23, 0x23, 0x26, 0x26, 3, -0x1F, 0x1F, 0x1F, 0x1F, 2, 0x23, 0x23, 0x26, 0x26, 2, 0x1F, 0x20, -0x22, 0x22, 3, 0x23, 0x23, 0x26, 0x26, 3, 0x1F, 0x1F, -0x20, 0x20, 3, 0x23, 0x23, 0x26, 0x26, 3, 0x20, 0x20, 0x20, -0x21, 3, 0x23, 0x23, 0x26, 0x26, 3, 0x1F, 0x1F, 0x1F, 0x20 -};*/ -//__int16 word_4F0576[777]; // weak -/*__int16 word_4F0576[] = -{ -0x23, 0x23, 0x26, 0x26, 3, 0x21, 0x1F, 0x20, 0x22, 3, 0x23, 0x23, -0x26, 0x26, 3, 0x21, 0x1F, 0x20, 0x22, 4, 0x23, 0x23, 0x26, 0x26, -4, 0x21, 0x1F, 0x20, 0x22, 0x1, 0x1, 0x2, 0x2, 0x4, 0x4, -3, 2, 2, 2, 2, 2, 2, 0, 0x1, 0x1, 0x2, 0x2, 0x3, 0x3, 0x4, 0x4, -2, 2, 2, 2, 0x0, 0x0, 1, 0, 0xA3, 0xA3, 0xA2, 0xA1, 0xA0, -2, 0, 0xA3, 0xA3, 0xA2, 0xA1, 0xA0, 2, 0, 0xA3, 0xA3, -0xA2, 0xA1, 0xA0, 2, 0, 0x0A3, 0x0A3, 0xA2, 0xA1, 0xA0, -3, 0, 0xA3, 0xA3, 0xA2, 0xA1, 0xA0, 3, 0, 0xA3, 0xA3, -0xA2, 0xA1, 0xA0 -};*/ -//__int16 word_4F0578[777]; // weak -//__int16 word_4F05AE[777]; // weak - -//__int16 word_4F063E[290]; -//__int16 word_4F06D8[22]; int guild_mambership_flags[32]={ 54, 54, 54, 54, 52, 52, 52, 52, 55, 55, 55, 55, 53, 53, 53, 53, 58, 58, 58, 58, 57, 57, 57, 57, 56, 56, 56, 56, 59, 59, 60, 60}; __int16 word_4F0754[49]; -//__int16 word_4F07B6[88]; -//__int16 _word_4F0866_pMaxLevelPerTrainingHallType_negindexing[14]; -__int16 _4F0882_evt_VAR_PlayerItemInHands_vals[54]= +__int16 _4F0882_evt_VAR_PlayerItemInHands_vals[54] = { 0x0D4, 0x270, 0x0D5, 0x21C, 0x0D6, 0x2BE, 0x0D7, 0x2BD, 0x0D8, 0x289, 0x0D9, 0x258, 0x0DA, 0x2AB, 0x0DB, 0x281, 0x0DC, 0x280, 0x0DD, @@ -1337,40 +1043,6 @@ 4, 7, 10, 11, 7, 11, 7, 11}; -char aS03d[777]; // idb -char byte_4F0F98; // idb -char sz[777]; // idb -char aSSSSSS[777]; // idb -char aSDS[777]; // idb -char aSS_3[777]; // idb -char aSSSS[777]; // idb -char aS_2[777]; // idb -char aErrorlog_txt[777]; // idb -char aUnsupportedPix[777]; // idb -char aSmackerError[777]; // idb -char aCS[777]; // idb -char aAnimsMagic7_vi[777]; // idb -char aVideoFileError[777]; // idb -char aCanTOpenFileAn[777]; // idb -char aAnimsMight7_vi[777]; // idb -char aCanTLoadS[777]; // idb -char aS_smk[777]; // idb -char aUnsupportedBin[27]; // weak -char aEWorkMsdevM_29[777]; // idb -char aFailedToOpenBl[777]; // idb -char aCanTAllocateMe[33]; // weak -char aCanTLoadFileAn[777]; // idb -char aS_bik[777]; // idb -char aMm7_win_pcx[777]; // idb -char aLuSLuSLuS[777]; // idb -char aEndgame_fnt[777]; // idb -char aWinbg_pcx[10]; // weak -char aDefaultCaseRea[777]; // idb -char aUnsupportedExc[71]; // weak -char aEWorkMsdevM_30[777]; // idb -char aUndefinedTypeR[777]; // idb -char aUnknownPointer[777]; // idb -char a1_1_3[6]; // weak double dbl_4F2870; // weak int dword_4F288C; // weak double dbl_4F5372; // weak @@ -1492,8 +1164,7 @@ int dword_506984; // weak int dword_506988; // weak int dword_50698C; // weak -int dword_506E68; // weak -char KeyButtonFlagChangesArray[28]; // weak +int uGameMenuUI_CurentlySelectedKeyIdx; // 506E68 unsigned int pPrevVirtualCidesMapping[27]; int KeyboardPageNum; // weak int dword_506F0C[777]; // idb @@ -1529,8 +1200,6 @@ int dword_507B98_ctrl_pressed; // weak unsigned int uActiveCharacter; int dword_507BF0_is_there_popup_onscreen; // weak -int dword_507C08; // weak -int dword_507C0C; // weak int dword_507CBC; // weak int dword_507CC0; // weak __int64 GameUI_RightPanel_BookFlashTimer; // weak @@ -1545,26 +1214,16 @@ int _50B834_view_transformed_zs[45]; int dword_50B918[777]; int _50B924_view_transformed_xs[45]; -//int unk_50B9D4[777]; // idb int _50B9D8_screen_space_y[777]; int dword_50B9E4[777]; -//int dword_50B9E0_ys[777]; // idb -//int dword_50B9EC[777]; // idb int dword_50B9F0[2]; // idb -//int dword_50BAE8_xs[777]; -//int dword_50BAF4_xs[777]; -//int dword_50B9F8[777]; // idb int dword_50B9FC_ys[3 + 45]; int dword_50BA08_ys[48]; // idb -//int dword_50BAC4[777]; // weak int _50BAC8_screen_space_x[777]; // idb -//int dword_50BAD0[777]; // weak int dword_50BAD4[777]; // weak -//int dword_50BADC_xs[777]; // weak int dword_50BAE0[777]; // weak int dword_50BAE8[777]; // weak int dword_50BAEC_xs[3 + 45]; // weak -//int dword_50BAF4[777]; // weak int dword_50BAF8_xs[48]; // weak int dword_50BC10[777]; // weak int dword_50BDA0[777]; // weak @@ -1840,10 +1499,6 @@ int aborting_app; // weak int dword_720020_zvalues[100]; int dword_7201B0_zvalues[299]; -int dword_72065C[777]; // weak -int dword_720660[777]; // idb -int dword_7207EC[777]; // weak -int dword_7207F0[777]; // idb int uTextureID_720980; // weak int _720984_unused; // weak char _72098C_unused; // weak
--- a/mm7_data.h Thu May 23 11:16:46 2013 +0600 +++ b/mm7_data.h Thu May 23 11:17:01 2013 +0600 @@ -321,14 +321,6 @@ extern char pDeckMaster[12]; extern char aIxf[4]; // idb extern _UNKNOWN unk_4E19FC; // weak -extern char pAreYouSureWishToLeave[32]; -extern char asc_4E1A28[4]; // idb -extern char aUsxfs[13]; -extern char aLayout_pcx[11]; // weak -extern char aSprites_pcx[12]; // weak -extern char aProblemInBlit_[]; // idb -extern char aEWorkMsdevMm7M[]; // idb -extern char aProblemInBli_0[]; // idb extern char aD[]; // idb extern char asc_4E1AB0[]; // idb extern char aWb_0[]; // idb @@ -430,7 +422,6 @@ extern char aS100110DS[]; // idb extern char aS100110D02dSS[]; // idb extern int pCurrentScreen; // 004E28F8 -extern char byte_4E28FC; // weak extern unsigned int uGammaPos; extern int BtnTurnCoord[8]; extern __int16 RightClickPortraitXmin[4]; @@ -449,118 +440,21 @@ extern const char *format_4E2D80; extern char format_4E2D90[8]; -//extern const char *format_4E2DC8; extern const char *format_4E2DE8; // idb -extern char asc_4E2DFC[3]; // idb extern const char *format_4E2E00; // idb extern const char *format_4E2E10; // format text of resistance in Stats screen -extern char aS100S_0[]; // idb -extern char aS100S[]; // idb -extern char aS100D[]; // idb -extern char aS180[6]; // idb -extern char aS_6[2]; // idb -extern char aSS_0[]; // idb -extern char aS_5[4]; // idb -extern char string_4E3294[8]; -extern char Format[]; // idb -extern char aMem03i_txt[]; // idb -extern char aMemory[]; // idb -extern char aIdSSizeI[16]; // idb extern __int16 word_4E3C66[]; // idb extern int dword_4E455C; // weak extern int dword_4E4560[6]; extern int dword_4E4578[6]; extern int dword_4E4590[6]; extern int dword_4E45A8[6]; -extern char aDDSDDS[]; // idb -extern char asc_4E45DC[]; // idb -extern char aD02dSSDSD[]; // idb -extern char aButtexi1[]; // idb -extern char aCanTJumpToThat[]; // idb -extern char aNoMapFoundForS[]; // idb -extern char global_a2[]; // idb -extern char aSSS[]; // idb -extern char aNotInMapStats[17]; // weak -extern char aD47_blv[]; // idb -extern char aOut15_odm[]; // idb -extern char Delim[]; // idb -extern char aGamma_pcx[]; -extern char aQuit1[]; // idb -extern char aControls1[]; // idb -extern char aSave1[]; // idb -extern char aLoad1[]; // idb -extern char aNew1[]; // idb -extern char aOptions[]; // idb -extern char aGammapos[9]; // weak -extern char aBloodsplats[]; // idb -extern char aTinting[]; // idb -extern char aColoredLights[]; // idb -extern char aTurndelta[]; // idb -extern char aFliponexit[]; // idb -extern char pKey[]; // idb -extern char aGraphicsmode[]; // idb -extern char aShowdamage[]; // idb -extern char aWalksound[]; // idb -extern char aCharvoices[]; // idb -extern char aMusicflag[]; // idb -extern char aSoundflag[]; // idb -extern char aOpvdgTn[]; // idb -extern char aOpvdgCl[]; // idb -extern char aOpvdgBs[]; // idb -extern char aOpvdhTn[]; // idb -extern char aOpvdhCl[]; // idb -extern char aOpvdhBs[]; // idb -extern char aOptvid[]; // idb -extern char aOptkb_2[]; // idb -extern char aOptkb_1[]; // idb -extern char aResume1[]; // idb -extern char aOptkb_h[]; // idb -extern char aOptkb[]; // idb -extern char aOption01[]; // idb -extern char aOption02[]; // idb -extern char aOption03[]; // idb -extern char aOption04[]; // idb -extern char aConvol90[]; // idb -extern char aConvol80[]; // idb -extern char aConvol70[]; // idb -extern char aConvol60[]; // idb -extern char aConvol50[]; // idb -extern char aConvol40[]; // idb -extern char aConvol30[]; // idb -extern char aConvol20[]; // idb -extern char aConvol10[]; // idb -extern char aConvol00[]; // idb -extern char aCon_smoo[]; // idb -extern char aCon_arrr[]; // idb -extern char aCon_arrl[]; // idb -extern char aCon_32x[]; // idb -extern char aCon_16x[]; // idb -extern char aControlbg[]; // idb -extern char aTitle_pcx[10]; // weak -extern char aEWorkMsdevMm_0[]; // idb -extern char aDraw_debug_lin[]; // idb -extern char aGenuineintel[13]; // weak -extern char asc_4E4938[13]; // weak -extern int dword_4E4948[]; // weak -extern int dword_4E494C[]; // weak -extern int dword_4E49D0[]; // weak extern _UNKNOWN dword_4E49D4; // idb extern int dword_4E4A18[]; // weak extern int dword_4E4A1C[]; // weak extern int dword_4E4A40[]; // weak extern int dword_4E4A44[]; // weak -extern char aCentaurhauls[13]; // weak -extern char aCyrixinstead[13]; // weak -extern char aAuthenticamd[13]; // weak extern float flt_4E4A80[10]; -extern char aInvalidPlayerI[]; // idb -extern char aEWorkMsdevMm_1[]; // idb -extern char aEWorkMsdevMm_2[]; // idb -extern char aErrorNoKeyboar[25]; // weak -extern char aInvalidDeviceP[]; // idb -extern char aInvalidDevic_0[]; // idb -extern char aEWorkMsdevMm_3[]; // idb -extern char aErrorNoMouseFo[22]; // weak extern int pPaperdoll_BodyX; // weak extern int pPaperdoll_BodyY; // weak extern int paperdoll_Armor[4][17][2]; @@ -578,144 +472,16 @@ extern int pPaperdoll_SecondLeftHand[4][2]; extern int pPaperdoll_RightHand[4][2]; extern int pPaperdollLeftEmptyHand[4][2]; -extern char aItem092v3[]; // idb -extern char aIbCd5D[]; // idb -extern char aItem281pc02d[]; // idb -extern char aPc02dbrd[]; // idb -extern char aPc23vDlhu[]; // idb -extern char aPc23vDlh[]; // idb -extern char aPc23vDrh[]; // idb -extern char aPc23vDlau[]; // idb -extern char aPc23vDlad[]; // idb -extern char aPc23vDbod[]; // idb -extern char aBackhand[]; // idb -extern char aBackdoll[]; // idb -extern char aMagnifB[]; // idb -extern char aItem3_3dvDa2[]; // idb -extern char aItem3_3dvDa1[15]; // weak -extern char aItem3_3dvD[13]; // weak -extern char aItem64v1[9]; // weak -extern char aEffpar01[]; // idb extern int pPartySpellbuffsUI_XYs[14][2]; extern unsigned char byte_4E5DD8[]; // weak extern unsigned __int8 pPartySpellbuffsUI_smthns[14]; -extern char aSpell27[]; // idb -extern char aSpell21[]; // idb -extern char aIsn02d[]; // idb -extern char aBardataB[]; // idb -extern char aBardata[8]; // weak -extern char aBardataC[10]; // weak -extern char aLoadprog[]; // idb -extern char aLoadingD_pcx[]; // idb extern int pNPCPortraits_x[6][6]; // 004E5E50 extern int pNPCPortraits_y[6][6]; // 004E5EE0 extern const char *pHouse_ExitPictures[11]; extern const char *_4E6BDC_loc_names[11]; -extern char aOutside[]; // idb -extern char aMer[]; // idb -extern char aMir[]; // idb -extern char aSel[]; // idb -extern char aEle[]; // idb -extern char aDar[]; // idb -extern char aLig[]; // idb -extern char aBod[]; // idb -extern char aMin[]; // idb -extern char aSpi[]; // idb -extern char aEar[]; // idb -extern char aWat[]; // idb -extern char aAir[]; // idb -extern char aFir[]; // idb -extern char aBan[]; // idb -extern char aTav[]; // idb -extern char aTow[]; // idb -extern char aTra[]; // idb -extern char aTem[]; // idb -extern char aBoa[]; // idb -extern char aSta[]; // idb -extern char aAlc[]; // idb -extern char aMag[]; // idb -extern char aArm[]; // idb -extern char aWea[]; // idb -extern char asc_4E7BD4[2]; // idb -extern char a2devents_txt[]; // idb -extern char aFileSSizeLuBuf[]; // idb -extern char aGlobal_evt[]; // idb -extern char aMax_event_text[]; // idb -extern char aS_str[]; // idb -extern char aS_evt[]; // idb -extern char aNoMazeInfoForT[36]; // weak -extern char aC[]; // idb -extern char aB[3]; // weak -extern char aEvt02d[]; // idb -extern char aNoTransitionTe[]; // idb -extern char aEWorkMsdevMm_4[]; // idb -extern char asc_4E7CD4[]; // idb -extern char aSS_1[]; // idb -extern char aNpcIdExceedsMa[]; // idb -extern char aNpc03u[]; // idb -extern char aPcout01[]; // idb -extern char aArbiterEvil[]; // idb -extern char aArbiterGood[]; // idb -extern char a0[]; // idb -extern char aPartyStart[]; // idb -extern char aNorthStart[12]; // weak -extern char aSouthStart[12]; // weak -extern char aEastStart[11]; // weak -extern char aWestStart[11]; // weak -extern char aUnableToFindDo[]; // idb -extern char aNwc_blv[]; // idb -extern char aUnableToOpenS[]; // idb -extern char aInvalidStringP[]; // idb -extern char aEWorkMsdevMm_5[]; // idb -extern char aNull[]; // idb -extern char aInvalidStrin_0[]; // idb -extern char aSI[]; // idb -extern char aS7[4]; // weak -extern char aS6[]; // idb -extern char aS5[4]; // weak -extern char aS1[]; // idb -extern char aS3[4]; // weak -extern char aS0[]; // idb -extern char aS2[4]; // weak -extern char aS4[4]; // weak -extern char aUnableToSaveDs[]; // idb -extern char aDataDsft_bin[]; // idb -extern char aPFrames[]; // idb -extern char aEFrames[]; // idb -extern char aSFrames[]; // idb -extern char aMirror7[]; // idb -extern char aMirror6[]; // idb -extern char aMirror5[]; // idb -extern char aMirror4[]; // idb -extern char aMirror3[]; // idb -extern char aMirror2[]; // idb -extern char aMirror1[]; // idb -extern char aMirror0[]; // idb -extern char aLuminous[]; // idb -extern char a1[]; // idb -extern char aNew[]; // idb -extern char pMessag[]; // idb -extern char aCspriteframeta[]; // idb -extern char aR[]; // idb -extern char aNew_0[]; // idb -extern char aUnableToSaveDt[]; // idb -extern char aDataDtft_bin[]; // idb -extern char aTxtFrames[]; // idb -extern char aCtexturefram_1[]; // idb -extern char aCtexturefram_0[]; // idb -extern char aCtextureframet[]; // idb extern int bWinNT4_0; // weak -extern char aEWorkMsdevMm_6[]; // idb -extern char aTheVisObjectPo[]; // idb -extern char aSpriteOutlineC[]; // idb -extern char aUndefinedCobje[]; // idb -extern char aEWorkMsdevMm_7[]; // idb -extern char aGammaControlNo[]; // idb extern __int16 word_4E8152[11]; extern char byte_4E8168[7][14]; -extern char aD3dTextureName[]; // idb -extern char aLogd3d_txt[]; // idb -extern char byte_4E8394[]; // weak #include "Texture.h" extern stru355 stru_4E82A4;// = {0x20, 0x41, 0, 0x20, 0xFF0000, 0xFF00, 0xFF, 0xFF000000}; extern stru355 stru_4EFCBC;// = {0x20, 0x41, 0, 0x10, 0x7C00, 0x3E0, 0x1F, 0x8000}; @@ -741,7 +507,6 @@ extern const char *dlhu_texnames_by_face[25]; extern unsigned char byte_4ECF08[48][25]; extern unsigned char SoundSetAction[110][8]; // weak -//extern unsigned char byte_4ED498; // weak extern __int16 pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing[4]; extern char byte_4ED970_skill_learn_ability_by_class_table[36][37]; extern int dword_4EDEA0[]; // weak @@ -761,59 +526,15 @@ extern void *off_4EFDB0; // weak extern int dword_4F031C[]; // weak extern const char *off_4F03B8[]; // idb -//extern __int16 word_4F03FE[]; // weak -//extern __int16 word_4F0400[]; // weak -//extern __int16 word_4F0404[]; -//extern __int16 word_4F0498[]; // weak extern __int16 word_4F0576[]; // weak -//extern __int16 word_4F05AE[]; // weak - -//extern __int16 word_4F063E[290]; -//extern __int16 word_4F06D8[22]; extern int guild_mambership_flags[32]; extern __int16 word_4F0754[49]; -//extern __int16 word_4F07B6[88]; -//extern __int16 _word_4F0866_pMaxLevelPerTrainingHallType_negindexing[14]; extern __int16 _4F0882_evt_VAR_PlayerItemInHands_vals[54]; extern unsigned short pMaxLevelPerTrainingHallType[]; extern int price_for_membership[]; // weak extern Vec2_int_ pMonsterArenaPlacements[20]; extern __int16 word_4F0F30[32]; // weak -extern char aS03d[]; // idb -extern char byte_4F0F98; // idb -extern char sz[]; // idb -extern char aSSSSSS[]; // idb -extern char aSDS[]; // idb -extern char aSS_3[]; // idb -extern char aSSSS[]; // idb -extern char aS_2[]; // idb -extern char aErrorlog_txt[]; // idb -extern char aUnsupportedPix[]; // idb -extern char aSmackerError[]; // idb -extern char aCS[]; // idb -extern char aAnimsMagic7_vi[]; // idb -extern char aVideoFileError[]; // idb -extern char aCanTOpenFileAn[]; // idb -extern char aAnimsMight7_vi[]; // idb -extern char aCanTLoadS[]; // idb -extern char aS_smk[]; // idb -extern char aUnsupportedBin[27]; // weak -extern char aEWorkMsdevM_29[]; // idb -extern char aFailedToOpenBl[]; // idb -extern char aCanTAllocateMe[33]; // weak -extern char aCanTLoadFileAn[]; // idb -extern char aS_bik[]; // idb -extern char aMm7_win_pcx[]; // idb -extern char aLuSLuSLuS[]; // idb -extern char aEndgame_fnt[]; // idb -extern char aWinbg_pcx[10]; // weak -extern char aDefaultCaseRea[]; // idb -extern char aUnsupportedExc[71]; // weak -extern char aEWorkMsdevM_30[]; // idb -extern char aUndefinedTypeR[]; // idb -extern char aUnknownPointer[]; // idb -extern char a1_1_3[6]; // weak extern double dbl_4F2870; // weak extern int dword_4F288C; // weak extern double dbl_4F5372; // weak @@ -934,8 +655,8 @@ extern int dword_506984; // weak extern int dword_506988; // weak extern int dword_50698C; // weak -extern int dword_506E68; // weak -extern char KeyButtonFlagChangesArray[28]; // weak +extern int uGameMenuUI_CurentlySelectedKeyIdx; // 506E68 +extern bool GameMenuUI_InvaligKeyBindingsFlags[28]; // 506E6C extern unsigned int pPrevVirtualCidesMapping[27]; extern int KeyboardPageNum; // weak extern int dword_506F0C[]; // idb @@ -971,8 +692,6 @@ extern int dword_507B98_ctrl_pressed; // weak extern unsigned int uActiveCharacter; extern int dword_507BF0_is_there_popup_onscreen; // weak -extern int dword_507C08; // weak -extern int dword_507C0C; // weak extern int dword_507CBC; // weak extern int dword_507CC0; // weak extern __int64 GameUI_RightPanel_BookFlashTimer; // weak @@ -987,26 +706,16 @@ extern int _50B834_view_transformed_zs[]; extern int dword_50B918[]; extern int _50B924_view_transformed_xs[]; -//extern int unk_50B9D4[]; // idb extern int _50B9D8_screen_space_y[]; extern int dword_50B9E4[]; -//extern int dword_50B9E0_ys[]; // idb -//extern int dword_50B9EC[]; // idb extern int dword_50B9F0[]; // idb -//extern int dword_50BAE8_xs[]; -//extern int dword_50BAF4_xs[]; -//extern int dword_50B9F8_xs[]; // idb extern int dword_50B9FC_ys[]; extern int dword_50BA08_ys[]; // idb -//extern int dword_50BAC4[]; // weak extern int _50BAC8_screen_space_x[]; // idb -//extern int dword_50BAD0[]; // weak extern int dword_50BAD4[]; // weak -//extern int dword_50BADC_xs[]; // weak extern int dword_50BAE0[]; // weak extern int dword_50BAE8[]; // weak extern int dword_50BAEC_xs[]; // weak -//extern int dword_50BAF4[]; // weak extern int dword_50BAF8_xs[]; // weak extern int dword_50BC10[]; // weak extern int dword_50BDA0[]; // weak @@ -1053,11 +762,6 @@ extern int papredoll_flying_feet[]; // idb extern int paperdoll_boots_texture[4][6]; extern int paperdoll_cloak_collar_texture[4][10]; // weak -//extern int dword_51179C; // weak -//extern int dword_5117A0; // weak -//extern int dword_5117A4; // weak -//extern int dword_5117A8; // weak -//extern int dword_5117AC; // weak extern int paperdoll_cloak_texture[4][10]; extern int bRingsShownInCharScreen; // weak extern int _unused000; // weak @@ -1290,9 +994,6 @@ extern int aborting_app; // weak extern int dword_720020_zvalues[100]; extern int dword_7201B0_zvalues[299]; -extern int dword_72065C[]; // weak -extern int dword_720660[]; // idb -extern int dword_7207EC[]; // weak extern int dword_7207F0[]; // idb extern int uTextureID_720980; // weak extern int _720984_unused; // weak @@ -1549,21 +1250,14 @@ void uGameUIFontShadow_initialize(); void sub_41420D_press_esc(); void sub_41426F(); -void GameMenuUI_DrawKeyBindings(); -unsigned int __thiscall sub_414D24(int _this); -void GameMenuUI_DrawVideoOptions(); -void DrawGameOptions(); void __fastcall DrawPopupWindow(unsigned int uX, unsigned int uY, unsigned int uWidth, unsigned int uHeight); // idb void DrawCopyrightWindow(); void LoadFonts_and_DrawCopyrightWindow(); void GUI_UpdateWindows(); void identify_item(); -void __thiscall sub_416B01(void *_this); void __thiscall sub_416D62_ShowPopupWindow_MonsterRecord_ItemInfo_etcsub_416D62(struct Vec2_int_ *_this); void UI_OnMouseLeftClick(int *pXY); // idb void __thiscall sub_417871(int *pXY); -void sub_4178C4(); -void sub_4178E1(); unsigned int __fastcall UI_GetHealthManaStringColor(signed int a1, signed int a2); signed int __thiscall GetConditionDrawColor(unsigned int uConditionIdx); // idb void __fastcall sub_4179BC_draw_tooltip(const char *a1, const char *a2); // idb @@ -1573,8 +1267,6 @@ unsigned int __fastcall GetSizeInInventorySlots(unsigned int uNumPixels); struct GUIButton *__fastcall GUI_HandleHotkey(unsigned __int8 uHotkey); // idb int __fastcall GUI_ReplaceHotkey(unsigned __int8 uOldHotkey, unsigned __int8 uNewHotkey, char bFirstCall); -void __cdecl MainMenuUI_LoadFontsAndSomeStuff(); -void __cdecl MainMenuUI_Create(); void __fastcall sub_41D20D_buff_remaining_time_string(int ecx0, struct GUIWindow *edx0, __int64 a3, struct GUIFont *a2); bool UI_OnKeyDown(unsigned int vkKey); void GameUI_DrawItemInfo(struct ItemGen* inspect_item); // idb @@ -1582,8 +1274,6 @@ void __cdecl nullsub_3(); // idb void __cdecl LoadActualSkyFrame(); void __cdecl Sleep6Hours(); -void __cdecl RestUI_Initialize(); -void __cdecl RestUI_Draw(); // idb void __cdecl sub_42038D(); void __fastcall party_finds_gold(unsigned int uNumGold, int _1_dont_share_with_followers___2_the_same_but_without_a_message__else_normal); // idb @@ -1669,7 +1359,6 @@ void __fastcall sub_4406BC(unsigned int node_id, unsigned int uFirstNode); // idb void __fastcall sub_440BED(struct IndoorLocation_drawstru *_this); bool sub_44100D(); -void LoadPartyBuffIcons(); __int16 __fastcall sub_441A4E(int a1); void DrawBook_Map_sub(unsigned int tl_x, unsigned int tl_y, unsigned int br_x, int br_y, int _48074); // idb void Initialize2DA(); @@ -1679,19 +1368,12 @@ void __cdecl OnMapLeave(); void /*__usercall*/ OnMapLoad(); void __thiscall Level_LoadEvtAndStr(const char *pLevelName); -char *__cdecl _4443D5_GetMinimapRightClickText(); const char *__cdecl sub_444564(); char *__thiscall GetEventHintString(unsigned int uEventID); // idb -unsigned int __fastcall sub_444839_move_map(unsigned int a1, int a2, int x, int y, int z, int directiony, int directionx, int a8, const char *pLocationName); // idb -void TransitionUI_Draw(); -void UI_CreateTravelDialogue(); signed int __cdecl GetTravelTime(); -void __cdecl TravelUI_Draw(); -void __cdecl DrawBranchlessDialogueUI(); void __fastcall sub_4451A8_press_any_key(int a1, int a2, int a4); void __cdecl sub_4452BB(); const char *GetProfessionActionText(int a1); -void __cdecl DrawDialogueUI(); struct NPCData *__fastcall GetNPCData(signed int npcid); struct NPCData *__fastcall GetNewNPCData(signed int npcid, int a2); int __fastcall GetGreetType(signed int SpeakingNPC_ID); @@ -1715,7 +1397,6 @@ __int16 __fastcall sub_449A49_door_switch_animation(unsigned int uDoorID, int a2); // idb bool _449B57_test_bit(unsigned __int8 *a1, __int16 a2); void _449B7E_toggle_bit(unsigned char *pArray, __int16 a2, unsigned __int16 bToggle); // idb -void __cdecl Party__CountHirelings(); void __fastcall ShowStatusBarString(const char *pString, unsigned int uNumSeconds); void __cdecl ShowNothingHereStatus(); signed int __cdecl const_2(); @@ -1750,14 +1431,9 @@ void *__thiscall unknown_vdtor_6(void *_this, bool a2); unsigned short * MakeScreenshot(signed int width, signed int height); void __thiscall SaveScreenshot(const char *pFilename); -void __fastcall GameUI_DrawLoadMenu(unsigned int uDialogueType); // idb -void __cdecl GameUI_DrawSaveMenu(); void __fastcall LoadGame(unsigned int uSlot); // idb void SaveGame(bool IsAutoSAve, bool NotSaveWorld); void __fastcall DoSavegame(unsigned int uSlot); // idb -void GameUI_MainMenu_DoDrawLoad(int a1); -void GameUI_MainMenu_DrawLoad(); -void __cdecl sub_4606FE(); void __cdecl TryLoadLevelFromLOD(); void __cdecl sub_46080D(); bool __cdecl Initialize_GamesLOD_NewLOD(); @@ -1794,19 +1470,16 @@ void __cdecl MM7Initialization(); int __cdecl AbortWithError(); void Abortf(const char *Format, ...); -void FreeSavegameThumbnails(); void SetCurrentMenuID(enum MENU_STATE); // idb enum MENU_STATE GetCurrentMenuID(); void *__thiscall output_debug_string(void *_this, std::string a2, const char *a3, int a4); std::string *__fastcall _4678E2_make_error_string(std::string *a1, int line, std::string file); -int __thiscall sub_467D5D(int _this); -void __thiscall sub_467E7F_EquipBody(unsigned int uEquipType); // idb +#include "Items.h" +void sub_467E7F_EquipBody(ITEM_EQUIP_TYPE uEquipType); // idb void CreateMsgScrollWindow(signed int mscroll_id); void __cdecl free_book_subwindow(); void CreateScrollWindow(); void __cdecl OnPaperdollLeftClick(); -int __thiscall UnprojectX(int x); -int __thiscall UnprojectY(int _this); void OnPressSpace(); char __fastcall DoInteractionWithTopmostZObject(int a1, int a2); int __fastcall sub_46A6AC(int a1, int a2, int a3);