Mercurial > mm7
changeset 333:405d0c4dd1b3
Слияние
author | Ritor1 |
---|---|
date | Wed, 20 Feb 2013 20:51:55 +0600 |
parents | e8fcde8ba3fc (current diff) 8e23edf57e27 (diff) |
children | 0cafbae201c8 |
files | Player.cpp mm7_5.cpp |
diffstat | 41 files changed, 3118 insertions(+), 3204 deletions(-) [+] |
line wrap: on
line diff
--- a/Actor.cpp Wed Feb 20 20:50:22 2013 +0600 +++ b/Actor.cpp Wed Feb 20 20:51:55 2013 +0600 @@ -1,3 +1,5 @@ +#include <assert.h> + #include "Actor.h" #include "LayingItem.h" #include "Math.h" @@ -974,7 +976,7 @@ 0); pGame->pStru6Instance->_4A7E89_sparkles_on_actor_after_it_casts_buff( v5, - (unsigned int)((char *)&pLevelEVT_Events[4335].uEventID + 2)); + (unsigned int)((char *)&pLevelEVT_Index[4335].uEventID + 2)); v106 = 0; v104 = 0; v103 = 0; @@ -1404,7 +1406,7 @@ //----- (0043ABB0) -------------------------------------------------------- -bool Actor::_43ABB0(Actor *a1, Actor *a2) +bool Actor::ArePeasantsOfSameFaction(Actor *a1, Actor *a2) { unsigned int v2; // esi@1 unsigned int v3; // edi@1 @@ -1427,50 +1429,34 @@ } //----- (0043AC45) -------------------------------------------------------- -void Actor::_43AC45(unsigned int uActorID, int a2) +void Actor::AggroSurroundingPeasants(unsigned int uActorID, int a2) { - Actor *v2; // esi@1 - Actor *v3; // edi@4 int v4; // ebx@8 int v5; // ST1C_4@8 int v6; // eax@8 - int v7; // [sp+4h] [bp-10h]@1 - unsigned int uActorID_; // [sp+Ch] [bp-8h]@1 - signed int v9; // [sp+10h] [bp-4h]@3 - uActorID_ = uActorID; - v2 = &pActors[uActorID]; - v7 = a2; + auto victim = pActors + uActorID; if ( a2 == 1 ) - BYTE2(v2->uAttributes) |= 8u; - v9 = 0; - if ( (signed int)uNumActors > 0 ) + BYTE2(victim->uAttributes) |= 8u; + + for (uint i = 0; i < uNumActors; ++i) { - v3 = pActors; - do + auto actor = pActors + i; + if (!actor->CanAct() || i == uActorID) + continue; + + if (Actor::ArePeasantsOfSameFaction(victim, actor)) { - if ( v3->CanAct() ) + v4 = abs(actor->vPosition.x - victim->vPosition.x); + v5 = abs(actor->vPosition.y - victim->vPosition.y); + v6 = abs(actor->vPosition.z - victim->vPosition.z); + if (int_get_vector_length(v4, v5, v6) < 4096) { - if ( v9 != uActorID_ ) - { - if ( Actor::_43ABB0(v2, v3) ) - { - v4 = abs(v3->vPosition.x - v2->vPosition.x); - v5 = abs(v3->vPosition.y - v2->vPosition.y); - v6 = abs(v3->vPosition.z - v2->vPosition.z); - if ( (double)sub_4621DA(v4, v5, v6) < 4096.0 ) - { - v3->pMonsterInfo.uHostilityType = (MonsterInfo::HostilityRadius)4; - if ( v7 == 1 ) - BYTE2(v3->uAttributes) |= 8u; - } - } - } + actor->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Long; + if ( a2 == 1 ) + BYTE2(actor->uAttributes) |= 8u; } - ++v9; - ++v3; } - while ( v9 < (signed int)uNumActors ); } } @@ -1958,11 +1944,11 @@ //----- (00404030) -------------------------------------------------------- -unsigned int __fastcall Actor::FaceObject(unsigned int uActorID, unsigned int uObjID, int _48, AIDirection *a4) +void Actor::FaceObject(unsigned int uActorID, unsigned int uObjID, int _48, AIDirection *a4) { unsigned int v4; // edi@1 unsigned int v5; // esi@1 - unsigned int result; // eax@2 + //unsigned int result; // eax@2 AIDirection *v7; // eax@3 unsigned int v8; // ecx@3 Actor *v9; // ebx@3 @@ -1994,20 +1980,17 @@ v9->uPitchAngle = v11; v9->uCurrentActionLength = 256; v9->uAIState = Interacting; - result = v9->UpdateAnimation(); + v9->UpdateAnimation(); } else - { - result = Actor::_402F87(v5, v4, a4); - } - return result; + Actor::_402F87(v5, v4, a4); } //----- (00403F58) -------------------------------------------------------- -unsigned int __fastcall Actor::_403F58(unsigned int uActorID, signed int uObjID, int uActionLength, AIDirection *a4) +void Actor::_403F58(unsigned int uActorID, signed int uObjID, int uActionLength, AIDirection *a4) { unsigned int v4; // esi@1 - unsigned int result; // eax@2 + //unsigned int result; // eax@2 AIDirection *v6; // eax@3 unsigned int v7; // edi@3 Actor *v8; // ebx@3 @@ -2020,10 +2003,10 @@ v4 = uActorID; if ( rand() % 2 ) { - result = Actor::_402F87(v4, a2, a4); + Actor::_402F87(v4, a2, a4); + return; } - else - { + v6 = a4; v7 = 0; v8 = &pActors[v4]; @@ -2045,15 +2028,13 @@ v8->vVelocity.z = v7; v8->vVelocity.y = v7; v8->vVelocity.x = v7; - result = v8->UpdateAnimation(); - } - return result; + v8->UpdateAnimation(); } //----- (00403EB6) -------------------------------------------------------- -unsigned int __fastcall Actor::_403EB6(unsigned int uActorID, unsigned int a2, unsigned int uActionLength, AIDirection *a4) +void Actor::_403EB6(unsigned int uActorID, unsigned int a2, unsigned int uActionLength, AIDirection *a4) { AIDirection *v4; // eax@1 unsigned int v5; // esi@1 @@ -2082,7 +2063,7 @@ v6->vVelocity.z = v5; v6->vVelocity.y = v5; v6->vVelocity.x = v5; - return v6->UpdateAnimation(); + v6->UpdateAnimation(); } @@ -2102,17 +2083,17 @@ } //----- (00403C6C) -------------------------------------------------------- -unsigned int __fastcall Actor::_403C6C(unsigned int uActorID, signed int edx0, struct AIDirection *arg0) +void Actor::_403C6C(unsigned int uActorID, signed int edx0, struct AIDirection *arg0) { Actor *v3; // ebx@1 char v4; // zf@1 - unsigned int result; // eax@3 + //unsigned int result; // eax@3 AIDirection *v6; // esi@6 AIDirection *v7; // edi@6 signed int v8; // eax@7 double v9; // st7@9 Vec3_int_ v10; // ST04_12@9 - int v11; // eax@10 + //int v11; // eax@10 AIDirection *v12; // eax@11 unsigned int v13; // esi@11 AIDirection *v14; // esi@12 @@ -2134,11 +2115,11 @@ v24 = uActorID; if ( v4 && v3->pMonsterInfo.uAIType == 1 ) { - result = Actor::_403EB6(uActorID, edx0, 0, arg0); + Actor::_403EB6(uActorID, edx0, 0, arg0); + return; } - else - { - if ( (edx0 & 7) == OBJECT_Actor) + + if ( (edx0 & 7) == OBJECT_Actor) { v8 = edx0 >> 3; v6 = (AIDirection *)pActors[v8].vPosition.x; @@ -2178,7 +2159,7 @@ } v15 = pSpriteFrameTable->pSpriteSFrames; v3->uYawAngle = LOWORD(v12->uYawAngle); - v16 = v15[v3->pSpriteIDs[2]].uAnimLength; + v16 = v15[v3->pSpriteIDs[ANIM_AtkMelee]].uAnimLength; v17 = v24; v3->uCurrentActionLength = 8 * v16; v3->uCurrentActionTime = v13; @@ -2198,31 +2179,28 @@ v3->vVelocity.z = v13; v3->vVelocity.y = v13; v3->vVelocity.x = v13; - result = v3->UpdateAnimation(); + v3->UpdateAnimation(); } else - { - v11 = rand(); - result = Actor::_402AD7(v24, a2, v11 % 2, 64, arg0); - } - } - return result; + Actor::_402AD7(v24, a2, rand() % 2, 64, arg0); } //----- (00438CF3) -------------------------------------------------------- -void Actor::_438CF3(unsigned int uActorID) +void Actor::ApplyFineForKillingPeasant(unsigned int uActorID) { unsigned int v1; // esi@1 unsigned int v2; // edi@2 char v3; // bl@3 - char *v4; // ecx@16 - signed int v5; // eax@18 + //char *v4; // ecx@16 + //signed int v5; // eax@18 Player **ppPlayers; // esi@20 v1 = uLevelMapStatsID; - if ( !uLevelMapStatsID || (v2 = uActorID, !pActors[uActorID]._438B9B()) ) + if ( !uLevelMapStatsID || !pActors[uActorID].IsPeasant()) return; + + v2 = uActorID; v3 = 1; if ( v1 != 5 ) { @@ -2243,20 +2221,24 @@ if ( v3 ) { LABEL_12: - pParty->uFine += 100 - * (pMapStats->pInfos[uLevelMapStatsID]._steal_perm - + pActors[v2].pMonsterInfo.uLevel - + GetPartyReputation()); + pParty->uFine += 100 * (pMapStats->pInfos[uLevelMapStatsID]._steal_perm + pActors[v2].pMonsterInfo.uLevel + GetPartyReputation()); if ( pParty->uFine < 0 ) pParty->uFine = 0; if ( pParty->uFine > 4000000 ) pParty->uFine = 4000000; - v4 = (char *)&pOutdoor->ddm; - if ( uCurrentlyLoadedLevelType == LEVEL_Indoor) - v4 = (char *)&pIndoor->dlv; - v5 = *((int *)v4 + 2); - if ( v5 < 10000 ) - *((int *)v4 + 2) = v5 + 1; + + if (uCurrentlyLoadedLevelType == LEVEL_Outdoor) + { + if (pOutdoor->ddm.uReputation < 10000) + pOutdoor->ddm.uReputation++; + } + else if (uCurrentlyLoadedLevelType == LEVEL_Indoor) + { + if (pIndoor->dlv.uReputation < 10000) + pIndoor->dlv.uReputation++; + } + else assert(false); + ppPlayers = &pPlayers[1]; do { @@ -2273,7 +2255,7 @@ //----- (0043AE80) -------------------------------------------------------- -int Actor::AddBloodsplatOnDamageOverlay(unsigned int uActorID, int a2, signed int a3) +void Actor::AddBloodsplatOnDamageOverlay(unsigned int uActorID, int a2, signed int a3) { int result; // eax@1 unsigned int v4; // esi@1 @@ -2297,7 +2279,7 @@ v5 = 904; goto LABEL_16; } - return result; + return; case 2: if ( a3 ) { @@ -2308,7 +2290,7 @@ v5 = 905; goto LABEL_16; } - return result; + return; case 3: if ( a3 ) { @@ -2319,7 +2301,7 @@ v5 = 906; goto LABEL_16; } - return result; + return; case 4: if ( a3 ) { @@ -2330,7 +2312,7 @@ v5 = 907; goto LABEL_16; } - return result; + return; case 5: v9 = 4; v8 = 65536; @@ -2376,9 +2358,9 @@ result = pOtherOverlayList->_4418B6(v5, v6, v7, v8, v9); break; default: - return result; + return; } - return result; + return; } @@ -2457,7 +2439,7 @@ } //----- (00438B9B) -------------------------------------------------------- -char Actor::_438B9B() +bool Actor::IsPeasant() { unsigned int v1; // eax@1 @@ -2510,14 +2492,14 @@ //----- (00403A60) -------------------------------------------------------- -unsigned int __fastcall Actor::_403A60(unsigned int uActorID, signed int edx0, AIDirection *pDir) +void Actor::_403A60(unsigned int uActorID, signed int edx0, AIDirection *pDir) { Actor *v3; // ebx@1 AIDirection *v4; // esi@3 AIDirection *v5; // edi@3 signed int v6; // eax@4 Vec3_int_ v7; // ST04_12@6 - unsigned int result; // eax@7 + //unsigned int result; // eax@7 AIDirection *v9; // eax@8 unsigned int v10; // esi@8 AIDirection *v11; // esi@9 @@ -2575,7 +2557,7 @@ } v12 = pSpriteFrameTable->pSpriteSFrames; v3->uYawAngle = LOWORD(v9->uYawAngle); - v13 = v12[v3->pSpriteIDs[3]].uAnimLength; + v13 = v12[v3->pSpriteIDs[ANIM_AtkRanged]].uAnimLength; v14 = v22; v3->uCurrentActionLength = 8 * v13; v3->uCurrentActionTime = v10; @@ -2605,31 +2587,26 @@ v3->uCurrentActionLength = 64; v3->uCurrentActionTime = v10; v3->uAIState = Fidgeting; - result = v3->UpdateAnimation(); + v3->UpdateAnimation(); v3->uAIState = AttackingRanged4; } else - { - result = v3->UpdateAnimation(); - } + v3->UpdateAnimation(); } else - { - result = Actor::_402AD7(v22, a2, v22, 64, pDir); - } - return result; + Actor::_402AD7(v22, a2, v22, 64, pDir); } //----- (00403854) -------------------------------------------------------- -unsigned int __fastcall Actor::_403854(unsigned int uActorID, signed int edx0, AIDirection *pDir) +void Actor::_403854(unsigned int uActorID, signed int edx0, AIDirection *pDir) { Actor *v3; // ebx@1 AIDirection *v4; // esi@3 AIDirection *v5; // edi@3 signed int v6; // eax@4 Vec3_int_ v7; // ST04_12@6 - unsigned int result; // eax@7 + //unsigned int result; // eax@7 AIDirection *v9; // eax@8 unsigned int v10; // esi@8 AIDirection *v11; // esi@9 @@ -2687,7 +2664,7 @@ } v12 = pSpriteFrameTable->pSpriteSFrames; v3->uYawAngle = LOWORD(v9->uYawAngle); - v13 = v12[v3->pSpriteIDs[3]].uAnimLength; + v13 = v12[v3->pSpriteIDs[ANIM_AtkRanged]].uAnimLength; v14 = v22; v3->uCurrentActionLength = 8 * v13; v3->uCurrentActionTime = v10; @@ -2717,31 +2694,26 @@ v3->uCurrentActionLength = 64; v3->uCurrentActionTime = v10; v3->uAIState = Fidgeting; - result = v3->UpdateAnimation(); + v3->UpdateAnimation(); v3->uAIState = AttackingRanged3; } else - { - result = v3->UpdateAnimation(); - } + v3->UpdateAnimation(); } else - { - result = Actor::_402AD7(v22, a2, v22, 64, pDir); - } - return result; + Actor::_402AD7(v22, a2, v22, 64, pDir); } //----- (0040368B) -------------------------------------------------------- -unsigned int __fastcall Actor::_40368B(unsigned int uActorID, signed int edx0, AIDirection *pDir) +void Actor::_40368B(unsigned int uActorID, signed int edx0, AIDirection *pDir) { Actor *v3; // ebx@1 AIDirection *v4; // esi@3 AIDirection *v5; // edi@3 signed int v6; // eax@4 Vec3_int_ v7; // ST04_12@6 - unsigned int result; // eax@7 + //unsigned int result; // eax@7 AIDirection *v9; // eax@8 unsigned int v10; // esi@8 AIDirection *v11; // esi@9 @@ -2798,7 +2770,7 @@ } v12 = pSpriteFrameTable->pSpriteSFrames; v3->uYawAngle = LOWORD(v9->uYawAngle); - v13 = v12[v3->pSpriteIDs[3]].uAnimLength; + v13 = v12[v3->pSpriteIDs[ANIM_AtkRanged]].uAnimLength; v14 = v21; v3->uCurrentActionLength = 8 * v13; v3->uCurrentActionTime = v10; @@ -2818,18 +2790,15 @@ v3->vVelocity.z = v10; v3->vVelocity.y = v10; v3->vVelocity.x = v10; - result = v3->UpdateAnimation(); + v3->UpdateAnimation(); } else - { - result = Actor::_402AD7(v21, a2, v21, 64, pDir); - } - return result; + Actor::_402AD7(v21, a2, v21, 64, pDir); } //----- (00403476) -------------------------------------------------------- -unsigned int __fastcall Actor::_403476(unsigned int uActorID, signed int edx0, AIDirection *pDir) +void Actor::_403476(unsigned int uActorID, signed int edx0, AIDirection *pDir) { Actor *v3; // ebx@1 int v4; // esi@3 @@ -2837,7 +2806,7 @@ signed int v6; // eax@4 Vec3_int_ v7; // ST04_12@6 unsigned char v8[12]; // ST04_12@7 - unsigned int result; // eax@8 + //unsigned int result; // eax@8 AIDirection *v10; // eax@9 unsigned int v11; // esi@9 AIDirection *v12; // esi@10 @@ -2902,7 +2871,7 @@ } v13 = pSpriteFrameTable->pSpriteSFrames; v3->uYawAngle = LOWORD(v10->uYawAngle); - v14 = v13[v3->pSpriteIDs[3]].uAnimLength; + v14 = v13[v3->pSpriteIDs[ANIM_AtkRanged]].uAnimLength; v15 = v21; v3->uCurrentActionLength = 8 * v14; v3->uCurrentActionTime = v11; @@ -2926,17 +2895,14 @@ v3->vVelocity.z = v11; v3->vVelocity.y = v11; v3->vVelocity.x = v11; - result = v3->UpdateAnimation(); + v3->UpdateAnimation(); } else - { - result = Actor::_402AD7(v21, a2, v21, 64, pDir); - } - return result; + Actor::_402AD7(v21, a2, v21, 64, pDir); } //----- (004032B2) -------------------------------------------------------- -void __fastcall Actor::_4032B2(unsigned int a1, unsigned int a2, int a3, int uActionLength) +void Actor::_4032B2(unsigned int a1, unsigned int a2, int a3, int uActionLength) { unsigned int v4; // edi@1 Actor *v5; // esi@1 @@ -3072,11 +3038,11 @@ //----- (004030AD) -------------------------------------------------------- -__int16 __fastcall Actor::_4030AD(unsigned int uActorID, signed int edx0, int arg0) +void Actor::_4030AD(unsigned int uActorID, signed int edx0, int arg0) { unsigned int v3; // edi@1 Actor *v4; // ebx@1 - __int16 result; // ax@10 + //__int16 result; // ax@10 SpriteFrame *v6; // ecx@16 __int16 v7; // ax@16 unsigned int v8; // ecx@16 @@ -3101,29 +3067,28 @@ if ( (signed __int64)v4->pActorBuffs[4].uExpireTime > 0 ) v4->pActorBuffs[4].Reset(); if ( arg0 - || (result = v4->uAIState, result != 8) - && result != 3 - && result != 12 - && result != 13 - && result != 18 - && result != 2 ) + || (v4->uAIState != 8 + && v4->uAIState != 3 + && v4->uAIState != 12 + && v4->uAIState != 13 + && v4->uAIState != 18 + && v4->uAIState != 2)) { memcpy(&v10, Actor::GetDirectionInfo(8 * v3 | 3, a2, &a3, 0), sizeof(v10)); v6 = pSpriteFrameTable->pSpriteSFrames; v4->uYawAngle = LOWORD(v10.uYawAngle); - v7 = v6[v4->pSpriteIDs[4]].uAnimLength; + v7 = v6[v4->pSpriteIDs[ANIM_GotHit]].uAnimLength; v8 = v11; v4->uCurrentActionTime = 0; v4->uAIState = Stunned; v4->uCurrentActionLength = 8 * v7; Actor::PlaySound(v8, 2u); - result = v4->UpdateAnimation(); + v4->UpdateAnimation(); } - return result; } //----- (00402F87) -------------------------------------------------------- -int __fastcall Actor::_402F87(unsigned int uActorID, unsigned int uObjID, AIDirection *a4) +void Actor::_402F87(unsigned int uActorID, unsigned int uObjID, AIDirection *a4) { int v3; // edi@1 AIDirection *v4; // esi@1 @@ -3132,7 +3097,7 @@ unsigned int v7; // eax@3 int v8; // edx@3 unsigned int v9; // eax@3 - int result; // eax@4 + //int result; // eax@4 AIDirection a3; // [sp+Ch] [bp-5Ch]@2 AIDirection v12; // [sp+28h] [bp-40h]@2 AIDirection v13; // [sp+44h] [bp-24h]@2 @@ -3153,13 +3118,13 @@ } v6 = pSpriteFrameTable->pSpriteSFrames; v5->uYawAngle = LOWORD(v4->uYawAngle); - v5->uCurrentActionLength = 8 * v6[v5->pSpriteIDs[7]].uAnimLength; + v5->uCurrentActionLength = 8 * v6[v5->pSpriteIDs[ANIM_Bored]].uAnimLength; v7 = stru_5C6E00->Atan2(v5->vPosition.x - pIndoorCamera->pos.x, v5->vPosition.y - pIndoorCamera->pos.y); LOWORD(v8) = v5->uYawAngle; v9 = stru_5C6E00->uIntegerPi + v8 + ((signed int)stru_5C6E00->uIntegerPi >> 3) - v7; if ( BYTE1(v9) & 7 ) { - result = Actor::_403EB6(v3, v14, v5->uCurrentActionLength, v4); + Actor::_403EB6(v3, v14, v5->uCurrentActionLength, v4); } else { @@ -3170,13 +3135,12 @@ v5->vVelocity.x = 0; if ( rand() % 100 < 5 ) Actor::PlaySound(v3, 3u); - result = v5->UpdateAnimation(); + v5->UpdateAnimation(); } - return result; } //----- (00402F27) -------------------------------------------------------- -unsigned int __fastcall Actor::Resurrect(unsigned int uActorID) +void Actor::Resurrect(unsigned int uActorID) { Actor *pActor; // esi@1 SpriteFrame *v2; // edx@1 @@ -3184,253 +3148,82 @@ pActor = &pActors[uActorID]; v2 = pSpriteFrameTable->pSpriteSFrames; - v3 = pActor->pSpriteIDs[5]; + v3 = pActor->pSpriteIDs[ANIM_Dying]; pActor->uCurrentActionTime = 0; pActor->uAIState = Resurrected; pActor->uCurrentActionAnimation = ANIM_Dying; pActor->uCurrentActionLength = 8 * v2[v3].uAnimLength; pActor->sCurrentHP = LOWORD(pActor->pMonsterInfo.uHP); Actor::PlaySound(uActorID, 1u); - return pActor->UpdateAnimation(); + pActor->UpdateAnimation(); } //----- (00402D6E) -------------------------------------------------------- -void __fastcall Actor::Die(unsigned int uActorID) +void Actor::Die(unsigned int uActorID) { - Actor *v1; // esi@1 - SpriteFrame *v2; // ecx@1 - int v3; // eax@1 - int v4; // ecx@1 - char *v5; // eax@1 - SpellBuff *v6; // edi@5 - signed int v7; // ebx@5 - MONSTER_TYPE v8; // eax@7 - int v9; // eax@23 - ItemGen _this; // [sp+8h] [bp-28h]@7 - unsigned int v11; // [sp+2Ch] [bp-4h]@1 + auto actor = &pActors[uActorID]; - v1 = &pActors[uActorID]; - v11 = uActorID; - v2 = pSpriteFrameTable->pSpriteSFrames; - v3 = 60 * v1->pSpriteIDs[5]; - v1->uCurrentActionTime = 0; - v1->uAIState = Dying; - v1->uCurrentActionAnimation = 5; - LOWORD(v3) = *(__int16 *)((char *)&v2->uAnimLength + v3); - v1->sCurrentHP = 0; - v1->uCurrentActionLength = 8 * v3; - v1->pActorBuffs[6].Reset(); - v1->pActorBuffs[5].Reset(); - Actor::PlaySound(v11, 1u); - v1->UpdateAnimation(); - v4 = v1->pMonsterInfo.uID; - v5 = (char *)pParty->field_75A; - do - { - if ( v4 == *((short *)v5 - 5) ) - *(short *)v5 = 1; - v5 += 2; - } - while ( (signed int)v5 < (signed int)&pParty->field_764 ); - v6 = v1->pActorBuffs; - v7 = 22; - do - { - v6->Reset(); - ++v6; - --v7; - } - while ( v7 ); - _this.Reset(); - v8 = (MONSTER_TYPE)v1->pMonsterInfo.uID; - if ( v8 > MONSTER_HARPY_3 ) + actor->uCurrentActionTime = 0; + actor->uAIState = Dying; + actor->uCurrentActionAnimation = ANIM_Dying; + actor->sCurrentHP = 0; + actor->uCurrentActionLength = 8 * pSpriteFrameTable->pSpriteSFrames[actor->pSpriteIDs[ANIM_Dying]].uAnimLength; + actor->pActorBuffs[6].Reset(); + actor->pActorBuffs[5].Reset(); + Actor::PlaySound(uActorID, 1); + actor->UpdateAnimation(); + + for (uint i = 0; i < 5; ++i) + if (pParty->field_750[i] == actor->pMonsterInfo.uID) + pParty->field_75A[i] = true; + + for (uint i = 0; i < 22; ++i) + actor->pActorBuffs[i].Reset(); + + ItemGen drop; + switch (actor->pMonsterInfo.uID) { - if ( v8 < MONSTER_OOZE_1 ) - { - if ( !_this.uItemID ) - { - if ( v1->pMonsterInfo.uSpecialAbilityType == MONSTER_SPECIAL_ABILITY_EXPLODE ) - Actor::Explode(v11); - return; - } - if ( rand() % 100 < 20 ) - { - v9 = rand(); - sub_42F7EB_DropItemAt( - pItemsTable->pItems[_this.uItemID].uSpriteID, - v1->vPosition.x, - v1->vPosition.y, - v1->vPosition.z + 16, - v9 % 200 + 200, - 1, - 1, - 0, - &_this); - } - if ( v1->pMonsterInfo.uSpecialAbilityType == MONSTER_SPECIAL_ABILITY_EXPLODE ) - Actor::Explode(v11); - return; - } - if ( v8 <= MONSTER_OOZE_3 ) - { - _this.uItemID = ITEM_OOZE_ECTOPLASM_BOTTLE; - if ( !_this.uItemID ) - { - if ( v1->pMonsterInfo.uSpecialAbilityType == MONSTER_SPECIAL_ABILITY_EXPLODE ) - Actor::Explode(v11); - return; - } - if ( rand() % 100 < 20 ) - { - v9 = rand(); - sub_42F7EB_DropItemAt( - pItemsTable->pItems[_this.uItemID].uSpriteID, - v1->vPosition.x, - v1->vPosition.y, - v1->vPosition.z + 16, - v9 % 200 + 200, - 1, - 1, - 0, - &_this); - } - if ( v1->pMonsterInfo.uSpecialAbilityType == MONSTER_SPECIAL_ABILITY_EXPLODE ) - Actor::Explode(v11); - return; - } - if ( v8 <= MONSTER_PEASANT_GOBLIN_MALE_3_3 || v8 > MONSTER_TROLL_3 ) - { - if ( !_this.uItemID ) - { - if ( v1->pMonsterInfo.uSpecialAbilityType == MONSTER_SPECIAL_ABILITY_EXPLODE ) - Actor::Explode(v11); - return; - } - if ( rand() % 100 < 20 ) - { - v9 = rand(); - sub_42F7EB_DropItemAt( - pItemsTable->pItems[_this.uItemID].uSpriteID, - v1->vPosition.x, - v1->vPosition.y, - v1->vPosition.z + 16, - v9 % 200 + 200, - 1, - 1, - 0, - &_this); - } - if ( v1->pMonsterInfo.uSpecialAbilityType == MONSTER_SPECIAL_ABILITY_EXPLODE ) - Actor::Explode(v11); - return; - } - _this.uItemID = ITEM_TROLL_BLOOD; + case MONSTER_HARPY_1: case MONSTER_HARPY_2: case MONSTER_HARPY_3: + drop.uItemID = ITEM_HARPY_FEATHER; + break; + + case MONSTER_OOZE_1: case MONSTER_OOZE_2: case MONSTER_OOZE_3: + drop.uItemID = ITEM_OOZE_ECTOPLASM_BOTTLE; + break; + + case MONSTER_TROLL_1: case MONSTER_TROLL_2: case MONSTER_TROLL_3: + drop.uItemID = ITEM_TROLL_BLOOD; + break; + + case MONSTER_DEVIL_1: case MONSTER_DEVIL_2: case MONSTER_DEVIL_3: + drop.uItemID = ITEM_DEVIL_ICHOR; + break; + + case MONSTER_DRAGON_1: case MONSTER_DRAGON_2: case MONSTER_DRAGON_3: + drop.uItemID = ITEM_DRAGON_EYE; + break; } - else + + if (rand() % 100 < 20) { - if ( v8 >= MONSTER_HARPY_1 ) - { - _this.uItemID = ITEM_HARPY_FEATHER; - } - else - { - if ( v8 < MONSTER_DEVIL_1 ) - { - if ( !_this.uItemID ) - { - if ( v1->pMonsterInfo.uSpecialAbilityType == MONSTER_SPECIAL_ABILITY_EXPLODE ) - Actor::Explode(v11); - return; - } - if ( rand() % 100 < 20 ) - { - v9 = rand(); - sub_42F7EB_DropItemAt( - pItemsTable->pItems[_this.uItemID].uSpriteID, - v1->vPosition.x, - v1->vPosition.y, - v1->vPosition.z + 16, - v9 % 200 + 200, - 1, - 1, - 0, - &_this); - } - if ( v1->pMonsterInfo.uSpecialAbilityType == MONSTER_SPECIAL_ABILITY_EXPLODE ) - Actor::Explode(v11); - return; - } - if ( v8 > MONSTER_DEVIL_3 ) - { - if ( v8 <= MONSTER_DRAGON_3 ) - { - _this.uItemID = ITEM_DRAGON_EYE; - if ( rand() % 100 < 20 ) - { - v9 = rand(); - sub_42F7EB_DropItemAt( - pItemsTable->pItems[_this.uItemID].uSpriteID, - v1->vPosition.x, - v1->vPosition.y, - v1->vPosition.z + 16, - v9 % 200 + 200, - 1, - 1, - 0, - &_this); - } - if ( v1->pMonsterInfo.uSpecialAbilityType == MONSTER_SPECIAL_ABILITY_EXPLODE ) - Actor::Explode(v11); - return; - } - if ( !_this.uItemID ) - { - if ( v1->pMonsterInfo.uSpecialAbilityType == MONSTER_SPECIAL_ABILITY_EXPLODE ) - Actor::Explode(v11); - return; - } - if ( rand() % 100 < 20 ) - { - v9 = rand(); - sub_42F7EB_DropItemAt( - pItemsTable->pItems[_this.uItemID].uSpriteID, - v1->vPosition.x, - v1->vPosition.y, - v1->vPosition.z + 16, - v9 % 200 + 200, - 1, - 1, - 0, - &_this); - } - if ( v1->pMonsterInfo.uSpecialAbilityType == MONSTER_SPECIAL_ABILITY_EXPLODE ) - Actor::Explode(v11); - return; - } - _this.uItemID = ITEM_DEVIL_ICHOR; - } - } - if ( rand() % 100 < 20 ) - { - v9 = rand(); - sub_42F7EB_DropItemAt( - pItemsTable->pItems[_this.uItemID].uSpriteID, - v1->vPosition.x, - v1->vPosition.y, - v1->vPosition.z + 16, - v9 % 200 + 200, + sub_42F7EB_DropItemAt(pItemsTable->pItems[drop.uItemID].uSpriteID, + actor->vPosition.x, + actor->vPosition.y, + actor->vPosition.z + 16, + rand() % 200 + 200, 1, 1, 0, - &_this); + &drop); } - if ( v1->pMonsterInfo.uSpecialAbilityType == MONSTER_SPECIAL_ABILITY_EXPLODE ) - Actor::Explode(v11); + + if (actor->pMonsterInfo.uSpecialAbilityType == MONSTER_SPECIAL_ABILITY_EXPLODE) + Actor::Explode(uActorID); } //----- (00402CED) -------------------------------------------------------- -void __fastcall Actor::PlaySound(unsigned int uActorID, unsigned int uSoundID) +void Actor::PlaySound(unsigned int uActorID, unsigned int uSoundID) { Actor *v2; // eax@1 unsigned __int16 v3; // dx@1 @@ -3492,7 +3285,7 @@ //----- (00402AD7) -------------------------------------------------------- -unsigned int __fastcall Actor::_402AD7(unsigned int uActorID, unsigned int a2, signed int arg0, signed int uActionLength, AIDirection *pDir) +void Actor::_402AD7(unsigned int uActorID, unsigned int a2, signed int arg0, signed int uActionLength, AIDirection *pDir) { unsigned int v5; // edi@1 int v6; // eax@1 @@ -3535,25 +3328,29 @@ { if ( !uActionLength ) uActionLength = 256; - return Actor::_403F58(v5, 4, uActionLength, v10); + Actor::_403F58(v5, 4, uActionLength, v10); + return; } if ( (double)(signed int)v10->uDistance < 307.2 ) { if ( !uActionLength ) uActionLength = 256; - return Actor::_403EB6(v5, v18, uActionLength, v10); + Actor::_403EB6(v5, v18, uActionLength, v10); + return; } if ( !v7->uMovementSpeed ) - return Actor::_403EB6(v5, v18, uActionLength, v10); + { + Actor::_403EB6(v5, v18, uActionLength, v10); + return; + } v18 = 16; if ( arg0 % 2 ) v18 = -16; - v12 = ((unsigned __int64)(stru_5C6E00->SinCos(v18 + stru_5C6E00->uIntegerPi + v10->uYawAngle) - * (signed __int64)v10->uDistanceXZ) >> 16) + v12 = ((unsigned __int64)(stru_5C6E00->Cos(v18 + stru_5C6E00->uIntegerPi + v10->uYawAngle) * (signed __int64)v10->uDistanceXZ) >> 16) + pParty->vPosition.x; v13 = stru_5C6E00->uIntegerPi + v10->uYawAngle; v17 = v12; - v19 = stru_5C6E00->SinCos(v18 + v13 - stru_5C6E00->uIntegerHalfPi); + v19 = stru_5C6E00->Sin(v18 + v13); v7->uYawAngle = stru_5C6E00->Atan2( v17 - v7->vPosition.x, pParty->vPosition.y @@ -3565,15 +3362,15 @@ v7->uCurrentActionLength = 128; v7->uPitchAngle = LOWORD(v10->uPitchAngle); v7->uAIState = Pursuing; - return v7->UpdateAnimation(); + v7->UpdateAnimation(); } //----- (00402968) -------------------------------------------------------- -unsigned int __fastcall Actor::_402968(unsigned int uActorID, signed int edx0, int uActionLength, AIDirection *a4) +void Actor::_402968(unsigned int uActorID, signed int edx0, int uActionLength, AIDirection *a4) { unsigned int v4; // esi@1 Actor *v5; // ebx@1 - unsigned int result; // eax@1 + //unsigned int result; // eax@1 int v7; // ecx@2 signed __int16 v8; // cx@10 unsigned __int16 v9; // ax@15 @@ -3589,8 +3386,8 @@ a2 = edx0; v15 = uActorID; v5 = &pActors[uActorID]; - result = pActors[uActorID].CanAct(); - if ( result ) + //result = pActors[uActorID].CanAct(); + if ( pActors[uActorID].CanAct() ) { v7 = 8 * v4 | 3; a1 = 8 * v4 | 3; @@ -3607,7 +3404,7 @@ { if ( !uActionLength ) uActionLength = 256; - result = Actor::_403F58(v15, 4, uActionLength, &v13); + Actor::_403F58(v15, 4, uActionLength, &v13); } else { @@ -3624,15 +3421,14 @@ v5->uCurrentActionTime = 0; v5->uPitchAngle = v9; v5->uAIState = Fleeing; - result = v5->UpdateAnimation(); + v5->UpdateAnimation(); } } - return result; } //----- (0040281C) -------------------------------------------------------- -int __fastcall Actor::_40281C(unsigned int uActorID, unsigned int a2, signed int uActionLength, AIDirection *pDir, int a5) +void Actor::_40281C(unsigned int uActorID, unsigned int a2, signed int uActionLength, AIDirection *pDir, int a5) { unsigned int v5; // edi@1 int v6; // eax@1 @@ -3679,7 +3475,8 @@ v16 = v10; v15 = uActionLength; v11 = 4; - return Actor::_403F58(v5, v11, v15, v16); + Actor::_403F58(v5, v11, v15, v16); + return; } if ( (signed int)v10->uDistance < a5 ) { @@ -3688,7 +3485,8 @@ v11 = v19; v16 = v10; v15 = uActionLength; - return Actor::_403F58(v5, v11, v15, v16); + Actor::_403F58(v5, v11, v15, v16); + return; } if ( uActionLength ) { @@ -3709,12 +3507,12 @@ v7->uCurrentActionTime = 0; v7->uPitchAngle = v14; v7->uAIState = Pursuing; - return v7->UpdateAnimation(); + v7->UpdateAnimation(); } //----- (00402686) -------------------------------------------------------- -unsigned int __fastcall Actor::_402686(unsigned int uActorID, unsigned int a2, signed int uActionLength, AIDirection *a4) +void Actor::_402686(unsigned int uActorID, unsigned int a2, signed int uActionLength, AIDirection *a4) { unsigned int v4; // edi@1 int v5; // eax@1 @@ -3802,11 +3600,11 @@ v6->uAIState = Pursuing; if ( rand() % 100 < 2 ) Actor::PlaySound(v4, 2u); - return v6->UpdateAnimation(); + v6->UpdateAnimation(); } //----- (00401221) -------------------------------------------------------- -void __fastcall Actor::_401221(unsigned int uActorID, int *a2, unsigned int a3) +void Actor::_401221(unsigned int uActorID, int *a2, unsigned int a3) { Actor *v3; // esi@1 unsigned int v4; // ebx@1 @@ -4084,61 +3882,72 @@ //----- (0045976D) -------------------------------------------------------- -unsigned int Actor::UpdateAnimation() +void Actor::UpdateAnimation() { - AIState state; // edx@1 - unsigned int result; // eax@1 + //AIState state; // edx@1 + //unsigned int result; // eax@1 - state = (AIState)this->uAIState; - BYTE2(this->uAttributes) &= 0xDFu; - result = this->uAttributes; - switch ( state ) + //state = (AIState)this->; + uAttributes &= 0xFFDFFFFF; + //result = this->uAttributes; + switch (uAIState) { case Tethered: - this->uCurrentActionAnimation = ANIM_Walking; - return result; + uCurrentActionAnimation = ANIM_Walking; + break; + case AttackingMelee: - this->uCurrentActionAnimation = ANIM_AtkMelee; - goto LABEL_10; + uCurrentActionAnimation = ANIM_AtkMelee; + uAttributes |= 0x200000u; + break; + case AttackingRanged1: case AttackingRanged2: case AttackingRanged3: case AttackingRanged4: - this->uCurrentActionAnimation = ANIM_AtkRanged; - goto LABEL_10; + uCurrentActionAnimation = ANIM_AtkRanged; + uAttributes |= 0x200000u; + break; + case Dying: case Resurrected: - this->uCurrentActionAnimation = ANIM_Dying; - goto LABEL_10; + uCurrentActionAnimation = ANIM_Dying; + uAttributes |= 0x200000u; + break; + case Pursuing: case Fleeing: - this->uCurrentActionAnimation = ANIM_Walking; - goto LABEL_10; + uCurrentActionAnimation = ANIM_Walking; + uAttributes |= 0x200000u; + break; + case Stunned: - this->uCurrentActionAnimation = ANIM_GotHit; - goto LABEL_10; + uCurrentActionAnimation = ANIM_GotHit; + uAttributes |= 0x200000u; + break; + case Fidgeting: - this->uCurrentActionAnimation = ANIM_Bored; - goto LABEL_10; + uCurrentActionAnimation = ANIM_Bored; + uAttributes |= 0x200000u; + break; + case Standing: case Interacting: case Summoned: - this->uCurrentActionAnimation = ANIM_Standing; -LABEL_10: - result |= 0x200000u; - this->uAttributes = result; - break; + uCurrentActionAnimation = ANIM_Standing; + uAttributes |= 0x200000u; + break; + case Dead: - result = 60 * this->pSpriteIDs[6]; - if ( *(__int16 *)((char *)pSpriteFrameTable->pSpriteSFrames->pHwSpriteIDs + result) <= 0 ) - this->uAIState = Removed; + if (pSpriteFrameTable->pSpriteSFrames[pSpriteIDs[ANIM_Dead]].pHwSpriteIDs[0] <= 0) + uAIState = Removed; else - this->uCurrentActionAnimation = ANIM_Dead; - break; + uCurrentActionAnimation = ANIM_Dead; + break; + default: - return result; + assert(false); } - return result; } //----- (00459671) -------------------------------------------------------- @@ -4168,7 +3977,7 @@ this->uActorRadius = 32; this->uActorHeight = 128; this->uAIState = Standing; - this->uCurrentActionAnimation = 0; + this->uCurrentActionAnimation = ANIM_Standing; this->uMovementSpeed = 200; this->uCarriedItemID = 0; this->uGroup = 0; @@ -4318,10 +4127,10 @@ v8->uMovementSpeed = v11; v12 = rand(); v13 = v12 % 2048; - v14 = stru_5C6E00->SinCos(v12 % 2048); + v14 = stru_5C6E00->Cos(v12 % 2048); v26 = v14; v15 = ((unsigned __int64)(v14 * (signed __int64)v27) >> 16) + v30->vPosition.x; - v16 = stru_5C6E00->SinCos(v13 - stru_5C6E00->uIntegerHalfPi); + v16 = stru_5C6E00->Sin(v13); v26 = v16; v29 = (unsigned __int64)(v16 * (signed __int64)v27) >> 16; LOWORD(v16) = uFaceID;
--- a/Actor.h Wed Feb 20 20:50:22 2013 +0600 +++ b/Actor.h Wed Feb 20 20:51:55 2013 +0600 @@ -190,49 +190,49 @@ void Reset(); void Remove(); void PrepareSprites(char load_sounds_if_bit1_set); - unsigned int UpdateAnimation(); + void UpdateAnimation(); signed int GetActorsRelation(Actor *a2); void SetRandomGoldIfTheresNoItem(); bool CanAct(); bool IsNotAlive(); void InitializeDialogue(int bPlayerSaysHello); - char _438B9B(); + bool IsPeasant(); - static void __fastcall _401221(unsigned int uActorID, int *a2, unsigned int a3); - static unsigned int __fastcall _402686(unsigned int uActorID, unsigned int a2, signed int uActionLength, struct AIDirection *a4); - static int __fastcall _40281C(unsigned int uActorID, unsigned int a2, signed int uActionLength, struct AIDirection *pDir, int a5); - static unsigned int __fastcall _402968(unsigned int uActorID, signed int edx0, int uActionLength, struct AIDirection *a4); - static unsigned int __fastcall _402AD7(unsigned int uActorID, unsigned int a2, signed int arg0, signed int uActionLength, struct AIDirection *pDir); - static void __fastcall PlaySound(unsigned int uActorID, unsigned int uSoundID); - static void __fastcall Die(unsigned int uActorID); - static unsigned int __fastcall Resurrect(unsigned int uActorID); - static int __fastcall _402F87(unsigned int uActorID, unsigned int uObjID, struct AIDirection *a4); - static __int16 __fastcall _4030AD(unsigned int uActorID, signed int edx0, int arg0); + static void _401221(unsigned int uActorID, int *a2, unsigned int a3); + static void _402686(unsigned int uActorID, unsigned int a2, signed int uActionLength, struct AIDirection *a4); + static void _40281C(unsigned int uActorID, unsigned int a2, signed int uActionLength, struct AIDirection *pDir, int a5); + static void _402968(unsigned int uActorID, signed int edx0, int uActionLength, struct AIDirection *a4); + static void _402AD7(unsigned int uActorID, unsigned int a2, signed int arg0, signed int uActionLength, struct AIDirection *pDir); + static void PlaySound(unsigned int uActorID, unsigned int uSoundID); + static void Die(unsigned int uActorID); + static void Resurrect(unsigned int uActorID); + static void _402F87(unsigned int uActorID, unsigned int uObjID, struct AIDirection *a4); + static void _4030AD(unsigned int uActorID, signed int edx0, int arg0); static char __fastcall _4031C1_update_job(unsigned int uActorID, signed int a2, int a3); - static void __fastcall _4032B2(unsigned int a1, unsigned int a2, int a3, int uActionLength); - static unsigned int __fastcall _403476(unsigned int uActorID, signed int edx0, struct AIDirection *pDir); - static unsigned int __fastcall _40368B(unsigned int uActorID, signed int edx0, struct AIDirection *pDir); - static unsigned int __fastcall _403854(unsigned int uActorID, signed int edx0, struct AIDirection *pDir); - static unsigned int __fastcall _403A60(unsigned int uActorID, signed int edx0, struct AIDirection *pDir); - static unsigned int __fastcall _403C6C(unsigned int uActorID, signed int edx0, struct AIDirection *arg0); + static void _4032B2(unsigned int a1, unsigned int a2, int a3, int uActionLength); + static void _403476(unsigned int uActorID, signed int edx0, struct AIDirection *pDir); + static void _40368B(unsigned int uActorID, signed int edx0, struct AIDirection *pDir); + static void _403854(unsigned int uActorID, signed int edx0, struct AIDirection *pDir); + static void _403A60(unsigned int uActorID, signed int edx0, struct AIDirection *pDir); + static void _403C6C(unsigned int uActorID, signed int edx0, struct AIDirection *arg0); static void __fastcall StandAwhile(unsigned int uActorID); - static unsigned int __fastcall _403EB6(unsigned int uActorID, unsigned int a2, unsigned int uActionLength, struct AIDirection *a4); - static unsigned int __fastcall _403F58(unsigned int uActorID, signed int uObjID, int uActionLength, struct AIDirection *a4); - static unsigned int __fastcall FaceObject(unsigned int uActorID, unsigned int uObjID, int _48, struct AIDirection *a4); + static void _403EB6(unsigned int uActorID, unsigned int a2, unsigned int uActionLength, struct AIDirection *a4); + static void _403F58(unsigned int uActorID, signed int uObjID, int uActionLength, struct AIDirection *a4); + static void FaceObject(unsigned int uActorID, unsigned int uObjID, int _48, struct AIDirection *a4); static struct AIDirection *__fastcall GetDirectionInfo(unsigned int uObj1ID, unsigned int uObj2ID, struct AIDirection *pOut, int a4); static signed int __fastcall Explode(unsigned int uActorID); static char __fastcall _404874(unsigned int uActorID, struct AIDirection *a2, int a3, char a4); static void __fastcall _404AC7(unsigned int uActorID, struct AIDirection *pDir, int spellnum, int a4, unsigned int uSkillLevel); - static void _43AC45(unsigned int uActorID, int a2); - static bool _43ABB0(Actor *a1, Actor *a2); + static void AggroSurroundingPeasants(unsigned int uActorID, int a2); + static bool ArePeasantsOfSameFaction(Actor *a1, Actor *a2); static bool StealFrom(unsigned int uActorID); static void GiveItem(unsigned int uActorID, unsigned int uItemID, unsigned int bGive); static void ToggleFlag(signed int uActorID, unsigned int uFlag, int bToggle); - static void _438CF3(unsigned int uActorID); + static void ApplyFineForKillingPeasant(unsigned int uActorID); static void DrawHealthBar(Actor *a1, struct GUIWindow *a2); static int _43B3E0_CalcDamage(Actor *a1, signed int a2); - static int AddBloodsplatOnDamageOverlay(unsigned int uActorID, int a2, signed int a3); + static void AddBloodsplatOnDamageOverlay(unsigned int uActorID, int a2, signed int a3); char pActorName[32];
--- a/AudioPlayer.cpp Wed Feb 20 20:50:22 2013 +0600 +++ b/AudioPlayer.cpp Wed Feb 20 20:51:55 2013 +0600 @@ -45,17 +45,9 @@ float pSoundVolumeLevels[10] = { - 0.0, - 0.10999999940395, - 0.21999999880791, - 0.33000001311302, - 0.43999999761581, - 0.55000001192093, - 0.66000002622604, - 0.76999998092651, - 0.87999999523163, - 0.99000000953674 -}; // idb + 0.0000000f, 0.1099999f, 0.2199999f, 0.3300000f, 0.4399999f, + 0.5500000f, 0.6600000f, 0.7699999f, 0.8799999f, 0.9900000f +}; @@ -541,7 +533,7 @@ if (!bNoSound && bPlayerReady && hAILRedbook && uMusicVolimeMultiplier) { AIL_redbook_stop(hAILRedbook); - AIL_redbook_set_volume(hAILRedbook, (signed)(pSoundVolumeLevels[uMusicVolimeMultiplier] * 64.0)); + AIL_redbook_set_volume(hAILRedbook, (signed)pSoundVolumeLevels[uMusicVolimeMultiplier] * 64.0f); AIL_redbook_track_info(hAILRedbook, eTrack, &uCurrentMusicTrackStartMS, &uCurrentMusicTrackEndMS); AIL_redbook_play(hAILRedbook, uCurrentMusicTrackStartMS + 1, uCurrentMusicTrackEndMS); uCurrentMusicTrackLength = ((uCurrentMusicTrackEndMS - uCurrentMusicTrackStartMS) * 128) / 1000; @@ -560,20 +552,15 @@ } //----- (004AA214) -------------------------------------------------------- -void AudioPlayer::SetMasterVolume(unsigned int uVolume) +void AudioPlayer::SetMasterVolume(float fVolume) { - AudioPlayer *v2; // esi@1 - _DIG_DRIVER *hDrv; // eax@2 - - v2 = this; - if ( this->bPlayerReady ) + if ( bPlayerReady ) { - hDrv = this->hDigDriver; - this->uMasterVolume = uVolume; - if ( hDrv ) - AIL_set_digital_master_volume(hDrv, uVolume); - if ( v2->b3DSoundInitialized ) - v2->s3DSoundVolume = (signed __int64)((double)(signed int)uVolume * 0.5); + uMasterVolume = fVolume; + if ( hDigDriver ) + AIL_set_digital_master_volume(hDigDriver, fVolume); + if ( b3DSoundInitialized ) + s3DSoundVolume = fVolume * 0.5f; } } // 4D8304: using guessed type int __stdcall AIL_set_digital_master_volume(int, int); @@ -1197,7 +1184,7 @@ v27 = abs((signed __int64)v26); v28 = abs((signed __int64)v93); v29 = abs((signed __int64)*(float *)&varC); - v90 = sub_4621DA(v29, v28, v27); + v90 = int_get_vector_length(v29, v28, v27); sPlaybackRate = v12; if ( v12 > v25 ) goto LABEL_192; @@ -1208,7 +1195,7 @@ v31 = abs((signed __int64)*(float *)&uVolume); v32 = abs((signed __int64)v93); v33 = abs((signed __int64)*(float *)&varC); - v34 = sub_4621DA(v33, v32, v31); + v34 = int_get_vector_length(v33, v32, v31); v35 = v103 == v34; if ( v103 < v34 ) { @@ -1287,7 +1274,7 @@ v50 = abs((signed __int64)v49); v51 = abs(0); v52 = abs((signed __int64)v99); - if ( sub_4621DA(v52, v51, v50) <= 100 ) + if ( int_get_vector_length(v52, v51, v50) <= 100 ) { AIL_set_3D_position((void *)*(int *)v42, LODWORD(v99), 0.0, LODWORD(uNumRepeatsa)); v53 = -uNumRepeatsa; @@ -1559,7 +1546,7 @@ v23 = abs((signed __int64)v22); v24 = abs(0); v25 = abs((signed __int64)v58); - if ( sub_4621DA(v25, v24, v23) <= 100 ) + if ( int_get_vector_length(v25, v24, v23) <= 100 ) { AIL_set_3D_position(v6->hSample, LODWORD(v58), 0.0, uNumRepeats); v26 = -*(float *)&uNumRepeats; @@ -1690,7 +1677,7 @@ v45 = abs(v44->vPosition.z - pParty->vPosition.z); v46 = abs(v44->vPosition.y - pParty->vPosition.y); v47 = abs(v44->vPosition.x - pParty->vPosition.x); - if ( sub_4621DA(v47, v46, v45) <= 8192 ) + if ( int_get_vector_length(v47, v46, v45) <= 8192 ) break; LABEL_89: ++v59; @@ -1772,7 +1759,6 @@ int v5; // ST08_4@1 int v6; // esi@1 int v7; // eax@1 - int result; // eax@2 int v9; // [sp+10h] [bp+8h]@1 v3 = a2; @@ -1780,12 +1766,11 @@ v5 = abs(a3 - pParty->vPosition.z); v6 = abs(v3 - pParty->vPosition.y); v7 = abs(v4 - pParty->vPosition.x); - v9 = sub_4621DA(v7, v6, v5); + v9 = int_get_vector_length(v7, v6, v5); if ( v9 <= 8192 ) - result = 114 - (unsigned __int64)(signed __int64)((double)v9 * 0.0001220703125 * 100.0); + return 114 - (unsigned __int64)(signed __int64)((double)v9 * 0.0001220703125 * 100.0); else - result = 0; - return result; + return 0; } @@ -1974,9 +1959,9 @@ uNumRedbookTracks = AIL_redbook_tracks(hAILRedbook); } pAudioPlayer->sRedbookVolume = AIL_redbook_volume(hAILRedbook); - pAudioPlayer->SetMasterVolume(pSoundVolumeLevels[uSoundVolumeMultiplier] * 128.0); + pAudioPlayer->SetMasterVolume(pSoundVolumeLevels[uSoundVolumeMultiplier] * 128.0f); if ( bPlayerReady && hAILRedbook ) - AIL_redbook_set_volume(hAILRedbook, (unsigned __int64)(pSoundVolumeLevels[uMusicVolimeMultiplier] * 64.0) >> 32); + AIL_redbook_set_volume(hAILRedbook, (unsigned __int64)(pSoundVolumeLevels[uMusicVolimeMultiplier] * 64.0f) >> 32); LoadAudioSnd(); }
--- a/AudioPlayer.h Wed Feb 20 20:50:22 2013 +0600 +++ b/AudioPlayer.h Wed Feb 20 20:51:55 2013 +0600 @@ -141,7 +141,7 @@ } void SetMusicVolume(int vol); - void SetMasterVolume(unsigned int uVolume); + void SetMasterVolume(float fVolume); void _4AA258(int a2); void PlaySound(SoundID eSoundID, signed int a3, unsigned int uNumRepeats, signed int a5, signed int a6, int a7, unsigned int uVolume, int sPlaybackRate); void _4AAFCF();
--- a/Events.cpp Wed Feb 20 20:50:22 2013 +0600 +++ b/Events.cpp Wed Feb 20 20:51:55 2013 +0600 @@ -1,19 +1,44 @@ +#include <stdlib.h> + +#include "MapInfo.h" +#include "Game.h" +#include "GUIWindow.h" +#include "GUIFont.h" +#include "GUIButton.h" +#include "GUIProgressBar.h" +#include "Chest.h" +#include "stru176.h" +#include "LOD.h" +#include "NPC.h" +#include "Actor.h" +#include "Party.h" +#include "Math.h" +#include "AudioPlayer.h" +#include "Indoor.h" +#include "Viewport.h" +#include "texts.h" +#include "Texture.h" +#include "Allocator.h" +#include "mm7_data.h" +#include "stru123.h" +#include "stru159.h" #include "Events.h" #include "Events2D.h" +#include "Weather.h" -Event pSomeOtherEVT_Events[4400]; +EventIndex pSomeOtherEVT_Events[4400]; unsigned int uSomeOtherEVT_NumEvents; char *pSomeOtherEVT; -Event pSomeEVT_Events[4400]; +EventIndex pSomeEVT_Events[4400]; unsigned int uSomeEVT_NumEvents; char *pSomeEVT; unsigned int uGlobalEVT_NumEvents; unsigned int uGlobalEVT_Size; char pGlobalEVT[46080]; -Event pGlobalEVT_Events[4400]; +EventIndex pGlobalEVT_Index[4400]; unsigned int pLevelStrOffsets[500]; unsigned int uLevelStrNumStrings; @@ -22,7 +47,1627 @@ unsigned int uLevelEVT_Size; char pLevelStr[9216]; char pLevelEVT[9216]; -Event pLevelEVT_Events[4400]; +EventIndex pLevelEVT_Index[4400]; _2devent p2DEvents[525]; // weak + + + +//----- (00443CE1) -------------------------------------------------------- +unsigned int LoadEventsToBuffer(const char *pContainerName, char *pBuffer, unsigned int uBufferSize) + { + FILE *pLodFile; // eax@1 + unsigned int uTextureSize; // esi@3 + char Args[60]; // [sp+8h] [bp-B4h]@6 + void *ptr; // [sp+B8h] [bp-4h]@1 + Texture DstBuf; // [sp+6Ch] [bp-50h]@1 + + ptr = pEvents_LOD->LoadRaw(pContainerName, 0); + pLodFile = pEvents_LOD->FindContainer(pContainerName, 0); + if ( !pLodFile ) + Abortf("Unable to load %s", pContainerName); + fread(&DstBuf, 1, 48, pLodFile); + uTextureSize = DstBuf.uDecompressedSize; + if ( !DstBuf.uDecompressedSize ) + uTextureSize = DstBuf.uTextureSize; + memset(&DstBuf, 0, 72); + if ( uTextureSize >= (signed int)uBufferSize ) + { + sprintf(Args, "File %s Size %lu - Buffer size %lu", pContainerName, uTextureSize, uBufferSize); + Abortf(Args); + } + memcpy(pBuffer, ptr, uTextureSize); + pAllocator->FreeChunk(ptr); + return uTextureSize; + } + +//----- (00443DA1) -------------------------------------------------------- +void __cdecl Initialize_GlobalEVT() + { + struct raw_event_header + { + unsigned char evt_size; + unsigned char evt_id_l; + unsigned char evt_id_h; + unsigned char evt_sequence_num; + } ; + uint events_count; + unsigned int offset_in; + raw_event_header *current_hdr; + uGlobalEVT_NumEvents = 0; + uGlobalEVT_Size = LoadEventsToBuffer("global.evt", pGlobalEVT, 46080); + if ( !uGlobalEVT_Size ) + return; + memset(pGlobalEVT_Index, 0x80, sizeof(pGlobalEVT_Index));//52800 + events_count = uGlobalEVT_NumEvents; + current_hdr=(raw_event_header *)pGlobalEVT; + offset_in=0; + for (events_count = 0, offset_in = 0; offset_in < uGlobalEVT_Size; ++events_count) + { + pGlobalEVT_Index[events_count].uEventID=current_hdr->evt_id_l+(current_hdr->evt_id_h<<8); + pGlobalEVT_Index[events_count].event_sequence_num=current_hdr->evt_sequence_num; + pGlobalEVT_Index[events_count].uEventOffsetInEVT=offset_in; + offset_in+=current_hdr->evt_size+1; + current_hdr=(raw_event_header *)&pGlobalEVT[offset_in]; + } + uGlobalEVT_NumEvents = events_count; + + } + + +//----- (00443EF8) -------------------------------------------------------- +void LoadLevel_InitializeLevelEvt() + { + if (!uLevelEVT_Size) + return; + + memset(array_5B5928, 0, 3200); + memset(pLevelEVT_Index, 80, 52800); + + uLevelEVT_NumEvents = 0; + dword_5B65C8 = 0; + + for (uint i = 0, j = 0; j < uLevelEVT_Size; ++i) + { + pLevelEVT_Index[i].uEventID = pLevelEVT[j + 1] + ((unsigned short)pLevelEVT[j + 2] << 8); + pLevelEVT_Index[i].event_sequence_num = pLevelEVT[j + 3]; + pLevelEVT_Index[i].uEventOffsetInEVT = j; + j += pLevelEVT[j] + 1; + uLevelEVT_NumEvents++; + } + } + + +//----- (0044684A) -------------------------------------------------------- +void EventProcessor(int uEventID, int a2, int a3) + { + unsigned int v3; // eax@5 + //signed int v4; // esi@7 + //char *v5; // eax@8 + Player *v6; // ecx@8 + //char *v7; // ebp@8 + //signed int v8; // edx@10 + //int v9; // edi@12 + //ByteArray *v10; // esi@12 + int v11; // eax@14 + char *v12; // eax@15 + //char *v13; // edi@21 + int v14; // ebp@21 + int v15; // edi@21 + const char *v16; // esi@21 + bool v17; // edx@21 + int v18; // ecx@22 + int v19; // ebp@36 + signed int v20; // ecx@40 + int v21; // eax@40 + int v22; // edx@40 + int v23; // eax@40 + unsigned __int16 v24; // ax@45 + int v25; // eax@54 + LevelDecoration *v26; // eax@55 + int v27; // eax@57 + int v28; // ecx@57 + int v29; // edx@58 + int v30; // eax@58 + int v31; // ecx@58 + int v32; // esi@58 + NPCData *v33; // ecx@58 + int v34; // esi@59 + int v35; // esi@60 + int v36; // esi@61 + int v37; // esi@62 + int v38; // eax@78 + int v39; // ecx@78 + size_t v40; // edx@78 + Actor *v41; // esi@79 + int v42; // eax@84 + int v43; // ecx@84 + size_t v44; // edx@84 + Actor *v45; // esi@85 + void *v46; // eax@91 + GUIWindow *v47; // eax@93 + GUIButton *v48; // ecx@93 + GUIButton *v49; // esi@94 + char v50; // al@100 + Player *v51; // esi@103 + Player *v52; // ecx@106 + int v53; // ecx@107 + char v54; // al@111 + Player *v55; // esi@114 + Player *v56; // ecx@117 + int v57; // ecx@118 + signed int v58; // ebp@124 + Player *v59; // esi@125 + int v60; // eax@126 + int v61; // edx@133 + int v62; // eax@139 + void *v63; // ebp@145 + signed int v64; // edi@146 + unsigned int v65; // edx@148 + Player *v66; // ecx@148 + int v67; // esi@148 + signed int v68; // eax@151 + int v69; // esi@151 + Player *v70; // ecx@158 + unsigned int v71; // eax@159 + int v72; // esi@159 + signed int v73; // eax@162 + int v74; // esi@162 + int v75; // edx@172 + Player *v76; // esi@173 + signed int v77; // ebp@186 + int v78; // edx@186 + Player *v79; // esi@187 + signed int v80; // ebp@200 + int v81; // edx@200 + Player *v82; // esi@201 + int v83; // eax@212 + int v84; // ebp@220 + signed int v85; // ebp@224 + char v86; // al@224 + Player *v87; // esi@227 + Player *v88; // ecx@231 + int v89; // ecx@232 + int v90; // eax@243 + const char *v91; // ecx@247 + int v92; // eax@251 + char *v93; // eax@252 + int v94; // ecx@262 + int v95; // ebp@262 + int v96; // edx@262 + int v97; // eax@262 + unsigned int v98; // edx@265 + const char *v99; // esi@267 + int v100; // edx@267 + //char *v101; // edi@281 + unsigned int v102; // esi@281 + int v103; // edi@284 + int v104; // eax@288 + int v105; // edx@294 + int v106; // [sp-20h] [bp-4C8h]@278 + signed int v107; // [sp-1Ch] [bp-4C4h]@278 + unsigned int v108; // [sp-18h] [bp-4C0h]@278 + signed int v109; // [sp-14h] [bp-4BCh]@278 + signed int v110; // [sp-10h] [bp-4B8h]@278 + int v111; // [sp-Ch] [bp-4B4h]@278 + // Event *v112; // [sp-8h] [bp-4B0h]@5 + int v113; // [sp-8h] [bp-4B0h]@106 + int v114; // [sp-8h] [bp-4B0h]@117 + signed int v115; // [sp-8h] [bp-4B0h]@231 + unsigned int v116; // [sp-8h] [bp-4B0h]@278 + int v117; // [sp-4h] [bp-4ACh]@106 + int v118; // [sp-4h] [bp-4ACh]@117 + int v119; // [sp-4h] [bp-4ACh]@231 + int v120; // [sp-4h] [bp-4ACh]@278 + int v121; // [sp-4h] [bp-4ACh]@294 + int curr_seq_num; // [sp+10h] [bp-498h]@4 + //char *v123; // [sp+14h] [bp-494h]@0 + //signed int v124; // [sp+18h] [bp-490h]@7 + signed int v125; // [sp+1Ch] [bp-48Ch]@155 + int v126; // [sp+1Ch] [bp-48Ch]@262 + int v127; // [sp+20h] [bp-488h]@4 + int v128; // [sp+24h] [bp-484h]@21 + int v129; // [sp+24h] [bp-484h]@262 + signed int v130; // [sp+28h] [bp-480h]@0 + //int v131; // [sp+2Ch] [bp-47Ch]@1 + int v132; // [sp+30h] [bp-478h]@262 + signed int v133; // [sp+34h] [bp-474h]@1 + int v134; // [sp+38h] [bp-470h]@262 + int v135; // [sp+3Ch] [bp-46Ch]@262 + int v136; // [sp+40h] [bp-468h]@40 + int v137; // [sp+44h] [bp-464h]@40 + int v138; // [sp+48h] [bp-460h]@40 + int v139; // [sp+4Ch] [bp-45Ch]@40 + ItemGen item; // [sp+50h] [bp-458h]@15 + char Source[120]; // [sp+74h] [bp-434h]@15 + char Str[120]; // [sp+ECh] [bp-3BCh]@21 + Actor Dst; // [sp+164h] [bp-344h]@53 + + //v131 = uEventID; + v133 = 0; + dword_5B5920 = a2; + dword_5B65C4 = 0; + if ( !a1 ) + { + if ( !GameUI_StatusBar_TimedStringTimeLeft ) + ShowStatusBarString(pGlobalTXT_LocalizationStrings[521], 2u);// Nothing here + return; + } + v127 = 2 * (uActiveCharacter == 0) + 4; //4 and 6 + curr_seq_num = dword_597F18; + if ( _5C3420_pDecoration ) + { + uSomeEVT_NumEvents = uGlobalEVT_NumEvents; + pSomeEVT = pGlobalEVT; + memcpy(pSomeEVT_Events, pGlobalEVT_Index, 52800); //4400 evts + } + else + { + uSomeEVT_NumEvents = uLevelEVT_NumEvents; + pSomeEVT = pLevelEVT; + memcpy(pSomeEVT_Events, pLevelEVT_Index, 52800); + } + + + //v4 = 0; + //v124 = 0; + for (uint i = 0; i < uSomeEVT_NumEvents; ++i) + { + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + //while ( 1 ) + //{ + if ( dword_5B65C4 ) + goto LABEL_301; + //v8 = v4; + if ( pSomeEVT_Events[i/*v4*/].uEventID == uEventID && pSomeEVT_Events[i/*v4*/].event_sequence_num == curr_seq_num ) + { + //v9 = pSomeEVT_Events[v8].uEventOffsetInEVT; + //v10 = (ByteArray *)&v5[v9]; + auto _evt = (_evt_raw *)(pSomeEVT + pSomeEVT_Events[i/*v4*/].uEventOffsetInEVT); + + switch (_evt->_e_type) + { + case EVENT_CheckSeason: + if ( !sub_4465DF_check_season(_evt->v5) ) + { + ++curr_seq_num; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + break; + } + v11 = _evt->v6; + goto LABEL_130; + case EVENT_ShowMovie: + { + strcpy(Source, (char *)&_evt->v7); + v12 = (char *)&item.uExpireTime + strlen(Source) + 7; + if ( *v12 == 32 ) + *v12 = 0; + if ( pVideoPlayer->field_54 ) + pVideoPlayer->Unload(); + pVideoPlayer->bStopBeforeSchedule = 0; + pVideoPlayer->pResetflag = 0; + if (pAsyncMouse) + pAsyncMouse->Suspend(); + v128 = pCurrentScreen; + //v13 = &pSomeEVT[v9]; + //v14 = (unsigned __int8)v13[5]; + //v15 = (unsigned __int8)v13[6]; + v14 = _evt->v5; + v15 = _evt->v6; + strcpy(Str, Source); + v16 = RemoveQuotes(Str); + VideoPlayer::MovieLoop(v16, 0, v14, 1); + if ( !_strcmpi(v16, "arbiter good") ) + { + pParty->uAlignment = 0; + v18 = 0; + LOBYTE(v17) = 1; + SetUserInterface(v18, v17); + if ( !v15 || v128 == 3 ) + { + pCurrentScreen = v128; + if ( v128 == 3 ) + pGameLoadingUI_ProgressBar->uType = GUIProgressBar::TYPE_Fullscreen; + if ( v128 == 13 ) + pVideoPlayer->_4BF28F(pAnimatedRooms[uCurrentHouse_Animation].field_0, 1u); + } + if (pAsyncMouse) + pAsyncMouse->Resume(); + ++curr_seq_num; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + break; + } + if ( !_strcmpi(v16, "arbiter evil") ) + { + v18 = 2; + pParty->uAlignment = 2; + LOBYTE(v17) = 1; + SetUserInterface(v18, v17); + if ( !v15 || v128 == 3 ) + { + pCurrentScreen = v128; + if ( v128 == 3 ) + pGameLoadingUI_ProgressBar->uType = GUIProgressBar::TYPE_Fullscreen; + if ( v128 == 13 ) + pVideoPlayer->_4BF28F(pAnimatedRooms[uCurrentHouse_Animation].field_0, 1u); + } + if (pAsyncMouse) + pAsyncMouse->Resume(); + ++curr_seq_num; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + + break; + } + if ( !_strcmpi(v16, "pcout01") ) // moving to harmondale from emerald isle + { + Rest(0x2760u); + pParty->RestAndHeal(); + pParty->field_764 = 0; + } + if ( !v15 || v128 == 3 ) + { + pCurrentScreen = v128; + if ( v128 == 3 ) + pGameLoadingUI_ProgressBar->uType = GUIProgressBar::TYPE_Fullscreen; + if ( v128 == 13 ) + pVideoPlayer->_4BF28F(pAnimatedRooms[uCurrentHouse_Animation].field_0, 1u); + } + if (pAsyncMouse) + pAsyncMouse->Resume(); + ++curr_seq_num; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + } + break; + case EVENT_CheckSkill: + { + v19 = _evt->v7 + ((_evt->v8 + ((_evt->v9 + ((unsigned int)_evt->v10 << 8)) << 8)) << 8); + if ( v127 < 0 ) + goto LABEL_47; + if ( v127 <= 3 ) + { + v24 = pParty->pPlayers[0].pActiveSkills[3486 * v127 + _evt->v5]; + } + else + { + if ( v127 == 4 ) + { + v24 = pPlayers[uActiveCharacter]->pActiveSkills[_evt->v5]; + } + else + { + if ( v127 == 5 ) + { + v20 = 0; + v21 = 3486 * v130 + _evt->v5; + v136 = 1; + LOWORD(v21) = pParty->pPlayers[0].pActiveSkills[v21]; + v137 = v21 & 0x40; + v138 = v21 & 0x80; + v22 = v21 & 0x100; + v23 = v21 & 0x3F; + v139 = v22; + while ( v23 < v19 || !*(&v136 + _evt->v6) ) + { + ++v20; + if ( v20 >= 4 ) + { + ++curr_seq_num; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + break; + } + } + v11 = _evt->v11; + goto LABEL_130; + } +LABEL_47: + //v10 = (ByteArray *)&v5[v9]; + v24 = pParty->pPlayers[0].pActiveSkills[_evt->v5 + 3486 * rand() % 4]; + } + } + v136 = 1; + v137 = v24 & 0x40; + v138 = v24 & 0x80; + v139 = v24 & 0x100; + if ( (v24 & 0x3F) >= v19 && *(&v136 + _evt->v6) ) + { + v11 = _evt->v11; + goto LABEL_130; + } + ++curr_seq_num; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + } + break; + + case EVENT_SpeakNPC: + if ( a3 ) + { + //Actor::Actor(&Dst); + memset(&Dst, 0, 0x344u); + dword_5B65D0_dialogue_actor_npc_id = _evt->v5 + + ((_evt->v6 + + ((_evt->v7 + + ((unsigned int)_evt->v8 << 8)) << 8)) << 8); + Dst.uNPC_ID = dword_5B65D0_dialogue_actor_npc_id; + Dst.InitializeDialogue(0); + } + else + { + bDialogueUI_InitializeActor_NPC_ID = _evt->v5 + + ((_evt->v6 + ((_evt->v7 + ((unsigned int)_evt->v8 << 8)) << 8)) << 8); + } + ++curr_seq_num; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + break; + case EVENT_ChangeEvent: + v25 = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((unsigned int)_evt->v8 << 8)) << 8)) << 8); + if ( v25 ) + { + stru_5E4C90._decor_events[_5C3420_pDecoration->_idx_in_stru123 - 75] = _evt->v5 - 124; + } + else + { + v26 = _5C3420_pDecoration; + stru_5E4C90._decor_events[_5C3420_pDecoration->_idx_in_stru123 - 75] = 0; + LOBYTE(v26->field_2) |= 0x20u; + } + ++curr_seq_num; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + break; + case EVENT_SetNPCGreeting: + v27 = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8); + v28 = _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8); + pNPCStats->pNewNPCData[v27].uFlags &= 0xFFFFFFFCu; + pNPCStats->pNewNPCData[v27].greet = v28; + ++curr_seq_num; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + break; + case EVENT_SetNPCTopic: + { + + v29 = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8); + v30 = _evt->v10 + ((_evt->v11 + ((_evt->v12 + ((uint)_evt->v13 << 8)) << 8)) << 8); + v31 = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8); + v32 = _evt->v9; + v33 = &pNPCStats->pNewNPCData[v31]; + if ( v32 ) + { + v34 = v32 - 1; + if ( v34 ) + { + v35 = v34 - 1; + if ( v35 ) + { + v36 = v35 - 1; + if ( v36 ) + { + v37 = v36 - 1; + if ( v37 ) + { + if ( v37 == 1 ) + v33->evt_F = v30; + } + else + { + v33->evt_E = v30; + } + } + else + { + v33->evt_D = v30; + } + } + else + { + v33->evt_C = v30; + } + } + else + { + v33->evt_B = v30; + } + } + else + { + v33->evt_A = v30; + } + if ( v29 == 8 ) + { + if ( v30 == 78 ) + { + sub_4BD8B5(); + ptr_507BC0->Release(); + pParty->uFlags &= 0xFFFFFFFDu; + if ( EnterHouse((enum HOUSE_TYPE)170) ) + { + pAudioPlayer->StopChannels(-1, -1); + ptr_507BC0 = GUIWindow::Create(0, 0, 640, 480, WINDOW_HouseInterior, 170, 0); + ptr_507BC0->CreateButton(0x3Du, 0x1A8u, 0x1Fu, 0, 2, 94, 0x6Eu, 1u, 0x31u, "", 0); + ptr_507BC0->CreateButton(0xB1u, 0x1A8u, 0x1Fu, 0, 2, 94, 0x6Eu, 2u, 0x32u, "", 0); + ptr_507BC0->CreateButton(0x124u, 0x1A8u, 0x1Fu, 0, 2, 94, 0x6Eu, 3u, 0x33u, "", 0); + ptr_507BC0->CreateButton(0x197u, 0x1A8u, 0x1Fu, 0, 2, 94, 0x6Eu, 4u, 0x34u, "", 0); + ptr_507BC0->CreateButton(0, 0, 0, 0, 1, 0, 0xB0u, 0, 9u, "", 0); + ptr_F8B1E8 = pNPCTopics[90].pText; + } + } + } + ++curr_seq_num; + } + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + break; + case EVENT_NPCSetItem: + sub_448518_npc_set_item(_evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8), + _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8), _evt->v13); + ++curr_seq_num; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + break; + case EVENT_SetActorItem: + Actor::GiveItem(_evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8), + _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8), _evt->v13); + ++curr_seq_num; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + break; + case EVENT_SetNPCGroupNews: + pNPCStats->pGroups_copy[_evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8)] = _evt->v9 + ((uint)_evt->v10 << 8); + ++curr_seq_num; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + break; + case EVENT_SetActorGroup: + __debugbreak(); + *(&pActors[0].uGroup + 0x11000000 * _evt->v8 + 209 * (_evt->v5 + ((_evt->v6 + ((uint)_evt->v7 << 8)) << 8))) = _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8); + ++curr_seq_num; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + break; + case EVENT_ChangeGroup: + v38 = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8); + v39 = _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8); + v40 = uNumActors; + __debugbreak(); + if ( (signed int)uNumActors > 0 ) + { + v41 = pActors;//[0].uGroup; + do + { + if ( v41->uGroup == v38 ) + v41->uGroup = v39; + ++v41; + --v40; + } + while ( v40 ); + } + ++curr_seq_num; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + break; + case EVENT_ChangeGroupAlly: + v42 = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8); + v43 = _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8); + v44 = uNumActors; + __debugbreak(); + if ( (signed int)uNumActors > 0 ) + { + v45 = pActors;//[0].uAlly; + do + { + if ( v45->uGroup == v42 ) + v45->uAlly = v43; + ++v45; + --v44; + } + while ( v44 ); + } + ++curr_seq_num; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + break; + case EVENT_MoveNPC: + { + + pNPCStats->pNewNPCData[_evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8)].Location2D = _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8); + if ( ptr_507BC0 ) + { + v46 = ptr_507BC0->ptr_1C; + if ( v46 == (void *)165 ) + { + sub_4BD8B5(); + pVideoPlayer->Unload(); + ptr_507BC0->Release(); + pParty->uFlags &= 0xFFFFFFFDu; + _5C3420_pDecoration = (LevelDecoration *)1; + if ( EnterHouse((enum HOUSE_TYPE)165) ) + { + pAudioPlayer->PlaySound((SoundID)0, 0, 0, -1, 0, 0, 0, 0); + v47 = GUIWindow::Create(0, 0, 640, 480, WINDOW_HouseInterior, 165, 0); + ptr_507BC0 = v47; + v48 = v47->pControlsHead; + if ( v48 ) + { + do + { + v49 = v48->pNext; + pAllocator->FreeChunk(v48); + v48 = v49; + } + while ( v49 ); + v47 = ptr_507BC0; + } + v47->pControlsHead = 0; + ptr_507BC0->pControlsTail = 0; + ptr_507BC0->uNumControls = 0; + } + } + else + { + if ( v46 == (void *)553 ) + pVideoPlayer->bLoopPlaying = 0; + } + } + ++curr_seq_num; + } + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + break; + case EVENT_Jmp: + //v124 = -1; + curr_seq_num = _evt->v5 - 1; + ++curr_seq_num; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + break; + case EVENT_ShowFace: + v50 = _evt->v5; + if ( (unsigned __int8)v50 <= 3u ) + { + v117 = 0; + v113 = _evt->v6; + v53 = (unsigned __int8)v50; + v52 = &pParty->pPlayers[v53]; + v52->PlayEmotion((CHARACTER_EXPRESSION_ID)v113, v117); + ++curr_seq_num; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + break; + } + if ( v50 == 4 ) + { + v117 = 0; + v113 = _evt->v6; + v52 = pPlayers[uActiveCharacter]; + v52->PlayEmotion((CHARACTER_EXPRESSION_ID)v113, v117); + ++curr_seq_num; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + break; + } + if ( v50 != 5 ) + { + v117 = 0; + v113 = _evt->v6; + v53 = rand() % 4; + v52 = &pParty->pPlayers[v53]; + v52->PlayEmotion((CHARACTER_EXPRESSION_ID)v113, v117); + ++curr_seq_num; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + break; + } + v51 = pParty->pPlayers; + do + { + v51->PlayEmotion((CHARACTER_EXPRESSION_ID)_evt->v6, 0); + ++v51; + } + while ( (signed int)v51 < (signed int)pParty->pHirelings ); + //LABEL_291: + ++curr_seq_num; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + break; + case EVENT_CharacterAnimation: + v54 = _evt->v5; + if ( (unsigned __int8)v54 <= 3u ) + { + v118 = 0; + v114 = _evt->v6; + v57 = (unsigned __int8)v54; + goto LABEL_119; + } + if ( v54 == 4 ) + { + v118 = 0; + v114 = _evt->v6; + v56 = pPlayers[uActiveCharacter]; + goto LABEL_120; + } + if ( v54 != 5 ) + { + v118 = 0; + v114 = _evt->v6; + v57 = rand() % 4; +LABEL_119: + v56 = &pParty->pPlayers[v57]; +LABEL_120: + v56->PlaySound((PlayerSpeech)v114, v118); + ++curr_seq_num; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + break; + } + v55 = pParty->pPlayers; + for (int iii = 0; iii < 4; ++iii) + { + v55->PlaySound((PlayerSpeech)_evt->v6, 0); + ++v55; + } + //while ( (signed int)v55 < (signed int)pParty->pHirelings ); + ++curr_seq_num; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + break; + case EVENT_ForPartyMember: + v127 = _evt->v5; + ++curr_seq_num; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + break; + case EVENT_SummonItem: + sub_42F7EB_DropItemAt(_evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8), + _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8), + _evt->v13 + ((_evt->v14 + ((_evt->v15 + ((uint)_evt->v16 << 8)) << 8)) << 8), + _evt->v17 + ((_evt->v18 + ((_evt->v19 + ((uint)_evt->v20 << 8)) << 8)) << 8), + _evt->v21 + ((_evt->v22 + ((_evt->v23 + ((uint)_evt->v24 << 8)) << 8)) << 8), + _evt->v25, _evt->v26, 0, 0); + ++curr_seq_num; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + break; + case EVENT_Compare: + v58 = _evt->v7 + ((_evt->v8 + ((_evt->v9 + ((uint)_evt->v10 << 8)) << 8)) << 8); + if ( v127 == 5 ) + { + v130 = 0; + v59 = pParty->pPlayers; + while ( 1 ) + { + LOBYTE(v60) = v59->CompareVariable((enum VariableType)(_evt->v5 + ((uint)_evt->v6 << 8)), v58); + if ( v60 ) + break; + ++v130; + ++v59; + if ( (signed int)v59 >= (signed int)pParty->pHirelings ) + { + ++curr_seq_num; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + break; + } + } +LABEL_129: + v11 = _evt->v11; + goto LABEL_130; + } + if ( v127 < 0 ) + goto LABEL_139; + v61 = v127; + if ( v127 <= 3 ) + goto LABEL_137; + if ( v127 == 4 ) + { + if ( uActiveCharacter ) + { + v6 = pPlayers[uActiveCharacter]; + goto LABEL_138; + } + } + else + { + if ( v127 != 6 ) + goto LABEL_139; + } + v61 = rand() % 4; + //v5 = pSomeEVT; +LABEL_137: + v6 = &pParty->pPlayers[v61]; +LABEL_138: + //v123 = v6; +LABEL_139: + LOBYTE(v62) = ((Player *)v6)->CompareVariable( + (enum VariableType)(_evt->v5 + ((uint)_evt->v6 << 8)), + v58); +LABEL_140: + if ( v62 ) + goto LABEL_129; + ++curr_seq_num; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + break; + case EVENT_IsActorAlive: + v62 = IsActorAlive( + _evt->v5, + _evt->v6 + ((_evt->v7 + ((_evt->v8 + ((uint)_evt->v9 << 8)) << 8)) << 8), + _evt->v10); + goto LABEL_140; + case EVENT_Substract: + v63 = (void *)(_evt->v7 + ((_evt->v8 + ((_evt->v9 + ((uint)_evt->v10 << 8)) << 8)) << 8)); + if ( _evt->v5 + ((uint)_evt->v6 << 8) == VAR_PlayerItemInHands ) + { + v64 = 0; + if ( (void *)pParty->pPickedItem.uItemID == v63 ) + { + pMouse->RemoveHoldingItem(); + ++curr_seq_num; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + break; + } + v65 = 0; + v66 = pPlayers[uActiveCharacter]; + v67 = (int)v66->pInventoryIndices; + do + { + if ( *(void **)&v66->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * *(int *)v67 + 5] == v63 ) + { + v66->RemoveItemAtInventoryIndex(v65); + ++curr_seq_num; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + break; + } + ++v65; + v67 += 4; + } + while ( (signed int)v65 < 126 ); + v68 = 0; + v69 = (int)&v66->pEquipment; + do + { + if ( *(int *)v69 && *(void **)&v66->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * *(int *)v69 + 5] == v63 ) + { + *(&v66->pEquipment.uOffHand + v68) = 0; + ++curr_seq_num; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + break; + } + ++v68; + v69 += 4; + } + while ( v68 < 16 ); + v125 = (signed int)&pPlayers[1]; + while ( 1 ) + { + v70 = *(Player **)v125; + if ( !v64 ) + { + v71 = 0; + v72 = (int)v70->pInventoryIndices; + do + { + if ( *(void **)&v70->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * *(int *)v72 + 5] == v63 ) + { + v70->RemoveItemAtInventoryIndex(v71); + goto LABEL_169; + } + ++v71; + v72 += 4; + } + while ( (signed int)v71 < 126 ); + v73 = 0; + v74 = (int)&v70->pEquipment; + while ( !*(int *)v74 + || *(void **)&v70->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * *(int *)v74 + 5] != v63 ) + { + ++v73; + v74 += 4; + if ( v73 >= 16 ) + goto LABEL_170; + } + *(&v70->pEquipment.uOffHand + v73) = 0; +LABEL_169: + v64 = 1; + } +LABEL_170: + v125 += 4; + if ( v125 > (signed int)&pPlayers[4] ) + { + ++curr_seq_num; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + break; + } + } + } + v75 = v127; + if ( v127 != 5 ) + { + if ( v127 < 0 ) + goto LABEL_183; + if ( v127 > 3 ) + { + if ( v127 != 4 ) + { + if ( v127 == 6 ) + goto LABEL_180; +LABEL_183: + ((Player *)v6)->SubtractVariable((enum VariableType)(_evt->v5 + ((uint)_evt->v6 << 8)), v63); + ++curr_seq_num; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + break; + } + if ( uActiveCharacter ) + { + v6 = pPlayers[uActiveCharacter]; + goto LABEL_182; + } +LABEL_180: + v75 = rand() % 4; + //v5 = pSomeEVT; + } + v6 = &pParty->pPlayers[v75]; +LABEL_182: + //v123 = v6; + goto LABEL_183; + } + v76 = pParty->pPlayers; + v130 = 4; + do + { + v76->SubtractVariable( + (enum VariableType)(_evt->v5 + ((uint)_evt->v6 << 8)), + v63); + ++v76; + } + while ( (signed int)v76 < (signed int)pParty->pHirelings ); + ++curr_seq_num; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + break; + case EVENT_Set: + v77 = _evt->v7 + ((_evt->v8 + ((_evt->v9 + ((uint)_evt->v10 << 8)) << 8)) << 8); + v78 = v127; + if ( v127 != 5 ) + { + if ( v127 < 0 ) + goto LABEL_197; + if ( v127 > 3 ) + { + if ( v127 != 4 ) + { + if ( v127 == 6 ) + goto LABEL_194; +LABEL_197: + ((Player *)v6)->SetVariable((enum VariableType)(_evt->v5 + ((uint)_evt->v6 << 8)), v77); + ++curr_seq_num; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + break; + } + if ( uActiveCharacter ) + { + v6 = pPlayers[uActiveCharacter]; + goto LABEL_196; + } +LABEL_194: + v78 = rand() % 4; + //v5 = pSomeEVT; + } + v6 = &pParty->pPlayers[v78]; +LABEL_196: + //v123 = v6; + goto LABEL_197; + } + v79 = pParty->pPlayers; + v130 = 4; + do + { + v79->SetVariable( + (enum VariableType)(_evt->v5 + ((uint)_evt->v6 << 8)), + v77); + ++v79; + } + while ( (signed int)v79 < (signed int)pParty->pHirelings ); + ++curr_seq_num; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + break; + case EVENT_Add: + v80 = _evt->v7 + ((_evt->v8 + ((_evt->v9 + ((uint)_evt->v10 << 8)) << 8)) << 8); + v81 = v127; + if ( v127 != 5 ) + { + if ( v127 < 0 ) + goto LABEL_211; + if ( v127 > 3 ) + { + if ( v127 != 4 ) + { + if ( v127 == 6 ) + goto LABEL_208; +LABEL_211: + ((Player *)v6)->AddVariable( + (enum VariableType)(_evt->v5 + ((uint)_evt->v6 << 8)), + v80); + goto LABEL_212; + } + if ( uActiveCharacter ) + { + v6 = pPlayers[uActiveCharacter]; + goto LABEL_210; + } +LABEL_208: + v81 = rand() % 4; + //v5 = pSomeEVT; + } + v6 = &pParty->pPlayers[v81]; +LABEL_210: + //v123 = v6; + goto LABEL_211; + } + v82 = pParty->pPlayers; + v130 = 4; + do + { + v82->AddVariable( + (enum VariableType)(_evt->v5 + ((uint)_evt->v6 << 8)), + v80); + ++v82; + } + while ( (signed int)v82 < (signed int)pParty->pHirelings ); +LABEL_212: + v83 = _evt->v5 + ((uint)_evt->v6 << 8); + if ( v83 == 21 || v83 == 22 || v83 == 23 || v83 == 24 ) + viewparams->bRedrawGameUI = 1; + ++curr_seq_num; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + break; + case EVENT_InputString: + if ( !dword_597F18 ) + { + strcpy( + GameUI_StatusBar_TimedString, + &pLevelStr[pLevelStrOffsets[_evt->v5 + + ((_evt->v6 + + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8)]]); + v105 = curr_seq_num; + v121 = 26; +LABEL_295: + sub_4451A8_press_any_key(uEventID, v105, v121); +LABEL_301: + if ( v133 == 1 ) +LABEL_302: + OnMapLeave(); + return; + } + v84 = _evt->v13 + ((_evt->v14 + ((_evt->v15 + ((uint)_evt->v16 << 8)) << 8)) << 8); + if ( !_strcmpi( + GameUI_StatusBar_TimedString, + &pLevelStr[pLevelStrOffsets[_evt->v9 + + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8)]]) + || !_strcmpi(GameUI_StatusBar_TimedString, &pLevelStr[pLevelStrOffsets[v84]]) ) + { + v11 = _evt->v17; +LABEL_130: + //v124 = -1; +LABEL_131: + curr_seq_num = v11 - 1; + } + ++curr_seq_num; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + break; + case EVENT_RandomGoTo: + //v124 = -1; + v11 = (unsigned __int8)*(&_evt->v5 + rand() % ((_evt->v5 != 0) + (_evt->v6 != 0) + (_evt->v7 != 0) + (_evt->v8 != 0) + (_evt->v9 != 0) + + (_evt->v10 != 0))); + goto LABEL_131; + case EVENT_ReceiveDamage: + v85 = _evt->v7 + ((_evt->v8 + ((_evt->v9 + ((uint)_evt->v10 << 8)) << 8)) << 8); + v86 = _evt->v5; + if ( (unsigned __int8)v86 <= 3u ) + { + v119 = _evt->v6; + v115 = _evt->v7 + ((_evt->v8 + ((_evt->v9 + ((uint)_evt->v10 << 8)) << 8)) << 8); + v89 = (unsigned __int8)v86; + goto LABEL_233; + } + if ( v86 == 4 ) + { + if ( !uActiveCharacter ) + { + ++curr_seq_num; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + break; + } + v119 = _evt->v6; + v88 = pPlayers[uActiveCharacter]; + v115 = _evt->v7 + ((_evt->v8 + ((_evt->v9 + ((uint)_evt->v10 << 8)) << 8)) << 8); + goto LABEL_234; + } + if ( v86 != 5 ) + { + v119 = _evt->v6; + v115 = _evt->v7 + ((_evt->v8 + ((_evt->v9 + ((uint)_evt->v10<< 8)) << 8)) << 8); + v89 = rand() % 4; +LABEL_233: + v88 = &pParty->pPlayers[v89]; +LABEL_234: + v88->ReceiveDamage(v115, v119); + ++curr_seq_num; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + break; + } + v87 = pParty->pPlayers; + do + { + v87->ReceiveDamage(v85, _evt->v6); + ++v87; + } + while ( (signed int)v87 < (signed int)pParty->pHirelings ); + ++curr_seq_num; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + break; + case EVENT_ToggleIndoorLight: + pIndoor->ToggleLight(_evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8), _evt->v9); + ++curr_seq_num; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + break; + case EVENT_SetFacesBit: + sub_44892E_set_faces_bit(_evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8), + _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8), _evt->v13); + ++curr_seq_num; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + break; + case EVENT_ToggleChestFlag: + Chest::ToggleFlag(_evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8), + _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8), _evt->v13); + ++curr_seq_num; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + break; + case EVENT_ToggleActorFlag: + Actor::ToggleFlag(_evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8), + _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8), _evt->v13); + ++curr_seq_num; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + break; + case EVENT_ToggleActorGroupFlag: + ToggleActorGroupFlag( + _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8), + _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8), + _evt->v13); + ++curr_seq_num; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + break; + case EVENT_SetSnow: + if ( !_evt->v5 ) + pWeather->bRenderSnow = _evt->v6 != 0; + ++curr_seq_num; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + break; + case EVENT_StatusText: + v90 = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8); + if ( _5C3420_pDecoration ) + { + if ( _5C3420_pDecoration == (LevelDecoration *)1 ) + { + ptr_F8B1E8 = pNPCTopics[v90-1].pText;//(&dword_721664)[8 * v90]; + ++curr_seq_num; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + break; + } + if ( a3 == 1 ) + { + v91 = pNPCTopics[v90-1].pText;//(&dword_721664)[8 * v90]; + //LABEL_248: + ShowStatusBarString(v91, 2u); + ++curr_seq_num; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + break; + } + } + else + { + if ( a3 == 1 ) + { + v91 = &pLevelStr[pLevelStrOffsets[v90]]; + ShowStatusBarString(v91, 2u); + ++curr_seq_num; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + break; + } + } + ++curr_seq_num; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + break; + case EVENT_ShowMessage: + v92 = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8); + if ( _5C3420_pDecoration ) + { + v93 = (char *)pNPCTopics[v92-1].pText;//(&dword_721664)[8 * v92]; + byte_5B0938[0] = 0; + ptr_F8B1E8 = v93; + } + else + { + strcpy(byte_5B0938, &pLevelStr[pLevelStrOffsets[v92]]); + } + ++curr_seq_num; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + break; + case EVENT_CastSpell: + sub_448DF8_cast_spell(_evt->v5, _evt->v6, _evt->v7, _evt->v8 + ((_evt->v9 + ((_evt->v10 + ((uint)_evt->v11 << 8)) << 8)) << 8), + _evt->v12 + ((_evt->v13 + ((_evt->v14 + ((uint)_evt->v15 << 8)) << 8)) << 8), + _evt->v16 + ((_evt->v17 + ((_evt->v18 + ((uint)_evt->v19 << 8)) << 8)) << 8), + _evt->v20 + ((_evt->v21 + ((_evt->v22 + ((uint)_evt->v23 << 8)) << 8)) << 8), + _evt->v24 + ((_evt->v25 + ((_evt->v26 + ((uint)_evt->v27 << 8)) << 8)) << 8), + _evt->v28 + ((_evt->v29 + ((_evt->v30 + ((uint)_evt->v31 << 8)) << 8)) << 8)); + ++curr_seq_num; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + break; + case EVENT_SetTexture: + sub_44861E_set_texture(_evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8), (char *)&_evt->v9); + ++curr_seq_num; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + break; + case EVENT_SetSprite: + SetDecorationSprite(_evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8), _evt->v9, (char *)&_evt->v10); + ++curr_seq_num; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + break; + case EVENT_SummonMonsters: + sub_448CF4_spawn_monsters(_evt->v5, _evt->v6, _evt->v7, + _evt->v8 + ((_evt->v9 + ((_evt->v10 + ((uint)_evt->v11 << 8)) << 8)) << 8), + _evt->v12 + ((_evt->v13 + ((_evt->v14 + ((uint)_evt->v15 << 8)) << 8)) << 8), + _evt->v16 + ((_evt->v17 + ((_evt->v18 + ((uint)_evt->v19 << 8)) << 8)) << 8), + _evt->v20 + ((_evt->v21 + ((_evt->v22 + ((uint)_evt->v23 << 8)) << 8)) << 8), + _evt->v24 + ((_evt->v25 + ((_evt->v26 + ((uint)_evt->v27 << 8)) << 8)) << 8)); + ++curr_seq_num; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + break; + case EVENT_MouseOver: + case EVENT_LocationName: + --curr_seq_num; + ++curr_seq_num; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + break; + case EVENT_ChangeDoorState: + sub_449A49_door_switch_animation(_evt->v5, _evt->v6); + ++curr_seq_num; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + break; + case EVENT_OpenChest: + if ( !Chest::Open(_evt->v5) ) + goto LABEL_301; + ++curr_seq_num; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + break; + case EVENT_MoveToMap: + v94 = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8); + v135 = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8); + v132 = _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8); + v126 = _evt->v13 + ((_evt->v14 + ((_evt->v15 + ((uint)_evt->v16 << 8)) << 8)) << 8); + v129 = _evt->v17 + ((_evt->v18 + ((_evt->v19 + ((uint)_evt->v20 << 8)) << 8)) << 8); + v95 = _evt->v21 + ((_evt->v22 + ((_evt->v23 + ((uint)_evt->v24 << 8)) << 8)) << 8); + v96 = _evt->v25; + v97 = v96 + ((_evt->v26 + ((_evt->v27 + ((uint)_evt->v28 << 8)) << 8)) << 8); + v134 = v96 + ((_evt->v26 + ((_evt->v27 + ((uint)_evt->v28 << 8)) << 8)) << 8); + if ( _evt->v29 || _evt->v30 ) + { + if ( pRenderer->pRenderD3D && !pRenderer->bWindowMode ) + pRenderer->_49FD3A(); + sub_444839_move_map(_evt->v29, _evt->v30, v135, v132, v126, v129, v95, v134, (char *)&_evt->v31); + dword_5C3418 = uEventID; + dword_5C341C = curr_seq_num + 1; + goto LABEL_301; + } + _5B65AC_npcdata_fame_or_other = _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8); + _5B65A8_npcdata_uflags_or_other = v94; + _5B65B0_npcdata_rep_or_other = v126; + if ( v129 == -1 ) + { + v98 = _5B65B4_npcdata_loword_house_or_other; + } + else + { + v98 = v129 & stru_5C6E00->uDoublePiMask; + _5B65B4_npcdata_loword_house_or_other = v129 & stru_5C6E00->uDoublePiMask; + } + v99 = (char *)&_evt->v31; + _5B65B8_npcdata_hiword_house_or_other = v95; + dword_5B65BC = v97; + v100 = v94 | v132 | v126 | v95 | v97 | v98; + dword_5B65C0 = v100; + if ( *v99 == 48 ) + { + if ( v100 ) + { + pParty->vPosition.x = v135; + pParty->vPosition.y = v132; + pParty->vPosition.z = v126; + pParty->uFallStartY = v126; + if ( _5B65B4_npcdata_loword_house_or_other != -1 ) + pParty->sRotationY = _5B65B4_npcdata_loword_house_or_other; + _5B65B4_npcdata_loword_house_or_other = -1; + v120 = 0; + v116 = 0; + v111 = 0; + v110 = 0; + v109 = -1; + v108 = 0; + v107 = 0; + pParty->sRotationX = v95; + pParty->uFallSpeed = v134; + dword_5B65C0 = 0; + dword_5B65BC = 0; + _5B65B8_npcdata_hiword_house_or_other = 0; + _5B65B0_npcdata_rep_or_other = 0; + _5B65AC_npcdata_fame_or_other = 0; + _5B65A8_npcdata_uflags_or_other = 0; + v106 = 232; +LABEL_280: + pAudioPlayer->PlaySound((SoundID)v106, v107, v108, v109, v110, v111, v116, v120); + } + } + else + { + pGameLoadingUI_ProgressBar->uType = (GUIProgressBar::Type)((_5C3420_pDecoration == 0) + 1); + sub_44987B(v99, 0); + v133 = 1; + if ( pCurrentScreen == SCREEN_HOUSE ) + { + if ( uGameState == 2 ) + { + pAudioPlayer->StopChannels(-1, -1); + dword_F8B19C = 0; + while ( sub_4BD8B5() ) + ; + pVideoPlayer->Unload(); + ptr_507BC0->Release(); + ptr_507BC0 = 0; + if ( pMessageQueue_50CBD0->uNumMessages ) + pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; + pCurrentScreen = SCREEN_GAME; + viewparams->bRedrawGameUI = 1; + array_5913D8[6] = 0; + pDialogueWindow->Release(); + dword_F8B19C = 0; + pDialogueWindow = 0; + pIcons_LOD->_40F9C5(); + } + goto LABEL_302; + } + } + ++curr_seq_num; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + break; + case EVENT_PlaySound: + v120 = 0; + v116 = 0; + v111 = 0; + v110 = _evt->v13 + ((_evt->v14 + ((_evt->v15 + ((uint)_evt->v16 << 8)) << 8)) << 8); + v109 = _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8); + v108 = 0; + v107 = 0; + v106 = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8); + goto LABEL_280; + case EVENT_GiveItem: + item.Reset(); + //v101 = &pSomeEVT[v9]; + v102 = _evt->v7 + + ((_evt->v8 + ((_evt->v9 + ((uint)_evt->v10 << 8)) << 8)) << 8); + pItemsTable->GenerateItem(_evt->v5, _evt->v6, &item); + if ( v102 ) + item.uItemID = v102; + pParty->SetHoldingItem(&item); + ++curr_seq_num; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + break; + case EVENT_SpeakInHouse: + v103 = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8); + if ( EnterHouse((enum HOUSE_TYPE)(_evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8))) ) + { + if ( pRenderer->pRenderD3D && !pRenderer->bWindowMode ) + pRenderer->_49FD3A(); + pAudioPlayer->PlaySound((SoundID)0, 0, 0, -1, 0, 0, 0, 0); + pAudioPlayer->PlaySound(SOUND_EnteringAHouse, 814, 0, -1, 0, 0, 0, 0); + v104 = 187; + if ( uCurrentHouse_Animation != 167 ) + v104 = v103; + ptr_507BC0 = GUIWindow::Create(0, 0, 640, 480, WINDOW_HouseInterior, v104, 0); + ptr_507BC0->CreateButton(0x3Du, 0x1A8u, 0x1Fu, 0, 2, 94, 0x6Eu, 1u, 0x31u, "", 0); + ptr_507BC0->CreateButton(0xB1u, 0x1A8u, 0x1Fu, 0, 2, 94, 0x6Eu, 2u, 0x32u, "", 0); + ptr_507BC0->CreateButton(0x124u, 0x1A8u, 0x1Fu, 0, 2, 94, 0x6Eu, 3u, 0x33u, "", 0); + ptr_507BC0->CreateButton(0x197u, 0x1A8u, 0x1Fu, 0, 2, 94, 0x6Eu, 4u, 0x34u, "", 0); + ptr_507BC0->CreateButton(0, 0, 0, 0, 1, 0, 0xB0u, 0, 9u, "", 0); + } + ++curr_seq_num; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + break; + case EVENT_PressAnyKey: + v121 = 33; + v105 = curr_seq_num + 1; + goto LABEL_295; + case EVENT_Exit: + goto LABEL_301; + default: + ++curr_seq_num; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + break; + } + } + //++v4; + //v124 = v4; + //if ( v4 >= (signed int)uSomeEVT_NumEvents ) + //goto LABEL_301; + //} + } + } +
--- a/Events.h Wed Feb 20 20:50:22 2013 +0600 +++ b/Events.h Wed Feb 20 20:51:55 2013 +0600 @@ -5,23 +5,29 @@ /* 167 */ #pragma pack(push, 1) -struct Event +struct EventIndex { int uEventID; - int field_4; + int event_sequence_num; unsigned int uEventOffsetInEVT; }; #pragma pack(pop) - +// raw event struct +// header +// size_event 1 header+data +// event id 2 3 +// event_sequence_num +// event data #pragma pack(push, 1) struct _evt_raw { - unsigned char v0; + unsigned char _e_size; unsigned char v1; unsigned char v2; unsigned char v3; - unsigned char v4; + + unsigned char _e_type; unsigned char v5; unsigned char v6; unsigned char v7; @@ -289,17 +295,17 @@ -extern Event pSomeOtherEVT_Events[4400]; +extern EventIndex pSomeOtherEVT_Events[4400]; extern unsigned int uSomeOtherEVT_NumEvents; extern char *pSomeOtherEVT; -extern Event pSomeEVT_Events[4400]; +extern EventIndex pSomeEVT_Events[4400]; extern unsigned int uSomeEVT_NumEvents; extern char *pSomeEVT; extern unsigned int uGlobalEVT_NumEvents; extern unsigned int uGlobalEVT_Size; extern char pGlobalEVT[46080]; -extern Event pGlobalEVT_Events[4400]; +extern EventIndex pGlobalEVT_Index[4400]; extern unsigned int pLevelStrOffsets[500]; extern unsigned int uLevelStrNumStrings; @@ -308,11 +314,13 @@ extern unsigned int uLevelEVT_Size; extern char pLevelStr[9216]; extern char pLevelEVT[9216]; -extern Event pLevelEVT_Events[4400]; +extern EventIndex pLevelEVT_Index[4400]; - - +unsigned int LoadEventsToBuffer(const char *pContainerName, char *pBuffer, unsigned int uBufferSize); +void Initialize_GlobalEVT(); +void LoadLevel_InitializeLevelEvt(); +void EventProcessor(int uEventID, int a2, int a3);
--- a/GUIWindow.cpp Wed Feb 20 20:50:22 2013 +0600 +++ b/GUIWindow.cpp Wed Feb 20 20:51:55 2013 +0600 @@ -215,7 +215,7 @@ v15 = pPlayerFrameTable->GetFrameBy_x(uFramesetID, v14); } pPlayer->field_1AA2 = v15->uTextureID - 1; - v13 = pTextures_PlayerFaces[(unsigned int)ptr_1C][v15->uTextureID]; + v13 = pTextures_PlayerFaces[(unsigned int)ptr_1C][v15->uTextureID-1]; } pRenderer->DrawTextureTransparent(uFrameX + 24, uFrameY + 24, v13);
--- a/Game.cpp Wed Feb 20 20:50:22 2013 +0600 +++ b/Game.cpp Wed Feb 20 20:51:55 2013 +0600 @@ -231,7 +231,7 @@ LoadPlayerPortraintsAndVoices(); pIcons_LOD->dword_11B84 = pIcons_LOD->uNumLoadedFiles; - pAudioPlayer->SetMusicVolume(pSoundVolumeLevels[uMusicVolimeMultiplier] * 64.0); + pAudioPlayer->SetMusicVolume(pSoundVolumeLevels[uMusicVolimeMultiplier] * 64.0f); while ( 2 ) { @@ -624,7 +624,7 @@ } //depth = v2; - PickMouse(depth, y, x, true, v10, v11); + PickMouse(depth, y, x, false, v10, v11); pLightmapBuilder->std__vector_000004_size = 0; pLightmapBuilder->std__vector_183808_size = 0; pDecalBuilder->std__vector_pDecals_size = 0; @@ -1114,6 +1114,7 @@ } else assert(false); } + break; default: {
--- a/Indoor.cpp Wed Feb 20 20:50:22 2013 +0600 +++ b/Indoor.cpp Wed Feb 20 20:51:55 2013 +0600 @@ -192,10 +192,10 @@ } if ( pRenderer->pRenderD3D ) { - v3->sCosineY = stru_5C6E00->SinCos(v3->sPartyRotY); - v3->sSineY = stru_5C6E00->SinCos(v3->sPartyRotY - stru_5C6E00->uIntegerHalfPi); - v3->sCosineNegX = stru_5C6E00->SinCos(-v3->sPartyRotX); - v3->sSineNegX = stru_5C6E00->SinCos(-v3->sPartyRotX - stru_5C6E00->uIntegerHalfPi); + v3->sCosineY = stru_5C6E00->Cos(v3->sPartyRotY); + v3->sSineY = stru_5C6E00->Sin(v3->sPartyRotY); + v3->sCosineNegX = stru_5C6E00->Cos(-v3->sPartyRotX); + v3->sSineNegX = stru_5C6E00->Sin(-v3->sPartyRotX); v3->fCosineY = cos((3.141592653589793 + 3.141592653589793) * (double)v3->sPartyRotY * 0.00048828125); v3->fSineY = sin((3.141592653589793 + 3.141592653589793) * (double)v3->sPartyRotY * 0.00048828125); v3->fCosineNegX = cos((3.141592653589793 + 3.141592653589793) * (double)-v3->sPartyRotX * 0.00048828125); @@ -214,10 +214,10 @@ } else { - v3->sCosineY = stru_5C6E00->SinCos(-v3->sPartyRotY); - v3->sSineY = stru_5C6E00->SinCos(-v3->sPartyRotY - stru_5C6E00->uIntegerHalfPi); - v3->sCosineNegX = stru_5C6E00->SinCos(-v3->sPartyRotX); - v3->sSineNegX = stru_5C6E00->SinCos(-v3->sPartyRotX - stru_5C6E00->uIntegerHalfPi); + v3->sCosineY = stru_5C6E00->Cos(-v3->sPartyRotY); + v3->sSineY = stru_5C6E00->Sin(-v3->sPartyRotY); + v3->sCosineNegX = stru_5C6E00->Cos(-v3->sPartyRotX); + v3->sSineNegX = stru_5C6E00->Sin(-v3->sPartyRotX); v17 = cos((double)-v3->sPartyRotY * 0.0030664064); v18 = v3->sPartyRotY; v3->fCosineY = v17; @@ -372,10 +372,8 @@ _this.uFlags |= INDOOR_CAMERA_DRAW_D3D_OUTLINES; _this.field_0_timer = pEventTimer->uTotalGameTimeElapsed; - _this.vPosition.x = pParty->vPosition.x - - ((unsigned __int64)(stru_5C6E00->SinCos(pParty->sRotationY) - * (signed __int64)pParty->y_rotation_granularity) >> 16); - v2 = stru_5C6E00->SinCos(pParty->sRotationY - stru_5C6E00->uIntegerHalfPi); + _this.vPosition.x = pParty->vPosition.x - ((unsigned __int64)(stru_5C6E00->Cos(pParty->sRotationY) * (signed __int64)pParty->y_rotation_granularity) >> 16); + v2 = stru_5C6E00->Sin(pParty->sRotationY); v3 = (unsigned __int64)(v2 * (signed __int64)pParty->y_rotation_granularity) >> 16; _this.field_1C_mb_fov = 65; _this.vPosition.y = pParty->vPosition.y - v3; @@ -1305,7 +1303,7 @@ auto pFace = &pIndoor->pFaces[uFaceID]; - if (pFace->uAttributes & 1) + if (pFace->TwoSided()) { auto p = &field_FA8[a2]; //v6 = (int)((char *)this + 2252 * a2); @@ -1502,7 +1500,7 @@ v3 = this; v4 = &pIndoor->pFaces[uFaceID]; v21 = v4; - if ( v4->uAttributes & 1 ) + if (v4->TwoSided()) { v5 = (char *)this + 2252 * a2; v20 = v5; @@ -3463,14 +3461,14 @@ int BLVFaceExtra::HasEventint() { signed int v1; // eax@1 - Event *v2; // esi@2 + EventIndex *v2; // esi@2 signed int result; // eax@5 signed int v4; // eax@6 v1 = 0; if ( (signed int)(uLevelEVT_NumEvents - 1) <= 0 ) goto LABEL_5; - v2 = pLevelEVT_Events; + v2 = pLevelEVT_Index; while ( v2->uEventID != this->uEventID ) { ++v1; @@ -3479,8 +3477,8 @@ goto LABEL_5; } v4 = v1; - if ( pLevelEVT[pLevelEVT_Events[v4 + 1].uEventOffsetInEVT + 4] != 1 - || pLevelEVT[pLevelEVT_Events[v4].uEventOffsetInEVT + 4] != 4 ) + if ( pLevelEVT[pLevelEVT_Index[v4 + 1].uEventOffsetInEVT + 4] != 1 + || pLevelEVT[pLevelEVT_Index[v4].uEventOffsetInEVT + 4] != 4 ) LABEL_5: result = 0; else @@ -4004,7 +4002,7 @@ || (v56 = _46CEC3_get_floor_level(v0->vPosition.x, v0->vPosition.y, v0->vPosition.z, v5, &uFaceID), v56 == -30000) ) goto LABEL_123; } - if ( v0->uCurrentActionAnimation == 1 ) + if ( v0->uCurrentActionAnimation == ANIM_Walking) { v6 = v0->uMovementSpeed; v7 = HIDWORD(v0->pActorBuffs[7].uExpireTime) == 0; @@ -4030,18 +4028,18 @@ v6 = (signed __int64)((double)v61 * flt_6BE3AC_debug_recmod1_x_1_6); if ( v6 > 1000 ) v6 = 1000; - v12 = stru_5C6E00->SinCos(v0->uYawAngle); + v12 = stru_5C6E00->Cos(v0->uYawAngle); uSectorID = v12; v13 = v12 * (signed __int64)v6; v61 = v13 >> 16; v0->vVelocity.x = WORD1(v13); - uSectorID = stru_5C6E00->SinCos(v0->uYawAngle - stru_5C6E00->uIntegerHalfPi); + uSectorID = stru_5C6E00->Sin(v0->uYawAngle); v61 = (unsigned __int64)(uSectorID * (signed __int64)v6) >> 16; v7 = v62 == 0; v0->vVelocity.y = (unsigned int)(uSectorID * v6) >> 16; if ( !v7 ) { - v14 = stru_5C6E00->SinCos(v0->uPitchAngle - stru_5C6E00->uIntegerHalfPi); + v14 = stru_5C6E00->Sin(v0->uPitchAngle); uSectorID = v14; v15 = v14 * (signed __int64)v6; v61 = v15 >> 16; @@ -4157,7 +4155,7 @@ v27 = abs(pActors[v54].vPosition.z - v0->vPosition.z); v28 = abs(pActors[v26].vPosition.y - v0->vPosition.y); v29 = abs(pActors[v26].vPosition.x - v0->vPosition.x); - if ( sub_4621DA(v29, v28, v27) >= v0->uActorRadius + (signed int)pActors[v26].uActorRadius + if ( int_get_vector_length(v29, v28, v27) >= v0->uActorRadius + (signed int)pActors[v26].uActorRadius && _46DF1A_collide_against_actor(v54, 40) ) ++v58; v22 = 0; @@ -4229,11 +4227,11 @@ v45 = stru_5C6E00->Atan2( v0->vPosition.x - pLevelDecorations[v37].vPosition.x, v0->vPosition.y - pLevelDecorations[v37].vPosition.y); - v54 = stru_5C6E00->SinCos(v45); + v54 = stru_5C6E00->Cos(v45); v56 = (unsigned __int64)(v54 * (signed __int64)(signed int)_this) >> 16; v46 = v45 - stru_5C6E00->uIntegerHalfPi; v0->vVelocity.x = v54 * _this >> 16; - v47 = stru_5C6E00->SinCos(v46); + v47 = stru_5C6E00->Sin(v45); v54 = v47; v48 = v47 * (signed __int64)(signed int)_this; v56 = v48 >> 16;
--- a/IndoorCamera.cpp Wed Feb 20 20:50:22 2013 +0600 +++ b/IndoorCamera.cpp Wed Feb 20 20:51:55 2013 +0600 @@ -102,11 +102,11 @@ fRotationXCosine = cos(v2 * 0.00048828125); //v5 = stru_5C6E00->SinCos(sRotationY - stru_5C6E00->uIntegerHalfPi); //v6 = sRotationY; - _int_sine = stru_5C6E00->SinCos(sRotationY - stru_5C6E00->uIntegerHalfPi); - _int_cosine = stru_5C6E00->SinCos(sRotationY); + _int_sine = stru_5C6E00->Sin(sRotationY); + _int_cosine = stru_5C6E00->Cos(sRotationY); //v7 = stru_5C6E00->SinCos(sRotationX - stru_5C6E00->uIntegerHalfPi); //v8 = sRotationX; - _int_sine_2 = stru_5C6E00->SinCos(sRotationX - stru_5C6E00->uIntegerHalfPi); - _int_cosine_2 = stru_5C6E00->SinCos(sRotationX); + _int_sine_2 = stru_5C6E00->Sin(sRotationX); + _int_cosine_2 = stru_5C6E00->Cos(sRotationX); } // 4D864C: using guessed type char byte_4D864C; \ No newline at end of file
--- a/Items.cpp Wed Feb 20 20:50:22 2013 +0600 +++ b/Items.cpp Wed Feb 20 20:51:55 2013 +0600 @@ -19,7 +19,7 @@ ItemGen *ptr_50C9A4; -struct ItemsTable *pItemsTable; +struct ItemsTable *pItemsTable; // 005D29E0
--- a/Items.h Wed Feb 20 20:50:22 2013 +0600 +++ b/Items.h Wed Feb 20 20:51:55 2013 +0600 @@ -56,6 +56,7 @@ ITEM_SPELLBOOK_LIGHT_SUN_BURST = 0x1E6, ITEM_SPELLBOOK_LIGHT_DIVINE_INTERVENTION = 0x1E7, ITEM_ARTIFACT_PUCK = 0x1F4, + ITEM_ARTIFACT_SPLITTER = 506,//1FA ITEM_RELIC_MEKORIGS_HAMMER = 0x210, }; @@ -80,7 +81,7 @@ EQUIP_F = 0xF, EQUIP_BOOK = 0x10, EQUIP_11 = 0x11, - EQUIP_GOLD = 0x12, + EQUIP_GOLD = 18, EQUIP_GEM = 0x13, }; @@ -96,7 +97,10 @@ Reset(); } - inline bool Broken() {return uAttributes & ITEM_BROKEN;} + inline bool Broken() {return uAttributes & ITEM_BROKEN;} + inline bool Identified() {return uAttributes & ITEM_IDENTIFIED;} + inline void SetIdentified() {uAttributes |= ITEM_IDENTIFIED;} + inline bool Stolen() {return uAttributes & ITEM_STOLEN;} bool GenerateArtifact(); unsigned int GetValue(); @@ -151,7 +155,7 @@ char field_26; //26 2A char field_27; // 27 2b union - { + { unsigned __int8 uChanceByTreasureLvl[6]; struct { unsigned __int8 uChanceByTreasureLvl1; // 28 2c @@ -161,10 +165,10 @@ unsigned __int8 uChanceByTreasureLvl5; // 2C 30 unsigned __int8 uChanceByTreasureLvl6; // 2D 32 }; - }; - unsigned char uItemID_Rep_St; //2e 32 - char field_2f; - }; + }; + unsigned char uItemID_Rep_St; //2e 32 + char field_2f; +}; #pragma pack(pop) @@ -250,6 +254,9 @@ unsigned int pSpecialEnchantmentsSumm[24]; //11738h unsigned int pSpecialEnchantments_count; //11798h char field_1179C; + char field_1179D; + char field_1179E; + char field_1179F; }; #pragma pack(pop)
--- a/Keyboard.cpp Wed Feb 20 20:50:22 2013 +0600 +++ b/Keyboard.cpp Wed Feb 20 20:51:55 2013 +0600 @@ -37,6 +37,7 @@ { uLastKeyPressed = 0; field_204 = 0; + pWindow = nullptr; SetDefaultMapping(); ReadMappings();
--- a/Math.h Wed Feb 20 20:50:22 2013 +0600 +++ b/Math.h Wed Feb 20 20:51:55 2013 +0600 @@ -7,9 +7,9 @@ struct stru193_math { stru193_math(); - int SinCos(int angle); + int Cos(int angle); unsigned int Atan2(int x, int y); - int _42EBDB(int angle); + int Sin(int angle); int pTanTable[520]; int pCosTable[520];
--- a/Monsters.h Wed Feb 20 20:50:22 2013 +0600 +++ b/Monsters.h Wed Feb 20 20:51:55 2013 +0600 @@ -6,8 +6,10 @@ enum MONSTER_TYPE { MONSTER_DEVIL_1 = 0x16, + MONSTER_DEVIL_2 = 0x17, MONSTER_DEVIL_3 = 0x18, MONSTER_DRAGON_1 = 0x19, + MONSTER_DRAGON_2 = 0x1A, MONSTER_DRAGON_3 = 0x1B, MONSTER_ELEMENTAL_WATER_1 = 0x2E, MONSTER_ELEMENTAL_WATER_3 = 0x30, @@ -18,10 +20,12 @@ MONSTER_GHOST_1 = 0x46, MONSTER_GHOST_3 = 0x48, MONSTER_HARPY_1 = 0x55, + MONSTER_HARPY_2 = 0x56, MONSTER_HARPY_3 = 0x57, MONSTER_LICH_1 = 0x5B, MONSTER_LICH_3 = 0x5D, MONSTER_OOZE_1 = 0x70, + MONSTER_OOZE_2 = 0x71, MONSTER_OOZE_3 = 0x72, MONSTER_PEASANT_ELF_FEMALE_1_1 = 0x85, MONSTER_PEASANT_ELF_MALE_3_3 = 0x96, @@ -36,6 +40,8 @@ MONSTER_ZOMBIE_1 = 0xE5, MONSTER_ZOMBIE_3 = 0xE7, MONSTER_PEASANT_GOBLIN_MALE_3_3 = 0xF9, + MONSTER_TROLL_1 = 0xFA, + MONSTER_TROLL_2 = 0xFB, MONSTER_TROLL_3 = 0xFC, MONSTER_TREANT_1 = 0xFD, MONSTER_TREANT_3 = 0xFF,
--- a/Mouse.cpp Wed Feb 20 20:50:22 2013 +0600 +++ b/Mouse.cpp Wed Feb 20 20:51:55 2013 +0600 @@ -518,17 +518,12 @@ while ( v8 < v1->field_4C ); v6 = v15; } - if ( pParty->pPickedItem.uAttributes & 2 ) - { - pRenderer->_4A6776(a2, v6, v3); - } + if (pParty->pPickedItem.Broken()) + pRenderer->DrawTransparentRedShade(a2, v6, v3); + else if (!pParty->pPickedItem.Identified()) + pRenderer->DrawTransparentGreenShade(a2, v6, v3); else - { - if ( pParty->pPickedItem.uAttributes & 1 ) - pRenderer->DrawTextureTransparent(a2, v6, v3); - else - pRenderer->DrawTransparentGreenShade(a2, v6, v3); - } + pRenderer->DrawTextureTransparent(a2, v6, v3); } } else
--- a/NPC.cpp Wed Feb 20 20:50:22 2013 +0600 +++ b/NPC.cpp Wed Feb 20 20:51:55 2013 +0600 @@ -18,7 +18,7 @@ void InitializeTransitions(); void InitializeAutonotes(); void InitializeQuests(); -bool CheckPortretAgainsSex(int portret_num, int sex); +bool CheckPortretAgainstSex(int portret_num, int sex); //----- (00476977) -------------------------------------------------------- void NPCStats::InitializeNPCText() @@ -518,7 +518,7 @@ } //----- (0047730C) -------------------------------------------------------- -bool CheckPortretAgainsSex(int a1, int) +bool CheckPortretAgainstSex(int a1, int) { return true; } @@ -553,7 +553,7 @@ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 0, 0, 0}; - unsigned __int8 seed = (unsigned __int8)((double)(npc_uid - 1) * 0.33333334); + unsigned __int8 seed = (unsigned __int8)((double)(npc_uid - 1)/3.0); uNPCSex = NPCSexGenTable[seed]; uRace = NPCRaceGenTable[seed]; pNPCDataBuff->uSex = uNPCSex; @@ -617,7 +617,7 @@ } uGeneratedPortret = uPortretMin + rand() % (uPortretMax - uPortretMin + 1); - if ( CheckPortretAgainsSex(uGeneratedPortret, uNPCSex)) + if ( CheckPortretAgainstSex(uGeneratedPortret, uNPCSex)) break_gen = true; ++gen_attempts; if ( gen_attempts >= 4 )
--- a/Outdoor.cpp Wed Feb 20 20:50:22 2013 +0600 +++ b/Outdoor.cpp Wed Feb 20 20:51:55 2013 +0600 @@ -57,10 +57,8 @@ pIndoorCamera->sRotationX = pParty->sRotationX; pIndoorCamera->sRotationY = pParty->sRotationY; - pIndoorCamera->pos.x = pParty->vPosition.x - - ((unsigned __int64)(stru_5C6E00->SinCos(pParty->sRotationY) - * (signed __int64)pParty->y_rotation_granularity) >> 16); - pIndoorCamera->pos.y = pParty->vPosition.y - pParty->y_rotation_granularity * ((stru_5C6E00->SinCos(pParty->sRotationY)) >> 16); + pIndoorCamera->pos.x = pParty->vPosition.x - ((stru_5C6E00->Cos(pParty->sRotationY) * (signed __int64)pParty->y_rotation_granularity) >> 16); + pIndoorCamera->pos.y = pParty->vPosition.y - pParty->y_rotation_granularity * (stru_5C6E00->Sin(pParty->sRotationY) >> 16); pIndoorCamera->pos.z = pParty->vPosition.z + pParty->sEyelevel; if (bRedraw || pRenderer->pRenderD3D) { @@ -470,10 +468,10 @@ { v3 = pParty->uCurrentMinute + 60 * (pParty->uCurrentHour - 5); v4 = (signed int)(v3 * stru_5C6E00->uIntegerPi) / 960; - v5 = stru_5C6E00->SinCos((signed int)(v3 * stru_5C6E00->uIntegerPi) / 960); + v5 = stru_5C6E00->Cos((signed int)(v3 * stru_5C6E00->uIntegerPi) / 960); v2->field_D1C = 0; v2->field_D18 = v5; - v6 = stru_5C6E00->SinCos(v4 - stru_5C6E00->uIntegerHalfPi); + v6 = stru_5C6E00->Sin(v4); v7 = v2->field_D18; v2->field_D20 = v6; v2->vSunlight.x = -v7; @@ -3146,14 +3144,14 @@ bool ODMFace::HasEventHint() { signed int v1; // eax@1 - Event *v2; // esi@2 + EventIndex *v2; // esi@2 bool result; // eax@5 signed int v4; // eax@6 v1 = 0; if ( (signed int)(uLevelEVT_NumEvents - 1) <= 0 ) goto LABEL_5; - v2 = pLevelEVT_Events; + v2 = pLevelEVT_Index; while ( v2->uEventID != this->sCogTriggeredID ) { ++v1; @@ -3162,8 +3160,8 @@ goto LABEL_5; } v4 = v1; - if ( pLevelEVT[pLevelEVT_Events[v4 + 1].uEventOffsetInEVT + 4] != 1 - || pLevelEVT[pLevelEVT_Events[v4].uEventOffsetInEVT + 4] != 4 ) + if ( pLevelEVT[pLevelEVT_Index[v4 + 1].uEventOffsetInEVT + 4] != 1 + || pLevelEVT[pLevelEVT_Index[v4].uEventOffsetInEVT + 4] != 4 ) LABEL_5: result = 0; else
--- a/ParticleEngine.cpp Wed Feb 20 20:50:22 2013 +0600 +++ b/ParticleEngine.cpp Wed Feb 20 20:51:55 2013 +0600 @@ -468,10 +468,10 @@ int uIDb; // [sp+58h] [bp+8h]@9 v2 = this; - v3 = stru_5C6E00->SinCos(pIndoorCamera->sRotationX); - v44 = stru_5C6E00->SinCos(pIndoorCamera->sRotationX - stru_5C6E00->uIntegerHalfPi); - v4 = stru_5C6E00->SinCos(pIndoorCamera->sRotationY); - v5 = stru_5C6E00->SinCos(pIndoorCamera->sRotationY - stru_5C6E00->uIntegerHalfPi); + v3 = stru_5C6E00->Cos(pIndoorCamera->sRotationX); + v44 = stru_5C6E00->Sin(pIndoorCamera->sRotationX); + v4 = stru_5C6E00->Cos(pIndoorCamera->sRotationY); + v5 = stru_5C6E00->Sin(pIndoorCamera->sRotationY); v6 = &v2->pParticles[uID]; if ( v6->uType ) {
--- a/Party.cpp Wed Feb 20 20:50:22 2013 +0600 +++ b/Party.cpp Wed Feb 20 20:51:55 2013 +0600 @@ -280,7 +280,7 @@ signed __int16 v3; // ax@1 //int pResMagicBase; // ecx@1 Player *pCharacter; // esi@3 - signed int uSpellBookPageCount; // edx@5 + //signed int uSpellBookPageCount; // edx@5 int pMagicSkills; // eax@5 int uSkillIdx; // eax@11 //unsigned __int8 v9; // zf@37 @@ -377,9 +377,10 @@ pCharacter = &pParty->pPlayers[uNumPlayers]; if (pCharacter->classType == PLAYER_CLASS_KNIGHT) pCharacter->sResMagicBase = v3; //player[i].pResMagicBase - uSpellBookPageCount = 0; + //uSpellBookPageCount = 0; //pMagicSkills = pPlayers[uNumPlayers].pActiveSkills[12];// Skills //while ( !*(short *)pMagicSkills ) //player[i].skillFire + pCharacter->lastOpenedSpellbookPage = 0; for (int i = 0; i < 9; i++)//for Magic Book { //++uSpellBookPageCount; @@ -387,9 +388,11 @@ //if ( uSpellBookPageCount >= 9 ) //goto LABEL_10; if (pPlayers[uNumPlayers].pActiveSkills[12+i]) - ++uSpellBookPageCount; + { + pCharacter->lastOpenedSpellbookPage = i; + break; + } } - pCharacter->lastOpenedSpellbookPage = uSpellBookPageCount; //LABEL_10: pCharacter->uExpressionTimePassed = 0; Dst.Reset(); @@ -802,7 +805,7 @@ v1 = abs(v0->vPosition.x - pParty->vPosition.x); v2 = abs(v0->vPosition.y - pParty->vPosition.y); v3 = abs(v0->vPosition.z - pParty->vPosition.z); - if ( (double)sub_4621DA(v1, v2, v3) < 512.0 ) + if (int_get_vector_length(v1, v2, v3) < 512) Actor::_402968(v4, 4, 0, 0); } ++v4;
--- a/Player.cpp Wed Feb 20 20:50:22 2013 +0600 +++ b/Player.cpp Wed Feb 20 20:51:55 2013 +0600 @@ -620,7 +620,7 @@ { pSoundId = rand() % _v1 + 2 * (v11 + 50 * uVoiceID) + 4998; v12 = (8 * pPlayerNum + 312) | OBJECT_Player; - pAudioPlayer->PlaySound((SoundID)pSoundId, v12, 0, -1, 0, 0, (pSoundVolumeLevels[uVoicesVolumeMultiplier] * 128.0), 0); + pAudioPlayer->PlaySound((SoundID)pSoundId, v12, 0, -1, 0, 0, pSoundVolumeLevels[uVoicesVolumeMultiplier] * 128.0f, 0); } } } @@ -1859,7 +1859,7 @@ return result; } LABEL_16: - if ( BYTE1(pItem->uAttributes) & 1 ) + if (pItem->Stolen()) return 6; LABEL_26: //v14 = &p2DEvents_minus1__20[13 * a4]; @@ -1872,7 +1872,7 @@ v23 = *v14; v24 = pItem->GetValue(); v17 = v27->_4B8102(v24, v23); - if ( !(pItem->uAttributes & 2) ) + if (!pItem->Broken()) goto LABEL_39; goto LABEL_38; } @@ -1895,7 +1895,7 @@ v18 = *v14; v19 = pItem->GetValue(); v17 = v27->_4B8102(v19, v18) / 2; - if ( pItem->uAttributes & 2 ) + if (pItem->Broken()) v17 = 1; if ( v17 >= 1 ) goto LABEL_39; @@ -2339,7 +2339,7 @@ v20 = thos; v2 = pItem->uItemID; if ( !pItemsTable->pItems[v2].uItemID_Rep_St ) - pItem->uAttributes |= 1u; + pItem->SetIdentified(); ///v15 = 0; //v16 = 1; //v18 = 3; @@ -3509,7 +3509,7 @@ v10 = v5->pMonsterInfo.uLevel + 100 * (_steal_perm + reputation); if ( rand() % 100 < 5 || v10 > v29 + v7 * v30 || (_steal_perma = 2, BYTE2(v5->uAttributes) & 8) ) { - Actor::_43AC45(uActorID, 1); + Actor::AggroSurroundingPeasants(uActorID, 1); _steal_perma = 0; v26 = (int)v31->pName; v25 = pGlobalTXT_LocalizationStrings[376]; @@ -3796,7 +3796,7 @@ v13 = this->pInventoryItems; do { - if ( (signed int)v13->uItemID > 0 && (signed int)v13->uItemID <= 134 && !(v13->uAttributes & 2) ) + if ( (signed int)v13->uItemID > 0 && (signed int)v13->uItemID <= 134 && !v13->Broken()) v46[v4++] = v12; ++v12; ++v13; @@ -4054,6 +4054,7 @@ } return result; } + // 48DCF6: using guessed type char var_94[140]; //----- (0048E1A3) -------------------------------------------------------- @@ -7542,7 +7543,7 @@ goto LABEL_92; } v15 = pParty->pPickedItem.uItemID - 400; - v72 = (char *)&v3->pConditions[0] + pParty->pPickedItem.uItemID + 2; + v72 = (char *)&v3->spellbook.pFireSpellbook+pParty->pPickedItem.uItemID-400;//(char *)&v3->pConditions[0] + pParty->pPickedItem.uItemID + 2; if ( *v72 ) { v66 = pParty->pPickedItem.GetDisplayName(); @@ -8301,7 +8302,7 @@ } if ( var <= VAR_Counter8 ) { - if ( (signed int)var >= 245 ) + if ( (signed int)var >= 0xF5 ) { *(int *)&stru_AA1058[3].pSounds[8 * var + 44300] = LODWORD(pParty->uTimePlayed); *(int *)&stru_AA1058[3].pSounds[8 * var + 44304] = HIDWORD(pParty->uTimePlayed); @@ -8328,7 +8329,7 @@ } if ( var < VAR_Counter9 ) return; - if ( (signed int)var <= 274 ) + if ( (signed int)var <= 0x112 ) { *(int *)&stru_AA1058[3].pSounds[8 * var + 44532] = LODWORD(pParty->uTimePlayed); *(int *)&stru_AA1058[3].pSounds[8 * var + 44536] = HIDWORD(pParty->uTimePlayed); @@ -8764,7 +8765,7 @@ //----- (0044AFFB) -------------------------------------------------------- -void Player::AddVariable(enum VariableType var, signed int val) +void Player::AddVariable(enum VariableType var_type, signed int val) { char v3; // bl@1 Player *v4; // esi@1 @@ -8793,7 +8794,7 @@ DDM_DLV_Header *v27; // eax@153 signed int v28; // eax@176 int v29; // [sp-8h] [bp-40h]@84 - signed int v30; // [sp-4h] [bp-3Ch]@4 + // signed int v30; // [sp-4h] [bp-3Ch]@4 int v31; // [sp-4h] [bp-3Ch]@84 ItemGen item; // [sp+Ch] [bp-2Ch]@45 unsigned int v33; // [sp+30h] [bp-8h]@34 @@ -8805,31 +8806,21 @@ v4 = Dst; uPlayerIdx = 0; if ( Dst == pPlayers[2] ) - { uPlayerIdx = 1; - goto LABEL_8; - } - if ( Dst == pPlayers[3] ) - { - v30 = 2; - } - else - { - if ( Dst != pPlayers[4] ) - goto LABEL_8; - v30 = 3; - } - uPlayerIdx = v30; -LABEL_8: - if ( var <= VAR_AutoNotes ) - { - if ( var != VAR_AutoNotes ) - { - if ( var <= VAR_ActualMight ) - { - if ( var != VAR_ActualMight ) + else if ( Dst == pPlayers[3] ) + uPlayerIdx = 2; + else if ( Dst == pPlayers[4] ) + uPlayerIdx = 3; + + if ( var_type <= VAR_AutoNotes ) + { + if ( var_type != VAR_AutoNotes ) + { + if ( var_type <= VAR_ActualMight ) + { + if ( var_type != VAR_ActualMight ) { - switch ( var ) + switch ( var_type ) { case VAR_RandomGold: if ( !val ) @@ -9002,11 +8993,11 @@ v19 = (__int16 *)&Dst->uMightBonus; goto LABEL_113; } - if ( var <= VAR_FireResistanceBonus ) - { - if ( var != VAR_FireResistanceBonus ) + if ( var_type <= VAR_FireResistanceBonus ) + { + if ( var_type != VAR_FireResistanceBonus ) { - switch ( var ) + switch ( var_type ) { case VAR_ActualIntellect: LABEL_66: @@ -9085,13 +9076,13 @@ pPlayers[uPlayerIdx + 1]->PlaySound((PlayerSpeech)v29, v31); goto _play_anim_and_maybe_sound; } - if ( var <= VAR_DisarmTrapSkill ) - { - if ( var != VAR_DisarmTrapSkill ) + if ( var_type <= VAR_DisarmTrapSkill ) + { + if ( var_type != VAR_DisarmTrapSkill ) { - if ( var <= VAR_BodyResistanceBonus ) + if ( var_type <= VAR_BodyResistanceBonus ) { - switch ( var ) + switch ( var_type ) { case VAR_BodyResistanceBonus: v19 = &Dst->sResBodyBonus; @@ -9109,43 +9100,43 @@ v19 = &Dst->sResSpiritBonus; break; default: - if ( var != 62 ) + if ( var_type != 62 ) return; v19 = &Dst->sResMindBonus; break; } goto LABEL_113; } - if ( var == VAR_LightResistanceBonus ) + if ( var_type == VAR_LightResistanceBonus ) { v19 = &Dst->sResLightBonus; goto LABEL_113; } - if ( var == VAR_DarkResistanceBonus ) + if ( var_type == VAR_DarkResistanceBonus ) { v19 = &Dst->sResDarkBonus; goto LABEL_113; } - if ( var == VAR_MagicResistanceBonus ) + if ( var_type == VAR_MagicResistanceBonus ) { v19 = &Dst->sResMagicBonus; goto LABEL_113; } - if ( var <= VAR_MagicResistanceBonus || var > VAR_DiplomacySkill ) + if ( var_type <= VAR_MagicResistanceBonus || var_type > VAR_DiplomacySkill ) return; } goto LABEL_106; } - if ( var == VAR_LearningSkill ) + if ( var_type == VAR_LearningSkill ) { LABEL_106: if ( val <= VAR_BodyResistanceBonus ) { - *((short *)&Dst->pConditions[16] + var) = (unsigned __int8)val | *((char *)&Dst->pConditions[16] + 2 * var) & VAR_BodyResistanceBonus; + *((short *)&Dst->pConditions[16] + var_type) = (unsigned __int8)val | *((char *)&Dst->pConditions[16] + 2 * var_type) & VAR_BodyResistanceBonus; } else { - v20 = (char *)&Dst->pConditions[16] + 2 * var; + v20 = (char *)&Dst->pConditions[16] + 2 * var_type; v21 = *(short *)v20; v22 = (unsigned __int8)val + (v21 & VAR_BodyResistanceBonus); if ( v22 > 60 ) @@ -9155,22 +9146,22 @@ } goto _play_anim_and_exit; } - if ( var <= VAR_LearningSkill ) + if ( var_type <= VAR_LearningSkill ) return; - if ( var <= VAR_Eradicated ) - { - Dst->SetCondition(var - 105, 0); + if ( var_type <= VAR_Eradicated ) + { + Dst->SetCondition(var_type - 105, 0); } else { - if ( var != VAR_MajorCondition ) + if ( var_type != VAR_MajorCondition ) { - if ( var > VAR_MajorCondition && var <= VAR_ActiveSpells ) + if ( var_type > VAR_MajorCondition && var_type <= VAR_ActiveSpells ) { - if ( (unsigned __int8)val + (unsigned __int8)byte_5E4C15[var] <= 255 ) - byte_5E4C15[var] += val; + if ( (unsigned __int8)val + (unsigned __int8)byte_5E4C15[var_type] <= 255 ) + byte_5E4C15[var_type] += val; else - byte_5E4C15[var] = -1; + byte_5E4C15[var_type] = -1; } return; } @@ -9203,14 +9194,14 @@ goto _maybe_play_sound; goto _play_anim_and_maybe_sound; } - if ( var > VAR_GoldInBank ) - { - if ( var == 307 ) + if ( var_type > VAR_GoldInBank ) + { + if ( var_type == 307 ) { pParty->uNumDeaths += val; goto LABEL_173; } - switch ( var ) + switch ( var_type ) { case 308: pParty->uNumBountiesCollected += val; @@ -9234,21 +9225,21 @@ } else { - if ( var == VAR_GoldInBank ) + if ( var_type == VAR_GoldInBank ) { pParty->uNumGoldInBank += val; return; } - if ( var <= VAR_Counter8 ) - { - if ( (signed int)var >= 245 ) - { - *(int *)&stru_AA1058[3].pSounds[8 * var + 44300] = LODWORD(pParty->uTimePlayed); - *(int *)&stru_AA1058[3].pSounds[8 * var + 44304] = HIDWORD(pParty->uTimePlayed); + if ( var_type <= VAR_Counter8 ) + { + if ( (signed int)var_type >= 245 ) + { + *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44300] = LODWORD(pParty->uTimePlayed); + *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44304] = HIDWORD(pParty->uTimePlayed); } else { - switch ( var ) + switch ( var_type ) { case VAR_MonthEquals|VAR_CurrentSP: _449B7E_toggle_bit((unsigned char *)Dst->field_1A50, val, 1u); @@ -9266,22 +9257,22 @@ } return; } - if ( var < VAR_Counter9 ) + if ( var_type < VAR_Counter9 ) return; - if ( (signed int)var <= 274 ) - { - *(int *)&stru_AA1058[3].pSounds[8 * var + 44532] = LODWORD(pParty->uTimePlayed); - *(int *)&stru_AA1058[3].pSounds[8 * var + 44536] = HIDWORD(pParty->uTimePlayed); + if ( (signed int)var_type <= 274 ) + { + *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44532] = LODWORD(pParty->uTimePlayed); + *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44536] = HIDWORD(pParty->uTimePlayed); goto _play_sound; } - if ( var != VAR_ReputationInCurrentLocation ) - { - if ( var <= VAR_ReputationInCurrentLocation - || var > VAR_History_28 - || (v25 = var - 276, pParty->field_3C.field_4F0[2 * v25 + 1] | pParty->field_3C.field_4F0[2 * v25]) - || (pParty->field_3C.field_4F0[2 * (var - 276)] = LODWORD(pParty->uTimePlayed), + if ( var_type != VAR_ReputationInCurrentLocation ) + { + if ( var_type <= VAR_ReputationInCurrentLocation + || var_type > VAR_History_28 + || (v25 = var_type - 276, pParty->field_3C.field_4F0[2 * v25 + 1] | pParty->field_3C.field_4F0[2 * v25]) + || (pParty->field_3C.field_4F0[2 * (var_type - 276)] = LODWORD(pParty->uTimePlayed), v26 = pStorylineText->StoreLine[v25].pText==0,//*(&pStorylineText->field_0 + 3 * v25) == 0, - pParty->field_3C.field_4F0[2 * (var - 276) + 1] = HIDWORD(pParty->uTimePlayed), + pParty->field_3C.field_4F0[2 * (var_type - 276) + 1] = HIDWORD(pParty->uTimePlayed), v26) ) return; bFlashHistoryBook = 1;
--- a/Render.cpp Wed Feb 20 20:50:22 2013 +0600 +++ b/Render.cpp Wed Feb 20 20:51:55 2013 +0600 @@ -610,10 +610,10 @@ array_77EC08[1999].field_58 = 23 - (-20 * pOutdoor->vSunlight.z >> 16); if ( array_77EC08[1999].field_58 > 20 ) array_77EC08[1999].field_58 = 20; - v10 = stru_5C6E00->SinCos(pIndoorCamera->sRotationX - stru_5C6E00->uIntegerHalfPi); + v10 = stru_5C6E00->Sin(pIndoorCamera->sRotationX); array_77EC08[1999].v_18.y = 0; array_77EC08[1999].v_18.x = v10; - array_77EC08[1999].v_18.z = stru_5C6E00->SinCos(pIndoorCamera->sRotationX); + array_77EC08[1999].v_18.z = stru_5C6E00->Cos(pIndoorCamera->sRotationX); array_77EC08[1999].field_24 = 2048 - (pIndoorCamera->pos.z << 16); a1a = (signed __int64)((double)(pIndoorCamera->pos.z * pOutdoorCamera->int_fov_rad) / ((double)pOutdoorCamera->int_fov_rad + 8192.0) @@ -627,10 +627,10 @@ if ( !(pOutdoor->uSky_TextureID != -1 ? (int)v2 : 0) ) return (signed __int16)v2; array_77EC08[1999].field_58 = 0; - v11 = stru_5C6E00->SinCos(pIndoorCamera->sRotationX + 16 - stru_5C6E00->uIntegerHalfPi); + v11 = stru_5C6E00->Sin(pIndoorCamera->sRotationX + 16); array_77EC08[1999].v_18.y = 0; array_77EC08[1999].v_18.x = -v11; - array_77EC08[1999].v_18.z = -stru_5C6E00->SinCos(pIndoorCamera->sRotationX + 16); + array_77EC08[1999].v_18.z = -stru_5C6E00->Cos(pIndoorCamera->sRotationX + 16); LOWORD(v2) = 224 * LOWORD(pMiscTimer->uTotalGameTimeElapsed); array_77EC08[1999].field_24 = 0x2000000u; array_77EC08[1999].sTextureDeltaU = 224 * pMiscTimer->uTotalGameTimeElapsed; @@ -729,13 +729,6 @@ } return (signed __int16)v2; } -// 6BE030: using guessed type int day_attrib; -// 6BE3C4: using guessed type char bUnderwater; -// 80AA10: using guessed type char byte_80AA10; -// 80AA14: using guessed type int dword_80AA14; -// 80AA18: using guessed type int dword_80AA18; -// 80AA1C: using guessed type int dword_80AA1C; -// 80AA20: using guessed type int dword_80AA20; //----- (00485044) -------------------------------------------------------- int Render::DrawSkySW(Span *a1, stru148 *a2, int a3) @@ -1034,8 +1027,8 @@ v105 = pIndoorCamera->sRotationY / ((signed int)stru_5C6E00->uIntegerHalfPi / 2);//2 pDirectionIndicator1 = stru_5C6E00->uDoublePiMask & (stru_5C6E00->uIntegerDoublePi - pIndoorCamera->sRotationY);//1536 pDirectionIndicator2 = stru_5C6E00->uDoublePiMask & (stru_5C6E00->uIntegerPi + pDirectionIndicator1);//512 - v124 = ((pIndoorCamera->uMapGridCellX << 16) + 3 * stru_5C6E00->SinCos(stru_5C6E00->uDoublePiMask & (stru_5C6E00->uIntegerPi + pDirectionIndicator1))) >> 16; - v123 = ((pIndoorCamera->uMapGridCellZ << 16) + 3 * stru_5C6E00->SinCos(pDirectionIndicator2 - stru_5C6E00->uIntegerHalfPi)) >> 16; + v124 = ((pIndoorCamera->uMapGridCellX << 16) + 3 * stru_5C6E00->Cos(stru_5C6E00->uDoublePiMask & (stru_5C6E00->uIntegerPi + pDirectionIndicator1))) >> 16; + v123 = ((pIndoorCamera->uMapGridCellZ << 16) + 3 * stru_5C6E00->Sin(pDirectionIndicator2)) >> 16; v120 = pOutdoorCamera->outdoor_grid_band_3 + v124;//+- range X v119 = pOutdoorCamera->outdoor_grid_band_3 + v123; v2 = pOutdoorCamera->uCameraFovInDegrees + 15; @@ -1047,10 +1040,10 @@ v3 = (v2 << 11) / 720; v4 = stru_5C6E00->uDoublePiMask & (pDirectionIndicator1 - v3); v5 = stru_5C6E00->uDoublePiMask & (v3 + pDirectionIndicator1); - v106 = stru_5C6E00->SinCos(v4); - uEndZ = stru_5C6E00->SinCos(v4 - stru_5C6E00->uIntegerHalfPi); - v111 = stru_5C6E00->SinCos(v5); - v6 = stru_5C6E00->SinCos(v5 - stru_5C6E00->uIntegerHalfPi); + v106 = stru_5C6E00->Cos(v4); + uEndZ = stru_5C6E00->Sin(v4); + v111 = stru_5C6E00->Cos(v5); + v6 = stru_5C6E00->Sin(v5); v7 = v4 & stru_5C6E00->uPiMask; if ( (v4 & stru_5C6E00->uPiMask) >= stru_5C6E00->uIntegerHalfPi ) @@ -3042,7 +3035,7 @@ billboard.pPalette = pPaletteManager->field_261600[*((short *)v1 - 7)]; if ( !(billboard.uFlags & 0x40) && billboard.uFlags & 0x80 ) { - v12 = stru_5C6E00->SinCos(i * 5 + GetTickCount()); + v12 = stru_5C6E00->Cos(i * 5 + GetTickCount()); v15 = abs(v12); v18 = (unsigned __int64)(15i64 * v15) >> 16; billboard.pPalette2 = PaletteManager::Get_Dark_or_Red_LUT(*((short *)v1 - 7), 15 - v18, 1); @@ -4437,7 +4430,7 @@ { if ( !v54 || byte_4D864C && pGame->uFlags & 2 ) { - ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, D3DTADDRESS_WRAP));// + ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, D3DTADDRESS_WRAP)); ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_CULLMODE, D3DCULL_CW)); if (bUsingSpecular) { @@ -4479,6 +4472,18 @@ } while ( !v18 ); } + + if (a4->uAttributes & FACE_OUTLINED) + { + int color; + if (GetTickCount() % 300 >= 150) + color = 0xFFFF2020; + else color = 0xFF901010; + + for (uint i = 0; i < uNumVertices; ++i) + d3d_vertex_buffer[i].diffuse = color; + } + pRenderD3D->pDevice->SetTexture(0, pTexture); pRenderD3D->pDevice->DrawPrimitive(D3DPT_TRIANGLEFAN, D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1, @@ -8171,10 +8176,10 @@ v15 = v14; v16 = (double)(v9 - 12) - v12; v17 = (double)(v10 - 25) - v14; - v18 = stru_5C6E00->SinCos(angle); - v19 = stru_5C6E00->SinCos(angle - stru_5C6E00->uIntegerHalfPi); - v20 = stru_5C6E00->SinCos(angle - stru_5C6E00->uIntegerHalfPi); - v21 = stru_5C6E00->SinCos(angle); + v18 = stru_5C6E00->Cos(angle); + v19 = stru_5C6E00->Sin(angle); + v20 = stru_5C6E00->Sin(angle); + v21 = stru_5C6E00->Cos(angle); pBillboardRenderListD3D[v8].pQuards[0].pos.x = (((double)(unsigned __int16)v18 * 0.000015259022 + (double)(v18 >> 16)) * v16 @@ -8196,10 +8201,10 @@ pBillboardRenderListD3D[v8].pQuards[0].texcoord.y = 0.0; v31 = (double)(a2->uScreenSpaceX + 12) - v13; v32 = (double)a2->uScreenSpaceY - v15; - v25 = stru_5C6E00->SinCos(angle); - v26 = stru_5C6E00->SinCos(angle - stru_5C6E00->uIntegerHalfPi); - v27 = stru_5C6E00->SinCos(angle - stru_5C6E00->uIntegerHalfPi); - v28 = stru_5C6E00->SinCos(angle); + v25 = stru_5C6E00->Cos(angle); + v26 = stru_5C6E00->Sin(angle); + v27 = stru_5C6E00->Sin(angle); + v28 = stru_5C6E00->Cos(angle); pBillboardRenderListD3D[v8].pQuards[1].pos.x = (((double)(unsigned __int16)v25 * 0.000015259022 + (double)(v25 >> 16)) * v23 @@ -8222,10 +8227,10 @@ pBillboardRenderListD3D[v8].pQuards[1].texcoord.y = 1.0; v23 = (double)(a2->uScreenSpaceX - 12) - v13; v24 = (double)a2->uScreenSpaceY - v15; - v33 = stru_5C6E00->SinCos(angle); - v34 = stru_5C6E00->SinCos(angle - stru_5C6E00->uIntegerHalfPi); - v35 = stru_5C6E00->SinCos(angle - stru_5C6E00->uIntegerHalfPi); - v36 = stru_5C6E00->SinCos(angle); + v33 = stru_5C6E00->Cos(angle); + v34 = stru_5C6E00->Sin(angle); + v35 = stru_5C6E00->Sin(angle); + v36 = stru_5C6E00->Cos(angle); pBillboardRenderListD3D[v8].pQuards[2].pos.x = (((double)(unsigned __int16)v33 * 0.000015259022 + (double)(v33 >> 16)) * v31 @@ -8248,10 +8253,10 @@ pBillboardRenderListD3D[v8].pQuards[2].texcoord.y = 1.0; v39 = (double)(a2->uScreenSpaceX + 12) - v13; v40 = (double)(a2->uScreenSpaceY - 25) - v15; - v41 = stru_5C6E00->SinCos(angle); - v42 = stru_5C6E00->SinCos(angle - stru_5C6E00->uIntegerHalfPi); - v43 = stru_5C6E00->SinCos(angle - stru_5C6E00->uIntegerHalfPi); - v44 = stru_5C6E00->SinCos(angle); + v41 = stru_5C6E00->Cos(angle); + v42 = stru_5C6E00->Sin(angle); + v43 = stru_5C6E00->Sin(angle); + v44 = stru_5C6E00->Cos(angle); pBillboardRenderListD3D[v8].pQuards[3].pos.x = (((double)(unsigned __int16)v41 * 0.000015259022 + (double)(v41 >> 16)) * v39 @@ -8345,11 +8350,11 @@ v15 = v14; v16 = (double)(v9 - 12) - v12; v17 = (double)(v10 - 25) - v14; - v18 = stru_5C6E00->SinCos(angle); + v18 = stru_5C6E00->Cos(angle); v19 = angle - stru_5C6E00->uIntegerHalfPi; - v20 = stru_5C6E00->SinCos(angle - stru_5C6E00->uIntegerHalfPi); - v21 = stru_5C6E00->SinCos(v19); - v22 = stru_5C6E00->SinCos(angle); + v20 = stru_5C6E00->Sin(angle); + v21 = stru_5C6E00->Sin(angle); + v22 = stru_5C6E00->Cos(angle); pBillboardRenderListD3D[v8].pQuards[0].pos.x = (((double)(unsigned __int16)v18 * 0.000015259022 + (double)(v18 >> 16)) * v16 @@ -8373,10 +8378,10 @@ pBillboardRenderListD3D[v8].pQuards[0].texcoord.y = 0.0; v26 = (double)(a2->uScreenSpaceX - 12) - v13; v27 = (double)a2->uScreenSpaceY - v15; - v28 = stru_5C6E00->SinCos(angle); - v29 = stru_5C6E00->SinCos(v19); - v30 = stru_5C6E00->SinCos(v19); - v31 = stru_5C6E00->SinCos(angle); + v28 = stru_5C6E00->Cos(angle); + v29 = stru_5C6E00->Sin(v19 + stru_5C6E00->uIntegerHalfPi); + v30 = stru_5C6E00->Sin(v19 + stru_5C6E00->uIntegerHalfPi); + v31 = stru_5C6E00->Cos(angle); pBillboardRenderListD3D[v8].pQuards[1].pos.x = (((double)(unsigned __int16)v28 * 0.000015259022 + (double)(v28 >> 16)) * v26 @@ -8398,10 +8403,10 @@ pBillboardRenderListD3D[v8].pQuards[1].texcoord.y = 1.0; v33 = (double)(a2->uScreenSpaceX + 12) - v13; v34 = (double)a2->uScreenSpaceY - v15; - v35 = stru_5C6E00->SinCos(angle); - v36 = stru_5C6E00->SinCos(v19); - v37 = stru_5C6E00->SinCos(v19); - v38 = stru_5C6E00->SinCos(angle); + v35 = stru_5C6E00->Cos(angle); + v36 = stru_5C6E00->Sin(v19 + stru_5C6E00->uIntegerHalfPi); + v37 = stru_5C6E00->Sin(v19 + stru_5C6E00->uIntegerHalfPi); + v38 = stru_5C6E00->Cos(angle); pBillboardRenderListD3D[v8].pQuards[2].pos.x = (((double)(unsigned __int16)v35 * 0.000015259022 + (double)(v35 >> 16)) * v33 @@ -8423,10 +8428,10 @@ pBillboardRenderListD3D[v8].pQuards[2].texcoord.y = 1.0; v40 = (double)(a2->uScreenSpaceX + 12) - v13; v41 = (double)(a2->uScreenSpaceY - 25) - v15; - v42 = stru_5C6E00->SinCos(angle); - v43 = stru_5C6E00->SinCos(v19); - v44 = stru_5C6E00->SinCos(v19); - v45 = stru_5C6E00->SinCos(angle); + v42 = stru_5C6E00->Cos(angle); + v43 = stru_5C6E00->Sin(v19 + stru_5C6E00->uIntegerHalfPi); + v44 = stru_5C6E00->Sin(v19 + stru_5C6E00->uIntegerHalfPi); + v45 = stru_5C6E00->Cos(angle); pBillboardRenderListD3D[v8].pQuards[3].pos.x = (((double)(unsigned __int16)v42 * 0.000015259022 + (double)(v42 >> 16)) * v40 @@ -10135,7 +10140,7 @@ //----- (004A6776) -------------------------------------------------------- -void Render::_4A6776(unsigned int a2, unsigned int a3, Texture *a4) +void Render::DrawTransparentRedShade(unsigned int a2, unsigned int a3, Texture *a4) { Texture *v4; // edi@2 unsigned int v5; // ebx@4
--- a/Render.h Wed Feb 20 20:50:22 2013 +0600 +++ b/Render.h Wed Feb 20 20:51:55 2013 +0600 @@ -348,7 +348,7 @@ void DrawTextureTransparent(unsigned int uX, unsigned int uY, Texture *pTexture); void _4A63E6(unsigned int a2, unsigned int a3, Texture *a4, Texture *a5, int a6, int a7, int a8); void _4A65CC(unsigned int x, unsigned int y, Texture *a4, Texture *a5, int a6, int a7, int a8); - void _4A6776(unsigned int a2, unsigned int a3, Texture *a4); + void DrawTransparentRedShade(unsigned int a2, unsigned int a3, Texture *a4); void DrawTransparentGreenShade(signed int a2, signed int a3, Texture *pTexture); void _4A6A68(unsigned int a2, unsigned int a3, Texture *a4, __int16 height); void DrawTextPalette(int x, int y, int a4, int a5, unsigned int uFontHeight, unsigned __int16 *pPalette, int a8);
--- a/SaveLoad.cpp Wed Feb 20 20:50:22 2013 +0600 +++ b/SaveLoad.cpp Wed Feb 20 20:51:55 2013 +0600 @@ -217,8 +217,8 @@ pSavegameThumbnails[i].Release(); pIcons_LOD->_4114F2(); - pAudioPlayer->SetMusicVolume(pSoundVolumeLevels[uMusicVolimeMultiplier] * 64.0); - pAudioPlayer->SetMasterVolume(pSoundVolumeLevels[uSoundVolumeMultiplier] * 128.0); + pAudioPlayer->SetMusicVolume(pSoundVolumeLevels[uMusicVolimeMultiplier] * 64.0f); + pAudioPlayer->SetMasterVolume(pSoundVolumeLevels[uSoundVolumeMultiplier] * 128.0f); if (uTurnSpeed) pParty->sRotationY = uTurnSpeed * pParty->sRotationY / (signed int)uTurnSpeed; MM7Initialization();
--- a/StorylineTextTable.cpp Wed Feb 20 20:50:22 2013 +0600 +++ b/StorylineTextTable.cpp Wed Feb 20 20:51:55 2013 +0600 @@ -50,13 +50,13 @@ switch (decode_step) { case 1: - StoreLine[i+1].pText=RemoveQuotes(test_string); + StoreLine[i].pText=RemoveQuotes(test_string); break; case 2: - StoreLine[i+1].uTime=atoi(test_string); //strange but in text here string not digit + StoreLine[i].uTime=atoi(test_string); //strange but in text here string not digit break; case 3: - StoreLine[i+1].pPageTitle=RemoveQuotes(test_string); + StoreLine[i].pPageTitle=RemoveQuotes(test_string); break; } }
--- a/Texture.cpp Wed Feb 20 20:50:22 2013 +0600 +++ b/Texture.cpp Wed Feb 20 20:51:55 2013 +0600 @@ -132,16 +132,16 @@ int uTextureID_50795C; // weak -unsigned int uTextureID_507970; +unsigned int uTextureID_Btn_GameSettings; -unsigned int uTextureID_507978; -unsigned int uTextureID_50797C; -unsigned int uTextureID_507980; -unsigned int uTextureID_507984; +unsigned int uTextureID_Btn_Rest; +unsigned int uTextureID_Btn_CastSpell; +unsigned int uTextureID_Btn_ZoomIn; +unsigned int uTextureID_Btn_ZoomOut; unsigned int uTextureID_FONTPAL; -unsigned int uTextureID_50798C; -unsigned int uTextureID_507990; +unsigned int uTextureID_Btn_NPCRight; +unsigned int uTextureID_Btn_NPCLeft; unsigned int pTextureIDs_pMapDirs[8];
--- a/Texture.h Wed Feb 20 20:50:22 2013 +0600 +++ b/Texture.h Wed Feb 20 20:51:55 2013 +0600 @@ -234,16 +234,16 @@ extern int uTextureID_50795C; // weak -extern unsigned int uTextureID_507970; +extern unsigned int uTextureID_Btn_GameSettings; -extern unsigned int uTextureID_507978; -extern unsigned int uTextureID_50797C; -extern unsigned int uTextureID_507980; -extern unsigned int uTextureID_507984; +extern unsigned int uTextureID_Btn_Rest; +extern unsigned int uTextureID_Btn_CastSpell; +extern unsigned int uTextureID_Btn_ZoomIn; +extern unsigned int uTextureID_Btn_ZoomOut; extern unsigned int uTextureID_FONTPAL; -extern unsigned int uTextureID_50798C; -extern unsigned int uTextureID_507990; +extern unsigned int uTextureID_Btn_NPCRight; +extern unsigned int uTextureID_Btn_NPCLeft; extern unsigned int pTextureIDs_pMapDirs[8];
--- a/TurnEngine.h Wed Feb 20 20:50:22 2013 +0600 +++ b/TurnEngine.h Wed Feb 20 20:51:55 2013 +0600 @@ -27,8 +27,8 @@ int _4063A1(); int _406457(int a2); void _40652A(); - __int16 _4065B0(); - __int16 _406648(unsigned int a2); + void _4065B0(); + void _406648(unsigned int a2); __int16 _40680F(int a2); void _406A63(); void _406AFE();
--- a/VideoPlayer.cpp Wed Feb 20 20:50:22 2013 +0600 +++ b/VideoPlayer.cpp Wed Feb 20 20:51:55 2013 +0600 @@ -952,8 +952,7 @@ { Prepare(); v3->bLoopPlaying = a3_1; - __debugbreak(); // VideoPlayer is larger than this - if ( v3[1].pVideoFrame.pName[0] == 1 ) + if ( LOBYTE(v3->field_104) == 1 ) { v15 = "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Video.cpp:925"; v12 = "Unsupported Bink playback!";
--- a/VideoPlayer.h Wed Feb 20 20:50:22 2013 +0600 +++ b/VideoPlayer.h Wed Feb 20 20:51:55 2013 +0600 @@ -185,6 +185,7 @@ int dword_0000A0; char pCurrentMovieName[64]; char pVideoFrameTextureFilename[32]; + int field_104; }; #pragma pack(pop)
--- a/Vis.cpp Wed Feb 20 20:50:22 2013 +0600 +++ b/Vis.cpp Wed Feb 20 20:51:55 2013 +0600 @@ -386,21 +386,20 @@ } //----- (004C17CF) -------------------------------------------------------- -void Vis::PickOutdoorFaces_Mouse(float fDepth, RenderVertexSoft *pRay, Vis_SelectionList *list, Vis_SelectionFilter *filter, bool one_sided) +void Vis::PickOutdoorFaces_Mouse(float fDepth, RenderVertexSoft *pRay, Vis_SelectionList *list, Vis_SelectionFilter *filter, bool only_reachable) { if (!pOutdoor) return; for (uint i = 0; i < pOutdoor->uNumBModels; ++i) { - int v24; - if (!IsBModelVisible(i, &v24)) + int reachable; + if (!IsBModelVisible(i, &reachable)) continue; - if (one_sided && !v24) + if (!reachable && only_reachable) continue; auto bmodel = &pOutdoor->pBModels[i]; - for (uint j = 0; j < bmodel->uNumFaces; ++j) { auto face = bmodel->pFaces + j; @@ -414,10 +413,15 @@ { pGame->pIndoorCameraD3D->ViewTransform(&intersection, 1u); int v13 = _48B561_mess_with_scaling_along_z(/*v12, */intersection.vWorldViewPosition.x); - LOWORD(v13) = (8 * (j | (i << 6)) | OBJECT_BModel) + v13; + v13 += (8 * (j | (i << 6)) | OBJECT_BModel); list->AddObject(face, VisObjectType_Face, v13); } + + if (blv_face.uAttributes & 0x80000000) + face->uAttributes |= FACE_OUTLINED; + else + face->uAttributes &= ~FACE_OUTLINED; } } } @@ -575,62 +579,118 @@ //----- (004C1C0C) -------------------------------------------------------- bool Vis::Intersect_Ray_Face(RenderVertexSoft *pRayStart, RenderVertexSoft *pRayEnd, float *pDepth, RenderVertexSoft *a4, BLVFace *a5, unsigned int a6) { - BLVFace *v7; // ebx@1 - bool result; // eax@1 + //BLVFace *v7; // ebx@1 + //bool result; // eax@1 double v9; // st7@3 - __int16 v10; // fps@3 - char v11; // c0@3 - char v12; // c2@3 - char v13; // c3@3 - __int16 v14; // fps@5 - char v15; // c0@5 - char v16; // c2@5 - char v17; // c3@5 + //__int16 v10; // fps@3 + //char v11; // c0@3 + //char v12; // c2@3 + //char v13; // c3@3 + //__int16 v14; // fps@5 + //char v15; // c0@5 + //char v16; // c2@5 + //char v17; // c3@5 double v18; // st5@6 - __int16 v19; // fps@6 - char v20; // c0@6 - char v21; // c2@6 - char v22; // c3@6 - unsigned __int8 v23; // c0@6 - char v24; // c2@6 - unsigned __int8 v25; // c3@6 - char v26; // zf@6 + //__int16 v19; // fps@6 + //char v20; // c0@6 + //char v21; // c2@6 + //char v22; // c3@6 + //unsigned __int8 v23; // c0@6 + //char v24; // c2@6 + //unsigned __int8 v25; // c3@6 + //char v26; // zf@6 double v27; // st6@10 - __int16 v28; // fps@10 - unsigned __int8 v29; // c0@10 - char v30; // c2@10 - unsigned __int8 v31; // c3@10 - double v32; // st7@11 + //__int16 v28; // fps@10 + //unsigned __int8 v29; // c0@10 + //char v30; // c2@10 + //unsigned __int8 v31; // c3@10 + //double v32; // st7@11 Vec2_short_ v33; // ST1E_4@11 Vec3_short_ v34; // ST04_6@11 - float a5a; // [sp+30h] [bp+18h]@10 - float a5b; // [sp+30h] [bp+18h]@13 + //float a5a; // [sp+30h] [bp+18h]@10 + //float a5b; // [sp+30h] [bp+18h]@13 + + if (a5->TwoSided() || a5->Invisible()) + return false; + + + int ray_dir_x = pRayEnd->vWorldPosition.x - pRayStart->vWorldPosition.x, + ray_dir_y = pRayEnd->vWorldPosition.y - pRayStart->vWorldPosition.y, + ray_dir_z = pRayEnd->vWorldPosition.z - pRayStart->vWorldPosition.z; + + v9 = ray_dir_z * a5->pFacePlane.vNormal.z + + ray_dir_y * a5->pFacePlane.vNormal.y + + ray_dir_x * a5->pFacePlane.vNormal.x; + if (v9 >= 0) // ray faces face's normal ( > 0) or parallel ( == 0) + return false; + +//ray = t dir + start +//plane = (p - vertex) normal = -d +// +// +//(t dir + start - vertex) normal = -d +// +// -d - (start - vertex) norm +//t = -------------------- +// dir norm + + + float dir_mag = sqrtf(ray_dir_x * ray_dir_x + ray_dir_y * ray_dir_y + ray_dir_z * ray_dir_z); + float ndir_x = ray_dir_x / dir_mag, + ndir_y = ray_dir_y / dir_mag, + ndir_z = ray_dir_z / dir_mag; + + int face_center_x = (a5->pBounding.x1 + a5->pBounding.x2) / 2, + face_center_y = (a5->pBounding.y1 + a5->pBounding.y2) / 2, + face_center_z = (a5->pBounding.z1 + a5->pBounding.z2) / 2; - v7 = a5; - result = a5->uAttributes; - if ( result & 1 - || BYTE1(result) & 0x20 - || (v9 = pRayEnd->vWorldPosition.z * a5->pFacePlane.vNormal.z - + a5->pFacePlane.vNormal.y * pRayEnd->vWorldPosition.y - + pRayEnd->vWorldPosition.x * a5->pFacePlane.vNormal.x, - //UNDEF(v10), - v11 = v9 < 0.0, - v12 = 0, - v13 = v9 == 0.0, - BYTE1(result) = HIBYTE(v10), - v9 == 0.0) - || (/*UNDEF(v14),*/ v15 = v9 < 0.0, v16 = 0, v17 = v9 == 0.0, BYTE1(result) = HIBYTE(v14), v9 > 0.0) )// ray's away (>) from face surface or parallel (==) - goto LABEL_12; - v18 = -(a5->pFacePlane.vNormal.y * pRayStart->vWorldPosition.y// ray-plane intersection + int to_plane_x = pRayStart->vWorldPosition.x - face_center_x, + to_plane_y = pRayStart->vWorldPosition.y - face_center_y, + to_plane_z = pRayStart->vWorldPosition.z - face_center_z; + + float t = /*-a5->pFacePlane.dist*/ - (to_plane_x * a5->pFacePlane.vNormal.x + to_plane_y * a5->pFacePlane.vNormal.y + to_plane_y * a5->pFacePlane.vNormal.z) / + (ndir_x * a5->pFacePlane.vNormal.x + ndir_y * a5->pFacePlane.vNormal.y + ndir_z * a5->pFacePlane.vNormal.z); + if (t <= *pDepth) + { + int intersection_x = pRayStart->vWorldPosition.x + ndir_x * t, + intersection_y = pRayStart->vWorldPosition.y + ndir_y * t, + intersection_z = pRayStart->vWorldPosition.z + ndir_z * t; + + if (intersection_x < a5->pBounding.x1 || intersection_x > a5->pBounding.x2 || + intersection_y < a5->pBounding.y1 || intersection_y > a5->pBounding.y2 || + intersection_z < a5->pBounding.z1 || intersection_z > a5->pBounding.z2) + return false; + + a5->uAttributes |= 0x80000000; + return true; + } + + + return false; + +// v7 = a5; + //result = a5->uAttributes; + v9 = pRayEnd->vWorldPosition.z * a5->pFacePlane.vNormal.z + + pRayEnd->vWorldPosition.y * a5->pFacePlane.vNormal.y + + pRayEnd->vWorldPosition.x * a5->pFacePlane.vNormal.x; + if (v9 >= 0) // ray faces face's normal ( > 0) or parallel ( == 0) + return false; + + a5->uAttributes |= 0x80000000; + return false; + + v18 = -(a5->pFacePlane.vNormal.y * pRayStart->vWorldPosition.y + pRayStart->vWorldPosition.x * a5->pFacePlane.vNormal.x + pRayStart->vWorldPosition.z * a5->pFacePlane.vNormal.z + a5->pFacePlane.dist); + if (v18 > 0) + return false; //UNDEF(v19); - v20 = v9 < 0.0; - v21 = 0; - v22 = v9 == 0.0; - BYTE1(result) = HIBYTE(v19); - v23 = v18 < 0.0; + //v20 = v9 < 0.0; + //v21 = 0; + //v22 = v9 == 0.0; + //BYTE1(result) = HIBYTE(v19); + /*v23 = v18 < 0.0; v24 = 0; v25 = v18 == 0.0; v26 = (BYTE1(result) & 0x41) == 0; @@ -648,32 +708,37 @@ LOBYTE(result) = 0; return result; } - } - a5a = v18; - v27 = a5a / v9; - HIWORD(result) = HIWORD(pDepth); + }*/ + + //a5a = v18; + v27 = v18 / v9; + //HIWORD(result) = HIWORD(pDepth); //UNDEF(v28); - v29 = v27 < *pDepth; - v30 = 0; - v31 = v27 == *pDepth; - BYTE1(result) = HIBYTE(v28); - if ( !(v29 | v31) - || (a4->vWorldPosition.x = v27 * pRayEnd->vWorldPosition.x + pRayStart->vWorldPosition.x, - a4->vWorldPosition.y = v27 * pRayEnd->vWorldPosition.y + pRayStart->vWorldPosition.y, - v32 = v27 * pRayEnd->vWorldPosition.z + pRayStart->vWorldPosition.z, - a4->vWorldPosition.z = v32, - v33.x = (signed __int64)a4->vWorldPosition.x, - v33.y = (signed __int64)a4->vWorldPosition.y, - *(int *)&v34.x = v33.x, - v34.z = (signed __int64)v32, - result = _4C1D2B(v7, v34, a6), - *(float *)&result == 0.0) ) - goto LABEL_12; - *(float *)&result = v27; - a5b = v27; - *(int *)pDepth = LODWORD(a5b); - LOBYTE(result) = 1; - return result; + //v29 = v27 < *pDepth; + //v30 = 0; + //v31 = v27 == *pDepth; + //BYTE1(result) = HIBYTE(v28); + + if (v27 > *pDepth) + return false; + + a5->uAttributes |= 0x80000000; + + a4->vWorldPosition.x = v27 * pRayEnd->vWorldPosition.x + pRayStart->vWorldPosition.x; + a4->vWorldPosition.y = v27 * pRayEnd->vWorldPosition.y + pRayStart->vWorldPosition.y; + a4->vWorldPosition.z = v27 * pRayEnd->vWorldPosition.z + pRayStart->vWorldPosition.z; + v33.x = (signed __int64)a4->vWorldPosition.x; + v33.y = (signed __int64)a4->vWorldPosition.y; + v34.x = v33.x; + v34.y = 0; + v34.z = (signed __int64)a4->vWorldPosition.z; + + if ( _4C1D2B(a5, v34, a6) == 0.0) + return false; + + //a5b = v27; + *pDepth = v27; + return true; } //----- (004C1D2B) -------------------------------------------------------- @@ -694,63 +759,54 @@ signed int v16; // [sp+18h] [bp-4h]@10 v4 = pFace; - if ( a2.z < pFace->pBounding.z1 - || a2.z > pFace->pBounding.z2 - || a2.x < pFace->pBounding.x1 - || a2.x > pFace->pBounding.x2 - || a2.y < pFace->pBounding.y1 - || a2.y > pFace->pBounding.y2 - || (uModelID != -1 ? _4C2186_BLV_IntersectBModel( - (int *)&pFace, - (int *)&uModelID, - &word_F8BC48_displaced_face_intersect_plane_coords_a, - &word_F8BD18_displaced_face_intersect_plane_coords_b, - &a2, - pFace, - uModelID) : _4C1EE5_BLV_IntersectBModel_2( - (int *)&pFace, - (int *)&uModelID, - &word_F8BC48_displaced_face_intersect_plane_coords_a, - &word_F8BD18_displaced_face_intersect_plane_coords_b, - &a2, - pFace), - v5 = 2 * v4->uNumVertices, - v16 = 0, - *(&word_F8BC48_displaced_face_intersect_plane_coords_a + v5) = word_F8BC48_displaced_face_intersect_plane_coords_a, - *(&word_F8BD18_displaced_face_intersect_plane_coords_b + v5) = word_F8BD18_displaced_face_intersect_plane_coords_b, - v15 = 0, - v6 = word_F8BD18_displaced_face_intersect_plane_coords_b >= (signed int)uModelID, - v5 <= 0) ) - goto LABEL_25; + if (a2.z < pFace->pBounding.z1 || a2.z > pFace->pBounding.z2 || + a2.x < pFace->pBounding.x1 || a2.x > pFace->pBounding.x2 || + a2.y < pFace->pBounding.y1 || a2.y > pFace->pBounding.y2) + return false; + + if (uModelID != -1) + _4C2186_BLV_IntersectBModel((int *)&pFace, (int *)&uModelID, + word_F8BC48_displaced_face_intersect_plane_coords_a, + word_F8BD18_displaced_face_intersect_plane_coords_b, + &a2, pFace, uModelID); + else + _4C1EE5_BLV_IntersectBModel_2((int *)&pFace, (int *)&uModelID, + word_F8BC48_displaced_face_intersect_plane_coords_a, + word_F8BD18_displaced_face_intersect_plane_coords_b, + &a2, pFace); + + v5 = 2 * v4->uNumVertices; + v16 = 0; + word_F8BC48_displaced_face_intersect_plane_coords_a[v5] = word_F8BC48_displaced_face_intersect_plane_coords_a[0]; + word_F8BD18_displaced_face_intersect_plane_coords_b[v5] = word_F8BD18_displaced_face_intersect_plane_coords_b[0]; + v15 = 0; + v6 = word_F8BD18_displaced_face_intersect_plane_coords_b[0] >= (signed int)uModelID; + if (v5 <= 0) + return false; + do { if ( v16 >= 2 ) break; v7 = 2 * v15; - v8 = *(&word_F8BD18_displaced_face_intersect_plane_coords_b + v15 + 1); + v8 = word_F8BD18_displaced_face_intersect_plane_coords_b[ + v15 + 1]; if ( v6 ^ v8 >= (signed int)uModelID ) { - v9 = *(__int16 *)((char *)&word_F8BC48_displaced_face_intersect_plane_coords_a + v7 + 2); + v9 = word_F8BC48_displaced_face_intersect_plane_coords_a[v7/2 + 1]; if ( v9 >= (signed int)pFace ) v10 = 0; else v10 = 2; - v11 = v10 | *(__int16 *)((char *)&word_F8BC48_displaced_face_intersect_plane_coords_a + v7) < (signed int)pFace; + v11 = v10 | word_F8BC48_displaced_face_intersect_plane_coords_a[v7/2] < (signed int)pFace; if ( v11 != 3 ) { if ( !v11 - || (v12 = v9 - *(__int16 *)((char *)&word_F8BC48_displaced_face_intersect_plane_coords_a + v7), + || (v12 = v9 - word_F8BC48_displaced_face_intersect_plane_coords_a[v7/2], LODWORD(v13) = v12 << 16, HIDWORD(v13) = v12 >> 16, - *(__int16 *)((char *)&word_F8BC48_displaced_face_intersect_plane_coords_a + v7) - + ((signed int)(((unsigned __int64)(v13 - / (v8 - - *(__int16 *)((char *)&word_F8BD18_displaced_face_intersect_plane_coords_b - + v7)) - * (signed int)((uModelID - - *(__int16 *)((char *)&word_F8BD18_displaced_face_intersect_plane_coords_b - + v7)) << 16)) >> 16) - + 32768) >> 16) >= (signed int)pFace) ) + word_F8BC48_displaced_face_intersect_plane_coords_a[v7/2] + + ((signed int)(((unsigned __int64)(v13 / (v8 - word_F8BD18_displaced_face_intersect_plane_coords_b[v7/2]) + * (signed int)((uModelID - word_F8BD18_displaced_face_intersect_plane_coords_b[v7/2]) << 16)) >> 16) + 32768) >> 16) >= (signed int)pFace) ) ++v16; } } @@ -1484,7 +1540,7 @@ PickOutdoorFaces_Mouse(fDepth, pMouseRay, &default_list, face_filter, false); else { - Log::Warning(L"Picking mouse in undefined level"); // picking in main menu is default (buggy) game behavious. should've returned false in Game::PickMouse + Log::Warning(L"Picking mouse in undefined level"); // picking in main menu is default (buggy) game behaviour. should've returned false in Game::PickMouse return false; } default_list.create_object_pointers(Vis_SelectionList::All);
--- a/Vis.h Wed Feb 20 20:50:22 2013 +0600 +++ b/Vis.h Wed Feb 20 20:51:55 2013 +0600 @@ -96,7 +96,7 @@ bool PickMouse(float fDepth, float fMouseX, float fMouseY, Vis_SelectionFilter *sprite_filter, Vis_SelectionFilter *face_filter); void PickBillboards_Mouse(float fPickDepth, float fX, float fY, Vis_SelectionList *list, Vis_SelectionFilter *filter); void PickIndoorFaces_Mouse(float fDepth, struct RenderVertexSoft *pRay, Vis_SelectionList *list, Vis_SelectionFilter *filter); - void PickOutdoorFaces_Mouse(float fDepth, struct RenderVertexSoft *pRay, Vis_SelectionList *list, Vis_SelectionFilter *filter, bool one_sided); + void PickOutdoorFaces_Mouse(float fDepth, struct RenderVertexSoft *pRay, Vis_SelectionList *list, Vis_SelectionFilter *filter, bool only_reachable); bool is_part_of_selection(void *uD3DBillboardIdx_or_pBLVFace_or_pODMFace, Vis_SelectionFilter *filter); bool DoesRayIntersectBillboard(float fDepth, unsigned int uD3DBillboardIdx);
--- a/mm7_1.cpp Wed Feb 20 20:50:22 2013 +0600 +++ b/mm7_1.cpp Wed Feb 20 20:51:55 2013 +0600 @@ -881,11 +881,10 @@ v17 = uCellX + ((v15 - v10) >> 1) + pSRZBufferLineOffsets[uCellY + ((((v14 - 14) & 0xFFFFFFE0) - v9 + 32) >> 1)]; if ( !(v16 & 0xF0) ) { - if ( v16 & 1 - || pCurrentScreen != SCREEN_HOUSE ) + if (pItem->Identified() || pCurrentScreen != SCREEN_HOUSE ) { - if ( v16 & 2 ) - pRenderer->_4A6776(uCellX, uCellY, v7); + if (pItem->Broken()) + pRenderer->DrawTransparentRedShade(uCellX, uCellY, v7); else pRenderer->DrawTextureTransparent(uCellX, uCellY, v7); } @@ -1625,23 +1624,23 @@ //----- (0041B690) -------------------------------------------------------- void __cdecl MainMenuUI_Create() { - unsigned int v0; // eax@1 - unsigned int v1; // eax@1 - unsigned int v2; // eax@1 - unsigned int v3; // eax@1 - unsigned int v4; // eax@1 - unsigned int v5; // eax@1 + //unsigned int v0; // eax@1 + //unsigned int v1; // eax@1 + //unsigned int v2; // eax@1 + //unsigned int v3; // eax@1 + //unsigned int v4; // eax@1 + //unsigned int v5; // eax@1 Texture *v6; // ST78_4@1 - const char *v7; // ST5C_4@1 + //const char *v7; // ST5C_4@1 unsigned __int8 v8; // al@1 //Texture *v9; // ST60_4@1 Texture *v10; // ST78_4@1 - const char *v11; // ST5C_4@1 + //const char *v11; // ST5C_4@1 unsigned __int8 v12; // al@1 //Texture *v13; // ST60_4@1 unsigned int v14; // eax@1 Texture *v15; // ST78_4@1 - const char *v16; // ST5C_4@1 + //const char *v16; // ST5C_4@1 unsigned __int8 v17; // al@1 //Texture *v18; // ST60_4@1 unsigned int uTextureID_ib_td4_A; // eax@1 @@ -1649,28 +1648,23 @@ unsigned __int8 v22; // al@1 //Texture *v23; // ST60_4@1 Texture *v24; // eax@1 - Texture *v25; // esi@1 - Texture *v26; // ST60_4@1 - const char *v27; // ST5C_4@1 + //Texture *v25; // esi@1 + //Texture *v26; // ST60_4@1 + //const char *v27; // ST5C_4@1 unsigned __int8 v28; // al@1 Texture *v29; // eax@1 - Texture *v30; // esi@1 - Texture *v31; // ST60_4@1 - const char *v32; // ST5C_4@1 + //Texture *v30; // esi@1 + //Texture *v31; // ST60_4@1 + //const char *v32; // ST5C_4@1 unsigned __int8 v33; // al@1 - v0 = pIconsFrameTable->FindIcon("wizeyeC"); - pIconsFrameTable->InitializeAnimation(v0); - v1 = pIconsFrameTable->FindIcon("wizeyeB"); - pIconsFrameTable->InitializeAnimation(v1); - v2 = pIconsFrameTable->FindIcon("wizeyeA"); - pIconsFrameTable->InitializeAnimation(v2); - v3 = pIconsFrameTable->FindIcon("torchC"); - pIconsFrameTable->InitializeAnimation(v3); - v4 = pIconsFrameTable->FindIcon("torchB"); - pIconsFrameTable->InitializeAnimation(v4); - v5 = pIconsFrameTable->FindIcon("torchA"); - pIconsFrameTable->InitializeAnimation(v5); + pIconsFrameTable->InitializeAnimation(pIconsFrameTable->FindIcon("wizeyeC")); + pIconsFrameTable->InitializeAnimation(pIconsFrameTable->FindIcon("wizeyeB")); + pIconsFrameTable->InitializeAnimation(pIconsFrameTable->FindIcon("wizeyeA")); + pIconsFrameTable->InitializeAnimation(pIconsFrameTable->FindIcon("torchC")); + pIconsFrameTable->InitializeAnimation(pIconsFrameTable->FindIcon("torchB")); + pIconsFrameTable->InitializeAnimation(pIconsFrameTable->FindIcon("torchA")); + pTextureIDs_pMapDirs[0] = pIcons_LOD->LoadTexture("MAPDIR8", TEXTURE_16BIT_PALETTE); pTextureIDs_pMapDirs[1] = pIcons_LOD->LoadTexture("MAPDIR1", TEXTURE_16BIT_PALETTE); pTextureIDs_pMapDirs[2] = pIcons_LOD->LoadTexture("MAPDIR2", TEXTURE_16BIT_PALETTE); @@ -1679,6 +1673,7 @@ pTextureIDs_pMapDirs[5] = pIcons_LOD->LoadTexture("MAPDIR5", TEXTURE_16BIT_PALETTE); pTextureIDs_pMapDirs[6] = pIcons_LOD->LoadTexture("MAPDIR6", TEXTURE_16BIT_PALETTE); pTextureIDs_pMapDirs[7] = pIcons_LOD->LoadTexture("MAPDIR7", TEXTURE_16BIT_PALETTE); + uTextureID_BarBlue = pIcons_LOD->LoadTexture("ib-statB", TEXTURE_16BIT_PALETTE); uTextureID_BarGreen = pIcons_LOD->LoadTexture("ib-statG", TEXTURE_16BIT_PALETTE); uTextureID_BarYellow = pIcons_LOD->LoadTexture("ib-statY", TEXTURE_16BIT_PALETTE); @@ -1712,154 +1707,142 @@ pPrimaryWindow->CreateButton(0xD4u, 0x194u, 5u, 0x31u, 1, 93, 0, 2u, 0, "", 0); pPrimaryWindow->CreateButton(0x148u, 0x194u, 5u, 0x31u, 1, 93, 0, 3u, 0, "", 0); pPrimaryWindow->CreateButton(0x1BBu, 0x194u, 5u, 0x31u, 1, 93, 0, 4u, 0, "", 0); + uTextureID_ib_td1_A = pIcons_LOD->LoadTexture("ib-td1-A", TEXTURE_16BIT_PALETTE); v6 = (Texture *)(uTextureID_ib_td1_A != -1 ? &pIcons_LOD->pTextures[uTextureID_ib_td1_A] : 0); - v7 = pGlobalTXT_LocalizationStrings[174];//Quests v8 = pKeyActionMap->GetActionVKey(INPUT_Quest); - pBtn_Quests = pPrimaryWindow->CreateButton(0x1EBu, 0x161u, v6->uTextureWidth, v6->uTextureHeight, 1, 0, 0xC8u, 0, v8, v7, v6, 0); + pBtn_Quests = pPrimaryWindow->CreateButton(0x1EBu, 0x161u, v6->uTextureWidth, v6->uTextureHeight, 1, 0, 0xC8u, 0, v8, pGlobalTXT_LocalizationStrings[174], v6, 0); //Quests + uTextureID_ib_td2_A = pIcons_LOD->LoadTexture("ib-td2-A", TEXTURE_16BIT_PALETTE); v10 = (Texture *)(uTextureID_ib_td2_A != -1 ? &pIcons_LOD->pTextures[uTextureID_ib_td2_A] : 0); - v11 = pGlobalTXT_LocalizationStrings[154];//Autonotes v12 = pKeyActionMap->GetActionVKey(INPUT_Autonotes); - pBtn_Autonotes = pPrimaryWindow->CreateButton(0x20Fu, 0x161u, v10->uTextureWidth, v10->uTextureHeight, 1, 0, 0xC9u, 0, v12, v11, v10, 0); + pBtn_Autonotes = pPrimaryWindow->CreateButton(0x20Fu, 0x161u, v10->uTextureWidth, v10->uTextureHeight, 1, 0, 0xC9u, 0, v12, pGlobalTXT_LocalizationStrings[154], v10, 0);//Autonotes + v14 = pIcons_LOD->LoadTexture("ib-td3-A", TEXTURE_16BIT_PALETTE); - v15 = (Texture *)(v14 != -1 ? (int)&pIcons_LOD->pTextures[v14] : 0); - v16 = pGlobalTXT_LocalizationStrings[139];//Maps + v15 = (Texture *)(v14 != -1 ? &pIcons_LOD->pTextures[v14] : 0); v17 = pKeyActionMap->GetActionVKey(INPUT_Mapbook); - pBtn_Maps = pPrimaryWindow->CreateButton(0x222u, 0x161u, v15->uTextureWidth, v15->uTextureHeight, 1, 0, 0xCAu, 0, v17, v16, v15, 0); + pBtn_Maps = pPrimaryWindow->CreateButton(0x222u, 0x161u, v15->uTextureWidth, v15->uTextureHeight, 1, 0, 0xCAu, 0, v17, pGlobalTXT_LocalizationStrings[139], v15, 0); //Maps + uTextureID_ib_td4_A = pIcons_LOD->LoadTexture("ib-td4-A", TEXTURE_16BIT_PALETTE); - v20 = (Texture *)(uTextureID_ib_td4_A != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_ib_td4_A] : 0); + v20 = (Texture *)(uTextureID_ib_td4_A != -1 ? &pIcons_LOD->pTextures[uTextureID_ib_td4_A] : 0); v22 = pKeyActionMap->GetActionVKey(INPUT_TimeCal); pBtn_Calendar = pPrimaryWindow->CreateButton(0x23Au, 0x161u, v20->uTextureWidth, v20->uTextureHeight, 1, 0, 0xCBu, 0, v22, pGlobalTXT_LocalizationStrings[78],//Calendar v20, 0); + uTextureID_ib_td5_A = pIcons_LOD->LoadTexture("ib-td5-A", TEXTURE_16BIT_PALETTE); pBtn_History = pPrimaryWindow->CreateButton(0x258u, 0x169u, (uTextureID_ib_td5_A != -1 ? pIcons_LOD->pTextures[uTextureID_ib_td5_A].uTextureWidth : 24), (uTextureID_ib_td5_A != -1 ? pIcons_LOD->pTextures[uTextureID_ib_td5_A].uTextureHeight : 26), 1, 0, 0xE0u, 0, 0x48u, pGlobalTXT_LocalizationStrings[602],//History (Texture *)(uTextureID_ib_td5_A != -1 ? &pIcons_LOD->pTextures[uTextureID_ib_td5_A] : 0), 0); - v24 = &pIcons_LOD->pTextures[uTextureID_507980]; - v25 = (Texture *)(uTextureID_507980 != -1 ? (int)v24 : 0); - bFlashHistoryBook = 0; - v26 = (Texture *)(uTextureID_507980 != -1 ? (int)v24 : 0); + bFlashAutonotesBook = 0; - v27 = pGlobalTXT_LocalizationStrings[252]; bFlashQuestBook = 0; + bFlashHistoryBook = 0; + + v24 = &pIcons_LOD->pTextures[uTextureID_Btn_ZoomIn]; v28 = pKeyActionMap->GetActionVKey(INPUT_ZoomIn); - dword_507A18 = pPrimaryWindow->CreateButton( + pBtn_ZoomIn = pPrimaryWindow->CreateButton( 0x23Eu, 0x88u, - v25->uTextureWidth, - v25->uTextureHeight, + v24->uTextureWidth, + v24->uTextureHeight, 2, 0, 0x170u, 0, v28, - v27, - v26, + pGlobalTXT_LocalizationStrings[252], // Zoom In + v24, 0); - v29 = &pIcons_LOD->pTextures[uTextureID_507984]; - v30 = (Texture *)(uTextureID_507984 != -1 ? (int)v29 : 0); - v31 = (Texture *)(uTextureID_507984 != -1 ? (int)v29 : 0); - v32 = pGlobalTXT_LocalizationStrings[251]; + + v29 = &pIcons_LOD->pTextures[uTextureID_Btn_ZoomOut]; v33 = pKeyActionMap->GetActionVKey(INPUT_ZoomOut); - dword_507A14 = pPrimaryWindow->CreateButton( + pBtn_ZoomOut = pPrimaryWindow->CreateButton( 0x207u, 0x88u, - v30->uTextureWidth, - v30->uTextureHeight, + v29->uTextureWidth, + v29->uTextureHeight, 2, 0, 0x16Fu, 0, v33, - v32, - v31, + pGlobalTXT_LocalizationStrings[251], // Zoom Out + v29, 0); + pPrimaryWindow->CreateButton(0x1E1u, 0, 0x99u, 0x43u, 1, 92, 0, 0, 0, "", 0); pPrimaryWindow->CreateButton(0x1EBu, 0x95u, 0x40u, 0x4Au, 1, 0, 0x86u, 0, 0x35u, "", 0); pPrimaryWindow->CreateButton(0x231u, 0x95u, 0x40u, 0x4Au, 1, 0, 0x87u, 0, 0x36u, "", 0); pPrimaryWindow->CreateButton(0x1DCu, 0x142u, 0x4Du, 0x11u, 1, 100, 0, 0, 0, "", 0); pPrimaryWindow->CreateButton(0x22Bu, 0x142u, 0x4Du, 0x11u, 1, 101, 0, 0, 0, "", 0); - pBtn_CastSpell = pPrimaryWindow->CreateButton( - 0x1DCu, - 0x1C2u, - (uTextureID_50797C != -1 ? pIcons_LOD->pTextures[uTextureID_50797C].uTextureWidth : 24), - (uTextureID_50797C != -1 ? pIcons_LOD->pTextures[uTextureID_50797C].uTextureHeight : 26), + pBtn_CastSpell = pPrimaryWindow->CreateButton(0x1DCu, 0x1C2u, + (uTextureID_Btn_CastSpell != -1 ? pIcons_LOD->pTextures[uTextureID_Btn_CastSpell].uTextureWidth : 24), + (uTextureID_Btn_CastSpell != -1 ? pIcons_LOD->pTextures[uTextureID_Btn_CastSpell].uTextureHeight : 26), 1, 0, 0x69u, 0, 0x43u, pGlobalTXT_LocalizationStrings[38], - (Texture *)(uTextureID_50797C != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_50797C] : 0), + (Texture *)(uTextureID_Btn_CastSpell != -1 ? &pIcons_LOD->pTextures[uTextureID_Btn_CastSpell] : 0), 0); - pBtn_Rest = pPrimaryWindow->CreateButton( - 0x206u, - 0x1C2u, - (uTextureID_507978 != -1 ? pIcons_LOD->pTextures[uTextureID_507978].uTextureWidth : 24), - (uTextureID_507978 != -1 ? pIcons_LOD->pTextures[uTextureID_507978].uTextureHeight : 26), + pBtn_Rest = pPrimaryWindow->CreateButton(0x206u, 0x1C2u, + (uTextureID_Btn_Rest != -1 ? pIcons_LOD->pTextures[uTextureID_Btn_Rest].uTextureWidth : 24), + (uTextureID_Btn_Rest != -1 ? pIcons_LOD->pTextures[uTextureID_Btn_Rest].uTextureHeight : 26), 1, 0, 0x68u, 0, 0x52u, pGlobalTXT_LocalizationStrings[182], - (Texture *)(uTextureID_507978 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_507978] : 0), + (Texture *)(uTextureID_Btn_Rest != -1 ? &pIcons_LOD->pTextures[uTextureID_Btn_Rest] : 0), 0); - pBtn_QuickReference = pPrimaryWindow->CreateButton( - 0x230u, - 0x1C2u, - (dword_507974 != -1 ? pIcons_LOD->pTextures[dword_507974].uTextureWidth : 24), - (dword_507974 != -1 ? pIcons_LOD->pTextures[dword_507974].uTextureHeight : 26), + pBtn_QuickReference = pPrimaryWindow->CreateButton(0x230u, 0x1C2u, + (uTextureID_Btn_QuickReference != -1 ? pIcons_LOD->pTextures[uTextureID_Btn_QuickReference].uTextureWidth : 24), + (uTextureID_Btn_QuickReference != -1 ? pIcons_LOD->pTextures[uTextureID_Btn_QuickReference].uTextureHeight : 26), 1, 0, 0x6Au, 0, 0x5Au, pGlobalTXT_LocalizationStrings[173], - (Texture *)(dword_507974 != -1 ? &pIcons_LOD->pTextures[dword_507974] : 0), + (Texture *)(uTextureID_Btn_QuickReference != -1 ? &pIcons_LOD->pTextures[uTextureID_Btn_QuickReference] : 0), 0); - pBtn_GameSettings = pPrimaryWindow->CreateButton( - 0x25Au, - 0x1C2u, - (uTextureID_507970 != -1 ? pIcons_LOD->pTextures[uTextureID_507970].uTextureWidth : 24), - (uTextureID_507970 != -1 ? pIcons_LOD->pTextures[uTextureID_507970].uTextureHeight : 26), + pBtn_GameSettings = pPrimaryWindow->CreateButton(0x25Au, 0x1C2u, + (uTextureID_Btn_GameSettings != -1 ? pIcons_LOD->pTextures[uTextureID_Btn_GameSettings].uTextureWidth : 24), + (uTextureID_Btn_GameSettings != -1 ? pIcons_LOD->pTextures[uTextureID_Btn_GameSettings].uTextureHeight : 26), 1, 0, 0x6Bu, 0, 0, pGlobalTXT_LocalizationStrings[93], - (Texture *)(uTextureID_507970 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_507970] : 0), + (Texture *)(uTextureID_Btn_GameSettings != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_Btn_GameSettings] : 0), 0); - pBtn_NPCLeft = pPrimaryWindow->CreateButton( - 0x1D5u, - 0xB2u, - (uTextureID_507990 != -1 ? pIcons_LOD->pTextures[uTextureID_507990].uTextureWidth : 24), - (uTextureID_507990 != -1 ? pIcons_LOD->pTextures[uTextureID_507990].uTextureHeight : 26), + pBtn_NPCLeft = pPrimaryWindow->CreateButton(0x1D5u, 0xB2u, + (uTextureID_Btn_NPCLeft != -1 ? pIcons_LOD->pTextures[uTextureID_Btn_NPCLeft].uTextureWidth : 24), + (uTextureID_Btn_NPCLeft != -1 ? pIcons_LOD->pTextures[uTextureID_Btn_NPCLeft].uTextureHeight : 26), 1, 0, 0xBCu, 0, 0, "", - (Texture *)(uTextureID_507990 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_507990] : 0), + (Texture *)(uTextureID_Btn_NPCLeft != -1 ? &pIcons_LOD->pTextures[uTextureID_Btn_NPCLeft] : 0), 0); - pBtn_NPCRight = pPrimaryWindow->CreateButton( - 0x272u, - 0xB2u, - (uTextureID_50798C != -1 ? pIcons_LOD->pTextures[uTextureID_50798C].uTextureWidth : 24), - (uTextureID_50798C != -1 ? pIcons_LOD->pTextures[uTextureID_50798C].uTextureHeight : 26), + pBtn_NPCRight = pPrimaryWindow->CreateButton(0x272u, 0xB2u, + (uTextureID_Btn_NPCRight != -1 ? pIcons_LOD->pTextures[uTextureID_Btn_NPCRight].uTextureWidth : 24), + (uTextureID_Btn_NPCRight != -1 ? pIcons_LOD->pTextures[uTextureID_Btn_NPCRight].uTextureHeight : 26), 1, 0, 0xBCu, 1u, 0, "", - (Texture *)(uTextureID_50798C != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_50798C] : 0), + (Texture *)(uTextureID_Btn_NPCRight != -1 ? &pIcons_LOD->pTextures[uTextureID_Btn_NPCRight] : 0), 0); Load_isn_spells_21_27(); } @@ -2305,31 +2288,31 @@ //----- (0041D895) -------------------------------------------------------- -void __thiscall GameUI_DrawItemInfo(ItemGen *ecx0) +void GameUI_DrawItemInfo(ItemGen *ecx0) { ItemGen *v1; // esi@1 unsigned int v2; // eax@3 - char *v3; // edi@5 - unsigned int v4; // eax@5 - unsigned int v5; // esi@5 + //char *v3; // edi@5 + //unsigned int v4; // eax@5 + //unsigned int v5; // esi@5 signed int v6; // eax@5 int v7; // edx@5 ItemGen *v8; // ecx@10 - unsigned int v9; // eax@12 + //unsigned int v9; // eax@12 char v10; // zf@16 ItemGen *v11; // eax@16 ItemGen *v12; // eax@25 - unsigned int v13; // ecx@32 - unsigned int v14; // eax@32 - Render *v15; // edi@33 + //unsigned int v13; // ecx@32 + //unsigned int v14; // eax@32 + //Render *v15; // edi@33 const char *v16; // eax@34 int v17; // eax@36 int v18; // esi@37 unsigned __int16 v19; // ax@37 - char v20; // al@40 + //char v20; // al@40 char v21; // al@44 - char v22; // al@48 - char v23; // al@51 + //char v22; // al@48 + //char v23; // al@51 int v24; // eax@52 int v25; // eax@57 int v26; // eax@60 @@ -2349,28 +2332,28 @@ GUIFont *v40; // edx@113 signed int v41; // [sp-20h] [bp-298h]@113 int v42; // [sp-1Ch] [bp-294h]@113 - char *v43; // [sp-18h] [bp-290h]@46 + //char *v43; // [sp-18h] [bp-290h]@46 unsigned int v44; // [sp-18h] [bp-290h]@113 - int v45; // [sp-14h] [bp-28Ch]@46 + //int v45; // [sp-14h] [bp-28Ch]@46 const char *v46; // [sp-14h] [bp-28Ch]@58 char *v47; // [sp-14h] [bp-28Ch]@110 - char *v48; // [sp-10h] [bp-288h]@46 + //char *v48; // [sp-10h] [bp-288h]@46 const char *v49; // [sp-10h] [bp-288h]@56 char *v50; // [sp-10h] [bp-288h]@58 int v51; // [sp-10h] [bp-288h]@110 const char *v52; // [sp-Ch] [bp-284h]@36 - int v53; // [sp-Ch] [bp-284h]@46 + //int v53; // [sp-Ch] [bp-284h]@46 char *v54; // [sp-Ch] [bp-284h]@56 int v55; // [sp-Ch] [bp-284h]@58 int v56; // [sp-Ch] [bp-284h]@110 unsigned int v57; // [sp-8h] [bp-280h]@36 - int v58; // [sp-8h] [bp-280h]@46 + //int v58; // [sp-8h] [bp-280h]@46 int v59; // [sp-8h] [bp-280h]@56 int v60; // [sp-8h] [bp-280h]@58 unsigned int v61; // [sp-8h] [bp-280h]@110 - char a1[100]; // [sp+8h] [bp-270h]@40 - char Dest[100]; // [sp+6Ch] [bp-20Ch]@40 - char v64[100]; // [sp+D0h] [bp-1A8h]@40 + char a1[300]; // [sp+8h] [bp-270h]@40 + //char Dest[100]; // [sp+6Ch] [bp-20Ch]@40 + //char v64[100]; // [sp+D0h] [bp-1A8h]@40 char v65[120]; // [sp+134h] [bp-144h]@92 char Source[40]; // [sp+1ACh] [bp-CCh]@49 int v67; // [sp+1D4h] [bp-A4h]@91 @@ -2381,8 +2364,8 @@ int v72; // [sp+1ECh] [bp-8Ch]@91 int var88; // [sp+1F0h] [bp-88h]@1 Texture *v73; // [sp+1F4h] [bp-84h]@5 - unsigned int v75; // [sp+1F8h] [bp-80h]@5 - char *v76; // [sp+1FCh] [bp-7Ch]@5 + //unsigned int v75; // [sp+1F8h] [bp-80h]@5 + //char *v76; // [sp+1FCh] [bp-7Ch]@5 int v77; // [sp+200h] [bp-78h]@12 int v78; // [sp+204h] [bp-74h]@5 GUIWindow v79; // [sp+208h] [bp-70h]@2 @@ -2397,8 +2380,9 @@ _this = ecx0; var88 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu); v82 = pFontComic; - if ( v1->uItemID ) - { + if (!v1->uItemID) + return; + v79.Hint = 0; v79.uFrameWidth = 384; v79.uFrameHeight = 180; @@ -2408,14 +2392,16 @@ else v2 = pMouse->GetCursorPos(&a2)->x - v79.uFrameWidth - 30; v79.uFrameX = v2; - v3 = (char *)&pItemsTable->pItems[_this->uItemID].pIconName; - v76 = v3; - v4 = pIcons_LOD->LoadTexture(*(const char **)v3, TEXTURE_16BIT_PALETTE); - v5 = v4; - v4 *= 72; - v75 = v4; - v73 = (struct Texture *)((char *)pIcons_LOD->pTextures + v4); - v6 = 100 - *(unsigned __int16 *)((char *)&pIcons_LOD->pTextures[0].uTextureWidth + v4); + auto item_desc = &pItemsTable->pItems[_this->uItemID]; + //v3 = (char *)&pItemsTable->pItems[_this->uItemID].pIconName; + //v76 = v3; + //v4 = pIcons_LOD->LoadTexture(pItemsTable->pItems[_this->uItemID].pIconName, TEXTURE_16BIT_PALETTE); + //v5 = v4; + //v4 *= 72; + //v75 = v4; + //v73 = &pIcons_LOD->pTextures[v4]; + v73 = pIcons_LOD->LoadTexturePtr(item_desc->pIconName, TEXTURE_16BIT_PALETTE); + v6 = 100 - v73->uTextureWidth; v7 = v73->uTextureHeight; v78 = v6; v81 = 144 - v7; @@ -2426,22 +2412,22 @@ else v81 >>= 1; v8 = _this; - if ( !v3[46] ) - _this->uAttributes |= 1u; - v9 = v8->uAttributes; + if ( !item_desc->uItemID_Rep_St ) + _this->SetIdentified(); + //v9 = v8->uAttributes; v77 = 0; - a2.y = v9 & 2; - if ( pItemsTable->pItems[v8->uItemID].uEquipType == 18 ) + //a2.y = v8->uAttributes & 2; + if (pItemsTable->pItems[v8->uItemID].uEquipType == EQUIP_GOLD) v77 = v8->uAdditionalValue; if ( uActiveCharacter ) { - if ( !(v9 & 1) ) + if (!v8->Identified()) { v10 = pPlayers[uActiveCharacter]->CanIdentify(_this) == 1; v11 = _this; if ( v10 ) - _this->uAttributes |= 1u; - v10 = (v11->uAttributes & 1) == 0; + _this->SetIdentified(); + v10 = !v11->Identified(); v83 = (char *)9; if ( v10 ) { @@ -2460,13 +2446,13 @@ } } _this->UpdateTempBonus(pParty->uTimePlayed); - if ( a2.y ) + if (v8->Broken()) { v10 = pPlayers[uActiveCharacter]->CanRepair(_this) == 1; v12 = _this; if ( v10 ) _this->uAttributes = _this->uAttributes & 0xFFFFFFFD | 1; - v10 = (v12->uAttributes & 2) == 0; + v10 = !v12->Broken(); v83 = (char *)SPEECH_11; if ( v10 ) v83 = (char *)SPEECH_10; @@ -2479,54 +2465,42 @@ } } } - v13 = _this->uAttributes; - v14 = _this->uAttributes & 1; - a2.y = _this->uAttributes & 1; - if ( v13 & 2 ) + //v13 = _this->uAttributes; + //v14 = _this->Identified(); + a2.y = _this->Identified(); + if (_this->Broken()) { v79.DrawMessageBox(0); //v15 = &; - pRenderer->Clip( - v79.uFrameX + 12, - v79.uFrameY + 12, - v79.uFrameX + v79.uFrameWidth - 12, - v79.uFrameY + v79.uFrameHeight - 12); + pRenderer->Clip(v79.uFrameX + 12, v79.uFrameY + 12, + v79.uFrameX + v79.uFrameWidth - 12, v79.uFrameY + v79.uFrameHeight - 12); v79.uFrameWidth -= 24; v79.uFrameHeight -= 12; v79.uFrameZ = v79.uFrameX + v79.uFrameWidth - 1; v79.uFrameW = v79.uFrameY + v79.uFrameHeight - 1; - pRenderer->_4A6776( - v79.uFrameX + v78, - v81 + v79.uFrameY + 30, - (Texture *)(v5 != -1 ? (int)((char *)pIcons_LOD->pTextures + v75) : 0)); + pRenderer->DrawTransparentRedShade(v79.uFrameX + v78, v81 + v79.uFrameY + 30, v73); if ( a2.y ) v16 = _this->GetIdentifiedName(); else - v16 = (const char *)*((int *)v76 + 2); + v16 = item_desc->pUnidentifiedName; v79.DrawTitleText(pFontArrus, 0, 0xCu, var88, v16, 3u); v17 = pFontArrus->CalcTextHeight(pGlobalTXT_LocalizationStrings[32], &v79, 0, 0); v57 = 3; v52 = pGlobalTXT_LocalizationStrings[32]; goto LABEL_37; } - if ( !v14 ) + if (!_this->Identified()) { v79.DrawMessageBox(0); - v15 = pRenderer; - pRenderer->Clip( - v79.uFrameX + 12, - v79.uFrameY + 12, - v79.uFrameX + v79.uFrameWidth - 12, - v79.uFrameY + v79.uFrameHeight - 12); + //v15 = pRenderer; + pRenderer->Clip(v79.uFrameX + 12, v79.uFrameY + 12, + v79.uFrameX + v79.uFrameWidth - 12, v79.uFrameY + v79.uFrameHeight - 12); v79.uFrameWidth -= 24; v79.uFrameHeight -= 12; v79.uFrameZ = v79.uFrameX + v79.uFrameWidth - 1; v79.uFrameW = v79.uFrameY + v79.uFrameHeight - 1; - pRenderer->DrawTextureTransparent( - v79.uFrameX + v78, - v81 + v79.uFrameY + 30, - (Texture *)(v5 != -1 ? (int)((char *)pIcons_LOD->pTextures + v75) : 0)); - v79.DrawTitleText(pFontArrus, 0, 0xCu, var88, *((const char **)v76 + 2), 3u); + pRenderer->DrawTextureTransparent(v79.uFrameX + v78, v81 + v79.uFrameY + 30, v73); + v79.DrawTitleText(pFontArrus, 0, 0xCu, var88, item_desc->pUnidentifiedName, 3u); v17 = pFontArrus->CalcTextHeight(pGlobalTXT_LocalizationStrings[232], &v79, 0, 0); v57 = 3; v52 = pGlobalTXT_LocalizationStrings[232]; @@ -2536,55 +2510,52 @@ v79.DrawTitleText(pFontArrus, 0x64u, ((signed int)v79.uFrameHeight >> 1) - v18, v19, v52, v57); goto LABEL_116; } - sprintf(a1, pGlobalTXT_LocalizationStrings[463], *((int *)v3 + 2)); - strcpy(Dest, ""); - strcpy(v64, ""); - v20 = v3[28]; - if ( (unsigned __int8)v20 <= 1u ) - { - v58 = (unsigned __int8)v3[31]; - v53 = (unsigned __int8)v3[30]; - v48 = pGlobalTXT_LocalizationStrings[53]; - v45 = (unsigned __int8)v3[32]; - v43 = pGlobalTXT_LocalizationStrings[18]; - } - else - { - if ( v20 != 2 ) - { - if ( (unsigned __int8)v20 > 2u ) + + sprintfex(a1, pGlobalTXT_LocalizationStrings[463], item_desc->pUnidentifiedName); + a1[100] = 0; + a1[200] = 0; + //v20 = item_desc->uEquipType; + switch (item_desc->uEquipType) + { + case EQUIP_ONE_OR_TWO_HANDS: + case EQUIP_TWO_HANDED: + sprintfex(a1 + 100, "%s: +%d %s: %dd%d", pGlobalTXT_LocalizationStrings[18], (int)item_desc->uDamageMod, pGlobalTXT_LocalizationStrings[53], (int)item_desc->uDamageDice, (int)item_desc->uDamageRoll); + if (item_desc->uDamageMod) { - if ( (unsigned __int8)v20 <= 0xBu ) - { - v21 = v3[30]; - if ( v21 ) - sprintf( - Dest, - "%s: +%d", - pGlobalTXT_LocalizationStrings[11], - (unsigned __int8)v21 + (unsigned __int8)v3[32]); - } + char mod[16]; + sprintf(mod, "+%d", (int)item_desc->uDamageMod); + strcat(a1 + 100, mod); + } + break; + + case EQUIP_BOW: + sprintfex(a1 + 100, "%s: +%d %s: %dd%d", pGlobalTXT_LocalizationStrings[203], (int)item_desc->uDamageMod, pGlobalTXT_LocalizationStrings[53], (int)item_desc->uDamageDice, (int)item_desc->uDamageRoll); + if (item_desc->uDamageMod) + { + char mod[16]; + sprintf(mod, "+%d", (int)item_desc->uDamageMod); + strcat(a1 + 100, mod); } - goto LABEL_50; - } - v58 = (unsigned __int8)v3[31]; - v53 = (unsigned __int8)v3[30]; - v48 = pGlobalTXT_LocalizationStrings[53]; - v45 = (unsigned __int8)v3[32]; - v43 = pGlobalTXT_LocalizationStrings[203]; - } - sprintf(Dest, "%s: +%d %s: %dd%d", v43, v45, v48, v53, v58); - v22 = v3[32]; - if ( v22 ) - { - sprintf(Source, " +%d", (unsigned __int8)v22); - strcat(Dest, Source); - } -LABEL_50: + break; + + case EQUIP_ARMOUR: + case EQUIP_SHIELD: + case EQUIP_HELMET: + case EQUIP_BELT: + case EQUIP_CLOAK: + case EQUIP_GAUNTLETS: + case EQUIP_BOOTS: + case EQUIP_RING: + case EQUIP_AMULET: + if (item_desc->uDamageDice) + sprintfex(a1 + 100, "%s: +%d", pGlobalTXT_LocalizationStrings[11], item_desc->uDamageDice + item_desc->uDamageMod); + break; + } + if ( v77 ) goto LABEL_65; - v23 = v3[28]; - if ( v23 == 14 ) + //v23 = item_desc->uEquipType; + if (item_desc->uEquipType == 14) { v24 = _this->_bonus_type; if ( v24 ) @@ -2607,7 +2578,7 @@ --a2.y; } while ( a2.y ); - v28 = (const char *)*((int *)v3 + 3); + v28 = item_desc->pDescription; if ( *v28 ) { v29 = pFontSmallnum->CalcTextHeight(v28, &v79, 100, 0); @@ -2633,12 +2604,9 @@ v79.uFrameW = v79.uFrameY + v79.uFrameHeight - 1; v79.uFrameZ = v79.uFrameX + v79.uFrameWidth - 1; v79.DrawMessageBox(0); - v15 = pRenderer; - pRenderer->Clip( - v79.uFrameX + 12, - v79.uFrameY + 12, - v79.uFrameX + v79.uFrameWidth - 12, - v79.uFrameY + v79.uFrameHeight - 12); + //v15 = pRenderer; + pRenderer->Clip(v79.uFrameX + 12, v79.uFrameY + 12, + v79.uFrameX + v79.uFrameWidth - 12, v79.uFrameY + v79.uFrameHeight - 12); v79.uFrameWidth -= 12; v32 = v73->uTextureHeight; v33 = v79.uFrameHeight; @@ -2648,7 +2616,7 @@ pRenderer->DrawTextureTransparent( v79.uFrameX + v78, v79.uFrameY + (signed int)(v33 - v32) / 2, - (Texture *)(v5 != -1 ? (int)((char *)pIcons_LOD->pTextures + v75) : 0)); + v73); a2.y = 3; v34 = (int)(v83 + 35); Str = a1; @@ -2663,7 +2631,7 @@ --a2.y; } while ( a2.y ); - v35 = (const char *)*((int *)v76 + 3); + v35 = item_desc->pDescription; if ( *v35 ) v79.DrawText(pFontSmallnum, 100, v34, 0, v35, 0, 0, 0); v79.uFrameX += 12; @@ -2744,7 +2712,7 @@ } return; } - if ( v23 == 13 ) + if (item_desc->uEquipType == 13) { v24 = pItemsTable->pItems[_this->uItemID].uDamageDice; LABEL_56: @@ -2752,7 +2720,7 @@ v54 = pGlobalTXT_LocalizationStrings[449]; v49 = "%s: %d"; LABEL_64: - sprintf(v64, v49, v54, v59); + sprintf(a1 + 200, v49, v54, v59); goto LABEL_65; } v25 = _this->_bonus_type; @@ -2782,9 +2750,8 @@ v50 = pGlobalTXT_LocalizationStrings[210]; v46 = "%s: %s"; } - sprintf(v64, v46, v50, v55, v60); + sprintf(a1 + 200, v46, v50, v55, v60); goto LABEL_65; - } } // 4E455C: using guessed type int dword_4E455C; // 506128: using guessed type int areWeLoadingTexture; @@ -2924,7 +2891,7 @@ else { memcpy(&pMonsterInfoUI_Doll, v3, sizeof(pMonsterInfoUI_Doll)); - pMonsterInfoUI_Doll.uCurrentActionAnimation = 7; + pMonsterInfoUI_Doll.uCurrentActionAnimation = ANIM_Bored; pMonsterInfoUI_Doll.uCurrentActionTime = 0; v8 = rand(); v3 = v121; @@ -2934,27 +2901,24 @@ if ( (signed int)pMonsterInfoUI_Doll.uCurrentActionTime > (signed __int16)v9 ) { pMonsterInfoUI_Doll.uCurrentActionTime = 0; - if ( pMonsterInfoUI_Doll.uCurrentActionAnimation == 7 || pMonsterInfoUI_Doll.uCurrentActionAnimation == 2 ) - { - pMonsterInfoUI_Doll.uCurrentActionAnimation = 0; + if ( pMonsterInfoUI_Doll.uCurrentActionAnimation == ANIM_Bored || pMonsterInfoUI_Doll.uCurrentActionAnimation == ANIM_AtkMelee) + { + pMonsterInfoUI_Doll.uCurrentActionAnimation = ANIM_Standing; pMonsterInfoUI_Doll.uCurrentActionLength = rand() % 128 + 128; } else { rand(); - pMonsterInfoUI_Doll.uCurrentActionAnimation = 7; + pMonsterInfoUI_Doll.uCurrentActionAnimation = ANIM_Bored; if ( (pMonsterInfoUI_Doll.pMonsterInfo.uID < 115 || pMonsterInfoUI_Doll.pMonsterInfo.uID > 186) && (pMonsterInfoUI_Doll.pMonsterInfo.uID < 232 || pMonsterInfoUI_Doll.pMonsterInfo.uID > 249) && rand() % 30 < 100 ) - pMonsterInfoUI_Doll.uCurrentActionAnimation = 2; - pMonsterInfoUI_Doll.uCurrentActionLength = 8 - * pSpriteFrameTable->pSpriteSFrames[v3->pSpriteIDs[(signed __int16)pMonsterInfoUI_Doll.uCurrentActionAnimation]].uAnimLength; - } - } - v10 = pSpriteFrameTable->GetFrame( - v3->pSpriteIDs[(signed __int16)pMonsterInfoUI_Doll.uCurrentActionAnimation], - pMonsterInfoUI_Doll.uCurrentActionTime); - v11 = pSprites_LOD[v10->pHwSpriteIDs[0]].pSpriteHeaders;//40 * v10->pHwSpriteIDs[0] + 7218180; + pMonsterInfoUI_Doll.uCurrentActionAnimation = ANIM_AtkMelee; + pMonsterInfoUI_Doll.uCurrentActionLength = 8 * pSpriteFrameTable->pSpriteSFrames[v3->pSpriteIDs[(signed __int16)pMonsterInfoUI_Doll.uCurrentActionAnimation]].uAnimLength; + } + } + v10 = pSpriteFrameTable->GetFrame( v3->pSpriteIDs[(signed __int16)pMonsterInfoUI_Doll.uCurrentActionAnimation], pMonsterInfoUI_Doll.uCurrentActionTime); + v11 = &pSprites_LOD->pSpriteHeaders[v10->pHwSpriteIDs[0]];//40 * v10->pHwSpriteIDs[0] + 7218180; v106.pTarget = pRenderer->pTargetSurface; v106.pTargetZ = pRenderer->pActiveZBuffer; v106.uTargetPitch = pRenderer->uTargetSurfacePitch; @@ -3095,7 +3059,7 @@ { v108 = (unsigned __int16 *)pDesc.lpSurface; a2 = (Player *)v124; - if ( v124 < v119 ) + if ( v124 < v119 ) { v109 = 2 * pRenderer->uTargetSurfacePitch; v29 = (int)a4; @@ -4282,7 +4246,7 @@ { Chest::PlaceItemAt((unsigned __int8)Dst[v6], v11, v10); if ( pChests[v3].uFlags & 4 ) - v12->uAttributes |= 1u; + v12->SetIdentified(); } } ++v11; @@ -4913,7 +4877,7 @@ pMouse->GetClickPos(&pX, &pY); if ( pX < 0 || (signed int)pX > 639 || pY < 0 || (signed int)pY > 479 )//( (pX & 0x80000000u) != 0 || (signed int)pX > 639 || (pY & 0x80000000u) != 0 || (signed int)pY > 479 ) return; - if ( !pCurrentScreen ) + if (pCurrentScreen == SCREEN_GAME) { if ( (signed int)pX > 467 || (signed int)pY > 351 ) goto _click_on_game_ui; @@ -6242,15 +6206,15 @@ pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[dword_5079D0], "IB-InitG-c", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[dword_5079C8], "IB-InitY-c", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[dword_5079CC], "IB-InitR-c", 2); - pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_507990], "IB-NPCLD-C", 2); - pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_50798C], "IB-NPCRD-C", 2); - pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_507980], "ib-autout-C", 2); - pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_507984], "ib-autin-C", 2); + pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_NPCLeft], "IB-NPCLD-C", 2); + pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_NPCRight], "IB-NPCRD-C", 2); + pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_ZoomIn], "ib-autout-C", 2); + pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_ZoomOut], "ib-autin-C", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[dword_50C98C], "IB-selec-C", 2); - pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_50797C], "ib-m1d-c", 2); - pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_507978], "ib-m2d-c", 2); - pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[dword_507974], "ib-m3d-c", 2); - pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_507970], "ib-m4d-c", 2); + pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_CastSpell], "ib-m1d-c", 2); + pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_Rest], "ib-m2d-c", 2); + pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_QuickReference], "ib-m3d-c", 2); + pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_GameSettings], "ib-m4d-c", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[dword_50796C], "isg-01-c", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[dword_507968], "isg-02-c", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[dword_507964], "isg-03-c", 2); @@ -6286,15 +6250,15 @@ dword_5079D0 = pIcons_LOD->LoadTexture("IB-InitG-c", TEXTURE_16BIT_PALETTE); dword_5079C8 = pIcons_LOD->LoadTexture("IB-InitY-c", TEXTURE_16BIT_PALETTE); dword_5079CC = pIcons_LOD->LoadTexture("IB-InitR-c", TEXTURE_16BIT_PALETTE); - uTextureID_507990 = pIcons_LOD->LoadTexture("IB-NPCLD-C", TEXTURE_16BIT_PALETTE); - uTextureID_50798C = pIcons_LOD->LoadTexture("IB-NPCRD-C", TEXTURE_16BIT_PALETTE); - uTextureID_507980 = pIcons_LOD->LoadTexture("ib-autout-C", TEXTURE_16BIT_PALETTE); - uTextureID_507984 = pIcons_LOD->LoadTexture("ib-autin-C", TEXTURE_16BIT_PALETTE); + uTextureID_Btn_NPCLeft = pIcons_LOD->LoadTexture("IB-NPCLD-C", TEXTURE_16BIT_PALETTE); + uTextureID_Btn_NPCRight = pIcons_LOD->LoadTexture("IB-NPCRD-C", TEXTURE_16BIT_PALETTE); + uTextureID_Btn_ZoomIn = pIcons_LOD->LoadTexture("ib-autout-C", TEXTURE_16BIT_PALETTE); + uTextureID_Btn_ZoomOut = pIcons_LOD->LoadTexture("ib-autin-C", TEXTURE_16BIT_PALETTE); dword_50C98C = pIcons_LOD->LoadTexture("IB-selec-C", TEXTURE_16BIT_PALETTE); - uTextureID_50797C = pIcons_LOD->LoadTexture("ib-m1d-c", TEXTURE_16BIT_PALETTE); - uTextureID_507978 = pIcons_LOD->LoadTexture("ib-m2d-c", TEXTURE_16BIT_PALETTE); - dword_507974 = pIcons_LOD->LoadTexture("ib-m3d-c", TEXTURE_16BIT_PALETTE); - uTextureID_507970 = pIcons_LOD->LoadTexture("ib-m4d-c", TEXTURE_16BIT_PALETTE); + uTextureID_Btn_CastSpell = pIcons_LOD->LoadTexture("ib-m1d-c", TEXTURE_16BIT_PALETTE); + uTextureID_Btn_Rest = pIcons_LOD->LoadTexture("ib-m2d-c", TEXTURE_16BIT_PALETTE); + uTextureID_Btn_QuickReference = pIcons_LOD->LoadTexture("ib-m3d-c", TEXTURE_16BIT_PALETTE); + uTextureID_Btn_GameSettings = pIcons_LOD->LoadTexture("ib-m4d-c", TEXTURE_16BIT_PALETTE); uTextureID_506438 = pIcons_LOD->LoadTexture("ib-bcu-c", TEXTURE_16BIT_PALETTE); dword_50796C = pIcons_LOD->LoadTexture("isg-01-c", TEXTURE_16BIT_PALETTE); dword_507968 = pIcons_LOD->LoadTexture("isg-02-c", TEXTURE_16BIT_PALETTE); @@ -6327,15 +6291,15 @@ pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[dword_5079D0], "IB-InitG-a", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[dword_5079C8], "IB-InitY-a", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[dword_5079CC], "IB-InitR-a", 2); - pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_507990], "IB-NPCLD-a", 2); - pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_50798C], "IB-NPCRD-a", 2); - pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_507980], "ib-autout-a", 2); - pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_507984], "ib-autin-a", 2); + pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_NPCLeft], "IB-NPCLD-a", 2); + pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_NPCRight], "IB-NPCRD-a", 2); + pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_ZoomIn], "ib-autout-a", 2); + pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_ZoomOut], "ib-autin-a", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[dword_50C98C], "IB-selec-a", 2); - pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_50797C], "ib-m1d-a", 2); - pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_507978], "ib-m2d-a", 2); - pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[dword_507974], "ib-m3d-a", 2); - pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_507970], "ib-m4d-a", 2); + pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_CastSpell], "ib-m1d-a", 2); + pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_Rest], "ib-m2d-a", 2); + pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_QuickReference], "ib-m3d-a", 2); + pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_GameSettings], "ib-m4d-a", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[dword_50796C], "isg-01-a", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[dword_507968], "isg-02-a", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[dword_507964], "isg-03-a", 2); @@ -6371,15 +6335,15 @@ dword_5079D0 = pIcons_LOD->LoadTexture("IB-InitG-a", TEXTURE_16BIT_PALETTE); dword_5079C8 = pIcons_LOD->LoadTexture("IB-InitY-a", TEXTURE_16BIT_PALETTE); dword_5079CC = pIcons_LOD->LoadTexture("IB-InitR-a", TEXTURE_16BIT_PALETTE); - uTextureID_507990 = pIcons_LOD->LoadTexture("IB-NPCLD-A", TEXTURE_16BIT_PALETTE); - uTextureID_50798C = pIcons_LOD->LoadTexture("IB-NPCRD-A", TEXTURE_16BIT_PALETTE); + uTextureID_Btn_NPCLeft = pIcons_LOD->LoadTexture("IB-NPCLD-A", TEXTURE_16BIT_PALETTE); + uTextureID_Btn_NPCRight = pIcons_LOD->LoadTexture("IB-NPCRD-A", TEXTURE_16BIT_PALETTE); dword_50C98C = pIcons_LOD->LoadTexture("IB-selec-A", TEXTURE_16BIT_PALETTE); - uTextureID_50797C = pIcons_LOD->LoadTexture("ib-m1d-a", TEXTURE_16BIT_PALETTE); - uTextureID_507978 = pIcons_LOD->LoadTexture("ib-m2d-a", TEXTURE_16BIT_PALETTE); - dword_507974 = pIcons_LOD->LoadTexture("ib-m3d-a", TEXTURE_16BIT_PALETTE); - uTextureID_507970 = pIcons_LOD->LoadTexture("ib-m4d-a", TEXTURE_16BIT_PALETTE); - uTextureID_507980 = pIcons_LOD->LoadTexture("ib-autout-a", TEXTURE_16BIT_PALETTE); - uTextureID_507984 = pIcons_LOD->LoadTexture("ib-autin-a", TEXTURE_16BIT_PALETTE); + uTextureID_Btn_CastSpell = pIcons_LOD->LoadTexture("ib-m1d-a", TEXTURE_16BIT_PALETTE); + uTextureID_Btn_Rest = pIcons_LOD->LoadTexture("ib-m2d-a", TEXTURE_16BIT_PALETTE); + uTextureID_Btn_QuickReference = pIcons_LOD->LoadTexture("ib-m3d-a", TEXTURE_16BIT_PALETTE); + uTextureID_Btn_GameSettings = pIcons_LOD->LoadTexture("ib-m4d-a", TEXTURE_16BIT_PALETTE); + uTextureID_Btn_ZoomIn = pIcons_LOD->LoadTexture("ib-autout-a", TEXTURE_16BIT_PALETTE); + uTextureID_Btn_ZoomOut = pIcons_LOD->LoadTexture("ib-autin-a", TEXTURE_16BIT_PALETTE); uTextureID_506438 = pIcons_LOD->LoadTexture("ib-bcu-a", TEXTURE_16BIT_PALETTE); dword_50796C = pIcons_LOD->LoadTexture("isg-01-a", TEXTURE_16BIT_PALETTE); dword_507968 = pIcons_LOD->LoadTexture("isg-02-a", TEXTURE_16BIT_PALETTE); @@ -6424,15 +6388,15 @@ pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[dword_5079D0], "IB-InitG-b", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[dword_5079C8], "IB-InitY-b", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[dword_5079CC], "IB-InitR-b", 2); - pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_507990], "IB-NPCLD-B", 2); - pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_50798C], "IB-NPCRD-B", 2); - pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_507980], "ib-autout-B", 2); - pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_507984], "ib-autin-B", 2); + pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_NPCLeft], "IB-NPCLD-B", 2); + pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_NPCRight], "IB-NPCRD-B", 2); + pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_ZoomIn], "ib-autout-B", 2); + pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_ZoomOut], "ib-autin-B", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[dword_50C98C], "IB-selec-B", 2); - pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_50797C], "ib-m1d-b", 2); - pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_507978], "ib-m2d-b", 2); - pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[dword_507974], "ib-m3d-b", 2); - pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_507970], "ib-m4d-b", 2); + pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_CastSpell], "ib-m1d-b", 2); + pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_Rest], "ib-m2d-b", 2); + pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_QuickReference], "ib-m3d-b", 2); + pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_GameSettings], "ib-m4d-b", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[dword_50796C], "isg-01-b", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[dword_507968], "isg-02-b", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[dword_507964], "isg-03-b", 2); @@ -6652,7 +6616,7 @@ else { dword_50B700 = 0; - if ( !(v1->uAttributes & 1) ) + if ( !v1->TwoSided() ) return 0; } //v66 = v1->uNumVertices;
--- a/mm7_2.cpp Wed Feb 20 20:50:22 2013 +0600 +++ b/mm7_2.cpp Wed Feb 20 20:51:55 2013 +0600 @@ -1446,7 +1446,7 @@ v85 = 0; v83 = 4; v4 = (ItemGen *)&_this->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * (int)result + 5]; - if ( !(v4->uAttributes & 1) ) + if (!v4->Identified()) { v81 = ptr_507BC0->ptr_1C; v79 = v4; @@ -1845,7 +1845,7 @@ v93 = 0; v91 = 4; v37 = (ItemGen *)&_this->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * (int)result + 5]; - if ( !(v37->uAttributes & 1) ) + if (!v37->Identified()) { v89 = ptr_507BC0->ptr_1C; v87 = v37; @@ -2894,7 +2894,7 @@ if ( v2 ) { v3 = (ItemGen *)&v0->pInventoryItems[v2-1]; - if ( v3->uAttributes & 1 ) + if (v3->Identified()) { v118 = ptr_507BC0->ptr_1C; v4 = uActiveCharacter - 1; @@ -4595,7 +4595,7 @@ if ( v25 ) { v26 = 1; - v20->uAttributes |= 1u; + v20->SetIdentified(); memcpy(&v0->pInventoryItems[v25-1], v20, 0x24u); goto LABEL_42; } @@ -4663,7 +4663,7 @@ v39 = v0->AddItem(0xFFFFFFFFu, v32->uItemID); if ( v39 ) { - v32->uAttributes |= 1u; + v32->SetIdentified(); v7 = v73 == 1; v40 = (int)((char *)v0 + 36 * v39); memcpy((void *)(v40 + 496), v32, 0x24u); @@ -7726,11 +7726,11 @@ pMonster->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Friendly; v32 = rand(); v33 = v32 % 2048; - v34 = stru_5C6E00->SinCos(v32 % 2048); + v34 = stru_5C6E00->Cos(v32 % 2048); a4 = v34; a3 = (unsigned __int64)(v34 * (signed __int64)v52) >> 16; pPosX = a3 + spawn->vPosition.x; - v35 = stru_5C6E00->SinCos(v33 - stru_5C6E00->uIntegerHalfPi); + v35 = stru_5C6E00->Sin(v33); a4 = v35; a3 = (unsigned __int64)(v35 * (signed __int64)v52) >> 16; a4 = a3 + spawn->vPosition.y; @@ -7844,8 +7844,8 @@ v6->pMonsterInfo.uExp = 0; v6->uMovementSpeed = v9; v10 = rand() % 2048; - v11 = ((unsigned __int64)(stru_5C6E00->SinCos(v10) * (signed __int64)v19) >> 16) + pParty->vPosition.x; - uFaceID = stru_5C6E00->SinCos(v10 - stru_5C6E00->uIntegerHalfPi); + v11 = ((unsigned __int64)(stru_5C6E00->Cos(v10) * (signed __int64)v19) >> 16) + pParty->vPosition.x; + uFaceID = stru_5C6E00->Sin(v10); v23 = (unsigned __int64)(uFaceID * (signed __int64)v19) >> 16; v12 = pParty->vPosition.y; v13 = (unsigned __int64)(uFaceID * (signed __int64)v19) >> 16; @@ -8003,7 +8003,7 @@ } v18 = v15; } - a1a.stru_24.uAttributes |= 1u; + a1a.stru_24.SetIdentified(); a1a.uObjectDescID = v18; a1a.stru_24.uAdditionalValue = v34; goto LABEL_35; @@ -8162,7 +8162,7 @@ } } LABEL_23: - v3->uAttributes |= 1u; + v3->SetIdentified(); v3->uAdditionalValue = v10; LABEL_25: v11 = v4 - 1; @@ -8375,10 +8375,10 @@ ++uFaceID; v6 = rand() % 1024 + 512; v7 = rand() % (signed int)stru_5C6E00->uIntegerDoublePi; - v20 = stru_5C6E00->SinCos(v7); + v20 = stru_5C6E00->Cos(v7); v23 = (unsigned __int64)(v20 * (signed __int64)v6) >> 16; v19.vPosition.x = pParty->vPosition.x + v23; - v20 = stru_5C6E00->SinCos(v7 - stru_5C6E00->uIntegerHalfPi); + v20 = stru_5C6E00->Sin(v7); v23 = (unsigned __int64)(v20 * (signed __int64)v6) >> 16; v8 = 0; v19.uIndex = v24; @@ -8401,7 +8401,7 @@ { v9 = abs(v19.vPosition.y - pOutdoor->pBModels[v8].vBoundingCenter.y); v10 = abs(v19.vPosition.x - pOutdoor->pBModels[v8].vBoundingCenter.x); - if ( sub_4621DA(v10, v9, 0) < pOutdoor->pBModels[v8].sBoundingRadius + 256 ) + if ( int_get_vector_length(v10, v9, 0) < pOutdoor->pBModels[v8].sBoundingRadius + 256 ) break; ++v23; ++v8; @@ -8431,11 +8431,11 @@ v12 = rand() % 512 + 256; v13 = rand(); v14 = v13 % (signed int)stru_5C6E00->uIntegerDoublePi; - v15 = stru_5C6E00->SinCos(v13 % (signed int)stru_5C6E00->uIntegerDoublePi); + v15 = stru_5C6E00->Cos(v13 % (signed int)stru_5C6E00->uIntegerDoublePi); v20 = v15; v23 = (unsigned __int64)(v15 * (signed __int64)v12) >> 16; v19.vPosition.x = pParty->vPosition.x + v23; - v16 = stru_5C6E00->SinCos(v14 - stru_5C6E00->uIntegerHalfPi); + v16 = stru_5C6E00->Sin(v13 % (signed int)stru_5C6E00->uIntegerDoublePi); v20 = v16; v23 = (unsigned __int64)(v16 * (signed __int64)v12) >> 16; v19.vPosition.y = v23 + pParty->vPosition.y; @@ -11466,7 +11466,7 @@ //----- (004621DA) -------------------------------------------------------- -int __fastcall sub_4621DA(signed int a1, signed int a2, signed int a3) +int __fastcall int_get_vector_length(signed int a1, signed int a2, signed int a3) { signed int v3; // eax@2 signed int v4; // eax@3 @@ -12916,7 +12916,6 @@ ReleaseDC(nullptr, hDesktopDC); - uint uTotalWinWidth = 2 * GetSystemMetrics(SM_CXFRAME) + 640; uint uTotalWinHeight = GetSystemMetrics(SM_CYCAPTION) + 2 * GetSystemMetrics(SM_CYFRAME) + 480; @@ -13570,7 +13569,7 @@ } if (!bNoSound && pAudioPlayer->hAILRedbook) { - pAudioPlayer->SetMusicVolume((pSoundVolumeLevels[uMusicVolimeMultiplier] * 64.0)); + pAudioPlayer->SetMusicVolume(pSoundVolumeLevels[uMusicVolimeMultiplier] * 64.0f); AIL_redbook_stop(pAudioPlayer->hAILRedbook); unsigned int end_ms; AIL_redbook_track_info(pAudioPlayer->hAILRedbook, 0xE, &startms, &end_ms);
--- a/mm7_3.cpp Wed Feb 20 20:50:22 2013 +0600 +++ b/mm7_3.cpp Wed Feb 20 20:51:55 2013 +0600 @@ -138,7 +138,7 @@ { v11 = v9->pFloors[v10]; v12 = &pIndoor->pFaces[v11]; - if ( v12->uAttributes & 1 + if ( v12->TwoSided() || stru_721530.sMaxX > v12->pBounding.x2 || stru_721530.sMinX < v12->pBounding.x1 || stru_721530.sMaxY > v12->pBounding.y2 @@ -1017,7 +1017,7 @@ v0->uAIState = Removed; goto LABEL_121; } - if ( v0->uCurrentActionAnimation == 1 ) + if ( v0->uCurrentActionAnimation == ANIM_Walking ) { v8 = v0->uMovementSpeed; v9 = HIDWORD(v0->pActorBuffs[7].uExpireTime) == 0; @@ -1038,18 +1038,18 @@ v8 = (signed __int64)((double)v73 * flt_6BE3AC_debug_recmod1_x_1_6); if ( v8 > 1000 ) v8 = 1000; - v12 = stru_5C6E00->SinCos(v0->uYawAngle); + v12 = stru_5C6E00->Cos(v0->uYawAngle); v69 = v12; v13 = v12 * (signed __int64)v8; v73 = v13 >> 16; v0->vVelocity.x = WORD1(v13); - v69 = stru_5C6E00->SinCos(v0->uYawAngle - stru_5C6E00->uIntegerHalfPi); + v69 = stru_5C6E00->Sin(v0->uYawAngle); v73 = (unsigned __int64)((signed int)v69 * (signed __int64)v8) >> 16; v9 = v74 == 0; v0->vVelocity.y = v69 * v8 >> 16; if ( !v9 ) { - v14 = stru_5C6E00->SinCos(v0->uPitchAngle - stru_5C6E00->uIntegerHalfPi); + v14 = stru_5C6E00->Sin(v0->uPitchAngle); v69 = v14; v15 = v14 * (signed __int64)v8; v73 = v15 >> 16; @@ -1264,11 +1264,11 @@ v48 = stru_5C6E00->Atan2( v0->vPosition.x - pLevelDecorations[v39].vPosition.x, v0->vPosition.y - pLevelDecorations[v39].vPosition.y); - v71 = stru_5C6E00->SinCos(v48); + v71 = stru_5C6E00->Cos(v48); v70 = (unsigned __int64)(v71 * (signed __int64)v47) >> 16; - v49 = v48 - stru_5C6E00->uIntegerHalfPi; + v49 = v48; v0->vVelocity.x = (unsigned int)(v71 * v47) >> 16; - v50 = stru_5C6E00->SinCos(v49); + v50 = stru_5C6E00->Sin(v48); v71 = v50; v51 = v50 * (signed __int64)v47; v70 = v51 >> 16; @@ -1582,11 +1582,11 @@ v23 = stru_5C6E00->Atan2( v1->vPosition.x - pLevelDecorations[v15].vPosition.x, v1->vPosition.y - pLevelDecorations[v15].vPosition.y); - v42 = stru_5C6E00->SinCos(v23); + v42 = stru_5C6E00->Cos(v23); v41 = (unsigned __int64)(v42 * (signed __int64)v40) >> 16; - v24 = v23 - stru_5C6E00->uIntegerHalfPi; + v24 = v23; v1->vVelocity.x = (unsigned int)(v42 * v40) >> 16; - v25 = stru_5C6E00->SinCos(v24); + v25 = stru_5C6E00->Sin(v23); v42 = v25; v26 = v25 * (signed __int64)v40; v41 = v26 >> 16; @@ -2166,12 +2166,12 @@ v1->vPosition.x - pLevelDecorations[v30].vPosition.x, v1->vPosition.y - pLevelDecorations[v30].vPosition.y); v56 = v38; - v39 = stru_5C6E00->SinCos(v38); + v39 = stru_5C6E00->Cos(v38); v60 = (Actor *)v39; v40 = v39 * (signed __int64)v57; v58 = v40 >> 16; v1->vVelocity.x = WORD1(v40); - v41 = stru_5C6E00->SinCos(v56 - stru_5C6E00->uIntegerHalfPi); + v41 = stru_5C6E00->Sin(v56 - stru_5C6E00->uIntegerHalfPi); v60 = (Actor *)v41; v35 = (unsigned __int64)(v41 * (signed __int64)v57) >> 16; v58 = v35; @@ -2257,7 +2257,7 @@ goto LABEL_36; } v11 = v4->uLifetime; - if ( item->uAttributes & 2 ) + if (item->uAttributes & 2) v11 = *((short *)v2 + 1); if ( v8 < v11 ) { @@ -2603,45 +2603,45 @@ goto LABEL_87; case PARTY_StrafeLeft: __debugbreak(); - v17 = stru_5C6E00->SinCos(angle - stru_5C6E00->uIntegerHalfPi); + v17 = stru_5C6E00->Sin(angle); v18 = (double)v81; //v88 = v18; v78 = (unsigned __int64)(v17 * (signed __int64)((signed int)(signed __int64)(v18 * fWalkSpeedMultiplier) >> 1)) >> 16; v2 -= v78; - v19 = stru_5C6E00->SinCos(angle); + v19 = stru_5C6E00->Cos(angle); v78 = (unsigned __int64)(v19 * (signed __int64)((signed int)(signed __int64)(v18 * fWalkSpeedMultiplier) >> 1)) >> 16; goto LABEL_63; case PARTY_StrafeRight: __debugbreak(); - v20 = stru_5C6E00->SinCos(angle - stru_5C6E00->uIntegerHalfPi); + v20 = stru_5C6E00->Sin(angle); v21 = (double)v81; //v88 = v21; v78 = (unsigned __int64)(v20 * (signed __int64)((signed int)(signed __int64)(v21 * fWalkSpeedMultiplier) >> 1)) >> 16; v2 += v78; - v22 = stru_5C6E00->SinCos(angle); + v22 = stru_5C6E00->Cos(angle); v78 = (unsigned __int64)(v22 * (signed __int64)((signed int)(signed __int64)(v21 * fWalkSpeedMultiplier) >> 1)) >> 16; goto LABEL_68; case PARTY_WalkForward: __debugbreak(); - v23 = stru_5C6E00->SinCos(angle); + v23 = stru_5C6E00->Cos(angle); v24 = (double)v81; //v88 = v24; v78 = (unsigned __int64)(v23 * (signed __int64)(signed int)(signed __int64)(v24 * fWalkSpeedMultiplier)) >> 16; v2 += v78; - v25 = stru_5C6E00->SinCos(angle - stru_5C6E00->uIntegerHalfPi); + v25 = stru_5C6E00->Sin(angle); v78 = (unsigned __int64)(v25 * (signed __int64)(signed int)(signed __int64)(v24 * fWalkSpeedMultiplier)) >> 16; LABEL_63: v1 += v78; goto LABEL_64; case PARTY_WalkBackward: __debugbreak(); - v26 = stru_5C6E00->SinCos(angle); + v26 = stru_5C6E00->Cos(angle); v27 = (double)v81; //v88 = v27; v78 = (unsigned __int64)(v26 * (signed __int64)(signed int)(signed __int64)(v27 * fBackwardWalkSpeedMultiplier)) >> 16; v2 -= v78; - v28 = stru_5C6E00->SinCos(angle - stru_5C6E00->uIntegerHalfPi); + v28 = stru_5C6E00->Sin(angle); v78 = (unsigned __int64)(v28 * (signed __int64)(signed int)(signed __int64)(v27 * fBackwardWalkSpeedMultiplier)) >> 16; LABEL_68: @@ -2650,21 +2650,21 @@ v78 = 1; goto LABEL_87; case PARTY_RunForward: - //v29 = stru_5C6E00->SinCos(angle); + //v29 = stru_5C6E00->Cos(angle); //v30 = (double)v81; //v88 = (double)v81; - v2 += (unsigned __int64)(stru_5C6E00->SinCos(angle) * (signed __int64)(signed int)(2 * (unsigned __int64)(signed __int64)((double)v81 * fWalkSpeedMultiplier))) >> 16; + v2 += (unsigned __int64)(stru_5C6E00->Cos(angle) * (signed __int64)(signed int)(2 * (unsigned __int64)(signed __int64)((double)v81 * fWalkSpeedMultiplier))) >> 16; //v31 = stru_5C6E00->SinCos(angle - stru_5C6E00->uIntegerHalfPi); - v1 += (unsigned __int64)(stru_5C6E00->SinCos(angle - stru_5C6E00->uIntegerHalfPi) * (signed __int64)(signed int)(2 * (unsigned __int64)(signed __int64)((double)v81 * fWalkSpeedMultiplier))) >> 16; + v1 += (unsigned __int64)(stru_5C6E00->Sin(angle) * (signed __int64)(signed int)(2 * (unsigned __int64)(signed __int64)((double)v81 * fWalkSpeedMultiplier))) >> 16; v72 = 1; goto LABEL_87; case PARTY_RunBackward: //v32 = stru_5C6E00->SinCos(angle); //v33 = (double)v81; //v88 = (double)v81; - v2 -= (unsigned __int64)(stru_5C6E00->SinCos(angle) * (signed __int64)(signed int)(signed __int64)((double)v81 * fBackwardWalkSpeedMultiplier)) >> 16; + v2 -= (unsigned __int64)(stru_5C6E00->Cos(angle) * (signed __int64)(signed int)(signed __int64)((double)v81 * fBackwardWalkSpeedMultiplier)) >> 16; //v34 = stru_5C6E00->SinCos(angle - stru_5C6E00->uIntegerHalfPi); - v1 -= (unsigned __int64)(stru_5C6E00->SinCos(angle - stru_5C6E00->uIntegerHalfPi) * (signed __int64)(signed int)(signed __int64)((double)v81 * fBackwardWalkSpeedMultiplier)) >> 16; + v1 -= (unsigned __int64)(stru_5C6E00->Sin(angle) * (signed __int64)(signed int)(signed __int64)((double)v81 * fBackwardWalkSpeedMultiplier)) >> 16; //LABEL_70: v72 = 1; goto LABEL_87; @@ -2830,8 +2830,8 @@ v54 = stru_5C6E00->Atan2( new_party_x - pLevelDecorations[stru_721530.uFaceID >> 3].vPosition.x, new_party_y - pLevelDecorations[stru_721530.uFaceID >> 3].vPosition.y); - v2 = (unsigned __int64)(stru_5C6E00->SinCos(v54) * (signed __int64)v53) >> 16; - v55 = stru_5C6E00->SinCos(v54 - stru_5C6E00->uIntegerHalfPi); + v2 = (unsigned __int64)(stru_5C6E00->Cos(v54) * (signed __int64)v53) >> 16; + v55 = stru_5C6E00->Sin(v54); v1 = (unsigned __int64)(v55 * (signed __int64)v80) >> 16; } else @@ -3552,7 +3552,7 @@ { LABEL_130: v31 = GetTickCount(); - v126 = stru_5C6E00->SinCos(v31); + v126 = stru_5C6E00->Cos(v31); v129 = (unsigned __int64)(4i64 * v126) >> 16; v123 = v113 + v129; if ( v127 ) @@ -3762,12 +3762,12 @@ _angle_x - pLevelDecorations[(signed int)stru_721530.uFaceID >> 3].vPosition.x, _angle_y - pLevelDecorations[(signed int)stru_721530.uFaceID >> 3].vPosition.y); v129 = v57; - v58 = (BSPModel *)stru_5C6E00->SinCos(v57); + v58 = (BSPModel *)stru_5C6E00->Cos(v57); v127 = v58; v59 = (signed int)v58 * (signed __int64)v56; v122 = v59 >> 16; v2 = v59 >> 16; - v60 = (BSPModel *)stru_5C6E00->SinCos(v129 - stru_5C6E00->uIntegerHalfPi); + v60 = (BSPModel *)stru_5C6E00->Sin(v129); v127 = v60; v61 = (signed int)v60 * (signed __int64)v118; v122 = v61 >> 16; @@ -4596,7 +4596,7 @@ v6 = (unsigned __int64)(a2->z * (signed __int64)v4->pFacePlane_old.vNormal.z) >> 16, v7 = v5 + v6 + a4b, (v16 = v5 + v6 + a4b) == 0) - || v7 > 0 && !(v4->uAttributes & 1) ) + || v7 > 0 && !v4->TwoSided()) return 0; v8 = v4->pFacePlane_old.vNormal.z * a1->z; v9 = -(v4->pFacePlane_old.dist + v8 + a1->y * v4->pFacePlane_old.vNormal.y + a1->x * v4->pFacePlane_old.vNormal.x); @@ -4656,7 +4656,7 @@ v14 = v10 + v12 + v11, v22 = v10 + v12 + v11, v13) - || v14 > 0 && !(a2->uAttributes & 1) ) + || v14 > 0 && !a2->TwoSided()) return 0; v15 = a4 * a2->pFacePlane_old.vNormal.y; v16 = -(a2->pFacePlane_old.dist + v15 + a3 * a2->pFacePlane_old.vNormal.x + a5 * a2->pFacePlane_old.vNormal.z); @@ -5140,11 +5140,10 @@ v31 = 3; do { - v40 = (double)stru_5C6E00->SinCos(pIndoorCamera->sRotationX) * 0.0000152587890625; - v32 = (double)stru_5C6E00->SinCos(pIndoorCamera->sRotationX - stru_5C6E00->uIntegerHalfPi) - * 0.0000152587890625; - v34 = (double)stru_5C6E00->SinCos(pIndoorCamera->sRotationY) * 0.0000152587890625; - v16 = stru_5C6E00->SinCos(pIndoorCamera->sRotationY - stru_5C6E00->uIntegerHalfPi); + v40 = (double)stru_5C6E00->Cos(pIndoorCamera->sRotationX) * 0.0000152587890625; + v32 = (double)stru_5C6E00->Sin(pIndoorCamera->sRotationX) * 0.0000152587890625; + v34 = (double)stru_5C6E00->Cos(pIndoorCamera->sRotationY) * 0.0000152587890625; + v16 = stru_5C6E00->Sin(pIndoorCamera->sRotationY); LODWORD(v38) = *(int *)v15; v33 = (double)v16 * 0.0000152587890625; //UNDEF(v17); @@ -6190,7 +6189,7 @@ // 73C830: using guessed type char static_sub_004789DE_byte_73C830__init_flag; //----- (00479089) -------------------------------------------------------- -bool __fastcall IsBModelVisible(unsigned int uModelID, int *unused) +bool __fastcall IsBModelVisible(unsigned int uModelID, int *reachable) { BSPModel *v2; // eax@1 int v3; // edi@1 @@ -6200,30 +6199,30 @@ int v7; // ebx@3 int v8; // eax@3 int v9; // eax@3 - int v10; // ebx@3 + //int v10; // ebx@3 signed int v11; // esi@6 int v12; // esi@8 bool result; // eax@9 - unsigned int v14; // [sp+Ch] [bp-20h]@1 + //unsigned int v14; // [sp+Ch] [bp-20h]@1 int v15; // [sp+Ch] [bp-20h]@5 - int *v16; // [sp+10h] [bp-1Ch]@1 + //int *v16; // [sp+10h] [bp-1Ch]@1 int v17; // [sp+1Ch] [bp-10h]@1 int v18; // [sp+20h] [bp-Ch]@1 int v19; // [sp+20h] [bp-Ch]@3 int angle; // [sp+24h] [bp-8h]@1 int v21; // [sp+28h] [bp-4h]@1 - int v22; // [sp+28h] [bp-4h]@3 - - v16 = unused; + //int v22; // [sp+28h] [bp-4h]@3 + + //v16 = unused; angle = (signed int)(pOutdoorCamera->uCameraFovInDegrees << 11) / 360 >> 1; - v14 = uModelID; + //v14 = uModelID; v2 = &pOutdoor->pBModels[uModelID]; v3 = v2->vBoundingCenter.x - pIndoorCamera->pos.x; v4 = v2->vBoundingCenter.y - pIndoorCamera->pos.y; - v5 = stru_5C6E00->SinCos(pIndoorCamera->sRotationY); - v21 = stru_5C6E00->SinCos(pIndoorCamera->sRotationY - stru_5C6E00->uIntegerHalfPi); - v18 = stru_5C6E00->SinCos(pIndoorCamera->sRotationX); - stru_5C6E00->SinCos(pIndoorCamera->sRotationX - stru_5C6E00->uIntegerHalfPi); + v5 = stru_5C6E00->Cos(pIndoorCamera->sRotationY); + v21 = stru_5C6E00->Sin(pIndoorCamera->sRotationY); + v18 = stru_5C6E00->Cos(pIndoorCamera->sRotationX); + stru_5C6E00->Sin(pIndoorCamera->sRotationX); v6 = v5; v17 = v3 * v5 + v4 * v21; if ( pIndoorCamera->sRotationX ) @@ -6231,38 +6230,31 @@ v19 = v4 * v6 - v3 * v21; v7 = abs(v4); v8 = abs(v3); - v9 = sub_4621DA(v8, v7, 0); - v10 = v14 * 188; - v22 = v9; - *v16 = 0; - if ( v9 < pOutdoor->pBModels[v14].sBoundingRadius + 256 ) - *v16 = 1; - v15 = stru_5C6E00->SinCos(angle - stru_5C6E00->uIntegerHalfPi); + v9 = int_get_vector_length(v8, v7, 0); + //v10 = v14 * 188; + //v22 = v9; + *reachable = false; + if ( v9 < pOutdoor->pBModels[uModelID].sBoundingRadius + 256 ) + *reachable = true; + v15 = stru_5C6E00->Sin(angle); if ( v19 >= 0 ) - v11 = ((unsigned __int64)(v15 * (signed __int64)v17) >> 16) - - ((unsigned __int64)(stru_5C6E00->SinCos(angle) * (signed __int64)v19) >> 16); - else - v11 = ((unsigned __int64)(stru_5C6E00->SinCos(angle) * (signed __int64)v19) >> 16) - + ((unsigned __int64)(v15 * (signed __int64)v17) >> 16); + v11 = ((unsigned __int64)(v15 * (signed __int64)v17) >> 16) - ((unsigned __int64)(stru_5C6E00->Cos(angle) * (signed __int64)v19) >> 16); + else + v11 = ((unsigned __int64)(stru_5C6E00->Cos(angle) * (signed __int64)v19) >> 16) + ((unsigned __int64)(v15 * (signed __int64)v17) >> 16); v12 = v11 >> 16; - if ( v22 <= pOutdoorCamera->shading_dist_mist + 2048 ) + if ( v9 <= pOutdoorCamera->shading_dist_mist + 2048 ) { //if ( abs(v12) > *(int *)((char *)&pOutdoor->pBModels->sBoundingRadius + v10) + 512 ) - if ( abs(v12) > *(int *)((char *)&pOutdoor->pBModels[v14].sBoundingRadius) + 512 ) + if ( abs(v12) > pOutdoor->pBModels[uModelID].sBoundingRadius + 512 ) { result = v12 < 0; LOBYTE(result) = v12 >= 0; - } - else - { - result = 1; - } - } - else - { - result = 0; - } - return result; + return result; + } + else + return true; + } + return false; } @@ -6947,9 +6939,9 @@ _this.field_58 = 0; _this.uNumVertices = 4; - _this.v_18.x = -stru_5C6E00->SinCos(pIndoorCamera->sRotationX - stru_5C6E00->uIntegerHalfPi + 16); + _this.v_18.x = -stru_5C6E00->Sin(pIndoorCamera->sRotationX + 16); _this.v_18.y = 0; - _this.v_18.z = -stru_5C6E00->SinCos(pIndoorCamera->sRotationX + 16); + _this.v_18.z = -stru_5C6E00->Cos(pIndoorCamera->sRotationX + 16); _this.field_24 = 0x2000000; _this.sTextureDeltaU = 224 * pMiscTimer->uTotalGameTimeElapsed; @@ -7205,10 +7197,10 @@ v8 = pBLVRenderParams->sPartyRotX; v62.field_58 = 0; v62.uNumVertices = v3; - v9 = stru_5C6E00->SinCos(pBLVRenderParams->sPartyRotX - stru_5C6E00->uIntegerHalfPi + 16); + v9 = stru_5C6E00->Sin(pBLVRenderParams->sPartyRotX + 16); v62.v_18.y = 0; v62.v_18.x = -v9; - v62.v_18.z = -stru_5C6E00->SinCos(v8 + 16); + v62.v_18.z = -stru_5C6E00->Cos(v8 + 16); v10 = pBLVRenderParams->uViewportZ - pBLVRenderParams->uViewportX; memcpy(&array_507D30[v3], array_507D30, sizeof(array_507D30[v3])); LODWORD(v80) = v10; @@ -9795,8 +9787,8 @@ v79 = (signed int)(v63 + ((unsigned __int64)(v79 * (signed __int64)v39) >> 16) - v5->ptr_38->field_28) >> v76; a1.field_4 = (v43 - v30) >> 4; a1.field_0 = (v79 - v68) >> 4; - a1.field_30 = v30 + 4 * stru_5C6E00->SinCos(v81 + (v68 >> v66)); - v44 = stru_5C6E00->SinCos(v81 + (v30 >> v66) - stru_5C6E00->uIntegerHalfPi); + a1.field_30 = v30 + 4 * stru_5C6E00->Cos(v81 + (v68 >> v66)); + v44 = stru_5C6E00->Sin(v81 + (v30 >> v66)); a1.field_2C = v68 + 4 * v44; if ( byte_4D864C && BYTE1(pGame->uFlags) & 8 ) sr_sub_485975(&a1, (stru315 *)&a2); @@ -9815,8 +9807,8 @@ if ( !v72 ) return 1; v66 = 12 - v75; - a1.field_30 = v30 + 4 * stru_5C6E00->SinCos(v81 + (v31 >> (12 - v75))); - v46 = stru_5C6E00->SinCos(v81 + (v30 >> v66) - stru_5C6E00->uIntegerHalfPi); + a1.field_30 = v30 + 4 * stru_5C6E00->Cos(v81 + (v31 >> (12 - v75))); + v46 = stru_5C6E00->Sin(v81 + (v30 >> v66)); a1.field_2C = v68 + 4 * v46; v79 = v5->v_18.y; v80 = (unsigned __int64)(v79 * (signed __int64)v73) >> 16; @@ -9943,8 +9935,8 @@ v42 = v3->v_18.z; v44 = (unsigned __int64)(v42 * (signed __int64)v4) >> 16; v9 = v44 + v3->v_18.x; - v35 = stru_5C6E00->SinCos(pIndoorCamera->sRotationY - stru_5C6E00->uIntegerHalfPi); - v10 = stru_5C6E00->SinCos(pIndoorCamera->sRotationY); + v35 = stru_5C6E00->Sin(pIndoorCamera->sRotationY); + v10 = stru_5C6E00->Cos(pIndoorCamera->sRotationY); v11 = v2->field_8; v36 = v10; a1.field_28 = v2->field_C; @@ -10121,8 +10113,8 @@ v39 = v3->v_18.z; v40 = (unsigned __int64)(v39 * (signed __int64)v4) >> 16; v9 = v40 + v3->v_18.x; - v32 = stru_5C6E00->SinCos(pIndoorCamera->sRotationY - stru_5C6E00->uIntegerHalfPi); - v10 = stru_5C6E00->SinCos(pIndoorCamera->sRotationY); + v32 = stru_5C6E00->Sin(pIndoorCamera->sRotationY); + v10 = stru_5C6E00->Cos(pIndoorCamera->sRotationY); v11 = v2->field_8; v33 = v10; v35.field_28 = v2->field_C; @@ -10764,11 +10756,11 @@ a1a.field_C = v32 - 1; i = (unsigned __int64)(pOutdoorCamera->int_fov_rad_inv * (signed __int64)i) >> 16; v47 = (Span *)(i >> v44); - v35 = stru_5C6E00->SinCos(pIndoorCamera->sRotationY - stru_5C6E00->uIntegerHalfPi); + v35 = stru_5C6E00->Sin(pIndoorCamera->sRotationY); v36 = (signed int)v47 * (signed __int64)v35; i = v36 >> 16; a1a.field_4 = v36 >> 16; - v37 = stru_5C6E00->SinCos(pIndoorCamera->sRotationY); + v37 = stru_5C6E00->Cos(pIndoorCamera->sRotationY); v38 = (signed int)v47 * (signed __int64)v37; i = v38 >> 16; a1a.field_0 = v38 >> 16; @@ -10778,8 +10770,8 @@ v39 = 12 - v49; for ( i = 12 - v49; ; v39 = i ) { - a1a.field_30 = v30 + 4 * stru_5C6E00->SinCos(X + (v31 >> v39)); - a1a.field_2C = v31 + 4 * stru_5C6E00->SinCos(X + (v30 >> i) - stru_5C6E00->uIntegerHalfPi); + a1a.field_30 = v30 + 4 * stru_5C6E00->Cos(X + (v31 >> v39)); + a1a.field_2C = v31 + 4 * stru_5C6E00->Sin(X + (v30 >> i)); if ( byte_4D864C && BYTE1(pGame->uFlags) & 8 ) sr_sub_485975(&a1a, (stru315 *)&a2); else @@ -10795,8 +10787,8 @@ if ( v48 ) { i = 12 - v49; - a1a.field_30 = v30 + 4 * stru_5C6E00->SinCos(X + (v31 >> (12 - v49))); - a1a.field_2C = v31 + 4 * stru_5C6E00->SinCos(X + (v30 >> i) - stru_5C6E00->uIntegerHalfPi); + a1a.field_30 = v30 + 4 * stru_5C6E00->Cos(X + (v31 >> (12 - v49))); + a1a.field_2C = v31 + 4 * stru_5C6E00->Sin(X + (v30 >> i)); a1a.field_28 = v48; if ( byte_4D864C && BYTE1(pGame->uFlags) & 8 ) sr_sub_485975(&a1a, (stru315 *)&a2); @@ -11388,10 +11380,10 @@ //----- (0048600E) -------------------------------------------------------- void OutdoorCamera::RotationToInts() { - camera_rotation_y_int_sine = stru_5C6E00->SinCos(pIndoorCamera->sRotationY - stru_5C6E00->uIntegerHalfPi); - camera_rotation_y_int_cosine = stru_5C6E00->SinCos(pIndoorCamera->sRotationY); - camera_rotation_x_int_sine = stru_5C6E00->SinCos(pIndoorCamera->sRotationX - stru_5C6E00->uIntegerHalfPi); - camera_rotation_x_int_cosine = stru_5C6E00->SinCos(pIndoorCamera->sRotationX); + camera_rotation_y_int_sine = stru_5C6E00->Sin(pIndoorCamera->sRotationY); + camera_rotation_y_int_cosine = stru_5C6E00->Cos(pIndoorCamera->sRotationY); + camera_rotation_x_int_sine = stru_5C6E00->Sin(pIndoorCamera->sRotationX); + camera_rotation_x_int_cosine = stru_5C6E00->Cos(pIndoorCamera->sRotationX); } @@ -11589,10 +11581,10 @@ int v31; // [sp+3Ch] [bp+14h]@10 v7 = this; - v8 = stru_5C6E00->SinCos(pBLVRenderParams->sPartyRotY); - v29 = stru_5C6E00->SinCos(pBLVRenderParams->sPartyRotY - stru_5C6E00->uIntegerHalfPi); - v28 = stru_5C6E00->SinCos(pBLVRenderParams->sPartyRotX); - v9 = stru_5C6E00->SinCos(pBLVRenderParams->sPartyRotX - stru_5C6E00->uIntegerHalfPi); + v8 = stru_5C6E00->Cos(pBLVRenderParams->sPartyRotY); + v29 = stru_5C6E00->Sin(pBLVRenderParams->sPartyRotY); + v28 = stru_5C6E00->Cos(pBLVRenderParams->sPartyRotX); + v9 = stru_5C6E00->Sin(pBLVRenderParams->sPartyRotX); v11 = -pBLVRenderParams->vPartyPos.y; v26 = -pBLVRenderParams->vPartyPos.x; v27 = v9; @@ -12384,7 +12376,7 @@ + pBLVRenderParams->vPartyPos.x * v4->pFacePlane_old.vNormal.x + pBLVRenderParams->vPartyPos.y * v4->pFacePlane_old.vNormal.y + pBLVRenderParams->vPartyPos.z * v4->pFacePlane_old.vNormal.z; - if ( v4->uAttributes & 1 && v4->uSectorID != v12->uSectorID ) + if (v4->TwoSided() && v4->uSectorID != v12->uSectorID ) v5 = -v5; v11 = v5 > 0; if ( v5 <= 0 ) @@ -13599,10 +13591,7 @@ else v50 = 1; } - pRenderer->_4A6776( - v47, - v49, - (Texture *)(pTextureIDs_pMapDirs[v50] != -1 ? (int)&pIcons_LOD->pTextures[pTextureIDs_pMapDirs[v50]] : 0)); + pRenderer->DrawTransparentRedShade(v47, v49, (Texture *)(pTextureIDs_pMapDirs[v50] != -1 ? (int)&pIcons_LOD->pTextures[pTextureIDs_pMapDirs[v50]] : 0)); } result = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu); v95 = 0; @@ -14163,62 +14152,6 @@ } -//----- (00443CE1) -------------------------------------------------------- -unsigned int LoadEventsToBuffer(const char *pContainerName, char *pBuffer, unsigned int uBufferSize) -{ - FILE *pLodFile; // eax@1 - unsigned int uTextureSize; // esi@3 - char Args[60]; // [sp+8h] [bp-B4h]@6 - void *ptr; // [sp+B8h] [bp-4h]@1 - Texture DstBuf; // [sp+6Ch] [bp-50h]@1 - - ptr = pEvents_LOD->LoadRaw(pContainerName, 0); - pLodFile = pEvents_LOD->FindContainer(pContainerName, 0); - if ( !pLodFile ) - Abortf("Unable to load %s", pContainerName); - fread(&DstBuf, 1, 48, pLodFile); - uTextureSize = DstBuf.uDecompressedSize; - if ( !DstBuf.uDecompressedSize ) - uTextureSize = DstBuf.uTextureSize; - memset(&DstBuf, 0, 72); - if ( uTextureSize >= (signed int)uBufferSize ) - { - sprintf(Args, "File %s Size %lu - Buffer size %lu", pContainerName, uTextureSize, uBufferSize); - Abortf(Args); - } - memcpy(pBuffer, ptr, uTextureSize); - pAllocator->FreeChunk(ptr); - return uTextureSize; -} - -//----- (00443DA1) -------------------------------------------------------- -void __cdecl Initialize_GlobalEVT() -{ - signed int v0; // esi@1 - unsigned int v1; // ecx@2 - char *v2; // eax@2 - - v0 = 0; - uGlobalEVT_Size = LoadEventsToBuffer("global.evt", pGlobalEVT, 0xB400u); - if ( uGlobalEVT_Size ) - { - uGlobalEVT_NumEvents = 0; - memset(pGlobalEVT_Events, 128, 0xCE40u); - v1 = uGlobalEVT_NumEvents; - v2 = (char *)&pGlobalEVT_Events[uGlobalEVT_NumEvents].field_4; - do - { - ++v1; - *((int *)v2 - 1) = (unsigned __int8)pGlobalEVT[v0 + 1] + ((unsigned __int8)pGlobalEVT[v0 + 2] << 8); - *(int *)v2 = (unsigned __int8)pGlobalEVT[v0 + 3]; - *((int *)v2 + 1) = v0; - v2 += 12; - v0 += (unsigned __int8)pGlobalEVT[v0] + 1; - } - while ( v0 < (signed int)uGlobalEVT_Size ); - uGlobalEVT_NumEvents = v1; - } -} //----- (00443E31) -------------------------------------------------------- void __cdecl LoadLevel_InitializeLevelStr() @@ -14279,28 +14212,6 @@ } } -//----- (00443EF8) -------------------------------------------------------- -void __cdecl LoadLevel_InitializeLevelEvt() -{ - if (!uLevelEVT_Size) - return; - - memset(array_5B5928, 0, 0xC80u); - memset(pLevelEVT_Events, 128, 0xCE40u); - - uLevelEVT_NumEvents = 0; - dword_5B65C8 = 0; - - for (uint i = 0, j = 0; j < uLevelEVT_Size; ++i) - { - pLevelEVT_Events[i].uEventID = pLevelEVT[j + 1] + ((unsigned short)pLevelEVT[j + 2] << 8); - pLevelEVT_Events[i].field_4 = pLevelEVT[j + 3]; - pLevelEVT_Events[i].uEventOffsetInEVT = j; - j += pLevelEVT[j] + 1; - - uLevelEVT_NumEvents++; - } -} //----- (00443F95) -------------------------------------------------------- void __cdecl OnMapLeave() @@ -14312,7 +14223,7 @@ v0 = 0; if ( (signed int)uLevelEVT_NumEvents > 0 ) { - v1 = (char *)&pLevelEVT_Events[0].field_4; + v1 = (char *)&pLevelEVT_Index[0].event_sequence_num; do { if ( pLevelEVT[*((short *)v1 + 2) + 4] == 53 ) @@ -14346,15 +14257,15 @@ signed __int64 v14; // qax@26 int v15; // ST58_4@26 signed __int64 v16; // qax@26 - int v17; // ebx@26 + int hours; // ebx@26 unsigned __int64 v18; // [sp+Ch] [bp-44h]@12 - signed __int64 v19; // [sp+14h] [bp-3Ch]@26 + signed __int64 seconds; // [sp+14h] [bp-3Ch]@26 unsigned __int64 v20; // [sp+1Ch] [bp-34h]@7 - int v22; // [sp+2Ch] [bp-24h]@26 - int v24; // [sp+34h] [bp-1Ch]@26 - int v25; // [sp+38h] [bp-18h]@26 + int minutes; // [sp+2Ch] [bp-24h]@26 + int month; // [sp+34h] [bp-1Ch]@26 + int weeks; // [sp+38h] [bp-18h]@26 int v26; // [sp+3Ch] [bp-14h]@15 - int v27; // [sp+3Ch] [bp-14h]@26 + int days; // [sp+3Ch] [bp-14h]@26 int v28; // [sp+40h] [bp-10h]@26 __int16 v29; // [sp+46h] [bp-Ah]@9 __int16 v30; // [sp+48h] [bp-8h]@9 @@ -14364,34 +14275,34 @@ for (uint i = 0; i < uLevelEVT_NumEvents; ++i) { - auto pEvent = pLevelEVT_Events + i; - - auto _evt = (_evt_raw *)(pLevelEVT + pEvent->uEventOffsetInEVT); - - if (_evt->v4 == 3) + auto pEvent = pLevelEVT_Index[i]; + + auto _evt = (_evt_raw *)(pLevelEVT + pEvent.uEventOffsetInEVT); + + if (_evt->_e_type == EVENT_PlaySound) { pSoundList->LoadSound( _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((unsigned int)_evt->v8 << 8)) << 8)) << 8), 0); } - else if (_evt->v4 == 37) - { - dword_597F18 = pEvent->field_4; - EventProcessor(pEvent->uEventID, 0, 0); + else if (_evt->_e_type == EVENT_OnMapReload) + { + dword_597F18 = pEvent.event_sequence_num; + EventProcessor(pEvent.uEventID, 0, 0); dword_597F18 = 0; } - else if (_evt->v4 == 31 || _evt->v4 == 38) + else if (_evt->_e_type == EVENT_OnTimer || _evt->_e_type == EVENT_OnLongTimer) { v3 = &array_5B5928[dword_5B65C8]; v20 = pOutdoor->uLastVisitDay; if (uCurrentlyLoadedLevelType == LEVEL_Indoor) v20 = pIndoor->stru1.uLastVisitDay; - v4 = _evt->v4; + v4 = _evt->_e_type; v3->field_1C = v4; - v3->field_8 = pEvent->uEventID; - v3->field_A = pEvent->field_4; + v3->field_8 = pEvent.uEventID; + v3->field_A = pEvent.event_sequence_num; v33 = _evt->v6; v3->field_12 = v33; v32 = _evt->v7; @@ -14420,9 +14331,8 @@ { if ( v5 ) { - v3->field_4 = 0; ++dword_5B65C8; - v3->field_0 = 0; + v3->field_0_time = 0; continue; } } @@ -14430,9 +14340,8 @@ v26 / 7 != 0 && v32 != 0 || v26 != 0 || !v20) { - v3->field_4 = 0; ++dword_5B65C8; - v3->field_0 = 0; + v3->field_0_time = 0; continue; } } @@ -14440,30 +14349,30 @@ v8 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375); v9 = v8; v10 = (signed int)v8 / 60; - v22 = v10 % 60; + minutes = v10 % 60; v11 = (signed int)(v10 / 60); v12 = v11 % 24; v13 = (signed int)(v11 / 24); - v27 = v13 % 7; + days = v13 % 7; v14 = (signed int)(v13 / 7); v15 = v14 % 4; v16 = (signed int)(v14 / 4); - v24 = v16 / 12; + month = v16 / 12; auto _1 = (unsigned __int64)((double)pParty->uTimePlayed * 0.234375) >> 32; auto _2 = ((__int64)v9 << 32) | _1; - v19 = _2 % 60; + seconds = _2 % 60; //v19 = (signed __int64)__PAIR__((unsigned __int64)(signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) >> 32, // v9) // % 60; - v17 = v12; - v25 = v15; + hours = v12; + weeks = v15; v28 = v16 % 12; if ( v5 ) { - ++v24; + ++month; } else { @@ -14475,28 +14384,26 @@ { if ( v32 ) { - ++v25; + ++weeks; } else { - ++v27; - v22 = v30; - v17 = v31; - v19 = v29; - } - } - } - auto v0 = (signed __int64)((double)((v19 - + 0x3C * v22 - + 0xE10 * v17 - + 0x93A80 * v25 - + 0x15180 * v27 - + 0x24EA00 * (v28 + 12i64 * v24)) << 7) + ++days; + minutes = v30; + hours = v31; + seconds = v29; + } + } + } + v3->field_0_time = (signed __int64)((double)((seconds + + 60 * minutes + + 3600 * hours + + 0x93A80 * weeks + + 0x15180 * days + + 0x24EA00 * (v28 + 12i64 * month)) << 7) * 0.033333335); - v3->field_4 = HIDWORD(v0); ++dword_5B65C8; - v3->field_0 = v0; } } } @@ -14575,7 +14482,7 @@ pY = pOutdoor->pBModels[v4].vBoundingCenter.y - v20; v5 = abs((signed)pY); v6 = abs((signed)pX); - v7 = sub_4621DA(v6, v5, v2); + v7 = int_get_vector_length(v6, v5, v2); v8 = &pOutdoor->pBModels[0]; if ( v7 < 2 * pOutdoor->pBModels[v4].sBoundingRadius ) { @@ -14676,7 +14583,7 @@ pY = *(int *)((char *)&pOutdoor->pBModels[v4].vBoundingCenter.y) - LODWORD(v19); v5 = abs((signed)pY); v6 = abs((signed)pX); - v7 = sub_4621DA(v6, v5, 0); + v7 = int_get_vector_length(v6, v5, 0); v8 = &pOutdoor->pBModels; if ( v7 < *(int *)((char *)&pOutdoor->pBModels[v4].sBoundingRadius) ) { @@ -15817,7 +15724,7 @@ v3 = dword_597F18; pSomeOtherEVT = pGlobalEVT; uSomeOtherEVT_NumEvents = uGlobalEVT_NumEvents; - memcpy(pSomeOtherEVT_Events, pGlobalEVT_Events, 0xCE40u); + memcpy(pSomeOtherEVT_Events, pGlobalEVT_Index, 0xCE40u); v4 = 1; v12 = 1; v11 = 0; @@ -15826,7 +15733,7 @@ do { v5 = v1; - if ( (void *)pSomeOtherEVT_Events[v1].uEventID == v13 && pSomeOtherEVT_Events[v5].field_4 == v3 ) + if ( (void *)pSomeOtherEVT_Events[v1].uEventID == v13 && pSomeOtherEVT_Events[v5].event_sequence_num == v3 ) { v6 = pSomeOtherEVT_Events[v5].uEventOffsetInEVT; v7 = &pSomeOtherEVT[v6]; @@ -15887,1527 +15794,6 @@ } -//----- (0044684A) -------------------------------------------------------- -void __fastcall EventProcessor(int uEventID, int a2, int a3) -{ - unsigned int v3; // eax@5 - //signed int v4; // esi@7 - //char *v5; // eax@8 - Player *v6; // ecx@8 - //char *v7; // ebp@8 - //signed int v8; // edx@10 - //int v9; // edi@12 - //ByteArray *v10; // esi@12 - int v11; // eax@14 - char *v12; // eax@15 - //char *v13; // edi@21 - int v14; // ebp@21 - int v15; // edi@21 - const char *v16; // esi@21 - bool v17; // edx@21 - int v18; // ecx@22 - int v19; // ebp@36 - signed int v20; // ecx@40 - int v21; // eax@40 - int v22; // edx@40 - int v23; // eax@40 - unsigned __int16 v24; // ax@45 - int v25; // eax@54 - LevelDecoration *v26; // eax@55 - int v27; // eax@57 - int v28; // ecx@57 - int v29; // edx@58 - int v30; // eax@58 - int v31; // ecx@58 - int v32; // esi@58 - NPCData *v33; // ecx@58 - int v34; // esi@59 - int v35; // esi@60 - int v36; // esi@61 - int v37; // esi@62 - int v38; // eax@78 - int v39; // ecx@78 - size_t v40; // edx@78 - Actor *v41; // esi@79 - int v42; // eax@84 - int v43; // ecx@84 - size_t v44; // edx@84 - Actor *v45; // esi@85 - void *v46; // eax@91 - GUIWindow *v47; // eax@93 - GUIButton *v48; // ecx@93 - GUIButton *v49; // esi@94 - char v50; // al@100 - Player *v51; // esi@103 - Player *v52; // ecx@106 - int v53; // ecx@107 - char v54; // al@111 - Player *v55; // esi@114 - Player *v56; // ecx@117 - int v57; // ecx@118 - signed int v58; // ebp@124 - Player *v59; // esi@125 - int v60; // eax@126 - int v61; // edx@133 - int v62; // eax@139 - void *v63; // ebp@145 - signed int v64; // edi@146 - unsigned int v65; // edx@148 - Player *v66; // ecx@148 - int v67; // esi@148 - signed int v68; // eax@151 - int v69; // esi@151 - Player *v70; // ecx@158 - unsigned int v71; // eax@159 - int v72; // esi@159 - signed int v73; // eax@162 - int v74; // esi@162 - int v75; // edx@172 - Player *v76; // esi@173 - signed int v77; // ebp@186 - int v78; // edx@186 - Player *v79; // esi@187 - signed int v80; // ebp@200 - int v81; // edx@200 - Player *v82; // esi@201 - int v83; // eax@212 - int v84; // ebp@220 - signed int v85; // ebp@224 - char v86; // al@224 - Player *v87; // esi@227 - Player *v88; // ecx@231 - int v89; // ecx@232 - int v90; // eax@243 - const char *v91; // ecx@247 - int v92; // eax@251 - char *v93; // eax@252 - int v94; // ecx@262 - int v95; // ebp@262 - int v96; // edx@262 - int v97; // eax@262 - unsigned int v98; // edx@265 - const char *v99; // esi@267 - int v100; // edx@267 - //char *v101; // edi@281 - unsigned int v102; // esi@281 - int v103; // edi@284 - int v104; // eax@288 - int v105; // edx@294 - int v106; // [sp-20h] [bp-4C8h]@278 - signed int v107; // [sp-1Ch] [bp-4C4h]@278 - unsigned int v108; // [sp-18h] [bp-4C0h]@278 - signed int v109; // [sp-14h] [bp-4BCh]@278 - signed int v110; // [sp-10h] [bp-4B8h]@278 - int v111; // [sp-Ch] [bp-4B4h]@278 - Event *v112; // [sp-8h] [bp-4B0h]@5 - int v113; // [sp-8h] [bp-4B0h]@106 - int v114; // [sp-8h] [bp-4B0h]@117 - signed int v115; // [sp-8h] [bp-4B0h]@231 - unsigned int v116; // [sp-8h] [bp-4B0h]@278 - int v117; // [sp-4h] [bp-4ACh]@106 - int v118; // [sp-4h] [bp-4ACh]@117 - int v119; // [sp-4h] [bp-4ACh]@231 - int v120; // [sp-4h] [bp-4ACh]@278 - int v121; // [sp-4h] [bp-4ACh]@294 - int v122; // [sp+10h] [bp-498h]@4 - //char *v123; // [sp+14h] [bp-494h]@0 - //signed int v124; // [sp+18h] [bp-490h]@7 - signed int v125; // [sp+1Ch] [bp-48Ch]@155 - int v126; // [sp+1Ch] [bp-48Ch]@262 - int v127; // [sp+20h] [bp-488h]@4 - int v128; // [sp+24h] [bp-484h]@21 - int v129; // [sp+24h] [bp-484h]@262 - signed int v130; // [sp+28h] [bp-480h]@0 - //int v131; // [sp+2Ch] [bp-47Ch]@1 - int v132; // [sp+30h] [bp-478h]@262 - signed int v133; // [sp+34h] [bp-474h]@1 - int v134; // [sp+38h] [bp-470h]@262 - int v135; // [sp+3Ch] [bp-46Ch]@262 - int v136; // [sp+40h] [bp-468h]@40 - int v137; // [sp+44h] [bp-464h]@40 - int v138; // [sp+48h] [bp-460h]@40 - int v139; // [sp+4Ch] [bp-45Ch]@40 - ItemGen item; // [sp+50h] [bp-458h]@15 - char Source[120]; // [sp+74h] [bp-434h]@15 - char Str[120]; // [sp+ECh] [bp-3BCh]@21 - Actor Dst; // [sp+164h] [bp-344h]@53 - - //v131 = uEventID; - v133 = 0; - dword_5B5920 = a2; - dword_5B65C4 = 0; - if ( !a1 ) - { - if ( !GameUI_StatusBar_TimedStringTimeLeft ) - ShowStatusBarString(pGlobalTXT_LocalizationStrings[521], 2u);// Nothing here - return; - } - v127 = 2 * (uActiveCharacter == 0) + 4; - v122 = dword_597F18; - if ( _5C3420_pDecoration ) - { - v3 = uGlobalEVT_NumEvents; - pSomeEVT = pGlobalEVT; - v112 = pGlobalEVT_Events; - } - else - { - v3 = uLevelEVT_NumEvents; - pSomeEVT = pLevelEVT; - v112 = pLevelEVT_Events; - } - uSomeEVT_NumEvents = v3; - memcpy(pSomeEVT_Events, v112, 0xCE40u); - //v4 = 0; - //v124 = 0; - for (uint i = 0; i < uSomeEVT_NumEvents; ++i) - { - //v5 = pSomeEVT; - //v6 = v123; - //v7 = ""; - //while ( 1 ) - //{ - if ( dword_5B65C4 ) - goto LABEL_301; - //v8 = v4; - if ( pSomeEVT_Events[i/*v4*/].uEventID == uEventID && pSomeEVT_Events[i/*v4*/].field_4 == v122 ) - { - //v9 = pSomeEVT_Events[v8].uEventOffsetInEVT; - //v10 = (ByteArray *)&v5[v9]; - auto _evt = (_evt_raw *)(pSomeEVT + pSomeEVT_Events[i/*v4*/].uEventOffsetInEVT); - - switch (_evt->v4) - { - case EVENT_CheckSeason: - if ( !sub_4465DF_check_season(_evt->v5) ) - { - ++v122; - //v4 = v124; - //v5 = pSomeEVT; - //v6 = v123; - //v7 = ""; - break; - } - v11 = _evt->v6; - goto LABEL_130; - case EVENT_ShowMovie: - strcpy(Source, (char *)&_evt->v7); - v12 = (char *)&item.uExpireTime + strlen(Source) + 7; - if ( *v12 == 32 ) - *v12 = 0; - if ( pVideoPlayer->field_54 ) - pVideoPlayer->Unload(); - pVideoPlayer->bStopBeforeSchedule = 0; - pVideoPlayer->pResetflag = 0; - if (pAsyncMouse) - pAsyncMouse->Suspend(); - v128 = pCurrentScreen; - //v13 = &pSomeEVT[v9]; - //v14 = (unsigned __int8)v13[5]; - //v15 = (unsigned __int8)v13[6]; - v14 = _evt->v5; - v15 = _evt->v6; - strcpy(Str, Source); - v16 = RemoveQuotes(Str); - VideoPlayer::MovieLoop(v16, 0, v14, 1); - if ( !_strcmpi(v16, "arbiter good") ) - { - pParty->uAlignment = 0; - v18 = 0; - LOBYTE(v17) = 1; - SetUserInterface(v18, v17); - if ( !v15 || v128 == 3 ) - { - pCurrentScreen = v128; - if ( v128 == 3 ) - pGameLoadingUI_ProgressBar->uType = GUIProgressBar::TYPE_Fullscreen; - if ( v128 == 13 ) - pVideoPlayer->_4BF28F(pAnimatedRooms[uCurrentHouse_Animation].field_0, 1u); - } - if (pAsyncMouse) - pAsyncMouse->Resume(); - ++v122; - //v4 = v124; - //v5 = pSomeEVT; - //v6 = v123; - //v7 = ""; - break; - } - if ( !_strcmpi(v16, "arbiter evil") ) - { - v18 = 2; - pParty->uAlignment = 2; - LOBYTE(v17) = 1; - SetUserInterface(v18, v17); - if ( !v15 || v128 == 3 ) - { - pCurrentScreen = v128; - if ( v128 == 3 ) - pGameLoadingUI_ProgressBar->uType = GUIProgressBar::TYPE_Fullscreen; - if ( v128 == 13 ) - pVideoPlayer->_4BF28F(pAnimatedRooms[uCurrentHouse_Animation].field_0, 1u); - } - if (pAsyncMouse) - pAsyncMouse->Resume(); - ++v122; - //v4 = v124; - //v5 = pSomeEVT; - //v6 = v123; - //v7 = ""; - break; - } - if ( !_strcmpi(v16, "pcout01") ) // moving to harmondale from emerald isle - { - Rest(0x2760u); - pParty->RestAndHeal(); - pParty->field_764 = 0; - } - if ( !v15 || v128 == 3 ) - { - pCurrentScreen = v128; - if ( v128 == 3 ) - pGameLoadingUI_ProgressBar->uType = GUIProgressBar::TYPE_Fullscreen; - if ( v128 == 13 ) - pVideoPlayer->_4BF28F(pAnimatedRooms[uCurrentHouse_Animation].field_0, 1u); - } - if (pAsyncMouse) - pAsyncMouse->Resume(); - ++v122; - //v4 = v124; - //v5 = pSomeEVT; - //v6 = v123; - //v7 = ""; - break; - case EVENT_CheckSkill: - v19 = _evt->v7 + ((_evt->v8 + ((_evt->v9 + ((unsigned int)_evt->v10 << 8)) << 8)) << 8); - if ( v127 < 0 ) - goto LABEL_47; - if ( v127 <= 3 ) - { - v24 = pParty->pPlayers[0].pActiveSkills[3486 * v127 + _evt->v5]; - } - else - { - if ( v127 == 4 ) - { - v24 = pPlayers[uActiveCharacter]->pActiveSkills[_evt->v5]; - } - else - { - if ( v127 == 5 ) - { - v20 = 0; - v21 = 3486 * v130 + _evt->v5; - v136 = 1; - LOWORD(v21) = pParty->pPlayers[0].pActiveSkills[v21]; - v137 = v21 & 0x40; - v138 = v21 & 0x80; - v22 = v21 & 0x100; - v23 = v21 & 0x3F; - v139 = v22; - while ( v23 < v19 || !*(&v136 + _evt->v6) ) - { - ++v20; - if ( v20 >= 4 ) - { - ++v122; - //v4 = v124; - //v5 = pSomeEVT; - //v6 = v123; - //v7 = ""; - break; - } - } - v11 = _evt->v11; - goto LABEL_130; - } -LABEL_47: - //v10 = (ByteArray *)&v5[v9]; - v24 = pParty->pPlayers[0].pActiveSkills[_evt->v5 + 3486 * rand() % 4]; - } - } - v136 = 1; - v137 = v24 & 0x40; - v138 = v24 & 0x80; - v139 = v24 & 0x100; - if ( (v24 & 0x3F) >= v19 && *(&v136 + _evt->v6) ) - { - v11 = _evt->v11; - goto LABEL_130; - } - ++v122; - //v4 = v124; - //v5 = pSomeEVT; - //v6 = v123; - //v7 = ""; - break; - case EVENT_SpeakNPC: - if ( a3 ) - { - //Actor::Actor(&Dst); - memset(&Dst, 0, 0x344u); - dword_5B65D0_dialogue_actor_npc_id = _evt->v5 - + ((_evt->v6 - + ((_evt->v7 - + ((unsigned int)_evt->v8 << 8)) << 8)) << 8); - Dst.uNPC_ID = dword_5B65D0_dialogue_actor_npc_id; - Dst.InitializeDialogue(0); - } - else - { - bDialogueUI_InitializeActor_NPC_ID = _evt->v5 - + ((_evt->v6 + ((_evt->v7 + ((unsigned int)_evt->v8 << 8)) << 8)) << 8); - } - ++v122; - //v4 = v124; - //v5 = pSomeEVT; - //v6 = v123; - //v7 = ""; - break; - case EVENT_ChangeEvent: - v25 = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((unsigned int)_evt->v8 << 8)) << 8)) << 8); - if ( v25 ) - { - stru_5E4C90._decor_events[_5C3420_pDecoration->_idx_in_stru123 - 75] = _evt->v5 - 124; - } - else - { - v26 = _5C3420_pDecoration; - stru_5E4C90._decor_events[_5C3420_pDecoration->_idx_in_stru123 - 75] = 0; - LOBYTE(v26->field_2) |= 0x20u; - } - ++v122; - //v4 = v124; - //v5 = pSomeEVT; - //v6 = v123; - //v7 = ""; - break; - case EVENT_SetNPCGreeting: - v27 = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8); - v28 = _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8); - pNPCStats->pNewNPCData[v27].uFlags &= 0xFFFFFFFCu; - pNPCStats->pNewNPCData[v27].greet = v28; - ++v122; - //v4 = v124; - //v5 = pSomeEVT; - //v6 = v123; - //v7 = ""; - break; - case EVENT_SetNPCTopic: - v29 = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8); - v30 = _evt->v10 + ((_evt->v11 + ((_evt->v12 + ((uint)_evt->v13 << 8)) << 8)) << 8); - v31 = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8); - v32 = _evt->v9; - v33 = &pNPCStats->pNewNPCData[v31]; - if ( v32 ) - { - v34 = v32 - 1; - if ( v34 ) - { - v35 = v34 - 1; - if ( v35 ) - { - v36 = v35 - 1; - if ( v36 ) - { - v37 = v36 - 1; - if ( v37 ) - { - if ( v37 == 1 ) - v33->evt_F = v30; - } - else - { - v33->evt_E = v30; - } - } - else - { - v33->evt_D = v30; - } - } - else - { - v33->evt_C = v30; - } - } - else - { - v33->evt_B = v30; - } - } - else - { - v33->evt_A = v30; - } - if ( v29 == 8 ) - { - if ( v30 == 78 ) - { - sub_4BD8B5(); - ptr_507BC0->Release(); - pParty->uFlags &= 0xFFFFFFFDu; - if ( EnterHouse((enum HOUSE_TYPE)170) ) - { - pAudioPlayer->StopChannels(-1, -1); - ptr_507BC0 = GUIWindow::Create(0, 0, 640, 480, WINDOW_HouseInterior, 170, 0); - ptr_507BC0->CreateButton(0x3Du, 0x1A8u, 0x1Fu, 0, 2, 94, 0x6Eu, 1u, 0x31u, "", 0); - ptr_507BC0->CreateButton(0xB1u, 0x1A8u, 0x1Fu, 0, 2, 94, 0x6Eu, 2u, 0x32u, "", 0); - ptr_507BC0->CreateButton(0x124u, 0x1A8u, 0x1Fu, 0, 2, 94, 0x6Eu, 3u, 0x33u, "", 0); - ptr_507BC0->CreateButton(0x197u, 0x1A8u, 0x1Fu, 0, 2, 94, 0x6Eu, 4u, 0x34u, "", 0); - ptr_507BC0->CreateButton(0, 0, 0, 0, 1, 0, 0xB0u, 0, 9u, "", 0); - ptr_F8B1E8 = pNPCTopics[90].pText; - } - } - } - ++v122; - //v4 = v124; - //v5 = pSomeEVT; - //v6 = v123; - //v7 = ""; - break; - case EVENT_NPCSetItem: - sub_448518_npc_set_item(_evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8), - _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8), _evt->v13); - ++v122; - //v4 = v124; - //v5 = pSomeEVT; - //v6 = v123; - //v7 = ""; - break; - case EVENT_SetActorItem: - Actor::GiveItem(_evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8), - _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8), _evt->v13); - ++v122; - //v4 = v124; - //v5 = pSomeEVT; - //v6 = v123; - //v7 = ""; - break; - case EVENT_SetNPCGroupNews: - pNPCStats->pGroups_copy[_evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8)] = _evt->v9 + ((uint)_evt->v10 << 8); - ++v122; - //v4 = v124; - //v5 = pSomeEVT; - //v6 = v123; - //v7 = ""; - break; - case EVENT_SetActorGroup: - __debugbreak(); - *(&pActors[0].uGroup + 0x11000000 * _evt->v8 + 209 * (_evt->v5 + ((_evt->v6 + ((uint)_evt->v7 << 8)) << 8))) = _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8); - ++v122; - //v4 = v124; - //v5 = pSomeEVT; - //v6 = v123; - //v7 = ""; - break; - case EVENT_ChangeGroup: - v38 = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8); - v39 = _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8); - v40 = uNumActors; - __debugbreak(); - if ( (signed int)uNumActors > 0 ) - { - v41 = pActors;//[0].uGroup; - do - { - if ( v41->uGroup == v38 ) - v41->uGroup = v39; - ++v41; - --v40; - } - while ( v40 ); - } - ++v122; - //v4 = v124; - //v5 = pSomeEVT; - //v6 = v123; - //v7 = ""; - break; - case EVENT_ChangeGroupAlly: - v42 = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8); - v43 = _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8); - v44 = uNumActors; - __debugbreak(); - if ( (signed int)uNumActors > 0 ) - { - v45 = pActors;//[0].uAlly; - do - { - if ( v45->uGroup == v42 ) - v45->uAlly = v43; - ++v45; - --v44; - } - while ( v44 ); - } - ++v122; - //v4 = v124; - //v5 = pSomeEVT; - //v6 = v123; - //v7 = ""; - break; - case EVENT_MoveNPC: - pNPCStats->pNewNPCData[_evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8)].Location2D = _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8); - if ( ptr_507BC0 ) - { - v46 = ptr_507BC0->ptr_1C; - if ( v46 == (void *)165 ) - { - sub_4BD8B5(); - pVideoPlayer->Unload(); - ptr_507BC0->Release(); - pParty->uFlags &= 0xFFFFFFFDu; - _5C3420_pDecoration = (LevelDecoration *)1; - if ( EnterHouse((enum HOUSE_TYPE)165) ) - { - pAudioPlayer->PlaySound((SoundID)0, 0, 0, -1, 0, 0, 0, 0); - v47 = GUIWindow::Create(0, 0, 640, 480, WINDOW_HouseInterior, 165, 0); - ptr_507BC0 = v47; - v48 = v47->pControlsHead; - if ( v48 ) - { - do - { - v49 = v48->pNext; - pAllocator->FreeChunk(v48); - v48 = v49; - } - while ( v49 ); - v47 = ptr_507BC0; - } - v47->pControlsHead = 0; - ptr_507BC0->pControlsTail = 0; - ptr_507BC0->uNumControls = 0; - } - } - else - { - if ( v46 == (void *)553 ) - pVideoPlayer->bLoopPlaying = 0; - } - } - ++v122; - //v4 = v124; - //v5 = pSomeEVT; - //v6 = v123; - //v7 = ""; - break; - case EVENT_Jmp: - //v124 = -1; - v122 = _evt->v5 - 1; - ++v122; - //v4 = v124; - //v5 = pSomeEVT; - //v6 = v123; - //v7 = ""; - break; - case EVENT_ShowFace: - v50 = _evt->v5; - if ( (unsigned __int8)v50 <= 3u ) - { - v117 = 0; - v113 = _evt->v6; - v53 = (unsigned __int8)v50; - v52 = &pParty->pPlayers[v53]; - v52->PlayEmotion((CHARACTER_EXPRESSION_ID)v113, v117); - ++v122; - //v4 = v124; - //v5 = pSomeEVT; - //v6 = v123; - //v7 = ""; - break; - } - if ( v50 == 4 ) - { - v117 = 0; - v113 = _evt->v6; - v52 = pPlayers[uActiveCharacter]; - v52->PlayEmotion((CHARACTER_EXPRESSION_ID)v113, v117); - ++v122; - //v4 = v124; - //v5 = pSomeEVT; - //v6 = v123; - //v7 = ""; - break; - } - if ( v50 != 5 ) - { - v117 = 0; - v113 = _evt->v6; - v53 = rand() % 4; - v52 = &pParty->pPlayers[v53]; - v52->PlayEmotion((CHARACTER_EXPRESSION_ID)v113, v117); - ++v122; - //v4 = v124; - //v5 = pSomeEVT; - //v6 = v123; - //v7 = ""; - break; - } - v51 = pParty->pPlayers; - do - { - v51->PlayEmotion((CHARACTER_EXPRESSION_ID)_evt->v6, 0); - ++v51; - } - while ( (signed int)v51 < (signed int)pParty->pHirelings ); -//LABEL_291: - ++v122; - //v4 = v124; - //v5 = pSomeEVT; - //v6 = v123; - //v7 = ""; - break; - case EVENT_CharacterAnimation: - v54 = _evt->v5; - if ( (unsigned __int8)v54 <= 3u ) - { - v118 = 0; - v114 = _evt->v6; - v57 = (unsigned __int8)v54; - goto LABEL_119; - } - if ( v54 == 4 ) - { - v118 = 0; - v114 = _evt->v6; - v56 = pPlayers[uActiveCharacter]; - goto LABEL_120; - } - if ( v54 != 5 ) - { - v118 = 0; - v114 = _evt->v6; - v57 = rand() % 4; -LABEL_119: - v56 = &pParty->pPlayers[v57]; -LABEL_120: - v56->PlaySound((PlayerSpeech)v114, v118); - ++v122; - //v4 = v124; - //v5 = pSomeEVT; - //v6 = v123; - //v7 = ""; - break; - } - v55 = pParty->pPlayers; - for (int iii = 0; iii < 4; ++iii) - { - v55->PlaySound((PlayerSpeech)_evt->v6, 0); - ++v55; - } - //while ( (signed int)v55 < (signed int)pParty->pHirelings ); - ++v122; - //v4 = v124; - //v5 = pSomeEVT; - //v6 = v123; - //v7 = ""; - break; - case EVENT_ForPartyMember: - v127 = _evt->v5; - ++v122; - //v4 = v124; - //v5 = pSomeEVT; - //v6 = v123; - //v7 = ""; - break; - case EVENT_SummonItem: - sub_42F7EB_DropItemAt(_evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8), - _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8), - _evt->v13 + ((_evt->v14 + ((_evt->v15 + ((uint)_evt->v16 << 8)) << 8)) << 8), - _evt->v17 + ((_evt->v18 + ((_evt->v19 + ((uint)_evt->v20 << 8)) << 8)) << 8), - _evt->v21 + ((_evt->v22 + ((_evt->v23 + ((uint)_evt->v24 << 8)) << 8)) << 8), - _evt->v25, _evt->v26, 0, 0); - ++v122; - //v4 = v124; - //v5 = pSomeEVT; - //v6 = v123; - //v7 = ""; - break; - case EVENT_Compare: - v58 = _evt->v7 + ((_evt->v8 + ((_evt->v9 + ((uint)_evt->v10 << 8)) << 8)) << 8); - if ( v127 == 5 ) - { - v130 = 0; - v59 = pParty->pPlayers; - while ( 1 ) - { - LOBYTE(v60) = v59->CompareVariable((enum VariableType)(_evt->v5 + ((uint)_evt->v6 << 8)), v58); - if ( v60 ) - break; - ++v130; - ++v59; - if ( (signed int)v59 >= (signed int)pParty->pHirelings ) - { - ++v122; - //v4 = v124; - //v5 = pSomeEVT; - //v6 = v123; - //v7 = ""; - break; - } - } -LABEL_129: - v11 = _evt->v11; - goto LABEL_130; - } - if ( v127 < 0 ) - goto LABEL_139; - v61 = v127; - if ( v127 <= 3 ) - goto LABEL_137; - if ( v127 == 4 ) - { - if ( uActiveCharacter ) - { - v6 = pPlayers[uActiveCharacter]; - goto LABEL_138; - } - } - else - { - if ( v127 != 6 ) - goto LABEL_139; - } - v61 = rand() % 4; - //v5 = pSomeEVT; -LABEL_137: - v6 = &pParty->pPlayers[v61]; -LABEL_138: - //v123 = v6; -LABEL_139: - LOBYTE(v62) = ((Player *)v6)->CompareVariable( - (enum VariableType)(_evt->v5 + ((uint)_evt->v6 << 8)), - v58); -LABEL_140: - if ( v62 ) - goto LABEL_129; - ++v122; - //v4 = v124; - //v5 = pSomeEVT; - //v6 = v123; - //v7 = ""; - break; - case EVENT_IsActorAlive: - v62 = IsActorAlive( - _evt->v5, - _evt->v6 + ((_evt->v7 + ((_evt->v8 + ((uint)_evt->v9 << 8)) << 8)) << 8), - _evt->v10); - goto LABEL_140; - case EVENT_Substract: - v63 = (void *)(_evt->v7 + ((_evt->v8 + ((_evt->v9 + ((uint)_evt->v10 << 8)) << 8)) << 8)); - if ( _evt->v5 + ((uint)_evt->v6 << 8) == VAR_PlayerItemInHands ) - { - v64 = 0; - if ( (void *)pParty->pPickedItem.uItemID == v63 ) - { - pMouse->RemoveHoldingItem(); - ++v122; - //v4 = v124; - //v5 = pSomeEVT; - //v6 = v123; - //v7 = ""; - break; - } - v65 = 0; - v66 = pPlayers[uActiveCharacter]; - v67 = (int)v66->pInventoryIndices; - do - { - if ( *(void **)&v66->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * *(int *)v67 + 5] == v63 ) - { - v66->RemoveItemAtInventoryIndex(v65); - ++v122; - //v4 = v124; - //v5 = pSomeEVT; - //v6 = v123; - //v7 = ""; - break; - } - ++v65; - v67 += 4; - } - while ( (signed int)v65 < 126 ); - v68 = 0; - v69 = (int)&v66->pEquipment; - do - { - if ( *(int *)v69 && *(void **)&v66->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * *(int *)v69 + 5] == v63 ) - { - *(&v66->pEquipment.uOffHand + v68) = 0; - ++v122; - //v4 = v124; - //v5 = pSomeEVT; - //v6 = v123; - //v7 = ""; - break; - } - ++v68; - v69 += 4; - } - while ( v68 < 16 ); - v125 = (signed int)&pPlayers[1]; - while ( 1 ) - { - v70 = *(Player **)v125; - if ( !v64 ) - { - v71 = 0; - v72 = (int)v70->pInventoryIndices; - do - { - if ( *(void **)&v70->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * *(int *)v72 + 5] == v63 ) - { - v70->RemoveItemAtInventoryIndex(v71); - goto LABEL_169; - } - ++v71; - v72 += 4; - } - while ( (signed int)v71 < 126 ); - v73 = 0; - v74 = (int)&v70->pEquipment; - while ( !*(int *)v74 - || *(void **)&v70->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * *(int *)v74 + 5] != v63 ) - { - ++v73; - v74 += 4; - if ( v73 >= 16 ) - goto LABEL_170; - } - *(&v70->pEquipment.uOffHand + v73) = 0; -LABEL_169: - v64 = 1; - } -LABEL_170: - v125 += 4; - if ( v125 > (signed int)&pPlayers[4] ) - { - ++v122; - //v4 = v124; - //v5 = pSomeEVT; - //v6 = v123; - //v7 = ""; - break; - } - } - } - v75 = v127; - if ( v127 != 5 ) - { - if ( v127 < 0 ) - goto LABEL_183; - if ( v127 > 3 ) - { - if ( v127 != 4 ) - { - if ( v127 == 6 ) - goto LABEL_180; -LABEL_183: - ((Player *)v6)->SubtractVariable((enum VariableType)(_evt->v5 + ((uint)_evt->v6 << 8)), v63); - ++v122; - //v4 = v124; - //v5 = pSomeEVT; - //v6 = v123; - //v7 = ""; - break; - } - if ( uActiveCharacter ) - { - v6 = pPlayers[uActiveCharacter]; - goto LABEL_182; - } -LABEL_180: - v75 = rand() % 4; - //v5 = pSomeEVT; - } - v6 = &pParty->pPlayers[v75]; -LABEL_182: - //v123 = v6; - goto LABEL_183; - } - v76 = pParty->pPlayers; - v130 = 4; - do - { - v76->SubtractVariable( - (enum VariableType)(_evt->v5 + ((uint)_evt->v6 << 8)), - v63); - ++v76; - } - while ( (signed int)v76 < (signed int)pParty->pHirelings ); - ++v122; - //v4 = v124; - //v5 = pSomeEVT; - //v6 = v123; - //v7 = ""; - break; - case EVENT_Set: - v77 = _evt->v7 + ((_evt->v8 + ((_evt->v9 + ((uint)_evt->v10 << 8)) << 8)) << 8); - v78 = v127; - if ( v127 != 5 ) - { - if ( v127 < 0 ) - goto LABEL_197; - if ( v127 > 3 ) - { - if ( v127 != 4 ) - { - if ( v127 == 6 ) - goto LABEL_194; -LABEL_197: - ((Player *)v6)->SetVariable((enum VariableType)(_evt->v5 + ((uint)_evt->v6 << 8)), v77); - ++v122; - //v4 = v124; - //v5 = pSomeEVT; - //v6 = v123; - //v7 = ""; - break; - } - if ( uActiveCharacter ) - { - v6 = pPlayers[uActiveCharacter]; - goto LABEL_196; - } -LABEL_194: - v78 = rand() % 4; - //v5 = pSomeEVT; - } - v6 = &pParty->pPlayers[v78]; -LABEL_196: - //v123 = v6; - goto LABEL_197; - } - v79 = pParty->pPlayers; - v130 = 4; - do - { - v79->SetVariable( - (enum VariableType)(_evt->v5 + ((uint)_evt->v6 << 8)), - v77); - ++v79; - } - while ( (signed int)v79 < (signed int)pParty->pHirelings ); - ++v122; - //v4 = v124; - //v5 = pSomeEVT; - //v6 = v123; - //v7 = ""; - break; - case EVENT_Add: - v80 = _evt->v7 + ((_evt->v8 + ((_evt->v9 + ((uint)_evt->v10 << 8)) << 8)) << 8); - v81 = v127; - if ( v127 != 5 ) - { - if ( v127 < 0 ) - goto LABEL_211; - if ( v127 > 3 ) - { - if ( v127 != 4 ) - { - if ( v127 == 6 ) - goto LABEL_208; -LABEL_211: - ((Player *)v6)->AddVariable( - (enum VariableType)(_evt->v5 + ((uint)_evt->v6 << 8)), - v80); - goto LABEL_212; - } - if ( uActiveCharacter ) - { - v6 = pPlayers[uActiveCharacter]; - goto LABEL_210; - } -LABEL_208: - v81 = rand() % 4; - //v5 = pSomeEVT; - } - v6 = &pParty->pPlayers[v81]; -LABEL_210: - //v123 = v6; - goto LABEL_211; - } - v82 = pParty->pPlayers; - v130 = 4; - do - { - v82->AddVariable( - (enum VariableType)(_evt->v5 + ((uint)_evt->v6 << 8)), - v80); - ++v82; - } - while ( (signed int)v82 < (signed int)pParty->pHirelings ); -LABEL_212: - v83 = _evt->v5 + ((uint)_evt->v6 << 8); - if ( v83 == 21 || v83 == 22 || v83 == 23 || v83 == 24 ) - viewparams->bRedrawGameUI = 1; - ++v122; - //v4 = v124; - //v5 = pSomeEVT; - //v6 = v123; - //v7 = ""; - break; - case EVENT_InputString: - if ( !dword_597F18 ) - { - strcpy( - GameUI_StatusBar_TimedString, - &pLevelStr[pLevelStrOffsets[_evt->v5 - + ((_evt->v6 - + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8)]]); - v105 = v122; - v121 = 26; -LABEL_295: - sub_4451A8_press_any_key(uEventID, v105, v121); -LABEL_301: - if ( v133 == 1 ) -LABEL_302: - OnMapLeave(); - return; - } - v84 = _evt->v13 + ((_evt->v14 + ((_evt->v15 + ((uint)_evt->v16 << 8)) << 8)) << 8); - if ( !_strcmpi( - GameUI_StatusBar_TimedString, - &pLevelStr[pLevelStrOffsets[_evt->v9 - + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8)]]) - || !_strcmpi(GameUI_StatusBar_TimedString, &pLevelStr[pLevelStrOffsets[v84]]) ) - { - v11 = _evt->v17; -LABEL_130: - //v124 = -1; -LABEL_131: - v122 = v11 - 1; - } - ++v122; - //v4 = v124; - //v5 = pSomeEVT; - //v6 = v123; - //v7 = ""; - break; - case EVENT_RandomGoTo: - //v124 = -1; - v11 = (unsigned __int8)*(&_evt->v5 + rand() % ((_evt->v5 != 0) + (_evt->v6 != 0) + (_evt->v7 != 0) + (_evt->v8 != 0) + (_evt->v9 != 0) - + (_evt->v10 != 0))); - goto LABEL_131; - case EVENT_ReceiveDamage: - v85 = _evt->v7 + ((_evt->v8 + ((_evt->v9 + ((uint)_evt->v10 << 8)) << 8)) << 8); - v86 = _evt->v5; - if ( (unsigned __int8)v86 <= 3u ) - { - v119 = _evt->v6; - v115 = _evt->v7 + ((_evt->v8 + ((_evt->v9 + ((uint)_evt->v10 << 8)) << 8)) << 8); - v89 = (unsigned __int8)v86; - goto LABEL_233; - } - if ( v86 == 4 ) - { - if ( !uActiveCharacter ) - { - ++v122; - //v4 = v124; - //v5 = pSomeEVT; - //v6 = v123; - //v7 = ""; - break; - } - v119 = _evt->v6; - v88 = pPlayers[uActiveCharacter]; - v115 = _evt->v7 + ((_evt->v8 + ((_evt->v9 + ((uint)_evt->v10 << 8)) << 8)) << 8); - goto LABEL_234; - } - if ( v86 != 5 ) - { - v119 = _evt->v6; - v115 = _evt->v7 + ((_evt->v8 + ((_evt->v9 + ((uint)_evt->v1 << 8)) << 8)) << 8); - v89 = rand() % 4; -LABEL_233: - v88 = &pParty->pPlayers[v89]; -LABEL_234: - v88->ReceiveDamage(v115, v119); - ++v122; - //v4 = v124; - //v5 = pSomeEVT; - //v6 = v123; - //v7 = ""; - break; - } - v87 = pParty->pPlayers; - do - { - v87->ReceiveDamage(v85, _evt->v6); - ++v87; - } - while ( (signed int)v87 < (signed int)pParty->pHirelings ); - ++v122; - //v4 = v124; - //v5 = pSomeEVT; - //v6 = v123; - //v7 = ""; - break; - case EVENT_ToggleIndoorLight: - pIndoor->ToggleLight(_evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8), _evt->v9); - ++v122; - //v4 = v124; - //v5 = pSomeEVT; - //v6 = v123; - //v7 = ""; - break; - case EVENT_SetFacesBit: - sub_44892E_set_faces_bit(_evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8), - _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8), _evt->v13); - ++v122; - //v4 = v124; - //v5 = pSomeEVT; - //v6 = v123; - //v7 = ""; - break; - case EVENT_ToggleChestFlag: - Chest::ToggleFlag(_evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8), - _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8), _evt->v13); - ++v122; - //v4 = v124; - //v5 = pSomeEVT; - //v6 = v123; - //v7 = ""; - break; - case EVENT_ToggleActorFlag: - Actor::ToggleFlag(_evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8), - _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8), _evt->v13); - ++v122; - //v4 = v124; - //v5 = pSomeEVT; - //v6 = v123; - //v7 = ""; - break; - case EVENT_ToggleActorGroupFlag: - ToggleActorGroupFlag( - _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8), - _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8), - _evt->v13); - ++v122; - //v4 = v124; - //v5 = pSomeEVT; - //v6 = v123; - //v7 = ""; - break; - case EVENT_SetSnow: - if ( !_evt->v5 ) - pWeather->bRenderSnow = _evt->v6 != 0; - ++v122; - //v4 = v124; - //v5 = pSomeEVT; - //v6 = v123; - //v7 = ""; - break; - case EVENT_StatusText: - v90 = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8); - if ( _5C3420_pDecoration ) - { - if ( _5C3420_pDecoration == (LevelDecoration *)1 ) - { - ptr_F8B1E8 = pNPCTopics[v90-1].pText;//(&dword_721664)[8 * v90]; - ++v122; - //v4 = v124; - //v5 = pSomeEVT; - //v6 = v123; - //v7 = ""; - break; - } - if ( a3 == 1 ) - { - v91 = pNPCTopics[v90-1].pText;//(&dword_721664)[8 * v90]; -//LABEL_248: - ShowStatusBarString(v91, 2u); - ++v122; - //v4 = v124; - //v5 = pSomeEVT; - //v6 = v123; - //v7 = ""; - break; - } - } - else - { - if ( a3 == 1 ) - { - v91 = &pLevelStr[pLevelStrOffsets[v90]]; - ShowStatusBarString(v91, 2u); - ++v122; - //v4 = v124; - //v5 = pSomeEVT; - //v6 = v123; - //v7 = ""; - break; - } - } - ++v122; - //v4 = v124; - //v5 = pSomeEVT; - //v6 = v123; - //v7 = ""; - break; - case EVENT_ShowMessage: - v92 = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8); - if ( _5C3420_pDecoration ) - { - v93 = (char *)pNPCTopics[v92-1].pText;//(&dword_721664)[8 * v92]; - byte_5B0938[0] = 0; - ptr_F8B1E8 = v93; - } - else - { - strcpy(byte_5B0938, &pLevelStr[pLevelStrOffsets[v92]]); - } - ++v122; - //v4 = v124; - //v5 = pSomeEVT; - //v6 = v123; - //v7 = ""; - break; - case EVENT_CastSpell: - sub_448DF8_cast_spell(_evt->v5, _evt->v6, _evt->v7, _evt->v8 + ((_evt->v9 + ((_evt->v10 + ((uint)_evt->v11 << 8)) << 8)) << 8), - _evt->v12 + ((_evt->v13 + ((_evt->v14 + ((uint)_evt->v15 << 8)) << 8)) << 8), - _evt->v16 + ((_evt->v17 + ((_evt->v18 + ((uint)_evt->v19 << 8)) << 8)) << 8), - _evt->v20 + ((_evt->v21 + ((_evt->v22 + ((uint)_evt->v23 << 8)) << 8)) << 8), - _evt->v24 + ((_evt->v25 + ((_evt->v26 + ((uint)_evt->v27 << 8)) << 8)) << 8), - _evt->v28 + ((_evt->v29 + ((_evt->v30 + ((uint)_evt->v31 << 8)) << 8)) << 8)); - ++v122; - //v4 = v124; - //v5 = pSomeEVT; - //v6 = v123; - //v7 = ""; - break; - case EVENT_SetTexture: - sub_44861E_set_texture(_evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8), (char *)&_evt->v9); - ++v122; - //v4 = v124; - //v5 = pSomeEVT; - //v6 = v123; - //v7 = ""; - break; - case EVENT_SetSprite: - SetDecorationSprite(_evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8), _evt->v9, (char *)&_evt->v10); - ++v122; - //v4 = v124; - //v5 = pSomeEVT; - //v6 = v123; - //v7 = ""; - break; - case EVENT_SummonMonsters: - sub_448CF4_spawn_monsters(_evt->v5, _evt->v6, _evt->v7, - _evt->v8 + ((_evt->v9 + ((_evt->v10 + ((uint)_evt->v11 << 8)) << 8)) << 8), - _evt->v12 + ((_evt->v13 + ((_evt->v14 + ((uint)_evt->v15 << 8)) << 8)) << 8), - _evt->v16 + ((_evt->v17 + ((_evt->v18 + ((uint)_evt->v19 << 8)) << 8)) << 8), - _evt->v20 + ((_evt->v21 + ((_evt->v22 + ((uint)_evt->v23 << 8)) << 8)) << 8), - _evt->v24 + ((_evt->v25 + ((_evt->v26 + ((uint)_evt->v27 << 8)) << 8)) << 8)); - ++v122; - //v4 = v124; - //v5 = pSomeEVT; - //v6 = v123; - //v7 = ""; - break; - case EVENT_MouseOver: - case EVENT_LocationName: - --v122; - ++v122; - //v4 = v124; - //v5 = pSomeEVT; - //v6 = v123; - //v7 = ""; - break; - case EVENT_ChangeDoorState: - sub_449A49_door_switch_animation(_evt->v5, _evt->v6); - ++v122; - //v4 = v124; - //v5 = pSomeEVT; - //v6 = v123; - //v7 = ""; - break; - case EVENT_OpenChest: - if ( !Chest::Open(_evt->v5) ) - goto LABEL_301; - ++v122; - //v4 = v124; - //v5 = pSomeEVT; - //v6 = v123; - //v7 = ""; - break; - case EVENT_MoveToMap: - v94 = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8); - v135 = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8); - v132 = _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8); - v126 = _evt->v13 + ((_evt->v14 + ((_evt->v15 + ((uint)_evt->v16 << 8)) << 8)) << 8); - v129 = _evt->v17 + ((_evt->v18 + ((_evt->v19 + ((uint)_evt->v20 << 8)) << 8)) << 8); - v95 = _evt->v21 + ((_evt->v22 + ((_evt->v23 + ((uint)_evt->v24 << 8)) << 8)) << 8); - v96 = _evt->v25; - v97 = v96 + ((_evt->v26 + ((_evt->v27 + ((uint)_evt->v28 << 8)) << 8)) << 8); - v134 = v96 + ((_evt->v26 + ((_evt->v27 + ((uint)_evt->v28 << 8)) << 8)) << 8); - if ( _evt->v29 || _evt->v30 ) - { - if ( pRenderer->pRenderD3D && !pRenderer->bWindowMode ) - pRenderer->_49FD3A(); - sub_444839_move_map(_evt->v29, _evt->v30, v135, v132, v126, v129, v95, v134, (char *)&_evt->v31); - dword_5C3418 = uEventID; - dword_5C341C = v122 + 1; - goto LABEL_301; - } - _5B65AC_npcdata_fame_or_other = _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8); - _5B65A8_npcdata_uflags_or_other = v94; - _5B65B0_npcdata_rep_or_other = v126; - if ( v129 == -1 ) - { - v98 = _5B65B4_npcdata_loword_house_or_other; - } - else - { - v98 = v129 & stru_5C6E00->uDoublePiMask; - _5B65B4_npcdata_loword_house_or_other = v129 & stru_5C6E00->uDoublePiMask; - } - v99 = (char *)&_evt->v31; - _5B65B8_npcdata_hiword_house_or_other = v95; - dword_5B65BC = v97; - v100 = v94 | v132 | v126 | v95 | v97 | v98; - dword_5B65C0 = v100; - if ( *v99 == 48 ) - { - if ( v100 ) - { - pParty->vPosition.x = v135; - pParty->vPosition.y = v132; - pParty->vPosition.z = v126; - pParty->uFallStartY = v126; - if ( _5B65B4_npcdata_loword_house_or_other != -1 ) - pParty->sRotationY = _5B65B4_npcdata_loword_house_or_other; - _5B65B4_npcdata_loword_house_or_other = -1; - v120 = 0; - v116 = 0; - v111 = 0; - v110 = 0; - v109 = -1; - v108 = 0; - v107 = 0; - pParty->sRotationX = v95; - pParty->uFallSpeed = v134; - dword_5B65C0 = 0; - dword_5B65BC = 0; - _5B65B8_npcdata_hiword_house_or_other = 0; - _5B65B0_npcdata_rep_or_other = 0; - _5B65AC_npcdata_fame_or_other = 0; - _5B65A8_npcdata_uflags_or_other = 0; - v106 = 232; -LABEL_280: - pAudioPlayer->PlaySound((SoundID)v106, v107, v108, v109, v110, v111, v116, v120); - } - } - else - { - pGameLoadingUI_ProgressBar->uType = (GUIProgressBar::Type)((_5C3420_pDecoration == 0) + 1); - sub_44987B(v99, 0); - v133 = 1; - if ( pCurrentScreen == SCREEN_HOUSE ) - { - if ( uGameState == 2 ) - { - pAudioPlayer->StopChannels(-1, -1); - dword_F8B19C = 0; - while ( sub_4BD8B5() ) - ; - pVideoPlayer->Unload(); - ptr_507BC0->Release(); - ptr_507BC0 = 0; - if ( pMessageQueue_50CBD0->uNumMessages ) - pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; - pCurrentScreen = SCREEN_GAME; - viewparams->bRedrawGameUI = 1; - array_5913D8[6] = 0; - pDialogueWindow->Release(); - dword_F8B19C = 0; - pDialogueWindow = 0; - pIcons_LOD->_40F9C5(); - } - goto LABEL_302; - } - } - ++v122; - //v4 = v124; - //v5 = pSomeEVT; - //v6 = v123; - //v7 = ""; - break; - case EVENT_PlaySound: - v120 = 0; - v116 = 0; - v111 = 0; - v110 = _evt->v13 + ((_evt->v14 + ((_evt->v15 + ((uint)_evt->v16 << 8)) << 8)) << 8); - v109 = _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8); - v108 = 0; - v107 = 0; - v106 = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8); - goto LABEL_280; - case EVENT_GiveItem: - item.Reset(); - //v101 = &pSomeEVT[v9]; - v102 = _evt->v7 - + ((_evt->v8 + ((_evt->v9 + ((uint)_evt->v10 << 8)) << 8)) << 8); - pItemsTable->GenerateItem(_evt->v5, _evt->v6, &item); - if ( v102 ) - item.uItemID = v102; - pParty->SetHoldingItem(&item); - ++v122; - //v4 = v124; - //v5 = pSomeEVT; - //v6 = v123; - //v7 = ""; - break; - case EVENT_SpeakInHouse: - v103 = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8); - if ( EnterHouse((enum HOUSE_TYPE)(_evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8))) ) - { - if ( pRenderer->pRenderD3D && !pRenderer->bWindowMode ) - pRenderer->_49FD3A(); - pAudioPlayer->PlaySound((SoundID)0, 0, 0, -1, 0, 0, 0, 0); - pAudioPlayer->PlaySound(SOUND_EnteringAHouse, 814, 0, -1, 0, 0, 0, 0); - v104 = 187; - if ( uCurrentHouse_Animation != 167 ) - v104 = v103; - ptr_507BC0 = GUIWindow::Create(0, 0, 640, 480, WINDOW_HouseInterior, v104, 0); - ptr_507BC0->CreateButton(0x3Du, 0x1A8u, 0x1Fu, 0, 2, 94, 0x6Eu, 1u, 0x31u, "", 0); - ptr_507BC0->CreateButton(0xB1u, 0x1A8u, 0x1Fu, 0, 2, 94, 0x6Eu, 2u, 0x32u, "", 0); - ptr_507BC0->CreateButton(0x124u, 0x1A8u, 0x1Fu, 0, 2, 94, 0x6Eu, 3u, 0x33u, "", 0); - ptr_507BC0->CreateButton(0x197u, 0x1A8u, 0x1Fu, 0, 2, 94, 0x6Eu, 4u, 0x34u, "", 0); - ptr_507BC0->CreateButton(0, 0, 0, 0, 1, 0, 0xB0u, 0, 9u, "", 0); - } - ++v122; - //v4 = v124; - //v5 = pSomeEVT; - //v6 = v123; - //v7 = ""; - break; - case EVENT_PressAnyKey: - v121 = 33; - v105 = v122 + 1; - goto LABEL_295; - case EVENT_Exit: - goto LABEL_301; - default: - ++v122; - //v4 = v124; - //v5 = pSomeEVT; - //v6 = v123; - //v7 = ""; - break; - } - } - //++v4; - //v124 = v4; - //if ( v4 >= (signed int)uSomeEVT_NumEvents ) - //goto LABEL_301; - //} - } -} - - //----- (0044861E) -------------------------------------------------------- void __fastcall sub_44861E_set_texture(unsigned int uFaceCog, const char *pFilename) @@ -20042,7 +18428,7 @@ //----- (00402CAE) -------------------------------------------------------- -int stru193_math::SinCos(int angle) +int stru193_math::Cos(int angle) { int v2; // eax@1
--- a/mm7_4.cpp Wed Feb 20 20:50:22 2013 +0600 +++ b/mm7_4.cpp Wed Feb 20 20:51:55 2013 +0600 @@ -5178,7 +5178,7 @@ v35 = *v26; v36 = a3->GetValue(); v29 = pPlayer->_4B8102(v36, v35); - if ( a3->uAttributes & 2 ) + if (a3->Broken()) v29 = 1; goto _continue_sprintf; } @@ -5197,7 +5197,7 @@ v30 = *v26; v31 = a3->GetValue(); v29 = pPlayer->_4B8102(v31, v30) / 2; - if ( a3->uAttributes & 2 ) + if (a3->Broken()) v29 = 1; if (!v29) v29 = 1; @@ -5720,7 +5720,7 @@ if ( pMessageQueue_50CBD0->uNumMessages ) pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; - pAudioPlayer->SetMusicVolume((pSoundVolumeLevels[uMusicVolimeMultiplier] * 64.0)); + pAudioPlayer->SetMusicVolume(pSoundVolumeLevels[uMusicVolimeMultiplier] * 64.0f); ++pIcons_LOD->uTexturePacksCount; if ( !pIcons_LOD->uNumPrevLoadedFiles ) pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles; @@ -5740,16 +5740,13 @@ pTexture_IC_KNIGHT[8] = pIcons_LOD->LoadTexturePtr("IC_SORC", TEXTURE_16BIT_PALETTE); pTexture_MAKETOP = pIcons_LOD->LoadTexturePtr("MAKETOP", TEXTURE_16BIT_PALETTE); pTexture_MAKESKY = pIcons_LOD->LoadTexturePtr("MAKESKY", TEXTURE_16BIT_PALETTE); - uX = 0; - do // load PlayerPortraits texture + for(uX=0;uX < 22;++uX ) // load PlayerPortraits texture { sprintf(pTmpBuf, "%s01", pPlayerPortraitsNames[uX]); v1 = pIcons_LOD->LoadTexture(pTmpBuf, TEXTURE_16BIT_PALETTE); - v2 = uX * 4; - ++uX; - *(Texture **)((char *)pPlayerPortraits + v2) = &pIcons_LOD->pTextures[v1]; - } - while ( uX < 22 ); + pPlayerPortraits[uX] = &pIcons_LOD->pTextures[v1]; + + } pTexture_PlayerFaceMask = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture("FACEMASK", TEXTURE_16BIT_PALETTE)]; pTexture_buttminu = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture("buttminu", TEXTURE_16BIT_PALETTE)]; pTexture_buttplus = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture("buttplus", TEXTURE_16BIT_PALETTE)]; @@ -5875,7 +5872,7 @@ int v9; // edx@31 char *v10; // ebx@37 Player *v11; // esi@38 - signed int uSpellBookPageCount; // ecx@40 + //signed int uSpellBookPageCount; // ecx@40 int v13; // eax@40 //signed int uSkillIdx; // eax@45 int v15; // eax@70 @@ -6013,13 +6010,14 @@ player->sResMagicBase = 10; //*((short *)v10 + 400) = 0; player->pPlayerBuffs[22].uExpireTime = 0; - uSpellBookPageCount = 0; for (uint j = 0; j < 9; j++) { if (player->pActiveSkills[PLAYER_SKILL_FIRE + j]) - ++uSpellBookPageCount; - } - player->lastOpenedSpellbookPage = uSpellBookPageCount; + { + player->lastOpenedSpellbookPage = j; + break; + } + } pItemsTable->GenerateItem(2, 40, &item); player->AddItem2(-1, &item); //uSkillIdx = 0; @@ -6097,7 +6095,7 @@ for (uint k = 0; k < 138; k++) { if (&player->pInventoryItems[k]) - player->pInventoryItems[k].uAttributes |= 1; + player->pInventoryItems[k].SetIdentified(); } } } @@ -7462,8 +7460,8 @@ v21 = stru_F81018.field_0.field_8 >> i >> (11 - v18); v22 = stru_5C6E00; v122 = (unsigned __int16 *)v20; - v121 = (stru_F81018.field_0.field_4 >> i) + 4 * stru_5C6E00->SinCos(v104 + v21); - v23 = stru_5C6E00->SinCos(v104 + (v19 >> (char)v122) - stru_5C6E00->uIntegerHalfPi); + v121 = (stru_F81018.field_0.field_4 >> i) + 4 * stru_5C6E00->Cos(v104 + v21); + v23 = stru_5C6E00->Sin(v104 + (v19 >> (char)v122)); v120 = v116 + 4 * v23; if ( v123 < v117 ) { @@ -7491,8 +7489,8 @@ v102 = v4->uHeightMinus1 >> v27 << (v27 + 16); v31 = *v114 >> i; v122 = (unsigned __int16 *)(11 - v27); - v116 = v30 + 4 * stru_5C6E00->SinCos(v104 + (v31 >> (11 - v27))); - v90 = v31 + 4 * stru_5C6E00->SinCos(v104 + (v30 >> (char)v122) - stru_5C6E00->uIntegerHalfPi); + v116 = v30 + 4 * stru_5C6E00->Cos(v104 + (v31 >> (11 - v27))); + v90 = v31 + 4 * stru_5C6E00->Sin(v104 + (v30 >> (char)v122)); v108 = (signed int)(v116 - v121) >> 4; v103 = (v90 - v120) >> 4; v32 = v123 + 32; @@ -12815,8 +12813,7 @@ v4 = a1->uItemID; v5 = pItemsTable->pItems[v4].uEquipType; if ( (v2 != 4 || (signed int)v3 < 740 || (signed int)v3 > 771) - && ((signed int)v3 >= 600 || (signed int)v3 >= 529 && (signed int)v3 <= 599) - || BYTE1(a1->uAttributes) & 1 ) + && ((signed int)v3 >= 600 || (signed int)v3 >= 529 && (signed int)v3 <= 599) || a1->Stolen()) return 0; v6 = v2 - 1; if ( !v6 ) @@ -14723,7 +14720,7 @@ } else { - v2 = (char *)&pLevelEVT_Events[0].uEventOffsetInEVT; + v2 = (char *)&pLevelEVT_Index[0].uEventOffsetInEVT; while ( 1 ) { if ( *((int *)v2 - 2) == uEventID ) @@ -14749,7 +14746,7 @@ } else { - for ( i = (char *)pLevelEVT_Events + 4 * (3 * v1 + 3); *(int *)i == uEventID; i += 12 ) + for ( i = (char *)pLevelEVT_Index + 4 * (3 * v1 + 3); *(int *)i == uEventID; i += 12 ) { v8 = *((int *)i + 2); if ( pLevelEVT[v8 + 4] == 2 )
--- a/mm7_5.cpp Wed Feb 20 20:50:22 2013 +0600 +++ b/mm7_5.cpp Wed Feb 20 20:51:55 2013 +0600 @@ -931,9 +931,8 @@ GUIWindow::Create(v23, 0xD8u, 0, 0, (enum WindowType)90, v153, v167); //goto LABEL_143; if ( uMusicVolimeMultiplier ) - pAudioPlayer->PlaySound(SOUND_Bell, -1, 0, -1, 0, 0, - (signed __int64)(pSoundVolumeLevels[(char)uMusicVolimeMultiplier] * 64.0), 0); - pAudioPlayer->SetMusicVolume((signed __int64)(pSoundVolumeLevels[(char)uMusicVolimeMultiplier] * 64.0)); + pAudioPlayer->PlaySound(SOUND_Bell, -1, 0, -1, 0, 0, pSoundVolumeLevels[(char)uMusicVolimeMultiplier] * 64.0f, 0); + pAudioPlayer->SetMusicVolume(pSoundVolumeLevels[(char)uMusicVolimeMultiplier] * 64.0f); continue; } if ( uMessageParam == 5 ) @@ -948,9 +947,8 @@ GUIWindow::Create(v23, 0xD8u, 0, 0, (enum WindowType)90, v153, v167); //goto LABEL_143; if ( uMusicVolimeMultiplier ) - pAudioPlayer->PlaySound(SOUND_Bell, -1, 0, -1, 0, 0, - (signed __int64)(pSoundVolumeLevels[(char)uMusicVolimeMultiplier] * 64.0), 0); - pAudioPlayer->SetMusicVolume((signed __int64)(pSoundVolumeLevels[(char)uMusicVolimeMultiplier] * 64.0)); + pAudioPlayer->PlaySound(SOUND_Bell, -1, 0, -1, 0, 0, pSoundVolumeLevels[(char)uMusicVolimeMultiplier] * 64.0f, 0); + pAudioPlayer->SetMusicVolume(pSoundVolumeLevels[(char)uMusicVolimeMultiplier] * 64.0f); continue; } uMusicVolimeMultiplier = (pMouse->GetCursorPos(&v202)->x - 263) / 17; @@ -958,34 +956,21 @@ uMusicVolimeMultiplier = 9; //LABEL_143: if ( uMusicVolimeMultiplier ) - pAudioPlayer->PlaySound(SOUND_Bell, -1, 0, -1, 0, 0, - (signed __int64)(pSoundVolumeLevels[(char)uMusicVolimeMultiplier] * 64.0), 0); - pAudioPlayer->SetMusicVolume((signed __int64)(pSoundVolumeLevels[(char)uMusicVolimeMultiplier] * 64.0)); + pAudioPlayer->PlaySound(SOUND_Bell, -1, 0, -1, 0, 0, pSoundVolumeLevels[uMusicVolimeMultiplier] * 64.0f, 0); + pAudioPlayer->SetMusicVolume(pSoundVolumeLevels[uMusicVolimeMultiplier] * 64.0f); continue; case UIMSG_ChangeSoundVolume: - if ( uMessageParam == 4 ) + if ( uMessageParam == 4 )//reduce sound level { --uSoundVolumeMultiplier; if ( (char)uSoundVolumeMultiplier < 1 ) uSoundVolumeMultiplier = 0; - v168 = v0; - v24 = 243; - v154 = (int)pBtn_SliderLeft; -//LABEL_150: - GUIWindow::Create(v24, 0xA2u, 0, 0, (enum WindowType)90, v154, v168); - //goto LABEL_157; - pAudioPlayer->SetMasterVolume((signed __int64)(pSoundVolumeLevels[(char)uSoundVolumeMultiplier] * 128.0)); - v165 = 0; - v151 = 0; - v144 = 0; - v139 = 0; - v135 = -1; - v132 = 0; - v130 = -1; - v127 = 218; - goto _play_sound_and_continue; - } - if ( uMessageParam == 5 ) + GUIWindow::Create(243, 162, 0, 0, (enum WindowType)90, (int)pBtn_SliderLeft, v0); + pAudioPlayer->SetMasterVolume(pSoundVolumeLevels[uSoundVolumeMultiplier] * 128.0f); + pAudioPlayer->PlaySound((SoundID)218, -1, 0, -1, 0, 0, 0, 0); + continue; + } + if ( uMessageParam == 5 )//Increase sound level { ++uSoundVolumeMultiplier; if ( (char)uSoundVolumeMultiplier > 8 ) @@ -996,7 +981,7 @@ //goto LABEL_150; GUIWindow::Create(v24, 0xA2u, 0, 0, (enum WindowType)90, v154, v168); //goto LABEL_157; - pAudioPlayer->SetMasterVolume((signed __int64)(pSoundVolumeLevels[(char)uSoundVolumeMultiplier] * 128.0)); + pAudioPlayer->SetMasterVolume(pSoundVolumeLevels[uSoundVolumeMultiplier] * 128.0f); v165 = 0; v151 = 0; v144 = 0; @@ -1011,7 +996,7 @@ if ( (char)uSoundVolumeMultiplier > 8 ) uSoundVolumeMultiplier = 9; //LABEL_157: - pAudioPlayer->SetMasterVolume((signed __int64)(pSoundVolumeLevels[(char)uSoundVolumeMultiplier] * 128.0)); + pAudioPlayer->SetMasterVolume(pSoundVolumeLevels[uSoundVolumeMultiplier] * 128.0f); v165 = 0; v151 = 0; v144 = 0; @@ -1048,7 +1033,7 @@ if ( !uVoicesVolumeMultiplier ) continue; v165 = 0; - v151 = (signed __int64)(pSoundVolumeLevels[(char)uVoicesVolumeMultiplier] * 128.0); + v151 = pSoundVolumeLevels[uVoicesVolumeMultiplier] * 128.0f; v144 = 0; v139 = 0; v135 = -1; @@ -1071,7 +1056,7 @@ if ( !uVoicesVolumeMultiplier ) continue; v165 = 0; - v151 = (signed __int64)(pSoundVolumeLevels[(char)uVoicesVolumeMultiplier] * 128.0); + v151 = pSoundVolumeLevels[uVoicesVolumeMultiplier] * 128.0f; v144 = 0; v139 = 0; v135 = -1; @@ -1087,7 +1072,7 @@ if ( !uVoicesVolumeMultiplier ) continue; v165 = 0; - v151 = (signed __int64)(pSoundVolumeLevels[(char)uVoicesVolumeMultiplier] * 128.0); + v151 = pSoundVolumeLevels[uVoicesVolumeMultiplier] * 128.0f; v144 = 0; v139 = 0; v135 = -1; @@ -2280,7 +2265,7 @@ } if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) { - pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)113; + pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape; pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = v0; *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; ++pMessageQueue_50CBD0->uNumMessages; @@ -3503,9 +3488,9 @@ sub_41C0B8_set_status_string(pTmpBuf); continue; case UIMSG_ShowStatus_Food: - v173 = (char *)pParty->uNumFoodRations; - v157 = pGlobalTXT_LocalizationStrings[501];// You have %lu food" - goto _sprintex_2args_draw_status_and_continue; + sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[501], pParty->uNumFoodRations); // "You have %lu food" + sub_41C0B8_set_status_string(pTmpBuf); + continue; case UIMSG_ShowStatus_Player: pPlayer5 = pPlayers[uMessageParam]; sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[429], pPlayer5->pName, pClassNames[pPlayer5->classType]);// "%s the %s" @@ -3637,7 +3622,7 @@ if ( pCurrentScreen ) continue; pParty->uFlags |= 2u; - GUIWindow::Create(0x207u, 0x88u, 0, 0, (enum WindowType)90, (int)dword_507A14, 0); + GUIWindow::Create(0x207u, 0x88u, 0, 0, (enum WindowType)90, (int)pBtn_ZoomOut, 0); uNumSeconds = 131072; v118 = 2 * viewparams->uMinimapZoom; ++viewparams->field_28; @@ -3660,7 +3645,7 @@ if ( pCurrentScreen ) continue; pParty->uFlags |= 2u; - GUIWindow::Create(0x23Eu, 0x88u, 0, 0, (enum WindowType)90, (int)dword_507A18, 0); + GUIWindow::Create(0x23Eu, 0x88u, 0, 0, (enum WindowType)90, (int)pBtn_ZoomIn, 0); uNumSeconds = 32768; v118 = (unsigned __int64)((signed __int64)(signed int)viewparams->uMinimapZoom << 15) >> 16; --viewparams->field_28; @@ -5492,7 +5477,7 @@ if ( pMonster->sCurrentHP > 0 ) { Actor::_4030AD(uActorID_Monster_, a1, 0); - Actor::_43AC45(uActorID_Monster_, 1); + Actor::AggroSurroundingPeasants(uActorID_Monster_, 1); if ( bShowDamage ) { v50 = uDamageAmount; @@ -5537,8 +5522,8 @@ } } Actor::Die(uActorID_Monster_); - Actor::_438CF3(uActorID_Monster_); - Actor::_43AC45(uActorID_Monster_, 1); + Actor::ApplyFineForKillingPeasant(uActorID_Monster_); + Actor::AggroSurroundingPeasants(uActorID_Monster_, 1); if ( pMonster->pMonsterInfo.uExp ) sub_4269A2_GivePartyExp(pMonsterStats->pInfos[pMonster->pMonsterInfo.uID].uExp); v40 = SPEECH_51; @@ -5827,8 +5812,8 @@ { if ( v7->sCurrentHP >= 1 ) { - Actor::_4030AD(uActorID, 8 * a4 | 4, 0); - Actor::_43AC45(uActorID, 1); + Actor::_4030AD(uActorID, 8 * a4 | OBJECT_Player, 0); + Actor::AggroSurroundingPeasants(uActorID, 1); } else { @@ -5854,8 +5839,8 @@ } } Actor::Die(uActorID); - Actor::_438CF3(uActorID); - Actor::_43AC45(uActorID, 1); + Actor::ApplyFineForKillingPeasant(uActorID); + Actor::AggroSurroundingPeasants(uActorID, 1); if ( v7->pMonsterInfo.uExp ) sub_4269A2_GivePartyExp(pMonsterStats->pInfos[v7->pMonsterInfo.uID].uExp); v34 = SPEECH_51; @@ -6013,8 +5998,8 @@ { if ( v44->sCurrentHP >= 1 ) { - Actor::_4030AD(uActorID, 8 * a4 | 4, 0); - Actor::_43AC45(uActorID, 1); + Actor::_4030AD(uActorID, 8 * a4 | OBJECT_Player, 0); + Actor::AggroSurroundingPeasants(uActorID, 1); } else { @@ -6040,8 +6025,8 @@ } } Actor::Die(uActorID); - Actor::_438CF3(uActorID); - Actor::_43AC45(uActorID, 1); + Actor::ApplyFineForKillingPeasant(uActorID); + Actor::AggroSurroundingPeasants(uActorID, 1); if ( v44->pMonsterInfo.uExp ) sub_4269A2_GivePartyExp(pMonsterStats->pInfos[v44->pMonsterInfo.uID].uExp); v64 = SPEECH_51; @@ -6348,7 +6333,7 @@ } //----- (0043B1B0) -------------------------------------------------------- -__int16 __fastcall sub_43B1B0(signed int a1, unsigned int a2, Vec3_int_ *pVelocity, signed int a4) +void sub_43B1B0(signed int a1, unsigned int a2, Vec3_int_ *pVelocity, signed int a4) { int v4; // ebx@1 LayingItem *v5; // eax@2 @@ -6432,7 +6417,7 @@ Actor::_4030AD(uActorID, v17, 0); else Actor::Die(uActorID); - Actor::_43AC45(uActorID, 0); + Actor::AggroSurroundingPeasants(uActorID, 0); v18 = 20 * v14 / (signed int)v7->pMonsterInfo.uHP; if ( 20 * v14 / (signed int)v7->pMonsterInfo.uHP > 10 ) v18 = 10; @@ -6445,13 +6430,13 @@ v7->vVelocity.y = 50 * LOWORD(pVelocity->y); v7->vVelocity.z = 50 * LOWORD(pVelocity->z); } - LOWORD(v6) = Actor::AddBloodsplatOnDamageOverlay(uActorID, 1, v14); + Actor::AddBloodsplatOnDamageOverlay(uActorID, 1, v14); } else { - LOWORD(v6) = Actor::_4030AD(uActorID, v17, 0); + Actor::_4030AD(uActorID, v17, 0); } - return v6; + return; } v13 = v7->pMonsterInfo.uSpell2ID; } @@ -6463,7 +6448,6 @@ } } } - return v6; } //----- (0043BCA7) -------------------------------------------------------- @@ -7021,7 +7005,11 @@ //----- (0043CC7C) -------------------------------------------------------- void __fastcall CharacterUI_DrawPaperdoll(unsigned int uPlayerID) { + Player **ppPlayer; // esi@1 Player *pPlayer; // ebx@1 + enum CHARACTER_RACE pRace; // edi@1 + signed int pSex; // eax@1 + int v5; // edi@4 unsigned int v6; // ecx@9 int v7; // ecx@10 unsigned int v8; // eax@14 @@ -7037,22 +7025,22 @@ int v18; // edi@30 char *v19; // eax@30 Texture *v20; // edi@31 - int pBowNum; // eax@37 + unsigned int v21; // eax@37 int v22; // edi@38 int v23; // eax@38 - int pX; // ebx@38 + int v24; // ebx@38 int v25; // eax@38 LODFile_IconsBitmaps *v26; // ecx@42 Texture *v27; // edi@51 double v28; // st7@51 char v29; // zf@54 char *v30; // eax@54 - int pCloakNum; // eax@59 + unsigned int v31; // eax@59 int v32; // edx@60 int v33; // eax@65 int v34; // eax@74 int v35; // ebx@74 - int pY2; // ecx@74 + unsigned int v36; // ecx@74 int v37; // eax@74 LODFile_IconsBitmaps *v38; // ecx@78 Texture *v39; // edi@85 @@ -7211,7 +7199,8 @@ signed int v192; // [sp-4h] [bp-50h]@304 unsigned int a3; // [sp+10h] [bp-3Ch]@7 int a3a; // [sp+10h] [bp-3Ch]@15 - int pY; // [sp+10h] [bp-3Ch]@38 + int a3b; // [sp+10h] [bp-3Ch]@38 + unsigned int a3c; // [sp+10h] [bp-3Ch]@74 unsigned int a3d; // [sp+10h] [bp-3Ch]@106 int a3e; // [sp+10h] [bp-3Ch]@129 int a3f; // [sp+10h] [bp-3Ch]@168 @@ -7223,7 +7212,7 @@ signed int a2; // [sp+14h] [bp-38h]@7 unsigned int a2a; // [sp+14h] [bp-38h]@15 Texture *a2b; // [sp+14h] [bp-38h]@49 - int pX2; // [sp+14h] [bp-38h]@74 + int a2c; // [sp+14h] [bp-38h]@74 int a2d; // [sp+14h] [bp-38h]@106 int a2e; // [sp+14h] [bp-38h]@129 int a2f; // [sp+14h] [bp-38h]@168 @@ -7232,7 +7221,9 @@ Texture *a2i; // [sp+14h] [bp-38h]@284 int a2j; // [sp+14h] [bp-38h]@312 int a2k; // [sp+14h] [bp-38h]@336 + Player *v217; // [sp+18h] [bp-34h]@1 int v218; // [sp+1Ch] [bp-30h]@15 + int v219; // [sp+1Ch] [bp-30h]@60 int v220; // [sp+1Ch] [bp-30h]@94 int v221; // [sp+1Ch] [bp-30h]@128 int v222; // [sp+1Ch] [bp-30h]@161 @@ -7243,6 +7234,8 @@ int v227; // [sp+1Ch] [bp-30h]@336 int v228; // [sp+1Ch] [bp-30h]@359 int v229; // [sp+20h] [bp-2Ch]@15 + int v230; // [sp+20h] [bp-2Ch]@38 + int v231; // [sp+20h] [bp-2Ch]@60 int v232; // [sp+20h] [bp-2Ch]@94 int v233; // [sp+20h] [bp-2Ch]@128 int v234; // [sp+20h] [bp-2Ch]@161 @@ -7255,43 +7248,54 @@ unsigned int v241; // [sp+2Ch] [bp-20h]@38 int v242; // [sp+2Ch] [bp-20h]@197 unsigned int v243; // [sp+2Ch] [bp-20h]@370 - int pFaceNum; // [sp+34h] [bp-18h]@6 + int v244; // [sp+34h] [bp-18h]@6 signed int v245; // [sp+34h] [bp-18h]@361 + unsigned int uPlayerID_; // [sp+38h] [bp-14h]@1 int uPlayerID_a; // [sp+38h] [bp-14h]@9 signed int IsDwarf; // [sp+40h] [bp-Ch]@4 int v249; // [sp+40h] [bp-Ch]@358 - - pPlayer = pPlayers[uPlayerID]; + signed int v250; // [sp+44h] [bp-8h]@1 + + ppPlayer = &pPlayers[uPlayerID]; + pPlayer = *ppPlayer; + uPlayerID_ = uPlayerID; + v217 = *ppPlayer; pIcons_LOD->LoadTexture("sptext01", TEXTURE_16BIT_PALETTE); - if ( pPlayer->GetRace() && pPlayer->GetRace() != 1 && pPlayer->GetRace() != 2 ) + pRace = pPlayer->GetRace(); + pSex = pPlayer->GetSexByVoice(); + v250 = pSex; + if ( pRace && pRace != 1 && pRace != 2 ) { IsDwarf = 1; - pBodyComplection = (pPlayer->GetSexByVoice() != 0) + 2; + v5 = (pSex != 0) + 2; } else { IsDwarf = 0; - pBodyComplection = pPlayer->GetSexByVoice() != 0; - } - pFaceNum = pPlayer->uFace; + v5 = pSex != 0; + } + pBodyComplection = v5; + v244 = (*ppPlayer)->uFace; pRenderer->ResetClip(); pRenderer->DrawTextureIndexed(0x1D3u, 0, (Texture *)(uTextureID_BACKDOLL != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_BACKDOLL] : 0));// - if ( !IsPlayerWearingWatersuit[uPlayerID] )// - { - pBowNum = pPlayer->pEquipment.uBow; // - if ( !pBowNum ) + if ( !IsPlayerWearingWatersuit[uPlayerID_] ) + { + v21 = pPlayer->pEquipment.uBow; // + if ( !v21 ) goto LABEL_59; - v22 = (int)&pPlayer->pInventoryItems[pBowNum-1]; + v230 = pPlayer->pEquipment.uBow; + v22 = (int)&v217->pInventoryItems[v21-1]; v23 = *(int *)v22; - pX = pPaperdoll_BodyX + paperdoll_Weapon[pBodyComplection][2][0] - pItemsTable->pItems[v23].uEquipX; - pY = pPaperdoll_BodyY + paperdoll_Weapon[pBodyComplection][2][1] - pItemsTable->pItems[v23].uEquipY; + v24 = pPaperdoll_BodyX + paperdoll_Weapon[pBodyComplection][2][0] - pItemsTable->pItems[v23].uEquipX; + a3b = pPaperdoll_BodyY + paperdoll_Weapon[pBodyComplection][2][1] - pItemsTable->pItems[v23].uEquipY; v241 = pIcons_LOD->LoadTexture(pItemsTable->pItems[v23].pIconName, TEXTURE_16BIT_PALETTE); v25 = *(int *)(v22 + 20); if ( !(*(int *)(v22 + 20) & 0xF0) ) { if ( v25 & 2 ) { - pRenderer->_4A6776(pX, pY, (Texture *)(v241 != -1 ? (int)&pIcons_LOD->pTextures[v241] : 0)); + v27 = (Texture *)(v241 != -1 ? (int)&pIcons_LOD->pTextures[v241] : 0); + pRenderer->DrawTransparentRedShade(v24, a3b, v27); } else { @@ -7300,22 +7304,24 @@ if ( v29 ) { v27 = (Texture *)(v241 != -1 ? (int)v30 : 0); - pRenderer->DrawTransparentGreenShade(pX, pY, (Texture *)(v241 != -1 ? (int)v30 : 0)); + pRenderer->DrawTransparentGreenShade(v24, a3b, (Texture *)(v241 != -1 ? (int)v30 : 0)); } else { v27 = (Texture *)(v241 != -1 ? (int)v30 : 0); - pRenderer->DrawTextureTransparent(pX, pY, (Texture *)(v241 != -1 ? (int)v30 : 0)); + pRenderer->DrawTextureTransparent(v24, a3b, (Texture *)(v241 != -1 ? (int)v30 : 0)); } } LABEL_57: if ( !bRingsShownInCharScreen ) - pRenderer->_4A612A(pX, pY, v27, pBowNum); + pRenderer->_4A612A(v24, a3b, v27, v230); LABEL_59: - pCloakNum = pPlayer->pEquipment.uCloak;// - if ( !pCloakNum ) + v31 = v217->pEquipment.uCloak;// + if ( !v31 ) goto LABEL_93; - v32 = (int)&pPlayer->pInventoryItems[pCloakNum-1]; + v231 = v217->pEquipment.uCloak; + v32 = (int)&v217->pInventoryItems[v31-1]; + v219 = v32; if ( *(int *)v32 != 525 ) { switch ( *(int *)v32 ) @@ -7339,33 +7345,34 @@ LABEL_74: v34 = v33 + 10 * pBodyComplection; v35 = paperdoll_array_511828[0][v34];//Texture_Cloak - pX2 = pPaperdoll_BodyX + paperdoll_Cloak[0][v34][0]; - pY2 = pPaperdoll_BodyY + paperdoll_Cloak[0][v34][1]; + a2c = pPaperdoll_BodyX + paperdoll_Cloak[0][v34][0]; + v36 = pPaperdoll_BodyY + paperdoll_Cloak[0][v34][1]; v37 = *(int *)(v32 + 20); + a3c = v36; if ( !(v37 & 0xF0) ) { v41 = v35 + 1; if ( v37 & 2 ) { v42 = (Texture *)(v41 != 0 ? (int)&pIcons_LOD->pTextures[v35] : 0); - pRenderer->_4A6776(pX2, pY2, v42); + pRenderer->DrawTransparentRedShade(a2c, v36, v42); } else { v42 = (Texture *)(v41 != 0 ? (int)&pIcons_LOD->pTextures[v35] : 0); - pRenderer->DrawTextureTransparent(pX2, pY2, v42); + pRenderer->DrawTextureTransparent(a2c, v36, v42); } if ( !bRingsShownInCharScreen ) - pRenderer->_4A612A(pX2, pY2, v42, pCloakNum); + pRenderer->_4A612A(a2c, a3c, v42, v231); LABEL_93: - v240 = 4 * uPlayerID - 4; + v240 = 4 * uPlayerID_ - 4; pRenderer->DrawTextureTransparent(pPaperdoll_BodyX, pPaperdoll_BodyY, (Texture *)(*(unsigned int *)((char *)papredoll_dbods + v240) != -1 ? (int)&pIcons_LOD->pTextures[*(unsigned int *)((char *)papredoll_dbods + v240)] : 0)); - v43 = pPlayer->pEquipment.uBody;// + v43 = v217->pEquipment.uBody;// if ( !v43 ) goto LABEL_127; - v232 = pPlayer->pEquipment.uBody; - v44 = (int)&pPlayer->pInventoryItems[v43-1]; + v232 = v217->pEquipment.uBody; + v44 = (int)&v217->pInventoryItems[v43-1]; v220 = v44; if ( *(int *)v44 != 504 ) { @@ -7400,7 +7407,7 @@ if ( v49 & 2 ) { v54 = (Texture *)(v53 != 0 ? (int)&pIcons_LOD->pTextures[v48] : 0); - pRenderer->_4A6776(a2d, v47, v54); + pRenderer->DrawTransparentRedShade(a2d, v47, v54); } else { @@ -7420,18 +7427,18 @@ if ( !bRingsShownInCharScreen ) pRenderer->_4A612A(a2d, a3d, v54, v232); LABEL_127: - v56 = pPlayer->pEquipment.field_20; + v56 = v217->pEquipment.field_20; if ( !v56 ) goto LABEL_155; - v233 = pPlayer->pEquipment.field_20; - v57 = (int)&pPlayer->pInventoryItems[v56-1]; + v233 = v217->pEquipment.field_20; + v57 = (int)&v217->pInventoryItems[v56-1]; v221 = v57; v58 = *(int *)v57; if ( *(int *)v57 == 529 ) { a3e = pPaperdoll_BodyY + paperdoll_Boot[pBodyComplection][5][1]; a2e = pPaperdoll_BodyX + paperdoll_Boot[pBodyComplection][5][0]; - v59 = papredoll_flying_feet[pFaceNum]; + v59 = papredoll_flying_feet[v244]; } else { @@ -7467,7 +7474,7 @@ if ( v62 & 2 ) { v67 = (Texture *)(v65 != 0 ? (int)v66 : 0); - pRenderer->_4A6776(a2e, a3e, v67); + pRenderer->DrawTransparentRedShade(a2e, a3e, v67); } else { @@ -7485,19 +7492,19 @@ if ( !bRingsShownInCharScreen ) pRenderer->_4A612A(a2e, a3e, v67, v233); LABEL_155: - v68 = pPlayer; - v69 = pPlayer->pEquipment.uMainHand; + v68 = v217; + v69 = v217->pEquipment.uMainHand; uPlayerID_a = 2 * pBodyComplection; - if ( !v69 || (v70 = *(int *)&pPlayer->pInventoryItems[v69-1], pItemsTable->pItems[v70].uEquipType != 1) - && (pItemsTable->pItems[v70].uSkillType != 4 || pPlayer->pEquipment.uOffHand) ) + if ( !v69 || (v70 = *(int *)&v217->pInventoryItems[v69-1], pItemsTable->pItems[v70].uEquipType != 1) + && (pItemsTable->pItems[v70].uSkillType != 4 || v217->pEquipment.uOffHand) ) pRenderer->DrawTextureTransparent(pPaperdoll_BodyX + pPaperdoll_LeftHand[pBodyComplection][0], pPaperdoll_BodyY + pPaperdoll_LeftHand[pBodyComplection][1], (Texture *)(*(unsigned int *)((char *)papredoll_dlads + v240) != -1 ? (int)&pIcons_LOD->pTextures[*(unsigned int *)((char *)papredoll_dlads + v240)] : 0)); - v71 = pPlayer->pEquipment.uBelt; + v71 = v217->pEquipment.uBelt; if ( v71 ) { - v234 = pPlayer->pEquipment.uBelt; - v72 = (int)&pPlayer->pInventoryItems[v71-1]; + v234 = v217->pEquipment.uBelt; + v72 = (int)&v217->pInventoryItems[v71-1]; v222 = v72; if ( *(int *)v72 == 524 ) { @@ -7522,15 +7529,15 @@ v75 = stru_511718.texids[v74]; else v75 = stru_511718.texids[v73 + 7 * (pBodyComplection - 2)]; - v76 = *(int *)&pPlayer->field_1F5[36 * v71 + 15]; - if ( !(*(int *)&pPlayer->field_1F5[36 * v71 + 15] & 0xF0) ) + v76 = *(int *)&v217->field_1F5[36 * v71 + 15]; + if ( !(*(int *)&v217->field_1F5[36 * v71 + 15] & 0xF0) ) { v79 = v75 + 1; v80 = (char *)&pIcons_LOD->pTextures[v75]; if ( v76 & 2 ) { v81 = (Texture *)(v79 != 0 ? (int)v80 : 0); - pRenderer->_4A6776(a2f, a3f, v81); + pRenderer->DrawTransparentRedShade(a2f, a3f, v81); } else { @@ -7547,12 +7554,12 @@ } if ( !bRingsShownInCharScreen ) pRenderer->_4A612A(a2f, a3f, v81, v234); - v68 = pPlayer; + v68 = v217; goto LABEL_192; } - if ( (*(int *)&pPlayer->field_1F5[36 * v71 + 15] & 0xF0) != 16 ) + if ( (*(int *)&v217->field_1F5[36 * v71 + 15] & 0xF0) != 16 ) { - if ( (*(int *)&pPlayer->field_1F5[36 * v71 + 15] & 0xF0) == 32 ) + if ( (*(int *)&v217->field_1F5[36 * v71 + 15] & 0xF0) == 32 ) { v172 = "sp28a"; v77 = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture(v172, TEXTURE_16BIT_PALETTE)]; @@ -7565,10 +7572,10 @@ } v78 = (double)GetTickCount() * 0.1; pRenderer->_4A63E6(a2f, a3f, (Texture *)(v75 != -1 ? (int)&pIcons_LOD->pTextures[v75] : 0), v77, (signed __int64)v78, 0, 255); - v68 = pPlayer; + v68 = v217; goto LABEL_192; } - if ( (*(int *)&pPlayer->field_1F5[36 * v71 + 15] & 0xF0) == 64 ) + if ( (*(int *)&v217->field_1F5[36 * v71 + 15] & 0xF0) == 64 ) { v172 = "sp30a"; v77 = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture(v172, TEXTURE_16BIT_PALETTE)]; @@ -7581,10 +7588,10 @@ } v78 = (double)GetTickCount() * 0.1; pRenderer->_4A63E6(a2f, a3f, (Texture *)(v75 != -1 ? (int)&pIcons_LOD->pTextures[v75] : 0), v77, (signed __int64)v78, 0, 255); - v68 = pPlayer; + v68 = v217; goto LABEL_192; } - if ( (*(int *)&pPlayer->field_1F5[36 * v71 + 15] & 0xF0) == 128 ) + if ( (*(int *)&v217->field_1F5[36 * v71 + 15] & 0xF0) == 128 ) { v172 = "sp91a"; v77 = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture(v172, TEXTURE_16BIT_PALETTE)]; @@ -7597,7 +7604,7 @@ } v78 = (double)GetTickCount() * 0.1; pRenderer->_4A63E6(a2f, a3f, (Texture *)(v75 != -1 ? (int)&pIcons_LOD->pTextures[v75] : 0), v77, (signed __int64)v78, 0, 255); - v68 = pPlayer; + v68 = v217; goto LABEL_192; } } @@ -7612,7 +7619,7 @@ } v78 = (double)GetTickCount() * 0.1; pRenderer->_4A63E6(a2f, a3f, (Texture *)(v75 != -1 ? (int)&pIcons_LOD->pTextures[v75] : 0), v77, (signed __int64)v78, 0, 255); - v68 = pPlayer; + v68 = v217; goto LABEL_192; } } @@ -7685,21 +7692,21 @@ if ( v116 == pIcons_LOD->FindTextureByName("pending") ) { LABEL_292: - v68 = pPlayer; + v68 = v217; LABEL_293: - if ( pFaceNum == 12 || pFaceNum == 13 ) + if ( v244 == 12 || v244 == 13 ) { - v122 = papredoll_dbrds[pFaceNum]; + v122 = papredoll_dbrds[v244]; if ( v122 != pIcons_LOD->FindTextureByName("Pending") ) - pRenderer->DrawTextureTransparent(pPaperdoll_BodyX + pPaperdoll_Beards[2 * pFaceNum - 24], - pPaperdoll_BodyY + pPaperdoll_Beards[2 * pFaceNum - 23], + pRenderer->DrawTextureTransparent(pPaperdoll_BodyX + pPaperdoll_Beards[2 * v244 - 24], + pPaperdoll_BodyY + pPaperdoll_Beards[2 * v244 - 23], (Texture *)(v122 != -1 ? (int)&pIcons_LOD->pTextures[v122] : 0)); } v123 = v68->pEquipment.uHelm; if ( !v123 ) goto LABEL_335; v237 = v123; - v124 = (int)&pPlayer->pInventoryItems[v123-1]; + v124 = (int)&v217->pInventoryItems[v123-1]; v226 = v124; if ( *(int *)v124 != 521 ) { @@ -7731,7 +7738,7 @@ a2j = pPaperdoll_BodyX + dword_4E58D0[v126]; a3i = pPaperdoll_BodyY + dword_4E58D4[v126]; if ( IsDwarf != 1 || *(int *)v124 != 92 ) - v127 = stru_511698.texids[v125 + 16 * pPlayer->GetSexByVoice()]; + v127 = stru_511698.texids[v125 + 16 * v250]; else v127 = papredoll_dbrds[11]; v128 = *(int *)(v124 + 20); @@ -7807,7 +7814,7 @@ if ( v128 & 2 ) { v133 = (Texture *)(v131 != 0 ? (int)v132 : 0); - pRenderer->_4A6776(a2j, a3i, v133); + pRenderer->DrawTransparentRedShade(a2j, a3i, v133); } else { @@ -7825,11 +7832,11 @@ if ( !bRingsShownInCharScreen ) pRenderer->_4A612A(a2j, a3i, v133, v237); LABEL_335: - v134 = pPlayer->pEquipment.uMainHand; + v134 = v217->pEquipment.uMainHand; if ( !v134 ) goto LABEL_358; - v238 = pPlayer->pEquipment.uMainHand; - v135 = (int)&pPlayer->pInventoryItems[v134-1]; + v238 = v217->pEquipment.uMainHand; + v135 = (int)&v217->pInventoryItems[v134-1]; v227 = v135; v136 = *(int *)v135; v137 = *(int *)v135; @@ -7848,7 +7855,7 @@ if ( v139 & 2 ) { v144 = (Texture *)(v142 != 0 ? (int)v143 : 0); - pRenderer->_4A6776(a2k, a3j, v144); + pRenderer->DrawTransparentRedShade(a2k, a3j, v144); } else { @@ -7866,11 +7873,11 @@ if ( !bRingsShownInCharScreen ) pRenderer->_4A612A(a2k, a3j, v144, v238); LABEL_358: - v145 = pPlayer->pEquipment.uOffHand; - v249 = pPlayer->pEquipment.uOffHand; + v145 = v217->pEquipment.uOffHand; + v249 = v217->pEquipment.uOffHand; if ( !v145 ) goto LABEL_393; - v146 = (int)&pPlayer->pInventoryItems[v145-1]; + v146 = (int)&v217->pInventoryItems[v145-1]; v228 = v146; v147 = *(int *)v146; v148 = *(int *)v146; @@ -7907,7 +7914,7 @@ if ( v155 & 2 ) { v159 = (Texture *)(v243 != -1 ? (int)&pIcons_LOD->pTextures[v243] : 0); - pRenderer->_4A6776(v150, a3k, v159); + pRenderer->DrawTransparentRedShade(v150, a3k, v159); } else { @@ -8111,7 +8118,7 @@ if ( *(int *)(v225 + 20) & 2 ) { v121 = (Texture *)(v119 != 0 ? (int)v120 : 0); - pRenderer->_4A6776(a2h, a3h, v121); + pRenderer->DrawTransparentRedShade(a2h, a3h, v121); } else { @@ -8221,7 +8228,7 @@ a3g = pPaperdoll_BodyY + v95; if ( v94 == pIcons_LOD->FindTextureByName("pending") ) { - v68 = pPlayer; + v68 = v217; goto LABEL_259; } if ( *(int *)(v242 + 516) & 0xF0 ) @@ -8244,7 +8251,7 @@ v97 = (double)GetTickCount(); pRenderer->_4A63E6(a2g, a3g, (Texture *)(v94 != -1 ? (int)&pIcons_LOD->pTextures[v94] : 0), (Texture *)v96, (signed __int64)(v97 * 0.1), v174, v187); - v68 = pPlayer; + v68 = v217; goto LABEL_259; } if ( (*(int *)(v242 + 516) & 0xF0) == 64 ) @@ -8263,7 +8270,7 @@ v97 = (double)GetTickCount(); pRenderer->_4A63E6(a2g, a3g, (Texture *)(v94 != -1 ? (int)&pIcons_LOD->pTextures[v94] : 0), (Texture *)v96, (signed __int64)(v97 * 0.1), v174, v187); - v68 = pPlayer; + v68 = v217; goto LABEL_259; } if ( (*(int *)(v242 + 516) & 0xF0) == 128 ) @@ -8282,7 +8289,7 @@ v97 = (double)GetTickCount(); pRenderer->_4A63E6(a2g, a3g, (Texture *)(v94 != -1 ? (int)&pIcons_LOD->pTextures[v94] : 0), (Texture *)v96, (signed __int64)(v97 * 0.1), v174, v187); - v68 = pPlayer; + v68 = v217; goto LABEL_259; } } @@ -8300,7 +8307,7 @@ v97 = (double)GetTickCount(); pRenderer->_4A63E6(a2g, a3g, (Texture *)(v94 != -1 ? (int)&pIcons_LOD->pTextures[v94] : 0), (Texture *)v96, (signed __int64)(v97 * 0.1), v174, v187); - v68 = pPlayer; + v68 = v217; goto LABEL_259; } v98 = v94 + 1; @@ -8312,10 +8319,10 @@ v188 = v101; v175 = a3g; v163 = a2g; - v100->_4A6776(v163, v175, v188); + v100->DrawTransparentRedShade(v163, v175, v188); if ( !bRingsShownInCharScreen ) pRenderer->_4A612A(a2g, a3g, v101, v235); - v68 = pPlayer; + v68 = v217; goto LABEL_259; } if ( *(char *)(v242 + 516) & 1 ) @@ -8327,7 +8334,7 @@ pRenderer->DrawTextureTransparent(v164, v176, v189); if ( !bRingsShownInCharScreen ) pRenderer->_4A612A(a2g, a3g, v101, v235); - v68 = pPlayer; + v68 = v217; goto LABEL_259; } v101 = (Texture *)(v98 != 0 ? (int)v99 : 0); @@ -8337,14 +8344,14 @@ pRenderer->DrawTransparentGreenShade(v165, v177, v190); if ( !bRingsShownInCharScreen ) pRenderer->_4A612A(a2g, a3g, v101, v235); - v68 = pPlayer; + v68 = v217; goto LABEL_259; } v102 = 17 * pBodyComplection + v90; v94 = paperdoll_array_511290[0][v102][1]; if ( v94 == pIcons_LOD->FindTextureByName("pending") ) { - v68 = pPlayer; + v68 = v217; goto LABEL_259; } v103 = pPaperdoll_BodyX + paperdoll_shoulder[0][v102][0]; @@ -8364,10 +8371,10 @@ v175 = v104; v163 = v103; v100 = pRenderer; - v100->_4A6776(v163, v175, v188); + v100->DrawTransparentRedShade(v163, v175, v188); if ( !bRingsShownInCharScreen ) pRenderer->_4A612A(a2g, a3g, v101, v235); - v68 = pPlayer; + v68 = v217; goto LABEL_259; } if ( v224 & 1 ) @@ -8380,7 +8387,7 @@ pRenderer->DrawTextureTransparent(v164, v176, v189); if ( !bRingsShownInCharScreen ) pRenderer->_4A612A(a2g, a3g, v101, v235); - v68 = pPlayer; + v68 = v217; goto LABEL_259; } v101 = (Texture *)(v109 != 0 ? (int)v110 : 0); @@ -8391,7 +8398,7 @@ pRenderer->DrawTransparentGreenShade(v165, v177, v190); if ( !bRingsShownInCharScreen ) pRenderer->_4A612A(a2g, a3g, v101, v235); - v68 = pPlayer; + v68 = v217; goto LABEL_259; } v106 = v105 - 16; @@ -8414,7 +8421,7 @@ v97 = (double)GetTickCount(); pRenderer->_4A63E6(a2g, a3g, (Texture *)(v94 != -1 ? (int)&pIcons_LOD->pTextures[v94] : 0), (Texture *)v96, (signed __int64)(v97 * 0.1), v174, v187); - v68 = pPlayer; + v68 = v217; goto LABEL_259; } v108 = v107 - 32; @@ -8434,7 +8441,7 @@ v97 = (double)GetTickCount(); pRenderer->_4A63E6(a2g, a3g, (Texture *)(v94 != -1 ? (int)&pIcons_LOD->pTextures[v94] : 0), (Texture *)v96, (signed __int64)(v97 * 0.1), v174, v187); - v68 = pPlayer; + v68 = v217; goto LABEL_259; } if ( v108 == 64 ) @@ -8453,7 +8460,7 @@ v97 = (double)GetTickCount(); pRenderer->_4A63E6(a2g, a3g, (Texture *)(v94 != -1 ? (int)&pIcons_LOD->pTextures[v94] : 0), (Texture *)v96, (signed __int64)(v97 * 0.1), v174, v187); - v68 = pPlayer; + v68 = v217; goto LABEL_259; } } @@ -8471,7 +8478,7 @@ v97 = (double)GetTickCount(); pRenderer->_4A63E6(a2g, a3g, (Texture *)(v94 != -1 ? (int)&pIcons_LOD->pTextures[v94] : 0), (Texture *)v96, (signed __int64)(v97 * 0.1), v174, v187); - v68 = pPlayer; + v68 = v217; goto LABEL_259; } v186 = 16; @@ -8656,11 +8663,11 @@ if ( dword_50C9A8 <= 0 ) { dword_50C9A8 = 0; - *(char *)(v32 + 20) &= 0xFu; + *(char *)(v219 + 20) &= 0xFu; ptr_50C9A4 = 0; } v40 = (double)GetTickCount() * 0.1; - pRenderer->_4A63E6(pX2, pY2, (Texture *)(v35 != -1 ? (int)&pIcons_LOD->pTextures[v35] : 0), v39, + pRenderer->_4A63E6(a2c, a3c, (Texture *)(v35 != -1 ? (int)&pIcons_LOD->pTextures[v35] : 0), v39, (signed __int64)v40, 0, 255); goto LABEL_93; } @@ -8670,11 +8677,11 @@ if ( dword_50C9A8 <= 0 ) { dword_50C9A8 = 0; - *(char *)(v32 + 20) &= 0xFu; + *(char *)(v219 + 20) &= 0xFu; ptr_50C9A4 = 0; } v40 = (double)GetTickCount() * 0.1; - pRenderer->_4A63E6(pX2, pY2, (Texture *)(v35 != -1 ? (int)&pIcons_LOD->pTextures[v35] : 0), v39, + pRenderer->_4A63E6(a2c, a3c, (Texture *)(v35 != -1 ? (int)&pIcons_LOD->pTextures[v35] : 0), v39, (signed __int64)v40, 0, 255); goto LABEL_93; } @@ -8686,11 +8693,11 @@ if ( dword_50C9A8 <= 0 ) { dword_50C9A8 = 0; - *(char *)(v32 + 20) &= 0xFu; + *(char *)(v219 + 20) &= 0xFu; ptr_50C9A4 = 0; } v40 = (double)GetTickCount() * 0.1; - pRenderer->_4A63E6(pX2, pY2, (Texture *)(v35 != -1 ? (int)&pIcons_LOD->pTextures[v35] : 0), v39, + pRenderer->_4A63E6(a2c, a3c, (Texture *)(v35 != -1 ? (int)&pIcons_LOD->pTextures[v35] : 0), v39, (signed __int64)v40, 0, 255); goto LABEL_93; } @@ -8701,11 +8708,11 @@ if ( dword_50C9A8 <= 0 ) { dword_50C9A8 = 0; - *(char *)(v32 + 20) &= 0xFu; + *(char *)(v219 + 20) &= 0xFu; ptr_50C9A4 = 0; } v40 = (double)GetTickCount() * 0.1; - pRenderer->_4A63E6(pX2, pY2, (Texture *)(v35 != -1 ? (int)&pIcons_LOD->pTextures[v35] : 0), v39, + pRenderer->_4A63E6(a2c, a3c, (Texture *)(v35 != -1 ? (int)&pIcons_LOD->pTextures[v35] : 0), v39, (signed __int64)v40, 0, 255); goto LABEL_93; } @@ -8742,7 +8749,7 @@ } v27 = (Texture *)(v241 != -1 ? (int)&pIcons_LOD->pTextures[v241] : 0); v28 = (double)GetTickCount() * 0.1; - pRenderer->_4A63E6(pX, pY, v27, a2b, (signed __int64)v28, 0, 255); + pRenderer->_4A63E6(v24, a3b, v27, a2b, (signed __int64)v28, 0, 255); goto LABEL_57; } v168 = "sptext01"; @@ -8756,7 +8763,7 @@ } v27 = (Texture *)(v241 != -1 ? (int)&pIcons_LOD->pTextures[v241] : 0); v28 = (double)GetTickCount() * 0.1; - pRenderer->_4A63E6(pX, pY, v27, a2b, (signed __int64)v28, 0, 255); + pRenderer->_4A63E6(v24, a3b, v27, a2b, (signed __int64)v28, 0, 255); goto LABEL_57; } v168 = "sp30a"; @@ -8772,7 +8779,7 @@ } v27 = (Texture *)(v241 != -1 ? (int)&pIcons_LOD->pTextures[v241] : 0); v28 = (double)GetTickCount() * 0.1; - pRenderer->_4A63E6(pX, pY, v27, a2b, (signed __int64)v28, 0, 255); + pRenderer->_4A63E6(v24, a3b, v27, a2b, (signed __int64)v28, 0, 255); goto LABEL_57; } v26 = pIcons_LOD; @@ -8787,35 +8794,35 @@ } v27 = (Texture *)(v241 != -1 ? (int)&pIcons_LOD->pTextures[v241] : 0); v28 = (double)GetTickCount() * 0.1; - pRenderer->_4A63E6(pX, pY, v27, a2b, (signed __int64)v28, 0, 255); + pRenderer->_4A63E6(v24, a3b, v27, a2b, (signed __int64)v28, 0, 255); goto LABEL_57;; } a3 = pPaperdoll_BodyY; a2 = pPaperdoll_BodyX; - v240 = 4 * uPlayerID - 4; + v240 = 4 * uPlayerID_ - 4; pRenderer->DrawTextureTransparent(pPaperdoll_BodyX, pPaperdoll_BodyY, (Texture *)(*(unsigned int *)((char *)papredoll_dbods + v240) != -1 ? (int)&pIcons_LOD->pTextures[*(unsigned int *)((char *)papredoll_dbods + v240)] : 0)); if ( !bRingsShownInCharScreen ) pRenderer->_4A612A(a2, a3, (Texture *)(*(unsigned int *)((char *)papredoll_dbods + v240) != -1 ? (int)&pIcons_LOD->pTextures[*(unsigned int *)((char *)papredoll_dbods + v240)] : 0), pPlayer->pEquipment.uBody); - uPlayerID_a = 2 * pBodyComplection; + uPlayerID_a = 2 * v5; v6 = pPlayer->pEquipment.uMainHand; if ( !v6 || (v7 = *(int *)&pPlayer->pInventoryItems[v6-1], pItemsTable->pItems[v7].uEquipType != 1) && (pItemsTable->pItems[v7].uSkillType != 4 || pPlayer->pEquipment.uOffHand) ) - pRenderer->DrawTextureTransparent(pPaperdoll_BodyX + pPaperdoll_LeftHand[pBodyComplection][0], pPaperdoll_BodyY + pPaperdoll_LeftHand[pBodyComplection][1], + pRenderer->DrawTextureTransparent(pPaperdoll_BodyX + pPaperdoll_LeftHand[v5][0], pPaperdoll_BodyY + pPaperdoll_LeftHand[v5][1], (Texture *)(*(unsigned int *)((char *)papredoll_dlads + v240) != -1 ? (int)&pIcons_LOD->pTextures[*(unsigned int *)((char *)papredoll_dlads + v240)] : 0)); v8 = pPlayer->pEquipment.uMainHand; if ( v8 ) { v229 = pPlayer->pEquipment.uMainHand; - v9 = (int)&pPlayer->pInventoryItems[v8-1]; - v10 = pBodyComplection << 7; + v9 = (int)&v217->pInventoryItems[v8-1]; + v10 = v5 << 7; v218 = v9; v11 = *(int *)v9; v12 = *(int *)v9; - v13 = pPaperdoll_BodyX + paperdoll_Weapon[pBodyComplection][1][0] - pItemsTable->pItems[v12].uEquipX; + v13 = pPaperdoll_BodyX + paperdoll_Weapon[v5][1][0] - pItemsTable->pItems[v12].uEquipX; a2a = v13; a3a = pPaperdoll_BodyY + *(int *)((char *)&paperdoll_Weapon[0][1][1] + v10) - pItemsTable->pItems[v12].uEquipY; if ( v11 == 64 ) @@ -8896,7 +8903,7 @@ if ( v15 & 2 ) { v20 = (Texture *)(v18 != 0 ? (int)v19 : 0); - pRenderer->_4A6776(a2a, a3a, v20); + pRenderer->DrawTransparentRedShade(a2a, a3a, v20); } else { @@ -8918,11 +8925,11 @@ pRenderer->DrawTextureTransparent(pPaperdoll_BodyX + pPaperdoll_RightHand[uPlayerID_a], pPaperdoll_BodyY + pPaperdoll_RightHand[uPlayerID_a + 1], (Texture *)(*(unsigned int *)((char *)papredoll_drhs + v240) != -1 ? (int)&pIcons_LOD->pTextures[*(unsigned int *)((char *)papredoll_drhs + v240)] : 0)); - v161 = pPlayer->pEquipment.uMainHand; + v161 = v217->pEquipment.uMainHand; if ( v161 ) { - v162 = *(int *)&pPlayer->pInventoryItems[v161-1]; - if ( pItemsTable->pItems[v162].uEquipType == 1 || pItemsTable->pItems[v162].uSkillType == 4 && !pPlayer->pEquipment.uOffHand ) + v162 = *(int *)&v217->pInventoryItems[v161-1]; + if ( pItemsTable->pItems[v162].uEquipType == 1 || pItemsTable->pItems[v162].uSkillType == 4 && !v217->pEquipment.uOffHand ) pRenderer->DrawTextureTransparent(pPaperdoll_BodyX + pPaperdoll_SecondLeftHand[0][uPlayerID_a], pPaperdoll_BodyY + pPaperdoll_SecondLeftHand[0][uPlayerID_a + 1], (Texture *)(*(unsigned int *)((char *)papredoll_dlhus + v240) != -1 ? (int)&pIcons_LOD->pTextures[*(unsigned int *)((char *)papredoll_dlhus + v240)] : 0)); @@ -9056,7 +9063,7 @@ if ( v6 & 2 ) { v10 = (Texture *)(v9 != 0 ? (int)&pIcons_LOD->pTextures[v5] : 0); - pRenderer->_4A6776(a2, a3, v10); + pRenderer->DrawTransparentRedShade(a2, a3, v10); } else { @@ -9100,7 +9107,7 @@ v21 = 9 * v16; v22 = 493; v23 = (Texture *)(v20 != 0 ? (int)&pIcons_LOD->pTextures[8 * v21 / 0x48u] : 0); - pRenderer->_4A6776(0x1EDu, 0x5Bu, v23); + pRenderer->DrawTransparentRedShade(0x1EDu, 0x5Bu, v23); } else { @@ -9180,7 +9187,7 @@ if ( v29 & 2 ) { v34 = v33 != 0 ? (int)&pIcons_LOD->pTextures[v28] : 0; - pRenderer->_4A6776(0x24Au, 0x58u, (Texture *)v34); + pRenderer->DrawTransparentRedShade(0x24Au, 0x58u, (Texture *)v34); } else { @@ -10214,7 +10221,7 @@ } //----- (004065B0) -------------------------------------------------------- -__int16 stru262_TurnBased::_4065B0() +void stru262_TurnBased::_4065B0() { stru262_TurnBased *v1; // esi@1 signed int v2; // eax@1 @@ -10254,14 +10261,13 @@ if ( v1->uActorQueueSize > 0 ) { do - LOWORD(v2) = v1->_406648(v5++); + v1->_406648(v5++); while ( (signed int)v5 < v1->uActorQueueSize ); } - return v2; } //----- (00406648) -------------------------------------------------------- -__int16 stru262_TurnBased::_406648(unsigned int a2) +void stru262_TurnBased::_406648(unsigned int a2) { TurnBased_QueueElem *v1; // ecx@1 int v3; // eax@1 @@ -10352,19 +10358,20 @@ v16 = a2a; if ( !(v14 % 2) ) { - LOWORD(v3) = Actor::_402F87(v4, a2a, &a4); - return v3; + Actor::_402F87(v4, a2a, &a4); + return; } v21 = 64; LABEL_26: - LOWORD(v3) = Actor::_403EB6(v15, v16, v21, v23); - return v3; + Actor::_403EB6(v15, v16, v21, v23); + return; } LABEL_21: v5->uCurrentActionTime = 0; v5->uCurrentActionLength = 0; v5->uAIState = Dead; - return pActors[v4].UpdateAnimation(); + pActors[v4].UpdateAnimation(); + return; } v24 = v5->pMonsterInfo.uSpellSkillAndMastery2; v22 = 3; @@ -10399,7 +10406,6 @@ } } } - return v3; } // 50FE08: using guessed type stru298 stru_50FE08; @@ -11834,7 +11840,7 @@ ++sDepthb ) { v62 = &pIndoor->pFaces[(*(unsigned __int16 **)((char *)&v60->pWalls + v61))[sDepthb]]; - if ( v62->uAttributes & 1 + if ( v62->TwoSided() || v119 > v62->pBounding.x2 || v123 < v62->pBounding.x1 || v127 > v62->pBounding.y2 @@ -12000,7 +12006,7 @@ while ( 1 ) { v90 = &pIndoor->pFaces[(*(unsigned __int16 **)((char *)&v88->pWalls + v89))[v162]]; - if ( v90->uAttributes & 1 + if ( v90->TwoSided() || v120 > v90->pBounding.x2 || v124 < v90->pBounding.x1 || v128 > v90->pBounding.y2 @@ -12369,7 +12375,7 @@ if (!v8 || v7) if (!v6 || v5) - if (actor->_438B9B()) + if (actor->IsPeasant()) BYTE2(actor->uAttributes) &= 0xF7u; BYTE2(actor->uAttributes) &= 0x7Fu; @@ -13515,11 +13521,12 @@ else dword_50654C = 0; - char *v11 = &pPlayer->field_152[11 * school + 63]; + //char *v11 = &pPlayer->field_152[11 * school + 63]; for (uint i = 1; i < 12; ++i) { - if (v11[i]) + //if (v11[i]) + if (pPlayer->spellbook.pChapters[school].bIsSpellAvailable[i - 1]) { sprintf(pContainer, "SB%sS%02d", spellbook_texture_filename_suffices[school], pSpellbookSpellIndices[school][i]); dword_506408[i] = pIcons_LOD->LoadTexturePtr(pContainer, TEXTURE_16BIT_PALETTE); @@ -15555,7 +15562,7 @@ { if ( v26 < 800 ) { - pItemGen.uAttributes |= 1u; + pItemGen.SetIdentified(); pItemGen.uItemID = v26; if ( pItemsTable->pItems[v26].uEquipType == 12 ) {
--- a/mm7_6.cpp Wed Feb 20 20:50:22 2013 +0600 +++ b/mm7_6.cpp Wed Feb 20 20:51:55 2013 +0600 @@ -2170,7 +2170,7 @@ } //----- (0042777D) -------------------------------------------------------- -bool __fastcall _42777D_CastSpell_UseWand_ShootArrow(int a1, unsigned int uPlayerID, unsigned int a4, __int16 a5, int a6) +void _42777D_CastSpell_UseWand_ShootArrow(int a1, unsigned int uPlayerID, unsigned int a4, __int16 a5, int a6) { bool result; // eax@2 __int16 v6; // bx@4 @@ -2355,18 +2355,19 @@ if ( v6 & 2 ) { if ( pGUIWindow_Settings ) - return result; + return; pGUIWindow_Settings = GUIWindow::Create(0, 0, 640, 480, (WindowType)(WINDOW_HouseInterior|0x2), (int)&pStru277[result], 0); pGUIWindow_Settings->CreateButton(0x34u, 0x1A6u, 0x23u, 0, 2, 0, 0x45u, 0, 0x31u, "", 0); pGUIWindow_Settings->CreateButton(0xA5u, 0x1A6u, 0x23u, 0, 2, 0, 0x45u, 1u, 0x32u, "", 0); pGUIWindow_Settings->CreateButton(0x118u, 0x1A6u, 0x23u, 0, 2, 0, 0x45u, 2u, 0x33u, "", 0); pGUIWindow_Settings->CreateButton(0x186u, 0x1A6u, 0x23u, 0, 2, 0, 0x45u, 3u, 0x34u, "", 0); - return sub_421B2C_PlaceInInventory_or_DropPickedItem(); + sub_421B2C_PlaceInInventory_or_DropPickedItem(); + return; } if ( v6 & 8 ) { if ( pGUIWindow_Settings ) - return result; + return; v17 = GUIWindow::Create(0, 0, 640, 480, (WindowType)(WINDOW_HouseInterior|0x2), (int)&pStru277[result], 0); v29 = 0; v28 = ""; @@ -2384,12 +2385,13 @@ v18 = v17; LABEL_56: v18->CreateButton(v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29); - return sub_421B2C_PlaceInInventory_or_DropPickedItem(); + sub_421B2C_PlaceInInventory_or_DropPickedItem(); + return; } if ( v6 & 0x40 ) { if ( pGUIWindow_Settings ) - return result; + return; v17 = GUIWindow::Create(0, 0, 640, 480, (WindowType)(WINDOW_HouseInterior|0x2), (int)&pStru277[result], 0); v29 = 0; v28 = ""; @@ -2401,20 +2403,21 @@ if ( (char)v6 < 0 ) { if ( pGUIWindow_Settings ) - return result; + return; ++pIcons_LOD->uTexturePacksCount; if ( !pIcons_LOD->uNumPrevLoadedFiles ) pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles; pGUIWindow_Settings = pStru277[result].sub_4219BE(); unk_50C9A0 = 1; some_active_character = uActiveCharacter; - return sub_421B2C_PlaceInInventory_or_DropPickedItem(); + sub_421B2C_PlaceInInventory_or_DropPickedItem(); + return; } if ( HIBYTE(v6) & 1 ) { if ( pGUIWindow_Settings ) - return result; - pGUIWindow_Settings = GUIWindow::Create(0, 0, 640, 480, (WindowType)(WINDOW_HouseInterior|0x2), 20 * result + 5292232, 0); + return; + pGUIWindow_Settings = GUIWindow::Create(0, 0, 640, 480, (WindowType)(WINDOW_HouseInterior|0x2), (int)&pStru277[result], 0); pGUIWindow_Settings->CreateButton(0x34u, 0x1A6u, 0x23u, 0, 2, 0, 0x8Du, 0, 0x31u, "", 0); pGUIWindow_Settings->CreateButton(0xA5u, 0x1A6u, 0x23u, 0, 2, 0, 0x8Du, 1u, 0x32u, "", 0); pGUIWindow_Settings->CreateButton(0x118u, 0x1A6u, 0x23u, 0, 2, 0, 0x8Du, 2u, 0x33u, "", 0); @@ -2435,50 +2438,38 @@ } if ( HIBYTE(v6) & 2 && !pGUIWindow_Settings ) { - pGUIWindow_Settings = GUIWindow::Create(0, 0, 640, 480, (WindowType)(WINDOW_HouseInterior|0x2), 20 * result + 5292232, 0); + pGUIWindow_Settings = GUIWindow::Create(0, 0, 640, 480, (WindowType)(WINDOW_HouseInterior|0x2), (int)&pStru277[result], 0); pBtn_NPCLeft = pGUIWindow_Settings->CreateButton( 0x1D5u, 0xB2u, - (uTextureID_507990 != -1 ? pIcons_LOD->pTextures[uTextureID_507990].uTextureWidth : 24), - (uTextureID_507990 != -1 ? pIcons_LOD->pTextures[uTextureID_507990].uTextureHeight : 26), + (uTextureID_Btn_NPCLeft != -1 ? pIcons_LOD->pTextures[uTextureID_Btn_NPCLeft].uTextureWidth : 24), + (uTextureID_Btn_NPCLeft != -1 ? pIcons_LOD->pTextures[uTextureID_Btn_NPCLeft].uTextureHeight : 26), 1, 0, 0xBCu, 0, 0, "", - (Texture *)(uTextureID_507990 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_507990] : 0), + (Texture *)(uTextureID_Btn_NPCLeft != -1 ? &pIcons_LOD->pTextures[uTextureID_Btn_NPCLeft] : 0), 0); pBtn_NPCRight = pGUIWindow_Settings->CreateButton( 0x272u, 0xB2u, - (uTextureID_50798C != -1 ? pIcons_LOD->pTextures[uTextureID_50798C].uTextureWidth : 24), - (uTextureID_50798C != -1 ? pIcons_LOD->pTextures[uTextureID_50798C].uTextureHeight : 26), + (uTextureID_Btn_NPCRight != -1 ? pIcons_LOD->pTextures[uTextureID_Btn_NPCRight].uTextureWidth : 24), + (uTextureID_Btn_NPCRight != -1 ? pIcons_LOD->pTextures[uTextureID_Btn_NPCRight].uTextureHeight : 26), 1, 0, 0xBCu, 1u, 0, "", - (Texture *)(uTextureID_50798C != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_50798C] : 0), + (Texture *)(uTextureID_Btn_NPCRight != -1 ? &pIcons_LOD->pTextures[uTextureID_Btn_NPCRight] : 0), 0); pGUIWindow_Settings->CreateButton(0x1EBu, 0x95u, 0x40u, 0x4Au, 1, 0, 0x8Fu, 4u, 0x35u, "", 0); - result = (bool)pGUIWindow_Settings->CreateButton( - 0x231u, - 0x95u, - 0x40u, - 0x4Au, - 1, - 0, - 0x8Fu, - 5u, - 0x36u, - "", - 0); + pGUIWindow_Settings->CreateButton(0x231u, 0x95u, 0x40u, 0x4Au, 1, 0, 0x8Fu, 5u, 0x36u, "", 0); } } } - return result; } @@ -4011,7 +4002,7 @@ v730c->UpdateTempBonus(pParty->uTimePlayed); if ( v730c->uItemID < 64 || v730c->uItemID > 65 ) { - if ( !(v730c->uAttributes & 2) ) + if (!v730c->Broken()) { if ( v730c->uAdditionalValue == v1 ) { @@ -4522,9 +4513,9 @@ } else { - v155 = stru_5C6E00->SinCos(pParty->sRotationY); + v155 = stru_5C6E00->Cos(pParty->sRotationY); uRequiredMana = pParty->vPosition.x + sub_42EBBE(2048, v155); - v156 = stru_5C6E00->_42EBDB(pParty->sRotationY); + v156 = stru_5C6E00->Sin(pParty->sRotationY); LODWORD(v727) = pParty->vPosition.y + sub_42EBBE(2048, v156); v154 = pParty->vPosition.z; } @@ -4926,9 +4917,9 @@ } else { - v212 = stru_5C6E00->SinCos(pParty->sRotationY); + v212 = stru_5C6E00->Cos(pParty->sRotationY); LODWORD(v718) = pParty->vPosition.x + sub_42EBBE(2048, v212); - v213 = stru_5C6E00->_42EBDB(pParty->sRotationY); + v213 = stru_5C6E00->Sin(pParty->sRotationY); v214 = sub_42EBBE(2048, v213); v211 = pParty->vPosition.z; v713 = pParty->vPosition.y + v214; @@ -5425,7 +5416,7 @@ || v726->pInventoryItems[a2].uAdditionalValue != v1 || v726->pInventoryItems[a2]._bonus_type != v1 || v726->pInventoryItems[a2]._bonus_strength != v1 - || (_this = (ItemGen *)((char *)&v726->pInventoryItems[a2] + 20), v726->pInventoryItems[a2].uAttributes & 2) ) + || (_this = (ItemGen *)((char *)&v726->pInventoryItems[a2] + 20), v726->pInventoryItems[a2].Broken()) ) goto LABEL_616; v247 = (char *)&pItemsTable->pItems[v246].pIconName; LODWORD(v725) = (int)v247; @@ -5533,7 +5524,7 @@ || (v291 = pItemsTable->pItems[v290].uEquipType) == 0 || v291 == 1 || v291 == 2 - || _this->uAttributes & 2 ) + || _this->Broken()) goto LABEL_616; if ( _this->GetValue() < 0x1C2 ) uRequiredMana = 1; @@ -7826,9 +7817,9 @@ // 42EBBE: using guessed type int __fastcall sub_42EBBE(int, int); //----- (0042EBDB) -------------------------------------------------------- -int stru193_math::_42EBDB(int angle) +int stru193_math::Sin(int angle) { - return SinCos(angle - this->uIntegerHalfPi); + return Cos(angle - this->uIntegerHalfPi); } //----- (0042ECB5) -------------------------------------------------------- @@ -7970,7 +7961,7 @@ Vec3_int_::Normalize(&a3.x, &a3.y, &a3.z); DamageMonsterFromParty((8 * (uActiveCharacter - 1)) | OBJECT_Player, target_id, &a3); - if (player->WearsItem(506, 1) || player->WearsItem(506, 0)) + if (player->WearsItem(ITEM_ARTIFACT_SPLITTER, 1) || player->WearsItem(ITEM_ARTIFACT_SPLITTER, 0)) _42FA66_do_explosive_impact( actor->vPosition.x, actor->vPosition.y, @@ -8409,11 +8400,11 @@ v12 = 0; if ( a4 ) { - a4a = stru_5C6E00->SinCos(angle); - v13 = (unsigned __int64)(a4a * (signed __int64)stru_5C6E00->SinCos(pitch)) >> 16; - a4b = stru_5C6E00->SinCos(angle - stru_5C6E00->uIntegerHalfPi); - a5a = (unsigned __int64)(a4b * (signed __int64)stru_5C6E00->SinCos(pitch)) >> 16; - v14 = stru_5C6E00->SinCos(pitch - stru_5C6E00->uIntegerHalfPi); + a4a = stru_5C6E00->Cos(angle); + v13 = (unsigned __int64)(a4a * (signed __int64)stru_5C6E00->Cos(pitch)) >> 16; + a4b = stru_5C6E00->Sin(angle); + a5a = (unsigned __int64)(a4b * (signed __int64)stru_5C6E00->Cos(pitch)) >> 16; + v14 = stru_5C6E00->Sin(pitch); v9->vVelocity.x = (unsigned int)(v13 * v11) >> 16; v9->vVelocity.y = (unsigned int)(a5a * v11) >> 16; v12 = (unsigned int)(v14 * v11) >> 16;
--- a/mm7_data.cpp Wed Feb 20 20:50:22 2013 +0600 +++ b/mm7_data.cpp Wed Feb 20 20:51:55 2013 +0600 @@ -67,7 +67,71 @@ Award pAwards[104]; #include "stru159.h" -stru159 pAnimatedRooms[196]; +stru159 pAnimatedRooms[196] = +{ + "", 0x00000004, 0x000001F4, 0x00000000, + "Human Armor01", 0x00000020, 0x000002C0, 0x00003A02, + "Necromancer Armor01", 0x00000020, 0x000002D7, 0x00004602, + "Dwarven Armor01", 0x00000020, 0x000002EE, 0x00000502, + "Wizard Armor", 0x00000020, 0x000003BD, 0x00001302, + "Warlock Armor", 0x00000020, 0x000002D6, 0x00002302, + "Elf Armor", 0x00000020, 0x000002BC, 0x00004F02, + "Human Alchemisht01", 0x0000000E, 0x000002BE, 0x00005F04, + "Necromancer Alchemist01", 0x0000000E, 0x000002D6, 0x00004504, + "Dwarven Achemist01", 0x0000000E, 0x00000387, 0x00000404, + "Wizard Alchemist", 0x0000000E, 0x00000232, 0x00001904, + "Warlock Alchemist", 0x0000000E, 0x000002BE, 0x00002A04, + "Elf Alchemist", 0x0000000E, 0x0000038A, 0x00005404, + "Human Bank01", 0x00000006, 0x00000384, 0x00003416, + "Necromancer Bank01", 0x00000006, 0x000002D8, 0x00004716, + "Dwarven Bank", 0x00000006, 0x000002F3, 0x00000616, + "Wizard Bank", 0x00000006, 0x000003BA, 0x00001416, + "Warlock Bank", 0x00000006, 0x0000039F, 0x00002416, + "Elf Bank", 0x00000006, 0x000002BC, 0x00004716, + "Boat01", 0x0000000F, 0x0000004C, 0x0003351C, + "Boat01d", 0x0000000F, 0x0000004C, 0x0003351C, + "Human Magic Shop01", 0x0000000A, 0x000002C8, 0x00003603, + "Necromancer Magic Shop01", 0x0000000E, 0x000002DC, 0x00004203, + "Dwarven Magic Shop01", 0x0000002A, 0x000002EF, 0x00005B03, + "Wizard Magic Shop", 0x0000001E, 0x000002DF, 0x00000F03, + "Warlock Magic Shop", 0x00000007, 0x000003B9, 0x00001F03, + "Elf Magic Shop", 0x00000024, 0x000002CC, 0x00005203, + "Human Stables01", 0x00000021, 0x00000031, 0x0003301B, + "Necromancer Stables", 0x00000021, 0x000002DD, 0x0003431B, + "", 0x00000021, 0x000002F0, 0x00035B1B, + "Wizard Stables", 0x00000021, 0x000003BA, 0x0003101B, + "Warlock Stables", 0x00000021, 0x00000181, 0x0003201B, + "Elf Stables", 0x00000021, 0x00000195, 0x00034D1B, + "Human Tavern01", 0x0000000D, 0x000002C2, 0x00003115, + "Necromancer Tavern 01", 0x0000000D, 0x000003B0, 0x00003915, + "Dwarven Tavern01", 0x0000000D, 0x000002FE, 0x00005E15, + "Wizard Tavern", 0x0000000D, 0x000003BB, 0x00001115, + "Warlock Tavern", 0x0000000D, 0x000003A8, 0x00002115, + "Elf Tavern", 0x0000000D, 0x000002CD, 0x00004E15, + "Human Temple01", 0x00000024, 0x000002DB, 0x00033217, + "Necromancer Temple", 0x00000024, 0x000002DF, 0x00033C17, + "Dwarven Temple01", 0x00000024, 0x000002F1, 0x00035617, + "Wizard Temple", 0x00000024, 0x000002E0, 0x00030A17, + "Warlock Temple", 0x00000024, 0x000003A4, 0x00031B17, + "Elf Temple", 0x00000024, 0x000002CE, 0x00034817, + "Human Town Hall", 0x00000010, 0x0000039C, 0x00000E11, + "Necromancer Town Hall01", 0x00000010, 0x000003A4, 0x00003D11, + "Dwarven Town Hall", 0x00000010, 0x000002DB, 0x00005811, + "Wizard Town Hall", 0x00000010, 0x000003BD, 0x00000B11, + "Warlock Town Hall", 0x00000010, 0x000002DB, 0x00001C11, + "Elf Town Hall", 0x00000010, 0x0000027A, 0x00004911, + "Human Training Ground01", 0x00000018, 0x000002C7, 0x00002C1E, + "Necromancer Training Ground", 0x00000018, 0x000003AD, 0x00003E1E, + "Dwarven Training Ground", 0x00000018, 0x000002F2, 0x0000591E, + "Wizard Training Ground", 0x00000018, 0x000003A3, 0x00000C1E, + "Warlock Training Ground", 0x00000018, 0x000003A6, 0x00001D1E, + "Elf Training Ground", 0x00000018, 0x0000019F, 0x00004A1E, + "Human Weapon Smith01", 0x00000016, 0x000002C1, 0x00042D01, + "Necromancer Weapon Smith01", 0x00000016, 0x000002D9, 0x00043F01, + "Dwarven Weapon Smith01", 0x00000016, 0x000002EE, 0x00045201, + "Wizard Weapon Smith", 0x00000016, 0x000002D5, 0x00040D01, + "Warlock Weapon Smith", 0x00000016, 0x000002D7, 0x00041701 +}; #include "stru160.h" stru160 array_4EB8B8[66] = @@ -376,7 +440,7 @@ char aPending[777]; // idb char aCanTFindS[777]; // idb char pDayMoonPhase[28]; -char *spellbook_texture_filename_suffices[8]; // weak +char *spellbook_texture_filename_suffices[8] = {"f", "a", "w", "e", "s", "m", "b", "l"}; // weak __int16 word_4E1D3A[777]; // weak __int16 pTownPortalBook_xs[6]; __int16 pTownPortalBook_ys[6]; @@ -480,8 +544,8 @@ char byte_4E28FC; // weak unsigned int uGammaPos; int dword_4E2910[777]; // weak -__int16 RightClickPortraitXmin[4]; -__int16 RightClickPortraitXmax[4]; +__int16 RightClickPortraitXmin[4]={0x14, 0x83, 0xF2, 0x165}; +__int16 RightClickPortraitXmax[4]={0x53, 0xC6, 0x138, 0x1A7}; void *off_4E2A12; // weak int pArmorSkills[5]={ 9, 10, 11, 8, 30}; int pWeaponSkills[9]={3, 5, 2, 6, 4, 0, 1, 31, 7}; @@ -1589,14 +1653,14 @@ int dword_507964; // weak int dword_507968; // weak int dword_50796C; // weak -int dword_507974; // weak +int uTextureID_Btn_QuickReference; // weak int dword_5079B4; // weak int dword_5079C8; // weak int dword_5079CC; // weak int dword_5079D0; // weak int dword_5079D8; // weak -struct GUIButton *dword_507A14; // idb -struct GUIButton *dword_507A18; // idb +struct GUIButton *pBtn_ZoomOut; // idb +struct GUIButton *pBtn_ZoomIn; // idb unsigned int uGameUIFontShadow; unsigned int uGameUIFontMain; int dword_507B00_spell_info_to_draw_in_popup; // weak @@ -2092,8 +2156,8 @@ //_UNKNOWN unk_F8BA50; // weak char byte_F8BC0C; // weak int bGameoverLoop = 0; // weak -__int16 word_F8BC48_displaced_face_intersect_plane_coords_a; // idb -__int16 word_F8BD18_displaced_face_intersect_plane_coords_b; // idb +__int16 word_F8BC48_displaced_face_intersect_plane_coords_a[104]; // idb +__int16 word_F8BD18_displaced_face_intersect_plane_coords_b[104]; // idb int dword_F93F20; // weak int dword_F93F70; // weak
--- a/mm7_data.h Wed Feb 20 20:50:22 2013 +0600 +++ b/mm7_data.h Wed Feb 20 20:51:55 2013 +0600 @@ -366,7 +366,7 @@ extern char aPending[]; // idb extern char aCanTFindS[]; // idb extern char pDayMoonPhase[28]; -extern char *spellbook_texture_filename_suffices[8]; // weak +extern char *spellbook_texture_filename_suffices[]; // weak extern __int16 word_4E1D3A[]; // weak extern __int16 pTownPortalBook_xs[6]; extern __int16 pTownPortalBook_ys[6]; @@ -1198,14 +1198,14 @@ extern int dword_507964; // weak extern int dword_507968; // weak extern int dword_50796C; // weak -extern int dword_507974; // weak +extern int uTextureID_Btn_QuickReference; // weak extern int dword_5079B4; // weak extern int dword_5079C8; // weak extern int dword_5079CC; // weak extern int dword_5079D0; // weak extern int dword_5079D8; // weak -extern struct GUIButton *dword_507A14; // idb -extern struct GUIButton *dword_507A18; // idb +extern struct GUIButton *pBtn_ZoomOut; // idb +extern struct GUIButton *pBtn_ZoomIn; // idb extern unsigned int uGameUIFontShadow; extern unsigned int uGameUIFontMain; extern int dword_507B00_spell_info_to_draw_in_popup; // weak @@ -1712,8 +1712,8 @@ //extern _UNKNOWN unk_F8BA50; // weak extern char byte_F8BC0C; // weak extern int bGameoverLoop; // weak -extern __int16 word_F8BC48_displaced_face_intersect_plane_coords_a; // idb -extern __int16 word_F8BD18_displaced_face_intersect_plane_coords_b; // idb +extern __int16 word_F8BC48_displaced_face_intersect_plane_coords_a[]; // idb +extern __int16 word_F8BD18_displaced_face_intersect_plane_coords_b[]; // idb //extern _UNKNOWN unk_F8EA04; // weak //extern _UNKNOWN unk_F8F8F8; // weak extern int dword_F93F20; // weak @@ -1893,7 +1893,7 @@ void __cdecl GameUI_DrawStatusBar(); bool __thiscall sub_41CD4F(unsigned int _this); char __fastcall sub_41D20D_buff_remaining_time_string(int ecx0, struct GUIWindow *edx0, __int64 a3, struct GUIFont *a2); -void __thiscall GameUI_DrawItemInfo(struct ItemGen *_this); // idb +void GameUI_DrawItemInfo(struct ItemGen *_this); // idb char *__fastcall MonsterPopup_Draw(unsigned int uActorID, struct GUIWindow *edx0); void __cdecl nullsub_3(); // idb void __cdecl LoadActualSkyFrame(); @@ -1930,7 +1930,7 @@ void __cdecl sub_426947(); int __fastcall sub_4269A2_GivePartyExp(unsigned int a1); bool __fastcall sub_427769_spell(unsigned int uSpellID); -bool __fastcall _42777D_CastSpell_UseWand_ShootArrow(int a1, unsigned int uPlayerID, unsigned int a4, __int16 a5, int a6); +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 *); @@ -1963,7 +1963,7 @@ 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); -__int16 __fastcall sub_43B1B0(signed int a1, unsigned int a2, struct Vec3_int_ *pVelocity, signed int a4); +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(); @@ -2000,10 +2000,9 @@ void GameUI_DrawMinimap(unsigned int uX, unsigned int uY, unsigned int uZ, unsigned int uW, unsigned int uZoom, unsigned int bRedrawOdmMinimap); int __fastcall DrawBook_Map_sub(unsigned int x, unsigned int y, unsigned int a4, int a5, int _48074); // idb void Initialize2DA(); -unsigned int LoadEventsToBuffer(const char *pContainerName, char *pBuffer, unsigned int uBufferSize); -void __cdecl Initialize_GlobalEVT(); + void __cdecl LoadLevel_InitializeLevelStr(); -void __cdecl LoadLevel_InitializeLevelEvt(); + void __cdecl OnMapLeave(); void /*__usercall*/ OnMapLoad(); void __thiscall Level_LoadEvtAndStr(const char *pLevelName); @@ -2030,7 +2029,7 @@ int __fastcall IsActorAlive(unsigned int uType, unsigned int uParam, unsigned int uNumAlive); // idb // void __cdecl crt_construct_5773C4(); bool __thiscall sub_4466C4(void *_this); -void __fastcall EventProcessor(int a1, int a2, int a3); + 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 @@ -2099,7 +2098,7 @@ void __fastcall PrepareToLoadODM(unsigned int bLoading, struct OutdoorCamera *a2); void __cdecl sub_461103(); int __cdecl sub_4613C4(); -int __fastcall sub_4621DA(signed int a1, signed int a2, signed int a3); +int __fastcall int_get_vector_length(signed int a1, signed int a2, signed int a3); int __cdecl sub_46224A(); int __cdecl crt_init_globals_462620(); void __cdecl crt_init_globals_462659();