diff --git a/C++ProjectTemplate b/C++ProjectTemplate index e7f2760..4d8c1f8 100755 Binary files a/C++ProjectTemplate and b/C++ProjectTemplate differ diff --git a/cutscene.h b/cutscene.h index 78992b4..fc33f22 100644 --- a/cutscene.h +++ b/cutscene.h @@ -15,6 +15,7 @@ namespace CutsceneName{ TEST_CUTSCENE, TRANSFER_MAP_CUTSCENE, LOAD_FILE_CUTSCENE, + INTRO_CUTSCENE, }; } @@ -35,6 +36,7 @@ enum class ActionType{ LOAD_MAP, MOVE_PLAYER_OBJS, LOAD_FILE, + SET_FLAG, }; class CutsceneAction{ @@ -299,6 +301,22 @@ class LoadGame:public CutsceneAction{ } }; +class SetFlag:public CutsceneAction{ + protected: + Flag flag; + bool value; + public: + SetFlag(Flag flag,bool value) + :flag(flag),value(value) {} + ActionType GetActionType() override{return ActionType::SET_FLAG;} + Flag GetFlag(){ + return flag; + } + bool GetValue(){ + return value; + } +}; + /* To use this class, specify multiple actions back-to-back, filling their appropriate arguments. diff --git a/flags.h b/flags.h index d6904bb..4511f61 100644 --- a/flags.h +++ b/flags.h @@ -17,5 +17,7 @@ enum class Flag:int{ SHOPKEER_BRANCH1, SHOPKEER_BRANCH2, SHOPKEEPER_PREP_SELL_MENU, + IS_NIGHTTIME, + INTRO_COMPLETED, }; #endif \ No newline at end of file diff --git a/main.cpp b/main.cpp index 6a005c4..ba72193 100644 --- a/main.cpp +++ b/main.cpp @@ -1349,6 +1349,10 @@ void SeasonI::updateGame(){ } }break; case GameState::GAME_WORLD:{ + if (!GetGameFlag(Flag::INTRO_COMPLETED)) { + SetGameFlag(Flag::INTRO_COMPLETED,true); + StartCutscene(CUTSCENES[CutsceneName::INTRO_CUTSCENE]); + } if (PlayerCanMove()) { bool moved=false; vd2d movementComponents = {0,0}; @@ -3315,6 +3319,9 @@ void SeasonI::drawGame(){ for (int i=0;irender(this); } + if (GAME_FLAGS[(int)Flag::IS_NIGHTTIME]) { + FillRectDecal({0,0},{WIDTH,HEIGHT},Pixel(0,0,64,128)); + } FillRectDecal({0,0},{WIDTH,HEIGHT},Pixel(0,0,0,(int)CUTSCENE_FADE_VALUE)); }; @@ -3948,6 +3955,8 @@ void SeasonI::HandleCutscenes() { if (CUTSCENE_FADE_VALUE==255) { CurrentCutscene->AdvanceAction(); } + } else { + CurrentCutscene->AdvanceAction(); } }break; case ActionType::FADE_ASYNC:{ @@ -3999,6 +4008,11 @@ void SeasonI::HandleCutscenes() { GAME_STATE=GameState::GAME_WORLD; CurrentCutscene->AdvanceAction(); }break; + case ActionType::SET_FLAG:{ + SetFlag*action=(SetFlag*)CurrentCutscene->GetAction(); + SetGameFlag(action->GetFlag(),action->GetValue()); + CurrentCutscene->AdvanceAction(); + }break; } for (int i=0;i