|
|
|
@ -48,7 +48,7 @@ public: |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public: |
|
|
|
|
GAMESTATE GAME_STATE=GAMEWORLD; |
|
|
|
|
GAMESTATE GAME_STATE=CUTSCENE_1; |
|
|
|
|
int textInd=0; |
|
|
|
|
int cursorX=0; |
|
|
|
|
int transitionTime=0; |
|
|
|
@ -68,10 +68,13 @@ public: |
|
|
|
|
CUTSCENE CURRENT_CUTSCENE=PAN_DOME; |
|
|
|
|
int CUTSCENE_TIMER=0; |
|
|
|
|
bool CUTSCENE_FLAGS[8]; |
|
|
|
|
bool messageBoxVisible; |
|
|
|
|
bool messageBoxVisible=false; |
|
|
|
|
int messageBoxCursor; |
|
|
|
|
std::string messageBoxSpeaker; |
|
|
|
|
std::string messageBoxText; |
|
|
|
|
std::string messageBoxRefText; |
|
|
|
|
bool firstNewline=false; |
|
|
|
|
bool secondNewline=false; |
|
|
|
|
|
|
|
|
|
olc::Decal*DOME_DECAL; |
|
|
|
|
std::map<std::string,olc::Decal*> BASE_OBJECTS; |
|
|
|
@ -140,7 +143,7 @@ public: |
|
|
|
|
TILES=new olc::Decal(new olc::Sprite("assets/tiles.png")); |
|
|
|
|
DOME_DECAL=new olc::Decal(new olc::Sprite("assets/dome.png")); |
|
|
|
|
BASE_OBJECTS["DOME"]=DOME_DECAL; |
|
|
|
|
LoadMap("assets/maps/map2"); |
|
|
|
|
LoadMap("assets/maps/map1"); |
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -188,6 +191,7 @@ public: |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void PlayCutscene(CUTSCENE scene) { |
|
|
|
|
CURRENT_CUTSCENE=scene; |
|
|
|
|
switch (scene) { |
|
|
|
|
case PAN_DOME:{ |
|
|
|
|
PLAYER_COORDS[0]=14; |
|
|
|
@ -227,7 +231,40 @@ public: |
|
|
|
|
fadeInCompleted(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (messageBoxVisible) { |
|
|
|
|
if (frameCount%MESSAGE_SCROLL_WAIT_SPD==0) { |
|
|
|
|
if (messageBoxCursor<messageBoxRefText.length()) { |
|
|
|
|
char c = messageBoxRefText[messageBoxCursor++]; |
|
|
|
|
printf("%c",c); |
|
|
|
|
if (c=='\n') { |
|
|
|
|
if (!firstNewline) { |
|
|
|
|
firstNewline=true; |
|
|
|
|
goto next; |
|
|
|
|
} else if (!secondNewline) { |
|
|
|
|
secondNewline=true; |
|
|
|
|
goto next; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if (firstNewline&&!secondNewline) { |
|
|
|
|
messageBoxSpeaker+=c; |
|
|
|
|
goto next; |
|
|
|
|
} |
|
|
|
|
messageBoxText+=c; |
|
|
|
|
if (GetTextSizeProp(messageBoxText).x>WIDTH-16) { |
|
|
|
|
int tempIndex=messageBoxCursor; |
|
|
|
|
while (messageBoxText[--tempIndex]!=' ') { |
|
|
|
|
messageBoxText.erase(tempIndex); |
|
|
|
|
} |
|
|
|
|
messageBoxText.erase(tempIndex++); |
|
|
|
|
messageBoxText+='\n'; |
|
|
|
|
while (tempIndex<messageBoxCursor) { |
|
|
|
|
messageBoxText+=messageBoxRefText[tempIndex++]; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
next: |
|
|
|
|
if (GetKey(olc::F1).bPressed) { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -246,6 +283,17 @@ public: |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
switch (CURRENT_CUTSCENE) { |
|
|
|
|
case CUTSCENE_4:{ |
|
|
|
|
if (!messageBoxVisible) { |
|
|
|
|
if (!CUTSCENE_FLAGS[0]) { |
|
|
|
|
CUTSCENE_FLAGS[0]=true; |
|
|
|
|
DisplayMessageBox(0); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}break; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
switch (GAME_STATE) { |
|
|
|
|
case CUTSCENE_1: |
|
|
|
|
case CUTSCENE_3:{ |
|
|
|
@ -337,6 +385,12 @@ public: |
|
|
|
|
GradientFillRectDecal({WIDTH/2,HEIGHT/2},{WIDTH/2,HEIGHT/2},{100, 10, 255,ALPHA_SCREEN2},{100, 10, 255,ALPHA_SCREEN1},{100, 10, 255,ALPHA_SCREEN1},{100, 10, 255,ALPHA_SCREEN1}); |
|
|
|
|
}break; |
|
|
|
|
} |
|
|
|
|
if (messageBoxVisible) { |
|
|
|
|
DrawDialogBox({4,HEIGHT-60},{WIDTH/3,16},olc::Pixel(18, 0, 33,180)); |
|
|
|
|
DrawDialogBox({0,HEIGHT-48},{WIDTH,48},olc::Pixel(18, 0, 33,180)); |
|
|
|
|
DrawStringPropDecal({8,HEIGHT-40},messageBoxText); |
|
|
|
|
DrawStringPropDecal({8,HEIGHT-57},messageBoxSpeaker); |
|
|
|
|
} |
|
|
|
|
FillRectDecal({0,0},{WIDTH,HEIGHT},olc::Pixel(0,0,0,transparency)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -353,6 +407,17 @@ public: |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
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) { |
|
|
|
|
FillRectDecal({pos.x,pos.y},size,p2); |
|
|
|
|
FillRectDecal({pos.x+1,pos.y+1},{size.x-2,size.y-2},p); |
|
|
|
|
FillRectDecal({pos.x+2,pos.y+2},{size.x-4,size.y-4},p3); |
|
|
|
|
FillRectDecal({pos.x+3,pos.y+3},{size.x-5,size.y-5},p); |
|
|
|
|
Draw({pos.x,pos.y},olc::BLACK); |
|
|
|
|
Draw({pos.x+size.x,pos.y+size.y},olc::BLACK); |
|
|
|
|
Draw({pos.x+size.x,pos.y},olc::BLACK); |
|
|
|
|
Draw({pos.x,pos.y+size.y},olc::BLACK); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void fadeOut() { |
|
|
|
|
fade=true; |
|
|
|
|
} |
|
|
|
@ -364,6 +429,7 @@ public: |
|
|
|
|
messageBoxCursor=0; |
|
|
|
|
messageBoxSpeaker=""; |
|
|
|
|
messageBoxText=""; |
|
|
|
|
messageBoxRefText=STORY_DIALOG[dialogNumber]; |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|