Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Sniperhid committed Aug 29, 2016
0 parents commit 24a2f43
Show file tree
Hide file tree
Showing 24 changed files with 195 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/addons/*.pbo
/tools
/release
Binary file added Build.exe
Binary file not shown.
Binary file added SwiftPbo.dll
Binary file not shown.
1 change: 1 addition & 0 deletions addons/helicam/$PBOPREFIX$
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
x\tac1\addons\helicam
5 changes: 5 additions & 0 deletions addons/helicam/CfgEventHandlers.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class Extended_PostInit_EventHandlers {
class ADDON {
clientInit = QUOTE(call COMPILE_FILE(XEH_postInitClient) );
};
};
9 changes: 9 additions & 0 deletions addons/helicam/CfgFunctions.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
class CfgFunctions {
class ADDON {
class COMPONENT {
file = QPATHTO_FOLDER(functions);
class drawCompass;
class checkConditions;
};
};
};
6 changes: 6 additions & 0 deletions addons/helicam/XEH_postInitClient.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#include "script_component.hpp"

// Setup the event handlers
["vehicle", FUNC(checkConditions)] call CBA_fnc_addPlayerEventHandler;
["turret", FUNC(checkConditions)] call CBA_fnc_addPlayerEventHandler;
["unit", FUNC(checkConditions)] call CBA_fnc_addPlayerEventHandler;
19 changes: 19 additions & 0 deletions addons/helicam/config.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#include "script_component.hpp"

class cfgPatches
{
class ADDON
{
name = "Helicam Enhancement";
author = "Snippers";
url = "http://www.teamonetactical.com";
units[] = {};
weapons[] = {};
requiredVersion = REQUIRED_VERSION;
requiredAddons[] = {"tac1_main"};
VERSION_CONFIG;
};
};

#include "CfgFunctions.hpp"
#include "CfgEventHandlers.hpp"
Binary file added addons/helicam/data/E.paa
Binary file not shown.
Binary file added addons/helicam/data/E.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added addons/helicam/data/N.paa
Binary file not shown.
Binary file added addons/helicam/data/N.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added addons/helicam/data/S.paa
Binary file not shown.
Binary file added addons/helicam/data/S.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added addons/helicam/data/W.paa
Binary file not shown.
Binary file added addons/helicam/data/W.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 17 additions & 0 deletions addons/helicam/functions/fn_checkConditions.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#include "\x\tac1\addons\helicam\script_component.hpp"

params ["_playerUnit"];

if ((vehicle _playerUnit) isKindOf "RHS_MELB_base" && {gunner (vehicle _playerUnit) isEqualTo _playerUnit}) then {
private _index = missionNamespace getVariable [QGVAR(draw3dIndex),-1];
if (_index isEqualTo -1) then {
GVAR(draw3dIndex) = addMissionEventHandler ["Draw3D",{ _this call FUNC(drawCompass); }];
};

} else {
private _index = missionNamespace getVariable [QGVAR(draw3dIndex),-1];
if !(_index isEqualTo -1) then {
removeMissionEventHandler ["Draw3D",_index];
GVAR(draw3dIndex) = -1;
};
};
34 changes: 34 additions & 0 deletions addons/helicam/functions/fn_drawCompass.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#include "\x\tac1\addons\helicam\script_component.hpp"

// Credit KK for proof of concept: http://killzonekid.com/arma-scripting-tutorials-3d-compass/

// currentVisionMode <- for dinnerent thermals etc.

if (cameraView == "gunner") then {
// Draw Compass
private _scale = 0.1;
private _center = positionCameraToWorld [0,0,3];
private _asl = getTerrainHeightASL [_center select 0,_center select 1];
{
_x params ["_texture", "_colour", "_offset1", "_offset2","_offset3","_offset4"];
_offset1 = _center vectorAdd _offset1; _offset1 set [2, (_offset1 select 2) + _asl - getTerrainHeightASL [_offset1 select 0,_offset1 select 1]];
_offset2 = _center vectorAdd _offset2; _offset2 set [2, (_offset2 select 2) + _asl - getTerrainHeightASL [_offset2 select 0,_offset2 select 1]];
_offset3 = _center vectorAdd _offset3; _offset3 set [2, (_offset3 select 2) + _asl - getTerrainHeightASL [_offset3 select 0,_offset3 select 1]];
_offset4 = _center vectorAdd _offset4; _offset4 set [2, (_offset4 select 2) + _asl - getTerrainHeightASL [_offset4 select 0,_offset4 select 1]];

drawIcon3D [_texture,_colour,_offset1,0.75,0.75,0];
drawIcon3D ["\a3\ui_f\data\IGUI\Cfg\Cursors\iconcomplex_ca.paa",_colour,_offset2,2.5,2.5,0];
drawIcon3D ["\a3\ui_f\data\IGUI\Cfg\Cursors\iconcomplex_ca.paa",_colour,_offset3,2.5,2.5,0];
drawIcon3D ["\a3\ui_f\data\IGUI\Cfg\Cursors\iconcomplex_ca.paa",_colour,_offset4,2.5,2.5,0];
} forEach [
["\x\tac1\addons\helicam\data\N.paa",[1,1,1,0.9],[0,1*_scale,0],[0,0.25*_scale,0],[0,0.5*_scale,0],[0,0.75*_scale,0]],
["\x\tac1\addons\helicam\data\S.paa",[1,1,1,0.6],[0,-1*_scale,0],[0,-0.25*_scale,0],[0,-0.5*_scale,0],[0,-0.75*_scale,0]],
["\x\tac1\addons\helicam\data\E.paa",[1,1,1,0.6],[1*_scale,0,0],[0.25*_scale,0,0],[0.5*_scale,0,0],[0.75*_scale,0,0]],
["\x\tac1\addons\helicam\data\W.paa",[1,1,1,0.6],[-1*_scale,0,0],[-0.25*_scale,0,0],[-0.5*_scale,0,0],[-0.75*_scale,0,0]]
];
private _dir = direction (vehicle (call CBA_fnc_currentUnit));
private _vehicleOffset = _center vectorAdd [0.375*_scale*(sin _dir),0.375*_scale*(cos _dir),0];
_vehicleOffset set [2, (_vehicleOffset select 2) + _asl - getTerrainHeightASL [_vehicleOffset select 0,_vehicleOffset select 1]];
drawIcon3D ["\a3\ui_f\data\IGUI\Cfg\Cursors\iconcomplex_ca.paa",[0,1,0,0.6],_vehicleOffset,2.5,2.5,0];
};

5 changes: 5 additions & 0 deletions addons/helicam/script_component.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#define COMPONENT helicam

#include "\x\tac1\addons\main\script_mod.hpp"
#include "\x\tac1\addons\main\script_macros.hpp"

1 change: 1 addition & 0 deletions addons/main/$PBOPREFIX$
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
x\tac1\addons\main
15 changes: 15 additions & 0 deletions addons/main/config.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#include "script_component.hpp"

class cfgPatches {
class ADDON {
name = "1Tac Misc: Main";
author = "1Tac";
url = "http://www.teamonetactical.com";
units[] = {};
weapons[] = {};
requiredVersion = REQUIRED_VERSION;
/* Require CBA and all components below */
requiredAddons[] = {"cba_main"};
VERSION_CONFIG;
};
};
4 changes: 4 additions & 0 deletions addons/main/script_component.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#define COMPONENT main

#include "\x\tac1\addons\main\script_mod.hpp"
#include "\x\tac1\addons\main\script_macros.hpp"
65 changes: 65 additions & 0 deletions addons/main/script_macros.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
#include "\x\cba\addons\main\script_macros_common.hpp"

// Expanding on CBA macros
#define EGVAR(module,var) TRIPLES(PREFIX,module,var)
#define QEGVAR(module,var) QUOTE(EGVAR(module,var))
#define QGVARMAIN(var) QUOTE(GVARMAIN(var))
#define CFUNC(var) EFUNC(common,var)
#define QFUNC(var1) QUOTE(FUNC(var1))

#ifndef PATHTO_FOLDER_SYS
#define PATHTO_FOLDER_SYS(var1,var2,var3) \MAINPREFIX\##var1\SUBPREFIX\##var2\##var3
#endif
#define PATHTO_FOLDER(var1) PATHTO_FOLDER_SYS(PREFIX,COMPONENT,var1)
#define QPATHTO_FOLDER(var1) QUOTE(PATHTO_FOLDER_SYS(PREFIX,COMPONENT,var1))

// Debug macros
#define DEBUG_LOG(text) [__FILE__,__LINE__,text] call CFUNC(debugLog)
#define DEBUG_LOG_1(text,A) DEBUG_LOG(FORMAT_1(text,A))
#define DEBUG_LOG_2(text,A,B) DEBUG_LOG(FORMAT_2(text,A,B))
#define DEBUG_LOG_3(text,A,B,C) DEBUG_LOG(FORMAT_3(text,A,B,C))
#define DEBUG_LOG_4(text,A,B,C,D) DEBUG_LOG(FORMAT_4(text,A,B,C,D))
#define DEBUG_LOG_5(text,A,B,C,D,E) DEBUG_LOG(FORMAT_5(text,A,B,C,D,E))
#define DEBUG_LOG_6(text,A,B,C,D,E,F) DEBUG_LOG(FORMAT_6(text,A,B,C,D,E,F))
#define DEBUG_LOG_7(text,A,B,C,D,E,F,G) DEBUG_LOG(FORMAT_7(text,A,B,C,D,E,F,G))
#define DEBUG_LOG_8(text,A,B,C,D,E,F,G,H) DEBUG_LOG(FORMAT_8(text,A,B,C,D,E,F,G,H))

#define DEBUG_ERR(text) [__FILE__,__LINE__,text] call CFUNC(debugError)
#define DEBUG_ERR_1(text,A) DEBUG_ERR(FORMAT_1(text,A))
#define DEBUG_ERR_2(text,A,B) DEBUG_ERR(FORMAT_2(text,A,B))
#define DEBUG_ERR_3(text,A,B,C) DEBUG_ERR(FORMAT_3(text,A,B,C))
#define DEBUG_ERR_4(text,A,B,C,D) DEBUG_ERR(FORMAT_4(text,A,B,C,D))
#define DEBUG_ERR_5(text,A,B,C,D,E) DEBUG_ERR(FORMAT_5(text,A,B,C,D,E))
#define DEBUG_ERR_6(text,A,B,C,D,E,F) DEBUG_ERR(FORMAT_6(text,A,B,C,D,E,F))
#define DEBUG_ERR_7(text,A,B,C,D,E,F,G) DEBUG_ERR(FORMAT_7(text,A,B,C,D,E,F,G))
#define DEBUG_ERR_8(text,A,B,C,D,E,F,G,H) DEBUG_ERR(FORMAT_8(text,A,B,C,D,E,F,G,H))

#define DEBUG_MSG(text) [QUOTE(COMPONENT),text] call CFUNC(debugMsg)
#define DEBUG_MSG_1(text,A) DEBUG_MSG(FORMAT_1(text,A))
#define DEBUG_MSG_2(text,A,B) DEBUG_MSG(FORMAT_2(text,A,B))
#define DEBUG_MSG_3(text,A,B,C) DEBUG_MSG(FORMAT_3(text,A,B,C))
#define DEBUG_MSG_4(text,A,B,C,D) DEBUG_MSG(FORMAT_4(text,A,B,C,D))
#define DEBUG_MSG_5(text,A,B,C,D,E) DEBUG_MSG(FORMAT_5(text,A,B,C,D,E))
#define DEBUG_MSG_6(text,A,B,C,D,E,F) DEBUG_MSG(FORMAT_6(text,A,B,C,D,E,F))
#define DEBUG_MSG_7(text,A,B,C,D,E,F,G) DEBUG_MSG(FORMAT_7(text,A,B,C,D,E,F,G))
#define DEBUG_MSG_8(text,A,B,C,D,E,F,G,H) DEBUG_MSG(FORMAT_8(text,A,B,C,D,E,F,G,H))

#define GETVAR_SYS(var1,var2) getVariable [ARR_2(QUOTE(var1),var2)]
#define SETVAR_SYS(var1,var2) setVariable [ARR_2(QUOTE(var1),var2)]
#define SETPVAR_SYS(var1,var2) setVariable [ARR_3(QUOTE(var1),var2,true)]

#define GETVAR(var1,var2,var3) var1 GETVAR_SYS(var2,var3)
#define GETMVAR(var1,var2) missionNamespace GETVAR_SYS(var1,var2)
#define GETUVAR(var1,var2) uiNamespace GETVAR_SYS(var1,var2)
#define GETPRVAR(var1,var2) profileNamespace GETVAR_SYS(var1,var2)
#define GETPAVAR(var1,var2) parsingNamespace GETVAR_SYS(var1,var2)

#define SETVAR(var1,var2,var3) var1 SETVAR_SYS(var2,var3)
#define SETPVAR(var1,var2,var3) var1 SETPVAR_SYS(var2,var3)
#define SETMVAR(var1,var2) missionNamespace SETVAR_SYS(var1,var2)
#define SETUVAR(var1,var2) uiNamespace SETVAR_SYS(var1,var2)
#define SETPRVAR(var1,var2) profileNamespace SETVAR_SYS(var1,var2)
#define SETPAVAR(var1,var2) parsingNamespace SETVAR_SYS(var1,var2)

#define GETGVAR(var1,var2) GETMVAR(GVAR(var1),var2)
#define GETEGVAR(var1,var2,var3) GETMVAR(EGVAR(var1,var2),var3)
11 changes: 11 additions & 0 deletions addons/main/script_mod.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#define MAINPREFIX x
#define PREFIX tac1

#define MAJOR 1
#define MINOR 0
#define PATCH 0

#define VERSION MAJOR.MINOR.PATCH
#define VERSION_AR MAJOR,MINOR,PATCH

#define REQUIRED_VERSION 1.56

0 comments on commit 24a2f43

Please sign in to comment.