comparison mm7_6.cpp @ 816:cfc65feef029

* Player Recovery Times * Player Attack fixes * Debug log to timers
author Nomad
date Tue, 26 Mar 2013 12:40:27 +0200
parents f5156b8c61ad
children 9359c114f98c
comparison
equal deleted inserted replaced
813:d37b03507b3b 816:cfc65feef029
3372 case SPELL_BOW_ARROW: 3372 case SPELL_BOW_ARROW:
3373 v17 = pPlayer; 3373 v17 = pPlayer;
3374 _this = (ItemGen *)1; 3374 _this = (ItemGen *)1;
3375 if ( (signed int)SkillToMastery(pPlayer->pActiveSkills[PLAYER_SKILL_BOW]) >= 3 ) 3375 if ( (signed int)SkillToMastery(pPlayer->pActiveSkills[PLAYER_SKILL_BOW]) >= 3 )
3376 _this = (ItemGen *)2; 3376 _this = (ItemGen *)2;
3377 sRecoveryTime = v17->GetAttackRecoveryTime(1); 3377 sRecoveryTime = v17->GetAttackRecoveryTime(true);
3378 a1.stru_24.Reset(); 3378 a1.stru_24.Reset();
3379 v18 = v3->spellnum; 3379 v18 = v3->spellnum;
3380 a1.field_4C = v2; 3380 a1.field_4C = v2;
3381 a1.field_48 = v18; 3381 a1.field_48 = v18;
3382 a1.field_50 = v731; 3382 a1.field_50 = v731;
7751 actor_distance = 0; 7751 actor_distance = 0;
7752 } 7752 }
7753 7753
7754 bool shooting_bow = false, 7754 bool shooting_bow = false,
7755 shotting_laser = false, 7755 shotting_laser = false,
7756 shooting_wand = false; 7756 shooting_wand = false,
7757 melee_attack = false;
7757 if (laser_weapon_item_id) 7758 if (laser_weapon_item_id)
7758 { 7759 {
7759 shotting_laser = true; 7760 shotting_laser = true;
7760 _42777D_CastSpell_UseWand_ShootArrow(SPELL_LASER_PROJECTILE, uActiveCharacter - 1, 0, 0, uActiveCharacter + 8); 7761 _42777D_CastSpell_UseWand_ShootArrow(SPELL_LASER_PROJECTILE, uActiveCharacter - 1, 0, 0, uActiveCharacter + 8);
7761 } 7762 }
7769 if (!--player->pInventoryItems[main_hand_idx - 1].uNumCharges) 7770 if (!--player->pInventoryItems[main_hand_idx - 1].uNumCharges)
7770 player->pEquipment.uMainHand = 0; 7771 player->pEquipment.uMainHand = 0;
7771 } 7772 }
7772 else if (target_type == OBJECT_Actor && actor_distance <= 407.2) 7773 else if (target_type == OBJECT_Actor && actor_distance <= 407.2)
7773 { 7774 {
7775 melee_attack = true;
7776
7774 Vec3_int_ a3; 7777 Vec3_int_ a3;
7775 a3.x = actor->vPosition.x - pParty->vPosition.x; 7778 a3.x = actor->vPosition.x - pParty->vPosition.x;
7776 a3.y = actor->vPosition.y - pParty->vPosition.y; 7779 a3.y = actor->vPosition.y - pParty->vPosition.y;
7777 a3.z = actor->vPosition.z - pParty->vPosition.z; 7780 a3.z = actor->vPosition.z - pParty->vPosition.z;
7778 Vec3_int_::Normalize(&a3.x, &a3.y, &a3.z); 7781 Vec3_int_::Normalize(&a3.x, &a3.y, &a3.z);
7790 shooting_bow = true; 7793 shooting_bow = true;
7791 _42777D_CastSpell_UseWand_ShootArrow(SPELL_BOW_ARROW, uActiveCharacter - 1, 0, 0, 0); 7794 _42777D_CastSpell_UseWand_ShootArrow(SPELL_BOW_ARROW, uActiveCharacter - 1, 0, 0, 0);
7792 } 7795 }
7793 else 7796 else
7794 { 7797 {
7798 melee_attack = true;
7795 ; // actor out of range or no actor; no ranged weapon so melee attacking air 7799 ; // actor out of range or no actor; no ranged weapon so melee attacking air
7796 } 7800 }
7797 7801
7798 if (!pParty->bTurnBasedModeOn) 7802 if (!pParty->bTurnBasedModeOn && melee_attack) // wands, bows & lasers will add recovery while shooting spell effect
7799 { 7803 {
7800 int recovery = player->GetAttackRecoveryTime(0); 7804 int recovery = player->GetAttackRecoveryTime(false);
7801 if (recovery < 30 ) 7805 if (recovery < 30 )
7802 recovery = 30; 7806 recovery = 30;
7803 player->SetRecoveryTime((signed __int64)(flt_6BE3A4_debug_recmod1 * (double)recovery * 2.133333333333333)); 7807 player->SetRecoveryTime(flt_6BE3A4_debug_recmod1 * (double)recovery * 2.133333333333333);
7804 } 7808 }
7805 7809
7806 7810
7807 int v34 = 0; 7811 int v34 = 0;
7808 if (shooting_wand) 7812 if (shooting_wand)
7815 if (shotting_laser) 7819 if (shotting_laser)
7816 v34 = 7; 7820 v34 = 7;
7817 else 7821 else
7818 { 7822 {
7819 int main_hand_idx = player->pEquipment.uMainHand; 7823 int main_hand_idx = player->pEquipment.uMainHand;
7820 if (player->HasItemEquipped(EQUIP_TWO_HANDED)) 7824 if (player->HasItemEquipped(EQUIP_MAIN_HAND))
7821 v34 = pItemsTable->pItems[*(int *)&player->pInventoryItems[main_hand_idx - 1]].uSkillType; 7825 v34 = pItemsTable->pItems[*(int *)&player->pInventoryItems[main_hand_idx - 1]].uSkillType;
7822 pTurnEngine->_40471C(); 7826 pTurnEngine->_40471C();
7823 } 7827 }
7824 7828
7825 switch (v34) 7829 switch (v34)
8693 if ( uActiveCharacter ) 8697 if ( uActiveCharacter )
8694 { 8698 {
8695 v6 = pPlayers[uActiveCharacter]; 8699 v6 = pPlayers[uActiveCharacter];
8696 if ( !v6->uTimeToRecovery ) 8700 if ( !v6->uTimeToRecovery )
8697 { 8701 {
8698 v24 = v6->GetAttackRecoveryTime(0); 8702 v24 = v6->GetAttackRecoveryTime(false);
8699 if ( !pParty->bTurnBasedModeOn ) 8703 if ( !pParty->bTurnBasedModeOn )
8700 pPlayers[uActiveCharacter]->SetRecoveryTime( 8704 pPlayers[uActiveCharacter]->SetRecoveryTime(
8701 (signed __int64)(flt_6BE3A4_debug_recmod1 * (double)v24 * 2.133333333333333)); 8705 (signed __int64)(flt_6BE3A4_debug_recmod1 * (double)v24 * 2.133333333333333));
8702 pStru277->_427D48(uActiveCharacter); 8706 pStru277->_427D48(uActiveCharacter);
8703 pTurnEngine->_40471C(); 8707 pTurnEngine->_40471C();