mirror of
https://github.com/ZDoom/Raze.git
synced 2024-11-15 08:51:24 +00:00
- removed redundant levelnum variable.
Better use the global map record.
This commit is contained in:
parent
1a0e413d5c
commit
f7fcd341ec
14 changed files with 43 additions and 39 deletions
|
@ -20,6 +20,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
#include "exhumed.h"
|
||||
#include "engine.h"
|
||||
#include "sequence.h"
|
||||
#include "mapinfo.h"
|
||||
#include <assert.h>
|
||||
|
||||
BEGIN_PS_NS
|
||||
|
@ -219,7 +220,7 @@ void DoBubbleMachines()
|
|||
void BuildBubbleMachine(int nSprite)
|
||||
{
|
||||
if (nMachineCount >= kMaxMachines) {
|
||||
I_Error("too many bubble machines in level %d\n", levelnum);
|
||||
I_Error("too many bubble machines in level %d\n", currentLevel->levelNumber);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
|
|
|
@ -158,7 +158,6 @@ short nCodeMin = 0;
|
|||
short nCodeMax = 0;
|
||||
short nCodeIndex = 0;
|
||||
|
||||
short levelnum = -1;
|
||||
//short nScreenWidth = 320;
|
||||
//short nScreenHeight = 200;
|
||||
int moveframes;
|
||||
|
@ -458,7 +457,7 @@ void GameMove(void)
|
|||
{
|
||||
FixPalette();
|
||||
|
||||
if (levelnum == kMap20)
|
||||
if (currentLevel->levelNumber == kMap20)
|
||||
{
|
||||
if (lCountDown <= 0)
|
||||
{
|
||||
|
@ -780,7 +779,6 @@ static SavegameHelper sgh("exhumed",
|
|||
SV(nEnergyChan),
|
||||
SV(lCountDown),
|
||||
SV(nEnergyTowers),
|
||||
SV(levelnum),
|
||||
SV(moveframes),
|
||||
SV(totalmoves),
|
||||
SV(nCurBodyNum),
|
||||
|
|
|
@ -183,7 +183,6 @@ extern short nBodyTotal;
|
|||
extern short bSnakeCam;
|
||||
extern uint8_t nCinemaSeen;
|
||||
|
||||
extern short levelnum;
|
||||
//extern short nScreenWidth;
|
||||
//extern short nScreenHeight;
|
||||
|
||||
|
|
|
@ -67,8 +67,9 @@ void DoTitle(CompletionFunc completion);
|
|||
|
||||
static int FinishLevel(TArray<JobDesc> &jobs)
|
||||
{
|
||||
if (levelnum > nBestLevel) {
|
||||
nBestLevel = levelnum - 1;
|
||||
int lnum = currentLevel->levelNumber;
|
||||
if (lnum > nBestLevel) {
|
||||
nBestLevel = lnum - 1;
|
||||
}
|
||||
|
||||
|
||||
|
@ -77,8 +78,8 @@ static int FinishLevel(TArray<JobDesc> &jobs)
|
|||
bCamera = false;
|
||||
nMapMode = 0;
|
||||
|
||||
STAT_Update(levelnum == kMap20);
|
||||
if (levelnum != kMap20)
|
||||
STAT_Update(lnum == kMap20);
|
||||
if (lnum != kMap20)
|
||||
{
|
||||
if (EndLevel != 2)
|
||||
{
|
||||
|
@ -90,8 +91,8 @@ static int FinishLevel(TArray<JobDesc> &jobs)
|
|||
}
|
||||
else nPlayerLives[0] = 0;
|
||||
|
||||
DoAfterCinemaScene(levelnum, jobs);
|
||||
return levelnum == kMap20? -1 : levelnum + 1;
|
||||
DoAfterCinemaScene(lnum, jobs);
|
||||
return lnum == kMap20? -1 : lnum + 1;
|
||||
}
|
||||
|
||||
|
||||
|
@ -112,7 +113,7 @@ static void showmap(short nLevel, short nLevelNew, short nLevelBest, TArray<JobD
|
|||
|
||||
static void GameDisplay(void)
|
||||
{
|
||||
if (levelnum == kMap20)
|
||||
if (currentLevel->levelNumber == kMap20)
|
||||
{
|
||||
DoEnergyTile();
|
||||
DrawClock();
|
||||
|
@ -184,6 +185,7 @@ void CheckProgression()
|
|||
if (GameAction < 1000)
|
||||
{
|
||||
// start a new game on the given level
|
||||
currentLevel = nullptr;
|
||||
mylevelnew = GameAction;
|
||||
GameAction = -1;
|
||||
InitNewGame();
|
||||
|
@ -200,7 +202,7 @@ void CheckProgression()
|
|||
}
|
||||
else if (EndLevel)
|
||||
{
|
||||
if (levelnum == 0) startmainmenu();
|
||||
if (currentLevel->levelNumber == 0) startmainmenu();
|
||||
else mylevelnew = FinishLevel(jobs);
|
||||
EndLevel = false;
|
||||
}
|
||||
|
@ -210,7 +212,7 @@ void CheckProgression()
|
|||
// start a new game at the given level
|
||||
if (!nNetPlayerCount && mylevelnew > 0)
|
||||
{
|
||||
showmap(levelnum, mylevelnew, nBestLevel, jobs);
|
||||
showmap(currentLevel? currentLevel->levelNumber : -1, mylevelnew, nBestLevel, jobs);
|
||||
}
|
||||
else
|
||||
jobs.Push({ Create<DScreenJob>() }); // we need something in here even in the multiplayer case.
|
||||
|
|
|
@ -173,15 +173,11 @@ uint8_t LoadLevel(int nMap)
|
|||
precache();
|
||||
|
||||
LoadObjects();
|
||||
|
||||
levelnum = nMap;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void InitLevel(int level)
|
||||
{
|
||||
levelnum = level;
|
||||
StopCD();
|
||||
if (!LoadLevel(level)) {
|
||||
I_Error("Can't load level %d...\n", level);
|
||||
|
|
|
@ -23,6 +23,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
#include "status.h"
|
||||
#include "engine.h"
|
||||
#include "ps_input.h"
|
||||
#include "mapinfo.h"
|
||||
|
||||
BEGIN_PS_NS
|
||||
|
||||
|
@ -435,7 +436,7 @@ void StartRegenerate(short nSprite)
|
|||
pSprite->extra = 1350;
|
||||
pSprite->ang = nFirstRegenerate;
|
||||
|
||||
if (levelnum <= kMap20)
|
||||
if (currentLevel->levelNumber <= kMap20)
|
||||
{
|
||||
pSprite->ang /= 5;
|
||||
}
|
||||
|
|
|
@ -293,7 +293,7 @@ void menu_GameSave2(FILE* fp)
|
|||
{
|
||||
memset(&GameStats, 0, sizeof(GameStats));
|
||||
|
||||
GameStats.nMap = (uint8_t)levelnum;
|
||||
//GameStats.nMap = (uint8_t)levelnum;
|
||||
GameStats.nWeapons = nPlayerWeapons[nLocalPlayer];
|
||||
GameStats.nCurrentWeapon = PlayerList[nLocalPlayer].nCurrentWeapon;
|
||||
GameStats.clip = nPlayerClip[nLocalPlayer];
|
||||
|
|
|
@ -23,6 +23,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
#include "view.h"
|
||||
#include "status.h"
|
||||
#include "sound.h"
|
||||
#include "mapinfo.h"
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
|
||||
|
@ -180,7 +181,7 @@ void MoveThings()
|
|||
DoMovingSects();
|
||||
DoRegenerates();
|
||||
|
||||
if (levelnum == kMap20)
|
||||
if (currentLevel->levelNumber == kMap20)
|
||||
{
|
||||
DoFinale();
|
||||
if (lCountDown < 1800 && nDronePitch < 2400 && !lFinaleStart)
|
||||
|
|
|
@ -24,6 +24,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
#include "names.h"
|
||||
#include "sequence.h"
|
||||
#include "player.h"
|
||||
#include "mapinfo.h"
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
|
||||
|
@ -2099,7 +2100,7 @@ FUNCOBJECT_GOTO:
|
|||
}
|
||||
}
|
||||
|
||||
if (levelnum <= 20 || nStat != kStatExplodeTrigger)
|
||||
if (currentLevel->levelNumber <= 20 || nStat != kStatExplodeTrigger)
|
||||
{
|
||||
runlist_SubRunRec(sprite[nSprite].owner);
|
||||
runlist_SubRunRec(ObjectList[nObject].field_4);
|
||||
|
@ -2554,7 +2555,7 @@ void PostProcess()
|
|||
}
|
||||
}
|
||||
|
||||
if (levelnum != kMap20)
|
||||
if (currentLevel->levelNumber != kMap20)
|
||||
{
|
||||
// esi is i
|
||||
for (i = 0; i < numsectors; i++)
|
||||
|
|
|
@ -32,6 +32,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
#include "buildtiles.h"
|
||||
#include "gstrings.h"
|
||||
#include "gamestate.h"
|
||||
#include "mapinfo.h"
|
||||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
@ -628,7 +629,7 @@ void RestartPlayer(short nPlayer)
|
|||
PlayerList[nPlayer].nAir = 100;
|
||||
airpages = 0;
|
||||
|
||||
if (levelnum <= kMap20)
|
||||
if (currentLevel->levelNumber <= kMap20)
|
||||
{
|
||||
RestoreMinAmmo(nPlayer);
|
||||
}
|
||||
|
@ -789,7 +790,7 @@ void StartDeathSeq(int nPlayer, int nVal)
|
|||
BuildStatusAnim((3 * (nLives - 1)) + 7, 0);
|
||||
}
|
||||
|
||||
if (levelnum > 0) { // if not on the training level
|
||||
if (currentLevel->levelNumber > 0) { // if not on the training level
|
||||
nPlayerLives[nPlayer]--;
|
||||
}
|
||||
|
||||
|
@ -1265,7 +1266,7 @@ void FuncPlayer(int a, int nDamage, int nRun)
|
|||
|
||||
nDestVertPan[nPlayer] = F16(92);
|
||||
|
||||
if (levelnum == 11)
|
||||
if (currentLevel->levelNumber == 11)
|
||||
{
|
||||
nDestVertPan[nPlayer] += F16(46);
|
||||
}
|
||||
|
@ -1728,7 +1729,7 @@ do_default:
|
|||
// loc_1B3C7
|
||||
|
||||
// CHECKME - is order of evaluation correct?
|
||||
if (levelnum <= 20 || (var_70 >= 25 && (var_70 <= 25 || var_70 == 50)))
|
||||
if (currentLevel->levelNumber <= 20 || (var_70 >= 25 && (var_70 <= 25 || var_70 == 50)))
|
||||
{
|
||||
DestroyItemAnim(nValB);
|
||||
mydeletesprite(nValB);
|
||||
|
@ -2184,7 +2185,7 @@ do_default_b:
|
|||
|
||||
if (weapons & var_18)
|
||||
{
|
||||
if (levelnum > 20)
|
||||
if (currentLevel->levelNumber > 20)
|
||||
{
|
||||
AddAmmo(nPlayer, WeaponInfo[var_40].nAmmoType, ebx);
|
||||
}
|
||||
|
@ -2246,7 +2247,7 @@ do_default_b:
|
|||
|
||||
if (weapons & var_18)
|
||||
{
|
||||
if (levelnum > 20)
|
||||
if (currentLevel->levelNumber > 20)
|
||||
{
|
||||
AddAmmo(nPlayer, WeaponInfo[var_40].nAmmoType, ebx);
|
||||
}
|
||||
|
@ -2308,7 +2309,7 @@ do_default_b:
|
|||
|
||||
if (weapons & var_18)
|
||||
{
|
||||
if (levelnum > 20)
|
||||
if (currentLevel->levelNumber > 20)
|
||||
{
|
||||
AddAmmo(nPlayer, WeaponInfo[var_40].nAmmoType, ebx);
|
||||
}
|
||||
|
@ -2370,7 +2371,7 @@ do_default_b:
|
|||
|
||||
if (weapons & var_18)
|
||||
{
|
||||
if (levelnum > 20)
|
||||
if (currentLevel->levelNumber > 20)
|
||||
{
|
||||
AddAmmo(nPlayer, WeaponInfo[var_40].nAmmoType, ebx);
|
||||
}
|
||||
|
@ -2432,7 +2433,7 @@ do_default_b:
|
|||
|
||||
if (weapons & var_18)
|
||||
{
|
||||
if (levelnum > 20)
|
||||
if (currentLevel->levelNumber > 20)
|
||||
{
|
||||
AddAmmo(nPlayer, WeaponInfo[var_40].nAmmoType, ebx);
|
||||
}
|
||||
|
@ -2494,7 +2495,7 @@ do_default_b:
|
|||
|
||||
if (weapons & var_18)
|
||||
{
|
||||
if (levelnum > 20)
|
||||
if (currentLevel->levelNumber > 20)
|
||||
{
|
||||
AddAmmo(nPlayer, WeaponInfo[var_40].nAmmoType, ebx);
|
||||
}
|
||||
|
@ -2954,7 +2955,7 @@ loc_1BD2E:
|
|||
}
|
||||
else
|
||||
{
|
||||
DoGameOverScene((levelnum == 20));
|
||||
DoGameOverScene((currentLevel->levelNumber == 20));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,6 +24,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
#include "names.h"
|
||||
#include "aistuff.h"
|
||||
#include "player.h"
|
||||
#include "mapinfo.h"
|
||||
|
||||
|
||||
BEGIN_PS_NS
|
||||
|
@ -137,7 +138,7 @@ void InitSpiritHead()
|
|||
|
||||
int nTrack;
|
||||
|
||||
if (levelnum == 1)
|
||||
if (currentLevel->levelNumber == 1)
|
||||
{
|
||||
nTrack = 3;
|
||||
}
|
||||
|
@ -150,7 +151,7 @@ void InitSpiritHead()
|
|||
|
||||
StartSwirlies();
|
||||
|
||||
sprintf(filename, "LEV%d.PUP", levelnum);
|
||||
sprintf(filename, "LEV%d.PUP", currentLevel->levelNumber);
|
||||
lNextStateChange = (int)totalclock;
|
||||
lHeadStartClock = (int)totalclock;
|
||||
|
||||
|
|
|
@ -25,6 +25,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
#include "mmulti.h"
|
||||
#include "savegamehelp.h"
|
||||
#include "sound.h"
|
||||
#include "mapinfo.h"
|
||||
|
||||
BEGIN_PS_NS
|
||||
|
||||
|
@ -62,7 +63,7 @@ bool GameInterface::LoadGame(FSaveGameNode* sv)
|
|||
ototalclock = totalclock;
|
||||
GameAction = 1000;
|
||||
|
||||
if (levelnum > 15)
|
||||
if (currentLevel->levelNumber > 15)
|
||||
{
|
||||
nSwitchSound = 35;
|
||||
nStoneSound = 23;
|
||||
|
|
|
@ -26,6 +26,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
#include "player.h"
|
||||
#include "sequence.h"
|
||||
#include "raze_sound.h"
|
||||
#include "mapinfo.h"
|
||||
|
||||
BEGIN_PS_NS
|
||||
|
||||
|
@ -656,7 +657,7 @@ void CheckAmbience(short nSector)
|
|||
|
||||
void UpdateCreepySounds()
|
||||
{
|
||||
if (levelnum == 20 || nFreeze)
|
||||
if (currentLevel->levelNumber == 20 || nFreeze)
|
||||
return;
|
||||
spritetype* pSprite = &sprite[PlayerList[nLocalPlayer].nSprite];
|
||||
nCreepyTimer--;
|
||||
|
|
|
@ -26,6 +26,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
#include "aistuff.h"
|
||||
#include "menu.h"
|
||||
#include "sound.h"
|
||||
#include "mapinfo.h"
|
||||
#include "v_video.h"
|
||||
#include "glbackend/glbackend.h"
|
||||
#include <string.h>
|
||||
|
@ -433,7 +434,7 @@ void DrawView(int smoothRatio, bool sceneonly)
|
|||
if (bSubTitles)
|
||||
{
|
||||
subtitleOverlay.Start(totalclock);
|
||||
if (levelnum == 1)
|
||||
if (currentLevel->levelNumber == 1)
|
||||
subtitleOverlay.ReadyCinemaText(1);
|
||||
else
|
||||
subtitleOverlay.ReadyCinemaText(5);
|
||||
|
|
Loading…
Reference in a new issue