mirror of
https://github.com/DrBeef/Raze.git
synced 2024-11-15 08:52:00 +00:00
- Blood code cleanup
deleting blocks of unused code, in particular some networking leftovers. Also moving a few functions around
This commit is contained in:
parent
6726c19f9c
commit
31fc39b051
18 changed files with 107 additions and 378 deletions
|
@ -136,6 +136,52 @@ void AddCmdDefine(char *text, int value)
|
|||
nCmdDefines++;
|
||||
}
|
||||
|
||||
static void SplitPath(const char *pzPath, char *pzDirectory, char *pzFile, char *pzType)
|
||||
{
|
||||
int const nLength = strlen(pzPath);
|
||||
const char *pDirectory = pzPath+nLength;
|
||||
const char *pDot = NULL;
|
||||
for (int i = nLength-1; i >= 0; i--)
|
||||
{
|
||||
if (pzPath[i] == '/' || pzPath[i] == '\\')
|
||||
{
|
||||
strncpy(pzDirectory, pzPath, i);
|
||||
pzDirectory[i] = 0;
|
||||
if (!pDot)
|
||||
{
|
||||
strcpy(pzFile, pzPath+i+1);
|
||||
strcpy(pzType, "");
|
||||
}
|
||||
else
|
||||
{
|
||||
strncpy(pzFile, pzPath+i+1, pDot-(pzPath+i+1));
|
||||
pzFile[pDot-(pzPath+i+1)] = 0;
|
||||
strcpy(pzType, pDot+1);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
else if (pzPath[i] == '.')
|
||||
{
|
||||
pDot = pzPath+i;
|
||||
}
|
||||
}
|
||||
strcpy(pzDirectory, "/");
|
||||
if (!pDot)
|
||||
{
|
||||
strcpy(pzFile, pzPath);
|
||||
strcpy(pzType, "");
|
||||
}
|
||||
else
|
||||
{
|
||||
strncpy(pzFile, pzPath, pDot-pzPath);
|
||||
pzFile[pDot-pzPath] = 0;
|
||||
strcpy(pzType, pDot+1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// 174 bytes
|
||||
struct RFS
|
||||
{
|
||||
|
|
|
@ -110,8 +110,6 @@ void StartLevel(MapRecord *level)
|
|||
EndLevel();
|
||||
gInput = {};
|
||||
gStartNewGame = nullptr;
|
||||
ready2send = 0;
|
||||
netWaitForEveryone(0);
|
||||
currentLevel = level;
|
||||
|
||||
if (gGameOptions.nGameType == 0)
|
||||
|
@ -255,11 +253,9 @@ void StartLevel(MapRecord *level)
|
|||
M_ClearMenus();
|
||||
// viewSetMessage("");
|
||||
viewSetErrorMessage("");
|
||||
netWaitForEveryone(0);
|
||||
gameclock = 0;
|
||||
lastTic = -1;
|
||||
paused = 0;
|
||||
ready2send = 1;
|
||||
levelTryPlayMusic();
|
||||
}
|
||||
|
||||
|
@ -281,31 +277,6 @@ void ProcessFrame(void)
|
|||
}
|
||||
gNetFifoTail++;
|
||||
|
||||
#if 0
|
||||
for (int i = connecthead; i >= 0; i = connectpoint2[i])
|
||||
{
|
||||
if (gPlayer[i].input.syncFlags.quit)
|
||||
{
|
||||
gPlayer[i].input.syncFlags.quit = 0;
|
||||
netBroadcastPlayerLogoff(i);
|
||||
if (i == myconnectindex)
|
||||
{
|
||||
// netBroadcastMyLogoff(gQuitRequest == 2);
|
||||
gQuitGame = true;
|
||||
gRestartGame = gQuitRequest == 2;
|
||||
netDeinitialize();
|
||||
netResetToSinglePlayer();
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (gPlayer[i].input.syncFlags.restart)
|
||||
{
|
||||
gPlayer[i].input.syncFlags.restart = 0;
|
||||
levelRestart();
|
||||
return;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
// This is single player only.
|
||||
if (gameRestart)
|
||||
{
|
||||
|
@ -364,18 +335,6 @@ void ProcessFrame(void)
|
|||
gFrameClock += 4;
|
||||
if ((gGameOptions.uGameFlags&1) != 0 && !gStartNewGame)
|
||||
{
|
||||
ready2send = 0;
|
||||
#if 0
|
||||
if (gNetPlayers > 1 && gNetMode == NETWORK_SERVER && gPacketMode == PACKETMODE_1 && myconnectindex == connecthead)
|
||||
{
|
||||
while (gNetFifoMasterTail < gNetFifoTail)
|
||||
{
|
||||
netGetPackets();
|
||||
h andleevents();
|
||||
netMasterUpdate();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
seqKillAll();
|
||||
if (gGameOptions.uGameFlags&2)
|
||||
{
|
||||
|
@ -414,11 +373,6 @@ void ProcessFrame(void)
|
|||
|
||||
|
||||
|
||||
void ParseOptions(void)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void ReadAllRFS();
|
||||
|
||||
void GameInterface::app_init()
|
||||
|
@ -458,7 +412,6 @@ void GameInterface::app_init()
|
|||
Printf(PRINT_NONOTIFY, "Initializing weapon animations\n");
|
||||
WeaponInit();
|
||||
LoadSaveSetup();
|
||||
LoadSavedInfo();
|
||||
|
||||
Printf(PRINT_NONOTIFY, "Initializing network users\n");
|
||||
netInitialize(true);
|
||||
|
@ -479,19 +432,7 @@ static void gameInit()
|
|||
gViewIndex = myconnectindex;
|
||||
gMe = gView = &gPlayer[myconnectindex];
|
||||
netBroadcastPlayerInfo(myconnectindex);
|
||||
#if 0
|
||||
Printf("Waiting for network players!\n");
|
||||
netWaitForEveryone(0);
|
||||
if (gRestartGame)
|
||||
{
|
||||
// Network error
|
||||
gQuitGame = false;
|
||||
gRestartGame = false;
|
||||
netDeinitialize();
|
||||
netResetToSinglePlayer();
|
||||
goto RESTART;
|
||||
}
|
||||
#endif
|
||||
|
||||
UpdateNetworkMenus();
|
||||
gQuitGame = 0;
|
||||
gRestartGame = 0;
|
||||
|
@ -510,8 +451,8 @@ static void gameTicker()
|
|||
{
|
||||
viewUpdatePrediction(&gFifoInput[gPredictTail & 255][myconnectindex]);
|
||||
}
|
||||
if (numplayers == 1)
|
||||
gBufferJitter = 0;
|
||||
|
||||
int gBufferJitter = 0;
|
||||
|
||||
int const currentTic = I_GetTime();
|
||||
gameclock = I_GetBuildTime();
|
||||
|
@ -519,7 +460,7 @@ static void gameTicker()
|
|||
gameupdatetime.Reset();
|
||||
gameupdatetime.Clock();
|
||||
|
||||
while (currentTic - lastTic >= 1 && ready2send)
|
||||
while (currentTic - lastTic >= 1)
|
||||
{
|
||||
gNetInput = gInput;
|
||||
gInput = {};
|
||||
|
@ -544,8 +485,6 @@ static void gameTicker()
|
|||
videoClearScreen(0);
|
||||
else
|
||||
{
|
||||
netCheckSync();
|
||||
|
||||
drawtime.Reset();
|
||||
drawtime.Clock();
|
||||
viewDrawScreen();
|
||||
|
@ -557,10 +496,6 @@ static void drawBackground()
|
|||
{
|
||||
twod->ClearScreen();
|
||||
DrawTexture(twod, tileGetTexture(2518, true), 0, 0, DTA_FullscreenEx, FSMode_ScaleToFit43, TAG_DONE);
|
||||
#if 0
|
||||
if (gQuitRequest && !gQuitGame)
|
||||
netBroadcastMyLogoff(gQuitRequest == 2);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void commonTicker()
|
||||
|
@ -617,7 +552,6 @@ static void commonTicker()
|
|||
void GameInterface::RunGameFrame()
|
||||
{
|
||||
commonTicker();
|
||||
netGetPackets();
|
||||
ctrlGetInput();
|
||||
|
||||
switch (gamestate)
|
||||
|
@ -661,26 +595,10 @@ void GameInterface::RunGameFrame()
|
|||
}
|
||||
}
|
||||
|
||||
bool DemoRecordStatus(void) {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool VanillaMode() {
|
||||
return false;
|
||||
}
|
||||
|
||||
int sndTryPlaySpecialMusic(int nMusic)
|
||||
{
|
||||
if (Mus_Play(nullptr, quoteMgr.GetQuote(nMusic), true))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
void sndPlaySpecialMusicOrNothing(int nMusic)
|
||||
{
|
||||
if (sndTryPlaySpecialMusic(nMusic))
|
||||
if (!Mus_Play(nullptr, quoteMgr.GetQuote(nMusic), true))
|
||||
{
|
||||
Mus_Stop();
|
||||
}
|
||||
|
@ -690,7 +608,6 @@ extern IniFile* BloodINI;
|
|||
void GameInterface::FreeGameData()
|
||||
{
|
||||
if (BloodINI) delete BloodINI;
|
||||
netDeinitialize();
|
||||
}
|
||||
|
||||
ReservedSpace GameInterface::GetReservedScreenSpace(int viewsize)
|
||||
|
|
|
@ -60,9 +60,16 @@ void PreloadCache(void);
|
|||
void StartLevel(MapRecord *gameOptions);
|
||||
void ProcessFrame(void);
|
||||
void ScanINIFiles(void);
|
||||
bool DemoRecordStatus(void);
|
||||
bool VanillaMode(void);
|
||||
int sndTryPlaySpecialMusic(int nMusic);
|
||||
|
||||
inline bool DemoRecordStatus(void)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
inline bool VanillaMode()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
void sndPlaySpecialMusicOrNothing(int nMusic);
|
||||
|
||||
struct GameInterface : ::GameInterface
|
||||
|
|
|
@ -44,21 +44,8 @@ bool bSilentAim = false;
|
|||
|
||||
int iTurnCount = 0;
|
||||
|
||||
void ctrlInit(void)
|
||||
{
|
||||
}
|
||||
|
||||
void ctrlTerm(void)
|
||||
{
|
||||
}
|
||||
|
||||
int32_t mouseyaxismode = -1;
|
||||
|
||||
int32_t GetTime(void)
|
||||
{
|
||||
return gameclock;
|
||||
}
|
||||
|
||||
fixed_t gViewLook, gViewAngle;
|
||||
float gViewAngleAdjust;
|
||||
float gViewLookAdjust;
|
||||
|
|
|
@ -34,7 +34,6 @@ extern float gViewAngleAdjust;
|
|||
extern float gViewLookAdjust;
|
||||
extern int gViewLookRecenter;
|
||||
|
||||
void ctrlInit();
|
||||
void ctrlGetInput();
|
||||
|
||||
END_BLD_NS
|
||||
|
|
|
@ -42,6 +42,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
#include "gstrings.h"
|
||||
#include "gamestate.h"
|
||||
#include "raze_sound.h"
|
||||
#include "d_net.h"
|
||||
|
||||
BEGIN_BLD_NS
|
||||
|
||||
|
@ -120,20 +121,9 @@ void CEndGameMgr::Draw(void)
|
|||
|
||||
void CEndGameMgr::ProcessKeys(void)
|
||||
{
|
||||
//if (dword_28E3D4 == 1)
|
||||
//{
|
||||
// if (gGameOptions.gameType >= 0 || numplayers > 1)
|
||||
// netWaitForEveryone(0);
|
||||
// Finish();
|
||||
//}
|
||||
//else
|
||||
{
|
||||
if (!inputState.CheckAllInput())
|
||||
return;
|
||||
if (gGameOptions.nGameType > 0 || numplayers > 1)
|
||||
netWaitForEveryone(0);
|
||||
Finish();
|
||||
}
|
||||
}
|
||||
|
||||
extern void EndLevel(void);
|
||||
|
@ -148,13 +138,11 @@ void CEndGameMgr::Setup(void)
|
|||
sndStartSample(268, 128, -1, false);
|
||||
}
|
||||
|
||||
extern int gInitialNetPlayers;
|
||||
|
||||
void CEndGameMgr::Finish(void)
|
||||
{
|
||||
int ep = volfromlevelnum(currentLevel->levelNumber);
|
||||
gStartNewGame = FindMapByLevelNum(levelnum(ep, gNextLevel));
|
||||
gInitialNetPlayers = numplayers;
|
||||
soundEngine->StopAllChannels();
|
||||
at0 = 0;
|
||||
}
|
||||
|
@ -211,13 +199,13 @@ void CKillMgr::Draw(void)
|
|||
viewDrawText(3, GStrings("NAME"), 100, 35, -128, 0, 0, 1);
|
||||
viewDrawText(3, GStrings("FRAGS"), 210, 35, -128, 0, 0, 1);
|
||||
int nStart = 0;
|
||||
int nEnd = gInitialNetPlayers;
|
||||
int nEnd = kMaxPlayers;
|
||||
//if (dword_28E3D4 == 1)
|
||||
//{
|
||||
// nStart++;
|
||||
// nEnd++;
|
||||
//}
|
||||
for (int i = nStart; i < nEnd; i++)
|
||||
for (int i = nStart; i < nEnd; i++) if (playeringame[i])
|
||||
{
|
||||
sprintf(pBuffer, "%-2d", i);
|
||||
viewDrawText(3, pBuffer, 85, 50+8*i, -128, 0, 0, 1);
|
||||
|
|
|
@ -35,6 +35,45 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
|
||||
BEGIN_BLD_NS
|
||||
|
||||
static void *ResReadLine(char *buffer, unsigned int nBytes, void **pRes)
|
||||
{
|
||||
unsigned int i;
|
||||
char ch;
|
||||
if (!pRes || !*pRes || *((char*)*pRes) == 0)
|
||||
return NULL;
|
||||
for (i = 0; i < nBytes; i++)
|
||||
{
|
||||
ch = *((char*)*pRes);
|
||||
if(ch == 0 || ch == '\n')
|
||||
break;
|
||||
buffer[i] = ch;
|
||||
*pRes = ((char*)*pRes)+1;
|
||||
}
|
||||
if (*((char*)*pRes) == '\n' && i < nBytes)
|
||||
{
|
||||
ch = *((char*)*pRes);
|
||||
buffer[i] = ch;
|
||||
*pRes = ((char*)*pRes)+1;
|
||||
i++;
|
||||
}
|
||||
else
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
ch = *((char*)*pRes);
|
||||
if (ch == 0 || ch == '\n')
|
||||
break;
|
||||
*pRes = ((char*)*pRes)+1;
|
||||
}
|
||||
if (*((char*)*pRes) == '\n')
|
||||
*pRes = ((char*)*pRes)+1;
|
||||
}
|
||||
if (i < nBytes)
|
||||
buffer[i] = 0;
|
||||
return *pRes;
|
||||
}
|
||||
|
||||
|
||||
|
||||
IniFile::IniFile(const char *fileName)
|
||||
{
|
||||
|
|
|
@ -58,7 +58,6 @@ int gNextLevel; // fixme: let this contain a full level number.
|
|||
int gLevelTime;
|
||||
|
||||
char BloodIniFile[BMAX_PATH] = "BLOOD.INI";
|
||||
char BloodIniPre[BMAX_PATH];
|
||||
bool bINIOverride = false;
|
||||
IniFile *BloodINI;
|
||||
|
||||
|
@ -69,8 +68,6 @@ void levelInitINI(const char *pzIni)
|
|||
ThrowError("Initialization: %s does not exist", pzIni);
|
||||
BloodINI = new IniFile(pzIni);
|
||||
Bstrncpy(BloodIniFile, pzIni, BMAX_PATH);
|
||||
Bstrncpy(BloodIniPre, pzIni, BMAX_PATH);
|
||||
ChangeExtension(BloodIniPre, "");
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -81,7 +81,6 @@ extern GAMEOPTIONS gSingleGameOptions;
|
|||
extern GAMEOPTIONS gGameOptions;
|
||||
extern int gSkill;
|
||||
extern char BloodIniFile[];
|
||||
extern char BloodIniPre[];
|
||||
extern bool bINIOverride;
|
||||
extern int gEpisodeCount;
|
||||
extern int gNextLevel;
|
||||
|
|
|
@ -501,31 +501,17 @@ bool GameInterface::LoadGame(FSaveGameNode* node)
|
|||
if (!bVanilla && !gMe->packSlots[1].isActive) // if diving suit is not active, turn off reverb sound effect
|
||||
sfxSetReverb(0);
|
||||
ambInit();
|
||||
memset(myMinLag, 0, sizeof(myMinLag));
|
||||
otherMinLag = 0;
|
||||
myMaxLag = 0;
|
||||
gNetFifoTail = 0;
|
||||
memset(gNetFifoHead, 0, sizeof(gNetFifoHead));
|
||||
gPredictTail = 0;
|
||||
gNetFifoMasterTail = 0;
|
||||
memset(gFifoInput, 0, sizeof(gFifoInput));
|
||||
gSendCheckTail = 0;
|
||||
gCheckTail = 0;
|
||||
gBufferJitter = 0;
|
||||
bOutOfSync = 0;
|
||||
for (int i = 0; i < gNetPlayers; i++)
|
||||
playerSetRace(&gPlayer[i], gPlayer[i].lifeMode);
|
||||
viewSetErrorMessage("");
|
||||
if (gamestate != GS_LEVEL)
|
||||
{
|
||||
netWaitForEveryone(0);
|
||||
memset(gPlayerReady, 0, sizeof(gPlayerReady));
|
||||
}
|
||||
gFrameCount = 0;
|
||||
gameclock = 0;
|
||||
lastTic = -1;
|
||||
paused = 0;
|
||||
ready2send = 1;
|
||||
gamestate = GS_LEVEL;
|
||||
bVanilla = false;
|
||||
|
||||
|
@ -762,14 +748,6 @@ void MyLoadSave::Save(void)
|
|||
Write(skyInfo, sizeof(*skyInfo));
|
||||
}
|
||||
|
||||
void LoadSavedInfo(void)
|
||||
{
|
||||
}
|
||||
|
||||
void UpdateSavedInfo(int nSlot)
|
||||
{
|
||||
}
|
||||
|
||||
static MyLoadSave *myLoadSave;
|
||||
|
||||
|
||||
|
|
|
@ -45,8 +45,6 @@ public:
|
|||
static void SaveGame(FSavegameNode*);
|
||||
};
|
||||
|
||||
void UpdateSavedInfo(int nSlot);
|
||||
void LoadSavedInfo(void);
|
||||
void LoadSaveSetup(void);
|
||||
|
||||
END_BLD_NS
|
||||
|
|
|
@ -50,12 +50,9 @@ MIRROR mirror[16];
|
|||
|
||||
void InitMirrors(void)
|
||||
{
|
||||
|
||||
#ifdef USE_OPENGL
|
||||
r_rortexture = 4080;
|
||||
r_rortexturerange = 16;
|
||||
|
||||
#endif
|
||||
mirrorcnt = 0;
|
||||
tileDelete(504);
|
||||
|
||||
|
@ -342,9 +339,7 @@ void DrawMirrors(int x, int y, int z, fixed_t a, fixed_t horiz, int smooth, int
|
|||
{
|
||||
renderPrepareMirror(x,y,z,a,horiz,nWall,&cx,&cy,&ca);
|
||||
}
|
||||
yax_preparedrawrooms();
|
||||
int32_t didmirror = renderDrawRoomsQ16(cx, cy, z, ca,horiz,mirrorsector|MAXSECTORS);
|
||||
yax_drawrooms(viewProcessSprites, mirrorsector, didmirror, smooth);
|
||||
viewProcessSprites(cx,cy,z,FixedToInt(ca),smooth);
|
||||
renderDrawMasks();
|
||||
if (GetWallType(nWall) != kWallStack)
|
||||
|
@ -357,9 +352,6 @@ void DrawMirrors(int x, int y, int z, fixed_t a, fixed_t horiz, int smooth, int
|
|||
}
|
||||
case 1:
|
||||
{
|
||||
#ifdef USE_OPENGL
|
||||
r_rorphase = 1;
|
||||
#endif
|
||||
int nSector = mirror[i].at4;
|
||||
int bakCstat;
|
||||
if (viewPlayer >= 0)
|
||||
|
@ -374,9 +366,7 @@ void DrawMirrors(int x, int y, int z, fixed_t a, fixed_t horiz, int smooth, int
|
|||
gPlayer[viewPlayer].pSprite->cstat |= 514;
|
||||
}
|
||||
}
|
||||
yax_preparedrawrooms();
|
||||
renderDrawRoomsQ16(x+mirror[i].at8, y+mirror[i].atc, z+mirror[i].at10, a, horiz, nSector|MAXSECTORS);
|
||||
yax_drawrooms(viewProcessSprites, nSector, 0, smooth);
|
||||
viewProcessSprites(x+mirror[i].at8, y+mirror[i].atc, z+mirror[i].at10, FixedToInt(a), smooth);
|
||||
short fstat = sector[nSector].floorstat;
|
||||
sector[nSector].floorstat |= 1;
|
||||
|
@ -388,16 +378,10 @@ void DrawMirrors(int x, int y, int z, fixed_t a, fixed_t horiz, int smooth, int
|
|||
{
|
||||
gPlayer[viewPlayer].pSprite->cstat = bakCstat;
|
||||
}
|
||||
#ifdef USE_OPENGL
|
||||
r_rorphase = 0;
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
case 2:
|
||||
{
|
||||
#ifdef USE_OPENGL
|
||||
r_rorphase = 1;
|
||||
#endif
|
||||
int nSector = mirror[i].at4;
|
||||
int bakCstat;
|
||||
if (viewPlayer >= 0)
|
||||
|
@ -426,9 +410,7 @@ void DrawMirrors(int x, int y, int z, fixed_t a, fixed_t horiz, int smooth, int
|
|||
{
|
||||
gPlayer[viewPlayer].pSprite->cstat = bakCstat;
|
||||
}
|
||||
#ifdef USE_OPENGL
|
||||
r_rorphase = 0;
|
||||
#endif
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,44 +30,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
|
||||
BEGIN_BLD_NS
|
||||
|
||||
void *ResReadLine(char *buffer, unsigned int nBytes, void **pRes)
|
||||
{
|
||||
unsigned int i;
|
||||
char ch;
|
||||
if (!pRes || !*pRes || *((char*)*pRes) == 0)
|
||||
return NULL;
|
||||
for (i = 0; i < nBytes; i++)
|
||||
{
|
||||
ch = *((char*)*pRes);
|
||||
if(ch == 0 || ch == '\n')
|
||||
break;
|
||||
buffer[i] = ch;
|
||||
*pRes = ((char*)*pRes)+1;
|
||||
}
|
||||
if (*((char*)*pRes) == '\n' && i < nBytes)
|
||||
{
|
||||
ch = *((char*)*pRes);
|
||||
buffer[i] = ch;
|
||||
*pRes = ((char*)*pRes)+1;
|
||||
i++;
|
||||
}
|
||||
else
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
ch = *((char*)*pRes);
|
||||
if (ch == 0 || ch == '\n')
|
||||
break;
|
||||
*pRes = ((char*)*pRes)+1;
|
||||
}
|
||||
if (*((char*)*pRes) == '\n')
|
||||
*pRes = ((char*)*pRes)+1;
|
||||
}
|
||||
if (i < nBytes)
|
||||
buffer[i] = 0;
|
||||
return *pRes;
|
||||
}
|
||||
|
||||
unsigned int randSeed = 1;
|
||||
|
||||
unsigned int qrand(void)
|
||||
|
@ -92,75 +54,5 @@ void wsrand(int seed)
|
|||
wRandSeed = seed;
|
||||
}
|
||||
|
||||
void ChangeExtension(char *pzFile, const char *pzExt)
|
||||
{
|
||||
#if 0
|
||||
char drive[BMAX_PATH];
|
||||
char dir[BMAX_PATH];
|
||||
char filename[BMAX_PATH];
|
||||
_splitpath(pzFile, drive, dir, filename, NULL);
|
||||
_makepath(pzFile, drive, dir, filename, pzExt);
|
||||
#else
|
||||
int const nLength = Bstrlen(pzFile);
|
||||
char * pDot = pzFile+nLength;
|
||||
for (int i = nLength-1; i >= 0; i--)
|
||||
{
|
||||
if (pzFile[i] == '/' || pzFile[i] == '\\')
|
||||
break;
|
||||
if (pzFile[i] == '.')
|
||||
{
|
||||
pDot = pzFile+i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
*pDot = '\0';
|
||||
Bstrcat(pDot, pzExt);
|
||||
#endif
|
||||
}
|
||||
|
||||
void SplitPath(const char *pzPath, char *pzDirectory, char *pzFile, char *pzType)
|
||||
{
|
||||
int const nLength = Bstrlen(pzPath);
|
||||
const char *pDirectory = pzPath+nLength;
|
||||
const char *pDot = NULL;
|
||||
for (int i = nLength-1; i >= 0; i--)
|
||||
{
|
||||
if (pzPath[i] == '/' || pzPath[i] == '\\')
|
||||
{
|
||||
Bstrncpy(pzDirectory, pzPath, i);
|
||||
pzDirectory[i] = 0;
|
||||
if (!pDot)
|
||||
{
|
||||
Bstrcpy(pzFile, pzPath+i+1);
|
||||
Bstrcpy(pzType, "");
|
||||
}
|
||||
else
|
||||
{
|
||||
Bstrncpy(pzFile, pzPath+i+1, pDot-(pzPath+i+1));
|
||||
pzFile[pDot-(pzPath+i+1)] = 0;
|
||||
Bstrcpy(pzType, pDot+1);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
else if (pzPath[i] == '.')
|
||||
{
|
||||
pDot = pzPath+i;
|
||||
}
|
||||
}
|
||||
Bstrcpy(pzDirectory, "/");
|
||||
if (!pDot)
|
||||
{
|
||||
Bstrcpy(pzFile, pzPath);
|
||||
Bstrcpy(pzType, "");
|
||||
}
|
||||
else
|
||||
{
|
||||
Bstrncpy(pzFile, pzPath, pDot-pzPath);
|
||||
pzFile[pDot-pzPath] = 0;
|
||||
Bstrcpy(pzType, pDot+1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
END_BLD_NS
|
||||
|
|
|
@ -28,12 +28,9 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
BEGIN_BLD_NS
|
||||
|
||||
void playlogos();
|
||||
void *ResReadLine(char *buffer, unsigned int nBytes, void **pRes);
|
||||
unsigned int qrand(void);
|
||||
int wrand(void);
|
||||
void wsrand(int);
|
||||
void ChangeExtension(char *pzFile, const char *pzExt);
|
||||
void SplitPath(const char *pzPath, char *pzDirectory, char *pzFile, char *pzType);
|
||||
void FireInit(void);
|
||||
void FireProcess(void);
|
||||
void UpdateNetworkMenus(void);
|
||||
|
|
|
@ -39,39 +39,17 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
BEGIN_BLD_NS
|
||||
|
||||
MapRecord *gStartNewGame = 0;
|
||||
PACKETMODE gPacketMode = PACKETMODE_1;
|
||||
int gNetFifoTail = 0;
|
||||
int gNetFifoHead[8];
|
||||
int gPredictTail = 0;
|
||||
int gNetFifoMasterTail = 0;
|
||||
InputPacket gFifoInput[256][8];
|
||||
int myMinLag[8];
|
||||
int otherMinLag = 0;
|
||||
int myMaxLag = 0;
|
||||
int gSendCheckTail = 0;
|
||||
int gCheckTail = 0;
|
||||
int gInitialNetPlayers = 0;
|
||||
int gBufferJitter = 1;
|
||||
int gPlayerReady[8];
|
||||
bool bNoResend = true;
|
||||
bool gRobust = false;
|
||||
bool bOutOfSync = false;
|
||||
bool ready2send = false;
|
||||
|
||||
NETWORKMODE gNetMode = NETWORK_NONE;
|
||||
char gNetAddress[32];
|
||||
// PORT-TODO: Use different port?
|
||||
int gNetPort = kNetDefaultPort;
|
||||
|
||||
const short word_1328AC = 0x214;
|
||||
|
||||
void netResetToSinglePlayer(void)
|
||||
{
|
||||
myconnectindex = connecthead = 0;
|
||||
gInitialNetPlayers = gNetPlayers = numplayers = 1;
|
||||
gNetPlayers = numplayers = 1;
|
||||
connectpoint2[0] = -1;
|
||||
gGameOptions.nGameType = 0;
|
||||
gNetMode = NETWORK_NONE;
|
||||
UpdateNetworkMenus();
|
||||
}
|
||||
|
||||
|
@ -79,17 +57,9 @@ void netReset(void)
|
|||
{
|
||||
gFrameClock = gameclock = 0;
|
||||
lastTic = -1;
|
||||
gNetFifoMasterTail = 0;
|
||||
gPredictTail = 0;
|
||||
gNetFifoTail = 0;
|
||||
memset(gNetFifoHead, 0, sizeof(gNetFifoHead));
|
||||
memset(myMinLag, 0, sizeof(myMinLag));
|
||||
otherMinLag = 0;
|
||||
myMaxLag = 0;
|
||||
gSendCheckTail = 0;
|
||||
gCheckTail = 0;
|
||||
bOutOfSync = 0;
|
||||
gBufferJitter = 1;
|
||||
}
|
||||
|
||||
void netBroadcastPlayerInfo(int nPlayer)
|
||||
|
@ -99,8 +69,6 @@ void netBroadcastPlayerInfo(int nPlayer)
|
|||
pProfile->skill = gSkill;
|
||||
pProfile->nAutoAim = cl_autoaim;
|
||||
pProfile->nWeaponSwitch = cl_weaponswitch;
|
||||
if (numplayers < 2)
|
||||
return;
|
||||
}
|
||||
|
||||
void netGetInput(void)
|
||||
|
@ -111,35 +79,13 @@ void netGetInput(void)
|
|||
InputPacket &input = gFifoInput[gNetFifoHead[myconnectindex]&255][myconnectindex];
|
||||
input = gNetInput;
|
||||
gNetFifoHead[myconnectindex]++;
|
||||
if (gGameOptions.nGameType == 0 || numplayers == 1)
|
||||
{
|
||||
for (int p = connecthead; p >= 0; p = connectpoint2[p])
|
||||
{
|
||||
if (p != myconnectindex)
|
||||
{
|
||||
InputPacket *pInput1 = &gFifoInput[(gNetFifoHead[p]-1)&255][p];
|
||||
InputPacket *pInput2 = &gFifoInput[gNetFifoHead[p]&255][p];
|
||||
memcpy(pInput2, pInput1, sizeof(InputPacket));
|
||||
gNetFifoHead[p]++;
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void netInitialize(bool bConsole)
|
||||
{
|
||||
memset(gPlayerReady, 0, sizeof(gPlayerReady));
|
||||
netReset();
|
||||
netResetToSinglePlayer();
|
||||
}
|
||||
|
||||
void netDeinitialize(void)
|
||||
{
|
||||
}
|
||||
|
||||
void netPlayerQuit(int nPlayer)
|
||||
{
|
||||
}
|
||||
|
||||
END_BLD_NS
|
||||
|
|
|
@ -28,58 +28,16 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
|
||||
BEGIN_BLD_NS
|
||||
|
||||
enum PACKETMODE {
|
||||
PACKETMODE_0 = 0,
|
||||
PACKETMODE_1,
|
||||
PACKETMODE_2,
|
||||
PACKETMODE_3,
|
||||
};
|
||||
|
||||
enum NETWORKMODE {
|
||||
NETWORK_NONE = 0,
|
||||
NETWORK_SERVER,
|
||||
NETWORK_CLIENT
|
||||
};
|
||||
|
||||
#define kNetDefaultPort 23513
|
||||
|
||||
extern MapRecord *gStartNewGame;
|
||||
extern PACKETMODE gPacketMode;
|
||||
extern int gNetFifoTail;
|
||||
extern int gNetFifoHead[8];
|
||||
extern int gPredictTail;
|
||||
extern int gNetFifoMasterTail;
|
||||
extern InputPacket gFifoInput[256][8];
|
||||
extern int myMinLag[8];
|
||||
extern int otherMinLag;
|
||||
extern int myMaxLag;
|
||||
extern int gSendCheckTail;
|
||||
extern int gCheckTail;
|
||||
extern int gInitialNetPlayers;
|
||||
extern int gBufferJitter;
|
||||
extern int gPlayerReady[8];
|
||||
extern bool bNoResend;
|
||||
extern bool gRobust;
|
||||
extern bool bOutOfSync;
|
||||
extern bool ready2send;
|
||||
extern NETWORKMODE gNetMode;
|
||||
extern char gNetAddress[32];
|
||||
extern int gNetPort;
|
||||
|
||||
|
||||
void netReset(void);
|
||||
void netResetToSinglePlayer(void);
|
||||
inline void netWaitForEveryone(char a1) {}
|
||||
inline void netGetPackets(void) {}
|
||||
inline void CalcGameChecksum(void) {}
|
||||
inline void netBroadcastPlayerLogoff(int nPlayer) {}
|
||||
inline void netBroadcastMyLogoff(bool bRestart) {}
|
||||
void netInitialize(bool bConsole);
|
||||
void netBroadcastPlayerInfo(int nPlayer);
|
||||
inline void netCheckSync(void) {}
|
||||
void netMasterUpdate(void);
|
||||
void netGetInput(void);
|
||||
void netPlayerQuit(int nPlayer);
|
||||
void netDeinitialize(void);
|
||||
|
||||
END_BLD_NS
|
||||
|
|
|
@ -273,8 +273,6 @@ void nnExtInitModernStuff(bool bSaveLoad) {
|
|||
|
||||
}*/
|
||||
|
||||
if (!gAllowTrueRandom) Printf("> STD randomness is not available, using in-game random function(s)");
|
||||
else Printf("> Using STD randomness function(s).");
|
||||
|
||||
for (int i = 0; i < kMaxXSprites; i++) {
|
||||
|
||||
|
|
|
@ -50,6 +50,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
#include "view.h"
|
||||
#include "messages.h"
|
||||
#include "nnexts.h"
|
||||
#include "d_net.h"
|
||||
|
||||
BEGIN_BLD_NS
|
||||
|
||||
|
@ -250,7 +251,7 @@ void LifeLeechOperate(spritetype *pSprite, XSPRITE *pXSprite, EVENT event)
|
|||
case kCmdSpritePush:
|
||||
{
|
||||
int nPlayer = pXSprite->data4;
|
||||
if (nPlayer >= 0 && nPlayer < gNetPlayers)
|
||||
if (nPlayer >= 0 && nPlayer < kMaxPlayers && playeringame[nPlayer])
|
||||
{
|
||||
PLAYER *pPlayer = &gPlayer[nPlayer];
|
||||
if (pPlayer->pXSprite->health > 0)
|
||||
|
|
Loading…
Reference in a new issue