User:Yume Dragoon/Menu

From SRB2 Wiki
Jump to navigation Jump to search

Menu

Menu is a SOC function that allows editing of specific sections inside SRB2's Menus. It can be used to add backgrounds and music to menus that lack said aspects or to change the backgrounds and music of existing menus

  • Specify type of menu to modify. See List of Menus below for valid types.

Inherited Parameters (see details below)

See Implementation Details for note on inheritance.

Background

  • BackgroundName - Graphics patch to show as a background. If this is not specified by inheritance, then defaults to TITLESKY. If this is specified when a titlemap is active, this background overlays the titlemap.
  • TitleScrollXSpeed - Scroll X speed. Negative value means move left. Only effective if BackgroundName is specified. Overrides the global default from MainCfg > HideTitlePics and defaults to 0.
  • TitleScrollYSpeed - Scroll Y speed. Negative value means move up. Only effective if BackgroundName is specified. Overrides the global default from MainCfg > HideTitlePics and defaults to 0.
  • HideTitlePics - Hide the title screen wings. If not specified, this inherits the global default from MainCfg > HideTitlePics
  • FadeStrength - How dark to overlay the background, 1-32. If not specified, this defaults to 16.

Music

  • Music - Lump name of music to change to
  • MusicTrack
  • MusicLoop

Unique Parameters

These parameters are specific per menu, and they are not retrieved from the parents.

Transitions

  • EnterWipe - Wipe ID to apply when entering the submenu. If not specified, no wipe is applied.
  • ExitWipe - Wipe ID to apply when exiting the submenu. If not specified, no wipe is applied.
  • EnterTag - Line exec tag to run when entering the submenu.
  • ExitTag - Line exec tag to run when exiting the submenu.
  • NoExecBubbling - If switching to a completely different branch in the tree, don't run the enter or exit tags of all the parents up to (and excluding) the common ancestor. By default, do so.

Implementation Details

Menus follow a tree hierarchy. If a child menu does not specify a parameter like BackgroundName or Music, it will inherit that parameter from the first parent that has that specified.

This applies in most cases; the exceptions are listed under Unique Parameters.

Note: the Top Menu is not specified as the ultimate parent of all menus. Instead, it is a sibling to the Single Player main menu, Multiplayer, Options, etc. This is to promote a separation of concerns between the top title screen and submenus to enforce non-inheritance (for linedef execs, in particular).

List of Menus

    // Top Menu
    MN_MAIN,

    // Single Player
    MN_SP_MAIN,

    MN_SP_LOAD,
    MN_SP_PLAYER,

    MN_SP_LEVELSELECT,
    MN_SP_LEVELSTATS,

    MN_SP_TIMEATTACK,
    MN_SP_TIMEATTACK_LEVELSELECT,
    MN_SP_GUESTREPLAY,
    MN_SP_REPLAY,
    MN_SP_GHOST,

    MN_SP_NIGHTSATTACK,
    MN_SP_NIGHTS_LEVELSELECT,
    MN_SP_NIGHTS_GUESTREPLAY,
    MN_SP_NIGHTS_REPLAY,
    MN_SP_NIGHTS_GHOST,

    // Multiplayer
    MN_MP_MAIN,
    MN_MP_SPLITSCREEN, // SplitServer
    MN_MP_SERVER,
    MN_MP_CONNECT,
    MN_MP_ROOM,
    MN_MP_PLAYERSETUP, // MP_PlayerSetupDef shared with SPLITSCREEN if #defined NONET

    // Options
    MN_OP_MAIN,

    MN_OP_P1CONTROLS,
    MN_OP_CHANGECONTROLS, // OP_ChangeControlsDef shared with P2
    MN_OP_P1MOUSE,
    MN_OP_P1JOYSTICK,
    MN_OP_JOYSTICKSET, // OP_JoystickSetDef shared with P2

    MN_OP_P2CONTROLS,
    MN_OP_P2MOUSE,
    MN_OP_P2JOYSTICK,

    MN_OP_VIDEO,
    MN_OP_VIDEOMODE,
    MN_OP_COLOR,
    MN_OP_OPENGL,
    MN_OP_OPENGL_LIGHTING,
    MN_OP_OPENGL_FOG,
    MN_OP_OPENGL_COLOR,

    MN_OP_SOUND,

    MN_OP_SERVER,
    MN_OP_MONITORTOGGLE,

    MN_OP_DATA,
    MN_OP_ADDONS,
    MN_OP_SCREENSHOTS,
    MN_OP_ERASEDATA,

    // Secrets
    MN_SR_MAIN,
    MN_SR_PANDORA,
    MN_SR_LEVELSELECT,
    MN_SR_UNLOCKCHECKLIST,
    MN_SR_EMBLEMHINT,

    // Addons
    MN_AD_MAIN,

Hierarchy Tree (abridged)

Basically just follow the in-game menus. This illustrates the sibling relationship between MM_MAIN and the other menus.

MN_MAIN

      /---------- MN_SP_LEVELSTATS
     /
MN_SP_MAIN ------ MN_SP_LOAD ------- MN_SP_PLAYER ------- MN_SP_LEVELSELECT
     \
      \---------- MN_SP_TIMEATTACK
       \
        \-------- MN_SP_NIGHTSATTACK

MN_MP_MAIN […]

MN_OP_MAIN […]

MN_SR_MAIN […]

MN_AD_MAIN […]

Example

MAINCFG
NumDemos = 0
HideTitlePics = True

MENU MN_MAIN
BackgroundName = TITLESKY
TitleScrollSpeed = -80
TitleScrollYSpeed = 40
HideTitlePics = False
FadeStrength = 8
Music = _TITLE

MENU MN_SP_MAIN
BackgroundName = TITLESKY
TitleScrollSpeed = 80
TitleScrollYSpeed = 40
Music = GFZALT

MENU MN_SP_TIMEATTACK
BackgroundName = SKY159
TitleScrollSpeed = 10
FadeStrength = 16

MENU MN_SP_NIGHTSATTACK
BackgroundName = SKY53
TitleScrollSpeed = 10
FadeStrength = 16

MENU MN_OP_MAIN
BackgroundName = OPTGEAR1
TitleScrollSpeed = -40
TitleScrollYSpeed = -40
HideTitlePics = True
FadeStrength = 8
Music = MP_FR2
EnterWipe = 66
ExitWipe = 66