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

Add Camera Flashlight #306

Merged
merged 4 commits into from
Feb 23, 2020
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
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ Special thanks to the [ACE3 Team](http://ace3mod.com/team.html) for their open s
- Vehicle customization garage made specifically for Zeus.
- Various bug fixes and quality of life improvements to the Zeus interface.
- Settings to control Zeus camera properties such as speed and available vision modes.
- Zeus camera flashlight for easier editing at night.
- New waypoint types such as paradrop available through Zeus.

## Contributing
Expand Down
1 change: 1 addition & 0 deletions addons/flashlight/$PBOPREFIX$
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
x\zen\addons\flashlight
17 changes: 17 additions & 0 deletions addons/flashlight/CfgEventHandlers.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
class Extended_PreStart_EventHandlers {
class ADDON {
init = QUOTE(call COMPILE_FILE(XEH_preStart));
};
};

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

class Extended_PostInit_EventHandlers {
class ADDON {
init = QUOTE(call COMPILE_FILE(XEH_postInit));
};
};
1 change: 1 addition & 0 deletions addons/flashlight/XEH_PREP.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
PREP(toggle);
13 changes: 13 additions & 0 deletions addons/flashlight/XEH_postInit.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#include "script_component.hpp"

["ZEN_displayCuratorLoad", {
{
if (GVAR(state)) then {
[true] call FUNC(toggle);
};
} call CBA_fnc_execNextFrame;
}] call CBA_fnc_addEventHandler;

["ZEN_displayCuratorUnload", {
[false] call FUNC(toggle);
}] call CBA_fnc_addEventHandler;
14 changes: 14 additions & 0 deletions addons/flashlight/XEH_preInit.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#include "script_component.hpp"

ADDON = false;

PREP_RECOMPILE_START;
#include "XEH_PREP.hpp"
PREP_RECOMPILE_END;

#include "initKeybinds.sqf"

GVAR(state) = false;
GVAR(light) = objNull;

ADDON = true;
3 changes: 3 additions & 0 deletions addons/flashlight/XEH_preStart.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#include "script_component.hpp"

#include "XEH_PREP.hpp"
17 changes: 17 additions & 0 deletions addons/flashlight/config.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#include "script_component.hpp"

class CfgPatches {
class ADDON {
name = COMPONENT_NAME;
units[] = {};
weapons[] = {};
requiredVersion = REQUIRED_VERSION;
requiredAddons[] = {"zen_common"};
author = ECSTRING(main,Author);
authors[] = {"mharis001"};
url = ECSTRING(main,URL);
VERSION_CONFIG;
};
};

#include "CfgEventHandlers.hpp"
28 changes: 28 additions & 0 deletions addons/flashlight/functions/fnc_toggle.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#include "script_component.hpp"
/*
* Author: mharis001
* Toggles the state of the Zeus camera flashlight.
*
* Arguments:
* 0: State <BOOL>
*
* Return Value:
* None
*
* Example:
* [true] call zen_flashlight_fnc_toggle
*
* Public: No
*/

params ["_state"];

if (_state) then {
GVAR(light) = "#lightpoint" createVehicleLocal [0, 0, 0];
GVAR(light) setLightBrightness LIGHT_INTENSITY;
GVAR(light) setLightAmbient [1, 1, 1];
GVAR(light) setLightColor [0, 0, 0];
GVAR(light) lightAttachObject [curatorCamera, [0, 0, -7 * LIGHT_INTENSITY]];
} else {
deleteVehicle GVAR(light);
};
1 change: 1 addition & 0 deletions addons/flashlight/functions/script_component.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#include "\x\zen\addons\flashlight\script_component.hpp"
8 changes: 8 additions & 0 deletions addons/flashlight/initKeybinds.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[ELSTRING(common,Category), QGVAR(toggle), [LSTRING(Toggle), LSTRING(Toggle_Description)], {
if (!isNull curatorCamera && {!GETMVAR(RscDisplayCurator_search,false)}) then {
GVAR(state) = !GVAR(state);
GVAR(state) call FUNC(toggle);

true // handled
};
}, {}, [DIK_L, [false, false, false]]] call CBA_fnc_addKeybind; // Default: L
21 changes: 21 additions & 0 deletions addons/flashlight/script_component.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#define COMPONENT flashlight
#define COMPONENT_BEAUTIFIED Flashlight
#include "\x\zen\addons\main\script_mod.hpp"

// #define DEBUG_MODE_FULL
// #define DISABLE_COMPILE_CACHE
// #define ENABLE_PERFORMANCE_COUNTERS

#ifdef DEBUG_ENABLED_FLASHLIGHT
#define DEBUG_MODE_FULL
#endif

#ifdef DEBUG_SETTINGS_FLASHLIGHT
#define DEBUG_SETTINGS DEBUG_SETTINGS_FLASHLIGHT
#endif

#include "\x\zen\addons\main\script_macros.hpp"

#include "\a3\ui_f\hpp\defineDIKCodes.inc"

#define LIGHT_INTENSITY 20
11 changes: 11 additions & 0 deletions addons/flashlight/stringtable.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<Project name="ZEN">
<Package name="Flashlight">
<Key ID="STR_ZEN_Flashlight_Toggle">
<English>Toggle Flashlight</English>
</Key>
<Key ID="STR_ZEN_Flashlight_Toggle_Description">
<English>Toggles the state of the Zeus camera flashlight.</English>
</Key>
</Package>
</Project>
1 change: 1 addition & 0 deletions docs/home.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,5 @@ Special thanks to the [ACE3 Team](http://ace3mod.com/team.html) for their open s
- Vehicle customization garage made specifically for Zeus.
- Various bug fixes and quality of life improvements to the Zeus interface.
- Settings to control Zeus camera properties such as speed and available vision modes.
- Zeus camera flashlight for easier editing at night.
- New waypoint types such as paradrop available through Zeus.