comparison Player.cpp @ 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
comparison
equal deleted inserted replaced
1359:60cdc3eac407 1360:a47d9282ea7c
570 { 570 {
571 v17 = 0; 571 v17 = 0;
572 } 572 }
573 else 573 else
574 { 574 {
575 pSoundID = pSoundList->pSounds->uSoundID; 575 pSoundID = pSoundList->pSounds[0].uSoundID;
576 v17 = 0; 576 v17 = 0;
577 for (int i = 0; i < pSoundList->sNumSounds; i++) 577 for (int i = 0; i < pSoundList->sNumSounds; i++)
578 { 578 {
579 v17 = i; 579 v17 = i;
580 if (pSoundID == pickedSoundID) 580 if (pSoundID == pickedSoundID)
695 case ITEM_ARTIFACT_LADYS_ESCORT: return IsFemale(); break; 695 case ITEM_ARTIFACT_LADYS_ESCORT: return IsFemale(); break;
696 case ITEM_WETSUIT: return NothingOrJustBlastersEquipped(); break; 696 case ITEM_WETSUIT: return NothingOrJustBlastersEquipped(); break;
697 default: return 1; break; 697 default: return 1; break;
698 } 698 }
699 } 699 }
700
701
700 //----- (00492D65) -------------------------------------------------------- 702 //----- (00492D65) --------------------------------------------------------
701 int Player::SetCondition(unsigned int uConditionIdx, int a3) 703 int Player::SetCondition(unsigned int uConditionIdx, int a3)
702 { 704 {
703 705 signed int player_sex; // ecx@77
704 signed int player_sex; // ecx@77 706 char zombi_face; // al@80
705 char zombi_face; // al@80 707 signed int remainig_player; // ebx@82
706 signed int remainig_player; // ebx@82 708 int players_before; // [sp+10h] [bp-4h]@2
707 int players_before; // [sp+10h] [bp-4h]@2 709 int players_after; // [sp+20h] [bp+Ch]@82
708 int players_after; // [sp+20h] [bp+Ch]@82 710
709 711 if ( pConditions[uConditionIdx] )
710 if ( pConditions[uConditionIdx] ) 712 return 0;
713
714 players_before = 0;
715
716 for (int i = 1; i < 5; ++i)
717 {
718 if ( pPlayers[i]->CanAct() )
719 ++players_before;
720 }
721
722 switch ( uConditionIdx )
723 {
724 case Condition_Cursed:
725 PlaySound((PlayerSpeech)30, 0);
726 break;
727 case Condition_Weak:
728 if ( a3 == 1 && (signed __int64)pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].uExpireTime > 0 )
729 {
730 --pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].uPower;
731 if ( pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].uPower < 1u )
732 pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].Reset();
711 return 0; 733 return 0;
712 players_before = 0; 734 }
713 for (int i=1;i<5;++i) 735 PlaySound((PlayerSpeech)25, 0);
714 if ( pPlayers[i]->CanAct() ) 736 break;
715 ++players_before; 737 case Condition_Sleep:
716 738 if ( a3 == 1 && (HasEnchantedItemEquipped(22) || WearsItem(ITEM_ARTIFACT_YORUBA, EQUIP_ARMOUR)))
717 switch ( uConditionIdx )
718 {
719 case Condition_Cursed:
720 PlaySound((PlayerSpeech)30, 0);
721 break;
722 case Condition_Weak:
723 if ( a3 == 1 && (signed __int64)pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].uExpireTime > 0 )
724 {--pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].uPower;
725 if ( pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].uPower < 1u )
726 pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].Reset();
727 return 0; 739 return 0;
728 } 740 break;
729
730 PlaySound((PlayerSpeech)25, 0);
731 break;
732 case Condition_Sleep:
733 if ( a3 == 1 &&(HasEnchantedItemEquipped(22)||
734 WearsItem(ITEM_ARTIFACT_YORUBA, EQUIP_ARMOUR)))
735 return 0;
736 break;
737 741
738 case Condition_Fear: 742 case Condition_Fear:
739 PlaySound((PlayerSpeech)26, 0); 743 PlaySound((PlayerSpeech)26, 0);
740 break; 744 break;
741 case Condition_Drunk: 745 case Condition_Drunk:
742 PlaySound((PlayerSpeech)31, 0); 746 PlaySound((PlayerSpeech)31, 0);
743 break; 747 break;
744
745 case Condition_Insane: 748 case Condition_Insane:
746 if ( a3 == 1 749 if ( a3 == 1 && (HasEnchantedItemEquipped(19) || WearsItem(ITEM_ARTIFACT_YORUBA, EQUIP_ARMOUR) || WearsItem(ITEM_ARTIFACT_CLOAK_OF_THE_SHEEP, EQUIP_CLOAK)) )
747 && (HasEnchantedItemEquipped(19) || 750 return 0;
748 WearsItem(ITEM_ARTIFACT_YORUBA, EQUIP_ARMOUR) || 751 PlaySound((PlayerSpeech)29, 0);
749 WearsItem(ITEM_ARTIFACT_CLOAK_OF_THE_SHEEP, EQUIP_CLOAK)) ) 752 break;
750 return 0;
751
752 PlaySound((PlayerSpeech)29, 0);
753 break;
754 case Condition_Poison1: 753 case Condition_Poison1:
755 case Condition_Poison2: 754 case Condition_Poison2:
756 case Condition_Poison3: 755 case Condition_Poison3:
757 if ( a3 == 1 ) 756 if ( a3 == 1 )
758 { 757 {
759 if ( (signed __int64)pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].uExpireTime > 0i64 ) 758 if ( (signed __int64)pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].uExpireTime > 0i64 )
760 { 759 {
761 --pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].uPower; 760 --pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].uPower;
762 if ( pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].uPower < 1u ) 761 if ( pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].uPower < 1u )
763 pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].Reset(); 762 pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].Reset();
764 } 763 return 0;
765 if ( HasEnchantedItemEquipped(21) 764 }
766 || WearsItem(ITEM_ARTIFACT_YORUBA, EQUIP_ARMOUR) 765 if ( HasEnchantedItemEquipped(21) || WearsItem(ITEM_ARTIFACT_YORUBA, EQUIP_ARMOUR) || WearsItem(ITEM_ARTIFACT_CLOAK_OF_THE_SHEEP, EQUIP_CLOAK) )
767 || WearsItem(ITEM_ARTIFACT_CLOAK_OF_THE_SHEEP, EQUIP_CLOAK) ) 766 return 0;
768 //goto LABEL_76; 767 }
769 return 0; 768 PlaySound((PlayerSpeech)27, 0);
770 } 769 break;
771
772 //v23 = 27;
773 PlaySound((PlayerSpeech)27, 0);
774 break;
775
776 case Condition_Disease1: 770 case Condition_Disease1:
777 case Condition_Disease2: 771 case Condition_Disease2:
778 case Condition_Disease3: 772 case Condition_Disease3:
779 if ( a3 == 1 ) 773 if ( a3 == 1 )
780 { 774 {
781 if ( pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].uExpireTime > 0i64 ) 775 if ( pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].uExpireTime > 0i64 )
782 { 776 {
783 --pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].uPower; 777 --pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].uPower;
784 if ( pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].uPower < 1u ) 778 if ( pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].uPower < 1u )
785 pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].Reset(); 779 pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].Reset();
786 return 0; 780 return 0;
787 } 781 }
788 782 if ( HasEnchantedItemEquipped(18) || WearsItem(ITEM_ARTIFACT_YORUBA, EQUIP_ARMOUR) || WearsItem(ITEM_ARTIFACT_CLOAK_OF_THE_SHEEP, EQUIP_CLOAK) )
789 if ( HasEnchantedItemEquipped(18) || 783 return 0;
790 WearsItem(ITEM_ARTIFACT_YORUBA, EQUIP_ARMOUR) || 784 }
791 WearsItem(ITEM_ARTIFACT_CLOAK_OF_THE_SHEEP, EQUIP_CLOAK) ) 785 PlaySound((PlayerSpeech)28, 0);
792 return 0; 786 break;
793 }
794 PlaySound((PlayerSpeech)28, 0);
795 break;
796 case Condition_Paralyzed: 787 case Condition_Paralyzed:
797 if ( a3 == 1 ) 788 if ( a3 == 1 )
798 { 789 {
799 if ( pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].uExpireTime > 0i64 ) 790 if ( pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].uExpireTime > 0i64 )
800 { 791 {
801 --pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].uPower; 792 --pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].uPower;
802 if ( pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].uPower < 1u ) 793 if ( pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].uPower < 1u )
803 pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].Reset(); 794 pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].Reset();
804 return 0; 795 return 0;
805 } 796 }
806 797 if ( HasEnchantedItemEquipped(20) || WearsItem(ITEM_ARTIFACT_YORUBA, EQUIP_ARMOUR) || WearsItem(ITEM_ARTIFACT_GHOULSBANE, EQIUP_ANY) || WearsItem(ITEM_ARTIFACT_CLOAK_OF_THE_SHEEP, EQUIP_CLOAK))
807 if ( HasEnchantedItemEquipped(20)|| 798 return 0;
808 WearsItem(ITEM_ARTIFACT_YORUBA, EQUIP_ARMOUR)|| 799 }
809 WearsItem(ITEM_ARTIFACT_GHOULSBANE, EQIUP_ANY)|| 800 break;
810 WearsItem(ITEM_ARTIFACT_CLOAK_OF_THE_SHEEP, EQUIP_CLOAK))
811 return 0;
812 }
813 break;
814 case Condition_Unconcious: 801 case Condition_Unconcious:
815 PlaySound(SPEECH_32, 0); 802 PlaySound(SPEECH_32, 0);
816 if ( sHealth > 0 ) 803 if ( sHealth > 0 )
817 sHealth = 0; 804 sHealth = 0;
818 break; 805 break;
819 case Condition_Dead: 806 case Condition_Dead:
820 if ( a3 == 1 && (signed __int64)pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].uExpireTime > 0i64 && pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].uSkill >= 4u ) 807 if ( a3 == 1 && (signed __int64)pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].uExpireTime > 0i64 && pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].uSkill >= 4u )
821 { 808 {
822 --pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].uPower; 809 --pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].uPower;
823 if ( pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].uPower < 1u ) 810 if ( pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].uPower < 1u )
824 pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].Reset(); 811 pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].Reset();
825 } 812 return 0;
826 813 }
827 PlaySound((PlayerSpeech)33, 0); 814 PlaySound((PlayerSpeech)33, 0);
828 if ( sHealth > 0 ) 815 if ( sHealth > 0 )
829 sHealth = 0; 816 sHealth = 0;
830 if ( sMana > 0 ) 817 if ( sMana > 0 )
831 sMana = 0; 818 sMana = 0;
832 break; 819 break;
833 case Condition_Pertified: 820 case Condition_Pertified:
834 if ( a3 == 1 821 if ( a3 == 1 )
835 &&((pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].uExpireTime > 0i64) 822 {
836 || HasEnchantedItemEquipped(23)|| 823 if ( pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].uExpireTime > 0i64 )
837 WearsItem(ITEM_RELIC_KELEBRIM, EQIUP_ANY) || 824 {
838 WearsItem(ITEM_ARTIFACT_YORUBA, EQUIP_ARMOUR) || 825 --pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].uPower;
839 WearsItem(ITEM_ARTIFACT_CLOAK_OF_THE_SHEEP, EQUIP_CLOAK)) ) 826 if ( pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].uPower < 1u )
840 827 pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].Reset();
841 return 0; 828 return 0;
842 PlaySound((PlayerSpeech)34, 0); 829 }
843 break; 830 if ( HasEnchantedItemEquipped(23) || WearsItem(ITEM_RELIC_KELEBRIM, EQIUP_ANY) || WearsItem(ITEM_ARTIFACT_YORUBA, EQUIP_ARMOUR) || WearsItem(ITEM_ARTIFACT_CLOAK_OF_THE_SHEEP, EQUIP_CLOAK) )
831 return 0;
832 }
833 PlaySound((PlayerSpeech)34, 0);
834 break;
844 case Condition_Eradicated: 835 case Condition_Eradicated:
845 if ( a3 == 1 && ((signed __int64)pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].uExpireTime > 0 )&&( pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].uSkill >= 4u )) 836 if ( a3 == 1 && ((signed __int64)pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].uExpireTime > 0 ) &&( pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].uSkill >= 4u ))
846 { 837 {
847 --pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].uPower; 838 --pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].uPower;
848 if ( pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].uPower < 1u ) 839 if ( pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].uPower < 1u )
849 pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].Reset(); 840 pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].Reset();
850 return 0; 841 return 0;
851 } 842 }
852 PlaySound(SPEECH_35, 0); 843 PlaySound(SPEECH_35, 0);
853 if (sHealth > 0 ) 844 if (sHealth > 0 )
854 sHealth = 0; 845 sHealth = 0;
855 if ( sMana > 0 ) 846 if ( sMana > 0 )
856 sMana = 0; 847 sMana = 0;
857 break; 848 break;
858 case Condition_Zombie: 849 case Condition_Zombie:
859 if ( classType == PLAYER_CLASS_LICH || Eradicated() ||Zombie() || !Dead()) 850 if ( classType == PLAYER_CLASS_LICH || Eradicated() || Zombie() || !Dead())
860 return 0; 851 return 0;
861 memset(&pConditions[0], 0, sizeof(pConditions)); 852 memset(&pConditions[0], 0, sizeof(pConditions));
862 sHealth = GetMaxHealth(); 853 sHealth = GetMaxHealth();
863 sMana = 0; 854 sMana = 0;
864 player_sex = 0; 855 player_sex = 0;
865 uPrevFace = uCurrentFace; 856 uPrevFace = uCurrentFace;
866 uPrevVoiceID = uVoiceID; 857 uPrevVoiceID = uVoiceID;
867 switch ( uVoiceID ) 858 if (IsMale())
868 { 859 {
869 case 0: 860 uCurrentFace = 23;
870 case 1: 861 uVoiceID = 23;
871 case 2: 862 }
872 case 3: 863 else
873 case 8: 864 {
874 case 9: 865 uCurrentFace = 24;
875 case 12: 866 uVoiceID = 24;
876 case 13: 867 }
877 case 16: 868 PlaySound((PlayerSpeech)SPEECH_99, 0);
878 case 17: 869 break;
879 case 20: 870 }
880 case 23: 871
881 player_sex = 0; 872 remainig_player = 0;
882 break; 873 pConditions[uConditionIdx] = pParty->uTimePlayed;
883 case 4: 874 players_after = 0;
884 case 5: 875 for (int i = 1; i < 5; ++i)
885 case 6: 876 {
886 case 7: 877 if ( pPlayers[i]->CanAct() )
887 case 10: 878 {
888 case 11: 879 remainig_player = i;
889 case 14: 880 ++players_after;
890 case 15: 881 }
891 case 18: 882 }
892 case 19: 883 if (( players_before == 2 ) && ( players_after == 1 ))
893 case 21: 884 {
894 case 24: 885 pPlayers[remainig_player]->PlaySound(SPEECH_107, 0);
895 player_sex = 1; 886 }
896 break; 887 return 1;
897 default: 888 }
898 break;
899 }
900
901 zombi_face = (player_sex != 0) + 23;
902 uCurrentFace = zombi_face;
903 uVoiceID = zombi_face;
904 PlaySound((PlayerSpeech)SPEECH_99, 0);
905 break;
906 }
907
908 remainig_player = 0;
909 pConditions[uConditionIdx] = pParty->uTimePlayed;
910 players_after = 0;
911 for (int i=1;i<5;++i)
912 {
913
914
915 if ( pPlayers[i]->CanAct() )
916 {
917 remainig_player=i;
918 ++players_after;
919 }
920 }
921 if (( players_before == 2 )&&( players_after == 1 ))
922 {
923 pPlayers[remainig_player]->PlaySound(SPEECH_107, 0);
924 }
925 return 1;
926 }
927 889
928 //----- (00492528) -------------------------------------------------------- 890 //----- (00492528) --------------------------------------------------------
929 bool Player::CanFitItem(unsigned int uSlot, unsigned int uItemID) 891 bool Player::CanFitItem(unsigned int uSlot, unsigned int uItemID)
930 { 892 {
931 //unsigned int v3; // eax@1 893 //unsigned int v3; // eax@1