Mercurial > mm7
changeset 1487:cb396f55671e
Слияние
author | Ritor1 |
---|---|
date | Thu, 29 Aug 2013 22:02:00 +0600 |
parents | 47c89461be23 (current diff) 58d43397b827 (diff) |
children | f62e6d06acac |
files | UI/UiGame.cpp |
diffstat | 49 files changed, 797 insertions(+), 472 deletions(-) [+] |
line wrap: on
line diff
--- a/Actor.cpp Thu Aug 29 22:01:47 2013 +0600 +++ b/Actor.cpp Thu Aug 29 22:02:00 2013 +0600 @@ -2310,7 +2310,7 @@ { pCastSpellInfo.data()->_427D48(v1); v4 = 0; - v5 = pMapStats->GetMapInfo(pCurrentMapName.data()); + v5 = pMapStats->GetMapInfo(pCurrentMapName); if ( v5 ) v4 = pMapStats->pInfos[v5]._steal_perm; v6 = &pOutdoor->ddm; @@ -4895,9 +4895,9 @@ v6 = 0; v7 = 0; v5 = 0; - if ( !_stricmp(pCurrentMapName.data(), "d25.blv") ) + if ( !_stricmp(pCurrentMapName, "d25.blv") ) v8 = 1; - if ( !_stricmp(pCurrentMapName.data(), "d26.blv") ) + if ( !_stricmp(pCurrentMapName, "d26.blv") ) v6 = 1; if (pParty->IsPartyGood()) v7 = 1;
--- a/AudioPlayer.cpp Thu Aug 29 22:01:47 2013 +0600 +++ b/AudioPlayer.cpp Thu Aug 29 22:02:00 2013 +0600 @@ -387,11 +387,27 @@ } //----- (004A9E89) -------------------------------------------------------- -void *SoundList::FromFile(void *pSerialized) +void SoundList::FromFile(void *data_mm6, void *data_mm7, void *data_mm8) { - sNumSounds = *(int *)pSerialized; - pSounds = (SoundDesc *)pAllocator->AllocNamedChunk(pSounds, 120 * sNumSounds, "Snd Des."); - return memcpy(pSounds, (char *)pSerialized + 4, 120 * sNumSounds); + uint num_mm6_sounds = data_mm6 ? *(int *)data_mm6 : 0, + num_mm7_sounds = data_mm7 ? *(int *)data_mm7 : 0, + num_mm8_sounds = data_mm8 ? *(int *)data_mm8 : 0; + + sNumSounds = num_mm6_sounds + num_mm7_sounds + num_mm8_sounds; + assert(sNumSounds); + assert(!num_mm8_sounds); + + pSounds = (SoundDesc *)pAllocator->AllocNamedChunk(pSounds, sNumSounds * sizeof(SoundDesc), "Snd Des."); + memcpy(pSounds, (char *)data_mm7 + 4, num_mm7_sounds * sizeof(SoundDesc)); + for (uint i = 0; i < num_mm6_sounds; ++i) + { + auto src = (SoundDesc_mm6 *)((char *)data_mm6 + 4) + i; + auto dst = pSounds + num_mm7_sounds + i; + + memcpy(dst, src, sizeof(SoundDesc_mm6)); + dst->p3DSound = nullptr; + dst->bDecompressed = false; + } } //----- (004A9ED0) -------------------------------------------------------- @@ -1665,7 +1681,7 @@ auto decor_desc = &pDecorationList->pDecorations[decor->uDecorationDescID]; //v48 = &pDecorationList->pDecorations[decor->uDecorationDescID]; //v49 = v48->uFlags; - uNumRepeats = (~(unsigned __int8)decor_desc->uFlags & DECORATION_SLOW_LOOP) >> 6; + uNumRepeats = (~(unsigned __int8)decor_desc->uFlags & DECORATION_DESC_SLOW_LOOP) >> 6; if (decor_desc->SoundOnDawn() || decor_desc->SoundOnDusk()) { @@ -2266,15 +2282,13 @@ } } } -// 4D82F4: using guessed type int __stdcall AIL_3D_sample_status(int); -// 4ABF23: using guessed type int var_48[16]; //----- (004ABFDB) -------------------------------------------------------- -void PlayLevelMusic() +void PlayLevelMusic() { unsigned int v0; // eax@1 - v0 = pMapStats->GetMapInfo(pCurrentMapName.data()); + v0 = pMapStats->GetMapInfo(pCurrentMapName); if ( v0 ) pAudioPlayer->PlayMusicTrack((MusicID)pMapStats->pInfos[v0].uRedbookTrackID); } @@ -2300,7 +2314,7 @@ unsigned int pMapID; // eax@1 int v3; // [sp+4h] [bp-4h]@3 - pMapID = pMapStats->GetMapInfo(pCurrentMapName.data()); + pMapID = pMapStats->GetMapInfo(pCurrentMapName); if ( this->b3DSoundInitialized && this->bEAXSupported ) { v3 = pMapStats->pInfos[pMapID].uEAXEnv; @@ -2335,7 +2349,7 @@ int v13; // [sp+20h] [bp-4h]@6 v1 = this; - v2 = pMapStats->GetMapInfo(pCurrentMapName.data()); + v2 = pMapStats->GetMapInfo(pCurrentMapName); v3 = v1->b3DSoundInitialized == 0; v4 = v2; v12 = v2;
--- a/AudioPlayer.h Thu Aug 29 22:01:47 2013 +0600 +++ b/AudioPlayer.h Thu Aug 29 22:02:00 2013 +0600 @@ -253,7 +253,7 @@ char pData[1]; }; -struct SoundDesc +struct SoundDesc_mm6 { inline bool Is3D() {return (uFlags & SOUND_DESC_3D) != 0;} @@ -262,6 +262,10 @@ SOUND_DESC_TYPE eType; int uFlags; SoundData *pSoundData[17]; +}; + +struct SoundDesc: public SoundDesc_mm6 +{ void *p3DSound; int bDecompressed; }; @@ -283,7 +287,7 @@ void _4A9D79(int a2); void UnloadSound(unsigned int uSoundID, char a3); void ToFile(); - void *FromFile(void *pSerialized); + void FromFile(void *data_mm6, void *data_mm7, void *data_mm8); int FromFileTxt(const char *Args); signed int sNumSounds;
--- a/CastSpellInfo.cpp Thu Aug 29 22:01:47 2013 +0600 +++ b/CastSpellInfo.cpp Thu Aug 29 22:02:00 2013 +0600 @@ -2122,7 +2122,7 @@ case SPELL_WATER_LLOYDS_BEACON: { LODWORD(v733) = 604800 * v2; - if ( !_stricmp(pCurrentMapName.data(), "d05.blv") ) + if ( !_stricmp(pCurrentMapName, "d05.blv") ) { ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
--- a/Chest.cpp Thu Aug 29 22:01:47 2013 +0600 +++ b/Chest.cpp Thu Aug 29 22:02:00 2013 +0600 @@ -80,7 +80,7 @@ if ( !uActiveCharacter ) return false; flag_shout = false; - pMapID = pMapStats->GetMapInfo(pCurrentMapName.data()); + pMapID = pMapStats->GetMapInfo(pCurrentMapName); if ( chest->Trapped() && pMapID ) { if ( pPlayers[uActiveCharacter]->GetDisarmTrap() < 2 * pMapStats->pInfos[pMapID].LockX5 ) @@ -419,11 +419,11 @@ item_in_chest_count = CountChestItems(uChestID); if ( item_in_chest_count == -1 ) return 0; - for( int i = 0; i < v5; i++) + for( int _i = 0; _i < v5; _i++) { - if ( Chest::CanPlaceItemAt(i, v4->uItemID, pChestWindow->par1C) ) + if ( Chest::CanPlaceItemAt(_i, v4->uItemID, pChestWindow->par1C) ) { - v21 = i; + v21 = _i; } } if ( v22 == v5 ) @@ -625,11 +625,20 @@ //----- (00458B4F) -------------------------------------------------------- -void ChestList::FromFile(void *pSerialized) +void ChestList::FromFile(void *data_mm6, void *data_mm7, void *data_mm8) { - uNumChests = *(int *)pSerialized; - pChests = (ChestDesc *)pAllocator->AllocNamedChunk(pChests, 36 * uNumChests, "Chest Descrip"); - memcpy(pChests, (char *)pSerialized + 4, 36 * uNumChests); + uint num_mm6_chests = data_mm6 ? *(int *)data_mm6 : 0, + num_mm7_chests = data_mm7 ? *(int *)data_mm7 : 0, + num_mm8_chests = data_mm8 ? *(int *)data_mm8 : 0; + + uNumChests = num_mm6_chests + num_mm7_chests + num_mm8_chests; + assert(uNumChests); + assert(!num_mm8_chests); + + pChests = (ChestDesc *)pAllocator->AllocNamedChunk(pChests, uNumChests * sizeof(ChestDesc), "Chest Descrip"); + memcpy(pChests, (char *)data_mm7 + 4, num_mm7_chests * sizeof(ChestDesc)); + memcpy(pChests + num_mm7_chests, (char *)data_mm6 + 4, num_mm6_chests * sizeof(ChestDesc)); + memcpy(pChests + num_mm6_chests + num_mm7_chests, (char *)data_mm8 + 4, num_mm8_chests * sizeof(ChestDesc)); }
--- a/Chest.h Thu Aug 29 22:01:47 2013 +0600 +++ b/Chest.h Thu Aug 29 22:02:00 2013 +0600 @@ -33,7 +33,7 @@ {} void ToFile(); - void FromFile(void *pSerialized); + void FromFile(void *data_mm6, void *data_mm7, void *data_mm8); int FromFileTxt(const char *Args);
--- a/DecorationList.cpp Thu Aug 29 22:01:47 2013 +0600 +++ b/DecorationList.cpp Thu Aug 29 22:02:00 2013 +0600 @@ -7,12 +7,27 @@ #include "Indoor.h" //----- (0045864C) -------------------------------------------------------- -void DecorationList::FromFile(void *pSerialized) +void DecorationList::FromFile(void *data_mm6, void *data_mm7, void *data_mm8) { - uNumDecorations = *(int *)pSerialized; - pDecorations = (DecorationDesc *)pAllocator->AllocNamedChunk(pDecorations, - 84 * uNumDecorations, "Dec Descrip"); - memcpy(pDecorations, (char *)pSerialized + 4, 84 * uNumDecorations); + uint num_mm6_decs = data_mm6 ? *(int *)data_mm6 : 0, + num_mm7_decs = data_mm7 ? *(int *)data_mm7 : 0, + num_mm8_decs = data_mm8 ? *(int *)data_mm8 : 0; + + uNumDecorations = num_mm6_decs + num_mm7_decs + num_mm8_decs; + assert(uNumDecorations); + assert(!num_mm8_decs); + + pDecorations = (DecorationDesc *)pAllocator->AllocNamedChunk(pDecorations, uNumDecorations * sizeof(DecorationDesc), "Dec Descrip"); + memcpy(pDecorations, (char *)data_mm7 + 4, num_mm7_decs * sizeof(DecorationDesc)); + for (uint i = 0; i < num_mm6_decs; ++i) + { + memcpy(pDecorations + num_mm7_decs + i, (char *)data_mm6 + 4 + i * sizeof(DecorationDesc_mm6), sizeof(DecorationDesc_mm6)); + pDecorations[num_mm7_decs + i].uColoredLightRed = 255; + pDecorations[num_mm7_decs + i].uColoredLightGreen = 255; + pDecorations[num_mm7_decs + i].uColoredLightBlue = 255; + pDecorations[num_mm7_decs + i].__padding = 255; + } + memcpy(pDecorations + num_mm6_decs + num_mm7_decs, (char *)data_mm8 + 4, num_mm8_decs * sizeof(DecorationDesc)); } //----- (00458693) -------------------------------------------------------- @@ -234,19 +249,6 @@ fwrite(v1->pDecorations, 0x54u, v1->uNumDecorations, v3); fclose(v3); } -//----- (004583B0) -------------------------------------------------------- -LevelDecoration::LevelDecoration() -{ - this->field_1A = 0; - this->field_18 = 0; - this->vPosition.z = 0; - this->vPosition.y = 0; - this->vPosition.x = 0; - this->uDecorationDescID = 0; - this->field_2 = 0; - this->field_16_event_id = 0; - this->uCog = 0; -} //----- (004488B6) -------------------------------------------------------- unsigned __int16 DecorationList::GetDecorIdByName(const char *pName) {
--- a/DecorationList.h Thu Aug 29 22:01:47 2013 +0600 +++ b/DecorationList.h Thu Aug 29 22:02:00 2013 +0600 @@ -4,31 +4,31 @@ /* 321 */ -enum DECORATION_FLAGS +enum DECORATION_DESC_FLAGS { - DECORATION_MOVE_THROUGH = 0x1, - DECORATION_DONT_DRAW = 0x2, - DECORATION_FLICKER_SLOW = 0x4, - DECORATION_FICKER_AVERAGE = 0x8, - DECORATION_FICKER_FAST = 0x10, - DECORATION_MARKER = 0x20, - DECORATION_SLOW_LOOP = 0x40, - DECORATION_EMITS_FIRE = 0x80, - DECORATION_SOUND_ON_DAWN = 0x100, - DECORATION_SOUND_ON_DUSK = 0x200, - DECORATION_EMITS_SMOKE = 0x400, + DECORATION_DESC_MOVE_THROUGH = 0x0001, + DECORATION_DESC_DONT_DRAW = 0x0002, + DECORATION_DESC_FLICKER_SLOW = 0x0004, + DECORATION_DESC_FICKER_AVERAGE = 0x0008, + DECORATION_DESC_FICKER_FAST = 0x0010, + DECORATION_DESC_MARKER = 0x0020, + DECORATION_DESC_SLOW_LOOP = 0x0040, + DECORATION_DESC_EMITS_FIRE = 0x0080, + DECORATION_DESC_SOUND_ON_DAWN = 0x0100, + DECORATION_DESC_SOUND_ON_DUSK = 0x0200, + DECORATION_DESC_EMITS_SMOKE = 0x0400, }; /* 54 */ #pragma pack(push, 1) -struct DecorationDesc +struct DecorationDesc_mm6 { - inline bool CanMoveThrough() {return (uFlags & DECORATION_MOVE_THROUGH) != 0;} - inline bool DontDraw() {return (uFlags & DECORATION_DONT_DRAW) != 0;} - inline bool SoundOnDawn() {return (uFlags & DECORATION_SOUND_ON_DAWN) != 0;} - inline bool SoundOnDusk() {return (uFlags & DECORATION_SOUND_ON_DUSK) != 0;} + inline bool CanMoveThrough() {return (uFlags & DECORATION_DESC_MOVE_THROUGH) != 0;} + inline bool DontDraw() {return (uFlags & DECORATION_DESC_DONT_DRAW) != 0;} + inline bool SoundOnDawn() {return (uFlags & DECORATION_DESC_SOUND_ON_DAWN) != 0;} + inline bool SoundOnDusk() {return (uFlags & DECORATION_DESC_SOUND_ON_DUSK) != 0;} char pName[32]; char field_20[32]; @@ -40,6 +40,14 @@ __int16 uFlags; __int16 uSoundID; __int16 _pad; + //unsigned __int8 uColoredLightRed; + //unsigned __int8 uColoredLightGreen; + //unsigned __int8 uColoredLightBlue; + //char __padding; +}; + +struct DecorationDesc: public DecorationDesc_mm6 +{ unsigned __int8 uColoredLightRed; unsigned __int8 uColoredLightGreen; unsigned __int8 uColoredLightBlue; @@ -56,7 +64,7 @@ {} void ToFile(); - void FromFile(void *pSerialized); + void FromFile(void *data_mm6, void *data_mm7, void *data_mm8); bool FromFileTxt(const char *Args); void InitializeDecorationSprite(unsigned int uDecID); unsigned __int16 GetDecorIdByName(const char *pName);
--- a/Game.cpp Thu Aug 29 22:01:47 2013 +0600 +++ b/Game.cpp Thu Aug 29 22:02:00 2013 +0600 @@ -516,9 +516,9 @@ pParty->uFallSpeed = 0; pParty->field_6E4 = 0; pParty->field_6E0 = 0; - if ( _stricmp(Source, pCurrentMapName.data()) ) + if ( _stricmp(Source, pCurrentMapName) ) { - strcpy(pCurrentMapName.data(), Source); + strcpy(pCurrentMapName, Source); _5B65A8_npcdata_uflags_or_other = pParty->vPosition.x; _5B65AC_npcdata_fame_or_other = pParty->vPosition.y; _5B65B0_npcdata_rep_or_other = pParty->vPosition.z;
--- a/IconFrameTable.cpp Thu Aug 29 22:01:47 2013 +0600 +++ b/IconFrameTable.cpp Thu Aug 29 22:02:00 2013 +0600 @@ -112,11 +112,20 @@ } //----- (00495056) -------------------------------------------------------- -void IconFrameTable::FromFile(void *pSerialized) +void IconFrameTable::FromFile(void *data_mm6, void *data_mm7, void *data_mm8) { - uNumIcons = *(int *)pSerialized; - pIcons = (IconFrame *)pAllocator->AllocNamedChunk(pIcons, 32 * uNumIcons, "I Frames"); - memcpy(pIcons, (char *)pSerialized + 4, 32 * uNumIcons); + uint num_mm6_frames = data_mm6 ? *(int *)data_mm6 : 0, + num_mm7_frames = data_mm7 ? *(int *)data_mm7 : 0, + num_mm8_frames = data_mm8 ? *(int *)data_mm8 : 0; + + uNumIcons = num_mm6_frames + num_mm7_frames + num_mm8_frames; + assert(uNumIcons); + assert(!num_mm8_frames); + + pIcons = (IconFrame *)pAllocator->AllocNamedChunk(pIcons, uNumIcons * sizeof(IconFrame), "I Frames"); + memcpy(pIcons, (char *)data_mm7 + 4, num_mm7_frames * sizeof(IconFrame)); + memcpy(pIcons + num_mm7_frames, (char *)data_mm6 + 4, num_mm6_frames * sizeof(IconFrame)); + memcpy(pIcons + num_mm6_frames + num_mm7_frames, (char *)data_mm8 + 4, num_mm8_frames * sizeof(IconFrame)); } //----- (0049509D) --------------------------------------------------------
--- a/IconFrameTable.h Thu Aug 29 22:01:47 2013 +0600 +++ b/IconFrameTable.h Thu Aug 29 22:02:00 2013 +0600 @@ -29,7 +29,7 @@ IconFrame *GetFrame(unsigned int uIconID, unsigned int uFrameID); void InitializeAnimation(unsigned int uIconID); void ToFile(); - void FromFile(void *pSerialized); + void FromFile(void *data_mm6, void *data_mm7, void *data_mm8); int FromFileTxt(const char *Args); int GetIconAnimLength(unsigned int uIconID);
--- a/Indoor.cpp Thu Aug 29 22:01:47 2013 +0600 +++ b/Indoor.cpp Thu Aug 29 22:02:00 2013 +0600 @@ -2158,7 +2158,7 @@ if (dword_6BE364_game_settings_1 & 0x2000 ) _i = 29030400; bool _a = false; - if ( a3 - dlv.uLastRepawnDay >= _i && _stricmp(pCurrentMapName.data(), "d29.dlv") ) + if ( a3 - dlv.uLastRepawnDay >= _i && _stricmp(pCurrentMapName, "d29.dlv") ) _a = true; //v154 = 875; @@ -3695,7 +3695,7 @@ bUnderwater = 1; pGame->uFlags2 |= 8u; } - if ( !_stricmp(pCurrentMapName.data(), "out15.odm") || !_stricmp(pCurrentMapName.data(), "d23.blv") ) + if ( !_stricmp(pCurrentMapName, "out15.odm") || !_stricmp(pCurrentMapName, "d23.blv") ) bNoNPCHiring = 1; pPaletteManager->pPalette_tintColor[0] = 0; pPaletteManager->pPalette_tintColor[1] = 0; @@ -3703,7 +3703,7 @@ pPaletteManager->RecalculateAll(); if ( qword_A750D8 ) qword_A750D8 = 0i64; - v2 = pMapStats->GetMapInfo(pCurrentMapName.data()); + v2 = pMapStats->GetMapInfo(pCurrentMapName); v39 = v2; if ( v2 ) { @@ -3721,8 +3721,7 @@ _6A0D0C_txt_lod_loading = 0; TryLoadLevelFromLOD(); pStationaryLightsStack->uNumLightsActive = 0; - v4 = pIndoor->Load( - pCurrentMapName.data(), + v4 = pIndoor->Load(pCurrentMapName, (unsigned int)(signed __int64)((double)pParty->uTimePlayed * 0.234375) / 60 / 60 / 24 + 1, v1, (char *)&pDest) @@ -4990,7 +4989,7 @@ v3 = &pDecorationList->pDecorations[v2->uDecorationDescID]; v4 = v3->uFlags; - if (v3->uFlags & DECORATION_EMITS_FIRE) + if (v3->uFlags & DECORATION_DESC_EMITS_FIRE) { memset(&local_0, 0, 0x68u); // fire, like at the Pit's tavern v5 = (double)v2->vPosition.x; @@ -5010,7 +5009,7 @@ } - if (v4 & DECORATION_DONT_DRAW) + if (v4 & DECORATION_DESC_DONT_DRAW) return; v6 = v2->vPosition.x;
--- a/Indoor.h Thu Aug 29 22:01:47 2013 +0600 +++ b/Indoor.h Thu Aug 29 22:02:00 2013 +0600 @@ -1,5 +1,5 @@ #pragma once -#include "VectorTypes.h" +#include "Level/Decoration.h" #include "Indoor_stuff.h" @@ -28,28 +28,7 @@ -/* 74 */ -#pragma pack(push, 1) -struct LevelDecoration -{ - LevelDecoration(); - int GetGlobalEvent(); - bool IsInteractive(); - bool _47A825(); - - unsigned __int16 uDecorationDescID; - __int16 field_2; - struct Vec3_int_ vPosition; - int field_10_y_rot; - __int16 uCog; - __int16 field_16_event_id; - __int16 field_18; - __int16 field_1A; - __int16 _idx_in_stru123; - __int16 field_1E; -}; -#pragma pack(pop) extern std::array<LevelDecoration, 3000> pLevelDecorations; extern size_t uNumLevelDecorations; extern LevelDecoration* activeLevelDecoration;
--- a/Items.cpp Thu Aug 29 22:01:47 2013 +0600 +++ b/Items.cpp Thu Aug 29 22:02:00 2013 +0600 @@ -2053,7 +2053,7 @@ signed int v23; // [sp+24h] [bp-4h]@2 v18 = rand() % 100; //main random - v0 = pMapStats->GetMapInfo(pCurrentMapName.data()); + v0 = pMapStats->GetMapInfo(pCurrentMapName); // v1 = pChests; v2 = &pMapStats->pInfos[v0]; //v21 = pChests;
--- a/LOD.cpp Thu Aug 29 22:01:47 2013 +0600 +++ b/LOD.cpp Thu Aug 29 22:02:00 2013 +0600 @@ -17,13 +17,19 @@ -LODFile_IconsBitmaps *pEvents_LOD; -LODFile_IconsBitmaps *pIcons_LOD; -LODFile_Sprites *pSprites_LOD; -LODFile_IconsBitmaps *pBitmaps_LOD; +LODFile_IconsBitmaps *pEvents_LOD = nullptr; + +LODFile_IconsBitmaps *pIcons_LOD = nullptr; +LODFile_IconsBitmaps *pIcons_LOD_mm6 = nullptr; -LODWriteableFile *pNew_LOD; -LODWriteableFile *pGames_LOD; +LODFile_IconsBitmaps *pBitmaps_LOD = nullptr; +LODFile_IconsBitmaps *pBitmaps_LOD_mm6 = nullptr; + +LODFile_Sprites *pSprites_LOD = nullptr; +LODFile_Sprites *pSprites_LOD_mm6 = nullptr; + +LODWriteableFile *pNew_LOD = nullptr; +LODWriteableFile *pGames_LOD = nullptr; @@ -1087,26 +1093,16 @@ +//----- (0040FAEE) -------------------------------------------------------- //----- (0040FA2E) -------------------------------------------------------- -bool LODFile_IconsBitmaps::LoadBitmaps(const char *pFilename) -{ - ReleaseAll(); - if (LoadHeader(pFilename, 1)) - return false; - else - return LoadSubIndices("bitmaps") == 0; -} - - -//----- (0040FAEE) -------------------------------------------------------- -bool LODFile_IconsBitmaps::LoadIconsOrEvents(const char *pLODFilename) +bool LODFile_IconsBitmaps::Load(const char *pLODFilename, const char *pFolderName) { ReleaseAll(); if (LoadHeader(pLODFilename, 1)) return false; - else - return LoadSubIndices("icons") == 0; + + return LoadSubIndices(pFolderName) == 0; } @@ -2925,7 +2921,7 @@ char Drive[4]; // [sp+408h] [bp-8h]@1 int DstBuf; // [sp+40Ch] [bp-4h]@2 - strcpy(a1, pCurrentMapName.data()); + strcpy(a1, pCurrentMapName); _splitpath(a1, Drive, Dir, Filename, Ext); sprintf(a1, "levels\\%s%s", Filename, ".lod"); v0 = fopen(a1, "rb");
--- a/LOD.h Thu Aug 29 22:01:47 2013 +0600 +++ b/LOD.h Thu Aug 29 22:02:00 2013 +0600 @@ -146,8 +146,7 @@ virtual ~LODFile_IconsBitmaps(); void SyncLoadedFilesCount(); unsigned int FindTextureByName(const char *pName); - bool LoadBitmaps(const char *pFilename); - bool LoadIconsOrEvents(const char *pLODFilename); + bool Load(const char *pFilename, const char *pFolderName); void ReleaseAll(); unsigned int LoadTexture(const char *pContainer, enum TEXTURE_TYPE uTextureType = TEXTURE_DEFAULT); struct Texture *LoadTexturePtr(const char *pContainer, enum TEXTURE_TYPE uTextureType = TEXTURE_DEFAULT); @@ -304,8 +303,13 @@ extern LODFile_IconsBitmaps *pEvents_LOD; extern LODFile_IconsBitmaps *pIcons_LOD; +extern LODFile_IconsBitmaps *pIcons_LOD_mm6; + +extern LODFile_IconsBitmaps *pBitmaps_LOD; +extern LODFile_IconsBitmaps *pBitmaps_LOD_mm6; + extern LODFile_Sprites *pSprites_LOD; -extern LODFile_IconsBitmaps *pBitmaps_LOD; +extern LODFile_Sprites *pSprites_LOD_mm6; extern LODWriteableFile *pNew_LOD; extern LODWriteableFile *pGames_LOD;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Level/Decoration.cpp Thu Aug 29 22:02:00 2013 +0600 @@ -0,0 +1,179 @@ +#include <assert.h> + +#include "Decoration.h" +#include "../Party.h" +#include "../mm7_data.h" // for _449B57_test_bit + +//----- (004583B0) -------------------------------------------------------- +LevelDecoration::LevelDecoration() +{ + this->field_1A = 0; + this->field_18 = 0; + this->vPosition.z = 0; + this->vPosition.y = 0; + this->vPosition.x = 0; + this->uDecorationDescID = 0; + this->field_2 = 0; + this->field_16_event_id = 0; + this->uCog = 0; +} + +//----- (00450929) -------------------------------------------------------- +int LevelDecoration::GetGlobalEvent() +{ + LevelDecoration *v1; // esi@1 + signed int v2; // eax@1 + int v3; // eax@5 + int v4; // eax@6 + int v5; // eax@7 + int v6; // eax@8 + int v7; // eax@9 + int result; // eax@14 + int v9; // eax@18 + int v10; // eax@19 + int v11; // eax@20 + int v12; // eax@21 + int v13; // eax@22 + + switch (uDecorationDescID) + { + case 0: case 1: + case 2: case 3: + return 0; + + case 4: return 16; // dec01 "Trash Pile" + case 5: return 32; // dec02 "Campfire" + case 6: return 12 + rand() % 4; // dec03 "Cauldron" + case 7: case 8: + case 9: case 10: + return 0; + + case 11: return 34; // dec08 "Fruit plate" + case 12: + return 0; + + case 13: return 17; // dec10 "Trash Pile" + case 14: return 18; // dec11 "Filth" + case 15: case 16: case 17: + case 18: case 19: case 20: + case 21: case 22: case 23: + return 0; + + case 24: return 36; // dec21 "Keg" + case 25: case 26: case 27: case 28: case 29: + case 30: case 31: case 32: case 33: + return 0; + + case 34: return 4 + rand() % 6; // dec32 "Barrel" + case 35: case 36: case 37: case 38: case 39: + case 40: case 41: case 42: case 43: case 44: case 45: case 46: case 47: case 48: case 49: + case 50: case 51: case 52: case 53: case 54: case 55: case 56: case 57: case 58: case 59: + case 60: case 61: case 62: case 63: case 64: case 65: case 66: case 67: case 68: case 69: + case 70: case 71: case 72: case 73: case 74: case 75: case 76: case 77: case 78: case 79: + case 80: case 81: case 82: case 83: case 84: case 85: case 86: case 87: case 88: case 89: + case 90: case 91: case 92: case 93: case 94: case 95: case 96: case 97: case 98: case 99: + case 100: case 101: case 102: case 103: case 104: case 105: case 106: case 107: case 108: case 109: + case 110: case 111: case 112: case 113: case 114: case 115: case 116: case 117: case 118: case 119: + case 120: case 121: case 122: case 123: case 124: case 125: case 126: case 127: case 128: case 129: + case 130: case 131: case 132: case 133: case 134: case 135: case 136: case 137: case 138: case 139: + case 140: case 141: case 142: case 143: case 144: case 145: case 146: case 147: case 148: case 149: + case 150: case 151: case 152: case 153: case 154: case 155: case 156: case 157: case 158: case 159: + case 160: case 161: case 162: case 163: case 164: case 165: case 166: case 167: case 168: case 169: + case 170: case 171: case 172: case 173: case 174: case 175: case 176: case 177: case 178: case 179: + case 180: case 181: case 182: case 183: + + case 184: return 33; // dec24 "Campfire" + case 185: case 186: + return 0; + + case 187: // dec88 "Mushroom" + case 190: // dec91 "Mushroom" + return 37; + + case 188: case 189: + case 191: case 192: case 193: case 194: case 195: case 196: + case 197: case 198: case 199: case 200: case 201: case 202: + case 203: case 204: case 205: + return 0; + + case 206: return 162 + rand() % 7; // dec60 + case 207: return 169 + rand() % 7; // dec61 + case 208: return 176 + rand() % 7; // dec62 + case 209: return 183 + rand() % 7; // dec63 + case 210: return 150; // dec64 "Magic Pedistal" + case 211: return 151; // dec65 "Magic Pedistal" + case 212: return 152; // dec66 "Magic Pedistal" + case 213: return 153; // dec67 "Magic Pedistal" + case 214: return 154; // dec68 "Magic Pedistal" + case 215: return 155; // dec69 "Magic Pedistal" + case 216: return 156; // dec70 "Magic Pedistal" + case 217: return 157; // dec71 "Magic Pedistal" + case 218: return 158; // dec72 "Magic Pedistal" + case 219: return 159; // dec73 "Magic Pedistal" + case 220: return 160; // dec74 "Magic Pedistal" + case 221: return 161; // dec75 "Magic Pedistal" + + case 222: case 223: case 224: + case 225: case 226: case 227: + return 0; + + default: assert(false && "Invalid Decoration"); + } +} + +//----- (0047A825) -------------------------------------------------------- +bool LevelDecoration::_47A825() +{ + //bool v1; // ebx@1 + //LevelDecoration *v2; // edi@1 + + if (pParty->uCurrentHour == 0 + && !_449B57_test_bit(pParty->_quest_bits, 178) + && _449B57_test_bit(pParty->_quest_bits, 164) + && _449B57_test_bit(pParty->_quest_bits, 165) + && _449B57_test_bit(pParty->_quest_bits, 166) + && _449B57_test_bit(pParty->_quest_bits, 167) + && _449B57_test_bit(pParty->_quest_bits, 168) + && _449B57_test_bit(pParty->_quest_bits, 169) + && _449B57_test_bit(pParty->_quest_bits, 170) + && _449B57_test_bit(pParty->_quest_bits, 171) + && _449B57_test_bit(pParty->_quest_bits, 172) + && _449B57_test_bit(pParty->_quest_bits, 173) + && _449B57_test_bit(pParty->_quest_bits, 174) + && _449B57_test_bit(pParty->_quest_bits, 175) + && _449B57_test_bit(pParty->_quest_bits, 176) + && _449B57_test_bit(pParty->_quest_bits, 177)) + { + this->field_2 &= ~LEVEL_DECORATION_INVISIBLE; + return true; + } + + this->field_2 |= LEVEL_DECORATION_INVISIBLE; + return false; +} + +//----- (0044C2F4) -------------------------------------------------------- +bool LevelDecoration::IsInteractive() +{ + switch (uDecorationDescID) + { + case 4: // trash pile + case 5: // campfire + case 6: // cauldron + case 11: // fruit plate + case 13: // trash pile + case 14: // dirt + case 24: // keg + case 184: // fire + case 187: // fire + case 190: // fire + return true; + } + + if (uDecorationDescID >= 206 && uDecorationDescID <= 209) // lighthouse fire + return true; + if (uDecorationDescID >= 210 && uDecorationDescID <= 221) // magic pedistal + return true; + + return false; +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Level/Decoration.h Thu Aug 29 22:02:00 2013 +0600 @@ -0,0 +1,37 @@ +#pragma once + +#include "../VectorTypes.h" + +enum LEVEL_DECORATION_FLAGS +{ + LEVEL_DECORATION_TRIGGERED_BY_TOUCH = 0x01, + LEVEL_DECORATION_TRIGGERED_BY_MONSTER = 0x02, + LEVEL_DECORATION_TRIGGERED_BY_OBJECT = 0x04, + LEVEL_DECORATION_VISIBLE_ON_MAP = 0x08, + LEVEL_DECORATION_CHEST = 0x10, + LEVEL_DECORATION_INVISIBLE = 0x20, + LEVEL_DECORATION_OBELISK_CHEST = 0x40, +}; + +/* 74 */ +#pragma pack(push, 1) +struct LevelDecoration +{ + LevelDecoration(); + int GetGlobalEvent(); + bool IsInteractive(); + bool _47A825(); + + + unsigned __int16 uDecorationDescID; + __int16 field_2; + struct Vec3_int_ vPosition; + int field_10_y_rot; + __int16 uCog; + __int16 field_16_event_id; + __int16 field_18; + __int16 field_1A; + __int16 _idx_in_stru123; + __int16 field_1E; +}; +#pragma pack(pop)
--- a/Log.cpp Thu Aug 29 22:01:47 2013 +0600 +++ b/Log.cpp Thu Aug 29 22:02:00 2013 +0600 @@ -1,13 +1,11 @@ #include "Log.h" - #include <stdio.h> #include <windows.h> + HANDLE hStdOut = nullptr; - - void Log::Initialize() { if (AllocConsole()) @@ -21,15 +19,12 @@ return; va_list args; - wchar_t pMsg[8192]; va_start(args, pFormat); - vswprintf_s(pMsg, 8192, pFormat, args); + vwprintf_s(pFormat, args); va_end(args); + puts("\r\n"); - DWORD w; - WriteConsole(hStdOut, pMsg, lstrlenW(pMsg), &w, nullptr); - WriteConsole(hStdOut, L"\r\n", 2, &w, nullptr); } //----- (004BE386) --------------------------------------------------------
--- a/Monsters.cpp Thu Aug 29 22:01:47 2013 +0600 +++ b/Monsters.cpp Thu Aug 29 22:02:00 2013 +0600 @@ -456,11 +456,33 @@ } //----- (004598AF) -------------------------------------------------------- -void MonsterList::FromFile(void *pSerialized) +void MonsterList::FromFile(void *data_mm6, void *data_mm7, void *data_mm8) { - uNumMonsters = *(int *)pSerialized; + uint num_mm6_monsters = data_mm6 ? *(int *)data_mm6 : 0, + num_mm7_monsters = data_mm7 ? *(int *)data_mm7 : 0, + num_mm8_monsters = data_mm8 ? *(int *)data_mm8 : 0; + + uNumMonsters = num_mm6_monsters + num_mm7_monsters + num_mm8_monsters; + assert(uNumMonsters); + assert(!num_mm8_monsters); + pMonsters = (MonsterDesc *)pAllocator->AllocNamedChunk(pMonsters, sizeof(MonsterDesc) * uNumMonsters, "Mon Race"); - memcpy(pMonsters, (char *)pSerialized + 4, sizeof(MonsterDesc) * uNumMonsters); + memcpy(pMonsters, (char *)data_mm7 + 4, num_mm7_monsters * sizeof(MonsterDesc)); + for (uint i = 0; i < num_mm6_monsters; ++i) + { + auto src = (MonsterDesc_mm6 *)((char *)data_mm6 + 4) + i; + auto dst = pMonsters + num_mm7_monsters + i; + + dst->uMonsterHeight = src->uMonsterHeight; + dst->uMonsterRadius = src->uMonsterRadius; + dst->uMovementSpeed = src->uMovementSpeed; + dst->uToHitRadius = src->uToHitRadius; + dst->uTintColor = 0xFFFFFFFF; + memcpy(dst->pSoundSampleIDs, src->pSoundSampleIDs, sizeof(src->pSoundSampleIDs)); + memcpy(dst->pMonsterName, src->pMonsterName, sizeof(src->pMonsterName)); + memcpy(dst->pSpriteNames, src->pSpriteNames, sizeof(src->pSpriteNames)); + } + memcpy(pMonsters + num_mm6_monsters + num_mm7_monsters, (char *)data_mm8 + 4, num_mm8_monsters * sizeof(MonsterDesc)); } //----- (00459860) --------------------------------------------------------
--- a/Monsters.h Thu Aug 29 22:01:47 2013 +0600 +++ b/Monsters.h Thu Aug 29 22:02:00 2013 +0600 @@ -188,6 +188,17 @@ #pragma pack(push, 1) +struct MonsterDesc_mm6 +{ + unsigned __int16 uMonsterHeight; + unsigned __int16 uMonsterRadius; + unsigned __int16 uMovementSpeed; + __int16 uToHitRadius; + unsigned __int16 pSoundSampleIDs[4]; + char pMonsterName[32]; + char pSpriteNames[10][10]; +}; + struct MonsterDesc { unsigned __int16 uMonsterHeight; @@ -210,7 +221,7 @@ {} signed __int16 GetMonsterIDByName(const char *pMonsterName); void ToFile(); - void FromFile(void *pSerialized); + void FromFile(void *data_mm6, void *data_mm7, void *data_mm8); bool FromFileTxt(const char *Args); signed int uNumMonsters;
--- a/ObjectList.cpp Thu Aug 29 22:01:47 2013 +0600 +++ b/ObjectList.cpp Thu Aug 29 22:02:00 2013 +0600 @@ -56,11 +56,38 @@ } //----- (004590DC) -------------------------------------------------------- -void ObjectList::FromFile(void *pSerialized) +void ObjectList::FromFile(void *data_mm6, void *data_mm7, void *data_mm8) { - uNumObjects = *(int *)pSerialized; - pObjects = (ObjectDesc *)pAllocator->AllocNamedChunk(pObjects, 56 * uNumObjects, "Obj Descrip"); - memcpy(pObjects, (char *)pSerialized + 4, 56 * uNumObjects); + uint num_mm6_objs = data_mm6 ? *(int *)data_mm6 : 0, + num_mm7_objs = data_mm7 ? *(int *)data_mm7 : 0, + num_mm8_objs = data_mm8 ? *(int *)data_mm8 : 0; + + uNumObjects = num_mm6_objs + num_mm7_objs + num_mm8_objs; + assert(uNumObjects); + assert(!num_mm8_objs); + + pObjects = (ObjectDesc *)pAllocator->AllocNamedChunk(pObjects, uNumObjects * sizeof(ObjectDesc), "Obj Descrip"); + memcpy(pObjects, (char *)data_mm7 + 4, num_mm7_objs * sizeof(ObjectDesc)); + for (uint i = 0; i < num_mm6_objs; ++i) + { + auto src = (ObjectDesc_mm6 *)((char *)data_mm6 + 4) + i; + auto dst = pObjects + num_mm7_objs + i; + memcpy(dst->field_0, src->field_0, sizeof(dst->field_0)); + dst->uObjectID = src->uObjectID; + dst->uRadius = src->uRadius; + dst->uHeight = src->uHeight; + dst->uFlags = src->uFlags; + dst->uSpriteID = src->uSpriteID; + dst->uLifetime = src->uLifetime; + dst->uParticleTrailColor = src->uParticleTrailColor; + dst->uSpeed = src->uSpeed; + dst->uParticleTrailColorR = src->uParticleTrailColorR; + dst->uParticleTrailColorG = src->uParticleTrailColorG; + dst->uParticleTrailColorB = src->uParticleTrailColorB; + dst->field_35_clr = src->field_35_clr; + dst->field_36_clr = 0; + dst->field_37_clr = 0; + } } //----- (00459123) --------------------------------------------------------
--- a/ObjectList.h Thu Aug 29 22:01:47 2013 +0600 +++ b/ObjectList.h Thu Aug 29 22:02:00 2013 +0600 @@ -24,6 +24,25 @@ /* 56 */ #pragma pack(push, 1) +struct ObjectDesc_mm6 +{ + inline bool NoSprite() const {return uFlags & OBJECT_DESC_NO_SPRITE;} + + char field_0[32]; + __int16 uObjectID; + __int16 uRadius; + __int16 uHeight; + __int16 uFlags; + unsigned __int16 uSpriteID; + __int16 uLifetime; + unsigned short uParticleTrailColor; + __int16 uSpeed; + char uParticleTrailColorR; + char uParticleTrailColorG; + char uParticleTrailColorB; + char field_35_clr; +}; + struct ObjectDesc { inline bool NoSprite() const {return uFlags & OBJECT_DESC_NO_SPRITE;} @@ -55,7 +74,7 @@ {} void ToFile(); - void FromFile(void *pSerialized); + void FromFile(void *data_mm6, void *data_mm7, void *data_mm8); bool FromFileTxt(const char *Args); void InitializeSprites(); __int16 ObjectIDByItemID(unsigned __int16 uItemID);
--- a/Outdoor.cpp Thu Aug 29 22:01:47 2013 +0600 +++ b/Outdoor.cpp Thu Aug 29 22:02:00 2013 +0600 @@ -649,9 +649,9 @@ //----- (00489487) -------------------------------------------------------- void OutdoorLocation::SetFog() { - strcpy(pOutdoor->pLevelFilename, pCurrentMapName.data()); + strcpy(pOutdoor->pLevelFilename, pCurrentMapName); - auto map_id = pMapStats->GetMapInfo(pCurrentMapName.data()); + auto map_id = pMapStats->GetMapInfo(pCurrentMapName); if (map_id == MAP_INVALID || map_id == MAP_CELESTIA || map_id == MAP_THE_PIT || map_id > MAP_SHOALS) return; @@ -2701,7 +2701,7 @@ v1 = 0; v8 = 0; - if ( !_stricmp(pCurrentMapName.data(), "out09.odm") ) + if ( !_stricmp(pCurrentMapName, "out09.odm") ) v8 = 1; for (uint i = 0; i < uNumLevelDecorations; ++i) @@ -3558,7 +3558,7 @@ || pParty->vPosition.y < -22528 || pParty->vPosition.y > 22528 ) { - strcpy(pOutdoor->pLevelFilename, pCurrentMapName.data()); + strcpy(pOutdoor->pLevelFilename, pCurrentMapName); v0 = pOutdoor->GetTravelDestination(pParty->vPosition.x, pParty->vPosition.y, pOut, 32); if ( !bUnderwater && (pParty->uFlags & (PARTY_FLAGS_1_STANDING_ON_WATER | PARTY_FLAGS_1_FALLING | 0x04) || pParty->uFlags & 0x0200 || pParty->bFlying) || !v0 ) {
--- a/Overlays.cpp Thu Aug 29 22:01:47 2013 +0600 +++ b/Overlays.cpp Thu Aug 29 22:02:00 2013 +0600 @@ -183,11 +183,20 @@ } //----- (00458E08) -------------------------------------------------------- -void OverlayList::FromFile(void *pSerialized) +void OverlayList::FromFile(void *data_mm6, void *data_mm7, void *data_mm8) { - uNumOverlays = *(int *)pSerialized; - pOverlays = (OverlayDesc *)pAllocator->AllocNamedChunk(pOverlays, 8 * uNumOverlays, "Ovl Des."); - memcpy(pOverlays, (char *)pSerialized + 4, 8 * uNumOverlays); + uint num_mm6_overlays = data_mm6 ? *(int *)data_mm6 : 0, + num_mm7_overlays = data_mm7 ? *(int *)data_mm7 : 0, + num_mm8_overlays = data_mm8 ? *(int *)data_mm8 : 0; + + uNumOverlays = num_mm6_overlays + num_mm7_overlays + num_mm8_overlays; + assert(uNumOverlays); + assert(!num_mm8_overlays); + + pOverlays = (OverlayDesc *)pAllocator->AllocNamedChunk(pOverlays, uNumOverlays * sizeof(OverlayDesc), "Ovl Des."); + memcpy(pOverlays, (char *)data_mm7 + 4, num_mm7_overlays * sizeof(OverlayDesc)); + memcpy(pOverlays + num_mm7_overlays, (char *)data_mm6 + 4, num_mm6_overlays * sizeof(OverlayDesc)); + memcpy(pOverlays + num_mm6_overlays + num_mm7_overlays, (char *)data_mm8 + 4, num_mm8_overlays * sizeof(OverlayDesc)); } //----- (00458E4F) --------------------------------------------------------
--- a/Overlays.h Thu Aug 29 22:01:47 2013 +0600 +++ b/Overlays.h Thu Aug 29 22:02:00 2013 +0600 @@ -63,7 +63,7 @@ {} void ToFile(); - void FromFile(void *pSerialized); + void FromFile(void *data_mm6, void *data_mm7, void *data_mm8); bool FromFileTxt(const char *Args); void InitializeSprites();
--- a/PlayerFrameTable.h Thu Aug 29 22:01:47 2013 +0600 +++ b/PlayerFrameTable.h Thu Aug 29 22:02:00 2013 +0600 @@ -26,7 +26,7 @@ PlayerFrame *GetFrameBy_x(unsigned int uFramesetID, unsigned int uFrameID); PlayerFrame *GetFrameBy_y(int *a2, int *a3, int a4); void ToFile(); - void FromFile(void *pSerialized); + void FromFile(void *data_mm6, void *data_mm7, void *data_mm8); int FromFileTxt(const char *Args); unsigned int uNumFrames;
--- a/SaveLoad.cpp Thu Aug 29 22:01:47 2013 +0600 +++ b/SaveLoad.cpp Thu Aug 29 22:02:00 2013 +0600 @@ -216,7 +216,7 @@ Abortf(pTmpBuf.data()); } - strcpy(pCurrentMapName.data(), header.pLocationName); + strcpy(pCurrentMapName, header.pLocationName); dword_6BE364_game_settings_1 |= 0x2001; for (uint i = 0; i < uNumSavegameFiles; ++i) @@ -261,8 +261,8 @@ unsigned int compressed_block_size; // [sp+260h] [bp-10h]@23 //v66 = a2; - strcpy(byte_6BE3B0.data(), pCurrentMapName.data()); - if (!_stricmp(pCurrentMapName.data(), "d05.blv")) // arena + strcpy(byte_6BE3B0.data(), pCurrentMapName); + if (!_stricmp(pCurrentMapName, "d05.blv")) // arena return; uncompressed_buff = (char*)malloc(1000000); @@ -312,7 +312,7 @@ memset(save_header.pName, 0, 20); memset(save_header.pLocationName, 0, 20); memset(save_header.field_30, 0, 52); - strcpy(save_header.pLocationName, pCurrentMapName.data()); + strcpy(save_header.pLocationName, pCurrentMapName); save_header.uWordTime = pParty->uTimePlayed; strcpy(pLodDirectory.pFilename, "header.bin"); pLodDirectory.uDataSize = sizeof(SavegameHeader); @@ -485,7 +485,7 @@ memcpy(data_write_pos, &pOutdoor->loc_time, 0x38); data_write_pos += 56; } - strcpy(Source, pCurrentMapName.data()); + strcpy(Source, pCurrentMapName); _splitpath(Source, Drive, Dir, Filename, Ext); Size = (int)data_write_pos - (int)uncompressed_buff; @@ -541,13 +541,13 @@ //v1 = uSlot; //v6 = uSlot; - bNotArena = _stricmp(pCurrentMapName.data(), "d05.blv"); + bNotArena = _stricmp(pCurrentMapName, "d05.blv"); if ( bNotArena ) { LOD::Directory pDir; // [sp+Ch] [bp-28h]@2 SaveGame(0, 0); //v2 = 100 * v1; - strcpy(pSavegameHeader[uSlot].pLocationName, pCurrentMapName.data()); + strcpy(pSavegameHeader[uSlot].pLocationName, pCurrentMapName); pSavegameHeader[uSlot].uWordTime = pParty->uTimePlayed; strcpy(pDir.pFilename, "header.bin"); pDir.uDataSize = 100;
--- a/SpriteObject.cpp Thu Aug 29 22:01:47 2013 +0600 +++ b/SpriteObject.cpp Thu Aug 29 22:02:00 2013 +0600 @@ -997,7 +997,7 @@ int dir_z; // [sp+10h] [bp-8h]@1 DAMAGE_TYPE pDamageType; // [sp+14h] [bp-4h]@14 - pMapInfo = &pMapStats->pInfos[pMapStats->GetMapInfo(pCurrentMapName.data())]; + pMapInfo = &pMapStats->pInfos[pMapStats->GetMapInfo(pCurrentMapName)]; dir_x = abs(pParty->vPosition.x - this->vPosition.x); dir_y = abs(pParty->vPosition.y - this->vPosition.y); dir_z = abs(pParty->vPosition.z + pParty->sEyelevel - this->vPosition.z);
--- a/Sprites.cpp Thu Aug 29 22:01:47 2013 +0600 +++ b/Sprites.cpp Thu Aug 29 22:02:00 2013 +0600 @@ -245,7 +245,7 @@ while ( 1 ) { int searchRange = endPos - startPos; - int middleFrameIndex = (endPos - startPos) / 2 + startPos; + int middleFrameIndex = startPos + (endPos - startPos) / 2; int comparisonResult = _stricmp(pSpriteName, this->pSpritePFrames[middleFrameIndex]->pIconName); if ( !comparisonResult ) { @@ -360,23 +360,68 @@ } //----- (0044D9D7) -------------------------------------------------------- -void SpriteFrameTable::FromFile(void *pSerialized) +void SpriteFrameTable::FromFile(void *data_mm6, void *data_mm7, void *data_mm8) { - //v2 = this; - uNumSpriteFrames = *(int *)pSerialized; - uNumEFrames = *((int *)pSerialized + 1); - //memcpy(this, pSerialized, 4u); - //memcpy(&v2->field_4, (char *)pSerialized + 4, 4u); - pSpriteSFrames = (SpriteFrame *)pAllocator->AllocNamedChunk(pSpriteSFrames, 60 * uNumSpriteFrames, "S Frames"); - pSpriteEFrames = (__int16 *)pAllocator->AllocNamedChunk(pSpriteEFrames, 2 * uNumSpriteFrames, "E Frames"); - //v3 = pAllocator->AllocNamedChunk(pSpritePFrames, 4 * uNumSpriteFrames, "P Frames"); - //v4 = v2->uNumSpriteFrames; + uint num_mm6_frames = 0; + uint num_mm6_eframes = 0; + if (data_mm6) + { + num_mm6_frames = *(int *)data_mm6; + num_mm6_eframes = *((int *)data_mm6 + 1); + } + + uint num_mm7_frames = 0; + uint num_mm7_eframes = 0; + if (data_mm7) + { + num_mm7_frames = *(int *)data_mm7; + num_mm7_eframes = *((int *)data_mm7 + 1); + } + + uint num_mm8_frames = 0; + uint num_mm8_eframes = 0; + if (data_mm8) + { + num_mm8_frames = *(int *)data_mm8; + num_mm8_eframes = *((int *)data_mm8 + 1); + } + + uNumSpriteFrames = num_mm6_frames + num_mm7_frames + num_mm8_frames; + uNumEFrames = num_mm6_eframes + num_mm7_eframes + num_mm8_eframes; + + pSpriteSFrames = (SpriteFrame *)pAllocator->AllocNamedChunk(pSpriteSFrames, uNumSpriteFrames * sizeof(SpriteFrame), "S Frames"); + pSpriteEFrames = (__int16 *)pAllocator->AllocNamedChunk(pSpriteEFrames, uNumSpriteFrames * sizeof(short), "E Frames"); + pSpritePFrames = (SpriteFrame **)pAllocator->AllocNamedChunk(pSpritePFrames, 4 * uNumSpriteFrames, "P Frames"); - auto uSpriteFramesSize = 60 * uNumSpriteFrames; - memcpy(pSpriteSFrames, (char *)pSerialized + 8, uSpriteFramesSize); - memcpy(pSpriteEFrames, (char *)pSerialized + uSpriteFramesSize + 8, 2 * uNumEFrames); - for (uint i = 0; i < uNumSpriteFrames; ++i) + + auto mm7_frames_size = num_mm7_frames * sizeof(SpriteFrame); + memcpy(pSpriteSFrames, (char *)data_mm7 + 8, mm7_frames_size); + memcpy(pSpriteEFrames, (char *)data_mm7 + 8 + mm7_frames_size, 2 * num_mm7_eframes); + + auto mm6_frames_size = num_mm6_frames * sizeof(SpriteFrame_mm6); + for (uint i = 0; i < num_mm6_frames; ++i) + { + memcpy(pSpriteSFrames + num_mm7_frames + i, (char *)data_mm6 + 8 + i * sizeof(SpriteFrame_mm6), sizeof(SpriteFrame_mm6)); + pSpriteSFrames[num_mm7_frames + i].uAnimLength = 0; + } + memcpy(pSpriteEFrames + num_mm7_frames, (char *)data_mm6 + 8 + mm6_frames_size, 2 * num_mm6_eframes); + + if (data_mm8) __debugbreak(); + auto mm8_frames_size = num_mm8_frames * sizeof(SpriteFrame); + memcpy(pSpriteSFrames + num_mm6_frames + num_mm7_frames, (char *)data_mm8 + 8, mm8_frames_size); + memcpy(pSpriteEFrames + num_mm6_frames + num_mm7_frames, (char *)data_mm8 + 8 + mm8_frames_size, 2 * num_mm8_eframes); + + for (uint i = 0; i < num_mm7_frames; ++i) pSpritePFrames[i] = &pSpriteSFrames[pSpriteEFrames[i]]; + + for (uint i = num_mm7_frames; i < num_mm6_frames + num_mm7_frames; ++i) + pSpritePFrames[i] = &pSpriteSFrames[pSpriteEFrames[i] + num_mm7_frames]; + + for (uint i = num_mm6_frames + num_mm7_frames; i < num_mm6_frames + num_mm7_frames + num_mm8_frames; ++i) + pSpritePFrames[i] = &pSpriteSFrames[pSpriteEFrames[i] + num_mm6_frames + num_mm7_frames]; + + //for (uint i = 0; i < uNumSpriteFrames; ++i) + // pSpritePFrames[i] = &pSpriteSFrames[pSpriteEFrames[i]]; } //----- (0044DA92) --------------------------------------------------------
--- a/Sprites.h Thu Aug 29 22:01:47 2013 +0600 +++ b/Sprites.h Thu Aug 29 22:02:00 2013 +0600 @@ -24,9 +24,8 @@ /* 42 */ #pragma pack(push, 1) -class SpriteFrame +struct SpriteFrame_mm6 { -public: char pIconName[12]; char pTextureName[12]; //c __int16 pHwSpriteIDs[8]; //18h @@ -36,6 +35,12 @@ __int16 uPaletteID; //32 __int16 uPaletteIndex; __int16 uAnimTime; + //__int16 uAnimLength; + //__int16 _pad; +}; + +struct SpriteFrame: SpriteFrame_mm6 +{ __int16 uAnimLength; __int16 _pad; }; @@ -54,7 +59,7 @@ pSpriteEFrames = nullptr; } void ToFile(); - void FromFile(void *pSerialized); + void FromFile(void *data_mm6, void *data_mm7, void *data_mm8); bool FromFileTxt(const char *Args); void ReleaseSFrames(); void ResetSomeSpriteFlags();
--- a/Texture.cpp Thu Aug 29 22:01:47 2013 +0600 +++ b/Texture.cpp Thu Aug 29 22:02:00 2013 +0600 @@ -264,11 +264,21 @@ } //----- (0044E0A0) -------------------------------------------------------- -void TextureFrameTable::FromFile(void *pSerialized) +void TextureFrameTable::FromFile(void *data_mm6, void *data_mm7, void *data_mm8) { - sNumTextures = *(int *)pSerialized; - pTextures = (TextureFrame *)pAllocator->AllocNamedChunk(pTextures, 20 * sNumTextures, "Txt Frames"); - memcpy(pTextures, (char *)pSerialized + 4, 20 * sNumTextures); + uint num_mm6_frames = data_mm6 ? *(int *)data_mm6 : 0, + num_mm7_frames = data_mm7 ? *(int *)data_mm7 : 0, + num_mm8_frames = data_mm8 ? *(int *)data_mm8 : 0; + + sNumTextures = num_mm6_frames + num_mm7_frames + num_mm8_frames; + assert(sNumTextures); + assert(!num_mm8_frames); + + pTextures = (TextureFrame *)pAllocator->AllocNamedChunk(pTextures, sNumTextures * sizeof(TextureFrame), "Txt Frames"); + + memcpy(pTextures, (char *)data_mm7 + 4, num_mm7_frames * sizeof(TextureFrame)); + memcpy(pTextures + num_mm7_frames, (char *)data_mm6 + 4, num_mm6_frames * sizeof(TextureFrame)); + memcpy(pTextures + num_mm6_frames + num_mm7_frames, (char *)data_mm8 + 4, num_mm8_frames * sizeof(TextureFrame)); } //----- (0044E0ED) --------------------------------------------------------
--- a/Texture.h Thu Aug 29 22:01:47 2013 +0600 +++ b/Texture.h Thu Aug 29 22:02:00 2013 +0600 @@ -110,7 +110,7 @@ } int FromFileTxt(const char *Args); void ToFile(); - void FromFile(void *pSerialized); + void FromFile(void *data_mm6, void *data_mm7, void *data_mm8); void LoadAnimationSequenceAndPalettes(signed int uIconID); unsigned int GetFrameTexture(int uFrameID, signed int a3); unsigned int FindTextureByName(const char *Str2);
--- a/TileFrameTable.h Thu Aug 29 22:01:47 2013 +0600 +++ b/TileFrameTable.h Thu Aug 29 22:02:00 2013 +0600 @@ -67,7 +67,7 @@ int GetTileForTerrainType(signed int a1, bool a2); unsigned int GetTileId(unsigned int uTerrainType, unsigned int uSection); void ToFile(); - void FromFile(void *pSerialized); + void FromFile(void *data_mm6, void *data_mm7, void *data_mm8); int FromFileTxt(const char *pFilename); signed int sNumTiles;
--- a/TileTable.cpp Thu Aug 29 22:01:47 2013 +0600 +++ b/TileTable.cpp Thu Aug 29 22:02:00 2013 +0600 @@ -119,11 +119,19 @@ } //----- (00488000) -------------------------------------------------------- -void TileTable::FromFile(void *pSerialized) +void TileTable::FromFile(void *data_mm6, void *data_mm7, void *data_mm8) { - sNumTiles = *(int *)pSerialized; - pTiles = (TileDesc *)pAllocator->AllocNamedChunk(pTiles, sizeof(TileDesc) * sNumTiles, "Tile Descrip"); - memcpy(pTiles, (char *)pSerialized + 4, sizeof(TileDesc) * sNumTiles); + uint num_mm6_tiles = data_mm6 ? *(int *)data_mm6 : 0, + num_mm7_tiles = data_mm7 ? *(int *)data_mm7 : 0, + num_mm8_tiles = data_mm8 ? *(int *)data_mm8 : 0; + sNumTiles = num_mm6_tiles + num_mm7_tiles + num_mm8_tiles; + assert(sNumTiles); + assert(!num_mm8_tiles); + + pTiles = (TileDesc *)pAllocator->AllocNamedChunk(pTiles, sNumTiles * sizeof(TileDesc), "Tile Descrip"); + memcpy(pTiles, (char *)data_mm7 + 4, num_mm7_tiles * sizeof(TileDesc)); + memcpy(pTiles + num_mm7_tiles, (char *)data_mm6 + 4, num_mm6_tiles * sizeof(TileDesc)); + memcpy(pTiles + num_mm6_tiles + num_mm7_tiles, (char *)data_mm8 + 4, num_mm8_tiles * sizeof(TileDesc)); } //----- (00488047) --------------------------------------------------------
--- a/UI/Books/UIMapBook.cpp Thu Aug 29 22:01:47 2013 +0600 +++ b/UI/Books/UIMapBook.cpp Thu Aug 29 22:02:00 2013 +0600 @@ -255,7 +255,7 @@ map_window.uFrameY = game_viewport_y; map_window.uFrameZ = game_viewport_z; map_window.uFrameW = game_viewport_w; - map_id = pMapStats->GetMapInfo(pCurrentMapName.data()); + map_id = pMapStats->GetMapInfo(pCurrentMapName); if ( map_id ) map_window.DrawTitleText(pBook2Font, -14, 12, ui_book_map_title_color, pMapStats->pInfos[map_id].pName, 3);
--- a/UI/Books/UINotesBooks.cpp Thu Aug 29 22:01:47 2013 +0600 +++ b/UI/Books/UINotesBooks.cpp Thu Aug 29 22:02:00 2013 +0600 @@ -94,7 +94,7 @@ sprintf(pTmpBuf.data(), "%s\t100:\t110%s", pGlobalTXT_LocalizationStrings[530], aMoonPhaseNames[pDayMoonPhase[pParty->uDaysPlayed]]); // "Moon" calendar_window.DrawText(pBookFont, 70, 8 * LOBYTE(pBookFont->uFontHeight) + 31, ui_book_calendar_moon_color, pTmpBuf.data(), 0, 0, 0); - pMapID = pMapStats->GetMapInfo(pCurrentMapName.data()); + pMapID = pMapStats->GetMapInfo(pCurrentMapName); if ( pMapID ) pMapName = pMapStats->pInfos[pMapID].pName; else
--- a/UI/UICharacter.cpp Thu Aug 29 22:01:47 2013 +0600 +++ b/UI/UICharacter.cpp Thu Aug 29 22:02:00 2013 +0600 @@ -2323,22 +2323,16 @@ unsigned int v3; // edx@4 unsigned int pSkillType; // esi@5 unsigned __int16 v5; // ax@7 - //unsigned int v6; // edi@19 int v7; // esi@27 int v8; // eax@29 - //int v9; // edx@32 int v10; // esi@34 - //int v11; // eax@34 int v12; // esi@38 - //int v13; // eax@38 char v14; // zf@38 int v15; // esi@42 - //int v16; // eax@42 int v17; // eax@44 unsigned int v18; // ecx@55 unsigned int v19; // eax@55 int v20; // esi@60 - //int v21; // eax@60 unsigned int v22; // eax@61 int v23; // eax@62 int v24; // esi@65 @@ -2367,7 +2361,6 @@ v51 = 0; _this.Reset(); - //v0 = pPlayers[uActiveCharacter]; v1 = pPlayers[uActiveCharacter]->pEquipment.uMainHand; v2 = pPlayers[uActiveCharacter]->pEquipment.uShield; //v54 = pPlayers[uActiveCharacter]->pEquipment.uShield; @@ -2397,14 +2390,14 @@ if ( (pSkillType == 8 || pSkillType == 1 || pSkillType == 2) && v1 && pItemsTable->pItems[*(int *)&pPlayers[uActiveCharacter]->pInventoryItemList[v1-1]].uSkillType == 4 ) - { + { LOBYTE(v5) = pPlayers[uActiveCharacter]->GetActualSkillLevel(PLAYER_SKILL_SPEAR); if ( (signed int)SkillToMastery(v5) < 3 ) { pPlayers[uActiveCharacter]->PlaySound(SPEECH_39, 0); return; } - } + } } if ( !pPlayers[uActiveCharacter]->CanEquip_RaceAndAlignmentCheck(v3) ) { @@ -2470,14 +2463,14 @@ } if ( v52 == 16 )// { - v52 = pPlayers[uActiveCharacter]->pEquipment.uRings[6] - 1; + v52 = pPlayers[uActiveCharacter]->pEquipment.uRings[5] - 1; memcpy(&_this, &pParty->pPickedItem, sizeof(_this)); v10 = (int)((char *)pPlayers[uActiveCharacter] + 36 * v52); *(char *)(v10 + 556) = 0; pParty->pPickedItem.Reset(); - pParty->SetHoldingItem((ItemGen *)(v10 + 532)); + pParty->SetHoldingItem(&pPlayers[uActiveCharacter]->pInventoryItemList[v52]);//(ItemGen *)(v10 + 532) _this.uBodyAnchor = 16; - memcpy((void *)(v10 + 532), &_this, 0x24u); + memcpy(&pPlayers[uActiveCharacter]->pInventoryItemList[v52], &_this, 0x24u); pPlayers[uActiveCharacter]->pEquipment.uRings[6] = v52 + 1; } return;
--- a/UI/UIHouses.cpp Thu Aug 29 22:01:47 2013 +0600 +++ b/UI/UIHouses.cpp Thu Aug 29 22:02:00 2013 +0600 @@ -2298,10 +2298,10 @@ v5 = &transport_schedule[transport_routes[(unsigned int)window_SpeakInHouse->ptr_1C - HOUSE_STABLES_HARMONDALE][dialog_menu_id - HOUSE_DIALOGUE_TRANSPORT_SCHEDULE_1]]; if ( v5->pSchedule[pParty->uDaysPlayed % 7] ) { - if ( _stricmp(pCurrentMapName.data(), pMapStats->pInfos[v5->uMapInfoID].pFilename) ) + if ( _stricmp(pCurrentMapName, pMapStats->pInfos[v5->uMapInfoID].pFilename) ) { SaveGame(1, 0); - strcpy(pCurrentMapName.data(), pMapStats->pInfos[v5->uMapInfoID].pFilename); + strcpy(pCurrentMapName, pMapStats->pInfos[v5->uMapInfoID].pFilename); dword_6BE364_game_settings_1 |= 1u; _5B65B8_npcdata_hiword_house_or_other = 0;
--- a/UI/UIRest.cpp Thu Aug 29 22:01:47 2013 +0600 +++ b/UI/UIRest.cpp Thu Aug 29 22:02:00 2013 +0600 @@ -60,7 +60,7 @@ --uRestUI_FoodRequiredToRest; if ( uRestUI_FoodRequiredToRest < 1 ) uRestUI_FoodRequiredToRest = 1; - if ( !_stricmp(pCurrentMapName.data(), "d29.blv") && _449B57_test_bit(pParty->_quest_bits, 98) ) + if ( !_stricmp(pCurrentMapName, "d29.blv") && _449B57_test_bit(pParty->_quest_bits, 98) ) uRestUI_FoodRequiredToRest = 0; ++pIcons_LOD->uTexturePacksCount;
--- a/UI/UIShops.cpp Thu Aug 29 22:01:47 2013 +0600 +++ b/UI/UIShops.cpp Thu Aug 29 22:02:00 2013 +0600 @@ -2483,8 +2483,8 @@ uPriceItemService = pPlayers[uActiveCharacter]->GetBuyingPrice(bought_item->GetValue(), p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier); uNumSeconds = 0; a3 = 0; - if ( pMapStats->GetMapInfo(pCurrentMapName.data()) ) - a3 = pMapStats->pInfos[pMapStats->GetMapInfo(pCurrentMapName.data())]._steal_perm; + if ( pMapStats->GetMapInfo(pCurrentMapName) ) + a3 = pMapStats->pInfos[pMapStats->GetMapInfo(pCurrentMapName)]._steal_perm; party_reputation = GetPartyReputation(); if (pPlayers[uActiveCharacter]->CanSteal()) {
--- a/UI/UITransition.cpp Thu Aug 29 22:01:47 2013 +0600 +++ b/UI/UITransition.cpp Thu Aug 29 22:02:00 2013 +0600 @@ -78,7 +78,7 @@ } else if ( !v23 ) { - v14 = pMapStats->GetMapInfo(pCurrentMapName.data()); + v14 = pMapStats->GetMapInfo(pCurrentMapName); if ( v14 ) { sprintfex(sHouseName.data(), pGlobalTXT_LocalizationStrings[410], pMapStats->pInfos[v14].pName); // "Leave %s" @@ -89,7 +89,7 @@ } v15 = pLocationName; if ( *pLocationName == 48 ) - v15 = pCurrentMapName.data(); + v15 = pCurrentMapName; v16 = pMapStats->GetMapInfo(v15); if ( v16 ) { @@ -134,7 +134,7 @@ pTexture_Dialogue_Background = pIcons_LOD->LoadTexturePtr(pContainer, TEXTURE_16BIT_PALETTE); pTexture_outside = pIcons_LOD->LoadTexturePtr("outside", TEXTURE_16BIT_PALETTE); - v1 = pMapStats->GetMapInfo(pCurrentMapName.data()); + v1 = pMapStats->GetMapInfo(pCurrentMapName); if ( v1 ) sprintfex(sHouseName.data(), pGlobalTXT_LocalizationStrings[410], pMapStats->pInfos[v1].pName);// "Leave %s" else @@ -158,7 +158,7 @@ unsigned int v9; // [sp+80h] [bp-4h]@1 memcpy(&v7, pPrimaryWindow, sizeof(v7)); - v9 = pMapStats->GetMapInfo(pCurrentMapName.data()); + v9 = pMapStats->GetMapInfo(pCurrentMapName); pOutdoor->GetTravelDestination(pParty->vPosition.x, pParty->vPosition.y, pDestinationMapName, 20); v0 = pMapStats->GetMapInfo(pDestinationMapName); pRenderer->DrawTextureIndexed(0x1DDu, 0, pTexture_Dialogue_Background); @@ -215,7 +215,7 @@ int a3; // [sp+6Bh] [bp-1h]@11 memcpy(&v8, pPrimaryWindow, sizeof(v8)); - v10 = pMapStats->GetMapInfo(pCurrentMapName.data()); + v10 = pMapStats->GetMapInfo(pCurrentMapName); v9 = IndoorLocation::GetLocationIndex(dword_591164_teleport_map_name); pRenderer->DrawTextureIndexed(0x1DDu, 0, pTexture_Dialogue_Background); pRenderer->DrawTextureIndexed(pNPCPortraits_x[0][0] - 4, pNPCPortraits_y[0][0] - 4, pIcons_LOD->GetTexture(uTextureID_50795C));
--- a/UI/UiGame.cpp Thu Aug 29 22:01:47 2013 +0600 +++ b/UI/UiGame.cpp Thu Aug 29 22:02:00 2013 +0600 @@ -853,7 +853,7 @@ if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor || (*(float *)&v23 = 0.0, (signed int)v1 <= 0) ) { LABEL_14: - v17 = pMapStats->GetMapInfo(pCurrentMapName.data()); + v17 = pMapStats->GetMapInfo(pCurrentMapName); if ( v17 == v2 ) result = "No Maze Info for this maze on file!"; else
--- a/mm7_2.cpp Thu Aug 29 22:01:47 2013 +0600 +++ b/mm7_2.cpp Thu Aug 29 22:02:00 2013 +0600 @@ -1776,109 +1776,6 @@ return result; } -//----- (00450929) -------------------------------------------------------- -int LevelDecoration::GetGlobalEvent() -{ - LevelDecoration *v1; // esi@1 - signed int v2; // eax@1 - int v3; // eax@5 - int v4; // eax@6 - int v5; // eax@7 - int v6; // eax@8 - int v7; // eax@9 - int result; // eax@14 - int v9; // eax@18 - int v10; // eax@19 - int v11; // eax@20 - int v12; // eax@21 - int v13; // eax@22 - - switch (uDecorationDescID) - { - case 0: case 1: - case 2: case 3: - return 0; - - case 4: return 16; // dec01 "Trash Pile" - case 5: return 32; // dec02 "Campfire" - case 6: return 12 + rand() % 4; // dec03 "Cauldron" - case 7: case 8: - case 9: case 10: - return 0; - - case 11: return 34; // dec08 "Fruit plate" - case 12: - return 0; - - case 13: return 17; // dec10 "Trash Pile" - case 14: return 18; // dec11 "Filth" - case 15: case 16: case 17: - case 18: case 19: case 20: - case 21: case 22: case 23: - return 0; - - case 24: return 36; // dec21 "Keg" - case 25: case 26: case 27: case 28: case 29: - case 30: case 31: case 32: case 33: - return 0; - - case 34: return 4 + rand() % 6; // dec32 "Barrel" - case 35: case 36: case 37: case 38: case 39: - case 40: case 41: case 42: case 43: case 44: case 45: case 46: case 47: case 48: case 49: - case 50: case 51: case 52: case 53: case 54: case 55: case 56: case 57: case 58: case 59: - case 60: case 61: case 62: case 63: case 64: case 65: case 66: case 67: case 68: case 69: - case 70: case 71: case 72: case 73: case 74: case 75: case 76: case 77: case 78: case 79: - case 80: case 81: case 82: case 83: case 84: case 85: case 86: case 87: case 88: case 89: - case 90: case 91: case 92: case 93: case 94: case 95: case 96: case 97: case 98: case 99: - case 100: case 101: case 102: case 103: case 104: case 105: case 106: case 107: case 108: case 109: - case 110: case 111: case 112: case 113: case 114: case 115: case 116: case 117: case 118: case 119: - case 120: case 121: case 122: case 123: case 124: case 125: case 126: case 127: case 128: case 129: - case 130: case 131: case 132: case 133: case 134: case 135: case 136: case 137: case 138: case 139: - case 140: case 141: case 142: case 143: case 144: case 145: case 146: case 147: case 148: case 149: - case 150: case 151: case 152: case 153: case 154: case 155: case 156: case 157: case 158: case 159: - case 160: case 161: case 162: case 163: case 164: case 165: case 166: case 167: case 168: case 169: - case 170: case 171: case 172: case 173: case 174: case 175: case 176: case 177: case 178: case 179: - case 180: case 181: case 182: case 183: - - case 184: return 33; // dec24 "Campfire" - case 185: case 186: - return 0; - - case 187: // dec88 "Mushroom" - case 190: // dec91 "Mushroom" - return 37; - - case 188: case 189: - case 191: case 192: case 193: case 194: case 195: case 196: - case 197: case 198: case 199: case 200: case 201: case 202: - case 203: case 204: case 205: - return 0; - - case 206: return 162 + rand() % 7; // dec60 - case 207: return 169 + rand() % 7; // dec61 - case 208: return 176 + rand() % 7; // dec62 - case 209: return 183 + rand() % 7; // dec63 - case 210: return 150; // dec64 "Magic Pedistal" - case 211: return 151; // dec65 "Magic Pedistal" - case 212: return 152; // dec66 "Magic Pedistal" - case 213: return 153; // dec67 "Magic Pedistal" - case 214: return 154; // dec68 "Magic Pedistal" - case 215: return 155; // dec69 "Magic Pedistal" - case 216: return 156; // dec70 "Magic Pedistal" - case 217: return 157; // dec71 "Magic Pedistal" - case 218: return 158; // dec72 "Magic Pedistal" - case 219: return 159; // dec73 "Magic Pedistal" - case 220: return 160; // dec74 "Magic Pedistal" - case 221: return 161; // dec75 "Magic Pedistal" - - case 222: case 223: case 224: - case 225: case 226: case 227: - return 0; - - default: assert(false && "Invalid Decoration"); - } -} - //----- (00450AAA) -------------------------------------------------------- void RespawnGlobalDecorations() { @@ -3022,10 +2919,10 @@ v2 = bLoading; v3 = a2; - pGameLoadingUI_ProgressBar->Reset(0x1Bu); + pGameLoadingUI_ProgressBar->Reset(27); pSoundList->_4A9D79(0); - uCurrentlyLoadedLevelType = (LEVEL_TYPE)2; - ODM_LoadAndInitialize(pCurrentMapName.data(), v3); + uCurrentlyLoadedLevelType = LEVEL_Outdoor; + ODM_LoadAndInitialize(pCurrentMapName, v3); if ( !v2 ) TeleportToStartingPoint(uLevel_StartingPointType); viewparams->_443365(); @@ -3067,7 +2964,7 @@ //v1 = 0; dword_5C6DF8 = 1; pNPCStats->uNewlNPCBufPos = 0; - v19 = pMapStats->GetMapInfo(pCurrentMapName.data()); + v19 = pMapStats->GetMapInfo(pCurrentMapName); //v15 = 0; for (uint i = 0; i < uNumActors; ++i) @@ -4090,7 +3987,7 @@ //----- (00464839) -------------------------------------------------------- char Is_out15odm_underwater() { - return _stricmp(pCurrentMapName.data(), "out15.odm") == 0; + return _stricmp(pCurrentMapName, "out15.odm") == 0; } //----- (00464851) -------------------------------------------------------- @@ -4117,12 +4014,12 @@ pDecalBuilder->Reset(0); pGameLoadingUI_ProgressBar->Initialize(_1_fullscreen_loading_2_box == 1 ? GUIProgressBar::TYPE_Fullscreen : GUIProgressBar::TYPE_Box); - strcpy(Str1, pCurrentMapName.data()); + strcpy(Str1, pCurrentMapName); v3 = strtok(Str1, "."); strcpy(Str1, v3); Level_LoadEvtAndStr(Str1); LoadLevel_InitializeLevelEvt(); - strcpy(Str1, pCurrentMapName.data()); + strcpy(Str1, pCurrentMapName); _strrev(Str1); strtok(Str1, "."); _strrev(Str1); @@ -4130,11 +4027,11 @@ for (uint i = 0; i < 1000; ++i) pSpriteObjects[i].uObjectDescID = 0; - v5 = pMapStats->GetMapInfo(pCurrentMapName.data()); + v5 = pMapStats->GetMapInfo(pCurrentMapName); bUnderwater = 0; uLevelMapStatsID = v5; pGame->uFlags2 &= 0xFFFFFFF7u; - if ( !_stricmp(pCurrentMapName.data(), "out15.odm") ) + if ( !_stricmp(pCurrentMapName, "out15.odm") ) { bUnderwater = 1; pGame->uFlags2 |= 8u; @@ -4146,7 +4043,7 @@ PrepareToLoadBLV(v9); pAudioPlayer->SetMapEAX(); _461103_load_level_sub(); - if ( !_stricmp(pCurrentMapName.data(), "d11.blv") || !_stricmp(pCurrentMapName.data(), "d10.blv") ) + if ( !_stricmp(pCurrentMapName, "d11.blv") || !_stricmp(pCurrentMapName, "d10.blv") ) { //spawning grounds & good analogue - no loot & exp from monsters @@ -4818,7 +4715,7 @@ ShowWindow(hWnd, SW_SHOWNORMAL); pIcons_LOD = new LODFile_IconsBitmaps; - if (!pIcons_LOD->LoadIconsOrEvents("data\\icons.lod")) + if (!pIcons_LOD->Load("data\\icons.lod", "icons")) { MessageBoxW(nullptr, L"Some files are missing\n\nPlease Reinstall.", @@ -4828,7 +4725,7 @@ pIcons_LOD->dword_011BA4 = 0; pEvents_LOD = new LODFile_IconsBitmaps; - if (!pEvents_LOD->LoadIconsOrEvents("data\\events.lod")) + if (!pEvents_LOD->Load("data\\events.lod", "icons")) { MessageBoxW(nullptr, L"Some files are missing\n\nPlease Reinstall.", @@ -4839,7 +4736,7 @@ InitializeGameText(); pBitmaps_LOD = new LODFile_IconsBitmaps; - if (!pBitmaps_LOD->LoadBitmaps("data\\bitmaps.lod")) + if (!pBitmaps_LOD->Load("data\\bitmaps.lod", "bitmaps")) { MessageBoxA(nullptr, pGlobalTXT_LocalizationStrings[63], @@ -4867,6 +4764,51 @@ return false; } + + + if (_access("../MM_VI/data/icons.lod", 0) == 0) + { + pIcons_LOD_mm6 = new LODFile_IconsBitmaps; + if (!pIcons_LOD_mm6->Load("../MM_VI/data/icons.lod", "icons")) + { + delete pIcons_LOD_mm6; + pIcons_LOD_mm6 = nullptr; + Log::Warning(L"Unable to load mm6:icons.lod"); + } + } + else + Log::Warning(L"Unable to find mm6:icons.lod"); + + if (_access("../MM_VI/data/bitmaps.lod", 0) == 0) + { + pBitmaps_LOD_mm6 = new LODFile_IconsBitmaps; + if (!pBitmaps_LOD_mm6->Load("../MM_VI/data/bitmaps.lod", "bitmaps")) + { + delete pBitmaps_LOD_mm6; + pBitmaps_LOD_mm6 = nullptr; + Log::Warning(L"Unable to load mm6:bitmaps.lod"); + } + } + else + Log::Warning(L"Unable to find mm6:bitmaps.lod"); + + auto mm6_sprite_container_name = bUseLoResSprites ? "../MM_VI/data/spriteLO.lod" + : "../MM_VI/data/sprites.lod"; + if (_access(mm6_sprite_container_name, 0) == 0) + { + pSprites_LOD_mm6 = new LODFile_Sprites; + if (!pSprites_LOD_mm6->LoadSprites(mm6_sprite_container_name)) + { + delete pSprites_LOD_mm6; + pSprites_LOD_mm6 = nullptr; + Log::Warning(L"Unable to load mm6:sprites.lod"); + } + } + else + Log::Warning(L"Unable to find mm6:sprites.lod"); + + + if (bDebugResouces) { pSpriteFrameTable = new SpriteFrameTable; @@ -4915,60 +4857,104 @@ } else { - auto pSFT = pEvents_LOD->LoadRaw("dsft.bin", 1); + void *sft_mm6 = pIcons_LOD_mm6 ? pIcons_LOD_mm6->LoadRaw("dsft.bin", 1) : nullptr, + *sft_mm8 = nullptr; + auto sft_mm7 = pEvents_LOD->LoadRaw("dsft.bin", 1); pSpriteFrameTable = new SpriteFrameTable; - pSpriteFrameTable->FromFile(pSFT); - free(pSFT); - - auto pTFT = pEvents_LOD->LoadRaw("dtft.bin", 1); + pSpriteFrameTable->FromFile(sft_mm6, sft_mm7, sft_mm8); + free(sft_mm6); + free(sft_mm7); + free(sft_mm8); + + void *tft_mm6 = pIcons_LOD_mm6 ? pIcons_LOD_mm6->LoadRaw("dtft.bin", 1) : nullptr, + *tft_mm8 = nullptr; + auto tft_mm7 = pEvents_LOD->LoadRaw("dtft.bin", 1); pTextureFrameTable = new TextureFrameTable; - pTextureFrameTable->FromFile(pTFT); - free(pTFT); - - auto pTiles = pEvents_LOD->LoadRaw("dtile.bin", 1); + pTextureFrameTable->FromFile(tft_mm6, tft_mm7, tft_mm8); + free(tft_mm6); + free(tft_mm7); + free(tft_mm8); + + void *tiles_mm6 = pIcons_LOD_mm6 ? pIcons_LOD_mm6->LoadRaw("dtile.bin", 1) : nullptr, + *tiles_mm8 = nullptr; + auto tiles_mm7 = pEvents_LOD->LoadRaw("dtile.bin", 1); pTileTable = new TileTable; - pTileTable->FromFile(pTiles); - free(pTiles); - - auto pPFT = pEvents_LOD->LoadRaw("dpft.bin", 1); + pTileTable->FromFile(tiles_mm6, tiles_mm7, tiles_mm8); + free(tiles_mm6); + free(tiles_mm7); + free(tiles_mm8); + + void *pft_mm6 = pIcons_LOD_mm6 ? pIcons_LOD_mm6->LoadRaw("dpft.bin", 1) : nullptr, + *pft_mm8 = nullptr; + auto pft_mm7 = pEvents_LOD->LoadRaw("dpft.bin", 1); pPlayerFrameTable = new PlayerFrameTable; - pPlayerFrameTable->FromFile(pPFT); - free(pPFT); - - auto pIFT = pEvents_LOD->LoadRaw("dift.bin", 1); + pPlayerFrameTable->FromFile(pft_mm6, pft_mm7, pft_mm8); + free(pft_mm6); + free(pft_mm7); + free(pft_mm8); + + void *ift_mm6 = pIcons_LOD_mm6 ? pIcons_LOD_mm6->LoadRaw("dift.bin", 1) : nullptr, + *ift_mm8 = nullptr; + auto ift_mm7 = pEvents_LOD->LoadRaw("dift.bin", 1); pIconsFrameTable = new IconFrameTable; - pIconsFrameTable->FromFile(pIFT); - free(pIFT); - - auto pDecs = pEvents_LOD->LoadRaw("ddeclist.bin", 1); + pIconsFrameTable->FromFile(ift_mm6, ift_mm7, ift_mm8); + free(ift_mm6); + free(ift_mm7); + free(ift_mm8); + + void *decs_mm6 = pIcons_LOD_mm6 ? pIcons_LOD_mm6->LoadRaw("ddeclist.bin", 1) : nullptr, + *decs_mm8 = nullptr; + auto decs_mm7 = pEvents_LOD->LoadRaw("ddeclist.bin", 1); pDecorationList = new DecorationList; - pDecorationList->FromFile(pDecs); - free(pDecs); - - auto pObjs = pEvents_LOD->LoadRaw("dobjlist.bin", 1); + pDecorationList->FromFile(decs_mm6, decs_mm7, decs_mm8); + free(decs_mm6); + free(decs_mm7); + free(decs_mm8); + + void *objs_mm6 = pIcons_LOD_mm6 ? pIcons_LOD_mm6->LoadRaw("dobjlist.bin", 1) : nullptr, + *objs_mm8 = nullptr; + auto objs_mm7 = pEvents_LOD->LoadRaw("dobjlist.bin", 1); pObjectList = new ObjectList; - pObjectList->FromFile(pObjs); - free(pObjs); - - auto pMons = pEvents_LOD->LoadRaw("dmonlist.bin", 1); + pObjectList->FromFile(objs_mm6, objs_mm7, objs_mm8); + free(objs_mm6); + free(objs_mm7); + free(objs_mm8); + + void *mons_mm6 = pIcons_LOD_mm6 ? pIcons_LOD_mm6->LoadRaw("dmonlist.bin", 1) : nullptr, + *mons_mm8 = nullptr; + auto mons_mm7 = pEvents_LOD->LoadRaw("dmonlist.bin", 1); pMonsterList = new MonsterList; - pMonsterList->FromFile(pMons); - free(pMons); - - auto pChests = pEvents_LOD->LoadRaw("dchest.bin", 1); + pMonsterList->FromFile(mons_mm6, mons_mm7, mons_mm8); + free(mons_mm6); + free(mons_mm7); + free(mons_mm8); + + void *chests_mm6 = pIcons_LOD_mm6 ? pIcons_LOD_mm6->LoadRaw("dchest.bin", 1) : nullptr, + *chests_mm8 = nullptr; + auto chests_mm7 = pEvents_LOD->LoadRaw("dchest.bin", 1); pChestList = new ChestList; - pChestList->FromFile(pChests); - free(pChests); - - auto pOverlays = pEvents_LOD->LoadRaw("doverlay.bin", 1); + pChestList->FromFile(chests_mm6, chests_mm7, chests_mm8); + free(chests_mm6); + free(chests_mm7); + free(chests_mm8); + + void *overlays_mm6 = pIcons_LOD_mm6 ? pIcons_LOD_mm6->LoadRaw("doverlay.bin", 1) : nullptr, + *overlays_mm8 = nullptr; + auto overlays_mm7 = pEvents_LOD->LoadRaw("doverlay.bin", 1); pOverlayList = new OverlayList; - pOverlayList->FromFile(pOverlays); - free(pOverlays); - - auto pSounds = pEvents_LOD->LoadRaw("dsounds.bin", 1); + pOverlayList->FromFile(overlays_mm6, overlays_mm7, overlays_mm8); + free(overlays_mm6); + free(overlays_mm7); + free(overlays_mm8); + + void *sounds_mm6 = pIcons_LOD_mm6 ? pIcons_LOD_mm6->LoadRaw("dsounds.bin", 1) : nullptr, + *sounds_mm8 = nullptr; + auto sounds_mm7 = pEvents_LOD->LoadRaw("dsounds.bin", 1); pSoundList = new SoundList; - pSoundList->FromFile(pSounds); - free(pSounds); + pSoundList->FromFile(sounds_mm6, sounds_mm7, sounds_mm8); + free(sounds_mm6); + free(sounds_mm7); + free(sounds_mm8); } @@ -5168,6 +5154,17 @@ void IntegrityTest() { + assert(sizeof(SoundDesc_mm6) == 112); + assert(sizeof(SoundDesc) == 120); + assert(sizeof(OverlayDesc) == 8); + assert(sizeof(ChestDesc) == 36); + assert(sizeof(ObjectDesc_mm6) == 52); + assert(sizeof(ObjectDesc) == 56); + assert(sizeof(DecorationDesc) == 84); + assert(sizeof(IconFrame) == 32); + assert(sizeof(PlayerFrame) == 10); + assert(sizeof(TextureFrame) == 20); + assert(sizeof(SpriteFrame) == 60); assert(sizeof(RenderVertexSoft) == 0x30); assert(sizeof(RenderBillboard) == 0x34); assert(sizeof(Texture) == 0x48); @@ -5183,7 +5180,8 @@ assert(sizeof(OverlayDesc) == 0x8); assert(sizeof(ChestDesc) == 0x24); assert(sizeof(TileDesc) == 0x1A); - assert(sizeof(MonsterDesc) == 0x98); + assert(sizeof(MonsterDesc_mm6) == 148); + assert(sizeof(MonsterDesc) == 152); assert(sizeof(Timer) == 0x28); assert(sizeof(OtherOverlay) == 0x14); assert(sizeof(ItemGen) == 0x24); @@ -5392,7 +5390,7 @@ pParty->Reset(); pOtherOverlayList->Reset(); - strcpy(pCurrentMapName.data(), pStartingMapName.data()); + strcpy(pCurrentMapName, pStartingMapName); pParty->CreateDefaultParty(0); PlayerCreationUI_Initialize(); if ( PlayerCreationUI_Loop() ) @@ -5452,7 +5450,7 @@ break; } _chdir("..\\"); - strcpy(pCurrentMapName.data(), ofn.lpstrFileTitle); + strcpy(pCurrentMapName, ofn.lpstrFileTitle); pMouse->Activate(1); pGame->Loop(); } @@ -5545,17 +5543,17 @@ wchar_t pStartingMapNameW[1024]; GetPrivateProfileStringW(L"file", L"startmap", L"out01.odm", pStartingMapNameW, 0x20u, pIniFilename); - sprintf(pStartingMapName.data(), "%S", pStartingMapNameW); + sprintf(pStartingMapName, "%S", pStartingMapNameW); v9 = 0; - if ( strlen(pStartingMapName.data()) ) + if ( strlen(pStartingMapName) ) { do { - if ( pStartingMapName[v9] == 32 ) + if ( pStartingMapName[v9] == ' ' ) pStartingMapName[v9] = 0; ++v9; - v2 = strlen(pStartingMapName.data()); + v2 = strlen(pStartingMapName); } while ( v9 < v2 ); }
--- a/mm7_3.cpp Thu Aug 29 22:01:47 2013 +0600 +++ b/mm7_3.cpp Thu Aug 29 22:02:00 2013 +0600 @@ -5562,7 +5562,7 @@ GetAlertStatus(); if ( qword_A750D8 ) qword_A750D8 = 0i64; - v2 = pMapStats->GetMapInfo(pCurrentMapName.data()); + v2 = pMapStats->GetMapInfo(pCurrentMapName); v3 = 0; if ( v2 ) { @@ -5639,45 +5639,6 @@ MM7Initialization(); } -//----- (0047A825) -------------------------------------------------------- -bool LevelDecoration::_47A825() -{ - bool v1; // ebx@1 - LevelDecoration *v2; // edi@1 - - v1 = 0; - v2 = this; - if ( pParty->uCurrentHour >= 1 || (unsigned __int16)_449B57_test_bit(pParty->_quest_bits, 178) ) - { - v1 = 0; - } - else - { - if ( (unsigned __int16)_449B57_test_bit(pParty->_quest_bits, 164) - && (unsigned __int16)_449B57_test_bit(pParty->_quest_bits, 165) - && (unsigned __int16)_449B57_test_bit(pParty->_quest_bits, 166) - && (unsigned __int16)_449B57_test_bit(pParty->_quest_bits, 167) - && (unsigned __int16)_449B57_test_bit(pParty->_quest_bits, 168) - && (unsigned __int16)_449B57_test_bit(pParty->_quest_bits, 169) - && (unsigned __int16)_449B57_test_bit(pParty->_quest_bits, 170) - && (unsigned __int16)_449B57_test_bit(pParty->_quest_bits, 171) - && (unsigned __int16)_449B57_test_bit(pParty->_quest_bits, 172) - && (unsigned __int16)_449B57_test_bit(pParty->_quest_bits, 173) - && (unsigned __int16)_449B57_test_bit(pParty->_quest_bits, 174) - && (unsigned __int16)_449B57_test_bit(pParty->_quest_bits, 175) - && (unsigned __int16)_449B57_test_bit(pParty->_quest_bits, 176) - && (unsigned __int16)_449B57_test_bit(pParty->_quest_bits, 177) ) - { - v1 = 1; - LOBYTE(v2->field_2) &= 0xDFu; - return v1; - } - } - LOBYTE(v2->field_2) |= 0x20u; - return v1; -} - - //----- (0047C370) -------------------------------------------------------- unsigned int GetLevelFogColor() { @@ -7516,7 +7477,7 @@ v16.uRadius = 32; v16.uKind = 3; v16.uIndex = v8 + 2 * v9 + v9; - v10 = pMapStats->GetMapInfo(pCurrentMapName.data()); + v10 = pMapStats->GetMapInfo(pCurrentMapName); if ( v10 ) { v11 = uNumActors; @@ -7546,11 +7507,11 @@ v2 = pMapName; pAudioPlayer->StopChannels(-1, -1); pGameLoadingUI_ProgressBar->Initialize(GUIProgressBar::TYPE_None); - if ( _stricmp(pCurrentMapName.data(), v2) ) + if ( _stricmp(pCurrentMapName, v2) ) SaveGame(1, 0); uGameState = GAME_STATE_2; - strcpy(pCurrentMapName.data(), v2); + strcpy(pCurrentMapName, v2); uLevel_StartingPointType = start_point; } // 6BE35C: using guessed type int uLevel_StartingPointType; @@ -7782,7 +7743,7 @@ //----- (0044C28F) -------------------------------------------------------- bool TeleportToNWCDungeon() { - if (!_stricmp("nwc.blv", pCurrentMapName.data())) + if (!_stricmp("nwc.blv", pCurrentMapName)) return false; _5B65A8_npcdata_uflags_or_other = 0; @@ -7799,32 +7760,6 @@ return true; } -//----- (0044C2F4) -------------------------------------------------------- -bool LevelDecoration::IsInteractive() -{ - switch (uDecorationDescID) - { - case 4: // trash pile - case 5: // campfire - case 6: // cauldron - case 11: // fruit plate - case 13: // trash pile - case 14: // dirt - case 24: // keg - case 184: // fire - case 187: // fire - case 190: // fire - return true; - } - - if (uDecorationDescID >= 206 && uDecorationDescID <= 209) // lighthouse fire - return true; - if (uDecorationDescID >= 210 && uDecorationDescID <= 221) // magic pedistal - return true; - - return false; -} - //----- (0044C362) -------------------------------------------------------- void Vec3_int_::Normalize_float() {
--- a/mm7_4.cpp Thu Aug 29 22:01:47 2013 +0600 +++ b/mm7_4.cpp Thu Aug 29 22:02:00 2013 +0600 @@ -1697,11 +1697,19 @@ } //----- (00494C0F) -------------------------------------------------------- -void PlayerFrameTable::FromFile(void *pSerialized) +void PlayerFrameTable::FromFile(void *data_mm6, void *data_mm7, void *data_mm8) { - uNumFrames = *(int *)pSerialized; - pFrames = (PlayerFrame *)pAllocator->AllocNamedChunk(pFrames, 10 * uNumFrames, "P Frames"); - memcpy(pFrames, (char *)pSerialized + 4, 10 * uNumFrames); + uint num_mm6_frames = data_mm6 ? *(int *)data_mm6 : 0, + num_mm7_frames = data_mm7 ? *(int *)data_mm7 : 0, + num_mm8_frames = data_mm8 ? *(int *)data_mm8 : 0; + uNumFrames = num_mm6_frames + num_mm7_frames + num_mm8_frames; + assert(uNumFrames); + assert(!num_mm8_frames); + + pFrames = (PlayerFrame *)pAllocator->AllocNamedChunk(pFrames, uNumFrames * sizeof(PlayerFrame), "P Frames"); + memcpy(pFrames, (char *)data_mm7 + 4, num_mm7_frames * sizeof(PlayerFrame)); + memcpy(pFrames + num_mm7_frames, (char *)data_mm6 + 4, num_mm6_frames * sizeof(PlayerFrame)); + memcpy(pFrames + num_mm6_frames + num_mm7_frames, (char *)data_mm8 + 4, num_mm8_frames * sizeof(PlayerFrame)); } //----- (00494C5A) -------------------------------------------------------- @@ -2000,7 +2008,7 @@ case 8: v63 = 0; v20 = (unsigned __int8 *)pPlayer->_achieved_awards_bits; - for ( uint i = 0; i < 28; ++i ) + for ( uint _i = 0; _i < 28; ++_i ) { if ( (unsigned __int16)_449B57_test_bit(v20, word_4EE150[i]) ) { @@ -2141,8 +2149,8 @@ i += 2; break; case 23: - if ( pMapStats->GetMapInfo(pCurrentMapName.data()) ) - pText = pMapStats->pInfos[pMapStats->GetMapInfo(pCurrentMapName.data())].pName; + if ( pMapStats->GetMapInfo(pCurrentMapName) ) + pText = pMapStats->pInfos[pMapStats->GetMapInfo(pCurrentMapName)].pName; else pText = pGlobalTXT_LocalizationStrings[394];// "Unknown" strcat(pTmpBuf2.data(), pText);
--- a/mm7_5.cpp Thu Aug 29 22:01:47 2013 +0600 +++ b/mm7_5.cpp Thu Aug 29 22:02:00 2013 +0600 @@ -1667,7 +1667,7 @@ dword_50CDC8 = 1; sub_42FBDD(); //pNPCData4 = (NPCData *)GetTravelTime(); - strcpy(pOutdoor->pLevelFilename, pCurrentMapName.data()); + strcpy(pOutdoor->pLevelFilename, pCurrentMapName); if ( bUnderwater != 1 && pParty->bFlying || pOutdoor->GetTravelDestination(pParty->vPosition.x, pParty->vPosition.y, pOut, 20) != 1 ) { @@ -1725,14 +1725,14 @@ } pPaletteManager->ResetNonLocked(); pSpriteFrameTable->ResetSomeSpriteFlags(); - strcpy(pCurrentMapName.data(), pOut); - strcpy(pLevelName, pCurrentMapName.data()); + strcpy(pCurrentMapName, pOut); + strcpy(pLevelName, pCurrentMapName); v41 = strtok(pLevelName, "."); strcpy(pLevelName, v41); Level_LoadEvtAndStr(pLevelName); pDecalBuilder->Reset(0); LoadLevel_InitializeLevelEvt(); - uLevelMapStatsID = pMapStats->GetMapInfo(pCurrentMapName.data()); + uLevelMapStatsID = pMapStats->GetMapInfo(pCurrentMapName); bUnderwater = 0; bNoNPCHiring = 0; pGame->uFlags2 &= 0xFFFFFFF7u; @@ -1741,7 +1741,7 @@ bUnderwater = 1; pGame->uFlags2 |= 8u; } - if ( !_stricmp(pCurrentMapName.data(), "out15.odm") || !_stricmp(pCurrentMapName.data(), "d47.blv") ) + if ( !_stricmp(pCurrentMapName, "out15.odm") || !_stricmp(pCurrentMapName, "d47.blv") ) bNoNPCHiring = 1; PrepareToLoadODM(1u, (OutdoorCamera *)1); pAudioPlayer->SetMapEAX(); @@ -1911,7 +1911,7 @@ dword_50CDC8 = 1; sub_42FBDD(); SaveGame(1, 0); - strcpy(pCurrentMapName.data(), pMapStats->pInfos[uHouse_ExitPic].pFilename); + strcpy(pCurrentMapName, pMapStats->pInfos[uHouse_ExitPic].pFilename); dword_6BE364_game_settings_1 |= 1; uGameState = GAME_STATE_2; //v53 = p2DEvents_minus1_::30[26 * (unsigned int)ptr_507BC0->ptr_1C]; @@ -1971,7 +1971,7 @@ GameUI_SetFooterString(pTmpBuf.data()); continue; } - pMapNum = pMapStats->GetMapInfo(pCurrentMapName.data()); + pMapNum = pMapStats->GetMapInfo(pCurrentMapName); pMapName = "Not in Map Stats"; if ( pMapNum ) pMapName = pMapStats->pInfos[pMapNum].pName; @@ -2015,11 +2015,11 @@ pAudioPlayer->PlaySound((SoundID)word_4EE088_sound_ids[dword_506338], 0, 0, -1, 0, dword_50633C, 0, 0); if ( bRecallingBeacon ) { - if ( _stricmp(pCurrentMapName.data(), (const char *)&pGames_LOD->pSubIndices[pPlayer9->pInstalledBeacons[uMessageParam].SaveFileID]) ) + if ( _stricmp(pCurrentMapName, (const char *)&pGames_LOD->pSubIndices[pPlayer9->pInstalledBeacons[uMessageParam].SaveFileID]) ) { SaveGame(1, 0); OnMapLeave(); - strcpy(pCurrentMapName.data(), (const char *)&pGames_LOD->pSubIndices[pPlayer9->pInstalledBeacons[uMessageParam].SaveFileID]); + strcpy(pCurrentMapName, (const char *)&pGames_LOD->pSubIndices[pPlayer9->pInstalledBeacons[uMessageParam].SaveFileID]); dword_6BE364_game_settings_1 |= 1; uGameState = GAME_STATE_2; _5B65A8_npcdata_uflags_or_other = pPlayer9->pInstalledBeacons[uMessageParam].PartyPos_X; @@ -2059,7 +2059,7 @@ continue; for ( thisg = 0; thisg < (signed int)pGames_LOD->uNumSubDirs / 2; ++thisg ) { - if ( !_stricmp((const char *)pGames_LOD->pSubIndices[thisg].pFilename, pCurrentMapName.data()) ) + if ( !_stricmp((const char *)pGames_LOD->pSubIndices[thisg].pFilename, pCurrentMapName) ) pPlayer9->pInstalledBeacons[uMessageParam].SaveFileID = thisg; } } @@ -2086,7 +2086,7 @@ { LABEL_486: SaveGame(1, 0); - v64 = pMapStats->GetMapInfo(pCurrentMapName.data()); + v64 = pMapStats->GetMapInfo(pCurrentMapName); v65 = uMessageParam; if ( v64 == TownPortalList[uMessageParam].uMapInfoID ) { @@ -2103,7 +2103,7 @@ OnMapLeave(); dword_6BE364_game_settings_1 |= 1; uGameState = GAME_STATE_2; - strcpy(pCurrentMapName.data(), pMapStats->pInfos[TownPortalList[uMessageParam].uMapInfoID].pFilename); + strcpy(pCurrentMapName, pMapStats->pInfos[TownPortalList[uMessageParam].uMapInfoID].pFilename); dword_5B65C0 = 1; _5B65A8_npcdata_uflags_or_other = TownPortalList[uMessageParam].pos.x; _5B65AC_npcdata_fame_or_other = TownPortalList[uMessageParam].pos.y; @@ -2283,7 +2283,7 @@ while ( (signed int)pNPCData3 < (signed int)pNPCData4 ); if ( (signed int)pNPCData3 < (signed int)pNPCData4 ) { - strcpy(pCurrentMapName.data(), (const char *)&pGames_LOD->pSubIndices[(int)pNPCData3]); + strcpy(pCurrentMapName, (const char *)&pGames_LOD->pSubIndices[(int)pNPCData3]); dword_6BE364_game_settings_1 |= 1u; uGameState = GAME_STATE_2; OnMapLeave(); @@ -2538,7 +2538,7 @@ pParty->pPlayers[2].pConditions[2] = pParty->uTimePlayed; pParty->pPlayers[1].pConditions[2] = pParty->uTimePlayed; pParty->pPlayers[0].pConditions[2] = pParty->uTimePlayed; - v90 = pMapStats->GetMapInfo(pCurrentMapName.data()); + v90 = pMapStats->GetMapInfo(pCurrentMapName); if ( !v90 ) v90 = rand() % (signed int)pMapStats->uNumMaps + 1; pMapInfo = &pMapStats->pInfos[v90];
--- a/mm7_data.cpp Thu Aug 29 22:01:47 2013 +0600 +++ b/mm7_data.cpp Thu Aug 29 22:02:00 2013 +0600 @@ -1015,7 +1015,7 @@ int dword_50CDCC; // weak int bProcessorIsNotIntel; // weak Vec3_int_ layingitem_vel_50FDFC; -std::array<char, 777> pStartingMapName; // idb +char pStartingMapName[32]; // idb std::array<unsigned __int8, 5> IsPlayerWearingWatersuit; std::array<char, 54> party_has_equipment; std::array<char, 16> byte_5111F6; @@ -1214,7 +1214,7 @@ LONG uWindowStyle; // idb HMENU hOSMenu; // idb int dword_6BE340; // weak -std::array<char, 20> pCurrentMapName; // idb +char pCurrentMapName[32]; // idb unsigned int uLevelMapStatsID; int dword_6BE364_game_settings_1 = 0; // weak int dword_6BE368_debug_settings_2 = 0; // weak
--- a/mm7_data.h Thu Aug 29 22:01:47 2013 +0600 +++ b/mm7_data.h Thu Aug 29 22:02:00 2013 +0600 @@ -657,7 +657,7 @@ extern int dword_50CDCC; // weak extern int bProcessorIsNotIntel; // weak extern Vec3_int_ layingitem_vel_50FDFC; -extern std::array<char, 777> pStartingMapName; // idb +extern char pStartingMapName[32]; // idb extern std::array<unsigned __int8, 5> IsPlayerWearingWatersuit; extern std::array<char, 54> party_has_equipment; extern std::array<char, 16> byte_5111F6; @@ -860,7 +860,7 @@ extern LONG uWindowStyle; // idb extern HMENU hOSMenu; // idb extern int dword_6BE340; // weak -extern std::array<char, 20> pCurrentMapName; // idb +extern char pCurrentMapName[32]; // idb extern unsigned int uLevelMapStatsID; extern int dword_6BE364_game_settings_1; // weak extern int dword_6BE368_debug_settings_2; // weak