mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Allow multiple cameras to exist at once. Fix script error
This commit is contained in:
parent
f9ea835c59
commit
36f148ded4
@ -1,7 +1,6 @@
|
||||
PREP(camera_changeZoom);
|
||||
PREP(camera_cycleViewMode);
|
||||
PREP(camera_destroy);
|
||||
PREP(camera_getCameraNamespaceFromProjectile);
|
||||
PREP(camera_handleKeyPress);
|
||||
PREP(camera_init);
|
||||
PREP(camera_preTrack);
|
||||
|
@ -21,7 +21,7 @@ if (hasInterface) then {
|
||||
}*/] call EFUNC(interact_menu,createAction);
|
||||
["CAManBase", 1, ["ACE_SelfActions"], _switchToCameraAction, true] call EFUNC(interact_menu,addActionToClass);
|
||||
|
||||
GVAR(projectileCameraHash) = [[], objNull] call CBA_fnc_hashCreate;
|
||||
GVAR(activeCamera) = objNull;
|
||||
GVAR(projectileHashMap) = createHashMap; // used in the seeker to get the namespace for the associated projectile
|
||||
};
|
||||
|
||||
|
@ -19,6 +19,7 @@ params ["_cameraNamespace"];
|
||||
|
||||
private _userInThisCamera = [_cameraNamespace] call FUNC(camera_userInCamera);
|
||||
private _userCamera = ACE_PLAYER getVariable [QGVAR(missileCamera), objNull];
|
||||
|
||||
if (_userInThisCamera || { _userCamera isEqualTo _cameraNamespace }) then {
|
||||
ACE_PLAYER setVariable [QGVAR(missileCamera), objNull];
|
||||
};
|
||||
|
@ -1,24 +0,0 @@
|
||||
#include "script_component.hpp"
|
||||
/*
|
||||
* Author: Brandon (TCVM)
|
||||
* Switches away from the currently controlled camera
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Guidance Arg Array <ARRAY>
|
||||
* 1: PFID <NUMBER>
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
*
|
||||
* Example:
|
||||
* [[], 0] call ace_missileguidance_fnc_guidancePFH;
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
params ["_projectile"];
|
||||
|
||||
[GVAR(projectileCameraHash), {
|
||||
!((isNil "_key") || { isNull _key })
|
||||
}] call CBA_fnc_hashFilter;
|
||||
[GVAR(projectileCameraHash), _projectile] call CBA_fnc_hashGet;
|
||||
|
@ -8,7 +8,7 @@
|
||||
* 1: PFID <NUMBER>
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
* The camera <OBJECT>
|
||||
*
|
||||
* Example:
|
||||
* [[], 0] call ace_missileguidance_fnc_guidancePFH;
|
||||
@ -94,8 +94,6 @@ if (_preTrack) then {
|
||||
_activeCameraNamespace setVariable [QGVAR(logic), _logic];
|
||||
_activeCameraNamespace setVariable [QGVAR(missile), objNull];
|
||||
_activeCameraNamespace setVariable [QGVAR(logicPos), _shooter worldToModelVisual _logicPosition];
|
||||
|
||||
[GVAR(projectileCameraHash), _shooter, _activeCameraNamespace] call CBA_fnc_hashSet;
|
||||
} else {
|
||||
private _pos = getPosASL _projectile;
|
||||
|
||||
@ -127,10 +125,10 @@ if (_preTrack) then {
|
||||
_activeCameraNamespace setVariable [QGVAR(missile), _projectile];
|
||||
_activeCameraNamespace setVariable [QGVAR(logicPos), _projectile vectorModelToWorldVisual _logicPosition];
|
||||
|
||||
[GVAR(projectileCameraHash), _projectile, _activeCameraNamespace] call CBA_fnc_hashSet;
|
||||
|
||||
if (_switchOnFire) then {
|
||||
[_activeCameraNamespace] call FUNC(camera_switchTo);
|
||||
};
|
||||
};
|
||||
|
||||
_activeCameraNamespace
|
||||
|
||||
|
@ -15,13 +15,12 @@
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
params ["_cameraArray", "_projectile", "_deltaTime"];
|
||||
params ["_cameraArray", "_projectile", "_deltaTime", "_cameraNamespace"];
|
||||
_extractedInfo params ["", "", "", "", "", "", "", "_miscManeuvering", "", "_miscSeeker", "", "", "_cameraArray"];
|
||||
_cameraArray params ["_hasCamera", "", "", "", "", "", "", "", "_viewData", "_gimbalData", "", "_designating", "_canStopDesignating"];
|
||||
_viewData params ["_lookDir", "_groundPos", "_pointPos", "_movingCameraX", "_movingCameraY"];
|
||||
_gimbalData params ["_hasGimbal", "_maxGimbalX", "_maxGimbalY", "_gimbalSpeedX", "_gimbalSpeedY", "", "", "_gimbalZoomSpeedModifiers", "_stabilizeWhenMoving", "_designateWhenStationary", "_trackLockedPosition"];
|
||||
|
||||
private _cameraNamespace = [_projectile] call FUNC(camera_getCameraNamespaceFromProjectile);
|
||||
if (!_hasCamera || { _cameraNamespace isEqualTo objNull }) exitWith {};
|
||||
|
||||
if ([_cameraNamespace] call FUNC(camera_userInCamera)) then {
|
||||
|
@ -48,6 +48,9 @@ if (_seekerTargetPos isEqualTo [0, 0, 0]) then {
|
||||
|
||||
if (_reticleMovesWithTrack) then {
|
||||
_seekerPositionScreen = worldToScreen ASLtoAGL _seekerTargetPos;
|
||||
if (_seekerPositionScreen isEqualTo []) then {
|
||||
_seekerPositionScreen = [0, 0];
|
||||
};
|
||||
_seekerPositionScreen set [0, _seekerPositionScreen#0 - 0.5];
|
||||
_seekerPositionScreen set [1, _seekerPositionScreen#1 - 0.5];
|
||||
};
|
||||
|
@ -19,5 +19,5 @@ params [["_cameraNamespace", objNull]];
|
||||
|
||||
if (isNil QGVAR(activeCamera)) exitWith { false };
|
||||
|
||||
(!(GVAR(activeCamera) isEqualTo objNull)) && { (_cameraNamespace isEqualTo objNull) || (_cameraNamespace isEqualTo GVAR(activeCamera)) };
|
||||
(GVAR(activeCamera) isNotEqualTo objNull) && { (_cameraNamespace isEqualTo objNull) || (_cameraNamespace isEqualTo GVAR(activeCamera)) };
|
||||
|
||||
|
@ -67,19 +67,21 @@ if (!(_cameraConfig isEqualTo configNull) && { (getNumber (_cameraConfig >> "ena
|
||||
_cameraArray set [12, (getNumber (_cameraConfig >> "canStopDesignating")) == 1];
|
||||
};
|
||||
|
||||
[_projectile, _cameraArray, _shooter, false] call FUNC(camera_init);
|
||||
private _camera = [_projectile, _cameraArray, _shooter, false] call FUNC(camera_init);
|
||||
GVAR(projectileHashMap) set [hashValue _projectile, _camera];
|
||||
[{
|
||||
params ["_args", "_pfID"];
|
||||
_args params ["_firedEH", "_cameraArray", "_lastUpdate"];
|
||||
_args params ["_firedEH", "_cameraArray", "_lastUpdate", "_camera", "_projectileHash"];
|
||||
|
||||
_firedEH params ["_shooter","_weapon","_muzzle","_mode","_ammo","_magazine","_projectile"];
|
||||
|
||||
if (!alive _projectile || isNull _projectile || isNull _shooter) exitWith {
|
||||
[[_projectile] call FUNC(camera_getCameraNamespaceFromProjectile)] call FUNC(camera_destroy);
|
||||
GVAR(projectileHashMap) deleteAt _projectileHash;
|
||||
[_camera] call FUNC(camera_destroy);
|
||||
[_pfID] call CBA_fnc_removePerFrameHandler;
|
||||
};
|
||||
|
||||
[_cameraArray, _projectile, CBA_missionTime - _lastUpdate] call FUNC(camera_update);
|
||||
[_cameraArray, _projectile, CBA_missionTime - _lastUpdate, _camera] call FUNC(camera_update);
|
||||
|
||||
_args set [2, CBA_missionTime];
|
||||
}, 0, [_this, _cameraArray, CBA_missionTime]] call CBA_fnc_addPerFrameHandler;
|
||||
}, 0, [_this, _cameraArray, CBA_missionTime, _camera, hashValue _projectile]] call CBA_fnc_addPerFrameHandler;
|
||||
|
@ -23,7 +23,7 @@ _launchParams params ["", "_targetParams"];
|
||||
_targetParams params ["_target"];
|
||||
_seekerParams params ["_seekerAngle", "", "_seekerMaxRange"];
|
||||
|
||||
private _cameraNamespace = [_projectile] call FUNC(camera_getCameraNamespaceFromProjectile);
|
||||
private _cameraNamespace = GVAR(projectileHashMap) get hashValue _projectile;
|
||||
private _seekerTargetPos = _cameraNamespace getVariable [QGVAR(seekerTargetPos), [0, 0, 0]];
|
||||
private _cameraPos = _cameraNamespace getVariable [QGVAR(cameraPos), [0, 0, 0]];
|
||||
private _logicPos = _cameraNamespace getVariable [QGVAR(logicPos), [0, 0, 0]];
|
||||
|
Loading…
Reference in New Issue
Block a user