Advertisement
Guest User

Untitled

a guest
Oct 16th, 2015
196
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 66.04 KB | None | 0 0
  1. #include "interfaces/Map_Interface.hps"
  2. #include "base/Inputhandler_Types.hps"
  3. #include "base/AchievementHandler_Types.hps"
  4.  
  5. #include "helpers/helper_game.hps"
  6. #include "helpers/helper_areas.hps"
  7. #include "helpers/helper_effects.hps"
  8. #include "helpers/helper_map.hps"
  9. #include "helpers/helper_sequences.hps"
  10. #include "helpers/helper_player.hps"
  11. #include "helper_imgui_cath_portrait.hps"
  12.  
  13. #include "helper_custom_depth.hps"
  14. #include "helper_custom_depth_ai.hps"
  15. #include "helper_custom_depth_ai_fleshers.hps"
  16. #include "helper_custom_depth_ai_kate.hps"
  17. #include "helper_custom_depth_ai_leviathan.hps"
  18. #include "helper_custom_depth_ai_puppet.hps"
  19.  
  20. //--------------------------------------------------
  21.  
  22. //------------------------------------------------------------
  23.  
  24. /////////////////////////////////////////
  25. // SETTINGS
  26. /////////////////////////////////////////
  27.  
  28. //------------------------------------------------------------
  29.  
  30. //Ambient music player
  31. const tString gsThetaExtMusicStage1 = "02_04_outside_theta";
  32.  
  33. //------------------------------------------------------------
  34.  
  35. class cScrMap : iScrMap
  36. {
  37. //--------------------------------------------
  38.  
  39. /////////////////////////////////////////
  40. // ==============
  41. // MAIN CALLBACKS
  42. // ==============
  43. /////////////////////////////////////////
  44.  
  45. //-------------------------------------------------------
  46.  
  47. ////////////////////////////
  48. // Preload
  49. void PreloadData()
  50. {
  51. // Gui
  52. OmnitoolGui_Preload();
  53.  
  54. ImGui_PreloadImage("zepmap", eImGuiGfx_Texture);
  55. ImGui_PreloadImage("zepcross", eImGuiGfx_Texture);
  56. ImGui_PreloadImage("zepinfo1.dds", eImGuiGfx_Texture);
  57. ImGui_PreloadImage("zepinfo2.dds", eImGuiGfx_Texture);
  58. ImGui_PreloadImage("zepinfo3.dds", eImGuiGfx_Texture);
  59. ImGui_PreloadImage("zepinfo4.dds", eImGuiGfx_Texture);
  60.  
  61. // Player hands
  62. PlayerHands_PreloadHandModel_Diving();
  63.  
  64. // Particles
  65. ParticleSystem_Preload("ps_impact_metal_high.ps");
  66. ParticleSystem_Preload("dust_puff.ps");
  67. ParticleSystem_Preload("02_03_zeppelin_engine_on");
  68. ParticleSystem_Preload("oneshot_sand_cascade.ps");
  69. ParticleSystem_Preload("oneshot_waterbubbles_huge_directed.ps");
  70. ParticleSystem_Preload("oneshot_sand_falling.ps");
  71. }
  72.  
  73. //-------------------------------------------------------
  74.  
  75. void Setup()
  76. {
  77. GetBase().SetDisplayNameEntry("02-04-theta-outside");
  78.  
  79. Effect_Bloom_FadeBrightPass(0.00001, 0); //sets pixels over 127 (255 * 0.5) to add to bloom
  80. Effect_Bloom_FadeBloomWidth(160, 0); //sets 128 pixels in bloom width, looks best within 32 - 512 pixels.
  81. Effect_Bloom_FadeBloomTint(0.3, 0.3, 0.3, 0); //sets red tint to bloom
  82.  
  83. Effect_DoF_Start(0, 12, 1.0f, 0);
  84.  
  85. iTexture@ pSkybox = cResources_CreateTextureCubeMap("grayscale_gradient_1_3.dds",false);
  86. cLux_GetCurrentMap().GetWorld().SetFogSkyboxTexture(pSkybox);
  87.  
  88. //////////////////////
  89. //Level start
  90. //Map_Preset_SetupFog("PresetLevelStart", true, 2, 95, 0.4, cColor(0.004,0.023,0.031,1), 1, true, true);
  91. //Map_Preset_SetupSkybox("PresetLevelStart", cColor(0.021,0.091,0.137,1), 1);
  92. //Map_Preset_SetupDirLight("PresetLevelStart", true, cColor(0.481,0.736,0.77,1), 2, cVector3f(-0.752, -0.637, -0.169), cColor(0.069,0.232,0.254,1), cColor(0.071,0.231,0.255,1));
  93.  
  94. //
  95. Map_Preset_SetupBloom("PresetLevelStart", 160, 0.00001, 0, cColor(0.3, 0.3, 0.3, 0.0));
  96. Map_Preset_SetupDepthOfField("PresetLevelStart", true, 0, 12, 1.0);
  97. Map_Preset_SetupSkybox("PresetLevelStart", cColor(0.471,0.902,1,1), 0.6);
  98. Map_Preset_SetupFog("PresetLevelStart", true, 0, 100, 0.3, cColor(0.047,0.086,0.098,1), 1, true, true);
  99. Map_Preset_SetupSecondaryFog("PresetLevelStart", true, 0, 50, 0.15, cColor(0.075,0.086,0.085,1));
  100. Map_Preset_SetupDirLight("PresetLevelStart", true, cColor(0.481,0.736,0.77,1), 2, cVector3f(-0.752, -0.637, -0.169), cColor(0.071,0.231,0.255,1), cColor(0.069,0.232,0.254,1));
  101.  
  102. //////////////////////
  103. //Level 2.5 transition
  104. Map_Preset_SetupBloom("Preset2.5", 128.0f, 0.75f, 1, cColor(1,1,1,1));
  105. Map_Preset_SetupDepthOfField("Preset2.5", false);
  106.  
  107. cTerrain@ pTerrain = cLux_GetCurrentMap().GetWorld().GetTerrain();
  108. if(pTerrain !is null) pTerrain.SetCheapMaterial("sand_wavy.mat", 0.5f);
  109.  
  110. ///////////////////
  111. //End of level airlock setup
  112. Decal_SetVisibleInArea(false, "AreaOffDecals", "leaking_single.mat");
  113. ParticleSystem_SetVisible("0*ParticleSystem*", false);
  114.  
  115. /////////////////////////////////
  116. // CathTool initial state
  117. CathTool_ResetScreen(eCathToolVariant_CathDelta);
  118. CathTool_Insert("CathTool2", "ZeppelinCathTerminal", false);
  119. }
  120.  
  121. //-------------------------------------------------------
  122.  
  123. ////////////////////////////
  124. // Run first time starting map
  125. void OnStart()
  126. {
  127. bool bDoIntro = true;
  128.  
  129. //////////////////////////////////////////
  130. // Player setup
  131. Player_SetAmbientLight_Outdoors();
  132.  
  133. PlayerHands_SetHandModel_Diving();
  134. PlayerEnergy_SetFlowerSwallows(true);
  135.  
  136. ////////////////////////////////////////
  137. // Audio
  138. Sound_PreloadProject("02_04_theta_outside");
  139. Sound_PreloadGroup("Flashback/Level/02_04", true);
  140.  
  141. // Joint fixes
  142. Entity_SetVarFloat("ManualOverride_Wheel_*", "JointFixMaxDist",2.0f);
  143.  
  144. /////////////////////////
  145. // Debug
  146. if(cLux_ScriptDebugOn())
  147. {
  148. //Add any debug stuff here
  149. cLux_SetDebugInfoWindowText("Text that should show up when pressing F1");
  150. Map_Preset_Fade("PresetLevelStart", 5);
  151.  
  152. bDoIntro = false;
  153. }
  154.  
  155. SetupZeppelinLands();
  156. SetupArrivalOutsideTheta();
  157. SetupBass();
  158. SetupAudio();
  159.  
  160. if (bDoIntro)
  161. {
  162. SequenceIntro("");
  163. }
  164. else
  165. {
  166. //Map_SetSkyBoxColor(cColor(0.471,0.902,1,1));
  167. //Map_SetFogProperties(0, 100, 0.3, cColor(0.047,0.086,0.098,1), true);
  168. }
  169.  
  170. LastOnSoma_SetText("02_04_theta_outside_1");
  171. }
  172.  
  173. //-------------------------------------------------------
  174.  
  175. ////////////////////////////
  176. // Run when entering map
  177. void OnEnter()
  178. {
  179. MainMenu_SetBGPhase(eMainMenuPhase_2_4_To_3_3);
  180.  
  181. Map_SetUnderwater(true);
  182.  
  183. Map_AddTimer("TimerStartPreload",10.0f,"TimerStartPreload");
  184. }
  185.  
  186. //-------------------------------------------------------
  187.  
  188. void TimerStartPreload(const tString& in asName)
  189. {
  190. cLux_AddDebugMessage("Start preloading.");
  191. Preload();
  192. }
  193.  
  194. //-------------------------------------------------------
  195.  
  196. ////////////////////////////
  197. // Run when leaving map
  198. void OnLeave()
  199. {
  200. Map_RemoveTimer("TimerFlickerGateLamps");
  201. }
  202.  
  203. //-------------------------------------------------------
  204.  
  205. ////////////////////////////
  206. // To get when player makes input (mostly used for debug)
  207. void OnAction(int alAction, bool abPressed)
  208. {
  209. if(abPressed==false) return;
  210.  
  211.  
  212. if (alAction == eAction_Test1)
  213. {
  214. SequenceOpenThetame("");
  215. Player_Teleport("StartByExit", true);
  216. Preload();
  217. Map_SetPreloadPriority(eWorldStreamPriority_VeryHigh);
  218. }
  219. else if (alAction == eAction_Test2)
  220. {
  221. Preload();
  222. Map_SetPreloadPriority(eWorldStreamPriority_VeryHigh);
  223. Player_Teleport("StartInExit", true);
  224. Entity_CallEntityInteract("CathTool");
  225. }
  226. else if(alAction == eAction_Test3)
  227. {
  228. SequenceOpenThetame("");
  229. }
  230.  
  231. else if(alAction == eAction_Test4)
  232. {
  233. Sound_Stop("ZeppelinLiftEngineMotion", 2.0);
  234. Sound_CreateAtEntity("ZeppelinLiftEngineMotion","NPC_Zeppelin/SFX/engine/motion", "ZeppelinPlatform", 0.5, true, 1.0f);
  235. }
  236.  
  237. else if(alAction == eAction_Test5)
  238. {
  239. Sound_Stop("ZeppelinLiftEngineMotion", 0.1);
  240. }
  241.  
  242. else if(alAction == eAction_Test6)
  243. {
  244. Map_Preset_Fade("PresetLevelStart", 5);
  245. }
  246.  
  247. else if(alAction == eAction_Test0)
  248. {
  249. Map_ChangeMap("02_05_theta_inside.hpm", "PlayerStartArea_1", "", "");
  250. }
  251. }
  252.  
  253. //-------------------------------------------------------
  254.  
  255. ////////////////////////////
  256. // This only used for pure debug purposes when info needs to printed.
  257. float DrawDebugOutput(cGuiSet @apSet,iFontData @apFont,float afY)
  258. {
  259. //afY = cLux_DrawDebugText("Warning Counter:"+mfWarningCounter, afY);
  260. return afY;
  261. }
  262.  
  263. //-------------------------------------------------------
  264.  
  265. float mfDatamineBlink=0.0f;
  266.  
  267. bool mbDeloaded = false;
  268.  
  269. void Update(float afTimeStep)
  270. {
  271. if (mbDeloaded)
  272. return;
  273.  
  274. cVector3f vToLanding = Map_GetEntity("ZeppelinPlatform").GetPosition() -
  275. mvLandingPos;
  276. mfDistToLanding = vToLanding.Length()-0.2f;
  277. if (mfTotalDistToLanding==-1.0f)
  278. mfTotalDistToLanding = mfDistToLanding;
  279.  
  280. mfDatamineBlink+=afTimeStep;
  281. if (mfDatamineBlink>1.0f)
  282. mfDatamineBlink-=1.0f;
  283. Entity_SetEffectsActive("RadioDatamineCathLindwall", mfDatamineBlink>0.75f,false);
  284. }
  285.  
  286. //-------------------------------------------------------
  287.  
  288. /////////////////////////////////////////
  289. // ==============
  290. // MAIN FUNCTIONS
  291. // ==============
  292. /////////////////////////////////////////
  293.  
  294. //-------------------------------------------------------
  295.  
  296. bool mbArrivedAtTheta = false;
  297. tID m_idPSArea;
  298. bool mbUpdatePSAreaPos = true;
  299.  
  300. //-------------------------------------------------------
  301.  
  302. /////////////////////////////////////////
  303. // Generic timers
  304. /////////////////////////////////////////
  305.  
  306. //-------------------------------------------------------
  307.  
  308. void LevelStartFadeIn_Audio(const tString &in asTimer)
  309. {
  310. Sound_FadeGlobalVolume(1.0f, 3.0f);
  311. }
  312.  
  313. //-------------------------------------------------------
  314.  
  315. void TimerSetLampLit(const tString &in asTimer)
  316. {
  317. Lamp_SetLit(asTimer, true, true);
  318. }
  319.  
  320. //-------------------------------------------------------
  321.  
  322. void TimerSetLampUnlit(const tString &in asTimer)
  323. {
  324. Lamp_SetLit(asTimer, false, true);
  325. }
  326.  
  327. //-------------------------------------------------------
  328.  
  329. void TimerFadeLightToBlack(const tString &in asTimer)
  330. {
  331. Light_FadeTo(asTimer, cColor(0), -1, 0.2);
  332. }
  333.  
  334. //-------------------------------------------------------
  335.  
  336. void TimerPlayVoice(const tString &in asTimer)
  337. {
  338. Voice_Play(asTimer);
  339. }
  340.  
  341. //-------------------------------------------------------
  342.  
  343. void TimerTurnOnEffects(const tString &in asTimer)
  344. {
  345. Entity_SetEffectsActive(asTimer, true, false);
  346. }
  347.  
  348. //-------------------------------------------------------
  349.  
  350. void TimerTurnOffEffects(const tString &in asTimer)
  351. {
  352. Entity_SetEffectsActive(asTimer, false, false);
  353. }
  354.  
  355. //-------------------------------------------------------
  356.  
  357. void TimerEnableInteraction(const tString &in asTimer)
  358. {
  359. Entity_SetInteractionDisabled(asTimer, false);
  360. }
  361.  
  362. //-------------------------------------------------------
  363.  
  364. /////////////////////////////////////////
  365. // ==============
  366. // SCENE 1 *ZEPPELIN LANDS*
  367. // ==============
  368. /////////////////////////////////////////
  369.  
  370. float mfDistToLanding;
  371. float mfTotalDistToLanding;
  372. cVector3f mvLandingPos;
  373. cVector3f mvStartingPos;
  374.  
  375. //-------------------------------------------------------
  376.  
  377. void SetupZeppelinLands()
  378. {
  379. if(cScript_GetGlobalVarBool("TransitionFrom2.3") == false) Entity_PlaceAtEntity("ZeppelinPlatform", "AreaStartZepHere", cVector3f_Zero, false);
  380.  
  381. Entity_SetInteractionDisabled("ZeppelinRailing_*", true);
  382.  
  383. mfTotalDistToLanding = -1.0f;
  384. mvLandingPos = Map_GetEntity("ZeppelinLandPos").GetPosition();
  385. mvStartingPos = Map_GetEntity("ZeppelinPlatform").GetPosition();
  386. mlZepInfoImage=1;
  387. mfZepInfoTimer=0.0f;
  388.  
  389. Entity_SetInteractionDisabled("BrokenRadio", true);
  390. Entity_SetEffectsActive("BrokenRadio",false,false);
  391. }
  392.  
  393. //-------------------------------------------------------
  394.  
  395. void LineStart_Conversation(const tString &in asParent, const tString &in asChild, int alState, bool abStart)
  396. {
  397. if (abStart==true)
  398. {
  399. cLux_AddDebugMessage("Conversation Start - ducking");
  400. Sound_FadeGlobalVolume(0.625f, 18.0f);
  401. }
  402. }
  403.  
  404. void LineOver_Conversation(const tString &in asParent, const tString &in asChild, int alState, bool abStart)
  405. {
  406. if (abStart)
  407. return;
  408.  
  409. cLux_AddDebugMessage("Conversation Over");
  410. Sound_FadeGlobalVolume(1.0f, 5.0f);
  411. }
  412.  
  413. /////////////////////////////////////////
  414. // Scene 1 Event A *Arrive at Landing pad*
  415. /////////////////////////////////////////
  416.  
  417. //-------------------------------------------------------
  418.  
  419. cSequenceStatesData mIntroSequence;
  420.  
  421. void SequenceIntro(const tString &in asTimer)
  422. {
  423. Sequence_Begin("SequenceIntro", mIntroSequence);
  424.  
  425. if (Sequence_DoStepAndWait(2))
  426. {
  427. //Zeppelin engine sound
  428. Sound_CreateAtEntity("ZeppelinLiftEngineMotion","NPC_Zeppelin/SFX/engine/motion", "ZeppelinPlatform", 0.25, true, 1.0f);
  429. //Sound_FadeGlobalVolume(1.0f, 9.0f, eSoundEntryType_WorldClean);
  430.  
  431. //Player_SetHeadBobMul(0);
  432. //Player_SetJumpDisabled(true);
  433. Prop_MoveLinearTo("ZeppelinPlatform", "ZeppelinLandPos", 100, 1.7, 3, true);
  434. Prop_AlignRotation("ZeppelinPlatform", "ZeppelinLandPos", 100, 0.015, 0.1, false);
  435.  
  436. Lamp_SetLit("LandingPadLamp_1", true, false);
  437. Map_AddTimer("LandingPadLamp_1", 0.4, "TimerLandingLightsLoop");
  438.  
  439. Entity_SetInteractionDisabled("StunRodLockboxLid", true);
  440. Map_Preset_Fade("PresetLevelStart", 20);
  441.  
  442. for (int i = 1; Entity_Exists("ZeppelinEngine_"+i); i++)
  443. {
  444. ParticleSystem_CreateAtEntity("ZeppelinEngineOn_"+i, "02_03_zeppelin_engine_on", "ZeppelinEngine_"+i, true);
  445. }
  446. }
  447. else if (Sequence_DoStepAndWait(1))
  448. {
  449. Terminal_SetGuiActive("ZepTerminalA", true, 0.5);
  450. //Map_Preset_Fade("PresetLevelStart", 15);
  451. }
  452. else if (Sequence_DoStepAndWait(9))
  453. {
  454. Terminal_SetGuiActive("ZepTerminalB", true, 0.5);
  455. }
  456. else if (Sequence_DoStepAndWait(0))
  457. {
  458. Voice_SetSource("Catherine", "CathTool2", 3, 20, true, 20);
  459. Voice_Play("1_CatherineGivesDirections");
  460. }
  461. Sequence_End();
  462. }
  463.  
  464. //-------------------------------------------------------
  465.  
  466. void TimerLandingLightsLoop(const tString &in asTimer)
  467. {
  468. int lLampIndex = cString_GetNumericSuffixInt(asTimer);
  469. Lamp_SetLit(asTimer, false, true);
  470.  
  471. tString sNextLamp = "LandingPadLamp_" + (lLampIndex == 6 ? 1 : (lLampIndex+1));
  472. Lamp_SetLit(sNextLamp, true, true);
  473.  
  474. Map_AddTimer(sNextLamp, 0.4, "TimerLandingLightsLoop");
  475. }
  476.  
  477. //-------------------------------------------------------
  478.  
  479. // When the zep platform lands on a light, dim it so particles/billboard turn off.
  480. bool OnZepHitsLightBlocker(const tString &in asParent, const tString &in asChild, int alState)
  481. {
  482. tString sLight = Entity_GetVarString(asParent,"");
  483. if (alState==1)
  484. {
  485. float fBright=Light_GetBrightness(sLight);
  486. Entity_SetVarFloat(asParent, "SavedBrightness",fBright);
  487. Light_SetBrightness(sLight,0.0f);
  488. }
  489. else
  490. {
  491. float fBright=Entity_GetVarFloat(asParent,"SavedBrightness");
  492. Light_SetBrightness(sLight,fBright);
  493. }
  494.  
  495. return true;
  496. }
  497.  
  498. //-------------------------------------------------------
  499.  
  500. bool CollisionZeppelinLanded(const tString &in asParent, const tString &in asChild, int alState)
  501. {
  502. cLux_AddTodoMessage("Sound: Zeppelin touchdown.");
  503.  
  504. //Zeppelin idle sound
  505. Sound_Play("zeppelin_idle", 3.0f, false);
  506.  
  507. //Turn on landing spots
  508. Sound_Play("landing_spot_*", 1.0f, false);
  509. Sound_Play("animal_spot_*", 1.0f, false);
  510.  
  511. Prop_StopMovement("ZeppelinPlatform");
  512.  
  513. ///////////////////////////
  514. // Turn off landing lights
  515. Lamp_SetLit("LandingPadLamp_*", true, true);
  516. for (int i = 1; Entity_Exists("LandingPadLamp_" + i); i++)
  517. Map_RemoveTimer("LandingPadLamp_" + i);
  518.  
  519. Player_SetHeadBobMul(1);
  520.  
  521. // Turn off fish
  522. Entity_SetActive("AweFish_*", false);
  523.  
  524. mbZeppelinLanded = true;
  525. CheckReleaseCathTool();
  526.  
  527. Entity_SetInteractionDisabled("BrokenRadio", false);
  528. Entity_SetEffectsActive("BrokenRadio",true,true);
  529.  
  530. return true;
  531. }
  532.  
  533. //-------------------------------------------------------
  534.  
  535. bool mbCathConversationFinished = false;
  536. bool mbZeppelinLanded = false;
  537. bool mbCathToolReleased = false;
  538.  
  539. void CheckReleaseCathTool()
  540. {
  541. if (mbCathToolReleased)
  542. return;
  543.  
  544. if (mbCathConversationFinished&&mbZeppelinLanded)
  545. {
  546. CathTool_AllowDetach("CathTool2");
  547. mbCathToolReleased = true;
  548. }
  549. }
  550.  
  551. //-------------------------------------------------------
  552.  
  553. void LineOver_CathEjects(const tString &in asScene, const tString &in asSubject, int alLineIndex, bool abStart)
  554. {
  555. if (abStart) return;
  556.  
  557. cLux_AddDebugMessage("Conversation Over");
  558. Sound_FadeGlobalVolume(1.0f, 5.0f);
  559.  
  560. Terminal_SetGuiActive("ZepTerminalA",false);
  561. Terminal_SetGuiActive("ZepTerminalB",false);
  562. Terminal_SetGuiActive("TerminalCathZep",false);
  563.  
  564. mbCathConversationFinished = true;
  565. CheckReleaseCathTool();
  566. }
  567.  
  568. //-------------------------------------------------------
  569.  
  570. /////////////////////////////////////////
  571. // Scene 1 Event B *Catherine give final directions (dialog)*
  572. /////////////////////////////////////////
  573.  
  574. //-------------------------------------------------------
  575.  
  576. void TimerBlinkCathBoxOn(const tString &in asTimer)
  577. {
  578. Entity_FadeEffectBaseColor(asTimer, cColor_Red*6, 1);
  579. Map_AddTimer(asTimer, 1, "TimerBlinkCathBoxOff");
  580. }
  581.  
  582. //-------------------------------------------------------
  583.  
  584. void TimerBlinkCathBoxOff(const tString &in asTimer)
  585. {
  586. Entity_FadeEffectBaseColor(asTimer, cColor(0), 1);
  587. Map_AddTimer(asTimer, 1, "TimerBlinkCathBoxOn");
  588. }
  589.  
  590. //-------------------------------------------------------
  591.  
  592. bool CathTool2_OnPickUp(const tString &in asTool)
  593. {
  594. cLux_AddTodoMessage("Sound: CathBox picked up");
  595.  
  596. Entity_CallEntityInteract("CathTool");
  597. Entity_SetActive(asTool, false);
  598.  
  599. Map_AddTimer("LowerZeppelinRailingTimer", 1, "TimerLowerZeppelinRailing");
  600. Game_AutoSave();
  601. return false;
  602. }
  603.  
  604. //-------------------------------------------------------
  605.  
  606. bool CanUseCathBox(const tString &in asTool, const tString &in asEntity)
  607. {
  608. if (Map_GetEntity(asEntity).GetInteractionDisabled())
  609. return false;
  610.  
  611. if (asEntity=="AirlockButton")
  612. return CathTool_CanUse(asTool, asEntity);
  613.  
  614. return false;
  615. }
  616.  
  617. //-------------------------------------------------------
  618.  
  619. bool OnUseCathBox(const tString &in asTool, const tString &in asEntity)
  620. {
  621. if (asEntity=="AirlockButton")
  622. {
  623. CathTool_UseOnPanel(asTool, asEntity);
  624. return false;
  625. }
  626. return true;
  627. }
  628.  
  629. //-------------------------------------------------------
  630.  
  631. void TimerLowerZeppelinRailing(const tString &in asTimer)
  632. {
  633. Sound_CreateAtEntity("ZeppelinRailingLower", "NPC_Zeppelin/SFX/linear/gates_open_onboard", "ZeppelinRailing_1", 0, false, 1);
  634. Sound_Fade("zeppelin_idle", 0.65f, 4.0f);
  635.  
  636. Map_AddTimer("StartAmbient", cMath_RandRectf(5.0f,8.0f), "AmbientMusicHandler");
  637.  
  638. Prop_SetStaticPhysics("ZeppelinRailing_*", false);
  639. Lever_SetAutoMoveEnabled("ZeppelinRailing_*", true);
  640. Lever_SetAutoMoveTarget("ZeppelinRailing_*", 1);
  641.  
  642. Entity_SetActive("ZeppelinRailingBlocker_*", false);
  643. }
  644.  
  645. //-------------------------------------------------------
  646.  
  647. /////////////////////////////////////////
  648. // Scene 1 Event C *Datamine exposed blackbox (dialog)*
  649. /////////////////////////////////////////
  650.  
  651. //-------------------------------------------------------
  652.  
  653. /////////////////////////////////////////
  654. // Scene 1 Event D *Down the ramp (dialog)*
  655. /////////////////////////////////////////
  656.  
  657. //-------------------------------------------------------
  658.  
  659. bool CollisionTurnOnPathMarkers(const tString &in asParent, const tString &in asChild, int alState)
  660. {
  661. cLux_AddTodoMessage("Sound: Path markers turn on automatically");
  662. for (int i = 1; i <= 10; i++)
  663. {
  664. Map_AddTimer("path_marker_theta_"+i, i*0.75f, "TimerSetLampLit");
  665. }
  666.  
  667. Map_AddTimer("1_PathAheadComment", 4, "TimerPlayVoice");
  668. return false;
  669. }
  670.  
  671. //-------------------------------------------------------
  672.  
  673. void OnChangeTransportStationButton(const tString &in asEntity, int alState)
  674. {
  675. if(alState != 1) return;
  676.  
  677. cLux_AddDebugMessage("Broken "+asEntity);
  678. Sound_CreateAtEntity("PressButton", "Entities_OceanBottom/button/plastic_stiff", asEntity, 0.0f, false);
  679. Map_AddTimer(asEntity, 1.25, "TransportButtonMalfunction");
  680.  
  681. ///////////////////////////////////
  682. //Cooldown timer to stop from sound spam
  683. Entity_SetInteractionDisabled(asEntity, true);
  684. Map_AddTimer(asEntity, 3.5, "TransportButtonInteractEnable");
  685. }
  686.  
  687. void TransportButtonMalfunction(const tString &in asTimer)
  688. {
  689. Sound_CreateAtEntity("InactiveDoorButton", "01_03_upsilon_outside/SFX/broken_airlock/broken_airlock", "slidedoor_double_large_1", 0.0f, false);
  690. }
  691.  
  692. void TransportButtonInteractEnable(const tString &in asTimer)
  693. {
  694. //enable interaction again
  695. Entity_SetInteractionDisabled("panel_slidedoor_theta_gate_1", false);
  696. }
  697.  
  698. //-------------------------------------------------------
  699.  
  700. /////////////////////////////////////////
  701. // Scene 1 Event E *Interact with Comm Central (dialog)*
  702. /////////////////////////////////////////
  703.  
  704. //-------------------------------------------------------
  705.  
  706. /////////////////////////////////////////
  707. // Scene 1 Event F *Jump Into the Abyss*
  708. /////////////////////////////////////////
  709.  
  710. //-------------------------------------------------------
  711.  
  712. bool CollisionAbyssFall(const tString &in asParent, const tString &in asChild, int alState)
  713. {
  714. if (SequenceStates_IsActive("SequenceAbyssFall") || alState == -1) return true;
  715.  
  716. cLux_AddDebugMessage("BeginFall " + alState + " " + asChild);
  717.  
  718. SequenceAbyssFall("");
  719.  
  720. return true;
  721. }
  722.  
  723. //-------------------------------------------------------
  724.  
  725. cSequenceStatesData mAbyssFallSequence;
  726.  
  727. void SequenceAbyssFall(const tString &in asTimer)
  728. {
  729. Sequence_Begin("SequenceAbyssFall", mAbyssFallSequence);
  730.  
  731. // Silence everything except dark tone
  732. if (Sequence_DoStepAndWait(1.f))
  733. {
  734. Sound_FadeGlobalVolume(0, 6);
  735. Sound_FadeGlobalVolume(0, 1, eSoundEntryType_GuiWorld);
  736. Sound_CreateAtEntity("AbyssFall", "Player/action/underwater/gui/abyss_fall", "Player", 0.0f, false, 1.0f);
  737. Prop_MoveLinearTo("AbyssWall_1", "AbyssFallLoopTrigger_1", 100, 20, 0, true);
  738. Prop_MoveLinearTo("AbyssWall_2", "AbyssFallLoopTrigger_1", 100, 20, 0, true);
  739. Prop_MoveLinearTo("AbyssWall_3", "AbyssFallLoopTrigger_1", 100, 20, 0, true);
  740. Prop_MoveLinearTo("AbyssWall_4", "AbyssFallLoopTrigger_2", 100, 20, 0, true);
  741. Prop_MoveLinearTo("AbyssWall_5", "AbyssFallLoopTrigger_2", 100, 20, 0, true);
  742. Prop_MoveLinearTo("AbyssWall_6", "AbyssFallLoopTrigger_2", 100, 20, 0, true);
  743. }
  744.  
  745. // Fade out and place player in fall loop
  746. else if (Sequence_DoStepAndWait(4.0f))
  747. {
  748. Effect_Fade_Out(2.f);
  749.  
  750. }
  751.  
  752. /////////////////////
  753. // Start falling
  754. if (Sequence_DoStepAndWait(2.f))
  755. {
  756. Effect_Fade_In(1.f);
  757. Player_SetMoveSpeedMul(0);
  758. Player_Teleport("abyss_fall_loop", false);
  759. Map_SetEnvironmentParticleGravityVelocity(cVector3f_Up * 20);
  760.  
  761. Effect_Shake_Start(0.2, 2, 12, 0);
  762.  
  763. //Breathing
  764. Sound_CreateAtEntity("HeavyBreathing", "Player/breaths/abyss/breathing_gui", "Player", 0.0f, false, 1.0f);
  765. }
  766.  
  767. /////////////////////
  768. // Begin crunching sound and slowly fade out
  769. else if (Sequence_DoStepAndWait(4.75f))
  770. {
  771. //Trigger Suit Pressure Alarm
  772. Sound_CreateAtEntity("PressureAlarmMediumSpeed", "Player/UI/Suit/pressure_alarm_medium", "Player", 0.0f, false, 1.0f);
  773. }
  774.  
  775. else if (Sequence_DoStepAndWait(1.f))
  776. {
  777. //Stop Medium Alarm and Trigger Fast Alarm
  778. Sound_Stop("PressureAlarmMediumSpeed", 0.0f);
  779. Sound_CreateAtEntity("PressureAlarmHighSpeed", "Player/UI/Suit/pressure_alarm_high", "Player", 0.0f, false, 1.0f);
  780. }
  781.  
  782. else if (Sequence_DoStepAndWait(2.5f))
  783. {
  784. //Trigger Suit Cracking Under Pressure
  785. Sound_CreateAtEntity("SuitCracking", "Player/action/underwater/gui/abyss_suit_crack", "player", 0.0f, false);
  786. }
  787.  
  788. else if (Sequence_DoStepAndWait(7.5f))
  789. {
  790. //Stop all sounds apart from the big finale, quick fade to black
  791. Sound_Stop("AbyssFall", 0.0f);
  792. Sound_Stop("PressureAlarmHighSpeed", 0.0f);
  793.  
  794. //Suit Crack Open
  795. Sound_CreateAtEntity("SuitCrackOpen", "Player/action/underwater/gui/abyss_suit_end", "player", 0.0f, false);
  796. Effect_Fade_Out(0.1f);
  797. }
  798.  
  799. else if (Sequence_DoStepAndWait(2.f))
  800. {
  801. Effect_Fade_Out(3.f);
  802. }
  803.  
  804. /////////////////////
  805. // Wakes up
  806. else if (Sequence_DoStepAndWait(2.f))
  807. {
  808. Sound_FadeGlobalVolume(1, 2);
  809. Sound_FadeGlobalVolume(1, 2, eSoundEntryType_GuiWorld);
  810. }
  811.  
  812. ////////////////////////////////
  813. // Return things to normal
  814. else if (Sequence_DoStepAndWait(4.f))
  815. {
  816. Player_Teleport("AbyssFallWakeUp");
  817.  
  818. // Setup and start camera animation
  819. CameraAnimationNode_SetAutoMove("AbyssWakeUpAnim_1", 0.5);
  820. CameraAnimation_Begin("AbyssWakeUpAnim", "", true);
  821.  
  822. Sound_CreateAtEntity("AbyssRiseVO", "Player/camera_anim/underwater/abyss_recover/vo", "Player", 0.0f, false, 1.0f);
  823. Sound_CreateAtEntity("AbyssRiseFoley", "Player/camera_anim/underwater/abyss_recover/foley", "Player", 0.0f, false, 1.0f);
  824.  
  825. Effect_Fade_In(2.0f);
  826. Player_SetMoveSpeedMul(0);
  827. Player_FadeMoveSpeedMulTo(1, 8.f);
  828.  
  829. Map_SetEnvironmentParticleGravityVelocity(cVector3f_Zero);
  830. Prop_StopMovement("AbyssWall_*");
  831.  
  832. Effect_ImageTrail_Start(1.5, 0, 0.5f, 25.0f);
  833.  
  834. }
  835. else if (Sequence_DoStepAndWait(0))
  836. {
  837.  
  838. }
  839.  
  840. Sequence_End();
  841. }
  842.  
  843. //-------------------------------------------------------
  844.  
  845. bool LoopAbyssFall(const tString &in asParent, const tString &in asChild, int alState)
  846. {
  847. int lTrigger = cString_GetNumericSuffixInt(asParent);
  848. Entity_PlaceAtEntity(asChild, "AbyssWallSpawnArea_" + lTrigger);
  849.  
  850. return true;
  851. }
  852.  
  853. //-------------------------------------------------------
  854.  
  855. /////////////////////////////////////////
  856. // Scene 2 Event C *Datamine shipping container (dialog + text)*
  857. /////////////////////////////////////////
  858.  
  859. //-------------------------------------------------------
  860.  
  861. /////////////////////////////////////////
  862. // Scene 2 Event D *Docile Mind Coral Transmission (dialog)*
  863. /////////////////////////////////////////
  864.  
  865. //-------------------------------------------------------
  866.  
  867. /////////////////////////////////////////
  868. // Scene 2 Event G *Rocks fall down*
  869. /////////////////////////////////////////
  870.  
  871. //-------------------------------------------------------
  872.  
  873. /////////////////////////////////////////
  874. // Scene 2 Event H *Stalking Sounds; Running ends in attack (dialog)*
  875. /////////////////////////////////////////
  876.  
  877. //-------------------------------------------------------
  878.  
  879. /////////////////////////////////////////
  880. // Scene 2 Event I *Strong Currents*
  881. /////////////////////////////////////////
  882.  
  883. // Boundaries
  884. bool CollisionPathBoundraries(const tString &in asParent, const tString &in asChild, int alState)
  885. {
  886. return true;
  887. }
  888.  
  889. //-------------------------------------------------------
  890.  
  891. /////////////////////////////////////////
  892. // Scene 2 Event M *Simon Comments*
  893. /////////////////////////////////////////
  894.  
  895. //-------------------------------------------------------
  896.  
  897. /////////////////////////////////////////
  898. // ==============
  899. // SCENE 3 *ARRIVAL OUTSIDE THETA*
  900. // ==============
  901. /////////////////////////////////////////
  902.  
  903. //-------------------------------------------------------
  904.  
  905. /*Put any variables that are used by many events in Scene X here.*/
  906.  
  907. //-------------------------------------------------------
  908.  
  909. void SetupArrivalOutsideTheta()
  910. {
  911. Entity_SetInteractionDisabled("ThetaGate_Walkboard", true);
  912. //Entity_SetInteractionDisabled("ThetaGate_Button", true);
  913. Entity_SetEffectsActive("ThetaGate_Button", false, false);
  914.  
  915. Entity_StopAnimation("ThetaGate_Up");
  916. Entity_StopAnimation("ThetaGate_Down");
  917. Entity_StopAnimation("ThetaGate_Left");
  918. Entity_StopAnimation("ThetaGate_Right");
  919.  
  920. Entity_StopAnimation("AirlockDoor_1x");
  921. Entity_StopAnimation("AirlockDoor_2x");
  922.  
  923. Entity_SetEffectsActive("ManualOverride_Slide", false, false);
  924. Entity_SetEffectsActive("ManualOverride_Wheel_Left", false, false);
  925. Entity_SetEffectsActive("ManualOverride_Lever", false, false);
  926. }
  927.  
  928. //-------------------------------------------------------
  929.  
  930. /////////////////////////////////////////
  931. // Scene 3 Event A *Storm stops; Theta Appears (dialog)*
  932. /////////////////////////////////////////
  933.  
  934. //-------------------------------------------------------
  935.  
  936. //-------------------------------------------------------
  937.  
  938. /////////////////////////////////////////
  939. // Scene 3 Extra: Talk to Bass Robot
  940. /////////////////////////////////////////
  941.  
  942. //-------------------------------------------------------
  943.  
  944. int mlBassConversation = 1;
  945. int mlBassLine = 1;
  946.  
  947. void SetupBass()
  948. {
  949. Voice_SetCharacterSpeakingCallback("BassRobot","OnBassSpeak");
  950. Lamp_SetFlickerActive("BassRobotLamp",false);
  951. Entity_SetEffectsActive("BassRobot_1",false,true);
  952. Entity_SetInteractionDisabled("WauFlower",true);
  953. Light_SetVisible("PointLight_34",false);
  954. Light_SetVisible("PointLight_35",false);
  955. }
  956.  
  957. //-------------------------------------------------------
  958.  
  959. bool OnBassSpeak(const tString &in asCharacter, bool abStartedTalking)
  960. {
  961. Lamp_SetFlickerActive("BassRobotLamp",abStartedTalking);
  962. Entity_SetEffectsActive("BassRobot_1",abStartedTalking,true);
  963. Entity_SetEffectsActive("BassRobot_dead",abStartedTalking,true);
  964. Light_SetVisible("PointLight_34",abStartedTalking);
  965. Light_SetVisible("PointLight_35",abStartedTalking);
  966. return true;
  967. }
  968.  
  969. //-------------------------------------------------------
  970. bool mbNearBassTriggered = false;
  971. bool OnNearBass(const tString &in asParent, const tString &in asChild, int alState)
  972. {
  973. if(alState==1)
  974. {
  975. if(mbBassDead==false)
  976. {
  977. Map_AddTimer("StopAmbientMusicQuickly", 1.0f, "AmbientMusicHandler");
  978. Entity_SetActive("BassLookAt", true);
  979. }
  980.  
  981.  
  982. if(mbNearBassTriggered==false)
  983. {
  984. cLux_AddDebugMessage("Trigger Bass");
  985. Voice_Play("BassRobot_Wakes", -1, "OnBassWoken");
  986. mbNearBassTriggered = true;
  987. }
  988. }
  989. else
  990. {
  991. Map_AddTimer("StartAmbient", cMath_RandRectf(5.0f,8.0f), "AmbientMusicHandler");
  992. }
  993. return true;
  994. }
  995.  
  996. bool mbLookAtBassMusic = false;
  997. void LookAtBass(const tString &in asEntity, int alState)
  998. {
  999. if(mbLookAtBassMusic==false)
  1000. {
  1001. Music_Play("02_04_robot_stinger", 0.65f, false, eMusicPrio_BigEvent);
  1002. Entity_SetActive("BassLookAt", false);
  1003. Sound_PreloadGroup("NPC_Creatures/Foley/Underwater/bass_robot", true);
  1004. mbLookAtBassMusic = true;
  1005. }
  1006. }
  1007.  
  1008. //-------------------------------------------------------
  1009.  
  1010. void OnBassWoken(const tString&in asScene, const tString&in asSubject)
  1011. {
  1012. cLux_AddDebugMessage("Bass woken");
  1013. Entity_SetActive("InteractBassConversation", true);
  1014. Map_AddTimer("TimerBassLine", cMath_RandRectf(5.0f,10.0f), "TimerBassLine");
  1015. }
  1016.  
  1017. //-------------------------------------------------------
  1018.  
  1019. void TimerBassLine(const tString& in asName)
  1020. {
  1021. if (Voice_AnySceneIsActive())
  1022. {
  1023. Map_AddTimer("TimerBassLine", cMath_RandRectf(10.0f,15.0f), "TimerBassLine");
  1024. return;
  1025. }
  1026.  
  1027. Voice_Play("BassRobot_Line"+mlBassLine);
  1028.  
  1029. mlBassLine++;
  1030. if (mlBassLine<16)
  1031. Map_AddTimer("TimerBassLine", cMath_RandRectf(10.0f,15.0f), "TimerBassLine");
  1032. }
  1033.  
  1034. //-------------------------------------------------------
  1035.  
  1036. void OnInteractWithBass(const tString &in asEntity)
  1037. {
  1038. Map_RemoveTimer("TimerBassLine");
  1039. Voice_StopAll();
  1040. Entity_SetActive("InteractBassConversation", false);
  1041. Dialog_StartConversation_PosBased("BassRobot","InteractBassConversation", "BassConvArea");
  1042. Dialog_Begin();
  1043. Dialog_AddBranchAndSubject("BassRobot_Conversation"+mlBassConversation, "", "OnBassConversationEnds");
  1044. Dialog_End();
  1045. }
  1046.  
  1047. //-------------------------------------------------------
  1048.  
  1049. void OnBassConversationEnds(const tString&in asSubject, bool abStartOfSubject)
  1050. {
  1051. if (abStartOfSubject)
  1052. return;
  1053.  
  1054. mlBassConversation++;
  1055. if (mlBassConversation<8)
  1056. {
  1057. Entity_SetActive("InteractBassConversation", true);
  1058. }
  1059. if (mlBassLine<16)
  1060. Map_AddTimer("TimerBassLine", cMath_RandRectf(10.0f,15.0f), "TimerBassLine");
  1061. }
  1062.  
  1063. //-------------------------------------------------------
  1064.  
  1065. void OnStartBassDrain(const tString &in asEntity)
  1066. {
  1067. Voice_StopAll();
  1068. Voice_Play("BassRobot_Die");
  1069. Entity_SetActive("InteractBassConversation", false);
  1070. Map_RemoveTimer("TimerBassLine");
  1071. Map_AddTimer("StartBassDeath", 0.1f, "SequenceBassDeath");
  1072. Entity_SetActive("BassRobot_1", false);
  1073. Entity_SetActive("BassRobot_dead", true);
  1074. Entity_SetEffectsActive("BassRobot_1",false,true);
  1075.  
  1076. Entity_SetEffectBaseColor("BassRobotLamp",cColor(0.5,0.5,0.5));
  1077. Lamp_SetupFlicker("BassRobotLamp",0.1f,0.2f,0.1f,0.2f,false);
  1078. Entity_FadeEffectBaseColor("BassRobotLamp",cColor(0.0,0.0,0.0),8.0f);
  1079.  
  1080. }
  1081.  
  1082. //-------------------------------------------------------
  1083.  
  1084. void Detach_BassCable(const tString &in asStickyArea, const tString &in asBodyName)
  1085. {
  1086. Entity_SetActive(asStickyArea, false);
  1087. Entity_SetActive("BassCableAux", false);
  1088.  
  1089. LightFlash_Add(0, 0.1, 0.1, Map_GetEntity(asStickyArea).GetPosition(), cColor(0.5,0.5,1,1), 1, 5);
  1090. ParticleSystem_CreateAtEntityExt(asStickyArea + "SparkParticles", "ps_impact_metal_high.ps", asStickyArea, false, cColor(0.75,0.75,1,1), 3.f);
  1091. ParticleSystem_CreateAtEntityExt(asStickyArea + "DustParticles", "dust_puff.ps", asStickyArea, false, cColor(0.3f,1));
  1092.  
  1093. Effect_Rumble_Start(0.9, 1.5, 0.1, 0.75);
  1094.  
  1095. Entity_SetEffectsActive("WauFlower",false,true);
  1096.  
  1097. Light_SetVisible("PointLight_33",false);
  1098.  
  1099. Sound_CreateAtEntity("BassDeathSweet", "NPC_Creatures/Foley/Underwater/bass_robot/death_sweet","DeathSoundSrc");
  1100.  
  1101.  
  1102. OnStartBassDrain("");
  1103. }
  1104.  
  1105. //-------------------------------------------------------
  1106. bool mbBassDead = false;
  1107. cSequenceStatesData mSequenceBassDeath;
  1108. void SequenceBassDeath(const tString &in asX)
  1109. {
  1110. Sequence_Begin("SequenceBassDeath", mSequenceBassDeath);
  1111. if (Sequence_DoStepAndWait(2.0f))
  1112. {
  1113. OnCompleteBassDrain("");
  1114. }
  1115. else if(Sequence_DoStepAndWait(11.8f))
  1116. {
  1117. Entity_PlayAnimation("BassRobot_dead", "death", 0, false, false);
  1118. mbBassDead = true;
  1119. }
  1120. else if(Sequence_DoStepAndWait(0))
  1121. {
  1122. Sound_Stop("BassRobot_1_AnimEvent", 0.25f);
  1123. Entity_PlayAnimation("BassRobot_dead", "dead", 0, true, true);
  1124. Lamp_SetLit("BassRobotLamp", false, true);
  1125. Entity_SetEffectsActive("BassRobot_dead",false,true);
  1126. Entity_SetEffectsActive("BassRobotLamp",false,true);
  1127. }
  1128. Sequence_End();
  1129. }
  1130.  
  1131. //-------------------------------------------------------
  1132.  
  1133. bool mbBassDeathMusic = false;
  1134. void LineStart_BassMusicBool(const tString &in asParent, const tString &in asChild, int alState, bool abStart)
  1135. {
  1136. if (abStart)
  1137. {
  1138. mbBassDeathMusic = true;
  1139. cLux_AddDebugMessage("Bass death music allowed");
  1140. }
  1141.  
  1142. }
  1143.  
  1144. //-------------------------------------------------------
  1145.  
  1146. void OnCompleteBassDrain(const tString &in asEntity)
  1147. {
  1148. Map_AddTimer("BassStopAnimSound", 2.0f, "BassStopAnimSound");
  1149.  
  1150. if(mbBassDeathMusic==true)
  1151. {
  1152. Map_AddTimer("BassDeathMusic", 2.0f, "BassDeathMusic");
  1153. }
  1154. }
  1155.  
  1156. //-------------------------------------------------------
  1157.  
  1158. void BassDeathMusic(const tString &in asTimer)
  1159. {
  1160. if(mbBassDeathMusic==true)
  1161. {
  1162. Music_Play("02_08_stationreveal", 1.0f, false, eMusicPrio_BigEvent);
  1163. }
  1164. }
  1165.  
  1166. //-------------------------------------------------------
  1167.  
  1168. void BassStopAnimSound(const tString &in asTimer)
  1169. {
  1170. if(Sound_Exists("BassRobot_AnimEvent"))
  1171. {
  1172. Sound_Stop("BassRobot_AnimEvent", 0.1f);
  1173. Map_AddTimer("BassStopAnimSound", 0.1f, "BassStopAnimSound");
  1174. }
  1175. else
  1176. {
  1177. Map_RemoveTimer("BassStopAnimSound");
  1178. }
  1179. }
  1180.  
  1181. //-------------------------------------------------------
  1182.  
  1183. /////////////////////////////////////////
  1184. // Scene 3 Event C *Open Entrance Door (dialog)*
  1185. /////////////////////////////////////////
  1186.  
  1187. //-------------------------------------------------------
  1188.  
  1189. bool mbTriedTheButton = false;
  1190. bool mbOverrideCylinderOut = false;
  1191. int mlGateShakeID = -1;
  1192.  
  1193. //-------------------------------------------------------
  1194.  
  1195. bool LockboxPopOff(const tString &in asParent, const tString &in asChild, int alState)
  1196. {
  1197. Sound_CreateAtEntity("LockBoxPopOffSound", "Entities_OceanBottom/objects/theta_door_open/hatch_remove", "ManualOverride_Slide_Out_1", 0.5f, false);
  1198. return false;
  1199. }
  1200.  
  1201. //-------------------------------------------------------
  1202.  
  1203. void OnChangeThetaGateButton(const tString &in asEntity, int alState)
  1204. {
  1205. if (alState != 1) return;
  1206.  
  1207. Sound_CreateAtEntity("InactiveDoorButton", "Entities_OceanBottom/objects/theta_door_open/door_button", "ThetaGate_Button", 0.0f, false);
  1208. Map_AddTimer("ThetaGateButtonMalfunction", 1.0f, "ThetaGateButtonMalfunction");
  1209.  
  1210.  
  1211. //disabled for a few seconds to stop from sound spam
  1212. Entity_SetInteractionDisabled("ThetaGate_Button", true);
  1213. Map_AddTimer("ThetaGateButtonInteractEnable", 2.5f, "ThetaGateButtonInteractEnable");
  1214.  
  1215. if (!mbTriedTheButton && Lever_GetState("ManualOverride_Lever") != 1)
  1216. {
  1217. mbTriedTheButton = true;
  1218. Map_AddTimer("3_OpeningMechanismBroken", 1,"TimerPlayVoice");
  1219. }
  1220. }
  1221.  
  1222. void ThetaGateButtonMalfunction(const tString &in asTimer)
  1223. {
  1224. Sound_CreateAtEntity("InactiveDoorButton", "01_03_upsilon_outside/SFX/broken_airlock/broken_airlock", "ThetaGate_Button", 0.0f, false);
  1225. }
  1226.  
  1227. void ThetaGateButtonInteractEnable(const tString &in asTimer)
  1228. {
  1229. //enable interaction again
  1230. Entity_SetInteractionDisabled("ThetaGate_Button", false);
  1231. }
  1232.  
  1233. //-------------------------------------------------------
  1234.  
  1235. void OnStartDoorDrain(const tString &in asEntity)
  1236. {
  1237. }
  1238.  
  1239. //-------------------------------------------------------
  1240.  
  1241. bool mbGateLampsOn = true;
  1242.  
  1243. void OnEndDoorDrain(const tString &in asEntity)
  1244. {
  1245. TimerFlickerGateLamps();
  1246. }
  1247.  
  1248. //-------------------------------------------------------
  1249.  
  1250. void TimerFlickerGateLamps(const tString& in asName="")
  1251. {
  1252. mbGateLampsOn = !mbGateLampsOn;
  1253. Lamp_SetLit("ThetaGateLamp_*",mbGateLampsOn,true);
  1254. Map_AddTimer("TimerFlickerGateLamps", cMath_RandRectf(0.05f,0.25f),"TimerFlickerGateLamps");
  1255. }
  1256.  
  1257. //-------------------------------------------------------
  1258.  
  1259. void OnChangeManualOverrideWheel(const tString &in asEntity, int alState)
  1260. {
  1261. if (!mbOverrideCylinderOut && alState == -1) return;
  1262. if (mbOverrideCylinderOut && alState == 1) return;
  1263.  
  1264. Entity_SetEffectsActive(asEntity, false, true);
  1265. Map_AddTimer(asEntity, 0.3, "TimerChangeToOverrideSlideCylinder");
  1266.  
  1267. Effect_Rumble_Start(0.4, 0.7);
  1268. Sound_CreateAtEntity("ManualOverrideRotate_1", "Entities_OceanBottom/objects/theta_door_open/cylinder/cylinder_rotate", "ManualOverride_Slide", 0.0f, false);
  1269. }
  1270.  
  1271. //-------------------------------------------------------
  1272.  
  1273. void TimerChangeToOverrideSlideCylinder(const tString &in asTimer)
  1274. {
  1275. bool bIsInteractedWith = Entity_IsInteractedWith(asTimer);
  1276. Player_ChangeStateToNormal();
  1277.  
  1278. /////////////////////////////////
  1279. // Switch entities
  1280. Entity_SetActive(asTimer, false);
  1281. Entity_SetActive("ManualOverride_Slide", true);
  1282. Prop_SetStaticPhysics("ManualOverride_Slide", false);
  1283.  
  1284. //////////////////////////////////////////////////////////////////////////
  1285. // Handle attachment so the transition between entities look right
  1286. Entity_RemoveEntityAttachment("ManualOverride_Slide");
  1287. Entity_RemoveEntityAttachment("ManualOverride_Wheel_Left");
  1288. Entity_AttachToEntity("ManualOverride_Wheel_Left", "ManualOverride_Slide", "", true);
  1289.  
  1290. //////////////////////////////////////////
  1291. // Seamless transition to new interaction
  1292. if (bIsInteractedWith) Entity_CallEntityInteract("ManualOverride_Slide");
  1293.  
  1294. //////////////////////////////////////////
  1295. // Effects
  1296. Entity_SetEffectsActive("ManualOverride_Slide", true, true);
  1297. }
  1298.  
  1299. //-------------------------------------------------------
  1300.  
  1301. bool CollisionOverrideSlideOut(const tString &in asParent, const tString &in asChild, int alState)
  1302. {
  1303. mbOverrideCylinderOut = true;
  1304. Entity_SetEffectsActive(asChild, false, true);
  1305. Entity_SetActive("ManualOverride_Slide_In", true);
  1306.  
  1307. Map_AddTimer(asChild, 0.3, "TimerChangeToOverrideRotateCylinder");
  1308.  
  1309. Effect_Rumble_Start(0.4, 0.7);
  1310. Sound_CreateAtEntity("ManualOverrideRotate_1", "Entities_OceanBottom/objects/theta_door_open/cylinder/cylinder_pull_end", "ManualOverride_Slide", 0.0f, false);
  1311.  
  1312. return false;
  1313. }
  1314.  
  1315. //-------------------------------------------------------
  1316.  
  1317. void TimerChangeToOverrideRotateCylinder(const tString &in asTimer)
  1318. {
  1319. bool bIsInteractedWith = Entity_IsInteractedWith(asTimer);
  1320. Player_ChangeStateToNormal();
  1321.  
  1322. /////////////////////////////////
  1323. // Switch entities
  1324. Entity_SetActive(asTimer, false);
  1325. Prop_SetStaticPhysics(asTimer, true);
  1326. Entity_SetActive("ManualOverride_Wheel_Left", true);
  1327.  
  1328. //////////////////////////////////////////////////////////////////////
  1329. // Handle attachment so the transition between entities look right
  1330. Entity_RemoveEntityAttachment("ManualOverride_Wheel_Left");
  1331. Entity_AttachToEntity(asTimer, "ManualOverride_Wheel_Left", "", true);
  1332.  
  1333. //////////////////////////////////////////
  1334. // Seamless transition to new interaction
  1335. if (bIsInteractedWith) Entity_CallEntityInteract("ManualOverride_Wheel_Left");
  1336.  
  1337. //////////////////////////////////////////
  1338. // Effects
  1339. Entity_SetEffectsActive("ManualOverride_Wheel_Left", true, true);
  1340. }
  1341.  
  1342. //-------------------------------------------------------
  1343.  
  1344. bool CollisionOverrideSlideIn(const tString &in asParent, const tString &in asChild, int alState)
  1345. {
  1346. mbOverrideCylinderOut = true;
  1347.  
  1348. Slide_SetLocked(asChild, true, true);
  1349. Entity_SetEffectsActive(asChild, false, true);
  1350.  
  1351. Lever_SetStuckState("ManualOverride_Lever", 0, true);
  1352. Entity_SetEffectsActive("ManualOverride_Lever", true, true);
  1353.  
  1354. Entity_SetEffectBaseColor("ManualOverride_Lamp", cColor_Red*1);
  1355. Lamp_SetLit("ManualOverride_Lamp", true, true);
  1356.  
  1357. Effect_Rumble_Start(0.4, 0.7);
  1358. Sound_CreateAtEntity("ManualOverrideRotate_1", "Entities_OceanBottom/objects/theta_door_open/cylinder/cylinder_push_end", "ManualOverride_Slide", 0.0f, false);
  1359. Entity_SetInteractionDisabled("ManualOverride_Wheel_*", true);
  1360. Entity_SetInteractionDisabled("ManualOverride_Slide", true);
  1361. Player_SetLookSpeedMul(0.2);
  1362. Player_FadeLookSpeedMulTo(1, 1);
  1363.  
  1364. return false;
  1365. }
  1366.  
  1367. //-------------------------------------------------------
  1368.  
  1369. void OnChangeOverrideLeverPulled(const tString &in asEntity, int alState)
  1370. {
  1371. if (alState == 1)
  1372. {
  1373. Map_AddTimer("StartOpenGateTimer", 2, "SequenceOpenThetame");
  1374. Entity_FadeEffectBaseColor("ManualOverride_Lamp", cColor_Green, 0.3);
  1375. Entity_SetEffectsActive("ManualOverride_Lever", false, true);
  1376.  
  1377. Effect_Rumble_Start(0.4, 0.7);
  1378. Sound_CreateAtEntity("ManualOverrideRotate_1", "Entities_OceanBottom/objects/theta_door_open/cylinder/lever_end", asEntity, 0.0f, false);
  1379.  
  1380. Entity_SetInteractionDisabled(asEntity, true);
  1381. Audio_ThetaGateStart();
  1382. }
  1383.  
  1384. }
  1385.  
  1386. //-------------------------------------------------------
  1387.  
  1388. cSequenceStatesData mOpenThetameSequence;
  1389.  
  1390. void SequenceOpenThetame(const tString &in asTimer)
  1391. {
  1392. Sequence_Begin("SequenceOpenThetame", mOpenThetameSequence);
  1393.  
  1394. if (Sequence_DoStepAndWait(1))
  1395. {
  1396. SlideDoor_SetOpenAmount("ThetaWarningLight_Gate_*", 1, false);
  1397. }
  1398. else if (Sequence_DoStepAndWait(2))
  1399. {
  1400. MoveObject_SetState("ThetaWarningLight_Base_*", 1);
  1401. }
  1402. else if (Sequence_DoStepAndWait(1))
  1403. {
  1404. /////////////////////////////////////////////
  1405. // TUrn off some lamps to put focus on door
  1406. Map_AddTimer("ThetaGateLamp_Top_1", 0, "TimerSetLampUnlit");
  1407. Map_AddTimer("ThetaGateLamp_Top_2", 0.4, "TimerSetLampUnlit");
  1408. Map_AddTimer("ThetaGateLamp_OverrideBox", 1, "TimerSetLampUnlit");
  1409. Map_AddTimer("ThetaGateLamp_OverrideBox_Spotlight", 1, "TimerFadeLightToBlack");
  1410. Map_AddTimer("ThetaGateLamp_OverrideBox_Pointlight", 1, "TimerFadeLightToBlack");
  1411.  
  1412. /////////////////////////////////////////////
  1413. // Turn on spinning warning lights
  1414. Lamp_SetLit("ThetaWarningLight_Lamp_*", true, true);
  1415. Prop_RotateToSpeed("ThetaWarningLight_Lamp_1", 5, 7.5, cVector3f(0, 0, 1), true, "");
  1416. Prop_RotateToSpeed("ThetaWarningLight_Lamp_2", 5, 7.5, cVector3f(0, 0, -1), true, "");
  1417. }
  1418. else if (Sequence_DoStepAndWait(8.5))
  1419. {
  1420. mlGateShakeID = Effect_Shake_Start(0.005, -1, 2, 0);
  1421. Effect_Shake_SetSourceEntity(mlGateShakeID, "ThetaGate_Down", 10, 25);
  1422.  
  1423. Entity_PlayAnimation("ThetaGate_Up", "Open", 0);
  1424. Entity_PlayAnimation("ThetaGate_Down", "Open", 0);
  1425. Map_AddTimer("ThetaGate_ClutchPS_1", 2, "TimerThetaGateClutchRelease");
  1426. Map_AddTimer("ThetaGate_ClutchPS_2", 3, "TimerThetaGateClutchRelease");
  1427. Map_AddTimer("ThetaGate_ClutchPS_3", 5, "TimerThetaGateClutchRelease");
  1428. Map_AddTimer("ThetaGate_ClutchPS_4", 6, "TimerThetaGateClutchRelease");
  1429. }
  1430. else if (Sequence_DoStepAndWait(0.25))
  1431. {
  1432. for (int i = 1; Entity_Exists("ThetaGate_BubblePS_" + i); i++)
  1433. {
  1434. Map_AddTimer("ThetaGate_BubblePS_" + i, cMath_RandRectf(0, 0.5),"TimerThetaGatePSDelay");
  1435. }
  1436. }
  1437. else if (Sequence_DoStepAndWait(11))
  1438. {
  1439. Effect_Shake_FadeOut(mlGateShakeID, 1);
  1440. mlGateShakeID = Effect_Shake_Start(0.0075, -1, 2, 0);
  1441. Effect_Shake_SetSourceEntity(mlGateShakeID, "ThetaGate_Down", 10, 25);
  1442.  
  1443. SlideDoor_SetOpenAmount("ThetaGate_Up", 1, false);
  1444. SlideDoor_SetOpenAmount("ThetaGate_Down", 0.875, false);
  1445.  
  1446. for (int i = 1; Entity_Exists("ThetaGate_DustFallPS_" + i); i++)
  1447. {
  1448. Map_AddTimer("ThetaGate_DustFallPS_" + i, cMath_RandRectf(0.4, 0.75),"TimerThetaGatePSDelay");
  1449. }
  1450. }
  1451. else if (Sequence_DoStepAndWait(1))
  1452. {
  1453. Effect_Shake_FadeOut(mlGateShakeID, 0.5);
  1454. Lever_SetAutoMoveEnabled("ThetaGate_Walkboard", true);
  1455. Lever_SetAutoMoveTarget("ThetaGate_Walkboard", 1);
  1456. }
  1457. else if (Sequence_DoStepAndWait(1))
  1458. {
  1459. Entity_PlayAnimation("ThetaGate_Left", "Open", 0);
  1460. Entity_PlayAnimation("ThetaGate_Right", "Open", 0);
  1461. }
  1462. else if (Sequence_DoStepAndWait(7))
  1463. {
  1464. mlGateShakeID = Effect_Shake_Start(0.0075, -1, 2, 0);
  1465. Effect_Shake_SetSourceEntity(mlGateShakeID, "ThetaGate_Down", 10, 25);
  1466.  
  1467. SlideDoor_SetOpenAmount("ThetaGate_Left", 1, false);
  1468. SlideDoor_SetOpenAmount("ThetaGate_Right", 1, false);
  1469. }
  1470. else if (Sequence_DoStepAndWait(0.5))
  1471. {
  1472. Effect_Shake_FadeOut(mlGateShakeID, 1);
  1473.  
  1474. Lamp_SetLit("ThetaWarningLight_Lamp_*", false, true);
  1475. Prop_RotateToSpeed("ThetaWarningLight_Lamp_1", 5, 0, cVector3f(0, 0, 1), false, "");
  1476. Prop_RotateToSpeed("ThetaWarningLight_Lamp_2", 5, 0, cVector3f(0, 0, -1), false, "");
  1477. }
  1478. else if (Sequence_DoStepAndWait(2))
  1479. {
  1480. MoveObject_SetState("ThetaWarningLight_Base_*", 0);
  1481. }
  1482. else if (Sequence_DoStepAndWait(2))
  1483. {
  1484. SlideDoor_SetOpenAmount("ThetaWarningLight_Gate_*", 0, false);
  1485. }
  1486.  
  1487. Sequence_End();
  1488. }
  1489.  
  1490. //-------------------------------------------------------
  1491.  
  1492. void TimerThetaGateClutchRelease(const tString &in asTimer)
  1493. {
  1494. /////////////////////
  1495. // Effects
  1496. ParticleSystem_CreateAtEntity(asTimer + "_Particles", "oneshot_sand_cascade.ps", asTimer, false);
  1497. }
  1498.  
  1499. //-------------------------------------------------------
  1500.  
  1501. void TimerThetaGatePSDelay(const tString &in asTimer)
  1502. {
  1503. // Create the particle system specified in the UserVar of the area
  1504. ParticleSystem_CreateAtEntity(asTimer + "_Particles", Entity_GetVarString(asTimer, ""), asTimer, false);
  1505. }
  1506.  
  1507. //-------------------------------------------------------
  1508.  
  1509. /////////////////////////////////////////
  1510. // Scene 3 Event D *Enter Theta*
  1511. /////////////////////////////////////////
  1512.  
  1513. //-------------------------------------------------------
  1514.  
  1515. cSequenceStatesData mEndLevelSequence;
  1516.  
  1517. void SequenceEndLevel(const tString &in asTimer)
  1518. {
  1519. Sequence_Begin("SequenceEndLevel", mEndLevelSequence);
  1520.  
  1521. if (Sequence_DoStepAndWait(0.025))
  1522. {
  1523. //Micro delay to stop enter water sound from playing when water plane spawned
  1524. }
  1525. else if (Sequence_DoStepAndWait(2.5))
  1526. {
  1527. //Delay for omnitool beep
  1528.  
  1529. Sound_Stop("Depth_Audio_PlayEnterWater", 0.015f);
  1530. }
  1531. else if (Sequence_DoStepAndWait(1.5))
  1532. {
  1533. Sound_CreateAtEntity("DoorsClosing", "02_04_theta_outside/SFX/theta_door_close_airlock", "ThetaGate_Left", 0, false);
  1534. SlideDoor_SetOpenAmount("ThetaGate_Left", 0, false);
  1535. SlideDoor_SetOpenAmount("ThetaGate_Right", 0, false);
  1536.  
  1537. Lamp_SetLit("AirlockLamp_*", true, true);
  1538.  
  1539. Effect_Shake_Start(0.005, 2, 0.5, 0);
  1540.  
  1541. Achievement_Unlock(eAchievement_Dunbat);
  1542. }
  1543. else if (Sequence_DoStepAndWait(0.5))
  1544. {
  1545. Music_Stop(2.5, eMusicPrio_BgAmb);
  1546. Sound_CreateAtEntity("AirlockSweetener", "02_04_theta_outside/SFX/theta_airlock_flush_sweetener", "Player");
  1547. }
  1548. else if (Sequence_DoStepAndWait(2.75))
  1549. {
  1550. cLux_AddDebugMessage("Calling deload!");
  1551. PreloadDeload();
  1552. }
  1553. else if (Sequence_DoStepAndWait(1))
  1554. {
  1555. SequenceAirlockDrains("");
  1556. }
  1557.  
  1558. Sequence_End();
  1559. }
  1560.  
  1561. //-------------------------------------------------------
  1562.  
  1563. void OnChange_AirlockButton(const tString &in asEntity, int alState)
  1564. {
  1565. SequenceEndLevel(""); //Old, this closes the entrance doors, then triggers SequenceAirlockDrains in end
  1566.  
  1567. Entity_SetActive("AirlockPanelToolArea_1", false);
  1568. //////////////////////////
  1569. //Turn off lights, some of them shine through door.
  1570. Light_SetVisible("SpotLight_9", false);
  1571. Light_SetVisible("SpotLight_5", false);
  1572. Light_SetVisible("SpotLight_3", false);
  1573. Light_SetVisible("SpotLight_4", false);
  1574. Light_SetVisible("SpotLight_1", false);
  1575. Light_SetVisible("SpotLight_2", false);
  1576. Light_SetVisible("ThetaGateLamp_OverrideBox_Spotlight", false);
  1577.  
  1578. Entity_SetActive("LiquidArea_1", true);
  1579.  
  1580. Entity_SetActive("BlockExitAirlock",true);
  1581. }
  1582.  
  1583. //-------------------------------------------------------
  1584.  
  1585. cSequenceStatesData mSequenceAirlockDrains;
  1586. void SequenceAirlockDrains(const tString &in asTimer)
  1587. {
  1588. Sequence_Begin("SequenceAirlockDrains", mSequenceAirlockDrains);
  1589.  
  1590. if (Sequence_DoStepAndWait(9.0))
  1591. {
  1592. LiquidArea_MoveLinearTo("LiquidArea_1", "LiquidArea_1_Target", 1, 1, 0.25);
  1593.  
  1594. AirlockEffectsFlushWater();
  1595.  
  1596. }
  1597. else if (Sequence_DoStepAndWait(6.0))
  1598. {
  1599. Map_SetUnderwater(false);
  1600. }
  1601. else
  1602. {
  1603.  
  1604. }
  1605.  
  1606. Sequence_End();
  1607. }
  1608.  
  1609. //-------------------------------------------------------
  1610. //Airlock audio
  1611. //{-------------------------------------------------------
  1612.  
  1613. void AirlockEffectsFlushWater()
  1614. {
  1615. Depth_Audio_AirlockDrainLeadInUW();
  1616. Depth_Audio_AirlockDrainLoopUW();
  1617. Map_AddTimer("StartingAirlockAirlockDrainUWStopTimer", 9.f, "StartingAirlockDrainUWStop");
  1618.  
  1619. //Sweetener and mixer
  1620. Sound_CreateAtEntity("StartingDrainingSweetenerUW", "04_02_tau_inside/SFX/airlock_start/draining_sweet_uw", "Player", 2.0f);
  1621. Sound_FadeGlobalVolume(0.7, 3.0f);
  1622. }
  1623.  
  1624. //-------------------------------------------------------
  1625.  
  1626. void StartingAirlockDrainUWStop(const tString &in asTimer)
  1627. {
  1628. Entity_SetActive("AMB_Airlock_Underwater", false);
  1629. Entity_SetActive("AMB_Airlock", true);
  1630. Sound_Stop("StartingDrainingSweetenerUW", 1.0f);
  1631. Depth_Audio_PlayLeaveWater();
  1632. Sound_CreateAtEntity("StartingAirlockPumpingAirLoop", "Entities_OceanBottom/airlock/air/pump/pump_loop_nointro", "PumpsSource_Start", 0.55f, false, 1.0f);
  1633. Depth_Audio_AirlockDrainLoopUWStop();
  1634. Depth_Audio_AirlockDrainLoopAir();
  1635. Map_AddTimer("StartingAirlockDrainingAirStopTimer", 4.5f, "StartingAirlockDrainingAirStop");
  1636. Sound_CreateAtEntity("AirlockDrainingAirSweetener", "02_04_theta_outside/amb/sweetener/theta_draining_water_sweetener", "Player", 1.5f, false, 1.0f);
  1637. Map_AddTimer("StopAirlockDrainAirSweet", 3.5f, "StopAirlockDrainAirSweet");
  1638.  
  1639. //Sweetener
  1640. Sound_CreateAtEntity("StartingAirlockDrainingSweetenerAir", "04_02_tau_inside/SFX/airlock_start/draining_sweet_air", "Player");
  1641. Sound_Stop("StartingAirlockDrainingSweetenerUW", 2.0f);
  1642. }
  1643.  
  1644. //-------------------------------------------------------
  1645.  
  1646. void StopAirlockDrainAirSweet(const tString &in asTimer)
  1647. {
  1648. Sound_Stop("AirlockDrainingAirSweetener", 3.5f);
  1649. }
  1650.  
  1651. void StartingAirlockDrainingAirStop(const tString &in asTimer)
  1652. {
  1653. Depth_Audio_AirlockDrainLoopAirStop();
  1654. Depth_Audio_AirlockDrainLeadOutAir();
  1655. Sound_Stop("StartingAirlockPumpingAirLoop", 0.25f);
  1656. Sound_CreateAtEntity("StartingAirlockPumpAirLeadOut", "Entities_OceanBottom/airlock/air/pump/pump_end", "PumpsSource_Start", 0.0f, false, 1.0f);
  1657. Sound_FadeGlobalVolume(1.0, 3.0f);
  1658. }
  1659.  
  1660. //End airlock audio
  1661. //}-------------------------------------------------------
  1662.  
  1663. void CameraInOutWater(int alState)
  1664. {
  1665. //Leaving water
  1666. if(alState == -1)
  1667. {
  1668. PreloadChangeOfMap();
  1669.  
  1670. Entity_SetActive("AMB_Airlock_Underwater", false);
  1671. Entity_SetActive("AMB_Airlock", true);
  1672.  
  1673. Decal_SetVisibleInArea(true, "AreaOffDecals", "leaking_single.mat");
  1674.  
  1675. ParticleSystem_SetVisible("0*ParticleSystem*", true);
  1676. Entity_SetActive("0*water_ripples*", true);
  1677.  
  1678. Depth_Audio_PlayLeaveWater();
  1679.  
  1680. Player_SetUnderwater(false);
  1681. Map_SetEnvironmentParticlesActive(false);
  1682.  
  1683. FogArea_SetVisible("FogArea_6", false);
  1684. }
  1685.  
  1686. //Back down in water (in case player jumps, crouches and what not, doin player things you know).
  1687. else
  1688. {
  1689. Entity_SetActive("AMB_Airlock", false);
  1690. Entity_SetActive("AMB_Airlock_Underwater", true);
  1691.  
  1692. Decal_SetVisibleInArea(false, "AreaOffDecals", "leaking_single.mat");
  1693.  
  1694. ParticleSystem_SetVisible("0*ParticleSystem*", false);
  1695. Entity_SetActive("0*water_ripples*", false);
  1696.  
  1697. Depth_Audio_PlayEnterWater();
  1698.  
  1699. Map_SetEnvironmentParticlesActive(true);
  1700. FogArea_SetVisible("FogArea_6", true);
  1701. }
  1702. }
  1703.  
  1704. //-------------------------------------------------------
  1705.  
  1706. /////////////////////////////////////////
  1707. // ==============
  1708. // PRELOAD
  1709. // ==============
  1710. /////////////////////////////////////////
  1711.  
  1712. //-------------------------------------------------------
  1713.  
  1714.  
  1715. bool PreloadDisabled(bool abCheckIfPreloading = true)
  1716. {
  1717. if(cLux_ScriptDebugOn())
  1718. {
  1719. cLux_AddDebugMessage("PRELOAD DISABLED!");
  1720. return true;
  1721. }
  1722.  
  1723. if(abCheckIfPreloading && Map_IsPreloading() == false)
  1724. {
  1725. return true;
  1726. }
  1727.  
  1728. return false;
  1729. }
  1730.  
  1731. //-------------------------------------------------------
  1732.  
  1733. void Preload()
  1734. {
  1735. if(PreloadDisabled(false)) return;
  1736.  
  1737. Map_Preload("02_05_theta_inside.hpm");
  1738. }
  1739.  
  1740. //-------------------------------------------------------
  1741.  
  1742. void PreloadDeload()
  1743. {
  1744. if(PreloadDisabled()) return;
  1745.  
  1746. cLux_AddDebugMessage("DELOAD!");
  1747. mbDeloaded = true;
  1748. Map_Deload("Transfer2425");
  1749. Map_SetPreloadPriority(eWorldStreamPriority_High);
  1750. }
  1751.  
  1752. //-------------------------------------------------------
  1753.  
  1754. void PreloadChangeOfMap()
  1755. {
  1756. if(PreloadDisabled())
  1757. {
  1758. Map_AddTimer("ManualChangeMap", 13, "PreloadTimer");
  1759. return;
  1760. }
  1761.  
  1762. Map_AddTimer("FadeGlobal", 0, "PreloadTimer");
  1763. Map_AddTimer("ChangeMap", 10, "PreloadTimer");
  1764. Map_AddTimer("ChangeMapNotReady", 14, "PreloadTimer");
  1765. }
  1766.  
  1767. //-------------------------------------------------------
  1768. bool mbGlobalCopyCompleted = false;
  1769. void PreloadTimer(const tString &in asTimer)
  1770. {
  1771. ////////////////////////////
  1772. //Preload - Change map globals when possible.
  1773. if(asTimer == "FadeGlobal")
  1774. {
  1775. if(mbGlobalCopyCompleted == false) Map_AddTimer("FadeGlobal", 1.0, "PreloadTimer");
  1776. else
  1777. {
  1778. Map_Preset_Fade("Preset2.5", 0.1);
  1779. return;
  1780. }
  1781.  
  1782. mbGlobalCopyCompleted = Map_CopyGlobalSettings(Map_GetPreloadMap(), 0.9);
  1783. }
  1784.  
  1785. if(asTimer == "ManualChangeMap")
  1786. PreloadManualChangeMap();
  1787.  
  1788. ////////////////////////////
  1789. //Preload - Change map when possible
  1790. if(asTimer == "ChangeMap")
  1791. {
  1792. if(Map_IsPreloadCompleted())
  1793. {
  1794. Entity_SetActive("ThetaGate_Walkboard", false);
  1795. Entity_SetActive("AirlockDoor_1x", false);
  1796. Entity_SetActive("AirlockDoor_2x", false);
  1797.  
  1798. Description_SetForceFading(true);
  1799. Map_ChangeMap("02_05_theta_inside.hpm", "", "Transfer2425", "", "");
  1800. }
  1801. else Map_AddTimer("ChangeMap", 1.1, "PreloadTimer");
  1802. }
  1803.  
  1804. if(asTimer == "ChangeMapNotReady")
  1805. {
  1806. Description_Add("02_05_theta_inside", "ScanRoom_Legacy_Loading", 10, false);
  1807. Map_SetPreloadPriority(eWorldStreamPriority_VeryHigh);
  1808. }
  1809. }
  1810.  
  1811. //-------------------------------------------------------
  1812.  
  1813. void PreloadManualChangeMap()
  1814. {
  1815. Map_ChangeMap("02_05_theta_inside.hpm", "PlayerStartArea_1", "", "");
  1816. }
  1817.  
  1818. //-------------------------------------------------------
  1819.  
  1820. /////////////////////////////////////////
  1821. // ==============
  1822. // TERMINALS
  1823. // ==============
  1824. /////////////////////////////////////////
  1825.  
  1826. //-------------------------------------------------------
  1827.  
  1828. /////////////////////////////////////////
  1829. // Terminal *Zeppelin A*
  1830. /////////////////////////////////////////
  1831.  
  1832. //-------------------------------------------------------
  1833.  
  1834. void OnGuiZeppelinA(const tString&in asEntityName, float afTimeStep)
  1835. {
  1836. ImGui_SetTransCategory("02_04_theta_outside");
  1837.  
  1838. cImGuiLabelData label;
  1839. label.mFont.SetFile("sansation_medium.fnt");
  1840. label.mFont.mvSize = cVector2f(50, 50);
  1841.  
  1842. StationGuiBG_Scanlines();
  1843. StationGuiBG_Backdrop();
  1844.  
  1845. if (mfTotalDistToLanding<0.0f)
  1846. return;
  1847.  
  1848. float fDist = 1.0f-(mfDistToLanding/mfTotalDistToLanding);
  1849. cVector3f vMapStart = cVector3f(-345,-300,1.0f);
  1850. cVector3f vMapEnd = cVector3f(-425.0f,-120.0f,1.0f);
  1851. cVector3f vOffs = (vMapEnd-vMapStart)*fDist;
  1852. cVector3f vMapCurrent = vMapStart+vOffs;
  1853.  
  1854. float fDepth=144.0f+(mvStartingPos.y-mvLandingPos.y)*fDist;
  1855.  
  1856. ImGui_GroupBegin(cVector3f_Zero, ImGui_GetSize());
  1857.  
  1858. ////////////////////
  1859. // Map
  1860. ImGui_DoImage(cImGuiGfx("zepmap", eImGuiGfx_Texture),
  1861. vMapCurrent, ImGui_NrmSizeGroup(cVector2f(1.75f,1.75f)) );
  1862.  
  1863. ////////////////////
  1864. // Cross
  1865. ImGui_DoImage(cImGuiGfx("zepcross", eImGuiGfx_Texture),
  1866. ImGui_NrmPosGroup(cVector3f(0.4,0.4,2.0f)), ImGui_NrmSizeGroup(cVector2f(0.2f,0.2f)) );
  1867.  
  1868. ////////////////////
  1869. // Distance
  1870. tString sDist = ""+mfDistToLanding;
  1871. int lDotPos = cString_GetLastCharPos(sDist, '.');
  1872. sDist = cString_Sub(sDist, 0, lDotPos+3);
  1873.  
  1874. tString sDepth = ""+fDepth;
  1875. lDotPos = cString_GetLastCharPos(sDepth, '.');
  1876. sDepth = cString_Sub(sDepth, 0, lDotPos+3);
  1877.  
  1878. ImGui_DoLabelExt("ZepGui_Dest", label, cVector3f(120.0f,420.0f,1.0f), cVector2f_MinusOne, 1.0f);
  1879.  
  1880. tWString sDistMsg = cResources_Translate("02_04_theta_outside", "ZepGui_DistanceDepth");
  1881.  
  1882. // Resize for translation here to get a constant font size instead of one that changes depending on dist/depth
  1883. ImGui_ResizeFontToFit(sDistMsg, label.mFont, ImGui_GetCurrentGroupSize().x-240);
  1884.  
  1885. sDistMsg = cString_ReplaceStringToW(sDistMsg, cString_To16Char("%dist"), cString_To16Char(sDist));
  1886. sDistMsg = cString_ReplaceStringToW(sDistMsg, cString_To16Char("%depth"), cString_To16Char(sDepth));
  1887.  
  1888. ImGui_SetTextOverride(sDistMsg);
  1889. ImGui_DoLabelExt("", label, cVector3f(120.0f,480.0f,1.0f), cVector2f_MinusOne, 1.0f);
  1890.  
  1891. ImGui_GroupEnd();
  1892. }
  1893.  
  1894. //-------------------------------------------------------
  1895.  
  1896. /////////////////////////////////////////
  1897. // Terminal *Zeppelin B*
  1898. /////////////////////////////////////////
  1899.  
  1900. //-------------------------------------------------------
  1901. int mlZepInfoImage;
  1902. float mfZepInfoTimer;
  1903.  
  1904. //-------------------------------------------------------
  1905.  
  1906. void OnGuiZeppelinB(const tString&in asEntityName, float afTimeStep)
  1907. {
  1908. ImGui_SetTransCategory("02_04_theta_outside");
  1909.  
  1910. StationGuiBG_Scanlines();
  1911. StationGuiBG_Backdrop();
  1912.  
  1913. ImGui_GroupBegin(cVector3f_Zero, ImGui_GetSize());
  1914.  
  1915. mfZepInfoTimer+=afTimeStep;
  1916. if (mfZepInfoTimer>2.0f)
  1917. {
  1918. mfZepInfoTimer-=2.0f;
  1919. mlZepInfoImage++;
  1920. if (mlZepInfoImage>4)
  1921. {
  1922. mlZepInfoImage=1;
  1923. }
  1924. }
  1925.  
  1926. ////////////////////
  1927. // Map
  1928. ImGui_DoImage(cImGuiGfx("zepinfo"+mlZepInfoImage+".dds", eImGuiGfx_Texture),
  1929. cVector3f(0,0,10), ImGui_NrmSizeGroup(cVector2f_One) );
  1930.  
  1931. ImGui_GroupEnd();
  1932. }
  1933.  
  1934. //-------------------------------------------------------
  1935.  
  1936. void OnGuiZepCath(const tString&in asEntityName, float afTimeStep)
  1937. {
  1938. StationGuiBG_Scanlines();
  1939. Depth_ImGui_CathPortrait(afTimeStep);
  1940. }
  1941.  
  1942. //-------------------------------------------------------
  1943.  
  1944. //////////////////////////////////////////////////////////////////////////////////////////
  1945. // ==============
  1946. // AUDIO
  1947. // ==============
  1948. //{//////////////////////////////////////////////////////////////////////////////////////
  1949.  
  1950. //-------------------------------------------------------
  1951.  
  1952. void SetupAudio()
  1953. {
  1954. //Sound_SetGlobalVolume(0.0f, eSoundEntryType_WorldAll);
  1955. // Music_FadeVolumeMul(0.0f, 1.0f);
  1956. // Map_AddTimer("FadeInAudio", 0.5f, "AudioHandler");
  1957. }
  1958.  
  1959. //-------------------------------------------------------
  1960.  
  1961. void AudioHandler(const tString &in asTimer)
  1962. {
  1963. if(asTimer=="FadeInAudio")
  1964. {
  1965. Sound_FadeGlobalVolume(1.0f, 3.0f, eSoundEntryType_WorldAll);
  1966. Music_FadeVolumeMul(1.0f, 3.0f);
  1967. }
  1968. if(asTimer=="FadeDownDoorSeq")
  1969. {
  1970. Sound_FadeGlobalVolume(0.4f, 3.0f, eSoundEntryType_WorldAll);
  1971. Map_AddTimer("FadeUpDoorSeq", 20.f, "AudioHandler");
  1972. }
  1973. if(asTimer=="FadeUpDoorSeq")
  1974. {
  1975. Sound_FadeGlobalVolume(1.0f, 8.0f, eSoundEntryType_WorldAll);
  1976. }
  1977. }
  1978.  
  1979. //-------------------------------------------------------
  1980. //Landing sequence
  1981. bool Audio_StartLandingSeq(const tString &in asParent, const tString &in asChild, int alState)
  1982. {
  1983. cLux_AddDebugMessage("Start landing sound");
  1984. Sound_CreateAtEntity("ZeppelinLandingSeq", "NPC_Zeppelin/SFX/linear/landing_sequence_onboard", "Player");
  1985. Sound_Stop("ZeppelinLiftEngineMotion", 35.0f);
  1986.  
  1987. Sound_FadeGlobalVolume(0.7f, 10.0f, eSoundEntryType_AllExceptGui);
  1988.  
  1989. Map_AddTimer("FadeUpPostApproach", 25.0f, "FadeUpPostApproach");
  1990. return false;
  1991. }
  1992.  
  1993. void FadeUpPostApproach(const tString &in asTimer)
  1994. {
  1995. Sound_FadeGlobalVolume(1.0f, 10.0f, eSoundEntryType_AllExceptGui);
  1996. }
  1997.  
  1998. //-------------------------------------------------------
  1999. //Gate sequence
  2000. void Audio_ThetaGateStart()
  2001. {
  2002. Sound_CreateAtEntity("ThetaGateSequence", "02_04_theta_outside/SFX/theta_door_Sequence", "ThetaGateSoundSource");
  2003. Map_AddTimer("ThetaGateSequenceMusic", 15.f, "ThetaGateSequence");
  2004. Map_AddTimer("FadeDownDoorSeq", 6.0f, "AudioHandler");
  2005. Map_AddTimer("StopAmbientMusicQuickly", 1.0f, "AmbientMusicHandler");
  2006. mbAmbientMusicAllowed = false;
  2007.  
  2008. //Remove anything that might overlap
  2009. Entity_SetActive("GraveyardTrigger", false);
  2010. Map_RemoveTimer("TimerGraveyardMusic");
  2011. Music_Stop(3.0f, eMusicPrio_BgAmb);
  2012. }
  2013.  
  2014. //-------------------------------------------------------
  2015.  
  2016. void ThetaGateSequence (const tString &in asTimer)
  2017. {
  2018. //Start music and fade sound
  2019. if(asTimer=="ThetaGateSequenceMusic")
  2020. {
  2021. cLux_AddDebugMessage("Fading Down Theta Gate");
  2022. Music_PlayExt("02_04_gate", false, 0.85, 1, 0, 0, eMusicPrio_BigEvent, true);
  2023. Sound_Fade("ThetaGateSequence", 0.85f, 10.0f);
  2024. Map_AddTimer("ThetaGateFadeUp", 12.0f, "ThetaGateSequence");
  2025. }
  2026. //Fade up gate sound after music
  2027. else if(asTimer=="ThetaGateFadeUp")
  2028. {
  2029. cLux_AddDebugMessage("Fading Up Theta Gate");
  2030. Sound_Fade("ThetaGateSequence", 1.f, 4.0f);
  2031. }
  2032. }
  2033.  
  2034. //-------------------------------------------------------
  2035. /**
  2036. bool GraveyardMusic(const tString &in asParent, const tString &in asChild, int alState)
  2037. {
  2038. Map_AddTimer("StopAmbientMusicQuickly", 1.0f, "AmbientMusicHandler");
  2039. Map_AddTimer("TimerGraveyardMusic", cMath_RandRectf(2.0f,2.5f), "StartGraveyardMusic");
  2040. return false;
  2041. }
  2042.  
  2043. void StartGraveyardMusic(const tString &in asTimer)
  2044. {
  2045. Music_Play("02_04_graveyard", 0.75f, false, eMusicPrio_MinorEvent);
  2046. Map_AddTimer("StartAmbient", cMath_RandRectf(5.0f,8.0f), "AmbientMusicHandler");
  2047. }
  2048. **/
  2049. //-------------------------------------------------------
  2050.  
  2051. /**
  2052. *Simple ambient music player that fades the ambience randomly whilst playing to stop it from getting repetitive
  2053. **/
  2054.  
  2055. bool mbAmbientMusicPlaying = false;
  2056. bool mbAmbientMusicAllowed = true;
  2057. float gfAmbientMusicMul = 1.0f;
  2058.  
  2059. void AmbientMusicHandler(const tString &in asTimer)
  2060. {
  2061. if (asTimer=="StartAmbient" && mbAmbientMusicPlaying==false && mbAmbientMusicAllowed==true)
  2062. {
  2063. Music_PlayExt(gsThetaExtMusicStage1, true, 0.75f, 1.0f, cMath_RandRectf(3.f,5.f), 0.0f, eMusicPrio_BgAmb, true);
  2064.  
  2065. cLux_AddDebugMessage("Ambient music triggering");
  2066.  
  2067. mbAmbientMusicPlaying = true;
  2068.  
  2069. //Dynamic fades
  2070. Map_AddTimer("RandomFadeRider", cMath_RandRectf(10.f,20.f), "AmbientMusicHandler");
  2071. Map_AddTimer("FadeOut", cMath_RandRectf(120.f,180.f), "AmbientMusicHandler");
  2072. Map_RemoveTimer("StopAmbientMusic");
  2073. Map_RemoveTimer("StopAmbientMusicQuickly");
  2074. }
  2075.  
  2076. else if (asTimer=="StartAmbient" && mbAmbientMusicPlaying==false && mbAmbientMusicAllowed==false)
  2077. {
  2078. Map_AddTimer("StartAmbient", cMath_RandRectf(10.f,20.f), "AmbientMusicHandler");
  2079. }
  2080.  
  2081. else if (asTimer=="StopAmbientMusic" && mbAmbientMusicPlaying==true)
  2082. {
  2083. Music_Stop(4.5f, eMusicPrio_BgAmb);
  2084. Map_RemoveTimer("RandomFadeRider");
  2085. Map_RemoveTimer("FadeOut");
  2086. Map_RemoveTimer("StartAmbient");
  2087. Music_FadeVolumeMul(1.0f,1.0f);
  2088. mbAmbientMusicPlaying = false;
  2089. }
  2090. else if (asTimer=="StopAmbientMusicQuickly" && mbAmbientMusicPlaying==true)
  2091. {
  2092. cLux_AddDebugMessage("Stop Ambient Music Quickly Triggered");
  2093. Music_Stop(1.5f, eMusicPrio_BgAmb);
  2094. Map_RemoveTimer("StartAmbient");
  2095. Map_RemoveTimer("RandomFadeRider");
  2096. Map_RemoveTimer("FadeOut");
  2097. Music_FadeVolumeMul(1.0f,1.0f);
  2098. mbAmbientMusicPlaying = false;
  2099. }
  2100.  
  2101. else if(asTimer=="RandomFadeRider")
  2102. {
  2103. Music_PlayExt(gsThetaExtMusicStage1, true, 0.5f*gfAmbientMusicMul, 1.0f, cMath_RandRectf(5.f,8.f), 0.0f, eMusicPrio_BgAmb, true);
  2104.  
  2105. cLux_AddDebugMessage("Ambient Music Fading");
  2106. gfAmbientMusicMul = cMath_RandRectf(0.35f, 1.2f);
  2107. Map_AddTimer("RandomFadeRider", cMath_RandRectf(10.f,15.f), "AmbientMusicHandler");
  2108. }
  2109.  
  2110. else if(asTimer=="FadeOut")
  2111. {
  2112. cLux_AddDebugMessage("Ambient Music Fading Out");
  2113. Music_Stop(cMath_RandRectf(8.f,12.f), eMusicPrio_BgAmb);
  2114. mbAmbientMusicPlaying = false;
  2115.  
  2116. Map_RemoveTimer("RandomFadeRider");
  2117. Map_AddTimer("StartAmbient", cMath_RandRectf(20.f,35.f), "AmbientMusicHandler");
  2118. }
  2119.  
  2120. cLux_AddDebugMessage("Ambient Music Playing is "+mbAmbientMusicPlaying);
  2121. }
  2122.  
  2123.  
  2124. //}ENDAUDIO--------------------------------------------
  2125. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement