Mercurial > mm7
changeset 1737:7a9d0973ae37
Merge
author | Grumpy7 |
---|---|
date | Fri, 27 Sep 2013 10:05:25 +0200 |
parents | c6fe09a06712 (current diff) 873ac151c38d (diff) |
children | ef86fc6d6a80 |
files | |
diffstat | 2 files changed, 232 insertions(+), 317 deletions(-) [+] |
line wrap: on
line diff
--- a/UI/UIPopup.cpp Fri Sep 27 10:04:45 2013 +0200 +++ b/UI/UIPopup.cpp Fri Sep 27 10:05:25 2013 +0200 @@ -1587,26 +1587,13 @@ //----- (00416196) -------------------------------------------------------- void Inventory_ItemPopupAndAlchemy() { - int v14; // edx@25 - unsigned int v15; // edi@25 - signed int v16; // edx@27 - int v17; // eax@54 - unsigned int v18; // edx@57 - int v19; // eax@65 - int v20; // edi@67 - int v21; // eax@72 - int v22; // ecx@74 - int v23; // edx@78 - int v24; // eax@79 - int v25; // eax@80 - int v26; // eax@84 - ItemGen *v27; // esi@98 + int potion1_id; // edx@25 + unsigned int potion2_id; // edi@25 + signed int potionID; // edx@27 + unsigned int pOut_y; // edx@57 double v31; // st7@112 - double v36; // st7@132 - signed __int64 v37; // qax@135 Vec3_int_ v39; // [sp-18h] [bp-A8h]@83 GUIWindow message_window; // [sp+Ch] [bp-84h]@137 - int v45; // [sp+64h] [bp-2Ch]@10 POINT a2; // [sp+78h] [bp-18h]@2 unsigned int damage_level; // [sp+8Ch] [bp-4h]@23 @@ -1617,7 +1604,7 @@ int item_pid = (pRenderer->pActiveZBuffer[a2.x + pSRZBufferLineOffsets[a2.y]] & 0xFFFF) - 1; auto item = &pPlayers[uActiveCharacter]->pInventoryItemList[item_pid]; - if (a2.x <= 13 || a2.x >= 462) + if (a2.x <= 13 || a2.x >= 462)//items out of inventory(вещи вне инвентаря) { GameUI_DrawItemInfo(item); return; @@ -1660,7 +1647,7 @@ } int alchemy_skill_points = (int8_t)pPlayers[uActiveCharacter]->GetActualSkillLevel(PLAYER_SKILL_ALCHEMY) & 0x3F; - int alchemy_skill_level = SkillToMastery(pPlayers[uActiveCharacter]->GetActualSkillLevel(PLAYER_SKILL_ALCHEMY)) - 1; + int alchemy_skill_level = SkillToMastery(pPlayers[uActiveCharacter]->GetActualSkillLevel(PLAYER_SKILL_ALCHEMY)); // for potion bottle(простая бутылка) if (pParty->pPickedItem.uItemID == ITEM_POTION_BOTTLE) @@ -1671,9 +1658,7 @@ //for recharge potion(зелье перезарядка) if (pParty->pPickedItem.uItemID == ITEM_POTION_RECHARGE_ITEM) { - if (item->uItemID != ITEM_POTION_BOTTLE && // cant recharge bottle - item->uItemID < ITEM_POTION_CATALYST && // cant recharge - item->uItemID > ITEM_POTION_REJUVENATION) // all potions + if (item->uItemID < ITEM_POTION_BOTTLE || item->uItemID > ITEM_POTION_REJUVENATION)// all potions { if (item->GetItemEquipType() != EQUIP_WAND) // can recharge only wands { @@ -1681,12 +1666,11 @@ return; } - v36 = (70.0 - (double)pParty->pPickedItem.uEnchantmentType) * 0.01; - if ( v36 < 0.0 ) - v36 = 0.0; - v37 = (signed __int64)((double)item->uMaxCharges - v36 * (double)item->uMaxCharges); - item->uMaxCharges = v37; - item->uNumCharges = v37; + v31 = (70.0 - (double)pParty->pPickedItem.uEnchantmentType) * 0.01; + if ( v31 < 0.0 ) + v31 = 0.0; + item->uMaxCharges = (signed __int64)((double)item->uMaxCharges - v31 * (double)item->uMaxCharges); + item->uNumCharges = (signed __int64)((double)item->uMaxCharges - v31 * (double)item->uMaxCharges); pMouse->RemoveHoldingItem(); no_rightlick_in_inventory = 1; @@ -1698,9 +1682,7 @@ // for harden potion(зелье закалка) else if (pParty->pPickedItem.uItemID == ITEM_POTION_HARDEN_ITEM) { - if (item->uItemID != ITEM_POTION_BOTTLE && // cant harden bottle - item->uItemID < ITEM_POTION_CATALYST && // cant harden - item->uItemID > ITEM_POTION_REJUVENATION) // all potions + if (item->uItemID < ITEM_POTION_BOTTLE || item->uItemID > ITEM_POTION_REJUVENATION) // bottle and all potions { if (item->IsBroken() || // cant harden broken items item->uItemID >= ITEM_ARTIFACT_PUCK || // cant harden artifacts @@ -1723,13 +1705,10 @@ return; } // several potions(несколько зелий) - else if (pParty->pPickedItem.uItemID >= ITEM_POTION_FLAMING_POTION && - pParty->pPickedItem.uItemID <= ITEM_POTION_SWIFT_POTION || + else if (pParty->pPickedItem.uItemID >= ITEM_POTION_FLAMING_POTION && pParty->pPickedItem.uItemID <= ITEM_POTION_SWIFT_POTION || pParty->pPickedItem.uItemID == ITEM_POTION_SLAYING_POTION) { - if (item->uItemID != ITEM_POTION_BOTTLE && // cant enchant bottle - item->uItemID < ITEM_POTION_CATALYST && // cant enchant - item->uItemID > ITEM_POTION_REJUVENATION) // all potions + if ( item->uItemID < ITEM_POTION_BOTTLE || item->uItemID > ITEM_POTION_REJUVENATION) // all potions { if (item->uItemID >= ITEM_BLASTER && item->uItemID <= ITEM_LASER_RIFLE || item->uItemID >= ITEM_ARTIFACT_PUCK || @@ -1761,8 +1740,8 @@ v31 = (double)(1800 * pParty->pPickedItem.uEnchantmentType * 128); } - v27->uExpireTime = pParty->uTimePlayed + v31 * 0.033333335; - v27->uAttributes = alchemy_skill_level | 0x18; + item->uExpireTime = pParty->uTimePlayed + v31 * 0.033333335; + item->uAttributes = alchemy_skill_level | 0x18; _50C9A8_item_enchantment_timer = 256; pMouse->RemoveHoldingItem(); @@ -1819,202 +1798,200 @@ } return; } - //potions mixing(смешивание двух зелий) - if (pParty->pPickedItem.uItemID < ITEM_REAGENT_WIDOWSWEEP_BERRIES || - pParty->pPickedItem.uItemID > ITEM_REAGENT_PHILOSOPHERS_STONE || - pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uItemID != ITEM_POTION_BOTTLE) + if (pParty->pPickedItem.uItemID >= ITEM_POTION_CATALYST && pParty->pPickedItem.uItemID <= ITEM_POTION_REJUVENATION && + pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uItemID >= ITEM_POTION_CATALYST && + pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uItemID <= ITEM_POTION_REJUVENATION) { - if (pParty->pPickedItem.uItemID < ITEM_POTION_CATALYST || - pParty->pPickedItem.uItemID > ITEM_POTION_REJUVENATION || - pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uItemID < ITEM_POTION_CATALYST || - pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uItemID > ITEM_POTION_REJUVENATION) - { - if (pParty->pPickedItem.uItemID != ITEM_POTION_HARDEN_ITEM && - (pParty->pPickedItem.uItemID < ITEM_POTION_FLAMING_POTION || pParty->pPickedItem.uItemID > ITEM_POTION_SWIFT_POTION) && - pParty->pPickedItem.uItemID != ITEM_POTION_SLAYING_POTION && - pParty->pPickedItem.uItemID != ITEM_POTION_RECHARGE_ITEM) - GameUI_DrawItemInfo(item); - return; - } - - // src not reagent, dst not bottle - // src potion, dst potion - - v14 = item->uItemID - ITEM_POTION_CURE_WOUNDS; - v15 = pParty->pPickedItem.uItemID - ITEM_POTION_CURE_WOUNDS; + potion1_id = item->uItemID - ITEM_POTION_CURE_WOUNDS; + potion2_id = pParty->pPickedItem.uItemID - ITEM_POTION_CURE_WOUNDS; if ( pParty->pPickedItem.uItemID == ITEM_POTION_CATALYST || item->uItemID == ITEM_POTION_CATALYST ) - v16 = 5; + potionID = 5; else - v16 = pItemsTable->potion_data[v15][v14 + 2]; - damage_level = v16; + potionID = pItemsTable->potion_data[potion2_id][potion1_id]; + damage_level = 0; if ( alchemy_skill_points ) { - if ( v16 < ITEM_POTION_CURE_DISEASE || v16 > ITEM_POTION_AWAKEN )//< 225 >227 + if ( potionID < ITEM_POTION_CURE_DISEASE || potionID > ITEM_POTION_AWAKEN )//< 225 >227 { - if ( v16 >= ITEM_POTION_HASTE && v16 <= ITEM_POTION_CURE_INSANITY )//228 >= v16 <= 239 - { - if ( alchemy_skill_points == 1 ) - damage_level = 2; - } - if ( v16 >= ITEM_POTION_MIGHT_BOOST && v16 <= ITEM_POTION_BODY_RESISTANE )//240 >= v16 <= 261 - { - if ( alchemy_skill_points <= 2 ) - damage_level = 3; - } - if ( v16 >= ITEM_POTION_STONE_TO_FLESH && alchemy_skill_points != 4 )//>= 262 + if ( potionID >= ITEM_POTION_HASTE && potionID <= ITEM_POTION_CURE_INSANITY && alchemy_skill_level == 1)//228 >= potionID <= 239 + damage_level = 2; + if ( potionID >= ITEM_POTION_MIGHT_BOOST && potionID <= ITEM_POTION_BODY_RESISTANE && alchemy_skill_level <= 2)//240 >= potionID <= 261 + damage_level = 3; + if ( potionID >= ITEM_POTION_STONE_TO_FLESH && alchemy_skill_level <= 3 )// 262 < potionID damage_level = 4; } } - else + else//no skill(нет навыка) { - if ( v16 >= ITEM_POTION_CURE_DISEASE && v16 <= ITEM_POTION_AWAKEN )//225 <= v16 <= 227 + if ( potionID >= ITEM_POTION_CURE_DISEASE && potionID <= ITEM_POTION_AWAKEN )//225 <= v16 <= 227 damage_level = 1; - if ( v16 >= ITEM_POTION_HASTE && v16 <= ITEM_POTION_CURE_INSANITY )//228 <= v16 <= 239 + if ( potionID >= ITEM_POTION_HASTE && potionID <= ITEM_POTION_CURE_INSANITY )//228 <= v16 <= 239 damage_level = 2; - if ( v16 >= ITEM_POTION_MIGHT_BOOST && v16 <= ITEM_POTION_BODY_RESISTANE )//240 <= v16 <= 261 + if ( potionID >= ITEM_POTION_MIGHT_BOOST && potionID <= ITEM_POTION_BODY_RESISTANE )//240 <= v16 <= 261 damage_level = 3; - if ( v16 >= ITEM_POTION_STONE_TO_FLESH )//262 <= v16 + if ( potionID >= ITEM_POTION_STONE_TO_FLESH )//262 <= v16 damage_level = 4; } - int pOut_y = 0; + int pOut_x = item_pid + 1; - v17 = (int)pPlayers[uActiveCharacter]->pInventoryMatrix; - while ( *(int *)v17 != pOut_x ) + for ( uint i = 0; i < 126; ++i ) { - ++pOut_y; - v17 += 4; - if ( pOut_y >= 126 ) + if ( pPlayers[uActiveCharacter]->pInventoryMatrix[i] == pOut_x ) { - v18 = pOut_y; - goto LABEL_59; + pOut_y = i; + break; } } - v18 = pOut_y; -LABEL_59: - if ( !damage_level ) + if ( !potionID ) { GameUI_DrawItemInfo(item); return; } if ( damage_level == 1 ) { - pPlayers[uActiveCharacter]->RemoveItemAtInventoryIndex(v18); - v26 = rand(); - pPlayers[uActiveCharacter]->ReceiveDamage(v26 % 11 + 10, DMGT_FIRE); + pPlayers[uActiveCharacter]->RemoveItemAtInventoryIndex(pOut_y); + pPlayers[uActiveCharacter]->ReceiveDamage(rand() % 11 + 10, DMGT_FIRE); + pAudioPlayer->PlaySound(SOUND_8, 0, 0, -1, 0, 0, 0, 0); + pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); + v39.z = pParty->vPosition.z + pParty->sEyelevel; + v39.x = pParty->vPosition.x; + v39.y = pParty->vPosition.y; + + int rot_x, rot_y, rot_z; + Vec3_int_::Rotate(64, pParty->sRotationY, pParty->sRotationX, v39, &rot_x, &rot_y, &rot_z); + sub_42F7EB_DropItemAt(0x41Bu, rot_x, rot_y, rot_z, 0, 1, 0, 0, 0); + if ( dword_4E455C ) + { + if ( pPlayers[uActiveCharacter]->CanAct() ) + pPlayers[uActiveCharacter]->PlaySound(SPEECH_17, 0); + ShowStatusBarString(pGlobalTXT_LocalizationStrings[444], 2);//Ой! + dword_4E455C = 0; + } + pMouse->RemoveHoldingItem(); + no_rightlick_in_inventory = 1; + return; + } + if ( damage_level == 2 ) + { + pPlayers[uActiveCharacter]->RemoveItemAtInventoryIndex(pOut_y); + pPlayers[uActiveCharacter]->ReceiveDamage(rand() % 71 + 30, DMGT_FIRE); + pPlayers[uActiveCharacter]->ItemsEnchant(1); + pAudioPlayer->PlaySound(SOUND_8, 0, 0, -1, 0, 0, 0, 0); + pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); + + v39.z = pParty->vPosition.z + pParty->sEyelevel; + v39.x = pParty->vPosition.x; + v39.y = pParty->vPosition.y; + + int rot_x, rot_y, rot_z; + Vec3_int_::Rotate(64, pParty->sRotationY, pParty->sRotationX, v39, &rot_x, &rot_y, &rot_z); + sub_42F7EB_DropItemAt(0x41Bu, rot_x, rot_y, rot_z, 0, 1, 0, 0, 0); + if ( dword_4E455C ) + { + if ( pPlayers[uActiveCharacter]->CanAct() ) + pPlayers[uActiveCharacter]->PlaySound(SPEECH_17, 0); + ShowStatusBarString(pGlobalTXT_LocalizationStrings[444], 2);//Ой! + dword_4E455C = 0; + } + pMouse->RemoveHoldingItem(); + no_rightlick_in_inventory = 1; + return; + } + if ( damage_level == 3 ) + { + pPlayers[uActiveCharacter]->RemoveItemAtInventoryIndex(pOut_y); + pPlayers[uActiveCharacter]->ReceiveDamage(rand() % 201 + 50, DMGT_FIRE); + pPlayers[uActiveCharacter]->ItemsEnchant(5); pAudioPlayer->PlaySound(SOUND_8, 0, 0, -1, 0, 0, 0, 0); pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); v39.z = pParty->vPosition.z + pParty->sEyelevel; - } - else - { - if ( damage_level == 2 ) - { - pPlayers[uActiveCharacter]->RemoveItemAtInventoryIndex(v18); - v25 = rand(); - pPlayers[uActiveCharacter]->ReceiveDamage(v25 % 71 + 30, DMGT_FIRE); - v23 = 1; - } - else + v39.x = pParty->vPosition.x; + v39.y = pParty->vPosition.y; + + int rot_x, rot_y, rot_z; + Vec3_int_::Rotate(64, pParty->sRotationY, pParty->sRotationX, v39, &rot_x, &rot_y, &rot_z); + sub_42F7EB_DropItemAt(0x41Bu, rot_x, rot_y, rot_z, 0, 1, 0, 0, 0); + if ( dword_4E455C ) { - if ( damage_level == 3 ) - { - pPlayers[uActiveCharacter]->RemoveItemAtInventoryIndex(v18); - v24 = rand(); - pPlayers[uActiveCharacter]->ReceiveDamage(v24 % 201 + 50, DMGT_FIRE); - v23 = 5; - } - else - { - if ( damage_level != 4 ) - { - if ( damage_level != 5 ) - { - v19 = pPlayers[uActiveCharacter]->AddItem(-1, 0xDCu); - if ( v19 ) - pPlayers[uActiveCharacter]->pOwnItems[v19-1].uAttributes = ITEM_IDENTIFIED; - v20 = v14 + 50 * v15; - pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uItemID = damage_level; - pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uEnchantmentType = (pParty->pPickedItem.uEnchantmentType - + pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uEnchantmentType) - / 2; - pPlayers[uActiveCharacter]->SetVariable(VAR_AutoNotes, *(short *)&pItemsTable->potion_note[2 * v20 ]);//field_10168 + 388 - v22 = (int)((char *)pPlayers[uActiveCharacter] + 36 * item_pid); - if ( !(pItemsTable->pItems[*(int *)(v22 + 532) ].uItemID_Rep_St) ) - *(int *)(v22 + 552) |= 1u; - if ( !dword_4E455C ) - { - pMouse->RemoveHoldingItem(); - no_rightlick_in_inventory = 1; - return; - } - pPlayers[uActiveCharacter]->PlaySound(SPEECH_DO_POTION_FINE, 0); - dword_4E455C = 0; - pMouse->RemoveHoldingItem(); - no_rightlick_in_inventory = 1; - return; - } - if ( alchemy_skill_points ) - { - if ( *(int *)(pPlayers[uActiveCharacter] + 36 * item_pid + 532) == 221 ) - *(int *)(pPlayers[uActiveCharacter] + 36 * item_pid + 532) = pParty->pPickedItem.uItemID; - else - *(int *)(pPlayers[uActiveCharacter] + 36 * item_pid + 536) = pParty->pPickedItem.uEnchantmentType; - v21 = pPlayers[uActiveCharacter]->AddItem(-1, 0xDCu); - if ( v21 ) - //*(int *)&v0->field_1F5[36 * v21 + 15] = 1; - pPlayers[uActiveCharacter]->pOwnItems[v21-1].uAttributes=ITEM_IDENTIFIED; - v22 = (int)((char *)pPlayers[uActiveCharacter] + 36 * item_pid); - if ( !(pItemsTable->pItems[*(int *)(v22 + 532) ].uItemID_Rep_St) ) - *(int *)(v22 + 552) |= 1u; - if ( !dword_4E455C ) - { - pMouse->RemoveHoldingItem(); - no_rightlick_in_inventory = 1; - return; - } - pPlayers[uActiveCharacter]->PlaySound(SPEECH_DO_POTION_FINE, 0); - dword_4E455C = 0; - pMouse->RemoveHoldingItem(); - no_rightlick_in_inventory = 1; - return; - } - GameUI_DrawItemInfo(item); - return; - } - pPlayers[uActiveCharacter]->RemoveItemAtInventoryIndex(v18); - pPlayers[uActiveCharacter]->SetCondition(0x10u, 0); - v23 = 0; - } + if ( pPlayers[uActiveCharacter]->CanAct() ) + pPlayers[uActiveCharacter]->PlaySound(SPEECH_17, 0); + ShowStatusBarString(pGlobalTXT_LocalizationStrings[444], 2);//Ой! + dword_4E455C = 0; } - pPlayers[uActiveCharacter]->ItemsEnchant(v23); + pMouse->RemoveHoldingItem(); + no_rightlick_in_inventory = 1; + return; + } + if ( damage_level == 4 ) + { + pPlayers[uActiveCharacter]->RemoveItemAtInventoryIndex(pOut_y); + pPlayers[uActiveCharacter]->SetCondition(0x10u, 0); + pPlayers[uActiveCharacter]->ItemsEnchant(0); pAudioPlayer->PlaySound(SOUND_8, 0, 0, -1, 0, 0, 0, 0); pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); v39.z = pParty->vPosition.z + pParty->sEyelevel; - } - v39.x = pParty->vPosition.x; - v39.y = pParty->vPosition.y; + v39.x = pParty->vPosition.x; + v39.y = pParty->vPosition.y; - int rot_x, rot_y, rot_z; - Vec3_int_::Rotate(64, pParty->sRotationY, pParty->sRotationX, v39, &rot_x, &rot_y, &rot_z); - sub_42F7EB_DropItemAt(0x41Bu, rot_x, rot_y, rot_z, 0, 1, 0, 0, 0); - if ( dword_4E455C ) + int rot_x, rot_y, rot_z; + Vec3_int_::Rotate(64, pParty->sRotationY, pParty->sRotationX, v39, &rot_x, &rot_y, &rot_z); + sub_42F7EB_DropItemAt(0x41Bu, rot_x, rot_y, rot_z, 0, 1, 0, 0, 0); + if ( dword_4E455C ) + { + if ( pPlayers[uActiveCharacter]->CanAct() ) + pPlayers[uActiveCharacter]->PlaySound(SPEECH_17, 0); + ShowStatusBarString(pGlobalTXT_LocalizationStrings[444], 2);//Ой! + dword_4E455C = 0; + } + pMouse->RemoveHoldingItem(); + no_rightlick_in_inventory = 1; + return; + } + if ( damage_level == 0 ) { - if ( pPlayers[uActiveCharacter]->CanAct() ) - pPlayers[uActiveCharacter]->PlaySound(SPEECH_17, 0); - ShowStatusBarString(pGlobalTXT_LocalizationStrings[444], 2u); - dword_4E455C = 0; + if ( alchemy_skill_points ) + { + if ( pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uItemID == 221 || pParty->pPickedItem.uItemID == 221 )//catalyst(катализатор) + { + if ( pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uItemID == 221 ) + pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uItemID = pParty->pPickedItem.uItemID; + if ( pParty->pPickedItem.uItemID == 221 ) + pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uEnchantmentType = pParty->pPickedItem.uEnchantmentType; + } + else + { + pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uItemID = potionID; + pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uEnchantmentType = (pParty->pPickedItem.uEnchantmentType + + pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uEnchantmentType) / 2; + pPlayers[uActiveCharacter]->SetVariable(VAR_AutoNotes, pItemsTable->potion_note[potion1_id][potion2_id]); + } + int bottle = pPlayers[uActiveCharacter]->AddItem(-1, 220);//бутылка + if ( bottle ) + pPlayers[uActiveCharacter]->pOwnItems[bottle - 1].uAttributes = ITEM_IDENTIFIED; + if ( !(pItemsTable->pItems[pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uItemID].uItemID_Rep_St) ) + pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uAttributes |= 1; + if ( !dword_4E455C ) + { + pMouse->RemoveHoldingItem(); + no_rightlick_in_inventory = 1; + return; + } + pPlayers[uActiveCharacter]->PlaySound(SPEECH_DO_POTION_FINE, 0); + dword_4E455C = 0; + pMouse->RemoveHoldingItem(); + no_rightlick_in_inventory = 1; + return; + } + GameUI_DrawItemInfo(item); + return; } - pMouse->RemoveHoldingItem(); - no_rightlick_in_inventory = 1; - return; } - pMouse->RemoveHoldingItem(); - no_rightlick_in_inventory = true; + GameUI_DrawItemInfo(item); return; }
--- a/UI/UISaveLoad.cpp Fri Sep 27 10:04:45 2013 +0200 +++ b/UI/UISaveLoad.cpp Fri Sep 27 10:05:25 2013 +0200 @@ -21,125 +21,76 @@ //----- (004601B7) -------------------------------------------------------- static void UI_DrawSaveLoad(bool save) { - //unsigned __int16 v1; // bx@1 - unsigned int v2; // edi@4 - unsigned int v3; // eax@4 - unsigned int v4; // eax@8 - int v5; // edi@8 - unsigned int v6; // eax@8 - unsigned int pMapID; // eax@10 - signed __int64 v8; // qax@10 - unsigned int v9; // ebx@10 - unsigned __int64 v10; // qax@10 - __int64 v11; // qax@10 - char v12; // di@10 - unsigned __int64 v13; // qtt@10 - unsigned int v14; // ecx@10 - __int64 pOurHour; // qax@10 - int v16; // edi@10 - signed int pHour; // ebx@22 - int v19; // eax@32 - const char *v20; // ST18_4@32 - int v21; // eax@32 - int v23; // eax@32 const char *pSlotName; // edi@36 - int v25; // eax@43 - GUIWindow pWindow; // [sp+Ch] [bp-78h]@8 - int pMinutes; // [sp+60h] [bp-24h]@10 - int pMonthNum; // [sp+68h] [bp-1Ch]@10 + GUIWindow save_load_window; // [sp+Ch] [bp-78h]@8 unsigned int pSaveFiles; // [sp+70h] [bp-14h]@10 - __int64 pAMPM2; // [sp+74h] [bp-10h]@10 - int pYear; // [sp+7Ch] [bp-8h]@10 - int pFilesID; + unsigned __int64 full_hours; + unsigned __int64 full_days; + int full_weeks; + int full_month; + int current_year; + int current_month; + int current_day; + int current_hour; + int current_minutes; - //v1 = 255; - //TargetColor(0xFF, 0xFF, 0xFF); - //TargetColor(0xFF, 0xFF, 0x9B); pRenderer->BeginScene(); if ( GetCurrentMenuID() != MENU_SAVELOAD && GetCurrentMenuID() != MENU_LoadingProcInMainMenu ) { pRenderer->DrawTextureIndexed(8, 8, pIcons_LOD->GetTexture(uTextureID_loadsave)); if (save) { - v2 = uTextureID_save_up; - v3 = uTextureID_LS_saveU; + pRenderer->DrawTextureIndexed(241, 302, pIcons_LOD->GetTexture(uTextureID_LS_saveU)); + pRenderer->DrawTextureIndexed( 18, 139, pIcons_LOD->GetTexture(uTextureID_save_up)); } else { - v2 = uTextureID_load_up; - v3 = uTextureID_LS_loadU; + pRenderer->DrawTextureIndexed(241, 302, pIcons_LOD->GetTexture(uTextureID_LS_loadU)); + pRenderer->DrawTextureIndexed( 18, 139, pIcons_LOD->GetTexture(uTextureID_load_up)); } - pRenderer->DrawTextureIndexed(241, 302, pIcons_LOD->GetTexture(v3)); - pRenderer->DrawTextureIndexed( 18, 139, pIcons_LOD->GetTexture(v2)); pRenderer->DrawTextureIndexed(351, 302, pIcons_LOD->GetTexture(uTextureID_x_u)); } if ( pSavegameUsedSlots[uLoadGameUI_SelectedSlot] ) { - memset(&pWindow, 0, 0x54); - pWindow.uFrameX = pGUIWindow_CurrentMenu->uFrameX + 240; - v4 = pGUIWindow_CurrentMenu->uFrameY - pFontSmallnum->uFontHeight; - pWindow.uFrameWidth = 220; - v4 += 157; - pWindow.uFrameY = v4; - v5 = pFontSmallnum->uFontHeight; - pWindow.uFrameZ = pWindow.uFrameX + 219; - pWindow.uFrameHeight = v5; - pWindow.uFrameW = v5 + v4 - 1; - v6 = uLoadGameUI_SelectedSlot; - if (pSavegameThumbnails[uLoadGameUI_SelectedSlot].pPixels) - { + memset(&save_load_window, 0, 0x54); + save_load_window.uFrameX = pGUIWindow_CurrentMenu->uFrameX + 240; + save_load_window.uFrameWidth = 220; + save_load_window.uFrameY = (pGUIWindow_CurrentMenu->uFrameY - pFontSmallnum->uFontHeight) + 157; + save_load_window.uFrameZ = save_load_window.uFrameX + 219; + save_load_window.uFrameHeight = pFontSmallnum->uFontHeight; + save_load_window.uFrameW = pFontSmallnum->uFontHeight + save_load_window.uFrameY - 1; + if ( pSavegameThumbnails[uLoadGameUI_SelectedSlot].pPixels ) pRenderer->DrawTextureRGB(pGUIWindow_CurrentMenu->uFrameX + 276, pGUIWindow_CurrentMenu->uFrameY + 171, &pSavegameThumbnails[uLoadGameUI_SelectedSlot]); - v6 = uLoadGameUI_SelectedSlot; - } - pMapID = pMapStats->GetMapInfo(pSavegameHeader[v6].pLocationName); - pWindow.DrawTitleText(pFontSmallnum, 0, 0, 0, pMapStats->pInfos[pMapID].pName, 3); - v8 = (signed __int64)(pSavegameHeader[uLoadGameUI_SelectedSlot].uWordTime * 0.234375) / 60; - pMinutes = (int)(((signed __int64)(pSavegameHeader[uLoadGameUI_SelectedSlot].uWordTime * 0.234375) / 60) >> 32); - v9 = v8; - v8 /= 60i64; - pAMPM2 = v8; - v10 = (unsigned int)v8 / 24; - pSaveFiles = v10; - v11 = (unsigned int)(v10 / 7); - v12 = v11; - LODWORD(v13) = (unsigned int)v11 >> 2; - HIDWORD(v13) = HIDWORD(v11); - pMonthNum = v13 % 12; - pYear = v13 / 12; - pMinutes = (int)__PAIR__(pMinutes, v9) % 60; - pOurHour = pAMPM2 % 24; - v14 = (unsigned __int64)(pAMPM2 % 24) >> 32; - LODWORD(pAMPM2) = pAMPM2 % 24; - HIDWORD(pOurHour) = pSaveFiles % 28; - pYear += game_starting_year; - v16 = v12 & 3; - pWindow.uFrameY = pGUIWindow_CurrentMenu->uFrameY + 261; - HIDWORD(pAMPM2) = v14 == 0 && ((signed int)v14 > 0 || (unsigned int)pOurHour >= 12) - && (signed int)v14 <= 0 && (v14 != 0 || (unsigned int)pOurHour < 24); - if ( v14 != 0 || ((signed int)v14 <= 0) && (unsigned int)pOurHour <= 12 ) +//Draw map name + save_load_window.DrawTitleText(pFontSmallnum, 0, 0, 0, pMapStats->pInfos[pMapStats->GetMapInfo(pSavegameHeader[uLoadGameUI_SelectedSlot].pLocationName)].pName, 3); +//Draw date + full_hours = ((signed __int64)(pSavegameHeader[uLoadGameUI_SelectedSlot].uWordTime * 0.234375) / 60) / 60i64; + full_days = (unsigned int)full_hours / 24; + full_weeks = (unsigned int)(full_days / 7); + full_month = (unsigned int)full_weeks / 4; + current_year = (full_month / 12) + game_starting_year; + current_month = full_month % 12; + current_day = full_days % 28; + current_hour = full_hours % 24; + current_minutes = (((signed __int64)(pSavegameHeader[uLoadGameUI_SelectedSlot].uWordTime * 0.234375) / 60) % 60i64); + + save_load_window.uFrameY = pGUIWindow_CurrentMenu->uFrameY + 261; + int am; + if ( (signed int)current_hour >= 12 ) { - if ( !(v14 | (unsigned int)pOurHour) ) - { - pSaveFiles = 0; - pHour = 12; - goto LABEL_23; - } + current_hour -= 12; + if ( !current_hour ) + current_hour = 12; + am = 1; } else - { - v14 = (__PAIR__(v14, (unsigned int)pOurHour) - 12) >> 32; - LODWORD(pOurHour) = pOurHour - 12; - } - pHour = pOurHour; - pSaveFiles = v14; -LABEL_23: - auto day = aDayNames[HIDWORD(pOurHour) % 7]; - auto ampm = aAMPMNames[HIDWORD(pAMPM2)]; - auto month = aMonthNames[pMonthNum]; - //sprintf(pTmpBuf.data(), "%s %d:%02d%s\n%d %s %d", _d, v17, (int)32, _a, 3, _m, pFilesID); - sprintfex(pTmpBuf.data(), "%s %d:%02d%s\n%d %s %d", day, pHour, pMinutes, ampm, 7 * v16 + HIDWORD(pOurHour) % 7 + 1, month, pYear); - pWindow.DrawTitleText(pFontSmallnum, 0, 0, 0, pTmpBuf.data(), 3u); - //v1 = 255; + am = 0; + auto day = aDayNames[full_days % 7]; + auto ampm = aAMPMNames[am]; + auto month = aMonthNames[current_month]; + + sprintfex(pTmpBuf.data(), "%s %d:%02d %s\n%d %s %d", day, current_hour, current_minutes, aAMPMNames[am], current_day + 1, month, current_year); + save_load_window.DrawTitleText(pFontSmallnum, 0, 0, 0, pTmpBuf.data(), 3); } if ( pGUIWindow_CurrentMenu->receives_keyboard_input_2 == WINDOW_INPUT_CONFIRMED) { @@ -154,15 +105,12 @@ } if (GetCurrentMenuID() == MENU_LoadingProcInMainMenu) { - //v18 = pGlobalTXT_LocalizationStrings[135]; - v19 = pFontSmallnum->AlignText_Center(0xBA, pGlobalTXT_LocalizationStrings[135]);//"Загрузка" - pGUIWindow_CurrentMenu->DrawText(pFontSmallnum, v19 + 25, 220, 0, pGlobalTXT_LocalizationStrings[135], 0, 0, 0); - v20 = (const char *)(&pSavegameHeader[uLoadGameUI_SelectedSlot]); - v21 = pFontSmallnum->AlignText_Center(0xBA, (const char *)pSavegameHeader.data() + 100 * uLoadGameUI_SelectedSlot); - pGUIWindow_CurrentMenu->DrawTextInRect(pFontSmallnum, v21 + 25, 0x106, 0, v20, 185, 0); - //v22 = pGlobalTXT_LocalizationStrings[165]; - v23 = pFontSmallnum->AlignText_Center(0xBA, pGlobalTXT_LocalizationStrings[165]);//"Пожалуйста, пожождите" - pGUIWindow_CurrentMenu->DrawText(pFontSmallnum, v23 + 25, 304, 0, pGlobalTXT_LocalizationStrings[165], 0, 0, 0); + pGUIWindow_CurrentMenu->DrawText(pFontSmallnum, pFontSmallnum->AlignText_Center(186, pGlobalTXT_LocalizationStrings[135]) + 25, + 220, 0, pGlobalTXT_LocalizationStrings[135], 0, 0, 0);//Загрузка + pGUIWindow_CurrentMenu->DrawTextInRect(pFontSmallnum, pFontSmallnum->AlignText_Center(186, + (const char *)pSavegameHeader.data() + 100 * uLoadGameUI_SelectedSlot) + 25, 0x106, 0, pSavegameHeader[uLoadGameUI_SelectedSlot].pName, 185, 0); + pGUIWindow_CurrentMenu->DrawText(pFontSmallnum, pFontSmallnum->AlignText_Center(186, pGlobalTXT_LocalizationStrings[165]) + 25, + 304, 0, pGlobalTXT_LocalizationStrings[165], 0, 0, 0);//"Пожалуйста, пожождите" } else { @@ -170,29 +118,19 @@ pSaveFiles = 40; else pSaveFiles = uNumSavegameFiles; - int a4 = 199; - pFilesID = pSaveListPosition; - pSlotName = (const char *)(&pSavegameHeader[pSaveListPosition]);//draw name for save slot - do + + int slot_Y = 199; + for ( uint i = pSaveListPosition; i < pSaveFiles; ++i ) { - if ( pFilesID >= (signed int)pSaveFiles ) + if ( slot_Y >= 346 ) break; - short clr; - HIDWORD(pAMPM2) = clr = (pFilesID == uLoadGameUI_SelectedSlot ? TargetColor(0xFF, 0xFF, 0x64) : 0); - if ( pGUIWindow_CurrentMenu->receives_keyboard_input_2 != WINDOW_INPUT_IN_PROGRESS || pFilesID != uLoadGameUI_SelectedSlot ) - { - pGUIWindow_CurrentMenu->DrawTextInRect(pFontSmallnum, 0x1B, a4, clr, pSlotName, 185, 0); - } + if ( pGUIWindow_CurrentMenu->receives_keyboard_input_2 != WINDOW_INPUT_IN_PROGRESS || i != uLoadGameUI_SelectedSlot ) + pGUIWindow_CurrentMenu->DrawTextInRect(pFontSmallnum, 27, slot_Y, i == uLoadGameUI_SelectedSlot ? TargetColor(0xFF, 0xFF, 0x64) : 0, pSavegameHeader[i].pName, 185, 0); else - { - v25 = pGUIWindow_CurrentMenu->DrawTextInRect(pFontSmallnum, 0x1B, a4, clr, (const char *)pKeyActionMap->pPressedKeysBuffer, 175, 1); - pGUIWindow_CurrentMenu->DrawFlashingInputCursor(v25 + 27, a4, pFontSmallnum); - } - a4 += 21; - ++pFilesID; - pSlotName += 100; + pGUIWindow_CurrentMenu->DrawFlashingInputCursor(pGUIWindow_CurrentMenu->DrawTextInRect(pFontSmallnum, 27, slot_Y, i == uLoadGameUI_SelectedSlot ? TargetColor(0xFF, 0xFF, 0x64) : 0, (const char *)pKeyActionMap->pPressedKeysBuffer, 175, 1) + 27, + slot_Y, pFontSmallnum); + slot_Y += 21; } - while ( a4 < 346 ); } pRenderer->EndScene(); }