mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
- Solve a number of ASL vs ATL issues
- Replace the way of calculating 3D positions for subactions
This commit is contained in:
parent
12c0a77f86
commit
27808847db
@ -15,9 +15,6 @@ PREP(render);
|
||||
PREP(renderIcon);
|
||||
PREP(renderBaseMenu);
|
||||
PREP(renderMenu);
|
||||
PREP(rotateVectLine);
|
||||
PREP(rotateVectLineGetMap);
|
||||
PREP(updateVecLineMap);
|
||||
|
||||
GVAR(keyDown) = false;
|
||||
GVAR(keyDownSelfAction) = false;
|
||||
@ -31,7 +28,6 @@ GVAR(actionSelected) = false;
|
||||
GVAR(selectedTarget) = objNull;
|
||||
|
||||
GVAR(menuDepthPath) = [];
|
||||
GVAR(vecLineMap) = [];
|
||||
GVAR(lastPos) = [0,0,0];
|
||||
|
||||
GVAR(currentOptions) = [];
|
||||
|
@ -32,6 +32,8 @@ if(!GVAR(keyDownSelfAction)) then {
|
||||
setMousePosition [0.5, 0.5];
|
||||
|
||||
};
|
||||
GVAR(selfMenuOffset) = (positionCameraToWorld [0, 0, 2]) vectorDiff (positionCameraToWorld [0, 0, 0]);
|
||||
|
||||
GVAR(selfMenuOffset) = ((positionCameraToWorld [0, 0, 2]) call EFUNC(common,positionToASL)) vectorDiff
|
||||
((positionCameraToWorld [0, 0, 0]) call EFUNC(common,positionToASL));
|
||||
};
|
||||
true
|
||||
|
@ -22,5 +22,4 @@ if(GVAR(actionSelected)) then {
|
||||
GVAR(expanded) = false;
|
||||
GVAR(lastPath) = [];
|
||||
GVAR(menuDepthPath) = [];
|
||||
GVAR(vecLineMap) = [];
|
||||
true
|
||||
|
@ -26,5 +26,4 @@ if(GVAR(actionSelected)) then {
|
||||
GVAR(expanded) = false;
|
||||
GVAR(lastPath) = [];
|
||||
GVAR(menuDepthPath) = [];
|
||||
GVAR(vecLineMap) = [];
|
||||
true
|
||||
|
@ -25,7 +25,6 @@ GVAR(currentOptions) = [];
|
||||
private ["_actionsVarName","_classActions","_objectActions","_target","_player","_action","_actionData","_active"];
|
||||
_player = ACE_player;
|
||||
if (GVAR(keyDown)) then {
|
||||
[] call FUNC(updateVecLineMap);
|
||||
|
||||
// Render all nearby interaction menus
|
||||
#define MAXINTERACTOBJECTS 3
|
||||
@ -76,8 +75,6 @@ if (GVAR(keyDown)) then {
|
||||
} else {
|
||||
if (GVAR(keyDownSelfAction)) then {
|
||||
|
||||
[] call FUNC(updateVecLineMap);
|
||||
|
||||
// Render only the self action menu
|
||||
_target = vehicle ACE_player;
|
||||
|
||||
@ -100,7 +97,7 @@ if (GVAR(keyDown)) then {
|
||||
{
|
||||
_action = _x;
|
||||
|
||||
_pos = _cursorPos1 vectorAdd GVAR(selfMenuOffset);
|
||||
_pos = (((positionCameraToWorld [0, 0, 0]) call EFUNC(common,positionToASL)) vectorAdd GVAR(selfMenuOffset)) call EFUNC(common,ASLToPosition);
|
||||
[_target, _action, _pos] call FUNC(renderBaseMenu);
|
||||
} forEach _classActions;
|
||||
};
|
||||
@ -176,9 +173,6 @@ if(!_foundTarget && GVAR(actionSelected)) then {
|
||||
GVAR(actionSelected) = false;
|
||||
GVAR(expanded) = false;
|
||||
GVAR(lastPath) = [];
|
||||
if(!GVAR(keyDown)) then {
|
||||
GVAR(vecLineMap) = [];
|
||||
};
|
||||
};
|
||||
for "_i" from GVAR(iconCount) to (count GVAR(iconCtrls))-1 do {
|
||||
ctrlDelete (GVAR(iconCtrls) select _i);
|
||||
|
@ -41,6 +41,9 @@ if((count _this) > 2) then {
|
||||
_pos = _pos vectorAdd ((visiblePositionASL _object) vectorDiff (getPosASL _object));
|
||||
};
|
||||
|
||||
_cameraToActionVec = (_pos call EFUNC(common,positionToASL)) vectorDiff ((positionCameraToWorld [0,0,0]) call EFUNC(common,positionToASL));
|
||||
GVAR(refSystem) = _cameraToActionVec call EFUNC(common,createOrthonormalReference);
|
||||
|
||||
// For non-self actions, exit if the action is too far away
|
||||
if (GVAR(keyDown) &&
|
||||
{(ACE_player modelToWorld (ACE_player selectionPosition "pilot")) distance _pos >= _distance}) exitWith {false};
|
||||
|
@ -66,9 +66,11 @@ _angle = _centerAngle - _angleSpan / 2;
|
||||
_target = _object;
|
||||
_player = ACE_player;
|
||||
|
||||
_offset = [GVAR(vecLineMap), _angle] call FUNC(rotateVectLine);
|
||||
_mod = (0.15 max (0.15 * ((positionCameraToWorld [0, 0, 0]) distance _pos))) / GVAR(selfMenuScale);
|
||||
_newPos = _pos vectorAdd (_offset vectorMultiply _mod);
|
||||
|
||||
_offset = ((GVAR(refSystem) select 1) vectorMultiply (-_mod * cos _angle)) vectorAdd
|
||||
((GVAR(refSystem) select 2) vectorMultiply (-_mod * sin _angle));
|
||||
_newPos = ((_pos call EFUNC(common,positionToASL)) vectorAdd _offset) call EFUNC(common,ASLToPosition);
|
||||
|
||||
//drawLine3D [_pos, _newPos, [1,0,0,0.5]];
|
||||
|
||||
|
@ -1,52 +0,0 @@
|
||||
/*
|
||||
* Author: NouberNou
|
||||
* Rotate a vector line (?)
|
||||
*
|
||||
* Argument:
|
||||
* 0: Map <ARRAY>
|
||||
* 1: Theta <ARRAY>
|
||||
*
|
||||
* Return value:
|
||||
* 0: ?? <ARRAY>
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_theta", "_p", "_map", "_p1", "_p2", "_q1", "_q2", "_u", "_d"];
|
||||
_map = _this select 0;
|
||||
_theta = _this select 1;
|
||||
|
||||
_p = _map select 0;
|
||||
_p1 = _map select 1;
|
||||
_p2 = _map select 2;
|
||||
|
||||
_q1 = +(_map select 3);
|
||||
_q2 = +(_map select 4);
|
||||
_u = _map select 5;
|
||||
_d = _map select 6;
|
||||
|
||||
/* Step 4 */
|
||||
_q2 set[0, (_q1 select 0) * cos(_theta) - (_q1 select 1) * sin(_theta)];
|
||||
_q2 set[1, (_q1 select 0) * sin(_theta) + (_q1 select 1) * cos(_theta)];
|
||||
_q2 set[2, (_q1 select 2)];
|
||||
|
||||
/* Inverse of step 3 */
|
||||
_q1 set[0, (_q2 select 0) * _d + (_q2 select 2) * (_u select 0)];
|
||||
_q1 set[1, (_q2 select 1)];
|
||||
_q1 set[2, - (_q2 select 0) * (_u select 0) + (_q2 select 2) * _d];
|
||||
|
||||
/* Inverse of step 2 */
|
||||
if (_d != 0) then {
|
||||
_q2 set[0, (_q1 select 0)];
|
||||
_q2 set[1, (_q1 select 1) * (_u select 2) / _d + (_q1 select 2) * (_u select 1) / _d];
|
||||
_q2 set[2, - (_q1 select 1) * (_u select 1) / _d + (_q1 select 2) * (_u select 2) / _d];
|
||||
} else {
|
||||
_q2 = _q1;
|
||||
};
|
||||
|
||||
/* Inverse of step 1 */
|
||||
_q1 set[0, (_q2 select 0) + (_p1 select 0)];
|
||||
_q1 set[1, (_q2 select 1) + (_p1 select 1)];
|
||||
_q1 set[2, (_q2 select 2) + (_p1 select 2)];
|
||||
_q1;
|
@ -1,52 +0,0 @@
|
||||
/*
|
||||
* Author: NouberNou
|
||||
* ?
|
||||
*
|
||||
* Argument:
|
||||
* 0: p0 <ARRAY>
|
||||
* 1: p1 <ARRAY>
|
||||
* 2: p2 <ARRAY>
|
||||
*
|
||||
* Return value:
|
||||
* Map <ARRAY>
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_p", "_p1", "_p2", "_q1", "_q2", "_u", "_d"];
|
||||
|
||||
_p = _this select 0;
|
||||
_p1 = _this select 1;
|
||||
_p2 = _this select 2;
|
||||
|
||||
_q1 = [];
|
||||
_q2 = [];
|
||||
_u = [];
|
||||
|
||||
/* Step 1 */
|
||||
_q1 set[0, (_p select 0) - (_p1 select 0)];
|
||||
_q1 set[1, (_p select 1) - (_p1 select 1)];
|
||||
_q1 set[2, (_p select 2) - (_p1 select 2)];
|
||||
|
||||
_u set[0, (_p2 select 0) - (_p1 select 0)];
|
||||
_u set[1, (_p2 select 1) - (_p1 select 1)];
|
||||
_u set[2, (_p2 select 2) - (_p1 select 2)];
|
||||
_u = _u call BIS_fnc_unitVector;
|
||||
_d = sqrt((_u select 1)*(_u select 1) + (_u select 2)*(_u select 2));
|
||||
|
||||
/* Step 2 */
|
||||
if (_d != 0) then {
|
||||
_q2 set[0, (_q1 select 0)];
|
||||
_q2 set[1, (_q1 select 1) * (_u select 2) / _d - (_q1 select 2) * (_u select 1) / _d];
|
||||
_q2 set[2, (_q1 select 1) * (_u select 1) / _d + (_q1 select 2) * (_u select 2) / _d];
|
||||
} else {
|
||||
_q2 = _q1;
|
||||
};
|
||||
|
||||
/* Step 3 */
|
||||
_q1 set[0, (_q2 select 0) * _d - (_q2 select 2) * (_u select 0)];
|
||||
_q1 set[1, (_q2 select 1)];
|
||||
_q1 set[2, (_q2 select 0) * (_u select 0) + (_q2 select 2) * _d];
|
||||
|
||||
[_p, _p1, _p2, _q1, _q2, _u, _d]
|
@ -1,13 +0,0 @@
|
||||
#include "script_component.hpp";
|
||||
|
||||
if((count GVAR(vecLineMap)) == 0 || ((count GVAR(menuDepthPath)) > 0 && (getPosASL player) distance GVAR(lastPos) > 0.01)) then {
|
||||
GVAR(lastPos) = getPosASL player;
|
||||
_cursorVec = [_cursorPos2, _cursorPos1] call BIS_fnc_vectorFromXtoY;
|
||||
_p1 = [0,0,0];
|
||||
_p2 = +_cursorVec;
|
||||
_p = (_cursorVec call CBA_fnc_vect2polar);
|
||||
_v = [(_p select 0), (_p select 1), (_p select 2)+90] call CBA_fnc_polar2vect;
|
||||
_cp = [_cursorVec, _v] call BIS_fnc_crossProduct;
|
||||
|
||||
GVAR(vecLineMap) = [_cp, _p1, _p2] call FUNC(rotateVectLineGetMap);
|
||||
};
|
Loading…
Reference in New Issue
Block a user