Mercurial > mm7
comparison Party.cpp @ 1828:35c1e4ff6ba7
party_finds_gold to Party::PartyFindsGold, cleaned up, moved Level/Decoration.h reference out of Indoor.h
author | Grumpy7 |
---|---|
date | Fri, 11 Oct 2013 07:04:19 +0200 |
parents | 0c75c3e7e436 |
children | e4e27261d84e |
comparison
equal
deleted
inserted
replaced
1827:0c75c3e7e436 | 1828:35c1e4ff6ba7 |
---|---|
817 { | 817 { |
818 signed __int64 v1; // ST2C_8@1 | 818 signed __int64 v1; // ST2C_8@1 |
819 signed __int64 v2; // qax@1 | 819 signed __int64 v2; // qax@1 |
820 unsigned __int64 v4; // qax@1 | 820 unsigned __int64 v4; // qax@1 |
821 unsigned int v5; // ebx@1 | 821 unsigned int v5; // ebx@1 |
822 Player *v6; // ebx@1 | |
823 | 822 |
824 pParty->pHirelings[0].bHasUsedTheAbility = 0; | 823 pParty->pHirelings[0].bHasUsedTheAbility = 0; |
825 pParty->pHirelings[1].bHasUsedTheAbility = 0; | 824 pParty->pHirelings[1].bHasUsedTheAbility = 0; |
826 pParty->uTimePlayed += (signed __int64)((double)(7680 * uNumMinutes) * 0.033333335); | 825 pParty->uTimePlayed += (signed __int64)((double)(7680 * uNumMinutes) * 0.033333335); |
827 v1 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375); | 826 v1 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375); |
932 } | 931 } |
933 } | 932 } |
934 } | 933 } |
935 } | 934 } |
936 //----- (00420C05) -------------------------------------------------------- | 935 //----- (00420C05) -------------------------------------------------------- |
937 void __fastcall party_finds_gold(unsigned int uNumGold, int _1_dont_share_with_followers___2_the_same_but_without_a_message__else_normal) | 936 void Party::PartyFindsGold(unsigned int uNumGold, int _1_dont_share_with_followers___2_the_same_but_without_a_message__else_normal) |
938 { | 937 { |
939 unsigned int v2; // edi@1 | |
940 int hirelingSalaries; // ebp@1 | 938 int hirelingSalaries; // ebp@1 |
941 unsigned int goldToGain; // esi@1 | 939 unsigned int goldToGain; // esi@1 |
942 int v5; // ecx@6 | |
943 NPCData *v6; // eax@6 | |
944 signed int v7; // edx@8 | |
945 signed int v8; // ebx@10 | |
946 char *v9; // edi@11 | |
947 signed int v10; // ecx@17 | |
948 int v11; // eax@21 | |
949 NPCData *v12; // ecx@21 | 940 NPCData *v12; // ecx@21 |
950 unsigned int v13; // ecx@23 | 941 unsigned int v13; // ecx@23 |
951 signed int hirelingCount; // [sp+Ch] [bp-4h]@6 | 942 signed int hirelingCount; // [sp+Ch] [bp-4h]@6 |
952 | 943 |
953 v2 = 0; | |
954 hirelingSalaries = 0; | 944 hirelingSalaries = 0; |
955 goldToGain = uNumGold; | 945 goldToGain = uNumGold; |
956 if ( _1_dont_share_with_followers___2_the_same_but_without_a_message__else_normal ) | 946 |
957 { | 947 if ( _1_dont_share_with_followers___2_the_same_but_without_a_message__else_normal == 2 ) |
958 if ( _1_dont_share_with_followers___2_the_same_but_without_a_message__else_normal == 1 ) | 948 pTmpBuf2[0] = 0; |
959 { | 949 else if ( _1_dont_share_with_followers___2_the_same_but_without_a_message__else_normal == 1 ) |
960 sprintf(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[467], uNumGold);// You found %lu gold! | 950 { |
961 } | 951 sprintf(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[467], uNumGold);// You found %lu gold! |
962 else | 952 } |
963 { | |
964 if ( _1_dont_share_with_followers___2_the_same_but_without_a_message__else_normal == 2 ) | |
965 pTmpBuf2[0] = 0; | |
966 } | |
967 } | |
968 else | 953 else |
969 { | 954 { |
970 hirelingCount = 0; | 955 hirelingCount = 0; |
971 v5 = 0; | 956 for (int i = 0; i < 2; i++) |
972 v6 = pParty->pHirelings; | 957 { |
973 do | 958 if (this->pHirelings[i].pName) |
974 { | 959 { |
975 if ( v6->pName ) | 960 hirelingCount++; |
976 { | 961 pTmpBuf[hirelingCount] = i; |
977 v7 = hirelingCount++; | 962 } |
978 pTmpBuf[v7] = v5; | 963 } |
979 } | 964 for (uint i = 0; i < pNPCStats->uNumNewNPCs; i++) |
980 ++v6; | 965 { |
981 ++v5; | 966 if ( pNPCStats->pNewNPCData[i].uFlags & 0x80 |
982 } | 967 && (!this->pHirelings[0].pName || strcmp(pNPCStats->pNewNPCData[i].pName, this->pHirelings[0].pName)) |
983 while ( (signed int)v6 < (signed int)&pParty->pPickedItem ); | 968 && (!this->pHirelings[1].pName || strcmp(pNPCStats->pNewNPCData[i].pName, this->pHirelings[1].pName)) ) |
984 v8 = 0; | 969 { |
985 if ( (signed int)pNPCStats->uNumNewNPCs > 0 ) | 970 hirelingCount++; |
986 { | 971 pTmpBuf[hirelingCount] = i + 2; |
987 v9 = (char *)pNPCStats->pNewNPCData; | 972 } |
988 do | 973 } |
989 { | 974 for (int i = 0; i < hirelingCount; i++) |
990 if ( v9[8] & 0x80 | 975 { |
991 && (!pParty->pHirelings[0].pName || strcmp(*(const char **)v9, pParty->pHirelings[0].pName)) | 976 uchar thisBufId = (uchar)pTmpBuf[i]; |
992 && (!pParty->pHirelings[1].pName || strcmp(*(const char **)v9, pParty->pHirelings[1].pName)) ) | 977 if (thisBufId < 2) |
993 { | 978 v12 = &this->pHirelings[thisBufId]; |
994 v10 = hirelingCount++; | 979 else |
995 pTmpBuf[v10] = v8 + 2; | 980 v12 = &pNPCStats->pNPCData[thisBufId + 499]; |
996 } | 981 v13 = v12->uProfession; |
997 ++v8; | 982 if ( v13 ) |
998 v9 += 76; | 983 hirelingSalaries += pNPCStats->pProfessions[v13].uHirePrice;//*(&pNPCStats->field_13A58 + 5 * v13); |
999 } | |
1000 while ( v8 < (signed int)pNPCStats->uNumNewNPCs ); | |
1001 v2 = 0; | |
1002 } | |
1003 if ( hirelingCount > 0 ) | |
1004 { | |
1005 do | |
1006 { | |
1007 v11 = (unsigned __int8)pTmpBuf[v2]; | |
1008 v12 = &pNPCStats->pNPCData[v11 + 499]; | |
1009 if ( (unsigned __int8)pTmpBuf[v2] < 2 ) | |
1010 v12 = &pParty->pHirelings[v11]; | |
1011 v13 = v12->uProfession; | |
1012 if ( v13 ) | |
1013 hirelingSalaries += pNPCStats->pProfessions[v13].uHirePrice;//*(&pNPCStats->field_13A58 + 5 * v13); | |
1014 ++v2; | |
1015 } | |
1016 while ( (signed int)v2 < hirelingCount ); | |
1017 } | 984 } |
1018 if ( CheckHiredNPCSpeciality(Factor) ) | 985 if ( CheckHiredNPCSpeciality(Factor) ) |
1019 goldToGain += (signed int)(10 * goldToGain) / 100; | 986 goldToGain += (signed int)(10 * goldToGain) / 100; |
1020 if ( CheckHiredNPCSpeciality(Banker) ) | 987 if ( CheckHiredNPCSpeciality(Banker) ) |
1021 goldToGain += (signed int)(20 * goldToGain) / 100; | 988 goldToGain += (signed int)(20 * goldToGain) / 100; |
1030 } | 997 } |
1031 else | 998 else |
1032 { | 999 { |
1033 sprintf(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[467], goldToGain);// You found %lu gold! | 1000 sprintf(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[467], goldToGain);// You found %lu gold! |
1034 } | 1001 } |
1035 v2 = 0; | 1002 } |
1036 } | 1003 this->uNumGold += goldToGain - hirelingSalaries; |
1037 pParty->uNumGold += goldToGain - hirelingSalaries; | 1004 pUIAnim_Gold->uAnimTime = 0; |
1038 pUIAnim_Gold->uAnimTime = v2; | |
1039 pUIAnim_Gold->uAnimLength = 8 * pIconsFrameTable->pIcons[(signed __int16)pUIAnim_Gold->uIconID].uAnimLength; | 1005 pUIAnim_Gold->uAnimLength = 8 * pIconsFrameTable->pIcons[(signed __int16)pUIAnim_Gold->uIconID].uAnimLength; |
1040 if ( pTmpBuf2[0] ) | 1006 if ( pTmpBuf2[0] ) |
1041 ShowStatusBarString(pTmpBuf2.data(), 2u); | 1007 ShowStatusBarString(pTmpBuf2.data(), 2u); |
1042 pAudioPlayer->PlaySound(SOUND_GoldReceived, v2, v2, -1, v2, v2, v2, v2); | 1008 pAudioPlayer->PlaySound(SOUND_GoldReceived, 0, 0, -1, 0, 0, 0, 0); |
1043 } | 1009 } |
1044 //----- (00421B2C) -------------------------------------------------------- | 1010 //----- (00421B2C) -------------------------------------------------------- |
1045 bool sub_421B2C_PlaceInInventory_or_DropPickedItem() | 1011 bool sub_421B2C_PlaceInInventory_or_DropPickedItem() |
1046 { | 1012 { |
1047 unsigned int v0; // eax@2 | 1013 unsigned int v0; // eax@2 |