comparison mm7_5.cpp @ 1727:2c38e17e5a3f

m
author Ritor1
date Wed, 25 Sep 2013 12:54:27 +0600
parents 8de9b24ace86
children f44b6e02e81c
comparison
equal deleted inserted replaced
1726:9e81a9147752 1727:2c38e17e5a3f
4939 4939
4940 pMouse->GetCursorPos(&a2); 4940 pMouse->GetCursorPos(&a2);
4941 if (a2.x <= 13 || a2.x >= 462) 4941 if (a2.x <= 13 || a2.x >= 462)
4942 return; 4942 return;
4943 4943
4944 auto player = pPlayers[uActiveCharacter];
4945
4946 int item_pid = pRenderer->pActiveZBuffer[a2.x + pSRZBufferLineOffsets[a2.y]] & 0xFFFF; 4944 int item_pid = pRenderer->pActiveZBuffer[a2.x + pSRZBufferLineOffsets[a2.y]] & 0xFFFF;
4947 //pMouse->GetClickPos(&pX, &pY);
4948 if (!item_pid) 4945 if (!item_pid)
4949 { 4946 {
4950 int inventory_mouse_x = a2.x - 14; 4947 int inventory_mouse_x = a2.x - 14;
4951 int inventory_mouse_y = a2.y - 17; 4948 int inventory_mouse_y = a2.y - 17;
4952 4949
4958 4955
4959 int inventory_idx = mouse_cell_x + 14 * mouse_cell_y; 4956 int inventory_idx = mouse_cell_x + 14 * mouse_cell_y;
4960 if (inventory_idx > 126) 4957 if (inventory_idx > 126)
4961 return; 4958 return;
4962 4959
4963 v7 = player->GetItemIDAtInventoryIndex(&inventory_idx); 4960 v7 = pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex(&inventory_idx);
4964 if (v7 == 0) 4961 if (v7 == 0)
4965 return; 4962 return;
4966 4963
4967 item_pid = v7; 4964 item_pid = v7;
4968 } 4965 }
4969 4966
4970 if (!player->CanAct()) 4967 if (!pPlayers[uActiveCharacter]->CanAct())
4971 { 4968 {
4972 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[427], player->pName, pGlobalTXT_LocalizationStrings[541]); 4969 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[427], pPlayers[uActiveCharacter]->pName, pGlobalTXT_LocalizationStrings[541]);//%s не в состоянии %s Опознать предметы
4973 v43.Hint = pTmpBuf.data(); 4970 v43.Hint = pTmpBuf.data();
4974 v43.uFrameWidth = 384; 4971 v43.uFrameWidth = 384;
4975 v43.uFrameHeight = 180; 4972 v43.uFrameHeight = 180;
4976 if (a2.x <= 320 ) 4973 if (a2.x <= 320 )
4977 v43.uFrameX = a2.x + 30; 4974 v43.uFrameX = a2.x + 30;
4981 v43.DrawMessageBox(0); 4978 v43.DrawMessageBox(0);
4982 return; 4979 return;
4983 } 4980 }
4984 4981
4985 --item_pid; 4982 --item_pid;
4986 int alchemy_level = (int8_t)player->GetActualSkillLevel(PLAYER_SKILL_ALCHEMY); 4983 int alchemy_level = (int8_t)pPlayers[uActiveCharacter]->GetActualSkillLevel(PLAYER_SKILL_ALCHEMY);
4987 v9 = alchemy_level & 0x3F; 4984 v9 = alchemy_level & 0x3F;
4988 //v45 = alchemy_level & 0x3F; 4985 //v45 = alchemy_level & 0x3F;
4989 int alchemy_skill = SkillToMastery(alchemy_level); 4986 int alchemy_skill = SkillToMastery(alchemy_level);
4990 4987
4991 auto item = &player->pInventoryItemList[item_pid]; 4988 auto item = &pPlayers[uActiveCharacter]->pInventoryItemList[item_pid];
4992 if (pParty->pPickedItem.uItemID == ITEM_POTION_BOTTLE) 4989 if (pParty->pPickedItem.uItemID == ITEM_POTION_BOTTLE)
4993 { 4990 {
4994 __show_item_desc:
4995 GameUI_DrawItemInfo(item); 4991 GameUI_DrawItemInfo(item);
4996 return; 4992 return;
4997 } 4993 }
4998 4994
4999 if (pParty->pPickedItem.uItemID == ITEM_POTION_RECHARGE_ITEM) 4995 if (pParty->pPickedItem.uItemID == ITEM_POTION_RECHARGE_ITEM)
5017 5013
5018 pMouse->RemoveHoldingItem(); 5014 pMouse->RemoveHoldingItem();
5019 no_rightlick_in_inventory = 1; 5015 no_rightlick_in_inventory = 1;
5020 return; 5016 return;
5021 } 5017 }
5022 goto __show_item_desc; 5018 GameUI_DrawItemInfo(item);
5019 return;
5023 } 5020 }
5024 5021
5025 else if (pParty->pPickedItem.uItemID == ITEM_POTION_HARDEN_ITEM) 5022 else if (pParty->pPickedItem.uItemID == ITEM_POTION_HARDEN_ITEM)
5026 { 5023 {
5027 if (item->uItemID != ITEM_POTION_BOTTLE && // cant harden bottle 5024 if (item->uItemID != ITEM_POTION_BOTTLE && // cant harden bottle
5039 _50C9A8_item_enchantment_timer = 256; 5036 _50C9A8_item_enchantment_timer = 256;
5040 pMouse->RemoveHoldingItem(); 5037 pMouse->RemoveHoldingItem();
5041 no_rightlick_in_inventory = true; 5038 no_rightlick_in_inventory = true;
5042 return; 5039 return;
5043 } 5040 }
5044 goto __show_item_desc; 5041 GameUI_DrawItemInfo(item);
5042 return;
5045 } 5043 }
5046 5044
5047 else if (pParty->pPickedItem.uItemID >= ITEM_POTION_FLAMING_POTION && 5045 else if (pParty->pPickedItem.uItemID >= ITEM_POTION_FLAMING_POTION &&
5048 pParty->pPickedItem.uItemID <= ITEM_POTION_SWIFT_POTION || 5046 pParty->pPickedItem.uItemID <= ITEM_POTION_SWIFT_POTION ||
5049 pParty->pPickedItem.uItemID == ITEM_POTION_SLAYING_POTION) 5047 pParty->pPickedItem.uItemID == ITEM_POTION_SLAYING_POTION)
5084 _50C9A8_item_enchantment_timer = 256; 5082 _50C9A8_item_enchantment_timer = 256;
5085 pMouse->RemoveHoldingItem(); 5083 pMouse->RemoveHoldingItem();
5086 no_rightlick_in_inventory = true; 5084 no_rightlick_in_inventory = true;
5087 return; 5085 return;
5088 } 5086 }
5089 goto __show_item_desc; 5087 GameUI_DrawItemInfo(item);
5088 return;
5090 } 5089 }
5091 5090
5092 5091
5093 5092
5094 if (pParty->pPickedItem.uItemID < ITEM_REAGENT_WIDOWSWEEP_BERRIES || 5093 if (pParty->pPickedItem.uItemID < ITEM_REAGENT_WIDOWSWEEP_BERRIES ||
5095 pParty->pPickedItem.uItemID > ITEM_REAGENT_PHILOSOPHERS_STONE || 5094 pParty->pPickedItem.uItemID > ITEM_REAGENT_PHILOSOPHERS_STONE ||
5096 player->pInventoryItemList[item_pid].uItemID != ITEM_POTION_BOTTLE) 5095 pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uItemID != ITEM_POTION_BOTTLE)
5097 { 5096 {
5098 if (pParty->pPickedItem.uItemID < ITEM_POTION_CATALYST || 5097 if (pParty->pPickedItem.uItemID < ITEM_POTION_CATALYST ||
5099 pParty->pPickedItem.uItemID > ITEM_POTION_REJUVENATION || 5098 pParty->pPickedItem.uItemID > ITEM_POTION_REJUVENATION ||
5100 player->pInventoryItemList[item_pid].uItemID < ITEM_POTION_CATALYST || 5099 pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uItemID < ITEM_POTION_CATALYST ||
5101 player->pInventoryItemList[item_pid].uItemID > ITEM_POTION_REJUVENATION) 5100 pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uItemID > ITEM_POTION_REJUVENATION)
5102 { 5101 {
5103 if (pParty->pPickedItem.uItemID != ITEM_POTION_HARDEN_ITEM && 5102 if (pParty->pPickedItem.uItemID != ITEM_POTION_HARDEN_ITEM &&
5104 (pParty->pPickedItem.uItemID < ITEM_POTION_FLAMING_POTION || pParty->pPickedItem.uItemID > ITEM_POTION_SWIFT_POTION) && 5103 (pParty->pPickedItem.uItemID < ITEM_POTION_FLAMING_POTION || pParty->pPickedItem.uItemID > ITEM_POTION_SWIFT_POTION) &&
5105 pParty->pPickedItem.uItemID != ITEM_POTION_SLAYING_POTION && 5104 pParty->pPickedItem.uItemID != ITEM_POTION_SLAYING_POTION &&
5106 pParty->pPickedItem.uItemID != ITEM_POTION_RECHARGE_ITEM) 5105 pParty->pPickedItem.uItemID != ITEM_POTION_RECHARGE_ITEM)
5107 goto __show_item_desc; 5106 GameUI_DrawItemInfo(item);
5107 return;
5108 } 5108 }
5109 5109
5110 // src not reagent, dst not bottle 5110 // src not reagent, dst not bottle
5111 // src potion, dst potion 5111 // src potion, dst potion
5112 5112
5174 goto LABEL_53; 5174 goto LABEL_53;
5175 } 5175 }
5176 LABEL_54: 5176 LABEL_54:
5177 int pOut_y = 0; 5177 int pOut_y = 0;
5178 int pOut_x = item_pid + 1; 5178 int pOut_x = item_pid + 1;
5179 v17 = (int)player->pInventoryMatrix; 5179 v17 = (int)pPlayers[uActiveCharacter]->pInventoryMatrix;
5180 while ( *(int *)v17 != pOut_x ) 5180 while ( *(int *)v17 != pOut_x )
5181 { 5181 {
5182 ++pOut_y; 5182 ++pOut_y;
5183 v17 += 4; 5183 v17 += 4;
5184 if ( pOut_y >= 126 ) 5184 if ( pOut_y >= 126 )
5188 } 5188 }
5189 } 5189 }
5190 v18 = pOut_y; 5190 v18 = pOut_y;
5191 LABEL_59: 5191 LABEL_59:
5192 if ( !v51 ) 5192 if ( !v51 )
5193 goto __show_item_desc;; 5193 GameUI_DrawItemInfo(item);
5194 return;
5194 if ( v51 == 1 ) 5195 if ( v51 == 1 )
5195 { 5196 {
5196 player->RemoveItemAtInventoryIndex(v18); 5197 pPlayers[uActiveCharacter]->RemoveItemAtInventoryIndex(v18);
5197 v26 = rand(); 5198 v26 = rand();
5198 player->ReceiveDamage(v26 % 11 + 10, DMGT_FIRE); 5199 pPlayers[uActiveCharacter]->ReceiveDamage(v26 % 11 + 10, DMGT_FIRE);
5199 pAudioPlayer->PlaySound(SOUND_8, 0, 0, -1, 0, 0, 0, 0); 5200 pAudioPlayer->PlaySound(SOUND_8, 0, 0, -1, 0, 0, 0, 0);
5200 5201
5201 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); 5202 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0);
5202 5203
5203 v39.z = pParty->vPosition.z + pParty->sEyelevel; 5204 v39.z = pParty->vPosition.z + pParty->sEyelevel;
5204 } 5205 }
5205 else 5206 else
5206 { 5207 {
5207 if ( v51 == 2 ) 5208 if ( v51 == 2 )
5208 { 5209 {
5209 player->RemoveItemAtInventoryIndex(v18); 5210 pPlayers[uActiveCharacter]->RemoveItemAtInventoryIndex(v18);
5210 v25 = rand(); 5211 v25 = rand();
5211 player->ReceiveDamage(v25 % 71 + 30, DMGT_FIRE); 5212 pPlayers[uActiveCharacter]->ReceiveDamage(v25 % 71 + 30, DMGT_FIRE);
5212 v23 = 1; 5213 v23 = 1;
5213 } 5214 }
5214 else 5215 else
5215 { 5216 {
5216 if ( v51 == 3 ) 5217 if ( v51 == 3 )
5217 { 5218 {
5218 player->RemoveItemAtInventoryIndex(v18); 5219 pPlayers[uActiveCharacter]->RemoveItemAtInventoryIndex(v18);
5219 v24 = rand(); 5220 v24 = rand();
5220 player->ReceiveDamage(v24 % 201 + 50, DMGT_FIRE); 5221 pPlayers[uActiveCharacter]->ReceiveDamage(v24 % 201 + 50, DMGT_FIRE);
5221 v23 = 5; 5222 v23 = 5;
5222 } 5223 }
5223 else 5224 else
5224 { 5225 {
5225 if ( v51 != 4 ) 5226 if ( v51 != 4 )
5226 { 5227 {
5227 if ( v51 != 5 ) 5228 if ( v51 != 5 )
5228 { 5229 {
5229 v19 = player->AddItem(-1, 0xDCu); 5230 v19 = pPlayers[uActiveCharacter]->AddItem(-1, 0xDCu);
5230 if ( v19 ) 5231 if ( v19 )
5231 // *(int *)&v0->field_1F5[36 * v19 + 15] = 1; 5232 // *(int *)&v0->field_1F5[36 * v19 + 15] = 1;
5232 player->pOwnItems[v19-1].uAttributes = ITEM_IDENTIFIED; 5233 pPlayers[uActiveCharacter]->pOwnItems[v19-1].uAttributes = ITEM_IDENTIFIED;
5233 v20 = v14 + 50 * v15; 5234 v20 = v14 + 50 * v15;
5234 player->pInventoryItemList[item_pid].uItemID = v51; 5235 pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uItemID = v51;
5235 player->pInventoryItemList[item_pid].uEnchantmentType = (pParty->pPickedItem.uEnchantmentType 5236 pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uEnchantmentType = (pParty->pPickedItem.uEnchantmentType
5236 + player->pInventoryItemList[item_pid].uEnchantmentType) 5237 + pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uEnchantmentType)
5237 / 2; 5238 / 2;
5238 player->SetVariable(VAR_AutoNotes, *(short *)&pItemsTable->potion_note[2 * v20 ]);//field_10168 + 388 5239 pPlayers[uActiveCharacter]->SetVariable(VAR_AutoNotes, *(short *)&pItemsTable->potion_note[2 * v20 ]);//field_10168 + 388
5239 LABEL_74: 5240 LABEL_74:
5240 v22 = (int)((char *)player + 36 * item_pid); 5241 v22 = (int)((char *)pPlayers[uActiveCharacter] + 36 * item_pid);
5241 if ( !(pItemsTable->pItems[*(int *)(v22 + 532) ].uItemID_Rep_St) ) 5242 if ( !(pItemsTable->pItems[*(int *)(v22 + 532) ].uItemID_Rep_St) )
5242 *(int *)(v22 + 552) |= 1u; 5243 *(int *)(v22 + 552) |= 1u;
5243 if ( !dword_4E455C ) 5244 if ( !dword_4E455C )
5244 { 5245 {
5245 pMouse->RemoveHoldingItem(); 5246 pMouse->RemoveHoldingItem();
5246 no_rightlick_in_inventory = 1; 5247 no_rightlick_in_inventory = 1;
5247 return; 5248 return;
5248 } 5249 }
5249 player->PlaySound(SPEECH_16, 0); 5250 pPlayers[uActiveCharacter]->PlaySound(SPEECH_16, 0);
5250 dword_4E455C = 0; 5251 dword_4E455C = 0;
5251 pMouse->RemoveHoldingItem(); 5252 pMouse->RemoveHoldingItem();
5252 no_rightlick_in_inventory = 1; 5253 no_rightlick_in_inventory = 1;
5253 return; 5254 return;
5254 } 5255 }
5255 if ( v9 ) 5256 if ( v9 )
5256 { 5257 {
5257 if ( *(int *)(player + 36 * item_pid + 532) == 221 ) 5258 if ( *(int *)(pPlayers[uActiveCharacter] + 36 * item_pid + 532) == 221 )
5258 *(int *)(player + 36 * item_pid + 532) = pParty->pPickedItem.uItemID; 5259 *(int *)(pPlayers[uActiveCharacter] + 36 * item_pid + 532) = pParty->pPickedItem.uItemID;
5259 else 5260 else
5260 *(int *)(player + 36 * item_pid + 536) = pParty->pPickedItem.uEnchantmentType; 5261 *(int *)(pPlayers[uActiveCharacter] + 36 * item_pid + 536) = pParty->pPickedItem.uEnchantmentType;
5261 v21 = player->AddItem(-1, 0xDCu); 5262 v21 = pPlayers[uActiveCharacter]->AddItem(-1, 0xDCu);
5262 if ( v21 ) 5263 if ( v21 )
5263 //*(int *)&v0->field_1F5[36 * v21 + 15] = 1; 5264 //*(int *)&v0->field_1F5[36 * v21 + 15] = 1;
5264 player->pOwnItems[v21-1].uAttributes=ITEM_IDENTIFIED; 5265 pPlayers[uActiveCharacter]->pOwnItems[v21-1].uAttributes=ITEM_IDENTIFIED;
5265 goto LABEL_74; 5266 goto LABEL_74;
5266 } 5267 }
5267 goto __show_item_desc; 5268 GameUI_DrawItemInfo(item);
5268 } 5269 return;
5269 player->RemoveItemAtInventoryIndex(v18); 5270 }
5270 player->SetCondition(0x10u, 0); 5271 pPlayers[uActiveCharacter]->RemoveItemAtInventoryIndex(v18);
5272 pPlayers[uActiveCharacter]->SetCondition(0x10u, 0);
5271 v23 = 0; 5273 v23 = 0;
5272 } 5274 }
5273 } 5275 }
5274 player->ItemsEnchant(v23); 5276 pPlayers[uActiveCharacter]->ItemsEnchant(v23);
5275 pAudioPlayer->PlaySound(SOUND_8, 0, 0, -1, 0, 0, 0, 0); 5277 pAudioPlayer->PlaySound(SOUND_8, 0, 0, -1, 0, 0, 0, 0);
5276 5278
5277 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); 5279 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0);
5278 5280
5279 v39.z = pParty->vPosition.z + pParty->sEyelevel; 5281 v39.z = pParty->vPosition.z + pParty->sEyelevel;
5284 int rot_x, rot_y, rot_z; 5286 int rot_x, rot_y, rot_z;
5285 Vec3_int_::Rotate(64, pParty->sRotationY, pParty->sRotationX, v39, &rot_x, &rot_y, &rot_z); 5287 Vec3_int_::Rotate(64, pParty->sRotationY, pParty->sRotationX, v39, &rot_x, &rot_y, &rot_z);
5286 sub_42F7EB_DropItemAt(0x41Bu, rot_x, rot_y, rot_z, 0, 1, 0, 0, 0); 5288 sub_42F7EB_DropItemAt(0x41Bu, rot_x, rot_y, rot_z, 0, 1, 0, 0, 0);
5287 if ( dword_4E455C ) 5289 if ( dword_4E455C )
5288 { 5290 {
5289 if ( player->CanAct() ) 5291 if ( pPlayers[uActiveCharacter]->CanAct() )
5290 player->PlaySound(SPEECH_17, 0); 5292 pPlayers[uActiveCharacter]->PlaySound(SPEECH_17, 0);
5291 ShowStatusBarString(pGlobalTXT_LocalizationStrings[444], 2u); 5293 ShowStatusBarString(pGlobalTXT_LocalizationStrings[444], 2u);
5292 dword_4E455C = 0; 5294 dword_4E455C = 0;
5293 } 5295 }
5294 pMouse->RemoveHoldingItem(); 5296 pMouse->RemoveHoldingItem();
5295 no_rightlick_in_inventory = 1; 5297 no_rightlick_in_inventory = 1;
5296 return; 5298 return;
5297 } 5299 }
5298 5300
5299 // end alchemy 5301 // end alchemy
5300 5302
5301 player->pInventoryItemList[item_pid].uEnchantmentType = v9 + pParty->pPickedItem.GetDamageDice(); 5303 pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uEnchantmentType = v9 + pParty->pPickedItem.GetDamageDice();
5302 switch ( pParty->pPickedItem.uItemID ) 5304 switch ( pParty->pPickedItem.uItemID )
5303 { 5305 {
5304 case 0xC8u: 5306 case 0xC8u:
5305 case 0xC9u: 5307 case 0xC9u:
5306 case 0xCAu: 5308 case 0xCAu:
5307 case 0xCBu: 5309 case 0xCBu:
5308 case 0xCCu: 5310 case 0xCCu:
5309 player->pInventoryItemList[item_pid].uItemID = 222; 5311 pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uItemID = 222;
5310 break; 5312 break;
5311 case 0xCDu: 5313 case 0xCDu:
5312 case 0xCEu: 5314 case 0xCEu:
5313 case 0xCFu: 5315 case 0xCFu:
5314 case 0xD0u: 5316 case 0xD0u:
5315 case 0xD1u: 5317 case 0xD1u:
5316 player->pInventoryItemList[item_pid].uItemID = 223; 5318 pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uItemID = 223;
5317 break; 5319 break;
5318 case 0xD2u: 5320 case 0xD2u:
5319 case 0xD3u: 5321 case 0xD3u:
5320 case 0xD4u: 5322 case 0xD4u:
5321 case 0xD5u: 5323 case 0xD5u:
5322 case 0xD6u: 5324 case 0xD6u:
5323 player->pInventoryItemList[item_pid].uItemID = 224; 5325 pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uItemID = 224;
5324 break; 5326 break;
5325 case 0xD7u: 5327 case 0xD7u:
5326 case 0xD8u: 5328 case 0xD8u:
5327 case 0xD9u: 5329 case 0xD9u:
5328 case 0xDAu: 5330 case 0xDAu:
5329 case 0xDBu: 5331 case 0xDBu:
5330 player->pInventoryItemList[item_pid].uItemID = 221; 5332 pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uItemID = 221;
5331 break; 5333 break;
5332 default: 5334 default:
5333 break; 5335 break;
5334 } 5336 }
5335 pMouse->RemoveHoldingItem(); 5337 pMouse->RemoveHoldingItem();
5336 no_rightlick_in_inventory = 1; 5338 no_rightlick_in_inventory = 1;
5337 if ( dword_4E455C ) 5339 if ( dword_4E455C )
5338 { 5340 {
5339 player->PlaySound(SPEECH_16, 0); 5341 pPlayers[uActiveCharacter]->PlaySound(SPEECH_16, 0);
5340 dword_4E455C = 0; 5342 dword_4E455C = 0;
5341 } 5343 }
5342 return; 5344 return;
5343 5345
5344 5346