Mercurial > mm7
comparison Player.cpp @ 1759:845a6503f55c
fixing some itemarray zero accesses
author | Grumpy7 |
---|---|
date | Tue, 01 Oct 2013 06:17:32 +0200 |
parents | cecb080929c4 |
children | a2ea57410b15 |
comparison
equal
deleted
inserted
replaced
1749:42a1874a2171 | 1759:845a6503f55c |
---|---|
2562 | 2562 |
2563 //----- (0048E1B5) -------------------------------------------------------- | 2563 //----- (0048E1B5) -------------------------------------------------------- |
2564 int Player::GetAttackRecoveryTime(bool bRangedAttack) | 2564 int Player::GetAttackRecoveryTime(bool bRangedAttack) |
2565 { | 2565 { |
2566 ItemGen *weapon = nullptr; | 2566 ItemGen *weapon = nullptr; |
2567 ItemDesc *weapon_desc = nullptr; | |
2568 uint weapon_recovery = base_recovery_times_per_weapon_type[0]; | 2567 uint weapon_recovery = base_recovery_times_per_weapon_type[0]; |
2569 if (bRangedAttack) | 2568 if (bRangedAttack) |
2570 { | 2569 { |
2571 if ( HasItemEquipped(EQUIP_BOW) ) | 2570 if ( HasItemEquipped(EQUIP_BOW) ) |
2572 { | 2571 { |
2645 { | 2644 { |
2646 if (GetActualSkillLevel((PLAYER_SKILL_TYPE)weapon->GetPlayerSkillType()) && | 2645 if (GetActualSkillLevel((PLAYER_SKILL_TYPE)weapon->GetPlayerSkillType()) && |
2647 (weapon->GetPlayerSkillType() == PLAYER_SKILL_SWORD || weapon->GetPlayerSkillType() == PLAYER_SKILL_AXE || weapon->GetPlayerSkillType() == PLAYER_SKILL_BOW) ) | 2646 (weapon->GetPlayerSkillType() == PLAYER_SKILL_SWORD || weapon->GetPlayerSkillType() == PLAYER_SKILL_AXE || weapon->GetPlayerSkillType() == PLAYER_SKILL_BOW) ) |
2648 { | 2647 { |
2649 if (SkillToMastery(pActiveSkills[weapon->GetPlayerSkillType()]) >= 2 ) // Expert Sword, Axe & Bow reduce recovery | 2648 if (SkillToMastery(pActiveSkills[weapon->GetPlayerSkillType()]) >= 2 ) // Expert Sword, Axe & Bow reduce recovery |
2650 sword_axe_bow_recovery_reduction = pActiveSkills[weapon_desc->uSkillType] & 0x3F; | 2649 sword_axe_bow_recovery_reduction = pActiveSkills[weapon->GetPlayerSkillType()] & 0x3F; |
2651 } | 2650 } |
2652 if (weapon_desc->uSkillType == PLAYER_SKILL_BLASTER) | 2651 if (weapon->GetPlayerSkillType() == PLAYER_SKILL_BLASTER) |
2653 shooting_laser = true; | 2652 shooting_laser = true; |
2654 } | 2653 } |
2655 | 2654 |
2656 uint armsmaster_recovery_reduction = 0; | 2655 uint armsmaster_recovery_reduction = 0; |
2657 if (!bRangedAttack && !shooting_laser) | 2656 if (!bRangedAttack && !shooting_laser) |
5513 } | 5512 } |
5514 if ( var_type <= VAR_ReputationInCurrentLocation | 5513 if ( var_type <= VAR_ReputationInCurrentLocation |
5515 || var_type > VAR_History_28 | 5514 || var_type > VAR_History_28 |
5516 || (v22 = var_type - VAR_History_0, pParty->PartyTimes.HistoryEventTimes[v22]) | 5515 || (v22 = var_type - VAR_History_0, pParty->PartyTimes.HistoryEventTimes[v22]) |
5517 || (pParty->PartyTimes.HistoryEventTimes[v22] = pParty->uTimePlayed, | 5516 || (pParty->PartyTimes.HistoryEventTimes[v22] = pParty->uTimePlayed, |
5518 v23 = pStorylineText->StoreLine[v22].pText == 0,//*(&pStorylineText->field_0 + 3 * v22) == 0, | 5517 pStorylineText->StoreLine[v22].pText == 0) )//*(&pStorylineText->field_0 + 3 * v22) == 0, |
5519 v23) ) | |
5520 return; | 5518 return; |
5521 bFlashHistoryBook = 1; | 5519 bFlashHistoryBook = 1; |
5522 } | 5520 } |
5523 v25 = 8 * currPlayerId + 400; | 5521 v25 = 8 * currPlayerId + 400; |
5524 LOBYTE(v25) = PID(OBJECT_Player,currPlayerId - 112); | 5522 LOBYTE(v25) = PID(OBJECT_Player,currPlayerId - 112); |
5577 goto LABEL_124; | 5575 goto LABEL_124; |
5578 case VAR_Class: | 5576 case VAR_Class: |
5579 this->classType = (PLAYER_CLASS_TYPE)var_value; | 5577 this->classType = (PLAYER_CLASS_TYPE)var_value; |
5580 if ( (char)var_value == PLAYER_CLASS_LICH ) | 5578 if ( (char)var_value == PLAYER_CLASS_LICH ) |
5581 { | 5579 { |
5582 v9 = NULL; | |
5583 for (int i = 0; i < 138; i++) | 5580 for (int i = 0; i < 138; i++) |
5584 { | 5581 { |
5585 v9 = &this->pInventoryItemList[i]; | 5582 v9 = &this->pInventoryItemList[i]; |
5586 if (v9->uItemID == ITEM_LICH_JAR_EMPTY) | 5583 if (v9->uItemID == ITEM_LICH_JAR_EMPTY) |
5584 { | |
5585 v9->uItemID = ITEM_LICH_JAR_FULL; | |
5586 v9->uHolderPlayer = currPlayerId + 1; | |
5587 v10 = (int)((char *)this + 36 * 138); | |
5588 *(int *)(v10 + 532) = 601; | |
5589 *(char *)(v10 + 558) = currPlayerId + 1; | |
5587 break; | 5590 break; |
5588 } | 5591 } |
5589 if (v9 != NULL && v9->uItemID != ITEM_LICH_JAR_EMPTY) | |
5590 { | |
5591 v10 = (int)((char *)this + 36 * 138); //originally 36 * v8. the code got to this condition only if v8 was equal to 138 | |
5592 *(int *)(v10 + 532) = 601; | |
5593 *(char *)(v10 + 558) = currPlayerId + 1; | |
5594 } | 5592 } |
5595 if ( this->sResFireBase < 20 ) | 5593 if ( this->sResFireBase < 20 ) |
5596 this->sResFireBase = 20; | 5594 this->sResFireBase = 20; |
5597 if ( this->sResAirBase < 20 ) | 5595 if ( this->sResAirBase < 20 ) |
5598 this->sResAirBase = 20; | 5596 this->sResAirBase = 20; |
5600 this->sResWaterBase = 20; | 5598 this->sResWaterBase = 20; |
5601 if ( this->sResEarthBase < 20 ) | 5599 if ( this->sResEarthBase < 20 ) |
5602 this->sResEarthBase = 20; | 5600 this->sResEarthBase = 20; |
5603 this->sResMindBase = 200; | 5601 this->sResMindBase = 200; |
5604 this->sResBodyBase = 200; | 5602 this->sResBodyBase = 200; |
5605 v11 = this->GetSexByVoice(); | |
5606 this->uPrevVoiceID = this->uVoiceID; | 5603 this->uPrevVoiceID = this->uVoiceID; |
5607 this->uPrevFace = this->uCurrentFace; | 5604 this->uPrevFace = this->uCurrentFace; |
5608 if ( v11 ) | 5605 if ( IsFemale() ) |
5609 { | 5606 { |
5610 this->uCurrentFace = 21; | 5607 this->uCurrentFace = 21; |
5611 this->uVoiceID = 21; | 5608 this->uVoiceID = 21; |
5612 } | 5609 } |
5613 else | 5610 else |
5855 } | 5852 } |
5856 else | 5853 else |
5857 { | 5854 { |
5858 v16 = (int)((char *)&this->pConditions[16] + 2 * var_type); | 5855 v16 = (int)((char *)&this->pConditions[16] + 2 * var_type); |
5859 v17 = *(char *)v16; | 5856 v17 = *(char *)v16; |
5860 if ( var_value <= VAR_BodyResistanceBonus ) | 5857 if ( var_value <= 63 ) |
5861 { | 5858 { |
5862 LOWORD(v15) = (unsigned __int8)var_value; | 5859 LOWORD(v15) = (unsigned __int8)var_value; |
5863 v18 = v15 | v17 & VAR_BodyResistanceBonus; | 5860 v18 = v15 | v17 & 63; |
5864 } | 5861 } |
5865 else | 5862 else |
5866 { | 5863 { |
5867 LOWORD(v18) = (unsigned __int8)(var_value | v17 & 0xC0); | 5864 LOWORD(v18) = (unsigned __int8)(var_value | v17 & 0xC0); |
5868 } | 5865 } |