diff options
author | Simon Howard | 2006-10-14 12:55:02 +0000 |
---|---|---|
committer | Simon Howard | 2006-10-14 12:55:02 +0000 |
commit | 2561fee6091fec2248a102e951cc108f3e2ea4b7 (patch) | |
tree | d07f15e3cb6308918c69600303891f317d103934 | |
parent | 94bff80737b6e3d04ad9c02b06739a431e0396f9 (diff) | |
download | chocolate-doom-2561fee6091fec2248a102e951cc108f3e2ea4b7.tar.gz chocolate-doom-2561fee6091fec2248a102e951cc108f3e2ea4b7.tar.bz2 chocolate-doom-2561fee6091fec2248a102e951cc108f3e2ea4b7.zip |
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
-rw-r--r-- | src/net_client.c | 20 | ||||
-rw-r--r-- | src/net_client.h | 4 | ||||
-rw-r--r-- | src/net_gui.c | 30 | ||||
-rw-r--r-- | src/net_server.c | 13 |
4 files changed, 59 insertions, 8 deletions
diff --git a/src/net_client.c b/src/net_client.c index bc31740d..39272dd0 100644 --- 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 @@ char net_player_names[MAXPLAYERS][MAXPLAYERNAME]; 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 @@ static unsigned int gamedata_recv_time; 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 @@ static void NET_CL_ParseWaitingData(net_packet_t *packet) 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 @@ static void NET_CL_ParseWaitingData(net_packet_t *packet) } 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 @@ static void NET_CL_ParseWaitingData(net_packet_t *packet) 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 @@ static void NET_CL_SendSYN(void) 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); @@ -1214,6 +1226,10 @@ boolean NET_CL_Connect(net_addr_t *addr) 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 diff --git a/src/net_client.h b/src/net_client.h index abc0f5bd..58488db6 100644 --- 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 boolean drone; 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 */ diff --git a/src/net_gui.c b/src/net_gui.c index aa08c950..7ef9d909 100644 --- 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 UpdateGUI(void) 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 @@ static void CheckMD5Sums(void) 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 @@ static void CheckMD5Sums(void) 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 diff --git a/src/net_server.c b/src/net_server.c index ed664a93..9223588c 100644 --- 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 @@ typedef struct 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 @@ static void NET_SV_ParseSYN(net_packet_t *packet, 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 @@ static void NET_SV_ParseSYN(net_packet_t *packet, || !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 @@ static void NET_SV_ParseSYN(net_packet_t *packet, 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 @@ static void NET_SV_SendWaitingData(net_client_t *client) { 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 |