# HG changeset patch # User Ritor1 # Date 1361675897 -21600 # Node ID 5e5dfedcc0add9c554285816caefa75054e18796 # Parent eaadcb39312ff277106455e5fbdf60e08ada4599# Parent 4f451a616d3d959cc007620899dd1953d4b22c34 Слияние diff -r eaadcb39312f -r 5e5dfedcc0ad AudioPlayer.h --- a/AudioPlayer.h Sun Feb 24 09:18:03 2013 +0600 +++ b/AudioPlayer.h Sun Feb 24 09:18:17 2013 +0600 @@ -98,6 +98,7 @@ SOUND_Arcomage_TowerUpgrade = 0x81, SOUND_Arcomage_WallUpgrade = 0x84, SOUND_GoldReceived = 0xC8, + SOUND_OpenChest = 208, SOUND_PlayerCantCastSpell = 0xD1, SOUND_Bell = 0xD9, SOUND_20001 = 0x4E21, diff -r eaadcb39312f -r 5e5dfedcc0ad Chest.cpp --- a/Chest.cpp Sun Feb 24 09:18:03 2013 +0600 +++ b/Chest.cpp Sun Feb 24 09:18:17 2013 +0600 @@ -1,4 +1,5 @@ #include +#include #include "Chest.h" #include "FrameTableInc.h" @@ -34,7 +35,7 @@ //----- (0042041E) -------------------------------------------------------- bool Chest::Open(unsigned int uChestID) { - char *v1; // edi@5 + //char *v1; // edi@5 unsigned int v2; // eax@8 GUIWindow *v3; // eax@15 int v5; // edx@16 @@ -66,7 +67,7 @@ int v31; // [sp+8Ch] [bp-38h]@16 int v32; // [sp+90h] [bp-34h]@16 float v33; // [sp+94h] [bp-30h]@23 - char *v34; // [sp+98h] [bp-2Ch]@5 + //char *v34; // [sp+98h] [bp-2Ch]@5 int v35; // [sp+9Ch] [bp-28h]@16 Vec3_int_ pOut; // [sp+A0h] [bp-24h]@28 int a4; // [sp+ACh] [bp-18h]@1 @@ -76,21 +77,25 @@ float v41; // [sp+BCh] [bp-8h]@23 int sRotY; // [sp+C0h] [bp-4h]@8 - a4 = uChestID; - if ( (uChestID & 0x80000000u) != 0 || (signed int)uChestID >= 20 ) - return 0; + //a4 = uChestID; + assert(uChestID < 20); + auto chest = pChests + uChestID; + ++pIcons_LOD->uTexturePacksCount; - if ( !pIcons_LOD->uNumPrevLoadedFiles ) + if (!pIcons_LOD->uNumPrevLoadedFiles) pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles; - v1 = (char *)&pChests[uChestID].uFlags; - v34 = v1; - if ( !(*v1 & CHEST_ITEMS_PLACED) ) + + + //v1 = (char *)&pChests[uChestID].uFlags; + //v34 = v1; + if (!chest->Initialized()) Chest::_420284(uChestID); + if ( !uActiveCharacter ) return 0; *(float *)&sRotY = 0.0; v2 = pMapStats->GetMapInfo(pCurrentMapName); - if ( !(*v1 & 1) || !v2 ) + if ( !chest->Trapped() || !v2 ) goto LABEL_12; if ( pPlayers[uActiveCharacter]->GetDisarmTrap() < 2 * pMapStats->pInfos[v2].LockX5 ) { @@ -206,7 +211,7 @@ a1.Create(0, 0, 0, 0); pAudioPlayer->PlaySound(SOUND_8, 0, 0, -1, 0, 0, 0, 0); a1._438E35(); - *v34 &= 0xFEu; + chest->SetInitialized(false);//*v34 &= 0xFEu; if ( uActiveCharacter && !qword_A750D8 && !dword_507CD8 ) { qword_A750D8 = 256i64; @@ -217,11 +222,11 @@ dword_507CD8 = 0; return 0; } - *v1 &= 0xFEu; + chest->SetInitialized(false);//*v1 &= 0xFEu; sRotY = 1; LABEL_12: pAudioPlayer->StopChannels(-1, -1); - pAudioPlayer->PlaySound((SoundID)208, 0, 0, -1, 0, 0, 0, 0); + pAudioPlayer->PlaySound(SOUND_OpenChest, 0, 0, -1, 0, 0, 0, 0); if ( *(float *)&sRotY != 0.0 ) { if ( !dword_507CD8 ) diff -r eaadcb39312f -r 5e5dfedcc0ad Chest.h --- a/Chest.h Sun Feb 24 09:18:03 2013 +0600 +++ b/Chest.h Sun Feb 24 09:18:17 2013 +0600 @@ -49,6 +49,10 @@ #pragma pack(push, 1) struct Chest { + inline bool Initialized() const {return uFlags & CHEST_ITEMS_PLACED;} + inline void SetInitialized(bool b) {if (b) uFlags |= CHEST_ITEMS_PLACED; else uFlags &= ~CHEST_ITEMS_PLACED;} + inline bool Trapped() const {return uFlags & CHEST_TRAPPED;} + static int CanPlaceItemAt(signed int a1, int a2, unsigned int uChestID); static int _41FF64(unsigned int uChestID); static int _41FFA2(int a1, ItemGen *a2, unsigned int uChestID); diff -r eaadcb39312f -r 5e5dfedcc0ad Events.cpp --- a/Events.cpp Sun Feb 24 09:18:03 2013 +0600 +++ b/Events.cpp Sun Feb 24 09:18:17 2013 +0600 @@ -30,10 +30,10 @@ EventIndex pSomeOtherEVT_Events[4400]; -unsigned int uSomeOtherEVT_NumEvents; +signed int uSomeOtherEVT_NumEvents; char *pSomeOtherEVT; EventIndex pSomeEVT_Events[4400]; -unsigned int uSomeEVT_NumEvents; +signed int uSomeEVT_NumEvents; char *pSomeEVT; unsigned int uGlobalEVT_NumEvents; @@ -44,7 +44,7 @@ unsigned int pLevelStrOffsets[500]; unsigned int uLevelStrNumStrings; unsigned int uLevelStrFileSize; -unsigned int uLevelEVT_NumEvents; +signed int uLevelEVT_NumEvents; unsigned int uLevelEVT_Size; char pLevelStr[9216]; char pLevelEVT[9216]; diff -r eaadcb39312f -r 5e5dfedcc0ad Events.h --- a/Events.h Sun Feb 24 09:18:03 2013 +0600 +++ b/Events.h Sun Feb 24 09:18:17 2013 +0600 @@ -105,14 +105,15 @@ EVENT_GiveItem = 0x29, EVENT_ChangeEvent = 0x2A, EVENT_CheckSkill = 0x2B, - EVENT_OnCanShowDialogItemCmp = 0x2C, - EVENT_EndCanShowDialogItem = 0x2D, - EVENT_SetCanShowDialogItem = 0x2E, + EVENT_OnCanShowDialogItemCmp = 44, + EVENT_EndCanShowDialogItem = 45, + EVENT_SetCanShowDialogItem = 46, EVENT_SetNPCGroupNews = 0x2F, EVENT_SetActorGroup = 0x30, EVENT_NPCSetItem = 0x31, EVENT_SetNPCGreeting = 0x32, EVENT_IsActorAlive = 0x33, + EVENT_IsActorAssasinated =52, EVENT_OnMapLeave = 0x35, EVENT_ChangeGroup = 0x36, EVENT_ChangeGroupAlly = 0x37, @@ -298,10 +299,10 @@ #define EVT_BYTE(x) (unsigned char)x extern EventIndex pSomeOtherEVT_Events[4400]; -extern unsigned int uSomeOtherEVT_NumEvents; +extern signed int uSomeOtherEVT_NumEvents; extern char *pSomeOtherEVT; extern EventIndex pSomeEVT_Events[4400]; -extern unsigned int uSomeEVT_NumEvents; +extern signed int uSomeEVT_NumEvents; extern char *pSomeEVT; extern unsigned int uGlobalEVT_NumEvents; @@ -312,7 +313,7 @@ extern unsigned int pLevelStrOffsets[500]; extern unsigned int uLevelStrNumStrings; extern unsigned int uLevelStrFileSize; -extern unsigned int uLevelEVT_NumEvents; +extern signed int uLevelEVT_NumEvents; extern unsigned int uLevelEVT_Size; extern char pLevelStr[9216]; extern char pLevelEVT[9216]; diff -r eaadcb39312f -r 5e5dfedcc0ad GUIProgressBar.cpp --- a/GUIProgressBar.cpp Sun Feb 24 09:18:03 2013 +0600 +++ b/GUIProgressBar.cpp Sun Feb 24 09:18:17 2013 +0600 @@ -17,8 +17,8 @@ -//----- (00443484) -------------------------------------------------------- -bool GUIProgressBar::_443484(Type type) +//----- (00Initialize) -------------------------------------------------------- +bool GUIProgressBar::Initialize(Type type) { //GUIProgressBar *v2; // esi@1 signed int v4; // eax@7 @@ -29,10 +29,17 @@ //unsigned int v9; // [sp-4h] [bp-80h]@20 char Str1[64]; // [sp+4h] [bp-78h]@16 - if (type < 1 || type > 1) + switch (type) { - __debugbreak(); - return false; + case TYPE_None: + return true; + + case TYPE_Box: + case TYPE_Fullscreen: + break; + + default: + assert(false && "Invalid GUIProgressBar type"); } //v2 = this; diff -r eaadcb39312f -r 5e5dfedcc0ad GUIProgressBar.h --- a/GUIProgressBar.h Sun Feb 24 09:18:03 2013 +0600 +++ b/GUIProgressBar.h Sun Feb 24 09:18:17 2013 +0600 @@ -8,10 +8,12 @@ { enum Type: unsigned __int32 { - TYPE_Fullscreen = 1 + TYPE_None = 0, + TYPE_Fullscreen = 1, + TYPE_Box = 2 }; - bool _443484(Type type); + bool Initialize(Type type); void Reset(unsigned __int8 uMaxProgress); void Progress(); void Release(); diff -r eaadcb39312f -r 5e5dfedcc0ad GUIWindow.cpp --- a/GUIWindow.cpp Sun Feb 24 09:18:03 2013 +0600 +++ b/GUIWindow.cpp Sun Feb 24 09:18:17 2013 +0600 @@ -1760,26 +1760,20 @@ //GUIWindow *pWindow; // esi@4 int v10; // eax@4 unsigned int v11; // ebx@15 - NPCData *v12; // ebp@15 - void *v13; // ecx@18 - bool v14; // eax@20 - void *v15; // ecx@23 - bool v16; // eax@25 - void *v17; // ecx@28 - bool v18; // eax@30 - void *v19; // ecx@33 - bool v20; // eax@35 - void *v21; // ecx@38 - bool v22; // eax@40 - void *v23; // ecx@43 - bool v24; // eax@45 + NPCData *speakingNPC; // ebp@15 + int v14; // eax@20 + int v16; // eax@25 + int v18; // eax@30 + int v20; // eax@35 + int v22; // eax@40 + int v24; // eax@45 int v25; // eax@65 unsigned int v26; // ebx@65 char *v27; // eax@71 const char *v29; // [sp-8h] [bp-18h]@68 char *v30; // [sp-4h] [bp-14h]@68 int uWidtha; // [sp+14h] [bp+4h]@66 - int a4a; // [sp+20h] [bp+10h]@15 + int num_menu_buttons; // [sp+20h] [bp+10h]@15 for (uNextFreeWindowID = 0; uNextFreeWindowID < 20; ++uNextFreeWindowID) { @@ -1819,95 +1813,89 @@ (Texture *)(uTextureID_506438 != -1 ? &pIcons_LOD->pTextures[uTextureID_506438] : 0), 0); if ( pWindow->ptr_1C != (void *)1 ) { - a4a = 0; + num_menu_buttons = 0; v11 = LOBYTE(pFontArrus->uFontHeight) - 3; - v12 = GetNPCData(uDialogue_SpeakingActorNPC_ID); + speakingNPC = GetNPCData(uDialogue_SpeakingActorNPC_ID); if ( sub_445C8B(uDialogue_SpeakingActorNPC_ID) == 1 ) { - if ( v12->joins ) + if ( speakingNPC->joins ) { pWindow->CreateButton(480, 130, 140, v11, 1, 0, 0x88u, 0xDu, 0, "", 0); - a4a = 1; + num_menu_buttons = 1; } - v13 = (void *)v12->evt_A; - if ( v13 ) + if ( speakingNPC->evt_A ) { - if ( a4a < 4 ) + if ( num_menu_buttons < 4 ) { - v14 = sub_4466C4(v13); + v14 = NPC_EventProcessor(speakingNPC->evt_A); if ( v14 == 1 || v14 == 2 ) - pWindow->CreateButton(0x1E0u, a4a++ * v11 + 130, 0x8Cu, v11, 1, 0, 0x88u, 0x13u, 0, "", 0); + pWindow->CreateButton(0x1E0u, num_menu_buttons++ * v11 + 130, 0x8Cu, v11, 1, 0, 0x88u, 0x13u, 0, "", 0); } } - v15 = (void *)v12->evt_B; - if ( v15 ) + if ( speakingNPC->evt_B ) { - if ( a4a < 4 ) + if ( num_menu_buttons < 4 ) { - v16 = sub_4466C4(v15); + v16 = NPC_EventProcessor(speakingNPC->evt_B); if ( v16 == 1 || v16 == 2 ) - pWindow->CreateButton(0x1E0u, a4a++ * v11 + 130, 0x8Cu, v11, 1, 0, 0x88u, 0x14u, 0, "", 0); + pWindow->CreateButton(0x1E0u, num_menu_buttons++ * v11 + 130, 0x8Cu, v11, 1, 0, 0x88u, 0x14u, 0, "", 0); } } - v17 = (void *)v12->evt_C; - if ( v17 ) + if ( speakingNPC->evt_C ) { - if ( a4a < 4 ) + if ( num_menu_buttons < 4 ) { - v18 = sub_4466C4(v17); + v18 = NPC_EventProcessor(speakingNPC->evt_C); if ( v18 == 1 || v18 == 2 ) - pWindow->CreateButton( 0x1E0u, a4a++ * v11 + 130, 0x8Cu, v11, 1, 0, 0x88u, 0x15u, 0, "", 0); + pWindow->CreateButton( 0x1E0u, num_menu_buttons++ * v11 + 130, 0x8Cu, v11, 1, 0, 0x88u, 0x15u, 0, "", 0); } } - v19 = (void *)v12->evt_D; - if ( v19 ) + if ( speakingNPC->evt_D ) { - if ( a4a < 4 ) + if ( num_menu_buttons < 4 ) { - v20 = sub_4466C4(v19); + v20 = NPC_EventProcessor(speakingNPC->evt_D); if ( v20 == 1 || v20 == 2 ) - pWindow->CreateButton(0x1E0u, a4a++ * v11 + 130, 0x8Cu, v11, 1, 0, 0x88u, 0x16u, 0, "", 0); + pWindow->CreateButton(0x1E0u, num_menu_buttons++ * v11 + 130, 0x8Cu, v11, 1, 0, 0x88u, 0x16u, 0, "", 0); } } - v21 = (void *)v12->evt_E; - if ( v21 ) + if ( speakingNPC->evt_E ) { - if ( a4a < 4 ) + if ( num_menu_buttons < 4 ) { - v22 = sub_4466C4(v21); + v22 = NPC_EventProcessor(speakingNPC->evt_E); if ( v22 == 1 || v22 == 2 ) - pWindow->CreateButton(0x1E0u, a4a++ * v11 + 130, 0x8Cu, v11, 1, 0, 0x88u, 0x17u, 0, "", 0); + pWindow->CreateButton(0x1E0u, num_menu_buttons++ * v11 + 130, 0x8Cu, v11, 1, 0, 0x88u, 0x17u, 0, "", 0); } } - v23 = (void *)v12->evt_F; - if ( v23 ) + if (speakingNPC->evt_F ) { - if ( a4a < 4 ) + if ( num_menu_buttons < 4 ) { - v24 = sub_4466C4(v23); + v24 = NPC_EventProcessor(speakingNPC->evt_F); if ( v24 == 1 || v24 == 2 ) - pWindow->CreateButton(0x1E0u, a4a++ * v11 + 130, 0x8Cu, v11, 1, 0, 0x88u, 0x18u, 0, "", 0); + pWindow->CreateButton(0x1E0u, num_menu_buttons++ * v11 + 130, 0x8Cu, v11, 1, 0, 0x88u, 0x18u, 0, "", 0); } } } else { - if ( v12->joins ) + if ( speakingNPC->joins ) { pWindow->CreateButton(0x1E0u, 0x82u, 0x8Cu, v11, 1, 0, 0x88u, 0x4Du, 0, pGlobalTXT_LocalizationStrings[407], 0);// - if (v12->Hired()) + if (speakingNPC->Hired()) { - sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[408], v12->pName); // + sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[408], speakingNPC->pName); // pWindow->CreateButton(0x1E0u, v11 + 130, 0x8Cu, v11, 1, 0, 0x88u, 0x4Cu, 0, pTmpBuf, 0); } else { pWindow->CreateButton(0x1E0u, v11 + 130, 0x8Cu, v11, 1, 0, 0x88u, 0x4Cu, 0, pGlobalTXT_LocalizationStrings[406], 0);// } - a4a = 2; + num_menu_buttons = 2; } } - pWindow->_41D08F(a4a, 1, 0, 1); + pWindow->_41D08F(num_menu_buttons, 1, 0, 1); } break; case WINDOW_ChangeLocation: @@ -1955,7 +1943,7 @@ if ( v26 + 1 == v25 && uHouse_ExitPic ) { v30 = pMapStats->pInfos[uHouse_ExitPic].pName; - v29 = (char*)pGlobalTXT_LocalizationStrings[411];// ^Pv[%s] + v29 = (char*)pGlobalTXT_LocalizationStrings[LOCSTR_ENTER_S];// ^Pv[%s] } else { @@ -1965,7 +1953,7 @@ //v27 = (char *)p2DEvents_minus1_::08[13 * a4]; v27 = (char *)p2DEvents[pButton - 1].pProprieterName; v30 = v27; - v29 = (char*)pGlobalTXT_LocalizationStrings[435];// ^Pt[%s] + v29 = (char*)pGlobalTXT_LocalizationStrings[435];// "Converse with %s" ^Pt[%s] } sprintf(&byte_591180[100 * v26], v29, v30); array_5913D8[v26 + 7] = (NPCData *)pWindow->CreateButton(pNPCPortraits_x[uNumDialogueNPCPortraits - 1][v26], diff -r eaadcb39312f -r 5e5dfedcc0ad GUIWindow.h --- a/GUIWindow.h Sun Feb 24 09:18:03 2013 +0600 +++ b/GUIWindow.h Sun Feb 24 09:18:17 2013 +0600 @@ -309,7 +309,7 @@ UIMSG_195 = 0x195, UIMSG_OpenRestUI = 0x199, UIMSG_19A = 0x19A, - UIMSG_19B = 0x19B, + UIMSG_TransitionUI_Confirm = 0x19B, UIMSG_19C = 0x19C, UIMSG_OpenKeyMappingOptions = 0x19F, UIMSG_SelectKeyPage1 = 0x1A0, diff -r eaadcb39312f -r 5e5dfedcc0ad Game.cpp --- a/Game.cpp Sun Feb 24 09:18:03 2013 +0600 +++ b/Game.cpp Sun Feb 24 09:18:17 2013 +0600 @@ -170,7 +170,7 @@ GUI_UpdateWindows(); pParty->UpdatePlayersAndHirelingsEmotions(); ++stru_51076C.field_8; - dword_5B5924 = 0; + _unused_5B5924_is_travel_ui_drawn = false; if (v4) pMouse->field_14 = 1; pMouse->_469EA4(); diff -r eaadcb39312f -r 5e5dfedcc0ad GameUIs.cpp --- a/GameUIs.cpp Sun Feb 24 09:18:03 2013 +0600 +++ b/GameUIs.cpp Sun Feb 24 09:18:17 2013 +0600 @@ -35,7 +35,6 @@ uDialogueType_ = uDialogueType; dword_6BE138 = -1; ++pIcons_LOD->uTexturePacksCount; - v16 = 0; if ( !pIcons_LOD->uNumPrevLoadedFiles ) pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles; memset(pSavegameUsedSlots, 0, sizeof(pSavegameUsedSlots)); @@ -82,11 +81,7 @@ //v3 = 0; for (uint i = 0; i < uNumSavegameFiles; ++i) { - //Dest = pSavegameHeader; - //pTex = pSavegameThumbnails; - //Str1 = (const char *)pSavegameList->pSavesNames; - //while ( 1 ) - //{ + sprintf(pTmpBuf, "saves\\%s", pSavegameList->pFileList[i].pSaveFileName); if (_access(pTmpBuf, 6)) { @@ -112,33 +107,20 @@ pLODFile.CloseWriteFile(); pSavegameUsedSlots[i] = 1; } -//LABEL_23: - //Str1 += 280; - //++pTex; - //++Dest; - //++v3; - //if ( v3 >= (signed int)uNumSavegameFiles ) - // goto LABEL_24; - //} - //goto LABEL_22; } //LABEL_24: pLODFile.FreeSubIndexAndIO(); if ( pCurrentScreen == SCREEN_SAVEGAME ) { - v6 = pIcons_LOD->LoadTexture("x_d", TEXTURE_16BIT_PALETTE); - v10 = (TEXTURE_TYPE)2; - v8 = "LS_saveD"; + uTextureID_x_d = pIcons_LOD->LoadTexture("x_d", TEXTURE_16BIT_PALETTE); + uTextureID_LS_ = pIcons_LOD->LoadTexture("LS_saveD",TEXTURE_16BIT_PALETTE); } else { - v6 = pIcons_LOD->LoadTexture("x_d", TEXTURE_16BIT_PALETTE); - v10 = (TEXTURE_TYPE)2; - v8 = "LS_loadD"; + uTextureID_x_d = pIcons_LOD->LoadTexture("x_d", TEXTURE_16BIT_PALETTE); + uTextureID_LS_ = pIcons_LOD->LoadTexture("LS_loadD",TEXTURE_16BIT_PALETTE); } - uTextureID_x_d = v6; - uTextureID_LS_ = pIcons_LOD->LoadTexture(v8, v10); uTextureID_AR_UP_DN = pIcons_LOD->LoadTexture("AR_UP_DN", TEXTURE_16BIT_PALETTE); uTextureID_AR_DN_DN = pIcons_LOD->LoadTexture("AR_DN_DN", TEXTURE_16BIT_PALETTE); pGUIWindow_CurrentMenu->CreateButton(21, 198, 191, 18, 1, 0, 0xA5, 0, 0, "", 0); @@ -156,8 +138,7 @@ (Texture *)(uTextureID_AR_UP_DN != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_AR_UP_DN] : 0), 0); pBtnDownArrow = pGUIWindow_CurrentMenu->CreateButton(215, 0x143, 0x11, 0x11, 1, 0, 0xA3, uNumSavegameFiles, 0, "", (Texture *)(uTextureID_AR_DN_DN != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_AR_DN_DN] : 0), 0); - v16 = -1; - //ptr_69BD58 = v7; + } //----- (0045E93E) -------------------------------------------------------- diff -r eaadcb39312f -r 5e5dfedcc0ad Indoor.cpp --- a/Indoor.cpp Sun Feb 24 09:18:03 2013 +0600 +++ b/Indoor.cpp Sun Feb 24 09:18:17 2013 +0600 @@ -1794,15 +1794,10 @@ const char *v1; // edi@1 signed int v2; // esi@1 - v1 = Str1; - v2 = 0; - while ( _strcmpi(v1, _4E6BDC_loc_names[v2]) ) - { - ++v2; - if ( v2 >= 11 ) - return 0; - } - return v2 + 1; + for (uint i = 0; i < 11; ++i) + if (!strcmpi(Str1, _4E6BDC_loc_names[i])) + return i + 1; + return 0; } @@ -2890,7 +2885,7 @@ { memcpy(v203, pData, 0x36B); LABEL_132: - free(File); + free(pRawDLV); dlv.uLastRepawnDay = a3; if (_v244) ++dlv.uNumRespawns; @@ -2901,7 +2896,7 @@ auto v155 = header.uCompressedSize; auto Count = header.uDecompressedSize; auto Src = (BLVFace *)malloc(header.uDecompressedSize); - File = (FILE *)Src; + pRawDLV = Src; if ( v155 <= Count ) { if ( v155 == Count ) @@ -3458,32 +3453,27 @@ } //----- (0044C23B) -------------------------------------------------------- -int BLVFaceExtra::HasEventint() -{ - signed int v1; // eax@1 - EventIndex *v2; // esi@2 - signed int result; // eax@5 - signed int v4; // eax@6 - - v1 = 0; - if ( (signed int)(uLevelEVT_NumEvents - 1) <= 0 ) - goto LABEL_5; - v2 = pLevelEVT_Index; - while ( v2->uEventID != this->uEventID ) +bool BLVFaceExtra::HasEventint() + { + signed int event_index; // eax@1 + _evt_raw* start_evt; + _evt_raw* end_evt; + + event_index = 0; + if ( (uLevelEVT_NumEvents - 1) <= 0 ) + return false; + while ( pLevelEVT_Index[event_index].uEventID != this->uEventID ) { - ++v1; - ++v2; - if ( v1 >= (signed int)(uLevelEVT_NumEvents - 1) ) - goto LABEL_5; + ++event_index; + if ( event_index >= (signed int)(uLevelEVT_NumEvents - 1) ) + return false; } - v4 = v1; - if ( pLevelEVT[pLevelEVT_Index[v4 + 1].uEventOffsetInEVT + 4] != 1 - || pLevelEVT[pLevelEVT_Index[v4].uEventOffsetInEVT + 4] != 4 ) -LABEL_5: - result = 0; + end_evt=(_evt_raw*)&pLevelEVT[pLevelEVT_Index[event_index+1].uEventOffsetInEVT]; + start_evt=(_evt_raw*)&pLevelEVT[pLevelEVT_Index[event_index].uEventOffsetInEVT]; + if ( (end_evt->_e_type != EVENT_Exit) || (start_evt->_e_type!= EVENT_MouseOver) ) + return false; else - result = 1; - return result; + return true; } diff -r eaadcb39312f -r 5e5dfedcc0ad Indoor.h --- a/Indoor.h Sun Feb 24 09:18:03 2013 +0600 +++ b/Indoor.h Sun Feb 24 09:18:17 2013 +0600 @@ -316,7 +316,7 @@ #pragma pack(push, 1) struct BLVFaceExtra { - int HasEventint(); +bool HasEventint(); __int16 field_0; __int16 field_2; diff -r eaadcb39312f -r 5e5dfedcc0ad LOD.h --- a/LOD.h Sun Feb 24 09:18:03 2013 +0600 +++ b/LOD.h Sun Feb 24 09:18:17 2013 +0600 @@ -1,6 +1,7 @@ #pragma once #include #include +#include #include "Texture.h" @@ -158,6 +159,14 @@ void _4114F2(); void _4355F7(); + inline Texture *GetTexture(int idx) + { + assert(idx < 1000); + if (idx == -1) + return nullptr; + return pTextures + idx; + } + /*FILE *pFile; unsigned __int8 pLODName[256]; diff -r eaadcb39312f -r 5e5dfedcc0ad LayingItem.cpp --- a/LayingItem.cpp Sun Feb 24 09:18:03 2013 +0600 +++ b/LayingItem.cpp Sun Feb 24 09:18:17 2013 +0600 @@ -107,7 +107,7 @@ //----- (0042F933) -------------------------------------------------------- -void LayingItem::_42F933(unsigned int uLayingItemID) +void LayingItem::OnItemPickup(unsigned int uLayingItemID) { unsigned int v1; // ecx@1 unsigned __int16 *pAttributes; // ecx@2 diff -r eaadcb39312f -r 5e5dfedcc0ad LayingItem.h --- a/LayingItem.h Sun Feb 24 09:18:03 2013 +0600 +++ b/LayingItem.h Sun Feb 24 09:18:17 2013 +0600 @@ -2,11 +2,18 @@ #include "VectorTypes.h" #include "Items.h" +enum +{ + OBJECT_ATTACHED_TO_ACTOR = 0x80, +}; + /* 72 */ #pragma pack(push, 1) struct LayingItem { + inline bool AttachedToActor() const {return uAttributes & OBJECT_ATTACHED_TO_ACTOR;} + LayingItem(); int Create(int yaw, int pitch, int a4, int a5); void _46BEF1_apply_spells(); @@ -14,7 +21,7 @@ static void UpdateObject_fn0_BLV(unsigned int uLayingItemID); static void UpdateObject_fn0_ODM(unsigned int uLayingItemID); - static void _42F933(unsigned int uLayingItemID); + static void OnItemPickup(unsigned int uLayingItemID); unsigned __int16 uItemType; @@ -27,7 +34,7 @@ __int16 uSectorID; unsigned __int16 uSpriteFrameID; __int16 field_20; - __int16 field_22; + __int16 field_22_glow_radius_multiplier; struct ItemGen stru_24; int field_48; int field_4C; diff -r eaadcb39312f -r 5e5dfedcc0ad NPC.cpp --- a/NPC.cpp Sun Feb 24 09:18:03 2013 +0600 +++ b/NPC.cpp Sun Feb 24 09:18:17 2013 +0600 @@ -922,7 +922,7 @@ if (temp_str_len) { if ( decode_step == 1) - pTransitionStrings[i]=RemoveQuotes(test_string); + pTransitionStrings[i + 1]=RemoveQuotes(test_string); } else { diff -r eaadcb39312f -r 5e5dfedcc0ad ObjectList.h --- a/ObjectList.h Sun Feb 24 09:18:03 2013 +0600 +++ b/ObjectList.h Sun Feb 24 09:18:17 2013 +0600 @@ -26,6 +26,8 @@ #pragma pack(push, 1) struct ObjectDesc { + inline bool NoSprite() const {return uFlags & OBJECT_DESC_NO_SPRITE;} + char field_0[32]; __int16 uObjectID; __int16 uRadius; diff -r eaadcb39312f -r 5e5dfedcc0ad Outdoor.cpp --- a/Outdoor.cpp Sun Feb 24 09:18:03 2013 +0600 +++ b/Outdoor.cpp Sun Feb 24 09:18:17 2013 +0600 @@ -2223,14 +2223,11 @@ pGameLoadingUI_ProgressBar->Progress(); memcpy(&uNumLayingItems, pSrc, 4); - //v93 = (char *)v92 + 4; - if (uNumLayingItems > 1000) - MessageBoxW(nullptr, L"Can't load file!", - L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Odmap.cpp:954", 0); + assert(uNumLayingItems <= 1000 && "Too many objects"); + assert(sizeof(LayingItem) == 112); pGameLoadingUI_ProgressBar->Progress(); - assert(sizeof(LayingItem) == 112); //pFilename = (char *)(112 * uNumLayingItems); memcpy(pLayingItems, pSrc + 4, uNumLayingItems * sizeof(LayingItem)); pSrc += 4 + uNumLayingItems * sizeof(LayingItem); @@ -3111,9 +3108,9 @@ } v28->uScreenSpaceX = v27; v28->uScreenSpaceY = v46; - v28->some_x = x; - v28->some_y = y; - v28->some_z = z; + v28->world_x = x; + v28->world_y = y; + v28->world_z = z; HIWORD(v34) = HIWORD(X); LOWORD(v34) = 0; v28->uPaletteSubindex = 0; @@ -3143,28 +3140,23 @@ //----- (0044C1E8) -------------------------------------------------------- bool ODMFace::HasEventHint() { - signed int v1; // eax@1 - EventIndex *v2; // esi@2 - bool result; // eax@5 - signed int v4; // eax@6 + signed int event_index; // eax@1 + _evt_raw* start_evt; + _evt_raw* end_evt; - v1 = 0; - if ( (signed int)(uLevelEVT_NumEvents - 1) <= 0 ) - goto LABEL_5; - v2 = pLevelEVT_Index; - while ( v2->uEventID != this->sCogTriggeredID ) + event_index = 0; + if ( (uLevelEVT_NumEvents - 1) <= 0 ) + return false; + while ( pLevelEVT_Index[event_index].uEventID != this->sCogTriggeredID ) { - ++v1; - ++v2; - if ( v1 >= (signed int)(uLevelEVT_NumEvents - 1) ) - goto LABEL_5; + ++event_index; + if ( event_index >= (signed int)(uLevelEVT_NumEvents - 1) ) + return false; } - v4 = v1; - if ( pLevelEVT[pLevelEVT_Index[v4 + 1].uEventOffsetInEVT + 4] != 1 - || pLevelEVT[pLevelEVT_Index[v4].uEventOffsetInEVT + 4] != 4 ) -LABEL_5: - result = 0; + end_evt=(_evt_raw*)&pLevelEVT[pLevelEVT_Index[event_index+1].uEventOffsetInEVT]; + start_evt=(_evt_raw*)&pLevelEVT[pLevelEVT_Index[event_index].uEventOffsetInEVT]; + if ( (end_evt->_e_type != EVENT_Exit) || (start_evt->_e_type!= EVENT_MouseOver) ) + return false; else - result = 1; - return result; + return true; } \ No newline at end of file diff -r eaadcb39312f -r 5e5dfedcc0ad Render.cpp --- a/Render.cpp Sun Feb 24 09:18:03 2013 +0600 +++ b/Render.cpp Sun Feb 24 09:18:17 2013 +0600 @@ -3053,17 +3053,17 @@ void Render::DrawLayingItems_Shooting_Magic_ODM() { //char *v0; // edi@2 - ObjectDesc *v1; // ebx@4 + //ObjectDesc *v1; // ebx@4 __int16 v2; // cx@5 RenderBillboard *v3; // esi@10 SpriteFrame *v4; // eax@10 - SpriteFrame *v5; // ebx@10 + //SpriteFrame *v5; // ebx@10 unsigned int v6; // eax@10 - int v7; // ecx@10 - int v8; // edx@10 + //int v7; // ecx@10 + //int v8; // edx@10 int v9; // ecx@10 unsigned __int16 v10; // ax@10 - int *v11; // eax@14 + //int *v11; // eax@14 int v12; // eax@22 int v13; // ST3C_4@23 int v14; // eax@23 @@ -3080,8 +3080,8 @@ int v25; // ST3C_4@30 int v26; // eax@31 char v27; // zf@31 - SpriteFrame *v28; // [sp+Ch] [bp-34h]@10 - __int16 a5; // [sp+10h] [bp-30h]@10 + //SpriteFrame *v28; // [sp+Ch] [bp-34h]@10 + //__int16 a5; // [sp+10h] [bp-30h]@10 int v30; // [sp+14h] [bp-2Ch]@23 int v31; // [sp+14h] [bp-2Ch]@29 __int16 v32; // [sp+14h] [bp-2Ch]@30 @@ -3103,56 +3103,61 @@ //v41 = 0; for (int i = 0; i < uNumLayingItems; ++i) { - auto v0 = (char *)&pLayingItems[i].uSectorID; + auto object = pLayingItems + i; + //auto v0 = (char *)&pLayingItems[i].uSectorID; //v0 = (char *)&pLayingItems[0].uSectorID; //do //{ - if ( *((short *)v0 - 13) ) - { - v1 = &pObjectList->pObjects[*((short *)v0 - 13)]; - if ( !(v1->uFlags & 1) ) - { - if ( ((v2 = *((short *)v0 - 14), v2 < 1000) || v2 >= 10000) && (v2 < 500 || v2 >= 600) - || pGame->pStru6Instance->_4A81CA((LayingItem *)(v0 - 28)) ) - { - a5 = *(short *)v0; - x = *((int *)v0 - 6); - y = *((int *)v0 - 5); - z = *((int *)v0 - 4); - v3 = &pBillboardRenderList[::uNumBillboardsToDraw]; - v4 = pSpriteFrameTable->GetFrame(v1->uSpriteID, *((short *)v0 + 1)); - v5 = v4; - v28 = v4; - v36 = v4->uFlags; - a6 = v4->uGlowRadius * *((short *)v0 + 3); - v6 = stru_5C6E00->Atan2( - *((int *)v0 - 6) - pIndoorCamera->pos.x, - *((int *)v0 - 5) - pIndoorCamera->pos.y); - LOWORD(v7) = *((short *)v0 - 3); - v8 = v36; - v9 = ((signed int)(stru_5C6E00->uIntegerPi + ((signed int)stru_5C6E00->uIntegerPi >> 3) + v7 - v6) >> 8) & 7; - v10 = v5->pHwSpriteIDs[v9]; + if (!object->uObjectDescID) // item probably pciked up + continue; + + assert(object->uObjectDescID < pObjectList->uNumObjects); + auto object_desc = pObjectList->pObjects + object->uObjectDescID; + if (object_desc->NoSprite()) + continue; + + //v1 = &pObjectList->pObjects[*((short *)v0 - 13)]; + //if ( !(v1->uFlags & 1) ) + //{ + //v2 = *((short *)v0 - 14) + v2 = object->uItemType; + if ( (v2 < 1000 || v2 >= 10000) && (v2 < 500 || v2 >= 600) || pGame->pStru6Instance->_4A81CA(object) ) + { + //a5 = *(short *)v0; + x = object->vPosition.x; + y = object->vPosition.y; + z = object->vPosition.z; + v3 = &pBillboardRenderList[::uNumBillboardsToDraw]; + v4 = pSpriteFrameTable->GetFrame(object_desc->uSpriteID, object->uSpriteFrameID); + //v5 = v4; + //v28 = v4; + v36 = v4->uFlags; + a6 = v4->uGlowRadius * object->field_22_glow_radius_multiplier; + v6 = stru_5C6E00->Atan2(object->vPosition.x - pIndoorCamera->pos.x, object->vPosition.y - pIndoorCamera->pos.y); + //LOWORD(v7) = object->uFacing; + //v8 = v36; + v9 = ((signed int)(stru_5C6E00->uIntegerPi + ((signed int)stru_5C6E00->uIntegerPi >> 3) + object->uFacing - v6) >> 8) & 7; + v10 = v4->pHwSpriteIDs[v9]; v3->uHwSpriteID = v10; if ( v36 & 0x20 ) { - v8 = v36; - z -= (signed int)((unsigned __int64)(v5->scale - * (signed __int64)pSprites_LOD->pSpriteHeaders[(signed __int16)v10].uHeight) >> 16) >> 1; + //v8 = v36; + z -= (signed int)((unsigned __int64)(v4->scale * (signed __int64)pSprites_LOD->pSpriteHeaders[(signed __int16)v10].uHeight) >> 16) >> 1; } v46 = 0; - if ( v8 & 2 ) + if ( v36 & 2 ) v46 = 2; - v11 = (int *)(256 << v9); - if ( (256 << v9) & v8 ) + //v11 = (int *)(256 << v9); + if ( (256 << v9) & v36 ) v46 |= 4u; - if ( v8 & 0x40000 ) + if ( v36 & 0x40000 ) v46 |= 0x40u; - if ( v8 & 0x20000 ) + if ( v36 & 0x20000 ) LOBYTE(v46) = v46 | 0x80; if ( a6 ) { - LOBYTE(v11) = byte_4E94D3; - pMobileLightsStack->AddLight(x, y, z, a5, a6, 0xFFu, 0xFFu, 0xFFu, byte_4E94D3); + //LOBYTE(v11) = byte_4E94D3; + pMobileLightsStack->AddLight(x, y, z, object->uSectorID, a6, 0xFFu, 0xFFu, 0xFFu, byte_4E94D3); } v12 = (x - pIndoorCamera->pos.x) << 16; if ( pIndoorCamera->sRotationX ) @@ -3185,12 +3190,9 @@ v42 = v20 + v19; if ( v20 + v19 >= 262144 && v16 <= pOutdoorCamera->shading_dist_mist << 16 ) { - v21 = (unsigned __int64)(((x - pIndoorCamera->pos.x) << 16) - * (signed __int64)pOutdoorCamera->camera_rotation_y_int_sine) >> 16; - v17 = ((unsigned __int64)(v34 * (signed __int64)pOutdoorCamera->camera_rotation_y_int_cosine) >> 16) - - v21; - v40 = ((unsigned __int64)(v34 * (signed __int64)pOutdoorCamera->camera_rotation_y_int_cosine) >> 16) - - v21; + v21 = (unsigned __int64)(((x - pIndoorCamera->pos.x) << 16) * (signed __int64)pOutdoorCamera->camera_rotation_y_int_sine) >> 16; + v17 = ((unsigned __int64)(v34 * (signed __int64)pOutdoorCamera->camera_rotation_y_int_cosine) >> 16) - v21; + v40 = ((unsigned __int64)(v34 * (signed __int64)pOutdoorCamera->camera_rotation_y_int_cosine) >> 16) - v21; v18 = (z - pIndoorCamera->pos.z) << 16; LABEL_29: v31 = v18; @@ -3203,30 +3205,31 @@ v25 = v23 / v42; LODWORD(v23) = 0; HIDWORD(v23) = SLOWORD(pOutdoorCamera->int_fov_rad); - v35 = pViewport->uScreenCenterX - - ((signed int)(((unsigned __int64)(v25 * (signed __int64)v40) >> 16) + 32768) >> 16); - v32 = LOWORD(pViewport->uScreenCenterY) - - (((unsigned int)((unsigned __int64)(v23 / v42 * v31) >> 16) + 32768) >> 16); - if (::uNumBillboardsToDraw >= 500) - return; + v35 = pViewport->uScreenCenterX - ((signed int)(((unsigned __int64)(v25 * (signed __int64)v40) >> 16) + 32768) >> 16); + v32 = LOWORD(pViewport->uScreenCenterY) - (((unsigned int)((unsigned __int64)(v23 / v42 * v31) >> 16) + 32768) >> 16); + + //if (::uNumBillboardsToDraw >= 500) + // return; + assert(::uNumBillboardsToDraw < 500); ++::uNumBillboardsToDraw; ++uNumSpritesDrawnThisFrame; - *(v0 - 2) |= 1u; - v3->uPalette = v28->uPaletteIndex; - v3->uIndoorSectorID = a5; - v3->_screenspace_x_scaler_packedfloat = (unsigned __int64)(v28->scale * (signed __int64)v24) >> 16; - v26 = (unsigned __int64)(v28->scale * (signed __int64)v24) >> 16; - v3->pSpriteFrame = v28; + + object->uAttributes |= 1; + v3->uPalette = v4->uPaletteIndex; + v3->uIndoorSectorID = object->uSectorID; + v3->_screenspace_x_scaler_packedfloat = (unsigned __int64)(v4->scale * (signed __int64)v24) >> 16; + v26 = (unsigned __int64)(v4->scale * (signed __int64)v24) >> 16; + v3->pSpriteFrame = v4; v3->_screenspace_y_scaler_packedfloat = v26; v3->field_1E = v46; - v3->some_x = x; - v3->some_y = y; - v3->some_z = z; + v3->world_x = x; + v3->world_y = y; + v3->world_z = z; v3->uScreenSpaceX = v35; v3->uScreenSpaceY = v32; HIWORD(v26) = HIWORD(v42); LOWORD(v26) = 0; - v27 = (*(v0 - 2) & 0x20) == 0; + v27 = (object->uAttributes & 0x20) == 0; v3->sZValue = v26 + (8 * i | OBJECT_Item); v3->uPaletteSubindex = 0; v3->uTintColor = 0; @@ -3240,8 +3243,7 @@ } } } - } - } + //} LABEL_34: ; //++v41; @@ -3659,9 +3661,9 @@ HIBYTE(v29) |= 2u; v27->uPalette = v28; v27->field_1E = v29; - v27->some_x = x; - v27->some_y = y; - v27->some_z = v36; + v27->world_x = x; + v27->world_y = y; + v27->world_z = v36; v27->uScreenSpaceY = v40; HIWORD(v30) = HIWORD(v39); v31 = 8 * i | OBJECT_Decoration; diff -r eaadcb39312f -r 5e5dfedcc0ad Render.h --- a/Render.h Sun Feb 24 09:18:03 2013 +0600 +++ b/Render.h Sun Feb 24 09:18:17 2013 +0600 @@ -70,9 +70,9 @@ __int16 uPalette; __int16 uIndoorSectorID; __int16 field_1E; - __int16 some_x; - __int16 some_y; - __int16 some_z; + __int16 world_x; + __int16 world_y; + __int16 world_z; __int16 uScreenSpaceX; __int16 uScreenSpaceY; unsigned __int16 uPaletteSubindex; diff -r eaadcb39312f -r 5e5dfedcc0ad mm7_1.cpp --- a/mm7_1.cpp Sun Feb 24 09:18:03 2013 +0600 +++ b/mm7_1.cpp Sun Feb 24 09:18:17 2013 +0600 @@ -4251,7 +4251,7 @@ uLastPointedObjectID = pMouse->uPointingObjectID; return; } - v22 = _444732_GetEventHintString(v25); + v22 = GetEventHintString(v25); if ( !v22 ) //goto _return; { @@ -4289,7 +4289,7 @@ { v21 = pOutdoor->pBModels[(signed int)(unsigned __int16)v18 >> 9].pFaces[v19 & 0x3F].sCogTriggeredID; //goto LABEL_71; - if ( !v21 || (v22 = _444732_GetEventHintString(v21)) == 0 ) + if ( !v21 || (v22 = GetEventHintString(v21)) == 0 ) //goto LABEL_73; { pMouse->uPointingObjectID = 0; @@ -4326,7 +4326,7 @@ { v21 = pIndoor->pFaceExtras[pFace->uFaceExtraID].uEventID; //LABEL_71: - if ( !v21 || (v22 = _444732_GetEventHintString(v21)) == 0 ) + if ( !v21 || (v22 = GetEventHintString(v21)) == 0 ) //goto LABEL_73; { pMouse->uPointingObjectID = 0; @@ -5249,7 +5249,7 @@ if ( !pParty->AddItem(v22) ) pParty->SetHoldingItem(v22); } - LayingItem::_42F933(a2.y); + LayingItem::OnItemPickup(a2.y); return; } goto LABEL_13; diff -r eaadcb39312f -r 5e5dfedcc0ad mm7_2.cpp --- a/mm7_2.cpp Sun Feb 24 09:18:03 2013 +0600 +++ b/mm7_2.cpp Sun Feb 24 09:18:17 2013 +0600 @@ -3680,24 +3680,15 @@ //----- (004BCA33) -------------------------------------------------------- -GUIButton *__cdecl sub_4BCA33() +GUIButton *__cdecl UI_CreateEndConversationButton() { pDialogueWindow->Release(); - pDialogueWindow = GUIWindow::Create(0, 0, 640, 0x159u, WINDOW_MainMenu, 0, 0); - pBtn_ExitCancel = pDialogueWindow->CreateButton( - 0x1D7u, - 0x1BDu, - 0xA9u, - 0x23u, - 1, - 0, - 0x71u, - 0, - 0, - pGlobalTXT_LocalizationStrings[74], - (Texture *)(uTextureID_506438 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_506438] : 0), + pDialogueWindow = GUIWindow::Create(0, 0, 640, 345, WINDOW_MainMenu, 0, 0); + pBtn_ExitCancel = pDialogueWindow->CreateButton( 471, 445, 169, 35, 1, 0, 0x71u, 0, 0, + pGlobalTXT_LocalizationStrings[74], //"End Conversation" + (Texture *)(uTextureID_506438 != -1 ? &pIcons_LOD->pTextures[uTextureID_506438] : NULL), 0); - return pDialogueWindow->CreateButton(8u, 8u, 0x1C2u, 0x140u, 1, 0, 0x51u, 0, 0, "", 0); + return pDialogueWindow->CreateButton(8, 8, 450, 320, 1, 0, 0x51u, 0, 0, "", 0); } //----- (004BCACC) -------------------------------------------------------- @@ -4091,12 +4082,12 @@ { case 96: pDialogueWindow->eWindowType = WINDOW_MainMenu; - sub_4BCA33(); + UI_CreateEndConversationButton(); sub_4B3703((void *)dword_F8B198); break; case 101: pDialogueWindow->eWindowType = WINDOW_MainMenu; - sub_4BCA33(); + UI_CreateEndConversationButton(); sub_4B3A72(dword_F8B198); break; case 102: @@ -4182,7 +4173,7 @@ if ( a1 == 94 ) { pDialogueWindow->eWindowType = WINDOW_MainMenu; - sub_4BCA33(); + UI_CreateEndConversationButton(); sub_4B3AD4(dword_F8B198); } } @@ -4344,7 +4335,7 @@ { if ( v0 == 3 || v0 == 5 || v0 == 4 ) { - sub_4BCA33(); + UI_CreateEndConversationButton(); dword_F8B19C = 94; sub_4B3AD4(dword_F8B198); } @@ -4359,14 +4350,14 @@ return 1; } pVideoPlayer->_4BF5B2(); - sub_4BCA33(); + UI_CreateEndConversationButton(); dword_F8B19C = 101; sub_4B3A72(dword_F8B198); } return 1; } pVideoPlayer->_4BF5B2(); - sub_4BCA33(); + UI_CreateEndConversationButton(); goto LABEL_28; } array_5913D8[6] = 0; @@ -12433,7 +12424,7 @@ v9 = bLoading; ResetCursor_Palettes_LODs_Level_Audio_SFT_Windows(); pDecalBuilder->Reset(0); - pGameLoadingUI_ProgressBar->_443484((GUIProgressBar::Type)v2); + pGameLoadingUI_ProgressBar->Initialize((GUIProgressBar::Type)v2); strcpy(Str1, pCurrentMapName); v3 = strtok(Str1, "."); strcpy(Str1, v3); @@ -15164,7 +15155,7 @@ v2 = a1; switch ( a1 & 7 ) { - case OBJECT_Item: + case OBJECT_Item: // take the item v17 = a1 >> 3; v26 = a1 >> 3; v18 = a1 >> 3; @@ -15174,7 +15165,7 @@ return 1; v19 = &pLayingItems[v18].stru_24; v20 = pLayingItems[v18].stru_24.uItemID; - if ( pItemsTable->pItems[v20].uEquipType == 18 ) + if ( pItemsTable->pItems[v20].uEquipType == EQUIP_GOLD) { party_finds_gold(v19->uSpecEnchantmentType, 0); viewparams->bRedrawGameUI = 1; @@ -15195,7 +15186,7 @@ pParty->SetHoldingItem(v19); v21 = v26; } - LayingItem::_42F933(v21); + LayingItem::OnItemPickup(v21); break; case OBJECT_Actor: @@ -15705,7 +15696,7 @@ } if ( v22 ) { - v23 = _444732_GetEventHintString(v22); + v23 = GetEventHintString(v22); if ( v23 ) goto LABEL_36; } @@ -15720,7 +15711,7 @@ v27 = v25->field_16_event_id; if ( v27 ) { - v23 = _444732_GetEventHintString(v27); + v23 = GetEventHintString(v27); if ( !v23 ) return v19; goto LABEL_36; @@ -16126,7 +16117,7 @@ } v2->uObjectDescID = v112; if ( !v112 ) - LayingItem::_42F933(v153); + LayingItem::OnItemPickup(v153); v2->vVelocity.z = 0; v2->vVelocity.y = 0; v2->vVelocity.x = 0; @@ -16149,7 +16140,7 @@ goto LABEL_269; } LABEL_246: - LayingItem::_42F933(v153); + LayingItem::OnItemPickup(v153); return 0; } v106 = v145; @@ -16296,7 +16287,7 @@ } v2->uObjectDescID = v58; if ( !v58 ) - LayingItem::_42F933(v153); + LayingItem::OnItemPickup(v153); v14 = v153; v2->vVelocity.z = 0; v2->vVelocity.y = 0; @@ -16352,7 +16343,7 @@ } v2->uObjectDescID = v63; if ( !v63 ) - LayingItem::_42F933(v153); + LayingItem::OnItemPickup(v153); v64 = v2->uFacing - stru_5C6E00->uIntegerDoublePi; v44 = v2->field_50 == 4; v2->vVelocity.z = 0; @@ -16375,7 +16366,7 @@ LABEL_160: v14 = v153; LABEL_34: - LayingItem::_42F933(v14); + LayingItem::OnItemPickup(v14); goto LABEL_35; } if ( v151 == 6 || v151 == 5 || (v66 = 0, !v151) ) @@ -16405,7 +16396,7 @@ } v2->uObjectDescID = v71; if ( !v71 ) - LayingItem::_42F933(v153); + LayingItem::OnItemPickup(v153); v134 = 0; v72 = v153; v132 = 0; @@ -16461,7 +16452,7 @@ } v2->uObjectDescID = v88; if ( !v88 ) - LayingItem::_42F933(v153); + LayingItem::OnItemPickup(v153); v89 = v2->uFacing - stru_5C6E00->uIntegerDoublePi; v2->vVelocity.z = 0; v2->vVelocity.y = 0; @@ -16508,7 +16499,7 @@ } v2->uObjectDescID = v83; if ( !v83 ) - LayingItem::_42F933(v153); + LayingItem::OnItemPickup(v153); v134 = 0; v72 = v153; v132 = v2->field_61; @@ -16553,7 +16544,7 @@ LABEL_42: v2->uObjectDescID = v22; if ( v22 == v18 ) - LayingItem::_42F933(v153); + LayingItem::OnItemPickup(v153); v2->vVelocity.z = v18; v2->vVelocity.y = v18; v2->vVelocity.x = v18; @@ -16630,7 +16621,7 @@ LABEL_24: v2->uObjectDescID = v12; if ( !v12 ) - LayingItem::_42F933(v153); + LayingItem::OnItemPickup(v153); v44 = v2->uItemType == 555; v2->vVelocity.z = 0; v2->vVelocity.y = 0; @@ -16681,7 +16672,7 @@ LABEL_182: v2->uObjectDescID = v95; if ( v95 == (short)v9 ) - LayingItem::_42F933(v153); + LayingItem::OnItemPickup(v153); v96 = v2->uSoundID; v2->vVelocity.z = v9; v2->vVelocity.y = v9; @@ -16726,7 +16717,7 @@ } v2->uObjectDescID = v36; if ( !v36 ) - LayingItem::_42F933(v153); + LayingItem::OnItemPickup(v153); v37 = v2->vPosition.z; v2->vVelocity.z = 0; v38 = 8 * v153; @@ -16783,7 +16774,7 @@ LABEL_196: v2->uObjectDescID = v46; if ( v46 == (short)v32 ) - LayingItem::_42F933(v153); + LayingItem::OnItemPickup(v153); v100 = v2->field_61; v101 = v2->vPosition.z; v2->uSpriteFrameID = v32; @@ -16871,7 +16862,7 @@ } v2->uObjectDescID = v121; if ( !v121 ) - LayingItem::_42F933(v153); + LayingItem::OnItemPickup(v153); v2->vVelocity.z = 0; v2->vVelocity.y = 0; v2->vVelocity.x = 0; diff -r eaadcb39312f -r 5e5dfedcc0ad mm7_3.cpp --- a/mm7_3.cpp Sun Feb 24 09:18:03 2013 +0600 +++ b/mm7_3.cpp Sun Feb 24 09:18:17 2013 +0600 @@ -1448,7 +1448,7 @@ (v1->uSectorID = v4) == 0) || (v42 = _46CEC3_get_floor_level(v1->vPosition.x, v1->vPosition.y, v1->vPosition.z, v4, &uFaceID), v42 == -30000)) ) { - LayingItem::_42F933(uLayingItemID_); + LayingItem::OnItemPickup(uLayingItemID_); return; } v5 = v2->uFlags; @@ -1844,7 +1844,7 @@ if ( v55 ) v9 = v7 + 30; sub_42F960_create_object(v1->vPosition.x, v1->vPosition.y, v9); - LayingItem::_42F933(uLayingItemID_); + LayingItem::OnItemPickup(uLayingItemID_); v7 = v54; } } @@ -2035,7 +2035,7 @@ else v44 = v54 + 60; sub_42F960_create_object(v1->vPosition.x, v1->vPosition.y, v44); - LayingItem::_42F933(uLayingItemID_); + LayingItem::OnItemPickup(uLayingItemID_); return; } if ( stru_721530.field_7C >= stru_721530.field_6C ) @@ -2223,9 +2223,9 @@ { //v3 = item->uObjectDescID; v4 = &pObjectList->pObjects[item->uObjectDescID]; - if (item->uAttributes) - { - v5 = *(int *)(v2 + 62) >> 3; + if (item->AttachedToActor()) + { + v5 = item->field_5C >> 3; *(int *)(v2 - 26) = pActors[v5].vPosition.x; *(int *)(v2 - 22) = pActors[v5].vPosition.y; *(int *)(v2 - 18) = pActors[v5].vPosition.z + pActors[v5].uActorHeight; @@ -2253,7 +2253,7 @@ { v10 = i; LABEL_35: - LayingItem::_42F933(v10); + LayingItem::OnItemPickup(v10); goto LABEL_36; } v11 = v4->uLifetime; @@ -3407,10 +3407,10 @@ cos_y = cosf(2 * 3.141592653589 * _angle_y / 2048.0); int dx = cos_y * pParty->uWalkSpeed * fWalkSpeedMultiplier; - v2 += dx; + v2 += dx * 12; int dy = sin_y * pParty->uWalkSpeed * fWalkSpeedMultiplier; - v1 += dy; + v1 += dy * 12; v128 = v1; v124 = 1; @@ -12099,9 +12099,9 @@ HIWORD(v22) = HIWORD(x); v15->_screenspace_y_scaler_packedfloat = v37; v15->field_1E = v30; - v15->some_x = a1; - v15->some_y = a2; - v15->some_z = a3; + v15->world_x = a1; + v15->world_y = a2; + v15->world_z = a3; v15->uScreenSpaceX = a5; v15->uScreenSpaceY = a6; v23 = 8 * v26; @@ -12198,10 +12198,9 @@ v5 = v4; v24 = v4; v30 = v4->uFlags; - a6 = v4->uGlowRadius * p->field_22; - v6 = stru_5C6E00->Atan2( - p->vPosition.x - pBLVRenderParams->vPartyPos.x, - p->vPosition.y - pBLVRenderParams->vPartyPos.y); + a6 = v4->uGlowRadius * p->field_22_glow_radius_multiplier; + v6 = stru_5C6E00->Atan2(p->vPosition.x - pBLVRenderParams->vPartyPos.x, + p->vPosition.y - pBLVRenderParams->vPartyPos.y); LOWORD(v7) = p->uFacing; v8 = v30; v9 = ((signed int)(stru_5C6E00->uIntegerPi + ((signed int)stru_5C6E00->uIntegerPi >> 3) + v7 - v6) >> 8) & 7; @@ -12274,9 +12273,9 @@ HIWORD(v21) = HIWORD(x); v3->_screenspace_y_scaler_packedfloat = v31; v3->field_1E = v34; - v3->some_x = a1; - v3->some_y = a2; - v3->some_z = a3; + v3->world_x = a1; + v3->world_y = a2; + v3->world_z = a3; v3->uScreenSpaceX = v36; v22 = v35; v3->uTintColor = 0; @@ -14466,7 +14465,7 @@ { if ( !(BYTE2(v12->uAttributes) & 0x10) ) { - v14 = _444732_GetEventHintString(v13); + v14 = GetEventHintString(v13); v15 = v14; if ( v14 ) { @@ -14567,7 +14566,7 @@ { if ( !(BYTE2(v11->uAttributes) & 0x10) ) { - v13 = _444732_GetEventHintString(v12); + v13 = GetEventHintString(v12); v14 = v13; if ( v13 ) { @@ -14604,11 +14603,10 @@ //----- (00444A51) -------------------------------------------------------- -char *__cdecl TransitionUI_Draw() +void TransitionUI_Draw() { MapInfo *pMapInfo; // esi@5 char *v1; // eax@6 - char *result; // eax@12 std::string v3; // [sp-18h] [bp-84h]@11 unsigned int v4; // [sp-10h] [bp-7Ch]@12 int v5; // [sp-Ch] [bp-78h]@12 @@ -14623,13 +14621,13 @@ 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->pTextures[uTextureID_50795C]); + 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_507B04 = uTextureID_right_panel; - pRenderer->DrawTextureTransparent(468, 0, (Texture *)(uTextureID_right_panel != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_right_panel] : 0)); - pRenderer->DrawTextureIndexed(556, 451, (Texture *)(uTextureID_x_x_u != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_x_x_u] : 0)); - pRenderer->DrawTextureIndexed(476, 451, (Texture *)(uTextureID_x_ok_u != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_x_ok_u] : 0)); - if ( (pVideoPlayer->AnyMovieLoaded() || v9) && *dword_591164_teleport_map_name != 48 ) + 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; @@ -14639,31 +14637,23 @@ v8.uFrameX = 483; v8.uFrameWidth = 148; v8.uFrameZ = 334; + + v1 = ""; if ( uCurrentHouse_Animation ) { - v1 = (&off_4EB080)[4 * uCurrentHouse_Animation]; - } - else - { - if ( v10 ) - { - sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[409], pMapInfo->pName);// "Do you wish to leave %s?" - v4 = (212 - pFontCreate->CalcTextHeight(pTmpBuf, &v8, 0, 0)) / 2 + 101; - result = v8.DrawTitleText(pFontCreate, 0, v4, 0, pTmpBuf, 3); - dword_5B5924 = 1; - return result; - } - v1 = ""; - } - if ( !v1 ) - { - MessageBoxW(nullptr, L"No transition text found!", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Events.cpp:1410", 0); - v1 = ""; - } - v4 = (212 - pFontCreate->CalcTextHeight(v1, &v8, 0, 0)) / 2 + 101; - result = v8.DrawTitleText(pFontCreate, 0, v4, 0, v1, 3); - dword_5B5924 = 1; - return result; + 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 ) + { + sprintf(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; } @@ -14703,10 +14693,10 @@ pTexture_outside = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture("outside", TEXTURE_16BIT_PALETTE)]; v1 = pMapStats->GetMapInfo(pCurrentMapName); if ( v1 ) - sprintf(byte_591098, pGlobalTXT_LocalizationStrings[410], pMapStats->pInfos[v1].pName);// "Leave %s" - else - strcpy(byte_591098, pGlobalTXT_LocalizationStrings[79]);// "Exit" - result = GUIWindow::Create(0, 0, 640, 480, (enum WindowType)17, 0, (int)byte_591098); + sprintf(sHouseName, pGlobalTXT_LocalizationStrings[410], pMapStats->pInfos[v1].pName);// "Leave %s" + else + strcpy(sHouseName, pGlobalTXT_LocalizationStrings[79]);// "Exit" + result = GUIWindow::Create(0, 0, 640, 480, (enum WindowType)17, 0, (int)sHouseName); pDialogueWindow = result; return result; } @@ -14783,7 +14773,7 @@ strcat(pTmpBuf, pTmpBuf2); v4 = pFontCreate->CalcTextHeight(pTmpBuf, &v7, 0, 0); v7.DrawTitleText(pFontCreate, 0, (212 - v4) / 2 + 101, 0, pTmpBuf, 3u); - dword_5B5924 = 1; + _unused_5B5924_is_travel_ui_drawn = 1; } } @@ -15673,94 +15663,85 @@ } //----- (004466C4) -------------------------------------------------------- -bool __thiscall sub_4466C4(void *_this) -{ - signed int v1; // ebp@1 - bool result; // eax@2 - int v3; // esi@3 - signed int v4; // edx@3 - signed int v5; // eax@4 - unsigned int v6; // ebx@6 - char *v7; // eax@6 - signed int v8; // edi@18 - int v9; // eax@19 - Player *v10; // [sp+8h] [bp-10h]@18 - signed int v11; // [sp+Ch] [bp-Ch]@3 - signed int v12; // [sp+10h] [bp-8h]@3 - void *v13; // [sp+14h] [bp-4h]@1 - - v1 = 0; - v13 = _this; - if ( !_this ) +int NPC_EventProcessor( int npc_event_id ) + { + signed int event_index; // ebp@1 + int evt_seq_num; // esi@3 + bool ready_to_exit; // [sp+Ch] [bp-Ch]@3 + signed int npc_activity; // [sp+10h] [bp-8h]@3 + int result; + + event_index = 0; + if ( !npc_event_id ) return 0; - v3 = start_event_seq_number; + evt_seq_num = start_event_seq_number; pSomeOtherEVT = pGlobalEVT; uSomeOtherEVT_NumEvents = uGlobalEVT_NumEvents; - memcpy(pSomeOtherEVT_Events, pGlobalEVT_Index, 0xCE40u); - v4 = 1; - v12 = 1; - v11 = 0; - if ( (signed int)uSomeOtherEVT_NumEvents <= 0 ) - goto LABEL_16; + memcpy(pSomeOtherEVT_Events, pGlobalEVT_Index, sizeof(EventIndex)*4400); + npc_activity = 1; + ready_to_exit = false; + if ( uSomeOtherEVT_NumEvents <= 0 ) + return 2; do { - v5 = v1; - if ( (void *)pSomeOtherEVT_Events[v1].uEventID == v13 && pSomeOtherEVT_Events[v5].event_sequence_num == v3 ) - { - v6 = pSomeOtherEVT_Events[v5].uEventOffsetInEVT; - v7 = &pSomeOtherEVT[v6]; - if ( (unsigned __int8)pSomeOtherEVT[v6 + 4] == 1 ) - break; - if ( (unsigned __int8)pSomeOtherEVT[v6 + 4] == 44 ) - { - v11 = v4; - v10 = pParty->pPlayers; - v8 = (unsigned __int8)v7[7] - + (((unsigned __int8)v7[8] + (((unsigned __int8)v7[9] + ((unsigned __int8)v7[10] << 8)) << 8)) << 8); - while ( 1 ) - { - LOBYTE(v9) = v10->CompareVariable( - (enum VariableType)((unsigned __int8)pSomeOtherEVT[v6 + 5] - + ((unsigned __int8)pSomeOtherEVT[v6 + 6] << 8)), - v8); - if ( v9 ) - break; - ++v10; - if ( (signed int)v10 >= (signed int)pParty->pHirelings ) - goto LABEL_13; - } - } - else - { - if ( (unsigned __int8)pSomeOtherEVT[v6 + 4] == 45 ) - break; - if ( (unsigned __int8)pSomeOtherEVT[v6 + 4] == 46 ) - { - v11 = v4; - v12 = (unsigned __int8)v7[5]; - goto LABEL_13; - } - if ( (unsigned __int8)pSomeOtherEVT[v6 + 4] != 52 - || !IsActorAlive( - (unsigned __int8)v7[5], - (unsigned __int8)v7[6] - + (((unsigned __int8)v7[7] + (((unsigned __int8)v7[8] + ((unsigned __int8)v7[9] << 8)) << 8)) << 8), - (unsigned __int8)v7[10]) ) - goto LABEL_13; - } - v1 = -1; - v3 = (unsigned __int8)pSomeOtherEVT[v6 + 11] - 1; -LABEL_13: - ++v3; - v4 = 1; - } - ++v1; - } - while ( v1 < (signed int)uSomeOtherEVT_NumEvents ); - if ( v11 ) - result = v12 != 0; - else -LABEL_16: + if ( (pSomeOtherEVT_Events[event_index].uEventID == npc_event_id) && (pSomeOtherEVT_Events[event_index].event_sequence_num == evt_seq_num) ) + { + _evt_raw *_evt = (_evt_raw *)&pSomeOtherEVT[pSomeOtherEVT_Events[event_index].uEventOffsetInEVT]; + switch(_evt->_e_type) + { + case EVENT_Exit: + //exit + if ( ready_to_exit ) + result = npc_activity != 0; + else + result = 2; + return result; + break; + case EVENT_OnCanShowDialogItemCmp: + ready_to_exit = true; + //v8 = (unsigned __int8)v7[7] + (((unsigned __int8)v7[8] + (((unsigned __int8)v7[9] + ((unsigned __int8)v7[10] << 8)) << 8)) << 8); + for(int i=0; i<4; ++i) + { + // if (pParty->pPlayers[i].CompareVariable((enum VariableType)((unsigned __int8)pSomeOtherEVT[v6 + 5] + ((unsigned __int8)pSomeOtherEVT[v6 + 6] << 8)), + // v8)) + if (pParty->pPlayers[i].CompareVariable((enum VariableType)EVT_WORD(_evt->v5), EVT_DWORD(_evt->v7))) + { + event_index = -1; + evt_seq_num = EVT_BYTE(_evt->v11)-1;//(unsigned __int8)pSomeOtherEVT[v6 + 11] - 1; + break; + } + } + break; + case EVENT_EndCanShowDialogItem : + if ( ready_to_exit ) + result = npc_activity != 0; + else + result = 2; + return result; + break; + case EVENT_SetCanShowDialogItem : + ready_to_exit = true; + npc_activity = EVT_BYTE(_evt->v5); //(unsigned __int8)v7[5]; + break; + case EVENT_IsActorAssasinated : + // if (IsActorAlive( (unsigned __int8)v7[5], + // (unsigned __int8)v7[6] + (((unsigned __int8)v7[7] + (((unsigned __int8)v7[8] + ((unsigned __int8)v7[9] << 8)) << 8)) << 8), + // (unsigned __int8)v7[10]) ) + if (IsActorAlive( EVT_BYTE(_evt->v5), EVT_DWORD(_evt->v6), EVT_BYTE(_evt->v10))) + { // drop linear sequense, going to new seq + event_index = -1; + evt_seq_num = EVT_BYTE(_evt->v11)-1;//(unsigned __int8)pSomeOtherEVT[v6 + 11] - 1; + } + break; + } + ++evt_seq_num; + } + ++event_index; + } + while ( event_index < uSomeOtherEVT_NumEvents ); + if ( ready_to_exit ) + result = npc_activity != 0; + else result = 2; return result; } @@ -16882,7 +16863,7 @@ v2 = pMapName; v3 = uStartingPointType; pAudioPlayer->StopChannels(-1, -1); - pGameLoadingUI_ProgressBar->_443484((GUIProgressBar::Type)0); + pGameLoadingUI_ProgressBar->Initialize(GUIProgressBar::TYPE_None); if ( _strcmpi(pCurrentMapName, v2) ) SaveGame(1, 0); uGameState = 2; @@ -18587,7 +18568,7 @@ LayingItem *v1; // esi@1 v1 = this; - v1->field_22 = 1; + v1->field_22_glow_radius_multiplier = 1; v1->uSoundID = 0; v1->uFacing = 0; v1->vVelocity.z = 0; diff -r eaadcb39312f -r 5e5dfedcc0ad mm7_4.cpp --- a/mm7_4.cpp Sun Feb 24 09:18:03 2013 +0600 +++ b/mm7_4.cpp Sun Feb 24 09:18:17 2013 +0600 @@ -260,7 +260,7 @@ //BLVFace *v23; // eax@33 //int v24; // esi@39 //int v25; // edi@39 - int v26; // esi@41 + //int v26; // esi@41 int v27; // ecx@43 signed int v28; // eax@45 int v29; // ebx@47 @@ -446,7 +446,7 @@ v54 = 0; v51 = 0; v49 = word_721390[0] >= y; - if ( v26 > 0 ) + if ( portal->uNumVertices > 0 ) { do { @@ -480,7 +480,8 @@ ++v51; v49 = v47; } - while ( v51 < v26 ); + while ( v51 < 2 * portal->uNumVertices ); + if ( v54 == 1 ) { if ( v55 >= 50 ) @@ -1012,7 +1013,7 @@ side1_dx = (double)(grid_pos_x1 - grid_pos_x1); side2_dz = (double)(grid_pos_z2 - grid_pos_z2); // bug? z2 - z2 side1_dz = (double)(grid_pos_z2 - grid_pos_z2); // z1 - z2 - Log::Warning(L"%s %s %u\n", __FILE__, __FUNCTION__, __LINE__); + Log::Warning(L"%S %S %u\n", __FILE__, __FUNCTION__, __LINE__); /* |\ side1 | \ |____\ @@ -10107,7 +10108,7 @@ a1.uFrameX = 483; a1.uFrameWidth = 148; a1.uFrameZ = 334; - v2 = (&off_4EB080)[4 * uHouse_ExitPic]; + v2 = pTransitionStrings[uHouse_ExitPic]; if ( !v2 ) { sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[411], v0); @@ -11187,72 +11188,34 @@ //----- (004B4224) -------------------------------------------------------- -GUIButton *_4B4224_UpdateNPCTopics(int _this) -{ - int v1; // ebx@1 - GUIButton *result; // eax@3 +void _4B4224_UpdateNPCTopics( int _this ) + { + int num_menu_buttons; // ebx@1 int i; // ebp@5 - signed int v4; // ebp@9 - void *v5; // ecx@14 - bool v6; // eax@16 - void *v7; // ecx@19 - bool v8; // eax@21 - void *v9; // ecx@24 - bool v10; // eax@26 - void *v11; // ecx@29 - bool v12; // eax@31 - void *v13; // ecx@34 - bool v14; // eax@36 - void *v15; // ecx@39 - bool v16; // eax@41 + // signed int v4; // ebp@9 + int v6; // eax@16 + int v8; // eax@21 + int v10; // eax@26 + int v12; // eax@31 + int v14; // eax@36 + int v16; // eax@41 NPCData *v17; // [sp+10h] [bp-4h]@4 - v1 = 0; + num_menu_buttons = 0; array_5913D8[6] = (NPCData *)(_this + 1); if ( _this + 1 == uNumDialogueNPCPortraits && uHouse_ExitPic ) { pDialogueWindow->Release(); pDialogueWindow = GUIWindow::Create(0, 0, 640, 480, WINDOW_MainMenu, 0, 0); - sprintf(byte_591098, pGlobalTXT_LocalizationStrings[411], pMapStats->pInfos[uHouse_ExitPic].pName); - pBtn_ExitCancel = pDialogueWindow->CreateButton( - 0x236u, - 0x1BDu, - 0x4Bu, - 0x21u, - 1, - 0, - 0x71u, - 0, - 0x4Eu, + sprintf(sHouseName, pGlobalTXT_LocalizationStrings[LOCSTR_ENTER_S], pMapStats->pInfos[uHouse_ExitPic].pName); + pBtn_ExitCancel = pDialogueWindow->CreateButton( 566, 445, 75, 33, 1, 0, 0x71u, 0, 0x4Eu, pGlobalTXT_LocalizationStrings[34],// "Cancel" - (Texture *)(uTextureID_BUTTDESC2 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_BUTTDESC2] : 0), - 0); - pBtn_YES = pDialogueWindow->CreateButton( - 486u, - 445u, - 75u, - 33u, - 1, - 0, - 0xBFu, - 1u, - 0x59u, - byte_591098, - (Texture *)(uTextureID_BUTTYES2 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_BUTTYES2] : 0), - 0); - pDialogueWindow->CreateButton( - pNPCPortraits_x[0][0], - pNPCPortraits_y[0][0], - 63u, - 73u, - 1, - 0, - 0xBFu, - 1u, - 0x20u, - byte_591098, - 0); - result = pDialogueWindow->CreateButton(8u, 8u, 460u, 344u, 1, 0, 0xBFu, 1u, 0x59u, byte_591098, 0); + (Texture *)(uTextureID_BUTTDESC2 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_BUTTDESC2] : 0),0); + pBtn_YES = pDialogueWindow->CreateButton( 486u, 445u, 75u, 33u, 1, 0, 0xBFu, 1u, 0x59u, + sHouseName, + (Texture *)(uTextureID_BUTTYES2 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_BUTTYES2] : 0), 0); + pDialogueWindow->CreateButton( pNPCPortraits_x[0][0], pNPCPortraits_y[0][0], 63u, 73u, 1, 0, 0xBFu, 1u, 0x20u, sHouseName, 0); + pDialogueWindow->CreateButton(8u, 8u, 460u, 344u, 1, 0, 0xBFu, 1u, 0x59u, sHouseName, 0); } else { @@ -11266,167 +11229,83 @@ for ( i = 0; i < uNumDialogueNPCPortraits; ++i ) GUIButton::_41D0D8((GUIButton *)array_5913D8[i + 7]); } - v4 = 1; pDialogueWindow = GUIWindow::Create(0, 0, 640, 0x159u, WINDOW_MainMenu, 0, 0); - pBtn_ExitCancel = pDialogueWindow->CreateButton( - 471u, - 445u, - 169u, - 35u, - 1, - 0, - 0x71u, - 0, - 0, + pBtn_ExitCancel = pDialogueWindow->CreateButton( 471u, 445u, 169u, 35u, 1, 0, 0x71u, 0, 0, pGlobalTXT_LocalizationStrings[74],// "End Conversation" - (Texture *)(uTextureID_506438 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_506438] : 0), - 0); + (Texture *)(uTextureID_506438 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_506438] : 0), 0); pDialogueWindow->CreateButton(8u, 8u, 0x1C2u, 0x140u, 1, 0, 0x51u, 0, 0, "", 0); if ( array_5913D8[6] == (NPCData *)1 && dword_591080 ) { - result = (GUIButton *)sub_4B3B42(dword_F8B198); + sub_4B3B42(dword_F8B198); } else { if ( v17->joins ) { - v1 = 1; + num_menu_buttons = 1; pDialogueWindow->CreateButton(480u, 160u, 140u, 30u, 1, 0, 0xAFu, 0xDu, 0, "", 0); } - v5 = (void *)v17->evt_A; - if ( v5 ) - { - if ( v1 < 4 ) - { - v6 = sub_4466C4(v5); + if ( v17->evt_A) + { + if ( num_menu_buttons < 4 ) + { + v6 = NPC_EventProcessor(v17->evt_A); if ( v6 == 1 || v6 == 2 ) - pDialogueWindow->CreateButton( - 480u, - 30 * v1++ + 160, - 140u, - 30u, - 1, - 0, - 0xAFu, - 0x13u, - 0, - "", - 0); - } - } - v7 = (void *)v17->evt_B; - if ( v7 ) - { - if ( v1 < 4 ) - { - v8 = sub_4466C4(v7); + pDialogueWindow->CreateButton( 480u, 30 * num_menu_buttons++ + 160, 140u, 30u, 1, 0, 0xAFu, 0x13u, 0, "", 0); + } + } + if ( v17->evt_B ) + { + if ( num_menu_buttons < 4 ) + { + v8 = NPC_EventProcessor(v17->evt_B); if ( v8 == 1 || v8 == 2 ) - pDialogueWindow->CreateButton( - 480u, - 30 * v1++ + 160, - 140u, - 30u, - 1, - 0, - 0xAFu, - 0x14u, - 0, - "", - 0); - } - } - v9 = (void *)v17->evt_C; - if ( v9 ) - { - if ( v1 < 4 ) - { - v10 = sub_4466C4(v9); + pDialogueWindow->CreateButton( 480u, 30 * num_menu_buttons++ + 160, 140u, 30u, 1, 0, 0xAFu, 0x14u, 0, "", 0); + } + } + if ( v17->evt_C ) + { + if ( num_menu_buttons < 4 ) + { + v10 = NPC_EventProcessor(v17->evt_C); if ( v10 == 1 || v10 == 2 ) - pDialogueWindow->CreateButton( - 480u, - 30 * v1++ + 160, - 140u, - 30u, - 1, - 0, - 0xAFu, - 0x15u, - 0, - "", - 0); - } - } - v11 = (void *)v17->evt_D; - if ( v11 ) - { - if ( v1 < 4 ) - { - v12 = sub_4466C4(v11); + pDialogueWindow->CreateButton( 480u, 30 * num_menu_buttons++ + 160, 140u, 30u, 1, 0, 0xAFu, 0x15u, 0, "", 0); + } + } + + if ( v17->evt_D ) + { + if ( num_menu_buttons < 4 ) + { + v12 = NPC_EventProcessor(v17->evt_D); if ( v12 == 1 || v12 == 2 ) - pDialogueWindow->CreateButton( - 0x1E0u, - 30 * v1++ + 160, - 0x8Cu, - 0x1Eu, - 1, - 0, - 0xAFu, - 0x16u, - 0, - "", - 0); - } - } - v13 = (void *)v17->evt_E; - if ( v13 ) - { - if ( v1 < 4 ) - { - v14 = sub_4466C4(v13); + pDialogueWindow->CreateButton( 0x1E0u, 30 * num_menu_buttons++ + 160, 0x8Cu, 0x1Eu, 1, 0, 0xAFu, 0x16u, 0, "", 0); + } + } + if ( v17->evt_E ) + { + if ( num_menu_buttons < 4 ) + { + v14 = NPC_EventProcessor(v17->evt_E); if ( v14 == 1 || v14 == 2 ) - pDialogueWindow->CreateButton( - 0x1E0u, - 30 * v1++ + 160, - 0x8Cu, - 0x1Eu, - 1, - 0, - 0xAFu, - 0x17u, - 0, - "", - 0); - } - } - v15 = (void *)v17->evt_F; - if ( v15 ) - { - if ( v1 < 4 ) - { - v16 = sub_4466C4(v15); + pDialogueWindow->CreateButton( 0x1E0u, 30 * num_menu_buttons++ + 160, 0x8Cu, 0x1Eu, 1, 0, 0xAFu, 0x17u, 0, "", 0); + } + } + if ( v17->evt_F ) + { + if ( num_menu_buttons < 4 ) + { + v16 = NPC_EventProcessor(v17->evt_F); if ( v16 == 1 || v16 == 2 ) - pDialogueWindow->CreateButton( - 0x1E0u, - 30 * v1++ + 160, - 0x8Cu, - 0x1Eu, - 1, - 0, - 0xAFu, - 0x18u, - 0, - "", - 0); - } - } - pDialogueWindow->_41D08F(v1, 1, 0, 2); - v4 = 1; - result = (GUIButton *)pDialogueWindow->pNumPresenceButton; + pDialogueWindow->CreateButton( 0x1E0u, 30 * num_menu_buttons++ + 160, 0x8Cu, 0x1Eu, 1, 0, 0xAFu, 0x18u, 0, "", 0); + } + } + pDialogueWindow->_41D08F(num_menu_buttons, 1, 0, 2); dword_F8B1E0 = pDialogueWindow->pNumPresenceButton; } - dword_F8B19C = v4; - } - return result; + dword_F8B19C = 1; + } + } @@ -14658,9 +14537,9 @@ } LABEL_44: HIWORD(v25) = HIWORD(x); - v0->some_x = a1a; - v0->some_y = a2; - v0->some_z = a3; + v0->world_x = a1a; + v0->world_y = a2; + v0->world_z = a3; v0->uScreenSpaceX = v43; v0->uScreenSpaceY = a6; LOWORD(v25) = 0; @@ -14691,66 +14570,57 @@ //----- (00444732) -------------------------------------------------------- -char *_444732_GetEventHintString(unsigned int uEventID) -{ - signed int v1; // edx@1 - char *v2; // eax@2 - int v3; // ebx@4 - int v4; // esi@4 +char *GetEventHintString(unsigned int uEventID) +{ + signed int event_index; // edx@1 + int event_pos; // esi@4 char *result; // eax@6 - int v6; // eax@9 - char *i; // esi@11 - int v8; // edx@12 - - v1 = 0; - if ( (signed int)uLevelEVT_NumEvents <= 0 ) - { -LABEL_6: - result = 0; - } - else - { - v2 = (char *)&pLevelEVT_Index[0].uEventOffsetInEVT; + unsigned int str_index; // eax@9 + int i; // esi@11 + _evt_raw* test_evt; + _evt_raw* last_evt; + + event_index = 0; + if ( uLevelEVT_NumEvents <= 0 ) + return NULL; + + //v2 = (char *)&pLevelEVT_Index[0].uEventOffsetInEVT; while ( 1 ) { - if ( *((int *)v2 - 2) == uEventID ) - { - v3 = *(int *)v2; - v4 = *((int *)v2 + 3); - if ( pLevelEVT[*(int *)v2 + 4] == 4 ) + if ( pLevelEVT_Index[event_index].uEventID == uEventID ) + { + test_evt=(_evt_raw*)&pLevelEVT[pLevelEVT_Index[event_index].uEventOffsetInEVT]; + last_evt=test_evt; + event_pos = pLevelEVT_Index[event_index+1].uEventOffsetInEVT; + if ( test_evt->_e_type == EVENT_MouseOver ) break; } - ++v1; - v2 += 12; - if ( v1 >= (signed int)uLevelEVT_NumEvents ) - goto LABEL_6; - } - if ( pLevelEVT[v4 + 4] == 2 ) - { - v6 = (unsigned __int8)pLevelEVT[v4 + 5] - + (((unsigned __int8)pLevelEVT[v4 + 6] - + (((unsigned __int8)pLevelEVT[v4 + 7] + ((unsigned __int8)pLevelEVT[v4 + 8] << 8)) << 8)) << 8); -LABEL_10: - //result = (char *)p2DEvents_minus1_::04[13 * v6]; - result = (char *)p2DEvents[v6 - 1].pName; + ++event_index; + if ( event_index >= uLevelEVT_NumEvents ) + return NULL; + } + test_evt=(_evt_raw*)&pLevelEVT[event_pos]; + if ( test_evt->_e_type== EVENT_SpeakInHouse ) + { + str_index = EVT_DWORD(test_evt->v5); + result = (char *)p2DEvents[str_index - 1].pName; } else { - for ( i = (char *)pLevelEVT_Index + 4 * (3 * v1 + 3); *(int *)i == uEventID; i += 12 ) - { - v8 = *((int *)i + 2); - if ( pLevelEVT[v8 + 4] == 2 ) - { - v6 = (unsigned __int8)pLevelEVT[v8 + 5] - + (((unsigned __int8)pLevelEVT[v8 + 6] - + (((unsigned __int8)pLevelEVT[v8 + 7] + ((unsigned __int8)pLevelEVT[v8 + 8] << 8)) << 8)) << 8); - if ( (unsigned int)v6 < 0x258 ) - goto LABEL_10; - } - } - result = &pLevelStr[pLevelStrOffsets[(unsigned __int8)pLevelEVT[v3 + 5]]]; - } - } + for ( i = event_index+1; pLevelEVT_Index[i].uEventID == uEventID; ++i ) + { + event_pos = pLevelEVT_Index[i].uEventOffsetInEVT; + test_evt=(_evt_raw*)&pLevelEVT[event_pos]; + if ( test_evt->_e_type == EVENT_SpeakInHouse ) + { + str_index = EVT_DWORD(test_evt->v5); + if ( str_index < 600 ) + return (char *)p2DEvents[str_index - 1].pName; + } + } + result = &pLevelStr[pLevelStrOffsets[EVT_BYTE(last_evt->v5)]]; + } + return result; } @@ -14832,7 +14702,7 @@ v20 = pMapStats->pInfos[v14].pName; v18 = pGlobalTXT_LocalizationStrings[410]; LABEL_10: - sprintf(byte_591098, v18, v20); + sprintf(sHouseName, v18, v20); goto LABEL_20; } v21 = pGlobalTXT_LocalizationStrings[79]; @@ -14851,9 +14721,9 @@ } v21 = pGlobalTXT_LocalizationStrings[73]; LABEL_19: - strcpy(byte_591098, v21); + strcpy(sHouseName, v21); LABEL_20: - pDialogueWindow = GUIWindow::Create(0, 0, 640, 480, (enum WindowType)26, 0, (int)byte_591098); + pDialogueWindow = GUIWindow::Create(0, 0, 640, 480, (enum WindowType)26, 0, (int)sHouseName); //if ( BYTE1(pAnimatedRooms[p2DEvents_minus1___02[26 * v9]].field_C) ) if ( BYTE1(pAnimatedRooms[p2DEvents[v9 - 1].uAnimationID].field_C) ) HousePlaySomeSound(v9, 1); diff -r eaadcb39312f -r 5e5dfedcc0ad mm7_5.cpp --- a/mm7_5.cpp Sun Feb 24 09:18:03 2013 +0600 +++ b/mm7_5.cpp Sun Feb 24 09:18:17 2013 +0600 @@ -1570,7 +1570,7 @@ } DrawHiredNPCs(); continue; - case UIMSG_19B: + case UIMSG_TransitionUI_Confirm: if ( pMessageQueue_50CBD0->uNumMessages ) pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; dword_50CDC8 = v0; @@ -1673,7 +1673,7 @@ pStru277->_427D48(v0); sub_44603D(); pEventTimer->Pause(); - pGameLoadingUI_ProgressBar->_443484((GUIProgressBar::Type)2); + pGameLoadingUI_ProgressBar->Initialize(GUIProgressBar::TYPE_Box); ++pGameLoadingUI_ProgressBar->uProgressMax; SaveGame(v0, 0); pGameLoadingUI_ProgressBar->Progress(); @@ -9319,7 +9319,7 @@ else v3 = uBaseLightLevel; } - return _43F5C8_get_point_light_level_with_respect_to_lights(v3, a1->uIndoorSectorID, a1->some_x, a1->some_y, a1->some_z); + return _43F5C8_get_point_light_level_with_respect_to_lights(v3, a1->uIndoorSectorID, a1->world_x, a1->world_y, a1->world_z); } //----- (0043F5C8) -------------------------------------------------------- @@ -12138,7 +12138,7 @@ if (item->uItemType && (item->uSoundID & 8 || pObjectList->pObjects[item->uItemType].uFlags & 0x10)) - LayingItem::_42F933(i); + LayingItem::OnItemPickup(i); } for (uint i = 0; i < 100; ++i) diff -r eaadcb39312f -r 5e5dfedcc0ad mm7_6.cpp --- a/mm7_6.cpp Sun Feb 24 09:18:03 2013 +0600 +++ b/mm7_6.cpp Sun Feb 24 09:18:17 2013 +0600 @@ -2431,19 +2431,8 @@ pGUIWindow_Settings->CreateButton(0xA5u, 0x1A6u, 0x23u, 0, 2, 0, 0x8Du, 1u, 0x32u, "", 0); pGUIWindow_Settings->CreateButton(0x118u, 0x1A6u, 0x23u, 0, 2, 0, 0x8Du, 2u, 0x33u, "", 0); pGUIWindow_Settings->CreateButton(0x186u, 0x1A6u, 0x23u, 0, 2, 0, 0x8Du, 3u, 0x34u, "", 0); - v29 = 0; - v28 = ""; - v27 = 0; - v26 = 0; - v25 = 140; - v24 = 0; - v23 = 1; - v22 = 344; - v21 = 460; - v20 = 8; - v19 = 8; - v18 = pGUIWindow_Settings; - goto LABEL_56; + pGUIWindow_Settings->CreateButton(8, 8, 460, 344, 1, 0, 140, 0, 0, "", NULL); + sub_421B2C_PlaceInInventory_or_DropPickedItem(); } if ( HIBYTE(v6) & 2 && !pGUIWindow_Settings ) { @@ -6480,7 +6469,7 @@ if ( !pParty->AddItem(&pLayingItems[v445].stru_24) ) pParty->SetHoldingItem(&pLayingItems[v445].stru_24); } - LayingItem::_42F933(v445); + LayingItem::OnItemPickup(v445); } else { diff -r eaadcb39312f -r 5e5dfedcc0ad mm7_data.cpp --- a/mm7_data.cpp Sun Feb 24 09:18:03 2013 +0600 +++ b/mm7_data.cpp Sun Feb 24 09:18:17 2013 +0600 @@ -685,10 +685,10 @@ char _4E2B21_buff_spell_tooltip_colors[80]; char byte_4E2B70[777]; // weak char byte_4E2BC8; // weak -int pChestSmthn1ByType[8]; -int pChestSmthn2ByType[8]; -int pChestWidthsByType[8]; -int pChestHeightsByType[8]; +int pChestSmthn1ByType[8] = {42, 18, 18, 42, 42, 42, 18, 42}; +int pChestSmthn2ByType[8] = {34, 30, 30, 34, 34, 34, 30, 34}; +int pChestWidthsByType[8] = {9, 9, 9, 9, 9, 9, 9, 9}; +int pChestHeightsByType[8] = {9, 9, 9, 9, 9, 9, 9, 9}; char aSS[777]; // idb char ascii_4E2C54[6]; char ascii_4E2C5C[7]; @@ -1130,8 +1130,8 @@ unsigned int saveload_dlg_zs[2] = {460, 640}; unsigned int saveload_dlg_ws[2] = {344, 480}; int dword_4E98BC_bApplicationActive; // weak -char *off_4EB080; // idb -char *pTransitionStrings[464]; +//char *off_4EB080; // idb +char *pTransitionStrings[465] = {"", nullptr}; // 004EB080 char aAwards_txt[777]; // idb char aScroll_txt[777]; // idb char aMerchant_txt[777]; // idb @@ -1982,7 +1982,7 @@ unsigned int uDialogueType; unsigned int uDialogue_SpeakingActorNPC_ID; struct LevelDecoration *_591094_decoration; -char byte_591098[200]; // idb +char sHouseName[200]; // idb int uCurrentHouse_Animation; // weak char *dword_591164_teleport_map_name; // idb int dword_591168_teleport_speedz; // weak @@ -2002,7 +2002,7 @@ int start_event_seq_number; // weak char byte_5B0938[2000]; int dword_5B5920; // weak -int dword_5B5924; // weak +int _unused_5B5924_is_travel_ui_drawn = false; // 005B5924 int _5B65A8_npcdata_uflags_or_other; // weak int _5B65AC_npcdata_fame_or_other; // weak int _5B65B0_npcdata_rep_or_other; // weak diff -r eaadcb39312f -r 5e5dfedcc0ad mm7_data.h --- a/mm7_data.h Sun Feb 24 09:18:03 2013 +0600 +++ b/mm7_data.h Sun Feb 24 09:18:17 2013 +0600 @@ -801,8 +801,7 @@ extern unsigned int saveload_dlg_zs[2]; extern unsigned int saveload_dlg_ws[2]; extern int dword_4E98BC_bApplicationActive; // weak -extern char *off_4EB080; // idb -extern char *pTransitionStrings[464]; +extern char *pTransitionStrings[]; // 4EB080 extern char aAwards_txt[]; // idb extern char aScroll_txt[]; // idb extern char aMerchant_txt[]; // idb @@ -1325,7 +1324,7 @@ extern unsigned int uDialogueType; extern unsigned int uDialogue_SpeakingActorNPC_ID; extern struct LevelDecoration *_591094_decoration; -extern char byte_591098[200]; // idb +extern char sHouseName[200]; // idb extern int uCurrentHouse_Animation; // weak extern char *dword_591164_teleport_map_name; // idb extern int dword_591168_teleport_speedz; // weak @@ -1345,7 +1344,7 @@ extern int start_event_seq_number; // weak extern char byte_5B0938[2000]; extern int dword_5B5920; // weak -extern int dword_5B5924; // weak +extern int _unused_5B5924_is_travel_ui_drawn; // 005B5924 extern int _5B65A8_npcdata_uflags_or_other; // weak extern int _5B65AC_npcdata_fame_or_other; // weak extern int _5B65B0_npcdata_rep_or_other; // weak @@ -2011,9 +2010,9 @@ void __thiscall Level_LoadEvtAndStr(const char *pLevelName); char *__cdecl _4443D5_GetMinimapRightClickText(); const char *__cdecl sub_444564(); -char *__thiscall _444732_GetEventHintString(unsigned int uEventID); // idb +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 -char *__cdecl TransitionUI_Draw(); +void TransitionUI_Draw(); struct GUIWindow *__cdecl UI_CreateTravelDialogue(); signed int __cdecl GetTravelTime(); void __cdecl TravelUI_Draw(); @@ -2031,7 +2030,7 @@ int sub_4465DF_check_season(int a1); int __fastcall IsActorAlive(unsigned int uType, unsigned int uParam, unsigned int uNumAlive); // idb // void __cdecl crt_construct_5773C4(); -bool __thiscall sub_4466C4(void *_this); +int NPC_EventProcessor(int npc_event_id); void __fastcall sub_448518_npc_set_item(int npc, unsigned int item, int a3); void __fastcall sub_44861E_set_texture(unsigned int uFaceCog, const char *pFilename); @@ -2317,7 +2316,7 @@ void __fastcall sub_4B3EF0(int a4); void __fastcall sub_4B3FE5(int a4); void __cdecl sub_4B40E6(); -struct GUIButton *__thiscall _4B4224_UpdateNPCTopics(int _this); +void _4B4224_UpdateNPCTopics(int _this); char __fastcall sub_4B46A5(const char *Str, int a5); int __fastcall sub_4B46F8(int a1); int __cdecl TrainingDialog(); @@ -2342,7 +2341,7 @@ void __fastcall _4BBF61_summon_actor(int a1, __int16 x, int y, int z); // idb void __cdecl ArenaFight(); struct Texture *__cdecl sub_4BC8D5(); -struct GUIButton *__cdecl sub_4BCA33(); +struct GUIButton *__cdecl UI_CreateEndConversationButton(); void __fastcall sub_4BCACC_bounties(signed int a1); signed int __cdecl sub_4BD8B5(); bool __fastcall sub_4BDAAF(ItemGen *a1, int _2da_idx); diff -r eaadcb39312f -r 5e5dfedcc0ad stru6.cpp --- a/stru6.cpp Sun Feb 24 09:18:03 2013 +0600 +++ b/stru6.cpp Sun Feb 24 09:18:17 2013 +0600 @@ -777,6 +777,7 @@ signed int v35; // [sp+0h] [bp-18h]@81 char pContainer[7]; // [sp+10h] [bp-8h]@81 + __debugbreak(); // need to refactor carefully & collect data v2 = this; result = a2->uItemType; if ( result <= 545 )