mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-12-09 17:43:07 +00:00
Permit gametype to be changed by MapWarp
- Simplest possible solution for the time remaining: If the current gametype doesn't overlap with the nextmapoverride's TOL, do G_GuessGametypeByTOL.
- Future work: Allow an optional extra parameter to MapWarp to specify a specific Gametype by name.
- Fixes for tutorialchallenge
- NEXTMAP_TUTORIALCHALLENGE is integrated into the above, to reduce duplicate code
- Call D_GametypeChanged, which was previously missing
This commit is contained in:
parent
6f0710818f
commit
c1fadac0a5
1 changed files with 51 additions and 32 deletions
83
src/g_game.c
83
src/g_game.c
|
|
@ -4032,14 +4032,54 @@ void G_GetNextMap(void)
|
||||||
nextmap = (nextmapoverride-1);
|
nextmap = (nextmapoverride-1);
|
||||||
setalready = true;
|
setalready = true;
|
||||||
|
|
||||||
// Roundqueue integration: Override the current entry!
|
// Tutorial Challenge behaviour
|
||||||
if (nextmap < nummapheaders
|
if (
|
||||||
&& roundqueue.position > 0
|
netgame == false
|
||||||
&& roundqueue.position <= roundqueue.size)
|
&& gametype == GT_TUTORIAL
|
||||||
|
&& nextmap == NEXTMAP_TUTORIALCHALLENGE
|
||||||
|
&& (
|
||||||
|
!gamedata
|
||||||
|
|| gamedata->enteredtutorialchallenge == false
|
||||||
|
|| M_GameTrulyStarted() == true
|
||||||
|
)
|
||||||
|
)
|
||||||
{
|
{
|
||||||
UINT8 entry = roundqueue.position-1;
|
nextmap = G_MapNumber(tutorialchallengemap);
|
||||||
roundqueue.entries[entry].mapnum = nextmap;
|
if (nextmap < nummapheaders)
|
||||||
roundqueue.entries[entry].overridden = true;
|
{
|
||||||
|
tutorialchallenge = TUTORIALSKIP_INPROGRESS;
|
||||||
|
gamedata->enteredtutorialchallenge = true;
|
||||||
|
// A gamedata save will happen on successful level enter
|
||||||
|
|
||||||
|
// Also set character, color, and follower from profile
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (nextmap < nummapheaders && mapheaderinfo[nextmap])
|
||||||
|
{
|
||||||
|
if (tutorialchallenge == TUTORIALSKIP_INPROGRESS
|
||||||
|
|| (mapheaderinfo[nextmap]->typeoflevel & G_TOLFlag(gametype)) == 0)
|
||||||
|
{
|
||||||
|
INT32 lastgametype = gametype;
|
||||||
|
INT32 newgametype = G_GuessGametypeByTOL(mapheaderinfo[nextmap]->typeoflevel);
|
||||||
|
if (newgametype == -1)
|
||||||
|
newgametype = GT_RACE; // sensible default
|
||||||
|
|
||||||
|
G_SetGametype(newgametype);
|
||||||
|
D_GameTypeChanged(lastgametype);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Roundqueue integration: Override the current entry!
|
||||||
|
if (roundqueue.position > 0
|
||||||
|
&& roundqueue.position <= roundqueue.size)
|
||||||
|
{
|
||||||
|
UINT8 entry = roundqueue.position-1;
|
||||||
|
|
||||||
|
roundqueue.entries[entry].mapnum = nextmap;
|
||||||
|
roundqueue.entries[entry].gametype = gametype;
|
||||||
|
roundqueue.entries[entry].overridden = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (roundqueue.size > 0)
|
else if (roundqueue.size > 0)
|
||||||
|
|
@ -4485,7 +4525,11 @@ static void G_DoCompleted(void)
|
||||||
{
|
{
|
||||||
// Return to whence you came with your tail between your legs
|
// Return to whence you came with your tail between your legs
|
||||||
tutorialchallenge = TUTORIALSKIP_FAILED;
|
tutorialchallenge = TUTORIALSKIP_FAILED;
|
||||||
|
|
||||||
|
INT32 lastgametype = gametype;
|
||||||
G_SetGametype(GT_TUTORIAL);
|
G_SetGametype(GT_TUTORIAL);
|
||||||
|
D_GameTypeChanged(lastgametype);
|
||||||
|
|
||||||
nextmapoverride = prevmap+1;
|
nextmapoverride = prevmap+1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -4587,31 +4631,6 @@ void G_AfterIntermission(void)
|
||||||
//
|
//
|
||||||
void G_NextLevel(void)
|
void G_NextLevel(void)
|
||||||
{
|
{
|
||||||
if (
|
|
||||||
gametype == GT_TUTORIAL
|
|
||||||
&& nextmap == NEXTMAP_TUTORIALCHALLENGE
|
|
||||||
&& (
|
|
||||||
!gamedata
|
|
||||||
|| gamedata->enteredtutorialchallenge == false
|
|
||||||
|| M_GameTrulyStarted() == true
|
|
||||||
)
|
|
||||||
)
|
|
||||||
{
|
|
||||||
nextmap = G_MapNumber(tutorialchallengemap);
|
|
||||||
if (
|
|
||||||
nextmap < nummapheaders
|
|
||||||
&& mapheaderinfo[nextmap] != NULL
|
|
||||||
&& mapheaderinfo[nextmap]->typeoflevel != 0
|
|
||||||
)
|
|
||||||
{
|
|
||||||
tutorialchallenge = TUTORIALSKIP_INPROGRESS;
|
|
||||||
G_SetGametype(G_GuessGametypeByTOL(mapheaderinfo[nextmap]->typeoflevel));
|
|
||||||
|
|
||||||
gamedata->enteredtutorialchallenge = true;
|
|
||||||
// A gamedata save will happen on successful level enter
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (nextmap >= NEXTMAP_SPECIAL)
|
if (nextmap >= NEXTMAP_SPECIAL)
|
||||||
{
|
{
|
||||||
G_EndGame();
|
G_EndGame();
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue