Skip to content

Commit

Permalink
add named parameters and correct types for some natives (#1204)
Browse files Browse the repository at this point in the history
* add named parameters and correct types for some natives

* document IS_ENTITY_AT_ENTITY

* document PLAY_ENTITY_ANIM

* document PLAY_SYNCHRONIZED_ENTITY_ANIM

* document PLAY_SYNCHRONIZED_MAP_ENTITY_ANIM

* some more docs

* fix type

* Update ENTITY/PlaySynchronizedEntityAnim.md

Co-authored-by: Dillon Skaggs <dillskaggs@gmail.com>

* Update ENTITY/PlaySynchronizedMapEntityAnim.md

Co-authored-by: Dillon Skaggs <dillskaggs@gmail.com>

* fix

* fix missmatched names

* tweak: keep consistent language for enum

---------

Co-authored-by: Dillon Skaggs <dillskaggs@gmail.com>
  • Loading branch information
coalaura and AvarianKnight authored Jan 23, 2025
1 parent 5fbf261 commit 6a32031
Show file tree
Hide file tree
Showing 8 changed files with 89 additions and 81 deletions.
4 changes: 2 additions & 2 deletions ENTITY/CreateModelSwap.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ ns: ENTITY

```c
// 0x92C47782FDA8B2A3 0x0BC12F9E
void CREATE_MODEL_SWAP(float x, float y, float z, float radius, Hash originalModel, Hash newModel, BOOL p6);
void CREATE_MODEL_SWAP(float x, float y, float z, float radius, Hash originalModel, Hash newModel, BOOL bSurviveMapReload);
```
```
Expand All @@ -20,5 +20,5 @@ Network players do not see changes done with this.
* **radius**:
* **originalModel**:
* **newModel**:
* **p6**:
* **bSurviveMapReload**:
29 changes: 17 additions & 12 deletions ENTITY/IsEntityAtEntity.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,27 @@ ns: ENTITY

```c
// 0x751B70C3D034E187 0xDABDCB52
BOOL IS_ENTITY_AT_ENTITY(Entity entity1, Entity entity2, float xSize, float ySize, float zSize, BOOL p5, BOOL p6, int p7);
BOOL IS_ENTITY_AT_ENTITY(Entity entity, Entity target, float xSize, float ySize, float zSize, BOOL highlightArea, BOOL do3dCheck, int transportMode);
```
```
Checks if entity1 is within the box defined by x/y/zSize of entity2.
Last three parameters are almost alwasy p5 = 0, p6 = 1, p7 = 0
Checks if entity is within the specified axis aligned box around the target entity.
```c
enum eTransportMode {
SCRIPT_TM_ANY = 0,
SCRIPT_TM_ON_FOOT = 1,
SCRIPT_TM_IN_VEHICLE = 2
};
```

## Parameters
* **entity1**:
* **entity2**:
* **xSize**:
* **ySize**:
* **zSize**:
* **p5**:
* **p6**:
* **p7**:
* **entity**: The source entity handle.
* **target**: The target entity handle.
* **xSize**: The x size of the axis aligned box around the target entity to check.
* **ySize**: The y size of the axis aligned box around the target entity to check.
* **zSize**: The z size of the axis aligned box around the target entity to check.
* **highlightArea**:
* **do3dCheck**: If the check should be 2d or 3d.
* **transportMode**: The transport mode. Returns early if the entity is not in that mode of transportation.

## Return value
25 changes: 10 additions & 15 deletions ENTITY/PlayEntityAnim.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,20 @@ ns: ENTITY

```c
// 0x7FB218262B810701 0x878753D5
BOOL PLAY_ENTITY_ANIM(Entity entity, char* animName, char* animDict, float p3, BOOL loop, BOOL stayInAnim, BOOL p6, float delta, Any bitset);
```
```
delta and bitset are guessed fields. They are based on the fact that most of the calls have 0 or nil field types passed in.
The only time bitset has a value is 0x4000 and the only time delta has a value is during stealth with usually <1.0f values.
BOOL PLAY_ENTITY_ANIM(Entity entity, char* animName, char* animDict, float fBlendDelta, BOOL bLoop, BOOL bHoldLastFrame, BOOL bDriveToPose, float fStartPhase, int iFlags);
```
[Animations list](https://alexguirre.github.io/animations-list/)
## Parameters
* **entity**:
* **animName**:
* **animDict**:
* **p3**:
* **loop**:
* **stayInAnim**:
* **p6**:
* **delta**:
* **bitset**:
* **entity**: The entity handle to play the animation on.
* **animName**: The name of the animation to play.
* **animDict**: The name of the animation dictionary to use.
* **fBlendDelta**: Blend in and out time.
* **bLoop**: Sets `AF_LOOPING` in the flags.
* **bHoldLastFrame**: Sets `AF_HOLD_LAST_FRAME` in the flags.
* **bDriveToPose**: unused
* **fStartPhase**: Clamped between `0.0` and `1.0`. Sets the start phase of the animation.
* **iFlags**: The flags to use when playing the animation. See [`TASK_PLAY_ANIM`](#_0xEA47FE3719165B94).
## Return value
22 changes: 9 additions & 13 deletions ENTITY/PlaySynchronizedEntityAnim.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,19 @@ ns: ENTITY

```c
// 0xC77720A12FE14A86 0x012760AA
BOOL PLAY_SYNCHRONIZED_ENTITY_ANIM(Entity entity, int syncedScene, char* animation, char* propName, float p4, float p5, Any p6, float p7);
```
```
p4 and p7 are usually 1000.0f.
BOOL PLAY_SYNCHRONIZED_ENTITY_ANIM(Entity entity, int syncedScene, char* animName, char* animDictName, float fBlendInDelta, float fBlendOutDelta, int iFlags, float fMoverBlendInDelta);
```
[Animations list](https://alexguirre.github.io/animations-list/)
## Parameters
* **entity**:
* **syncedScene**:
* **animation**:
* **propName**:
* **p4**:
* **p5**:
* **p6**:
* **p7**:
* **entity**: The entity handle to play the animation on.
* **syncedScene**:
* **animName**: The name of the animation to play.
* **animDictName**: The name of the animation dictionary to use.
* **fBlendInDelta**: Blend in time.
* **fBlendOutDelta**: Blend out time.
* **iFlags**: The flags to use when playing the animation. See [`TASK_PLAY_ANIM`](#_0xEA47FE3719165B94).
* **fMoverBlendInDelta**:
## Return value
26 changes: 13 additions & 13 deletions ENTITY/PlaySynchronizedMapEntityAnim.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,23 @@ ns: ENTITY

```c
// 0xB9C54555ED30FBC4 0xEB4CBA74
BOOL PLAY_SYNCHRONIZED_MAP_ENTITY_ANIM(float p0, float p1, float p2, float p3, Any p4, Any p5, Any* p6, Any* p7, float p8, float p9, Any p10, float p11);
BOOL PLAY_SYNCHRONIZED_MAP_ENTITY_ANIM(float x, float y, float z, float radius, cs_type(Any) Hash objectModelHash, int sceneId, cs_type(AnyPtr) char* pAnimName, cs_type(AnyPtr) char* pAnimDictName, float fBlendDelta, float fBlendOutDelta, int flags, float fMoverBlendInDelta);
```
[Animations list](https://alexguirre.github.io/animations-list/)
## Parameters
* **p0**:
* **p1**:
* **p2**:
* **p3**:
* **p4**:
* **p5**:
* **p6**:
* **p7**:
* **p8**:
* **p9**:
* **p10**:
* **p11**:
* **x**:
* **y**:
* **z**:
* **radius**:
* **objectModelHash**:
* **sceneId**:
* **pAnimName**: The name of the animation to play.
* **pAnimDictName**: The name of the animation dictionary to use.
* **fBlendDelta**: Blend in time.
* **fBlendOutDelta**: Blend out time.
* **flags**: The flags to use when playing the animation. See [`TASK_PLAY_ANIM`](#_0xEA47FE3719165B94).
* **fMoverBlendInDelta**:
## Return value
8 changes: 4 additions & 4 deletions ENTITY/RemoveModelSwap.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ ns: ENTITY

```c
// 0x033C0F9A64E229AE 0xCE0AA8BC
void REMOVE_MODEL_SWAP(float x, float y, float z, float radius, Hash originalModel, Hash newModel, BOOL p6);
void REMOVE_MODEL_SWAP(float x, float y, float z, float radius, Hash oldModelHash, Hash newModelHash, BOOL bLazy);
```
Expand All @@ -14,7 +14,7 @@ void REMOVE_MODEL_SWAP(float x, float y, float z, float radius, Hash originalMod
* **y**:
* **z**:
* **radius**:
* **originalModel**:
* **newModel**:
* **p6**:
* **oldModelHash**:
* **newModelHash**:
* **bLazy**:
14 changes: 7 additions & 7 deletions PED/SetPedToRagdoll.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ ns: PED

```c
// 0xAE99FB955581844A 0x83CB5052
BOOL SET_PED_TO_RAGDOLL(Ped ped, int time1, int time2, int ragdollType, BOOL p4, BOOL p5, BOOL p6);
BOOL SET_PED_TO_RAGDOLL(Ped ped, int minTime, int maxTime, int ragdollType, BOOL bAbortIfInjured, BOOL bAbortIfDead, BOOL bForceScriptControl);
```
p4/p5: Unusued in TU27
Expand All @@ -16,12 +16,12 @@ p4/p5: Unusued in TU27
**Else**: CTaskNMBalance
## Parameters
* **ped**:
* **time1**: Time(ms) Ped is in ragdoll mode; only applies to ragdoll types 0 and not 1.
* **time2**:
* **ped**: The ped to ragdoll.
* **minTime**: Time(ms) Ped is in ragdoll mode; only applies to ragdoll types 0 and not 1.
* **maxTime**:
* **ragdollType**:
* **p4**:
* **p5**:
* **p6**:
* **bAbortIfInjured**: unused
* **bAbortIfDead**: unused
* **bForceScriptControl**:
## Return value
42 changes: 27 additions & 15 deletions PED/SetPedToRagdollWithFall.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,19 @@ ns: PED

```c
// 0xD76632D99E4966C8 0xFA12E286
BOOL SET_PED_TO_RAGDOLL_WITH_FALL(Ped ped, int time, int p2, int ragdollType, float x, float y, float z, float p7, float p8, float p9, float p10, float p11, float p12, float p13);
BOOL SET_PED_TO_RAGDOLL_WITH_FALL(Ped ped, int minTime, int maxTime, int nFallType, float dirX, float dirY, float dirZ, float fGroundHeight, float grab1X, float grab1Y, float grab1Z, float grab2X, float grab2Y, float grab2Z);
```
```c
enum eNMFallType {
TYPE_FROM_HIGH = 0,
TYPE_OVER_WALL = 1,
TYPE_DOWN_STAIRS = 2,
TYPE_DIE_TYPES = 3,
TYPE_DIE_FROM_HIGH = 4,
TYPE_DIE_OVER_WALL = 5,
TYPE_DIE_DOWN_STAIRS = 6
}
```

```
Expand All @@ -19,19 +31,19 @@ ped::set_ped_to_ragdoll_with_fall(ped, 1500, 2000, 1, -entity::get_entity_forwar
```

## Parameters
* **ped**:
* **time**:
* **p2**:
* **ragdollType**:
* **x**:
* **y**:
* **z**:
* **p7**:
* **p8**:
* **p9**:
* **p10**:
* **p11**:
* **p12**:
* **p13**:
* **ped**: The ped to ragdoll.
* **minTime**:
* **maxTime**:
* **nFallType**: The type of fall.
* **dirX**: The x direction of the fall.
* **dirY**: The y direction of the fall.
* **dirZ**: The z direction of the fall.
* **fGroundHeight**: The ground height (z).
* **grab1X**: unused
* **grab1Y**: unused
* **grab1Z**: unused
* **grab2X**: unused
* **grab2Y**: unused
* **grab2Z**: unused

## Return value

0 comments on commit 6a32031

Please sign in to comment.