diff --git a/C++ProjectTemplate b/C++ProjectTemplate index 1526475..f9a6ff6 100755 Binary files a/C++ProjectTemplate and b/C++ProjectTemplate differ diff --git a/entity.h b/entity.h index 6beaf52..8f64c0d 100644 --- a/entity.h +++ b/entity.h @@ -7,6 +7,8 @@ extern std::vectorPARTY_INVENTORY; extern int INVENTORY_CONSUMABLE_OFFSET[4]; +extern int ITEM_SELECTION_CURSOR; +extern int ITEM_SELECTION_OFFSET; using namespace olc; @@ -224,6 +226,7 @@ class Entity{ } void RemoveItem(int index) { + int prevPartyInvenSize=PARTY_INVENTORY.size(); if (isPlayer) { for (int i=0;i<4;i++) { if (index=PARTY_INVENTORY.size()&&prevPartyInvenSize&1&&PARTY_INVENTORY.size()==prevPartyInvenSize-1) { + ITEM_SELECTION_OFFSET-=2; + } + ITEM_SELECTION_CURSOR=std::clamp(ITEM_SELECTION_CURSOR,0,(int)PARTY_INVENTORY.size()-1); } //If index is -1, the item is inserted at the end of the list. Otherwise it's going to overwrite a certain slot. Be certain you swap the item before doing this! diff --git a/main.cpp b/main.cpp index f0f9835..50a898c 100644 --- a/main.cpp +++ b/main.cpp @@ -2173,7 +2173,6 @@ void SeasonI::keyUpdates() { } if (ACTIONKEYPRESSED) { if (OVERWORLD_ITEM_BEING_USED) { //Equipping an item. - int prevPartyInvenSize=PARTY_INVENTORY.size(); if (PARTY_INVENTORY[ITEM_SELECTION_CURSOR]->stats.equip!=EquipSlot::NONE) { DisplayMessageBox(PARTY_MEMBER_OBJ[OVERWORLD_TARGET_SELECTION]->name+" equipped the "+PARTY_INVENTORY[ITEM_SELECTION_CURSOR]->name+"."); PARTY_MEMBER_STATS[PARTY_MEMBER_ID[OVERWORLD_TARGET_SELECTION]]->EquipItem(ITEM_SELECTION_CURSOR); @@ -2245,10 +2244,6 @@ void SeasonI::keyUpdates() { PARTY_MEMBER_STATS[PARTY_MEMBER_ID[OVERWORLD_TARGET_SELECTION]]->RemoveItem(ITEM_SELECTION_CURSOR); } } - if (ITEM_SELECTION_CURSOR>=PARTY_INVENTORY.size()&&prevPartyInvenSize&1&&PARTY_INVENTORY.size()==prevPartyInvenSize-1) { - ITEM_SELECTION_OFFSET-=2; - } - ITEM_SELECTION_CURSOR=std::clamp(ITEM_SELECTION_CURSOR,0,(int)PARTY_INVENTORY.size()-1); OVERWORLD_ITEM_BEING_USED=false; GAME_STATE=GameState::OVERWORLD_ITEMS_MENU; } else { //Using a power instead. @@ -4136,7 +4131,11 @@ void SeasonI::SetupTargetSelect() { for (auto&ent:GetEntitiesInRange(SELECTED_TARGET,PARTY_MEMBER_STATS[PARTY_MEMBER_ID[-CURRENT_TURN-1]]->channelPos,PARTY_MEMBER_STATS[PARTY_MEMBER_ID[-CURRENT_TURN-1]]->selectedMove)) { ent->obj->highlighted=true; } - DISPLAY_TARGET_MESSAGE="Use "+PARTY_MEMBER_STATS[PARTY_MEMBER_ID[-CURRENT_TURN-1]]->selectedMove->GetPowerName()+" on..."; + if (PARTY_MEMBER_STATS[PARTY_MEMBER_ID[-CURRENT_TURN-1]]->selectedMove==MOVELIST[BattleMoveName::CONSUMABLE]||PARTY_MEMBER_STATS[PARTY_MEMBER_ID[-CURRENT_TURN-1]]->selectedMove==MOVELIST[BattleMoveName::CONSUMABLE_ENEMY]) { + DISPLAY_TARGET_MESSAGE="Use "+EQUIP_$ITEM_DISPLAY+" on..."; + } else { + DISPLAY_TARGET_MESSAGE="Use "+PARTY_MEMBER_STATS[PARTY_MEMBER_ID[-CURRENT_TURN-1]]->selectedMove->GetPowerName()+" on..."; + } } void SeasonI::ConfirmPlayerTargetSelection() { @@ -4148,7 +4147,6 @@ void SeasonI::ConfirmPlayerTargetSelection() { } PARTY_MEMBER_STATS[PARTY_MEMBER_ID[-CURRENT_TURN-1]]->channelTimeRemaining=PARTY_MEMBER_STATS[PARTY_MEMBER_ID[-CURRENT_TURN-1]]->selectedMove->channelTime; - int prevPartyInvenSize=PARTY_INVENTORY.size(); if (ITEM_REQUIRES_EQUIPPING) { Item*SelectedItem=PARTY_INVENTORY[ITEM_SELECTION_CURSOR]; if (SelectedItem->stats.equip==EquipSlot::WEAPON&&PARTY_MEMBER_STATS[PARTY_MEMBER_ID[-CURRENT_TURN-1]]->equipment[SelectedItem->stats.equip]!=nullptr) { //Only swap back to the previous equip when there was nothing equipped to begin with. @@ -4174,10 +4172,6 @@ void SeasonI::ConfirmPlayerTargetSelection() { PARTY_MEMBER_STATS[PARTY_MEMBER_ID[-CURRENT_TURN-1]]->RemoveItem(ITEM_SELECTION_CURSOR); } } - if (ITEM_SELECTION_CURSOR>=PARTY_INVENTORY.size()&&prevPartyInvenSize&1&&PARTY_INVENTORY.size()==prevPartyInvenSize-1) { - ITEM_SELECTION_OFFSET-=2; - } - ITEM_SELECTION_CURSOR=std::clamp(ITEM_SELECTION_CURSOR,0,(int)PARTY_INVENTORY.size()-1); } std::vector SeasonI::GetEntitiesInRange(int targetEnt, vd2d channelPos, Battle::Move*move) {