Mercurial > mm7
comparison mm7_2.cpp @ 916:897b10712a1a
UIShop_Buy_Identify_Repair little clean and rename
author | Ritor1 |
---|---|
date | Thu, 25 Apr 2013 17:37:00 +0600 |
parents | a8a3efd631de |
children | 34ed2d5e7cfb |
comparison
equal
deleted
inserted
replaced
915:9efbe4bff7ac | 916:897b10712a1a |
---|---|
888 } | 888 } |
889 | 889 |
890 //----- (004BDB56) -------------------------------------------------------- | 890 //----- (004BDB56) -------------------------------------------------------- |
891 void __cdecl UIShop_Buy_Identify_Repair() | 891 void __cdecl UIShop_Buy_Identify_Repair() |
892 { | 892 { |
893 Player *v0; // edi@1 | |
894 signed int v1; // esi@9 | |
895 unsigned int v2; // eax@11 | |
896 int v3; // esi@12 | |
897 float v4; // ST1C_4@12 | |
898 signed int v5; // eax@12 | |
899 signed int v6; // eax@12 | |
900 char v7; // zf@12 | |
901 int v8; // eax@15 | 893 int v8; // eax@15 |
902 const char *v9; // ecx@15 | 894 unsigned int pItemID; // esi@20 |
903 signed int v10; // esi@18 | 895 ItemGen *item; // esi@21 |
904 unsigned int v11; // esi@20 | |
905 int v12; // esi@21 | |
906 void *v13; // ecx@26 | |
907 signed int v14; // esi@31 | |
908 unsigned int v15; // eax@33 | 896 unsigned int v15; // eax@33 |
909 GUIWindow *v16; // esi@34 | 897 POINT *pCursorPos; // esi@37 |
910 POINT *v17; // esi@37 | |
911 int v18; // ecx@37 | 898 int v18; // ecx@37 |
912 void *v19; // eax@38 | 899 float pPriceMultiplier; // ST1C_4@38 |
913 ItemGen *v20; // esi@38 | 900 int taken_item; // eax@40 |
914 float v21; // ST1C_4@38 | 901 ItemGen *bought_item; // esi@51 |
915 signed int v22; // eax@38 | 902 int party_reputation; // eax@55 |
916 int v23; // ebx@38 | |
917 int v24; // edx@39 | |
918 int v25; // eax@40 | |
919 int v26; // ebx@41 | |
920 Player *v27; // ecx@43 | |
921 POINT *v28; // esi@49 | |
922 int v29; // ecx@49 | |
923 void *v30; // eax@50 | |
924 int v31; // ecx@50 | |
925 ItemGen *v32; // esi@51 | |
926 //float v33; // ST1C_4@53 | |
927 //signed int v34; // eax@53 | |
928 //int v35; // eax@53 | |
929 //bool v36; // eax@53 | |
930 unsigned int v37; // eax@53 | |
931 int v38; // eax@55 | |
932 int v39; // eax@63 | 903 int v39; // eax@63 |
933 //int v40; // eax@64 | |
934 int v41; // edx@66 | |
935 int v42; // esi@74 | 904 int v42; // esi@74 |
936 signed int v43; // ebx@74 | 905 signed int v43; // ebx@74 |
937 int v44; // ecx@74 | |
938 unsigned __int16 *pSkill; // esi@77 | 906 unsigned __int16 *pSkill; // esi@77 |
939 signed int v46; // [sp-18h] [bp-CCh]@36 | |
940 unsigned int v47; // [sp-14h] [bp-C8h]@36 | |
941 signed int v48; // [sp-10h] [bp-C4h]@36 | |
942 signed int v49; // [sp-Ch] [bp-C0h]@36 | |
943 int v50; // [sp-8h] [bp-BCh]@36 | |
944 int v51; // [sp-4h] [bp-B8h]@28 | |
945 unsigned int v52; // [sp-4h] [bp-B8h]@36 | |
946 int v53; // [sp+0h] [bp-B4h]@16 | |
947 unsigned int v54; // [sp+0h] [bp-B4h]@25 | |
948 int v55; // [sp+0h] [bp-B4h]@26 | 907 int v55; // [sp+0h] [bp-B4h]@26 |
949 int v56; // [sp+0h] [bp-B4h]@36 | 908 POINT cursor; // [sp+40h] [bp-74h]@37 |
950 //POINT v57; // [sp+10h] [bp-A4h]@49 | |
951 //POINT v58; // [sp+18h] [bp-9Ch]@18 | |
952 POINT v59; // [sp+20h] [bp-94h]@49 | |
953 POINT v60; // [sp+28h] [bp-8Ch]@9 | |
954 POINT v61; // [sp+30h] [bp-84h]@37 | |
955 POINT v62; // [sp+38h] [bp-7Ch]@18 | |
956 POINT v63; // [sp+40h] [bp-74h]@37 | |
957 //POINT v64; // [sp+48h] [bp-6Ch]@19 | |
958 POINT v65; // [sp+50h] [bp-64h]@32 | |
959 //POINT v66; // [sp+58h] [bp-5Ch]@18 | |
960 POINT v67; // [sp+60h] [bp-54h]@31 | |
961 POINT a2; // [sp+68h] [bp-4Ch]@9 | |
962 POINT v69; // [sp+70h] [bp-44h]@31 | |
963 POINT v70; // [sp+78h] [bp-3Ch]@9 | |
964 POINT v71; // [sp+80h] [bp-34h]@31 | |
965 POINT v72; // [sp+88h] [bp-2Ch]@10 | |
966 //bool v73; // [sp+90h] [bp-24h]@53 | |
967 int v74; // [sp+94h] [bp-20h]@53 | |
968 int a6; // [sp+98h] [bp-1Ch]@57 | 909 int a6; // [sp+98h] [bp-1Ch]@57 |
969 int a3; // [sp+9Ch] [bp-18h]@53 | 910 int a3; // [sp+9Ch] [bp-18h]@53 |
970 //Player *v77; // [sp+A0h] [bp-14h]@1 | |
971 unsigned int uNumSeconds; // [sp+A4h] [bp-10h]@53 | 911 unsigned int uNumSeconds; // [sp+A4h] [bp-10h]@53 |
972 unsigned int v79; // [sp+A8h] [bp-Ch]@9 | 912 unsigned int v79; // [sp+A8h] [bp-Ch]@9 |
973 int v80; // [sp+ACh] [bp-8h]@12 | 913 int uPriceItemService; // [sp+ACh] [bp-8h]@12 |
974 ItemGen *_this; // [sp+B0h] [bp-4h]@13 | 914 |
975 | |
976 v0 = pPlayers[uActiveCharacter]; | |
977 //v77 = pPlayers[uActiveCharacter]; | |
978 if ( pCurrentScreen == SCREEN_E ) | 915 if ( pCurrentScreen == SCREEN_E ) |
979 { | 916 { |
980 sub_421EA6_OnInventoryLeftClick(); | 917 sub_421EA6_OnInventoryLeftClick(); |
981 return; | 918 return; |
982 } | 919 } |
994 sub_421EA6_OnInventoryLeftClick(); | 931 sub_421EA6_OnInventoryLeftClick(); |
995 break; | 932 break; |
996 } | 933 } |
997 case HOUSE_DIALOGUE_GUILD_BUY_BOOKS: | 934 case HOUSE_DIALOGUE_GUILD_BUY_BOOKS: |
998 { | 935 { |
999 v17 = pMouse->GetCursorPos(&v63); | 936 pCursorPos = pMouse->GetCursorPos(&cursor); |
1000 v18 = pRenderer->pActiveZBuffer[v17->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v61)->y]] & 0xFFFF; | 937 v18 = pRenderer->pActiveZBuffer[pCursorPos->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&cursor)->y]] & 0xFFFF; |
1001 if ( !v18 ) | 938 if ( !v18 ) |
1002 return; | 939 return; |
1003 v20 = (ItemGen *)(&pParty->pPlayers[1].uExpressionTimeLength + 18 * (v18 + 12 * (int)window_SpeakInHouse->ptr_1C)); | 940 bought_item = (ItemGen *)(&pParty->pPlayers[1].uExpressionTimeLength + 18 * (v18 + 12 * (int)window_SpeakInHouse->ptr_1C)); |
1004 v21 = p2DEvents[(signed int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier; | 941 pPriceMultiplier = p2DEvents[(signed int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier; |
1005 _this = v20; | 942 uPriceItemService = pPlayers[uActiveCharacter]->GetBuyingPrice(bought_item->GetValue(), pPriceMultiplier); |
1006 v22 = v20->GetValue(); | |
1007 v23 = pPlayers[uActiveCharacter]->GetBuyingPrice(v22, v21); | |
1008 v80 = v23; | |
1009 GetAsyncKeyState(VK_CONTROL); | 943 GetAsyncKeyState(VK_CONTROL); |
1010 if ( pParty->uNumGold < v23 ) | 944 if ( pParty->uNumGold < uPriceItemService ) |
1011 { | 945 { |
1012 v24 = 2; | 946 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, (HouseSoundID)2); |
1013 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, (HouseSoundID)v24); | |
1014 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2); | 947 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2); |
1015 return; | 948 return; |
1016 } | 949 } |
1017 v25 = pPlayers[uActiveCharacter]->AddItem(0xFFFFFFFFu, v20->uItemID); | 950 taken_item = pPlayers[uActiveCharacter]->AddItem(0xFFFFFFFFu, bought_item->uItemID); |
1018 if ( v25 ) | 951 if ( taken_item ) |
1019 { | 952 { |
1020 v26 = 1; | 953 bought_item->SetIdentified(); |
1021 v20->SetIdentified(); | 954 memcpy(&pPlayers[uActiveCharacter]->pInventoryItems[taken_item - 1], bought_item, 0x24u); |
1022 memcpy(&pPlayers[uActiveCharacter]->pInventoryItems[v25-1], v20, 0x24u); | 955 dword_F8B1E4 = 1; |
1023 dword_F8B1E4 = v26; | 956 Party::TakeGold(uPriceItemService); |
1024 Party::TakeGold(v80); | 957 viewparams->bRedrawGameUI = 1; |
1025 viewparams->bRedrawGameUI = v26; | 958 bought_item->Reset(); |
1026 _this->Reset(); | |
1027 pRenderer->ClearZBuffer(0, 479); | 959 pRenderer->ClearZBuffer(0, 479); |
1028 pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)SPEECH_75, 0); | 960 pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)SPEECH_75, 0); |
1029 return; | 961 return; |
1030 } | 962 } |
1031 pPlayers[uActiveCharacter]->PlaySound(SPEECH_NoRoom, 0); | 963 pPlayers[uActiveCharacter]->PlaySound(SPEECH_NoRoom, 0); |
1032 ShowStatusBarString(pGlobalTXT_LocalizationStrings[563], 5); // "Pack is Full!" | 964 ShowStatusBarString(pGlobalTXT_LocalizationStrings[563], 5); // "Pack is Full!" |
1033 break; | 965 break; |
1034 } | 966 } |
1035 case HOUSE_DIALOGUE_SHOP_SELL: | 967 case HOUSE_DIALOGUE_SHOP_SELL: |
1036 { | 968 { |
1037 v14 = pMouse->GetCursorPos(&v71)->x - 14; | 969 v79 = ((pMouse->GetCursorPos(&cursor)->x - 14) >> 5) + 14 * ((pMouse->GetCursorPos(&cursor)->y - 17) >> 5); |
1038 v79 = (v14 >> 5) + 14 * ((pMouse->GetCursorPos(&v69)->y - 17) >> 5); | 970 if ( pMouse->GetCursorPos(&cursor)->x <= 13 |
1039 if ( pMouse->GetCursorPos(&v67)->x <= 13 | 971 || pMouse->GetCursorPos(&cursor)->x >= 462 |
1040 || pMouse->GetCursorPos(&v65)->x >= 462 | |
1041 || (v15 = pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v79), !v15) ) | 972 || (v15 = pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v79), !v15) ) |
1042 return; | 973 return; |
1043 v16 = window_SpeakInHouse; | 974 if ( MerchandiseTest(&pPlayers[uActiveCharacter]->pInventoryItems[v15 - 1], (int)window_SpeakInHouse->ptr_1C) ) |
1044 if ( MerchandiseTest(&pPlayers[uActiveCharacter]->pInventoryItems[v15-1], (int)window_SpeakInHouse->ptr_1C) ) | |
1045 { | 975 { |
1046 dword_F8B1E4 = 1; | 976 dword_F8B1E4 = 1; |
1047 pPlayers[uActiveCharacter]->SalesProcess(v79, v15 - 1, (int)v16->ptr_1C); | 977 pPlayers[uActiveCharacter]->SalesProcess(v79, v15 - 1, (int)window_SpeakInHouse->ptr_1C); |
1048 viewparams->bRedrawGameUI = 1; | 978 viewparams->bRedrawGameUI = 1; |
1049 pRenderer->ClearZBuffer(0, 479); | 979 pRenderer->ClearZBuffer(0, 479); |
1050 pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)77, 0); | 980 pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)77, 0); |
1051 return; | 981 return; |
1052 } | 982 } |
1054 pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0); | 984 pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0); |
1055 break; | 985 break; |
1056 } | 986 } |
1057 case HOUSE_DIALOGUE_SHOP_IDENTIFY: | 987 case HOUSE_DIALOGUE_SHOP_IDENTIFY: |
1058 { | 988 { |
1059 pMouse->GetCursorPos(&v62); | 989 pMouse->GetCursorPos(&cursor); |
1060 v10 = v62.x - 14; | 990 v79 = ((cursor.x - 14) >> 5) + 14 * ((cursor.y - 17) >> 5); |
1061 v79 = (v10 >> 5) + 14 * ((v62.y - 17) >> 5); | 991 if (cursor.x > 13 && cursor.x < 462) |
1062 if (v62.x > 13 && v62.x < 462) | 992 { |
1063 { | 993 pItemID = pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v79); |
1064 v11 = pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v79); | 994 if ( pItemID ) |
1065 if ( v11 ) | 995 { |
1066 { | 996 uPriceItemService = pPlayers[uActiveCharacter]->GetPriceIdentification(p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier); |
1067 //v80 = v0->_4B8179(p2DEvents_minus1__20[13 * (unsigned int)ptr_507BC0->ptr_1C]); | 997 item = &pPlayers[uActiveCharacter]->pInventoryItems[pItemID - 1]; |
1068 v80 = pPlayers[uActiveCharacter]->_4B8179(p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier); | 998 if ( !(item->uAttributes & 1) ) |
1069 v12 = (int)&pPlayers[uActiveCharacter]->pInventoryItems[v11-1]; | |
1070 if ( !(*(char *)(v12 + 20) & 1) ) | |
1071 { | 999 { |
1072 _this = (ItemGen *)window_SpeakInHouse->ptr_1C; | 1000 if ( MerchandiseTest(item, (int)window_SpeakInHouse->ptr_1C) ) |
1073 if ( MerchandiseTest((ItemGen *)v12, (int)_this) ) | |
1074 { | 1001 { |
1075 if ( pParty->uNumGold >= v80 ) | 1002 if ( pParty->uNumGold >= uPriceItemService ) |
1076 { | 1003 { |
1077 dword_F8B1E4 = 1; | 1004 dword_F8B1E4 = 1; |
1078 Party::TakeGold(v80); | 1005 Party::TakeGold(uPriceItemService); |
1079 *(int *)(v12 + 20) |= 1u; | 1006 item->uAttributes |= 1; |
1080 pPlayers[uActiveCharacter]->PlaySound(SPEECH_73, 0); | 1007 pPlayers[uActiveCharacter]->PlaySound(SPEECH_73, 0); |
1081 v9 = pGlobalTXT_LocalizationStrings[569]; | 1008 ShowStatusBarString(pGlobalTXT_LocalizationStrings[569], 2); |
1082 ShowStatusBarString(v9, 2); | |
1083 return; | 1009 return; |
1084 } | 1010 } |
1085 PlayHouseSound((unsigned int)_this, (HouseSoundID)2); | 1011 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, (HouseSoundID)2); |
1086 return; | 1012 return; |
1087 } | 1013 } |
1088 pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0); | 1014 pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0); |
1089 pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)79, 0); | 1015 pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)79, 0); |
1090 return; | 1016 return; |
1095 } | 1021 } |
1096 break; | 1022 break; |
1097 } | 1023 } |
1098 case HOUSE_DIALOGUE_SHOP_REPAIR: | 1024 case HOUSE_DIALOGUE_SHOP_REPAIR: |
1099 { | 1025 { |
1100 v1 = pMouse->GetCursorPos(&a2)->x - 14; | 1026 v79 = ((pMouse->GetCursorPos(&cursor)->x - 14) >> 5) + 14 * ((pMouse->GetCursorPos(&cursor)->y - 17) >> 5); |
1101 v79 = (v1 >> 5) + 14 * ((pMouse->GetCursorPos(&v70)->y - 17) >> 5); | 1027 if ( pMouse->GetCursorPos(&cursor)->x > 13 ) |
1102 if ( pMouse->GetCursorPos(&v60)->x > 13 ) | 1028 { |
1103 { | 1029 if ( pMouse->GetCursorPos(&cursor)->x < 462 ) |
1104 if ( pMouse->GetCursorPos(&v72)->x < 462 ) | 1030 { |
1105 { | 1031 pItemID = pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v79); |
1106 v2 = v0->GetItemIDAtInventoryIndex((int *)&v79); | 1032 if ( pItemID ) |
1107 if ( v2 ) | |
1108 { | 1033 { |
1109 v3 = (int)&v0->pInventoryItems[v2-1]; | 1034 item = &pPlayers[uActiveCharacter]->pInventoryItems[pItemID - 1]; |
1110 //v4 = p2DEvents_minus1__20[13 * (unsigned int)ptr_507BC0->ptr_1C]; | 1035 pPriceMultiplier = p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier; |
1111 v4 = p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier; | 1036 auto _v = (ItemGen *)&pPlayers[uActiveCharacter]->pInventoryItems[pItemID - 1]; |
1112 auto _v = (ItemGen *)&pPlayers[uActiveCharacter]->pInventoryItems[v2-1]; | 1037 uPriceItemService = pPlayers[uActiveCharacter]->GetPriceRepair(_v->GetValue(), pPriceMultiplier); |
1113 v5 = _v->GetValue(); | 1038 if ( item->uAttributes & 2 ) |
1114 v6 = pPlayers[uActiveCharacter]->_4B81C3(v5, v4); | |
1115 v7 = (*(char *)(v3 + 20) & 2) == 0; | |
1116 v80 = v6; | |
1117 if ( !v7 ) | |
1118 { | 1039 { |
1119 _this = (ItemGen *)window_SpeakInHouse->ptr_1C; | 1040 if ( MerchandiseTest(item, (int)window_SpeakInHouse->ptr_1C) ) |
1120 if ( MerchandiseTest((ItemGen *)v3, (int)_this) ) | |
1121 { | 1041 { |
1122 if ( pParty->uNumGold >= v80 ) | 1042 if ( pParty->uNumGold >= uPriceItemService ) |
1123 { | 1043 { |
1124 dword_F8B1E4 = 1; | 1044 dword_F8B1E4 = 1; |
1125 Party::TakeGold(v80); | 1045 Party::TakeGold(uPriceItemService); |
1126 v8 = *(int *)(v3 + 20); | 1046 v8 = item->uAttributes; |
1127 LOBYTE(v8) = v8 & 0xFD; | 1047 LOBYTE(v8) = v8 & 0xFD; |
1128 *(int *)(v3 + 20) = v8 | 1; | 1048 item->uAttributes = v8 | 1; |
1129 pPlayers[uActiveCharacter]->PlaySound(SPEECH_74, 0); | 1049 pPlayers[uActiveCharacter]->PlaySound(SPEECH_74, 0); |
1130 v9 = pGlobalTXT_LocalizationStrings[570]; | 1050 ShowStatusBarString(pGlobalTXT_LocalizationStrings[570], 2); |
1131 ShowStatusBarString(v9, 2); | |
1132 return; | 1051 return; |
1133 } | 1052 } |
1134 PlayHouseSound((unsigned int)_this, (HouseSoundID)2); | 1053 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, (HouseSoundID)2); |
1135 return; | 1054 return; |
1136 } | 1055 } |
1137 pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0); | 1056 pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0); |
1138 pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)79, 0); | 1057 pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)79, 0); |
1139 return; | 1058 return; |
1146 break; | 1065 break; |
1147 } | 1066 } |
1148 case HOUSE_DIALOGUE_SHOP_BUY_STANDARD: | 1067 case HOUSE_DIALOGUE_SHOP_BUY_STANDARD: |
1149 case HOUSE_DIALOGUE_SHOP_BUY_SPECIAL: | 1068 case HOUSE_DIALOGUE_SHOP_BUY_SPECIAL: |
1150 { | 1069 { |
1151 v28 = pMouse->GetCursorPos(&v59); | 1070 pCursorPos = pMouse->GetCursorPos(&cursor); |
1152 v29 = pRenderer->pActiveZBuffer[v28->x + pSRZBufferLineOffsets[v28->y]] & 0xFFFF; | 1071 v18 = pRenderer->pActiveZBuffer[pCursorPos->x + pSRZBufferLineOffsets[pCursorPos->y]] & 0xFFFF; |
1153 if ( !v29 ) | 1072 if ( !v18 ) |
1154 return; | 1073 return; |
1155 v30 = window_SpeakInHouse->ptr_1C; | |
1156 // v31 = 9 * (v29 - 1 + 12 * (int)v30); | |
1157 if ( dialog_menu_id == HOUSE_DIALOGUE_SHOP_BUY_STANDARD) | 1074 if ( dialog_menu_id == HOUSE_DIALOGUE_SHOP_BUY_STANDARD) |
1158 { | 1075 bought_item = (ItemGen *)&pParty->StandartItemsInShops[(int)window_SpeakInHouse->ptr_1C][v18 - 1]; |
1159 v32 = (ItemGen *)&pParty->StandartItemsInShops[(int)v30][v29 - 1]; | |
1160 _this = (ItemGen *)&pParty->StandartItemsInShops[(int)v30][v29 - 1]; | |
1161 } | |
1162 else | 1076 else |
1163 { | 1077 bought_item = &pParty->SpecialItemsInShops[(int)window_SpeakInHouse->ptr_1C][v18 - 1];//(ItemGen *)&pParty->field_C59C[v31 + 724]; |
1164 _this =&pParty->SpecialItemsInShops[(int)v30][v29-1]; //(ItemGen *)&pParty->field_C59C[v31 + 724]; | 1078 uPriceItemService = pPlayers[uActiveCharacter]->GetBuyingPrice(bought_item->GetValue(), p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier); |
1165 v32 = &pParty->SpecialItemsInShops[(int)v30][v29-1];//(ItemGen *)&pParty->field_C59C[v31 + 724]; | |
1166 } | |
1167 //v33 = p2DEvents_minus1__20[13 * (signed int)v30]; | |
1168 //v33 = p2DEvents[(signed int)v30 - 1].fPriceMultiplier; | |
1169 //v34 = v32->GetValue(); | |
1170 v80 = pPlayers[uActiveCharacter]->GetBuyingPrice(v32->GetValue(), p2DEvents[(unsigned int)v30 - 1].fPriceMultiplier); | |
1171 //LOWORD(v35) = GetAsyncKeyState(VK_CONTROL); | |
1172 v74 = GetAsyncKeyState(VK_CONTROL); | |
1173 //v36 = v0->CanSteal(); | |
1174 uNumSeconds = 0; | 1079 uNumSeconds = 0; |
1175 a3 = 0; | 1080 a3 = 0; |
1176 //v73 = v0->CanSteal(); | 1081 if ( pMapStats->GetMapInfo(pCurrentMapName) ) |
1177 v37 = pMapStats->GetMapInfo(pCurrentMapName); | 1082 a3 = pMapStats->pInfos[pMapStats->GetMapInfo(pCurrentMapName)]._steal_perm; |
1178 if ( v37 ) | 1083 party_reputation = GetPartyReputation(); |
1179 a3 = pMapStats->pInfos[v37]._steal_perm; | |
1180 v38 = GetPartyReputation(); | |
1181 v26 = 1; | |
1182 if (pPlayers[uActiveCharacter]->CanSteal()) | 1084 if (pPlayers[uActiveCharacter]->CanSteal()) |
1183 { | 1085 { |
1184 if ( v74 ) | 1086 if ( GetAsyncKeyState(VK_CONTROL) ) |
1185 { | 1087 { |
1186 uNumSeconds = pPlayers[uActiveCharacter]->StealFromShop(v32, a3, v38, 0, &a6); | 1088 uNumSeconds = pPlayers[uActiveCharacter]->StealFromShop(bought_item, a3, party_reputation, 0, &a6); |
1187 if ( !uNumSeconds ) | 1089 if ( !uNumSeconds ) |
1188 { | 1090 { |
1189 sub_4B1447_party_fine((int)window_SpeakInHouse->ptr_1C, 0, a6); | 1091 sub_4B1447_party_fine((int)window_SpeakInHouse->ptr_1C, 0, a6); |
1190 return; | 1092 return; |
1191 } | 1093 } |
1192 } | 1094 } |
1193 } | 1095 } |
1194 if ( pParty->uNumGold < v80 ) | 1096 if ( pParty->uNumGold < uPriceItemService ) |
1195 { | 1097 { |
1196 v24 = 2; | |
1197 if ( uNumSeconds != 2 ) | 1098 if ( uNumSeconds != 2 ) |
1198 { | 1099 { |
1199 if ( uNumSeconds != 1 ) | 1100 if ( uNumSeconds != 1 ) |
1200 { | 1101 { |
1201 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, (HouseSoundID)v24); | 1102 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, (HouseSoundID)2); |
1202 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2);// "You don't have enough gold" | 1103 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2);// "You don't have enough gold" |
1203 return; | 1104 return; |
1204 } | 1105 } |
1205 } | 1106 } |
1206 } | 1107 } |
1207 v39 = pPlayers[uActiveCharacter]->AddItem(0xFFFFFFFFu, v32->uItemID); | 1108 v39 = pPlayers[uActiveCharacter]->AddItem(0xFFFFFFFFu, bought_item->uItemID); |
1208 if ( v39 ) | 1109 if ( v39 ) |
1209 { | 1110 { |
1210 v32->SetIdentified(); | 1111 bought_item->SetIdentified(); |
1211 v7 = pPlayers[uActiveCharacter]->CanSteal(); | 1112 memcpy(&pPlayers[uActiveCharacter]->pInventoryItems[v39 - 1], bought_item, sizeof(ItemGen)); |
1212 //v40 = (int)((char *)v0 + 36 * v39); | 1113 if ( pPlayers[uActiveCharacter]->CanSteal() ) |
1213 //memcpy((void *)(v40 + 496), v32, 0x24u); | 1114 { |
1214 memcpy(&v0->pInventoryItems[v39 - 1], v32, sizeof(ItemGen)); | 1115 if ( GetAsyncKeyState(VK_CONTROL) ) |
1215 if ( v7 ) | |
1216 { | |
1217 if ( v74 ) | |
1218 { | 1116 { |
1219 v41 = uNumSeconds; | |
1220 if ( uNumSeconds == 1 || uNumSeconds == 2 ) | 1117 if ( uNumSeconds == 1 || uNumSeconds == 2 ) |
1221 { | 1118 { |
1222 //*(char *)(v40 + 517) |= 1u; | |
1223 pPlayers[uActiveCharacter]->pInventoryItems[v39 - 1].SetStolen(); | 1119 pPlayers[uActiveCharacter]->pInventoryItems[v39 - 1].SetStolen(); |
1224 sub_4B1447_party_fine((int)window_SpeakInHouse->ptr_1C, v41, a6); | 1120 sub_4B1447_party_fine((int)window_SpeakInHouse->ptr_1C, uNumSeconds, a6); |
1225 viewparams->bRedrawGameUI = v26; | 1121 viewparams->bRedrawGameUI = 1; |
1226 _this->Reset(); | 1122 bought_item->Reset(); |
1227 pRenderer->ClearZBuffer(0, 479); | 1123 pRenderer->ClearZBuffer(0, 479); |
1228 pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)SPEECH_75, 0); | 1124 pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)SPEECH_75, 0); |
1229 return; | 1125 return; |
1230 } | 1126 } |
1231 } | 1127 } |
1232 } | 1128 } |
1233 dword_F8B1E4 = v26; | 1129 dword_F8B1E4 = 1; |
1234 Party::TakeGold(v80); | 1130 Party::TakeGold(uPriceItemService); |
1235 viewparams->bRedrawGameUI = v26; | 1131 viewparams->bRedrawGameUI = 1; |
1236 _this->Reset(); | 1132 bought_item->Reset(); |
1237 pRenderer->ClearZBuffer(0, 479); | 1133 pRenderer->ClearZBuffer(0, 479); |
1238 pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)SPEECH_75, 0); | 1134 pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)SPEECH_75, 0); |
1239 return; | 1135 return; |
1240 } | 1136 } |
1241 pPlayers[uActiveCharacter]->PlaySound(SPEECH_NoRoom, 0); | 1137 pPlayers[uActiveCharacter]->PlaySound(SPEECH_NoRoom, 0); |
1242 v9 = pGlobalTXT_LocalizationStrings[563]; // "Pack is Full!" | 1138 ShowStatusBarString(pGlobalTXT_LocalizationStrings[563], 2); // "Pack is Full!" |
1243 ShowStatusBarString(v9, 2); | |
1244 break; | 1139 break; |
1245 } | 1140 } |
1246 default:// if click video screen in shop | 1141 default:// if click video screen in shop |
1247 { | 1142 { |
1248 __debugbreak(); // please do record these dialogue ids to the HOUSE_DIALOGUE_MENU enum | 1143 __debugbreak(); // please do record these dialogue ids to the HOUSE_DIALOGUE_MENU enum |
1249 if( dialog_menu_id >= 36 && dialog_menu_id <= 72 ) | 1144 if( dialog_menu_id >= 36 && dialog_menu_id <= 72 ) |
1250 { | 1145 { |
1251 v42 = dialog_menu_id - 36; | 1146 v42 = dialog_menu_id - 36; |
1252 //v43 = (signed __int64)(*(float *)&p2DEvents_minus1__24[13 * (unsigned int)ptr_507BC0->ptr_1C] * 500.0); | 1147 //v43 = (signed __int64)(*(float *)&p2DEvents_minus1__24[13 * (unsigned int)ptr_507BC0->ptr_1C] * 500.0); |
1253 v43 = (signed __int64)(p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].flt_24 * 500.0); | 1148 v43 = (signed __int64)(p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].flt_24 * 500.0); |
1254 v44 = v43 * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100; | 1149 uPriceItemService = v43 * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100; |
1255 if ( v44 < v43 / 3 ) | 1150 if ( uPriceItemService < v43 / 3 ) |
1256 v44 = v43 / 3; | 1151 uPriceItemService = v43 / 3; |
1257 if ( byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][v42] ) | 1152 if ( byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][v42] ) |
1258 { | 1153 { |
1259 pSkill = &pPlayers[uActiveCharacter]->pActiveSkills[v42]; | 1154 pSkill = &pPlayers[uActiveCharacter]->pActiveSkills[v42]; |
1260 if ( !*pSkill ) | 1155 if ( !*pSkill ) |
1261 { | 1156 { |
1262 if ( pParty->uNumGold < v44 ) | 1157 if ( pParty->uNumGold < uPriceItemService ) |
1263 { | 1158 { |
1264 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2);// "You don't have enough gold" | 1159 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2);// "You don't have enough gold" |
1265 if ( in_current_building_type == BildingType_Training ) | 1160 if ( in_current_building_type == BildingType_Training ) |
1266 v55 = 4; | 1161 v55 = 4; |
1267 else | 1162 else |
1268 v55 = 2; | 1163 v55 = 2; |
1269 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, (HouseSoundID)v55); | 1164 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, (HouseSoundID)v55); |
1270 return; | 1165 return; |
1271 } | 1166 } |
1272 Party::TakeGold(v44); | 1167 Party::TakeGold(uPriceItemService); |
1273 dword_F8B1E4 = 1; | 1168 dword_F8B1E4 = 1; |
1274 *pSkill = 1; | 1169 *pSkill = 1; |
1275 pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)78, 0); | 1170 pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)78, 0); |
1276 return; | 1171 return; |
1277 } | 1172 } |
9464 void __cdecl OnPaperdollLeftClick() | 9359 void __cdecl OnPaperdollLeftClick() |
9465 { | 9360 { |
9466 int v1; // ecx@1 | 9361 int v1; // ecx@1 |
9467 unsigned int v2; // edi@1 | 9362 unsigned int v2; // edi@1 |
9468 unsigned int v3; // edx@4 | 9363 unsigned int v3; // edx@4 |
9469 unsigned int v4; // esi@5 | 9364 unsigned int pSkillType; // esi@5 |
9470 unsigned __int16 v5; // ax@7 | 9365 unsigned __int16 v5; // ax@7 |
9471 unsigned int v6; // edi@19 | 9366 unsigned int v6; // edi@19 |
9472 int v7; // esi@27 | 9367 int v7; // esi@27 |
9473 unsigned int v8; // eax@29 | 9368 unsigned int v8; // eax@29 |
9474 int v9; // edx@32 | 9369 int v9; // edx@32 |
9506 unsigned int v48; // [sp+30h] [bp-1Ch]@88 | 9401 unsigned int v48; // [sp+30h] [bp-1Ch]@88 |
9507 unsigned int v49; // [sp+34h] [bp-18h]@57 | 9402 unsigned int v49; // [sp+34h] [bp-18h]@57 |
9508 unsigned int v50; // [sp+38h] [bp-14h]@50 | 9403 unsigned int v50; // [sp+38h] [bp-14h]@50 |
9509 int v51; // [sp+3Ch] [bp-10h]@1 | 9404 int v51; // [sp+3Ch] [bp-10h]@1 |
9510 unsigned int v52; // [sp+40h] [bp-Ch]@5 | 9405 unsigned int v52; // [sp+40h] [bp-Ch]@5 |
9511 int v53; // [sp+44h] [bp-8h]@1 | 9406 //int v53; // [sp+44h] [bp-8h]@1 |
9512 unsigned int v54; // [sp+48h] [bp-4h]@1 | 9407 //unsigned int v54; // [sp+48h] [bp-4h]@1 |
9513 | 9408 |
9514 v51 = 0; | 9409 v51 = 0; |
9515 _this.Reset(); | 9410 _this.Reset(); |
9516 //v0 = pPlayers[uActiveCharacter]; | 9411 //v0 = pPlayers[uActiveCharacter]; |
9517 v1 = pPlayers[uActiveCharacter]->pEquipment.uMainHand; | 9412 v1 = pPlayers[uActiveCharacter]->pEquipment.uMainHand; |
9518 v2 = pPlayers[uActiveCharacter]->pEquipment.uShield; | 9413 v2 = pPlayers[uActiveCharacter]->pEquipment.uShield; |
9519 v54 = pPlayers[uActiveCharacter]->pEquipment.uShield; | 9414 //v54 = pPlayers[uActiveCharacter]->pEquipment.uShield; |
9520 v53 = v1; | 9415 //v53 = v1; |
9521 if ( v1 && pItemsTable->pItems[*(int *)&pPlayers[uActiveCharacter]->pInventoryItems[v1-1]].uEquipType == 1 ) | 9416 if ( v1 && pItemsTable->pItems[*(int *)&pPlayers[uActiveCharacter]->pInventoryItems[v1 - 1]].uEquipType == 1 ) |
9522 v51 = v1; | 9417 v51 = v1; |
9523 v3 = pParty->pPickedItem.uItemID; | 9418 v3 = pParty->pPickedItem.uItemID; |
9524 if ( pParty->pPickedItem.uItemID ) | 9419 if ( pParty->pPickedItem.uItemID ) |
9525 { | 9420 { |
9526 v52 = pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType; | 9421 v52 = pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType; |
9527 v4 = pItemsTable->pItems[pParty->pPickedItem.uItemID].uSkillType; | 9422 pSkillType = pItemsTable->pItems[pParty->pPickedItem.uItemID].uSkillType; |
9528 if ( v4 == 4 ) | 9423 if ( pSkillType == 4 ) |
9529 { | 9424 { |
9530 if ( v2 ) | 9425 if ( v2 ) |
9531 { | 9426 { |
9532 LOBYTE(v5) = pPlayers[uActiveCharacter]->GetActualSkillLevel(PLAYER_SKILL_SPEAR); | 9427 LOBYTE(v5) = pPlayers[uActiveCharacter]->GetActualSkillLevel(PLAYER_SKILL_SPEAR); |
9533 if ( (signed int)SkillToMastery(v5) < 3 ) | 9428 if ( (signed int)SkillToMastery(v5) < 3 ) |
9538 v3 = pParty->pPickedItem.uItemID; | 9433 v3 = pParty->pPickedItem.uItemID; |
9539 } | 9434 } |
9540 } | 9435 } |
9541 else | 9436 else |
9542 { | 9437 { |
9543 if ( (v4 == 8 || v4 == 1 || v4 == 2) | 9438 if ( (pSkillType == 8 || pSkillType == 1 || pSkillType == 2) |
9544 && v1 | 9439 && v1 |
9545 && pItemsTable->pItems[*(int *)&pPlayers[uActiveCharacter]->pInventoryItems[v1-1]].uSkillType == 4 ) | 9440 && pItemsTable->pItems[*(int *)&pPlayers[uActiveCharacter]->pInventoryItems[v1-1]].uSkillType == 4 ) |
9546 { | 9441 { |
9547 LOBYTE(v5) = pPlayers[uActiveCharacter]->GetActualSkillLevel(PLAYER_SKILL_SPEAR); | 9442 LOBYTE(v5) = pPlayers[uActiveCharacter]->GetActualSkillLevel(PLAYER_SKILL_SPEAR); |
9548 if ( (signed int)SkillToMastery(v5) < 3 ) | 9443 if ( (signed int)SkillToMastery(v5) < 3 ) |
9573 case 6u: | 9468 case 6u: |
9574 case 7u: | 9469 case 7u: |
9575 case 8u: | 9470 case 8u: |
9576 case 9u: | 9471 case 9u: |
9577 case 0xBu: | 9472 case 0xBu: |
9578 if ( !pPlayers[uActiveCharacter]->HasSkill(v4) ) | 9473 if ( !pPlayers[uActiveCharacter]->HasSkill(pSkillType) ) |
9579 { | 9474 { |
9580 pPlayers[uActiveCharacter]->PlaySound(SPEECH_39, 0); | 9475 pPlayers[uActiveCharacter]->PlaySound(SPEECH_39, 0); |
9581 return; | 9476 return; |
9582 } | 9477 } |
9583 if ( sub_43EE77_ProbablyIfUnderwaterSuitIsEquipped(uActiveCharacter) && (v6 != 3 || bUnderwater) ) | 9478 if ( sub_43EE77_ProbablyIfUnderwaterSuitIsEquipped(uActiveCharacter) && (v6 != 3 || bUnderwater) ) |
9635 if ( sub_43EE77_ProbablyIfUnderwaterSuitIsEquipped(uActiveCharacter) ) | 9530 if ( sub_43EE77_ProbablyIfUnderwaterSuitIsEquipped(uActiveCharacter) ) |
9636 { | 9531 { |
9637 pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0); | 9532 pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0); |
9638 return; | 9533 return; |
9639 } | 9534 } |
9640 if ( !pPlayers[uActiveCharacter]->HasSkill(v4) ) | 9535 if ( !pPlayers[uActiveCharacter]->HasSkill(pSkillType) ) |
9641 { | 9536 { |
9642 pPlayers[uActiveCharacter]->PlaySound(SPEECH_39, 0); | 9537 pPlayers[uActiveCharacter]->PlaySound(SPEECH_39, 0); |
9643 return; | 9538 return; |
9644 } | 9539 } |
9645 if ( v54 ) | 9540 if ( v2 ) |
9646 { | 9541 { |
9647 --v54; | 9542 --v2; |
9648 memcpy(&_this, &pParty->pPickedItem, sizeof(_this)); | 9543 memcpy(&_this, &pParty->pPickedItem, sizeof(_this)); |
9649 v12 = (int)((char *)pPlayers[uActiveCharacter] + 36 * v54); | 9544 v12 = (int)((char *)pPlayers[uActiveCharacter] + 36 * v2); |
9650 *(char *)(v12 + 556) = 0; | 9545 *(char *)(v12 + 556) = 0; |
9651 pParty->pPickedItem.Reset(); | 9546 pParty->pPickedItem.Reset(); |
9652 pParty->SetHoldingItem((ItemGen *)(v12 + 532)); | 9547 pParty->SetHoldingItem((ItemGen *)(v12 + 532)); |
9653 _this.uBodyAnchor = 1; | 9548 _this.uBodyAnchor = 1; |
9654 v13 = v54 + 1; | 9549 v13 = v2 + 1; |
9655 v14 = v51 == 0; | 9550 v14 = v51 == 0; |
9656 memcpy((void *)(v12 + 532), &_this, 0x24u); | 9551 memcpy((void *)(v12 + 532), &_this, 0x24u); |
9657 pPlayers[uActiveCharacter]->pEquipment.uShield = v13; | 9552 pPlayers[uActiveCharacter]->pEquipment.uShield = v13; |
9658 if ( v14 ) | 9553 if ( v14 ) |
9659 return; | 9554 return; |
9671 pPlayers[uActiveCharacter]->pEquipment.uShield = v17; | 9566 pPlayers[uActiveCharacter]->pEquipment.uShield = v17; |
9672 pMouse->RemoveHoldingItem(); | 9567 pMouse->RemoveHoldingItem(); |
9673 return; | 9568 return; |
9674 } | 9569 } |
9675 memcpy(&_this, &pParty->pPickedItem, sizeof(_this)); | 9570 memcpy(&_this, &pParty->pPickedItem, sizeof(_this)); |
9676 v15 = (int)((char *)pPlayers[uActiveCharacter] + 36 * (v53 - 1)); | 9571 v15 = (int)((char *)pPlayers[uActiveCharacter] + 36 * (v1 - 1)); |
9677 *(char *)(v15 + 556) = 0; | 9572 *(char *)(v15 + 556) = 0; |
9678 pParty->pPickedItem.Reset(); | 9573 pParty->pPickedItem.Reset(); |
9679 pParty->SetHoldingItem((ItemGen *)(v15 + 532)); | 9574 pParty->SetHoldingItem((ItemGen *)(v15 + 532)); |
9680 _this.uBodyAnchor = 1; | 9575 _this.uBodyAnchor = 1; |
9681 v16 = v52 + 1; | 9576 v16 = v52 + 1; |
9691 && pParty->pPickedItem.uItemID != 65 ) | 9586 && pParty->pPickedItem.uItemID != 65 ) |
9692 { | 9587 { |
9693 pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0); | 9588 pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0); |
9694 return; | 9589 return; |
9695 } | 9590 } |
9696 if ( !pPlayers[uActiveCharacter]->HasSkill(v4) ) | 9591 if ( !pPlayers[uActiveCharacter]->HasSkill(pSkillType) ) |
9697 { | 9592 { |
9698 pPlayers[uActiveCharacter]->PlaySound(SPEECH_39, 0); | 9593 pPlayers[uActiveCharacter]->PlaySound(SPEECH_39, 0); |
9699 return; | 9594 return; |
9700 } | 9595 } |
9701 v50 = 0; | 9596 v50 = 0; |
9702 if ( v4 == 2 && (unsigned __int16)(pPlayers[uActiveCharacter]->pActiveSkills[2] & 0xFFC0) | 9597 if ( pSkillType == 2 && (unsigned __int16)(pPlayers[uActiveCharacter]->pActiveSkills[2] & 0xFFC0) |
9703 || v4 == 1 && (signed int)SkillToMastery(pPlayers[uActiveCharacter]->pActiveSkills[1]) >= 3 ) | 9598 || pSkillType == 1 && (signed int)SkillToMastery(pPlayers[uActiveCharacter]->pActiveSkills[1]) >= 3 ) |
9704 { | 9599 { |
9705 if (pAsyncMouse) | 9600 if (pAsyncMouse) |
9706 { | 9601 { |
9707 v18 = *((int *)pAsyncMouse + 6); | 9602 v18 = *((int *)pAsyncMouse + 6); |
9708 v19 = *((int *)pAsyncMouse + 7); | 9603 v19 = *((int *)pAsyncMouse + 7); |
9715 v49 = v19; | 9610 v49 = v19; |
9716 if ( (signed int)v18 >= 560 ) | 9611 if ( (signed int)v18 >= 560 ) |
9717 { | 9612 { |
9718 if ( !v51 ) | 9613 if ( !v51 ) |
9719 { | 9614 { |
9720 if ( v54 ) | 9615 if ( v2 ) |
9721 { | 9616 { |
9722 --v54; | 9617 --v2; |
9723 memcpy(&_this, &pParty->pPickedItem, sizeof(_this)); | 9618 memcpy(&_this, &pParty->pPickedItem, sizeof(_this)); |
9724 v20 = (int)((char *)pPlayers[uActiveCharacter] + 36 * v54); | 9619 v20 = (int)((char *)pPlayers[uActiveCharacter] + 36 * v2); |
9725 *(char *)(v20 + 556) = 0; | 9620 *(char *)(v20 + 556) = 0; |
9726 pParty->pPickedItem.Reset(); | 9621 pParty->pPickedItem.Reset(); |
9727 pParty->SetHoldingItem((ItemGen *)(v20 + 532)); | 9622 pParty->SetHoldingItem((ItemGen *)(v20 + 532)); |
9728 _this.uBodyAnchor = 1; | 9623 _this.uBodyAnchor = 1; |
9729 v21 = v54 + 1; | 9624 v21 = v2 + 1; |
9730 v14 = v52 == 12; | 9625 v14 = v52 == 12; |
9731 memcpy((void *)(v20 + 532), &_this, 0x24u); | 9626 memcpy((void *)(v20 + 532), &_this, 0x24u); |
9732 pPlayers[uActiveCharacter]->pEquipment.uShield = v21; | 9627 pPlayers[uActiveCharacter]->pEquipment.uShield = v21; |
9733 if ( !v14 ) | 9628 if ( !v14 ) |
9734 return; | 9629 return; |
9735 v22 = _this.uItemID; | 9630 v22 = _this.uItemID; |
9736 v50 = v22; | 9631 v50 = v22; |
9737 if ( v50 ) | 9632 if ( v50 ) |
9738 { | 9633 { |
9739 __debugbreak(); // looks like offset in player's inventory and wand_lut much like case in 0042ECB5 | 9634 __debugbreak(); // looks like offset in player's inventory and wand_lut much like case in 0042ECB5 |
9740 stru_A750F8[uActiveCharacter - 1]._494836( | 9635 stru_A750F8[uActiveCharacter - 1]._494836(*((int *)&pSpellDatas[66].uNormalLevelRecovery + v50), uActiveCharacter - 1 + 9); |
9741 *((int *)&pSpellDatas[66].uNormalLevelRecovery + v50), | |
9742 uActiveCharacter - 1 + 9); | |
9743 } | 9636 } |
9744 break; | 9637 break; |
9745 } | 9638 } |
9746 v23 = pPlayers[uActiveCharacter]->FindFreeInventorySlot(); | 9639 v23 = pPlayers[uActiveCharacter]->FindFreeInventorySlot(); |
9747 if ( (v23 & 0x80000000u) != 0 ) | 9640 if ( (v23 & 0x80000000u) != 0 ) |
9756 v22 = *(int *)v50; | 9649 v22 = *(int *)v50; |
9757 v50 = v22; | 9650 v50 = v22; |
9758 if ( v50 ) | 9651 if ( v50 ) |
9759 { | 9652 { |
9760 __debugbreak(); // looks like offset in player's inventory and wand_lut much like case in 0042ECB5 | 9653 __debugbreak(); // looks like offset in player's inventory and wand_lut much like case in 0042ECB5 |
9761 stru_A750F8[uActiveCharacter - 1]._494836( | 9654 stru_A750F8[uActiveCharacter - 1]._494836(*((int *)&pSpellDatas[66].uNormalLevelRecovery + v50), uActiveCharacter - 1 + 9); |
9762 *((int *)&pSpellDatas[66].uNormalLevelRecovery + v50), uActiveCharacter - 1 + 9); | |
9763 } | 9655 } |
9764 break; | 9656 break; |
9765 } | 9657 } |
9766 } | 9658 } |
9767 } | 9659 } |
9768 if ( !v53 ) | 9660 if ( !v1 ) |
9769 { | 9661 { |
9770 v26 = pPlayers[uActiveCharacter]->FindFreeInventorySlot(); | 9662 v26 = pPlayers[uActiveCharacter]->FindFreeInventorySlot(); |
9771 if ( (v26 & 0x80000000u) != 0 ) | 9663 if ( (v26 & 0x80000000u) != 0 ) |
9772 return; | 9664 return; |
9773 pParty->pPickedItem.uBodyAnchor = 2; | 9665 pParty->pPickedItem.uBodyAnchor = 2; |
9780 v22 = *(int *)v50; | 9672 v22 = *(int *)v50; |
9781 v50 = v22; | 9673 v50 = v22; |
9782 if ( v50 ) | 9674 if ( v50 ) |
9783 { | 9675 { |
9784 __debugbreak(); // looks like offset in player's inventory and wand_lut much like case in 0042ECB5 | 9676 __debugbreak(); // looks like offset in player's inventory and wand_lut much like case in 0042ECB5 |
9785 stru_A750F8[uActiveCharacter - 1]._494836( | 9677 stru_A750F8[uActiveCharacter - 1]._494836(*((int *)&pSpellDatas[66].uNormalLevelRecovery + v50), uActiveCharacter - 1 + 9); |
9786 *((int *)&pSpellDatas[66].uNormalLevelRecovery + v50), | |
9787 uActiveCharacter - 1 + 9); | |
9788 } | 9678 } |
9789 break; | 9679 break; |
9790 } | 9680 } |
9791 --v53; | 9681 --v1; |
9792 memcpy(&_this, &pParty->pPickedItem, sizeof(_this)); | 9682 memcpy(&_this, &pParty->pPickedItem, sizeof(_this)); |
9793 v24 = (int)((char *)pPlayers[uActiveCharacter] + 36 * v53); | 9683 v24 = (int)((char *)pPlayers[uActiveCharacter] + 36 * v1); |
9794 *(char *)(v24 + 556) = 0; | 9684 *(char *)(v24 + 556) = 0; |
9795 pParty->pPickedItem.Reset(); | 9685 pParty->pPickedItem.Reset(); |
9796 pParty->SetHoldingItem((ItemGen *)(v24 + 532)); | 9686 pParty->SetHoldingItem((ItemGen *)(v24 + 532)); |
9797 _this.uBodyAnchor = 2; | 9687 _this.uBodyAnchor = 2; |
9798 v25 = v53 + 1; | 9688 v25 = v1 + 1; |
9799 v14 = v52 == 12; | 9689 v14 = v52 == 12; |
9800 memcpy((void *)(v24 + 532), &_this, 0x24u); | 9690 memcpy((void *)(v24 + 532), &_this, 0x24u); |
9801 pPlayers[uActiveCharacter]->pEquipment.uMainHand = v25; | 9691 pPlayers[uActiveCharacter]->pEquipment.uMainHand = v25; |
9802 if ( v14 ) | 9692 if ( v14 ) |
9803 v50 = _this.uItemID; | 9693 v50 = _this.uItemID; |
9804 if ( v51 ) | 9694 if ( v51 ) |
9805 pPlayers[uActiveCharacter]->pEquipment.uShield = 0; | 9695 pPlayers[uActiveCharacter]->pEquipment.uShield = 0; |
9806 if ( v50 ) | 9696 if ( v50 ) |
9807 { | 9697 { |
9808 __debugbreak(); // looks like offset in player's inventory and wand_lut much like case in 0042ECB5 | 9698 __debugbreak(); // looks like offset in player's inventory and wand_lut much like case in 0042ECB5 |
9809 stru_A750F8[uActiveCharacter - 1]._494836( | 9699 stru_A750F8[uActiveCharacter - 1]._494836( *((int *)&pSpellDatas[66].uNormalLevelRecovery + v50), uActiveCharacter - 1 + 9); |
9810 *((int *)&pSpellDatas[66].uNormalLevelRecovery + v50), | |
9811 uActiveCharacter - 1 + 9); | |
9812 } | 9700 } |
9813 break; | 9701 break; |
9814 case 1u: | 9702 case 1u: |
9815 if ( sub_43EE77_ProbablyIfUnderwaterSuitIsEquipped(uActiveCharacter) ) | 9703 if ( sub_43EE77_ProbablyIfUnderwaterSuitIsEquipped(uActiveCharacter) ) |
9816 { | 9704 { |
9817 pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0); | 9705 pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0); |
9818 return; | 9706 return; |
9819 } | 9707 } |
9820 if ( !pPlayers[uActiveCharacter]->HasSkill(v4) ) | 9708 if ( !pPlayers[uActiveCharacter]->HasSkill(pSkillType) ) |
9821 { | 9709 { |
9822 pPlayers[uActiveCharacter]->PlaySound(SPEECH_39, 0); | 9710 pPlayers[uActiveCharacter]->PlaySound(SPEECH_39, 0); |
9823 return; | 9711 return; |
9824 } | 9712 } |
9825 if ( v53 ) | 9713 if ( v1 ) |
9826 { | 9714 { |
9827 if ( v54 ) | 9715 if ( v2 ) |
9828 { | 9716 { |
9829 pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0); | 9717 pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0); |
9830 return; | 9718 return; |
9831 } | 9719 } |
9832 --v53; | 9720 --v1; |
9833 memcpy(&_this, &pParty->pPickedItem, sizeof(_this)); | 9721 memcpy(&_this, &pParty->pPickedItem, sizeof(_this)); |
9834 v27 = (int)((char *)pPlayers[uActiveCharacter] + 36 * v53); | 9722 v27 = (int)((char *)pPlayers[uActiveCharacter] + 36 * v1); |
9835 *(char *)(v27 + 556) = 0; | 9723 *(char *)(v27 + 556) = 0; |
9836 pParty->pPickedItem.Reset(); | 9724 pParty->pPickedItem.Reset(); |
9837 pParty->SetHoldingItem((ItemGen *)(v27 + 532)); | 9725 pParty->SetHoldingItem((ItemGen *)(v27 + 532)); |
9838 _this.uBodyAnchor = 2; | 9726 _this.uBodyAnchor = 2; |
9839 v28 = v53 + 1; | 9727 v28 = v1 + 1; |
9840 memcpy((void *)(v27 + 532), &_this, 0x24u); | 9728 memcpy((void *)(v27 + 532), &_this, 0x24u); |
9841 pPlayers[uActiveCharacter]->pEquipment.uMainHand = v28; | 9729 pPlayers[uActiveCharacter]->pEquipment.uMainHand = v28; |
9842 } | 9730 } |
9843 else | 9731 else |
9844 { | 9732 { |
9845 v52 = pPlayers[uActiveCharacter]->FindFreeInventorySlot(); | 9733 v52 = pPlayers[uActiveCharacter]->FindFreeInventorySlot(); |
9846 if ( (v52 & 0x80000000u) == 0 ) | 9734 if ( (v52 & 0x80000000u) == 0 ) |
9847 { | 9735 { |
9848 if ( v54 ) | 9736 if ( v2 ) |
9849 { | 9737 { |
9850 memcpy(&_this, &pParty->pPickedItem, sizeof(_this)); | 9738 memcpy(&_this, &pParty->pPickedItem, sizeof(_this)); |
9851 v29 = (int)((char *)pPlayers[uActiveCharacter] + 36 * (v54 - 1)); | 9739 v29 = (int)((char *)pPlayers[uActiveCharacter] + 36 * (v2 - 1)); |
9852 *(char *)(v29 + 556) = 0; | 9740 *(char *)(v29 + 556) = 0; |
9853 pParty->pPickedItem.Reset(); | 9741 pParty->pPickedItem.Reset(); |
9854 pParty->SetHoldingItem((ItemGen *)(v29 + 532)); | 9742 pParty->SetHoldingItem((ItemGen *)(v29 + 532)); |
9855 _this.uBodyAnchor = 2; | 9743 _this.uBodyAnchor = 2; |
9856 v30 = v52 + 1; | 9744 v30 = v52 + 1; |
9934 else | 9822 else |
9935 { | 9823 { |
9936 v35 = pPlayers[uActiveCharacter]->pEquipment.uBow; | 9824 v35 = pPlayers[uActiveCharacter]->pEquipment.uBow; |
9937 if ( v35 ) | 9825 if ( v35 ) |
9938 { | 9826 { |
9939 auto _a = (ItemGen *)&pPlayers[uActiveCharacter]->pInventoryItems[v35-1]; | 9827 auto _a = (ItemGen *)&pPlayers[uActiveCharacter]->pInventoryItems[v35 - 1]; |
9940 pParty->SetHoldingItem(_a); | 9828 pParty->SetHoldingItem(_a); |
9941 _a->Reset(); | 9829 _a->Reset(); |
9942 pPlayers[uActiveCharacter]->pEquipment.uBow = 0; | 9830 pPlayers[uActiveCharacter]->pEquipment.uBow = 0; |
9943 } | 9831 } |
9944 } | 9832 } |