Mercurial > mm7
changeset 1817:0f1543750bf8
Changing itemlist accesses to helper functions + getting rid of some pPlayers array accesses
author | Grumpy7 |
---|---|
date | Mon, 07 Oct 2013 06:37:49 +0200 |
parents | 3f1e09a71726 |
children | 253194aba8b8 |
files | Actor.cpp Events.cpp UI/UICharacter.cpp |
diffstat | 3 files changed, 60 insertions(+), 60 deletions(-) [+] |
line wrap: on
line diff
--- a/Actor.cpp Sun Oct 06 09:21:09 2013 +0200 +++ b/Actor.cpp Mon Oct 07 06:37:49 2013 +0200 @@ -5001,7 +5001,7 @@ v59 = 1; if ( player->HasItemEquipped(EQUIP_MAIN_HAND) ) { - auto main_hand_skill = player->pInventoryItemList[main_hand_idx - 1].GetPlayerSkillType(); + auto main_hand_skill = player->GetMainHandItem()->GetPlayerSkillType(); //v55 = pItemsTable->pItems[player->pInventoryItems[main_hand_idx - 1].uItemID].uSkillType; //v28 = SkillToMastery(player->pActiveSkills[v55]); auto main_hand_mastery = SkillToMastery(player->pActiveSkills[main_hand_skill]);
--- a/Events.cpp Sun Oct 06 09:21:09 2013 +0200 +++ b/Events.cpp Mon Oct 07 06:37:49 2013 +0200 @@ -924,7 +924,7 @@ } else if ( player_choose == 6 ) //random { - if ( pPlayers[rand() % 4]->CompareVariable((enum VariableType)EVT_WORD(_evt->v5), pValue) ) + if ( pPlayers[rand() % 4 + 1]->CompareVariable((enum VariableType)EVT_WORD(_evt->v5), pValue) ) { v124 = -1; curr_seq_num = _evt->v11 - 1;
--- a/UI/UICharacter.cpp Sun Oct 06 09:21:09 2013 +0200 +++ b/UI/UICharacter.cpp Mon Oct 07 06:37:49 2013 +0200 @@ -776,16 +776,16 @@ if ( !bRingsShownInCharScreen ) pRenderer->DrawMaskToZBuffer(pPaperdoll_BodyX, pPaperdoll_BodyY, pIcons_LOD->GetTexture(papredoll_dbods[uPlayerID - 1]), player->pEquipment.uArmor); //Рука не занята или ... - if ( !player->pEquipment.uMainHand - || ( pPlayers[uPlayerID]->pInventoryItemList[player->pEquipment.uMainHand - 1].GetItemEquipType() != EQUIP_MAIN_HAND) - && (pPlayers[uPlayerID]->pInventoryItemList[player->pEquipment.uMainHand - 1].GetItemEquipType() != PLAYER_SKILL_SPEAR - || pPlayers[uPlayerID]->pEquipment.uShield) ) + if ( !player->GetItem(&PlayerEquipment::uMainHand) + || ( player->GetMainHandItem()->GetItemEquipType() != EQUIP_MAIN_HAND) + && (player->GetMainHandItem()->GetItemEquipType() != PLAYER_SKILL_SPEAR + || player->GetItem(&PlayerEquipment::uShield)) ) pRenderer->DrawTextureTransparent(pPaperdoll_BodyX + pPaperdoll_LeftHand[pBodyComplection][0], pPaperdoll_BodyY + pPaperdoll_LeftHand[pBodyComplection][1], pIcons_LOD->GetTexture(papredoll_dlads[uPlayerID - 1])); //-----------------------------------------------------(Hand/Рука)--------------------------------------------------------------- - if ( pPlayers[uPlayerID]->pEquipment.uMainHand ) + if ( player->GetItem(&PlayerEquipment::uMainHand) ) { - item = &pPlayers[uPlayerID]->pInventoryItemList[pPlayers[uPlayerID]->pEquipment.uMainHand - 1]; + item = player->GetMainHandItem(); item_X = pPaperdoll_BodyX + paperdoll_Weapon[pBodyComplection][1][0] - pItemsTable->pItems[item->uItemID].uEquipX; item_Y = pPaperdoll_BodyY + paperdoll_Weapon[pBodyComplection][1][1] - pItemsTable->pItems[item->uItemID].uEquipY; if ( item->uItemID == 64 ) //blaster @@ -825,15 +825,15 @@ pIcons_LOD->LoadTexturePtr(container, TEXTURE_16BIT_PALETTE), GetTickCount() * 0.1, 0, 255); } if ( !bRingsShownInCharScreen ) - pRenderer->DrawMaskToZBuffer(item_X, item_Y, pIcons_LOD->GetTexture(pIcons_LOD->LoadTexture(v166, TEXTURE_16BIT_PALETTE)), pPlayers[uPlayerID]->pEquipment.uMainHand); + pRenderer->DrawMaskToZBuffer(item_X, item_Y, pIcons_LOD->GetTexture(pIcons_LOD->LoadTexture(v166, TEXTURE_16BIT_PALETTE)), player->pEquipment.uMainHand); } } else// без акваланга { //----------------(Bow/ Лук)------------------------------------------------- - if ( pPlayers[uPlayerID]->pEquipment.uBow ) + if ( player->GetItem(&PlayerEquipment::uBow) ) { - item = &pPlayers[uPlayerID]->pInventoryItemList[pPlayers[uPlayerID]->pEquipment.uBow - 1]; + item = player->GetBowItem(); item_X = pPaperdoll_BodyX + paperdoll_Weapon[pBodyComplection][2][0] - pItemsTable->pItems[item->uItemID].uEquipX; item_Y = pPaperdoll_BodyY + paperdoll_Weapon[pBodyComplection][2][1] - pItemsTable->pItems[item->uItemID].uEquipY; if ( !(item->uAttributes & 0xF0) )// если не применён закл @@ -871,12 +871,12 @@ } if ( !bRingsShownInCharScreen ) pRenderer->DrawMaskToZBuffer(item_X, item_Y, pIcons_LOD->GetTexture(pIcons_LOD->LoadTexture(item->GetIconName(), TEXTURE_16BIT_PALETTE)), - pPlayers[uPlayerID]->pEquipment.uBow); + player->pEquipment.uBow); } //-----------------------------(Cloak/Плащ)--------------------------------------------------------- - if ( pPlayers[uPlayerID]->pEquipment.uCloak ) + if ( player->GetItem(&PlayerEquipment::uCloak) ) { - item = &pPlayers[uPlayerID]->pInventoryItemList[pPlayers[uPlayerID]->pEquipment.uCloak - 1]; + item = player->GetCloakItem(); switch ( item->uItemID ) { case ITEM_RELIC_TWILIGHT: @@ -931,15 +931,15 @@ } if ( !bRingsShownInCharScreen ) pRenderer->DrawMaskToZBuffer(item_X, item_Y, pIcons_LOD->GetTexture(paperdoll_cloak_texture[pBodyComplection][index]), - pPlayers[uPlayerID]->pEquipment.uCloak); + player->pEquipment.uCloak); } } //-------------------------------(Paperdoll/Кукла)------------------------------------------- pRenderer->DrawTextureTransparent(pPaperdoll_BodyX, pPaperdoll_BodyY, pIcons_LOD->GetTexture(papredoll_dbods[uPlayerID - 1])); //-------------------------------(Armor/Броня)----------------------------------------------- - if ( pPlayers[uPlayerID]->pEquipment.uArmor ) + if ( player->GetItem(&PlayerEquipment::uArmor) ) { - item = &pPlayers[uPlayerID]->pInventoryItemList[pPlayers[uPlayerID]->pEquipment.uArmor - 1]; + item = player->GetArmorItem(); switch ( item->uItemID ) { case ITEM_ARTIFACT_GOVERNORS_ARMOR: @@ -997,19 +997,19 @@ if ( !bRingsShownInCharScreen ) pRenderer->DrawMaskToZBuffer(item_X, item_Y, &pIcons_LOD->pTextures[paperdoll_armor_texture[pBodyComplection][index][0]], - pPlayers[uPlayerID]->pEquipment.uArmor); + player->pEquipment.uArmor); } } //----------------------------------(End of Armor/Конец Брони)------------------------------------------ //----------------------------------(Boot/Обувь)-------------------------------------------------------- - if ( pPlayers[uPlayerID]->pEquipment.uBoot ) + if ( player->GetItem(&PlayerEquipment::uBoot) ) { - item = &pPlayers[uPlayerID]->pInventoryItemList[pPlayers[uPlayerID]->pEquipment.uBoot - 1]; + item = player->GetBootItem(); switch ( item->uItemID ) { case ITEM_ARTIFACT_HERMES_SANDALS: index = 5; - v59 = papredoll_flying_feet[pPlayers[uPlayerID]->uCurrentFace]; + v59 = papredoll_flying_feet[player->uCurrentFace]; break; case ITEM_ARTIFACT_LEAGUE_BOOTS: index = 6; @@ -1057,20 +1057,20 @@ GetTickCount() * 0.1, 0, 255); } if ( !bRingsShownInCharScreen ) - pRenderer->DrawMaskToZBuffer(item_X, item_Y, pIcons_LOD->GetTexture(v59), pPlayers[uPlayerID]->pEquipment.uBoot); + pRenderer->DrawMaskToZBuffer(item_X, item_Y, pIcons_LOD->GetTexture(v59), player->pEquipment.uBoot); } } //--------------------------------------------(Hand/Рука)------------------------------------------------------ - if ( !pPlayers[uPlayerID]->pEquipment.uMainHand - || ( pPlayers[uPlayerID]->pInventoryItemList[pPlayers[uPlayerID]->pEquipment.uMainHand -1].GetItemEquipType() != EQUIP_MAIN_HAND) - && (pPlayers[uPlayerID]->pInventoryItemList[pPlayers[uPlayerID]->pEquipment.uMainHand -1].GetPlayerSkillType() != PLAYER_SKILL_SPEAR - || pPlayers[uPlayerID]->pEquipment.uShield) ) + if ( !player->GetItem(&PlayerEquipment::uMainHand) + || ( player->GetMainHandItem()->GetItemEquipType() != EQUIP_MAIN_HAND) + && (player->GetMainHandItem()->GetPlayerSkillType() != PLAYER_SKILL_SPEAR + || player->GetItem(&PlayerEquipment::uShield)) ) pRenderer->DrawTextureTransparent(pPaperdoll_BodyX + pPaperdoll_LeftHand[pBodyComplection][0], pPaperdoll_BodyY + pPaperdoll_LeftHand[pBodyComplection][1], pIcons_LOD->GetTexture(papredoll_dlads[uPlayerID - 1])); //--------------------------------------------(Belt/Пояс)------------------------------------------------------- - if ( pPlayers[uPlayerID]->pEquipment.uBelt ) + if ( player->GetItem(&PlayerEquipment::uBelt)) { - item = &pPlayers[uPlayerID]->pInventoryItemList[pPlayers[uPlayerID]->pEquipment.uBelt - 1]; + item = player->GetBeltItem(); switch ( item->uItemID ) { case ITEM_RILIC_TITANS_BELT: @@ -1103,7 +1103,7 @@ pRenderer->DrawTransparentGreenShade(item_X, item_Y, pIcons_LOD->GetTexture(v75)); } if ( !bRingsShownInCharScreen ) - pRenderer->DrawMaskToZBuffer(item_X, item_Y, pIcons_LOD->GetTexture(v75), pPlayers[uPlayerID]->pEquipment.uBelt); + pRenderer->DrawMaskToZBuffer(item_X, item_Y, pIcons_LOD->GetTexture(v75), player->pEquipment.uBelt); } else { @@ -1128,16 +1128,16 @@ } } //---------------------------------------------(Hand2/Рука2)-------------------------------------------------- - if ( pPlayers[uPlayerID]->pEquipment.uMainHand ) + if ( player->GetItem(&PlayerEquipment::uMainHand) ) { - if ( pPlayers[uPlayerID]->pInventoryItemList[pPlayers[uPlayerID]->pEquipment.uMainHand - 1].GetItemEquipType() == EQUIP_MAIN_HAND - || pPlayers[uPlayerID]->pInventoryItemList[pPlayers[uPlayerID]->pEquipment.uMainHand - 1].GetPlayerSkillType() == PLAYER_SKILL_SPEAR - && !pPlayers[uPlayerID]->pEquipment.uShield ) + if ( player->GetMainHandItem()->GetItemEquipType() == EQUIP_MAIN_HAND + || player->GetMainHandItem()->GetPlayerSkillType() == PLAYER_SKILL_SPEAR + && !player->GetItem(&PlayerEquipment::uShield) ) pRenderer->DrawTextureTransparent(pPaperdoll_BodyX + pPaperdoll_SecondLeftHand[pBodyComplection][0], pPaperdoll_BodyY + pPaperdoll_SecondLeftHand[pBodyComplection][1], pIcons_LOD->GetTexture(papredoll_dlaus[uPlayerID - 1])); } //--------------------------------(Shoulder/Плечи)--------------------------------------------- - item = &pPlayers[uPlayerID]->pInventoryItemList[pPlayers[uPlayerID]->pEquipment.uArmor - 1]; + item = player->GetArmorItem(); switch ( item->uItemID ) { case ITEM_ARTIFACT_GOVERNORS_ARMOR: @@ -1158,10 +1158,10 @@ } if ( index >= 0 && index < 17 ) { - if ( pPlayers[uPlayerID]->pEquipment.uMainHand - && (pPlayers[uPlayerID]->GetEquippedItemEquipType(EQUIP_MAIN_HAND) == EQUIP_MAIN_HAND - || pPlayers[uPlayerID]->GetEquippedItemSkillType(EQUIP_MAIN_HAND) == EQUIP_SHIELD - && !pPlayers[uPlayerID]->pEquipment.uShield) )//без щита + if ( player->GetItem(&PlayerEquipment::uMainHand) + && (player->GetMainHandItem()->GetItemEquipType() == EQUIP_MAIN_HAND + || player->GetMainHandItem()->GetPlayerSkillType() == PLAYER_SKILL_SPEAR + && !player->GetItem(&PlayerEquipment::uShield) ))//без щита { v94 = paperdoll_armor_texture[pBodyComplection][index][2]; if ( paperdoll_armor_texture[pBodyComplection][index][2] == pIcons_LOD->FindTextureByName("pending") ) @@ -1260,9 +1260,9 @@ } } //----------------------------------------------(Cloak collar/воротник плаща)------------------------------------- - if ( pPlayers[uPlayerID]->pEquipment.uCloak ) + if ( player->GetItem(&PlayerEquipment::uCloak) ) { - item = &pPlayers[uPlayerID]->pInventoryItemList[pPlayers[uPlayerID]->pEquipment.uCloak - 1]; + item = player->GetCloakItem(); switch ( item->uItemID ) { case ITEM_RELIC_TWILIGHT: @@ -1297,7 +1297,7 @@ pRenderer->DrawTextureTransparent(item_X, item_Y, pIcons_LOD->GetTexture(paperdoll_cloak_collar_texture[pBodyComplection][index])); if ( !bRingsShownInCharScreen ) pRenderer->DrawMaskToZBuffer(item_X, item_Y, pIcons_LOD->GetTexture(paperdoll_cloak_collar_texture[pBodyComplection][index]), - pPlayers[uPlayerID]->pEquipment.uCloak); + player->pEquipment.uCloak); } else { @@ -1323,17 +1323,17 @@ } } //--------------------------------------------(Beards/Борода)------------------------------------------------------- - if ( pPlayers[uPlayerID]->uCurrentFace == 12 || pPlayers[uPlayerID]->uCurrentFace == 13 ) + if ( player->uCurrentFace == 12 || player->uCurrentFace == 13 ) { - if ( papredoll_dbrds[pPlayers[uPlayerID]->uCurrentFace] != pIcons_LOD->FindTextureByName("Pending") ) - pRenderer->DrawTextureTransparent(pPaperdoll_BodyX + pPaperdoll_Beards[2 * pPlayers[uPlayerID]->uCurrentFace - 24], - pPaperdoll_BodyY + pPaperdoll_Beards[2 * pPlayers[uPlayerID]->uCurrentFace - 23], - pIcons_LOD->GetTexture(papredoll_dbrds[pPlayers[uPlayerID]->uCurrentFace])); + if ( papredoll_dbrds[player->uCurrentFace] != pIcons_LOD->FindTextureByName("Pending") ) + pRenderer->DrawTextureTransparent(pPaperdoll_BodyX + pPaperdoll_Beards[2 * player->uCurrentFace - 24], + pPaperdoll_BodyY + pPaperdoll_Beards[2 * player->uCurrentFace - 23], + pIcons_LOD->GetTexture(papredoll_dbrds[player->uCurrentFace])); } //--------------------------------------------(Helm/Шлем)------------------------------------------------------------ - if ( pPlayers[uPlayerID]->pEquipment.uHelm ) + if ( player->GetItem(&PlayerEquipment::uHelm) ) { - item = &pPlayers[uPlayerID]->pInventoryItemList[pPlayers[uPlayerID]->pEquipment.uHelm - 1]; + item = player->GetHelmItem(); switch ( item->uItemID ) { case ITEM_RELIC_TALEDONS_HELM: @@ -1395,13 +1395,13 @@ } } if ( !bRingsShownInCharScreen ) - pRenderer->DrawMaskToZBuffer(item_X, item_Y, pIcons_LOD->GetTexture(v127), pPlayers[uPlayerID]->pEquipment.uHelm); + pRenderer->DrawMaskToZBuffer(item_X, item_Y, pIcons_LOD->GetTexture(v127), player->pEquipment.uHelm); } } //------------------------------------------------(Hand3/Рука3)------------------------------------------- - if ( pPlayers[uPlayerID]->pEquipment.uMainHand ) + if ( player->GetItem(&PlayerEquipment::uMainHand) ) { - item = &pPlayers[uPlayerID]->pInventoryItemList[pPlayers[uPlayerID]->pEquipment.uMainHand - 1]; + item = player->GetMainHandItem(); item_X = pPaperdoll_BodyX + paperdoll_Weapon[pBodyComplection][1][0] - pItemsTable->pItems[item->uItemID].uEquipX; item_Y = pPaperdoll_BodyY + paperdoll_Weapon[pBodyComplection][1][1] - pItemsTable->pItems[item->uItemID].uEquipY; if ( item->uItemID == 64 ) @@ -1442,12 +1442,12 @@ } if ( !bRingsShownInCharScreen ) pRenderer->DrawMaskToZBuffer(item_X, item_Y, pIcons_LOD->GetTexture(pIcons_LOD->LoadTexture(v181, TEXTURE_16BIT_PALETTE)), - pPlayers[uPlayerID]->pEquipment.uMainHand); + player->pEquipment.uMainHand); } //--------------------------------------------------(Shield/Щит)--------------------------------------------- - if ( pPlayers[uPlayerID]->pEquipment.uShield ) + if ( player->GetItem(&PlayerEquipment::uShield) ) { - item = &pPlayers[uPlayerID]->pInventoryItemList[pPlayers[uPlayerID]->pEquipment.uShield - 1]; + item = player->GetOffHandItem(); if ( item->GetPlayerSkillType() == PLAYER_SKILL_DAGGER || item->GetPlayerSkillType() == PLAYER_SKILL_SWORD ) { @@ -1516,18 +1516,18 @@ pPaperdoll_BodyY + pPaperdollLeftEmptyHand[pBodyComplection][1], pIcons_LOD->GetTexture(papredoll_dlhs[uPlayerID - 1])); } if ( !bRingsShownInCharScreen ) - pRenderer->DrawMaskToZBuffer(item_X, item_Y, pIcons_LOD->GetTexture(v153), pPlayers[uPlayerID]->pEquipment.uShield); + pRenderer->DrawMaskToZBuffer(item_X, item_Y, pIcons_LOD->GetTexture(v153), player->pEquipment.uShield); } } //--------------------------------------------------------(RightHand/Правая рука)-------------------------------------------------- pRenderer->DrawTextureTransparent(pPaperdoll_BodyX + pPaperdoll_RightHand[pBodyComplection][0], pPaperdoll_BodyY + pPaperdoll_RightHand[pBodyComplection][1], pIcons_LOD->GetTexture(papredoll_drhs[uPlayerID - 1])); //--------------------------------------------------------(LeftHand/Левая рука)---------------------------------------------------- - if ( pPlayers[uPlayerID]->pEquipment.uMainHand ) + if ( player->GetItem(&PlayerEquipment::uMainHand)) { - item = &pPlayers[uPlayerID]->pInventoryItemList[pPlayers[uPlayerID]->pEquipment.uMainHand - 1]; + item = player->GetMainHandItem(); if ( item->GetItemEquipType() == EQUIP_MAIN_HAND || item->GetPlayerSkillType() == PLAYER_SKILL_SPEAR - && !pPlayers[uPlayerID]->pEquipment.uShield ) + && !player->GetItem(&PlayerEquipment::uShield) ) pRenderer->DrawTextureTransparent(pPaperdoll_BodyX + pPaperdoll_SecondLeftHand[pBodyComplection][0], pPaperdoll_BodyY + pPaperdoll_SecondLeftHand[pBodyComplection][1], pIcons_LOD->GetTexture(papredoll_dlhus[uPlayerID - 1])); @@ -1661,9 +1661,9 @@ player->pEquipment.uRings[i]); } if (player->pEquipment.uAmulet) - CharacterUI_DrawItem(493, 91, &player->pInventoryItemList[player->pEquipment.uAmulet - 1], player->pEquipment.uAmulet); + CharacterUI_DrawItem(493, 91, player->GetAmuletItem(), player->pEquipment.uAmulet); if (player->pEquipment.uGlove) - CharacterUI_DrawItem(586, 88, &player->pInventoryItemList[player->pEquipment.uGlove - 1], player->pEquipment.uGlove); + CharacterUI_DrawItem(586, 88, player->GetGloveItem(), player->pEquipment.uGlove); } //----- (0043BCA7) --------------------------------------------------------