-
Notifications
You must be signed in to change notification settings - Fork 740
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Map - Fix effects breaking mid mission #6566
Conversation
#include "script_component.hpp" | ||
|
||
params ["_display"]; | ||
private _control = _display displayCtrl 51; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
magic number
addons/map/config.cpp
Outdated
@@ -89,6 +89,11 @@ class RscDisplayMainMap { | |||
onDraw = QUOTE([ctrlParent (_this select 0)] call DFUNC(onDrawMap)); | |||
#include "MapTweaks.hpp" | |||
}; | |||
class InitScript: RscText { | |||
onLoad = QUOTE(ctrlParent (_this select 0) call (uiNamespace getVariable 'FUNC(initMainMap)')); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use Extended_DisplayLoad_EventHandlers
, AFAIK RscDisplayMainMap
uses BIS_fnc_initDisplay
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
True. It's called RscDiary
there however, so I should filter all idd != 12 (IDD_MAIN_MAP
) though.
|
||
//get mouse position on map | ||
_control ctrlAddEventHandler ["MouseMoving", { | ||
GVAR(mousePos) = (_this select 0) ctrlMapScreenToWorld [_this select 1, _this select 2]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rather than 3x select
, use params
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
True. The orig didn't use it either, but could be updated.
GVAR(mousePos) = (_this select 0) ctrlMapScreenToWorld [_this select 1, _this select 2]; | ||
}]; | ||
_control ctrlAddEventHandler ["MouseHolding", { | ||
GVAR(mousePos) = (_this select 0) ctrlMapScreenToWorld [_this select 1, _this select 2]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above
…ACE3 into fix-map-effects-breaking
|
||
_control ctrlAddEventHandler ["Draw", {_this call FUNC(updateMapEffects)}]; | ||
_control ctrlAddEventHandler ["MouseMoving", { | ||
params ["_control", "_x", "_y"]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could move inside the if
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't think that's worth it, tbh.
addons/map/CfgEventHandlers.hpp
Outdated
|
||
class Extended_DisplayLoad_EventHandlers { | ||
class RscDiary { | ||
GVAR(initMainMap) = QUOTE(ctrlParent (_this select 0) call (uiNamespace getVariable 'FUNC(initMainMap)')); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Error in expression <ctrlParent (_this select 0) call (uiName>
Error position: <ctrlParent (_this select 0) call (uiName>
Error ctrlparent: Type Display (dialog), expected Control
* 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
When merged this pull request will:
The map effects are only applied once, but if the map display is destroyed mid mission (loaded savegame, respawn etc.) the effects are never added again.