Mercurial > mm7
changeset 1483:223605b325b3
Слияние
author | Ritor1 |
---|---|
date | Thu, 29 Aug 2013 12:04:55 +0600 |
parents | cfd99b6177a3 (current diff) 0356a84be1cf (diff) |
children | 62c7f07bc05a |
files | UI/UICharacter.cpp |
diffstat | 96 files changed, 2392 insertions(+), 2445 deletions(-) [+] |
line wrap: on
line diff
--- a/Actor.cpp Thu Aug 29 12:04:33 2013 +0600 +++ b/Actor.cpp Thu Aug 29 12:04:55 2013 +0600 @@ -1955,7 +1955,7 @@ v3 = &pActors[uActorID]; //a2 = edx0; - v4 = v3->pMonsterInfo.uMovementType == 5; + v4 = v3->pMonsterInfo.uMovementType == MONSTER_MOVEMENT_TYPE_STAIONARY; v24 = uActorID; if ( v4 && v3->pMonsterInfo.uAIType == 1 ) { @@ -2084,8 +2084,8 @@ { if ( pParty->uFine ) { - if ( !(unsigned __int16)_449B57_test_bit((unsigned __int8 *)(*ppPlayers)->_guilds_member_bits, 1) ) - _449B7E_toggle_bit((unsigned char *)(*ppPlayers)->_guilds_member_bits, 1, 1u); + if ( !(unsigned __int16)_449B57_test_bit((unsigned __int8 *)(*ppPlayers)->_achieved_awards_bits, 1) ) + _449B7E_toggle_bit((unsigned char *)(*ppPlayers)->_achieved_awards_bits, 1, 1u); } ++ppPlayers; } @@ -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; @@ -2419,7 +2419,7 @@ v3->vVelocity.z = v10; v3->vVelocity.y = v10; v3->vVelocity.x = v10; - if ( sub_42FB5C(v16) ) + if ( _42FB5C_check_spell(v16) ) { v3->uCurrentActionLength = 64; v3->uCurrentActionTime = v10; @@ -2525,7 +2525,7 @@ v3->vVelocity.z = v10; v3->vVelocity.y = v10; v3->vVelocity.x = v10; - if ( sub_42FB5C(v16) ) + if ( _42FB5C_check_spell(v16) ) { v3->uCurrentActionLength = 64; v3->uCurrentActionTime = v10; @@ -2736,8 +2736,8 @@ } //----- (004032B2) -------------------------------------------------------- -void Actor::AI_4032B2(unsigned int a1, unsigned int a2, int a3, int uActionLength) -{ +void Actor::AI_RandomMove( unsigned int uActor_id, unsigned int uTarget_id, int radius, int uActionLength ) + { unsigned int v4; // edi@1 Actor *v5; // esi@1 int v6; // ebx@1 @@ -2757,10 +2757,10 @@ //v14 never filled, maybe it is passed to function but optimized away as local variable - uActorID = a1; - v4 = a1; - v5 = &pActors[a1]; - v16 = a2; + uActorID = uActor_id; + v4 = uActor_id; + v5 = &pActors[uActor_id]; + v16 = uTarget_id; v6 = v5->vInitialPosition.x - v5->vPosition.x; v7 = v5->vInitialPosition.x - v5->vPosition.x; y = v5->vInitialPosition.y - v5->vPosition.y; @@ -2779,13 +2779,11 @@ } if ( pActors[v4].pMonsterInfo.uMovementType == 3 && v19 < 128 ) { - v13 = &v14; - v12 = 256; - Actor::AI_Stand(uActorID, v16, v12, v13); + Actor::AI_Stand(uActorID, uTarget_id, 256, &v14); return; } v15 = (rand() & 0xF) << 12; - v19 += (unsigned __int64)(v15 * (signed __int64)a3) >> 16; + v19 += (unsigned __int64)(v15 * (signed __int64)radius) >> 16; v9 = (stru_5C6E00->uIntegerDoublePi - 1) & stru_5C6E00->Atan2(v6, y); if ( rand() % 100 < 25 ) { @@ -2793,17 +2791,14 @@ return; } v10 = v9 + rand() % 256 - 128; - if ( abs(v10 - v5->uYawAngle) > 256 && !(BYTE2(v5->uAttributes) & 0x20) ) + if ( abs(v10 - v5->uYawAngle) > 256 && !(v5->uAttributes & 0x200000) ) { - v13 = &v14; - v12 = 256; - Actor::AI_Stand(uActorID, v16, v12, v13); + Actor::AI_Stand(uActorID, uTarget_id, 256, &v14); return; } - v11 = v5->uMovementSpeed; v5->uYawAngle = v10; - if ( v11 ) - v5->uCurrentActionLength = 32 * v19 / v11; + if ( v5->uMovementSpeed) + v5->uCurrentActionLength = 32 * v19 / v5->uMovementSpeed; else v5->uCurrentActionLength = 0; v5->uCurrentActionTime = 0; @@ -2858,7 +2853,7 @@ v10 = v5->vPos.z; v4->vInitialPosition.z = v10; LOBYTE(v5) = v5->uAction; - v4->pMonsterInfo.uMovementType = (unsigned __int8)v5; + v4->pMonsterInfo.uMovementType = MONSTER_MOVEMENT_TYPE_STAIONARY; if ( a3 == 1 ) { v4->vPosition.x = v4->vInitialPosition.x; @@ -4002,7 +3997,7 @@ return result; } //----- (00401A91) -------------------------------------------------------- -void __cdecl UpdateActorAI() +void UpdateActorAI() { //unsigned int v0; // esi@4 int v1; // eax@7 @@ -4417,7 +4412,7 @@ { if ( (signed int)v36 >= 10240 ) { - Actor::AI_4032B2(actor_id, target_pid, 1024, 0); + Actor::AI_RandomMove(actor_id, target_pid, 1024, 0); } else { @@ -4433,7 +4428,7 @@ if ( pActor->pMonsterInfo.uAIType == 1 ) { - if ( pActor->pMonsterInfo.uMovementType == 5 ) + if ( pActor->pMonsterInfo.uMovementType == MONSTER_MOVEMENT_TYPE_STAIONARY ) { Actor::AI_Stand(actor_id, target_pid, (signed __int64)((double)(signed int)pActor->pMonsterInfo.uRecoveryTime * 2.133333333333333), &pDir); } @@ -4480,7 +4475,7 @@ { Actor::AI_MissileAttack1(actor_id, target_pid, &pDir); } - else if ( pActor->pMonsterInfo.uMovementType == 5 ) + else if ( pActor->pMonsterInfo.uMovementType == MONSTER_MOVEMENT_TYPE_STAIONARY ) { v47 = (double)(signed int)pActor->pMonsterInfo.uRecoveryTime * 2.133333333333333; v64 = (signed __int64)v47; @@ -4506,7 +4501,7 @@ { if ( v81 >= 1024 ) { - if ( pActor->pMonsterInfo.uMovementType == 5 ) + if ( pActor->pMonsterInfo.uMovementType == MONSTER_MOVEMENT_TYPE_STAIONARY ) { v47 = (double)(signed int)pActor->pMonsterInfo.uRecoveryTime * 2.133333333333333; v64 = (signed __int64)v47; @@ -4518,7 +4513,7 @@ Actor::AI_Pursue3(actor_id, target_pid, 0, &pDir); } } - else if ( pActor->pMonsterInfo.uMovementType == 5 ) + else if ( pActor->pMonsterInfo.uMovementType == MONSTER_MOVEMENT_TYPE_STAIONARY ) { v47 = (double)(signed int)pActor->pMonsterInfo.uRecoveryTime * 2.133333333333333; v64 = (signed __int64)v47; @@ -4562,7 +4557,7 @@ else Actor::AI_SpellAttack2(actor_id, target_pid, &pDir); } - else if ( v80 * 307.2 > (double)v81 || pActor->pMonsterInfo.uMovementType == 5 ) + else if ( v80 * 307.2 > (double)v81 || pActor->pMonsterInfo.uMovementType == MONSTER_MOVEMENT_TYPE_STAIONARY ) { v47 = (double)(signed int)pActor->pMonsterInfo.uRecoveryTime * 2.133333333333333; v64 = (signed __int64)v47; @@ -4580,7 +4575,7 @@ { if ( v81 >= 1024 ) { - if ( pActor->pMonsterInfo.uMovementType == 5 ) + if ( pActor->pMonsterInfo.uMovementType == MONSTER_MOVEMENT_TYPE_STAIONARY ) { v47 = (double)(signed int)pActor->pMonsterInfo.uRecoveryTime * 2.133333333333333; v64 = (signed __int64)v47; @@ -4591,7 +4586,7 @@ Actor::AI_Pursue3(actor_id, target_pid, 256, &pDir); } } - else if ( pActor->pMonsterInfo.uMovementType == 5 ) + else if ( pActor->pMonsterInfo.uMovementType == MONSTER_MOVEMENT_TYPE_STAIONARY ) { v47 = (double)(signed int)pActor->pMonsterInfo.uRecoveryTime * 2.133333333333333; v64 = (signed __int64)v47; @@ -4621,23 +4616,23 @@ if ( pActor->pMonsterInfo.uHostilityType != MonsterInfo::Hostility_Long || !target_pid || v81 >= 5120 || v45 != 1 ) { - if ( !pActor->pMonsterInfo.uMovementType ) + if ( pActor->pMonsterInfo.uMovementType == MONSTER_MOVEMENT_TYPE_SHORT ) { - Actor::AI_4032B2(actor_id, 4, 1024, 0); + Actor::AI_RandomMove(actor_id, 4, 1024, 0); } else if ( pActor->pMonsterInfo.uMovementType == 1 ) { - Actor::AI_4032B2(actor_id, 4, 2560, 0); + Actor::AI_RandomMove(actor_id, 4, 2560, 0); } else if ( pActor->pMonsterInfo.uMovementType == 2 ) { - Actor::AI_4032B2(actor_id, 4, 5120, 0); + Actor::AI_RandomMove(actor_id, 4, 5120, 0); } else if ( pActor->pMonsterInfo.uMovementType == 4 ) { - Actor::AI_4032B2(actor_id, 4, 10240, 0); + Actor::AI_RandomMove(actor_id, 4, 10240, 0); } - else if ( pActor->pMonsterInfo.uMovementType == 5 ) + else if ( pActor->pMonsterInfo.uMovementType == MONSTER_MOVEMENT_TYPE_STAIONARY ) { v57 = Actor::GetDirectionInfo(a1, 4u, &v72, 0); v58 = (double)(signed int)pActor->pMonsterInfo.uRecoveryTime * 2.133333333333333; @@ -4653,7 +4648,7 @@ { if ( v81 >= 1024 ) { - if ( pActor->pMonsterInfo.uMovementType == 5 ) + if ( pActor->pMonsterInfo.uMovementType == MONSTER_MOVEMENT_TYPE_STAIONARY ) { v47 = (double)(signed int)pActor->pMonsterInfo.uRecoveryTime * 2.133333333333333; v64 = (signed __int64)v47; @@ -4664,7 +4659,7 @@ Actor::AI_Pursue3(actor_id, target_pid, 256, &pDir); } } - else if ( pActor->pMonsterInfo.uMovementType == 5 ) + else if ( pActor->pMonsterInfo.uMovementType == MONSTER_MOVEMENT_TYPE_STAIONARY ) { v47 = (double)(signed int)pActor->pMonsterInfo.uRecoveryTime * 2.133333333333333; v64 = (signed __int64)v47; @@ -4690,7 +4685,7 @@ else if ( (signed int)pActor->pMonsterInfo.uRecoveryTime > 0 ) { v47 = (double)(signed int)pActor->pMonsterInfo.uRecoveryTime * 2.133333333333333; - if ( v80 * 307.2 > (double)v81 || pActor->pMonsterInfo.uMovementType == 5 ) + if ( v80 * 307.2 > (double)v81 || pActor->pMonsterInfo.uMovementType == MONSTER_MOVEMENT_TYPE_STAIONARY ) { v64 = (signed __int64)v47; Actor::AI_Stand(actor_id, target_pid, v64, &pDir); @@ -4752,7 +4747,7 @@ return v5; } //----- (00408B54) -------------------------------------------------------- -unsigned int __fastcall SearchActorByID(unsigned int *pTotalActors, unsigned int a2) +unsigned int SearchActorByID(unsigned int *pTotalActors, unsigned int a2) { unsigned int v2; // edi@1 unsigned int *v3; // esi@1 @@ -4775,7 +4770,7 @@ return v5; } //----- (00408AE7) -------------------------------------------------------- -unsigned int __fastcall SearchActorByGroup(unsigned int *pTotalActors, unsigned int uGroup) +unsigned int SearchActorByGroup(unsigned int *pTotalActors, unsigned int uGroup) { unsigned int *v2; // esi@1 signed int v3; // ebx@1 @@ -4814,7 +4809,7 @@ return v9; } //----- (00408A7E) -------------------------------------------------------- -unsigned int __fastcall SearchActorByMonsterID(unsigned int *pTotalActors, int uMonsterID) +unsigned int SearchActorByMonsterID(unsigned int *pTotalActors, int uMonsterID) { unsigned int *v2; // esi@1 signed int v3; // ebx@1 @@ -4853,7 +4848,7 @@ return v9; } //----- (00408A27) -------------------------------------------------------- -unsigned int __thiscall SearchAliveActors(unsigned int *pTotalActors) +unsigned int SearchAliveActors(unsigned int *pTotalActors) { unsigned int *v1; // esi@1 int v2; // eax@1 @@ -4900,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/Actor.h Thu Aug 29 12:04:33 2013 +0600 +++ b/Actor.h Thu Aug 29 12:04:55 2013 +0600 @@ -201,7 +201,7 @@ static void AI_Bored(unsigned int uActorID, unsigned int uObjID, struct AIDirection *a4); static void AI_Stun(unsigned int uActorID, signed int edx0, int arg0); static char __fastcall _4031C1_update_job(unsigned int uActorID, signed int a2, int a3); - static void AI_4032B2(unsigned int a1, unsigned int a2, int a3, int uActionLength); + static void AI_RandomMove(unsigned int uActor_id, unsigned int uTarget_id, int radius, int uActionLength); static void AI_MissileAttack1(unsigned int uActorID, signed int sTargetPid, struct AIDirection *pDir); static void AI_MissileAttack2(unsigned int uActorID, signed int sTargetPid, struct AIDirection *pDir); static void AI_SpellAttack1(unsigned int uActorID, signed int sTargetPid, struct AIDirection *pDir);
--- a/Arcomage.cpp Thu Aug 29 12:04:33 2013 +0600 +++ b/Arcomage.cpp Thu Aug 29 12:04:55 2013 +0600 @@ -58,10 +58,10 @@ void GameResultsApply(); void pPrimaryWindow_draws_text(int a1, const char *pText, POINT *pXY); -void __thiscall am_BeginScene(unsigned __int16 *pPcxPixels, int a2, int a3); // idb +void am_BeginScene(unsigned __int16 *pPcxPixels, int a2, int a3); // idb void __fastcall Blt_Chroma(RECT *pSrcXYZW, POINT *pTargetXY, int a3, int a4); void Blt_Copy(RECT *pSrcRect, POINT *pTargetXY, int a3); -void __cdecl am_EndScene(); +void am_EndScene(); void DrawRect(RECT *pXYZW, unsigned __int16 uColor, char bSolidFill); void SetPixel2sq( POINT *pTargetXY, unsigned __int16 uColor ); void SetPixel(POINT *pTargetXY, unsigned __int16 uColor); @@ -1272,9 +1272,6 @@ GameResultsApply(); if ( byte_4FAA2C ) { - // v2 = retzero_sub_40DFA7((int)dword_4FAA28); - // v1 = 1000; - // dword_4FAA70 = v2 / 1000; dword_4FAA70 = 0; } else @@ -3935,7 +3932,7 @@ for (int i=0; i<4; ++i ) { - v11 = (char *)&pParty->pPlayers[i]._guilds_member_bits; + v11 = (char *)&pParty->pPlayers[i]._achieved_awards_bits; if ( !(unsigned __int16)_449B57_test_bit((unsigned __int8 *)v11, 1) ) _449B7E_toggle_bit((unsigned char *)v11, PLAYER_GUILD_BITS__ARCOMAGE_WIN, 1); @@ -3949,7 +3946,7 @@ { for (int i=0; i<4; ++i ) { - v12 = (char *)&pParty->pPlayers[i]._guilds_member_bits; + v12 = (char *)&pParty->pPlayers[i]._achieved_awards_bits; if ( !(unsigned __int16)_449B57_test_bit((unsigned __int8 *)v12, 1) ) _449B7E_toggle_bit((unsigned char *)v12, PLAYER_GUILD_BITS__ARCOMAGE_LOSE, 1); }
--- a/AudioPlayer.cpp Thu Aug 29 12:04:33 2013 +0600 +++ b/AudioPlayer.cpp Thu Aug 29 12:04:55 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) -------------------------------------------------------- @@ -1308,7 +1324,7 @@ } //----- (0040DEA5) -------------------------------------------------------- -void __cdecl AudioPlayer::MessWithChannels() +void AudioPlayer::MessWithChannels() { pAudioPlayer->StopChannels(-1, -1); } @@ -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 __cdecl 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 12:04:33 2013 +0600 +++ b/AudioPlayer.h Thu Aug 29 12:04:55 2013 +0600 @@ -103,12 +103,16 @@ SOUND_Arcomage_130 = 0x82, SOUND_Arcomage_131 = 0x83, SOUND_Arcomage_WallUpgrade = 0x84, + SOUND_PlayLute = 133, // 85 + SOUND_PlayFaeriePipes = 134, // 86 + SOUND_PlayGryphonheartsTrumpet = 135, // 87 SOUND_GoldReceived = 0xC8, SOUND_203 = 203, SOUND_206 = 206, SOUND_207 = 207, SOUND_OpenChest = 208, SOUND_PlayerCantCastSpell = 0xD1, + SOUND_EatApple = 211, // D3 SOUND_Bell = 0xD9, SOUND_OpenBook = 230, SOUND_CloseBook = 231, @@ -171,7 +175,7 @@ void SetMapEAX(); int _4AC0A2(); void PlayMusicTrack(enum MusicID eTrack); - void __cdecl MessWithChannels(); + void MessWithChannels(); unsigned int bEAXSupported; @@ -249,7 +253,7 @@ char pData[1]; }; -struct SoundDesc +struct SoundDesc_mm6 { inline bool Is3D() {return (uFlags & SOUND_DESC_3D) != 0;} @@ -258,6 +262,10 @@ SOUND_DESC_TYPE eType; int uFlags; SoundData *pSoundData[17]; +}; + +struct SoundDesc: public SoundDesc_mm6 +{ void *p3DSound; int bDecompressed; }; @@ -279,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/CShow.h Thu Aug 29 12:04:33 2013 +0600 +++ b/CShow.h Thu Aug 29 12:04:55 2013 +0600 @@ -52,6 +52,6 @@ void PlayMovie(MovieType eVideo, bool bShowMouseAfterPlayback); - void (__thiscall ***vdestructor_ptr)(CShow *, bool); + void ( ***vdestructor_ptr)(CShow *, bool); }; #pragma pack(pop)*/ \ No newline at end of file
--- a/CastSpellInfo.cpp Thu Aug 29 12:04:33 2013 +0600 +++ b/CastSpellInfo.cpp Thu Aug 29 12:04:55 2013 +0600 @@ -1346,9 +1346,9 @@ else { v155 = stru_5C6E00->Cos(pParty->sRotationY); - uRequiredMana = pParty->vPosition.x + sub_42EBBE(2048, v155); + uRequiredMana = pParty->vPosition.x + fixpoint_sub0(2048, v155); v156 = stru_5C6E00->Sin(pParty->sRotationY); - LODWORD(v727) = pParty->vPosition.y + sub_42EBBE(2048, v156); + LODWORD(v727) = pParty->vPosition.y + fixpoint_sub0(2048, v156); v154 = pParty->vPosition.z; } unsigned __int64 k = 0; @@ -1414,7 +1414,7 @@ } if ( !pPlayer->CanCastSpell(uRequiredMana) ) break; - auto _v726 = sub_46A6AC((int)dword_50BF30.data(), 100, 4096); + auto _v726 = _46A6AC_spell_render((int)dword_50BF30.data(), 100, 4096); v700.z = 0; v700.y = 0; v700.x = 0; @@ -1653,9 +1653,9 @@ else { v212 = stru_5C6E00->Cos(pParty->sRotationY); - LODWORD(v718) = pParty->vPosition.x + sub_42EBBE(2048, v212); + LODWORD(v718) = pParty->vPosition.x + fixpoint_sub0(2048, v212); v213 = stru_5C6E00->Sin(pParty->sRotationY); - v214 = sub_42EBBE(2048, v213); + v214 = fixpoint_sub0(2048, v213); v211 = pParty->vPosition.z; v713 = pParty->vPosition.y + v214; v208 = LODWORD(v725); @@ -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); @@ -2389,7 +2389,7 @@ LODWORD(v733) = 300 * v2 + 180; if ( !pPlayer->CanCastSpell(uRequiredMana) ) break; - auto _v726 = sub_46A6AC((int)dword_50BF30.data(), 100, 4096); + auto _v726 = _46A6AC_spell_render((int)dword_50BF30.data(), 100, 4096); pGame->GetStru6()->FadeScreen__like_Turn_Undead_and_mb_Armageddon(0xFFFFFFu, 0xC0u); ++pSpellSprite.uType; pSpellSprite.stru_24.Reset(); @@ -2859,7 +2859,7 @@ amount = 180 * v2; if ( !pPlayer->CanCastSpell(uRequiredMana) ) break; - auto _v726 = sub_46A6AC((int)dword_50BF30.data(), 100, 4096); + auto _v726 = _46A6AC_spell_render((int)dword_50BF30.data(), 100, 4096); pGame->GetStru6()->FadeScreen__like_Turn_Undead_and_mb_Armageddon(0xA0A0Au, 0xC0u); ++pSpellSprite.uType; pSpellSprite.stru_24.Reset(); @@ -3248,7 +3248,7 @@ break; pGame->GetStru6()->FadeScreen__like_Turn_Undead_and_mb_Armageddon(0xAFF0Au, 0xC0u); - v505 = sub_46A6AC((int)dword_50BF30.data(), 100, 4096); + v505 = _46A6AC_spell_render((int)dword_50BF30.data(), 100, 4096); ++pSpellSprite.uType; //signed int _v733 = v505; v688.x = 0; @@ -3368,7 +3368,7 @@ } if ( !pPlayer->CanCastSpell(uRequiredMana) ) break; - v531 = sub_46A6AC((int)dword_50BF30.data(), 100, 4096); + v531 = _46A6AC_spell_render((int)dword_50BF30.data(), 100, 4096); ++pSpellSprite.uType; v694.x = 0; v694.y = 0; @@ -3905,7 +3905,7 @@ break; pGame->GetIndoorCamera(); v623 = (signed __int64)pGame->pIndoorCameraD3D->GetPickDepth(); - signed int _v733 = sub_46A6AC((int)dword_50BF30.data(), 100, v623); + signed int _v733 = _46A6AC_spell_render((int)dword_50BF30.data(), 100, v623); v707.x = 0; v707.y = 0; v707.z = 0;
--- a/Chest.cpp Thu Aug 29 12:04:33 2013 +0600 +++ b/Chest.cpp Thu Aug 29 12:04:55 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 ) @@ -198,7 +198,7 @@ //----- (0042038D) -------------------------------------------------------- -void __cdecl ChestUI_WritePointedObjectStatusString() +void ChestUI_WritePointedObjectStatusString() { POINT *v0; // esi@2 int v1; // ecx@2 @@ -282,7 +282,7 @@ itemPixelPosY = chest_offs_y + 32 * (item_counter / chestHeghtCells) + ((signed int)(((itemPixelHeght - 14) & 0xFFFFFFE0) + 32- item_texture->uTextureHeight ) /2); pRenderer->DrawTextureTransparent( itemPixelPosX, itemPixelPosY, item_texture); - sub_40F92A(&v16[itemPixelPosX + pSRZBufferLineOffsets[itemPixelPosY]], item_texture, item_counter + 1); + ZBuffer_DoFill2(&v16[itemPixelPosX + pSRZBufferLineOffsets[itemPixelPosY]], item_texture, item_counter + 1); } } pRenderer->DrawTextureIndexed(pBtn_ExitCancel->uX, pBtn_ExitCancel->uY, pIcons_LOD->GetTexture(uExitCancelTextureId)); @@ -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)); } @@ -791,7 +800,7 @@ } // 506128: using guessed type int areWeLoadingTexture; //----- (00420E01) -------------------------------------------------------- -void __cdecl OnChestLeftClick() +void OnChestLeftClick() { int chest_id; // edi@1 POINT *v1; // esi@2
--- a/Chest.h Thu Aug 29 12:04:33 2013 +0600 +++ b/Chest.h Thu Aug 29 12:04:55 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/DecalBuilder.h Thu Aug 29 12:04:33 2013 +0600 +++ b/DecalBuilder.h Thu Aug 29 12:04:55 2013 +0600 @@ -15,14 +15,14 @@ } //----- (0043B54C) -------------------------------------------------------- - //void __thiscall Bloodsplat::vdtor(Bloodsplat *this, char a2) + //void Bloodsplat::vdtor(Bloodsplat *this, char a2) //----- (0043B569) -------------------------------------------------------- virtual ~Bloodsplat() { } - //void (__thiscall ***vdestructor_ptr)(Bloodsplat *, bool); + //void ( ***vdestructor_ptr)(Bloodsplat *, bool); float x; float y; float z; @@ -49,8 +49,8 @@ this->std__vector_pBloodsplats, 40, 64, - (void (__thiscall *)(void *))Bloodsplat::Bloodsplat, - (void (__thiscall *)(void *))Bloodsplat::dtor); + (void ( *)(void *))Bloodsplat::Bloodsplat, + (void ( *)(void *))Bloodsplat::dtor); v1->std__vector_pBloodsplats_size = 0;*/ uNumBloodsplats = 0; } @@ -66,7 +66,7 @@ bool AddBloodsplat(float x, float y, float z, float radius, char r, char g, char b); - //void (__thiscall ***vdestructor_ptr)(BloodsplatContainer *, bool); + //void ( ***vdestructor_ptr)(BloodsplatContainer *, bool); Bloodsplat std__vector_pBloodsplats[64]; unsigned int std__vector_pBloodsplats_size; int uNumBloodsplats; @@ -107,13 +107,13 @@ } //----- (0043B625) -------------------------------------------------------- - //void __thiscall Decal::vdtor(Decal *this, bool a2) + //void Decal::vdtor(Decal *this, bool a2) //----- (0043B641) -------------------------------------------------------- virtual ~Decal() { } - //void (__thiscall ***vdestructor_ptr)(Decal *, bool); + //void ( ***vdestructor_ptr)(Decal *, bool); int uNumVertices; RenderVertexSoft pVertices[64]; __int16 field_C08; @@ -142,8 +142,8 @@ this->std__vector_pDecals, 3104, 1024, - (void (__thiscall *)(void *))Decal::Decal, - (void (__thiscall *)(void *))Decal::dtor);*/ + (void ( *)(void *))Decal::Decal, + (void ( *)(void *))Decal::dtor);*/ v1->std__vector_pDecals_size = 0; v1->field_308008 = 0; v2 = (char *)&v1->pVertices[0].flt_2C; @@ -176,7 +176,7 @@ - //void (__thiscall ***vdestructor_ptr)(DecalBuilder *, bool); + //void ( ***vdestructor_ptr)(DecalBuilder *, bool); Decal std__vector_pDecals[1024]; unsigned int std__vector_pDecals_size; int field_308008;
--- a/DecorationList.cpp Thu Aug 29 12:04:33 2013 +0600 +++ b/DecorationList.cpp Thu Aug 29 12:04:55 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 12:04:33 2013 +0600 +++ b/DecorationList.h Thu Aug 29 12:04:55 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/Events.cpp Thu Aug 29 12:04:33 2013 +0600 +++ b/Events.cpp Thu Aug 29 12:04:55 2013 +0600 @@ -91,7 +91,7 @@ } //----- (00443DA1) -------------------------------------------------------- -void __cdecl Initialize_GlobalEVT() +void Initialize_GlobalEVT() { struct raw_event_header {
--- a/GUIButton.cpp Thu Aug 29 12:04:33 2013 +0600 +++ b/GUIButton.cpp Thu Aug 29 12:04:55 2013 +0600 @@ -77,7 +77,7 @@ struct GUIWindow *pGUIWindow_CurrentMenu; struct GUIWindow *ptr_507BD0; struct GUIWindow *pGUIWindow_Settings; -struct GUIWindow *ptr_507BDC; +struct GUIWindow *pModalWindow; struct GUIWindow *pGUIWindow_EscMessageWindow; struct GUIWindow *pBooksWindow; struct GUIWindow *pGUIWindow2; @@ -182,13 +182,13 @@ pDialogueWindow->CreateButton( 480, 30 * column_pos + 146, 140, 30, 1, 0, UIMSG_SelectShopDialogueOption, control_id, 0, "", 0); } //----- (00419379) -------------------------------------------------------- -void __cdecl sub_419379() +void ReleaseAwardsScrollBar() { GUIButton *pButton; // esi@2 - if ( dword_507CBC ) + if ( awards_scroll_bar_created ) { - dword_507CBC = 0; + awards_scroll_bar_created = false; ptr_507BA4->Release(); pBtn_Up->Release(); pBtn_Down->Release(); @@ -208,13 +208,13 @@ } } //----- (00419220) -------------------------------------------------------- -void __cdecl CreateAwardsScrollBar() +void CreateAwardsScrollBar() { GUIButton *pButton; // eax@2 - if ( !dword_507CBC ) + if ( !awards_scroll_bar_created ) { - dword_507CBC = 1; + awards_scroll_bar_created = 1; for ( pButton = pGUIWindow_CurrentMenu->pControlsHead; pButton; pButton = pButton->pNext ) { if ( pButton->msg == UIMSG_InventoryLeftClick )
--- a/GUIWindow.cpp Thu Aug 29 12:04:33 2013 +0600 +++ b/GUIWindow.cpp Thu Aug 29 12:04:55 2013 +0600 @@ -74,17 +74,6 @@ - -//----- (004141CA) -------------------------------------------------------- -void ModalWindow( const char *pStrHint, int a4 ) - { - pEventTimer->Pause(); - dword_506F0C[0] = pCurrentScreen; - ptr_507BDC = GUIWindow::Create(0, 0, 640, 480, WINDOW_FinalWindow, a4, pStrHint); - pCurrentScreen = SCREEN_PRESS_ESCAPE_MESSAGE; -} -// 4E28F8: using guessed type int pCurrentScreen; - // inlined //----- (mm6c::00420520) -------------------------------------------------- void GUIMessageQueue::Flush() @@ -293,7 +282,7 @@ { pIcons_LOD->SyncLoadedFilesCount(); pCurrentScreen = pMainScreenNum; - pKeyActionMap->SetWindowInputStatus(3); + pKeyActionMap->SetWindowInputStatus(WINDOW_INPUT_CANCELLED); break; } case WINDOW_HouseInterior: @@ -1827,7 +1816,7 @@ dialog_menu_id = HOUSE_DIALOGUE_OTHER; } //----- (0044603D) -------------------------------------------------------- -void __cdecl DialogueEnding() +void DialogueEnding() { sDialogue_SpeakingActorNPC_ID = 0; pDialogueWindow->Release(); @@ -1984,9 +1973,9 @@ pRenderer->DrawTextureTransparent(pBtn_ExitCancel->uX, pBtn_ExitCancel->uY, pIcons_LOD->GetTexture(uTextureID_x_x_u)); continue; } - case WINDOW_FinalWindow: + case WINDOW_ModalWindow: { - sub_41420D_press_esc(); + ModalWindow_ShowHint(); continue; } case WINDOW_50: @@ -2278,12 +2267,27 @@ Dst.uFrameW = Dst.uFrameY + Dst.uFrameHeight - 1; Dst.DrawTitleText(pFontSmallnum, 0, 0xCu, ui_mainmenu_copyright_color, pGlobalTXT_LocalizationStrings[157], 3); } + + + + +int modal_window_prev_screen; + +//----- (004141CA) -------------------------------------------------------- +void ModalWindow(const char *pStrHint, UIMessageType OnRelease_message) +{ + pEventTimer->Pause(); + modal_window_prev_screen = pCurrentScreen; + pModalWindow = GUIWindow::Create(0, 0, 640, 480, WINDOW_ModalWindow, OnRelease_message, pStrHint); + pCurrentScreen = SCREEN_MODAL_WINDOW; +} + //----- (0041420D) -------------------------------------------------------- -void __cdecl sub_41420D_press_esc() +void ModalWindow_ShowHint() { GUIWindow pWindow; // [sp+4h] [bp-54h]@1 - sprintf(pTmpBuf2.data(), "%s\n \n%s", ptr_507BDC->Hint, pGlobalTXT_LocalizationStrings[61]);// Press Escape + sprintf(pTmpBuf2.data(), "%s\n \n%s", pModalWindow->Hint, pGlobalTXT_LocalizationStrings[61]);// Press Escape pWindow.Hint = pTmpBuf2.data(); pWindow.uFrameWidth = 400; pWindow.uFrameHeight = 100; @@ -2295,16 +2299,14 @@ } //----- (0041426F) -------------------------------------------------------- -void __cdecl sub_41426F() +void ModalWindow_Release() { - GUIWindow *pWindow; // ecx@1 + pMessageQueue_50CBD0->AddMessage((UIMessageType)pModalWindow->par1C, 0, 0); - pWindow = ptr_507BDC; - pMessageQueue_50CBD0->AddMessage((UIMessageType)ptr_507BDC->par1C, 0, 0); + pModalWindow->Release(); + pModalWindow = nullptr; - pWindow->Release(); - ptr_507BDC = 0; - pCurrentScreen = dword_506F0C[0]; + pCurrentScreen = modal_window_prev_screen; pEventTimer->Resume(); } @@ -2369,7 +2371,7 @@ } } //----- (00467F9F) -------------------------------------------------------- -void __cdecl free_book_subwindow() +void free_book_subwindow() { if ( pGUIWindow_ScrollWindow ) {
--- a/GUIWindow.h Thu Aug 29 12:04:33 2013 +0600 +++ b/GUIWindow.h Thu Aug 29 12:04:55 2013 +0600 @@ -158,7 +158,7 @@ UIMSG_C2 = 192, UIMSG_OnCastTownPortal = 195, - UIMSG_C4 = 196, + UIMSG_OnFinalWindowClose = 196, UIMSG_ShowFinalWindow = 197, UIMSG_C6 = 198, UIMSG_C7 = 199, @@ -222,7 +222,7 @@ MENU_NAMEPANELESC = 7, MENU_CREDITSPROC = 8, MENU_LoadingProcInMainMenu = 9, - MENU_10 = 10, + MENU_DebugBLVLevel = 10, MENU_CREDITSCLOSE = 11, }; @@ -276,7 +276,7 @@ WINDOW_CastSpell = 27, WINDOW_Scroll = 0x1E, WINDOW_CastSpell_InInventory = 31, - WINDOW_FinalWindow = 70, + WINDOW_ModalWindow = 70, WINDOW_50 = 80, WINDOW_59 = 89, WINDOW_PressedButton2 = 90, @@ -398,7 +398,7 @@ SCREEN_INPUT_BLV = 0x12, SCREEN_BRANCHLESS_NPC_DIALOG = 0x13, SCREEN_PARTY_CREATION = 0x15, - SCREEN_PRESS_ESCAPE_MESSAGE = 0x16, + SCREEN_MODAL_WINDOW = 0x16, SCREEN_CASTING = 0x17, SCREEN_19 = 0x19, SCREEN_KEYBOARD_OPTIONS = 0x1A, @@ -464,7 +464,9 @@ -void ModalWindow(const char *pStrHint, int a4); +void ModalWindow(const char *pStrHint, UIMessageType OnRelease_message); +void ModalWindow_ShowHint(); +void ModalWindow_Release(); @@ -549,7 +551,7 @@ void InitializeBookTextures(); void InitializeBookFonts(); void DrawSpellBookContent(Player *player); -unsigned int __cdecl DrawLloydBeaconsScreen(); +unsigned int DrawLloydBeaconsScreen(); void BookUI_DrawTownPortalMap(); void LoadSpellbook(unsigned int uID); // idb void DrawSpellDescriptionPopup(int spell_index); @@ -575,6 +577,15 @@ +void __fastcall DrawPopupWindow(unsigned int uX, unsigned int uY, unsigned int uWidth, unsigned int uHeight); // idb +void DrawCopyrightWindow(); +void LoadFonts_and_DrawCopyrightWindow(); +void GUI_UpdateWindows(); +int GetConditionDrawColor(unsigned int uConditionIdx); // idb +void FillAwardsData(); +void CreateAwardsScrollBar(); +void ReleaseAwardsScrollBar(); + @@ -693,7 +704,7 @@ extern struct GUIWindow *pGUIWindow_CurrentMenu; extern struct GUIWindow *ptr_507BD0; extern struct GUIWindow *pGUIWindow_Settings; -extern struct GUIWindow *ptr_507BDC; +extern struct GUIWindow *pModalWindow; extern struct GUIWindow *pGUIWindow_EscMessageWindow; extern struct GUIWindow *pBooksWindow; extern struct GUIWindow *pGUIWindow2; @@ -738,6 +749,10 @@ extern unsigned int ui_character_skillinfo_can_learn; extern unsigned int ui_character_skillinfo_can_learn_gm; extern unsigned int ui_character_skillinfo_cant_learn; +extern unsigned int ui_character_condition_normal_color; +extern unsigned int ui_character_condition_light_color; +extern unsigned int ui_character_condition_moderate_color; +extern unsigned int ui_character_condition_severe_color; extern std::array<unsigned int, 6> ui_character_award_color; extern unsigned int ui_game_minimap_outline_color; extern unsigned int ui_game_minimap_actor_friendly_color;
--- a/Game.cpp Thu Aug 29 12:04:33 2013 +0600 +++ b/Game.cpp Thu Aug 29 12:04:55 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/Game.h Thu Aug 29 12:04:33 2013 +0600 +++ b/Game.h Thu Aug 29 12:04:55 2013 +0600 @@ -119,7 +119,7 @@ struct IndoorCameraD3D *GetIndoorCamera() {return this->pIndoorCameraD3D;} - //void (__thiscall ***vdestructor_ptr)(Game *, bool); + //void ( ***vdestructor_ptr)(Game *, bool); Game__StationaryLight pStationaryLights[25]; char field_2C0[1092]; unsigned int uNumStationaryLights;
--- a/GammaControl.h Thu Aug 29 12:04:33 2013 +0600 +++ b/GammaControl.h Thu Aug 29 12:04:55 2013 +0600 @@ -23,7 +23,7 @@ - void (__thiscall ***vdestructor_ptr)(GammaController *, bool); + void ( ***vdestructor_ptr)(GammaController *, bool); IDirectDrawSurface4 *pSurface; IDirectDrawGammaControl *pGammaControl; DDGAMMARAMP pDefaultRamp;
--- a/IconFrameTable.cpp Thu Aug 29 12:04:33 2013 +0600 +++ b/IconFrameTable.cpp Thu Aug 29 12:04:55 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 12:04:33 2013 +0600 +++ b/IconFrameTable.h Thu Aug 29 12:04:55 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 12:04:33 2013 +0600 +++ b/Indoor.cpp Thu Aug 29 12:04:55 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; @@ -2739,7 +2739,7 @@ //----- (0046F228) -------------------------------------------------------- -void __cdecl BLV_UpdateDoors() +void BLV_UpdateDoors() { //int v0; // ebx@1 //int v1; // edi@1 @@ -3162,7 +3162,7 @@ // 6BE13C: using guessed type int dword_6BE13C_uCurrentlyLoadedLocationID; //----- (0046F90C) -------------------------------------------------------- -void __cdecl UpdateActors_BLV() +void UpdateActors_BLV() { Actor *v0; // esi@2 unsigned __int16 v1; // ax@2 @@ -3637,7 +3637,7 @@ //----- (00460A78) -------------------------------------------------------- -void __thiscall PrepareToLoadBLV(unsigned int bLoading) +void PrepareToLoadBLV(unsigned int bLoading) { unsigned int v1; // ebx@1 unsigned int v2; // eax@8 @@ -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) @@ -4241,7 +4240,7 @@ return result; } //----- (004016FA) -------------------------------------------------------- -int __cdecl MakeActorAIList_BLV() +int MakeActorAIList_BLV() { Actor *v0; // esi@2 int v1; // eax@4 @@ -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; @@ -5441,6 +5440,8 @@ int v_4c; // [sp+8Ch] [bp+10h]@141 int v_8; // [sp+90h] [bp+14h]@53 + __debugbreak(); + a4 = __PAIR__(z, x); v4 = stru_5C6E00->Atan2(v.x - x, v.y - z); v114 = 0; @@ -6209,7 +6210,7 @@ return 0; } //----- (0046BDF1) -------------------------------------------------------- -void __cdecl BLV_UpdateUserInputAndOther() +void BLV_UpdateUserInputAndOther() { UpdateObjects(); BLV_ProcessPartyActions();
--- a/Indoor.h Thu Aug 29 12:04:33 2013 +0600 +++ b/Indoor.h Thu Aug 29 12:04:55 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/IndoorCameraD3D.cpp Thu Aug 29 12:04:33 2013 +0600 +++ b/IndoorCameraD3D.cpp Thu Aug 29 12:04:55 2013 +0600 @@ -29,8 +29,8 @@ /*_eh_vector_constructor_iterator_(v1->std__vector_000034_prolly_frustrum, 24, 6, - (void (__thiscall *)(void *))IndoorCameraD3D_Vec4::IndoorCameraD3D_Vec4, - (void (__thiscall *)(void *))IndoorCameraD3D_Vec4::dtor);*/ + (void ( *)(void *))IndoorCameraD3D_Vec4::IndoorCameraD3D_Vec4, + (void ( *)(void *))IndoorCameraD3D_Vec4::dtor);*/ //v2 = 0;//(double)pBLVRenderParams->vPartyPos.z; //v3 = 0;//(double)pBLVRenderParams->vPartyPos.y; //v4 = 0;//(double)pBLVRenderParams->vPartyPos.x; @@ -87,7 +87,7 @@ // v10->mm7__vector_000004, // 48, // 64, - // (int (__thiscall *)(int))IndoorCameraD3D_stru1::IndoorCameraD3D_stru1); + // (int ( *)(int))IndoorCameraD3D_stru1::IndoorCameraD3D_stru1); //++v10; --v12; }
--- a/IndoorCameraD3D.h Thu Aug 29 12:04:33 2013 +0600 +++ b/IndoorCameraD3D.h Thu Aug 29 12:04:55 2013 +0600 @@ -14,7 +14,7 @@ //----- (004C039C) -------------------------------------------------------- //void ~IndoorCameraD3D_Vec3() {} - //void (__thiscall ***vdestructor_ptr)(IndoorCameraD3D_Vec3 *, bool); + //void ( ***vdestructor_ptr)(IndoorCameraD3D_Vec3 *, bool); union { @@ -161,7 +161,7 @@ void DebugDrawPortal(struct BLVFace *pFace); - //void (__thiscall ***vdestructor_ptr)(IndoorCameraD3D *, bool); + //void ( ***vdestructor_ptr)(IndoorCameraD3D *, bool); IndoorCameraD3D_Vec3 field_4[3]; //IndoorCameraD3D_Vec3 field_14; //IndoorCameraD3D_Vec3 field_24;
--- a/Indoor_stuff.h Thu Aug 29 12:04:33 2013 +0600 +++ b/Indoor_stuff.h Thu Aug 29 12:04:55 2013 +0600 @@ -33,8 +33,8 @@ inline BspRenderer_stru0() { //_eh_vector_constructor_iterator_(std__vector_0007AC, 24, 4, - // (void (__thiscall *)(void *))IndoorCameraD3D_Vec4::IndoorCameraD3D_Vec4, - // (void (__thiscall *)(void *))IndoorCameraD3D_Vec4::dtor); + // (void ( *)(void *))IndoorCameraD3D_Vec4::IndoorCameraD3D_Vec4, + // (void ( *)(void *))IndoorCameraD3D_Vec4::dtor); //for (int i = 0; i < 4; ++i) // pVertices[i].flt_2C = 0.0f; } @@ -80,8 +80,8 @@ inline BspRenderer() { // _eh_vector_constructor_iterator_(field_FA8, 2252, 150, - // (void (__thiscall *)(void *))stru170_stru0::stru170_stru0, - // (void (__thiscall *)(void *))stru170_stru0::dtor); + // (void ( *)(void *))stru170_stru0::stru170_stru0, + // (void ( *)(void *))stru170_stru0::dtor); num_faces = 0; num_nodes = 0; uNumVisibleNotEmptySectors = 0; @@ -355,7 +355,7 @@ void GetFacePlane(struct ODMFace *pFace, struct BSPVertexBuffer *pVertices, struct Vec3_float_ *pOutNormal, float *pOutDist); - void (__thiscall ***vdestructor_ptr)(stru154 *, bool); + void ( ***vdestructor_ptr)(stru154 *, bool); Plane_float_ face_plane; PolygonType polygonType; char field_15;
--- a/Items.cpp Thu Aug 29 12:04:33 2013 +0600 +++ b/Items.cpp Thu Aug 29 12:04:55 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/Keyboard.cpp Thu Aug 29 12:04:33 2013 +0600 +++ b/Keyboard.cpp Thu Aug 29 12:04:55 2013 +0600 @@ -191,8 +191,8 @@ return 1; } LABEL_15: - v3 = 3; - goto LABEL_4; + pKeyActionMap->SetWindowInputStatus(WINDOW_INPUT_CANCELLED); + return 1; } } if ( !pKeyActionMap->uNumKeysPressed ) @@ -203,10 +203,9 @@ pKeyActionMap->pPressedKeysBuffer[pKeyActionMap->uNumKeysPressed] = a2; ++pKeyActionMap->uNumKeysPressed; pKeyActionMap->pPressedKeysBuffer[pKeyActionMap->uNumKeysPressed] = 0; + LABEL_3: - v3 = 2; -LABEL_4: - pKeyActionMap->SetWindowInputStatus(v3); + pKeyActionMap->SetWindowInputStatus(WINDOW_INPUT_CONFIRMED); return 1; } // 506E68: using guessed type int uGameMenuUI_CurentlySelectedKeyIdx;
--- a/Keyboard.h Thu Aug 29 12:04:33 2013 +0600 +++ b/Keyboard.h Thu Aug 29 12:04:55 2013 +0600 @@ -86,7 +86,7 @@ bool IsShiftHeld(); void EnterCriticalSection(); - void (__thiscall ***vdestructor_ptr)(Keyboard *, bool); + void ( ***vdestructor_ptr)(Keyboard *, bool); unsigned int bUsingAsynKeyboard; }; #pragma pack(pop)
--- a/LOD.cpp Thu Aug 29 12:04:33 2013 +0600 +++ b/LOD.cpp Thu Aug 29 12:04:55 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; } @@ -1283,8 +1279,8 @@ v1->pSpriteHeaders, 40, 1500, - (void (__thiscall *)(void *))LODSprite::LODSprite, - (void (__thiscall *)(void *))LODSprite::dtor);*/ + (void ( *)(void *))LODSprite::LODSprite, + (void ( *)(void *))LODSprite::dtor);*/ field_ECA4 = 0; field_ECA0 = 0; pHardwareSprites = 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"); @@ -2947,7 +2943,7 @@ } //----- (0046080D) -------------------------------------------------------- -void __cdecl sub_46080D() +void sub_46080D() { pAllocator->FreeChunk(ptr_6A0D08); ptr_6A0D08 = 0;
--- a/LOD.h Thu Aug 29 12:04:33 2013 +0600 +++ b/LOD.h Thu Aug 29 12:04:55 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); @@ -168,8 +167,9 @@ inline struct Texture *GetTexture(int idx) { assert(idx < 1000); - if (idx == -1) return nullptr; // we need to return dummy texture here - return pTextures + idx; + if (idx == -1) + return nullptr; // we need to return dummy texture here + return &pTextures[idx]; } @@ -303,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 12:04:55 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 12:04:55 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/LightmapBuilder.h Thu Aug 29 12:04:33 2013 +0600 +++ b/LightmapBuilder.h Thu Aug 29 12:04:55 2013 +0600 @@ -12,7 +12,7 @@ Lightmap(); virtual ~Lightmap() {} - //void (__thiscall ***vdestructor_ptr)(Lightmap *, bool); + //void ( ***vdestructor_ptr)(Lightmap *, bool); unsigned int uNumVertices; RenderVertexSoft pVertices[64]; __int16 field_C08; @@ -60,7 +60,7 @@ bool ApplyLights(struct stru320 *a2, struct stru154 *a3, unsigned int uNumVertices, struct RenderVertexSoft *a5, struct IndoorCameraD3D_Vec4 *, char uClipFlag); - //void (__thiscall ***vdestructor_ptr)(LightmapBuilder *, bool); + //void ( ***vdestructor_ptr)(LightmapBuilder *, bool); //std::vector<Lightmap> std__vector_000004; //std::vector<Lightmap> std__vector_183808; Lightmap std__vector_000004[512];
--- a/Lights.h Thu Aug 29 12:04:33 2013 +0600 +++ b/Lights.h Thu Aug 29 12:04:55 2013 +0600 @@ -98,7 +98,7 @@ - //void (__thiscall ***vdestructor_ptr)(LightsStack_StationaryLight_ *, bool); + //void ( ***vdestructor_ptr)(LightsStack_StationaryLight_ *, bool); StationaryLight pLights[400]; unsigned int uNumLightsActive; }; @@ -127,7 +127,7 @@ - //void (__thiscall ***vdestructor_ptr)(LightsStack_MobileLight_ *, bool); + //void ( ***vdestructor_ptr)(LightsStack_MobileLight_ *, bool); MobileLight pLights[400]; unsigned int uNumLightsActive; };
--- a/Log.cpp Thu Aug 29 12:04:33 2013 +0600 +++ b/Log.cpp Thu Aug 29 12:04:55 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/MM7.h Thu Aug 29 12:04:33 2013 +0600 +++ b/MM7.h Thu Aug 29 12:04:55 2013 +0600 @@ -22,7 +22,7 @@ char ddraw_error(HRESULT hr, char *Str, size_t a3); char dinput_error(int a1, const char *Str, int a3); - void (__thiscall ***vdestructor_ptr)(CheckHRESULT_stru0 *, bool); + void ( ***vdestructor_ptr)(CheckHRESULT_stru0 *, bool); }; #pragma pack(pop)*/
--- a/Monsters.cpp Thu Aug 29 12:04:33 2013 +0600 +++ b/Monsters.cpp Thu Aug 29 12:04:55 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) -------------------------------------------------------- @@ -800,9 +822,9 @@ { switch(tolower(test_string[0])) { - case 's': pInfos[curr_rec_num].uMovementType=0;// short + case 's': pInfos[curr_rec_num].uMovementType=MONSTER_MOVEMENT_TYPE_SHORT;// short if (tolower(test_string[1])!='h') - pInfos[curr_rec_num].uMovementType=5; //stationary? + pInfos[curr_rec_num].uMovementType=MONSTER_MOVEMENT_TYPE_STAIONARY; //stationary break; //short case 'l': pInfos[curr_rec_num].uMovementType=2; break; //long case 'm': pInfos[curr_rec_num].uMovementType=1; break; //med
--- a/Monsters.h Thu Aug 29 12:04:33 2013 +0600 +++ b/Monsters.h Thu Aug 29 12:04:55 2013 +0600 @@ -58,6 +58,17 @@ MONSTER_SPECIAL_ABILITY_EXPLODE = 0x3, }; +enum MONSTER_MOVEMENT_TYPE + { + MONSTER_MOVEMENT_TYPE_SHORT = 0x0, + MONSTER_MOVEMENT_TYPE_MEDIUM = 0x1, + MONSTER_MOVEMENT_TYPE_LONG = 0x2, + MONSTER_MOVEMENT_TYPE_GLOBAL = 0x3, + MONSTER_MOVEMENT_TYPE_FREE = 0x4, + MONSTER_MOVEMENT_TYPE_STAIONARY = 0x5, + }; + + /* 336 */ enum MONSTER_SUPERTYPE { @@ -177,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; @@ -199,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/Mouse.cpp Thu Aug 29 12:04:33 2013 +0600 +++ b/Mouse.cpp Thu Aug 29 12:04:55 2013 +0600 @@ -614,30 +614,6 @@ } - -//----- (00417871) -------------------------------------------------------- -void __thiscall sub_417871(int *pXY) -{ - POINT v1; // [sp+0h] [bp-18h]@5 - POINT a2; // [sp+8h] [bp-10h]@5 - unsigned int pY; // [sp+10h] [bp-8h]@3 - unsigned int pX; // [sp+14h] [bp-4h]@3 - - if ( !pRenderer->pRenderD3D ) - { - if ( pXY ) - { - pX = *pXY; - pY = pXY[1]; - } - else - { - pMouse->GetClickPos(&pX, &pY); - } - pMouse->GetCursorPos(&a2); - pMouse->GetCursorPos(&v1); - } -} //----- (0041CD4F) -------------------------------------------------------- bool UI_OnKeyDown(unsigned int vkKey) {
--- a/Mouse.h Thu Aug 29 12:04:33 2013 +0600 +++ b/Mouse.h Thu Aug 29 12:04:55 2013 +0600 @@ -32,7 +32,7 @@ DeleteCriticalSection(&v1->csAsyncMouse); } - void (__thiscall ***vdestructor_ptr)(ThreadWard *, bool); + void ( ***vdestructor_ptr)(ThreadWard *, bool); _RTL_CRITICAL_SECTION csAsyncMouse; _RTL_CRITICAL_SECTION cs2; _RTL_CRITICAL_SECTION cs3;
--- a/NPC.cpp Thu Aug 29 12:04:33 2013 +0600 +++ b/NPC.cpp Thu Aug 29 12:04:55 2013 +0600 @@ -903,7 +903,7 @@ //----- (00476395) -------------------------------------------------------- //0x26 Wizard eye at skill level 2 -bool __thiscall CheckHiredNPCSpeciality(unsigned int uProfession) +bool CheckHiredNPCSpeciality(unsigned int uProfession) { if ( bNoNPCHiring == 1 ) @@ -1142,7 +1142,7 @@ } //----- (00476750) -------------------------------------------------------- -void __cdecl InitializeAutonotes() +void InitializeAutonotes() { int i; char* test_string; @@ -1227,7 +1227,7 @@ //----- (004768A9) -------------------------------------------------------- -void __cdecl InitializeQuests() +void InitializeQuests() { int i; char* test_string; @@ -1340,7 +1340,7 @@ /*switch ( pEventNumber ) { case 139: - sub_4B1ECE(); + OracleDialogue(); goto _return; case 311: sub_4BBA85_bounties(); @@ -1352,7 +1352,7 @@ { if ( pEventNumber == 139 ) { - sub_4B1ECE(); + OracleDialogue(); } else { @@ -1563,7 +1563,7 @@ gold_transaction_amount = price_for_membership[pEventCode]; if ( pPlayers[uActiveCharacter]->CanAct() ) { - if ( (unsigned __int16)_449B57_test_bit((unsigned __int8 *)pPlayers[uActiveCharacter]->_guilds_member_bits, dword_F8B1AC_award_bit_number) ) + if ( (unsigned __int16)_449B57_test_bit((unsigned __int8 *)pPlayers[uActiveCharacter]->_achieved_awards_bits, dword_F8B1AC_award_bit_number) ) { return pNPCTopics[dialogue_base+13].pText; }
--- a/OSInfo.h Thu Aug 29 12:04:33 2013 +0600 +++ b/OSInfo.h Thu Aug 29 12:04:55 2013 +0600 @@ -21,7 +21,7 @@ } - //void (__thiscall ***vdestructor_ptr)(OSVersion *, bool); + //void ( ***vdestructor_ptr)(OSVersion *, bool); OSVERSIONINFOA pVersionInfo; int bInitialized; };
--- a/ObjectList.cpp Thu Aug 29 12:04:33 2013 +0600 +++ b/ObjectList.cpp Thu Aug 29 12:04:55 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 12:04:33 2013 +0600 +++ b/ObjectList.h Thu Aug 29 12:04:55 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 12:04:33 2013 +0600 +++ b/Outdoor.cpp Thu Aug 29 12:04:55 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) @@ -3546,7 +3546,7 @@ pActors[ai_near_actors_ids[i]].uAttributes |= 0x0400; } //----- (0046BE0A) -------------------------------------------------------- -void __cdecl ODM_UpdateUserInputAndOther() +void ODM_UpdateUserInputAndOther() { bool v0; // eax@5 char pOut[32]; // [sp+8h] [bp-20h]@5 @@ -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 ) { @@ -3581,7 +3581,7 @@ check_event_triggers(); } //----- (0041F54A) -------------------------------------------------------- -void __cdecl LoadActualSkyFrame() +void LoadActualSkyFrame() { if ( pTexture_RestUI_CurrentSkyFrame ) pTexture_RestUI_CurrentSkyFrame->Release();
--- a/Overlays.cpp Thu Aug 29 12:04:33 2013 +0600 +++ b/Overlays.cpp Thu Aug 29 12:04:55 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 12:04:33 2013 +0600 +++ b/Overlays.h Thu Aug 29 12:04:55 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/Party.cpp Thu Aug 29 12:04:33 2013 +0600 +++ b/Party.cpp Thu Aug 29 12:04:55 2013 +0600 @@ -1181,7 +1181,7 @@ _494035_timed_effects__water_walking_damage__etc(); } //----- (004B1BDB) -------------------------------------------------------- -void __stdcall RestAndHeal(__int64 uNumMinutes) +void RestAndHeal(__int64 uNumMinutes) { signed __int64 v1; // ST2C_8@1 signed __int64 v2; // qax@1 @@ -1218,7 +1218,7 @@ pParty->UpdatePlayersAndHirelingsEmotions(); } //----- (0041F5BE) -------------------------------------------------------- -void __cdecl Sleep6Hours() +void Sleep6Hours() { if ( _506F18_num_minutes_to_sleep < 6 ) { @@ -1264,7 +1264,7 @@ } //----- (0047752B) -------------------------------------------------------- -int __cdecl GetPartyReputation() +int GetPartyReputation() { DDM_DLV_Header *v0; // ebx@1 signed int v1; // esi@3 @@ -1427,7 +1427,7 @@ pAudioPlayer->PlaySound(SOUND_GoldReceived, v2, v2, -1, v2, v2, v2, v2); } //----- (00421B2C) -------------------------------------------------------- -bool __cdecl sub_421B2C_PlaceInInventory_or_DropPickedItem() +bool sub_421B2C_PlaceInInventory_or_DropPickedItem() { unsigned int v0; // eax@2 Texture *v1; // ebx@2
--- a/Player.cpp Thu Aug 29 12:04:33 2013 +0600 +++ b/Player.cpp Thu Aug 29 12:04:55 2013 +0600 @@ -162,7 +162,7 @@ //----- (00490913) -------------------------------------------------------- -signed int __cdecl PlayerCreation_GetUnspentAttributePointCount() +int PlayerCreation_GetUnspentAttributePointCount() { signed int v0; // edi@1 int raceId; // ebx@2 @@ -641,13 +641,13 @@ switch ( uClass ) { case 0x1Au: - return(_449B57_test_bit((unsigned __int8 *)this->_guilds_member_bits, 65)); + return(_449B57_test_bit((unsigned __int8 *)this->_achieved_awards_bits, 65)); case 0x1Bu: - return(_449B57_test_bit((unsigned __int8 *)this->_guilds_member_bits, 67)); + return(_449B57_test_bit((unsigned __int8 *)this->_achieved_awards_bits, 67)); case 0x22u: - return(_449B57_test_bit((unsigned __int8 *)this->_guilds_member_bits, 77)); + return(_449B57_test_bit((unsigned __int8 *)this->_achieved_awards_bits, 77)); case 0x23u: - return(_449B57_test_bit((unsigned __int8 *)this->_guilds_member_bits, 79)); + return(_449B57_test_bit((unsigned __int8 *)this->_achieved_awards_bits, 79)); break; default: assert("Should not be able to get here" && false); @@ -5406,7 +5406,7 @@ uExperience = 251 + rand() % 100; uBirthYear = 1147 - rand() % 6; memset(pActiveSkills, 0, sizeof(pActiveSkills)); - memset(_guilds_member_bits, 0, 64); + memset(_achieved_awards_bits, 0, 64); memset(&spellbook, 0, sizeof(PlayerSpells)); for (uint i = 0; i < 37; ++i) @@ -5635,7 +5635,7 @@ } //----- (004905F5) -------------------------------------------------------- -//signed int __thiscall PartyCreation_BtnPlusClick(Player *this, int eAttribute) +//signed int PartyCreation_BtnPlusClick(Player *this, int eAttribute) void Player::IncreaseAttribute( int eAttribute ) { int raceId; // eax@1 @@ -6287,9 +6287,9 @@ return; } else - { - if ( pParty->pPickedItem.uItemID == 616 ) //Genie Lamp - { + { + if (pParty->pPickedItem.uItemID == 616) //Genie Lamp + { thisa = pParty->uCurrentMonthWeek + 1; if ( pParty->uCurrentMonth >= 7 ) v74 = NULL; @@ -6376,7 +6376,7 @@ } ShowStatusBarString(pTmpBuf.data(), 2u); pMouse->RemoveHoldingItem(); - pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, player_num - 1); + pGame->pStru6Instance->SetPlayerBuffAnim(SPELL_QUEST_COMPLETED, player_num - 1); v3->PlaySound(SPEECH_93, 0); pAudioPlayer->PlaySound((SoundID)219, 0, 0, -1, 0, 0, 0, 0); if ( pParty->uDaysPlayed == 6 || pParty->uDaysPlayed == 20 ) @@ -6397,36 +6397,35 @@ return; } else if ( pParty->pPickedItem.uItemID == 630 ) //Red Apple - { + { Party::GiveFood(1u); - pAudioPlayer->PlaySound((SoundID)(SOUND_PlayerCantCastSpell|0x2), 0, 0, -1, 0, 0, 0, 0); - - } + pAudioPlayer->PlaySound(SOUND_EatApple, 0, 0, -1, 0, 0, 0, 0); + } else if ( pParty->pPickedItem.uItemID == 632 ) //Lute { - pAudioPlayer->PlaySound((SoundID)133, 0, 0, -1, 0, 0, 0, 0); + pAudioPlayer->PlaySound(SOUND_PlayLute, 0, 0, -1, 0, 0, 0, 0); return; } else if ( pParty->pPickedItem.uItemID == 633 ) //Faerie Pipes { - pAudioPlayer->PlaySound((SoundID)134, 0, 0, -1, 0, 0, 0, 0); + pAudioPlayer->PlaySound(SOUND_PlayFaeriePipes, 0, 0, -1, 0, 0, 0, 0); return; } else if ( pParty->pPickedItem.uItemID == 634 ) //Gryphonheart's Trumpet { - pAudioPlayer->PlaySound((SoundID)135, 0, 0, -1, 0, 0, 0, 0); + pAudioPlayer->PlaySound(SOUND_PlayGryphonheartsTrumpet, 0, 0, -1, 0, 0, 0, 0); return; } else if ( pParty->pPickedItem.uItemID == 646 ) //Horseshoe - { - pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, player_num - 1); - v5 = PID(OBJECT_Player,player_num + 49); + { + pGame->pStru6Instance->SetPlayerBuffAnim(SPELL_QUEST_COMPLETED, player_num - 1); + v5 = PID(OBJECT_Player, player_num + 49); pAudioPlayer->PlaySound(SOUND_20001, v5, 0, -1, 0, 0, 0, 0); v3->AddVariable(VAR_NumSkillPoints, 2); } else if ( pParty->pPickedItem.uItemID == 650 ) //Temple in a Bottle { - sub_44C28F_open_nwc_dungeon(); + TeleportToNWCDungeon(); return; } else @@ -6715,7 +6714,7 @@ goto _j_cmp_against_arg; case VAR_Award: test_bit_value = 0x80u >> ((signed __int16)pValue - 1) % 8; - our_bit_value = this->_guilds_member_bits[((signed __int16)pValue - 1) /8]; + our_bit_value = this->_achieved_awards_bits[((signed __int16)pValue - 1) /8]; if ( !((unsigned __int8)test_bit_value & our_bit_value) ) return true; return false; @@ -7177,7 +7176,7 @@ return; case VAR_Award: if ( !((unsigned __int8)(0x80u >> ((signed __int16)var_value - 1) % 8) & - pPlayers[currPlayerId + 1]->_guilds_member_bits[((signed __int16)var_value - 1)/ 8]) + pPlayers[currPlayerId + 1]->_achieved_awards_bits[((signed __int16)var_value - 1)/ 8]) //&& dword_723E80_award_related[2 * a3] ) && pAwards[var_value].pText ) { @@ -7185,7 +7184,7 @@ DrawPlayerBuffAnimBasedOnCondition(currPlayerId); PlaySoundBasedOnCondition(currPlayerId); } - _449B7E_toggle_bit((unsigned char *)this->_guilds_member_bits, var_value, 1u); + _449B7E_toggle_bit((unsigned char *)this->_achieved_awards_bits, var_value, 1u); return; case VAR_Experience: this->uExperience = var_value; @@ -7599,7 +7598,7 @@ return; case VAR_Award: v13 = pPlayers[uPlayerIdx + 1]; - if (_449B57_test_bit((unsigned __int8 *)pPlayers[uPlayerIdx + 1]->_guilds_member_bits, val) + if (_449B57_test_bit((unsigned __int8 *)pPlayers[uPlayerIdx + 1]->_achieved_awards_bits, val) && pAwards[val].pText ) { @@ -7608,7 +7607,7 @@ v3 = 1; v14->PlaySound(SPEECH_96, 0); } - v15 = (char *)v4->_guilds_member_bits; + v15 = (char *)v4->_achieved_awards_bits; goto LABEL_44; case VAR_Experience: v16 = __CFADD__(val, LODWORD(Dst->uExperience)); @@ -8234,7 +8233,7 @@ this->sAgeModifier -= (signed __int16)pValue; return result; case VAR_Award: - _449B7E_toggle_bit((unsigned char *)this->_guilds_member_bits, (signed __int16)pValue, 0); + _449B7E_toggle_bit((unsigned char *)this->_achieved_awards_bits, (signed __int16)pValue, 0); return result; case VAR_Experience: v12 = (char *)&this->uExperience; @@ -8683,14 +8682,14 @@ //----- (0049387A) -------------------------------------------------------- -int CycleCharacter(unsigned int _this) +int CycleCharacter(bool backwards) { signed int result; // eax@1 signed int v2; // ecx@2 signed int v3; // ecx@8 result = uActiveCharacter; - if ( _this ) + if ( backwards ) { v2 = 0; while ( 1 ) @@ -8784,7 +8783,7 @@ return false; } //----- (0043EDB9) -------------------------------------------------------- -bool __thiscall sub_43EDB9_get_some_race_sex_relation_2(unsigned int a1) +bool sub_43EDB9_get_some_race_sex_relation_2(unsigned int a1) { unsigned int pNum; // ebp@1 Player **pPlayer; // ebx@1 @@ -9371,7 +9370,7 @@ } } //----- (00421EA6) -------------------------------------------------------- -void __cdecl OnInventoryLeftClick() +void OnInventoryLeftClick() { Player *v0; // ebx@1 signed int v1; // eax@2
--- a/Player.h Thu Aug 29 12:04:33 2013 +0600 +++ b/Player.h Thu Aug 29 12:04:55 2013 +0600 @@ -697,7 +697,7 @@ }; unsigned __int16 pActiveSkills[37]; }; - unsigned char _guilds_member_bits[64]; + unsigned char _achieved_awards_bits[64]; PlayerSpells spellbook; char field__1F5[2]; // used to be [31] int pure_luck_used;
--- a/PlayerFrameTable.h Thu Aug 29 12:04:33 2013 +0600 +++ b/PlayerFrameTable.h Thu Aug 29 12:04:55 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/Render.cpp Thu Aug 29 12:04:33 2013 +0600 +++ b/Render.cpp Thu Aug 29 12:04:55 2013 +0600 @@ -91,7 +91,7 @@ signed int __stdcall RenderD3D__DeviceEnumerator(GUID *lpGUID, const char *lpDevDesc, const char *lpDriverName, RenderD3D__DevInfo *pOut); // idb //----- (0049E79F) -------------------------------------------------------- -bool __cdecl CheckTextureStages() +bool CheckTextureStages() { bool v0; // edi@1 IDirectDrawSurface4 *pSurface2; // [sp+Ch] [bp-14h]@1 @@ -182,7 +182,7 @@ } //----- (004A16A5) -------------------------------------------------------- -bool __cdecl AreRenderSurfacesOk() +bool AreRenderSurfacesOk() { char v0; // zf@4 bool result; // eax@8 @@ -8378,7 +8378,7 @@ if ( !pRenderer->bWindowMode && (dword_6BE364_game_settings_1 & 2) ) { - ModalWindow(pGlobalTXT_LocalizationStrings[62], 0);// "Might and Magic VII requires your desktop to be in 16bit (32k or 65k) Color mode in order to operate in a window." + ModalWindow(pGlobalTXT_LocalizationStrings[62], UIMSG_0);// "Might and Magic VII requires your desktop to be in 16bit (32k or 65k) Color mode in order to operate in a window." return; } if ( pRenderer->bWindowMode || !pRenderer->pRenderD3D || pRenderer->pRenderD3D->pAvailableDevices->bIsDeviceCompatible ) @@ -8821,15 +8821,7 @@ } } //----- (0040DF3D) -------------------------------------------------------- -void __cdecl CallRenderPresent() +void CallRenderPresent() { pRenderer->Present(); } - - - -//----- (0044EC20) -------------------------------------------------------- -/*bool RenderD3D::DoesRaiseExceptions() -{ - return true; -}*/ \ No newline at end of file
--- a/Render.h Thu Aug 29 12:04:33 2013 +0600 +++ b/Render.h Thu Aug 29 12:04:55 2013 +0600 @@ -445,7 +445,7 @@ IDirect3DTexture2 *pTexture; int field_1036B8; int _gpu_memory_used; - void (__cdecl *pBeforePresentFunction)(); + void ( *pBeforePresentFunction)(); int field_1036C4; uint bFogEnabled; int field_1036CC;
--- a/SaveLoad.cpp Thu Aug 29 12:04:33 2013 +0600 +++ b/SaveLoad.cpp Thu Aug 29 12:04:55 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; @@ -836,7 +836,7 @@ return pPixels; } //----- (0045E26C) -------------------------------------------------------- -void __thiscall SaveScreenshot(const char *pFilename) +void SaveScreenshot(const char *pFilename) { unsigned __int16 *v2; // esi@1
--- a/SpriteObject.cpp Thu Aug 29 12:04:33 2013 +0600 +++ b/SpriteObject.cpp Thu Aug 29 12:04:55 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 12:04:33 2013 +0600 +++ b/Sprites.cpp Thu Aug 29 12:04:55 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 12:04:33 2013 +0600 +++ b/Sprites.h Thu Aug 29 12:04:55 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 12:04:33 2013 +0600 +++ b/Texture.cpp Thu Aug 29 12:04:55 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 12:04:33 2013 +0600 +++ b/Texture.h Thu Aug 29 12:04:55 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 12:04:33 2013 +0600 +++ b/TileFrameTable.h Thu Aug 29 12:04:55 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 12:04:33 2013 +0600 +++ b/TileTable.cpp Thu Aug 29 12:04:55 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/TurnEngine.cpp Thu Aug 29 12:04:33 2013 +0600 +++ b/TurnEngine.cpp Thu Aug 29 12:04:55 2013 +0600 @@ -357,7 +357,7 @@ } else if ( turn_stage == 2 ) { - if ( field_18 == TE_FLAG_1) + if ( !(field_18 &TE_FLAG_1)) { if ( turn_initiative == 100 ) { @@ -375,7 +375,7 @@ } else if ( turn_stage == 3 ) { - if ( (uActionPointsLeft > 0) && (field_18 == TE_FLAG_8) ) + if ( (uActionPointsLeft > 0) && (!(field_18 & TE_FLAG_8)) ) ActorAIChooseNewTargets(); else { @@ -625,18 +625,16 @@ else uActiveCharacter = 0; viewparams->bRedrawGameUI = 1; - if (pQueue[0].actor_initiative > 0) + + while ( (pQueue[0].actor_initiative > 0)&&(turn_initiative > 0) ) { - while(turn_initiative > 0) + for (i=0; i<uActorQueueSize; ++i) { - for (i=0; i<uActorQueueSize; ++i) - { - --pQueue[i].actor_initiative; - if (pQueue[i].actor_initiative==0) - pQueue[i].uActionLength=0; - } - --turn_initiative; + --pQueue[i].actor_initiative; + if (pQueue[i].actor_initiative==0) + pQueue[i].uActionLength=0; } + --turn_initiative; } } @@ -1072,7 +1070,7 @@ } else { - Actor::AI_4032B2(uActorID, a2a, 1024, 0); + Actor::AI_RandomMove(uActorID, a2a, 1024, 0); v29->AI_action_type = TE_AI_PURSUE; } @@ -1086,11 +1084,11 @@ { if ( actor->pMonsterInfo.uAIType == 1 ) { - if ( actor->pMonsterInfo.uMovementType == 5 ) + if ( actor->pMonsterInfo.uMovementType == MONSTER_MOVEMENT_TYPE_STAIONARY ) Actor::AI_Stand(uActorID, a2a, 32, 0); else Actor::AI_Flee(uActorID, a2a, 32, 0); - v29->AI_action_type = 4; + v29->AI_action_type = TE_AI_FLEE; v29->uActionLength = actor->uCurrentActionLength; return 1; } @@ -1099,11 +1097,11 @@ if (((double)actor->pMonsterInfo.uHP * 0.2) > (double)actor->sCurrentHP && (v11 < 10240 ) ) { - if ( actor->pMonsterInfo.uMovementType == 5 ) + if ( actor->pMonsterInfo.uMovementType == MONSTER_MOVEMENT_TYPE_STAIONARY ) Actor::AI_Stand(uActorID, a2a, 32, 0); else Actor::AI_Flee(uActorID, a2a, 32, 0); - v29->AI_action_type = 4; + v29->AI_action_type = TE_AI_FLEE; v29->uActionLength = actor->uCurrentActionLength; return 1; } @@ -1113,11 +1111,11 @@ if ( ((double)actor->pMonsterInfo.uHP * 0.1) > (double)actor->sCurrentHP && (v11 < 10240 )) { - if ( actor->pMonsterInfo.uMovementType == 5 ) + if ( actor->pMonsterInfo.uMovementType == MONSTER_MOVEMENT_TYPE_STAIONARY ) Actor::AI_Stand(uActorID, a2a, 32, 0); else Actor::AI_Flee(uActorID, a2a, 32, 0); - v29->AI_action_type = 4; + v29->AI_action_type = TE_AI_FLEE; v29->uActionLength = actor->uCurrentActionLength; return 1; } @@ -1140,19 +1138,19 @@ } switch(actor->pMonsterInfo.uMovementType) { - case 0: - Actor::AI_4032B2(uActorID, a2a, 1024, 32); + case MONSTER_MOVEMENT_TYPE_SHORT: + Actor::AI_RandomMove(uActorID, a2a, 1024, 32); break; - case 1: - Actor::AI_4032B2(uActorID, a2a, 2560, 32); + case MONSTER_MOVEMENT_TYPE_MEDIUM: + Actor::AI_RandomMove(uActorID, a2a, 2560, 32); break; - case 2: - Actor::AI_4032B2(uActorID, a2a, 5120, 32); + case MONSTER_MOVEMENT_TYPE_LONG: + Actor::AI_RandomMove(uActorID, a2a, 5120, 32); break; - case 4: - Actor::AI_4032B2(uActorID, a2a, 10240, 32); + case MONSTER_MOVEMENT_TYPE_FREE: + Actor::AI_RandomMove(uActorID, a2a, 10240, 32); break; - case 5: + case MONSTER_MOVEMENT_TYPE_STAIONARY: Actor::AI_Stand(uActorID, a2a, 32, 0); break; default:
--- a/TurnEngine.h Thu Aug 29 12:04:33 2013 +0600 +++ b/TurnEngine.h Thu Aug 29 12:04:55 2013 +0600 @@ -82,7 +82,7 @@ int uActionPointsLeft; //14 int field_18; int pending_actions; - TurnBased_QueueElem pQueue[504]; //20 + TurnBased_QueueElem pQueue[530]; //20 }; #pragma pack(pop)
--- a/UI/Books/UIMapBook.cpp Thu Aug 29 12:04:33 2013 +0600 +++ b/UI/Books/UIMapBook.cpp Thu Aug 29 12:04:55 2013 +0600 @@ -78,7 +78,7 @@ } //----- (00410DEC) -------------------------------------------------------- -unsigned int __cdecl DrawLloydBeaconsScreen() +unsigned int DrawLloydBeaconsScreen() { Player *pPlayer; // esi@1 char *pText; // eax@1 @@ -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 12:04:33 2013 +0600 +++ b/UI/Books/UINotesBooks.cpp Thu Aug 29 12:04:55 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/Books/UISpellBook.cpp Thu Aug 29 12:04:33 2013 +0600 +++ b/UI/Books/UISpellBook.cpp Thu Aug 29 12:04:55 2013 +0600 @@ -97,7 +97,7 @@ { for ( uint i = 1; i <= 11; ++i ) { - if (player->_guilds_member_bits[(11 * player->lastOpenedSpellbookPage) + i + 63] ) + if (player->_achieved_awards_bits[(11 * player->lastOpenedSpellbookPage) + i + 63] ) { if ( SBPageSSpellsTextureList[i] != PendingTexture ) {
--- a/UI/UICharacter.cpp Thu Aug 29 12:04:33 2013 +0600 +++ b/UI/UICharacter.cpp Thu Aug 29 12:04:55 2013 +0600 @@ -43,6 +43,10 @@ unsigned int ui_character_skillinfo_can_learn; unsigned int ui_character_skillinfo_can_learn_gm; unsigned int ui_character_skillinfo_cant_learn; +unsigned int ui_character_condition_normal_color; +unsigned int ui_character_condition_light_color; +unsigned int ui_character_condition_moderate_color; +unsigned int ui_character_condition_severe_color; std::array<unsigned int, 6> ui_character_award_color; unsigned int ui_game_minimap_outline_color; @@ -107,6 +111,11 @@ ui_character_skillinfo_can_learn = TargetColor(255, 255, 255); ui_character_skillinfo_can_learn_gm = TargetColor(255, 255, 0); ui_character_skillinfo_cant_learn = TargetColor(255, 0, 0); + + ui_character_condition_normal_color = TargetColor(255, 255, 255); + ui_character_condition_light_color = TargetColor(0, 255, 0); + ui_character_condition_moderate_color = TargetColor(225, 205, 35); + ui_character_condition_severe_color = TargetColor(255, 35, 0); ui_character_award_color[0] = TargetColor(248, 108, 160); ui_character_award_color[1] = TargetColor(112, 220, 248); @@ -185,7 +194,7 @@ unsigned int papredoll_dlhus[4]; unsigned int papredoll_dlhs[4]; unsigned int papredoll_dbods[5]; -int paperdoll_armor_texture[4][17][3]; +int paperdoll_armor_texture[4][17][3];//0x511294 //int paperdoll_array_51132C[165]; unsigned int papredoll_dlaus[5]; unsigned int papredoll_dlads[4]; @@ -274,7 +283,7 @@ int pPaperdoll_BodyX = 481; // 004E4C28 int pPaperdoll_BodyY = 0; // 004E4C2C -const int paperdoll_Armor[4][17][2] = //4E4E30 +const int paperdoll_Armor_Coord[4][17][2] = //4E4E30 { // X Y 0x2C, 0x67, 0x30, 0x69, 0x2D, 0x67, 0x2C, 0x64, 0x14, 0x66, 0x22, 0x67, 0x20, 0x66, 0x25, 0x66, 0x12, 0x66,//Human @@ -289,7 +298,7 @@ 0x33, 0x90, 0x32, 0x90, 0x34, 0x91, 0x32, 0x8E, 0x21, 0x8B, 0x31, 0x8B, 0x33, 0x8E, 0x2F, 0x8F, 0x16, 0x8D, 0x18, 0x8C, 0x19, 0x8C, 0x1B, 0x8E, 0x0C, 0x8C, 0x21, 0x8B, 0x0C, 0x8C, 0x18, 0x8C, 0x2F, 0x8F, }; -const int paperdoll_shoulder[4][17][2] = //4E5050 +const int paperdoll_shoulder_coord[4][17][2] = //4E5050 { 0x64, 0x67, 0x61, 0x67, 0x65, 0x68, 0x6E, 0x74, 0x6C, 0x68, 0x61, 0x67, 0x66, 0x68, 0x6C, 0x6A, 0x6E, 0x6D, 0x67, 0x69, 0x70, 0x67, 0x6E, 0x6D, 0x6C, 0x6F, 0x6C, 0x68, 0x6C, 0x6F, 0x67, 0x69, 0x6C, 0x6A, @@ -303,12 +312,19 @@ 0x72, 0x91, 0x72, 0x91, 0, 0, 0x6E, 0x92, 0x6F, 0x91, 0, 0, 0, 0, 0x6E, 0x91, 0x71, 0x90, 0x72, 0x8D, 0x72, 0x90, 0x73, 0x93, 0x73, 0x90, 0x6F, 0x91, 0x73, 0x90, 0x72, 0x8D, 0x6E, 0x91, }; -const int dword_4E5270[4][2] = +const int paperdoll_shoulder_second_coord[4][17][2] = //dword_4E5270 { - 0, 0, - 0x61, 0x67, - 0, 0, - 0x64, 0x69, + 0, 0, 0x61, 0x67, 0, 0, 0x64, 0x69, 0x64, 0x68, 0, 0, 0, 0, 0x5E, 0x66, 0x5F, 0x69, + 0x55, 0x69, 0x5F, 0x67, 0x5F, 0x68, 0x32, 0x69, 0x64, 0x68, 0x32, 0x69, 0x55, 0x69, 0x5E, 0x66, + + 0, 0, 0x60, 0x6C, 0, 0, 0x60, 0x6C, 0x5E, 0x69, 0, 0, 0, 0, 0x5D, 0x6A, 0x5B, 0x6A, + 0x5B, 0x6A, 0x59, 0x69, 0x56, 0x68, 0x38, 0x6E, 0x5E, 0x69, 0x38, 0x6E, 0x5B, 0x6A, 0x5D, 0x6A, + + 0, 0, 0x75, 0x8C, 0, 0, 0x72, 0x8D, 0x62, 0x89, 0, 0, 0, 0, 0x69, 0x8C, 0x5E, 0x8D, + 0x61, 0x8D, 0x5F, 0x8D, 0x60, 0x8D, 0x2E, 0x8C, 0x62, 0x89, 0x2E, 0x8C, 0x61, 0x8D, 0x69, 0x8C, + + 0, 0, 0x72, 0x91, 0, 0, 0x72, 0x91, 0x67, 0x8F, 0, 0, 0, 0, 0x6E, 0x91, 0x64, 0x93, + 0x65, 0x8C, 0x65, 0x91, 0x67, 0x91, 0x36, 0x90, 0x67, 0x8F, 0x36, 0x90, 0x65, 0x8C, 0x6E, 0x91, }; const char *dlad_texnames_by_face[25] = @@ -563,7 +579,7 @@ //----- (0041A000) -------------------------------------------------------- void CharacterUI_AwardsTab_Draw(Player *player) { - unsigned int result; // eax@1 + int items_per_page; // eax@1 char *v6; // ebx@15 char Source[100]; // [sp+Ch] [bp-C4h]@1 GUIWindow awards_window; // [sp+70h] [bp-60h]@1 @@ -575,7 +591,7 @@ strcat(pTmpBuf.data(), "\f00000"); pGUIWindow_CurrentMenu->DrawText(pFontArrus, 24, 18, 0, pTmpBuf.data(), 0, 0, 0); - result = books_primary_item_per_page; + items_per_page = books_primary_item_per_page; awards_window.uFrameX = 12; awards_window.uFrameY = 48; awards_window.uFrameWidth = 424; @@ -583,31 +599,31 @@ awards_window.uFrameZ = 435; awards_window.uFrameW = 337; if (BtnDown_flag && num_achieved_awards + books_primary_item_per_page < full_num_items_in_book) - result = books_primary_item_per_page++ + 1; - if (BtnUp_flag && result) + items_per_page = books_primary_item_per_page++ + 1; + if (BtnUp_flag && items_per_page) { - --result; - books_primary_item_per_page = result; + --items_per_page; + books_primary_item_per_page = items_per_page; } if ( books_page_number < 0 ) { - result += num_achieved_awards; - books_primary_item_per_page = result; - if ( (signed int)(num_achieved_awards + result) > full_num_items_in_book ) + items_per_page += num_achieved_awards; + books_primary_item_per_page = items_per_page; + if ( (signed int)(num_achieved_awards + items_per_page) > full_num_items_in_book ) { - result = full_num_items_in_book - num_achieved_awards; - books_primary_item_per_page = result; + items_per_page = full_num_items_in_book - num_achieved_awards; + books_primary_item_per_page = items_per_page; } } else if ( books_page_number > 0 ) { - result -= num_achieved_awards; - books_primary_item_per_page = result; - if ( (result & 0x80000000u) != 0 ) + items_per_page -= num_achieved_awards; + books_primary_item_per_page = items_per_page; + if ( items_per_page < 0 ) { - result = 0; - books_primary_item_per_page = result; + items_per_page = 0; + books_primary_item_per_page = items_per_page; } } BtnDown_flag = 0; @@ -615,7 +631,7 @@ num_achieved_awards = 0; books_page_number = 0; - for ( int i = result; i < full_num_items_in_book; ++i) + for ( int i = items_per_page; i < full_num_items_in_book; ++i) { v6 = (char *)pAwards[achieved_awards[i]].pText;//(char *)dword_723E80_award_related[v20 / 4]; pTmpBuf[0] = 0; @@ -667,7 +683,7 @@ { case WINDOW_CharacterWindow_Stats: // stats CharacterUI_ReleaseButtons(); - sub_419379(); + ReleaseAwardsScrollBar(); CharacterUI_StatsTab_Draw(player); pRenderer->DrawTextureIndexed(pCharacterScreen_StatsBtn->uX, pCharacterScreen_StatsBtn->uY, @@ -680,7 +696,7 @@ CharacterUI_ReleaseButtons(); CharacterUI_SkillsTab_CreateButtons(); } - sub_419379(); + ReleaseAwardsScrollBar(); CharacterUI_SkillsTab_Draw(player); pRenderer->DrawTextureIndexed(pCharacterScreen_SkillsBtn->uX, pCharacterScreen_SkillsBtn->uY, @@ -689,7 +705,7 @@ case WINDOW_CharacterWindow_Awards: // awards CharacterUI_ReleaseButtons(); - sub_419379(); + ReleaseAwardsScrollBar(); CreateAwardsScrollBar(); CharacterUI_AwardsTab_Draw(player); pRenderer->DrawTextureIndexed(pCharacterScreen_AwardsBtn->uX, @@ -699,7 +715,7 @@ case WINDOW_CharacterWindow_Inventory: // inventory and other CharacterUI_ReleaseButtons(); - sub_419379(); + ReleaseAwardsScrollBar(); CharacterUI_InventoryTab_Draw(player, false); pRenderer->DrawTextureIndexed(pCharacterScreen_InventoryBtn->uX, pCharacterScreen_InventoryBtn->uY, @@ -947,8 +963,8 @@ } if ( index >= 0 && index < 17 ) { - item_X = pPaperdoll_BodyX + paperdoll_Armor[pBodyComplection][index][0]; - item_Y = pPaperdoll_BodyY + paperdoll_Armor[pBodyComplection][index][1]; + item_X = pPaperdoll_BodyX + paperdoll_Armor_Coord[pBodyComplection][index][0]; + item_Y = pPaperdoll_BodyY + paperdoll_Armor_Coord[pBodyComplection][index][1]; if ( !(item->uAttributes & 0xF0) ) { if ( item->uAttributes & 2 ) @@ -981,105 +997,6 @@ pRenderer->DrawAura(item_X, item_Y, pIcons_LOD->GetTexture(paperdoll_armor_texture[pBodyComplection][index][0]), pIcons_LOD->LoadTexturePtr(container, TEXTURE_16BIT_PALETTE), GetTickCount() * 0.1, 0, 255); } - //--------------------------------(Shoulder/)--------------------------------------------- - if ( pPlayers[uPlayerID]->pEquipment.uMainHand - && (pPlayers[uPlayerID]->GetEquippedItemEquipType(EQUIP_MAIN_HAND) == EQUIP_MAIN_HAND || - pPlayers[uPlayerID]->GetEquippedItemSkillType(EQUIP_MAIN_HAND) == EQUIP_SHIELD && - !pPlayers[uPlayerID]->pEquipment.uShield) )// - { - v94 = paperdoll_armor_texture[pBodyComplection][index][2]; - if ( paperdoll_armor_texture[pBodyComplection][index][2] == pIcons_LOD->FindTextureByName("pending") ) - { - v94 = paperdoll_armor_texture[pBodyComplection][index][1]; - item_X = pPaperdoll_BodyX + paperdoll_shoulder[pBodyComplection][index][0]; - item_Y = pPaperdoll_BodyY + paperdoll_shoulder[pBodyComplection][index][1]; - } - else - { - item_X = pPaperdoll_BodyX + dword_4E5270[index][0]; - item_Y = pPaperdoll_BodyY + dword_4E5270[index][1]; - } - if ( !(item->uAttributes & 0xF0) ) - { - //v98 = v94 + 1; - if ( item->uAttributes & 2 ) - pRenderer->DrawTransparentRedShade(item_X, item_Y, pIcons_LOD->GetTexture(v94)); - else - { - if ( item->uAttributes & 1 ) - pRenderer->DrawTextureTransparent(item_X, item_Y, pIcons_LOD->GetTexture(v94)); - else - pRenderer->DrawTransparentGreenShade(item_X, item_Y, pIcons_LOD->GetTexture(v94)); - } - } - else - { - if ( paperdoll_armor_texture[pBodyComplection][index][2] != pIcons_LOD->FindTextureByName("pending") ) - { - if ( item->uAttributes & 0xF0 ) - { - if ( (item->uAttributes & 0xF0) == ITEM_AURA_EFFECT_RED ) - container = "sptext01"; - if ( (item->uAttributes & 0xF0) == ITEM_AURA_EFFECT_BLUE ) - container = "sp28a"; - if ( ( item->uAttributes & 0xF0) == ITEM_AURA_EFFECT_GREEN ) - container = "sp30a"; - if ( (item->uAttributes & 0xF0) == ITEM_AURA_EFFECT_PURPLE ) - container = "sp91a"; - _50C9A8_item_enchantment_timer -= pEventTimer->uTimeElapsed; - if ( _50C9A8_item_enchantment_timer <= 0 ) - { - _50C9A8_item_enchantment_timer = 0; - item->uAttributes &= 0xFFFFFF0Fu; - ptr_50C9A4 = 0; - } - pRenderer->DrawAura(item_X, item_Y, pIcons_LOD->GetTexture(v94), pIcons_LOD->LoadTexturePtr(container, TEXTURE_16BIT_PALETTE), - GetTickCount() * 0.1, 0, 255); - } - } - } - } - else// - { - //v94 = paperdoll_armor_texture[pBodyComplection][index][1]; - if ( paperdoll_armor_texture[pBodyComplection][index][1] != pIcons_LOD->FindTextureByName("pending") ) - { - item_X = pPaperdoll_BodyX + paperdoll_shoulder[pBodyComplection][index][0]; - item_Y = pPaperdoll_BodyY + paperdoll_shoulder[pBodyComplection][index][1]; - if ( !(item->uAttributes & 0xF0) ) - { - if ( item->uAttributes & 2 ) - pRenderer->DrawTransparentRedShade(item_X, item_Y, pIcons_LOD->GetTexture(paperdoll_armor_texture[pBodyComplection][index][2])); - else - { - if ( item->uAttributes & 1 ) - pRenderer->DrawTextureTransparent(item_X, item_Y, pIcons_LOD->GetTexture(paperdoll_armor_texture[pBodyComplection][index][2])); - else - pRenderer->DrawTransparentGreenShade(item_X, item_Y, pIcons_LOD->GetTexture(paperdoll_armor_texture[pBodyComplection][index][2])); - } - } - else - { - if ( (item->uAttributes & 0xF0) == ITEM_AURA_EFFECT_RED ) - container = "sptext01"; - if ( (item->uAttributes & 0xF0) == ITEM_AURA_EFFECT_BLUE ) - container = "sp28a"; - if ( (item->uAttributes & 0xF0) == ITEM_AURA_EFFECT_GREEN ) - container = "sp30a"; - if ( (item->uAttributes & 0xF0) == ITEM_AURA_EFFECT_PURPLE ) - container = "sp91a"; - _50C9A8_item_enchantment_timer -= pEventTimer->uTimeElapsed; - if ( _50C9A8_item_enchantment_timer <= 0 ) - { - _50C9A8_item_enchantment_timer = 0; - item->uAttributes &= 0xFFFFFF0Fu; - ptr_50C9A4 = 0; - } - pRenderer->DrawAura(item_X, item_Y, pIcons_LOD->GetTexture(paperdoll_armor_texture[pBodyComplection][index][1]), - pIcons_LOD->LoadTexturePtr(container, TEXTURE_16BIT_PALETTE), GetTickCount() * 0.1, 0, 255); - } - } - } if ( !bRingsShownInCharScreen ) pRenderer->DrawMaskToZBuffer(item_X, item_Y, &pIcons_LOD->pTextures[paperdoll_armor_texture[pBodyComplection][index][0]], @@ -1222,6 +1139,129 @@ pRenderer->DrawTextureTransparent(pPaperdoll_BodyX + pPaperdoll_SecondLeftHand[pBodyComplection][0], pPaperdoll_BodyY + pPaperdoll_SecondLeftHand[pBodyComplection][1], pIcons_LOD->GetTexture(papredoll_dlaus[uPlayerID - 1])); } + //--------------------------------(Shoulder/)--------------------------------------------- + item = &pPlayers[uPlayerID]->pInventoryItemList[pPlayers[uPlayerID]->pEquipment.uArmor - 1]; + switch ( item->uItemID ) + { + case ITEM_ARTICACT_GOVERNONS_ARMOR: + index = 15; + break; + case ITEM_ARTIFACT_YORUBA: + index = 14; + break; + case ITEM_RELIC_HARECS_LEATHER: + index = 13; + break; + case ITEM_ELVEN_CHAINMAIL: + index = 16; + break; + default: + index = item->uItemID - 66; + break; + } + if ( index >= 0 && index < 17 ) + { + if ( pPlayers[uPlayerID]->pEquipment.uMainHand + && (pPlayers[uPlayerID]->GetEquippedItemEquipType(EQUIP_MAIN_HAND) == EQUIP_MAIN_HAND + || pPlayers[uPlayerID]->GetEquippedItemSkillType(EQUIP_MAIN_HAND) == EQUIP_SHIELD + && !pPlayers[uPlayerID]->pEquipment.uShield) )// + { + v94 = paperdoll_armor_texture[pBodyComplection][index][2]; + if ( paperdoll_armor_texture[pBodyComplection][index][2] == pIcons_LOD->FindTextureByName("pending") ) + { + v94 = paperdoll_armor_texture[pBodyComplection][index][1]; + item_X = pPaperdoll_BodyX + paperdoll_shoulder_coord[pBodyComplection][index][0]; + item_Y = pPaperdoll_BodyY + paperdoll_shoulder_coord[pBodyComplection][index][1]; + } + else + { + item_X = pPaperdoll_BodyX + paperdoll_shoulder_second_coord[pBodyComplection][index][0]; + item_Y = pPaperdoll_BodyY + paperdoll_shoulder_second_coord[pBodyComplection][index][1]; + } + if ( v94 != pIcons_LOD->FindTextureByName("pending") ) + { + if ( !(item->uAttributes & 0xF0) ) + { + if ( item->uAttributes & 2 ) + pRenderer->DrawTransparentRedShade(item_X, item_Y, pIcons_LOD->GetTexture(v94)); + else + { + if ( item->uAttributes & 1 ) + pRenderer->DrawTextureTransparent(item_X, item_Y, pIcons_LOD->GetTexture(v94)); + else + pRenderer->DrawTransparentGreenShade(item_X, item_Y, pIcons_LOD->GetTexture(v94)); + } + } + else + { + if ( paperdoll_armor_texture[pBodyComplection][index][2] != pIcons_LOD->FindTextureByName("pending") ) + { + if ( item->uAttributes & 0xF0 ) + { + if ( (item->uAttributes & 0xF0) == ITEM_AURA_EFFECT_RED ) + container = "sptext01"; + if ( (item->uAttributes & 0xF0) == ITEM_AURA_EFFECT_BLUE ) + container = "sp28a"; + if ( ( item->uAttributes & 0xF0) == ITEM_AURA_EFFECT_GREEN ) + container = "sp30a"; + if ( (item->uAttributes & 0xF0) == ITEM_AURA_EFFECT_PURPLE ) + container = "sp91a"; + _50C9A8_item_enchantment_timer -= pEventTimer->uTimeElapsed; + if ( _50C9A8_item_enchantment_timer <= 0 ) + { + _50C9A8_item_enchantment_timer = 0; + item->uAttributes &= 0xFFFFFF0Fu; + ptr_50C9A4 = 0; + } + pRenderer->DrawAura(item_X, item_Y, pIcons_LOD->GetTexture(v94), pIcons_LOD->LoadTexturePtr(container, TEXTURE_16BIT_PALETTE), + GetTickCount() * 0.1, 0, 255); + } + } + } + } + } + else// + { + //v94 = paperdoll_armor_texture[pBodyComplection][index][1]; + if ( paperdoll_armor_texture[pBodyComplection][index][1] != pIcons_LOD->FindTextureByName("pending") ) + { + item_X = pPaperdoll_BodyX + paperdoll_shoulder_coord[pBodyComplection][index][0]; + item_Y = pPaperdoll_BodyY + paperdoll_shoulder_coord[pBodyComplection][index][1]; + if ( !(item->uAttributes & 0xF0) ) + { + if ( item->uAttributes & 2 ) + pRenderer->DrawTransparentRedShade(item_X, item_Y, pIcons_LOD->GetTexture(paperdoll_armor_texture[pBodyComplection][index][1])); + else + { + if ( item->uAttributes & 1 ) + pRenderer->DrawTextureTransparent(item_X, item_Y, pIcons_LOD->GetTexture(paperdoll_armor_texture[pBodyComplection][index][1])); + else + pRenderer->DrawTransparentGreenShade(item_X, item_Y, pIcons_LOD->GetTexture(paperdoll_armor_texture[pBodyComplection][index][1])); + } + } + else + { + if ( (item->uAttributes & 0xF0) == ITEM_AURA_EFFECT_RED ) + container = "sptext01"; + if ( (item->uAttributes & 0xF0) == ITEM_AURA_EFFECT_BLUE ) + container = "sp28a"; + if ( (item->uAttributes & 0xF0) == ITEM_AURA_EFFECT_GREEN ) + container = "sp30a"; + if ( (item->uAttributes & 0xF0) == ITEM_AURA_EFFECT_PURPLE ) + container = "sp91a"; + _50C9A8_item_enchantment_timer -= pEventTimer->uTimeElapsed; + if ( _50C9A8_item_enchantment_timer <= 0 ) + { + _50C9A8_item_enchantment_timer = 0; + item->uAttributes &= 0xFFFFFF0Fu; + ptr_50C9A4 = 0; + } + pRenderer->DrawAura(item_X, item_Y, pIcons_LOD->GetTexture(paperdoll_armor_texture[pBodyComplection][index][1]), + pIcons_LOD->LoadTexturePtr(container, TEXTURE_16BIT_PALETTE), GetTickCount() * 0.1, 0, 255); + } + } + } + } //----------------------------------------------(Cloak collar/ )------------------------------------- if ( pPlayers[uPlayerID]->pEquipment.uCloak ) { @@ -1503,93 +1543,72 @@ //----- (0041A2D1) -------------------------------------------------------- void CharacterUI_InventoryTab_Draw(Player *player, bool a2) { - Texture *v7; // esi@6 - signed int v11; // edx@6 - int v13; // eax@13 - signed int v14; // edx@13 - int v15; // eax@13 - unsigned int v17; // edi@15 - Texture *pTexture; // ebx@24 - unsigned int uCellX; // [sp+30h] [bp-8h]@5 - unsigned int uCellY; // [sp+34h] [bp-4h]@5 + Texture *pTexture; // esi@6 + int v13; // eax@13 + int v15; // eax@13 + unsigned int v17; // edi@15 + unsigned int uCellX; // [sp+30h] [bp-8h]@5 + unsigned int uCellY; // [sp+34h] [bp-4h]@5 pRenderer->DrawTextureIndexed(8, 8, pIcons_LOD->GetTexture(uTextureID_CharacterUI_InventoryBackground)); if (a2) pRenderer->DrawTextureIndexed(8, 305, pIcons_LOD->LoadTexturePtr("fr_strip", TEXTURE_16BIT_PALETTE)); - - int i = 0; for (uint i = 0; i < 126; ++i) { - int v26 = (int)(player->pInventoryMatrix + i); - - if (player->pInventoryMatrix[i] <= 0) + if ( player->pInventoryMatrix[i] <= 0 ) continue; - - int item_idx = player->pInventoryMatrix[i]; - auto item = &player->pInventoryItemList[item_idx - 1]; - if (!item->uItemID) + if ( !player->pInventoryItemList[player->pInventoryMatrix[i] - 1].uItemID ) continue; - uCellY = 32 * (i / 14) + 17; uCellX = 32 * (i % 14) + 14; - uint item_texture_id = pIcons_LOD->LoadTexture(pItemsTable->pItems[item->uItemID].pIconName, TEXTURE_16BIT_PALETTE); - v7 = pIcons_LOD->GetTexture(item_texture_id); - - v11 = v7->uTextureWidth; - if (v11 < 14) - v11 = 14; - - if ( (v11 - 14) / 32 == 0 && v7->uTextureWidth < 32) - uCellX += (32 - v7->uTextureWidth) / 2; - v13 = v11 - 14; - LOBYTE(v13) = v13 & 0xE0; - v15 = v13 + 32; - v14 = v7->uTextureHeight; - if (v14 < 14 ) - v14 = 14; - v17 = uCellX + ((v15 - v7->uTextureWidth) >> 1) + pSRZBufferLineOffsets[uCellY + (( (int)((v14 - 14) & 0xFFFFFFE0) - v7->uTextureHeight + 32) >> 1)]; //added typecast. without it the value in the brackets got cat to unsigned which messed stuff up - - if (item->uAttributes & 0xF0) + uint item_texture_id = pIcons_LOD->LoadTexture(pItemsTable->pItems[player->pInventoryItemList[player->pInventoryMatrix[i] - 1].uItemID].pIconName, TEXTURE_16BIT_PALETTE); + pTexture = pIcons_LOD->GetTexture(item_texture_id); + if (pTexture->uTextureWidth < 14) + pTexture->uTextureWidth = 14; + if ( (pTexture->uTextureWidth - 14) / 32 == 0 && pTexture->uTextureWidth < 32) + uCellX += (32 - pTexture->uTextureWidth) / 2; + v13 = pTexture->uTextureWidth - 14; + LOBYTE(v13) = v13 & 0xE0; + v15 = v13 + 32; + if (pTexture->uTextureHeight < 14 ) + pTexture->uTextureHeight = 14; + v17 = uCellX + ((v15 - pTexture->uTextureWidth) >> 1) + pSRZBufferLineOffsets[uCellY + (( (int)((pTexture->uTextureHeight - 14) & 0xFFFFFFE0) - pTexture->uTextureHeight + 32) >> 1)]; //added typecast. without it the value in the brackets got cat to unsigned which messed stuff up + if (player->pInventoryItemList[player->pInventoryMatrix[i] - 1].uAttributes & 0xF0) { - switch (item->uAttributes & 0xF0) + switch (player->pInventoryItemList[player->pInventoryMatrix[i] - 1].uAttributes & 0xF0) { case ITEM_AURA_EFFECT_RED: pTexture = pIcons_LOD->LoadTexturePtr("sptext01", TEXTURE_16BIT_PALETTE); break; case ITEM_AURA_EFFECT_BLUE: pTexture = pIcons_LOD->LoadTexturePtr("sp28a", TEXTURE_16BIT_PALETTE); break; case ITEM_AURA_EFFECT_GREEN: pTexture = pIcons_LOD->LoadTexturePtr("sp30a", TEXTURE_16BIT_PALETTE); break; case ITEM_AURA_EFFECT_PURPLE: pTexture = pIcons_LOD->LoadTexturePtr("sp91a", TEXTURE_16BIT_PALETTE); break; } - _50C9A8_item_enchantment_timer -= pEventTimer->uTimeElapsed; if (_50C9A8_item_enchantment_timer <= 0) { _50C9A8_item_enchantment_timer = 0; - LOBYTE(item->uAttributes) &= 0xF; + LOBYTE(player->pInventoryItemList[player->pInventoryMatrix[i] - 1].uAttributes) &= 0xF; ptr_50C9A4 = 0; } - - pRenderer->DrawAura(uCellX, uCellY, v7, pTexture, GetTickCount() * 0.1, 0, 255); - ZBuffer_Fill(&pRenderer->pActiveZBuffer[v17], item_texture_id, item_idx); + pRenderer->DrawAura(uCellX, uCellY, pTexture, pTexture, GetTickCount() * 0.1, 0, 255); + ZBuffer_Fill(&pRenderer->pActiveZBuffer[v17], item_texture_id, player->pInventoryMatrix[i]); } else { - if (item->Identified() || pCurrentScreen != SCREEN_HOUSE) + if (player->pInventoryItemList[player->pInventoryMatrix[i] - 1].Identified() || pCurrentScreen != SCREEN_HOUSE) { - if (item->Broken()) - pRenderer->DrawTransparentRedShade(uCellX, uCellY, v7); + if (player->pInventoryItemList[player->pInventoryMatrix[i] - 1].Broken()) + pRenderer->DrawTransparentRedShade(uCellX, uCellY, pTexture); else - pRenderer->DrawTextureTransparent(uCellX, uCellY, v7); + pRenderer->DrawTextureTransparent(uCellX, uCellY, pTexture); } else - pRenderer->DrawTransparentGreenShade(uCellX, uCellY, v7); - - ZBuffer_Fill(&pRenderer->pActiveZBuffer[v17], item_texture_id, item_idx); + pRenderer->DrawTransparentGreenShade(uCellX, uCellY, pTexture); + ZBuffer_Fill(&pRenderer->pActiveZBuffer[v17], item_texture_id, player->pInventoryMatrix[i]); continue; } } } - - static void CharacterUI_DrawItem(int x, int y, ItemGen *item, int id) { auto item_texture = pIcons_LOD->LoadTexturePtr(pItemsTable->pItems[item->uItemID].pIconName, TEXTURE_16BIT_PALETTE); @@ -1627,140 +1646,103 @@ } } - //----- (0043E825) -------------------------------------------------------- void CharacterUI_DrawPaperdollWithRingOverlay(Player *player) { CharacterUI_DrawPaperdoll(player); - pRenderer->DrawTextureTransparent(0x1D9u, 0, pIcons_LOD->GetTexture(uTextureID_BACKHAND)); pRenderer->DrawTextureTransparent(0x1D4u, 0, pIcons_LOD->GetTexture(uTextureID_right_panel_loop)); - pRenderer->DrawTextureIndexed(pCharacterScreen_DetalizBtn->uX, - pCharacterScreen_DetalizBtn->uY, + pRenderer->DrawTextureIndexed(pCharacterScreen_DetalizBtn->uX, pCharacterScreen_DetalizBtn->uY, pIcons_LOD->GetTexture(uTextureID_detaliz_close_button)); - for (uint i = 0; i < 6; ++i) { if (!player->pEquipment.uRings[i]) continue; - static int pPaperdollRingsX[6] = {0x1EA, 0x21A, 0x248, 0x1EA, 0x21A, 0x248}; static int pPaperdollRingsY[6] = {0x0CA, 0x0CA, 0x0CA, 0x0FA, 0x0FA, 0x0FA}; - - CharacterUI_DrawItem(pPaperdollRingsX[i], - pPaperdollRingsY[i], - &player->pInventoryItemList[player->pEquipment.uRings[i] - 1], + CharacterUI_DrawItem(pPaperdollRingsX[i], pPaperdollRingsY[i], &player->pInventoryItemList[player->pEquipment.uRings[i] - 1], player->pEquipment.uRings[i]); } - - if (player->pEquipment.uAmulet) - { - CharacterUI_DrawItem(493, 91, - &player->pInventoryItemList[player->pEquipment.uAmulet - 1], - player->pEquipment.uAmulet); - } - + CharacterUI_DrawItem(493, 91, &player->pInventoryItemList[player->pEquipment.uAmulet - 1], player->pEquipment.uAmulet); if (player->pEquipment.uGlove) - { - CharacterUI_DrawItem(586, 88, - &player->pInventoryItemList[player->pEquipment.uGlove - 1], - player->pEquipment.uGlove); - } + CharacterUI_DrawItem(586, 88, &player->pInventoryItemList[player->pEquipment.uGlove - 1], player->pEquipment.uGlove); } //----- (0043BCA7) -------------------------------------------------------- void CharacterUI_LoadPaperdollTextures() { - int v0; // edi@7 - enum CHARACTER_RACE pRace; // ebx@7 - signed int pSex; // eax@7 int v3; // ebx@10 Player *pPlayer; // edi@12 - unsigned __int8 v5; // cl@12 int v6; // edi@16 unsigned int v7; // eax@16 Player *pPlayer2; // ebx@16 char *v9; // ebx@16 - char v10; // al@16 - signed int v11; // edi@21 unsigned int v22; // eax@76 int v23; // ecx@76 unsigned int v24; // eax@78 int v25; // ecx@78 - int v26; // ebx@79 unsigned int v27; // eax@80 int v28; // ecx@80 - int v30; // [sp+10h] [bp-28h]@5 signed int v32; // [sp+10h] [bp-28h]@75 signed int v33; // [sp+10h] [bp-28h]@77 int v34; // [sp+10h] [bp-28h]@79 int pItemTXTNum; // [sp+14h] [bp-24h]@75 int v37; // [sp+14h] [bp-24h]@77 signed int v38; // [sp+14h] [bp-24h]@79 - int v42; // [sp+20h] [bp-18h]@6 - int v43; // [sp+20h] [bp-18h]@73 char pContainer[128]; // [sp+24h] [bp-14h]@12 uTextureID_MAGNIF_B = pIcons_LOD->LoadTexture("MAGNIF-B", TEXTURE_16BIT_PALETTE); //if ( !pParty->uAlignment || pParty->uAlignment == 1 || pParty->uAlignment == 2 ) uTextureID_BACKDOLL = pIcons_LOD->LoadTexture("BACKDOLL", TEXTURE_16BIT_PALETTE); uTextureID_right_panel_loop = uTextureID_right_panel; - v30 = 0; uTextureID_BACKHAND = pIcons_LOD->LoadTexture("BACKHAND", TEXTURE_16BIT_PALETTE); uTextureID_detaliz_close_button = uExitCancelTextureId; - do + for ( uint i = 0; i < 4; ++i ) { - v42 = v30 + 1; - if ( sub_43EE77_ProbablyIfUnderwaterSuitIsEquipped(v30 + 1) ) + if ( sub_43EE77_ProbablyIfUnderwaterSuitIsEquipped(i + 1) ) { - v0 = v30; - pRace = pPlayers[v30 + 1]->GetRace(); - pSex = pPlayers[v30 + 1]->GetSexByVoice(); - if ( pRace && pRace != 1 && pRace != 2 )//race == 3 - v3 = (pSex != 0) + 3; + if ( pPlayers[i + 1]->GetRace() == CHARACTER_RACE_DWARF ) + v3 = (pPlayers[i + 1]->GetSexByVoice() != 0) + 3; else - v3 = (pSex != 0) + 1; + v3 = (pPlayers[i + 1]->GetSexByVoice() != 0) + 1; wsprintfA(pContainer, "pc23v%dBod", v3); - papredoll_dbods[v0] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);//Body texture + papredoll_dbods[i] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);//Body texture wsprintfA(pContainer, "pc23v%dlad", v3); - papredoll_dlads[v0] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);// Left Hand + papredoll_dlads[i] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);// Left Hand wsprintfA(pContainer, "pc23v%dlau", v3); - papredoll_dlaus[v0] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);// Left Hand2 + papredoll_dlaus[i] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);// Left Hand2 wsprintfA(pContainer, "pc23v%drh", v3); - papredoll_drhs[v0] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);// Right Hand + papredoll_drhs[i] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);// Right Hand wsprintfA(pContainer, "pc23v%dlh", v3); - papredoll_dlhs[v0] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);// Left Fist + papredoll_dlhs[i] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);// Left Fist wsprintfA(pContainer, "pc23v%dlhu", v3); - papredoll_dlhus[v0] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); // Left Fist 2 - pPlayer = pPlayers[v0 + 1]; - v5 = pPlayer->uCurrentFace; - if ( v5 == 12 || v5 == 13 ) - papredoll_dbrds[(char)v5] = 0; + papredoll_dlhus[i] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); // Left Fist 2 + pPlayer = pPlayers[i + 1]; + if ( pPlayer->uCurrentFace == 12 || pPlayer->uCurrentFace == 13 ) + papredoll_dbrds[(char)pPlayer->uCurrentFace] = 0; papredoll_flying_feet[pPlayer->uCurrentFace] = 0; - IsPlayerWearingWatersuit[v30 + 1] = 1; + IsPlayerWearingWatersuit[i + 1] = 1; } else { - papredoll_dbods[v30] = pIcons_LOD->LoadTexture(dbod_texnames_by_face[pPlayers[v30 + 1]->uCurrentFace], TEXTURE_16BIT_PALETTE); - papredoll_dlads[v30] = pIcons_LOD->LoadTexture(dlad_texnames_by_face[pPlayers[v30 + 1]->uCurrentFace], TEXTURE_16BIT_PALETTE); - papredoll_dlaus[v30] = pIcons_LOD->LoadTexture(dlau_texnames_by_face[pPlayers[v30 + 1]->uCurrentFace], TEXTURE_16BIT_PALETTE); - papredoll_drhs[v30] = pIcons_LOD->LoadTexture(drh_texnames_by_face[pPlayers[v30 + 1]->uCurrentFace], TEXTURE_16BIT_PALETTE); - papredoll_dlhs[v30] = pIcons_LOD->LoadTexture(dlh_texnames_by_face[pPlayers[v30 + 1]->uCurrentFace], TEXTURE_16BIT_PALETTE); - papredoll_dlhus[v30] = pIcons_LOD->LoadTexture(dlhu_texnames_by_face[pPlayers[v30 + 1]->uCurrentFace], TEXTURE_16BIT_PALETTE); - v10 = pPlayers[v30 + 1]->uCurrentFace; - if ( v10 == 12 || v10 == 13 ) + papredoll_dbods[i] = pIcons_LOD->LoadTexture(dbod_texnames_by_face[pPlayers[i + 1]->uCurrentFace], TEXTURE_16BIT_PALETTE); + papredoll_dlads[i] = pIcons_LOD->LoadTexture(dlad_texnames_by_face[pPlayers[i + 1]->uCurrentFace], TEXTURE_16BIT_PALETTE); + papredoll_dlaus[i] = pIcons_LOD->LoadTexture(dlau_texnames_by_face[pPlayers[i + 1]->uCurrentFace], TEXTURE_16BIT_PALETTE); + papredoll_drhs[i] = pIcons_LOD->LoadTexture(drh_texnames_by_face[pPlayers[i + 1]->uCurrentFace], TEXTURE_16BIT_PALETTE); + papredoll_dlhs[i] = pIcons_LOD->LoadTexture(dlh_texnames_by_face[pPlayers[i + 1]->uCurrentFace], TEXTURE_16BIT_PALETTE); + papredoll_dlhus[i] = pIcons_LOD->LoadTexture(dlhu_texnames_by_face[pPlayers[i + 1]->uCurrentFace], TEXTURE_16BIT_PALETTE); + if ( pPlayers[i + 1]->uCurrentFace == 12 || pPlayers[i + 1]->uCurrentFace == 13 ) { - wsprintfA(pContainer, "pc%02dbrd", v10 + 1); - papredoll_dbrds[v10] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); + wsprintfA(pContainer, "pc%02dbrd", pPlayers[i + 1]->uCurrentFace + 1); + papredoll_dbrds[pPlayers[i + 1]->uCurrentFace] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); } - wsprintfA(pContainer, "item281pc%02d", v10 + 1); - papredoll_flying_feet[pPlayers[v30 + 1]->uCurrentFace] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); - IsPlayerWearingWatersuit[v30 + 1] = 0; + wsprintfA(pContainer, "item281pc%02d", pPlayers[i + 1]->uCurrentFace + 1); + papredoll_flying_feet[pPlayers[i + 1]->uCurrentFace] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); + IsPlayerWearingWatersuit[i + 1] = 0; } - ++v30; } - while ( v42 < 4 ); + uTextureID_ar_up_up = pIcons_LOD->LoadTexture("ar_up_up", TEXTURE_16BIT_PALETTE); uTextureID_ar_up_dn = pIcons_LOD->LoadTexture("ar_up_dn", TEXTURE_16BIT_PALETTE); uTextureID_ar_dn_up = pIcons_LOD->LoadTexture("ar_dn_up", TEXTURE_16BIT_PALETTE); @@ -1770,15 +1752,15 @@ papredoll_dbrds[5] = pIcons_LOD->LoadTexture("ib-cd3-d", TEXTURE_16BIT_PALETTE); papredoll_dbrds[3] = pIcons_LOD->LoadTexture("ib-cd4-d", TEXTURE_16BIT_PALETTE); papredoll_dbrds[1] = pIcons_LOD->LoadTexture("ib-cd5-d", TEXTURE_16BIT_PALETTE); - for ( v11 = 0; v11 < 54; ++v11 )// test equipment + for ( uint i = 0; i < 54; ++i )// test equipment { - party_has_equipment[v11] = 0; - if ( pParty->pPickedItem.uItemID != v11 + 66 ) + party_has_equipment[i] = 0; + if ( pParty->pPickedItem.uItemID != i + 66 ) { - for ( uint i = 0; i < 4; ++i) + for ( uint j = 0; j < 4; ++j) { - if ( Player_has_item(v11 + 66, &pParty->pPlayers[i], 0) ) - party_has_equipment[v11] = 1; + if ( Player_has_item(i + 66, &pParty->pPlayers[j], 0) ) + party_has_equipment[i] = 1; } } } @@ -1806,7 +1788,6 @@ if (Player_has_item(ITEM_ELVEN_CHAINMAIL, player, 1)) byte_5111F6[16] = 1; } - for (uint i = 0; i < 2; ++i) { for ( uint j = 0; j < 5; ++j )//Belt @@ -1834,7 +1815,7 @@ if ( _43ED6F_check_party_races(true) ) papredoll_dbrds[11] = pIcons_LOD->LoadTexture("item092v3", TEXTURE_16BIT_PALETTE); } - v43 = 0; + //v43 = 0; for (uint i = 0; i < 4; ++i) { if ( sub_43EDB9_get_some_race_sex_relation_2(i) ) @@ -1845,11 +1826,11 @@ for ( v32 = 0; v32 < 13; ++v32 )//simple armor { GetItemTextureFilename(pContainer, pItemTXTNum, i + 1, 0); - paperdoll_armor_texture[i][v32][0] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); + paperdoll_armor_texture[i][v32][0] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);// armor GetItemTextureFilename(pContainer, pItemTXTNum, i + 1, 1); - paperdoll_armor_texture[i][v32][1] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); + paperdoll_armor_texture[i][v32][1] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);// shoulder 1 GetItemTextureFilename(pContainer, pItemTXTNum, i + 1, 2); - paperdoll_armor_texture[i][v32][2] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); + paperdoll_armor_texture[i][v32][2] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);// shoulder 2 pItemTXTNum++; } GetItemTextureFilename(pContainer, 516, i + 1, 0);//artefacts @@ -1911,190 +1892,112 @@ GetItemTextureFilename(pContainer, 550, i + 1, 1); paperdoll_cloak_collar_texture[i][9] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); } - else - { - v26 = v43; - } - v43 = v26 + 40; + //else + //{ + //v26 = v43; + //} + //v43 = v26 + 40; } } //----- (00419401) -------------------------------------------------------- void CharacterUI_SkillsTab_CreateButtons() - { - // unsigned int v0; // ecx@3 - GUIButton *pButton; // eax@3 - unsigned int current_Y; // esi@8 - int buttons_count; // [sp+10h] [bp-14h]@1 - int first_rows; // [sp+14h] [bp-10h]@19 - int skill_id; // [sp+18h] [bp-Ch]@8 - Player *curr_player; // [sp+1Ch] [bp-8h]@8 - int i; - int uCurrFontHeght; +{ + GUIButton *pButton; // eax@3 + unsigned int current_Y; // esi@8 + int buttons_count; // [sp+10h] [bp-14h]@1 + int first_rows; // [sp+14h] [bp-10h]@19 + int skill_id; // [sp+18h] [bp-Ch]@8 + Player *curr_player; // [sp+1Ch] [bp-8h]@8 + int i; + int uCurrFontHeght; - buttons_count = 0; - if ( dword_507CC0_activ_ch ) - CharacterUI_ReleaseButtons(); - dword_507CC0_activ_ch = uActiveCharacter; - for ( pButton = pGUIWindow_CurrentMenu->pControlsHead; pButton; pButton = pButton->pNext ) - { - if ( pButton->msg == UIMSG_InventoryLeftClick ) - { - dword_50698C_uX = pButton->uX; - dword_506988_uY = pButton->uY; - dword_506984_uZ = pButton->uZ; - dword_506980_uW = pButton->uW; - pButton->uW = 0; - pButton->uZ = 0; - pButton->uY = 0; - pButton->uX = 0; - } - } - first_rows = 0; - // a5 = pGUIWindow_CurrentMenu->uNumControls; - curr_player = &pParty->pPlayers[uActiveCharacter-1]; + buttons_count = 0; + if ( dword_507CC0_activ_ch ) + CharacterUI_ReleaseButtons(); + dword_507CC0_activ_ch = uActiveCharacter; + for ( pButton = pGUIWindow_CurrentMenu->pControlsHead; pButton; pButton = pButton->pNext ) + { + if ( pButton->msg == UIMSG_InventoryLeftClick ) + { + dword_50698C_uX = pButton->uX; + dword_506988_uY = pButton->uY; + dword_506984_uZ = pButton->uZ; + dword_506980_uW = pButton->uW; + pButton->uW = 0; + pButton->uZ = 0; + pButton->uY = 0; + pButton->uX = 0; + } + } + first_rows = 0; + // a5 = pGUIWindow_CurrentMenu->uNumControls; + curr_player = &pParty->pPlayers[uActiveCharacter-1]; - uCurrFontHeght=pFontLucida->uFontHeight; - current_Y = 2 *uCurrFontHeght + 13; - for(i=0; i<9;++i) - { - skill_id = pWeaponSkills[i]; - if ( curr_player->pActiveSkills[skill_id] & 0x3F ) - { - current_Y += uCurrFontHeght - 3; - ++buttons_count; - ++first_rows; - pGUIWindow_CurrentMenu->CreateButton(24, current_Y, 204, uCurrFontHeght - 3, 3, skill_id | 0x8000, UIMSG_SkillUp, skill_id, 0, "", 0, 0); - } - } - if ( !first_rows ) - current_Y += uCurrFontHeght - 3; - current_Y += 2 * uCurrFontHeght - 6; - for(i=0; i<9;++i) - { - skill_id = pMagicSkills[i]; - if ( curr_player->pActiveSkills[skill_id] & 0x3F && buttons_count < 15 ) - { - current_Y += uCurrFontHeght - 3; - ++buttons_count; - pGUIWindow_CurrentMenu->CreateButton(24, current_Y, 204, uCurrFontHeght - 3, 3, skill_id | 0x8000, UIMSG_SkillUp, skill_id, 0, "", 0, 0); - } - } - first_rows = 0; - current_Y = 2 * uCurrFontHeght + 13; - for(i=0; i<5;++i) - { - skill_id = pArmorSkills[i]; - if ( curr_player->pActiveSkills[skill_id] & 0x3F ) - { - current_Y+= uCurrFontHeght - 3; - ++buttons_count; - ++first_rows; - pGUIWindow_CurrentMenu->CreateButton(246, current_Y, 204, uCurrFontHeght - 3, 3, skill_id | 0x8000, UIMSG_SkillUp, skill_id, 0, "", 0, 0); - } - } - if ( !first_rows ) - current_Y += uCurrFontHeght - 3; - current_Y += 2 * uCurrFontHeght - 6; - for(i=0; i<12; ++i) - { - skill_id = pMiscSkills[i]; - if ( curr_player->pActiveSkills[skill_id] & 0x3F ) - { - current_Y += uCurrFontHeght - 3; - ++buttons_count; - pGUIWindow_CurrentMenu->CreateButton(246, current_Y, 204, uCurrFontHeght - 3, 3, skill_id | 0x8000, UIMSG_SkillUp, skill_id, 0, "", 0, 0); - } - } + uCurrFontHeght=pFontLucida->uFontHeight; + current_Y = 2 *uCurrFontHeght + 13; + for( i = 0; i < 9; ++i ) + { + skill_id = pWeaponSkills[i]; + if ( curr_player->pActiveSkills[skill_id] & 0x3F ) + { + current_Y += uCurrFontHeght - 3; + ++buttons_count; + ++first_rows; + pGUIWindow_CurrentMenu->CreateButton(24, current_Y, 204, uCurrFontHeght - 3, 3, skill_id | 0x8000, UIMSG_SkillUp, skill_id, 0, "", 0, 0); + } + } + if ( !first_rows ) + current_Y += uCurrFontHeght - 3; + current_Y += 2 * uCurrFontHeght - 6; + for ( i = 0; i < 9; ++i ) + { + skill_id = pMagicSkills[i]; + if ( curr_player->pActiveSkills[skill_id] & 0x3F && buttons_count < 15 ) + { + current_Y += uCurrFontHeght - 3; + ++buttons_count; + pGUIWindow_CurrentMenu->CreateButton(24, current_Y, 204, uCurrFontHeght - 3, 3, skill_id | 0x8000, UIMSG_SkillUp, skill_id, 0, "", 0, 0); + } + } + first_rows = 0; + current_Y = 2 * uCurrFontHeght + 13; + for ( i = 0; i < 5; ++i ) + { + skill_id = pArmorSkills[i]; + if ( curr_player->pActiveSkills[skill_id] & 0x3F ) + { + current_Y+= uCurrFontHeght - 3; + ++buttons_count; + ++first_rows; + pGUIWindow_CurrentMenu->CreateButton(246, current_Y, 204, uCurrFontHeght - 3, 3, skill_id | 0x8000, UIMSG_SkillUp, skill_id, 0, "", 0, 0); + } + } + if ( !first_rows ) + current_Y += uCurrFontHeght - 3; + current_Y += 2 * uCurrFontHeght - 6; + for ( i = 0; i < 12; ++i ) + { + skill_id = pMiscSkills[i]; + if ( curr_player->pActiveSkills[skill_id] & 0x3F ) + { + current_Y += uCurrFontHeght - 3; + ++buttons_count; + pGUIWindow_CurrentMenu->CreateButton(246, current_Y, 204, uCurrFontHeght - 3, 3, skill_id | 0x8000, UIMSG_SkillUp, skill_id, 0, "", 0, 0); + } + } - if ( buttons_count ) - pGUIWindow_CurrentMenu->_41D08F_set_keyboard_control_group(buttons_count, 1, 0, pGUIWindow_CurrentMenu->uNumControls); - } - - + if ( buttons_count ) + pGUIWindow_CurrentMenu->_41D08F_set_keyboard_control_group(buttons_count, 1, 0, pGUIWindow_CurrentMenu->uNumControls); +} //----- (00418511) -------------------------------------------------------- - void CharacterUI_StatsTab_Draw( Player *player ) - { - //Player *pPlayer; // edi@1 - //unsigned int v4; // eax@2 - int v7; // ebp@4 - int v8; // eax@4 - unsigned int v9; // eax@4 - int v10; // ST34_4@4 - int v13; // ebp@4 - int v14; // eax@4 - unsigned int v15; // eax@4 - int v19; // ebp@4 - int v20; // eax@4 - unsigned int v21; // eax@4 - int v25; // ebp@4 - int v26; // eax@4 - unsigned int v27; // eax@4 - int v31; // ebp@4 - int v32; // eax@4 - unsigned int v33; // eax@4 - int v37; // ebp@4 - int v38; // eax@4 - unsigned int v39; // eax@4 - int v43; // ebp@4 - int v44; // eax@4 - unsigned int v45; // eax@4 - signed int v49; // eax@6 - unsigned int v50; // eax@6 - int v53; // eax@8 - unsigned int v54; // eax@8 - int v58; // ebp@8 - int v59; // eax@8 - unsigned int v60; // eax@8 - unsigned int v62; // eax@8 - signed int v64; // eax@8 - //unsigned __int8 v66; // al@8 - char *v67; // eax@9 - signed int v70; // ebp@11 - signed int v71; // eax@11 - unsigned int v72; // eax@11 - int v75; // ebp@13 - int v76; // eax@13 - unsigned int v77; // eax@13 - char *v78; // ecx@14 - unsigned int v81; // eax@16 - int v83; // eax@16 - char *v85; // eax@16 - int v87; // eax@16 - char *v89; // eax@16 - int v90; // eax@16 - unsigned int v92; // eax@19 - int v93; // eax@19 - unsigned int v95; // eax@22 - int v96; // eax@22 - unsigned int v98; // eax@25 - int v99; // eax@25 - unsigned int v101; // eax@27 - int v102; // eax@27 - unsigned int v104; // eax@30 - unsigned int v106; // eax@32 - int v107; // eax@33 - unsigned int v109; // eax@36 - unsigned int v111; // eax@38 - const char *a2; // [sp+14h] [bp-Ch]@4 - const char *a2a; // [sp+14h] [bp-Ch]@6 - const char *a2b; // [sp+14h] [bp-Ch]@11 - const char *a2c; // [sp+14h] [bp-Ch]@16 - const char *a2d; // [sp+14h] [bp-Ch]@19 - const char *a2e; // [sp+14h] [bp-Ch]@22 - const char *a2f; // [sp+14h] [bp-Ch]@25 - const char *a2g; // [sp+14h] [bp-Ch]@27 - const char *a2h; // [sp+14h] [bp-Ch]@33 - int v131; // [sp+18h] [bp-8h]@16 - int v132; // [sp+18h] [bp-8h]@19 - int v133; // [sp+18h] [bp-8h]@22 - int v134; // [sp+18h] [bp-8h]@25 - int v135; // [sp+18h] [bp-8h]@27 - int v136; // [sp+18h] [bp-8h]@33 +void CharacterUI_StatsTab_Draw( Player *player ) +{ + int pY; // ST34_4@4 + char *pText; // eax@9 + const char *a2; // [sp+14h] [bp-Ch]@4 - //pPlayer = &pParty->pPlayers[uPlayerID-1]; - //pPlayer = player; pRenderer->DrawTextureIndexed(8, 8, pIcons_LOD->LoadTexturePtr("fr_stats", TEXTURE_16BIT_PALETTE)); sprintf(pTmpBuf.data(), "\f%05d", ui_character_header_text_color); sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[429], player->pName, pClassNames[player->classType]);//"^Pi[%s] %s" / "%s the %s" @@ -2106,358 +2009,336 @@ strcat(pTmpBuf.data(), pTmpBuf2.data()); pGUIWindow_CurrentMenu->DrawText(pFontArrus, 26, 18, 0, pTmpBuf.data(), 0, 0, 0); - v10 = 53; - v7 = player->GetBaseStrength(); - v8 = player->GetActualMight(); - v9 = UI_GetHealthManaStringColor(v8, v7); - sprintf(pTmpBuf.data(), "%s\f%05u\r424%d\f00000 /\t185%d\n", pGlobalTXT_LocalizationStrings[144], v9, v8, v7);//Might - pGUIWindow_CurrentMenu->DrawText(pFontArrus, 26, v10, 0, pTmpBuf.data(), 0, 0, 0); + //First column( ) + pY = 53; + sprintf(pTmpBuf.data(), "%s\f%05u\r424%d\f00000 /\t185%d\n", pGlobalTXT_LocalizationStrings[144], + UI_GetHealthManaStringColor(player->GetActualMight(), player->GetBaseStrength()), + player->GetActualMight(), player->GetBaseStrength());//Might + pGUIWindow_CurrentMenu->DrawText(pFontArrus, 26, pY, 0, pTmpBuf.data(), 0, 0, 0); - v10 += LOBYTE(pFontArrus->uFontHeight) - 2; - v13 = player->GetBaseIntelligence(); - v14 = player->GetActualIntelligence(); - v15 = UI_GetHealthManaStringColor(v14, v13); - sprintf(pTmpBuf.data(), "%s\f%05u\r424%d\f00000 /\t185%d\n", pGlobalTXT_LocalizationStrings[116], v15, v14, v13);//Intellect - pGUIWindow_CurrentMenu->DrawText(pFontArrus, 26, v10, 0, pTmpBuf.data(), 0, 0, 0); + pY += LOBYTE(pFontArrus->uFontHeight) - 2; + sprintf(pTmpBuf.data(), "%s\f%05u\r424%d\f00000 /\t185%d\n", pGlobalTXT_LocalizationStrings[116], + UI_GetHealthManaStringColor(player->GetActualIntelligence(), player->GetBaseIntelligence()), + player->GetActualIntelligence(), player->GetBaseIntelligence());//Intellect + pGUIWindow_CurrentMenu->DrawText(pFontArrus, 26, pY, 0, pTmpBuf.data(), 0, 0, 0); - v10 += LOBYTE(pFontArrus->uFontHeight) - 2; - v19 = player->GetBaseWillpower(); - v20 = player->GetActualWillpower(); - v21 = UI_GetHealthManaStringColor(v20, v19); - sprintf(pTmpBuf.data(), "%s\f%05u\r424%d\f00000 /\t185%d\n", pGlobalTXT_LocalizationStrings[163], v21, v20, v19);// - pGUIWindow_CurrentMenu->DrawText(pFontArrus, 26, v10, 0, pTmpBuf.data(), 0, 0, 0); + pY += LOBYTE(pFontArrus->uFontHeight) - 2; + sprintf(pTmpBuf.data(), "%s\f%05u\r424%d\f00000 /\t185%d\n", pGlobalTXT_LocalizationStrings[163], + UI_GetHealthManaStringColor(player->GetActualWillpower(), player->GetBaseWillpower()), + player->GetActualWillpower(), player->GetBaseWillpower());// + pGUIWindow_CurrentMenu->DrawText(pFontArrus, 26, pY, 0, pTmpBuf.data(), 0, 0, 0); - v10 += LOBYTE(pFontArrus->uFontHeight) - 2; - v25 = player->GetBaseEndurance(); - v26 = player->GetActualEndurance(); - v27 = UI_GetHealthManaStringColor(v26, v25); - sprintf(pTmpBuf.data(), "%s\f%05u\r424%d\f00000 /\t185%d\n", pGlobalTXT_LocalizationStrings[75], v27, v26, v25);// - pGUIWindow_CurrentMenu->DrawText(pFontArrus, 26, v10, 0, pTmpBuf.data(), 0, 0, 0); + pY += LOBYTE(pFontArrus->uFontHeight) - 2; + sprintf(pTmpBuf.data(), "%s\f%05u\r424%d\f00000 /\t185%d\n", pGlobalTXT_LocalizationStrings[75], + UI_GetHealthManaStringColor(player->GetActualEndurance(), player->GetBaseEndurance()), + player->GetActualEndurance(), player->GetBaseEndurance());// + pGUIWindow_CurrentMenu->DrawText(pFontArrus, 26, pY, 0, pTmpBuf.data(), 0, 0, 0); + + pY += LOBYTE(pFontArrus->uFontHeight) - 2; + sprintf(pTmpBuf.data(), "%s\f%05u\r424%d\f00000 /\t185%d\n", pGlobalTXT_LocalizationStrings[1], + UI_GetHealthManaStringColor(player->GetActualAccuracy(), player->GetBaseAccuracy()), + player->GetActualAccuracy(), player->GetBaseAccuracy()); + pGUIWindow_CurrentMenu->DrawText(pFontArrus, 26, pY, 0, pTmpBuf.data(), 0, 0, 0); - v10 += LOBYTE(pFontArrus->uFontHeight) - 2; - v31 = player->GetBaseAccuracy(); - v32 = player->GetActualAccuracy(); - v33 = UI_GetHealthManaStringColor(v32, v31); - sprintf(pTmpBuf.data(), "%s\f%05u\r424%d\f00000 /\t185%d\n", pGlobalTXT_LocalizationStrings[1], v33, v32, v31); - pGUIWindow_CurrentMenu->DrawText(pFontArrus, 26, v10, 0, pTmpBuf.data(), 0, 0, 0); + pY += LOBYTE(pFontArrus->uFontHeight) - 2; + sprintf(pTmpBuf.data(), "%s\f%05u\r424%d\f00000 /\t185%d\n", pGlobalTXT_LocalizationStrings[211], + UI_GetHealthManaStringColor(player->GetActualSpeed(), player->GetBaseSpeed()), + player->GetActualSpeed(), player->GetBaseSpeed()); + pGUIWindow_CurrentMenu->DrawText(pFontArrus, 26, pY, 0, pTmpBuf.data(), 0, 0, 0); - v10 += LOBYTE(pFontArrus->uFontHeight) - 2; - v37 = player->GetBaseSpeed(); - v38 = player->GetActualSpeed(); - v39 = UI_GetHealthManaStringColor(v38, v37); - sprintf(pTmpBuf.data(), "%s\f%05u\r424%d\f00000 /\t185%d\n", pGlobalTXT_LocalizationStrings[211], v39, v38, v37); - pGUIWindow_CurrentMenu->DrawText(pFontArrus, 26, v10, 0, pTmpBuf.data(), 0, 0, 0); + pY += LOBYTE(pFontArrus->uFontHeight) - 2; + sprintf(pTmpBuf.data(), "%s\f%05u\r424%d\f00000 /\t185%d\n\n", pGlobalTXT_LocalizationStrings[136], + UI_GetHealthManaStringColor(player->GetActualLuck(), player->GetBaseLuck()), + player->GetActualLuck(), player->GetBaseLuck()); + pGUIWindow_CurrentMenu->DrawText(pFontArrus, 26, pY, 0, pTmpBuf.data(), 0, 0, 0); - v10 += LOBYTE(pFontArrus->uFontHeight) - 2; - v43 = player->GetBaseLuck(); - v44 = player->GetActualLuck(); - v45 = UI_GetHealthManaStringColor(v44, v43); - sprintf(pTmpBuf.data(), "%s\f%05u\r424%d\f00000 /\t185%d\n\n", pGlobalTXT_LocalizationStrings[136], v45, v44, v43); - pGUIWindow_CurrentMenu->DrawText(pFontArrus, 26, v10, 0, pTmpBuf.data(), 0, 0, 0); + a2 = "%s\f%05u\r424%d\f00000 /\t185%d\n"; + if ( player->GetMaxHealth() >= 1000 ) + a2 = "%s\f%05u\r388%d\f00000 / %d\n"; + pY += 2 * LOBYTE(pFontArrus->uFontHeight) + 5; + sprintf(pTmpBuf.data(), a2, pGlobalTXT_LocalizationStrings[108], + UI_GetHealthManaStringColor(player->sHealth, player->GetMaxHealth()), + player->sHealth, player->GetMaxHealth()); + pGUIWindow_CurrentMenu->DrawText(pFontArrus, 26, pY, 0, pTmpBuf.data(), 0, 0, 0); - a2 = "%s\f%05u\r424%d\f00000 /\t185%d\n"; - v10 += 2 * LOBYTE(pFontArrus->uFontHeight) + 5; - if ( player->GetMaxHealth() >= 1000 ) - a2 = "%s\f%05u\r388%d\f00000 / %d\n"; - v49 = player->GetMaxHealth(); - v50 = UI_GetHealthManaStringColor(player->sHealth, v49); - sprintf(pTmpBuf.data(), a2, pGlobalTXT_LocalizationStrings[108], v50, player->sHealth, v49); - pGUIWindow_CurrentMenu->DrawText(pFontArrus, 26, v10, 0, pTmpBuf.data(), 0, 0, 0); - - a2a = "%s\f%05u\r424%d\f00000 /\t185%d\n"; - v10 += LOBYTE(pFontArrus->uFontHeight) - 2; - if ( player->GetMaxMana() >= 1000 ) - a2a = "%s\f%05u\r388%d\f00000 / %d\n"; - v53 = player->GetMaxMana(); - v54 = UI_GetHealthManaStringColor(player->sMana, v53); - sprintf(pTmpBuf.data(), a2a, pGlobalTXT_LocalizationStrings[212], v54, player->sMana, v53); - pGUIWindow_CurrentMenu->DrawText(pFontArrus, 26, v10, 0, pTmpBuf.data(), 0, 0, 0); + a2 = "%s\f%05u\r424%d\f00000 /\t185%d\n"; + if ( player->GetMaxMana() >= 1000 ) + a2 = "%s\f%05u\r388%d\f00000 / %d\n"; + pY += LOBYTE(pFontArrus->uFontHeight) - 2; + sprintf(pTmpBuf.data(), a2, pGlobalTXT_LocalizationStrings[212], + UI_GetHealthManaStringColor(player->sMana, player->GetMaxMana()), + player->sMana, player->GetMaxMana()); + pGUIWindow_CurrentMenu->DrawText(pFontArrus, 26, pY, 0, pTmpBuf.data(), 0, 0, 0); - v10 += LOBYTE(pFontArrus->uFontHeight) - 2; - v58 = player->GetBaseAC(); - v59 = player->GetActualAC(); - v60 = UI_GetHealthManaStringColor(v59, v58); - sprintf(pTmpBuf.data(), "%s\f%05u\r424%d\f00000 /\t185%d\n\n", pGlobalTXT_LocalizationStrings[12], v60, v59, v58); - pGUIWindow_CurrentMenu->DrawText(pFontArrus, 26, v10, 0, pTmpBuf.data(), 0, 0, 0); + pY += LOBYTE(pFontArrus->uFontHeight) - 2; + sprintf(pTmpBuf.data(), "%s\f%05u\r424%d\f00000 /\t185%d\n\n", pGlobalTXT_LocalizationStrings[12], + UI_GetHealthManaStringColor(player->GetActualAC(), player->GetBaseAC()), + player->GetActualAC(), player->GetBaseAC()); + pGUIWindow_CurrentMenu->DrawText(pFontArrus, 26, pY, 0, pTmpBuf.data(), 0, 0, 0); - v10 += 2 * LOBYTE(pFontArrus->uFontHeight) - 2; - v62 = player->GetMajorConditionIdx(); - v64 = GetConditionDrawColor(v62); - sprintf(pTmpBuf.data(), "%s: \f%05d%s\n", pGlobalTXT_LocalizationStrings[47], v64, aCharacterConditionNames[v62]); - pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x1Au, v10, 0, pTmpBuf.data(), 226, 0); + pY += 2 * LOBYTE(pFontArrus->uFontHeight) - 2; + sprintf(pTmpBuf.data(), "%s: \f%05d%s\n", pGlobalTXT_LocalizationStrings[47], GetConditionDrawColor(player->GetMajorConditionIdx()), + aCharacterConditionNames[player->GetMajorConditionIdx()]);// + pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 26, pY, 0, pTmpBuf.data(), 226, 0); - v10 += LOBYTE(pFontArrus->uFontHeight) + - 1; - if (player->uQuickSpell) - v67 = pSpellStats->pInfos[player->uQuickSpell].pShortName; - else - v67 = pGlobalTXT_LocalizationStrings[153]; - sprintf(pTmpBuf.data(), "%s: %s", pGlobalTXT_LocalizationStrings[172], v67); - pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x1Au, v10, 0, pTmpBuf.data(), 226, 0); + pY += LOBYTE(pFontArrus->uFontHeight) + - 1; + pText = pGlobalTXT_LocalizationStrings[153];// + if (player->uQuickSpell) + pText = pSpellStats->pInfos[player->uQuickSpell].pShortName; + sprintf(pTmpBuf.data(), "%s: %s", pGlobalTXT_LocalizationStrings[172], pText);//. + pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 26, pY, 0, pTmpBuf.data(), 226, 0); - v10 = 50; - v70 = player->GetBaseAge(); - v71 = player->GetActualAge(); - v72 = UI_GetHealthManaStringColor(v71, v70); - sprintf(pTmpBuf.data(), "%s\f%05u\t100%d\f00000 / %d\n", pGlobalTXT_LocalizationStrings[5], v72, v71, v70); - pGUIWindow_CurrentMenu->DrawText(pFontArrus, 266, v10, 0, pTmpBuf.data(), 0, 0, 0); + //Second column ( ) + pY = 50; + sprintf(pTmpBuf.data(), "%s\f%05u\t100%d\f00000 / %d\n", pGlobalTXT_LocalizationStrings[5], + UI_GetHealthManaStringColor(player->GetActualAge(), player->GetBaseAge()), + player->GetActualAge(), player->GetBaseAge()); + pGUIWindow_CurrentMenu->DrawText(pFontArrus, 266, pY, 0, pTmpBuf.data(), 0, 0, 0); - a2b = "%s\f%05u\t100%d\f00000 / %d\n"; - v10 += LOBYTE(pFontArrus->uFontHeight) - 2; - if ( player->GetBaseLevel() > 99 ) - a2b = "%s\f%05u\t180%d\f00000 / %d\n"; - v75 = player->GetBaseLevel(); - v76 = player->GetActualLevel(); - v77 = UI_GetHealthManaStringColor(v76, v75); - sprintf(pTmpBuf.data(), a2b, pGlobalTXT_LocalizationStrings[131], v77, v76, v75); - pGUIWindow_CurrentMenu->DrawText(pFontArrus, 266, v10, 0, pTmpBuf.data(), 0, 0, 0); + a2 = "%s\f%05u\t100%d\f00000 / %d\n"; + if ( player->GetBaseLevel() > 99 ) + a2 = "%s\f%05u\t180%d\f00000 / %d\n"; + pY += LOBYTE(pFontArrus->uFontHeight) - 2; + sprintf(pTmpBuf.data(), a2, pGlobalTXT_LocalizationStrings[131],//. + UI_GetHealthManaStringColor(player->GetActualLevel(), player->GetBaseLevel()), + player->GetActualLevel(), player->GetBaseLevel()); + pGUIWindow_CurrentMenu->DrawText(pFontArrus, 266, pY, 0, pTmpBuf.data(), 0, 0, 0); - v10 += LOBYTE(pFontArrus->uFontHeight) - 2; - if (player->uExperience <= 9999999) - v78 = pGlobalTXT_LocalizationStrings[83]; // "Experience" - else - v78 = pGlobalTXT_LocalizationStrings[17]; // "Exp." - v81 = player->GetExperienceDisplayColor(); - sprintf(pTmpBuf.data(), "%s\r180\f%05d%lu\f00000\n\n", v78, v81, LODWORD(player->uExperience)); - pGUIWindow_CurrentMenu->DrawText(pFontArrus, 266, v10, 0, pTmpBuf.data(), 0, 0, 0); + pY += LOBYTE(pFontArrus->uFontHeight) - 2; + pText = pGlobalTXT_LocalizationStrings[17]; // "Exp." + if (player->uExperience <= 9999999) + pText = pGlobalTXT_LocalizationStrings[83]; // "Experience" + sprintf(pTmpBuf.data(), "%s\r180\f%05d%lu\f00000\n\n", pText, player->GetExperienceDisplayColor(), LODWORD(player->uExperience)); + pGUIWindow_CurrentMenu->DrawText(pFontArrus, 266, pY, 0, pTmpBuf.data(), 0, 0, 0); - v10 += 2 * LOBYTE(pFontArrus->uFontHeight); - v83 = player->GetActualAttack(0); - sprintf(pTmpBuf.data(), "%s\t100%+d\n", pGlobalTXT_LocalizationStrings[18], v83); - pGUIWindow_CurrentMenu->DrawText(pFontArrus, 266, v10, 0, pTmpBuf.data(), 0, 0, 0); + pY += 2 * LOBYTE(pFontArrus->uFontHeight); + sprintf(pTmpBuf.data(), "%s\t100%+d\n", pGlobalTXT_LocalizationStrings[18], player->GetActualAttack(0)); + pGUIWindow_CurrentMenu->DrawText(pFontArrus, 266, pY, 0, pTmpBuf.data(), 0, 0, 0); - v10 += LOBYTE(pFontArrus->uFontHeight) - 2; - v85 = player->GetMeleeDamageString(); - sprintf(pTmpBuf.data(), "%s\t100 %s\n", pGlobalTXT_LocalizationStrings[53], v85); - pGUIWindow_CurrentMenu->DrawText(pFontArrus, 266, v10, 0, pTmpBuf.data(), 0, 0, 0); + pY += LOBYTE(pFontArrus->uFontHeight) - 2; + sprintf(pTmpBuf.data(), "%s\t100 %s\n", pGlobalTXT_LocalizationStrings[53], player->GetMeleeDamageString()); + pGUIWindow_CurrentMenu->DrawText(pFontArrus, 266, pY, 0, pTmpBuf.data(), 0, 0, 0); - v10 += LOBYTE(pFontArrus->uFontHeight) - 2; - v87 = player->GetRangedAttack(); - sprintf(pTmpBuf.data(), "%s\t100%+d\n", pGlobalTXT_LocalizationStrings[203], v87); - pGUIWindow_CurrentMenu->DrawText(pFontArrus, 266, v10, 0, pTmpBuf.data(), 0, 0, 0); + pY += LOBYTE(pFontArrus->uFontHeight) - 2; + sprintf(pTmpBuf.data(), "%s\t100%+d\n", pGlobalTXT_LocalizationStrings[203], player->GetRangedAttack()); + pGUIWindow_CurrentMenu->DrawText(pFontArrus, 266, pY, 0, pTmpBuf.data(), 0, 0, 0); - v10 += LOBYTE(pFontArrus->uFontHeight) - 2; - v89 = player->GetRangedDamageString(); - sprintf(pTmpBuf.data(), "%s\t100 %s\n\n", pGlobalTXT_LocalizationStrings[53], v89); - pGUIWindow_CurrentMenu->DrawText(pFontArrus, 266, v10, 0, pTmpBuf.data(), 0, 0, 0); + pY += LOBYTE(pFontArrus->uFontHeight) - 2; + sprintf(pTmpBuf.data(), "%s\t100 %s\n\n", pGlobalTXT_LocalizationStrings[53], player->GetRangedDamageString()); + pGUIWindow_CurrentMenu->DrawText(pFontArrus, 266, pY, 0, pTmpBuf.data(), 0, 0, 0); - a2c = format_4E2E10; - v10 += 2 * LOBYTE(pFontArrus->uFontHeight) - 4; - v131 = player->GetActualResistance(CHARACTER_ATTRIBUTE_RESIST_FIRE); - v90 = player->GetBaseResistance(CHARACTER_ATTRIBUTE_RESIST_FIRE); - if ( v131 > 99 || v90 > 99 ) - a2c = "%s\f%05u\t180%d\f00000 / %d\n"; - v92 = UI_GetHealthManaStringColor(v131, v90); - sprintf(pTmpBuf.data(), a2c, pGlobalTXT_LocalizationStrings[87], v92, v131, v90); - pGUIWindow_CurrentMenu->DrawText(pFontArrus, 266, v10, 0, pTmpBuf.data(), 0, 0, 0); + a2 = format_4E2E10; + if ( player->GetActualResistance(CHARACTER_ATTRIBUTE_RESIST_FIRE) > 99 || player->GetBaseResistance(CHARACTER_ATTRIBUTE_RESIST_FIRE) > 99 ) + a2 = "%s\f%05u\t180%d\f00000 / %d\n"; + pY += 2 * LOBYTE(pFontArrus->uFontHeight) - 4; + sprintf(pTmpBuf.data(), a2, pGlobalTXT_LocalizationStrings[87], + UI_GetHealthManaStringColor(player->GetActualResistance(CHARACTER_ATTRIBUTE_RESIST_FIRE), player->GetBaseResistance(CHARACTER_ATTRIBUTE_RESIST_FIRE)), + player->GetActualResistance(CHARACTER_ATTRIBUTE_RESIST_FIRE), player->GetBaseResistance(CHARACTER_ATTRIBUTE_RESIST_FIRE)); + pGUIWindow_CurrentMenu->DrawText(pFontArrus, 266, pY, 0, pTmpBuf.data(), 0, 0, 0); - a2d = format_4E2E10; - v10 += LOBYTE(pFontArrus->uFontHeight) - 2; - v132 = player->GetActualResistance(CHARACTER_ATTRIBUTE_RESIST_AIR); - v93 = player->GetBaseResistance(CHARACTER_ATTRIBUTE_RESIST_AIR); - if ( v132 > 99 || v93 > 99 ) - a2d = "%s\f%05u\t180%d\f00000 / %d\n"; - v95 = UI_GetHealthManaStringColor(v132, v93); - sprintf(pTmpBuf.data(), a2d, pGlobalTXT_LocalizationStrings[6], v95, v132, v93); - pGUIWindow_CurrentMenu->DrawText(pFontArrus, 266, v10, 0, pTmpBuf.data(), 0, 0, 0); + a2 = format_4E2E10; + if ( player->GetActualResistance(CHARACTER_ATTRIBUTE_RESIST_AIR) > 99 || player->GetBaseResistance(CHARACTER_ATTRIBUTE_RESIST_AIR) > 99 ) + a2 = "%s\f%05u\t180%d\f00000 / %d\n"; + pY += LOBYTE(pFontArrus->uFontHeight) - 2; + sprintf(pTmpBuf.data(), a2, pGlobalTXT_LocalizationStrings[6], + UI_GetHealthManaStringColor(player->GetActualResistance(CHARACTER_ATTRIBUTE_RESIST_AIR), player->GetBaseResistance(CHARACTER_ATTRIBUTE_RESIST_AIR)), + player->GetActualResistance(CHARACTER_ATTRIBUTE_RESIST_AIR), player->GetBaseResistance(CHARACTER_ATTRIBUTE_RESIST_AIR)); + pGUIWindow_CurrentMenu->DrawText(pFontArrus, 266, pY, 0, pTmpBuf.data(), 0, 0, 0); - a2e = format_4E2E10; - v10 += LOBYTE(pFontArrus->uFontHeight) - 2; - v133 = player->GetActualResistance(CHARACTER_ATTRIBUTE_RESIST_WATER); - v96 = player->GetBaseResistance(CHARACTER_ATTRIBUTE_RESIST_WATER); - if ( v133 > 99 || v96 > 99 ) - a2e = "%s\f%05u\t180%d\f00000 / %d\n"; - v98 = UI_GetHealthManaStringColor(v133, v96); - sprintf(pTmpBuf.data(), a2e, pGlobalTXT_LocalizationStrings[240], v98, v133, v96); - pGUIWindow_CurrentMenu->DrawText(pFontArrus, 266, v10, 0, pTmpBuf.data(), 0, 0, 0); - - a2f = format_4E2E10; - v10 += LOBYTE(pFontArrus->uFontHeight) - 2; - v134 = player->GetActualResistance(CHARACTER_ATTRIBUTE_RESIST_EARTH); - v99 = player->GetBaseResistance(CHARACTER_ATTRIBUTE_RESIST_EARTH); - if ( v134 > 99 ) - a2f = "%s\f%05u\t180%d\f00000 / %d\n"; - v101 = UI_GetHealthManaStringColor(v134, v99); - sprintf(pTmpBuf.data(), a2f, pGlobalTXT_LocalizationStrings[70], v101, v134, v99); - pGUIWindow_CurrentMenu->DrawText(pFontArrus, 266, v10, 0, pTmpBuf.data(), 0, 0, 0); + a2 = format_4E2E10; + if ( player->GetActualResistance(CHARACTER_ATTRIBUTE_RESIST_WATER) > 99 || player->GetBaseResistance(CHARACTER_ATTRIBUTE_RESIST_WATER) > 99 ) + a2 = "%s\f%05u\t180%d\f00000 / %d\n"; + pY += LOBYTE(pFontArrus->uFontHeight) - 2; + sprintf(pTmpBuf.data(), a2, pGlobalTXT_LocalizationStrings[240], + UI_GetHealthManaStringColor(player->GetActualResistance(CHARACTER_ATTRIBUTE_RESIST_WATER), player->GetBaseResistance(CHARACTER_ATTRIBUTE_RESIST_WATER)), + player->GetActualResistance(CHARACTER_ATTRIBUTE_RESIST_WATER), player->GetBaseResistance(CHARACTER_ATTRIBUTE_RESIST_WATER)); + pGUIWindow_CurrentMenu->DrawText(pFontArrus, 266, pY, 0, pTmpBuf.data(), 0, 0, 0); - a2g = format_4E2E10; - v10 += LOBYTE(pFontArrus->uFontHeight) - 2; - v135 = player->GetActualResistance(CHARACTER_ATTRIBUTE_RESIST_MIND); - v102 = player->GetBaseResistance(CHARACTER_ATTRIBUTE_RESIST_MIND); - if ( v135 > 99 || v102 > 99 ) - a2g = "%s\f%05u\t180%d\f00000 / %d\n"; - v104 = UI_GetHealthManaStringColor(v135, v102); - sprintf(pTmpBuf.data(), a2g, pGlobalTXT_LocalizationStrings[142], v104, v135, v102); - if ( player->classType == PLAYER_CLASS_LICH && v102 == 200 ) - { - v106 = UI_GetHealthManaStringColor(v135, 200); - sprintf(pTmpBuf.data(), format_4E2E00, pGlobalTXT_LocalizationStrings[142], v106, pGlobalTXT_LocalizationStrings[625]); - } - pGUIWindow_CurrentMenu->DrawText(pFontArrus, 266, v10, 0, pTmpBuf.data(), 0, 0, 0); + a2 = format_4E2E10; + if ( player->GetActualResistance(CHARACTER_ATTRIBUTE_RESIST_EARTH) > 99 ) + a2 = "%s\f%05u\t180%d\f00000 / %d\n"; + pY += LOBYTE(pFontArrus->uFontHeight) - 2; + sprintf(pTmpBuf.data(), a2, pGlobalTXT_LocalizationStrings[70], + UI_GetHealthManaStringColor(player->GetActualResistance(CHARACTER_ATTRIBUTE_RESIST_EARTH), player->GetBaseResistance(CHARACTER_ATTRIBUTE_RESIST_EARTH)), + player->GetActualResistance(CHARACTER_ATTRIBUTE_RESIST_EARTH), player->GetBaseResistance(CHARACTER_ATTRIBUTE_RESIST_EARTH)); + pGUIWindow_CurrentMenu->DrawText(pFontArrus, 266, pY, 0, pTmpBuf.data(), 0, 0, 0); - a2h = format_4E2E10; - v10 += LOBYTE(pFontArrus->uFontHeight) - 2; - v136 = player->GetActualResistance(CHARACTER_ATTRIBUTE_RESIST_BODY); - v107 = player->GetBaseResistance(CHARACTER_ATTRIBUTE_RESIST_BODY); - if ( v136 > 99 || v107 > 99 ) - a2h = "%s\f%05u\t180%d\f00000 / %d\n"; - v109 = UI_GetHealthManaStringColor(v136, v107); - sprintf(pTmpBuf.data(), a2h, pGlobalTXT_LocalizationStrings[29], v109, v136, v107); - if ( player->classType == PLAYER_CLASS_LICH && v107 == 200 ) - { - v111 = UI_GetHealthManaStringColor(v136, 200); - sprintf(pTmpBuf.data(), format_4E2E00, pGlobalTXT_LocalizationStrings[29], v111, pGlobalTXT_LocalizationStrings[625]); - } - pGUIWindow_CurrentMenu->DrawText(pFontArrus, 266, v10, 0, pTmpBuf.data(), 0, 0, 0); + a2 = format_4E2E10; + if ( player->GetActualResistance(CHARACTER_ATTRIBUTE_RESIST_MIND) > 99 || player->GetBaseResistance(CHARACTER_ATTRIBUTE_RESIST_MIND) > 99 ) + a2 = "%s\f%05u\t180%d\f00000 / %d\n"; + pY += LOBYTE(pFontArrus->uFontHeight) - 2; + sprintf(pTmpBuf.data(), a2, pGlobalTXT_LocalizationStrings[142], + UI_GetHealthManaStringColor(player->GetActualResistance(CHARACTER_ATTRIBUTE_RESIST_MIND), player->GetBaseResistance(CHARACTER_ATTRIBUTE_RESIST_MIND)), + player->GetActualResistance(CHARACTER_ATTRIBUTE_RESIST_MIND), player->GetBaseResistance(CHARACTER_ATTRIBUTE_RESIST_MIND)); + if ( player->classType == PLAYER_CLASS_LICH && player->GetBaseResistance(CHARACTER_ATTRIBUTE_RESIST_MIND) == 200 ) + sprintf(pTmpBuf.data(), format_4E2E00, pGlobalTXT_LocalizationStrings[142], + UI_GetHealthManaStringColor(player->GetActualResistance(CHARACTER_ATTRIBUTE_RESIST_MIND), 200), pGlobalTXT_LocalizationStrings[625]); + pGUIWindow_CurrentMenu->DrawText(pFontArrus, 266, pY, 0, pTmpBuf.data(), 0, 0, 0); + + a2 = format_4E2E10; + if ( player->GetActualResistance(CHARACTER_ATTRIBUTE_RESIST_BODY) > 99 || player->GetBaseResistance(CHARACTER_ATTRIBUTE_RESIST_BODY) > 99 ) + a2 = "%s\f%05u\t180%d\f00000 / %d\n"; + pY += LOBYTE(pFontArrus->uFontHeight) - 2; + sprintf(pTmpBuf.data(), a2, pGlobalTXT_LocalizationStrings[29], + UI_GetHealthManaStringColor(player->GetActualResistance(CHARACTER_ATTRIBUTE_RESIST_BODY), player->GetBaseResistance(CHARACTER_ATTRIBUTE_RESIST_BODY)), + player->GetActualResistance(CHARACTER_ATTRIBUTE_RESIST_BODY), player->GetBaseResistance(CHARACTER_ATTRIBUTE_RESIST_BODY)); + if ( player->classType == PLAYER_CLASS_LICH && player->GetBaseResistance(CHARACTER_ATTRIBUTE_RESIST_BODY) == 200 ) + sprintf(pTmpBuf.data(), format_4E2E00, pGlobalTXT_LocalizationStrings[29], + UI_GetHealthManaStringColor(player->GetActualResistance(CHARACTER_ATTRIBUTE_RESIST_BODY), 200), pGlobalTXT_LocalizationStrings[625]); + pGUIWindow_CurrentMenu->DrawText(pFontArrus, 266, pY, 0, pTmpBuf.data(), 0, 0, 0); } -bool awardSort (int i,int j) { - if (pAwards[i].uPriority == 0) //none - { - return false; - } - else if (pAwards[j].uPriority == 0) - { - return true; - } - else if(pAwards[i].uPriority == 1) //fines,arena stuff,etc - { - return false; - } - else if(pAwards[j].uPriority == 1) - { - return true; - } - else if(pAwards[i].uPriority == 5) //joined guilds - { - return false; - } - else if(pAwards[j].uPriority == 5) - { - return true; - } - else - { - return (pAwards[i].uPriority<pAwards[j].uPriority); - } +bool awardSort (int i, int j) +{ + if (pAwards[i].uPriority == 0) //none + return false; + else if (pAwards[j].uPriority == 0) + return true; + else if(pAwards[i].uPriority == 1) //fines,arena stuff,etc + return false; + else if(pAwards[j].uPriority == 1) + return true; + else if(pAwards[i].uPriority == 5) //joined guilds + return false; + else if(pAwards[j].uPriority == 5) + return true; + else + return (pAwards[i].uPriority < pAwards[j].uPriority); } //----- (00419100) -------------------------------------------------------- void FillAwardsData() { - auto pPlayer = pPlayers[uActiveCharacter]; + Player* pPlayer = pPlayers[uActiveCharacter]; - memset(achieved_awards.data(), 0, 4000); - num_achieved_awards = 0; + memset(achieved_awards.data(), 0, 4000); + num_achieved_awards = 0; - memset(pTmpBuf2.data(), 0, 0x7D0u); - BtnDown_flag = 0; - BtnUp_flag = 0; - books_page_number = 0; - books_primary_item_per_page = 0; - for (int i = 0; i < 105; ++i) + memset(pTmpBuf2.data(), 0, 0x7D0u); + BtnDown_flag = 0; + BtnUp_flag = 0; + books_page_number = 0; + books_primary_item_per_page = 0; + for ( int i = 1; i < 105; ++i ) + { + if ( _449B57_test_bit(pPlayer->_achieved_awards_bits, i) && pAwards[i].pText ) + achieved_awards[num_achieved_awards++] = (AwardType)i; + } + full_num_items_in_book = num_achieved_awards; + num_achieved_awards = 0; + + //sort awards index + + if (full_num_items_in_book>0) + { + for (int i = 0; i< full_num_items_in_book; ++i) + achieved_awards[full_num_items_in_book+i] = (AwardType)(rand()%16); + for (int i = 1; i< full_num_items_in_book; ++i) + { + for (int j = i; j< full_num_items_in_book; ++j) + { + AwardType tmp; + if (pAwards[achieved_awards[j]].uPriority < pAwards[achieved_awards[i]].uPriority) { - if ( _449B57_test_bit(pPlayer->_guilds_member_bits, i) && pAwards[i].pText ) - { - achieved_awards[num_achieved_awards++] = (AwardType)i; - } + tmp= achieved_awards[j]; + achieved_awards[j] = achieved_awards[i]; + achieved_awards[i] = tmp; } - full_num_items_in_book = num_achieved_awards; - num_achieved_awards = 0; + } + } + } - //sort awards index - if (full_num_items_in_book > 0) - { - std::stable_sort(achieved_awards.begin(), achieved_awards.end(), awardSort); - } - } - + // if (full_num_items_in_book > 0) + /* { + std::stable_sort(achieved_awards.begin(), achieved_awards.end(), awardSort); + }*/ +} //----- (0043EF2B) -------------------------------------------------------- void WetsuitOn( unsigned int uPlayerID ) - { - CHARACTER_RACE player_race; // edi@2 - signed int player_sex; // eax@2 - int texture_num; // ecx@5 - char pContainer[20]; // [sp+4h] [bp-1Ch]@7 - - if ( uPlayerID> 0 ) - { - player_race = pPlayers[uPlayerID]->GetRace(); - player_sex = pPlayers[uPlayerID]->GetSexByVoice(); - if ( player_race == CHARACTER_RACE_DWARF ) - texture_num = (player_sex != 0) + 3; - else - texture_num = (player_sex != 0) + 1; - wsprintfA(pContainer, "pc23v%dBod", texture_num); - papredoll_dbods[uPlayerID - 1] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); - wsprintfA(pContainer, "pc23v%dlad", texture_num); - papredoll_dlads[uPlayerID - 1] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); - wsprintfA(pContainer, "pc23v%dlau", texture_num); - papredoll_dlaus[uPlayerID - 1] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); - wsprintfA(pContainer, "pc23v%drh", texture_num); - papredoll_drhs[uPlayerID - 1] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); - wsprintfA(pContainer, "pc23v%dlh", texture_num); - papredoll_dlhs[uPlayerID - 1] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); - wsprintfA(pContainer, "pc23v%dlhu", texture_num); - papredoll_dlhus[uPlayerID - 1] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); +{ + CHARACTER_RACE player_race; // edi@2 + signed int player_sex; // eax@2 + int texture_num; // ecx@5 + char pContainer[20]; // [sp+4h] [bp-1Ch]@7 - if ( pPlayers[uPlayerID]->uCurrentFace == 12 || pPlayers[uPlayerID]->uCurrentFace == 13 ) - papredoll_dbrds[pPlayers[uPlayerID]->uCurrentFace] = 0; + if ( uPlayerID> 0 ) + { + player_race = pPlayers[uPlayerID]->GetRace(); + player_sex = pPlayers[uPlayerID]->GetSexByVoice(); + if ( player_race == CHARACTER_RACE_DWARF ) + texture_num = (player_sex != 0) + 3; + else + texture_num = (player_sex != 0) + 1; + wsprintfA(pContainer, "pc23v%dBod", texture_num); + papredoll_dbods[uPlayerID - 1] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); + wsprintfA(pContainer, "pc23v%dlad", texture_num); + papredoll_dlads[uPlayerID - 1] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); + wsprintfA(pContainer, "pc23v%dlau", texture_num); + papredoll_dlaus[uPlayerID - 1] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); + wsprintfA(pContainer, "pc23v%drh", texture_num); + papredoll_drhs[uPlayerID - 1] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); + wsprintfA(pContainer, "pc23v%dlh", texture_num); + papredoll_dlhs[uPlayerID - 1] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); + wsprintfA(pContainer, "pc23v%dlhu", texture_num); + papredoll_dlhus[uPlayerID - 1] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); - papredoll_flying_feet[pPlayers[uPlayerID]->uCurrentFace] = 0; - IsPlayerWearingWatersuit[uPlayerID] = 1; - } - } + if ( pPlayers[uPlayerID]->uCurrentFace == 12 || pPlayers[uPlayerID]->uCurrentFace == 13 ) + papredoll_dbrds[pPlayers[uPlayerID]->uCurrentFace] = 0; + papredoll_flying_feet[pPlayers[uPlayerID]->uCurrentFace] = 0; + IsPlayerWearingWatersuit[uPlayerID] = 1; + } +} //----- (0043F0BD) -------------------------------------------------------- void WetsuitOff( unsigned int uPlayerID ) - { - char pContainer[20]; // [sp+0h] [bp-18h]@4 +{ + char pContainer[20]; // [sp+0h] [bp-18h]@4 - if (uPlayerID > 0 ) - { - papredoll_dbods[uPlayerID - 1] = pIcons_LOD->LoadTexture(dbod_texnames_by_face[pPlayers[uPlayerID]->uCurrentFace], TEXTURE_16BIT_PALETTE); - papredoll_dlads[uPlayerID - 1] = pIcons_LOD->LoadTexture(dlad_texnames_by_face[pPlayers[uPlayerID]->uCurrentFace], TEXTURE_16BIT_PALETTE); - papredoll_dlaus[uPlayerID - 1] = pIcons_LOD->LoadTexture(dlau_texnames_by_face[pPlayers[uPlayerID]->uCurrentFace], TEXTURE_16BIT_PALETTE); - papredoll_drhs [uPlayerID - 1] = pIcons_LOD->LoadTexture(drh_texnames_by_face [pPlayers[uPlayerID]->uCurrentFace], TEXTURE_16BIT_PALETTE); - papredoll_dlhs [uPlayerID - 1] = pIcons_LOD->LoadTexture(dlh_texnames_by_face [pPlayers[uPlayerID]->uCurrentFace], TEXTURE_16BIT_PALETTE); - papredoll_dlhus[uPlayerID - 1] = pIcons_LOD->LoadTexture(dlhu_texnames_by_face[pPlayers[uPlayerID]->uCurrentFace], TEXTURE_16BIT_PALETTE); + if (uPlayerID > 0 ) + { + papredoll_dbods[uPlayerID - 1] = pIcons_LOD->LoadTexture(dbod_texnames_by_face[pPlayers[uPlayerID]->uCurrentFace], TEXTURE_16BIT_PALETTE); + papredoll_dlads[uPlayerID - 1] = pIcons_LOD->LoadTexture(dlad_texnames_by_face[pPlayers[uPlayerID]->uCurrentFace], TEXTURE_16BIT_PALETTE); + papredoll_dlaus[uPlayerID - 1] = pIcons_LOD->LoadTexture(dlau_texnames_by_face[pPlayers[uPlayerID]->uCurrentFace], TEXTURE_16BIT_PALETTE); + papredoll_drhs [uPlayerID - 1] = pIcons_LOD->LoadTexture(drh_texnames_by_face [pPlayers[uPlayerID]->uCurrentFace], TEXTURE_16BIT_PALETTE); + papredoll_dlhs [uPlayerID - 1] = pIcons_LOD->LoadTexture(dlh_texnames_by_face [pPlayers[uPlayerID]->uCurrentFace], TEXTURE_16BIT_PALETTE); + papredoll_dlhus[uPlayerID - 1] = pIcons_LOD->LoadTexture(dlhu_texnames_by_face[pPlayers[uPlayerID]->uCurrentFace], TEXTURE_16BIT_PALETTE); - if ( pPlayers[uPlayerID]->uCurrentFace == 12 || pPlayers[uPlayerID]->uCurrentFace == 13 ) - { - wsprintfA(pContainer, "pc%02dbrd", pPlayers[uPlayerID]->uCurrentFace + 1); - papredoll_dbrds[pPlayers[uPlayerID]->uCurrentFace] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); - } - wsprintfA(pContainer, "item281pc%02d", pPlayers[uPlayerID]->uCurrentFace + 1); - papredoll_flying_feet[pPlayers[uPlayerID]->uCurrentFace] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); - IsPlayerWearingWatersuit[uPlayerID] = 0; - } + if ( pPlayers[uPlayerID]->uCurrentFace == 12 || pPlayers[uPlayerID]->uCurrentFace == 13 ) + { + wsprintfA(pContainer, "pc%02dbrd", pPlayers[uPlayerID]->uCurrentFace + 1); + papredoll_dbrds[pPlayers[uPlayerID]->uCurrentFace] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); } + wsprintfA(pContainer, "item281pc%02d", pPlayers[uPlayerID]->uCurrentFace + 1); + papredoll_flying_feet[pPlayers[uPlayerID]->uCurrentFace] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); + IsPlayerWearingWatersuit[uPlayerID] = 0; + } +} + //----- (00468F8A) -------------------------------------------------------- -void __cdecl OnPaperdollLeftClick() +void OnPaperdollLeftClick() { int v1; // ecx@1 unsigned int v2; // edi@1 unsigned int v3; // edx@4 unsigned int pSkillType; // esi@5 unsigned __int16 v5; // ax@7 - unsigned int v6; // edi@19 + //unsigned int v6; // edi@19 int v7; // esi@27 int v8; // eax@29 - int v9; // edx@32 + //int v9; // edx@32 int v10; // esi@34 - int v11; // eax@34 + //int v11; // eax@34 int v12; // esi@38 - int v13; // eax@38 + //int v13; // eax@38 char v14; // zf@38 int v15; // esi@42 - int v16; // eax@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 + //int v21; // eax@60 unsigned int v22; // eax@61 int v23; // eax@62 int v24; // esi@65 @@ -2482,8 +2363,7 @@ unsigned int v50; // [sp+38h] [bp-14h]@50 int v51; // [sp+3Ch] [bp-10h]@1 int v52; // [sp+40h] [bp-Ch]@5 - //int v53; // [sp+44h] [bp-8h]@1 - //unsigned int v54; // [sp+48h] [bp-4h]@1 + ITEM_EQUIP_TYPE pEquipType; v51 = 0; _this.Reset(); @@ -2497,7 +2377,7 @@ v3 = pParty->pPickedItem.uItemID; if ( pParty->pPickedItem.uItemID ) { - v52 = pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType; + pEquipType = pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType; pSkillType = pItemsTable->pItems[pParty->pPickedItem.uItemID].uSkillType; if ( pSkillType == 4 ) { @@ -2538,60 +2418,57 @@ WetsuitOn(uActiveCharacter); return; } - v6 = v52; - switch ( v52 ) + //v6 = v52; + switch ( pEquipType ) { - case 2u: - case 3u: - case 5u: - case 6u: - case 7u: - case 8u: - case 9u: - case 0xBu: + case EQUIP_BOW: + case EQUIP_ARMOUR: + case EQUIP_HELMET: + case EQUIP_BELT: + case EQUIP_CLOAK: + case EQUIP_GAUNTLETS: + case EQUIP_BOOTS: + case EQUIP_AMULET: if ( !pPlayers[uActiveCharacter]->HasSkill(pSkillType) ) { pPlayers[uActiveCharacter]->PlaySound(SPEECH_39, 0); return; } - if ( sub_43EE77_ProbablyIfUnderwaterSuitIsEquipped(uActiveCharacter) && (v6 != 3 || bUnderwater) ) - { - pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0); - return; - } - pPlayers[uActiveCharacter]->EquipBody((ITEM_EQUIP_TYPE)v6); + if ( sub_43EE77_ProbablyIfUnderwaterSuitIsEquipped(uActiveCharacter) && (pEquipType != EQUIP_ARMOUR || bUnderwater) ) + { + pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0); + return; + } + pPlayers[uActiveCharacter]->EquipBody(pEquipType); if ( pParty->pPickedItem.uItemID == ITEM_WETSUIT ) WetsuitOff(uActiveCharacter); return; - case 0xAu: + + case EQUIP_RING:// if ( sub_43EE77_ProbablyIfUnderwaterSuitIsEquipped(uActiveCharacter) ) - { - pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0); - return; - } - v52 = 10; - v7 = (int)&pPlayers[uActiveCharacter]->pEquipment.uRings; - while ( 1 ) { - if ( !*(int *)v7 ) + pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0); + return; + } + // + v7 = 0; + for ( v52 = 10; (signed int)v52 < 16; ++v52 ) + { + if ( !pPlayers[uActiveCharacter]->pEquipment.uRings[v7] ) { v8 = pPlayers[uActiveCharacter]->FindFreeInventoryListSlot(); if ( v8 >= 0 ) - { - v9 = v52; - pParty->pPickedItem.uBodyAnchor = v52 + 1; - memcpy(&pPlayers[uActiveCharacter]->pInventoryItemList[v8], &pParty->pPickedItem, sizeof(pPlayers[uActiveCharacter]->pInventoryItemList[v8])); - *(&pPlayers[uActiveCharacter]->pEquipment.uShield + v9) = v8 + 1; - pMouse->RemoveHoldingItem(); + { + pParty->pPickedItem.uBodyAnchor = v52 + 1; + memcpy(&pPlayers[uActiveCharacter]->pInventoryItemList[v8], &pParty->pPickedItem, sizeof(pPlayers[uActiveCharacter]->pInventoryItemList[v8])); + pPlayers[uActiveCharacter]->pEquipment.uRings[v7] = v8 + 1; + pMouse->RemoveHoldingItem(); break; - } + } } - ++v52; - v7 += 4; - if ( (signed int)v52 > 15 ) - break; + v7++; } - if ( v52 == 16 ) + if ( v52 == 16 )// { v52 = pPlayers[uActiveCharacter]->pEquipment.uRings[6] - 1; memcpy(&_this, &pParty->pPickedItem, sizeof(_this)); @@ -2600,17 +2477,17 @@ pParty->pPickedItem.Reset(); pParty->SetHoldingItem((ItemGen *)(v10 + 532)); _this.uBodyAnchor = 16; - v11 = v52 + 1; memcpy((void *)(v10 + 532), &_this, 0x24u); - pPlayers[uActiveCharacter]->pEquipment.uRings[6] = v11; + pPlayers[uActiveCharacter]->pEquipment.uRings[6] = v52 + 1; } return; - case 4u: + + case EQUIP_SHIELD:// if ( sub_43EE77_ProbablyIfUnderwaterSuitIsEquipped(uActiveCharacter) ) - { - pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0); - return; - } + { + pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0); + return; + } if ( !pPlayers[uActiveCharacter]->HasSkill(pSkillType) ) { pPlayers[uActiveCharacter]->PlaySound(SPEECH_39, 0); @@ -2625,10 +2502,9 @@ pParty->pPickedItem.Reset(); pParty->SetHoldingItem((ItemGen *)(v12 + 532)); _this.uBodyAnchor = 1; - v13 = v2 + 1; v14 = v51 == 0; memcpy((void *)(v12 + 532), &_this, 0x24u); - pPlayers[uActiveCharacter]->pEquipment.uShield = v13; + pPlayers[uActiveCharacter]->pEquipment.uShield = v2 + 1; if ( v14 ) return; } @@ -2652,21 +2528,20 @@ pParty->pPickedItem.Reset(); pParty->SetHoldingItem((ItemGen *)(v15 + 532)); _this.uBodyAnchor = 1; - v16 = v52 + 1; memcpy(&pPlayers[uActiveCharacter]->pInventoryItemList[v52], &_this, sizeof(pPlayers[uActiveCharacter]->pInventoryItemList[v52])); - pPlayers[uActiveCharacter]->pEquipment.uShield = v16; + pPlayers[uActiveCharacter]->pEquipment.uShield = v52 + 1; } pPlayers[uActiveCharacter]->pEquipment.uMainHand = 0; return; - case 0u: - case 0xCu: + case EQUIP_OFF_HAND: + case EQUIP_WAND: if ( sub_43EE77_ProbablyIfUnderwaterSuitIsEquipped(uActiveCharacter) && pParty->pPickedItem.uItemID != 64 && pParty->pPickedItem.uItemID != 65 ) - { - pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0); - return; - } + { + pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0); + return; + } if ( !pPlayers[uActiveCharacter]->HasSkill(pSkillType) ) { pPlayers[uActiveCharacter]->PlaySound(SPEECH_39, 0); @@ -2676,10 +2551,8 @@ if ( pSkillType == 2 && (unsigned __int16)(pPlayers[uActiveCharacter]->pActiveSkills[2] & 0xFFC0) || pSkillType == 1 && (signed int)SkillToMastery(pPlayers[uActiveCharacter]->pActiveSkills[1]) >= 3 ) { - - v18 = pMouse->uMouseClickX; - v19 = pMouse->uMouseClickY; - + v18 = pMouse->uMouseClickX; + v19 = pMouse->uMouseClickY; v49 = v19; if ( (signed int)v18 >= 560 ) { @@ -2694,20 +2567,19 @@ pParty->pPickedItem.Reset(); pParty->SetHoldingItem((ItemGen *)(v20 + 532)); _this.uBodyAnchor = 1; - v21 = v2 + 1; - v14 = v52 == 12; + v14 = pEquipType == EQUIP_WAND; memcpy((void *)(v20 + 532), &_this, 0x24u); - pPlayers[uActiveCharacter]->pEquipment.uShield = v21; + pPlayers[uActiveCharacter]->pEquipment.uShield = v2 + 1; if ( !v14 ) return; v22 = _this.uItemID; v50 = v22; - if ( v50 ) + if ( v50 ) { __debugbreak(); // looks like offset in player's inventory and wand_lut much like case in 0042ECB5 - stru_A750F8[uActiveCharacter - 1]._494836(*((int *)&pSpellDatas[66].uNormalLevelRecovery + v50), uActiveCharacter - 1 + 9); + stru_A750F8[uActiveCharacter - 1]._494836(*((int *)&pSpellDatas[66].uNormalLevelRecovery + v50), uActiveCharacter - 1 + 9); } - break; + break; } v23 = pPlayers[uActiveCharacter]->FindFreeInventoryListSlot(); if ( v23 < 0 ) @@ -2717,16 +2589,16 @@ memcpy(&pPlayers[uActiveCharacter]->pInventoryItemList[v23], &pParty->pPickedItem, sizeof(pPlayers[uActiveCharacter]->pInventoryItemList[v23])); pPlayers[uActiveCharacter]->pEquipment.uShield = v23 + 1; pMouse->RemoveHoldingItem(); - if ( v52 != 12 ) + if ( pEquipType != 12 ) return; v22 = *(int *)v50; - v50 = v22; - if ( v50 ) + v50 = v22; + if ( v50 ) { __debugbreak(); // looks like offset in player's inventory and wand_lut much like case in 0042ECB5 - stru_A750F8[uActiveCharacter - 1]._494836(*((int *)&pSpellDatas[66].uNormalLevelRecovery + v50), uActiveCharacter - 1 + 9); + stru_A750F8[uActiveCharacter - 1]._494836(*((int *)&pSpellDatas[66].uNormalLevelRecovery + v50), uActiveCharacter - 1 + 9); } - break; + break; } } } @@ -2739,17 +2611,17 @@ v50 = (unsigned int)&pPlayers[uActiveCharacter]->pInventoryItemList[v26]; memcpy(&pPlayers[uActiveCharacter]->pInventoryItemList[v26], &pParty->pPickedItem, sizeof(pPlayers[uActiveCharacter]->pInventoryItemList[v26])); pPlayers[uActiveCharacter]->pEquipment.uMainHand = v26 + 1; - pMouse->RemoveHoldingItem(); - if ( v52 != 12 ) - return; - v22 = *(int *)v50; - v50 = v22; - if ( v50 ) - { - __debugbreak(); // looks like offset in player's inventory and wand_lut much like case in 0042ECB5 - stru_A750F8[uActiveCharacter - 1]._494836(*((int *)&pSpellDatas[66].uNormalLevelRecovery + v50), uActiveCharacter - 1 + 9); - } - break; + pMouse->RemoveHoldingItem(); + if ( pEquipType != 12 ) + return; + v22 = *(int *)v50; + v50 = v22; + if ( v50 ) + { + __debugbreak(); // looks like offset in player's inventory and wand_lut much like case in 0042ECB5 + stru_A750F8[uActiveCharacter - 1]._494836(*((int *)&pSpellDatas[66].uNormalLevelRecovery + v50), uActiveCharacter - 1 + 9); + } + break; } --v1; memcpy(&_this, &pParty->pPickedItem, sizeof(_this)); @@ -2759,7 +2631,7 @@ pParty->SetHoldingItem((ItemGen *)(v24 + 532)); _this.uBodyAnchor = 2; v25 = v1 + 1; - v14 = v52 == 12; + v14 = pEquipType == 12; memcpy((void *)(v24 + 532), &_this, 0x24u); pPlayers[uActiveCharacter]->pEquipment.uMainHand = v25; if ( v14 ) @@ -2772,7 +2644,7 @@ stru_A750F8[uActiveCharacter - 1]._494836( *((int *)&pSpellDatas[66].uNormalLevelRecovery + v50), uActiveCharacter - 1 + 9); } break; - case 1u: + case EQUIP_MAIN_HAND: if ( sub_43EE77_ProbablyIfUnderwaterSuitIsEquipped(uActiveCharacter) ) { pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0); @@ -2848,7 +2720,7 @@ v50 = v37; v38 = (ItemGen *)(v37 + 532); v14 = v38->uItemID == ITEM_WETSUIT; - v52 = pItemsTable->pItems[v38->uItemID].uEquipType; + pEquipType = pItemsTable->pItems[v38->uItemID].uEquipType; if ( v14 ) { if ( bUnderwater ) @@ -2862,7 +2734,7 @@ { *((char *)pGUIWindow_Settings->ptr_1C + 8) &= 0x7Fu; *((short *)pGUIWindow_Settings->ptr_1C + 2) = uActiveCharacter - 1; - v39 = v52; + v39 = pEquipType; *((int *)pGUIWindow_Settings->ptr_1C + 3) = v36; *((short *)pGUIWindow_Settings->ptr_1C + 3) = v39; ptr_50C9A4 = v38; @@ -2896,6 +2768,7 @@ } } } + //----- (004196A0) -------------------------------------------------------- void CharacterUI_ReleaseButtons() {
--- a/UI/UIGuilds.cpp Thu Aug 29 12:04:33 2013 +0600 +++ b/UI/UIGuilds.cpp Thu Aug 29 12:04:55 2013 +0600 @@ -191,7 +191,7 @@ } return; } - if ( !(unsigned __int16)_449B57_test_bit((unsigned __int8 *)pPlayers[uActiveCharacter]->_guilds_member_bits, + if ( !(unsigned __int16)_449B57_test_bit((unsigned __int8 *)pPlayers[uActiveCharacter]->_achieved_awards_bits, guild_mambership_flags[(unsigned int)window_SpeakInHouse->ptr_1C-139]) ) { //you must me member v38 = pFontArrus->CalcTextHeight(pNPCTopics[121].pText, &working_window, 0, 0);
--- a/UI/UIHouses.cpp Thu Aug 29 12:04:33 2013 +0600 +++ b/UI/UIHouses.cpp Thu Aug 29 12:04:55 2013 +0600 @@ -762,7 +762,7 @@ //----- (004B1784) -------------------------------------------------------- -bool __cdecl HouseUI_CheckIfPlayerCanInteract() +bool HouseUI_CheckIfPlayerCanInteract() { Player *pPlayer; // ebx@1 bool result; // eax@2 @@ -829,7 +829,7 @@ pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; viewparams->bRedrawGameUI = 1; uDialogueType = 0; - pKeyActionMap->SetWindowInputStatus(3); + pKeyActionMap->SetWindowInputStatus(WINDOW_INPUT_CANCELLED); pKeyActionMap->ResetKeys(); if (uHouseID == HOUSE_600 || uHouseID == HOUSE_601) { @@ -937,7 +937,7 @@ v19 = guild_mambership_flags[uHouseID - HOUSE_FIRE_GUILD_INITIATE_EMERALD_ISLE]; //guilds flags //v20 = uHouseID; //if ( !((unsigned __int8)(0x80u >> v19 % 8) & pPlayers[uActiveCharacter]->_guilds_member_bits[v19 /8]) ) - if(_449B57_test_bit(pPlayers[uActiveCharacter]->_guilds_member_bits,v19)) + if(_449B57_test_bit(pPlayers[uActiveCharacter]->_achieved_awards_bits,v19)) { PlayHouseSound(uHouseID, HouseSound_Greeting_2); return 1; @@ -2061,7 +2061,7 @@ */ } //----- (004B6943) -------------------------------------------------------- -void __cdecl TravelByTransport() +void TravelByTransport() { GUIWindow *v0; // ebx@1 Player *v1; // esi@1 @@ -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; @@ -2391,7 +2391,7 @@ //----- (004B7911) -------------------------------------------------------- -void __cdecl TownHallDialog() +void TownHallDialog() { GUIWindow *v0; // eax@4 int v1; // eax@10 @@ -2569,7 +2569,7 @@ } //----- (004B7D7E) -------------------------------------------------------- -void __cdecl BankDialog() +void BankDialog() { GUIWindow *v0; // eax@4 //int v1; // ecx@5 @@ -2711,7 +2711,7 @@ // F8B19C: using guessed type int dword_F8B19C; //----- (004B8285) -------------------------------------------------------- -void __cdecl TavernDialog() +void TavernDialog() { int v0; int pItemNum; @@ -4017,7 +4017,7 @@ pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, v5); return; // void func } - if ( !(unsigned __int16)_449B57_test_bit((unsigned __int8 *)v1->_guilds_member_bits, word_4F0754[2 * (unsigned int)window_SpeakInHouse->ptr_1C]) ) + if ( !(unsigned __int16)_449B57_test_bit((unsigned __int8 *)v1->_achieved_awards_bits, word_4F0754[2 * (unsigned int)window_SpeakInHouse->ptr_1C]) ) { v24 = pNPCTopics[171].pText; v25 = v31;
--- a/UI/UIHouses.h Thu Aug 29 12:04:33 2013 +0600 +++ b/UI/UIHouses.h Thu Aug 29 12:04:55 2013 +0600 @@ -124,15 +124,15 @@ void GuildDialog(); void sub_4B6478(); bool __fastcall IsTravelAvailable(int a1); -void __cdecl TravelByTransport(); +void TravelByTransport(); void TempleDialog(); -void __cdecl TownHallDialog(); -void __cdecl BankDialog(); -void __cdecl TavernDialog(); +void TownHallDialog(); +void BankDialog(); +void TavernDialog(); void PlayHouseSound(unsigned int uHouseID, HouseSoundID sound); // idb -void __cdecl WeaponShopDialog(); -void __cdecl AlchemistDialog(); -void __cdecl ArmorShopDialog(); +void WeaponShopDialog(); +void AlchemistDialog(); +void ArmorShopDialog(); void InitializaDialogueOptions_Tavern(BuildingType type); // idb
--- a/UI/UIPartyCreation.cpp Thu Aug 29 12:04:33 2013 +0600 +++ b/UI/UIPartyCreation.cpp Thu Aug 29 12:04:55 2013 +0600 @@ -25,7 +25,7 @@ //----- (004908DE) -------------------------------------------------------- -signed int __cdecl PlayerCreation_Chose4Skills() +int PlayerCreation_Choose4Skills() { Player *v0; // esi@1 signed int v1; // edx@2 @@ -59,7 +59,7 @@ //----- (00491CB5) -------------------------------------------------------- -void __cdecl LoadPlayerPortraintsAndVoices() +void LoadPlayerPortraintsAndVoices() { //Texture **v0; // ebx@1 //int v1; // eax@2 @@ -475,7 +475,7 @@ } //----- (0049695A) -------------------------------------------------------- -void __cdecl PlayerCreationUI_Initialize() +void PlayerCreationUI_Initialize() { unsigned int v0; // ebx@5 unsigned int v1; // eax@6
--- a/UI/UIPopup.cpp Thu Aug 29 12:04:33 2013 +0600 +++ b/UI/UIPopup.cpp Thu Aug 29 12:04:55 2013 +0600 @@ -551,7 +551,7 @@ { if ( (inspect_item->uAttributes & 8) && (inspect_item->uSpecEnchantmentType || inspect_item->uEnchantmentType) ) { - sub_493F79(&v67, inspect_item->uExpireTime - pParty->uTimePlayed); + init_summoned_item(&v67, inspect_item->uExpireTime - pParty->uTimePlayed); strcpy(pTmpBuf.data(), "Duration:"); Str = (char *)(v67.field_18_expire_year - game_starting_year); if (v67.field_18_expire_year != 1168 ) @@ -1596,7 +1596,7 @@ } //----- (00418083) -------------------------------------------------------- -void __cdecl CharacterUI_StatsTab_ShowHint() +void CharacterUI_StatsTab_ShowHint() { int pStringNum; // edi@1 signed int pTextColor; // eax@15 @@ -1687,7 +1687,7 @@ v15 = pPlayers[uActiveCharacter]->uLevel; do { - if ( (signed __int64)pPlayers[uActiveCharacter]->uExperience < (unsigned int)sub_4B46F8(v15) ) + if ( (signed __int64)pPlayers[uActiveCharacter]->uExperience < (unsigned int)GetExperienceRequiredForLevel(v15) ) break; ++v15; } @@ -1696,7 +1696,7 @@ pTmpBuf2[0] = 0; if ( v15 > pPlayers[uActiveCharacter]->uLevel ) sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[147], v15); - v16 = sub_4B46F8(v15) - LODWORD(pPlayers[uActiveCharacter]->uExperience); + v16 = GetExperienceRequiredForLevel(v15) - LODWORD(pPlayers[uActiveCharacter]->uExperience); sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[538], v16, v15 + 1); strcat(pTmpBuf.data(), "\n"); strcat(pTmpBuf.data(), pTmpBuf2.data()); @@ -1763,7 +1763,7 @@ } //----- (00410B28) -------------------------------------------------------- - void __thiscall DrawSpellDescriptionPopup(int spell_index) + void DrawSpellDescriptionPopup(int spell_index) { Player *v1; // edi@1 SpellInfo *v2; // esi@1
--- a/UI/UIRest.cpp Thu Aug 29 12:04:33 2013 +0600 +++ b/UI/UIRest.cpp Thu Aug 29 12:04:55 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 12:04:33 2013 +0600 +++ b/UI/UIShops.cpp Thu Aug 29 12:04:55 2013 +0600 @@ -14,7 +14,7 @@ #include "..\Viewport.h" //----- (004B910F) -------------------------------------------------------- -void __cdecl WeaponShopDialog() +void WeaponShopDialog() { int v0; // ebx@1 int pNumActiveItem; // eax@6 @@ -183,7 +183,7 @@ v49 += 30; v51 = 60 - ((signed int)v50->uTextureWidth >> 1); pRenderer->DrawTextureTransparent(v51 + pItemNum, v49, v50); - sub_40F92A(&pRenderer->pActiveZBuffer[v51 + pItemNum + 640 * v49], ItemsInShopTexture[(signed int)v109], (int)((char *)v109 + 1)); + ZBuffer_DoFill2(&pRenderer->pActiveZBuffer[v51 + pItemNum + 640 * v49], ItemsInShopTexture[(signed int)v109], (int)((char *)v109 + 1)); v48 = v109; } pItemNum += 70; @@ -376,7 +376,7 @@ v53 = ItemsInShopTexture[(signed int)v109]; v54 = 60 - ((signed int)v53->uTextureWidth >> 1); pRenderer->DrawTextureTransparent(v54 + pItemNum, word_F8B158[(signed int)v109] + 30, v53); - sub_40F92A(&pRenderer->pActiveZBuffer[v54 + pItemNum + 640 * v52], ItemsInShopTexture[(signed int)v109], (int)((char *)v109 + 1)); + ZBuffer_DoFill2(&pRenderer->pActiveZBuffer[v54 + pItemNum + 640 * v52], ItemsInShopTexture[(signed int)v109], (int)((char *)v109 + 1)); } v109 = (const char **)((char *)v109 + 1); pItemNum += 70; @@ -538,7 +538,7 @@ } //----- (004BA928) -------------------------------------------------------- -void __cdecl ArmorShopDialog() +void ArmorShopDialog() { signed int v1; // esi@8 unsigned int v2; // eax@10 @@ -1106,7 +1106,7 @@ } } //----- (004B9CC6) -------------------------------------------------------- -void __cdecl AlchemistDialog() +void AlchemistDialog() { int v0; int pNumActiveItem; // eax@7 @@ -1287,7 +1287,7 @@ else if ( (signed int)v48 < 18 ) v48 = 18; pRenderer->DrawTextureTransparent(v48, v47, v46); - sub_40F92A(&pRenderer->pActiveZBuffer[v48 + 640 * v47], ItemsInShopTexture[v114], v114 + 1); + ZBuffer_DoFill2(&pRenderer->pActiveZBuffer[v48 + 640 * v47], ItemsInShopTexture[v114], v114 + 1); } ++v114; } @@ -1317,7 +1317,7 @@ v52 = 18; } pRenderer->DrawTextureTransparent(v52, v51, v50); - sub_40F92A(&pRenderer->pActiveZBuffer[v52 + 640 * v51], ItemsInShopTexture[v114 + 6], v114 + 7); + ZBuffer_DoFill2(&pRenderer->pActiveZBuffer[v52 + 640 * v51], ItemsInShopTexture[v114 + 6], v114 + 7); } ++v114; } @@ -1489,7 +1489,7 @@ v56 = 18; } pRenderer->DrawTextureTransparent(v56, v55, v54); - sub_40F92A(&pRenderer->pActiveZBuffer[v56 + 640 * v55], ItemsInShopTexture[v114], v114 + 1); + ZBuffer_DoFill2(&pRenderer->pActiveZBuffer[v56 + 640 * v55], ItemsInShopTexture[v114], v114 + 1); } ++v114; } @@ -1519,7 +1519,7 @@ v60 = 18; } pRenderer->DrawTextureTransparent(v60, v59, v58); - sub_40F92A(&pRenderer->pActiveZBuffer[v60 + 640 * v59], ItemsInShopTexture[v114 + 6], v114 + 7); + ZBuffer_DoFill2(&pRenderer->pActiveZBuffer[v60 + 640 * v59], ItemsInShopTexture[v114 + 6], v114 + 7); } ++v114; } @@ -1857,7 +1857,7 @@ v52 = 18; } pRenderer->DrawTextureTransparent(v52, v51, v50); - sub_40F92A(&pRenderer->pActiveZBuffer[v52 + 640 * v51], ItemsInShopTexture[v122], v122 + 1); + ZBuffer_DoFill2(&pRenderer->pActiveZBuffer[v52 + 640 * v51], ItemsInShopTexture[v122], v122 + 1); v49 = v122; } ++v49; @@ -1887,7 +1887,7 @@ v56 = 18; } pRenderer->DrawTextureTransparent(v56, v55, v54); - sub_40F92A(&pRenderer->pActiveZBuffer[v56 + 640 * v55], ItemsInShopTexture[v122 + 6], v122 + 7); + ZBuffer_DoFill2(&pRenderer->pActiveZBuffer[v56 + 640 * v55], ItemsInShopTexture[v122 + 6], v122 + 7); } ++v122; } @@ -1987,7 +1987,7 @@ v60 = 18; } pRenderer->DrawTextureTransparent(v60, v59, ItemsInShopTexture[v49]); - sub_40F92A(&pRenderer->pActiveZBuffer[v60 + 640 * v59], ItemsInShopTexture[v122], v122 + 1); + ZBuffer_DoFill2(&pRenderer->pActiveZBuffer[v60 + 640 * v59], ItemsInShopTexture[v122], v122 + 1); v49 = v122; } ++v49; @@ -2018,7 +2018,7 @@ v64 = 18; } pRenderer->DrawTextureTransparent(v64, v63, ItemsInShopTexture[v122 + 6]); - sub_40F92A(&pRenderer->pActiveZBuffer[v64 + 640 * v63], ItemsInShopTexture[v122 + 6], v122 + 7); + ZBuffer_DoFill2(&pRenderer->pActiveZBuffer[v64 + 640 * v63], ItemsInShopTexture[v122 + 6], v122 + 7); } ++v122; } @@ -2067,7 +2067,7 @@ return; } v70 = pMouse->GetCursorPos(&v102); - result = v70->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v100)->y]; + result = v70->x + pSRZBufferLineOffsets[v70->y]; if ( pRenderer->pActiveZBuffer[result] & 0xFFFF ) { v71 = (pRenderer->pActiveZBuffer[result] & 0xFFFF) - 1; @@ -2293,7 +2293,7 @@ return; } //----- (004BDB56) -------------------------------------------------------- -void __cdecl UIShop_Buy_Identify_Repair() +void UIShop_Buy_Identify_Repair() { int v8; // eax@15 unsigned int pItemID; // esi@20 @@ -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()) { @@ -2582,7 +2582,7 @@ } } //----- (004B1A2D) -------------------------------------------------------- -void __cdecl ShowPopupShopItem() +void ShowPopupShopItem() { POINT *v1; // esi@5 unsigned int v2; // eax@5 @@ -2646,7 +2646,7 @@ } } //----- (004B1D27) -------------------------------------------------------- -void __cdecl GetHouseGoodbyeSpeech() +void GetHouseGoodbyeSpeech() { signed int v2; // edi@10 signed int v5; // edi@20
--- a/UI/UITransition.cpp Thu Aug 29 12:04:33 2013 +0600 +++ b/UI/UITransition.cpp Thu Aug 29 12:04:55 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 12:04:33 2013 +0600 +++ b/UI/UiGame.cpp Thu Aug 29 12:04:55 2013 +0600 @@ -809,7 +809,7 @@ } if ( pKeyActionMap->pPressedKeysBuffer[0] ) { - pKeyActionMap->SetWindowInputStatus(0); + pKeyActionMap->SetWindowInputStatus(WINDOW_INPUT_NONE); goto LABEL_15; } } @@ -860,7 +860,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 @@ -1387,7 +1387,7 @@ for ( i = pFontLucida->GetLineWidth(GameUI_Footer_TimedString.data()); i > 450; i = pFontLucida->GetLineWidth(GameUI_Footer_TimedString.data()) ) - byte_5C3427[strlen(GameUI_Footer_TimedString.data())] = 0; + GameUI_Footer_TimedString[strlen(GameUI_Footer_TimedString.data()) - 1] = 0; } else { @@ -1395,7 +1395,7 @@ for ( j = pFontLucida->GetLineWidth(pFooterString.data()); j > 450; j = pFontLucida->GetLineWidth(pFooterString.data()) ) - GameUI_Footer_TimedString[strlen(pFooterString.data()) + 199] = 0; + pFooterString[strlen(pFooterString.data()) - 1] = 0; } } } @@ -1428,7 +1428,7 @@ { v4 = strlen(GameUI_Footer_TimedString.data()); v5 = pFontLucida; - byte_5C3427[v4] = 0; + GameUI_Footer_TimedString[v4 - 1] = 0; v2 = pFontLucida->GetLineWidth(GameUI_Footer_TimedString.data()); } } @@ -1441,7 +1441,7 @@ { v7 = strlen(pFooterString.data()); v8 = pFontLucida; - GameUI_Footer_TimedString[v7 + 199] = 0; + pFooterString[v7 - 1] = 0; v6 = pFontLucida->GetLineWidth(pFooterString.data()); } } @@ -1458,7 +1458,7 @@ //----- (00420EFF) -------------------------------------------------------- -void __cdecl GameUI_WritePointedObjectStatusString() +void GameUI_WritePointedObjectStatusString() { int v1; // ebx@6 GUIWindow *pWindow; // edi@7 @@ -2767,7 +2767,7 @@ } //----- (00441498) -------------------------------------------------------- -void __cdecl GameUI_DrawTorchlightAndWizardEye() +void GameUI_DrawTorchlightAndWizardEye() { if (pCurrentScreen == SCREEN_GAME || pCurrentScreen == SCREEN_MENU @@ -2930,46 +2930,36 @@ } //----- (00417939) -------------------------------------------------------- -signed int __thiscall GetConditionDrawColor(unsigned int uConditionIdx) +int GetConditionDrawColor(unsigned int uConditionIdx) { - unsigned int v1; // ebx@1 - signed int v2; // edi@1 - unsigned int v3; // esi@1 - unsigned int v4; // eax@1 - unsigned int v6; // [sp+Ch] [bp-4h]@1 - - v1 = uConditionIdx; - v2 = 65535; - v3 = TargetColor(0xE1u, 0xCDu, 0x23u); - v6 = TargetColor(0xFFu, 0x23u, 0); - v4 = TargetColor(0, 0xFFu, 0); - switch ( v1 ) + switch (uConditionIdx) { - case 0u: - case 1u: - case 3u: - case 4u: - case 5u: - case 6u: - case 7u: - v2 = v4; - break; - case 2u: - case 8u: - case 9u: - case 0xCu: - case 0xDu: - v2 = v3; - break; - case 0xAu: - case 0xBu: - case 0xEu: - case 0xFu: - case 0x10u: - v2 = v6; - break; - default: - return v2; + case Condition_Zombie: + case Condition_Good: + return ui_character_condition_normal_color; + + case Condition_Cursed: + case Condition_Weak: + case Condition_Fear: + case Condition_Drunk: + case Condition_Insane: + case Condition_Poison1: + case Condition_Disease1: + return ui_character_condition_light_color; + + case Condition_Sleep: + case Condition_Poison2: + case Condition_Disease2: + case Condition_Paralyzed: + case Condition_Unconcious: + return ui_character_condition_moderate_color; + + case Condition_Poison3: + case Condition_Disease3: + case Condition_Dead: + case Condition_Pertified: + case Condition_Eradicated: + return ui_character_condition_severe_color; } - return v2; + assert(false && "Invalid condition"); }
--- a/VideoPlayer.cpp Thu Aug 29 12:04:33 2013 +0600 +++ b/VideoPlayer.cpp Thu Aug 29 12:04:55 2013 +0600 @@ -65,6 +65,8 @@ +bool BinkLockBuffer(struct _BINKBUF *_this); +void BinkUnlockBuffer(struct _BINKBUF *_this); //----- (004BFE2D) -------------------------------------------------------- _BINKBUF *VideoPlayer::CreateBinkBuffer(HWND hWindow, unsigned int uWidth, unsigned int uHeight, char a4) @@ -293,7 +295,7 @@ } } //----- (004BF794) -------------------------------------------------------- -void __cdecl ShowIntroVideo_and_LoadingScreen() +void ShowIntroVideo_and_LoadingScreen() { RGBTexture tex; // [sp+Ch] [bp-30h]@1 unsigned int uTrackStartMS; // [sp+34h] [bp-8h]@8
--- a/VideoPlayer.h Thu Aug 29 12:04:33 2013 +0600 +++ b/VideoPlayer.h Thu Aug 29 12:04:55 2013 +0600 @@ -104,7 +104,7 @@ -void __cdecl ShowIntroVideo_and_LoadingScreen(); +void ShowIntroVideo_and_LoadingScreen();
--- a/Vis.h Thu Aug 29 12:04:33 2013 +0600 +++ b/Vis.h Thu Aug 29 12:04:55 2013 +0600 @@ -70,7 +70,7 @@ object_pool[uNumPointers++].sZValue = packed_zval; } - void (__thiscall ***vdestructor_ptr)(Vis_SelectionList *, bool); + void ( ***vdestructor_ptr)(Vis_SelectionList *, bool); Vis_ObjectInfo object_pool[512]; Vis_ObjectInfo *object_pointers[512]; unsigned int uNumPointers; @@ -122,7 +122,7 @@ bool SortByScreenSpaceX(struct RenderVertexSoft *pArray, int sLeft, int sRight); bool SortByScreenSpaceY(struct RenderVertexSoft *pArray, int sLeft, int sRight); - //void (__thiscall ***vdestructor_ptr)(Vis *, bool); + //void ( ***vdestructor_ptr)(Vis *, bool); Vis_SelectionList default_list; RenderVertexSoft stru_200C; RenderVertexSoft stru_203C;
--- a/_deleted.cpp Thu Aug 29 12:04:33 2013 +0600 +++ b/_deleted.cpp Thu Aug 29 12:04:55 2013 +0600 @@ -71,7 +71,7 @@ void _4898E6(); - void (__thiscall *vdestructor_ptr)(stru12 *); + void ( *vdestructor_ptr)(stru12 *); int field_4[16]; int field_44; int field_48; @@ -5875,7 +5875,7 @@ } //----- (00486F92) -------------------------------------------------------- -void __cdecl sr_sub_486F92_MessWithEdgesAndSpans() +void sr_sub_486F92_MessWithEdgesAndSpans() { Span *v0; // ebx@1 int v1; // eax@2 @@ -9382,7 +9382,7 @@ } //----- (00423B4A) -------------------------------------------------------- -void __cdecl sub_423B4A() +void sub_423B4A() { float *v0; // eax@1 signed int v1; // ecx@1 @@ -10576,7 +10576,7 @@ } //----- (004AF412) -------------------------------------------------------- -int __cdecl sr_4AF412() +int sr_4AF412() { int v0; // ST20_4@2 int v1; // ST20_4@2 @@ -11023,7 +11023,7 @@ return result; } //----- (004AC1C9) -------------------------------------------------------- -int __thiscall _4AC1C9_get_cpu_speed(unsigned int _this, Vec4_int_ *a2) +int _4AC1C9_get_cpu_speed(unsigned int _this, Vec4_int_ *a2) { unsigned int v2; // esi@1 __int16 v3; // di@1 @@ -11097,7 +11097,7 @@ //----- (004382BC) -------------------------------------------------------- -__int16 __thiscall _4382BC_get_cpu_speed_sub0(int _this) +__int16 _4382BC_get_cpu_speed_sub0(int _this) { __int16 result; // ax@4 __int16 v14; // sp@11 @@ -11158,7 +11158,7 @@ //----- (0043847A) -------------------------------------------------------- -__int16 __cdecl _43847A_get_cpu_speed_sub1() +__int16 _43847A_get_cpu_speed_sub1() { signed int v5; // eax@1 char v12[12]; // [sp+Ch] [bp-28h]@1 @@ -11208,7 +11208,7 @@ //----- (004383ED) -------------------------------------------------------- -int __cdecl _4383ED_get_cpu_speed_sub2() +int _4383ED_get_cpu_speed_sub2() { signed int v9; // eax@4 int v16; // [sp-4h] [bp-38h]@0 @@ -11265,7 +11265,7 @@ //----- (004AC4FD) -------------------------------------------------------- -Vec4_int_ *__thiscall _4AC4FD_get_cpu_clocks_rdtsc(int _this, Vec4_int_ *a1) +Vec4_int_ * _4AC4FD_get_cpu_clocks_rdtsc(int _this, Vec4_int_ *a1) { int v2; // eax@1 int v3; // eax@4 @@ -11348,7 +11348,7 @@ //----- (004AC33A) -------------------------------------------------------- -Vec4_int_ *__thiscall _4AC33A_get_cpu_clocks_QPC(int _this, Vec4_int_ *a1) +Vec4_int_ * _4AC33A_get_cpu_clocks_QPC(int _this, Vec4_int_ *a1) { int v2; // esi@1 int v3; // ebx@1 @@ -11459,7 +11459,7 @@ //----- (004AC277) -------------------------------------------------------- -Vec4_int_ *__thiscall _4AC277_get_cpu_speed_sub3(unsigned int _this, Vec4_int_ *a2) +Vec4_int_ * _4AC277_get_cpu_speed_sub3(unsigned int _this, Vec4_int_ *a2) { signed int v2; // esi@1 signed __int16 v4; // bx@3 @@ -11516,7 +11516,7 @@ } //----- (004D714C) -------------------------------------------------------- -int __cdecl sr_sub_4D714C(stru315 *a1) +int sr_sub_4D714C(stru315 *a1) { stru315 *v1; // ebp@0 stru315 *v2; // ebp@1 @@ -11724,7 +11724,7 @@ } //----- (004D71F8) -------------------------------------------------------- -int __cdecl sr_sub_4D71F8(stru315 *a1) +int sr_sub_4D71F8(stru315 *a1) { stru315 *v1; // ebp@0 stru315 *v2; // ebp@1 @@ -11808,7 +11808,7 @@ } //----- (004D754B) -------------------------------------------------------- -void __cdecl sr_sub_4D754B(stru315 *a1, stru316 *a2) +void sr_sub_4D754B(stru315 *a1, stru316 *a2) { int v2; // ecx@1 unsigned int v3; // eax@2 @@ -12017,7 +12017,7 @@ } //----- (004D7630) -------------------------------------------------------- -void __cdecl sr_sub_4D7630(stru315 *a1, stru316 *a2) +void sr_sub_4D7630(stru315 *a1, stru316 *a2) { int v2; // ecx@1 int v3; // eax@2 @@ -12075,7 +12075,7 @@ } //----- (004D76ED) -------------------------------------------------------- -void __cdecl sr_sub_4D76ED(stru315 *a1, stru316 *a2) +void sr_sub_4D76ED(stru315 *a1, stru316 *a2) { int v2; // ecx@1 unsigned int v3; // eax@2 @@ -12143,7 +12143,7 @@ } //----- (004D77D2) -------------------------------------------------------- -void __cdecl sr_sub_4D77D2(stru315 *a1, stru316 *a2) +void sr_sub_4D77D2(stru315 *a1, stru316 *a2) { int v2; // ecx@1 unsigned __int16 *v3; // ebx@2 @@ -12207,7 +12207,7 @@ } } //----- (004D789A) -------------------------------------------------------- -void __cdecl sr_sub_4D789A(stru315 *a1, stru316 *a2) +void sr_sub_4D789A(stru315 *a1, stru316 *a2) { int v2; // ecx@1 unsigned int v3; // eax@2
--- a/lib/legacy_dx/d3drmobj.h Thu Aug 29 12:04:33 2013 +0600 +++ b/lib/legacy_dx/d3drmobj.h Thu Aug 29 12:04:55 2013 +0600 @@ -173,26 +173,26 @@ DEFINE_GUID(IID_IDirect3DRMPicked2Array, 0x4516ec7b, 0x8f20, 0x11d0, 0x9b, 0x6d, 0x0, 0x0, 0xc0, 0x78, 0x1b, 0xc3); DEFINE_GUID(IID_IDirect3DRMClippedVisual, 0x5434e733, 0x6d66, 0x11d1, 0xbb, 0xb, 0x0, 0x0, 0xf8, 0x75, 0x86, 0x5a); -typedef void (__cdecl *D3DRMOBJECTCALLBACK)(LPDIRECT3DRMOBJECT obj, LPVOID arg); -typedef void (__cdecl *D3DRMFRAMEMOVECALLBACK)(LPDIRECT3DRMFRAME obj, LPVOID arg, D3DVALUE delta); -typedef void (__cdecl *D3DRMFRAME3MOVECALLBACK)(LPDIRECT3DRMFRAME3 obj, LPVOID arg, D3DVALUE delta); -typedef void (__cdecl *D3DRMUPDATECALLBACK)(LPDIRECT3DRMDEVICE obj, LPVOID arg, int, LPD3DRECT); -typedef void (__cdecl *D3DRMDEVICE3UPDATECALLBACK)(LPDIRECT3DRMDEVICE3 obj, LPVOID arg, int, LPD3DRECT); -typedef int (__cdecl *D3DRMUSERVISUALCALLBACK) +typedef void ( *D3DRMOBJECTCALLBACK)(LPDIRECT3DRMOBJECT obj, LPVOID arg); +typedef void ( *D3DRMFRAMEMOVECALLBACK)(LPDIRECT3DRMFRAME obj, LPVOID arg, D3DVALUE delta); +typedef void ( *D3DRMFRAME3MOVECALLBACK)(LPDIRECT3DRMFRAME3 obj, LPVOID arg, D3DVALUE delta); +typedef void ( *D3DRMUPDATECALLBACK)(LPDIRECT3DRMDEVICE obj, LPVOID arg, int, LPD3DRECT); +typedef void ( *D3DRMDEVICE3UPDATECALLBACK)(LPDIRECT3DRMDEVICE3 obj, LPVOID arg, int, LPD3DRECT); +typedef int ( *D3DRMUSERVISUALCALLBACK) ( LPDIRECT3DRMUSERVISUAL obj, LPVOID arg, D3DRMUSERVISUALREASON reason, LPDIRECT3DRMDEVICE dev, LPDIRECT3DRMVIEWPORT view ); -typedef HRESULT (__cdecl *D3DRMLOADTEXTURECALLBACK) +typedef HRESULT ( *D3DRMLOADTEXTURECALLBACK) (char *tex_name, void *arg, LPDIRECT3DRMTEXTURE *); -typedef HRESULT (__cdecl *D3DRMLOADTEXTURE3CALLBACK) +typedef HRESULT ( *D3DRMLOADTEXTURE3CALLBACK) (char *tex_name, void *arg, LPDIRECT3DRMTEXTURE3 *); -typedef void (__cdecl *D3DRMLOADCALLBACK) +typedef void ( *D3DRMLOADCALLBACK) (LPDIRECT3DRMOBJECT object, REFIID objectguid, LPVOID arg); -typedef HRESULT (__cdecl *D3DRMDOWNSAMPLECALLBACK) +typedef HRESULT ( *D3DRMDOWNSAMPLECALLBACK) (LPDIRECT3DRMTEXTURE3 lpDirect3DRMTexture, LPVOID pArg, LPDIRECTDRAWSURFACE pDDSSrc, LPDIRECTDRAWSURFACE pDDSDst); -typedef HRESULT (__cdecl *D3DRMVALIDATIONCALLBACK) +typedef HRESULT ( *D3DRMVALIDATIONCALLBACK) (LPDIRECT3DRMTEXTURE3 lpDirect3DRMTexture, LPVOID pArg, DWORD dwFlags, DWORD dwcRects, LPRECT pRects);
--- a/mm7_1.cpp Thu Aug 29 12:04:33 2013 +0600 +++ b/mm7_1.cpp Thu Aug 29 12:04:55 2013 +0600 @@ -59,6 +59,8 @@ return (((__int64)a1 << 16) * a2) >> 16; } + +//----- (0042EBBE) -------------------------------------------------------- //----- (004453C0) mm6----------------------------------------------------- //----- (004A1760) mm6_chinese--------------------------------------------- int fixpoint_sub0(int a1, int a2)
--- a/mm7_2.cpp Thu Aug 29 12:04:33 2013 +0600 +++ b/mm7_2.cpp Thu Aug 29 12:04:55 2013 +0600 @@ -296,7 +296,7 @@ } //----- (004BBCDD) -------------------------------------------------------- -void __cdecl sub_4BBCDD() +void sub_4BBCDD() { signed int v0; // ebp@3 Actor *v1; // eax@4 @@ -387,7 +387,7 @@ } //----- (004BC109) -------------------------------------------------------- -void __cdecl ArenaFight() +void ArenaFight() { int v0; // edi@1 char *v1; // eax@7 @@ -598,7 +598,7 @@ } //----- (004BD8B5) -------------------------------------------------------- -signed int __cdecl sub_4BD8B5() +int sub_4BD8B5() { int v0; // eax@4 int v1; // eax@29 @@ -607,7 +607,7 @@ if ( pMessageQueue_50CBD0->uNumMessages ) pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; - pKeyActionMap->SetWindowInputStatus(3); + pKeyActionMap->SetWindowInputStatus(WINDOW_INPUT_CANCELLED); pKeyActionMap->ResetKeys(); activeLevelDecoration = NULL; current_npc_text = 0; @@ -694,7 +694,7 @@ } //----- (004BF91E) -------------------------------------------------------- -unsigned int __thiscall GameOverMenu(void *ecx0) +unsigned int GameOverMenu(void *ecx0) { char *v1; // eax@2 unsigned int result; // eax@3 @@ -1578,7 +1578,7 @@ } //----- (00450521) -------------------------------------------------------- -signed int __fastcall sub_450521_ProllyDropItemAt(int ecx0, signed int a2, int a3, int a4, int a5, unsigned __int16 a6) +int __fastcall sub_450521_ProllyDropItemAt(int ecx0, signed int a2, int a3, int a4, int a5, unsigned __int16 a6) { int v6; // edi@1 int v7; // esi@1 @@ -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() { @@ -1962,7 +1859,7 @@ // 5C6DF8: using guessed type int dword_5C6DF8; //----- (00450DA3) -------------------------------------------------------- -int __cdecl GetAlertStatus() +int GetAlertStatus() { int result; // eax@2 @@ -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(); @@ -3034,7 +2931,7 @@ // 6BE35C: using guessed type int uLevel_StartingPointType; //----- (00461103) -------------------------------------------------------- -void __cdecl sub_461103() +void _461103_load_level_sub() { //GUIProgressBar *v0; // ebx@1 //signed int v1; // ebp@1 @@ -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) @@ -3188,7 +3085,7 @@ uNumActors = 0; if ( dword_6BE368_debug_settings_2 & 8 ) uNumLevelDecorations = 0; - sub_4613C4(); + init_event_triggers(); pGameLoadingUI_ProgressBar->Progress(); @@ -3206,38 +3103,15 @@ } //----- (004613C4) -------------------------------------------------------- -int __cdecl sub_4613C4() +void init_event_triggers() { - unsigned __int16 v0; // ax@1 - size_t v1; // ecx@1 - int v2; // esi@1 - int result; // eax@1 - LevelDecoration *v4; // edx@2 - int v5; // edi@4 - - _6836C8_num_decorations_6807E8 = 0; - v0 = pDecorationList->GetDecorIdByName("Event Trigger"); - v1 = uNumLevelDecorations; - v2 = (signed __int16)v0; - result = 0; - if ( (signed int)uNumLevelDecorations > 0 ) - { - v4 = pLevelDecorations.data(); - do - { - if ( v4->uDecorationDescID == v2 ) - { - v5 = _6836C8_num_decorations_6807E8++; - _6807E8_level_decorations_ids[v5] = result; - } - ++result; - ++v4; - } - while ( result < (signed int)v1 ); - } - return result; + uint id = pDecorationList->GetDecorIdByName("Event Trigger"); + + num_event_triggers = 0; + for (uint i = 0; i < uNumLevelDecorations; ++i) + if (pLevelDecorations[i].uDecorationDescID == id) + event_triggers[num_event_triggers++] = i; } -// 6836C8: using guessed type int 6836C8_num_decorations_6807E8; //----- (004621DA) -------------------------------------------------------- int int_get_vector_length(signed int x, signed int y, signed int z) @@ -3267,7 +3141,7 @@ OPENFILENAMEA ofn; //----- (0046271C) -------------------------------------------------------- -void __cdecl crt_init_globals_46271C() +void CreateDefaultBLVLevel() { ofn.lStructSize = 0x4Cu; ofn.hwndOwner = hWnd; @@ -3378,7 +3252,7 @@ } else { - if ( !ptr_507BDC )// ??? + if ( !pModalWindow )// ??? { pButton = pWindow->pControlsHead; for ( pButton = pWindow->pControlsHead; pButton; pButton = pButton->pNext ) @@ -3445,10 +3319,22 @@ struct tagPAINTSTRUCT Paint; // [sp+24h] [bp-48h]@13 int pXY[2]; // [sp+64h] [bp-8h]@261 int a2; // [sp+7Ch] [bp+10h]@50 - + switch (Msg) { + case WM_SIZING: return 1; + case WM_SHOWWINDOW: + case WM_GETTEXT: case WM_SETTEXT: return DefWindowProcW(hWnd, Msg, wParam, lParam); + + case WM_WINDOWPOSCHANGED: + { + if (pVideoPlayer && pVideoPlayer->AnyMovieLoaded() && pVideoPlayer->pBinkBuffer) + BinkBufferSetOffset(pVideoPlayer->pBinkBuffer, 0, 0); + + return DefWindowProcW(hWnd, Msg, wParam, lParam); + } + case WM_CHAR: { if (!pKeyActionMap->_459F10(wParam) && !viewparams->field_4C) @@ -3456,6 +3342,14 @@ } return DefWindowProcA(hWnd, Msg, wParam, lParam); + + case WM_DEVICECHANGE: + { + if (wParam == 0x8000) // CD or some device has been inserted - notify InsertCD dialog + PostMessageA(hInsertCDWindow, WM_USER + 1, 0, 0); + return 0; + } + case WM_COMMAND: { switch (wParam) @@ -3640,12 +3534,6 @@ { switch ( Msg ) { - case WM_DEVICECHANGE: - if ( wParam == 0x8000 ) - PostMessageA(hInsertCDWindow, WM_CHOOSEFONT_GETLOGFONT, 0, 0); - return 0; - case WM_SIZING: - return 1; case WM_LBUTTONDOWN: if ( pArcomageGame->bGameInProgress ) { @@ -3763,7 +3651,6 @@ if ( !pGame ) //goto _def_wnd_proc; return DefWindowProcA(hWnd, Msg, wParam, lParam); - sub_417871(0); return DefWindowProcA(hWnd, Msg, wParam, lParam); case WM_MOUSEMOVE: if ( pArcomageGame->bGameInProgress ) @@ -3794,15 +3681,7 @@ } if ( Msg > WM_ACTIVATEAPP ) { - if ( Msg == WM_WINDOWPOSCHANGED ) - { - if (pVideoPlayer && pVideoPlayer->AnyMovieLoaded() && pVideoPlayer->pBinkBuffer) - { - BinkBufferSetOffset(pVideoPlayer->pBinkBuffer, 0, 0); - } - return DefWindowProcA(hWnd, Msg, wParam, lParam); - } - if ( Msg != WM_KEYFIRST ) + if ( Msg != WM_KEYFIRST && Msg != WM_WINDOWPOSCHANGED) { if ( Msg == WM_KEYUP && wParam == VK_CONTROL ) { @@ -3846,14 +3725,14 @@ } if ( wParam >= VK_LEFT && wParam <= VK_DOWN ) { - if ( pCurrentScreen != SCREEN_GAME && pCurrentScreen != SCREEN_PRESS_ESCAPE_MESSAGE ) + if ( pCurrentScreen != SCREEN_GAME && pCurrentScreen != SCREEN_MODAL_WINDOW ) { if ( !viewparams->field_4C ) UI_OnKeyDown(wParam); return 0; } } - if ( pCurrentScreen != SCREEN_GAME && pCurrentScreen != SCREEN_PRESS_ESCAPE_MESSAGE ) + if ( pCurrentScreen != SCREEN_GAME && pCurrentScreen != SCREEN_MODAL_WINDOW ) return 0; } @@ -4023,7 +3902,7 @@ } //----- (00464479) -------------------------------------------------------- -void __cdecl ResetCursor_Palettes_LODs_Level_Audio_SFT_Windows() +void ResetCursor_Palettes_LODs_Level_Audio_SFT_Windows() { int v0; // esi@9 @@ -4056,11 +3935,8 @@ } //----- (004646F0) -------------------------------------------------------- -void PrepareWorld(unsigned int this_) +void PrepareWorld(unsigned int _0_box_loading_1_fullscreen) { - unsigned int v1; // ebx@1 - - v1 = this_; if ( pRenderer->pRenderD3D ) pGame->pVisInstance->_4C1A02(); pEventTimer->Pause(); @@ -4068,13 +3944,13 @@ pParty->uFlags = 2; pCastSpellInfo.data()->_427D48(1); ResetCursor_Palettes_LODs_Level_Audio_SFT_Windows(); - DoPrepareWorld(0, (v1 == 0) + 1); + DoPrepareWorld(0, (_0_box_loading_1_fullscreen == 0) + 1); pMiscTimer->Resume(); pEventTimer->Resume(); } //----- (00464761) -------------------------------------------------------- -void __thiscall Game_DeinitializeAndTerminate(int exitCode) +void Game_DeinitializeAndTerminate(int exitCode) { int v1; // esi@1 HANDLE v2; // eax@1 @@ -4109,22 +3985,22 @@ // 6BE3A0: using guessed type float flt_6BE3A0; //----- (00464839) -------------------------------------------------------- -char __cdecl Is_out15odm_underwater() +char Is_out15odm_underwater() { - return _stricmp(pCurrentMapName.data(), "out15.odm") == 0; + return _stricmp(pCurrentMapName, "out15.odm") == 0; } //----- (00464851) -------------------------------------------------------- -void __cdecl SetUnderwaterFog() +void SetUnderwaterFog() { day_fogrange_1 = 50; day_fogrange_2 = 5000; } //----- (00464866) -------------------------------------------------------- -void __fastcall DoPrepareWorld(unsigned int bLoading, int a2) +void DoPrepareWorld(unsigned int bLoading, int _1_fullscreen_loading_2_box) { - int v2; // esi@1 + //int v2; // esi@1 char *v3; // eax@1 //char *v4; // eax@1 unsigned int v5; // eax@3 @@ -4133,17 +4009,17 @@ char Str1[20]; // [sp+Ch] [bp-18h]@1 unsigned int v9; // [sp+20h] [bp-4h]@1 - v2 = a2; v9 = bLoading; ResetCursor_Palettes_LODs_Level_Audio_SFT_Windows(); pDecalBuilder->Reset(0); - pGameLoadingUI_ProgressBar->Initialize((GUIProgressBar::Type)v2); - strcpy(Str1, pCurrentMapName.data()); + pGameLoadingUI_ProgressBar->Initialize(_1_fullscreen_loading_2_box == 1 ? GUIProgressBar::TYPE_Fullscreen : + GUIProgressBar::TYPE_Box); + 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); @@ -4151,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; @@ -4166,8 +4042,8 @@ else PrepareToLoadBLV(v9); pAudioPlayer->SetMapEAX(); - sub_461103(); - if ( !_stricmp(pCurrentMapName.data(), "d11.blv") || !_stricmp(pCurrentMapName.data(), "d10.blv") ) + _461103_load_level_sub(); + if ( !_stricmp(pCurrentMapName, "d11.blv") || !_stricmp(pCurrentMapName, "d10.blv") ) { //spawning grounds & good analogue - no loot & exp from monsters @@ -4181,7 +4057,7 @@ bDialogueUI_InitializeActor_NPC_ID = 0; OnMapLoad(); pGameLoadingUI_ProgressBar->Progress(); -memset(&pRenderer->pBillboardRenderListD3D, 0, sizeof(pRenderer->pBillboardRenderListD3D)); + memset(&pRenderer->pBillboardRenderListD3D, 0, sizeof(pRenderer->pBillboardRenderListD3D)); pGameLoadingUI_ProgressBar->Release(); _flushall(); } @@ -4839,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.", @@ -4849,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.", @@ -4860,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], @@ -4888,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; @@ -4936,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); } @@ -5087,7 +5052,7 @@ } //----- (00465D0B) -------------------------------------------------------- -void __cdecl SecondaryInitialization() +void SecondaryInitialization() { __int16 v4; // ax@4 signed int v5; // esi@5 @@ -5189,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); @@ -5204,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); @@ -5413,7 +5390,7 @@ pParty->Reset(); pOtherOverlayList->Reset(); - strcpy(pCurrentMapName.data(), pStartingMapName.data()); + strcpy(pCurrentMapName, pStartingMapName); pParty->CreateDefaultParty(0); PlayerCreationUI_Initialize(); if ( PlayerCreationUI_Loop() ) @@ -5456,13 +5433,16 @@ } else { - if (GetCurrentMenuID() == MENU_10) + if (GetCurrentMenuID() == MENU_DebugBLVLevel) { pMouse->Activate(0); pParty->Reset(); pParty->CreateDefaultParty(1); - crt_init_globals_46271C(); + + extern void CreateDefaultBLVLevel(); + CreateDefaultBLVLevel(); + extern OPENFILENAMEA ofn; if ( !GetOpenFileNameA((LPOPENFILENAMEA)&ofn) ) { @@ -5470,7 +5450,7 @@ break; } _chdir("..\\"); - strcpy(pCurrentMapName.data(), ofn.lpstrFileTitle); + strcpy(pCurrentMapName, ofn.lpstrFileTitle); pMouse->Activate(1); pGame->Loop(); } @@ -5509,7 +5489,7 @@ } //----- (004637E0) -------------------------------------------------------- -char __cdecl sub_4637E0_is_there_popup_onscreen() +char sub_4637E0_is_there_popup_onscreen() { return dword_507BF0_is_there_popup_onscreen == 1; } @@ -5563,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 ); } @@ -5659,7 +5639,7 @@ } //----- (004666D5) -------------------------------------------------------- -void __cdecl MM7Initialization() +void MM7Initialization() { if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor ) { @@ -5705,7 +5685,7 @@ } //----- (00466B8C) -------------------------------------------------------- -int __cdecl AbortWithError() +int AbortWithError() { if ( !aborting_app ) { @@ -5754,7 +5734,7 @@ case MENU_NAMEPANELESC: return L"MENU_NAMEPANELESC"; case MENU_CREDITSPROC: return L"MENU_CREDITSPROC"; case MENU_LoadingProcInMainMenu: return L"MENU_LoadingProcInMainMenu"; - case MENU_10: return L"MENU_10"; + case MENU_DebugBLVLevel: return L"MENU_DebugBLVLevel"; case MENU_CREDITSCLOSE: return L"MENU_CREDITSCLOSE"; default: return L"unk"; }; @@ -5772,12 +5752,9 @@ return uCurrentMenuID; } -// 720980: using guessed type int uTextureID_720980; - -// 4E28F8: using guessed type int pCurrentScreen; //----- (0046A6AC) -------------------------------------------------------- -int __fastcall sub_46A6AC(int a1, int a2, int a3) +int __fastcall _46A6AC_spell_render(int a1, int a2, int a3) { int result; // eax@2 unsigned int v4; // edx@3 @@ -5798,10 +5775,11 @@ v14 = a1; if ( pRenderer->pRenderD3D ) { - result = sub_46A7C8(a1, a2, a3); + result = _46A6AC_spell_render_d3d(a1, a2, a3); } else { + __debugbreak(); // SW render never called v16 = 0; v4 = viewparams->uScreen_topL_X; v12 = viewparams->uScreen_BttmR_X; @@ -5860,7 +5838,7 @@ } //----- (0046A7C8) -------------------------------------------------------- -int __fastcall sub_46A7C8(int a1, int a2, signed int a3) +int __fastcall _46A6AC_spell_render_d3d(int a1, int a2, int a3) { unsigned int v3; // eax@2 int v4; // ecx@2 @@ -5929,7 +5907,7 @@ } //----- (0046A89E) -------------------------------------------------------- -int __fastcall sub_46A89E(int a1, int a2, signed int a3) +int __fastcall _46A89E_immolation_effect(int a1, int a2, int a3) { signed int v3; // edi@1 Actor *v4; // esi@2 @@ -6013,7 +5991,7 @@ } //----- (0046A99B) -------------------------------------------------------- -int __cdecl sub_46A99B() +int sub_46A99B() { int v0; // ebx@1 signed int v1; // ecx@1 @@ -6219,7 +6197,7 @@ } //----- (0046BDA8) -------------------------------------------------------- -unsigned int __cdecl GetGravityStrength() +unsigned int GetGravityStrength() { int v0; // eax@1 @@ -6229,7 +6207,7 @@ } //----- (0046BDC0) -------------------------------------------------------- -void __cdecl UpdateUserInput_and_MapSpecificStuff() +void UpdateUserInput_and_MapSpecificStuff() { if ( dword_6BE364_game_settings_1 & 0x80 ) { @@ -6766,7 +6744,7 @@ v16 = (signed __int16)pSpriteObjects[uLayingItemID].uSoundID + 4; v124 = 8 * v153; LOBYTE(v124) = v124 | 2; - v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id] + 1; + v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id - 1] + 1; pAudioPlayer->PlaySound((SoundID)v125, v124, v9, -1, v9, v16, v9, v9); return 0; } @@ -6823,7 +6801,7 @@ v16 = (signed __int16)pSpriteObjects[uLayingItemID].uSoundID + 4; v124 = 8 * v153; LOBYTE(v124) = v124 | 2; - v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id] + 1; + v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id - 1] + 1; pAudioPlayer->PlaySound((SoundID)v125, v124, v9, -1, v9, v16, v9, v9); return 0; } @@ -6924,7 +6902,7 @@ v16 = (signed __int16)pSpriteObjects[uLayingItemID].uSoundID + 4; v124 = 8 * v153; LOBYTE(v124) = v124 | 2; - v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id] + 1; + v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id-1] + 1; pAudioPlayer->PlaySound((SoundID)v125, v124, v9, -1, v9, v16, v9, v9); return 0; } @@ -7058,7 +7036,7 @@ v16 = (signed __int16)pSpriteObjects[uLayingItemID].uSoundID + 4; v124 = 8 * v153; LOBYTE(v124) = v124 | 2; - v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id] + 1; + v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id - 1] + 1; pAudioPlayer->PlaySound((SoundID)v125, v124, 0, -1, 0, v16, 0, 0); return 0; }
--- a/mm7_3.cpp Thu Aug 29 12:04:33 2013 +0600 +++ b/mm7_3.cpp Thu Aug 29 12:04:55 2013 +0600 @@ -52,7 +52,7 @@ #include "MM7.h" //----- (0046E44E) -------------------------------------------------------- -int __thiscall _46E44E_collide_against_faces_and_portals(unsigned int b1) +int _46E44E_collide_against_faces_and_portals(unsigned int b1) { BLVSector *pSector; // edi@1 signed int v2; // ebx@1 @@ -600,7 +600,7 @@ } //----- (0046EF01) -------------------------------------------------------- -int __thiscall _46EF01_collision_chech_player(int a1) +int _46EF01_collision_chech_player(int a1) { int v1; // edx@1 int result; // eax@1 @@ -673,7 +673,7 @@ } //----- (0046F04E) -------------------------------------------------------- -signed int __cdecl _46F04E_collide_against_portals() +int _46F04E_collide_against_portals() { BLVSector *v0; // ecx@1 unsigned int v1; // eax@1 @@ -864,7 +864,7 @@ } //----- (004706C6) -------------------------------------------------------- -void __cdecl UpdateActors_ODM() +void UpdateActors_ODM() { Actor *v0; // esi@2 AIState uAIState; // ax@2 @@ -3348,7 +3348,7 @@ } //----- (00475665) -------------------------------------------------------- -signed int __thiscall sub_475665(BLVFace *_this, int a2, __int16 a3) +int sub_475665(BLVFace *_this, int a2, __int16 a3) { unsigned int v3; // eax@1 Vec3_short_ *v4; // edx@3 @@ -4334,23 +4334,6 @@ return v16; } -//----- (004783FA) -------------------------------------------------------- -void __cdecl sub_4783FA_construct_global_73D150() -{ - char *v0; // eax@1 - signed int v1; // ecx@1 - - v0 = (char *)&array_73D150[0].flt_2C; - v1 = 20; - do - { - *(float *)v0 = 0.0; - v0 += 48; - --v1; - } - while ( v1 ); -} - //----- (0047840D) -------------------------------------------------------- char Render::DrawBuildingsD3D() { @@ -5579,7 +5562,7 @@ GetAlertStatus(); if ( qword_A750D8 ) qword_A750D8 = 0i64; - v2 = pMapStats->GetMapInfo(pCurrentMapName.data()); + v2 = pMapStats->GetMapInfo(pCurrentMapName); v3 = 0; if ( v2 ) { @@ -5656,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() { @@ -5816,7 +5760,7 @@ } //----- (0047C4FC) -------------------------------------------------------- -signed int __fastcall GetActorTintColor(int max_dimm, int min_dimm, float distance, int a4, RenderBillboard *a5) +int __fastcall GetActorTintColor(int max_dimm, int min_dimm, float distance, int a4, RenderBillboard *a5) { //int v5; // esi@1 signed int v6; // edx@1 @@ -5970,13 +5914,13 @@ } //----- (0047F469) -------------------------------------------------------- -int __stdcall GridCellToWorldPosX(int a1) +int GridCellToWorldPosX(int a1) { return (a1 - 64) << 9; } //----- (0047F476) -------------------------------------------------------- -int __stdcall GridCellToWorldPosZ(int a1) +int GridCellToWorldPosZ(int a1) { return (64 - a1) << 9; } @@ -6010,7 +5954,7 @@ } //----- (00481ED9) -------------------------------------------------------- -void __cdecl sub_481ED9_MessWithOutdoorCamera() +void sub_481ED9_MessWithOutdoorCamera() { stru_8019C8._48616B(65536, 0, 0, 0, 65536, 0); pOutdoorCamera->uNumPolygons = 0; @@ -6189,18 +6133,12 @@ return y_x1z1; } -//----- (00482A90) -------------------------------------------------------- -signed int __cdecl const_1_0() -{ - return 1; -} - //----- (00485F53) -------------------------------------------------------- -void __thiscall sr_485F53(Vec2_int_ *v) +void sr_485F53(Vec2_int_ *v) { ++v->y; if ( v->y > 1000 ) @@ -6726,7 +6664,7 @@ } //----- (00443F95) -------------------------------------------------------- -void __cdecl OnMapLeave() +void OnMapLeave() { _evt_raw *test_event; if ( uLevelEVT_NumEvents > 0 ) @@ -6917,7 +6855,7 @@ } //----- (00444564) -------------------------------------------------------- -const char *__cdecl sub_444564() +const char * sub_444564() { double v0; // st7@3 int v1; // ebx@3 @@ -7047,7 +6985,7 @@ } //----- (004452BB) -------------------------------------------------------- -void __cdecl sub_4452BB() +void sub_4452BB() { pGUIWindow2->Release(); pGUIWindow2 = 0; @@ -7436,7 +7374,7 @@ } //----- (00448B45) -------------------------------------------------------- -void __thiscall GameUI_StatusBar_UpdateTimedString(unsigned int bForceHide) +void GameUI_StatusBar_UpdateTimedString(unsigned int bForceHide) { if ( bForceHide || GameUI_Footer_TimeLeft && GetTickCount() >= GameUI_Footer_TimeLeft ) GameUI_Footer_TimeLeft = 0; @@ -7539,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; @@ -7569,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; @@ -7786,7 +7724,7 @@ for ( i = pFontLucida->GetLineWidth(GameUI_Footer_TimedString.data()); i > 450; i = pFontLucida->GetLineWidth(GameUI_Footer_TimedString.data()) ) - byte_5C3427[strlen(GameUI_Footer_TimedString.data())] = 0; + GameUI_Footer_TimedString[strlen(GameUI_Footer_TimedString.data()) - 1] = 0; } //----- (0044C1D0) -------------------------------------------------------- @@ -7797,58 +7735,29 @@ } //----- (0044C28B) -------------------------------------------------------- -signed int __cdecl const_2() +int const_2() { return 2; } //----- (0044C28F) -------------------------------------------------------- -bool __cdecl sub_44C28F_open_nwc_dungeon() +bool TeleportToNWCDungeon() { - bool result; // eax@1 - - result = _stricmp("nwc.blv", pCurrentMapName.data()); - if ( result ) - { - _5B65A8_npcdata_uflags_or_other = 0; - _5B65AC_npcdata_fame_or_other = 0; - _5B65B0_npcdata_rep_or_other = 0; - _5B65B4_npcdata_loword_house_or_other = 0; - _5B65B8_npcdata_hiword_house_or_other = 0; - dword_5B65BC = 0; - dword_5B65C0 = 0; - pGameLoadingUI_ProgressBar->uType = GUIProgressBar::TYPE_Fullscreen; - sub_44987B("nwc.blv", MapStartPoint_Party); - pCurrentScreen = SCREEN_GAME; - result = 1; - } - return result; -} - -//----- (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; + if (!_stricmp("nwc.blv", pCurrentMapName)) + return false; + + _5B65A8_npcdata_uflags_or_other = 0; + _5B65AC_npcdata_fame_or_other = 0; + _5B65B0_npcdata_rep_or_other = 0; + _5B65B4_npcdata_loword_house_or_other = 0; + _5B65B8_npcdata_hiword_house_or_other = 0; + dword_5B65BC = 0; + dword_5B65C0 = 0; + + pGameLoadingUI_ProgressBar->uType = GUIProgressBar::TYPE_Fullscreen; + sub_44987B("nwc.blv", MapStartPoint_Party); + pCurrentScreen = SCREEN_GAME; + return true; } //----- (0044C362) -------------------------------------------------------- @@ -7890,7 +7799,7 @@ } //----- (00401000) -------------------------------------------------------- -void __stdcall mm7__vector_constructor(void *a1, int objSize, int numObjs, int (__thiscall *constructor)(int)) +void mm7__vector_constructor(void *a1, int objSize, int numObjs, int ( *constructor)(int)) { void *v4; // esi@2 int v5; // edi@2 @@ -7909,10 +7818,6 @@ } } -// 4F75D8: using guessed type int ai_arrays_size; - -// 4F75D8: using guessed type int ai_arrays_size; - //----- (0040261D) -------------------------------------------------------- int stru298::Add(__int16 uID, __int16 a3, __int16 x, __int16 y, __int16 z, char a7, char a8) {
--- a/mm7_4.cpp Thu Aug 29 12:04:33 2013 +0600 +++ b/mm7_4.cpp Thu Aug 29 12:04:55 2013 +0600 @@ -47,7 +47,7 @@ #include "Lights.h" //----- (0046CC4B) -------------------------------------------------------- -void __cdecl check_event_triggers() +void check_event_triggers() { int v0; // eax@1 LevelDecoration *v1; // esi@2 @@ -90,9 +90,9 @@ signed int v38; // [sp+20h] [bp-4h]@24 v0 = 0; - for ( i = 0; i < _6836C8_num_decorations_6807E8; ++i ) + for ( i = 0; i < num_event_triggers; ++i ) { - v1 = &pLevelDecorations[_6807E8_level_decorations_ids[v0]]; + v1 = &pLevelDecorations[event_triggers[v0]]; v2 = v1->field_18; v3 = v1->vPosition.y; v33 = v1->vPosition.x; @@ -440,7 +440,7 @@ } //----- (0046E0B2) -------------------------------------------------------- -void __cdecl _46E0B2_collide_against_decorations() +void _46E0B2_collide_against_decorations() { BLVSector *v0; // ebp@1 LevelDecoration *v1; // edi@2 @@ -532,7 +532,7 @@ } //----- (00487DA9) -------------------------------------------------------- -void __cdecl sub_487DA9() +void sub_487DA9() { for (int i = 0; i < 20000; ++i) array_77EC08[i].field_108 = 0; @@ -597,7 +597,7 @@ } //----- (00491E3A) -------------------------------------------------------- -void __cdecl sub_491E3A() +void sub_491E3A() { Player *v0; // ebx@1 signed int v1; // esi@3 @@ -698,7 +698,7 @@ // 4ED498: using guessed type char byte_4ED498; //----- (00493938) -------------------------------------------------------- -int __cdecl _493938_regenerate() +int _493938_regenerate() { int v0; // edi@1 signed __int64 v1; // qax@1 @@ -842,7 +842,7 @@ a1.spell_caster_pid = v12; a1.uFacing = 0; a1.uSoundID = 0; - v13 = sub_46A89E((int)v41, 100, 307); + v13 = _46A89E_immolation_effect((int)v41, 100, 307); if ( v13 > 0 ) { do @@ -1070,7 +1070,7 @@ } //----- (00493F79) -------------------------------------------------------- -void sub_493F79(stru351_summoned_item *_this, __int64 a2) +void init_summoned_item(stru351_summoned_item *_this, __int64 duration) { signed __int64 v2; // ST2C_8@1 signed __int64 v3; // qax@1 @@ -1078,7 +1078,7 @@ unsigned __int64 v5; // qax@1 unsigned int v6; // ebx@1 - v2 = (signed __int64)((double)a2 * 0.234375); + v2 = (signed __int64)((double)duration * 0.234375); v3 = v2 / 60 / 60; //v4 = v3; v5 = (unsigned int)v3 / 0x18; @@ -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) -------------------------------------------------------- @@ -1885,8 +1893,7 @@ dword_AE3370 = v3; return pNPCStats->pNPCNames[0][v11 + 2 * v3]; } -// AE336C: using guessed type int dword_AE336C; -// AE3370: using guessed type int dword_AE3370; + //----- (00495430) -------------------------------------------------------- char * GetReputationString( signed int a1 ) @@ -2000,8 +2007,8 @@ break; case 8: v63 = 0; - v20 = (unsigned __int8 *)pPlayer->_guilds_member_bits; - for ( uint i = 0; i < 28; ++i ) + v20 = (unsigned __int8 *)pPlayer->_achieved_awards_bits; + for ( uint _i = 0; _i < 28; ++_i ) { if ( (unsigned __int16)_449B57_test_bit(v20, word_4EE150[i]) ) { @@ -2142,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); @@ -2241,7 +2248,7 @@ i += 2; break; } - sub_493F79(&v56, *a6); + init_summoned_item(&v56, *a6); sprintfex(a1, pGlobalTXT_LocalizationStrings[378], aMonthNames[v56.field_14_exprie_month], v56.field_C_expire_day + 1, v56.field_18_expire_year); strcat(pTmpBuf2.data(), a1); dst = strlen(pTmpBuf2.data()); @@ -2272,7 +2279,7 @@ i += 2; break; } - sub_493F79(&v56, pParty->field_3C._s_times[v17-51]); + init_summoned_item(&v56, pParty->field_3C._s_times[v17-51]); sprintfex(a1, pGlobalTXT_LocalizationStrings[378], aMonthNames[v56.field_14_exprie_month], v56.field_C_expire_day + 1, v56.field_18_expire_year); strcat(pTmpBuf2.data(), a1); dst = strlen(pTmpBuf2.data()); @@ -2615,7 +2622,7 @@ } //----- (004A57E9) -------------------------------------------------------- -void __cdecl Present_ColorKey() +void Present_ColorKey() { HRESULT v0; // eax@3 HRESULT v1; // eax@3 @@ -2927,7 +2934,7 @@ if ( pParty->uFine ) { //v10 = result->_guilds_member_bits; - result = (Player *)_449B57_test_bit((unsigned __int8 *)result->_guilds_member_bits, 1); + result = (Player *)_449B57_test_bit((unsigned __int8 *)result->_achieved_awards_bits, 1); if ( !(short)result ) __debugbreak(); //result = (Player *)_449B7E_toggle_bit((unsigned char *)v10, 1, 1u); @@ -2939,7 +2946,7 @@ } //----- (004B1523) -------------------------------------------------------- -void __thiscall sub_4B1523(int *_this) +void sub_4B1523(int *_this) { int v1; // esi@1 int v2; // edx@1 @@ -3009,7 +3016,7 @@ } //----- (004B1ECE) -------------------------------------------------------- -void __cdecl sub_4B1ECE() +void OracleDialogue() { __int16 *v0; // edi@1 int v1; // ebx@3 @@ -3103,13 +3110,9 @@ v9->uHolderPlayer = v5; } } -// 4F08EC: using guessed type int dword_4F08EC[]; -// 722B3C: using guessed type int dword_722B3C; -// 722B44: using guessed type int dword_722B44; -// F8B1A8: using guessed type int dword_F8B1A8; //----- (004B254D) -------------------------------------------------------- -char *__thiscall _4B254D_SkillMasteryTeacher(int _this) +char * _4B254D_SkillMasteryTeacher(int _this) { //Player *v1; // esi@1 int v2; // edx@1 @@ -3485,7 +3488,7 @@ } //----- (004B3E1E) -------------------------------------------------------- -void __cdecl sub_4B3E1E() +void sub_4B3E1E() { NPCData *v0; // ST40_4@1 signed int v1; // edi@1 @@ -3506,7 +3509,6 @@ pDialogueWindow->_41D08F_set_keyboard_control_group(v1 + 1, 1, 0, 1); } -// F8B19C: using guessed type int dword_F8B19C; //----- (004B3FE5) -------------------------------------------------------- void __fastcall sub_4B3FE5(int a4) @@ -3544,13 +3546,13 @@ } //----- (004B46F8) -------------------------------------------------------- -int __fastcall sub_4B46F8(int a1) +__int64 GetExperienceRequiredForLevel(int level) { - int v1; // eax@1 + __int64 v1; // eax@1 int i; // edx@1 v1 = 0; - for ( i = 0; i < a1; ++i ) + for ( i = 0; i < level; ++i ) v1 += i + 1; return 1000 * v1; } @@ -3756,12 +3758,13 @@ switch ( npc_event_id ) { case 139: - sub_4B1ECE(); + OracleDialogue(); break; case 311: sub_4BBA85_bounties(); break; case 399: + __debugbreak(); // what kind of dialogue is that? sub_4BBCDD(); break; default:
--- a/mm7_5.cpp Thu Aug 29 12:04:33 2013 +0600 +++ b/mm7_5.cpp Thu Aug 29 12:04:55 2013 +0600 @@ -51,7 +51,7 @@ #include "Lights.h" //----- (004304E7) -------------------------------------------------------- -void __cdecl GameUI_MsgProc() +void GameUI_MsgProc() { //signed int v0; // edi@6 //char *v1; // esi@6 @@ -890,7 +890,7 @@ MM7Initialization(); continue; } - ModalWindow(pNPCTopics[453].pText, 0); + ModalWindow(pNPCTopics[453].pText, UIMSG_0); continue; case UIMSG_GameMenu_ReturnToGame: pGUIWindow_CurrentMenu->Release(); @@ -983,7 +983,7 @@ } break; } - if ( !ptr_507BDC ) + if ( !pModalWindow ) { pRenderer->ClearZBuffer(0, 479); viewparams->bRedrawGameUI = 1; @@ -1392,7 +1392,7 @@ continue; case SCREEN_CHARACTERS: CharacterUI_ReleaseButtons(); - sub_419379(); + ReleaseAwardsScrollBar(); pIcons_LOD->RemoveTexturesPackFromTextureList(); if ( pGUIWindow_Settings ) { @@ -1479,7 +1479,7 @@ continue; } CharacterUI_ReleaseButtons(); - sub_419379(); + ReleaseAwardsScrollBar(); pIcons_LOD->RemoveTexturesPackFromTextureList(); } if ( pGUIWindow_Settings ) @@ -1565,7 +1565,7 @@ back_to_game(); continue; } - sub_41426F(); + ModalWindow_Release(); continue; case UIMSG_ScrollNPCPanel://Right and Left button for NPCPanel if ( uMessageParam ) @@ -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(); @@ -1751,7 +1751,7 @@ TeleportToStartingPoint(uLevel_StartingPointType); pParty->vPosition.z = GetTerrainHeightsAroundParty2(pParty->vPosition.x, pParty->vPosition.y, &v213, 0); pParty->uFallStartY = pParty->vPosition.z; - sub_461103(); + _461103_load_level_sub(); pEventTimer->Resume(); viewparams->bRedrawGameUI = 1; pCurrentScreen = SCREEN_GAME; @@ -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; @@ -2249,13 +2249,14 @@ sprintfex(pFinalMessage.data(), "%s\n \n%s\n \n%s", pGlobalTXT_LocalizationStrings[151],// "Congratulations Adventurer." pGlobalTXT_LocalizationStrings[118],// "We hope that you've enjoyed playing Might and Magic VII as much as we did making it. We have saved this screen as MM7_WIN.PCX in your MM7 directory. You can print it out as proof of your accomplishment." pGlobalTXT_LocalizationStrings[167]);// "- The Might and Magic VII Development Team." - ModalWindow(pFinalMessage.data(), 196); + ModalWindow(pFinalMessage.data(), UIMSG_OnFinalWindowClose); uGameState = GAME_STATE_FINAL_WINDOW; continue; - case UIMSG_C4: + case UIMSG_OnFinalWindowClose: __debugbreak(); uGameState = GAME_STATE_PLAYING; strcpy((char *)pKeyActionMap->pPressedKeysBuffer, "2"); + __debugbreak(); // missed break/continue? case UIMSG_DD: __debugbreak(); sprintf(pTmpBuf.data(), "%s", pKeyActionMap->pPressedKeysBuffer); @@ -2282,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(); @@ -2479,7 +2480,7 @@ pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; if ( pCurrentScreen ) continue; - if ( sub_42F4DA() ) + if ( _42F4DA_check_actor_proximity() ) { if ( pParty->bTurnBasedModeOn == 1 ) { @@ -2537,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]; @@ -2885,13 +2886,13 @@ case UIMSG_ClickStatsBtn: pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 100; CharacterUI_ReleaseButtons(); - sub_419379(); + ReleaseAwardsScrollBar(); GUIWindow::Create(pCharacterScreen_StatsBtn->uX, pCharacterScreen_StatsBtn->uY, 0, 0, WINDOW_CharactersPressedButton, (int)pCharacterScreen_StatsBtn, 0); continue; case UIMSG_ClickSkillsBtn: pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 101; CharacterUI_ReleaseButtons(); - sub_419379(); + ReleaseAwardsScrollBar(); CharacterUI_SkillsTab_CreateButtons(); GUIWindow::Create(pCharacterScreen_SkillsBtn->uX, pCharacterScreen_SkillsBtn->uY, 0, 0, WINDOW_CharactersPressedButton, (int)pCharacterScreen_SkillsBtn, 0); continue; @@ -2920,7 +2921,7 @@ continue; case UIMSG_ClickInventoryBtn: pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 103; - sub_419379(); + ReleaseAwardsScrollBar(); CharacterUI_ReleaseButtons(); GUIWindow::Create(pCharacterScreen_InventoryBtn->uX, pCharacterScreen_InventoryBtn->uY, 0, 0, WINDOW_CharactersPressedButton, (int)pCharacterScreen_InventoryBtn, 0); continue; @@ -2928,7 +2929,7 @@ GUIWindow::Create(pCharacterScreen_ExitBtn->uX, pCharacterScreen_ExitBtn->uY, 0, 0, WINDOW_ExitCharacterWindow, (int)pCharacterScreen_ExitBtn, 0); continue; case UIMSG_ClickAwardsBtn: - sub_419379(); + ReleaseAwardsScrollBar(); CharacterUI_ReleaseButtons(); CreateAwardsScrollBar(); pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 102; @@ -3238,7 +3239,7 @@ } //----- (004356FF) -------------------------------------------------------- -void __cdecl back_to_game() +void back_to_game() { dword_507BF0_is_there_popup_onscreen = 0; dword_4E455C = 1; @@ -3251,7 +3252,7 @@ } //----- (00435748) -------------------------------------------------------- -void __cdecl GUI_MainMenuMessageProc() +void GUI_MainMenuMessageProc() { Player *pPlayer; // ebx@2 void *v3; // edi@21 @@ -3387,7 +3388,7 @@ break; case UIMSG_PlayerCreationClickOK: GUIWindow::Create(580, 431, 0, 0, WINDOW_PressedButton2, (int)pPlayerCreationUI_BtnOK, 0); - if ( PlayerCreation_GetUnspentAttributePointCount() || !PlayerCreation_Chose4Skills() ) + if ( PlayerCreation_GetUnspentAttributePointCount() || !PlayerCreation_Choose4Skills() ) GameUI_Footer_TimeLeft = GetTickCount() + 4000; else uGameState = GAME_STATE_STARTING_NEW_GAME; @@ -3420,7 +3421,7 @@ pMouse->SetCursorBitmap("MICON2"); break; case UIMSG_3A: - SetCurrentMenuID(MENU_10); + SetCurrentMenuID(MENU_DebugBLVLevel); break; case UIMSG_LoadGame: if (!pSavegameUsedSlots[uLoadGameUI_SelectedSlot]) @@ -3479,12 +3480,12 @@ break; case UIMSG_AE: GUIWindow::Create(pMainMenu_BtnExit->uX, pMainMenu_BtnExit->uY, 0, 0, WINDOW_PressedButton2, (int)pMainMenu_BtnExit, 0); - SetCurrentMenuID(MENU_10); + SetCurrentMenuID(MENU_DebugBLVLevel); break; case UIMSG_Escape: - if ( ptr_507BDC ) + if ( pModalWindow ) { - sub_41426F(); + ModalWindow_Release(); break; } if ( !(BYTE1(dword_6BE364_game_settings_1) & 0x40) ) @@ -3579,7 +3580,7 @@ } //----- (00436427) -------------------------------------------------------- -double __cdecl get_shading_dist_mist() +double get_shading_dist_mist() { if (uCurrentlyLoadedLevelType == LEVEL_Outdoor) return (double)pOutdoorCamera->shading_dist_mist; @@ -3917,7 +3918,7 @@ } else { - result = (flt_4E4A80[v2] - flt_4E4A80[v2 - 3]) * (v3 - flt_4E4A80[v2 + 4]) / (flt_4E4A80[v2 + 5] - flt_4E4A80[v2 + 4]) + flt_4E4A80[v2]; + result = (flt_4E4A80[v2] - flt_4E4A80[v2 - 1]) * (v3 - flt_4E4A80[v2 + 4]) / (flt_4E4A80[v2 + 5] - flt_4E4A80[v2 + 4]) + flt_4E4A80[v2]; } return result; } @@ -4597,20 +4598,15 @@ //----- (004075DB) -------------------------------------------------------- bool __fastcall sub_4075DB(int a1, int a2, int a3, BLVFace *a4) { - BLVFace *v4; // eax@1 unsigned int v5; // esi@1 - signed int v6; // esi@2 char v7; // zf@2 int v8; // edi@2 Vec3_short_ *v9; // ecx@3 int v10; // edx@4 - signed int v11; // esi@7 Vec3_short_ *v12; // ecx@8 int v13; // edx@9 - signed int v14; // esi@11 Vec3_short_ *v15; // ecx@12 int v16; // edx@13 - int v17; // eax@14 bool v18; // esi@14 int v19; // ecx@14 int v20; // ecx@16 @@ -4621,111 +4617,70 @@ signed int v25; // eax@22 signed __int64 v26; // qtt@22 bool result; // eax@25 - int v28; // [sp+8h] [bp-14h]@14 int v29; // [sp+10h] [bp-Ch]@14 signed int a3a; // [sp+24h] [bp+8h]@14 int a4a; // [sp+28h] [bp+Ch]@2 - v4 = a4; + __debugbreak(); + v5 = a4->uAttributes; - if ( v5 & 0x100 ) + v9 = pIndoor->pVertices; + if ( v5 & FACE_XY_PLANE ) { - v6 = 0; - v7 = a4->uNumVertices == 0; a4a = a1; v8 = a2; - if ( !v7 ) - { - v9 = pIndoor->pVertices; - do - { - dword_4F5D98_xs[v6] = v9[v4->pVertexIDs[v6]].x; - v10 = v4->pVertexIDs[v6++]; - dword_4F5CC4_ys[v6] = v9[v10].y; - } - while ( v6 < v4->uNumVertices ); - } + for(int i = 0; i < a4->uNumVertices; i++) + { + dword_4F5D98_xs[i] = v9[a4->pVertexIDs[i]].x; + dword_4F5CC4_ys[i+1] = v9[a4->pVertexIDs[i]].y; + } } else { v8 = a3; - if ( v5 & 0x200 ) + if ( v5 & FACE_XY_PLANE ) { - v11 = 0; - v7 = a4->uNumVertices == 0; a4a = a1; - if ( !v7 ) - { - v12 = pIndoor->pVertices; - do - { - dword_4F5D98_xs[v11] = v12[v4->pVertexIDs[v11]].x; - v13 = v4->pVertexIDs[v11++]; - dword_4F5CC4_ys[v11] = v12[v13].z; - } - while ( v11 < v4->uNumVertices ); - } + for(int i = 0; i < a4->uNumVertices; i++) + { + dword_4F5D98_xs[i] = v9[a4->pVertexIDs[i]].x; + dword_4F5CC4_ys[i+1] = v9[a4->pVertexIDs[i]].z; + } } else { - v14 = 0; - v7 = a4->uNumVertices == 0; a4a = a2; - if ( !v7 ) - { - v15 = pIndoor->pVertices; - do - { - dword_4F5D98_xs[v14] = v15[v4->pVertexIDs[v14]].y; - v16 = v4->pVertexIDs[v14++]; - dword_4F5CC4_ys[v14] = v15[v16].z; - } - while ( v14 < v4->uNumVertices ); - } + for(int i = 0; i < a4->uNumVertices; i++) + { + dword_4F5D98_xs[i] = v9[a4->pVertexIDs[i]].y; + dword_4F5CC4_ys[i+1] = v9[a4->pVertexIDs[i]].z; + } } } - v17 = v4->uNumVertices; a3a = 0; - dword_4F5D98_xs[v17] = dword_4F5D98_xs[0]; - dword_4F5CC4_ys[v17 + 1] = dword_4F5CC4_ys[1]; - v28 = v17; - v18 = dword_4F5CC4_ys[1] >= v8; - v19 = 0; - v29 = 0; - if ( v17 <= 0 ) - return 0; - do + dword_4F5D98_xs[a4->uNumVertices] = dword_4F5D98_xs[0]; + dword_4F5CC4_ys[a4->uNumVertices + 1] = dword_4F5CC4_ys[1]; + for(int i = 0; i < a4->uNumVertices; i++) { if ( a3a >= 2 ) break; - v20 = v19; - v21 = dword_4F5CC4_ys[v20 + 2]; - if ( v18 ^ (v21 >= v8) ) + if ( dword_4F5CC4_ys[i + 1] >= v8 ^ (dword_4F5CC4_ys[i + 2] >= v8) ) { - v22 = dword_4F5D98_xs[v20 + 1]; - if ( v22 >= a4a ) - v23 = 0; - else - v23 = 2; - v24 = v23 | (dword_4F5D98_xs[v20] < a4a); - if ( v24 != 3 ) + if( dword_4F5D98_xs[i + 1] >= a4a || dword_4F5D98_xs[i] >= a4a) { - if ( !v24 - || (v25 = v22 - dword_4F5D98_xs[v20], + if ( (dword_4F5D98_xs[i + 1] >= a4a && dword_4F5D98_xs[i] >= a4a) + || (v25 = dword_4F5D98_xs[i + 1] - dword_4F5D98_xs[i], LODWORD(v26) = v25 << 16, HIDWORD(v26) = v25 >> 16, - dword_4F5D98_xs[v20] + dword_4F5D98_xs[i] + ((signed int)(((unsigned __int64)(v26 - / (v21 - dword_4F5CC4_ys[v20 + 1]) - * ((v8 - dword_4F5CC4_ys[v20 + 1]) << 16)) >> 16) + / (dword_4F5CC4_ys[i + 2] - dword_4F5CC4_ys[i + 1]) + * ((v8 - dword_4F5CC4_ys[i + 1]) << 16)) >> 16) + 32768) >> 16) >= a4a) ) ++a3a; } } - v18 = v21 >= v8; - v19 = v29++ + 1; } - while ( v29 < v28 ); result = 1; if ( a3a != 1 ) result = 0; @@ -4735,11 +4690,12 @@ //----- (004077F1) -------------------------------------------------------- bool __fastcall sub_4077F1(int a1, int a2, int a3, ODMFace *a4, BSPVertexBuffer *a5) { - ODMFace *v5; // eax@1 - unsigned int v6; // esi@1 + //ODMFace *v5; // eax@1 + Vec3_int_ *v9; + unsigned int v5; // esi@1 signed int v7; // edi@1 - char v8; // zf@2 - unsigned __int16 *v9; // edx@3 + //char v8; // zf@2 + //unsigned __int16 *v9; // edx@3 int v10; // ecx@4 unsigned __int16 *v11; // edx@8 int v12; // ecx@9 @@ -4759,131 +4715,84 @@ int a4a; // [sp+28h] [bp+Ch]@2 signed int a5a; // [sp+2Ch] [bp+10h]@14 - v5 = a4; - v6 = a4->uAttributes; - v7 = 0; - if ( v6 & 0x100 ) + __debugbreak(); + + v5 = a4->uAttributes; + v9 = a5->pVertices; + if ( v5 & FACE_XY_PLANE ) { - v8 = a4->uNumVertices == 0; a4a = a1; a3 = a2; - if ( !v8 ) - { - v9 = v5->pVertexIDs; - do - { - ++v7; - dword_4F5BF4_xs[v7] = a5->pVertices[*v9].x; - v10 = *v9; - ++v9; - dword_4F5B24_ys[v7] = a5->pVertices[v10].y; - } - while ( v7 < v5->uNumVertices ); - } + for(int i = 0; i < a4->uNumVertices; i++) + { + dword_4F5BF4_xs[i+1] = v9[a4->pVertexIDs[i]].x; + dword_4F5B24_ys[i+1] = v9[a4->pVertexIDs[i]].y; + } } else { - if ( v6 & 0x200 ) + if ( v5 & FACE_XY_PLANE ) { - v8 = a4->uNumVertices == 0; a4a = a1; - if ( !v8 ) - { - v11 = v5->pVertexIDs; - do - { - ++v7; - dword_4F5BF4_xs[v7] = a5->pVertices[*v11].x; - v12 = *v11; - ++v11; - dword_4F5B24_ys[v7] = a5->pVertices[v12].z; - } - while ( v7 < v5->uNumVertices ); - } + for(int i = 0; i < a4->uNumVertices; i++) + { + dword_4F5BF4_xs[i+1] = v9[a4->pVertexIDs[i]].x; + dword_4F5B24_ys[i+1] = v9[a4->pVertexIDs[i]].z; + } } else { - v8 = a4->uNumVertices == 0; a4a = a2; - if ( !v8 ) - { - v13 = (int)v5->pVertexIDs; - do - { - ++v7; - dword_4F5BF4_xs[v7] = a5->pVertices[*(short *)v13].y; - v14 = *(short *)v13; - v13 += 2; - dword_4F5B24_ys[v7] = a5->pVertices[v14].z; - } - while ( v7 < v5->uNumVertices ); - } + for(int i = 0; i < a4->uNumVertices; i++) + { + dword_4F5BF4_xs[i+1] = v9[a4->pVertexIDs[i]].y; + dword_4F5B24_ys[i+1] = v9[a4->pVertexIDs[i]].z; + } } } - v15 = v5->uNumVertices; a5a = 0; - dword_4F5BF4_xs[v15 + 1] = dword_4F5BF4_xs[1]; - dword_4F5B24_ys[v15 + 1] = dword_4F5B24_ys[1]; - v25 = 0; - v16 = dword_4F5B24_ys[1] >= a3; - if ( v15 <= 0 ) - return 0; - do + dword_4F5BF4_xs[a4->uNumVertices + 1] = dword_4F5BF4_xs[1]; + dword_4F5B24_ys[a4->uNumVertices + 1] = dword_4F5B24_ys[1]; + for(int i = 0; i < a4->uNumVertices; i++) { if ( a5a >= 2 ) break; - v17 = v25; - v18 = dword_4F5B24_ys[v25 + 2]; - if ( v16 ^ (v18 >= a3) ) + if ( dword_4F5B24_ys[i + 1] >= a3 ^ (dword_4F5B24_ys[i + 2] >= a3) ) { - v19 = dword_4F5BF4_xs[v17 + 2]; - if ( v19 >= a4a ) - v20 = 0; - else - v20 = 2; - v21 = v20 | (dword_4F5BF4_xs[v17 + 1] < a4a); - if ( v21 != 3 ) + if( dword_4F5BF4_xs[i + 2] >= a4a || dword_4F5BF4_xs[i] >= a4a) { - if ( !v21 - || (v22 = v19 - dword_4F5BF4_xs[v17 + 1], - LODWORD(v23) = v22 << 16, - HIDWORD(v23) = v22 >> 16, - dword_4F5BF4_xs[v17 + 1] + if ( (dword_4F5BF4_xs[i + 2] >= a4a && dword_4F5BF4_xs[i + 1] >= a4a) + || (v25 = dword_4F5BF4_xs[i + 2] - dword_4F5BF4_xs[i + 1], + LODWORD(v23) = v25 << 16, + HIDWORD(v23) = v25 >> 16, + dword_4F5BF4_xs[i + 1] + ((signed int)(((unsigned __int64)(v23 - / (v18 - dword_4F5B24_ys[v17 + 1]) - * ((a3 - dword_4F5B24_ys[v17 + 1]) << 16)) >> 16) + / (dword_4F5B24_ys[i + 2] - dword_4F5B24_ys[i + 1]) + * ((a3 - dword_4F5B24_ys[i + 1]) << 16)) >> 16) + 32768) >> 16) >= a4a) ) ++a5a; - } + } } - ++v25; - v16 = v18 >= a3; } - while ( v25 < v15 ); result = 1; if ( a5a != 1 ) result = 0; return result; + } //----- (004088E9) -------------------------------------------------------- -signed int __fastcall sub_4088E9(int a1, int a2, int a3, int a4, int a5, int a6) +int __fastcall sub_4088E9(int x1, int y1, int x2, int y2, int x3, int y3) { - int v6; // esi@1 - int v7; // edi@1 int v8; // eax@1 signed int result; // eax@1 - int v10; // [sp+Ch] [bp-4h]@1 int v11; // [sp+18h] [bp+8h]@1 - v6 = a1; - v10 = a2; - v7 = a3 - a1; - v11 = abs(a3 - a1); - v8 = abs(a4 - v10); + v11 = abs(x2 - x1); + v8 = abs(y2 - y1); result = integer_sqrt(v11 * v11 + v8 * v8); if ( result ) - result = abs((v7 * (v10 - a6) - (a4 - v10) * (v6 - a5)) / result); + result = abs(((x2 - x1) * (y1 - y3) - (y2 - y1) * (x1 - x3)) / result); return result; } @@ -4895,13 +4804,6 @@ LOBYTE(pRenderer->uTargetRBits) + LOBYTE(pRenderer->uTargetBBits) - 8)); } -//----- (0040DFA7) -------------------------------------------------------- -int __stdcall retzero_sub_40DFA7(int a1) -{ - return 0; -} -// 40DFA7: using guessed type int __stdcall retzero_sub_40DFA7(int); - //----- (0040F82D) -------------------------------------------------------- @@ -4964,7 +4866,7 @@ } //----- (0040F92A) -------------------------------------------------------- -void __fastcall sub_40F92A(int *pZBuffer, Texture *a2, int a3) +void __fastcall ZBuffer_DoFill2(int *pZBuffer, Texture *a2, int a3) { Texture *v3; // esi@1 void *v4; // eax@3 @@ -5005,7 +4907,7 @@ } //----- (00410D99) -------------------------------------------------------- -signed int __fastcall sub_410D99_get_map_index(int a1) +int __fastcall sub_410D99_get_map_index(int a1) { int v1; // edi@1 signed int v2; // ebp@1
--- a/mm7_6.cpp Thu Aug 29 12:04:33 2013 +0600 +++ b/mm7_6.cpp Thu Aug 29 12:04:55 2013 +0600 @@ -44,7 +44,7 @@ //----- (00424EE0) -------------------------------------------------------- -signed int __fastcall sr_424EE0_MakeFanFromTriangle(unsigned int uVertexID) +int __fastcall sr_424EE0_MakeFanFromTriangle(unsigned int uVertexID) { unsigned int v1; // edx@1 double v2; // st7@1 @@ -209,78 +209,6 @@ return result; } -//----- (0042620A) -------------------------------------------------------- -bool sr_42620A(RenderVertexSoft *p) -{ - __int16 v1; // fps@1 - unsigned __int8 v2; // c0@2 - char v3; // c2@2 - unsigned __int8 v4; // c3@2 - bool result; // eax@2 - unsigned __int8 v6; // c0@4 - char v7; // c2@4 - unsigned __int8 v8; // c3@4 - unsigned __int8 v9; // c0@6 - char v10; // c2@6 - unsigned __int8 v11; // c3@6 - double v12; // st6@7 - float v13; // ST04_4@7 - float v14; // ST00_4@7 - double v15; // st7@7 - double v16; // st6@8 - float v17; // ST04_4@8 - float v18; // ST00_4@8 - double v19; // st7@8 - - //UNDEF(v1); - if ( p->vWorldViewPosition.x < 300.0 - || (v2 = 300.0 < p[1].vWorldViewPosition.x, - v3 = 0, - v4 = 300.0 == p[1].vWorldViewPosition.x, - //BYTE1(result) = HIBYTE(v1), - !(v2 | v4)) ) - { - if ( p->vWorldViewPosition.x < 300.0 ) - { - v6 = 300.0 < p[1].vWorldViewPosition.x; - v7 = 0; - v8 = 300.0 == p[1].vWorldViewPosition.x; - //BYTE1(result) = HIBYTE(v1); - if ( !(v6 | v8) ) - { - //LOBYTE(result) = 0; - return false; - } - } - v9 = 300.0 < p->vWorldViewPosition.x; - v10 = 0; - v11 = 300.0 == p->vWorldViewPosition.x; - //BYTE1(result) = HIBYTE(v1); - if ( v9 | v11 ) - { - v16 = 1.0 / (p->vWorldViewPosition.x - p[1].vWorldViewPosition.x); - v17 = (p->vWorldViewPosition.y - p[1].vWorldViewPosition.y) * v16; - v18 = (p->vWorldViewPosition.z - p[1].vWorldViewPosition.z) * v16; - v19 = 300.0 - p[1].vWorldViewPosition.x; - p[1].vWorldViewPosition.x = v19 + p[1].vWorldViewPosition.x; - p[1].vWorldViewPosition.y = v17 * v19 + p[1].vWorldViewPosition.y; - p[1].vWorldViewPosition.z = v19 * v18 + p[1].vWorldViewPosition.z; - } - else - { - v12 = 1.0 / (p[1].vWorldViewPosition.x - p->vWorldViewPosition.x); - v13 = (p[1].vWorldViewPosition.y - p->vWorldViewPosition.y) * v12; - v14 = (p[1].vWorldViewPosition.z - p->vWorldViewPosition.z) * v12; - v15 = 300.0 - p->vWorldViewPosition.x; - p->vWorldViewPosition.x = v15 + p->vWorldViewPosition.x; - p->vWorldViewPosition.y = v13 * v15 + p->vWorldViewPosition.y; - p->vWorldViewPosition.z = v15 * v14 + p->vWorldViewPosition.z; - } - } - //LOBYTE(result) = 1; - return true; -} - //----- (004268E3) -------------------------------------------------------- int __fastcall _4268E3_smthn_to_a1r5g5b5(unsigned int uColor) { @@ -313,16 +241,6 @@ LOWORD(v2) = (a1 >> 5) & 0x7E0; return ((unsigned __int8)a1 >> 3) | v2 | v1; } -//----- (00426947) -------------------------------------------------------- -void __cdecl sub_426947() -{ - stru_50C198.field_0 = 0; - dword_50C994 = 0; - dword_50C998_turnbased_icon_1A = 0; -} -// 50C968: using guessed type int dword_50C968; -// 50C994: using guessed type int dword_50C994; -// 50C998: using guessed type int dword_50C998_turnbased_icon_1A; //----- (00426A5A) -------------------------------------------------------- void stru319::LootActor(Actor *pActor) @@ -1137,12 +1055,6 @@ } } -//----- (0042EBBE) -------------------------------------------------------- -int __fastcall sub_42EBBE(int a1, int a2) -{ - return (unsigned __int64)(a2 * (signed __int64)a1) >> 16; -} -// 42EBBE: using guessed type int __fastcall sub_42EBBE(int, int); //----- (0042EBDB) -------------------------------------------------------- int stru193_math::Sin(int angle) @@ -1549,7 +1461,7 @@ } //----- (0042F4DA) -------------------------------------------------------- -signed int __cdecl sub_42F4DA() +int _42F4DA_check_actor_proximity() { signed int v0; // edi@1 Actor *v1; // esi@4 @@ -1837,7 +1749,7 @@ } //----- (0042FB5C) -------------------------------------------------------- -bool __fastcall sub_42FB5C(signed int a1) +bool _42FB5C_check_spell(signed int a1) { int v1; // ecx@3 int v2; // ecx@4 @@ -1897,7 +1809,7 @@ } //----- (0042FBDD) -------------------------------------------------------- -void __cdecl sub_42FBDD() +void sub_42FBDD() { pAudioPlayer->PlaySound(SOUND_Button2, 0, 0, -1, 0, 0, 0, 0); pRenderer->DrawTextureTransparent(pBtn_YES->uX, pBtn_YES->uY, pBtn_YES->pTextures[0]); @@ -1905,7 +1817,7 @@ } //----- (0042FC15) -------------------------------------------------------- -void __cdecl CloseWindowBackground() +void CloseWindowBackground() { pAudioPlayer->PlaySound(SOUND_Button2, -2, 0, -1, 0, 0, 0, 0); pRenderer->DrawTextureTransparent(pBtn_ExitCancel->uX, pBtn_ExitCancel->uY, pBtn_ExitCancel->pTextures[0]); @@ -1913,7 +1825,7 @@ } //----- (0042FC4E) -------------------------------------------------------- -void __cdecl ProcessInputActions() +void ProcessInputActions() { char v4; // al@9 char v8; // bl@100
--- a/mm7_data.cpp Thu Aug 29 12:04:33 2013 +0600 +++ b/mm7_data.cpp Thu Aug 29 12:04:55 2013 +0600 @@ -500,7 +500,11 @@ int dword_4E4A1C[777]; // weak int dword_4E4A40[777]; // weak int dword_4E4A44[777]; // weak -std::array<float, 10> flt_4E4A80; +std::array<float, 10> flt_4E4A80 = +{ + 0.050000001, 0.1, 0.30000001, 0.5, 0.60000002, + 1.0, 6.0, 25.0, 50.0, 100.0 +}; std::array< std::array<int, 2>, 14> pPartySpellbuffsUI_XYs = @@ -924,7 +928,6 @@ int uGameMenuUI_CurentlySelectedKeyIdx; // 506E68 std::array<unsigned int, 27> pPrevVirtualCidesMapping; int KeyboardPageNum; // weak -std::array<int, 777> dword_506F0C; // idb int uRestUI_FoodRequiredToRest; int dword_506F14; // weak int _506F18_num_minutes_to_sleep; // weak @@ -957,7 +960,7 @@ int dword_507B98_ctrl_pressed; // weak unsigned int uActiveCharacter; int dword_507BF0_is_there_popup_onscreen; // weak -int dword_507CBC; // weak +int awards_scroll_bar_created; // weak int dword_507CC0_activ_ch; // weak __int64 GameUI_RightPanel_BookFlashTimer; // weak int _507CD4_RestUI_hourglass_anim_controller; // weak @@ -995,8 +998,8 @@ unsigned int uIconID_TurnHour; int uIconID_CharacterFrame; // idb unsigned int uIconID_TurnStart; -int dword_50C994; // weak -int dword_50C998_turnbased_icon_1A; // weak +int dword_50C994 = 0; // weak +int dword_50C998_turnbased_icon_1A = 0; // weak int uSpriteID_Spell11; // idb _UNKNOWN unk_50C9A0; // weak int _50C9A8_item_enchantment_timer = 0; // weak @@ -1012,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; @@ -1069,7 +1072,7 @@ int dword_5C3418; // weak int dword_5C341C; // weak int _5C3420_pDecoration; -std::array<char, 777> byte_5C3427; // weak +//std::array<char, 777> byte_5C3427; // weak std::array<char, 200> GameUI_Footer_TimedString; std::array<char, 200> pFooterString; unsigned int GameUI_Footer_TimeLeft; @@ -1137,8 +1140,8 @@ std::array<int, 777> _6807B8_level_decorations_ids; // idb int _6807E0_num_decorations_with_sounds_6807B8; // weak -std::array<int, 777> _6807E8_level_decorations_ids; // idb -int _6836C8_num_decorations_6807E8; // weak +std::array<int, 3000> event_triggers; // 6807E8 +int num_event_triggers; // 6836C8 std::array<int, 64> dword_69B010; float flt_69B138_dist; // weak char byte_69BD41_unused; // weak @@ -1211,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 @@ -1380,8 +1383,4 @@ int dword_F93F20; // weak int dword_F93F70; // weak -volatile bool initing; - -//int crt_F94004; // weak -//int crtdword_F9400C; // weak -FARPROC lpfn; // idb \ No newline at end of file +volatile bool initing; \ No newline at end of file
--- a/mm7_data.h Thu Aug 29 12:04:33 2013 +0600 +++ b/mm7_data.h Thu Aug 29 12:04:55 2013 +0600 @@ -570,7 +570,6 @@ extern std::array<bool, 28> GameMenuUI_InvaligKeyBindingsFlags; // 506E6C extern std::array<unsigned int, 27> pPrevVirtualCidesMapping; extern int KeyboardPageNum; // weak -extern std::array<int, 777> dword_506F0C; // idb extern int uRestUI_FoodRequiredToRest; extern int dword_506F14; // weak extern int _506F18_num_minutes_to_sleep; // weak @@ -603,7 +602,7 @@ extern int dword_507B98_ctrl_pressed; // weak extern unsigned int uActiveCharacter; extern int dword_507BF0_is_there_popup_onscreen; // weak -extern int dword_507CBC; // weak +extern int awards_scroll_bar_created; // weak extern int dword_507CC0_activ_ch; // weak extern __int64 GameUI_RightPanel_BookFlashTimer; // weak extern int _507CD4_RestUI_hourglass_anim_controller; // weak @@ -658,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; @@ -717,7 +716,7 @@ extern int dword_5C3418; // weak extern int dword_5C341C; // weak extern int _5C3420_pDecoration; -extern std::array<char, 777> byte_5C3427; // weak +//extern std::array<char, 777> byte_5C3427; // weak extern std::array<char, 200> GameUI_Footer_TimedString; extern std::array<char, 200> pFooterString; extern unsigned int GameUI_Footer_TimeLeft; @@ -784,8 +783,8 @@ extern std::array<int, 777> _6807B8_level_decorations_ids; // idb extern int _6807E0_num_decorations_with_sounds_6807B8; // weak -extern std::array<int, 777> _6807E8_level_decorations_ids; // idb -extern int _6836C8_num_decorations_6807E8; // weak +extern std::array<int, 3000> event_triggers; // 6807E8 +extern int num_event_triggers; // 6836C8 extern std::array<int, 64> dword_69B010; extern float flt_69B138_dist; // weak extern char byte_69BD41_unused; // weak @@ -861,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 @@ -1043,18 +1042,6 @@ extern volatile bool initing; //ADDED -//extern int crt_F94004; // weak -//extern int crtdword_F9400C; // weak -extern FARPROC lpfn; // idb -//extern int crt_F944EC; // weak -//extern int crtdword_F944F0; // weak -//extern void *crt_F944F4; // idb -//extern int crtdword_F944F8; // weak -//extern LPVOID crt_lpMem; // idb -//extern int crt_F94500; // weak -//extern HANDLE crt_hHeap; // idb -//extern int crt_F94508; // weak - @@ -1071,12 +1058,21 @@ //------------------------------------------------------------------------- // Function declarations -#define __thiscall __cdecl // Test compile in C mode + +void init_event_triggers(); +void check_event_triggers(); + + + -void __stdcall mm7__vector_constructor(void *a1, int objSize, int numObjs, int (__thiscall *constructor)(int)); +void ShowIntroVideo_and_LoadingScreen(); +unsigned int GameOverMenu(void *ecx0); +int __fastcall SpawnRandomTreasure(struct MapInfo *a1, struct SpawnPointMM7 *a2); +void DamageMonsterFromParty(signed int a1, unsigned int uActorID_Monster, struct Vec3_int_ *pVelocity); + void MakeActorAIList_ODM(); -int __cdecl MakeActorAIList_BLV(); -void __cdecl UpdateActorAI(); +int MakeActorAIList_BLV(); +void UpdateActorAI(); bool __fastcall sub_4070EF_prolly_collide_objects(unsigned int uObjID, unsigned int uObj2ID); bool __fastcall sub_4075DB(int a1, int a2, int a3, struct BLVFace *a4); bool __fastcall sub_4077F1(int a1, int a2, int a3, struct ODMFace *a4, struct BSPVertexBuffer *a5); @@ -1084,42 +1080,27 @@ void InitializeActors(); void InitializeSpriteObjects(); int __fastcall sub_4088E9(int a1, int a2, int a3, int a4, int a5, int a6); -unsigned int __thiscall SearchAliveActors(unsigned int *pTotalActors); -unsigned int __fastcall SearchActorByMonsterID(unsigned int *pTotalActors, int uMonsterID); -unsigned int __fastcall SearchActorByGroup(unsigned int *pTotalActors, unsigned int uGroup); -unsigned int __fastcall SearchActorByID(unsigned int *pTotalActors, unsigned int a2); -void PrepareArcomage(); - +unsigned int SearchAliveActors(unsigned int *pTotalActors); +unsigned int SearchActorByMonsterID(unsigned int *pTotalActors, int uMonsterID); +unsigned int SearchActorByGroup(unsigned int *pTotalActors, unsigned int uGroup); +unsigned int SearchActorByID(unsigned int *pTotalActors, unsigned int a2); +void PrepareArcomage(); unsigned short TargetColor(unsigned __int16 r, unsigned __int16 g, unsigned __int16 b); // idb -void __cdecl CallRenderPresent(); -void __thiscall DoBlt_Copy(unsigned __int16 *pPixels); // idb -int __stdcall retzero_sub_40DFA7(int); // weak -int loc_40E4FC(); // weak +void CallRenderPresent(); +void DoBlt_Copy(unsigned __int16 *pPixels); // idb void __fastcall ZBuffer_Fill(int *pZBuffer, int uTextureId, int iZValue); - void __fastcall ZBuffer_DoFill(int *pZBuffer, struct Texture *pTex, int uZValue); -void __fastcall sub_40F92A(int *pZBuffer, struct Texture *a2, int a3); // idb -void __cdecl SetMoonPhaseNames(); -signed int __fastcall sub_410D99_get_map_index(int a1); +void __fastcall ZBuffer_DoFill2(int *pZBuffer, struct Texture *a2, int a3); // idb +void SetMoonPhaseNames(); +int __fastcall sub_410D99_get_map_index(int a1); void __fastcall LoadThumbnailLloydTexture(unsigned int uSlot, unsigned int uPlayer); void SetAttributeNames(); void uGameUIFontMain_initialize(); void uGameUIFontShadow_initialize(); -void sub_41420D_press_esc(); -void sub_41426F(); -void __fastcall DrawPopupWindow(unsigned int uX, unsigned int uY, unsigned int uWidth, unsigned int uHeight); // idb -void DrawCopyrightWindow(); -void LoadFonts_and_DrawCopyrightWindow(); -void GUI_UpdateWindows(); void identify_item(); -void __thiscall sub_416D62_ShowPopupWindow_MonsterRecord_ItemInfo_etcsub_416D62(struct Vec2_int_ *_this); +void sub_416D62_ShowPopupWindow_MonsterRecord_ItemInfo_etcsub_416D62(struct Vec2_int_ *_this); void UI_OnMouseLeftClick(int *pXY); // idb -void __thiscall sub_417871(int *pXY); unsigned int __fastcall UI_GetHealthManaStringColor(signed int a1, signed int a2); -signed int __thiscall GetConditionDrawColor(unsigned int uConditionIdx); // idb -void FillAwardsData(); -void CreateAwardsScrollBar(); -void sub_419379(); unsigned int __fastcall GetSizeInInventorySlots(unsigned int uNumPixels); struct GUIButton *__fastcall GUI_HandleHotkey(unsigned __int8 uHotkey); // idb int __fastcall GUI_ReplaceHotkey(unsigned __int8 uOldHotkey, unsigned __int8 uNewHotkey, char bFirstCall); @@ -1127,78 +1108,62 @@ bool UI_OnKeyDown(unsigned int vkKey); void GameUI_DrawItemInfo(struct ItemGen* inspect_item); // idb void MonsterPopup_Draw(unsigned int uActorID, struct GUIWindow *edx0); -void __cdecl nullsub_3(); // idb -void __cdecl LoadActualSkyFrame(); -void __cdecl Sleep6Hours(); -void __cdecl ChestUI_WritePointedObjectStatusString(); - +void LoadActualSkyFrame(); +void Sleep6Hours(); +void ChestUI_WritePointedObjectStatusString(); void __fastcall party_finds_gold(unsigned int uNumGold, int _1_dont_share_with_followers___2_the_same_but_without_a_message__else_normal); // idb void OnChestLeftClick(); -void __cdecl GameUI_WritePointedObjectStatusString(); -//struct GUIWindow *__thiscall GetCastSpellInInventoryWindow(void *a4); -bool __cdecl sub_421B2C_PlaceInInventory_or_DropPickedItem(); +void GameUI_WritePointedObjectStatusString(); +bool sub_421B2C_PlaceInInventory_or_DropPickedItem(); void __fastcall GameUI_OnPlayerPortraitLeftClick(unsigned int uPlayerID); // idb void OnInventoryLeftClick(); void OnGameViewportClick(); bool PauseGameDrawing(); void SetUserInterface(enum PartyAlignment alignment, bool bReplace); -void __cdecl reset_some_strus_flt_2Cs(); +void reset_some_strus_flt_2Cs(); int __fastcall GetPortalScreenCoord(unsigned int uFaceID); -signed int __fastcall sr_424579(int uFaceID, struct stru320 *a2); bool PortalFrustrum(int pNumVertices, struct BspRenderer_PortalViewportData *a2, struct BspRenderer_PortalViewportData *near_portal, int uFaceID); int sr_424CD7(unsigned int uVertexID); // idb -signed int __fastcall sr_424EE0_MakeFanFromTriangle(unsigned int uVertexID); // idb -signed int __fastcall sr_4250FE(unsigned int uVertexID); // idb -bool sr_42620A(struct RenderVertexSoft *p); +int __fastcall sr_424EE0_MakeFanFromTriangle(unsigned int uVertexID); // idb int __fastcall _4268E3_smthn_to_a1r5g5b5(unsigned int uColor); // idb int __fastcall _42690D_colors_cvt(unsigned int a1); -void __cdecl sub_426947(); void __fastcall GivePartyExp(unsigned int pEXPNum); bool __fastcall sub_427769_spell(unsigned int uSpellID); void _42777D_CastSpell_UseWand_ShootArrow(int a1, unsigned int uPlayerID, unsigned int a4, __int16 a5, int a6); -int __fastcall sub_42EBBE(int, int); // weak void _42ECB5_PlayerAttacksActor(); -void __thiscall InitializeTurnBasedAnimations(void *); -signed int __cdecl sub_42F4DA(); +void InitializeTurnBasedAnimations(void *); +int _42F4DA_check_actor_proximity(); bool __fastcall sub_42F7EB_DropItemAt(unsigned int uSpriteID, int x, int y, int z, int a4, int count, int a7, unsigned __int16 attributes, ItemGen *a9); void __fastcall sub_42F960_create_object(int x, int y, int z); // idb void CompactLayingItemsList(); -signed int __fastcall _42FA66_do_explosive_impact(int a1, int a2, int a3, int a4, __int16 a5, signed int a6); -bool __fastcall sub_42FB5C(signed int a1); -// int __cdecl crt_sub_42FBB7(); -// void __cdecl crt_construct_50CDB4(); -void __cdecl sub_42FBDD(); -void __cdecl CloseWindowBackground(); -void __cdecl ProcessInputActions(); -void __cdecl GameUI_MsgProc(); -void __cdecl back_to_game(); -void __cdecl GUI_MainMenuMessageProc(); -double __cdecl get_shading_dist_mist(); +int __fastcall _42FA66_do_explosive_impact(int a1, int a2, int a3, int a4, __int16 a5, signed int a6); +bool _42FB5C_check_spell(signed int a1); +void sub_42FBDD(); +void CloseWindowBackground(); +void ProcessInputActions(); +void GameUI_MsgProc(); +void back_to_game(); +void GUI_MainMenuMessageProc(); +double get_shading_dist_mist(); void Vec3_short__to_RenderVertexSoft(struct RenderVertexSoft *_this, struct Vec3_short_ *a2); -void __cdecl nullsub_4(); // idb -void __cdecl nullsub_5(); // idb -void __cdecl nullsub_6(); // idb -void __cdecl area_of_effect__damage_evaluate(); +void area_of_effect__damage_evaluate(); void __fastcall DamagePlayerFromMonster(unsigned int uObjID, int a2, struct Vec3_int_ *pPos, unsigned int a4); void __fastcall sub_43A97E(unsigned int uLayingItemID, signed int a2); // idb double __fastcall sub_43AE12(signed int a1); int __fastcall _43AFE3_calc_spell_damage(int a1, int a2, signed int a3, int a4); void __fastcall sub_43B057(unsigned int uObjID, unsigned int uActorID, struct Vec3_int_ *pVelocity); void sub_43B1B0(signed int a1, unsigned int a2, struct Vec3_int_ *pVelocity, signed int a4); -int __stdcall DirectInputKeyboard_enumerator_43B9B9(int, int); // weak void Software_ResetNewEdges(); -// int __cdecl crt_deconstruct_43B9E3(); -int __stdcall DirectInputMouse_enumerator(int, int); // weak void CharacterUI_LoadPaperdollTextures(); int __fastcall GetItemTextureFilename(char *pOut, signed int item_id, int index, int shoulder); bool _43ED6F_check_party_races(bool b); -bool __thiscall sub_43EDB9_get_some_race_sex_relation_2(unsigned int _this); +bool sub_43EDB9_get_some_race_sex_relation_2(unsigned int _this); bool __fastcall Player_has_item(unsigned int uItemID, struct Player *pPlayer, char a3); bool __fastcall sub_43EE77_ProbablyIfUnderwaterSuitIsEquipped(signed int a1); -void WetsuitOn(unsigned int uPlayerID); // idb -void WetsuitOff(unsigned int uPlayerID); +void WetsuitOn(unsigned int uPlayerID); // idb +void WetsuitOff(unsigned int uPlayerID); void __fastcall PrepareDrawLists_BLV(struct IndoorLocation_drawstru *_this); -void __cdecl FindBillboardsLightLevels_BLV(); +void FindBillboardsLightLevels_BLV(); int __fastcall _43F55F_get_billboard_light_level(struct RenderBillboard *a1, int uBaseLightLevel); int __fastcall _43F5C8_get_point_light_level_with_respect_to_lights(unsigned int uBaseLightLevel, int uSectorID, float x, float y, float z); void PrepareBspRenderList_BLV(); @@ -1212,199 +1177,110 @@ __int16 __fastcall sub_441A4E(int a1); void DrawBook_Map_sub(unsigned int tl_x, unsigned int tl_y, unsigned int br_x, int br_y, int _48074); // idb void Initialize2DA(); - -void LoadLevel_InitializeLevelStr(); - -void __cdecl OnMapLeave(); -void /*__usercall*/ OnMapLoad(); +void LoadLevel_InitializeLevelStr(); +void OnMapLeave(); +void OnMapLoad(); void Level_LoadEvtAndStr(const char *pLevelName); -const char *__cdecl sub_444564(); -char *__thiscall GetEventHintString(unsigned int uEventID); // idb +const char *sub_444564(); +char *GetEventHintString(unsigned int uEventID); // idb int GetTravelTime(); void __fastcall sub_4451A8_press_any_key(int a1, int a2, int a4); -void __cdecl sub_4452BB(); -const char *GetProfessionActionText(int a1); -struct NPCData *__fastcall GetNPCData(signed int npcid); -struct NPCData * GetNewNPCData(signed int npcid, int* npc_indx); -int __fastcall GetGreetType(signed int SpeakingNPC_ID); -void __cdecl DialogueEnding(); -void PrepareHouse(enum HOUSE_ID house); // idb -bool EnterHouse(enum HOUSE_ID uHouseID); -int sub_4465DF_check_season(int a1); -int __fastcall IsActorAlive(unsigned int uType, unsigned int uParam, unsigned int uNumAlive); // idb -// void __cdecl crt_construct_5773C4(); -int NPC_EventProcessor(int npc_event_id, int entry_line = 0); - -void __fastcall sub_448518_npc_set_item(int npc, unsigned int item, int a3); -void __fastcall sub_44861E_set_texture(unsigned int uFaceCog, const char *pFilename); -void __fastcall SetDecorationSprite(unsigned int uCog, int a2, const char *pFileName); // idb -void __fastcall sub_44892E_set_faces_bit(int sCogNumber, int bit, int on); -void __fastcall ToggleActorGroupFlag(unsigned int uGroupID, unsigned int uFlag, unsigned int bToggle); -void __thiscall GameUI_StatusBar_UpdateTimedString(unsigned int bForceHide); // idb -void OnTimer(int); -void __fastcall sub_448CF4_spawn_monsters(__int16 typeindex, __int16 level, int count, int x, int y, int z, int group, unsigned int uUniqueName); -void __fastcall EventCastSpell(int spellnum, int uSkillLevel, int uSkill, int fromx, int fromy, int fromz, int tox, int toy, int toz);//sub_448DF8 -__int16 __fastcall sub_449A49_door_switch_animation(unsigned int uDoorID, int a2); // idb -bool _449B57_test_bit(unsigned __int8 *a1, __int16 a2); -void _449B7E_toggle_bit(unsigned char *pArray, __int16 a2, unsigned __int16 bToggle); // idb -void ShowStatusBarString(const char *pString, unsigned int uNumSeconds); -void __cdecl ShowNothingHereStatus(); -signed int __cdecl const_2(); -bool __cdecl sub_44C28F_open_nwc_dungeon(); -// int __cdecl crt_deconstruct_44C42C(); -void SpawnEncounter(struct MapInfo *pMapInfo, struct SpawnPointMM7 *spawn, int a3, int a4, int a5); -int __fastcall sub_44FA4C_spawn_light_elemental(int a1, int a2, int a3); - -signed int __fastcall sub_450521_ProllyDropItemAt(int ecx0, signed int a2, int a3, int a4, int a5, unsigned __int16 a6); -int __fastcall _45063B_spawn_some_monster(struct MapInfo *a1, int a2); -void RespawnGlobalDecorations(); -bool __fastcall SpawnActor(unsigned int uMonsterID); -int __cdecl GetAlertStatus(); -unsigned int __fastcall sub_452442(unsigned __int16 a1, unsigned __int16 a2, int a3, int a4); -int integer_sqrt(int val); -int __fastcall MakeColorMaskFromBitDepth(int a1); -void __fastcall fill_pixels_fast(unsigned int a1, unsigned __int16 *pPixels, unsigned int uNumPixels); -int __fastcall GetDiceResult(unsigned int uNumDice, unsigned int uDiceSides); // idb -inline int round(float x) { return (int)floor(x + 0.5f); } -inline void __fastcall memset32(void *ptr, unsigned __int32 value, int count) -{ - auto p = (unsigned __int32 *)ptr; - for ( int i=0; i < count; i++ ) - *p++ = value; -} -inline void __fastcall j_memset32(int a2, void *a1, unsigned int a3) {memset32(a1, a2, a3);} -// int __cdecl crt_452B74(); -int __cdecl j_SetSomeItemsNames(); - - int SkillToMastery(unsigned int skill_value); unsigned int __fastcall GetSpellColor(signed int a1); -void *__thiscall unknown_vdtor_6(void *_this, bool a2); unsigned short * MakeScreenshot(signed int width, signed int height); -void __thiscall SaveScreenshot(const char *pFilename); +void SaveScreenshot(const char *pFilename); void __fastcall LoadGame(unsigned int uSlot); // idb void SaveGame(bool IsAutoSAve, bool NotSaveWorld); void __fastcall DoSavegame(unsigned int uSlot); // idb -void __cdecl TryLoadLevelFromLOD(); -void __cdecl sub_46080D(); -bool __cdecl Initialize_GamesLOD_NewLOD(); +void TryLoadLevelFromLOD(); +void sub_46080D(); +bool Initialize_GamesLOD_NewLOD(); void SaveNewGame(); -void __thiscall PrepareToLoadBLV(unsigned int bLoading); +void PrepareToLoadBLV(unsigned int bLoading); void __fastcall PrepareToLoadODM(unsigned int bLoading, struct OutdoorCamera *a2); -void __cdecl sub_461103(); -int __cdecl sub_4613C4(); +void _461103_load_level_sub(); int int_get_vector_length(signed int x, signed int y, signed int z); -int __cdecl sub_46224A(); -int __cdecl crt_init_globals_462620(); -void __cdecl crt_init_globals_462659(); -void __cdecl crt_init_globals_46269B(); -void __cdecl crt_init_globals_46271C(); -void __cdecl MainMenu_Loop(); -char __cdecl sub_4637E0_is_there_popup_onscreen(); -void __cdecl ResetCursor_Palettes_LODs_Level_Audio_SFT_Windows(); -void __thiscall PrepareWorld(unsigned int _this); -void __thiscall Game_DeinitializeAndTerminate(int exitCode); // idb -void __cdecl FinalInitialization(); -char __cdecl Is_out15odm_underwater(); -void __cdecl SetUnderwaterFog(); -void __fastcall DoPrepareWorld(unsigned int bLoading, int a2); +void MainMenu_Loop(); +char sub_4637E0_is_there_popup_onscreen(); +void ResetCursor_Palettes_LODs_Level_Audio_SFT_Windows(); +void PrepareWorld(unsigned int _0_box_loading_1_fullscreen); +void Game_DeinitializeAndTerminate(int exitCode); // idb +void FinalInitialization(); +char Is_out15odm_underwater(); +void SetUnderwaterFog(); +void DoPrepareWorld(unsigned int bLoading, int _1_fullscreen_loading_2_box); int __fastcall ReadWindowsRegistryInt(const char *pKey, int uDefValue); // idb void __fastcall WriteWindowsRegistryString(const char *pKey, const char *pString); void __fastcall ReadWindowsRegistryString(const char *pKeyName, char *pOutString, int uBufLen, const char *pDefaultValue); void __fastcall WriteWindowsRegistryInt(const char *pKey, int val); bool __fastcall CheckMM7CD(char c); -int loc_465CC8(); // weak -void __cdecl SecondaryInitialization(); -void __cdecl CreateAsyncMouse(); -void __cdecl CreateAsyncKeyboard(); -void __cdecl MM6_Initialize(const wchar_t *pIniFilename); -void __cdecl MM7Initialization(); -int __cdecl AbortWithError(); +void SecondaryInitialization(); +void CreateAsyncMouse(); +void CreateAsyncKeyboard(); +void MM6_Initialize(const wchar_t *pIniFilename); +void MM7Initialization(); +int AbortWithError(); void Abortf(const char *Format, ...); void SetCurrentMenuID(enum MENU_STATE); // idb enum MENU_STATE GetCurrentMenuID(); -void *__thiscall output_debug_string(void *_this, std::string a2, const char *a3, int a4); -std::string *__fastcall _4678E2_make_error_string(std::string *a1, int line, std::string file); -void CreateMsgScrollWindow(signed int mscroll_id); -void __cdecl free_book_subwindow(); -void CreateScrollWindow(); -void __cdecl OnPaperdollLeftClick(); +void CreateMsgScrollWindow(signed int mscroll_id); +void free_book_subwindow(); +void CreateScrollWindow(); +void OnPaperdollLeftClick(); void OnPressSpace(); char __fastcall DoInteractionWithTopmostZObject(int a1, int a2); -int __fastcall sub_46A6AC(int a1, int a2, int a3); -int __fastcall sub_46A7C8(int a1, int a2, signed int a3); -int __fastcall sub_46A89E(int a1, int a2, signed int a3); -int __cdecl sub_46A99B(); -void *__thiscall unknown_libname_8(void *_this, char a2); -unsigned int __cdecl GetGravityStrength(); -void __cdecl UpdateUserInput_and_MapSpecificStuff(); -void __cdecl BLV_UpdateUserInputAndOther(); -void __cdecl ODM_UpdateUserInputAndOther(); -bool __fastcall _46BFFA_check_object_intercept(unsigned int uLayingItemID, signed int a2); -void __cdecl check_event_triggers(); -int BLV_GetFloorLevel(int x, int y, int z, unsigned int uSectorID, unsigned int *pFaceID); -int ODM_GetFloorLevel(int X, signed int Y, int Z, int, int *pOnWater, int *bmodel_pid, int bWaterWalk); -int __fastcall sub_46D8E3(int a1, signed int a2, int a3, int a4); -void ODM_GetTerrainNormalAt(int pos_x, int pos_z, Vec3_int_ *out); -unsigned int __fastcall sub_46DEF2(signed int a2, unsigned int uLayingItemID); -int __fastcall _46DF1A_collide_against_actor(int, int); // weak -void __cdecl _46E0B2_collide_against_decorations(); -void __fastcall _46E26D_collide_against_sprites(signed int a1, signed int a2); -int __thiscall _46E44E_collide_against_faces_and_portals(unsigned int b1); // idb -int __fastcall _46E889_collide_against_bmodels(unsigned int ecx0); -int collide_against_floor(int x, int y, int z, unsigned int *pSectorID, unsigned int *pFaceID); // idb -void __fastcall _46ED8A_collide_against_sprite_objects(unsigned int _this); -int __thiscall _46EF01_collision_chech_player(int a1); // idb -signed int __cdecl _46F04E_collide_against_portals(); -void BLV_UpdateDoors(); -void UpdateActors_BLV(); -void UpdateActors_ODM(); -void UpdateObjects(); -int collide_against_floor_approximate(int x, int y, int z, unsigned int *pSectorID, unsigned int *pFaceID); // idb -void BLV_ProcessPartyActions(); -void ODM_ProcessPartyActions(); -bool __fastcall sub_47531C(int a1, int *a2, int a3, int a4, int a5, int a6, int a7, int a8, BLVFace *a9, int a10); -bool __fastcall sub_4754BF(int a1, int *a2, int a3, int a4, int a5, int a6, int a7, int a8, BLVFace *a9, int a10, int a11); -signed int __thiscall sub_475665(BLVFace *_this, int a2, __int16 a3); -bool __fastcall sub_4759C9(BLVFace *a1, int a2, int a3, __int16 a4); -bool __fastcall sub_475D85(Vec3_int_ *a1, Vec3_int_ *a2, int *a3, BLVFace *a4); -bool __fastcall sub_475F30(int *a1, BLVFace *a2, int a3, int a4, int a5, int a6, int a7, int a8, int a9); - -int __cdecl GetPartyReputation(); -void __cdecl sub_4783FA_construct_global_73D150(); -void __cdecl loc_4789D4(); // idb -void __cdecl loc_47907F(); // idb +int GetPartyReputation(); +void OracleDialogue(); +void __fastcall ClickNPCTopic(signed int uMessageParam); +char * _4B254D_SkillMasteryTeacher(int _this); +const char *ContractSelectText(int pEventCode); +void SimpleHouseAndBoatsDialog(); +void CreateButtonInColumn(int a1, unsigned int a2); +void FillAviableSkillsToTeach(int _this); +void sub_4B3E1E(); +void DrawJoinGuildWindow(int pEventCode); +void __fastcall sub_4B3FE5(int a4); +void NPCHireableDialogPrepare(); +void _4B4224_UpdateNPCTopics(int _this); +void __fastcall DrawTextAtStatusBar(const char *Str, int a5); +__int64 GetExperienceRequiredForLevel(int a1); +const char *sub_4BBA85_bounties(); +void sub_4BBCDD(); +void __fastcall _4BBF61_summon_actor(int a1, __int16 x, int y, int z); // idb +void ArenaFight(); +void SpellBookGenerator(); +void UI_CreateEndConversationButton(); +void __fastcall OnSelectShopDialogueOption(signed int uMessageParam); +int sub_4BD8B5(); +bool __fastcall MerchandiseTest(ItemGen *item, int _2da_idx); +void UIShop_Buy_Identify_Repair(); bool __fastcall IsBModelVisible(unsigned int uModelID, int *unused); -void __thiscall ODM_LoadAndInitialize(const char *pLevelFilename, struct OutdoorCamera *thisa); +void ODM_LoadAndInitialize(const char *pLevelFilename, struct OutdoorCamera *thisa); unsigned int GetLevelFogColor(); int __fastcall sub_47C3D7_get_fog_related_stuff(int a1, int a2, float a3); -signed int __fastcall GetActorTintColor(int max_dim, int min_dim, float distance, int a4, struct RenderBillboard *a5); +int __fastcall GetActorTintColor(int max_dim, int min_dim, float distance, int a4, struct RenderBillboard *a5); unsigned int WorldPosToGridCellX(int); // weak unsigned int WorldPosToGridCellZ(int); // weak -int __stdcall GridCellToWorldPosX(int); // weak -int __stdcall GridCellToWorldPosZ(int); // weak -void __cdecl loc_48118F(); // idb -void __cdecl loc_481199(); // idb +int GridCellToWorldPosX(int); // weak +int GridCellToWorldPosZ(int); // weak void ResetPolygons(); -void __cdecl sub_481ED9_MessWithOutdoorCamera(); +void sub_481ED9_MessWithOutdoorCamera(); bool IsTerrainSlopeTooHigh(int pos_x, int pos_y); int __fastcall GetTerrainHeightsAroundParty2(int a1, int a2, int *a3, int a4); -signed int __cdecl const_1_0(); -void __cdecl sub_487DA9(); -double __thiscall GetFogDensityByTime(struct OutdoorLocation *_this); -int __stdcall loc_489BB3(struct stru320 *a2, int thisa, unsigned int uNumVertices, RenderVertexSoft *a5, float a6, char uClipFlag); // weak +void sub_487DA9(); +double GetFogDensityByTime(struct OutdoorLocation *_this); bool __fastcall HSV2RGB(float *a1, float *a2, float *a3, float a4, float a5, float a6); void __fastcall RGB2HSV(float *a1, float *a2, float a3, float a4, float a5, float *a6); unsigned int ReplaceHSV(unsigned int uColor, float a2, float gamma, float a4); -signed int __cdecl PlayerCreation_Chose4Skills(); -signed int __cdecl PlayerCreation_GetUnspentAttributePointCount(); +int PlayerCreation_Choose4Skills(); +int PlayerCreation_GetUnspentAttributePointCount(); void LoadPlayerPortraintsAndVoices(); int __fastcall ReloadPlayerPortraits(int, int); // weak void sub_491E3A(); -signed int __thiscall CycleCharacter(unsigned int _this); +int CycleCharacter(bool backwards); void __fastcall Rest(unsigned int uHoursToSleep); int _493938_regenerate(); -void sub_493F79(struct stru351_summoned_item *_this, __int64 a2); +void init_summoned_item(struct stru351_summoned_item *_this, __int64 duration); void _494035_timed_effects__water_walking_damage__etc(); unsigned int __fastcall _494820_training_time(unsigned int a1); char *__fastcall sub_495366(unsigned __int8 a1, unsigned __int8 a2); @@ -1425,51 +1301,100 @@ unsigned int ModulateColor(unsigned int diffuse, float multiplier); // idb struct SoundHeader *FindSound_BinSearch(unsigned int uStart, unsigned int uEnd, const char *pName); struct SoundData *LoadSound(const char *pSoundName, struct SoundData *pOutBuff, unsigned int uID); -int __fastcall sub_4AAEA6_transform(RenderVertexSoft *a1); +int __fastcall sub_4AAEA6_transform(struct RenderVertexSoft *a1); int __fastcall sub_4AB66C(int, int); // weak int GetSoundStrengthByDistanceFromParty(int x, int y, int z); struct _DIG_DRIVER *Audio_GetFirstHardwareDigitalDriver(void); -void __cdecl PlayLevelMusic(); +void PlayLevelMusic(); unsigned int __fastcall sub_4B0E07(unsigned int uFaceID); // idb struct Player *__fastcall sub_4B1447_party_fine(int a1, int a2, int a3); -void __thiscall sub_4B1523(int *_this); -void __cdecl ShowPopupShopItem(); -void __stdcall RestAndHeal(__int64 uNumMinutes); // idb -void __cdecl GetHouseGoodbyeSpeech(); - -void __cdecl sub_4B1ECE(); -void __fastcall ClickNPCTopic(signed int uMessageParam); -char *__thiscall _4B254D_SkillMasteryTeacher(int _this); -const char * ContractSelectText(int pEventCode); -void SimpleHouseAndBoatsDialog(); -void CreateButtonInColumn(int a1, unsigned int a2); -void FillAviableSkillsToTeach(int _this); -void __cdecl sub_4B3E1E(); -void DrawJoinGuildWindow(int pEventCode); -void __fastcall sub_4B3FE5(int a4); -void NPCHireableDialogPrepare(); -void _4B4224_UpdateNPCTopics(int _this); -void __fastcall DrawTextAtStatusBar(const char *Str, int a5); -int __fastcall sub_4B46F8(int a1); - -const char *sub_4BBA85_bounties(); -void __cdecl sub_4BBCDD(); -void __fastcall _4BBF61_summon_actor(int a1, __int16 x, int y, int z); // idb -void __cdecl ArenaFight(); -void SpellBookGenerator(); -void UI_CreateEndConversationButton(); -void __fastcall OnSelectShopDialogueOption(signed int uMessageParam); -signed int __cdecl sub_4BD8B5(); -bool __fastcall MerchandiseTest(ItemGen *item, int _2da_idx); -void __cdecl UIShop_Buy_Identify_Repair(); - - -void __cdecl ShowIntroVideo_and_LoadingScreen(); -unsigned int __thiscall GameOverMenu(void *ecx0); -bool __thiscall BinkLockBuffer(struct _BINKBUF *_this); -void __thiscall BinkUnlockBuffer(struct _BINKBUF *_this); -signed int __fastcall SpawnRandomTreasure(struct MapInfo *a1, struct SpawnPointMM7 *a2); -void DamageMonsterFromParty(signed int a1, unsigned int uActorID_Monster, struct Vec3_int_ *pVelocity); +void sub_4B1523(int *_this); +void ShowPopupShopItem(); +void RestAndHeal(__int64 uNumMinutes); // idb +void GetHouseGoodbyeSpeech(); +int __fastcall _46A6AC_spell_render(int a1, int a2, int a3); +int __fastcall _46A6AC_spell_render_d3d(int a1, int a2, int a3); +int __fastcall _46A89E_immolation_effect(int a1, int a2, int a3); +int sub_46A99B(); +unsigned int GetGravityStrength(); +void UpdateUserInput_and_MapSpecificStuff(); +void BLV_UpdateUserInputAndOther(); +void ODM_UpdateUserInputAndOther(); +bool __fastcall _46BFFA_check_object_intercept(unsigned int uLayingItemID, signed int a2); +int BLV_GetFloorLevel(int x, int y, int z, unsigned int uSectorID, unsigned int *pFaceID); +int ODM_GetFloorLevel(int X, signed int Y, int Z, int, int *pOnWater, int *bmodel_pid, int bWaterWalk); +int __fastcall sub_46D8E3(int a1, signed int a2, int a3, int a4); +void ODM_GetTerrainNormalAt(int pos_x, int pos_z, Vec3_int_ *out); +unsigned int __fastcall sub_46DEF2(signed int a2, unsigned int uLayingItemID); +int __fastcall _46DF1A_collide_against_actor(int, int); // weak +void _46E0B2_collide_against_decorations(); +void __fastcall _46E26D_collide_against_sprites(signed int a1, signed int a2); +int _46E44E_collide_against_faces_and_portals(unsigned int b1); // idb +int __fastcall _46E889_collide_against_bmodels(unsigned int ecx0); +int collide_against_floor(int x, int y, int z, unsigned int *pSectorID, unsigned int *pFaceID); // idb +void __fastcall _46ED8A_collide_against_sprite_objects(unsigned int _this); +int _46EF01_collision_chech_player(int a1); // idb +int _46F04E_collide_against_portals(); +void BLV_UpdateDoors(); +void UpdateActors_BLV(); +void UpdateActors_ODM(); +void UpdateObjects(); +int collide_against_floor_approximate(int x, int y, int z, unsigned int *pSectorID, unsigned int *pFaceID); // idb +void BLV_ProcessPartyActions(); +void ODM_ProcessPartyActions(); +bool __fastcall sub_47531C(int a1, int *a2, int a3, int a4, int a5, int a6, int a7, int a8, struct BLVFace *a9, int a10); +bool __fastcall sub_4754BF(int a1, int *a2, int a3, int a4, int a5, int a6, int a7, int a8, struct BLVFace *a9, int a10, int a11); +int sub_475665(struct BLVFace *_this, int a2, __int16 a3); +bool __fastcall sub_4759C9(struct BLVFace *a1, int a2, int a3, __int16 a4); +bool __fastcall sub_475D85(Vec3_int_ *a1, Vec3_int_ *a2, int *a3, struct BLVFace *a4); +bool __fastcall sub_475F30(int *a1, struct BLVFace *a2, int a3, int a4, int a5, int a6, int a7, int a8, int a9); +void sub_4452BB(); +const char *GetProfessionActionText(int a1); +struct NPCData *__fastcall GetNPCData(signed int npcid); +struct NPCData * GetNewNPCData(signed int npcid, int* npc_indx); +int __fastcall GetGreetType(signed int SpeakingNPC_ID); +void DialogueEnding(); +void PrepareHouse(enum HOUSE_ID house); // idb +bool EnterHouse(enum HOUSE_ID uHouseID); +int sub_4465DF_check_season(int a1); +int __fastcall IsActorAlive(unsigned int uType, unsigned int uParam, unsigned int uNumAlive); // idb +int NPC_EventProcessor(int npc_event_id, int entry_line = 0); +void __fastcall sub_448518_npc_set_item(int npc, unsigned int item, int a3); +void __fastcall sub_44861E_set_texture(unsigned int uFaceCog, const char *pFilename); +void __fastcall SetDecorationSprite(unsigned int uCog, int a2, const char *pFileName); // idb +void __fastcall sub_44892E_set_faces_bit(int sCogNumber, int bit, int on); +void __fastcall ToggleActorGroupFlag(unsigned int uGroupID, unsigned int uFlag, unsigned int bToggle); +void GameUI_StatusBar_UpdateTimedString(unsigned int bForceHide); // idb +void OnTimer(int); +void __fastcall sub_448CF4_spawn_monsters(__int16 typeindex, __int16 level, int count, int x, int y, int z, int group, unsigned int uUniqueName); +void __fastcall EventCastSpell(int spellnum, int uSkillLevel, int uSkill, int fromx, int fromy, int fromz, int tox, int toy, int toz);//sub_448DF8 +__int16 __fastcall sub_449A49_door_switch_animation(unsigned int uDoorID, int a2); // idb +bool _449B57_test_bit(unsigned __int8 *a1, __int16 a2); +void _449B7E_toggle_bit(unsigned char *pArray, __int16 a2, unsigned __int16 bToggle); // idb +void ShowStatusBarString(const char *pString, unsigned int uNumSeconds); +void ShowNothingHereStatus(); +int const_2(); +bool TeleportToNWCDungeon(); +void SpawnEncounter(struct MapInfo *pMapInfo, struct SpawnPointMM7 *spawn, int a3, int a4, int a5); +int __fastcall sub_44FA4C_spawn_light_elemental(int a1, int a2, int a3); +int __fastcall sub_450521_ProllyDropItemAt(int ecx0, signed int a2, int a3, int a4, int a5, unsigned __int16 a6); +int __fastcall _45063B_spawn_some_monster(struct MapInfo *a1, int a2); +void RespawnGlobalDecorations(); +bool __fastcall SpawnActor(unsigned int uMonsterID); +int GetAlertStatus(); +unsigned int __fastcall sub_452442(unsigned __int16 a1, unsigned __int16 a2, int a3, int a4); +int integer_sqrt(int val); +int __fastcall MakeColorMaskFromBitDepth(int a1); +void __fastcall fill_pixels_fast(unsigned int a1, unsigned __int16 *pPixels, unsigned int uNumPixels); +int __fastcall GetDiceResult(unsigned int uNumDice, unsigned int uDiceSides); // idb +inline int round(float x) { return (int)floor(x + 0.5f); } +inline void __fastcall memset32(void *ptr, unsigned __int32 value, int count) +{ + auto p = (unsigned __int32 *)ptr; + for ( int i=0; i < count; i++ ) + *p++ = value; +} +inline void __fastcall j_memset32(int a2, void *a1, unsigned int a3) {memset32(a1, a2, a3);} #define ErrD3D(hr) do {extern void ErrHR(HRESULT, const char *, const char *, const char *, int); ErrHR(hr, "Direct3D", __FUNCTION__, __FILE__, __LINE__);} while(0)
--- a/mm7text_ru.cpp Thu Aug 29 12:04:33 2013 +0600 +++ b/mm7text_ru.cpp Thu Aug 29 12:04:55 2013 +0600 @@ -1161,7 +1161,7 @@ return nullptr; } -int __cdecl sprintfex_internal(char *str) +int sprintfex_internal(char *str) { auto p = strstr(str, "^"); if (!p)
--- a/stru10.h Thu Aug 29 12:04:33 2013 +0600 +++ b/stru10.h Thu Aug 29 12:04:55 2013 +0600 @@ -17,7 +17,7 @@ void _49CE9E(struct BLVFace *pFace, struct RenderVertexSoft *pVertices, unsigned int uNumVertices, RenderVertexSoft *pOutLimits); - void (__thiscall ***vdestructor_ptr)(stru10 *, bool); + void ( ***vdestructor_ptr)(stru10 *, bool); int bDoNotDrawPortalFrustum; }; #pragma pack(pop)
--- a/stru6.cpp Thu Aug 29 12:04:33 2013 +0600 +++ b/stru6.cpp Thu Aug 29 12:04:55 2013 +0600 @@ -28,6 +28,80 @@ +//----- (0042620A) -------------------------------------------------------- +bool sr_42620A(RenderVertexSoft *p) +{ + __int16 v1; // fps@1 + unsigned __int8 v2; // c0@2 + char v3; // c2@2 + unsigned __int8 v4; // c3@2 + bool result; // eax@2 + unsigned __int8 v6; // c0@4 + char v7; // c2@4 + unsigned __int8 v8; // c3@4 + unsigned __int8 v9; // c0@6 + char v10; // c2@6 + unsigned __int8 v11; // c3@6 + double v12; // st6@7 + float v13; // ST04_4@7 + float v14; // ST00_4@7 + double v15; // st7@7 + double v16; // st6@8 + float v17; // ST04_4@8 + float v18; // ST00_4@8 + double v19; // st7@8 + + //UNDEF(v1); + if ( p->vWorldViewPosition.x < 300.0 + || (v2 = 300.0 < p[1].vWorldViewPosition.x, + v3 = 0, + v4 = 300.0 == p[1].vWorldViewPosition.x, + //BYTE1(result) = HIBYTE(v1), + !(v2 | v4)) ) + { + if ( p->vWorldViewPosition.x < 300.0 ) + { + v6 = 300.0 < p[1].vWorldViewPosition.x; + v7 = 0; + v8 = 300.0 == p[1].vWorldViewPosition.x; + //BYTE1(result) = HIBYTE(v1); + if ( !(v6 | v8) ) + { + //LOBYTE(result) = 0; + return false; + } + } + v9 = 300.0 < p->vWorldViewPosition.x; + v10 = 0; + v11 = 300.0 == p->vWorldViewPosition.x; + //BYTE1(result) = HIBYTE(v1); + if ( v9 | v11 ) + { + v16 = 1.0 / (p->vWorldViewPosition.x - p[1].vWorldViewPosition.x); + v17 = (p->vWorldViewPosition.y - p[1].vWorldViewPosition.y) * v16; + v18 = (p->vWorldViewPosition.z - p[1].vWorldViewPosition.z) * v16; + v19 = 300.0 - p[1].vWorldViewPosition.x; + p[1].vWorldViewPosition.x = v19 + p[1].vWorldViewPosition.x; + p[1].vWorldViewPosition.y = v17 * v19 + p[1].vWorldViewPosition.y; + p[1].vWorldViewPosition.z = v19 * v18 + p[1].vWorldViewPosition.z; + } + else + { + v12 = 1.0 / (p[1].vWorldViewPosition.x - p->vWorldViewPosition.x); + v13 = (p[1].vWorldViewPosition.y - p->vWorldViewPosition.y) * v12; + v14 = (p[1].vWorldViewPosition.z - p->vWorldViewPosition.z) * v12; + v15 = 300.0 - p->vWorldViewPosition.x; + p->vWorldViewPosition.x = v15 + p->vWorldViewPosition.x; + p->vWorldViewPosition.y = v13 * v15 + p->vWorldViewPosition.y; + p->vWorldViewPosition.z = v15 * v14 + p->vWorldViewPosition.z; + } + } + //LOBYTE(result) = 1; + return true; +} + + + //----- (004775C4) -------------------------------------------------------- stru6_stru1_indoor_sw_billboard::~stru6_stru1_indoor_sw_billboard() {
--- a/stru9.h Thu Aug 29 12:04:33 2013 +0600 +++ b/stru9.h Thu Aug 29 12:04:55 2013 +0600 @@ -58,6 +58,6 @@ bool AreVectorsCollinear(struct RenderVertexSoft *a1, struct RenderVertexSoft *a2, struct stru312 *a3); bool _4989E1(struct RenderVertexSoft *a1, struct RenderVertexSoft *a2, struct RenderVertexSoft *a3, struct stru312 *a4); - void (__thiscall ***vdestructor_ptr)(stru9 *, bool); + void ( ***vdestructor_ptr)(stru9 *, bool); }; #pragma pack(pop) \ No newline at end of file
--- a/texts.cpp Thu Aug 29 12:04:33 2013 +0600 +++ b/texts.cpp Thu Aug 29 12:04:55 2013 +0600 @@ -18,7 +18,7 @@ -int __cdecl sprintfex(char *buf, const char *format, ...) +int sprintfex(char *buf, const char *format, ...) { va_list args_ptr; va_start(args_ptr, format); @@ -27,12 +27,12 @@ } va_end(args_ptr); - extern int __cdecl sprintfex_internal(char *buf); + extern int sprintfex_internal(char *buf); return sprintfex_internal(buf); } //----- (00452B95) -------------------------------------------------------- -void __cdecl SetSomeItemsNames() +void SetSomeItemsNames() { pSomeItemsNames[0] = pGlobalTXT_LocalizationStrings[568]; pSomeItemsNames[1] = pGlobalTXT_LocalizationStrings[271]; @@ -442,7 +442,7 @@ aAttributeNames[6] = pGlobalTXT_LocalizationStrings[136]; } //----- (00410AF5) -------------------------------------------------------- -void __cdecl SetMoonPhaseNames() +void SetMoonPhaseNames() { aMoonPhaseNames[0] = pGlobalTXT_LocalizationStrings[150]; aMoonPhaseNames[1] = pGlobalTXT_LocalizationStrings[171];
--- a/texts.h Thu Aug 29 12:04:33 2013 +0600 +++ b/texts.h Thu Aug 29 12:04:55 2013 +0600 @@ -2,12 +2,12 @@ #include <array> -int __cdecl sprintfex(char *buf, const char *format, ...); +int sprintfex(char *buf, const char *format, ...); -void __cdecl SetSomeItemsNames(); +void SetSomeItemsNames(); char *RemoveQuotes(char *Str); -void __cdecl InitializeGameText(); +void InitializeGameText(); enum GLOBAL_LOCALIZ_INDEX