Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Odyssey_MenuFrontEnd extends GFxMoviePlayer
- config(UI);
- var GFxClikWidget NewButton;
- var GFxClikWidget ContinueButton;
- var GFxClikWidget ControlsButton;
- var GFxClikWidget StoryButton;
- var GFxClikWidget JournalButton;
- var GFxClikWidget CreditsButton;
- var GFxClikWidget QuitButton;
- var GFxObject StoryWalls[17];
- var GFxObject newImage;
- var GFxObject continueWind;
- var GFxObject continueEarth;
- var GFxObject continueLightning;
- var GFxObject continueFinal;
- var GFxObject windMap;
- var GFxObject earthMap;
- var GFxObject lightningMap;
- var GFxObject finalMap;
- var GFxObject compass;
- var GFxObject touchupsCounter;
- var GFxClikWidget OptionsButton;
- var GFxClikWidget OptionsBackButton;
- var GFxClikWidget ToggleInvertButton;
- var GFxObject invertedText;
- var GFxObject notInvertedText;
- var bool bContinueDisabled;
- var SoundCue ButtonChangeSoundCue;
- DefaultProperties
- {
- bEnableGammaCorrection=FALSE
- bIgnoreMouseInput = false
- bCaptureInput = true
- bContinueDisabled = false;
- // These are the button names set in the flash file
- WidgetBindings.Add( ( WidgetName = "newButton", WidgetClass = class'GFxClikWidget') );
- WidgetBindings.Add( ( WidgetName = "continueButton", WidgetClass = class'GFxClikWidget') );
- WidgetBindings.Add( ( WidgetName = "controlsButton", WidgetClass = class'GFxClikWidget') );
- WidgetBindings.Add( ( WidgetName = "journalButton", WidgetClass = class'GFxClikWidget') );
- WidgetBindings.Add( ( WidgetName = "storyButton", WidgetClass = class'GFxClikWidget') );
- WidgetBindings.Add( ( WidgetName = "creditsButton", WidgetClass = class'GFxClikWidget') );
- WidgetBindings.Add( ( WidgetName = "quitButton", WidgetClass = class'GFxClikWidget') );
- WidgetBindings.Add( ( WidgetName = "optionsButton", WidgetClass = class'GFxClikWidget') );
- WidgetBindings.Add( ( WidgetName = "optionsBackButton", WidgetClass = class'GFxClikWidget') );
- WidgetBindings.Add( ( WidgetName = "toggleInvertButton", WidgetClass = class'GFxClikWidget') );
- ButtonChangeSoundCue = SoundCue'Common_EnvSounds_Odyssey.Sounds.BalOdyssey_PageTurn_Cue';
- }
- function Init(optional LocalPlayer PC )
- {
- //Start and load the SWF Movie
- super.Start();
- Advance(0.f);
- super.Init(PC);
- }
- event bool WidgetInitialized( name WidgetName, name WidgetPath, GFxObject Widget )
- {
- local int i;
- local Odyssey_SaveGameState SGS;
- switch( WidgetName )
- {
- case ('newButton'):
- if( NewButton == none )
- {
- NewButton=GFxClikWidget( Widget );
- NewButton.AddEventListener( 'CLIK_press', NewButtonFunction );
- NewButton.AddEventListener( 'CLIK_rollOver', NewButtonRollOver );
- NewButton.AddEventListener( 'CLIK_focusIn', HideOptionsMenu );
- NewButton.AddEventListener( 'CLIK_focusIn', PlayPageFlipSound );
- SGS = new () class'Odyssey_SaveGameState';
- class'Engine'.static.BasicLoadObject(SGS, "..\\..\\..\\Saves\\SaveGameState\\odysseysave2.bin", true, 1);
- if((SGS.currentLevel == Wind && SGS.bLevelStart == true)
- ||
- (SGS.currentLevel == Mother && SGS.CheckpointInt == 50))
- {
- NewButton.SetBool("focused", true);
- }
- return true;
- }
- break;
- case ('continueButton'):
- if( ContinueButton == none )
- {
- ContinueButton=GFxClikWidget( Widget );
- ContinueButton.AddEventListener( 'CLIK_press', ContinueButtonFunction );
- ContinueButton.AddEventListener( 'CLIK_focusIn', ContinueButtonShow );
- ContinueButton.AddEventListener( 'CLIK_focusOut', ContinueButtonHide );
- ContinueButton.AddEventListener( 'CLIK_rollOver', ContinueButtonRollOver );
- ContinueButton.AddEventListener( 'CLIK_focusIn', HideOptionsMenu );
- ContinueButton.AddEventListener( 'CLIK_focusIn', PlayPageFlipSound );
- newImage = getVariableObject("_root.newImage");
- continueWind = getVariableObject("_root.continueWind");
- continueEarth = getVariableObject("_root.continueEarth");
- continueLightning = getVariableObject("_root.continueLightning");
- continueFinal = getVariableObject("_root.continueFinal");
- SGS = new () class'Odyssey_SaveGameState';
- class'Engine'.static.BasicLoadObject(SGS, "..\\..\\..\\Saves\\SaveGameState\\odysseysave2.bin", true, 1);
- if((SGS.currentLevel == Wind && SGS.bLevelStart == true)
- ||
- (SGS.currentLevel == Mother && SGS.CheckpointInt == 50))
- {
- ContinueButton.SetBool("disabled", true);
- bContinueDisabled = true;
- }
- else
- {
- ContinueButton.SetBool("focused", true);
- }
- return true;
- }
- break;
- case ('storyButton'):
- if( StoryButton == none )
- {
- StoryButton=GFxClikWidget( Widget );
- StoryButton.AddEventListener( 'CLIK_focusIn', StoryButtonShow );
- StoryButton.AddEventListener( 'CLIK_focusOut', StoryButtonHide );
- StoryButton.AddEventListener( 'CLIK_rollOver', StoryButtonRollOver );
- StoryButton.AddEventListener( 'CLIK_focusIn', HideOptionsMenu );
- StoryButton.AddEventListener( 'CLIK_focusIn', PlayPageFlipSound );
- for(i = 0; i < 17; i++)
- {
- StoryWalls[i] = GetVariableObject("_root.story"$i );
- }
- return true;
- }
- break;
- case ('journalButton'):
- if( JournalButton == none )
- {
- JournalButton=GFxClikWidget( Widget );
- JournalButton.AddEventListener( 'CLIK_focusIn', JournalButtonShow );
- JournalButton.AddEventListener( 'CLIK_focusOut', JournalButtonHide );
- JournalButton.AddEventListener( 'CLIK_rollOver', JournalButtonRollOver );
- JournalButton.AddEventListener( 'CLIK_focusIn', HideOptionsMenu );
- JournalButton.AddEventListener( 'CLIK_focusIn', PlayPageFlipSound );
- windMap = GetVariableObject("_root.windMap");
- earthMap = GetVariableObject("_root.earthMap");
- lightningMap = GetVariableObject("_root.lightningMap");
- finalMap = GetVariableObject("_root.finalMap");
- compass = GetVariableObject("_root.compass");
- touchupsCounter = GetVariableObject("_root.touchupsCounter");
- return true;
- }
- break;
- //Handled in ActionScript
- case ('controlsButton'):
- if( ControlsButton == none )
- {
- ControlsButton=GFxClikWidget( Widget );
- ControlsButton.AddEventListener( 'CLIK_rollOver', ControlsButtonRollOver );
- ControlsButton.AddEventListener( 'CLIK_focusIn', HideOptionsMenu );
- ControlsButton.AddEventListener( 'CLIK_focusIn', PlayPageFlipSound );
- return true;
- }
- break;
- case ('creditsButton'):
- if( CreditsButton == none )
- {
- CreditsButton=GFxClikWidget( Widget );
- CreditsButton.AddEventListener( 'CLIK_rollOver', CreditsButtonRollOver );
- CreditsButton.AddEventListener( 'CLIK_focusIn', HideOptionsMenu );
- CreditsButton.AddEventListener( 'CLIK_focusIn', PlayPageFlipSound );
- return true;
- }
- break;
- case ('quitButton'):
- if( QuitButton == none )
- {
- QuitButton=GFxClikWidget( Widget );
- QuitButton.AddEventListener( 'CLIK_press', QuitButtonFunction );
- QuitButton.AddEventListener( 'CLIK_rollOver', QuitButtonRollOver );
- QuitButton.AddEventListener( 'CLIK_focusIn', HideOptionsMenu );
- QuitButton.AddEventListener( 'CLIK_focusIn', PlayPageFlipSound );
- return true;
- }
- break;
- case('optionsButton'):
- if( OptionsButton == none )
- {
- OptionsButton=GFxClikWidget( Widget );
- OptionsButton.AddEventListener( 'CLIK_press', OptionsButtonFunction );
- OptionsButton.AddEventListener( 'CLIK_rollOver', OptionsButtonRollOver );
- OptionsButton.AddEventListener( 'CLIK_focusIn', OptionsButtonFocusIn);
- OptionsButton.AddEventListener( 'CLIK_focusOut', OptionsButtonFocusOut);
- OptionsButton.AddEventListener( 'CLIK_focusIn', PlayPageFlipSound );
- }
- break;
- case('optionsBackButton'):
- if( OptionsBackButton == none )
- {
- OptionsBackButton=GFxClikWidget( Widget );
- OptionsBackButton.AddEventListener( 'CLIK_press', OptionsBackButtonFunction );
- OptionsBackButton.AddEventListener( 'CLIK_rollOver', OptionsBackButtonRollOver );
- OptionsBackButton.AddEventListener( 'CLIK_focusIn', PlayPageFlipSound );
- OptionsBackButton.setVisible(false);
- }
- break;
- case('toggleInvertButton'):
- if( ToggleInvertButton == none )
- {
- ToggleInvertButton=GFxClikWidget( Widget );
- ToggleInvertButton.AddEventListener( 'CLIK_press', ToggleInvertButtonFunction );
- ToggleInvertButton.AddEventListener( 'CLIK_rollOver', ToggleInvertButtonRollOver );
- ToggleInvertButton.AddEventListener( 'CLIK_focusIn', PlayPageFlipSound );
- invertedText = getVariableObject("_root.invertedText");
- notInvertedText = getVariableObject("_root.notInvertedText");
- }
- break;
- }
- return true;
- }
- // These functions are referred to by the WidgetInitialized() function
- function NewButtonFunction( GFxClikWidget.EventData ev )
- {
- local Odyssey_SaveGameState SGS;
- local Odyssey_PlayerController OPC;
- SGS = new () class'Odyssey_SaveGameState';
- OPC = Odyssey_PlayerController(GetPC());
- OPC.SaveGameState = SGS;
- OPC.SaveGame(SGS);
- OPC.ConsoleCommand("open OdyJadeJournalCinematic");
- }
- function NewButtonRollOver( GFxClikWidget.EventData ev )
- {
- NewButton.SetBool("focused", true);
- }
- function ContinueButtonRollOver( GFxClikWidget.EventData ev )
- {
- ContinueButton.SetBool("focused", true);
- }
- function StoryButtonRollOver( GFxClikWidget.EventData ev )
- {
- StoryButton.SetBool("focused", true);
- }
- function JournalButtonRollOver( GFxClikWidget.EventData ev )
- {
- JournalButton.SetBool("focused", true);
- }
- function ControlsButtonRollOver( GFxClikWidget.EventData ev )
- {
- ControlsButton.SetBool("focused", true);
- }
- function CreditsButtonRollOver( GFxClikWidget.EventData ev )
- {
- CreditsButton.SetBool("focused", true);
- }
- function QuitButtonRollOver( GFxClikWidget.EventData ev )
- {
- QuitButton.SetBool("focused", true);
- }
- function ContinueButtonShow( GFxClikWidget.EventData ev )
- {
- local Odyssey_SaveGameState SGS;
- SGS = new () class'Odyssey_SaveGameState';
- class'Engine'.static.BasicLoadObject(SGS, "..\\..\\..\\Saves\\SaveGameState\\odysseysave2.bin", true, 1);
- if(SGS.currentLevel == Wind && SGS.bLevelStart == true)
- {
- newImage.setVisible(true);
- }
- else
- {
- switch(SGS.currentLevel)
- {
- case Wind:
- continueWind.setVisible(true);
- break;
- case Earth:
- continueEarth.setVisible(true);
- break;
- case Lightning:
- continueLightning.setVisible(true);
- break;
- case Mother:
- continueFinal.setVisible(true);
- break;
- }
- }
- }
- function ContinueButtonHide( GFxClikWidget.EventData ev )
- {
- newImage.setVisible(false);
- continueWind.setVisible(false);
- continueEarth.setVisible(false);
- continueLightning.setVisible(false);
- continueFinal.setVisible(false);
- }
- function ContinueButtonFunction( GFxClikWidget.EventData ev )
- {
- local Odyssey_SaveGameState SGS;
- local Odyssey_PlayerController OPC;
- SGS = new () class'Odyssey_SaveGameState';
- OPC = Odyssey_PlayerController(GetPC());
- if( class'Engine'.static.BasicLoadObject(SGS, "..\\..\\..\\Saves\\SaveGameState\\odysseysave2.bin", true, 1) )
- {
- if(SGS.currentLevel == Wind)
- {
- OPC.ConsoleCommand("open Wind_P");
- return;
- }
- else if(SGS.currentLevel == Earth)
- {
- OPC.ConsoleCommand("open Earth_P");
- return;
- }
- else if(SGS.currentLevel == Lightning)
- {
- OPC.ConsoleCommand("open Lightning_P");
- return;
- }
- else if(SGS.currentLevel == Mother)
- {
- OPC.ConsoleCommand("open Mother_P");
- return;
- }
- }
- }
- //exit
- function QuitButtonFunction( GFxClikWidget.EventData ev )
- {
- local Odyssey_PlayerController OPC;
- OPC = Odyssey_PlayerController(GetPC());
- OPC.ConsoleCommand("exit");
- }
- function StoryButtonShow( GFxClikWidget.EventData ev )
- {
- //get number of storywalls, hide/show data appropriately
- local Odyssey_SaveGameState SGS;
- local int i;
- StoryWalls[0].setVisible(true);
- SGS = new () class'Odyssey_SaveGameState';
- if( class'Engine'.static.BasicLoadObject(SGS, "..\\..\\..\\Saves\\SaveGameState\\odysseysave2.bin", true, 1) )
- {
- for(i = 0; i < 4; ++i)
- {
- if(SGS.WindSW[i] > 0) //1-4
- StoryWalls[i + 1].setVisible(true);
- if(SGS.EarthSW[i] > 0) //5-8
- StoryWalls[i + 5].setVisible(true);
- if(SGS.LightSW[i] > 0) //9-12
- StoryWalls[i + 9].setVisible(true);
- if(SGS.MotherSW[i] > 0) //13-16
- StoryWalls[i + 13].setVisible(true);
- }
- if(SGS.currentLevel == Mother && SGS.CheckpointInt == 50)
- {
- StoryWalls[16].setVisible(true);
- }
- }
- }
- function StoryButtonHide( GFxClikWidget.EventData ev )
- {
- local int i;
- for(i = 0; i < 17; ++i)
- StoryWalls[i].setVisible(false);
- }
- function JournalButtonShow( GFxClikWidget.EventData ev )
- {
- local int i;
- local int j;
- local Odyssey_SaveGameState SGS;
- SGS = new () class'Odyssey_SaveGameState';
- class'Engine'.static.BasicLoadObject(SGS, "..\\..\\..\\Saves\\SaveGameState\\odysseysave2.bin", true, 1);
- j = 0;
- for(i = 0; i < 11; ++i)
- {
- if(SGS.earthMap[i] > 0)
- ++j;
- if(SGS.WindMap[i] > 0)
- ++j;
- if(SGS.LightMap[i] > 0)
- ++j;
- }
- for(i = 0; i < 14; ++i)
- {
- if(SGS.MotherMap[i] > 0)
- ++j;
- }
- touchupsCounter.SetText(j $ "/ 32");
- if(SGS.currentLevel >= Wind)
- windMap.setVisible(true);
- if(SGS.currentLevel >= Earth)
- earthMap.setVisible(true);
- if(SGS.currentLevel >= Lightning)
- lightningMap.setVisible(true);
- if(SGS.currentLevel >= Mother)
- finalMap.setVisible(true);
- compass.setVisible(true);
- touchupsCounter.setVisible(true);
- }
- function JournalButtonHide( GFxClikWidget.EventData ev )
- {
- windMap.setVisible(false);
- earthMap.setVisible(false);
- lightningMap.setVisible(false);
- finalMap.setVisible(false);
- compass.setVisible(false);
- touchupsCounter.setVisible(false);
- }
- function OptionsButtonFunction( GFxClikWidget.EventData ev )
- {
- local Odyssey_PlayerController OPC;
- //disable all buttons on the side, enable toggle and back button
- NewButton.setBool("disabled", true);
- ContinueButton.setBool("disabled", true);
- ControlsButton.setBool("disabled", true);
- StoryButton.setBool("disabled", true);
- JournalButton.setBool("disabled", true);
- CreditsButton.setBool("disabled", true);
- QuitButton.setBool("disabled", true);
- OptionsButton.setBool("disabled", true);
- ToggleInvertButton.setBool("disabled", false);
- OptionsBackButton.setBool("disabled", false);
- ToggleInvertButton.setVisible(true);
- OptionsBackButton.setVisible(true);
- ToggleInvertButton.setBool("focused", true);
- OPC = Odyssey_PlayerController(GetPC());
- //show/hide text as appropriate
- if(OPC.PlayerInput.bInvertMouse)
- {
- invertedText.setVisible(true);
- notInvertedText.setVisible(false);
- }
- else
- {
- invertedText.setVisible(false);
- notInvertedText.setVisible(true);
- }
- }
- function OptionsButtonRollOver( GFxClikWidget.EventData ev )
- {
- OptionsButton.SetBool("focused", true);
- //options menu displayed, not selectable yet
- //show/hide of options menu on rollover/out handled in actionscript
- }
- function OptionsButtonFocusIn( GFxClikWidget.EventData ev )
- {
- local Odyssey_PlayerController OPC;
- OptionsBackButton.SetBool("visible", true);
- ToggleInvertButton.SetBool("visible", true);
- OptionsBackButton.SetBool("disabled", true);
- ToggleInvertButton.SetBool("disabled", true);
- OPC = Odyssey_PlayerController(GetPC());
- //show/hide text as appropriate
- if(OPC.PlayerInput.bInvertMouse)
- {
- invertedText.setVisible(true);
- notInvertedText.setVisible(false);
- }
- else
- {
- invertedText.setVisible(false);
- notInvertedText.setVisible(true);
- }
- }
- function OptionsButtonFocusOut( GFxClikWidget.EventData ev )
- {
- invertedText.setVisible(false);
- notInvertedText.setVisible(false);
- }
- function OptionsBackButtonFunction( GFxClikWidget.EventData ev )
- {
- //re-enable all buttons on side, disable toggle and back button
- NewButton.setBool("disabled", false);
- if(!bContinueDisabled) ContinueButton.setBool("disabled", false);
- ControlsButton.setBool("disabled", false);
- StoryButton.setBool("disabled", false);
- JournalButton.setBool("disabled", false);
- CreditsButton.setBool("disabled", false);
- QuitButton.setBool("disabled", false);
- OptionsButton.setBool("disabled", false);
- ToggleInvertButton.setBool("disabled", true);
- OptionsBackButton.setBool("disabled", true);
- OptionsButton.SetBool("focused", true);
- }
- function OptionsBackButtonRollOver( GFxClikWidget.EventData ev )
- {
- OptionsBackButton.SetBool("focused", true);
- }
- function ToggleInvertButtonRollOver( GFxClikWidget.EventData ev )
- {
- ToggleInvertButton.SetBool("focused", true);
- }
- function HideOptionsMenu( GFxClikWidget.EventData ev )
- {
- if(OptionsBackButton != None) OptionsBackButton.SetBool("visible", false);
- if(ToggleInvertButton != None) ToggleInvertButton.SetBool("visible", false);
- if(invertedText != None) invertedText.setVisible(false);
- if(notInvertedText != None) notInvertedText.setVisible(false);
- }
- function ToggleInvertButtonFunction( GFxClikWidget.EventData ev )
- {
- local Odyssey_PlayerController OPC;
- OPC = Odyssey_PlayerController(GetPC());
- OPC.ConsoleCommand("invertmouse");
- //show/hide text as appropriate
- if(OPC.PlayerInput.bInvertMouse)
- {
- invertedText.setVisible(true);
- notInvertedText.setVisible(false);
- }
- else
- {
- invertedText.setVisible(false);
- notInvertedText.setVisible(true);
- }
- }
- function PlayPageFlipSound( GFxClikWidget.EventData ev )
- {
- GetPC().Pawn.PlaySound(ButtonChangeSoundCue, true);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement