Skip to content

Commit

Permalink
feat(natives): update WATER and SHAPETEST natives (#596)
Browse files Browse the repository at this point in the history
  • Loading branch information
AvarianKnight authored Jan 22, 2022
1 parent 1572531 commit 5ff31ee
Show file tree
Hide file tree
Showing 10 changed files with 66 additions and 69 deletions.
19 changes: 1 addition & 18 deletions SHAPETEST/StartExpensiveSynchronousShapeTestLosProbe.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,6 @@ Does the same as [START_SHAPE_TEST_LOS_PROBE](#_0x7EE9F5D83DD4F90E), except bloc
Use [START_SHAPE_TEST_LOS_PROBE](#_0x7EE9F5D83DD4F90E) instead. Literally. Rockstar named this correctly: it's expensive, and it's synchronous.
```
This function casts a ray from Point1 to Point2 and returns it's ray handle. A simple ray cast will 'shoot' a line from point A to point B, and return whether or not the ray reached it's destination or if it hit anything and if it did hit anything, will return the handle of what it hit (entity handle) and coordinates of where the ray reached.
You can use _GET_RAYCAST_RESULT to get the result of the raycast
Entity is an entity to ignore, such as the player.
Flags are intersection bit flags. They tell the ray what to care about and what not to care about when casting. Passing -1 will intersect with everything, presumably.
Flags:
1: Intersect with map
2: Intersect with vehicles (used to be mission entities?) (includes train)
4: Intersect with peds? (same as 8)
8: Intersect with peds? (same as 4)
16: Intersect with objects
32: Water?
64: Unknown
128: Unknown
256: Intersect with vegetation (plants, coral. trees not included)
NOTE: Raycasts that intersect with mission_entites (flag = 2) has limited range and will not register for far away entites. The range seems to be about 30 metres.
```
## Parameters
* **x1**: Starting X coordinate.
Expand All @@ -38,7 +21,7 @@ NOTE: Raycasts that intersect with mission_entites (flag = 2) has limited range
* **x2**: Ending X coordinate.
* **y2**: Ending Y coordinate.
* **z2**: Ending Z coordinate.
* **flags**: Flags.
* **flags**: See [START_SHAPE_TEST_LOS_PROBE](#_0x7EE9F5D83DD4F90E).
* **entity**: An entity to ignore, or 0.
* **p8**: A bit mask with bits 1, 2 and/or 4, relating to collider types. 4 should usually be used.
Expand Down
1 change: 1 addition & 0 deletions SHAPETEST/StartShapeTestBound.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ aliases: ["0x37181417CE7C8900"]
int START_SHAPE_TEST_BOUND(Entity entity, int flags1, int flags2);
```
See [`START_SHAPE_TEST_LOS_PROBE`](#_0x7EE9F5D83DD4F90E) for flags.
## Parameters
* **entity**:
Expand Down
1 change: 1 addition & 0 deletions SHAPETEST/StartShapeTestBoundingBox.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ aliases: ["0x052837721A854EC7"]
int START_SHAPE_TEST_BOUNDING_BOX(Entity entity, int flags1, int flags2);
```
See [`START_SHAPE_TEST_LOS_PROBE`](#_0x7EE9F5D83DD4F90E) for flags.
## Parameters
* **entity**:
Expand Down
20 changes: 10 additions & 10 deletions SHAPETEST/StartShapeTestBox.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,24 @@ aliases: ["0xFE466162C4401D18"]

```c
// 0xFE466162C4401D18 0x249BC876
int START_SHAPE_TEST_BOX(float x, float y, float z, float x1, float y2, float z2, float rotX, float rotY, float rotZ, Any p9, int flags, Entity entity, Any p12);
int START_SHAPE_TEST_BOX(float x, float y, float z, float x1, float y1, float z1, float rotX, float rotY, float rotZ, int p9, int flags, Entity entity, int p12);
```
For more information, see [`START_EXPENSIVE_SYNCHRONOUS_SHAPE_TEST_LOS_PROBE`](#_0x377906D8A31E5586) and [`START_SHAPE_TEST_LOS_PROBE`](#_0x7EE9F5D83DD4F90E).
## Parameters
* **x**:
* **y**:
* **z**:
* **x1**:
* **y2**:
* **z2**:
* **x**: Starting X coordinate.
* **y**: Starting Y coordinate.
* **z**: Starting Z coordinate.
* **x1**: Ending X coordinate.
* **y1**: Ending Y coordinate.
* **z1**: Ending Z coordinate.
* **rotX**:
* **rotY**:
* **rotZ**:
* **p9**:
* **flags**:
* **p9**: Unknown, always 2 or 0
* **flags**: See [`START_SHAPE_TEST_LOS_PROBE`](#_0x7EE9F5D83DD4F90E)
* **entity**:
* **p12**:
* **p12**: A bit mask with bits 1, 2, 4, or 7 relating to collider types. 4 and 7 are usually used.
## Return value
27 changes: 10 additions & 17 deletions SHAPETEST/StartShapeTestCapsule.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,26 +9,19 @@ aliases: ["_CAST_3D_RAY_POINT_TO_POINT"]
int START_SHAPE_TEST_CAPSULE(float x1, float y1, float z1, float x2, float y2, float z2, float radius, int flags, Entity entity, int p9);
```
```
Raycast from point to point, where the ray has a radius.
flags:
vehicles=10
peds =12
Iterating through flags yields many ped / vehicle/ object combinations
p9 = 7, but no idea what it does
Entity is an entity to ignore
```
## Parameters
* **x1**:
* **y1**:
* **z1**:
* **x2**:
* **y2**:
* **z2**:
* **x1**: Starting X coordinate.
* **y1**: Starting Y coordinate.
* **z1**: Starting Z coordinate.
* **x2**: Ending X coordinate.
* **y2**: Ending Y coordinate.
* **z2**: Ending Z coordinate.
* **radius**:
* **flags**:
* **entity**:
* **p9**:
* **flags**: See [`START_SHAPE_TEST_LOS_PROBE`](#_0x7EE9F5D83DD4F90E)
* **entity**: Entity to ignore, or 0.
* **p9**: A bit mask with bits 1, 2, 4, or 7 relating to collider types. 4 and 7 are usually used.
## Return value
20 changes: 19 additions & 1 deletion SHAPETEST/StartShapeTestLosProbe.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,24 @@ int START_SHAPE_TEST_LOS_PROBE(float x1, float y1, float z1, float x2, float y2,
Asynchronously starts a line-of-sight (raycast) world probe shape test.
```cpp
enum TraceFlags
{
None = 0,
IntersectWorld = 1,
IntersectVehicles = 2,
IntersectPedsSimpleCollision = 4,
IntersectPeds = 8,
IntersectObjects = 16,
IntersectWater = 32,
Unknown = 128,
IntersectFoliage = 256,
IntersectEverything = 4294967295
}
```
NOTE: Raycasts that intersect with mission_entites (flag = 2) has limited range and will not register for far away entites. The range seems to be about 30 metres.


Use the handle with [GET_SHAPE_TEST_RESULT](#_0x3D87450E15D98694) or [GET_SHAPE_TEST_RESULT_INCLUDING_MATERIAL](#_0x65287525D951F6BE) until it returns 0 or 2.

## Parameters
Expand All @@ -22,7 +40,7 @@ Use the handle with [GET_SHAPE_TEST_RESULT](#_0x3D87450E15D98694) or [GET_SHAPE_
* **z2**: Ending Z coordinate.
* **flags**: Flags.
* **entity**: An entity to ignore, or 0.
* **p8**: A bit mask with bits 1, 2 and/or 4, relating to collider types. 4 should usually be used.
* **p8**: A bit mask with bits 1, 2, 4, or 7 relating to collider types. 4 and 7 are usually used.

## Return value
A shape test handle.
2 changes: 2 additions & 0 deletions SHAPETEST/StartShapeTestSurroundingCoords.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ it returns a ShapeTest handle that can be used with GET_SHAPE_TEST_RESULT.
In its only usage in game scripts its called with flag set to 511, entity to player_ped_id and flag2 set to 7
```
See [`START_SHAPE_TEST_LOS_PROBE`](#_0x7EE9F5D83DD4F90E) for flags.
## Parameters
* **pVec1**:
* **pVec2**:
Expand Down
22 changes: 10 additions & 12 deletions SHAPETEST/StartShapeTestSweptSphere.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,21 @@ aliases: ["0xE6AC6C45FBE83004","_START_SHAPE_TEST_CAPSULE_2"]

```c
// 0xE6AC6C45FBE83004 0x4559460A
int START_SHAPE_TEST_SWEPT_SPHERE(float x1, float y1, float z1, float x2, float y2, float z2, float radius, int flags, Entity entity, Any p9);
int START_SHAPE_TEST_SWEPT_SPHERE(float x1, float y1, float z1, float x2, float y2, float z2, float radius, int flags, Entity entity, int p9);
```
```
Performs the same type of trace as START_SHAPE_TEST_CAPSULE, but with some different hardcoded parameters.
```
## Parameters
* **x1**:
* **y1**:
* **z1**:
* **x2**:
* **y2**:
* **z2**:
* **x1**: Starting X coordinate.
* **y1**: Starting Y coordinate.
* **z1**: Starting Z coordinate.
* **x2**: Ending X coordinate.
* **y2**: Ending Y coordinate.
* **z2**: Ending Z coordinate.
* **radius**:
* **flags**:
* **entity**:
* **p9**:
* **flags**: See [`START_SHAPE_TEST_LOS_PROBE`](#_0x7EE9F5D83DD4F90E)
* **entity**: An entity to ignore, or 0.
* **p9**: A bit mask with bits 1, 2, 4, or 7 relating to collider types. 4 and 7 are usually used.
## Return value
19 changes: 10 additions & 9 deletions WATER/TestProbeAgainstAllWater.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,19 @@ ns: WATER

```c
// 0x8974647ED222EA5F 0x4A962D55
BOOL TEST_PROBE_AGAINST_ALL_WATER(Any p0, Any p1, Any p2, Any p3, Any p4, Any p5, Any p6, Any p7);
BOOL TEST_PROBE_AGAINST_ALL_WATER(float x1, float y1, float z1, float x2, float y2, float z2, int flag, Vector3* result);
```
Flags are identical to START_SHAPE_TEST*, however, 128 is automatically set.
## Parameters
* **p0**:
* **p1**:
* **p2**:
* **p3**:
* **p4**:
* **p5**:
* **p6**:
* **p7**:
* **x1**:
* **y1**:
* **z1**:
* **x2**:
* **y2**:
* **z2**:
* **flag**: See [`START_SHAPE_TEST_LOS_PROBE`](#_0x7EE9F5D83DD4F90E)
* **result**:
## Return value
4 changes: 2 additions & 2 deletions WATER/TestVerticalProbeAgainstAllWater.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ ns: WATER

```c
// 0x2B3451FA1E3142E2 0x4C71D143
BOOL TEST_VERTICAL_PROBE_AGAINST_ALL_WATER(float x, float y, float z, Any p3, float* height);
BOOL TEST_VERTICAL_PROBE_AGAINST_ALL_WATER(float x, float y, float z, int flag, float* height);
```
## Parameters
* **x**:
* **y**:
* **z**:
* **p3**:
* **flag**: See [`START_SHAPE_TEST_LOS_PROBE`](#_0x7EE9F5D83DD4F90E)
* **height**:
## Return value

3 comments on commit 5ff31ee

@jaymo1011
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes to WATER natives in this commit do not parse/render correctly. TEST_PROBE_AGAINST_ALL_WATER and TEST_VERTICAL_PROBE_AGAINST_ALL_WATER are currently missing the parameters and return value sections.

@AvarianKnight
Copy link
Collaborator Author

@AvarianKnight AvarianKnight commented on 5ff31ee Feb 12, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it break if you don't add a comment for all of the parameters?

@AvarianKnight
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll try and get hugo setup later and see if I can find what messed up

Please sign in to comment.