-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updating remove view camera logic, allowing use of map while in remot…
…e view
- Loading branch information
Showing
7 changed files
with
114 additions
and
72 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
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
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
39 changes: 27 additions & 12 deletions
39
AICommand/functions/remoteCamera/fn_enable3rdPersonCamera.sqf
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 |
---|---|---|
@@ -1,23 +1,38 @@ | ||
#include "..\functions.h" | ||
_this spawn { | ||
params ["_object"]; | ||
private ["_lastPosition"]; | ||
params ["_object",["_followDirection",false]]; | ||
waitUntil {time > 0}; | ||
showCinemaBorder false; | ||
AIC_3rd_Person_Camera_Target = _object; | ||
AIC_3rd_Person_Camera = "camera" camCreate (_object modelToWorld [0,0,0]); | ||
AIC_3rd_Person_Camera camSetTarget _object; | ||
AIC_3rd_Person_Camera cameraEffect ["internal", "BACK"]; | ||
[] call AIC_fnc_cameraUpdatePosition; | ||
AIC_Mouse_Move_Handler = ["MAIN_DISPLAY","MouseMoving", "_this call AIC_fnc_cameraMouseMoveHandler"] call AIC_fnc_addEventHandler; | ||
AIC_Mouse_Zoom_Handler = ["MAIN_DISPLAY","MouseZChanged", "_this call AIC_fnc_cameraMouseZoomHandler"] call AIC_fnc_addEventHandler; | ||
_lastPosition = getPos _object; | ||
_lastVectorDir = vectorDir _object; | ||
while {!isNull AIC_FNC_CAMERA && !isNull _object && alive _object} do { | ||
if(_lastPosition distance _object > 0.01 || vectorMagnitude (_lastVectorDir vectorDiff (vectorDir _object)) > 0.01 ) then { | ||
[] call AIC_fnc_cameraUpdatePosition; | ||
_lastPosition = getPos _object; | ||
AIC_3rd_Person_Camera_Frame_Handler = addMissionEventHandler ["EachFrame", {[] call AIC_fnc_cameraUpdatePosition; false}]; | ||
|
||
AIC_fnc_remoteCameraMapHandler = { | ||
private ["_event","_eventParams","_actionKeys"]; | ||
_event = param [0]; | ||
_eventParams = param [1]; | ||
_actionKeys = actionKeys "ShowMap"; | ||
if(_event == "KeyDown" || _event == "MouseButtonDown") then { | ||
if( (_eventParams select 1) in _actionKeys || (65536 + (_eventParams select 1)) in _actionKeys ) then { | ||
[] spawn { | ||
AIC_FNC_CAMERA cameraEffect ["Terminate", "Back"]; | ||
openMap true; | ||
waitUntil {!visibleMap}; | ||
if(!isNil "AIC_3rd_Person_Camera") then { | ||
AIC_3rd_Person_Camera cameraEffect ["internal", "BACK"]; | ||
}; | ||
}; | ||
}; | ||
}; | ||
sleep 0.01; | ||
}; | ||
|
||
}; | ||
|
||
AIC_3rd_Person_Camera_Map_Handler1 = ["MAIN_DISPLAY","KeyDown", "[""KeyDown"",_this] call AIC_fnc_remoteCameraMapHandler"] call AIC_fnc_addEventHandler; | ||
AIC_3rd_Person_Camera_Map_Handler2 = ["MAIN_DISPLAY","MouseButtonDown", "[""MouseButtonDown"",_this] call AIC_fnc_remoteCameraMapHandler"] call AIC_fnc_addEventHandler; | ||
|
||
waitUntil {isNull AIC_FNC_CAMERA || isNull _object}; | ||
[] call AIC_fnc_disable3rdPersonCamera; | ||
}; |
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 |
---|---|---|
@@ -1,7 +1,7 @@ | ||
#define AIC_FNC_CAMERA_DISTANCE (missionNamespace getVariable ["AIC_3rd_Person_Camera_Distance",8]) | ||
#define AIC_FNC_CAMERA (missionNamespace getVariable ["AIC_3rd_Person_Camera",objNull]) | ||
#define AIC_FNC_CAMERA_TARGET (missionNamespace getVariable ["AIC_3rd_Person_Camera_Target",objNull]) | ||
#define AIC_FNC_CAMERA_X_TOTAL (missionNamespace getVariable ["AIC_3rd_Person_Camera_X_Move_Total",-90]) | ||
#define AIC_FNC_CAMERA_Y_TOTAL (missionNamespace getVariable ["AIC_3rd_Person_Camera_Y_Move_Total",60]) | ||
#define AIC_FNC_CAMERA_Y_TOTAL_PRIOR (missionNamespace getVariable ["AIC_3rd_Person_Camera_Y_Move_Total_Prior",AIC_FNC_CAMERA_Y_TOTAL]) | ||
#define AIC_FNC_CAMERA_REL_POSITION [AIC_FNC_CAMERA_DISTANCE * (cos AIC_FNC_CAMERA_X_TOTAL) * (sin AIC_FNC_CAMERA_Y_TOTAL), AIC_FNC_CAMERA_DISTANCE * (sin AIC_FNC_CAMERA_X_TOTAL) * (sin AIC_FNC_CAMERA_Y_TOTAL), AIC_FNC_CAMERA_DISTANCE * (cos AIC_FNC_CAMERA_Y_TOTAL)] | ||
#define AIC_FNC_CAMERA_WORLD_POSITION ((camTarget AIC_FNC_CAMERA) modelToWorld AIC_FNC_CAMERA_REL_POSITION) | ||
#define AIC_FNC_CAMERA_REL_POSITION [AIC_FNC_CAMERA_DISTANCE * (cos AIC_FNC_CAMERA_X_TOTAL) * (sin AIC_FNC_CAMERA_Y_TOTAL), AIC_FNC_CAMERA_DISTANCE * (sin AIC_FNC_CAMERA_X_TOTAL) * (sin AIC_FNC_CAMERA_Y_TOTAL), AIC_FNC_CAMERA_DISTANCE * (cos AIC_FNC_CAMERA_Y_TOTAL)] |