mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Map - Fix effects breaking mid mission (#6566)
* fix map effects breaking mid mission * avoid magic numbers * params a function * XEH DisplayLoad instead of dummy display * formatting, parentheses * fix a thing * skip effects in briefing
This commit is contained in:
parent
001942b2ed
commit
d842e0ad58
@ -17,3 +17,9 @@ class Extended_PostInit_EventHandlers {
|
||||
serverInit = QUOTE(call COMPILE_FILE(XEH_postInitServer));
|
||||
};
|
||||
};
|
||||
|
||||
class Extended_DisplayLoad_EventHandlers {
|
||||
class RscDiary {
|
||||
GVAR(initMainMap) = QUOTE((_this select 0) call (uiNamespace getVariable 'FUNC(initMainMap)'));
|
||||
};
|
||||
};
|
||||
|
@ -11,3 +11,4 @@ PREP(onDrawMap);
|
||||
PREP(simulateMapLight);
|
||||
PREP(switchFlashlight);
|
||||
PREP(updateMapEffects);
|
||||
PREP(initMainMap);
|
||||
|
@ -8,52 +8,6 @@ LOG(MSG_INIT);
|
||||
// Calculate the maximum zoom allowed for this map
|
||||
call FUNC(determineZoom);
|
||||
|
||||
[{
|
||||
if (isNull findDisplay 12) exitWith {};
|
||||
|
||||
GVAR(lastStillPosition) = ((findDisplay 12) displayCtrl 51) ctrlMapScreenToWorld [0.5, 0.5];
|
||||
GVAR(lastStillTime) = CBA_missionTime;
|
||||
GVAR(isShaking) = false;
|
||||
|
||||
//map sizes are multiples of 1280
|
||||
GVAR(worldSize) = worldSize / 1280;
|
||||
GVAR(mousePos) = [0.5,0.5];
|
||||
|
||||
//Allow panning the lastStillPosition while mapShake is active
|
||||
GVAR(rightMouseButtonLastPos) = [];
|
||||
((findDisplay 12) displayCtrl 51) ctrlAddEventHandler ["Draw", {_this call FUNC(updateMapEffects)}];
|
||||
((findDisplay 12) displayCtrl 51) ctrlAddEventHandler ["MouseMoving", {
|
||||
if (GVAR(isShaking) && {(count GVAR(rightMouseButtonLastPos)) == 2}) then {
|
||||
private _lastPos = (_this select 0) ctrlMapScreenToWorld GVAR(rightMouseButtonLastPos);
|
||||
private _newPos = (_this select 0) ctrlMapScreenToWorld (_this select [1,2]);
|
||||
GVAR(lastStillPosition) set [0, (GVAR(lastStillPosition) select 0) + (_lastPos select 0) - (_newPos select 0)];
|
||||
GVAR(lastStillPosition) set [1, (GVAR(lastStillPosition) select 1) + (_lastPos select 1) - (_newPos select 1)];
|
||||
GVAR(rightMouseButtonLastPos) = _this select [1,2];
|
||||
TRACE_3("Mouse Move",_lastPos,_newPos,GVAR(rightMouseButtonLastPos));
|
||||
};
|
||||
}];
|
||||
((findDisplay 12) displayCtrl 51) ctrlAddEventHandler ["MouseButtonDown", {
|
||||
if ((_this select 1) == 1) then {
|
||||
GVAR(rightMouseButtonLastPos) = _this select [2,2];
|
||||
};
|
||||
}];
|
||||
((findDisplay 12) displayCtrl 51) ctrlAddEventHandler ["MouseButtonUp", {
|
||||
if ((_this select 1) == 1) then {
|
||||
GVAR(rightMouseButtonLastPos) = [];
|
||||
};
|
||||
}];
|
||||
|
||||
//get mouse position on map
|
||||
((findDisplay 12) displayCtrl 51) ctrlAddEventHandler ["MouseMoving", {
|
||||
GVAR(mousePos) = (_this select 0) ctrlMapScreenToWorld [_this select 1, _this select 2];
|
||||
}];
|
||||
((findDisplay 12) displayCtrl 51) ctrlAddEventHandler ["MouseHolding", {
|
||||
GVAR(mousePos) = (_this select 0) ctrlMapScreenToWorld [_this select 1, _this select 2];
|
||||
}];
|
||||
|
||||
[_this select 1] call CBA_fnc_removePerFrameHandler;
|
||||
}, 0] call CBA_fnc_addPerFrameHandler;
|
||||
|
||||
["ace_settingsInitialized", {
|
||||
if (isMultiplayer && {GVAR(DefaultChannel) != -1}) then {
|
||||
//Set the chat channel once the map has finished loading
|
||||
|
56
addons/map/functions/fnc_initMainMap.sqf
Normal file
56
addons/map/functions/fnc_initMainMap.sqf
Normal file
@ -0,0 +1,56 @@
|
||||
#include "script_component.hpp"
|
||||
#include "\a3\ui_f\hpp\defineResincl.inc"
|
||||
|
||||
params ["_display"];
|
||||
if (ctrlIDD _display != IDD_MAIN_MAP) exitWith {};
|
||||
|
||||
private _control = _display displayCtrl IDC_MAP;
|
||||
|
||||
GVAR(lastStillPosition) = _control ctrlMapScreenToWorld [0.5, 0.5];
|
||||
GVAR(lastStillTime) = CBA_missionTime;
|
||||
GVAR(isShaking) = false;
|
||||
|
||||
//map sizes are multiples of 1280
|
||||
GVAR(worldSize) = worldSize / 1280;
|
||||
GVAR(mousePos) = [0.5, 0.5];
|
||||
|
||||
//Allow panning the lastStillPosition while mapShake is active
|
||||
GVAR(rightMouseButtonLastPos) = [];
|
||||
|
||||
_control ctrlAddEventHandler ["Draw", {_this call FUNC(updateMapEffects)}];
|
||||
_control ctrlAddEventHandler ["MouseMoving", {
|
||||
params ["_control", "_x", "_y"];
|
||||
if (GVAR(isShaking) && {count GVAR(rightMouseButtonLastPos) == 2}) then {
|
||||
private _lastPos = _control ctrlMapScreenToWorld GVAR(rightMouseButtonLastPos);
|
||||
private _newPos = _control ctrlMapScreenToWorld [_x, _y];
|
||||
GVAR(lastStillPosition) set [0, (GVAR(lastStillPosition) select 0) + (_lastPos select 0) - (_newPos select 0)];
|
||||
GVAR(lastStillPosition) set [1, (GVAR(lastStillPosition) select 1) + (_lastPos select 1) - (_newPos select 1)];
|
||||
GVAR(rightMouseButtonLastPos) = [_x, _y];
|
||||
TRACE_3("Mouse Move",_lastPos,_newPos,GVAR(rightMouseButtonLastPos));
|
||||
};
|
||||
}];
|
||||
|
||||
_control ctrlAddEventHandler ["MouseButtonDown", {
|
||||
params ["", "_button", "_x", "_y"];
|
||||
if (_button == 1) then {
|
||||
GVAR(rightMouseButtonLastPos) = [_x, _y];
|
||||
};
|
||||
}];
|
||||
|
||||
_control ctrlAddEventHandler ["MouseButtonUp", {
|
||||
params ["", "_button"];
|
||||
if (_button == 1) then {
|
||||
GVAR(rightMouseButtonLastPos) = [];
|
||||
};
|
||||
}];
|
||||
|
||||
//get mouse position on map
|
||||
_control ctrlAddEventHandler ["MouseMoving", {
|
||||
params ["_control", "_x", "_y"];
|
||||
GVAR(mousePos) = _control ctrlMapScreenToWorld [_x, _y];
|
||||
}];
|
||||
|
||||
_control ctrlAddEventHandler ["MouseHolding", {
|
||||
params ["_control", "_x", "_y"];
|
||||
GVAR(mousePos) = _control ctrlMapScreenToWorld [_x, _y];
|
||||
}];
|
@ -16,7 +16,6 @@
|
||||
|
||||
#include "\z\ace\addons\main\script_macros.hpp"
|
||||
|
||||
|
||||
#define MARKERNAME_MAPTOOL_FIXED "ACE_MapToolFixed"
|
||||
#define MARKERNAME_MAPTOOL_ROTATINGNORMAL "ACE_MapToolRotatingNormal"
|
||||
#define MARKERNAME_MAPTOOL_ROTATINGSMALL "ACE_MapToolRotatingSmall"
|
||||
|
Loading…
Reference in New Issue
Block a user