Merge pull request #45 from KoffeinFlummi/csePort_fixed

Port from CSE Common.
This commit is contained in:
Glowbal 2015-01-18 20:12:18 +01:00
commit b80cec4c18
114 changed files with 4277 additions and 2 deletions

View File

@ -38,5 +38,8 @@ class Extended_Respawn_EventHandlers {
class GVAR(setName) {
respawn = QUOTE(_this call FUNC(setName));
};
class GVAR(RESETDefaults) {
respawn = QUOTE(_this call FUNC(resetAllDefaults_F));
};
};
};

View File

@ -8,7 +8,7 @@ QGVAR(remoteFnc) addPublicVariableEventHandler {
[missionNamespace] call FUNC(executePersistent);
// check previous version number from profile
_currentVersion = getText (configFile >> "CfgPatches" >> ADDON >> "version");
_currentVersion = getText (configFile >> "CfgPatches" >> QUOTE(ADDON) >> "version");
_previousVersion = profileNamespace getVariable ["ACE_VersionNumberString", ""];
if (_currentVersion != _previousVersion) then {
@ -71,6 +71,7 @@ enableCamShake true;
if (alive _oldPlayer) then {
[_oldPlayer] call FUNC(setName)
};
}] call FUNC(addEventhandler);
GVAR(OldPlayerInventory) = ACE_player call FUNC(getAllGear);
@ -140,3 +141,22 @@ GVAR(OldPlayerTurret) = [ACE_player] call FUNC(getTurretIndex);
};
}, 0, []] call cba_fnc_addPerFrameHandler;
[QGVAR(reviveCounter_f), 0, false, QGVAR(ADDON)] call FUNC(defineVariable);
[QGVAR(inReviveState), false, true, QGVAR(ADDON)] call FUNC(defineVariable);
[QGVAR(isDead),false,true,QUOTE(ADDON)] call FUNC(defineVariable);
[QGVAR(isDeadPlayer), false, true, QUOTE(ADDON)] call FUNC(defineVariable);
[QGVAR(StateArrested),false,true,QUOTE(ADDON)] call FUNC(defineVariable);
["ACE_isUnconscious",false,true,QUOTE(ADDON)] call FUNC(defineVariable);
[QGVAR(ENABLE_REVIVE_SETDEAD_F),0,false,QUOTE(ADDON)] call FUNC(defineVariable);
[QGVAR(carriedBy),objNull,false,QUOTE(ADDON)] call FUNC(defineVariable);
if (isNil QGVAR(ENABLE_REVIVE_F)) then {
GVAR(ENABLE_REVIVE_F) = 0;
};
[
{((_this select 0) getvariable [QGVAR(inReviveState), false])}
] call EFUNC(common,registerUnconsciousCondition);

View File

@ -182,6 +182,81 @@ if (hasInterface) then {
};
PREP(stringCompare);
PREP(string_removeWhiteSpace);
PREP(isHC);
PREP(sendRequest_f);
PREP(requestCallback);
PREP(receiveRequest);
PREP(onAnswerRequest);
PREP(debug);
PREP(debugModule);
PREP(defineVariable);
PREP(setDefinedVariable);
PREP(getDefinedVariable);
PREP(getAllDefinedSetVariables);
PREP(getDefinedVariableInfo);
PREP(getDefinedVariableDefault);
PREP(getDeathAnim);
PREP(insertionSort);
PREP(uniqueElementsOnly);
PREP(sortAlphabeticallyBy);
PREP(hasMagazine);
PREP(useMagazine);
PREP(findMagazine);
PREP(hasItem);
PREP(useItem);
PREP(findItem);
PREP(getNumberMagazinesIn);
PREP(setCanInteract);
PREP(getCanInteract);
PREP(canInteract);
PREP(resetAllDefaults_f);
PREP(broadcastSound3D_f);
PREP(setDead);
PREP(isAwake);
PREP(setProne);
PREP(raiseScriptedEvent_f);
PREP(setDisableUserInputStatus);
PREP(dropWeapon_f);
PREP(inWater_f);
PREP(setVolume_f);
PREP(closeAllDialogs_f);
PREP(disableAI_f);
PREP(moduleBasicRevive);
PREP(switchToGroupSide_f);
PREP(getFirstObjectIntersection);
PREP(getFirstTerrainIntersection);
PREP(setHearingCapability);
PREP(revealObject_f);
PREP(getWeaponItems_f);
PREP(isModLoaded_f);
PREP(inheritsFrom);
PREP(getVersion);
PREP(carryObj);
PREP(carriedByObj);
PREP(getCarriedObj);
PREP(getCarriedBy);
PREP(beingCarried);
PREP(setCarriedBy);
PREP(setUnconsciousState);
PREP(isUnconscious);
PREP(getUnconsciousCondition);
PREP(registerUnconsciousCondition);
PREP(setCaptiveSwitch);
PREP(moveToTempGroup);
PREP(canGoUnconsciousState);
PREP(setWeaponsCorrectUnconscious);
PREP(limitMovementSpeed);
PREP(setArrestState);
PREP(isArrested);
PREP(loadPerson_F);
PREP(loadPersonLocal_F);
PREP(makeCopyOfBody_F);
PREP(unloadPerson_F);
PREP(cleanUpCopyOfBody_F);
ADDON = true;

View File

@ -5,7 +5,7 @@ class CfgPatches {
units[] = {"ACE_Box_Misc"};
weapons[] = {"ACE_ItemCore","ACE_FakePrimaryWeapon"};
requiredVersion = REQUIRED_VERSION;
requiredAddons[] = {"ace_main"};
requiredAddons[] = {"ace_main", "ace_gui"};
author[] = {"KoffeinFlummi"};
authorUrl = "https://github.com/KoffeinFlummi/";
VERSION_CONFIG;
@ -80,3 +80,4 @@ class RscAttributeInventory: RscControlsGroupNoScrollbars {
#include <FixPickup.hpp>
#include <FixAnimations.hpp>
#include <NoVoice.hpp>

View File

@ -0,0 +1,12 @@
/**
* fn_beingCarried.sqf
* @Descr: Check if object is being carried
* @Author: Glowbal
*
* @Arguments: [object OBJECT]
* @Return: BOOL True if object is being carried
* @PublicAPI: true
*/
#include "script_component.hpp"
!(isNull ([_this select 0] call FUNC(getCarriedObj)));

View File

@ -0,0 +1,16 @@
/**
* fn_broadcastSound3D_f.sqf
* @Descr: Plays a sound in 3D
* @Author: Glowbal
*
* @Arguments: [unit OBJECT, sound STRING]
* @Return: void
* @PublicAPI: true
*/
#include "script_component.hpp"
if (isDedicated) exitwith{};
_unit = [_this, 0, ObjNull,[ObjNull]] call BIS_fnc_Param;
_sound = [_this, 1, "",[""]] call BIS_fnc_Param;
_unit say3D _sound;

View File

@ -0,0 +1,17 @@
/**
* fn_canGoUnconsciousState.sqf
* @Descr: Checks if an object can move into unconscious state
* @Author: Glowbal
*
* @Arguments: [unit OBJECT]
* @Return: BOOL true if object can move into unconscious state
* @PublicAPI: true
*/
#include "script_component.hpp"
private ["_unit"];
_unit = _this select 0;
(!(isNull _unit) && {(_unit isKindOf "CaManBase") && ([_unit] call FUNC(isAwake))})

View File

@ -0,0 +1,13 @@
/**
* fn_canInteract.sqf
* @Descr: Check if unit can interact with enviroment. Unit has to be awake and not be in arrested state.
* @Author: Glowbal
*
* @Arguments: [unit OBJECT]
* @Return: BOOL True if unit can interact with enviroment.
* @PublicAPI: true
*/
#include "script_component.hpp"
private ["_unit","_return"];
_unit = _this select 0;
(((_unit getvariable [QGVAR(canInteract),0]) < 1) && ([_unit] call FUNC(isAwake)) && !([_unit] call FUNC(isArrested)))

View File

@ -0,0 +1,13 @@
/**
* fn_carriedByObj.sqf
* @Descr: Check if object A is being carried by object B.
* @Author: Glowbal
*
* @Arguments: [object OBJECT, unit OBJECT]
* @Return: BOOL True if B is carrying A.
* @PublicAPI: true
*/
#include "script_component.hpp"
([(_this select 0)] call FUNC(getCarriedBy) == [(_this select 1)] call FUNC(getCarriedBy));

View File

@ -0,0 +1,74 @@
/**
* fn_carryObj.sqf
* @Descr: Have a unit carry an object. Use ObjNull for second parameter if you want the unit to carry nothing
* @Author: Glowbal
*
* @Arguments: [unit OBJECT, objectToCarry OBJECT, attachToVector ARRAY (Optional)]
* @Return: BOOL Returns true if succesful
* @PublicAPI: true
*/
#include "script_component.hpp"
private ["_unit","_to","_return", "_fallDown", "_carriedObj", "_positionUnit"];
_unit = [_this, 0,ObjNull, [ObjNull]] call bis_fnc_param;
_to = [_this, 1,ObjNull, [ObjNull]] call bis_fnc_param;
_fallDown = false;
if (count _this > 3) then {
_fallDown = _this select 3;
};
_return = false;
[format["fnc_carryObj - UNIT: %1 ATTEMPTS TO CARRY %2",_unit,_to],2] call FUNC(debug);
if (((typeName _to) == "OBJECT" && (isNull ([_unit] call FUNC(getCarriedObj)))) || isNull _to) then {
if (vehicle _unit != _unit) exitwith {};
if (!isNull _to) then {
if ((isNull ([_to] call FUNC(getCarriedObj))) && ([_unit] call FUNC(canInteract))) then {
_return = true;
_unit setvariable [QGVAR(carriedObj),_to,true];
if (_fallDown) then {
// [_unit,_fallDown] call FUNC(limitMovementSpeed);
};
[_to, _unit] call FUNC(setCarriedBy);
if (count _this > 2) then {
if (count (_this select 2) == 3) then {
_to attachTo [_unit,(_this select 2)];
[format["fnc_carryObj - UNIT: %1 TO %2 - attachTo offset: %3",_unit,_to,(_this select 2)],2] call FUNC(debug);
};
} else {
[format["fnc_carryObj - UNIT: %1 TO %2 - Script expects external handling of attachTo Command. Exiting",_unit,_to],2] call FUNC(debug);
};
[[_unit, _to, _fallDown],"carryObject"] call FUNC(raiseScriptedEvent_f);
};
} else {
if (!isNull ([_unit] call FUNC(getCarriedObj))) then {
[format["fnc_carryObj - UNIT: %1 DROPING CARRIED OBJECT",_unit],2] call FUNC(debug);
_carriedObj = ([_unit] call FUNC(getCarriedObj));
detach _carriedObj;
//_carriedObj setPosATL [(getPosATL _carriedObj) select 0, (getPosATL _carriedObj) select 1,0];
if (!surfaceIsWater getPos _unit) then {
_positionUnit = getPosATL _carriedObj;
_positionUnit set [2, ((getPosATL _unit) select 2) + 0.1];
_carriedObj setPosATL _positionUnit;
} else {
_positionUnit = getPosASL _carriedObj;
_positionUnit set [2, ((getPosASL _unit) select 2) + 0.1];
_carriedObj setPosASL _positionUnit;
};
[[_unit, _carriedObj],"carryObjectDropped"] call FUNC(raiseScriptedEvent_f);
[[_unit] call FUNC(getCarriedObj), objNull] call FUNC(setCarriedBy);
_unit setvariable [QGVAR(carriedObj),_to,true];
_return = true;
[[_unit, _to, _fallDown],"carryObject"] call FUNC(raiseScriptedEvent_f);
};
};
} else {
[format["fnc_carryObj - UNIT: %1 FAILED TO CARRY %2 - not an object or already carrying",_unit,_to],2] call FUNC(debug);
};
_return

View File

@ -0,0 +1,26 @@
/**
* fn_cleanUpCopyOfBody_f.sqf
* @Descr: Called from a custom eventhandler to ensure that any copies of bodies are cleaned up.
* @Author: Glowbal
*
* @Arguments: [unit OBJECT]
* @Return: BOOL
* @PublicAPI: true
*/
#include "script_component.hpp"
private ["_unit", "_copy"];
_unit = _this select 0;
_copy = _unit getvariable QGVAR(copyOfBody_f);
if (isnil "_copy") exitwith {false};
[format["Cleaning up a copy of Body: %1 %2", _unit, _copy]] call FUNC(debug);
// lets clean it up
_unit setvariable [QGVAR(originalCopy_f), nil, true];
_unit setvariable [QGVAR(copyOfBody_f), nil, true];
if (!isNull _copy) then {
deleteVehicle _copy;
};
true;

View File

@ -0,0 +1,14 @@
/**
* fn_closeAllDialogs_f.sqf
* @Descr: Close all dialogs
* @Author: Glowbal
*
* @Arguments: []
* @Return: void
* @PublicAPI: true
*/
#include "script_component.hpp"
while {dialog} do {
closeDialog 0;
};

View File

@ -0,0 +1,53 @@
/**
* fn_debug.sqf
* @Descr: Print logging messages through the ACE framework.
* @Author: Glowbal
*
* @Arguments: [message ANY, level NUMBER (Optional)]
* @Return: BOOL True if message has been printed
* @PublicAPI: true
*/
#include "script_component.hpp"
#define DEFAULT_LOGGING_LEVEL -1
#define DEFAULT_TEXT_DISPLAY -1
private ["_msg", "_level", "_prefix", "_defaultLoglevel","_defaultLogDisplayLevel", "_message", "_from"];
_msg = _this select 0;
_level = if (count _this > 1) then {_this select 1} else { 2 };
_defaultLoglevel = if (isNil QGVAR(LOGLEVEL)) then {
DEFAULT_LOGGING_LEVEL;
} else {
GVAR(LOGLEVEL);
};
_defaultLogDisplayLevel = if (isnil QGVAR(LOGDISPLAY_LEVEL)) then {
DEFAULT_TEXT_DISPLAY;
} else {
GVAR(LOGDISPLAY_LEVEL);
};
if (_defaultLoglevel < 0) exitwith {
false
};
if (_level <= _defaultLoglevel) then {
_prefix = switch (_level) do {
case 0: { "ACE Error" };
case 1: { "ACE Warn" };
case 2: { "ACE Debug" };
case 3: { "ACE Info" };
default { "ACE Unknown" };
};
_message = format["[%1] %2",_prefix,_msg];
if (_level >= _defaultLogDisplayLevel) then {
systemChat _message;
};
diag_log _message;
// pass it onwards to the log function:
// [0, [], compile format["%1",_msg], true] call FUNC(log);
};
true

View File

@ -0,0 +1,15 @@
/**
* fn_debugModule.sqf
* @Descr: N/A
* @Author: Glowbal
*
* @Arguments: []
* @Return:
* @PublicAPI: false
*/
#include "script_component.hpp"
private ["_entity"];
_entity = _this select 0;
GVAR(LOGDISPLAY_LEVEL) = call compile (_entity getvariable ["logDisplayLevel","4"]);
GVAR(LOGLEVEL) = call compile (_entity getvariable ["logLevel","4"]);

View File

@ -0,0 +1,40 @@
/**
* fn_defineVariable.sqf
* @Descr: Define a variable for the ACE variable framework
* @Author: Glowbal
*
* @Arguments: [name STRING, defaultValue ANY, publicFlag BOOL, category STRING, type NUMBER, persistentFlag BOOL]
* @Return:
* @PublicAPI: true
*/
#include "script_component.hpp"
private ["_name","_value","_defaultGlobal","_catagory","_code","_persistent"];
_name = _this select 0;
_value = _this select 1;
_defaultGlobal = _this select 2;
_catagory = _this select 3;
_code = 0;
_persistent = false;
if (count _this < 3) exitwith {};
if (count _this > 4) then {
_code = _this select 4;
if (count _this > 5) then {
_persistent = _this select 5;
};
};
if (typeName _name != typeName "") exitwith {
[format["Tried to the deinfe a variable with an invalid name: %1 Arguments: %2", _name, _this]] call FUNC(debug);
};
if (isnil QGVAR(OBJECT_VARIABLES_STORAGE)) then {
GVAR(OBJECT_VARIABLES_STORAGE) = [];
};
GVAR(OBJECT_VARIABLES_STORAGE) pushback [_name,_value,_defaultGlobal,_catagory,_code, _persistent];
missionNamespace setvariable [QGVAR(OBJECT_VARIABLES_STORAGE_) + _name, [_name,_value,_defaultGlobal,_catagory,_code, _persistent]];
[[_name,_value,_defaultGlobal,_catagory,_code, _persistent],"variableDefined"] call FUNC(raiseScriptedEvent_f);

View File

@ -0,0 +1,23 @@
/**
* fn_disableAI_f.sqf
* @Descr: N/A
* @Author: Glowbal
*
* @Arguments: []
* @Return:
* @PublicAPI: false
*/
#include "script_component.hpp"
private ["_unit","_disable"];
_unit = [_this, 0,ObjNull,[ObjNull]] call BIS_fnc_Param;
_disable = [_this, 1,false,[false]] call BIS_fnc_Param;
if (local _unit && !(IsPlayer _unit)) then {
if (_disable) then {
_unit disableAI "Move";
_unit disableAI "TARGET";
} else {
_unit enableAI "Move";
_unit enableAI "TARGET";
};
};

View File

@ -0,0 +1,39 @@
/**
* fn_dropWeapon_f.sqf
* @Descr: N/A
* @Author: Glowbal
*
* @Arguments: []
* @Return:
* @PublicAPI: false
*/
#include "script_component.hpp"
private ["_unit","_currentWeapon","_currentAnimation", "_WeaponHolder"];
_unit = [_this, 0, ObjNull,[ObjNull]] call BIS_fnc_Param;
_currentWeapon = currentWeapon _unit;
_currentAnimation = animationState _unit;
_WeaponHolder = "GroundWeaponHolder" createVehicle position _unit;
_unit removeWeapon _currentWeapon;
_weaponHolder addWeaponCargoGlobal [_currentWeapon, 1];
//_unit action [ "DropWeapon", _WeaponHolder, _currentWeapon ];
_WeaponHolder setPos (getPos _unit);
//_unit switchMove _currentAnimation;
_primairyWeapon = primaryWeapon _unit;
_secondairyWeapon = secondaryWeapon _unit;
_handGunWeapon = handgunWeapon _unit;
switch (_currentWeapon) do {
case _primairyWeapon: {
};
case _secondairyWeapon: {
};
case _handGunWeapon: {
};
default {};
};

View File

@ -0,0 +1,25 @@
/**
* fn_findItem.sqf
* @Descr:
* @Author: Glowbal
*
* @Arguments: []
* @Return:
* @PublicAPI: true
*/
#include "script_component.hpp"
private ["_unit","_magazine","_return"];
_unit = _this select 0;
_item = _this select 1;
if (_item in (uniformItems _unit)) exitwith {1};
if (_item in (vestItems _unit)) exitwith {2};
if (_item in (backpackItems _unit)) exitwith {3};
if (_item in (assignedItems _unit)) exitwith {4};
if (_item in (primaryWeaponItems _unit)) exitwith {5};
if (_item in (secondaryWeaponItems _unit)) exitwith {6};
if (_item in (handgunItems _unit)) exitwith {7};
if (_item in (items _unit)) exitwith {8}; // in case it is in items but cannot be found in any other container (should never reach this)
// If we cannot find the item, return 0.
0;

View File

@ -0,0 +1,21 @@
/**
* fn_findMagazine.sqf
* @Descr: Find where the current magazines are. Order: uniform, vest, backpack, any.
* @Author: Glowbal
*
* @Arguments: [unit OBJECT, magazine STRING (Classname of magazine)]
* @Return: NUMBER 0 = none, 1 = in uniform, 2 = in vest, 3 = in backpack, 4 = found outside container
* @PublicAPI: true
*/
#include "script_component.hpp"
private ["_unit","_magazine"];
_unit = _this select 0;
_magazine = _this select 1;
if (_magazine in (getMagazineCargo uniformContainer _unit)) exitwith {1};
if (_magazine in (getMagazineCargo vestContainer _unit)) exitwith {2};
if (_magazine in (getMagazineCargo backpackContainer _unit)) exitwith {3};
if (_magazine in (magazines _unit)) exitwith {4}; // in case it cannot be found in any other container. Most likely loaded in a weapon.
// If we cannot find the item, return 0.
0;

View File

@ -0,0 +1,30 @@
/**
* fn_getAllSetVariables.sqf
* @Descr: Returns an 2d array of all variables that have been set on the object
* @Author: Glowbal
*
* @Arguments: [unit OBJECT, category STRING (Optional. Only get the variables from the specified category. Default is "" == all)]
* @Return: ARRAY REturns an array with the format [ [name STRING, typeName STRING, value ANY, publicFlag BOOL, peristentFlag BOOL] ]
* @PublicAPI: true
*/
#include "script_component.hpp"
private ["_object", "_return", "_val", "_category"];
_object = _this select 0;
_category = if (count _this > 1) then { _this select 1 } else { "" };
if (isnil QGVAR(OBJECT_VARIABLES_STORAGE)) exitwith {
[];
};
_return = [];
{
_val = _object getvariable (_x select 0);
if (!isnil "_val") then {
if (_category == "" || _category == _x select 3) then {
_return pushback [_x select 0, typeName _val, _val, _x select 2, _x select 5];
};
};
}foreach GVAR(OBJECT_VARIABLES_STORAGE);
_return

View File

@ -0,0 +1,12 @@
/**
* fn_getCanInteract.sqf
* @Descr: N/A
* @Author: Glowbal
*
* @Arguments: []
* @Return:
* @PublicAPI: false
*/
#include "script_component.hpp"
((_this select 0) getvariable [QGVAR(canInteract),0])

View File

@ -0,0 +1,13 @@
/**
* fn_getCarriedBy.sqf
* @Descr: Get the object that is carrying given unit or object
* @Author: Glowbal
*
* @Arguments: [unit OBJECT]
* @Return: OBJECT Returns the object that is carrying the unit. Otherwise returns ObjNull
* @PublicAPI: true
*/
#include "script_component.hpp"
((_this select 0) getvariable [QGVAR(carriedBy),objNull]);

View File

@ -0,0 +1,13 @@
/**
* fn_getCarriedObj.sqf
* @Descr: Grab the registered carried object
* @Author: Glowbal
*
* @Arguments: [unit OBJECT]
* @Return: OBJECT Returns the object that the unit is currently carrying. If not carrying, returns ObjNull
* @PublicAPI: true
*/
#include "script_component.hpp"
((_this select 0) getvariable [QGVAR(carriedObj),objNull]);

View File

@ -0,0 +1,45 @@
/**
* fn_getCustomResults_f.sqf
* @Descr: Executes custom results eventhandlers, collects their output and returns this.
* @Author: Glowbal
*
* @Arguments: [arguments ANY, handle STRING]
* @Return: ARRAY Collection of all return values of all executed CustomResult handlers
* @PublicAPI: true
*/
#include "script_component.hpp"
private ["_arguments","_handle","_ehCfg","_eventHandlerCollection","_eventHandlerName","_cfg","_code","_classType", "_return"];
_arguments = _this select 0;
_handle = _this select 1;
_eventHandlerName = ("ace_f_custom_results_eventhandler_" + _handle);
_eventHandlerCollection = missionNamespace getvariable _eventHandlerName;
if (isnil "_eventHandlerCollection") then {
_eventHandlerCollection = [];
// TODO Get a replacement for this
_cfg = (ConfigFile >> "Advanced_Combat_Environment" >> "CustomResults" >> _handle);
if (isClass _cfg) then {
_numberOfEH = count _cfg;
for [{_EHiterator=0}, {(_EHiterator< _numberOfEH)}, {_EHiterator=_EHiterator+1}] do {
_ehCfg = _cfg select _EHiterator;
if (isClass _ehCfg) then {
_classType = (ConfigName _ehCfg);
_code = (compile getText(_ehCfg >> "onCall"));
_eventHandlerCollection pushback [_classType, _code];
true;
};
};
};
missionNamespace setvariable [_eventHandlerName, _eventHandlerCollection];
};
_return = [];
{
_return pushback (_arguments call (_x select 1));
false;
}count _eventHandlerCollection;
_return

View File

@ -0,0 +1,38 @@
/**
* fn_getDeathAnim.sqf
* @Descr: Get the death animation for the unit at current time
* @Author: Glowbal
*
* @Arguments: [unit OBJECT]
* @Return: STRING animation
* @PublicAPI: true
*/
#include "script_component.hpp"
private ["_unit", "_curAnim", "_animation", "_cfg","_unitAnimation", "_animationState"];
_unit = _this select 0;
if (vehicle _unit != _unit) exitwith {
_animation = "";
_animationState = (animationState _unit);
_unitAnimation = (configFile >> "CfgMovesMaleSdr" >> "States" >> _animationState);
if (isText (_unitAnimation >> "actions")) then {
if ((vehicle _unit) != _unit) then {
_cfg = (configFile >> "CfgMovesMaleSdr" >> "States" >> _animationState);
if (isArray (_cfg >> "interpolateTo")) then {
_animation = getArray (_cfg >> "interpolateTo") select 0;
};
} else {
_cfg = (configFile >> "CfgMovesBasic" >> "Actions" >> (getText (_unitAnimation >> "actions")) >> "die");
if (isText _cfg) then {
_animation = getText _cfg;
};
};
};
if (isnil "_animation") then {
_animation = "";
};
_animation;
};
"Unconscious";

View File

@ -0,0 +1,33 @@
/**
* fn_getVariable.sqf
* @Descr: Grabs a variable. If variable has not been set, attempts to use default defined value
* @Author: Glowbal
*
* @Arguments: [unit OBJECT, variableName STRING]
* @Return: ANY
* @PublicAPI: true
*/
#include "script_component.hpp"
#define UNIT (_this select 0)
#define VARIABLE (_this select 1)
private "_value";
_value = UNIT getvariable VARIABLE;
if (isnil "_value") then {
if (count _this >2) then {
_value = _this select 2;
} else {
private "_definedVariable";
_definedVariable = ([VARIABLE] call FUNC(getDefinedVariableInfo));
if (count _definedVariable > 1) then {
_value = _definedVariable select 1;
};
};
if (isnil "_value") then {
_value = 0;
};
};
_value

View File

@ -0,0 +1,19 @@
/**
* fn_getvariableDefault.sqf
* @Descr: Get the variable default value
* @Author: Glowbal
*
* @Arguments: [variableName STRING]
* @Return: ANY
* @PublicAPI: true
*/
#include "script_component.hpp"
private "_variableDefinition";
_variableDefinition = ([_this select 0] call FUNC(getDefinedVariableInfo));
if (count _variableDefinition > 0) exitwith {
_variableDefinition select 1;
};
nil;

View File

@ -0,0 +1,11 @@
/**
* fn_getvariableInfo.sqf
* @Descr: N/A
* @Author: Glowbal
*
* @Arguments: []
* @Return:
* @PublicAPI: false
*/
#include "script_component.hpp"
+(missionNamespace getvariable [QGVAR(OBJECT_VARIABLES_STORAGE_) + (_this select 0),[]])

View File

@ -0,0 +1,44 @@
/**
* fn_getFirstIntersection.sqf
* @Descr: Returns the the first intersection with an object between two positions
* @Author: Ruthberg
*
* @Arguments: [position PositionASL, position PositionASL, accuracy FLOAT]
* @Return: [intersects BOOL, intersection PositionASL]
* @PublicAPI: true
*/
#include "script_component.hpp"
private ["_source", "_destination", "_accuracy", "_distance", "_lower", "_upper", "_mid", "_intersections", "_result"];
_source = _this select 0;
_destination = _this select 1;
_accuracy = _this select 2;
_result = [false, [0, 0, 0]];
_distance = _source vectorDistance _destination;
if (count (lineIntersectsWith [_source, _destination]) > 0) then {
_lower = 0;
_upper = 1;
_mid = 0.5;
_dir = _source vectorFromTo _destination;
while {(_upper - _lower) * _distance > _accuracy} do {
_mid = _lower + (_upper - _lower) / 2;
_intersections = count (lineIntersectsWith [_source, _source vectorAdd (_dir vectorMultiply (_mid * _distance))]);
if (_intersections > 0) then {
_upper = _mid;
} else {
_lower = _mid;
};
};
_mid = _lower + (_upper - _lower) / 2;
_result = [true, _source vectorAdd (_dir vectorMultiply (_mid * _distance))];
};
_result

View File

@ -0,0 +1,44 @@
/**
* fn_getFirstIntersection.sqf
* @Descr: Returns the the first intersection with an object between two positions
* @Author: Ruthberg
*
* @Arguments: [position PositionASL, position PositionASL, accuracy FLOAT]
* @Return: [intersects BOOL, intersection PositionASL]
* @PublicAPI: true
*/
#include "script_component.hpp"
private ["_source", "_destination", "_accuracy", "_distance", "_lower", "_upper", "_mid", "_intersection", "_result"];
_source = _this select 0;
_destination = _this select 1;
_accuracy = _this select 2;
_result = [false, [0, 0, 0]];
_distance = _source vectorDistance _destination;
if (terrainIntersectASL [_source, _destination]) then {
_lower = 0;
_upper = 1;
_mid = 0.5;
_dir = _source vectorFromTo _destination;
while {(_upper - _lower) * _distance > _accuracy} do {
_mid = _lower + (_upper - _lower) / 2;
_intersection = terrainIntersectASL [_source, _source vectorAdd (_dir vectorMultiply (_mid * _distance))];
if (_intersection) then {
_upper = _mid;
} else {
_lower = _mid;
};
};
_mid = _lower + (_upper - _lower) / 2;
_result = [true, _source vectorAdd (_dir vectorMultiply (_mid * _distance))];
};
_result

View File

@ -0,0 +1,28 @@
/**
* fn_getNumberMagazinesIn.sqf
* @Descr:
* @Author: Glowbal
*
* @Arguments: []
* @Return:
* @PublicAPI: true
*/
#include "script_component.hpp"
private ["_unit","_magazine"];
_unit = _this select 0;
_magazine = _this select 1;
_return = 0;
if (_unit isKindOf "CAManBase") then {
_return = {_x == _magazine} count magazines _unit;
} else {
{
_return = _return + {_x == _magazine} count magazines _x;
}foreach (crew _unit);
_return = _return + ({_x == _magazine} count getMagazineCargo _unit);
};
_return

View File

@ -0,0 +1,29 @@
/**
* fn_getUnconsciousCondition.sqf
* @Descr: get whatever or not a unit should be or stay unconscious
* @Author: Glowbal
*
* @Arguments: [unit OBJECT]
* @Return: BOOL True when the unit should be unconscious
* @PublicAPI: true
*/
#include "script_component.hpp"
private ["_unit","_return"];
_unit = _this select 0;
if (isnil QGVAR(unconsciousConditions_F)) then {
GVAR(unconsciousConditions_F) = [];
};
_return = false;
{
if (typeName _x == typeName {}) then {
if (([_unit] call _x)) then {
_return = true;
};
};
if (_return) exitwith{};
}foreach GVAR(unconsciousConditions_F);
_return

View File

@ -0,0 +1,11 @@
/**
* fn_getVersion.sqf
* @Descr: Get the version number of the current ACE Build
* @Author: Glowbal
*
* @Arguments: []
* @Return: STRING String containing the version
* @PublicAPI: true
*/
#include "script_component.hpp"
getText (configFile >> "cfgPatches" >> "ACE_main" >> "version");

View File

@ -0,0 +1,14 @@
/**
* fn_getWeaponItems_f.sqf
* @Descr: Get the weapon items from the unit.
* @Author: Glowbal
*
* @Arguments: [unit OBJECT]
* @Return:
* @PublicAPI: false
*/
#include "script_component.hpp"
private "_unit";
_unit = _this select 0;
[primaryWeaponItems _unit, secondaryWeaponItems _unit, handgunItems _unit];

View File

@ -0,0 +1,13 @@
/**
* fn_hasItem.sqf
* @Descr: Check if unit has item
* @Author: Glowbal
*
* @Arguments: [unit OBJECT, item STRING (Classname of item)]
* @Return: BOOL
* @PublicAPI: true
*/
#include "script_component.hpp"
// item classname in items unit
((_this select 1) in items (_this select 0));

View File

@ -0,0 +1,22 @@
/**
* fn_hasMagazine.sqf
* @Descr: Check if given unit has a magazine of given classname
* @Author: Glowbal
*
* @Arguments: [unit OBJECT, magazine STRING]
* @Return: BOOL True if unith as given magazine
* @PublicAPI: true
*/
#include "script_component.hpp"
private ["_unit","_magazine","_return"];
_unit = _this select 0;
_magazine = _this select 1;
if (_magazine != "") then {
_return = (_magazine in magazines _unit);
} else {
_return = false;
};
_return

View File

@ -0,0 +1,22 @@
/**
* fn_inWater_f.sqf
* @Descr: Check if unit is underwater
* @Author: Glowbal
*
* @Arguments: [unit OBJECT]
* @Return: BOOL True if unit is in the water
* @PublicAPI: true
*/
#include "script_component.hpp"
private ["_unit","_return","_aslPos"];
_unit = _this select 0;
_return = false;
if ((surfaceIsWater getPos _unit)) then {
_aslPos = _unit modelToWorld (_unit selectionPosition "head");
if ((_aslPos select 2) <= 0) then {
_return = true;
};
};
_return;

View File

@ -0,0 +1,26 @@
/**
* fn_inheritsFrom.sqf
* @Descr: Checks whether a given configuration name appears in the inheritance tree of a specific configuration entry.
* @Author: Ruthberg
*
* @Arguments: [configEntry CONFIG, configname STRING]
* @Return: BOOL
* @PublicAPI: true
*/
#include "script_component.hpp"
private ["_configEntry","_configMatch", "_match"];
_configEntry = _this select 0;
_configMatch = _this select 1;
if (configName _configEntry == _configMatch) exitWith { true };
if (configName _configEntry == ",") exitWith { false };
_match = false;
while {configName _configEntry != ""} do {
if (configName _configEntry == _configMatch) exitWith { _match = true };
_configEntry = inheritsFrom(_configEntry);
};
_match

View File

@ -0,0 +1,34 @@
/**
* fn_insertionSort.sqf
* @Descr: Sorts an array of numbers
* @Author: Ruthberg
*
* @Arguments: [array ARRAY, (optional) ascending BOOL]
* @Return: sortedArray ARRAY
* @PublicAPI: true
*/
#include "script_component.hpp"
private ["_list", "_ascending", "_tmp", "_i", "_j"];
_list = +(_this select 0);
_ascending = true;
if (count _this > 1) then {
_ascending = _this select 1;
};
for "_i" from 1 to (count _list) - 1 do {
_tmp = _list select _i;
_j = _i;
while {_j >= 1 && {_tmp < _list select (_j - 1)}} do {
_list set [_j, _list select (_j - 1)];
_j = _j - 1;
};
_list set[_j, _tmp];
};
if (!_ascending) then {
reverse _list;
};
_list

View File

@ -0,0 +1,13 @@
/**
* fn_isArrested.sqf
* @Descr: Check if unit is in arrested state
* @Author: Glowbal
*
* @Arguments: [unit OBJECT]
* @Return: BOOL Returns true if unit or object is in arrest state
* @PublicAPI: true
*/
#include "script_component.hpp"
((_this select 0) getvariable [QGVAR(StateArrested),false])

View File

@ -0,0 +1,15 @@
/**
* fn_isAwake.sqf
* @Descr: Check if unit is awake. Will be false when death or unit is unconscious.
* @Author: Glowbal
*
* @Arguments: [unit OBJECT]
* @Return: BOOL True if unit is awake
* @PublicAPI: true
*/
#include "script_component.hpp"
private ["_unit","_return"];
_unit = _this select 0;
(!([_unit] call FUNC(isUnconscious))) && alive _unit && !(_unit getvariable [QGVAR(isDead),false]);

View File

@ -0,0 +1,24 @@
/**
* fn_isHC.sqf
* @Descr: Check if current locality is a headless client
* @Author: Glowbal
*
* @Arguments: []
* @Return: BOOL True if locality is headless client OR is not in multiplayer
* @PublicAPI: true
*/
#include "script_component.hpp"
private ["_return"];
if (!isMultiplayer) then {
_return = true;
} else {
if (isServer && !isDedicated) then {
_return = true;
} else {
_return = !(hasInterface || isDedicated);
};
};
_return

View File

@ -0,0 +1,13 @@
/**
* fn_isModLoaded_f.sqf
* Descr: Check in cfgPatches if modification is loaded
* Author: Glowbal
*
* Arguments: [modName STRING (Classname of the mod in cfgPatches)]
* Return: BOOL true if modification is loaded
* PublicAPI: true
*/
#include "script_component.hpp"
(isClass (configFile >> "cfgPatches" >> (_this select 0)))

View File

@ -0,0 +1,13 @@
/**
* fn_isUnconscious.sqf
* @Descr: Checks whatever given object is in the unconscious state
* @Author: Glowbal
*
* @Arguments: [unit OBJECT]
* @Return: BOOL True when object is in unconscious state
* @PublicAPI: true
*/
#include "script_component.hpp"
((_this select 0) getvariable ["ACE_isUnconscious",false]);

View File

@ -0,0 +1,53 @@
/**
* fn_limitMovementSpeed.sqf
* @Descr: Limits the movement speed of a unit
* @Author: Glowbal
*
* @Arguments: [unit OBJECT, fallDown BOOL (Optional)]
* @Return: void
* @PublicAPI: true
*/
#include "script_component.hpp"
private ["_unit","_carriedObj"];
_unit = _this select 0;
_fallDown = false;
if (count _this > 1) then {
_fallDown = _this select 1;
};
if ((_unit getvariable [QGVAR(limitMovementSpeed),false])) exitwith {
_unit setvariable [QGVAR(limitMovementSpeed),nil,true];
};
[{
private["_unit","_fallDown","_carriedObj"];
_unit = (_this select 0) select 0;
_fallDown = (_this select 0) select 1;
_carriedObj = [_unit] call FUNC(getCarriedObj);
if !(_unit getvariable [QGVAR(limitMovementSpeed),false]) exitwith {
[(_this select 1)] call cba_fnc_removePerFrameHandler;
};
if !((!isNull _carriedObj) && (alive _unit)) exitwith {
[(_this select 1)] call cba_fnc_removePerFrameHandler;
};
if (speed _unit > 12 && vehicle _unit == _unit && isTouchingGround _unit) then {
_unit setVelocity [0,0,0];
if (_fallDown) then {
_unit playMove "amovppnemstpsraswrfldnon";
};
if (_carriedObj isKindOf "Man") then {
hint "You can not move this fast while transporting this person.";
} else {
hint "You can not move this fast while carrying this object";
};
[_unit,ObjNull] call FUNC(carryObj);
};
}, 0.5, [_unit,_fallDown] ] call CBA_fnc_addPerFrameHandler;

View File

@ -0,0 +1,39 @@
/**
* fn_loadPersonLocal_f.sqf
* @Descr: Load a person, local
* @Author: Glowbal
*
* @Arguments: [unit OBJECT, vehicle OBJECT, caller OBJECT]
* @Return: void
* @PublicAPI: false
*/
#include "script_component.hpp"
private ["_unit","_vehicle","_caller","_handle","_loaded"];
_unit = [_this, 0, ObjNull,[ObjNull]] call BIS_fnc_Param;
_vehicle = [_this, 1, ObjNull,[ObjNull]] call BIS_fnc_Param;
_caller = [_this, 2, ObjNull,[ObjNull]] call BIS_fnc_Param;
if (!alive _unit) then {
_unit = [_unit,_caller] call FUNC(makeCopyOfBody_F);
};
_unit moveInCargo _vehicle;
_loaded = _vehicle getvariable [QGVAR(loaded_persons_F),[]];
_loaded pushback _unit;
_vehicle setvariable [QGVAR(loaded_persons_F),_loaded,true];
if (!([_unit] call FUNC(isAwake))) then {
_handle = [_unit,_vehicle] spawn {
private ["_unit","_vehicle"];
_unit = _this select 0;
_vehicle = _this select 1;
waituntil {vehicle _unit == _vehicle};
sleep 0.5;
[_unit,([_unit] call FUNC(getDeathAnim)), 1] call FUNC(doAnimation);
};
} else {
if ([_unit] call FUNC(isArrested)) then {
};
};

View File

@ -0,0 +1,42 @@
/**
* fn_loadPerson_f.sqf
* @Descr: Loads a specified unit into any nearby vehicle
* @Author: Glowbal
*
* @Arguments: [caller OBJECT, unitToBeLoaded OBJECT]
* @Return: OBJECT Returns the vehicle that the unitToBeloaded has been loaded in. Returns ObjNull if function failed
* @PublicAPI: true
*/
#include "script_component.hpp"
#define GROUP_SWITCH_ID QUOTE(FUNC(loadPerson_F))
private ["_caller", "_unit","_vehicle", "_loadcar", "_loadhelicopter", "_loadtank"];
_caller = [_this, 0, ObjNull,[ObjNull]] call BIS_fnc_Param;
_unit = [_this, 1, ObjNull,[ObjNull]] call BIS_fnc_Param;
_vehicle = ObjNull;
if (!([_caller] call FUNC(canInteract)) || {_caller == _unit}) exitwith {_vehicle};
_loadcar = nearestObject [_unit, "car"];
if (_unit distance _loadcar <= 10) then {
_vehicle = _loadcar;
} else {
_loadhelicopter = nearestObject [_unit, "air"];
if (_unit distance _loadhelicopter <= 10) then {
_vehicle = _loadhelicopter;
} else {
_loadtank = nearestObject [_unit, "tank"];
if (_unit distance _loadtank <= 10) then {
_vehicle = _loadtank;
};
};
};
if (!isNull _vehicle) then {
[_unit, true, GROUP_SWITCH_ID, side group _caller] call FUNC(switchToGroupSide_f);
[_caller,objNull] call FUNC(carryObj);
[_unit,objNull] call FUNC(carryObj);
[[_unit, _vehicle,_caller], QUOTE(FUNC(loadPersonLocal_F)), _unit, false] call EFUNC(common,execRemoteFnc);
};
_vehicle

View File

@ -0,0 +1,75 @@
/**
* fn_makeCopyOfBody_f.sqf
* @Descr: Makes a copy of a dead body. For handling dead bodies for actions such as load and carry.
* @Author: Glowbal
*
* @Arguments: [oldBody OBJECT, caller OBJECT]
* @Return: newUnit OBJECT Returns the copy of the unit. If no copy could be made, returns the oldBody
* @PublicAPI: false
*/
#include "script_component.hpp"
private ["_oldBody","_newUnit","_class","_group","_position","_side","_allVariables"];
_oldBody = _this select 0;
_caller = _this select 1;
if (alive _oldBody) exitwith {_oldBody}; // we only want to do this for dead bodies
_name = _oldBody getvariable [QGVAR(name),"unknown"];
_class = typeof _oldBody;
_side = side _caller;
_group = createGroup _side;
_position = getPos _oldBody;
_newUnit = _group createUnit [typeof _oldBody, _position, [], 0, "NONE"];
_allVariables = [_oldBody] call FUNC(getAllDefinedSetVariables);
// [NAME (STRING), TYPENAME (STRING), VALUE (ANY), DEFAULT GLOBAL (BOOLEAN)]
{
[_newUnit,_x select 0, _x select 2] call FUNC(setDefinedVariable);
}foreach _allVariables;
_newUnit setVariable [QGVAR(name),_name,true];
_newUnit disableAI "TARGET";
_newUnit disableAI "AUTOTARGET";
_newUnit disableAI "MOVE";
_newUnit disableAI "ANIM";
_newUnit disableAI "FSM";
_newUnit setvariable [QGVAR(isDead),true,true];
removeallweapons _newUnit;
removeallassigneditems _newUnit;
removeUniform _newUnit;
removeHeadgear _newUnit;
removeBackpack _newUnit;
removeVest _newUnit;
_newUnit addHeadgear (headgear _oldBody);
_newUnit addBackpack (backpack _oldBody);
clearItemCargoGlobal (backpackContainer _newUnit);
clearMagazineCargoGlobal (backpackContainer _newUnit);
clearWeaponCargoGlobal (backpackContainer _newUnit);
_newUnit addVest (vest _oldBody);
clearItemCargoGlobal (backpackContainer _newUnit);
clearMagazineCargoGlobal (backpackContainer _newUnit);
clearWeaponCargoGlobal (backpackContainer _newUnit);
_newUnit addUniform (uniform _oldBody);
clearItemCargoGlobal (backpackContainer _newUnit);
clearMagazineCargoGlobal (backpackContainer _newUnit);
clearWeaponCargoGlobal (backpackContainer _newUnit);
{_newUnit addMagazine _x} count (magazines _oldBody);
{_newUnit addWeapon _x} count (weapons _oldBody);
{_newUnit addItem _x} count (items _oldBody);
_newUnit selectWeapon (primaryWeapon _newUnit);
//_newUnit playMoveNow ([_newUnit] call FUNC(getDeathAnim));
deleteVehicle _oldBody;
// TODO sometimes the old body does not get cleaned up properly. Look into garbage collection.
_newUnit setDamage 0.9;
_newUnit

View File

@ -0,0 +1,24 @@
/**
* fn_moduleEnableBasicRevive.sqf
* @Descr: N/A
* @Author: Glowbal
*
* @Arguments: []
* @Return:
* @PublicAPI: false
*/
#include "script_component.hpp"
private ["_logic"];
_logic = _this select 0;
GVAR(Module) = true;
[_logic, QGVAR(ENABLE_REVIVE_F), "enableFor" ] call EFUNC(common,readNumericParameterFromModule);
[_logic, QGVAR(REVIVE_TIMER_MAX_F), "timer" ] call EFUNC(common,readNumericParameterFromModule);
[_logic, QGVAR(REVIVE_NUMBER_MAX_F), "amountOf" ] call EFUNC(common,readNumericParameterFromModule);
[
{(((_this select 0) getvariable[QGVAR(ENABLE_REVIVE_SETDEAD_F),0]) > 0)}
] call FUNC(registerUnconsciousCondition);

View File

@ -0,0 +1,32 @@
/**
* fn_moveToTempGroup_f.sqf
* Moves a unit into a temporarly group and stores its original group to allow rejoining.
* @Author: Glowbal
*
* @Arguments: [unit OBJECT, moveToTempGroup BOOL]
* @Return: void
* @PublicAPI: false
*/
#include "script_component.hpp"
private ["_unit","_moveTo","_previousGroup","_newGroup", "_currentGroup", "_switchToGroup"];
_unit = [_this, 0,ObjNull,[ObjNull]] call BIS_fnc_Param;
_moveTo = [_this, 1,false,[false]] call BIS_fnc_Param;
if (_moveTo) then {
_previousGroup = group _unit;
_newGroup = createGroup (side _previousGroup);
[_unit] joinSilent _newGroup;
_unit setvariable [QGVAR(previousGroup_F),_previousGroup];
} else {
_previousGroup = _unit getvariable QGVAR(previousGroup_F);
if (!isnil "_previousGroup") then {
_currentGroup = group _unit;
_unit setvariable [QGVAR(previousGroup_F),nil];
[_unit] joinSilent _previousGroup;
if (count units _currentGroup == 0) then {
deleteGroup _currentGroup;
};
};
};

View File

@ -0,0 +1,38 @@
/**
* fn_onAnswerRequest.sqf
* @Descr: N/A
* @Author: Glowbal
*
* @Arguments: []
* @Return:
* @PublicAPI: false
*/
#include "script_component.hpp"
private ["_unit","_requestID", "_id", "_accepted", "_info", "_callBack", "_caller", "_replyParams", "_requestMessage", "_target"];
_unit = _this select 0;
_id = _this select 1;
_accepted = _this select 2;
_info = _unit getvariable _id;
if (!isnil "_info") then {
_caller = _info select 0;
_target = _info select 1;
_requestID = _info select 2;
_requestMessage = _info select 3;
_callBack = _info select 4;
_replyParams = [_info, _accepted];
[_replyParams, QUOTE(FUNC(requestCallback)), _caller, false] call FUNC(execRemoteFnc);
_unit setvariable [_id, nil];
};
GVAR(RECIEVE_REQUEST_ID_KEY_BINDING) = nil;
if (!isnil QGVAR(RECIEVE_REQUEST_ADD_ACTION_ACCEPT)) then {
_unit removeAction GVAR(RECIEVE_REQUEST_ADD_ACTION_ACCEPT);
GVAR(RECIEVE_REQUEST_ADD_ACTION_ACCEPT) = nil;
};
if (!isnil QGVAR(RECIEVE_REQUEST_ADD_ACTION_DECLINE)) then {
_unit removeAction GVAR(RECIEVE_REQUEST_ADD_ACTION_DECLINE);
GVAR(RECIEVE_REQUEST_ADD_ACTION_DECLINE) = nil;
};

View File

@ -0,0 +1,64 @@
/**
* fn_raiseScriptedEvent_f.sqf
* @Descr: Execute a custom defined eventhandler.
* @Author: Glowbal
*
* @Arguments: [arguments ANY, handle STRING (The name of the eventhandler)]
* @Return: ARRAY Array containing the results of the called eventhandlers.
* @PublicAPI: true
*/
#include "script_component.hpp"
private ["_arguments","_handle","_ehCfg","_eventHandlerCollection","_eventHandlerName","_cfg","_code","_classType", "_return"];
_arguments = _this select 0;
_handle = _this select 1;
// TODO figure out how we want to handle custom eventhandlers
_eventHandlerName = (QGVAR(f_custom_eventhandlers_) + _handle);
_eventHandlerCollection = missionNamespace getvariable _eventHandlerName;
if (isnil "_eventHandlerCollection") then {
_eventHandlerCollection = [];
[format["caching Custom Eventhandler: %1",_handle]] call FUNC(debug);
_cfg = (ConfigFile >> "ACE_Eventhandlers" >> "CustomEventHandlers" >> _handle);
if (isClass _cfg) then {
_numberOfEH = count _cfg;
for "_EHiterator" from 0 to (_numberOfEH -1) /* step +1 */ do {
//for [{_EHiterator=0}, {(_EHiterator< _numberOfEH)}, {_EHiterator=_EHiterator+1}] do {
_ehCfg = _cfg select _EHiterator;
if (isClass _ehCfg) then {
_classType = (ConfigName _ehCfg);
_code = (compile getText(_ehCfg >> "onCall"));
_eventHandlerCollection pushback [_classType, _code];
true;
};
};
};
_cfg = (MissionConfigFile >> "ACE_Eventhandlers" >> "CustomEventHandlers" >> _handle);
if (isClass _cfg) then {
_numberOfEH = count _cfg;
for "_EHiterator" from 0 to (_numberOfEH -1) /* step +1 */ do {
//for [{_EHiterator=0}, {(_EHiterator< _numberOfEH)}, {_EHiterator=_EHiterator+1}] do {
_ehCfg = _cfg select _EHiterator;
if (isClass _ehCfg) then {
_classType = (ConfigName _ehCfg);
_code = (compile getText(_ehCfg >> "onCall"));
_eventHandlerCollection pushback [_classType, _code];
true;
};
};
};
missionNamespace setvariable [_eventHandlerName, _eventHandlerCollection];
[format["Custom Eventhandler: %1 cache: %2",_handle, _eventHandlerCollection]] call FUNC(debug);
};
_return = [];
{
_return pushback (_arguments call (_x select 1));
}foreach _eventHandlerCollection;
_return

View File

@ -0,0 +1,69 @@
/**
* fn_recieveRequest.sqf
* @Descr: N/A
* @Author: Glowbal
*
* @Arguments: []
* @Return:
* @PublicAPI: false
*/
#include "script_component.hpp"
private ["_caller", "_target", "_requestID", "_requestMessage", "_callBack"];
_caller = _this select 0;
_target = _this select 1;
_requestID = _this select 2;
_requestMessage = _this select 3;
_callBack = _this select 4;
_requestID = ("ace_recieveRequest_f_id_"+_requestID);
_target setvariable [_requestID, _this];
if (isLocalized _requestMessage) then {
_requestMessage = format[localize _requestMessage,[_caller] call FUNC(getName)];
} else {
_requestMessage = format[_requestMessage,[_caller] call FUNC(getName)];
};
hint format["%1",_requestMessage];
if !(isnil QGVAR(RECIEVE_REQUEST_TIME_OUT_SCRIPT)) then {
terminate GVAR(RECIEVE_REQUEST_TIME_OUT_SCRIPT);
};
if (!isnil QGVAR(RECIEVE_REQUEST_ADD_ACTION_ACCEPT)) then {
_target removeAction GVAR(RECIEVE_REQUEST_ADD_ACTION_ACCEPT);
GVAR(RECIEVE_REQUEST_ADD_ACTION_ACCEPT) = nil;
};
if (!isnil QGVAR(RECIEVE_REQUEST_ADD_ACTION_DECLINE)) then {
_target removeAction GVAR(RECIEVE_REQUEST_ADD_ACTION_DECLINE);
GVAR(RECIEVE_REQUEST_ADD_ACTION_DECLINE) = nil;
};
GVAR(RECIEVE_REQUEST_ADD_ACTION_ACCEPT) = _target addAction ["Accept", compile format["[player,'%1', true] call FUNC(onAnswerRequest);", _requestID]];
GVAR(RECIEVE_REQUEST_ADD_ACTION_DECLINE) = _target addAction ["Decline", compile format["[player,'%1', false] call FUNC(onAnswerRequest);", _requestID]];
GVAR(RECIEVE_REQUEST_ID_KEY_BINDING) = _requestID;
GVAR(RECIEVE_REQUEST_TIME_OUT_SCRIPT) = [time, _target, _requestID] spawn {
_t = (_this select 0) + 40;
_target = _this select 1;
_requestID = _this select 2;
_id = _target getvariable _requestID;
waituntil {
_id = _target getvariable _requestID;
(time > _t || isnil "_id")};
_target setvariable [_requestID, nil];
GVAR(RECIEVE_REQUEST_ID_KEY_BINDING) = nil;
if (!isnil QGVAR(RECIEVE_REQUEST_ADD_ACTION_ACCEPT)) then {
_target removeAction GVAR(RECIEVE_REQUEST_ADD_ACTION_ACCEPT);
GVAR(RECIEVE_REQUEST_ADD_ACTION_ACCEPT) = nil;
};
if (!isnil QGVAR(RECIEVE_REQUEST_ADD_ACTION_DECLINE)) then {
_target removeAction GVAR(RECIEVE_REQUEST_ADD_ACTION_DECLINE);
GVAR(RECIEVE_REQUEST_ADD_ACTION_DECLINE) = nil;
};
};

View File

@ -0,0 +1,22 @@
/**
* fn_registerUnconsciousCondition.sqf
* @Descr: Register new condition for the unconscious state. Conditions are not actively checked for units unless unit is in unconscious state.
* @Author: Glowbal
*
* @Arguments: [code CODE]
* @Return: void
* @PublicAPI: true
*/
#include "script_component.hpp"
if (isnil QGVAR(unconsciousConditions_F)) then {
GVAR(unconsciousConditions_F) = [];
};
if (typeName _this == typeName []) then {
{
if (typeName _x == typeName {}) then {
GVAR(unconsciousConditions_F) pushback _x;
};
}foreach _this;
};

View File

@ -0,0 +1,23 @@
/**
* fn_requestCallback.sqf
* @Descr: N/A
* @Author: Glowbal
*
* @Arguments: []
* @Return:
* @PublicAPI: false
*/
#include "script_component.hpp"
private ["_info", "_accepted", "_caller", "_target", "_requestID", "_requestMessage", "_callBack"];
_info = _this select 0;
_accepted = _this select 1;
_caller = _info select 0;
_target = _info select 1;
_requestID = _info select 2;
_requestMessage = _info select 3;
_callBack = _info select 4;
[_caller, _target, _accepted] call compile _callBack;

View File

@ -0,0 +1,38 @@
/**
* fn_resetAllDefaults_f.sqf
* @Descr: reset all variables that have been defined
* @Author: Glowbal
*
* @Arguments: []
* @Return:
* @PublicAPI: false
*/
#include "script_component.hpp"
private ["_unit","_oldUnit","_sets"];
_unit = _this select 0;
_unit setvariable [QGVAR(isDead),nil,true];
_unit setvariable ["ACE_isUnconscious", nil, true];
if (isPlayer _unit) then {
[true] call FUNC(setVolume_f);
[false] call FUNC(disableKeyInput_f);
[false] call EFUNC(GUI,effectBlackOut);
if !(isnil QGVAR(DISABLE_USER_INPUT_COLLECTION_F)) then {
// clear all disable user input
{
[_X, false] call FUNC(setDisableUserInputStatus);
}foreach GVAR(DISABLE_USER_INPUT_COLLECTION_F);
};
};
{
if (!(_x select 4)) then {
_unit setvariable [(_x select 0),nil,_x select 3];
};
}foreach ([_unit] call FUNC(getAllDefinedSetVariables));
[[_unit],"resetToDefaults"] call FUNC(raiseScriptedEvent_f);

View File

@ -0,0 +1,15 @@
/**
* fnc_revealObject_f.sqf
* @Descr: N/A
* @Author: Glowbal
*
* @Arguments: []
* @Return:
* @PublicAPI: false
*/
#include "script_component.hpp"
if (hasInterface) then {
player reveal (_this select 0);
};

View File

@ -0,0 +1,26 @@
/**
* fn_sendRequest_f.sqf
* @Descr: Send a request to an unit and execute code based upon results.
* @Author: Glowbal
*
* @Arguments: [caller OBJECT, target OBJECT, requestID STRING, requestMessage STRING (Will be localized for other target object), callback CODE (Code called upon accept or decline.)]
* @Return: void
* @PublicAPI: true
*/
#include "script_component.hpp"
private ["_caller", "_target", "_requestMessage", "_requestID", "_callBack"];
_caller = _this select 0;
_target = _this select 1;
_requestID = _this select 2;
_requestMessage = _this select 3;
_callBack = _this select 4;
if (isPlayer _target) then {
// Pass request on to target locality for player accept/decline.
[[_caller, _target, _requestID, _requestMessage, _callBack], QUOTE(FUNC(receiveRequest)), _target, false] call EFUNC(common,execRemoteFnc);
} else {
// accept it, since it's an AI.
[_caller, _target, true] call compile _callBack;
};

View File

@ -0,0 +1,45 @@
/**
* fn_setArrestState.sqf
* @Descr: Set a unit in arrest state
* @Author: Glowbal
*
* @Arguments: [unitToBeArrested OBJECT, setArrested BOOL]
* @Return: void
* @PublicAPI: true
*/
#include "script_component.hpp"
private ["_unit","_setArrest"];
_unit = [_this, 0, objNull, [objNull]] call BIS_fnc_Param;
_setArrest = [_this, 1, false, [false]] call BIS_fnc_Param;
if (_setArrest) then {
[_unit, QGVAR(StateArrested), true] call FUNC(setDefinedVariable);
if ([_unit] call FUNC(isAwake)) then {
if (vehicle _unit == _unit) then {
[_unit,"UnaErcPoslechVelitele2",1] call FUNC(doAnimation);
};
};
if (IsPlayer _unit) then {
[["arrested", true],QUOTE(FUNC(setDisableUserInputStatus)),_unit,false] call EFUNC(common,execRemoteFnc);
};
_unit disableAI "Move";
_unit disableAI "ANIM";
} else {
[_unit, QGVAR(StateArrested), false] call FUNC(setDefinedVariable);
if ([_unit] call FUNC(isAwake)) then {
if (vehicle _unit == _unit) then {
[_unit,"",1] call FUNC(doAnimation);
};
_unit enableAI "Move";
_unit enableAI "ANIM";
};
if (IsPlayer _unit) then {
[["arrested", false],QUOTE(FUNC(setDisableUserInputStatus)),_unit,false] call EFUNC(common,execRemoteFnc);
};
};
[[_unit, _setArrest],"setArrestState"] call FUNC(raiseScriptedEvent_f);

View File

@ -0,0 +1,28 @@
/**
* fn_setCanInteract.sqf
* @Descr: N/A
* @Author: Glowbal
*
* @Arguments: []
* @Return:
* @PublicAPI: false
*/
#include "script_component.hpp"
private ["_unit","_to","_return"];
_unit = [_this, 0, objNull, [objNull]] call BIS_fnc_param;
_to = _this select 1;
_return = false;
if (((typeName _to) == "SCALAR")) then {
if (_to <-1) then {
_to = -1;
} else {
if (_to > 1) then {
_to = 1;
};
};
_unit setvariable [QGVAR(canInteract), ([_unit] call FUNC(getCanInteract)) + _to,false];
_return = true;
};
_return

View File

@ -0,0 +1,33 @@
/**
* fn_setCaptiveSwitch.sqf
* @Descr: Register a unit as captive for the unconscious state
* @Author: Glowbal
*
* @Arguments: [unit OBJECT, setCaptive BOOL]
* @Return: BOOL True if unit is put as set captive, otherwise false
* @PublicAPI: false
*/
#include "script_component.hpp"
private ["_unit", "_captiveSwitch", "_setCaptive"];
_unit = [_this, 0, objNull, [objNull]] call BIS_fnc_Param;
_setCaptive = [_this, 1, false, [false]] call BIS_fnc_Param;
_captiveSwitch = true;
if (_setCaptive) then {
if (captive _unit) then {
_captiveSwitch = false;
} else {
_unit setCaptive true;
};
} else {
if (captive _unit) then {
_unit setCaptive false;
} else {
_captiveSwitch = false;
};
};
_captiveSwitch

View File

@ -0,0 +1,21 @@
/**
* fn_setCarriedBy.sqf
* @Descr: Registers an object being carried by another object
* @Author: Glowbal
*
* @Arguments: [unitToBeCarried OBJECT, objectCarrying OBJECT]
* @Return: BOOL True if succesfully registered
* @PublicAPI: false
*/
#include "script_component.hpp"
private ["_unit","_to","_return"];
_unit = [_this, 0, ObjNull,[ObjNull]] call BIS_fnc_Param;
_to = [_this, 1, ObjNull,[ObjNull]] call BIS_fnc_Param;
_return = false;
if ((isNull ([_unit] call FUNC(getCarriedBy))) || isNull _to) then {
_return = true;
_unit setvariable [QGVAR(carriedBy),_to,true];
};
_return

View File

@ -0,0 +1,88 @@
/**
* fn_setDead.sqf
* @Descr: Kills a unit
* @Author: Glowbal
*
* @Arguments: [unit OBJECT]
* @Return: void
* @PublicAPI: true
*/
#include "script_component.hpp"
#define TIME_BETWEEN_REVIVE_RUNS 0.5
private ["_unit"];
_unit = _this select 0;
_force = false;
if (count _this >= 2) then {
_force = _this select 1;
};
if (!alive _unit) exitwith{};
if (!local _unit) exitwith {
[[_unit, _force], QUOTE(FUNC(setDead)), _unit, false] call BIS_fnc_MP;
};
if (isnil QGVAR(ENABLE_REVIVE_F)) then {
GVAR(ENABLE_REVIVE_F) = 0;
};
if (((GVAR(ENABLE_REVIVE_F) == 1 && isPlayer _unit) || (GVAR(ENABLE_REVIVE_F) == 2)) && !_force && (alive (vehicle _unit))) exitwith {
// enter revive state
_unit setvariable [QGVAR(inReviveState), true, true];
// Remain unconscious while in revive state
[_unit] call FUNC(setUnconsciousState);
// setting the revive default values
if (isnil QGVAR(REVIVE_TIMER_F)) then {
GVAR(REVIVE_TIMER_F) = 10;
};
if (isnil QGVAR(REVIVE_NUMBER_MAX_F)) then {
GVAR(REVIVE_NUMBER_MAX_F) = -1;
};
[{
private ["_unit","_playerDead","_counter"];
_unit = (_this select 0) select 0;
_playerDead = (_this select 0) select 1;
// Check if a unit woke up or was already killed
if (!([_unit] call FUNC(isUnconscious)) || !alive _unit) exitwith {
[(_this select 1)] call cba_fnc_removePerFrameHandler;
// Cleaning up the variables, as we no longer need them.
_unit setvariable [QGVAR(reviveCounter_f), nil];
_unit setvariable [QGVAR(inReviveState), nil, true];
};
_counter = _unit getvariable [QGVAR(reviveCounter_f), 0];
if (_counter >= GVAR(REVIVE_TIMER_F)) exitwith{
if (isPlayer _unit) then {
titleText ["You died..","PLAIN DOWN"];
};
[_unit,QGVAR(isDead), true, true] call FUNC(setDefinedVariable);
if (_playerDead) then {
[_unit,QGVAR(isDeadPlayer),true,true] call FUNC(setDefinedVariable);
};
_unit setdamage 1; // killing a unit will automatically clean up all variables.
[[_unit, true],"killed"] call FUNC(raiseScriptedEvent_f);
[(_this select 1)] call cba_fnc_removePerFrameHandler;
};
_unit setvariable [QGVAR(reviveCounter_f),_counter + TIME_BETWEEN_REVIVE_RUNS];
}, TIME_BETWEEN_REVIVE_RUNS, [_unit, isPlayer _unit] ] call CBA_fnc_addPerFrameHandler;
};
[_unit,QGVAR(isDead),true,true] call FUNC(setDefinedVariable);
if (isPLayer _unit) then {
[_unit,QGVAR(isDeadPlayer),true,true] call FUNC(setDefinedVariable);
};
_unit setdamage 1;
[[_unit, false],"killed"] call FUNC(raiseScriptedEvent_f);

View File

@ -0,0 +1,31 @@
/**
* fn_setVariable.sqf
* @Descr: Setvariable value
* @Author: Glowbal
*
* @Arguments: [unit OBJECT, variableName STRING, value ANY]
* @Return: void
* @PublicAPI: true
*/
#include "script_component.hpp"
private ["_unit","_variable","_value","_update","_global","_definedVariable","_defaultGlobal","_currentValue"];
_unit = _this select 0;
_variable = _this select 1;
_value = _this select 2;
_global = false;
if (count _this > 3) then {
_global = _this select 3;
} else {
_definedVariable = ([_variable] call FUNC(getDefinedVariableInfo));
if (count _definedVariable > 2) then {
_global = _definedVariable select 2;
};
};
if (!isNil "_value") exitwith {
_unit setvariable [_variable, _value, _global];
};
_unit setvariable [_variable, nil, _global];

View File

@ -0,0 +1,28 @@
/**
* fn_setDisableUserInputStatus.sqf
* @Descr: Disables the user input. Works stacked.
* @Author: Glowbal
*
* @Arguments: [id STRING, disable BOOL]
* @Return: void
* @PublicAPI: true
*/
#include "script_component.hpp"
private ["_id","_disable"];
_id = _this select 0;
_disable = _this select 1;
if (isnil QGVAR(DISABLE_USER_INPUT_COLLECTION_F)) then {
GVAR(DISABLE_USER_INPUT_COLLECTION_F) = [];
};
if (_disable) then {
GVAR(DISABLE_USER_INPUT_COLLECTION_F) pushback _id;
[true] call FUNC(disableUserInput);
} else {
GVAR(DISABLE_USER_INPUT_COLLECTION_F) = GVAR(DISABLE_USER_INPUT_COLLECTION_F) - [_id];
if (GVAR(DISABLE_USER_INPUT_COLLECTION_F) isEqualTo []) then {
[false] call FUNC(disableUserInput);
};
};

View File

@ -0,0 +1,55 @@
/**
* fn_setHearingCapability.sqf
* @Descr: Handle set volume calls. Will use the lowest available volume setting.
* @Author: Glowbal
*
* @Arguments: [id STRING, settings NUMBER, add BOOL (Optional. True will add, false will remove. Default value is true)]
* @Return: nil
* @PublicAPI: true
*/
#include "script_component.hpp"
private ["_id", "_settings", "_add", "_exists", "_map", "_lowestVolume"];
_id = _this select 0;
_settings = _this select 1;
_add = true;
if (count _this > 2) then {
_add = _this select 2;
};
_map = missionNamespace getVariable [QGVAR(setHearingCapabilityMap),[]];
_exists = false;
{
if (_id == _x select 0) exitWith {
_exists = true;
if (_add) then {
_x set [1, _settings];
} else {
_map set [_forEachIndex, 0];
_map = _map - [0];
};
};
} forEach _map;
if (!_exists && _add) then {
_map pushBack [_id, _settings];
};
missionNamespace setVariable [QGVAR(setHearingCapabilityMap), _map];
// find lowest volume
_lowestVolume = 1;
{
_lowestVolume = (_x select 1) min _lowestVolume;
} forEach _map;
// in game sounds
0 fadeSound _lowestVolume;
0 fadeRadio _lowestVolume;
0 fadeMusic _lowestVolume;
// Set Radio mod variables.
player setVariable ["tf_globalVolume", _lowestVolume];
player setVariable ["acre_sys_core_globalVolume", _lowestVolume];

View File

@ -0,0 +1,28 @@
/**
* fn_setProne.sqf
* @Descr: Force a unit to go prone
* @Author: Glowbal
*
* @Arguments: [unit OBJECT]
* @Return: void
* @PublicAPI: true
*/
#include "script_component.hpp"
private ["_unit"];
_unit = [_this,0, ObjNull,[ObjNull]] call BIS_fnc_Param;
switch (currentWeapon _unit) do {
case (primaryWeapon _unit): {
[_unit,"amovppnemstpsraswrfldnon"] call FUNC(localAnim);
};
case (secondaryWeapon _unit): {
[_unit,"amovppnemstpsraswlnrdnon"] call FUNC(localAnim);
};
case (handgunWeapon _unit): {
[_unit,"AmovPpneMstpSrasWpstDnon"] call FUNC(localAnim);
};
default {
[_unit,"amovppnemstpsnonwnondnon"] call FUNC(localAnim);
};
};

View File

@ -0,0 +1,142 @@
/**
* fn_setUnconsciousState.sqf
* @Descr: Sets a unit in the unconscious state
* @Author: Glowbal
*
* @Arguments: [unit OBJECT]
* @Return: void
* @PublicAPI: true
*/
#include "script_component.hpp"
private ["_unit", "_animState", "_dAnim"];
_unit = _this select 0;
if !([_unit] call FUNC(canGoUnconsciousState)) exitwith{
[format["Exit setUnconscious: %1", _this]] call FUNC(debug);
};
// We only want this function to work on local machines
if (!local _unit) exitwith {
[[_unit], QUOTE(FUNC(setUnconsciousState)), _unit, false] call EFUNC(common,execRemoteFnc);
[format["Exit setUnconscious: %1", _this]] call FUNC(debug);
};
// get rid of the object we are carrying, before we go unconscious.
[_unit, ObjNull, [0,0,0]] call FUNC(carryObj);
// Set the unit in the unconscious state.
_unit setvariable ["ACE_isUnconscious",true,true];
_unit setUnconscious true;
// If a unit has the launcher out, it will sometimes start selecting the primairy weapon while unconscious,
// therefor we force it to select the primairy weapon before going unconscious
[_unit] call FUNC(setWeaponsCorrectUnconscious);
// We are storing the current animation, so we can use it later on when waking the unit up inside a vehicle
_animState = animationState _unit;
_originalPos = unitPos _unit;
// Handle the on screen effects
if (isPlayer _unit) then {
[] call FUNC(closeAllDialogs_f);
[true] call EFUNC(GUI,effectBlackOut);
["unconscious", true] call FUNC(setDisableUserInputStatus);
[false] call FUNC(setVolume_f);
} else {
_unit setUnitPos "DOWN";
[_unit, true] call FUNC(disableAI_F);
};
// So the AI does not get stuck, we are moving the unit to a temp group on its own.
[_unit, true, "ACE_isUnconscious", side group _unit] call FUNC(switchToGroupSide_f);
_captiveSwitch = [_unit, true] call FUNC(setCaptiveSwitch);
[_unit, [_unit] call FUNC(getDeathAnim), 1, true] call FUNC(doAnimation);
[format["Unit moving into unconscious: %1", _this]] call FUNC(debug);
_startingTime = time;
_minWaitingTime = (round(random(10)+5));
[{
private ["_unit", "_vehicleOfUnit","_lockSwitch","_minWaitingTime", "_oldAnimation", "_captiveSwitch"];
_args = _this select 0;
_unit = _args select 0;
_oldAnimation = _args select 1;
_captiveSwitch = _args select 2;
_originalPos = _args select 3;
_startingTime = _args select 4;
_minWaitingTime = _args select 5;
// Since the unit is no longer alive, get rid of this PFH.
if (!alive _unit) exitwith {
[format["%1 Unit no longer alive, exiting"], _unit] call FUNC(debug);
// EXIT PFH
[(_this select 1)] call cba_fnc_removePerFrameHandler;
[[_unit, false],"setUnconsciousState"] call FUNC(raiseScriptedEvent_f);
};
// In case the unit is no longer in an unconscious state, we are going to check if we can already reset the animation
if !([_unit] call FUNC(isUnconscious)) exitwith {
[format["%1 Unit no longer unconscious, handling exit and animation"], _unit] call FUNC(debug);
// Wait until the unit isn't being carried anymore, so we won't end up with wierd animations
if !([_unit] call FUNC(beingCarried)) then {
if (vehicle _unit == _unit) then {
[_unit,"amovppnemstpsnonwnondnon", 1] call FUNC(doAnimation);
} else {
// Switch to the units original animation, assuming
// TODO: what if the unit switched vehicle?
[_unit, _oldAnimation, 1] call FUNC(doAnimation);
};
// EXIT PFH
[(_this select 1)] call cba_fnc_removePerFrameHandler;
[[_unit, false],"setUnconsciousState"] call FUNC(raiseScriptedEvent_f);
};
};
// Ensure we are waiting at least a minimum period before checking if we can wake up the unit again, allows for temp knock outs
if ((time - _startingTime) >= _minWaitingTime) exitwith {
// Wait until the unit is no longer unconscious
if (!([_unit] call FUNC(getUnconsciousCondition))) then {
[format["%1 No unconscious condition valid anymore, moving uit out of unconsciousState"], _unit] call FUNC(debug);
// Reset the unit back to the previous captive state.
if (_captiveSwitch) then {
[_unit, false] call FUNC(setCaptiveSwitch);
};
_unit setUnconscious false;
// Swhich the unit back to its original group
[_unit, false, "ACE_isUnconscious", side group _unit] call FUNC(switchToGroupSide_f);
// Reset any visual and audio effects for players, or enable everything again for AI.
if (isPlayer _unit) then {
[false] call EFUNC(GUI,effectBlackOut);
[true] call FUNC(setVolume_f);
["unconscious", false] call FUNC(setDisableUserInputStatus);
} else {
[_unit, false] call FUNC(disableAI_F);
_unit setUnitPos _originalPos; // This is not position but stance (DOWN, MIDDLE, UP)
};
// Move unit out of unconscious state
_unit setvariable ["ACE_isUnconscious", false, true];
[format["%1 Unit no longer unconsicous"], _unit] call FUNC(debug);
};
};
// A check to ensure that the animation is being played properly.
// TODO: Might no longer be necessary: Have to test this in MP.
if (vehicle _unit == _unit && {animationState _unit != "deadState" && animationState _unit != "unconscious"} && {(isNull ([_unit] call FUNC(getCarriedBy)))} && (time - _startingTime >= 0.5)) then {
[_unit,([_unit] call FUNC(getDeathAnim)), 1, true] call FUNC(doAnimation); // Reset animations if unit starts doing wierd things.
[format["%1 Had to reset an animation for unconscious"], _unit] call FUNC(debug);
};
}, 0.1, [_unit,_animState, _captiveSwitch, _originalPos, _startingTime, _minWaitingTime] ] call CBA_fnc_addPerFrameHandler;
[[_unit, true],"setUnconsciousState"] call FUNC(raiseScriptedEvent_f);

View File

@ -0,0 +1,48 @@
/**
* fn_setVolume_f.sqf
* @Descr: Sets the volume of the game, including third party radio modifications such as TFAR and ACRE.
* @Author: Glowbal
*
* @Arguments: [setVolume BOOL]
* @Return: void
* @PublicAPI: true
*/
#include "script_component.hpp"
#define MUTED_LEVEL 0.2
#define NORMAL_LEVEL 1
#define NO_SOUND 0
private ["_setVolume"];
_setVolume = [_this, 0, false, [false]] call BIS_fnc_Param;
if (_setVolume) then {
// Vanilla Game
2 fadeSound NORMAL_LEVEL;
// TFAR
player setVariable ["tf_voiceVolume", NORMAL_LEVEL, true];
player setVariable ["tf_globalVolume", NORMAL_LEVEL];
player setVariable ["tf_unable_to_use_radio", false];
// ACRE2
player setVariable ["acre_sys_core_globalVolume", NORMAL_LEVEL];
player setVariable ["acre_sys_core_isDisabled", false, true];
} else {
// Vanilla Game
2 fadeSound MUTED_LEVEL;
// TFAR
player setVariable ["tf_voiceVolume", NO_SOUND, true];
player setVariable ["tf_globalVolume", MUTED_LEVEL];
player setVariable ["tf_unable_to_use_radio", true];
// ACRE2
player setVariable ["acre_sys_core_globalVolume", MUTED_LEVEL];
player setVariable ["acre_sys_core_isDisabled", true, true];
};
[[_setVolume],"setVolume"] call FUNC(raiseScriptedEvent_f);

View File

@ -0,0 +1,38 @@
/**
* fn_setWeaponsCorrectUnconscious.sqf
* @Descr: Ensures the weapon of a unit is selected correctly for the unconscious state. Prefents wierd animation behaviour
* @Author: Glowbal
*
* @Arguments: [unit OBJECT]
* @Return: void
* @PublicAPI: false
*/
#include "script_component.hpp"
private ["_unit"];
_unit = _this select 0;
if ((vehicle _unit) isKindOf "StaticWeapon") then {
moveOut _unit;
unassignVehicle _unit;
//unassignVehicle _unit;
//_unit action ["eject", vehicle _unit];
};
if (vehicle _unit == _unit) then {
if (currentWeapon _unit == secondaryWeapon _unit) then {
reload _unit;
};
};
if (animationState _unit in ["ladderriflestatic","laddercivilstatic"]) then {
_unit action ["ladderOff", (nearestBuilding _unit)];
};
if (vehicle _unit == _unit) then {
if (currentWeapon _unit == secondaryWeapon _unit) then {
_unit selectWeapon (primaryWeapon _unit);
_unit switchMove "";
_unit playmoveNow "";
};
};

View File

@ -0,0 +1,44 @@
/**
* fn_sortAlphabeticallyBy.sqf
* @Descr:
* @Author: Glowbal
*
* @Arguments: []
* @Return:
* @PublicAPI: true
*/
#include "script_component.hpp"
private ["_array", "_elements", "_elementN", "_indexes", "_theElement", "_tmp", "_tempIndex", "_j", "_i", "_returnArray"];
_array = _this select 0;
_elementN = _this select 1;
_indexes = [];
_elements = [];
{
_theElement = toArray (_x select _elementN);
_indexes pushback _foreachIndex;
_elements pushback _theElement;
}foreach _array;
for "_i" from 1 to (count _elements) - 1 do {
_tmp = _elements select _i;
_tempIndex = _indexes select _i;
_j = _i;
while {_j >= 1 && {_tmp < _elements select (_j - 1)}} do {
_elements set [_j, _elements select (_j - 1)];
_indexes set [_j, _indexes select (_j - 1)];
_j = _j - 1;
};
_elements set[_j, _tmp];
_indexes set [_j, _tempIndex];
};
_returnArray = [];
{
_returnArray pushback (_array select _x);
}foreach _indexes;
_returnArray;

View File

@ -0,0 +1,35 @@
/**
* fn_stringCompare.sqf
* @Descr: Determines whether one string matches another and how many characters match. Case insensitive.
* @Author: bovine3dom
*
* @Arguments: [stringA STRING, stringB STRING]
* @Return: NUMBER Number of matching characters
* @PublicAPI: true
*/
#include "script_component.hpp"
private ["_searchTerm", "_string", "_arraySearchTerm", "_arrayString", "_sizeSearchTerm", "_sizeString", "_matchingCharacters", "_searchIterator", "_targetIterator"];
_string = toLower (_this select 0); // removes case sensitivity
_searchTerm = toLower (_this select 1);
_arraySearchTerm = toArray _searchTerm; // splits string into array of unicode decimals
_arrayString = toArray _string;
_sizeSearchTerm = count _arraySearchTerm; // We only measure the array once
_sizeString = count _arrayString;
_matchingCharacters = 0;
_targetIterator = 0;
_searchIterator = 0;
while {(_searchIterator < _sizeSearchTerm) && (_targetIterator < _sizeString)} do { // Prevents us from going out of bounds
if ((_arraySearchTerm select _searchIterator) == (_arrayString select _targetIterator)) then { // If we have a match, start looking for the next character in the search term
_matchingCharacters = _matchingCharacters + 1;
_searchIterator = _searchIterator + 1
};
_targetIterator = _targetIterator + 1; // Look at the next character in the string
};
_matchingCharacters

View File

@ -0,0 +1,21 @@
/**
* fn_stringTrim.sqf
* @Descr: Removes white spaces from string
* @Author: Glowbal
*
* @Arguments: [string STRING]
* @Return: STRING copy of string
* @PublicAPI: true
*/
#include "script_component.hpp"
#define WHITE_SPACE [20]
private ["_string", "_charArray", "_returnString"];
_string = [_this, 0, "",[""]] call bis_fnc_param;
_charArray = toArray _string;
_charArray = _charArray - [((toArray " ") select 0)];
_returnString = toString _charArray;
_returnString;

View File

@ -0,0 +1,66 @@
/**
* fn_switchToGroupSide_f.sqf
* @Descr: Stack group switches. Will always trace back to original group.
* @Author: Glowbal
*
* @Arguments: [unit OBJECT, switch BOOL, id STRING, side SIDE]
* @Return: void
* @PublicAPI: true
*/
#include "script_component.hpp"
private ["_unit","_side","_previousGroup","_newGroup", "_currentGroup", "_switch", "_originalSide", "_previousGroupsList", "_id"];
_unit = [_this, 0,ObjNull,[ObjNull]] call BIS_fnc_Param;
_switch = [_this, 1, false,[false]] call BIS_fnc_Param;
_id = [_this, 2, "", [""]] call BIS_fnc_Param;
_side = [_this, 3, side _unit,[west]] call BIS_fnc_Param;
_previousGroupsList = _unit getvariable [QGVAR(previousGroupSwitchTo_F),[]];
if (_switch) then {
// go forward
_previousGroup = group _unit;
_originalSide = side group _unit;
if (count units _previousGroup == 1 && _originalSide == _side) exitwith {
[format["Current group has only 1 member and is of same side as switch. Not switching unit %1", _id]] call FUNC(debug);
};
_newGroup = createGroup _side;
[_unit] joinSilent _newGroup;
_previousGroupsList pushback [_previousGroup, _originalSide, _id, true];
_unit setvariable [QGVAR(previousGroupSwitchTo_F), _previousGroupsList, true];
} else {
// go one back
{
if (_id == (_x select 2)) exitwith {
_x set [ 3, false];
_previousGroupsList set [_foreachIndex, _x];
[format["found group with ID: %1", _id]] call FUNC(debug);
};
}foreach _previousGroupsList;
reverse _previousGroupsList;
{
if (_x select 3) exitwith {}; // stop at first id set to true
if !(_x select 3) then {
_currentGroup = group _unit;
if (!isNull (_x select 0)) then {
[_unit] joinSilent (_x select 0);
} else {
_newGroup = createGroup (_x select 1);
[_unit] joinSilent _newGroup;
};
if (count units _currentGroup == 0) then {
deleteGroup _currentGroup;
};
_previousGroupsList set [_foreachIndex, ObjNull];
};
}foreach _previousGroupsList;
_previousGroupsList = _previousGroupsList - [objNull];
reverse _previousGroupsList; // we have to reverse again, to ensure the list is in the right order.
_unit setvariable [QGVAR(previousGroupSwitchTo_F), _previousGroupsList, true];
};
[[_unit, _switch, _id, _side],"switchToGroupSide"] call FUNC(raiseScriptedEvent_f);

View File

@ -0,0 +1,24 @@
/**
* fn_uniqueElementsOnly.sqf
* @Descr: Make a copy of an array with only the unique elements.
* @Author: Glowbal
*
* @Arguments: [array ARRAY]
* @Return: ARRAY Copy of original array
* @PublicAPI: true
*/
#include "script_component.hpp"
private ["_array", "_result", "_value"];
_array = _this select 0;
_result = [];
{
_value = _x;
if ({_x isEqualTo _value} count _result == 0) then {
_result pushback _x;
};
}foreach _array;
_result;

View File

@ -0,0 +1,59 @@
/**
* fn_unloadPerson_f.sqf
* @Descr: Unload a person from a vehicle
* @Author: Glowbal
*
* @Arguments: [caller OBJECT, unit OBJECT]
* @Return: BOOL Returns true if succesfully unloaded person
* @PublicAPI: true
*/
#include "script_component.hpp"
#define GROUP_SWITCH_ID QUOTE(FUNC(loadPerson_F))
private ["_caller", "_unit","_vehicle", "_loaded"];
_caller = [_this, 0, ObjNull,[ObjNull]] call BIS_fnc_Param;
_unit = [_this, 1, ObjNull,[ObjNull]] call BIS_fnc_Param;
_vehicle = vehicle _unit;
if (_vehicle == _unit) exitwith {false;};
if !(speed _vehicle <1 && (((getpos _vehicle) select 2) < 2)) exitwith {false;};
if (!([_caller] call FUNC(isAwake))) exitwith{false;};
moveOut _unit;
unassignVehicle _unit;
if (!alive _unit) then {
_unit action ["Eject", vehicle _unit];
};
[_unit, false, GROUP_SWITCH_ID, side group _caller] call FUNC(switchToGroupSide_f);
_loaded = _vehicle getvariable [QGVAR(loaded_persons_F),[]];
_loaded = _loaded - [_unit];
_vehicle setvariable [QGVAR(loaded_persons_F),_loaded,true];
if (!([_unit] call FUNC(isAwake))) then {
_handle = [_unit,_vehicle] spawn {
private ["_unit","_vehicle"];
_unit = _this select 0;
_vehicle = _this select 1;
waituntil {vehicle _unit != _vehicle};
[_unit,([_unit] call FUNC(getDeathAnim)), 1, true] call FUNC(doAnimation);
[format["Unit should move into death anim: %1", _unit]] call FUNC(debug);
};
} else {
if ([_unit] call FUNC(isArrested)) then {
_handle = [_unit,_vehicle] spawn {
_unit = _this select 0;
_vehicle = _this select 1;
waituntil {vehicle _unit != _vehicle};
[_unit,"UnaErcPoslechVelitele2", 1] call FUNC(doAnimation);
[format["Unit should move into arrested anim: %1", _unit]] call FUNC(debug);
};
} else {
[format["Unit should move into normal anim: %1", _unit]] call FUNC(debug);
};
};
true;

View File

@ -0,0 +1,35 @@
/**
* fn_useItem.sqf
* @Descr:
* @Author: Glowbal
*
* @Arguments: []
* @Return:
* @PublicAPI: true
*/
#include "script_component.hpp"
private ["_unit","_item","_return"];
_unit = _this select 0;
_item = _this select 1;
_vehicleUsage = [_this, 2, false, [false]] call BIS_fnc_Param;
_return = false;
if (!_vehicleUsage) then {
if (_item != "") then {
if (_item in (items _unit)) then {
_unit removeItem _item;
_return = true;
} else {
if (_item in (assignedItems _unit)) then {
_unit unassignItem _item;
_unit removeItem _item;
_return = true;
};
};
};
};
// TODO implement shared item functionality for with vehicles.
_return;

View File

@ -0,0 +1,30 @@
/**
* fn_useMagazine.sqf
* @Descr: Use magazine
* @Author: Glowbal
*
* @Arguments: [unit OBJECt, magazine STRING]
* @Return: BOOL True if magazine has been used.
* @PublicAPI: true
*/
#include "script_component.hpp"
private ["_unit","_magazine","_return"];
_unit = _this select 0;
_magazine = _this select 1;
_vehicleUsage = [_this, 2, false, [false]] call BIS_fnc_Param;
if (!_vehicleUsage) then {
if (_magazine != "") then {
_unit removeMagazine _magazine;
_return = true;
} else {
_return = false;
};
[format["fnc_useMagazine: %1 | %2",_this,_return]] call FUNC(debug);
_return
} else
{
// TODO implement shared magazine functionality
};

View File

@ -463,5 +463,26 @@
<Russian>Без голоса</Russian>
<Hungarian>Nincs hang</Hungarian>
</Key>
<Key ID="STR_ACE_ACTION_ACCEPT_REQUEST_KEY_TITLE">
<Original>Accept Requests</Original>
<Polish>Akceptuj prośby</Polish>
<Spanish>Aceptar Peticiones</Spanish>
</Key>
<Key ID="STR_ACE_ACTION_DECLINE_REQUEST_KEY_TITLE">
<Original>Decline Requests</Original>
<Polish>Ignoruj prośby</Polish>
<Spanish>Rechazar Peticiones</Spanish>
</Key>
<Key ID="STR_ACE_ACTION_ACCEPT_REQUEST_KEY_TOOLTIP">
<Original>Accept Requests send by other players. These can be requests to use / share equipment, perform certain actions.</Original>
<Polish>Akceptuj prośby wysłane przez innych graczy. Akceptacji wymagają między innymi akcje używania / współdzielenia wyposażenia, wykonywania określonych czynności.</Polish>
<Spanish>Acepta Peticiones de otros jugadores. Pueden ser solicitudes para usar / compartir equipamiento, realizar ciertas acciones.</Spanish>
</Key>
<Key ID="STR_ACE_ACTION_DECLINE_REQUEST_KEY_TOOLTIP">
<Original>Decline Requests send by other players. These can be requests to use / share equipment, perform certain actions.</Original>
<Polish>Ignoruj prośby wysłane przez innych graczy. Akceptacji wymagają między innymi akcje używania / współdzielenia wyposażenia, wykonywania określonych czynności.</Polish>
<Spanish>Rechazar Peticiones de otros jugadores. Pueden ser solicitudes para usar / compartir equipamiento, realizar ciertas acciones.</Spanish>
</Key>
</Package>
</Project>

View File

@ -0,0 +1,11 @@
class Extended_PreInit_EventHandlers {
class ADDON {
init = QUOTE( call compile preprocessFileLineNumbers QUOTE(QUOTE(PATHTOF(XEH_preInit.sqf))) );
};
};
class Extended_PostInit_EventHandlers {
class ADDON {
init = QUOTE( call compile preprocessFileLineNumbers QUOTE(QUOTE(PATHTOF(XEH_postInit.sqf))) );
};
};

2
addons/gui/GUI.hpp Normal file
View File

@ -0,0 +1,2 @@
#include "UI\define.hpp"
#include "UI\RscTitles.hpp"

251
addons/gui/UI/RscTitles.hpp Normal file
View File

@ -0,0 +1,251 @@
#define RIGHT_SIDE (safezoneW + safezoneX)
#define LEFT_SIDE safezoneX
#define TOP_SIDE safeZoneY
#define BOTTOM_SIDE (safeZoneH + safezoneY)
#define ICON_WIDTH (1.75 * (((safezoneW / safezoneH) min 1.2) / 40))
#define X_POS_ICONS RIGHT_SIDE - (1.1 * ICON_WIDTH)
#define Y_POS_ICONS TOP_SIDE + (2.2 * ICON_WIDTH)
#define DIFFERENCE_ICONS (1.1 * ICON_WIDTH)
class RscTitles {
class GVAR(iconsDisplay) {
duration = 1e+011;
idd = 1111;
movingenable = 0;
onLoad = QUOTE(uiNamespace setVariable [ARR_2(QUOTE(QGVAR(iconsDisplay)), _this select 0)]);
class controlsBackground {
class icon_1: ACE_gui_backgroundBase {
text = "";
colorText[] = {0.0,1.0,0.0,0.4};
idc = 10501;
x = X_POS_ICONS;
y = Y_POS_ICONS + (0 * DIFFERENCE_ICONS);
w = ICON_WIDTH;
h = ICON_WIDTH;
};
class icon_2: icon_1 {
idc = 10502;
y = Y_POS_ICONS + (1 * DIFFERENCE_ICONS);
};
class icon_3: icon_1 {
idc = 10503;
y = Y_POS_ICONS + (2 * DIFFERENCE_ICONS);
};
class icon_4: icon_1 {
idc = 10504;
y = Y_POS_ICONS + (3 * DIFFERENCE_ICONS);
};
class icon_5: icon_1 {
idc = 10505;
y = Y_POS_ICONS + (4 * DIFFERENCE_ICONS);
};
class icon_6: icon_1 {
idc = 10506;
y = Y_POS_ICONS + (5 * DIFFERENCE_ICONS);
};
};
};
class GVAR(RSC_PROGRESSBAR_LOADING) {
idd = -1;
onLoad = QUOTE(uiNamespace setVariable [ARR_2(QUOTE(QGVAR(RSC_PROGRESSBAR_LOADING)), _this select 0)]);
fadein = 0;
fadeout = 0;
duration = 10e10;
class Controls {
class background: ACE_gui_backgroundBase {
idc = -1;
colorBackground[] = {0,0,0,1};
colorText[] = {1, 1, 1, 1};
x = "1 * (((safezoneW / safezoneH) min 1.2) / 40) + (safezoneX + (safezoneW - ((safezoneW / safezoneH) min 1.2))/2)";
y = "29 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) + (safezoneY + (safezoneH - (((safezoneW / safezoneH) min 1.2) / 1.2))/2)";
w = "38 * (((safezoneW / safezoneH) min 1.2) / 40)";
h = "0.4 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)";
text = "#(argb,8,8,3)color(0,0,0,0.4)";
};
class Progress: ACE_gui_RscProgress {
idc = 6;
x = "1 * (((safezoneW / safezoneH) min 1.2) / 40) + (safezoneX + (safezoneW - ((safezoneW / safezoneH) min 1.2))/2)";
y = "29 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) + (safezoneY + (safezoneH - (((safezoneW / safezoneH) min 1.2) / 1.2))/2)";
w = "38 * (((safezoneW / safezoneH) min 1.2) / 40)";
h = "0.4 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)";
colorFrame[] = {0,0,0,0};
colorBar[] = {0.27,0.5,0.31,0.6};
texture = "#(argb,8,8,3)color(1,1,1,0.7)";
};
};
};
class GVAR(RSC_DISPLAY_MESSAGE) {
duration = 7;
idd = 86411;
movingenable = 0;
onLoad = QUOTE(uiNamespace setVariable [ARR_2(QUOTE(QGVAR(RSC_DISPLAY_MESSAGE)), _this select 0)]);
fadein = 0;
class controlsBackground {
class header: ACE_gui_staticBase {
idc = 1;
type = CT_STATIC;
x = "safezoneX + (safezoneW / 10)";
y = "safezoneY + (30 * (safeZoneH / 40))";
w = "(safeZoneW / 10)";
h = "(safeZoneH / 40)";
style = ST_LEFT;
font = FontCSE;
SizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)";
colorText[] = {0.85, 0.85, 0.85, 1.0};
colorBackground[] = {0, 0, 0, 0.9};
text = "";
};
class text: header {
idc = 2;
y = "safezoneY + (31 * (safeZoneH / 40))";
w = "(safeZoneW / 10) * 1.3";
colorText[] = {0.0, 0.0, 0.0, 1.0};
colorBackground[] = {1, 1, 1, 0.9};
text = "";
};
};
};
class GVAR(RSC_DISPLAY_INFORMATION) {
duration = 15;
idd = 86412;
movingenable = 0;
onLoad = QUOTE(uiNamespace setVariable [ARR_2(QUOTE(QGVAR(RSC_DISPLAY_INFORMATION)), _this select 0)]);
fadein = 0;
class controlsBackground {
class header: ACE_gui_staticBase {
idc = 1;
type = CT_STATIC;
x = "safezoneX + (safezoneW / 10)";
y = "safezoneY + (6 * (safeZoneH / 40))";
w = "(safeZoneW / 10)";
h = "(safeZoneH / 40)";
style = ST_LEFT;
font = FontCSE;
SizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)";
colorText[] = {0.85, 0.85, 0.85, 1.0};
colorBackground[] = {0, 0, 0, 0.9};
text = "";
};
class text: header {
idc = 2;
y = "safezoneY + (7.1 * (safeZoneH / 40))";
w = "(safeZoneW / 10) * 1.3";
colorText[] = {0.0, 0.0, 0.0, 1.0};
colorBackground[] = {1, 1, 1, 0.9};
text = "";
};
class text2: text {
idc = 3;
y = "safezoneY + (8.2 * (safeZoneH / 40))";
};
class text3: text {
idc = 4;
y = "safezoneY + (9.3 * (safeZoneH / 40))";
};
class text4: text {
idc = 5;
y = "safezoneY + (10.4 * (safeZoneH / 40))";
};
class text5: text {
idc = 6;
y = "safezoneY + (11.5 * (safeZoneH / 40))";
};
class icon: ACE_gui_backgroundBase {
type = CT_STATIC;
idc = 10;
style = ST_PICTURE;
colorBackground[] = {0,0,0,1};
colorText[] = {1, 1, 1, 1};
font = FontCSE;
text = "";
sizeEx = 0.032;
x = "safezoneX + (safezoneW / 10)";
y = "safezoneY + (4 * (safeZoneH / 40))";
w = "(safeZoneH / 40)*2";
h = "(safeZoneH / 40)*2";
};
};
};
class GVAR(ScreenEffectsBlack) {
duration = 10e10;
idd = 1111;
movingenable = 0;
onLoad = QUOTE(uiNamespace setVariable [ARR_2(QUOTE(QUOTE(GVAR(ScreenEffectsBlack))), _this select 0)]);
class controlsBackground {
class blackScreen: ACE_gui_backgroundBase {
text = QUOTE(PATHTOF(data\black_out.paa));
colorText[] = {0.0, 0.0, 0.0, 0.0};
idc = 11112;
x = safezoneX;
y = safezoneY;
w = safezoneW;
h = safezoneH;
};
};
};
class GVAR(ScreenEffectsBleeding) {
duration = 1;
idd = 1111;
movingenable = 0;
onLoad = QUOTE(uiNamespace setVariable [ARR_2(QUOTE(QUOTE(GVAR(ScreenEffectsBleeding))), _this select 0)]);
class controlsBackground {
class bleedingScreen: ACE_gui_backgroundBase {
text = QUOTE(PATHTOF(data\bleeding.paa));
colorText[] = {0.9, 0.2, 0.2, 0.6};
idc = 11113;
x = safezoneX;
y = safezoneY;
w = safezoneW;
h = safezoneH;
};
};
};
class GVAR(ScreenEffectsHit) {
duration = 1.1;
idd = 1111;
movingenable = 0;
onLoad = QUOTE(uiNamespace setVariable [ARR_2(QUOTE(QUOTE(GVAR(ScreenEffectsHit))), _this select 0)]);
class controlsBackground {
class effectHit: ACE_gui_backgroundBase {
text = QUOTE(PATHTOF(data\hit.paa));
colorText[] = {0.7, 0.2, 0.2, 0.4};
idc = 11113;
x = safezoneX;
y = safezoneY;
w = safezoneW;
h = safezoneH;
};
};
};
class GVAR(ScreenEffectsPain) {
duration = 1;
idd = 1111;
movingenable = 0;
onLoad = QUOTE(uiNamespace setVariable [ARR_2(QUOTE(QUOTE(GVAR(ScreenEffectsPain))), _this select 0)]);
class controlsBackground {
class painScreen: ACE_gui_backgroundBase {
text = QUOTE(PATHTOF(data\painScreen.paa));
colorText[] = {1, 1, 1, 0.5};
idc = 11115;
x = safezoneX;
y = safezoneY;
w = safezoneW;
h = safezoneH;
};
};
};
};

790
addons/gui/UI/define.hpp Normal file
View File

@ -0,0 +1,790 @@
#ifndef ACE_DEFINE_H
#define ACE_DEFINE_H
// define.hpp
#define true 1
#define false 0
#define CT_STATIC 0
#define CT_BUTTON 1
#define CT_EDIT 2
#define CT_SLIDER 3
#define CT_COMBO 4
#define CT_LISTBOX 5
#define CT_TOOLBOX 6
#define CT_CHECKBOXES 7
#define CT_PROGRESS 8
#define CT_HTML 9
#define CT_STATIC_SKEW 10
#define CT_ACTIVETEXT 11
#define CT_TREE 12
#define CT_STRUCTURED_TEXT 13
#define CT_CONTEXT_MENU 14
#define CT_CONTROLS_GROUP 15
#define CT_SHORTCUTBUTTON 16
#define CT_XKEYDESC 40
#define CT_XBUTTON 41
#define CT_XLISTBOX 42
#define CT_XSLIDER 43
#define CT_XCOMBO 44
#define CT_ANIMATED_TEXTURE 45
#define CT_OBJECT 80
#define CT_OBJECT_ZOOM 81
#define CT_OBJECT_CONTAINER 82
#define CT_OBJECT_CONT_ANIM 83
#define CT_LINEBREAK 98
#define CT_ANIMATED_USER 99
#define CT_MAP 100
#define CT_MAP_MAIN 101
#define CT_LISTNBOX 102
// Static styles
#define ST_POS 0x0F
#define ST_HPOS 0x03
#define ST_VPOS 0x0C
#define ST_LEFT 0x00
#define ST_RIGHT 0x01
#define ST_CENTER 0x02
#define ST_DOWN 0x04
#define ST_UP 0x08
#define ST_VCENTER 0x0c
#define ST_TYPE 0xF0
#define ST_SINGLE 0
#define ST_MULTI 16
#define ST_TITLE_BAR 32
#define ST_PICTURE 48
#define ST_FRAME 64
#define ST_BACKGROUND 80
#define ST_GROUP_BOX 96
#define ST_GROUP_BOX2 112
#define ST_HUD_BACKGROUND 128
#define ST_TILE_PICTURE 144
#define ST_WITH_RECT 160
#define ST_LINE 176
#define ST_SHADOW 0x100
#define ST_NO_RECT 0x200 // this style works for CT_STATIC in conjunction with ST_MULTI
#define ST_KEEP_ASPECT_RATIO 0x800
#define ST_TITLE ST_TITLE_BAR + ST_CENTER
// Slider styles
#define SL_DIR 0x400
#define SL_VERT 0
#define SL_HORZ 0x400
#define SL_TEXTURES 0x10
// Listbox styles
#define LB_TEXTURES 0x10
#define LB_MULTI 0x20
#define FontCSE "PuristaMedium"
class ACE_gui_backgroundBase {
type = CT_STATIC;
idc = -1;
style = ST_PICTURE;
colorBackground[] = {0,0,0,0};
colorText[] = {1, 1, 1, 1};
font = FontCSE;
text = "";
sizeEx = 0.032;
};
class ACE_gui_editBase
{
access = 0;
type = 2;
x = 0;
y = 0;
h = 0.04;
w = 0.2;
colorBackground[] =
{
0,
0,
0,
1
};
colorText[] =
{
0.95,
0.95,
0.95,
1
};
colorSelection[] =
{
"(profilenamespace getvariable ['GUI_BCG_RGB_R',0.3843])",
"(profilenamespace getvariable ['GUI_BCG_RGB_G',0.7019])",
"(profilenamespace getvariable ['GUI_BCG_RGB_B',0.8862])",
1
};
autocomplete = "";
text = "";
size = 0.2;
style = "0x00 + 0x40";
font = "PuristaMedium";
shadow = 2;
sizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)";
colorDisabled[] =
{
1,
1,
1,
0.25
};
};
class ACE_gui_buttonBase {
idc = -1;
type = 16;
style = ST_LEFT;
text = "";
action = "";
x = 0.0;
y = 0.0;
w = 0.25;
h = 0.04;
size = 0.03921;
sizeEx = 0.03921;
color[] = {1.0, 1.0, 1.0, 1};
color2[] = {1.0, 1.0, 1.0, 1};
colorBackground[] = {1,1,1,0.95};
colorbackground2[] = {1,1,1,0.95};
colorDisabled[] = {1,1,1,0.6};
colorFocused[] = {1,1,1,1};
colorBackgroundFocused[] = {1,1,1,1};
periodFocus = 1.2;
periodOver = 0.8;
default = false;
class HitZone {
left = 0.00;
top = 0.00;
right = 0.00;
bottom = 0.00;
};
class ShortcutPos {
left = 0.00;
top = 0.00;
w = 0.00;
h = 0.00;
};
class TextPos {
left = 0.002;
top = 0.0004;
right = 0.0;
bottom = 0.00;
};
textureNoShortcut = "";
animTextureNormal = QUOTE( PATHTOF(data\buttonNormal_gradient_top.paa) );
animTextureDisabled = QUOTE( PATHTOF(data\buttonDisabled_gradient.paa));
animTextureOver = QUOTE( PATHTOF(data\buttonNormal_gradient_top.paa));
animTextureFocused = QUOTE( PATHTOF(data\buttonNormal_gradient_top.paa));
animTexturePressed = QUOTE( PATHTOF(data\buttonNormal_gradient_top.paa));
animTextureDefault = QUOTE( PATHTOF(data\buttonNormal_gradient_top.paa));
period = 0.5;
font = FontCSE;
soundClick[] = {"\A3\ui_f\data\sound\RscButton\soundClick",0.09,1};
soundPush[] = {"\A3\ui_f\data\sound\RscButton\soundPush",0.0,0};
soundEnter[] = {"\A3\ui_f\data\sound\RscButton\soundEnter",0.07,1};
soundEscape[] = {"\A3\ui_f\data\sound\RscButton\soundEscape",0.09,1};
class Attributes {
font = FontCSE;
color = "#E5E5E5";
align = "center";
shadow = "true";
};
class AttributesImage {
font = FontCSE;
color = "#E5E5E5";
align = "left";
shadow = "true";
};
};
class ACE_gui_RscProgress {
type = 8;
style = 0;
colorFrame[] = {1,1,1,0.7};
colorBar[] = {1,1,1,0.7};
texture = "#(argb,8,8,3)color(1,1,1,0.7)";
x = "1 * (((safezoneW / safezoneH) min 1.2) / 40) + (safezoneX + (safezoneW - ((safezoneW / safezoneH) min 1.2))/2)";
y = "10 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) + (safezoneY + (safezoneH - (((safezoneW / safezoneH) min 1.2) / 1.2))/2)";
w = "38 * (((safezoneW / safezoneH) min 1.2) / 40)";
h = "0.5 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)";
};
class ACE_gui_staticBase {
idc = -1;
type = CT_STATIC;
x = 0.0;
y = 0.0;
w = 0.183825;
h = 0.104575;
style = ST_LEFT;
font = FontCSE;
sizeEx = 0.03921;
colorText[] = {0.95, 0.95, 0.95, 1.0};
colorBackground[] = {0, 0, 0, 0};
text = "";
};
class RscListBox;
class ACE_gui_listBoxBase : RscListBox{
type = CT_LISTBOX;
style = ST_MULTI;
font = FontCSE;
sizeEx = 0.03921;
color[] = {1, 1, 1, 1};
colorText[] = {0.543, 0.5742, 0.4102, 1.0};
colorScrollbar[] = {0.95, 0.95, 0.95, 1};
colorSelect[] = {0.95, 0.95, 0.95, 1};
colorSelect2[] = {0.95, 0.95, 0.95, 1};
colorSelectBackground[] = {0, 0, 0, 1};
colorSelectBackground2[] = {0.543, 0.5742, 0.4102, 1.0};
colorDisabled[] = {"(profilenamespace getvariable ['GUI_BCG_RGB_R',0.69])","(profilenamespace getvariable ['GUI_BCG_RGB_G',0.75])","(profilenamespace getvariable ['GUI_BCG_RGB_B',0.5])", 0.25};
period = 1.2;
rowHeight = 0.03;
colorBackground[] = {0, 0, 0, 1};
maxHistoryDelay = 1.0;
autoScrollSpeed = -1;
autoScrollDelay = 5;
autoScrollRewind = 0;
soundSelect[] = {"",0.1,1};
soundExpand[] = {"",0.1,1};
soundCollapse[] = {"",0.1,1};
class ListScrollBar {
arrowEmpty = "\A3\ui_f\data\gui\cfg\scrollbar\arrowEmpty_ca.paa";
arrowFull = "\A3\ui_f\data\gui\cfg\scrollbar\arrowFull_ca.paa";
autoScrollDelay = 5;
autoScrollEnabled = 0;
autoScrollRewind = 0;
autoScrollSpeed = -1;
border = "\A3\ui_f\data\gui\cfg\scrollbar\border_ca.paa";
color[] = {1,1,1,0.6};
colorActive[] = {1,1,1,1};
colorDisabled[] = {1,1,1,0.3};
height = 0;
scrollSpeed = 0.06;
shadow = 0;
thumb = "\A3\ui_f\data\gui\cfg\scrollbar\thumb_ca.paa";
width = 0;
};
class ScrollBar {
color[] = {1, 1, 1, 0.6};
colorActive[] = {1, 1, 1, 1};
colorDisabled[] = {1, 1, 1, 0.3};
thumb = "";
arrowFull = "";
arrowEmpty = "";
border = "";
};
};
class ACE_gui_listNBox {
access = 0;
type = CT_LISTNBOX;// 102;
style =ST_MULTI;
w = 0.4;
h = 0.4;
font = FontCSE;
sizeEx = 0.031;
autoScrollSpeed = -1;
autoScrollDelay = 5;
autoScrollRewind = 0;
arrowEmpty = "#(argb,8,8,3)color(1,1,1,1)";
arrowFull = "#(argb,8,8,3)color(1,1,1,1)";
columns[] = {0.0};
color[] = {1, 1, 1, 1};
rowHeight = 0.03;
colorBackground[] = {0, 0, 0, 0.2};
colorText[] = {1,1, 1, 1.0};
colorScrollbar[] = {0.95, 0.95, 0.95, 1};
colorSelect[] = {0.95, 0.95, 0.95, 1};
colorSelect2[] = {0.95, 0.95, 0.95, 1};
colorSelectBackground[] = {0, 0, 0, 0.0};
colorSelectBackground2[] = {0.0, 0.0, 0.0, 0.5};
colorActive[] = {0,0,0,1};
colorDisabled[] = {0,0,0,0.3};
rows = 1;
drawSideArrows = 0;
idcLeft = -1;
idcRight = -1;
maxHistoryDelay = 1;
soundSelect[] = {"", 0.1, 1};
period = 1;
shadow = 2;
class ScrollBar {
arrowEmpty = "#(argb,8,8,3)color(1,1,1,1)";
arrowFull = "#(argb,8,8,3)color(1,1,1,1)";
border = "#(argb,8,8,3)color(1,1,1,1)";
color[] = {1,1,1,0.6};
colorActive[] = {1,1,1,1};
colorDisabled[] = {1,1,1,0.3};
thumb = "#(argb,8,8,3)color(1,1,1,1)";
};
class ListScrollBar {
arrowEmpty = "\A3\ui_f\data\gui\cfg\scrollbar\arrowEmpty_ca.paa";
arrowFull = "\A3\ui_f\data\gui\cfg\scrollbar\arrowFull_ca.paa";
autoScrollDelay = 5;
autoScrollEnabled = 0;
autoScrollRewind = 0;
autoScrollSpeed = -1;
border = "\A3\ui_f\data\gui\cfg\scrollbar\border_ca.paa";
color[] = {1,1,1,0.6};
colorActive[] = {1,1,1,1};
colorDisabled[] = {1,1,1,0.3};
height = 0;
scrollSpeed = 0.06;
shadow = 0;
thumb = "\A3\ui_f\data\gui\cfg\scrollbar\thumb_ca.paa";
width = 0;
};
};
class RscCombo;
class ACE_gui_comboBoxBase: RscCombo {
idc = -1;
type = 4;
style = "0x10 + 0x200";
x = 0;
y = 0;
w = 0.3;
h = 0.035;
color[] = {0,0,0,0.6};
colorActive[] = {1,0,0,1};
colorBackground[] = {0,0,0,1};
colorDisabled[] = {1,1,1,0.25};
colorScrollbar[] = {1,0,0,1};
colorSelect[] = {0,0,0,1};
colorSelectBackground[] = {1,1,1,0.7};
colorText[] = {1,1,1,1};
arrowEmpty = "";
arrowFull = "";
wholeHeight = 0.45;
font = FontCSE;
sizeEx = 0.031;
soundSelect[] = {"\A3\ui_f\data\sound\RscCombo\soundSelect",0.1,1};
soundExpand[] = {"\A3\ui_f\data\sound\RscCombo\soundExpand",0.1,1};
soundCollapse[] = {"\A3\ui_f\data\sound\RscCombo\soundCollapse",0.1,1};
maxHistoryDelay = 1.0;
class ScrollBar
{
color[] = {0.3,0.3,0.3,0.6};
colorActive[] = {0.3,0.3,0.3,1};
colorDisabled[] = {0.3,0.3,0.3,0.3};
thumb = "\A3\ui_f\data\gui\cfg\scrollbar\thumb_ca.paa";
arrowEmpty = "\A3\ui_f\data\gui\cfg\scrollbar\arrowEmpty_ca.paa";
arrowFull = "\A3\ui_f\data\gui\cfg\scrollbar\arrowFull_ca.paa";
border = "";
};
class ComboScrollBar {
arrowEmpty = "\A3\ui_f\data\gui\cfg\scrollbar\arrowEmpty_ca.paa";
arrowFull = "\A3\ui_f\data\gui\cfg\scrollbar\arrowFull_ca.paa";
autoScrollDelay = 5;
autoScrollEnabled = 0;
autoScrollRewind = 0;
autoScrollSpeed = -1;
border = "\A3\ui_f\data\gui\cfg\scrollbar\border_ca.paa";
color[] = {0.3,0.3,0.3,0.6};
colorActive[] = {0.3,0.3,0.3,1};
colorDisabled[] = {0.3,0.3,0.3,0.3};
height = 0;
scrollSpeed = 0.06;
shadow = 0;
thumb = "\A3\ui_f\data\gui\cfg\scrollbar\thumb_ca.paa";
width = 0;
};
};
class ACE_gui_mapBase {
moveOnEdges = 1;
x = "SafeZoneXAbs";
y = "SafeZoneY + 1.5 * ( ( ((safezoneW / safezoneH) min 1.2) / 1.2) / 25)";
w = "SafeZoneWAbs";
h = "SafeZoneH - 1.5 * ( ( ((safezoneW / safezoneH) min 1.2) / 1.2) / 25)";
type = 100; // Use 100 to hide markers
style = 48;
shadow = 0;
ptsPerSquareSea = 5;
ptsPerSquareTxt = 3;
ptsPerSquareCLn = 10;
ptsPerSquareExp = 10;
ptsPerSquareCost = 10;
ptsPerSquareFor = 9;
ptsPerSquareForEdge = 9;
ptsPerSquareRoad = 6;
ptsPerSquareObj = 9;
showCountourInterval = 0;
scaleMin = 0.001;
scaleMax = 1.0;
scaleDefault = 0.16;
maxSatelliteAlpha = 0.85;
alphaFadeStartScale = 0.35;
alphaFadeEndScale = 0.4;
colorBackground[] = {0.969,0.957,0.949,1.0};
colorSea[] = {0.467,0.631,0.851,0.5};
colorForest[] = {0.624,0.78,0.388,0.5};
colorForestBorder[] = {0.0,0.0,0.0,0.0};
colorRocks[] = {0.0,0.0,0.0,0.3};
colorRocksBorder[] = {0.0,0.0,0.0,0.0};
colorLevels[] = {0.286,0.177,0.094,0.5};
colorMainCountlines[] = {0.572,0.354,0.188,0.5};
colorCountlines[] = {0.572,0.354,0.188,0.25};
colorMainCountlinesWater[] = {0.491,0.577,0.702,0.6};
colorCountlinesWater[] = {0.491,0.577,0.702,0.3};
colorPowerLines[] = {0.1,0.1,0.1,1.0};
colorRailWay[] = {0.8,0.2,0.0,1.0};
colorNames[] = {0.1,0.1,0.1,0.9};
colorInactive[] = {1.0,1.0,1.0,0.5};
colorOutside[] = {0.0,0.0,0.0,1.0};
colorTracks[] = {0.84,0.76,0.65,0.15};
colorTracksFill[] = {0.84,0.76,0.65,1.0};
colorRoads[] = {0.7,0.7,0.7,1.0};
colorRoadsFill[] = {1.0,1.0,1.0,1.0};
colorMainRoads[] = {0.9,0.5,0.3,1.0};
colorMainRoadsFill[] = {1.0,0.6,0.4,1.0};
colorGrid[] = {0.1,0.1,0.1,0.6};
colorGridMap[] = {0.1,0.1,0.1,0.6};
colorText[] = {1, 1, 1, 0.85};
font = "PuristaMedium";
sizeEx = 0.0270000;
stickX[] = {0.20, {"Gamma", 1.00, 1.50} };
stickY[] = {0.20, {"Gamma", 1.00, 1.50} };
onMouseButtonClick = "";
onMouseButtonDblClick = "";
fontLabel = "PuristaMedium";
sizeExLabel = "( ( ( ((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 0.8)";
fontGrid = "TahomaB";
sizeExGrid = 0.02;
fontUnits = "TahomaB";
sizeExUnits = "( ( ( ((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 0.8)";
fontNames = "PuristaMedium";
sizeExNames = "( ( ( ((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 0.8) * 2";
fontInfo = "PuristaMedium";
sizeExInfo = "( ( ( ((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 0.8)";
fontLevel = "TahomaB";
sizeExLevel = 0.02;
text = "#(argb,8,8,3)color(1,1,1,1)";
class ActiveMarker {
color[] = {0.30, 0.10, 0.90, 1.00};
size = 50;
};
class Legend
{
x = "SafeZoneX + ( ((safezoneW / safezoneH) min 1.2) / 40)";
y = "SafeZoneY + safezoneH - 4.5 * ( ( ((safezoneW / safezoneH) min 1.2) / 1.2) / 25)";
w = "10 * ( ((safezoneW / safezoneH) min 1.2) / 40)";
h = "3.5 * ( ( ((safezoneW / safezoneH) min 1.2) / 1.2) / 25)";
font = "PuristaMedium";
sizeEx = "( ( ( ((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 0.8)";
colorBackground[] = {1,1,1,0.5};
color[] = {0,0,0,1};
};
class Task
{
icon = "\A3\ui_f\data\map\mapcontrol\taskIcon_CA.paa";
iconCreated = "\A3\ui_f\data\map\mapcontrol\taskIconCreated_CA.paa";
iconCanceled = "\A3\ui_f\data\map\mapcontrol\taskIconCanceled_CA.paa";
iconDone = "\A3\ui_f\data\map\mapcontrol\taskIconDone_CA.paa";
iconFailed = "\A3\ui_f\data\map\mapcontrol\taskIconFailed_CA.paa";
color[] = {"(profilenamespace getvariable ['IGUI_TEXT_RGB_R',0])","(profilenamespace getvariable ['IGUI_TEXT_RGB_G',1])","(profilenamespace getvariable ['IGUI_TEXT_RGB_B',1])","(profilenamespace getvariable ['IGUI_TEXT_RGB_A',0.8])"};
colorCreated[] = {1,1,1,1};
colorCanceled[] = {0.7,0.7,0.7,1};
colorDone[] = {0.7,1,0.3,1};
colorFailed[] = {1,0.3,0.2,1};
size = 27;
importance = 1;
coefMin = 1;
coefMax = 1;
};
class Waypoint
{
icon = "\A3\ui_f\data\map\mapcontrol\waypoint_ca.paa";
color[] = {0,0,0,1};
size = 20;
importance = "1.2 * 16 * 0.05";
coefMin = 0.900000;
coefMax = 4;
};
class WaypointCompleted
{
icon = "\A3\ui_f\data\map\mapcontrol\waypointCompleted_ca.paa";
color[] = {0,0,0,1};
size = 20;
importance = "1.2 * 16 * 0.05";
coefMin = 0.900000;
coefMax = 4;
};
class CustomMark
{
icon = "\A3\ui_f\data\map\mapcontrol\custommark_ca.paa";
size = 24;
importance = 1;
coefMin = 1;
coefMax = 1;
color[] = {0,0,0,1};
};
class Command
{
icon = "\A3\ui_f\data\map\mapcontrol\waypoint_ca.paa";
size = 18;
importance = 1;
coefMin = 1;
coefMax = 1;
color[] = {1,1,1,1};
};
class Bush
{
icon = "\A3\ui_f\data\map\mapcontrol\bush_ca.paa";
color[] = {0.45,0.64,0.33,0.4};
size = "14/2";
importance = "0.2 * 14 * 0.05 * 0.05";
coefMin = 0.25;
coefMax = 4;
};
class Rock
{
icon = "\A3\ui_f\data\map\mapcontrol\rock_ca.paa";
color[] = {0.1,0.1,0.1,0.8};
size = 12;
importance = "0.5 * 12 * 0.05";
coefMin = 0.25;
coefMax = 4;
};
class SmallTree
{
icon = "\A3\ui_f\data\map\mapcontrol\bush_ca.paa";
color[] = {0.45,0.64,0.33,0.4};
size = 12;
importance = "0.6 * 12 * 0.05";
coefMin = 0.25;
coefMax = 4;
};
class Tree
{
icon = "\A3\ui_f\data\map\mapcontrol\bush_ca.paa";
color[] = {0.45,0.64,0.33,0.4};
size = 12;
importance = "0.9 * 16 * 0.05";
coefMin = 0.25;
coefMax = 4;
};
class busstop
{
icon = "\A3\ui_f\data\map\mapcontrol\busstop_CA.paa";
size = 24;
importance = 1;
coefMin = 0.85;
coefMax = 1.0;
color[] = {1,1,1,1};
};
class fuelstation
{
icon = "\A3\ui_f\data\map\mapcontrol\fuelstation_CA.paa";
size = 24;
importance = 1;
coefMin = 0.85;
coefMax = 1.0;
color[] = {1,1,1,1};
};
class hospital
{
icon = "\A3\ui_f\data\map\mapcontrol\hospital_CA.paa";
size = 24;
importance = 1;
coefMin = 0.85;
coefMax = 1.0;
color[] = {1,1,1,1};
};
class church
{
icon = "\A3\ui_f\data\map\mapcontrol\church_CA.paa";
size = 24;
importance = 1;
coefMin = 0.85;
coefMax = 1.0;
color[] = {1,1,1,1};
};
class lighthouse
{
icon = "\A3\ui_f\data\map\mapcontrol\lighthouse_CA.paa";
size = 24;
importance = 1;
coefMin = 0.85;
coefMax = 1.0;
color[] = {1,1,1,1};
};
class power
{
icon = "\A3\ui_f\data\map\mapcontrol\power_CA.paa";
size = 24;
importance = 1;
coefMin = 0.85;
coefMax = 1.0;
color[] = {1,1,1,1};
};
class powersolar
{
icon = "\A3\ui_f\data\map\mapcontrol\powersolar_CA.paa";
size = 24;
importance = 1;
coefMin = 0.85;
coefMax = 1.0;
color[] = {1,1,1,1};
};
class powerwave
{
icon = "\A3\ui_f\data\map\mapcontrol\powerwave_CA.paa";
size = 24;
importance = 1;
coefMin = 0.85;
coefMax = 1.0;
color[] = {1,1,1,1};
};
class powerwind
{
icon = "\A3\ui_f\data\map\mapcontrol\powerwind_CA.paa";
size = 24;
importance = 1;
coefMin = 0.85;
coefMax = 1.0;
color[] = {1,1,1,1};
};
class quay
{
icon = "\A3\ui_f\data\map\mapcontrol\quay_CA.paa";
size = 24;
importance = 1;
coefMin = 0.85;
coefMax = 1.0;
color[] = {1,1,1,1};
};
class shipwreck
{
icon = "\A3\ui_f\data\map\mapcontrol\shipwreck_CA.paa";
size = 24;
importance = 1;
coefMin = 0.85;
coefMax = 1.0;
color[] = {1,1,1,1};
};
class transmitter
{
icon = "\A3\ui_f\data\map\mapcontrol\transmitter_CA.paa";
size = 24;
importance = 1;
coefMin = 0.85;
coefMax = 1.0;
color[] = {1,1,1,1};
};
class watertower
{
icon = "\A3\ui_f\data\map\mapcontrol\watertower_CA.paa";
size = 24;
importance = 1;
coefMin = 0.85;
coefMax = 1.0;
color[] = {1,1,1,1};
};
class Cross
{
icon = "\A3\ui_f\data\map\mapcontrol\Cross_CA.paa";
size = 24;
importance = 1;
coefMin = 0.85;
coefMax = 1.0;
color[] = {0,0,0,1};
};
class Chapel
{
icon = "\A3\ui_f\data\map\mapcontrol\Chapel_CA.paa";
size = 24;
importance = 1;
coefMin = 0.85;
coefMax = 1.0;
color[] = {0,0,0,1};
};
class Bunker
{
icon = "\A3\ui_f\data\map\mapcontrol\bunker_ca.paa";
size = 14;
importance = "1.5 * 14 * 0.05";
coefMin = 0.25;
coefMax = 4;
color[] = {0,0,0,1};
};
class Fortress
{
icon = "\A3\ui_f\data\map\mapcontrol\bunker_ca.paa";
size = 16;
importance = "2 * 16 * 0.05";
coefMin = 0.25;
coefMax = 4;
color[] = {0,0,0,1};
};
class Fountain
{
icon = "\A3\ui_f\data\map\mapcontrol\fountain_ca.paa";
size = 11;
importance = "1 * 12 * 0.05";
coefMin = 0.25;
coefMax = 4;
color[] = {0,0,0,1};
};
class Ruin
{
icon = "\A3\ui_f\data\map\mapcontrol\ruin_ca.paa";
size = 16;
importance = "1.2 * 16 * 0.05";
coefMin = 1;
coefMax = 4;
color[] = {0,0,0,1};
};
class Stack
{
icon = "\A3\ui_f\data\map\mapcontrol\stack_ca.paa";
size = 20;
importance = "2 * 16 * 0.05";
coefMin = 0.9;
coefMax = 4;
color[] = {0,0,0,1};
};
class Tourism
{
icon = "\A3\ui_f\data\map\mapcontrol\tourism_ca.paa";
size = 16;
importance = "1 * 16 * 0.05";
coefMin = 0.7;
coefMax = 4;
color[] = {0,0,0,1};
};
class ViewTower
{
icon = "\A3\ui_f\data\map\mapcontrol\viewtower_ca.paa";
size = 16;
importance = "2.5 * 16 * 0.05";
coefMin = 0.5;
coefMax = 4;
color[] = {0,0,0,1};
};
};
#endif

View File

@ -0,0 +1,11 @@
/**
* XEH_postInit.sqf
* @Descr: N/A
* @Author: Glowbal
*
* @Arguments: []
* @Return:
* @PublicAPI: false
*/
#include "script_component.hpp"

View File

@ -0,0 +1,28 @@
/**
* XEH_preInit.sqf
* @Descr: N/A
* @Author: Glowbal
*
* @Arguments: []
* @Return:
* @PublicAPI: false
*/
#include "script_component.hpp"
ADDON = false;
PREP(loadingBar);
PREP(displayInformation);
PREP(displayMessage);
PREP(blurScreen);
PREP(displayIcon);
PREP(effectPain);
PREP(effectBleeding);
PREP(effectBlackOut);
PREP(sendHintTo);
PREP(sendMessageTo);
PREP(sendDisplayInformationTo);
PREP(sendDisplayMessageTo);
ADDON = true;

27
addons/gui/config.cpp Normal file
View File

@ -0,0 +1,27 @@
#include "script_component.hpp"
class CfgPatches {
class ADDON {
units[] = {};
weapons[] = {};
requiredVersion = REQUIRED_VERSION;
requiredAddons[] = {"ACE_main"};
version = VERSION;
author[] = {$STR_ACE_Common_ACETeam};
authorUrl = "http://csemod.com"; // TODO website link?
};
};
class CfgAddons {
class PreloadAddons {
class ADDON {
list[] = {QUOTE(ADDON)};
};
};
};
#include "CfgEventHandlers.hpp"
// TODO Port over the UI defines
#include "GUI.hpp"
#include "empty.hpp"

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
addons/gui/data/hit.paa Normal file

Binary file not shown.

Binary file not shown.

21
addons/gui/empty.hpp Normal file
View File

@ -0,0 +1,21 @@
#include "\z\ace\addons\gui\UI\define.hpp"
class ACE_common_empty_screen {
idd = 679123;
onLoad = "uiNamespace setVariable [""ACE_common_empty_screen"", _this select 0]";
onUnload = "if (missionNamespace getvariable [""ACE_common_DISABLE_USER_INPUT_SCREEN"", false)]) then { createDialog ""ACE_common_empty_screen""; }";
class controlsBackground {
class background : ACE_gui_backgroundBase {
idc = 1;
x = safezoneX;
y = safezoneY;
w = safezoneW;
h = safezoneH;
text = "";
moving = 0;
};
};
class controls {
};
};

View File

@ -0,0 +1,42 @@
/**
* fn_gui_blurScreen.sqf
* @Descr:
* @Author: Glowbal
*
* @Arguments: []
* @Return:
* @PublicAPI: true
*/
#include "script_component.hpp"
private ["_id", "_show"];
_id = _this select 0;
_show = if (count _this > 1) then {_this select 1} else {false};
if (isnil QGVAR(SHOW_BLUR_SCREEN_COLLECTION)) then {
GVAR(SHOW_BLUR_SCREEN_COLLECTION) = [];
};
if (typeName _show == typeName 0) then {
_show = (_show == 1);
};
if (_show) then {
GVAR(SHOW_BLUR_SCREEN_COLLECTION) pushback _id;
// show blur
if (isnil QGVAR(MENU_ppHandle_GUI_BLUR_SCREEN)) then {
GVAR(MENU_ppHandle_GUI_BLUR_SCREEN) = ppEffectCreate ["DynamicBlur", 102];
GVAR(MENU_ppHandle_GUI_BLUR_SCREEN) ppEffectAdjust [0.9];
GVAR(MENU_ppHandle_GUI_BLUR_SCREEN) ppEffectEnable true;
GVAR(MENU_ppHandle_GUI_BLUR_SCREEN) ppEffectCommit 0;
};
} else {
GVAR(SHOW_BLUR_SCREEN_COLLECTION) = GVAR(SHOW_BLUR_SCREEN_COLLECTION) - [_id];
if (GVAR(SHOW_BLUR_SCREEN_COLLECTION) isEqualTo []) then {
// hide blur
if (!isnil QGVAR(MENU_ppHandle_GUI_BLUR_SCREEN)) then {
ppEffectDestroy GVAR(MENU_ppHandle_GUI_BLUR_SCREEN);
GVAR(MENU_ppHandle_GUI_BLUR_SCREEN) = nil;
};
};
};

Some files were not shown because too many files have changed in this diff Show More