generated from sigonasr2/CPlusPlusProjectTemplate
Implement status menu display
Co-authored-by: sigonasr2 <sigonasr2@gmail.com>
This commit is contained in:
parent
300f77d51e
commit
948e8600a6
7
C++/scripts/debug.sh
Executable file
7
C++/scripts/debug.sh
Executable file
@ -0,0 +1,7 @@
|
||||
#Compiles the entire program with debug flags then runs it in gdb.
|
||||
#C++
|
||||
printf "Running program...\n\n\n"
|
||||
if g++ $(find . -type f -name "*.cpp") -g ${CUSTOM_PARAMS} -o ${PROJECT_NAME}; then
|
||||
gdb ./${PROJECT_NAME} "$@"
|
||||
fi
|
||||
printf "\n\n"
|
||||
@ -1,5 +1,6 @@
|
||||
build.sh
|
||||
commit.sh
|
||||
debug.sh
|
||||
lines.sh
|
||||
release.sh
|
||||
temp
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
build.sh:530634457ea9041267c05d4ced95eee1 -
|
||||
commit.sh:d03a46e721060c22ccb146e19d27e70a -
|
||||
debug.sh:abbbb0c6d9f2409f3a90738ab3d9d44f -
|
||||
lines.sh:3b907786f7fc9204025993016c9080de -
|
||||
release.sh:a54e2002be80814cc1293a11dff4d116 -
|
||||
temp:d41d8cd98f00b204e9800998ecf8427e -
|
||||
|
||||
Binary file not shown.
BIN
assets/bufficons.png
Normal file
BIN
assets/bufficons.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.7 KiB |
@ -37,6 +37,7 @@ using namespace olc;
|
||||
#define 액션 (CutsceneAction*)new
|
||||
|
||||
enum class Property{
|
||||
NONE,
|
||||
PETRIFY,
|
||||
PARALYZE,
|
||||
DIAMONDIZE,
|
||||
@ -47,8 +48,7 @@ enum class Property{
|
||||
POISON,
|
||||
REGEN,
|
||||
DEFENSE_UP,
|
||||
REVIVE,
|
||||
NONE
|
||||
REVIVE
|
||||
};
|
||||
|
||||
extern PixelGameEngine*GAME;
|
||||
|
||||
10
entity.h
10
entity.h
@ -8,6 +8,15 @@ extern std::vector<Item*>PARTY_INVENTORY;
|
||||
|
||||
using namespace olc;
|
||||
|
||||
namespace boost{
|
||||
enum{
|
||||
ATK,
|
||||
HP,
|
||||
PP,
|
||||
SPD
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
class Entity{
|
||||
private:
|
||||
@ -35,6 +44,7 @@ class Entity{
|
||||
std::vector<Item*> inventory; //Used mostly for enemy spoils.
|
||||
std::array<Item*,3> equipment = {nullptr,nullptr,nullptr}; //Equipment this character is using.
|
||||
bool isPlayer=false; //Whether or not this is a player entity.
|
||||
std::array<int,4> boosts = {0,0,0,0}; //Values to indicate how much the boosts of each stat ended up being. Order is ATK,HP,PP,SPD.
|
||||
//Used for initializing players.
|
||||
Entity(int HP,int maxHP,int PP,int maxPP,int baseAtk,std::array<int,4>resistances,int speed,std::vector<Battle::Move*>moveSet,std::vector<Item*>items={},std::array<Item*,3>equipment={},int damageReduction=0,bool smart=false,bool dumb=false)
|
||||
:Entity(nullptr,HP,maxHP,PP,maxPP,baseAtk,resistances,speed,moveSet,items,equipment,damageReduction,smart,dumb){
|
||||
|
||||
84
main.cpp
84
main.cpp
@ -1,3 +1,4 @@
|
||||
#include "entity.h"
|
||||
#include "item.h"
|
||||
#include "layers.h"
|
||||
#include <string>
|
||||
@ -1387,19 +1388,23 @@ This is a test message that lets us trigger straight from a cutscene! Cool!)"),
|
||||
}break;
|
||||
case ItemAction::ATKINCREASE:{
|
||||
target->baseAtk+=item->stats.atkIncrease;
|
||||
target->boosts[boost::ATK]+=item->stats.atkIncrease;
|
||||
}break;
|
||||
case ItemAction::HPINCREASE:{
|
||||
target->maxHP+=item->stats.hpIncrease;
|
||||
target->AddHP(item->stats.hpIncrease);
|
||||
vi2d box = {(128-32*PARTY_MEMBER_COUNT)+OVERWORLD_TARGET_SELECTION*64+29,170};
|
||||
DAMAGE_NUMBERS.push_back(new DamageNumber(-item->stats.hpIncrease,box+cameraPos));
|
||||
target->boosts[boost::HP]+=item->stats.hpIncrease;
|
||||
}break;
|
||||
case ItemAction::PPINCREASE:{
|
||||
target->maxPP+=item->stats.ppIncrease;
|
||||
target->AddPP(item->stats.ppIncrease);
|
||||
target->boosts[boost::PP]+=item->stats.ppIncrease;
|
||||
}break;
|
||||
case ItemAction::SPDINCREASE:{
|
||||
target->speed+=item->stats.spdIncrease;
|
||||
target->boosts[boost::SPD]+=item->stats.spdIncrease;
|
||||
}break;
|
||||
case ItemAction::LEARNMOVE:{
|
||||
bool moveLearned=false;
|
||||
@ -1869,17 +1874,69 @@ This is a test message that lets us trigger straight from a cutscene! Cool!)"),
|
||||
DrawStringPropDecal({72+GetTextSizeProp(defStr).x*0.85F,HEIGHT*(5.F/8)+12},std::to_string(newDefense),(newDefense>equipDefense)?GREEN:(newDefense<equipDefense)?RED:WHITE,{0.85,2});
|
||||
}
|
||||
if (GAME_STATE==GameState::OVERWORLD_STATUS_MENU) {
|
||||
Entity*member=PARTY_MEMBER_STATS[PARTY_MEMBER_ID[OVERWORLD_POWER_SELECTION_MEMBER]];
|
||||
DrawDialogBox({4,4},{(int)(WIDTH-8),(int)(HEIGHT/2)},Pixel(70, 33, 105,220),Pixel(62, 54, 69,220),Pixel(185, 148, 255,220));
|
||||
int nameWidth=GetTextSizeProp(PARTY_MEMBER_OBJ[OVERWORLD_POWER_SELECTION_MEMBER]->name).x/2;
|
||||
DrawStringPropDecal({(float)(WIDTH-12-nameWidth),4},PARTY_MEMBER_OBJ[OVERWORLD_POWER_SELECTION_MEMBER]->name,WHITE,{0.5,1});
|
||||
int nameWidth=GetTextSizeProp(member->obj->name).x/2;
|
||||
DrawStringPropDecal({(float)(WIDTH-12-nameWidth),4},member->obj->name,WHITE,{0.5,1});
|
||||
DrawRotatedDecal({(float)(WIDTH-nameWidth-16),7},SPRITES["cursor.png"],M_PI,{(float)SPRITES["cursor.png"]->sprite->width/2,(float)SPRITES["cursor.png"]->sprite->height/2},{(sinf(frameCount/10.F*M_PI)>0)?0.5F:0.25F,(sinf(frameCount/10.F*M_PI)>0)?0.5F:0.25F});
|
||||
DrawRotatedDecal({(float)(WIDTH-8),7},SPRITES["cursor.png"],0,{(float)SPRITES["cursor.png"]->sprite->width/2,(float)SPRITES["cursor.png"]->sprite->height/2},{(sinf(frameCount/10.F*M_PI)>0)?0.5F:0.25F,(sinf(frameCount/10.F*M_PI)>0)?0.5F:0.25F});
|
||||
vi2d drawPos={8,8};
|
||||
DrawStringPropDecal(drawPos,PARTY_MEMBER_OBJ[OVERWORLD_POWER_SELECTION_MEMBER]->name);
|
||||
DrawStringPropDecal(drawPos,member->obj->name);
|
||||
drawPos.y+=12;
|
||||
if (PARTY_MEMBER_STATS[PARTY_MEMBER_ID[OVERWORLD_POWER_SELECTION_MEMBER]]->GetPrimaryStatusEffect()!=Property::NONE) {
|
||||
|
||||
Property statusEffect = member->GetPrimaryStatusEffect();
|
||||
if (statusEffect!=Property::NONE) {
|
||||
DrawStringPropDecal(drawPos,BATTLE_PROPERTIES[statusEffect]->displayName);
|
||||
}
|
||||
drawPos.y+=24;
|
||||
drawPos.x+=96;
|
||||
std::string displayStr1 = "ATK Boosts: ";
|
||||
std::string displayStr2 = "+"+std::to_string(member->boosts[boost::ATK]);
|
||||
DrawStringPropDecal({(float)(drawPos.x-GetTextSizeProp(displayStr1).x),(float)drawPos.y},displayStr1);
|
||||
DrawStringPropDecal({(float)(drawPos.x+24-GetTextSizeProp(displayStr2).x),(float)drawPos.y},displayStr2);
|
||||
drawPos.y+=12;
|
||||
displayStr1 = "HP Boosts: ";
|
||||
displayStr2 = "+"+std::to_string(member->boosts[boost::HP]);
|
||||
DrawStringPropDecal({(float)(drawPos.x-GetTextSizeProp(displayStr1).x),(float)drawPos.y},displayStr1);
|
||||
DrawStringPropDecal({(float)(drawPos.x+24-GetTextSizeProp(displayStr2).x),(float)drawPos.y},displayStr2);
|
||||
drawPos.y+=12;
|
||||
displayStr1 = "PP Boosts: ";
|
||||
displayStr2 = "+"+std::to_string(member->boosts[boost::PP]);
|
||||
DrawStringPropDecal({(float)(drawPos.x-GetTextSizeProp(displayStr1).x),(float)drawPos.y},displayStr1);
|
||||
DrawStringPropDecal({(float)(drawPos.x+24-GetTextSizeProp(displayStr2).x),(float)drawPos.y},displayStr2);
|
||||
drawPos.y+=12;
|
||||
displayStr1 = "SPD Boosts: ";
|
||||
displayStr2 = "+"+std::to_string(member->boosts[boost::SPD]);
|
||||
DrawStringPropDecal({(float)(drawPos.x-GetTextSizeProp(displayStr1).x),(float)drawPos.y},displayStr1);
|
||||
DrawStringPropDecal({(float)(drawPos.x+24-GetTextSizeProp(displayStr2).x),(float)drawPos.y},displayStr2);
|
||||
drawPos.y+=12;
|
||||
drawPos={WIDTH-40,20};
|
||||
int calculatedAtk=0;
|
||||
int calculatedDef=0;
|
||||
CalculateEquipmentStats(OVERWORLD_POWER_SELECTION_MEMBER,calculatedAtk,calculatedDef);
|
||||
displayStr1 = "ATK: ";
|
||||
displayStr2 = std::to_string(calculatedAtk);
|
||||
DrawStringPropDecal({(float)(drawPos.x-GetTextSizeProp(displayStr1).x),(float)drawPos.y},displayStr1);
|
||||
DrawStringPropDecal({(float)(WIDTH-8-GetTextSizeProp(displayStr2).x),(float)drawPos.y},displayStr2);
|
||||
drawPos.y+=12;
|
||||
displayStr1 = "DEF: ";
|
||||
displayStr2 = std::to_string(calculatedDef);
|
||||
DrawStringPropDecal({(float)(drawPos.x-GetTextSizeProp(displayStr1).x),(float)drawPos.y},displayStr1);
|
||||
DrawStringPropDecal({(float)(WIDTH-8-GetTextSizeProp(displayStr2).x),(float)drawPos.y},displayStr2);
|
||||
drawPos.y+=12;
|
||||
displayStr1 = "HP: ";
|
||||
displayStr2 = std::to_string(member->maxHP);
|
||||
DrawStringPropDecal({(float)(drawPos.x-GetTextSizeProp(displayStr1).x),(float)drawPos.y},displayStr1);
|
||||
DrawStringPropDecal({(float)(WIDTH-8-GetTextSizeProp(displayStr2).x),(float)drawPos.y},displayStr2);
|
||||
drawPos.y+=12;
|
||||
displayStr1 = "PP: ";
|
||||
displayStr2 = std::to_string(member->maxPP);
|
||||
DrawStringPropDecal({(float)(drawPos.x-GetTextSizeProp(displayStr1).x),(float)drawPos.y},displayStr1);
|
||||
DrawStringPropDecal({(float)(WIDTH-8-GetTextSizeProp(displayStr2).x),(float)drawPos.y},displayStr2);
|
||||
drawPos.y+=12;
|
||||
displayStr1 = "SPD: ";
|
||||
displayStr2 = std::to_string(member->speed);
|
||||
DrawStringPropDecal({(float)(drawPos.x-GetTextSizeProp(displayStr1).x),(float)drawPos.y},displayStr1);
|
||||
DrawStringPropDecal({(float)(WIDTH-8-GetTextSizeProp(displayStr2).x),(float)drawPos.y},displayStr2);
|
||||
}
|
||||
if (GAME_STATE==GameState::OVERWORLD_POWER_MENU||GAME_STATE==GameState::OVERWORLD_POWER_PLAYER_MENU||GAME_STATE==GameState::OVERWORLD_GRADE_MENU) {
|
||||
DrawBattleMoveList(OVERWORLD_POWER_SELECTION_MEMBER);
|
||||
@ -2483,6 +2540,7 @@ This is a test message that lets us trigger straight from a cutscene! Cool!)"),
|
||||
for (int i=0;i<7;i++) {
|
||||
PARTY_MEMBER_STATS[i]=new Entity(120,120,30,30,8,{0,0,0,0},8,{MOVELIST[BattleMoveName::TESTMOVE1]});
|
||||
}
|
||||
PARTY_MEMBER_STATS[PLAYER]->statusEffects[Property::MUSHROOMIZED]=4;
|
||||
PARTY_MEMBER_STATS[PLAYER]->moveSet={
|
||||
MOVELIST[BattleMoveName::HAILSTORM_A],
|
||||
MOVELIST[BattleMoveName::HAILSTORM_B],
|
||||
@ -2589,6 +2647,7 @@ This is a test message that lets us trigger straight from a cutscene! Cool!)"),
|
||||
CreateSprite("crosshair.png");
|
||||
CreateSprite("arrow_connector.png");
|
||||
CreateSprite("pixel.png");
|
||||
CreateSprite("bufficons.png");
|
||||
}
|
||||
|
||||
void SetupObjectInfo() {
|
||||
@ -3411,17 +3470,21 @@ This is a test message that lets us trigger straight from a cutscene! Cool!)"),
|
||||
}break;
|
||||
case ItemAction::ATKINCREASE:{
|
||||
target->baseAtk+=BATTLE_CUSTOM_ITEM->stats.atkIncrease;
|
||||
target->boosts[boost::ATK]+=BATTLE_CUSTOM_ITEM->stats.atkIncrease;
|
||||
}break;
|
||||
case ItemAction::HPINCREASE:{
|
||||
target->maxHP+=BATTLE_CUSTOM_ITEM->stats.hpIncrease;
|
||||
target->AddHP(BATTLE_CUSTOM_ITEM->stats.hpIncrease);
|
||||
target->boosts[boost::HP]+=BATTLE_CUSTOM_ITEM->stats.hpIncrease;
|
||||
}break;
|
||||
case ItemAction::PPINCREASE:{
|
||||
target->maxPP+=BATTLE_CUSTOM_ITEM->stats.ppIncrease;
|
||||
target->AddPP(BATTLE_CUSTOM_ITEM->stats.ppIncrease);
|
||||
target->boosts[boost::PP]+=BATTLE_CUSTOM_ITEM->stats.ppIncrease;
|
||||
}break;
|
||||
case ItemAction::SPDINCREASE:{
|
||||
target->speed+=BATTLE_CUSTOM_ITEM->stats.spdIncrease;
|
||||
target->boosts[boost::SPD]+=BATTLE_CUSTOM_ITEM->stats.spdIncrease;
|
||||
}break;
|
||||
case ItemAction::LEARNMOVE:{
|
||||
bool moveLearned=false;
|
||||
@ -4523,6 +4586,17 @@ This is a test message that lets us trigger straight from a cutscene! Cool!)"),
|
||||
}
|
||||
}
|
||||
|
||||
void CalculateEquipmentStats(int partyMemberSlot,int&atk,int&def) {
|
||||
atk=PARTY_MEMBER_STATS[PARTY_MEMBER_ID[partyMemberSlot]]->baseAtk;
|
||||
def=0;
|
||||
for (int i=0;i<PARTY_MEMBER_STATS[PARTY_MEMBER_ID[partyMemberSlot]]->equipment.size();i++) {
|
||||
if (PARTY_MEMBER_STATS[PARTY_MEMBER_ID[partyMemberSlot]]->equipment[i]!=nullptr) {
|
||||
atk+=PARTY_MEMBER_STATS[PARTY_MEMBER_ID[partyMemberSlot]]->equipment[i]->stats.attack;
|
||||
def+=PARTY_MEMBER_STATS[PARTY_MEMBER_ID[partyMemberSlot]]->equipment[i]->stats.defense;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CalculateChangeInEquipmentStats(int partyMemberSlot,int itemSlot,int&equipAttack,int&equipDefense,int&newAttack,int&newDefense) {
|
||||
EquipSlot::Equip slot;
|
||||
if (itemSlot==-1) {
|
||||
|
||||
2
sig
2
sig
@ -3,7 +3,7 @@ export AUTO_UPDATE=true
|
||||
source utils/define.sh
|
||||
|
||||
define PROJECT_NAME "C++ProjectTemplate"
|
||||
define CUSTOM_PARAMS "-g -std=c++17 -lX11 -lGL -lpthread -lpng -lstdc++fs -lpulse -lpulse-simple"
|
||||
define CUSTOM_PARAMS "-std=c++17 -lX11 -lGL -lpthread -lpng -lstdc++fs -lpulse -lpulse-simple"
|
||||
define LANGUAGE "C++"
|
||||
|
||||
source utils/main.sh
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user