ref: 2561fee6091fec2248a102e951cc108f3e2ea4b7
parent: 94bff80737b6e3d04ad9c02b06739a431e0396f9
author: Simon Howard <[email protected]>
date: Sat Oct 14 08:55:02 EDT 2006
Display a different message from the normal WAD directory warning if players are mixing Freedoom/Original IWADs. Subversion-branch: /trunk/chocolate-doom Subversion-revision: 698
--- a/src/net_client.c
+++ b/src/net_client.c
@@ -1,7 +1,7 @@
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
-// $Id: net_client.c 694 2006-10-11 22:55:06Z fraggle $
+// $Id: net_client.c 698 2006-10-14 12:55:02Z fraggle $
//
// Copyright(C) 2005 Simon Howard
//
@@ -250,6 +250,10 @@
md5_digest_t net_server_wad_md5sum;
md5_digest_t net_server_deh_md5sum;
+// Is the server a freedoom game?
+
+unsigned int net_server_is_freedoom;
+
// Player number
int net_player_number;
@@ -287,6 +291,10 @@
md5_digest_t net_local_wad_md5sum;
md5_digest_t net_local_deh_md5sum;
+// Are we playing with the freedoom IWAD?
+
+unsigned int net_local_is_freedoom;
+
// Average time between sending our ticcmd and receiving from the server
static fixed_t average_latency;
@@ -642,6 +650,7 @@
char *player_names[MAXPLAYERS];
char *player_addr[MAXPLAYERS];
md5_digest_t wad_md5sum, deh_md5sum;
+ unsigned int server_is_freedoom;
size_t i;
if (!NET_ReadInt8(packet, &num_players)
@@ -683,7 +692,8 @@
}
if (!NET_ReadMD5Sum(packet, wad_md5sum)
- || !NET_ReadMD5Sum(packet, deh_md5sum))
+ || !NET_ReadMD5Sum(packet, deh_md5sum)
+ || !NET_ReadInt8(packet, &server_is_freedoom))
{
return;
}
@@ -702,6 +712,7 @@
memcpy(net_server_wad_md5sum, wad_md5sum, sizeof(md5_digest_t));
memcpy(net_server_deh_md5sum, deh_md5sum, sizeof(md5_digest_t));
+ net_server_is_freedoom = server_is_freedoom;
net_client_received_wait_data = true;
}
@@ -1188,6 +1199,7 @@
NET_WriteInt8(packet, drone);
NET_WriteMD5Sum(packet, net_local_wad_md5sum);
NET_WriteMD5Sum(packet, net_local_deh_md5sum);
+ NET_WriteInt8(packet, net_local_is_freedoom);
NET_WriteString(packet, net_player_name);
NET_Conn_SendPacket(&client_connection, packet);
NET_FreePacket(packet);
@@ -1213,6 +1225,10 @@
W_Checksum(net_local_wad_md5sum);
DEH_Checksum(net_local_deh_md5sum);
+
+ // Are we playing with the Freedoom IWAD?
+
+ net_local_is_freedoom = W_CheckNumForName("FREEDOOM") >= 0;
// create a new network I/O context and add just the
// necessary module
--- a/src/net_client.h
+++ b/src/net_client.h
@@ -1,7 +1,7 @@
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
-// $Id: net_client.h 689 2006-10-06 17:06:05Z fraggle $
+// $Id: net_client.h 698 2006-10-14 12:55:02Z fraggle $
//
// Copyright(C) 2005 Simon Howard
//
@@ -97,8 +97,10 @@
extern md5_digest_t net_server_wad_md5sum;
extern md5_digest_t net_server_deh_md5sum;
+extern unsigned int net_server_is_freedoom;
extern md5_digest_t net_local_wad_md5sum;
extern md5_digest_t net_local_deh_md5sum;
+extern unsigned int net_local_is_freedoom;
#endif /* #ifndef NET_CLIENT_H */
--- a/src/net_gui.c
+++ b/src/net_gui.c
@@ -1,7 +1,7 @@
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
-// $Id: net_gui.c 697 2006-10-14 11:53:08Z fraggle $
+// $Id: net_gui.c 698 2006-10-14 12:55:02Z fraggle $
//
// Copyright(C) 2005 Simon Howard
//
@@ -192,6 +192,7 @@
static void CheckMD5Sums(void)
{
boolean correct_wad, correct_deh;
+ boolean same_freedoom;
txt_window_t *window;
if (!net_client_received_wait_data || had_warning)
@@ -203,8 +204,9 @@
sizeof(md5_digest_t)) == 0;
correct_deh = memcmp(net_local_deh_md5sum, net_server_deh_md5sum,
sizeof(md5_digest_t)) == 0;
+ same_freedoom = net_server_is_freedoom == net_local_is_freedoom;
- if (correct_wad && correct_deh)
+ if (correct_wad && correct_deh && same_freedoom)
{
return;
}
@@ -213,13 +215,35 @@
TXT_SetWindowAction(window, TXT_HORIZ_RIGHT, NULL);
- if (!correct_wad)
+ if (!same_freedoom)
{
+ // If Freedoom and Doom IWADs are mixed, the WAD directory
+ // will be wrong, but this is not neccessarily a problem.
+ // Display a different message to the WAD directory message.
+
+ if (net_local_is_freedoom)
+ {
+ TXT_AddWidget(window, TXT_NewLabel
+ ("You are using the Freedoom IWAD to play with players\n"
+ "using an official Doom IWAD. Make sure that you are\n"
+ "playing the same levels as other players.\n"));
+ }
+ else
+ {
+ TXT_AddWidget(window, TXT_NewLabel
+ ("You are using an official IWAD to play with players\n"
+ "using the Freedoom IWAD. Make sure that you are\n"
+ "playing the same levels as other players.\n"));
+ }
+ }
+ else if (!correct_wad)
+ {
TXT_AddWidget(window, TXT_NewLabel
("Your WAD directory does not match other players in the game.\n"
"Check that you have loaded the exact same WAD files as other\n"
"players.\n"));
}
+
if (!correct_deh)
{
TXT_AddWidget(window, TXT_NewLabel
--- a/src/net_server.c
+++ b/src/net_server.c
@@ -1,7 +1,7 @@
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
-// $Id: net_server.c 694 2006-10-11 22:55:06Z fraggle $
+// $Id: net_server.c 698 2006-10-14 12:55:02Z fraggle $
//
// Copyright(C) 2005 Simon Howard
//
@@ -226,6 +226,10 @@
md5_digest_t wad_md5sum;
md5_digest_t deh_md5sum;
+ // Is this client is playing with the Freedoom IWAD?
+
+ unsigned int is_freedoom;
+
} net_client_t;
// structure used for the recv window
@@ -560,6 +564,7 @@
unsigned int cl_gamemode, cl_gamemission;
unsigned int cl_recording_lowres;
unsigned int cl_drone;
+ unsigned int is_freedoom;
md5_digest_t deh_md5sum, wad_md5sum;
char *player_name;
char *client_version;
@@ -601,7 +606,8 @@
|| !NET_ReadInt8(packet, &cl_recording_lowres)
|| !NET_ReadInt8(packet, &cl_drone)
|| !NET_ReadMD5Sum(packet, wad_md5sum)
- || !NET_ReadMD5Sum(packet, deh_md5sum))
+ || !NET_ReadMD5Sum(packet, deh_md5sum)
+ || !NET_ReadInt8(packet, &is_freedoom))
{
return;
}
@@ -696,6 +702,7 @@
memcpy(client->wad_md5sum, wad_md5sum, sizeof(md5_digest_t));
memcpy(client->deh_md5sum, deh_md5sum, sizeof(md5_digest_t));
+ client->is_freedoom = is_freedoom;
// Check the connecting client is playing the same game as all
// the other clients
@@ -1323,11 +1330,13 @@
{
NET_WriteMD5Sum(packet, controller->wad_md5sum);
NET_WriteMD5Sum(packet, controller->deh_md5sum);
+ NET_WriteInt8(packet, controller->is_freedoom);
}
else
{
NET_WriteMD5Sum(packet, client->wad_md5sum);
NET_WriteMD5Sum(packet, client->deh_md5sum);
+ NET_WriteInt8(packet, client->is_freedoom);
}
// send packet to client and free