Advertisement
Guest User

Untitled

a guest
Oct 27th, 2016
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.46 KB | None | 0 0
  1. /*--------------------------------------------------------------------
  2. file: initAddon.sqf
  3. ==============
  4. Author: Liquid <wogames.info>
  5. Description: Init
  6. --------------------------------------------------------------------*/
  7.  
  8. #define IDD_VIEWDISTMUTING 555000
  9. #define DIK_F1 0x3B
  10. #define DIK_F2 0x3C
  11. #define DIK_F3 0x3D
  12. #define DIK_F4 0x3E
  13. #define DIK_HOME 0xC7
  14.  
  15. if (isDedicated) exitWith {};
  16.  
  17. handler = compile preprocessFileLineNumbers "wog_volumeVDPresets\handler.sqf";
  18.  
  19. sleep 1;
  20.  
  21. waituntil {!isnull (finddisplay 46)};
  22.  
  23. if (isNil "WOG_muted") then {
  24. missionNamespace setVariable ["WOG_muted", false];
  25. };
  26.  
  27. if (isNil "WOG_initViewDistance") then {
  28. missionNamespace setVariable ["WOG_initViewDistance", round (viewDistance)];
  29. };
  30.  
  31. _vdl = missionNamespace getVariable [ "ace_viewdistance_limit",(missionNamespace getVariable "WOG_initViewDistance") ];
  32. wog_limitvd = (_vdl min 10000) max 200;
  33.  
  34. (findDisplay 46) displayAddEventHandler ["KeyDown", "[_this, wog_limitvd] call preset_hotkeys"];
  35.  
  36. preset_hotkeys = {
  37. private ["_dik", "_shiftState", "_ctrlState", "_altState", "_return", "_lvd"];
  38.  
  39. _return = false;
  40. _dik = (_this select 0) select 1;
  41. _shiftState = (_this select 0) select 2;
  42. _ctrlState = (_this select 0) select 3;
  43. _altState = (_this select 0) select 4;
  44. _lvd = _this select 1;
  45.  
  46. if (!_shiftState && !_ctrlState && !_altState) then
  47. {
  48. switch (_dik) do
  49. {
  50. case DIK_F1:
  51. {
  52. ["changeViewDistance", missionNamespace getVariable ["WOG_vdPreset1", _lvd] ] spawn handler;
  53. _return = true;
  54. };
  55. case DIK_F2:
  56. {
  57. ["changeViewDistance", missionNamespace getVariable ["WOG_vdPreset2", round (_lvd/2)] ] spawn handler;
  58. _return = true;
  59. };
  60. case DIK_F3:
  61. {
  62. ["changeViewDistance", missionNamespace getVariable ["WOG_vdPreset3", round (_lvd/4)] ] spawn handler;
  63. _return = true;
  64. };
  65. case DIK_F4:
  66. {
  67. if (missionNamespace getVariable "WOG_muted") then
  68. {
  69. ["unmute", (profileNamespace getVariable ["WOG_mutelevel", 1]) ] spawn handler;
  70. }
  71. else
  72. {
  73. ["mute", (profileNamespace getVariable ["WOG_mutelevel", 0.5]) ] spawn handler;
  74. };
  75.  
  76. _return = true;
  77. };
  78. };
  79. };
  80.  
  81. if (!_shiftState && _ctrlState && !_altState) then
  82. {
  83. switch (_dik) do
  84. {
  85. case DIK_HOME:
  86. {
  87. if (isNull (findDisplay IDD_VIEWDISTMUTING)) then {
  88. _ok = createDialog "WOG_volumeVDPresetsDialog";
  89. _return = _ok;
  90. };
  91. };
  92. };
  93. };
  94. _return;
  95. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement