Fixed startpos not saving
Will now load properly from a save game preventing respawning at the wrong player starts.
This commit is contained in:
parent
85cefd8516
commit
0fe2d72b75
2 changed files with 16 additions and 8 deletions
|
|
@ -111,6 +111,8 @@ EXTERN_CVAR (Int, disableautosave)
|
|||
EXTERN_CVAR (String, playerclass)
|
||||
|
||||
extern uint8_t globalfreeze, globalchangefreeze;
|
||||
int startpos = 0; // [RH] Support for multiple starts per level
|
||||
int laststartpos = 0;
|
||||
|
||||
#define SNAP_ID MAKE_ID('s','n','A','p')
|
||||
#define DSNP_ID MAKE_ID('d','s','N','p')
|
||||
|
|
@ -652,7 +654,9 @@ void G_InitNew (const char *mapname, bool bTitleLevel)
|
|||
gamestate = GS_LEVEL;
|
||||
}
|
||||
|
||||
G_DoLoadLevel (mapname, 0, false, !savegamerestore);
|
||||
if (!savegamerestore)
|
||||
startpos = laststartpos = 0;
|
||||
G_DoLoadLevel (mapname, startpos, false, !savegamerestore);
|
||||
|
||||
if (!savegamerestore && (gameinfo.gametype == GAME_Strife || (SBarInfoScript[SCRIPT_CUSTOM] != nullptr && SBarInfoScript[SCRIPT_CUSTOM]->GetGameType() == GAME_Strife)))
|
||||
{
|
||||
|
|
@ -669,7 +673,6 @@ void G_InitNew (const char *mapname, bool bTitleLevel)
|
|||
// G_DoCompleted
|
||||
//
|
||||
static FString nextlevel;
|
||||
static int startpos; // [RH] Support for multiple starts per level
|
||||
extern int NoWipe; // [RH] Don't wipe when travelling in hubs
|
||||
static int changeflags;
|
||||
static bool unloading;
|
||||
|
|
@ -1100,7 +1103,6 @@ void G_DoCompleted (void)
|
|||
if (gamestate == GS_TITLELEVEL)
|
||||
{
|
||||
G_DoLoadLevel (nextlevel, startpos, false, false);
|
||||
startpos = 0;
|
||||
viewactive = true;
|
||||
return;
|
||||
}
|
||||
|
|
@ -1373,7 +1375,6 @@ void G_DoLoadLevel(const FString &nextmapname, int position, bool autosave, bool
|
|||
void FLevelLocals::DoLoadLevel(const FString &nextmapname, int position, bool autosave, bool newGame)
|
||||
{
|
||||
MapName = nextmapname;
|
||||
static int lastposition = 0;
|
||||
int i;
|
||||
|
||||
if (NextSkill >= 0)
|
||||
|
|
@ -1385,9 +1386,9 @@ void FLevelLocals::DoLoadLevel(const FString &nextmapname, int position, bool au
|
|||
}
|
||||
|
||||
if (position == -1)
|
||||
position = lastposition;
|
||||
position = laststartpos;
|
||||
else
|
||||
lastposition = position;
|
||||
laststartpos = position;
|
||||
|
||||
Init();
|
||||
StatusBar->DetachAllMessages ();
|
||||
|
|
@ -1575,7 +1576,6 @@ void G_DoWorldDone (void)
|
|||
}
|
||||
primaryLevel->StartTravel ();
|
||||
G_DoLoadLevel (nextlevel, startpos, true, false);
|
||||
startpos = 0;
|
||||
gameaction = ga_nothing;
|
||||
viewactive = true;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue