mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Merge branch 'master' into agmMapPort
This commit is contained in:
commit
e260ea5314
@ -29,5 +29,5 @@
|
||||
};
|
||||
|
||||
// don't show speed and height when in expert mode
|
||||
["Parachute", {if (!cadetMode) then {_dlg = _this select 0; {(_dlg displayCtrl _x) ctrlShow false} forEach [121, 122, 1004, 1005, 1006, 1014];};}] call AGM_Core_fnc_addInfoDisplayEventHandler;
|
||||
["Soldier", {if (!cadetMode) then {_dlg = _this select 0; {_ctrl = (_dlg displayCtrl _x); _ctrl ctrlSetPosition [0,0,0,0]; _ctrl ctrlCommit 0;} forEach [380, 382]};}] call AGM_Core_fnc_addInfoDisplayEventHandler;
|
||||
["Parachute", {if (!cadetMode) then {_dlg = _this select 0; {(_dlg displayCtrl _x) ctrlShow false} forEach [121, 122, 1004, 1005, 1006, 1014];};}] call AGM_Core_fnc_addInfoDisplayEventHandler; //@todo addEventHandler infoDisplayChanged with select 1 == "Parachute"
|
||||
["Soldier", {if (!cadetMode) then {_dlg = _this select 0; {_ctrl = (_dlg displayCtrl _x); _ctrl ctrlSetPosition [0,0,0,0]; _ctrl ctrlCommit 0;} forEach [380, 382]};}] call AGM_Core_fnc_addInfoDisplayEventHandler; //@todo addEventHandler infoDisplayChanged with select 1 == "Soldier"
|
||||
|
@ -2,3 +2,4 @@
|
||||
// by commy2
|
||||
|
||||
//["Soldier", {_player = AGM_player; if (currentWeapon _player in (_player getVariable ["AGM_SafeMode_safedWeapons", []])) then {[false] call AGM_SafeMode_setSafeModeVisual}] call AGM_Core_fnc_addInfoDisplayEventHandler;
|
||||
//@todo addEventHandler infoDisplayChanged with select 1 == "Soldier"
|
@ -46,4 +46,4 @@ AGM_WeaponSelect_AllMagazines = uiNamespace getVariable "AGM_WeaponSelect_Al
|
||||
|
||||
// hide grenade count if none is selected
|
||||
[uiNamespace getVariable "AGM_dlgSoldier", false] call AGM_WeaponSelect_fnc_toggleGrenadeCount;
|
||||
["Soldier", {[_this select 0, call AGM_WeaponSelect_fnc_getSelectedGrenade != ""] call AGM_WeaponSelect_fnc_toggleGrenadeCount}] call AGM_Core_fnc_addInfoDisplayEventHandler;
|
||||
["Soldier", {[_this select 0, call AGM_WeaponSelect_fnc_getSelectedGrenade != ""] call AGM_WeaponSelect_fnc_toggleGrenadeCount}] call AGM_Core_fnc_addInfoDisplayEventHandler; //@todo addEventHandler infoDisplayChanged with select 1 == "Soldier"
|
||||
|
@ -2,24 +2,27 @@
|
||||
class RscInGameUI {
|
||||
class RscUnitInfo;
|
||||
class RscUnitInfoSoldier: RscUnitInfo {
|
||||
onLoad = "uiNamespace setVariable ['ACE_dlgSoldier', _this select 0]; {_this call _x} forEach ((missionNamespace getVariable ['ACE_onLoadInfoSoldier', [-1, [], []]]) select 2); {_this call _x} forEach ((missionNamespace getVariable ['ACE_onLoadInfoAny', [-1, [], []]]) select 2); [""onLoad"",_this,""RscUnitInfo"",'IGUI'] call compile preprocessfilelinenumbers ""A3\ui_f\scripts\initDisplay.sqf""";
|
||||
onLoad = QUOTE([ARR_4(""onLoad"",_this,""RscUnitInfo"",'IGUI')] call compile preprocessfilelinenumbers ""A3\ui_f\scripts\initDisplay.sqf""; uiNamespace setVariable [ARR_2('ACE_dlgSoldier', _this select 0)]; [ARR_2('infoDisplayChanged', [ARR_2(_this select 0, 'Soldier')])] call FUNC(localEvent););
|
||||
};
|
||||
class RscUnitInfoTank: RscUnitInfo {
|
||||
onLoad = "uiNamespace setVariable ['ACE_dlgVehicle', _this select 0]; {_this call _x} forEach ((missionNamespace getVariable ['ACE_onLoadInfoVehicle', [-1, [], []]]) select 2); {_this call _x} forEach ((missionNamespace getVariable ['ACE_onLoadInfoAny', [-1, [], []]]) select 2); [""onLoad"",_this,""RscUnitInfo"",'IGUI'] call compile preprocessfilelinenumbers ""A3\ui_f\scripts\initDisplay.sqf""";
|
||||
onLoad = QUOTE([ARR_4(""onLoad"",_this,""RscUnitInfo"",'IGUI')] call compile preprocessfilelinenumbers ""A3\ui_f\scripts\initDisplay.sqf""; uiNamespace setVariable [ARR_2('ACE_dlgVehicle', _this select 0)]; [ARR_2('infoDisplayChanged', [ARR_2(_this select 0, 'Vehicle')])] call FUNC(localEvent););
|
||||
};
|
||||
class RscUnitInfoAir: RscUnitInfo {
|
||||
onLoad = "uiNamespace setVariable ['ACE_dlgAircraft', _this select 0]; {_this call _x} forEach ((missionNamespace getVariable ['ACE_onLoadInfoAircraft', [-1, [], []]]) select 2); {_this call _x} forEach ((missionNamespace getVariable ['ACE_onLoadInfoAny', [-1, [], []]]) select 2); [""onLoad"",_this,""RscUnitInfo"",'IGUI'] call compile preprocessfilelinenumbers ""A3\ui_f\scripts\initDisplay.sqf""";
|
||||
onLoad = QUOTE([ARR_4(""onLoad"",_this,""RscUnitInfo"",'IGUI')] call compile preprocessfilelinenumbers ""A3\ui_f\scripts\initDisplay.sqf""; uiNamespace setVariable [ARR_2('ACE_dlgAircraft', _this select 0)]; [ARR_2('infoDisplayChanged', [ARR_2(_this select 0, 'Aircraft')])] call FUNC(localEvent););
|
||||
};
|
||||
class RscUnitInfoSubmarine: RscUnitInfo {
|
||||
onLoad = QUOTE([ARR_4(""onLoad"",_this,""RscUnitInfo"",'IGUI')] call compile preprocessfilelinenumbers ""A3\ui_f\scripts\initDisplay.sqf""; uiNamespace setVariable [ARR_2('ACE_dlgSubmarine', _this select 0)]; [ARR_2('infoDisplayChanged', [ARR_2(_this select 0, 'Submarine')])] call FUNC(localEvent););
|
||||
};
|
||||
class RscUnitInfoShip: RscUnitInfo {
|
||||
onLoad = "uiNamespace setVariable ['ACE_dlgShip', _this select 0]; {_this call _x} forEach ((missionNamespace getVariable ['ACE_onLoadInfoShip', [-1, [], []]]) select 2); {_this call _x} forEach ((missionNamespace getVariable ['ACE_onLoadInfoAny', [-1, [], []]]) select 2); [""onLoad"",_this,""RscUnitInfo"",'IGUI'] call compile preprocessfilelinenumbers ""A3\ui_f\scripts\initDisplay.sqf""";
|
||||
onLoad = QUOTE([ARR_4(""onLoad"",_this,""RscUnitInfo"",'IGUI')] call compile preprocessfilelinenumbers ""A3\ui_f\scripts\initDisplay.sqf""; uiNamespace setVariable [ARR_2('ACE_dlgShip', _this select 0)]; [ARR_2('infoDisplayChanged', [ARR_2(_this select 0, 'Ship')])] call FUNC(localEvent););
|
||||
};
|
||||
class RscUnitInfoParachute: RscUnitInfo {
|
||||
onLoad = "uiNamespace setVariable ['ACE_dlgParachute', _this select 0]; {_this call _x} forEach ((missionNamespace getVariable ['ACE_onLoadInfoParachute', [-1, [], []]]) select 2); {_this call _x} forEach ((missionNamespace getVariable ['ACE_onLoadInfoAny', [-1, [], []]]) select 2); [""onLoad"",_this,""RscUnitInfo"",'IGUI'] call compile preprocessfilelinenumbers ""A3\ui_f\scripts\initDisplay.sqf""";
|
||||
onLoad = QUOTE([ARR_4(""onLoad"",_this,""RscUnitInfo"",'IGUI')] call compile preprocessfilelinenumbers ""A3\ui_f\scripts\initDisplay.sqf""; uiNamespace setVariable [ARR_2('ACE_dlgParachute', _this select 0)]; [ARR_2('infoDisplayChanged', [ARR_2(_this select 0, 'Parachute')])] call FUNC(localEvent););
|
||||
};
|
||||
};
|
||||
|
||||
class RscDisplayInventory {
|
||||
onLoad = "[""onLoad"",_this,""RscDisplayInventory"",'IGUI'] call compile preprocessfilelinenumbers ""A3\ui_f\scripts\initDisplay.sqf""; {_this call _x} forEach ((missionNamespace getVariable ['ACE_onLoadInventory', [-1, [], []]]) select 2);";
|
||||
onLoad = QUOTE([ARR_4(""onLoad"",_this,""RscDisplayInventory"",'IGUI')] call compile preprocessfilelinenumbers ""A3\ui_f\scripts\initDisplay.sqf""; [ARR_2('inventoryDisplayLoaded', _this)] call FUNC(localEvent););
|
||||
};
|
||||
|
||||
class RscDisplayChannel {
|
||||
|
@ -19,9 +19,8 @@ if (_currentVersion != _previousVersion) then {
|
||||
|
||||
0 spawn COMPILE_FILE(scripts\Version\checkVersionNumber);
|
||||
|
||||
//add network event handlers
|
||||
"ACEg" addPublicVariableEventHandler { _this call FUNC(_handletNetEvent); };
|
||||
"ACEc" addPublicVariableEventHandler { _this call FUNC(_handletNetEvent); };
|
||||
"ACEg" addPublicVariableEventHandler { _this call FUNC(_handleNetEvent); };
|
||||
"ACEc" addPublicVariableEventHandler { _this call FUNC(_handleNetEvent); };
|
||||
|
||||
// everything that only player controlled machines need, goes below this
|
||||
if (!hasInterface) exitWith {};
|
||||
@ -74,4 +73,62 @@ enableCamShake true;
|
||||
};
|
||||
}] call FUNC(addEventhandler);
|
||||
|
||||
GVAR(OldPlayerInventory) = ACE_player call FUNC(getAllGear);
|
||||
GVAR(OldPlayerVisionMode) = currentVisionMode ACE_player;
|
||||
GVAR(OldZeusDisplayIsOpen) = !(isNull findDisplay 312);
|
||||
GVAR(OldCameraView) = cameraView;
|
||||
GVAR(OldPlayerVehicle) = vehicle ACE_player;
|
||||
GVAR(OldPlayerTurret) = [ACE_player] call FUNC(getTurretIndex);
|
||||
|
||||
// PFH to raise varios events
|
||||
[{
|
||||
|
||||
// "playerInventoryChanged" event
|
||||
_newPlayerInventory = ACE_player call FUNC(getAllGear);
|
||||
if !(_newPlayerInventory isEqualTo GVAR(OldPlayerInventory)) then {
|
||||
// Raise ACE event locally
|
||||
GVAR(OldPlayerInventory) = _newPlayerInventory;
|
||||
["playerInventoryChanged", [ACE_player, _newPlayerInventory]] call FUNC(localEvent);
|
||||
};
|
||||
|
||||
// "playerVisionModeChanged" event
|
||||
_newPlayerVisionMode = currentVisionMode ACE_player;
|
||||
if !(_newPlayerVisionMode isEqualTo GVAR(OldPlayerVisionMode)) then {
|
||||
// Raise ACE event locally
|
||||
GVAR(OldPlayerVisionMode) = _newPlayerVisionMode;
|
||||
["playerVisionModeChanged", [ACE_player, _newPlayerVisionMode]] call FUNC(localEvent);
|
||||
};
|
||||
|
||||
// "zeusDisplayChanged" event
|
||||
_newZeusDisplayIsOpen = !(isNull findDisplay 312);
|
||||
if !(_newZeusDisplayIsOpen isEqualTo GVAR(OldZeusDisplayIsOpen)) then {
|
||||
// Raise ACE event locally
|
||||
GVAR(OldZeusDisplayIsOpen) = _newZeusDisplayIsOpen;
|
||||
["zeusDisplayChanged", [ACE_player, _newZeusDisplayIsOpen]] call FUNC(localEvent);
|
||||
};
|
||||
|
||||
// "cameraViewChanged" event
|
||||
_newCameraView = cameraView;
|
||||
if !(_newCameraView isEqualTo GVAR(OldCameraView)) then {
|
||||
// Raise ACE event locally
|
||||
GVAR(OldCameraView) = _newCameraView;
|
||||
["cameraViewChanged", [ACE_player, _newCameraView]] call FUNC(localEvent);
|
||||
};
|
||||
|
||||
// "playerVehicleChanged" event
|
||||
_newPlayerVehicle = vehicle ACE_player;
|
||||
if !(_newPlayerVehicle isEqualTo GVAR(OldPlayerVehicle)) then {
|
||||
// Raise ACE event locally
|
||||
GVAR(OldPlayerVehicle) = _newPlayerVehicle;
|
||||
["playerVehicleChanged", [ACE_player, _newPlayerVehicle]] call FUNC(localEvent);
|
||||
};
|
||||
|
||||
// "playerTurretChanged" event
|
||||
[ACE_player] call FUNC(getTurretIndex);
|
||||
if !(_newPlayerTurret isEqualTo GVAR(OldPlayerTurret)) then {
|
||||
// Raise ACE event locally
|
||||
GVAR(OldPlayerTurret) = _newPlayerTurret;
|
||||
["playerTurretChanged", [ACE_player, _newPlayerTurret]] call FUNC(localEvent);
|
||||
};
|
||||
|
||||
}, 0, []] call cba_fnc_addPerFrameHandler;
|
||||
|
@ -6,9 +6,7 @@ PREP(addActionEventHandler);
|
||||
PREP(addActionMenuEventHandler);
|
||||
PREP(addCameraEventHandler);
|
||||
PREP(addCustomEventHandler);
|
||||
PREP(addInfoDisplayEventHandler);
|
||||
PREP(addMapMarkerCreatedEventHandler);
|
||||
PREP(addInventoryDisplayLoadedEventHandler);
|
||||
PREP(addScrollWheelEventHandler);
|
||||
PREP(adminKick);
|
||||
PREP(ambientBrightness);
|
||||
@ -38,6 +36,7 @@ PREP(execRemoteFnc);
|
||||
PREP(executePersistent);
|
||||
PREP(filter);
|
||||
PREP(fixLoweredRifleAnimation);
|
||||
PREP(getAllGear);
|
||||
PREP(getCaptivityStatus);
|
||||
PREP(getConfigCommander);
|
||||
PREP(getConfigGunner);
|
||||
@ -100,8 +99,6 @@ PREP(removeActionEventHandler);
|
||||
PREP(removeActionMenuEventHandler);
|
||||
PREP(removeCameraEventHandler);
|
||||
PREP(removeCustomEventHandler);
|
||||
PREP(removeInfoDisplayEventHandler);
|
||||
PREP(removeInventoryDisplayLoadedEventHandler);
|
||||
PREP(removeMapMarkerCreatedEventHandler);
|
||||
PREP(removeScrollWheelEventHandler);
|
||||
PREP(restoreVariablesJIP);
|
||||
|
@ -1,35 +0,0 @@
|
||||
/*
|
||||
* Author: commy2
|
||||
*
|
||||
* Add a unit info type handler.
|
||||
*
|
||||
* Argument:
|
||||
* 0: Type. Can be "Soldier", "Vehicle", "Aircraft", "Ship", "Parachute" or "Any". "Any" will execute for any compatible display (String)
|
||||
* 1: Code to execute (Code or String)
|
||||
*
|
||||
* Return value:
|
||||
* ID of the event script (used to remove it later).
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_type", "_statement", "_actionsVar", "_id", "_actionIDs", "_actions"];
|
||||
|
||||
_type = format ["ACE_onLoadInfo%1", _this select 0];
|
||||
_statement = _this select 1;
|
||||
|
||||
if (typeName _statement == "STRING") then {
|
||||
_statement = compile _statement;
|
||||
};
|
||||
|
||||
_actionsVar = missionNamespace getVariable [_type, [-1, [], []]];
|
||||
|
||||
_id = (_actionsVar select 0) + 1;
|
||||
_actionIDs = _actionsVar select 1;
|
||||
_actions = _actionsVar select 2;
|
||||
|
||||
_actionIDs pushBack _id;
|
||||
_actions pushBack _statement;
|
||||
|
||||
missionNamespace setVariable [_type, [_id, _actionIDs, _actions]];
|
||||
|
||||
_id
|
@ -1,33 +0,0 @@
|
||||
/*
|
||||
* Author: commy2
|
||||
*
|
||||
* Add an inventory display opened handler.
|
||||
*
|
||||
* Argument:
|
||||
* 0: Code to execute (Code or String)
|
||||
*
|
||||
* Return value:
|
||||
* ID of the event script (used to remove it later).
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_statement", "_actionsVar", "_id", "_actionIDs", "_actions"];
|
||||
|
||||
_statement = _this select 0;
|
||||
|
||||
if (typeName _statement == "STRING") then {
|
||||
_statement = compile _statement;
|
||||
};
|
||||
|
||||
_actionsVar = missionNamespace getVariable ["ACE_onLoadInventory", [-1, [], []]];
|
||||
|
||||
_id = (_actionsVar select 0) + 1;
|
||||
_actionIDs = _actionsVar select 1;
|
||||
_actions = _actionsVar select 2;
|
||||
|
||||
_actionIDs pushBack _id;
|
||||
_actions pushBack _statement;
|
||||
|
||||
missionNamespace setVariable ["ACE_onLoadInventory", [_id, _actionIDs, _actions]];
|
||||
|
||||
_id
|
@ -1,26 +1,21 @@
|
||||
/*
|
||||
Name: ACE_Respawn_fnc_getAllGear
|
||||
|
||||
Author(s):
|
||||
bux578
|
||||
|
||||
Description:
|
||||
returns an array containing all items of a given unit
|
||||
|
||||
Parameters:
|
||||
0: OBJECT - unit
|
||||
|
||||
Returns:
|
||||
ARRAY
|
||||
*/
|
||||
|
||||
* Author: bux578
|
||||
*
|
||||
* Returns an array containing all items of a given unit
|
||||
*
|
||||
* Argument:
|
||||
* 0: Unit (Object)
|
||||
*
|
||||
* Return value:
|
||||
* Array with all the gear
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_unit", "_allGear"];
|
||||
EXPLODE_1_PVT(_this,_unit);
|
||||
|
||||
_unit = _this select 0;
|
||||
if (isNull _unit) exitWith {[]};
|
||||
|
||||
_allGear = [
|
||||
[
|
||||
(headgear _unit),
|
||||
(goggles _unit),
|
||||
(uniform _unit),
|
||||
@ -40,6 +35,4 @@ _allGear = [
|
||||
(handgunMagazine _unit),
|
||||
(assignedItems _unit),
|
||||
(binocular _unit)
|
||||
];
|
||||
|
||||
_allGear
|
||||
]
|
@ -16,6 +16,8 @@ private ["_unit", "_vehicle", "_turrets", "_units", "_index"];
|
||||
_unit = _this select 0;
|
||||
_vehicle = vehicle _unit;
|
||||
|
||||
if (_unit == _vehicle) exitWith {[]};
|
||||
|
||||
//_turrets = [typeOf _vehicle] call FUNC(getTurrets);
|
||||
_turrets = allTurrets [_vehicle, true];
|
||||
|
||||
|
@ -1,33 +0,0 @@
|
||||
/*
|
||||
* Author: commy2
|
||||
*
|
||||
* Remove a unit info type event handler.
|
||||
*
|
||||
* Argument:
|
||||
* 0: Type. Can be "Soldier", "Vehicle", "Aircraft" or "Parachute" (String)
|
||||
* 1: ID of the event handler (Number)
|
||||
*
|
||||
* Return value:
|
||||
* None.
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_type", "_id", "_actionsVar", "_currentId", "_actionIDs", "_actions"];
|
||||
|
||||
_type = format ["ACE_onLoadInfo%1", _this select 0];
|
||||
_id = _this select 1;
|
||||
|
||||
_actionsVar = missionNamespace getVariable [_type, [-1, [], []]];
|
||||
|
||||
_currentId = _actionsVar select 0;
|
||||
_actionIDs = _actionsVar select 1;
|
||||
_actions = _actionsVar select 2;
|
||||
|
||||
_id = _actionIDs find _id;
|
||||
|
||||
if (_id == -1) exitWith {};
|
||||
|
||||
_actionIDs deleteAt _id;
|
||||
_actions deleteAt _id;
|
||||
|
||||
missionNamespace setVariable [_type, [_currentId, _actionIDs, _actions]];
|
@ -1,31 +0,0 @@
|
||||
/*
|
||||
* Author: commy2
|
||||
*
|
||||
* Remove an inventory display opened handler.
|
||||
*
|
||||
* Argument:
|
||||
* 0: ID of the event handler (Number)
|
||||
*
|
||||
* Return value:
|
||||
* None.
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_id", "_actionsVar", "_currentId", "_actionIDs", "_actions"];
|
||||
|
||||
_id = _this select 0;
|
||||
|
||||
_actionsVar = missionNamespace getVariable ["ACE_onLoadInventory", [-1, [], []]];
|
||||
|
||||
_currentId = _actionsVar select 0;
|
||||
_actionIDs = _actionsVar select 1;
|
||||
_actions = _actionsVar select 2;
|
||||
|
||||
_id = _actionIDs find _id;
|
||||
|
||||
if (_id == -1) exitWith {};
|
||||
|
||||
_actionIDs deleteAt _id;
|
||||
_actions deleteAt _id;
|
||||
|
||||
missionNamespace setVariable ["ACE_onLoadInventory", [_currentId, _actionIDs, _actions]];
|
@ -5,9 +5,9 @@
|
||||
#include "script_component.hpp"
|
||||
|
||||
if (isNil QGVAR(UpdateInventoryDisplay_EHID)) then {
|
||||
GVAR(UpdateInventoryDisplay_EHID) = [{
|
||||
GVAR(UpdateInventoryDisplay_EHID) = ["inventoryDisplayLoaded",{
|
||||
_player = ACE_player;
|
||||
[_player, secondaryWeapon _player] call FUNC(takeLoadedATWeapon);
|
||||
[_player, (_this select 0)] call FUNC(updateInventoryDisplay);
|
||||
}] call EFUNC(common,addInventoryDisplayLoadedEventHandler);
|
||||
}] call EFUNC(common,addEventHandler);
|
||||
};
|
||||
|
@ -3,10 +3,10 @@
|
||||
|
||||
if (!hasInterface) exitWith {};
|
||||
|
||||
GVAR(ppEffectBlur) = ppEffectCreate ["dynamicBlur", 1234];
|
||||
GVAR(ppEffectBlur) = ppEffectCreate ["dynamicBlur", 1234];
|
||||
GVAR(ppEffectBlur) ppEffectForceInNVG true;
|
||||
GVAR(ppEffectBlur) ppEffectAdjust [0];
|
||||
GVAR(ppEffectBlur) ppEffectCommit 0;
|
||||
GVAR(ppEffectBlur) ppEffectAdjust [0];
|
||||
GVAR(ppEffectBlur) ppEffectCommit 0;
|
||||
|
||||
GVAR(ppEffectRadialBlur) = ppEffectCreate ["radialBlur", 1238];
|
||||
GVAR(ppEffectRadialBlur) ppEffectForceInNVG true;
|
||||
@ -28,11 +28,10 @@ GVAR(ppEffectMuzzleFlash) ppEffectForceInNVG true;
|
||||
GVAR(ppEffectMuzzleFlash) ppEffectAdjust [1, 1, 0, [0, 0, 0, 0], [0, 0, 0, 1], [0, 0, 0, 1]];
|
||||
GVAR(ppEffectMuzzleFlash) ppEffectCommit 0;
|
||||
|
||||
//Setup global variables for the ppEffectUpdater
|
||||
GVAR(lastFrameView) = "";
|
||||
GVAR(lastFrameVehicle) = objNull;
|
||||
GVAR(lastFrameTurret) = [-1];
|
||||
GVAR(lastFrameHMD) = "";
|
||||
GVAR(currentMode) = 0;
|
||||
|
||||
[FUNC(updatePPEffectsEachFrame), 0, []] call CBA_fnc_addPerFrameHandler;
|
||||
// Setup the event handlers
|
||||
["playerInventoryChanged", FUNC(updatePPEffects)] call EFUNC(common,addEventHandler);
|
||||
["playerVisionModeChanged", FUNC(updatePPEffects)] call EFUNC(common,addEventHandler);
|
||||
["zeusDisplayChanged", FUNC(updatePPEffects)] call EFUNC(common,addEventHandler);
|
||||
["cameraViewChanged", FUNC(updatePPEffects)] call EFUNC(common,addEventHandler);
|
||||
["playerVehicleChanged", FUNC(updatePPEffects)] call EFUNC(common,addEventHandler);
|
||||
["playerTurretChanged", FUNC(updatePPEffects)] call EFUNC(common,addEventHandler);
|
||||
|
@ -3,4 +3,4 @@
|
||||
PREP(blending);
|
||||
PREP(decreaseNVGBrightness);
|
||||
PREP(increaseNVGBrightness);
|
||||
PREP(updatePPEffectsEachFrame);
|
||||
PREP(updatePPEffects);
|
||||
|
71
addons/nightvision/functions/fnc_updatePPEffects.sqf
Normal file
71
addons/nightvision/functions/fnc_updatePPEffects.sqf
Normal file
@ -0,0 +1,71 @@
|
||||
//by commy2, PabstMirror and CAA-Picard
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_currentVehicle", "_grainSetting", "_blurSetting", "_radBlurSetting", "_config"];
|
||||
|
||||
_currentVehicle = vehicle ACE_player;
|
||||
|
||||
// If the Zeus display is on or the player has no nightvision
|
||||
if ((!isNull findDisplay 312) || ((currentVisionMode ACE_player) != 1)) exitWith {
|
||||
GVAR(ppEffectFilmGrain) ppEffectEnable false;
|
||||
GVAR(ppEffectBlur) ppEffectEnable false;
|
||||
GVAR(ppEffectRadialBlur) ppEffectEnable false;
|
||||
GVAR(ppEffectNVGBrightness) ppEffectEnable false;
|
||||
};
|
||||
|
||||
// The unit has nightvision
|
||||
_config = configFile >> "CfgVehicles" >> typeOf _currentVehicle;
|
||||
_hmd = hmd ACE_player;
|
||||
_cameraView = cameraView;
|
||||
_turret = [ACE_player] call EFUNC(common,getTurretIndex);
|
||||
|
||||
|
||||
_fnc_isUsingHMD = {
|
||||
if (_cameraView != "GUNNER") exitWith {true}; // asume hmd usage outside of gunner view
|
||||
|
||||
if (ACE_player == (driver _currentVehicle)) exitWith {
|
||||
!("NVG" in getArray (_config >> "ViewOptics" >> "visionMode"));
|
||||
};
|
||||
|
||||
private ["_result", "_turretConfig", "_turretConfigOpticsIn"];
|
||||
_result = true;
|
||||
_turretConfig = [_config, _turret] call EFUNC(common,getTurretConfigPath);
|
||||
_turretConfigOpticsIn = _turretConfig >> "OpticsIn";
|
||||
|
||||
if (isClass _turretConfigOpticsIn) then {
|
||||
for "_index" from 0 to (count _turretConfigOpticsIn - 1) do {
|
||||
if ("NVG" in getArray (_turretConfigOpticsIn select _index >> "visionMode")) exitWith {_result = false};
|
||||
};
|
||||
} else {
|
||||
//No OpticsIn usualy means RCWS, still need to test on more vehicles
|
||||
_result = false;
|
||||
};
|
||||
_result
|
||||
};
|
||||
|
||||
if ((_currentVehicle == ACE_player) || _fnc_isUsingHMD) then {
|
||||
_grainSetting = getNumber (configFile >> "CfgWeapons" >> _hmd >> "ACE_NightVision_grain");
|
||||
_blurSetting = getNumber (configFile >> "CfgWeapons" >> _hmd >> "ACE_NightVision_blur");
|
||||
_radBlurSetting = getNumber (configFile >> "CfgWeapons" >> _hmd >> "ACE_NightVision_radBlur");
|
||||
TRACE_3("New NVG Settings From Player NVG",_grainSetting,_blurSetting,_radBlurSetting)
|
||||
} else {
|
||||
_grainSetting = _currentVehicle getVariable ["ACE_NightVision_grain", getNumber (_config >> "ACE_NightVision_grain")];
|
||||
_blurSetting = _currentVehicle getVariable ["ACE_NightVision_blur", getNumber (_config >> "ACE_NightVision_blur")];
|
||||
_radBlurSetting = _currentVehicle getVariable ["ACE_NightVision_radBlur", getNumber (_config >> "ACE_NightVision_radBlur")];
|
||||
TRACE_3("New NVG Settings From Vehicle",_grainSetting,_blurSetting,_radBlurSetting)
|
||||
};
|
||||
|
||||
|
||||
// Enable the effects
|
||||
GVAR(ppEffectFilmGrain) ppEffectEnable true;
|
||||
GVAR(ppEffectBlur) ppEffectEnable true;
|
||||
GVAR(ppEffectRadialBlur) ppEffectEnable true;
|
||||
GVAR(ppEffectNVGBrightness) ppEffectEnable true;
|
||||
|
||||
// Configure effects parameters
|
||||
GVAR(ppEffectFilmGrain) ppEffectAdjust [0.25, 2.5, 2.5, _grainSetting, _grainSetting, false];
|
||||
GVAR(ppEffectFilmGrain) ppEffectCommit 0;
|
||||
GVAR(ppEffectBlur) ppEffectAdjust [_blurSetting];
|
||||
GVAR(ppEffectBlur) ppEffectCommit 0;
|
||||
GVAR(ppEffectRadialBlur) ppEffectAdjust [_radBlurSetting, _radBlurSetting, 0.2, 0.2];
|
||||
GVAR(ppEffectRadialBlur) ppEffectCommit 0;
|
@ -1,104 +0,0 @@
|
||||
//by commy2, PabstMirror
|
||||
|
||||
#include "script_component.hpp"
|
||||
#define MODE_NVG_OFF 0
|
||||
#define MODE_NVG_ON 1
|
||||
#define MODE_NVG_ONZEUS 2
|
||||
|
||||
_fnc_isUsingHMD = {
|
||||
if (GVAR(lastFrameView) != "GUNNER") exitWith {true}; // asume hmd usage outside of gunner view
|
||||
|
||||
if (ACE_player == (driver _currentVehicle)) exitWith {
|
||||
!("NVG" in getArray (_config >> "ViewOptics" >> "visionMode"));
|
||||
};
|
||||
|
||||
private ["_result", "_turretConfig", "_turretConfigOpticsIn"];
|
||||
_result = true;
|
||||
_turretConfig = [_config, GVAR(lastFrameTurret)] call EFUNC(common,getTurretConfigPath);
|
||||
_turretConfigOpticsIn = _turretConfig >> "OpticsIn";
|
||||
|
||||
if (isClass _turretConfigOpticsIn) then {
|
||||
for "_index" from 0 to (count _turretConfig - 1) do {
|
||||
if ("NVG" in getArray (_turretConfig select _index >> "visionMode")) exitWith {_result = false};
|
||||
};
|
||||
} else {
|
||||
//No OpticsIn usualy means RCWS, still need to test on more vehicles
|
||||
_result = false;
|
||||
};
|
||||
_result
|
||||
};
|
||||
|
||||
private ["_currentVehicle", "_grainSetting", "_blurSetting", "_radBlurSetting", "_config"];
|
||||
_currentVehicle = vehicle ACE_player;
|
||||
|
||||
switch (GVAR(currentMode)) do {
|
||||
case (MODE_NVG_OFF): {
|
||||
if ((currentVisionMode ACE_player) == 1) then {
|
||||
GVAR(currentMode) = MODE_NVG_ON;
|
||||
GVAR(ppEffectFilmGrain) ppEffectEnable true;
|
||||
GVAR(ppEffectBlur) ppEffectEnable true;
|
||||
GVAR(ppEffectRadialBlur) ppEffectEnable true;
|
||||
GVAR(ppEffectNVGBrightness) ppEffectEnable true;
|
||||
};
|
||||
};
|
||||
case (MODE_NVG_ON): {
|
||||
if ((currentVisionMode ACE_player) == 0) then {
|
||||
GVAR(currentMode) = MODE_NVG_OFF;
|
||||
GVAR(ppEffectFilmGrain) ppEffectEnable false;
|
||||
GVAR(ppEffectBlur) ppEffectEnable false;
|
||||
GVAR(ppEffectRadialBlur) ppEffectEnable false;
|
||||
GVAR(ppEffectNVGBrightness) ppEffectEnable false;
|
||||
};
|
||||
if (!isNull findDisplay 312) then {
|
||||
GVAR(currentMode) = MODE_NVG_ONZEUS;
|
||||
GVAR(ppEffectFilmGrain) ppEffectEnable false;
|
||||
GVAR(ppEffectBlur) ppEffectEnable false;
|
||||
GVAR(ppEffectRadialBlur) ppEffectEnable false;
|
||||
GVAR(ppEffectNVGBrightness) ppEffectEnable false;
|
||||
} else {
|
||||
if (((hmd ACE_player) != GVAR(lastFrameHMD)) ||
|
||||
{cameraView != GVAR(lastFrameView)} ||
|
||||
{_currentVehicle != GVAR(lastFrameVehicle)} ||
|
||||
{!(([ACE_player] call EFUNC(common,getTurretIndex)) isEqualTo GVAR(lastFrameTurret))}) then {
|
||||
|
||||
GVAR(lastFrameHMD) = hmd ACE_player;
|
||||
GVAR(lastFrameView) = cameraView;
|
||||
GVAR(lastFrameVehicle) = _currentVehicle;
|
||||
GVAR(lastFrameTurret) = [ACE_player] call EFUNC(common,getTurretIndex);
|
||||
_config = configFile >> "CfgVehicles" >> typeOf _currentVehicle;
|
||||
|
||||
if ((_currentVehicle == ACE_player) || _fnc_isUsingHMD) then {
|
||||
_grainSetting = getNumber (configFile >> "CfgWeapons" >> GVAR(lastFrameHMD) >> "ACE_NightVision_grain");
|
||||
_blurSetting = getNumber (configFile >> "CfgWeapons" >> GVAR(lastFrameHMD) >> "ACE_NightVision_blur");
|
||||
_radBlurSetting = getNumber (configFile >> "CfgWeapons" >> GVAR(lastFrameHMD) >> "ACE_NightVision_radBlur");
|
||||
TRACE_3("New NVG Settings From Player NVG",_grainSetting,_blurSetting,_radBlurSetting)
|
||||
} else {
|
||||
_grainSetting = _currentVehicle getVariable ["ACE_NightVision_grain", getNumber (_config >> "ACE_NightVision_grain")];
|
||||
_blurSetting = _currentVehicle getVariable ["ACE_NightVision_blur", getNumber (_config >> "ACE_NightVision_blur")];
|
||||
_radBlurSetting = _currentVehicle getVariable ["ACE_NightVision_radBlur", getNumber (_config >> "ACE_NightVision_radBlur")];
|
||||
TRACE_3("New NVG Settings From Vehicle",_grainSetting,_blurSetting,_radBlurSetting)
|
||||
};
|
||||
|
||||
GVAR(ppEffectFilmGrain) ppEffectAdjust [0.25, 2.5, 2.5, _grainSetting, _grainSetting, false];
|
||||
GVAR(ppEffectFilmGrain) ppEffectCommit 0;
|
||||
GVAR(ppEffectBlur) ppEffectAdjust [_blurSetting];
|
||||
GVAR(ppEffectBlur) ppEffectCommit 0;
|
||||
GVAR(ppEffectRadialBlur) ppEffectAdjust [_radBlurSetting, _radBlurSetting, 0.2, 0.2];
|
||||
GVAR(ppEffectRadialBlur) ppEffectCommit 0;
|
||||
};
|
||||
};
|
||||
};
|
||||
case (MODE_NVG_ONZEUS): {
|
||||
if (isNull findDisplay 312) then {
|
||||
if ((currentVisionMode ACE_player) == 0) then {
|
||||
GVAR(currentMode) = MODE_NVG_OFF;
|
||||
} else {
|
||||
GVAR(currentMode) = MODE_NVG_ON;
|
||||
GVAR(ppEffectFilmGrain) ppEffectEnable true;
|
||||
GVAR(ppEffectBlur) ppEffectEnable true;
|
||||
GVAR(ppEffectRadialBlur) ppEffectEnable true;
|
||||
GVAR(ppEffectNVGBrightness) ppEffectEnable true;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
@ -82,7 +82,7 @@ class CfgVehicles {
|
||||
displayName = "Teleport to Rallypoint";
|
||||
distance = 4;
|
||||
condition = QUOTE(side group _player == west);
|
||||
statement = QUOTE([_player, side group _player, false] call FUNC(teleportToRallypoint));
|
||||
statement = QUOTE([ARR_3(_player, side group _player, false)] call FUNC(teleportToRallypoint));
|
||||
showDisabled = 1;
|
||||
priority = 1;
|
||||
};
|
||||
@ -102,7 +102,7 @@ class CfgVehicles {
|
||||
displayName = "Teleport to Rallypoint";
|
||||
distance = 4;
|
||||
condition = QUOTE(side group _player == east);
|
||||
statement = QUOTE([_player, side group _player, false] call FUNC(teleportToRallypoint));
|
||||
statement = QUOTE([ARR_3(_player, side group _player, false)] call FUNC(teleportToRallypoint));
|
||||
showDisabled = 1;
|
||||
priority = 1;
|
||||
};
|
||||
@ -122,7 +122,7 @@ class CfgVehicles {
|
||||
displayName = "Teleport to Rallypoint";
|
||||
distance = 4;
|
||||
condition = QUOTE(side group _player == independent);
|
||||
statement = QUOTE([_player, side group _player, false] call FUNC(teleportToRallypoint));
|
||||
statement = QUOTE([ARR_3(_player, side group _player, false)] call FUNC(teleportToRallypoint));
|
||||
showDisabled = 1;
|
||||
priority = 1;
|
||||
};
|
||||
@ -143,7 +143,7 @@ class CfgVehicles {
|
||||
displayName = "Teleport to Base";
|
||||
distance = 4;
|
||||
condition = QUOTE(side group _player == west);
|
||||
statement = QUOTE([_player, side group _player, true] call FUNC(teleportToRallypoint));
|
||||
statement = QUOTE([ARR_3(_player, side group _player, true)] call FUNC(teleportToRallypoint));
|
||||
showDisabled = 1;
|
||||
priority = 1;
|
||||
};
|
||||
@ -163,7 +163,7 @@ class CfgVehicles {
|
||||
displayName = "Teleport to Base";
|
||||
distance = 4;
|
||||
condition = QUOTE(side group _player == east);
|
||||
statement = QUOTE([_player, side group _player, true] call FUNC(teleportToRallypoint));
|
||||
statement = QUOTE([ARR_3(_player, side group _player, true)] call FUNC(teleportToRallypoint));
|
||||
showDisabled = 1;
|
||||
priority = 1;
|
||||
};
|
||||
@ -183,7 +183,7 @@ class CfgVehicles {
|
||||
displayName = "Teleport to Base";
|
||||
distance = 4;
|
||||
condition = QUOTE(side group _player == independent);
|
||||
statement = QUOTE([_player, side group _player, true] call FUNC(teleportToRallypoint));
|
||||
statement = QUOTE([ARR_3(_player, side group _player, true)] call FUNC(teleportToRallypoint));
|
||||
showDisabled = 1;
|
||||
priority = 1;
|
||||
};
|
||||
@ -196,8 +196,8 @@ class CfgVehicles {
|
||||
class ACE_SelfActions {
|
||||
class ACE_MoveRallypoint {
|
||||
displayName = "Move Rallypoint";
|
||||
condition = QUOTE([_player, side group _player] call FUNC(canMoveRallypoint));
|
||||
statement = QUOTE([_player, side group _player] call FUNC(moveRallypoint));
|
||||
condition = QUOTE([ARR_2(_player, side group _player)] call FUNC(canMoveRallypoint));
|
||||
statement = QUOTE([ARR_2(_player, side group _player)] call FUNC(moveRallypoint));
|
||||
showDisabled = 0;
|
||||
priority = -0.5;
|
||||
};
|
||||
|
@ -1,7 +1,6 @@
|
||||
#include "script_component.hpp"
|
||||
|
||||
PREP(canMoveRallypoint);
|
||||
PREP(getAllGear);
|
||||
PREP(handleKilled);
|
||||
PREP(handleRespawn);
|
||||
PREP(initRallypoint);
|
||||
|
@ -1,16 +1,16 @@
|
||||
/*
|
||||
Name: ACE_Respawn_fnc_handleKilled
|
||||
|
||||
|
||||
Author(s):
|
||||
bux578
|
||||
|
||||
|
||||
Description:
|
||||
Handles the XEH Killed event
|
||||
|
||||
|
||||
Parameters:
|
||||
0: OBJECT - Killed unit
|
||||
1: OBJECT - Attacker
|
||||
|
||||
|
||||
Returns:
|
||||
VOID
|
||||
*/
|
||||
@ -25,7 +25,7 @@ _killedUnit = _this select 0;
|
||||
GVAR(unitGear) = [];
|
||||
|
||||
if (GVAR(SavePreDeathGear)) then {
|
||||
GVAR(unitGear) = [_killedUnit] call FUNC(getAllGear);
|
||||
GVAR(unitGear) = [_killedUnit] call EFUNC(common,getAllGear);
|
||||
};
|
||||
|
||||
if (missionNamespace getVariable [QGVAR(showFriendlyFireMessage), false]) then {
|
||||
|
Loading…
Reference in New Issue
Block a user