# HG changeset patch # User Ritor1 # Date 1361563975 -21600 # Node ID 7189d0bddf0774b98766e9aff12cf5094ac15618 # Parent 5fd32833604891c723759a6801817cd150472c46# Parent c3a0d94c07a55a8eeb7e8d66c345597e7f89716a Слияние diff -r 5fd328336048 -r 7189d0bddf07 Actor.cpp --- a/Actor.cpp Sat Feb 23 02:12:36 2013 +0600 +++ b/Actor.cpp Sat Feb 23 02:12:55 2013 +0600 @@ -343,7 +343,7 @@ if ( v2 ) { v1->array_000234[3].uItemID = 197; - v1->array_000234[3].uAdditionalValue = v2; + v1->array_000234[3].uSpecEnchantmentType = v2; } } } diff -r 5fd328336048 -r 7189d0bddf07 AudioPlayer.cpp --- a/AudioPlayer.cpp Sat Feb 23 02:12:36 2013 +0600 +++ b/AudioPlayer.cpp Sat Feb 23 02:12:55 2013 +0600 @@ -1,4 +1,5 @@ #include +#include #include "AudioPlayer.h" #include "Allocator.h" @@ -13,6 +14,8 @@ #include "OSInfo.h" #include "Math.h" #include "MapInfo.h" +#include "Actor.h" +#include "GUIWindow.h" #include "Log.h" #include "Bink_Smacker.h" @@ -602,9 +605,9 @@ v6 = v2->pMixerChannels; do { - if ( v6->dword_000004 == a2 ) + if ( v6->source_pid == a2 ) { - if ( AIL_sample_status(v6->hSample) == 4 ) + if ( AIL_sample_status(v6->hSample) == AIL::Sample::Playing) { AIL_end_sample(v6->hSample); _4ABE55(v6); @@ -620,10 +623,6 @@ } } } -// 4D82F4: using guessed type int __stdcall AIL_3D_sample_status(int); -// 4D82F8: using guessed type int __stdcall AIL_sample_status(int); -// 4D82FC: using guessed type int __stdcall AIL_end_sample(int); -// 4D8300: using guessed type int __stdcall AIL_end_3D_sample(int); //----- (004AA306) -------------------------------------------------------- void AudioPlayer::PlaySound(SoundID eSoundID, signed int a3, unsigned int uNumRepeats, signed int PartyX, signed int PartyY, int a7, unsigned int uVolume, int sPlaybackRate) @@ -780,8 +779,8 @@ pMixerChannel = pAudioPlayer->pMixerChannels; do { - if ( AIL_sample_status(pMixerChannel->hSample) == 4 && pMixerChannel->dword_000004 == a3 - && AIL_sample_status(pMixerChannel->hSample) == 4 ) + if ( AIL_sample_status(pMixerChannel->hSample) == AIL::Sample::Playing && pMixerChannel->source_pid == a3 + && AIL_sample_status(pMixerChannel->hSample) == AIL::Sample::Playing) { if ( pMixerChannel->uSourceTrackIdx == pNum ) return; @@ -801,7 +800,7 @@ if ( varC <= v96 ) { pMixerChannel2 = &pAudioPlayer->pMixerChannels[varC]; - while ( AIL_sample_status(pMixerChannel2->hSample) != 2 ) + while ( AIL_sample_status(pMixerChannel2->hSample) != AIL::Sample::Done) { ++v62; ++pMixerChannel2; @@ -903,7 +902,7 @@ AIL_set_sample_loop_count(pMixerChannel5->hSample, uNumRepeats - 1); v85 = pMixerChannel5->hSample; pMixerChannel5->uSourceTrackIdx = pNum; - pMixerChannel5->dword_000004 = v76; + pMixerChannel5->source_pid = v76; pMixerChannel5->uSourceTrackID = eSoundID; AIL_start_sample(v85); if ( sPlaybackRate ) @@ -1340,13 +1339,13 @@ //----- (004AAFCF) -------------------------------------------------------- -void AudioPlayer::_4AAFCF() +void AudioPlayer::UpdateSounds() { - AudioPlayer *pAudioPlayer; // edi@1 + //AudioPlayer *pAudioPlayer; // edi@1 int v2; // ebx@1 - unsigned __int8 v3; // zf@1 - int *v4; // eax@2 - unsigned __int8 v5; // sf@4 + //unsigned __int8 v3; // zf@1 + //int *v4; // eax@2 + //unsigned __int8 v5; // sf@4 AudioPlayer_3DSample *v6; // esi@5 int v7; // ebx@6 int v8; // ebx@9 @@ -1369,31 +1368,31 @@ int v25; // eax@32 float v26; // ST10_4@34 float v27; // ST08_4@34 - MixerChannel *v28; // esi@38 - unsigned __int8 v29; // of@43 - MixerChannel *v30; // esi@44 - int v31; // eax@45 - LayingItem *v32; // eax@49 - Actor *v33; // edi@50 - int v34; // eax@50 - unsigned int v35; // edx@51 - unsigned int v36; // ecx@51 - LayingItem *v37; // edi@53 + //MixerChannel *v28; // esi@38 + //unsigned __int8 v29; // of@43 + //MixerChannel *v30; // esi@44 + //int v31; // eax@45 + //LayingItem *v32; // eax@49 + //Actor *v33; // edi@50 + //int v34; // eax@50 + //unsigned int v35; // edx@51 + //unsigned int v36; // ecx@51 + //LayingItem *v37; // edi@53 int v38; // eax@53 - BLVDoor *v39; // edi@56 - int v40; // eax@57 - int v41; // eax@60 - MixerChannel *v42; // edi@65 - int v43; // ebx@68 - LevelDecoration *v44; // esi@68 - int v45; // ST1C_4@68 - int v46; // edi@68 - int v47; // eax@68 - DecorationDesc *v48; // edi@69 - __int16 v49; // ax@69 - __int16 v50; // ax@70 + //BLVDoor *v39; // edi@56 + //int v40; // eax@57 + //int v41; // eax@60 + //MixerChannel *v42; // edi@65 + //int v43; // ebx@68 + //LevelDecoration *v44; // esi@68 + //int v45; // ST1C_4@68 + //int v46; // edi@68 + //int v47; // eax@68 + //DecorationDesc *v48; // edi@69 + //__int16 v49; // ax@69 + //__int16 v50; // ax@70 __int16 v51; // ax@71 - __int16 v52; // ax@73 + //__int16 v52; // ax@73 signed int v53; // eax@88 RenderVertexSoft a1; // [sp+24h] [bp-48h]@1 float v55; // [sp+54h] [bp-18h]@22 @@ -1401,27 +1400,32 @@ int uNumRepeats; // [sp+5Ch] [bp-10h]@15 float v58; // [sp+60h] [bp-Ch]@23 int v59; // [sp+64h] [bp-8h]@4 - AudioPlayer *thisa; // [sp+68h] [bp-4h]@1 + //AudioPlayer *thisa; // [sp+68h] [bp-4h]@1 - pAudioPlayer = this; + //pAudioPlayer = this; v2 = 0; - thisa = this; - v3 = this->bPlayerReady == 0; - a1.flt_2C = 0.0; - if ( !v3 ) + //thisa = this; + //v3 = this->bPlayerReady == 0; + //a1.flt_2C = 0.0; + if (!bPlayerReady) + return; + + if (field_2D0_time_left <= pEventTimer->uTimeElapsed) + field_2D0_time_left = 32; + else { - v4 = &this->field_2D0_time_left; - *v4 -= pEventTimer->uTimeElapsed; - if ( this->field_2D0_time_left <= 0 ) - { - v3 = this->b3DSoundInitialized == 0; - *v4 = 32; - if ( !v3 ) + field_2D0_time_left -= pEventTimer->uTimeElapsed; + return; + } + + //v3 = this->b3DSoundInitialized == 0; + if (b3DSoundInitialized) { - v3 = this->uNum3DSamples == 0; - v5 = this->uNum3DSamples < 0; + __debugbreak(); // refactor refactor + //v3 = this->uNum3DSamples == 0; + //v5 = this->uNum3DSamples < 0; v59 = 0; - if ( !(v5 | v3) ) + if (uNum3DSamples > 0) { v6 = this->p3DSamples; while ( 1 ) @@ -1459,6 +1463,7 @@ goto LABEL_37; } } + v9 = v8 - 1; if ( v9 ) { @@ -1561,178 +1566,184 @@ goto LABEL_35; } } + + + + + + + LABEL_37: - if ( pAudioPlayer->uMixerChannels > v2 ) + for (uint i = 0; i < uMixerChannels; ++i) + { + auto channel = pMixerChannels + i; + + AIL_end_sample(channel->hSample); + _4ABE55(channel); + } + + for (uint i = 0; i < uMixerChannels; ++i) + { + auto channel = pMixerChannels + i; + int source_type = channel->source_pid & 7, + source_id = channel->source_pid >> 3; + int source_x, + source_y, + source_z; + + switch (source_type) + { + case 0: + case OBJECT_Player: + continue; + + case OBJECT_BLVDoor: { - v28 = pAudioPlayer->pMixerChannels; - do - { - if ( AIL_sample_status(v28->hSample) == 2 ) - { - AIL_end_sample(v28->hSample); - pAudioPlayer->_4ABE55(v28); - } - ++v2; - ++v28; - } - while ( v2 < pAudioPlayer->uMixerChannels ); - v2 = 0; + assert(uCurrentlyLoadedLevelType == LEVEL_Indoor); + + assert(source_id < pIndoor->uNumDoors); + auto door = pIndoor->pDoors + source_id; + if (!door->uDoorID) + continue; + + source_x = door->pXOffsets[0]; + source_y = door->pYOffsets[0]; + source_z = door->pZOffsets[0]; } - //v29 = __OFSUB__(v1->uMixerChannels, v2); - v29 = pAudioPlayer->uMixerChannels > v2; - v3 = pAudioPlayer->uMixerChannels == v2; - v5 = pAudioPlayer->uMixerChannels - v2 < 0; - v59 = v2; - if ( !((unsigned __int8)(v5 ^ v29) | v3) ) + break; + + case OBJECT_Item: + { + assert(source_id < uNumLayingItems); + auto object = &pLayingItems[source_id]; + + source_x = object->vPosition.x; + source_y = object->vPosition.y; + source_z = object->vPosition.z; + } + break; + + case OBJECT_Decoration: { - v30 = pAudioPlayer->pMixerChannels; - while ( 1 ) - { - v31 = v30->dword_000004; - if ( (v30->dword_000004 & 7) == 1 ) - { - if ( uCurrentlyLoadedLevelType == LEVEL_Indoor ) - { - v39 = &pIndoor->pDoors[v31 >> 3]; - if ( !v39->uDoorID ) - { -LABEL_61: - pAudioPlayer = thisa; - goto LABEL_62; - } - v40 = GetSoundStrengthByDistanceFromParty(*v39->pXOffsets, *v39->pYOffsets, *v39->pZOffsets); - if ( !v40 ) - { -LABEL_58: - AIL_end_sample(v30->hSample); - thisa->_4ABE55(v30); - goto LABEL_61; - } - AIL_set_sample_volume(v30->hSample, v40); - v35 = *v39->pYOffsets; - v36 = *v39->pXOffsets; -LABEL_60: - v41 = sub_4AB66C(v36, v35); - AIL_set_sample_pan(v30->hSample, v41); - goto LABEL_61; - } - } - else - { - if ( (v30->dword_000004 & 7) == 2 ) - { - v32 = &pLayingItems[v31 >> 3]; - goto LABEL_53; - } - if ( (v30->dword_000004 & 7) == 3 ) - { - v33 = &pActors[v31 >> 3]; - v34 = GetSoundStrengthByDistanceFromParty(v33->vPosition.x, v33->vPosition.y, v33->vPosition.z); - if ( !v34 ) - goto LABEL_58; - AIL_set_sample_volume(v30->hSample, v34); - v35 = v33->vPosition.y; - v36 = v33->vPosition.x; - goto LABEL_60; - } - if ( (v30->dword_000004 & 7) == 5 ) - { - v32 = (LayingItem *)&pLevelDecorations[v31 >> 3]; -LABEL_53: - v37 = v32; - v38 = GetSoundStrengthByDistanceFromParty(v32->vPosition.x, v32->vPosition.y, v32->vPosition.z); - if ( !v38 ) - goto LABEL_58; - AIL_set_sample_volume(v30->hSample, v38); - v35 = v37->vPosition.y; - v36 = v37->vPosition.x; - goto LABEL_60; - } - } -LABEL_62: - ++v59; - ++v30; - if ( v59 >= pAudioPlayer->uMixerChannels ) - { - v2 = 0; - break; - } - } + assert(source_id < uNumLevelDecorations); + auto object = (LayingItem *)&pLevelDecorations[source_id]; + + source_x = object->vPosition.x; + source_y = object->vPosition.y; + source_z = object->vPosition.z; + } + break; + + case OBJECT_Actor: + { + assert(source_id < uNumActors); + auto actor = pActors + source_id; + + source_x = actor->vPosition.x; + source_y = actor->vPosition.y; + source_z = actor->vPosition.z; } - if ( pCurrentScreen != v2 ) - { - v42 = &pAudioPlayer->pMixerChannels[4]; - if ( AIL_sample_status(v42->hSample) == 4 ) - AIL_end_sample(v42->hSample); - return; - } - v59 = v2; - if ( _6807E0_num_decorations_with_sounds_6807B8 <= v2 ) - return; - while ( 1 ) - { + break; + + default: + assert(false); + continue; + } + + if (auto sound_strength = GetSoundStrengthByDistanceFromParty(source_x, source_y, source_z)) + { + AIL_set_sample_volume(channel->hSample, sound_strength); + AIL_set_sample_pan(channel->hSample, sub_4AB66C(source_x, source_y)); + } + else + { + AIL_end_sample(channel->hSample); + _4ABE55(channel); + } + } + + + + if (pCurrentScreen != SCREEN_GAME) + { + auto channel = &pMixerChannels[4]; + if (AIL_sample_status(channel->hSample) == AIL::Sample::Playing) + AIL_end_sample(channel->hSample); + return; + } + if (!_6807E0_num_decorations_with_sounds_6807B8) + return; + + v55 = 0; + //v59 = 0; + for (uint i = 0; i < _6807E0_num_decorations_with_sounds_6807B8; ++i) + { + //while ( 1 ) + //{ LODWORD(v56) = 1; - v43 = 4 * v59 + 6817720; - v44 = &pLevelDecorations[_6807B8_level_decorations_ids[v59]]; - v45 = abs(v44->vPosition.z - pParty->vPosition.z); - v46 = abs(v44->vPosition.y - pParty->vPosition.y); - v47 = abs(v44->vPosition.x - pParty->vPosition.x); - if ( int_get_vector_length(v47, v46, v45) <= 8192 ) - break; -LABEL_89: - ++v59; - if ( v59 >= _6807E0_num_decorations_with_sounds_6807B8 ) - return; - } - v48 = &pDecorationList->pDecorations[v44->uDecorationDescID]; - v49 = v48->uFlags; - uNumRepeats = (~(unsigned __int8)v48->uFlags & 0x40) >> 6; - if ( HIBYTE(v49) & 3 ) - { - v50 = v44->field_1A; + //v43 = _6807B8_level_decorations_ids[v59]; + //v44 = &pLevelDecorations[_6807B8_level_decorations_ids[v59]]; + //v45 = abs(v44->vPosition.z - pParty->vPosition.z); + //v46 = abs(v44->vPosition.y - pParty->vPosition.y); + //v47 = abs(v44->vPosition.x - pParty->vPosition.x); + auto decor = &pLevelDecorations[_6807B8_level_decorations_ids[i]]; + if (int_get_vector_length(decor->vPosition.x - pParty->vPosition.x, + decor->vPosition.y - pParty->vPosition.y, + decor->vPosition.z - pParty->vPosition.z) > 8192) + continue; + + auto decor_desc = &pDecorationList->pDecorations[decor->uDecorationDescID]; + //v48 = &pDecorationList->pDecorations[decor->uDecorationDescID]; + //v49 = v48->uFlags; + uNumRepeats = (~(unsigned __int8)decor_desc->uFlags & 0x40) >> 6; + + if (decor_desc->SoundOnDawn() || decor_desc->SoundOnDusk()) + { + //v50 = decor->field_1A; v55 = 0.0; uNumRepeats = 2; - if ( v50 ) + if (decor->field_1A) { - v51 = v50 - 32; - v44->field_1A = v51; + v51 = decor->field_1A - 32; + decor->field_1A = v51; if ( v51 < 0 ) - v44->field_1A = 0; + decor->field_1A = 0; } - } - v52 = v48->uFlags; - if ( !(HIBYTE(v52) & 1) ) - { - if ( !(HIBYTE(v52) & 2) ) - goto LABEL_84; - if ( v55 != 0.0 ) - goto LABEL_85; - } - v56 = 0.0; - if ( pParty->uCurrentHour >= 5 && pParty->uCurrentHour < 6 - || pParty->uCurrentHour >= 0x14 && pParty->uCurrentHour < 0x15 ) - { - if ( !v44->field_1A && rand() % 100 < 100 ) + } + + //v52 = v48->uFlags; + if (!decor_desc->SoundOnDawn()) + { + if (!decor_desc->SoundOnDusk()) + goto LABEL_84; + if ( v55 != 0.0 ) + goto LABEL_85; + } + v56 = 0.0; + + if (pParty->uCurrentHour >= 5 && pParty->uCurrentHour < 6 || + pParty->uCurrentHour >= 20 && pParty->uCurrentHour < 21) + { + if ( !decor->field_1A && rand() % 100 < 100 ) LODWORD(v56) = 1; LODWORD(v55) = 1; - } + } LABEL_84: if ( v55 == 0.0 ) { LABEL_87: if ( v56 != 0.0 ) { - v53 = 8 * *(int *)v43; - LOBYTE(v53) = v53 | 5; - thisa->PlaySound((SoundID)v48->uSoundID, v53, uNumRepeats, -1, 0, 0, 0, 0); + v53 = 8 * _6807B8_level_decorations_ids[i]; + LOBYTE(v53) = v53 | OBJECT_Decoration; + PlaySound((SoundID)decor_desc->uSoundID, v53, uNumRepeats, -1, 0, 0, 0, 0); } - goto LABEL_89; + continue; } LABEL_85: - if ( !v44->field_1A ) - v44->field_1A = (rand() % 15 + 1) << 7; + if ( !decor->field_1A ) + decor->field_1A = (rand() % 15 + 1) << 7; goto LABEL_87; - } } } @@ -1824,7 +1835,7 @@ { AIL_end_sample(pChannel->hSample); _4ABE55(pChannel); - pChannel->dword_000004 = 0; + pChannel->source_pid = 0; } ++v6; ++pChannel; @@ -2188,7 +2199,7 @@ v9 = *(int *)v7; ++v16; v14[v8] = v2; - if ( AIL_sample_status((HSAMPLE)v9) == 4 ) + if ( AIL_sample_status((HSAMPLE)v9) == AIL::Sample::Playing) ++v15; } ++v2; @@ -2218,8 +2229,6 @@ } } } -// 4D82F8: using guessed type int __stdcall AIL_sample_status(int); -// 4ABE55: using guessed type int var_48[16]; diff -r 5fd328336048 -r 7189d0bddf07 AudioPlayer.h --- a/AudioPlayer.h Sat Feb 23 02:12:36 2013 +0600 +++ b/AudioPlayer.h Sat Feb 23 02:12:55 2013 +0600 @@ -56,11 +56,11 @@ struct MixerChannel { inline MixerChannel(): - hSample(nullptr), dword_000004(0), uSourceTrackIdx(0), uSourceTrackID(0) + hSample(nullptr), source_pid(0), uSourceTrackIdx(0), uSourceTrackID(0) {} _SAMPLE *hSample; - int dword_000004; + int source_pid; unsigned int uSourceTrackIdx; unsigned int uSourceTrackID; }; @@ -144,7 +144,7 @@ void SetMasterVolume(float fVolume); void _4AA258(int a2); void PlaySound(SoundID eSoundID, signed int a3, unsigned int uNumRepeats, signed int a5, signed int a6, int a7, unsigned int uVolume, int sPlaybackRate); - void _4AAFCF(); + void UpdateSounds(); void StopChannels(int uStartChannel, int uEndChannel); void LoadAudioSnd(); void Initialize(HWND hWnd); diff -r 5fd328336048 -r 7189d0bddf07 DecorationList.h --- a/DecorationList.h Sat Feb 23 02:12:36 2013 +0600 +++ b/DecorationList.h Sat Feb 23 02:12:55 2013 +0600 @@ -25,6 +25,11 @@ #pragma pack(push, 1) struct DecorationDesc { + inline bool CanMoveThrough() {return uFlags & DECORATION_MOVE_THROUGH;} + inline bool DontDraw() {return uFlags & DECORATION_DONT_DRAW;} + inline bool SoundOnDawn() {return uFlags & DECORATION_SOUND_ON_DAWN;} + inline bool SoundOnDusk() {return uFlags & DECORATION_SOUND_ON_DUSK;} + char pName[32]; char field_20[32]; __int16 uType; diff -r 5fd328336048 -r 7189d0bddf07 Game.cpp --- a/Game.cpp Sat Feb 23 02:12:36 2013 +0600 +++ b/Game.cpp Sat Feb 23 02:12:55 2013 +0600 @@ -328,7 +328,7 @@ v16 = 0; viewparams->bRedrawGameUI = true; } - //pAudioPlayer->_4AAFCF();//Ritor1: it's temporarily, game crash. decorations sounds + pAudioPlayer->UpdateSounds(); if (uGameState == 1) //goto LABEL_96; { diff -r 5fd328336048 -r 7189d0bddf07 GameUIs.cpp --- a/GameUIs.cpp Sat Feb 23 02:12:36 2013 +0600 +++ b/GameUIs.cpp Sat Feb 23 02:12:55 2013 +0600 @@ -87,7 +87,7 @@ //Str1 = (const char *)pSavegameList->pSavesNames; //while ( 1 ) //{ - sprintf(pTmpBuf, "saves\\%s", pSavegameList->pSavesNames[i]); + sprintf(pTmpBuf, "saves\\%s", pSavegameList->pFileList[i].pSaveFileName); if (_access(pTmpBuf, 6)) { pSavegameUsedSlots[i] = 0; @@ -98,13 +98,13 @@ v4 = pLODFile.FindContainer("header.bin", true); if ( v4 ) fread(&pSavegameHeader[i], 0x64, 1, v4); - if ( !_strcmpi(pSavegameList->pSavesNames[i], pGlobalTXT_LocalizationStrings[613]) )// "AutoSave.MM7" + if ( !_strcmpi(pSavegameList->pFileList[i].pSaveFileName, pGlobalTXT_LocalizationStrings[613]) )// "AutoSave.MM7" strcpy(pSavegameHeader[i].pName, pGlobalTXT_LocalizationStrings[16]);// "Autosave" v5 = pLODFile.FindContainer("image.pcx", true); if ( !v5 ) { pSavegameUsedSlots[i] = 0; - strcpy(pSavegameList->pSavesNames[i], ""); + strcpy(pSavegameList->pFileList[i].pSaveFileName, ""); } else { @@ -161,24 +161,16 @@ } //----- (0045E93E) -------------------------------------------------------- -void __cdecl GameUI_DrawSaveMenu() +void GameUI_DrawSaveMenu() { unsigned int v0; // ebp@4 unsigned int v1; // eax@4 - unsigned int *v2; // ebp@6 char *v3; // eax@7 FILE *v4; // eax@11 FILE *v5; // eax@11 - const char *v6; // ST64_4@14 - GUIButton *v7; // eax@16 - char *v8; // [sp+10h] [bp-254h]@6 - SavegameHeader *Dest; // [sp+14h] [bp-250h]@6 - RGBTexture *this_; // [sp+18h] [bp-24Ch]@6 LODWriteableFile v11; // [sp+1Ch] [bp-248h]@1 - int v12; // [sp+260h] [bp-4h]@1 ++pIcons_LOD->uTexturePacksCount; - v12 = 0; if ( !pIcons_LOD->uNumPrevLoadedFiles ) pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles; memset(pSavegameUsedSlots, 0, 0xB4u); @@ -189,9 +181,7 @@ uTextureID_LS_loadU = pIcons_LOD->LoadTexture("LS_loadU", TEXTURE_16BIT_PALETTE); uTextureID_LS_saveU = pIcons_LOD->LoadTexture("LS_saveU", TEXTURE_16BIT_PALETTE); uTextureID_x_u = pIcons_LOD->LoadTexture("x_u", TEXTURE_16BIT_PALETTE); - pRenderer->DrawTextureIndexed( - 8u, - 8u, + pRenderer->DrawTextureIndexed( 8u, 8u, (Texture *)(uTextureID_loadsave != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_loadsave] : 0)); if ( pCurrentScreen == SCREEN_SAVEGAME ) { @@ -204,54 +194,48 @@ v1 = uTextureID_LS_loadU; } pRenderer->DrawTextureIndexed(0xF1u, 0x12Eu, (Texture *)(v1 != -1 ? (int)&pIcons_LOD->pTextures[v1] : 0)); - pRenderer->DrawTextureIndexed( - 0x15Fu, - 0x12Eu, + pRenderer->DrawTextureIndexed(0x15Fu, 0x12Eu, (Texture *)(uTextureID_x_u != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_x_u] : 0)); pRenderer->DrawTextureIndexed(0x12u, 0x8Du, (Texture *)(v0 != -1 ? (int)&pIcons_LOD->pTextures[v0] : 0)); pGUIWindow_CurrentMenu->DrawText(pFontSmallnum, 25, 199, 0, pGlobalTXT_LocalizationStrings[505], 0, 0, 0); pRenderer->Present(); pSavegameList->Initialize(1u); v11.AllocSubIndicesAndIO(0x12Cu, 0); - v2 = pSavegameUsedSlots; - Dest = pSavegameHeader; - this_ = pSavegameThumbnails; - v8 = (char *)pSavegameList->pSavesNames; - do - { - v3 = v8; - if ( !*v8 ) + //v2 = pSavegameUsedSlots; + // Dest = pSavegameHeader; + // this_ = pSavegameThumbnails; + // v8 = (char *)pSavegameList->pSavesNames; + for (uint i = 0; i < 40; ++i) + { + v3 = pSavegameList->pFileList[i].pSaveFileName; + if ( !pSavegameList->pFileList[i].pSaveFileName ) v3 = "1.mm7"; sprintf(pTmpBuf, "saves\\%s", v3); if ( _access(pTmpBuf, 0) || _access(pTmpBuf, 6) ) { - v6 = pGlobalTXT_LocalizationStrings[72]; - *v2 = 0; - strcpy(Dest->pName, v6); + pSavegameUsedSlots[i] = 0; + strcpy(pSavegameHeader[i].pName, pGlobalTXT_LocalizationStrings[LOCSTR_EMPTY]); } else { v11.LoadFile(pTmpBuf, 1); v4 = v11.FindContainer("header.bin", 1); - fread(Dest, 0x64u, 1u, v4); + fread(&pSavegameHeader[i], 100, 1u, v4); v5 = v11.FindContainer("image.pcx", 1); if ( v5 ) { - this_->LoadFromFILE(v5, 0, 1u); + pSavegameThumbnails[i].LoadFromFILE(v5, 0, 1u); v11.CloseWriteFile(); - *v2 = 1; + pSavegameUsedSlots[i] = 1; } else { - *v2 = 0; + pSavegameUsedSlots[i] = 0; } } - v8 += 280; - ++this_; - ++Dest; - ++v2; + } - while ( (signed int)v8 < (signed int)&_69FBB4_ptr_iterator_end ); + v11.FreeSubIndexAndIO(); uTextureID_x_d = pIcons_LOD->LoadTexture("x_d", TEXTURE_16BIT_PALETTE); uTextureID_LS_ = pIcons_LOD->LoadTexture("LS_saveD", TEXTURE_16BIT_PALETTE); @@ -273,5 +257,4 @@ (Texture *)(uTextureID_AR_UP_DN != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_AR_UP_DN] : 0), 0); pBtnDownArrow = pGUIWindow_CurrentMenu->CreateButton( 0xD7u, 0x143u, 0x11u, 0x11u, 1, 0, 0xA3u, 0x22u, 0, "", (Texture *)(uTextureID_AR_DN_DN != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_AR_DN_DN] : 0), 0); - v12 = -1; } \ No newline at end of file diff -r 5fd328336048 -r 7189d0bddf07 Indoor.cpp --- a/Indoor.cpp Sat Feb 23 02:12:36 2013 +0600 +++ b/Indoor.cpp Sat Feb 23 02:12:55 2013 +0600 @@ -4616,7 +4616,7 @@ if ( !(pDecortaion->field_2 & 0x20) ) { v17 = &pDecorationList->pDecorations[pDecortaion->uDecorationDescID]; - if ( !((unsigned __int8)2 & v17->uFlags) ) + if (!v17->DontDraw()) { v18 = v17->uLightRadius; if ( v18 ) @@ -4670,8 +4670,8 @@ if (uItemID) { if (uItemID != 220 && pItemsTable->pItems[uItemID].uEquipType == EQUIP_POTION && - !p->stru_24._bonus_type) - p->stru_24._bonus_type = rand() % 15 + 5; + !p->stru_24.uEncantmentType) + p->stru_24.uEncantmentType = rand() % 15 + 5; pItemsTable->SetSpecialBonus(&p->stru_24); } } diff -r 5fd328336048 -r 7189d0bddf07 Items.cpp --- a/Items.cpp Sat Feb 23 02:12:36 2013 +0600 +++ b/Items.cpp Sat Feb 23 02:12:55 2013 +0600 @@ -77,7 +77,7 @@ *v3 = v5; return v5; } - v8 = v4->uAdditionalValue; + v8 = v4->uSpecEnchantmentType; if ( v8 > 46 ) { v5 = 0; @@ -184,12 +184,12 @@ //----- (00402F07) -------------------------------------------------------- void ItemGen::Reset() { - this->field_1A = 0; + this->uHolderPlayer = 0; this->uAttributes = 0; this->uNumCharges = 0; - this->uAdditionalValue = 0; + this->uSpecEnchantmentType = 0; this->_bonus_strength = 0; - this->_bonus_type = 0; + this->uEncantmentType = 0; this->uItemID = 0; this->uBodyAnchor = 0; this->uExpireTime = 0i64; @@ -205,35 +205,31 @@ { if ( uTimePlayed > (signed __int64)this->uExpireTime ) { - this->_bonus_type = 0; + this->uEncantmentType = 0; LOBYTE(v2) = v2 & 0xF7; - this->uAdditionalValue = 0; + this->uSpecEnchantmentType = 0; this->uAttributes = v2; } } } //----- (0045814E) -------------------------------------------------------- -char *ItemsTable::Release() +void ItemsTable::Release() { - ItemsTable *v1; // edi@1 - char *result; // eax@23 - - v1 = this; if ( pMonstersTXT_Raw ) pAllocator->FreeChunk(pMonstersTXT_Raw); if ( pMonsterPlacementTXT_Raw ) pAllocator->FreeChunk(pMonsterPlacementTXT_Raw); if ( pSkillDescTXT_Raw ) pAllocator->FreeChunk(pSkillDescTXT_Raw); - if ( v1->pSpcItemsTXT_Raw ) - pAllocator->FreeChunk(v1->pSpcItemsTXT_Raw); - if ( v1->pStdItemsTXT_Raw ) - pAllocator->FreeChunk(v1->pStdItemsTXT_Raw); - if ( v1->pRndItemsTXT_Raw ) - pAllocator->FreeChunk(v1->pRndItemsTXT_Raw); - if ( v1->pItemsTXT_Raw ) - pAllocator->FreeChunk(v1->pItemsTXT_Raw); + if (pSpcItemsTXT_Raw ) + pAllocator->FreeChunk(pSpcItemsTXT_Raw); + if ( pStdItemsTXT_Raw ) + pAllocator->FreeChunk(pStdItemsTXT_Raw); + if ( pRndItemsTXT_Raw ) + pAllocator->FreeChunk(pRndItemsTXT_Raw); + if ( pItemsTXT_Raw ) + pAllocator->FreeChunk(pItemsTXT_Raw); if ( pHostileTXT_Raw ) pAllocator->FreeChunk(pHostileTXT_Raw); if ( pHistoryTXT_Raw ) @@ -242,13 +238,12 @@ pAllocator->FreeChunk(pPotionsTXT_Raw); if ( pPotionNotesTXT_Raw ) pAllocator->FreeChunk(pPotionNotesTXT_Raw); - v1->pSpcItemsTXT_Raw = 0; - pSkillDescTXT_Raw = 0; - v1->pStdItemsTXT_Raw = 0; - v1->pRndItemsTXT_Raw = pSkillDescTXT_Raw; - result = pSkillDescTXT_Raw; - v1->pItemsTXT_Raw = pSkillDescTXT_Raw; - return result; + pSpcItemsTXT_Raw = NULL; + pSkillDescTXT_Raw = NULL; + pStdItemsTXT_Raw = NULL; + pRndItemsTXT_Raw = NULL; + pItemsTXT_Raw = NULL; + } @@ -444,8 +439,6 @@ pSpecialEnchantmentsSumm[i]+=pSpecialEnchantments[j].to_item_apply[i]; } - - Initialize2DA(); pItemsTXT_Raw = NULL; @@ -573,7 +566,7 @@ } if ( !_strcmpi(test_string, "sscroll") ) { - pItems[item_counter].uEquipType = 15; + pItems[item_counter].uEquipType = EQUIP_SPELL_SCROLL; break; } if ( !_strcmpi(test_string, "book") ) @@ -583,7 +576,7 @@ } if ( !_strcmpi(test_string, "mscroll") ) { - pItems[item_counter].uEquipType = 17; + pItems[item_counter].uEquipType = EQUIP_MESSAGE_SCROLL; break; } if ( !_strcmpi(test_string, "gold") ) @@ -603,70 +596,70 @@ { if ( !_strcmpi(test_string, "staff") ) { - pItems[item_counter].uSkillType = 0; + pItems[item_counter].uSkillType = PLAYER_SKILL_STAFF; break; } if ( !_strcmpi(test_string, "sword") ) { - pItems[item_counter].uSkillType = 1; + pItems[item_counter].uSkillType = PLAYER_SKILL_SWORD; break; } if ( !_strcmpi(test_string, "dagger") ) { - pItems[item_counter].uSkillType = 2; + pItems[item_counter].uSkillType = PLAYER_SKILL_DAGGER; break; } if ( !_strcmpi(test_string, "axe") ) { - pItems[item_counter].uSkillType = 3; + pItems[item_counter].uSkillType = PLAYER_SKILL_AXE; break; } if ( !_strcmpi(test_string, "spear") ) { - pItems[item_counter].uSkillType = 4; + pItems[item_counter].uSkillType = PLAYER_SKILL_SPEAR; break; } if ( !_strcmpi(test_string, "bow") ) { - pItems[item_counter].uSkillType = 5; + pItems[item_counter].uSkillType = PLAYER_SKILL_BOW; break; } if ( !_strcmpi(test_string, "mace") ) { - pItems[item_counter].uSkillType = 6; + pItems[item_counter].uSkillType = PLAYER_SKILL_MACE; break; } if ( !_strcmpi(test_string, "blaster") ) { - pItems[item_counter].uSkillType = 7; + pItems[item_counter].uSkillType = PLAYER_SKILL_BLASTER; break; } if ( !_strcmpi(test_string, "shield") ) { - pItems[item_counter].uSkillType = 8; + pItems[item_counter].uSkillType = PLAYER_SKILL_SHIELD; break; } if ( !_strcmpi(test_string, "leather") ) { - pItems[item_counter].uSkillType = 9; + pItems[item_counter].uSkillType = PLAYER_SKILL_LEATHER; break; } if ( !_strcmpi(test_string, "chain") ) { - pItems[item_counter].uSkillType = 10; + pItems[item_counter].uSkillType = PLAYER_SKILL_CHAIN; break; } if ( !_strcmpi(test_string, "plate") ) { - pItems[item_counter].uSkillType = 11; + pItems[item_counter].uSkillType = PLAYER_SKILL_PLATE; break; } if ( !_strcmpi(test_string, "club") ) { - pItems[item_counter].uSkillType = 37; + pItems[item_counter].uSkillType = PLAYER_SKILL_CLUB; break; } - pItems[item_counter].uSkillType = 38; + pItems[item_counter].uSkillType = PLAYER_SKILL_ANY; break; } case 6: //Mod1 @@ -705,20 +698,20 @@ { if ( !_strcmpi(test_string, "artifact") ) { - pItems[item_counter].uMaterial = 1; + pItems[item_counter].uMaterial = MATERIAL_ARTEFACT; break; } if ( !_strcmpi(test_string, "relic") ) { - pItems[item_counter].uMaterial = 2; + pItems[item_counter].uMaterial = MATERIAL_RELIC; break; } if ( !_strcmpi(test_string, "special") ) { - pItems[item_counter].uMaterial = 3; + pItems[item_counter].uMaterial = MATERIAL_SPECIAL; break; } - pItems[item_counter].uMaterial = 0; + pItems[item_counter].uMaterial = MATERIAL_COMMON; break;} case 9: //ID/Rep/St pItems[item_counter].uItemID_Rep_St=atoi(test_string); @@ -733,7 +726,7 @@ { pItems[item_counter]._additional_value=0; pItems[item_counter]._bonus_type=0; - if (pItems[item_counter].uMaterial==3) + if (pItems[item_counter].uMaterial==MATERIAL_SPECIAL) { for(int ii=0; ii<24; ++ii) { @@ -758,7 +751,7 @@ break; } case 13: //VarB - if ((pItems[item_counter].uMaterial==3)&&(pItems[item_counter]._bonus_type)) + if ((pItems[item_counter].uMaterial==MATERIAL_SPECIAL)&&(pItems[item_counter]._bonus_type)) { char b_s=atoi(test_string); if (b_s) @@ -1199,25 +1192,25 @@ v2 = &this->pItems[pItem->uItemID]; if ( v2->uMaterial == 3 ) { - pItem->_bonus_type = v2->_bonus_type; - pItem->uAdditionalValue = v2->_additional_value; + pItem->uEncantmentType = v2->_bonus_type; + pItem->uSpecEnchantmentType = v2->_additional_value; pItem->_bonus_strength = v2->_bonus_strength; } } //----- (00456D43) -------------------------------------------------------- -bool ItemsTable::_456D43_is_material_equals_3(ItemGen *pItem) +bool ItemsTable::IsMaterialSpecial(ItemGen *pItem) { - return this->pItems[pItem->uItemID].uMaterial == 3; + return this->pItems[pItem->uItemID].uMaterial == MATERIAL_SPECIAL; } //----- (00456D5E) -------------------------------------------------------- -bool ItemsTable::_456D5E_is_some_material(ItemGen *pItem) +bool ItemsTable::IsMaterialNonCommon(ItemGen *pItem) { unsigned __int8 v2; // al@1 v2 = this->pItems[pItem->uItemID].uMaterial; - return v2 == 3 || v2 == 1 || v2 == 2; + return v2 == MATERIAL_SPECIAL || v2 == MATERIAL_RELIC || v2 == MATERIAL_ARTEFACT; } @@ -1392,14 +1385,14 @@ v1 = this; uBaseValue = pItemsTable->pItems[this->uItemID].uValue; - if ( this->uAttributes & ITEM_TEMP_BONUS || pItemsTable->_456D5E_is_some_material(this) ) + if ( this->uAttributes & ITEM_TEMP_BONUS || pItemsTable->IsMaterialNonCommon(this) ) return uBaseValue; - if ( v1->_bonus_type ) + if ( v1->uEncantmentType ) { v3 = 100 * v1->_bonus_strength; return uBaseValue + v3; } - v4 = v1->uAdditionalValue; + v4 = v1->uSpecEnchantmentType; if ( !v4 ) { result = uBaseValue; @@ -1426,89 +1419,69 @@ //----- (004564B3) -------------------------------------------------------- const char *ItemGen::GetIdentifiedName() { - ItemGen *v1; // esi@1 - unsigned int v2; // eax@1 - unsigned __int8 v3; // cl@1 - char *v4; // edi@4 - char v5; // al@6 - const char *v6; // esi@8 - int v7; // eax@15 - const char *v9; // [sp-Ch] [bp-14h]@14 - const char *v10; // [sp-8h] [bp-10h]@4 - char *v11; // [sp-4h] [bp-Ch]@4 + unsigned __int8 equip_type; + const char *player_name; + const char *nameModificator; + const char *format_str; - v1 = this; - v2 = this->uItemID; - v3 = pItemsTable->pItems[v2].uEquipType; - if ( v3 >= EQUIP_REAGENT && (v3 <= EQUIP_POTION || v3 == EQUIP_GOLD) ) + equip_type = pItemsTable->pItems[uItemID].uEquipType; + if ( (equip_type == EQUIP_REAGENT) || (equip_type == EQUIP_POTION) || (equip_type == EQUIP_GOLD) ) { - v11 = pItemsTable->pItems[v2].pName; - v4 = item__getname_buffer; - v10 = "%s"; - sprintf(v4, v10, v11); - return v4; + sprintf(item__getname_buffer, "%s", pItemsTable->pItems[uItemID].pName); + return item__getname_buffer; } - v4 = item__getname_buffer; - sprintf(item__getname_buffer, "%s", pItemsTable->pItems[v2].pName); - if ( v1->uItemID == 601 ) + sprintf(item__getname_buffer, "%s", pItemsTable->pItems[uItemID].pName); + if ( uItemID == ITEM_LICH_JAR ) //Lich Jar { - v5 = v1->field_1A; - if ( (unsigned __int8)v5 >= 1u ) - { - if ( (unsigned __int8)v5 <= 4u ) + if ( (uHolderPlayer >0 )&& (uHolderPlayer <= 4) ) { - v6 = pPlayers[(unsigned __int8)v5]->pName; - strlen(pPlayers[(unsigned __int8)v5]->pName); - v11 = (char *)v6; - if ( v6[strlen(v6) - 1] == 115 ) - v10 = pGlobalTXT_LocalizationStrings[655]; + player_name = pPlayers[uHolderPlayer]->pName; + strlen(player_name); + if ( player_name[strlen(player_name) - 1] == 's' ) + format_str = pGlobalTXT_LocalizationStrings[655]; //"%s' Jar" else - v10 = pGlobalTXT_LocalizationStrings[654]; - sprintf(v4, v10, v11); - return v4; + format_str = pGlobalTXT_LocalizationStrings[654]; //"%s's Jar" + sprintf(item__getname_buffer, format_str, pPlayers[uHolderPlayer]->pName); + return item__getname_buffer; } - } } - if ( !pItemsTable->_456D5E_is_some_material(v1) ) + if ( !pItemsTable->IsMaterialNonCommon(this) ) { - if ( v1->_bonus_type ) + if ( uEncantmentType ) { strcat(item__getname_buffer, " "); - v9 = (const char *)*((unsigned int *)&pItemsTable->pItems[799].uEquipType + 5 * v1->_bonus_type); + nameModificator = pItemsTable->pEnchantments[uEncantmentType-1].pOfName; } else { - v7 = v1->uAdditionalValue; - if ( !v7 ) - return v4; - if ( v7 == 16 - || v7 == 39 - || v7 == 40 - || v7 == 45 - || v7 == 56 - || v7 == 57 - || v7 == 58 - || v7 == 60 - || v7 == 61 - || v7 == 59 - || v7 == 63 - || v7 == 64 - || v7 == 67 - || v7 == 68 ) - { - sprintf( - item__getname_buffer, - "%s %s", - pItemsTable->pSpecialEnchantments[v7].pBonusStatement, - pItemsTable->pItems[v1->uItemID].pName); - return v4; + if ( !uSpecEnchantmentType ) + return item__getname_buffer; + if ( uSpecEnchantmentType == 16 //Drain Hit Points from target. + || uSpecEnchantmentType == 39 //Double damage vs Demons. + || uSpecEnchantmentType == 40 //Double damage vs Dragons + || uSpecEnchantmentType == 45 //+5 Speed and Accuracy + || uSpecEnchantmentType == 56 //+5 Might and Endurance. + || uSpecEnchantmentType == 57 //+5 Intellect and Personality. + || uSpecEnchantmentType == 58 //Increased Value. + || uSpecEnchantmentType == 60 //+3 Unarmed and Dodging skills + || uSpecEnchantmentType == 61 //+3 Stealing and Disarm skills. + || uSpecEnchantmentType == 59 //Increased Weapon speed. + || uSpecEnchantmentType == 63 //Double Damage vs. Elves. + || uSpecEnchantmentType == 64 //Double Damage vs. Undead. + || uSpecEnchantmentType == 67 //Adds 5 points of Body damage and +2 Disarm skill. + || uSpecEnchantmentType == 68 ) //Adds 6-8 points of Cold damage and +5 Armor Class. + { //enchantment and name positions inverted! + sprintf( item__getname_buffer, "%s %s", + pItemsTable->pSpecialEnchantments[uSpecEnchantmentType-1].pNameAdd, + pItemsTable->pItems[uItemID].pName); + return item__getname_buffer; } strcat(item__getname_buffer, " "); - v9 = pItemsTable->pSpecialEnchantments[v1->uAdditionalValue].pBonusStatement; + nameModificator = pItemsTable->pSpecialEnchantments[uSpecEnchantmentType-1].pNameAdd; } - strcat(item__getname_buffer, v9); + strcat(item__getname_buffer, nameModificator); } - return v4; + return item__getname_buffer; } @@ -1614,7 +1587,7 @@ case 40: requested_equip = EQUIP_RING; break; case 41: requested_equip = EQUIP_AMULET; break; case 42: requested_equip = EQUIP_WAND; break; - case 43: requested_equip = EQUIP_F; break; + case 43: requested_equip = EQUIP_SPELL_SCROLL; break; case 44: requested_equip = EQUIP_POTION; break; case 45: requested_equip = EQUIP_REAGENT; break; case 46: requested_equip = EQUIP_GEM; break; @@ -1673,16 +1646,16 @@ } if (pItems[v4->uItemID].uEquipType == EQUIP_POTION && v4->uItemID != ITEM_POTION_BOTTLE ) { - v4->_bonus_type = 0; + v4->uEncantmentType = 0; v14 = 2; do { - v4->_bonus_type += rand() % 4 + 1; - v15 = v4->_bonus_type; + v4->uEncantmentType += rand() % 4 + 1; + v15 = v4->uEncantmentType; --v14; } while ( v14 ); - v4->_bonus_type = v15 * treasure_level; + v4->uEncantmentType = v15 * treasure_level; } } else @@ -1716,16 +1689,16 @@ v4->uItemID = 1; if (pItems[v4->uItemID].uEquipType == EQUIP_POTION && v4->uItemID != ITEM_POTION_BOTTLE) { - v4->_bonus_type = 0; + v4->uEncantmentType = 0; v19 = 2; do { - v4->_bonus_type += rand() % 4 + 1; - v15 = v4->_bonus_type; + v4->uEncantmentType += rand() % 4 + 1; + v15 = v4->uEncantmentType; --v19; } while ( v19 ); - v4->_bonus_type = v15 * treasure_level; + v4->uEncantmentType = v15 * treasure_level; } } if ( v4->uItemID == ITEM_SPELLBOOK_LIGHT_DIVINE_INTERVENTION @@ -1737,8 +1710,8 @@ v4->uAttributes = 1; if ( pItems[v4->uItemID].uEquipType != EQUIP_POTION ) { - v4->uAdditionalValue = 0; - v4->_bonus_type = 0; + v4->uSpecEnchantmentType = 0; + v4->uEncantmentType = 0; } v20 = pItems[v4->uItemID].uEquipType; if ( v20 <= EQUIP_BOW ) @@ -1774,18 +1747,18 @@ { v26 = rand() % 10;//v5->field_116D8[v5->pItems[v4->uItemID].uEquipType]; v27 = v4->uItemID; - v4->_bonus_type = 0; + v4->uEncantmentType = 0; for ( i = pEnchantments[0].to_item[pItems[v27].uEquipType + 1]; i < v26; - i += pEnchantments[v4->_bonus_type].to_item[pItems[v29].uEquipType + 1] ) + i += pEnchantments[v4->uEncantmentType].to_item[pItems[v29].uEquipType + 1] ) { v29 = v4->uItemID; - ++v4->_bonus_type; + ++v4->uEncantmentType; } - ++v4->_bonus_type; + ++v4->uEncantmentType; v30 = 10;// v5->field_116D8[2 * v54 + 12]; v31 = rand(); - v32 = v4->_bonus_type - 1; + v32 = v4->uEncantmentType - 1; v33 = v31 % 10;//(v5->field_116D8[2 * v54 + 13] - v30 + 1) + v30; v4->_bonus_strength = v33; if ( v32 == 21 || v32 == 22 || v32 == 23 ) @@ -1889,7 +1862,7 @@ while ( a2b < pSpecialEnchantments_count ); } v45 = rand(); - v4->uAdditionalValue = *(uint *)Dst; + v4->uSpecEnchantmentType = *(uint *)Dst; v46 = v45 % v39 + 1; a2c = *((unsigned char *)&uAllItemsCount + 28 * (*(uint *)Dst + 1389) + pItems[v4->uItemID].uEquipType); if ( a2c < v46 ) @@ -1900,13 +1873,13 @@ v49 = (int)(j + 1); v59 = v49; v50 = *(unsigned int *)v49; - v4->uAdditionalValue = v50; + v4->uSpecEnchantmentType = v50; a2c += *((unsigned char *)&uAllItemsCount + 28 * (v50 + 1389) + pItems[v48].uEquipType); if ( a2c >= v46 ) break; } } - ++v4->uAdditionalValue; + ++v4->uSpecEnchantmentType; } //----- (004505CC) -------------------------------------------------------- diff -r 5fd328336048 -r 7189d0bddf07 Items.h --- a/Items.h Sat Feb 23 02:12:36 2013 +0600 +++ b/Items.h Sat Feb 23 02:12:55 2013 +0600 @@ -16,6 +16,14 @@ }; +enum ITEM_MATERIAL + { + MATERIAL_COMMON =0, + MATERIAL_ARTEFACT = 1, + MATERIAL_RELIC = 2, + MATERIAL_SPECIAL = 3 + }; + /* 330 */ enum ITEM_TYPE { @@ -58,6 +66,7 @@ ITEM_ARTIFACT_PUCK = 0x1F4, ITEM_ARTIFACT_SPLITTER = 506,//1FA ITEM_RELIC_MEKORIGS_HAMMER = 0x210, + ITEM_LICH_JAR = 601 }; /* 331 */ @@ -71,19 +80,19 @@ EQUIP_HELMET = 5, EQUIP_BELT = 6, EQUIP_CLOAK = 7, - EQUIP_GAUNTLETS = 0x8, - EQUIP_BOOTS = 0x9, - EQUIP_RING = 10, - EQUIP_AMULET = 11, - EQUIP_WAND = 12, - EQUIP_REAGENT = 13, - EQUIP_POTION = 14, - EQUIP_F = 0xF, - EQUIP_BOOK = 16, - EQUIP_11 = 17, - EQUIP_GOLD = 18, - EQUIP_GEM = 19, - EQUIP_NONE = 20 + EQUIP_GAUNTLETS = 8, + EQUIP_BOOTS = 9, + EQUIP_RING = 10, + EQUIP_AMULET = 11, + EQUIP_WAND = 12, + EQUIP_REAGENT = 13, + EQUIP_POTION = 14, + EQUIP_SPELL_SCROLL = 15, + EQUIP_BOOK = 16, + EQUIP_MESSAGE_SCROLL = 17, + EQUIP_GOLD = 18, + EQUIP_GEM = 19, + EQUIP_NONE = 20 }; @@ -114,14 +123,14 @@ unsigned int uItemID; - int _bonus_type; + int uEncantmentType; int _bonus_strength; - int uAdditionalValue; + int uSpecEnchantmentType; int uNumCharges; unsigned int uAttributes; unsigned __int8 uBodyAnchor; char uMaxCharges; - char field_1A; + char uHolderPlayer; char field_1B; unsigned __int64 uExpireTime; }; @@ -227,9 +236,9 @@ void LoadPotionNotes(); void GenerateItem(int treasure_level, int a3, ItemGen *pItem); void SetSpecialBonus(ItemGen *pItem); - bool _456D43_is_material_equals_3(ItemGen *pItem); - bool _456D5E_is_some_material(ItemGen *pItem); - char *Release(); + bool IsMaterialSpecial(ItemGen *pItem); + bool IsMaterialNonCommon(ItemGen *pItem); + void Release(); int uAllItemsCount; ItemDesc pItems[800]; //4-9604h @@ -266,4 +275,79 @@ extern ItemGen *ptr_50C9A4; -extern struct ItemsTable *pItemsTable; \ No newline at end of file +extern struct ItemsTable *pItemsTable; + +/* ++10 to all Resistances. 1 + +10 to all Seven Statistics. 2 + Explosive Impact! 3 + Adds 3-4 points of Cold damage. 4 + Adds 6-8 points of Cold damage. 5 + Adds 9-12 points of Cold damage. 6 + Adds 2-5 points of Electrical damage. 7 + Adds 4-10 points of Electrical damage. 8 + Adds 6-15 points of Electrical damage. 9 + Adds 1-6 points of Fire damage. 10 + Adds 2-12 points of Fire damage. 11 + Adds 3-18 points of Fire damage. 12 + Adds 5 points of Body damage. 13 + Adds 8 points of Body damage. 14 + Adds 12 points of Body damage. 15 + Drain Hit Points from target. 16 + Increases rate of Recovery. 17 + Wearer resistant to Diseases. 18 + Wearer resistant to Insanity. 19 + Wearer resistant to Paralysis. 20 + Wearer resistant to Poison. 21 + Wearer resistant to Sleep. 22 + Wearer resistant to Stone. 23 + Increased Knockback. 24 + +5 Level. 25 + Increases effect of all Air spells. 26 + Increases effect of all Body spells. 27 + Increases effect of all Dark spells. 28 + Increases effect of all Earth spells. 29 + Increases effect of all Fire spells. 30 + Increases effect of all Light spells. 31 + Increases effect of all Mind spells. 32 + Increases effect of all Spirit spells. 33 + Increases effect of all Water spells. 34 + Increases chance of Disarming. 35 + Half damage from all missile attacks. 36 + Regenerate Hit points over time. 37 + Regenerate Spell points over time. 38 + Double damage vs Demons. 39 + Double damage vs Dragons 40 + Drain Hit Points from target and Increased Weapon speed. 41 + +1 to Seven Stats, HP, SP, Armor, Resistances. 42 + +10 to Endurance, Armor, Hit points. 43 + +10 Hit points and Regenerate Hit points over time. 44 + +5 Speed and Accuracy. 45 + Adds 10-20 points of Fire damage and +25 Might. 46 + +10 Spell points and Regenerate Spell points over time. 47 + +15 Endurance and +5 Armor. 48 + +10 Intellect and Luck. 49 + +30 Fire Resistance and Regenerate Hit points over time. 50 + +10 Spell points, Speed, Intellect. 51 + +10 Endurance and Accuracy. 52 + +10 Might and Personality. 53 + +15 Endurance and Regenerate Hit points over time. 54 + +15 Luck and Regenerate Spell points over time. 55 + +5 Might and Endurance. 56 + +5 Intellect and Personality. 57 + Increased Value. 58 + Increased Weapon speed. 59 + +3 Unarmed and Dodging skills. 60 + +3 Stealing and Disarm skills. 61 + +3 ID Item and ID Monster skills. 62 + Double Damage vs. Elves. 63 + Double Damage vs. Undead. 64 + Double Damage vs. Titans. 65 + Regenerate Spell points and Hit points over time. 66 + Adds 5 points of Body damage and +2 Disarm skill. 67 + Adds 6-8 points of Cold damage and +5 Armor Class. 68 + +20 Air Resistance and Shielding. 69 + +10 Water Resistance and +2 Alchemy skill. 70 + Prevents damage from drowning. 71 + Prevents damage from falling. 72 +*/ \ No newline at end of file diff -r 5fd328336048 -r 7189d0bddf07 NPC.h --- a/NPC.h Sat Feb 23 02:12:36 2013 +0600 +++ b/NPC.h Sat Feb 23 02:12:55 2013 +0600 @@ -1,5 +1,71 @@ #pragma once +/* +enum NPCProffession + { + Smith 1 + Armorer 2 + Alchemist 3 + Scholar 4 + Guide 5 + Tracker 6 + Pathfinder 7 + Sailor 8 + Navigator 9 + Healer 10 + Expert Healer 11 + Master Healer 12 + Teacher 13 + Instructor 14 + Arms Master 15 + Weapons Master 16 + Apprentice 17 + Mystic 18 + Spell Master 19 + Trader 20 + Merchant 21 + Scout 22 + Herbalist 23 + Apothecary 24 + Tinker 25 + Locksmith 26 + Fool 27 + Chimney Sweep 28 + Porter 29 + Quarter Master 30 + Factor 31 + Banker 32 + Cook 33 + Chef 34 + Horseman 35 + Bard 36 + Enchanter 37 + Cartographer 38 + Wind Master 39 + Water Master 40 + Gate Master 41 + Acolyte 42 + Piper 43 + Explorer 44 + Pirate 45 + Squire 46 + Psychic 47 + Gypsy 48 + Diplomat 49 + Duper 50 + Burglar 51 + Fallen Wizard 52 + Acolyte 53 + Initiate 54 + Prelate 55 + Monk 56 + Sage 57 + Hunter 58 + + + }; + */ + struct NPCTopic { @@ -147,8 +213,8 @@ #pragma pack(push, 1) struct NPCGreeting { - char *pGreeting1; - char *pGreeting2; + char *pGreeting1; //at first meet + char *pGreeting2; // at latest meets }; #pragma pack(pop) diff -r 5fd328336048 -r 7189d0bddf07 Party.cpp --- a/Party.cpp Sat Feb 23 02:12:36 2013 +0600 +++ b/Party.cpp Sat Feb 23 02:12:55 2013 +0600 @@ -1061,7 +1061,7 @@ v8 = 138; do { - if ( v7->uItemID == 601 && (unsigned __int8)v7->field_1A== v15 + 1 ) + if ( v7->uItemID == 601 && (unsigned __int8)v7->uHolderPlayer== v15 + 1 ) v14 = 1; ++v7; --v8; diff -r 5fd328336048 -r 7189d0bddf07 Player.cpp --- a/Player.cpp Sat Feb 23 02:12:36 2013 +0600 +++ b/Player.cpp Sat Feb 23 02:12:55 2013 +0600 @@ -2796,7 +2796,7 @@ v12 = pItemsTable->pItems[v8].uDamageMod + v28; if ( !uTargetActorID ) goto LABEL_28; - v13 = v6->uAdditionalValue; + v13 = v6->uSpecEnchantmentType; if ( v13 == 64 || v7 == 507 || v7 == 508 || v7 == 527 ) { v14 = (MONSTER_SUPERTYPE)1; @@ -2867,7 +2867,7 @@ v4 = pItemsTable->pItems[v17].uDamageMod + v29; if ( !uTargetActorID ) goto LABEL_57; - v19 = v15->uAdditionalValue; + v19 = v15->uSpecEnchantmentType; if ( v19 == 64 || v16 == 507 || v16 == 508 || v16 == 527 ) { v20 = (MONSTER_SUPERTYPE)1; @@ -3048,7 +3048,7 @@ v9 = pItemsTable->pItems[v6].uDamageMod + v17; if ( a2 ) { - v10 = v4->uAdditionalValue; + v10 = v4->uSpecEnchantmentType; if ( v10 == 64 ) { v11 = (MONSTER_SUPERTYPE)1; @@ -3371,7 +3371,7 @@ for (uint i = 0; i < 16; ++i) { if (HasItemEquipped((ITEM_EQUIP_TYPE)i) && - pInventoryItems[i].uAdditionalValue == uEnchantment) + pInventoryItems[i].uSpecEnchantmentType == uEnchantment) // *(int *)&this->field_1F6[36 * pEquipment[i] + 6] != uEnchantment) return true; } @@ -3532,9 +3532,9 @@ } if ( pItemsTable->pItems[v5->array_000234[3].uItemID].uEquipType != 18 ) return _steal_perma; - v20 = (int)&v5->array_000234[3].uAdditionalValue; - if ( (signed int)v19 > v5->array_000234[3].uAdditionalValue ) - v19 = v5->array_000234[3].uAdditionalValue; + v20 = (int)&v5->array_000234[3].uSpecEnchantmentType; + if ( (signed int)v19 > v5->array_000234[3].uSpecEnchantmentType ) + v19 = v5->array_000234[3].uSpecEnchantmentType; v21 = *(int *)v20 == v19; *(int *)v20 -= v19; if ( v21 ) @@ -3580,7 +3580,7 @@ if ( pItemsTable->pItems[v17].uEquipType == 14 ) { if ( v16 != 220 ) - v27._bonus_type = 2 * rand() % 4 + 2; + v27.uEncantmentType = 2 * rand() % 4 + 2; } } else @@ -4661,7 +4661,7 @@ if ( (signed int)v3 >= 16 ) return v2; } - if ( a2 != 24 || this->pInventoryItems[v5].uAdditionalValue != 24 ) + if ( a2 != 24 || this->pInventoryItems[v5].uSpecEnchantmentType != 24 ) goto LABEL_11; return 5; } @@ -4900,8 +4900,8 @@ } v63 = (int)((char *)v6 + 36 * v31); attra = (ItemGen *)(v63 + 532); - if ( pItemsTable->_456D5E_is_some_material((ItemGen *)(v63 + 532)) == 1 - && !pItemsTable->_456D43_is_material_equals_3(attra) ) + if ( pItemsTable->IsMaterialNonCommon((ItemGen *)(v63 + 532)) == 1 + && !pItemsTable->IsMaterialSpecial(attra) ) { v34 = attra->uItemID; switch ( attra->uItemID ) @@ -6969,10 +6969,10 @@ switch ( pParty->pPickedItem.uItemID ) { case 0xDEu: - v25 = pParty->pPickedItem._bonus_type + 10; + v25 = pParty->pPickedItem.uEncantmentType + 10; goto LABEL_110; case 0xDFu: - v26 = pParty->pPickedItem._bonus_type + 10; + v26 = pParty->pPickedItem.uEncantmentType + 10; goto LABEL_114; case 0xE0u: LODWORD(v3->pConditions[1]) = 0; @@ -7005,7 +7005,7 @@ v59 = 0; v50 = 5; v46 = 3; - v28 = (signed __int64)((double)(230400 * pParty->pPickedItem._bonus_type) * 0.033333335); + v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEncantmentType) * 0.033333335); v29 = (char *)&v3->pPlayerBuffs[7]; goto LABEL_147; case 0xE5u: @@ -7013,7 +7013,7 @@ v59 = 0; v50 = 5; v46 = 3; - v28 = (signed __int64)((double)(230400 * pParty->pPickedItem._bonus_type) * 0.033333335); + v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEncantmentType) * 0.033333335); v29 = (char *)&v3->pPlayerBuffs[8]; goto LABEL_147; case 0xE6u: @@ -7021,23 +7021,23 @@ v59 = 0; v50 = 5; v46 = 3; - v28 = (signed __int64)((double)(230400 * pParty->pPickedItem._bonus_type) * 0.033333335); + v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEncantmentType) * 0.033333335); v29 = (char *)&v3->pPlayerBuffs[1]; goto LABEL_147; case 0xE7u: v70 = 0; v59 = 0; - v50 = 3 * LOWORD(pParty->pPickedItem._bonus_type); + v50 = 3 * LOWORD(pParty->pPickedItem.uEncantmentType); v46 = 0; - v28 = (signed __int64)((double)(230400 * pParty->pPickedItem._bonus_type) * 0.033333335); + v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEncantmentType) * 0.033333335); v29 = (char *)&v3->pPlayerBuffs[11]; goto LABEL_147; case 0xE8u: v70 = 0; v59 = 0; - v50 = 3 * LOWORD(pParty->pPickedItem._bonus_type); + v50 = 3 * LOWORD(pParty->pPickedItem.uEncantmentType); v46 = 0; - v28 = (signed __int64)((double)(230400 * pParty->pPickedItem._bonus_type) * 0.033333335); + v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEncantmentType) * 0.033333335); v29 = (char *)&v3->pPlayerBuffs[13]; goto LABEL_147; case 0xEAu: @@ -7045,12 +7045,12 @@ v59 = 0; v50 = 5; v46 = 3; - v28 = (signed __int64)((double)(230400 * pParty->pPickedItem._bonus_type) * 0.033333335); + v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEncantmentType) * 0.033333335); v29 = (char *)&v3->pPlayerBuffs[14]; goto LABEL_147; case 0xEBu: v3->pPlayerBuffs[23].Apply( - pParty->uTimePlayed + (signed __int64)((double)(230400 * pParty->pPickedItem._bonus_type) * 0.033333335), + pParty->uTimePlayed + (signed __int64)((double)(230400 * pParty->pPickedItem.uEncantmentType) * 0.033333335), 3u, 5u, 0, @@ -7071,49 +7071,49 @@ case 0xF0u: v70 = 0; v59 = 0; - v50 = 3 * LOWORD(pParty->pPickedItem._bonus_type); + v50 = 3 * LOWORD(pParty->pPickedItem.uEncantmentType); v46 = 0; - v28 = (signed __int64)((double)(230400 * pParty->pPickedItem._bonus_type) * 0.033333335); + v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEncantmentType) * 0.033333335); v29 = (char *)&v3->pPlayerBuffs[19]; goto LABEL_147; case 0xF1u: v70 = 0; v59 = 0; - v50 = 3 * LOWORD(pParty->pPickedItem._bonus_type); + v50 = 3 * LOWORD(pParty->pPickedItem.uEncantmentType); v46 = 0; - v28 = (signed __int64)((double)(230400 * pParty->pPickedItem._bonus_type) * 0.033333335); + v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEncantmentType) * 0.033333335); v29 = (char *)&v3->pPlayerBuffs[17]; goto LABEL_147; case 0xF2u: v70 = 0; v59 = 0; - v50 = 3 * LOWORD(pParty->pPickedItem._bonus_type); + v50 = 3 * LOWORD(pParty->pPickedItem.uEncantmentType); v46 = 0; - v28 = (signed __int64)((double)(230400 * pParty->pPickedItem._bonus_type) * 0.033333335); + v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEncantmentType) * 0.033333335); v29 = (char *)&v3->pPlayerBuffs[20]; goto LABEL_147; case 0xF3u: v70 = 0; v59 = 0; - v50 = 3 * LOWORD(pParty->pPickedItem._bonus_type); + v50 = 3 * LOWORD(pParty->pPickedItem.uEncantmentType); v46 = 0; - v28 = (signed __int64)((double)(230400 * pParty->pPickedItem._bonus_type) * 0.033333335); + v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEncantmentType) * 0.033333335); v29 = (char *)&v3->pPlayerBuffs[16]; goto LABEL_147; case 0xF4u: v70 = 0; v59 = 0; - v50 = 3 * LOWORD(pParty->pPickedItem._bonus_type); + v50 = 3 * LOWORD(pParty->pPickedItem.uEncantmentType); v46 = 0; - v28 = (signed __int64)((double)(230400 * pParty->pPickedItem._bonus_type) * 0.033333335); + v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEncantmentType) * 0.033333335); v29 = (char *)&v3->pPlayerBuffs[21]; goto LABEL_147; case 0xF5u: v70 = 0; v59 = 0; - v50 = 3 * LOWORD(pParty->pPickedItem._bonus_type); + v50 = 3 * LOWORD(pParty->pPickedItem.uEncantmentType); v46 = 0; - v28 = (signed __int64)((double)(230400 * pParty->pPickedItem._bonus_type) * 0.033333335); + v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEncantmentType) * 0.033333335); v29 = (char *)&v3->pPlayerBuffs[15]; goto LABEL_147; case 0xFBu: @@ -7136,12 +7136,12 @@ HIDWORD(v3->pConditions[16]) = v35; goto LABEL_112; case 0xFDu: - v25 = 5 * pParty->pPickedItem._bonus_type; + v25 = 5 * pParty->pPickedItem.uEncantmentType; LABEL_110: v69 = v25; goto LABEL_111; case 0xFEu: - v26 = 5 * pParty->pPickedItem._bonus_type; + v26 = 5 * pParty->pPickedItem.uEncantmentType; LABEL_114: v27 = (char *)&v3->sMana; *(int *)v27 += v26; @@ -7149,57 +7149,57 @@ case 0xFFu: v70 = 0; v59 = 0; - v50 = 3 * LOWORD(pParty->pPickedItem._bonus_type); + v50 = 3 * LOWORD(pParty->pPickedItem.uEncantmentType); v46 = 0; - v28 = (signed __int64)((double)(230400 * pParty->pPickedItem._bonus_type) * 0.033333335); + v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEncantmentType) * 0.033333335); v29 = (char *)&v3->pPlayerBuffs[18]; goto LABEL_147; case 0x100u: v70 = 0; v59 = 0; - v50 = 3 * LOWORD(pParty->pPickedItem._bonus_type); + v50 = 3 * LOWORD(pParty->pPickedItem.uEncantmentType); v46 = 0; - v28 = (signed __int64)((double)(230400 * pParty->pPickedItem._bonus_type) * 0.033333335); + v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEncantmentType) * 0.033333335); v29 = (char *)&v3->pPlayerBuffs[5]; goto LABEL_147; case 0x101u: v70 = 0; v59 = 0; - v50 = 3 * LOWORD(pParty->pPickedItem._bonus_type); + v50 = 3 * LOWORD(pParty->pPickedItem.uEncantmentType); v46 = 0; - v28 = (signed __int64)((double)(230400 * pParty->pPickedItem._bonus_type) * 0.033333335); + v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEncantmentType) * 0.033333335); v29 = (char *)v3->pPlayerBuffs; goto LABEL_147; case 0x102u: v70 = 0; v59 = 0; - v50 = 3 * LOWORD(pParty->pPickedItem._bonus_type); + v50 = 3 * LOWORD(pParty->pPickedItem.uEncantmentType); v46 = 0; - v28 = (signed __int64)((double)(230400 * pParty->pPickedItem._bonus_type) * 0.033333335); + v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEncantmentType) * 0.033333335); v29 = (char *)&v3->pPlayerBuffs[22]; goto LABEL_147; case 0x103u: v70 = 0; v59 = 0; - v50 = 3 * LOWORD(pParty->pPickedItem._bonus_type); + v50 = 3 * LOWORD(pParty->pPickedItem.uEncantmentType); v46 = 0; - v28 = (signed __int64)((double)(230400 * pParty->pPickedItem._bonus_type) * 0.033333335); + v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEncantmentType) * 0.033333335); v29 = (char *)&v3->pPlayerBuffs[3]; goto LABEL_147; case 0x104u: v70 = 0; v59 = 0; - v50 = 3 * LOWORD(pParty->pPickedItem._bonus_type); + v50 = 3 * LOWORD(pParty->pPickedItem.uEncantmentType); v46 = 0; - v28 = (signed __int64)((double)(230400 * pParty->pPickedItem._bonus_type) * 0.033333335); + v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEncantmentType) * 0.033333335); v29 = (char *)&v3->pPlayerBuffs[9]; goto LABEL_147; case 0x105u: v70 = 0; v59 = 0; - v50 = 3 * LOWORD(pParty->pPickedItem._bonus_type); + v50 = 3 * LOWORD(pParty->pPickedItem.uEncantmentType); v46 = 0; - v28 = (signed __int64)((double)(230400 * pParty->pPickedItem._bonus_type) * 0.033333335); + v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEncantmentType) * 0.033333335); v29 = (char *)&v3->pPlayerBuffs[2]; LABEL_147: ((SpellBuff *)v29)->Apply(pParty->uTimePlayed + v28, v46, v50, v59, v70); diff -r 5fd328336048 -r 7189d0bddf07 Player.h --- a/Player.h Sat Feb 23 02:12:36 2013 +0600 +++ b/Player.h Sat Feb 23 02:12:55 2013 +0600 @@ -215,7 +215,8 @@ PLAYER_SKILL_STEALING = 34, PLAYER_SKILL_ALCHEMY = 35, PLAYER_SKILL_LEARNING = 36, - + PLAYER_SKILL_CLUB = 37, + PLAYER_SKILL_ANY = 38, PLAYER_SKILL_INVALID = -1 }; diff -r 5fd328336048 -r 7189d0bddf07 SaveLoad.cpp --- a/SaveLoad.cpp Sat Feb 23 02:12:36 2013 +0600 +++ b/SaveLoad.cpp Sat Feb 23 02:12:55 2013 +0600 @@ -85,7 +85,7 @@ } } - sprintf(pTmpBuf, "saves\\%s", pSavegameList->pSavesNames[uSlot]); + sprintf(pTmpBuf, "saves\\%s", pSavegameList->pFileList[uSlot].pSaveFileName); pNew_LOD->CloseWriteFile(); if (!CopyFileA(pTmpBuf, "data\\new.lod", 0)) @@ -670,14 +670,14 @@ //----- (0045E297) -------------------------------------------------------- void SavegameList::Initialize(unsigned int bHideEmptySlots) { - //memset(pSavegameList, 0, 0x3138); - Reset(); + memset(pSavegameList, 0, 0x3138); + // Reset(); uNumSavegameFiles = 0; _chdir("saves"); { if (!bHideEmptySlots && _access(pGlobalTXT_LocalizationStrings[613], 0) != -1 ) // AutoSave.MM7 - strcpy(pSavesNames[uNumSavegameFiles++], pGlobalTXT_LocalizationStrings[613]); + strcpy(pSavegameList->pFileList[uNumSavegameFiles++].pSaveFileName, pGlobalTXT_LocalizationStrings[613]); for (uint i = 0; i < 40; ++i) { @@ -688,7 +688,7 @@ uint idx = i; if (!bHideEmptySlots) idx = uNumSavegameFiles; - strcpy(pSavesNames[idx], pTmpBuf); + strcpy(pSavegameList->pFileList[idx].pSaveFileName, pTmpBuf); ++uNumSavegameFiles; } diff -r 5fd328336048 -r 7189d0bddf07 SaveLoad.h --- a/SaveLoad.h Sat Feb 23 02:12:36 2013 +0600 +++ b/SaveLoad.h Sat Feb 23 02:12:55 2013 +0600 @@ -1,23 +1,28 @@ #pragma once - +#pragma pack(push, 1) +struct SaveFile_ + { + char field_0[20]; + char pSaveFileName[260]; + }; +#pragma pack(pop) /* 243 */ #pragma pack(push, 1) struct SavegameList { - void Initialize(unsigned int a1); + static void Initialize(unsigned int a1); - inline void Reset() + /*inline void Reset() { for (int i = 0; i < 20; ++i) field_0[i] = 0; for (int i = 0; i < 44; ++i) pSavesNames[i][0] = 0; - } - - char field_0[20]; - char pSavesNames[44][280]; + }*/ + SaveFile_ pFileList[45]; + }; #pragma pack(pop) diff -r 5fd328336048 -r 7189d0bddf07 mm7_1.cpp --- a/mm7_1.cpp Sat Feb 23 02:12:36 2013 +0600 +++ b/mm7_1.cpp Sat Feb 23 02:12:55 2013 +0600 @@ -2362,7 +2362,7 @@ v77 = 0; //a2.y = v8->uAttributes & 2; if (pItemsTable->pItems[v8->uItemID].uEquipType == EQUIP_GOLD) - v77 = v8->uAdditionalValue; + v77 = v8->uSpecEnchantmentType; if ( uActiveCharacter ) { if (!v8->Identified()) @@ -2501,7 +2501,7 @@ //v23 = item_desc->uEquipType; if (item_desc->uEquipType == 14) { - v24 = _this->_bonus_type; + v24 = _this->uEncantmentType; if ( v24 ) goto LABEL_56; LABEL_65: @@ -2531,7 +2531,7 @@ v79.uFrameHeight = v73->uTextureHeight + v81 + 54; if ( (signed int)Str > (signed int)v79.uFrameHeight ) v79.uFrameHeight = (unsigned int)Str; - if ( _this->uAttributes & 8 && (_this->uAdditionalValue || _this->_bonus_type) ) + if ( _this->uAttributes & 8 && (_this->uSpecEnchantmentType || _this->uEncantmentType) ) v79.uFrameHeight += LOBYTE(v82->uFontHeight); v83 = 0; if ( LOBYTE(pFontArrus->uFontHeight) ) @@ -2598,7 +2598,7 @@ } else { - if ( _this->uAttributes & 8 && (_this->uAdditionalValue || _this->_bonus_type) ) + if ( _this->uAttributes & 8 && (_this->uSpecEnchantmentType || _this->uEncantmentType) ) { sub_493F79(&v67, _this->uExpireTime - pParty->uTimePlayed); strcpy(pTmpBuf, "Duration:"); @@ -2667,7 +2667,7 @@ sprintf(a1 + 200, v49, v54, v59); goto LABEL_65; } - v25 = _this->_bonus_type; + v25 = _this->uEncantmentType; if ( v25 ) { v60 = _this->_bonus_strength; @@ -2677,7 +2677,7 @@ } else { - v26 = _this->uAdditionalValue; + v26 = _this->uSpecEnchantmentType; if ( !v26 ) { if ( _this->uNumCharges ) @@ -4749,7 +4749,7 @@ v5 = 5324 * (int)v0 + 36 * v4; if ( pItemsTable->pItems[*(unsigned int *)((char *)&pChests[0].mm7__vector_pItems[0].uItemID + v5)].uEquipType == 18 ) { - party_finds_gold(*(int *)((char *)&pChests[0].mm7__vector_pItems[0].uAdditionalValue + v5), 0); + party_finds_gold(*(int *)((char *)&pChests[0].mm7__vector_pItems[0].uSpecEnchantmentType + v5), 0); viewparams->bRedrawGameUI = 1; } else @@ -5904,7 +5904,7 @@ v23 = pLayingItems[v21].stru_24.uItemID; if ( pItemsTable->pItems[v23].uEquipType == 18 ) { - party_finds_gold(v22->uAdditionalValue, 0); + party_finds_gold(v22->uSpecEnchantmentType, 0); viewparams->bRedrawGameUI = 1; } else diff -r 5fd328336048 -r 7189d0bddf07 mm7_2.cpp --- a/mm7_2.cpp Sat Feb 23 02:12:36 2013 +0600 +++ b/mm7_2.cpp Sat Feb 23 02:12:55 2013 +0600 @@ -7989,7 +7989,7 @@ } a1a.stru_24.SetIdentified(); a1a.uObjectDescID = v18; - a1a.stru_24.uAdditionalValue = v34; + a1a.stru_24.uSpecEnchantmentType = v34; goto LABEL_35; } v14 = rand() % 3001 + 2000; @@ -8147,7 +8147,7 @@ } LABEL_23: v3->SetIdentified(); - v3->uAdditionalValue = v10; + v3->uSpecEnchantmentType = v10; LABEL_25: v11 = v4 - 1; v12 = 0; @@ -8212,7 +8212,7 @@ v14->uItemID = 199; } LABEL_49: - v14->uAdditionalValue = v17; + v14->uSpecEnchantmentType = v17; LABEL_51: v12 = v13 + 1; LABEL_52: @@ -15176,7 +15176,7 @@ v20 = pLayingItems[v18].stru_24.uItemID; if ( pItemsTable->pItems[v20].uEquipType == 18 ) { - party_finds_gold(v19->uAdditionalValue, 0); + party_finds_gold(v19->uSpecEnchantmentType, 0); viewparams->bRedrawGameUI = 1; v21 = v17; } @@ -16583,7 +16583,7 @@ break; case 545: case 550: - if ( v2->stru_24.uItemID != 405 && v2->stru_24.uAdditionalValue != 3 ) + if ( v2->stru_24.uItemID != 405 && v2->stru_24.uSpecEnchantmentType != 3 ) { v14 = v153; v9 = 0; diff -r 5fd328336048 -r 7189d0bddf07 mm7_3.cpp --- a/mm7_3.cpp Sat Feb 23 02:12:36 2013 +0600 +++ b/mm7_3.cpp Sat Feb 23 02:12:55 2013 +0600 @@ -15135,7 +15135,7 @@ } else if (v16 == 20) { - __debugbreak(); // learn conditions of this event + //__debugbreak(); // learn conditions of this event instruments auto topic = pNPCTopics[pNPC->evt_B - 1].pTopic;//(&dword_721660)[8 * v23]; if (!topic) { diff -r 5fd328336048 -r 7189d0bddf07 mm7_4.cpp --- a/mm7_4.cpp Sat Feb 23 02:12:36 2013 +0600 +++ b/mm7_4.cpp Sat Feb 23 02:12:55 2013 +0600 @@ -1165,7 +1165,7 @@ if ( !(v1->field_2 & 0x20) ) { v2 = &pDecorationList->pDecorations[v1->uDecorationDescID]; - if ( !(v2->uFlags & 1) ) + if (!v2->CanMoveThrough()) { v3 = v2->uRadius; v4 = v1->vPosition.x; @@ -1274,7 +1274,7 @@ if ( !(v5->field_2 & 0x20) ) { v6 = &pDecorationList->pDecorations[v5->uDecorationDescID]; - if ( !(v6->uFlags & 1) ) + if (!v6->CanMoveThrough()) { v7 = v6->uRadius; v8 = v5->vPosition.x; @@ -3562,7 +3562,7 @@ } else { - v25 = v21->pInventoryItems[_idx].uAdditionalValue; + v25 = v21->pInventoryItems[_idx].uSpecEnchantmentType; if ( v25 <= 50 ) { if ( v25 != 50 ) @@ -6173,6 +6173,7 @@ pColor2 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xECu, 0xE6u, 0x9Cu); pString = (char *)operator new(2 * pSize); strncpy(pString, ptr, pSize); + pString[pSize]=0; pFontQuick->_44D2FD_prolly_draw_credits_entry(pFontCChar, 0, a4, (signed __int16)pTexture2.uWidth, (signed __int16)pTexture2.uHeight, pColor1, pColor2, pString, pTexture2.pPixels, (signed __int16)pTexture2.uWidth); free(pString); @@ -9340,9 +9341,9 @@ { if ( v7->uItemID == 601 ) { - if ( !v7->field_1A ) + if ( !v7->uHolderPlayer ) v9 = v7; - if ( v7->field_1A == v5 ) + if ( v7->uHolderPlayer == v5 ) v10 = 1; } ++v7; @@ -9361,7 +9362,7 @@ return; } if ( v9 ) - v9->field_1A = v5; + v9->uHolderPlayer = v5; } } // 4F08EC: using guessed type int dword_4F08EC[]; diff -r 5fd328336048 -r 7189d0bddf07 mm7_5.cpp --- a/mm7_5.cpp Sat Feb 23 02:12:36 2013 +0600 +++ b/mm7_5.cpp Sat Feb 23 02:12:55 2013 +0600 @@ -5174,7 +5174,7 @@ v19 = v4->stru_24.uItemID == 0; uDamageAmount = v17; v57 = 0; - if ( !v19 && v4->stru_24.uAdditionalValue == 3 ) + if ( !v19 && v4->stru_24.uSpecEnchantmentType == 3 ) { a2 = 0; v57 = (PlayerEquipment *)1; @@ -15273,7 +15273,7 @@ else { if ( v26 >= 221 && v26 < 271 ) - pItemGen._bonus_type = rand() % 10 + 1; + pItemGen.uEncantmentType = rand() % 10 + 1; } pItemsTable->SetSpecialBonus(&pItemGen); pParty->SetHoldingItem(&pItemGen); @@ -15742,7 +15742,7 @@ v27 = &v0->pInventoryItems[pOut.z]; v28 = v27->uItemID; v51 = pItemsTable->pItems[v27->uItemID].uEquipType; - v29 = (ItemGen *)(1800 * pParty->pPickedItem._bonus_type); + v29 = (ItemGen *)(1800 * pParty->pPickedItem.uEncantmentType); if ( pParty->pPickedItem.uItemID != 233 ) { if ( pParty->pPickedItem.uItemID == 236 ) @@ -15763,15 +15763,15 @@ v33 = v27->uItemID; if ( (signed int)v27->uItemID >= 64 && (signed int)v33 <= 65 || (pOut.y = v27->uAttributes, pOut.y & 2) - || v27->uAdditionalValue - || v27->_bonus_type + || v27->uSpecEnchantmentType + || v27->uEncantmentType || v51 && v51 != 1 && v51 != 2 || (signed int)v33 >= 500 ) goto LABEL_92; v34 = *(int *)&aSbwb00[4 * pParty->pPickedItem.uItemID + 4]; a2.y = (int)v29 << 7; v31 = (double)(signed int)((int)v29 << 7); - v27->uAdditionalValue = v34; + v27->uSpecEnchantmentType = v34; } else { @@ -15779,13 +15779,13 @@ || (v27->UpdateTempBonus(pParty->uTimePlayed), v30 = v27->uItemID, (signed int)v27->uItemID >= 64) && (signed int)v30 <= 65 || (pOut.y = v27->uAttributes, pOut.y & 2) - || v27->uAdditionalValue - || v27->_bonus_type + || v27->uSpecEnchantmentType + || v27->uEncantmentType || v51 && v51 != 1 && v51 != 2 || (signed int)v30 >= 500 ) goto LABEL_92; a2.y = (int)v29 << 7; - v27->uAdditionalValue = 40; + v27->uSpecEnchantmentType = 40; v31 = (double)a2.y; } v32 = pParty->uTimePlayed + (signed int)(signed __int64)(v31 * 0.033333335); @@ -15798,7 +15798,7 @@ dword_50C9A8 = 256; goto LABEL_92; } - v36 = (70.0 - (double)pParty->pPickedItem._bonus_type) * 0.01; + v36 = (70.0 - (double)pParty->pPickedItem.uEncantmentType) * 0.01; if ( v36 < 0.0 ) v36 = 0.0; if ( v51 != 12 ) @@ -15945,8 +15945,8 @@ *(int *)&v0->field_1F5[36 * v19 + 15] = 1; v20 = v47 + 50 * v15; v0->pInventoryItems[pOut.z].uItemID = v51; - v0->pInventoryItems[pOut.z]._bonus_type = (pParty->pPickedItem._bonus_type - + v0->pInventoryItems[pOut.z]._bonus_type) + v0->pInventoryItems[pOut.z].uEncantmentType = (pParty->pPickedItem.uEncantmentType + + v0->pInventoryItems[pOut.z].uEncantmentType) / 2; v0->SetVariable(VAR_AutoNotes, *(short *)&pItemsTable->potion_note[2 * v20 ]);//field_10168 + 388 LABEL_74: @@ -15963,7 +15963,7 @@ if ( *(int *)(a2.y + 532) == 221 ) *(int *)(a2.y + 532) = pParty->pPickedItem.uItemID; else - *(int *)(a2.y + 536) = pParty->pPickedItem._bonus_type; + *(int *)(a2.y + 536) = pParty->pPickedItem.uEncantmentType; v21 = v0->AddItem(0xFFFFFFFFu, 0xDCu); if ( v21 ) *(int *)&v0->field_1F5[36 * v21 + 15] = 1; diff -r 5fd328336048 -r 7189d0bddf07 mm7_6.cpp --- a/mm7_6.cpp Sat Feb 23 02:12:36 2013 +0600 +++ b/mm7_6.cpp Sat Feb 23 02:12:55 2013 +0600 @@ -1402,7 +1402,7 @@ { if ( pItemsTable->pItems[pActor->array_000234[3].uItemID].uEquipType != 18 ) goto LABEL_9; - v14 = pActor->array_000234[3].uAdditionalValue; + v14 = pActor->array_000234[3].uSpecEnchantmentType; pActor->array_000234[3].Reset(); } if ( v14 ) @@ -1432,7 +1432,7 @@ v4 = Dst.uItemID; } if ( pItemsTable->pItems[v5].uEquipType == 14 && v4 != 220 ) - Dst._bonus_type = 2 * rand() % 4 + 2; + Dst.uEncantmentType = 2 * rand() % 4 + 2; pItemsTable->SetSpecialBonus(&Dst); if ( !pParty->AddItem(&Dst) ) pParty->SetHoldingItem(&Dst); @@ -4012,14 +4012,14 @@ { if (!v730c->Broken()) { - if ( v730c->uAdditionalValue == v1 ) + if ( v730c->uSpecEnchantmentType == v1 ) { - if ( v730c->_bonus_type == v1 ) + if ( v730c->uEncantmentType == v1 ) { v68 = BYTE4(v726->pConditions[3]); if ( !v68 || v68 == 1 || v68 == 2 ) { - if ( !pItemsTable->_456D5E_is_some_material(v730c) ) + if ( !pItemsTable->IsMaterialNonCommon(v730c) ) { v69 = v730c; v14 = v731 == 4; @@ -5421,8 +5421,8 @@ { if ( v731 != 4 || (v245 = (int)&v726->pInventoryItems[a2], v246 = *(int *)v245, *(int *)v245 > 134) - || v726->pInventoryItems[a2].uAdditionalValue != v1 - || v726->pInventoryItems[a2]._bonus_type != v1 + || v726->pInventoryItems[a2].uSpecEnchantmentType != v1 + || v726->pInventoryItems[a2].uEncantmentType != v1 || v726->pInventoryItems[a2]._bonus_strength != v1 || (_this = (ItemGen *)((char *)&v726->pInventoryItems[a2] + 20), v726->pInventoryItems[a2].Broken()) ) goto LABEL_616; @@ -5526,8 +5526,8 @@ v290 = v289->uItemID; LODWORD(v725) = (int)(char *)&pItemsTable + 48 * v290 + 4; if ( v290 > 134 - || _this->uAdditionalValue != v1 - || _this->_bonus_type != v1 + || _this->uSpecEnchantmentType != v1 + || _this->uEncantmentType != v1 || _this->_bonus_strength != v1 || (v291 = pItemsTable->pItems[v290].uEquipType) == 0 || v291 == 1 @@ -5579,7 +5579,7 @@ } v302 = rand() % SLODWORD(v725); v303 = v679; - v294->uAdditionalValue = v679; + v294->uSpecEnchantmentType = v679; v304 = pItemsTable->pSpecialEnchantments[v303].to_item_apply[pItemsTable->pItems[v294->uItemID].uEquipType + 4]; v305 = v302 + 1; if ( v304 < v305 ) @@ -5589,26 +5589,26 @@ v307 = (int)(jj + 1); v732 = v307; v308 = *(int *)v307; - v294->uAdditionalValue = v308; + v294->uSpecEnchantmentType = v308; v304 += pItemsTable->pSpecialEnchantments[v308].to_item_apply[pItemsTable->pItems[v294->uItemID].uEquipType + 4]; if ( v304 >= v305 ) break; } } - ++v294->uAdditionalValue; + ++v294->uSpecEnchantmentType; } else { v293 = rand(); v294 = _this; v295 = v293 % 10;// pItemsTable->field_116D8[pItemsTable->pItems[_this->uItemID].uEquipType]; - _this->_bonus_type = 0; + _this->uEncantmentType = 0; for ( kk = pItemsTable->pEnchantments[0].to_item[pItemsTable->pItems[v294->uItemID].uEquipType + 1]; ; - kk += pItemsTable->pEnchantments[v294->_bonus_type].to_item[pItemsTable->pItems[v294->uItemID].uEquipType + kk += pItemsTable->pEnchantments[v294->uEncantmentType].to_item[pItemsTable->pItems[v294->uItemID].uEquipType + 1] ) { - ++v294->_bonus_type; + ++v294->uEncantmentType; if ( kk >= v295 ) break; } @@ -7335,7 +7335,7 @@ || *(int *)(HIDWORD(v733) + 12) != v1 || *(int *)(HIDWORD(v733) + 4) != v1 || (v591 = *(char *)(v732 + 28)) != 0 && v591 != 1 && v591 != 2 - || pItemsTable->_456D5E_is_some_material((ItemGen *)HIDWORD(v733)) ) + || pItemsTable->IsMaterialNonCommon((ItemGen *)HIDWORD(v733)) ) goto LABEL_199; v592 = HIDWORD(v733); v14 = v731 == 4;