mirror of
https://github.com/ZDoom/raze-gles.git
synced 2025-01-13 19:40:43 +00:00
- added MAPINFO parser, based on GZDoom's.
This isn't hooked up yet, but all necessary structures and fields have been added so that selected pieces can be tested.
This commit is contained in:
parent
51aeb6dd39
commit
f732d4ec64
19 changed files with 1337 additions and 56 deletions
|
@ -1048,6 +1048,7 @@ set (PCH_SOURCES
|
|||
core/gamehud.cpp
|
||||
core/gamefuncs.cpp
|
||||
core/gameinput.cpp
|
||||
core/g_mapinfo.cpp
|
||||
core/interpolate.cpp
|
||||
core/inputstate.cpp
|
||||
core/maphack.cpp
|
||||
|
|
|
@ -294,7 +294,7 @@ static MapRecord* levelwarp_common(FCommandLine& argv, const char *cmdname, cons
|
|||
Printf(PRINT_BOLD, "Invalid level! Numbers must be > 0\n");
|
||||
return nullptr;
|
||||
}
|
||||
auto map = FindMapByLevelNum(numparm == 1 ? m : levelnum(e - 1, m - 1));
|
||||
auto map = FindMapByLevelNum(numparm == 1 ? m : makelevelnum(e - 1, m - 1));
|
||||
if (!map)
|
||||
{
|
||||
if (numparm == 2) Printf(PRINT_BOLD, "Level E%s L%s not found!\n", argv[1], argv[2]);
|
||||
|
|
1042
source/core/g_mapinfo.cpp
Normal file
1042
source/core/g_mapinfo.cpp
Normal file
File diff suppressed because it is too large
Load diff
108
source/core/g_mapinfo.h
Normal file
108
source/core/g_mapinfo.h
Normal file
|
@ -0,0 +1,108 @@
|
|||
/*
|
||||
** g_level.h
|
||||
**
|
||||
**---------------------------------------------------------------------------
|
||||
** Copyright 1998-2006 Randy Heit
|
||||
** All rights reserved.
|
||||
**
|
||||
** Redistribution and use in source and binary forms, with or without
|
||||
** modification, are permitted provided that the following conditions
|
||||
** are met:
|
||||
**
|
||||
** 1. Redistributions of source code must retain the above copyright
|
||||
** notice, this list of conditions and the following disclaimer.
|
||||
** 2. Redistributions in binary form must reproduce the above copyright
|
||||
** notice, this list of conditions and the following disclaimer in the
|
||||
** documentation and/or other materials provided with the distribution.
|
||||
** 3. The name of the author may not be used to endorse or promote products
|
||||
** derived from this software without specific prior written permission.
|
||||
**
|
||||
** THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
** IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
** OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
** IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
** NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
** THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
**---------------------------------------------------------------------------
|
||||
**
|
||||
*/
|
||||
|
||||
#ifndef __G_LEVEL_H__
|
||||
#define __G_LEVEL_H__
|
||||
|
||||
#include "autosegs.h"
|
||||
#include "vectors.h"
|
||||
#include "sc_man.h"
|
||||
#include "file_zip.h"
|
||||
|
||||
struct FMapInfoParser
|
||||
{
|
||||
FScanner sc;
|
||||
bool Internal;
|
||||
MapRecord* defaultinfoptr;
|
||||
|
||||
FMapInfoParser(bool internal = false)
|
||||
{
|
||||
Internal = internal;
|
||||
}
|
||||
|
||||
bool CheckLegacyMapDefinition(FString& mapname);
|
||||
bool ParseLookupName(FString &dest);
|
||||
void ParseMusic(FString &name, int &order);
|
||||
//void ParseLumpOrTextureName(char *name);
|
||||
void ParseLumpOrTextureName(FString &name);
|
||||
|
||||
void ParseCutscene(CutsceneDef& cdef);
|
||||
void ParseCluster();
|
||||
void ParseMapName(FString &mapname);
|
||||
MapRecord *ParseMapHeader(MapRecord &defaultinfo);
|
||||
void ParseMapDefinition(MapRecord &leveldef);
|
||||
void ParseEpisodeInfo ();
|
||||
void ParseSkill ();
|
||||
void ParseMapInfo (int lump, MapRecord &gamedefaults, MapRecord &defaultinfo);
|
||||
|
||||
void ParseOpenBrace();
|
||||
bool ParseCloseBrace();
|
||||
bool CheckAssign();
|
||||
void ParseAssign();
|
||||
void MustParseAssign();
|
||||
void ParseComma();
|
||||
bool CheckNumber();
|
||||
bool CheckFloat();
|
||||
void SkipToNext();
|
||||
void CheckEndOfFile(const char *block);
|
||||
};
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#pragma section(SECTION_YREG,read)
|
||||
#define MSVC_YSEG __declspec(allocate(SECTION_YREG))
|
||||
#define GCC_YSEG
|
||||
#else
|
||||
#define MSVC_YSEG
|
||||
#define GCC_YSEG __attribute__((section(SECTION_YREG))) __attribute__((used))
|
||||
#endif
|
||||
|
||||
#define DEFINE_MAP_OPTION(name, old) \
|
||||
static void MapOptHandler_##name(FMapInfoParser &parse, MapRecord *info); \
|
||||
static FMapOptInfo MapOpt_##name = \
|
||||
{ #name, MapOptHandler_##name, old }; \
|
||||
MSVC_YSEG FMapOptInfo *mapopt_##name GCC_YSEG = &MapOpt_##name; \
|
||||
static void MapOptHandler_##name(FMapInfoParser &parse, MapRecord *info)
|
||||
|
||||
|
||||
struct FMapOptInfo
|
||||
{
|
||||
const char *name;
|
||||
void (*handler) (FMapInfoParser &parse, MapRecord *levelinfo);
|
||||
bool old;
|
||||
};
|
||||
|
||||
|
||||
void G_ParseMapInfo();
|
||||
|
||||
|
||||
#endif //__G_LEVEL_H__
|
|
@ -608,7 +608,6 @@ void SetDefaultStrings()
|
|||
gSkillNames[2] = "$Come get Some";
|
||||
gSkillNames[3] = "$Damn I'm Good";
|
||||
}
|
||||
if (g_gameType & GAMEFLAG_RR) volumeList[0].flags |= EF_GOTONEXTVOLUME;
|
||||
// Blood hard codes its skill names, so we have to define them manually.
|
||||
if (isBlood())
|
||||
{
|
||||
|
@ -1518,7 +1517,7 @@ DEFINE_FIELD_X(MapRecord, MapRecord, cluster)
|
|||
DEFINE_FIELD_X(MapRecord, MapRecord, nextLevel)
|
||||
DEFINE_FIELD_X(MapRecord, MapRecord, nextSecret)
|
||||
//native readonly String messages[MAX_MESSAGES];
|
||||
DEFINE_FIELD_X(MapRecord, MapRecord, author)
|
||||
DEFINE_FIELD_X(MapRecord, MapRecord, Author)
|
||||
|
||||
DEFINE_FIELD_X(SummaryInfo, SummaryInfo, kills)
|
||||
DEFINE_FIELD_X(SummaryInfo, SummaryInfo, maxkills)
|
||||
|
|
|
@ -44,8 +44,10 @@ FString gSkillNames[MAXSKILLS];
|
|||
int gDefaultVolume = 0, gDefaultSkill = 1;
|
||||
|
||||
GlobalCutscenes globalCutscenes;
|
||||
TArray<ClusterDef> clusters;
|
||||
TArray<VolumeRecord> volumes;
|
||||
TArray<TPointer<MapRecord>> mapList; // must be allocated as pointers because it can whack the currentlLevel pointer if this was a flat array.
|
||||
VolumeRecord volumeList[MAXVOLUMES];
|
||||
static TArray<TPointer<MapRecord>> mapList;
|
||||
MapRecord *currentLevel; // level that is currently played.
|
||||
MapRecord* lastLevel; // Same here, for the last level.
|
||||
|
||||
|
@ -58,7 +60,7 @@ CCMD(listmaps)
|
|||
if (lump >= 0)
|
||||
{
|
||||
int rfnum = fileSystem.GetFileContainer(lump);
|
||||
Printf("%s - %s (%s)\n", map->fileName.GetChars(), map->DisplayName(), fileSystem.GetResourceFileName(rfnum));
|
||||
Printf("%s - %s (%s)\n", map->LabelName(), map->DisplayName(), fileSystem.GetResourceFileName(rfnum));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -67,6 +69,58 @@ CCMD(listmaps)
|
|||
}
|
||||
}
|
||||
|
||||
CCMD(mapinfo)
|
||||
{
|
||||
const char* mapname = nullptr;
|
||||
if (argv.argc() > 1) mapname = argv[1];
|
||||
|
||||
if (!mapname)
|
||||
{
|
||||
for (auto& vol : volumes)
|
||||
{
|
||||
Printf("Volume %d\n\tName = '%s'\n\tstartmap = '%s'\n}\n", vol.index, vol.name.GetChars(), vol.startmap.GetChars());
|
||||
}
|
||||
for (auto& clus : clusters)
|
||||
{
|
||||
if (clus.intro.isdefined() || clus.outro.isdefined())
|
||||
{
|
||||
Printf("Cluster %d\n\tName = '%s'\n", clus.index, clus.name.GetChars());
|
||||
if (clus.intro.function.IsNotEmpty()) Printf("\tIntro function = %d\n", clus.intro.function.GetChars());
|
||||
if (clus.intro.video.IsNotEmpty()) Printf("\tIntro video = %d\n", clus.intro.video.GetChars());
|
||||
if (clus.outro.function.IsNotEmpty()) Printf("\tOutro function = %d\n", clus.outro.function.GetChars());
|
||||
if (clus.outro.video.IsNotEmpty()) Printf("\tOutro video = %d\n", clus.outro.video.GetChars());
|
||||
Printf("}\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
for (auto& map : mapList)
|
||||
{
|
||||
if (mapname && map->labelName.CompareNoCase(mapname)) continue;
|
||||
int lump = fileSystem.FindFile(map->fileName);
|
||||
if (lump >= 0)
|
||||
{
|
||||
int rfnum = fileSystem.GetFileContainer(lump);
|
||||
Printf("%s - %s (%s)\n{\n", map->fileName.GetChars(), map->DisplayName(), fileSystem.GetResourceFileName(rfnum));
|
||||
Printf("\tlevel number = %d\n\tCluster = %d\n\tIndex = %d\n", map->levelNumber, map->cluster, map->mapindex);
|
||||
if (map->Author.IsNotEmpty()) Printf("\tAuthor = '%s'\n", map->Author.GetChars());
|
||||
if (map->NextMap.IsNotEmpty()) Printf("\tNext map = '%s'\n", map->NextMap.GetChars());
|
||||
if (map->NextSecret.IsNotEmpty()) Printf("\tNext secret map = '%s'\n", map->NextSecret.GetChars());
|
||||
if (map->music.IsNotEmpty()) Printf("\tMusic = '%s:%d'", map->music.GetChars(), map->musicorder);
|
||||
if (map->cdSongId > 0) Printf("\tCD track = %d\n", map->cdSongId);
|
||||
if (map->parTime) Printf("\tPar Time = %d\n", map->parTime);
|
||||
if (map->designerTime) Printf("\tPar Time = %d\n", map->designerTime);
|
||||
if (map->intro.function.IsNotEmpty()) Printf("\tIntro function = %d\n", map->intro.function.GetChars());
|
||||
if (map->intro.video.IsNotEmpty()) Printf("\tIntro video = %d\n", map->intro.video.GetChars());
|
||||
if (map->outro.function.IsNotEmpty()) Printf("\tOutro function = %d\n", map->outro.function.GetChars());
|
||||
if (map->outro.video.IsNotEmpty()) Printf("\tOutro video = %d\n", map->outro.video.GetChars());
|
||||
Printf("}\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
Printf("%s - %s (defined but does not exist)\n", map->fileName.GetChars(), map->DisplayName());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
MapRecord *FindMapByName(const char *nm)
|
||||
{
|
||||
|
@ -147,7 +201,7 @@ bool SetMusicForMap(const char* mapname, const char* music, bool namehack)
|
|||
if (numMatches != 4 || toupper(b1) != 'E' || toupper(b2) != 'L')
|
||||
return false;
|
||||
|
||||
index = FindMapByLevelNum(levelnum(ep - 1, lev - 1));
|
||||
index = FindMapByLevelNum(makelevelnum(ep - 1, lev - 1));
|
||||
|
||||
}
|
||||
if (index != nullptr)
|
||||
|
|
|
@ -3,6 +3,8 @@
|
|||
#include "gstrings.h"
|
||||
#include "cmdlib.h"
|
||||
#include "quotemgr.h"
|
||||
#include "palentry.h"
|
||||
#include "vectors.h"
|
||||
#ifdef GetMessage
|
||||
#undef GetMessage // Windows strikes...
|
||||
#endif
|
||||
|
@ -17,8 +19,24 @@ enum EMax
|
|||
|
||||
enum EVolFlags
|
||||
{
|
||||
EF_HIDEFROMSP = 1,
|
||||
EF_GOTONEXTVOLUME = 2, // for RR which continues the game in the next volume
|
||||
VF_HIDEFROMSP = 1,
|
||||
VF_OPTIONAL = 2,
|
||||
VF_SHAREWARELOCK = 4, // show in shareware but lock access.
|
||||
VF_NOSKILL = 8,
|
||||
};
|
||||
|
||||
enum EMapFlags
|
||||
{
|
||||
LEVEL_NOINTERMISSION = 1,
|
||||
LEVEL_SECRETEXITOVERRIDE = 2, // when given an explicit level number, override with secret exit in the map, mainly for compiling episodes out of single levels.
|
||||
LEVEL_CLEARINVENTORY = 4,
|
||||
LEVEL_CLEARWEAPONS = 8,
|
||||
};
|
||||
|
||||
enum EMapGameFlags
|
||||
{
|
||||
LEVEL_RR_HULKSPAWN = 1,
|
||||
LEVEL_RR_CLEARMOONSHINE = 2,
|
||||
};
|
||||
|
||||
// These get filled in by the map definition parsers of the front ends.
|
||||
|
@ -51,12 +69,16 @@ struct CutsceneDef
|
|||
{
|
||||
FString video;
|
||||
FString function;
|
||||
FString soundName;
|
||||
int soundID; // ResID not SoundID!
|
||||
int sound = 0;
|
||||
int framespersec = 0; // only relevant for ANM.
|
||||
bool transitiononly = false; // only play when transitioning between maps, but not when starting on a map or ending a game.
|
||||
|
||||
void Create(DObject* runner);
|
||||
bool Create(DObject* runner, MapRecord* map, bool transition);
|
||||
bool isdefined() { return video.IsNotEmpty() || function.IsNotEmpty(); }
|
||||
int GetSound();
|
||||
};
|
||||
|
||||
struct GlobalCutscenes
|
||||
|
@ -70,13 +92,28 @@ struct GlobalCutscenes
|
|||
FString SummaryScreen;
|
||||
};
|
||||
|
||||
struct VolumeRecord
|
||||
struct ClusterDef
|
||||
{
|
||||
FString name; // What gets displayed for this cluster. In Duke this is normally the corresponding volume name but does not have to be.
|
||||
CutsceneDef intro; // plays when entering this cluster
|
||||
CutsceneDef outro; // plays when leaving this cluster
|
||||
CutsceneDef gameover; // when defined, plays when the player dies in this cluster
|
||||
FString InterBackground;
|
||||
int index = -1;
|
||||
int flags = 0; // engine and common flags
|
||||
int gameflags = 0; // game specific flags.
|
||||
};
|
||||
|
||||
struct VolumeRecord // episodes
|
||||
{
|
||||
FString startmap;
|
||||
FString name;
|
||||
FString subtitle;
|
||||
int index = -1;
|
||||
CutsceneDef intro;
|
||||
CutsceneDef outro;
|
||||
int32_t flags = 0;
|
||||
int flags = 0;
|
||||
int shortcut = 0;
|
||||
};
|
||||
|
||||
struct MapRecord
|
||||
|
@ -87,19 +124,36 @@ struct MapRecord
|
|||
FString labelName;
|
||||
FString name;
|
||||
FString music;
|
||||
FString Author;
|
||||
FString NextMap;
|
||||
FString NextSecret;
|
||||
int cdSongId = -1;
|
||||
int musicorder = -1;
|
||||
|
||||
CutsceneDef intro;
|
||||
CutsceneDef outro;
|
||||
int cdSongId = -1;
|
||||
int flags = 0;
|
||||
int gameflags = 0;
|
||||
int levelNumber = -1;
|
||||
int mapindex = -1; // index in the episode. This only for finding the next map in the progression when nothing explicit is defined.
|
||||
int cluster = -1;
|
||||
|
||||
PalEntry fadeto = 0;
|
||||
int fogdensity = 0;
|
||||
int skyfog = 0;
|
||||
FString BorderTexture;
|
||||
FString InterBackground;
|
||||
TArray<FString> PrecacheTextures;
|
||||
FVector4 skyrotatevector;
|
||||
|
||||
// The rest is only used by Blood
|
||||
int nextLevel = -1;
|
||||
int nextSecret = -1;
|
||||
FString messages[MAX_MESSAGES];
|
||||
FString author;
|
||||
int8_t fog = -1, weather = -1; // Blood defines these but they aren't used.
|
||||
|
||||
// game specific stuff
|
||||
int rr_startsound = 0;
|
||||
|
||||
const char* LabelName() const
|
||||
{
|
||||
|
@ -133,8 +187,6 @@ struct MapRecord
|
|||
{
|
||||
messages[num] = msg;
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
|
||||
struct SummaryInfo
|
||||
|
@ -159,12 +211,37 @@ bool SetMusicForMap(const char* mapname, const char* music, bool namehack = fals
|
|||
MapRecord *FindMapByName(const char *nm);
|
||||
MapRecord *FindMapByLevelNum(int num);
|
||||
MapRecord* FindMapByClusterAndLevelNum(int clst, int num);
|
||||
inline MapRecord* FindMapByIndexOnly(int clst, int num) { return FindMapByClusterAndLevelNum(clst, num); }
|
||||
MapRecord *FindNextMap(MapRecord *thismap);
|
||||
MapRecord* SetupUserMap(const char* boardfilename, const char *defaultmusic = nullptr);
|
||||
MapRecord* AllocateMap();
|
||||
|
||||
inline VolumeRecord* FindVolume(int index) { return nullptr; }
|
||||
inline ClusterDef* FindCluster(int index) { return nullptr; }
|
||||
inline ClusterDef* AllocateCluster() { return nullptr; }
|
||||
inline VolumeRecord* AllocateVolume() { return nullptr; }
|
||||
void SetLevelNum(MapRecord* info, int num);
|
||||
|
||||
inline VolumeRecord* MustFindVolume(int index)
|
||||
{
|
||||
auto r = FindVolume(index);
|
||||
if (r) return r;
|
||||
r = AllocateVolume();
|
||||
r->index = index;
|
||||
return r;
|
||||
}
|
||||
inline ClusterDef* MustFindCluster(int index)
|
||||
{
|
||||
auto r = FindCluster(index);
|
||||
if (r) return r;
|
||||
r = AllocateCluster();
|
||||
r->index = index;
|
||||
return r;
|
||||
}
|
||||
|
||||
|
||||
// These should be the only places converting between level numbers and volume/map pairs
|
||||
constexpr inline int levelnum(int vol, int map)
|
||||
constexpr inline int makelevelnum(int vol, int map)
|
||||
{
|
||||
return vol * 1000 + map;
|
||||
}
|
||||
|
|
|
@ -388,7 +388,7 @@ static void BuildEpisodeMenu()
|
|||
for (int i = 0; i < MAXVOLUMES; i++)
|
||||
{
|
||||
auto& vol = volumeList[i];
|
||||
if (vol.name.IsNotEmpty() && !(vol.flags & EF_HIDEFROMSP))
|
||||
if (vol.name.IsNotEmpty() && !(vol.flags & VF_HIDEFROMSP))
|
||||
|
||||
{
|
||||
int isShareware = ((g_gameType & GAMEFLAG_DUKE) && (g_gameType & GAMEFLAG_SHAREWARE) && i > 0);
|
||||
|
|
|
@ -329,7 +329,7 @@ void GameInterface::Ticker()
|
|||
STAT_Update(false);
|
||||
// Fixme: Link maps, not episode/level pairs.
|
||||
int ep = volfromlevelnum(currentLevel->levelNumber);
|
||||
auto map = FindMapByLevelNum(levelnum(ep, gNextLevel));
|
||||
auto map = FindMapByLevelNum(makelevelnum(ep, gNextLevel));
|
||||
CompleteLevel(map);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -171,7 +171,7 @@ bool GameInterface::StartGame(FNewGameStartup& gs)
|
|||
}
|
||||
|
||||
sfxKillAllSounds();
|
||||
auto map = FindMapByLevelNum(levelnum(gs.Episode, gs.Level));
|
||||
auto map = FindMapByLevelNum(makelevelnum(gs.Episode, gs.Level));
|
||||
DeferedStartGame(map, gs.Skill);
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -95,7 +95,7 @@ void levelLoadMapInfo(IniFile *pIni, MapRecord *pLevelInfo, const char *pzSectio
|
|||
{
|
||||
char buffer[16];
|
||||
pLevelInfo->SetName(pIni->GetKeyString(pzSection, "Title", pLevelInfo->labelName));
|
||||
pLevelInfo->author = pIni->GetKeyString(pzSection, "Author", "");
|
||||
pLevelInfo->Author = pIni->GetKeyString(pzSection, "Author", "");
|
||||
pLevelInfo->music = pIni->GetKeyString(pzSection, "Song", ""); DefaultExtension(pLevelInfo->music, ".mid");
|
||||
pLevelInfo->cdSongId = pIni->GetKeyInt(pzSection, "Track", -1);
|
||||
pLevelInfo->nextLevel = pIni->GetKeyInt(pzSection, "EndingA", -1);
|
||||
|
@ -187,7 +187,7 @@ void levelLoadDefaults(void)
|
|||
auto pLevelInfo = AllocateMap();
|
||||
const char *pMap = BloodINI->GetKeyString(buffer, buffer2, NULL);
|
||||
CheckSectionAbend(pMap);
|
||||
pLevelInfo->levelNumber = levelnum(i, j);
|
||||
pLevelInfo->levelNumber = makelevelnum(i, j);
|
||||
pLevelInfo->cluster = i + 1;
|
||||
pLevelInfo->labelName = pMap;
|
||||
pLevelInfo->fileName.Format("%s.map", pMap);
|
||||
|
|
|
@ -421,7 +421,7 @@ static bool cheatMario(cheatseq_t* c)
|
|||
int nEpisode, nLevel;
|
||||
if (parseArgs((char*)c->Args, &nEpisode, &nLevel) == 2)
|
||||
{
|
||||
auto map = FindMapByLevelNum(levelnum(nEpisode, nLevel));
|
||||
auto map = FindMapByLevelNum(makelevelnum(nEpisode, nLevel));
|
||||
if (map) DeferedStartGame(map, -1);
|
||||
}
|
||||
return true;
|
||||
|
|
|
@ -296,7 +296,7 @@ static bool cheatLevel(cheatseq_t *s)
|
|||
levnume = (s->Args[1] - '0')*10+(s->Args[2]-'0') - 1;
|
||||
|
||||
// Instead of hard coded range checks on volume and level, let's just check if the level is defined.
|
||||
auto map = FindMapByLevelNum(levelnum(volnume, levnume));
|
||||
auto map = FindMapByLevelNum(makelevelnum(volnume, levnume));
|
||||
if (map)
|
||||
{
|
||||
ChangeLevel(map, -1);
|
||||
|
|
|
@ -127,7 +127,7 @@ bool GameInterface::StartGame(FNewGameStartup& gs)
|
|||
Net_ClearFifo();
|
||||
}
|
||||
|
||||
auto map = FindMapByLevelNum(levelnum(gs.Episode, gs.Level));
|
||||
auto map = FindMapByLevelNum(makelevelnum(gs.Episode, gs.Level));
|
||||
if (map)
|
||||
{
|
||||
DeferedStartGame(map, gs.Skill);
|
||||
|
|
|
@ -1016,7 +1016,7 @@ int ConCompiler::parsecommand()
|
|||
if (k >= 0)
|
||||
{
|
||||
tempMusic.Reserve(1);
|
||||
tempMusic.Last().levnum = levelnum(k, i);
|
||||
tempMusic.Last().levnum = makelevelnum(k, i);
|
||||
tempMusic.Last().music = parsebuffer.Data();
|
||||
}
|
||||
else
|
||||
|
@ -1695,7 +1695,7 @@ int ConCompiler::parsecommand()
|
|||
textptr++, i++;
|
||||
}
|
||||
parsebuffer.Push(0);
|
||||
auto levnum = levelnum(j, k);
|
||||
auto levnum = makelevelnum(j, k);
|
||||
auto map = FindMapByLevelNum(levnum);
|
||||
if (!map) map = AllocateMap();
|
||||
map->SetFileName(parsebuffer.Data());
|
||||
|
@ -3222,26 +3222,26 @@ void FixMapinfo()
|
|||
if (file <= fileSystem.GetMaxIwadNum())
|
||||
{
|
||||
auto maprec = FindMapByName("e1l7");
|
||||
if (maprec) maprec->nextLevel = levelnum(0, 4);
|
||||
if (maprec) maprec->nextLevel = makelevelnum(0, 4);
|
||||
}
|
||||
}
|
||||
else if (isRR())
|
||||
{
|
||||
if (volumeList[0].flags & EF_GOTONEXTVOLUME)
|
||||
if (true)
|
||||
{
|
||||
// RR goes directly to the second episode after E1L7 to continue the game.
|
||||
auto maprec1 = FindMapByLevelNum(levelnum(0, 6)); // E1L7 must exist
|
||||
auto maprec2 = FindMapByLevelNum(levelnum(0, 7)); // E1L8 must not exist
|
||||
auto maprec1 = FindMapByLevelNum(makelevelnum(0, 6)); // E1L7 must exist
|
||||
auto maprec2 = FindMapByLevelNum(makelevelnum(0, 7)); // E1L8 must not exist
|
||||
if (maprec1 && !maprec2)
|
||||
{
|
||||
maprec1->nextLevel = levelnum(1, 0);
|
||||
maprec1->nextLevel = makelevelnum(1, 0);
|
||||
}
|
||||
}
|
||||
if (!isRRRA())
|
||||
{
|
||||
// RR does not define its final level and crudely hacked it into the progression. This puts it into the E2L8 slot so that the game can naturally progress there.
|
||||
auto maprec1 = FindMapByLevelNum(levelnum(1, 6)); // E2L7 must exist
|
||||
auto maprec2 = FindMapByLevelNum(levelnum(1, 7)); // E2L8 must not exist
|
||||
auto maprec1 = FindMapByLevelNum(makelevelnum(1, 6)); // E2L7 must exist
|
||||
auto maprec2 = FindMapByLevelNum(makelevelnum(1, 7)); // E2L8 must not exist
|
||||
auto maprec3 = FindMapByName("endgame"); // endgame must not have a map record already
|
||||
int num3 = fileSystem.FindFile("endgame.map"); // endgame.map must exist.
|
||||
if (maprec1 && !maprec2 && !maprec3 && num3 >= 0)
|
||||
|
@ -3251,7 +3251,7 @@ void FixMapinfo()
|
|||
maprec->parTime = 0;
|
||||
maprec->SetFileName("endgame.map");
|
||||
maprec->SetName("$TXT_CLOSEENCOUNTERS");
|
||||
maprec->levelNumber = levelnum(1, 7);
|
||||
maprec->levelNumber = makelevelnum(1, 7);
|
||||
maprec->cluster = 2;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3455,7 +3455,7 @@ int ParseState::parse(void)
|
|||
insptr++; // skip command
|
||||
volnume = GetGameVarID(*insptr++, g_ac, g_p);
|
||||
levnume = GetGameVarID(*insptr++, g_ac, g_p);
|
||||
auto level = FindMapByLevelNum(levelnum(volnume - 1, levnume - 1));
|
||||
auto level = FindMapByLevelNum(makelevelnum(volnume - 1, levnume - 1));
|
||||
if (level != nullptr)
|
||||
ChangeLevel(level, -1);
|
||||
break;
|
||||
|
@ -3572,7 +3572,7 @@ int ParseState::parse(void)
|
|||
{
|
||||
insptr++;
|
||||
int music_select = *insptr++;
|
||||
auto level = FindMapByLevelNum(levelnum(currentLevel->cluster, music_select));
|
||||
auto level = FindMapByLevelNum(makelevelnum(currentLevel->cluster, music_select));
|
||||
if (level) S_PlayLevelMusic(level);
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -1469,20 +1469,20 @@ int doincrements_r(struct player_struct* p)
|
|||
switch (currentLevel->levelNumber)
|
||||
{
|
||||
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;
|
||||
case makelevelnum(0, 0): snd = isRRRA() ? 63 : 391; break;
|
||||
case makelevelnum(0, 1): snd = 64; break;
|
||||
case makelevelnum(0, 2): snd = 77; break;
|
||||
case makelevelnum(0, 3): snd = 80; break;
|
||||
case makelevelnum(0, 4): snd = 102; break;
|
||||
case makelevelnum(0, 5): snd = 103; break;
|
||||
case makelevelnum(0, 6): snd = 104; break;
|
||||
case makelevelnum(1, 0): snd = 105; break;
|
||||
case makelevelnum(1, 1): snd = 176; break;
|
||||
case makelevelnum(1, 2): snd = 177; break;
|
||||
case makelevelnum(1, 3): snd = 198; break;
|
||||
case makelevelnum(1, 4): snd = 230; break;
|
||||
case makelevelnum(1, 5): snd = 255; break;
|
||||
case makelevelnum(1, 6): snd = 283; break;
|
||||
}
|
||||
S_PlayActorSound(snd, pact);
|
||||
}
|
||||
|
@ -3401,7 +3401,7 @@ void processinput_r(int snum)
|
|||
}
|
||||
}
|
||||
else if (psectlotag == 7777)
|
||||
if (currentLevel->levelNumber == levelnum(1, 6))
|
||||
if (currentLevel->levelNumber == makelevelnum(1, 6))
|
||||
lastlevel = 1;
|
||||
|
||||
if (psectlotag == 848 && sector[psect].floorpicnum == WATERTILE2)
|
||||
|
|
|
@ -832,7 +832,7 @@ static int LoadTheMap(MapRecord *mi, struct player_struct *p, int gamemode)
|
|||
SECRET_SetMapName(mi->DisplayName(), mi->name);
|
||||
STAT_NewLevel(mi->fileName);
|
||||
|
||||
if (isRR() && !isRRRA() && mi->levelNumber == levelnum(1, 1))
|
||||
if (isRR() && !isRRRA() && mi->levelNumber == makelevelnum(1, 1))
|
||||
{
|
||||
for (int i = PISTOL_WEAPON; i < MAX_WEAPONS; i++)
|
||||
ps[0].ammo_amount[i] = 0;
|
||||
|
@ -845,7 +845,7 @@ static int LoadTheMap(MapRecord *mi, struct player_struct *p, int gamemode)
|
|||
if (isRR()) prelevel_r(gamemode);
|
||||
else prelevel_d(gamemode);
|
||||
|
||||
if (isRRRA() && mi->levelNumber == levelnum(0, 2))
|
||||
if (isRRRA() && mi->levelNumber == makelevelnum(0, 2))
|
||||
{
|
||||
for (int i = PISTOL_WEAPON; i < MAX_WEAPONS; i++)
|
||||
ps[0].ammo_amount[i] = 0;
|
||||
|
@ -1001,7 +1001,7 @@ bool setnextmap(bool checksecretexit)
|
|||
{
|
||||
if (ud.secretlevel > 0)
|
||||
{
|
||||
int newlevnum = levelnum(volfromlevelnum(currentLevel->levelNumber), ud.secretlevel-1);
|
||||
int newlevnum = makelevelnum(volfromlevelnum(currentLevel->levelNumber), ud.secretlevel-1);
|
||||
map = FindMapByLevelNum(newlevnum);
|
||||
if (map)
|
||||
{
|
||||
|
|
|
@ -366,11 +366,11 @@ static void cachegoodsprites(void)
|
|||
for (i = SMALLSMOKE; i < (SMALLSMOKE + 4); i++)
|
||||
tloadtile(i);
|
||||
|
||||
if (isRRRA() && currentLevel->levelNumber == levelnum(0, 4))
|
||||
if (isRRRA() && currentLevel->levelNumber == makelevelnum(0, 4))
|
||||
{
|
||||
tloadtile(RRTILE2577);
|
||||
}
|
||||
if (!isRRRA() && currentLevel->levelNumber == levelnum(1, 2))
|
||||
if (!isRRRA() && currentLevel->levelNumber == makelevelnum(1, 2))
|
||||
{
|
||||
tloadtile(RRTILE3190);
|
||||
tloadtile(RRTILE3191);
|
||||
|
@ -465,7 +465,7 @@ void prelevel_r(int g)
|
|||
|
||||
if (isRRRA())
|
||||
{
|
||||
if (currentLevel->levelNumber == levelnum(1, 4))
|
||||
if (currentLevel->levelNumber == makelevelnum(1, 4))
|
||||
ps[myconnectindex].steroids_amount = 0;
|
||||
|
||||
for (j = 0; j < MAXSPRITES; j++)
|
||||
|
|
Loading…
Reference in a new issue