Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document various HUD/CAM natives #933

Closed
wants to merge 12 commits into from
37 changes: 27 additions & 10 deletions CAM/AnimatedShakeCam.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,35 @@ ns: CAM

```c
// 0xA2746EEAE3E577CD 0xE1168767
void ANIMATED_SHAKE_CAM(Cam cam, char* p1, char* p2, char* p3, float amplitude);
void ANIMATED_SHAKE_CAM(Cam cam, char* animDict, char* animName, char* p3, float amplitude);
```

```
Example from michael2 script.
CAM::ANIMATED_SHAKE_CAM(l_5069, "shake_cam_all@", "light", "", 1f);
```
Makes a camera shake with specific animation dictionary.

## Parameters
* **cam**:
* **p1**:
* **p2**:
* **p3**:
* **amplitude**:
* **cam**: Cam ID
* **animDict**: Animation dictionary of this shake. Must be requested with (REQUEST_ANIM_DICT)(#_0xD3BD40951412FEF6)
* **animName**: Animation name
* **p3**: Unknown. In scripts, only "" is used
* **amplitude**: Strength of the cam shake

## Examples
```lua
RegisterCommand('viewvinewood', function()
RequestAnimDict('shake_cam_all@') -- Request the shake animation dictionary

while not HasAnimDictLoaded('shake_cam_all@') do Wait(0) end -- Wait for the dictionary to load

local camID = CreateCam('DEFAULT_SCRIPTED_CAMERA', true)
SetCamRot(camID, 1.07, 0.0, -26.70, 2) -- Rotate the camera to face the vinewood sign
SetCamCoord(camID, 573.5313, 905.455, 305.432) -- Set the camera location
AnimatedShakeCam(camID, 'shake_cam_all@', 'light', '', 0.5) -- Play the shake animation on the camera
RemoveAnimDict('shake_cam_all@') -- Unload the dictionary

RenderScriptCams(true, false, 3000, true, false, 0) -- Render the camera

BeginTextCommandDisplayHelp('STRING')
AddTextComponentSubstringPlayerName('You are now looking at the beautiful Vinewood sign.')
EndTextCommandDisplayHelp(0, false, true, -1)
end)
```
15 changes: 6 additions & 9 deletions CAM/AnimatedShakeScriptGlobal.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,13 @@ aliases: ["0xC2EAE3FB8CDBED31"]

```c
// 0xC2EAE3FB8CDBED31 0xCB75BD9C
void ANIMATED_SHAKE_SCRIPT_GLOBAL(char* p0, char* p1, char* p2, float p3);
void ANIMATED_SHAKE_SCRIPT_GLOBAL(char* animDict, char* animName, char* p2, float amplitude);
```

```
CAM::ANIMATED_SHAKE_SCRIPT_GLOBAL("SHAKE_CAM_medium", "medium", "", 0.5f);
```
Makes every script-created camera shake with a specific anim dictionary.

## Parameters
* **p0**:
* **p1**:
* **p2**:
* **p3**:

* **animDict**: Anim dictionary to shake the cameras with. Must be requested with (REQUEST_ANIM_DICT)(#_0xD3BD40951412FEF6)
* **animName**: Animation name
* **p2**: Unknown. Only "" is used in scripts.
* **amplitude**: Strength of the shake
3 changes: 2 additions & 1 deletion CAM/IsCamShaking.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ BOOL IS_CAM_SHAKING(Cam cam);


## Parameters
* **cam**:
* **cam**: Cam ID returned by [CREATE_CAM](#_0xC3981DCE61D9E13F)

## Return value
Whether or not this cam was set to shake with [SHAKE_CAM](#_0x6A25241C340D3822)
1 change: 1 addition & 0 deletions CAM/IsCinematicCamShaking.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ BOOL IS_CINEMATIC_CAM_SHAKING();


## Return value
Whether or not the cinematic/idle cam was set to shake with [SHAKE_CINEMATIC_CAM](#_0xDCE214D9ED58F3CF)
1 change: 1 addition & 0 deletions CAM/IsGameplayCamShaking.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ BOOL IS_GAMEPLAY_CAM_SHAKING();


## Return value
Whether or not the gameplay cam was set to shake with [SHAKE_GAMEPLAY_CAM](#_0xFD55E49555E017CF)
8 changes: 1 addition & 7 deletions CAM/IsScriptGlobalShaking.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,5 @@ aliases: ["0xC912AF078AF19212"]
BOOL IS_SCRIPT_GLOBAL_SHAKING();
```

```
In drunk_controller.c4, sub_309
if (CAM::IS_SCRIPT_GLOBAL_SHAKING()) {
CAM::STOP_SCRIPT_GLOBAL_SHAKING(0);
}
```

## Return value
Whether or not every camera has been set to shake with [SCRIPT_GLOBAL_SHAKE](#_0xF4C8CF9E353AFECA)
30 changes: 28 additions & 2 deletions CAM/SetCamDofStrength.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,34 @@ ns: CAM
void SET_CAM_DOF_STRENGTH(Cam cam, float dofStrength);
```

Specifies how much the DoF effect should be applied (Set using [`SET_CAM_NEAR_DOF`](#_0x3FA4BF0A7AB7DE2C), [`SET_CAM_FAR_DOF`](#_0xEDD91296CD01AEE0), etc.)

## Parameters
* **cam**:
* **dofStrength**:
* **cam**: The camera handle
* **dofStrength**: Depth of Field strength (between 0.0 and 1.0)

## Examples
```lua
CreateThread(function()
local camera = CreateCam("DEFAULT_SCRIPTED_FLY_CAMERA", true)
-- Set the cam coordinates to the player coords
local playerCoords = GetEntityCoords(PlayerPedId())
SetCamCoord(camera, playerCoords)
-- Render the camera we just created
RenderScriptCams(true)
-- Use a shallow depth of field
SetCamUseShallowDofMode(camera, true)
-- Set at what distance your camera should start to focus (Example: 0.7 meters)
SetCamNearDof(camera, 0.7)
-- Set at what distance your camera should stop focusing (Example: 1.3 meters)
SetCamFarDof(camera, 1.3)
-- Apply 100% of the DoF effect (The native you're reading documentation on)
SetCamDofStrength(camera, 1.0)

while DoesCamExist(camera) do
-- Use DoF effect (needs to be called every tick)
SetUseHiDof()
Citizen.Wait(0)
end
end)
```
9 changes: 6 additions & 3 deletions CAM/SetCamFarDof.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,11 @@ ns: CAM
void SET_CAM_FAR_DOF(Cam cam, float farDOF);
```

Specifies when the camera should stop being in focus. Can be used together with [`SET_USE_HI_DOF`](#_0xA13B0222F3D94A94), [`SET_CAM_NEAR_DOF`](#_0x3FA4BF0A7AB7DE2C), [`SET_CAM_USE_SHALLOW_DOF_MODE`](#_0x16A96863A17552BB), [`SET_CAM_DOF_STRENGTH`](#_0x5EE29B4D7D5DF897) and other DoF related natives.

## Parameters
* **cam**:
* **farDOF**:
### Usage Example
A usage example for this native can be found in the following native documentation: [`SET_CAM_DOF_STRENGTH`](#_0x5EE29B4D7D5DF897).

## Parameters
* **cam**: The camera handle
* **farDOF**: Distance in in standard units
10 changes: 7 additions & 3 deletions CAM/SetCamNearDof.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,12 @@ ns: CAM
void SET_CAM_NEAR_DOF(Cam cam, float nearDOF);
```

Specifies when the camera should start being in focus. Can be used together with [`SET_USE_HI_DOF`](#_0xA13B0222F3D94A94), [`SET_CAM_FAR_DOF`](#_0xEDD91296CD01AEE0), [`SET_CAM_USE_SHALLOW_DOF_MODE`](#_0x16A96863A17552BB), [`SET_CAM_DOF_STRENGTH`](#_0x5EE29B4D7D5DF897) and other DoF related natives.

## Parameters
* **cam**:
* **nearDOF**:

### Usage Example
A usage example for this native can be found in the following native documentation: [`SET_CAM_DOF_STRENGTH`](#_0x5EE29B4D7D5DF897).

## Parameters
* **cam**: The camera handle
* **nearDOF**: Distance in in standard units
10 changes: 7 additions & 3 deletions CAM/SetCamUseShallowDofMode.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,12 @@ ns: CAM
void SET_CAM_USE_SHALLOW_DOF_MODE(Cam cam, BOOL toggle);
```

Enables or disables the usage of a shallow DOF. Needs to be set to true to use [`SET_CAM_NEAR_DOF`](#_0x3FA4BF0A7AB7DE2C), [`SET_CAM_FAR_DOF`](#_0xEDD91296CD01AEE0), etc. Doesn't need to be called every tick.

## Parameters
* **cam**:
* **toggle**:

### Usage Example
A usage example for this native can be found in the following native documentation: [`SET_CAM_DOF_STRENGTH`](#_0x5EE29B4D7D5DF897).

## Parameters
* **cam**: The camera handle
* **toggle**: Boolean if the camera should use a shallow depth of field or not
4 changes: 4 additions & 0 deletions CAM/SetUseHiDof.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,8 @@ ns: CAM
void SET_USE_HI_DOF();
```

Needs to be called every tick to make the active camera use a high depth of field.
The DoF can be customized using [`SET_CAM_NEAR_DOF`](#_0x3FA4BF0A7AB7DE2C), [`SET_CAM_FAR_DOF`](#_0xEDD91296CD01AEE0), [`SET_CAM_USE_SHALLOW_DOF_MODE`](#_0x16A96863A17552BB), [`SET_CAM_DOF_STRENGTH`](#_0x5EE29B4D7D5DF897) and other DoF related natives.

### Usage Example
A usage example for this native can be found in the following native documentation: [`SET_CAM_DOF_STRENGTH`](#_0x5EE29B4D7D5DF897).
22 changes: 5 additions & 17 deletions CAM/ShakeCam.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,11 @@ ns: CAM
void SHAKE_CAM(Cam cam, char* type, float amplitude);
```

```
Possible shake types (updated b617d):
DEATH_FAIL_IN_EFFECT_SHAKE
DRUNK_SHAKE
FAMILY5_DRUG_TRIP_SHAKE
HAND_SHAKE
JOLT_SHAKE
LARGE_EXPLOSION_SHAKE
MEDIUM_EXPLOSION_SHAKE
SMALL_EXPLOSION_SHAKE
ROAD_VIBRATION_SHAKE
SKY_DIVING_SHAKE
VIBRATE_SHAKE
```
Makes a cam shake.
[Shake Type List](https://github.com/DurtyFree/gta-v-data-dumps/blob/master/camShakeTypesCompact.json)

## Parameters
* **cam**:
* **type**:
* **amplitude**:
* **cam**: Cam ID, returned by [CREATE_CAM](#_0xC3981DCE61D9E13F)
* **type**: How the cam should shake
* **amplitude**: Strength of the cam shake

11 changes: 5 additions & 6 deletions CAM/ShakeCinematicCam.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,13 @@ ns: CAM

```c
// 0xDCE214D9ED58F3CF 0x61815F31
void SHAKE_CINEMATIC_CAM(char* p0, float p1);
void SHAKE_CINEMATIC_CAM(char* shakeType, float amplitude);
```

```
p0 argument found in the b617d scripts: "DRUNK_SHAKE"
```
Makes the cinematic/idle cam shake.
[Shake Type List](https://github.com/DurtyFree/gta-v-data-dumps/blob/master/camShakeTypesCompact.json)

## Parameters
* **p0**:
* **p1**:
* **shakeType**: How the cinematic cam should shake
* **amplitude**: Float value that represents the strength of the shake

22 changes: 5 additions & 17 deletions CAM/ShakeGameplayCam.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,13 @@ ns: CAM

```c
// 0xFD55E49555E017CF 0xF2EFE660
void SHAKE_GAMEPLAY_CAM(char* shakeName, float intensity);
void SHAKE_GAMEPLAY_CAM(char* shakeType, float amplitude);
```

```
Possible shake types (updated b617d):
DEATH_FAIL_IN_EFFECT_SHAKE
DRUNK_SHAKE
FAMILY5_DRUG_TRIP_SHAKE
HAND_SHAKE
JOLT_SHAKE
LARGE_EXPLOSION_SHAKE
MEDIUM_EXPLOSION_SHAKE
SMALL_EXPLOSION_SHAKE
ROAD_VIBRATION_SHAKE
SKY_DIVING_SHAKE
VIBRATE_SHAKE
```
Makes the gameplay cam shake.
[Shake Type List](https://github.com/DurtyFree/gta-v-data-dumps/blob/master/camShakeTypesCompact.json)

## Parameters
* **shakeName**:
* **intensity**:
* **shakeType**: How the gameplay cam should shake
* **amplitude**: Float value that represents the strength of the shake

11 changes: 5 additions & 6 deletions CAM/ShakeScriptGlobal.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,13 @@ aliases: ["0xF4C8CF9E353AFECA"]

```c
// 0xF4C8CF9E353AFECA 0x2B0F05CD
void SHAKE_SCRIPT_GLOBAL(char* p0, float p1);
void SHAKE_SCRIPT_GLOBAL(char* shakeType, float amplitude);
```

```
CAM::SHAKE_SCRIPT_GLOBAL("HAND_SHAKE", 0.2);
```
Makes every script-created camera shake.
[Shake Type List](https://github.com/DurtyFree/gta-v-data-dumps/blob/master/camShakeTypesCompact.json)

## Parameters
* **p0**:
* **p1**:
* **shakeType**: How the cameras should shake
* **amplitude**: Float value that represents the strength of the shake

6 changes: 3 additions & 3 deletions CAM/StopCamShaking.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ ns: CAM

```c
// 0xBDECF64367884AC3 0x40D0EB87
void STOP_CAM_SHAKING(Cam cam, BOOL p1);
void STOP_CAM_SHAKING(Cam cam, BOOL instantly);
```


## Parameters
* **cam**:
* **p1**:
* **cam**: Cam ID
* **instantly**: If false, the camera will transition into normal state. If true, the camera will stop shaking instantly.

4 changes: 2 additions & 2 deletions CAM/StopCinematicCamShaking.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ ns: CAM

```c
// 0x2238E588E588A6D7 0x71C12904
void STOP_CINEMATIC_CAM_SHAKING(BOOL p0);
void STOP_CINEMATIC_CAM_SHAKING(BOOL instantly);
```


## Parameters
* **p0**:
* **instantly**: If false, the cinematic/idle camera will transition into normal state. If true, the camera will stop shaking instantly.

4 changes: 2 additions & 2 deletions CAM/StopGameplayCamShaking.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ ns: CAM

```c
// 0x0EF93E9F3D08C178 0xFD569E4E
void STOP_GAMEPLAY_CAM_SHAKING(BOOL p0);
void STOP_GAMEPLAY_CAM_SHAKING(BOOL instantly);
```


## Parameters
* **p0**:
* **instantly**: If false, the gameplay camera will transition into normal state. If true, the camera will stop shaking instantly.

11 changes: 3 additions & 8 deletions CAM/StopScriptGlobalShaking.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,11 @@ aliases: ["0x1C9D7949FA533490"]

```c
// 0x1C9D7949FA533490 0x26FCFB96
void STOP_SCRIPT_GLOBAL_SHAKING(BOOL p0);
void STOP_SCRIPT_GLOBAL_SHAKING(BOOL instantly);
```

```
In drunk_controller.c4, sub_309
if (CAM::IS_SCRIPT_GLOBAL_SHAKING()) {
CAM::STOP_SCRIPT_GLOBAL_SHAKING(0);
}
```
Stops shaking script-created cameras.

## Parameters
* **p0**:
* **instantly**: If false, currently rendering camera will transition into normal state. If true, the cameras will stop shaking instantly.

Loading
Loading