- another safety commit.

This commit is contained in:
Christoph Oelckers 2020-07-07 17:56:20 +02:00
parent 6b86d7606f
commit 915b566612
19 changed files with 155 additions and 254 deletions

View file

@ -781,7 +781,8 @@ class DDukeLevelSummaryScreen : public DScreenJob
public:
DDukeLevelSummaryScreen() : DScreenJob(fadein | fadeout)
{
gfx_offset = BONUSSCREEN + ((ud.volume_number == 1) ? 5 : 0);
int vol = volfromlevelnum(currentLevel->levelNumber);
gfx_offset = BONUSSCREEN + ((vol == 1) ? 5 : 0);
lastmapname = currentLevel->DisplayName();
PlayBonusMusic();
}
@ -964,7 +965,7 @@ void dobonus_d(bool bonusonly, CompletionFunc completion)
if (!bonusonly && numplayers < 2 && ud.eog && ud.from_bonus == 0)
{
bonussequence_d(ud.volume_number, jobs, job);
bonussequence_d(volfromlevelnum(currentLevel->levelNumber), jobs, job);
}
if (playerswhenstarted > 1 && ud.coop != 1)

View file

@ -561,7 +561,8 @@ void dobonus_r(bool bonusonly, CompletionFunc completion)
if (!bonusonly && !isRRRA() && numplayers < 2 && ud.eog && ud.from_bonus == 0)
{
bonussequence_r(ud.volume_number, jobs, job);
int vol = volfromlevelnum(currentLevel->levelNumber);
bonussequence_r(vol, jobs, job);
}
if (playerswhenstarted > 1 && ud.coop != 1)

View file

@ -30,6 +30,7 @@ Prepared for public release: 03/21/2003 - Charlie Wiederhold, 3D Realms
#include "global.h"
#include "names_r.h"
#include "mmulti.h"
#include "mapinfo.h"
BEGIN_DUKE_NS
@ -2138,9 +2139,7 @@ static void rrra_specialstats()
{
ps[screenpeek].gm = MODE_EOL;
ud.eog = 1;
ud.level_number++;
if (ud.level_number > 6)
ud.level_number = 0;
ud.nextLevel = FindNextMap(currentLevel);
}
}

View file

@ -214,5 +214,11 @@ void drawbackground(void);
void displayrooms(int32_t playerNum, int32_t smoothratio);
void setgamepalette(int palid);
void resetmys();
void resettimevars();
bool setnextmap(bool checksecretexit);
void prelevel_d(int g);
void prelevel_r(int g);
void e4intro(CompletionFunc completion);
void clearfrags(void);
END_DUKE_NS

View file

@ -40,6 +40,7 @@ Modifications for JonoF's port by Jonathon Fowler (jf@jonof.id.au)
#include "st_start.h"
#include "i_interface.h"
#include "prediction.h"
#include "glbackend/glbackend.h"
BEGIN_DUKE_NS
@ -92,6 +93,17 @@ FString GameInterface::statFPS()
}
//---------------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------------
void setmapfog(int fogtype)
{
GLInterface.SetMapFog(fogtype != 0);
}
//---------------------------------------------------------------------------
//
// game specific command line args go here.
@ -773,7 +785,7 @@ void drawoverheadmap(int cposx, int cposy, int czoom, int cang)
double scale = isRR() ? 0.5 : 1.;
int top = isRR() ? 0 : ((ud.screen_size > 0) ? 147 : 179);
if (!(currentLevel->flags & MI_USERMAP))
DrawText(twod, SmallFont2, CR_UNDEFINED, 5, top+6, GStrings.localize(gVolumeNames[ud.volume_number]),
DrawText(twod, SmallFont2, CR_UNDEFINED, 5, top+6, GStrings.localize(gVolumeNames[volfromlevelnum(currentLevel->levelNumber)]),
DTA_FullscreenScale, 3, DTA_VirtualWidth, 320, DTA_VirtualHeight, 200, DTA_ScaleX, scale, DTA_ScaleY, scale, DTA_KeepRatio, true, TAG_DONE);
DrawText(twod, SmallFont2, CR_UNDEFINED, 5, top + 12, currentLevel->DisplayName(),
DTA_FullscreenScale, 3, DTA_VirtualWidth, 320, DTA_VirtualHeight, 200, DTA_ScaleX, scale, DTA_ScaleY, scale, DTA_KeepRatio, true, TAG_DONE);
@ -825,15 +837,6 @@ void dobonus(int bonusonly)
if (isRRRA());
else if (isRR()) dobonus_r(bonusonly, nullptr);
else dobonus_d(bonusonly, nullptr);
// This hack needs to go away!
if (RRRA_EndEpisode)
{
RRRA_EndEpisode = 0;
ud.volume_number = 1;
ud.level_number = 0;
ud.eog = 0;
}
}
//---------------------------------------------------------------------------

View file

@ -36,6 +36,7 @@ source as it is released.
#include "duke3d.h"
#include "gamedef.h"
#include "gamevar.h"
#include "mapinfo.h"
BEGIN_DUKE_NS
@ -535,10 +536,7 @@ int parse(void)
insptr++;
if (!isRRRA() || g_sp->pal != 105)
{
ps[myconnectindex].gm = MODE_EOL;
ud.level_number++;
if (ud.level_number > 6)
ud.level_number = 0;
setnextmap(false);
}
break;
case concmd_mamaend:

View file

@ -40,6 +40,7 @@ source as it is released.
#include "build.h"
#include "mmulti.h"
#include "gamevar.h"
#include "mapinfo.h"
// This currently only works for WW2GI.
#include "names_d.h"
@ -68,7 +69,7 @@ void SerializeGameVars(FSerializer &arc)
// Only save the ones which hold their own data, i.e. skip pointer variables.
for (auto& gv : aGameVars)
{
if (!(gv.dwFlags & GAMEVAR_FLAG_PLONG))
if (!(gv.dwFlags & (GAMEVAR_FLAG_PLONG|GAMEVAR_FLAG_PFUNC)))
{
if (arc.BeginObject(gv.szLabel))
{
@ -99,7 +100,7 @@ bool AddGameVar(const char* pszLabel, intptr_t lValue, unsigned dwFlags)
int b = 0;
if (dwFlags & GAMEVAR_FLAG_PLONG)
if (dwFlags & (GAMEVAR_FLAG_PLONG | GAMEVAR_FLAG_PFUNC))
dwFlags |= GAMEVAR_FLAG_SYSTEM; // force system if PLONG
if (strlen(pszLabel) > (MAXVARLABEL - 1))
@ -132,7 +133,7 @@ bool AddGameVar(const char* pszLabel, intptr_t lValue, unsigned dwFlags)
if (i < MAXGAMEVARS)
{
// Set values
if (aGameVars[i].dwFlags & GAMEVAR_FLAG_SYSTEM && !(dwFlags & GAMEVAR_FLAG_PLONG))
if (aGameVars[i].dwFlags & GAMEVAR_FLAG_SYSTEM && !(dwFlags & (GAMEVAR_FLAG_PLONG | GAMEVAR_FLAG_PFUNC)))
{
// if existing is system, they only get to change default value....
aGameVars[i].lValue = lValue;
@ -145,7 +146,7 @@ bool AddGameVar(const char* pszLabel, intptr_t lValue, unsigned dwFlags)
{
strcpy(aGameVars[i].szLabel, pszLabel);
aGameVars[i].dwFlags = dwFlags;
if (dwFlags & GAMEVAR_FLAG_PLONG)
if (dwFlags & (GAMEVAR_FLAG_PLONG | GAMEVAR_FLAG_PFUNC))
{
aGameVars[i].plValue = (int*)lValue;
}
@ -267,7 +268,7 @@ void ResetGameVars(void)
for(i=0;i<iGameVarCount;i++)
{
if (!(aGameVars[i].dwFlags & GAMEVAR_FLAG_PLONG))
if (!(aGameVars[i].dwFlags & (GAMEVAR_FLAG_PLONG | GAMEVAR_FLAG_PFUNC)))
{
if (aGameVars[i].dwFlags & (GAMEVAR_FLAG_PERPLAYER | GAMEVAR_FLAG_PERACTOR))
{
@ -330,6 +331,15 @@ int GetGameVarID(int id, int sActor, int sPlayer)
return *aGameVars[id].plValue;
}
else if (aGameVars[id].dwFlags & GAMEVAR_FLAG_PFUNC)
{
if (!aGameVars[id].plValue)
{
Printf("GetGameVarID NULL PlValues for PFUNC Var=%s\n", aGameVars[id].szLabel);
}
return aGameVars[id].getter();
}
else
{
return aGameVars[id].lValue;
@ -367,7 +377,7 @@ void SetGameVarID(int id, int lValue, int sActor, int sPlayer)
// set the value at pointer
*aGameVars[id].plValue=lValue;
}
else
else if( !(aGameVars[id].dwFlags & GAMEVAR_FLAG_PFUNC) )
{
aGameVars[id].lValue=lValue;
}
@ -550,6 +560,9 @@ void InitGameVarPointers(void)
//
//---------------------------------------------------------------------------
int getmap() { return mapfromlevelnum(currentLevel->levelNumber); }
int getvol() { return volfromlevelnum(currentLevel->levelNumber); }
void AddSystemVars()
{
// only call ONCE
@ -1137,8 +1150,8 @@ void AddSystemVars()
AddGameVar("MONSTERS_OFF",(intptr_t)&ud.monsters_off, GAMEVAR_FLAG_SYSTEM | GAMEVAR_FLAG_PLONG);
AddGameVar("MARKER",(intptr_t)&ud.marker, GAMEVAR_FLAG_SYSTEM | GAMEVAR_FLAG_PLONG);
AddGameVar("FFIRE",(intptr_t)&ud.ffire, GAMEVAR_FLAG_SYSTEM | GAMEVAR_FLAG_PLONG);
AddGameVar("LEVEL",(intptr_t)&ud.level_number, GAMEVAR_FLAG_SYSTEM | GAMEVAR_FLAG_PLONG | GAMEVAR_FLAG_READONLY);
AddGameVar("VOLUME",(intptr_t)&ud.volume_number, GAMEVAR_FLAG_SYSTEM | GAMEVAR_FLAG_PLONG | GAMEVAR_FLAG_READONLY);
AddGameVar("LEVEL", (intptr_t)getmap, GAMEVAR_FLAG_SYSTEM | GAMEVAR_FLAG_PFUNC | GAMEVAR_FLAG_READONLY);
AddGameVar("VOLUME",(intptr_t)getvol, GAMEVAR_FLAG_SYSTEM | GAMEVAR_FLAG_PFUNC | GAMEVAR_FLAG_READONLY);
AddGameVar("COOP",(intptr_t)&ud.coop, GAMEVAR_FLAG_SYSTEM | GAMEVAR_FLAG_PLONG);
AddGameVar("MULTIMODE",(intptr_t)&ud.multimode, GAMEVAR_FLAG_SYSTEM | GAMEVAR_FLAG_PLONG);

View file

@ -28,7 +28,8 @@ enum
GAMEVAR_FLAG_SYSTEM = 2048, // cannot change mode flags...(only default value)
GAMEVAR_FLAG_READONLY = 4096, // values are read-only (no setvar allowed)
GAMEVAR_FLAG_PLONG = 8192, // plValue is a pointer to a long
};
GAMEVAR_FLAG_PFUNC = 8192, // plValue is a pointer to a getter function
};
enum
{
@ -94,6 +95,7 @@ typedef struct
{
int lValue;
int* plValue;
int (*getter)();
};
int defaultValue;
unsigned int dwFlags;

View file

@ -157,11 +157,22 @@ inline void SetPlayerPal(player_struct* p, PalEntry pe)
p->pals = pe;
}
// These should be the only places converting between level numbers and volume/map pairs
constexpr inline int levelnum(int vol, int map)
{
return vol * 1000 + map;
}
constexpr int volfromlevelnum(int num)
{
return num > 0 ? num / 1000 : 0;
}
constexpr int mapfromlevelnum(int num)
{
return num > 0 ? num % 1000 : -1;
}
//---------------------------------------------------------------------------
//
//

View file

@ -35,6 +35,7 @@ source as it is released.
#include "ns.h"
#include "global.h"
#include "mapinfo.h"
BEGIN_DUKE_NS
@ -593,32 +594,7 @@ int endoflevel(int snum)
}
if (p->fist_incs > 42)
{
// Fixme: Take level orogression logic out of here.
if (p->buttonpalette && ud.from_bonus == 0)
{
ud.from_bonus = ud.level_number + 1;
if (ud.secretlevel > 0 && ud.secretlevel < (isRR() ? 9 : 12)) ud.level_number = ud.secretlevel - 1;
}
else
{
if (ud.from_bonus)
{
ud.level_number = ud.from_bonus;
ud.from_bonus = 0;
}
else
{
if (ud.level_number == ud.secretlevel && ud.from_bonus > 0)
ud.level_number = ud.from_bonus;
else ud.level_number++;
if (ud.level_number > (isRR() ? 6 : 10)) ud.level_number = 0;
}
}
for (int i = connecthead; i >= 0; i = connectpoint2[i])
ps[i].gm = MODE_EOL;
p->fist_incs = 0;
setnextmap(!!p->buttonpalette);
return 1;
}
return 0;
@ -645,17 +621,7 @@ int timedexit(int snum)
}
else if (p->timebeforeexit == 1)
{
for (int i = connecthead; i >= 0; i = connectpoint2[i])
ps[i].gm = MODE_EOL;
if (ud.from_bonus && !isRR())
{
ud.level_number = ud.from_bonus;
ud.from_bonus = 0;
}
else
{
ud.level_number++;
}
setnextmap(false);
return true;
}
return false;

View file

@ -30,6 +30,7 @@ Prepared for public release: 03/21/2003 - Charlie Wiederhold, 3D Realms
#include "global.h"
#include "game.h"
#include "names_r.h"
#include "mapinfo.h"
BEGIN_DUKE_NS
@ -1377,69 +1378,26 @@ int doincrements_r(struct player_struct* p)
{
if (!wupass)
{
short snd = -1;
short snd;
wupass = 1;
if (lastlevel)
switch (currentLevel->levelNumber)
{
snd = 391;
default: snd = 391; break;
case levelnum(0, 0): snd = isRRRA() ? 63 : 391; break;
case levelnum(0, 1): snd = 64; break;
case levelnum(0, 2): snd = 77; break;
case levelnum(0, 3): snd = 80; break;
case levelnum(0, 4): snd = 102; break;
case levelnum(0, 5): snd = 103; break;
case levelnum(0, 6): snd = 104; break;
case levelnum(1, 0): snd = 105; break;
case levelnum(1, 1): snd = 176; break;
case levelnum(1, 2): snd = 177; break;
case levelnum(1, 3): snd = 198; break;
case levelnum(1, 4): snd = 230; break;
case levelnum(1, 5): snd = 255; break;
case levelnum(1, 6): snd = 283; break;
}
else switch (ud.volume_number)
{
case 0:
switch (ud.level_number)
{
case 0:
snd = isRRRA()? 63 : 391;
break;
case 1:
snd = 64;
break;
case 2:
snd = 77;
break;
case 3:
snd = 80;
break;
case 4:
snd = 102;
break;
case 5:
snd = 103;
break;
case 6:
snd = 104;
break;
}
break;
case 1:
switch (ud.level_number)
{
case 0:
snd = 105;
break;
case 1:
snd = 176;
break;
case 2:
snd = 177;
break;
case 3:
snd = 198;
break;
case 4:
snd = 230;
break;
case 5:
snd = 255;
break;
case 6:
snd = 283;
break;
}
break;
}
if (snd == -1)
snd = 391;
spritesound(snd, p->i);
}
else if (totalclock > 1024)
@ -3480,7 +3438,7 @@ void processinput_r(int snum)
}
}
else if (psectlotag == 7777)
if (ud.volume_number == 1 && ud.level_number == 6)
if (currentLevel->levelNumber == levelnum(1, 6))
lastlevel = 1;
if (psectlotag == 848 && sector[psect].floorpicnum == WATERTILE2)

View file

@ -29,6 +29,9 @@ Prepared for public release: 03/21/2003 - Charlie Wiederhold, 3D Realms
#include "ns.h"
#include "global.h"
#include "premap.h"
#include "mapinfo.h"
#include "secrets.h"
#include "statistics.h"
BEGIN_DUKE_NS
@ -135,7 +138,7 @@ void resetplayerstats(int snum)
p->jetpack_on = 0;
p->holoduke_on = -1;
p->look_ang = 512 - ((ud.level_number&1)<<10);
p->look_ang = 512 - ((currentLevel->levelNumber & 1) << 10);
p->rotscrnang = 0;
p->orotscrnang = 1; // JBF 20031220
@ -895,7 +898,7 @@ int enterlevel(MapRecord *mi, int gamemode)
everyothertime = 0;
global_random = 0;
ud.last_level = ud.level_number+1;
ud.last_level = currentLevel->levelNumber;
clearfifo();
for (int i=numinterpolations-1; i>=0; i--) bakipos[i] = *curipos[i];
ps[myconnectindex].over_shoulder_on = 0;
@ -916,6 +919,49 @@ void setmapfog(int fogtype)
GLInterface.SetMapFog(fogtype != 0);
}
//---------------------------------------------------------------------------
//
// Ideally this will become the only place where map progression gets set up.
//
//---------------------------------------------------------------------------
bool setnextmap(bool checksecretexit)
{
MapRecord *map;
int from_bonus = 0;
if (checksecretexit && ud.from_bonus == 0)
{
if (ud.secretlevel > 0)
{
int newlevnum = levelnum(volfromlevelnum(currentLevel->levelNumber), ud.secretlevel);
map = FindMapByLevelNum(newlevnum);
if (map)
{
from_bonus = currentLevel->levelNumber + 1;
}
}
}
else if (ud.from_bonus && currentLevel->nextLevel == -1) // if the current level has an explicit link, use that instead of ud.from_bonus.
{
map = FindMapByLevelNum(ud.from_bonus);
}
else
{
map = FindNextMap(currentLevel);
}
for (int i = connecthead; i >= 0; i = connectpoint2[i])
ps[i].gm = MODE_EOL;
if (map)
{
ud.from_bonus = from_bonus;
ud.nextLevel = map;
return true;
}
ud.eog = true;
return false;
}
END_DUKE_NS

View file

@ -29,6 +29,7 @@ Prepared for public release: 03/21/2003 - Charlie Wiederhold, 3D Realms
#include "ns.h"
#include "global.h"
#include "names_r.h"
#include "mapinfo.h"
BEGIN_DUKE_NS
@ -363,11 +364,11 @@ static void cachegoodsprites(void)
for (i = SMALLSMOKE; i < (SMALLSMOKE + 4); i++)
tloadtile(i);
if (isRRRA() && ud.volume_number == 0 && ud.level_number == 4)
if (isRRRA() && currentLevel->levelNumber == levelnum(0, 4))
{
tloadtile(RRTILE2577);
}
if (!isRRRA() && ud.volume_number == 1 && ud.level_number == 2)
if (!isRRRA() && currentLevel->levelNumber == levelnum(1, 2))
{
tloadtile(RRTILE3190);
tloadtile(RRTILE3191);
@ -464,7 +465,7 @@ void prelevel_r(int g)
if (isRRRA())
{
if (ud.level_number == 4 && ud.volume_number == 1)
if (currentLevel->levelNumber == levelnum(1, 4))
ps[myconnectindex].steroids_amount = 0;
for (j = 0; j < MAXSPRITES; j++)

View file

@ -36,6 +36,7 @@ source as it is released.
#include "global.h"
#include "sounds.h"
#include "names_d.h"
#include "mapinfo.h"
// PRIMITIVE
BEGIN_DUKE_NS
@ -477,17 +478,7 @@ bool checkhitswitch_d(int snum, int w, int switchtype)
if (lotag == (short)65535)
{
ps[myconnectindex].gm = MODE_EOL;
if (ud.from_bonus)
{
ud.level_number = ud.from_bonus;
ud.from_bonus = 0;
}
else
{
// fixme: This needs to be taken from the level definitions.
ud.level_number = (++ud.level_number < MAXLEVELS) ? ud.level_number : 0;
}
setnextmap(false);
return 1;
}
@ -1506,20 +1497,8 @@ void checksectors_d(int snum)
p->secret_rooms++;
return;
case -1:
for (i = connecthead; i >= 0; i = connectpoint2[i])
ps[i].gm = MODE_EOL;
sector[p->cursectnum].lotag = 0;
if (ud.from_bonus)
{
ud.level_number = ud.from_bonus;
ud.from_bonus = 0;
}
else
{
ud.level_number++;
if ((ud.volume_number && ud.level_number > 10) || ud.level_number > 5)
ud.level_number = 0;
}
setnextmap(false);
return;
case -2:
sector[p->cursectnum].lotag = 0;

View file

@ -30,6 +30,7 @@ Prepared for public release: 03/21/2003 - Charlie Wiederhold, 3D Realms
#include "global.h"
#include "sounds.h"
#include "names_r.h"
#include "mapinfo.h"
// PRIMITIVE
BEGIN_DUKE_NS
@ -517,8 +518,7 @@ bool checkhitswitch_r(int snum, int w, int switchtype)
break;
case RRTILE2214:
if (ud.level_number > 6)
ud.level_number = 0;
//if (ud.level_numbe r > 6) ud.level_numbe r = 0; ??? Looks like some leftover garbage.
sprite[i].picnum++;
break;
case RRTILE8660:
@ -675,19 +675,7 @@ bool checkhitswitch_r(int snum, int w, int switchtype)
if (lotag == (short)65535)
{
ps[myconnectindex].gm = MODE_EOL;
if (ud.from_bonus)
{
ud.level_number = ud.from_bonus;
ud.from_bonus = 0;
}
else
{
// fixme: This needs to be taken from the level definitions.
if (isRRRA() && ud.level_number == 6 && ud.volume_number == 0)
RRRA_EndEpisode = 1; // hack to force advancing to episode 2.
ud.level_number = (++ud.level_number < MAXLEVELS) ? ud.level_number : 0;
}
setnextmap(false);
}
vec3_t v = { sx, sy, ps[snum].posz };
@ -2464,24 +2452,10 @@ void checksectors_r(int snum)
p->secret_rooms++;
return;
case -1:
for (i = connecthead; i >= 0; i = connectpoint2[i])
ps[i].gm = MODE_EOL;
sector[p->cursectnum].lotag = 0;
if (!isRRRA() || !RRRA_ExitedLevel)
{
if (ud.from_bonus)
{
ud.level_number = ud.from_bonus;
ud.from_bonus = 0;
}
else
{
if (isRRRA() && ud.level_number == 6 && ud.volume_number == 0)
RRRA_EndEpisode = 1;
ud.level_number++;
if (ud.level_number > 6)
ud.level_number = 0;
}
setnextmap(false);
RRRA_ExitedLevel = 1;
}
return;

View file

@ -64,9 +64,10 @@ struct user_defs
int respawn_monsters, respawn_items, respawn_inventory, recstat, monsters_off, brightness;
int m_respawn_items, m_respawn_monsters, m_respawn_inventory, m_recstat, m_monsters_off, detail;
int m_ffire, ffire, m_player_skill, /*m_level_number, m_volume_number,*/ multimode;
int player_skill, level_number, volume_number, m_marker, marker, mouseflip;
int m_ffire, ffire, m_player_skill, multimode;
int player_skill, m_marker, marker, mouseflip;
int statusbarmode, althud, ShowOpponentWeapons;
MapRecord* nextLevel;
};

View file

@ -453,51 +453,6 @@ void G_BackToMenu(void)
inputState.keyFlushChars();
}
static int G_EndOfLevel(void)
{
STAT_Update(ud.eog || (currentLevel->flags & MI_FORCEEOG));
setpal(g_player[myconnectindex].ps);
if (g_player[myconnectindex].ps->gm&MODE_EOL)
{
ready2send = 0;
dobonus(0);
// Clear potentially loaded per-map ART only after the bonus screens.
artClearMapArt();
if (ud.eog || (currentLevel->flags & MI_FORCEEOG))
{
ud.eog = 0;
if ((!g_netServer && ud.multimode < 2))
{
if (!VOLUMEALL)
doorders([](bool) {});
g_player[myconnectindex].ps->gm = 0;
return 2;
}
else
{
ud.level_number = 0;
}
}
}
ready2send = 0;
if (numplayers > 1)
g_player[myconnectindex].ps->gm = MODE_GAME;
if (G_EnterLevel(g_player[myconnectindex].ps->gm))
{
return 2;
}
Net_WaitForEverybody();
return 1;
}
void G_MaybeAllocPlayer(int32_t pnum)
{
if (g_player[pnum].ps == NULL)
@ -803,7 +758,7 @@ MAIN_LOOP_RESTART:
if (g_player[myconnectindex].ps->gm & (MODE_EOL|MODE_RESTART))
{
switch (G_EndOfLevel())
switch (exitlevel())
{
case 1: continue;
case 2: goto MAIN_LOOP_RESTART;

View file

@ -63,11 +63,7 @@ void G_InitRRRASkies(void)
}
}
void prelevel_d(int g);
void prelevel_r(int g);
void e4intro(CompletionFunc completion);
void G_NewGame(int volumeNum, int levelNum, int skillNum)
void G_NewGame(MapRecord *map, int skillNum)
{
struct player_struct *const pPlayer = g_player[0].ps;
@ -82,14 +78,13 @@ void G_NewGame(int volumeNum, int levelNum, int skillNum)
dobonus(1);
}
if (isRR() && !isRRRA() && ud.level_number == 6 && ud.volume_number == 0)
if (isRR() && !isRRRA() && map->levelNumber == levelnum(0, 6))
dobonus(0);
#endif
show_shareware = REALGAMETICSPERSEC*30;
ud.level_number = levelNum;
ud.volume_number = volumeNum;
ud.nextLevel = map;
ud.player_skill = skillNum;
ud.secretlevel = 0;
ud.from_bonus = 0;
@ -98,18 +93,13 @@ void G_NewGame(int volumeNum, int levelNum, int skillNum)
int const UserMap = false;// Menu_HaveUserMap();
// we don't want the intro to play after the multiplayer setup screen
if (!isRR() && (!g_netServer && ud.multimode < 2) && UserMap == 0 &&
levelNum == 0 && volumeNum == 3)
// we don't want the intro to play after the multiplayer setup screen.
if (!isRR() && (!g_netServer && ud.multimode < 2) && UserMap == 0 && currentLevel->levelNumber == levelnum(3, 0))
{
e4intro([](bool) {});
}
#ifdef EDUKE32_TOUCH_DEVICES
pPlayer->zoom = 360;
#else
pPlayer->zoom = 768;
#endif
pPlayer->gm = 0;
M_ClearMenus();

View file

@ -767,8 +767,6 @@ static const dataspec_t svgm_udnetw[] =
{ 0, &numplayersprites, sizeof(numplayersprites), 1 },
{ 0, &po, sizeof(po), 1 },
{ DS_NOCHK, &ud.volume_number, sizeof(ud.volume_number), 1 },
{ DS_NOCHK, &ud.level_number, sizeof(ud.level_number), 1 },
{ DS_NOCHK, &ud.player_skill, sizeof(ud.player_skill), 1 },
{ DS_NOCHK, &ud.from_bonus, sizeof(ud.from_bonus), 1 },
@ -883,7 +881,6 @@ static const dataspec_t svgm_anmisc[] =
{ 0, &pistonsound, sizeof(pistonsound), 1 },
{ 0, &chickenphase, sizeof(chickenphase), 1 },
{ 0, &RRRA_ExitedLevel, sizeof(RRRA_ExitedLevel), 1 },
{ 0, &RRRA_EndEpisode, sizeof(RRRA_EndEpisode), 1 },
{ 0, &fogactive, sizeof(fogactive), 1 },
{ DS_LOADFN, (void *)sv_rrrafog, 0, 1 },
@ -966,8 +963,8 @@ int32_t sv_saveandmakesnapshot(FileWriter &fil, int8_t spot, bool isAutoSave)
// it in a savegame header read
h.numplayers = ud.multimode;
h.volnum = ud.volume_number;
h.levnum = ud.level_number;
h.volnum = 0;
h.levnum = 0;
h.skill = ud.player_skill;
if (spot >= 0)