diff --git a/C++ProjectTemplate b/C++ProjectTemplate index a1b4dba..27d59eb 100755 Binary files a/C++ProjectTemplate and b/C++ProjectTemplate differ diff --git a/encounters.h b/encounters.h index 110e836..2222e41 100644 --- a/encounters.h +++ b/encounters.h @@ -115,7 +115,7 @@ class Entity{ } //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! - void RemoveEquip(int slot,int index=-1) { + void RemoveEquip(EquipSlot::Equip slot,int index=-1) { Item*CurrentEquip=equipment[slot]; if (CurrentEquip==nullptr) { return; diff --git a/main.cpp b/main.cpp index 4f90b6a..5dd9a8f 100644 --- a/main.cpp +++ b/main.cpp @@ -1585,14 +1585,9 @@ This is a test message that lets us trigger straight from a cutscene! Cool!)"), } } if (ACTIONKEYPRESSED) { - GAME_STATE=GameState::OVERWORLD_EQUIP_ITEM_MENU; - EQUIP_ITEM_MENU_CONTENTS.clear(); - EQUIP_ITEM_MENU_OFFSET=0; - EQUIP_ITEM_MENU_CURSOR=0; - for (int i=0;istats.equip==EQUIP_MENU_SLOT) { - EQUIP_ITEM_MENU_CONTENTS.push_back(i); - } + PopulateEquipMenuItems(); + if (EQUIP_ITEM_MENU_CONTENTS.size()>0) { + GAME_STATE=GameState::OVERWORLD_EQUIP_ITEM_MENU; } } }break; @@ -1627,6 +1622,20 @@ This is a test message that lets us trigger straight from a cutscene! Cool!)"), if (LeftPressed()) { GAME_STATE=GameState::OVERWORLD_EQUIP_MENU; } + if (ACTIONKEYPRESSED) { + if (EQUIP_ITEM_MENU_CONTENTS[EQUIP_ITEM_MENU_CURSOR]==-1) { + PARTY_MEMBER_STATS[PARTY_MEMBER_ID[OVERWORLD_POWER_SELECTION_MEMBER]]->RemoveEquip(EQUIP_MENU_SLOT); + } else { + PARTY_MEMBER_STATS[PARTY_MEMBER_ID[OVERWORLD_POWER_SELECTION_MEMBER]]->EquipItem(EQUIP_ITEM_MENU_CONTENTS[EQUIP_ITEM_MENU_CURSOR]); + } + if (EQUIP_ITEM_MENU_CURSOR>=EQUIP_ITEM_MENU_CONTENTS.size()) { + EQUIP_ITEM_MENU_CURSOR--; + } + if (EQUIP_ITEM_MENU_OFFSET>EQUIP_ITEM_MENU_CURSOR) { + EQUIP_ITEM_MENU_OFFSET=EQUIP_ITEM_MENU_CURSOR; + } + PopulateEquipMenuItems(); + } }break; } ANYKEYPRESSED=ACTIONKEYPRESSED=false; @@ -1793,7 +1802,7 @@ This is a test message that lets us trigger straight from a cutscene! Cool!)"), DrawDecal({8,(float)(12+(EQUIP_ITEM_MENU_CURSOR-EQUIP_ITEM_MENU_OFFSET)*12)},SPRITES["cursor.png"]); for (int i=0;i<8;i++) { if (EQUIP_ITEM_MENU_OFFSET+iname); + DrawStringPropDecal({16,(float)(12+i*12)},EQUIP_ITEM_MENU_CONTENTS[i+EQUIP_ITEM_MENU_OFFSET]==-1?"Unequip":PARTY_INVENTORY[EQUIP_ITEM_MENU_CONTENTS[i+EQUIP_ITEM_MENU_OFFSET]]->name); } } if (EQUIP_ITEM_MENU_OFFSET>0) { @@ -4394,6 +4403,20 @@ This is a test message that lets us trigger straight from a cutscene! Cool!)"), } return false; } + + void PopulateEquipMenuItems() { + EQUIP_ITEM_MENU_CONTENTS.clear(); + EQUIP_ITEM_MENU_OFFSET=0; + EQUIP_ITEM_MENU_CURSOR=0; + for (int i=0;istats.equip==EQUIP_MENU_SLOT) { + EQUIP_ITEM_MENU_CONTENTS.push_back(i); + } + } + if (PARTY_MEMBER_STATS[PARTY_MEMBER_ID[OVERWORLD_POWER_SELECTION_MEMBER]]->equipment[EQUIP_MENU_SLOT]!=nullptr) { + EQUIP_ITEM_MENU_CONTENTS.push_back(-1); + } + } }; int main()