Mercurial > mm7
comparison mm7_5.cpp @ 848:ceef50611567
* AI fixed (temporary)
* PID_ID, PID_TYPE replaces
* >> 7 error in AudioPlayer
author | zipi |
---|---|
date | Sun, 31 Mar 2013 10:44:43 +0100 |
parents | ae8f83e1b0cf |
children | 8fafe3645f36 |
comparison
equal
deleted
inserted
replaced
847:e398541aee60 | 848:ceef50611567 |
---|---|
1739 uNumSeconds = (unsigned int)pMouse->GetCursorPos(&v210); | 1739 uNumSeconds = (unsigned int)pMouse->GetCursorPos(&v210); |
1740 pPoint = pMouse->GetCursorPos(&v208); | 1740 pPoint = pMouse->GetCursorPos(&v208); |
1741 v42 = pRenderer->pActiveZBuffer[*(int *)uNumSeconds + pSRZBufferLineOffsets[pPoint->y]]; | 1741 v42 = pRenderer->pActiveZBuffer[*(int *)uNumSeconds + pSRZBufferLineOffsets[pPoint->y]]; |
1742 } | 1742 } |
1743 v44 = (unsigned __int16)v42; | 1743 v44 = (unsigned __int16)v42; |
1744 v45 = v44 & 7; | 1744 v45 = PID_TYPE(v44); |
1745 uNumSeconds = v44; | 1745 uNumSeconds = v44; |
1746 v46 = v44 >> 3; | 1746 v46 = PID_ID(v44); |
1747 if ( v45 == 3 ) | 1747 if ( v45 == 3 ) |
1748 { | 1748 { |
1749 v47 = pActors[v46].uAIState == Dead; | 1749 v47 = pActors[v46].uAIState == Dead; |
1750 //goto LABEL_400; | 1750 //goto LABEL_400; |
1751 if ( !v47 ) | 1751 if ( !v47 ) |
2395 v81 = pRenderer->pActiveZBuffer[*(int *)uNumSeconds + pSRZBufferLineOffsets[pPoint2->y]]; | 2395 v81 = pRenderer->pActiveZBuffer[*(int *)uNumSeconds + pSRZBufferLineOffsets[pPoint2->y]]; |
2396 } | 2396 } |
2397 v83 = v81; | 2397 v83 = v81; |
2398 v44 = (unsigned __int16)v81; | 2398 v44 = (unsigned __int16)v81; |
2399 v84 = v83 >> 16; | 2399 v84 = v83 >> 16; |
2400 if ( (v44 & 7) != 3 || v84 >= 5120 ) | 2400 if ( PID_TYPE(v44) != 3 || v84 >= 5120 ) |
2401 //goto LABEL_90; | 2401 //goto LABEL_90; |
2402 { | 2402 { |
2403 v1 = ""; | 2403 v1 = ""; |
2404 v0 = 1; | 2404 v0 = 1; |
2405 continue; | 2405 continue; |
4530 { | 4530 { |
4531 pVelocity = &stru_50FE08.vec_4B4; | 4531 pVelocity = &stru_50FE08.vec_4B4; |
4532 v1 = (char *)stru_50FE08.pZs; | 4532 v1 = (char *)stru_50FE08.pZs; |
4533 do | 4533 do |
4534 { | 4534 { |
4535 v2 = *((short *)v1 - 300) & 7; | 4535 v2 = PID_TYPE(*((short *)v1 - 300)); |
4536 v3 = (signed int)*((short *)v1 - 300) >> 3; | 4536 v3 = PID_ID((signed int)*((short *)v1 - 300)); |
4537 v39 = (signed int)*((short *)v1 - 300) >> 3; | 4537 v39 = PID_ID((signed int)*((short *)v1 - 300)); |
4538 if ( v2 == 2 ) | 4538 if ( v2 == 2 ) |
4539 { | 4539 { |
4540 v4 = &pSpriteObjects[v3]; | 4540 v4 = &pSpriteObjects[v3]; |
4541 v36 = v4; | 4541 v36 = v4; |
4542 v5 = v4->spell_caster_pid; | 4542 v5 = v4->spell_caster_pid; |
4543 v2 = v5 & 7; | 4543 v2 = PID_TYPE(v5); |
4544 v3 = v5 >> 3; | 4544 v3 = PID_ID(v5); |
4545 } | 4545 } |
4546 v41 = v2; | 4546 v41 = v2; |
4547 v37 = v3; | 4547 v37 = v3; |
4548 if ( stru_50FE08.field_3EC[v0] & 1 ) | 4548 if ( stru_50FE08.field_3EC[v0] & 1 ) |
4549 { | 4549 { |
4550 v6 = ai_near_actors_targets_pid[v3]; | 4550 v6 = ai_near_actors_targets_pid[v3]; |
4551 v7 = v6 >> 3; | 4551 v7 = PID_ID(v6); |
4552 v8 = (v6 & 7) - 3; | 4552 v8 = PID_TYPE(v6) - 3; |
4553 uActorID = v7; | 4553 uActorID = v7; |
4554 if ( v8 ) | 4554 if ( v8 ) |
4555 { | 4555 { |
4556 if ( v8 == 1 ) | 4556 if ( v8 == 1 ) |
4557 { | 4557 { |
4773 uDamageAmount = 0; | 4773 uDamageAmount = 0; |
4774 a4 = 0; | 4774 a4 = 0; |
4775 v61 = 0; | 4775 v61 = 0; |
4776 v59 = 0; | 4776 v59 = 0; |
4777 v62 = 0; | 4777 v62 = 0; |
4778 if ( (a1 & 7) == OBJECT_Item) | 4778 if ( PID_TYPE(a1) == OBJECT_Item) |
4779 { | 4779 { |
4780 v4 = &pSpriteObjects[a1 >> 3]; | 4780 v4 = &pSpriteObjects[PID_ID(a1)]; |
4781 //uDamageAmount = (int)v4; | 4781 //uDamageAmount = (int)v4; |
4782 v61 = v4->field_60_distance_related_prolly_lod; | 4782 v61 = v4->field_60_distance_related_prolly_lod; |
4783 a1 = v4->spell_caster_pid; | 4783 a1 = v4->spell_caster_pid; |
4784 //v54 = v4->field_58_pid; | 4784 //v54 = v4->field_58_pid; |
4785 } | 4785 } |
4786 //v5 = a1 & 7; | 4786 //v5 = a1 & 7; |
4787 //uPlayerID = a1 >> 3; | 4787 //uPlayerID = a1 >> 3; |
4788 if ((a1 & 7) != OBJECT_Player) | 4788 if (PID_TYPE(a1) != OBJECT_Player) |
4789 return; | 4789 return; |
4790 | 4790 |
4791 assert(abs(a1 >> 3) < 4); | 4791 assert(PID_ID(abs(a1)) < 4); |
4792 auto player = &pParty->pPlayers[a1 >> 3]; | 4792 auto player = &pParty->pPlayers[PID_ID(a1)]; |
4793 pMonster = &pActors[uActorID_Monster_]; | 4793 pMonster = &pActors[uActorID_Monster_]; |
4794 //uPlayerID = pMonster->IsAlive(); | 4794 //uPlayerID = pMonster->IsAlive(); |
4795 if (pMonster->IsNotAlive()) | 4795 if (pMonster->IsNotAlive()) |
4796 return; | 4796 return; |
4797 | 4797 |
5248 unsigned int uActorID; // [sp+4Ch] [bp-8h]@1 | 5248 unsigned int uActorID; // [sp+4Ch] [bp-8h]@1 |
5249 int v77; // [sp+50h] [bp-4h]@26 | 5249 int v77; // [sp+50h] [bp-4h]@26 |
5250 signed int a4a; // [sp+60h] [bp+Ch]@162 | 5250 signed int a4a; // [sp+60h] [bp+Ch]@162 |
5251 Player *a4b; // [sp+60h] [bp+Ch]@168 | 5251 Player *a4b; // [sp+60h] [bp+Ch]@168 |
5252 | 5252 |
5253 v4 = (signed int)uObjID >> 3; | 5253 v4 = PID_ID(uObjID); |
5254 v5 = (uObjID & 7) - 2; | 5254 v5 = PID_TYPE(uObjID) - 2; |
5255 v74 = a2; | 5255 v74 = a2; |
5256 uActorID = v4; | 5256 uActorID = v4; |
5257 if ( v5 ) | 5257 if ( v5 ) |
5258 { | 5258 { |
5259 if ( v5 != 1 | 5259 if ( v5 != 1 |
5446 } | 5446 } |
5447 viewparams->bRedrawGameUI = 1; | 5447 viewparams->bRedrawGameUI = 1; |
5448 return; | 5448 return; |
5449 } | 5449 } |
5450 v37 = &pSpriteObjects[uActorID]; | 5450 v37 = &pSpriteObjects[uActorID]; |
5451 v38 = v37->spell_caster_pid & 7; | 5451 v38 = PID_TYPE(v37->spell_caster_pid); |
5452 v39 = v37->spell_caster_pid >> 3; | 5452 v39 = PID_ID(v37->spell_caster_pid); |
5453 v40 = v37->spell_caster_pid & 7; | 5453 v40 = PID_TYPE(v37->spell_caster_pid); |
5454 uActorID = v37->spell_caster_pid >> 3; | 5454 uActorID = PID_ID(v37->spell_caster_pid); |
5455 v41 = v40 - 2; | 5455 v41 = v40 - 2; |
5456 if ( !v41 ) | 5456 if ( !v41 ) |
5457 goto LABEL_80; | 5457 goto LABEL_80; |
5458 v42 = v41 - 1; | 5458 v42 = v41 - 1; |
5459 if ( !v42 ) | 5459 if ( !v42 ) |
5845 uActorIDa = uActorID; | 5845 uActorIDa = uActorID; |
5846 pActor = &pActors[uActorID]; | 5846 pActor = &pActors[uActorID]; |
5847 a2 = uObjID; | 5847 a2 = uObjID; |
5848 if ( !pActors[uActorID].IsNotAlive() ) | 5848 if ( !pActors[uActorID].IsNotAlive() ) |
5849 { | 5849 { |
5850 if ( (a2 & 7) == OBJECT_Item) | 5850 if ( PID_TYPE(a2) == OBJECT_Item) |
5851 { | 5851 { |
5852 v4 = &pSpriteObjects[(signed int)a2 >> 3]; | 5852 v4 = &pSpriteObjects[PID_ID(a2)]; |
5853 v5 = v4->spell_id; | 5853 v5 = v4->spell_id; |
5854 if ( v5 ) | 5854 if ( v5 ) |
5855 { | 5855 { |
5856 v6 = _43AFE3_calc_spell_damage(v5, v4->spell_level, v4->spell_skill, pActor->sCurrentHP); | 5856 v6 = _43AFE3_calc_spell_damage(v5, v4->spell_level, v4->spell_skill, pActor->sCurrentHP); |
5857 v7 = stru_50C198.CalcMagicalDamageToActor(pActor, 0, v6); | 5857 v7 = stru_50C198.CalcMagicalDamageToActor(pActor, 0, v6); |
5904 int v18; // [sp+20h] [bp+Ch]@34 | 5904 int v18; // [sp+20h] [bp+Ch]@34 |
5905 | 5905 |
5906 v4 = 0; | 5906 v4 = 0; |
5907 uActorID = a2; | 5907 uActorID = a2; |
5908 v17 = a1; | 5908 v17 = a1; |
5909 if ( (a1 & 7) == OBJECT_Item) | 5909 if ( PID_TYPE(a1) == OBJECT_Item) |
5910 { | 5910 { |
5911 v5 = &pSpriteObjects[a1 >> 3]; | 5911 v5 = &pSpriteObjects[PID_ID(a1)]; |
5912 v4 = v5->field_60_distance_related_prolly_lod; | 5912 v4 = v5->field_60_distance_related_prolly_lod; |
5913 v17 = v5->spell_caster_pid; | 5913 v17 = v5->spell_caster_pid; |
5914 } | 5914 } |
5915 LOWORD(v6) = v17 & 7; | 5915 LOWORD(v6) = PID_TYPE(v17); |
5916 if ( v6 == OBJECT_Actor) | 5916 if ( v6 == OBJECT_Actor) |
5917 { | 5917 { |
5918 v7 = &pActors[a2]; | 5918 v7 = &pActors[a2]; |
5919 v8 = &pActors[v17 >> 3]; | 5919 v8 = &pActors[PID_ID(v17)]; |
5920 v6 = pActors[a2].IsNotAlive(); | 5920 v6 = pActors[a2].IsNotAlive(); |
5921 if ( !v6 ) | 5921 if ( !v6 ) |
5922 { | 5922 { |
5923 v9 = v7->uAIState == 7; | 5923 v9 = v7->uAIState == 7; |
5924 v7->uLastCharacterIDToHit = v17; | 5924 v7->uLastCharacterIDToHit = v17; |
6757 goto LABEL_11; | 6757 goto LABEL_11; |
6758 v16 = v1->pQueue; | 6758 v16 = v1->pQueue; |
6759 while ( 1 ) | 6759 while ( 1 ) |
6760 { | 6760 { |
6761 v5 = v16->uPackedID; | 6761 v5 = v16->uPackedID; |
6762 if ( (v16->uPackedID & 7) == OBJECT_Player) | 6762 if ( PID_TYPE(v16->uPackedID) == OBJECT_Player) |
6763 break; | 6763 break; |
6764 LABEL_8: | 6764 LABEL_8: |
6765 ++v17; | 6765 ++v17; |
6766 ++v16; | 6766 ++v16; |
6767 if ( v17 >= v1->uActorQueueSize ) | 6767 if ( v17 >= v1->uActorQueueSize ) |
6768 goto LABEL_11; | 6768 goto LABEL_11; |
6769 } | 6769 } |
6770 v15 = v5 >> 3; | 6770 v15 = PID_ID(v5); |
6771 if ( !pPlayers[(v5 >> 3) + 1]->CanAct() || v19 != v15 ) | 6771 if ( !pPlayers[(PID_ID(v5)) + 1]->CanAct() || v19 != v15 ) |
6772 { | 6772 { |
6773 v2 = 0; | 6773 v2 = 0; |
6774 goto LABEL_8; | 6774 goto LABEL_8; |
6775 } | 6775 } |
6776 v2 = 0; | 6776 v2 = 0; |
6800 if ( v1->uActorQueueSize > v2 ) | 6800 if ( v1->uActorQueueSize > v2 ) |
6801 { | 6801 { |
6802 v8 = v1->pQueue; | 6802 v8 = v1->pQueue; |
6803 do | 6803 do |
6804 { | 6804 { |
6805 if ( (v8->uPackedID & 7) == OBJECT_Actor && ai_near_actors_ids[v20] == v8->uPackedID >> 3 ) | 6805 if ( PID_TYPE(v8->uPackedID) == OBJECT_Actor && ai_near_actors_ids[v20] == PID_ID(v8->uPackedID) ) |
6806 break; | 6806 break; |
6807 ++v18; | 6807 ++v18; |
6808 ++v8; | 6808 ++v8; |
6809 } | 6809 } |
6810 while ( v18 < v1->uActorQueueSize ); | 6810 while ( v18 < v1->uActorQueueSize ); |
6844 if ( v1->uActorQueueSize > 0 ) | 6844 if ( v1->uActorQueueSize > 0 ) |
6845 { | 6845 { |
6846 v13 = (char *)&v1->pQueue[0].field_4; | 6846 v13 = (char *)&v1->pQueue[0].field_4; |
6847 do | 6847 do |
6848 { | 6848 { |
6849 v11 = *((int *)v13 - 1) & 7; | 6849 v11 = PID_TYPE(*((int *)v13 - 1)); |
6850 if ( (char)v11 == 4 ) | 6850 if ( (char)v11 == 4 ) |
6851 break; | 6851 break; |
6852 if ( *(int *)v13 > 0 ) | 6852 if ( *(int *)v13 > 0 ) |
6853 break; | 6853 break; |
6854 LOWORD(v11) = v1->_40680F(v12++); | 6854 LOWORD(v11) = v1->_40680F(v12++); |
6934 else | 6934 else |
6935 { | 6935 { |
6936 if ( v6 != 8 ) | 6936 if ( v6 != 8 ) |
6937 goto LABEL_19; | 6937 goto LABEL_19; |
6938 v3 = 0; | 6938 v3 = 0; |
6939 Actor::AI_StandOrBored(v2->uPackedID >> 3, ai_near_actors_targets_pid[v2->uPackedID >> 3], 32, 0); | 6939 Actor::AI_StandOrBored(PID_ID(v2->uPackedID), ai_near_actors_targets_pid[PID_ID(v2->uPackedID)], 32, 0); |
6940 } | 6940 } |
6941 } | 6941 } |
6942 } | 6942 } |
6943 LABEL_20: | 6943 LABEL_20: |
6944 ++v4; | 6944 ++v4; |
7037 LABEL_24: | 7037 LABEL_24: |
7038 result = 1; | 7038 result = 1; |
7039 } | 7039 } |
7040 else | 7040 else |
7041 { | 7041 { |
7042 v8 = &pActors[v1->pQueue[0].uPackedID >> 3]; | 7042 v8 = &pActors[PID_ID(v1->pQueue[0].uPackedID)]; |
7043 if ( v4 > 0 ) | 7043 if ( v4 > 0 ) |
7044 { | 7044 { |
7045 do | 7045 do |
7046 { | 7046 { |
7047 v9 = v8->uAIState; | 7047 v9 = v8->uAIState; |
7089 int v9; // ecx@14 | 7089 int v9; // ecx@14 |
7090 char v10; // zf@15 | 7090 char v10; // zf@15 |
7091 | 7091 |
7092 v2 = this; | 7092 v2 = this; |
7093 v3 = *(&this->field_0 + 4 * (a2 + 2)); | 7093 v3 = *(&this->field_0 + 4 * (a2 + 2)); |
7094 if ( (*((char *)&this->field_0 + 16 * (a2 + 2)) & 7) == OBJECT_Player) | 7094 if ( (*((char *)&this->field_0 + 16 * PID_TYPE(a2 + 2))) == OBJECT_Player) |
7095 { | 7095 { |
7096 v4 = v3 >> 3; | 7096 v4 = PID_ID(v3); |
7097 v5 = (char *)&pParty->pTurnBasedPlayerRecoveryTimes[v3 >> 3]; | 7097 v5 = (char *)&pParty->pTurnBasedPlayerRecoveryTimes[PID_ID(v3)]; |
7098 v6 = *(int *)v5; | 7098 v6 = *(int *)v5; |
7099 if ( *(int *)v5 ) | 7099 if ( *(int *)v5 ) |
7100 *(int *)v5 = 0; | 7100 *(int *)v5 = 0; |
7101 else | 7101 else |
7102 v6 = pPlayers[v4 + 1]->GetAttackRecoveryTime(0); | 7102 v6 = pPlayers[v4 + 1]->GetAttackRecoveryTime(0); |
7103 if ( v6 < 30 ) | 7103 if ( v6 < 30 ) |
7104 v6 = 30; | 7104 v6 = 30; |
7105 } | 7105 } |
7106 else | 7106 else |
7107 { | 7107 { |
7108 v6 = pMonsterStats->pInfos[pActors[v3 >> 3].pMonsterInfo.uID].uRecoveryTime; | 7108 v6 = pMonsterStats->pInfos[pActors[PID_ID(v3)].pMonsterInfo.uID].uRecoveryTime; |
7109 } | 7109 } |
7110 v2->pQueue[a2].field_4 = v6; | 7110 v2->pQueue[a2].field_4 = v6; |
7111 v2->_404544(); | 7111 v2->_404544(); |
7112 if (PID_TYPE(v2->pQueue[0].uPackedID) == OBJECT_Player) | 7112 if (PID_TYPE(v2->pQueue[0].uPackedID) == OBJECT_Player) |
7113 uActiveCharacter = PID_ID(v2->pQueue[0].uPackedID) + 1; | 7113 uActiveCharacter = PID_ID(v2->pQueue[0].uPackedID) + 1; |
7141 } | 7141 } |
7142 | 7142 |
7143 //----- (0040652A) -------------------------------------------------------- | 7143 //----- (0040652A) -------------------------------------------------------- |
7144 void stru262_TurnBased::_40652A() | 7144 void stru262_TurnBased::_40652A() |
7145 { | 7145 { |
7146 char *v1; // edx@2 | 7146 int *v1; // edx@2 |
7147 Actor *v2; // eax@5 | 7147 Actor *v2; // eax@5 |
7148 unsigned __int16 v3; // si@5 | 7148 unsigned __int16 v3; // si@5 |
7149 unsigned int v4; // esi@8 | 7149 unsigned int v4; // esi@8 |
7150 int v5; // [sp+Ch] [bp-4h]@1 | 7150 int v5; // [sp+Ch] [bp-4h]@1 |
7151 | 7151 |
7152 v5 = 0; | 7152 v5 = 0; |
7153 if ( this->uActorQueueSize > 0 ) | 7153 if ( this->uActorQueueSize > 0 ) |
7154 { | 7154 { |
7155 v1 = (char *)&this->pQueue[0].field_4; | 7155 v1 = &this->pQueue[0].field_4; |
7156 do | 7156 do |
7157 { | 7157 { |
7158 if ( !*(int *)v1 ) | 7158 if ( !*(int *)v1 ) |
7159 { | 7159 { |
7160 if ( (*(v1 - 4) & 7) == OBJECT_Player) | 7160 if ( PID_TYPE(*(v1 - 4)) == OBJECT_Player) |
7161 return; | 7161 return; |
7162 v2 = &pActors[*((int *)v1 - 1) >> 3]; | 7162 v2 = &pActors[PID_ID(*(v1 - 1))]; |
7163 v3 = v2->uAIState; | 7163 v3 = v2->uAIState; |
7164 if (v3 == Standing || v3 == Fleeing || v3 == Fidgeting) | 7164 if (v3 == Standing || v3 == Fleeing || v3 == Fidgeting) |
7165 { | 7165 { |
7166 v4 = pMonsterStats->pInfos[v2->pMonsterInfo.uID].uRecoveryTime; | 7166 v4 = pMonsterStats->pInfos[v2->pMonsterInfo.uID].uRecoveryTime; |
7167 *(int *)v1 = v4; | 7167 *(int *)v1 = v4; |
7186 unsigned int v5; // edi@14 | 7186 unsigned int v5; // edi@14 |
7187 | 7187 |
7188 v1 = this; | 7188 v1 = this; |
7189 LOWORD(v2) = _404544(); | 7189 LOWORD(v2) = _404544(); |
7190 if ( v1->pQueue[0].field_4 <= 0 | 7190 if ( v1->pQueue[0].field_4 <= 0 |
7191 || ((_4063A1(), v2 = v1->pQueue[0].uPackedID, PID_TYPE(v1->pQueue[0].uPackedID) != OBJECT_Player) ? (uActiveCharacter = 0) : (v2 = (v2 >> 3) + 1, uActiveCharacter = v2), | 7191 || ((_4063A1(), v2 = v1->pQueue[0].uPackedID, PID_TYPE(v1->pQueue[0].uPackedID) != OBJECT_Player) ? (uActiveCharacter = 0) : (v2 = (PID_ID(v2)) + 1, uActiveCharacter = v2), |
7192 viewparams->bRedrawGameUI = 1, | 7192 viewparams->bRedrawGameUI = 1, |
7193 v1->pQueue[0].field_4 <= 0) ) | 7193 v1->pQueue[0].field_4 <= 0) ) |
7194 { | 7194 { |
7195 v3 = 0; | 7195 v3 = 0; |
7196 if ( v1->uActorQueueSize > 0 ) | 7196 if ( v1->uActorQueueSize > 0 ) |
7197 { | 7197 { |
7198 v4 = (int)v1->pQueue; | 7198 v4 = (int)v1->pQueue; |
7199 do | 7199 do |
7200 { | 7200 { |
7201 v2 = *(int *)v4; | 7201 v2 = *(int *)v4; |
7202 if ( (*(char *)v4 & 7) == OBJECT_Player || *(int *)(v4 + 4) > 0 ) | 7202 if ( PID_TYPE(*(char *)v4) == OBJECT_Player || *(int *)(v4 + 4) > 0 ) |
7203 break; | 7203 break; |
7204 if ( *(int *)(v4 + 8) <= 0 ) | 7204 if ( *(int *)(v4 + 8) <= 0 ) |
7205 { | 7205 { |
7206 LOWORD(v2) = v2 & 3; | 7206 LOWORD(v2) = v2 & 3; |
7207 if ( (char)v2 == 3 ) | 7207 if ( (char)v2 == 3 ) |
7260 { | 7260 { |
7261 v4 = PID_ID(v3); | 7261 v4 = PID_ID(v3); |
7262 a2a = ai_near_actors_targets_pid[PID_ID(v3)]; | 7262 a2a = ai_near_actors_targets_pid[PID_ID(v3)]; |
7263 memcpy(&a3, Actor::GetDirectionInfo(v1->uPackedID, ai_near_actors_targets_pid[PID_ID(v3)], &a3, 0), sizeof(a3)); | 7263 memcpy(&a3, Actor::GetDirectionInfo(v1->uPackedID, ai_near_actors_targets_pid[PID_ID(v3)], &a3, 0), sizeof(a3)); |
7264 memcpy(&a4, &a3, sizeof(a4)); | 7264 memcpy(&a4, &a3, sizeof(a4)); |
7265 v5 = &pActors[PID_ID(v3 >> 3)]; | 7265 v5 = &pActors[PID_ID(v3)]; |
7266 LOWORD(v3) = v5->uAIState; | 7266 LOWORD(v3) = v5->uAIState; |
7267 if ( (short)v3 != Dead ) | 7267 if ( (short)v3 != Dead ) |
7268 { | 7268 { |
7269 if ( (short)v3 != Disabled ) | 7269 if ( (short)v3 != Disabled ) |
7270 { | 7270 { |
7367 | 7367 |
7368 //----- (0040680F) -------------------------------------------------------- | 7368 //----- (0040680F) -------------------------------------------------------- |
7369 __int16 stru262_TurnBased::_40680F(int a2) | 7369 __int16 stru262_TurnBased::_40680F(int a2) |
7370 { | 7370 { |
7371 TurnBased_QueueElem *v2; // eax@1 | 7371 TurnBased_QueueElem *v2; // eax@1 |
7372 TurnBased_QueueElem *v3; // eax@1 | 7372 unsigned int v3; // eax@1 |
7373 TurnBased_QueueElem *v4; // edi@2 | 7373 unsigned int v4; // edi@2 |
7374 Actor *v5; // ebx@2 | 7374 Actor *v5; // ebx@2 |
7375 unsigned int *v6; // esi@7 | 7375 unsigned int *v6; // esi@7 |
7376 AIDirection *v7; // esi@10 | 7376 AIDirection *v7; // esi@10 |
7377 int v8; // eax@10 | 7377 int v8; // eax@10 |
7378 unsigned int v9; // ecx@10 | 7378 unsigned int v9; // ecx@10 |
7390 signed int v22; // [sp+58h] [bp+8h]@10 | 7390 signed int v22; // [sp+58h] [bp+8h]@10 |
7391 | 7391 |
7392 v2 = (TurnBased_QueueElem *)((char *)this + 16 * (a2 + 2)); | 7392 v2 = (TurnBased_QueueElem *)((char *)this + 16 * (a2 + 2)); |
7393 v21 = v2; | 7393 v21 = v2; |
7394 v2->uActionLength = 0; | 7394 v2->uActionLength = 0; |
7395 v3 = (TurnBased_QueueElem *)v2->uPackedID; | 7395 v3 = v2->uPackedID; |
7396 if ( (unsigned __int8)v3 & 3 ) | 7396 if ( (unsigned __int8)v3 & 3 ) |
7397 { | 7397 { |
7398 v3 = (TurnBased_QueueElem *)((signed int)v3 >> 3); | 7398 v3 = PID_ID(v3); |
7399 v4 = v3; | 7399 v4 = v3; |
7400 a2a = (int)v3; | 7400 a2a = v3; |
7401 v5 = &pActors[(int)v3]; | 7401 v5 = &pActors[v3]; |
7402 LOWORD(v3) = v5->uAIState; | 7402 LOWORD(v3) = v5->uAIState; |
7403 if ( (short)v3 != 5 ) | 7403 if ( (short)v3 != 5 ) |
7404 { | 7404 { |
7405 if ( (short)v3 != 4 && (short)v3 != 11 && (short)v3 != 19 && (short)v3 != 17 ) | 7405 if ( (short)v3 != 4 && (short)v3 != 11 && (short)v3 != 19 && (short)v3 != 17 ) |
7406 { | 7406 { |
7419 { | 7419 { |
7420 v9 = 0; | 7420 v9 = 0; |
7421 v20 = 0; | 7421 v20 = 0; |
7422 } | 7422 } |
7423 if (PID_TYPE(v22) == OBJECT_Actor) | 7423 if (PID_TYPE(v22) == OBJECT_Actor) |
7424 v10 = (unsigned __int8)*(&byte_5C8D1A[89 * (pMonsterStats->pInfos[pActors[v22 >> 3].pMonsterInfo.uID].uID - 1) / 3] + (v5->pMonsterInfo.uID - 1) / 3); | 7424 v10 = (unsigned __int8)*(&byte_5C8D1A[89 * (pMonsterStats->pInfos[pActors[PID_ID(v22)].pMonsterInfo.uID].uID - 1) / 3] + (v5->pMonsterInfo.uID - 1) / 3); |
7425 else | 7425 else |
7426 v10 = 4; | 7426 v10 = 4; |
7427 if ( v10 == 1 ) | 7427 if ( v10 == 1 ) |
7428 { | 7428 { |
7429 if ( (double)(signed int)v20 < 307.2 ) | 7429 if ( (double)(signed int)v20 < 307.2 ) |
7494 } | 7494 } |
7495 if ( v5->pMonsterInfo.uMissleAttack1Type ) | 7495 if ( v5->pMonsterInfo.uMissleAttack1Type ) |
7496 { | 7496 { |
7497 Actor::_403476(v13, v22, &v18); | 7497 Actor::_403476(v13, v22, &v18); |
7498 LABEL_43: | 7498 LABEL_43: |
7499 v3 = v21; | 7499 //v3 = v21; |
7500 v21->field_C = 1; | 7500 v21->field_C = 1; |
7501 LABEL_48: | 7501 LABEL_48: |
7502 v3->uActionLength = v5->uCurrentActionLength; | 7502 v21->uActionLength = v5->uCurrentActionLength; |
7503 return (signed __int16)v3; | 7503 //return (signed __int16)v3; |
7504 return (signed __int16)&v21; | |
7504 } | 7505 } |
7505 } | 7506 } |
7506 LABEL_44: | 7507 LABEL_44: |
7507 if ( (double)(signed int)v20 < 307.2 ) | 7508 if ( (double)(signed int)v20 < 307.2 ) |
7508 { | 7509 { |
7509 Actor::_403C6C(v13, v22, &v18); | 7510 Actor::_403C6C(v13, v22, &v18); |
7510 v3 = v21; | 7511 //v3 = v21; |
7511 v21->field_C = 3; | 7512 v21->field_C = 3; |
7512 goto LABEL_48; | 7513 goto LABEL_48; |
7513 } | 7514 } |
7514 LABEL_47: | 7515 LABEL_47: |
7515 Actor::AI_Stand(v13, v22, 0x40u, &v18); | 7516 Actor::AI_Stand(v13, v22, 0x40u, &v18); |
7516 v3 = v21; | 7517 //v3 = v21; |
7517 v21->field_C = 0; | 7518 v21->field_C = 0; |
7518 goto LABEL_48; | 7519 goto LABEL_48; |
7519 } | 7520 } |
7520 } | 7521 } |
7521 } | 7522 } |
7553 if (PID_TYPE(v10->uPackedID) == OBJECT_Actor) | 7554 if (PID_TYPE(v10->uPackedID) == OBJECT_Actor) |
7554 { | 7555 { |
7555 v8 = ai_near_actors_targets_pid[PID_ID(v5)]; | 7556 v8 = ai_near_actors_targets_pid[PID_ID(v5)]; |
7556 memcpy(&v7, Actor::GetDirectionInfo(v5, v8, &a3, v2), sizeof(v7)); | 7557 memcpy(&v7, Actor::GetDirectionInfo(v5, v8, &a3, v2), sizeof(v7)); |
7557 if ( !v1->_406D10(a2) ) | 7558 if ( !v1->_406D10(a2) ) |
7558 Actor::AI_Stand(v10->uPackedID >> 3, v8, 0x20u, &v7); | 7559 Actor::AI_Stand(PID_ID(v10->uPackedID), v8, 0x20u, &v7); |
7559 } | 7560 } |
7560 ++a2; | 7561 ++a2; |
7561 ++v10; | 7562 ++v10; |
7562 if ( a2 >= v1->uActorQueueSize ) | 7563 if ( a2 >= v1->uActorQueueSize ) |
7563 break; | 7564 break; |
7644 { | 7645 { |
7645 v4 = v14->uPackedID; | 7646 v4 = v14->uPackedID; |
7646 a1 = v14->uPackedID; | 7647 a1 = v14->uPackedID; |
7647 if (PID_TYPE(a1) != OBJECT_Player) | 7648 if (PID_TYPE(a1) != OBJECT_Player) |
7648 { | 7649 { |
7649 v5 = v4 >> 3; | 7650 v5 = PID_ID(v4); |
7650 v12 = v5; | 7651 v12 = v5; |
7651 v6 = &pActors[v5]; | 7652 v6 = &pActors[v5]; |
7652 if ( SHIDWORD(v6->pActorBuffs[5].uExpireTime) < result | 7653 if ( SHIDWORD(v6->pActorBuffs[5].uExpireTime) < result |
7653 || SHIDWORD(v6->pActorBuffs[5].uExpireTime) <= result && LODWORD(v6->pActorBuffs[5].uExpireTime) <= result ) | 7654 || SHIDWORD(v6->pActorBuffs[5].uExpireTime) <= result && LODWORD(v6->pActorBuffs[5].uExpireTime) <= result ) |
7654 v13 = result; | 7655 v13 = result; |
8040 int v63; // [sp+58h] [bp-10h]@4 | 8041 int v63; // [sp+58h] [bp-10h]@4 |
8041 int v64; // [sp+5Ch] [bp-Ch]@4 | 8042 int v64; // [sp+5Ch] [bp-Ch]@4 |
8042 int v65; // [sp+60h] [bp-8h]@4 | 8043 int v65; // [sp+60h] [bp-8h]@4 |
8043 int v66; // [sp+64h] [bp-4h]@7 | 8044 int v66; // [sp+64h] [bp-4h]@7 |
8044 | 8045 |
8045 v2 = (signed int)uObjID >> 3; | 8046 v2 = PID_ID(uObjID); |
8046 v3 = (uObjID & 7) - 2; | 8047 v3 = PID_TYPE(uObjID) - 2; |
8047 v4 = uObj2ID; | 8048 v4 = uObj2ID; |
8048 if ( v3 ) | 8049 if ( v3 ) |
8049 { | 8050 { |
8050 v5 = v3 - 1; | 8051 v5 = v3 - 1; |
8051 if ( v5 ) | 8052 if ( v5 ) |
8076 v11 = pSpriteObjects[v10].vPosition.z; | 8077 v11 = pSpriteObjects[v10].vPosition.z; |
8077 v7 = pSpriteObjects[v10].uSectorID; | 8078 v7 = pSpriteObjects[v10].uSectorID; |
8078 v65 = v11; | 8079 v65 = v11; |
8079 } | 8080 } |
8080 v66 = v7; | 8081 v66 = v7; |
8081 v12 = v4 >> 3; | 8082 v12 = PID_ID(v4); |
8082 v13 = (v4 & 7) - 2; | 8083 v13 = PID_TYPE(v4) - 2; |
8083 if ( v13 ) | 8084 if ( v13 ) |
8084 { | 8085 { |
8085 v14 = v13 - 1; | 8086 v14 = v13 - 1; |
8086 if ( v14 ) | 8087 if ( v14 ) |
8087 { | 8088 { |