mirror of
https://github.com/ZDoom/Raze.git
synced 2025-02-07 15:31:11 +00:00
- everything compiles again.
Still needs testing.
This commit is contained in:
parent
915b566612
commit
01fce31f43
21 changed files with 511 additions and 447 deletions
|
@ -34,6 +34,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "mapinfo.h"
|
#include "mapinfo.h"
|
||||||
|
#include "raze_music.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 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 *currentLevel; // level that is currently played. (The real level, not what script hacks modfifying the current level index can pretend.)
|
||||||
|
@ -70,11 +71,11 @@ MapRecord *FindMapByLevelNum(int num)
|
||||||
|
|
||||||
MapRecord *FindNextMap(MapRecord *thismap)
|
MapRecord *FindNextMap(MapRecord *thismap)
|
||||||
{
|
{
|
||||||
if (thismap->nextLevel != -1) return mapList[thismap->nextlevel];
|
if (thismap->nextLevel != -1) return &mapList[thismap->nextLevel];
|
||||||
return FindMapByLevelNum(thismap->levelNumber+1);
|
return FindMapByLevelNum(thismap->levelNumber+1);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SetMusicForMap(const char* mapname, const char* music, bool namehack = false)
|
bool SetMusicForMap(const char* mapname, const char* music, bool namehack)
|
||||||
{
|
{
|
||||||
static const char* specials[] = { "intro", "briefing", "loading" };
|
static const char* specials[] = { "intro", "briefing", "loading" };
|
||||||
for (int i = 0; i < 3; i++)
|
for (int i = 0; i < 3; i++)
|
||||||
|
@ -86,10 +87,10 @@ bool SetMusicForMap(const char* mapname, const char* music, bool namehack = fals
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int index = FindMapByName(mapname);
|
auto index = FindMapByName(mapname);
|
||||||
|
|
||||||
// This is for the DEFS parser's MUSIC command which never bothered to check for the real map name.
|
// This is for the DEFS parser's MUSIC command which never bothered to check for the real map name.
|
||||||
if (index < 0 && namehack)
|
if (index == nullptr && namehack)
|
||||||
{
|
{
|
||||||
int lev, ep;
|
int lev, ep;
|
||||||
signed char b1, b2;
|
signed char b1, b2;
|
||||||
|
@ -102,21 +103,21 @@ bool SetMusicForMap(const char* mapname, const char* music, bool namehack = fals
|
||||||
index = FindMapByLevelNum(ep*100 + lev);
|
index = FindMapByLevelNum(ep*100 + lev);
|
||||||
|
|
||||||
}
|
}
|
||||||
if (index >= 0)
|
if (index != nullptr)
|
||||||
{
|
{
|
||||||
mapList[index].music = music;
|
index->music = music;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
MapRecord *AlloocateMap()
|
MapRecord *AllocateMap()
|
||||||
{
|
{
|
||||||
return &mapList[numUsedSlots++];
|
return &mapList[numUsedSlots++];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
MapRecord* SetupUserMap(const char* boardfilename)
|
MapRecord* SetupUserMap(const char* boardfilename, const char *defaultmusic)
|
||||||
{
|
{
|
||||||
for (unsigned i = 0; i < numUsedSlots; i++)
|
for (unsigned i = 0; i < numUsedSlots; i++)
|
||||||
{
|
{
|
||||||
|
@ -126,11 +127,11 @@ MapRecord* SetupUserMap(const char* boardfilename)
|
||||||
return ↦
|
return ↦
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
auto map = AllocateMap()
|
auto map = AllocateMap();
|
||||||
map->name = "";
|
map->name = "";
|
||||||
map->SetFileName(boardfilename);
|
map->SetFileName(boardfilename);
|
||||||
map->flags = MI_USERMAP|MI_FORCEEOG;
|
map->flags = MI_USERMAP|MI_FORCEEOG;
|
||||||
map->music = G_SetupFilenameBasedMusic(boardfilename, !isRR() ? "dethtoll.mid" : nullptr);
|
map->music = G_SetupFilenameBasedMusic(boardfilename, defaultmusic);
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -78,6 +78,8 @@ void InitRREndMap();
|
||||||
MapRecord *FindMapByName(const char *nm);
|
MapRecord *FindMapByName(const char *nm);
|
||||||
MapRecord *FindMapByLevelNum(int num);
|
MapRecord *FindMapByLevelNum(int num);
|
||||||
MapRecord *FindNextMap(MapRecord *thismap);
|
MapRecord *FindNextMap(MapRecord *thismap);
|
||||||
|
MapRecord* SetupUserMap(const char* boardfilename, const char *defaultmusic = nullptr);
|
||||||
|
MapRecord* AllocateMap();
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
|
|
|
@ -305,13 +305,14 @@ int G_ValidateSavegame(FileReader &fr, FString *savetitle, bool formenu)
|
||||||
}
|
}
|
||||||
|
|
||||||
int savever;
|
int savever;
|
||||||
FString engine, gamegrp, mapgrp, title, filename;
|
FString engine, gamegrp, mapgrp, title, filename, label;
|
||||||
|
|
||||||
arc("Save Version", savever)
|
arc("Save Version", savever)
|
||||||
("Engine", engine)
|
("Engine", engine)
|
||||||
("Game Resource", gamegrp)
|
("Game Resource", gamegrp)
|
||||||
("Map Resource", mapgrp)
|
("Map Resource", mapgrp)
|
||||||
("Title", title)
|
("Title", title)
|
||||||
|
("Nap Label", label)
|
||||||
("Map File", filename);
|
("Map File", filename);
|
||||||
|
|
||||||
auto savesig = gi->GetSaveSig();
|
auto savesig = gi->GetSaveSig();
|
||||||
|
@ -324,25 +325,16 @@ int G_ValidateSavegame(FileReader &fr, FString *savetitle, bool formenu)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
MapRecord *curLevel = nullptr;
|
MapRecord *curLevel = FindMapByName(label);
|
||||||
|
|
||||||
if (strncmp(filename, "file://", 7) != 0)
|
// If the map does not exist, check if it's a user map.
|
||||||
|
if (!curLevel)
|
||||||
{
|
{
|
||||||
for (auto& mr : mapList)
|
curLevel = AllocateMap();
|
||||||
{
|
|
||||||
if (mr.fileName.Compare(filename) == 0)
|
|
||||||
{
|
|
||||||
curLevel = &mr;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
curLevel = &userMapRecord;
|
|
||||||
if (!formenu)
|
if (!formenu)
|
||||||
{
|
{
|
||||||
userMapRecord.name = "";
|
curLevel->name = "";
|
||||||
userMapRecord.SetFileName(filename);
|
curLevel->SetFileName(filename);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!curLevel) return 0;
|
if (!curLevel) return 0;
|
||||||
|
|
|
@ -1744,7 +1744,6 @@ int G_EnterLevel(int gameMode)
|
||||||
auto &p0 = *g_player[0].ps;
|
auto &p0 = *g_player[0].ps;
|
||||||
int16_t playerAngle;
|
int16_t playerAngle;
|
||||||
|
|
||||||
char levelName[BMAX_PATH];
|
|
||||||
NET_75_CHECK++; // a major problem with how STAT_NETALLOC works, is that loadboard loads sprites directly into the arrays and does not take from
|
NET_75_CHECK++; // a major problem with how STAT_NETALLOC works, is that loadboard loads sprites directly into the arrays and does not take from
|
||||||
// STAT_NETALLOC, even though the loaded sprites are very, very likely to be relevant to the netcode.
|
// STAT_NETALLOC, even though the loaded sprites are very, very likely to be relevant to the netcode.
|
||||||
|
|
||||||
|
|
|
@ -30,6 +30,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
|
||||||
BEGIN_EDUKE_NS
|
BEGIN_EDUKE_NS
|
||||||
|
|
||||||
|
extern MapRecord userMapRecord;
|
||||||
|
|
||||||
class DukeSoundEngine : public SoundEngine
|
class DukeSoundEngine : public SoundEngine
|
||||||
{
|
{
|
||||||
|
|
|
@ -600,7 +600,6 @@ void dobonus_r(bool bonusonly, CompletionFunc completion)
|
||||||
|
|
||||||
class DRRLoadScreen : public DScreenJob
|
class DRRLoadScreen : public DScreenJob
|
||||||
{
|
{
|
||||||
std::function<int(void)> callback;
|
|
||||||
std::function<int(void)> callback;
|
std::function<int(void)> callback;
|
||||||
MapRecord* rec;
|
MapRecord* rec;
|
||||||
|
|
||||||
|
|
|
@ -2139,7 +2139,7 @@ static void rrra_specialstats()
|
||||||
{
|
{
|
||||||
ps[screenpeek].gm = MODE_EOL;
|
ps[screenpeek].gm = MODE_EOL;
|
||||||
ud.eog = 1;
|
ud.eog = 1;
|
||||||
ud.nextLevel = FindNextMap(currentLevel);
|
ud.nextLevel = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -43,7 +43,7 @@ bool cheatStuff(cheatseq_t* s);
|
||||||
bool cheatKeys(cheatseq_t* s);
|
bool cheatKeys(cheatseq_t* s);
|
||||||
bool cheatInventory(cheatseq_t* s);
|
bool cheatInventory(cheatseq_t* s);
|
||||||
|
|
||||||
static void dowarp(int volume, int level)
|
static void dowarp(MapRecord *map)
|
||||||
{
|
{
|
||||||
ud.m_monsters_off = ud.monsters_off = 0;
|
ud.m_monsters_off = ud.monsters_off = 0;
|
||||||
|
|
||||||
|
@ -54,10 +54,10 @@ static void dowarp(int volume, int level)
|
||||||
|
|
||||||
if (ps[myconnectindex].gm & MODE_GAME)
|
if (ps[myconnectindex].gm & MODE_GAME)
|
||||||
{
|
{
|
||||||
G_NewGame(volume, level, ud.m_player_skill);
|
G_NewGame(map, ud.m_player_skill);
|
||||||
ps[myconnectindex].gm = MODE_RESTART;
|
ps[myconnectindex].gm = MODE_RESTART;
|
||||||
}
|
}
|
||||||
else G_NewGame_EnterLevel(volume, level, ud.m_player_skill);
|
else G_NewGame_EnterLevel(map, ud.m_player_skill);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int ccmd_levelwarp(CCmdFuncPtr parm)
|
static int ccmd_levelwarp(CCmdFuncPtr parm)
|
||||||
|
@ -71,7 +71,13 @@ static int ccmd_levelwarp(CCmdFuncPtr parm)
|
||||||
Printf(TEXTCOLOR_RED "Invalid level!: E%sL%s\n", parm->parms[0], parm->parms[1]);
|
Printf(TEXTCOLOR_RED "Invalid level!: E%sL%s\n", parm->parms[0], parm->parms[1]);
|
||||||
return CCMD_OK;
|
return CCMD_OK;
|
||||||
}
|
}
|
||||||
dowarp(e - 1, m - 1);
|
auto map = FindMapByLevelNum(levelnum(e - 1, m - 1));
|
||||||
|
if (!map)
|
||||||
|
{
|
||||||
|
Printf(TEXTCOLOR_RED "Level not found!: E%sL%s\n", parm->parms[0], parm->parms[1]);
|
||||||
|
return CCMD_OK;
|
||||||
|
}
|
||||||
|
dowarp(map);
|
||||||
|
|
||||||
return CCMD_OK;
|
return CCMD_OK;
|
||||||
}
|
}
|
||||||
|
@ -89,36 +95,26 @@ static int ccmd_map(CCmdFuncPtr parm)
|
||||||
Printf(TEXTCOLOR_RED "map: file \"%s\" not found.\n", mapname.GetChars());
|
Printf(TEXTCOLOR_RED "map: file \"%s\" not found.\n", mapname.GetChars());
|
||||||
return CCMD_OK;
|
return CCMD_OK;
|
||||||
}
|
}
|
||||||
int volume, level;
|
|
||||||
// Check if the map is already defined.
|
// Check if the map is already defined.
|
||||||
for (int i = 0; i < 512; i++)
|
auto map = FindMapByName(mapname);
|
||||||
|
if (map == nullptr)
|
||||||
{
|
{
|
||||||
if (mapList[i].labelName.CompareNoCase(mapname) == 0)
|
// got a user map
|
||||||
{
|
|
||||||
volume = i / MAXLEVELS;
|
|
||||||
level = i % MAXLEVELS;
|
|
||||||
goto foundone;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (VOLUMEONE)
|
if (VOLUMEONE)
|
||||||
{
|
{
|
||||||
Printf(TEXTCOLOR_RED "Cannot use user maps in shareware.\n");
|
Printf(TEXTCOLOR_RED "Cannot use user maps in shareware.\n");
|
||||||
return CCMD_OK;
|
return CCMD_OK;
|
||||||
}
|
}
|
||||||
// Treat as user map if not found in the list of regular maps.
|
|
||||||
boardfilename[0] = '/';
|
|
||||||
boardfilename[1] = 0;
|
|
||||||
volume = 0;
|
|
||||||
level = 7;
|
|
||||||
DefaultExtension(mapname, ".map");
|
DefaultExtension(mapname, ".map");
|
||||||
strcat(boardfilename, mapname);
|
if (mapname[0] != '/') mapname.Insert(0, "/");
|
||||||
foundone:
|
map = SetupUserMap(mapname, !isRR() ? "dethtoll.mid" : nullptr);
|
||||||
|
}
|
||||||
if (numplayers > 1)
|
if (numplayers > 1)
|
||||||
{
|
{
|
||||||
return CCMD_OK;
|
return CCMD_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
dowarp(volume, level);
|
dowarp(map);
|
||||||
return CCMD_OK;
|
return CCMD_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -179,8 +179,10 @@ static bool cheatLevel(cheatseq_t *s)
|
||||||
levnume = (s->Args[1] - '0')*10+(s->Args[2]-'0') - 1;
|
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.
|
// Instead of hard coded range checks on volume and level, let's just check if the level is defined.
|
||||||
if (mapList[volnume*MAXLEVELS + levnume].fileName.IsNotEmpty())
|
auto map = FindMapByLevelNum(levelnum(volnume, levnume));
|
||||||
|
if (map)
|
||||||
{
|
{
|
||||||
|
ud.nextLevel = map;
|
||||||
FX_StopAllSounds();
|
FX_StopAllSounds();
|
||||||
FX_SetReverb(0);
|
FX_SetReverb(0);
|
||||||
ps[myconnectindex].gm |= MODE_RESTART;
|
ps[myconnectindex].gm |= MODE_RESTART;
|
||||||
|
|
|
@ -40,6 +40,7 @@ Prepared for public release: 03/21/2003 - Charlie Wiederhold, 3D Realms
|
||||||
#include "gstrings.h"
|
#include "gstrings.h"
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
#include "names.h"
|
#include "names.h"
|
||||||
|
#include "mapinfo.h"
|
||||||
#include "../../glbackend/glbackend.h"
|
#include "../../glbackend/glbackend.h"
|
||||||
|
|
||||||
|
|
||||||
|
@ -317,7 +318,11 @@ void GameInterface::StartGame(FNewGameStartup& gs)
|
||||||
ud.m_respawn_items = 0;
|
ud.m_respawn_items = 0;
|
||||||
ud.m_respawn_inventory = 0;
|
ud.m_respawn_inventory = 0;
|
||||||
ud.multimode = 1;
|
ud.multimode = 1;
|
||||||
G_NewGame_EnterLevel(gs.Episode, gs.Level, ud.m_player_skill);
|
auto map = FindMapByLevelNum(levelnum(gs.Episode, gs.Level));
|
||||||
|
if (map)
|
||||||
|
{
|
||||||
|
G_NewGame_EnterLevel(map, ud.m_player_skill);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -220,5 +220,6 @@ void prelevel_d(int g);
|
||||||
void prelevel_r(int g);
|
void prelevel_r(int g);
|
||||||
void e4intro(CompletionFunc completion);
|
void e4intro(CompletionFunc completion);
|
||||||
void clearfrags(void);
|
void clearfrags(void);
|
||||||
|
int exitlevel();
|
||||||
|
|
||||||
END_DUKE_NS
|
END_DUKE_NS
|
||||||
|
|
|
@ -45,8 +45,6 @@ extern int rtsplaying;
|
||||||
#ifndef ONLY_USERDEFS
|
#ifndef ONLY_USERDEFS
|
||||||
|
|
||||||
extern char boardfilename[BMAX_PATH];
|
extern char boardfilename[BMAX_PATH];
|
||||||
#define USERMAPMUSICFAKEVOLUME MAXVOLUMES
|
|
||||||
#define USERMAPMUSICFAKELEVEL (MAXLEVELS-1)
|
|
||||||
|
|
||||||
extern int32_t g_Shareware;
|
extern int32_t g_Shareware;
|
||||||
extern int32_t cameraclock;
|
extern int32_t cameraclock;
|
||||||
|
@ -90,11 +88,11 @@ static inline int32_t calc_smoothratio(ClockTicks totalclk, ClockTicks ototalclk
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static inline void G_NewGame_EnterLevel(int volume, int level, int skill)
|
static inline void G_NewGame_EnterLevel(MapRecord *map, int skill)
|
||||||
{
|
{
|
||||||
G_NewGame(volume, level, skill);
|
G_NewGame(map, skill);
|
||||||
|
|
||||||
if (G_EnterLevel(MODE_GAME))
|
if (enterlevel(map, MODE_GAME))
|
||||||
G_BackToMenu();
|
G_BackToMenu();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -42,6 +42,7 @@ into many sub-files.
|
||||||
#include "menu.h"
|
#include "menu.h"
|
||||||
#include "global.h"
|
#include "global.h"
|
||||||
#include "m_argv.h"
|
#include "m_argv.h"
|
||||||
|
#include "sounds.h"
|
||||||
|
|
||||||
BEGIN_DUKE_NS
|
BEGIN_DUKE_NS
|
||||||
|
|
||||||
|
@ -63,6 +64,16 @@ extern int* labelcode;
|
||||||
|
|
||||||
TArray<int> ScriptCode;
|
TArray<int> ScriptCode;
|
||||||
|
|
||||||
|
struct TempMusic
|
||||||
|
{
|
||||||
|
int levnum;
|
||||||
|
FString music;
|
||||||
|
};
|
||||||
|
|
||||||
|
// This is for situations where the music gets defined before the map. Since the map records do not exist yet, we need a temporary buffer.
|
||||||
|
static TArray<TempMusic> tempMusic;
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// synthesize the instruction list
|
// synthesize the instruction list
|
||||||
|
@ -752,11 +763,8 @@ int parsecommand()
|
||||||
popscriptvalue();
|
popscriptvalue();
|
||||||
transnum(); // Volume Number (0/4)
|
transnum(); // Volume Number (0/4)
|
||||||
k = popscriptvalue() - 1;
|
k = popscriptvalue() - 1;
|
||||||
|
if (k < 0) specialmusic.Clear();
|
||||||
|
|
||||||
if (k == -1) k = MAXVOLUMES;
|
|
||||||
|
|
||||||
if (k >= 0) // if it's background music
|
|
||||||
{
|
|
||||||
i = 0;
|
i = 0;
|
||||||
// get the file name...
|
// get the file name...
|
||||||
while (keyword() == -1)
|
while (keyword() == -1)
|
||||||
|
@ -775,12 +783,20 @@ int parsecommand()
|
||||||
j++;
|
j++;
|
||||||
}
|
}
|
||||||
parsebuffer.Push(0);
|
parsebuffer.Push(0);
|
||||||
mapList[(MAXLEVELS * k) + i].music = parsebuffer.Data();
|
if (k >= 0)
|
||||||
|
{
|
||||||
|
tempMusic.Reserve(1);
|
||||||
|
tempMusic.Last().levnum = levelnum(k, i);
|
||||||
|
tempMusic.Last().music = parsebuffer.Data();
|
||||||
textptr += j;
|
textptr += j;
|
||||||
if (i > MAXLEVELS) break;
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
specialmusic.Push(parsebuffer.Data());
|
||||||
|
}
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
case concmd_include:
|
case concmd_include:
|
||||||
|
@ -1395,6 +1411,7 @@ int parsecommand()
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
case concmd_definelevelname:
|
case concmd_definelevelname:
|
||||||
|
{
|
||||||
popscriptvalue();
|
popscriptvalue();
|
||||||
transnum();
|
transnum();
|
||||||
j = popscriptvalue();
|
j = popscriptvalue();
|
||||||
|
@ -1410,22 +1427,25 @@ int parsecommand()
|
||||||
textptr++, i++;
|
textptr++, i++;
|
||||||
}
|
}
|
||||||
parsebuffer.Push(0);
|
parsebuffer.Push(0);
|
||||||
mapList[j * MAXLEVELS + k].SetFileName(parsebuffer.Data());
|
auto levnum = levelnum(j, k);
|
||||||
|
auto map = FindMapByLevelNum(levnum);
|
||||||
|
if (!map) map = AllocateMap();
|
||||||
|
map->SetFileName(parsebuffer.Data());
|
||||||
|
|
||||||
while (*textptr == ' ') textptr++;
|
while (*textptr == ' ') textptr++;
|
||||||
|
|
||||||
mapList[j * MAXLEVELS + k].parTime =
|
map->parTime =
|
||||||
(((*(textptr + 0) - '0') * 10 + (*(textptr + 1) - '0')) * 26 * 60) +
|
(((*(textptr + 0) - '0') * 10 + (*(textptr + 1) - '0')) * 26 * 60) +
|
||||||
(((*(textptr + 3) - '0') * 10 + (*(textptr + 4) - '0')) * 26);
|
(((*(textptr + 3) - '0') * 10 + (*(textptr + 4) - '0')) * 26);
|
||||||
|
|
||||||
textptr += 5;
|
textptr += 5;
|
||||||
while (*textptr == ' ') textptr++;
|
while (*textptr == ' ') textptr++;
|
||||||
|
|
||||||
mapList[j * MAXLEVELS + k].designerTime =
|
map->designerTime =
|
||||||
(((*(textptr + 0) - '0') * 10 + (*(textptr + 1) - '0')) * 26 * 60) +
|
(((*(textptr + 0) - '0') * 10 + (*(textptr + 1) - '0')) * 26 * 60) +
|
||||||
(((*(textptr + 3) - '0') * 10 + (*(textptr + 4) - '0')) * 26);
|
(((*(textptr + 3) - '0') * 10 + (*(textptr + 4) - '0')) * 26);
|
||||||
|
|
||||||
mapList[j * MAXLEVELS + k].levelNumber = k + j * 100;
|
map->levelNumber = levnum;
|
||||||
|
|
||||||
textptr += 5;
|
textptr += 5;
|
||||||
while (*textptr == ' ') textptr++;
|
while (*textptr == ' ') textptr++;
|
||||||
|
@ -1439,9 +1459,9 @@ int parsecommand()
|
||||||
textptr++, i++;
|
textptr++, i++;
|
||||||
}
|
}
|
||||||
parsebuffer.Push(0);
|
parsebuffer.Push(0);
|
||||||
mapList[j * MAXLEVELS + k].name = parsebuffer.Data();
|
map->name = parsebuffer.Data();
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
case concmd_definequote:
|
case concmd_definequote:
|
||||||
popscriptvalue();
|
popscriptvalue();
|
||||||
transnum();
|
transnum();
|
||||||
|
@ -1703,6 +1723,12 @@ void loadcons(const char* filenam)
|
||||||
// These can only be retrieved AFTER loading the scripts.
|
// These can only be retrieved AFTER loading the scripts.
|
||||||
InitGameVarPointers();
|
InitGameVarPointers();
|
||||||
ResetSystemDefaults();
|
ResetSystemDefaults();
|
||||||
|
for (auto& tm : tempMusic)
|
||||||
|
{
|
||||||
|
auto map = FindMapByLevelNum(tm.levnum);
|
||||||
|
if (map) map->music = tm.music;
|
||||||
|
}
|
||||||
|
tempMusic.Clear();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -560,6 +560,7 @@ void InitGameVarPointers(void)
|
||||||
//
|
//
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// These are deliberately not stored in accessible variables anymore
|
||||||
int getmap() { return mapfromlevelnum(currentLevel->levelNumber); }
|
int getmap() { return mapfromlevelnum(currentLevel->levelNumber); }
|
||||||
int getvol() { return volfromlevelnum(currentLevel->levelNumber); }
|
int getvol() { return volfromlevelnum(currentLevel->levelNumber); }
|
||||||
|
|
||||||
|
|
|
@ -40,15 +40,12 @@ BEGIN_DUKE_NS
|
||||||
|
|
||||||
#define MOVEFIFOSIZ 256
|
#define MOVEFIFOSIZ 256
|
||||||
|
|
||||||
#define MAXLEVELS 64
|
|
||||||
#define MAXGAMETYPES 16
|
#define MAXGAMETYPES 16
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
MUS_FIRST_SPECIAL = MAXVOLUMES * MAXLEVELS,
|
MUS_INTRO = 0,
|
||||||
|
MUS_BRIEFING = 1,
|
||||||
MUS_INTRO = MUS_FIRST_SPECIAL,
|
MUS_LOADING = 2,
|
||||||
MUS_BRIEFING = MUS_FIRST_SPECIAL + 1,
|
|
||||||
MUS_LOADING = MUS_FIRST_SPECIAL + 2,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -127,8 +124,7 @@ G_EXTERN int32_t g_earthquakeTime;
|
||||||
G_EXTERN int32_t g_freezerSelfDamage;
|
G_EXTERN int32_t g_freezerSelfDamage;
|
||||||
#define freezerhurtowner g_freezerSelfDamage
|
#define freezerhurtowner g_freezerSelfDamage
|
||||||
G_EXTERN int32_t g_gameQuit;
|
G_EXTERN int32_t g_gameQuit;
|
||||||
G_EXTERN int32_t g_globalRandom;
|
G_EXTERN int32_t global_random;
|
||||||
#define global_random g_globalRandom
|
|
||||||
G_EXTERN int32_t impact_damage;
|
G_EXTERN int32_t impact_damage;
|
||||||
extern int32_t labelcnt;
|
extern int32_t labelcnt;
|
||||||
G_EXTERN int32_t g_maxPlayerHealth;
|
G_EXTERN int32_t g_maxPlayerHealth;
|
||||||
|
@ -220,7 +216,7 @@ G_EXTERN int16_t fakebubba_spawn, mamaspawn_count, banjosound, g_bellTime, BellS
|
||||||
#define BellTime g_bellTime
|
#define BellTime g_bellTime
|
||||||
#define word_119BE0 BellSprite
|
#define word_119BE0 BellSprite
|
||||||
G_EXTERN uint8_t g_spriteExtra[MAXSPRITES], g_sectorExtra[MAXSECTORS]; // move these back into the base structs!
|
G_EXTERN uint8_t g_spriteExtra[MAXSPRITES], g_sectorExtra[MAXSECTORS]; // move these back into the base structs!
|
||||||
G_EXTERN uint8_t enemysizecheat, ufospawnsminion, pistonsound, chickenphase, RRRA_ExitedLevel, RRRA_EndEpisode, fogactive;
|
G_EXTERN uint8_t enemysizecheat, ufospawnsminion, pistonsound, chickenphase, RRRA_ExitedLevel, fogactive;
|
||||||
G_EXTERN int32_t g_cdTrack;
|
G_EXTERN int32_t g_cdTrack;
|
||||||
#define raat607 enemysizecheat // only as a reminder
|
#define raat607 enemysizecheat // only as a reminder
|
||||||
#define raat605 chickenphase
|
#define raat605 chickenphase
|
||||||
|
@ -241,7 +237,6 @@ G_EXTERN player_orig po[MAXPLAYERS];
|
||||||
#pragma pack(pop)
|
#pragma pack(pop)
|
||||||
|
|
||||||
G_EXTERN uint32_t everyothertime;
|
G_EXTERN uint32_t everyothertime;
|
||||||
G_EXTERN uint32_t g_moveThingsCount;
|
|
||||||
G_EXTERN double g_gameUpdateTime;
|
G_EXTERN double g_gameUpdateTime;
|
||||||
G_EXTERN double g_gameUpdateAndDrawTime;
|
G_EXTERN double g_gameUpdateAndDrawTime;
|
||||||
#define GAMEUPDATEAVGTIMENUMSAMPLES 100
|
#define GAMEUPDATEAVGTIMENUMSAMPLES 100
|
||||||
|
|
|
@ -908,17 +908,6 @@ int enterlevel(MapRecord *mi, int gamemode)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//---------------------------------------------------------------------------
|
|
||||||
|
|
||||||
void setmapfog(int fogtype)
|
|
||||||
{
|
|
||||||
GLInterface.SetMapFog(fogtype != 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// Ideally this will become the only place where map progression gets set up.
|
// Ideally this will become the only place where map progression gets set up.
|
||||||
|
@ -964,4 +953,58 @@ bool setnextmap(bool checksecretexit)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
int exitlevel(void)
|
||||||
|
{
|
||||||
|
bool endofgame = ud.eog || (currentLevel->flags & MI_FORCEEOG) || ud.nextLevel == nullptr;
|
||||||
|
STAT_Update(endofgame);
|
||||||
|
setpal(&ps[myconnectindex]);
|
||||||
|
|
||||||
|
if (ps[myconnectindex].gm & MODE_RESTART)
|
||||||
|
{
|
||||||
|
ud.nextLevel = currentLevel;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ps[myconnectindex].gm & MODE_EOL)
|
||||||
|
{
|
||||||
|
ready2send = 0;
|
||||||
|
dobonus(0);
|
||||||
|
|
||||||
|
// Clear potentially loaded per-map ART only after the bonus screens.
|
||||||
|
artClearMapArt();
|
||||||
|
|
||||||
|
if (endofgame)
|
||||||
|
{
|
||||||
|
ud.eog = 0;
|
||||||
|
if (ud.multimode < 2)
|
||||||
|
{
|
||||||
|
if (!VOLUMEALL)
|
||||||
|
doorders([](bool) {});
|
||||||
|
ps[myconnectindex].gm = 0;
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ud.nextLevel = FindMapByLevelNum(0);
|
||||||
|
if (!ud.nextLevel) return 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ready2send = 0;
|
||||||
|
|
||||||
|
if (numplayers > 1)
|
||||||
|
ps[myconnectindex].gm = MODE_GAME;
|
||||||
|
|
||||||
|
int res = enterlevel(ud.nextLevel, ps[myconnectindex].gm);
|
||||||
|
ud.nextLevel = nullptr;
|
||||||
|
return res ? 2 : 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
END_DUKE_NS
|
END_DUKE_NS
|
|
@ -29,10 +29,8 @@ 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(MapRecord *mi, int gameMode);
|
int enterlevel(MapRecord *mi, int gameMode);
|
||||||
int G_FindLevelByFile(const char *fileName);
|
void G_NewGame(MapRecord *mi, int skillNum);
|
||||||
void G_NewGame(int volumeNum, int levelNum, int skillNum);
|
|
||||||
void G_ResetTimers(uint8_t keepgtics);
|
|
||||||
void P_ResetPlayer(int pn);
|
void P_ResetPlayer(int pn);
|
||||||
void G_ResetInterpolations(void);
|
void G_ResetInterpolations(void);
|
||||||
void G_InitRRRASkies(void);
|
void G_InitRRRASkies(void);
|
||||||
|
|
|
@ -44,6 +44,8 @@ source as it is released.
|
||||||
|
|
||||||
BEGIN_DUKE_NS
|
BEGIN_DUKE_NS
|
||||||
|
|
||||||
|
TArray<FString> specialmusic;
|
||||||
|
|
||||||
class DukeSoundEngine : public SoundEngine
|
class DukeSoundEngine : public SoundEngine
|
||||||
{
|
{
|
||||||
// client specific parts of the sound engine go in this class.
|
// client specific parts of the sound engine go in this class.
|
||||||
|
@ -546,7 +548,7 @@ int S_CheckSoundPlaying(int soundNum)
|
||||||
void S_MenuSound(void)
|
void S_MenuSound(void)
|
||||||
{
|
{
|
||||||
static int menunum;
|
static int menunum;
|
||||||
int/*static const short*/ menusnds[] =
|
static const short menusnds[] =
|
||||||
{
|
{
|
||||||
LASERTRIP_EXPLODE,
|
LASERTRIP_EXPLODE,
|
||||||
DUKE_GRUNT,
|
DUKE_GRUNT,
|
||||||
|
@ -587,12 +589,11 @@ void S_PlayLevelMusic(MapRecord *mi)
|
||||||
|
|
||||||
void S_PlaySpecialMusic(unsigned int m)
|
void S_PlaySpecialMusic(unsigned int m)
|
||||||
{
|
{
|
||||||
if (isRR()) return; // Can only be MUS_LOADING, isRR() does not use it.
|
if (isRR() || m >= specialmusic.Size()) return; // Can only be MUS_LOADING, isRR() does not use it.
|
||||||
auto& musicfn = mapList[m].music;
|
auto& musicfn = specialmusic[m];
|
||||||
if (musicfn.IsNotEmpty())
|
if (musicfn.IsNotEmpty())
|
||||||
{
|
{
|
||||||
Mus_Play(nullptr, musicfn, true);
|
Mus_Play(nullptr, musicfn, true);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -109,6 +109,8 @@ inline bool StartCommentary(int tag, int sprnum)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern TArray<FString> specialmusic;
|
||||||
|
|
||||||
|
|
||||||
END_DUKE_NS
|
END_DUKE_NS
|
||||||
|
|
||||||
|
|
|
@ -133,13 +133,13 @@ void G_NewGame(MapRecord *map, int skillNum)
|
||||||
|
|
||||||
void resetpspritevars(int gameMode);
|
void resetpspritevars(int gameMode);
|
||||||
|
|
||||||
static inline void clearfrags(void)
|
void clearfrags(void)
|
||||||
{
|
{
|
||||||
for (int 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;
|
||||||
Bmemset(pPlayerData->frags, 0, sizeof(pPlayerData->frags));
|
memset(pPlayerData->frags, 0, sizeof(pPlayerData->frags));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -30,6 +30,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
|
||||||
BEGIN_RR_NS
|
BEGIN_RR_NS
|
||||||
|
|
||||||
|
extern MapRecord userMapRecord;
|
||||||
|
|
||||||
class DukeSoundEngine : public SoundEngine
|
class DukeSoundEngine : public SoundEngine
|
||||||
{
|
{
|
||||||
// client specific parts of the sound engine go in this class.
|
// client specific parts of the sound engine go in this class.
|
||||||
|
|
Loading…
Reference in a new issue