diff --git a/source/games/duke/src/d_menu.cpp b/source/games/duke/src/d_menu.cpp index 7df808484..e5f9bd965 100644 --- a/source/games/duke/src/d_menu.cpp +++ b/source/games/duke/src/d_menu.cpp @@ -216,7 +216,7 @@ void GameInterface::DrawNativeMenuText(int fontnum, int state, double oxpos, dou void GameInterface::MenuOpened() { S_PauseSounds(true); - if ((!g_netServer && ud.multimode < 2)) + if (ud.multimode < 2) { ready2send = 0; totalclock = ototalclock; @@ -267,7 +267,7 @@ void GameInterface::MenuClosed() // The following lines are here so that you cannot close the menu when no game is running. gm &= ~MODE_MENU; - if ((!g_netServer && ud.multimode < 2) && ud.recstat != 2) + if (ud.multimode < 2 && ud.recstat != 2) { ready2send = 1; totalclock = ototalclock; diff --git a/source/games/duke/src/game.h b/source/games/duke/src/game.h index 22464e2f7..da7f91cc9 100644 --- a/source/games/duke/src/game.h +++ b/source/games/duke/src/game.h @@ -252,10 +252,8 @@ static inline void G_HandleAsync(void) static inline int32_t calc_smoothratio(ClockTicks totalclk, ClockTicks ototalclk) { - if (!(((!g_netServer && ud.multimode < 2) && ((g_player[myconnectindex].ps->gm & MODE_MENU) == 0)) || - (g_netServer || ud.multimode > 1) || - ud.recstat == 2) || - ud.pause_on) + if (!((ud.multimode < 2 && ((g_player[myconnectindex].ps->gm & MODE_MENU) == 0)) || + ud.multimode > 1 || ud.recstat == 2) || ud.pause_on) { return 65536; } diff --git a/source/games/duke/src/game_misc.cpp b/source/games/duke/src/game_misc.cpp index 479a6bdbb..99e9514c4 100644 --- a/source/games/duke/src/game_misc.cpp +++ b/source/games/duke/src/game_misc.cpp @@ -132,7 +132,7 @@ void checkcommandline() void gameexitfrommenu() { // MP scoreboard - if (playerswhenstarted > 1 && g_player[myconnectindex].ps->gm & MODE_GAME && GTFLAGS(GAMETYPE_SCORESHEET)) + if (playerswhenstarted > 1 && g_player[myconnectindex].ps->gm & MODE_GAME && !ud.coop) { G_BonusScreen(1); } diff --git a/source/games/duke/src/net.h b/source/games/duke/src/net.h index 77c28d5b9..32d805eaf 100644 --- a/source/games/duke/src/net.h +++ b/source/games/duke/src/net.h @@ -30,127 +30,7 @@ struct ENetPacket; BEGIN_DUKE_NS - -// net packet specification/compatibility version -#define NETVERSION 1 - -extern ENetHost *g_netClient; -extern ENetHost *g_netServer; -extern ENetPeer *g_netClientPeer; -extern char g_netPassword[32]; -extern int32_t g_netDisconnect; -extern int32_t g_netPlayersWaiting; -extern uint16_t g_netPort; -#define g_networkMode 0 -extern int32_t g_netIndex; -extern int32_t lastsectupdate[MAXSECTORS]; -extern int32_t lastupdate[MAXSPRITES]; -extern int32_t lastwallupdate[MAXWALLS]; -extern int16_t g_netStatnums[]; - -#define NET_REVISIONS 64 - -enum netchan_t -{ - CHAN_REROUTE, - CHAN_GAME, - //CHAN_MOVE, // unreliable movement packets - CHAN_GAMESTATE, // gamestate changes... frags, respawns, player names, etc - CHAN_CHAT, // chat and RTS - //CHAN_MISC, // whatever else - CHAN_MAX -}; - -enum ServicePacket_t -{ - SERVICEPACKET_TYPE_SENDTOID, -}; - -enum DukePacket_t -{ - PACKET_TYPE_MASTER_TO_SLAVE, - PACKET_TYPE_SLAVE_TO_MASTER, - PACKET_TYPE_BROADCAST, - SERVER_GENERATED_BROADCAST, - //PACKET_TYPE_VERSION, - - /* don't change anything above this line */ - - //PACKET_TYPE_MESSAGE, - // - //PACKET_TYPE_NEW_GAME, - //PACKET_TYPE_RTS, - //PACKET_TYPE_MENU_LEVEL_QUIT, - //PACKET_TYPE_WEAPON_CHOICE, - //PACKET_TYPE_PLAYER_OPTIONS, - //PACKET_TYPE_PLAYER_NAME, - //PACKET_TYPE_INIT_SETTINGS, - // - //PACKET_TYPE_USER_MAP, - // - //PACKET_TYPE_MAP_VOTE, - //PACKET_TYPE_MAP_VOTE_INITIATE, - //PACKET_TYPE_MAP_VOTE_CANCEL, - // - //PACKET_TYPE_LOAD_GAME, - PACKET_TYPE_NULL_PACKET, - PACKET_TYPE_PLAYER_READY, - //PACKET_TYPE_FRAGLIMIT_CHANGED, - //PACKET_TYPE_EOL, - //PACKET_TYPE_QUIT = 255, // should match mmulti I think - - - //PACKET_MASTER_TO_SLAVE, - //PACKET_SLAVE_TO_MASTER, - - PACKET_NUM_PLAYERS, - PACKET_PLAYER_INDEX, - PACKET_PLAYER_DISCONNECTED, - //PACKET_PLAYER_SPAWN, - //PACKET_FRAG, - PACKET_ACK, - PACKET_AUTH, - //PACKET_PLAYER_PING, - //PACKET_PLAYER_READY, - //PACKET_MAP_STREAM, - - // any packet with an ID higher than PACKET_BROADCAST is rebroadcast by server - // so hacked clients can't create fake server packets and get the server to - // send them to everyone - // newer versions of the netcode also make this determination based on which - // channel the packet was broadcast on - - PACKET_BROADCAST, - PACKET_NEW_GAME, - PACKET_RTS, - PACKET_CLIENT_INFO, - PACKET_MESSAGE, - PACKET_USER_MAP, - - PACKET_MAP_VOTE, - PACKET_MAP_VOTE_INITIATE, - PACKET_MAP_VOTE_CANCEL, -}; - -enum netdisconnect_t -{ - DISC_BAD_PASSWORD = 1, - DISC_GAME_STARTED, - DISC_VERSION_MISMATCH, - DISC_INVALID, - DISC_SERVER_QUIT, - DISC_SERVER_FULL, - DISC_KICKED, - DISC_BANNED -}; - -enum netmode_t -{ - NET_CLIENT = 0, - NET_SERVER, - //NET_DEDICATED_CLIENT, // client on dedicated server - //NET_DEDICATED_SERVER -}; +extern void *g_netServer; #define MAXSYNCBYTES 16 #define SYNCFIFOSIZ 1024 @@ -168,27 +48,6 @@ extern int g_numSyncBytes; extern int g_foundSyncError; extern int syncvaltail, syncvaltottail; -#pragma pack(push,1) -typedef struct -{ - int8_t header; - int8_t connection; - int8_t level_number; - int8_t volume_number; - int8_t player_skill; - int8_t monsters_off; - int8_t respawn_monsters; - int8_t respawn_items; - int8_t respawn_inventory; - int8_t marker; - int8_t ffire; - int8_t noexits; - int8_t coop; -} newgame_t; -#pragma pack(pop) - -extern newgame_t pendingnewgame; - void Net_ClearFIFO(void); void Net_GetInput(void); void Net_GetPackets(void); diff --git a/source/games/duke/src/zz_demo.cpp b/source/games/duke/src/zz_demo.cpp index 8d7a3d4f6..1a376b665 100644 --- a/source/games/duke/src/zz_demo.cpp +++ b/source/games/duke/src/zz_demo.cpp @@ -100,7 +100,7 @@ RECHECK: //if (ud.recstat != 2) //M_DisplayMenus(); - if ((g_netServer || ud.multimode > 1))// && !Menu_IsTextInput(m_currentMenu)) + if (ud.multimode > 1)// && !Menu_IsTextInput(m_currentMenu)) { ControlInfo noshareinfo; CONTROL_GetInput(&noshareinfo); diff --git a/source/games/duke/src/zz_game.cpp b/source/games/duke/src/zz_game.cpp index a0517694c..e4d7490b2 100644 --- a/source/games/duke/src/zz_game.cpp +++ b/source/games/duke/src/zz_game.cpp @@ -223,9 +223,6 @@ void G_HandleLocalKeys(void) { Printf(PRINT_NOTIFY, *CombatMacros[ridiculeNum-1]); Net_SendTaunt(ridiculeNum); - pus = NUMPAGES; - pub = NUMPAGES; - return; } @@ -233,9 +230,6 @@ void G_HandleLocalKeys(void) if (G_StartRTS(ridiculeNum, 1)) { Net_SendRTS(ridiculeNum); - pus = NUMPAGES; - pub = NUMPAGES; - return; } } @@ -849,7 +843,7 @@ MAIN_LOOP_RESTART: gameupdatetime.Reset(); gameupdatetime.Clock(); - while (((g_netClient || g_netServer) || !(g_player[myconnectindex].ps->gm & (MODE_MENU|MODE_DEMO))) && (int)(totalclock - ototalclock) >= TICSPERFRAME) + while ((!(g_player[myconnectindex].ps->gm & (MODE_MENU|MODE_DEMO))) && (int)(totalclock - ototalclock) >= TICSPERFRAME) { ototalclock += TICSPERFRAME; diff --git a/source/games/duke/src/zz_net.cpp b/source/games/duke/src/zz_net.cpp index 9caddb9d5..d1cb88b83 100644 --- a/source/games/duke/src/zz_net.cpp +++ b/source/games/duke/src/zz_net.cpp @@ -37,21 +37,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. BEGIN_DUKE_NS -#define TIMERUPDATESIZ 32 - -ENetHost *g_netServer = NULL; -ENetHost *g_netClient = NULL; -ENetPeer *g_netClientPeer = NULL; -ENetPeer* g_netPlayerPeer[MAXPLAYERS]; -enet_uint16 g_netPort = 23513; -int32_t g_netDisconnect = 0; -char g_netPassword[32]; -int32_t g_netPlayersWaiting = 0; -int32_t g_netIndex = 2; -newgame_t pendingnewgame; - +void *g_netServer = NULL; void faketimerhandler(void) {} - void Net_GetPackets(void) { } diff --git a/source/games/duke/src/zz_savegame.cpp b/source/games/duke/src/zz_savegame.cpp index c7b50ec11..9800f5f99 100644 --- a/source/games/duke/src/zz_savegame.cpp +++ b/source/games/duke/src/zz_savegame.cpp @@ -1391,8 +1391,8 @@ static void postloadplayer(int32_t savegamep) //1 if (g_player[myconnectindex].ps->over_shoulder_on != 0) { - CAMERADIST = 0; - CAMERACLOCK = 0; + cameradist = 0; + cameraclock = 0; g_player[myconnectindex].ps->over_shoulder_on = 1; }