generated from sigonasr2/CPlusPlusProjectTemplate
Cutscene display text sizing corrected
Co-authored-by: sigonasr2 <sigonasr2@gmail.com>
This commit is contained in:
parent
f74aa855c0
commit
d67ffa3e7f
Binary file not shown.
18
cutscene.h
18
cutscene.h
@ -37,6 +37,7 @@ enum class ActionType{
|
||||
MOVE_PLAYER_OBJS,
|
||||
LOAD_FILE,
|
||||
SET_FLAG,
|
||||
SET_CUTSCENE_DISPLAY_TEXT,
|
||||
};
|
||||
|
||||
class CutsceneAction{
|
||||
@ -317,6 +318,23 @@ class SetFlag:public CutsceneAction{
|
||||
}
|
||||
};
|
||||
|
||||
class SetCutsceneDisplayText:public CutsceneAction{
|
||||
protected:
|
||||
std::string text;
|
||||
int delay;
|
||||
public:
|
||||
//delay in frames
|
||||
SetCutsceneDisplayText(std::string text,int delay)
|
||||
:text(text),delay(delay) {}
|
||||
ActionType GetActionType() override{return ActionType::SET_CUTSCENE_DISPLAY_TEXT;}
|
||||
std::string GetCutsceneText(){
|
||||
return text;
|
||||
}
|
||||
int GetDelay() {
|
||||
return delay;
|
||||
}
|
||||
};
|
||||
|
||||
/*
|
||||
To use this class, specify multiple actions back-to-back, filling their appropriate arguments.
|
||||
|
||||
|
||||
20
main.cpp
20
main.cpp
@ -177,6 +177,8 @@ std::array<std::string,7> PARTY_MEMBER_NAMES={"PLAYER","NESS","PAULA","JEFF","AN
|
||||
std::array<SaveFileData,3> SAVE_FILE_DATA={{}};
|
||||
int CHAPTER_NUMBER=0;
|
||||
int SAVE_FILE_CURSOR=0;
|
||||
std::string CUTSCENE_DISPLAY_TEXT="";
|
||||
int CUTSCENE_DISPLAY_TEXT_DELAY_TIME=0;
|
||||
|
||||
/*
|
||||
[Choice1,Choice2,Choice3]
|
||||
@ -3323,6 +3325,10 @@ void SeasonI::drawGame(){
|
||||
FillRectDecal({0,0},{WIDTH,HEIGHT},Pixel(0,0,64,128));
|
||||
}
|
||||
FillRectDecal({0,0},{WIDTH,HEIGHT},Pixel(0,0,0,(int)CUTSCENE_FADE_VALUE));
|
||||
if (GAME_STATE==GameState::DISPLAY_CUTSCENE_TEXT) {
|
||||
vi2d textSize=GetTextSizeProp(Wrap(CUTSCENE_DISPLAY_TEXT,WIDTH,true,{2,2}))*2;
|
||||
DrawStringPropDecal(GetScreenSize()/2-textSize/2,Wrap(CUTSCENE_DISPLAY_TEXT,WIDTH,true,{2,2}),WHITE,{2,2});
|
||||
}
|
||||
};
|
||||
|
||||
ActionType SeasonI::GetCurrentCutsceneAction() {
|
||||
@ -4013,6 +4019,18 @@ void SeasonI::HandleCutscenes() {
|
||||
SetGameFlag(action->GetFlag(),action->GetValue());
|
||||
CurrentCutscene->AdvanceAction();
|
||||
}break;
|
||||
case ActionType::SET_CUTSCENE_DISPLAY_TEXT:{
|
||||
SetCutsceneDisplayText*action=(SetCutsceneDisplayText*)CurrentCutscene->GetAction();
|
||||
if (CUTSCENE_DISPLAY_TEXT_DELAY_TIME==0) {
|
||||
CUTSCENE_DISPLAY_TEXT=action->GetCutsceneText();
|
||||
CUTSCENE_DISPLAY_TEXT_DELAY_TIME=action->GetDelay();
|
||||
GAME_STATE=GameState::DISPLAY_CUTSCENE_TEXT;
|
||||
} else
|
||||
if (--CUTSCENE_DISPLAY_TEXT_DELAY_TIME==0) {
|
||||
CurrentCutscene->AdvanceAction();
|
||||
GAME_STATE=GameState::GAME_WORLD;
|
||||
}
|
||||
}break;
|
||||
}
|
||||
|
||||
for (int i=0;i<CUTSCENE_QUEUE.size();i++) {
|
||||
@ -5337,10 +5355,12 @@ void SeasonI::SetupCutscenes(){
|
||||
액션 FadeAsync(true),
|
||||
액션 PanCamera({64+128,512-128},BOTH,0.5),
|
||||
액션 Fade(),
|
||||
액션 SetCutsceneDisplayText("Eagleland...",60*5),
|
||||
액션 PanCamera({360,256},BOTH,999),
|
||||
액션 FadeAsync(true),
|
||||
액션 PanCamera({360-128,256-128},BOTH,0.5),
|
||||
액션 Fade(),
|
||||
액션 SetCutsceneDisplayText("A faraway region",60*5),
|
||||
})},
|
||||
};
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user