From 7efe8ccba52551893ddb0028af8c463ed3cff232 Mon Sep 17 00:00:00 2001 From: jaynus Date: Mon, 11 May 2015 16:44:17 -0700 Subject: [PATCH 1/3] Added: waveHeightAt Function, refs #1024 for use. --- addons/common/XEH_preInit.sqf | 1 + addons/common/functions/fnc_waveHeightAt.sqf | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+) create mode 100644 addons/common/functions/fnc_waveHeightAt.sqf diff --git a/addons/common/XEH_preInit.sqf b/addons/common/XEH_preInit.sqf index 5c2ad1e592..8230a4eb0b 100644 --- a/addons/common/XEH_preInit.sqf +++ b/addons/common/XEH_preInit.sqf @@ -183,6 +183,7 @@ PREP(unmuteUnit); PREP(useItem); PREP(useMagazine); PREP(waitAndExecute); +PREP(waveHeightAt); PREP(translateToWeaponSpace); PREP(translateToModelSpace); diff --git a/addons/common/functions/fnc_waveHeightAt.sqf b/addons/common/functions/fnc_waveHeightAt.sqf new file mode 100644 index 0000000000..fbfe5fb241 --- /dev/null +++ b/addons/common/functions/fnc_waveHeightAt.sqf @@ -0,0 +1,19 @@ +/* + * Author: jaynus + * + * Gets the wave height at a specific location. Uses a logic, so may be performance iffy + * + * Arguments: + * 0: Position ASL to get height at + * + * Return Value: + * Wave height in meters + * + */ + +if(isNil QGVAR(waveHeightLogic)) then { + GVAR(waveHeightLogic) = "Logic" createVehicleLocal [0,0,0]; +}; +GVAR(waveHeightLogic) setPosASL (_this select 0); + +(((getPosASLW GVAR(waveHeightLogic)) select 2) - ((getPosASL GVAR(waveHeightLogic)) select 2)) \ No newline at end of file From e613db1feadafd1f203b17d8e18c7e50f7a67303 Mon Sep 17 00:00:00 2001 From: PabstMirror Date: Tue, 12 May 2015 15:40:12 -0500 Subject: [PATCH 2/3] Add missing script_component include --- addons/common/functions/fnc_waveHeightAt.sqf | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/common/functions/fnc_waveHeightAt.sqf b/addons/common/functions/fnc_waveHeightAt.sqf index fbfe5fb241..e05e4219b7 100644 --- a/addons/common/functions/fnc_waveHeightAt.sqf +++ b/addons/common/functions/fnc_waveHeightAt.sqf @@ -4,12 +4,13 @@ * Gets the wave height at a specific location. Uses a logic, so may be performance iffy * * Arguments: - * 0: Position ASL to get height at + * 0: Position ASL to get height at * * Return Value: * Wave height in meters * */ +#include "script_component.hpp" if(isNil QGVAR(waveHeightLogic)) then { GVAR(waveHeightLogic) = "Logic" createVehicleLocal [0,0,0]; From 1827d8ad959ad6d9c0c06f41033b6f022a0bdfa9 Mon Sep 17 00:00:00 2001 From: PabstMirror Date: Tue, 12 May 2015 16:04:42 -0500 Subject: [PATCH 3/3] Fix #1024 - Adjust self iMenu for wave height --- .../interact_menu/functions/fnc_keyDown.sqf | 7 +++++++ .../functions/fnc_renderActionPoints.sqf | 19 ++++++++++++------- 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/addons/interact_menu/functions/fnc_keyDown.sqf b/addons/interact_menu/functions/fnc_keyDown.sqf index 464466ae3a..5416440269 100644 --- a/addons/interact_menu/functions/fnc_keyDown.sqf +++ b/addons/interact_menu/functions/fnc_keyDown.sqf @@ -64,6 +64,13 @@ if (GVAR(useCursorMenu)) then { GVAR(selfMenuOffset) = ((positionCameraToWorld [0, 0, 2]) call EFUNC(common,positionToASL)) vectorDiff ((positionCameraToWorld [0, 0, 0]) call EFUNC(common,positionToASL)); +private ["_wavesAtOrigin", "_wavesAtVirtualPoint"]; + +_wavesAtOrigin = [(positionCameraToWorld [0, 0, 0])] call EFUNC(common,waveHeightAt); +_wavesAtVirtualPoint = [(positionCameraToWorld [0, 0, 2])] call EFUNC(common,waveHeightAt); +GVAR(selfMenuOffset) set [2, ((GVAR(selfMenuOffset) select 2) + _wavesAtOrigin - _wavesAtVirtualPoint)]; + + ["interactMenuOpened", [_menuType]] call EFUNC(common,localEvent); true diff --git a/addons/interact_menu/functions/fnc_renderActionPoints.sqf b/addons/interact_menu/functions/fnc_renderActionPoints.sqf index 8e6cb7d390..6579bd33e7 100644 --- a/addons/interact_menu/functions/fnc_renderActionPoints.sqf +++ b/addons/interact_menu/functions/fnc_renderActionPoints.sqf @@ -14,7 +14,7 @@ GVAR(currentOptions) = []; -private ["_player","_numInteractObjects","_numInteractions","_actionsVarName","_classActions","_target","_player","_action","_cameraPos","_cameraDir", "_lambda", "_nearestObjects", "_pos"]; +private ["_player","_numInteractObjects","_numInteractions","_actionsVarName","_classActions","_target","_player","_action","_cameraPos","_cameraDir", "_lambda", "_nearestObjects", "_pos", "_virtualPoint", "_wavesAtOrigin", "_wavesAtVirtualPoint"]; _player = ACE_player; _fnc_renderNearbyActions = { @@ -101,14 +101,19 @@ _fnc_renderSelfActions = { // Iterate through base level class actions and render them if appropiate _actionsVarName = format [QGVAR(SelfAct_%1), typeOf _target]; _classActions = missionNamespace getVariable [_actionsVarName, []]; + + _pos = if !(GVAR(useCursorMenu)) then { + _virtualPoint = (((positionCameraToWorld [0, 0, 0]) call EFUNC(common,positionToASL)) vectorAdd GVAR(selfMenuOffset)) call EFUNC(common,ASLToPosition); + _wavesAtOrigin = [(positionCameraToWorld [0, 0, 0])] call EFUNC(common,waveHeightAt); + _wavesAtVirtualPoint = [_virtualPoint] call EFUNC(common,waveHeightAt); + _virtualPoint set [2, ((_virtualPoint select 2) - _wavesAtOrigin + _wavesAtVirtualPoint)]; + _virtualPoint + } else { + [0.5, 0.5] + }; + { _action = _x; - - _pos = if !(GVAR(useCursorMenu)) then { - (((positionCameraToWorld [0, 0, 0]) call EFUNC(common,positionToASL)) vectorAdd GVAR(selfMenuOffset)) call EFUNC(common,ASLToPosition) - } else { - [0.5, 0.5] - }; [_target, _action, _pos] call FUNC(renderBaseMenu); } forEach _classActions; };