mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-24 10:40:46 +00:00
more multiplayer fixes
git-svn-id: https://svn.eduke32.com/eduke32@1570 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
e38f060ce8
commit
18f098ba93
5 changed files with 44 additions and 28 deletions
|
@ -1104,6 +1104,7 @@ enum DukePacket_t
|
|||
PACKET_REQUEST_GAMESTATE,
|
||||
PACKET_NEW_GAME,
|
||||
PACKET_LOAD_GAME,
|
||||
PACKET_VERSION,
|
||||
|
||||
// any packet with an ID higher than PACKET_BROADCAST is rebroadcast by server
|
||||
// this is so hacked clients can't create fake server packets and get the server
|
||||
|
@ -1114,7 +1115,6 @@ enum DukePacket_t
|
|||
PACKET_WEAPON_CHOICE,
|
||||
PACKET_PLAYER_OPTIONS,
|
||||
PACKET_PLAYER_NAME,
|
||||
PACKET_VERSION,
|
||||
PACKET_MESSAGE,
|
||||
PACKET_USER_MAP,
|
||||
|
||||
|
@ -1123,7 +1123,7 @@ enum DukePacket_t
|
|||
PACKET_MAP_VOTE_CANCEL,
|
||||
|
||||
PACKET_PLAYER_READY,
|
||||
PACKET_QUIT = 255 // should match mmulti I think
|
||||
PACKET_QUIT = 255
|
||||
};
|
||||
|
||||
#pragma pack(pop)
|
||||
|
|
|
@ -53,6 +53,7 @@ ENetHost * net_server = NULL;
|
|||
ENetHost * net_client = NULL;
|
||||
ENetPeer * net_peer = NULL;
|
||||
int32_t net_port = 23513;
|
||||
int32_t g_netDisconnect = 0;
|
||||
|
||||
#ifdef _WIN32
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
|
@ -696,8 +697,7 @@ void Net_SendQuit(void)
|
|||
{
|
||||
g_gameQuit = 1;
|
||||
quittimer = totalclock+120;
|
||||
Net_Disconnect();
|
||||
G_GameExit(" ");
|
||||
g_netDisconnect = 1;
|
||||
}
|
||||
else if (numplayers < 2)
|
||||
G_GameExit(" ");
|
||||
|
@ -732,8 +732,8 @@ static void Net_SendVersion(void)
|
|||
if (numplayers < 2) return;
|
||||
|
||||
buf[0] = PACKET_VERSION;
|
||||
buf[1] = (uint8_t)atoi(s_buildDate);
|
||||
buf[2] = BYTEVERSION;
|
||||
buf[1] = BYTEVERSION;
|
||||
buf[2] = (uint8_t)atoi(s_buildDate);
|
||||
buf[3] = myconnectindex;
|
||||
|
||||
if (net_client)
|
||||
|
@ -1224,16 +1224,20 @@ process:
|
|||
break;
|
||||
|
||||
case PACKET_VERSION:
|
||||
if (packbuf[1] != (uint8_t)atoi(s_buildDate))
|
||||
if (net_client)
|
||||
{
|
||||
initprintf("Player %d has version %d, expecting %d\n",other,packbuf[1],(uint8_t)atoi(s_buildDate));
|
||||
G_GameExit("You cannot play with different versions of EDuke32!");
|
||||
}
|
||||
if (packbuf[2] != BYTEVERSION)
|
||||
{
|
||||
initprintf("Player %d has version %d, expecting %d\n",other,packbuf[2],BYTEVERSION);
|
||||
G_GameExit("You cannot play Duke with different versions!");
|
||||
if (packbuf[1] != BYTEVERSION || packbuf[2] != (uint8_t)atoi(s_buildDate))
|
||||
{
|
||||
Bsprintf(tempbuf, "Server protocol is version %d.%d, expecting %d.%d\n",
|
||||
packbuf[1], packbuf[2], BYTEVERSION, (uint8_t)atoi(s_buildDate));
|
||||
initprintf(tempbuf);
|
||||
initprintf("Version mismatch! You cannot play Duke with different versions!\n");
|
||||
g_netDisconnect = 1;
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if (net_server)
|
||||
Net_SendVersion();
|
||||
break;
|
||||
|
||||
case PACKET_NUM_PLAYERS:
|
||||
|
@ -1462,6 +1466,15 @@ void Net_GetPackets(void)
|
|||
|
||||
G_HandleSpecialKeys();
|
||||
|
||||
if (g_netDisconnect)
|
||||
{
|
||||
Net_Disconnect();
|
||||
g_netDisconnect = 0;
|
||||
|
||||
if (g_gameQuit)
|
||||
G_GameExit(" ");
|
||||
}
|
||||
|
||||
if (net_server)
|
||||
{
|
||||
ENetEvent event;
|
||||
|
@ -1643,12 +1656,14 @@ void Net_GetPackets(void)
|
|||
else
|
||||
{
|
||||
initprintf("Invalid map state from server!\n");
|
||||
Net_Disconnect();
|
||||
g_netDisconnect = 1;
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
initprintf("Error allocating memory!\n");
|
||||
g_netDisconnect = 1;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
//-------------------------------------------------------------------------
|
||||
#include "duke3d.h"
|
||||
|
||||
const char *s_buildDate = "20091212";
|
||||
const char *s_buildDate = "20091214";
|
||||
char *MusicPtr = NULL;
|
||||
int32_t g_musicSize;
|
||||
|
||||
|
|
|
@ -1149,8 +1149,9 @@ static int32_t osdcmd_inittimer(const osdfuncparm_t *parm)
|
|||
|
||||
static int32_t osdcmd_disconnect(const osdfuncparm_t *parm)
|
||||
{
|
||||
extern int32_t g_netDisconnect;
|
||||
UNREFERENCED_PARAMETER(parm);
|
||||
Net_Disconnect();
|
||||
g_netDisconnect = 1;
|
||||
return OSDCMD_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -3826,17 +3826,6 @@ void P_FragPlayer(int32_t snum)
|
|||
|
||||
randomseed = ticrandomseed;
|
||||
|
||||
if (net_server)
|
||||
{
|
||||
packbuf[0] = PACKET_FRAG;
|
||||
packbuf[1] = snum;
|
||||
packbuf[2] = p->frag_ps;
|
||||
packbuf[3] = ActorExtra[p->i].picnum;
|
||||
packbuf[4] = myconnectindex;
|
||||
|
||||
enet_host_broadcast(net_server, 0, enet_packet_create(packbuf, 5, ENET_PACKET_FLAG_RELIABLE));
|
||||
}
|
||||
|
||||
if (s->pal != 1)
|
||||
{
|
||||
p->pals[0] = 63;
|
||||
|
@ -3855,6 +3844,17 @@ void P_FragPlayer(int32_t snum)
|
|||
p->dead_flag = (512-((krand()&1)<<10)+(krand()&255)-512)&2047;
|
||||
if (p->dead_flag == 0)
|
||||
p->dead_flag++;
|
||||
|
||||
if (net_server)
|
||||
{
|
||||
packbuf[0] = PACKET_FRAG;
|
||||
packbuf[1] = snum;
|
||||
packbuf[2] = p->frag_ps;
|
||||
packbuf[3] = ActorExtra[p->i].picnum;
|
||||
packbuf[4] = myconnectindex;
|
||||
|
||||
enet_host_broadcast(net_server, 0, enet_packet_create(packbuf, 5, ENET_PACKET_FLAG_RELIABLE));
|
||||
}
|
||||
}
|
||||
|
||||
p->jetpack_on = 0;
|
||||
|
|
Loading…
Reference in a new issue