Mercurial > mm7
comparison Engine/Party.cpp @ 2575:a76d408c5132 tip
DrawTranslucent -> DrawTextureGrayShade
Removed old texture drawing stuff
author | a.parshin |
---|---|
date | Wed, 09 Mar 2016 01:39:52 +0200 |
parents | dd36326a9994 |
children |
comparison
equal
deleted
inserted
replaced
2574:dd36326a9994 | 2575:a76d408c5132 |
---|---|
35 char PickedPlayer3_unused; // byte_AE336A_ | 35 char PickedPlayer3_unused; // byte_AE336A_ |
36 char PickedPlayer4_unused; // byte_AE336B_ | 36 char PickedPlayer4_unused; // byte_AE336B_ |
37 | 37 |
38 | 38 |
39 | 39 |
40 struct | |
41 { | |
42 struct UIAnimation _pUIAnim_Food; | |
43 struct UIAnimation _pUIAnim_Gold; | |
44 struct UIAnimation _pUIAnum_Torchlight; | |
45 struct UIAnimation _pUIAnim_WizardEye; | |
46 } _uianim; | |
47 | |
48 struct UIAnimation *pUIAnim_Food = &_uianim._pUIAnim_Food; | |
49 struct UIAnimation *pUIAnim_Gold = &_uianim._pUIAnim_Gold; | |
50 struct UIAnimation *pUIAnum_Torchlight = &_uianim._pUIAnum_Torchlight; | |
51 struct UIAnimation *pUIAnim_WizardEye = &_uianim._pUIAnim_WizardEye; | |
52 | |
53 std::array<struct UIAnimation *, 4> pUIAnims = | |
54 { | |
55 &_uianim._pUIAnim_Food, | |
56 &_uianim._pUIAnim_Gold, | |
57 &_uianim._pUIAnum_Torchlight, | |
58 &_uianim._pUIAnim_WizardEye | |
59 }; | |
60 | |
61 | |
62 | |
40 //----- (0044A56A) -------------------------------------------------------- | 63 //----- (0044A56A) -------------------------------------------------------- |
41 void Party::CountHirelings() | 64 void Party::CountHirelings() |
42 { | 65 { |
43 field_70A = 0; | 66 field_70A = 0; |
44 | 67 |
216 //----- (00492AD5) -------------------------------------------------------- | 239 //----- (00492AD5) -------------------------------------------------------- |
217 void Party::SetFood(unsigned int uNumFood) | 240 void Party::SetFood(unsigned int uNumFood) |
218 { | 241 { |
219 pUIAnim_Food->uAnimTime = 0; | 242 pUIAnim_Food->uAnimTime = 0; |
220 pParty->uNumFoodRations = uNumFood; | 243 pParty->uNumFoodRations = uNumFood; |
221 pUIAnim_Food->uAnimLength = 8 * pIconsFrameTable->pIcons[pUIAnim_Food->uIconID].uAnimLength; | 244 pUIAnim_Food->uAnimLength = pUIAnim_Food->icon->GetAnimLength(); |
222 } | 245 } |
223 | 246 |
224 //----- (00492B03) -------------------------------------------------------- | 247 //----- (00492B03) -------------------------------------------------------- |
225 void Party::TakeFood(unsigned int uNumFood) | 248 void Party::TakeFood(unsigned int uNumFood) |
226 { | 249 { |
228 pParty->uNumFoodRations = 0; | 251 pParty->uNumFoodRations = 0; |
229 else | 252 else |
230 pParty->uNumFoodRations -= uNumFood; | 253 pParty->uNumFoodRations -= uNumFood; |
231 | 254 |
232 pUIAnim_Food->uAnimTime = 0; | 255 pUIAnim_Food->uAnimTime = 0; |
233 pUIAnim_Food->uAnimLength = 8 * pIconsFrameTable->pIcons[pUIAnim_Food->uIconID].uAnimLength; | 256 pUIAnim_Food->uAnimLength = pUIAnim_Food->icon->GetAnimLength(); |
234 } | 257 } |
235 | 258 |
236 //----- (00492B42) -------------------------------------------------------- | 259 //----- (00492B42) -------------------------------------------------------- |
237 void Party::GiveFood(unsigned int _this) | 260 void Party::GiveFood(unsigned int _this) |
238 { | 261 { |
239 pParty->uNumFoodRations += _this; | 262 pParty->uNumFoodRations += _this; |
240 pUIAnim_Food->uAnimTime = 0; | 263 pUIAnim_Food->uAnimTime = 0; |
241 pUIAnim_Food->uAnimLength = 8 * pIconsFrameTable->pIcons[pUIAnim_Food->uIconID].uAnimLength; | 264 pUIAnim_Food->uAnimLength = pUIAnim_Food->icon->GetAnimLength(); |
242 } | 265 } |
243 | 266 |
244 //----- (00492B70) -------------------------------------------------------- | 267 //----- (00492B70) -------------------------------------------------------- |
245 void Party::SetGold(unsigned int uNumGold) | 268 void Party::SetGold(unsigned int uNumGold) |
246 { | 269 { |
247 pParty->uNumGold = uNumGold; | 270 pParty->uNumGold = uNumGold; |
248 pUIAnim_Gold->uAnimTime = 0; | 271 pUIAnim_Gold->uAnimTime = 0; |
249 pUIAnim_Gold->uAnimLength = 8 * pIconsFrameTable->pIcons[pUIAnim_Gold->uIconID].uAnimLength; | 272 pUIAnim_Gold->uAnimLength = pUIAnim_Gold->icon->GetAnimLength(); |
250 pAudioPlayer->PlaySound(SOUND_gold01, 0, 0, -1, 0, 0, 0, 0); | 273 pAudioPlayer->PlaySound(SOUND_gold01, 0, 0, -1, 0, 0, 0, 0); |
251 } | 274 } |
252 | 275 |
253 //----- (00492BB6) -------------------------------------------------------- | 276 //----- (00492BB6) -------------------------------------------------------- |
254 void Party::TakeGold(unsigned int uNumGold) | 277 void Party::TakeGold(unsigned int uNumGold) |
256 if ( uNumGold <= pParty->uNumGold ) | 279 if ( uNumGold <= pParty->uNumGold ) |
257 pParty->uNumGold -= uNumGold; | 280 pParty->uNumGold -= uNumGold; |
258 else | 281 else |
259 pParty->uNumGold = 0; | 282 pParty->uNumGold = 0; |
260 pUIAnim_Gold->uAnimTime = 0; | 283 pUIAnim_Gold->uAnimTime = 0; |
261 pUIAnim_Gold->uAnimLength = 8 * pIconsFrameTable->pIcons[pUIAnim_Gold->uIconID].uAnimLength; | 284 pUIAnim_Gold->uAnimLength = pUIAnim_Gold->icon->GetAnimLength(); |
262 pAudioPlayer->PlaySound(SOUND_gold01, 0, 0, -1, 0, 0, 0, 0); | 285 pAudioPlayer->PlaySound(SOUND_gold01, 0, 0, -1, 0, 0, 0, 0); |
263 } | 286 } |
264 | 287 |
265 //----- (0049135E) -------------------------------------------------------- | 288 //----- (0049135E) -------------------------------------------------------- |
266 unsigned int Party::GetPartyFame() | 289 unsigned int Party::GetPartyFame() |
1013 sprintf(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[467], goldToGain);// You found %lu gold! | 1036 sprintf(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[467], goldToGain);// You found %lu gold! |
1014 } | 1037 } |
1015 } | 1038 } |
1016 this->uNumGold += goldToGain - hirelingSalaries; | 1039 this->uNumGold += goldToGain - hirelingSalaries; |
1017 pUIAnim_Gold->uAnimTime = 0; | 1040 pUIAnim_Gold->uAnimTime = 0; |
1018 pUIAnim_Gold->uAnimLength = 8 * pIconsFrameTable->pIcons[(signed __int16)pUIAnim_Gold->uIconID].uAnimLength; | 1041 pUIAnim_Gold->uAnimLength = pUIAnim_Gold->icon->GetAnimLength(); |
1019 if ( pTmpBuf2[0] ) | 1042 if ( pTmpBuf2[0] ) |
1020 ShowStatusBarString(pTmpBuf2.data(), 2u); | 1043 ShowStatusBarString(pTmpBuf2.data(), 2u); |
1021 pAudioPlayer->PlaySound(SOUND_gold01, 0, 0, -1, 0, 0, 0, 0); | 1044 pAudioPlayer->PlaySound(SOUND_gold01, 0, 0, -1, 0, 0, 0, 0); |
1022 } | 1045 } |
1023 //----- (00421B2C) -------------------------------------------------------- | 1046 //----- (00421B2C) -------------------------------------------------------- |
1024 void Party::sub_421B2C_PlaceInInventory_or_DropPickedItem() | 1047 void Party::sub_421B2C_PlaceInInventory_or_DropPickedItem() |
1025 { | 1048 { |
1026 unsigned int v0; // eax@2 | 1049 //unsigned int v0; // eax@2 |
1027 Texture_MM7 *v1; // ebx@2 | 1050 //Texture_MM7 *v1; // ebx@2 |
1028 int v2; // eax@3 | 1051 int v2; // eax@3 |
1029 int v4; // eax@6 | 1052 int v4; // eax@6 |
1030 unsigned __int16 v5; // dx@11 | 1053 unsigned __int16 v5; // dx@11 |
1031 signed int v6; // eax@11 | 1054 signed int v6; // eax@11 |
1032 __int16 v8; // ax@16 | 1055 __int16 v8; // ax@16 |
1033 SpriteObject a1; // [sp+4h] [bp-78h]@11 | 1056 SpriteObject a1; // [sp+4h] [bp-78h]@11 |
1034 int v11; // [sp+74h] [bp-8h]@2 | 1057 //int v11; // [sp+74h] [bp-8h]@2 |
1035 int v12; // [sp+78h] [bp-4h]@5 | 1058 int v12; // [sp+78h] [bp-4h]@5 |
1036 | 1059 |
1037 if ( !pParty->pPickedItem.uItemID ) | 1060 if ( !pParty->pPickedItem.uItemID ) |
1038 return; | 1061 return; |
1039 v0 = pIcons_LOD->LoadTexture( | 1062 |
1040 pParty->pPickedItem.GetIconName(), | 1063 auto texture = assets->GetImage_16BitColorKey(pParty->pPickedItem.GetIconName(), 0x7FF); |
1041 TEXTURE_16BIT_PALETTE); | 1064 //v0 = pIcons_LOD->LoadTexture( |
1042 v1 = pIcons_LOD->GetTexture(v0); | 1065 // pParty->pPickedItem.GetIconName(), |
1043 v11 = areWeLoadingTexture; | 1066 // TEXTURE_16BIT_PALETTE); |
1067 //v1 = pIcons_LOD->GetTexture(v0); | |
1068 //v11 = areWeLoadingTexture; | |
1044 if ( uActiveCharacter | 1069 if ( uActiveCharacter |
1045 && (v2 = ::pPlayers[uActiveCharacter]->AddItem(-1, pParty->pPickedItem.uItemID)) != 0 ) | 1070 && (v2 = ::pPlayers[uActiveCharacter]->AddItem(-1, pParty->pPickedItem.uItemID)) != 0 ) |
1046 { | 1071 { |
1047 memcpy(&::pPlayers[uActiveCharacter]->pInventoryItemList[v2-1], &pParty->pPickedItem, 0x24u); | 1072 memcpy(&::pPlayers[uActiveCharacter]->pInventoryItemList[v2-1], &pParty->pPickedItem, 0x24u); |
1048 pMouse->RemoveHoldingItem(); | 1073 pMouse->RemoveHoldingItem(); |
1089 memcpy(&a1.containing_item, &pParty->pPickedItem, sizeof(a1.containing_item)); | 1114 memcpy(&a1.containing_item, &pParty->pPickedItem, sizeof(a1.containing_item)); |
1090 a1.Create(pParty->sRotationY, 184, 200, 0); | 1115 a1.Create(pParty->sRotationY, 184, 200, 0); |
1091 pMouse->RemoveHoldingItem(); | 1116 pMouse->RemoveHoldingItem(); |
1092 } | 1117 } |
1093 } | 1118 } |
1094 if ( !v11 ) | 1119 |
1095 { | 1120 if (texture) |
1096 v1->Release(); | 1121 { |
1097 pIcons_LOD->SyncLoadedFilesCount(); | 1122 texture->Release(); |
1098 } | 1123 texture = nullptr; |
1099 return; | 1124 } |
1100 } | 1125 } |
1101 | 1126 |
1102 | 1127 |
1103 //----- (0048C6F6) -------------------------------------------------------- | 1128 //----- (0048C6F6) -------------------------------------------------------- |
1104 bool Party::AddItemToParty(ItemGen *pItem) | 1129 bool Party::AddItemToParty(ItemGen *pItem) |
1105 { | 1130 { |
1106 unsigned int v2; // eax@1 | 1131 unsigned int v2; // eax@1 |
1107 char *v5; // eax@8 | 1132 char *v5; // eax@8 |
1108 Texture_MM7 *v7; // ebx@10 | 1133 //Texture_MM7 *v7; // ebx@10 |
1109 signed int v8; // esi@10 | 1134 signed int v8; // esi@10 |
1110 Player *v9; // edi@11 | 1135 Player *v9; // edi@11 |
1111 int v10; // eax@11 | 1136 int v10; // eax@11 |
1112 int v21; // [sp+24h] [bp-4h]@10 | 1137 //int v21; // [sp+24h] [bp-4h]@10 |
1113 | 1138 |
1114 v2 = pItem->uItemID; | 1139 v2 = pItem->uItemID; |
1115 if ( !pItemsTable->pItems[v2].uItemID_Rep_St ) | 1140 if ( !pItemsTable->pItems[v2].uItemID_Rep_St ) |
1116 pItem->SetIdentified(); | 1141 pItem->SetIdentified(); |
1117 | 1142 |
1118 v5 = pItemsTable->pItems[v2].pIconName; | 1143 v5 = pItemsTable->pItems[v2].pIconName; |
1119 if ( v5 ) | 1144 if ( v5 ) |
1120 { | 1145 { |
1121 v7 = pIcons_LOD->LoadTexturePtr(v5, TEXTURE_16BIT_PALETTE); | 1146 auto texture = assets->GetImage_16BitColorKey(v5, 0x7FF); |
1122 v21 = areWeLoadingTexture; | 1147 //v7 = pIcons_LOD->LoadTexturePtr(v5, TEXTURE_16BIT_PALETTE); |
1148 //v21 = areWeLoadingTexture; | |
1123 v8 = 0; | 1149 v8 = 0; |
1124 uint current_player = uActiveCharacter; | 1150 uint current_player = uActiveCharacter; |
1125 for (int i = 0; i < 4; i++) | 1151 for (int i = 0; i < 4; i++) |
1126 { | 1152 { |
1127 current_player = current_player + i; | 1153 current_player = current_player + i; |
1133 { | 1159 { |
1134 memcpy(&v9->pInventoryItemList[v10-1], pItem, 0x24u); | 1160 memcpy(&v9->pInventoryItemList[v10-1], pItem, 0x24u); |
1135 pItem->Reset(); | 1161 pItem->Reset(); |
1136 pAudioPlayer->PlaySound(SOUND_gold01, 0, 0, -1, 0, 0, 0, 0); | 1162 pAudioPlayer->PlaySound(SOUND_gold01, 0, 0, -1, 0, 0, 0, 0); |
1137 v9->PlaySound(SPEECH_60, 0); | 1163 v9->PlaySound(SPEECH_60, 0); |
1138 if ( !v21 ) | 1164 |
1165 if (texture) | |
1139 { | 1166 { |
1140 v7->Release(); | 1167 texture->Release(); |
1141 pIcons_LOD->SyncLoadedFilesCount(); | 1168 texture = nullptr; |
1142 } | 1169 } |
1143 return true; | 1170 return true; |
1144 } | 1171 } |
1145 } | 1172 } |
1146 if ( !v21 ) | 1173 if (texture) |
1147 { | 1174 { |
1148 v7->Release(); | 1175 texture->Release(); |
1149 pIcons_LOD->SyncLoadedFilesCount(); | 1176 texture = nullptr; |
1150 } | 1177 } |
1151 return false; | |
1152 } | 1178 } |
1153 else | 1179 else |
1154 { | 1180 { |
1155 MessageBoxW(nullptr, L"Invalid picture_name detected ::addItem()", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Party.cpp:795", 0); | 1181 MessageBoxW(nullptr, L"Invalid picture_name detected ::addItem()", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Party.cpp:795", 0); |
1156 return false; | 1182 } |
1157 } | 1183 return false; |
1158 } | 1184 } |
1159 // 506128: using guessed type int areWeLoadingTexture; | 1185 |
1160 | 1186 |
1161 bool Party::IsPartyEvil() | 1187 bool Party::IsPartyEvil() |
1162 { | 1188 { |
1163 return _449B57_test_bit(_quest_bits, 100); | 1189 return _449B57_test_bit(_quest_bits, 100); |
1164 } | 1190 } |