ACE3/addons/map/functions/fnc_updateMapEffects.sqf
Dedmen Miller e2ac18a05d [WIP] Fix script errors reporting wrong line numbers (#6407)
* advanced_ballistics

* advanced_fatigue

* advanced_throwing

* ai

* aircraft

* arsenal

* atragmx

* attach

* backpacks

* ballistics

* captives

* cargo

* chemlights

* common

* concertina_wire

* cookoff

* dagr

* disarming

* disposable

* dogtags

* dragging

* explosives

* fastroping

* fcs

* finger

* frag

* gestures

* gforces

* goggles

* grenades

* gunbag

* hearing

* hitreactions

* huntir

* interact_menu

* interaction

* inventory

* kestrel4500

* laser

* laserpointer

* logistics_uavbattery

* logistics_wirecutter

* magazinerepack

* map

* map_gestures

* maptools

* markers

* medical

* medical_ai

* medical_blood

* medical_menu

* microdagr

* minedetector

* missileguidance

* missionmodules

* mk6mortar

* modules

* movement

* nametags

* nightvision

* nlaw

* optics

* optionsmenu

* overheating

* overpressure

* parachute

* pylons

* quickmount

* rangecard

* rearm

* recoil

* refuel

* reload

* reloadlaunchers

* repair

* respawn

* safemode

* sandbag

* scopes

* slideshow

* spectator

* spottingscope

* switchunits

* tacticalladder

* tagging

* trenches

* tripod

* ui

* vector

* vehiclelock

* vehicles

* viewdistance

* weaponselect

* weather

* winddeflection

* yardage450

* zeus

* arsenal defines.hpp

* optionals

* DEBUG_MODE_FULL 1

* DEBUG_MODE_FULL 2

* Manual fixes

* Add SQF Validator check for #include after block comment

* explosives fnc_openTimerUI

* fix uniqueItems
2018-09-17 14:19:29 -05:00

78 lines
2.3 KiB
Plaintext

#include "script_component.hpp"
/*
* Author: Rocko and esteldunedain
* On map draw, updates the effects
*
* Arguments:
* None
*
* Return Value:
* None
*
* Example:
* call ACE_map_fnc_updateMapEffects
*
* Public: No
*/
params ["_mapCtrl"];
private _mapScale = ctrlMapScale _mapCtrl;
private _mapCentre = _mapCtrl ctrlMapScreenToWorld [0.5, 0.5];
if (GVAR(mapIllumination)) then {
//get nearby lighting
private _light = [[ACE_player], FUNC(determineMapLight), missionNamespace, QGVAR(mapLight), 0.1] call EFUNC(common,cachedCall);
_light params ["_applyLighting", "_lightLevel"];
if (_applyLighting) then {
[_mapCtrl, _mapScale, _mapCentre, _lightLevel] call FUNC(simulateMapLight);
};
};
if (GVAR(mapShake)) then {
// Only shake map while moving on foot
private _speed = 0;
if ((alive ACE_player) && {vehicle ACE_player == ACE_player}) then {
_speed = vectorMagnitude (velocity ACE_player);
};
// If speed is large enough, create anims to shake map
if (_speed > 0.1) then {
if (ctrlMapAnimDone _mapCtrl) then {
private _amplitude = (_speed - 0.1) / 5 * (1000 * _mapScale);
private _time = 0.1;
private _shakePos = [(GVAR(lastStillPosition) select 0) + sin((CBA_missionTime + _time - GVAR(lastStillTime))*100) * _amplitude * 0.25,
(GVAR(lastStillPosition) select 1) + sin((CBA_missionTime + _time - GVAR(lastStillTime))*260) * _amplitude];
_mapCtrl ctrlMapAnimAdd [_time, _mapScale, _shakePos];
ctrlMapAnimCommit _mapCtrl;
GVAR(isShaking) = true;
};
} else {
if (GVAR(isShaking)) then {
// Stop shaking, return to original position
ctrlMapAnimClear _mapCtrl;
_mapCtrl ctrlMapAnimAdd [0, _mapScale, GVAR(lastStillPosition)];
ctrlMapAnimCommit _mapCtrl;
GVAR(isShaking) = false;
} else {
// The map is still, store state
GVAR(lastStillPosition) = _mapCentre;
GVAR(lastStillTime) = CBA_missionTime;
};
};
};
if (GVAR(mapLimitZoom)) then {
if (GVAR(minMapSize) >= _mapScale) then {
ctrlMapAnimClear _mapCtrl;
_mapCtrl ctrlMapAnimAdd [0, GVAR(minMapSize) + 0.001, _mapCentre];
ctrlMapAnimCommit _mapCtrl;
};
};