Mercurial > mm7
diff mm7_5.cpp @ 872:2db21a810d48
Merge
author | Nomad |
---|---|
date | Mon, 01 Apr 2013 13:39:39 +0200 |
parents | 710cf848ad24 f4394e320312 |
children | 7eb081d32614 |
line wrap: on
line diff
--- a/mm7_5.cpp Mon Apr 01 13:39:19 2013 +0200 +++ b/mm7_5.cpp Mon Apr 01 13:39:39 2013 +0200 @@ -1741,9 +1741,9 @@ v42 = pRenderer->pActiveZBuffer[*(int *)uNumSeconds + pSRZBufferLineOffsets[pPoint->y]]; } v44 = (unsigned __int16)v42; - v45 = v44 & 7; + v45 = PID_TYPE(v44); uNumSeconds = v44; - v46 = v44 >> 3; + v46 = PID_ID(v44); if ( v45 == 3 ) { v47 = pActors[v46].uAIState == Dead; @@ -2087,14 +2087,14 @@ SaveGame(v0, 0); v64 = pMapStats->GetMapInfo(pCurrentMapName); v65 = uMessageParam; - if ( v64 == stru_4ECBB8[uMessageParam].uMapInfoID ) + if ( v64 == TownPortalList[uMessageParam].uMapInfoID ) { - pParty->vPosition.x = stru_4ECBB8[v65].pos.x; - pParty->vPosition.y = stru_4ECBB8[v65].pos.y; - pParty->vPosition.z = stru_4ECBB8[v65].pos.z; + pParty->vPosition.x = TownPortalList[v65].pos.x; + pParty->vPosition.y = TownPortalList[v65].pos.y; + pParty->vPosition.z = TownPortalList[v65].pos.z; pParty->uFallStartY = pParty->vPosition.z; - pParty->sRotationY = stru_4ECBB8[v65].rot_y; - pParty->sRotationX = stru_4ECBB8[v65].rot_x; + pParty->sRotationY = TownPortalList[v65].rot_y; + pParty->sRotationX = TownPortalList[v65].rot_x; } else { @@ -2102,13 +2102,13 @@ OnMapLeave(); dword_6BE364_game_settings_1 |= v0; uGameState = 2; - strcpy(pCurrentMapName, pMapStats->pInfos[stru_4ECBB8[uMessageParam].uMapInfoID].pFilename); + strcpy(pCurrentMapName, pMapStats->pInfos[TownPortalList[uMessageParam].uMapInfoID].pFilename); dword_5B65C0 = v0; - _5B65A8_npcdata_uflags_or_other = stru_4ECBB8[uMessageParam].pos.x; - _5B65AC_npcdata_fame_or_other = stru_4ECBB8[uMessageParam].pos.y; - _5B65B0_npcdata_rep_or_other = stru_4ECBB8[uMessageParam].pos.z; - v66 = stru_4ECBB8[uMessageParam].rot_x; - _5B65B4_npcdata_loword_house_or_other = stru_4ECBB8[uMessageParam].rot_y; + _5B65A8_npcdata_uflags_or_other = TownPortalList[uMessageParam].pos.x; + _5B65AC_npcdata_fame_or_other = TownPortalList[uMessageParam].pos.y; + _5B65B0_npcdata_rep_or_other = TownPortalList[uMessageParam].pos.z; + v66 = TownPortalList[uMessageParam].rot_x; + _5B65B4_npcdata_loword_house_or_other = TownPortalList[uMessageParam].rot_y; _5B65B8_npcdata_hiword_house_or_other = v66; InitializeActors(); } @@ -2397,7 +2397,7 @@ v83 = v81; v44 = (unsigned __int16)v81; v84 = v83 >> 16; - if ( (v44 & 7) != 3 || v84 >= 5120 ) + if ( PID_TYPE(v44) != 3 || v84 >= 5120 ) //goto LABEL_90; { v1 = ""; @@ -4520,24 +4520,24 @@ v1 = (char *)stru_50FE08.pZs; do { - v2 = *((short *)v1 - 300) & 7; - v3 = (signed int)*((short *)v1 - 300) >> 3; - v39 = (signed int)*((short *)v1 - 300) >> 3; + v2 = PID_TYPE(*((short *)v1 - 300)); + v3 = PID_ID((signed int)*((short *)v1 - 300)); + v39 = PID_ID((signed int)*((short *)v1 - 300)); if ( v2 == 2 ) { v4 = &pSpriteObjects[v3]; v36 = v4; v5 = v4->spell_caster_pid; - v2 = v5 & 7; - v3 = v5 >> 3; + v2 = PID_TYPE(v5); + v3 = PID_ID(v5); } v41 = v2; v37 = v3; if ( stru_50FE08.field_3EC[v0] & 1 ) { v6 = ai_near_actors_targets_pid[v3]; - v7 = v6 >> 3; - v8 = (v6 & 7) - 3; + v7 = PID_ID(v6); + v8 = PID_TYPE(v6) - 3; uActorID = v7; if ( v8 ) { @@ -4763,9 +4763,9 @@ v61 = 0; v59 = 0; v62 = 0; - if ( (a1 & 7) == OBJECT_Item) - { - v4 = &pSpriteObjects[a1 >> 3]; + if ( PID_TYPE(a1) == OBJECT_Item) + { + v4 = &pSpriteObjects[PID_ID(a1)]; //uDamageAmount = (int)v4; v61 = v4->field_60_distance_related_prolly_lod; a1 = v4->spell_caster_pid; @@ -4773,11 +4773,11 @@ } //v5 = a1 & 7; //uPlayerID = a1 >> 3; - if ((a1 & 7) != OBJECT_Player) + if (PID_TYPE(a1) != OBJECT_Player) return; - assert(abs(a1 >> 3) < 4); - auto player = &pParty->pPlayers[a1 >> 3]; + assert(PID_ID(abs(a1)) < 4); + auto player = &pParty->pPlayers[PID_ID(a1)]; pMonster = &pActors[uActorID_Monster_]; //uPlayerID = pMonster->IsAlive(); if (pMonster->IsNotAlive()) @@ -5034,7 +5034,7 @@ } if ( pMonster->sCurrentHP > 0 ) { - Actor::_4030AD(uActorID_Monster_, a1, 0); + Actor::Stun(uActorID_Monster_, a1, 0); Actor::AggroSurroundingPeasants(uActorID_Monster_, 1); if ( bShowDamage ) { @@ -5238,8 +5238,8 @@ signed int a4a; // [sp+60h] [bp+Ch]@162 Player *a4b; // [sp+60h] [bp+Ch]@168 - v4 = (signed int)uObjID >> 3; - v5 = (uObjID & 7) - 2; + v4 = PID_ID(uObjID); + v5 = PID_TYPE(uObjID) - 2; v74 = a2; uActorID = v4; if ( v5 ) @@ -5309,7 +5309,7 @@ } v17 = (SoundID)a4; LABEL_26: - pAudioPlayer->PlaySound(v17, (8 * a4 + 80) | 4, 0, -1, 0, 0, 0, 0); + pAudioPlayer->PlaySound(v17, PID(OBJECT_Player,a4 + 80), 0, -1, 0, 0, 0, 0); v18 = Actor::_43B3E0_CalcDamage(v7, v74); v19 = HIDWORD(v7->pActorBuffs[3].uExpireTime) == 0; v20 = SHIDWORD(v7->pActorBuffs[3].uExpireTime) < 0; @@ -5369,7 +5369,7 @@ { if ( v7->sCurrentHP >= 1 ) { - Actor::_4030AD(uActorID, 8 * a4 | OBJECT_Player, 0); + Actor::Stun(uActorID, PID(OBJECT_Player,a4), 0); Actor::AggroSurroundingPeasants(uActorID, 1); } else @@ -5436,10 +5436,10 @@ return; } v37 = &pSpriteObjects[uActorID]; - v38 = v37->spell_caster_pid & 7; - v39 = v37->spell_caster_pid >> 3; - v40 = v37->spell_caster_pid & 7; - uActorID = v37->spell_caster_pid >> 3; + v38 = PID_TYPE(v37->spell_caster_pid); + v39 = PID_ID(v37->spell_caster_pid); + v40 = PID_TYPE(v37->spell_caster_pid); + uActorID = PID_ID(v37->spell_caster_pid); v41 = v40 - 2; if ( !v41 ) goto LABEL_80; @@ -5555,7 +5555,7 @@ { if ( v44->sCurrentHP >= 1 ) { - Actor::_4030AD(uActorID, 8 * a4 | OBJECT_Player, 0); + Actor::Stun(uActorID, PID(OBJECT_Player,a4), 0); Actor::AggroSurroundingPeasants(uActorID, 1); } else @@ -5835,9 +5835,9 @@ a2 = uObjID; if ( !pActors[uActorID].IsNotAlive() ) { - if ( (a2 & 7) == OBJECT_Item) - { - v4 = &pSpriteObjects[(signed int)a2 >> 3]; + if ( PID_TYPE(a2) == OBJECT_Item) + { + v4 = &pSpriteObjects[PID_ID(a2)]; v5 = v4->spell_id; if ( v5 ) { @@ -5847,7 +5847,7 @@ if ( v7 ) { if ( pActor->sCurrentHP > 0 ) - Actor::_4030AD(uActorIDa, a2, 0); + Actor::Stun(uActorIDa, a2, 0); else Actor::Die(uActorIDa); a2a = 20 * v7 / (signed int)pActor->pMonsterInfo.uHP; @@ -5866,7 +5866,7 @@ } else { - Actor::_4030AD(uActorIDa, a2, 0); + Actor::Stun(uActorIDa, a2, 0); } } } @@ -5894,17 +5894,17 @@ v4 = 0; uActorID = a2; v17 = a1; - if ( (a1 & 7) == OBJECT_Item) - { - v5 = &pSpriteObjects[a1 >> 3]; + if ( PID_TYPE(a1) == OBJECT_Item) + { + v5 = &pSpriteObjects[PID_ID(a1)]; v4 = v5->field_60_distance_related_prolly_lod; v17 = v5->spell_caster_pid; } - LOWORD(v6) = v17 & 7; + LOWORD(v6) = PID_TYPE(v17); if ( v6 == OBJECT_Actor) { v7 = &pActors[a2]; - v8 = &pActors[v17 >> 3]; + v8 = &pActors[PID_ID(v17)]; v6 = pActors[a2].IsNotAlive(); if ( !v6 ) { @@ -5955,7 +5955,7 @@ if ( v14 ) { if ( v7->sCurrentHP > 0 ) - Actor::_4030AD(uActorID, v17, 0); + Actor::Stun(uActorID, v17, 0); else Actor::Die(uActorID); Actor::AggroSurroundingPeasants(uActorID, 0); @@ -5975,7 +5975,7 @@ } else { - Actor::_4030AD(uActorID, v17, 0); + Actor::Stun(uActorID, v17, 0); } return; } @@ -6747,7 +6747,7 @@ while ( 1 ) { v5 = v16->uPackedID; - if ( (v16->uPackedID & 7) == OBJECT_Player) + if ( PID_TYPE(v16->uPackedID) == OBJECT_Player) break; LABEL_8: ++v17; @@ -6755,8 +6755,8 @@ if ( v17 >= v1->uActorQueueSize ) goto LABEL_11; } - v15 = v5 >> 3; - if ( !pPlayers[(v5 >> 3) + 1]->CanAct() || v19 != v15 ) + v15 = PID_ID(v5); + if ( !pPlayers[(PID_ID(v5)) + 1]->CanAct() || v19 != v15 ) { v2 = 0; goto LABEL_8; @@ -6767,7 +6767,7 @@ { *(int *)v4 = 100; v6 = 8 * v19; - LOBYTE(v6) = 8 * v19 | 4; + LOBYTE(v6) = PID(OBJECT_Player,v19); *((int *)v4 + 2) = v2; *((int *)v4 - 1) = v6; *((int *)v4 + 1) = v2; @@ -6790,7 +6790,7 @@ v8 = v1->pQueue; do { - if ( (v8->uPackedID & 7) == OBJECT_Actor && ai_near_actors_ids[v20] == v8->uPackedID >> 3 ) + if ( PID_TYPE(v8->uPackedID) == OBJECT_Actor && ai_near_actors_ids[v20] == PID_ID(v8->uPackedID) ) break; ++v18; ++v8; @@ -6803,7 +6803,7 @@ v9 = ai_near_actors_ids[v20]; *(int *)v7 = 1; *((int *)v7 + 2) = v2; - *((int *)v7 - 1) = 8 * v9 | 3; + *((int *)v7 - 1) = PID(OBJECT_Actor,v9); *((int *)v7 + 1) = v2; ++v3; v7 += 16; @@ -6834,7 +6834,7 @@ v13 = (char *)&v1->pQueue[0].field_4; do { - v11 = *((int *)v13 - 1) & 7; + v11 = PID_TYPE(*((int *)v13 - 1)); if ( (char)v11 == 4 ) break; if ( *(int *)v13 > 0 ) @@ -6924,7 +6924,7 @@ if ( v6 != 8 ) goto LABEL_19; v3 = 0; - Actor::AI_StandOrBored(v2->uPackedID >> 3, ai_near_actors_targets_pid[v2->uPackedID >> 3], 32, 0); + Actor::AI_StandOrBored(PID_ID(v2->uPackedID), ai_near_actors_targets_pid[PID_ID(v2->uPackedID)], 32, 0); } } } @@ -7027,7 +7027,7 @@ } else { - v8 = &pActors[v1->pQueue[0].uPackedID >> 3]; + v8 = &pActors[PID_ID(v1->pQueue[0].uPackedID)]; if ( v4 > 0 ) { do @@ -7079,10 +7079,10 @@ v2 = this; v3 = *(&this->field_0 + 4 * (a2 + 2)); - if ( (*((char *)&this->field_0 + 16 * (a2 + 2)) & 7) == OBJECT_Player) - { - v4 = v3 >> 3; - v5 = (char *)&pParty->pTurnBasedPlayerRecoveryTimes[v3 >> 3]; + if ( (*((char *)&this->field_0 + 16 * PID_TYPE(a2 + 2))) == OBJECT_Player) + { + v4 = PID_ID(v3); + v5 = (char *)&pParty->pTurnBasedPlayerRecoveryTimes[PID_ID(v3)]; v6 = *(int *)v5; if ( *(int *)v5 ) *(int *)v5 = 0; @@ -7093,7 +7093,7 @@ } else { - v6 = pMonsterStats->pInfos[pActors[v3 >> 3].pMonsterInfo.uID].uRecoveryTime; + v6 = pMonsterStats->pInfos[pActors[PID_ID(v3)].pMonsterInfo.uID].uRecoveryTime; } v2->pQueue[a2].field_4 = v6; v2->_404544(); @@ -7131,7 +7131,7 @@ //----- (0040652A) -------------------------------------------------------- void stru262_TurnBased::_40652A() { - char *v1; // edx@2 + int *v1; // edx@2 Actor *v2; // eax@5 unsigned __int16 v3; // si@5 unsigned int v4; // esi@8 @@ -7140,14 +7140,14 @@ v5 = 0; if ( this->uActorQueueSize > 0 ) { - v1 = (char *)&this->pQueue[0].field_4; + v1 = &this->pQueue[0].field_4; do { if ( !*(int *)v1 ) { - if ( (*(v1 - 4) & 7) == OBJECT_Player) + if ( PID_TYPE(*(v1 - 4)) == OBJECT_Player) return; - v2 = &pActors[*((int *)v1 - 1) >> 3]; + v2 = &pActors[PID_ID(*(v1 - 1))]; v3 = v2->uAIState; if (v3 == Standing || v3 == Fleeing || v3 == Fidgeting) { @@ -7176,7 +7176,7 @@ v1 = this; LOWORD(v2) = _404544(); if ( v1->pQueue[0].field_4 <= 0 - || ((_4063A1(), v2 = v1->pQueue[0].uPackedID, PID_TYPE(v1->pQueue[0].uPackedID) != OBJECT_Player) ? (uActiveCharacter = 0) : (v2 = (v2 >> 3) + 1, uActiveCharacter = v2), + || ((_4063A1(), v2 = v1->pQueue[0].uPackedID, PID_TYPE(v1->pQueue[0].uPackedID) != OBJECT_Player) ? (uActiveCharacter = 0) : (v2 = (PID_ID(v2)) + 1, uActiveCharacter = v2), viewparams->bRedrawGameUI = 1, v1->pQueue[0].field_4 <= 0) ) { @@ -7187,7 +7187,7 @@ do { v2 = *(int *)v4; - if ( (*(char *)v4 & 7) == OBJECT_Player || *(int *)(v4 + 4) > 0 ) + if ( PID_TYPE(*(char *)v4) == OBJECT_Player || *(int *)(v4 + 4) > 0 ) break; if ( *(int *)(v4 + 8) <= 0 ) { @@ -7250,7 +7250,7 @@ a2a = ai_near_actors_targets_pid[PID_ID(v3)]; memcpy(&a3, Actor::GetDirectionInfo(v1->uPackedID, ai_near_actors_targets_pid[PID_ID(v3)], &a3, 0), sizeof(a3)); memcpy(&a4, &a3, sizeof(a4)); - v5 = &pActors[PID_ID(v3 >> 3)]; + v5 = &pActors[PID_ID(v3)]; LOWORD(v3) = v5->uAIState; if ( (short)v3 != Dead ) { @@ -7327,7 +7327,7 @@ v22 = 2; v17 = v5->pMonsterInfo.uSpell1ID; } - Actor::_404AC7(v4, &a4, v17, v22, v24); + Actor::SpellAttack(v4, &a4, v17, v22, v24); LABEL_25: v16 = a2a; v23 = &a4; @@ -7343,7 +7343,7 @@ v18 = v5->pMonsterInfo.uMissleAttack1Type; v25 = 0; } - Actor::_404874(v4, &a4, v18, v25); + Actor::RangedAttack(v4, &a4, v18, v25); goto LABEL_25; } } @@ -7357,8 +7357,8 @@ __int16 stru262_TurnBased::_40680F(int a2) { TurnBased_QueueElem *v2; // eax@1 - TurnBased_QueueElem *v3; // eax@1 - TurnBased_QueueElem *v4; // edi@2 + unsigned int v3; // eax@1 + unsigned int v4; // edi@2 Actor *v5; // ebx@2 unsigned int *v6; // esi@7 AIDirection *v7; // esi@10 @@ -7380,13 +7380,13 @@ v2 = (TurnBased_QueueElem *)((char *)this + 16 * (a2 + 2)); v21 = v2; v2->uActionLength = 0; - v3 = (TurnBased_QueueElem *)v2->uPackedID; + v3 = v2->uPackedID; if ( (unsigned __int8)v3 & 3 ) { - v3 = (TurnBased_QueueElem *)((signed int)v3 >> 3); + v3 = PID_ID(v3); v4 = v3; - a2a = (int)v3; - v5 = &pActors[(int)v3]; + a2a = v3; + v5 = &pActors[v3]; LOWORD(v3) = v5->uAIState; if ( (short)v3 != 5 ) { @@ -7397,7 +7397,7 @@ if ( v5->pMonsterInfo.uHostilityType && !*v6 ) v5->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Friendly; v22 = *v6; - v7 = Actor::GetDirectionInfo(8 * (int)v4 | 3, *v6, &a3, 0); + v7 = Actor::GetDirectionInfo(PID(OBJECT_Actor,(int)v4), *v6, &a3, 0); v8 = v5->uActorRadius; memcpy(&a3, v7, sizeof(a3)); memcpy(&v18, &a3, sizeof(v18)); @@ -7409,7 +7409,7 @@ v20 = 0; } if (PID_TYPE(v22) == OBJECT_Actor) - v10 = (unsigned __int8)*(&byte_5C8D1A[89 * (pMonsterStats->pInfos[pActors[v22 >> 3].pMonsterInfo.uID].uID - 1) / 3] + (v5->pMonsterInfo.uID - 1) / 3); + v10 = (unsigned __int8)*(&byte_5C8D1A[89 * (pMonsterStats->pInfos[pActors[PID_ID(v22)].pMonsterInfo.uID].uID - 1) / 3] + (v5->pMonsterInfo.uID - 1) / 3); else v10 = 4; if ( v10 == 1 ) @@ -7458,7 +7458,7 @@ { if ( v5->pMonsterInfo.uMissleAttack2Type ) { - Actor::_40368B(v13, v22, &v18); + Actor::MissileAttack2(v13, v22, &v18); goto LABEL_43; } } @@ -7473,35 +7473,36 @@ if ( v15 ) { if ( v14 == 2 ) - Actor::_403854(v13, v22, &v18); + Actor::SpellAttack1(v13, v22, &v18); else - Actor::_403A60(v13, v22, &v18); + Actor::SpellAttack2(v13, v22, &v18); goto LABEL_43; } goto LABEL_44; } if ( v5->pMonsterInfo.uMissleAttack1Type ) { - Actor::_403476(v13, v22, &v18); + Actor::MissileAttack1(v13, v22, &v18); LABEL_43: - v3 = v21; + //v3 = v21; v21->field_C = 1; LABEL_48: - v3->uActionLength = v5->uCurrentActionLength; - return (signed __int16)v3; + v21->uActionLength = v5->uCurrentActionLength; + //return (signed __int16)v3; + return (signed __int16)&v21; } } LABEL_44: if ( (double)(signed int)v20 < 307.2 ) { - Actor::_403C6C(v13, v22, &v18); - v3 = v21; + Actor::MeleeAttack(v13, v22, &v18); + //v3 = v21; v21->field_C = 3; goto LABEL_48; } LABEL_47: Actor::AI_Stand(v13, v22, 0x40u, &v18); - v3 = v21; + //v3 = v21; v21->field_C = 0; goto LABEL_48; } @@ -7543,7 +7544,7 @@ v8 = ai_near_actors_targets_pid[PID_ID(v5)]; memcpy(&v7, Actor::GetDirectionInfo(v5, v8, &a3, v2), sizeof(v7)); if ( !v1->_406D10(a2) ) - Actor::AI_Stand(v10->uPackedID >> 3, v8, 0x20u, &v7); + Actor::AI_Stand(PID_ID(v10->uPackedID), v8, 0x20u, &v7); } ++a2; ++v10; @@ -7634,7 +7635,7 @@ a1 = v14->uPackedID; if (PID_TYPE(a1) != OBJECT_Player) { - v5 = v4 >> 3; + v5 = PID_ID(v4); v12 = v5; v6 = &pActors[v5]; if ( SHIDWORD(v6->pActorBuffs[5].uExpireTime) < result @@ -7814,7 +7815,7 @@ goto LABEL_25; } LABEL_24: - Actor::_402968(v16, v15, v21, v23); + Actor::Flee(v16, v15, v21, v23); LABEL_25: v17 = v29; v29->field_C = 4; @@ -7831,9 +7832,9 @@ if ( (signed int)v11 < 5120 ) { if ( v4->pMonsterInfo.uMissleAttack1Type && (signed int)v11 < 1024 ) - Actor::_402AD7(uActorID, a2a, uActorID, 32, &pDir); + Actor::Pursue1(uActorID, a2a, uActorID, 32, &pDir); else - Actor::_40281C(uActorID, a2a, 32, &pDir, 307); + Actor::Pursue2(uActorID, a2a, 32, &pDir, 307); goto LABEL_59; } LABEL_46: @@ -8030,8 +8031,8 @@ int v65; // [sp+60h] [bp-8h]@4 int v66; // [sp+64h] [bp-4h]@7 - v2 = (signed int)uObjID >> 3; - v3 = (uObjID & 7) - 2; + v2 = PID_ID(uObjID); + v3 = PID_TYPE(uObjID) - 2; v4 = uObj2ID; if ( v3 ) { @@ -8066,8 +8067,8 @@ v65 = v11; } v66 = v7; - v12 = v4 >> 3; - v13 = (v4 & 7) - 2; + v12 = PID_ID(v4); + v13 = PID_TYPE(v4) - 2; if ( v13 ) { v14 = v13 - 1;