Mercurial > mm7
changeset 538:1d876589a030
Слияние
author | Ritor1 |
---|---|
date | Sat, 02 Mar 2013 09:01:48 +0600 |
parents | db4631a484ae (current diff) 5196a51cc9ec (diff) |
children | 75e80fc74045 |
files | Events.cpp stru179.h |
diffstat | 21 files changed, 507 insertions(+), 494 deletions(-) [+] |
line wrap: on
line diff
--- a/DecalBuilder.h Sat Mar 02 08:59:10 2013 +0600 +++ b/DecalBuilder.h Sat Mar 02 09:01:48 2013 +0600 @@ -40,7 +40,7 @@ { } - void (__thiscall ***vdestructor_ptr)(Decal *, bool); + //void (__thiscall ***vdestructor_ptr)(Decal *, bool); int uNumVertices; RenderVertexSoft pVertices[64]; __int16 field_C08; @@ -103,7 +103,7 @@ - void (__thiscall ***vdestructor_ptr)(DecalBuilder *, bool); + //void (__thiscall ***vdestructor_ptr)(DecalBuilder *, bool); Decal std__vector_pDecals[1024]; unsigned int std__vector_pDecals_size; int field_308008; @@ -150,7 +150,7 @@ { } - void (__thiscall ***vdestructor_ptr)(Bloodsplat *, bool); + //void (__thiscall ***vdestructor_ptr)(Bloodsplat *, bool); float x; float y; float z; @@ -194,7 +194,7 @@ bool AddBloodsplat(float x, float y, float z, float radius, char r, char g, char b); - void (__thiscall ***vdestructor_ptr)(BloodsplatContainer *, bool); + //void (__thiscall ***vdestructor_ptr)(BloodsplatContainer *, bool); Bloodsplat std__vector_pBloodsplats[64]; unsigned int std__vector_pBloodsplats_size; int uNumBloodsplats;
--- a/Events.cpp Sat Mar 02 08:59:10 2013 +0600 +++ b/Events.cpp Sat Mar 02 09:01:48 2013 +0600 @@ -298,7 +298,7 @@ } player_choose = (uActiveCharacter == 0)?6:4; //4 - active or 6 - random player if active =0 curr_seq_num = start_event_seq_number; - if ( GlobalEventInfo ) + if ( activeLevelDecoration ) { uSomeEVT_NumEvents = uGlobalEVT_NumEvents; pSomeEVT = pGlobalEVT; @@ -524,15 +524,15 @@ //v7 = ""; break; case EVENT_ChangeEvent: - v25 = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((unsigned int)_evt->v8 << 8)) << 8)) << 8); + v25 = EVT_DWORD(_evt->v5); if ( v25 ) { - stru_5E4C90._decor_events[GlobalEventInfo + 28] = _evt->v5 - 124; + stru_5E4C90._decor_events[activeLevelDecoration->_idx_in_stru123] = _evt->v5 - 124; } else { - v26 = (LevelDecoration *)GlobalEventInfo; - stru_5E4C90._decor_events[GlobalEventInfo + 28] = 0; + v26 = (LevelDecoration *)activeLevelDecoration; + stru_5E4C90._decor_events[activeLevelDecoration ->_idx_in_stru123] = 0; LOBYTE(v26->field_2) |= 0x20u; } ++curr_seq_num; @@ -722,7 +722,7 @@ pVideoPlayer->Unload(); window_SpeakInHouse->Release(); pParty->uFlags &= 0xFFFFFFFDu; - GlobalEventInfo = 1; + activeLevelDecoration = (LevelDecoration*)1; if ( EnterHouse(HOUSE_BODY_GUILD_ERATHIA) ) { pAudioPlayer->PlaySound((SoundID)0, 0, 0, -1, 0, 0, 0, 0); @@ -1241,9 +1241,9 @@ break; case EVENT_StatusText: v90 = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8); - if ( GlobalEventInfo ) + if ( activeLevelDecoration ) { - if ( GlobalEventInfo == 1 ) + if ( activeLevelDecoration == (void*)1 ) { ptr_F8B1E8 = pNPCTopics[v90-1].pText;//(&dword_721664)[8 * v90]; ++curr_seq_num; @@ -1288,7 +1288,7 @@ break; case EVENT_ShowMessage: v92 = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8); - if ( GlobalEventInfo ) + if ( activeLevelDecoration ) { v93 = (char *)pNPCTopics[v92-1].pText;//(&dword_721664)[8 * v92]; byte_5B0938[0] = 0; @@ -1441,7 +1441,7 @@ } else { - pGameLoadingUI_ProgressBar->uType = (GUIProgressBar::Type)((GlobalEventInfo == 0) + 1); + pGameLoadingUI_ProgressBar->uType = (GUIProgressBar::Type)((activeLevelDecoration == NULL) + 1); sub_44987B(v99, 0); v133 = 1; if ( pCurrentScreen == SCREEN_HOUSE )
--- a/GUIWindow.cpp Sat Mar 02 08:59:10 2013 +0600 +++ b/GUIWindow.cpp Sat Mar 02 09:01:48 2013 +0600 @@ -15,7 +15,6 @@ #include "Viewport.h" #include "Render.h" #include "PlayerFrameTable.h" -#include "stru179.h" #include "SaveLoad.h" #include "FactionTable.h" #include "StorylineTextTable.h" @@ -474,10 +473,10 @@ InitializeBookFonts(); v1->CreateButton(0x1DBu, 0x1BDu, 0x9Eu, 0x22u, 1, 0, 0x71u, 0, 0, pGlobalTXT_LocalizationStrings[79], 0); pCurrentScreen = SCREEN_BOOKS; - dword_506524 = 0; + awards_count2 = 0; dword_506528 = 0; dword_50651C = 0; - dword_506520 = 0; + awards_count = 0; if ( v1->ptr_1C == (void *)177 ) { byte_506360 = 0; @@ -558,15 +557,15 @@ pBtn_Book_2 = v1->CreateButton(pViewport->uViewportX + 398, pViewport->uViewportY + 38, pTex_tab_an_7b__zoot_on->uTextureHeight, pTex_tab_an_7b__zoot_on->uTextureHeight, 1, 0, 0x47u, 0xAu, 0, pGlobalTXT_LocalizationStrings[193],// "Scroll Down" pTex_tab_an_7b__zoot_on, 0); - dword_506520 = 0; - memset(&pStru179, 0, 0xFA0u); + awards_count = 0; + memset(&achievedAwardsIndex, 0, 4000); for ( i = dword_506528; i < 512; ++i ) { v14 = (char *)pQuestTable[i-1];//(&dword_722F10)[4 * i]; - if ( (unsigned __int16)_449B57_test_bit(pParty->_quest_bits, i) && v14 ) + if ( _449B57_test_bit(pParty->_quest_bits, i) && v14 ) { - v15 = dword_506520++; - pStru179.field_0[v15] = i; + v15 = awards_count++; + achievedAwardsIndex[v15] = i; } } } @@ -610,7 +609,7 @@ pGlobalTXT_LocalizationStrings[662], pTexture_50636C, 0);// "Instructors" v10 = dword_506528; pBtn_Autonotes_Instructors = v9; - dword_506520 = 0; + awards_count = 0; while ( v10 < 196 ) { if ( dword_506568 == pAutonoteTxt[v10-1].eType)//dword_72371C[2 * v10] ) @@ -619,10 +618,10 @@ v25 = (char *)pAutonoteTxt[v10-1].pText; if ( (short)v10 ) { - if ( (unsigned __int16)_449B57_test_bit(pParty->_autonote_bits, v10) && v25 ) + if ( _449B57_test_bit(pParty->_autonote_bits, v10) && v25 ) { - v11 = dword_506520++; - pStru179.field_0[v11] = (signed __int16)v10; + v11 = awards_count++; + achievedAwardsIndex[v11] = (signed __int16)v10; } } } @@ -704,7 +703,7 @@ pGlobalTXT_LocalizationStrings[193], pTex_tab_an_7b__zoot_on, 0); - dword_506520 = 0; + awards_count = 0; v26.uFrameX = 48; v26.uFrameY = 70; v26.uFrameWidth = 360; @@ -713,7 +712,7 @@ v26.uFrameZ = 407; v26.uFrameHeight = v2 * 264 / v2; v26.uFrameW = v26.uFrameHeight + 69; - memset(&pStru179, 0, 0xFA0u); + memset(&achievedAwardsIndex, 0, 4000); memset(byte_5C6D50, 0, 0x64u); if ( dword_506528 < 29 ) { @@ -731,10 +730,10 @@ v8 = v7 + 1; if ( (signed int)v7 + 1 > 0 ) { - memset32((char *)&pStru179 + 4 * dword_506520 , i, v8); + memset32((char *)&achievedAwardsIndex + 4 * awards_count , i, v8); do { - LODWORD(v7) = dword_506520++; + LODWORD(v7) = awards_count++; byte_5C6D50[(int)v7] = BYTE4(v7); ++HIDWORD(v7); } @@ -748,9 +747,9 @@ } } } - v12 = dword_506520; - dword_506520 = 0; - dword_506524 = v12; + v12 = awards_count; + awards_count = 0; + awards_count2 = v12; } } }
--- a/Game.h Sat Mar 02 08:59:10 2013 +0600 +++ b/Game.h Sat Mar 02 09:01:48 2013 +0600 @@ -82,7 +82,7 @@ static void Destroy(); protected: Game(); -protected: ~Game(); +protected: virtual ~Game(); public: void _44E904(); @@ -113,7 +113,7 @@ struct IndoorCameraD3D *GetIndoorCamera() {return this->pIndoorCameraD3D;} - void (__thiscall ***vdestructor_ptr)(Game *, bool); + //void (__thiscall ***vdestructor_ptr)(Game *, bool); Game__StationaryLight pStationaryLights[25]; char field_2C0[1092]; unsigned int uNumStationaryLights;
--- a/Indoor.cpp Sat Mar 02 08:59:10 2013 +0600 +++ b/Indoor.cpp Sat Mar 02 09:01:48 2013 +0600 @@ -41,7 +41,7 @@ LevelDecoration pLevelDecorations[3000]; size_t uNumLevelDecorations; -int GlobalEventInfo; +LevelDecoration* activeLevelDecoration; LEVEL_TYPE uCurrentlyLoadedLevelType = LEVEL_null;
--- a/Indoor.h Sat Mar 02 08:59:10 2013 +0600 +++ b/Indoor.h Sat Mar 02 09:01:48 2013 +0600 @@ -42,7 +42,7 @@ #pragma pack(pop) extern LevelDecoration pLevelDecorations[3000]; extern size_t uNumLevelDecorations; -extern int GlobalEventInfo; +extern LevelDecoration* activeLevelDecoration;
--- a/IndoorCameraD3D.h Sat Mar 02 08:59:10 2013 +0600 +++ b/IndoorCameraD3D.h Sat Mar 02 09:01:48 2013 +0600 @@ -14,7 +14,7 @@ //----- (004C039C) -------------------------------------------------------- //void ~IndoorCameraD3D_Vec3() {} - void (__thiscall ***vdestructor_ptr)(IndoorCameraD3D_Vec3 *, bool); + //void (__thiscall ***vdestructor_ptr)(IndoorCameraD3D_Vec3 *, bool); union { @@ -43,6 +43,7 @@ {} float dot; + int _wtf; // sizeof vec4 is 18 and first member is vdtor, but vdtor is already included in vec3 so very weird }; #pragma pack(pop) @@ -157,7 +158,7 @@ void ViewTransfrom_OffsetUV(struct RenderVertexSoft *pVertices, unsigned int uNumVertices, struct RenderVertexSoft *pOutVertices, struct stru320 *a5); char ApplyViewTransform_TrueIfStillVisible(int x, int y, int z, signed int *pOutX, int *pOutZ, int *pOutY, char bDoNotShow); - void (__thiscall ***vdestructor_ptr)(IndoorCameraD3D *, bool); + //void (__thiscall ***vdestructor_ptr)(IndoorCameraD3D *, bool); IndoorCameraD3D_Vec3 field_4[3]; //IndoorCameraD3D_Vec3 field_14; //IndoorCameraD3D_Vec3 field_24;
--- a/LightmapBuilder.h Sat Mar 02 08:59:10 2013 +0600 +++ b/LightmapBuilder.h Sat Mar 02 09:01:48 2013 +0600 @@ -9,8 +9,9 @@ struct Lightmap { Lightmap(); + virtual ~Lightmap() {} - void (__thiscall ***vdestructor_ptr)(Lightmap *, bool); + //void (__thiscall ***vdestructor_ptr)(Lightmap *, bool); unsigned int uNumVertices; RenderVertexSoft pVertices[64]; __int16 field_C08; @@ -29,7 +30,7 @@ struct LightmapBuilder { LightmapBuilder(); - inline ~LightmapBuilder() //----- (0045BBAA) + virtual ~LightmapBuilder() //----- (0045BBAA) {} void DoDrawLightmaps(); @@ -57,7 +58,7 @@ bool ApplyLights(struct stru320 *a2, struct stru154 *a3, unsigned int uNumVertices, struct RenderVertexSoft *a5, struct IndoorCameraD3D_Vec4 *, char uClipFlag); - void (__thiscall ***vdestructor_ptr)(LightmapBuilder *, bool); + //void (__thiscall ***vdestructor_ptr)(LightmapBuilder *, bool); //std::vector<Lightmap> std__vector_000004; //std::vector<Lightmap> std__vector_183808; Lightmap std__vector_000004[512];
--- a/Lights.h Sat Mar 02 08:59:10 2013 +0600 +++ b/Lights.h Sat Mar 02 09:01:48 2013 +0600 @@ -98,7 +98,7 @@ - void (__thiscall ***vdestructor_ptr)(LightsStack_StationaryLight_ *, bool); + //void (__thiscall ***vdestructor_ptr)(LightsStack_StationaryLight_ *, bool); StationaryLight pLights[400]; unsigned int uNumLightsActive; }; @@ -127,7 +127,7 @@ - void (__thiscall ***vdestructor_ptr)(LightsStack_MobileLight_ *, bool); + //void (__thiscall ***vdestructor_ptr)(LightsStack_MobileLight_ *, bool); MobileLight pLights[400]; unsigned int uNumLightsActive; };
--- a/Party.h Sat Mar 02 08:59:10 2013 +0600 +++ b/Party.h Sat Mar 02 09:01:48 2013 +0600 @@ -277,10 +277,6 @@ ItemGen StandartItemsInShops[53][12]; ItemGen SpecialItemsInShops[53][12]; //D0EC ItemGen SpellBooksInGuilds[32][12]; - //int field_12A5C[2117]; - // char field_14B70[5000]; - //char field_15EF8[250]; - //char field_15FF2[130]; char pHireling1Name[100]; char pHireling2Name[100]; int armageddon_timer;
--- a/Player.cpp Sat Mar 02 08:59:10 2013 +0600 +++ b/Player.cpp Sat Mar 02 09:01:48 2013 +0600 @@ -8868,9 +8868,8 @@ return; case VAR_Award: v13 = pPlayers[uPlayerIdx + 1]; - v33 = 0x80u >> ((signed __int16)val - 1) % 8; - if ( !((unsigned __int8)(0x80u >> ((signed __int16)val - 1) % 8) & v13->_guilds_member_bits[((signed __int16)val - 1) >> 3]) - //&& dword_723E80_award_related[2 * val] ) + if (_449B57_test_bit((unsigned __int8 *)pPlayers[uPlayerIdx + 1]->_guilds_member_bits, val) + && pAwards[val].pText ) { v14 = pPlayers[uPlayerIdx + 1];
--- a/Vis.h Sat Mar 02 08:59:10 2013 +0600 +++ b/Vis.h Sat Mar 02 09:01:48 2013 +0600 @@ -87,7 +87,7 @@ //----- (004C05A2) -------------------------------------------------------- //virtual ~Vis() {} //----- (004C05BE) -------------------------------------------------------- - ~Vis() {} + virtual ~Vis() {} bool PickKeyboard(Vis_SelectionList *list, Vis_SelectionFilter *sprite_filter, Vis_SelectionFilter *face_filter); void PickBillboards_Keyboard(float pick_depth, Vis_SelectionList *list, Vis_SelectionFilter *filter); void PickIndoorFaces_Keyboard(float pick_depth, Vis_SelectionList *list, Vis_SelectionFilter *filter); @@ -121,7 +121,7 @@ bool SortByScreenSpaceX(struct RenderVertexSoft *pArray, int sLeft, int sRight); bool SortByScreenSpaceY(struct RenderVertexSoft *pArray, int sLeft, int sRight); - void (__thiscall ***vdestructor_ptr)(Vis *, bool); + //void (__thiscall ***vdestructor_ptr)(Vis *, bool); Vis_SelectionList default_list; RenderVertexSoft stru_200C; RenderVertexSoft stru_203C;
--- a/mm7_1.cpp Sat Mar 02 08:59:10 2013 +0600 +++ b/mm7_1.cpp Sat Mar 02 09:01:48 2013 +0600 @@ -38,7 +38,6 @@ #include "stru123.h" #include "Time.h" #include "IconFrameTable.h" -#include "stru179.h" #include "Awards.h" #include "Autonotes.h" #include "stru160.h" @@ -612,11 +611,11 @@ } //----- (0041A000) -------------------------------------------------------- -unsigned int __fastcall CharacterUI_AwardsTab_Draw(unsigned int uPlayerID) -{ +void CharacterUI_AwardsTab_Draw( unsigned int uPlayerID ) + { //unsigned int v1; // esi@1 unsigned int v2; // ebx@1 - unsigned int v3; // eax@1 + unsigned int award_texture_id; // eax@1 unsigned int result; // eax@1 int v5; // eax@15 char *v6; // ebx@15 @@ -637,15 +636,15 @@ int v21; // [sp+C8h] [bp-8h]@14 int v22; // [sp+CCh] [bp-4h]@40 - auto player = pParty->pPlayers + uPlayerID - 1; + auto player = &pParty->pPlayers[uPlayerID - 1]; //v1 = uPlayerID; v2 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu); - v3 = pIcons_LOD->LoadTexture("fr_award", TEXTURE_16BIT_PALETTE); - pRenderer->DrawTextureIndexed(8u, 8u, (Texture *)(v3 != -1 ? &pIcons_LOD->pTextures[v3] : 0)); - sprintfex(pTmpBuf, "%s\xC" "%05d", pGlobalTXT_LocalizationStrings[23], v2); - sprintfex(Source, pGlobalTXT_LocalizationStrings[429], player->pName, pClassNames[player->classType]); + award_texture_id = pIcons_LOD->LoadTexture("fr_award", TEXTURE_16BIT_PALETTE); + pRenderer->DrawTextureIndexed(8u, 8u, (Texture *)(award_texture_id != -1 ? &pIcons_LOD->pTextures[award_texture_id] : 0)); + sprintfex(pTmpBuf, "%s \f%05d", pGlobalTXT_LocalizationStrings[LOCSTR_AVARDS_FOR], v2); + sprintfex(Source, pGlobalTXT_LocalizationStrings[LOCSTR_S_THE_S], player->pName, pClassNames[player->classType]); strcat(pTmpBuf, Source); - strcat(pTmpBuf, "\xC" "00000"); + strcat(pTmpBuf, "\f00000"); pGUIWindow_CurrentMenu->DrawText(pFontArrus, 24, 18, 0, pTmpBuf, 0, 0, 0); result = dword_506528; a1.uFrameX = 12; @@ -654,7 +653,7 @@ a1.uFrameHeight = 290; a1.uFrameZ = 435; a1.uFrameW = 337; - if ( dword_506544 && dword_506520 + dword_506528 < dword_506524 ) + if ( dword_506544 && awards_count + dword_506528 < awards_count2 ) result = dword_506528++ + 1; if ( dword_506548 && result ) { @@ -663,16 +662,16 @@ } if ( dword_50651C < 0 ) { - result += dword_506520; + result += awards_count; dword_506528 = result; - if ( (signed int)(dword_506520 + result) <= dword_506524 ) + if ( (signed int)(awards_count + result) <= awards_count2 ) goto LABEL_14; - result = dword_506524 - dword_506520; + result = awards_count2 - awards_count; goto LABEL_13; } if ( dword_50651C > 0 ) { - result -= dword_506520; + result -= awards_count; dword_506528 = result; if ( (result & 0x80000000u) != 0 ) { @@ -685,16 +684,16 @@ LABEL_14: dword_506544 = 0; dword_506548 = 0; - dword_506520 = 0; + awards_count = 0; dword_50651C = 0; v21 = result; - if ( (signed int)result < dword_506524 ) + if ( (signed int)result < awards_count2 ) { while ( 1 ) { - v5 = pStru179.field_0[v21]; - v20 = 8 * pStru179.field_0[v21]; - v6 = (char *)pAwards[(v20-1)/8].pText;//(char *)dword_723E80_award_related[v20 / 4]; + v5 = achievedAwardsIndex[v21]; + v20 = achievedAwardsIndex[v21]; + v6 = (char *)pAwards[v20].pText;//(char *)dword_723E80_award_related[v20 / 4]; if ( v5 != 1 ) break; v17 = pParty->uFine; @@ -702,8 +701,8 @@ sprintf(pTmpBuf, v6, v17); v6 = pTmpBuf; LABEL_43: - v14 = pAwards[v20/8-1].uSort;//dword_723E84[v20 / 4]; - ++dword_506520; + v14 = pAwards[v20].uSort;//dword_723E84[v20 / 4]; + ++awards_count; v15 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat( pAwardsTextColors[3 * v14 % 6], pAwardsTextColors[3 * v14 % 6 + 1], @@ -716,10 +715,10 @@ ++v21; a1.uFrameY = result; result = v21; - if ( v21 < dword_506524 ) + if ( v21 < awards_count2 ) continue; } - return result; + return; } if ( (v5 < 85 || v5 > 91) && (v5 < 103 || v5 > 104) ) goto LABEL_43; @@ -786,7 +785,7 @@ v17 = v22; goto LABEL_42; } - return result; + return; } // 50651C: using guessed type int dword_50651C; // 506520: using guessed type int dword_506520; @@ -4791,7 +4790,7 @@ pWindow->CreateButton(0x124u, 0x1A8u, 0x1Fu, 0, 2, 94, 0x6Eu, 3u, 0x33u, "", 0); pWindow->CreateButton(0x197u, 0x1A8u, 0x1Fu, 0, 2, 94, 0x6Eu, 4u, 0x34u, "", 0); pWindow->CreateButton(0, 0, 0, 0, 1, 0, 0xB0u, 0, 9u, "", 0); - sub_419100(); + FillAwardsData(); return pWindow; } @@ -5014,7 +5013,7 @@ viewparams->bRedrawGameUI = true; uActiveCharacter = uPlayerID; if ( pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] == 102 ) - sub_419100(); + FillAwardsData(); return; } //goto LABEL_23; @@ -5244,9 +5243,9 @@ if ( pLevelDecorations[(signed int)(unsigned __int16)v0 >> 3].IsInteractive() ) { v15 = stru_5E4C90._decor_events[v13->_idx_in_stru123 - 75] + 380; - GlobalEventInfo = (int)&pLevelDecorations[(signed int)(unsigned __int16)v0 >> 3]; + activeLevelDecoration = &pLevelDecorations[(signed int)(unsigned __int16)v0 >> 3]; EventProcessor(v15, 0, 1); - GlobalEventInfo = 0; + activeLevelDecoration = NULL; } return; }
--- a/mm7_2.cpp Sat Mar 02 08:59:10 2013 +0600 +++ b/mm7_2.cpp Sat Mar 02 09:01:48 2013 +0600 @@ -29,6 +29,7 @@ #include "SaveLoad.h" #include "stru123.h" #include "stru287.h" +#include "stru176.h" #include "Time.h" #include "IconFrameTable.h" #include "GUIProgressBar.h" @@ -53,6 +54,7 @@ #include "texts.h" #include "mm7_data.h" +#include "MM7.h" //----- (004B4F4F) -------------------------------------------------------- @@ -3730,7 +3732,7 @@ int v37; // ecx@227 int v38; // esi@230 int v39; // edx@235 - void *v40; // edi@243 + int v40; // edi@243 unsigned __int64 v41; // qax@243 void *v42; // eax@244 signed int v43; // edi@244 @@ -4188,14 +4190,14 @@ GenerateStandartShopItems(); GenerateSpecialShopItems(); v8 = window_SpeakInHouse; - v40 = window_SpeakInHouse->ptr_1C; + v40 = window_SpeakInHouse->par1C; //v3 = dword_F8B198; v41 = pParty->uTimePlayed //+ (signed __int64)((double)(11059200 * (signed int)p2DEvents_minus1[26 * (unsigned int)ptr_507BC0->ptr_1C]) + (signed __int64)((double)(11059200 * (signed int)p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].field_1C) * 0.033333335); - pParty->field_3C.field_50[2 * (int)v40] = v41; - pParty->field_3C.field_50[2 * (int)v40 + 1] = HIDWORD(v41); + pParty->field_3C.field_50[v40] = v41; + } v42 = v8->ptr_1C; v43 = 0; @@ -4304,7 +4306,7 @@ pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; pKeyActionMap->_459ED1(3); pKeyActionMap->ResetKeys(); - GlobalEventInfo = 0; + activeLevelDecoration = NULL; ptr_F8B1E8 = 0; if ( pDialogueNPCCount ) { @@ -13128,6 +13130,112 @@ +void IntegrityTest() +{ + assert(sizeof(RenderVertexSoft) == 0x30); + assert(sizeof(RenderBillboard) == 0x34); + assert(sizeof(Texture) == 0x48); + assert(sizeof(RGBTexture) == 0x28); + assert(sizeof(LODFile_IconsBitmaps) == 0x11BB8 + 4); // + virtual dtor ptr + assert(sizeof(AudioPlayer) == 0xC84); + assert(sizeof(SoundDesc) == 0x78); + assert(sizeof(stru339_spell_sound) == 0xAFD8); + assert(sizeof(VideoPlayer) == 0x108 + 4); + assert(sizeof(MovieHeader) == 0x2C); + assert(sizeof(DecorationDesc) == 0x54); + assert(sizeof(ObjectDesc) == 0x38); + assert(sizeof(OverlayDesc) == 0x8); + assert(sizeof(ChestDesc) == 0x24); + assert(sizeof(TileDesc) == 0x1A); + assert(sizeof(MonsterDesc) == 0x98); + assert(sizeof(Timer) == 0x28); + assert(sizeof(OtherOverlay) == 0x14); + assert(sizeof(ItemGen) == 0x24); + assert(sizeof(SpriteObject) == 0x70); + assert(sizeof(ItemDesc) == 0x30); + assert(sizeof(ItemsTable) == 0x117A0); + assert(sizeof(Chest) == 0x14CC); + assert(sizeof(MapInfo) == 0x44); + assert(sizeof(SpellInfo) == 0x24); + assert(sizeof(SpellData) == 0x14); + assert(sizeof(SpellBuff) == 0x10); + assert(sizeof(AIDirection) == 0x1C); + assert(sizeof(ActorJob) == 0xC); + assert(sizeof(Actor) == 0x344); + assert(sizeof(LevelDecoration) == 0x20); + assert(sizeof(KeyboardActionMapping) == 0x20C); + assert(sizeof(UIAnimation) == 0xD); + assert(sizeof(SpawnPointMM7) == 0x18); + assert(sizeof(ODMFace) == 0x134); + assert(sizeof(BSPNode) == 0x8); + assert(sizeof(BSPModel) == 0xBC); + assert(sizeof(OutdoorLocation) == 0x1C28C); + assert(sizeof(BLVFace) == 0x60); + assert(sizeof(BLVFaceExtra) == 0x24); + assert(sizeof(BLVSector) == 0x74); + assert(sizeof(BLVLightMM7) == 0x10); + assert(sizeof(BLVDoor) == 0x50); + assert(sizeof(IndoorLocation) == 0x690); + assert(sizeof(OutdoorCamera) == 0x74); + assert(sizeof(Mouse) == 0x114); + assert(sizeof(Particle_) == 0x68); + assert(sizeof(Particle) == 0x68); + assert(sizeof(ParticleEngine) == 0xE430); + assert(sizeof(Lightmap) == 0xC1C); + assert(sizeof(LightmapBuilder) == 0x3CBC38); + assert(sizeof(Vis_SelectionList) == 0x2008); + assert(sizeof(Vis) == 0x20D0); + assert(sizeof(PlayerBuffAnim) == 0x10); + assert(sizeof(ProjectileAnim) == 0x1C); + assert(sizeof(stru6) == 0x5F8); + assert(sizeof(IndoorCameraD3D_Vec3) == 0x10); + assert(sizeof(IndoorCameraD3D_Vec4) == 0x18); //should be 14 (10 vec3 + 4 vdtor) but 18 coz of his +4 from own vdtor, but it is odd since vdtor already present from vec3 + assert(sizeof(IndoorCameraD3D) == 0x1A1384); + assert(sizeof(StationaryLight) == 0xC); + assert(sizeof(LightsStack_StationaryLight_) == 0x12C8); + assert(sizeof(MobileLight) == 0x12); + assert(sizeof(LightsStack_MobileLight_) == 0x1C28); + assert(sizeof(Game) == 0xE78); + assert(sizeof(stru141) == 0xA8); + assert(sizeof(ActionQueue) == 0x7C); + assert(sizeof(NPCData) == 0x4C); + assert(sizeof(NPCStats) == 0x17FFC); + assert(sizeof(BspRenderer) == 0x53740); + assert(sizeof(PaletteManager) == 0x267AF0); + assert(sizeof(ViewingParams) == 0x26C); + assert(sizeof(IndoorCamera) == 0x50); + assert(sizeof(Bloodsplat) == 0x28); + assert(sizeof(BloodsplatContainer) == 0xA0C); + assert(sizeof(stru167) == 0x18); + assert(sizeof(EventIndex) == 0xC); + assert(sizeof(_2devent) == 0x34); + assert(sizeof(stru176) == 0x20); + assert(sizeof(SavegameHeader) == 0x64); + assert(sizeof(SavegameList) == 0x3138); + assert(sizeof(StorylineText) == 0x168); + assert(sizeof(FactionTable) == 0x1EF1); + assert(sizeof(Decal) == 0xC20); + assert(sizeof(DecalBuilder) == 0x30C038); + assert(sizeof(MonsterInfo) == 0x58); + assert(sizeof(MonsterStats) == 0x5BA0); + assert(sizeof(RenderD3D) == 0x148); + assert(sizeof(Render) == 0x129844); + assert(sizeof(Player) == 0x1B3C); + assert(sizeof(Party_stru0) == 0x678); + assert(sizeof(Party) == 0x16238); + assert(sizeof(GUIButton) == 0xBC); + assert(sizeof(GUIWindow) == 0x54); + assert(sizeof(GUIProgressBar) == 0x1B8); + assert(sizeof(GUIFont) == 0x1020); + assert(sizeof(stru262_TurnBased) == 0x40); + assert(sizeof(ArcomageGame) == 0xFA); + assert(sizeof(stru277) == 0x14); + assert(sizeof(ArcomageCard) == 0x6C); + assert(sizeof(stru320) == 0x3FC); + assert(sizeof(TravelInfo) == 0x20); + assert(sizeof(stru336) == 0x798); +} + bool new_sky = false; //----- (00462C94) -------------------------------------------------------- @@ -13145,9 +13253,11 @@ unsigned int startms; // [sp+8h] [bp-24h]@55 RECT Rect; // [sp+Ch] [bp-20h]@15 int a2[4]; // [sp+1Ch] [bp-10h]@15 - + + IntegrityTest(); char test[1024]; - //sprintfex(test, "^Pi[%s]: ^R[;;]", ""); + sprintfex(test, "^Pi[%s]: ^R[;;]", ""); + if (pCmdLine && *pCmdLine) { @@ -15028,9 +15138,9 @@ v10 = v8->_idx_in_stru123; v24 = 1; v11 = stru_5E4C90._decor_events[v10 - 75] + 380; - GlobalEventInfo = (int)v8; + activeLevelDecoration = v8; EventProcessor(v11, 0, 1); - GlobalEventInfo = 0; + activeLevelDecoration = NULL; } break;
--- a/mm7_3.cpp Sat Mar 02 08:59:10 2013 +0600 +++ b/mm7_3.cpp Sat Mar 02 09:01:48 2013 +0600 @@ -14065,7 +14065,7 @@ pEventTimer->Pause(); dword_5C3418 = v4; dword_5C341C = v3; - _591094_decoration = (LevelDecoration *)GlobalEventInfo; + _591094_decoration = activeLevelDecoration; pGUIWindow2 = GUIWindow::Create(0, 0, 640u, 480u, (enum WindowType)19, a4, 0); pGUIWindow2->CreateButton(61u, 424u, 0x1Fu, 0x28u, 2, 94, 0x6Eu, 1u, 0x31u, "", 0); pGUIWindow2->CreateButton(177u, 424u, 0x1Fu, 0x28u, 2, 94, 0x6Eu, 2u, 0x32u, "", 0); @@ -14079,11 +14079,11 @@ { pGUIWindow2->Release(); pGUIWindow2 = 0; - GlobalEventInfo = (int)_591094_decoration; + activeLevelDecoration = _591094_decoration; start_event_seq_number = dword_5C341C; EventProcessor(dword_5C3418, 0, 1); start_event_seq_number = 0; - GlobalEventInfo = 0; + activeLevelDecoration = NULL; pEventTimer->Resume(); } @@ -16285,8 +16285,8 @@ } //----- (00449B57) -------------------------------------------------------- -unsigned int __fastcall _449B57_test_bit(unsigned __int8 *a1, __int16 a2) -{ +bool _449B57_test_bit( unsigned __int8 *a1, __int16 a2 ) + { return a1[(a2 - 1) >> 3] & (0x80u >> (a2 - 1) % 8); }
--- a/mm7_4.cpp Sat Mar 02 08:59:10 2013 +0600 +++ b/mm7_4.cpp Sat Mar 02 09:01:48 2013 +0600 @@ -9458,9 +9458,9 @@ else { ptr_F8B1E8 = 0; - GlobalEventInfo = 1; + activeLevelDecoration = (LevelDecoration*)1; EventProcessor(pEventNumber, 0, 1); - GlobalEventInfo = 0; + activeLevelDecoration = NULL; } } } @@ -11940,264 +11940,227 @@ //----- (004BC49B) -------------------------------------------------------- void OnSelectDialogueOption(DIALOGUE_TYPE newDialogueType) -{ - //unsigned int v1; // esi@1 - NPCData *v2; // ebp@1 - //unsigned int v3; // eax@1 - int v4; // ecx@10 - signed int v5; // edi@14 - char *v6; // esi@15 - const char *v7; // ecx@22 - signed int v8; // edi@37 - //unsigned int v9; // eax@56 - unsigned int v10; // ecx@57 - void *v11; // [sp-Ch] [bp-1Ch]@46 - int v12; // [sp-8h] [bp-18h]@46 - char *v13; // [sp-8h] [bp-18h]@60 - size_t v14; // [sp-4h] [bp-14h]@46 - const char *v15; // [sp-4h] [bp-14h]@60 - - //v1 = _this; - v2 = GetNPCData(uDialogue_SpeakingActorNPC_ID); - //v3 = v1; - uDialogueType = newDialogueType; - if ( !v2->uFlags ) - { - v2->uFlags = 1; - //v3 = uDialogueType; - } - if ( (signed int)newDialogueType > 22 ) - { - if ( newDialogueType == DIALOGUE_23 ) - { - v4 = v2->evt_E; - goto LABEL_74; - } - if (newDialogueType == DIALOGUE_24) - { - v4 = v2->evt_F; - goto LABEL_74; - } - if (newDialogueType != DIALOGUE_76) - { - if (newDialogueType == DIALOGUE_PROFESSION_DETAILS) - { - dialogue_show_profession_details = ~dialogue_show_profession_details; - } - else - { - if ( (signed int)newDialogueType > 84 && (signed int)newDialogueType <= 88 ) - { - ArenaFight(); - return; - } - } - goto LABEL_87; - } - if (v2->Hired()) - { - v8 = 0; - if ( (signed int)pNPCStats->uNumNewNPCs > 0 ) - { - v6 = (char *)pNPCStats->pNewNPCData; - while ( !(v6[8] & 0x80) || strcmp(v2->pName, *(const char **)v6) ) - { - ++v8; - v6 += 76; - if ( v8 >= (signed int)pNPCStats->uNumNewNPCs ) - goto LABEL_44; - } - goto LABEL_43; - } + { + //unsigned int v1; // esi@1 + NPCData *speakingNPC; // ebp@1 + //unsigned int v3; // eax@1 + int npc_event_id; // ecx@10 + signed int v5; // edi@14 + char *v6; // esi@15 + const char *v7; // ecx@22 + signed int v8; // edi@37 + //unsigned int v9; // eax@56 + unsigned int v10; // ecx@57 + void *v11; // [sp-Ch] [bp-1Ch]@46 + int v12; // [sp-8h] [bp-18h]@46 + char *v13; // [sp-8h] [bp-18h]@60 + size_t v14; // [sp-4h] [bp-14h]@46 + const char *v15; // [sp-4h] [bp-14h]@60 + + //v1 = _this; + speakingNPC = GetNPCData(uDialogue_SpeakingActorNPC_ID); + //v3 = v1; + uDialogueType = newDialogueType; + if ( !speakingNPC->uFlags ) + { + speakingNPC->uFlags = 1; + //v3 = uDialogueType; + } + if ((newDialogueType>DIALOGUE_24)||(newDialogueType<DIALOGUE_19)) + { + + if (newDialogueType != DIALOGUE_76) + { + if (newDialogueType == DIALOGUE_PROFESSION_DETAILS) + { + dialogue_show_profession_details = ~dialogue_show_profession_details; + } + else + { + if ( (signed int)newDialogueType > 84 && (signed int)newDialogueType <= 88 ) + { + ArenaFight(); + return; + } + } + goto LABEL_87; + } + if (speakingNPC->Hired()) + { + v8 = 0; + if ( (signed int)pNPCStats->uNumNewNPCs > 0 ) + { + v6 = (char *)pNPCStats->pNewNPCData; + while ( !(v6[8] & 0x80) || strcmp(speakingNPC->pName, *(const char **)v6) ) + { + ++v8; + v6 += 76; + if ( v8 >= (signed int)pNPCStats->uNumNewNPCs ) + goto LABEL_44; + } + goto LABEL_43; + } LABEL_44: - if ( !pParty->pHirelings[0].pName || _strcmpi(pParty->pHirelings[0].pName, v2->pName) ) - { - if ( !pParty->pHirelings[1].pName || _strcmpi(pParty->pHirelings[1].pName, v2->pName) ) - { + if ( !pParty->pHirelings[0].pName || _strcmpi(pParty->pHirelings[0].pName, speakingNPC->pName) ) + { + if ( !pParty->pHirelings[1].pName || _strcmpi(pParty->pHirelings[1].pName, speakingNPC->pName) ) + { LABEL_51: - pParty->field_709 = 0; - sub_44A56A(); - dword_591084 = 0; - pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); - /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) - { - pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)113; - pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 1; - *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; - ++pMessageQueue_50CBD0->uNumMessages; - }*/ - goto LABEL_89; - } - v14 = 76; - v12 = 0; - v11 = &pParty->pHirelings[1]; - } - else - { - v14 = 76; - v12 = 0; - v11 = pParty->pHirelings; - } - memset(v11, v12, v14); - goto LABEL_51; - } - if ( pParty->pHirelings[0].pName && pParty->pHirelings[1].pName ) - { - v7 = pGlobalTXT_LocalizationStrings[533]; // ""I cannot join you, you're party is full"" + pParty->field_709 = 0; + sub_44A56A(); + dword_591084 = 0; + pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); + + goto LABEL_89; + } + v11 = &pParty->pHirelings[1]; + } + else + { + v11 = pParty->pHirelings; + } + memset(v11, 0, sizeof(NPCData)); + goto LABEL_51; + } + if ( pParty->pHirelings[0].pName && pParty->pHirelings[1].pName ) + { + v7 = pGlobalTXT_LocalizationStrings[533]; // ""I cannot join you, you're party is full"" LABEL_64: - ShowStatusBarString(v7, 2u); - goto LABEL_87; - } - //v9 = v2->uProfession; - if ( v2->uProfession != 51 ) - { - v10 = pNPCStats->pProfessions[v2->uProfession - 1].uHirePrice; - if ( pParty->uNumGold < v10 ) - { - ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u);// "You don't have enough gold" - dialogue_show_profession_details = false; - uDialogueType = 13; + ShowStatusBarString(v7, 2u); + goto LABEL_87; + } + //v9 = v2->uProfession; + if ( speakingNPC->uProfession != 51 ) + { + v10 = pNPCStats->pProfessions[speakingNPC->uProfession - 1].uHirePrice; + if ( pParty->uNumGold < v10 ) + { + ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u);// "You don't have enough gold" + dialogue_show_profession_details = false; + uDialogueType = 13; + if ( uActiveCharacter ) + pPlayers[uActiveCharacter]->PlaySound(SPEECH_NotEnoughGold, 0); + v7 = pGlobalTXT_LocalizationStrings[155]; + ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u); + goto LABEL_87; + } + Party::TakeGold(v10); + } + LOBYTE(speakingNPC->uFlags) |= 0x80u; + if ( pParty->pHirelings[0].pName ) + { + memcpy(&pParty->pHirelings[1], speakingNPC, sizeof(pParty->pHirelings[1])); + v15 = speakingNPC->pName; + v13 = pParty->pHireling2Name; + } + else + { + memcpy(pParty->pHirelings, speakingNPC, 0x4Cu); + v15 = speakingNPC->pName; + v13 = pParty->pHireling1Name; + } + strcpy(v13, v15); + pParty->field_709 = 0; + sub_44A56A(); + + pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); + + if ( (uDialogue_SpeakingActorNPC_ID & 0x80000000u) == 0 ) + pDialogue_SpeakingActor->uAIState = Removed; if ( uActiveCharacter ) - pPlayers[uActiveCharacter]->PlaySound(SPEECH_NotEnoughGold, 0); - v7 = pGlobalTXT_LocalizationStrings[155]; - goto LABEL_64; - } - Party::TakeGold(v10); - } - LOBYTE(v2->uFlags) |= 0x80u; - if ( pParty->pHirelings[0].pName ) - { - memcpy(&pParty->pHirelings[1], v2, sizeof(pParty->pHirelings[1])); - v15 = v2->pName; - v13 = pParty->pHireling2Name; - } + pPlayers[uActiveCharacter]->PlaySound(SPEECH_61, 0); + goto LABEL_87; + if (newDialogueType == DIALOGUE_9) + { + if ( !sub_4BB756(speakingNPC->uProfession) ) + { + if ( speakingNPC->uProfession != 41 ) + speakingNPC->bHasUsedTheAbility = 1; + + pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); + } + else + { + ShowStatusBarString(pGlobalTXT_LocalizationStrings[140], 2u); //"Your packs are already full!" + } + + goto LABEL_87; + } + if (newDialogueType == DIALOGUE_13) + { + if (!speakingNPC->Hired()) + { + sub_4B3E1E(); + dialogue_show_profession_details = false; + goto LABEL_87; + } + else + { + v5 = 0; + if ( (signed int)pNPCStats->uNumNewNPCs > 0 ) + { + v6 = (char *)pNPCStats->pNewNPCData; + while ( !(v6[8] & 0x80) || strcmp(speakingNPC->pName, *(const char **)v6) ) + { + ++v5; + v6 += 76; + if ( v5 >= (signed int)pNPCStats->uNumNewNPCs ) + goto LABEL_44; + } +LABEL_43: + v6[8] &= 0x7Fu; + goto LABEL_44; + } + goto LABEL_44; + } + } + } else - { - memcpy(pParty->pHirelings, v2, 0x4Cu); - v15 = v2->pName; - v13 = pParty->pHireling1Name; - } - strcpy(v13, v15); - pParty->field_709 = 0; - sub_44A56A(); - - pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); - /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) - { - pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)113; - pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 1; - *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; - ++pMessageQueue_50CBD0->uNumMessages; - }*/ - if ( (uDialogue_SpeakingActorNPC_ID & 0x80000000u) == 0 ) - pDialogue_SpeakingActor->uAIState = Removed; - if ( uActiveCharacter ) - pPlayers[uActiveCharacter]->PlaySound(SPEECH_61, 0); - goto LABEL_87; - } - if (newDialogueType == DIALOGUE_22) - { - v4 = v2->evt_D; - goto LABEL_74; - } - if (newDialogueType == DIALOGUE_9) - { - if ( !sub_4BB756(v2->uProfession) ) - { - if ( v2->uProfession != 41 ) - v2->bHasUsedTheAbility = 1; - /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) - { - pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)113; - pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 1; - *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; - ++pMessageQueue_50CBD0->uNumMessages; - }*/ - pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); - goto LABEL_87; - } - v7 = pGlobalTXT_LocalizationStrings[140]; - goto LABEL_64; - } - if (newDialogueType == DIALOGUE_13) - { - if (!v2->Hired()) - { - sub_4B3E1E(); - dialogue_show_profession_details = false; - goto LABEL_87; - } - v5 = 0; - if ( (signed int)pNPCStats->uNumNewNPCs > 0 ) - { - v6 = (char *)pNPCStats->pNewNPCData; - while ( !(v6[8] & 0x80) || strcmp(v2->pName, *(const char **)v6) ) - { - ++v5; - v6 += 76; - if ( v5 >= (signed int)pNPCStats->uNumNewNPCs ) - goto LABEL_44; - } -LABEL_43: - v6[8] &= 0x7Fu; - goto LABEL_44; - } - goto LABEL_44; - } - if (newDialogueType == DIALOGUE_19) - { - v4 = v2->evt_A; - goto LABEL_74; - } - if (newDialogueType == DIALOGUE_20) - { - v4 = v2->evt_B; - goto LABEL_74; - } - if (newDialogueType == DIALOGUE_21) - { - v4 = v2->evt_C; -LABEL_74: - if ( v4 < 200 || v4 > 310 ) - { - if ( v4 < 400 || v4 > 410 ) - { - switch ( v4 ) - { - case 139: - sub_4B1ECE(); - break; - case 311: - sub_4BBA85_bounties(); - break; - case 399: - sub_4BBCDD(); - break; - default: - GlobalEventInfo = 1; - ptr_F8B1E8 = 0; - EventProcessor(v4, 0, 1); - GlobalEventInfo = 0; - break; - } - } - else - { - dword_F8B1D8 = newDialogueType; - DrawJoinGuildWindow(v4 - 400); - } - } - else - { - sub_4B3FE5(v4); - } - } + { + switch(newDialogueType) + { + case DIALOGUE_19: npc_event_id = speakingNPC->evt_A; break; + case DIALOGUE_20: npc_event_id = speakingNPC->evt_B; break; + case DIALOGUE_21: npc_event_id = speakingNPC->evt_C; break; + case DIALOGUE_22: npc_event_id = speakingNPC->evt_D; break; + case DIALOGUE_23: npc_event_id = speakingNPC->evt_E; break; + case DIALOGUE_24: npc_event_id = speakingNPC->evt_F; break; + } + if ( (npc_event_id >= 200) && (npc_event_id <= 310) ) + sub_4B3FE5(npc_event_id); //200-310 + else if (( npc_event_id >= 400) && (npc_event_id <= 410) ) + { //400-410 + dword_F8B1D8 = newDialogueType; + DrawJoinGuildWindow(npc_event_id - 400); + } + else + { + switch ( npc_event_id ) + { + case 139: + sub_4B1ECE(); + break; + case 311: + sub_4BBA85_bounties(); + break; + case 399: + sub_4BBCDD(); + break; + default: + activeLevelDecoration = (LevelDecoration*)1; + ptr_F8B1E8 = 0; + EventProcessor(npc_event_id, 0, 1); + activeLevelDecoration = NULL; + break; + } + } + } LABEL_87: - if ( !dword_7241C8 ) - pGame->Draw(); + if ( !dword_7241C8 ) + pGame->Draw(); LABEL_89: - dword_7241C8 = 0; -} + dword_7241C8 = 0; + }
--- a/mm7_5.cpp Sat Mar 02 08:59:10 2013 +0600 +++ b/mm7_5.cpp Sat Mar 02 09:01:48 2013 +0600 @@ -31,7 +31,6 @@ #include "stru123.h" #include "Time.h" #include "IconFrameTable.h" -#include "stru179.h" #include "Awards.h" #include "Autonotes.h" #include "stru160.h" @@ -3174,7 +3173,7 @@ pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 102; GUIWindow::Create(pCharacterScreen_AwardsBtn->uX, pCharacterScreen_AwardsBtn->uY, 0, 0, (WindowType)(WINDOW_HouseInterior|0x42), (int)pCharacterScreen_AwardsBtn, 0); - sub_419100(); + FillAwardsData(); continue; case UIMSG_AutonotesBook: switch ( uMessageParam ) @@ -13602,7 +13601,7 @@ v0 = pViewport->uViewportX + 398; } pRenderer->DrawTextureTransparent(v0, v11, v13); - if ( dword_506544 || dword_506528 + dword_506520 >= dword_506524 ) + if ( dword_506544 || dword_506528 + awards_count >= awards_count2 ) { v14 = pTex_tab_an_7a__zoot_off; v12 = pViewport->uViewportY + 38; @@ -13617,7 +13616,7 @@ pRenderer->DrawTextureTransparent(v1, v12, v14); if ( !byte_5C6D50[dword_506528] ) { - v2 = pStru179.field_0[dword_506528]; + v2 = achievedAwardsIndex[dword_506528]; a1.uFrameWidth = 460; a1.uFrameX = 8; a1.uFrameY = 8; @@ -13636,12 +13635,12 @@ a1.uFrameZ = 407; a1.uFrameHeight = v4 * 264 / v4; a1.uFrameW = a1.uFrameHeight + 69; - if ( dword_506544 && dword_506528 + dword_506520 < dword_506524 ) + if ( dword_506544 && dword_506528 + awards_count < awards_count2 ) { pAudioPlayer->PlaySound((SoundID)230, 0, 0, -1, 0, 0, 0, 0); v5 = dword_50651C++; - dword_506528 += dword_506520; - byte_506130[v5] = dword_506520; + dword_506528 += awards_count; + byte_506130[v5] = awards_count; } if ( dword_506548 && dword_50651C ) { @@ -13649,15 +13648,15 @@ --dword_50651C; dword_506528 -= (unsigned __int8)byte_506130[dword_50651C]; } - if ( !dword_506520 || dword_506528 < 1 ) + if ( !awards_count || dword_506528 < 1 ) { dword_506528 = 0; dword_50651C = 0; } dword_506544 = 0; - v6 = pStru179.field_0[dword_506528]; + v6 = achievedAwardsIndex[dword_506528]; dword_506548 = 0; - dword_506520 = 0; + awards_count = 0; //v7 = *pStorylineText->StoreLine[v6].pText;//*(&pStorylineText->field_0 + 3 * v6); v7 = (int)pStorylineText->StoreLine[v6].pText;//*(&pStorylineText->field_0 + 3 * v6); v8 = BuilDialogueString( @@ -13671,7 +13670,7 @@ { v9 = pAutonoteFont->_44C6C2(v8, &a1, 1u, (unsigned __int8)byte_5C6D50[dword_506528]); LOBYTE(v8) = a1.DrawText(pAutonoteFont, 1, 0, 0, (const char *)v9, 0, a1.uFrameY + a1.uFrameHeight, 0); - ++dword_506520; + ++awards_count; } return (char)v8; } @@ -13708,7 +13707,7 @@ v0 = pViewport->uViewportX + 398; } pRenderer->DrawTextureTransparent(v0, v8, v10); - if ( dword_506544 || dword_506528 + dword_506520 >= dword_506524 ) + if ( dword_506544 || dword_506528 + awards_count >= awards_count2 ) { v11 = pTex_tab_an_7a__zoot_off; v9 = pViewport->uViewportY + 38; @@ -13734,12 +13733,12 @@ a1.uFrameHeight = 264; a1.uFrameZ = 407; a1.uFrameW = 333; - if ( dword_506544 && dword_506528 + dword_506520 < dword_506524 ) + if ( dword_506544 && dword_506528 + awards_count < awards_count2 ) { pAudioPlayer->PlaySound((SoundID)230, 0, 0, -1, 0, 0, 0, 0); v2 = dword_50651C++; - dword_506528 += dword_506520; - byte_506130[v2] = dword_506520; + dword_506528 += awards_count; + byte_506130[v2] = awards_count; } if ( dword_506548 && dword_50651C ) { @@ -13747,7 +13746,7 @@ --dword_50651C; dword_506528 -= (unsigned __int8)byte_506130[dword_50651C]; } - if ( !dword_506520 || (v3 = dword_506528, dword_506528 < 1) ) + if ( !awards_count || (v3 = dword_506528, dword_506528 < 1) ) { v3 = 0; dword_50651C = 0; @@ -13755,11 +13754,11 @@ } dword_506544 = 0; dword_506548 = 0; - dword_506520 = 0; - while ( v3 < dword_506524 ) - { - v4 = pStru179.field_0[v3]; - ++dword_506520; + awards_count = 0; + while ( v3 < awards_count2 ) + { + v4 = achievedAwardsIndex[v3]; + ++awards_count; v5 = pQuestTable[v4-1];//(&dword_722F10)[4 * v4]; a1.DrawText(pAutonoteFont, 1, 0, 0, pQuestTable[v4-1], 0, 0, 0);//(&dword_722F10)[4 * v4], 0, 0, 0); v6 = pAutonoteFont->CalcTextHeight(v5, &a1, 1, 0); @@ -13826,7 +13825,7 @@ v0 = pViewport->uViewportX + 398; } pRenderer->DrawTextureTransparent(v0, v17, v24); - if ( dword_506544 || dword_506528 + dword_506520 >= dword_506524 ) + if ( dword_506544 || dword_506528 + awards_count >= awards_count2 ) { v25 = pTex_tab_an_7a__zoot_off; v18 = pViewport->uViewportY + 38; @@ -14000,10 +13999,10 @@ a1.uFrameW = 333; if ( v31 ) { - dword_506524 = 0; + awards_count2 = 0; dword_506528 = 0; dword_50651C = 0; - dword_506520 = 0; + awards_count = 0; v8 = 0; do { @@ -14016,25 +14015,25 @@ { if ( (unsigned __int16)_449B57_test_bit(pParty->_autonote_bits, v8) && v32 ) { - v9 = dword_506520++; - pStru179.field_0[v9] = (signed __int16)v8; + v9 = awards_count++; + achievedAwardsIndex[v9] = (signed __int16)v8; } } } ++v8; } while ( v8 < 196 ); - dword_506524 = dword_506520; + awards_count2 = awards_count; } else { if ( dword_506544 ) { - v10 = dword_506520 + dword_506528; - if ( dword_506520 + dword_506528 < dword_506524 ) + v10 = awards_count + dword_506528; + if ( awards_count + dword_506528 < awards_count2 ) { v11 = dword_50651C++; - byte_506130[v11] = dword_506520; + byte_506130[v11] = awards_count; dword_506528 = v10; pAudioPlayer->PlaySound((SoundID)230, 0, 0, -1, 0, 0, 0, 0); } @@ -14045,7 +14044,7 @@ dword_506528 -= (unsigned __int8)byte_506130[dword_50651C]; pAudioPlayer->PlaySound((SoundID)230, 0, 0, -1, 0, 0, 0, 0); } - if ( !dword_506520 || dword_506528 < 1 ) + if ( !awards_count || dword_506528 < 1 ) { dword_506528 = 0; dword_50651C = 0; @@ -14055,16 +14054,16 @@ dword_50652C = 0; dword_506544 = 0; dword_506548 = 0; - dword_506520 = 0; + awards_count = 0; dword_506530 = 0; dword_506534 = 0; dword_506538 = 0; dword_50653C = 0; dword_506540 = 0; - while ( v12 < dword_506524 ) - { - v13 = pStru179.field_0[v12]; - ++dword_506520; + while ( v12 < awards_count2 ) + { + v13 = achievedAwardsIndex[v12]; + ++awards_count; //v14 = (&dword_723718_autonote_related)[8 * v13]; v14 = pAutonoteTxt[v13-1].pText; //a1.DrawText(pAutonoteFont, 1, 0, 0, (&dword_723718_autonote_related)[8 * v13], 0, 0, 0); @@ -17657,88 +17656,45 @@ } //----- (00419100) -------------------------------------------------------- -int __cdecl sub_419100() -{ - Player *pPlayer; // esi@1 - int v1; // ebx@1 - unsigned __int8 *v2; // esi@1 - int v3; // eax@4 - int result; // eax@6 - int v5; // esi@6 - unsigned __int8 v6; // zf@6 - unsigned __int8 v7; // sf@6 - int v8; // edx@7 - int v9; // ecx@7 - unsigned __int8 v10; // of@7 - stru179 *v11; // edi@9 - int v12; // edx@11 - char *v13; // [sp+Ch] [bp-8h]@2 - signed int v14; // [sp+Ch] [bp-8h]@9 - int i; // [sp+10h] [bp-4h]@10 - - pPlayer = pPlayers[uActiveCharacter]; - memset(&pStru179, 0, 0xFA0u); - memset(pTmpBuf2, 0, 0x7D0u); - v1 = 0; - dword_506544 = 0; - dword_506548 = 0; - dword_506520 = 0; - dword_50651C = 0; - dword_506528 = 0; - v2 = (unsigned __int8 *)pPlayer->_guilds_member_bits; - do - { - v13 = (char *)pAwards[v1].pText;//dword_723E80_award_related[2 * v1]; - if ( (unsigned __int16)_449B57_test_bit(v2, v1) && v13 ) - { - v3 = dword_506520++; - pStru179.field_0[v3] = v1; - } - ++v1; - } - while ( v1 < 105 ); - result = dword_506520; - v5 = 0; - v6 = dword_506520 == 0; - v7 = dword_506520 < 0; - dword_506524 = dword_506520; - dword_506520 = 0; - if ( !(v7 | v6) ) - { - do - { - v8 = rand() % 16; - result = dword_506524; - v9 = dword_506524 + v5++; - v10 = v5 > dword_506524;//__OFSUB__(v5, dword_506524); - v7 = v5 - dword_506524 < 0; - pStru179.field_0[v9] = v8; - } - while ( v7 ^ v10 ); - if ( result > 0 ) - { - v14 = 1; - v11 = &pStru179; - do - { - for ( i = v14; i < result; ++i ) - { - v12 = pStru179.field_0[i]; - //if ( dword_723E84[2 * v12] < dword_723E84[2 * v11->field_0[0]] ) - if(pAwards[v12-1].uSort < pAwards[v11->field_0[0]].uSort) - { - pStru179.field_0[i] = v11->field_0[0]; - v11->field_0[0] = v12; - } - } - ++v14; - v11 = (stru179 *)((char *)v11 + 4); - } - while ( v14 - 1 < result ); - } - } - return result; -} +void FillAwardsData() + { + Player *pPlayer; // esi@1 + + pPlayer = pPlayers[uActiveCharacter]; + memset(&achievedAwardsIndex, 0, 4000); + memset(pTmpBuf2, 0, 0x7D0u); + dword_506544 = 0; + dword_506548 = 0; + awards_count = 0; + dword_50651C = 0; + dword_506528 = 0; + for(int i=0; i<105; ++i) + { + if ( _449B57_test_bit((unsigned char*)&pPlayer->_guilds_member_bits, i) && pAwards[i].pText ) + achievedAwardsIndex[awards_count++] = i; + } + awards_count2 = awards_count; + awards_count = 0; + //sort awards index + if ( awards_count2>0 ) + { + for(int i=0; i<awards_count2; ++i) + achievedAwardsIndex[awards_count2 + i] = rand() % 16; + + for(int i=1; i<awards_count2-1; ++i) + { + for (int j = i; j < awards_count2-1; ++j ) + { + int tmp=achievedAwardsIndex[j]; + if(pAwards[j].uSort < pAwards[i].uSort) + { + achievedAwardsIndex[j] = achievedAwardsIndex[i]; + achievedAwardsIndex[i] = tmp; + } + } + } + } + } //----- (00419220) --------------------------------------------------------
--- a/mm7_6.cpp Sat Mar 02 08:59:10 2013 +0600 +++ b/mm7_6.cpp Sat Mar 02 09:01:48 2013 +0600 @@ -29,7 +29,6 @@ #include "stru123.h" #include "Time.h" #include "IconFrameTable.h" -#include "stru179.h" #include "Awards.h" #include "Autonotes.h" #include "stru160.h" @@ -6356,9 +6355,9 @@ } if ( v447->IsInteractive() ) { - GlobalEventInfo = (int)v447; + activeLevelDecoration = v447; EventProcessor(stru_5E4C90._decor_events[v447->_idx_in_stru123 - 75] + 380, 0, 1); - GlobalEventInfo = 0; + activeLevelDecoration = NULL; } } } @@ -7232,7 +7231,7 @@ if ( !pPlayer->CanCastSpell(uRequiredMana) ) goto play_sound_and_continue; HIDWORD(v733) = 0; - memset(&pStru179, 0, 0xFA0u); + memset(&achievedAwardsIndex, 0, 4000); _this = 0; v605 = (char *)pParty->pHirelings; do @@ -7240,7 +7239,7 @@ if ( *(int *)v605) { v606 = HIDWORD(v733)++; - pStru179.field_0[v606] = (int)((char *)&_this->uItemID + 1); + achievedAwardsIndex[v606] = (int)((char *)&_this->uItemID + 1); } _this = (ItemGen *)((char *)_this + 1); v605 += 76;
--- a/mm7_data.cpp Sat Mar 02 08:59:10 2013 +0600 +++ b/mm7_data.cpp Sat Mar 02 09:01:48 2013 +0600 @@ -48,8 +48,8 @@ #include "stru279.h" stru279 stru_51076C; -#include "stru179.h" -stru179 pStru179; + +int achievedAwardsIndex[1000]; #include "stru123.h" stru123 stru_5E4C90; @@ -1832,8 +1832,8 @@ Texture *dword_50640C[12]; // weak unsigned int uTextureID_506438; int dword_50651C; // weak -int dword_506520; // weak -int dword_506524; // weak +int awards_count; // weak +int awards_count2; // weak int dword_506528; // weak int dword_50652C; // weak int dword_506530; // weak @@ -2035,6 +2035,7 @@ int dword_5B65D0_dialogue_actor_npc_id; // weak int dword_5C3418; // weak int dword_5C341C; // weak +int _5C3420_pDecoration; char byte_5C3427[777]; // weak char GameUI_StatusBar_TimedString[200]; char pStatusBarString[200];
--- a/mm7_data.h Sat Mar 02 08:59:10 2013 +0600 +++ b/mm7_data.h Sat Mar 02 09:01:48 2013 +0600 @@ -1155,8 +1155,8 @@ extern Texture *dword_50640C[]; // weak extern unsigned int uTextureID_506438; extern int dword_50651C; // weak -extern int dword_506520; // weak -extern int dword_506524; // weak +extern int awards_count; // weak +extern int awards_count2; // weak extern int dword_506528; // weak extern int dword_50652C; // weak extern int dword_506530; // weak @@ -1358,6 +1358,7 @@ extern int dword_5B65D0_dialogue_actor_npc_id; // weak extern int dword_5C3418; // weak extern int dword_5C341C; // weak +extern int _5C3420_pDecoration; extern char byte_5C3427[]; // weak extern char GameUI_StatusBar_TimedString[200]; extern char pStatusBarString[200]; @@ -1409,7 +1410,7 @@ extern char *pClassTXT_Raw; extern char *pStatsTXT_Raw; extern char *pSkillDescTXT_Raw; - +extern int achievedAwardsIndex[1000]; extern struct FactionTable *pFactionTable; extern char byte_5C8D1A[]; // weak @@ -1869,13 +1870,13 @@ char __cdecl CharacterUI_SkillsTab_ShowHint(); char __cdecl CharacterUI_StatsTab_ShowHint(); char __fastcall CharacterUI_StatsTab_Draw(unsigned int uPlayerID); // idb -int __cdecl sub_419100(); +void FillAwardsData(); void __cdecl sub_419220(); void __cdecl sub_419379(); void __cdecl CharacterUI_SkillScreen_Draw(); void __cdecl sub_4196A0(); char __fastcall CharacterUI_SkillsTab_Draw(unsigned int uPlayerID); // idb -unsigned int __fastcall CharacterUI_AwardsTab_Draw(unsigned int uPlayerID); // idb +void CharacterUI_AwardsTab_Draw(unsigned int uPlayerID); // idb unsigned int __fastcall GetSizeInInventorySlots(unsigned int uNumPixels); void __fastcall CharacterUI_InventoryTab_Draw(unsigned int uPlayerID, char a2); void __cdecl draw_leather(); @@ -2044,7 +2045,7 @@ char *__fastcall sub_44987B(const char *pMapName, unsigned int uStartingPointType); // idb void __thiscall TeleportToStartingPoint(unsigned int uPointType); // idb __int16 __fastcall sub_449A49_door_switch_animation(unsigned int uDoorID, int a2); // idb -unsigned int __fastcall _449B57_test_bit(unsigned __int8 *a1, __int16 a2); +bool _449B57_test_bit(unsigned __int8 *a1, __int16 a2); void _449B7E_toggle_bit(unsigned char *pArray, __int16 a2, unsigned __int16 bToggle); // idb void __cdecl sub_44A56A(); void __fastcall ShowStatusBarString(const char *pString, unsigned int uNumSeconds);