Completed core scenes for Chapter 1

Co-authored-by: sigonasr2 <sigonasr2@gmail.com>
master
sigonasr2 2 years ago
parent e0f6a98407
commit 3b696c802a
  1. 213
      SeasonsOfLoneliness.cpp
  2. BIN
      Seasons_of_Loneliness
  3. 7
      assets/maps/map1
  4. BIN
      assets/nado.png
  5. 2
      data.h
  6. 2
      ideas

@ -55,7 +55,9 @@ namespace cutscene{
WALK_TO_COMPUTER,
INPUT_USERNAME,
GO_OUTSIDE,
WALK_TO_ROVER
WALK_TO_ROVER,
DISPLAY_VOLCANIC_AREA,
END_VOLCANIC_AREA_CUTSCENE,
};
}
@ -76,9 +78,16 @@ namespace battle{
namespace gameflag{
enum FLAG{
TUTORIAL_WALKED_OFF_FARM,
VISIT_BROKEN_ROVER,
};
}
enum MOVEMENT_PRIORITY{
HORZ_FIRST,
VERT_FIRST,
BOTH
};
#define MAX_TERMINAL_NAME_LENGTH 6
#define WIDTH 256
#define HEIGHT 224
@ -367,6 +376,7 @@ public:
Animation POWER_SNOWSTORM_ANIMATION;
Animation CONSUME_SNACK_ANIMATION;
Animation CONSUME_MEAL_ANIMATION;
Animation NADO_ANIMATION;
ParticleEffect*HAILSTORM_EFF = new ParticleEffect({0,0},{WIDTH,HEIGHT},{0,0},{WIDTH,HEIGHT},{1,1},{4,4},{-2,0.5},{-0.5,2},Pixel(143, 242, 255,255),Pixel(255,255,255,255),300,Pixel(220, 226, 227,0));
ParticleEffect*HURRICANE_EFF = new ParticleEffect({0,0},{WIDTH,HEIGHT},{0,0},{WIDTH,HEIGHT},{1,1},{2,2},{-4,1},{-1,4},Pixel(225, 248, 252,64),Pixel(255,255,255,128),300,Pixel(220, 226, 227,0));
ParticleEffect*METEOR_RAIN_EFF = new ParticleEffect({0,0},{WIDTH,HEIGHT},{0,0},{WIDTH,HEIGHT},{3,3},{6,6},{-1,0.2},{-0.2,1},Pixel(46, 31, 31,255),Pixel(43, 31, 46,255),50,Pixel(30, 10, 36,0));
@ -430,7 +440,8 @@ public:
*PLAYER_DECAL,
*WEATHERNODE_EFFECT_DECAL,*POWER_HAILSTORM_DECAL,*POWER_HURRICANE_DECAL,*POWER_METEOR_SHOWER_DECAL,*POWER_METEOR_STORM_DECAL,*POWER_SNOWSTORM_DECAL,
*SPIDEY_DECAL,*TARGETING_CIRCLE,*TARGETING_RANGE_CIRCLE,*HEALTHBAR_DECAL,
*CONSUME_SNACK_DECAL,*CONSUME_MEAL_DECAL,*COMPUTER_DECAL,*BROKEN_ROVER_DECAL;
*CONSUME_SNACK_DECAL,*CONSUME_MEAL_DECAL,*COMPUTER_DECAL,*BROKEN_ROVER_DECAL,
*NADO_DECAL;
std::map<std::string,ObjectLoadInfo*> BASE_OBJECTS;
std::vector<Encounter> ENCOUNTERS;
Encounter ENCOUNTER_SPIDEY_1;
@ -445,7 +456,7 @@ public:
SetPixelMode(Pixel::ALPHA);
ConsoleCaptureStdOut(true);
#define LAYERS 2 //How many layers exist.
#define LAYERS 3 //How many layers exist.
for (int i=1;i<LAYERS;i++) {
CreateLayer();
EnableLayer(i,true);
@ -473,6 +484,7 @@ public:
HEALTHBAR_DECAL=new Decal(new Sprite("assets/healthbar.png"));
COMPUTER_DECAL=new Decal(new Sprite("assets/computerSystem.png"));
BROKEN_ROVER_DECAL=new Decal(new Sprite("assets/brokenROVER.png"));
NADO_DECAL=new Decal(new Sprite("assets/nado.png"));
current_playerAnim.spr=PLAYER_DECAL;
playerAnim.spr=PLAYER_DECAL;
@ -549,6 +561,11 @@ public:
CONSUME_MEAL_ANIMATION.frames.push_back({32,0});
CONSUME_MEAL_ANIMATION.frames.push_back({64,0});
CONSUME_MEAL_ANIMATION.skip_frames=nodeAnimationSkipFrames;
NADO_ANIMATION.spr=NADO_DECAL;
for (int i=0;i<8;i++) {
NADO_ANIMATION.frames.push_back({i*32,0});
}
CONSUME_MEAL_ANIMATION.skip_frames=3;
HAILSTORM->playerOwnCount=3;
HURRICANE->playerOwnCount=1;
@ -575,6 +592,7 @@ public:
BASE_OBJECTS["SNOWSTORM_NODE"]=new ObjectLoadInfo(POWER_SNOWSTORM_DECAL,&POWER_SNOWSTORM_ANIMATION);
BASE_OBJECTS["COMPUTER"]=new ObjectLoadInfo(COMPUTER_DECAL);
BASE_OBJECTS["BROKEN_ROVER"]=new ObjectLoadInfo(BROKEN_ROVER_DECAL);
BASE_OBJECTS["NADO"]=new ObjectLoadInfo(NADO_DECAL,&NADO_ANIMATION);
Zone*SILICON_DEPOSIT_ZONE = new Zone({109,7},{26,9},{0,0},{WIDTH,HEIGHT},{0,0},{WIDTH,HEIGHT},{1,1},{3,3},{-30,-3},{30,3},Pixel(133, 98, 66,180),Pixel(220, 120, 90,230),300,Pixel(87, 78, 69,64));
@ -789,6 +807,8 @@ public:
SetDrawTarget(nullptr);
Clear(BLANK);
SetDrawTarget(1);
Clear(BLANK);
SetDrawTarget(2);
drawGame();
// called once per frame
return true;
@ -814,6 +834,10 @@ public:
PLAYER_COORDS[1]=37.5;
fadeIn();
EndCutscene();
if (!GAME_FLAGS[gameflag::VISIT_BROKEN_ROVER]) {
GAME_FLAGS[gameflag::VISIT_BROKEN_ROVER]=true;
PlayCutscene(cutscene::WALK_TO_ROVER);
}
}break;
case cutscene::TRANSITION_CUTSCENE_2:{
LoadMap("assets/maps/map2");
@ -821,11 +845,37 @@ public:
fadeIn();
EndCutscene();
}break;
case cutscene::DISPLAY_VOLCANIC_AREA:{
TeleportToMapFileCoords(13,122);
fadeIn();
}break;
case cutscene::END_VOLCANIC_AREA_CUTSCENE:{
PLAYER_COORDS[0]=33;
PLAYER_COORDS[1]=34;
ClearAllTemporaryObjects();
fadeIn();
}break;
}
}
void fadeInCompleted() {
switch (CURRENT_CUTSCENE) {
case cutscene::DISPLAY_VOLCANIC_AREA:{
CUTSCENE_FLAGS[0]=true;
}break;
case cutscene::END_VOLCANIC_AREA_CUTSCENE:{
DisplayMessageBox(10);
EndCutscene();
}break;
}
}
void StartCutscene(cutscene::CUTSCENE scene) {
PlayCutscene(scene);
}
void RunCutscene(cutscene::CUTSCENE scene) {
PlayCutscene(scene);
}
void PlayCutscene(cutscene::CUTSCENE scene) {
@ -848,6 +898,10 @@ public:
applyPixelEffect(HURRICANE,GetMapFileCoords(7,11),1);
CUTSCENE_TIMER=0;
}break;
case cutscene::WALK_TO_ROVER:{
CUTSCENE_OBJS[0]=CreateObject({PLAYER_COORDS[0],PLAYER_COORDS[1]},PLAYER_DECAL,{32,0},{32,32},true);
CUTSCENE_OBJS[0]->flipped=true;
}break;
}
for (int i=0;i<8;i++) {
CUTSCENE_FLAGS[i]=false;
@ -888,6 +942,23 @@ public:
}
}
if (!IN_BATTLE_ENCOUNTER) {
bool zoneEffectActive=false;
for (int i=0;i<ZONES.size();i++) {
Zone*z = ZONES[i];
if (PLAYER_COORDS[0]>=z->pos.x&&PLAYER_COORDS[0]<=z->pos.x+z->size.x&&
PLAYER_COORDS[1]>=z->pos.y&&PLAYER_COORDS[1]<=z->pos.y+z->size.y) {
if (PIXEL_EFFECT_TRANSPARENCY==0) {
applyPixelEffect(z->eff,{PLAYER_COORDS[0],PLAYER_COORDS[1]},0.9);
}
zoneEffectActive=true;
}
}
if (!zoneEffectActive&&PIXEL_EFFECT_TRANSPARENCY>0) {
clearPixelEffect();
}
}
if (playerCanMove()) {
bool animationchanged=false;
bool positionModified=false;
@ -942,20 +1013,6 @@ public:
if (positionModified) {
playerMoved();
}
bool zoneEffectActive=false;
for (int i=0;i<ZONES.size();i++) {
Zone*z = ZONES[i];
if (PLAYER_COORDS[0]>=z->pos.x&&PLAYER_COORDS[0]<=z->pos.x+z->size.x&&
PLAYER_COORDS[1]>=z->pos.y&&PLAYER_COORDS[1]<=z->pos.y+z->size.y) {
if (PIXEL_EFFECT_TRANSPARENCY==0) {
applyPixelEffect(z->eff,{PLAYER_COORDS[0],PLAYER_COORDS[1]},0.9);
}
zoneEffectActive=true;
}
}
if (!zoneEffectActive&&PIXEL_EFFECT_TRANSPARENCY>0) {
clearPixelEffect();
}
for (int i=0;i<OBJECTS.size();i++) {
Object*obj = OBJECTS[i];
if (obj->name.compare("HAILSTORM_NODE")==0&&collidesWithPlayer(obj)) {
@ -1311,6 +1368,47 @@ public:
}
}
}break;
case cutscene::WALK_TO_ROVER:{
if (MoveObjectTowardsPoint({33,36},CUTSCENE_OBJS[0],HORZ_FIRST)) {
CUTSCENE_OBJS[0]->spos={64,0};
}
if (MoveCameraTowardsPoint({33,36})) {
if (!CUTSCENE_FLAGS[0]) {
CUTSCENE_FLAGS[0]=true;
CUTSCENE_TIMER=0;
}
if (CUTSCENE_TIMER>60) {
if (!messageBoxVisible) {
if (!CUTSCENE_FLAGS[3]) {
CUTSCENE_FLAGS[3]=true;
DisplayMessageBox(13);
} else
if (!CUTSCENE_FLAGS[1]) {
CUTSCENE_FLAGS[1]=true;
DisplayMessageBox(7);
} else
if (!CUTSCENE_FLAGS[2]) {
CUTSCENE_FLAGS[2]=true;
DisplayMessageBox(8);
} else {
PlayCutscene(cutscene::DISPLAY_VOLCANIC_AREA);
fadeOut();
}
}
}
}
}break;
case cutscene::DISPLAY_VOLCANIC_AREA:{
if (CUTSCENE_FLAGS[0]&&!messageBoxVisible) {
if (!CUTSCENE_FLAGS[1]) {
CUTSCENE_FLAGS[1]=true;
DisplayMessageBox(9);
} else {
fadeOut();
PlayCutscene(cutscene::END_VOLCANIC_AREA_CUTSCENE);
}
}
}break;
}
switch (GAME_STATE) {
@ -1450,6 +1548,7 @@ public:
DrawGameWorld();
int meterYOffset=2;
if (CURRENT_CUTSCENE==cutscene::NONE) {
SetDrawTarget(nullptr);
if (foodMeterVisible) {
DrawStringDecal({WIDTH-36*0.4-GetTextSize(std::to_string(foodCount)).x*1-8,meterYOffset+1},std::to_string(foodCount),BLACK,{1,1});
DrawStringDecal({WIDTH-36*0.4-GetTextSize(std::to_string(foodCount)).x*1-7,meterYOffset+2},std::to_string(foodCount),WHITE,{1,1});
@ -1466,6 +1565,7 @@ public:
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},"!!",RED);
}
SetDrawTarget(2);
}
}break;
case CUTSCENE_3:{
@ -1522,7 +1622,7 @@ public:
}
}
if (PIXEL_EFFECT_TRANSPARENCY>0) {
SetDrawTarget(nullptr);
SetDrawTarget(1);
for (int i=0;i<PIXEL_LIMIT;i++) {
if (pixels[i]->size.x==1&&pixels[i]->size.y==1) {
Draw(pixels[i]->pos,{pixels[i]->r,pixels[i]->g,pixels[i]->b,pixels[i]->a});
@ -1531,9 +1631,10 @@ public:
}
}
FillRectDecal({0,0},{WIDTH,HEIGHT},Pixel(ORIGINAL_FOREGROUND_EFFECT_COLOR.r,ORIGINAL_FOREGROUND_EFFECT_COLOR.g,ORIGINAL_FOREGROUND_EFFECT_COLOR.b,ORIGINAL_FOREGROUND_EFFECT_COLOR.a*PIXEL_EFFECT_TRANSPARENCY));
SetDrawTarget(1);
SetDrawTarget(2);
}
if (messageBoxVisible) {
SetDrawTarget(nullptr);
DrawDialogBox({4,HEIGHT-60},{WIDTH/2,16},Pixel(18, 0, 33,180));
DrawDialogBox({0,HEIGHT-48},{WIDTH,48},Pixel(18, 0, 33,180));
DrawStringPropDecal({8,HEIGHT-40},messageBoxText);
@ -1541,6 +1642,7 @@ public:
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",Pixel(173, 74, 255,(0.5*sin(frameCount*8/60.0)+0.5)*128+128),{(float)sin(frameCount*8/60.0),0.5});
}
SetDrawTarget(2);
}
switch (CURRENT_CUTSCENE) {
case cutscene::NODE_COLLECT_CUTSCENE:{
@ -1690,20 +1792,13 @@ public:
fade=false;
}
void StopCutscene() {
EndCutscene();
}
void EndCutscene() {
CURRENT_CUTSCENE=cutscene::NONE;
for (int i=0;i<8;i++) {
for (int j=0;j<OBJECTS.size();j++) {
if (OBJECTS[j]==CUTSCENE_OBJS[i]) {
if (CUTSCENE_OBJS[i]->tempObj) {
OBJECTS.erase(OBJECTS.begin()+j);
std::cout<<"Erased at position "<<j<<".\n";
break;
}
delete CUTSCENE_OBJS[i];
}
}
}
ClearAllTemporaryObjects();
}
void DisplayMessageBox(int dialogNumber) {
@ -2149,10 +2244,16 @@ public:
return newobj;
}
void ClearAllTemporaryObjects() {
for (int i=0;i<OBJECTS.size();i++) {
if (OBJECTS[i]->tempObj) {
delete OBJECTS[i];
OBJECTS.erase(OBJECTS.begin()+i--);
for (int i=0;i<8;i++) {
for (int j=0;j<OBJECTS.size();j++) {
if (OBJECTS[j]==CUTSCENE_OBJS[i]) {
if (CUTSCENE_OBJS[i]->tempObj) {
OBJECTS.erase(OBJECTS.begin()+j);
std::cout<<"Erased at position "<<j<<".\n";
break;
}
delete CUTSCENE_OBJS[i];
}
}
}
}
@ -2189,6 +2290,48 @@ public:
}
return reachedPosition;
}
bool MoveObjectTowardsPoint(vf2d pos,Object*obj,MOVEMENT_PRIORITY movementStyle,float spd=BATTLE_CAMERA_SCROLL_SPD,bool secondRun=false) {
bool reachedPosition=true;
if (movementStyle==HORZ_FIRST||movementStyle==BOTH) {
if (obj->x!=pos.x) {
if (obj->x<pos.x) {
obj->x+=spd;
if (obj->x>pos.x) {
obj->x=pos.x;
}
} else {
obj->x-=spd;
if (obj->x<pos.x) {
obj->x=pos.x;
}
}
reachedPosition=false;
} else
if (!secondRun&&movementStyle!=BOTH) {
MoveObjectTowardsPoint(pos,obj,VERT_FIRST,spd,true);
}
}
if (movementStyle==VERT_FIRST||movementStyle==BOTH) {
if (obj->y!=pos.y) {
if (obj->y<pos.y) {
obj->y+=spd;
if (obj->y>pos.y) {
obj->y=pos.y;
}
} else {
obj->y-=spd;
if (obj->y<pos.y) {
obj->y=pos.y;
}
}
reachedPosition=false;
} else
if (!secondRun&&movementStyle!=BOTH) {
MoveObjectTowardsPoint(pos,obj,HORZ_FIRST,spd,true);
}
}
return reachedPosition;
}
};

Binary file not shown.

@ -86,3 +86,10 @@
167;44;SNOWSTORM_NODE
20;10;HURRICANE_NODE
33;35;BROKEN_ROVER
116;8;NADO
120;9;NADO
123;7;NADO
122;10;NADO
116;11;NADO
120;11;NADO
122;13;NADO

Binary file not shown.

After

Width:  |  Height:  |  Size: 81 KiB

@ -48,7 +48,7 @@ $PLAYER
So those dust columns only form around large hole deposits. This is usually where volcanic activity subsides, and usually dense rich in minerals!)",//9
R"(
$PLAYER
We'll head there.)",//10
We'll head there. I recall seeing some volcanic rock North-East of here.)",//10
R"(
$PLAYER
What a great harvest!)",//11

@ -81,3 +81,5 @@ a little baffled."
"Winds" - Winds interact with Seeds and Fire.
"Petal Storm" - A petal storm causes Seeds to scatter and minor damage.
""
==============
Go the whole game nameless (Do not farm food)
Loading…
Cancel
Save