Mercurial > mm7
changeset 325:875ba5966ceb
Слияние
author | Ritor1 |
---|---|
date | Wed, 20 Feb 2013 09:24:02 +0600 |
parents | b7f0c5abca42 (current diff) ce39b96acf5c (diff) |
children | ead95219160c |
files | Player.cpp |
diffstat | 34 files changed, 2784 insertions(+), 2983 deletions(-) [+] |
line wrap: on
line diff
--- a/Actor.cpp Wed Feb 20 09:23:48 2013 +0600 +++ b/Actor.cpp Wed Feb 20 09:24:02 2013 +0600 @@ -1,3 +1,5 @@ +#include <assert.h> + #include "Actor.h" #include "LayingItem.h" #include "Math.h" @@ -297,16 +299,16 @@ } //----- (004089C7) -------------------------------------------------------- -bool Actor::IsAlive() +bool Actor::IsNotAlive() { signed int v1; // esi@1 - unsigned __int16 v2; // ax@3 + //unsigned __int16 v2; // ax@3 v1 = 0; - if ( (signed __int64)this->pActorBuffs[5].uExpireTime > 0 ) + if (pActorBuffs[5].uExpireTime) v1 = 1; - v2 = this->uAIState; - return (v1 | (v2 == Dying) | (v2 == Dead) | (v2 == Removed) | (v2 == Summoned) | (v2 == Disabled)) != 0; + //v2 = this->uAIState; + return (v1 | (uAIState == Dying) | (uAIState == Dead) | (uAIState == Removed) | (uAIState == Summoned) | (uAIState == Disabled)) != 0; } //----- (004086E9) -------------------------------------------------------- @@ -589,7 +591,7 @@ a1.uSectorID = pIndoor->GetSector(v13, v14, v15); v18 = 8 * LODWORD(v120); LOBYTE(v18) = 8 * LOBYTE(v120) | AI_OBJECT_ACTOR; - a1.field_58 = v18; + a1.field_58_pid = v18; a1.uSpriteFrameID = 0; a1.field_5C = 0; a1.field_60_distance_related_prolly_lod = 3; @@ -672,9 +674,9 @@ a1.uSectorID = v88; LODWORD(v119) = v89; v90 = 8 * LODWORD(v120); - LOBYTE(v90) = 8 * LOBYTE(v120) | 3; + LOBYTE(v90) = 8 * LOBYTE(v120) | OBJECT_Actor; a1.uSpriteFrameID = 0; - a1.field_58 = v90; + a1.field_58_pid = v90; a1.field_5C = 0; a1.field_60_distance_related_prolly_lod = 3; if ( (double)v89 >= 307.2 ) @@ -809,7 +811,7 @@ a1.uAttributes = 0; a1.uSectorID = 0; a1.uSpriteFrameID = 0; - a1.field_58 = v116; + a1.field_58_pid = v116; a1.field_5C = 0; a1.field_60_distance_related_prolly_lod = stru_50C198._427546(v30 + 2500); a1.uFacing = v32; @@ -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; @@ -1361,8 +1363,8 @@ a1.uAttributes = 0; a1.uSectorID = pIndoor->GetSector(v73, v74, v75); v78 = 8 * LODWORD(v120); - LOBYTE(v78) = 8 * LOBYTE(v120) | 3; - a1.field_58 = v78; + LOBYTE(v78) = 8 * LOBYTE(v120) | OBJECT_Actor; + a1.field_58_pid = v78; a1.uSpriteFrameID = 0; a1.field_5C = 0; a1.field_60_distance_related_prolly_lod = 3; @@ -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 ); } } @@ -1579,7 +1565,7 @@ v12 = 8 * v15; LOBYTE(v12) = 8 * v15 | AI_OBJECT_ACTOR; a1.uSpriteFrameID = 0; - a1.field_58 = v12; + a1.field_58_pid = v12; a1.field_5C = 0; if ( (double)v11 >= 307.2 ) { @@ -1683,9 +1669,9 @@ a1.uAttributes = 0; a1.uSectorID = pIndoor->GetSector(v5, a1.vPosition.y, v6); v7 = 8 * v10; - LOBYTE(v7) = 8 * v10 | 3; + LOBYTE(v7) = 8 * v10 | OBJECT_Actor; a1.uSpriteFrameID = 0; - a1.field_58 = v7; + a1.field_58_pid = v7; a1.field_5C = 0; a1.field_60_distance_related_prolly_lod = 3; a1.field_61 = 4; @@ -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,16 +3328,21 @@ { 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; @@ -3565,15 +3363,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 +3387,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 +3405,7 @@ { if ( !uActionLength ) uActionLength = 256; - result = Actor::_403F58(v15, 4, uActionLength, &v13); + Actor::_403F58(v15, 4, uActionLength, &v13); } else { @@ -3624,15 +3422,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 +3476,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 +3486,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 +3508,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 +3601,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 @@ -3868,7 +3667,7 @@ continue; } } - else if ( v7->IsAlive() == 1 ) + else if (v7->IsNotAlive()) { v24 = v4; v3->uLastCharacterIDToHit = v4; @@ -4084,61 +3883,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 +3978,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;
--- a/Actor.h Wed Feb 20 09:23:48 2013 +0600 +++ b/Actor.h Wed Feb 20 09:24:02 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 IsAlive(); + 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 09:23:48 2013 +0600 +++ b/AudioPlayer.cpp Wed Feb 20 09:24:02 2013 +0600 @@ -1197,7 +1197,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 +1208,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 +1287,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 +1559,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 +1690,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 +1772,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 +1779,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; }
--- a/Events.cpp Wed Feb 20 09:23:48 2013 +0600 +++ b/Events.cpp Wed Feb 20 09:24:02 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 09:23:48 2013 +0600 +++ b/Events.h Wed Feb 20 09:24:02 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 09:23:48 2013 +0600 +++ b/GUIWindow.cpp Wed Feb 20 09:24:02 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/Indoor.cpp Wed Feb 20 09:23:48 2013 +0600 +++ b/Indoor.cpp Wed Feb 20 09:24:02 2013 +0600 @@ -1305,7 +1305,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 +1502,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 +3463,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 +3479,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 +4004,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; @@ -4157,7 +4157,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;
--- a/Items.cpp Wed Feb 20 09:23:48 2013 +0600 +++ b/Items.cpp Wed Feb 20 09:24:02 2013 +0600 @@ -19,7 +19,7 @@ ItemGen *ptr_50C9A4; -struct ItemsTable *pItemsTable; +struct ItemsTable *pItemsTable; // 005D29E0
--- a/Items.h Wed Feb 20 09:23:48 2013 +0600 +++ b/Items.h Wed Feb 20 09:24:02 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/LayingItem.h Wed Feb 20 09:23:48 2013 +0600 +++ b/LayingItem.h Wed Feb 20 09:24:02 2013 +0600 @@ -33,7 +33,7 @@ int field_4C; int field_50; int field_54; - int field_58; + int field_58_pid; int field_5C; char field_60_distance_related_prolly_lod; char field_61;
--- a/Monsters.h Wed Feb 20 09:23:48 2013 +0600 +++ b/Monsters.h Wed Feb 20 09:24:02 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 09:23:48 2013 +0600 +++ b/Mouse.cpp Wed Feb 20 09:24:02 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 09:23:48 2013 +0600 +++ b/NPC.cpp Wed Feb 20 09:24:02 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 09:23:48 2013 +0600 +++ b/Outdoor.cpp Wed Feb 20 09:24:02 2013 +0600 @@ -3146,14 +3146,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 +3162,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/Party.cpp Wed Feb 20 09:23:48 2013 +0600 +++ b/Party.cpp Wed Feb 20 09:24:02 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 09:23:48 2013 +0600 +++ b/Player.cpp Wed Feb 20 09:24:02 2013 +0600 @@ -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; @@ -7543,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(); @@ -8302,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); @@ -8329,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); @@ -8765,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 @@ -8794,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 @@ -8806,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 ) @@ -9003,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: @@ -9086,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; @@ -9110,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 ) @@ -9156,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; } @@ -9204,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; @@ -9235,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); @@ -9267,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/Player.h Wed Feb 20 09:23:48 2013 +0600 +++ b/Player.h Wed Feb 20 09:24:02 2013 +0600 @@ -560,6 +560,7 @@ bool Recover(signed int a2); bool CanCastSpell(unsigned int uRequiredMana); + inline bool Weak() {return pConditions[Condition::Condition_Weak] != 0;} inline bool Dead() {return pConditions[Condition::Condition_Dead] != 0;} inline bool Eradicated() {return pConditions[Condition::Condition_Eradicated] != 0;} inline bool Zombie() {return pConditions[Condition::Condition_Zombie] != 0;}
--- a/Render.cpp Wed Feb 20 09:23:48 2013 +0600 +++ b/Render.cpp Wed Feb 20 09:24:02 2013 +0600 @@ -10135,7 +10135,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 09:23:48 2013 +0600 +++ b/Render.h Wed Feb 20 09:24:02 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/StorylineTextTable.cpp Wed Feb 20 09:23:48 2013 +0600 +++ b/StorylineTextTable.cpp Wed Feb 20 09:24:02 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 09:23:48 2013 +0600 +++ b/Texture.cpp Wed Feb 20 09:24:02 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 09:23:48 2013 +0600 +++ b/Texture.h Wed Feb 20 09:24:02 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 09:23:48 2013 +0600 +++ b/TurnEngine.h Wed Feb 20 09:24:02 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/mm7_1.cpp Wed Feb 20 09:23:48 2013 +0600 +++ b/mm7_1.cpp Wed Feb 20 09:24:02 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; @@ -4489,7 +4453,7 @@ a1.uAttributes = 48; a1.uSectorID = pIndoor->GetSector(pOut.x, pOut.z, pOut.y); a1.uSpriteFrameID = 0; - a1.field_58 = 0; + a1.field_58_pid = 0; a1.field_5C = 0; a1.uFacing = 0; a1.Create(0, 0, 0, 0); @@ -5694,7 +5658,7 @@ } } } - a1.field_58 = 4; + a1.field_58_pid = OBJECT_Player; a1.uObjectDescID = v6; a1.vPosition.y = pParty->vPosition.y; a1.vPosition.x = pParty->vPosition.x; @@ -6077,7 +6041,7 @@ } a1.uObjectDescID = v6; a1.vPosition.y = pParty->vPosition.y; - a1.field_58 = 4; + a1.field_58_pid = OBJECT_Player; a1.vPosition.x = pParty->vPosition.x; a1.vPosition.z = pParty->sEyelevel + pParty->vPosition.z; a1.uSoundID = 0; @@ -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); + unsigned int 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); + unsigned int 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 09:23:48 2013 +0600 +++ b/mm7_2.cpp Wed Feb 20 09:24:02 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); @@ -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; @@ -8065,7 +8065,7 @@ a1a.field_48 = 0; v30 = pIndoor->GetSector(v28, v27, v29); a1a.field_5C = 0; - a1a.field_58 = 0; + a1a.field_58_pid = 0; a1a.uSpriteFrameID = 0; a1a.uSectorID = v30; return a1a.Create(0, 0, 0, 0); @@ -8162,7 +8162,7 @@ } } LABEL_23: - v3->uAttributes |= 1u; + v3->SetIdentified(); v3->uAdditionalValue = v10; LABEL_25: v11 = v4 - 1; @@ -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; @@ -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 @@ -16034,12 +16034,12 @@ v151 = a2 & 7; if ( (a2 & 7) == OBJECT_Actor) { - if ( (v2->field_58 & 7) == OBJECT_Actor && !pActors[v2->field_58 >> 3].GetActorsRelation(&pActors[a2 >> 3]) ) + if ( (v2->field_58_pid & 7) == OBJECT_Actor && !pActors[v2->field_58_pid >> 3].GetActorsRelation(&pActors[a2 >> 3]) ) return 1; } else { - if ( (a2 & 7) == OBJECT_Player && (v2->field_58 & 7) == OBJECT_Player) + if ( (a2 & 7) == OBJECT_Player && (v2->field_58_pid & 7) == OBJECT_Player) return 1; } if ( pParty->bTurnBasedModeOn == 1 ) @@ -16051,8 +16051,8 @@ v2->uAttributes = v5 & 0xFFFB; } } - if ( v151 == OBJECT_BModel && (v2->field_58 & 7) != OBJECT_Player) - BYTE2(pActors[v2->field_58 >> 3].uAttributes) |= 4u; + if ( v151 == OBJECT_BModel && (v2->field_58_pid & 7) != OBJECT_Player) + BYTE2(pActors[v2->field_58_pid >> 3].uAttributes) |= 4u; v6 = v2->uItemType; v7 = v2->uItemType; if ( v7 > 3060 )
--- a/mm7_3.cpp Wed Feb 20 09:23:48 2013 +0600 +++ b/mm7_3.cpp Wed Feb 20 09:24:02 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; @@ -1484,9 +1484,9 @@ { _46E44E_collide_against_faces_and_portals(0); _46E0B2_collide_against_decorations(); - if ( (v1->field_58 & 7) != OBJECT_Player) + if ( (v1->field_58_pid & 7) != OBJECT_Player) _46EF01_collision_chech_player(1); - v13 = v1->field_58; + v13 = v1->field_58_pid; v42 = v8; if ( (v13 & 7) == OBJECT_Actor) { @@ -1499,7 +1499,7 @@ //v14 = (signed __int64)((double)v41 * 0.3333333333333333); //v41 = *(short *)(v39 - 38) - 1; //if ( v14 != (unsigned int)(signed __int64)((double)v41 * 0.3333333333333333) ) - if( pActors[v1->field_58 >> 3].pMonsterInfo.uID != v39b->pMonsterInfo.uID ) + if( pActors[v1->field_58_pid >> 3].pMonsterInfo.uID != v39b->pMonsterInfo.uID ) //not sure: pMonsterList->pMonsters[v39b->word_000086_some_monster_id-1].uToHitRadius _46DF1A_collide_against_actor(v42, *((short *)&pMonsterList->pMonsters[v39b->word_000086_some_monster_id] - 73)); ++v42; @@ -1988,11 +1988,11 @@ v58 = v16; v18 = WorldPosToGridCellX(v17); _46E26D_collide_against_sprites(v18, v58); - if ( (v1->field_58 & 7) != OBJECT_Player) + if ( (v1->field_58_pid & 7) != OBJECT_Player) _46EF01_collision_chech_player(0); - if ( (v1->field_58 & 7) == OBJECT_Actor) - { - v19 = v1->field_58 >> 3; + if ( (v1->field_58_pid & 7) == OBJECT_Actor) + { + v19 = v1->field_58_pid >> 3; if ( v19 >= 0 ) { if ( v19 < (signed int)(uNumActors - 1) ) @@ -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 ) { @@ -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); @@ -6231,7 +6231,7 @@ v19 = v4 * v6 - v3 * v21; v7 = abs(v4); v8 = abs(v3); - v9 = sub_4621DA(v8, v7, 0); + v9 = int_get_vector_length(v8, v7, 0); v10 = v14 * 188; v22 = v9; *v16 = 0; @@ -12384,7 +12384,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 +13599,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 +14160,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 +14220,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 +14231,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 +14265,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 +14283,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 +14339,8 @@ { if ( v5 ) { - v3->field_4 = 0; ++dword_5B65C8; - v3->field_0 = 0; + v3->field_0_time = 0; continue; } } @@ -14430,9 +14348,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 +14357,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 +14392,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 +14490,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 +14591,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 +15732,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 +15741,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 +15802,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) @@ -18187,7 +16581,7 @@ a1.uSectorID = pIndoor->GetSector(fromx, fromy, fromz); a1.field_60_distance_related_prolly_lod = v55; a1.uSpriteFrameID = 0; - a1.field_58 = 8002; + a1.field_58_pid = 8000 | OBJECT_Item; a1.field_5C = 4; a1.uSoundID = 0; for ( i = a7c / -2; i <= a7c / 2; i += a8b ) @@ -18228,7 +16622,7 @@ a1.field_60_distance_related_prolly_lod = v55; v20 = yaw; a1.uSpriteFrameID = 0; - a1.field_58 = 8002; + a1.field_58_pid = 8000 | OBJECT_Item; a1.field_5C = 0; a1.uFacing = yaw; a1.uSoundID = 0; @@ -18282,7 +16676,7 @@ a1.uSectorID = pIndoor->GetSector(fromx, fromy, fromz); a1.field_60_distance_related_prolly_lod = v55; a1.uSpriteFrameID = 0; - a1.field_58 = 8002; + a1.field_58_pid = 8000 | OBJECT_Item; a1.field_5C = 4; a1.uSoundID = 0; for ( j = a7d / -2; j <= a7d / 2; j += a8c ) @@ -18438,7 +16832,7 @@ a1.uSectorID = pIndoor->GetSector(fromx, fromy, fromz); a1.field_60_distance_related_prolly_lod = v55; a1.uSpriteFrameID = 0; - a1.field_58 = 8002; + a1.field_58_pid = 8000 | OBJECT_Item; a1.field_5C = 4; a1.uSoundID = 0; v51 = 0;
--- a/mm7_4.cpp Wed Feb 20 09:23:48 2013 +0600 +++ b/mm7_4.cpp Wed Feb 20 09:24:02 2013 +0600 @@ -3489,11 +3489,11 @@ a1.uObjectDescID = v10; a1.field_60_distance_related_prolly_lod = 0; v12 = 8 * pParty->pPartyBuffs[10].uCaster; - LOBYTE(v12) = v12 | 4; + LOBYTE(v12) = v12 | OBJECT_Player; a1.uAttributes = 0; a1.uSectorID = 0; a1.uSpriteFrameID = 0; - a1.field_58 = v12; + a1.field_58_pid = v12; a1.uFacing = 0; a1.uSoundID = 0; v13 = sub_46A89E((int)v41, 100, 307); @@ -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; @@ -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(); } } } @@ -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 09:23:48 2013 +0600 +++ b/mm7_5.cpp Wed Feb 20 09:24:02 2013 +0600 @@ -1,3 +1,5 @@ +#include <assert.h> + #include "mm7.h" #include "MapInfo.h" @@ -2278,7 +2280,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; @@ -3501,9 +3503,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" @@ -3635,7 +3637,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; @@ -3658,7 +3660,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; @@ -4981,7 +4983,7 @@ { v4 = &pLayingItems[v3]; v36 = v4; - v5 = v4->field_58; + v5 = v4->field_58_pid; v2 = v5 & 7; v3 = v5 >> 3; } @@ -5110,14 +5112,14 @@ v35->z = v44; switch ( v41 ) { - case 4: + case OBJECT_Player: DamageMonsterFromParty(*((short *)v1 - 300), uActorID, v35); break; - case 3: + case OBJECT_Actor: if ( v36 && pActors[v37].GetActorsRelation(v28) ) sub_43B1B0(*((short *)v1 - 300), uActorID, pVelocity, v36->field_61); break; - case 2: + case OBJECT_Item: sub_43B057(*((short *)v1 - 300), uActorID, v35); break; } @@ -5144,11 +5146,11 @@ //----- (00439474) -------------------------------------------------------- void DamageMonsterFromParty(signed int a1, unsigned int uActorID_Monster, Vec3_int_ *pVelocity) { - signed int v3; // eax@1 + //signed int v3; // eax@1 LayingItem *v4; // ebx@1 - int v5; // edx@3 - bool uPlayerID; // eax@3 - Player *pPlayer; // edi@4 + //int v5; // edx@3 + //bool uPlayerID; // eax@3 + //Player *pPlayer; // edi@4 Actor *pMonster; // esi@7 LayingItem *v9; // ebx@12 int v10; // eax@12 @@ -5168,8 +5170,8 @@ unsigned __int8 v24; // sf@44 int v25; // edx@51 int v26; // ecx@51 - signed int v27; // eax@51 - int v28; // eax@53 + //signed int v27; // eax@51 + //int v28; // eax@53 signed int v29; // eax@76 signed int v30; // eax@84 signed int v31; // eax@92 @@ -5192,14 +5194,14 @@ char *pPlayerName; // [sp+18h] [bp-54h]@12 char *pMonsterName; // [sp+1Ch] [bp-50h]@6 int v50; // [sp+20h] [bp-4Ch]@6 - unsigned __int64 *v51; // [sp+30h] [bp-3Ch]@6 + //unsigned __int64 *v51; // [sp+30h] [bp-3Ch]@6 int v52; // [sp+34h] [bp-38h]@12 - int v53; // [sp+38h] [bp-34h]@10 - int v54; // [sp+3Ch] [bp-30h]@1 - int v55; // [sp+40h] [bp-2Ch]@12 + //int v53; // [sp+38h] [bp-34h]@10 + //int v54; // [sp+3Ch] [bp-30h]@1 + //int v55; // [sp+40h] [bp-2Ch]@12 signed int a4; // [sp+44h] [bp-28h]@1 PlayerEquipment *v57; // [sp+48h] [bp-24h]@10 - int v58; // [sp+4Ch] [bp-20h]@10 + //int v58; // [sp+4Ch] [bp-20h]@10 int v59; // [sp+50h] [bp-1Ch]@1 unsigned int uActorID_Monster_; // [sp+54h] [bp-18h]@1 int v61; // [sp+58h] [bp-14h]@1 @@ -5208,10 +5210,10 @@ int a2; // [sp+64h] [bp-8h]@27 int a3; // [sp+6Bh] [bp-1h]@6 - v3 = a1; + //v3 = a1; v4 = 0; uActorID_Monster_ = uActorID_Monster; - v54 = a1; + //v54 = a1; uDamageAmount = 0; a4 = 0; v61 = 0; @@ -5220,94 +5222,96 @@ if ( (a1 & 7) == OBJECT_Item) { v4 = &pLayingItems[a1 >> 3]; - uDamageAmount = (int)v4; + //uDamageAmount = (int)v4; v61 = v4->field_60_distance_related_prolly_lod; - v3 = v4->field_58; - v54 = v4->field_58; - } - v5 = v3 & 7; - uPlayerID = v3 >> 3; - if (v5 != OBJECT_Player) + a1 = v4->field_58_pid; + //v54 = v4->field_58_pid; + } + //v5 = a1 & 7; + //uPlayerID = a1 >> 3; + if ((a1 & 7) != OBJECT_Player) return; - pPlayer = &pParty->pPlayers[uPlayerID]; - if ( uPlayerID < 0 && uPlayerID > 3 ) - { - MessageBoxW(nullptr, L"Invalid player in damageMonsterFromParty!", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Damage.cpp:457", 0); - } + + assert(abs(a1 >> 3) < 4); + auto player = &pParty->pPlayers[a1 >> 3]; pMonster = &pActors[uActorID_Monster_]; - uPlayerID = pMonster->IsAlive(); - if ( uPlayerID ) + //uPlayerID = pMonster->IsAlive(); + if (pMonster->IsNotAlive()) return; + BYTE1(pMonster->uAttributes) |= 0xC0u; if ( pMonster->uAIState == Fleeing ) pMonster->uAttributes |= 0x20000u; - v58 = 0; - v53 = 0; - v57 = 0; + //v57 = 0; + //v53 = 0; + //v58 = 0; + bool hit_will_stun = false, + hit_will_paralyze = false; if ( !v4 ) { - v51 = (unsigned __int64 *)pPlayer->pEquipment.uMainHand; + //v51 = (unsigned __int64 *)player->pEquipment.uMainHand; + int main_hand_idx = player->pEquipment.uMainHand; v59 = 1; - if ( pPlayer->HasItemEquipped(EQUIP_TWO_HANDED) ) - { - v55 = pItemsTable->pItems[*(int *)&pPlayer->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * (int)v51 + 5]].uSkillType; - v28 = SkillToMastery(pPlayer->pActiveSkills[v55]); - uDamageAmount = v28; - if ( v55 ) - { - if ( v55 == 6 ) - { - if ( v28 >= 3 ) - { - LOBYTE(v51) = pPlayer->GetActualSkillLevel(PLAYER_SKILL_MACE) & 0x3F; - v51 = (unsigned __int64 *)(unsigned __int8)v51; - if ( rand() % 100 < (unsigned __int8)v51 ) - v58 = 1; - } - if ( uDamageAmount >= 4 ) - { - LOBYTE(v51) = pPlayer->GetActualSkillLevel(PLAYER_SKILL_MACE) & 0x3F; - v51 = (unsigned __int64 *)(unsigned __int8)v51; - if ( rand() % 100 < (unsigned __int8)v51 ) - v53 = 1; - } - } - } - else - { - if ( uDamageAmount >= 3 ) - { - LOBYTE(v51) = pPlayer->GetActualSkillLevel((PLAYER_SKILL_TYPE)0) & 0x3F; - v51 = (unsigned __int64 *)(unsigned __int8)v51; - if ( rand() % 100 < (unsigned __int8)v51 ) - v58 = 1; - } + if ( player->HasItemEquipped(EQUIP_TWO_HANDED) ) + { + auto main_hand_skill = pItemsTable->pItems[player->pInventoryItems[main_hand_idx - 1].uItemID].uSkillType; + //v55 = pItemsTable->pItems[player->pInventoryItems[main_hand_idx - 1].uItemID].uSkillType; + //v28 = SkillToMastery(player->pActiveSkills[v55]); + auto main_hand_mastery = SkillToMastery(player->pActiveSkills[main_hand_skill]); + //uDamageAmount = v28; + switch (main_hand_skill) + { + case PLAYER_SKILL_STAFF: + if (main_hand_mastery >= 3) + { + if (rand() % 100 < player->GetActualSkillLevel(PLAYER_SKILL_STAFF) & 0x3F) // stun chance when mastery >= 3 + hit_will_stun = true; + } + break; + + case PLAYER_SKILL_MACE: + if (main_hand_mastery >= 3) + { + if (rand() % 100 < player->GetActualSkillLevel(PLAYER_SKILL_MACE) & 0x3F) + hit_will_stun = true; + } + if (main_hand_mastery >= 4) + { + if (rand() % 100 < player->GetActualSkillLevel(PLAYER_SKILL_MACE) & 0x3F) + hit_will_paralyze = true; + } + break; } } v50 = pMonster->pMonsterInfo.uID; a2 = 4; - v27 = pPlayer->CalculateMeleeDamageTo(0, 0, v50); - goto LABEL_65; - } + //v27 = player->CalculateMeleeDamageTo(0, 0, v50); + uDamageAmount = player->CalculateMeleeDamageTo(0, 0, v50); + //if ( !v57 ) + goto LABEL_67; + //goto LABEL_69; + } + + v19 = v4->field_48 == 99; v61 = v4->field_60_distance_related_prolly_lod; if ( !v19 ) { v9 = (LayingItem *)uDamageAmount; v50 = pParty->vPosition.x - *(int *)(uDamageAmount + 4); - v55 = abs(v50); + //v55 = abs(v50); pMonsterName = (char *)(pParty->vPosition.y - v9->vPosition.y); - v51 = (unsigned __int64 *)abs((int)pMonsterName); + //v51 = (unsigned __int64 *)abs((int)pMonsterName); pPlayerName = (char *)(pParty->vPosition.z - v9->vPosition.z); v52 = abs((int)pPlayerName); - v61 = v55; - v10 = v55; - v11 = (int)v51; + v61 = abs(v50); + v10 = abs(v50); + v11 = (int)abs((int)pMonsterName); v12 = v52; - if ( v55 < (signed int)v51 ) - { - v10 = (int)v51; - v11 = v55; + if ( v10 < v11) + { + v10 = (int)v11; + v11 = v10; } if ( v10 < v52 ) { @@ -5321,9 +5325,9 @@ v12 = v11; v11 = v14; } - uPlayerID = ((unsigned int)(11 * v11) >> 5) + (v12 >> 2) + v10; - v61 = uPlayerID; - if ( uPlayerID >= 2560 ) + //uPlayerID = ((unsigned int)(11 * v11) >> 5) + (v12 >> 2) + v10; + v61 = ((unsigned int)(11 * v11) >> 5) + (v12 >> 2) + v10; + if ( v61 >= 2560 ) { if ( v61 >= 5120 && !(BYTE1(pMonster->uAttributes) & 4) ) return; @@ -5335,15 +5339,16 @@ } v4 = (LayingItem *)uDamageAmount; } + v15 = v4->field_48; if ( v15 == 102 ) { - v16 = pPlayer->pActiveSkills[7]; + v16 = player->pActiveSkills[7]; v61 = 1; if ( (signed int)SkillToMastery(v16) >= 3 ) - a4 = pPlayer->pActiveSkills[7] & 0x3F; + a4 = player->pActiveSkills[7] & 0x3F; a2 = 4; - uDamageAmount = pPlayer->CalculateMeleeDamageTo(1, 1, 0); + uDamageAmount = player->CalculateMeleeDamageTo(1, 1, 0); goto LABEL_67; } if ( v15 != 100 ) @@ -5351,7 +5356,7 @@ if ( v15 == 101 ) { a2 = 0; - v18 = pPlayer->CalculateRangedDamageTo(0); + v18 = player->CalculateRangedDamageTo(0); v19 = HIDWORD(pMonster->pActorBuffs[15].uExpireTime) == 0; v20 = SHIDWORD(pMonster->pActorBuffs[15].uExpireTime) < 0; uDamageAmount = v18; @@ -5363,7 +5368,7 @@ if ( v15 == 39 ) { a4 = 5 * v4->field_4C; - a2 = pPlayer->GetSpellSchool(0x27u); + a2 = player->GetSpellSchool(0x27u); v21 = v4->field_4C; v50 = pMonster->sCurrentHP; pMonsterName = (char *)v4->field_50; @@ -5375,10 +5380,10 @@ uDamageAmount >>= 1; v59 = 0; LABEL_67: - if ( !stru_50C198.PlayerHitOrMiss(pPlayer, pMonster, v61, a4) ) - { -LABEL_68: - pPlayer->PlaySound(SPEECH_52, 0); + if ( !stru_50C198.PlayerHitOrMiss(player, pMonster, v61, a4) ) + { +//LABEL_68: + player->PlaySound(SPEECH_52, 0); return; } goto LABEL_69; @@ -5387,27 +5392,30 @@ { uDamageAmount = 0; a2 = 4; - v58 = 1; + hit_will_stun = 1; goto LABEL_67; } v50 = v4->field_48; - a2 = pPlayer->GetSpellSchool(v50); + a2 = player->GetSpellSchool(v50); v25 = v4->field_4C; v26 = v4->field_48; v50 = pMonster->sCurrentHP; pMonsterName = (char *)v4->field_50; - v27 = _43AFE3_calc_spell_damage(v26, v25, (signed int)pMonsterName, v50); + //v27 = _43AFE3_calc_spell_damage(v26, v25, (signed int)pMonsterName, v50); v59 = 0; - v57 = (PlayerEquipment *)1; -LABEL_65: - uDamageAmount = v27; - goto LABEL_66; + //v57 = (PlayerEquipment *)1; +//LABEL_65: + uDamageAmount = _43AFE3_calc_spell_damage(v26, v25, (signed int)pMonsterName, v50); + //if ( !v57 ) + // goto LABEL_67; + goto LABEL_69; } v50 = pMonster->word_000086_some_monster_id; a2 = 4; - v17 = pPlayer->CalculateRangedDamageTo(v50); + v17 = player->CalculateRangedDamageTo(v50); v19 = v4->stru_24.uItemID == 0; uDamageAmount = v17; + v57 = 0; if ( !v19 && v4->stru_24.uAdditionalValue == 3 ) { a2 = 0; @@ -5417,18 +5425,18 @@ && (SHIDWORD(pMonster->pActorBuffs[15].uExpireTime) > 0 || LODWORD(pMonster->pActorBuffs[15].uExpireTime)) ) uDamageAmount >>= 1; v59 = 1; -LABEL_66: +//LABEL_66: if ( !v57 ) goto LABEL_67; LABEL_69: - if ( pPlayer->pConditions[1] ) - uDamageAmount >>= 1; + if (player->Weak()) + uDamageAmount /= 1; if ( (signed __int64)pMonster->pActorBuffs[5].uExpireTime > 0 ) uDamageAmount = 0; v61 = stru_50C198.CalcMagicalDamageToActor(pMonster, a2, uDamageAmount); - if ( !v4 && pPlayer->IsUnarmed() && (signed __int64)pPlayer->pPlayerBuffs[6].uExpireTime > 0 ) - { - v50 = pPlayer->pPlayerBuffs[6].uPower; + if ( !v4 && player->IsUnarmed() && (signed __int64)player->pPlayerBuffs[6].uExpireTime > 0 ) + { + v50 = player->pPlayerBuffs[6].uPower; v29 = stru_50C198.CalcMagicalDamageToActor(pMonster, 8, v50); v61 += v29; } @@ -5440,9 +5448,9 @@ a4 = v4->stru_24._439DF3_get_additional_damage(&a2, &v62); if ( v62 && pMonster->sCurrentHP > 0 ) { - pPlayer->sHealth += v61 / 5; - if ( pPlayer->sHealth > pPlayer->GetMaxHealth() ) - pPlayer->sHealth = pPlayer->GetMaxHealth(); + player->sHealth += v61 / 5; + if ( player->sHealth > player->GetMaxHealth() ) + player->sHealth = player->GetMaxHealth(); v62 = 0; } v30 = stru_50C198.CalcMagicalDamageToActor(pMonster, a2, a4); @@ -5451,18 +5459,18 @@ else { v59 = 0; - v57 = &pPlayer->pEquipment; + v57 = &player->pEquipment; do { - if ( pPlayer->HasItemEquipped((ITEM_EQUIP_TYPE)v59) ) - { - auto _s = (ItemGen *)&pPlayer->pInventoryItems[v57->uOffHand-1]; + if ( player->HasItemEquipped((ITEM_EQUIP_TYPE)v59) ) + { + auto _s = (ItemGen *)&player->pInventoryItems[v57->uOffHand-1]; a4 = _s->_439DF3_get_additional_damage(&a2, &v62); if ( v62 && pMonster->sCurrentHP > 0 ) { - pPlayer->sHealth += v61 / 5; - if ( pPlayer->sHealth > pPlayer->GetMaxHealth() ) - pPlayer->sHealth = pPlayer->GetMaxHealth(); + player->sHealth += v61 / 5; + if ( player->sHealth > player->GetMaxHealth() ) + player->sHealth = player->GetMaxHealth(); v62 = 0; } v31 = stru_50C198.CalcMagicalDamageToActor(pMonster, a2, a4); @@ -5476,22 +5484,25 @@ } v32 = uDamageAmount; pMonster->sCurrentHP -= uDamageAmount; - if ( !v32 && !v58 ) - goto LABEL_68; + if ( !v32 && !hit_will_stun ) + { + player->PlaySound(SPEECH_52, 0); + return; + } if ( pMonster->sCurrentHP > 0 ) { - Actor::_4030AD(uActorID_Monster_, v54, 0); - Actor::_43AC45(uActorID_Monster_, 1); + Actor::_4030AD(uActorID_Monster_, a1, 0); + Actor::AggroSurroundingPeasants(uActorID_Monster_, 1); if ( bShowDamage ) { v50 = uDamageAmount; pMonsterName = (char *)pMonster; - pPlayerName = pPlayer->pName; + pPlayerName = player->pName; if ( v4 ) v47 = pGlobalTXT_LocalizationStrings[189];// "%s shoots %s for %lu points" else v47 = pGlobalTXT_LocalizationStrings[164];// "%s hits %s for %lu damage" - sprintf(pTmpBuf, v47, pPlayerName, pMonsterName, v50); + sprintfex(pTmpBuf, v47, pPlayerName, pMonsterName, v50); ShowStatusBarString(pTmpBuf, 2u); } v41 = 0; @@ -5501,7 +5512,7 @@ if ( pMonsterStats->pInfos[pMonster->pMonsterInfo.uID].bQuestMonster & 1 ) { v33 = byte_4D864C && BYTE2(pGame->uFlags) & 8 ? 10 * pMonster->uActorRadius : pMonster->uActorRadius; - v55 = v33; + //v55 = v33; if ( pRenderer->pRenderD3D ) { if ( pGame->uFlags2 & 0x20 ) @@ -5509,38 +5520,38 @@ v50 = 0; pMonsterName = 0; v34 = pMonster->vPosition.z; - *(float *)&pPlayerName = (double)v55; - v51 = (unsigned __int64 *)v34; + *(float *)&pPlayerName = (double)v33; + //v51 = (unsigned __int64 *)v34; *(float *)&v47 = 0.0; v35 = pMonster->vPosition.y; *((float *)&v46 + 1) = 0.0; *(float *)&v46 = 1.0; - v36 = (double)(signed int)v51; - v51 = (unsigned __int64 *)v35; + v36 = (double)(signed int)pMonster->vPosition.z; + //v51 = (unsigned __int64 *)v35; v37 = v36; - v51 = (unsigned __int64 *)pMonster->vPosition.x; + //v51 = (unsigned __int64 *)pMonster->vPosition.x; v38 = (double)v35; - v39 = (double)(signed int)v51; + v39 = (double)(signed int)pMonster->vPosition.x; pDecalBuilder->AddBloodsplat(v39, v38, v37, 1.0, 0.0, 0.0, *(float *)&pPlayerName, 0, 0); } } } 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; if ( rand() % 100 < 20 ) v40 = ((signed int)pMonster->pMonsterInfo.uHP >= 100) + 1; - pPlayer->PlaySound((PlayerSpeech)v40, 0); + player->PlaySound((PlayerSpeech)v40, 0); v41 = 0; if ( bShowDamage ) { v50 = (int)pMonster; pMonsterName = (char *)uDamageAmount; - pPlayerName = pPlayer->pName; // "%s inflicts %lu points killing %s" - sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[175], pPlayer->pName, uDamageAmount, pMonster); + pPlayerName = player->pName; // "%s inflicts %lu points killing %s" + sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[175], player->pName, uDamageAmount, pMonster); ShowStatusBarString(pTmpBuf, 2u); } } @@ -5548,10 +5559,10 @@ && (SHIDWORD(pMonster->pActorBuffs[20].uExpireTime) > (signed int)v41 || LODWORD(pMonster->pActorBuffs[20].uExpireTime) > v41) && uDamageAmount != v41 ) - pPlayer->ReceiveDamage(uDamageAmount, a2); + player->ReceiveDamage(uDamageAmount, a2); v50 = 24; v59 = 20 * v61 / (signed int)pMonster->pMonsterInfo.uHP; - if ( (pPlayer->_48EA46_calc_special_bonus_by_items(24) || v58 != v41) + if ( (player->_48EA46_calc_special_bonus_by_items(24) || hit_will_stun != v41) && stru_50C198.GetMagicalResistance(pMonster, 3u) ) { LODWORD(v42) = 20; @@ -5562,28 +5573,28 @@ if ( bShowDamage != v41 ) { v50 = (int)pMonster; - pMonsterName = pPlayer->pName; // "%s stuns %s" - sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[635], pPlayer->pName, pMonster); + pMonsterName = player->pName; // "%s stuns %s" + sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[635], player->pName, pMonster); ShowStatusBarString(pTmpBuf, 2u); } } - if ( v53 != v41 ) + if ( hit_will_paralyze != v41 ) { if ( pMonster->CanAct() ) { - if ( stru_50C198.GetMagicalResistance(pMonster, 3u) ) - { - LOBYTE(v43) = pPlayer->GetActualSkillLevel(PLAYER_SKILL_MACE); + if ( stru_50C198.GetMagicalResistance(pMonster, 3) ) + { + LOBYTE(v43) = player->GetActualSkillLevel(PLAYER_SKILL_MACE); v44 = v43; v45 = SkillToMastery(v43); - v51 = (unsigned __int64 *)(7680 * (v44 & 0x3F)); - v46 = pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)v51 * 0.033333335); + //v51 = (unsigned __int64 *)(7680 * (v44 & 0x3F)); + v46 = pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)(7680 * (v44 & 0x3F)) * 0.033333335); pMonster->pActorBuffs[6].Apply(v46, v45, 0, 0, 0); if ( bShowDamage ) { v50 = (int)pMonster; - pMonsterName = pPlayer->pName; // "%s paralyzes %s" - sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[636], pPlayer->pName, pMonster); + pMonsterName = player->pName; // "%s paralyzes %s" + sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[636], player->pName, pMonster); ShowStatusBarString(pTmpBuf, 2u); } } @@ -5816,8 +5827,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 { @@ -5843,8 +5854,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; @@ -5883,10 +5894,10 @@ return; } v37 = &pLayingItems[uActorID]; - v38 = v37->field_58 & 7; - v39 = v37->field_58 >> 3; - v40 = v37->field_58 & 7; - uActorID = v37->field_58 >> 3; + v38 = v37->field_58_pid & 7; + v39 = v37->field_58_pid >> 3; + v40 = v37->field_58_pid & 7; + uActorID = v37->field_58_pid >> 3; v41 = v40 - 2; if ( !v41 ) goto LABEL_80; @@ -6002,8 +6013,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 { @@ -6029,8 +6040,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; @@ -6072,7 +6083,7 @@ v43 = &pParty->pPlayers[a4]; LABEL_168: a4b = v43; - if ( v38 != 4 || v37->field_48 != 100 ) + if ( v38 != OBJECT_Player || v37->field_48 != 100 ) { v70 = v43->GetMaxHealth(); v68 = _43AFE3_calc_spell_damage(v37->field_48, v37->field_4C, v37->field_50, v70); @@ -6084,7 +6095,7 @@ v69 = 0; } a4b->ReceiveDamage(v68, v69); - if ( v38 == 4 && !qword_A750D8 ) + if ( v38 == OBJECT_Player && !qword_A750D8 ) { qword_A750D8 = 256i64; word_A750E0 = 44; @@ -6124,7 +6135,7 @@ v6 = uLayingItemID; v2 = uLayingItemID; v3 = a2 >> 3; - v4 = pLayingItems[uLayingItemID].field_58 & 7; + v4 = pLayingItems[uLayingItemID].field_58_pid & 7; v5 = (a2 & 7) - 3; if ( v5 ) { @@ -6296,7 +6307,7 @@ uActorIDa = uActorID; pActor = &pActors[uActorID]; a2 = uObjID; - if ( !pActors[uActorID].IsAlive() ) + if ( !pActors[uActorID].IsNotAlive() ) { if ( (a2 & 7) == OBJECT_Item) { @@ -6337,7 +6348,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 @@ -6361,14 +6372,14 @@ { v5 = &pLayingItems[a1 >> 3]; v4 = v5->field_60_distance_related_prolly_lod; - v17 = v5->field_58; + v17 = v5->field_58_pid; } LOWORD(v6) = v17 & 7; - if ( v6 == 3 ) + if ( v6 == OBJECT_Actor) { v7 = &pActors[a2]; v8 = &pActors[v17 >> 3]; - v6 = pActors[a2].IsAlive(); + v6 = pActors[a2].IsNotAlive(); if ( !v6 ) { v9 = v7->uAIState == 7; @@ -6421,7 +6432,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; @@ -6434,13 +6445,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; } @@ -6452,7 +6463,6 @@ } } } - return v6; } //----- (0043BCA7) -------------------------------------------------------- @@ -7300,7 +7310,7 @@ if ( v25 & 2 ) { v27 = (Texture *)(v241 != -1 ? (int)&pIcons_LOD->pTextures[v241] : 0); - pRenderer->_4A6776(v24, a3b, v27); + pRenderer->DrawTransparentRedShade(v24, a3b, v27); } else { @@ -7360,7 +7370,7 @@ if ( v37 & 2 ) { v42 = (Texture *)(v41 != 0 ? (int)&pIcons_LOD->pTextures[v35] : 0); - pRenderer->_4A6776(a2c, v36, v42); + pRenderer->DrawTransparentRedShade(a2c, v36, v42); } else { @@ -7412,7 +7422,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 { @@ -7479,7 +7489,7 @@ if ( v62 & 2 ) { v67 = (Texture *)(v65 != 0 ? (int)v66 : 0); - pRenderer->_4A6776(a2e, a3e, v67); + pRenderer->DrawTransparentRedShade(a2e, a3e, v67); } else { @@ -7542,7 +7552,7 @@ if ( v76 & 2 ) { v81 = (Texture *)(v79 != 0 ? (int)v80 : 0); - pRenderer->_4A6776(a2f, a3f, v81); + pRenderer->DrawTransparentRedShade(a2f, a3f, v81); } else { @@ -7819,7 +7829,7 @@ if ( v128 & 2 ) { v133 = (Texture *)(v131 != 0 ? (int)v132 : 0); - pRenderer->_4A6776(a2j, a3i, v133); + pRenderer->DrawTransparentRedShade(a2j, a3i, v133); } else { @@ -7860,7 +7870,7 @@ if ( v139 & 2 ) { v144 = (Texture *)(v142 != 0 ? (int)v143 : 0); - pRenderer->_4A6776(a2k, a3j, v144); + pRenderer->DrawTransparentRedShade(a2k, a3j, v144); } else { @@ -7919,7 +7929,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 { @@ -8123,7 +8133,7 @@ if ( *(int *)(v225 + 20) & 2 ) { v121 = (Texture *)(v119 != 0 ? (int)v120 : 0); - pRenderer->_4A6776(a2h, a3h, v121); + pRenderer->DrawTransparentRedShade(a2h, a3h, v121); } else { @@ -8324,7 +8334,7 @@ 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 = v217; @@ -8376,7 +8386,7 @@ 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 = v217; @@ -8908,7 +8918,7 @@ if ( v15 & 2 ) { v20 = (Texture *)(v18 != 0 ? (int)v19 : 0); - pRenderer->_4A6776(a2a, a3a, v20); + pRenderer->DrawTransparentRedShade(a2a, a3a, v20); } else { @@ -9068,7 +9078,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 { @@ -9112,7 +9122,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 { @@ -9192,7 +9202,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 { @@ -10226,7 +10236,7 @@ } //----- (004065B0) -------------------------------------------------------- -__int16 stru262_TurnBased::_4065B0() +void stru262_TurnBased::_4065B0() { stru262_TurnBased *v1; // esi@1 signed int v2; // eax@1 @@ -10266,14 +10276,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 @@ -10364,19 +10373,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; @@ -10411,7 +10421,6 @@ } } } - return v3; } // 50FE08: using guessed type stru298 stru_50FE08; @@ -11846,7 +11855,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 @@ -12012,7 +12021,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 @@ -12381,7 +12390,7 @@ if (!v8 || v7) if (!v6 || v5) - if (actor->_438B9B()) + if (actor->IsPeasant()) BYTE2(actor->uAttributes) &= 0xF7u; BYTE2(actor->uAttributes) &= 0x7Fu; @@ -12454,7 +12463,7 @@ if ( (v6 & 0x100000) == v8 ) { ++*v1; - if ( v5->IsAlive() == 1 ) + if ( v5->IsNotAlive() == 1 ) ++v3; } ++v4; @@ -12493,7 +12502,7 @@ if ( v4->pMonsterInfo.field_33 == v7 ) { ++*v2; - if ( v4->IsAlive() == 1 ) + if ( v4->IsNotAlive() == 1 ) ++v9; } } @@ -12533,7 +12542,7 @@ if ( v4->uGroup == v7 ) { ++*v2; - if ( v4->IsAlive() == 1 ) + if ( v4->IsNotAlive() == 1 ) ++v9; } } @@ -12563,7 +12572,7 @@ if ( (v6 & 0x100000) == v4 ) { *v3 = 1; - if ( pActors[v2].IsAlive() == 1 ) + if ( pActors[v2].IsNotAlive() == 1 ) v5 = 1; } return v5; @@ -13527,11 +13536,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); @@ -15567,7 +15577,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 09:23:48 2013 +0600 +++ b/mm7_6.cpp Wed Feb 20 09:24:02 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; } @@ -3512,8 +3503,8 @@ a1.uSpriteFrameID = 0; a1.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; v19 = 8 * v3->uPlayerID; - LOBYTE(v19) = v19 | 4; - a1.field_58 = v19; + LOBYTE(v19) = v19 | OBJECT_Player; + a1.field_58_pid = v19; a1.field_5C = a2; a1.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); a1.uFacing = LOWORD(v715.uYawAngle); @@ -3550,8 +3541,8 @@ a1.uSpriteFrameID = 0; a1.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 2; v22 = 8 * v3->uPlayerID; - LOBYTE(v22) = v22 | 4; - a1.field_58 = v22; + LOBYTE(v22) = v22 | OBJECT_Player; + a1.field_58_pid = v22; a1.field_5C = a2; a1.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); a1.uFacing = LOWORD(v715.uYawAngle); @@ -3656,8 +3647,8 @@ pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3); a1.uSpriteFrameID = v1; v34 = 8 * v3->uPlayerID; - LOBYTE(v34) = v34 | 4; - a1.field_58 = v34; + LOBYTE(v34) = v34 | OBJECT_Player; + a1.field_58_pid = v34; a1.field_5C = a2; a1.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); a1.uFacing = LOWORD(v715.uYawAngle); @@ -3689,9 +3680,9 @@ v37 = v3->uPlayerID; a1.field_60_distance_related_prolly_lod = 0; v37 *= 8; - LOBYTE(v37) = v37 | 4; + LOBYTE(v37) = v37 | OBJECT_Player; a1.uFacing = v1; - a1.field_58 = v37; + a1.field_58_pid = v37; v38 = a2 >> 3; a1.uSoundID = LOWORD(v3->field_10); v39 = a2 >> 3; @@ -3733,9 +3724,9 @@ a1.field_60_distance_related_prolly_lod = 0; a1.uFacing = v1; v44 *= 8; - LOBYTE(v44) = v44 | 4; + LOBYTE(v44) = v44 | OBJECT_Player; v38 = (signed int)v726; - a1.field_58 = v44; + a1.field_58_pid = v44; a1.uSoundID = LOWORD(v3->field_10); a1.vPosition.x = *(__int16 *)((char *)&pActors[0].vPosition.x + HIDWORD(v733)); v45 = *(__int16 *)((char *)&pActors[0].vPosition.y + HIDWORD(v733)); @@ -3771,8 +3762,8 @@ a1.uSectorID = pIndoor->GetSector(a1.vPosition.x, a1.vPosition.y, v48); a1.uSpriteFrameID = v1; v49 = 8 * v3->uPlayerID; - LOBYTE(v49) = v49 | 4; - a1.field_58 = v49; + LOBYTE(v49) = v49 | OBJECT_Player; + a1.field_58_pid = v49; a1.field_5C = a2; a1.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); a1.uFacing = LOWORD(v715.uYawAngle); @@ -3818,8 +3809,8 @@ pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3); a1.uSpriteFrameID = v1; v50 = 8 * v3->uPlayerID; - LOBYTE(v50) = v50 | 4; - a1.field_58 = v50; + LOBYTE(v50) = v50 | OBJECT_Player; + a1.field_58_pid = v50; a1.field_5C = a2; a1.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); a1.uFacing = LOWORD(v715.uYawAngle); @@ -3967,8 +3958,8 @@ pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3); a1.uSpriteFrameID = v1; v62 = 8 * v3->uPlayerID; - LOBYTE(v62) = v62 | 4; - a1.field_58 = v62; + LOBYTE(v62) = v62 | OBJECT_Player; + a1.field_58_pid = v62; a1.field_5C = a2; a1.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); a1.uFacing = LOWORD(v715.uYawAngle); @@ -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 ) { @@ -4369,9 +4360,9 @@ a1.uSectorID = 0; a1.uSpriteFrameID = 0; v120 = 8 * *(short *)(v119 + 2); - LOBYTE(v120) = v120 | 4; + LOBYTE(v120) = v120 | OBJECT_Player; a1.field_60_distance_related_prolly_lod = 0; - a1.field_58 = v120; + a1.field_58_pid = v120; a1.uFacing = 0; a1.uSoundID = *(short *)(v119 + 16); a1.vPosition.x = v112->vPosition.x; @@ -4572,7 +4563,7 @@ a1.uSectorID = v1; a1.vPosition.z = a2 + v713; a1.uSpriteFrameID = v1; - a1.field_58 = 8 * v3->uPlayerID | 4; + a1.field_58_pid = 8 * v3->uPlayerID | OBJECT_Player; a1.field_5C = v730; a1.field_60_distance_related_prolly_lod = stru_50C198._427546(a2 + 2500); a1.uFacing = v687; @@ -4620,8 +4611,8 @@ a1.field_60_distance_related_prolly_lod = 0; a1.uFacing = v1; v161 *= 8; - LOBYTE(v161) = v161 | 4; - a1.field_58 = v161; + LOBYTE(v161) = v161 | OBJECT_Player; + a1.field_58_pid = v161; a1.uSoundID = LOWORD(v3->field_10); a2 = v1; if ( (signed int)v726 > v1 ) @@ -4759,8 +4750,8 @@ pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3); a1.uSpriteFrameID = v1; v187 = 8 * v3->uPlayerID; - LOBYTE(v187) = v187 | 4; - a1.field_58 = v187; + LOBYTE(v187) = v187 | OBJECT_Player; + a1.field_58_pid = v187; a1.field_5C = a2; a1.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); a1.uSoundID = LOWORD(v3->field_10); @@ -4976,7 +4967,7 @@ a1.uSectorID = v1; a1.vPosition.z = (int)((char *)_this + LODWORD(v725)); a1.uSpriteFrameID = v1; - a1.field_58 = 8 * v3->uPlayerID | 4; + a1.field_58_pid = 8 * v3->uPlayerID | OBJECT_Player; a1.field_5C = v730; a1.field_60_distance_related_prolly_lod = stru_50C198._427546((int)&_this[69].uNumCharges); a1.uFacing = v685; @@ -5071,8 +5062,8 @@ a1.uSpriteFrameID = v1; a1.uSectorID = v52; v53 = 8 * v3->uPlayerID; - LOBYTE(v53) = v53 | 4; - a1.field_58 = v53; + LOBYTE(v53) = v53 | OBJECT_Player; + a1.field_58_pid = v53; a1.field_5C = a2; a1.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); a1.uFacing = LOWORD(v715.uYawAngle); @@ -5107,8 +5098,8 @@ pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3); a1.uSpriteFrameID = v1; v226 = 8 * v3->uPlayerID; - LOBYTE(v226) = v226 | 4; - a1.field_58 = v226; + LOBYTE(v226) = v226 | OBJECT_Player; + a1.field_58_pid = v226; a1.field_5C = a2; a1.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); a1.uSoundID = LOWORD(v3->field_10); @@ -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; @@ -5693,8 +5684,8 @@ pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3); a1.uSpriteFrameID = v1; v326 = 8 * v3->uPlayerID; - LOBYTE(v326) = v326 | 4; - a1.field_58 = v326; + LOBYTE(v326) = v326 | OBJECT_Player; + a1.field_58_pid = v326; a1.field_5C = a2; a1.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); a1.uFacing = LOWORD(pParty->sRotationY); @@ -5723,9 +5714,9 @@ a1.uSpriteFrameID = v1; a1.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; v327 = 8 * v3->uPlayerID; - LOBYTE(v327) = v327 | 4; + LOBYTE(v327) = v327 | OBJECT_Player; a1.field_60_distance_related_prolly_lod = 0; - a1.field_58 = v327; + a1.field_58_pid = v327; a1.field_5C = a2; a1.uFacing = LOWORD(pParty->sRotationY); a1.uSoundID = LOWORD(v3->field_10); @@ -5940,8 +5931,8 @@ a1.field_60_distance_related_prolly_lod = 0; a1.uFacing = v1; v368 *= 8; - LOBYTE(v368) = v368 | 4; - a1.field_58 = v368; + LOBYTE(v368) = v368 | OBJECT_Player; + a1.field_58_pid = v368; a1.uSoundID = LOWORD(v3->field_10); for ( a2 = v1; a2 < (signed int)v726; ++a2 ) { @@ -6381,8 +6372,8 @@ a1.field_60_distance_related_prolly_lod = 0; a1.uFacing = v1; v432 *= 8; - LOBYTE(v432) = v432 | 4; - a1.field_58 = v432; + LOBYTE(v432) = v432 | OBJECT_Player; + a1.field_58_pid = v432; a1.uSoundID = LOWORD(v3->field_10); for ( a2 = v1; a2 < (signed int)v726; ++a2 ) { @@ -6842,8 +6833,8 @@ a1.field_60_distance_related_prolly_lod = 0; a1.uFacing = v1; v506 *= 8; - LOBYTE(v506) = v506 | 4; - a1.field_58 = v506; + LOBYTE(v506) = v506 | OBJECT_Player; + a1.field_58_pid = v506; a1.uSoundID = LOWORD(v3->field_10); a2 = v1; if ( SHIDWORD(v733) > v1 ) @@ -7012,8 +7003,8 @@ a1.field_60_distance_related_prolly_lod = 0; a1.uFacing = v1; v532 *= 8; - LOBYTE(v532) = v532 | 4; - a1.field_58 = v532; + LOBYTE(v532) = v532 | OBJECT_Player; + a1.field_58_pid = v532; a1.uSoundID = LOWORD(v3->field_10); a2 = v1; if ( (signed int)v726 > v1 ) @@ -7284,9 +7275,9 @@ a1.field_60_distance_related_prolly_lod = 0; v581 = v721; v580 *= 8; - LOBYTE(v580) = v580 | 4; + LOBYTE(v580) = v580 | OBJECT_Player; a1.uFacing = v1; - a1.field_58 = v580; + a1.field_58_pid = v580; a1.uSoundID = LOWORD(v3->field_10); a1.vPosition.x = *(short *)(v721 + 142); a1.vPosition.y = *(short *)(v721 + 144); @@ -7386,8 +7377,8 @@ pParty->vPosition.z + (signed int)pParty->uPartyHeight / 2); a1.uSpriteFrameID = v1; v595 = 8 * v3->uPlayerID; - LOBYTE(v595) = v595 | 4; - a1.field_58 = v595; + LOBYTE(v595) = v595 | OBJECT_Player; + a1.field_58_pid = v595; a1.field_5C = a2; a1.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); a1.uSoundID = LOWORD(v3->field_10); @@ -7471,8 +7462,8 @@ a1.uSectorID = pIndoor->GetSector(v657, v665, v676); a1.uSpriteFrameID = v1; v604 = 8 * v3->uPlayerID; - LOBYTE(v604) = v604 | 4; - a1.field_58 = v604; + LOBYTE(v604) = v604 | OBJECT_Player; + a1.field_58_pid = v604; a1.field_5C = a2; a1.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); a1.uFacing = LOWORD(v715.uYawAngle); @@ -7619,8 +7610,8 @@ a1.field_60_distance_related_prolly_lod = 0; a1.uFacing = v1; v624 *= 8; - LOBYTE(v624) = v624 | 4; - a1.field_58 = v624; + LOBYTE(v624) = v624 | OBJECT_Player; + a1.field_58_pid = v624; a1.uSoundID = LOWORD(v3->field_10); a2 = v1; if ( SHIDWORD(v733) > v1 ) @@ -7961,55 +7952,38 @@ if (!--player->pInventoryItems[main_hand_idx - 1].uNumCharges) player->pEquipment.uMainHand = 0; } - else if (target_type == OBJECT_Actor) + else if (target_type == OBJECT_Actor && actor_distance <= 407.2) { - if (actor_distance <= 407.2) - { - Vec3_int_ a3; - a3.x = actor->vPosition.x - pParty->vPosition.x; - a3.y = actor->vPosition.y - pParty->vPosition.y; - a3.z = actor->vPosition.z - pParty->vPosition.z; - Vec3_int_::Normalize(&a3.x, &a3.y, &a3.z); - - DamageMonsterFromParty((8 * uActiveCharacter - 8) | OBJECT_Player, target_id, &a3); - if (player->WearsItem(506, 1) || player->WearsItem(506, 0)) + Vec3_int_ a3; + a3.x = actor->vPosition.x - pParty->vPosition.x; + a3.y = actor->vPosition.y - pParty->vPosition.y; + a3.z = actor->vPosition.z - pParty->vPosition.z; + Vec3_int_::Normalize(&a3.x, &a3.y, &a3.z); + + DamageMonsterFromParty((8 * (uActiveCharacter - 1)) | OBJECT_Player, target_id, &a3); + if (player->WearsItem(ITEM_ARTIFACT_SPLITTER, 1) || player->WearsItem(ITEM_ARTIFACT_SPLITTER, 0)) _42FA66_do_explosive_impact( actor->vPosition.x, actor->vPosition.y, actor->vPosition.z + actor->uActorHeight / 2, 0, 512, uActiveCharacter); - } - else if (bow_idx) - { - shooting_bow = true; - - _42777D_CastSpell_UseWand_ShootArrow(100, uActiveCharacter - 1, 0, 0, 0); - if (!pParty->bTurnBasedModeOn) - { - int recovery = player->GetAttackRecoveryTime(0); - if (recovery < 30) - recovery = 30; - player->SetRecoveryTime(flt_6BE3A4_debug_recmod1 * (double)recovery * 2.133333333333333); - } - } + } + else if (bow_idx) + { + shooting_bow = true; + _42777D_CastSpell_UseWand_ShootArrow(100, uActiveCharacter - 1, 0, 0, 0); } else { - if (bow_idx) - { - shooting_bow = true; - _42777D_CastSpell_UseWand_ShootArrow(100, uActiveCharacter - 1, 0, 0, 0); - } - else - { - if (!pParty->bTurnBasedModeOn) - { - int recovery = player->GetAttackRecoveryTime(0); - if (recovery < 30 ) - recovery = 30; - player->SetRecoveryTime((signed __int64)(flt_6BE3A4_debug_recmod1 * (double)recovery * 2.133333333333333)); - } - } + ; // actor out of range or no actor; no ranged weapon so melee attacking air + } + + if (!pParty->bTurnBasedModeOn) + { + int recovery = player->GetAttackRecoveryTime(0); + if (recovery < 30 ) + recovery = 30; + player->SetRecoveryTime((signed __int64)(flt_6BE3A4_debug_recmod1 * (double)recovery * 2.133333333333333)); } @@ -8508,7 +8482,7 @@ a1a.uAttributes = attributes; a1a.uSectorID = pIndoor->GetSector(v21, y, z); a1a.uSpriteFrameID = 0; - a1a.field_58 = 0; + a1a.field_58_pid = 0; a1a.field_5C = 0; if ( !(a1a.uAttributes & 0x10) ) { @@ -8614,7 +8588,7 @@ a1.uAttributes = 0; a1.uSectorID = pIndoor->GetSector(v3, v4, z); a1.uSpriteFrameID = 0; - a1.field_58 = 0; + a1.field_58_pid = 0; a1.field_5C = 0; v8 = a1.Create(0, 0, 0, 0); if ( v8 != -1 ) @@ -8714,12 +8688,12 @@ if ( a6 >= 1 || a6 <= 4 ) { v10 = 8 * a6 - 8; - LOBYTE(v10) = v10 | 4; - a1a.field_58 = v10; + LOBYTE(v10) = v10 | OBJECT_Player; + a1a.field_58_pid = v10; } else { - a1a.field_58 = 0; + a1a.field_58_pid = 0; } result = a1a.Create(0, 0, 0, 0); if ( result != -1 )
--- a/mm7_data.cpp Wed Feb 20 09:23:48 2013 +0600 +++ b/mm7_data.cpp Wed Feb 20 09:24:02 2013 +0600 @@ -376,7 +376,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 +480,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 +1589,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
--- a/mm7_data.h Wed Feb 20 09:23:48 2013 +0600 +++ b/mm7_data.h Wed Feb 20 09:24:02 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 @@ -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();
--- a/mm7text_ru.cpp Wed Feb 20 09:23:48 2013 +0600 +++ b/mm7text_ru.cpp Wed Feb 20 09:24:02 2013 +0600 @@ -1096,7 +1096,8 @@ else left = match; } - assert(false); + + Log::Warning(L"sprintfex: unknown gender: %S", name); return 0; }
--- a/stru176.h Wed Feb 20 09:23:48 2013 +0600 +++ b/stru176.h Wed Feb 20 09:24:02 2013 +0600 @@ -5,8 +5,7 @@ #pragma pack(push, 1) struct stru176 { - int field_0; - int field_4; + signed __int64 field_0_time; __int16 field_8; __int16 field_A; __int16 field_C;
--- a/stru6.cpp Wed Feb 20 09:23:48 2013 +0600 +++ b/stru6.cpp Wed Feb 20 09:24:02 2013 +0600 @@ -865,7 +865,7 @@ result = AddMobileLight(a2, 0xFF3C1Eu, 256);// fireball hit if ( pRenderer->pRenderD3D ) { - result = a2->field_58 & 7; + result = a2->field_58_pid & 7; if ( result != 3 ) { if ( result != 2 )