Intro cutscene layout flags

Co-authored-by: sigonasr2 <sigonasr2@gmail.com>
master
sigonasr2 2 years ago
parent 1fd6c6507c
commit f74aa855c0
  1. BIN
      C++ProjectTemplate
  2. 18
      cutscene.h
  3. 2
      flags.h
  4. 26
      main.cpp

Binary file not shown.

@ -15,6 +15,7 @@ namespace CutsceneName{
TEST_CUTSCENE, TEST_CUTSCENE,
TRANSFER_MAP_CUTSCENE, TRANSFER_MAP_CUTSCENE,
LOAD_FILE_CUTSCENE, LOAD_FILE_CUTSCENE,
INTRO_CUTSCENE,
}; };
} }
@ -35,6 +36,7 @@ enum class ActionType{
LOAD_MAP, LOAD_MAP,
MOVE_PLAYER_OBJS, MOVE_PLAYER_OBJS,
LOAD_FILE, LOAD_FILE,
SET_FLAG,
}; };
class CutsceneAction{ 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. To use this class, specify multiple actions back-to-back, filling their appropriate arguments.

@ -17,5 +17,7 @@ enum class Flag:int{
SHOPKEER_BRANCH1, SHOPKEER_BRANCH1,
SHOPKEER_BRANCH2, SHOPKEER_BRANCH2,
SHOPKEEPER_PREP_SELL_MENU, SHOPKEEPER_PREP_SELL_MENU,
IS_NIGHTTIME,
INTRO_COMPLETED,
}; };
#endif #endif

@ -1349,6 +1349,10 @@ void SeasonI::updateGame(){
} }
}break; }break;
case GameState::GAME_WORLD:{ case GameState::GAME_WORLD:{
if (!GetGameFlag(Flag::INTRO_COMPLETED)) {
SetGameFlag(Flag::INTRO_COMPLETED,true);
StartCutscene(CUTSCENES[CutsceneName::INTRO_CUTSCENE]);
}
if (PlayerCanMove()) { if (PlayerCanMove()) {
bool moved=false; bool moved=false;
vd2d movementComponents = {0,0}; vd2d movementComponents = {0,0};
@ -3315,6 +3319,9 @@ void SeasonI::drawGame(){
for (int i=0;i<PARTICLES.size();i++) { for (int i=0;i<PARTICLES.size();i++) {
PARTICLES[i]->render(this); PARTICLES[i]->render(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)); 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) { if (CUTSCENE_FADE_VALUE==255) {
CurrentCutscene->AdvanceAction(); CurrentCutscene->AdvanceAction();
} }
} else {
CurrentCutscene->AdvanceAction();
} }
}break; }break;
case ActionType::FADE_ASYNC:{ case ActionType::FADE_ASYNC:{
@ -3999,6 +4008,11 @@ void SeasonI::HandleCutscenes() {
GAME_STATE=GameState::GAME_WORLD; GAME_STATE=GameState::GAME_WORLD;
CurrentCutscene->AdvanceAction(); CurrentCutscene->AdvanceAction();
}break; }break;
case ActionType::SET_FLAG:{
SetFlag*action=(SetFlag*)CurrentCutscene->GetAction();
SetGameFlag(action->GetFlag(),action->GetValue());
CurrentCutscene->AdvanceAction();
}break;
} }
for (int i=0;i<CUTSCENE_QUEUE.size();i++) { for (int i=0;i<CUTSCENE_QUEUE.size();i++) {
@ -5316,6 +5330,18 @@ void SeasonI::SetupCutscenes(){
MoveCutsceneObject(1,{320,64},1),})}, MoveCutsceneObject(1,{320,64},1),})},
{CutsceneName::TRANSFER_MAP_CUTSCENE,new MapTransitionCutscene()}, {CutsceneName::TRANSFER_MAP_CUTSCENE,new MapTransitionCutscene()},
{CutsceneName::LOAD_FILE_CUTSCENE,new LoadFileCutscene()}, {CutsceneName::LOAD_FILE_CUTSCENE,new LoadFileCutscene()},
{CutsceneName::INTRO_CUTSCENE,new Cutscene({
Fade(),
SetFlag(Flag::IS_NIGHTTIME,true),
PanCamera({64,512},BOTH,999),
FadeAsync(true),
PanCamera({64+128,512-128},BOTH,0.5),
Fade(),
PanCamera({360,256},BOTH,999),
FadeAsync(true),
PanCamera({360-128,256-128},BOTH,0.5),
Fade(),
})},
}; };
} }

Loading…
Cancel
Save