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,
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.

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

@ -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;i<PARTICLES.size();i++) {
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));
};
@ -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<CUTSCENE_QUEUE.size();i++) {
@ -5316,6 +5330,18 @@ void SeasonI::SetupCutscenes(){
MoveCutsceneObject(1,{320,64},1),})},
{CutsceneName::TRANSFER_MAP_CUTSCENE,new MapTransitionCutscene()},
{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