diff --git a/C++/scripts/debug.sh b/C++/scripts/debug.sh new file mode 100755 index 0000000..3d84b84 --- /dev/null +++ b/C++/scripts/debug.sh @@ -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" diff --git a/C++/scripts/filelist b/C++/scripts/filelist index ca9afe2..03e1e9a 100644 --- a/C++/scripts/filelist +++ b/C++/scripts/filelist @@ -1,5 +1,6 @@ build.sh commit.sh +debug.sh lines.sh release.sh temp diff --git a/C++/scripts/md5 b/C++/scripts/md5 index b57c2c4..add9549 100644 --- a/C++/scripts/md5 +++ b/C++/scripts/md5 @@ -1,5 +1,6 @@ build.sh:530634457ea9041267c05d4ced95eee1 - commit.sh:d03a46e721060c22ccb146e19d27e70a - +debug.sh:abbbb0c6d9f2409f3a90738ab3d9d44f - lines.sh:3b907786f7fc9204025993016c9080de - release.sh:a54e2002be80814cc1293a11dff4d116 - temp:d41d8cd98f00b204e9800998ecf8427e - diff --git a/C++ProjectTemplate b/C++ProjectTemplate index ba109a7..ba31dac 100755 Binary files a/C++ProjectTemplate and b/C++ProjectTemplate differ diff --git a/assets/bufficons.png b/assets/bufficons.png new file mode 100644 index 0000000..c0f9fcf Binary files /dev/null and b/assets/bufficons.png differ diff --git a/defines.h b/defines.h index 879e330..d7be6eb 100644 --- a/defines.h +++ b/defines.h @@ -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; diff --git a/entity.h b/entity.h index 373ce1c..25bb17d 100644 --- a/entity.h +++ b/entity.h @@ -8,6 +8,15 @@ extern std::vectorPARTY_INVENTORY; using namespace olc; +namespace boost{ + enum{ + ATK, + HP, + PP, + SPD + }; +} + class Entity{ private: @@ -35,6 +44,7 @@ class Entity{ std::vector inventory; //Used mostly for enemy spoils. std::array equipment = {nullptr,nullptr,nullptr}; //Equipment this character is using. bool isPlayer=false; //Whether or not this is a player entity. + std::array 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::arrayresistances,int speed,std::vectormoveSet,std::vectoritems={},std::arrayequipment={},int damageReduction=0,bool smart=false,bool dumb=false) :Entity(nullptr,HP,maxHP,PP,maxPP,baseAtk,resistances,speed,moveSet,items,equipment,damageReduction,smart,dumb){ diff --git a/main.cpp b/main.cpp index 0dc7aa5..e3a4827 100644 --- a/main.cpp +++ b/main.cpp @@ -1,3 +1,4 @@ +#include "entity.h" #include "item.h" #include "layers.h" #include @@ -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:(newDefensename).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;iequipment.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) { diff --git a/sig b/sig index 1808869..65804b4 100755 --- a/sig +++ b/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