Skip to content

Commit

Permalink
Add more v5 function pages + misc fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
MegAmi24 committed Oct 14, 2024
1 parent dd7b2b1 commit 8d6f6f9
Show file tree
Hide file tree
Showing 20 changed files with 350 additions and 11 deletions.
2 changes: 1 addition & 1 deletion docs/Guides/RSDKv3/Decompilation/Building.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ git clone --recursive https://github.com/RSDKModding/RSDKv3-Decompilation
If you've already cloned the repo, run these commands inside of the repository to ensure the clone is up-to-date:
```
git pull
git submodule update --init --recursive
git submodule update --remote --init --recursive
```

## Getting dependencies
Expand Down
2 changes: 1 addition & 1 deletion docs/Guides/RSDKv4/Decompilation/Building.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ git clone --recursive https://github.com/RSDKModding/RSDKv4-Decompilation
If you've already cloned the repo, run these commands inside of the repository to ensure the clone is up-to-date:
```
git pull
git submodule update --init --recursive
git submodule update --remote --init --recursive
```

## Getting dependencies
Expand Down
2 changes: 1 addition & 1 deletion docs/Guides/RSDKv5/Decompilation/Building.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Clone the repo **recursively**, using:
If you've already cloned the repo, run these commands inside of the repository to ensure the clone is up-to-date:
```
git pull
git submodule update --init --recursive
git submodule update --remote --init --recursive
```

## Getting dependencies
Expand Down
3 changes: 3 additions & 0 deletions docs/RSDKv4/Functions/Object/CopyObject.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# CopyObject

!!! note
This function only exists in REV02 and above.

## Description
Copies `count` objects starting from `srcSlot` and pastes them to the object slots starting from `destSlot`.

Expand Down
3 changes: 3 additions & 0 deletions docs/RSDKv4/Functions/Object/GetObjectValue.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# GetObjectValue

!!! note
This function only exists in REV02 and above.

## Description
Gets `object.valueXX` of the object in `slot` corresponding to `valueID` and stores it in `store`.

Expand Down
3 changes: 3 additions & 0 deletions docs/RSDKv4/Functions/Object/SetObjectValue.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# SetObjectValue

!!! note
This function only exists in REV02 and above.

## Description
Sets `object.valueXX` of the object in `slot` corresponding to `valueID` to `value`.

Expand Down
2 changes: 1 addition & 1 deletion docs/RSDKv4/Functions/Stages/CheckCurrentStageFolder.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Reads the name of the current stage's folder.
: The string to match.

## Return Value
Sets `checkResult` to `true` if the current folder's name matches `checkFolder`; otherwise, it's set to`false`.
Sets `checkResult` to `true` if the current folder's name matches `checkFolder`; otherwise, it's set to `false`.

## Syntax
```
Expand Down
30 changes: 30 additions & 0 deletions docs/RSDKv5/Functions/Misc/HasNotifyCallback.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# HasNotifyCallback

!!! note
This function only exists in Sonic Origins.

## Description
Checks if the game has access to [NotifyCallback()](NotifyCallback.md).

## Parameters
None.

## Return Value
Returns `true` if [NotifyCallback()](NotifyCallback.md) exists and is accessible, or `false` if not.

## Syntax
``` c++
HasNotifyCallback();
```

## Example
``` c++
if (HasNotifyCallback()) { /* do stuff */ }
```
!!! note
This is a macro, which is designed to make programming in RSDK easier. The underlying logic is:
``` c++
RSDKTable->NotifyCallback != NULL
```
The underlying logic should NEVER be used as it's less safe than the macro. This note is here for anyone wishing to learn about the internals or hoping to develop a wrapper for another language that doesn't support macros.
2 changes: 1 addition & 1 deletion docs/RSDKv5/Functions/Misc/NotifyCallback.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,5 @@ NotifyCallback(NOTIFY_STATS_CHARA_ACTION, 1, 0, 0);
if (HasNotifyCallback())
RSDKTable->NotifyCallback(callback, param1, param2, param3);
```
`HasNotifyCallback()` is a macro as well, with its underlying logic being `RSDKTable->NotifyCallback != NULL`.
[HasNotifyCallback()](HasNotifyCallback.md) is a macro as well.
The underlying logic for either macro should NEVER be used as it's less safe than the macros. This note is here for anyone wishing to learn about the internals or hoping to develop a wrapper for another language that doesn't support macros.
26 changes: 26 additions & 0 deletions docs/RSDKv5/Functions/Misc/SetGameFinished.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# SetGameFinished

!!! note
This function only exists in Sonic Origins.

## Description
Notifies the engine that the game has been finished.

## Parameters
None.

## Return Value
Sets `SceneInfo->state` to `ENGINESTATE_GAME_FINISHED`.

## Example
=== "C"

``` c
RSDK.SetGameFinished();
```

=== "C++"

``` cpp
RSDKTable->SetGameFinished();
```
38 changes: 38 additions & 0 deletions docs/RSDKv5/Functions/Object/FindObject.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# FindObject

## Description
Finds a loaded object by name and retrieves its ID.

## Parameters
`name`

: The name of the object to find.

## Return Value
Returns the [classID](TODO) of the found object as a `uint16`. The return value will be `0` if the object wasn't found.

## Syntax
=== "C"

``` c
RSDK.FindObject(const char *name);
```

=== "C++"

``` cpp
GameObject::Find(const char *name);
```

## Example
=== "C"

``` c
uint16 foundObject = RSDK.FindObject("MyObject");
```

=== "C++"

``` cpp
uint16 foundObject = GameObject::Find("MyObject");
```
27 changes: 22 additions & 5 deletions docs/RSDKv5/Functions/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
## SpriteSheets
| Function | Description |
| ------------------------------------------------------ | --------------------------------------------- |
| [**LoadSpriteSheet**](SpriteSheets/LoadSpriteSheet.md) | Loads a spritesheet and returns the id of it. |
| [**LoadSpriteSheet**](SpriteSheets/LoadSpriteSheet.md) | Loads a spritesheet and returns the ID of it. |

## Graphics
| Function | Description |
Expand All @@ -37,18 +37,35 @@
| [**GetHitbox**](Graphics/GetHitbox.md) | Gets a Hitbox from the animator's current frame. |
| [**GetFrameID**](Graphics/GetFrameID.md) | Gets the `unicode char` value of the animator's current frame. |
| [**GetStringWidth**](Graphics/GetStringWidth.md) | Retrieves the width of a string in pixels when displayed with [DrawText](TODO). |
| [**ProcessAnimation**](Graphics/ProcessAnimation.md) | Processes the animation applied to an animator. |
| [**ProcessAnimation**](Graphics/ProcessAnimation.md) | Processes the animation applied to an animator. |

## Debugging
| Function | Description |
| ----------------------------------------------------------------- | ------------------------------------------------------------------- |
| [**ClearViewableVariables**](Debugging/ClearViewableVariables.md) | Clears all loaded viewable variables. |
| [**AddViewableVariable**](Debugging/AddViewableVariable.md) | Adds a viewable variable to the [Dev Menu](../Overview/DevMenu.md). |

## Objects & Entities
| Function | Description |
| -------------------------------------- | --------------------------------------------------- |
| [**FindObject**](Object/FindObject.md) | Finds a loaded object by name and retrieves its ID. |

## Scene Management
| Function | Description |
| ------------------------------------------------- | -------------------------------------------------------------------------------------------------------- |
| [**SetScene**](Scene/SetScene.md) | Sets the scene category and list position to the matching scene entry in the GameConfig. |
| [**SetEngineState**](Scene/SetEngineState.md) | Sets the state of the engine. |
| [**ForceHardReset**](Scene/ForceHardReset.md) | Sets whether the next stage reload should reload all assets. |
| [**CheckValidScene**](Scene/CheckValidScene.md) | Checks if `SceneInfo->activeCategory` and `SceneInfo->listPos` point to a valid scene in the GameConfig. |
| [**CheckSceneFolder**](Scene/CheckSceneFolder.md) | Reads the name of the current stage's folder. |
| [**LoadScene**](Scene/LoadScene.md) | Loads a stage based on `SceneInfo->activeCategory` and `SceneInfo->listPos`. |

## Miscellaneous
| Function | Description |
| -------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------- |
| [**NotifyCallback**](Misc/NotifyCallback.md) | Sends the given callback to communicate to [Hedgehog Engine 2](/Games/SonicOrigins/HedgehogEngine2.md). **Sonic Origins only.** |
| Function | Description |
| -------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------- |
| [**NotifyCallback**](Misc/NotifyCallback.md) | Sends the given callback to communicate to [Hedgehog Engine 2](/Games/SonicOrigins/HedgehogEngine2.md). **Sonic Origins only.** |
| [**HasNotifyCallback**](Misc/HasNotifyCallback.md) | Checks if the game has access to [NotifyCallback()](Misc/NotifyCallback.md). **Sonic Origins only.** |
| [**SetGameFinished**](Misc/SetGameFinished.md) | Notifies the engine that the game has been finished. **Sonic Origins only.** |

## Editor
| Function | Description |
Expand Down
38 changes: 38 additions & 0 deletions docs/RSDKv5/Functions/Scene/CheckSceneFolder.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# CheckSceneFolder

## Description
Reads the name of the current stage's folder.

## Parameters
`folderName`

: The string to match.

## Return Value
Returns `true` as a `bool32` if the current folder's name matches `folderName`; otherwise, returns `false`.

## Syntax
=== "C"

``` c
RSDK.CheckSceneFolder(const char *folderName);
```

=== "C++"

``` cpp
Stage::CheckSceneFolder(const char *folderName);
```

## Example
=== "C"

``` c
RSDK.CheckSceneFolder("Menu");
```

=== "C++"

``` cpp
Stage::CheckSceneFolder("Menu");
```
23 changes: 23 additions & 0 deletions docs/RSDKv5/Functions/Scene/CheckValidScene.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# CheckValidScene

## Description
Checks if `SceneInfo->activeCategory` and `SceneInfo->listPos` point to a valid scene in the GameConfig.

## Parameters
None.

## Return Value
Returns whether the current scene is valid as a `bool32`.

## Example
=== "C"

``` c
RSDK.CheckValidScene();
```

=== "C++"

``` cpp
Stage::CheckValidScene();
```
44 changes: 44 additions & 0 deletions docs/RSDKv5/Functions/Scene/ForceHardReset.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# ForceHardReset

!!! note
This function only exists in REV02 and above.

## Description
Sets whether the next stage reload should reload all assets.

!!! note
This function does not reload the scene by itself; you must call [LoadStage()](LoadStage.md) manually.

## Parameters
`shouldHardReset`

: If set to `false`, the stage will reload normally. If set to `true`, the stage will reload all assets when reloaded.

## Return Value
None.

## Syntax
=== "C"

``` c
RSDK.ForceHardReset(bool32 shouldHardReset);
```

=== "C++"

``` cpp
Stage::ForceHardReset(bool32 shouldHardReset);
```

## Example
=== "C"

``` c
RSDK.ForceHardReset(true);
```

=== "C++"

``` cpp
Stage::ForceHardReset(true);
```
23 changes: 23 additions & 0 deletions docs/RSDKv5/Functions/Scene/LoadScene.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# LoadScene

## Description
Loads a stage based on `SceneInfo->activeCategory` and `SceneInfo->listPos`.

## Parameters
None.

## Return Value
None.

## Example
=== "C"

``` c
RSDK.LoadScene();
```

=== "C++"

``` cpp
Stage::LoadScene();
```
38 changes: 38 additions & 0 deletions docs/RSDKv5/Functions/Scene/SetEngineState.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# SetEngineState

## Description
Sets the state of the engine.

## Parameters
`state`

: The [engine state](TODO) to set the engine to.

## Return Value
Sets `SceneInfo->state` to the given state, preserving step-over mode if it's enabled.

## Syntax
=== "C"

``` c
RSDK.SetEngineState(uint8 state);
```

=== "C++"

``` cpp
Stage::SetEngineState(EngineStates state);
```

## Example
=== "C"

``` c
RSDK.SetEngineState(ENGINESTATE_FROZEN);
```

=== "C++"

``` cpp
Stage::SetEngineState(ENGINESTATE_FROZEN);
```
Loading

0 comments on commit 8d6f6f9

Please sign in to comment.