diff --git a/C++ProjectTemplate b/C++ProjectTemplate index 27d59eb..5705ec5 100755 Binary files a/C++ProjectTemplate and b/C++ProjectTemplate differ diff --git a/item.h b/item.h index 0d5f61f..e0e304a 100644 --- a/item.h +++ b/item.h @@ -18,6 +18,7 @@ enum class ItemName{ KEY_TO_THE_PALACE, BOMB, FREEZE_PACKET, + SOME_STUPIDLY_LONG_FEATHER, }; namespace EquipSlot{ diff --git a/main.cpp b/main.cpp index 5dd9a8f..fbd74a0 100644 --- a/main.cpp +++ b/main.cpp @@ -289,6 +289,9 @@ This is a test message that lets us trigger straight from a cutscene! Cool!)"), AddItemToPlayerInventory(ItemName::BOMB); AddItemToPlayerInventory(ItemName::BOMB); AddItemToPlayerInventory(ItemName::BOMB); + AddItemToPlayerInventory(ItemName::SOME_STUPIDLY_LONG_FEATHER); + AddItemToPlayerInventory(ItemName::SOME_STUPIDLY_LONG_FEATHER); + AddItemToPlayerInventory(ItemName::SOME_STUPIDLY_LONG_FEATHER); for (int i=0;i<20;i++) { AddItemToPlayerInventory(ItemName::COOKIE); } @@ -1635,6 +1638,7 @@ This is a test message that lets us trigger straight from a cutscene! Cool!)"), EQUIP_ITEM_MENU_OFFSET=EQUIP_ITEM_MENU_CURSOR; } PopulateEquipMenuItems(); + GAME_STATE=GameState::OVERWORLD_EQUIP_MENU; } }break; } @@ -1794,7 +1798,8 @@ This is a test message that lets us trigger straight from a cutscene! Cool!)"), std::string labels[3]={"WEAPON:","ARMOR:","OTHER:"}; for (int i=0;i<3;i++) { DrawStringPropDecal({16,(float)(19+i*12)},labels[i]); - DrawStringPropDecal({12+64,(float)(19+i*12)},(PARTY_MEMBER_STATS[PARTY_MEMBER_ID[OVERWORLD_POWER_SELECTION_MEMBER]]->equipment[i]!=nullptr)?PARTY_MEMBER_STATS[PARTY_MEMBER_ID[OVERWORLD_POWER_SELECTION_MEMBER]]->equipment[i]->name:"None"); + std::string equipName = (PARTY_MEMBER_STATS[PARTY_MEMBER_ID[OVERWORLD_POWER_SELECTION_MEMBER]]->equipment[i]!=nullptr)?PARTY_MEMBER_STATS[PARTY_MEMBER_ID[OVERWORLD_POWER_SELECTION_MEMBER]]->equipment[i]->name:"None"; + DrawStringPropDecal({12+64,(float)(19+i*12)},equipName,WHITE,{std::min(1.0F,(float)((WIDTH/1.5)-84)/GetTextSizeProp(equipName).x),1}); } } if (GAME_STATE==GameState::OVERWORLD_EQUIP_ITEM_MENU) { @@ -1802,7 +1807,8 @@ 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); + std::string equipName = EQUIP_ITEM_MENU_CONTENTS[i+EQUIP_ITEM_MENU_OFFSET]==-1?"Unequip":PARTY_INVENTORY[EQUIP_ITEM_MENU_CONTENTS[i+EQUIP_ITEM_MENU_OFFSET]]->name; + DrawStringPropDecal({16,(float)(12+i*12)},equipName,WHITE,{std::min(1.0F,(float)((WIDTH/2)-12)/GetTextSizeProp(equipName).x),1}); } } if (EQUIP_ITEM_MENU_OFFSET>0) { @@ -1811,6 +1817,26 @@ This is a test message that lets us trigger straight from a cutscene! Cool!)"), if (EQUIP_ITEM_MENU_OFFSET+8description,(int)(WIDTH/2-8)-8,true,{1,1})); + } + DrawDialogBox({4,HEIGHT/2+4},{(int)(WIDTH/2),HEIGHT/8},Pixel(70, 33, 105,220),Pixel(62, 54, 69,220),Pixel(185, 148, 255,220)); + DrawDialogBox({4,(int)(HEIGHT*(5.F/8)+4)},{(int)(WIDTH/2),HEIGHT/8},Pixel(70, 33, 105,220),Pixel(62, 54, 69,220),Pixel(185, 148, 255,220)); + DrawStringPropDecal({8,HEIGHT/2+12},"ATTACK",WHITE,{0.85,2}); + DrawStringPropDecal({8,HEIGHT*(5.F/8)+12},"DEFENSE",WHITE,{0.85,2}); + + int equipAttack=0; + int equipDefense=0; + int newAttack=0; + int newDefense=0; + CalculateChangeInEquipmentStats(OVERWORLD_POWER_SELECTION_MEMBER,EQUIP_ITEM_MENU_CONTENTS[EQUIP_ITEM_MENU_CURSOR],equipAttack,equipDefense,newAttack,newDefense); + std::string atkStr = std::to_string(equipAttack)+" -> "; + DrawStringPropDecal({72,HEIGHT/2+12},atkStr,WHITE,{0.85,2}); + DrawStringPropDecal({72+GetTextSizeProp(atkStr).x*0.85F,HEIGHT/2+12},std::to_string(newAttack),(newAttack>equipAttack)?GREEN:(newAttack "; + DrawStringPropDecal({72,HEIGHT*(5.F/8)+12},defStr,WHITE,{0.85,2}); + DrawStringPropDecal({72+GetTextSizeProp(defStr).x*0.85F,HEIGHT*(5.F/8)+12},std::to_string(newDefense),(newDefense>equipDefense)?GREEN:(newDefensestats.equip; - for (int j=0;jequipment.size();j++) { - if (PARTY_MEMBER_STATS[PARTY_MEMBER_ID[i]]->equipment[j]!=nullptr) { - equipAttack+=PARTY_MEMBER_STATS[PARTY_MEMBER_ID[i]]->equipment[j]->stats.attack; - equipDefense+=PARTY_MEMBER_STATS[PARTY_MEMBER_ID[i]]->equipment[j]->stats.defense; - if (PARTY_MEMBER_STATS[PARTY_MEMBER_ID[i]]->equipment[j]->stats.equip==slot) { - newAttack+=PARTY_INVENTORY[ITEM_SELECTION_CURSOR]->stats.attack; - newDefense+=PARTY_INVENTORY[ITEM_SELECTION_CURSOR]->stats.defense; - } else { - newAttack+=PARTY_MEMBER_STATS[PARTY_MEMBER_ID[i]]->equipment[j]->stats.attack; - newDefense+=PARTY_MEMBER_STATS[PARTY_MEMBER_ID[i]]->equipment[j]->stats.defense; - } - } else { - if (j==slot) { - newAttack+=PARTY_INVENTORY[ITEM_SELECTION_CURSOR]->stats.attack; - newDefense+=PARTY_INVENTORY[ITEM_SELECTION_CURSOR]->stats.defense; - } - } - } + CalculateChangeInEquipmentStats(i,ITEM_SELECTION_CURSOR,equipAttack,equipDefense,newAttack,newDefense); DrawStringPropDecal({(float)4+WIDTH*(1.0F/8),(float)(HEIGHT/2+4+12+i*10)},std::to_string(PARTY_MEMBER_STATS[PARTY_MEMBER_ID[i]]->baseAtk+newAttack),(newAttack>equipAttack)?GREEN:(newAttackequipDefense)?GREEN:(newDefenseequipAttack?-M_PI_2:M_PI_2,{4,4},{0.5,0.5},newAttack>equipAttack?GREEN:RED);} @@ -2523,6 +2531,7 @@ This is a test message that lets us trigger straight from a cutscene! Cool!)"), ITEMLIST[ItemName::COPPER_BRACELET]=new Item("Copper Bracelet","It's not quite as shiny as a diamond, but it still makes you look good.",256,{defense:5,equip:EquipSlot::ACCESSORY}); ITEMLIST[ItemName::KEY_TO_THE_PALACE]=new Item("Key to the Palace","Lets you access a Palace.",256,{important:true}); ITEMLIST[ItemName::FREEZE_PACKET]=new Item("Freeze Packet","Lets out some blistering cold weather.",256,{consumable:Consumable::ENEMY},MOVELIST[BattleMoveName::FREEZE_PACKET]); + ITEMLIST[ItemName::SOME_STUPIDLY_LONG_FEATHER]=new Item("Some Stupidly Long Feather","Yeah, we don't know why this feather is so long either.",256,{attack:2,defense:3,equip:EquipSlot::ACCESSORY}); } void SetupAnimations() { @@ -4417,6 +4426,37 @@ This is a test message that lets us trigger straight from a cutscene! Cool!)"), EQUIP_ITEM_MENU_CONTENTS.push_back(-1); } } + + void CalculateChangeInEquipmentStats(int partyMemberSlot,int itemSlot,int&equipAttack,int&equipDefense,int&newAttack,int&newDefense) { + EquipSlot::Equip slot; + if (itemSlot==-1) { + slot=EQUIP_MENU_SLOT; + } else { + slot=PARTY_INVENTORY[itemSlot]->stats.equip; + } + for (int j=0;jequipment.size();j++) { + if (PARTY_MEMBER_STATS[PARTY_MEMBER_ID[partyMemberSlot]]->equipment[j]!=nullptr) { + equipAttack+=PARTY_MEMBER_STATS[PARTY_MEMBER_ID[partyMemberSlot]]->equipment[j]->stats.attack; + equipDefense+=PARTY_MEMBER_STATS[PARTY_MEMBER_ID[partyMemberSlot]]->equipment[j]->stats.defense; + if (PARTY_MEMBER_STATS[PARTY_MEMBER_ID[partyMemberSlot]]->equipment[j]->stats.equip==slot) { + if (itemSlot!=-1) { + newAttack+=PARTY_INVENTORY[itemSlot]->stats.attack; + newDefense+=PARTY_INVENTORY[itemSlot]->stats.defense; + } + } else { + newAttack+=PARTY_MEMBER_STATS[PARTY_MEMBER_ID[partyMemberSlot]]->equipment[j]->stats.attack; + newDefense+=PARTY_MEMBER_STATS[PARTY_MEMBER_ID[partyMemberSlot]]->equipment[j]->stats.defense; + } + } else { + if (j==slot) { + if (itemSlot!=-1) { + newAttack+=PARTY_INVENTORY[itemSlot]->stats.attack; + newDefense+=PARTY_INVENTORY[itemSlot]->stats.defense; + } + } + } + } + } }; int main()