Mercurial > mm7
changeset 1360:a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
author | Grumpy7 |
---|---|
date | Sat, 13 Jul 2013 21:36:35 +0200 |
parents | 60cdc3eac407 |
children | b3ac17fd12de |
files | Player.cpp |
diffstat | 1 files changed, 167 insertions(+), 205 deletions(-) [+] |
line wrap: on
line diff
--- a/Player.cpp Sat Jul 13 17:13:45 2013 +0200 +++ b/Player.cpp Sat Jul 13 21:36:35 2013 +0200 @@ -572,7 +572,7 @@ } else { - pSoundID = pSoundList->pSounds->uSoundID; + pSoundID = pSoundList->pSounds[0].uSoundID; v17 = 0; for (int i = 0; i < pSoundList->sNumSounds; i++) { @@ -697,233 +697,195 @@ default: return 1; break; } } + + //----- (00492D65) -------------------------------------------------------- int Player::SetCondition(unsigned int uConditionIdx, int a3) - { - - signed int player_sex; // ecx@77 - char zombi_face; // al@80 - signed int remainig_player; // ebx@82 - int players_before; // [sp+10h] [bp-4h]@2 - int players_after; // [sp+20h] [bp+Ch]@82 - - if ( pConditions[uConditionIdx] ) - return 0; - players_before = 0; - for (int i=1;i<5;++i) - if ( pPlayers[i]->CanAct() ) - ++players_before; - - switch ( uConditionIdx ) - { +{ + signed int player_sex; // ecx@77 + char zombi_face; // al@80 + signed int remainig_player; // ebx@82 + int players_before; // [sp+10h] [bp-4h]@2 + int players_after; // [sp+20h] [bp+Ch]@82 + + if ( pConditions[uConditionIdx] ) + return 0; + + players_before = 0; + + for (int i = 1; i < 5; ++i) + { + if ( pPlayers[i]->CanAct() ) + ++players_before; + } + + switch ( uConditionIdx ) + { case Condition_Cursed: - PlaySound((PlayerSpeech)30, 0); - break; + PlaySound((PlayerSpeech)30, 0); + break; case Condition_Weak: - if ( a3 == 1 && (signed __int64)pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].uExpireTime > 0 ) - {--pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].uPower; + if ( a3 == 1 && (signed __int64)pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].uExpireTime > 0 ) + { + --pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].uPower; if ( pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].uPower < 1u ) - pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].Reset(); + pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].Reset(); return 0; - } - - PlaySound((PlayerSpeech)25, 0); - break; + } + PlaySound((PlayerSpeech)25, 0); + break; case Condition_Sleep: - if ( a3 == 1 &&(HasEnchantedItemEquipped(22)|| - WearsItem(ITEM_ARTIFACT_YORUBA, EQUIP_ARMOUR))) - return 0; - break; + if ( a3 == 1 && (HasEnchantedItemEquipped(22) || WearsItem(ITEM_ARTIFACT_YORUBA, EQUIP_ARMOUR))) + return 0; + break; case Condition_Fear: - PlaySound((PlayerSpeech)26, 0); - break; + PlaySound((PlayerSpeech)26, 0); + break; case Condition_Drunk: - PlaySound((PlayerSpeech)31, 0); - break; - + PlaySound((PlayerSpeech)31, 0); + break; case Condition_Insane: - if ( a3 == 1 - && (HasEnchantedItemEquipped(19) || - WearsItem(ITEM_ARTIFACT_YORUBA, EQUIP_ARMOUR) || - WearsItem(ITEM_ARTIFACT_CLOAK_OF_THE_SHEEP, EQUIP_CLOAK)) ) - return 0; - - PlaySound((PlayerSpeech)29, 0); - break; + if ( a3 == 1 && (HasEnchantedItemEquipped(19) || WearsItem(ITEM_ARTIFACT_YORUBA, EQUIP_ARMOUR) || WearsItem(ITEM_ARTIFACT_CLOAK_OF_THE_SHEEP, EQUIP_CLOAK)) ) + return 0; + PlaySound((PlayerSpeech)29, 0); + break; case Condition_Poison1: case Condition_Poison2: case Condition_Poison3: - if ( a3 == 1 ) - { - if ( (signed __int64)pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].uExpireTime > 0i64 ) - { - --pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].uPower; - if ( pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].uPower < 1u ) - pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].Reset(); - } - if ( HasEnchantedItemEquipped(21) - || WearsItem(ITEM_ARTIFACT_YORUBA, EQUIP_ARMOUR) - || WearsItem(ITEM_ARTIFACT_CLOAK_OF_THE_SHEEP, EQUIP_CLOAK) ) - //goto LABEL_76; - return 0; - } - - //v23 = 27; - PlaySound((PlayerSpeech)27, 0); - break; - + if ( a3 == 1 ) + { + if ( (signed __int64)pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].uExpireTime > 0i64 ) + { + --pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].uPower; + if ( pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].uPower < 1u ) + pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].Reset(); + return 0; + } + if ( HasEnchantedItemEquipped(21) || WearsItem(ITEM_ARTIFACT_YORUBA, EQUIP_ARMOUR) || WearsItem(ITEM_ARTIFACT_CLOAK_OF_THE_SHEEP, EQUIP_CLOAK) ) + return 0; + } + PlaySound((PlayerSpeech)27, 0); + break; case Condition_Disease1: case Condition_Disease2: case Condition_Disease3: - if ( a3 == 1 ) - { - if ( pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].uExpireTime > 0i64 ) - { - --pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].uPower; - if ( pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].uPower < 1u ) - pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].Reset(); - return 0; - } - - if ( HasEnchantedItemEquipped(18) || - WearsItem(ITEM_ARTIFACT_YORUBA, EQUIP_ARMOUR) || - WearsItem(ITEM_ARTIFACT_CLOAK_OF_THE_SHEEP, EQUIP_CLOAK) ) - return 0; - } - PlaySound((PlayerSpeech)28, 0); - break; + if ( a3 == 1 ) + { + if ( pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].uExpireTime > 0i64 ) + { + --pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].uPower; + if ( pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].uPower < 1u ) + pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].Reset(); + return 0; + } + if ( HasEnchantedItemEquipped(18) || WearsItem(ITEM_ARTIFACT_YORUBA, EQUIP_ARMOUR) || WearsItem(ITEM_ARTIFACT_CLOAK_OF_THE_SHEEP, EQUIP_CLOAK) ) + return 0; + } + PlaySound((PlayerSpeech)28, 0); + break; case Condition_Paralyzed: - if ( a3 == 1 ) - { - if ( pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].uExpireTime > 0i64 ) - { - --pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].uPower; - if ( pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].uPower < 1u ) - pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].Reset(); - return 0; - } - - if ( HasEnchantedItemEquipped(20)|| - WearsItem(ITEM_ARTIFACT_YORUBA, EQUIP_ARMOUR)|| - WearsItem(ITEM_ARTIFACT_GHOULSBANE, EQIUP_ANY)|| - WearsItem(ITEM_ARTIFACT_CLOAK_OF_THE_SHEEP, EQUIP_CLOAK)) - return 0; - } - break; + if ( a3 == 1 ) + { + if ( pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].uExpireTime > 0i64 ) + { + --pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].uPower; + if ( pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].uPower < 1u ) + pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].Reset(); + return 0; + } + if ( HasEnchantedItemEquipped(20) || WearsItem(ITEM_ARTIFACT_YORUBA, EQUIP_ARMOUR) || WearsItem(ITEM_ARTIFACT_GHOULSBANE, EQIUP_ANY) || WearsItem(ITEM_ARTIFACT_CLOAK_OF_THE_SHEEP, EQUIP_CLOAK)) + return 0; + } + break; case Condition_Unconcious: - PlaySound(SPEECH_32, 0); - if ( sHealth > 0 ) - sHealth = 0; - break; + PlaySound(SPEECH_32, 0); + if ( sHealth > 0 ) + sHealth = 0; + break; case Condition_Dead: - if ( a3 == 1 && (signed __int64)pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].uExpireTime > 0i64 && pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].uSkill >= 4u ) - { - --pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].uPower; - if ( pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].uPower < 1u ) - pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].Reset(); - } - - PlaySound((PlayerSpeech)33, 0); - if ( sHealth > 0 ) - sHealth = 0; - if ( sMana > 0 ) - sMana = 0; - break; + if ( a3 == 1 && (signed __int64)pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].uExpireTime > 0i64 && pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].uSkill >= 4u ) + { + --pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].uPower; + if ( pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].uPower < 1u ) + pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].Reset(); + return 0; + } + PlaySound((PlayerSpeech)33, 0); + if ( sHealth > 0 ) + sHealth = 0; + if ( sMana > 0 ) + sMana = 0; + break; case Condition_Pertified: - if ( a3 == 1 - &&((pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].uExpireTime > 0i64) - || HasEnchantedItemEquipped(23)|| - WearsItem(ITEM_RELIC_KELEBRIM, EQIUP_ANY) || - WearsItem(ITEM_ARTIFACT_YORUBA, EQUIP_ARMOUR) || - WearsItem(ITEM_ARTIFACT_CLOAK_OF_THE_SHEEP, EQUIP_CLOAK)) ) - - return 0; - PlaySound((PlayerSpeech)34, 0); - break; + if ( a3 == 1 ) + { + if ( pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].uExpireTime > 0i64 ) + { + --pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].uPower; + if ( pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].uPower < 1u ) + pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].Reset(); + return 0; + } + if ( HasEnchantedItemEquipped(23) || WearsItem(ITEM_RELIC_KELEBRIM, EQIUP_ANY) || WearsItem(ITEM_ARTIFACT_YORUBA, EQUIP_ARMOUR) || WearsItem(ITEM_ARTIFACT_CLOAK_OF_THE_SHEEP, EQUIP_CLOAK) ) + return 0; + } + PlaySound((PlayerSpeech)34, 0); + break; case Condition_Eradicated: - if ( a3 == 1 && ((signed __int64)pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].uExpireTime > 0 )&&( pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].uSkill >= 4u )) - { - --pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].uPower; - if ( pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].uPower < 1u ) - pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].Reset(); - return 0; - } - PlaySound(SPEECH_35, 0); - if (sHealth > 0 ) - sHealth = 0; - if ( sMana > 0 ) - sMana = 0; - break; - case Condition_Zombie: - if ( classType == PLAYER_CLASS_LICH || Eradicated() ||Zombie() || !Dead()) - return 0; - memset(&pConditions[0], 0, sizeof(pConditions)); - sHealth = GetMaxHealth(); + if ( a3 == 1 && ((signed __int64)pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].uExpireTime > 0 ) &&( pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].uSkill >= 4u )) + { + --pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].uPower; + if ( pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].uPower < 1u ) + pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].Reset(); + return 0; + } + PlaySound(SPEECH_35, 0); + if (sHealth > 0 ) + sHealth = 0; + if ( sMana > 0 ) sMana = 0; - player_sex = 0; - uPrevFace = uCurrentFace; - uPrevVoiceID = uVoiceID; - switch ( uVoiceID ) - { - case 0: - case 1: - case 2: - case 3: - case 8: - case 9: - case 12: - case 13: - case 16: - case 17: - case 20: - case 23: - player_sex = 0; - break; - case 4: - case 5: - case 6: - case 7: - case 10: - case 11: - case 14: - case 15: - case 18: - case 19: - case 21: - case 24: - player_sex = 1; - break; - default: - break; - } - - zombi_face = (player_sex != 0) + 23; - uCurrentFace = zombi_face; - uVoiceID = zombi_face; - PlaySound((PlayerSpeech)SPEECH_99, 0); - break; - } - - remainig_player = 0; - pConditions[uConditionIdx] = pParty->uTimePlayed; - players_after = 0; - for (int i=1;i<5;++i) - { - - - if ( pPlayers[i]->CanAct() ) - { - remainig_player=i; - ++players_after; - } - } - if (( players_before == 2 )&&( players_after == 1 )) - { - pPlayers[remainig_player]->PlaySound(SPEECH_107, 0); - } - return 1; - } + break; + case Condition_Zombie: + if ( classType == PLAYER_CLASS_LICH || Eradicated() || Zombie() || !Dead()) + return 0; + memset(&pConditions[0], 0, sizeof(pConditions)); + sHealth = GetMaxHealth(); + sMana = 0; + player_sex = 0; + uPrevFace = uCurrentFace; + uPrevVoiceID = uVoiceID; + if (IsMale()) + { + uCurrentFace = 23; + uVoiceID = 23; + } + else + { + uCurrentFace = 24; + uVoiceID = 24; + } + PlaySound((PlayerSpeech)SPEECH_99, 0); + break; + } + + remainig_player = 0; + pConditions[uConditionIdx] = pParty->uTimePlayed; + players_after = 0; + for (int i = 1; i < 5; ++i) + { + if ( pPlayers[i]->CanAct() ) + { + remainig_player = i; + ++players_after; + } + } + if (( players_before == 2 ) && ( players_after == 1 )) + { + pPlayers[remainig_player]->PlaySound(SPEECH_107, 0); + } + return 1; +} //----- (00492528) -------------------------------------------------------- bool Player::CanFitItem(unsigned int uSlot, unsigned int uItemID)