From 8d6f6f9fc18ceffe356f9cde1f40be1037e67138 Mon Sep 17 00:00:00 2001 From: MegAmi Date: Mon, 14 Oct 2024 14:49:27 -0500 Subject: [PATCH] Add more v5 function pages + misc fixes --- docs/Guides/RSDKv3/Decompilation/Building.md | 2 +- docs/Guides/RSDKv4/Decompilation/Building.md | 2 +- docs/Guides/RSDKv5/Decompilation/Building.md | 2 +- docs/RSDKv4/Functions/Object/CopyObject.md | 3 ++ .../RSDKv4/Functions/Object/GetObjectValue.md | 3 ++ .../RSDKv4/Functions/Object/SetObjectValue.md | 3 ++ .../Stages/CheckCurrentStageFolder.md | 2 +- .../Functions/Misc/HasNotifyCallback.md | 30 +++++++++++++ docs/RSDKv5/Functions/Misc/NotifyCallback.md | 2 +- docs/RSDKv5/Functions/Misc/SetGameFinished.md | 26 +++++++++++ docs/RSDKv5/Functions/Object/FindObject.md | 38 ++++++++++++++++ docs/RSDKv5/Functions/README.md | 27 +++++++++--- .../Functions/Scene/CheckSceneFolder.md | 38 ++++++++++++++++ .../RSDKv5/Functions/Scene/CheckValidScene.md | 23 ++++++++++ docs/RSDKv5/Functions/Scene/ForceHardReset.md | 44 +++++++++++++++++++ docs/RSDKv5/Functions/Scene/LoadScene.md | 23 ++++++++++ docs/RSDKv5/Functions/Scene/SetEngineState.md | 38 ++++++++++++++++ docs/RSDKv5/Functions/Scene/SetScene.md | 42 ++++++++++++++++++ .../Functions/SpriteSheets/LoadSpriteSheet.md | 2 +- mkdocs.yml | 11 +++++ 20 files changed, 350 insertions(+), 11 deletions(-) create mode 100644 docs/RSDKv5/Functions/Misc/HasNotifyCallback.md create mode 100644 docs/RSDKv5/Functions/Misc/SetGameFinished.md create mode 100644 docs/RSDKv5/Functions/Object/FindObject.md create mode 100644 docs/RSDKv5/Functions/Scene/CheckSceneFolder.md create mode 100644 docs/RSDKv5/Functions/Scene/CheckValidScene.md create mode 100644 docs/RSDKv5/Functions/Scene/ForceHardReset.md create mode 100644 docs/RSDKv5/Functions/Scene/LoadScene.md create mode 100644 docs/RSDKv5/Functions/Scene/SetEngineState.md create mode 100644 docs/RSDKv5/Functions/Scene/SetScene.md diff --git a/docs/Guides/RSDKv3/Decompilation/Building.md b/docs/Guides/RSDKv3/Decompilation/Building.md index 9dae83eae..294649c5a 100644 --- a/docs/Guides/RSDKv3/Decompilation/Building.md +++ b/docs/Guides/RSDKv3/Decompilation/Building.md @@ -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 diff --git a/docs/Guides/RSDKv4/Decompilation/Building.md b/docs/Guides/RSDKv4/Decompilation/Building.md index 47aa1d520..a2e357fac 100644 --- a/docs/Guides/RSDKv4/Decompilation/Building.md +++ b/docs/Guides/RSDKv4/Decompilation/Building.md @@ -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 diff --git a/docs/Guides/RSDKv5/Decompilation/Building.md b/docs/Guides/RSDKv5/Decompilation/Building.md index b0295bb36..8798315c9 100644 --- a/docs/Guides/RSDKv5/Decompilation/Building.md +++ b/docs/Guides/RSDKv5/Decompilation/Building.md @@ -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 diff --git a/docs/RSDKv4/Functions/Object/CopyObject.md b/docs/RSDKv4/Functions/Object/CopyObject.md index 57c09e29b..1ce722581 100644 --- a/docs/RSDKv4/Functions/Object/CopyObject.md +++ b/docs/RSDKv4/Functions/Object/CopyObject.md @@ -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`. diff --git a/docs/RSDKv4/Functions/Object/GetObjectValue.md b/docs/RSDKv4/Functions/Object/GetObjectValue.md index 59da316e2..038a34667 100644 --- a/docs/RSDKv4/Functions/Object/GetObjectValue.md +++ b/docs/RSDKv4/Functions/Object/GetObjectValue.md @@ -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`. diff --git a/docs/RSDKv4/Functions/Object/SetObjectValue.md b/docs/RSDKv4/Functions/Object/SetObjectValue.md index 29a432dbc..a28403f23 100644 --- a/docs/RSDKv4/Functions/Object/SetObjectValue.md +++ b/docs/RSDKv4/Functions/Object/SetObjectValue.md @@ -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`. diff --git a/docs/RSDKv4/Functions/Stages/CheckCurrentStageFolder.md b/docs/RSDKv4/Functions/Stages/CheckCurrentStageFolder.md index 3c332e4f6..ce6822df7 100644 --- a/docs/RSDKv4/Functions/Stages/CheckCurrentStageFolder.md +++ b/docs/RSDKv4/Functions/Stages/CheckCurrentStageFolder.md @@ -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 ``` diff --git a/docs/RSDKv5/Functions/Misc/HasNotifyCallback.md b/docs/RSDKv5/Functions/Misc/HasNotifyCallback.md new file mode 100644 index 000000000..0bfbd018e --- /dev/null +++ b/docs/RSDKv5/Functions/Misc/HasNotifyCallback.md @@ -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. \ No newline at end of file diff --git a/docs/RSDKv5/Functions/Misc/NotifyCallback.md b/docs/RSDKv5/Functions/Misc/NotifyCallback.md index fb68c75cf..11699f4f0 100644 --- a/docs/RSDKv5/Functions/Misc/NotifyCallback.md +++ b/docs/RSDKv5/Functions/Misc/NotifyCallback.md @@ -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. \ No newline at end of file diff --git a/docs/RSDKv5/Functions/Misc/SetGameFinished.md b/docs/RSDKv5/Functions/Misc/SetGameFinished.md new file mode 100644 index 000000000..cd737dbbc --- /dev/null +++ b/docs/RSDKv5/Functions/Misc/SetGameFinished.md @@ -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(); + ``` \ No newline at end of file diff --git a/docs/RSDKv5/Functions/Object/FindObject.md b/docs/RSDKv5/Functions/Object/FindObject.md new file mode 100644 index 000000000..596840f2f --- /dev/null +++ b/docs/RSDKv5/Functions/Object/FindObject.md @@ -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"); + ``` \ No newline at end of file diff --git a/docs/RSDKv5/Functions/README.md b/docs/RSDKv5/Functions/README.md index adf7ad7f6..60bb35a69 100644 --- a/docs/RSDKv5/Functions/README.md +++ b/docs/RSDKv5/Functions/README.md @@ -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 | @@ -37,7 +37,7 @@ | [**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 | @@ -45,10 +45,27 @@ | [**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 | diff --git a/docs/RSDKv5/Functions/Scene/CheckSceneFolder.md b/docs/RSDKv5/Functions/Scene/CheckSceneFolder.md new file mode 100644 index 000000000..5a3f66838 --- /dev/null +++ b/docs/RSDKv5/Functions/Scene/CheckSceneFolder.md @@ -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"); + ``` \ No newline at end of file diff --git a/docs/RSDKv5/Functions/Scene/CheckValidScene.md b/docs/RSDKv5/Functions/Scene/CheckValidScene.md new file mode 100644 index 000000000..b86b36a3b --- /dev/null +++ b/docs/RSDKv5/Functions/Scene/CheckValidScene.md @@ -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(); + ``` \ No newline at end of file diff --git a/docs/RSDKv5/Functions/Scene/ForceHardReset.md b/docs/RSDKv5/Functions/Scene/ForceHardReset.md new file mode 100644 index 000000000..aab1ed1d3 --- /dev/null +++ b/docs/RSDKv5/Functions/Scene/ForceHardReset.md @@ -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); + ``` \ No newline at end of file diff --git a/docs/RSDKv5/Functions/Scene/LoadScene.md b/docs/RSDKv5/Functions/Scene/LoadScene.md new file mode 100644 index 000000000..53c75b887 --- /dev/null +++ b/docs/RSDKv5/Functions/Scene/LoadScene.md @@ -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(); + ``` \ No newline at end of file diff --git a/docs/RSDKv5/Functions/Scene/SetEngineState.md b/docs/RSDKv5/Functions/Scene/SetEngineState.md new file mode 100644 index 000000000..7e306adf8 --- /dev/null +++ b/docs/RSDKv5/Functions/Scene/SetEngineState.md @@ -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); + ``` \ No newline at end of file diff --git a/docs/RSDKv5/Functions/Scene/SetScene.md b/docs/RSDKv5/Functions/Scene/SetScene.md new file mode 100644 index 000000000..d2ae6a22b --- /dev/null +++ b/docs/RSDKv5/Functions/Scene/SetScene.md @@ -0,0 +1,42 @@ +# SetScene + +## Description +Sets the scene category and list position to the matching scene entry in the GameConfig. + +## Parameters +`categoryName` + +: The name of the stage category in the GameConfig. + +`sceneName` + +: The name of the scene in the GameConfig. + +## Return Value +Sets `SceneInfo->activeCategory` and `SceneInfo->listPos` to the category and scene with names matching `categoryName` and `sceneName`, respectively. If the given name(s) aren't found in the GameConfig, the variables will not be set. + +## Syntax +=== "C" + + ``` c + RSDK.SetScene(const char *categoryName, const char *sceneName); + ``` + +=== "C++" + + ``` cpp + Stage::SetScene(const char *categoryName, const char *sceneName); + ``` + +## Example +=== "C" + + ``` c + RSDK.SetScene("Presentation", "Title Screen"); + ``` + +=== "C++" + + ``` cpp + Stage::SetScene("Presentation", "Title Screen"); + ``` \ No newline at end of file diff --git a/docs/RSDKv5/Functions/SpriteSheets/LoadSpriteSheet.md b/docs/RSDKv5/Functions/SpriteSheets/LoadSpriteSheet.md index 960dde6fa..6b2ca7c6e 100644 --- a/docs/RSDKv5/Functions/SpriteSheets/LoadSpriteSheet.md +++ b/docs/RSDKv5/Functions/SpriteSheets/LoadSpriteSheet.md @@ -13,7 +13,7 @@ Loads a spritesheet and returns the ID of it. : The asset's scope, may be `SCOPE_GLOBAL` or `SCOPE_STAGE`. ## Return Value -Returns the ID of the loaded spritesheet as a `uint16`. The return value will be `-1` if the animation file failed to load. +Returns the ID of the loaded spritesheet as a `uint16`. The return value will be `-1` if the spritesheet failed to load. ## Syntax === "C" diff --git a/mkdocs.yml b/mkdocs.yml index c529fcb02..53f84ebca 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -462,8 +462,19 @@ nav: - Debugging: - ClearViewableVariables: RSDKv5/Functions/Debugging/ClearViewableVariables.md - AddViewableVariable: RSDKv5/Functions/Debugging/AddViewableVariable.md + - Objects & Entities: + - FindObject: RSDKv5/Functions/Object/FindObject.md + - Scene Management: + - SetScene: RSDKv5/Functions/Scene/SetScene.md + - SetEngineState: RSDKv5/Functions/Scene/SetEngineState.md + - ForceHardReset: RSDKv5/Functions/Scene/ForceHardReset.md + - CheckValidScene: RSDKv5/Functions/Scene/CheckValidScene.md + - CheckSceneFolder: RSDKv5/Functions/Scene/CheckSceneFolder.md + - LoadScene: RSDKv5/Functions/Scene/LoadScene.md - Miscellaneous: - NotifyCallback: RSDKv5/Functions/Misc/NotifyCallback.md + - HasNotifyCallback: RSDKv5/Functions/Misc/HasNotifyCallback.md + - SetGameFinished: RSDKv5/Functions/Misc/SetGameFinished.md - Editor: - RSDK_ACTIVE_VAR: RSDKv5/Functions/Editor/RSDK_ACTIVE_VAR.md - RSDK_ENUM_VAR: RSDKv5/Functions/Editor/RSDK_ENUM_VAR.md