2023-09-12 18:58:10 +00:00
|
|
|
#include "..\script_component.hpp"
|
2015-03-14 16:46:10 +00:00
|
|
|
/*
|
2016-06-18 00:18:06 +00:00
|
|
|
* Author: Rocko and esteldunedain
|
|
|
|
* On map draw, updates the effects
|
|
|
|
*
|
|
|
|
* Arguments:
|
2021-10-12 08:31:46 +00:00
|
|
|
* 0: Map control <CONTROL>
|
2016-06-18 00:18:06 +00:00
|
|
|
*
|
|
|
|
* Return Value:
|
|
|
|
* None
|
|
|
|
*
|
2017-06-08 13:31:51 +00:00
|
|
|
* Example:
|
2021-10-12 08:31:46 +00:00
|
|
|
* _mapControl call ACE_map_fnc_updateMapEffects
|
2017-06-08 13:31:51 +00:00
|
|
|
*
|
2016-06-18 00:18:06 +00:00
|
|
|
* Public: No
|
|
|
|
*/
|
2015-03-13 00:04:10 +00:00
|
|
|
|
2016-06-18 00:18:06 +00:00
|
|
|
params ["_mapCtrl"];
|
|
|
|
private _mapScale = ctrlMapScale _mapCtrl;
|
|
|
|
private _mapCentre = _mapCtrl ctrlMapScreenToWorld [0.5, 0.5];
|
2015-03-13 04:35:45 +00:00
|
|
|
|
2015-03-14 16:46:10 +00:00
|
|
|
if (GVAR(mapIllumination)) then {
|
2015-08-11 17:49:39 +00:00
|
|
|
//get nearby lighting
|
2023-08-29 15:32:44 +00:00
|
|
|
private _light = [ACE_player] call FUNC(determineMapLight);
|
2015-03-13 00:04:10 +00:00
|
|
|
|
2015-08-11 17:49:39 +00:00
|
|
|
_light params ["_applyLighting", "_lightLevel"];
|
2015-03-13 00:04:10 +00:00
|
|
|
|
2015-08-11 17:49:39 +00:00
|
|
|
if (_applyLighting) then {
|
|
|
|
[_mapCtrl, _mapScale, _mapCentre, _lightLevel] call FUNC(simulateMapLight);
|
2015-03-14 16:46:10 +00:00
|
|
|
};
|
2015-03-13 00:04:10 +00:00
|
|
|
};
|
|
|
|
|
2015-03-14 16:46:10 +00:00
|
|
|
if (GVAR(mapShake)) then {
|
2015-03-13 00:04:10 +00:00
|
|
|
|
2015-03-14 16:46:10 +00:00
|
|
|
// Only shake map while moving on foot
|
2016-06-18 00:18:06 +00:00
|
|
|
private _speed = 0;
|
2017-12-02 17:57:36 +00:00
|
|
|
if ((alive ACE_player) && {vehicle ACE_player == ACE_player}) then {
|
2015-03-14 16:46:10 +00:00
|
|
|
_speed = vectorMagnitude (velocity ACE_player);
|
|
|
|
};
|
2015-03-13 00:04:10 +00:00
|
|
|
|
2015-03-14 16:46:10 +00:00
|
|
|
// If speed is large enough, create anims to shake map
|
|
|
|
if (_speed > 0.1) then {
|
|
|
|
if (ctrlMapAnimDone _mapCtrl) then {
|
2015-03-13 00:04:10 +00:00
|
|
|
|
2016-06-18 00:18:06 +00:00
|
|
|
private _amplitude = (_speed - 0.1) / 5 * (1000 * _mapScale);
|
|
|
|
private _time = 0.1;
|
2015-03-13 00:04:10 +00:00
|
|
|
|
2016-06-18 00:18:06 +00:00
|
|
|
private _shakePos = [(GVAR(lastStillPosition) select 0) + sin((CBA_missionTime + _time - GVAR(lastStillTime))*100) * _amplitude * 0.25,
|
2016-03-02 10:01:39 +00:00
|
|
|
(GVAR(lastStillPosition) select 1) + sin((CBA_missionTime + _time - GVAR(lastStillTime))*260) * _amplitude];
|
2015-03-13 00:04:10 +00:00
|
|
|
|
2015-03-14 16:46:10 +00:00
|
|
|
_mapCtrl ctrlMapAnimAdd [_time, _mapScale, _shakePos];
|
|
|
|
ctrlMapAnimCommit _mapCtrl;
|
2015-03-13 00:04:10 +00:00
|
|
|
|
2015-03-14 16:46:10 +00:00
|
|
|
GVAR(isShaking) = true;
|
2015-03-13 00:04:10 +00:00
|
|
|
};
|
2015-03-14 16:46:10 +00:00
|
|
|
} else {
|
|
|
|
if (GVAR(isShaking)) then {
|
|
|
|
// Stop shaking, return to original position
|
2015-05-25 04:56:22 +00:00
|
|
|
ctrlMapAnimClear _mapCtrl;
|
2015-03-14 16:46:10 +00:00
|
|
|
_mapCtrl ctrlMapAnimAdd [0, _mapScale, GVAR(lastStillPosition)];
|
|
|
|
ctrlMapAnimCommit _mapCtrl;
|
|
|
|
GVAR(isShaking) = false;
|
|
|
|
} else {
|
|
|
|
// The map is still, store state
|
2015-08-11 17:49:39 +00:00
|
|
|
GVAR(lastStillPosition) = _mapCentre;
|
2016-03-02 10:01:39 +00:00
|
|
|
GVAR(lastStillTime) = CBA_missionTime;
|
2015-03-14 16:46:10 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
if (GVAR(mapLimitZoom)) then {
|
|
|
|
if (GVAR(minMapSize) >= _mapScale) then {
|
|
|
|
ctrlMapAnimClear _mapCtrl;
|
2015-08-11 17:49:39 +00:00
|
|
|
_mapCtrl ctrlMapAnimAdd [0, GVAR(minMapSize) + 0.001, _mapCentre];
|
2015-03-14 16:46:10 +00:00
|
|
|
ctrlMapAnimCommit _mapCtrl;
|
2015-03-13 00:04:10 +00:00
|
|
|
};
|
2015-10-14 17:56:54 +00:00
|
|
|
};
|