Refactoring ahoy
* Instead of doing constant G_MapNumbers when finding the relationship between maps and cups...
* Add a cache of level IDs to cups, to go with the strings.
* Add a cache of the cup pointer to maps, so we don't have to search through all cups to find our map. (done in P_InitMapData)
* Pre-emptive work: G_IsSpecialStage and P_GetNextEmerald now reference cup data instead of a hardcoded ID set.
* Remove a bunch of old stuff from mapheaderinfo_t/associated, and reorder what stays
* Countdowntimer? 💥
* Startrings? 💥
* sstimer/ssspheres? 💥
* forcecharacter? 💥 (distinct from forceskin)
* interscreen? 💥
* sstage_start/end and smpstage_start/end? 💥💥💥💥
* You've been blocked
* G_MapNumber now returns a special NEXTMAP_INVALID if not found, for more consistent reference.
* Incorporate a good chunk of the `edit-headers` branch. Can't clear maps individually because of the new restrictions on sequential mapheaders, but we can add a "disable in vote screen, not even for map hell/archive" flag to a map at some future juncture for equivalent functionality...
This commit is contained in:
parent
66f965c2c0
commit
1475feb734
14 changed files with 129 additions and 240 deletions
|
|
@ -1428,7 +1428,7 @@ UINT8 CanChangeSkin(INT32 playernum)
|
|||
return true;
|
||||
|
||||
// Force skin in effect.
|
||||
if ((cv_forceskin.value != -1) || (mapheaderinfo[gamemap-1] && mapheaderinfo[gamemap-1]->forcecharacter[0] != '\0'))
|
||||
if (cv_forceskin.value != -1)
|
||||
return false;
|
||||
|
||||
// Can change skin in intermission and whatnot.
|
||||
|
|
|
|||
|
|
@ -160,6 +160,8 @@ void clear_levels(void)
|
|||
|
||||
P_DeleteFlickies(nummapheaders);
|
||||
|
||||
Z_Free(mapheaderinfo[nummapheaders]->mainrecord);
|
||||
|
||||
Patch_Free(mapheaderinfo[nummapheaders]->thumbnailPic);
|
||||
Patch_Free(mapheaderinfo[nummapheaders]->minimapPic);
|
||||
|
||||
|
|
@ -169,7 +171,22 @@ void clear_levels(void)
|
|||
mapheaderinfo[nummapheaders] = NULL;
|
||||
}
|
||||
|
||||
// Realloc the one for the current gamemap as a safeguard
|
||||
// Clear out the cache
|
||||
{
|
||||
cupheader_t *cup = kartcupheaders;
|
||||
UINT8 i;
|
||||
|
||||
while (cup)
|
||||
{
|
||||
for (i = 0; i < CUPCACHE_MAX; i++)
|
||||
{
|
||||
cup->cachedlevels[i] = NEXTMAP_INVALID;
|
||||
}
|
||||
cup = cup->next;
|
||||
}
|
||||
}
|
||||
|
||||
// Exit the current gamemap as a safeguard
|
||||
if (Playing())
|
||||
COM_BufAddText("exitgame"); // Command_ExitGame_f() but delayed
|
||||
}
|
||||
|
|
@ -1077,11 +1094,11 @@ void readlevelheader(MYFILE *f, char * name)
|
|||
char *tmp;
|
||||
INT32 i;
|
||||
|
||||
const INT32 num = G_MapNumber(name);
|
||||
INT32 num = G_MapNumber(name);
|
||||
|
||||
if (num >= nummapheaders)
|
||||
{
|
||||
P_AllocMapHeader((INT16)(num));
|
||||
P_AllocMapHeader((INT16)(num = nummapheaders));
|
||||
}
|
||||
else if (f->wad > mainwads)
|
||||
{
|
||||
|
|
@ -1337,11 +1354,6 @@ void readlevelheader(MYFILE *f, char * name)
|
|||
mapheaderinfo[num]->mustrack = ((UINT16)i - 1);
|
||||
else if (fastcmp(word, "MUSICPOS"))
|
||||
mapheaderinfo[num]->muspos = (UINT32)get_number(word2);
|
||||
else if (fastcmp(word, "FORCECHARACTER"))
|
||||
{
|
||||
strlcpy(mapheaderinfo[num]->forcecharacter, word2, SKINNAMESIZE+1);
|
||||
strlwr(mapheaderinfo[num]->forcecharacter); // skin names are lowercase
|
||||
}
|
||||
else if (fastcmp(word, "WEATHER"))
|
||||
mapheaderinfo[num]->weather = get_precip(word2);
|
||||
else if (fastcmp(word, "SKYTEXTURE"))
|
||||
|
|
@ -3077,24 +3089,6 @@ void readmaincfg(MYFILE *f)
|
|||
if (maptmp <= nummapheaders)
|
||||
spmarathon_start = maptmp;
|
||||
}
|
||||
else if (fastcmp(word, "SSTAGE_START"))
|
||||
{
|
||||
INT16 maptmp = G_MapNumber(word2)+1;
|
||||
if (maptmp <= nummapheaders)
|
||||
{
|
||||
sstage_start = maptmp;
|
||||
sstage_end = (sstage_start+13); // 14 special stages
|
||||
}
|
||||
}
|
||||
else if (fastcmp(word, "SMPSTAGE_START"))
|
||||
{
|
||||
INT16 maptmp = G_MapNumber(word2)+1;
|
||||
if (maptmp <= nummapheaders)
|
||||
{
|
||||
smpstage_start = maptmp;
|
||||
smpstage_end = (smpstage_start+13); // 14 special stages
|
||||
}
|
||||
}
|
||||
else if (fastcmp(word, "REDTEAM"))
|
||||
{
|
||||
skincolor_redteam = (UINT16)get_number(word2);
|
||||
|
|
@ -3538,16 +3532,17 @@ void readcupheader(MYFILE *f, cupheader_t *cup)
|
|||
}
|
||||
|
||||
cup->levellist[cup->numlevels] = Z_StrDup(tmp);
|
||||
cup->cachedlevels[cup->numlevels] = NEXTMAP_INVALID;
|
||||
cup->numlevels++;
|
||||
} while((tmp = strtok(NULL,",")) != NULL);
|
||||
}
|
||||
else if (fastcmp(word, "BONUSGAME"))
|
||||
{
|
||||
cup->bonusgame = Z_StrDup(word2);
|
||||
cup->levellist[CUPCACHE_BONUS] = Z_StrDup(word2);
|
||||
}
|
||||
else if (fastcmp(word, "SPECIALSTAGE"))
|
||||
{
|
||||
cup->specialstage = Z_StrDup(word2);
|
||||
cup->levellist[CUPCACHE_SPECIAL] = Z_StrDup(word2);
|
||||
}
|
||||
else if (fastcmp(word, "EMERALDNUM"))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -209,7 +209,6 @@ extern boolean splitscreen_partied[MAXPLAYERS];
|
|||
|
||||
// Maps of special importance
|
||||
extern INT16 spstage_start, spmarathon_start;
|
||||
extern INT16 sstage_start, sstage_end, smpstage_start, smpstage_end;
|
||||
|
||||
extern char * titlemap;
|
||||
extern boolean hidetitlepics;
|
||||
|
|
@ -224,8 +223,6 @@ extern boolean looptitle;
|
|||
// CTF colors.
|
||||
extern UINT16 skincolor_redteam, skincolor_blueteam, skincolor_redring, skincolor_bluering;
|
||||
|
||||
extern tic_t countdowntimer;
|
||||
extern boolean countdowntimeup;
|
||||
extern boolean exitfadestarted;
|
||||
|
||||
struct scene_t
|
||||
|
|
@ -316,8 +313,6 @@ extern textprompt_t *textprompts[MAX_PROMPTS];
|
|||
extern INT16 nextmapoverride;
|
||||
extern UINT8 skipstats;
|
||||
|
||||
extern UINT32 ssspheres; // Total # of spheres in a level
|
||||
|
||||
// Fun extra stuff
|
||||
extern INT16 lastmap; // Last level you were at (returning from special stages).
|
||||
|
||||
|
|
@ -355,12 +350,36 @@ struct mapheader_lighting_t
|
|||
|
||||
#define MAXMUSNAMES 3 // maximum definable music tracks per level
|
||||
|
||||
// This could support more, but is that a good idea?
|
||||
// Keep in mind that it may encourage people making overly long cups just because they "can", and would be a waste of memory.
|
||||
#define MAXLEVELLIST 5
|
||||
#define CUPCACHE_BONUS MAXLEVELLIST
|
||||
#define CUPCACHE_SPECIAL MAXLEVELLIST+1
|
||||
#define CUPCACHE_MAX CUPCACHE_SPECIAL+1
|
||||
|
||||
struct cupheader_t
|
||||
{
|
||||
UINT16 id; ///< Cup ID
|
||||
char name[15]; ///< Cup title (14 chars)
|
||||
char icon[9]; ///< Name of the icon patch
|
||||
char *levellist[CUPCACHE_MAX]; ///< List of levels that belong to this cup
|
||||
INT16 cachedlevels[CUPCACHE_MAX]; ///< IDs in levellist, bonusgame, and specialstage
|
||||
UINT8 numlevels; ///< Number of levels defined in levellist
|
||||
UINT8 emeraldnum; ///< ID of Emerald to use for special stage (1-7 for Chaos Emeralds, 8-14 for Super Emeralds, 0 for no emerald)
|
||||
SINT8 unlockrequired; ///< An unlockable is required to select this cup. -1 for no unlocking required.
|
||||
cupheader_t *next; ///< Next cup in linked list
|
||||
};
|
||||
|
||||
extern cupheader_t *kartcupheaders; // Start of cup linked list
|
||||
extern UINT16 numkartcupheaders;
|
||||
|
||||
/** Map header information.
|
||||
*/
|
||||
struct mapheader_t
|
||||
{
|
||||
// Core game information, not user-modifiable directly
|
||||
char *lumpname; ///< Lump name can be really long
|
||||
lumpnum_t lumpnum; ///< Lump number for the map
|
||||
lumpnum_t lumpnum; ///< Lump number for the map, used by vres_GetMap
|
||||
|
||||
void *thumbnailPic; ///< Lump data for the level select thumbnail.
|
||||
void *minimapPic; ///< Lump data for the minimap graphic.
|
||||
|
|
@ -368,17 +387,22 @@ struct mapheader_t
|
|||
UINT8 mapvisited; ///< A set of flags that says what we've done in the map.
|
||||
recorddata_t *mainrecord; ///< Stores best time attack data
|
||||
|
||||
cupheader_t *cup; ///< Cached cup
|
||||
|
||||
// Titlecard information
|
||||
char lvlttl[22]; ///< Level name without "Zone". (21 character limit instead of 32, 21 characters can display on screen max anyway)
|
||||
char subttl[33]; ///< Subtitle for level
|
||||
char zonttl[22]; ///< "ZONE" replacement name
|
||||
char actnum[3]; ///< SRB2Kart: Now a 2 character long string.
|
||||
|
||||
// Selection metadata
|
||||
char keywords[33]; ///< Keywords separated by space to search for. 32 characters.
|
||||
|
||||
SINT8 unlockrequired; ///< Is an unlockable required to play this level? -1 if no.
|
||||
UINT8 levelselect; ///< Is this map available in the level select? If so, which map list is it available in?
|
||||
UINT8 menuflags; ///< LF2_flags: options that affect record attack / nights mode menus
|
||||
UINT8 menuflags; ///< LF2_flags: options that affect record attack menus
|
||||
|
||||
// Operational metadata
|
||||
UINT16 levelflags; ///< LF_flags: merged booleans into one UINT16 for space, see below
|
||||
UINT32 typeoflevel; ///< Combination of typeoflevel flags.
|
||||
UINT8 numlaps; ///< Number of laps in circuit mode, unless overridden.
|
||||
|
|
@ -390,45 +414,37 @@ struct mapheader_t
|
|||
UINT32 muspos; ///< Music position to jump to.
|
||||
UINT8 musname_size; ///< Number of music tracks defined
|
||||
|
||||
char forcecharacter[17]; ///< (SKINNAMESIZE+1) Skin to switch to or "" to disable.
|
||||
|
||||
UINT8 weather; ///< 0 = sunny day, 1 = storm, 2 = snow, 3 = rain, 4 = blank, 5 = thunder w/o rain, 6 = rain w/o lightning, 7 = heat wave.
|
||||
// Sky information
|
||||
UINT8 weather; ///< See preciptype_t
|
||||
char skytexture[9]; ///< Sky texture to use.
|
||||
INT16 skybox_scalex; ///< Skybox X axis scale. (0 = no movement, 1 = 1:1 movement, 16 = 16:1 slow movement, -4 = 1:4 fast movement, etc.)
|
||||
INT16 skybox_scaley; ///< Skybox Y axis scale.
|
||||
INT16 skybox_scalez; ///< Skybox Z axis scale.
|
||||
|
||||
// Extra information.
|
||||
char interscreen[8]; ///< 320x200 patch to display at intermission.
|
||||
|
||||
INT16 countdown; ///< Countdown until level end?
|
||||
|
||||
// SRB2kart
|
||||
fixed_t mobj_scale; ///< Replacement for TOL_ERZ3
|
||||
// Distance information
|
||||
fixed_t mobj_scale; ///< Defines the size all object calculations are relative to
|
||||
fixed_t default_waypoint_radius; ///< 0 is a special value for DEFAULT_WAYPOINT_RADIUS, but scaled with mobjscale
|
||||
|
||||
// Visual information
|
||||
UINT16 palette; ///< PAL lump to use on this map
|
||||
UINT16 encorepal; ///< PAL for encore mode
|
||||
mapheader_lighting_t lighting; ///< Wall and sprite lighting
|
||||
mapheader_lighting_t lighting_encore; ///< Alternative lighting for Encore mode
|
||||
boolean use_encore_lighting; ///< Whether to use separate Encore lighting
|
||||
|
||||
UINT16 startrings; ///< Number of rings players start with.
|
||||
INT32 sstimer; ///< Timer for special stages.
|
||||
UINT32 ssspheres; ///< Sphere requirement in special stages.
|
||||
|
||||
// Freed animals stuff.
|
||||
// Freed animal information
|
||||
UINT8 numFlickies; ///< Internal. For freed flicky support.
|
||||
mobjtype_t *flickies; ///< List of freeable flickies in this level. Allocated dynamically for space reasons. Be careful.
|
||||
|
||||
// Script information
|
||||
char runsoc[33]; ///< SOC to execute at start of level (32 character limit instead of 63)
|
||||
char scriptname[33]; ///< Script to use when the map is switched to. (32 character limit instead of 191)
|
||||
|
||||
// Cutscene information
|
||||
UINT8 precutscenenum; ///< Cutscene number to play BEFORE a level starts.
|
||||
UINT8 cutscenenum; ///< Cutscene number to use, 0 for none.
|
||||
|
||||
// Lua stuff.
|
||||
// (This is not ifdeffed so the map header structure can stay identical, just in case.)
|
||||
// Lua information
|
||||
UINT8 numCustomOptions; ///< Internal. For Lua custom value support.
|
||||
customoption_t *customopts; ///< Custom options. Allocated dynamically for space reasons. Be careful.
|
||||
|
||||
|
|
@ -453,27 +469,6 @@ extern INT32 nummapheaders, mapallocsize;
|
|||
|
||||
#define MAXMAPLUMPNAME 64 // includes \0, for cleaner savedata
|
||||
|
||||
// This could support more, but is that a good idea?
|
||||
// Keep in mind that it may encourage people making overly long cups just because they "can", and would be a waste of memory.
|
||||
#define MAXLEVELLIST 5
|
||||
|
||||
struct cupheader_t
|
||||
{
|
||||
UINT16 id; ///< Cup ID
|
||||
char name[15]; ///< Cup title (14 chars)
|
||||
char icon[9]; ///< Name of the icon patch
|
||||
char * levellist[MAXLEVELLIST]; ///< List of levels that belong to this cup
|
||||
UINT8 numlevels; ///< Number of levels defined in levellist
|
||||
char * bonusgame; ///< Map number to use for bonus game
|
||||
char * specialstage; ///< Map number to use for special stage
|
||||
UINT8 emeraldnum; ///< ID of Emerald to use for special stage (1-7 for Chaos Emeralds, 8-14 for Super Emeralds, 0 for no emerald)
|
||||
SINT8 unlockrequired; ///< An unlockable is required to select this cup. -1 for no unlocking required.
|
||||
cupheader_t *next; ///< Next cup in linked list
|
||||
};
|
||||
|
||||
extern cupheader_t *kartcupheaders; // Start of cup linked list
|
||||
extern UINT16 numkartcupheaders;
|
||||
|
||||
// Gametypes
|
||||
#define NUMGAMETYPEFREESLOTS 128
|
||||
|
||||
|
|
@ -584,7 +579,6 @@ extern UINT32 token; ///< Number of tokens collected in a level
|
|||
extern UINT32 tokenlist; ///< List of tokens collected
|
||||
extern boolean gottoken; ///< Did you get a token? Used for end of act
|
||||
extern INT32 tokenbits; ///< Used for setting token bits
|
||||
extern INT32 sstimer; ///< Time allotted in the special stage
|
||||
extern UINT32 bluescore; ///< Blue Team Scores
|
||||
extern UINT32 redscore; ///< Red Team Scores
|
||||
|
||||
|
|
|
|||
60
src/g_game.c
60
src/g_game.c
|
|
@ -147,12 +147,10 @@ INT32 g_localplayers[MAXSPLITSCREENPLAYERS];
|
|||
|
||||
tic_t gametic;
|
||||
tic_t levelstarttic; // gametic at level start
|
||||
UINT32 ssspheres; // old special stage
|
||||
INT16 lastmap; // last level you were at (returning from special stages)
|
||||
tic_t timeinmap; // Ticker for time spent in level (used for levelcard display)
|
||||
|
||||
INT16 spstage_start, spmarathon_start;
|
||||
INT16 sstage_start, sstage_end, smpstage_start, smpstage_end;
|
||||
|
||||
char * titlemap = NULL;
|
||||
boolean hidetitlepics = false;
|
||||
|
|
@ -169,8 +167,6 @@ UINT16 skincolor_blueteam = SKINCOLOR_BLUE;
|
|||
UINT16 skincolor_redring = SKINCOLOR_RASPBERRY;
|
||||
UINT16 skincolor_bluering = SKINCOLOR_PERIWINKLE;
|
||||
|
||||
tic_t countdowntimer = 0;
|
||||
boolean countdowntimeup = false;
|
||||
boolean exitfadestarted = false;
|
||||
|
||||
cutscene_t *cutscenes[128];
|
||||
|
|
@ -202,9 +198,6 @@ UINT32 tokenlist; // List of tokens collected
|
|||
boolean gottoken; // Did you get a token? Used for end of act
|
||||
INT32 tokenbits; // Used for setting token bits
|
||||
|
||||
// Old Special Stage
|
||||
INT32 sstimer; // Time allotted in the special stage
|
||||
|
||||
tic_t totalplaytime;
|
||||
UINT32 matchesplayed; // SRB2Kart
|
||||
boolean gamedataloaded = false;
|
||||
|
|
@ -735,13 +728,13 @@ INT32 G_MapNumber(const char * name)
|
|||
|
||||
for (map = 0; map < nummapheaders; ++map)
|
||||
{
|
||||
if (strcasecmp(mapheaderinfo[map]->lumpname, name) == 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
if (strcasecmp(mapheaderinfo[map]->lumpname, name) != 0)
|
||||
continue;
|
||||
|
||||
return map;
|
||||
}
|
||||
|
||||
return map;
|
||||
return NEXTMAP_INVALID;
|
||||
}
|
||||
|
||||
#ifdef NEXTMAPINSOC
|
||||
|
|
@ -3306,18 +3299,15 @@ INT32 G_GetGametypeByName(const char *gametypestr)
|
|||
//
|
||||
boolean G_IsSpecialStage(INT32 mapnum)
|
||||
{
|
||||
#if 1
|
||||
(void)mapnum;
|
||||
#else
|
||||
if (modeattacking == ATTACKING_TIME)
|
||||
return false;
|
||||
if (mapnum >= sstage_start && mapnum <= sstage_end)
|
||||
return true;
|
||||
if (mapnum >= smpstage_start && mapnum <= smpstage_end)
|
||||
return true;
|
||||
#endif
|
||||
mapnum--; // gamemap-based to 0 indexed
|
||||
|
||||
return false;
|
||||
if (mapnum > nummapheaders || !mapheaderinfo[mapnum])
|
||||
return false;
|
||||
|
||||
if (!mapheaderinfo[mapnum]->cup || mapheaderinfo[mapnum]->cup->cachedlevels[CUPCACHE_SPECIAL] != mapnum)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//
|
||||
|
|
@ -3492,12 +3482,12 @@ UINT32 G_TOLFlag(INT32 pgametype)
|
|||
|
||||
INT16 G_GetFirstMapOfGametype(UINT8 pgametype)
|
||||
{
|
||||
INT16 mapnum = nummapheaders;
|
||||
INT16 mapnum = NEXTMAP_INVALID;
|
||||
|
||||
/* G: not sure what to do with this
|
||||
if ((gametypedefaultrules[pgametype] & GTR_CAMPAIGN) && kartcupheaders)
|
||||
{
|
||||
mapnum = G_MapNumber(kartcupheaders->levellist[0]);
|
||||
mapnum = kartcupheaders->cachedlevels[0];
|
||||
}
|
||||
*/
|
||||
|
||||
|
|
@ -3825,7 +3815,7 @@ static void G_GetNextMap(void)
|
|||
else
|
||||
{
|
||||
// Proceed to next map
|
||||
const INT32 cupLevelNum = G_MapNumber(grandprixinfo.cup->levellist[grandprixinfo.roundnum]);
|
||||
const INT32 cupLevelNum =grandprixinfo.cup->cachedlevels[grandprixinfo.roundnum];
|
||||
|
||||
if (cupLevelNum < nummapheaders && mapheaderinfo[cupLevelNum])
|
||||
{
|
||||
|
|
@ -3851,19 +3841,14 @@ static void G_GetNextMap(void)
|
|||
if (grandprixinfo.gp == true)
|
||||
{
|
||||
register INT16 cm;
|
||||
cupheader_t *cup = kartcupheaders;
|
||||
cupheader_t *cup = mapheaderinfo[gamemap-1]->cup;
|
||||
UINT8 gettingresult = 0;
|
||||
|
||||
// While this can't produce an infinite loop IN THE ITERATION, it
|
||||
// is technically possible for you to keep cycling inside a lousy
|
||||
// cul-de-sac of the same maps over and over while marathonning
|
||||
// them all, if the same map is present in the cup list multiple
|
||||
// times. There is no good solution. Don't dupe maps between cups!
|
||||
while (cup)
|
||||
{
|
||||
for (i = 0; i < cup->numlevels; i++)
|
||||
{
|
||||
cm = G_MapNumber(cup->levellist[i]);
|
||||
cm = cup->cachedlevels[i];
|
||||
|
||||
// Not valid?
|
||||
if (cm >= nummapheaders
|
||||
|
|
@ -3955,9 +3940,7 @@ static void G_GetNextMap(void)
|
|||
}
|
||||
|
||||
// We are committed to this map now.
|
||||
// We may as well allocate its header if it doesn't exist
|
||||
// (That is, if it's a real map)
|
||||
if (nextmap < NEXTMAP_SPECIAL && (nextmap >= nummapheaders || !mapheaderinfo[nextmap] || mapheaderinfo[nextmap]->lumpnum == LUMPERROR))
|
||||
if (nextmap == NEXTMAP_INVALID || (nextmap < NEXTMAP_SPECIAL && (nextmap >= nummapheaders || !mapheaderinfo[nextmap] || mapheaderinfo[nextmap]->lumpnum == LUMPERROR)))
|
||||
I_Error("G_GetNextMap: Internal map ID %d not found (nummapheaders = %d)\n", nextmap, nummapheaders);
|
||||
}
|
||||
|
||||
|
|
@ -4261,11 +4244,6 @@ void G_LoadGameSettings(void)
|
|||
{
|
||||
// defaults
|
||||
spstage_start = spmarathon_start = 1;
|
||||
sstage_start = 50;
|
||||
sstage_end = 56; // 7 special stages in vanilla SRB2
|
||||
sstage_end++; // plus one weirdo
|
||||
smpstage_start = 60;
|
||||
smpstage_end = 66; // 7 multiplayer special stages too
|
||||
|
||||
// initialize free sfx slots for skin sounds
|
||||
S_InitRuntimeSounds();
|
||||
|
|
|
|||
|
|
@ -48,7 +48,8 @@ typedef enum
|
|||
NEXTMAP_EVALUATION = INT16_MAX-2,
|
||||
NEXTMAP_CREDITS = INT16_MAX-3,
|
||||
NEXTMAP_CEREMONY = INT16_MAX-4,
|
||||
NEXTMAP_SPECIAL = NEXTMAP_CEREMONY
|
||||
NEXTMAP_INVALID = INT16_MAX-5, // Always last (swap with NEXTMAP_RESERVED when removing that)
|
||||
NEXTMAP_SPECIAL = NEXTMAP_INVALID
|
||||
} nextmapspecial_t;
|
||||
|
||||
extern INT32 gameovertics;
|
||||
|
|
|
|||
|
|
@ -2499,7 +2499,6 @@ static int mapheaderinfo_get(lua_State *L)
|
|||
{
|
||||
mapheader_t *header = *((mapheader_t **)luaL_checkudata(L, 1, META_MAPHEADER));
|
||||
const char *field = luaL_checkstring(L, 2);
|
||||
INT16 i;
|
||||
if (fastcmp(field,"lvlttl"))
|
||||
lua_pushstring(L, header->lvlttl);
|
||||
else if (fastcmp(field,"subttl"))
|
||||
|
|
@ -2533,8 +2532,6 @@ static int mapheaderinfo_get(lua_State *L)
|
|||
lua_pushinteger(L, header->muspos);
|
||||
else if (fastcmp(field,"musname_size"))
|
||||
lua_pushinteger(L, header->musname_size);
|
||||
else if (fastcmp(field,"forcecharacter"))
|
||||
lua_pushstring(L, header->forcecharacter);
|
||||
else if (fastcmp(field,"weather"))
|
||||
lua_pushinteger(L, header->weather);
|
||||
else if (fastcmp(field,"skytexture"))
|
||||
|
|
@ -2545,12 +2542,7 @@ static int mapheaderinfo_get(lua_State *L)
|
|||
lua_pushinteger(L, header->skybox_scaley);
|
||||
else if (fastcmp(field,"skybox_scalez"))
|
||||
lua_pushinteger(L, header->skybox_scalez);
|
||||
else if (fastcmp(field,"interscreen")) {
|
||||
for (i = 0; i < 8; i++)
|
||||
if (!header->interscreen[i])
|
||||
break;
|
||||
lua_pushlstring(L, header->interscreen, i);
|
||||
} else if (fastcmp(field,"runsoc"))
|
||||
else if (fastcmp(field,"runsoc"))
|
||||
lua_pushstring(L, header->runsoc);
|
||||
else if (fastcmp(field,"scriptname"))
|
||||
lua_pushstring(L, header->scriptname);
|
||||
|
|
@ -2558,8 +2550,6 @@ static int mapheaderinfo_get(lua_State *L)
|
|||
lua_pushinteger(L, header->precutscenenum);
|
||||
else if (fastcmp(field,"cutscenenum"))
|
||||
lua_pushinteger(L, header->cutscenenum);
|
||||
else if (fastcmp(field,"countdown"))
|
||||
lua_pushinteger(L, header->countdown);
|
||||
else if (fastcmp(field,"palette"))
|
||||
lua_pushinteger(L, header->palette);
|
||||
else if (fastcmp(field,"numlaps"))
|
||||
|
|
@ -2574,12 +2564,6 @@ static int mapheaderinfo_get(lua_State *L)
|
|||
lua_pushinteger(L, header->menuflags);
|
||||
else if (fastcmp(field,"mobj_scale"))
|
||||
lua_pushfixed(L, header->mobj_scale);
|
||||
else if (fastcmp(field,"startrings"))
|
||||
lua_pushinteger(L, header->startrings);
|
||||
else if (fastcmp(field, "sstimer"))
|
||||
lua_pushinteger(L, header->sstimer);
|
||||
else if (fastcmp(field, "ssspheres"))
|
||||
lua_pushinteger(L, header->ssspheres);
|
||||
else if (fastcmp(field, "gravity"))
|
||||
lua_pushfixed(L, header->gravity);
|
||||
else {
|
||||
|
|
|
|||
|
|
@ -219,18 +219,6 @@ int LUA_PushGlobals(lua_State *L, const char *word)
|
|||
} else if (fastcmp(word,"spmarathon_start")) {
|
||||
lua_pushinteger(L, spmarathon_start);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"sstage_start")) {
|
||||
lua_pushinteger(L, sstage_start);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"sstage_end")) {
|
||||
lua_pushinteger(L, sstage_end);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"smpstage_start")) {
|
||||
lua_pushinteger(L, smpstage_start);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"smpstage_end")) {
|
||||
lua_pushinteger(L, smpstage_end);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"titlemap")) {
|
||||
lua_pushstring(L, titlemap);
|
||||
return 1;
|
||||
|
|
|
|||
|
|
@ -2198,9 +2198,6 @@ void Nextmap_OnChange(void)
|
|||
itemOn = tastart;
|
||||
}
|
||||
|
||||
if (mapheaderinfo[cv_nextmap.value-1] && mapheaderinfo[cv_nextmap.value-1]->forcecharacter[0] != '\0')
|
||||
CV_Set(&cv_chooseskin, mapheaderinfo[cv_nextmap.value-1]->forcecharacter);
|
||||
|
||||
free(gpath);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10540,7 +10540,7 @@ void P_SpawnPlayer(INT32 playernum)
|
|||
else if (p->bot)
|
||||
{
|
||||
/*
|
||||
if (bonusgame || specialstage)
|
||||
if (bonusgame || specialstage || boss)
|
||||
{
|
||||
// Bots should avoid
|
||||
p->spectator = true;
|
||||
|
|
|
|||
|
|
@ -4944,7 +4944,6 @@ static void P_NetArchiveMisc(savebuffer_t *save, boolean resending)
|
|||
WRITEUINT8(save->p, mapmusrng);
|
||||
|
||||
WRITEUINT32(save->p, leveltime);
|
||||
WRITEUINT32(save->p, ssspheres);
|
||||
WRITEINT16(save->p, lastmap);
|
||||
WRITEUINT16(save->p, bossdisabled);
|
||||
WRITEUINT8(save->p, ringsdisabled);
|
||||
|
|
@ -4971,7 +4970,6 @@ static void P_NetArchiveMisc(savebuffer_t *save, boolean resending)
|
|||
}
|
||||
|
||||
WRITEUINT32(save->p, token);
|
||||
WRITEINT32(save->p, sstimer);
|
||||
WRITEUINT32(save->p, bluescore);
|
||||
WRITEUINT32(save->p, redscore);
|
||||
|
||||
|
|
@ -5004,9 +5002,6 @@ static void P_NetArchiveMisc(savebuffer_t *save, boolean resending)
|
|||
WRITEFIXED(save->p, gravity);
|
||||
WRITEFIXED(save->p, mapobjectscale);
|
||||
|
||||
WRITEUINT32(save->p, countdowntimer);
|
||||
WRITEUINT8(save->p, countdowntimeup);
|
||||
|
||||
// SRB2kart
|
||||
WRITEINT32(save->p, numgotboxes);
|
||||
WRITEUINT8(save->p, numtargets);
|
||||
|
|
@ -5114,7 +5109,6 @@ FUNCINLINE static ATTRINLINE boolean P_NetUnArchiveMisc(savebuffer_t *save, bool
|
|||
|
||||
// get the time
|
||||
leveltime = READUINT32(save->p);
|
||||
ssspheres = READUINT32(save->p);
|
||||
lastmap = READINT16(save->p);
|
||||
bossdisabled = READUINT16(save->p);
|
||||
ringsdisabled = READUINT8(save->p);
|
||||
|
|
@ -5138,7 +5132,6 @@ FUNCINLINE static ATTRINLINE boolean P_NetUnArchiveMisc(savebuffer_t *save, bool
|
|||
}
|
||||
|
||||
token = READUINT32(save->p);
|
||||
sstimer = READINT32(save->p);
|
||||
bluescore = READUINT32(save->p);
|
||||
redscore = READUINT32(save->p);
|
||||
|
||||
|
|
@ -5171,9 +5164,6 @@ FUNCINLINE static ATTRINLINE boolean P_NetUnArchiveMisc(savebuffer_t *save, bool
|
|||
gravity = READFIXED(save->p);
|
||||
mapobjectscale = READFIXED(save->p);
|
||||
|
||||
countdowntimer = (tic_t)READUINT32(save->p);
|
||||
countdowntimeup = (boolean)READUINT8(save->p);
|
||||
|
||||
// SRB2kart
|
||||
numgotboxes = READINT32(save->p);
|
||||
numtargets = READUINT8(save->p);
|
||||
|
|
|
|||
|
|
@ -400,9 +400,6 @@ static void P_ClearSingleMapHeaderInfo(INT16 num)
|
|||
mapheaderinfo[num]->zonttl[0] = '\0';
|
||||
mapheaderinfo[num]->actnum[0] = '\0';
|
||||
mapheaderinfo[num]->typeoflevel = 0;
|
||||
mapheaderinfo[num]->startrings = 0;
|
||||
mapheaderinfo[num]->sstimer = 90;
|
||||
mapheaderinfo[num]->ssspheres = 1;
|
||||
mapheaderinfo[num]->gravity = DEFAULT_GRAVITY;
|
||||
mapheaderinfo[num]->use_walltransfer = false;
|
||||
mapheaderinfo[num]->keywords[0] = '\0';
|
||||
|
|
@ -410,7 +407,6 @@ static void P_ClearSingleMapHeaderInfo(INT16 num)
|
|||
mapheaderinfo[num]->musname[i][0] = 0;
|
||||
mapheaderinfo[num]->mustrack = 0;
|
||||
mapheaderinfo[num]->muspos = 0;
|
||||
mapheaderinfo[num]->forcecharacter[0] = '\0';
|
||||
mapheaderinfo[num]->musname_size = 0;
|
||||
mapheaderinfo[num]->weather = PRECIP_NONE;
|
||||
snprintf(mapheaderinfo[num]->skytexture, 5, "SKY1");
|
||||
|
|
@ -418,12 +414,10 @@ static void P_ClearSingleMapHeaderInfo(INT16 num)
|
|||
mapheaderinfo[num]->skybox_scalex = 16;
|
||||
mapheaderinfo[num]->skybox_scaley = 16;
|
||||
mapheaderinfo[num]->skybox_scalez = 16;
|
||||
mapheaderinfo[num]->interscreen[0] = '#';
|
||||
mapheaderinfo[num]->runsoc[0] = '#';
|
||||
mapheaderinfo[num]->scriptname[0] = '#';
|
||||
mapheaderinfo[num]->precutscenenum = 0;
|
||||
mapheaderinfo[num]->cutscenenum = 0;
|
||||
mapheaderinfo[num]->countdown = 0;
|
||||
mapheaderinfo[num]->palette = UINT16_MAX;
|
||||
mapheaderinfo[num]->encorepal = UINT16_MAX;
|
||||
mapheaderinfo[num]->numlaps = NUMLAPS_DEFAULT;
|
||||
|
|
@ -497,8 +491,9 @@ void P_AllocMapHeader(INT16 i)
|
|||
mapheaderinfo[i]->lumpname = NULL;
|
||||
mapheaderinfo[i]->thumbnailPic = NULL;
|
||||
mapheaderinfo[i]->minimapPic = NULL;
|
||||
mapheaderinfo[i]->flickies = NULL;
|
||||
mapheaderinfo[i]->cup = NULL;
|
||||
mapheaderinfo[i]->mainrecord = NULL;
|
||||
mapheaderinfo[i]->flickies = NULL;
|
||||
nummapheaders++;
|
||||
}
|
||||
P_ClearSingleMapHeaderInfo(i);
|
||||
|
|
@ -7614,19 +7609,9 @@ static void P_InitLevelSettings(boolean reloadinggamestate)
|
|||
// emerald hunt
|
||||
hunt1 = hunt2 = hunt3 = NULL;
|
||||
|
||||
// map time limit
|
||||
if (mapheaderinfo[gamemap-1]->countdown)
|
||||
{
|
||||
countdowntimer = mapheaderinfo[gamemap-1]->countdown * TICRATE;
|
||||
}
|
||||
else
|
||||
countdowntimer = 0;
|
||||
countdowntimeup = false;
|
||||
|
||||
// circuit, race and competition stuff
|
||||
circuitmap = false;
|
||||
numstarposts = 0;
|
||||
ssspheres = 0;
|
||||
numbosswaypoints = 0;
|
||||
if (!reloadinggamestate)
|
||||
timeinmap = 0;
|
||||
|
|
@ -7782,43 +7767,6 @@ static void P_RunLevelScript(const char *scriptname)
|
|||
COM_BufExecute(); // Run it!
|
||||
}
|
||||
|
||||
static void P_ForceCharacter(const char *forcecharskin)
|
||||
{
|
||||
UINT8 i;
|
||||
|
||||
if (netgame)
|
||||
{
|
||||
char skincmd[33];
|
||||
|
||||
for (i = 0; i <= splitscreen; i++)
|
||||
{
|
||||
const char *num = "";
|
||||
|
||||
if (i > 0)
|
||||
num = va("%d", i+1);
|
||||
|
||||
sprintf(skincmd, "skin%s %s\n", num, forcecharskin);
|
||||
CV_Set(&cv_skin[i], forcecharskin);
|
||||
}
|
||||
|
||||
COM_BufAddText(skincmd);
|
||||
}
|
||||
else
|
||||
{
|
||||
for (i = 0; i <= splitscreen; i++)
|
||||
{
|
||||
SetPlayerSkin(g_localplayers[i], forcecharskin);
|
||||
|
||||
// normal player colors in single player
|
||||
if ((unsigned)cv_playercolor[i].value != skins[players[g_localplayers[i]].skin].prefcolor && !modeattacking)
|
||||
{
|
||||
CV_StealthSetValue(&cv_playercolor[i], skins[players[g_localplayers[i]].skin].prefcolor);
|
||||
players[g_localplayers[i]].skincolor = skins[players[g_localplayers[i]].skin].prefcolor;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void P_ResetSpawnpoints(void)
|
||||
{
|
||||
UINT8 i;
|
||||
|
|
@ -8104,9 +8052,6 @@ boolean P_LoadLevel(boolean fromnetsave, boolean reloadinggamestate)
|
|||
for (i = 0; i <= r_splitscreen; i++)
|
||||
postimgtype[i] = postimg_none;
|
||||
|
||||
if (mapheaderinfo[gamemap-1]->forcecharacter[0] != '\0')
|
||||
P_ForceCharacter(mapheaderinfo[gamemap-1]->forcecharacter);
|
||||
|
||||
// Initial height of PointOfView
|
||||
// will be set by player think.
|
||||
players[consoleplayer].viewz = 1;
|
||||
|
|
@ -8768,6 +8713,37 @@ UINT8 P_InitMapData(boolean existingmapheaders)
|
|||
}
|
||||
|
||||
vres_Free(virtmap);
|
||||
|
||||
// Now associate it with a cup cache.
|
||||
// (The core assumption is that cups < headers.)
|
||||
if (i >= numexistingmapheaders)
|
||||
{
|
||||
cupheader_t *cup = kartcupheaders;
|
||||
INT32 j;
|
||||
while (cup)
|
||||
{
|
||||
for (j = 0; j < CUPCACHE_MAX; j++)
|
||||
{
|
||||
// Already discovered?
|
||||
if (cup->cachedlevels[j] != NEXTMAP_INVALID)
|
||||
continue;
|
||||
|
||||
if (!cup->levellist[j] || strcasecmp(cup->levellist[j], name) != 0)
|
||||
continue;
|
||||
|
||||
// Only panic about back-reference for non-bonus material.
|
||||
if (j < MAXLEVELLIST || j == CUPCACHE_SPECIAL)
|
||||
{
|
||||
if (mapheaderinfo[i]->cup)
|
||||
I_Error("P_InitMapData: Map %s cannot appear in cups multiple times! (First in %s, now in %s)", name, mapheaderinfo[i]->cup->name, cup->name);
|
||||
mapheaderinfo[i]->cup = cup;
|
||||
}
|
||||
|
||||
cup->cachedlevels[j] = i;
|
||||
}
|
||||
cup = cup->next;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -6714,10 +6714,6 @@ void P_InitSpecials(void)
|
|||
maplighting.directional = lighting->use_light_angle;
|
||||
maplighting.angle = lighting->light_angle;
|
||||
|
||||
// Defaults in case levels don't have them set.
|
||||
sstimer = mapheaderinfo[gamemap-1]->sstimer*TICRATE + 6;
|
||||
ssspheres = mapheaderinfo[gamemap-1]->ssspheres;
|
||||
|
||||
CheckForBustableBlocks = CheckForBouncySector = CheckForQuicksand = CheckForMarioBlocks = CheckForFloatBob = CheckForReverseGravity = false;
|
||||
|
||||
// Set weather
|
||||
|
|
@ -6868,11 +6864,6 @@ void P_SpawnSpecials(boolean fromnetsave)
|
|||
// Process Section 2
|
||||
switch(GETSECSPECIAL(sector->special, 2))
|
||||
{
|
||||
case 10: // Time for special stage
|
||||
sstimer = (sector->floorheight>>FRACBITS) * TICRATE + 6; // Time to finish
|
||||
ssspheres = sector->ceilingheight>>FRACBITS; // Ring count for special stage
|
||||
break;
|
||||
|
||||
case 11: // Custom global gravity!
|
||||
if (udmf)
|
||||
break;
|
||||
|
|
|
|||
17
src/p_user.c
17
src/p_user.c
|
|
@ -303,11 +303,15 @@ boolean P_PlayerMoving(INT32 pnum)
|
|||
//
|
||||
UINT8 P_GetNextEmerald(void)
|
||||
{
|
||||
if (gamemap >= sstage_start && gamemap <= sstage_end)
|
||||
return (UINT8)(gamemap - sstage_start);
|
||||
if (gamemap >= smpstage_start || gamemap <= smpstage_end)
|
||||
return (UINT8)(gamemap - smpstage_start);
|
||||
return 0;
|
||||
INT16 mapnum = gamemap-1;
|
||||
|
||||
if (mapnum > nummapheaders || !mapheaderinfo[mapnum])
|
||||
return 0;
|
||||
|
||||
if (!mapheaderinfo[mapnum]->cup || mapheaderinfo[mapnum]->cup->cachedlevels[CUPCACHE_SPECIAL] != mapnum)
|
||||
return 0;
|
||||
|
||||
return mapheaderinfo[mapnum]->cup->emeraldnum;
|
||||
}
|
||||
|
||||
//
|
||||
|
|
@ -2098,9 +2102,6 @@ void P_MovePlayer(player_t *player)
|
|||
|
||||
fixed_t runspd;
|
||||
|
||||
if (countdowntimeup)
|
||||
return;
|
||||
|
||||
cmd = &player->cmd;
|
||||
runspd = 14*player->mo->scale; //srb2kart
|
||||
|
||||
|
|
|
|||
|
|
@ -198,12 +198,6 @@ boolean R_SkinUsable(INT32 playernum, INT32 skinnum)
|
|||
return true;
|
||||
}
|
||||
|
||||
if (Playing() && (R_SkinAvailable(mapheaderinfo[gamemap-1]->forcecharacter) == skinnum))
|
||||
{
|
||||
// Being forced to play as this character by the level
|
||||
return true;
|
||||
}
|
||||
|
||||
if (netgame && (cv_forceskin.value == skinnum))
|
||||
{
|
||||
// Being forced to play as this character by the server
|
||||
|
|
|
|||
Loading…
Reference in a new issue