Mercurial > mm7
changeset 2254:2e02c384c62b
Merge
author | Grumpy7 |
---|---|
date | Wed, 26 Feb 2014 23:35:46 +0100 |
parents | aff7a7b072b7 (current diff) cd80d91b780f (diff) |
children | 4c9fef516e0a |
files | Actor.cpp BSPModel.cpp Indoor.cpp LightmapBuilder.cpp Render.cpp mm7_5.cpp |
diffstat | 6 files changed, 153 insertions(+), 343 deletions(-) [+] |
line wrap: on
line diff
--- a/Actor.cpp Wed Feb 26 23:35:23 2014 +0100 +++ b/Actor.cpp Wed Feb 26 23:35:46 2014 +0100 @@ -97,9 +97,7 @@ v9 = uTextureID_mhp_grn; if ( actor->sCurrentHP < (int)actor->pMonsterInfo.uHP ) - { v10 = bar_length / actor->pMonsterInfo.uHP * actor->sCurrentHP; - } uX = window->uFrameX + (signed int)(window->uFrameWidth - bar_length) / 2; @@ -119,9 +117,7 @@ if ( uActorID >= 0 && uActorID <= (signed int)(uNumActors - 1) ) { if ( bToggle ) - { pActors[uActorID].uAttributes |= uFlag; - } else { if ( uFlag == 0x10000 ) @@ -140,9 +136,7 @@ for (uint i = 0; i < uNumActors; i++) { if (pActors[uNumActors].sNPC_ID == npc) - { Actor::GiveItem(i, item, a3); - } } } @@ -151,24 +145,23 @@ { if ( (uActorID >= 0) && (signed int)uActorID <= (signed int)(uNumActors - 1) ) { - Actor* currActor = &pActors[uActorID]; if ( bGive ) { - if ( currActor->uCarriedItemID == 0) - currActor->uCarriedItemID = uItemID; - else if ( currActor->array_000234[0].uItemID == 0) - currActor->array_000234[0].uItemID = uItemID; - else if ( currActor->array_000234[1].uItemID == 0) - currActor->array_000234[1].uItemID = uItemID; + if ( pActors[uActorID].uCarriedItemID == 0) + pActors[uActorID].uCarriedItemID = uItemID; + else if ( pActors[uActorID].array_000234[0].uItemID == 0) + pActors[uActorID].array_000234[0].uItemID = uItemID; + else if ( pActors[uActorID].array_000234[1].uItemID == 0) + pActors[uActorID].array_000234[1].uItemID = uItemID; } else { - if ( currActor->uCarriedItemID == uItemID ) - currActor->uCarriedItemID = 0; - else if ( currActor->array_000234[0].uItemID == uItemID ) - currActor->array_000234[0].Reset(); - else if ( currActor->array_000234[1].uItemID == uItemID ) - currActor->array_000234[1].Reset(); + if ( pActors[uActorID].uCarriedItemID == uItemID ) + pActors[uActorID].uCarriedItemID = 0; + else if ( pActors[uActorID].array_000234[0].uItemID == uItemID ) + pActors[uActorID].array_000234[0].Reset(); + else if ( pActors[uActorID].array_000234[1].uItemID == uItemID ) + pActors[uActorID].array_000234[1].Reset(); } } } @@ -178,12 +171,11 @@ { bool isparalyzed; // esi@1 bool isstoned; // edi@2 - AIState v3; // ax@6 isstoned = (signed __int64)this->pActorBuffs[ACTOR_BUFF_STONED].uExpireTime > 0;// stoned isparalyzed = (signed __int64)this->pActorBuffs[ACTOR_BUFF_PARALYZED].uExpireTime > 0;// paralyzed - v3 = this->uAIState; - return !(isstoned || isparalyzed || v3 == Dying || v3 == Dead || v3 == Removed || v3 == Summoned || v3 == Disabled); + return !(isstoned || isparalyzed || this->uAIState == Dying || this->uAIState == Dead + || this->uAIState == Removed || this->uAIState == Summoned || this->uAIState == Disabled); } //----- (004089C7) -------------------------------------------------------- @@ -199,7 +191,6 @@ void Actor::SetRandomGoldIfTheresNoItem() { int v2; // edi@1 - unsigned __int8 v4; // al@7 v2 = 0; if ( !this->array_000234[3].uItemID ) @@ -207,9 +198,7 @@ if ( this->pMonsterInfo.uTreasureDiceRolls ) { for (int i = 0; i < this->pMonsterInfo.uTreasureDiceRolls; i++) - { v2 += rand() % this->pMonsterInfo.uTreasureDiceSides + 1; - } if ( v2 ) { this->array_000234[3].uItemID = 197; @@ -219,9 +208,8 @@ } if ( rand() % 100 < this->pMonsterInfo.uTreasureDropChance ) { - v4 = this->pMonsterInfo.uTreasureLevel; - if ( v4 ) - pItemsTable->GenerateItem(v4, this->pMonsterInfo.uTreasureType, &this->array_000234[2]); + if ( this->pMonsterInfo.uTreasureLevel ) + pItemsTable->GenerateItem(this->pMonsterInfo.uTreasureLevel, this->pMonsterInfo.uTreasureType, &this->array_000234[2]); } this->uAttributes |= 0x800000; } @@ -248,18 +236,18 @@ int v48; // ecx@110 int v51; // ecx@130 int v54; // ecx@138 - Player *v57; // esi@145 - int v58; // eax@146 + //Player *v57; // esi@145 + //int v58; // eax@146 int v59; // edi@146 - int v60; // eax@146 + //int v60; // eax@146 int v61; // edi@146 - int v62; // eax@146 + //int v62; // eax@146 signed int v63; // edi@146 int v68; // edi@168 signed int v70; // ecx@172 int v79; // edx@185 int v80; // eax@185 - signed int v89; // ecx@192 + //signed int v89; // ecx@192 signed int v91; // eax@200 int v94; // ecx@208 int v96; // ecx@217 @@ -310,26 +298,21 @@ a1.uFacing = LOWORD(pDir->uYawAngle); a1.uSoundID = 0; a1.uAttributes = 0; - v89 = pDir->uDistance; a1.uSectorID = pIndoor->GetSector(a1.vPosition.x, a1.vPosition.y, a1.vPosition.z); a1.uSpriteFrameID = 0; a1.spell_caster_pid = PID(OBJECT_Actor, uActorID); a1.spell_target_pid = 0; - if ((double)v89 < 307.2 ) + if ((double)pDir->uDistance < 307.2 ) a1.field_60_distance_related_prolly_lod = 0; - else if ( v89 < 1024 ) + else if ( pDir->uDistance < 1024 ) a1.field_60_distance_related_prolly_lod = 1; - else if ( v89 < 2560 ) + else if ( pDir->uDistance < 2560 ) a1.field_60_distance_related_prolly_lod = 2; else a1.field_60_distance_related_prolly_lod = 3; a1.field_61 = 2; - v91 = a1.Create( - pDir->uYawAngle, - pDir->uPitchAngle, - pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed, - 0); + v91 = a1.Create(pDir->uYawAngle, pDir->uPitchAngle, pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed, 0); if ( v91 != -1 ) { pAudioPlayer->PlaySound((SoundID)word_4EE088_sound_ids[uSpellID], PID(OBJECT_Item, v91), 0, -1, 0, 0, 0, 0); @@ -347,12 +330,8 @@ v39 = 240 * (realPoints + 15); else v39 = 0; - actorPtr->pActorBuffs[ACTOR_BUFF_HASTE].Apply( - pParty->uTimePlayed + (signed int)(signed __int64)((double)(v39 << 7) * 0.033333335), - masteryLevel, - 0, - 0, - 0); + actorPtr->pActorBuffs[ACTOR_BUFF_HASTE].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(v39 << 7) * 0.033333335), + masteryLevel, 0, 0, 0); pGame->pStru6Instance->_4A7E89_sparkles_on_actor_after_it_casts_buff(actorPtr, 0xFF3C1Eu); pAudioPlayer->PlaySound((SoundID)10040, PID(OBJECT_Actor, uActorID), 0, -1, 0, 0, 0, 0); return; @@ -413,15 +392,9 @@ else a1.field_60_distance_related_prolly_lod = 3; a1.field_61 = 2; - v36 = a1.Create( - v32, - pitch, - pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed, - 0); + v36 = a1.Create(v32, pitch, pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed, 0); if ( v36 != -1 ) - { pAudioPlayer->PlaySound((SoundID)word_4EE088_sound_ids[9], PID(OBJECT_Item, v36), 0, -1, 0, 0, 0, 0); - } spellnumb = rand() % 1024 - 512; v28 = rand() % 1024 - 512; } @@ -460,19 +433,14 @@ v19 = spellnuma / -2; a1a = spellnuma / 2; if ( spellnuma / -2 > spellnuma / 2 ) - { v20 = spellnuma / 2; - } else { do { a1.uFacing = v19 + LOWORD(pDir->uYawAngle); - v20 = a1.Create( - (signed __int16)a1.uFacing, - pDir->uPitchAngle, - pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed, - 0); + v20 = a1.Create((signed __int16)a1.uFacing, pDir->uPitchAngle, + pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed, 0); v19 += v118; } while ( v19 <= a1a ); @@ -496,10 +464,7 @@ v8 = 0; actorPtr->pActorBuffs[ACTOR_BUFF_SHIELD].Apply( pParty->uTimePlayed + (signed int)(signed __int64)((double)(v8 << 7) * 0.033333335), - masteryLevel, - 0, - 0, - 0); + masteryLevel, 0, 0, 0); return; case SPELL_EARTH_STONESKIN: @@ -513,10 +478,7 @@ v44 = 0; actorPtr->pActorBuffs[ACTOR_BUFF_STONESKIN].Apply( pParty->uTimePlayed + (signed int)(signed __int64)((double)(v44 << 7) * 0.033333335), - masteryLevel, - realPoints + 5, - 0, - 0); + masteryLevel, realPoints + 5, 0, 0); pGame->pStru6Instance->_4A7E89_sparkles_on_actor_after_it_casts_buff(actorPtr,0x5C310Eu); pAudioPlayer->PlaySound((SoundID)13040, PID(OBJECT_Actor,uActorID), 0, -1, 0, 0, 0, 0); return; @@ -532,10 +494,7 @@ v42 = 0; actorPtr->pActorBuffs[ACTOR_BUFF_BLESS].Apply( pParty->uTimePlayed + (signed int)(signed __int64)((double)(v42 << 7) * 0.033333335), - masteryLevel, - realPoints + 5, - 0, - 0); + masteryLevel, realPoints + 5, 0, 0); pGame->pStru6Instance->_4A7E89_sparkles_on_actor_after_it_casts_buff(actorPtr,0xC8C805u); pAudioPlayer->PlaySound((SoundID)14010, PID(OBJECT_Actor,uActorID), 0, -1, 0, 0, 0, 0); return; @@ -566,10 +525,7 @@ v54 = 0; actorPtr->pActorBuffs[ACTOR_BUFF_HEROISM].Apply( pParty->uTimePlayed + (signed int)(signed __int64)((double)(v54 << 7) * 0.033333335), - masteryLevel, - realPoints + 5, - 0, - 0); + masteryLevel, realPoints + 5, 0, 0); pGame->pStru6Instance->_4A7E89_sparkles_on_actor_after_it_casts_buff(actorPtr,0xC8C805u); pAudioPlayer->PlaySound((SoundID)14060, PID(OBJECT_Actor,uActorID), 0, -1, 0, 0, 0, 0); return; @@ -599,24 +555,16 @@ case SPELL_LIGHT_DISPEL_MAGIC: for (int i = 0; i < 20; i++ ) - { pParty->pPartyBuffs[i].Reset(); - } for (int i = 1; i <= 4; i++) { - v57 = pPlayers[i]; - v58 = v57->GetActualWillpower(); - v59 = v57->GetParameterBonus(v58); - v60 = v57->GetActualIntelligence(); - v61 = (v57->GetParameterBonus(v60) + v59) / 2; - v62 = v57->GetActualLuck(); - v63 = v61 + v57->GetParameterBonus(v62) + 30; + v59 = pPlayers[i]->GetParameterBonus(pPlayers[i]->GetActualWillpower()); + v61 = (pPlayers[i]->GetParameterBonus(pPlayers[i]->GetActualIntelligence()) + v59) / 2; + v63 = v61 + pPlayers[i]->GetParameterBonus(pPlayers[i]->GetActualLuck()) + 30; if ( rand() % v63 < 30 ) { - for (uint k = 0; k < v57->pPlayerBuffs.size(); k++) - { - v57->pPlayerBuffs[k].Reset(); - } + for (uint k = 0; k < pPlayers[i]->pPlayerBuffs.size(); k++) + pPlayers[i]->pPlayerBuffs[k].Reset(); pOtherOverlayList->_4418B1(11210, i + 99, 0, 65536); } } @@ -625,9 +573,7 @@ case SPELL_LIGHT_DAY_OF_PROTECTION: if (masteryLevel == 1 || masteryLevel == 2) - { v96 = 300 * realPoints + 3840; - } else if (masteryLevel == 3 ) { LOWORD(realPoints) = 3 * realPoints; @@ -645,10 +591,7 @@ } actorPtr->pActorBuffs[ACTOR_BUFF_DAY_OF_PROTECTION].Apply( pParty->uTimePlayed + (signed int)(signed __int64)((double)(v96 << 7) * 0.033333335), - masteryLevel, - realPoints, - 0, - 0); + masteryLevel, realPoints, 0, 0); pGame->pStru6Instance->_4A7E89_sparkles_on_actor_after_it_casts_buff(actorPtr, 0xFFFFFFu); pAudioPlayer->PlaySound((SoundID)17070, PID(OBJECT_Actor, uActorID), 0, -1, 0, 0, 0, 0); return; @@ -664,10 +607,7 @@ v94 = 0; actorPtr->pActorBuffs[ACTOR_BUFF_HOUR_OF_POWER].Apply( pParty->uTimePlayed + (signed int)(signed __int64)((double)(v94 << 7) * 0.033333335), - masteryLevel, - realPoints + 5, - 0, - 0); + masteryLevel, realPoints + 5, 0, 0); pGame->pStru6Instance->_4A7E89_sparkles_on_actor_after_it_casts_buff(actorPtr, 0xFFFFFFu); pAudioPlayer->PlaySound((SoundID)17080, PID(OBJECT_Actor, uActorID), 0, -1, 0, 0, 0, 0); return; @@ -703,20 +643,15 @@ a1.field_60_distance_related_prolly_lod = 3; a1c = spellnume / -2; if ( spellnume / -2 > spellnume / 2 ) - { v80 = spellnume / -2; - } else { do { v79 = pDir->uYawAngle; a1.uFacing = a1c + LOWORD(pDir->uYawAngle); - v80 = a1.Create( - v79, - pDir->uPitchAngle, - pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed, - 0); + v80 = a1.Create(v79, pDir->uPitchAngle, + pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed, 0); a1c += v116; } while ( a1c <= spellnume / 2 ); @@ -738,17 +673,13 @@ v68 = 900 * realPoints + 3840; actorPtr->pActorBuffs[ACTOR_BUFF_PAIN_REFLECTION].Apply( pParty->uTimePlayed + (signed int)(signed __int64)((double)(v68 << 7) * 0.033333335), - masteryLevel, - 0, - 0, - 0); + masteryLevel, 0, 0, 0); pGame->pStru6Instance->_4A7E89_sparkles_on_actor_after_it_casts_buff(actorPtr,0x7E7E7Eu); pAudioPlayer->PlaySound((SoundID)18060, PID(OBJECT_Actor, uActorID), 0, -1, 0, 0, 0, 0); return; } } - //----- (new func) -------------------------------------------------------- unsigned short Actor::GetObjDescId( int spellId ) { @@ -794,7 +725,7 @@ int v5; // ST1C_4@8 int v6; // eax@8 - int x = 0; BYTE2(x) |= 8u; + int x = 0; x |= 0x80000; int y = 0; y |= 0x80000; Actor* victim = &pActors[uActorID]; if ( a2 == 1 ) @@ -825,11 +756,11 @@ //----- (00404874) -------------------------------------------------------- void Actor::AI_RangedAttack( unsigned int uActorID, struct AIDirection *pDir, int type, char a4 ) { - Actor *actPtr; // esi@1 + //Actor *actPtr; // esi@1 char specAb; // al@1 int v13; // edx@28 - actPtr = &pActors[uActorID]; + //actPtr = &pActors[uActorID]; SpriteObject a1; // [sp+Ch] [bp-74h]@1 @@ -890,12 +821,12 @@ return; } a1.stru_24.Reset(); - a1.vPosition.x = actPtr->vPosition.x; + a1.vPosition.x = pActors[uActorID].vPosition.x; a1.spell_id = 0; - a1.vPosition.y = actPtr->vPosition.y; + a1.vPosition.y = pActors[uActorID].vPosition.y; a1.spell_level = 0; a1.spell_skill = 0; - a1.vPosition.z = actPtr->vPosition.z - (unsigned int)(actPtr->uActorHeight * -0.75); + a1.vPosition.z = pActors[uActorID].vPosition.z - (unsigned int)(pActors[uActorID].uActorHeight * -0.75); a1.uFacing = pDir->uYawAngle; a1.uSoundID = 0; a1.uAttributes = 0; @@ -913,35 +844,24 @@ a1.field_60_distance_related_prolly_lod = 3; a1.field_61 = a4; - a1.Create( - pDir->uYawAngle, - pDir->uPitchAngle, - pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed, - 0); - if ( actPtr->pMonsterInfo.uSpecialAbilityType == 1 ) + a1.Create(pDir->uYawAngle, pDir->uPitchAngle, pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed, 0); + if ( pActors[uActorID].pMonsterInfo.uSpecialAbilityType == 1 ) { - specAb = actPtr->pMonsterInfo.uSpecialAbilityDamageDiceBonus; + specAb = pActors[uActorID].pMonsterInfo.uSpecialAbilityDamageDiceBonus; if ( specAb == 2 ) { - a1.vPosition.z += 40; + a1.vPosition.z += 40; v13 = pDir->uYawAngle; } else { if ( specAb != 3 ) return; - a1.Create( - pDir->uYawAngle + 30, //TODO find out why the YawAngle change - pDir->uPitchAngle, - pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed, - 0); + a1.Create(pDir->uYawAngle + 30, //TODO find out why the YawAngle change + pDir->uPitchAngle, pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed, 0); v13 = pDir->uYawAngle - 30; } - a1.Create( - v13, - pDir->uPitchAngle, - pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed, - 0); + a1.Create(v13, pDir->uPitchAngle, pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed, 0); } return; } @@ -949,20 +869,18 @@ //----- (00404736) -------------------------------------------------------- void Actor::Explode( unsigned int uActorID ) { - Actor *v1; // esi@1 SpriteObject a1; // [sp+Ch] [bp-78h]@1 - v1 = &pActors[uActorID]; a1.uType = 600; a1.uObjectDescID = GetObjDescId(a1.uType); a1.stru_24.Reset(); - a1.vPosition.y = v1->vPosition.y; a1.spell_id = 0; a1.spell_level = 0; a1.spell_skill = 0; - a1.vPosition.x = v1->vPosition.x; + a1.vPosition.x = pActors[uActorID].vPosition.x; + a1.vPosition.y = pActors[uActorID].vPosition.y; + a1.vPosition.z = pActors[uActorID].vPosition.z - (unsigned int)(pActors[uActorID].uActorHeight * -0.75); a1.uFacing = 0; - a1.vPosition.z = v1->vPosition.z - (unsigned int)(v1->uActorHeight * -0.75); a1.uSoundID = 0; a1.uAttributes = 0; a1.uSectorID = pIndoor->GetSector(a1.vPosition.x, a1.vPosition.y, a1.vPosition.z); @@ -1181,30 +1099,28 @@ { AIDirection *v7; // eax@3 AIDirection v1; // eax@3 - Actor *v9; // ebx@3 + //Actor *v9; // ebx@3 AIDirection a3; // [sp+8h] [bp-38h]@4 if ( rand() % 100 >= 5 ) { - v9 = &pActors[uActorID]; + //v9 = &pActors[uActorID]; if ( !a4 ) { Actor::GetDirectionInfo(PID(OBJECT_Actor, uActorID), uObjID, &v1, 0); v7 = &v1; } else - { v7 = a4; - } - v9->uYawAngle = v7->uYawAngle; - v9->uCurrentActionTime = 0; - v9->vVelocity.z = 0; - v9->vVelocity.y = 0; - v9->vVelocity.x = 0; - v9->uPitchAngle = v7->uPitchAngle; - v9->uCurrentActionLength = 256; - v9->uAIState = Interacting; - v9->UpdateAnimation(); + pActors[uActorID].uYawAngle = v7->uYawAngle; + pActors[uActorID].uCurrentActionTime = 0; + pActors[uActorID].vVelocity.z = 0; + pActors[uActorID].vVelocity.y = 0; + pActors[uActorID].vVelocity.x = 0; + pActors[uActorID].uPitchAngle = v7->uPitchAngle; + pActors[uActorID].uCurrentActionLength = 256; + pActors[uActorID].uAIState = Interacting; + pActors[uActorID].UpdateAnimation(); } else Actor::AI_Bored(uActorID, uObjID, a4); @@ -1223,7 +1139,7 @@ void Actor::AI_Stand(unsigned int uActorID, unsigned int object_to_face_pid, unsigned int uActionLength, AIDirection *a4) { assert(uActorID < uNumActors); - Actor* actor = &pActors[uActorID]; + // Actor* actor = &pActors[uActorID]; AIDirection a3; if (!a4) @@ -1232,18 +1148,18 @@ a4 = &a3; } - actor->uAIState = Standing; + pActors[uActorID].uAIState = Standing; if (!uActionLength) - actor->uCurrentActionLength = rand() % 256 + 256; + pActors[uActorID].uCurrentActionLength = rand() % 256 + 256; else - actor->uCurrentActionLength = uActionLength; - actor->uCurrentActionTime = 0; - actor->uYawAngle = a4->uYawAngle; - actor->uPitchAngle = a4->uPitchAngle; - actor->vVelocity.z = 0; - actor->vVelocity.y = 0; - actor->vVelocity.x = 0; - actor->UpdateAnimation(); + pActors[uActorID].uCurrentActionLength = uActionLength; + pActors[uActorID].uCurrentActionTime = 0; + pActors[uActorID].uYawAngle = a4->uYawAngle; + pActors[uActorID].uPitchAngle = a4->uPitchAngle; + pActors[uActorID].vVelocity.z = 0; + pActors[uActorID].vVelocity.y = 0; + pActors[uActorID].vVelocity.x = 0; + pActors[uActorID].UpdateAnimation(); } //----- (00403E61) -------------------------------------------------------- @@ -1304,12 +1220,10 @@ if ( sub_407A1C((int)v6, (int)v7, v23, v10) ) { if (arg0 != nullptr) - { v12 = arg0; - } else { - Actor::GetDirectionInfo(PID(OBJECT_Actor, uActorID), sTargetPid, &a3, 0); + Actor::GetDirectionInfo(PID(OBJECT_Actor, uActorID), sTargetPid, &a3, 0); v12 = &a3; } v3->uYawAngle = LOWORD(v12->uYawAngle); @@ -1319,17 +1233,11 @@ Actor::PlaySound(uActorID, 0); v25 = pMonsterStats->pInfos[v3->pMonsterInfo.uID].uRecoveryTime; if ( v3->pActorBuffs[ACTOR_BUFF_SLOWED].uExpireTime > 0 ) - { v25 *= 2; - } if ( pParty->bTurnBasedModeOn != 1 ) - { v3->pMonsterInfo.uRecoveryTime = (int)(flt_6BE3A8_debug_recmod2 * v25 * 2.133333333333333); - } else - { v3->pMonsterInfo.uRecoveryTime = v25; - } v3->vVelocity.z = 0; v3->vVelocity.y = 0; v3->vVelocity.x = 0; @@ -1480,9 +1388,7 @@ return 0; } for ( int i = 0; i < v3; i++) - { v11 += rand() % v4 + 1; - } return v11 + v5 + v2; } @@ -1580,9 +1486,7 @@ v9 = &a3; } else - { v9 = pDir; - } v3->uYawAngle = LOWORD(v9->uYawAngle); v13 = pSpriteFrameTable->pSpriteSFrames[v3->pSpriteIDs[ANIM_AtkRanged]].uAnimLength; v3->uCurrentActionLength = 8 * v13; @@ -1591,9 +1495,7 @@ Actor::PlaySound(uActorID, 0); pDira = pMonsterStats->pInfos[v3->pMonsterInfo.uID].uRecoveryTime; if (v3->pActorBuffs[ACTOR_BUFF_SLOWED].uExpireTime > 0) - { pDira *= 2; - } if ( pParty->bTurnBasedModeOn == 1 ) v3->pMonsterInfo.uRecoveryTime = pDira; else @@ -1664,9 +1566,7 @@ v9 = &a3; } else - { v9 = pDir; - } v3->uYawAngle = LOWORD(v9->uYawAngle); v13 = pSpriteFrameTable->pSpriteSFrames[v3->pSpriteIDs[ANIM_AtkRanged]].uAnimLength; v3->uCurrentActionLength = 8 * v13; @@ -1675,9 +1575,7 @@ Actor::PlaySound(uActorID, 0); pDira = pMonsterStats->pInfos[v3->pMonsterInfo.uID].uRecoveryTime; if (v3->pActorBuffs[ACTOR_BUFF_SLOWED].uExpireTime > 0) - { pDira *= 2; - } if ( pParty->bTurnBasedModeOn == 1 ) v3->pMonsterInfo.uRecoveryTime = pDira; else @@ -1748,9 +1646,7 @@ v9 = &a3; } else - { v9 = pDir; - } v3->uYawAngle = LOWORD(v9->uYawAngle); v13 = pSpriteFrameTable->pSpriteSFrames[v3->pSpriteIDs[ANIM_AtkRanged]].uAnimLength; v3->uCurrentActionLength = 8 * v13; @@ -1759,15 +1655,11 @@ Actor::PlaySound(uActorID, 0); pDira = pMonsterStats->pInfos[v3->pMonsterInfo.uID].uRecoveryTime; if ( v3->pActorBuffs[ACTOR_BUFF_SLOWED].uExpireTime > 0 ) - { pDira *= 2; - } if ( pParty->bTurnBasedModeOn != 1 ) v3->pMonsterInfo.uRecoveryTime = (int)(flt_6BE3A8_debug_recmod2 * pDira * 2.133333333333333); else - { v3->pMonsterInfo.uRecoveryTime = pDira; - } v3->vVelocity.z = 0; v3->vVelocity.y = 0; v3->vVelocity.x = 0; @@ -1829,9 +1721,7 @@ v10 = &a3; } else - { v10 = pDir; - } v3->uYawAngle = LOWORD(v10->uYawAngle); v14 = pSpriteFrameTable->pSpriteSFrames[v3->pSpriteIDs[ANIM_AtkRanged]].uAnimLength; v3->uCurrentActionLength = 8 * v14; @@ -1840,9 +1730,7 @@ Actor::PlaySound(uActorID, 0); pDira = pMonsterStats->pInfos[v3->pMonsterInfo.uID].uRecoveryTime; if ( v3->pActorBuffs[ACTOR_BUFF_SLOWED].uExpireTime > 0 ) - { pDira *= 2; - } if ( pParty->bTurnBasedModeOn == 1 ) v3->pMonsterInfo.uRecoveryTime = pDira; else @@ -1912,7 +1800,7 @@ v5->uCurrentActionTime = 0; v5->uAIState = Tethered; if ( rand() % 100 < 2 ) - Actor::PlaySound(uActor_id, 3u); + Actor::PlaySound(uActor_id, 3); v5->UpdateAnimation(); } @@ -2139,9 +2027,7 @@ if ( v3 ) { if ( pActors[uActorID].pActorBuffs[ACTOR_BUFF_SHRINK].uExpireTime <= 0 ) - { pAudioPlayer->PlaySound((SoundID)v3, PID(OBJECT_Actor, uActorID), 0, -1, 0, 0, 0, 0); - } else { switch(pActors[uActorID].pActorBuffs[ACTOR_BUFF_SHRINK].uPower) @@ -2191,9 +2077,7 @@ v10 = &a3; } else - { v10 = pDir; - } if ( MonsterStats::BelongsToSupertype(v7->pMonsterInfo.uID, MONSTER_SUPERTYPE_TREANT) ) { if ( !uActionLength ) @@ -2381,9 +2265,7 @@ return Actor::AI_StandOrBored(uActorID, a2, uActionLength, a4); } if ( uActionLength ) - { v6->uCurrentActionLength = uActionLength + rand() % uActionLength; - } else { v12 = v6->uMovementSpeed; @@ -2512,8 +2394,6 @@ //----- (0040104C) -------------------------------------------------------- signed int Actor::GetActorsRelation(Actor *otherActPtr) { - unsigned int v5; // edx@15 - unsigned int v6; // eax@16 unsigned int thisGroup; // ebp@19 int otherGroup; // eax@22 unsigned int thisAlly; // edx@25 @@ -2521,9 +2401,7 @@ if ( otherActPtr) { - v5 = otherActPtr->uGroup; - v6 = this->uGroup; - if ( v5 != 0 && v6 != 0 && v5 == v6 ) + if ( otherActPtr->uGroup != 0 && this->uGroup != 0 && otherActPtr->uGroup == this->uGroup ) return 0; } @@ -2533,13 +2411,9 @@ if ( this->pActorBuffs[ACTOR_BUFF_ENSLAVED].uExpireTime > 0 || thisAlly == 9999) thisGroup = 0; else if ( thisAlly > 0 ) - { thisGroup = thisAlly; - } else - { thisGroup = (this->pMonsterInfo.uID - 1) / 3 + 1; - } if ( otherActPtr ) { @@ -2549,18 +2423,12 @@ if ( otherActPtr->pActorBuffs[ACTOR_BUFF_ENSLAVED].uExpireTime > 0 || otherAlly == 9999) otherGroup = 0; else if ( otherAlly > 0 ) - { otherGroup = otherAlly; - } else - { otherGroup = (otherActPtr->pMonsterInfo.uID - 1) / 3 + 1; - } } else - { otherGroup = 0; - } if ( this->pActorBuffs[ACTOR_BUFF_CHARM].uExpireTime > 0 && !otherGroup || otherActPtr && otherActPtr->pActorBuffs[ACTOR_BUFF_CHARM].uExpireTime > 0 && !thisGroup ) @@ -2578,9 +2446,7 @@ return 4; } else - { return pFactionTable->relations[thisGroup][otherGroup]; - } } //----- (0045976D) -------------------------------------------------------- @@ -2718,8 +2584,8 @@ uMovementSpeed = v9->uBaseSpeed; if ( !(load_sounds_if_bit1_set & 1) ) { - for (int i=0;i<4;++i ) - pSoundSampleIDs[i]=v3->pSoundSampleIDs[i]; + for ( int i = 0; i < 4; ++i ) + pSoundSampleIDs[i] = v3->pSoundSampleIDs[i]; } } @@ -2789,9 +2655,7 @@ if ( v5 >= 90 ) summonMonsterBaseType += 2; else if ( v5 >= 60 ) - { summonMonsterBaseType += 1; - } } v7 = summonMonsterBaseType - 1; v8 = &pActors[uNumActors]; @@ -2828,7 +2692,7 @@ ++uNumActors; ++this->pMonsterInfo.uSpecialAbilityDamageDiceBonus; if ( this->uAttributes & 0x80000 ) - v8->uAttributes |= 0x80000u; + v8->uAttributes |= 0x80000; v8->uSummonerID = PID(OBJECT_Actor,summonerId); } @@ -3354,15 +3218,11 @@ if ( uType ) { if ( uType == 1 ) - { uAliveActors = SearchActorByGroup(&uTotalActors, uParam); - } else { if ( uType == 2 ) - { uAliveActors = SearchActorByMonsterID(&uTotalActors, uParam); - } else { if ( uType != 3 ) @@ -3372,9 +3232,7 @@ } } else - { uAliveActors = SearchAliveActors(&uTotalActors); - } if (uNumAlive) return uAliveActors >= uNumAlive; @@ -4042,9 +3900,7 @@ if ( !( this->uAttributes & 0x800000 ) ) { for (uchar i = 0; i < this->pMonsterInfo.uTreasureDiceRolls; i++ ) - { v14 += rand() % this->pMonsterInfo.uTreasureDiceSides + 1; - } if ( v14 != 0 ) { pParty->PartyFindsGold(v14, 0); @@ -4160,9 +4016,7 @@ this->array_000234[1].Reset(); } if ( !itemFound || rand() % 100 < 90 ) - { this->Remove(); - } } @@ -4182,18 +4036,14 @@ for (int i = 0; i < 20; i++) { if (pParty->pPartyBuffs[i].uExpireTime > 0) - { return true; - } } for ( int i = 1; i <= 4; i++ ) { for ( int j = 0; j < 22; j++ ) { if (pPlayers[i]->pPlayerBuffs[j].uExpireTime > 0) - { return true; - } } } return false; @@ -4249,9 +4099,7 @@ break; } default: - { return true; - } } } @@ -4263,7 +4111,7 @@ signed int okToCastSpell2; // edi@5 if ( this->pMonsterInfo.uSpecialAbilityType == 2 - && this->pMonsterInfo.uSpecialAbilityDamageDiceBonus < 3u + && this->pMonsterInfo.uSpecialAbilityDamageDiceBonus < 3 && rand() % 100 < 5 ) this->SummonMinion(a2); okToCastSpell1 = this->_427102_IsOkToCastSpell(this->pMonsterInfo.uSpell1ID);
--- a/BSPModel.cpp Wed Feb 26 23:35:23 2014 +0100 +++ b/BSPModel.cpp Wed Feb 26 23:35:46 2014 +0100 @@ -8,25 +8,16 @@ //----- (00478389) -------------------------------------------------------- void BSPModel::Release() { - BSPModel *v1; // esi@1 - void *v2; // ST00_4@1 - void *v3; // ST00_4@1 - void *v4; // ST00_4@1 - - v1 = this; - free(*(void **)&this->pVertices.pVertices); - v2 = v1->pFaces; - v1->pVertices.pVertices = 0; - free(v2); - v3 = v1->pFacesOrdering; - v1->pFaces = 0; - free(v3); - v4 = v1->pNodes; - v1->pFacesOrdering = 0; - free(v4); - v1->pNodes = 0; - v1->uNumNodes = 0; - v1->uNumFaces = 0; - v1->pVertices.uNumVertices = 0; - v1->uNumConvexFaces = 0; + free(this->pVertices.pVertices); + this->pVertices.pVertices = 0; + free(this->pFaces); + this->pFaces = 0; + free(this->pFacesOrdering); + this->pFacesOrdering = 0; + free(this->pNodes); + this->pNodes = 0; + this->uNumNodes = 0; + this->uNumFaces = 0; + this->pVertices.uNumVertices = 0; + this->uNumConvexFaces = 0; }
--- a/Indoor.cpp Wed Feb 26 23:35:23 2014 +0100 +++ b/Indoor.cpp Wed Feb 26 23:35:46 2014 +0100 @@ -5570,7 +5570,7 @@ if ( next_vertices_flag )//следующая вершина за ближней границей { //t = near_clip - v0.z / v1.z - v0.z - t = fixpoint_div(524288 - PortalFace._view_transformed_z[i + 2], PortalFace._view_transformed_z[i + 3] - PortalFace._view_transformed_z[i + 2]); + t = fixpoint_div(0x80000 - PortalFace._view_transformed_z[i + 2], PortalFace._view_transformed_z[i + 3] - PortalFace._view_transformed_z[i + 2]); //New_x = (v1.x - v0.x)*t + v0.x PortalFace._view_transformed_x[depth_num_vertices] = fixpoint_mul((PortalFace._view_transformed_x[i + 3] - PortalFace._view_transformed_x[i + 2]), t) + PortalFace._view_transformed_x[i + 2];
--- a/LightmapBuilder.cpp Wed Feb 26 23:35:23 2014 +0100 +++ b/LightmapBuilder.cpp Wed Feb 26 23:35:46 2014 +0100 @@ -228,9 +228,7 @@ v11->fBrightness = v40 - (1 / radius) * v38; } else - { MessageBoxW(nullptr, L"Invalid light type!", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Light.cpp:277", 0); - } } if (!pGame->pStru9Instance->_4980B9(a9, uNumVertices, @@ -841,46 +839,24 @@ //----- (0045CDB7) -------------------------------------------------------- bool LightmapBuilder::ApplyLights_OutdoorFace(ODMFace *pFace) { - int v2; // esi@1 int v3; // eax@1 - MobileLight *pMobileLight; // ebx@2 - int v5; // esi@5 - StationaryLight *pStationaryLight; // ebx@6 bool result; // eax@9 - LightmapBuilder *thisa; // [sp+Ch] [bp-8h]@1 int pSlot; // [sp+10h] [bp-4h]@1 - v2 = 0; - thisa = this; v3 = stru_F8AD28.uDefaultAmbientLightLevel + pFace->uShadeType; pSlot = 0; stru_F8AD28.uCurrentAmbientLightLevel = v3 << 16; - if ( pMobileLightsStack->uNumLightsActive > 0 ) + for ( uint i = 0; i < pMobileLightsStack->uNumLightsActive; ++i ) { - pMobileLight = pMobileLightsStack->pLights; - do - { - if ( pSlot >= 20 ) - break; - ApplyLight_ODM((StationaryLight *)pMobileLight, pFace, (unsigned int *)&pSlot, 1); - ++v2; - ++pMobileLight; - } - while ( v2 < pMobileLightsStack->uNumLightsActive ); + if ( pSlot >= 20 ) + break; + ApplyLight_ODM((StationaryLight *)pMobileLightsStack[i].pLights, pFace, (unsigned int *)&pSlot, 1); } - v5 = 0; - if ( pStationaryLightsStack->uNumLightsActive > 0 ) + for ( uint i = 0; i < pStationaryLightsStack->uNumLightsActive; ++i ) { - pStationaryLight = pStationaryLightsStack->pLights; - do - { - if ( pSlot >= 20 ) - break; - ApplyLight_ODM(pStationaryLight, pFace, (unsigned int *)&pSlot, 0); - ++v5; - ++pStationaryLight; - } - while ( v5 < pStationaryLightsStack->uNumLightsActive ); + if ( pSlot >= 20 ) + break; + ApplyLight_ODM(pStationaryLightsStack[i].pLights, pFace, (unsigned int *)&pSlot, 0); } result = pSlot; stru_F8AD28.uNumLightsApplied = pSlot; @@ -891,53 +867,43 @@ bool LightmapBuilder::ApplyLight_ODM(StationaryLight *pLight, ODMFace *pFace, unsigned int *pSlot, char a4) { int result; // eax@0 - signed int v6; // ebx@1 - int v7; // ecx@2 - int v8; // esi@4 - int v9; // edx@6 int v10; // ecx@8 - int v11; // eax@11 - unsigned int v12; // ebx@11 + //unsigned int v12; // ebx@11 //RenderD3D *v13; // ecx@11 char v14; // dl@11 //__debugbreak(); - v6 = pLight->uRadius; - if ( v6 > 0 - && (result = (int)pFace, v7 = pLight->vPosition.x, v7 > pFace->pBoundingBox.x1 - v6) - && v7 < v6 + pFace->pBoundingBox.x2 - && (v8 = pLight->vPosition.y, v8 > pFace->pBoundingBox.y1 - v6) - && v8 < v6 + pFace->pBoundingBox.y2 - && (v9 = pLight->vPosition.z, v9 > pFace->pBoundingBox.z1 - v6) - && v9 < v6 + pFace->pBoundingBox.z2 - && ((v10 = (pFace->pFacePlane.dist + result = (int)pFace; + v10 = (pFace->pFacePlane.dist + pLight->vPosition.x * pFace->pFacePlane.vNormal.x - + v8 * pFace->pFacePlane.vNormal.y - + v9 * pFace->pFacePlane.vNormal.z) >> 16, - a4) - || v10 >= 0) - && v10 <= v6 ) + + pLight->vPosition.y * pFace->pFacePlane.vNormal.y + + pLight->vPosition.z * pFace->pFacePlane.vNormal.z) >> 16; + if ( pLight->uRadius > 0 + && (pLight->vPosition.x > pFace->pBoundingBox.x1 - pLight->uRadius) && pLight->vPosition.x < pLight->uRadius + pFace->pBoundingBox.x2 + && (pLight->vPosition.y > pFace->pBoundingBox.y1 - pLight->uRadius) && pLight->vPosition.y < pLight->uRadius + pFace->pBoundingBox.y2 + && (pLight->vPosition.z > pFace->pBoundingBox.z1 - pLight->uRadius) && pLight->vPosition.z < pLight->uRadius + pFace->pBoundingBox.z2 + && ((a4) || v10 >= 0) && v10 <= pLight->uRadius ) { - stru_F8AD28._blv_lights_radii[*pSlot] = v6; - stru_F8AD28._blv_lights_inv_radii[*pSlot] = 65536 / v6; + stru_F8AD28._blv_lights_radii[*pSlot] = pLight->uRadius; + stru_F8AD28._blv_lights_inv_radii[*pSlot] = 65536 / pLight->uRadius; stru_F8AD28._blv_lights_xs[*pSlot] = pLight->vPosition.x; stru_F8AD28._blv_lights_ys[*pSlot] = pLight->vPosition.y; stru_F8AD28._blv_lights_zs[*pSlot] = pLight->vPosition.z; stru_F8AD28._blv_lights_rs[*pSlot] = (double)pLight->uLightColorR * 0.0039215689; stru_F8AD28._blv_lights_gs[*pSlot] = (double)pLight->uLightColorG * 0.0039215689; stru_F8AD28._blv_lights_bs[*pSlot] = (double)pLight->uLightColorB * 0.0039215689; - v11 = abs(v10); - v12 = pRenderer->bUsingSpecular; - stru_F8AD28._blv_lights_light_dot_faces[*pSlot] = v11; + //v11 = abs(v10); + //v12 = pRenderer->bUsingSpecular; + stru_F8AD28._blv_lights_light_dot_faces[*pSlot] = abs(v10); stru_F8AD28._blv_lights_types[*pSlot] = pLight->uLightType; //v13 = pRenderer->pRenderD3D; v14 = stru_F8AD28._blv_lights_types[*pSlot]; - if ( /*pRenderer->pRenderD3D &&*/ v12 && v14 & 4 ) + if ( /*pRenderer->pRenderD3D &&*/ pRenderer->bUsingSpecular && v14 & 4 ) v14 = _4E94D2_light_type; stru_F8AD28._blv_lights_types[*pSlot] = v14; result = 4 * *pSlot; - if ( /*v13*/true && v12 ) + if ( /*v13*/true && pRenderer->bUsingSpecular ) { if ( stru_F8AD28._blv_lights_types[*pSlot] & 4 ) { @@ -953,9 +919,7 @@ LOBYTE(result) = 1; } else - { LOBYTE(result) = 0; - } return result; } // 4E94D2: using guessed type char _4E94D2_light_type;
--- a/Render.cpp Wed Feb 26 23:35:23 2014 +0100 +++ b/Render.cpp Wed Feb 26 23:35:46 2014 +0100 @@ -228,6 +228,7 @@ { int v6; // ecx@8 struct Polygon *pTilePolygon; // ebx@8 + float a3a; //warning: the game uses CW culling by default, ccw is incosistent pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_CULLMODE, D3DCULL_CCW); @@ -321,6 +322,12 @@ (norm->y * (float)pOutdoor->vSunlight.y / 65536.0) - (norm->z * (float)pOutdoor->vSunlight.z / 65536.0)); pTilePolygon->dimming_level = 20.0 - floorf(20.0 * _f + 0.5f); + //if ( norm_idx < 0 || norm_idx > uNumTerrainNormals - 1 ) + //norm = 0; + //else + //norm = &pTerrainNormals[norm_idx]; + //pGame->pLightmapBuilder->StackLights_TerrainFace(norm, &a3a, array_50AC10, 4, 1); + //pDecalBuilder->_49BE8A(pTilePolygon, norm, &a3a, array_50AC10, 4, 1); //----------------------------------------------------------------------------------------------- ++pODMRenderParams->uNumPolygons; @@ -8478,18 +8485,18 @@ { //t = near_clip - v0.x / v1.x - v0.x (формула получения точки пересечения отрезка с плоскостью) t = (8.0 - array_50AC10[i].vWorldViewPosition.x) / (array_50AC10[i + 1].vWorldViewPosition.x - array_50AC10[i].vWorldViewPosition.x); - array_507D30[out_num_vertices].vWorldViewPosition.y = (array_50AC10[i + 1].vWorldViewPosition.y - array_50AC10[i].vWorldViewPosition.y) * t + array_50AC10[i].vWorldViewPosition.y; - array_507D30[out_num_vertices].vWorldViewPosition.z = (array_50AC10[i + 1].vWorldViewPosition.z - array_50AC10[i].vWorldViewPosition.z) * t + array_50AC10[i].vWorldViewPosition.z; - array_507D30[out_num_vertices].u = (array_50AC10[i + 1].u - array_50AC10[i].u) * t + array_50AC10[i].u; - array_507D30[out_num_vertices].v = (array_50AC10[i + 1].v - array_50AC10[i].v) * t + array_50AC10[i].v; + array_507D30[out_num_vertices].vWorldViewPosition.y = fixpoint_mul((array_50AC10[i + 1].vWorldViewPosition.y - array_50AC10[i].vWorldViewPosition.y), t) + array_50AC10[i].vWorldViewPosition.y; + array_507D30[out_num_vertices].vWorldViewPosition.z = fixpoint_mul((array_50AC10[i + 1].vWorldViewPosition.z - array_50AC10[i].vWorldViewPosition.z), t) + array_50AC10[i].vWorldViewPosition.z; + array_507D30[out_num_vertices].u = fixpoint_mul((array_50AC10[i + 1].u - array_50AC10[i].u), t) + array_50AC10[i].u; + array_507D30[out_num_vertices].v = fixpoint_mul((array_50AC10[i + 1].v - array_50AC10[i].v), t) + array_50AC10[i].v; } else { t = (8.0 - array_50AC10[i + 1].vWorldViewPosition.x) / (array_50AC10[i].vWorldViewPosition.x - array_50AC10[i + 1].vWorldViewPosition.x); - array_507D30[out_num_vertices].vWorldViewPosition.y = (array_50AC10[i].vWorldViewPosition.y - array_50AC10[i + 1].vWorldViewPosition.y) * t + array_50AC10[i + 1].vWorldViewPosition.y; - array_507D30[out_num_vertices].vWorldViewPosition.z = (array_50AC10[i].vWorldViewPosition.z - array_50AC10[i + 1].vWorldViewPosition.z) * t + array_50AC10[i + 1].vWorldViewPosition.z; - array_507D30[out_num_vertices].u = (array_50AC10[i].u - array_50AC10[i + 1].u) * t + array_50AC10[i + 1].u; - array_507D30[out_num_vertices].v = (array_50AC10[i].v - array_50AC10[i + 1].v) * t + array_50AC10[i + 1].v; + array_507D30[out_num_vertices].vWorldViewPosition.y = fixpoint_mul((array_50AC10[i].vWorldViewPosition.y - array_50AC10[i + 1].vWorldViewPosition.y), t) + array_50AC10[i + 1].vWorldViewPosition.y; + array_507D30[out_num_vertices].vWorldViewPosition.z = fixpoint_mul((array_50AC10[i].vWorldViewPosition.z - array_50AC10[i + 1].vWorldViewPosition.z), t) + array_50AC10[i + 1].vWorldViewPosition.z; + array_507D30[out_num_vertices].u = fixpoint_mul((array_50AC10[i].u - array_50AC10[i + 1].u), t) + array_50AC10[i + 1].u; + array_507D30[out_num_vertices].v = fixpoint_mul((array_50AC10[i].v - array_50AC10[i + 1].v), t) + array_50AC10[i + 1].v; } array_507D30[out_num_vertices].vWorldViewPosition.x = 8.0; array_507D30[out_num_vertices]._rhw = 1.0 / 8.0;
--- a/mm7_5.cpp Wed Feb 26 23:35:23 2014 +0100 +++ b/mm7_5.cpp Wed Feb 26 23:35:46 2014 +0100 @@ -448,7 +448,7 @@ int v30; // edx@39 unsigned int v31; // edx@41 unsigned int v32; // edx@43 - signed int v33; // ecx@44 + //signed int v33; // ecx@44 int v37; // [sp+Ch] [bp-18h]@37 int v38; // [sp+10h] [bp-14h]@5 int v39; // [sp+10h] [bp-14h]@23 @@ -532,20 +532,20 @@ for (uint i = 0; i < pStationaryLightsStack->uNumLightsActive; ++i) { - StationaryLight* p = &pStationaryLightsStack->pLights[i]; - v26 = abs(p->vPosition.x - x); - if ( v26 <= p->uRadius) + //StationaryLight* p = &pStationaryLightsStack->pLights[i]; + v26 = abs(pStationaryLightsStack->pLights[i].vPosition.x - x); + if ( v26 <= pStationaryLightsStack->pLights[i].uRadius) { - v40 = abs(p->vPosition.y - y); - if ( v40 <= p->uRadius) + v40 = abs(pStationaryLightsStack->pLights[i].vPosition.y - y); + if ( v40 <= pStationaryLightsStack->pLights[i].uRadius) { - v37 = abs(p->vPosition.z - z); - if ( v37 <= p->uRadius) + v37 = abs(pStationaryLightsStack->pLights[i].vPosition.z - z); + if ( v37 <= pStationaryLightsStack->pLights[i].uRadius) { v45 = int_get_vector_length(v26, v40, v37); - v33 = p->uRadius; - if ( (signed int)v45 < v33 ) - v6 += ((unsigned __int64)(30i64 * (signed int)(v45 << 16) / v33) >> 16) - 30; + //v33 = pStationaryLightsStack->pLights[i].uRadius; + if ( (signed int)v45 < pStationaryLightsStack->pLights[i].uRadius ) + v6 += ((unsigned __int64)(30i64 * (signed int)(v45 << 16) / pStationaryLightsStack->pLights[i].uRadius) >> 16) - 30; } } }