Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //From my Amnesia Rebirth Tutorial Series
- //Episode 48 Main Menus Pt.3! Full Intro!
- //https://www.youtube.com/playlist?list=PL4KkjlmOwLwwMVqedCNpi6caUxhgyf8Qr
- //-----------------------------------------------------------
- //Entire main_menu.hps code below
- #include "interfaces/Map_Interface.hps"
- #include "helpers/helper_imgui.hps"
- #include "helpers/helper_map.hps"
- #include "helpers/helper_game.hps"
- #include "helpers/helper_audio.hps"
- #include "helpers/helper_effects.hps"
- #include "helpers/helper_player.hps"
- #include "inputhandler_types.hps"
- #include "helpers/helper_imgui_options.hps"
- #include "custom/helpers/helper_menu.hps"
- class cScrMap : iScrMap
- {
- [volatile] cConfigFile@ mpConfig;
- void Setup()
- {
- @mpConfig = cLux_GetUserConfig();
- mpConfig.SetBool("Main", "IntroPlayed", mpConfig.GetBool("Main", "IntroPlayed", false));
- mpConfig.Save();
- Effect_Fade_Out(0);
- }
- bool showIntroMessage1 = false;
- bool showIntroMessage2 = false;
- bool showIntroMessage3 = false;
- void OnGui(float afTimeStep){
- introMessage1();
- introMessage2();
- introMessage3();
- }
- void PreloadData()
- {
- }
- void OnStart()
- {
- if(cLux_ScriptDebugOn())
- {
- }
- }
- void OnEnter()
- {
- PauseMenu_Enabled(false);
- Player_ShowCrossHairIcons(false);
- Music_Play("amb1.ogg", 1.0f, true, eMusicPrio_BgAmb);
- if(mpConfig.GetBool("Main", "IntroPlayed", false)){
- //Intro has already played
- Effect_Fade_In(1);
- CameraAnimation_Begin("NoCameraAnimation", "", false);
- MainMenu_Show(true);
- }else{
- //Intro hasn't played
- showIntroMessage1 = true;
- Map_AddTimer("Timer_StartCameras", 3.0f, "OnTimer_StartCameras");
- }
- }
- int stage = 1;
- void OnTimer_StartCameras(const tString &in asTimer){
- if(stage == 1){
- Effect_Fade_In(1);
- CameraAnimation_Begin("IntroAnimation1", "", false);
- }else if(stage == 2){
- Effect_Fade_In(1);
- CameraAnimation_End();
- CameraAnimation_Begin("IntroAnimation2", "", false);
- }else if(stage == 3){
- Effect_Fade_In(1);
- CameraAnimation_End();
- CameraAnimation_Begin("CameraAnimation", "", false);
- }
- }
- void OnLeave()
- {
- Player_ShowCrossHairIcons(true);
- Music_Stop(3.0f, eMusicPrio_BgAmb);
- }
- bool IntroAnimation1_2_CameraNodePassed(const tString &in asEntity, int alDirection)
- {
- Effect_Fade_Out(0.5f);
- showIntroMessage2 = true;
- stage = 2;
- Map_AddTimer("Timer_StartCameras", 3.0f, "OnTimer_StartCameras");
- return true;
- }
- bool IntroAnimation2_2_CameraNodePassed(const tString &in asEntity, int alDirection)
- {
- Effect_Fade_Out(0.5f);
- showIntroMessage3 = true;
- stage = 3;
- Map_AddTimer("Timer_StartCameras", 3.0f, "OnTimer_StartCameras");
- return true;
- }
- bool OnAnimatonEnd(const tString &in asEntity, int alDirection)
- {
- MainMenu_Show(true);
- mpConfig.SetBool("Main", "IntroPlayed", true);
- mpConfig.Save();
- return true;
- }
- ///////////////////////////////
- //Messages
- ///////////////////////////////
- void introMessage1(){
- if(showIntroMessage1){
- float messageFadeTime = 2.0f;
- cImGuiLabelData label;
- label.mFontAlign = eFontAlign_Center;
- label.mFont.mvSize = cVector2f(50,50);
- label.mColorBase = ImGui_FadeOscillateColor("label1", cColor(1,1,1,0), cColor(1,1,1,1), messageFadeTime, eEasing_Linear);
- ImGui_SetTransCategory("Messages");
- ImGui_DoLabelExt("IntroMessage_1", label, ImGui_NrmPos(0,0,10), ImGui_NrmSize(1,1));
- if(label.mColorBase.a == 0) showIntroMessage1 = false;
- }
- }
- void introMessage2(){
- if(showIntroMessage2){
- float messageFadeTime = 2.0f;
- cImGuiLabelData label;
- label.mFontAlign = eFontAlign_Center;
- label.mFont.mvSize = cVector2f(50,50);
- label.mColorBase = ImGui_FadeOscillateColor("label2", cColor(1,1,1,0), cColor(1,1,1,1), messageFadeTime, eEasing_Linear);
- ImGui_SetTransCategory("Messages");
- ImGui_DoLabelExt("IntroMessage_2", label, ImGui_NrmPos(0,0,10), ImGui_NrmSize(1,1));
- if(label.mColorBase.a == 0) showIntroMessage2 = false;
- }
- }
- void introMessage3(){
- if(showIntroMessage3){
- float messageFadeTime = 2.0f;
- cImGuiLabelData label;
- label.mFontAlign = eFontAlign_Center;
- label.mFont.mvSize = cVector2f(50,50);
- label.mColorBase = ImGui_FadeOscillateColor("label3", cColor(1,1,1,0), cColor(1,1,1,1), messageFadeTime, eEasing_Linear);
- ImGui_SetTransCategory("Messages");
- ImGui_DoLabelExt("IntroMessage_3", label, ImGui_NrmPos(0,0,10), ImGui_NrmSize(1,1));
- if(label.mColorBase.a == 0) showIntroMessage3 = false;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment