mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2026-05-10 19:01:50 +00:00
Make the map command from the title screen *actually work*, and make a best-guess attempt at determining the necessary setup to play each particular map in a Single Player context (such as grandprixinfo for TOL_RACE, a little cleanup for TOL_BATTLE, and bossinfo for TOL_BOSS).
This will be necessary when newmenus comes around and it is no longer advantageous to have a menu for testing bosses, given they won't be a headline feature in v2 or accessible via multiplayer at this time.
This commit is contained in:
parent
61577e5026
commit
dc2936de42
2 changed files with 100 additions and 64 deletions
|
|
@ -3754,6 +3754,7 @@ void SV_StopServer(void)
|
||||||
// called at singleplayer start and stopdemo
|
// called at singleplayer start and stopdemo
|
||||||
void SV_StartSinglePlayerServer(void)
|
void SV_StartSinglePlayerServer(void)
|
||||||
{
|
{
|
||||||
|
INT32 lastgametype = gametype;
|
||||||
server = true;
|
server = true;
|
||||||
netgame = false;
|
netgame = false;
|
||||||
multiplayer = false;
|
multiplayer = false;
|
||||||
|
|
@ -3767,6 +3768,9 @@ void SV_StartSinglePlayerServer(void)
|
||||||
G_SetGametype(GT_RACE);
|
G_SetGametype(GT_RACE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (gametype != lastgametype)
|
||||||
|
D_GameTypeChanged(lastgametype);
|
||||||
|
|
||||||
// no more tic the game with this settings!
|
// no more tic the game with this settings!
|
||||||
SV_StopServer();
|
SV_StopServer();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2578,7 +2578,6 @@ static void Command_Map_f(void)
|
||||||
|
|
||||||
INT32 newgametype = gametype;
|
INT32 newgametype = gametype;
|
||||||
boolean newencoremode = (cv_kartencore.value == 1);
|
boolean newencoremode = (cv_kartencore.value == 1);
|
||||||
boolean startgp = false;
|
|
||||||
|
|
||||||
INT32 d;
|
INT32 d;
|
||||||
|
|
||||||
|
|
@ -2596,7 +2595,7 @@ static void Command_Map_f(void)
|
||||||
|
|
||||||
mustmodifygame = !(netgame || multiplayer) && !majormods;
|
mustmodifygame = !(netgame || multiplayer) && !majormods;
|
||||||
|
|
||||||
if (mustmodifygame)
|
if (mustmodifygame && !option_force)
|
||||||
{
|
{
|
||||||
/* May want to be more descriptive? */
|
/* May want to be more descriptive? */
|
||||||
CONS_Printf(M_GetText("Sorry, level change disabled in single player.\n"));
|
CONS_Printf(M_GetText("Sorry, level change disabled in single player.\n"));
|
||||||
|
|
@ -2653,7 +2652,6 @@ static void Command_Map_f(void)
|
||||||
if (mustmodifygame && option_force)
|
if (mustmodifygame && option_force)
|
||||||
{
|
{
|
||||||
G_SetGameModified(multiplayer, true);
|
G_SetGameModified(multiplayer, true);
|
||||||
startgp = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// new gametype value
|
// new gametype value
|
||||||
|
|
@ -2695,6 +2693,15 @@ static void Command_Map_f(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (!Playing())
|
||||||
|
{
|
||||||
|
newresetplayers = true;
|
||||||
|
if (mapheaderinfo[newmapnum-1])
|
||||||
|
{
|
||||||
|
// Let's just guess so we don't have to specify the gametype EVERY time...
|
||||||
|
newgametype = (mapheaderinfo[newmapnum-1]->typeoflevel & TOL_RACE) ? GT_RACE : GT_BATTLE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// new encoremode value
|
// new encoremode value
|
||||||
if (option_encore)
|
if (option_encore)
|
||||||
|
|
@ -2708,7 +2715,56 @@ static void Command_Map_f(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (startgp)
|
if (!option_force && newgametype == gametype && Playing()) // SRB2Kart
|
||||||
|
newresetplayers = false; // if not forcing and gametypes is the same
|
||||||
|
|
||||||
|
// don't use a gametype the map doesn't support
|
||||||
|
if (cv_debug || option_force || cv_skipmapcheck.value)
|
||||||
|
fromlevelselect = false; // The player wants us to trek on anyway. Do so.
|
||||||
|
// G_TOLFlag handles both multiplayer gametype and ignores it for !multiplayer
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (!(
|
||||||
|
mapheaderinfo[newmapnum-1] &&
|
||||||
|
mapheaderinfo[newmapnum-1]->typeoflevel & G_TOLFlag(newgametype)
|
||||||
|
))
|
||||||
|
{
|
||||||
|
CONS_Alert(CONS_WARNING, M_GetText("%s (%s) doesn't support %s mode!\n(Use -force to override)\n"), realmapname, G_BuildMapName(newmapnum),
|
||||||
|
(multiplayer ? gametype_cons_t[newgametype].strvalue : "Single Player"));
|
||||||
|
Z_Free(realmapname);
|
||||||
|
Z_Free(mapname);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
fromlevelselect =
|
||||||
|
( netgame || multiplayer ) &&
|
||||||
|
newgametype == gametype &&
|
||||||
|
gametypedefaultrules[newgametype] & GTR_CAMPAIGN;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!(netgame || multiplayer))
|
||||||
|
{
|
||||||
|
if (newgametype == GT_BATTLE)
|
||||||
|
{
|
||||||
|
grandprixinfo.gp = false;
|
||||||
|
|
||||||
|
if (mapheaderinfo[newmapnum-1] &&
|
||||||
|
mapheaderinfo[newmapnum-1]->typeoflevel & TOL_BOSS)
|
||||||
|
{
|
||||||
|
// Reset boss info
|
||||||
|
if (bossinfo.enemyname)
|
||||||
|
Z_Free(bossinfo.enemyname);
|
||||||
|
if (bossinfo.subtitle)
|
||||||
|
Z_Free(bossinfo.subtitle);
|
||||||
|
memset(&bossinfo, 0, sizeof(struct bossinfo));
|
||||||
|
|
||||||
|
bossinfo.boss = true;
|
||||||
|
bossinfo.encore = newencoremode;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else // default GP
|
||||||
{
|
{
|
||||||
grandprixinfo.gamespeed = (cv_kartspeed.value == KARTSPEED_AUTO ? KARTSPEED_NORMAL : cv_kartspeed.value);
|
grandprixinfo.gamespeed = (cv_kartspeed.value == KARTSPEED_AUTO ? KARTSPEED_NORMAL : cv_kartspeed.value);
|
||||||
grandprixinfo.masterbots = false;
|
grandprixinfo.masterbots = false;
|
||||||
|
|
@ -2765,36 +2821,10 @@ static void Command_Map_f(void)
|
||||||
grandprixinfo.cup = NULL;
|
grandprixinfo.cup = NULL;
|
||||||
grandprixinfo.wonround = false;
|
grandprixinfo.wonround = false;
|
||||||
|
|
||||||
|
bossinfo.boss = false;
|
||||||
|
|
||||||
grandprixinfo.initalize = true;
|
grandprixinfo.initalize = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!option_force && newgametype == gametype) // SRB2Kart
|
|
||||||
newresetplayers = false; // if not forcing and gametypes is the same
|
|
||||||
|
|
||||||
// don't use a gametype the map doesn't support
|
|
||||||
if (cv_debug || option_force || cv_skipmapcheck.value)
|
|
||||||
fromlevelselect = false; // The player wants us to trek on anyway. Do so.
|
|
||||||
// G_TOLFlag handles both multiplayer gametype and ignores it for !multiplayer
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (!(
|
|
||||||
mapheaderinfo[newmapnum-1] &&
|
|
||||||
mapheaderinfo[newmapnum-1]->typeoflevel & G_TOLFlag(newgametype)
|
|
||||||
))
|
|
||||||
{
|
|
||||||
CONS_Alert(CONS_WARNING, M_GetText("%s (%s) doesn't support %s mode!\n(Use -force to override)\n"), realmapname, G_BuildMapName(newmapnum),
|
|
||||||
(multiplayer ? gametype_cons_t[newgametype].strvalue : "Single Player"));
|
|
||||||
Z_Free(realmapname);
|
|
||||||
Z_Free(mapname);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
fromlevelselect =
|
|
||||||
( netgame || multiplayer ) &&
|
|
||||||
newgametype == gametype &&
|
|
||||||
gametypedefaultrules[newgametype] & GTR_CAMPAIGN;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Prevent warping to locked levels
|
// Prevent warping to locked levels
|
||||||
|
|
@ -4541,10 +4571,12 @@ void D_GameTypeChanged(INT32 lastgametype)
|
||||||
CV_SetValue(&cv_pointlimit, pointlimits[gametype]);
|
CV_SetValue(&cv_pointlimit, pointlimits[gametype]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/* -- no longer useful
|
||||||
else if (!multiplayer && !netgame)
|
else if (!multiplayer && !netgame)
|
||||||
{
|
{
|
||||||
G_SetGametype(GT_RACE);
|
G_SetGametype(GT_RACE);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
// reset timelimit and pointlimit in race/coop, prevent stupid cheats
|
// reset timelimit and pointlimit in race/coop, prevent stupid cheats
|
||||||
if (server)
|
if (server)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue