Skip to content

Commit 89659ec

Browse files
committed
ready for playtesting?
1 parent 5606d06 commit 89659ec

20 files changed

+601
-422
lines changed

x/ocap2/addons/extension/config.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ class CfgPatches
1717
};
1818
};
1919

20+
cba_settings_whitelist[] = {"admin"};
21+
2022
class Extended_PreInit_EventHandlers {
2123
class ADDON {
2224
// This will be executed once in 3DEN, main menu and before briefing has started for every mission

x/ocap2/addons/main/config.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ class CfgPatches
1717
};
1818
};
1919

20+
cba_settings_whitelist[] = {"admin"};
21+
2022
class Extended_PreInit_EventHandlers {
2123
class ADDON {
2224
// This will be executed once in 3DEN, main menu and before briefing has started for every mission

x/ocap2/addons/recorder/XEH_preInit.sqf

+14-14
Original file line numberDiff line numberDiff line change
@@ -115,20 +115,6 @@ GVAR(allSettings) = [
115115
false // requires restart to apply
116116
],
117117

118-
[
119-
QEGVAR(settings,pauseOnEmpty),
120-
"CHECKBOX", // setting type
121-
[
122-
"Auto-Save When No Players", // Pretty name shown inside the ingame settings menu. Can be stringtable entry.
123-
"Will automatically save recording when there are 0 players on the server and existing data accounts for more time than the minumum save duration setting. Default: true"
124-
],
125-
[COMPONENT_NAME, "Recording Settings"], // Pretty name of the category where the setting can be found. Can be stringtable entry.
126-
true, // default enabled
127-
true, // "_isGlobal" flag. Set this to true to always have this setting synchronized between all clients in multiplayer
128-
{}, // function that will be executed once on mission start and every time the setting is changed.
129-
false // requires restart to apply
130-
],
131-
132118
[
133119
QEGVAR(settings,trackTimes),
134120
"CHECKBOX", // setting type
@@ -194,6 +180,20 @@ GVAR(allSettings) = [
194180
false // requires restart to apply
195181
],
196182

183+
[
184+
QEGVAR(settings,saveOnEmpty),
185+
"CHECKBOX", // setting type
186+
[
187+
"Auto-Save When No Players", // Pretty name shown inside the ingame settings menu. Can be stringtable entry.
188+
"Will automatically save recording when there are 0 players on the server and existing data accounts for more time than the minimum save duration setting. Default: true"
189+
],
190+
[COMPONENT_NAME, "Recording Settings"], // Pretty name of the category where the setting can be found. Can be stringtable entry.
191+
true, // default enabled
192+
true, // "_isGlobal" flag. Set this to true to always have this setting synchronized between all clients in multiplayer
193+
{}, // function that will be executed once on mission start and every time the setting is changed.
194+
false // requires restart to apply
195+
],
196+
197197
[
198198
QEGVAR(settings,minMissionTime),
199199
"SLIDER", // setting type

x/ocap2/addons/recorder/XEH_prep.sqf

+3-1
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,10 @@ PREP(eh_hit);
2323
PREP(eh_killed);
2424
PREP(getInstigator);
2525
PREP(getEventWeaponText);
26-
PREP(getAmmoData);
26+
PREP(getAmmoMarkerData);
27+
PREP(getWeaponDisplayData);
2728

29+
PREP(projectileMonitors);
2830
PREP(aceThrowing);
2931
PREP(aceExplosives);
3032

x/ocap2/addons/recorder/config.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ class CfgPatches
1717
};
1818
};
1919

20+
cba_settings_whitelist[] = {"admin"};
21+
2022
class Extended_PreInit_EventHandlers {
2123
class ADDON {
2224
// This will be executed once in 3DEN, main menu and before briefing has started for every mission

x/ocap2/addons/recorder/fnc_aceExplosives.sqf

+8-5
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ EGVAR(listener,aceExplosives) = ["ace_explosives_place", {
4141
_explType = typeOf _explosive;
4242
_explosiveMag = getText(configFile >> "CfgAmmo" >> _explType >> "defaultMagazine");
4343
_explosiveDisp = getText(configFile >> "CfgMagazines" >> _explosiveMag >> "displayName");
44+
_explosivePic = getText(configFile >> "CfgMagazines" >> _explosiveMag >> "picture");
4445

4546
_placedPos = getPosASL _explosive;
4647
_unit addOwnedMine _explosive;
@@ -50,15 +51,17 @@ EGVAR(listener,aceExplosives) = ["ace_explosives_place", {
5051
_markColor = "ColorRed";
5152
_markerType = "Minefield";
5253

53-
if (GVARMAIN(isDebug)) then {
54-
format["Created explosive placed marker, %1, %2", _markName, _explosiveDisp] SYSCHAT;
55-
OCAPEXTLOG(ARR3("Created explosive placed marker", _markName, _explosiveDisp));
56-
};
57-
5854
[QGVARMAIN(handleMarker), [
5955
"CREATED", _markName, _unit, _placedPos, _markerType, "ICON", [1,1], 0, "Solid", "ColorRed", 1, _markTextLocal, true
6056
]] call CBA_fnc_localEvent;
6157

58+
if (GVARMAIN(isDebug)) then {
59+
// add to map draw array
60+
private _debugArr = [_explosive, _explosivePic, format["%1 %2 - %3", str side group _unit, name _unit, _markTextLocal], [side group _unit] call BIS_fnc_sideColor];
61+
GVAR(liveDebugMagIcons) pushBack _debugArr;
62+
publicVariable QGVAR(liveDebugMagIcons);
63+
};
64+
6265

6366
[{isNull (_this#0)}, { // wait until the mine is null (exploded), and mark this for playback
6467

x/ocap2/addons/recorder/fnc_aceThrowing.sqf

+74-106
Original file line numberDiff line numberDiff line change
@@ -27,135 +27,103 @@ EGVAR(listener,aceThrowing) = ["ace_throwableThrown", {
2727

2828
if (!SHOULDSAVEEVENTS) exitWith {};
2929

30-
_this spawn {
30+
params["_unit", "_projectile"];
3131

32-
params["_unit", "_projectile"];
32+
if (isNull _projectile) then {
33+
_projectile = nearestObject [_unit, "CA_Magazine"];
34+
};
3335

34-
if (isNull _projectile) then {
35-
_projectile = nearestObject [_unit, "CA_Magazine"];
36-
};
36+
// systemChat str _this;
3737

38-
// systemChat str _this;
38+
// note that thrown objects outside of ACE explosives do not include a "default magazine" property in their config.
39+
// this script will attempt to find a matching classname in CfgMagazines, as some chemlights and smokes are built this way.
40+
// if not found, a default magazine value will be assigned (m67 frag, white smoke, green chemlight)
3941

40-
// note that thrown objects outside of ACE explosives do not include a "default magazine" property in their config.
41-
// this script will attempt to find a matching classname in CfgMagazines, as some chemlights and smokes are built this way.
42-
// if not found, a default magazine value will be assigned (m67 frag, white smoke, green chemlight)
42+
_projType = typeOf _projectile;
43+
_projConfig = configOf _projectile;
44+
_projName = getText(configFile >> "CfgAmmo" >> _projType >> "displayName");
4345

44-
_projType = typeOf _projectile;
45-
_projConfig = configOf _projectile;
46-
_projName = getText(configFile >> "CfgAmmo" >> _projType >> "displayName");
46+
// systemChat format["Config name: %1", configOf _projectile];
4747

48-
if (GVARMAIN(isDebug)) then {
49-
format["Detected ACE throwing of %1", _projName] SYSCHAT;
50-
OCAPEXTLOG(ARR2("Detected ACE throwing of ", _projName));
51-
};
48+
_ammoSimType = getText(configFile >> "CfgAmmo" >> _projType >> "simulation");
49+
// systemChat format["Projectile type: %1", _ammoSimType];
5250

53-
// systemChat format["Config name: %1", configOf _projectile];
51+
_markerType = "";
52+
_markColor = "";
53+
_magDisp = "";
54+
_magPic = "";
5455

55-
_ammoSimType = getText(configFile >> "CfgAmmo" >> _projType >> "simulation");
56-
// systemChat format["Projectile type: %1", _ammoSimType];
56+
_magType = getText(_projConfig >> "defaultMagazine");
57+
if (_magType == "") then {
58+
_magType = configName(configfile >> "CfgMagazines" >> _projType)
59+
};
5760

58-
_markerType = "";
59-
_markColor = "";
60-
_magDisp = "";
61-
_magPic = "";
61+
if (!(_magType isEqualTo "")) then {
62+
// systemChat format["Mag type: %1", _magType];
6263

63-
_magType = getText(_projConfig >> "defaultMagazine");
64-
if (_magType == "") then {
65-
_magType = configName(configfile >> "CfgMagazines" >> _projType)
64+
_magDisp = getText(configFile >> "CfgMagazines" >> _magType >> "displayNameShort");
65+
if (_magDisp == "") then {
66+
_magDisp = getText(configFile >> "CfgMagazines" >> _magType >> "displayName")
67+
};
68+
if (_magDisp == "") then {
69+
_magDisp = _projName;
6670
};
6771

68-
if (!(_magType isEqualTo "")) then {
69-
// systemChat format["Mag type: %1", _magType];
70-
71-
_magDisp = getText(configFile >> "CfgMagazines" >> _magType >> "displayNameShort");
72-
if (_magDisp == "") then {
73-
_magDisp = getText(configFile >> "CfgMagazines" >> _magType >> "displayName")
74-
};
75-
if (_magDisp == "") then {
76-
_magDisp = _projName;
77-
};
78-
79-
_magPic = (getText(configfile >> "CfgMagazines" >> _magType >> "picture"));
80-
// hint parseText format["Projectile fired:<br/><img image='%1'/>", _magPic];
81-
if (_magPic == "") then {
82-
_markerType = "mil_triangle";
83-
_markColor = "ColorRed";
84-
} else {
85-
_magPicSplit = _magPic splitString "\";
86-
_magPic = _magPicSplit#((count _magPicSplit) - 1);
87-
_markerType = format["magIcons/%1", _magPic];
88-
_markColor = "ColorWhite";
89-
};
90-
} else {
72+
_magPic = (getText(configfile >> "CfgMagazines" >> _magType >> "picture"));
73+
// hint parseText format["Projectile fired:<br/><img image='%1'/>", _magPic];
74+
if (_magPic == "") then {
9175
_markerType = "mil_triangle";
9276
_markColor = "ColorRed";
93-
// set defaults based on ammo sim type, if no magazine could be matched
94-
switch (_ammoSimType) do {
95-
case "shotGrenade":{
96-
_magPic = "\A3\Weapons_F\Data\UI\gear_M67_CA.paa";
97-
_magDisp = "Frag";
98-
};
99-
case "shotSmokeX":{
100-
_magPic = "\A3\Weapons_f\data\ui\gear_smokegrenade_white_ca.paa";
101-
_magDisp = "Smoke";
102-
};
103-
case "shotIlluminating":{
104-
_magPic = "\A3\Weapons_F\Data\UI\gear_flare_white_ca.paa";
105-
_magDisp = "Flare";
106-
};
107-
default {
108-
_magPic = "\A3\Weapons_F\Data\UI\gear_M67_CA.paa";
109-
_magDisp = "Frag";
110-
};
111-
};
112-
// hint parseText format["Projectile fired:<br/><img image='%1'/>", _magPic];
77+
} else {
11378
_magPicSplit = _magPic splitString "\";
11479
_magPic = _magPicSplit#((count _magPicSplit) - 1);
11580
_markerType = format["magIcons/%1", _magPic];
11681
_markColor = "ColorWhite";
11782
};
83+
} else {
84+
_markerType = "mil_triangle";
85+
_markColor = "ColorRed";
86+
// set defaults based on ammo sim type, if no magazine could be matched
87+
switch (_ammoSimType) do {
88+
case "shotGrenade":{
89+
_magPic = "\A3\Weapons_F\Data\UI\gear_M67_CA.paa";
90+
_magDisp = "Frag";
91+
};
92+
case "shotSmokeX":{
93+
_magPic = "\A3\Weapons_f\data\ui\gear_smokegrenade_white_ca.paa";
94+
_magDisp = "Smoke";
95+
};
96+
case "shotIlluminating":{
97+
_magPic = "\A3\Weapons_F\Data\UI\gear_flare_white_ca.paa";
98+
_magDisp = "Flare";
99+
};
100+
default {
101+
_magPic = "\A3\Weapons_F\Data\UI\gear_M67_CA.paa";
102+
_magDisp = "Frag";
103+
};
104+
};
105+
// hint parseText format["Projectile fired:<br/><img image='%1'/>", _magPic];
106+
_magPicSplit = _magPic splitString "\";
107+
_magPic = _magPicSplit#((count _magPicSplit) - 1);
108+
_markerType = format["magIcons/%1", _magPic];
109+
_markColor = "ColorWhite";
110+
};
118111

119-
if (!(_ammoSimType isEqualTo "shotBullet")) then {
120-
121-
_int = random 2000;
122-
123-
_markTextLocal = format["%1", _magDisp];
124-
_markName = format["Projectile#%1", _int];
125-
126-
_throwerPos = getPosASL _unit;
127-
128-
[QGVARMAIN(handleMarker), ["CREATED", _markName, _unit, _throwerPos, _markerType, "ICON", [1,1], 0, "Solid", _markColor, 1, _markTextLocal, true]] call CBA_fnc_serverEvent;
112+
_int = random 2000;
129113

130-
private _lastPos = [];
131-
waitUntil {
132-
_pos = getPosASL _projectile;
133-
if (((_pos select 0) isEqualTo 0) || isNull _projectile) exitWith {
134-
true
135-
};
136-
_lastPos = _pos;
137-
[QGVARMAIN(handleMarker), ["UPDATED", _markName, _unit, _pos, "", "", "", 0, "", "", 1]] call CBA_fnc_serverEvent;
114+
_markTextLocal = format["%1", _magDisp];
115+
_markName = format["Projectile#%1", _int];
138116

139-
// here, monitor fast moving missiles/rockets/shells every 0.3 seconds. monitor smokes, grenades, flares, mines in line with the configured frame capture delay
140-
sleep (([0.3, GVAR(frameCaptureDelay)] select {_ammoSimType in ["ShotSmokeX","ShotGrenade","ShotIlluminating","ShotMine"]})#0);
141-
false;
142-
};
117+
// MAKE MARKER FOR PLAYBACK
118+
_throwerPos = getPosASL _unit;
119+
[QGVARMAIN(handleMarker), ["CREATED", _markName, _unit, _throwerPos, _markerType, "ICON", [1,1], 0, "Solid", _markColor, 1, _markTextLocal, true]] call CBA_fnc_serverEvent;
143120

144-
if !((count _lastPos) isEqualTo 0) then {
145-
isNil {
146-
// for non-bullets, set the last fired variable of the soldier so hits/kills are recorded accurately
147-
if (_ammoSimType == "shotGrenade") then {
148-
_unit setVariable [
149-
QGVARMAIN(lastFired),
150-
_projName
151-
];
152-
};
153-
};
154-
[QGVARMAIN(handleMarker), ["UPDATED", _markName, _unit, _lastPos, "", "", "", 0, "", "", 1]] call CBA_fnc_serverEvent;
155-
};
121+
GVAR(liveGrenades) pushBack [_projectile, _magazine, _unit, getPosASL _projectile, _markName, _markTextLocal, _ammoSimType];
156122

157-
sleep 10;
158-
[QGVARMAIN(handleMarker), ["DELETED", _markName]] call CBA_fnc_serverEvent;
159-
};
123+
if (GVARMAIN(isDebug)) then {
124+
// add to map draw array
125+
private _debugArr = [_projectile, _magPic, format["%1 %2 - %3", str side group _unit, name _unit, _markTextLocal], [side group _unit] call BIS_fnc_sideColor];
126+
GVAR(liveDebugMagIcons) pushBack _debugArr;
127+
publicVariable QGVAR(liveDebugMagIcons);
160128
};
161129
}] call CBA_fnc_addEventHandler;

0 commit comments

Comments
 (0)