Mercurial > mm7
changeset 2203:4bfee77e900d
DoInteractionWithTopmostZObject cleaned
author | Ritor1 |
---|---|
date | Tue, 04 Feb 2014 17:29:04 +0600 |
parents | 44d956d4f838 |
children | 23e7c7299ea8 |
files | Actor.cpp Indoor.cpp Player.cpp UI/UiGame.cpp Viewport.cpp |
diffstat | 5 files changed, 266 insertions(+), 475 deletions(-) [+] |
line wrap: on
line diff
--- a/Actor.cpp Mon Feb 03 23:07:15 2014 +0100 +++ b/Actor.cpp Tue Feb 04 17:29:04 2014 +0600 @@ -2932,9 +2932,7 @@ if ( uCurrentlyLoadedLevelType != LEVEL_Indoor && pParty->armageddon_timer > 0 ) { if ( pParty->armageddon_timer > 417 ) - { pParty->armageddon_timer = 0; - } else { pParty->sRotationY = (stru_5C6E00->uIntegerDoublePi - 1) & (pParty->sRotationY + rand() % 16 - 8); @@ -2960,9 +2958,7 @@ if ( sDmg ) { if ( pActor->sCurrentHP >= 0 ) - { Actor::AI_Stun(i, 4, 0); - } else { Actor::Die(i); @@ -2990,7 +2986,6 @@ return; } - for (uint i = 0; i < uNumActors; ++i) { pActor = &pActors[i]; @@ -3061,17 +3056,13 @@ radiusMultiplier = 1.0; v22 = pActor->uAIState; if ( v22 == Dying || v22 == Dead || v22 == Removed || v22 == Disabled || v22 == Summoned) - { continue; - } if ( !pActor->sCurrentHP ) Actor::Die(actor_id); for(int i=0;i<22;i++) { if ( i != 10 ) - { pActor->pActorBuffs[i].IsBuffExpiredToTime(pParty->uTimePlayed); - } } if ( pActor->pActorBuffs[ACTOR_BUFF_SHRINK].uExpireTime < 0 ) pActor->uActorHeight = pMonsterList->pMonsters[pActor->pMonsterInfo.uID - 1].uMonsterHeight; @@ -3110,21 +3101,11 @@ && !pActor->pMonsterInfo.uMissleAttack1Type || uAIState != Stunned ) { if ( (signed int)pActor->uCurrentActionTime < pActor->uCurrentActionLength ) - { continue; - } else if ( pActor->uAIState == AttackingMelee ) { v35 = pActor->special_ability_use_check(actor_id); - AttackerInfo.Add( - a1, - 5120, - pActor->vPosition.x, - pActor->vPosition.y, - pActor->vPosition.z + ((signed int)pActor->uActorHeight >> 1), - v35, - 1 - ); + AttackerInfo.Add(a1, 5120, pActor->vPosition.x, pActor->vPosition.y, pActor->vPosition.z + ((signed int)pActor->uActorHeight >> 1), v35, 1 ); } else if ( pActor->uAIState == AttackingRanged1 ) { @@ -3159,22 +3140,14 @@ v37 =pFactionTable->relations[(pActor->pMonsterInfo.uID-1) / 3 + 1][(pActors[PID_ID(target_pid)].pMonsterInfo.uID - 1) / 3 + 1]; } else - { v37 = 4; - } - v38=0; + v38 = 0; if ( v37 == 2 ) - { v38 = 1024; - } else if ( v37 == 3 ) - { v38 = 2560; - } else if ( v37 == 4 ) - { v38 = 5120; - } if ( v37 >= 1 && v37 <= 4 && v36 < v38 || v37 == 1 ) pActor->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Long; } @@ -3182,9 +3155,7 @@ if (pActor->pActorBuffs[ACTOR_BUFF_AFRAID].uExpireTime > 0) { if ( (signed int)v36 >= 10240 ) - { Actor::AI_RandomMove(actor_id, target_pid, 1024, 0); - } else { //peasents after attacked @@ -3196,13 +3167,10 @@ if ( pActor->pMonsterInfo.uHostilityType == MonsterInfo::Hostility_Long && target_pid ) { - if ( pActor->pMonsterInfo.uAIType == 1 ) { if ( pActor->pMonsterInfo.uMovementType == MONSTER_MOVEMENT_TYPE_STAIONARY ) - { Actor::AI_Stand(actor_id, target_pid, (uint)(pActor->pMonsterInfo.uRecoveryTime * 2.133333333333333), pDir); - } else { Actor::AI_Flee(actor_id, target_pid, 0, pDir); @@ -3242,23 +3210,15 @@ if ( pActor->pMonsterInfo.uMissleAttack1Type ) { if ( (signed int)pActor->pMonsterInfo.uRecoveryTime <= 0 ) - { Actor::AI_MissileAttack1(actor_id, target_pid, pDir); - } else if ( pActor->pMonsterInfo.uMovementType == MONSTER_MOVEMENT_TYPE_STAIONARY ) - { Actor::AI_Stand(actor_id, target_pid, v47, pDir); - } else { if ( radiusMultiplier * 307.2 > (double)v81 ) - { Actor::AI_Stand(actor_id, target_pid, v47, pDir); - } else - { Actor::AI_Pursue1(actor_id, target_pid, actor_id, v47, pDir); - } } } else @@ -3266,14 +3226,9 @@ if ( (double)v81 >= radiusMultiplier * 307.2 ) { if (pActor->pMonsterInfo.uMovementType == MONSTER_MOVEMENT_TYPE_STAIONARY) - { Actor::AI_Stand(actor_id, target_pid, v47, pDir); - } - else if ( v81 >= 1024 ) - { - //monsters + else if ( v81 >= 1024 )//monsters Actor::AI_Pursue3(actor_id, target_pid, 0, pDir); - } else { v70 = (signed int)(radiusMultiplier * 307.2); @@ -3311,26 +3266,18 @@ Actor::AI_SpellAttack2(actor_id, target_pid, pDir); } else if ( radiusMultiplier * 307.2 > (double)v81 || pActor->pMonsterInfo.uMovementType == MONSTER_MOVEMENT_TYPE_STAIONARY ) - { Actor::AI_Stand(actor_id, target_pid, v47, pDir); - } else - { Actor::AI_Pursue1(actor_id, target_pid, actor_id, v47, pDir); - } } else { if ( (double)v81 >= radiusMultiplier * 307.2 ) { if ( pActor->pMonsterInfo.uMovementType == MONSTER_MOVEMENT_TYPE_STAIONARY ) - { Actor::AI_Stand(actor_id, target_pid, v47, pDir); - } else if ( v81 >= 1024 ) - { Actor::AI_Pursue3(actor_id, target_pid, 256, pDir); - } else { v70 = (signed int)(radiusMultiplier * 307.2); @@ -3354,21 +3301,13 @@ if ( pActor->pMonsterInfo.uHostilityType != MonsterInfo::Hostility_Long || !target_pid || v81 >= 5120 || v45 != 1 ) { if ( pActor->pMonsterInfo.uMovementType == MONSTER_MOVEMENT_TYPE_SHORT ) - { Actor::AI_RandomMove(actor_id, 4, 1024, 0); - } else if ( pActor->pMonsterInfo.uMovementType == 1 ) - { Actor::AI_RandomMove(actor_id, 4, 2560, 0); - } else if ( pActor->pMonsterInfo.uMovementType == 2 ) - { Actor::AI_RandomMove(actor_id, 4, 5120, 0); - } else if ( pActor->pMonsterInfo.uMovementType == 4 ) - { Actor::AI_RandomMove(actor_id, 4, 10240, 0); - } else if ( pActor->pMonsterInfo.uMovementType == MONSTER_MOVEMENT_TYPE_STAIONARY ) { Actor::GetDirectionInfo(a1, 4u, &v72, 0); @@ -3378,30 +3317,22 @@ } else if ( !pActor->pMonsterInfo.uMissleAttack2Type ) { - if ( (double)v81 >= radiusMultiplier * 307.2 ) - { + if ( (double)v81 >= radiusMultiplier * 307.2 ) + { if ( pActor->pMonsterInfo.uMovementType == MONSTER_MOVEMENT_TYPE_STAIONARY ) - { Actor::AI_Stand(actor_id, target_pid, v47, pDir); - } - else if ( v81 >= 1024 ) - { - Actor::AI_Pursue3(actor_id, target_pid, 256, pDir); - } - else - { - v70 = (int)(radiusMultiplier * 307.2); - Actor::AI_Pursue2(actor_id, target_pid, 0, pDir, v70); - } - } + else if ( v81 >= 1024 ) + Actor::AI_Pursue3(actor_id, target_pid, 256, pDir); + else + { + v70 = (int)(radiusMultiplier * 307.2); + Actor::AI_Pursue2(actor_id, target_pid, 0, pDir, v70); + } + } else if ( (signed int)pActor->pMonsterInfo.uRecoveryTime > 0 ) - { Actor::AI_Stand(actor_id, target_pid, v47, pDir); - } else - { Actor::AI_MeleeAttack(actor_id, target_pid, pDir); - } } else if ( (signed int)pActor->pMonsterInfo.uRecoveryTime > 0 ) { @@ -3411,9 +3342,7 @@ Actor::AI_Pursue1(actor_id, target_pid, actor_id, v47, pDir); } else - { Actor::AI_MissileAttack2(actor_id, target_pid, pDir); - } } } //----- (0044665D) -------------------------------------------------------- @@ -3583,10 +3512,10 @@ if (!v8 || v7) if (!v6 || v5) if (actor->IsPeasant()) - BYTE2(actor->uAttributes) &= 0xF7u; + actor->uAttributes &= 0xF70000; - BYTE2(actor->uAttributes) &= 0x7Fu; - if (BYTE2(actor->uAttributes) & 0x40) + actor->uAttributes &= 0x7F0000; + if (actor->uAttributes & 0x400000) Actor::_4031C1_update_job_never_gets_called(i, pParty->uCurrentHour, 1); } } @@ -3689,18 +3618,12 @@ std::sort(distances.begin(), distances.end()); v61 = ((unsigned int)(11 * distances[1]) >> 5) + (distances[0] >> 2) + distances[2]; - if ( v61 >= 5120 && !(BYTE1(pMonster->uAttributes) & 4) ) - { + if ( v61 >= 5120 && !(pMonster->uAttributes & 0x400) ) return; - } else if ( v61 >= 2560 ) - { v61 = 2; - } else - { v61 = 1; - } } switch (projectileSprite->spell_id) @@ -4119,7 +4042,7 @@ { if ( pActors[i].uAIState != Dying && pActors[i].uAIState != Removed && pActors[i].uAIState != Disabled && pActors[i].uAIState != Summoned - && (BYTE2(pActors[i].uAttributes) & 8 || pActors[i].GetActorsRelation(0) ) ) + && (pActors[i].uAttributes & 0x80000 || pActors[i].GetActorsRelation(0) ) ) return true; } }
--- a/Indoor.cpp Mon Feb 03 23:07:15 2014 +0100 +++ b/Indoor.cpp Tue Feb 04 17:29:04 2014 +0600 @@ -601,18 +601,14 @@ stru_F8AD28.pDeltaUV[1] = pIndoor->pFaceExtras[pIndoor->pFaces[uFaceID].uFaceExtraID].sTextureDeltaV; result = GetTickCount() >> 3; if ( pIndoor->pFaces[uFaceID].uAttributes & 4 ) - { stru_F8AD28.pDeltaUV[1] -= result & pBitmaps_LOD->GetTexture(pIndoor->pFaces[uFaceID].uBitmapID)->uHeightMinus1; - } else { if ( pIndoor->pFaces[uFaceID].uAttributes & 0x20 ) stru_F8AD28.pDeltaUV[1] += result & pBitmaps_LOD->GetTexture(pIndoor->pFaces[uFaceID].uBitmapID)->uHeightMinus1; } - if ( BYTE1(pIndoor->pFaces[uFaceID].uAttributes) & 8 ) - { + if ( pIndoor->pFaces[uFaceID].uAttributes & 0x800 ) stru_F8AD28.pDeltaUV[0] -= result & pBitmaps_LOD->GetTexture(pIndoor->pFaces[uFaceID].uBitmapID)->uWidthMinus1; - } else { if ( pIndoor->pFaces[uFaceID].uAttributes & FACE_DONT_CACHE_TEXTURE ) @@ -2490,13 +2486,13 @@ goto LABEL_12; } LABEL_12: - if ( BYTE2(this->uAttributes) & 0x80 ) + if ( this->uAttributes & 0x800000 ) { a2->x = -a2->x; a2->y = -a2->y; a2->z = -a2->z; } - if ( BYTE3(this->uAttributes) & 1 ) + if ( this->uAttributes & 0x1000000 ) { a3->x = -a3->x; a3->y = -a3->y; @@ -3610,7 +3606,7 @@ //----- (004016FA) -------------------------------------------------------- int MakeActorAIList_BLV() { - Actor *v0; // esi@2 + //Actor *v0; // esi@2 int v1; // eax@4 int v2; // ebx@4 unsigned int v3; // ecx@4 @@ -3649,10 +3645,10 @@ int v37; // [sp+Ch] [bp-18h]@1 int v38; // [sp+10h] [bp-14h]@4 int v39; // [sp+14h] [bp-10h]@4 - int v40; // [sp+18h] [bp-Ch]@10 + //int v40; // [sp+18h] [bp-Ch]@10 int v41; // [sp+18h] [bp-Ch]@29 int i; // [sp+18h] [bp-Ch]@31 - signed int v43; // [sp+1Ch] [bp-8h]@1 + //signed int v43; // [sp+1Ch] [bp-8h]@1 signed int v44; // [sp+1Ch] [bp-8h]@25 int v45; // [sp+20h] [bp-4h]@1 @@ -3660,201 +3656,152 @@ pParty->uFlags &= 0xFFFFFFCFu; v37 = pIndoor->GetSector(pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z); v45 = 0; - v43 = 0; - if ( (signed int)uNumActors > 0 ) + for ( uint i = 0; i < (signed int)uNumActors; ++i ) { - v0 = pActors.data();//[0].uAttributes; - do + pActors[i].uAttributes &= 0xFB00; + if ( !pActors[i].CanAct() ) + { + pActors[i].uAttributes &= 0xBF00; + continue; + } + v39 = abs(pParty->vPosition.z - pActors[i].vPosition.z); + v38 = abs(pParty->vPosition.y - pActors[i].vPosition.y); + v1 = abs(pParty->vPosition.x - pActors[i].vPosition.x); + v2 = v38; + v3 = v39; + if ( v1 < v38 ) { - BYTE1(v0->uAttributes) &= 0xFBu; - if ( ! v0->CanAct() ) - goto LABEL_60; - v39 = abs(pParty->vPosition.z - v0->vPosition.z); - v38 = abs(pParty->vPosition.y - v0->vPosition.y); - v1 = abs(pParty->vPosition.x - v0->vPosition.x); - v2 = v38; - v3 = v39; - if ( v1 < v38 ) + v4 = v1; + v1 = v38; + v2 = v4; + } + if ( v1 < v39 ) + { + v5 = v1; + v1 = v39; + v3 = v5; + } + if ( v2 < (signed int)v3 ) + { + v6 = v3; + v3 = v2; + v2 = v6; + } + v7 = ((unsigned int)(11 * v2) >> 5) + (v3 >> 2) + v1; + v9 = v7 - pActors[i].uActorRadius; + if ( v9 < 0 ) + v9 = 0; + if ( v9 < 10240 ) + { + pActors[i].uAttributes &= 0xFEFFFFFF; + if ( pActors[i].uAttributes & 0x80000 || pActors[i].GetActorsRelation(0) ) { - v4 = v1; - v1 = v38; - v2 = v4; - } - if ( v1 < v39 ) - { - v5 = v1; - v1 = v39; - v3 = v5; - } - if ( v2 < (signed int)v3 ) - { - v6 = v3; - v3 = v2; - v2 = v6; + pActors[i].uAttributes |= 0x1000000; + if ( !(pParty->uFlags & 0x10) && (double)v9 < 307.2 ) + pParty->uFlags |= 0x10; + if ( !(pParty->uFlags & 0x20) && v9 < 5120 ) + pParty->uFlags |= 0x20; } - v7 = ((unsigned int)(11 * v2) >> 5) + (v3 >> 2) + v1; - v8 = v0->uActorRadius; - v9 = v7 - v8; - v40 = v7 - v8; - if ( v40 < 0 ) - { - v9 = 0; - v40 = 0; - } - if ( v9 < 10240 ) - { - v10 = v0->uAttributes & 0xFEFFFFFF; - v0->uAttributes = v10; - if ( v10 & 0x80000 || v0->GetActorsRelation(0) ) - { - v11 = (pParty->uFlags & 0x10) == 0; - v0->uAttributes = v10 | 0x1000000; - if ( v11 && (double)v40 < 307.2 ) - pParty->uFlags |= 0x10u; - if ( !(pParty->uFlags & 0x20) && v9 < 5120 ) - pParty->uFlags |= 0x20u; - } - v12 = v45++; - ai_near_actors_distances[v12] = v9; - ai_near_actors_ids[v12] = v43; - } - else - { -LABEL_60: - BYTE1(v0->uAttributes) &= 0xBFu; - } - ++v43; - ++v0; + v12 = v45++; + ai_near_actors_distances[v12] = v9; + ai_near_actors_ids[v12] = i; } - while ( v43 < (signed int)uNumActors ); + else + pActors[i].uAttributes &= 0xBF00; } v13 = 0; if ( v45 > 0 ) { - v14 = 1; - v44 = 1; - do + for ( uint i = 1; i < v45; i++ ) { - while ( 1 ) + for ( uint j = 1; j < v45; ++j ) { - v41 = v14; - if ( v14 >= v45 ) - break; v15 = ai_near_actors_distances[v13]; - if ( v15 > ai_near_actors_distances[v14] ) + if ( ai_near_actors_distances[v13] > ai_near_actors_distances[j] ) { - v16 = &ai_near_actors_ids[v14]; v17 = ai_near_actors_ids[v13]; - ai_near_actors_ids[v13] = *v16; - *v16 = v17; - v14 = v41; - ai_near_actors_distances[v13] = ai_near_actors_distances[v41]; - ai_near_actors_distances[v41] = v15; + ai_near_actors_ids[v13] = ai_near_actors_ids[j]; + ai_near_actors_ids[j] = v17; + ai_near_actors_distances[v13] = ai_near_actors_distances[j]; + ai_near_actors_distances[j] = v15; } - ++v14; } ++v13; - v14 = v44 + 1; - v44 = v14; } - while ( v14 - 1 < v45 ); } v18 = 0; v19 = 0; - for ( i = 0; v18 < v45; i = v18 ) + for ( i = 0; i < v45; i++ ) { - v20 = &pActors[ai_near_actors_ids[v18]]; - if ( v20->uAttributes & 0x8000 - || (v21 = sub_4070EF_prolly_detect_player(PID(OBJECT_Actor,ai_near_actors_ids[v18]), 4u), v18 = i, v21) ) + if ( pActors[ai_near_actors_ids[i]].uAttributes & 0x8000 + || sub_4070EF_prolly_detect_player(PID(OBJECT_Actor,ai_near_actors_ids[i]), 4) ) { - v22 = ai_near_actors_ids[v18]; - v20->uAttributes |= 0x8000u; - ai_array_4F6638_actor_ids[v19] = v22; - ai_array_4F5E68[v19++] = ai_near_actors_distances[v18]; + pActors[ai_near_actors_ids[i]].uAttributes |= 0x8000; + ai_array_4F6638_actor_ids[v19] = ai_near_actors_ids[i]; + ai_array_4F5E68[v19++] = ai_near_actors_distances[i]; if ( v19 >= 30 ) break; } - ++v18; } - v23 = 0; ai_arrays_size = v19; if ( (signed int)uNumActors > 0 ) { - v24 = pActors.data();//[0].uAttributes; - do + for ( uint i = 0; i < (signed int)uNumActors; ++i ) { - if ( v24->CanAct() && v24->uSectorID == v37 ) + if ( pActors[i].CanAct() && pActors[i].uSectorID == v37 ) { v25 = 0; if ( v19 <= 0 ) { -LABEL_43: - v26 = ai_arrays_size; - BYTE1(v24->uAttributes) |= 0x40u; - ++ai_arrays_size; - ai_array_4F6638_actor_ids[v26] = v23; + pActors[i].uAttributes |= 0x4000; + ai_array_4F6638_actor_ids[ai_arrays_size++] = i; } else { - while ( ai_array_4F6638_actor_ids[v25] != v23 ) + while ( ai_array_4F6638_actor_ids[v25] != i ) { ++v25; if ( v25 >= v19 ) - goto LABEL_43; + { + pActors[i].uAttributes |= 0x4000; + ai_array_4F6638_actor_ids[ai_arrays_size++] = i; + break; + } } } } - ++v23; - ++v24; } - while ( v23 < (signed int)uNumActors ); } v27 = ai_arrays_size; for ( j = 0; j < v45; ++j ) { - v29 = ai_near_actors_ids[j]; - if ( pActors[v29].uAttributes & 0xC000 && pActors[v29].CanAct() ) + //v29 = ai_near_actors_ids[j]; + if ( pActors[ai_near_actors_ids[j]].uAttributes & 0xC000 && pActors[ai_near_actors_ids[j]].CanAct() ) { v30 = 0; if ( v27 <= 0 ) - { -LABEL_51: - v31 = ai_arrays_size; - v32 = ai_near_actors_ids[j]; - ++ai_arrays_size; - ai_array_4F6638_actor_ids[v31] = v32; - } + ai_array_4F6638_actor_ids[ai_arrays_size++] = ai_near_actors_ids[j]; else { while ( ai_array_4F6638_actor_ids[v30] != ai_near_actors_ids[j] ) { ++v30; if ( v30 >= v27 ) - goto LABEL_51; + { + ai_array_4F6638_actor_ids[ai_arrays_size++] = ai_near_actors_ids[j]; + break; + } } } } } - v33 = ai_arrays_size; if ( ai_arrays_size > 30 ) - { - v33 = 30; ai_arrays_size = 30; - } - memcpy(ai_near_actors_ids.data(), ai_array_4F6638_actor_ids.data(), 4 * v33); + memcpy(ai_near_actors_ids.data(), ai_array_4F6638_actor_ids.data(), 4 * ai_arrays_size); memcpy(ai_near_actors_distances.data(), ai_array_4F5E68.data(), 4 * ai_arrays_size); - v34 = (unsigned int)ai_arrays_size; - if ( ai_arrays_size > 0 ) - { - do - { - v35 = (char *)&pActors[ai_near_actors_ids[HIDWORD(v34)]].uAttributes; - v35[1] |= 4u; - ++HIDWORD(v34); - } - while ( SHIDWORD(v34) < (signed int)v34 ); - } - return v34; + for ( uint i = 0; i < ai_arrays_size; i++ ) + pActors[ai_near_actors_ids[i]].uAttributes |= 0x400; + return ai_arrays_size; } //----- (0043FDED) -------------------------------------------------------- void PrepareActorRenderList_BLV() @@ -4511,7 +4458,7 @@ int v59; // eax@90 BLVSector *v60; // edx@90 int v61; // ecx@90 - BLVFace *v62; // esi@91 + BLVFace *face; // esi@91 int v63; // ST34_4@98 int v64; // ST30_4@98 int v65; // eax@98 @@ -4539,7 +4486,7 @@ int v87; // ecx@128 BLVSector *v88; // eax@128 int v89; // ecx@128 - BLVFace *v90; // esi@129 + //BLVFace *v90; // esi@129 int v91; // ebx@136 int v92; // eax@137 signed int v93; // edi@137 @@ -4662,9 +4609,7 @@ v151 = v53; v119 = pOut.x; if ( pOut.x < outx ) - { v123 = outx; - } else { v119 = outx; @@ -4674,9 +4619,7 @@ v56 = outy; v127 = pOut.y; if ( pOut.y < outy ) - { v131 = outy; - } else { v127 = outy; @@ -4686,9 +4629,7 @@ v58 = outz; v135 = outz; if ( outz < v163 ) - { v139 = v163; - } else { v135 = v163; @@ -4718,47 +4659,45 @@ + 2 * *(__int16 *)((char *)&pIndoor->pSectors->uNumFloors + v61); ++sDepthb ) { - v62 = &pIndoor->pFaces[(*(unsigned __int16 **)((char *)&v60->pWalls + v61))[sDepthb]]; - if ( v62->Portal() - || v119 > v62->pBounding.x2 - || v123 < v62->pBounding.x1 - || v127 > v62->pBounding.y2 - || v131 < v62->pBounding.y1 - || v135 > v62->pBounding.z2 - || v139 < v62->pBounding.z1 - || (v63 = (unsigned __int64)(v143 * (signed __int64)v62->pFacePlane_old.vNormal.x) >> 16, - v64 = (unsigned __int64)(v151 * (signed __int64)v62->pFacePlane_old.vNormal.z) >> 16, - v65 = (unsigned __int64)(v147 * (signed __int64)v62->pFacePlane_old.vNormal.y) >> 16, + face = &pIndoor->pFaces[(*(unsigned __int16 **)((char *)&v60->pWalls + v61))[sDepthb]]; + if ( face->Portal() + || v119 > face->pBounding.x2 + || v123 < face->pBounding.x1 + || v127 > face->pBounding.y2 + || v131 < face->pBounding.y1 + || v135 > face->pBounding.z2 + || v139 < face->pBounding.z1 + || (v63 = fixpoint_mul(v143, face->pFacePlane_old.vNormal.x), + v64 = fixpoint_mul(v151, face->pFacePlane_old.vNormal.z), + v65 = fixpoint_mul(v147, face->pFacePlane_old.vNormal.y), v20 = v63 + v64 + v65 == 0, v66 = v63 + v64 + v65, v107 = v63 + v64 + v65, v20) ) goto LABEL_107; - v67 = outz * v62->pFacePlane_old.vNormal.z; - v68 = -(v62->pFacePlane_old.dist - + v67 - + pOut.y * v62->pFacePlane_old.vNormal.y - + pOut.x * v62->pFacePlane_old.vNormal.x); + //v67 = outz * face->pFacePlane_old.vNormal.z; + v68 = -(face->pFacePlane_old.dist + outz * face->pFacePlane_old.vNormal.z + pOut.y * face->pFacePlane_old.vNormal.y + + pOut.x * face->pFacePlane_old.vNormal.x); if ( v66 <= 0 ) { - if ( v62->pFacePlane_old.dist - + v67 - + pOut.y * v62->pFacePlane_old.vNormal.y - + pOut.x * v62->pFacePlane_old.vNormal.x < 0 ) + if ( face->pFacePlane_old.dist + + outz * face->pFacePlane_old.vNormal.z + + pOut.y * face->pFacePlane_old.vNormal.y + + pOut.x * face->pFacePlane_old.vNormal.x < 0 ) goto LABEL_107; } else { - if ( v62->pFacePlane_old.dist - + v67 - + pOut.y * v62->pFacePlane_old.vNormal.y - + pOut.x * v62->pFacePlane_old.vNormal.x > 0 ) + if ( face->pFacePlane_old.dist + + outz * face->pFacePlane_old.vNormal.z + + pOut.y * face->pFacePlane_old.vNormal.y + + pOut.x * face->pFacePlane_old.vNormal.x > 0 ) goto LABEL_107; } - v69 = abs(-(v62->pFacePlane_old.dist - + v67 - + pOut.y * v62->pFacePlane_old.vNormal.y - + pOut.x * v62->pFacePlane_old.vNormal.x)) >> 14; + v69 = abs(-(face->pFacePlane_old.dist + + outz * face->pFacePlane_old.vNormal.z + + pOut.y * face->pFacePlane_old.vNormal.y + + pOut.x * face->pFacePlane_old.vNormal.x)) >> 14; if ( v69 <= abs(v66) ) { //LODWORD(v70) = v68 << 16; @@ -4772,7 +4711,7 @@ pOut.x + ((signed int)(fixpoint_mul(v108, v143) + 32768) >> 16), pOut.y + ((signed int)(fixpoint_mul(v108, v147) + 32768) >> 16), outz + ((signed int)(fixpoint_mul(v108, v151) + 32768) >> 16), - v62) ) + face) ) { v114 = 1; break; @@ -4829,9 +4768,7 @@ v84 = outy; v128 = pOut.y; if ( pOut.y < outy ) - { v132 = outy; - } else { v128 = outy; @@ -4841,9 +4778,7 @@ v86 = outz; v136 = outz; if ( outz < v163 ) - { v140 = v163; - } else { v136 = v163; @@ -4887,47 +4822,47 @@ } while ( 1 ) { - v90 = &pIndoor->pFaces[(*(unsigned __int16 **)((char *)&v88->pWalls + v89))[v162]]; - if ( v90->Portal() - || v120 > v90->pBounding.x2 - || v124 < v90->pBounding.x1 - || v128 > v90->pBounding.y2 - || v132 < v90->pBounding.y1 - || v136 > v90->pBounding.z2 - || v140 < v90->pBounding.z1 - || (yb = fixpoint_mul(v144, v90->pFacePlane_old.vNormal.x), - v_4b = fixpoint_mul(v148, v90->pFacePlane_old.vNormal.y), - vf = fixpoint_mul(v152, v90->pFacePlane_old.vNormal.z), + face = &pIndoor->pFaces[(*(unsigned __int16 **)((char *)&v88->pWalls + v89))[v162]]; + if ( face->Portal() + || v120 > face->pBounding.x2 + || v124 < face->pBounding.x1 + || v128 > face->pBounding.y2 + || v132 < face->pBounding.y1 + || v136 > face->pBounding.z2 + || v140 < face->pBounding.z1 + || (yb = fixpoint_mul(v144, face->pFacePlane_old.vNormal.x), + v_4b = fixpoint_mul(v148, face->pFacePlane_old.vNormal.y), + vf = fixpoint_mul(v152, face->pFacePlane_old.vNormal.z), v20 = yb + vf + v_4b == 0, v91 = yb + vf + v_4b, vc = yb + vf + v_4b, v20) ) goto LABEL_145; - v92 = outz * v90->pFacePlane_old.vNormal.z; - v93 = -(v90->pFacePlane_old.dist + v92 = outz * face->pFacePlane_old.vNormal.z; + v93 = -(face->pFacePlane_old.dist + v92 - + pOut.y * v90->pFacePlane_old.vNormal.y - + pOut.x * v90->pFacePlane_old.vNormal.x); + + pOut.y * face->pFacePlane_old.vNormal.y + + pOut.x * face->pFacePlane_old.vNormal.x); if ( v91 <= 0 ) { - if ( v90->pFacePlane_old.dist + if ( face->pFacePlane_old.dist + v92 - + pOut.y * v90->pFacePlane_old.vNormal.y - + pOut.x * v90->pFacePlane_old.vNormal.x < 0 ) + + pOut.y * face->pFacePlane_old.vNormal.y + + pOut.x * face->pFacePlane_old.vNormal.x < 0 ) goto LABEL_145; } else { - if ( v90->pFacePlane_old.dist + if ( face->pFacePlane_old.dist + v92 - + pOut.y * v90->pFacePlane_old.vNormal.y - + pOut.x * v90->pFacePlane_old.vNormal.x > 0 ) + + pOut.y * face->pFacePlane_old.vNormal.y + + pOut.x * face->pFacePlane_old.vNormal.x > 0 ) goto LABEL_145; } - v_4c = abs(-(v90->pFacePlane_old.dist + v_4c = abs(-(face->pFacePlane_old.dist + v92 - + pOut.y * v90->pFacePlane_old.vNormal.y - + pOut.x * v90->pFacePlane_old.vNormal.x)) >> 14; + + pOut.y * face->pFacePlane_old.vNormal.y + + pOut.x * face->pFacePlane_old.vNormal.x)) >> 14; if ( v_4c <= abs(v91) ) { //LODWORD(v94) = v93 << 16; @@ -4941,7 +4876,7 @@ pOut.x + ((signed int)(fixpoint_mul(vd, v144) + 32768) >> 16), pOut.y + ((signed int)(fixpoint_mul(vd, v148) + 32768) >> 16), outz + ((signed int)(fixpoint_mul(vd, v152) + 32768) >> 16), - v90) ) + face) ) { v113 = 1; goto LABEL_148; @@ -4977,9 +4912,7 @@ v121 = v6 * v11; v149 = pOut.x; if ( pOut.x < outx ) - { v145 = outx; - } else { v149 = outx; @@ -4988,9 +4921,7 @@ v14 = outy; v141 = pOut.y; if ( pOut.y < outy ) - { v137 = outy; - } else { v141 = outy; @@ -4998,9 +4929,7 @@ } v133 = outz; if ( outz < v163 ) - { v129 = v163; - } else { v133 = v163; @@ -5230,120 +5159,74 @@ uNumVisibleNotEmptySectors = 0; for (uint i = 0; i < num_nodes; ++i) { - if (!uNumVisibleNotEmptySectors) - { - pVisibleSectorIDs_toDrawDecorsActorsEtcFrom[uNumVisibleNotEmptySectors++] = nodes[i].uSectorID; - continue; - } - - v6 = 0; - while (pVisibleSectorIDs_toDrawDecorsActorsEtcFrom[v6] != nodes[i].uSectorID ) - { - ++v6; - if ( v6 >= uNumVisibleNotEmptySectors) - { - pVisibleSectorIDs_toDrawDecorsActorsEtcFrom[uNumVisibleNotEmptySectors++] = nodes[i].uSectorID; - } - } - + //if (!uNumVisibleNotEmptySectors) + //{ + //pVisibleSectorIDs_toDrawDecorsActorsEtcFrom[uNumVisibleNotEmptySectors++] = nodes[i].uSectorID; + //continue; + //} + //v6 = 0; + //while (pVisibleSectorIDs_toDrawDecorsActorsEtcFrom[v6] != nodes[i].uSectorID ) + for ( uint j = 0; j < uNumVisibleNotEmptySectors; j++ ) + { + //++v6; + if ( pVisibleSectorIDs_toDrawDecorsActorsEtcFrom[j] == nodes[i].uSectorID) + break; + } + pVisibleSectorIDs_toDrawDecorsActorsEtcFrom[uNumVisibleNotEmptySectors++] = nodes[i].uSectorID; } } //----- (0046A334) -------------------------------------------------------- char __fastcall DoInteractionWithTopmostZObject(int a1, int a2) { - int v2; // edx@1 - BLVFace *v4; // eax@9 - unsigned int v5; // ecx@9 - unsigned __int16 v6; // ax@11 - //ODMFace *v7; // eax@16 - LevelDecoration *v8; // esi@19 - __int16 v9; // ax@19 - int v10; // eax@22 - int v11; // ecx@22 - int v12; // edi@23 - Actor *v13; // esi@23 - unsigned __int16 v14; // ax@23 - unsigned __int16 v15; // ax@33 - const char *v16; // eax@34 int v17; // edi@36 - int v18; // eax@36 - ItemGen *v19; // esi@39 - unsigned int v20; // eax@39 - int v21; // ecx@40 - std::string v22; // [sp-18h] [bp-2Ch]@5 - const char *v23; // [sp-8h] [bp-1Ch]@5 - int v24; // [sp-4h] [bp-18h]@5 - char v25; // [sp+8h] [bp-Ch]@5 - int v26; // [sp+Ch] [bp-8h]@1 - int a3; // [sp+13h] [bp-1h]@5 - - v26 = a2; - v2 = a1; + + v17 = PID_ID(a1); switch ( PID_TYPE(a1) ) { case OBJECT_Item: // take the item - v17 = PID_ID(a1); - v26 = PID_ID(a1); - v18 = PID_ID(a1); - if ( pObjectList->pObjects[pSpriteObjects[v18].uObjectDescID].uFlags & 0x10 - || v17 >= 1000 - || !pSpriteObjects[v18].uObjectDescID ) + if ( pObjectList->pObjects[pSpriteObjects[v17].uObjectDescID].uFlags & 0x10 || v17 >= 1000 || !pSpriteObjects[v17].uObjectDescID ) return 1; - v19 = &pSpriteObjects[v18].stru_24; - v20 = pSpriteObjects[v18].stru_24.uItemID; - if ( pItemsTable->pItems[v20].uEquipType == EQUIP_GOLD) + if ( pItemsTable->pItems[pSpriteObjects[v17].stru_24.uItemID].uEquipType == EQUIP_GOLD) { - pParty->PartyFindsGold(v19->uSpecEnchantmentType, 0); + pParty->PartyFindsGold(pSpriteObjects[v17].stru_24.uSpecEnchantmentType, 0); viewparams->bRedrawGameUI = 1; - v21 = v17; } else { if ( pParty->pPickedItem.uItemID ) return 1; - v24 = (int)pItemsTable->pItems[v20].pUnidentifiedName; - sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[471], v24); - ShowStatusBarString(pTmpBuf2.data(), 2u); - if ( v19->uItemID == 506 ) - _449B7E_toggle_bit(pParty->_quest_bits, 184, 1u); - if ( v19->uItemID == 455 ) - _449B7E_toggle_bit(pParty->_quest_bits, 185, 1u); - if ( !pParty->AddItemToParty(v19) ) - pParty->SetHoldingItem(v19); - v21 = v26; + sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[471], pItemsTable->pItems[v17].pUnidentifiedName);//You found an item (%s)! + ShowStatusBarString(pTmpBuf2.data(), 2); + if ( pSpriteObjects[v17].stru_24.uItemID == 506 )//artefact + _449B7E_toggle_bit(pParty->_quest_bits, 184, 1); + if ( pSpriteObjects[v17].stru_24.uItemID == 455 ) + _449B7E_toggle_bit(pParty->_quest_bits, 185, 1); + if ( !pParty->AddItemToParty(&pSpriteObjects[v17].stru_24) ) + pParty->SetHoldingItem(&pSpriteObjects[v17].stru_24); } - SpriteObject::OnInteraction(v21); + SpriteObject::OnInteraction(v17); break; case OBJECT_Actor: - v12 = PID_ID(a1); - v13 = &pActors[PID_ID(a1)]; - v14 = v13->uAIState; - if ( v14 == 4 || v14 == 17 ) + if ( pActors[v17].uAIState == Dying || pActors[v17].uAIState == Summoned ) return 1; - if ( v14 == 5 ) - { - pActors[PID_ID(a1)].LootActor(); - } + if ( pActors[v17].uAIState == Dead ) + pActors[v17].LootActor(); else { - if ( !v13->GetActorsRelation(0) && !(BYTE2(v13->uAttributes) & 8) && v13->CanAct() ) + if ( !pActors[v17].GetActorsRelation(0) && !(pActors[v17].uAttributes & 0x80000) && pActors[v17].CanAct() ) { - Actor::AI_FaceObject(v12, 4u, 0, 0); - if ( v13->sNPC_ID ) - { - pMessageQueue_50CBD0->AddMessage(UIMSG_StartNPCDialogue, v12, 0); - } + Actor::AI_FaceObject(v17, 4, 0, 0); + if ( pActors[v17].sNPC_ID ) + pMessageQueue_50CBD0->AddMessage(UIMSG_StartNPCDialogue, v17, 0); else { - v15 = pNPCStats->pGroups_copy[v13->uGroup]; - if ( v15 ) + if ( pNPCStats->pGroups_copy[pActors[v17].uGroup] ) { - v16 = pNPCStats->pCatchPhrases[v15]; - if ( v16 ) + if ( pNPCStats->pCatchPhrases[pNPCStats->pGroups_copy[pActors[v17].uGroup]] ) { - pParty->uFlags |= 2u; - strcpy(byte_5B0938.data(), v16); + pParty->uFlags |= 2; + strcpy(byte_5B0938.data(), pNPCStats->pCatchPhrases[pNPCStats->pGroups_copy[pActors[v17].uGroup]]); sub_4451A8_press_any_key(0, 0, 0); } } @@ -5353,22 +5236,17 @@ break; case OBJECT_Decoration: - v8 = &pLevelDecorations[PID_ID(a1)]; - v9 = v8->uEventID; - if ( v9 ) + if ( pLevelDecorations[v17].uEventID ) { - EventProcessor(v9, a1, 1); - v8->uFlags |= LEVEL_DECORATION_VISIBLE_ON_MAP; + EventProcessor(pLevelDecorations[v17].uEventID, a1, 1); + pLevelDecorations[v17].uFlags |= LEVEL_DECORATION_VISIBLE_ON_MAP; } else { - if ( !pLevelDecorations[PID_ID(a1)].IsInteractive() ) + if ( !pLevelDecorations[v17].IsInteractive() ) return 1; - v10 = v8->_idx_in_stru123; - v24 = 1; - v11 = stru_5E4C90_MapPersistVars._decor_events[v10 - 75] + 380; - activeLevelDecoration = v8; - EventProcessor(v11, 0, 1); + activeLevelDecoration = &pLevelDecorations[v17]; + EventProcessor(stru_5E4C90_MapPersistVars._decor_events[pLevelDecorations[v17]._idx_in_stru123 - 75] + 380, 0, 1); activeLevelDecoration = NULL; } break; @@ -5381,27 +5259,25 @@ if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor ) { int bmodel_id = a1 >> 9, - face_id = PID_ID(a1) & 0x3F; + face_id = v17 & 0x3F; if (bmodel_id >= pOutdoor->uNumBModels) return 1; - ODMFace* face = &pOutdoor->pBModels[bmodel_id].pFaces[face_id]; - if (face->uAttributes & 0x100000 || face->sCogTriggeredID == 0 ) + if (pOutdoor->pBModels[bmodel_id].pFaces[face_id].uAttributes & FACE_UNKNOW + || pOutdoor->pBModels[bmodel_id].pFaces[face_id].sCogTriggeredID == 0 ) return 1; - EventProcessor((signed __int16)face->sCogTriggeredID, v2, 1); + EventProcessor((signed __int16)pOutdoor->pBModels[bmodel_id].pFaces[face_id].sCogTriggeredID, a1, 1); } else { - v4 = &pIndoor->pFaces[PID_ID(a1)]; - v5 = v4->uAttributes; - if ( !(v5 & 0x2000000) ) + if ( !(pIndoor->pFaces[v17].uAttributes & FACE_CLICKABLE) ) { ShowNothingHereStatus(); return 1; } - if ( v5 & 0x100000 || (v6 = pIndoor->pFaceExtras[v4->uFaceExtraID].uEventID) == 0 ) + if ( pIndoor->pFaces[v17].uAttributes & FACE_UNKNOW || !pIndoor->pFaceExtras[pIndoor->pFaces[v17].uFaceExtraID].uEventID ) return 1; if ( pCurrentScreen != SCREEN_BRANCHLESS_NPC_DIALOG ) - EventProcessor((signed __int16)v6, v2, 1); + EventProcessor((signed __int16)pIndoor->pFaceExtras[pIndoor->pFaces[v17].uFaceExtraID].uEventID, a1, 1); } return 0; break;
--- a/Player.cpp Mon Feb 03 23:07:15 2014 +0100 +++ b/Player.cpp Tue Feb 04 17:29:04 2014 +0600 @@ -1996,8 +1996,8 @@ { return 0; } - pGlobalTXT_LocalizationStrings[1]; - if ( !(BYTE2(actroPtr->uAttributes) & 0x80) ) + //pGlobalTXT_LocalizationStrings[1];//Accuracy + if ( !(actroPtr->uAttributes & 0x800000) ) actroPtr->SetRandomGoldIfTheresNoItem(); unsigned __int16 v6 = this->pActiveSkills[PLAYER_SKILL_STEALING]; v7 = v6 & 0x3F; @@ -2006,12 +2006,12 @@ int v29 = StealingRandomBonuses[rand() % 5]; fineIfFailed = actroPtr->pMonsterInfo.uLevel + 100 * (_steal_perm + reputation); currMaxItemValue = v29 + v7 * v30; - pGlobalTXT_LocalizationStrings[200]; - if ( rand() % 100 < 5 || fineIfFailed > currMaxItemValue || BYTE2(actroPtr->uAttributes) & 8 ) + //pGlobalTXT_LocalizationStrings[200];//Sell + if ( rand() % 100 < 5 || fineIfFailed > currMaxItemValue || actroPtr->uAttributes & 0x80000 ) { Actor::AggroSurroundingPeasants(uActorID, 1); - sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[376], this->pName); - ShowStatusBarString(pTmpBuf2.data(), 2u); + sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[376], this->pName);//"%s was caught stealing!" + ShowStatusBarString(pTmpBuf2.data(), 2); return 0; } else @@ -2021,9 +2021,7 @@ { enchBonusSum = 0; for (int i = 0; i < v7; i++) - { enchBonusSum += rand() % StealingEnchantmentBonusForSkill[stealingMastery] + 1; - } if ( actroPtr->array_000234[3].GetItemEquipType() != EQUIP_GOLD ) return 2; enchTypePtr = &actroPtr->array_000234[3].uSpecEnchantmentType; @@ -2033,19 +2031,15 @@ *enchTypePtr = 0; } else - { *enchTypePtr -= enchBonusSum; - } if ( enchBonusSum ) { pParty->PartyFindsGold(enchBonusSum, 2); sprintf(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[302], this->pName, enchBonusSum); //%stole %d gold } else - { sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[377], this->pName); //%s failed to steal anything - } - ShowStatusBarString(pTmpBuf2.data(), 2u); + ShowStatusBarString(pTmpBuf2.data(), 2); return 2; } else if ( v11 % 100 >= 40 ) //stealing an item @@ -2097,7 +2091,7 @@ } } sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[377], this->pName); //%s failed to steal anything - ShowStatusBarString(pTmpBuf2.data(), 2u); + ShowStatusBarString(pTmpBuf2.data(), 2); return 2; } }
--- a/UI/UiGame.cpp Mon Feb 03 23:07:15 2014 +0100 +++ b/UI/UiGame.cpp Tue Feb 04 17:29:04 2014 +0600 @@ -684,7 +684,6 @@ { double v3; // st7@1 int v7; // eax@4 - ODMFace *pFace; // eax@6 const char *v14; // eax@8 char *result; // eax@12 unsigned int pMapID; // eax@14 @@ -718,12 +717,11 @@ { for ( uint i = 0; i < (uint)pOutdoor->pBModels[j].uNumFaces; ++i ) { - pFace = &pOutdoor->pBModels[j].pFaces[i]; - if ( pFace->sCogTriggeredID ) + if ( pOutdoor->pBModels[j].pFaces[i].sCogTriggeredID ) { - if ( !(BYTE2(pFace->uAttributes) & 0x10) ) + if ( !(pOutdoor->pBModels[j].pFaces[i].uAttributes & FACE_UNKNOW) ) { - v14 = GetEventHintString(pFace->sCogTriggeredID); + v14 = GetEventHintString(pOutdoor->pBModels[j].pFaces[i].sCogTriggeredID); if ( v14 ) { if ( _stricmp(v14, "") ) @@ -1954,15 +1952,15 @@ for (uint i = 0; i < (uint)pIndoor->pMapOutlines->uNumOutlines; ++i) { BLVMapOutline* pOutline = &pIndoor->pMapOutlines->pOutlines[i]; - BLVFace* pFace1 = pIndoor->pFaces + pOutline->uFace1ID; - BLVFace* pFace2 = pIndoor->pFaces + pOutline->uFace2ID; - if (pFace1->Visible() && pFace2->Visible()) + //BLVFace* pFace1 = &pIndoor->pFaces[pOutline->uFace1ID]; + //BLVFace* pFace2 = &pIndoor->pFaces[pOutline->uFace2ID]; + if (pIndoor->pFaces[pOutline->uFace1ID].Visible() && pIndoor->pFaces[pOutline->uFace2ID].Visible()) { if ( pOutline->uFlags & 1 ) { if (bWizardEyeActive && uWizardEyeSkillLevel >= 3 && - (pFace1->Clickable() || pFace2->Clickable()) && - (pIndoor->pFaceExtras[pFace1->uFaceExtraID].uEventID || pIndoor->pFaceExtras[pFace2->uFaceExtraID].uEventID)) + (pIndoor->pFaces[pOutline->uFace1ID].Clickable() || pIndoor->pFaces[pOutline->uFace2ID].Clickable()) && + (pIndoor->pFaceExtras[pIndoor->pFaces[pOutline->uFace1ID].uFaceExtraID].uEventID || pIndoor->pFaceExtras[pIndoor->pFaces[pOutline->uFace2ID].uFaceExtraID].uEventID)) { if (uNumBlueFacesInBLVMinimap < 49) pBlueFacesInBLVMinimapIDs[uNumBlueFacesInBLVMinimap++] = i; @@ -1980,13 +1978,13 @@ } continue; } - if (pFace1->uAttributes & 0x80 || pFace2->uAttributes & 0x80) + if (pIndoor->pFaces[pOutline->uFace1ID].uAttributes & FACE_UNKNOW4 || pIndoor->pFaces[pOutline->uFace2ID].uAttributes & FACE_UNKNOW4) { pOutline->uFlags = pOutline->uFlags | 1; pIndoor->_visible_outlines[i >> 3] |= 1 << (7 - i % 8); if (bWizardEyeActive && uWizardEyeSkillLevel >= 3 && - (pFace1->Clickable() || pFace2->Clickable()) && - (pIndoor->pFaceExtras[pFace1->uFaceExtraID].uEventID || pIndoor->pFaceExtras[pFace2->uFaceExtraID].uEventID)) + (pIndoor->pFaces[pOutline->uFace1ID].Clickable() || pIndoor->pFaces[pOutline->uFace2ID].Clickable()) && + (pIndoor->pFaceExtras[pIndoor->pFaces[pOutline->uFace1ID].uFaceExtraID].uEventID || pIndoor->pFaceExtras[pIndoor->pFaces[pOutline->uFace2ID].uFaceExtraID].uEventID)) { if (uNumBlueFacesInBLVMinimap < 49) pBlueFacesInBLVMinimapIDs[uNumBlueFacesInBLVMinimap++] = i;
--- a/Viewport.cpp Mon Feb 03 23:07:15 2014 +0100 +++ b/Viewport.cpp Tue Feb 04 17:29:04 2014 +0600 @@ -281,28 +281,28 @@ if ( PID_TYPE(v0) == OBJECT_Item) { - a2.y = (signed int)(unsigned __int16)v0 >> 3; - v21 = (signed int)(unsigned __int16)v0 >> 3; - if ( !(pObjectList->pObjects[pSpriteObjects[v21].uObjectDescID].uFlags & 0x10) && a2.y < 1000 && pSpriteObjects[v21].uObjectDescID + int item_id = PID_ID(v0); + //v21 = (signed int)(unsigned __int16)v0 >> 3; + if ( !(pObjectList->pObjects[pSpriteObjects[item_id].uObjectDescID].uFlags & 0x10) && item_id < 1000 && pSpriteObjects[item_id].uObjectDescID && (unsigned int)v0 < 0x2000000 ) { - if ( pSpriteObjects[v21].stru_24.GetItemEquipType() == 18 ) + if ( pSpriteObjects[item_id].stru_24.GetItemEquipType() == 18 ) { - pParty->PartyFindsGold(pSpriteObjects[v21].stru_24.uSpecEnchantmentType, 0); + pParty->PartyFindsGold(pSpriteObjects[item_id].stru_24.uSpecEnchantmentType, 0); viewparams->bRedrawGameUI = 1; } else { - sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[471], pItemsTable->pItems[pSpriteObjects[v21].stru_24.uItemID].pUnidentifiedName); - ShowStatusBarString(pTmpBuf2.data(), 2u); - if ( pSpriteObjects[v21].stru_24.uItemID == ITEM_ARTIFACT_SPLITTER ) + sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[471], pItemsTable->pItems[pSpriteObjects[item_id].stru_24.uItemID].pUnidentifiedName);//You found an item (%s)! + ShowStatusBarString(pTmpBuf2.data(), 2); + if ( pSpriteObjects[item_id].stru_24.uItemID == ITEM_ARTIFACT_SPLITTER ) _449B7E_toggle_bit(pParty->_quest_bits, 184, 1); - if ( pSpriteObjects[v21].stru_24.uItemID == 455 ) + if ( pSpriteObjects[item_id].stru_24.uItemID == 455 ) _449B7E_toggle_bit(pParty->_quest_bits, 185, 1); - if ( !pParty->AddItemToParty(&pSpriteObjects[v21].stru_24) ) - pParty->SetHoldingItem(&pSpriteObjects[v21].stru_24); + if ( !pParty->AddItemToParty(&pSpriteObjects[item_id].stru_24) ) + pParty->SetHoldingItem(&pSpriteObjects[item_id].stru_24); } - SpriteObject::OnInteraction(a2.y); + SpriteObject::OnInteraction(item_id); return; } if ( !pParty->pPickedItem.uItemID ) @@ -339,8 +339,8 @@ memcpy(&a1.stru_24, &pParty->pPickedItem, 0x24u); extern int UnprojectX(int); - v9 = UnprojectX(v1->x); - a1.Create(pParty->sRotationY + v9, 184, 200, 0); + //v9 = UnprojectX(v1->x); + a1.Create(pParty->sRotationY + UnprojectX(v1->x), 184, 200, 0); pTextureID = pIcons_LOD->LoadTexture(pParty->pPickedItem.GetIconName(), TEXTURE_16BIT_PALETTE); if (pTextureID != -1) pIcons_LOD->pTextures[pTextureID].Release(); @@ -350,13 +350,13 @@ } if ( PID_TYPE(v0) == OBJECT_Actor) { - v16 = (signed int)(unsigned __int16)v0 >> 3; - a2.y = v16; - if ( pActors[v16].uAIState == 5 ) + int mon_id = PID_ID(v0); + //a2.y = v16; + if ( pActors[mon_id].uAIState == Dead ) { if ( (unsigned int)v0 < 0x2000000 ) { - pActors[v16].LootActor(); + pActors[mon_id].LootActor(); return; } if ( !pParty->pPickedItem.uItemID ) @@ -393,8 +393,8 @@ memcpy(&a1.stru_24, &pParty->pPickedItem, 0x24u); extern int UnprojectX(int); - v9 = UnprojectX(v1->x); - a1.Create(pParty->sRotationY + v9, 184, 200, 0); + //v9 = UnprojectX(v1->x); + a1.Create(pParty->sRotationY + UnprojectX(v1->x), 184, 200, 0); pTextureID = pIcons_LOD->LoadTexture(pParty->pPickedItem.GetIconName(), TEXTURE_16BIT_PALETTE); if (pTextureID != -1) pIcons_LOD->pTextures[pTextureID].Release(); @@ -404,7 +404,7 @@ } if ( GetAsyncKeyState(VK_SHIFT) >= 0 ) { - if ( !pActors[v16].GetActorsRelation(0) && !(pActors[v16].uAttributes & 0x80000) ) + if ( !pActors[mon_id].GetActorsRelation(0) && !(pActors[mon_id].uAttributes & 0x80000) ) { if ( HIWORD(v0) >= clickable_distance) { @@ -442,8 +442,8 @@ memcpy(&a1.stru_24, &pParty->pPickedItem, 0x24u); extern int UnprojectX(int); - v9 = UnprojectX(v1->x); - a1.Create(pParty->sRotationY + v9, 184, 200, 0); + //v9 = UnprojectX(v1->x); + a1.Create(pParty->sRotationY + UnprojectX(v1->x), 184, 200, 0); pTextureID = pIcons_LOD->LoadTexture(pParty->pPickedItem.GetIconName(), TEXTURE_16BIT_PALETTE); if (pTextureID != -1) pIcons_LOD->pTextures[pTextureID].Release(); @@ -451,24 +451,24 @@ pIcons_LOD->SyncLoadedFilesCount(); return; } - if ( !pActors[v16].CanAct() ) + if ( !pActors[mon_id].CanAct() ) return; - v18 = a2.y; - Actor::AI_FaceObject(a2.y, 4, 0, 0); - if ( !pActors[v16].sNPC_ID ) + //v18 = mon_id; + Actor::AI_FaceObject(mon_id, 4, 0, 0); + if ( !pActors[mon_id].sNPC_ID ) { - if ( pNPCStats->pGroups_copy[pActors[v16].uGroup] ) + if ( pNPCStats->pGroups_copy[pActors[mon_id].uGroup] ) { - if ( pNPCStats->pCatchPhrases[pNPCStats->pGroups_copy[pActors[v16].uGroup]] ) + if ( pNPCStats->pCatchPhrases[pNPCStats->pGroups_copy[pActors[mon_id].uGroup]] ) { - pParty->uFlags |= 2u; - strcpy(byte_5B0938.data(), pNPCStats->pCatchPhrases[pNPCStats->pGroups_copy[pActors[v16].uGroup]]); + pParty->uFlags |= 2; + strcpy(byte_5B0938.data(), pNPCStats->pCatchPhrases[pNPCStats->pGroups_copy[pActors[mon_id].uGroup]]); sub_4451A8_press_any_key(0, 0, 0); } } return; } - pMessageQueue_50CBD0->AddMessage(UIMSG_StartNPCDialogue, v18, 0); + pMessageQueue_50CBD0->AddMessage(UIMSG_StartNPCDialogue, mon_id, 0); return; } if ( pParty->bTurnBasedModeOn == 1 && pTurnEngine->turn_stage == 3 ) @@ -528,8 +528,8 @@ memcpy(&a1.stru_24, &pParty->pPickedItem, 0x24u); extern int UnprojectX(int); - v9 = UnprojectX(v1->x); - a1.Create(pParty->sRotationY + v9, 184, 200, 0); + //v9 = UnprojectX(v1->x); + a1.Create(pParty->sRotationY + UnprojectX(v1->x), 184, 200, 0); pTextureID = pIcons_LOD->LoadTexture(pParty->pPickedItem.GetIconName(), TEXTURE_16BIT_PALETTE); if (pTextureID != -1) pIcons_LOD->pTextures[pTextureID].Release(); @@ -699,8 +699,8 @@ memcpy(&a1.stru_24, &pParty->pPickedItem, 0x24u); extern int UnprojectX(int); - v9 = UnprojectX(v1->x); - a1.Create(pParty->sRotationY + v9, 184, 200, 0); + //v9 = UnprojectX(v1->x); + a1.Create(pParty->sRotationY + UnprojectX(v1->x), 184, 200, 0); pTextureID = pIcons_LOD->LoadTexture(pParty->pPickedItem.GetIconName(), TEXTURE_16BIT_PALETTE); if (pTextureID != -1) pIcons_LOD->pTextures[pTextureID].Release();