- got rid of m_level_number and m_volume_number.

These were only needed so that G_NewGame_EnterLevel could be called without parameters. Ouch!
This commit is contained in:
Christoph Oelckers 2020-07-07 10:17:02 +02:00
parent 7f3c0ef16c
commit dd45749650
18 changed files with 30 additions and 75 deletions

View file

@ -107,10 +107,8 @@ EXTERN_CVAR(String, usermapfolder)
EXTERN_CVAR(Int, m_recstat)
EXTERN_CVAR(Int, m_coop)
EXTERN_CVAR(Int, m_marker)
EXTERN_CVAR(Int, m_level_number)
EXTERN_CVAR(Int, m_ffire)
EXTERN_CVAR(Int, m_noexits)
EXTERN_CVAR(Int, m_levelnumber)
EXTERN_CVAR(Int, playercolor)
EXTERN_CVAR(Int, playerteam)

View file

@ -37,6 +37,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "palette.h"
#include "cmdlib.h"
EXTERN_CVAR(Int, m_level_number)
BEGIN_EDUKE_NS
#ifndef ONLY_USERDEFS

View file

@ -2141,7 +2141,6 @@ static void rrra_specialstats()
ud.level_number++;
if (ud.level_number > 6)
ud.level_number = 0;
ud.m_level_number = ud.level_number;
}
}

View file

@ -52,14 +52,12 @@ static void dowarp(int volume, int level)
ud.multimode = 1;
ud.m_volume_number = volume;
m_level_number = level;
if (ps[myconnectindex].gm & MODE_GAME)
{
G_NewGame(ud.m_volume_number, m_level_number, ud.m_player_skill);
G_NewGame(volume, level, ud.m_player_skill);
ps[myconnectindex].gm = MODE_RESTART;
}
else G_NewGame_EnterLevel();
else G_NewGame_EnterLevel(volume, level, ud.m_player_skill);
}
static int ccmd_levelwarp(CCmdFuncPtr parm)

View file

@ -183,8 +183,6 @@ static bool cheatLevel(cheatseq_t *s)
{
FX_StopAllSounds();
FX_SetReverb(0);
ud.m_volume_number = ud.volume_number = volnume;
ud.m_level_number = ud.level_number = levnume;
ps[myconnectindex].gm |= MODE_RESTART;
}
return true;

View file

@ -312,14 +312,12 @@ void GameInterface::StartGame(FNewGameStartup& gs)
}
}
ud.m_respawn_monsters = (gs.Skill == 3);
ud.m_volume_number = gs.Episode;
m_level_number = gs.Level;
ud.m_monsters_off = ud.monsters_off = 0;
ud.m_respawn_items = 0;
ud.m_respawn_inventory = 0;
ud.multimode = 1;
G_NewGame_EnterLevel();
G_NewGame_EnterLevel(gs.Episode, gs.Level, ud.m_player_skill);
}

View file

@ -49,14 +49,15 @@ extern char boardfilename[BMAX_PATH];
#define USERMAPMUSICFAKELEVEL (MAXLEVELS-1)
#define USERMAPMUSICFAKESLOT ((USERMAPMUSICFAKEVOLUME * MAXLEVELS) + USERMAPMUSICFAKELEVEL)
// Need to do this differently, set to false to allow transitioning away from the current mess.
static inline int G_HaveUserMap(void)
{
return (boardfilename[0] != 0 && ud.level_number == 7 && ud.volume_number == 0);
return false; // (boardfilename[0] != 0 && ud.level_number == 7 && ud.volume_number == 0);
}
static inline int Menu_HaveUserMap(void)
{
return (boardfilename[0] != 0 && m_level_number == 7 && ud.m_volume_number == 0);
return false;// (boardfilename[0] != 0 && m_level_number == 7 && ud.m_volume_number == 0);
}
extern int32_t g_Shareware;
@ -101,9 +102,9 @@ static inline int32_t calc_smoothratio(ClockTicks totalclk, ClockTicks ototalclk
}
static inline void G_NewGame_EnterLevel(void)
static inline void G_NewGame_EnterLevel(int volume, int level, int skill)
{
G_NewGame(ud.m_volume_number, m_level_number, ud.m_player_skill);
G_NewGame(volume, level, skill);
if (G_EnterLevel(MODE_GAME))
G_BackToMenu();

View file

@ -374,7 +374,7 @@ void displayrest(int smoothratio)
i = pp->cursectnum;
show2dsector.Set(i);
if (i >= 0) show2dsector.Set(i);
wal = &wall[sector[i].wallptr];
for (j = sector[i].wallnum; j > 0; j--, wal++)
{
@ -830,8 +830,8 @@ void dobonus(int bonusonly)
if (RRRA_EndEpisode)
{
RRRA_EndEpisode = 0;
ud.m_volume_number = ud.volume_number = 1;
m_level_number = ud.level_number = 0;
ud.volume_number = 1;
ud.level_number = 0;
ud.eog = 0;
}
}

View file

@ -539,7 +539,6 @@ int parse(void)
ud.level_number++;
if (ud.level_number > 6)
ud.level_number = 0;
ud.m_level_number = ud.level_number;
}
break;
case concmd_mamaend:

View file

@ -598,14 +598,12 @@ int endoflevel(int snum)
{
ud.from_bonus = ud.level_number + 1;
if (ud.secretlevel > 0 && ud.secretlevel < (isRR() ? 9 : 12)) ud.level_number = ud.secretlevel - 1;
ud.m_level_number = ud.level_number;
}
else
{
if (ud.from_bonus)
{
ud.level_number = ud.from_bonus;
ud.m_level_number = ud.level_number;
ud.from_bonus = 0;
}
else
@ -615,7 +613,6 @@ int endoflevel(int snum)
else ud.level_number++;
if (ud.level_number > (isRR() ? 6 : 10)) ud.level_number = 0;
ud.m_level_number = ud.level_number;
}
}
@ -653,13 +650,11 @@ int timedexit(int snum)
if (ud.from_bonus && !isRR())
{
ud.level_number = ud.from_bonus;
ud.m_level_number = ud.level_number;
ud.from_bonus = 0;
}
else
{
ud.level_number++;
ud.m_level_number = ud.level_number;
}
return true;
}

View file

@ -501,7 +501,7 @@ void displayrooms(int snum, int smoothratio)
setgamepalette(BASEPAL);
animatecamsprite(smoothratio);
// The camera texture must be rendered with the base palette, so this is the only place where the current global can be set.
// The camera texture must be rendered with the base palette, so this is the only place where the current global palette can be set.
// The setting here will be carried over to the rendering of the weapon sprites, but other 2D content will always default to the main palette.
setgamepalette(p->palette);
if (ud.camerasprite >= 0)

View file

@ -481,14 +481,12 @@ bool checkhitswitch_d(int snum, int w, int switchtype)
if (ud.from_bonus)
{
ud.level_number = ud.from_bonus;
ud.m_level_number = ud.level_number;
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;
ud.m_level_number = ud.level_number;
}
return 1;
}
@ -1514,7 +1512,6 @@ void checksectors_d(int snum)
if (ud.from_bonus)
{
ud.level_number = ud.from_bonus;
ud.m_level_number = ud.level_number;
ud.from_bonus = 0;
}
else
@ -1522,7 +1519,6 @@ void checksectors_d(int snum)
ud.level_number++;
if ((ud.volume_number && ud.level_number > 10) || ud.level_number > 5)
ud.level_number = 0;
ud.m_level_number = ud.level_number;
}
return;
case -2:

View file

@ -679,7 +679,6 @@ bool checkhitswitch_r(int snum, int w, int switchtype)
if (ud.from_bonus)
{
ud.level_number = ud.from_bonus;
ud.m_level_number = ud.level_number;
ud.from_bonus = 0;
}
else
@ -688,7 +687,6 @@ bool checkhitswitch_r(int snum, int w, int switchtype)
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;
ud.m_level_number = ud.level_number;
}
}
@ -2474,7 +2472,6 @@ void checksectors_r(int snum)
if (ud.from_bonus)
{
ud.level_number = ud.from_bonus;
ud.m_level_number = ud.level_number;
ud.from_bonus = 0;
}
else
@ -2484,7 +2481,6 @@ void checksectors_r(int snum)
ud.level_number++;
if (ud.level_number > 6)
ud.level_number = 0;
ud.m_level_number = ud.level_number;
}
RRRA_ExitedLevel = 1;
}

View file

@ -43,7 +43,7 @@ struct input_t // original name was input which is too generic for a type name.
struct user_defs
{
unsigned char god, warp_on, cashman, eog, showallmap;
unsigned char god, cashman, eog, showallmap;
unsigned char show_help, scrollmode, clipping;
char user_name[MAXPLAYERS][32];
unsigned char overhead_on, last_overhead, showweapons;
@ -64,7 +64,7 @@ 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 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 statusbarmode, noexits, althud, ShowOpponentWeapons;

View file

@ -447,7 +447,6 @@ void G_UpdatePlayerFromMenu(void)
void G_BackToMenu(void)
{
boardfilename[0] = 0;
ud.warp_on = 0;
g_player[myconnectindex].ps->gm = 0;
M_StartControlPanel(false);
M_SetMenu(NAME_Mainmenu);
@ -480,7 +479,6 @@ static int G_EndOfLevel(void)
}
else
{
m_level_number = 0;
ud.level_number = 0;
}
}
@ -674,22 +672,12 @@ int GameInterface::app_main()
tileDelete(13);
if (numplayers == 1 && boardfilename[0] != 0)
{
m_level_number = 7;
ud.m_volume_number = 0;
ud.warp_on = 1;
}
// getnames();
if (g_netServer || ud.multimode > 1)
{
if (ud.warp_on == 0)
{
ud.m_monsters_off = 1;
ud.m_player_skill = 0;
}
ud.m_monsters_off = 1;
ud.m_player_skill = 0;
}
playerswhenstarted = ud.multimode; // XXX: redundant?
@ -717,32 +705,24 @@ MAIN_LOOP_RESTART:
g_player[myconnectindex].ps->ftq = 0;
if (ud.warp_on == 1)
{
G_NewGame_EnterLevel();
// may change ud.warp_on in an error condition
}
if (ud.warp_on == 0)
//if (ud.warp_on == 0)
{
#if 0 // fixme once the game loop has been done.
if ((g_netServer || ud.multimode > 1) && boardfilename[0] != 0)
{
m_level_number = 7;
ud.m_volume_number = 0;
auto maprecord = FindMap(boardfilename);
ud.m_respawn_monsters = ud.m_player_skill == 4;
if (ud.m_player_skill == 4)
ud.m_respawn_monsters = 1;
else ud.m_respawn_monsters = 0;
for (bssize_t TRAVERSE_CONNECT(i))
for (int i = 0; i != -1; i = connectpoint2[i])
{
resetweapons(i);
resetinventory(i);
}
G_NewGame_EnterLevel();
StartGame(maprecord);
}
else
#endif
{
fi.ShowLogo([](bool) {});
}
@ -763,7 +743,6 @@ MAIN_LOOP_RESTART:
if (playercolor) g_player[myconnectindex].ps->palookup = g_player[myconnectindex].pcolor = G_CheckPlayerColor(playercolor);
else g_player[myconnectindex].ps->palookup = g_player[myconnectindex].pcolor;
ud.warp_on = 0;
inputState.ClearKeyStatus(sc_Pause); // JBF: I hate the pause key
do //main loop

View file

@ -332,8 +332,8 @@ int G_EnterLevel(int gameMode)
levelNum &= MAXLEVELS-1;
volumeNum = (volumeNum - levelNum) / MAXLEVELS;
ud.level_number = m_level_number = levelNum;
ud.volume_number = ud.m_volume_number = volumeNum;
ud.level_number = levelNum;
ud.volume_number = volumeNum;
boardfilename[0] = 0;
}
@ -442,8 +442,7 @@ int G_EnterLevel(int gameMode)
}
else
{
Printf(TEXTCOLOR_GOLD "E%dL%d: %s\n", ud.volume_number+1, ud.level_number+1,
mapList[mii].DisplayName());
Printf(TEXTCOLOR_GOLD "%s: %s\n", mapList[mii].labelName.GetChars(), mapList[mii].DisplayName());
}
videoClearViewableArea(0L);

View file

@ -162,9 +162,6 @@ int32_t G_LoadPlayer(const char *path)
FX_StopAllSounds();
// non-"m_" fields will be loaded from svgm_udnetw
ud.m_volume_number = h.volnum;
m_level_number = h.levnum;
ud.m_player_skill = h.skill;
// NOTE: Bmemcpy needed for SAVEGAME_MUSIC.
@ -1199,8 +1196,6 @@ int32_t sv_readdiff(FileReader &fil)
static void sv_postudload()
{
#if 1
m_level_number = ud.level_number;
ud.m_volume_number = ud.volume_number;
ud.m_player_skill = ud.player_skill;
ud.m_respawn_monsters = ud.respawn_monsters;
ud.m_respawn_items = ud.respawn_items;

View file

@ -34,6 +34,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "palette.h"
#include "cmdlib.h"
EXTERN_CVAR(Int, m_level_number)
BEGIN_RR_NS
#ifndef ONLY_USERDEFS