Skip to content

Commit

Permalink
Merge pull request #27 from tuntematonjr/Development
Browse files Browse the repository at this point in the history
Development
  • Loading branch information
tuntematonjr authored Dec 7, 2024
2 parents 5811798 + 93397ce commit 0c3c891
Show file tree
Hide file tree
Showing 5 changed files with 80 additions and 53 deletions.
4 changes: 2 additions & 2 deletions addons/main/script_version.hpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#define MAJOR 1
#define MINOR 4
#define PATCH 5
#define MINOR 5
#define PATCH 0
#define BUILD 1
34 changes: 18 additions & 16 deletions include/x/cba/addons/main/script_macros_common.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
- Provide a solid structure that can be dynamic and easy editable (Which sometimes means we cannot adhere to Aim #1 ;-)
An example is the path that is built from defines. Some available in this file, others in mods and addons.
Follows Standard:
Follows Standard:
Object variables: PREFIX_COMPONENT
Main-object variables: PREFIX_main
Paths: MAINPREFIX\PREFIX\SUBPREFIX\COMPONENT\SCRIPTNAME.sqf
Expand All @@ -29,6 +29,10 @@
and include your mod's script_macros.hpp
In your scripts you can then include the addon's component.hpp with relative path)
use in subcomponents (subconfigs)
define SUBCOMPONENT and include parent component's script_component.hpp
currently only supported by SUBADDON, additional macros may be added in the future
TODO:
- Try only to use 1 string type " vs '
- Evaluate double functions, and simplification
Expand All @@ -54,6 +58,10 @@
#define ADDON DOUBLES(PREFIX,COMPONENT)
#define MAIN_ADDON DOUBLES(PREFIX,main)

#ifdef SUBCOMPONENT
#define SUBADDON DOUBLES(ADDON,SUBCOMPONENT)
#endif

/* -------------------------------------------
Macro: VERSION_CONFIG
Define CBA Versioning System config entries.
Expand Down Expand Up @@ -857,15 +865,10 @@ Macro: ISNILS()
#define COMPILE_SCRIPT(var1) compileScript ['PATHTO_SYS(PREFIX,COMPONENT_F,var1)']


#define VERSIONING_SYS(var1) class CfgSettings \
{ \
class CBA \
{ \
class Versioning \
{ \
class var1 \
{ \
}; \
#define VERSIONING_SYS(var1) class CfgSettings { \
class CBA { \
class Versioning { \
class var1 {}; \
}; \
}; \
};
Expand Down Expand Up @@ -1032,12 +1035,9 @@ Macro: PATHTO_FNC()
#define QQEFUNC(var1,var2) QUOTE(QEFUNC(var1,var2))

#ifndef PRELOAD_ADDONS
#define PRELOAD_ADDONS class CfgAddons \
{ \
class PreloadAddons \
{ \
class ADDON \
{ \
#define PRELOAD_ADDONS class CfgAddons { \
class PreloadAddons { \
class ADDON { \
list[]={ QUOTE(ADDON) }; \
}; \
}; \
Expand Down Expand Up @@ -1275,9 +1275,11 @@ Macro: xSTRING()
#define ELSTRING(var1,var2) QUOTE(TRIPLES(STR,DOUBLES(PREFIX,var1),var2))
#define CSTRING(var1) QUOTE(TRIPLES($STR,ADDON,var1))
#define ECSTRING(var1,var2) QUOTE(TRIPLES($STR,DOUBLES(PREFIX,var1),var2))
#define SUBCSTRING(var1) QUOTE(TRIPLES($STR,SUBADDON,var1))

#define LLSTRING(var1) localize QUOTE(TRIPLES(STR,ADDON,var1))
#define LELSTRING(var1,var2) localize QUOTE(TRIPLES(STR,DOUBLES(PREFIX,var1),var2))
#define LSUBLSTRING(var1) localize QUOTE(TRIPLES(STR,SUBADDON,var1))
#endif


Expand Down
66 changes: 40 additions & 26 deletions include/x/cba/addons/xeh/script_xeh.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,23 +14,29 @@ fired = "call cba_xeh_fnc_fired"; \
animChanged = "call cba_xeh_fnc_animChanged"; \
animDone = "call cba_xeh_fnc_animDone"; \
animStateChanged = "call cba_xeh_fnc_animStateChanged"; \
cargoLoaded = "call cba_xeh_fnc_cargoLoaded"; \
cargoUnloaded = "call cba_xeh_fnc_cargoUnloaded"; \
containerClosed = "call cba_xeh_fnc_containerClosed"; \
containerOpened = "call cba_xeh_fnc_containerOpened"; \
controlsShifted = "call cba_xeh_fnc_controlsShifted"; \
dammaged = "call cba_xeh_fnc_dammaged"; \
deleted = "call cba_xeh_fnc_deleted"; \
disassembled = "call cba_xeh_fnc_disassembled"; \
engine = "call cba_xeh_fnc_engine"; \
epeContact = "call cba_xeh_fnc_epeContact"; \
epeContactEnd = "call cba_xeh_fnc_epeContactEnd"; \
epeContactStart = "call cba_xeh_fnc_epeContactStart"; \
explosion = "call cba_xeh_fnc_explosion"; \
firedMan = "call cba_xeh_fnc_firedMan"; \
firedNear = "call cba_xeh_fnc_firedNear"; \
fuel = "call cba_xeh_fnc_cba_xeh_fuel"; \
gear = "call cba_xeh_fnc_gear"; \
gestureChanged = "call cba_xeh_fnc_gestureChanged"; \
gestureDone = "call cba_xeh_fnc_gestureDone"; \
getIn = "call cba_xeh_fnc_getIn"; \
getInMan = "call cba_xeh_fnc_getInMan"; \
getOut = "call cba_xeh_fnc_getOut"; \
getOutMan = "call cba_xeh_fnc_getOutMan"; \
handleHeal = "call cba_xeh_fnc_handleHeal"; \
hit = "call cba_xeh_fnc_hit"; \
hitPart = "call cba_xeh_fnc_hitPart"; \
incomingMissile = "call cba_xeh_fnc_incomingMissile"; \
Expand All @@ -40,25 +46,27 @@ killed = "call cba_xeh_fnc_killed"; \
landedTouchDown = "call cba_xeh_fnc_landedTouchDown"; \
landedStopped = "call cba_xeh_fnc_landedStopped"; \
local = "call cba_xeh_fnc_local"; \
respawn = "call cba_xeh_fnc_respawn"; \
opticsModeChanged = "call cba_xeh_fnc_opticsModeChanged"; \
opticsSwitch = "call cba_xeh_fnc_opticsSwitch"; \
put = "call cba_xeh_fnc_put"; \
take = "call cba_xeh_fnc_take"; \
reloaded = "call cba_xeh_fnc_reloaded"; \
respawn = "call cba_xeh_fnc_respawn"; \
ropeAttach = "call cba_xeh_fnc_ropeAttach"; \
ropeBreak = "call cba_xeh_fnc_ropeBreak"; \
seatSwitched = "call cba_xeh_fnc_seatSwitched"; \
seatSwitchedMan = "call cba_xeh_fnc_seatSwitchedMan"; \
slotItemChanged = "call cba_xeh_fnc_slotItemChanged"; \
suppressed = "call cba_xeh_fnc_suppressed"; \
soundPlayed = "call cba_xeh_fnc_soundPlayed"; \
take = "call cba_xeh_fnc_take"; \
turnIn = "call cba_xeh_fnc_turnIn"; \
turnOut = "call cba_xeh_fnc_turnOut"; \
visionModeChanged = "call cba_xeh_fnc_visionModeChanged"; \
weaponAssembled = "call cba_xeh_fnc_weaponAssembled"; \
weaponDisassembled = "call cba_xeh_fnc_weaponDisassembled"; \
weaponDeployed = "call cba_xeh_fnc_weaponDeployed"; \
weaponRested = "call cba_xeh_fnc_weaponRested"; \
reloaded = "call cba_xeh_fnc_reloaded"; \
firedMan = "call cba_xeh_fnc_firedMan"; \
turnIn = "call cba_xeh_fnc_turnIn"; \
turnOut = "call cba_xeh_fnc_turnOut"; \
deleted = "call cba_xeh_fnc_deleted"; \
disassembled = "call cba_xeh_fnc_disassembled"; \
Suppressed = "call cba_xeh_fnc_Suppressed"; \
gestureChanged = "call cba_xeh_fnc_gestureChanged"; \
gestureDone = "call cba_xeh_fnc_gestureDone";
weaponRested = "call cba_xeh_fnc_weaponRested";


/*
MACRO: DELETE_EVENTHANDLERS
Expand All @@ -71,23 +79,29 @@ fired = ""; \
animChanged = ""; \
animDone = ""; \
animStateChanged = ""; \
cargoLoaded = ""; \
cargoUnloaded = ""; \
containerClosed = ""; \
containerOpened = ""; \
controlsShifted = ""; \
dammaged = ""; \
deleted = ""; \
disassembled = ""; \
engine = ""; \
epeContact = ""; \
epeContactEnd = ""; \
epeContactStart = ""; \
explosion = ""; \
firedMan = ""; \
firedNear = ""; \
fuel = ""; \
gear = ""; \
gestureChanged = ""; \
gestureDone = "" \
getIn = ""; \
getInMan = ""; \
getOut = ""; \
getOutMan = ""; \
handleHeal = ""; \
hit = ""; \
hitPart = ""; \
incomingMissile = ""; \
Expand All @@ -97,22 +111,22 @@ killed = ""; \
landedTouchDown = ""; \
landedStopped = ""; \
local = ""; \
respawn = ""; \
opticsModeChanged = ""; \
opticsSwitch = ""; \
put = ""; \
take = ""; \
reloaded = ""; \
respawn = ""; \
ropeAttach = ""; \
ropeBreak = ""; \
seatSwitched = ""; \
seatSwitchedMan = ""; \
soundPlayed = ""; \
suppressed = ""; \
take = ""; \
turnIn = ""; \
turnOut = ""; \
visionModeChanged = ""; \
weaponAssembled = ""; \
weaponDisassembled = ""; \
weaponDeployed = ""; \
weaponRested = ""; \
reloaded = ""; \
firedMan = ""; \
turnIn = ""; \
turnOut = ""; \
deleted = ""; \
disassembled = ""; \
Suppressed = ""; \
gestureChanged = ""; \
gestureDone = ""
weaponRested = "";
4 changes: 2 additions & 2 deletions include/z/ace/addons/main/script_debug.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ Fast Recompiling via function

#ifdef DISABLE_COMPILE_CACHE
#define LINKFUNC(x) {_this call FUNC(x)}
#define PREP_RECOMPILE_START if (isNil "ACE_PREP_RECOMPILE") then {ACE_RECOMPILES = []; ACE_PREP_RECOMPILE = {{call _x} forEach ACE_RECOMPILES;}}; private _recomp = {
#define PREP_RECOMPILE_END }; call _recomp; ACE_RECOMPILES pushBack _recomp;
#define PREP_RECOMPILE_START if (isNil "ACE_PREP_RECOMPILE") then {Ace_RECOMPILES = []; ACE_PREP_RECOMPILE = {{call _x} forEach Ace_RECOMPILES;}}; private _recomp = {
#define PREP_RECOMPILE_END }; call _recomp; Ace_RECOMPILES pushBack _recomp;
#else
#define LINKFUNC(x) FUNC(x)
#define PREP_RECOMPILE_START ; /* disabled */
Expand Down
25 changes: 18 additions & 7 deletions include/z/ace/addons/main/script_macros.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,11 @@
#define TYPE_SCUBA 604 // not implemented
#define TYPE_HEADGEAR 605
#define TYPE_FACTOR 607
#define TYPE_MAP 608
#define TYPE_COMPASS 609
#define TYPE_WATCH 610
#define TYPE_RADIO 611
#define TYPE_GPS 612
#define TYPE_HMD 616
#define TYPE_BINOCULAR 617
#define TYPE_MEDIKIT 619
Expand Down Expand Up @@ -138,13 +142,20 @@
#define SD_TO_MIN_MAX(d) ((d) * 3.371) // Standard deviation -> min / max of random [min, mid, max]

// Angular unit conversion
#define MRAD_TO_MOA(d) ((d) * 3.43774677) // Conversion factor: 54 / (5 * PI)
#define MOA_TO_MRAD(d) ((d) * 0.29088821) // Conversion factor: (5 * PI) / 54
#define DEG_TO_MOA(d) ((d) * 60) // Conversion factor: 60
#define MOA_TO_DEG(d) ((d) / 60) // Conversion factor: 1 / 60
#define DEG_TO_MRAD(d) ((d) * 17.45329252) // Conversion factor: (50 * PI) / 9
#define MRAD_TO_DEG(d) ((d) / 17.45329252) // Conversion factor: 9 / (50 * PI)
#define MOA_TO_RAD(d) ((d) * 0.00029088) // Conversion factor: PI / 10800
// Conversion factor: 54 / (5 * PI)
#define MRAD_TO_MOA(d) ((d) * 3.43774677)
// Conversion factor: (5 * PI) / 54
#define MOA_TO_MRAD(d) ((d) * 0.29088821)
// Conversion factor: 60
#define DEG_TO_MOA(d) ((d) * 60)
// Conversion factor: 1 / 60
#define MOA_TO_DEG(d) ((d) / 60)
// Conversion factor: (50 * PI) / 9
#define DEG_TO_MRAD(d) ((d) * 17.45329252)
// Conversion factor: 9 / (50 * PI)
#define MRAD_TO_DEG(d) ((d) / 17.45329252)
// Conversion factor: PI / 10800
#define MOA_TO_RAD(d) ((d) * 0.00029088)

#define ZEUS_ACTION_CONDITION ([_target, {QUOTE(QUOTE(ADDON)) in curatorAddons _this}, missionNamespace, QUOTE(QGVAR(zeusCheck)), 1E11, 'ace_interactMenuClosed'] call EFUNC(common,cachedCall))

Expand Down

0 comments on commit 0c3c891

Please sign in to comment.