- removed most of the network code in Blood.

Mainly to expose the parts that still get used in single player because there's some problems here that need addressing.
ENet is also gone now.
This commit is contained in:
Christoph Oelckers 2020-08-03 20:01:08 +02:00
parent dea0804f9a
commit 0036402be8
10 changed files with 13 additions and 6963 deletions

View File

@ -766,7 +766,6 @@ set (PCH_SOURCES
thirdparty/src/base64.cpp thirdparty/src/base64.cpp
thirdparty/src/fix16.cpp thirdparty/src/fix16.cpp
thirdparty/src/md4.cpp thirdparty/src/md4.cpp
thirdparty/src/enet.cpp
# Todo: Split out the license-safe code from this. # Todo: Split out the license-safe code from this.
build/src/animvpx.cpp build/src/animvpx.cpp

View File

@ -525,7 +525,7 @@ void StartLevel(GAMEOPTIONS *gameOptions)
if (!bVanilla && !gMe->packSlots[1].isActive) // if diving suit is not active, turn off reverb sound effect if (!bVanilla && !gMe->packSlots[1].isActive) // if diving suit is not active, turn off reverb sound effect
sfxSetReverb(0); sfxSetReverb(0);
ambInit(); ambInit();
sub_79760(); netReset();
gFrame = 0; gFrame = 0;
gChokeCounter = 0; gChokeCounter = 0;
M_ClearMenus(); M_ClearMenus();
@ -557,12 +557,14 @@ void ProcessFrame(void)
gPlayer[i].input.q16mlook = gFifoInput[gNetFifoTail&255][i].q16mlook; gPlayer[i].input.q16mlook = gFifoInput[gNetFifoTail&255][i].q16mlook;
} }
gNetFifoTail++; gNetFifoTail++;
#if 0
if (!(gFrame&7)) if (!(gFrame&7))
{ {
CalcGameChecksum(); CalcGameChecksum();
memcpy(gCheckFifo[gCheckHead[myconnectindex]&255][myconnectindex], gChecksum, sizeof(gChecksum)); memcpy(gCheckFifo[gCheckHead[myconnectindex]&255][myconnectindex], gChecksum, sizeof(gChecksum));
gCheckHead[myconnectindex]++; gCheckHead[myconnectindex]++;
} }
#endif
for (int i = connecthead; i >= 0; i = connectpoint2[i]) for (int i = connecthead; i >= 0; i = connectpoint2[i])
{ {
if (gPlayer[i].input.keyFlags.quit) if (gPlayer[i].input.keyFlags.quit)
@ -797,7 +799,7 @@ static void app_init()
static void gameInit() static void gameInit()
{ {
//RESTART: //RESTART:
sub_79760(); netReset();
gViewIndex = myconnectindex; gViewIndex = myconnectindex;
gMe = gView = &gPlayer[myconnectindex]; gMe = gView = &gPlayer[myconnectindex];
netBroadcastPlayerInfo(myconnectindex); netBroadcastPlayerInfo(myconnectindex);
@ -848,7 +850,6 @@ static void gameTicker()
break; break;
if (i >= 0) if (i >= 0)
break; break;
//faketimerhandler();
ProcessFrame(); ProcessFrame();
gameUpdate = true; gameUpdate = true;
} }

View File

@ -36,6 +36,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "view.h" #include "view.h"
#include "d_event.h" #include "d_event.h"
#include "gamestate.h" #include "gamestate.h"
#include "sound.h"
BEGIN_BLD_NS BEGIN_BLD_NS
@ -119,7 +120,8 @@ void LocalKeys(void)
char fk = key - sc_F1; char fk = key - sc_F1;
if (alt) if (alt)
{ {
netBroadcastTaunt(myconnectindex, fk); sndStartSample(4400 + fk, 128, 1, 0);
//netBroadcastTaunt(myconnectindex, fk);
} }
else else
{ {
@ -129,7 +131,7 @@ void LocalKeys(void)
buttonMap.ClearButton(gamefunc_Third_Person_View); buttonMap.ClearButton(gamefunc_Third_Person_View);
return; return;
} }
} }
} }

View File

@ -331,7 +331,7 @@ void CPlayerMsg::Send(void)
{ {
if (VanillaMode() || !IsWhitespaceOnly(text)) if (VanillaMode() || !IsWhitespaceOnly(text))
{ {
netBroadcastMessage(myconnectindex, text); //netBroadcastMessage(myconnectindex, text);
if (!VanillaMode()) if (!VanillaMode())
{ {
char *myName = gProfile[myconnectindex].name; char *myName = gProfile[myconnectindex].name;

File diff suppressed because it is too large Load Diff

View File

@ -138,13 +138,10 @@ inline void GetPacketBuffer(char *&p, void *pBuffer, int size)
p += size; p += size;
} }
void sub_79760(void); void netReset(void);
void netResetToSinglePlayer(void); void netResetToSinglePlayer(void);
void netBroadcastMessage(int nPlayer, const char *pzMessage);
void netWaitForEveryone(char a1); void netWaitForEveryone(char a1);
void sub_7AC28(const char *pzString);
void netGetPackets(void); void netGetPackets(void);
void netBroadcastTaunt(int nPlayer, int nTaunt);
void CalcGameChecksum(void); void CalcGameChecksum(void);
void netBroadcastPlayerLogoff(int nPlayer); void netBroadcastPlayerLogoff(int nPlayer);
void netBroadcastMyLogoff(bool bRestart); void netBroadcastMyLogoff(bool bRestart);
@ -154,7 +151,6 @@ void netCheckSync(void);
void netMasterUpdate(void); void netMasterUpdate(void);
void netGetInput(void); void netGetInput(void);
void netPlayerQuit(int nPlayer); void netPlayerQuit(int nPlayer);
void netUpdate(void);
void netDeinitialize(void); void netDeinitialize(void);
void netBroadcastNewGame(void); void netBroadcastNewGame(void);

View File

@ -957,13 +957,6 @@ char PickupItem(PLAYER *pPlayer, spritetype *pItem) {
sprintf(buffer, "%s captured Red Flag!", gProfile[pPlayer->nPlayer].name); sprintf(buffer, "%s captured Red Flag!", gProfile[pPlayer->nPlayer].name);
sndStartSample(8001, 255, 2, 0); sndStartSample(8001, 255, 2, 0);
viewSetMessage(buffer); viewSetMessage(buffer);
#if 0
if (dword_28E3D4 == 3 && myconnectindex == connecthead)
{
sprintf(buffer, "frag A killed B\n");
sub_7AC28(buffer);
}
#endif
} }
} }
@ -1001,13 +994,6 @@ char PickupItem(PLAYER *pPlayer, spritetype *pItem) {
sprintf(buffer, "%s captured Blue Flag!", gProfile[pPlayer->nPlayer].name); sprintf(buffer, "%s captured Blue Flag!", gProfile[pPlayer->nPlayer].name);
sndStartSample(8000, 255, 2, 0); sndStartSample(8000, 255, 2, 0);
viewSetMessage(buffer); viewSetMessage(buffer);
#if 0
if (dword_28E3D4 == 3 && myconnectindex == connecthead)
{
sprintf(buffer, "frag B killed A\n");
sub_7AC28(buffer);
}
#endif
} }
} }
} }
@ -1842,12 +1828,6 @@ void playerFrag(PLAYER *pKiller, PLAYER *pVictim)
dassert(nKiller >= 0 && nKiller < kMaxPlayers); dassert(nKiller >= 0 && nKiller < kMaxPlayers);
int nVictim = pVictim->pSprite->type-kDudePlayer1; int nVictim = pVictim->pSprite->type-kDudePlayer1;
dassert(nVictim >= 0 && nVictim < kMaxPlayers); dassert(nVictim >= 0 && nVictim < kMaxPlayers);
if (myconnectindex == connecthead)
{
sprintf(buffer, "frag %d killed %d\n", pKiller->nPlayer+1, pVictim->nPlayer+1);
sub_7AC28(buffer);
buffer[0] = 0;
}
if (nKiller == nVictim) if (nKiller == nVictim)
{ {
pVictim->fraggerId = -1; pVictim->fraggerId = -1;

View File

@ -113,8 +113,6 @@ int ShowStartupWindow(TArray<GrpEntry> &);
FString GetGameFronUserFiles(); FString GetGameFronUserFiles();
void InitFileSystem(TArray<GrpEntry>&); void InitFileSystem(TArray<GrpEntry>&);
void I_SetWindowTitle(const char* caption); void I_SetWindowTitle(const char* caption);
void InitENet();
void ShutdownENet();
void S_ParseSndInfo(); void S_ParseSndInfo();
void I_DetectOS(void); void I_DetectOS(void);
void LoadScripts(); void LoadScripts();
@ -548,7 +546,6 @@ int GameMain()
delete gi; delete gi;
gi = nullptr; gi = nullptr;
} }
InitENet();
DeleteStartupScreen(); DeleteStartupScreen();
PClass::StaticShutdown(); PClass::StaticShutdown();
if (Args) delete Args; if (Args) delete Args;
@ -763,7 +760,6 @@ int RunGame()
I_DetectOS(); I_DetectOS();
userConfig.ProcessOptions(); userConfig.ProcessOptions();
G_LoadConfig(); G_LoadConfig();
ShutdownENet();
auto usedgroups = SetupGame(); auto usedgroups = SetupGame();

File diff suppressed because it is too large Load Diff

View File

@ -1,18 +0,0 @@
#define ENET_IMPLEMENTATION
#include "enet.h"
#include "printf.h"
bool gHaveNetworking;
void ShutdownENet()
{
if (gHaveNetworking) enet_deinitialize();
}
void InitENet()
{
gHaveNetworking = !enet_initialize();
if (!gHaveNetworking)
Printf("An error occurred while initializing ENet.\n");
}