-
-
Notifications
You must be signed in to change notification settings - Fork 311
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
309 additions
and
2 deletions.
There are no files selected for viewing
40 changes: 40 additions & 0 deletions
40
Missionframework/modules/99_playerMenu/fnc/fn_plm_apply.sqf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/* | ||
KPLIB_fnc_plm_apply | ||
File: fn_plm_apply.sqf | ||
Author: KP Liberation Dev Team - https://github.com/KillahPotatoes | ||
Date: 2018-08-04 | ||
Last Update: 2018-08-05 | ||
License: GNU General Public License v3.0 - https://www.gnu.org/licenses/gpl-3.0.html | ||
Description: | ||
Applies and saves the selected settings from the player menu dialog. | ||
Parameter(s): | ||
NONE | ||
Returns: | ||
BOOL | ||
*/ | ||
|
||
// Apply current view distance and sound volume | ||
[] call KPLIB_fnc_plm_getInOut; | ||
|
||
// Apply terrain detail setting | ||
switch (KPLIB_plm_terrain) do { | ||
case 0: {setTerrainGrid 50;}; | ||
case 1: {setTerrainGrid 25;}; | ||
case 2: {setTerrainGrid 12.5;}; | ||
case 3: {setTerrainGrid 6.25;}; | ||
case 4: {setTerrainGrid 3.125;}; | ||
default {setTerrainGrid 10;}; | ||
}; | ||
|
||
// Apply radio chatter setting | ||
switch (KPLIB_plm_radio) do { | ||
case 1: {enableRadio true; 1 fadeRadio 0;}; | ||
case 2: {enableRadio false; 1 fadeRadio 0;}; | ||
default {enableRadio true; 1 fadeRadio 1;}; | ||
}; | ||
|
||
true |
27 changes: 27 additions & 0 deletions
27
Missionframework/modules/99_playerMenu/fnc/fn_plm_create.sqf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/* | ||
KPLIB_fnc_plm_create | ||
File: fn_plm_create.sqf | ||
Author: KP Liberation Dev Team - https://github.com/KillahPotatoes | ||
Date: 2018-08-05 | ||
Last Update: 2018-08-05 | ||
License: GNU General Public License v3.0 - https://www.gnu.org/licenses/gpl-3.0.html | ||
Description: | ||
Creates a new group for the player. | ||
Parameter(s): | ||
NONE | ||
Returns: | ||
BOOL | ||
*/ | ||
|
||
private _grp = createGroup [(side player), true]; | ||
[player] join _grp; | ||
|
||
// Refresh Dialog | ||
closeDialog 0; | ||
[{!dialog}, {call KPLIB_fnc_plm_openDialog;}] call CBA_fnc_waitUntilAndExecute; | ||
|
||
true |
48 changes: 48 additions & 0 deletions
48
Missionframework/modules/99_playerMenu/fnc/fn_plm_getInOut.sqf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/* | ||
KPLIB_fnc_plm_getInOut | ||
File: fn_plm_getInOut.sqf | ||
Author: KP Liberation Dev Team - https://github.com/KillahPotatoes | ||
Date: 2018-08-05 | ||
Last Update: 2018-08-05 | ||
License: GNU General Public License v3.0 - https://www.gnu.org/licenses/gpl-3.0.html | ||
Description: | ||
Sets the view distance and the sound volume of the player depending on the current vehicle. | ||
Also changes the camera view, if functionality is enabled by the player. | ||
Parameter(s): | ||
NONE | ||
Returns: | ||
BOOL | ||
*/ | ||
|
||
// Player on foot | ||
if (isNull objectParent player) then { | ||
setViewDistance KPLIB_plm_viewFoot; | ||
setObjectViewDistance KPLIB_plm_viewFoot; | ||
1 fadeSound 1; | ||
}; | ||
|
||
// Player in boat or land vehicle | ||
if (vehicle player isKindOf "LandVehicle" || vehicle player isKindOf "Ship") then { | ||
setViewDistance KPLIB_plm_viewVeh; | ||
setObjectViewDistance KPLIB_plm_viewVeh; | ||
1 fadeSound KPLIB_plm_soundVeh; | ||
if (difficultyOption "thirdPersonView" == 1) then { | ||
if (KPLIB_plm_tpv > 1) then {player switchCamera "EXTERNAL";}; | ||
}; | ||
}; | ||
|
||
// Player in air vehicle | ||
if (vehicle player isKindOf "Air") then { | ||
setViewDistance KPLIB_plm_viewAir; | ||
setObjectViewDistance KPLIB_plm_viewAir; | ||
1 fadeSound KPLIB_plm_soundVeh; | ||
if (difficultyOption "thirdPersonView" == 1) then { | ||
if (KPLIB_plm_tpv == 1 || KPLIB_plm_tpv == 3) then {player switchCamera "EXTERNAL";}; | ||
}; | ||
}; | ||
|
||
true |
31 changes: 31 additions & 0 deletions
31
Missionframework/modules/99_playerMenu/fnc/fn_plm_join.sqf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/* | ||
KPLIB_fnc_plm_join | ||
File: fn_plm_join.sqf | ||
Author: KP Liberation Dev Team - https://github.com/KillahPotatoes | ||
Date: 2018-08-05 | ||
Last Update: 2018-08-05 | ||
License: GNU General Public License v3.0 - https://www.gnu.org/licenses/gpl-3.0.html | ||
Description: | ||
Joins the group which is currently selected in the group list. | ||
Parameter(s): | ||
NONE | ||
Returns: | ||
BOOL | ||
*/ | ||
|
||
// Dialog controls | ||
private _dialog = findDisplay 75803; | ||
private _ctrlGroupList = _dialog displayCtrl 758038; | ||
|
||
private _grp = KPLIB_plm_groups select (lbCurSel _ctrlGroupList); | ||
[player] join _grp; | ||
|
||
// Refresh Dialog | ||
closeDialog 0; | ||
[{!dialog}, {call KPLIB_fnc_plm_openDialog;}] call CBA_fnc_waitUntilAndExecute; | ||
|
||
true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
Missionframework/modules/99_playerMenu/fnc/fn_plm_rename.sqf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/* | ||
KPLIB_fnc_plm_rename | ||
File: fn_plm_rename.sqf | ||
Author: KP Liberation Dev Team - https://github.com/KillahPotatoes | ||
Date: 2018-08-05 | ||
Last Update: 2018-08-05 | ||
License: GNU General Public License v3.0 - https://www.gnu.org/licenses/gpl-3.0.html | ||
Description: | ||
Set the new name for the group which is selected in the group list. | ||
Parameter(s): | ||
NONE | ||
Returns: | ||
BOOL | ||
*/ | ||
|
||
// Dialog controls | ||
private _dialog = findDisplay 75803; | ||
private _ctrlGroupList = _dialog displayCtrl 758038; | ||
private _ctrlEditName = _dialog displayCtrl 758039; | ||
private _grp = KPLIB_plm_groups select (lbCurSel _ctrlGroupList); | ||
|
||
// Only allow change, when player is leader | ||
if (leader _grp == player) then { | ||
_grp setGroupIdGlobal [ctrlText _ctrlEditName]; | ||
|
||
// Refresh Dialog | ||
closeDialog 0; | ||
[{!dialog}, {call KPLIB_fnc_plm_openDialog;}] call CBA_fnc_waitUntilAndExecute; | ||
} else { | ||
hint localize "STR_PLAYERDIALOG_NOTLEADER"; | ||
[{hintSilent "";}, [], 3] call CBA_fnc_waitAndExecute; | ||
}; | ||
|
||
true |
52 changes: 52 additions & 0 deletions
52
Missionframework/modules/99_playerMenu/fnc/fn_plm_save.sqf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
/* | ||
KPLIB_fnc_plm_save | ||
File: fn_plm_save.sqf | ||
Author: KP Liberation Dev Team - https://github.com/KillahPotatoes | ||
Date: 2018-08-05 | ||
Last Update: 2018-08-05 | ||
License: GNU General Public License v3.0 - https://www.gnu.org/licenses/gpl-3.0.html | ||
Description: | ||
Saves the selected settings from the player menu dialog and calls the apply function. | ||
Parameter(s): | ||
NONE | ||
Returns: | ||
BOOL | ||
*/ | ||
|
||
// Dialog controls | ||
private _dialog = findDisplay 75803; | ||
private _ctrlViewFoot = _dialog displayCtrl 7580310; | ||
private _ctrlViewVeh = _dialog displayCtrl 7580311; | ||
private _ctrlViewAir = _dialog displayCtrl 7580312; | ||
private _ctrlTerrain = _dialog displayCtrl 7580313; | ||
private _ctrlTpv = _dialog displayCtrl 7580314; | ||
private _ctrlRadio = _dialog displayCtrl 7580315; | ||
private _ctrlSliderSound = _dialog displayCtrl 7580317; | ||
|
||
// Fetch all selected values | ||
KPLIB_plm_viewFoot = round (parseNumber (ctrlText _ctrlViewFoot)); | ||
if (KPLIB_plm_viewFoot == 0) then {KPLIB_plm_viewFoot = 1600;}; | ||
KPLIB_plm_viewVeh = round (parseNumber (ctrlText _ctrlViewVeh)); | ||
if (KPLIB_plm_viewVeh == 0) then {KPLIB_plm_viewVeh = 1600;}; | ||
KPLIB_plm_viewAir = round (parseNumber (ctrlText _ctrlViewAir)); | ||
if (KPLIB_plm_viewAir == 0) then {KPLIB_plm_viewAir = 1600;}; | ||
KPLIB_plm_terrain = lbCurSel _ctrlTerrain; | ||
KPLIB_plm_tpv = lbCurSel _ctrlTpv; | ||
KPLIB_plm_radio = lbCurSel _ctrlRadio; | ||
KPLIB_plm_soundVeh = (round sliderPosition _ctrlSliderSound) / 100; | ||
|
||
// Save settings in user profile | ||
profileNamespace setVariable ["KP_PLM_Settings", [KPLIB_plm_viewFoot, KPLIB_plm_viewVeh, KPLIB_plm_viewAir, KPLIB_plm_terrain, KPLIB_plm_tpv, KPLIB_plm_radio, KPLIB_plm_soundVeh]]; | ||
saveProfileNamespace; | ||
|
||
// Apply settings | ||
[] call KPLIB_fnc_plm_apply; | ||
|
||
// Close the dialog | ||
closeDialog 0; | ||
|
||
true |