Advertisement
ev88

Untitled

Oct 5th, 2016
294
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.76 KB | None | 0 0
  1. //-----------------------------------------------------------------------------
  2. // Fallen Empire: Legions
  3. // Copyright (C) GarageGames.com, Inc.
  4. //-----------------------------------------------------------------------------
  5.  
  6. function GameOptionsBackButton::onClick(%this)
  7. {
  8. GameOptionsGui.close();
  9. }
  10.  
  11. function GameOptionsGui::open(%this)
  12. {
  13. Canvas.pushDialog(GameOptionsGui);
  14. slideElement(GameOptionsHandle, -400, 0, 0, 0, 500);
  15. }
  16.  
  17. function GameOptionsGui::close(%this)
  18. {
  19. Legions::exportPrefs();
  20. slideElement(GameOptionsHandle, 0, 0, -400, 0, 500);
  21. GameOptionsSwitchButton1.setVisible(true);
  22. GameOptionsSwitchButton2.setVisible(false);
  23. HudOptionsList.setVisible(false);
  24. GameOptionsScroll.setVisible(true);
  25. schedule(500, 0, PopGameOptions);
  26. }
  27.  
  28. function PopGameOptions()
  29. {
  30. canvas.popDialog(GameOptionsGui);
  31. }
  32.  
  33. function GameOptionsList::populate(%this)
  34. {
  35. %this.clear();
  36.  
  37. %yesNoList = "Yes" TAB "No";
  38.  
  39. %this.addRow("Third Person Camera", %yesNoList, true, "onThirdPersonChanged", 0, 0, true);
  40.  
  41. %fovList = GetIncrementalList(90, 130, 1);
  42. %this.addRow("Camera FOV", %fovList, false, "onFOVOptionChanged", 0, 0, true);
  43.  
  44. %sensitivityList = GetIncrementalList(0, 100, 2);
  45. %this.addRow("Mouse Speed", %sensitivityList, false, "onSensitivityOptionChanged", 0, 0, true);
  46.  
  47. //%this.addRow("Invert Mouse X", %yesNoList, true, "onInvertMouseXOptionChanged", 0, 0);
  48. %this.addRow("Invert Mouse Y", %yesNoList, true, "onInvertMouseYOptionChanged", 0, 0);
  49.  
  50. %volumeList = GetIncrementalList(0, 100, 5);
  51. %this.addRow("Master Volume", %volumeList, false, "onVolumeOptionChanged", 0, 0, true);
  52. %this.addRow("Game Events Volume", %volumeList, false, "onGameEventsVolumeOptionChanged", 0, 0, true);
  53. %this.addRow("Effects Volume", %volumeList, false, "onEffectsVolumeOptionChanged", 0, 0, true);
  54. %this.addRow("Overdrive Volume", %volumeList, false, "onOverdriveVolumeOptionChanged", 0, 0, true);
  55. %this.addRow("Music Volume", %volumeList, false, "onMusicVolumeOptionChanged", 0, 0, true);
  56.  
  57. %this.addRow("Health Warning Sound", %yesNoList, true, "onHealthWarningOptionChanged", 0, 0);
  58. %this.addRow("Overdrive Notify Sound", %yesNoList, true, "onOverdriveNotifyOptionChanged", 0, 0);
  59. %this.addRow("Hit Notify Sound", %yesNoList, true, "onHitNotifyOptionChanged", 0, 0);
  60.  
  61. %this.addRow("Show Chat Messages", %yesNoList, true, "onShowChatMsgChanged", 0, 0);
  62. %this.addRow("Show Game Messages", %yesNoList, true, "onShowGameMsgsChanged", 0, 0);
  63.  
  64. %this.addRow("Sniper Hold Toggle", %yesNoList, false, "onSniperHoldOptionChanged", 0, 0, true);
  65.  
  66. %this.addRow("Toggle Zoom", %yesNoList, false, "onZoomToggleChanged", 0, 0, true);
  67.  
  68. %chatAutohideTimeList = GetIncrementalList(1, 10, 1);
  69. %this.addRow("Chat Autohide Time", %chatAutohideTimeList, false, "onChatAutohideTimeChanged", 0, 0);
  70.  
  71. %quickChatList = "On" TAB "Team Only" TAB "Off";
  72. %this.addRow("Quick-Chat Sounds", %quickChatList, true, "onQuickChatSoundsChanged", 0, 0);
  73.  
  74. %quickChatVoiceList = $Client::QuickChat::Voices;
  75. %this.addRow("Quick-Chat Voice", %quickChatVoiceList, true, "onQuickChatVoiceChanged", 0, 0);
  76. }
  77.  
  78. function GameOptionsList::onWake(%this)
  79. {
  80. %this.populate();
  81.  
  82. %thirdPerson = $Pref::Player::ThirdPersonCamera ? "Yes" : "No";
  83. %this.selectOption(0, %thirdPerson);
  84.  
  85. %FOV = $Pref::Player::DefaultFOV;
  86. %this.selectOption(1, %FOV);
  87.  
  88. %mouseSpeed = (($Pref::Input::MouseSensitivity - 0.01) / 4) * 100;
  89. %this.selectOption(2, %mouseSpeed);
  90.  
  91. //%invertX = $Pref::Input::MouseInvertXAxis ? "Yes" : "No";
  92. //%this.selectOption(3, %invertX);
  93.  
  94. %invertY = $Pref::Input::MouseInvertYAxis ? "Yes" : "No";
  95. %this.selectOption(3, %invertY);
  96.  
  97. %volume = $pref::SFX::masterVolume * 100;
  98. %this.selectOption(4, mFloor((%volume + 2.5) / 5) * 5);
  99.  
  100. %volume = $Pref::Sfx::ChannelVolume2 * 100;
  101. %this.selectOption(5, mFloor((%volume + 2.5) / 5) * 5);
  102.  
  103. %volume = $Pref::Sfx::ChannelVolume3 * 100;
  104. %this.selectOption(6, mFloor((%volume + 2.5) / 5) * 5);
  105.  
  106. %volume = $Pref::Sfx::ChannelVolume4 * 100;
  107. %this.selectOption(7, mFloor((%volume + 2.5) / 5) * 5);
  108.  
  109. %volume = $Pref::Sfx::ChannelVolume5 * 100;
  110. %this.selectOption(8, mFloor((%volume + 2.5) / 5) * 5);
  111.  
  112. %healthWarn = $Pref::Player::PlayHealthWarningSound ? "Yes" : "No";
  113. %this.selectOption(9, %healthWarn);
  114.  
  115. %odNotify = $Pref::Player::PlayOverdriveNotifySound ? "Yes" : "No";
  116. %this.selectOption(10, %odNotify);
  117.  
  118. %hitNotify = $Pref::Player::PlayHitNotifySound ? "Yes" : "No";
  119. %this.selectOption(11, %hitNotify);
  120.  
  121. %showChat = $Pref::Player::ChatDisplayChatMessages ? "Yes" : "No";
  122. %this.selectOption(12, %showChat);
  123.  
  124. %showGame = $Pref::Player::ChatDisplayGameMessages ? "Yes" : "No";
  125. %this.selectOption(13, %showGame);
  126.  
  127. %showGame = $Pref::Player::SniperHoldToCharge ? "Yes" : "No";
  128. %this.selectOption(14, %showGame);
  129.  
  130. %showGame = $Pref::Player::ToggleZoom ? "Yes" : "No";
  131. %this.selectOption(15, %showGame);
  132.  
  133. %chatAutohideTime = $Pref::Player::ChatAutohideLineTimeout / 0.8;
  134. %this.selectOption(16, %chatAutohideTime);
  135.  
  136. if($Pref::Player::QuickChatSoundSetting == 1)
  137. %quickChatSound = "On";
  138. else if($Pref::Player::QuickChatSoundSetting == 2)
  139. %quickChatSound = "Team Only";
  140. else
  141. %quickChatSound = "Off";
  142.  
  143. %this.selectOption(16, %quickChatSound);
  144.  
  145. %quickChatVoice = strlwr($Pref::Player::QuickChatVoice);
  146. %this.selectOption(17, %quickChatVoice);
  147. }
  148.  
  149. function GetIncrementalList(%start, %end, %increment)
  150. {
  151. %list = %start;
  152. for (%i = %start + %inc; %i <= %end; %i += %increment)
  153. %list = %list TAB %i;
  154.  
  155. return %list;
  156. }
  157.  
  158. function onThirdPersonChanged(%direction, %row)
  159. {
  160. $Pref::Player::ThirdPersonCamera = GameOptionsList.getCurrentOption(%row) $= "Yes";
  161. if(isObject(ServerConnection))
  162. ServerConnection.setFirstPerson(!$Pref::Player::ThirdPersonCamera);
  163. }
  164.  
  165. function onVolumeOptionChanged(%direction, %row)
  166. {
  167. $Pref::SFX::MasterVolume = GameOptionsList.getCurrentOption(%row) / 100;
  168. sfxSetMasterVolume($Pref::SFX::MasterVolume);
  169. sfxPlayOnce(AudioGui, "legions/data/sound/game/CTF/LowTimeWarn");
  170. }
  171.  
  172. function onGameEventsVolumeOptionChanged(%direction, %row)
  173. {
  174. $Pref::Sfx::ChannelVolume2 = GameOptionsList.getCurrentOption(%row) / 100;
  175. sfxSetChannelVolume($AudioType::GameEvents, $Pref::Sfx::ChannelVolume2);
  176. sfxPlayOnce(AudioGameEvent, "legions/data/sound/game/CTF/LowTimeWarn");
  177. }
  178.  
  179. function onEffectsVolumeOptionChanged(%direction, %row)
  180. {
  181. $Pref::Sfx::ChannelVolume3 = GameOptionsList.getCurrentOption(%row) / 100;
  182. sfxSetChannelVolume($AudioType::Effects, $Pref::Sfx::ChannelVolume3);
  183. sfxPlayOnce(EffectsVolumeOption, "legions/data/sound/game/CTF/LowTimeWarn");
  184. }
  185.  
  186. function onOverdriveVolumeOptionChanged(%direction, %row)
  187. {
  188. $Pref::Sfx::ChannelVolume4 = GameOptionsList.getCurrentOption(%row) / 100;
  189. sfxSetChannelVolume($AudioType::Overdrive, $Pref::Sfx::ChannelVolume4);
  190. sfxPlayOnce(OverdriveVolumeOption, "legions/data/sound/game/CTF/LowTimeWarn");
  191. }
  192.  
  193. function onMusicVolumeOptionChanged(%direction, %row)
  194. {
  195. $Pref::Sfx::ChannelVolume5 = GameOptionsList.getCurrentOption(%row) / 100;
  196. sfxSetChannelVolume($AudioType::Music, $Pref::Sfx::ChannelVolume5);
  197. sfxPlayOnce(MusicVolumeOption, "legions/data/sound/game/CTF/LowTimeWarn");
  198. }
  199.  
  200. function onSensitivityOptionChanged(%direction, %row)
  201. {
  202. $pref::Input::MouseSensitivity = ((GameOptionsList.getCurrentOption(%row) / 100) * 4) + 0.01;
  203. }
  204.  
  205. function onFOVOptionChanged(%direction, %row)
  206. {
  207. $Pref::Player::DefaultFOV = GameOptionsList.getCurrentOption(%row);
  208. }
  209.  
  210. function onInvertMouseXOptionChanged(%direction, %row)
  211. {
  212. $Pref::Input::MouseInvertXAxis = GameOptionsList.getCurrentOption(%row) $= "Yes";
  213. }
  214.  
  215. function onInvertMouseYOptionChanged(%direction, %row)
  216. {
  217. $Pref::Input::MouseInvertYAxis = GameOptionsList.getCurrentOption(%row) $= "Yes";
  218. }
  219.  
  220. function onHealthWarningOptionChanged(%direction, %row)
  221. {
  222. $Pref::Player::PlayHealthWarningSound = GameOptionsList.getCurrentOption(%row) $= "Yes";
  223. }
  224.  
  225. function onOverdriveNotifyOptionChanged(%direction, %row)
  226. {
  227. $Pref::Player::PlayOverdriveNotifySound = GameOptionsList.getCurrentOption(%row) $= "Yes";
  228. }
  229.  
  230. function onHitNotifyOptionChanged(%direction, %row)
  231. {
  232. $Pref::Player::PlayHitNotifySound = GameOptionsList.getCurrentOption(%row) $= "Yes";
  233. }
  234.  
  235. function onQuickChatVoiceChanged(%direction, %row)
  236. {
  237. $Pref::Player::QuickChatVoice = GameOptionsList.getCurrentOption(%row);
  238. createChatRoot($Pref::Player::QuickChatVoice);
  239. }
  240.  
  241. function onQuickChatSoundsChanged(%direction, %row)
  242. {
  243. %selected = GameOptionsList.getCurrentOption(%row);
  244.  
  245. if(%selected $= "On")
  246. $Pref::Player::QuickChatSoundSetting = 1;
  247. else if(%selected $= "Team Only")
  248. $Pref::Player::QuickChatSoundSetting = 2;
  249. else
  250. $Pref::Player::QuickChatSoundSetting = 0;
  251. }
  252.  
  253. function onShowChatMsgChanged(%direction, %row)
  254. {
  255. $Pref::Player::ChatDisplayChatMessages = GameOptionsList.getCurrentOption(%row) $= "Yes";
  256. }
  257.  
  258. function onSniperHoldOptionChanged(%direction, %row)
  259. {
  260. $Pref::Player::SniperHoldToCharge = GameOptionsList.getCurrentOption(%row) $= "Yes";
  261. }
  262.  
  263. function onZoomToggleChanged(%direction, %row)
  264. {
  265. $Pref::Input::ToggleZoom = GameOptionsList.getCurrentOption(%row) $= "Yes";
  266. }
  267.  
  268. function onShowGameMsgsChanged(%direction, %row)
  269. {
  270. $Pref::Player::ChatDisplayGameMessages = GameOptionsList.getCurrentOption(%row) $= "Yes";
  271. }
  272.  
  273. function onChatAutohideTimeChanged(%direction, %row)
  274. {
  275. %selection = GameOptionsList.getCurrentOption(%row);
  276.  
  277. $Pref::Player::ChatAutohideLineTimeout = 0.8 * %selection;
  278. $Pref::Player::ChatAutohideMinLineDelay = 0.2 * %selection;
  279. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement