2015-03-14 16:46:10 +00:00
|
|
|
/*
|
2015-03-24 04:18:00 +00:00
|
|
|
* Author: Rocko and esteldunedain
|
2015-03-14 16:46:10 +00:00
|
|
|
* On map draw, updates the effects
|
|
|
|
*
|
|
|
|
* Arguments:
|
|
|
|
* None
|
|
|
|
*
|
|
|
|
* Return Value:
|
|
|
|
* None
|
|
|
|
*
|
|
|
|
* Public: No
|
|
|
|
*/
|
2015-03-13 00:04:10 +00:00
|
|
|
#include "script_component.hpp"
|
|
|
|
|
2015-03-14 16:46:10 +00:00
|
|
|
private ["_mapCtrl","_mapScale"];
|
2015-03-13 04:35:45 +00:00
|
|
|
|
2015-03-14 16:46:10 +00:00
|
|
|
_mapCtrl = ((findDisplay 12) displayCtrl 51);
|
|
|
|
_mapScale = ctrlMapScale _mapCtrl;
|
2015-03-13 04:35:45 +00:00
|
|
|
|
2015-03-14 16:46:10 +00:00
|
|
|
if (GVAR(mapIllumination)) then {
|
|
|
|
private ["_data","_darkenFill"];
|
2015-03-13 00:04:10 +00:00
|
|
|
|
2015-03-14 16:46:10 +00:00
|
|
|
// Calculate map illumination
|
|
|
|
_data = [[ACE_player], FUNC(determineMapLight), missionNamespace, QGVAR(mapLight), 0.1] call EFUNC(common,cachedCall);
|
2015-03-13 00:04:10 +00:00
|
|
|
|
2015-03-14 16:46:10 +00:00
|
|
|
EXPLODE_2_PVT(_data,_darkenMap,_darkenColor);
|
|
|
|
if (_darkenMap) then {
|
|
|
|
_darkenFill = format["#(rgb,1,1,1)color(%1,%2,%3,%4)",_darkenColor select 0, _darkenColor select 1, _darkenColor select 2, _darkenColor select 3];
|
|
|
|
_mapCtrl drawRectangle [(getArray(configFile >> 'CfgWorlds' >> worldName >> 'centerPosition')),80000,80000,0,_darkenColor,_darkenFill];
|
|
|
|
};
|
2015-03-13 00:04:10 +00:00
|
|
|
};
|
|
|
|
|
2015-03-14 16:46:10 +00:00
|
|
|
if (GVAR(mapShake)) then {
|
|
|
|
private ["_speed","_amplitude", "_time", "_shakePos"];
|
2015-03-13 00:04:10 +00:00
|
|
|
|
2015-03-14 16:46:10 +00:00
|
|
|
// Only shake map while moving on foot
|
|
|
|
_speed = 0;
|
|
|
|
if (vehicle ACE_player == ACE_player) then {
|
|
|
|
_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
|
|
|
|
2015-03-14 16:46:10 +00:00
|
|
|
_amplitude = (_speed - 0.1) / 5 * (1000 * _mapScale);
|
|
|
|
_time = 0.1;
|
2015-03-13 00:04:10 +00:00
|
|
|
|
2015-05-21 16:42:44 +00:00
|
|
|
_shakePos = [(GVAR(lastStillPosition) select 0) + sin((ACE_time + _time - GVAR(lastStillTime))*100) * _amplitude * 0.25,
|
|
|
|
(GVAR(lastStillPosition) select 1) + sin((ACE_time + _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
|
|
|
|
_mapCtrl ctrlMapAnimAdd [0, _mapScale, GVAR(lastStillPosition)];
|
|
|
|
ctrlMapAnimCommit _mapCtrl;
|
|
|
|
GVAR(isShaking) = false;
|
|
|
|
} else {
|
|
|
|
// The map is still, store state
|
|
|
|
ctrlMapAnimClear _mapCtrl;
|
|
|
|
GVAR(lastStillPosition) = _mapCtrl ctrlMapScreenToWorld [0.5, 0.5];
|
2015-05-21 16:42:44 +00:00
|
|
|
GVAR(lastStillTime) = ACE_time;
|
2015-03-14 16:46:10 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
if (GVAR(mapLimitZoom)) then {
|
|
|
|
if (GVAR(minMapSize) >= _mapScale) then {
|
|
|
|
ctrlMapAnimClear _mapCtrl;
|
|
|
|
_mapCtrl ctrlMapAnimAdd [0, GVAR(minMapSize) + 0.001, (_mapCtrl ctrlMapScreenToWorld [0.5, 0.5])];
|
|
|
|
ctrlMapAnimCommit _mapCtrl;
|
2015-03-13 00:04:10 +00:00
|
|
|
};
|
|
|
|
};
|