- handle all level access and indexing through the mapinfo data.

No more level numbers will be stored in the game code.
This commit is contained in:
Christoph Oelckers 2020-08-16 14:39:18 +02:00
parent 9700b8435b
commit 532b11467f
20 changed files with 98 additions and 436 deletions

View file

@ -84,7 +84,7 @@ void Logo(const CompletionFunc& completion)
};
static const int logoframetimes[] = { 360, 8, 128 };
if (!AutoNet && !userConfig.nologo)
if (!userConfig.nologo)
{
JobDesc jobs[3];
int job = 0;

View file

@ -432,7 +432,6 @@ PreCacheActor(void)
void DoTheCache(void)
{
extern char CacheLastLevel[32],LevelName[20];
int i, cnt=0;
PreCacheActor();
@ -449,7 +448,6 @@ void DoTheCache(void)
}
memset(gotpic,0,sizeof(gotpic));
strcpy(CacheLastLevel, LevelName);
}
void

View file

@ -79,16 +79,18 @@ bool RoomCheat(cheatseq_t* c)
bool NextCheat(cheatseq_t* c)
{
if (!checkCheat(c)) return false;
Level++;
ExitLevel = TRUE;
if (!currentLevel) return true;
NextLevel = FindMapByLevelNum(currentLevel->levelNumber + 1);
if (NextLevel) ExitLevel = TRUE;
return true;
}
bool PrevCheat(cheatseq_t* c)
{
if (!checkCheat(c)) return false;
Level--;
ExitLevel = TRUE;
if (!currentLevel) return true;
NextLevel = FindMapByLevelNum(currentLevel->levelNumber - 1);
if (NextLevel) ExitLevel = TRUE;
return true;
}
@ -207,18 +209,11 @@ bool WarpCheat(cheatseq_t* c)
int level_num;
level_num = atol((char*)c->Args);
//int episode_num;
//DSPRINTF(ds,"ep %d, lev %d",episode_num, level_num);
//MONO_PRINT(ds);
auto maprec = FindMapByLevelNum(level_num);
if (!maprec) return false;
if (!pp) return true;
if (!SW_SHAREWARE)
{
if (level_num > 28 || level_num < 1)
return false;
}
else
if (SW_SHAREWARE)
{
if (level_num > 4 || level_num < 1)
return false;
@ -227,10 +222,10 @@ bool WarpCheat(cheatseq_t* c)
return true;
Level = level_num;
NextLevel = maprec;
ExitLevel = TRUE;
sprintf(ds, "%s %1d", GStrings("TXT_ENTERING"), Level);
sprintf(ds, "%s %s", GStrings("TXT_ENTERING"), maprec->DisplayName());
PutStringInfo(pp, ds);
return true;
}

View file

@ -37,7 +37,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "keydef.h"
#include "gamecontrol.h"
#include "gamedefs.h"
#include "network.h"
#include "misc.h"
#include "version.h"
@ -198,10 +197,11 @@ void GameInterface::StartGame(FNewGameStartup& gs)
ready2send = 0;
if (gs.Episode >= 1)
Level = 5;
NextLevel = FindMapByLevelNum(5);
else
Level = 1;
NextLevel = FindMapByLevelNum(1);
if (!NextLevel) return;
ExitLevel = TRUE;
NewGame = TRUE;
CameraTestMode = FALSE;

View file

@ -55,8 +55,8 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms
#define DIST_NORMAL 0 // Just play sound normaly
#define DIST_MAXNORMAL 16384 // This is max distance constant for normal sounds
// This is the limiting constant in Sound_Dist function.
#define DIST_WIDE 65536 // Half Level at full volume before sound begins to fade.
#define DIST_LEVELWIDE 131072 // Full Level
#define DIST_WIDE 65536 // Half level at full volume before sound begins to fade.
#define DIST_LEVELWIDE 131072 // Full level
// VOC Flag definitions
#define VF_NORMAL 0

View file

@ -53,7 +53,6 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms
#include "menus.h"
#include "gamecontrol.h"
#include "gamedefs.h"
#include "misc.h"
@ -108,7 +107,6 @@ int Follow_posx=0,Follow_posy=0;
SWBOOL NoMeters = FALSE;
SWBOOL GraphicsMode = FALSE;
char CacheLastLevel[32] = "";
char PlayerNameArg[32] = "";
SWBOOL CleanExit = FALSE;
SWBOOL FinishAnim = 0;
@ -149,8 +147,6 @@ short Skill = 2;
short BetaVersion = 900;
short TotalKillable;
AUTO_NET Auto;
SWBOOL AutoNet = FALSE;
SWBOOL HasAutoColor = FALSE;
uint8_t AutoColor;
@ -158,7 +154,6 @@ const GAME_SET gs_defaults =
{
// Network game settings
0, // GameType
0, // Level
0, // Monsters
FALSE, // HurtTeammate
TRUE, // SpawnMarkers Markers
@ -188,7 +183,7 @@ uint8_t FakeMultiNumPlayers;
int totalsynctics;
short Level = 0;
MapRecord* NextLevel = nullptr;
SWBOOL ExitLevel = FALSE;
int OrigCommPlayers=0;
extern uint8_t CommPlayers;
@ -213,7 +208,6 @@ SWBOOL InGame = FALSE;
SWBOOL CommandSetup = FALSE;
char buffer[80], ch;
char LevelName[20];
uint8_t DebugPrintColor = 255;
@ -300,17 +294,17 @@ void TerminateGame(void)
throw CExitEvent(3);
}
bool LoadLevel(const char *filename)
bool LoadLevel(MapRecord *maprec)
{
int16_t ang;
if (engineLoadBoard(filename, SW_SHAREWARE ? 1 : 0, (vec3_t *)&Player[0], &ang, &Player[0].cursectnum) == -1)
if (engineLoadBoard(maprec->fileName, SW_SHAREWARE ? 1 : 0, (vec3_t *)&Player[0], &ang, &Player[0].cursectnum) == -1)
{
Printf("Level not found: %s", filename);
Printf("Map not found: %s", maprec->fileName.GetChars());
return false;
}
currentLevel = &mapList[Level];
}
currentLevel = maprec;
SECRET_SetMapName(currentLevel->DisplayName(), currentLevel->name);
STAT_NewLevel(currentLevel->labelName);
STAT_NewLevel(currentLevel->fileName);
Player[0].q16ang = fix16_from_int(ang);
return true;
}
@ -331,24 +325,6 @@ void MultiSharewareCheck(void)
int TotalMemory = 0;
int ActualHeap = 0;
void InitAutoNet(void)
{
if (!AutoNet)
return;
gs.NetGameType = Auto.Rules;
gs.NetLevel = Auto.Level;
gs.NetMonsters = Auto.Enemy;
gs.NetSpawnMarkers = Auto.Markers;
gs.NetTeamPlay = Auto.Team;
gs.NetHurtTeammate = Auto.HurtTeam;
gs.NetKillLimit = Auto.Kill;
gs.NetTimeLimit = Auto.Time;
gs.NetColor = Auto.Color;
gs.NetNuke = Auto.Nuke;
}
static int firstnet = 0; // JBF
void SW_InitMultiPsky(void)
@ -366,12 +342,6 @@ bool InitGame()
int i;
engineInit();
InitAutoNet();
{
auto pal = fileSystem.LoadFile("3drealms.pal", 0);
if (pal.Size() >= 768)
@ -439,10 +409,6 @@ bool InitGame()
videoInit();
if (!LoadLevel("$dozer.map")) return false;
SetupPreCache();
DoTheCache();
GraphicsMode = TRUE;
InitFX(); // JBF: do it down here so we get a hold of the window handle
@ -450,8 +416,6 @@ bool InitGame()
}
short SongLevelNum;
FString ThemeSongs[6];
int ThemeTrack[6];
@ -540,32 +504,25 @@ InitLevel(void)
Mus_Stop();
InitLevelGlobals2();
auto maprec = NextLevel;
NextLevel = nullptr;
if (!maprec)
{
if (Level < 0)
Level = 0;
if (Level > MAX_LEVELS)
Level = 1;
strcpy(LevelName, mapList[Level].fileName);
NewGame = false;
return;
}
InitLevelGlobals2();
if (NewGame)
InitNewGame();
if (!LoadLevel(LevelName))
if (!LoadLevel(maprec))
{
NewGame = false;
return;
}
STAT_NewLevel(LevelName);
if (Bstrcasecmp(CacheLastLevel, LevelName) != 0)
// clears gotpic and does some bit setting
SetupPreCache();
else
memset(gotpic,0,sizeof(gotpic));
SetupPreCache();
if (sector[0].extra != -1)
{
@ -610,8 +567,6 @@ InitLevel(void)
PostSetupSectorObject();
SetupMirrorTiles();
initlava();
SongLevelNum = Level;
// reset NewGame
NewGame = FALSE;
@ -844,7 +799,6 @@ void MenuLevel(void)
if (ExitLevel)
{
// Quiting Level
ExitLevel = FALSE;
break;
}
@ -886,27 +840,16 @@ void EndGameSequence(void)
ExitLevel = FALSE;
QuitFlag = FALSE;
AutoNet = FALSE;
//if (FinishAnim == ANIM_ZILLA)
// CreditsLevel();
ExitLevel = FALSE;
QuitFlag = FALSE;
AutoNet = FALSE;
if (SW_SHAREWARE)
if (currentLevel->levelNumber != 4 && currentLevel->levelNumber != 20)
{
Level = 0;
}
else
{
if (Level == 4 || Level == 20)
{
Level=0;
}
else
Level++;
NextLevel = FindMapByLevelNum(currentLevel->levelNumber + 1);
}
}
@ -944,7 +887,6 @@ void StatScreen(PLAYERp mpp)
void GameIntro(void)
{
Level = 1;
Logo([](bool) { gamestate = GS_LEVEL; });
SyncScreenJob();
MenuLevel();
@ -1080,8 +1022,7 @@ void InitRunLevel(void)
Mus_Stop();
if (Bstrcasecmp(CacheLastLevel, LevelName) != 0)
DoTheCache();
DoTheCache();
// auto aim / auto run / etc
InitPlayerGameSettings();
@ -1092,15 +1033,9 @@ void InitRunLevel(void)
// Initialize Game part of network code (When ready2send != 0)
InitNetVars();
if (currentLevel)
{
if (Level == 0)
{
PlaySong(nullptr, currentLevel->music, 1 + RANDOM_RANGE(10));
}
else
{
PlaySong(currentLevel->labelName, currentLevel->music, currentLevel->cdSongId);
}
PlaySong(currentLevel->labelName, currentLevel->music, currentLevel->cdSongId);
}
InitPrediction(&Player[myconnectindex]);

View file

@ -48,6 +48,7 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms
#include "gamecvars.h"
#include "raze_sound.h"
#include "c_cvars.h"
#include "mapinfo.h"
EXTERN_CVAR(Bool, sw_ninjahack)
EXTERN_CVAR(Bool, sw_darts)
@ -885,23 +886,6 @@ extern void (*InitWeapon[MAX_WEAPONS]) (PLAYERp);
#define MAX_SW_PLAYERS_REG (8)
#define MAX_SW_PLAYERS (isShareware ? MAX_SW_PLAYERS_SW : MAX_SW_PLAYERS_REG)
typedef struct
{
char map_name[16];
char numplayers;
char Episode,Level;
char LevelSong[16];
} DEMO_HEADER, *DEMO_HEADERp;
typedef struct
{
int x,y,z;
} DEMO_START_POS, *DEMO_START_POSp;
#define MAX_LEVELS_REG 29
#define MAX_LEVELS_SW 4
#define MAX_LEVELS (isShareware ? MAX_LEVELS_SW : MAX_LEVELS_REG)
extern int ThemeTrack[6]; // w
extern FString ThemeSongs[6]; //
@ -2165,11 +2149,11 @@ void DoSoundSpotMatch(short match, short sound_num, short sound_type);
//
///////////////////////////////////////////////////////////////////////////////////////////
extern SWBOOL ExitLevel;
extern SWBOOL ExitLevel, FinishedLevel;
extern SWBOOL Warping;
extern uint8_t CommPlayers;
extern SWBOOL CommEnabled;
extern short Level;
extern MapRecord* NextLevel;
extern short Episode;
extern int LastFrameTics;

View file

@ -1,191 +0,0 @@
//-------------------------------------------------------------------------
/*
Copyright (C) 1997, 2005 - 3D Realms Entertainment
This file is part of Shadow Warrior version 1.2
Shadow Warrior is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
Original Source: 1997 - Frank Maddin and Jim Norwood
Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms
*/
//-------------------------------------------------------------------------
//****************************************************************************
//
// gamedefs.h
//
// common defines between the game and the setup program
//
//****************************************************************************
#ifndef gamedefs_public_
#define gamedefs_public_
//****************************************************************************
//
// DEFINES
//
//****************************************************************************
//#define SHARE 1
//
// Setup program defines
//
// Max number of players
//#ifdef SHARE
//#define MAXPLAYERS 4
//#else
//#define MAXPLAYERS 8
//#endif
// max path+track length for waveform music files
#define MAXWAVEFORMTRACKLENGTH 256
//
// modem string defines
//
#define MAXMODEMSTRING 50
// MACRO defines
#define MAXMACROS 10
#define MAXMACROLENGTH 34
// Phone list defines
#define PHONENUMBERLENGTH 28
#define PHONENAMELENGTH 16
#define MAXPHONEENTRIES 16
// length of program functions
#define MAXFUNCTIONLENGTH 30
// length of axis functions
#define MAXAXISFUNCTIONLENGTH 30
// Max Player Name length
#define MAXPLAYERNAMELENGTH 11
// Max RTS Name length
#define MAXRTSNAMELENGTH 15
// Max User Level Name length
#define MAXUSERLEVELNAMELENGTH 15
// Max RTS Path length
#define MAXRTSPATHLENGTH 48
// Max User Level Path length
#define MAXUSERLEVELPATHLENGTH 48
// Number of Mouse Axes
#ifdef __FLAT__
#define CONTROLSHIFT 0
#else
#define CONTROLSHIFT 4
#endif
// MIN/MAX scale value for controller scales
#define MAXCONTROLSCALEVALUE (1<<(18-CONTROLSHIFT))
// DEFAULT scale value for controller scales
#define DEFAULTCONTROLSCALEVALUE (1<<(16-CONTROLSHIFT))
// base value for controller scales
#define BASECONTROLSCALEVALUE (1<<(16-CONTROLSHIFT))
// MAX mouse sensitivity scale
#define MAXMOUSESENSITIVITY (1<<(17-CONTROLSHIFT))
// mouse sensitivity base
#define MOUSECONTROLBASE ((1<<(15-CONTROLSHIFT))-1)
enum
{
gametype_network=3,
gametype_serial=1,
gametype_modem=2
};
enum
{
connecttype_dialing=0,
connecttype_answer=1,
connecttype_alreadyconnected=2
};
enum
{
screenbuffer_320x200,
screenbuffer_640x400,
screenbuffer_640x480,
screenbuffer_800x600,
screenbuffer_1024x768,
screenbuffer_1280x1024,
screenbuffer_1600x1200
};
enum
{
vesa_320x200,
vesa_360x200,
vesa_320x240,
vesa_360x240,
vesa_320x400,
vesa_360x400,
vesa_640x350,
vesa_640x400,
vesa_640x480,
vesa_800x600,
vesa_1024x768,
vesa_1280x1024,
vesa_1600x1200
};
enum
{
screenmode_chained,
screenmode_vesa,
screenmode_buffered,
screenmode_tseng,
screenmode_paradise,
screenmode_s3,
screenmode_crystal,
screenmode_redblue,
};
#endif

View file

@ -42,7 +42,6 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms
#include "keydef.h"
#include "gamecontrol.h"
#include "gamedefs.h"
#include "network.h"
#include "version.h"
#include "network.h"

View file

@ -29,27 +29,6 @@ BEGIN_SW_NS
#define SYNC_TEST 0
#define MAXSYNCBYTES 16
#pragma pack(push,1)
typedef struct
{
uint8_t PacketType; // first byte is always packet type
uint8_t FirstPlayerIndex;
SWBOOL AutoAim;
uint8_t Level;
uint8_t Episode;
int8_t Skill;
uint8_t GameType;
SWBOOL HurtTeammate;
SWBOOL SpawnMarkers;
SWBOOL TeamPlay;
uint8_t KillLimit;
uint8_t TimeLimit;
SWBOOL Nuke;
} PACKET_NEW_GAME,*PACKET_NEW_GAMEp;
#pragma pack(pop)
extern uint8_t syncstat[MAXSYNCBYTES];
extern SWBOOL PredictionOn;
extern PLAYER PredictPlayer;
@ -93,23 +72,6 @@ typedef struct
extern gNET gNet;
typedef struct
{
int Rules,
Level,
Enemy,
Markers,
Team,
HurtTeam,
Kill,
Time,
Color,
Nuke;
} AUTO_NET, *AUTO_NETp;
extern AUTO_NET Auto;
extern SWBOOL AutoNet;
void UpdateInputs(void);
void InitNetVars(void);
void InitTimingVars(void);

View file

@ -65,14 +65,12 @@ static int osdcmd_map(CCmdFuncPtr parm)
}
// Check if the map is already defined.
for (int i = 0; i < 32; i++)
auto maprec = FindMapByName(mapname);
if (maprec)
{
if (mapList[i].labelName.CompareNoCase(mapname) == 0)
{
FStringf cheatcode("activatecheat swtrek%02d", i);
C_DoCommand(cheatcode);
return CCMD_OK;
}
// This needs to be done better...
FStringf cheatcode("activatecheat swtrek%02d", maprec->levelNumber);
C_DoCommand(cheatcode);
}
return CCMD_OK;
}

View file

@ -7573,9 +7573,11 @@ void MultiPlayLimits(void)
{
gNet.TimeLimitClock = gNet.TimeLimit;
// do not increment if level is 23 thru 28
if (Level <= 22)
Level++;
NextLevel = nullptr;
// do not increment if level is 23 thru 28 (should be done smarter.)
if (currentLevel->levelNumber <= 22)
NextLevel = FindMapByLevelNum(currentLevel->levelNumber + 1);
if (!NextLevel) NextLevel = currentLevel;
ExitLevel = TRUE;
FinishedLevel = TRUE;

View file

@ -72,7 +72,6 @@ extern char SaveGameDescr[10][80];
extern int PlayClock;
extern short Bunny_Count;
extern SWBOOL NewGame;
extern char CacheLastLevel[];
extern int GodMode;
extern int FinishTimer;
extern SWBOOL FinishAnim;
@ -88,7 +87,6 @@ extern short BossSpriteNum[3];
#define ANIM_SAVE 1
extern SW_PACKET loc;
extern char LevelName[20];
extern STATE s_NotRestored[];
OrgTileListP otlist[] = {&orgwalllist, &orgwalloverlist, &orgsectorceilinglist, &orgsectorfloorlist};
@ -232,7 +230,6 @@ bool GameInterface::SaveGame(FSaveGameNode *sv)
MWRITE(&GameVersion,sizeof(GameVersion),1,fil);
MWRITE(&Level,sizeof(Level),1,fil);
MWRITE(&Skill,sizeof(Skill),1,fil);
MWRITE(&numplayers,sizeof(numplayers),1,fil);
@ -479,7 +476,6 @@ bool GameInterface::SaveGame(FSaveGameNode *sv)
//MWRITE(&oloc,sizeof(oloc),1,fil);
//MWRITE(&fsync,sizeof(fsync),1,fil);
MWRITE(LevelName,sizeof(LevelName),1,fil);
MWRITE(&screenpeek,sizeof(screenpeek),1,fil);
MWRITE(&totalsynctics,sizeof(totalsynctics),1,fil);
@ -704,7 +700,6 @@ bool GameInterface::LoadGame(FSaveGameNode* sv)
return false;
}
MREAD(&Level,sizeof(Level),1,fil);
MREAD(&Skill,sizeof(Skill),1,fil);
MREAD(&numplayers, sizeof(numplayers),1,fil);
@ -890,7 +885,6 @@ bool GameInterface::LoadGame(FSaveGameNode* sv)
MREAD(&loc,sizeof(loc),1,fil);
MREAD(LevelName,sizeof(LevelName),1,fil);
MREAD(&screenpeek,sizeof(screenpeek),1,fil);
MREAD(&totalsynctics,sizeof(totalsynctics),1,fil); // same as kens lockclock
@ -1069,11 +1063,8 @@ bool GameInterface::LoadGame(FSaveGameNode* sv)
}
#endif
if (Bstrcasecmp(CacheLastLevel, LevelName) != 0)
{
SetupPreCache();
DoTheCache();
}
SetupPreCache();
DoTheCache();
// what is this for? don't remember
totalclock = totalsynctics;

View file

@ -459,7 +459,6 @@ void LoadCustomInfoFromScript(const char *filename)
scriptfile *script;
char *token;
char *braceend;
int curmap = -1;
script = scriptfile_fromfile(filename);
if (!script) return;
@ -483,6 +482,7 @@ void LoadCustomInfoFromScript(const char *filename)
scriptfile_addsymbolvalue(weaponmap[i].sym, 1+i);
}
MapRecord* curMap = nullptr;
while ((token = scriptfile_gettoken(script)))
{
switch (cm_transtok(token, cm_tokens, cm_numtokens))
@ -490,18 +490,15 @@ void LoadCustomInfoFromScript(const char *filename)
case CM_MAP:
{
char *mapnumptr;
if (scriptfile_getnumber(script, &curmap)) break;
int mapno;
if (scriptfile_getnumber(script, &mapno)) break;
mapnumptr = script->ltextptr;
if (scriptfile_getbraces(script, &braceend)) break;
// first map entry may not be used, max. amount needs investigation
if (curmap < 1 || curmap > MAX_LEVELS_REG)
curMap = FindMapByLevelNum(mapno);
if (!curMap)
{
Printf("Error: map number %d not in range 1-%d on line %s:%d\n",
curmap, MAX_LEVELS_REG, script->filename,
scriptfile_getlinum(script,mapnumptr));
script->textptr = braceend;
break;
curMap = AllocateMap();
curMap->levelNumber = mapno;
}
while (script->textptr < braceend)
@ -515,7 +512,7 @@ void LoadCustomInfoFromScript(const char *filename)
char *t;
if (scriptfile_getstring(script, &t)) break;
mapList[curmap].SetFileName(t);
curMap->SetFileName(t);
break;
}
case CM_SONG:
@ -523,7 +520,7 @@ void LoadCustomInfoFromScript(const char *filename)
char *t;
if (scriptfile_getstring(script, &t)) break;
mapList[curmap].music = t;
curMap->music = t;
break;
}
case CM_TITLE:
@ -531,7 +528,7 @@ void LoadCustomInfoFromScript(const char *filename)
char *t;
if (scriptfile_getstring(script, &t)) break;
mapList[curmap].SetName(t);
curMap->SetName(t);
break;
}
case CM_BESTTIME:
@ -539,7 +536,7 @@ void LoadCustomInfoFromScript(const char *filename)
int n;
if (scriptfile_getnumber(script, &n)) break;
mapList[curmap].designerTime = n;
curMap->designerTime = n;
break;
}
case CM_PARTIME:
@ -547,14 +544,14 @@ void LoadCustomInfoFromScript(const char *filename)
int n;
if (scriptfile_getnumber(script, &n)) break;
mapList[curmap].parTime = n;
curMap->parTime = n;
break;
}
case CM_CDATRACK:
{
int n;
if (scriptfile_getnumber(script, &n)) break;
mapList[curmap].cdSongId = n;
curMap->cdSongId = n;
break;
}
default:
@ -570,14 +567,15 @@ void LoadCustomInfoFromScript(const char *filename)
case CM_EPISODE:
{
char *epnumptr;
if (scriptfile_getnumber(script, &curmap)) break;
int curep;
if (scriptfile_getnumber(script, &curep)) break;
epnumptr = script->ltextptr;
if (scriptfile_getbraces(script, &braceend)) break;
if ((unsigned)--curmap >= 2u)
if ((unsigned)--curep >= 2u)
{
Printf("Error: episode number %d not in range 1-2 on line %s:%d\n",
curmap, script->filename,
curep, script->filename,
scriptfile_getlinum(script,epnumptr));
script->textptr = braceend;
break;
@ -593,14 +591,14 @@ void LoadCustomInfoFromScript(const char *filename)
{
char *t;
if (scriptfile_getstring(script, &t)) break;
gVolumeNames[curmap] = t;
gVolumeNames[curep] = t;
break;
}
case CM_SUBTITLE:
{
char *t;
if (scriptfile_getstring(script, &t)) break;
gVolumeSubtitles[curmap] = t;
gVolumeSubtitles[curep] = t;
break;
}
default:
@ -615,15 +613,16 @@ void LoadCustomInfoFromScript(const char *filename)
case CM_SKILL:
{
int curskill;
char *epnumptr;
if (scriptfile_getnumber(script, &curmap)) break;
if (scriptfile_getnumber(script, &curskill)) break;
epnumptr = script->ltextptr;
if (scriptfile_getbraces(script, &braceend)) break;
if ((unsigned)--curmap >= 4u)
if ((unsigned)--curskill >= 4u)
{
Printf("Error: skill number %d not in range 1-4 on line %s:%d\n",
curmap, script->filename,
curskill, script->filename,
scriptfile_getlinum(script,epnumptr));
script->textptr = braceend;
break;
@ -640,7 +639,7 @@ void LoadCustomInfoFromScript(const char *filename)
char *t;
if (scriptfile_getstring(script, &t)) break;
gSkillNames[curmap] = t;
gSkillNames[curskill] = t;
break;
}
default:
@ -841,13 +840,14 @@ void LoadCustomInfoFromScript(const char *filename)
char *epnumptr;
char *name = NULL;
int trak = -1;
int curtheme;
if (scriptfile_getnumber(script, &curmap)) break; epnumptr = script->ltextptr;
if (scriptfile_getnumber(script, &curtheme)) break; epnumptr = script->ltextptr;
if (scriptfile_getbraces(script, &braceend)) break;
if ((unsigned)--curmap >= 6u)
if ((unsigned)--curtheme >= 6u)
{
Printf("Error: theme number %d not in range 1-6 on line %s:%d\n",
curmap, script->filename,
curtheme, script->filename,
scriptfile_getlinum(script,epnumptr));
script->textptr = braceend;
break;
@ -873,11 +873,11 @@ void LoadCustomInfoFromScript(const char *filename)
}
if (name)
{
ThemeSongs[curmap] = name;
ThemeSongs[curtheme] = name;
}
if (trak >= 2)
{
ThemeTrack[curmap] = trak;
ThemeTrack[curtheme] = trak;
}
break;
}

View file

@ -1902,17 +1902,14 @@ OperateSprite(short SpriteNum, short player_is_operating)
case TAG_LEVEL_EXIT_SWITCH:
{
extern short Level;
extern SWBOOL ExitLevel, FinishedLevel;
AnimateSwitch(sp, -1);
PlaySound(DIGI_BIGSWITCH, sp, v3df_none);
if (sp->hitag)
Level = sp->hitag;
NextLevel = FindMapByLevelNum(sp->hitag);
else
Level++;
NextLevel = FindMapByLevelNum(currentLevel->levelNumber + 1);
ExitLevel = TRUE;
FinishedLevel = TRUE;
@ -2112,13 +2109,10 @@ OperateTripTrigger(PLAYERp pp)
// same tag for sector as for switch
case TAG_LEVEL_EXIT_SWITCH:
{
extern short Level;
extern SWBOOL ExitLevel, FinishedLevel;
if (sectp->hitag)
Level = sectp->hitag;
NextLevel = FindMapByLevelNum(sectp->hitag);
else
Level++;
NextLevel = FindMapByLevelNum(currentLevel->levelNumber + 1);
ExitLevel = TRUE;
FinishedLevel = TRUE;
break;

View file

@ -24,7 +24,6 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms
*/
//-------------------------------------------------------------------------
#include "mytypes.h"
#include "gamedefs.h"
// Only ad to the end. These currently have to be in this order because of the
// way they are initilized.
BEGIN_SW_NS
@ -33,7 +32,6 @@ typedef struct
{
// Net Options from Menus
uint8_t NetGameType; // 0=DeathMatch [spawn], 1=Cooperative 2=DeathMatch [no spawn]
uint8_t NetLevel; // 1-28
uint8_t NetMonsters; // Cycle skill levels
SWBOOL NetHurtTeammate; // Allow friendly kills
SWBOOL NetSpawnMarkers; // Respawn markers on/off

View file

@ -30,7 +30,6 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms
#include "names2.h"
#include "mytypes.h"
#include "gamedefs.h"
#include "panel.h"
#include "game.h"
@ -934,8 +933,6 @@ int PlayerYellVocs[] =
//
//==========================================================================
extern short Level;
SWBOOL PlaySong(const char* mapname, const char* song_file_name, int cdaudio_track, bool isThemeTrack) //(nullptr, nullptr, -1, false) starts the normal level music.
{
// Play CD audio if enabled.

View file

@ -1108,9 +1108,9 @@ ActorTestSpawn(SPRITEp sp)
sp->picnum == PRUNEGIRL_R0 ||
sp->picnum == SAILORGIRL_R0) && (g_gameType & GAMEFLAG_ADDON)) return TRUE;
// spawn Bouncing Betty (mine) in TD Level 09 Warehouse
// spawn Bouncing Betty (mine) in TD map 09 Warehouse
#if 0 // needs to be done smarter.
if (sp->picnum == 817 && swGetAddon() == 2 && Level == 9)
if (sp->picnum == 817 && swGetAddon() == 2 && currentLevel->levelNumber == 9)
return TRUE;
#endif

View file

@ -824,17 +824,17 @@ BossHealthMeter(void)
if (NoMeters) return;
if (Level != 20 && Level != 4 && Level != 11 && Level != 5) return;
if (currentLevel->levelNumber != 20 && currentLevel->levelNumber != 4 && currentLevel->levelNumber != 11 && currentLevel->levelNumber != 5) return;
// Don't draw bar for other players
if (pp != Player+myconnectindex)
return;
// all enemys
if ((Level == 20 && (BossSpriteNum[0] == -1 || BossSpriteNum[1] == -1 || BossSpriteNum[2] == -1)) ||
(Level == 4 && BossSpriteNum[0] == -1) ||
(Level == 5 && BossSpriteNum[0] == -1) ||
(Level == 11 && BossSpriteNum[1] == -1))
if ((currentLevel->levelNumber == 20 && (BossSpriteNum[0] == -1 || BossSpriteNum[1] == -1 || BossSpriteNum[2] == -1)) ||
(currentLevel->levelNumber == 4 && BossSpriteNum[0] == -1) ||
(currentLevel->levelNumber == 5 && BossSpriteNum[0] == -1) ||
(currentLevel->levelNumber == 11 && BossSpriteNum[1] == -1))
{
TRAVERSE_SPRITE_STAT(headspritestat[STAT_ENEMY], i, nexti)
{
@ -861,7 +861,7 @@ BossHealthMeter(void)
bosswasseen = serpwasseen|sumowasseen|zillawasseen;
// Only show the meter when you can see the boss
if ((Level == 20 && (!serpwasseen || !sumowasseen || !zillawasseen)) || !bosswasseen)
if ((currentLevel->levelNumber == 20 && (!serpwasseen || !sumowasseen || !zillawasseen)) || !bosswasseen)
{
for (i=0; i<3; i++)
{
@ -962,7 +962,7 @@ BossHealthMeter(void)
else
y = 30;
if (Level == 20 && numplayers >= 2)
if (currentLevel->levelNumber == 20 && numplayers >= 2)
{
if (u->ID == SUMO_RUN_R0 && sumowasseen) y += 10;
else if (u->ID == ZILLA_RUN_R0 && zillawasseen) y += 20;

View file

@ -5336,7 +5336,7 @@ ActorHealth(short SpriteNum, short amt)
u->Health += amt;
if (u->ID == SERP_RUN_R0 && sp->pal != 16 && Level == 4)
if (u->ID == SERP_RUN_R0 && sp->pal != 16 && currentLevel->levelNumber == 4)
{
if (u->Health < u->MaxHealth/2)
{
@ -5347,7 +5347,7 @@ ActorHealth(short SpriteNum, short amt)
}
}
if (u->ID == SUMO_RUN_R0 && Level == 11)
if (u->ID == SUMO_RUN_R0 && currentLevel->levelNumber == 11)
{
if (u->Health <= 0)
{
@ -5356,7 +5356,7 @@ ActorHealth(short SpriteNum, short amt)
}
}
if (u->ID == ZILLA_RUN_R0 && Level == 20)
if (u->ID == ZILLA_RUN_R0 && currentLevel->levelNumber == 20)
{
if (u->Health <= 0)
//if (u->Health < u->MaxHealth)