Tab to space plus comments for the spawns

This commit is contained in:
Nicolás Badano 2015-03-14 17:15:28 -03:00
parent 5b74f99f10
commit 618c021f7e
2 changed files with 44 additions and 41 deletions

View File

@ -6,6 +6,8 @@ LOG(MSG_INIT);
// Calculate the maximum zoom allowed for this map
call FUNC(determineZoom);
// This spawn is probably worth keeping, as pfh don't work natively on the briefing screen and IDK how reliable the hack we implemented for them is.
// The thread dies as soon as the mission start, so it's not really compiting for scheduler space.
[] spawn {
// Wait until the map display is detected
waitUntil {(!isNull findDisplay 12)};

View File

@ -20,51 +20,52 @@ GVAR(drawing_lineMarkers) = [];
GVAR(drawing_drawColor) = "ColorBlack";
GVAR(drawing_controls) = [36732, 36733, 36734, 36735, 36736, 36737];
// This spawn is probably worth keeping, as pfh don't work natively on the briefing screen and IDK how reliable the hack we implemented for them is.
// The thread dies as soon as the mission start, so it's not really compiting for scheduler space.
[] spawn {
_fnc_installMapEvents = {
_d = _this;
diag_log format ["Installing EH in display %1", _d];
((finddisplay _d) displayctrl 51) ctrlAddEventHandler ["MouseMoving", {_this call FUNC(handleMouseMove);}];
((finddisplay _d) displayctrl 51) ctrlAddEventHandler ["MouseButtonDown", {[1, _this] call FUNC(handleMouseButton);}];
((finddisplay _d) displayctrl 51) ctrlAddEventHandler ["MouseButtonUp", {[0, _this] call FUNC(handleMouseButton)}];
((finddisplay _d) displayctrl 51) ctrlAddEventHandler ["Draw", {[] call FUNC(updateMapToolMarkers);}];
(finddisplay _d) displayAddEventHandler ["KeyDown", {_this call FUNC(handleKeyDown);}];
};
_fnc_installMapEvents = {
_d = _this;
((finddisplay _d) displayctrl 51) ctrlAddEventHandler ["MouseMoving", {_this call FUNC(handleMouseMove);}];
((finddisplay _d) displayctrl 51) ctrlAddEventHandler ["MouseButtonDown", {[1, _this] call FUNC(handleMouseButton);}];
((finddisplay _d) displayctrl 51) ctrlAddEventHandler ["MouseButtonUp", {[0, _this] call FUNC(handleMouseButton)}];
((finddisplay _d) displayctrl 51) ctrlAddEventHandler ["Draw", {[] call FUNC(updateMapToolMarkers);}];
(finddisplay _d) displayAddEventHandler ["KeyDown", {_this call FUNC(handleKeyDown);}];
};
// Wait until the briefing map is detected
// display = 37 for SP
// display = 52 for host server on MP;
// display = 53 for MP clients)
waitUntil {(!isNull findDisplay 37) || (!isNull findDisplay 52) || (!isNull findDisplay 53) || (!isNull findDisplay 12)};
// Wait until the briefing map is detected
// display = 37 for SP
// display = 52 for host server on MP;
// display = 53 for MP clients)
waitUntil {(!isNull findDisplay 37) || (!isNull findDisplay 52) || (!isNull findDisplay 53) || (!isNull findDisplay 12)};
if (isNull findDisplay 12) then {
// Install event handlers on the map control of the briefing screen (control = 51)
GVAR(drawing_syncMarkers) = true;
if (!isNull findDisplay 52) then {
52 call _fnc_installMapEvents;
} else {
if (!isNull findDisplay 53) then {
53 call _fnc_installMapEvents;
} else {
37 call _fnc_installMapEvents;
};
};
} else {
// Briefing screen was skipped; the player is JIP, create the markers defined during the briefing
GVAR(drawing_syncMarkers) = false;
{
_x call FUNC(addLineMarker);
} forEach GVAR(drawing_serverLineMarkers);
};
if (isNull findDisplay 12) then {
// Install event handlers on the map control of the briefing screen (control = 51)
GVAR(drawing_syncMarkers) = true;
if (!isNull findDisplay 52) then {
52 call _fnc_installMapEvents;
} else {
if (!isNull findDisplay 53) then {
53 call _fnc_installMapEvents;
} else {
37 call _fnc_installMapEvents;
};
};
} else {
// Briefing screen was skipped; the player is JIP, create the markers defined during the briefing
GVAR(drawing_syncMarkers) = false;
{
_x call FUNC(addLineMarker);
} forEach GVAR(drawing_serverLineMarkers);
};
// Wait until the main map display is detected (display = 12)
waitUntil { !isNull findDisplay 12 };
// Install event handlers on the map control and display (control = 51)
GVAR(drawing_syncMarkers) = false;
12 call _fnc_installMapEvents;
// Wait until the main map display is detected (display = 12)
waitUntil { !isNull findDisplay 12 };
// Install event handlers on the map control and display (control = 51)
GVAR(drawing_syncMarkers) = false;
12 call _fnc_installMapEvents;
// Update the size and rotation of map tools
[] call FUNC(updateMapToolMarkers);
// Update the size and rotation of map tools
[] call FUNC(updateMapToolMarkers);
[FUNC(mapStateUpdater), 0, []] call CBA_fnc_addPerFrameHandler;
[FUNC(mapStateUpdater), 0, []] call CBA_fnc_addPerFrameHandler;
};