generated from sigonasr2/CPlusPlusProjectTemplate
olc::
Co-authored-by: sigonasr2 <sigonasr2@gmail.com>
This commit is contained in:
parent
b8e0037928
commit
3c081b3cbf
@ -4,7 +4,7 @@
|
|||||||
#define OLC_PGEX_SPLASHSCREEN
|
#define OLC_PGEX_SPLASHSCREEN
|
||||||
#include "splash.h"
|
#include "splash.h"
|
||||||
|
|
||||||
using namespace std;
|
using namespace olc;
|
||||||
|
|
||||||
enum GAMESTATE{
|
enum GAMESTATE{
|
||||||
CUTSCENE_1,
|
CUTSCENE_1,
|
||||||
@ -14,13 +14,15 @@ enum GAMESTATE{
|
|||||||
WAITING_FOR_CUTSCENE_3,
|
WAITING_FOR_CUTSCENE_3,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum CUTSCENE{
|
namespace cutscene{
|
||||||
|
enum CUTSCENE{
|
||||||
NONE,
|
NONE,
|
||||||
PAN_DOME,
|
PAN_DOME,
|
||||||
PAUSE_TO_CUTSCENE_3,
|
PAUSE_TO_CUTSCENE_3,
|
||||||
CUTSCENE_4,
|
CUTSCENE_4,
|
||||||
TRANSITION_CUTSCENE,
|
TRANSITION_CUTSCENE,
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
|
||||||
namespace battle{
|
namespace battle{
|
||||||
enum BATTLESTATE{
|
enum BATTLESTATE{
|
||||||
@ -45,15 +47,15 @@ namespace battle{
|
|||||||
|
|
||||||
class Animation{
|
class Animation{
|
||||||
public:
|
public:
|
||||||
olc::Decal*spr;
|
Decal*spr;
|
||||||
std::vector<olc::vi2d> frames;
|
std::vector<vi2d> frames;
|
||||||
int frame=0;
|
int frame=0;
|
||||||
bool flipped=false;
|
bool flipped=false;
|
||||||
int skip_frames=1; //Essentially the animation speed. Number of frames to wait for next frame.
|
int skip_frames=1; //Essentially the animation speed. Number of frames to wait for next frame.
|
||||||
int width=32;
|
int width=32;
|
||||||
int height=32;
|
int height=32;
|
||||||
|
|
||||||
olc::vi2d getCurrentFrame() {
|
vi2d getCurrentFrame() {
|
||||||
return frames[frame];
|
return frames[frame];
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -62,13 +64,13 @@ std::vector<Animation*> updateAnimationsList; //Used to store animations in the
|
|||||||
|
|
||||||
class ObjectLoadInfo{
|
class ObjectLoadInfo{
|
||||||
public:
|
public:
|
||||||
olc::Decal*spr;
|
Decal*spr;
|
||||||
bool hasanim=false;
|
bool hasanim=false;
|
||||||
Animation*anim;
|
Animation*anim;
|
||||||
ObjectLoadInfo(olc::Decal*spr) {
|
ObjectLoadInfo(Decal*spr) {
|
||||||
this->spr=spr;
|
this->spr=spr;
|
||||||
}
|
}
|
||||||
ObjectLoadInfo(olc::Decal*spr,Animation*anim) {
|
ObjectLoadInfo(Decal*spr,Animation*anim) {
|
||||||
this->spr=spr;
|
this->spr=spr;
|
||||||
this->anim=anim;
|
this->anim=anim;
|
||||||
this->hasanim=true;
|
this->hasanim=true;
|
||||||
@ -79,39 +81,12 @@ class ObjectLoadInfo{
|
|||||||
class Object{
|
class Object{
|
||||||
public:
|
public:
|
||||||
float x,y;
|
float x,y;
|
||||||
olc::Decal*spr;
|
Decal*spr;
|
||||||
std::string name;
|
std::string name;
|
||||||
bool hasAnim=false;
|
bool hasAnim=false;
|
||||||
Animation*anim;
|
Animation*anim;
|
||||||
};
|
};
|
||||||
|
|
||||||
class Entity{
|
|
||||||
public:
|
|
||||||
bool ally;
|
|
||||||
int hp;
|
|
||||||
int maxhp;
|
|
||||||
olc::Decal*spr;
|
|
||||||
int x;
|
|
||||||
int y;
|
|
||||||
std::string name;
|
|
||||||
WEATHER_POWER*selectedMove;
|
|
||||||
Entity(olc::Decal*spr,std::string name,int x,int y,int hp,int maxhp,bool isAlly=false) {
|
|
||||||
this->spr=spr;
|
|
||||||
this->name=name;
|
|
||||||
this->x=x;
|
|
||||||
this->y=y;
|
|
||||||
this->hp=hp;
|
|
||||||
this->maxhp=maxhp;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
class Encounter{
|
|
||||||
public:
|
|
||||||
int x,y;
|
|
||||||
std::vector<Entity> entities;
|
|
||||||
std::vector<int> turnOrder;
|
|
||||||
};
|
|
||||||
|
|
||||||
class WEATHER_POWER{
|
class WEATHER_POWER{
|
||||||
public:
|
public:
|
||||||
std::string description;
|
std::string description;
|
||||||
@ -131,18 +106,36 @@ class WEATHER_POWER{
|
|||||||
this->damageRoll=dmgRoll;
|
this->damageRoll=dmgRoll;
|
||||||
this->range=range;
|
this->range=range;
|
||||||
}
|
}
|
||||||
WEATHER_POWER(std::string name,std::string desc,Animation*icon,Animation*effect,int dmg,int dmgRoll,int range) {
|
};
|
||||||
this->description=desc;
|
|
||||||
|
class Entity{
|
||||||
|
public:
|
||||||
|
bool ally;
|
||||||
|
int hp;
|
||||||
|
int maxhp;
|
||||||
|
Decal*spr;
|
||||||
|
int x;
|
||||||
|
int y;
|
||||||
|
std::string name;
|
||||||
|
WEATHER_POWER*selectedMove;
|
||||||
|
Entity(Decal*spr,std::string name,int x,int y,int hp,int maxhp,bool isAlly=false) {
|
||||||
|
this->spr=spr;
|
||||||
this->name=name;
|
this->name=name;
|
||||||
this->anim=icon;
|
this->x=x;
|
||||||
this->effectAnim=effect;
|
this->y=y;
|
||||||
this->damage=dmg;
|
this->hp=hp;
|
||||||
this->damageRoll=dmgRoll;
|
this->maxhp=maxhp;
|
||||||
this->range=range;
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
class SeasonsOfLoneliness : public olc::PixelGameEngine
|
class Encounter{
|
||||||
|
public:
|
||||||
|
int x,y;
|
||||||
|
std::vector<Entity> entities;
|
||||||
|
std::vector<int> turnOrder;
|
||||||
|
};
|
||||||
|
|
||||||
|
class SeasonsOfLoneliness : public PixelGameEngine
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
SeasonsOfLoneliness()
|
SeasonsOfLoneliness()
|
||||||
@ -167,11 +160,11 @@ public:
|
|||||||
int**MAP=NULL;
|
int**MAP=NULL;
|
||||||
int MAP_WIDTH=-1;
|
int MAP_WIDTH=-1;
|
||||||
int MAP_HEIGHT=-1;
|
int MAP_HEIGHT=-1;
|
||||||
olc::Decal*TILES;
|
Decal*TILES;
|
||||||
float PLAYER_COORDS[2] = {14,4};
|
float PLAYER_COORDS[2] = {14,4};
|
||||||
std::vector<Object> OBJECTS;
|
std::vector<Object> OBJECTS;
|
||||||
bool CUTSCENE_ACTIVE=false;
|
bool CUTSCENE_ACTIVE=false;
|
||||||
CUTSCENE CURRENT_CUTSCENE=NONE;
|
cutscene::CUTSCENE CURRENT_CUTSCENE=cutscene::NONE;
|
||||||
int CUTSCENE_TIMER=0;
|
int CUTSCENE_TIMER=0;
|
||||||
bool CUTSCENE_FLAGS[8];
|
bool CUTSCENE_FLAGS[8];
|
||||||
bool messageBoxVisible=false;
|
bool messageBoxVisible=false;
|
||||||
@ -186,7 +179,7 @@ public:
|
|||||||
bool oxygenMeterVisible=false;
|
bool oxygenMeterVisible=false;
|
||||||
int oxygenQualityLevel=34;
|
int oxygenQualityLevel=34;
|
||||||
int plantState=0b10010110101000101010100110101010;
|
int plantState=0b10010110101000101010100110101010;
|
||||||
olc::SplashScreen splash;
|
SplashScreen splash;
|
||||||
Animation current_playerAnim;
|
Animation current_playerAnim;
|
||||||
Animation playerAnim;
|
Animation playerAnim;
|
||||||
Animation playerAnimRight;
|
Animation playerAnimRight;
|
||||||
@ -217,27 +210,19 @@ public:
|
|||||||
bool IN_BATTLE_ENCOUNTER = false;
|
bool IN_BATTLE_ENCOUNTER = false;
|
||||||
int BATTLE_ENTRY_TIMER = 0;
|
int BATTLE_ENTRY_TIMER = 0;
|
||||||
int EFFECT_TIMER = 0;
|
int EFFECT_TIMER = 0;
|
||||||
#define WEATHER_POWER_COUNT 15 //Number of powers that are in the game. Update storage array accordingly.
|
#define WEATHER_POWER_COUNT 5 //Number of powers that are in the game. Update storage array accordingly.
|
||||||
WEATHER_POWER*WEATHER_POWERS[WEATHER_POWER_COUNT] = {
|
WEATHER_POWER*WEATHER_POWERS[WEATHER_POWER_COUNT] = {
|
||||||
HAILSTORM,
|
HAILSTORM,
|
||||||
HURRICANE,
|
HURRICANE,
|
||||||
METEOR_SHOWER,
|
METEOR_SHOWER,
|
||||||
METEOR_STORM,
|
METEOR_STORM,
|
||||||
SNOWSTORM,
|
SNOWSTORM,};
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,0,0};
|
|
||||||
battle::BATTLESTATE BATTLE_STATE=battle::NONE;
|
battle::BATTLESTATE BATTLE_STATE=battle::NONE;
|
||||||
std::vector<WEATHER_POWER*> availablePowers;
|
std::vector<WEATHER_POWER*> availablePowers;
|
||||||
WEATHER_POWER*BATTLE_CARD_SELECTION=HAILSTORM;
|
WEATHER_POWER*BATTLE_CARD_SELECTION=HAILSTORM;
|
||||||
|
|
||||||
|
|
||||||
olc::Decal*DOME_DECAL,*FOOD_METER_DECAL,*OXYGEN_METER_DECAL,*PLANT_DECAL,
|
Decal*DOME_DECAL,*FOOD_METER_DECAL,*OXYGEN_METER_DECAL,*PLANT_DECAL,
|
||||||
*PLAYER_DECAL,
|
*PLAYER_DECAL,
|
||||||
*WEATHERNODE_EFFECT_DECAL,*POWER_HAILSTORM_DECAL,*POWER_HURRICANE_DECAL,*POWER_METEOR_SHOWER_DECAL,*POWER_METEOR_STORM_DECAL,*POWER_SNOWSTORM_DECAL,
|
*WEATHERNODE_EFFECT_DECAL,*POWER_HAILSTORM_DECAL,*POWER_HURRICANE_DECAL,*POWER_METEOR_SHOWER_DECAL,*POWER_METEOR_STORM_DECAL,*POWER_SNOWSTORM_DECAL,
|
||||||
*SPIDEY_DECAL;
|
*SPIDEY_DECAL;
|
||||||
@ -248,23 +233,23 @@ public:
|
|||||||
|
|
||||||
bool OnUserCreate() override
|
bool OnUserCreate() override
|
||||||
{
|
{
|
||||||
SetPixelMode(olc::Pixel::ALPHA);
|
SetPixelMode(Pixel::ALPHA);
|
||||||
ConsoleCaptureStdOut(true);
|
ConsoleCaptureStdOut(true);
|
||||||
//ConsoleShow(olc::F1,false);
|
//ConsoleShow(F1,false);
|
||||||
// Called once at the start, so create things here
|
// Called once at the start, so create things here
|
||||||
TILES=new olc::Decal(new olc::Sprite("assets/tiles.png"));
|
TILES=new Decal(new Sprite("assets/tiles.png"));
|
||||||
DOME_DECAL=new olc::Decal(new olc::Sprite("assets/dome.png"));
|
DOME_DECAL=new Decal(new Sprite("assets/dome.png"));
|
||||||
FOOD_METER_DECAL=new olc::Decal(new olc::Sprite("assets/corn.png"));
|
FOOD_METER_DECAL=new Decal(new Sprite("assets/corn.png"));
|
||||||
OXYGEN_METER_DECAL=new olc::Decal(new olc::Sprite("assets/co2.png"));
|
OXYGEN_METER_DECAL=new Decal(new Sprite("assets/co2.png"));
|
||||||
PLANT_DECAL=new olc::Decal(new olc::Sprite("assets/plant.png"));
|
PLANT_DECAL=new Decal(new Sprite("assets/plant.png"));
|
||||||
PLAYER_DECAL=new olc::Decal(new olc::Sprite("assets/player.png"));
|
PLAYER_DECAL=new Decal(new Sprite("assets/player.png"));
|
||||||
WEATHERNODE_EFFECT_DECAL=new olc::Decal(new olc::Sprite("assets/weathernode_effect.png"));
|
WEATHERNODE_EFFECT_DECAL=new Decal(new Sprite("assets/weathernode_effect.png"));
|
||||||
POWER_HAILSTORM_DECAL=new olc::Decal(new olc::Sprite("assets/hailstorm_icon.png"));
|
POWER_HAILSTORM_DECAL=new Decal(new Sprite("assets/hailstorm_icon.png"));
|
||||||
POWER_HURRICANE_DECAL=new olc::Decal(new olc::Sprite("assets/hurricane_icon.png"));
|
POWER_HURRICANE_DECAL=new Decal(new Sprite("assets/hurricane_icon.png"));
|
||||||
POWER_METEOR_SHOWER_DECAL=new olc::Decal(new olc::Sprite("assets/meteor_shower_icon.png"));
|
POWER_METEOR_SHOWER_DECAL=new Decal(new Sprite("assets/meteor_shower_icon.png"));
|
||||||
POWER_METEOR_STORM_DECAL=new olc::Decal(new olc::Sprite("assets/meteor_storm.png"));
|
POWER_METEOR_STORM_DECAL=new Decal(new Sprite("assets/meteor_storm.png"));
|
||||||
POWER_SNOWSTORM_DECAL=new olc::Decal(new olc::Sprite("assets/snowstorm_icon.png"));
|
POWER_SNOWSTORM_DECAL=new Decal(new Sprite("assets/snowstorm_icon.png"));
|
||||||
SPIDEY_DECAL=new olc::Decal(new olc::Sprite("assets/spidey.png"));
|
SPIDEY_DECAL=new Decal(new Sprite("assets/spidey.png"));
|
||||||
|
|
||||||
current_playerAnim.spr=PLAYER_DECAL;
|
current_playerAnim.spr=PLAYER_DECAL;
|
||||||
playerAnim.spr=PLAYER_DECAL;
|
playerAnim.spr=PLAYER_DECAL;
|
||||||
@ -356,8 +341,8 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
void GetAnyKeyPress() override {
|
void GetAnyKeyPress() override {
|
||||||
if (!GetKey(olc::W).bPressed&&!GetKey(olc::A).bPressed&&!GetKey(olc::S).bPressed&&!GetKey(olc::D).bPressed&&
|
if (!GetKey(W).bPressed&&!GetKey(A).bPressed&&!GetKey(S).bPressed&&!GetKey(D).bPressed&&
|
||||||
!GetKey(olc::UP).bPressed&&!GetKey(olc::RIGHT).bPressed&&!GetKey(olc::DOWN).bPressed&&!GetKey(olc::LEFT).bPressed) {
|
!GetKey(UP).bPressed&&!GetKey(RIGHT).bPressed&&!GetKey(DOWN).bPressed&&!GetKey(LEFT).bPressed) {
|
||||||
ActionButtonPress();
|
ActionButtonPress();
|
||||||
}
|
}
|
||||||
if (messageBoxVisible) {
|
if (messageBoxVisible) {
|
||||||
@ -399,35 +384,35 @@ public:
|
|||||||
elapsedTime-=TARGET_RATE;
|
elapsedTime-=TARGET_RATE;
|
||||||
updateGame();
|
updateGame();
|
||||||
}
|
}
|
||||||
if (GetKey(olc::F1).bPressed) {
|
if (GetKey(F1).bPressed) {
|
||||||
ConsoleShow(olc::F1,false);
|
ConsoleShow(F1,false);
|
||||||
}
|
}
|
||||||
if (GetKey(olc::D).bPressed||GetKey(olc::RIGHT).bPressed||GetKey(olc::NP6).bPressed) {
|
if (GetKey(D).bPressed||GetKey(RIGHT).bPressed||GetKey(NP6).bPressed) {
|
||||||
changeAnimation(playerAnimWalkRight);
|
changeAnimation(playerAnimWalkRight);
|
||||||
}
|
}
|
||||||
if (GetKey(olc::A).bPressed||GetKey(olc::LEFT).bPressed||GetKey(olc::NP4).bPressed) {
|
if (GetKey(A).bPressed||GetKey(LEFT).bPressed||GetKey(NP4).bPressed) {
|
||||||
changeAnimation(playerAnimWalkLeft);
|
changeAnimation(playerAnimWalkLeft);
|
||||||
}
|
}
|
||||||
if (GetKey(olc::W).bPressed||GetKey(olc::UP).bPressed||GetKey(olc::NP8).bPressed) {
|
if (GetKey(W).bPressed||GetKey(UP).bPressed||GetKey(NP8).bPressed) {
|
||||||
changeAnimation(playerAnimWalkUp);
|
changeAnimation(playerAnimWalkUp);
|
||||||
}
|
}
|
||||||
if (GetKey(olc::S).bPressed||GetKey(olc::DOWN).bPressed||GetKey(olc::NP5).bPressed||GetKey(olc::NP2).bPressed) {
|
if (GetKey(S).bPressed||GetKey(DOWN).bPressed||GetKey(NP5).bPressed||GetKey(NP2).bPressed) {
|
||||||
changeAnimation(playerAnimWalkDown);
|
changeAnimation(playerAnimWalkDown);
|
||||||
}
|
}
|
||||||
if (!GetKey(olc::D).bHeld&&!GetKey(olc::RIGHT).bHeld&&!GetKey(olc::NP6).bHeld&&
|
if (!GetKey(D).bHeld&&!GetKey(RIGHT).bHeld&&!GetKey(NP6).bHeld&&
|
||||||
!GetKey(olc::A).bHeld&&!GetKey(olc::LEFT).bHeld&&!GetKey(olc::NP4).bHeld&&
|
!GetKey(A).bHeld&&!GetKey(LEFT).bHeld&&!GetKey(NP4).bHeld&&
|
||||||
!GetKey(olc::S).bHeld&&!GetKey(olc::UP).bHeld&&!GetKey(olc::NP8).bHeld&&
|
!GetKey(S).bHeld&&!GetKey(UP).bHeld&&!GetKey(NP8).bHeld&&
|
||||||
!GetKey(olc::W).bHeld&&!GetKey(olc::DOWN).bHeld&&!GetKey(olc::NP5).bHeld&&!GetKey(olc::NP2).bHeld) {
|
!GetKey(W).bHeld&&!GetKey(DOWN).bHeld&&!GetKey(NP5).bHeld&&!GetKey(NP2).bHeld) {
|
||||||
if (GetKey(olc::D).bReleased||GetKey(olc::RIGHT).bReleased||GetKey(olc::NP6).bReleased) {
|
if (GetKey(D).bReleased||GetKey(RIGHT).bReleased||GetKey(NP6).bReleased) {
|
||||||
changeAnimation(playerAnimRight);
|
changeAnimation(playerAnimRight);
|
||||||
}
|
}
|
||||||
if (GetKey(olc::A).bReleased||GetKey(olc::LEFT).bReleased||GetKey(olc::NP4).bReleased) {
|
if (GetKey(A).bReleased||GetKey(LEFT).bReleased||GetKey(NP4).bReleased) {
|
||||||
changeAnimation(playerAnimLeft);
|
changeAnimation(playerAnimLeft);
|
||||||
}
|
}
|
||||||
if (GetKey(olc::W).bReleased||GetKey(olc::UP).bReleased||GetKey(olc::NP8).bReleased) {
|
if (GetKey(W).bReleased||GetKey(UP).bReleased||GetKey(NP8).bReleased) {
|
||||||
changeAnimation(playerAnim);
|
changeAnimation(playerAnim);
|
||||||
}
|
}
|
||||||
if (GetKey(olc::S).bReleased||GetKey(olc::DOWN).bReleased||GetKey(olc::NP5).bReleased||GetKey(olc::NP2).bReleased) {
|
if (GetKey(S).bReleased||GetKey(DOWN).bReleased||GetKey(NP5).bReleased||GetKey(NP2).bReleased) {
|
||||||
changeAnimation(playerAnimDown);
|
changeAnimation(playerAnimDown);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -441,17 +426,17 @@ public:
|
|||||||
switch (GAME_STATE) {
|
switch (GAME_STATE) {
|
||||||
case CUTSCENE_1:{
|
case CUTSCENE_1:{
|
||||||
GAME_STATE=CUTSCENE_2;
|
GAME_STATE=CUTSCENE_2;
|
||||||
PlayCutscene(PAN_DOME);
|
PlayCutscene(cutscene::PAN_DOME);
|
||||||
fadeIn();
|
fadeIn();
|
||||||
}break;
|
}break;
|
||||||
case CUTSCENE_2:{
|
case CUTSCENE_2:{
|
||||||
fadeIn();
|
fadeIn();
|
||||||
PlayCutscene(CUTSCENE_4);
|
PlayCutscene(cutscene::CUTSCENE_4);
|
||||||
GAME_STATE=GAMEWORLD;
|
GAME_STATE=GAMEWORLD;
|
||||||
}break;
|
}break;
|
||||||
}
|
}
|
||||||
switch (CURRENT_CUTSCENE) {
|
switch (CURRENT_CUTSCENE) {
|
||||||
case TRANSITION_CUTSCENE:{
|
case cutscene::TRANSITION_CUTSCENE:{
|
||||||
LoadMap("assets/maps/map1");
|
LoadMap("assets/maps/map1");
|
||||||
PLAYER_COORDS[0]=40;
|
PLAYER_COORDS[0]=40;
|
||||||
PLAYER_COORDS[1]=37;
|
PLAYER_COORDS[1]=37;
|
||||||
@ -465,18 +450,18 @@ public:
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void PlayCutscene(CUTSCENE scene) {
|
void PlayCutscene(cutscene::CUTSCENE scene) {
|
||||||
CURRENT_CUTSCENE=scene;
|
CURRENT_CUTSCENE=scene;
|
||||||
switch (scene) {
|
switch (scene) {
|
||||||
case PAN_DOME:{
|
case cutscene::PAN_DOME:{
|
||||||
PLAYER_COORDS[0]=14;
|
PLAYER_COORDS[0]=14;
|
||||||
PLAYER_COORDS[1]=35+(64/2/32);
|
PLAYER_COORDS[1]=35+(64/2/32);
|
||||||
}break;
|
}break;
|
||||||
case PAUSE_TO_CUTSCENE_3:{
|
case cutscene::PAUSE_TO_CUTSCENE_3:{
|
||||||
CUTSCENE_CONSOLE_TEXT.clear();
|
CUTSCENE_CONSOLE_TEXT.clear();
|
||||||
textInd=0;
|
textInd=0;
|
||||||
}break;
|
}break;
|
||||||
case CUTSCENE_4:{
|
case cutscene::CUTSCENE_4:{
|
||||||
LoadMap("assets/maps/map2");
|
LoadMap("assets/maps/map2");
|
||||||
PLAYER_COORDS[0]=16;
|
PLAYER_COORDS[0]=16;
|
||||||
PLAYER_COORDS[1]=6;
|
PLAYER_COORDS[1]=6;
|
||||||
@ -494,13 +479,13 @@ public:
|
|||||||
CUTSCENE_TIMER++;
|
CUTSCENE_TIMER++;
|
||||||
}
|
}
|
||||||
if (fade&&transparency<255) {
|
if (fade&&transparency<255) {
|
||||||
transparency=clamp(transparency+FADE_SPD,0,255);
|
transparency=std::clamp(transparency+FADE_SPD,0,255);
|
||||||
if (transparency==255) {
|
if (transparency==255) {
|
||||||
fadeOutCompleted();
|
fadeOutCompleted();
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
if (!fade&&transparency>0) {
|
if (!fade&&transparency>0) {
|
||||||
transparency=clamp(transparency-FADE_SPD,0,255);
|
transparency=std::clamp(transparency-FADE_SPD,0,255);
|
||||||
if (transparency==0) {
|
if (transparency==0) {
|
||||||
fadeInCompleted();
|
fadeInCompleted();
|
||||||
}
|
}
|
||||||
@ -523,8 +508,8 @@ public:
|
|||||||
|
|
||||||
if (CURRENT_CUTSCENE==NONE&&!messageBoxVisible&&!IN_BATTLE_ENCOUNTER) {
|
if (CURRENT_CUTSCENE==NONE&&!messageBoxVisible&&!IN_BATTLE_ENCOUNTER) {
|
||||||
bool changed=false;
|
bool changed=false;
|
||||||
if (GetKey(olc::D).bHeld||GetKey(olc::RIGHT).bHeld||GetKey(olc::NP6).bHeld) {
|
if (GetKey(D).bHeld||GetKey(RIGHT).bHeld||GetKey(NP6).bHeld) {
|
||||||
PLAYER_COORDS[0]=clamp(PLAYER_COORDS[0]+MOVE_SPD,0.1,(double)MAP_WIDTH);
|
PLAYER_COORDS[0]=std::clamp(PLAYER_COORDS[0]+MOVE_SPD,0.1,(double)MAP_WIDTH);
|
||||||
//ConsoleClear();
|
//ConsoleClear();
|
||||||
//cout<<"("<<PLAYER_COORDS[0]<<","<<PLAYER_COORDS[1]<<+")";
|
//cout<<"("<<PLAYER_COORDS[0]<<","<<PLAYER_COORDS[1]<<+")";
|
||||||
if (!changed&&¤t_playerAnim!=&playerAnimWalkRight) {
|
if (!changed&&¤t_playerAnim!=&playerAnimWalkRight) {
|
||||||
@ -532,8 +517,8 @@ public:
|
|||||||
changed=true;
|
changed=true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (GetKey(olc::A).bHeld||GetKey(olc::LEFT).bHeld||GetKey(olc::NP4).bHeld) {
|
if (GetKey(A).bHeld||GetKey(LEFT).bHeld||GetKey(NP4).bHeld) {
|
||||||
PLAYER_COORDS[0]=clamp(PLAYER_COORDS[0]-MOVE_SPD,0.1,(double)MAP_WIDTH);
|
PLAYER_COORDS[0]=std::clamp(PLAYER_COORDS[0]-MOVE_SPD,0.1,(double)MAP_WIDTH);
|
||||||
//ConsoleClear();
|
//ConsoleClear();
|
||||||
//cout<<"("<<PLAYER_COORDS[0]<<","<<PLAYER_COORDS[1]<<+")";
|
//cout<<"("<<PLAYER_COORDS[0]<<","<<PLAYER_COORDS[1]<<+")";
|
||||||
if (!changed&&¤t_playerAnim!=&playerAnimWalkLeft) {
|
if (!changed&&¤t_playerAnim!=&playerAnimWalkLeft) {
|
||||||
@ -541,8 +526,8 @@ public:
|
|||||||
changed=true;
|
changed=true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (GetKey(olc::W).bHeld||GetKey(olc::UP).bHeld||GetKey(olc::NP8).bHeld) {
|
if (GetKey(W).bHeld||GetKey(UP).bHeld||GetKey(NP8).bHeld) {
|
||||||
PLAYER_COORDS[1]=clamp(PLAYER_COORDS[1]-MOVE_SPD,0.1,(double)MAP_HEIGHT);
|
PLAYER_COORDS[1]=std::clamp(PLAYER_COORDS[1]-MOVE_SPD,0.1,(double)MAP_HEIGHT);
|
||||||
//ConsoleClear();
|
//ConsoleClear();
|
||||||
//cout<<"("<<PLAYER_COORDS[0]<<","<<PLAYER_COORDS[1]<<+")";
|
//cout<<"("<<PLAYER_COORDS[0]<<","<<PLAYER_COORDS[1]<<+")";
|
||||||
if (!changed&&¤t_playerAnim!=&playerAnimWalkUp) {
|
if (!changed&&¤t_playerAnim!=&playerAnimWalkUp) {
|
||||||
@ -550,8 +535,8 @@ public:
|
|||||||
changed=true;
|
changed=true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (GetKey(olc::S).bHeld||GetKey(olc::DOWN).bHeld||GetKey(olc::NP5).bHeld||GetKey(olc::NP2).bHeld) {
|
if (GetKey(S).bHeld||GetKey(DOWN).bHeld||GetKey(NP5).bHeld||GetKey(NP2).bHeld) {
|
||||||
PLAYER_COORDS[1]=clamp(PLAYER_COORDS[1]+MOVE_SPD,0.1,(double)MAP_HEIGHT);
|
PLAYER_COORDS[1]=std::clamp(PLAYER_COORDS[1]+MOVE_SPD,0.1,(double)MAP_HEIGHT);
|
||||||
//ConsoleClear();
|
//ConsoleClear();
|
||||||
//cout<<"("<<PLAYER_COORDS[0]<<","<<PLAYER_COORDS[1]<<+")";
|
//cout<<"("<<PLAYER_COORDS[0]<<","<<PLAYER_COORDS[1]<<+")";
|
||||||
if (!changed&&¤t_playerAnim!=&playerAnimWalkDown) {
|
if (!changed&&¤t_playerAnim!=&playerAnimWalkDown) {
|
||||||
@ -566,36 +551,36 @@ public:
|
|||||||
if (obj.name.compare("HAILSTORM_NODE")==0&&collidesWithPlayer(obj)) {
|
if (obj.name.compare("HAILSTORM_NODE")==0&&collidesWithPlayer(obj)) {
|
||||||
int amountGained=rand()%4+2;
|
int amountGained=rand()%4+2;
|
||||||
HAILSTORM->playerOwnCount+=amountGained;
|
HAILSTORM->playerOwnCount+=amountGained;
|
||||||
cout<<"Increased HAILSTORM power inventory count by "<<amountGained<<".\n";
|
std::cout<<"Increased HAILSTORM power inventory count by "<<amountGained<<".\n";
|
||||||
OBJECTS.erase(OBJECTS.begin()+i--);
|
OBJECTS.erase(OBJECTS.begin()+i--);
|
||||||
} else
|
} else
|
||||||
if (obj.name.compare("HURRICANE_NODE")==0&&collidesWithPlayer(obj)) {
|
if (obj.name.compare("HURRICANE_NODE")==0&&collidesWithPlayer(obj)) {
|
||||||
int amountGained=rand()%4+2;
|
int amountGained=rand()%4+2;
|
||||||
HURRICANE->playerOwnCount+=amountGained;
|
HURRICANE->playerOwnCount+=amountGained;
|
||||||
cout<<"Increased HURRICANE power inventory count by "<<amountGained<<".\n";
|
std::cout<<"Increased HURRICANE power inventory count by "<<amountGained<<".\n";
|
||||||
OBJECTS.erase(OBJECTS.begin()+i--);
|
OBJECTS.erase(OBJECTS.begin()+i--);
|
||||||
} else
|
} else
|
||||||
if (obj.name.compare("METEORSHOWER_NODE")==0&&collidesWithPlayer(obj)) {
|
if (obj.name.compare("METEORSHOWER_NODE")==0&&collidesWithPlayer(obj)) {
|
||||||
int amountGained=rand()%4+2;
|
int amountGained=rand()%4+2;
|
||||||
METEOR_SHOWER->playerOwnCount+=amountGained;
|
METEOR_SHOWER->playerOwnCount+=amountGained;
|
||||||
cout<<"Increased METEORSHOWER power inventory count by "<<amountGained<<".\n";
|
std::cout<<"Increased METEORSHOWER power inventory count by "<<amountGained<<".\n";
|
||||||
OBJECTS.erase(OBJECTS.begin()+i--);
|
OBJECTS.erase(OBJECTS.begin()+i--);
|
||||||
} else
|
} else
|
||||||
if (obj.name.compare("METEORSTORM_NODE")==0&&collidesWithPlayer(obj)) {
|
if (obj.name.compare("METEORSTORM_NODE")==0&&collidesWithPlayer(obj)) {
|
||||||
int amountGained=rand()%4+2;
|
int amountGained=rand()%4+2;
|
||||||
METEOR_STORM->playerOwnCount+=amountGained;
|
METEOR_STORM->playerOwnCount+=amountGained;
|
||||||
cout<<"Increased METEORSTORM power inventory count by "<<amountGained<<".\n";
|
std::cout<<"Increased METEORSTORM power inventory count by "<<amountGained<<".\n";
|
||||||
OBJECTS.erase(OBJECTS.begin()+i--);
|
OBJECTS.erase(OBJECTS.begin()+i--);
|
||||||
} else
|
} else
|
||||||
if (obj.name.compare("SNOWSTORM_NODE")==0&&collidesWithPlayer(obj)) {
|
if (obj.name.compare("SNOWSTORM_NODE")==0&&collidesWithPlayer(obj)) {
|
||||||
int amountGained=rand()%4+2;
|
int amountGained=rand()%4+2;
|
||||||
SNOWSTORM->playerOwnCount+=amountGained;
|
SNOWSTORM->playerOwnCount+=amountGained;
|
||||||
cout<<"Increased SNOWSTORM power inventory count by "<<amountGained<<".\n";
|
std::cout<<"Increased SNOWSTORM power inventory count by "<<amountGained<<".\n";
|
||||||
OBJECTS.erase(OBJECTS.begin()+i--);
|
OBJECTS.erase(OBJECTS.begin()+i--);
|
||||||
}
|
}
|
||||||
if (obj.name.compare("EXIT")==0&&collidesWithPlayer(obj)) {
|
if (obj.name.compare("EXIT")==0&&collidesWithPlayer(obj)) {
|
||||||
fadeOut();
|
fadeOut();
|
||||||
PlayCutscene(TRANSITION_CUTSCENE);
|
PlayCutscene(cutscene::TRANSITION_CUTSCENE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -611,7 +596,7 @@ public:
|
|||||||
for (int i=0;i<WEATHER_POWER_COUNT;i++) {
|
for (int i=0;i<WEATHER_POWER_COUNT;i++) {
|
||||||
if (WEATHER_POWERS[i]->playerOwnCount>0) {
|
if (WEATHER_POWERS[i]->playerOwnCount>0) {
|
||||||
availablePowers.push_back(WEATHER_POWERS[i]);
|
availablePowers.push_back(WEATHER_POWERS[i]);
|
||||||
cout<<"There are x"<<WEATHER_POWERS[i]->playerOwnCount<<" of "<<WEATHER_POWERS[i]->name<<"\n";
|
//cout<<"There are x"<<WEATHER_POWERS[i]->playerOwnCount<<" of "<<WEATHER_POWERS[i]->name<<"\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
BATTLE_CARD_SELECTION=availablePowers[0];
|
BATTLE_CARD_SELECTION=availablePowers[0];
|
||||||
@ -662,7 +647,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
switch (CURRENT_CUTSCENE) {
|
switch (CURRENT_CUTSCENE) {
|
||||||
case CUTSCENE_4:{
|
case cutscene::CUTSCENE_4:{
|
||||||
if (!messageBoxVisible) {
|
if (!messageBoxVisible) {
|
||||||
if (!CUTSCENE_FLAGS[0]) {
|
if (!CUTSCENE_FLAGS[0]) {
|
||||||
CUTSCENE_FLAGS[0]=true;
|
CUTSCENE_FLAGS[0]=true;
|
||||||
@ -779,11 +764,11 @@ public:
|
|||||||
void drawGame(){
|
void drawGame(){
|
||||||
switch (GAME_STATE) {
|
switch (GAME_STATE) {
|
||||||
case CUTSCENE_1:{
|
case CUTSCENE_1:{
|
||||||
DrawStringDecal({16,16},CUTSCENE_CONSOLE_TEXT,olc::GREEN,{1,1});
|
DrawStringDecal({16,16},CUTSCENE_CONSOLE_TEXT,GREEN,{1,1});
|
||||||
if (textInd<STORY_TEXT1.length()) {
|
if (textInd<STORY_TEXT1.length()) {
|
||||||
FillRectDecal({(float)(16+(cursorX)*8%(WIDTH-32)),(float)(8+GetTextSize(CUTSCENE_CONSOLE_TEXT).y+((cursorX==28)?8:0))},{4,8},olc::GREEN);
|
FillRectDecal({(float)(16+(cursorX)*8%(WIDTH-32)),(float)(8+GetTextSize(CUTSCENE_CONSOLE_TEXT).y+((cursorX==28)?8:0))},{4,8},GREEN);
|
||||||
} else {
|
} else {
|
||||||
FillRectDecal({(float)(16+(cursorX)*8%(WIDTH-32)),(float)(8+GetTextSize(CUTSCENE_CONSOLE_TEXT).y+((cursorX==28)?8:0))},{4,8},olc::Pixel(0,255,0,(0.5*sin(frameCount*4/60.0)+0.5)*256));
|
FillRectDecal({(float)(16+(cursorX)*8%(WIDTH-32)),(float)(8+GetTextSize(CUTSCENE_CONSOLE_TEXT).y+((cursorX==28)?8:0))},{4,8},Pixel(0,255,0,(0.5*sin(frameCount*4/60.0)+0.5)*256));
|
||||||
}
|
}
|
||||||
GradientFillRectDecal({0,0},{WIDTH/2,HEIGHT/2},{20, 28, 22,ALPHA_SCREEN1},{20, 28, 22,ALPHA_SCREEN1},{20, 28, 22,ALPHA_SCREEN2},{20, 28, 22,ALPHA_SCREEN1});
|
GradientFillRectDecal({0,0},{WIDTH/2,HEIGHT/2},{20, 28, 22,ALPHA_SCREEN1},{20, 28, 22,ALPHA_SCREEN1},{20, 28, 22,ALPHA_SCREEN2},{20, 28, 22,ALPHA_SCREEN1});
|
||||||
GradientFillRectDecal({WIDTH/2,0},{WIDTH/2,HEIGHT/2},{20, 28, 22,ALPHA_SCREEN1},{20, 28, 22,ALPHA_SCREEN2},{20, 28, 22,ALPHA_SCREEN1},{20, 28, 22,ALPHA_SCREEN1});
|
GradientFillRectDecal({WIDTH/2,0},{WIDTH/2,HEIGHT/2},{20, 28, 22,ALPHA_SCREEN1},{20, 28, 22,ALPHA_SCREEN2},{20, 28, 22,ALPHA_SCREEN1},{20, 28, 22,ALPHA_SCREEN1});
|
||||||
@ -796,29 +781,29 @@ public:
|
|||||||
int meterYOffset=2;
|
int meterYOffset=2;
|
||||||
if (CURRENT_CUTSCENE==NONE) {
|
if (CURRENT_CUTSCENE==NONE) {
|
||||||
if (foodMeterVisible) {
|
if (foodMeterVisible) {
|
||||||
DrawStringDecal({WIDTH-36*0.4-GetTextSize(to_string(foodCount)).x*1-8,meterYOffset+2},to_string(foodCount),olc::BLUE,{1,1});
|
DrawStringDecal({WIDTH-36*0.4-GetTextSize(std::to_string(foodCount)).x*1-8,meterYOffset+2},std::to_string(foodCount),BLUE,{1,1});
|
||||||
DrawStringDecal({WIDTH-36*0.4-GetTextSize(to_string(foodCount)).x*1-7,meterYOffset+2},to_string(foodCount),olc::BLACK,{1,1});
|
DrawStringDecal({WIDTH-36*0.4-GetTextSize(std::to_string(foodCount)).x*1-7,meterYOffset+2},std::to_string(foodCount),BLACK,{1,1});
|
||||||
DrawDecal({WIDTH-52*0.4,meterYOffset},FOOD_METER_DECAL,{0.4,0.4});
|
DrawDecal({WIDTH-52*0.4,meterYOffset},FOOD_METER_DECAL,{0.4,0.4});
|
||||||
meterYOffset+=(2+48*0.4);
|
meterYOffset+=(2+48*0.4);
|
||||||
}
|
}
|
||||||
if (oxygenMeterVisible) {
|
if (oxygenMeterVisible) {
|
||||||
DrawStringDecal({WIDTH-36*0.4-GetTextSize(to_string(oxygenQualityLevel)+"%").x*1-8,meterYOffset+2},to_string(oxygenQualityLevel)+"%",olc::BLUE,{1,1});
|
DrawStringDecal({WIDTH-36*0.4-GetTextSize(std::to_string(oxygenQualityLevel)+"%").x*1-8,meterYOffset+2},std::to_string(oxygenQualityLevel)+"%",BLUE,{1,1});
|
||||||
DrawStringDecal({WIDTH-36*0.4-GetTextSize(to_string(oxygenQualityLevel)+"%").x*1-7,meterYOffset+2},to_string(oxygenQualityLevel)+"%",olc::BLACK,{1,1});
|
DrawStringDecal({WIDTH-36*0.4-GetTextSize(std::to_string(oxygenQualityLevel)+"%").x*1-7,meterYOffset+2},std::to_string(oxygenQualityLevel)+"%",BLACK,{1,1});
|
||||||
DrawDecal({WIDTH-52*0.4,meterYOffset},OXYGEN_METER_DECAL,{0.4,0.4});
|
DrawDecal({WIDTH-52*0.4,meterYOffset},OXYGEN_METER_DECAL,{0.4,0.4});
|
||||||
meterYOffset+=(2+48*0.4);
|
meterYOffset+=(2+48*0.4);
|
||||||
}
|
}
|
||||||
DrawPartialDecal({WIDTH/2-16+(current_playerAnim.flipped?32:0),HEIGHT/2-16},current_playerAnim.spr,current_playerAnim.getCurrentFrame(),{32,32},{current_playerAnim.flipped?-1:1,1});
|
DrawPartialDecal({WIDTH/2-16+(current_playerAnim.flipped?32:0),HEIGHT/2-16},current_playerAnim.spr,current_playerAnim.getCurrentFrame(),{32,32},{current_playerAnim.flipped?-1:1,1});
|
||||||
if (IN_BATTLE_ENCOUNTER&&BATTLE_ENTRY_TIMER<45) {
|
if (IN_BATTLE_ENCOUNTER&&BATTLE_ENTRY_TIMER<45) {
|
||||||
DrawStringDecal({WIDTH/2-16+(current_playerAnim.flipped?32:0)+8,HEIGHT/2-16-sin(frameCount*12/60.0)*4-12},"!!",olc::RED);
|
DrawStringDecal({WIDTH/2-16+(current_playerAnim.flipped?32:0)+8,HEIGHT/2-16-sin(frameCount*12/60.0)*4-12},"!!",RED);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}break;
|
}break;
|
||||||
case CUTSCENE_3:{
|
case CUTSCENE_3:{
|
||||||
DrawStringDecal({48,16},CUTSCENE_CONSOLE_TEXT,olc::Pixel(100, 10, 255),{2,2});
|
DrawStringDecal({48,16},CUTSCENE_CONSOLE_TEXT,Pixel(100, 10, 255),{2,2});
|
||||||
if (textInd<STORY_TEXT2.length()) {
|
if (textInd<STORY_TEXT2.length()) {
|
||||||
FillRectDecal({(float)(48+(cursorX)*16%(WIDTH-32)),(float)(GetTextSize(CUTSCENE_CONSOLE_TEXT).y*2+((cursorX==28)?16:0))},{4*2,8*2},olc::Pixel(100, 10, 255));
|
FillRectDecal({(float)(48+(cursorX)*16%(WIDTH-32)),(float)(GetTextSize(CUTSCENE_CONSOLE_TEXT).y*2+((cursorX==28)?16:0))},{4*2,8*2},Pixel(100, 10, 255));
|
||||||
} else {
|
} else {
|
||||||
FillRectDecal({(float)(48+(cursorX)*16%(WIDTH-32)),(float)(GetTextSize(CUTSCENE_CONSOLE_TEXT).y*2+((cursorX==28)?16:0))},{4*2,8*2},olc::Pixel(100, 10, 255,(0.5*sin(frameCount*4/60.0)+0.5)*256));
|
FillRectDecal({(float)(48+(cursorX)*16%(WIDTH-32)),(float)(GetTextSize(CUTSCENE_CONSOLE_TEXT).y*2+((cursorX==28)?16:0))},{4*2,8*2},Pixel(100, 10, 255,(0.5*sin(frameCount*4/60.0)+0.5)*256));
|
||||||
}
|
}
|
||||||
GradientFillRectDecal({0,0},{WIDTH/2,HEIGHT/2},{100, 10, 255,ALPHA_SCREEN1},{100, 10, 255,ALPHA_SCREEN1},{100, 10, 255,ALPHA_SCREEN2},{100, 10, 255,ALPHA_SCREEN1});
|
GradientFillRectDecal({0,0},{WIDTH/2,HEIGHT/2},{100, 10, 255,ALPHA_SCREEN1},{100, 10, 255,ALPHA_SCREEN1},{100, 10, 255,ALPHA_SCREEN2},{100, 10, 255,ALPHA_SCREEN1});
|
||||||
GradientFillRectDecal({WIDTH/2,0},{WIDTH/2,HEIGHT/2},{100, 10, 255,ALPHA_SCREEN1},{100, 10, 255,ALPHA_SCREEN2},{100, 10, 255,ALPHA_SCREEN1},{100, 10, 255,ALPHA_SCREEN1});
|
GradientFillRectDecal({WIDTH/2,0},{WIDTH/2,HEIGHT/2},{100, 10, 255,ALPHA_SCREEN1},{100, 10, 255,ALPHA_SCREEN2},{100, 10, 255,ALPHA_SCREEN1},{100, 10, 255,ALPHA_SCREEN1});
|
||||||
@ -828,23 +813,42 @@ public:
|
|||||||
}
|
}
|
||||||
switch (BATTLE_STATE) {
|
switch (BATTLE_STATE) {
|
||||||
case battle::PLAYER_SELECTION:{
|
case battle::PLAYER_SELECTION:{
|
||||||
GradientFillRectDecal({WIDTH/6,HEIGHT/6},{WIDTH/3,HEIGHT/6*2},olc::Pixel(72, 160, 212,255),olc::Pixel(72, 160, 212,255),olc::Pixel(72, 160, 212,0),olc::Pixel(72, 160, 212,255));
|
GradientFillRectDecal({WIDTH/6,HEIGHT/6},{WIDTH/3,HEIGHT/6*2},Pixel(72, 160, 212,255),Pixel(72, 160, 212,255),Pixel(72, 160, 212,0),Pixel(72, 160, 212,255));
|
||||||
GradientFillRectDecal({WIDTH/6*3+1,HEIGHT/6},{WIDTH/3,HEIGHT/6*2},olc::Pixel(72, 160, 212,255),olc::Pixel(72, 160, 212,0),olc::Pixel(72, 160, 212,255),olc::Pixel(72, 160, 212,255));
|
GradientFillRectDecal({WIDTH/6*3+1,HEIGHT/6},{WIDTH/3,HEIGHT/6*2},Pixel(72, 160, 212,255),Pixel(72, 160, 212,0),Pixel(72, 160, 212,255),Pixel(72, 160, 212,255));
|
||||||
GradientFillRectDecal({WIDTH/6,HEIGHT/6*3},{WIDTH/3,HEIGHT/6*2},olc::Pixel(72, 160, 212,255),olc::Pixel(72, 160, 212,255),olc::Pixel(72, 160, 212,255),olc::Pixel(72, 160, 212,0));
|
GradientFillRectDecal({WIDTH/6,HEIGHT/6*3},{WIDTH/3,HEIGHT/6*2},Pixel(72, 160, 212,255),Pixel(72, 160, 212,255),Pixel(72, 160, 212,255),Pixel(72, 160, 212,0));
|
||||||
GradientFillRectDecal({WIDTH/6*3+1,HEIGHT/6*3},{WIDTH/3,HEIGHT/6*2},olc::Pixel(72, 160, 212,0),olc::Pixel(72, 160, 212,255),olc::Pixel(72, 160, 212,255),olc::Pixel(72, 160, 212,255));
|
GradientFillRectDecal({WIDTH/6*3+1,HEIGHT/6*3},{WIDTH/3,HEIGHT/6*2},Pixel(72, 160, 212,0),Pixel(72, 160, 212,255),Pixel(72, 160, 212,255),Pixel(72, 160, 212,255));
|
||||||
|
DrawPartialDecal({WIDTH/2-BATTLE_CARD_SELECTION->anim->width/2*3,HEIGHT/6+16-BATTLE_CARD_SELECTION->anim->height/2},BATTLE_CARD_SELECTION->anim->spr,BATTLE_CARD_SELECTION->anim->getCurrentFrame(),{BATTLE_CARD_SELECTION->anim->width,BATTLE_CARD_SELECTION->anim->height},{3,3});
|
||||||
|
for (int x=-1;x<=1;x++) {
|
||||||
|
for (int y=-1;y<=1;y++) {
|
||||||
|
if (x!=0&&y!=0) {
|
||||||
|
DrawStringPropDecal({WIDTH/6+4+x,HEIGHT/2+8+y},BATTLE_CARD_SELECTION->name,BLACK,{2,2});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
DrawStringPropDecal({WIDTH/6+4,HEIGHT/2+8},BATTLE_CARD_SELECTION->name,Pixel(93, 161, 163,255),{2,2});
|
||||||
|
DrawWrappedPropText({WIDTH/6+4+1,HEIGHT/2+24+1},BATTLE_CARD_SELECTION->description,WIDTH/3*2-8,BLACK,{1,1});
|
||||||
|
DrawWrappedPropText({WIDTH/6+4,HEIGHT/2+24},BATTLE_CARD_SELECTION->description,WIDTH/3*2-8,Pixel(227, 245, 255,255),{1,1});
|
||||||
|
for (int x=-1;x<=1;x++) {
|
||||||
|
for (int y=-1;y<=1;y++) {
|
||||||
|
if (x!=0&&y!=0) {
|
||||||
|
DrawStringPropDecal({WIDTH/6+4+x,HEIGHT/2+8+y},BATTLE_CARD_SELECTION->name,BLACK,{2,2});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
DrawStringPropDecal({WIDTH/6+4,HEIGHT/2+8},std::to_string(BATTLE_CARD_SELECTION->playerOwnCount),Pixel(93, 161, 163,255),{2,2});
|
||||||
}break;
|
}break;
|
||||||
}
|
}
|
||||||
if (messageBoxVisible) {
|
if (messageBoxVisible) {
|
||||||
DrawDialogBox({4,HEIGHT-60},{WIDTH/2,16},olc::Pixel(18, 0, 33,180));
|
DrawDialogBox({4,HEIGHT-60},{WIDTH/2,16},Pixel(18, 0, 33,180));
|
||||||
DrawDialogBox({0,HEIGHT-48},{WIDTH,48},olc::Pixel(18, 0, 33,180));
|
DrawDialogBox({0,HEIGHT-48},{WIDTH,48},Pixel(18, 0, 33,180));
|
||||||
DrawStringPropDecal({8,HEIGHT-40},messageBoxText);
|
DrawStringPropDecal({8,HEIGHT-40},messageBoxText);
|
||||||
DrawStringPropDecal({8,HEIGHT-57},messageBoxSpeaker);
|
DrawStringPropDecal({8,HEIGHT-57},messageBoxSpeaker);
|
||||||
if (messageBoxCursor==messageBoxRefText.length()) {
|
if (messageBoxCursor==messageBoxRefText.length()) {
|
||||||
DrawStringPropDecal({WIDTH-16-(float)sin(frameCount*8/60.0)*3,HEIGHT-8+(float)(cos(frameCount*6/60.0)*0.6)},"v",olc::Pixel(173, 74, 255,(0.5*sin(frameCount*8/60.0)+0.5)*128+128),{(float)sin(frameCount*8/60.0),0.5});
|
DrawStringPropDecal({WIDTH-16-(float)sin(frameCount*8/60.0)*3,HEIGHT-8+(float)(cos(frameCount*6/60.0)*0.6)},"v",Pixel(173, 74, 255,(0.5*sin(frameCount*8/60.0)+0.5)*128+128),{(float)sin(frameCount*8/60.0),0.5});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FillRectDecal({0,0},{WIDTH,HEIGHT},olc::Pixel(0,0,0,transparency));
|
FillRectDecal({0,0},{WIDTH,HEIGHT},Pixel(0,0,0,transparency));
|
||||||
//FillRectDecal({WIDTH/2-2,HEIGHT/2-2},{4,4},olc::WHITE);
|
//FillRectDecal({WIDTH/2-2,HEIGHT/2-2},{4,4},WHITE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DrawGameWorld() {
|
void DrawGameWorld() {
|
||||||
@ -873,7 +877,7 @@ public:
|
|||||||
} else {
|
} else {
|
||||||
if (obj.name.find("NODE")!=std::string::npos) {
|
if (obj.name.find("NODE")!=std::string::npos) {
|
||||||
DrawDecal({(obj.x-PLAYER_COORDS[0])*32+WIDTH/2-32+18,(obj.y-PLAYER_COORDS[1])*32+HEIGHT/2-32+26},WEATHERNODE_EFFECT_DECAL);
|
DrawDecal({(obj.x-PLAYER_COORDS[0])*32+WIDTH/2-32+18,(obj.y-PLAYER_COORDS[1])*32+HEIGHT/2-32+26},WEATHERNODE_EFFECT_DECAL);
|
||||||
DrawPartialDecal({(obj.x-PLAYER_COORDS[0])*32+WIDTH/2-16*(float)sin(frameCount*2/60.0)+16,(obj.y-PLAYER_COORDS[1])*32+HEIGHT/2},obj.anim->spr,{obj.anim->getCurrentFrame().x,obj.anim->getCurrentFrame().y},{obj.anim->width,obj.anim->height},{(float)sin(frameCount*2/60.0),1},olc::Pixel((float)sin(frameCount*4/60.0)*55+200,(float)sin(frameCount*4/60.0)*55+200,(float)sin(frameCount*4/60.0+M_PI)+65*125,255));
|
DrawPartialDecal({(obj.x-PLAYER_COORDS[0])*32+WIDTH/2-16*(float)sin(frameCount*2/60.0)+16,(obj.y-PLAYER_COORDS[1])*32+HEIGHT/2},obj.anim->spr,{obj.anim->getCurrentFrame().x,obj.anim->getCurrentFrame().y},{obj.anim->width,obj.anim->height},{(float)sin(frameCount*2/60.0),1},Pixel((float)sin(frameCount*4/60.0)*55+200,(float)sin(frameCount*4/60.0)*55+200,(float)sin(frameCount*4/60.0+M_PI)+65*125,255));
|
||||||
} else
|
} else
|
||||||
if (obj.hasAnim) {
|
if (obj.hasAnim) {
|
||||||
DrawPartialDecal({(obj.x-PLAYER_COORDS[0])*32+WIDTH/2+(obj.anim->flipped?32:0),(obj.y-PLAYER_COORDS[1])*32+HEIGHT/2},obj.anim->spr,{obj.anim->getCurrentFrame().x,obj.anim->getCurrentFrame().y},{obj.anim->width,obj.anim->height},{obj.anim->flipped?-1:1,1});
|
DrawPartialDecal({(obj.x-PLAYER_COORDS[0])*32+WIDTH/2+(obj.anim->flipped?32:0),(obj.y-PLAYER_COORDS[1])*32+HEIGHT/2},obj.anim->spr,{obj.anim->getCurrentFrame().x,obj.anim->getCurrentFrame().y},{obj.anim->width,obj.anim->height},{obj.anim->flipped?-1:1,1});
|
||||||
@ -883,7 +887,7 @@ public:
|
|||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
if (obj.name.compare("EXIT")==0) {
|
if (obj.name.compare("EXIT")==0) {
|
||||||
GradientFillRectDecal({(obj.x-PLAYER_COORDS[0])*32+WIDTH/2,(obj.y-PLAYER_COORDS[1])*32+HEIGHT/2},{32,32},olc::Pixel(0,0,0,0),olc::WHITE,olc::WHITE,olc::Pixel(0,0,0,0));
|
GradientFillRectDecal({(obj.x-PLAYER_COORDS[0])*32+WIDTH/2,(obj.y-PLAYER_COORDS[1])*32+HEIGHT/2},{32,32},Pixel(0,0,0,0),WHITE,WHITE,Pixel(0,0,0,0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (auto&enc:ENCOUNTERS) {
|
for (auto&enc:ENCOUNTERS) {
|
||||||
@ -908,15 +912,15 @@ public:
|
|||||||
plantState&=numb;
|
plantState&=numb;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DrawDialogBox(const olc::vi2d &pos, const olc::vi2d &size, olc::Pixel p = olc::WHITE, olc::Pixel p2 = olc::DARK_GREY, olc::Pixel p3 = olc::VERY_DARK_GREY) {
|
void DrawDialogBox(const vi2d &pos, const vi2d &size, Pixel p = WHITE, Pixel p2 = DARK_GREY, Pixel p3 = VERY_DARK_GREY) {
|
||||||
FillRectDecal({(float)pos.x,(float)pos.y},size,p2);
|
FillRectDecal({(float)pos.x,(float)pos.y},size,p2);
|
||||||
FillRectDecal({(float)pos.x+1,(float)pos.y+1},{(float)size.x-2,(float)size.y-2},p);
|
FillRectDecal({(float)pos.x+1,(float)pos.y+1},{(float)size.x-2,(float)size.y-2},p);
|
||||||
FillRectDecal({(float)pos.x+2,(float)pos.y+2},{(float)size.x-4,(float)size.y-4},p3);
|
FillRectDecal({(float)pos.x+2,(float)pos.y+2},{(float)size.x-4,(float)size.y-4},p3);
|
||||||
FillRectDecal({(float)pos.x+3,(float)pos.y+3},{(float)size.x-5,(float)size.y-5},p);
|
FillRectDecal({(float)pos.x+3,(float)pos.y+3},{(float)size.x-5,(float)size.y-5},p);
|
||||||
Draw({pos.x,pos.y},olc::BLACK);
|
Draw({pos.x,pos.y},BLACK);
|
||||||
Draw({pos.x+size.x,pos.y+size.y},olc::BLACK);
|
Draw({pos.x+size.x,pos.y+size.y},BLACK);
|
||||||
Draw({pos.x+size.x,pos.y},olc::BLACK);
|
Draw({pos.x+size.x,pos.y},BLACK);
|
||||||
Draw({pos.x,pos.y+size.y},olc::BLACK);
|
Draw({pos.x,pos.y+size.y},BLACK);
|
||||||
}
|
}
|
||||||
|
|
||||||
void fadeOut() {
|
void fadeOut() {
|
||||||
@ -927,7 +931,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
void EndCutscene() {
|
void EndCutscene() {
|
||||||
CURRENT_CUTSCENE=NONE;
|
CURRENT_CUTSCENE=cutscene::NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplayMessageBox(int dialogNumber) {
|
void DisplayMessageBox(int dialogNumber) {
|
||||||
@ -1031,6 +1035,27 @@ public:
|
|||||||
return PLAYER_COORDS[0]>=obj.x&&PLAYER_COORDS[0]<=obj.x+WIDTH/32&&
|
return PLAYER_COORDS[0]>=obj.x&&PLAYER_COORDS[0]<=obj.x+WIDTH/32&&
|
||||||
PLAYER_COORDS[1]>=obj.y&&PLAYER_COORDS[1]<=obj.y+HEIGHT/32;
|
PLAYER_COORDS[1]>=obj.y&&PLAYER_COORDS[1]<=obj.y+HEIGHT/32;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DrawWrappedPropText(vf2d pos,std::string text,int targetWidth,Pixel col,vf2d scale) {
|
||||||
|
std::string wrappedText;
|
||||||
|
int marker=0;
|
||||||
|
while (marker<text.length()) {
|
||||||
|
wrappedText+=text[marker];
|
||||||
|
if (GetTextSizeProp(wrappedText).x>targetWidth*scale.x) {
|
||||||
|
int tempMarker=marker;
|
||||||
|
while (wrappedText[tempMarker]!=' ') {
|
||||||
|
wrappedText.erase(tempMarker--);
|
||||||
|
}
|
||||||
|
wrappedText.erase(tempMarker++);
|
||||||
|
wrappedText+='\n';
|
||||||
|
while (tempMarker<marker+1) {
|
||||||
|
wrappedText+=text[tempMarker++];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
marker++;
|
||||||
|
}
|
||||||
|
DrawStringPropDecal(pos,wrappedText,col,scale);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user