- cleanup.

This commit is contained in:
Christoph Oelckers 2020-07-06 00:54:06 +02:00
parent c6b619214f
commit 25bff01c70
8 changed files with 11 additions and 173 deletions

View file

@ -216,7 +216,7 @@ void GameInterface::DrawNativeMenuText(int fontnum, int state, double oxpos, dou
void GameInterface::MenuOpened() void GameInterface::MenuOpened()
{ {
S_PauseSounds(true); S_PauseSounds(true);
if ((!g_netServer && ud.multimode < 2)) if (ud.multimode < 2)
{ {
ready2send = 0; ready2send = 0;
totalclock = ototalclock; 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. // The following lines are here so that you cannot close the menu when no game is running.
gm &= ~MODE_MENU; gm &= ~MODE_MENU;
if ((!g_netServer && ud.multimode < 2) && ud.recstat != 2) if (ud.multimode < 2 && ud.recstat != 2)
{ {
ready2send = 1; ready2send = 1;
totalclock = ototalclock; totalclock = ototalclock;

View file

@ -252,10 +252,8 @@ static inline void G_HandleAsync(void)
static inline int32_t calc_smoothratio(ClockTicks totalclk, ClockTicks ototalclk) static inline int32_t calc_smoothratio(ClockTicks totalclk, ClockTicks ototalclk)
{ {
if (!(((!g_netServer && ud.multimode < 2) && ((g_player[myconnectindex].ps->gm & MODE_MENU) == 0)) || if (!((ud.multimode < 2 && ((g_player[myconnectindex].ps->gm & MODE_MENU) == 0)) ||
(g_netServer || ud.multimode > 1) || ud.multimode > 1 || ud.recstat == 2) || ud.pause_on)
ud.recstat == 2) ||
ud.pause_on)
{ {
return 65536; return 65536;
} }

View file

@ -132,7 +132,7 @@ void checkcommandline()
void gameexitfrommenu() void gameexitfrommenu()
{ {
// MP scoreboard // 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); G_BonusScreen(1);
} }

View file

@ -30,127 +30,7 @@ struct ENetPacket;
BEGIN_DUKE_NS BEGIN_DUKE_NS
extern void *g_netServer;
// 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
};
#define MAXSYNCBYTES 16 #define MAXSYNCBYTES 16
#define SYNCFIFOSIZ 1024 #define SYNCFIFOSIZ 1024
@ -168,27 +48,6 @@ extern int g_numSyncBytes;
extern int g_foundSyncError; extern int g_foundSyncError;
extern int syncvaltail, syncvaltottail; 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_ClearFIFO(void);
void Net_GetInput(void); void Net_GetInput(void);
void Net_GetPackets(void); void Net_GetPackets(void);

View file

@ -100,7 +100,7 @@ RECHECK:
//if (ud.recstat != 2) //if (ud.recstat != 2)
//M_DisplayMenus(); //M_DisplayMenus();
if ((g_netServer || ud.multimode > 1))// && !Menu_IsTextInput(m_currentMenu)) if (ud.multimode > 1)// && !Menu_IsTextInput(m_currentMenu))
{ {
ControlInfo noshareinfo; ControlInfo noshareinfo;
CONTROL_GetInput(&noshareinfo); CONTROL_GetInput(&noshareinfo);

View file

@ -223,9 +223,6 @@ void G_HandleLocalKeys(void)
{ {
Printf(PRINT_NOTIFY, *CombatMacros[ridiculeNum-1]); Printf(PRINT_NOTIFY, *CombatMacros[ridiculeNum-1]);
Net_SendTaunt(ridiculeNum); Net_SendTaunt(ridiculeNum);
pus = NUMPAGES;
pub = NUMPAGES;
return; return;
} }
@ -233,9 +230,6 @@ void G_HandleLocalKeys(void)
if (G_StartRTS(ridiculeNum, 1)) if (G_StartRTS(ridiculeNum, 1))
{ {
Net_SendRTS(ridiculeNum); Net_SendRTS(ridiculeNum);
pus = NUMPAGES;
pub = NUMPAGES;
return; return;
} }
} }
@ -849,7 +843,7 @@ MAIN_LOOP_RESTART:
gameupdatetime.Reset(); gameupdatetime.Reset();
gameupdatetime.Clock(); 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; ototalclock += TICSPERFRAME;

View file

@ -37,21 +37,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
BEGIN_DUKE_NS BEGIN_DUKE_NS
#define TIMERUPDATESIZ 32 void *g_netServer = NULL;
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 faketimerhandler(void) {} void faketimerhandler(void) {}
void Net_GetPackets(void) void Net_GetPackets(void)
{ {
} }

View file

@ -1391,8 +1391,8 @@ static void postloadplayer(int32_t savegamep)
//1 //1
if (g_player[myconnectindex].ps->over_shoulder_on != 0) if (g_player[myconnectindex].ps->over_shoulder_on != 0)
{ {
CAMERADIST = 0; cameradist = 0;
CAMERACLOCK = 0; cameraclock = 0;
g_player[myconnectindex].ps->over_shoulder_on = 1; g_player[myconnectindex].ps->over_shoulder_on = 1;
} }