Unlocking chapters in your mod: Difference between revisions
(unlock caramelldansen in rockband) |
|||
Line 34: | Line 34: | ||
You can solve this problem in one of two ways. The first and easiest is to dispense with the "-game" parameter and simply hardcode "#mymod_chapter" as the chapterNumberPrefix. The second, which may be copied and pasted across mods, is to lop off the parent folders one by one, perhaps with strtok, until only the mod folder is left. | You can solve this problem in one of two ways. The first and easiest is to dispense with the "-game" parameter and simply hardcode "#mymod_chapter" as the chapterNumberPrefix. The second, which may be copied and pasted across mods, is to lop off the parent folders one by one, perhaps with strtok, until only the mod folder is left. | ||
rockband | |||
Revision as of 09:38, 21 November 2008
Valve Approach
This approach shows the best way to update chapters in your mod.
Renaming
Your maps should be renamed to conform to a pattern which allows you and the game to tell at a glance where a map is chronologically.
Notice Half-Life 2's maps are named according to this pattern:
"d#_areaname_##"
where
- "#" represents the "day" of the game, is 1 for the beginning, 2 for the middle, and 3 for the endgame
- "##" is some numbered segment of an area "areaname"
Example: d1_trainstation_01
However, Half-Life 1's pattern might make unlocking the chapters a little easier:
"c#a$"
where
- # is the chapter number
- $ is the area of the chapter with an extra letter appended as necessary.
Examples: c1a4 c4a1b
Updating
In gameinterface.cpp
, modify void UpdateChapterRestrictions( const char* mapname )
and the array static TITLECOMMENT gTitleComments[]
to conform to your maps' naming format.
Each TITLECOMMENT in gTitleComments contains a char* pBSPName
(the map name or part of a map name) and a char* pTitleName
(the chapter that map or set of maps is part of). If you want the map e2m4 to be part of Chapter 2 of the mod Doom, add {"e2m4", "#Doom_Chapter2_Title"}
to the array (with a trailing comma if it's not last, of course). Replace "e2m4" with simply "e2" and all maps starting with "e2" will be part of Chapter 2.
Note the comment right above gTitleComments, which reads "This list gets searched for the first partial match, so some are out of order". Meaning, if e2m9 is part of Chapter 3 and the rest of the "e2" maps are in Chapter 2, then {"e2m9", "#Doom_Chapter3_Title"}
must come before {"e2", "#Doom_Chapter2_Title"}
in the array.
Necessary Fixes
UpdateChapterRestrictions has an inherent flaw which only comes to light when Steam runs a Source mod. Steam puts the mod's entire path in the command line; the mod MyMod might be run with hl2.exe -game "C:\Steam\SteamApps\SourceMods\MyMod"
.
But UpdateChapterRestrictions assumes "-game" to be just "mymod"(Mod name in lowercase), so char chapterNumberPrefix[64]
ends up as #C:\Steam\SteamApps\SourceMods\MyMod_chapter
, rather than #mymod_chapter
as it should be.
You can solve this problem in one of two ways. The first and easiest is to dispense with the "-game" parameter and simply hardcode "#mymod_chapter" as the chapterNumberPrefix. The second, which may be copied and pasted across mods, is to lop off the parent folders one by one, perhaps with strtok, until only the mod folder is left.
rockband