Skip to content

Commit f196f53

Browse files
committed
Make visual sensor mode black and white
1 parent 2b76bdd commit f196f53

File tree

5 files changed

+45
-7
lines changed

5 files changed

+45
-7
lines changed

addons/spike/CfgAmmo.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,8 @@ class CfgAmmo {
8181
alwaysDesignate = 0; // always designate
8282
canStopDesignating = 0;
8383

84-
enabledThermalTypes[] = { "white_hot_black_cold", "black_hot_white_cold" };
85-
initialThermalType = "white_hot_black_cold";
84+
enabledThermalTypes[] = { "normal", "white_hot_black_cold", "black_hot_white_cold" };
85+
initialThermalType = "normal";
8686

8787
class reticle {
8888
titleRsc = "ACE_guidance_spike";

addons/spike/XEH_postInit.sqf

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,23 @@ if (hasInterface) then {
2121
GVAR(activeCamera) = objNull;
2222
GVAR(projectileHashMap) = createHashMap; // used in the seeker to get the namespace for the associated projectile
2323
GVAR(launcherWeapons) = createHashMap; // Used to quickly determine whether the current weapon is a Spike launcher
24+
25+
// Define the B&W ppEffect for the visual seeker view mode
26+
GVAR(ppEffectBW) = ppEffectCreate ["ColorCorrections", 1500];
27+
GVAR(ppEffectBW) ppEffectAdjust [1, 1, 0, [0, 0, 0, 0], [1, 1, 1, 0], [0.33, 0.33, 0.33, 0]];
28+
GVAR(ppEffectBW) ppEffectCommit 0;
29+
GVAR(ppEffectBW) ppEffectEnable false;
30+
31+
// Stores launcher view mode, to auto-set the missile's post-launch
32+
GVAR(visionMode) = "normal";
33+
ace_player addEventHandler ["VisionModeChanged", {
34+
params ["", "_visionMode", "_TIindex"];
35+
36+
if (cameraView isNotEqualTo "GUNNER") exitWith {};
37+
38+
if (_visionMode == 2) then { // If thermal, add specific thermal submode to index
39+
_visionMode = _TIindex + 1;
40+
};
41+
GVAR(visionMode) = ["normal", "white_hot_black_cold", "black_hot_white_cold"] select _visionMode;
42+
}];
2443
};

addons/spike/functions/fnc_camera_init.sqf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ if (_designating) then {
4848
_activeCameraNamespace setVariable [QGVAR(reticleData), _reticleData];
4949
_shooter setVariable [QGVAR(missileCamera), _activeCameraNamespace];
5050
_activeCameraNamespace setVariable [QGVAR(shooter), _shooter];
51-
[_activeCameraNamespace, _initialThermalType] call FUNC(camera_setViewMode);
51+
[_activeCameraNamespace, GVAR(visionMode)] call FUNC(camera_setViewMode);
5252

5353
private _pos = getPosASL _projectile;
5454

addons/spike/functions/fnc_camera_setViewMode.sqf

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ params ["_cameraNamespace", "_viewMode"];
2020
private _userInCamera = [] call FUNC(camera_userInCamera);
2121

2222
if (_userInCamera) then {
23+
GVAR(ppEffectBW) ppEffectEnable false;
2324
camUseNVG false;
2425
false setCamUseTI (_cameraNamespace getVariable [QGVAR(tiMode), 0]);
2526
};
@@ -29,11 +30,17 @@ if (_thermalMode > 1) then {
2930
if (_userInCamera) then {
3031
true setCamUseTI (_thermalMode - 2);
3132
};
32-
};
33-
if (_thermalMode == 1) then {
34-
if (_userInCamera) then {
35-
camUseNVG true;
33+
} else {
34+
if (_thermalMode == 1) then {
35+
if (_userInCamera) then {
36+
camUseNVG true;
37+
};
38+
} else {
39+
GVAR(ppEffectBW) ppEffectEnable true;
3640
};
3741
};
3842
_cameraNamespace setVariable [QGVAR(tiMode), _thermalMode - 2];
3943
_cameraNamespace setVariable [QGVAR(tiModeString), _viewMode];
44+
45+
private _thermalIndex = (_cameraNamespace getVariable [QGVAR(thermalTypes), []]) findIf { _viewMode isEqualTo _x };
46+
_cameraNamespace setVariable [QGVAR(currentTIModeIndex), _thermalIndex];

addons/spike/functions/fnc_mapHelperDraw.sqf

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,17 @@ if (isNil QGVAR(arguments)) then {
4545
if (cameraView isEqualTo "GUNNER") then {
4646
GVAR(arguments) set [0, diag_frameNo];
4747

48+
private _visionMode = currentVisionMode ace_player;
49+
// If the current mode is normal, but thermal was cached, recover to normal. This happens when selecting a thermal mode, dropping and picking the launcher back up.
50+
if (GVAR(visionMode) != "normal" && _visionMode == 0) then { GVAR(visionMode) = "normal"; };
51+
52+
// Toggle Black&White effect depending on vision mode
53+
if (_visionMode == 0) then {
54+
GVAR(ppEffectBW) ppEffectEnable true;
55+
} else {
56+
GVAR(ppEffectBW) ppEffectEnable false;
57+
};
58+
4859
__SPIKE_RETICLE ctrlShow true;
4960
GVAR(arguments) params ["", "_targetPosition"];
5061

@@ -94,6 +105,7 @@ if (cameraView isEqualTo "GUNNER") then {
94105

95106
__SPIKE_RETICLE ctrlCommit 0;
96107
} else {
108+
GVAR(ppEffectBW) ppEffectEnable false;
97109
__SPIKE_RETICLE ctrlShow false;
98110
(__SPIKE_DISPLAY displayCtrl 241000) ctrlShow false;
99111
};

0 commit comments

Comments
 (0)