MainCfg
MAINCFG, see SOC#Script execution.| To do Describe unique parameters |
The MainCfg block is a special SOC block that allows the user to modify a variety of global game settings, such as the timers of various power-ups and other timed effects, the name of the gamedata and save files, the location of the Special Stages and the first Single Player stage, and other miscellaneous settings. It is commonly used in level packs and other addons that extensively modify the game.
The MainCfg block should not be confused with the MAINCFG lump. Although both share the same name and are related to SOCs, they are not otherwise connected. MAINCFG is a reserved lump name in SRB2 – if a WAD file contains a lump with that name, SRB2 will recognize it as a SOC lump and load its contents upon loading the WAD file. Because of this, SOC code that should be executed immediately is often placed in the MAINCFG lump – including the MainCfg block.
Because it contains globally relevant information, the MainCfg block is usually placed at the top of a SOC lump or file. This causes it to be loaded before all other SOC blocks. This is especially relevant due to the ResetData parameter, which can cause previously loaded SOC data to be erased. But even if the ResetData parameter is not set, it is advised to place the MainCfg block first for better organization.
Header
The header of the MainCfg block simply consists of a single line that reads MainCfg. Unlike most other SOC blocks, it contains no slot number, since the data it modifies is global and exists only once.
Parameters
The following is a list of all parameters that can be set in the MainCfg block. Not all of these have to be specified; if a parameter is left out, it will revert to its default value.
Data handling
GameDatadefines which data file is used to save game progress, such as unlocked secrets. Modifications with custom unlockables need to set this parameter. For example, ifGameData = s_mymod.datis set, then the file used to save data iss_mymod.datin the SRB2 directory. The file extension must be.dat.ResetDataresets the sprite, state or Object type tables upon loading the file. This means that any changes made to these tables by previously loaded SOC files will be reverted. The value determines which tables to reset: Add 1 to reset the sprite table, 2 to reset the state table, and 4 to reset the Object type table. The values can be combined. No freeslot declarations, state definitions or Object type definitions should be placed above this line in the SOC lump, as they will be erased as well.
Map locations
These parameters determine which slots certain special maps are placed in.
SPStage_Startsets the map number of the first map in the Single Player campaign. This is the map the game warps to when starting a new Single Player game. Unlike the Special Stages, the Single Player maps do not have to be placed in successive map slots, because the individual level headers determine which map is loaded next. This parameter merely tells the game where the first level is. Defaults to1if the parameter is omitted.SPMarathon_Startsets the map number of the first map in Marathon Run. Useful for non-linear campaigns, where this can be used to set a speedrun's starting point, after which each map can utilize the MarathonNext parameter to create a set order of maps. Defaults to SPStage_Start's value if the parameter is omitted.SStage_Startsets the map number of the first Single Player Special Stage. All other Single Player Special Stages must be clustered together in the immediately following map slots. For example, ifSStage_Start = 50, then the first Special Stage should be inMAP50, the second inMAP51, and the seventh inMAP56. Defaults to50if the parameter is omitted.SMPStage_Startsets the map number of the first Coop Special Stage. All other Coop Special Stages must be clustered together in the immediately following map slots. Set this to the same value asSStage_Startto use the same stages in both gametypes. Defaults to60if the parameter is omitted.TitleMapsets the map number to display as a background for the title screen. If set to0, no title map is used and theTITLESKYlump is displayed as a background graphic instead. Defaults to0if the parameter is omitted, although SRB2's own resource files set this to99.TutorialMapsets the map number of the tutorial map, which is accessed via the "Tutorial" option in the Single Player option menu. Set this to0to disable the tutorial. Defaults to0if the parameter is omitted, although SRB2's own resource files set this toZ0.BootMapsets the map number to warp to immediately when starting the game. If set to0, the game does not warp to a map on startup. Defaults to0if the parameter is omitted.
Cutscenes
These parameters can be used to change the cutscenes that are used for the intro and credits.
IntroToPlaydetermines the number of the cutscene to play as the intro, replacing the existing intro cutscene SRB2 uses. For example, ifIntroToPlay = 2is set, then the game will search for a cutscene block with a header ofCutscene 2to be played as the intro.CreditsCutscenedetermines the number of the cutscene to use for the credits.UseBlackRockdetermines whether the Black Rock cutscene is used upon completing the Single Player campaign (true) or not (false), and also toggles the Black Rock being present in the Marathon Run menu. Defaults totrueif the parameter is omitted.
Title screen
These parameters affect different properties of the title screen.
LoopTitledetermines whether to loop the title screen music (true) or play it just once (false). Defaults tofalseif the parameter is omitted.TitleScrollXSpeed(orTitleScrollSpeed) sets the speed at which to scroll the title screen background rightwards or, if a title map is used, the speed at which to spin the title map's camera counterclockwise. Use negative values for leftward scrolling or clockwise spinning, respectively. For scrolling the background, a value of 1 equals 1/16th of a pixel per tic. For spinning the title map camera, a value of 1 equals 1/64th of a degree per tic. The default value is20, which gives a speed of 1.25 pixels per tic or slightly below 11 degrees per second.TitleScrollYSpeedsets the speed at which to scroll the title screen background downwards. Use negative values for upward scrolling. A value of 1 equals 1/16th of a pixel per tic. The default value is0, which gives no scrolling. If a title map is used, this parameter has no effect.TitlePicsModedetermines how graphics are overlaid on top of the title screen background or title map. If set toHide,HiddenorNone, no extra graphics are displayed. If set toAlacroix, the animated SRB2 logo is displayed. If set toOld, a still image of the SRB2 logo is displayed. If set toUser, a custom animation or still image is displayed. The parameters used for configuring this are listed below. Defaults toOldif the parameter is omitted, although SRB2's own resource files set this toAlacroix.TitlePicsHideorHideTitlePicsdetermines whether extra graphics are overlaid on top of the title screen background or title map (true) or not (false). Setting this totrueis equivalent to settingTitlePicsMode = Hide. Defaults tofalseif the parameter is omitted.TitlePicsScalesets the scaling of the title screen graphics. Possible values range from1to8. For a specified value x, the scale of the graphics will be 1/x, e.g.,TitlePicsScale = 8will scale the graphics down to 1/8th of their original size. This setting is not used ifTitlePicsMode = Alacroixis set. Defaults to1if the parameter is omitted.TitlePicsNamesets the lumps to use for the title screen graphics when settingTitlePicsMode = User. To use a still image, set this to the name of the graphics lump to use. To create an animated sequence, set this to a lump name prefix with at most six letters, e.g.,NEWTS. The game will then search for lumpsNEWTS00throughNEWTS99to make up the frames of the animation. The length of the animation depends on how many lumps are supplied.TitlePicsTicssets the number of tics to show each image in the title screen animation when settingTitlePicsMode = Userand using an animated sequence. For example, a value of3will make the animation advance to the next frame every 3 tics. Defaults to1if the parameter is omitted.TitlePicsLoopset the frame number that the title screen animation will loop back to when settingTitlePicsMode = Userand using an animated sequence. Using the previousNEWTSexample, a value of16will make the animation loop back toNEWTS16after showing the last frame. If set to-1, the animation will not loop. Defaults to-1if the parameter is omitted.TitlePicsXandTitlePicsYset the coordinates at which the title screen graphics are placed when settingTitlePicsMode = User. Both parameters default to0if they are omitted.TitlePicsScalesAvailablesets which graphics exist for each scale when settingTitlePicsMode = Alacroix. Possible values range from1to6and are separated by commas, e.g.,TitlePicsScalesAvailable = 2,3,6means there are graphics for 1/2 scale, 1/3 scale, and 1/6 scale.
Title screen demos
These parameters affect the demos that are played back at the title screen.
NumDemossets the number of demos that are played back at the title screen. The demo lumps to be played should have the lump namesDEMO_xxx, withxxxstarting at001and continuing up until the value of this parameter. The default value is0, although SRB2's own resource files set this to4.DemoDelayTimesets the amount of time that the game will stay on the title screen between playing back demos. The default value is15*TICRATE(15 seconds).DemoIdleTimesets the additional amount of time that the game will stay on the title screen if theDemoDelayTimewas depleted while the console was open or the user was in a menu. Once the console or menu is closed, the game will additionally deplete theDemoIdleTimebefore playing back a demo. The default value is3*TICRATE(3 seconds).
Customization
These parameters customize various minor game settings.
RedTeamsets the skin color of players on the red team in Team Match and Capture the Flag games in the formatSKINCOLOR_X, where X is the name of the color, e.g.,SKINCOLOR_RED. The default value isSKINCOLOR_RED. See List of skin colors for a full list of available colors.BlueTeamsets the skin color of players on the blue team in Team Match and Capture the Flag games in the formatSKINCOLOR_X, where X is the name of the color, e.g.,SKINCOLOR_RED. The default value isSKINCOLOR_BLUE.RedRingsets the color of the red ring thrown in Match and other combative gametypes in the formatSKINCOLOR_X, where X is the name of the color, e.g.,SKINCOLOR_RED. The default value isSKINCOLOR_SALMON.BlueRingsets the skin color of the rings thrown by players on the blue team in Team Match and Capture the Flag games in the formatSKINCOLOR_X, where X is the name of the color, e.g.,SKINCOLOR_RED. The default value isSKINCOLOR_CORNFLOWER.DisableSpeedAdjustdetermines whether to change the player character's animations according to the player's velocity, for example when Sonic's walking animation speeds up as he walks faster (false), or not (true). Defaults tofalseif the parameter is omitted. Note that this will affect all characters in the game. To set this for specific characters, use theSF_NOSPEEDADJUSTskin flag.Use1UpSounddetermines whether to play the sound effectsfx_oneup(true) or the music trackmus_xtlife(false) when earning an extra lives. Defaults tofalseif the parameter is omitted.MaxXtraLifedetermines the maximum number of extra lives that can be earned from collecting rings. An extra life is awarded for each 100 rings that the player collects, until the maximum is reached. Defaults to2if the parameter is omitted, which means that no more extra lives are awarded for collecting 300 rings and above.StartCharsets the character select entry that the character select screen highlights initially. Defaults to0if the parameter is omitted.UseContinuesdetermines whether continues can be earned (true) or not (false) from a Special Stage in the Single Player campaign. Defaults tofalseif the parameter is omitted.
Timers
These parameters control how long the effects of certain power-ups and other timers last. They are measured in tics, of which 35 equal one second. Multiply the values with the constant TICRATE (35) to convert them to seconds.
InvulnTicssets how long the Invincibility power-up lasts. The default value is20*TICRATE(20 seconds).SneakerTicssets how long the Super Sneakers power-up lasts. The default value is20*TICRATE(20 seconds).FlashingTicssets how long a player flashes and is invincible after taking damage. The default value is3*TICRATE(3 seconds).TailsFlyTicssets how long Tails can fly before getting tired. The default value is8*TICRATE(8 seconds).UnderwaterTicssets how long the player can stay underwater before drowning. Note that this value includes the drowning countdown, not just the period before it. To retain the full countdown, this value should be at least 11.5 seconds. The default value is30*TICRATE(30 seconds). Setting this value to0completely disables the drowning system, including the aquaphobia sound effect.SpacetimeTicssets how long the player can survive in a space countdown before suffocating. Note that the timer can actually be expanded beyond just the countdown, so that there is a period before the countdown starts, like in water. The default value is11*TICRATE + (TICRATE/2)(11.5 seconds).ExtraLifeTicssets how long the extra life music plays. Note that this value is completely separate from the length of the actual extra life tune. If this value is shorter than the length of the tune, the tune will be cut off. If it is longer, the remaining time will be filled with silence. If a custom extra life tune is used, this parameter should be adjusted to match the length of the custom tune. The default value is4*TICRATE(4 seconds).NiGHTSLinkTicssets how long it takes for a NiGHTS link to fade out. The default value is2*TICRATE(2 seconds).GameOverTicssets how long the game stays at a Game Over screen before switching to the continue screen or the title screen. This only affects Single Player mode, where the game eventually switches to another screen. In other applicable modes, such as Coop and Competition, the Game Over screen will be displayed indefinitely until the other players complete the level. The default value is11*TICRATE(11 seconds).AmmoRemovalTicssets how long the ammo removal warning will be displayed when shooting a weapon ring without regular rings in Match and related gametypes. The default value is2*TICRATE(2 seconds).
Netgame
ShareEmblemsdetermines if the game should share emblems across players instead of client sided. (true) or not (false)
Miscellaneous
ExecCfgsets the file name of a console script to be executed when the WAD or PK3 file is loaded.CustomVersionreplaces the "v2.2.x" version string in the bottom-left corner of the game menus with a customized version string. This parameter supports custom colors.
Example
MainCfg SpStage_Start = A1 SStage_Start = B1 GameData = s_mymod.dat ResetData = 7 TailsFlyTics = 10*TICRATE CustomVersion = v1.1
| SOC | [view] | |
| General | Clear • MainCfg
| |
| Objects | Object • State • Sound • Sprite2 • SpriteInfo • Sprite2Info • Freeslot
| |
| Unlockable content | Emblem • ExtraEmblem • Unlockable • ConditionSet
| |
| Miscellaneous | Wipes • Character • Level • Cutscene / Scene • Prompt • Menu • HudItem
| |
| Related links | Actions • Constants • Custom Object tutorial | |