-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updating event handler logic, adding remove view camera
- Loading branch information
Showing
20 changed files
with
308 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#include "..\functions.h" | ||
|
||
/* | ||
Author: [SA] Duda | ||
Description: | ||
Add an event handler | ||
Parameter(s): | ||
_this select 0: STRING - Event handler type ("MAIN_DISPLAY","MAP_DISPLAY","MAP_CONTROL") | ||
_this select 1: STRING - Event type (e.g. "KeyDown") | ||
_this select 2: STRING - Event script | ||
Returns: | ||
NUMBER - Event handler id | ||
*/ | ||
|
||
params ["_handlerType","_eventType","_eventScript"]; | ||
|
||
waitUntil {!isNull AIC_MAP_CONTROL && !isNull AIC_MAIN_DISPLAY && !isNull AIC_MAP_DISPLAY}; | ||
|
||
private _eventId = -1; | ||
if(_handlerType == "MAIN_DISPLAY") then { | ||
_eventId = AIC_MAIN_DISPLAY displayAddEventHandler [_eventType, _eventScript + "; false"]; | ||
}; | ||
if(_handlerType == "MAP_DISPLAY") then { | ||
_eventId = AIC_MAP_DISPLAY displayAddEventHandler [_eventType, _eventScript+ "; false"]; | ||
}; | ||
if(_handlerType == "MAP_CONTROL") then { | ||
_eventId = AIC_MAP_CONTROL ctrlAddEventHandler [_eventType, _eventScript+ "; false"]; | ||
}; | ||
_eventId; | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
33 changes: 33 additions & 0 deletions
33
AICommand/functions/eventHandler/fn_addManagedEventHandler.sqf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#include "..\functions.h" | ||
|
||
/* | ||
Author: [SA] Duda | ||
Description: | ||
Add a managed event handler (will ensure that it doesn't get disabled by other addons) | ||
Parameter(s): | ||
_this select 0: STRING - Event handler type ("MAIN_DISPLAY","MAP_DISPLAY","MAP_CONTROL") | ||
_this select 1: STRING - Event type (e.g. "KeyDown") | ||
_this select 2: STRING - Event script | ||
Returns: | ||
Nothing | ||
*/ | ||
|
||
if(isDedicated || !hasInterface) exitWith {}; | ||
|
||
params ["_handlerType","_eventType","_eventScript"]; | ||
waitUntil {!isNull AIC_MAP_CONTROL && !isNull AIC_MAIN_DISPLAY && !isNull AIC_MAP_DISPLAY}; | ||
private _eventHandlers = AIC_fnc_getEventHandlers(); | ||
private _eventHandlerId = _this call AIC_fnc_addEventHandler; | ||
_eventHandlers pushBack [_eventHandlerId,_this]; | ||
AIC_fnc_setEventHandlers(_eventHandlers); | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
34 changes: 34 additions & 0 deletions
34
AICommand/functions/eventHandler/fn_eventHandlerManager.sqf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#include "..\functions.h" | ||
|
||
/* | ||
Author: [SA] Duda | ||
Description: | ||
Event handler manager. Takes care of making sure other addons don't take over control of the event handlers. | ||
Parameter(s): | ||
Nothing | ||
Returns: | ||
Nothing | ||
*/ | ||
|
||
if(isDedicated || !hasInterface) exitWith {}; | ||
|
||
[] spawn { | ||
waitUntil {!isNull AIC_MAP_CONTROL && !isNull AIC_MAIN_DISPLAY && !isNull AIC_MAP_DISPLAY}; | ||
sleep 60; | ||
while {true} do { | ||
_eventHandlers = AIC_fnc_getEventHandlers(); | ||
_index = 0; | ||
{ | ||
_x params ["_eventHandlerId","_handlerParams"]; | ||
_handlerParams params ["_handlerType","_eventType","_eventScript"]; | ||
[_handlerType, _eventType, _eventHandlerId] call AIC_fnc_removeEventHandler; | ||
_eventHandlerId = _handlerParams call AIC_fnc_addEventHandler; | ||
_eventHandlers set [_index,[_eventHandlerId,_handlerParams]]; | ||
_index = _index + 1; | ||
} forEach _eventHandlers; | ||
sleep (5 * 60); | ||
}; | ||
}; |
32 changes: 32 additions & 0 deletions
32
AICommand/functions/eventHandler/fn_removeEventHandler.sqf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#include "..\functions.h" | ||
|
||
/* | ||
Author: [SA] Duda | ||
Description: | ||
Remove an event handler | ||
Parameter(s): | ||
_this select 0: STRING - Event handler type ("MAIN_DISPLAY","MAP_DISPLAY","MAP_CONTROL") | ||
_this select 1: STRING - Event type (e.g. "KeyDown") | ||
_this select 2: NUMBER - Event handler id | ||
Returns: | ||
Nothing | ||
*/ | ||
|
||
params ["_handlerType","_eventType","_eventHandlerId"]; | ||
|
||
waitUntil {!isNull AIC_MAP_CONTROL && !isNull AIC_MAIN_DISPLAY && !isNull AIC_MAP_DISPLAY}; | ||
|
||
if(_eventHandlerId >= 0) then { | ||
if(_handlerType == "MAIN_DISPLAY") then { | ||
AIC_MAIN_DISPLAY displayRemoveEventHandler [_eventType, _eventHandlerId]; | ||
}; | ||
if(_handlerType == "MAP_DISPLAY") then { | ||
AIC_MAP_DISPLAY displayRemoveEventHandler [_eventType, _eventHandlerId]; | ||
}; | ||
if(_handlerType == "MAP_CONTROL") then { | ||
AIC_MAP_CONTROL ctrlRemoveEventHandler [_eventType, _eventHandlerId]; | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
|
||
#define AIC_fnc_getEventHandlers() missionNamespace getVariable ["AIC_Event_Handlers",[]] | ||
#define AIC_fnc_setEventHandlers(_eventHandlers) missionNamespace setVariable ["AIC_Event_Handlers",(_eventHandlers)] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
AICommand/functions/remoteCamera/fn_cameraMouseMoveHandler.sqf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#include "..\functions.h" | ||
private ["_cam","_distance","_target"]; | ||
AIC_3rd_Person_Camera_X_Move_Total = AIC_FNC_CAMERA_X_TOTAL + (-(_this select 1)*0.16); | ||
AIC_3rd_Person_Camera_Y_Move_Total = AIC_FNC_CAMERA_Y_TOTAL + (-(_this select 2)*0.16); | ||
AIC_3rd_Person_Camera_Y_Move_Total = AIC_FNC_CAMERA_Y_TOTAL max 20 min 160; | ||
[] spawn AIC_fnc_cameraUpdatePosition; |
Oops, something went wrong.