Item descriptions added.

Co-authored-by: sigonasr2 <sigonasr2@gmail.com>
master
sigonasr2 2 years ago
parent e3310b2329
commit bb7bea1fac
  1. BIN
      C++ProjectTemplate
  2. 1
      layers.h
  3. 45
      main.cpp

Binary file not shown.

@ -3,6 +3,7 @@
namespace layer{ namespace layer{
enum layer{ enum layer{
INTERFACE2, //The highest layer, even better than the interface layer.
INTERFACE, //Interface items should be on this layer. On top of everything. INTERFACE, //Interface items should be on this layer. On top of everything.
COLLISION, //Collision checking layer. This layer is COLLISION, //Collision checking layer. This layer is
HIGH, HIGH,

@ -202,7 +202,7 @@ public:
{ {
srand(time(NULL)); srand(time(NULL));
GAME=this; GAME=this;
for (int i=1;i<6;i++) { for (int i=1;i<7;i++) {
CreateLayer(); CreateLayer();
EnableLayer(i,true); EnableLayer(i,true);
} }
@ -279,6 +279,8 @@ This is a test message that lets us trigger straight from a cutscene! Cool!)"),
keyUpdates(); keyUpdates();
SetDrawTarget(nullptr); SetDrawTarget(nullptr);
Clear(BLANK); Clear(BLANK);
SetDrawTarget(layer::INTERFACE);
Clear(BLANK);
SetDrawTarget(layer::COLLISION); SetDrawTarget(layer::COLLISION);
if (EDITING_LAYER!=layer::COLLISION) { if (EDITING_LAYER!=layer::COLLISION) {
Clear(MAGENTA); Clear(MAGENTA);
@ -959,9 +961,10 @@ This is a test message that lets us trigger straight from a cutscene! Cool!)"),
} }
}break; }break;
case BattleState::ITEM_SELECT:{ case BattleState::ITEM_SELECT:{
HandleInventoryMenu();
if (LeftPressed()&&!(ITEM_SELECTION_CURSOR&1)) { if (LeftPressed()&&!(ITEM_SELECTION_CURSOR&1)) {
BATTLE_STATE=BattleState::SELECT_ACTION; BATTLE_STATE=BattleState::SELECT_ACTION;
} else {
HandleInventoryMenu();
} }
}break; }break;
} }
@ -1299,6 +1302,25 @@ This is a test message that lets us trigger straight from a cutscene! Cool!)"),
} }
} }
} }
if (BATTLE_STATE==BattleState::ITEM_SELECT) {
SetDrawTarget(layer::INTERFACE2);
DrawDecal({static_cast<float>(8+(ITEM_SELECTION_CURSOR)%2*(WIDTH-8)/2),static_cast<float>(12*((ITEM_SELECTION_CURSOR-ITEM_SELECTION_OFFSET)/2)+8)},SPRITES["cursor.png"]);
DrawDialogBox({4,4},{(int)(WIDTH-8),(int)(HEIGHT/2)},Pixel(70, 33, 105,128),Pixel(62, 54, 69,128),Pixel(185, 148, 255,128));
DrawDialogBox({(int)(WIDTH*(3.0F/8)),HEIGHT/2+4},{(int)(WIDTH*(5.0F/8)-4),(int)(HEIGHT/4)},Pixel(70, 33, 105,128),Pixel(62, 54, 69,128),Pixel(185, 148, 255,128));
DrawStringPropDecal({(int)(WIDTH*(3.0F/8))+4,HEIGHT/2+8},Wrap(PARTY_INVENTORY[ITEM_SELECTION_CURSOR]->description,(int)(WIDTH*(5.0F/8))-4,true,{1,1}));
for (int i=0;i<18;i++) {
if (ITEM_SELECTION_OFFSET+i<PARTY_INVENTORY.size()) {
DrawStringDecal({static_cast<float>(16+i%2*(WIDTH-8)/2),static_cast<float>(12*(i/2)+8)},PARTY_INVENTORY[ITEM_SELECTION_OFFSET+i]->name);
}
}
if (ITEM_SELECTION_OFFSET>0) {
DrawRotatedDecal({WIDTH-20,8},SPRITES["cursor.png"],-M_PI_2,{4,4});
}
if (ITEM_SELECTION_OFFSET+18<PARTY_INVENTORY.size()) {
DrawRotatedDecal({WIDTH-20,4+HEIGHT/2-4},SPRITES["cursor.png"],M_PI_2,{4,4});
}
SetDrawTarget(layer::INTERFACE);
}
if (BATTLE_STATE==BattleState::TARGET_SELECT) { if (BATTLE_STATE==BattleState::TARGET_SELECT) {
SetDrawTarget(layer::GROUND); SetDrawTarget(layer::GROUND);
if (SELECTED_TARGET<0) { if (SELECTED_TARGET<0) {
@ -1422,23 +1444,6 @@ This is a test message that lets us trigger straight from a cutscene! Cool!)"),
} }
} }
} }
if (BATTLE_STATE==BattleState::ITEM_SELECT) {
SetDrawTarget(layer::INTERFACE);
DrawDecal({static_cast<float>(8+(ITEM_SELECTION_CURSOR)%2*(WIDTH-8)/2),static_cast<float>(12*((ITEM_SELECTION_CURSOR-ITEM_SELECTION_OFFSET)/2)+8)},SPRITES["cursor.png"]);
DrawDialogBox({4,4},{(int)(WIDTH-8),(int)(HEIGHT/2)},Pixel(70, 33, 105,128),Pixel(62, 54, 69,128),Pixel(185, 148, 255,128));
DrawDialogBox({WIDTH/2,HEIGHT/2+4},{(int)(WIDTH/2-4),(int)(HEIGHT/2)},Pixel(70, 33, 105,128),Pixel(62, 54, 69,128),Pixel(185, 148, 255,128));
for (int i=0;i<18;i++) {
if (ITEM_SELECTION_OFFSET+i<PARTY_INVENTORY.size()) {
DrawStringDecal({static_cast<float>(16+i%2*(WIDTH-8)/2),static_cast<float>(12*(i/2)+8)},PARTY_INVENTORY[ITEM_SELECTION_OFFSET+i]->name);
}
}
if (ITEM_SELECTION_OFFSET>0) {
DrawRotatedDecal({WIDTH-20,8},SPRITES["cursor.png"],-M_PI_2,{4,4});
}
if (ITEM_SELECTION_OFFSET+18<PARTY_INVENTORY.size()) {
DrawRotatedDecal({WIDTH-20,4+HEIGHT/2-4},SPRITES["cursor.png"],M_PI_2,{4,4});
}
}
} }
//////////////////INTERFACE LAYER. //////////////////INTERFACE LAYER.
@ -1897,7 +1902,7 @@ This is a test message that lets us trigger straight from a cutscene! Cool!)"),
ITEMLIST[ItemName::COOKIE]=new Item("Cookie","A delightful little treat. Restores 40 HP.",{hpRecovery:40,consumable:true}); ITEMLIST[ItemName::COOKIE]=new Item("Cookie","A delightful little treat. Restores 40 HP.",{hpRecovery:40,consumable:true});
ITEMLIST[ItemName::EGG]=new Item("Egg","Did it come before or after the chicken? Restores 60 HP.",{hpRecovery:60,consumable:true}); ITEMLIST[ItemName::EGG]=new Item("Egg","Did it come before or after the chicken? Restores 60 HP.",{hpRecovery:60,consumable:true});
ITEMLIST[ItemName::PIZZA]=new Item("Pizza","A scrumptious meal filled with lots of cheese. Restores 200 HP.",{hpRecovery:200,consumable:true}); ITEMLIST[ItemName::PIZZA]=new Item("Pizza","A scrumptious meal filled with lots of cheese. Restores 200 HP.",{hpRecovery:200,consumable:true});
ITEMLIST[ItemName::CRACKED_BAT]=new Item("Cracked Bat","Has some dents in it, but you can probably still dents things with it yourself.",{attack:4,equip:EquipSlot::WEAPON}); ITEMLIST[ItemName::CRACKED_BAT]=new Item("Cracked Bat","Has some dents in it, but you can probably still dent things with it yourself.",{attack:4,equip:EquipSlot::WEAPON});
ITEMLIST[ItemName::LIGHT_JACKET]=new Item("Light Jacket","Fits just fine.",{defense:2,equip:EquipSlot::ARMOR}); ITEMLIST[ItemName::LIGHT_JACKET]=new Item("Light Jacket","Fits just fine.",{defense:2,equip:EquipSlot::ARMOR});
ITEMLIST[ItemName::KEY_TO_THE_PALACE]=new Item("Key to the Palace","Lets you access a Palace.",{important:true}); ITEMLIST[ItemName::KEY_TO_THE_PALACE]=new Item("Key to the Palace","Lets you access a Palace.",{important:true});
} }

Loading…
Cancel
Save