mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-28 12:30:46 +00:00
- safety commit - does not compile!
This commit is contained in:
parent
dd45749650
commit
6b86d7606f
24 changed files with 844 additions and 1325 deletions
|
@ -791,6 +791,7 @@ set (PCH_SOURCES
|
||||||
core/gamecvars.cpp
|
core/gamecvars.cpp
|
||||||
core/gamecontrol.cpp
|
core/gamecontrol.cpp
|
||||||
core/inputstate.cpp
|
core/inputstate.cpp
|
||||||
|
core/mapinfo.cpp
|
||||||
core/searchpaths.cpp
|
core/searchpaths.cpp
|
||||||
core/screenjob.cpp
|
core/screenjob.cpp
|
||||||
core/initfs.cpp
|
core/initfs.cpp
|
||||||
|
|
|
@ -420,32 +420,6 @@ void EndLevel(void)
|
||||||
seqKillAll();
|
seqKillAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
int G_TryMapHack(const char* mhkfile)
|
|
||||||
{
|
|
||||||
int const failure = engineLoadMHK(mhkfile);
|
|
||||||
|
|
||||||
if (!failure)
|
|
||||||
Printf("Loaded map hack file \"%s\"\n", mhkfile);
|
|
||||||
|
|
||||||
return failure;
|
|
||||||
}
|
|
||||||
|
|
||||||
void G_LoadMapHack(char* outbuf, const char* filename)
|
|
||||||
{
|
|
||||||
if (filename != NULL)
|
|
||||||
Bstrcpy(outbuf, filename);
|
|
||||||
|
|
||||||
append_ext_UNSAFE(outbuf, ".mhk");
|
|
||||||
|
|
||||||
if (G_TryMapHack(outbuf) && usermaphacks != NULL)
|
|
||||||
{
|
|
||||||
auto pMapInfo = (usermaphack_t*)bsearch(&g_loadedMapHack, usermaphacks, num_usermaphacks,
|
|
||||||
sizeof(usermaphack_t), compare_usermaphacks);
|
|
||||||
if (pMapInfo)
|
|
||||||
G_TryMapHack(pMapInfo->mhkfile);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef POLYMER
|
#ifdef POLYMER
|
||||||
void G_RefreshLights(void)
|
void G_RefreshLights(void)
|
||||||
{
|
{
|
||||||
|
@ -541,11 +515,10 @@ void StartLevel(GAMEOPTIONS *gameOptions)
|
||||||
gQuitGame = true;
|
gQuitGame = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
char levelName[BMAX_PATH];
|
|
||||||
currentLevel = &mapList[gGameOptions.nEpisode * kMaxLevels + gGameOptions.nLevel];
|
currentLevel = &mapList[gGameOptions.nEpisode * kMaxLevels + gGameOptions.nLevel];
|
||||||
SECRET_SetMapName(currentLevel->DisplayName(), currentLevel->name);
|
SECRET_SetMapName(currentLevel->DisplayName(), currentLevel->name);
|
||||||
STAT_NewLevel(currentLevel->fileName);
|
STAT_NewLevel(currentLevel->fileName);
|
||||||
G_LoadMapHack(levelName, gameOptions->zLevelName);
|
G_LoadMapHack(gameOptions->zLevelName);
|
||||||
wsrand(gameOptions->uMapCRC);
|
wsrand(gameOptions->uMapCRC);
|
||||||
gKillMgr.Clear();
|
gKillMgr.Clear();
|
||||||
gSecretMgr.Clear();
|
gSecretMgr.Clear();
|
||||||
|
|
|
@ -818,6 +818,7 @@ void initspritelists(void);
|
||||||
|
|
||||||
int32_t engineLoadBoard(const char *filename, char flags, vec3_t *dapos, int16_t *daang, int16_t *dacursectnum);
|
int32_t engineLoadBoard(const char *filename, char flags, vec3_t *dapos, int16_t *daang, int16_t *dacursectnum);
|
||||||
int32_t engineLoadMHK(const char *filename);
|
int32_t engineLoadMHK(const char *filename);
|
||||||
|
void G_LoadMapHack(const char* filename);
|
||||||
void engineClearLightsFromMHK();
|
void engineClearLightsFromMHK();
|
||||||
#ifdef HAVE_CLIPSHAPE_FEATURE
|
#ifdef HAVE_CLIPSHAPE_FEATURE
|
||||||
int32_t engineLoadClipMaps(void);
|
int32_t engineLoadClipMaps(void);
|
||||||
|
|
|
@ -417,3 +417,28 @@ int32_t engineLoadMHK(const char *filename)
|
||||||
scriptfile_close(script);
|
scriptfile_close(script);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// taken out of the game modules - this code was repeated in all of them.
|
||||||
|
static int G_TryMapHack(const char* mhkfile)
|
||||||
|
{
|
||||||
|
int const failure = engineLoadMHK(mhkfile);
|
||||||
|
|
||||||
|
if (!failure)
|
||||||
|
Printf("Loaded map hack file \"%s\"\n", mhkfile);
|
||||||
|
|
||||||
|
return failure;
|
||||||
|
}
|
||||||
|
|
||||||
|
void G_LoadMapHack(const char* filename)
|
||||||
|
{
|
||||||
|
FString hack = StripExtension(filename) + ".mhk";
|
||||||
|
|
||||||
|
if (G_TryMapHack(hack) && usermaphacks != NULL)
|
||||||
|
{
|
||||||
|
auto pMapInfo = (usermaphack_t*)bsearch(&g_loadedMapHack, usermaphacks, num_usermaphacks,
|
||||||
|
sizeof(usermaphack_t), compare_usermaphacks);
|
||||||
|
if (pMapInfo)
|
||||||
|
G_TryMapHack(pMapInfo->mhkfile);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -97,12 +97,6 @@ auto vsnprintfptr = vsnprintf; // This is an inline in Visual Studio but we need
|
||||||
|
|
||||||
glcycle_t thinktime, actortime, gameupdatetime, drawtime;
|
glcycle_t thinktime, actortime, gameupdatetime, drawtime;
|
||||||
|
|
||||||
|
|
||||||
MapRecord mapList[512]; // Due to how this gets used it needs to be static. EDuke defines 7 episode plus one spare episode with 64 potential levels each and relies on the static array which is freely accessible by scripts.
|
|
||||||
MapRecord *currentLevel; // level that is currently played. (The real level, not what script hacks modfifying the current level index can pretend.)
|
|
||||||
MapRecord* lastLevel; // Same here, for the last level.
|
|
||||||
MapRecord userMapRecord; // stand-in for the user map.
|
|
||||||
|
|
||||||
gamestate_t gamestate = GS_STARTUP;
|
gamestate_t gamestate = GS_STARTUP;
|
||||||
|
|
||||||
FILE* hashfile;
|
FILE* hashfile;
|
||||||
|
|
145
source/core/mapinfo.cpp
Normal file
145
source/core/mapinfo.cpp
Normal file
|
@ -0,0 +1,145 @@
|
||||||
|
/*
|
||||||
|
** mapinfo.cpp
|
||||||
|
**
|
||||||
|
** Map record management
|
||||||
|
**
|
||||||
|
**---------------------------------------------------------------------------
|
||||||
|
** Copyright 2020 Christoph Oelckers
|
||||||
|
** 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.
|
||||||
|
**---------------------------------------------------------------------------
|
||||||
|
**
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "mapinfo.h"
|
||||||
|
|
||||||
|
MapRecord mapList[512]; // Due to how this gets used it needs to be static. EDuke defines 7 episode plus one spare episode with 64 potential levels each and relies on the static array which is freely accessible by scripts.
|
||||||
|
MapRecord *currentLevel; // level that is currently played. (The real level, not what script hacks modfifying the current level index can pretend.)
|
||||||
|
MapRecord* lastLevel; // Same here, for the last level.
|
||||||
|
unsigned int numUsedSlots;
|
||||||
|
|
||||||
|
|
||||||
|
MapRecord *FindMapByName(const char *nm)
|
||||||
|
{
|
||||||
|
for (unsigned i = 0; i < numUsedSlots; i++)
|
||||||
|
{
|
||||||
|
auto &map = mapList[i];
|
||||||
|
if (map.labelName.CompareNoCase(nm) == 0)
|
||||||
|
{
|
||||||
|
return ↦
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
MapRecord *FindMapByLevelNum(int num)
|
||||||
|
{
|
||||||
|
for (unsigned i = 0; i < numUsedSlots; i++)
|
||||||
|
{
|
||||||
|
auto &map = mapList[i];
|
||||||
|
if (map.levelNumber == num)
|
||||||
|
{
|
||||||
|
return ↦
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
MapRecord *FindNextMap(MapRecord *thismap)
|
||||||
|
{
|
||||||
|
if (thismap->nextLevel != -1) return mapList[thismap->nextlevel];
|
||||||
|
return FindMapByLevelNum(thismap->levelNumber+1);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool SetMusicForMap(const char* mapname, const char* music, bool namehack = false)
|
||||||
|
{
|
||||||
|
static const char* specials[] = { "intro", "briefing", "loading" };
|
||||||
|
for (int i = 0; i < 3; i++)
|
||||||
|
{
|
||||||
|
if (!stricmp(mapname, specials[i]))
|
||||||
|
{
|
||||||
|
// todo: store this properly.
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int index = FindMapByName(mapname);
|
||||||
|
|
||||||
|
// This is for the DEFS parser's MUSIC command which never bothered to check for the real map name.
|
||||||
|
if (index < 0 && namehack)
|
||||||
|
{
|
||||||
|
int lev, ep;
|
||||||
|
signed char b1, b2;
|
||||||
|
|
||||||
|
int numMatches = sscanf(mapname, "%c%d%c%d", &b1, &ep, &b2, &lev);
|
||||||
|
|
||||||
|
if (numMatches != 4 || toupper(b1) != 'E' || toupper(b2) != 'L')
|
||||||
|
return false;
|
||||||
|
|
||||||
|
index = FindMapByLevelNum(ep*100 + lev);
|
||||||
|
|
||||||
|
}
|
||||||
|
if (index >= 0)
|
||||||
|
{
|
||||||
|
mapList[index].music = music;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
MapRecord *AlloocateMap()
|
||||||
|
{
|
||||||
|
return &mapList[numUsedSlots++];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
MapRecord* SetupUserMap(const char* boardfilename)
|
||||||
|
{
|
||||||
|
for (unsigned i = 0; i < numUsedSlots; i++)
|
||||||
|
{
|
||||||
|
auto &map = mapList[i];
|
||||||
|
if (map.fileName.CompareNoCase(boardfilename) == 0)
|
||||||
|
{
|
||||||
|
return ↦
|
||||||
|
}
|
||||||
|
}
|
||||||
|
auto map = AllocateMap()
|
||||||
|
map->name = "";
|
||||||
|
map->SetFileName(boardfilename);
|
||||||
|
map->flags = MI_USERMAP|MI_FORCEEOG;
|
||||||
|
map->music = G_SetupFilenameBasedMusic(boardfilename, !isRR() ? "dethtoll.mid" : nullptr);
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void InitRREndMap()
|
||||||
|
{
|
||||||
|
// RR defines its end map ad-hoc so give it a proper entry to reference (the last one in episode 2 because it needs to be in Ep. 2.)
|
||||||
|
mapList[127].SetName("$TXT_CLOSEENCOUNTERS");
|
||||||
|
mapList[127].SetFileName("endgame.map");
|
||||||
|
mapList[127].levelNumber = 163; // last one in Ep. 2.
|
||||||
|
}
|
|
@ -18,6 +18,7 @@ inline void MakeStringLocalizable(FString "e)
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
MI_FORCEEOG = 1,
|
MI_FORCEEOG = 1,
|
||||||
|
MI_USERMAP = 2,
|
||||||
};
|
};
|
||||||
|
|
||||||
struct MapRecord
|
struct MapRecord
|
||||||
|
@ -39,7 +40,12 @@ struct MapRecord
|
||||||
FString author;
|
FString author;
|
||||||
int8_t fog = -1, weather = -1; // Blood defines these but they aren't used.
|
int8_t fog = -1, weather = -1; // Blood defines these but they aren't used.
|
||||||
|
|
||||||
const char *DisplayName()
|
const char* LabelName() const
|
||||||
|
{
|
||||||
|
if (flags & MI_USERMAP) return GStrings("TXT_USERMAP");
|
||||||
|
return labelName;
|
||||||
|
}
|
||||||
|
const char *DisplayName() const
|
||||||
{
|
{
|
||||||
if (name.IsEmpty()) return labelName;
|
if (name.IsEmpty()) return labelName;
|
||||||
return GStrings.localize(name);
|
return GStrings.localize(name);
|
||||||
|
@ -64,54 +70,14 @@ struct MapRecord
|
||||||
|
|
||||||
|
|
||||||
extern MapRecord mapList[512];
|
extern MapRecord mapList[512];
|
||||||
extern MapRecord userMapRecord;
|
|
||||||
extern MapRecord *currentLevel;
|
extern MapRecord *currentLevel;
|
||||||
extern MapRecord* lastLevel;
|
|
||||||
|
|
||||||
inline bool SetMusicForMap(const char* mapname, const char* music, bool namehack = false)
|
bool SetMusicForMap(const char* mapname, const char* music, bool namehack = false);
|
||||||
{
|
void InitRREndMap();
|
||||||
static const char* specials[] = { "intro", "briefing", "loading" };
|
|
||||||
for (int i = 0; i < 3; i++)
|
|
||||||
{
|
|
||||||
if (!stricmp(mapname, specials[i]))
|
|
||||||
{
|
|
||||||
// todo: store this properly.
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int index = -1; // = FindMap(mapname);
|
MapRecord *FindMapByName(const char *nm);
|
||||||
|
MapRecord *FindMapByLevelNum(int num);
|
||||||
// This is for the DEFS parser's MUSIC command which never bothered to check for the real map name.
|
MapRecord *FindNextMap(MapRecord *thismap);
|
||||||
if (index < 0 && namehack)
|
|
||||||
{
|
|
||||||
int lev, ep;
|
|
||||||
signed char b1, b2;
|
|
||||||
|
|
||||||
int numMatches = sscanf(mapname, "%c%d%c%d", &b1, &ep, &b2, &lev);
|
|
||||||
|
|
||||||
if (numMatches != 4 || toupper(b1) != 'E' || toupper(b2) != 'L')
|
|
||||||
return false;
|
|
||||||
|
|
||||||
index = -1; // = FindMapByIndex(ep, lev);
|
|
||||||
|
|
||||||
}
|
|
||||||
if (index >= 0)
|
|
||||||
{
|
|
||||||
mapList[index].music = music;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
inline void InitRREndMap()
|
|
||||||
{
|
|
||||||
// RR defines its end map ad-hoc so give it a proper entry to reference (the last one in episode 2 because it needs to be in Ep. 2.)
|
|
||||||
mapList[127].SetName("$TXT_CLOSEENCOUNTERS");
|
|
||||||
mapList[127].SetFileName("endgame.map");
|
|
||||||
mapList[127].levelNumber = 163; // last one in Ep. 2.
|
|
||||||
}
|
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
|
|
|
@ -40,6 +40,7 @@ BEGIN_EDUKE_NS
|
||||||
|
|
||||||
static uint8_t precachehightile[2][(MAXTILES+7)>>3];
|
static uint8_t precachehightile[2][(MAXTILES+7)>>3];
|
||||||
static int32_t g_precacheCount;
|
static int32_t g_precacheCount;
|
||||||
|
MapRecord userMapRecord;
|
||||||
|
|
||||||
|
|
||||||
static int32_t NET_75_CHECK = 0;
|
static int32_t NET_75_CHECK = 0;
|
||||||
|
@ -1653,32 +1654,6 @@ static void G_FadeLoad(int32_t r, int32_t g, int32_t b, int32_t start, int32_t e
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static int G_TryMapHack(const char *mhkfile)
|
|
||||||
{
|
|
||||||
int const failure = engineLoadMHK(mhkfile);
|
|
||||||
|
|
||||||
if (!failure)
|
|
||||||
Printf("Loaded map hack file \"%s\"\n", mhkfile);
|
|
||||||
|
|
||||||
return failure;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void G_LoadMapHack(char *outbuf, const char *filename)
|
|
||||||
{
|
|
||||||
if (filename != NULL)
|
|
||||||
Bstrcpy(outbuf, filename);
|
|
||||||
|
|
||||||
append_ext_UNSAFE(outbuf, ".mhk");
|
|
||||||
|
|
||||||
if (G_TryMapHack(outbuf) && usermaphacks != NULL)
|
|
||||||
{
|
|
||||||
auto pMapInfo = (usermaphack_t *)bsearch(&g_loadedMapHack, usermaphacks, num_usermaphacks,
|
|
||||||
sizeof(usermaphack_t), compare_usermaphacks);
|
|
||||||
if (pMapInfo)
|
|
||||||
G_TryMapHack(pMapInfo->mhkfile);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void G_CheckIfStateless()
|
static void G_CheckIfStateless()
|
||||||
{
|
{
|
||||||
for (bssize_t i = 0; i < (MAXVOLUMES * MAXLEVELS); i++)
|
for (bssize_t i = 0; i < (MAXVOLUMES * MAXLEVELS); i++)
|
||||||
|
@ -1785,7 +1760,7 @@ int G_EnterLevel(int gameMode)
|
||||||
currentLevel = &userMapRecord;
|
currentLevel = &userMapRecord;
|
||||||
SECRET_SetMapName(currentLevel->DisplayName(), currentLevel->name);
|
SECRET_SetMapName(currentLevel->DisplayName(), currentLevel->name);
|
||||||
STAT_NewLevel(boardfilename);
|
STAT_NewLevel(boardfilename);
|
||||||
G_LoadMapHack(levelName, boardfilename);
|
G_LoadMapHack(boardfilename);
|
||||||
|
|
||||||
userMapRecord.music = G_SetupFilenameBasedMusic(boardfilename, mapList[MUS_USERMAP].music.IsNotEmpty()? mapList[MUS_USERMAP].music.GetChars() :(!FURY? mapList[7].music.GetChars() : nullptr));
|
userMapRecord.music = G_SetupFilenameBasedMusic(boardfilename, mapList[MUS_USERMAP].music.IsNotEmpty()? mapList[MUS_USERMAP].music.GetChars() :(!FURY? mapList[7].music.GetChars() : nullptr));
|
||||||
}
|
}
|
||||||
|
@ -1799,7 +1774,7 @@ int G_EnterLevel(int gameMode)
|
||||||
currentLevel = &mm;
|
currentLevel = &mm;
|
||||||
SECRET_SetMapName(currentLevel->DisplayName(), currentLevel->name);
|
SECRET_SetMapName(currentLevel->DisplayName(), currentLevel->name);
|
||||||
STAT_NewLevel(mm.fileName);
|
STAT_NewLevel(mm.fileName);
|
||||||
G_LoadMapHack(levelName, mm.fileName);
|
G_LoadMapHack(mm.fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
p0.q16ang = fix16_from_int(playerAngle);
|
p0.q16ang = fix16_from_int(playerAngle);
|
||||||
|
|
|
@ -38,6 +38,7 @@ Modifications for JonoF's port by Jonathon Fowler (jf@jonof.id.au)
|
||||||
#include "screenjob.h"
|
#include "screenjob.h"
|
||||||
#include "texturemanager.h"
|
#include "texturemanager.h"
|
||||||
#include "buildtiles.h"
|
#include "buildtiles.h"
|
||||||
|
#include "mapinfo.h"
|
||||||
|
|
||||||
BEGIN_DUKE_NS
|
BEGIN_DUKE_NS
|
||||||
|
|
||||||
|
@ -781,17 +782,7 @@ public:
|
||||||
DDukeLevelSummaryScreen() : DScreenJob(fadein | fadeout)
|
DDukeLevelSummaryScreen() : DScreenJob(fadein | fadeout)
|
||||||
{
|
{
|
||||||
gfx_offset = BONUSSCREEN + ((ud.volume_number == 1) ? 5 : 0);
|
gfx_offset = BONUSSCREEN + ((ud.volume_number == 1) ? 5 : 0);
|
||||||
|
lastmapname = currentLevel->DisplayName();
|
||||||
if (ud.volume_number == 0 && ud.last_level == 8 && boardfilename[0]) // todo: get rid of this awful hack.
|
|
||||||
{
|
|
||||||
lastmapname = strrchr(boardfilename, '\\');
|
|
||||||
if (!lastmapname) lastmapname = strrchr(boardfilename, '/');
|
|
||||||
if (!lastmapname) lastmapname = boardfilename;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
lastmapname = currentLevel->DisplayName();
|
|
||||||
}
|
|
||||||
PlayBonusMusic();
|
PlayBonusMusic();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1043,26 +1034,18 @@ void e4intro(CompletionFunc completion)
|
||||||
class DDukeLoadScreen : public DScreenJob
|
class DDukeLoadScreen : public DScreenJob
|
||||||
{
|
{
|
||||||
std::function<int(void)> callback;
|
std::function<int(void)> callback;
|
||||||
|
MapRecord* rec;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
DDukeLoadScreen(const char *mapname_, std::function<int(void)> callback_) : DScreenJob(fadein|fadeout), callback(callback_) {}
|
DDukeLoadScreen(MapRecord *maprec, std::function<int(void)> callback_) : DScreenJob(fadein|fadeout), callback(callback_), rec(maprec) {}
|
||||||
|
|
||||||
int Frame(uint64_t clock, bool skiprequest)
|
int Frame(uint64_t clock, bool skiprequest)
|
||||||
{
|
{
|
||||||
DrawTexture(twod, tileGetTexture(LOADSCREEN), 0, 0, DTA_FullscreenEx, 3, DTA_LegacyRenderStyle, STYLE_Normal, TAG_DONE);
|
DrawTexture(twod, tileGetTexture(LOADSCREEN), 0, 0, DTA_FullscreenEx, 3, DTA_LegacyRenderStyle, STYLE_Normal, TAG_DONE);
|
||||||
|
|
||||||
// fixme: The level management needs a total overhaul!
|
BigText(160, 90, (rec->flags & MI_USERMAP)? GStrings("TXT_LOADUM") : GStrings("TXT_LOADING"));
|
||||||
if (boardfilename[0] != 0 && ud.level_number == 7 && ud.volume_number == 0)
|
BigText(160, 114, rec->DisplayName());
|
||||||
{
|
|
||||||
BigText(160, 90, GStrings("TXT_LOADUM"));
|
|
||||||
GameText(160, 100, boardfilename, 14, 0);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
BigText(160, 90, GStrings("TXT_LOADING"));
|
|
||||||
BigText(160, 114, mapList[(ud.volume_number * MAXLEVELS) + ud.level_number].DisplayName());
|
|
||||||
}
|
|
||||||
|
|
||||||
// Initiate the level load once the page has been faded in completely.
|
// Initiate the level load once the page has been faded in completely.
|
||||||
if (callback && GetFadeState() == visible)
|
if (callback && GetFadeState() == visible)
|
||||||
{
|
{
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -192,6 +192,8 @@ void resetprestat(int snum, int g);
|
||||||
void clearfifo(void);
|
void clearfifo(void);
|
||||||
void setmapfog(int fogtype);
|
void setmapfog(int fogtype);
|
||||||
void prelevel_common(int g);
|
void prelevel_common(int g);
|
||||||
|
void cacheit_d();
|
||||||
|
void cacheit_r();
|
||||||
|
|
||||||
void FTA(int q, struct player_struct* p);
|
void FTA(int q, struct player_struct* p);
|
||||||
void OnMotorcycle(player_struct *pl, int snum);
|
void OnMotorcycle(player_struct *pl, int snum);
|
||||||
|
@ -211,5 +213,6 @@ void displayrest(int32_t smoothratio);
|
||||||
void drawbackground(void);
|
void drawbackground(void);
|
||||||
void displayrooms(int32_t playerNum, int32_t smoothratio);
|
void displayrooms(int32_t playerNum, int32_t smoothratio);
|
||||||
void setgamepalette(int palid);
|
void setgamepalette(int palid);
|
||||||
|
void resetmys();
|
||||||
|
|
||||||
END_DUKE_NS
|
END_DUKE_NS
|
||||||
|
|
|
@ -47,18 +47,6 @@ extern int rtsplaying;
|
||||||
extern char boardfilename[BMAX_PATH];
|
extern char boardfilename[BMAX_PATH];
|
||||||
#define USERMAPMUSICFAKEVOLUME MAXVOLUMES
|
#define USERMAPMUSICFAKEVOLUME MAXVOLUMES
|
||||||
#define USERMAPMUSICFAKELEVEL (MAXLEVELS-1)
|
#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 false; // (boardfilename[0] != 0 && ud.level_number == 7 && ud.volume_number == 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline int Menu_HaveUserMap(void)
|
|
||||||
{
|
|
||||||
return false;// (boardfilename[0] != 0 && m_level_number == 7 && ud.m_volume_number == 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
extern int32_t g_Shareware;
|
extern int32_t g_Shareware;
|
||||||
extern int32_t cameraclock;
|
extern int32_t cameraclock;
|
||||||
|
|
|
@ -772,9 +772,9 @@ void drawoverheadmap(int cposx, int cposy, int czoom, int cang)
|
||||||
{
|
{
|
||||||
double scale = isRR() ? 0.5 : 1.;
|
double scale = isRR() ? 0.5 : 1.;
|
||||||
int top = isRR() ? 0 : ((ud.screen_size > 0) ? 147 : 179);
|
int top = isRR() ? 0 : ((ud.screen_size > 0) ? 147 : 179);
|
||||||
if (!G_HaveUserMap())
|
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[ud.volume_number]),
|
||||||
DTA_FullscreenScale, 3, DTA_VirtualWidth, 320, DTA_VirtualHeight, 200, DTA_ScaleX, scale, DTA_ScaleY, scale, DTA_KeepRatio, true, TAG_DONE);
|
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(),
|
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);
|
DTA_FullscreenScale, 3, DTA_VirtualWidth, 320, DTA_VirtualHeight, 200, DTA_ScaleX, scale, DTA_ScaleY, scale, DTA_KeepRatio, true, TAG_DONE);
|
||||||
}
|
}
|
||||||
|
|
|
@ -157,6 +157,11 @@ inline void SetPlayerPal(player_struct* p, PalEntry pe)
|
||||||
p->pals = pe;
|
p->pals = pe;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
constexpr inline int levelnum(int vol, int map)
|
||||||
|
{
|
||||||
|
return vol * 1000 + map;
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
|
|
|
@ -742,5 +742,180 @@ void prelevel_common(int g)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
void resettimevars(void)
|
||||||
|
{
|
||||||
|
totalclock = 0;
|
||||||
|
cloudtotalclock = 0;
|
||||||
|
ototalclock = 0;
|
||||||
|
lockclock = 0;
|
||||||
|
ready2send = 1;
|
||||||
|
if (camsprite >= 0)
|
||||||
|
hittype[camsprite].temp_data[0] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
static int LoadTheMap(MapRecord *mi, struct player_struct *p, int gamemode)
|
||||||
|
{
|
||||||
|
int16_t lbang;
|
||||||
|
if (VOLUMEONE && (mi->flags & MI_USERMAP))
|
||||||
|
{
|
||||||
|
Printf(TEXTCOLOR_RED "Cannot load user maps with shareware version!\n");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (engineLoadBoard(mi->fileName, VOLUMEONE, &p->pos, &lbang, &p->cursectnum) < 0)
|
||||||
|
{
|
||||||
|
Printf(TEXTCOLOR_RED "Map \"%s\" not found or invalid map version!\n", mi->fileName.GetChars());
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
currentLevel = mi;
|
||||||
|
SECRET_SetMapName(currentLevel->DisplayName(), currentLevel->name);
|
||||||
|
STAT_NewLevel(mi->fileName);
|
||||||
|
G_LoadMapHack(mi->fileName);
|
||||||
|
|
||||||
|
if (isRR() && !isRRRA() && mi->levelNumber == levelnum(1, 1))
|
||||||
|
{
|
||||||
|
for (int i = PISTOL_WEAPON; i < MAX_WEAPONS; i++)
|
||||||
|
ps[0].ammo_amount[i] = 0;
|
||||||
|
ps[0].gotweapon.Clear(KNEE_WEAPON);
|
||||||
|
}
|
||||||
|
p->setang(lbang);
|
||||||
|
|
||||||
|
memset(gotpic, 0, sizeof(gotpic));
|
||||||
|
|
||||||
|
if (isRR()) prelevel_r(gamemode);
|
||||||
|
else prelevel_d(gamemode);
|
||||||
|
|
||||||
|
G_InitRRRASkies();
|
||||||
|
|
||||||
|
if (isRRRA() && mi->levelNumber == levelnum(2, 0))
|
||||||
|
{
|
||||||
|
for (int i = PISTOL_WEAPON; i < MAX_WEAPONS; i++)
|
||||||
|
ps[0].ammo_amount[i] = 0;
|
||||||
|
ps[0].gotweapon.Clear(KNEE_WEAPON);
|
||||||
|
ps[0].gotweapon.Set(SLINGBLADE_WEAPON);
|
||||||
|
ps[0].ammo_amount[SLINGBLADE_WEAPON] = 1;
|
||||||
|
ps[0].curr_weapon = SLINGBLADE_WEAPON;
|
||||||
|
}
|
||||||
|
|
||||||
|
allignwarpelevators();
|
||||||
|
resetpspritevars(gamemode);
|
||||||
|
|
||||||
|
if (isRR()) cacheit_r(); else cacheit_d();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
int enterlevel(MapRecord *mi, int gamemode)
|
||||||
|
{
|
||||||
|
// flushpackets();
|
||||||
|
// waitforeverybody();
|
||||||
|
|
||||||
|
ud.respawn_monsters = ud.m_respawn_monsters;
|
||||||
|
ud.respawn_items = ud.m_respawn_items;
|
||||||
|
ud.respawn_inventory = ud.m_respawn_inventory;
|
||||||
|
ud.monsters_off = ud.m_monsters_off;
|
||||||
|
ud.coop = ud.m_coop;
|
||||||
|
ud.marker = ud.m_marker;
|
||||||
|
ud.ffire = ud.m_ffire;
|
||||||
|
|
||||||
|
if ((gamemode & MODE_DEMO) == 0 && ud.recstat == 2)
|
||||||
|
ud.recstat = 0;
|
||||||
|
|
||||||
|
OnEvent(EVENT_ENTERLEVEL);
|
||||||
|
|
||||||
|
// Stop all sounds
|
||||||
|
S_PauseSounds(false);
|
||||||
|
FX_StopAllSounds();
|
||||||
|
FX_SetReverb(0);
|
||||||
|
|
||||||
|
struct player_struct *const p = g_player[0].ps;
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
G_DoLoadScreen(msg, -1); // this should be done outside of this function later.
|
||||||
|
*/
|
||||||
|
int res = LoadTheMap(mi, p, gamemode);
|
||||||
|
if (res != 0) return res;
|
||||||
|
|
||||||
|
// Try this first so that it can disable the CD player if no tracks are found.
|
||||||
|
if (isRR() && !(gamemode & MODE_DEMO))
|
||||||
|
S_PlayRRMusic();
|
||||||
|
|
||||||
|
if (ud.recstat != 2)
|
||||||
|
{
|
||||||
|
S_PlayLevelMusic(mi);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (gamemode & (MODE_GAME|MODE_EOL))
|
||||||
|
{
|
||||||
|
ps[myconnectindex].gm = MODE_GAME;
|
||||||
|
}
|
||||||
|
else if (gamemode & MODE_RESTART)
|
||||||
|
{
|
||||||
|
if (ud.recstat == 2)
|
||||||
|
ps[myconnectindex].gm = MODE_DEMO;
|
||||||
|
else ps[myconnectindex].gm = MODE_GAME;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (VOLUMEONE && mi->levelNumber == 0 && ud.recstat != 2) FTA(QUOTE_F1HELP, &ps[myconnectindex]);
|
||||||
|
|
||||||
|
for (int i = connecthead; i >= 0; i = connectpoint2[i])
|
||||||
|
{
|
||||||
|
int pn = sector[sprite[ps[i].i].sectnum].floorpicnum;
|
||||||
|
if (pn == TILE_HURTRAIL || pn == TILE_FLOORSLIME || pn == TILE_FLOORPLASMA)
|
||||||
|
{
|
||||||
|
resetweapons(i);
|
||||||
|
resetinventory(i);
|
||||||
|
ps[i].gotweapon.Clear(PISTOL_WEAPON);
|
||||||
|
ps[i].ammo_amount[PISTOL_WEAPON] = 0;
|
||||||
|
ps[i].curr_weapon = KNEE_WEAPON;
|
||||||
|
ps[i].kickback_pic = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
resetmys();
|
||||||
|
setpal(&ps[myconnectindex]);
|
||||||
|
|
||||||
|
everyothertime = 0;
|
||||||
|
global_random = 0;
|
||||||
|
|
||||||
|
ud.last_level = ud.level_number+1;
|
||||||
|
clearfifo();
|
||||||
|
for (int i=numinterpolations-1; i>=0; i--) bakipos[i] = *curipos[i];
|
||||||
|
ps[myconnectindex].over_shoulder_on = 0;
|
||||||
|
clearfrags();
|
||||||
|
resettimevars(); // Here we go
|
||||||
|
Printf(TEXTCOLOR_GOLD "%s: %s\n", mi->LabelName(), mi->DisplayName());
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
void setmapfog(int fogtype)
|
||||||
|
{
|
||||||
|
GLInterface.SetMapFog(fogtype != 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
END_DUKE_NS
|
END_DUKE_NS
|
|
@ -23,11 +23,13 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
#ifndef premap_h_
|
#ifndef premap_h_
|
||||||
#define premap_h_
|
#define premap_h_
|
||||||
|
|
||||||
|
struct MapRecord;
|
||||||
|
|
||||||
BEGIN_DUKE_NS
|
BEGIN_DUKE_NS
|
||||||
|
|
||||||
extern int16_t ambientlotag[64];
|
extern int16_t ambientlotag[64];
|
||||||
extern int16_t ambienthitag[64];
|
extern int16_t ambienthitag[64];
|
||||||
int G_EnterLevel(int gameMode);
|
int G_EnterLevel(MapRecord *mi, int gameMode);
|
||||||
int G_FindLevelByFile(const char *fileName);
|
int G_FindLevelByFile(const char *fileName);
|
||||||
void G_NewGame(int volumeNum, int levelNum, int skillNum);
|
void G_NewGame(int volumeNum, int levelNum, int skillNum);
|
||||||
void G_ResetTimers(uint8_t keepgtics);
|
void G_ResetTimers(uint8_t keepgtics);
|
||||||
|
|
|
@ -507,184 +507,4 @@ void prelevel_d(int g)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//---------------------------------------------------------------------------
|
|
||||||
|
|
||||||
void enterlevel(char g)
|
|
||||||
{
|
|
||||||
short i,j;
|
|
||||||
long l;
|
|
||||||
char levname[256];
|
|
||||||
|
|
||||||
if( (g&MODE_DEMO) != MODE_DEMO ) ud.recstat = ud.m_recstat;
|
|
||||||
ud.respawn_monsters = ud.m_respawn_monsters;
|
|
||||||
ud.respawn_items = ud.m_respawn_items;
|
|
||||||
ud.respawn_inventory = ud.m_respawn_inventory;
|
|
||||||
ud.monsters_off = ud.m_monsters_off;
|
|
||||||
ud.coop = ud.m_coop;
|
|
||||||
ud.marker = ud.m_marker;
|
|
||||||
ud.ffire = ud.m_ffire;
|
|
||||||
|
|
||||||
#ifdef WW2
|
|
||||||
//sprintf(g_szBuf,"ENTERLEVEL L=%d V=%d",ud.level_number, ud.volume_number);
|
|
||||||
//AddLog(g_szBuf);
|
|
||||||
// variables are set by pointer...
|
|
||||||
OnEvent(EVENT_ENTERLEVEL, -1, -1, -1);
|
|
||||||
#endif
|
|
||||||
if( (g&MODE_DEMO) == 0 && ud.recstat == 2)
|
|
||||||
ud.recstat = 0;
|
|
||||||
|
|
||||||
FX_StopAllSounds();
|
|
||||||
clearsoundlocks();
|
|
||||||
FX_SetReverb(0);
|
|
||||||
|
|
||||||
dofrontscreens();
|
|
||||||
vscrn();
|
|
||||||
|
|
||||||
#ifndef VOLUMEONE
|
|
||||||
|
|
||||||
if( boardfilename[0] != 0 && ud.m_level_number == 7 && ud.m_volume_number == 0 )
|
|
||||||
{
|
|
||||||
if ( loadboard( boardfilename,&ps[0].posx, &ps[0].posy, &ps[0].posz, &ps[0].ang,&ps[0].cursectnum ) == -1 )
|
|
||||||
{
|
|
||||||
initprintf("Map %s not found!\n",boardfilename);
|
|
||||||
//gameexit(tempbuf);
|
|
||||||
return 1;
|
|
||||||
} else {
|
|
||||||
char *p;
|
|
||||||
strcpy(levname, boardfilename);
|
|
||||||
p = Bstrrchr(levname,'.');
|
|
||||||
if (!p) strcat(levname,".mhk");
|
|
||||||
else { p[1]='m'; p[2]='h'; p[3]='k'; p[4]=0; }
|
|
||||||
if (!loadmaphack(levname)) initprintf("Loaded map hack file %s\n",levname);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if ( loadboard( level_file_names[ (ud.volume_number*11)+ud.level_number],&ps[0].posx, &ps[0].posy, &ps[0].posz, &ps[0].ang,&ps[0].cursectnum ) == -1)
|
|
||||||
{
|
|
||||||
initprintf("Map %s not found!\n",level_file_names[(ud.volume_number*11)+ud.level_number]);
|
|
||||||
//gameexit(tempbuf);
|
|
||||||
return 1;
|
|
||||||
} else {
|
|
||||||
char *p;
|
|
||||||
strcpy(levname, level_file_names[ (ud.volume_number*11)+ud.level_number]);
|
|
||||||
p = Bstrrchr(levname,'.');
|
|
||||||
if (!p) strcat(levname,".mhk");
|
|
||||||
else { p[1]='m'; p[2]='h'; p[3]='k'; p[4]=0; }
|
|
||||||
if (!loadmaphack(levname)) initprintf("Loaded map hack file %s\n",levname);
|
|
||||||
}
|
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
l = strlen(level_file_names[ (ud.volume_number*11)+ud.level_number]);
|
|
||||||
copybufbyte( level_file_names[ (ud.volume_number*11)+ud.level_number],&levname[0],l);
|
|
||||||
levname[l] = 255;
|
|
||||||
levname[l+1] = 0;
|
|
||||||
|
|
||||||
if ( loadboard( levname,&ps[0].posx, &ps[0].posy, &ps[0].posz, &ps[0].ang,&ps[0].cursectnum ) == -1)
|
|
||||||
{
|
|
||||||
initprintf("Map %s not found!\n",level_file_names[(ud.volume_number*11)+ud.level_number]);
|
|
||||||
//gameexit(tempbuf);
|
|
||||||
return 1;
|
|
||||||
} else {
|
|
||||||
char *p;
|
|
||||||
p = Bstrrchr(levname,'.');
|
|
||||||
if (!p) strcat(levname,".mhk");
|
|
||||||
else { p[1]='m'; p[2]='h'; p[3]='k'; p[4]=0; }
|
|
||||||
if (!loadmaphack(levname)) initprintf("Loaded map hack file %s\n",levname);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
clearbufbyte(gotpic,sizeof(gotpic),0L);
|
|
||||||
|
|
||||||
prelevel(g);
|
|
||||||
|
|
||||||
allignwarpelevators();
|
|
||||||
resetpspritevars(g);
|
|
||||||
|
|
||||||
cachedebug = 0;
|
|
||||||
automapping = 0;
|
|
||||||
|
|
||||||
if(ud.recstat != 2) MUSIC_StopSong();
|
|
||||||
|
|
||||||
cacheit();
|
|
||||||
|
|
||||||
if(ud.recstat != 2)
|
|
||||||
{
|
|
||||||
music_select = (ud.volume_number*11) + ud.level_number;
|
|
||||||
playmusic(&music_fn[0][music_select][0]);
|
|
||||||
}
|
|
||||||
|
|
||||||
if( (g&MODE_GAME) || (g&MODE_EOL) )
|
|
||||||
ps[myconnectindex].gm = MODE_GAME;
|
|
||||||
else if(g&MODE_RESTART)
|
|
||||||
{
|
|
||||||
if(ud.recstat == 2)
|
|
||||||
ps[myconnectindex].gm = MODE_DEMO;
|
|
||||||
else ps[myconnectindex].gm = MODE_GAME;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( (ud.recstat == 1) && (g&MODE_RESTART) != MODE_RESTART )
|
|
||||||
opendemowrite();
|
|
||||||
|
|
||||||
#ifdef VOLUMEONE
|
|
||||||
if(ud.level_number == 0 && ud.recstat != 2) FTA(40,&ps[myconnectindex]);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
for(i=connecthead;i>=0;i=connectpoint2[i])
|
|
||||||
switch(sector[sprite[ps[i].i].sectnum].floorpicnum)
|
|
||||||
{
|
|
||||||
case HURTRAIL:
|
|
||||||
case FLOORSLIME:
|
|
||||||
case FLOORPLASMA:
|
|
||||||
resetweapons(i);
|
|
||||||
resetinventory(i);
|
|
||||||
ps[i].gotweapon[PISTOL_WEAPON] = 0;
|
|
||||||
ps[i].ammo_amount[PISTOL_WEAPON] = 0;
|
|
||||||
ps[i].curr_weapon = KNEE_WEAPON;
|
|
||||||
ps[i].kickback_pic = 0;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
//PREMAP.C - replace near the my's at the end of the file
|
|
||||||
|
|
||||||
resetmys();
|
|
||||||
|
|
||||||
ps[myconnectindex].palette = palette;
|
|
||||||
palto(0,0,0,0);
|
|
||||||
|
|
||||||
setpal(&ps[myconnectindex]);
|
|
||||||
flushperms();
|
|
||||||
|
|
||||||
everyothertime = 0;
|
|
||||||
global_random = 0;
|
|
||||||
|
|
||||||
ud.last_level = ud.level_number+1;
|
|
||||||
|
|
||||||
clearfifo();
|
|
||||||
|
|
||||||
for(i=numinterpolations-1;i>=0;i--) bakipos[i] = *curipos[i];
|
|
||||||
|
|
||||||
flushpackets();
|
|
||||||
waitforeverybody();
|
|
||||||
|
|
||||||
palto(0,0,0,0);
|
|
||||||
vscrn();
|
|
||||||
clearview(0L);
|
|
||||||
displayrooms(myconnectindex,65536);
|
|
||||||
displayrest(screenpeek);
|
|
||||||
|
|
||||||
ps[myconnectindex].over_shoulder_on = 0;
|
|
||||||
|
|
||||||
clearfrags();
|
|
||||||
|
|
||||||
resettimevars(); // Here we go
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
END_DUKE_NS
|
END_DUKE_NS
|
|
@ -812,191 +812,4 @@ void prelevel_r(int g)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
void enterlevel(char g)
|
|
||||||
{
|
|
||||||
short i, j;
|
|
||||||
long l;
|
|
||||||
char levname[256];
|
|
||||||
|
|
||||||
if ((g & MODE_DEMO) != MODE_DEMO) ud.recstat = ud.m_recstat;
|
|
||||||
ud.respawn_monsters = ud.m_respawn_monsters;
|
|
||||||
ud.respawn_items = ud.m_respawn_items;
|
|
||||||
ud.respawn_inventory = ud.m_respawn_inventory;
|
|
||||||
ud.monsters_off = ud.m_monsters_off;
|
|
||||||
ud.coop = ud.m_coop;
|
|
||||||
ud.marker = ud.m_marker;
|
|
||||||
ud.ffire = ud.m_ffire;
|
|
||||||
|
|
||||||
if ((g & MODE_DEMO) == 0 && ud.recstat == 2)
|
|
||||||
ud.recstat = 0;
|
|
||||||
|
|
||||||
dofrontscreens();
|
|
||||||
vscrn();
|
|
||||||
|
|
||||||
if (lastlevel)
|
|
||||||
{
|
|
||||||
if (loadboard("endgame.map", &ps[0].posx, &ps[0].posy, &ps[0].posz, &ps[0].ang, &ps[0].cursectnum) == -1)
|
|
||||||
{
|
|
||||||
sprintf(tempbuf, "Map %s not found!", boardfilename);
|
|
||||||
gameexit(tempbuf);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (boardfilename[0] != 0 && ud.m_level_number == 7 && ud.m_volume_number == 0)
|
|
||||||
{
|
|
||||||
if (loadboard(boardfilename, &ps[0].posx, &ps[0].posy, &ps[0].posz, &ps[0].ang, &ps[0].cursectnum) == -1)
|
|
||||||
{
|
|
||||||
sprintf(tempbuf, "Map %s not found!", boardfilename);
|
|
||||||
gameexit(tempbuf);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (loadboard(level_file_names[(ud.volume_number * 7) + ud.level_number], &ps[0].posx, &ps[0].posy, &ps[0].posz, &ps[0].ang, &ps[0].cursectnum) == -1)
|
|
||||||
{
|
|
||||||
sprintf(tempbuf, "Map %s not found!", level_file_names[(ud.volume_number * 8) + ud.level_number]);
|
|
||||||
gameexit(tempbuf);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
void loadlevel(const char *filename)
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef RRRA
|
|
||||||
if (ud.volume_number == 1 && ud.level_number == 1)
|
|
||||||
{
|
|
||||||
short ii;
|
|
||||||
for (ii = PISTOL_WEAPON; ii < MAX_WEAPONS; ii++)
|
|
||||||
ps[0].gotweapon[ii] = 0;
|
|
||||||
for (ii = PISTOL_WEAPON; ii < MAX_WEAPONS; ii++)
|
|
||||||
ps[0].ammo_amount[ii] = 0;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
clearbufbyte(gotpic,sizeof(gotpic),0L);
|
|
||||||
|
|
||||||
prelevel(g);
|
|
||||||
|
|
||||||
#ifdef RRRA
|
|
||||||
if (ud.level_number == 2 && ud.volume_number == 0)
|
|
||||||
{
|
|
||||||
short ii;
|
|
||||||
for (ii = PISTOL_WEAPON; ii < MAX_WEAPONS; ii++)
|
|
||||||
ps[0].gotweapon[ii] = 0;
|
|
||||||
for (ii = PISTOL_WEAPON; ii < MAX_WEAPONS; ii++)
|
|
||||||
ps[0].ammo_amount[ii] = 0;
|
|
||||||
ps[0].gotweapon[RA15_WEAPON] = 1;
|
|
||||||
ps[0].ammo_amount[RA15_WEAPON] = 1;
|
|
||||||
ps[0].curr_weapon = RA15_WEAPON;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
allignwarpelevators();
|
|
||||||
resetpspritevars(g);
|
|
||||||
|
|
||||||
cachedebug = 0;
|
|
||||||
automapping = 0;
|
|
||||||
|
|
||||||
cacheit();
|
|
||||||
docacheit();
|
|
||||||
|
|
||||||
if (globalskillsound >= 0)
|
|
||||||
{
|
|
||||||
while (Sound[globalskillsound].lock >= 200);
|
|
||||||
}
|
|
||||||
globalskillsound = -1;
|
|
||||||
|
|
||||||
FX_StopAllSounds();
|
|
||||||
clearsoundlocks();
|
|
||||||
FX_SetReverb(0);
|
|
||||||
|
|
||||||
if( (g&MODE_GAME) || (g&MODE_EOL) )
|
|
||||||
ps[myconnectindex].gm = MODE_GAME;
|
|
||||||
else if(g&MODE_RESTART)
|
|
||||||
{
|
|
||||||
if(ud.recstat == 2)
|
|
||||||
ps[myconnectindex].gm = MODE_DEMO;
|
|
||||||
else ps[myconnectindex].gm = MODE_GAME;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( (ud.recstat == 1) && (g&MODE_RESTART) != MODE_RESTART )
|
|
||||||
opendemowrite();
|
|
||||||
|
|
||||||
for(i=connecthead;i>=0;i=connectpoint2[i])
|
|
||||||
switch(sector[sprite[ps[i].i].sectnum].floorpicnum)
|
|
||||||
{
|
|
||||||
case HURTRAIL:
|
|
||||||
case FLOORSLIME:
|
|
||||||
case FLOORPLASMA:
|
|
||||||
resetweapons(i);
|
|
||||||
resetinventory(i);
|
|
||||||
ps[i].gotweapon[PISTOL_WEAPON] = 0;
|
|
||||||
ps[i].ammo_amount[PISTOL_WEAPON] = 0;
|
|
||||||
ps[i].curr_weapon = KNEE_WEAPON;
|
|
||||||
ps[i].kickback_pic = 0;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
//PREMAP.C - replace near the my's at the end of the file
|
|
||||||
myx = omyx = ps[myconnectindex].posx;
|
|
||||||
myy = omyy = ps[myconnectindex].posy;
|
|
||||||
myz = omyz = ps[myconnectindex].posz;
|
|
||||||
myxvel = myyvel = myzvel = 0;
|
|
||||||
myang = omyang = ps[myconnectindex].ang;
|
|
||||||
myhoriz = omyhoriz = ps[myconnectindex].horiz;
|
|
||||||
myhorizoff = omyhorizoff = ps[myconnectindex].horizoff;
|
|
||||||
mycursectnum = ps[myconnectindex].cursectnum;
|
|
||||||
myjumpingcounter = ps[myconnectindex].jumping_counter;
|
|
||||||
myjumpingtoggle = ps[myconnectindex].jumping_toggle;
|
|
||||||
myonground = ps[myconnectindex].on_ground;
|
|
||||||
myhardlanding = ps[myconnectindex].hard_landing;
|
|
||||||
myreturntocenter = ps[myconnectindex].return_to_center;
|
|
||||||
|
|
||||||
ps[myconnectindex].palette = palette;
|
|
||||||
palto(0,0,0,0);
|
|
||||||
|
|
||||||
setpal(&ps[myconnectindex]);
|
|
||||||
flushperms();
|
|
||||||
|
|
||||||
everyothertime = 0;
|
|
||||||
global_random = 0;
|
|
||||||
|
|
||||||
ud.last_level = ud.level_number+1;
|
|
||||||
|
|
||||||
clearfifo();
|
|
||||||
|
|
||||||
for(i=numinterpolations-1;i>=0;i--) bakipos[i] = *curipos[i];
|
|
||||||
|
|
||||||
flushpackets();
|
|
||||||
waitforeverybody();
|
|
||||||
|
|
||||||
palto(0,0,0,0);
|
|
||||||
vscrn();
|
|
||||||
clearview(0L);
|
|
||||||
displayrooms(screenpeek,65536);
|
|
||||||
displayrest(screenpeek);
|
|
||||||
nextpage();
|
|
||||||
|
|
||||||
if (waitabort == 1)
|
|
||||||
gameexit(" ");
|
|
||||||
ps[myconnectindex].over_shoulder_on = 0;
|
|
||||||
|
|
||||||
clearfrags();
|
|
||||||
|
|
||||||
resettimevars(); // Here we go
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
END_DUKE_NS
|
END_DUKE_NS
|
||||||
|
|
|
@ -579,11 +579,10 @@ void S_MenuSound(void)
|
||||||
|
|
||||||
static bool cd_disabled = false; // This is in case mus_redbook is enabled but no tracks found so that the regular music system can be switched on.
|
static bool cd_disabled = false; // This is in case mus_redbook is enabled but no tracks found so that the regular music system can be switched on.
|
||||||
|
|
||||||
void S_PlayLevelMusic(unsigned int m)
|
void S_PlayLevelMusic(MapRecord *mi)
|
||||||
{
|
{
|
||||||
auto& mr = m == USERMAPMUSICFAKESLOT ? userMapRecord : mapList[m];
|
if (isRR() && mi->music.IsEmpty() && mus_redbook && !cd_disabled) return;
|
||||||
if (isRR() && mr.music.IsEmpty() && mus_redbook && !cd_disabled) return;
|
Mus_Play(mi->labelName, mi->music, true);
|
||||||
Mus_Play(mr.labelName, mr.music, true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void S_PlaySpecialMusic(unsigned int m)
|
void S_PlaySpecialMusic(unsigned int m)
|
||||||
|
|
|
@ -31,6 +31,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
|
||||||
#include "raze_sound.h"
|
#include "raze_sound.h"
|
||||||
#include "raze_music.h"
|
#include "raze_music.h"
|
||||||
|
struct MapRecord;
|
||||||
|
|
||||||
BEGIN_DUKE_NS
|
BEGIN_DUKE_NS
|
||||||
|
|
||||||
|
@ -69,7 +70,7 @@ void cacheAllSounds(void);
|
||||||
void S_MenuSound(void);
|
void S_MenuSound(void);
|
||||||
void S_PauseMusic(bool paused);
|
void S_PauseMusic(bool paused);
|
||||||
void S_PauseSounds(bool paused);
|
void S_PauseSounds(bool paused);
|
||||||
void S_PlayLevelMusic(unsigned int);
|
void S_PlayLevelMusic(MapRecord* mi);
|
||||||
void S_PlaySpecialMusic(unsigned int);
|
void S_PlaySpecialMusic(unsigned int);
|
||||||
void S_ContinueLevelMusic(void);
|
void S_ContinueLevelMusic(void);
|
||||||
int S_PlaySound(int num, int channel = CHAN_AUTO, EChanFlags flags = 0);
|
int S_PlaySound(int num, int channel = CHAN_AUTO, EChanFlags flags = 0);
|
||||||
|
|
|
@ -66,7 +66,7 @@ struct user_defs
|
||||||
int m_respawn_items, m_respawn_monsters, m_respawn_inventory, m_recstat, m_monsters_off, detail;
|
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 player_skill, level_number, volume_number, m_marker, marker, mouseflip;
|
||||||
int statusbarmode, noexits, althud, ShowOpponentWeapons;
|
int statusbarmode, althud, ShowOpponentWeapons;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -34,18 +34,12 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
|
||||||
BEGIN_DUKE_NS
|
BEGIN_DUKE_NS
|
||||||
|
|
||||||
extern int which_palookup;
|
|
||||||
|
|
||||||
static int32_t g_precacheCount;
|
|
||||||
int32_t g_skillSoundVoice = -1;
|
|
||||||
|
|
||||||
|
|
||||||
void G_InitRRRASkies(void)
|
void G_InitRRRASkies(void)
|
||||||
{
|
{
|
||||||
if (!isRRRA())
|
if (!isRRRA())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (bssize_t i = 0; i < MAXSECTORS; i++)
|
for (int i = 0; i < MAXSECTORS; i++)
|
||||||
{
|
{
|
||||||
if (sector[i].ceilingpicnum != TILE_LA && sector[i].ceilingpicnum != TILE_MOONSKY1 && sector[i].ceilingpicnum != TILE_BIGORBIT1)
|
if (sector[i].ceilingpicnum != TILE_LA && sector[i].ceilingpicnum != TILE_MOONSKY1 && sector[i].ceilingpicnum != TILE_BIGORBIT1)
|
||||||
{
|
{
|
||||||
|
@ -79,8 +73,6 @@ void G_NewGame(int volumeNum, int levelNum, int skillNum)
|
||||||
|
|
||||||
handleevents();
|
handleevents();
|
||||||
|
|
||||||
g_skillSoundVoice = -1;
|
|
||||||
|
|
||||||
ready2send = 0;
|
ready2send = 0;
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
|
@ -104,7 +96,7 @@ void G_NewGame(int volumeNum, int levelNum, int skillNum)
|
||||||
|
|
||||||
ud.last_level = -1;
|
ud.last_level = -1;
|
||||||
|
|
||||||
int const UserMap = Menu_HaveUserMap();
|
int const UserMap = false;// Menu_HaveUserMap();
|
||||||
|
|
||||||
// we don't want the intro to play after the multiplayer setup screen
|
// we don't want the intro to play after the multiplayer setup screen
|
||||||
if (!isRR() && (!g_netServer && ud.multimode < 2) && UserMap == 0 &&
|
if (!isRR() && (!g_netServer && ud.multimode < 2) && UserMap == 0 &&
|
||||||
|
@ -127,7 +119,7 @@ void G_NewGame(int volumeNum, int levelNum, int skillNum)
|
||||||
|
|
||||||
if (m_coop != 1)
|
if (m_coop != 1)
|
||||||
{
|
{
|
||||||
for (bssize_t weaponNum = 0; weaponNum < 12/*MAX_WEAPONS*/; weaponNum++)
|
for (int weaponNum = 0; weaponNum < 12/*MAX_WEAPONS*/; weaponNum++)
|
||||||
{
|
{
|
||||||
auto const worksLike = isWW2GI() ? PWEAPON(0, weaponNum, WorksLike) : weaponNum;
|
auto const worksLike = isWW2GI() ? PWEAPON(0, weaponNum, WorksLike) : weaponNum;
|
||||||
if (worksLike == PISTOL_WEAPON)
|
if (worksLike == PISTOL_WEAPON)
|
||||||
|
@ -153,7 +145,7 @@ void resetpspritevars(int gameMode);
|
||||||
|
|
||||||
static inline void clearfrags(void)
|
static inline void clearfrags(void)
|
||||||
{
|
{
|
||||||
for (bssize_t i = 0; i < ud.multimode; i++)
|
for (int i = 0; i < ud.multimode; i++)
|
||||||
{
|
{
|
||||||
playerdata_t *const pPlayerData = &g_player[i];
|
playerdata_t *const pPlayerData = &g_player[i];
|
||||||
pPlayerData->ps->frag = pPlayerData->ps->fraggedself = 0;
|
pPlayerData->ps->frag = pPlayerData->ps->fraggedself = 0;
|
||||||
|
@ -161,301 +153,5 @@ static inline void clearfrags(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void G_ResetTimers(uint8_t keepgtics)
|
|
||||||
{
|
|
||||||
totalclock = cloudtotalclock = ototalclock = lockclock = 0;
|
|
||||||
ready2send = 1;
|
|
||||||
levelTextTime = 85;
|
|
||||||
|
|
||||||
if (!keepgtics)
|
|
||||||
g_moveThingsCount = 0;
|
|
||||||
|
|
||||||
if (camsprite >= 0)
|
|
||||||
hittype[camsprite].temp_data[0] = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int G_FindLevelByFile(const char *fileName)
|
|
||||||
{
|
|
||||||
for (bssize_t volumeNum = 0; volumeNum < MAXVOLUMES; volumeNum++)
|
|
||||||
{
|
|
||||||
int const volOffset = volumeNum * MAXLEVELS;
|
|
||||||
|
|
||||||
for (bssize_t levelNum = 0; levelNum < MAXLEVELS; levelNum++)
|
|
||||||
{
|
|
||||||
if (!mapList[volOffset + levelNum].fileName.CompareNoCase(fileName))
|
|
||||||
return volOffset + levelNum;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return MAXLEVELS * MAXVOLUMES;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int G_TryMapHack(const char *mhkfile)
|
|
||||||
{
|
|
||||||
int32_t failure = engineLoadMHK(mhkfile);
|
|
||||||
|
|
||||||
if (!failure)
|
|
||||||
Printf("Loaded map hack file \"%s\"\n", mhkfile);
|
|
||||||
|
|
||||||
return failure;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void G_LoadMapHack(char *outbuf, const char *filename)
|
|
||||||
{
|
|
||||||
if (filename != NULL)
|
|
||||||
Bstrcpy(outbuf, filename);
|
|
||||||
|
|
||||||
append_ext_UNSAFE(outbuf, ".mhk");
|
|
||||||
|
|
||||||
if (G_TryMapHack(outbuf) && usermaphacks != NULL)
|
|
||||||
{
|
|
||||||
usermaphack_t *pMapInfo = (usermaphack_t*)bsearch(
|
|
||||||
&g_loadedMapHack, usermaphacks, num_usermaphacks, sizeof(usermaphack_t),
|
|
||||||
compare_usermaphacks);
|
|
||||||
|
|
||||||
if (pMapInfo)
|
|
||||||
G_TryMapHack(pMapInfo->mhkfile);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void cacheit_d();
|
|
||||||
void cacheit_r();
|
|
||||||
|
|
||||||
static int LoadTheMap(MapRecord &mi, struct player_struct *pPlayer, int gameMode)
|
|
||||||
{
|
|
||||||
char levelName[BMAX_PATH];
|
|
||||||
int16_t lbang;
|
|
||||||
if (!VOLUMEONE && Menu_HaveUserMap())
|
|
||||||
{
|
|
||||||
if (engineLoadBoard(boardfilename, 0, &pPlayer->pos, &lbang, &pPlayer->cursectnum) < 0)
|
|
||||||
{
|
|
||||||
Printf(TEXTCOLOR_RED "Map \"%s\" not found or invalid map version!\n", boardfilename);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
userMapRecord.name = "";
|
|
||||||
userMapRecord.SetFileName(boardfilename);
|
|
||||||
currentLevel = &userMapRecord;
|
|
||||||
SECRET_SetMapName(currentLevel->DisplayName(), currentLevel->name);
|
|
||||||
STAT_NewLevel(boardfilename);
|
|
||||||
G_LoadMapHack(levelName, boardfilename);
|
|
||||||
userMapRecord.music = G_SetupFilenameBasedMusic(boardfilename, !isRR() ? "dethtoll.mid" : nullptr);
|
|
||||||
}
|
|
||||||
else if (engineLoadBoard(mi.fileName, VOLUMEONE, &pPlayer->pos, &lbang, &pPlayer->cursectnum) < 0)
|
|
||||||
{
|
|
||||||
Printf(TEXTCOLOR_RED "Map \"%s\" not found or invalid map version!\n", mi.fileName.GetChars());
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
currentLevel = &mi;
|
|
||||||
SECRET_SetMapName(currentLevel->DisplayName(), currentLevel->name);
|
|
||||||
STAT_NewLevel(mi.fileName);
|
|
||||||
G_LoadMapHack(levelName, mi.fileName);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isRR() && !isRRRA() && ud.volume_number == 1 && ud.level_number == 1)
|
|
||||||
{
|
|
||||||
for (bssize_t i = PISTOL_WEAPON; i < MAX_WEAPONS; i++)
|
|
||||||
g_player[0].ps->ammo_amount[i] = 0;
|
|
||||||
g_player[0].ps->gotweapon.Clear(KNEE_WEAPON);
|
|
||||||
}
|
|
||||||
|
|
||||||
pPlayer->q16ang = fix16_from_int(lbang);
|
|
||||||
|
|
||||||
g_precacheCount = 0;
|
|
||||||
Bmemset(gotpic, 0, sizeof(gotpic));
|
|
||||||
|
|
||||||
if (isRR()) prelevel_r(gameMode);
|
|
||||||
else prelevel_d(gameMode);
|
|
||||||
|
|
||||||
G_InitRRRASkies();
|
|
||||||
|
|
||||||
if (isRRRA() && ud.level_number == 2 && ud.volume_number == 0)
|
|
||||||
{
|
|
||||||
for (bssize_t i = PISTOL_WEAPON; i < MAX_WEAPONS; i++)
|
|
||||||
g_player[0].ps->ammo_amount[i] = 0;
|
|
||||||
g_player[0].ps->gotweapon.Clear(KNEE_WEAPON);
|
|
||||||
g_player[0].ps->gotweapon.Set(SLINGBLADE_WEAPON);
|
|
||||||
g_player[0].ps->ammo_amount[SLINGBLADE_WEAPON] = 1;
|
|
||||||
g_player[0].ps->curr_weapon = SLINGBLADE_WEAPON;
|
|
||||||
}
|
|
||||||
|
|
||||||
allignwarpelevators();
|
|
||||||
resetpspritevars(gameMode);
|
|
||||||
|
|
||||||
if (isRR()) cacheit_r(); else cacheit_d();
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int G_EnterLevel(int gameMode)
|
|
||||||
{
|
|
||||||
int32_t i, mii;
|
|
||||||
|
|
||||||
// flushpackets();
|
|
||||||
// waitforeverybody();
|
|
||||||
|
|
||||||
ud.respawn_monsters = ud.m_respawn_monsters;
|
|
||||||
ud.respawn_items = ud.m_respawn_items;
|
|
||||||
ud.respawn_inventory = ud.m_respawn_inventory;
|
|
||||||
ud.monsters_off = ud.m_monsters_off;
|
|
||||||
ud.coop = m_coop;
|
|
||||||
ud.marker = m_marker;
|
|
||||||
ud.ffire = m_ffire;
|
|
||||||
ud.noexits = m_noexits;
|
|
||||||
|
|
||||||
if ((gameMode & MODE_DEMO) != MODE_DEMO)
|
|
||||||
ud.recstat = m_recstat;
|
|
||||||
if ((gameMode & MODE_DEMO) == 0 && ud.recstat == 2)
|
|
||||||
ud.recstat = 0;
|
|
||||||
|
|
||||||
if (IsGameEvent(EVENT_ENTERLEVEL))
|
|
||||||
{
|
|
||||||
SetGameVarID(g_iReturnVarID, -1, -1, -1);
|
|
||||||
OnEvent(EVENT_ENTERLEVEL);
|
|
||||||
}
|
|
||||||
|
|
||||||
//if (g_networkMode != NET_DEDICATED_SERVER)
|
|
||||||
{
|
|
||||||
S_PauseSounds(false);
|
|
||||||
FX_StopAllSounds();
|
|
||||||
FX_SetReverb(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Menu_HaveUserMap())
|
|
||||||
{
|
|
||||||
int levelNum = G_FindLevelByFile(boardfilename);
|
|
||||||
|
|
||||||
if (levelNum != MAXLEVELS*MAXVOLUMES)
|
|
||||||
{
|
|
||||||
int volumeNum = levelNum;
|
|
||||||
|
|
||||||
levelNum &= MAXLEVELS-1;
|
|
||||||
volumeNum = (volumeNum - levelNum) / MAXLEVELS;
|
|
||||||
|
|
||||||
ud.level_number = levelNum;
|
|
||||||
ud.volume_number = volumeNum;
|
|
||||||
|
|
||||||
boardfilename[0] = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Redirect the final isRR() level to a valid map record so that currentLevel can point to something.
|
|
||||||
mii = (isRR() && g_lastLevel)? 127 : (ud.volume_number*MAXLEVELS)+ud.level_number;
|
|
||||||
auto& mi = mapList[mii];
|
|
||||||
|
|
||||||
if (mi.fileName.IsEmpty() && !Menu_HaveUserMap())
|
|
||||||
{
|
|
||||||
Printf(TEXTCOLOR_RED "Map E%dL%d not defined!\n", ud.volume_number+1, ud.level_number+1);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
FStringf msg("%s . . .", GStrings("TXT_LOADMAP"));
|
|
||||||
struct player_struct *const pPlayer = g_player[0].ps;
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
G_DoLoadScreen(msg, -1);
|
|
||||||
*/
|
|
||||||
int res = LoadTheMap(mi, pPlayer, gameMode);
|
|
||||||
if (res != 0) return res;
|
|
||||||
|
|
||||||
// Try this first so that it can disable the CD player if no tracks are found.
|
|
||||||
if (isRR() && !(gameMode & MODE_DEMO))
|
|
||||||
S_PlayRRMusic();
|
|
||||||
|
|
||||||
if (ud.recstat != 2)
|
|
||||||
{
|
|
||||||
if (Menu_HaveUserMap())
|
|
||||||
{
|
|
||||||
S_PlayLevelMusic(USERMAPMUSICFAKESLOT);
|
|
||||||
}
|
|
||||||
else S_PlayLevelMusic(mii);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (gameMode & (MODE_GAME|MODE_EOL))
|
|
||||||
{
|
|
||||||
for (TRAVERSE_CONNECT(i))
|
|
||||||
{
|
|
||||||
g_player[i].ps->gm = MODE_GAME;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (gameMode & MODE_RESTART)
|
|
||||||
{
|
|
||||||
if (ud.recstat == 2)
|
|
||||||
g_player[myconnectindex].ps->gm = MODE_DEMO;
|
|
||||||
else g_player[myconnectindex].ps->gm = MODE_GAME;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifndef EDUKE32_TOUCH_DEVICES
|
|
||||||
if (VOLUMEONE && ud.level_number == 0 && ud.recstat != 2)
|
|
||||||
FTA(QUOTE_F1HELP,g_player[myconnectindex].ps);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
for (TRAVERSE_CONNECT(i))
|
|
||||||
{
|
|
||||||
int pn = sector[sprite[g_player[i].ps->i].sectnum].floorpicnum;
|
|
||||||
if (pn == TILE_HURTRAIL || pn == TILE_FLOORSLIME || pn == TILE_FLOORPLASMA)
|
|
||||||
{
|
|
||||||
resetweapons(i);
|
|
||||||
resetinventory(i);
|
|
||||||
|
|
||||||
g_player[i].ps->gotweapon.Clear(PISTOL_WEAPON);
|
|
||||||
g_player[i].ps->ammo_amount[PISTOL_WEAPON] = 0;
|
|
||||||
|
|
||||||
g_player[i].ps->curr_weapon = KNEE_WEAPON;
|
|
||||||
g_player[i].ps->kickback_pic = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//PREMAP.C - replace near the my's at the end of the file
|
|
||||||
|
|
||||||
Net_NotifyNewGame();
|
|
||||||
Net_ResetPrediction();
|
|
||||||
|
|
||||||
//g_player[myconnectindex].ps->palette = palette;
|
|
||||||
setpal(g_player[myconnectindex].ps);
|
|
||||||
renderFlushPerms();
|
|
||||||
|
|
||||||
everyothertime = 0;
|
|
||||||
g_globalRandom = 0;
|
|
||||||
|
|
||||||
ud.last_level = ud.level_number+1;
|
|
||||||
|
|
||||||
clearfifo();
|
|
||||||
|
|
||||||
for (i=numinterpolations-1; i>=0; i--) bakipos[i] = *curipos[i];
|
|
||||||
|
|
||||||
g_player[myconnectindex].ps->over_shoulder_on = 0;
|
|
||||||
|
|
||||||
clearfrags();
|
|
||||||
|
|
||||||
G_ResetTimers(0); // Here we go
|
|
||||||
|
|
||||||
//Bsprintf(g_szBuf,"G_EnterLevel L=%d V=%d",ud.level_number, ud.volume_number);
|
|
||||||
//AddLog(g_szBuf);
|
|
||||||
// variables are set by pointer...
|
|
||||||
|
|
||||||
|
|
||||||
if (G_HaveUserMap())
|
|
||||||
{
|
|
||||||
Printf(TEXTCOLOR_GOLD "%s: %s\n", GStrings("TXT_USERMAP"), boardfilename);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Printf(TEXTCOLOR_GOLD "%s: %s\n", mapList[mii].labelName.GetChars(), mapList[mii].DisplayName());
|
|
||||||
}
|
|
||||||
|
|
||||||
videoClearViewableArea(0L);
|
|
||||||
displayrooms(myconnectindex,65536);
|
|
||||||
displayrest(65536);
|
|
||||||
|
|
||||||
Net_WaitForEverybody();
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void setmapfog(int fogtype)
|
|
||||||
{
|
|
||||||
GLInterface.SetMapFog(fogtype != 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
END_DUKE_NS
|
END_DUKE_NS
|
||||||
|
|
|
@ -783,11 +783,10 @@ static const dataspec_t svgm_udnetw[] =
|
||||||
{ DS_NOCHK, &ud.coop, sizeof(ud.coop), 1 },
|
{ DS_NOCHK, &ud.coop, sizeof(ud.coop), 1 },
|
||||||
{ DS_NOCHK, &ud.marker, sizeof(ud.marker), 1 },
|
{ DS_NOCHK, &ud.marker, sizeof(ud.marker), 1 },
|
||||||
{ DS_NOCHK, &ud.ffire, sizeof(ud.ffire), 1 },
|
{ DS_NOCHK, &ud.ffire, sizeof(ud.ffire), 1 },
|
||||||
{ DS_NOCHK, &ud.noexits, sizeof(ud.noexits), 1 },
|
|
||||||
{ 0, &ud.pause_on, sizeof(ud.pause_on), 1 },
|
{ 0, &ud.pause_on, sizeof(ud.pause_on), 1 },
|
||||||
{ 0, connectpoint2, sizeof(connectpoint2), 1 },
|
{ 0, connectpoint2, sizeof(connectpoint2), 1 },
|
||||||
{ 0, &randomseed, sizeof(randomseed), 1 },
|
{ 0, &randomseed, sizeof(randomseed), 1 },
|
||||||
{ 0, &g_globalRandom, sizeof(g_globalRandom), 1 },
|
{ 0, &global_random, sizeof(global_random), 1 },
|
||||||
// { 0, &lockclock_dummy, sizeof(lockclock), 1 },
|
// { 0, &lockclock_dummy, sizeof(lockclock), 1 },
|
||||||
{ DS_END, 0, 0, 0 }
|
{ DS_END, 0, 0, 0 }
|
||||||
};
|
};
|
||||||
|
@ -1204,7 +1203,6 @@ static void sv_postudload()
|
||||||
m_coop = ud.coop;
|
m_coop = ud.coop;
|
||||||
m_marker = ud.marker;
|
m_marker = ud.marker;
|
||||||
m_ffire = ud.ffire;
|
m_ffire = ud.ffire;
|
||||||
m_noexits = ud.noexits;
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
//static int32_t lockclock_dummy;
|
//static int32_t lockclock_dummy;
|
||||||
|
@ -1432,7 +1430,7 @@ static void postloadplayer(int32_t savegamep)
|
||||||
|
|
||||||
//8
|
//8
|
||||||
// if (savegamep) ?
|
// if (savegamep) ?
|
||||||
G_ResetTimers(0);
|
resettimevars();
|
||||||
|
|
||||||
#ifdef USE_STRUCT_TRACKERS
|
#ifdef USE_STRUCT_TRACKERS
|
||||||
Bmemset(sectorchanged, 0, sizeof(sectorchanged));
|
Bmemset(sectorchanged, 0, sizeof(sectorchanged));
|
||||||
|
|
|
@ -42,6 +42,7 @@ static int32_t g_whichPalForPlayer = 9;
|
||||||
static uint8_t precachehightile[2][MAXTILES>>3];
|
static uint8_t precachehightile[2][MAXTILES>>3];
|
||||||
static int32_t g_precacheCount;
|
static int32_t g_precacheCount;
|
||||||
int32_t g_skillSoundVoice = -1;
|
int32_t g_skillSoundVoice = -1;
|
||||||
|
MapRecord userMapRecord;
|
||||||
|
|
||||||
|
|
||||||
static void flag_precache(int32_t tile, int32_t type)
|
static void flag_precache(int32_t tile, int32_t type)
|
||||||
|
@ -2237,34 +2238,6 @@ static void G_FadeLoad(int32_t r, int32_t g, int32_t b, int32_t start, int32_t e
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static int G_TryMapHack(const char *mhkfile)
|
|
||||||
{
|
|
||||||
int32_t failure = engineLoadMHK(mhkfile);
|
|
||||||
|
|
||||||
if (!failure)
|
|
||||||
Printf("Loaded map hack file \"%s\"\n", mhkfile);
|
|
||||||
|
|
||||||
return failure;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void G_LoadMapHack(char *outbuf, const char *filename)
|
|
||||||
{
|
|
||||||
if (filename != NULL)
|
|
||||||
Bstrcpy(outbuf, filename);
|
|
||||||
|
|
||||||
append_ext_UNSAFE(outbuf, ".mhk");
|
|
||||||
|
|
||||||
if (G_TryMapHack(outbuf) && usermaphacks != NULL)
|
|
||||||
{
|
|
||||||
usermaphack_t *pMapInfo = (usermaphack_t*)bsearch(
|
|
||||||
&g_loadedMapHack, usermaphacks, num_usermaphacks, sizeof(usermaphack_t),
|
|
||||||
compare_usermaphacks);
|
|
||||||
|
|
||||||
if (pMapInfo)
|
|
||||||
G_TryMapHack(pMapInfo->mhkfile);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int G_EnterLevel(int gameMode)
|
int G_EnterLevel(int gameMode)
|
||||||
{
|
{
|
||||||
int32_t i, mii;
|
int32_t i, mii;
|
||||||
|
@ -2350,7 +2323,7 @@ int G_EnterLevel(int gameMode)
|
||||||
currentLevel = &userMapRecord;
|
currentLevel = &userMapRecord;
|
||||||
SECRET_SetMapName(currentLevel->DisplayName(), currentLevel->name);
|
SECRET_SetMapName(currentLevel->DisplayName(), currentLevel->name);
|
||||||
STAT_NewLevel(boardfilename);
|
STAT_NewLevel(boardfilename);
|
||||||
G_LoadMapHack(levelName, boardfilename);
|
G_LoadMapHack(boardfilename);
|
||||||
userMapRecord.music = G_SetupFilenameBasedMusic(boardfilename, !RR? "dethtoll.mid" : nullptr);
|
userMapRecord.music = G_SetupFilenameBasedMusic(boardfilename, !RR? "dethtoll.mid" : nullptr);
|
||||||
}
|
}
|
||||||
else if (engineLoadBoard(mi.fileName, VOLUMEONE, &pPlayer->pos, &lbang, &pPlayer->cursectnum) < 0)
|
else if (engineLoadBoard(mi.fileName, VOLUMEONE, &pPlayer->pos, &lbang, &pPlayer->cursectnum) < 0)
|
||||||
|
@ -2363,7 +2336,7 @@ int G_EnterLevel(int gameMode)
|
||||||
currentLevel = &mi;
|
currentLevel = &mi;
|
||||||
SECRET_SetMapName(currentLevel->DisplayName(), currentLevel->name);
|
SECRET_SetMapName(currentLevel->DisplayName(), currentLevel->name);
|
||||||
STAT_NewLevel(mi.fileName);
|
STAT_NewLevel(mi.fileName);
|
||||||
G_LoadMapHack(levelName, mi.fileName);
|
G_LoadMapHack(mi.fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (RR && !RRRA && ud.volume_number == 1 && ud.level_number == 1)
|
if (RR && !RRRA && ud.volume_number == 1 && ud.level_number == 1)
|
||||||
|
|
Loading…
Reference in a new issue