Skip to content

Commit

Permalink
feat(natives/CAM): work on CAM natives (#1036)
Browse files Browse the repository at this point in the history
* 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 <[email protected]>
  • Loading branch information
spacevx and 4mmonium authored Mar 4, 2024
1 parent 9fff6e4 commit 623ad46
Show file tree
Hide file tree
Showing 7 changed files with 121 additions and 38 deletions.
24 changes: 20 additions & 4 deletions CAM/IsScriptGlobalShaking.md
Original file line number Diff line number Diff line change
Expand Up @@ -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());
```
12 changes: 5 additions & 7 deletions CAM/SetCamFov.md
Original file line number Diff line number Diff line change
Expand Up @@ -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).
10 changes: 7 additions & 3 deletions CAM/StopGameplayHint.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`.
53 changes: 46 additions & 7 deletions CAM/StopRenderingScriptCamsUsingCatchUp.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
33 changes: 27 additions & 6 deletions CAM/StopScriptGlobalShaking.md
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
```
11 changes: 0 additions & 11 deletions CAM/UseStuntCameraThisFrame.md

This file was deleted.

16 changes: 16 additions & 0 deletions CAM/UseVehicleCamStuntSettingsThisUpdate.md
Original file line number Diff line number Diff line change
@@ -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
```

0 comments on commit 623ad46

Please sign in to comment.