generated from sigonasr2/CPlusPlusProjectTemplate
Complete ending to Chapter 1
Co-authored-by: sigonasr2 <sigonasr2@gmail.com>
This commit is contained in:
parent
6fb5ec4acb
commit
fa2f66b964
@ -8,8 +8,9 @@
|
||||
using namespace olc;
|
||||
|
||||
//#define TEST_MAP1 //Toggle to just play around on map 1.
|
||||
#define TEST_MAP2 //Toggle on to just play around on map 2.
|
||||
#define SKIP_INTRO true
|
||||
//#define TEST_MAP2 //Toggle on to just play around on map 2.
|
||||
|
||||
#define SKIP_INTRO false
|
||||
|
||||
#define STARTING_MAP "assets/maps/map1"
|
||||
#define STARTING_STATE CUTSCENE_1
|
||||
@ -40,6 +41,7 @@ enum GAMESTATE{
|
||||
WAITING_FOR_CUTSCENE_3,
|
||||
GAME_OVER,
|
||||
COLLECTED_SILICON,
|
||||
CUTSCENE_4, //First rover repaired.
|
||||
};
|
||||
|
||||
namespace cutscene{
|
||||
@ -60,6 +62,8 @@ namespace cutscene{
|
||||
WALK_TO_ROVER,
|
||||
DISPLAY_VOLCANIC_AREA,
|
||||
END_VOLCANIC_AREA_CUTSCENE,
|
||||
REPAIR_ROVER_1,
|
||||
GET_SOME_REST,
|
||||
};
|
||||
}
|
||||
|
||||
@ -82,6 +86,7 @@ namespace gameflag{
|
||||
TUTORIAL_WALKED_OFF_FARM,
|
||||
VISIT_BROKEN_ROVER,
|
||||
COLLECTED_SILICON_1,
|
||||
REPAIRED_ROVER_1,
|
||||
};
|
||||
}
|
||||
|
||||
@ -450,6 +455,8 @@ public:
|
||||
std::string PLAYER_NAME="...";
|
||||
std::vector<Zone*>ZONES;
|
||||
std::vector<vi2d>COLLECTED_ITEMS;
|
||||
Zone*ACTIVE_ZONE=nullptr;
|
||||
std::vector<vi2d>REPAIRED_ROVERS;
|
||||
|
||||
|
||||
Decal*DOME_DECAL,*FOOD_METER_DECAL,*OXYGEN_METER_DECAL,*PLANT_DECAL,
|
||||
@ -457,7 +464,7 @@ public:
|
||||
*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,
|
||||
*NADO_DECAL,*SILICON_ROCK_DECAL,*PETAL_STORM_DECAL;
|
||||
*NADO_DECAL,*SILICON_ROCK_DECAL,*PETAL_STORM_DECAL,*ROVER_DECAL;
|
||||
std::map<std::string,ObjectLoadInfo*> BASE_OBJECTS;
|
||||
std::vector<Encounter> ENCOUNTERS;
|
||||
Encounter ENCOUNTER_SPIDEY_1;
|
||||
@ -508,6 +515,7 @@ public:
|
||||
NADO_DECAL=new Decal(new Sprite("assets/nado.png"));
|
||||
SILICON_ROCK_DECAL=new Decal(new Sprite("assets/siliconPiece.png"));
|
||||
PETAL_STORM_DECAL=new Decal(new Sprite("assets/petalstorm_icon.png"));
|
||||
ROVER_DECAL=new Decal(new Sprite("assets/ROVER.png"));
|
||||
|
||||
current_playerAnim.spr=PLAYER_DECAL;
|
||||
playerAnim.spr=PLAYER_DECAL;
|
||||
@ -657,6 +665,11 @@ public:
|
||||
fadeOut();
|
||||
}
|
||||
}break;
|
||||
case CUTSCENE_4:{
|
||||
if (textInd>=STORY_TEXT1.length()) {
|
||||
fadeOut();
|
||||
}
|
||||
}break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -857,6 +870,11 @@ public:
|
||||
PlayCutscene(cutscene::CUTSCENE_4);
|
||||
GAME_STATE=GAMEWORLD;
|
||||
}break;
|
||||
case CUTSCENE_4:{
|
||||
GAME_STATE=GAMEWORLD;
|
||||
PlayCutscene(cutscene::GET_SOME_REST);
|
||||
fadeIn();
|
||||
}break;
|
||||
}
|
||||
switch (CURRENT_CUTSCENE) {
|
||||
case cutscene::TRANSITION_CUTSCENE:{
|
||||
@ -898,6 +916,9 @@ public:
|
||||
DisplayMessageBox(10);
|
||||
EndCutscene();
|
||||
}break;
|
||||
case cutscene::GET_SOME_REST:{
|
||||
DisplayMessageBox(18);
|
||||
}break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -933,6 +954,9 @@ public:
|
||||
CUTSCENE_OBJS[0]=CreateObject({PLAYER_COORDS[0],PLAYER_COORDS[1]},PLAYER_DECAL,{32,0},{32,32},true);
|
||||
CUTSCENE_OBJS[0]->flipped=true;
|
||||
}break;
|
||||
case cutscene::REPAIR_ROVER_1:{
|
||||
CUTSCENE_OBJS[0]=CreateObject({PLAYER_COORDS[0],PLAYER_COORDS[1]},PLAYER_DECAL,{64,0},{32,32},true);
|
||||
}break;
|
||||
}
|
||||
for (int i=0;i<8;i++) {
|
||||
CUTSCENE_FLAGS[i]=false;
|
||||
@ -979,14 +1003,16 @@ public:
|
||||
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) {
|
||||
if (ACTIVE_ZONE==nullptr) {
|
||||
applyPixelEffect(z->eff,{PLAYER_COORDS[0],PLAYER_COORDS[1]},0.9);
|
||||
ACTIVE_ZONE=z;
|
||||
}
|
||||
zoneEffectActive=true;
|
||||
}
|
||||
}
|
||||
if (!zoneEffectActive&&PIXEL_EFFECT_TRANSPARENCY>0) {
|
||||
if (!zoneEffectActive&&ACTIVE_ZONE!=nullptr) {
|
||||
clearPixelEffect();
|
||||
ACTIVE_ZONE=nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1471,11 +1497,49 @@ public:
|
||||
}
|
||||
}
|
||||
}break;
|
||||
case cutscene::REPAIR_ROVER_1:{
|
||||
if (!messageBoxVisible) {
|
||||
if (!CUTSCENE_FLAGS[0]) {
|
||||
CUTSCENE_FLAGS[0]=true;
|
||||
DisplayMessageBox(16);
|
||||
} else
|
||||
if (!CUTSCENE_FLAGS[1]) {
|
||||
CUTSCENE_FLAGS[1]=true;
|
||||
CUTSCENE_TIMER=0;
|
||||
} else
|
||||
if (!CUTSCENE_FLAGS[4]&&CUTSCENE_TIMER>60) {
|
||||
for (int i=0;i<OBJECTS.size();i++) {
|
||||
if (OBJECTS[i]->x==33&&OBJECTS[i]->y==35) {
|
||||
OBJECTS[i]->spr=ROVER_DECAL;
|
||||
}
|
||||
}
|
||||
} else
|
||||
if (!CUTSCENE_FLAGS[2]&&CUTSCENE_TIMER>120) {
|
||||
DisplayMessageBox(17);
|
||||
CUTSCENE_FLAGS[2]=true;
|
||||
} else
|
||||
if (!CUTSCENE_FLAGS[3]&&CUTSCENE_TIMER>120) {
|
||||
GAME_STATE=CUTSCENE_4;
|
||||
}
|
||||
}
|
||||
}break;
|
||||
case cutscene::GET_SOME_REST:{
|
||||
if (!messageBoxVisible) {
|
||||
if (!CUTSCENE_FLAGS[0]) {
|
||||
CUTSCENE_FLAGS[0]=true;
|
||||
DisplayMessageBox(19);
|
||||
} else
|
||||
{
|
||||
EndCutscene();
|
||||
}
|
||||
}
|
||||
}break;
|
||||
}
|
||||
|
||||
switch (GAME_STATE) {
|
||||
case CUTSCENE_1:
|
||||
case CUTSCENE_3:{
|
||||
case CUTSCENE_3:
|
||||
case CUTSCENE_4:{
|
||||
std::string refText;
|
||||
switch (GAME_STATE) {
|
||||
case CUTSCENE_1:{
|
||||
@ -1484,6 +1548,9 @@ public:
|
||||
case CUTSCENE_3:{
|
||||
refText=STORY_TEXT2;
|
||||
}break;
|
||||
case CUTSCENE_4:{
|
||||
refText=STORY_TEXT3;
|
||||
}break;
|
||||
}
|
||||
if (GAME_STATE==CUTSCENE_3&&frameCount%4!=0) {break;}
|
||||
if (textInd<refText.length()) {
|
||||
@ -1598,6 +1665,10 @@ public:
|
||||
GAME_FLAGS[gameflag::TUTORIAL_WALKED_OFF_FARM]=true;
|
||||
PlayCutscene(cutscene::WALK_TO_COMPUTER);
|
||||
CUTSCENE_OBJS[0]=CreateObject({PLAYER_COORDS[0],PLAYER_COORDS[1]},PLAYER_DECAL,{32,0},{32,32},true);
|
||||
} else
|
||||
if (!GAME_FLAGS[gameflag::REPAIRED_ROVER_1]&&PLAYER_COORDS[0]>=31&&PLAYER_COORDS[0]<=35&&PLAYER_COORDS[1]>=33&&PLAYER_COORDS[1]<=37) {
|
||||
GAME_FLAGS[gameflag::REPAIRED_ROVER_1]=true;
|
||||
PlayCutscene(cutscene::REPAIR_ROVER_1);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1930,19 +2001,30 @@ public:
|
||||
split1>>x;
|
||||
split2>>y;
|
||||
bool alreadyCollected=false;
|
||||
bool alreadyRepaired=false;
|
||||
for (int i=0;i<COLLECTED_ITEMS.size();i++) {
|
||||
if (x==COLLECTED_ITEMS[i].x&&y==COLLECTED_ITEMS[i].y) {
|
||||
alreadyCollected=true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
for (int i=0;i<REPAIRED_ROVERS.size();i++) {
|
||||
if (x==REPAIRED_ROVERS[i].x&&y==REPAIRED_ROVERS[i].y) {
|
||||
alreadyRepaired=true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!alreadyCollected) {
|
||||
Object*obj = new Object();
|
||||
obj->x=x;
|
||||
obj->y=y;
|
||||
std::string split3 = data.substr(data.find(';',data.find(";")+1)+1,data.length()-(data.find(';',data.find(";")+1)+1));
|
||||
if (split3.compare("NULL")!=0) {
|
||||
if (alreadyRepaired) {
|
||||
obj->spr=ROVER_DECAL;
|
||||
} else {
|
||||
obj->spr=BASE_OBJECTS[split3]->spr;
|
||||
}
|
||||
obj->col=BASE_OBJECTS[split3]->col;
|
||||
if (BASE_OBJECTS[split3]->hasanim) {
|
||||
obj->hasAnim=true;
|
||||
@ -2040,7 +2122,7 @@ public:
|
||||
}
|
||||
|
||||
bool playerCanMove() {
|
||||
return CURRENT_CUTSCENE==cutscene::NONE&&!messageBoxVisible&&!IN_BATTLE_ENCOUNTER;
|
||||
return GAME_STATE==GAMEWORLD&&CURRENT_CUTSCENE==cutscene::NONE&&!messageBoxVisible&&!IN_BATTLE_ENCOUNTER;
|
||||
}
|
||||
|
||||
void DrawCard(WEATHER_POWER*data,vf2d offset={0,0},vf2d scale={1,1},float darknessFactor=1.0) {
|
||||
@ -2228,9 +2310,6 @@ public:
|
||||
}
|
||||
|
||||
void applyPixelEffect(ParticleEffect*effect,vf2d pos,float startingTransparency) {
|
||||
SetDrawTarget(nullptr);
|
||||
Clear(BLANK);
|
||||
SetDrawTarget(1);
|
||||
applyPixelEffect(
|
||||
{(pos.x-PLAYER_COORDS[0])*32+WIDTH/2-effect->effectSize.x/2,(pos.y-PLAYER_COORDS[1])*32+HEIGHT/2-effect->effectSize.y/2},
|
||||
effect->effectSize,
|
||||
@ -2248,9 +2327,6 @@ public:
|
||||
}
|
||||
|
||||
void applyPixelEffect(WEATHER_POWER*power,vf2d pos,float startingTransparency) {
|
||||
SetDrawTarget(nullptr);
|
||||
Clear(BLANK);
|
||||
SetDrawTarget(1);
|
||||
applyPixelEffect(
|
||||
{(pos.x-PLAYER_COORDS[0])*32+WIDTH/2-power->effect->effectSize.x/2,(pos.y-PLAYER_COORDS[1])*32+HEIGHT/2-power->effect->effectSize.y/2},
|
||||
power->effect->effectSize,
|
||||
|
Binary file not shown.
BIN
assets/ROVER.png
Normal file
BIN
assets/ROVER.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 7.7 KiB |
24
data.h
24
data.h
@ -16,6 +16,18 @@ std::string STORY_TEXT2=R"( SEASONS
|
||||
-of-
|
||||
LONELINESS)";
|
||||
|
||||
std::string STORY_TEXT3=R"(ERROR CODE -4: Transmission Failed. Unable to Retrieve Launch Data.
|
||||
|
||||
GPSNAV-17 - FAILED.
|
||||
GPSNAV-18 - UNABLE TO LOCATE
|
||||
GPSNAV-22 - UNABLE TO LOCATE
|
||||
GPSNAV-26 - UNABLE TO LOCATE
|
||||
GPSNAV-31 - UNABLE TO LOCATE
|
||||
GPSNAV-33 - UNABLE TO LOCATE
|
||||
GPSNAV-35 - UNABLE TO LOCATE
|
||||
|
||||
Press any key to continue.)";
|
||||
|
||||
std::string STORY_DIALOG[]={R"(
|
||||
???
|
||||
RAIN CYCLE COMMENCING)", //0
|
||||
@ -64,6 +76,18 @@ Silicon resources acquired!!)",//14
|
||||
R"(
|
||||
$PLAYER
|
||||
Now I can finally repair the Receiver! Better head back to the site.)",//15
|
||||
R"(
|
||||
$PLAYER
|
||||
Please let this work...)",//16
|
||||
R"(
|
||||
$PLAYER
|
||||
Perfect! Now to see if it will detect anything.)",//17
|
||||
R"(
|
||||
$PLAYER
|
||||
Huh, it still doesn't work. At least the signaling is fixed. Maybe it'll work tomorrow...)",//18
|
||||
R"(
|
||||
$PLAYER
|
||||
I'll go inside and get some rest in the meantime.)",//19
|
||||
};
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user