Actions

SCHG

Difference between revisions of "Sonic Riders/Memory Editing/Enumerables"

From Sonic Retro

(Created page with "{{SCHG Riders}} == Disclaimer == The following structures are illustrated through the use of C# code in order to simplify maintenance of this SCHG. Exported from the follow...")
 
m (Text replacement - "== (.*) ==" to "==$1==")
Line 1: Line 1:
 
{{SCHG Riders}}
 
{{SCHG Riders}}
  
== Disclaimer ==
+
==Disclaimer==
  
 
The following structures are illustrated through the use of C# code in order to simplify maintenance of this SCHG.
 
The following structures are illustrated through the use of C# code in order to simplify maintenance of this SCHG.
Line 7: Line 7:
 
Exported from the following Github project: https://github.com/sewer56lol/Sewer56.SonicRiders and mirrored by hand.
 
Exported from the following Github project: https://github.com/sewer56lol/Sewer56.SonicRiders and mirrored by hand.
  
== Gameplay ==
+
==Gameplay==
  
=== Characters ===
+
===Characters===
  
 
Tip for non C# programmers: Each subsequent entry automatically increments from the last by 1; i.e. Tails is 1, Knuckles is 2 below.
 
Tip for non C# programmers: Each subsequent entry automatically increments from the last by 1; i.e. Tails is 1, Knuckles is 2 below.
Line 64: Line 64:
 
</pre>
 
</pre>
  
=== Extreme Gear ===
+
===Extreme Gear===
  
 
<pre>
 
<pre>
Line 113: Line 113:
 
</pre>
 
</pre>
  
=== Extreme Gear Special Flags ===
+
===Extreme Gear Special Flags===
  
 
<pre>
 
<pre>
Line 219: Line 219:
 
</pre>
 
</pre>
  
=== Formation Types ===
+
===Formation Types===
  
 
<pre>
 
<pre>
Line 238: Line 238:
 
</pre>
 
</pre>
  
=== Gear Types ===
+
===Gear Types===
 
<pre>
 
<pre>
 
public enum GearType : byte
 
public enum GearType : byte
Line 248: Line 248:
 
</pre>
 
</pre>
  
=== Racing Stages ===
+
===Racing Stages===
 
<pre>
 
<pre>
 
public enum Levels : byte
 
public enum Levels : byte
Line 278: Line 278:
 
</pre>
 
</pre>
  
=== Player Display Flags ===
+
===Player Display Flags===
 
Part of the Player structure.
 
Part of the Player structure.
 
<pre>
 
<pre>
Line 319: Line 319:
 
</pre>
 
</pre>
  
=== Player Restrictions ===
+
===Player Restrictions===
 
Part of the Player structure.
 
Part of the Player structure.
 
<pre>
 
<pre>
Line 336: Line 336:
 
</pre>
 
</pre>
  
=== Player Action/State ===
+
===Player Action/State===
 
Part of the Player structure.
 
Part of the Player structure.
  
Line 452: Line 452:
 
</pre>
 
</pre>
  
=== Player Type ===
+
===Player Type===
 
Part of the Player structure.
 
Part of the Player structure.
 
<pre>
 
<pre>
Line 462: Line 462:
 
</pre>
 
</pre>
  
== Menus ==
+
==Menus==
  
=== Air Lost Actions (Race Settings Menu) ===
+
===Air Lost Actions (Race Settings Menu)===
 
Part of the Race Settings Menu structure.
 
Part of the Race Settings Menu structure.
  
Line 475: Line 475:
 
</pre>
 
</pre>
  
=== Controlling Menu ===
+
===Controlling Menu===
 
Part of the Common Menu structure.
 
Part of the Common Menu structure.
  
Line 497: Line 497:
 
</pre>
 
</pre>
  
=== Main Menu Action ===
+
===Main Menu Action===
 
Part of the Main Menu structure.
 
Part of the Main Menu structure.
  
Line 539: Line 539:
 
</pre>
 
</pre>
  
=== Main Menu Variation ===
+
===Main Menu Variation===
 
Part of the Main Menu structure.
 
Part of the Main Menu structure.
  
Line 556: Line 556:
 
</pre>
 
</pre>
  
=== Main Menu Colour ===
+
===Main Menu Colour===
 
Part of the Main Menu structure.
 
Part of the Main Menu structure.
  
Line 599: Line 599:
 
</pre>
 
</pre>
  
=== Menu State ===
+
===Menu State===
 
This structure is common to all game menus.
 
This structure is common to all game menus.
  
Line 638: Line 638:
 
</pre>
 
</pre>
  
=== Player State ===
+
===Player State===
 
This structure is part of the Character Select screen.
 
This structure is part of the Character Select screen.
  
Line 667: Line 667:
 
</pre>
 
</pre>
  
=== Track Select Mode ===
+
===Track Select Mode===
 
Set when entering the track selection menu, defines the mode the next race
 
Set when entering the track selection menu, defines the mode the next race
 
will be entered in.
 
will be entered in.
Line 701: Line 701:
 
</pre>
 
</pre>
  
== Input ==
+
==Input==
  
=== Buttons ===
+
===Buttons===
 
Part of the Player Input structure.
 
Part of the Player Input structure.
  
Line 721: Line 721:
 
</pre>
 
</pre>
  
== Other ==
+
==Other==
=== Game States ===
+
===Game States===
  
 
<pre>
 
<pre>

Revision as of 16:26, 24 March 2020

SCHG: Sonic Riders
Main Article
Memory Editing & Functions

Variables
Structures
Functions
Enumerables
Mathematical Formulae

Files
File Structure
Sound Editing
Voices

Disclaimer

The following structures are illustrated through the use of C# code in order to simplify maintenance of this SCHG.

Exported from the following Github project: https://github.com/sewer56lol/Sewer56.SonicRiders and mirrored by hand.

Gameplay

Characters

Tip for non C# programmers: Each subsequent entry automatically increments from the last by 1; i.e. Tails is 1, Knuckles is 2 below.

/// <summary>
/// Defines the list of character IDs used internally in the game.
/// </summary>
public enum Characters : byte
{
    Sonic = 0,
    Tails,
    Knuckles,
    Amy,
    Jet,
    Storm,
    Wave,
    Robotnik,
    Cream,
    Rouge,
    Shadow,
    SuperSonic,
    Nights,
    AiAi,
    Ulala,
    E10000G,
    E10000R,
}

/// <summary>
/// Defines the list of character IDs when used as flags internally within the game.
/// </summary>
[Flags]
public enum CharactersFlags : int
{
    Sonic = 0x000001,
    Tails = 0x000002,
    Knuckles = 0x000004,
    Amy = 0x000008,
    Jet = 0x000010,
    Storm = 0x000020,
    Wave = 0x000040,
    Robotnik = 0x000080,
    Cream = 0x000100,
    Rouge = 0x000200,
    Shadow = 0x000400,
    SuperSonic = 0x000800,
    Nights = 0x001000,
    AiAi = 0x002000,
    Ulala = 0x004000,
    E10000G = 0x008000,
    E10000R = 0x010000,
}

Extreme Gear

public enum ExtremeGear : byte
{
    Default = 0,
    HighBooster,
    AutoSlider,
    PowerfulGear,
    Fastest,
    TurboStar,
    Speedbalancer,
    BlueStarII,
    Access,
    Beginner,
    Accelerator,
    TrapGear,
    LightBoard,
    SlideBooster,
    Legend,
    MagicCarpet,
    AirBroom,
    Hovercraft,
    ChaosEmerald,
    Faster,
    Gambler,
    PowerGear,
    OpaOpa,
    TheCrazy,
    Berserker,
    ERider,
    AirTank,
    HeavyBike,
    Destroyer,
    Omnipotence,
    CoverS,
    CoverF,
    CoverP,
    HangOn,
    SuperHangOn,
    Darkness,
    Grinder,
    AdvantageS,
    AdvantageF,
    AdvantageP,
    Cannonball,
}

Extreme Gear Special Flags

[Flags]
public enum ExtremeGearSpecialFlags
{
    /// <summary>
    /// Ignore Turbulence (Heavy Bike)
    /// </summary>
    IgnoreTurbulence = 0x1,

    /// <summary>
    /// Always Perfect Jump (Legend)
    /// </summary>
    AlwaysPerfectJump = 0x2,

    /// <summary>
    /// Massive Oversteering! (Hovercraft)
    /// </summary>
    Oversteering = 0x4,

    /// <summary>
    /// Cannot Boost (Trap Gear, Slide Booster)
    /// </summary>
    CannotBoost = 0x10,

    /// <summary>
    /// Auto Slider (Auto Slider)
    /// </summary>
    AutoSlider = 0x20,

    /// <summary>
    /// No Speed Loss Uphill (Powerful Gear)
    /// </summary>
    NoUphillSpeedLoss = 0x40,

    /// <summary>
    /// Tornadoes Act as Boost (Trap Gear)
    /// </summary>
    TornadoBoostsPlayer = 0x80,

    /// <summary>
    /// No Speed Loss Holding Jump (Hovercraft, Heavy Bike)
    /// </summary>
    NoJumpHoldSpeedLoss = 0x100,

    /// <summary>
    /// Double Ring Winnings at End of Race (Gambler)
    /// </summary>
    DoubleRingWinnings = 0x200,

    /// <summary>
    /// Gear Runs on Rings @ Level 1 (Chaos Emerald/SS, The Crazy)
    /// </summary>
    GearOnRings = 0x400,

    /// <summary>
    /// Boosts do not Perform Attacks (Cannonball)
    /// </summary>
    NerfedBoosts = 0x800,

    /// <summary>
    /// Always Attacking (Berserker)
    /// </summary>
    AlwaysAttacking = 0x1000,

    /// <summary>
    /// Type skills disabled. (Gambler)
    /// </summary>
    SkillsDisabled = 0x2000,

    /// <summary>
    /// Unknown (Chaos Emerald/SS)
    /// </summary>
    Unknown1 = 0x4000,

    /// <summary>
    /// Start with 30% Air (Chaos Emerald/SS)
    /// </summary>
    StartThirtyPercentAir = 0x8000,

    /// <summary>
    /// Start with 50% Air (The Crazy)
    /// </summary>
    StartFiftyPercentAir = 0x10000,

    /// <summary>
    /// Unknown (Powerful Gear)
    /// </summary>
    Unknown2 = 0x20000,

    /// <summary>
    /// Light Board Flag (Light Board)
    /// > Hitting a wall cancels current boost.
    /// > At the end of the current boost, speed is reset to your boosting speed.
    /// > Speed reset to boosting speed is maintained until the player collides with a wall.
    /// </summary>
    LightBoard = 0x40000,

    /// <summary>
    /// Unknown (The Crazy)
    /// </summary>
    Unknown3 = 0x80000
}

Formation Types

public enum FormationTypes
{
    Speed = 0,
    Fly,
    Power
}

[Flags]
public enum FormationTypesFlags
{
    Speed = 0x1,
    Fly = 0x2,
    Power = 0x4
}

Gear Types

public enum GearType : byte
{
    Board = 0,
    Skate,
    Bike
}

Racing Stages

public enum Levels : byte
{
    /// <summary>
    /// Only exists in GC version, and crashes there.
    /// </summary>
    TestLevel = 0,
    MetalCity,
    SplashCanyon,
    EggFactory,
    GreenCave,
    SandRuins,
    BabylonGarden,
    DigitalDimension,
    SEGACarnival,
    NightChase,
    RedCanyon,
    IceFactory,
    WhiteCave,
    DarkDesert,
    SkyRoad,
    BabylonGuardian,
    SEGAIllusion,
    DualTowers,
    SnowValley,
    SpaceTheater
}

Player Display Flags

Part of the Player structure.

[Flags]
public enum PlayerDisplayFlags : int
{
    /// <summary>
    /// If set to true, hides the player speed number on the bottom right.
    /// </summary>
    HideSpeed = 0x80,

    /// <summary>
    /// Notably disables the board trail.
    /// Enables the animations used for running before crossing the start line.
    /// </summary>
    RunningAnimationMode = 0x100,

    /// <summary>
    /// Shows the Hairpin Turn Symbol/HUD element near hairpin turns.
    /// </summary>
    HairpinTurnSymbol = 0x800,

    /// <summary>
    /// Triggers a camera backward to forward motion.
    /// (Gives a sense of speed landing a trick)
    /// </summary>
    CameraZoomMotion = 0x20000,

    /// <summary>
    /// Fixes the camera around a certain point.
    /// Seems to only work when in Cinematic Camera Mode?
    /// </summary>
    FixedCamera = 0x40000,

    /// <summary>
    /// The Camera Mode used once you finish a race.
    /// </summary>
    CinematicCamera = 0x80000
}

Player Restrictions

Part of the Player structure.

public enum PlayerRestrictions : byte
{
    /// <summary>
    /// Apply restrictions normally given when the player is in the air.
    /// </summary>
    Airborne = 0x01,

    /// <summary>
    /// Disallow Drifting, Jumping (Pre-Start Line Restrictions)
    /// </summary>
    Running = 0x02
}

Player Action/State

Part of the Player structure.

public enum PlayerState : byte
{
    /// <summary>
    /// The running state that is applied at the start of a race.
    /// </summary>
    Running = 0x01,

    /// <summary>
    /// Resets the player as if they were to fall out of map, go the wrong way, etc.
    /// </summary>
    Reset = 0x03,

    /// <summary>
    /// Brings up the Retire Screen as if the current mission were to be failed by the player.
    /// </summary>
    Retire = 0x04,

    /// <summary>
    /// Normally driving forward on extreme gear/skates/bike.
    /// </summary>
    NormalOnBoard = 0x05,

    /// <summary>
    /// Triggers a character jump.
    /// </summary>
    Jump = 0x06,

    /// <summary>
    /// Applied when the player falls off a cliff/ledge without jumping.
    /// </summary>
    FreeFalling = 0x07,

    /// <summary>
    /// Doing Tricks (Horizontal Ramp) e.g. First Jump Metal City
    /// </summary>
    TrickJumpHorizontal = 0x08,

    /// <summary>
    /// Doing Tricks (Vertical Ramp) e.g. First Jump Ice Factory
    /// </summary>
    TrickJumpVertical = 0x09,

    TrickJumpUnknown1 = 0x0A,
    TrickJumpUnknown2 = 0x0B,

    /// <summary>
    /// Doing Tricks (Flat Vertical Ramp) (e.g. Ice Factory 2nd Jump), first jump after
    /// Metal City's first turn.
    /// </summary>
    TrickJumpFlatVertical = 0x0C,

    /// <summary>
    /// Doing Tricks (Turbulence) e.g. Turbulence
    /// </summary>
    TrickJumpTurbulence = 0x0D,

    /// <summary>
    /// Turbulence
    /// </summary>
    Turbulence = 0x10,

    /// <summary>
    /// Inside an Auto/Rotate Stick Section (or arrows on PC version).
    /// (Setting manually = crash, needs rail set somewhere first)
    /// </summary>
    RotateSection = 0x11,

    /// <summary>
    /// Grinding (Setting manually = crash, needs rail set somewhere first)
    /// </summary>
    Grinding = 0x12,

    /// <summary>
    /// Flying (Flight Formation).
    /// </summary>
    Flying = 0x13,

    /// <summary>
    /// Attacking an enemy/rival.
    /// (Setting manually = crash, needs enemy set somewhere first)
    /// </summary>
    Attacking = 0x15,

    /// <summary>
    /// Getting attacked by an enemy/rival.
    /// (Setting manually = crash, needs enemy set somewhere first)
    /// </summary>
    GettingAttacked = 0x16,

    /// <summary>
    /// Triggers the electric shock encountered if the player passes the start
    /// line too early.
    /// </summary>
    ElectricShock = 0x1A,

    /// <summary>
    /// Purpose unknown, brings player to a halt.
    /// </summary>
    InstantStop = 0x1B,

    /// <summary>
    /// ElectricShock but longer.
    /// </summary>
    ElectricShockLong = 0x1C,

    /// <summary>
    /// Some variant of ElectricShock which crashes the game.
    /// </summary>
    ElectricShockCrash = 0x1D,
}

Player Type

Part of the Player structure.

public enum PlayerType : byte
{
    Human = 0,
    CPU
}

Menus

Air Lost Actions (Race Settings Menu)

Part of the Race Settings Menu structure.

public enum AirLostActions : byte
{
    Run = 0,
    Retire = 1
}

Controlling Menu

Part of the Common Menu structure.

/// <summary>
/// Defines the menu or submenu that the player is currently in control of.
/// Generally only useful in the case of synchronizing the stage select submenu.
/// </summary>
public enum ControllingMenu
{
    MainMenu = 1,
    StageSelect = 3,
    StageSelectStageSubmenu = 5,
    TitleScreenPressEnter = 6,
    TitleSaveLoadAndBattleTrackSelect = 7,
    TitleMenu = 8,
    OpenRaceRules = 9,
    RaceRules = 10,
    ShopMenu = 15
}

Main Menu Action

Part of the Main Menu structure.

/// <summary>
/// Part of the <see cref="MainMenu"/> structure.
/// Toggle this number in order to perform minor adjustments on the
/// current menu.
/// </summary>
public enum MainMenuAction : byte
{
    /// <summary>
    /// Resets the description box size on the bottom of the screen.
    /// </summary>
    ResetDescription = 1,

    Unknown = 2,
    Crash = 3,
    Unknown2 = 4,

    /// <summary>
    /// Unknown, causes a black background in some menus.
    /// </summary>
    DarkBackground = 5,

    SmallDescription = 6,
    SmallDescription2 = 7,
    LargeDescription = 8,
    LargeDescription2 = 9,

    /// <summary>
    /// Plays the enter animation for the description.
    /// </summary>
    DescriptionEnterAnimation = 10,

    /// <summary>
    /// Plays the leave animation for the description.
    /// </summary>
    DescriptionLeaveAnimation = 11
}

Main Menu Variation

Part of the Main Menu structure.

/// <summary>
/// Specifies the variant of the main menu the user is currently in, 
/// since Game State 15 is shared between multiple menus.
/// </summary>
public enum MainMenuVariation : byte
{
    Default = 0,
    ExtrasMenu = 1,
    MissionMode = 2,
    Options = 3
}

Main Menu Colour

Part of the Main Menu structure.

/// <summary>
/// Defines the menu state for the individual menus used
/// throughout the game. Depending on the menu, these can either
/// trigger only animations or cause the next menu to be loaded/this menu closed.
/// </summary>
public enum MenuColour : byte
{
    /// <summary>
    /// [Default] Sonic Blue.
    /// </summary>
    Blue = 0,

    /// <summary>
    /// [Extras] Knuckles Red.
    /// </summary>
    Red = 1,

    /// <summary>
    /// [Options] Tails Yellow.
    /// </summary>
    Yellow = 2,

    /// <summary>
    /// [Mission Mode] Storm Gray.
    /// </summary>
    Gray = 3,

    /// <summary>
    /// [Mission Mode] Wave Purple.
    /// </summary>
    Purple = 4,

    /// <summary>
    /// [Mission Mode] Jet Green.
    /// </summary>
    Green = 5,
}

Menu State

This structure is common to all game menus.

/// <summary>
/// Defines the menu state for the individual menus used
/// throughout the game. Depending on the menu, these can either
/// trigger only animations or cause the next menu to be loaded/this menu closed.
/// </summary>
public enum MenuState : byte
{
    /// <summary>
    /// Generally reloads the menu.
    /// </summary>
    Reset = 0,

    /// <summary>
    /// Plays the menu entry animation.
    /// </summary>
    Enter = 1,

    /// <summary>
    /// Default state once inside the menu.
    /// </summary>
    Running = 2,

    /// <summary>
    /// Typically just plays the exit animation.
    /// In some cases, it can lead to the next screen or go back to last.
    /// </summary>
    Exit = 3,

    /// <summary>
    /// Default state once <see cref="Exit"/> finishes.
    /// </summary>
    Closed = 4
}

Player State

This structure is part of the Character Select screen.

[Flags]
public enum PlayerStatus : byte
{
    /// <summary>
    /// Player is currently inactive.
    /// </summary>
    Inactive = 0,

    /// <summary>
    /// Player has joined the game/race.
    /// </summary>
    Active = 1,

    /// <summary>
    /// Player is currently selecting gear.
    /// </summary>
    GearSelect = 2,

    /// <summary>
    /// Player has selected both gear and character and is ready to race.
    /// </summary>
    Ready = 4
}

Track Select Mode

Set when entering the track selection menu, defines the mode the next race will be entered in.

/// <summary>
/// Defines the mode to enter the next race in, such as Time Trial, GP, Emerald Race etc.
/// This is read upon starting a stage and initially set on entering
/// the track selection menu - thus is part of the <see cref="TitleScreen"/> 
/// structure.
/// </summary>
public enum TrackSelectMode : byte
{
    Default = 0,
    TimeTrial = 1,
    GrandPrix = 2,
    EmeraldRace = 3,
    BattleMode = 4,
    MissionMode = 5,
    TagMode = 6,

    /// <summary>
    /// Launches the game demos, your track selection does not affect
    /// the demo launched.
    /// </summary>
    DemoMode = 7,

    /// <summary>
    /// Boots you back to the title screen.
    /// </summary>
    TitleScreen = 8
}

Input

Buttons

Part of the Player Input structure.

[Flags]
public enum Buttons : int
{
    Accept = 0x00000001,
    Decline = 0x00000002,
    LBumper = 0x00000200,
    RBumper = 0x00000400,
    Up = 0x00001010,
    Down = 0x00002020,
    Left = 0x00004040,
    Right = 0x00008080
}

Other

Game States

public enum GameState : byte
{
    /// <summary>
    /// Set this to 1 and a new race is loaded. Strange, isn't it?
    /// </summary>
    LoadRace = 1,
    Race = 2,
    TitleScreen = 13,

    /// <summary>
    /// Also valid for the Extras and Options menu.
    /// </summary>
    MainMenu = 15,

    NormalRaceSubmenu = 16,
    StorySubmenu = 17,
    MissionSubmenu = 18,
    LoadTagSubmenu = 19,
    SurvivalSubmenu = 20,
    LoadShopSubmenu = 21,
    StageSelect = 22,
    CharacterSelect = 24,
    Shop = 25,
    LoadExtras = 26,
    LoadOptions = 27,
    ExtrasSubmenus = 28,
    OptionsSubmenus = 29,
    LoadTitleScreen = 30,
    LoadMainMenu = 31,
    MissionSelect = 38
}