Equipment Management is now possible!

Co-authored-by: sigonasr2 <sigonasr2@gmail.com>
master
sigonasr2 2 years ago
parent 9b28a8970b
commit f095fe5148
  1. BIN
      C++ProjectTemplate
  2. 2
      encounters.h
  3. 41
      main.cpp

Binary file not shown.

@ -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;

@ -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;i<PARTY_INVENTORY.size();i++) {
if (PARTY_INVENTORY[i]->stats.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+i<EQUIP_ITEM_MENU_CONTENTS.size()) {
DrawStringPropDecal({16,(float)(12+i*12)},PARTY_INVENTORY[EQUIP_ITEM_MENU_CONTENTS[i+EQUIP_ITEM_MENU_OFFSET]]->name);
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;i<PARTY_INVENTORY.size();i++) {
if (PARTY_INVENTORY[i]->stats.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()

Loading…
Cancel
Save