- removed network code because whatever gets done here, this code won't be it.

This commit is contained in:
Christoph Oelckers 2020-05-20 11:06:55 +02:00
parent 603afdde87
commit f437015350
10 changed files with 2 additions and 4005 deletions

View file

@ -354,7 +354,6 @@ extern void G_MaybeAllocPlayer(int32_t pnum);
static inline void G_HandleAsync(void)
{
handleevents();
Net_GetPackets();
}
static inline int32_t calc_smoothratio(ClockTicks totalclk, ClockTicks ototalclk)

View file

@ -30,6 +30,7 @@ struct ENetPacket;
BEGIN_DUKE_NS
// net packet specification/compatibility version
#define NETVERSION 1
@ -40,11 +41,7 @@ extern char g_netPassword[32];
extern int32_t g_netDisconnect;
extern int32_t g_netPlayersWaiting;
extern uint16_t g_netPort;
#ifndef NETCODE_DISABLE
extern int32_t g_networkMode;
#else
#define g_networkMode 0
#endif
extern int32_t g_netIndex;
extern int32_t lastsectupdate[MAXSECTORS];
extern int32_t lastupdate[MAXSPRITES];
@ -192,124 +189,9 @@ typedef struct
extern newgame_t pendingnewgame;
#ifndef NETCODE_DISABLE
// Sync
void initsynccrc(void);
char Net_PlayerSync(void);
char Net_PlayerSync2(void);
char Net_ActorSync(void);
char Net_WeaponSync(void);
char Net_MapSync(void);
char Net_RandomSync(void);
void Net_GetSyncStat(void);
void Net_DisplaySyncMsg(void);
void Net_AddSyncInfoToPacket(int* j);
void Net_GetSyncInfoFromPacket(uint8_t* packbuf, int packbufleng, int* j, int otherconnectindex);
// Connect/Disconnect
void Net_Connect(const char *srvaddr);
void Net_Disconnect(void);
void Net_ReceiveDisconnect(ENetEvent *event);
// Packet Handlers
#endif
void Net_ClearFIFO(void);
void Net_GetInput(void);
void Net_GetPackets(void);
#ifndef NETCODE_DISABLE
void Net_SendPacket(int32_t dest, uint8_t* pbuf, int32_t packbufleng);
void Net_HandleServerPackets(void);
void Net_HandleClientPackets(void);
void Net_ParseClientPacket(ENetEvent *event);
void Net_ParseServerPacket(ENetEvent *event);
void Net_ParsePacketCommon(uint8_t *pbuf, int32_t packbufleng, int32_t serverpacketp);
void Net_SendAcknowledge(ENetPeer *client);
void Net_ReceiveAcknowledge(uint8_t *pbuf, int32_t packbufleng);
void Net_SendChallenge();
void Net_ReceiveChallenge(uint8_t *pbuf, int32_t packbufleng, ENetEvent *event);
void Net_SendNewPlayer(int32_t newplayerindex);
void Net_ReceiveNewPlayer(uint8_t *pbuf, int32_t packbufleng);
void Net_SendPlayerIndex(int32_t index, ENetPeer *peer);
void Net_ReceivePlayerIndex(uint8_t *pbuf, int32_t packbufleng);
void Net_SendClientInfo(void);
void Net_ReceiveClientInfo(uint8_t *pbuf, int32_t packbufleng, int32_t fromserver);
void Net_SendUserMapName(void);
void Net_ReceiveUserMapName(uint8_t *pbuf, int32_t packbufleng);
//netmapstate_t *Net_GetRevision(uint8_t revision, uint8_t cancreate);
//void Net_SendMapUpdate(void);
//void Net_ReceiveMapUpdate(ENetEvent *event);
//void Net_FillMapDiff(uint32_t fromRevision, uint32_t toRevision);
//void Net_SaveMapState(netmapstate_t *save);
//void Net_RestoreMapState();
//void Net_CopyToNet(int32_t i, netactor_t *netactor);
//void Net_CopyFromNet(int32_t i, netactor_t *netactor);
//int32_t Net_ActorsAreDifferent(netactor_t *actor1, netactor_t *actor2);
//int32_t Net_IsRelevantSprite(int32_t i);
//int32_t Net_IsRelevantStat(int32_t stat);
//int32_t Net_InsertSprite(int32_t sect, int32_t stat);
//void Net_DeleteSprite(int32_t spritenum);
//void Net_FillPlayerUpdate(playerupdate_t *update, int32_t player);
//void Net_ExtractPlayerUpdate(playerupdate_t *update, int32_t type);
void Net_SendServerUpdates(void);
void Net_ReceiveServerUpdate(ENetEvent *event);
void Net_SendClientUpdate(void);
void Net_ReceiveClientUpdate(ENetEvent *event);
void Net_SendMessage(void);
void Net_ReceiveMessage(uint8_t *pbuf, int32_t packbufleng);
void Net_StartNewGame();
void Net_NotifyNewGame();
void Net_SendNewGame(int32_t frommenu, ENetPeer *peer);
void Net_ReceiveNewGame(ENetEvent* event);
void Net_FillNewGame(newgame_t *newgame, int32_t frommenu);
void Net_ExtractNewGame(newgame_t *newgame, int32_t menuonly);
void Net_SendMapVoteInitiate(void);
void Net_ReceiveMapVoteInitiate(uint8_t *pbuf);
void Net_SendMapVote(int32_t votefor);
void Net_ReceiveMapVote(uint8_t *pbuf);
void Net_CheckForEnoughVotes();
void Net_SendMapVoteCancel(int32_t failed);
void Net_ReceiveMapVoteCancel(uint8_t *pbuf);
//////////
void Net_ResetPrediction(void);
void Net_DoPrediction(void);
void Net_CorrectPrediction(void);
void Net_SpawnPlayer(int32_t player);
void Net_SyncPlayer(ENetEvent *event);
void Net_WaitForEverybody(void);
void Net_Update(void);
void Net_PostPacket(ENetPacket *packet);
void faketimerhandler(void);
void Net_SendTaunt(int ridiculeNum);
void Net_SendRTS(int ridiculeNum);
void Net_InitNetwork();
void Net_PrintLag(FString& output);
#else
/* NETCODE_ENABLE is not defined */
// Connect/Disconnect
@ -404,8 +286,6 @@ void Net_PrintLag(FString& output);
#define Net_ClearFIFO(...) ((void)0)
#define Net_GetInput(...) ((void)0)
#endif
END_DUKE_NS
#endif // netplay_h_

View file

@ -421,7 +421,6 @@ inline void setpal(DukePlayer_t* pPlayer)
void P_EndLevel(void);
void P_CheckWeaponI(int playerNum);
int P_GetHudPal(const DukePlayer_t *pPlayer);
int P_GetOverheadPal(const DukePlayer_t *pPlayer);
void madenoise(int playerNum);
int haskey(int sect, int snum);
@ -429,23 +428,7 @@ int haskey(int sect, int snum);
// Get the player index given an TILE_APLAYER sprite pointer.
static inline int P_GetP(const void *pSprite)
{
#if 0 // unprotected player index retrieval
return spr->yvel;
#elif defined NETCODE_DISABLE
UNREFERENCED_PARAMETER(pSprite); // for NDEBUG build
// NOTE: In the no-netcode build, there's no point to pass player indices
// at all since there is ever only one player. However, merely returning 0
// would mean making this build less strict than the normal one.
Bassert(((const uspritetype *)pSprite)->yvel == 0);
return 0;
#else
int playerNum = ((const uspritetype *)pSprite)->yvel;
// [JM] Check against MAXPLAYERS as opposed to g_mostConcurrentPlayers
// to prevent CON for disconnected/fake players from executing as playernum 0.
if ((unsigned)playerNum >= MAXPLAYERS)
playerNum = 0;
return playerNum;
#endif
return ((const uspritetype*)pSprite)->yvel;
}
// Get the player index given an TILE_APLAYER sprite index.

View file

@ -599,11 +599,6 @@ void G_DoCheats(void)
ud.volume_number = volnume;
ud.level_number = levnume;
#if 0
if (numplayers > 1 && g_netServer)
Net_NewGame(volnume, levnume);
else
#endif
pPlayer->gm |= MODE_RESTART;
}
@ -616,11 +611,6 @@ void G_DoCheats(void)
g_lastLevel = 0;
ud.player_skill = ud.m_player_skill;
#if 0
if (numplayers > 1 && g_netServer)
Net_NewGame(ud.m_volume_number, m_level_number);
else
#endif
pPlayer->gm |= MODE_RESTART;
end_cheat(pPlayer);

View file

@ -3891,9 +3891,6 @@ int GameInterface::app_main()
if (g_scriptDebug)
Printf("CON debugging activated (level %d).\n",g_scriptDebug);
#ifndef NETCODE_DISABLE
Net_InitNetwork();
#endif
numplayers = 1;
g_mostConcurrentPlayers = ud.multimode;

File diff suppressed because it is too large Load diff

View file

@ -371,40 +371,6 @@ static int osdcmd_give(CCmdFuncPtr parm)
return OSDCMD_SHOWHELP;
}
#if !defined NETCODE_DISABLE
static int osdcmd_disconnect(CCmdFuncPtr UNUSED(parm))
{
UNREFERENCED_CONST_PARAMETER(parm);
// NUKE-TODO:
if (g_player[myconnectindex].ps->gm&MODE_MENU)
g_netDisconnect = 1;
return OSDCMD_OK;
}
static int osdcmd_connect(CCmdFuncPtr parm)
{
if (parm->numparms != 1)
return OSDCMD_SHOWHELP;
Net_Connect(parm->parms[0]);
G_BackToMenu();
return OSDCMD_OK;
}
static int osdcmd_password(CCmdFuncPtr parm)
{
if (parm->numparms < 1)
{
Bmemset(g_netPassword, 0, sizeof(g_netPassword));
return OSDCMD_OK;
}
Bstrncpy(g_netPassword, (parm->raw) + 9, sizeof(g_netPassword)-1);
return OSDCMD_OK;
}
int osdcmd_listplayers(CCmdFuncPtr parm);
#endif
int32_t registerosdcommands(void)
@ -417,32 +383,11 @@ int32_t registerosdcommands(void)
}
C_RegisterFunction("levelwarp","levelwarp <e> <m>: warp to episode 'e' and map 'm'", osdcmd_levelwarp);
#if !defined NETCODE_DISABLE
C_RegisterFunction("connect","connect: connects to a multiplayer game", osdcmd_connect);
C_RegisterFunction("disconnect","disconnect: disconnects from the local multiplayer game", osdcmd_disconnect);
#endif
C_RegisterFunction("give","give <all|health|weapons|ammo|armor|keys|inventory>: gives requested item", osdcmd_give);
C_RegisterFunction("god","god: toggles god mode", osdcmd_god);
C_RegisterFunction("activatecheat","activatecheat <id>: activates a cheat code", osdcmd_activatecheat);
#ifdef DEBUGGINGAIDS
C_RegisterFunction("inittimer","debug", osdcmd_inittimer);
#endif
#if !defined NETCODE_DISABLE
#if 0
C_RegisterFunction("kick","kick <id>: kicks a multiplayer client. See listplayers.", osdcmd_kick);
C_RegisterFunction("kickban","kickban <id>: kicks a multiplayer client and prevents them from reconnecting. See listplayers.", osdcmd_kickban);
#endif
C_RegisterFunction("listplayers","listplayers: lists currently connected multiplayer clients", osdcmd_listplayers);
#endif
C_RegisterFunction("noclip","noclip: toggles clipping mode", osdcmd_noclip);
#if !defined NETCODE_DISABLE
C_RegisterFunction("password","password: sets multiplayer game password", osdcmd_password);
#endif
C_RegisterFunction("restartmap", "restartmap: restarts the current map", osdcmd_restartmap);
C_RegisterFunction("spawn","spawn <picnum> [palnum] [cstat] [ang] [x y z]: spawns a sprite with the given properties",osdcmd_spawn);

View file

@ -34,10 +34,6 @@ int32_t PHEIGHT = PHEIGHT_DUKE;
int32_t lastvisinc;
hudweapon_t hudweap;
#ifdef SPLITSCREEN_MOD_HACKS
static int32_t g_snum;
#endif
extern int32_t g_levelTextTime, ticrandomseed;
int32_t g_numObituaries = 0;

View file

@ -2155,32 +2155,6 @@ int G_FindLevelByFile(const char *fileName)
return MAXLEVELS * MAXVOLUMES;
}
#if 0
static void G_FadeLoad(int32_t r, int32_t g, int32_t b, int32_t start, int32_t end, int32_t step, int32_t ticwait, int32_t tc)
{
int32_t m = (step < 0) ? -1 : 1;
int32_t nexttic = totalclock;
for (; m*start <= m*end; start += step)
{
while (totalclock < nexttic)
sampletimer();
nexttic += ticwait;
if (inputState.GetKeyStatus(sc_Space))
{
inputState.ClearKeyStatus(sc_Space);
return;
}
setpalettefade(r,g,b,start);
flushperms();
G_DoLoadScreen(" ", tc);
}
}
#endif
static int G_TryMapHack(const char *mhkfile)
{
int32_t failure = engineLoadMHK(mhkfile);

View file

@ -608,11 +608,6 @@ FString GameInterface::statFPS()
output.AppendFormat("G_MoveActors(): %.3f ms\n", g_moveActorsTime);
output.AppendFormat("G_MoveWorld(): %.3f ms\n", g_moveWorldTime);
}
// lag meter
#ifndef NETCODE_DISABLE
Net_PrintLag(output);
#endif
}
if (cumulativeFrameDelay >= 1000.0)