-
Notifications
You must be signed in to change notification settings - Fork 739
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
XM157 (NGSW-FC Smart Scope) Framework (#8897)
* XM157 (NGSW-FC Smart Scope) * Update addons/common/functions/fnc_rscObjectHelper.sqf Co-authored-by: Jouni Järvinen <rautamiekka@users.noreply.github.com> * Update addons/xm157/functions/fnc_weaponInfo_draw.sqf Co-authored-by: Jouni Järvinen <rautamiekka@users.noreply.github.com> * Headers * Handle prone-deploy weapon bank * Disable Reticle picker for now * some localizations * Change font looks like CUP modifies EtelkaMonospaceProBold for some reason?? * Create xm157-framework.md * Formating Co-authored-by: Jouni Järvinen <rautamiekka@users.noreply.github.com>
- Loading branch information
1 parent
77cf716
commit cc3bad3
Showing
29 changed files
with
1,131 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
#include "script_component.hpp" | ||
/* | ||
* Author: PabstMirror | ||
* Convert between screen and 3d object coordinates | ||
* | ||
* Arguments: | ||
* 0: Function <STRING> | ||
* 1: Input array <CODE> | ||
* 2: Scale (optional: 1) <NUMBER> | ||
* | ||
* Return Value: | ||
* Value <ARRAY> | ||
* | ||
* Example: | ||
* ["2d", [0,0,0], 1] call ace_common_fnc_rscObjectHelper | ||
* | ||
* Public: Maybe | ||
*/ | ||
|
||
params ["_func", "_array", ["_scale", 1]]; | ||
|
||
private _adjustCam = 1; | ||
private _topFOV = getResolution # 6; | ||
private _leftFOV = getResolution # 7; | ||
|
||
private _topLeftX = (_leftFOV-1)*0.5/_leftFOV; | ||
private _bottomRightX = 1-_topLeftX; | ||
private _topLeftY = 0; | ||
private _bottomRightY = 1; | ||
|
||
private _return = []; | ||
|
||
switch (toLower _func) do { | ||
case ("2d"): { | ||
_array params ["_pointX", "_z", "_pointY"]; | ||
|
||
private _scrX = _pointX * (_bottomRightX - _topLeftX) + _topLeftX; | ||
private _vX = _leftFOV * (_scrX - 0.5) * _adjustCam * _z; | ||
|
||
private _scrY = _pointY * (_bottomRightY - _topLeftY) + _topLeftY; | ||
private _vY = _topFOV * (0.5 - _scrY) * _adjustCam * _z; | ||
|
||
_vX = _vX / _scale; | ||
_vY = _vY / _scale; | ||
|
||
_return = [_vX, _vY, _z]; | ||
}; | ||
case ("3d"): { | ||
_array params ["_vX", "_vY", "_z"]; // z is distance from screen | ||
|
||
_vX = _vX * _scale; | ||
_vY = _vY * _scale; | ||
|
||
private _scrX = _vX / (_leftFOV * _adjustCam * _z) + 0.5; | ||
private _pointX = (_scrX - _topLeftX) / (_bottomRightX - _topLeftX); | ||
|
||
private _scrY = 0.5 - _vY / (_topFOV * _adjustCam * _z); | ||
private _pointY = (_scrY - _topLeftY) / (_bottomRightY - _topLeftY); | ||
|
||
_return = [_pointX, _z, _pointY]; | ||
}; | ||
}; | ||
|
||
_return |
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 @@ | ||
z\ace\addons\xm157 |
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,15 @@ | ||
class Extended_PreStart_EventHandlers { | ||
class ADDON { | ||
init = QUOTE(call COMPILE_SCRIPT(XEH_preStart)); | ||
}; | ||
}; | ||
class Extended_PreInit_EventHandlers { | ||
class ADDON { | ||
init = QUOTE(call COMPILE_SCRIPT(XEH_preInit)); | ||
}; | ||
}; | ||
class Extended_PostInit_EventHandlers { | ||
class ADDON { | ||
init = QUOTE(call COMPILE_SCRIPT(XEH_postInit)); | ||
}; | ||
}; |
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 @@ | ||
class CfgSounds { | ||
class GVAR(click) { | ||
sound[] = {QPATHTOF(sounds\click.wav), db-30, 3}; | ||
titles[] = {}; | ||
}; | ||
}; |
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,48 @@ | ||
class CfgWeapons { | ||
class ItemCore; | ||
class InventoryOpticsItem_Base_F; | ||
|
||
class ace_xm157_prototype: ItemCore { | ||
author = ECSTRING(common,ACETeam); | ||
scope = 1; // hidden | ||
displayName = "XM157 Prototype"; | ||
descriptionShort = ""; | ||
picture = "\a3\Weapons_F\acc\Data\UI\icon_optic_tws_ca.paa"; | ||
model = "\A3\weapons_f\acc\acco_tws_F"; | ||
inertia = 0.3; | ||
|
||
class CBA_ScriptedOptic { | ||
bodyTexture = QPATHTOF(data\ace_vector_body_co.paa); | ||
// bodyTextureNight = ".paa"; // optional | ||
bodyTextureSize = 1; | ||
hideMagnification = 1; // no point, and it flickers at 1x | ||
disableTilt = 0; | ||
}; | ||
|
||
weaponInfoType = QGVAR(info); | ||
class ItemInfo: InventoryOpticsItem_Base_F { | ||
mass = 14; | ||
optics = 1; | ||
modelOptics = "\x\cba\addons\optics\cba_optic_big_100.p3d"; | ||
class OpticsModes { | ||
class lpvo { | ||
opticsID = 1; | ||
useModelOptics = 1; | ||
opticsPPEffects[] = { "OpticsCHAbera1", "OpticsBlur1" }; | ||
opticsZoomMin = "8 call (uiNamespace getVariable 'cba_optics_fnc_setOpticMagnificationHelper')"; | ||
opticsZoomMax = "1 call (uiNamespace getVariable 'cba_optics_fnc_setOpticMagnificationHelper')"; | ||
opticsZoomInit = "1 call (uiNamespace getVariable 'cba_optics_fnc_setOpticMagnificationHelper')"; | ||
discreteDistance[] = {100}; | ||
discreteDistanceInitIndex = 0; | ||
distanceZoomMin = 100; | ||
distanceZoomMax = 100; | ||
memoryPointCamera = "opticView"; | ||
visionMode[] = {"Normal"}; | ||
opticsFlare = 1; | ||
opticsDisablePeripherialVision = 1; | ||
cameraDir = ""; | ||
}; | ||
}; | ||
}; | ||
}; | ||
}; |
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,2 @@ | ||
ace_xm157 | ||
========== |
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,79 @@ | ||
class RscObject; | ||
class RscControlsGroupNoScrollbars; | ||
|
||
class RscText; | ||
class GVAR(text): RscText { | ||
font = "EtelkaMonospacePro"; | ||
SizeEx = 0.04; | ||
colorText[]={1,0.1,0.05,0.95}; | ||
shadow = 0; | ||
}; | ||
class GVAR(textMenu): GVAR(text) { | ||
SizeEx = 0.09; | ||
style = 2+16; | ||
}; | ||
|
||
class RscInGameUI { | ||
class CBA_ScriptedOptic_zooming; | ||
class GVAR(info): CBA_ScriptedOptic_zooming { | ||
onLoad = QUOTE(call FUNC(weaponInfo_onLoad)); | ||
class objects { | ||
class Optic: RscObject { // first focal plane | ||
idc = IDC_SCOPE_OBJECT; | ||
type = 82; | ||
model = "\A3\Misc_F\Helpers\UserTexture1m.p3d"; | ||
x = 0; | ||
y = 0; | ||
z = 0; | ||
xBack = 0.9; | ||
yBack = 0.9; | ||
zBack = 0.3; | ||
inBack = 0; | ||
enableZoom = 1; | ||
zoomDuration = 0.001; | ||
class Areas { | ||
class usertexture { | ||
selection = "usertexture"; | ||
class controls { | ||
class test: RscControlsGroupNoScrollbars { | ||
idc = IDC_SCOPE_GROUP; | ||
x = 0; | ||
y = 0; | ||
w = 1; | ||
h = 4/3; | ||
}; | ||
}; | ||
}; | ||
}; | ||
}; | ||
class Screen: RscObject { | ||
idc = IDC_SCREEN_OBJECT; | ||
type = 82; | ||
model = "\A3\Misc_F\Helpers\UserTexture1m.p3d"; | ||
x = 0; | ||
y = 0; | ||
z = 0; | ||
xBack = 0.9; | ||
yBack = 0.9; | ||
zBack = 0.3; | ||
inBack = 1; | ||
enableZoom = 1; | ||
zoomDuration = 0.001; | ||
class Areas { | ||
class usertexture { | ||
selection = "usertexture"; | ||
class controls { | ||
class test: RscControlsGroupNoScrollbars { | ||
idc = IDC_SCREEN_GROUP; | ||
x = 0; | ||
y = 0; | ||
w = 1; | ||
h = 4/3; | ||
}; | ||
}; | ||
}; | ||
}; | ||
}; | ||
}; | ||
}; | ||
}; |
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,8 @@ | ||
LOG("prep"); | ||
|
||
PREP(ballistics_calculator); | ||
PREP(ballistics_getData); | ||
PREP(keyPress); | ||
PREP(weaponInfo_draw); | ||
PREP(weaponInfo_drawMenu); | ||
PREP(weaponInfo_onLoad); |
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,66 @@ | ||
#include "script_component.hpp" | ||
#include "\a3\ui_f\hpp\defineDIKCodes.inc" | ||
|
||
GVAR(shown) = false; | ||
GVAR(data) = createHashMap; | ||
([worldName] call EFUNC(common,getMapData)) params ["_latitude"]; | ||
GVAR(data) set ["latitude", _latitude]; | ||
|
||
|
||
// Add Keybinds | ||
["ACE3 Equipment", QGVAR(range), [format ["XM157 - %1", localize "str_a3_rscdisplayarsenal_stat_range"]], { | ||
["range", true] call FUNC(keyPress); | ||
}, { | ||
["range", false] call FUNC(keyPress); | ||
}, [DIK_TAB, [false, false, false]], false, 0] call CBA_fnc_addKeybind; | ||
|
||
["ACE3 Equipment", QGVAR(left), [format ["XM157 - %1", localize "str_a3_left"]], { | ||
["right", true] call FUNC(keyPress); | ||
}, { | ||
["right", false] call FUNC(keyPress); | ||
}, [DIK_END, [false, false, false]], false, 0] call CBA_fnc_addKeybind; | ||
|
||
["ACE3 Equipment", QGVAR(right), [format ["XM157 - %1", localize "str_a3_right"]], { | ||
["left", true] call FUNC(keyPress); | ||
}, { | ||
["left", false] call FUNC(keyPress); | ||
}, [DIK_DELETE, [false, false, false]], false, 0] call CBA_fnc_addKeybind; | ||
|
||
["ACE3 Equipment", QGVAR(up), [format ["XM157 - %1", localize "str_a3_rscattributetargetstate_up"]], { | ||
["up", true] call FUNC(keyPress); | ||
}, { | ||
["up", false] call FUNC(keyPress); | ||
}, [DIK_PGUP, [false, false, false]], false, 0] call CBA_fnc_addKeybind; | ||
|
||
["ACE3 Equipment", QGVAR(down), [format ["XM157 - %1", localize "str_a3_rscattributetargetstate_down"]], { | ||
["down", true] call FUNC(keyPress); | ||
}, { | ||
["down", false] call FUNC(keyPress); | ||
}, [DIK_PGDN, [false, false, false]], false, 0] call CBA_fnc_addKeybind; | ||
|
||
|
||
|
||
#ifdef ENABLE_QUICK_TESTING | ||
player addPrimaryWeaponItem "ace_xm157_prototype"; | ||
[player] call CBA_fnc_addUnitTrackProjectiles; | ||
player addItem "ACE_ATragMX"; | ||
player addItem "ace_rangecard"; | ||
|
||
["recompile", "recompile", "recompile", { | ||
private _start = diag_tickTime; | ||
[] call ACE_PREP_RECOMPILE; | ||
[] call ace_common_fnc_dumpPerformanceCounters; | ||
private _end = diag_tickTime; | ||
systemChat format ["recompile took [%1 ms]", (1000 * (_end - _start)) toFixed 1]; | ||
|
||
if (productVersion #4 == "Diag") then { | ||
call compile "diag_mergeConfigFile ['P:\z\ace\addons\xm157\config.cpp']"; | ||
}; | ||
|
||
private _windSpd = vectorMagnitude wind; | ||
private _windDir = (wind select 0) atan2 (wind select 1); | ||
systemChat format ["Wind %1 @ %2", _windSpd, _windDir + 180]; | ||
|
||
false | ||
}, {false}, [0x21, [false, false, false]], false] call CBA_fnc_addKeybind; // F Key | ||
#endif |
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,9 @@ | ||
#include "script_component.hpp" | ||
|
||
ADDON = false; | ||
|
||
PREP_RECOMPILE_START; | ||
#include "XEH_PREP.hpp" | ||
PREP_RECOMPILE_END; | ||
|
||
ADDON = true; |
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 @@ | ||
#include "script_component.hpp" | ||
|
||
#include "XEH_PREP.hpp" |
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,27 @@ | ||
#include "script_component.hpp" | ||
|
||
class CfgPatches { | ||
class ADDON { | ||
name = COMPONENT_NAME; | ||
units[] = {}; | ||
weapons[] = {"ace_xm157_prototype"}; | ||
requiredVersion = REQUIRED_VERSION; | ||
requiredAddons[] = {"ace_advanced_ballistics", "ace_scopes"}; | ||
author = ECSTRING(common,ACETeam); | ||
authors[] = {"PabstMirror"}; | ||
url = ECSTRING(main,URL); | ||
VERSION_CONFIG; | ||
}; | ||
}; | ||
|
||
#include "CfgEventHandlers.hpp" | ||
#include "CfgSounds.hpp" | ||
#include "CfgWeapons.hpp" | ||
#include "RscInGameUI.hpp" | ||
|
||
class asdg_OpticRail; | ||
class asdg_OpticRail1913: asdg_OpticRail { | ||
class compatibleItems { | ||
ace_xm157_prototype = 1; | ||
}; | ||
}; |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Oops, something went wrong.