NotifyCallback¶
NotifyCallback is a function in Sonic Origins that handles communicating between RSDKv5U and Hedgehog Engine 2.
Usage¶
Set game.callbackParam0, game.callbackParam1, and game.callbackParam2 to the needed parameters (unused parameters do not need to be set), then call EngineCallback() with Callback set to the appropriate callback ID.
EngineCallback(NOTIFY_TOUCH_SIGNPOST)
game.callbackParam0 = 1
game.callbackParam1 = 3
game.callbackParam2 = 0x03
EngineCallback(NOTIFY_SPECIAL_RETRY)
Note
The names of each callback are not defined by the engine itself. Instead, the names and their corresponding IDs are defined as global variables in Sonic CD's GameConfig.
Call CallNativeFunction2() or CallNativeFunction4() (depending on the amount of parameters needed) with callback set to NotifyCallback and param1 set to the appropriate callback ID. Set param2, param3, and param4 to the needed parameters. Unused parameters should be set to 0.
CallNativeFunction2(NotifyCallback, NOTIFY_TOUCH_SIGNPOST, 0)
CallNativeFunction4(NotifyCallback, NOTIFY_SPECIAL_RETRY, 1, 3, 0x03)
Note
The names of each callback are not defined by the engine itself. Instead, the names and their corresponding IDs are defined as global variables in Sonic 1 and 2's GameConfigs.
Call NotifyCallback() with callback set to the appropriate callback ID and param1, param2, and param3 set to the needed parameters. Unused parameters should be set to 0.
Callbacks¶
ID 128 - NOTIFY_DEATH_EVENT¶
Notifies of a Player death.
No parameters
ID 129 - NOTIFY_TOUCH_SIGNPOST¶
Notifies when a Sign Post has been touched.
No parameters
ID 130 - NOTIFY_HUD_ENABLE¶
Seemingly has no effect. Presumably replaced with the game.hudEnable global variable.
ID 131 - NOTIFY_ADD_COIN¶
Awards the player the given amount of coins.
param1-
The number of coins to give the player.
ID 132 - NOTIFY_KILL_ENEMY¶
Notifies that an enemy has been killed.
param1-
The attribute (method) an enemy was killed with, if relevant to a mission being played.
Kill Enemy Attributes¶
0- KILL_ENEMY_ATTR_DEFAULT1- KILL_ENEMY_ATTR_ANIMALPRISON2- KILL_ENEMY_ATTR_SPINDASH3- KILL_ENEMY_ATTR_GLIDING4- KILL_ENEMY_ATTR_RINGVACUUM (Lightning Shield)5- KILL_ENEMY_ATTR_BALLOON6- KILL_ENEMY_ATTR_FIREDASH (Fire Shield)
ID 133 - NOTIFY_SAVESLOT_SELECT¶
Notifies that a save has been selected in the save select.
param1-
The save slot selected.
ID 134 - NOTIFY_FUTURE_PAST¶
Notifies of the time period that is being or has been traveled to.
param1-
The new time period.
ID 135 - NOTIFY_GOTO_FUTURE_PAST¶
Notifies of the time period that is being traveled to. Unlike NOTIFY_FUTURE_PAST, this callback should be called when loading the stage.
param1-
The new time period.
ID 136 - NOTIFY_BOSS_END¶
Notifies that a boss fight is over.
param1-
Unknown, but usually set to
1/true.
ID 137 - NOTIFY_SPECIAL_END¶
Seemingly has no effect.
ID 138 - NOTIFY_DEBUGPRINT¶
Has no effect in-game, but would have likely printed the given values to the console in debug builds of the game.
ID 139 - NOTIFY_KILL_BOSS¶
Notifies that a boss has been defeated.
No parameters
ID 140 - NOTIFY_TOUCH_EMERALD¶
Notifies that a Chaos/Super Emerald or Time Stone has been collected. This callback is typically ran when the emerald jingle plays.
No parameters
ID 141 - NOTIFY_STATS_ENEMY¶
Reports badnik-related statistics.
param1-
The amount of total badniks destroyed.
param2-
The amount of badniks destroyed using the Spin Dash.
param3-
The amount of a specific badnik destroyed (Motobugs in Sonic 1, Buzzbombers in Sonic 2, Cyclones in Sonic 3 & Knuckles). Unused in Sonic CD.
ID 142 - NOTIFY_STATS_CHARA_ACTION¶
Reports statistics related to player characters.
param1-
Whether the player is transforming into their Super or Hyper form.
param2-
Whether the player is using Tails' flight.
ID 143 - NOTIFY_STATS_RING¶
Reports ring-related statistics.
param1-
The amount of rings player 1 currently has.
ID 144 - NOTIFY_STATS_MOVIE¶
Unlocks the current game's ending in the Museum.
param1-
Unknown, but usually set to
1/true.
ID 145 - NOTIFY_STATS_PARAM_1¶
Reports statistics tied to achievements and Museum unlocks.
param1-
Whether the following condition has been met based on the game:
- Sonic 1: The player grabbed an air bubble.
- Sonic CD: The player has time traveled.
- Sonic 2: The player got three Jackpots at a slot machine in Casino Night Zone.
- Sonic 3 & Knuckles: The player broke a monitor containing a Fire Shield.
param2-
Whether the player broke a monitor containing a Lightning Shield. Only used in Sonic 3 & Knuckles.
param3-
Whether the player broke a monitor containing a Bubble Shield. Only used in Sonic 3 & Knuckles.
ID 146 - NOTIFY_STATS_PARAM_2¶
Notifies that all Chaos Emeralds or Time Stones have been collected. Note that this does not include the Super Emeralds in Sonic 3 & Knuckles.
No parameters
ID 147 - NOTIFY_CHARACTER_SELECT¶
Opens the character select menu. If the menu is backed out of without selecting a save slot, game.callbackResult is set to 0; otherwise, it's set to 1. If the selected save slot is an existing save, game.continueFlag is set to 1.
param1-
If true, skips the character select and automatically loads the save slot for the current character.
ID 148 - NOTIFY_SPECIAL_RETRY¶
Opens the Special Stage retry screen. If the player chooses not to, game.callbackResult is set to 0.
param1-
Whether or not the retry screen should be skipped (i.e. the player completed the Special Stage).
param2-
The ID of the current Special Stage.
param3-
Seemingly unused, but usually set to the player's emerald count.
ID 149 - NOTIFY_TOUCH_CHECKPOINT¶
Notifies when a Lamp Post or Star Post has been touched.
No parameters
ID 150 - NOTIFY_ACT_FINISH¶
Notifies when an act has been completed.
param1-
Whether or not the act has been skipped, such as falling into the pit that leads to Hidden Palace Zone in Mystic Cave Zone Act 2.
ID 151 - NOTIFY_1P_VS_SELECT¶
It's not entirely clear what this callback is for, but it seems to be related to whether the player chose 1 PLAYER or 2 PLAYER VS in Sonic 2's title screen.
param1-
Set to
0for 1 PLAYER or1for 2 PLAYER VS.
ID 152 - NOTIFY_CONTROLLER_SUPPORT¶
Opens the controller setup screen in the Nintendo Switch version of the game. If not on the Nintendo Switch or there is only one controller connected when the screen is closed, game.callbackResult is set to 0; otherwise, it's set to 1.
No parameters
ID 153 - NOTIFY_STAGE_RETRY¶
Opens the stage retry screen for My Data & Ranking mode.
param1-
Set to
0for the regular retry screen (player death) or anything else to show the current and best time (stage completed). param2-
The current stage ID.
ID 154 - NOTIFY_SOUND_TRACK¶
Reports the new soundtrack setting selected.
param1-
The soundtrack setting to use (
0for JP,1for US).
ID 155 - NOTIFY_GOOD_ENDING¶
Notifies that a good ending has been achieved.
No parameters
ID 156 - NOTIFY_BACK_TO_MAINMENU¶
Prompts the player if they'd like to return to the main menu.
param1-
Seemingly unused, but sometimes set to
1.
ID 157 - NOTIFY_LEVEL_SELECT_MENU¶
Reports whether the player has visited a level select menu.
param1-
Whether the player has visited a level select menu.
ID 158 - NOTIFY_PLAYER_SET¶
Reports the character the player should be set to.
param1-
The ID of the character.
param2-
In Sonic 3 & Knuckles, the save slot ID to use (
-1for the level select). In other games, whether a sidekick should be present. param3-
Whether the player is starting a new game. Only used in Sonic 3 & Knuckles.
ID 159 - NOTIFY_EXTRAS_MODE¶
Reports whether the player is in the Extras menu.
param1-
Whether the player is in the Extras menu.
ID 160 - NOTIFY_SPIN_DASH_TYPE¶
Reports the new Spin Dash Type setting selected.
param1-
The Spin Dash type to use (
0for Genesis,1for Original).
ID 161 - NOTIFY_TIME_OVER¶
Notifies that a Game Over has been achieved. Note that Sonic Origins uses a different method of differentiating a Game Over from a Time Over than usual.
param1-
Whether an actual Time Over has been achieved.
ID 162 - NOTIFY_TIMEATTACK_MODE¶
Reports whether the player is in the Time Attack menu.
param1-
Whether the player is in the Time Attack menu.
ID 163 - NOTIFY_STATS_BREAK_OBJECT¶
Note
This callback was added in version 2.0.0.
Reports statistics related to stage objects.
param1-
If set to
0, the player broke a Metal Sonic projector; if set to1, the player destroyed the Eggman statue in Wacky Workbench Zone Act 1. param2-
The character ID. Note that Amy uses ID
3for this rather than5.
ID 164 - NOTIFY_STATS_SAVE_FUTURE¶
Note
This callback was added in version 2.0.0.
Notifies that the player made a good future in an act.
No parameters
ID 165 - NOTIFY_STATS_CHARA_ACTION2¶
Note
This callback was added in version 2.0.0.
Reports statistics related to player characters.
param1-
Whether the player is using Knuckles' glide (
1) or wall climb (2). Set to0for neither. param2-
Whether the player is using Amy's Hammer Jump.
ID 1000 - NOTIFY_1000¶
Unknown callback.
ID 1001 - NOTIFY_1001¶
Unknown callback.
ID 1002 - NOTIFY_1002¶
Unknown callback.
ID 1003 - NOTIFY_PLAYER_SAVED_VALUES¶
Records the player's current score.
param1-
The score to record.
ID 1004 - NOTIFY_1004¶
Unknown callback.
ID 1005 - NOTIFY_1005¶
Unknown callback.
ID 1006 - NOTIFY_TITLECARD_INIT¶
Notifies that the title card is being displayed.
No parameters
ID 1007 - NOTIFY_1007¶
Displays an error message for trying to access a save file with DLC content without said DLC installed.
No parameters