Skip to content
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

CBA events rewrite #284

Merged
merged 5 commits into from
Mar 5, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions addons/common/XEH_postInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,7 @@ FUNC(initPerFrameHandlers) = {
};

// Run the per frame handler init code, bringing up the hidden map control
if (_oldPFH && {!CBA_MISSION_START}) then {
["CBA_MISSION_START", { _oldPFH call FUNC(initPerFrameHandlers) }] call CBA_fnc_addEventHandler;
} else {
_oldPFH call FUNC(initPerFrameHandlers);
};
_oldPFH call FUNC(initPerFrameHandlers);

// TODO: Consider a waitUntil loop with tickTime check to wait for some frames as opposed to trying to sleep until time > 0. Re MP Briefings etc.
/*
Expand Down
26 changes: 7 additions & 19 deletions addons/events/CfgEventHandlers.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,29 +5,17 @@ class Extended_PreStart_EventHandlers {
};
};

class Extended_PreInit_EventHandlers
{
class ADDON
{
class Extended_PreInit_EventHandlers {
class ADDON {
init = QUOTE(call COMPILE_FILE(XEH_preInit));
clientInit = QUOTE(call COMPILE_FILE(XEH_preClientInit));
};
};

/*
class Extended_Hit_EventHandlers
{
class All
{
GVAR(hit) = QUOTE(_this call FUNC(globalHitEvent));
class Extended_DisplayLoad_EventHandlers {
class RscDisplayMission {
ADDON = QUOTE(_this call COMPILE_FILE(XEH_missionDisplayLoad));
};
};

class Extended_Killed_EventHandlers
{
class All
{
GVAR(killed) = QUOTE(_this call FUNC(globalKilledEvent));
class RscDisplayCurator {
ADDON = QUOTE(_this call COMPILE_FILE(XEH_curatorDisplayLoad));
};
};
*/
150 changes: 39 additions & 111 deletions addons/events/CfgFunctions.hpp
Original file line number Diff line number Diff line change
@@ -1,135 +1,63 @@
// -----------------------------------------------------------------------------
// Automatically generated by 'functions_config.rb'
// DO NOT MANUALLY EDIT THIS FILE!
// -----------------------------------------------------------------------------

class CfgFunctions
{
class CBA
{
class Events
{
// CBA_fnc_addDisplayHandler
class addDisplayHandler
{
description = "Adds an action to a displayHandler";
class CfgFunctions {
class CBA {
class Events {
class addDisplayHandler {
description = "Adds an action to the main display.";
file = "\x\cba\addons\events\fnc_addDisplayHandler.sqf";
};
// CBA_fnc_addEventHandler
class addEventHandler
{
description = "Registers an event handler for a specific CBA event.";
file = "\x\cba\addons\events\fnc_addEventHandler.sqf";
class removeDisplayHandler {
description = "Removes an action from the main display.";
file = "\x\cba\addons\events\fnc_removeDisplayHandler.sqf";
};
// CBA_fnc_addKeyHandler
class addKeyHandler
{
description = "Adds an action to a keyhandler";
class addKeyHandler {
description = "Adds an action to a keybind.";
file = "\x\cba\addons\events\fnc_addKeyHandler.sqf";
};
// CBA_fnc_addKeyHandlerFromConfig
class addKeyHandlerFromConfig
{
description = "Adds an action to a keyhandler, read from config";
class addKeyHandlerFromConfig {
description = "Adds an action to a keybind from config.";
file = "\x\cba\addons\events\fnc_addKeyHandlerFromConfig.sqf";
};
// CBA_fnc_addLocalEventHandler
class addLocalEventHandler
{
description = "Registers an event handler for a specific CBA event which only runs where the first parameter (object) is local.";
file = "\x\cba\addons\events\fnc_addLocalEventHandler.sqf";
class readKeyFromConfig {
description = "Reads key setting from config.";
file = "\x\cba\addons\events\fnc_readKeyFromConfig.sqf";
};
// CBA_fnc_changeKeyHandler
class changeKeyHandler
{
description = "Changes an action to a keyhandler";
class changeKeyHandler {
description = "Changes the key of a key handler.";
file = "\x\cba\addons\events\fnc_changeKeyHandler.sqf";
};
// CBA_fnc_globalEvent
class globalEvent
{
description = "Raises a CBA event on all machines, including the local one.";
file = "\x\cba\addons\events\fnc_globalEvent.sqf";
};
// CBA_fnc_localEvent
class localEvent
{
description = "Raises a CBA event only on the local machine.";
file = "\x\cba\addons\events\fnc_localEvent.sqf";
};
// CBA_fnc_readKeyFromConfig
class readKeyFromConfig
{
description = "Reads key setting from config";
file = "\x\cba\addons\events\fnc_readKeyFromConfig.sqf";
};
// CBA_fnc_remoteEvent
class remoteEvent
{
description = "Raises a CBA event on all machines EXCEPT the local one.";
file = "\x\cba\addons\events\fnc_remoteEvent.sqf";
class removeKeyHandler {
description = "Removes an action from a keybind.";
file = "\x\cba\addons\events\fnc_removeKeyHandler.sqf";
};
// CBA_fnc_removeDisplayHandler
class removeDisplayHandler
{
description = "Removes an action to a displayHandler";
file = "\x\cba\addons\events\fnc_removeDisplayHandler.sqf";
class addEventHandler {
description = "Registers an event handler for a specific CBA event.";
file = "\x\cba\addons\events\fnc_addEventHandler.sqf";
};
// CBA_fnc_removeEventHandler
class removeEventHandler
{
class removeEventHandler {
description = "Removes an event handler previously registered with CBA_fnc_addEventHandler.";
file = "\x\cba\addons\events\fnc_removeEventHandler.sqf";
};
// CBA_fnc_removeKeyHandler
class removeKeyHandler
{
description = "Removes an action to a keyhandler";
file = "\x\cba\addons\events\fnc_removeKeyHandler.sqf";
};
// CBA_fnc_removeLocalEventHandler
class removeLocalEventHandler
{
description = "Removes an event handler previously registered with CBA_fnc_addLocalEventHandler.";
file = "\x\cba\addons\events\fnc_removeLocalEventHandler.sqf";
};
// CBA_fnc_whereLocalEvent
class whereLocalEvent
{
description = "Raises a CBA event only on the machine where parameter one is local.";
file = "\x\cba\addons\events\fnc_whereLocalEvent.sqf";
};
// CBA_fnc_addClientToServerEventhandler
class addClientToServerEventhandler {
description = "Registers an event handler for a client to server event which only runs on the server (thus is only needed on the server)";
file = "\x\cba\addons\events\fnc_addClientToServerEventhandler.sqf";
};
// CBA_fnc_clientToServerEvent
class clientToServerEvent {
description = "Raises an CBA event only on the server (only broadcasted to server and not to other clients)";
file = "\x\cba\addons\events\fnc_clientToServerEvent.sqf";
class localEvent {
description = "Raises a CBA event on the local machine.";
file = "\x\cba\addons\events\fnc_localEvent.sqf";
};
// CBA_fnc_removeClientToServerEvent
class removeClientToServerEvent {
description = "Removes client to server event";
file = "\x\cba\addons\events\fnc_removeClientToServerEvent.sqf";
class globalEvent {
description = "Raises a CBA event on all machines, including the local one.";
file = "\x\cba\addons\events\fnc_globalEvent.sqf";
};
// CBA_fnc_addReceiverOnlyEventhandler
class addReceiverOnlyEventhandler {
description = "Registers an event handler for an CBA event which is only broadcasted to the receiver (and no other clients)";
file = "\x\cba\addons\events\fnc_addReceiverOnlyEventhandler.sqf";
class serverEvent {
description = "Raises a CBA event on the server machine.";
file = "\x\cba\addons\events\fnc_serverEvent.sqf";
};
// CBA_fnc_receiverOnlyEvent
class receiverOnlyEvent {
description = "Raises an CBA event only on the receiver and is only broadcasted there";
file = "\x\cba\addons\events\fnc_receiverOnlyEvent.sqf";
class remoteEvent {
description = "Raises a CBA event on all machines, except the local one.";
file = "\x\cba\addons\events\fnc_remoteEvent.sqf";
};
// CBA_fnc_removeReceiverOnlyEvent
class removeReceiverOnlyEvent {
description = "Removes receiver only event";
file = "\x\cba\addons\events\fnc_removeReceiverOnlyEvent.sqf";
class targetEvent {
description = "Raises a CBA event on all machines where this object or at least one of these objects are local.";
file = "\x\cba\addons\events\fnc_targetEvent.sqf";
};

};
};
};
6 changes: 6 additions & 0 deletions addons/events/XEH_curatorDisplayLoad.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#include "script_component.hpp"

params ["_display"];

_display displayAddEventHandler ["KeyDown", {_this call FUNC(keyHandlerDown)}];
_display displayAddEventHandler ["KeyUp", {_this call FUNC(keyHandlerUp)}];
22 changes: 22 additions & 0 deletions addons/events/XEH_missionDisplayLoad.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#include "script_component.hpp"

params ["_display"];

uiNamespace setVariable ["CBA_missionDisplay", _display];

// re apply missions display event handlers when display is loaded (save game)
if (!isNil QGVAR(handlerHash)) then {
[GVAR(handlerHash), {
{
private _code = _x param [1];

if (!isNil "_code") then {
private _handler = _display displayAddEventHandler [_key, _code];
_x set [0, _handler];
};
} forEach _value;
}] call CBA_fnc_hashEachPair;

// copy hash reference to display namespace again, because it's not serialized in save games
_display setVariable [QGVAR(handlerHash), GVAR(handlerHash)];
};
101 changes: 0 additions & 101 deletions addons/events/XEH_preClientInit.sqf

This file was deleted.

Loading