From 623ad4602cdd0baea140456cbd6ab3f14ace9da8 Mon Sep 17 00:00:00 2001 From: Space V <40030799+ahcenezdh@users.noreply.github.com> Date: Mon, 4 Mar 2024 02:27:04 +0100 Subject: [PATCH] feat(natives/CAM): work on CAM natives (#1036) * feat(natives/CAM): work on CAM natives * * Update UseVehicleCamStuntSettingsThisUpdate.md Correct documentation for this native. * Update StopRenderingScriptCamsUsingCatchUp.md Correct documentation for this native. --------- Co-authored-by: ammonia-cfx <38232208+4mmonium@users.noreply.github.com> --- CAM/IsScriptGlobalShaking.md | 24 ++++++++-- CAM/SetCamFov.md | 12 ++--- CAM/StopGameplayHint.md | 10 ++-- CAM/StopRenderingScriptCamsUsingCatchUp.md | 53 ++++++++++++++++++--- CAM/StopScriptGlobalShaking.md | 33 ++++++++++--- CAM/UseStuntCameraThisFrame.md | 11 ----- CAM/UseVehicleCamStuntSettingsThisUpdate.md | 16 +++++++ 7 files changed, 121 insertions(+), 38 deletions(-) delete mode 100644 CAM/UseStuntCameraThisFrame.md create mode 100644 CAM/UseVehicleCamStuntSettingsThisUpdate.md diff --git a/CAM/IsScriptGlobalShaking.md b/CAM/IsScriptGlobalShaking.md index aa2d363dd..a96b6a668 100644 --- a/CAM/IsScriptGlobalShaking.md +++ b/CAM/IsScriptGlobalShaking.md @@ -9,11 +9,27 @@ aliases: ["0xC912AF078AF19212"] BOOL IS_SCRIPT_GLOBAL_SHAKING(); ``` +Determines if a global camera shake is currently active. You can stop the currently active global camera shake using [STOP_SCRIPT_GLOBAL_SHAKING](#_0x1C9D7949FA533490). + ``` -In drunk_controller.c4, sub_309 -if (CAM::IS_SCRIPT_GLOBAL_SHAKING()) { - CAM::STOP_SCRIPT_GLOBAL_SHAKING(0); -} +NativeDB Introduced: v323 ``` ## Return value +Returns `true` if a scripted global camera shake is currently in effect, otherwise `false`. + +## Examples +```lua +-- Print whether a global camera shake is currently active +print(IsScriptGlobalShaking()) +``` +```js +// Print whether a global camera shake is currently active +console.log(IsScriptGlobalShaking()); +``` +```csharp +using static CitizenFX.Core.Native.API; + +// Print whether a global camera shake is currently active +Debug.WriteLine(IsScriptGlobalShaking()); +``` \ No newline at end of file diff --git a/CAM/SetCamFov.md b/CAM/SetCamFov.md index 62ca23e08..37c0b8622 100644 --- a/CAM/SetCamFov.md +++ b/CAM/SetCamFov.md @@ -8,14 +8,12 @@ ns: CAM void SET_CAM_FOV(Cam cam, float fieldOfView); ``` +Adjusts the field of view (FOV) for a specified camera, allowing for a wider or narrower perspective of the game world. The field of view is measured in degrees and affects how much of the game world is visible at any given moment through the camera. + ``` -Sets the field of view of the cam. ---------------------------------------------- -Min: 1.0f -Max: 130.0f +NativeDB Introduced: v323 ``` ## Parameters -* **cam**: -* **fieldOfView**: - +* **cam**: The camera whose FOV is being set. +* **fieldOfView**: The new FOV value, in degrees. Valid range is from `1.0f` (minimum FOV, for a very narrow view) to `130.0f` (maximum FOV, for a very wide view). \ No newline at end of file diff --git a/CAM/StopGameplayHint.md b/CAM/StopGameplayHint.md index cd7e08222..2901aa7db 100644 --- a/CAM/StopGameplayHint.md +++ b/CAM/StopGameplayHint.md @@ -5,10 +5,14 @@ ns: CAM ```c // 0xF46C581C61718916 0x1BC28B7B -void STOP_GAMEPLAY_HINT(BOOL p0); +void STOP_GAMEPLAY_HINT(BOOL bStopImmediately); ``` +Terminates the current gameplay hint camera, with an option for immediate cessation or a gradual fade out. -## Parameters -* **p0**: +``` +NativeDB Introduced: v323 +``` +## Parameters +* **bStopImmediately**: Specifies whether the gameplay hint camera should stop instantly `true` or gradually transition out `false`. \ No newline at end of file diff --git a/CAM/StopRenderingScriptCamsUsingCatchUp.md b/CAM/StopRenderingScriptCamsUsingCatchUp.md index e9f13e101..61562d4a4 100644 --- a/CAM/StopRenderingScriptCamsUsingCatchUp.md +++ b/CAM/StopRenderingScriptCamsUsingCatchUp.md @@ -6,19 +6,58 @@ aliases: ["0xC819F3CBB62BF692","_RENDER_FIRST_PERSON_CAM"] ```c // 0xC819F3CBB62BF692 0xD3C08183 -void STOP_RENDERING_SCRIPT_CAMS_USING_CATCH_UP(BOOL render, float p1, int p2); +void STOP_RENDERING_SCRIPT_CAMS_USING_CATCH_UP(BOOL bShouldApplyAcrossAllThreads, float distanceToBlend, int blendType); +``` + +Instructs the game engine to stop rendering scripted cameras and transition back to the gameplay camera, optionally applying custom blending and rendering options. + +```c +enum eRenderingOptionFlags { + RO_NO_OPTIONS = 0, + RO_STOP_RENDERING_OPTION_WHEN_PLAYER_EXITS_INTO_COVER = 1 +}; +``` + +```c +enum eCamSplineSmoothingFlags { + CAM_SPLINE_NO_SMOOTH = 0, // No smoothing just moves at a constant rate + CAM_SPLINE_SLOW_IN_SMOOTH = 1, // Decelerates when approaching a node + CAM_SPLINE_SLOW_OUT_SMOOTH = 2, // Accelerates slowly when leaving a node + CAM_SPLINE_SLOW_IN_OUT_SMOOTH = 3, // Decelerates when approaching a node and accelerates slowly when leaving a node + CAM_SPLINE_VERY_SLOW_IN = 4, + CAM_SPLINE_VERY_SLOW_OUT = 5, + CAM_SPLINE_VERY_SLOW_IN_SLOW_OUT = 6, + CAM_SPLINE_SLOW_IN_VERY_SLOW_OUT = 7, + CAM_SPLINE_VERY_SLOW_IN_VERY_SLOW_OUT = 8, + CAM_SPLINE_EASE_IN = 9, + CAM_SPLINE_EASE_OUT = 10, + CAM_SPLINE_QUADRATIC_EASE_IN = 11, + CAM_SPLINE_QUADRATIC_EASE_OUT = 12, + CAM_SPLINE_QUADRATIC_EASE_IN_OUT = 13, + CAM_SPLINE_CUBIC_EASE_IN = 14, + CAM_SPLINE_CUBIC_EASE_OUT = 15, + CAM_SPLINE_CUBIC_EASE_IN_OUT = 16, + CAM_SPLINE_QUARTIC_EASE_IN = 17, + CAM_SPLINE_QUARTIC_EASE_OUT = 18, + CAM_SPLINE_QUARTIC_EASE_IN_OUT = 19, + CAM_SPLINE_QUINTIC_EASE_IN = 20, + CAM_SPLINE_QUINTIC_EASE_OUT = 21, + CAM_SPLINE_QUINTIC_EASE_IN_OUT = 22, + CAM_SPLINE_CIRCULAR_EASE_IN = 23, + CAM_SPLINE_CIRCULAR_EASE_OUT = 24, + CAM_SPLINE_CIRCULAR_EASE_IN_OUT = 25 +}; ``` ``` -This native makes the gameplay camera zoom into first person/third person with a special effect. +NativeDB Added Parameter 4: int renderingOptions : An integer bitmask of eRenderingOptionFlags to apply specific rendering behaviors during the transition. RO_NO_OPTIONS signifies no special options are applied. ``` ``` -NativeDB Added Parameter 4: Any p3 +NativeDB Introduced: v323 ``` ## Parameters -* **render**: -* **p1**: -* **p2**: - +* **bShouldApplyAcrossAllThreads**: If `true`, ensures that the rendering stop request is enforced regardless of other script threads that might still expect rendering to be active. Use with caution to avoid conflicts. +* **distanceToBlend**: Specifies the distance over which the camera should blend from the scripted camera back to the gameplay camera. A value of `0.0` uses the game's default blending distance. +* **blendType**: An integer representing `eCamSplineSmoothingFlags` to determine the smoothness of the camera transition. Common values include `CAM_SPLINE_SLOW_IN_OUT_SMOOTH` among others, defining the easing of the blend. diff --git a/CAM/StopScriptGlobalShaking.md b/CAM/StopScriptGlobalShaking.md index efbf65753..651ef82ee 100644 --- a/CAM/StopScriptGlobalShaking.md +++ b/CAM/StopScriptGlobalShaking.md @@ -6,16 +6,37 @@ aliases: ["0x1C9D7949FA533490"] ```c // 0x1C9D7949FA533490 0x26FCFB96 -void STOP_SCRIPT_GLOBAL_SHAKING(BOOL p0); +void STOP_SCRIPT_GLOBAL_SHAKING(BOOL bStopImmediately); ``` +Stops the currently active global camera shake that was initiated by a script. You can check if a global camera shake is active using [IS_SCRIPT_GLOBAL_SHAKING](#_0xC912AF078AF19212). + ``` -In drunk_controller.c4, sub_309 -if (CAM::IS_SCRIPT_GLOBAL_SHAKING()) { - CAM::STOP_SCRIPT_GLOBAL_SHAKING(0); -} +NativeDB Introduced: v323 ``` ## Parameters -* **p0**: +* **bStopImmediately**: A boolean indicating whether the camera shake should stop instantly (TRUE) or gradually fade out (FALSE). +## Examples +```lua +-- Stops the currently active global camera shake with a gradual fade out +if IsScriptGlobalShaking() then + StopScriptGlobalShaking(false) +end +``` +```js +// Stops the currently active global camera shake with a gradual fade out +if (IsScriptGlobalShaking()) { + StopScriptGlobalShaking(false); +} +``` +```csharp +using static CitizenFX.Core.Native.API; + +// Stops the currently active global camera shake with a gradual fade out +if (IsScriptGlobalShaking()) +{ + StopScriptGlobalShaking(false); +} +``` \ No newline at end of file diff --git a/CAM/UseStuntCameraThisFrame.md b/CAM/UseStuntCameraThisFrame.md deleted file mode 100644 index 962503537..000000000 --- a/CAM/UseStuntCameraThisFrame.md +++ /dev/null @@ -1,11 +0,0 @@ ---- -ns: CAM -aliases: ["0x6493CF69859B116A"] ---- -## _USE_STUNT_CAMERA_THIS_FRAME - -```c -// 0x6493CF69859B116A -void _USE_STUNT_CAMERA_THIS_FRAME(); -``` - diff --git a/CAM/UseVehicleCamStuntSettingsThisUpdate.md b/CAM/UseVehicleCamStuntSettingsThisUpdate.md new file mode 100644 index 000000000..078d484f6 --- /dev/null +++ b/CAM/UseVehicleCamStuntSettingsThisUpdate.md @@ -0,0 +1,16 @@ +--- +ns: CAM +aliases: ["0x6493CF69859B116A", "_USE_STUNT_CAMERA_THIS_FRAME"] +--- +## USE_VEHICLE_CAM_STUNT_SETTINGS_THIS_UPDATE + +```c +// 0x6493CF69859B116A +void USE_VEHICLE_CAM_STUNT_SETTINGS_THIS_UPDATE(); +``` + +Applies a predefined set of vehicle camera settings optimized for capturing stunts, effective for the current game update/frame. + +``` +NativeDB Introduced: v791 +```