From modemhero at users.sourceforge.net Sun Apr 6 17:41:45 2008 From: modemhero at users.sourceforge.net (Bill Balcerski) Date: Sun, 06 Apr 2008 22:41:45 +0000 Subject: [netrek-cvs] client/netrekxp/resources/docs changes.txt, 1.200, 1.201 Message-ID: <20080406224224.A6820B443@smtpgrey-2.real-time.com> Update of /cvsroot/netrek/client/netrekxp/resources/docs In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv4313/resources/docs Modified Files: changes.txt Log Message: Added support for server feature packets F_whydead_2 and the two lame_refit feature packets. Bug fix for paradise handling of macros. Bug fix for addition of 2 extra paradise death messages. Moved planet initialization into its own function. Index: changes.txt =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/resources/docs/changes.txt,v retrieving revision 1.200 retrieving revision 1.201 diff -u -d -r1.200 -r1.201 --- changes.txt 29 Jul 2007 01:38:39 -0000 1.200 +++ changes.txt 6 Apr 2008 22:41:43 -0000 1.201 @@ -1,3 +1,13 @@ +Netrek XP 2009, Version 1.0: (Released April-2008) + +General bug fixes: +1) Fix to cloak bug where ships would briefly be seen to flash when entering. +2) Various bug fixes for play on a paradise server. + +tactical range. +New features: +1) Addition of 3rd metaserver to the metaserver list. + Netrek XP 2006, Version 1.3: (Released July-2007) User interface: From modemhero at users.sourceforge.net Sun Apr 6 17:41:44 2008 From: modemhero at users.sourceforge.net (Bill Balcerski) Date: Sun, 06 Apr 2008 22:41:44 +0000 Subject: [netrek-cvs] client/netrekxp NetrekXP to do list.C, 1.157, 1.158 clientr.suo, 1.142, 1.143 Message-ID: <20080406224224.5A1D43B40BB@smtpgrey-1.real-time.com> Update of /cvsroot/netrek/client/netrekxp In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv4313 Modified Files: NetrekXP to do list.C clientr.suo Log Message: Added support for server feature packets F_whydead_2 and the two lame_refit feature packets. Bug fix for paradise handling of macros. Bug fix for addition of 2 extra paradise death messages. Moved planet initialization into its own function. Index: NetrekXP to do list.C =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/NetrekXP to do list.C,v retrieving revision 1.157 retrieving revision 1.158 diff -u -d -r1.157 -r1.158 --- NetrekXP to do list.C 24 Feb 2008 00:33:54 -0000 1.157 +++ NetrekXP to do list.C 6 Apr 2008 22:41:40 -0000 1.158 @@ -50,8 +50,6 @@ 7) Still missing asteroids and (flashing) warpbeacons. 8) Show ratings on full/wide playerlist. 9) CV army capacity is wrong - waiting on word from server experts to the right value -10) Seems a commodore char doesn't have the proper rank info..player info is all blank. - this may be fixed....needs testing 11) Playing back recordings made by linux pclient is probably impossible. 12) Mysterious crash bug, not reproducible by me. Index: clientr.suo =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/clientr.suo,v retrieving revision 1.142 retrieving revision 1.143 diff -u -d -r1.142 -r1.143 Binary files /tmp/cvs77ZyGd and /tmp/cvsRWdqgq differ From modemhero at users.sourceforge.net Sun Apr 6 17:41:45 2008 From: modemhero at users.sourceforge.net (Bill Balcerski) Date: Sun, 06 Apr 2008 22:41:45 +0000 Subject: [netrek-cvs] client/netrekxp/include data.h, 1.92, 1.93 proto.h, 1.59, 1.60 Message-ID: <20080406224224.59F6EB43F@smtpgrey-2.real-time.com> Update of /cvsroot/netrek/client/netrekxp/include In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv4313/include Modified Files: data.h proto.h Log Message: Added support for server feature packets F_whydead_2 and the two lame_refit feature packets. Bug fix for paradise handling of macros. Bug fix for addition of 2 extra paradise death messages. Moved planet initialization into its own function. Index: data.h =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/include/data.h,v retrieving revision 1.92 retrieving revision 1.93 diff -u -d -r1.92 -r1.93 --- data.h 29 Jul 2007 01:38:38 -0000 1.92 +++ data.h 6 Apr 2008 22:41:42 -0000 1.93 @@ -160,6 +160,8 @@ extern int lastUpdateSpeed; /* last update speed client requested */ extern int server_ups; /* server responded updates per second */ extern int server_fps; /* server configured frames per second */ +extern int lame_refit; +extern int lame_base_refit; extern int SBhours; @@ -661,6 +663,7 @@ extern int F_turn_keys; extern int F_show_visibility_range; extern int F_sp_flags_all; +extern int F_why_dead_2; #ifdef RECORDGAME extern int F_many_self; Index: proto.h =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/include/proto.h,v retrieving revision 1.59 retrieving revision 1.60 diff -u -d -r1.59 -r1.60 --- proto.h 24 Feb 2008 00:33:55 -0000 1.59 +++ proto.h 6 Apr 2008 22:41:43 -0000 1.60 @@ -900,6 +900,7 @@ /******************************************************************************/ /*** planetlist.c /******************************************************************************/ +void initialize_planets (void); void planetlist (void); void updatePlanetw (void); int GetPlanetFromPlist (int x, int y); From modemhero at users.sourceforge.net Sun Apr 6 17:41:47 2008 From: modemhero at users.sourceforge.net (Bill Balcerski) Date: Sun, 06 Apr 2008 22:41:47 +0000 Subject: [netrek-cvs] client/netrekxp/src data.c, 1.101, 1.102 dmessage.c, 1.10, 1.11 enter.c, 1.14, 1.15 feature.c, 1.19, 1.20 planetlist.c, 1.9, 1.10 socket.c, 1.37, 1.38 Message-ID: <20080406224159.D08B63B40BB@smtpgrey-1.real-time.com> Update of /cvsroot/netrek/client/netrekxp/src In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv4313/src Modified Files: data.c dmessage.c enter.c feature.c planetlist.c socket.c Log Message: Added support for server feature packets F_whydead_2 and the two lame_refit feature packets. Bug fix for paradise handling of macros. Bug fix for addition of 2 extra paradise death messages. Moved planet initialization into its own function. Index: dmessage.c =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/src/dmessage.c,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- dmessage.c 24 Feb 2008 00:33:55 -0000 1.10 +++ dmessage.c 6 Apr 2008 22:41:43 -0000 1.11 @@ -150,7 +150,13 @@ } /* aha! A new type distress/macro call came in. parse it appropriately */ - if (flags == (MTEAM | MDISTR | MVALID)) + if ( +#ifdef PARADISE // Not quite sure why this check is here..but apparently it's needed. + // This check needs to be further investigated on the current paradise + // server code, for bombing messages and RCDs. BB 03/11/08 + gen_distress && +#endif + flags == (MTEAM | MDISTR | MVALID)) { HandleGenDistr (message, from, to, &dist); len = makedistress (&dist, message, distmacro[dist.distype].macro); @@ -269,6 +275,10 @@ (instr (message, "was kill") || instr (message, "killed by")) || instr (message, "Credit for")) || +#ifdef PARADISE + instr (message, "burned to a crisp by") || + instr (message, "shot down by") || +#endif (*message != ' ' && instr (message, "We are being attacked"))) { if (!reportKills) Index: enter.c =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/src/enter.c,v retrieving revision 1.14 retrieving revision 1.15 diff -u -d -r1.14 -r1.15 --- enter.c 24 Feb 2008 00:33:55 -0000 1.14 +++ enter.c 6 Apr 2008 22:41:44 -0000 1.15 @@ -60,7 +60,7 @@ status2 = (struct status2 *) malloc(sizeof(*status2)); #endif status = (struct status *) malloc(sizeof(*status)); - planets = (struct planet *) malloc(sizeof(*planets) * MAXPLANETS); + initialize_planets(); phasers = (struct phaser *) malloc(sizeof(*phasers) * MAXPLAYER); mctl = (struct mctl *) malloc(sizeof(*mctl)); messages = (struct message *) malloc(sizeof(*messages) * MAXMESSAGE); @@ -105,13 +105,6 @@ plasmatorps[i].pt_owner = (short) (i / MAXPLASMA); } - for (i = 0; i < MAXPLANETS; i++) - planets[i].pl_no = i; - - /* initialize planet redraw for moving planets */ - for (i = 0; i < MAXPLANETS; i++) - pl_update[i].plu_update = -1; - /* initialize pointers if ghost start */ if (ghoststart) { Index: planetlist.c =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/src/planetlist.c,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- planetlist.c 18 May 2007 19:54:39 -0000 1.9 +++ planetlist.c 6 Apr 2008 22:41:45 -0000 1.10 @@ -38,6 +38,33 @@ "ORI" }; +void initialize_planets(void) +{ + int i; + + planets = (struct planet *)malloc(sizeof(*planets) * MAXPLANETS); + + for(i = 0; i < MAXPLANETS; i++) { + struct planet *curr = &planets[i]; + curr->pl_no = i; + curr->pl_flags = 0; + curr->pl_owner = 0; + curr->pl_x = curr->pl_y = -10000; + sprintf(curr->pl_name, "planet%d", i); + curr->pl_namelen = strlen(curr->pl_name); + curr->pl_armies = 0; + curr->pl_info = 0; + curr->pl_deadtime = 0; + curr->pl_couptime = 0; +#ifdef PARADISE + curr->pl_timestamp = 0; +#endif + + /* initialize planet redraw for moving planets */ + pl_update[i].plu_update = -1; + } +} + /* * Open a window which contains all the planets and their current * * statistics. Players will not know about planets that their team * has not * orbited. */ Index: data.c =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/src/data.c,v retrieving revision 1.101 retrieving revision 1.102 diff -u -d -r1.101 -r1.102 --- data.c 29 Nov 2007 05:29:05 -0000 1.101 +++ data.c 6 Apr 2008 22:41:43 -0000 1.102 @@ -251,6 +251,8 @@ int lastUpdateSpeed = 10; /* last update speed client requested */ int server_ups = 10; /* server responded updates per second */ int server_fps = 10; /* server configured frames per second */ +int lame_refit = 1; +int lame_base_refit = 1; #ifdef META /* Metaservers list - comma delimited */ @@ -760,6 +762,7 @@ int F_turn_keys = 0; int F_show_visibility_range = 0; int F_sp_flags_all = 0; +int F_why_dead_2 = 0; #ifdef RECORDGAME int F_many_self = 0; Index: feature.c =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/src/feature.c,v retrieving revision 1.19 retrieving revision 1.20 diff -u -d -r1.19 -r1.20 --- feature.c 17 May 2007 08:49:48 -0000 1.19 +++ feature.c 6 Apr 2008 22:41:44 -0000 1.20 @@ -104,6 +104,7 @@ #else {"SP_FLAGS_ALL", &F_sp_flags_all, 'S', 1, 0, 0}, #endif + {"WHY_DEAD_2", &F_why_dead_2, 'S', 1, 0, 0}, {0, 0, 0, 0, 0, 0} }; @@ -202,7 +203,17 @@ LineToConsole("Server actually sending %d updates per second.\n", value); return; } - + if (strcmpi (packet->name, "LAME_REFIT") == 0) + { + lame_refit = value; + return; + } + if (strcmpi (packet->name, "LAME_BASE_REFIT") == 0) + { + lame_base_refit = value; + return; + } + if (features[i].name == 0) { LineToConsole ("Feature %s from server unknown to client!\n", packet->name); Index: socket.c =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/src/socket.c,v retrieving revision 1.37 retrieving revision 1.38 diff -u -d -r1.37 -r1.38 --- socket.c 24 Feb 2008 00:33:56 -0000 1.37 +++ socket.c 6 Apr 2008 22:41:45 -0000 1.38 @@ -3175,32 +3175,6 @@ } void -initialize_planets(void) -{ - int i; - - planets = (struct planet *)malloc(sizeof(*planets) * MAXPLANETS); - - for(i = 0; i < MAXPLANETS; i++) { - struct planet *curr = &planets[i]; - curr->pl_no = i; - curr->pl_flags = 0; - curr->pl_owner = 0; - curr->pl_x = curr->pl_y = -10000; - sprintf(curr->pl_name, "planet%d", i); - curr->pl_namelen = strlen(curr->pl_name); - curr->pl_armies = 0; - curr->pl_info = 0; - curr->pl_deadtime = 0; - curr->pl_couptime = 0; - curr->pl_timestamp = 0; - - /* initialize planet redraw for moving planets */ - pl_update[i].plu_update = -1; - } -} - -void initialize_ranks(void) { ranks2 = (struct rank2 *) malloc(sizeof(*ranks2) * nranks2); From modemhero at users.sourceforge.net Sun Apr 6 18:29:57 2008 From: modemhero at users.sourceforge.net (Bill Balcerski) Date: Sun, 06 Apr 2008 23:29:57 +0000 Subject: [netrek-cvs] client/netrekxp/include version.h,1.7,1.8 Message-ID: <20080406233035.9457B3B40B9@smtpgrey-1.real-time.com> Update of /cvsroot/netrek/client/netrekxp/include In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv26701/include Modified Files: version.h Log Message: Update client name to 2009, version back to 1.0. Fixed a type in changes.txt. Updated cygwin1.dll to mkkey works (sigh). Index: version.h =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/include/version.h,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- version.h 13 Mar 2007 19:42:06 -0000 1.7 +++ version.h 6 Apr 2008 23:29:55 -0000 1.8 @@ -2,5 +2,5 @@ /* store the version info here */ -static char mvers[] = "1.3"; -static char version[] = "Netrek XP 2006"; \ No newline at end of file +static char mvers[] = "1.0"; +static char version[] = "Netrek XP 2009"; \ No newline at end of file From modemhero at users.sourceforge.net Sun Apr 6 18:29:58 2008 From: modemhero at users.sourceforge.net (Bill Balcerski) Date: Sun, 06 Apr 2008 23:29:58 +0000 Subject: [netrek-cvs] client/netrekxp/resources/netrekrc netrekrc.txt, 1.4, 1.5 Message-ID: <20080406233006.DE323B456@smtpgrey-2.real-time.com> Update of /cvsroot/netrek/client/netrekxp/resources/netrekrc In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv26701/resources/netrekrc Modified Files: netrekrc.txt Log Message: Update client name to 2009, version back to 1.0. Fixed a type in changes.txt. Updated cygwin1.dll to mkkey works (sigh). Index: netrekrc.txt =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/resources/netrekrc/netrekrc.txt,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- netrekrc.txt 29 Jul 2007 01:38:40 -0000 1.4 +++ netrekrc.txt 6 Apr 2008 23:29:55 -0000 1.5 @@ -877,8 +877,8 @@ macro.0.A:% __ __ ______ __ Zoom in/out! Anti-packet loss, macro.0.A:% / \ / /__/_ __/______ / /__ observers see all weapons, etc. macro.0.A:% / /\ \/ / -_)/ / / __/ -_) '_/ Plus 50 updates/sec support! -macro.0.A:% /_/ \__/\__//_/ /_/ \__/_/\_\ XP 2006, v1.3, released July 2007 -macro.0.A:% Get it today at http://www.netrek.org +macro.0.A:% /_/ \__/\__//_/ /_/ \__/_/\_\ XP 2009, v1.0 +macro.0.A:% Get it today at http://play.netrek.org macro.P.A:% \~~\ _ _ ,----------------------------------, macro.P.A:% \**\___\/ \............| %u: Sucks to be you! @@ -1040,12 +1040,12 @@ macro.).A:/* Join the netrek clue game mailing list today! At */ macro.).A:/* http://groups.google.com/group/netrek-clue-games */ -macro.).A:/* INL-style timed bronco games are every Wednesday */ -macro.).A:/* 10pm EST/7pm PST */ +macro.).A:/* INL-style timed bronco games are every Wednesday! */ -macro.(.A:/* Get the latest version of Netrek XP 2006 today! */ -macro.(.A:/* Current version is 1.3, released July 2007 */ -macro.(.A:/* Download it at http://www.netrek.org/files/NetrekXP_2006/ */ +macro.(.A:/* Get the latest version of Netrek XP 2009 today! */ +macro.(.A:/* Current version is 1.0 */ +macro.(.A:/* Download it at http://www.netrek.org/files/NetrekXP_2009/ */ +macro.(.A:/* or at http://play.netrek.org */ mac.e.T: Escorting %g (%d%%D %s%%S %f%%F) mac.V.A: %T%c PING stats: Average: %v ms, Stdv: %V ms, Loss: %y%% From modemhero at users.sourceforge.net Sun Apr 6 18:29:57 2008 From: modemhero at users.sourceforge.net (Bill Balcerski) Date: Sun, 06 Apr 2008 23:29:57 +0000 Subject: [netrek-cvs] client/netrekxp/resources/docs changes.txt, 1.201, 1.202 Message-ID: <20080406233006.DF10BB45B@smtpgrey-2.real-time.com> Update of /cvsroot/netrek/client/netrekxp/resources/docs In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv26701/resources/docs Modified Files: changes.txt Log Message: Update client name to 2009, version back to 1.0. Fixed a type in changes.txt. Updated cygwin1.dll to mkkey works (sigh). Index: changes.txt =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/resources/docs/changes.txt,v retrieving revision 1.201 retrieving revision 1.202 diff -u -d -r1.201 -r1.202 --- changes.txt 6 Apr 2008 22:41:43 -0000 1.201 +++ changes.txt 6 Apr 2008 23:29:55 -0000 1.202 @@ -4,9 +4,10 @@ 1) Fix to cloak bug where ships would briefly be seen to flash when entering. 2) Various bug fixes for play on a paradise server. -tactical range. New features: 1) Addition of 3rd metaserver to the metaserver list. +2) Added support for new server feature packets (lame_refit and whydead_2). + Netrek XP 2006, Version 1.3: (Released July-2007) From modemhero at users.sourceforge.net Sun Apr 6 18:29:58 2008 From: modemhero at users.sourceforge.net (Bill Balcerski) Date: Sun, 06 Apr 2008 23:29:58 +0000 Subject: [netrek-cvs] client/netrekxp/src bccnetrek.rc, 1.8, 1.9 defaults.c, 1.88, 1.89 getname.c, 1.9, 1.10 netrek.rc, 1.6, 1.7 parsemeta.c, 1.40, 1.41 vccnetrek.rc, 1.6, 1.7 Message-ID: <20080406233006.DAB0F3B40BD@smtpgrey-1.real-time.com> Update of /cvsroot/netrek/client/netrekxp/src In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv26701/src Modified Files: bccnetrek.rc defaults.c getname.c netrek.rc parsemeta.c vccnetrek.rc Log Message: Update client name to 2009, version back to 1.0. Fixed a type in changes.txt. Updated cygwin1.dll to mkkey works (sigh). Index: bccnetrek.rc =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/src/bccnetrek.rc,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- bccnetrek.rc 13 Mar 2007 19:42:06 -0000 1.8 +++ bccnetrek.rc 6 Apr 2008 23:29:56 -0000 1.9 @@ -1,20 +1,20 @@ #include "resource.h" 1 VERSIONINFO -FILEVERSION 1, 3, 0, 0 -PRODUCTVERSION 1, 3, 0, 0 +FILEVERSION 1, 0, 0, 0 +PRODUCTVERSION 1, 0, 0, 0 FILEOS VOS_DOS_WINDOWS32 FILETYPE VFT_APP { BLOCK "StringFileInfo" { BLOCK "040904E4" { VALUE "CompanyName", "Netrek\000" - VALUE "FileDescription", "Netrek XP 2006 Client\000" + VALUE "FileDescription", "Netrek XP 2009 Client\000" VALUE "FileVersion", "123456789012345678901234567890\000" - VALUE "InternalName", "Netrek XP 2006\000" - VALUE "LegalCopyright", "Copyright ? 1986-2006\000" + VALUE "InternalName", "Netrek XP 2009\000" + VALUE "LegalCopyright", "Copyright ? 1986-2009\000" VALUE "OriginalFilename", "netrek.rc\000" - VALUE "ProductName", "Netrek XP 2006 Client\000" + VALUE "ProductName", "Netrek XP 2009 Client\000" VALUE "ProductVersion", "123456789012345678901234567890\000" } } Index: vccnetrek.rc =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/src/vccnetrek.rc,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- vccnetrek.rc 13 Mar 2007 19:42:06 -0000 1.6 +++ vccnetrek.rc 6 Apr 2008 23:29:56 -0000 1.7 @@ -3,18 +3,18 @@ MAIN ICON DISCARDABLE "main.ico" 1 VERSIONINFO -FILEVERSION 1, 3, 0, 0 -PRODUCTVERSION 1, 3, 0, 0 +FILEVERSION 1, 0, 0, 0 +PRODUCTVERSION 1, 0, 0, 0 { BLOCK "StringFileInfo" { BLOCK "040904E4" { VALUE "CompanyName", "Netrek\000" - VALUE "FileDescription", "Netrek XP 2006 Client\000" + VALUE "FileDescription", "Netrek XP 2009 Client\000" VALUE "FileVersion", "123456789012345678901234567890\000" - VALUE "InternalName", "Netrek XP 2006\000" - VALUE "LegalCopyright", "Copyright ? 1986-2006\000" + VALUE "InternalName", "Netrek XP 2009\000" + VALUE "LegalCopyright", "Copyright ? 1986-2009\000" VALUE "OriginalFilename", "vccnetrek.rc\000" - VALUE "ProductName", "Netrek XP 2006 Client\000" + VALUE "ProductName", "Netrek XP 2009 Client\000" VALUE "ProductVersion", "123456789012345678901234567890\000" } } Index: getname.c =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/src/getname.c,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- getname.c 13 Apr 2007 07:12:24 -0000 1.9 +++ getname.c 6 Apr 2008 23:29:56 -0000 1.10 @@ -75,7 +75,7 @@ static char *README[] = { "", - "Netrek XP 2006 - the better netrek eXPerience!", + "Netrek XP 2009 - the better netrek eXPerience!", "", "", "", @@ -83,11 +83,11 @@ " No one takes responsibility for lost INL games etc.", " Use at your own risk! If you don't like it, don't use it.", "", - "Comments, suggestions, bugreports to: billbalcerski at hotmail.com", + "Comments, suggestions, bugreports to: billbalcerski at gmail.com", "", "Include version and architecture info in bug reports", "", - "Patches to: billbalcerski at hotmail.com", + "Patches to: billbalcerski at gmail.com", "", }; int i, length; Index: netrek.rc =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/src/netrek.rc,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- netrek.rc 13 Mar 2007 19:42:06 -0000 1.6 +++ netrek.rc 6 Apr 2008 23:29:56 -0000 1.7 @@ -28,8 +28,8 @@ // VS_VERSION_INFO VERSIONINFO - FILEVERSION 1,3,0,0 - PRODUCTVERSION 1,3,0,0 + FILEVERSION 1,0,0,0 + PRODUCTVERSION 1,0,0,0 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x3L @@ -46,14 +46,14 @@ BEGIN VALUE "Comments", "\0" VALUE "CompanyName", "Netrek\0" - VALUE "FileDescription", "Netrek XP 2006 Client\0" + VALUE "FileDescription", "Netrek XP 2009 Client\0" VALUE "FileVersion", "1, 3, 0, 0\0" - VALUE "InternalName", "Netrek XP 2006\0" - VALUE "LegalCopyright", "Copyright ? 1986-2006\0" + VALUE "InternalName", "Netrek XP 2009\0" + VALUE "LegalCopyright", "Copyright ? 1986-2009\0" VALUE "LegalTrademarks", "\0" VALUE "OriginalFilename", "netrek.rc\0" VALUE "PrivateBuild", "\0" - VALUE "ProductName", "Netrek XP 2006 Client\0" + VALUE "ProductName", "Netrek XP 2009 Client\0" VALUE "ProductVersion", "1, 3, 0, 0\0" VALUE "SpecialBuild", "\0" END Index: parsemeta.c =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/src/parsemeta.c,v retrieving revision 1.40 retrieving revision 1.41 diff -u -d -r1.40 -r1.41 --- parsemeta.c 21 Feb 2008 04:32:25 -0000 1.40 +++ parsemeta.c 6 Apr 2008 23:29:56 -0000 1.41 @@ -441,7 +441,7 @@ token = strtok(NULL,","); } /* while (token != NULL) */ - metaWindowName = "Netrek XP 2006 Server List"; + metaWindowName = "Netrek XP 2009 Server List"; return sent; } @@ -1165,7 +1165,7 @@ } free (sockbuf); - metaWindowName = "Netrek XP 2006 Server List"; + metaWindowName = "Netrek XP 2009 Server List"; return 1; } Index: defaults.c =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/src/defaults.c,v retrieving revision 1.88 retrieving revision 1.89 diff -u -d -r1.88 -r1.89 --- defaults.c 29 Jul 2007 01:38:43 -0000 1.88 +++ defaults.c 6 Apr 2008 23:29:56 -0000 1.89 @@ -1753,7 +1753,7 @@ int i; if (strlen (pigcall) == 0) - sprintf (pigcall, "Netrek XP 2006 (%s) - the smarter netrek eXPerience!", mvers); + sprintf (pigcall, "Netrek XP 2009 (%s) - the smarter netrek eXPerience!", mvers); timerType = intDefault ("timerType", timerType); if (timerType < T_NONE || timerType >= T_TOTAL) From modemhero at users.sourceforge.net Sun Apr 6 18:29:59 2008 From: modemhero at users.sourceforge.net (Bill Balcerski) Date: Sun, 06 Apr 2008 23:29:59 +0000 Subject: [netrek-cvs] client/netrekxp/tools cygwin1.dll,1.3,1.4 Message-ID: <20080406233007.CCFE93B40BD@smtpgrey-1.real-time.com> Update of /cvsroot/netrek/client/netrekxp/tools In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv26701/tools Modified Files: cygwin1.dll Log Message: Update client name to 2009, version back to 1.0. Fixed a type in changes.txt. Updated cygwin1.dll to mkkey works (sigh). Index: cygwin1.dll =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/tools/cygwin1.dll,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 Binary files /tmp/cvsZRLrAE and /tmp/cvsNztj82 differ From modemhero at users.sourceforge.net Sun Apr 6 18:29:57 2008 From: modemhero at users.sourceforge.net (Bill Balcerski) Date: Sun, 06 Apr 2008 23:29:57 +0000 Subject: [netrek-cvs] client/netrekxp NetrekXP to do list.C, 1.158, 1.159 compile.txt, 1.14, 1.15 copyright.txt, 1.3, 1.4 Message-ID: <20080406233037.3B6B6B44A@smtpgrey-2.real-time.com> Update of /cvsroot/netrek/client/netrekxp In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv26701 Modified Files: NetrekXP to do list.C compile.txt copyright.txt Log Message: Update client name to 2009, version back to 1.0. Fixed a type in changes.txt. Updated cygwin1.dll to mkkey works (sigh). Index: NetrekXP to do list.C =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/NetrekXP to do list.C,v retrieving revision 1.158 retrieving revision 1.159 diff -u -d -r1.158 -r1.159 --- NetrekXP to do list.C 6 Apr 2008 22:41:40 -0000 1.158 +++ NetrekXP to do list.C 6 Apr 2008 23:29:54 -0000 1.159 @@ -12,7 +12,6 @@ 9) on daemon exit in newbie/pret, kill any hosed bot slots 10) end game bots are stupid, and on timericide don't act right 11) feature packet for rank names and requirements -12) feature packet for KSHIP2 and KTORP2 p_whydead messages Things that are sorta fixed, but could use improvement: 1) Border issue - quite complex problem, how to know the borders to obey after the bitmap @@ -63,4 +62,3 @@ - fix accelerated scroll for microsoft mice - add msg.phaser to enable formatting of phaser messages - parse Announcer messages in hockey games - Index: compile.txt =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/compile.txt,v retrieving revision 1.14 retrieving revision 1.15 diff -u -d -r1.14 -r1.15 --- compile.txt 27 Apr 2007 07:15:27 -0000 1.14 +++ compile.txt 6 Apr 2008 23:29:54 -0000 1.15 @@ -1,7 +1,7 @@ This source tree was tested with Borland C Builder 5.5, and Microsoft Visual C++ 2005 Express Edition. The client can also be compiled with MS Visual C++ 6.0, and the instructions below explain how to do so. However, this compiler is no longer supported by the Netrek -XP 2006 author as it is not free software (everything else needed for compiling is free). +XP 2009 author as it is not free software (everything else needed for compiling is free). I'd like however to discourage you from using Borland's compiler unless you know how to debug its binaries. The output is also slower even though speed optimizations Index: copyright.txt =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/copyright.txt,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- copyright.txt 21 Apr 2006 12:00:06 -0000 1.3 +++ copyright.txt 6 Apr 2008 23:29:54 -0000 1.4 @@ -107,7 +107,7 @@ * Netrek XP Mod * Stas Pirogov (keyos at keyos.org) * - * ----------------------------------------------------------- Copyright 2006 + * ----------------------------------------------------------- Copyright 2009 * * As above. * From modemhero at users.sourceforge.net Sat Apr 12 18:28:31 2008 From: modemhero at users.sourceforge.net (Bill Balcerski) Date: Sat, 12 Apr 2008 23:28:31 +0000 Subject: [netrek-cvs] client/netrekxp NetrekXP to do list.C, 1.159, 1.160 clientr.suo, 1.143, 1.144 Message-ID: <20080412232840.5BE22B3FA@smtpgrey-2.real-time.com> Update of /cvsroot/netrek/client/netrekxp In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv29682 Modified Files: NetrekXP to do list.C clientr.suo Log Message: Update todo list. Fix typo in changes.txt. Adds new icons/pointers for paradise planets, rather than sharing the same data structures as bronco planets, so that paradise planet bitmaps are always loaded into memory. Which planet bitmaps to use depends on whether it is a paradise server or not. Index: NetrekXP to do list.C =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/NetrekXP to do list.C,v retrieving revision 1.159 retrieving revision 1.160 diff -u -d -r1.159 -r1.160 --- NetrekXP to do list.C 6 Apr 2008 23:29:54 -0000 1.159 +++ NetrekXP to do list.C 12 Apr 2008 23:28:28 -0000 1.160 @@ -34,6 +34,7 @@ if you fly into the NW corner of the galaxy. this was never anticipated! 6) Tractor on/off and pressor on/off option, rather than just tractor on, pressor on. Maybe with enforced state? +7) Verbosity setting for logfile..phaser and torp warn messages can be very spammy. Paradise issues: 1) Motd paging system gutted for sake of simplicity @@ -51,6 +52,7 @@ 9) CV army capacity is wrong - waiting on word from server experts to the right value 11) Playing back recordings made by linux pclient is probably impossible. 12) Mysterious crash bug, not reproducible by me. +13) Issue with phaser misses on latest paradise server? on whitestar at least Wish list: 1) Rewrite graphics engine using SDL Index: clientr.suo =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/clientr.suo,v retrieving revision 1.143 retrieving revision 1.144 diff -u -d -r1.143 -r1.144 Binary files /tmp/cvsWh3je8 and /tmp/cvsDD75GM differ From modemhero at users.sourceforge.net Sat Apr 12 18:28:31 2008 From: modemhero at users.sourceforge.net (Bill Balcerski) Date: Sat, 12 Apr 2008 23:28:31 +0000 Subject: [netrek-cvs] client/netrekxp/include bitmaps.h, 1.23, 1.24 data.h, 1.93, 1.94 Message-ID: <20080412232840.7ABEC3B4080@smtpgrey-1.real-time.com> Update of /cvsroot/netrek/client/netrekxp/include In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv29682/include Modified Files: bitmaps.h data.h Log Message: Update todo list. Fix typo in changes.txt. Adds new icons/pointers for paradise planets, rather than sharing the same data structures as bronco planets, so that paradise planet bitmaps are always loaded into memory. Which planet bitmaps to use depends on whether it is a paradise server or not. Index: bitmaps.h =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/include/bitmaps.h,v retrieving revision 1.23 retrieving revision 1.24 diff -u -d -r1.23 -r1.24 --- bitmaps.h 12 Jun 2007 01:23:17 -0000 1.23 +++ bitmaps.h 12 Apr 2008 23:28:29 -0000 1.24 @@ -151,12 +151,11 @@ #define BMP_MPLANET_HEIGHT 16 #ifdef PARADISE -#define PLANET_VIEWS 13 -#define MPLANET_VIEWS 13 -#else +#define PARADISE_PLANET_VIEWS 13 +#define PARADISE_MPLANET_VIEWS 13 +#endif #define PLANET_VIEWS 9 #define MPLANET_VIEWS 9 -#endif // Color planets Index: data.h =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/include/data.h,v retrieving revision 1.93 retrieving revision 1.94 diff -u -d -r1.93 -r1.94 --- data.h 6 Apr 2008 22:41:42 -0000 1.93 +++ data.h 12 Apr 2008 23:28:29 -0000 1.94 @@ -281,6 +281,7 @@ extern double Sin[], Cos[]; #ifdef PARADISE +extern int paradise; extern int received_terrain_info; extern int terrain_x; extern int terrain_y; @@ -430,6 +431,12 @@ extern W_Icon base_mplanets; extern W_Icon bplanets[PLANET_VIEWS]; extern W_Icon bmplanets[MPLANET_VIEWS]; +#ifdef PARADISE +extern W_Icon paradise_base_planets; +extern W_Icon paradise_base_mplanets; +extern W_Icon paradise_bplanets[PARADISE_PLANET_VIEWS]; +extern W_Icon paradise_bmplanets[PARADISE_PLANET_VIEWS]; +#endif extern W_Color borderColor, backColor, textColor, myColor, warningColor, shipCol[5], rColor, yColor, gColor, unColor, foreColor; extern char *colornames[COLORS]; From modemhero at users.sourceforge.net Sat Apr 12 18:28:31 2008 From: modemhero at users.sourceforge.net (Bill Balcerski) Date: Sat, 12 Apr 2008 23:28:31 +0000 Subject: [netrek-cvs] client/netrekxp/resources/docs changes.txt, 1.202, 1.203 Message-ID: <20080412232840.5FEB13B4076@smtpgrey-1.real-time.com> Update of /cvsroot/netrek/client/netrekxp/resources/docs In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv29682/resources/docs Modified Files: changes.txt Log Message: Update todo list. Fix typo in changes.txt. Adds new icons/pointers for paradise planets, rather than sharing the same data structures as bronco planets, so that paradise planet bitmaps are always loaded into memory. Which planet bitmaps to use depends on whether it is a paradise server or not. Index: changes.txt =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/resources/docs/changes.txt,v retrieving revision 1.202 retrieving revision 1.203 diff -u -d -r1.202 -r1.203 --- changes.txt 6 Apr 2008 23:29:55 -0000 1.202 +++ changes.txt 12 Apr 2008 23:28:29 -0000 1.203 @@ -1,7 +1,8 @@ Netrek XP 2009, Version 1.0: (Released April-2008) General bug fixes: -1) Fix to cloak bug where ships would briefly be seen to flash when entering. +1) Fix to cloak bug where ships would briefly be seen to flash when entering +tactical. 2) Various bug fixes for play on a paradise server. New features: From modemhero at users.sourceforge.net Sat Apr 12 18:28:32 2008 From: modemhero at users.sourceforge.net (Bill Balcerski) Date: Sat, 12 Apr 2008 23:28:32 +0000 Subject: [netrek-cvs] client/netrekxp/src data.c, 1.102, 1.103 local.c, 1.108, 1.109 map.c, 1.61, 1.62 mswindow.c, 1.87, 1.88 newwin.c, 1.69, 1.70 option.c, 1.51, 1.52 socket.c, 1.38, 1.39 Message-ID: <20080412232840.63E333B407F@smtpgrey-1.real-time.com> Update of /cvsroot/netrek/client/netrekxp/src In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv29682/src Modified Files: data.c local.c map.c mswindow.c newwin.c option.c socket.c Log Message: Update todo list. Fix typo in changes.txt. Adds new icons/pointers for paradise planets, rather than sharing the same data structures as bronco planets, so that paradise planet bitmaps are always loaded into memory. Which planet bitmaps to use depends on whether it is a paradise server or not. Index: mswindow.c =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/src/mswindow.c,v retrieving revision 1.87 retrieving revision 1.88 diff -u -d -r1.87 -r1.88 --- mswindow.c 12 Jun 2007 01:23:18 -0000 1.87 +++ mswindow.c 12 Apr 2008 23:28:29 -0000 1.88 @@ -557,6 +557,12 @@ free (bplanets[i]); for (i = 0; i < MPLANET_VIEWS; i++) free (bmplanets[i]); +#ifdef PARADISE + for (i = 0; i < PARADISE_PLANET_VIEWS; i++) + free (paradise_bplanets[i]); + for (i = 0; i < PARADISE_MPLANET_VIEWS; i++) + free (paradise_bmplanets[i]); +#endif for (i = 0; i < BMP_SHIPEXPL_FRAMES; i++) free (expview[i]); Index: newwin.c =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/src/newwin.c,v retrieving revision 1.69 retrieving revision 1.70 diff -u -d -r1.69 -r1.70 --- newwin.c 12 Jun 2007 01:23:18 -0000 1.69 +++ newwin.c 12 Apr 2008 23:28:29 -0000 1.70 @@ -1309,6 +1309,10 @@ int i, k; char *Planlib; char *MPlanlib; +#ifdef PARADISE + char *Paradise_Planlib; + char *Paradise_MPlanlib; +#endif planetBitmap = intDefault ("planetBitmap", planetBitmap); planetBitmapGalaxy = intDefault ("planetBitmapGalaxy", planetBitmapGalaxy); @@ -1319,9 +1323,9 @@ loadparadisethings(); #endif #ifdef PARADISE - Planlib = "bitmaps/paradise/paradise_plan.bmp"; - MPlanlib = "bitmaps/paradise/paradise_mplan.bmp"; -#else + Paradise_Planlib = "bitmaps/paradise/paradise_plan.bmp"; + Paradise_MPlanlib = "bitmaps/paradise/paradise_mplan.bmp"; +#endif switch (planetBitmap) // Case 3 = new color, but we never use Planlib { case 1: @@ -1346,7 +1350,6 @@ MPlanlib = "bitmaps/planlibm/mplan.bmp"; break; } -#endif if (!dynamicBitmaps) /* Only load needed bitmaps */ { @@ -1477,6 +1480,14 @@ base_mplanets = W_StoreBitmap3 (MPlanlib, BMP_MPLANET_WIDTH, BMP_MPLANET_HEIGHT * PLANET_VIEWS, BMP_MPLANET000, mapw, LR_MONOCHROME); +#ifdef PARADISE + paradise_base_planets = + W_StoreBitmap3 (Paradise_Planlib, BMP_PLANET_WIDTH, BMP_PLANET_HEIGHT * PARADISE_PLANET_VIEWS, + BMP_PLANET000, w, LR_MONOCHROME); + paradise_base_mplanets = + W_StoreBitmap3 (Paradise_MPlanlib, BMP_MPLANET_WIDTH, BMP_MPLANET_HEIGHT * PARADISE_PLANET_VIEWS, + BMP_MPLANET000, mapw, LR_MONOCHROME); +#endif for (k = 0; k < PLANET_VIEWS; k++) { @@ -1487,6 +1498,17 @@ W_PointBitmap2 (base_mplanets, 0, k, BMP_MPLANET_WIDTH, BMP_MPLANET_HEIGHT); } +#ifdef PARADISE + for (k = 0; k < PARADISE_PLANET_VIEWS; k++) + { + paradise_bplanets[k] = + W_PointBitmap2 (paradise_base_planets, 0, k, BMP_PLANET_WIDTH, + BMP_PLANET_HEIGHT); + paradise_bmplanets[k] = + W_PointBitmap2 (paradise_base_mplanets, 0, k, BMP_MPLANET_WIDTH, + BMP_MPLANET_HEIGHT); + } +#endif if (colorClient > 0) { Index: local.c =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/src/local.c,v retrieving revision 1.108 retrieving revision 1.109 diff -u -d -r1.108 -r1.109 --- local.c 29 Nov 2007 05:29:06 -0000 1.108 +++ local.c 12 Apr 2008 23:28:29 -0000 1.109 @@ -391,7 +391,7 @@ if (p->pl_flags & PLFUEL) i += 1; #ifdef PARADISE - if (p->pl_flags & PLSHIPYARD) + if (paradise && (p->pl_flags & PLSHIPYARD)) { i = 9; /* Base for shipyards */ if (p->pl_flags & PLFUEL) @@ -400,11 +400,21 @@ i += 2; } #endif - return (bplanets[i]); +#ifdef PARADISE + if (paradise) + return (paradise_bplanets[i]); + else +#endif + return (bplanets[i]); } else { - return (bplanets[8]); +#ifdef PARADISE + if (paradise) + return (paradise_bplanets[8]); + else +#endif + return (bplanets[8]); } } Index: option.c =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/src/option.c,v retrieving revision 1.51 retrieving revision 1.52 diff -u -d -r1.51 -r1.52 --- option.c 29 Jul 2007 01:38:44 -0000 1.51 +++ option.c 12 Apr 2008 23:28:30 -0000 1.52 @@ -776,7 +776,11 @@ RedrawPlayerList (); } /* Let's see if this is our option changed */ - else if (op->op_option == &planetBitmap) + else if (op->op_option == &planetBitmap +#ifdef PARADISE + && !paradise // Paradise bitmaps stay loaded at all times +#endif + ) { if (planetBitmap != 3) // Color planet bitmaps stay loaded at all times { @@ -785,9 +789,6 @@ for (i = 0; i < PLANET_VIEWS; i++) free (bplanets[i]); -#ifdef PARADISE - Planlib = "bitmaps/paradise/paradise_plan.bmp"; -#else switch (planetBitmap) { case 1: @@ -800,7 +801,7 @@ Planlib = "bitmaps/planlibm/plan.bmp"; break; } -#endif + base_planets = W_StoreBitmap3 (Planlib, BMP_PLANET_WIDTH, BMP_PLANET_HEIGHT * 9, BMP_PLANET000, w, LR_MONOCHROME); @@ -813,7 +814,11 @@ redrawall = 1; } - else if (op->op_option == &planetBitmapGalaxy) + else if (op->op_option == &planetBitmapGalaxy +#ifdef PARADISE + && !paradise // Paradise bitmaps stay loaded at all times +#endif + ) { if (planetBitmapGalaxy != 3) // Color planet bitmaps stay loaded at all times { @@ -822,9 +827,6 @@ for (i = 0; i < MPLANET_VIEWS; i++) free (bmplanets[i]); -#ifdef PARADISE - MPlanlib = "bitmaps/paradise/paradise_mplan.bmp"; -#else switch (planetBitmapGalaxy) { case 1: @@ -837,7 +839,7 @@ MPlanlib = "bitmaps/planlibm/mplan.bmp"; break; } -#endif + base_mplanets = W_StoreBitmap3 (MPlanlib, BMP_MPLANET_WIDTH, BMP_MPLANET_HEIGHT * 9, BMP_MPLANET000, mapw, LR_MONOCHROME); Index: data.c =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/src/data.c,v retrieving revision 1.102 retrieving revision 1.103 diff -u -d -r1.102 -r1.103 --- data.c 6 Apr 2008 22:41:43 -0000 1.102 +++ data.c 12 Apr 2008 23:28:29 -0000 1.103 @@ -277,6 +277,7 @@ extern double Sin[], Cos[]; #ifdef PARADISE +int paradise = 0; /* is the server a paradise server */ int received_terrain_info = 0; int terrain_x; int terrain_y; @@ -425,6 +426,12 @@ W_Icon base_mplanets; W_Icon bplanets[PLANET_VIEWS]; W_Icon bmplanets[MPLANET_VIEWS]; +#ifdef PARADISE +W_Icon paradise_base_planets; +W_Icon paradise_base_mplanets; +W_Icon paradise_bplanets[PARADISE_PLANET_VIEWS]; +W_Icon paradise_bmplanets[PARADISE_PLANET_VIEWS]; +#endif /* jn - SMARTMACRO */ Index: socket.c =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/src/socket.c,v retrieving revision 1.38 retrieving revision 1.39 diff -u -d -r1.38 -r1.39 --- socket.c 6 Apr 2008 22:41:45 -0000 1.38 +++ socket.c 12 Apr 2008 23:28:30 -0000 1.39 @@ -1918,16 +1918,12 @@ { loginAccept = packet->accept; #ifdef PARADISE - if ((packet->pad2 != 69) && (packet->pad3 != 42)) - { - LineToConsole ("Paradise.exe only works on paradise servers, either select a paradise server or use netrek.exe.\n"); - exit (0); - } -#else if ((packet->pad2 == 69) && (packet->pad3 == 42)) - { - LineToConsole ("Netrek.exe only works on non-paradise servers, either select a non-paradise server or use paradise.exe.\n"); - exit (0); + paradise = 1; + else { + /*nshiptypes = 8;*/ + /*nplayers=20;*/ + /*nplanets=40;*/ } #endif if (packet->accept) Index: map.c =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/src/map.c,v retrieving revision 1.61 retrieving revision 1.62 diff -u -d -r1.61 -r1.62 --- map.c 16 Jul 2007 23:44:18 -0000 1.61 +++ map.c 12 Apr 2008 23:28:29 -0000 1.62 @@ -347,7 +347,7 @@ if (p->pl_flags & PLFUEL) i += 1; #ifdef PARADISE - if (p->pl_flags & PLSHIPYARD) + if (paradise && (p->pl_flags & PLSHIPYARD)) { i = 9; /* Base for shipyards */ if (p->pl_flags & PLFUEL) @@ -356,11 +356,21 @@ i += 2; } #endif - return bmplanets[i]; +#ifdef PARADISE + if (paradise) + return (paradise_bmplanets[i]); + else +#endif + return bmplanets[i]; } else { - return (bmplanets[8]); +#ifdef PARADISE + if (paradise) + return (paradise_bmplanets[8]); + else +#endif + return (bmplanets[8]); } } From modemhero at users.sourceforge.net Sat Apr 12 21:25:52 2008 From: modemhero at users.sourceforge.net (Bill Balcerski) Date: Sun, 13 Apr 2008 02:25:52 +0000 Subject: [netrek-cvs] client/netrekxp NetrekXP to do list.C,1.160,1.161 Message-ID: <20080413022630.AA2F83B4078@smtpgrey-1.real-time.com> Update of /cvsroot/netrek/client/netrekxp In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv17664 Modified Files: NetrekXP to do list.C Log Message: This patch changes the number of planets from a static to dynamic define. Paradise servers can have more than 40 planets, so we first redefine the maximum # of planets that we will ever receive, which is MAXPLANETS = 60. This is a change from the previous value of MAXPLANETS = 40. We then use a 2nd variable, nplanets, to keep track of how many planets the server actually has. The default value of nplanets is 40, which is what is used for bronco. Most places in the code dealing with loop checks have been changed from MAXPLANETS to nplanets. In a few cases where arrays are defined, the MAXPLANETS value is still used. The planet window is initially created at bronco size, but as more planets are received via handlePlanet2, the window is recreated to fit the added planets. Added another possible bug to the paradise todo list. Fixed bug where print_packets was erroneously changing the value of nplanets. Index: NetrekXP to do list.C =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/NetrekXP to do list.C,v retrieving revision 1.160 retrieving revision 1.161 diff -u -d -r1.160 -r1.161 --- NetrekXP to do list.C 12 Apr 2008 23:28:28 -0000 1.160 +++ NetrekXP to do list.C 13 Apr 2008 02:25:49 -0000 1.161 @@ -53,6 +53,8 @@ 11) Playing back recordings made by linux pclient is probably impossible. 12) Mysterious crash bug, not reproducible by me. 13) Issue with phaser misses on latest paradise server? on whitestar at least +14) Don't think there is gettarget support for astral bodies like nebulae and stars +and black holes. Might be an issue with macros. Wish list: 1) Rewrite graphics engine using SDL From modemhero at users.sourceforge.net Sat Apr 12 21:25:52 2008 From: modemhero at users.sourceforge.net (Bill Balcerski) Date: Sun, 13 Apr 2008 02:25:52 +0000 Subject: [netrek-cvs] client/netrekxp/include data.h, 1.94, 1.95 defs.h, 1.28, 1.29 Message-ID: <20080413022632.4B9A2B3F6@smtpgrey-2.real-time.com> Update of /cvsroot/netrek/client/netrekxp/include In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv17664/include Modified Files: data.h defs.h Log Message: This patch changes the number of planets from a static to dynamic define. Paradise servers can have more than 40 planets, so we first redefine the maximum # of planets that we will ever receive, which is MAXPLANETS = 60. This is a change from the previous value of MAXPLANETS = 40. We then use a 2nd variable, nplanets, to keep track of how many planets the server actually has. The default value of nplanets is 40, which is what is used for bronco. Most places in the code dealing with loop checks have been changed from MAXPLANETS to nplanets. In a few cases where arrays are defined, the MAXPLANETS value is still used. The planet window is initially created at bronco size, but as more planets are received via handlePlanet2, the window is recreated to fit the added planets. Added another possible bug to the paradise todo list. Fixed bug where print_packets was erroneously changing the value of nplanets. Index: defs.h =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/include/defs.h,v retrieving revision 1.28 retrieving revision 1.29 diff -u -d -r1.28 -r1.29 --- defs.h 7 Jun 2007 04:43:36 -0000 1.28 +++ defs.h 13 Apr 2008 02:25:50 -0000 1.29 @@ -45,11 +45,9 @@ #define TESTERS 4 /* Priveledged slots for * robots and game 'testers' */ -#ifdef PARADISE -#define MAXPLANETS 60 -#else -#define MAXPLANETS 40 -#endif + +#define MAXPLANETS 60 /* Maximum planets any server will send us. + Bronco has 40, paradise can go up to 60 */ #define MAXTORP 8 #define MAXPLASMA 1 #define PKEY 128 Index: data.h =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/include/data.h,v retrieving revision 1.94 retrieving revision 1.95 diff -u -d -r1.94 -r1.95 --- data.h 12 Apr 2008 23:28:29 -0000 1.94 +++ data.h 13 Apr 2008 02:25:50 -0000 1.95 @@ -57,6 +57,7 @@ extern int TWINSIDE; extern int GWINSIDE; +extern int nplanets; extern unsigned int oldalert; extern unsigned char oldtourn; extern unsigned int oldengflag; @@ -296,7 +297,6 @@ extern int ngthingies; extern int nplasmas; extern int nphasers; -extern int nplanets; extern struct teaminfo_s *teaminfo; extern int number_of_teams; /* MOTD data */ From modemhero at users.sourceforge.net Sat Apr 12 21:25:55 2008 From: modemhero at users.sourceforge.net (Bill Balcerski) Date: Sun, 13 Apr 2008 02:25:55 +0000 Subject: [netrek-cvs] client/netrekxp/src dashboard.c, 1.24, 1.25 data.c, 1.103, 1.104 input.c, 1.42, 1.43 local.c, 1.109, 1.110 map.c, 1.62, 1.63 newwin.c, 1.70, 1.71 planetlist.c, 1.10, 1.11 rotate.c, 1.3, 1.4 short.c, 1.24, 1.25 socket.c, 1.39, 1.40 util.c, 1.6, 1.7 Message-ID: <20080413022607.23676B3F6@smtpgrey-2.real-time.com> Update of /cvsroot/netrek/client/netrekxp/src In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv17664/src Modified Files: dashboard.c data.c input.c local.c map.c newwin.c planetlist.c rotate.c short.c socket.c util.c Log Message: This patch changes the number of planets from a static to dynamic define. Paradise servers can have more than 40 planets, so we first redefine the maximum # of planets that we will ever receive, which is MAXPLANETS = 60. This is a change from the previous value of MAXPLANETS = 40. We then use a 2nd variable, nplanets, to keep track of how many planets the server actually has. The default value of nplanets is 40, which is what is used for bronco. Most places in the code dealing with loop checks have been changed from MAXPLANETS to nplanets. In a few cases where arrays are defined, the MAXPLANETS value is still used. The planet window is initially created at bronco size, but as more planets are received via handlePlanet2, the window is recreated to fit the added planets. Added another possible bug to the paradise todo list. Fixed bug where print_packets was erroneously changing the value of nplanets. Index: dashboard.c =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/src/dashboard.c,v retrieving revision 1.24 retrieving revision 1.25 diff -u -d -r1.24 -r1.25 --- dashboard.c 25 May 2007 03:36:46 -0000 1.24 +++ dashboard.c 13 Apr 2008 02:25:50 -0000 1.25 @@ -1155,7 +1155,7 @@ int target; closedist = GWIDTH; - for (i = 0, k = &planets[i]; i < MAXPLANETS; i++, k++) + for (i = 0, k = &planets[i]; i < nplanets; i++, k++) { dist = hypot ((double) (x - k->pl_x), (double) (y - k->pl_y)); if (dist < closedist) Index: rotate.c =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/src/rotate.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- rotate.c 21 Feb 2007 15:17:08 -0000 1.3 +++ rotate.c 13 Apr 2008 02:25:51 -0000 1.4 @@ -96,7 +96,7 @@ redrawall = 1; reinitPlanets = 1; - for (i = 0, l = planets; i < MAXPLANETS; i++, l++) + for (i = 0, l = planets; i < nplanets; i++, l++) { if (rotate) { Index: newwin.c =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/src/newwin.c,v retrieving revision 1.70 retrieving revision 1.71 diff -u -d -r1.70 -r1.71 --- newwin.c 12 Apr 2008 23:28:29 -0000 1.70 +++ newwin.c 13 Apr 2008 02:25:51 -0000 1.71 @@ -1006,11 +1006,9 @@ W_SetWindowKeyDownHandler (warnw, handleMessageWindowKeyDown); -#ifdef PARADISE - planetw = W_MakeTextWindow ("planet", TWINSIDE + 2 * THICKBORDER + 10, 10, 75, MAXPLANETS + 8, baseWin, 2); -#else - planetw = W_MakeTextWindow ("planet", TWINSIDE + 2 * THICKBORDER + 10, 10, 57, MAXPLANETS + 3, baseWin, 2); -#endif + // Planet window sized assuming only 40 (nplanets) planets, can be resized if more planets received + // see void handlePlanet2 in socket.c + planetw = W_MakeTextWindow ("planet", TWINSIDE + 2 * THICKBORDER + 10, 10, 57, nplanets + 3, baseWin, 2); W_SetWindowExposeHandler (planetw, planetlist); #ifdef PARADISE @@ -2106,7 +2104,7 @@ if (planets[remap[owner] * 10 - 10].pl_couptime == 0) return (0); - for (i = 0, p = planets; i < MAXPLANETS; i++, p++) + for (i = 0, p = planets; i < nplanets; i++, p++) { if (p->pl_owner & owner) { Index: input.c =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/src/input.c,v retrieving revision 1.42 retrieving revision 1.43 diff -u -d -r1.42 -r1.43 --- input.c 25 May 2007 03:36:46 -0000 1.42 +++ input.c 13 Apr 2008 02:25:51 -0000 1.43 @@ -355,7 +355,7 @@ } closedist = GWIDTH; - for (i = 0, k = &planets[i]; i < MAXPLANETS; i++, k++) + for (i = 0, k = &planets[i]; i < nplanets; i++, k++) { dist = hypot ((double) (g_x - k->pl_x), (double) (g_y - k->pl_y)); if (dist < closedist) Index: local.c =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/src/local.c,v retrieving revision 1.109 retrieving revision 1.110 diff -u -d -r1.109 -r1.110 --- local.c 12 Apr 2008 23:28:29 -0000 1.109 +++ local.c 13 Apr 2008 02:25:51 -0000 1.110 @@ -580,7 +580,7 @@ register struct planet *l; int view = scaleFactor * TWINSIDE / 2 + BMP_PLANET_WIDTH * SCALE / 2; - for (l = planets + MAXPLANETS - 1; l >= planets; --l) + for (l = planets + nplanets - 1; l >= planets; --l) { dx = l->pl_x - me->p_x; dy = l->pl_y - me->p_y; Index: planetlist.c =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/src/planetlist.c,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- planetlist.c 6 Apr 2008 22:41:45 -0000 1.10 +++ planetlist.c 13 Apr 2008 02:25:51 -0000 1.11 @@ -328,7 +328,7 @@ /* Store # of visible planets from each team. And let's sort them by army count (low to high) while we are at it. */ - for (i = 0, j = &planets[i]; i < MAXPLANETS; i++, j++) + for (i = 0, j = &planets[i]; i < nplanets; i++, j++) { if (j->pl_info & me->p_team) { @@ -429,7 +429,7 @@ planetOffset[1],planetOffset[2],planetOffset[3],planetOffset[4],planetOffset[5]); #endif - for (i = 0, j = &planets[i]; i < MAXPLANETS; i++, j++) + for (i = 0, j = &planets[i]; i < nplanets; i++, j++) { if (sortPlanets) { @@ -572,7 +572,7 @@ int GetPlanetFromPlist (int x, int y) { - if (y < MAXPLANETS && y >= 0) + if (y < nplanets && y >= 0) return planet_row[y]; else return (-1); Index: short.c =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/src/short.c,v retrieving revision 1.24 retrieving revision 1.25 diff -u -d -r1.24 -r1.25 --- short.c 7 Jun 2007 04:43:39 -0000 1.24 +++ short.c 13 Apr 2008 02:25:52 -0000 1.25 @@ -1131,12 +1131,12 @@ numofplanets = (unsigned char) sbuf[1]; - if (numofplanets > MAXPLANETS + 1) + if (numofplanets > nplanets + 1) return; for (i = 0; i < numofplanets; i++, packet++) { - if (packet->pnum >= MAXPLANETS) + if (packet->pnum < 0 || packet->pnum >= nplanets) continue; plan = &planets[packet->pnum]; Index: util.c =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/src/util.c,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- util.c 7 Apr 2007 05:17:39 -0000 1.6 +++ util.c 13 Apr 2008 02:25:52 -0000 1.7 @@ -111,7 +111,7 @@ closedist = GWIDTH; if (targtype & TARG_PLANET) { - for (i = 0, k = &planets[i]; i < MAXPLANETS; i++, k++) + for (i = 0, k = &planets[i]; i < nplanets; i++, k++) { dist = hypot ((double) (x - k->pl_x), (double) (y - k->pl_y)); if (dist < closedist) Index: map.c =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/src/map.c,v retrieving revision 1.62 retrieving revision 1.63 diff -u -d -r1.62 -r1.63 --- map.c 12 Apr 2008 23:28:29 -0000 1.62 +++ map.c 13 Apr 2008 02:25:51 -0000 1.63 @@ -124,7 +124,7 @@ #else pRadius = BMP_MPLANET_WIDTH * GWIDTH / GWINSIDE / 2; #endif - for (k = 0, pl = planets; k < MAXPLANETS; k++, pl++) + for (k = 0, pl = planets; k < nplanets; k++, pl++) { /* Size of planet is pRadius but a ship will touch the planet if @@ -164,7 +164,7 @@ } /* Now loop for the new planet bitmaps, which are roughly 50% wider */ pRadius = 3 * BMP_MPLANET_WIDTH * GWIDTH / GWINSIDE / 4; - for (k = 0, pl = planets; k < MAXPLANETS; k++, pl++) + for (k = 0, pl = planets; k < nplanets; k++, pl++) { /* Size of planet is pRadius but a ship will touch the planet if @@ -225,7 +225,7 @@ const int tHeight = W_Textheight * GWIDTH / GWINSIDE; const int tWidth = W_Textwidth * GWIDTH / GWINSIDE; - for (k = 0, pl = planets; k < MAXPLANETS; k++, pl++) + for (k = 0, pl = planets; k < nplanets; k++, pl++) { startX = (pl->pl_x - pRadius - tWidth) / SIZE; endX = (pl->pl_x + pRadius + tWidth + (tWidth / 2)) / SIZE; @@ -543,11 +543,11 @@ register int dx, dy; char ch, agri_name[3]; - for (l = planets + MAXPLANETS - 1; l >= planets; --l) + for (l = planets + nplanets - 1; l >= planets; --l) { /* Synchronize planet info (up to 10 times/second) for current orbitted - planet. For all other planets, send info on planet 0 through planet - MAXPLANETS every MAXPLANETS/10 seconds, one planet at a time, + planet. For all other planets, send info on planet 0 through last + planet (nplanets) every nplanets/10 seconds, one planet at a time, 10 times/second. */ if (F_check_planets) { @@ -1010,7 +1010,7 @@ redrawPlayer[i] = 1; } - for (l = planets + MAXPLANETS - 1; l >= planets; --l) + for (l = planets + nplanets - 1; l >= planets; --l) l->pl_flags |= PLREDRAW; } else @@ -1195,7 +1195,7 @@ /* Increment counter for requesting planet sync (F_check_planets) */ if (F_check_planets) { - if ((planet_refresh * 10 / server_ups) >= MAXPLANETS) + if ((planet_refresh * 10 / server_ups) >= nplanets) planet_refresh = 0; else planet_refresh++; @@ -1364,7 +1364,7 @@ mcleary = dy; mclearr = rad; mclearccount++; - for (pl = planets + MAXPLANETS - 1; pl >= planets; --pl) + for (pl = planets + nplanets - 1; pl >= planets; --pl) { /* Redraw check - redraw all planets in range. Have to adjust distance to account for planet radius and text Index: data.c =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/src/data.c,v retrieving revision 1.103 retrieving revision 1.104 diff -u -d -r1.103 -r1.104 --- data.c 12 Apr 2008 23:28:29 -0000 1.103 +++ data.c 13 Apr 2008 02:25:50 -0000 1.104 @@ -39,6 +39,9 @@ int TWINSIDE = 500; /* Size of tactical window */ int GWINSIDE = 500; /* Size of galactic window */ + +int nplanets = 40; /* can be larger for paradise servers, dynamically + sent via SP_PLANET2 */ int globalerr = 0; /* For sending error # between threads */ int ingame = 0; /* If player is in game - to distinguish between whether to use double buffering on the local and map window */ @@ -292,7 +295,6 @@ int ngthingies = 0; int nplasmas = 1; int nphasers = 1; -int nplanets = MAXPLANETS; /* get this info dyn. from Pserver */ struct teaminfo_s *teaminfo = NULL; int number_of_teams = 4; /* MOTD data */ Index: socket.c =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/src/socket.c,v retrieving revision 1.39 retrieving revision 1.40 diff -u -d -r1.39 -r1.40 --- socket.c 12 Apr 2008 23:28:30 -0000 1.39 +++ socket.c 13 Apr 2008 02:25:52 -0000 1.40 @@ -1759,6 +1759,8 @@ return; } #endif + if (packet->pnum > nplanets) // This shouldn't happen... + LineToConsole( "handlePlanet: received planet num larger than nplanets\n"); plan = &planets[packet->pnum]; @@ -2830,11 +2832,27 @@ { first_planet_packet = 0; nplanets = packet->pnum+1; + //Resize planet window if more than the default # of planets (40) + if (nplanets > 40) + { + W_DestroyWindow (planetw); + planetw = W_MakeTextWindow ("planet", TWINSIDE + 2 * THICKBORDER + 10, 10, 75, nplanets + 8, baseWin, 2); + W_SetWindowExposeHandler (planetw, planetlist); + } } else { if((packet->pnum+1) > nplanets) + { nplanets = packet->pnum+1; + //Resize planet window if more than the default # of planets (40) + if (nplanets > 40) + { + W_DestroyWindow (planetw); + planetw = W_MakeTextWindow ("planet", TWINSIDE + 2 * THICKBORDER + 10, 10, 75, nplanets + 8, baseWin, 2); + W_SetWindowExposeHandler (planetw, planetlist); + } + } } planets[packet->pnum].pl_owner = packet->owner; @@ -4503,7 +4521,7 @@ int i; /* lcv */ unsigned int j; unsigned char *data; - int kills, pnum, nplanets; + int kills, pnum, packet_planets; struct planet_s_spacket *plpacket; if(log_packets == 0) return; switch ( packet[0] ) @@ -4920,9 +4938,9 @@ if (log_packets > 1) { plpacket = (struct planet_s_spacket *) &packet[2]; - nplanets = packet[1]; - LineToConsole("nplanets = %d, ", nplanets); - for(i = 0; i < nplanets; i++, plpacket++ ) + packet_planets = packet[1]; + LineToConsole("packet_planets = %d, ", packet_planets); + for(i = 0; i < packet_planets; i++, plpacket++ ) LineToConsole( "pnum = %d, pl_owner = %d, info = %d, flags = %d, armies = %d ", plpacket->pnum, From modemhero at users.sourceforge.net Sat Apr 12 21:48:56 2008 From: modemhero at users.sourceforge.net (Bill Balcerski) Date: Sun, 13 Apr 2008 02:48:56 +0000 Subject: [netrek-cvs] client/netrekxp/src data.c, 1.104, 1.105 short.c, 1.25, 1.26 Message-ID: <20080413024905.17E603B407A@smtpgrey-1.real-time.com> Update of /cvsroot/netrek/client/netrekxp/src In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv27792/src Modified Files: data.c short.c Log Message: Moved galaxy width from a static to dynamic define. Very little had to change for this, most of the work had been done previously on prior paradise patches. All this patch does is remove the different definitions of GWIDTH depending on if PARADISE is defined. The only way gwidth will be altered is on paradise servers when planets are sent whose (x,y) falls outside of the 100000x100000 area, in which case the paradise protocol indicates that the new galaxy size is assumed to be 200000x200000. There's also a provision for changing the default short packet gwidth but that should never happen. Index: short.c =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/src/short.c,v retrieving revision 1.25 retrieving revision 1.26 diff -u -d -r1.25 -r1.26 --- short.c 13 Apr 2008 02:25:52 -0000 1.25 +++ short.c 13 Apr 2008 02:48:54 -0000 1.26 @@ -225,11 +225,7 @@ int spwinside = 500; /* WINSIDE from Server */ #define SPWINSIDE 500 /* To make it safe */ -#ifdef PARADISE -LONG spgwidth = 100000; -#else -LONG spgwidth = GWIDTH; -#endif +long spgwidth = 100000; void sendThreshold (short unsigned int v) Index: data.c =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/src/data.c,v retrieving revision 1.104 retrieving revision 1.105 diff -u -d -r1.104 -r1.105 --- data.c 13 Apr 2008 02:25:50 -0000 1.104 +++ data.c 13 Apr 2008 02:48:54 -0000 1.105 @@ -42,6 +42,7 @@ int nplanets = 40; /* can be larger for paradise servers, dynamically sent via SP_PLANET2 */ +int gwidth = 100000; /* can be changed by paradise server */ int globalerr = 0; /* For sending error # between threads */ int ingame = 0; /* If player is in game - to distinguish between whether to use double buffering on the local and map window */ @@ -284,7 +285,6 @@ int received_terrain_info = 0; int terrain_x; int terrain_y; -int gwidth = 100000; /* Paradise version of GWIDTH */ int gwidth_zoom = 100000; /* galaxy width, adjusted for zoom, unused */ int offsetx = 0; int offsety = 0; /* offsets when zooming [BDyess] */ From modemhero at users.sourceforge.net Sat Apr 12 21:48:56 2008 From: modemhero at users.sourceforge.net (Bill Balcerski) Date: Sun, 13 Apr 2008 02:48:56 +0000 Subject: [netrek-cvs] client/netrekxp/include data.h, 1.95, 1.96 defs.h, 1.29, 1.30 Message-ID: <20080413024905.184D0B3F6@smtpgrey-2.real-time.com> Update of /cvsroot/netrek/client/netrekxp/include In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv27792/include Modified Files: data.h defs.h Log Message: Moved galaxy width from a static to dynamic define. Very little had to change for this, most of the work had been done previously on prior paradise patches. All this patch does is remove the different definitions of GWIDTH depending on if PARADISE is defined. The only way gwidth will be altered is on paradise servers when planets are sent whose (x,y) falls outside of the 100000x100000 area, in which case the paradise protocol indicates that the new galaxy size is assumed to be 200000x200000. There's also a provision for changing the default short packet gwidth but that should never happen. Index: defs.h =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/include/defs.h,v retrieving revision 1.29 retrieving revision 1.30 diff -u -d -r1.29 -r1.30 --- defs.h 13 Apr 2008 02:25:50 -0000 1.29 +++ defs.h 13 Apr 2008 02:48:54 -0000 1.30 @@ -67,13 +67,9 @@ #define DESIRED_TIC_LEN 10 /* for desired heading */ /* These are configuration definitions */ -#ifdef PARADISE -#define GWIDTH gwidth /* Paradise has variable galaxy - width, up to 200000 */ -#else -#define GWIDTH 100000 /* galaxy is 100000 spaces - * on a side */ -#endif +#define GWIDTH gwidth /* Normally 100000, but paradise + has variable galaxy width, up + to 200000 */ #define SCALE 40 /* Window will be one pixel for these # spaces */ #define WARP1 20 /* warp one will move 20 Index: data.h =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/include/data.h,v retrieving revision 1.95 retrieving revision 1.96 diff -u -d -r1.95 -r1.96 --- data.h 13 Apr 2008 02:25:50 -0000 1.95 +++ data.h 13 Apr 2008 02:48:54 -0000 1.96 @@ -58,6 +58,7 @@ extern int GWINSIDE; extern int nplanets; +extern int gwidth; extern unsigned int oldalert; extern unsigned char oldtourn; extern unsigned int oldengflag; @@ -286,7 +287,6 @@ extern int received_terrain_info; extern int terrain_x; extern int terrain_y; -extern int gwidth; /* Paradise version of GWIDTH */ extern int gwidth_zoom; /* galaxy width, adjusted for zoom, unused */ extern int offsetx; extern int offsety; /* offsets when zooming [BDyess] */ From modemhero at users.sourceforge.net Sun Apr 13 08:50:22 2008 From: modemhero at users.sourceforge.net (Bill Balcerski) Date: Sun, 13 Apr 2008 13:50:22 +0000 Subject: [netrek-cvs] client/netrekxp/src planetlist.c, 1.11, 1.12 socket.c, 1.40, 1.41 Message-ID: <20080413135034.98ADAB3EA@smtpgrey-2.real-time.com> Update of /cvsroot/netrek/client/netrekxp/src In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv21807/src Modified Files: planetlist.c socket.c Log Message: MAXSECTORS to 20. No need to define this differently for paradise or bronco. Added in resizing planet window when paradise mode is received (need bigger window) and when planets above the assumed 40 are received (also need to make it bigger). Fixed bug in paradise planet list where wrong team name variable was being used. Index: socket.c =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/src/socket.c,v retrieving revision 1.40 retrieving revision 1.41 diff -u -d -r1.40 -r1.41 --- socket.c 13 Apr 2008 02:25:52 -0000 1.40 +++ socket.c 13 Apr 2008 13:50:19 -0000 1.41 @@ -1921,11 +1921,18 @@ loginAccept = packet->accept; #ifdef PARADISE if ((packet->pad2 == 69) && (packet->pad3 == 42)) - paradise = 1; + { + paradise = 1; + // Now we have to resize certain windows that are set too small by default + // First resize planet window + W_DestroyWindow (planetw); + planetw = W_MakeTextWindow ("planet", TWINSIDE + 2 * THICKBORDER + 10, 10, 75, nplanets + 9, baseWin, 2); + W_SetWindowExposeHandler (planetw, planetlist); + } else { - /*nshiptypes = 8;*/ - /*nplayers=20;*/ - /*nplanets=40;*/ + /*nshiptypes = 8;*/ + /*nplayers=36;*/ + /*nplanets=40;*/ } #endif if (packet->accept) @@ -2836,7 +2843,7 @@ if (nplanets > 40) { W_DestroyWindow (planetw); - planetw = W_MakeTextWindow ("planet", TWINSIDE + 2 * THICKBORDER + 10, 10, 75, nplanets + 8, baseWin, 2); + planetw = W_MakeTextWindow ("planet", TWINSIDE + 2 * THICKBORDER + 10, 10, 75, nplanets + 9, baseWin, 2); W_SetWindowExposeHandler (planetw, planetlist); } } @@ -2849,7 +2856,7 @@ if (nplanets > 40) { W_DestroyWindow (planetw); - planetw = W_MakeTextWindow ("planet", TWINSIDE + 2 * THICKBORDER + 10, 10, 75, nplanets + 8, baseWin, 2); + planetw = W_MakeTextWindow ("planet", TWINSIDE + 2 * THICKBORDER + 10, 10, 75, nplanets + 9, baseWin, 2); W_SetWindowExposeHandler (planetw, planetlist); } } Index: planetlist.c =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/src/planetlist.c,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- planetlist.c 13 Apr 2008 02:25:51 -0000 1.11 +++ planetlist.c 13 Apr 2008 13:50:19 -0000 1.12 @@ -184,8 +184,7 @@ W_Color cur_color; cur_color = shipCol[i]; - //sprintf(buf, "%s: ", teaminfo[i-1].shortname); - sprintf(buf, "%s : ", teamname[i]); + sprintf(buf, "%s: ", teaminfo[i-1].shortname); W_WriteText(wind, i * 7 + 2, k, cur_color, buf, strlen(buf), W_RegularFont); sprintf(buf, " %-2d", team_pcount[i]); From modemhero at users.sourceforge.net Sun Apr 13 08:50:22 2008 From: modemhero at users.sourceforge.net (Bill Balcerski) Date: Sun, 13 Apr 2008 13:50:22 +0000 Subject: [netrek-cvs] client/netrekxp/include defs.h,1.30,1.31 Message-ID: <20080413135034.6D6E73B4080@smtpgrey-1.real-time.com> Update of /cvsroot/netrek/client/netrekxp/include In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv21807/include Modified Files: defs.h Log Message: MAXSECTORS to 20. No need to define this differently for paradise or bronco. Added in resizing planet window when paradise mode is received (need bigger window) and when planets above the assumed 40 are received (also need to make it bigger). Fixed bug in paradise planet list where wrong team name variable was being used. Index: defs.h =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/include/defs.h,v retrieving revision 1.30 retrieving revision 1.31 diff -u -d -r1.30 -r1.31 --- defs.h 13 Apr 2008 02:48:54 -0000 1.30 +++ defs.h 13 Apr 2008 13:50:19 -0000 1.31 @@ -98,11 +98,8 @@ /* At this range a player can be seen while visible (uncloaked) */ -#ifdef PARADISE -#define MAXSECTORS 20 -#else -#define MAXSECTORS 10 /* Max # of star sectors */ -#endif +#define MAXSECTORS 20 /* Max # of star sectors. Sector size + is always same size as tactical window */ #define MAXSTARS 100 /* Max # of stars in a sector */ /* 6 minutes is maximum for autoquit -- anything more causes problems in the From modemhero at users.sourceforge.net Sun Apr 13 08:50:22 2008 From: modemhero at users.sourceforge.net (Bill Balcerski) Date: Sun, 13 Apr 2008 13:50:22 +0000 Subject: [netrek-cvs] client/netrekxp clientr.suo,1.144,1.145 Message-ID: <20080413135034.73ECC3B4083@smtpgrey-1.real-time.com> Update of /cvsroot/netrek/client/netrekxp In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv21807 Modified Files: clientr.suo Log Message: MAXSECTORS to 20. No need to define this differently for paradise or bronco. Added in resizing planet window when paradise mode is received (need bigger window) and when planets above the assumed 40 are received (also need to make it bigger). Fixed bug in paradise planet list where wrong team name variable was being used. Index: clientr.suo =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/clientr.suo,v retrieving revision 1.144 retrieving revision 1.145 diff -u -d -r1.144 -r1.145 Binary files /tmp/cvsAJLeZj and /tmp/cvsivjfSo differ From modemhero at users.sourceforge.net Tue Apr 15 19:08:07 2008 From: modemhero at users.sourceforge.net (Bill Balcerski) Date: Wed, 16 Apr 2008 00:08:07 +0000 Subject: [netrek-cvs] client/netrekxp/include bitmaps.h, 1.24, 1.25 data.h, 1.96, 1.97 defs.h, 1.31, 1.32 packets.h, 1.11, 1.12 proto.h, 1.60, 1.61 struct.h, 1.24, 1.25 Message-ID: <20080416000857.7D4BD3B4093@smtpgrey-1.real-time.com> Update of /cvsroot/netrek/client/netrekxp/include In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv25812/include Modified Files: bitmaps.h data.h defs.h packets.h proto.h struct.h Log Message: This massive patch solves most of the issues that prevented the client from working on bronco and paradise servers simultaneously. The end goal is to remove all the #ifdef PARADISE defines and have a unified client. These patch notes will describe some of the obstacles, and what was done to work around them. Obstacles/Solutions: 1) One obstacle was the reliance on MAX* values in the client for things like MAXPLAYER, MAXTORP, and MAXPHASER. The solution was to copy the paradise client and define both a theoretical server maximum (i.e. MAXPLAYER) and then the actual value defined by the server (nplayers). Thus, many checks in the code were changed to use these new dynamic variables. MAXPLAYER is now 257 instead of 36. But the default value for nplayers is 36, and will only be changed if the client receives a paradise game parameters packet. So there is no impact on playing on bronco servers since the default value is always the same. Likewise, ntorps, nplasmas and nphasers are now dynamic, with the default values being the bronco defaults. 2) Another obstacle was conflicting defines for some server packets. Namely SP_GENERIC_32/SP_MOTD_PIC and SP_FLAGS_ALL/SP_STATS2. The solution was to treat these packets as having dynamic size, with the size being determined on whether the server is paradise or not. One complication was that a paradise server will send the client a SP_STATS2 packet before it even acknowledges the client is paradise comptable, thus corrupting the data stream! The solution is to treat all SP_FLAGS_ALL/SP_STATS2 packets as being SP_STATS2 if the login packet was not received yet (the login packet identifies whether the server is paradise or not). 3) Yet another obstacle was conflicting player flag states, namely PFOBSERV/PFWARP, and PFTWARP/PFSNAKE. The solution was to change all checks in the code involving observers and twarp and paradise warp to check if the server is paradise or not. 4) A minor obstacle was overlapping p_whydead states between bronco and paradise. Solved by a simple if (paradise) check. General Changes: 1) Most #ifdef PARADISE removed and replaced, where necessary, by if (paradise) checks. Some areas which required more work were the planet window, rank window, motd paging and layout, initializing and sorting the playerlist. 2) Load all paradise bitmaps upon startup. 3) Struct ship updated to include fields the server has been sending via ship cap packets but we have been ignoring. Will be necessary for future changes to how ship caps are handled. 4) Initialization of most data structs (players, torps, phasers, plasmas, teams) now moved into their own functions rather than all being done in openmem(). In paradise sometimes they need to be reinitialized, so this was necessary. 5) New funcion isMe() to check if a player X is me, or if I am an observer locked onto player X. 6) Metaserver now lists paradise servers. 7) Added afterburner/warpprep/impulse indicator to the plain text dashboard. 8) Added a bunch of safety checks for many of the packet types. 9) Added a bunch of the new packet types to the print_packet function. 10) Removed unused compute_extension1_size() 11) Added load_default_teams(). It sets up the classic bronco teams into a data structure called teaminfo. Index: bitmaps.h =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/include/bitmaps.h,v retrieving revision 1.24 retrieving revision 1.25 diff -u -d -r1.24 -r1.25 --- bitmaps.h 12 Apr 2008 23:28:29 -0000 1.24 +++ bitmaps.h 16 Apr 2008 00:08:00 -0000 1.25 @@ -26,9 +26,7 @@ #define BMP_KLI_SHIP 3 #define BMP_ROM_SHIP 5 #define BMP_IND_SHIP 2 -#ifdef PARADISE #define BMP_PSHIP 6 -#endif // Weapons // ------- @@ -150,10 +148,8 @@ #define BMP_MPLANET_WIDTH 16 #define BMP_MPLANET_HEIGHT 16 -#ifdef PARADISE #define PARADISE_PLANET_VIEWS 13 #define PARADISE_MPLANET_VIEWS 13 -#endif #define PLANET_VIEWS 9 #define MPLANET_VIEWS 9 @@ -195,7 +191,6 @@ #define CPLANET_VIEWS 16 -#ifdef PARADISE #define BMP_DRONE 9 #define BMP_DRONEC 10 #define BMP_DRONE_WIDTH 6 @@ -231,4 +226,3 @@ #define BMP_MWORMHOLE_WIDTH 16 #define BMP_MWORMHOLE_HEIGHT 16 #define WORMHOLE_VIEWS 8 -#endif Index: defs.h =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/include/defs.h,v retrieving revision 1.31 retrieving revision 1.32 diff -u -d -r1.31 -r1.32 --- defs.h 13 Apr 2008 13:50:19 -0000 1.31 +++ defs.h 16 Apr 2008 00:08:00 -0000 1.32 @@ -8,7 +8,7 @@ #include "copyright.h" -#ifdef PARADISE +/* Paradise stuff */ #define GRIDSIZE 33333 /* defs for updatePlayer [BDyess] */ @@ -25,7 +25,7 @@ #define GMAP_NEVER 0 #define GMAP_FREQUENT 1 #define GMAP_INFREQUENT 2 -#endif /* PARADISE */ +/* End paradise stuff */ /* Error handling */ #define RETURNBASE 10 @@ -37,11 +37,12 @@ #define MAX_MACRO 500 #endif -#ifdef PARADISE -#define MAXPLAYER 257 -#else -#define MAXPLAYER 36 -#endif +#define MAXPLAYER 257 /* Paradise can apparently go over 36 ... for + most purposes, the nplayers variable will be + used to track maximum players allowed by server. + This variable serves as a maximum possible value + for sizing arrays and structs. */ +//#define MAXPLAYER 36 #define TESTERS 4 /* Priveledged slots for * robots and game 'testers' */ @@ -49,6 +50,7 @@ #define MAXPLANETS 60 /* Maximum planets any server will send us. Bronco has 40, paradise can go up to 60 */ #define MAXTORP 8 +#define MAXPHASER 1 #define MAXPLASMA 1 #define PKEY 128 Index: packets.h =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/include/packets.h,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- packets.h 7 Jun 2007 04:43:37 -0000 1.11 +++ packets.h 16 Apr 2008 00:08:01 -0000 1.12 @@ -68,10 +68,8 @@ #define SP_RESERVED 25 /* for future use */ #define SP_PLANET_LOC 26 /* planet name, x, y */ -#ifdef PARADISE -#define SP_SCAN 27 /* ATM: results of player +#define SP_SCAN 27 /* paradise: results of player * scan */ -#endif #define SP_UDP_REPLY 28 /* notify client of UDP * status */ @@ -84,19 +82,16 @@ * verification */ #endif -#ifdef PARADISE -#define SP_MOTD_PIC 32 /* motd bitmap pictures */ -#define SP_STATS2 33 /* new stats packet */ -#define SP_STATUS2 34 /* new status packet */ -#define SP_PLANET2 35 /* new planet packet */ -#define SP_NEW_MOTD 36 /* New MOTD info notification uses */ -#define SP_THINGY 37 /* thingy location */ -#define SP_THINGY_INFO 38 /* thingy status */ -#else -#define SP_GENERIC_32 32 /* 32 byte generic, see struct */ -#define SP_FLAGS_ALL 33 /* abbreviated flags for all players */ -#endif - +// Note the conflicting defines for types 32 and 33 +#define SP_MOTD_PIC 32 /* paradise - motd bitmap pictures */ +#define SP_GENERIC_32 32 /* bronco - 32 byte generic, see struct */ +#define SP_STATS2 33 /* paradise - new stats packet */ +#define SP_FLAGS_ALL 33 /* bronco - abbreviated flags for all players */ +#define SP_STATUS2 34 /* paradise - new status packet */ +#define SP_PLANET2 35 /* paradise - new planet packet */ +#define SP_NEW_MOTD 36 /* paradise - New MOTD info notification uses */ +#define SP_THINGY 37 /* paradise - thingy location */ +#define SP_THINGY_INFO 38 /* paradise - thingy status */ #define SP_SHIP_CAP 39 /* Handles server ship mods */ #ifdef SHORT_PACKETS @@ -122,17 +117,15 @@ #define SP_S_8_TORP 49 /* optimized SP_S_TORP */ #define SP_S_PLANET 50 /* see SP_PLANET */ -#ifdef PARADISE -#define SP_GPARAM 51 /* game params packet */ +#define SP_GPARAM 51 /* paradise game params packet */ /* the following is a family of packets with the same type, but a discriminating subtype */ #define SP_PARADISE_EXT1 52 #define SP_PE1_MISSING_BITMAP 0 #define SP_PE1_NUM_MISSILES 1 /* end of packet 52 subtypes */ -#define SP_TERRAIN2 53 /* Terrain packets */ -#define SP_TERRAIN_INFO2 54 /* Terrain info */ -#endif +#define SP_TERRAIN2 53 /* paradise terrain packets */ +#define SP_TERRAIN_INFO2 54 /* paradise terrain info */ /* S_P2 */ #define SP_S_SEQUENCE 56 /* SP_SEQUENCE for @@ -199,11 +192,9 @@ * verification */ #endif -#ifdef PARADISE -/* the CP_ASK_MOTD packet is the same as temp_spacket */ -#define CP_ASK_MOTD 38 /* request MOTD */ -#endif -#define CP_PLANET 38 /* cross-check planet info */ +/* Note the conflicting defines for packet type 38*/ +#define CP_ASK_MOTD 38 /* paradise - request MOTD */ +#define CP_PLANET 38 /* bronco - cross-check planet info */ #define CP_PING_RESPONSE 42 /* client response */ @@ -905,7 +896,7 @@ unsigned short s_height; unsigned short s_maxarmies; char s_letter; - char pad2; + char s_armies; /* Paradise only */ char s_name[16]; char s_desig1; char s_desig2; @@ -1125,7 +1116,6 @@ #endif -#ifdef PARADISE /* Shapes of thingys. It would be best to add to the end of this list and try to coordinate your additions with other hackers. */ enum thingy_types { @@ -1447,4 +1437,4 @@ char galactic[32]; char galacticM[32]; }; -#endif + Index: struct.h =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/include/struct.h,v retrieving revision 1.24 retrieving revision 1.25 diff -u -d -r1.24 -r1.25 --- struct.h 24 Feb 2008 00:33:55 -0000 1.24 +++ struct.h 16 Apr 2008 00:08:04 -0000 1.25 @@ -44,7 +44,6 @@ unsigned LONG timeprod; }; -#ifdef PARADISE struct thingy { int t_no; int t_shape; /* State information */ @@ -115,7 +114,6 @@ int page; }; -#endif enum dist_type { @@ -205,20 +203,15 @@ #define PFPRESS 0x800000 /* pressor beam activated */ #define PFDOCKOK 0x1000000 /* docking permission */ #define PFSEEN 0x2000000 /* seen by enemy on galactic map? */ -#ifdef PARADISE /* Note overlap with PFWARP/PFOBSERV and PFSNAKE/PFTWARP */ -#define PFWARPPREP (1<<26) /* in warp prep [BDyess] */ -#define PFWARP (1<<27) /* ship warping */ -#define PFAFTER (1<<28) /* after burners on */ -#define PFWPSUSPENDED (1<<29) /* warp prep suspended [BDyess] */ -#define PFSNAKE (1<<30) /* it's a space snake */ -#define PFBIRD (1<<31) /* it's a space bird */ -#define PFOBSERV (1<<31) /* set to something unused */ -#define PFTWARP (1<<31) /* set to something unused */ -#else +#define PFWARPPREP 0x4000000 /* in warp prep [BDyess] */ +#define PFWARP 0x8000000 /* ship warping */ #define PFOBSERV 0x8000000 /* for observers */ -#define PFTWARP 0x40000000 /* transwarping to base */ -#endif +#define PFAFTER 0x10000000 /* after burners on */ +#define PFWPSUSPENDED 0x20000000 /* warp prep suspended [BDyess] */ +#define PFSNAKE 0x40000000 /* it's a space snake */ +#define PFTWARP 0x40000000 /* transwarping to base */ +#define PFBIRD 0x80000000 /* it's a space bird */ #define KLOGIN 0x00 /* initial state */ #define KQUIT 0x01 /* Player quit */ @@ -236,28 +229,29 @@ #define KOVER 0x0d /* game over */ #define TOURNSTART 0x0e /* tournament game starting */ #define KBADBIN 0x0f /* bad binary */ -#ifdef PARADISE -#define KMISSILE 0x10 /* missile, note the overlap with KTORP2! */ -#define KASTEROID 0x11 /* asteroid, note the overlap with KSHIP2! */ -#else -#define KTORP2 0x10 /* killed by detted torps */ -#define KSHIP2 0x11 /* chain-reaction explosions */ -#endif +#define KTORP2 0x10 /* killed by detted torps, overloaded to paradise KMISSILE */ +#define KSHIP2 0x11 /* chain-reaction explosions, overloaded to paradise KASTEROID */ #define KPLASMA2 0x12 /* killed by zapped plasma */ -#ifdef PARADISE -#define NUM_TYPES 15 #define NUM_PSHIP_TYPES 7 #define PARADISE_SHIP_OFFSET 7 /* To make jumpship first entry in the paradise ship bitmap array */ +#ifdef PARADISE +#define NUM_TYPES 15 +#define ATT 6 +#define JUMPSHIP 7 +#define SGALAXY 8 /* Not sure where to put this .. */ +#else +#define NUM_TYPES 8 +#define SGALAXY 6 +#define ATT 7 +#define JUMPSHIP 8 +#endif #define SCOUT 0 #define DESTROYER 1 #define CRUISER 2 #define BATTLESHIP 3 #define ASSAULT 4 #define STARBASE 5 -#define ATT 6 -#define JUMPSHIP 7 -#define SGALAXY 8 /* Not sure where to put this .. */ #define FLAGSHIP 8 #define WARBASE 9 #define LIGHTCRUISER 10 @@ -265,17 +259,6 @@ #define UTILITY 12 #define PATROL 13 #define PUCK 14 -#else -#define NUM_TYPES 8 -#define SCOUT 0 -#define DESTROYER 1 -#define CRUISER 2 -#define BATTLESHIP 3 -#define ASSAULT 4 -#define STARBASE 5 -#define SGALAXY 6 -#define ATT 7 -#endif struct ship { @@ -293,6 +276,11 @@ int s_torpspeed; int s_phaserfuse; int s_repair; + char s_letter; + char s_armies; /* paradise - gets army carrying cap. from server */ + /* char s_name[16]; */ + char s_desig[2]; + short s_bitmap; }; struct stats @@ -326,7 +314,6 @@ int st_rank; /* Ranking of the player */ }; -#ifdef PARADISE struct stats2 { /* paradise stats */ int st_genocides; /* number of genocides participated in */ float st_tmaxkills; /* max kills ever */ @@ -355,7 +342,6 @@ int st_rank; /* Ranking of the player */ int st_royal; /* royaly, specialty, rank */ }; -#endif #define ST_MAPMODE 1 #define ST_NAMEMODE 2 @@ -420,11 +406,10 @@ short p_whydead; /* Tells you why you died */ short p_whodead; /* Tells you who killed you */ struct stats p_stats; /* player statistics */ -#ifdef PARADISE short p_ndrone; /* Number of drones .. why was this missing? */ short p_totmissiles; /* number of total missiles [Bill Dyess] */ struct stats2 p_stats2; /* Paradise stats */ -#endif + short p_genoplanets; /* planets taken since last * genocide */ short p_genoarmsbomb; /* armies bombed since last @@ -531,7 +516,6 @@ * are in a 'known' order. Ten planets per team, the first being the home * planet. */ -#ifdef PARADISE /* pl_flags is an int of 32 bits: @@ -575,10 +559,12 @@ #define PLREDRAW (1<<7) /* Player close for redraw */ -#define PLHOME (1<< 8) /* These 4 flags no longer are */ -#define PLCOUP (1<< 9) /* used in the server */ -#define PLCHEAP (1<<10) -#define PLCORE (1<<11) +#define PLHOME (1<< 8) /* home planet for a given + * team */ +#define PLCOUP (1<< 9) /* Coup has occured */ +#define PLCHEAP (1<<10) /* Planet was taken from + * undefended team */ +#define PLCORE (1<<11) /* A core world planet */ /* cosmic object types, bits 16 and 23, and 24 */ #define PLPLANET 0 /* object is a planet */ @@ -618,20 +604,6 @@ #define PLPARADISE (1<<22) /* Paradise server flag set to 1 for P server */ -#else -/* the lower bits represent the original owning team */ -#define PLREPAIR 0x010 -#define PLFUEL 0x020 -#define PLAGRI 0x040 -#define PLREDRAW 0x080 /* Player close for redraw */ -#define PLHOME 0x100 /* home planet for a given - * team */ -#define PLCOUP 0x200 /* Coup has occured */ -#define PLCHEAP 0x400 /* Planet was taken from - * undefended team */ -#define PLCORE 0x800 /* A core world planet */ - -#endif /* PARADISE */ struct planet { @@ -649,9 +621,7 @@ * support life */ int pl_couptime; /* Time before coup may take * place */ -#ifdef PARADISE int pl_timestamp; /* time the info was taken */ -#endif }; #define MVALID 0x01 @@ -760,7 +730,6 @@ char *name, *cname; }; -#ifdef PARADISE /* ratings struct */ struct ratings { float r_offrat; /* offense rating */ @@ -804,7 +773,6 @@ struct royalty { /* Paradise royalty ranks */ char *name; /* name of rank */ }; -#endif struct plupdate { Index: proto.h =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/include/proto.h,v retrieving revision 1.60 retrieving revision 1.61 diff -u -d -r1.60 -r1.61 --- proto.h 6 Apr 2008 22:41:43 -0000 1.60 +++ proto.h 16 Apr 2008 00:08:02 -0000 1.61 @@ -433,6 +433,7 @@ /******************************************************************************/ /*** local.c /******************************************************************************/ +int isMe (struct player *j); void initStars (void); static inline W_Icon planetBitmapC(register struct planet * p); static inline void planetResourcesC (register struct planet *p, int destwidth, @@ -825,9 +826,7 @@ struct list; void showValues (struct list *data); void newMotdLine (char *line); -#ifdef PARADISE void newMotdPic (int x, int y, int width, int height, char *bits, int page); -#endif void getResources (char *prog); void redrawTeam (W_Window win, int teamNo, @@ -1155,8 +1154,16 @@ void handleFlagsAll (struct flags_all_spacket *packet); struct rsa_key_spacket; void handleRSAKey (struct rsa_key_spacket *packet); -#ifdef PARADISE +void initialize_players (void); +void initialize_plasmas (void); +void initialize_torps (void); +void initialize_phasers (void); +// Paradise handlers void build_default_configuration (void); +void load_default_teams (void); +void initialize_thingies(void); +void handlePacket32 (unsigned char *sbuf); +void handlePacket33 (unsigned char *sbuf); void handleScan (struct scan_spacket *packet); void handleMotdPic (struct motd_pic_spacket * packet); void handleStats2 (struct stats_spacket2 * packet); @@ -1169,7 +1176,7 @@ void handleThingyInfo (struct thingy_info_spacket * packet); void handleExtension1 (struct paradiseext1_spacket * packet); void handleGameparams (struct gameparam_spacket * packet); -#endif +// end paradise handlers void sendUdpReq (int req); struct udp_reply_spacket; void handleUdpReply (struct udp_reply_spacket *packet); Index: data.h =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/include/data.h,v retrieving revision 1.96 retrieving revision 1.97 diff -u -d -r1.96 -r1.97 --- data.h 13 Apr 2008 02:48:54 -0000 1.96 +++ data.h 16 Apr 2008 00:08:00 -0000 1.97 @@ -37,11 +37,9 @@ extern struct torp *torps; extern struct plasmatorp *plasmatorps; extern struct status *status; -#ifdef PARADISE extern struct status2 *status2; extern struct thingy *thingies; extern struct t_unit *terrainInfo; -#endif extern struct ship *myship; extern struct stats *mystats; extern struct planet *planets; @@ -58,6 +56,10 @@ extern int GWINSIDE; extern int nplanets; +extern int nplayers; +extern int ntorps; +extern int nplasmas; +extern int nphasers; extern int gwidth; extern unsigned int oldalert; extern unsigned char oldtourn; @@ -282,7 +284,6 @@ extern double Sin[], Cos[]; -#ifdef PARADISE extern int paradise; extern int received_terrain_info; extern int terrain_x; @@ -290,13 +291,9 @@ extern int gwidth_zoom; /* galaxy width, adjusted for zoom, unused */ extern int offsetx; extern int offsety; /* offsets when zooming [BDyess] */ -extern int nplayers; extern int nshiptypes; -extern int ntorps; extern int npthingies; extern int ngthingies; -extern int nplasmas; -extern int nphasers; extern struct teaminfo_s *teaminfo; extern int number_of_teams; /* MOTD data */ @@ -304,7 +301,6 @@ extern struct page *pmotddata; extern char blk_refitstring[80]; extern int blk_friendlycloak; -#endif extern W_Icon fedteam, romteam, kliteam, oriteam; extern W_Icon stipple, clockpic, clockhandpic, genopic, genopic2; @@ -351,7 +347,6 @@ extern W_Icon tractbits, pressbits; //Paradise bitmaps -#ifdef PARADISE extern W_Icon drone_bitmap; extern W_Icon base_dronec_bitmap; extern W_Icon dronec_bitmap[NUM_CTORP_TYPES]; @@ -379,7 +374,6 @@ extern W_Icon paradise_cships_self[NUM_PSHIP_TYPES][NUMTEAMS]; extern W_Icon paradise_cship_bitmaps; extern W_Icon paradise_cships[NUM_PSHIP_TYPES][NUMTEAMS]; -#endif //Ships extern W_Icon ship_bitmaps[5]; @@ -431,12 +425,10 @@ extern W_Icon base_mplanets; extern W_Icon bplanets[PLANET_VIEWS]; extern W_Icon bmplanets[MPLANET_VIEWS]; -#ifdef PARADISE extern W_Icon paradise_base_planets; extern W_Icon paradise_base_mplanets; extern W_Icon paradise_bplanets[PARADISE_PLANET_VIEWS]; extern W_Icon paradise_bmplanets[PARADISE_PLANET_VIEWS]; -#endif extern W_Color borderColor, backColor, textColor, myColor, warningColor, shipCol[5], rColor, yColor, gColor, unColor, foreColor; extern char *colornames[COLORS]; @@ -452,12 +444,10 @@ extern char login[PSEUDOSIZE]; extern struct rank ranks[NUMRANKS]; -#ifdef PARADISE extern struct rank2 *ranks2; extern struct royalty *royal; extern int nranks2; extern int nroyals; -#endif extern W_Window messagew, w, mapw, statwin, baseWin, infow, tstatw, war, warnw, helpWin, teamWin[4], qwin, messwa, messwt, messwi, From modemhero at users.sourceforge.net Tue Apr 15 19:08:26 2008 From: modemhero at users.sourceforge.net (Bill Balcerski) Date: Wed, 16 Apr 2008 00:08:26 +0000 Subject: [netrek-cvs] client/netrekxp/src beeplite.c, 1.16, 1.17 cowmain.c, 1.36, 1.37 dashboard.c, 1.25, 1.26 dashboard3.c, 1.11, 1.12 data.c, 1.105, 1.106 death.c, 1.21, 1.22 dmessage.c, 1.11, 1.12 enter.c, 1.15, 1.16 feature.c, 1.20, 1.21 findslot.c, 1.10, 1.11 getship.c, 1.5, 1.6 helpwin.c, 1.12, 1.13 inform.c, 1.7, 1.8 input.c, 1.43, 1.44 local.c, 1.110, 1.111 map.c, 1.63, 1.64 mswindow.c, 1.88, 1.89 newwin.c, 1.71, 1.72 option.c, 1.52, 1.53 parsemeta.c, 1.41, 1.42 planetlist.c, 1.12, 1.13 playback.c, 1.23, 1.24 playerlist.c, 1.15, 1.16 ranklist.c, 1.5, 1.6 redraw.c, 1.14, 1.15 rotate.c, 1.4, 1.5 short.c, 1.26, 1.27 smessage.c, 1.9, 1.10 socket.c, 1.41, 1.42 util.c, 1.7, 1.8 warning.c, 1.14, 1.15 Message-ID: <20080416000921.380F1B42B@smtpgrey-2.real-time.com> Update of /cvsroot/netrek/client/netrekxp/src In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv25812/src Modified Files: beeplite.c cowmain.c dashboard.c dashboard3.c data.c death.c dmessage.c enter.c feature.c findslot.c getship.c helpwin.c inform.c input.c local.c map.c mswindow.c newwin.c option.c parsemeta.c planetlist.c playback.c playerlist.c ranklist.c redraw.c rotate.c short.c smessage.c socket.c util.c warning.c Log Message: This massive patch solves most of the issues that prevented the client from working on bronco and paradise servers simultaneously. The end goal is to remove all the #ifdef PARADISE defines and have a unified client. These patch notes will describe some of the obstacles, and what was done to work around them. Obstacles/Solutions: 1) One obstacle was the reliance on MAX* values in the client for things like MAXPLAYER, MAXTORP, and MAXPHASER. The solution was to copy the paradise client and define both a theoretical server maximum (i.e. MAXPLAYER) and then the actual value defined by the server (nplayers). Thus, many checks in the code were changed to use these new dynamic variables. MAXPLAYER is now 257 instead of 36. But the default value for nplayers is 36, and will only be changed if the client receives a paradise game parameters packet. So there is no impact on playing on bronco servers since the default value is always the same. Likewise, ntorps, nplasmas and nphasers are now dynamic, with the default values being the bronco defaults. 2) Another obstacle was conflicting defines for some server packets. Namely SP_GENERIC_32/SP_MOTD_PIC and SP_FLAGS_ALL/SP_STATS2. The solution was to treat these packets as having dynamic size, with the size being determined on whether the server is paradise or not. One complication was that a paradise server will send the client a SP_STATS2 packet before it even acknowledges the client is paradise comptable, thus corrupting the data stream! The solution is to treat all SP_FLAGS_ALL/SP_STATS2 packets as being SP_STATS2 if the login packet was not received yet (the login packet identifies whether the server is paradise or not). 3) Yet another obstacle was conflicting player flag states, namely PFOBSERV/PFWARP, and PFTWARP/PFSNAKE. The solution was to change all checks in the code involving observers and twarp and paradise warp to check if the server is paradise or not. 4) A minor obstacle was overlapping p_whydead states between bronco and paradise. Solved by a simple if (paradise) check. General Changes: 1) Most #ifdef PARADISE removed and replaced, where necessary, by if (paradise) checks. Some areas which required more work were the planet window, rank window, motd paging and layout, initializing and sorting the playerlist. 2) Load all paradise bitmaps upon startup. 3) Struct ship updated to include fields the server has been sending via ship cap packets but we have been ignoring. Will be necessary for future changes to how ship caps are handled. 4) Initialization of most data structs (players, torps, phasers, plasmas, teams) now moved into their own functions rather than all being done in openmem(). In paradise sometimes they need to be reinitialized, so this was necessary. 5) New funcion isMe() to check if a player X is me, or if I am an observer locked onto player X. 6) Metaserver now lists paradise servers. 7) Added afterburner/warpprep/impulse indicator to the plain text dashboard. 8) Added a bunch of safety checks for many of the packet types. 9) Added a bunch of the new packet types to the print_packet function. 10) Removed unused compute_extension1_size() 11) Added load_default_teams(). It sets up the classic bronco teams into a data structure called teaminfo. Index: findslot.c =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/src/findslot.c,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- findslot.c 17 May 2007 08:49:48 -0000 1.10 +++ findslot.c 16 Apr 2008 00:08:11 -0000 1.11 @@ -33,9 +33,7 @@ #define WAITTITLE 15 /* height of title for wait * window */ -#ifdef PARADISE extern int newMotdStuff; /* from newwin.c */ -#endif /******************************************************************************/ /*** mapWaitWin() ***/ @@ -161,10 +159,8 @@ LineToConsole ("Damn, We've been ghostbusted!\n"); terminate (0); } -#ifdef PARADISE - if (newMotdStuff) + if (paradise && newMotdStuff) showMotdWin(motdWin, WaitMotdLine); -#endif while (W_EventsPending ()) { W_NextEvent (&event); Index: smessage.c =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/src/smessage.c,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- smessage.c 13 Apr 2007 07:52:42 -0000 1.9 +++ smessage.c 16 Apr 2008 00:08:22 -0000 1.10 @@ -550,7 +550,7 @@ case 'x': case 'y': case 'z': - if (who - 'a' + 10 > MAXPLAYER) + if (who - 'a' + 10 > nplayers) { warning ("Player is not in game"); return (0); Index: inform.c =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/src/inform.c,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- inform.c 24 Feb 2008 00:33:56 -0000 1.7 +++ inform.c 16 Apr 2008 00:08:16 -0000 1.8 @@ -42,9 +42,7 @@ }; #endif -#ifdef PARADISE static void Info_list_paradise (struct player * j); -#endif /******************************************************************************/ /*** inform() ***/ @@ -96,7 +94,8 @@ { if (key == 'i') { -#ifdef PARADISE + if (paradise) + { double dist; /* Too close to the edge? */ if (mx + 23 * W_Textwidth + 2 > windowWidth) @@ -142,7 +141,9 @@ (void) sprintf (buf, "%s@%s", j->p_login, j->p_monitor); W_WriteText (infow, W_Textwidth, W_Textheight * line++, playerColor (j), buf, strlen (buf), W_RegularFont); -#else + } + else + { /* Too close to the edge? */ if (mx + 23 * W_Textwidth + 2 > windowWidth) mx = windowWidth - 23 * W_Textwidth - 2; @@ -182,11 +183,12 @@ (void) sprintf (buf, "%s@%s", j->p_login, j->p_monitor); W_WriteText (infow, W_Textwidth, W_Textheight * line++, playerColor (j), buf, strlen (buf), W_RegularFont); -#endif + } } else { /* New information window! */ -#ifdef PARADISE + if (paradise) + { if (mx + 50 * W_Textwidth + 2 > windowWidth) mx = windowWidth - 50 * W_Textwidth - 2; if (my + 25 * W_Textheight + 2 > windowHeight) @@ -202,7 +204,9 @@ W_WriteText (infow, W_Textwidth, W_Textheight * line++, playerColor (j), buf, strlen (buf), shipFont (j)); Info_list_paradise(j); -#else + } + else + { float KillsPerHour, LossesPerHour; /* SB info window changed to * use these instead of * Offense and Defense. */ @@ -293,12 +297,13 @@ } W_WriteText (infow, W_Textwidth, W_Textheight * line++, playerColor (j), buf, strlen (buf), W_RegularFont); -#endif + } } } else { /* Planet */ -#ifdef PARADISE + if (paradise) + { /* Too close to the edge? */ if (mx + 23 * W_Textwidth + 2 > windowWidth) mx = windowWidth - 28 * W_Textwidth - 2; @@ -391,7 +396,9 @@ W_WriteText (infow, W_Textwidth, W_Textheight * line++, planetColor (k), buf, strlen (buf), W_RegularFont); } -#else + } + else + { /* Too close to the edge? */ if (mx + 23 * W_Textwidth + 2 > windowWidth) mx = windowWidth - 28 * W_Textwidth - 2; @@ -436,11 +443,10 @@ W_WriteText (infow, W_Textwidth, W_Textheight * line++, planetColor (k), buf, strlen (buf), W_RegularFont); } -#endif + } } } -#ifdef PARADISE /* fills the ratings struct pointed to by r with the stats for the player pointed to by j [BDyess] @@ -686,7 +692,6 @@ W_WriteText(infow, W_Textwidth * 28, W_Textheight * line++, playerColor(j), buf, strlen(buf), W_RegularFont); } -#endif /******************************************************************************/ /*** destroyInfo() ***/ Index: enter.c =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/src/enter.c,v retrieving revision 1.15 retrieving revision 1.16 diff -u -d -r1.15 -r1.16 --- enter.c 6 Apr 2008 22:41:44 -0000 1.15 +++ enter.c 16 Apr 2008 00:08:11 -0000 1.16 @@ -46,38 +46,20 @@ void openmem (void) { - int i; - /* Used to be struct memory universe, but leaving room for flexible struct sizes is better, and necessary for paradise - BB */ - players = (struct player *) malloc(sizeof(*players) * MAXPLAYER); - torps = (struct torp *) malloc(sizeof(*torps) * MAXPLAYER * MAXTORP); - plasmatorps = (struct plasmatorp *) malloc(sizeof(*plasmatorps) * MAXPLAYER * MAXPLASMA); -#ifdef PARADISE - thingies = (struct thingy *) malloc(sizeof(*thingies) * (MAXPLAYER * npthingies + ngthingies)); - /* independent is teaminfo[-1] */ - teaminfo = 1 + (struct teaminfo_s *) malloc(sizeof(*teaminfo) * (number_of_teams + 2)); + initialize_players(); + initialize_torps(); + initialize_plasmas(); + initialize_phasers(); + load_default_teams(); + initialize_thingies(); status2 = (struct status2 *) malloc(sizeof(*status2)); -#endif status = (struct status *) malloc(sizeof(*status)); initialize_planets(); - phasers = (struct phaser *) malloc(sizeof(*phasers) * MAXPLAYER); mctl = (struct mctl *) malloc(sizeof(*mctl)); messages = (struct message *) malloc(sizeof(*messages) * MAXMESSAGE); - for (i = 0; i < MAXPLAYER; i++) - { - players[i].p_status = PFREE; - players[i].p_cloakphase = 0; - players[i].p_no = i; - players[i].p_ntorp = 0; -#ifdef PARADISE - players[i].p_stats2.st_rank = 0; - players[i].p_stats2.st_royal = 0; - players[i].p_ndrone = 0; -#endif - players[i].p_explode = 1; - players[i].p_stats.st_tticks = 1; - } + mctl->mc_current = 0; status->time = 1; status->timeprod = 1; @@ -86,24 +68,6 @@ status->time = 1; status->planets = 1; status->armsbomb = 1; - for (i = 0; i < MAXPLAYER * MAXTORP; i++) - { - torps[i].t_status = TFREE; - torps[i].t_owner = (short) (i / MAXTORP); - } - for (i = 0; i < MAXPLAYER; i++) - { - phasers[i].ph_status = PHFREE; -#ifdef SOUND - phasers[i].sound_phaser = 0; -#endif - } - - for (i = 0; i < MAXPLAYER * MAXPLASMA; i++) - { - plasmatorps[i].pt_status = PTFREE; - plasmatorps[i].pt_owner = (short) (i / MAXPLASMA); - } /* initialize pointers if ghost start */ if (ghoststart) @@ -283,7 +247,7 @@ { int i; - for (i = 0; i < MAXPLAYER; i++) + for (i = 0; i < nplayers; i++) { if (strcmp(players[i].p_name, "Puck") == 0 && strcmp(players[i].p_login, "Robot") == 0 && Index: util.c =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/src/util.c,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- util.c 13 Apr 2008 02:25:52 -0000 1.7 +++ util.c 16 Apr 2008 00:08:23 -0000 1.8 @@ -126,7 +126,7 @@ if (targtype & (TARG_PLAYER | TARG_FRIEND | TARG_ENEMY)) { - for (i = 0, j = &players[i]; i < MAXPLAYER; i++, j++) + for (i = 0, j = &players[i]; i < nplayers; i++, j++) { if (j->p_status != PALIVE) continue; Index: data.c =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/src/data.c,v retrieving revision 1.105 retrieving revision 1.106 diff -u -d -r1.105 -r1.106 --- data.c 13 Apr 2008 02:48:54 -0000 1.105 +++ data.c 16 Apr 2008 00:08:08 -0000 1.106 @@ -24,11 +24,9 @@ struct torp *torps; struct plasmatorp *plasmatorps; struct status *status; -#ifdef PARADISE struct status2 *status2; struct thingy *thingies; struct t_unit *terrainInfo; -#endif struct ship *myship; struct stats *mystats; struct planet *planets; @@ -42,6 +40,11 @@ int nplanets = 40; /* can be larger for paradise servers, dynamically sent via SP_PLANET2 */ +int nplayers = 36; /* can be larger for paradise servers, dynamically + sent via SP_GPARAM */ +int ntorps = 8; +int nplasmas = 1; +int nphasers = 1; int gwidth = 100000; /* can be changed by paradise server */ int globalerr = 0; /* For sending error # between threads */ int ingame = 0; /* If player is in game - to distinguish between whether @@ -280,7 +283,6 @@ extern double Sin[], Cos[]; -#ifdef PARADISE int paradise = 0; /* is the server a paradise server */ int received_terrain_info = 0; int terrain_x; @@ -288,13 +290,9 @@ int gwidth_zoom = 100000; /* galaxy width, adjusted for zoom, unused */ int offsetx = 0; int offsety = 0; /* offsets when zooming [BDyess] */ -int nplayers = 256; int nshiptypes = 15; -int ntorps = 8; int npthingies = 20; int ngthingies = 0; -int nplasmas = 1; -int nphasers = 1; struct teaminfo_s *teaminfo = NULL; int number_of_teams = 4; /* MOTD data */ @@ -302,7 +300,7 @@ struct page *pmotddata = NULL; char blk_refitstring[80] = "s=scout, d=destroyer, c=cruiser, b=battleship, a=assault, o=starbase"; int blk_friendlycloak = 0; /* Show color of cloakers who are friendly. */ -#endif + W_Icon fedteam, romteam, kliteam, oriteam; W_Icon stipple, clockpic, clockhandpic, genopic, genopic2, icon; @@ -349,7 +347,6 @@ int vary_hull = 0; // Paradise bitmaps -#ifdef PARADISE W_Icon drone_bitmap; W_Icon base_dronec_bitmap; W_Icon dronec_bitmap[NUM_CTORP_TYPES]; @@ -377,7 +374,7 @@ W_Icon paradise_cships_self[NUM_PSHIP_TYPES][NUMTEAMS]; W_Icon paradise_cship_bitmaps; W_Icon paradise_cships[NUM_PSHIP_TYPES][NUMTEAMS]; -#endif + // Ships W_Icon ship_bitmaps[5]; W_Icon fed_bitmaps[NUM_TYPES][SHIP_VIEWS], kli_bitmaps[NUM_TYPES][SHIP_VIEWS], @@ -428,12 +425,10 @@ W_Icon base_mplanets; W_Icon bplanets[PLANET_VIEWS]; W_Icon bmplanets[MPLANET_VIEWS]; -#ifdef PARADISE W_Icon paradise_base_planets; W_Icon paradise_base_mplanets; W_Icon paradise_bplanets[PARADISE_PLANET_VIEWS]; W_Icon paradise_bmplanets[PARADISE_PLANET_VIEWS]; -#endif /* jn - SMARTMACRO */ @@ -467,12 +462,10 @@ {30.0, 7.0, 0.0, "Rear Adm.", "RAdm"}, {40.0, 8.0, 0.0, "Admiral", "Admr"} }; -#ifdef PARADISE int nranks2 = 18; struct rank2 *ranks2; int nroyals = 5; struct royalty *royal = 0; -#endif W_Window messagew, w, mapw, statwin, baseWin = 0, infow, tstatw, war, warnw, helpWin, teamWin[4], qwin, messwa, messwt, messwi, messwk, Index: feature.c =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/src/feature.c,v retrieving revision 1.20 retrieving revision 1.21 diff -u -d -r1.20 -r1.21 --- feature.c 6 Apr 2008 22:41:44 -0000 1.20 +++ feature.c 16 Apr 2008 00:08:11 -0000 1.21 @@ -99,11 +99,7 @@ {"SHOW_CLOAKERS", &F_show_cloakers, 'S', 1, 0, 0}, {"TURN_KEYS", &F_turn_keys, 'S', 1, 0, 0}, {"SHOW_VISIBILITY_RANGE", &F_show_visibility_range, 'S', 1, 0, 0}, -#ifdef PARADISE - {"SP_FLAGS_ALL", &F_sp_flags_all, 'S', 0, 0, 0}, -#else {"SP_FLAGS_ALL", &F_sp_flags_all, 'S', 1, 0, 0}, -#endif {"WHY_DEAD_2", &F_why_dead_2, 'S', 1, 0, 0}, {0, 0, 0, 0, 0, 0} }; Index: parsemeta.c =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/src/parsemeta.c,v retrieving revision 1.41 retrieving revision 1.42 diff -u -d -r1.41 -r1.42 --- parsemeta.c 6 Apr 2008 23:29:56 -0000 1.41 +++ parsemeta.c 16 Apr 2008 00:08:18 -0000 1.42 @@ -565,13 +565,9 @@ if (tempstatus > statusLevel) throwaway++; -#ifdef PARADISE - /* only show paradise servers */ - if (type != 'P') throwaway++; -#else + /* ignore paradise servers */ - if (type == 'P') throwaway++; -#endif + // if (type == 'P') throwaway++; /* if it's to be thrown away, do not add this server, skip to next */ if (throwaway) continue; @@ -646,7 +642,7 @@ type = p[0]; /* ignore paradise servers */ - if (type == 'P') return; + // if (type == 'P') return; p = strtok(NULL,","); /* comment */ if (p == NULL) return; Index: helpwin.c =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/src/helpwin.c,v retrieving revision 1.12 retrieving revision 1.13 diff -u -d -r1.12 -r1.13 --- helpwin.c 18 May 2007 19:54:37 -0000 1.12 +++ helpwin.c 16 Apr 2008 00:08:16 -0000 1.13 @@ -79,11 +79,9 @@ "@ speed = 12", "% speed = maximum", "# speed = 1/2 maximum", -#ifdef PARADISE ". Afterburners", "J Engage Warp", "^j Toggle warp prep", -#endif "< slow speed 1", "> speed up 1", "k Set course", Index: dashboard3.c =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/src/dashboard3.c,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- dashboard3.c 18 May 2007 19:54:37 -0000 1.11 +++ dashboard3.c 16 Apr 2008 00:08:07 -0000 1.12 @@ -381,14 +381,12 @@ static int old_ful = -1; static float old_kills = -1; static int old_torp = -1; -#ifdef PARADISE char buf[16]; int i = 0; static int old_drone = -1; static int old_totmissiles = -1; int drone; int totmissiles; -#endif int cur_max, cur_arm, label_len; /* Was 75, too bad it wasn't defined as an even multiple of text width. */ register int BAR_LENGTH = W_Textwidth/2 + 12 * W_Textwidth; @@ -396,23 +394,19 @@ float kills; int torp; - if ((me->p_flags & (PFPLOCK | PFOBSERV)) == (PFPLOCK | PFOBSERV)) + if ((me->p_flags & PFPLOCK) && (!paradise && (me->p_flags & PFOBSERV))) { kills = players[me->p_playerl].p_kills; torp = players[me->p_playerl].p_ntorp; -#ifdef PARADISE drone = players[me->p_playerl].p_ndrone; totmissiles = players[me->p_playerl].p_totmissiles; -#endif } else { kills = me->p_kills; torp = me->p_ntorp; -#ifdef PARADISE drone = me->p_ndrone; totmissiles = me->p_totmissiles; -#endif } if (fr) @@ -649,30 +643,31 @@ old_torp = torp; } -#ifdef PARADISE - /* code to show the number of drones out */ - strcpy(buf, "M: "); - if (fr || totmissiles != old_totmissiles || drone != old_drone) + if (paradise) { - if (totmissiles > 0) - sprintf(buf + strlen(buf), "L%d ", totmissiles); - old_totmissiles = totmissiles; - if (drone > 0) - sprintf(buf + strlen(buf), "O%d", drone); - old_drone = drone; - if (!totmissiles && !drone) /* clear missile text */ - W_ClearArea(tstatw, 7 + BAR_LENGTH, 12 + 2 * W_Textheight, 10 * W_Textwidth, W_Textheight); - else - { - for (i = strlen(buf); i < 11; i++) - { - buf[i] = ' '; - buf[11] = 0; - } - W_WriteText(tstatw, 7 + BAR_LENGTH, 12 + 2 * W_Textheight, textColor, buf, 11, W_RegularFont); - } + /* code to show the number of drones out */ + strcpy(buf, "M: "); + if (fr || totmissiles != old_totmissiles || drone != old_drone) + { + if (totmissiles > 0) + sprintf(buf + strlen(buf), "L%d ", totmissiles); + old_totmissiles = totmissiles; + if (drone > 0) + sprintf(buf + strlen(buf), "O%d", drone); + old_drone = drone; + if (!totmissiles && !drone) /* clear missile text */ + W_ClearArea(tstatw, 7 + BAR_LENGTH, 12 + 2 * W_Textheight, 10 * W_Textwidth, W_Textheight); + else + { + for (i = strlen(buf); i < 11; i++) + { + buf[i] = ' '; + buf[11] = 0; + } + W_WriteText(tstatw, 7 + BAR_LENGTH, 12 + 2 * W_Textheight, textColor, buf, 11, W_RegularFont); + } + } } -#endif old_spd = me->p_speed; old_cur_max = cur_max; Index: dmessage.c =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/src/dmessage.c,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- dmessage.c 6 Apr 2008 22:41:43 -0000 1.11 +++ dmessage.c 16 Apr 2008 00:08:10 -0000 1.12 @@ -150,13 +150,10 @@ } /* aha! A new type distress/macro call came in. parse it appropriately */ - if ( -#ifdef PARADISE // Not quite sure why this check is here..but apparently it's needed. - // This check needs to be further investigated on the current paradise - // server code, for bombing messages and RCDs. BB 03/11/08 - gen_distress && -#endif - flags == (MTEAM | MDISTR | MVALID)) + // Not quite sure why this paradise check is here..but apparently it's needed. + // This check needs to be further investigated on the current paradise + // server code, for bombing messages and RCDs. BB 03/11/08 + if ((paradise ? gen_distress : 1) && flags == (MTEAM | MDISTR | MVALID)) { HandleGenDistr (message, from, to, &dist); len = makedistress (&dist, message, distmacro[dist.distype].macro); @@ -171,12 +168,7 @@ } - -#ifdef PARADISE - if (0) /* Paradise doesn't support the message flags */ -#else - if (niftyNewMessages) -#endif + if (!paradise && niftyNewMessages) { if (logging) { @@ -275,10 +267,8 @@ (instr (message, "was kill") || instr (message, "killed by")) || instr (message, "Credit for")) || -#ifdef PARADISE instr (message, "burned to a crisp by") || instr (message, "shot down by") || -#endif (*message != ' ' && instr (message, "We are being attacked"))) { if (!reportKills) Index: input.c =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/src/input.c,v retrieving revision 1.43 retrieving revision 1.44 diff -u -d -r1.43 -r1.44 --- input.c 13 Apr 2008 02:25:51 -0000 1.43 +++ input.c 16 Apr 2008 00:08:16 -0000 1.44 @@ -311,7 +311,7 @@ register struct player *j; register int targnum = -1; - for (i = 0, j = &players[i]; i < MAXPLAYER; i++, j++) + for (i = 0, j = &players[i]; i < nplayers; i++, j++) { if (j->p_status != PALIVE) continue; @@ -1292,43 +1292,48 @@ localflags &= ~(PFREFIT); return; break; -#ifdef PARADISE case 'j': - sendRefitReq (JUMPSHIP); + if (paradise) + sendRefitReq (JUMPSHIP); localflags &= ~(PFREFIT); return; break; case 'f': - sendRefitReq (FLAGSHIP); + if (paradise) + sendRefitReq (FLAGSHIP); localflags &= ~(PFREFIT); return; break; case 'w': - sendRefitReq (WARBASE); + if (paradise) + sendRefitReq (WARBASE); localflags &= ~(PFREFIT); return; break; case 'l': - sendRefitReq (LIGHTCRUISER); + if (paradise) + sendRefitReq (LIGHTCRUISER); localflags &= ~(PFREFIT); return; break; case 'v': - sendRefitReq (CARRIER); + if (paradise) + sendRefitReq (CARRIER); localflags &= ~(PFREFIT); return; break; case 'u': - sendRefitReq (UTILITY); + if (paradise) + sendRefitReq (UTILITY); localflags &= ~(PFREFIT); return; break; case 'p': - sendRefitReq (PATROL); + if (paradise) + sendRefitReq (PATROL); localflags &= ~(PFREFIT); return; break; -#endif default: localflags &= ~(PFREFIT); return; @@ -1948,15 +1953,16 @@ { register int i = 0; -#ifdef PARADISE - sendDetMineReq(-1); -#else - for (i = 0; i < MAXTORP; i++) + if (paradise) + sendDetMineReq(-1); + else { - if (torps[i + (me->p_no * MAXTORP)].t_status == TMOVE || - torps[i + (me->p_no * MAXTORP)].t_status == TSTRAIGHT) + for (i = 0; i < ntorps; i++) + { + if (torps[i + (me->p_no * ntorps)].t_status == TMOVE || + torps[i + (me->p_no * ntorps)].t_status == TSTRAIGHT) { - sendDetMineReq ((short) (i + (me->p_no * MAXTORP))); + sendDetMineReq ((short) (i + (me->p_no * ntorps))); #ifdef SHORT_PACKETS if (recv_short) @@ -1964,7 +1970,7 @@ #endif } } -#endif + } return (0); } @@ -2299,11 +2305,10 @@ void Key37 (void) { -#ifdef PARADISE - set_speed(me->p_ship.s_maxspeed); -#else - set_speed (99); /* Max speed... */ -#endif + if (paradise) + set_speed(me->p_ship.s_maxspeed); + else + set_speed (99); /* Max speed... */ } /******************************************************************************/ @@ -2412,11 +2417,10 @@ void Key46 (void) { -#ifdef PARADISE - set_speed(98); /* afterburners */ -#else - emptyKey(); -#endif + if (paradise) + set_speed(98); /* afterburners */ + else + emptyKey(); } /******************************************************************************/ @@ -2754,11 +2758,10 @@ void Key74 (W_Event * data) { -#ifdef PARADISE - set_speed(99); /* warp! */ -#else - emptyKey (); -#endif + if (paradise) + set_speed(99); /* warp! */ + else + emptyKey (); } /******************************************************************************/ @@ -3242,7 +3245,8 @@ /* Observers can't move. Also incorrectly removes the lock flag even though you are still locked */ - if (me->p_flags & PFOBSERV) return; + if (me->p_flags & PFOBSERV && !paradise) + return; course = (unsigned char) (getcourse (data->Window, data->x, data->y)); set_course (course); @@ -3619,7 +3623,8 @@ if (!F_turn_keys) return; /* Observers can't turn */ - if (me->p_flags & PFOBSERV) return; + if (me->p_flags & PFOBSERV && !paradise) + return; course = (unsigned char) (me->p_dir - 16); set_course (course); @@ -3638,7 +3643,8 @@ if (!F_turn_keys) return; /* Observers can't turn */ - if (me->p_flags & PFOBSERV) return; + if (me->p_flags & PFOBSERV && !paradise) + return; course = (unsigned char) (me->p_dir + 16); set_course (course); @@ -3905,13 +3911,14 @@ void Key202 (W_Event * data) { -#ifdef PARADISE - /* suspend warp toggle [BDyess] */ - if (me->p_flags & PFWPSUSPENDED) - set_speed(96); /* unsuspend */ + if (paradise) + { + /* suspend warp toggle [BDyess] */ + if (me->p_flags & PFWPSUSPENDED) + set_speed(96); /* unsuspend */ + else + set_speed(97); /* suspend */ + } else - set_speed(97); /* suspend */ -#else - emptyKey (); -#endif + emptyKey (); } \ No newline at end of file Index: short.c =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/src/short.c,v retrieving revision 1.26 retrieving revision 1.27 diff -u -d -r1.26 -r1.27 --- short.c 13 Apr 2008 02:48:54 -0000 1.26 +++ short.c 16 Apr 2008 00:08:21 -0000 1.27 @@ -465,7 +465,7 @@ for (i = 0; i < numofplayers; i++) { pl_no = ((unsigned char) *sbuf & 0x1f) + 32; - if (pl_no >= MAXPLAYER) + if (pl_no >= nplayers) continue; /* a little error check */ save = (unsigned char) *sbuf; sbuf++; @@ -589,7 +589,7 @@ for (i = 0; i < numofplayers; i++) { pl_no = ((unsigned char) *sbuf & 0x1f); - if (pl_no >= MAXPLAYER) + if (pl_no >= nplayers) continue; save = (unsigned char) *sbuf; sbuf++; @@ -757,7 +757,7 @@ for (i = 0; i < numofplayers; i++) { pl_no = ((unsigned char) *sbuf & 0x1f); - if (pl_no >= MAXPLAYER) + if (pl_no >= nplayers) continue; save = (unsigned char) *sbuf; sbuf++; @@ -866,7 +866,7 @@ LineToConsole ("Length of Message is: %d total Size %d \n", strlen (&packet->mesg), (int) packet->length); } - if (packet->m_from >= MAXPLAYER) + if (packet->m_from >= nplayers) packet->m_from = 255; if (packet->m_from == 255) @@ -1216,13 +1216,13 @@ { register int i; - for (i = 0; i < MAXPLAYER * MAXTORP; i++) + for (i = 0; i < nplayers * ntorps; i++) torps[i].t_status = TFREE; - for (i = 0; i < MAXPLAYER * MAXPLASMA; i++) + for (i = 0; i < nplayers * nplasmas; i++) plasmatorps[i].pt_status = PTFREE; - for (i = 0; i < MAXPLAYER; i++) + for (i = 0; i < nplayers; i++) { players[i].p_ntorp = 0; players[i].p_nplasmatorp = 0; @@ -1974,6 +1974,12 @@ LineToConsole ("handleKills: bad index %d\n", pnum); return; } + if (pnum < 0 || pnum >= nplayers) + // This shouldn't happen... + { + LineToConsole ("handleKills: received player num larger than nplayers\n"); + return; + } #endif if (players[pnum].p_kills != ((float) pkills / 100.0)) @@ -2069,6 +2075,12 @@ LineToConsole ("handleStats: bad index %d\n", packet->pnum); return; } + if (packet->pnum < 0 || packet->pnum >= nplayers) + // This shouldn't happen... + { + LineToConsole ("handleStats: received player num larger than nplayers\n"); + return; + } #endif pl = &players[packet->pnum]; @@ -2107,7 +2119,7 @@ struct player *j; tmp = data; - for (pnum = which * 16; pnum < (which + 1) * 16 && pnum < MAXPLAYER; + for (pnum = which * 16; pnum < (which + 1) * 16 && pnum < nplayers; pnum++) { new = tmp & 0x03; Index: playback.c =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/src/playback.c,v retrieving revision 1.23 retrieving revision 1.24 diff -u -d -r1.23 -r1.24 --- playback.c 24 Feb 2008 00:33:56 -0000 1.23 +++ playback.c 16 Apr 2008 00:08:20 -0000 1.24 @@ -199,9 +199,8 @@ resetdefaults (); -#ifdef PARADISE build_default_configuration(); -#endif + newwin (display_host, name); savebitmaps (); @@ -509,9 +508,7 @@ case SP_S_YOU_SS: case SP_S_PLAYER: case SP_SHIP_CAP: -#ifndef PARADISE case SP_GENERIC_32: -#endif case SP_S_TORP: case SP_S_TORP_INFO: case SP_S_8_TORP: @@ -521,7 +518,6 @@ case SP_S_KILLS: case SP_S_STATS: case SP_FEATURE: -#ifdef PARADISE case SP_SCAN: case SP_STATS2: case SP_STATUS2: @@ -532,8 +528,6 @@ case SP_PARADISE_EXT1: case SP_TERRAIN2: case SP_TERRAIN_INFO2: -#endif - return 1; } return 0; Index: option.c =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/src/option.c,v retrieving revision 1.52 retrieving revision 1.53 diff -u -d -r1.52 -r1.53 --- option.c 12 Apr 2008 23:28:30 -0000 1.52 +++ option.c 16 Apr 2008 00:08:18 -0000 1.53 @@ -776,11 +776,8 @@ RedrawPlayerList (); } /* Let's see if this is our option changed */ - else if (op->op_option == &planetBitmap -#ifdef PARADISE - && !paradise // Paradise bitmaps stay loaded at all times -#endif - ) + // Paradise bitmaps stay loaded at all times + else if (op->op_option == &planetBitmap && !paradise) { if (planetBitmap != 3) // Color planet bitmaps stay loaded at all times { @@ -814,11 +811,8 @@ redrawall = 1; } - else if (op->op_option == &planetBitmapGalaxy -#ifdef PARADISE - && !paradise // Paradise bitmaps stay loaded at all times -#endif - ) + // Paradise bitmaps stay loaded at all times + else if (op->op_option == &planetBitmapGalaxy && !paradise) { if (planetBitmapGalaxy != 3) // Color planet bitmaps stay loaded at all times { Index: beeplite.c =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/src/beeplite.c,v retrieving revision 1.16 retrieving revision 1.17 diff -u -d -r1.16 -r1.17 --- beeplite.c 17 May 2007 08:49:48 -0000 1.16 +++ beeplite.c 16 Apr 2008 00:08:05 -0000 1.17 @@ -66,7 +66,7 @@ void liteplayer(struct player *j) { - if (!j || (j->p_flags & PFCLOAK) || (j->p_flags & PFOBSERV)) + if (!j || (j->p_flags & PFCLOAK) || (!paradise && (j->p_flags & PFOBSERV))) return; redrawPlayer[j->p_no] = 1; Index: getship.c =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/src/getship.c,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- getship.c 17 May 2007 08:49:48 -0000 1.5 +++ getship.c 16 Apr 2008 00:08:13 -0000 1.6 @@ -40,6 +40,10 @@ shipvals[SCOUT].s_height = 20; /* scout: */ shipvals[SCOUT].s_phaserfuse = 10; /* scout: */ shipvals[SCOUT].s_repair = 80; /* scout: */ + shipvals[SCOUT].s_letter = 's'; + shipvals[SCOUT].s_desig[0] = 'S'; + shipvals[SCOUT].s_desig[1] = 'C'; + shipvals[SCOUT].s_bitmap = SCOUT; shipvals[DESTROYER].s_phaserdamage = 85; /* destroyer: */ shipvals[DESTROYER].s_torpspeed = 14; /* destroyer: */ @@ -55,6 +59,10 @@ shipvals[DESTROYER].s_type = DESTROYER; /* destroyer: */ shipvals[DESTROYER].s_phaserfuse = 10; /* destroyer: */ shipvals[DESTROYER].s_repair = 100; /* destroyer: */ + shipvals[DESTROYER].s_letter = 'd'; + shipvals[DESTROYER].s_desig[0] = 'D'; + shipvals[DESTROYER].s_desig[1] = 'D'; + shipvals[DESTROYER].s_bitmap = DESTROYER; shipvals[BATTLESHIP].s_phaserdamage = 105; /* battleship: */ shipvals[BATTLESHIP].s_torpspeed = 12; /* battleship: */ @@ -70,7 +78,11 @@ shipvals[BATTLESHIP].s_type = BATTLESHIP; /* battleship: */ shipvals[BATTLESHIP].s_phaserfuse = 10; /* battleship: */ shipvals[BATTLESHIP].s_repair = 125; /* battleship: */ - + shipvals[BATTLESHIP].s_letter = 'b'; + shipvals[BATTLESHIP].s_desig[0] = 'B'; + shipvals[BATTLESHIP].s_desig[1] = 'B'; + shipvals[BATTLESHIP].s_bitmap = BATTLESHIP; + shipvals[ASSAULT].s_phaserdamage = 80; /* assault */ shipvals[ASSAULT].s_torpspeed = 16; /* assault */ shipvals[ASSAULT].s_maxspeed = 8; /* assault */ @@ -85,6 +97,10 @@ shipvals[ASSAULT].s_type = ASSAULT; /* assault */ shipvals[ASSAULT].s_phaserfuse = 10; /* assault */ shipvals[ASSAULT].s_repair = 120; /* assault */ + shipvals[ASSAULT].s_letter = 'a'; + shipvals[ASSAULT].s_desig[0] = 'A'; + shipvals[ASSAULT].s_desig[1] = 'S'; + shipvals[ASSAULT].s_bitmap = ASSAULT; shipvals[STARBASE].s_phaserdamage = 120; /* starbase */ shipvals[STARBASE].s_torpspeed = 14; /* starbase */ @@ -100,6 +116,10 @@ shipvals[STARBASE].s_type = STARBASE; /* starbase */ shipvals[STARBASE].s_phaserfuse = 4; /* starbase */ shipvals[STARBASE].s_repair = 140; /* starbase */ + shipvals[STARBASE].s_letter = 'o'; + shipvals[STARBASE].s_desig[0] = 'S'; + shipvals[STARBASE].s_desig[1] = 'B'; + shipvals[STARBASE].s_bitmap = STARBASE; shipvals[ATT].s_phaserdamage = 10000; /* att: */ shipvals[ATT].s_torpspeed = 30; /* att: */ @@ -115,6 +135,10 @@ shipvals[ATT].s_type = ATT; /* att: */ shipvals[ATT].s_phaserfuse = 2; /* att: */ shipvals[ATT].s_repair = 30000; /* att: */ + shipvals[ATT].s_letter = 'X'; + shipvals[ATT].s_desig[0] = 'A'; + shipvals[ATT].s_desig[1] = 'T'; + shipvals[ATT].s_bitmap = ATT; shipvals[SGALAXY].s_phaserdamage = 100; /* galaxy: */ shipvals[SGALAXY].s_torpspeed = 13; /* galaxy: */ @@ -130,6 +154,10 @@ shipvals[SGALAXY].s_type = SGALAXY; /* galaxy: */ shipvals[SGALAXY].s_phaserfuse = 10; /* galaxy: */ shipvals[SGALAXY].s_repair = 112; /* galaxy: */ + shipvals[SGALAXY].s_letter = 'g'; + shipvals[SGALAXY].s_desig[0] = 'G'; + shipvals[SGALAXY].s_desig[1] = 'A'; + shipvals[SGALAXY].s_bitmap = SGALAXY; shipvals[CRUISER].s_phaserdamage = 100; /* cruiser: */ shipvals[CRUISER].s_torpspeed = 12; /* cruiser: */ @@ -145,6 +173,10 @@ shipvals[CRUISER].s_type = CRUISER; /* cruiser: */ shipvals[CRUISER].s_phaserfuse = 10; /* cruiser: */ shipvals[CRUISER].s_repair = 110; /* cruiser: */ + shipvals[CRUISER].s_letter = 'c'; + shipvals[CRUISER].s_desig[0] = 'C'; + shipvals[CRUISER].s_desig[1] = 'A'; + shipvals[CRUISER].s_bitmap = CRUISER; #ifdef PARADISE shipvals[JUMPSHIP].s_phaserdamage = 25; @@ -161,7 +193,11 @@ shipvals[JUMPSHIP].s_height = 20; shipvals[JUMPSHIP].s_phaserfuse = 4; shipvals[JUMPSHIP].s_repair = 200; - + shipvals[JUMPSHIP].s_letter = 'j'; + shipvals[JUMPSHIP].s_desig[0] = 'J'; + shipvals[JUMPSHIP].s_desig[1] = 'S'; + shipvals[JUMPSHIP].s_bitmap = JUMPSHIP; + shipvals[FLAGSHIP].s_phaserdamage = 102; shipvals[FLAGSHIP].s_torpspeed = 12; shipvals[FLAGSHIP].s_maxspeed = 9; @@ -176,6 +212,10 @@ shipvals[FLAGSHIP].s_height = 20; shipvals[FLAGSHIP].s_phaserfuse = 10; shipvals[FLAGSHIP].s_repair = 118; + shipvals[FLAGSHIP].s_letter = 'f'; + shipvals[FLAGSHIP].s_desig[0] = 'F'; + shipvals[FLAGSHIP].s_desig[1] = 'L'; + shipvals[FLAGSHIP].s_bitmap = FLAGSHIP; shipvals[WARBASE].s_phaserdamage = 125; shipvals[WARBASE].s_torpspeed = 15; @@ -191,6 +231,10 @@ shipvals[WARBASE].s_height = 20; shipvals[WARBASE].s_phaserfuse = 5; shipvals[WARBASE].s_repair = 170; + shipvals[WARBASE].s_letter = 'w'; + shipvals[WARBASE].s_desig[0] = 'W'; + shipvals[WARBASE].s_desig[1] = 'B'; + shipvals[WARBASE].s_bitmap = WARBASE; shipvals[LIGHTCRUISER].s_phaserdamage = 90; shipvals[LIGHTCRUISER].s_torpspeed = 13; @@ -206,7 +250,11 @@ shipvals[LIGHTCRUISER].s_height = 20; shipvals[LIGHTCRUISER].s_phaserfuse = 10; shipvals[LIGHTCRUISER].s_repair = 80; - + shipvals[LIGHTCRUISER].s_letter = 'l'; + shipvals[LIGHTCRUISER].s_desig[0] = 'C'; + shipvals[LIGHTCRUISER].s_desig[1] = 'L'; + shipvals[LIGHTCRUISER].s_bitmap = LIGHTCRUISER; + shipvals[CARRIER].s_phaserdamage = 95; shipvals[CARRIER].s_torpspeed = 13; shipvals[CARRIER].s_maxspeed = 9; @@ -221,7 +269,11 @@ shipvals[CARRIER].s_height = 20; shipvals[CARRIER].s_phaserfuse = 6; shipvals[CARRIER].s_repair = 105; - + shipvals[CARRIER].s_letter = 'v'; + shipvals[CARRIER].s_desig[0] = 'C'; + shipvals[CARRIER].s_desig[1] = 'V'; + shipvals[CARRIER].s_bitmap = CARRIER; + shipvals[UTILITY].s_phaserdamage = 80; shipvals[UTILITY].s_torpspeed = 15; shipvals[UTILITY].s_maxspeed = 7; @@ -236,6 +288,10 @@ shipvals[UTILITY].s_height = 20; shipvals[UTILITY].s_phaserfuse = 8; shipvals[UTILITY].s_repair = 120; + shipvals[UTILITY].s_letter = 'u'; + shipvals[UTILITY].s_desig[0] = 'U'; + shipvals[UTILITY].s_desig[1] = 'T'; + shipvals[UTILITY].s_bitmap = UTILITY; shipvals[PATROL].s_phaserdamage = 50; shipvals[PATROL].s_torpspeed = 15; @@ -251,6 +307,10 @@ shipvals[PATROL].s_height = 20; shipvals[PATROL].s_phaserfuse = 8; shipvals[PATROL].s_repair = 50; + shipvals[PATROL].s_letter = 'p'; + shipvals[PATROL].s_desig[0] = 'P'; + shipvals[PATROL].s_desig[1] = 'T'; + shipvals[PATROL].s_bitmap = PATROL; shipvals[PUCK].s_phaserdamage = 75; shipvals[PUCK].s_torpspeed = 16; @@ -266,6 +326,10 @@ shipvals[PUCK].s_height = 20; shipvals[PUCK].s_phaserfuse = 10; shipvals[PUCK].s_repair = 80; + shipvals[PUCK].s_letter = 'k'; + shipvals[PUCK].s_desig[0] = 'P'; + shipvals[PUCK].s_desig[1] = 'U'; + shipvals[PUCK].s_bitmap = PUCK; #endif } Index: mswindow.c =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/src/mswindow.c,v retrieving revision 1.88 retrieving revision 1.89 diff -u -d -r1.88 -r1.89 --- mswindow.c 12 Apr 2008 23:28:29 -0000 1.88 +++ mswindow.c 16 Apr 2008 00:08:17 -0000 1.89 @@ -557,12 +557,10 @@ free (bplanets[i]); for (i = 0; i < MPLANET_VIEWS; i++) free (bmplanets[i]); -#ifdef PARADISE for (i = 0; i < PARADISE_PLANET_VIEWS; i++) free (paradise_bplanets[i]); for (i = 0; i < PARADISE_MPLANET_VIEWS; i++) free (paradise_bmplanets[i]); -#endif for (i = 0; i < BMP_SHIPEXPL_FRAMES; i++) free (expview[i]); @@ -584,7 +582,6 @@ free (genopic); free (genopic2); -#ifdef PARADISE free (drone_bitmap); free (base_dronec_bitmap); for (i = 0; i < NUM_CTORP_TYPES; i++) @@ -627,7 +624,7 @@ free (paradise_cships[j][i]); } } -#endif + //Remove default objects while (defaults) { Index: newwin.c =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/src/newwin.c,v retrieving revision 1.71 retrieving revision 1.72 diff -u -d -r1.71 -r1.72 --- newwin.c 13 Apr 2008 02:25:51 -0000 1.71 +++ newwin.c 16 Apr 2008 00:08:18 -0000 1.72 @@ -36,13 +36,9 @@ static int line = 0; int MaxMotdLine = 0; -#ifdef PARADISE -#define LINESPERPAGE 38 -#else -#define LINESPERPAGE 28 -#endif +#define LINESPERPARADISEPAGE 38 +#define LINESPERPAGE 28 -#ifdef PARADISE #define S_MOTD 0 #define S_SYSDEF 1 #define S_CREDITS 2 @@ -51,7 +47,6 @@ int newMotdStuff = 0; /* set to 1 when new motd packets arrive */ static struct piclist *motdPics = NULL; static struct piclist **motd_buftail = &motdPics; -#endif /* if a motd line from the server is this, the client will junk all motd * * data it currently has. New data may be received */ @@ -71,10 +66,8 @@ void loadbitmapsM (void); void loadbitmapsG (void); void loadbitmapsHR (void); -#ifdef PARADISE void loadbitmapsparadise (void); void loadparadisethings (void); -#endif void loadweaponsC (void); void loadplanetsC (void); @@ -450,7 +443,6 @@ } } -#ifdef PARADISE /******************************************************************************/ /*** loadbitmapsParadise() /******************************************************************************/ @@ -569,7 +561,6 @@ fighterc_explosion_bitmap[i] = W_PointBitmap2 (base_fighterc_explosion_bitmap, 0, i, BMP_FIGHTERDET_WIDTH, BMP_FIGHTERDET_HEIGHT); } -#endif /******************************************************************************/ /*** loadbitmapsHR() - high quality ship bitmaps, 80x80 @@ -811,12 +802,10 @@ W_StoreBitmap3 ("bitmaps/planlibm/color/wrench.bmp", BMP_WRENCH_WIDTH, BMP_WRENCH_HEIGHT, BMP_WRENCHBMP, w, LR_DEFAULTCOLOR); -#ifdef PARADISE gear_bitmap = W_StoreBitmap3 ("bitmaps/paradise/gear.bmp", BMP_GEAR_WIDTH, BMP_GEAR_HEIGHT, BMP_GEARBMP, w, LR_DEFAULTCOLOR); -#endif fuel_bitmap = W_StoreBitmap3 ("bitmaps/planlibm/color/fuel.bmp", BMP_FUEL_WIDTH, BMP_FUEL_HEIGHT, BMP_FUELBMP, w, @@ -909,12 +898,10 @@ W_StoreBitmap3 ("bitmaps/planlibm/color/wrench.bmp", BMP_WRENCH_WIDTH, BMP_WRENCH_HEIGHT, BMP_WRENCHBMP, mapw, LR_DEFAULTCOLOR); -#ifdef PARADISE - mgear_bitmap = + mgear_bitmap = W_StoreBitmap3 ("bitmaps/paradise/gear.bmp", BMP_GEAR_WIDTH, BMP_GEAR_HEIGHT, BMP_GEARBMP, w, LR_DEFAULTCOLOR); -#endif mfuel_bitmap = W_StoreBitmap3 ("bitmaps/planlibm/color/fuel.bmp", BMP_FUEL_WIDTH, BMP_FUEL_HEIGHT, BMP_FUELBMP, mapw, @@ -1011,18 +998,16 @@ planetw = W_MakeTextWindow ("planet", TWINSIDE + 2 * THICKBORDER + 10, 10, 57, nplanets + 3, baseWin, 2); W_SetWindowExposeHandler (planetw, planetlist); -#ifdef PARADISE - rankw = W_MakeTextWindow ("rank", 10, 100, 80, nranks2 + 9, baseWin, 2); -#else + // Rank window sized assuming only 9 (NUMRANKS) ranks, resized in paradise, see ranklist.c rankw = W_MakeTextWindow ("rank", 10, 300, 80, NUMRANKS + 9, baseWin, 2); -#endif W_SetWindowExposeHandler (rankw, ranklist); + // Player list windows will be too small if players > 36, which is possible in paradise playerw = W_MakeTextWindow ("player", 0, TWINSIDE + 2 * THICKBORDER + STATSIZE + 2 * BORDER, - PlistMaxWidth (), MAXPLAYER + 3, baseWin, 2); + PlistMaxWidth (), nplayers + 3, baseWin, 2); W_SetWindowExposeHandler (playerw, RedrawPlayerList); - playerw2 = W_MakeTextWindow ("player2", 140, 100, PlistMaxWidth2 (), MAXPLAYER + 3, baseWin, 2); + playerw2 = W_MakeTextWindow ("player2", 140, 100, PlistMaxWidth2 (), nplayers + 3, baseWin, 2); W_SetWindowExposeHandler (playerw2, RedrawPlayerList); #ifdef RECORDGAME @@ -1033,12 +1018,8 @@ else #endif helpWin = W_MakeTextWindow ("help", 20, - TWINSIDE + 2 * THICKBORDER + STATSIZE + 2 * BORDER - 5, -#ifdef PARADISE + TWINSIDE + 2 * THICKBORDER + STATSIZE + 2 * BORDER - 25, 160, 23, NULL, BORDER); -#else - 160, 21, NULL, BORDER); -#endif #ifdef RECORDGAME if (playback) @@ -1307,23 +1288,17 @@ int i, k; char *Planlib; char *MPlanlib; -#ifdef PARADISE char *Paradise_Planlib; char *Paradise_MPlanlib; -#endif planetBitmap = intDefault ("planetBitmap", planetBitmap); planetBitmapGalaxy = intDefault ("planetBitmapGalaxy", planetBitmapGalaxy); rotatePlanets = booleanDefault ("rotatePlanets", rotatePlanets); loadplanetsC(); // Always load new color planet bitmaps..for now loadmplanetsC(); -#ifdef PARADISE loadparadisethings(); -#endif -#ifdef PARADISE Paradise_Planlib = "bitmaps/paradise/paradise_plan.bmp"; Paradise_MPlanlib = "bitmaps/paradise/paradise_mplan.bmp"; -#endif switch (planetBitmap) // Case 3 = new color, but we never use Planlib { case 1: @@ -1371,9 +1346,7 @@ loadbitmapsM(); break; } -#ifdef PARADISE loadbitmapsParadise(); -#endif } else /* Load all bitmaps */ { @@ -1383,9 +1356,7 @@ loadbitmapsT(); loadbitmapsM(); loadbitmapsHR(); -#ifdef PARADISE loadbitmapsParadise(); -#endif } #ifdef BEEPLITE @@ -1478,14 +1449,12 @@ base_mplanets = W_StoreBitmap3 (MPlanlib, BMP_MPLANET_WIDTH, BMP_MPLANET_HEIGHT * PLANET_VIEWS, BMP_MPLANET000, mapw, LR_MONOCHROME); -#ifdef PARADISE paradise_base_planets = W_StoreBitmap3 (Paradise_Planlib, BMP_PLANET_WIDTH, BMP_PLANET_HEIGHT * PARADISE_PLANET_VIEWS, BMP_PLANET000, w, LR_MONOCHROME); paradise_base_mplanets = W_StoreBitmap3 (Paradise_MPlanlib, BMP_MPLANET_WIDTH, BMP_MPLANET_HEIGHT * PARADISE_PLANET_VIEWS, BMP_MPLANET000, mapw, LR_MONOCHROME); -#endif for (k = 0; k < PLANET_VIEWS; k++) { @@ -1496,7 +1465,6 @@ W_PointBitmap2 (base_mplanets, 0, k, BMP_MPLANET_WIDTH, BMP_MPLANET_HEIGHT); } -#ifdef PARADISE for (k = 0; k < PARADISE_PLANET_VIEWS; k++) { paradise_bplanets[k] = @@ -1506,7 +1474,6 @@ W_PointBitmap2 (paradise_base_mplanets, 0, k, BMP_MPLANET_WIDTH, BMP_MPLANET_HEIGHT); } -#endif if (colorClient > 0) { @@ -1735,13 +1702,11 @@ updatedeath (); if (W_IsMapped (playerw)) UpdatePlayerList (); -#ifdef PARADISE - if (newMotdStuff) + if (paradise && newMotdStuff) { showMotdWin (w, line); //showValues(mapw); } -#endif showTimeLeft (elapsed, autoQuit); lasttime = time (0); } @@ -1812,29 +1777,48 @@ case 'o': *s_type = STARBASE; break; -#ifdef PARADISE case 'j': - *s_type = JUMPSHIP; + if (paradise) + *s_type = JUMPSHIP; + else + typeok = 0; break; case 'f': - *s_type = FLAGSHIP; + if (paradise) + *s_type = FLAGSHIP; + else + typeok = 0; break; case 'w': - *s_type = WARBASE; + if (paradise) + *s_type = WARBASE; + else + typeok = 0; break; case 'l': - *s_type = LIGHTCRUISER; + if (paradise) + *s_type = LIGHTCRUISER; + else + typeok = 0; break; case 'v': - *s_type = CARRIER; + if (paradise) + *s_type = CARRIER; + else + typeok = 0; break; case 'u': - *s_type = UTILITY; + if (paradise) + *s_type = UTILITY; + else + typeok = 0; break; case 'p': - *s_type = PATROL; + if (paradise) + *s_type = PATROL; + else + typeok = 0; break; -#endif case ' ': switch (me->p_team) { @@ -1883,10 +1867,10 @@ resetting = 1; break; case 'f': /* Scroll motd forward */ - line = line + LINESPERPAGE; + line = line + (paradise ? LINESPERPARADISEPAGE : LINESPERPAGE); if (line > MaxMotdLine) { - line = line - LINESPERPAGE; + line = line - (paradise ? LINESPERPARADISEPAGE : LINESPERPAGE); break; } W_ClearWindow (w); @@ -1895,14 +1879,16 @@ case 'b': /* Scroll motd backward */ if (line == 0) break; - line = line - LINESPERPAGE; + line = line - (paradise ? LINESPERPARADISEPAGE : LINESPERPAGE); if (line < 0) line = 0; W_ClearWindow (w); showMotdWin (w, line); break; -#ifndef PARADISE /* Paradise MOTD requires paging */ + /* Paradise MOTD requires paging */ case 'F': /* Scroll motd a bit forwards */ + if (paradise) + break; line = line + 4; if (line > MaxMotdLine) { @@ -1913,6 +1899,8 @@ showMotdWin (w, line); break; case 'B': /* Scroll motd a bit backwards */ + if (paradise) + break; if (line == 0) break; line = line - 4; @@ -1921,7 +1909,6 @@ W_ClearWindow (w); showMotdWin (w, line); break; -#endif } } /* No break, we just fall through */ @@ -1993,12 +1980,11 @@ { char buf[80]; -#ifdef PARADISE - sprintf (buf, "Welcome aboard %s!", - (me->p_stats2.st_royal == 0 ? ranks2[me->p_stats2.st_rank].name : royal[me->p_stats2.st_royal].name)); -#else - sprintf (buf, "Welcome aboard %s!", ranks[me->p_stats.st_rank].name); -#endif + if (paradise) + sprintf (buf, "Welcome aboard %s!", + (me->p_stats2.st_royal == 0 ? ranks2[me->p_stats2.st_rank].name : royal[me->p_stats2.st_royal].name)); + else + sprintf (buf, "Welcome aboard %s!", ranks[me->p_stats.st_rank].name); warning (buf); } @@ -2069,7 +2055,7 @@ int i, num = 0; struct player *p; - for (i = 0, p = players; i < MAXPLAYER; i++, p++) + for (i = 0, p = players; i < nplayers; i++, p++) if (p->p_status == PALIVE && p->p_team == owner) num++; return (num); @@ -2085,7 +2071,7 @@ int i, num = 0; struct player *p; - for (i = 0, p = players; i < MAXPLAYER; i++, p++) + for (i = 0, p = players; i < nplayers; i++, p++) if (p->p_status != PFREE && p->p_team == owner) num++; return (num); @@ -2179,30 +2165,25 @@ int count; char buf[128]; -#ifdef PARADISE newMotdStuff = 0; /* clear the flag */ -#endif sprintf (buf, "--- %s ---", (char *) query_cowid ()); length = strlen (buf); center = TWINSIDE / 2 - (length * W_Textwidth) / 2; -#ifndef PARADISE /* no space for client header in paradise */ - W_WriteText (motdwin, center, W_Textheight, textColor, - buf, length, W_BoldFont); -#endif + /* no space for client header in paradise */ + if (!paradise) + W_WriteText (motdwin, center, W_Textheight, textColor, buf, length, W_BoldFont); sprintf (buf, CBUGS); length = strlen (buf); center = TWINSIDE / 2 - (length * W_Textwidth) / 2; -#ifndef PARADISE /* no space for client header in paradise */ - W_WriteText (motdwin, center, 3 * W_Textheight, textColor, - buf, length, W_RegularFont); -#endif + /* no space for client header in paradise */ + if (!paradise) + W_WriteText (motdwin, center, 3 * W_Textheight, textColor, buf, length, W_RegularFont); -#ifdef PARADISE - top = 0; -#else - top = 10; -#endif + if (paradise) + top = 0; + else + top = 10; if (first) { @@ -2227,7 +2208,8 @@ data = data->next; } - count = LINESPERPAGE; /* Magical # of lines to + count = (paradise ? LINESPERPARADISEPAGE : LINESPERPAGE); + /* Magical # of lines to * display */ for (i = top; i < 50; i++) { @@ -2250,20 +2232,20 @@ if (count <= 0) break; } -#ifdef PARADISE - if (motdwin == w) { - W_WriteText(mapw, GWINSIDE/2 - W_Textwidth * strlen(blk_refitstring) / 2, GWINSIDE - 20, textColor, blk_refitstring, - strlen(blk_refitstring), W_RegularFont); + if (paradise) + { + if (motdwin == w) { + W_WriteText(mapw, GWINSIDE/2 - W_Textwidth * strlen(blk_refitstring) / 2, GWINSIDE - 20, textColor, blk_refitstring, + strlen(blk_refitstring), W_RegularFont); + } + showPics(motdwin, atline); } - showPics(motdwin, atline); -#endif showValues (data); } /******************************************************************************/ /*** showPics() */ /******************************************************************************/ -#ifdef PARADISE static void showPics(W_Window win, int atline) { @@ -2272,7 +2254,7 @@ temp = motdPics; while (temp != NULL) { - if (atline/LINESPERPAGE == temp->page) { /* hack for paging not working */ + if (atline/(paradise ? LINESPERPARADISEPAGE : LINESPERPAGE) == temp->page) { /* hack for paging not working */ if (temp->thepic) W_WriteBitmap(temp->x, temp->y, temp->thepic, foreColor, win); else { @@ -2293,7 +2275,6 @@ temp = temp->next; } } -#endif /******************************************************************************/ /*** showValues() @@ -2318,11 +2299,8 @@ W_WriteText (mapw, 20, 14 * W_Textheight, textColor, msg, strlen (msg), W_RegularFont); -#ifdef PARADISE + for (i = 16; i < 50; i++) -#else - for (i = 16; i < 50; i += 2) -#endif { if (data == NULL) break; @@ -2333,6 +2311,8 @@ W_WriteText (mapw, 20, i * W_Textheight, textColor, data->data, strlen (data->data), W_RegularFont); data = data->next; + if (!paradise) // Extra line for non-paradise + i++; } } @@ -2352,9 +2332,7 @@ free (temp2->data); free (temp2); } -#ifdef PARADISE // Probably need some stuff here from erase_motd() -#endif first = 1; /* so that it'll check bold * next time around */ @@ -2369,7 +2347,8 @@ static struct list **temp = &motddata; static int statmode = 0; /* ATM */ -#ifdef PARADISE + if (paradise) + { /* Inlined blk_parsemotd() paradise client function */ if (strncmp("BLK: ", line, 5) == 0) { /* See if it's a refit string.*/ @@ -2391,7 +2370,8 @@ motdlinestate == IN_SYSDEF) */ newMotdStuff = 1; /* set flag for event loop */ first = 1; /* check for bold again */ -#endif + } + if (!statmode && !strcmp (line, STATUS_TOKEN)) statmode = 1; if (!statmode) @@ -2417,7 +2397,6 @@ temp = &((*temp)->next); } -#ifdef PARADISE /******************************************************************************/ /*** newMotdPic() /******************************************************************************/ @@ -2451,7 +2430,6 @@ tmp->page = page; motd_buftail = &(tmp->next); } -#endif /******************************************************************************/ /*** getResources() Index: planetlist.c =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/src/planetlist.c,v retrieving revision 1.12 retrieving revision 1.13 diff -u -d -r1.12 -r1.13 --- planetlist.c 13 Apr 2008 13:50:19 -0000 1.12 +++ planetlist.c 16 Apr 2008 00:08:19 -0000 1.13 @@ -19,10 +19,8 @@ #include "proto.h" /* Prototypes */ -#ifdef PARADISE static void planet_list_paradise (void); static void print_planet (W_Window wind, int line, struct planet * ); -#endif static char priorplanets[MAXPLANETS][BUFSIZ]; int planet_row[MAXPLANETS]; /* planets location in current plist */ @@ -56,9 +54,7 @@ curr->pl_info = 0; curr->pl_deadtime = 0; curr->pl_couptime = 0; -#ifdef PARADISE curr->pl_timestamp = 0; -#endif /* initialize planet redraw for moving planets */ pl_update[i].plu_update = -1; @@ -71,9 +67,10 @@ void planetlist (void) { -#ifdef PARADISE - planet_list_paradise(); -#else + if (paradise) + planet_list_paradise(); + else + { register int i; char buf[BUFSIZ]; @@ -86,10 +83,9 @@ for (i = 0; i < MAXPLANETS; i++) strcpy(priorplanets[i], ""); updatePlanetw (); -#endif + } } -#ifdef PARADISE int mask_to_idx(int m) { switch(m) { @@ -262,7 +258,6 @@ W_RegularFont); } } /* end of print_planet */ -#endif /* Update only lines that have changed */ void Index: warning.c =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/src/warning.c,v retrieving revision 1.14 retrieving revision 1.15 diff -u -d -r1.14 -r1.15 --- warning.c 18 May 2007 19:54:39 -0000 1.14 +++ warning.c 16 Apr 2008 00:08:23 -0000 1.15 @@ -145,15 +145,13 @@ if (doPhaser) W_MessageAllowedWindows (WAM_PHASER, 0, 0, textColor, newtext, warncount, 0); } -#ifdef PARADISE - if (strncmp(text, "Missile away", 12) == 0) { + if (paradise && strncmp(text, "Missile away", 12) == 0) { /* missile total kludge. No value until one is shot :( */ me->p_totmissiles = atoi(text + 13); - } else if (strcmp(text, "Prepping for warp jump") == 0) { + } else if (paradise && strcmp(text, "Prepping for warp jump") == 0) { /* keep track of when in warp prep */ me->p_flags |= PFWARPPREP; - } else if (strcmp(text, "Warp drive aborted") == 0) { + } else if (paradise && strcmp(text, "Warp drive aborted") == 0) { me->p_flags &= ~PFWARPPREP; } -#endif } Index: map.c =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/src/map.c,v retrieving revision 1.63 retrieving revision 1.64 diff -u -d -r1.63 -r1.64 --- map.c 13 Apr 2008 02:25:51 -0000 1.63 +++ map.c 16 Apr 2008 00:08:17 -0000 1.64 @@ -38,12 +38,10 @@ #define DETAIL 100 #define SIZE (GWIDTH/DETAIL) -#ifdef PARADISE int drawgrid = 1; /* goes to netrekrc eventually */ int blk_zoom = 0; /* goes to netrekrc eventually, doesn't work */ int sectorNums = 1; /* goes to netrekrc eventually */ #define DRAWGRID 4 -#endif /* @@ -289,10 +287,11 @@ if (i == -1) return; planets[i].pl_flags |= PLREDRAW; - for (i = 0, j = &players[i]; i < MAXPLAYER; i++, j++) + for (i = 0, j = &players[i]; i < nplayers; i++, j++) { if (j->p_status != PALIVE) continue; - if (j->p_flags & PFOBSERV) continue; + if (j->p_flags & PFOBSERV && !paradise) + continue; if (roughMap[j->p_x / SIZE][j->p_y / SIZE] != -1) redrawPlayer[i] = 1; } @@ -308,10 +307,11 @@ if (i == -1) return; planets[i].pl_flags |= PLREDRAW; - for (i = 0, j = &players[i]; i < MAXPLAYER; i++, j++) + for (i = 0, j = &players[i]; i < nplayers; i++, j++) { if (j->p_status != PALIVE) continue; - if (j->p_flags & PFOBSERV) continue; + if (j->p_flags & PFOBSERV && !paradise) + continue; if (roughMap3[j->p_x / SIZE][j->p_y / SIZE] != -1) redrawPlayer[i] = 1; } @@ -346,7 +346,6 @@ i += 2; if (p->pl_flags & PLFUEL) i += 1; -#ifdef PARADISE if (paradise && (p->pl_flags & PLSHIPYARD)) { i = 9; /* Base for shipyards */ @@ -355,21 +354,16 @@ if (p->pl_armies > 4) i += 2; } -#endif -#ifdef PARADISE if (paradise) return (paradise_bmplanets[i]); else -#endif return bmplanets[i]; } else { -#ifdef PARADISE if (paradise) return (paradise_bmplanets[8]); else -#endif return (bmplanets[8]); } } @@ -491,8 +485,7 @@ 0, mwrench_bitmap, planetColor(p), window); -#ifdef PARADISE - if (p->pl_flags & PLSHIPYARD) + if (paradise && p->pl_flags & PLSHIPYARD) W_WriteScaleBitmap(dx + destwidth, dy - destheight/3 - 1, destwidth/3 + 1, @@ -502,7 +495,6 @@ 0, mgear_bitmap, planetColor(p), window); -#endif if (p->pl_flags & PLFUEL) W_WriteScaleBitmap(dx + destwidth, dy, @@ -565,11 +557,9 @@ sendPlanetsPacket(l->pl_no); } -#ifdef PARADISE /* Stars need to be refreshed often... */ - if (PL_TYPE(*l) == PLSTAR) + if (paradise && PL_TYPE(*l) == PLSTAR) l->pl_flags |= PLREDRAW; -#endif if (!(l->pl_flags & PLREDRAW)) continue; @@ -589,20 +579,19 @@ odx = pl_update[l->pl_no].plu_x * GWINSIDE / GWIDTH; ody = pl_update[l->pl_no].plu_y * GWINSIDE / GWIDTH; -#ifdef PARADISE - if (PL_TYPE(*l) == PLSTAR) + + if (paradise && PL_TYPE(*l) == PLSTAR) W_ClearArea (mapw, dx - ( BMP_MSTAR_WIDTH / 2), dy - ( BMP_MSTAR_HEIGHT / 2), BMP_MSTAR_WIDTH, BMP_MSTAR_HEIGHT); - else if (PL_TYPE(*l) == PLWHOLE) + else if (paradise && PL_TYPE(*l) == PLWHOLE) W_ClearArea (mapw, dx - ( BMP_MWORMHOLE_WIDTH / 2), dy - ( BMP_MWORMHOLE_HEIGHT / 2), BMP_MWORMHOLE_WIDTH, BMP_MWORMHOLE_HEIGHT); else { -#endif /* XFIX */ if (planetBitmapGalaxy == 3) W_ClearArea (mapw, odx - (5 * BMP_MPLANET_WIDTH / 6) - 1, @@ -618,22 +607,18 @@ ody + (BMP_MPLANET_HEIGHT / 2), backColor, l->pl_name, 3, planetFont (l)); pl_update[l->pl_no].plu_update = 0; -#ifdef PARADISE } -#endif } else { /* Clear the planet normally */ -#ifdef PARADISE - if (PL_TYPE(*l) == PLSTAR) + if (paradise && PL_TYPE(*l) == PLSTAR) W_ClearArea (mapw, dx - ( BMP_MSTAR_WIDTH / 2), dy - ( BMP_MSTAR_HEIGHT / 2), BMP_MSTAR_WIDTH, BMP_MSTAR_HEIGHT); else { -#endif /* XFIX */ if (planetBitmapGalaxy == 3) W_ClearArea (mapw, dx - (5 * BMP_MPLANET_WIDTH / 6) - 1, @@ -647,15 +632,12 @@ dy - (BMP_MPLANET_HEIGHT / 2 + 4), BMP_MPLANET_WIDTH + 8, BMP_MPLANET_HEIGHT + 8); -#ifdef PARADISE } -#endif } /* Draw the new planet */ -#ifdef PARADISE - if (PL_TYPE(*l) == PLSTAR) + if (paradise && PL_TYPE(*l) == PLSTAR) W_OverlayScaleBitmap (dx - (BMP_MSTAR_WIDTH / 2), dy - (BMP_MSTAR_HEIGHT / 2), BMP_MSTAR_WIDTH, @@ -666,7 +648,7 @@ star_mbitmap, planetColor (l), mapw); - else if (PL_TYPE(*l) == PLWHOLE) + else if (paradise && PL_TYPE(*l) == PLWHOLE) W_OverlayScaleBitmap (dx - (BMP_MWORMHOLE_WIDTH / 2), dy - (BMP_MWORMHOLE_HEIGHT / 2), BMP_MWORMHOLE_WIDTH, @@ -678,7 +660,6 @@ planetColor (l), mapw); else -#endif #ifdef BEEPLITE if (useLite && emph_planet_seq_n[l->pl_no] > 0) { @@ -757,10 +738,9 @@ } #endif if (planetHighlighting && (l->pl_info & me->p_team) -#ifdef PARADISE - && PL_TYPE(*l) != PLSTAR && PL_TYPE(*l) != PLWHOLE -#endif - ) /* Draw halo */ + && (paradise ? PL_TYPE(*l) != PLSTAR : 1) + && (paradise? PL_TYPE(*l) != PLWHOLE : 1)) + /* Draw halo */ W_WriteCircle(mapw, dx, dy, BMP_MPLANET_WIDTH / 2, l->pl_armies > 4 ? 1 : 0, 0, planetColor(l)); @@ -792,11 +772,8 @@ if (F_show_army_count && (showArmy == 2 || showArmy == 3) && (l->pl_info & me->p_team) -#ifdef PARADISE - && (PL_TYPE(*l) != PLSTAR) - && (PL_TYPE(*l) != PLWHOLE) -#endif - ) + && (paradise ? PL_TYPE(*l) != PLSTAR : 1) + && (paradise ? PL_TYPE(*l) != PLWHOLE : 1)) { char armbuf[4]; int armbuflen; @@ -961,11 +938,9 @@ int view = TWINSIDE * mapscaleFactor / 2; /* view range for scaled galactic */ int viewboxview = (TWINSIDE * scaleFactor / 2); /* view range for view box */ int mvx, mvy; -#ifdef PARADISE static int osx = 0, osy = 0; /* old square */ static int scalex, scaley; static int grid_fuse; -#endif if (doubleBuffering) W_Win2Mem (mapSDB); @@ -979,9 +954,7 @@ dx = (me->p_x) / (GWIDTH / GWINSIDE); dy = (me->p_y) / (GWIDTH / GWINSIDE); -#ifdef PARADISE grid_fuse++; /* we only draw the grids every DRAWGRID interval */ -#endif if (redrawall) { @@ -1003,7 +976,7 @@ clearviewbox = 0; viewboxcleared = 1; - for (i = 0; i < MAXPLAYER; i++) + for (i = 0; i < nplayers; i++) { lastRedraw[i] = 0; mclearzone[2][i] = 0; @@ -1052,7 +1025,7 @@ } /* Erase the ships */ - for (i = 0; i < MAXPLAYER; i++) + for (i = 0; i < nplayers; i++) { /* Erase the player if redrawPlayer[i] is set and there is an active clearzone */ @@ -1084,7 +1057,8 @@ } } -#ifdef PARADISE + if (paradise) + { /* draw grid on galactic */ if ((redrawall || (grid_fuse % DRAWGRID) == 0) && (drawgrid)) { int x, y, width, h, grid; @@ -1186,7 +1160,7 @@ W_WriteRectangle (mapw, x + 2, y + 2, width - 4, h - 4, 1, yColor); } -#endif + } // end paradise grid /* Draw Planets */ @@ -1241,7 +1215,7 @@ /* Draw ships */ - for (i = 0, j = &players[i]; i < MAXPLAYER; i++, j++) + for (i = 0, j = &players[i]; i < nplayers; i++, j++) { /* redrawPlayer[i] has been set to 1 if redrawall or the ship has * been erased or a redraw has not taken place for a while. These @@ -1251,7 +1225,7 @@ continue; if (j->p_status != PALIVE) continue; - if (j->p_flags & PFOBSERV) + if (j->p_flags & PFOBSERV && !paradise) continue; /* jmn - observer support */ if (j->p_x < 0 || j->p_x >= GWIDTH || j->p_y < 0 || j->p_y >= GWIDTH) continue; @@ -1324,7 +1298,7 @@ /* Draw range circle */ if (viewRange && F_show_visibility_range - && (myPlayer(j) || isObsLockPlayer(j)) + && (isMe(j)) && j->p_ship.s_type != STARBASE) { /* Orbitting any non-owned planet gets you seen, @@ -1387,12 +1361,10 @@ register struct phaser *ph; register struct torp *k; register struct plasmatorp *pt; -#ifdef PARADISE register struct thingy *th; -#endif int tx, ty; - for (i = 0, j = &players[i]; i < MAXPLAYER; i++, j++) + for (i = 0, j = &players[i]; i < nplayers; i++, j++) { if (j->p_status == PFREE) continue; @@ -1423,26 +1395,29 @@ /* Here I will have to compute end coordinate */ /* Server will sometimes send us this information though, so check if we have it first */ - if (ph->ph_x > 0 && ph->ph_y > 0 && ph->ph_x < GWIDTH && ph->ph_y < GWIDTH) + if (!paradise && ph->ph_x > 0 && ph->ph_y > 0 && ph->ph_x < GWIDTH && ph->ph_y < GWIDTH) { tx = ph->ph_x * GWINSIDE / GWIDTH; ty = ph->ph_y * GWINSIDE / GWIDTH; } else { -#ifdef PARADISE + if (paradise) + { /* Paradise servers changed the ship cap protocol for phaser damage :( */ tx = (int) (j->p_x + j->p_ship.s_phaserdamage * Cos[ph->ph_dir]) * GWINSIDE / GWIDTH; ty = (int) (j->p_y + j->p_ship.s_phaserdamage * Sin[ph->ph_dir]) * GWINSIDE / GWIDTH; -#else + } + else + { tx = (int) (j->p_x + PHASEDIST * j->p_ship.s_phaserdamage / 100 * Cos[ph->ph_dir]) * GWINSIDE / GWIDTH; ty = (int) (j->p_y + PHASEDIST * j->p_ship.s_phaserdamage / 100 * Sin[ph->ph_dir]) * GWINSIDE / GWIDTH; -#endif + } } break; case PHHIT2: @@ -1474,15 +1449,11 @@ checkRedraw(tx * (GWIDTH / GWINSIDE), ty * (GWIDTH / GWINSIDE)); } - if (!j->p_ntorp && !j->p_nplasmatorp -#ifdef PARADISE - && !j->p_ndrone -#endif - ) + if (!j->p_ntorp && !j->p_nplasmatorp && (paradise ? !j->p_ndrone : 1)) continue; /* torps */ - for (h = 0, k = &torps[MAXTORP * i + h]; h < MAXTORP; h++, k++) + for (h = 0, k = &torps[ntorps * i + h]; h < ntorps; h++, k++) { if (!k->t_status) continue; @@ -1539,7 +1510,7 @@ } /* plasmas */ - for (h = 0, pt = &plasmatorps[MAXPLASMA * i + h]; h < MAXPLASMA; h++, pt++) + for (h = 0, pt = &plasmatorps[nplasmas * i + h]; h < nplasmas; h++, pt++) { if (!pt->pt_status) continue; @@ -1596,7 +1567,8 @@ /* Check for overwriting planets */ checkRedraw(pt->pt_x, pt->pt_y); } -#ifdef PARADISE + if (paradise) + { /* missiles/fighters */ for (h = i * npthingies, th = &thingies[i * npthingies]; h < npthingies * (i + 1); h++, th++) { @@ -1618,7 +1590,7 @@ /* Check for overwriting planets */ checkRedraw(th->t_x, th->t_y); } -#endif + } } } /* Reset weapon update marker */ Index: redraw.c =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/src/redraw.c,v retrieving revision 1.14 retrieving revision 1.15 diff -u -d -r1.14 -r1.15 --- redraw.c 19 Apr 2007 08:18:16 -0000 1.14 +++ redraw.c 16 Apr 2008 00:08:20 -0000 1.15 @@ -215,7 +215,10 @@ if (buf[14] == '0') buf[14] = ' '; buf[15] = (char) ('0' + (me->p_speed % 10)); /* speed */ - buf[16] = ' '; + if (paradise) + buf[16] = (me->p_flags & PFWARP ? 'w' : me->p_flags & PFAFTER ? 'a' : 'i'); + else + buf[16] = ' '; buf[17] = ' '; if (me->p_ship.s_type != ATT) { @@ -403,7 +406,7 @@ if (newDashboard) return; - if ((me->p_flags & (PFPLOCK | PFOBSERV)) == (PFPLOCK | PFOBSERV)) + if ((me->p_flags & PFPLOCK) && (!paradise && (me->p_flags & PFOBSERV))) kills = players[me->p_playerl].p_kills; else kills = me->p_kills; Index: dashboard.c =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/src/dashboard.c,v retrieving revision 1.25 retrieving revision 1.26 diff -u -d -r1.25 -r1.26 --- dashboard.c 13 Apr 2008 02:25:50 -0000 1.25 +++ dashboard.c 16 Apr 2008 00:08:07 -0000 1.26 @@ -395,7 +395,7 @@ W_Color color; int left, right, pos; - if ((me->p_flags & (PFPLOCK | PFOBSERV)) == (PFPLOCK | PFOBSERV)) + if ((me->p_flags & PFPLOCK) && (!paradise && (me->p_flags & PFOBSERV))) plr = players + me->p_playerl; else plr = me; @@ -454,29 +454,28 @@ color = W_Grey; } /* Transwarp text */ - else if (me->p_flags & PFTWARP) + else if (!paradise && me->p_flags & PFTWARP) { sprintf (buf, "Twarp"); msgtype = 4; color = W_White; } -#ifdef PARADISE /* Transwarp text */ - else if (me->p_flags & PFWARP) + else if (paradise && me->p_flags & PFWARP) { sprintf (buf, "Warp"); msgtype = 5; color = W_White; } /* Afterburners */ - else if (me->p_flags & PFAFTER) + else if (paradise && me->p_flags & PFAFTER) { sprintf (buf, "Aftrbrn"); msgtype = 6; color = W_Red; } /* Warp preparation */ - else if (me->p_flags & PFWARPPREP) + else if (paradise && me->p_flags & PFWARPPREP) { if (me->p_flags & PFWPSUSPENDED) { @@ -491,7 +490,6 @@ color = W_Cyan; } } -#endif /* Ship stopped */ else if (me->p_speed == 0) { @@ -556,18 +554,16 @@ { static float old_kills = -1.0; static int old_torp = -1; -#ifdef PARADISE int i = 0; static int old_drone = -1; static int old_totmissiles = -1; -#endif static unsigned int old_flags = (unsigned int) -1; static int old_tourn = 0; register int BAR_LENGTH = W_Textwidth/3 + 9 * W_Textwidth; char buf[16]; struct player *plr; - if ((me->p_flags & (PFPLOCK | PFOBSERV)) == (PFPLOCK | PFOBSERV)) + if ((me->p_flags & PFPLOCK) && (!paradise && (me->p_flags & PFOBSERV))) plr = players + me->p_playerl; else plr = me; @@ -674,30 +670,31 @@ } old_torp = plr->p_ntorp; } -#ifdef PARADISE /* code to show the number of drones out */ - strcpy(buf, "Miss: "); - if (fr || plr->p_totmissiles != old_totmissiles || plr->p_ndrone != old_drone) + if (paradise) { - if (plr->p_totmissiles > 0) - sprintf(buf + strlen(buf), "L%d ", plr->p_totmissiles); - old_totmissiles = me->p_totmissiles; - if (plr->p_ndrone > 0) - sprintf(buf + strlen(buf), "O%d", plr->p_ndrone); - old_drone = plr->p_ndrone; - if (!plr->p_totmissiles && !plr->p_ndrone) /* clear missile text */ - W_ClearArea(tstatw, 199 * W_Textwidth / 3, 3 + 2 * (W_Textheight + SPACING), 13 * W_Textwidth, W_Textheight); - else - { - for (i = strlen(buf); i < 14; i++) - { - buf[i] = ' '; - buf[14] = 0; - } - W_WriteText(tstatw, 199 * W_Textwidth / 3, 3 + 2 * (W_Textheight + SPACING), textColor, buf, 14, W_RegularFont); - } + strcpy(buf, "Miss: "); + if (fr || plr->p_totmissiles != old_totmissiles || plr->p_ndrone != old_drone) + { + if (plr->p_totmissiles > 0) + sprintf(buf + strlen(buf), "L%d ", plr->p_totmissiles); + old_totmissiles = me->p_totmissiles; + if (plr->p_ndrone > 0) + sprintf(buf + strlen(buf), "O%d", plr->p_ndrone); + old_drone = plr->p_ndrone; + if (!plr->p_totmissiles && !plr->p_ndrone) /* clear missile text */ + W_ClearArea(tstatw, 199 * W_Textwidth / 3, 3 + 2 * (W_Textheight + SPACING), 13 * W_Textwidth, W_Textheight); + else + { + for (i = strlen(buf); i < 14; i++) + { + buf[i] = ' '; + buf[14] = 0; + } + W_WriteText(tstatw, 199 * W_Textwidth / 3, 3 + 2 * (W_Textheight + SPACING), textColor, buf, 14, W_RegularFont); + } + } } -#endif } @@ -717,7 +714,7 @@ int color; float kills; - if ((me->p_flags & (PFPLOCK | PFOBSERV)) == (PFPLOCK | PFOBSERV)) + if ((me->p_flags & PFPLOCK) && (!paradise && (me->p_flags & PFOBSERV))) kills = players[me->p_playerl].p_kills; else kills = me->p_kills; @@ -891,7 +888,7 @@ int color; float kills; - if ((me->p_flags & (PFPLOCK | PFOBSERV)) == (PFPLOCK | PFOBSERV)) + if ((me->p_flags & PFPLOCK) && (!paradise && (me->p_flags & PFOBSERV))) kills = players[me->p_playerl].p_kills; else kills = me->p_kills; @@ -1085,7 +1082,7 @@ short planet; struct player *plr; - if ((me->p_flags & (PFPLOCK | PFOBSERV)) == (PFPLOCK | PFOBSERV)) + if ((me->p_flags & PFPLOCK) && (!paradise && (me->p_flags & PFOBSERV))) { plr = players + me->p_playerl; obs = 1; Index: rotate.c =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/src/rotate.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- rotate.c 13 Apr 2008 02:25:51 -0000 1.4 +++ rotate.c 16 Apr 2008 00:08:21 -0000 1.5 @@ -116,7 +116,7 @@ /* we could wait for the server to do this but looks better if we * do it now. */ - for (i = 0, j = players; i < MAXPLAYER; i++, j++) + for (i = 0, j = players; i < nplayers; i++, j++) { if (j->p_status != PALIVE) continue; Index: cowmain.c =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/src/cowmain.c,v retrieving revision 1.36 retrieving revision 1.37 diff -u -d -r1.36 -r1.37 --- cowmain.c 24 Feb 2008 00:33:55 -0000 1.36 +++ cowmain.c 16 Apr 2008 00:08:06 -0000 1.37 @@ -779,9 +779,7 @@ ind_ship_bmp_HR = stringDefault ("indshipHRbmpfile"); resetdefaults (); -#ifdef PARADISE - build_default_configuration(); -#endif + build_default_configuration(); // for paradise newwin (display_host, name); if (hideConsole) Index: local.c =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/src/local.c,v retrieving revision 1.110 retrieving revision 1.111 diff -u -d -r1.110 -r1.111 --- local.c 13 Apr 2008 02:25:51 -0000 1.110 +++ local.c 16 Apr 2008 00:08:17 -0000 1.111 @@ -39,10 +39,8 @@ static int clearline[4][MAXPLAYER + 2 * MAXPLAYER]; #endif static int planet_frame = 0; -#ifdef PARADISE static int star_frame = 0; static int wormhole_frame = 0; -#endif static int star_updates = 0; static int last_speed = 0; static int streaks_on = 0; @@ -55,13 +53,11 @@ static int sound_plasma = 0; static int sound_other_plasmas = 0; static int num_other_plasmas = 0; -#ifdef PARADISE static int sound_missiles = 0; static int sound_other_missiles = 0; static int num_other_missiles = 0; static int other_missile_dist = 0; static int other_missile_angle = 0; -#endif static unsigned int sound_flags = 0; static int other_torp_dist = 0; static int other_torp_angle = 0; @@ -132,6 +128,14 @@ } } +int isMe(struct player *j) +{ + if (myPlayer(j) || (!paradise && isObsLockPlayer(j))) + return 1; + else + return 0; +} + void initStars() { @@ -275,7 +279,12 @@ if (warpStreaks) { - if (warpflag != (me->p_flags & PFTWARP)) + if (paradise && warpflag != (me->p_flags & PFWARP)) + { + streaks_on = 1; + warpflag = (me->p_flags & PFWARP); + } + if (!paradise && warpflag != (me->p_flags & PFTWARP)) { /* change in warp state */ streaks_on = 1; warpflag = (me->p_flags & PFTWARP); @@ -390,7 +399,6 @@ i += 2; if (p->pl_flags & PLFUEL) i += 1; -#ifdef PARADISE if (paradise && (p->pl_flags & PLSHIPYARD)) { i = 9; /* Base for shipyards */ @@ -399,21 +407,16 @@ if (p->pl_armies > 4) i += 2; } -#endif -#ifdef PARADISE if (paradise) return (paradise_bplanets[i]); else -#endif return (bplanets[i]); } else { -#ifdef PARADISE if (paradise) return (paradise_bplanets[8]); else -#endif return (bplanets[8]); } } @@ -544,8 +547,7 @@ 0, wrench_bitmap, planetColor(p), window); -#ifdef PARADISE - if (p->pl_flags & PLSHIPYARD) + if (paradise && p->pl_flags & PLSHIPYARD) W_WriteScaleBitmap(dx + destwidth, dy - destheight/3 - 1, destwidth/3 + 1, @@ -555,7 +557,6 @@ 0, gear_bitmap, planetColor(p), window); -#endif if (p->pl_flags & PLFUEL) W_WriteScaleBitmap(dx + destwidth, dy, @@ -590,8 +591,7 @@ dx = dx / scaleFactor + TWINSIDE / 2; dy = dy / scaleFactor + TWINSIDE / 2; -#ifdef PARADISE - if (PL_TYPE(*l) == PLSTAR) + if (paradise && PL_TYPE(*l) == PLSTAR) { int j = star_frame * 10 / server_ups; if ((j >= STAR_VIEWS - 1) || (j < 0)) @@ -610,7 +610,7 @@ planetColor (l), w); } - else if (PL_TYPE(*l) == PLWHOLE) + else if (paradise && PL_TYPE(*l) == PLWHOLE) { int j = wormhole_frame * 10 / server_ups; if ((j >= WORMHOLE_VIEWS - 1) || (j < 0)) @@ -629,9 +629,7 @@ planetColor (l), w); } - else -#endif - if (planetBitmap == 3) + else if (planetBitmap == 3) { W_WriteScaleBitmap (dx - (BMP_PLANET_WIDTH / 2) * SCALE / scaleFactor, dy - (BMP_PLANET_HEIGHT / 2) * SCALE / scaleFactor, @@ -682,11 +680,7 @@ W_White); } - if (showPlanetNames -#ifdef PARADISE - && (PL_TYPE(*l) != PLWHOLE) -#endif - ) + if (showPlanetNames && (paradise ? (PL_TYPE(*l) != PLWHOLE) : 1)) { /* Center name */ W_MaskText (w, dx - (W_Textwidth * l->pl_namelen / 2), @@ -703,12 +697,10 @@ /* Allow army display if player/observer is orbitting a planet, or alternatively if observer is locked onto a planet, or is show_army_count feature packet is on */ if ((showArmy == 1 || showArmy == 3) && (l->pl_info & me->p_team) -#ifdef PARADISE - && (PL_TYPE(*l) == PLPLANET) -#endif + && (paradise ? (PL_TYPE(*l) == PLPLANET) : 1) && (F_show_army_count || ( (me->p_flags & PFORBIT) && (F_sp_generic_32 ? me->pl_orbit : get_closest_planet(me->p_x, me->p_y)) == l->pl_no) - || ((me->p_flags & PFPLLOCK) && (me->p_flags & PFOBSERV) && (me->p_planet == l->pl_no)) )) + || (!paradise && (me->p_flags & PFPLLOCK) && (me->p_flags & PFOBSERV) && (me->p_planet == l->pl_no)) )) { char armbuf[4]; int armbuflen; @@ -744,24 +736,21 @@ clearzone[3][clearcount] = W_Textheight; clearcount++; } -#ifdef PARADISE - if (PL_TYPE(*l) == PLSTAR) + if (paradise && PL_TYPE(*l) == PLSTAR) { clearzone[0][clearcount] = dx - (BMP_STAR_WIDTH / 2) * SCALE / scaleFactor; clearzone[1][clearcount] = dy - (BMP_STAR_HEIGHT / 2) * SCALE / scaleFactor; clearzone[2][clearcount] = BMP_STAR_WIDTH * SCALE / scaleFactor; clearzone[3][clearcount] = BMP_STAR_HEIGHT * SCALE / scaleFactor; } - else if (PL_TYPE(*l) == PLWHOLE) + else if (paradise && PL_TYPE(*l) == PLWHOLE) { clearzone[0][clearcount] = dx - (BMP_WORMHOLE_WIDTH / 2) * SCALE / scaleFactor; clearzone[1][clearcount] = dy - (BMP_WORMHOLE_HEIGHT / 2) * SCALE / scaleFactor; clearzone[2][clearcount] = BMP_WORMHOLE_WIDTH * SCALE / scaleFactor; clearzone[3][clearcount] = BMP_WORMHOLE_HEIGHT * SCALE / scaleFactor; } - else -#endif - if (planetBitmap == 3) + else if (planetBitmap == 3) { clearzone[0][clearcount] = dx - (5 * BMP_PLANET_WIDTH / 6 * SCALE / scaleFactor) - 1; clearzone[1][clearcount] = dy - (5 * BMP_PLANET_HEIGHT / 6 * SCALE / scaleFactor) - 1; @@ -778,10 +767,8 @@ clearcount++; } planet_frame++; -#ifdef PARADISE star_frame++; wormhole_frame++; -#endif } @@ -835,9 +822,7 @@ int type; W_Icon (*ship_bits)[SHIP_VIEWS]; -#ifdef PARADISE W_Icon (*ship_bits_paradise)[NUMTEAMS]; -#endif W_Icon (*ship_bitsHR); /* Kludge to try to fix missing ID chars on tactical (short range) @@ -846,42 +831,69 @@ idbuf[0] = '0'; idbuf[1] = '\0'; - for (j = players + MAXPLAYER - 1; j >= players; --j) + for (j = players + nplayers - 1; j >= players; --j) { if ((j->p_status != PALIVE) && (j->p_status != PEXPLODE)) continue; /* Twarp sounds put up here so observers can hear them */ #ifdef SOUND - /* Have to use me->p_flags because server doesn't send us twarp flag info - on other players. */ - if (twarpflag != (me->p_flags & PFTWARP)) + if (paradise && myPlayer(j)) { - /* change in warp state */ - warpchange = 1; - twarpflag = (me->p_flags & PFTWARP); - } - - if (myPlayer(j) || isObsLockPlayer(j)) + if (twarpflag != (me->p_flags & PFWARP)) + { + /* change in warp state */ + warpchange = 1; + twarpflag = (me->p_flags & PFWARP); + } + + if (warpchange && (j->p_flags & PFWARP)) + { + // Kill any channels with ENTER_WARP_WAV or EXIT_WARP_WAV (group 3) + Mix_HaltGroup(3); + Play_Sound(ENTER_WARP_WAV, SF_INFO); + warpchange = 0; + } + if (warpchange && !(j->p_flags & PFWARP)) + { + // Kill any channels with ENTER_WARP_WAV or EXIT_WARP_WAV (group 3) + Mix_HaltGroup(3); + Play_Sound(EXIT_WARP_WAV, SF_INFO); + warpchange = 0; + } + } + if (!paradise) { - if (warpchange && (j->p_flags & PFTWARP)) - { - // Kill any channels with ENTER_WARP_WAV or EXIT_WARP_WAV (group 3) - Mix_HaltGroup(3); - Play_Sound(ENTER_WARP_WAV, SF_INFO); - warpchange = 0; - } - if (warpchange && !(j->p_flags & PFTWARP)) - { - // Kill any channels with ENTER_WARP_WAV or EXIT_WARP_WAV (group 3) - Mix_HaltGroup(3); - Play_Sound(EXIT_WARP_WAV, SF_INFO); - warpchange = 0; - } + /* Have to use me->p_flags because server doesn't send us twarp flag info + on other players. */ + if (twarpflag != (me->p_flags & PFTWARP)) + { + /* change in warp state */ + warpchange = 1; + twarpflag = (me->p_flags & PFTWARP); + } + + if (isMe(j)) + { + if (warpchange && (j->p_flags & PFTWARP)) + { + // Kill any channels with ENTER_WARP_WAV or EXIT_WARP_WAV (group 3) + Mix_HaltGroup(3); + Play_Sound(ENTER_WARP_WAV, SF_INFO); + warpchange = 0; + } + if (warpchange && !(j->p_flags & PFTWARP)) + { + // Kill any channels with ENTER_WARP_WAV or EXIT_WARP_WAV (group 3) + Mix_HaltGroup(3); + Play_Sound(EXIT_WARP_WAV, SF_INFO); + warpchange = 0; + } + } } #endif - if (j->p_flags & PFOBSERV) + if (j->p_flags & PFOBSERV && !paradise) { /* observer and NOT locked onto a player (ie. locked onto planet or * vacuum) */ @@ -910,7 +922,7 @@ if (j->p_cloakphase == 0 && dx <= view && dx >= -view && dy <= view && dy >= -view) { // To avoid hearing twarp cloak sounds as the twarper/observer - if ( (myPlayer(j) || isObsLockPlayer(j)) ? ((me->p_flags & PFTWARP) ? 0 : 1) : 1 ) + if ( isMe(j) ? ((!paradise && (me->p_flags & PFTWARP)) ? 0 : 1) : 1 ) { SetDistAngle(dx / scaleFactor + TWINSIDE / 2, dy / scaleFactor + TWINSIDE / 2); // At short distances, don't use angular sound @@ -932,7 +944,7 @@ #ifdef SOUND // To avoid twarp cloak sounds as the twarper/observer - if ( (myPlayer(j) || isObsLockPlayer(j)) ? ((me->p_flags & PFTWARP) ? 0 : 1) : 1 ) + if ( isMe(j) ? ((!paradise && (me->p_flags & PFTWARP)) ? 0 : 1) : 1 ) { /* Only play sounds for ships on tactical */ if (j->p_cloakphase == (cloak_phases - 1) && dx <= view && dx >= -view && dy <= view && dy >= -view) @@ -963,7 +975,7 @@ the ship drawing code with the goto statement */ if (j->p_flags & PFCLOAK && (j->p_cloakphase == (cloak_phases - 1))) { - if (myPlayer (j) || (showCloakers && F_show_cloakers && !isObsLockPlayer(j)) + if (myPlayer (j) || (showCloakers && F_show_cloakers && (!paradise && !isObsLockPlayer(j))) #ifdef RECORDGAME || playback #endif @@ -1142,9 +1154,8 @@ } type = j->p_ship.s_type; -#ifdef PARADISE // If it's a paradise ship, use a paradise bitmap set. - if (type >= PARADISE_SHIP_OFFSET) + if (paradise && type >= PARADISE_SHIP_OFFSET) { int pos; @@ -1189,7 +1200,6 @@ } else { -#endif if (colorClient != 4) { W_WriteScaleBitmap (dx - (j->p_ship.s_width / 2) * SCALE / scaleFactor, @@ -1220,9 +1230,7 @@ playerColor (j), w); } -#ifdef PARADISE } -#endif /* If the ship is not yet fully cloaked, draw the cloak icon on top of the ship icon */ @@ -1235,7 +1243,7 @@ BMP_CLOAK_WIDTH, BMP_CLOAK_HEIGHT, 0, cloakicon, playerColor (j), w); - if (!myPlayer (j) && !isObsLockPlayer(j)) + if (!isMe(j)) /* If not my player, or not observing that player, we exit the draw function here */ continue; @@ -1261,7 +1269,7 @@ #endif #ifdef SOUND - if (myPlayer(j) || isObsLockPlayer(j)) + if (isMe(j)) { if ((sound_flags & PFSHIELD) && !(j->p_flags & PFSHIELD)) { @@ -1290,7 +1298,7 @@ #ifdef VSHIELD_BITMAPS int shieldnum; - if ((myPlayer(j) || isObsLockPlayer(j)) && varyShields) + if (isMe(j) && varyShields) { shieldnum = SHIELD_FRAMES * me->p_shield / me->p_ship.s_maxshield; @@ -1300,7 +1308,7 @@ else shieldnum = 2; - if ((myPlayer(j) || isObsLockPlayer(j)) && varyShieldsColor) + if (isMe(j) && varyShieldsColor) { int value; value = (100 * me->p_shield) / me->p_ship.s_maxshield; @@ -1315,7 +1323,7 @@ color = playerColor (j); #endif - if (warnShields && (myPlayer(j) || isObsLockPlayer(j))) + if (warnShields && isMe(j)) { switch (me->p_flags & (PFGREEN | PFYELLOW | PFRED)) { @@ -1352,7 +1360,7 @@ /* Warning hull */ if (vary_hull) { - if (myPlayer(j) || isObsLockPlayer(j)) + if (isMe(j)) { int hull_left = (100 * (me->p_ship.s_maxdamage - me->p_damage)) / me->p_ship.s_maxdamage; @@ -1429,7 +1437,7 @@ /* Self tic heading */ if (headingTic) { - if (myPlayer(j) || isObsLockPlayer(j)) + if (isMe(j)) { startx = dx + (int) (TIC_DIST/scaleFactor * Cos[j->p_dir]); starty = dy + (int) (TIC_DIST/scaleFactor * Sin[j->p_dir]); @@ -1477,7 +1485,7 @@ /* Puck circle */ if (puckCircle && playing_hockey) { - if (myPlayer(j) || isObsLockPlayer(j)) + if (isMe(j)) { W_WriteCircle(w, TWINSIDE/2, TWINSIDE/2, SHOTRANGE/scaleFactor, 0, 0, W_Grey); clearzone[0][clearcount] = TWINSIDE/2 - (SHOTRANGE/scaleFactor); @@ -1556,7 +1564,7 @@ buflen = 1; } - if (myPlayer(j) || isObsLockPlayer(j)) + if (isMe(j)) { switch (me->p_flags & (PFGREEN | PFYELLOW | PFRED)) { @@ -1619,7 +1627,7 @@ clearcount++; /* Tractor target ID */ - if (tractorID && (myPlayer(j) || isObsLockPlayer(j))) + if (tractorID && isMe(j)) { if (j->p_flags & (PFTRACT | PFPRESS)) { @@ -1648,7 +1656,7 @@ #ifdef SOUND if (j->p_explode == 1) { - if (myPlayer(j) || isObsLockPlayer(j)) + if (isMe(j)) { if (j->p_ship.s_type == STARBASE) Play_Sound(BASE_EXPLOSION_WAV, SF_EXPLOSIONS); @@ -1732,7 +1740,7 @@ #ifdef SOUND if (php->sound_phaser) { - if (myPlayer(j) || isObsLockPlayer(j)) + if (isMe(j)) Play_Sound(PHASER_WAV, SF_WEAPONS); else { @@ -1766,26 +1774,30 @@ /* Here I will have to compute end coordinate */ /* Server will sometimes send us this information though, so check if we have it first */ - if (php->ph_x > 0 && php->ph_y > 0 && php->ph_x < GWIDTH && php->ph_y < GWIDTH) + if (!paradise && php->ph_x > 0 && php->ph_y > 0 && php->ph_x < GWIDTH && php->ph_y < GWIDTH) { tx = (php->ph_x - me->p_x) / scaleFactor + TWINSIDE / 2; ty = (php->ph_y - me->p_y) / scaleFactor + TWINSIDE / 2; } else { -#ifdef PARADISE /* Paradise servers changed the ship cap protocol for phaser damage :( */ - tx = (int) (j->p_ship.s_phaserdamage * Cos[php->ph_dir]); + if (paradise) + { + tx = (int) (j->p_ship.s_phaserdamage * Cos[php->ph_dir]); - ty = (int) (j->p_ship.s_phaserdamage * Sin[php->ph_dir]); -#else - tx = (int) (PHASEDIST * j->p_ship.s_phaserdamage / 100 * - Cos[php->ph_dir]); + ty = (int) (j->p_ship.s_phaserdamage * Sin[php->ph_dir]); + } + else + { + tx = (int) (PHASEDIST * j->p_ship.s_phaserdamage / 100 * + Cos[php->ph_dir]); + + ty = (int) (PHASEDIST * j->p_ship.s_phaserdamage / 100 * + Sin[php->ph_dir]); + } - ty = (int) (PHASEDIST * j->p_ship.s_phaserdamage / 100 * - Sin[php->ph_dir]); -#endif tx = (j->p_x + tx - me->p_x) / scaleFactor + TWINSIDE / 2; ty = (j->p_y + ty - me->p_y) / scaleFactor + TWINSIDE / 2; } @@ -1828,7 +1840,7 @@ if (shrinkPhaserOnMiss || php->ph_status != PHMISS) { - if (myPlayer(j) || isObsLockPlayer(j)) + if (isMe(j)) { if (phaserShrinkStyle == 1) { @@ -1884,7 +1896,7 @@ if (friendlyPlayer (j)) { #ifdef JUBILEE_PHASERS - if ((myPlayer(j) || isObsLockPlayer(j)) && php->ph_status == PHHIT && colorfulPhasers) + if (isMe(j) && php->ph_status == PHHIT && colorfulPhasers) { int col; @@ -2023,7 +2035,7 @@ struct player *tractee; - if (j->p_tractor < 0 || j->p_tractor >= MAXPLAYER) + if (j->p_tractor < 0 || j->p_tractor >= nplayers) continue; tractee = &players[j->p_tractor]; @@ -2106,7 +2118,7 @@ } } } - else if ((myPlayer(j) || isObsLockPlayer(j))&& !(j->p_flags & PFPRESS || j->p_flags & PFTRACT)) + else if (isMe(j) && !(j->p_flags & PFPRESS || j->p_flags & PFTRACT)) tcounter = 2; } } @@ -2124,7 +2136,7 @@ int frame; int view = scaleFactor * TWINSIDE / 2; - for (t = torps, j = players; j != players + MAXPLAYER; t += MAXTORP, ++j) + for (t = torps, j = players; j != players + nplayers; t += ntorps, ++j) { #ifdef SOUND if (j != me) @@ -2364,9 +2376,9 @@ int ptorpTeam; int frame; - /* MAXPLASMA is small so work through all the plasmas rather than + /* nplasmas is small so work through all the plasmas rather than look at the number of outstanding plasma torps for each player. */ - for (pt = plasmatorps + (MAXPLASMA * MAXPLAYER) - 1; pt >= plasmatorps; + for (pt = plasmatorps + (nplasmas * nplayers) - 1; pt >= plasmatorps; --pt) { if (!pt->pt_status) @@ -2578,7 +2590,6 @@ } } -#ifdef PARADISE void draw_one_thingy(struct thingy *k) { @@ -2850,7 +2861,7 @@ int count; struct player *j; - for (j = players; j != players + MAXPLAYER; ++j) + for (j = players; j != players + nplayers; ++j) { i = j->p_no; @@ -2866,7 +2877,6 @@ j->p_ndrone = count; } } -#endif static void DrawMisc (void) @@ -3234,26 +3244,25 @@ else Play_Sound_Loc(FIRE_PLASMA_OTHER_WAV, SF_OTHER|SF_WEAPONS, other_plasma_angle, other_plasma_dist); } -#ifdef PARADISE - if (sound_missiles < me->p_ndrone ) - Play_Sound(FIRE_PLASMA_WAV, SF_WEAPONS); - if (sound_other_missiles < num_other_missiles) + if (paradise) { - if (!soundAngles || other_missile_dist < SCALE/2) - Play_Sound_Loc(FIRE_TORP_OTHER_WAV, SF_OTHER|SF_WEAPONS, -1, other_missile_dist); - else - Play_Sound_Loc(FIRE_TORP_OTHER_WAV, SF_OTHER|SF_WEAPONS, other_missile_angle, other_missile_dist); + if (sound_missiles < me->p_ndrone ) + Play_Sound(FIRE_PLASMA_WAV, SF_WEAPONS); + if (sound_other_missiles < num_other_missiles) + { + if (!soundAngles || other_missile_dist < SCALE/2) + Play_Sound_Loc(FIRE_TORP_OTHER_WAV, SF_OTHER|SF_WEAPONS, -1, other_missile_dist); + else + Play_Sound_Loc(FIRE_TORP_OTHER_WAV, SF_OTHER|SF_WEAPONS, other_missile_angle, other_missile_dist); + } } -#endif // Reset locations and fuses of other's closest torps and plasmas other_torp_dist = SOUND_MAXRANGE; other_torp_angle = 0; other_plasma_dist = SOUND_MAXRANGE; other_plasma_angle = 0; -#ifdef PARADISE other_missile_dist = SOUND_MAXRANGE; other_missile_angle = 0; -#endif sound_flags = me->p_flags; sound_torps = me->p_ntorp; @@ -3262,12 +3271,10 @@ sound_plasma = me->p_nplasmatorp; sound_other_plasmas = num_other_plasmas; num_other_plasmas = 0; -#ifdef PARADISE sound_missiles = me->p_ndrone; sound_other_missiles = num_other_missiles; num_other_missiles = 0; #endif -#endif /* show 'lock' icon on local map (Actually an EM hack ) */ if (showLock & 2) @@ -3348,7 +3355,8 @@ /* Keep redrawing for double buffered observers who get set out of normal gameplay bounds, whether due to locking onto an ineligible planet, or observing a player who dies - - otherwise screen doesn't refresh */ + otherwise screen doesn't refresh. In paradise this check will also trigger for people + in PFWARP but I don't think it matters. */ if ((me->p_x < 0 || me->p_x >= GWIDTH) && !(doubleBuffering && (me->p_flags & PFOBSERV))) { /* If alive but out of bounds, we probably missed a packet giving our location, @@ -3369,9 +3377,8 @@ DrawTorps (); DrawPlasmaTorps (); -#ifdef PARADISE - DrawThingies (); -#endif + if (paradise) + DrawThingies (); if (!weaponsOnMap) weaponUpdate = 0; Index: death.c =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/src/death.c,v retrieving revision 1.21 retrieving revision 1.22 diff -u -d -r1.21 -r1.22 --- death.c 25 May 2007 03:36:46 -0000 1.21 +++ death.c 16 Apr 2008 00:08:09 -0000 1.22 @@ -90,11 +90,7 @@ if (promoted) { sprintf (rankmessage, "Congratulations, You have scummed up to %s", -#ifdef PARADISE - ranks2[mystats->st_rank].name); -#else - ranks[mystats->st_rank].name); -#endif + paradise ? ranks2[mystats->st_rank].name : ranks[mystats->st_rank].name); W_WriteText (w, 50, 80, W_Yellow, rankmessage, strlen (rankmessage), W_BoldFont); } @@ -126,18 +122,16 @@ shipnos[me->p_whodead]); break; case KPLANET: -#ifdef PARADISE /* different message if killed by a star [BDyess] */ - if(planets[me->p_whodead].pl_flags && PLSTAR) + if(paradise && planets[me->p_whodead].pl_flags && PLSTAR) sprintf (deathmessage, "You were burned to a crisp by %s [star]", planets[me->p_whodead].pl_name); else -#endif - sprintf (deathmessage, - "You were killed by planetary fire from %s (%c).", - planets[me->p_whodead].pl_name, - teamlet[planets[me->p_whodead].pl_owner]); + sprintf (deathmessage, + "You were killed by planetary fire from %s (%c).", + planets[me->p_whodead].pl_name, + teamlet[planets[me->p_whodead].pl_owner]); break; case KSHIP: sprintf (deathmessage, @@ -229,30 +223,24 @@ case KBADBIN: strcpy (deathmessage, "Your netrek executable didn't verify correctly."); break; -#ifdef PARADISE - /* Unfortunately the numbering of whydead messages is inconsistent between - paradise and Vanilla */ - case KMISSILE: - sprintf (deathmessage, "You were killed by a missile from %s (%c%c).", - players[me->p_whodead].p_name, - teamlet[players[me->p_whodead].p_team], - shipnos[me->p_whodead]); - break; -#else + /* Unfortunately the numbering of some whydead messages is inconsistent between + paradise and Vanilla. KTORP2 overlaps with KMISSILE */ case KTORP2: - strcpy (deathmessage, "You were killed by detonated torpedo."); - break; -#endif -#ifdef PARADISE - case KASTEROID: - /* asteroid death [BDyess] */ - sprintf(deathmessage, "You were smashed to bits by an asteroid."); + if (paradise) + sprintf (deathmessage, "You were killed by a missile from %s (%c%c).", + players[me->p_whodead].p_name, + teamlet[players[me->p_whodead].p_team], + shipnos[me->p_whodead]); + else + strcpy (deathmessage, "You were killed by detonated torpedo."); break; -#else + /* Another Vanilla/paradise overlap problem. KSHIP2 overlaps with KASTEROID */ case KSHIP2: - strcpy (deathmessage, "You were killed by chain reaction explosion."); + if (paradise) + sprintf(deathmessage, "You were smashed to bits by an asteroid."); + else + strcpy (deathmessage, "You were killed by chain reaction explosion."); break; -#endif case KPLASMA2: strcpy (deathmessage, "You were killed by zapped plasma."); break; Index: playerlist.c =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/src/playerlist.c,v retrieving revision 1.15 retrieving revision 1.16 diff -u -d -r1.15 -r1.16 --- playerlist.c 25 May 2007 03:36:47 -0000 1.15 +++ playerlist.c 16 Apr 2008 00:08:20 -0000 1.16 @@ -201,10 +201,10 @@ /* Do we show observers in playerlist? 0 = all, 1 = only players, 2 = only observers 3 = players then observers */ playerListObserver = intDefault ("playerListObserver", 0); - /* plistUpdate[MAXPLAYER] must always be TRUE because thats how we no when + /* plistUpdate[nplayers] must always be TRUE because thats how we know when * to stop looking for a changed player. */ - updatePlayer[MAXPLAYER] = TRUE; + updatePlayer[nplayers] = TRUE; RedrawPlayerList (); } @@ -259,7 +259,6 @@ if (IsEmpty (me)) return; - /* Translate this style number into a player list layout string. */ switch (playerListStyle) @@ -313,7 +312,7 @@ plistReorder = TRUE; plistUpdated = TRUE; - for (i = 0; i < MAXPLAYER; i++) + for (i = 0; i < nplayers; i++) updatePlayer[i] = TRUE; UpdatePlistFn (); @@ -354,11 +353,11 @@ while (!(*update)); - /* Is this a valid player? Remember updatePlayer[MAXPLAYER] is + /* Is this a valid player? Remember updatePlayer[nplayers] is * always TRUE to make the above loop more efficient. */ count = update - updatePlayer; - if (count == MAXPLAYER) + if (count == nplayers) break; *update = FALSE; @@ -394,10 +393,10 @@ { if ((players[count].p_status != PFREE) && ((playerListObserver == 0 || playerListObserver == 3) || - ((playerListObserver == 1) && - !(players[count].p_flags & PFOBSERV)) || - ((playerListObserver == 2) && - (players[count].p_flags & PFOBSERV)))) + ((playerListObserver == 1) && (!paradise && + !(players[count].p_flags & PFOBSERV))) || + ((playerListObserver == 2) && (!paradise && + (players[count].p_flags & PFOBSERV))))) { PlistLine (playerw, players + count, plistPos[count]); PlistLine (playerw2, players + count, plistPos[count]); @@ -442,7 +441,7 @@ { myTeam = remap[me->p_team]; - for (pos = plistPos + MAXPLAYER - 1; pos >= plistPos; --pos) + for (pos = plistPos + nplayers - 1; pos >= plistPos; --pos) *pos = -1; } @@ -461,7 +460,7 @@ for (i = NUMTEAM; i >= 0; --i) teamPos[i] = 0; - for (current = players + MAXPLAYER - 1; current >= players; --current) + for (current = players + nplayers - 1; current >= players; --current) { if (playerListHack) { @@ -486,12 +485,12 @@ { if ( (playerListObserver == 0) || ((playerListObserver == 1 || playerListObserver == 3) - && !(current->p_flags & PFOBSERV)) + && !(!paradise && current->p_flags & PFOBSERV)) || ((playerListObserver == 2) - && (current->p_flags & PFOBSERV)) ) + && (!paradise && current->p_flags & PFOBSERV)) ) ++teamPos[remap[current->p_team]]; - if (current->p_flags & PFOBSERV) + if (!paradise && current->p_flags & PFOBSERV) ++obsPos; } } @@ -586,7 +585,7 @@ /* Write out each player that has either changed position or has * new stats. */ - for (i = MAXPLAYER - 1, current = players + MAXPLAYER - 1; + for (i = nplayers - 1, current = players + nplayers - 1; i >= 0; --i, --current) { if (current->p_status == PFREE) @@ -641,11 +640,14 @@ else { if ((playerListObserver == 0) || - ((playerListObserver == 1) && !(current->p_flags & PFOBSERV)) || - ((playerListObserver == 2) && (current->p_flags & PFOBSERV)) || + ((playerListObserver == 1) && !(!paradise && + current->p_flags & PFOBSERV)) || + ((playerListObserver == 2) && (!paradise && + current->p_flags & PFOBSERV)) || (playerListObserver == 3)) { - if (playerListObserver == 3 && (current->p_flags & PFOBSERV)) + if (playerListObserver == 3 && (!paradise && + current->p_flags & PFOBSERV)) row = --obsPos; else row = --(teamPos[remap[current->p_team]]); @@ -686,7 +688,7 @@ { myTeam = remap[me->p_team]; - for (update = updatePlayer + MAXPLAYER; update >= updatePlayer; + for (update = updatePlayer + nplayers; update >= updatePlayer; --update) { *update = TRUE; @@ -705,11 +707,11 @@ while (!(*update)); - /* Is this a valid player? Remember updatePlayer[MAXPLAYER] + /* Is this a valid player? Remember updatePlayer[nplayers] * is always TRUE to make the above loop more efficient. */ count = update - updatePlayer; - if (count == MAXPLAYER) + if (count == nplayers) break; @@ -721,8 +723,10 @@ if ( players[count].p_status != PFREE && (((playerListObserver == 0) || (playerListObserver == 3)) || - ((playerListObserver == 1) && !(players[count].p_flags & PFOBSERV)) || - ((playerListObserver == 2) && (players[count].p_flags & PFOBSERV))) ) + ((playerListObserver == 1) && !(!paradise && + players[count].p_flags & PFOBSERV)) || + ((playerListObserver == 2) && (!paradise && + players[count].p_flags & PFOBSERV))) ) { PlistLine (playerw, players + count, pos); PlistLine (playerw2, players + count, pos); @@ -1129,20 +1133,19 @@ break; case 'C': /* Curt (short) Rank */ -#ifdef PARADISE - format (buffPoint, (j->p_stats2.st_royal == 0 ? ranks2[j->p_stats2.st_rank].name : royal[j->p_stats2.st_royal].name), 10, 0); -#else - format (buffPoint, ranks[j->p_stats.st_rank].cname, 4, 0); -#endif + if (paradise) + //format (buffPoint, (j->p_stats2.st_royal == 0 ? ranks2[j->p_stats2.st_rank].name : royal[j->p_stats2.st_royal].name), 10, 0); + format (buffPoint, "UNKN", 4, 0); + else + format (buffPoint, ranks[j->p_stats.st_rank].cname, 4, 0); buffPoint += 4; break; case 'R': /* Rank */ -#ifdef PARADISE - format (buffPoint, (j->p_stats2.st_royal == 0 ? ranks2[j->p_stats2.st_rank].name : royal[j->p_stats2.st_royal].name), 10, 0); -#else - format (buffPoint, ranks[j->p_stats.st_rank].name, 10, 0); -#endif + if (paradise) + format (buffPoint, (j->p_stats2.st_royal == 0 ? ranks2[j->p_stats2.st_rank].name : royal[j->p_stats2.st_royal].name), 10, 0); + else + format (buffPoint, ranks[j->p_stats.st_rank].name, 10, 0); buffPoint += 10; break; @@ -1411,14 +1414,14 @@ GetPlayerFromPlist (int x, int y) { int i; - int player_no = MAXPLAYER; /* just to be sure the player does not exist */ + int player_no = nplayers; /* just to be sure the player does not exist */ int flag = 0; - if (y > MAXPLAYER - 1) y = MAXPLAYER - 1; + if (y > nplayers - 1) y = nplayers - 1; else if (y < 0) y = 0; /* Let's find what player sits in poition y in the list */ - for (i=0; i < MAXPLAYER; i++) + for (i=0; i < nplayers; i++) if (pl_row[i] == y) { if (playerListHack) @@ -1449,13 +1452,13 @@ break; } else if (playerListObserver == 1 && - !(players[i].p_flags & PFOBSERV)) + !(!paradise && players[i].p_flags & PFOBSERV)) { player_no = i; break; } else if (playerListObserver == 2 && - (players[i].p_flags & PFOBSERV)) + (!paradise && players[i].p_flags & PFOBSERV)) { player_no = i; break; @@ -1463,7 +1466,7 @@ } } - if (player_no != MAXPLAYER) + if (player_no != nplayers) { if (playerListHack) { @@ -1481,10 +1484,10 @@ if (playerListObserver == 0 || playerListObserver == 3) flag = 1; else if (playerListObserver == 1 && - !(players[player_no].p_flags & PFOBSERV)) + !(!paradise && players[player_no].p_flags & PFOBSERV)) flag = 1; else if (playerListObserver == 2 && - (players[player_no].p_flags & PFOBSERV)) + (!paradise && players[player_no].p_flags & PFOBSERV)) flag = 1; } } @@ -1506,7 +1509,7 @@ } else { - if (!(players[player_no].p_flags & PFOBSERV)) + if (!(!paradise && players[player_no].p_flags & PFOBSERV)) { if (!((players[player_no].p_flags & PFCLOAK) && (players[player_no].p_team != me->p_team)) && Index: ranklist.c =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/src/ranklist.c,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- ranklist.c 7 Jun 2007 04:43:39 -0000 1.5 +++ ranklist.c 16 Apr 2008 00:08:20 -0000 1.6 @@ -72,7 +72,6 @@ return (-1); } -#ifdef PARADISE void print_ranks_paradise(void) { @@ -106,14 +105,14 @@ strcpy(buf, "enough special ship rating"); W_WriteText(rankw, 1, i + 6, textColor, buf, strlen(buf), W_RegularFont); } -#endif void ranklist (void) { -#ifdef PARADISE - print_ranks_paradise(); -#else + if (paradise) + print_ranks_paradise(); + else + { register int i; char buf[100]; @@ -165,5 +164,5 @@ strcpy (buf, "4xDI with Ratings - 2, and 8xDI with Ratings - 3"); W_WriteText (rankw, 1, i + 7, textColor, buf, strlen (buf), W_RegularFont); -#endif + } } Index: socket.c =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/src/socket.c,v retrieving revision 1.41 retrieving revision 1.42 diff -u -d -r1.41 -r1.42 --- socket.c 13 Apr 2008 13:50:19 -0000 1.41 +++ socket.c 16 Apr 2008 00:08:22 -0000 1.42 @@ -19,9 +19,7 @@ #include #include #include -#ifdef PARADISE #include -#endif #include "Wlib.h" #include "defs.h" @@ -90,6 +88,7 @@ static int vtsize[9] = { 4, 8, 8, 12, 12, 16, 20, 20, 24 }; /* How big is the torppacket */ static int vtdata[9] = { 0, 3, 5, 7, 9, 12, 14, 16, 18 }; /* How big is Torpdata */ int vtisize[9] = { 4, 7, 9, 11, 13, 16, 18, 20, 22 }; /* 4 byte Header + torpdata */ +static int login_received = 0; /* S_P2 */ int shortversion = SHORTVERSION; /* Which version do we use? */ @@ -131,13 +130,7 @@ {sizeof (struct plyr_login_spacket), handlePlyrLogin}, /* SP_PL_LOGIN */ {sizeof (struct reserved_spacket), handleReserved}, /* SP_RESERVED */ {sizeof (struct planet_loc_spacket), handlePlanetLoc}, /* SP_PLANET_LOC */ - -#ifdef PARADISE {sizeof (struct scan_spacket), handleScan}, /* SP_SCAN (ATM) */ -#else - {0, dummy}, /* won't be called */ -#endif - {sizeof (struct udp_reply_spacket), handleUdpReply}, /* SP_UDP_STAT */ {sizeof (struct sequence_spacket), handleSequence}, /* SP_SEQUENCE */ {sizeof (struct sc_sequence_spacket), handleSequence}, /* SP_SC_SEQUENCE */ @@ -148,23 +141,14 @@ {0, dummy}, /* #31, and dummy won't */ #endif -#ifdef PARADISE - {sizeof (struct motd_pic_spacket), handleMotdPic}, /* SP_MOTD_PIC */ - {sizeof (struct stats_spacket2), handleStats2}, /* SP_STATS2 */ + {-1, handlePacket32}, /* SP_MOTD_PIC and SP_GENERIC_32 */ + {-1, handlePacket33}, /* SP_STATS2 and SP_FLAGS_ALL */ {sizeof (struct status_spacket2), handleStatus2}, /* SP_STATUS2 */ {sizeof (struct planet_spacket2), handlePlanet2}, /* SP_PLANET2 */ {sizeof (struct obvious_packet), handleTempPack}, /* SP_TEMP_5 */ {sizeof (struct thingy_spacket), handleThingy}, /* SP_THINGY */ {sizeof (struct thingy_info_spacket), handleThingyInfo}, /* SP_THINGY_INFO */ -#else - {sizeof (struct generic_32_spacket), handleGeneric32}, /* SP_GENERIC_32 */ - {sizeof (struct flags_all_spacket), handleFlagsAll}, /* SP_FLAGS_ALL */ - {0, dummy}, /* 34 */ - {0, dummy}, /* 35 */ - {0, dummy}, /* 36 */ - {0, dummy}, /* 37 */ - {0, dummy}, /* 38 */ -#endif + {sizeof (struct ship_cap_spacket), handleShipCap}, /* SP_SHIP_CAP */ #ifdef SHORT_PACKETS @@ -198,17 +182,10 @@ {0, dummy}, /* 50 */ #endif -#ifdef PARADISE {-1, /* variable */ handleGameparams}, {-1, /* variable */ handleExtension1}, {sizeof (struct terrain_packet2), handleTerrain2}, /* 53 */ {sizeof (struct terrain_info_packet2), handleTerrainInfo2}, /* 54 */ -#else - {0, dummy}, /* 51 */ - {0, dummy}, /* 52 */ - {0, dummy}, /* 53 */ - {0, dummy}, /* 54 */ -#endif {0, dummy}, /* 55 */ #ifdef SHORT_PACKETS /* S_P2 */ @@ -265,12 +242,7 @@ sizeof (struct updates_cpacket), /* CP_UPDATES */ sizeof (struct resetstats_cpacket), /* CP_RESETSTATS */ sizeof (struct reserved_cpacket), /* CP_RESERVED */ - -#ifdef PARADISE sizeof (struct scan_cpacket), /* CP_SCAN (ATM) */ -#else - 0, -#endif sizeof (struct udp_req_cpacket), /* CP_UDP_REQ */ sizeof (struct sequence_cpacket), /* CP_SEQUENCE */ @@ -945,7 +917,21 @@ switch (*bufptr) { -#ifdef PARADISE + case SP_MOTD_PIC: + //case SP_GENERIC_32: + if (paradise) + size = sizeof(struct motd_pic_spacket); + else + size = sizeof(struct generic_32_spacket); + break; + case SP_STATS2: + //case SP_FLAGS_ALL: + /* see packet33 handler for explanation of login_received */ + if (paradise || !login_received) + size = sizeof(struct stats_spacket2); + else + size = sizeof(struct flags_all_spacket); + break; case SP_GPARAM: switch ((unsigned char) bufptr[1]) { case 0: @@ -990,7 +976,6 @@ break; } break; -#endif case SP_S_MESSAGE: size = ((unsigned char) bufptr[4]); /* IMPORTANT Changed */ break; @@ -1302,6 +1287,12 @@ LineToConsole ("handleTorp: bad index %d\n", ntohs (packet->tnum)); return; } + if (ntohs (packet->tnum) >= nplayers * ntorps) + // This shouldn't happen... + { + LineToConsole ("handleTorp: received packet num larger than nplayers*ntorps\n"); + return; + } #endif weaponUpdate = 1; @@ -1337,6 +1328,12 @@ LineToConsole ("handleTorpInfo: bad index %d\n", ntohs (packet->tnum)); return; } + if (ntohs (packet->tnum) >= nplayers * ntorps) + // This shouldn't happen... + { + LineToConsole ("handleTorpInfo: received packet num larger than nplayers*ntorps\n"); + return; + } #endif weaponUpdate = 1; @@ -1433,6 +1430,11 @@ LineToConsole ("handleSelf: bad index %d\n", packet->pnum); return; } + if (packet->pnum >= nplayers) + { + LineToConsole ("handleSelf: received player num larger than nplayers\n"); + return; + } #endif if (!F_many_self) @@ -1489,6 +1491,11 @@ LineToConsole ("handlePlayer: bad index %d\n", packet->pnum); return; } + if (packet->pnum >= nplayers) + { + LineToConsole ("handlePlayer: received player num larger than nplayers\n"); + return; + } #endif @@ -1704,11 +1711,7 @@ case CP_REPRESS: case CP_COUP: case CP_DOCKPERM: - -#ifdef PARADISE case CP_SCAN: -#endif - case CP_PING_RESPONSE: /* non-critical stuff, use UDP */ send_udp: @@ -1758,9 +1761,13 @@ LineToConsole ("handlePlanet: bad index %d\n", packet->pnum); return; } -#endif - if (packet->pnum > nplanets) // This shouldn't happen... + if (packet->pnum > nplanets) + // This shouldn't happen... + { LineToConsole( "handlePlanet: received planet num larger than nplanets\n"); + return; + } +#endif plan = &planets[packet->pnum]; @@ -1821,8 +1828,19 @@ LineToConsole ("handlePhaser: bad target %d\n", ntohl (packet->target)); return; } + if (packet->pnum > nplayers*nphasers) + // This shouldn't happen... + { + LineToConsole( "handlePhaser: received player num larger than nplayers*nphasers\n"); + return; + } + if (packet->status == PHHIT && + (ntohl (packet->target) < 0 || ntohl (packet->target) >= (u_int) (nplayers*nplasmas) )) + { + LineToConsole ("handlePhaser: received target num larger than nplayers*nphasers\n"); + return; + } #endif - weaponUpdate = 1; phas = &phasers[packet->pnum]; phas->ph_status = packet->status; @@ -1853,7 +1871,7 @@ void handleMessage (struct mesg_spacket *packet) { - if (packet->m_from >= MAXPLAYER) + if (packet->m_from >= nplayers) packet->m_from = 255; #ifdef CORRUPTED_PACKETS @@ -1908,18 +1926,16 @@ strcpy (packet.login, login); packet.type = CP_LOGIN; packet.query = query; -#ifdef PARADISE packet.pad2 = 0x69; /* Paradise support */ packet.pad3 = 0x43; /* Paradise support */ -#endif sendServerPacket ((struct player_spacket *) &packet); } void handleLogin (struct login_spacket *packet) { + login_received = 1; loginAccept = packet->accept; -#ifdef PARADISE if ((packet->pad2 == 69) && (packet->pad3 == 42)) { paradise = 1; @@ -1934,7 +1950,7 @@ /*nplayers=36;*/ /*nplanets=40;*/ } -#endif + if (packet->accept) { /* no longer needed .. we have it in xtrekrc bcopy(packet->keymap, @@ -1999,6 +2015,12 @@ LineToConsole ("handlePlasmaInfo: bad index %d\n", packet->pnum); return; } + if (ntohs (packet->pnum) >= nplayers * nplasmas) + // This shouldn't happen... + { + LineToConsole ("handlePlasmaInfo: received packet num larger than nplayers*nplasmas\n"); + return; + } #endif weaponUpdate = 1; @@ -2045,6 +2067,12 @@ LineToConsole ("handlePlasma: bad index %d\n", packet->pnum); return; } + if (ntohs (packet->pnum) >= nplayers * nplasmas) + // This shouldn't happen... + { + LineToConsole ("handlePlasma: received packet num larger than nplayers*nplasmas\n"); + return; + } #endif weaponUpdate = 1; @@ -2075,6 +2103,11 @@ LineToConsole ("handleFlags: bad index %d\n", packet->pnum); return; } + if (packet->pnum >= nplayers) + { + LineToConsole ("handleFlags: received player num larger than nplayers\n"); + return; + } #endif if (players[packet->pnum].p_flags != ntohl (packet->flags) @@ -2112,6 +2145,11 @@ LineToConsole ("handleKills: bad index %d\n", packet->pnum); return; } + if (packet->pnum >= nplayers) + { + LineToConsole ("handleKills: received player num larger than nplayers\n"); + return; + } #endif if (players[packet->pnum].p_kills != ntohl (packet->kills) / 100.0) @@ -2141,6 +2179,11 @@ LineToConsole ("handlePStatus: bad index %d\n", packet->pnum); return; } + if (packet->pnum >= nplayers) + { + LineToConsole ("handlePStatus: received player num larger than nplayers\n"); + return; + } #endif j = &players[packet->pnum]; @@ -2340,6 +2383,11 @@ LineToConsole ("handleHostile: bad index %d\n", packet->pnum); return; } + if (packet->pnum >= nplayers) + { + LineToConsole ("handleHostile: received player num larger than nplayers\n"); + return; + } #endif pl = &players[packet->pnum]; @@ -2373,13 +2421,16 @@ LineToConsole ("handlePlyrLogin: bad index %d\n", packet->pnum); return; } -#ifndef PARADISE - if (packet->rank >= NUMRANKS) + if (packet->pnum >= nplayers) + { + LineToConsole ("handlePlyrLogin: received player num larger than nplayers\n"); + return; + } + if (!paradise && packet->rank >= NUMRANKS) { LineToConsole ("handlePlyrLogin: bad rank %d\n", packet->rank); return; } -#endif packet->name[sizeof (packet->name) - 1] = '\0'; packet->monitor[sizeof (packet->monitor) - 1] = '\0'; packet->login[sizeof (packet->login) - 1] = '\0'; @@ -2430,6 +2481,11 @@ LineToConsole ("handleStats: bad index %d\n", packet->pnum); return; } + if (packet->pnum >= nplayers) + { + LineToConsole ("handleStats: received player num larger than nplayers\n"); + return; + } #endif pl = &players[packet->pnum]; @@ -2554,11 +2610,9 @@ pl->pl_flags |= PLREDRAW; reinitPlanets = 1; -#ifdef PARADISE /* What a terrible hack, just copying paradise client code - BB */ if (pl->pl_x > gwidth) gwidth = 200000; -#endif #ifdef ROTATERACE if (rotate) @@ -2622,28 +2676,40 @@ #endif /* defined(BORG) */ } +/* SP_SHIP_CAP is sent frequenly by bronco servers but only once + by a paradise server. The paradise server packet contains ship + data for all ships. The bronco server packet contains data on + only one ship. */ void handleShipCap (struct ship_cap_spacket *packet) { unsigned short stype; stype = ntohs (packet->s_type); - shipvals[stype].s_torpspeed = ntohs (packet->s_torpspeed); - shipvals[stype].s_maxshield = ntohl (packet->s_maxshield); - shipvals[stype].s_maxdamage = ntohl (packet->s_maxdamage); - shipvals[stype].s_maxegntemp = ntohl (packet->s_maxegntemp); - shipvals[stype].s_maxwpntemp = ntohl (packet->s_maxwpntemp); - shipvals[stype].s_maxarmies = ntohs (packet->s_maxarmies); - shipvals[stype].s_maxfuel = ntohl (packet->s_maxfuel); - shipvals[stype].s_maxspeed = ntohl (packet->s_maxspeed); - shipvals[stype].s_width = ntohs (packet->s_width); - shipvals[stype].s_height = ntohs (packet->s_height); - shipvals[stype].s_phaserdamage = ntohs (packet->s_phaserrange); - getship (myship, myship->s_type); + if (!paradise) + { + shipvals[stype].s_torpspeed = ntohs (packet->s_torpspeed); + shipvals[stype].s_maxshield = ntohl (packet->s_maxshield); + shipvals[stype].s_maxdamage = ntohl (packet->s_maxdamage); + shipvals[stype].s_maxegntemp = ntohl (packet->s_maxegntemp); + shipvals[stype].s_maxwpntemp = ntohl (packet->s_maxwpntemp); + shipvals[stype].s_maxarmies = ntohs (packet->s_maxarmies); + shipvals[stype].s_maxfuel = ntohl (packet->s_maxfuel); + shipvals[stype].s_maxspeed = ntohl (packet->s_maxspeed); + shipvals[stype].s_width = ntohs (packet->s_width); + shipvals[stype].s_height = ntohs (packet->s_height); + shipvals[stype].s_phaserdamage = ntohs (packet->s_phaserrange); + shipvals[stype].s_letter = packet->s_letter; + shipvals[stype].s_desig[1] = packet->s_desig1; + shipvals[stype].s_desig[2] = packet->s_desig2; + shipvals[stype].s_bitmap = ntohs (packet->s_bitmap); + /* strncpy(shipvals[stype].s_name, packet->s_name, 16); */ + getship (myship, myship->s_type); - redrawTstats (); - calibrate_stats (); - redrawStats (); + redrawTstats (); /* Redraw dashboard */ + calibrate_stats (); /* Redefine colored statwin sliders */ + redrawStats (); /* Redraw statwin */ + } } void @@ -2739,7 +2805,90 @@ #endif -#ifdef PARADISE +void +initialize_players(void) +{ + int i; + + players = (struct player *) malloc(sizeof(*players) * nplayers); + + for (i = 0; i < nplayers; i++) + { + players[i].p_status = PFREE; + players[i].p_cloakphase = 0; + players[i].p_no = i; + players[i].p_ntorp = 0; + players[i].p_stats2.st_rank = 0; + players[i].p_stats2.st_royal = 0; + players[i].p_ndrone = 0; + players[i].p_explode = 1; + players[i].p_stats.st_tticks = 1; + } +} +void +initialize_torps(void) +{ + int i; + + torps = (struct torp *) malloc(sizeof(*torps) * nplayers * ntorps); + + for (i = 0; i < nplayers * ntorps; i++) { + torps[i].t_status = TFREE; + torps[i].t_owner = (i / ntorps); + } +} + +void +initialize_plasmas(void) +{ + int i; + + plasmatorps = (struct plasmatorp *) malloc(sizeof(*plasmatorps) * nplayers * nplasmas); + for (i = 0; i < nplayers * nplasmas; i++) { + plasmatorps[i].pt_status = PTFREE; + plasmatorps[i].pt_owner = (i / nplasmas); + } +} + +void +initialize_phasers(void) +{ + int i; + + phasers = (struct phaser *) malloc(sizeof(*phasers) * nplayers * nphasers); + + for (i = 0; i < nplayers * nphasers; i++) { + phasers[i].ph_status = PHFREE; + phasers[i].ph_fuse = 0; +#ifdef SOUND + phasers[i].sound_phaser = 0; +#endif + } +} + +/* Functions to handle the overloaded packet types 32 and 33 */ +void handlePacket32 (unsigned char *sbuf) +{ + if (paradise) + handleMotdPic ((struct motd_pic_spacket *) sbuf); + else + handleGeneric32 ((struct generic_32_spacket *) sbuf); + return; +} +void handlePacket33 (unsigned char *sbuf) +{ + /* Ok so paradise is evil and will send a stats_spacket2 to the client + before the client is told it is a paradise server, i.e. receiving the + login packet :(. Bronco will not send a flags_all_spacket before such time. + So we have to assume if we receive this packet before login is received, + it's a paradise server */ + if (paradise || !login_received) + handleStats2 ((struct stats_spacket2 *) sbuf); + else + handleFlagsAll ((struct flags_all_spacket *) sbuf); + return; +} + void handleMotdPic (struct motd_pic_spacket *packet) { int x, y, page, width, height; @@ -2763,6 +2912,11 @@ LineToConsole ("handleStats2: bad index\n"); return; } + if (packet->pnum >= nplayers) + { + LineToConsole ("handleStats2: received player num larger than nplayers\n"); + return; + } #endif updatePlayer[packet->pnum] |= LARGE_UPDATE; @@ -3002,21 +3156,6 @@ /* handlers for the extension1 packet */ -int compute_extension1_size (char *pkt) -{ - if (pkt[0] != SP_PARADISE_EXT1) - return -1; - - switch (pkt[1]) { - case SP_PE1_MISSING_BITMAP: - return sizeof(struct pe1_missing_bitmap_spacket); - case SP_PE1_NUM_MISSILES: - return sizeof(struct pe1_num_missiles_spacket); - default: - return -1; - } -} - void handleExtension1 (struct paradiseext1_spacket *packet) { switch (packet->subtype) { @@ -3130,6 +3269,11 @@ LineToConsole ("handleScan: bad index\n"); return; } + if (packet->pnum >= nplayers) + { + LineToConsole ("handleScan: received player num larger than nplayers\n"); + return; + } #endif if (packet->success) @@ -3147,51 +3291,13 @@ void initialize_thingies(void) { - int i; - int n = (npthingies * MAXPLAYER + ngthingies); + int i; + int n = (npthingies * nplayers + ngthingies); thingies = (struct thingy *) malloc(sizeof(*thingies) * n); for (i = 0; i < n; i++) { thingies[i].t_shape = SHP_BLANK; thingies[i].t_no = i; - thingies[i].t_owner = (i >= npthingies * MAXPLAYER) ? -1 : (i / npthingies); - } -} - -void -initialize_torps(void) -{ - int i; - - torps = (struct torp *) malloc(sizeof(*torps) * MAXPLAYER * ntorps); - - for (i = 0; i < nplayers * ntorps; i++) { - torps[i].t_status = TFREE; - torps[i].t_owner = (i / ntorps); - } -} - -void -initialize_plasmas(void) -{ - int i; - - plasmatorps = (struct plasmatorp *) malloc(sizeof(*plasmatorps) * MAXPLAYER * nplasmas); - for (i = 0; i < MAXPLAYER * nplasmas; i++) { - plasmatorps[i].pt_status = PTFREE; - plasmatorps[i].pt_owner = (i / nplasmas); - } -} - -static void -initialize_phasers(void) -{ - int i; - - phasers = (struct phaser *) malloc(sizeof(*phasers) * MAXPLAYER * nphasers); - - for (i = 0; i < MAXPLAYER * nphasers; i++) { - phasers[i].ph_status = PHFREE; - phasers[i].ph_fuse = 0; + thingies[i].t_owner = (i >= npthingies * nplayers) ? -1 : (i / npthingies); } } @@ -3363,6 +3469,7 @@ void build_default_configuration(void) { + // Most other initializations handled elsewhere (openmem) initialize_ranks(); initialize_royal(); } @@ -3370,10 +3477,7 @@ void resize_players(void) { -/* For sake of simplicity, I'm leaving size of player struct constant at MAXPLAYER, - resizing just leads to too many problems. - BB */ -/* - int me_no = 0; + int me_no = 0; if (me) me_no = me->p_no; @@ -3382,7 +3486,42 @@ me = &players[me_no]; myship = &(me->p_ship); } -*/ +} + +void +load_default_teams(void) +{ + number_of_teams = 4; + + /* independent is teaminfo[-1], allteam is teaminfo[4] */ + teaminfo = 1 + (struct teaminfo_s *) malloc(sizeof(*teaminfo) * (number_of_teams + 2)); + + strcpy(teaminfo[-1].name, "Independant"); + teaminfo[-1].letter = 'I'; + strcpy(teaminfo[-1].shortname, "IND"); + + strcpy(teaminfo[0].name, "Federation"); + teaminfo[0].letter = 'F'; + strcpy(teaminfo[0].shortname, "FED"); + + + strcpy(teaminfo[1].name, "Romulan"); + teaminfo[1].letter = 'R'; + strcpy(teaminfo[1].shortname, "ROM"); + + + strcpy(teaminfo[2].name, "Klingon"); + teaminfo[2].letter = 'K'; + strcpy(teaminfo[2].shortname, "KLI"); + + + strcpy(teaminfo[3].name, "Orion"); + teaminfo[3].letter = 'O'; + strcpy(teaminfo[3].shortname, "ORI"); + + strcpy(teaminfo[4].name, "All"); + teaminfo[4].letter = '-'; + strcpy(teaminfo[4].shortname, "ALL"); } load_generic_teams(void) @@ -3476,6 +3615,7 @@ free(royal); royal = 0; } + void handleGPsizes (struct gp_sizes_spacket *pkt) { free_ranks(); @@ -3492,7 +3632,6 @@ // shiptypes nranks2 = pkt->nranks; nroyals = pkt->nroyal; - // Code doesn't support nphasers ntorps or plasmas changing - BB nphasers = pkt->nphasers; ntorps = pkt->ntorps; nplasmas = pkt->nplasmas; @@ -3508,6 +3647,8 @@ reinitialize_royal(); resize_players(); + // Reinit playerlist - absolutely necessary or it will break horribly + InitPlayerList(); initialize_torps(); initialize_phasers(); initialize_plasmas(); @@ -3718,6 +3859,10 @@ #endif } +/* Interesting design. Uses a "dummy" packet gameparam_spacket to +represent the packet data passed to the function (in sbuf). The function +then looks at a common field between all the subpacket types to determine +which handler to use. */ void handleGameparams (struct gameparam_spacket *packet) { switch (packet->subtype) { @@ -3750,7 +3895,6 @@ } } -#endif /* PARADISE*/ /* UDP stuff */ void @@ -4769,14 +4913,12 @@ ntohl(((struct planet_loc_spacket *) packet)->y), ((struct planet_loc_spacket *) packet)->name ); break; -#ifdef PARADISE case SP_SCAN : /* ATM: results of player * * * scan */ LineToConsole("\nS->C SP_SCAN\t"); if(log_packets > 1) LineToConsole("not implemented,"); break; -#endif case SP_UDP_REPLY : /* notify client of UDP * * * status */ LineToConsole("\nS->C SP_UDP_REPLY\t"); @@ -4812,6 +4954,122 @@ } break; #endif + case SP_GENERIC_32 : + //case SP_MOTD_PIC : + if (paradise) + { + LineToConsole("\nS->C SP_MOTD_PIC\t"); + if (log_packets > 1) + LineToConsole(" x=%u, y=%u, page=%u, width=%u, height=%u,", + ntohs(((struct motd_pic_spacket *) packet)->x), + ntohs(((struct motd_pic_spacket *) packet)->y), + ntohs(((struct motd_pic_spacket *) packet)->page), + ntohs(((struct motd_pic_spacket *) packet)->width), + ntohs(((struct motd_pic_spacket *) packet)->height) ); + break; + } + else + { + LineToConsole("\nS->C SP_GENERIC_32\t"); + if (log_packets > 1) + LineToConsole(" version=%d, repair_time=%d, pl_orbit=%d,", + ((struct generic_32_spacket *) packet)->version, + ntohs(((struct generic_32_spacket *) packet)->repair_time), + ntohs(((struct generic_32_spacket *) packet)->pl_orbit) ); + break; + } + case SP_FLAGS_ALL : + //case SP_STATS2 : + if (paradise) + { + LineToConsole("\nS->C SP_STATS2\t"); + if (log_packets > 1) + LineToConsole(" pnum=%d, genocides=%ld, maxkills==%ld, di=%ld, kills=%ld, losses=%ld, armsbomb=%ld, resbomb=%ld, dooshes=%ld, planets=%ld, tticks=%ld, sbkills=%ld, sblosses=%ld, sbticks=%ld, sbmaxkills=%ld, wbkills=%ld, wblosses=%ld, wbticks=%ld, wbmaxkills=%ld, jsplanets=%ld, jsticks=%ld, rank=%ld, royal=%ld,", + ((struct stats_spacket *) packet)->pnum, + ntohl(((struct stats_spacket2 *) packet)->genocides), + ntohl(((struct stats_spacket2 *) packet)->maxkills), + ntohl(((struct stats_spacket2 *) packet)->di), + ntohl(((struct stats_spacket2 *) packet)->kills), + ntohl(((struct stats_spacket2 *) packet)->losses), + ntohl(((struct stats_spacket2 *) packet)->armsbomb), + ntohl(((struct stats_spacket2 *) packet)->resbomb), + ntohl(((struct stats_spacket2 *) packet)->dooshes), + ntohl(((struct stats_spacket2 *) packet)->planets), + ntohl(((struct stats_spacket2 *) packet)->tticks), + ntohl(((struct stats_spacket2 *) packet)->sbkills), + ntohl(((struct stats_spacket2 *) packet)->sblosses), + ntohl(((struct stats_spacket2 *) packet)->sbticks), + ntohl(((struct stats_spacket2 *) packet)->sbmaxkills), + ntohl(((struct stats_spacket2 *) packet)->wbkills), + ntohl(((struct stats_spacket2 *) packet)->wblosses), + ntohl(((struct stats_spacket2 *) packet)->wbticks), + ntohl(((struct stats_spacket2 *) packet)->wbmaxkills), + ntohl(((struct stats_spacket2 *) packet)->jsplanets), + ntohl(((struct stats_spacket2 *) packet)->jsticks), + ntohl(((struct stats_spacket2 *) packet)->rank), + ntohl(((struct stats_spacket2 *) packet)->royal) ); + break; + } + else + { + LineToConsole("\nS->C SP_FLAGS_ALL\t"); + if (log_packets > 1) + LineToConsole(" offset=%d, flags=%ld", + ((struct flags_all_spacket *) packet)->offset, + ((struct flags_all_spacket *) packet)->flags ); + break; + } + case SP_STATUS2 : + LineToConsole("\nS->C SP_STATUS2\t"); + if (log_packets > 1) + LineToConsole(" tourn=%d, dooshes=%ld, armsbomb=%ld, resbomb=%ld, planets=%ld, kills=%ld, losses=%ld, sbkills=%ld, sblosses=%ld, sbtime=%ld, wbkills=%ld, wblosses=%ld, wbtime=%ld, jsplanets=%ld, jstime=%ld, time=%ld, timeprod=%ld,", + ((struct status_spacket *) packet)->tourn, + ntohl(((struct status_spacket2 *) packet)->dooshes), + ntohl(((struct status_spacket2 *) packet)->armsbomb), + ntohl(((struct status_spacket2 *) packet)->resbomb), + ntohl(((struct status_spacket2 *) packet)->planets), + ntohl(((struct status_spacket2 *) packet)->kills), + ntohl(((struct status_spacket2 *) packet)->losses), + ntohl(((struct status_spacket2 *) packet)->sbkills), + ntohl(((struct status_spacket2 *) packet)->sblosses), + ntohl(((struct status_spacket2 *) packet)->sbtime), + ntohl(((struct status_spacket2 *) packet)->wbkills), + ntohl(((struct status_spacket2 *) packet)->wblosses), + ntohl(((struct status_spacket2 *) packet)->wbtime), + ntohl(((struct status_spacket2 *) packet)->jsplanets), + ntohl(((struct status_spacket2 *) packet)->jstime), + ntohl(((struct status_spacket2 *) packet)->time), + ntohl(((struct status_spacket2 *) packet)->timeprod) ); + break; + case SP_PLANET2 : + LineToConsole("\nS->C SP_PLANET2\t"); + if (log_packets > 1) + LineToConsole(" pnum=%d, owner=%d, info=%d, resbomb=%ld, planets=%ld, kills=%ld, losses=%ld, sbkills=%ld, sblosses=%ld, sbtime=%ld, wbkills=%ld, wblosses=%ld, wbtime=%ld, jsplanets=%ld, jstime=%ld, time=%ld, timeprod=%ld,", + ((struct planet_spacket2 *) packet)->pnum, + ((struct planet_spacket2 *) packet)->owner, + ((struct planet_spacket2 *) packet)->info, + ntohl(((struct planet_spacket2 *) packet)->flags), + ntohl(((struct planet_spacket2 *) packet)->timestamp), + ntohl(((struct planet_spacket2 *) packet)->armies) ); + break; + case SP_THINGY : + LineToConsole("\nS->C SP_THINGY\t"); + if (log_packets > 1) + LineToConsole(" dir=%d, tnum=%u, x=%u, y=%u,", + ((struct thingy_spacket *) packet)->dir, + ntohs(((struct thingy_spacket *) packet)->tnum), + ntohl(((struct thingy_spacket *) packet)->x), + ntohl(((struct thingy_spacket *) packet)->y) ); + break; + case SP_THINGY_INFO : + LineToConsole("\nS->C SP_THINGY_INFO\t"); + if (log_packets > 1) + LineToConsole(" war=%d, shape=%u, tnum=%u, owner=%u,", + ((struct thingy_info_spacket *) packet)->war, + ntohs(((struct thingy_info_spacket *) packet)->shape), + ntohs(((struct thingy_info_spacket *) packet)->tnum), + ntohs(((struct thingy_info_spacket *) packet)->owner) ); + break; case SP_SHIP_CAP : /* Handles server ship mods */ LineToConsole("\nS->C SP_SHIP_CAP\t"); if (log_packets > 1) @@ -4958,6 +5216,11 @@ } fprintf(stderr,"\n"); break; + case SP_GPARAM : + LineToConsole("\nS->C SP_GPARAM\t"); + if (log_packets > 1) + LineToConsole(" Fill in info later,"); + break; /* S_P2 */ case SP_S_SEQUENCE : /* SP_SEQUENCE for * * * compressed packets */ @@ -5270,7 +5533,6 @@ LineToConsole(","); } break; -#ifdef PARADISE case CP_SCAN : /* ATM: request for player * * * * scan */ @@ -5278,7 +5540,6 @@ if (log_packets > 1) LineToConsole(" not implemented," ); break; -#endif case CP_UDP_REQ : /* request UDP on/off */ LineToConsole("\nC->S CP_UDP_REQ\t"); if (log_packets > 1) From modemhero at users.sourceforge.net Tue Apr 15 19:08:02 2008 From: modemhero at users.sourceforge.net (Bill Balcerski) Date: Wed, 16 Apr 2008 00:08:02 +0000 Subject: [netrek-cvs] client/netrekxp NetrekXP to do list.C, 1.161, 1.162 clientr.suo, 1.145, 1.146 Message-ID: <20080416000845.D0D7DB42B@smtpgrey-2.real-time.com> Update of /cvsroot/netrek/client/netrekxp In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv25812 Modified Files: NetrekXP to do list.C clientr.suo Log Message: This massive patch solves most of the issues that prevented the client from working on bronco and paradise servers simultaneously. The end goal is to remove all the #ifdef PARADISE defines and have a unified client. These patch notes will describe some of the obstacles, and what was done to work around them. Obstacles/Solutions: 1) One obstacle was the reliance on MAX* values in the client for things like MAXPLAYER, MAXTORP, and MAXPHASER. The solution was to copy the paradise client and define both a theoretical server maximum (i.e. MAXPLAYER) and then the actual value defined by the server (nplayers). Thus, many checks in the code were changed to use these new dynamic variables. MAXPLAYER is now 257 instead of 36. But the default value for nplayers is 36, and will only be changed if the client receives a paradise game parameters packet. So there is no impact on playing on bronco servers since the default value is always the same. Likewise, ntorps, nplasmas and nphasers are now dynamic, with the default values being the bronco defaults. 2) Another obstacle was conflicting defines for some server packets. Namely SP_GENERIC_32/SP_MOTD_PIC and SP_FLAGS_ALL/SP_STATS2. The solution was to treat these packets as having dynamic size, with the size being determined on whether the server is paradise or not. One complication was that a paradise server will send the client a SP_STATS2 packet before it even acknowledges the client is paradise comptable, thus corrupting the data stream! The solution is to treat all SP_FLAGS_ALL/SP_STATS2 packets as being SP_STATS2 if the login packet was not received yet (the login packet identifies whether the server is paradise or not). 3) Yet another obstacle was conflicting player flag states, namely PFOBSERV/PFWARP, and PFTWARP/PFSNAKE. The solution was to change all checks in the code involving observers and twarp and paradise warp to check if the server is paradise or not. 4) A minor obstacle was overlapping p_whydead states between bronco and paradise. Solved by a simple if (paradise) check. General Changes: 1) Most #ifdef PARADISE removed and replaced, where necessary, by if (paradise) checks. Some areas which required more work were the planet window, rank window, motd paging and layout, initializing and sorting the playerlist. 2) Load all paradise bitmaps upon startup. 3) Struct ship updated to include fields the server has been sending via ship cap packets but we have been ignoring. Will be necessary for future changes to how ship caps are handled. 4) Initialization of most data structs (players, torps, phasers, plasmas, teams) now moved into their own functions rather than all being done in openmem(). In paradise sometimes they need to be reinitialized, so this was necessary. 5) New funcion isMe() to check if a player X is me, or if I am an observer locked onto player X. 6) Metaserver now lists paradise servers. 7) Added afterburner/warpprep/impulse indicator to the plain text dashboard. 8) Added a bunch of safety checks for many of the packet types. 9) Added a bunch of the new packet types to the print_packet function. 10) Removed unused compute_extension1_size() 11) Added load_default_teams(). It sets up the classic bronco teams into a data structure called teaminfo. Index: NetrekXP to do list.C =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/NetrekXP to do list.C,v retrieving revision 1.161 retrieving revision 1.162 diff -u -d -r1.161 -r1.162 --- NetrekXP to do list.C 13 Apr 2008 02:25:49 -0000 1.161 +++ NetrekXP to do list.C 16 Apr 2008 00:07:54 -0000 1.162 @@ -35,6 +35,7 @@ 6) Tractor on/off and pressor on/off option, rather than just tractor on, pressor on. Maybe with enforced state? 7) Verbosity setting for logfile..phaser and torp warn messages can be very spammy. +8) Make server packet for variable rank requirements like min offense. Paradise issues: 1) Motd paging system gutted for sake of simplicity @@ -43,10 +44,6 @@ 3) A bunch of gridline/zoom options should be made into netrekrc options. 4) The galactic zoom doesn't work 5) Some of the paradise packet types may need some work -6) Many many places in code where things are based on MAXSOMETHING whether it be players -torps planets plasmas. Whereas paradise wants to use dynamic variables. It's a -mess. And paradise has nphasers, the entire concept of multiple phasers -per ship is not compliant with current code. 7) Still missing asteroids and (flashing) warpbeacons. 8) Show ratings on full/wide playerlist. 9) CV army capacity is wrong - waiting on word from server experts to the right value @@ -55,6 +52,7 @@ 13) Issue with phaser misses on latest paradise server? on whitestar at least 14) Don't think there is gettarget support for astral bodies like nebulae and stars and black holes. Might be an issue with macros. +15) support variable # of ship types Wish list: 1) Rewrite graphics engine using SDL Index: clientr.suo =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/clientr.suo,v retrieving revision 1.145 retrieving revision 1.146 diff -u -d -r1.145 -r1.146 Binary files /tmp/cvsmWy1cQ and /tmp/cvskxMBsG differ From modemhero at users.sourceforge.net Tue Apr 15 21:57:09 2008 From: modemhero at users.sourceforge.net (Bill Balcerski) Date: Wed, 16 Apr 2008 02:57:09 +0000 Subject: [netrek-cvs] client/netrekxp clientr.suo,1.146,1.147 Message-ID: <20080416025748.25C3DB433@smtpgrey-2.real-time.com> Update of /cvsroot/netrek/client/netrekxp In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv5111 Modified Files: clientr.suo Log Message: First part of work at redoing ship types. Use s_desig[] instead of static shiptype arrays for a few cases to get ship type letters. Define # of typical ships for bronco vs paradise. Index: clientr.suo =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/clientr.suo,v retrieving revision 1.146 retrieving revision 1.147 diff -u -d -r1.146 -r1.147 Binary files /tmp/cvsJ0kcAP and /tmp/cvswlrULs differ From modemhero at users.sourceforge.net Tue Apr 15 21:57:10 2008 From: modemhero at users.sourceforge.net (Bill Balcerski) Date: Wed, 16 Apr 2008 02:57:10 +0000 Subject: [netrek-cvs] client/netrekxp/include data.h, 1.97, 1.98 struct.h, 1.25, 1.26 Message-ID: <20080416025720.74B1C3B408F@smtpgrey-1.real-time.com> Update of /cvsroot/netrek/client/netrekxp/include In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv5111/include Modified Files: data.h struct.h Log Message: First part of work at redoing ship types. Use s_desig[] instead of static shiptype arrays for a few cases to get ship type letters. Define # of typical ships for bronco vs paradise. Index: data.h =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/include/data.h,v retrieving revision 1.97 retrieving revision 1.98 diff -u -d -r1.97 -r1.98 --- data.h 16 Apr 2008 00:08:00 -0000 1.97 +++ data.h 16 Apr 2008 02:57:07 -0000 1.98 @@ -377,34 +377,34 @@ //Ships extern W_Icon ship_bitmaps[5]; -extern W_Icon fed_bitmaps[NUM_TYPES][SHIP_VIEWS], - kli_bitmaps[NUM_TYPES][SHIP_VIEWS], rom_bitmaps[NUM_TYPES][SHIP_VIEWS], - ori_bitmaps[NUM_TYPES][SHIP_VIEWS], ind_bitmaps[NUM_TYPES][SHIP_VIEWS]; +extern W_Icon fed_bitmaps[NUM_TYPES_BRONCO][SHIP_VIEWS], + kli_bitmaps[NUM_TYPES_BRONCO][SHIP_VIEWS], rom_bitmaps[NUM_TYPES_BRONCO][SHIP_VIEWS], + ori_bitmaps[NUM_TYPES_BRONCO][SHIP_VIEWS], ind_bitmaps[NUM_TYPES_BRONCO][SHIP_VIEWS]; extern W_Icon ship_bitmaps1[5]; -extern W_Icon fed_bitmaps1[NUM_TYPES][SHIP_VIEWS], - kli_bitmaps1[NUM_TYPES][SHIP_VIEWS], rom_bitmaps1[NUM_TYPES][SHIP_VIEWS], - ori_bitmaps1[NUM_TYPES][SHIP_VIEWS], ind_bitmaps1[NUM_TYPES][SHIP_VIEWS]; +extern W_Icon fed_bitmaps1[NUM_TYPES_BRONCO][SHIP_VIEWS], + kli_bitmaps1[NUM_TYPES_BRONCO][SHIP_VIEWS], rom_bitmaps1[NUM_TYPES_BRONCO][SHIP_VIEWS], + ori_bitmaps1[NUM_TYPES_BRONCO][SHIP_VIEWS], ind_bitmaps1[NUM_TYPES_BRONCO][SHIP_VIEWS]; extern W_Icon ship_bitmapsG[5]; -extern W_Icon fed_bitmapsG[NUM_TYPES][SHIP_VIEWS], - kli_bitmapsG[NUM_TYPES][SHIP_VIEWS], rom_bitmapsG[NUM_TYPES][SHIP_VIEWS], - ori_bitmapsG[NUM_TYPES][SHIP_VIEWS], ind_bitmapsG[NUM_TYPES][SHIP_VIEWS]; +extern W_Icon fed_bitmapsG[NUM_TYPES_BRONCO][SHIP_VIEWS], + kli_bitmapsG[NUM_TYPES_BRONCO][SHIP_VIEWS], rom_bitmapsG[NUM_TYPES_BRONCO][SHIP_VIEWS], + ori_bitmapsG[NUM_TYPES_BRONCO][SHIP_VIEWS], ind_bitmapsG[NUM_TYPES_BRONCO][SHIP_VIEWS]; extern W_Icon ship_bitmapsM[5]; -extern W_Icon fed_bitmapsM[NUM_TYPES][SHIP_VIEWS], - kli_bitmapsM[NUM_TYPES][SHIP_VIEWS], rom_bitmapsM[NUM_TYPES][SHIP_VIEWS], - ori_bitmapsM[NUM_TYPES][SHIP_VIEWS], ind_bitmapsM[NUM_TYPES][SHIP_VIEWS]; +extern W_Icon fed_bitmapsM[NUM_TYPES_BRONCO][SHIP_VIEWS], + kli_bitmapsM[NUM_TYPES_BRONCO][SHIP_VIEWS], rom_bitmapsM[NUM_TYPES_BRONCO][SHIP_VIEWS], + ori_bitmapsM[NUM_TYPES_BRONCO][SHIP_VIEWS], ind_bitmapsM[NUM_TYPES_BRONCO][SHIP_VIEWS]; extern W_Icon ship_bitmapsT[5]; -extern W_Icon fed_bitmapsT[NUM_TYPES][SHIP_VIEWS], - kli_bitmapsT[NUM_TYPES][SHIP_VIEWS], rom_bitmapsT[NUM_TYPES][SHIP_VIEWS], - ori_bitmapsT[NUM_TYPES][SHIP_VIEWS], ind_bitmapsT[NUM_TYPES][SHIP_VIEWS]; +extern W_Icon fed_bitmapsT[NUM_TYPES_BRONCO][SHIP_VIEWS], + kli_bitmapsT[NUM_TYPES_BRONCO][SHIP_VIEWS], rom_bitmapsT[NUM_TYPES_BRONCO][SHIP_VIEWS], + ori_bitmapsT[NUM_TYPES_BRONCO][SHIP_VIEWS], ind_bitmapsT[NUM_TYPES_BRONCO][SHIP_VIEWS]; extern W_Icon ship_bitmapsHR[5]; -extern W_Icon fed_bitmapsHR[NUM_TYPES], - kli_bitmapsHR[NUM_TYPES], rom_bitmapsHR[NUM_TYPES], - ori_bitmapsHR[NUM_TYPES], ind_bitmapsHR[NUM_TYPES]; +extern W_Icon fed_bitmapsHR[NUM_TYPES_BRONCO], + kli_bitmapsHR[NUM_TYPES_BRONCO], rom_bitmapsHR[NUM_TYPES_BRONCO], + ori_bitmapsHR[NUM_TYPES_BRONCO], ind_bitmapsHR[NUM_TYPES_BRONCO]; // Planets extern W_Icon planet_unknown_bitmap; Index: struct.h =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/include/struct.h,v retrieving revision 1.25 retrieving revision 1.26 diff -u -d -r1.25 -r1.26 --- struct.h 16 Apr 2008 00:08:04 -0000 1.25 +++ struct.h 16 Apr 2008 02:57:08 -0000 1.26 @@ -233,15 +233,15 @@ #define KSHIP2 0x11 /* chain-reaction explosions, overloaded to paradise KASTEROID */ #define KPLASMA2 0x12 /* killed by zapped plasma */ -#define NUM_PSHIP_TYPES 7 +#define NUM_PSHIP_TYPES 7 /* Number of unique paradise ships in the bitmap file */ #define PARADISE_SHIP_OFFSET 7 /* To make jumpship first entry in the paradise ship bitmap array */ +#define NUM_TYPES_PARADISE 15 /* Typical total number of ships on a paradise server */ +#define NUM_TYPES_BRONCO 8 /* Concrete total number of ships on a bronco server */ #ifdef PARADISE -#define NUM_TYPES 15 #define ATT 6 #define JUMPSHIP 7 #define SGALAXY 8 /* Not sure where to put this .. */ #else -#define NUM_TYPES 8 #define SGALAXY 6 #define ATT 7 #define JUMPSHIP 8 @@ -252,7 +252,7 @@ #define BATTLESHIP 3 #define ASSAULT 4 #define STARBASE 5 -#define FLAGSHIP 8 +#define FLAGSHIP 8 /* shares bitmap with galaxy class */ #define WARBASE 9 #define LIGHTCRUISER 10 #define CARRIER 11 From modemhero at users.sourceforge.net Tue Apr 15 21:57:13 2008 From: modemhero at users.sourceforge.net (Bill Balcerski) Date: Wed, 16 Apr 2008 02:57:13 +0000 Subject: [netrek-cvs] client/netrekxp/src data.c, 1.106, 1.107 defaults.c, 1.89, 1.90 inform.c, 1.8, 1.9 mswindow.c, 1.89, 1.90 newwin.c, 1.72, 1.73 playerlist.c, 1.16, 1.17 short.c, 1.27, 1.28 Message-ID: <20080416025724.939F03B408F@smtpgrey-1.real-time.com> Update of /cvsroot/netrek/client/netrekxp/src In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv5111/src Modified Files: data.c defaults.c inform.c mswindow.c newwin.c playerlist.c short.c Log Message: First part of work at redoing ship types. Use s_desig[] instead of static shiptype arrays for a few cases to get ship type letters. Define # of typical ships for bronco vs paradise. Index: mswindow.c =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/src/mswindow.c,v retrieving revision 1.89 retrieving revision 1.90 diff -u -d -r1.89 -r1.90 --- mswindow.c 16 Apr 2008 00:08:17 -0000 1.89 +++ mswindow.c 16 Apr 2008 02:57:09 -0000 1.90 @@ -421,7 +421,7 @@ DeleteObject (NetrekPalette); // Remove the ship bitmap structures we've created - for (j = 0; j < NUM_TYPES; j++) + for (j = 0; j < NUM_TYPES_BRONCO; j++) { for (k = 0; k < SHIP_VIEWS; k++) { Index: newwin.c =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/src/newwin.c,v retrieving revision 1.72 retrieving revision 1.73 diff -u -d -r1.72 -r1.73 --- newwin.c 16 Apr 2008 00:08:18 -0000 1.72 +++ newwin.c 16 Apr 2008 02:57:09 -0000 1.73 @@ -141,7 +141,7 @@ LR_MONOCHROME); } - for (j = 0; j < NUM_TYPES; j++) + for (j = 0; j < NUM_TYPES_BRONCO; j++) { for (k = 0; k < SHIP_VIEWS; k++) { @@ -218,7 +218,7 @@ BMP_SHIP_HEIGHT * 32, BMP_ROM_SHIP, w, LR_MONOCHROME); } - for (j = 0; j < NUM_TYPES; j++) + for (j = 0; j < NUM_TYPES_BRONCO; j++) { for (k = 0; k < SHIP_VIEWS; k++) { @@ -295,7 +295,7 @@ BMP_SHIP_HEIGHT * 32, BMP_ROM_SHIP, w, LR_MONOCHROME); } - for (j = 0; j < NUM_TYPES; j++) + for (j = 0; j < NUM_TYPES_BRONCO; j++) { for (k = 0; k < SHIP_VIEWS; k++) { @@ -372,7 +372,7 @@ BMP_SHIP_HEIGHT * 32, BMP_ROM_SHIP, w, LR_MONOCHROME); } - for (j = 0; j < NUM_TYPES; j++) + for (j = 0; j < NUM_TYPES_BRONCO; j++) { for (k = 0; k < SHIP_VIEWS; k++) { @@ -420,7 +420,7 @@ BMP_SHIP_HEIGHT * 32, BMP_ROM_SHIP, w, LR_MONOCHROME); - for (j = 0; j < NUM_TYPES; j++) + for (j = 0; j < NUM_TYPES_BRONCO; j++) { for (k = 0; k < SHIP_VIEWS; k++) { @@ -604,7 +604,7 @@ return; } - for (j = 0; j < NUM_TYPES; j++) + for (j = 0; j < NUM_TYPES_BRONCO; j++) { fed_bitmapsHR[j] = W_PointBitmap2 (ship_bitmapsHR[0], j, 0, BMP_SHIP_WIDTH_HR, Index: inform.c =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/src/inform.c,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- inform.c 16 Apr 2008 00:08:16 -0000 1.8 +++ inform.c 16 Apr 2008 02:57:09 -0000 1.9 @@ -32,16 +32,6 @@ * There is a different sized window for each type player/planet * and we take * care to keep it from extending beyond the main * window boundaries. */ -#ifdef PARADISE -static char *my_classes[NUM_TYPES] = { - "SC", "DD", "CA", "BB", "AS", "SB", "AT", "JS", "FL", "WB", "CL", "CV", "UT", "PT", "PU", -}; -#else -static char *my_classes[NUM_TYPES] = { - "SC", "DD", "CA", "BB", "AS", "SB", "GA", "AT" -}; -#endif - static void Info_list_paradise (struct player * j); /******************************************************************************/ @@ -124,8 +114,8 @@ (void) sprintf(buf, "dist: %-1.2f sectors", dist); W_WriteText (infow, W_Textwidth, W_Textheight * line++, playerColor (j), buf, strlen (buf), W_RegularFont); - (void) sprintf (buf, "Ship Type: %-s", - my_classes[j->p_ship.s_type]); + (void) sprintf (buf, "Ship Type: %c%c",j->p_ship.s_desig[0], + j->p_ship.s_desig[1]); W_WriteText (infow, W_Textwidth, W_Textheight * line++, playerColor (j), buf, strlen (buf), W_RegularFont); @@ -166,8 +156,8 @@ (void) sprintf (buf, "kills: %-4.2f", j->p_kills); W_WriteText (infow, W_Textwidth, W_Textheight * line++, playerColor (j), buf, strlen (buf), W_RegularFont); - (void) sprintf (buf, "Ship Type: %-s", - my_classes[j->p_ship.s_type]); + (void) sprintf (buf, "Ship Type: %c%c", j->p_ship.s_desig[0], + j->p_ship.s_desig[1]); W_WriteText (infow, W_Textwidth, W_Textheight * line++, playerColor (j), buf, strlen (buf), W_RegularFont); Index: short.c =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/src/short.c,v retrieving revision 1.27 retrieving revision 1.28 diff -u -d -r1.27 -r1.28 --- short.c 16 Apr 2008 00:08:21 -0000 1.27 +++ short.c 16 Apr 2008 02:57:09 -0000 1.28 @@ -221,7 +221,7 @@ char no_memory[] = { "Not enough memory for warning string!" }; /* For INL Server */ -char *shiptype[NUM_TYPES] = { "SC", "DD", "CA", "BB", "AS", "SB", "AT" }; +char *shiptype[NUM_TYPES_BRONCO] = { "SC", "DD", "CA", "BB", "AS", "SB", "AT" }; int spwinside = 500; /* WINSIDE from Server */ #define SPWINSIDE 500 /* To make it safe */ Index: playerlist.c =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/src/playerlist.c,v retrieving revision 1.16 retrieving revision 1.17 diff -u -d -r1.16 -r1.17 --- playerlist.c 16 Apr 2008 00:08:20 -0000 1.16 +++ playerlist.c 16 Apr 2008 02:57:09 -0000 1.17 @@ -98,7 +98,6 @@ plistLayout : The fields in the current playerlist. plistPos[plr] : The player list row assigned to each player. plistWidth : The width of the playerlist. - my_classes : The letters to go with each ship type. */ char *plistLayout = ""; @@ -106,13 +105,6 @@ static int plistPos[MAXPLAYER]; static int plistWidth = 0; static int plist2Width = 0; -#ifdef PARADISE -static char *my_classes[NUM_TYPES] = { - "SC", "DD", "CA", "BB", "AS", "SB", "AT", "JS", "FL", "WB", "CL", "CV", "UT", "PT", "PU" }; -#else -static char *my_classes[NUM_TYPES] = - { "SC", "DD", "CA", "BB", "AS", "SB", "GA", "AT" }; -#endif /* Local Functions */ @@ -1126,8 +1118,8 @@ } else { - *(buffPoint++) = my_classes[j->p_ship.s_type][0]; - *(buffPoint++) = my_classes[j->p_ship.s_type][1]; + *(buffPoint++) = j->p_ship.s_desig[0]; + *(buffPoint++) = j->p_ship.s_desig[1]; } break; Index: defaults.c =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/src/defaults.c,v retrieving revision 1.89 retrieving revision 1.90 diff -u -d -r1.89 -r1.90 --- defaults.c 6 Apr 2008 23:29:56 -0000 1.89 +++ defaults.c 16 Apr 2008 02:57:08 -0000 1.90 @@ -21,10 +21,9 @@ #include "proto.h" #include "version.h" -#define DEFAULTSHIP NUM_TYPES - #ifdef PARADISE -struct shipdef shipdefaults[NUM_TYPES + 1] = { +#define DEFAULTSHIP NUM_TYPES_PARADISE +struct shipdef shipdefaults[NUM_TYPES_PARADISE + 1] = { {"sc", NULL, NULL, NULL, NULL}, {"dd", NULL, NULL, NULL, NULL}, {"ca", NULL, NULL, NULL, NULL}, @@ -43,7 +42,8 @@ {"default", NULL, NULL, NULL, NULL} }; #else -struct shipdef shipdefaults[NUM_TYPES + 1] = { +#define DEFAULTSHIP NUM_TYPES_BRONCO +struct shipdef shipdefaults[NUM_TYPES_BRONCO + 1] = { {"sc", NULL, NULL, NULL, NULL}, {"dd", NULL, NULL, NULL, NULL}, {"ca", NULL, NULL, NULL, NULL}, @@ -3435,7 +3435,7 @@ fputs ("# button keymaps (b1keymap through b5keymap)\n", fp); } // Individual ship type settings - for (j = NUM_TYPES; j >= 0; j--) + for (j = (paradise ? NUM_TYPES_PARADISE : NUM_TYPES_BRONCO); j >= 0; j--) { STRNCPY (str1, "rcfile-", 8); strcat (str1, shipdefaults[j].name); Index: data.c =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/src/data.c,v retrieving revision 1.106 retrieving revision 1.107 diff -u -d -r1.106 -r1.107 --- data.c 16 Apr 2008 00:08:08 -0000 1.106 +++ data.c 16 Apr 2008 02:57:08 -0000 1.107 @@ -377,34 +377,34 @@ // Ships W_Icon ship_bitmaps[5]; -W_Icon fed_bitmaps[NUM_TYPES][SHIP_VIEWS], kli_bitmaps[NUM_TYPES][SHIP_VIEWS], - rom_bitmaps[NUM_TYPES][SHIP_VIEWS], ori_bitmaps[NUM_TYPES][SHIP_VIEWS], - ind_bitmaps[NUM_TYPES][SHIP_VIEWS]; +W_Icon fed_bitmaps[NUM_TYPES_BRONCO][SHIP_VIEWS], kli_bitmaps[NUM_TYPES_BRONCO][SHIP_VIEWS], + rom_bitmaps[NUM_TYPES_BRONCO][SHIP_VIEWS], ori_bitmaps[NUM_TYPES_BRONCO][SHIP_VIEWS], + ind_bitmaps[NUM_TYPES_BRONCO][SHIP_VIEWS]; W_Icon ship_bitmaps1[5]; -W_Icon fed_bitmaps1[NUM_TYPES][SHIP_VIEWS], kli_bitmaps1[NUM_TYPES][SHIP_VIEWS], - rom_bitmaps1[NUM_TYPES][SHIP_VIEWS], ori_bitmaps1[NUM_TYPES][SHIP_VIEWS], - ind_bitmaps1[NUM_TYPES][SHIP_VIEWS]; +W_Icon fed_bitmaps1[NUM_TYPES_BRONCO][SHIP_VIEWS], kli_bitmaps1[NUM_TYPES_BRONCO][SHIP_VIEWS], + rom_bitmaps1[NUM_TYPES_BRONCO][SHIP_VIEWS], ori_bitmaps1[NUM_TYPES_BRONCO][SHIP_VIEWS], + ind_bitmaps1[NUM_TYPES_BRONCO][SHIP_VIEWS]; W_Icon ship_bitmapsG[5]; -W_Icon fed_bitmapsG[NUM_TYPES][SHIP_VIEWS], - kli_bitmapsG[NUM_TYPES][SHIP_VIEWS], rom_bitmapsG[NUM_TYPES][SHIP_VIEWS], - ori_bitmapsG[NUM_TYPES][SHIP_VIEWS], ind_bitmapsG[NUM_TYPES][SHIP_VIEWS]; +W_Icon fed_bitmapsG[NUM_TYPES_BRONCO][SHIP_VIEWS], + kli_bitmapsG[NUM_TYPES_BRONCO][SHIP_VIEWS], rom_bitmapsG[NUM_TYPES_BRONCO][SHIP_VIEWS], + ori_bitmapsG[NUM_TYPES_BRONCO][SHIP_VIEWS], ind_bitmapsG[NUM_TYPES_BRONCO][SHIP_VIEWS]; W_Icon ship_bitmapsM[5]; -W_Icon fed_bitmapsM[NUM_TYPES][SHIP_VIEWS], - kli_bitmapsM[NUM_TYPES][SHIP_VIEWS], rom_bitmapsM[NUM_TYPES][SHIP_VIEWS], - ori_bitmapsM[NUM_TYPES][SHIP_VIEWS], ind_bitmapsM[NUM_TYPES][SHIP_VIEWS]; +W_Icon fed_bitmapsM[NUM_TYPES_BRONCO][SHIP_VIEWS], + kli_bitmapsM[NUM_TYPES_BRONCO][SHIP_VIEWS], rom_bitmapsM[NUM_TYPES_BRONCO][SHIP_VIEWS], + ori_bitmapsM[NUM_TYPES_BRONCO][SHIP_VIEWS], ind_bitmapsM[NUM_TYPES_BRONCO][SHIP_VIEWS]; W_Icon ship_bitmapsT[5]; -W_Icon fed_bitmapsT[NUM_TYPES][SHIP_VIEWS], - kli_bitmapsT[NUM_TYPES][SHIP_VIEWS], rom_bitmapsT[NUM_TYPES][SHIP_VIEWS], - ori_bitmapsT[NUM_TYPES][SHIP_VIEWS], ind_bitmapsT[NUM_TYPES][SHIP_VIEWS]; +W_Icon fed_bitmapsT[NUM_TYPES_BRONCO][SHIP_VIEWS], + kli_bitmapsT[NUM_TYPES_BRONCO][SHIP_VIEWS], rom_bitmapsT[NUM_TYPES_BRONCO][SHIP_VIEWS], + ori_bitmapsT[NUM_TYPES_BRONCO][SHIP_VIEWS], ind_bitmapsT[NUM_TYPES_BRONCO][SHIP_VIEWS]; W_Icon ship_bitmapsHR[5]; -W_Icon fed_bitmapsHR[NUM_TYPES], - kli_bitmapsHR[NUM_TYPES], rom_bitmapsHR[NUM_TYPES], - ori_bitmapsHR[NUM_TYPES], ind_bitmapsHR[NUM_TYPES]; +W_Icon fed_bitmapsHR[NUM_TYPES_BRONCO], + kli_bitmapsHR[NUM_TYPES_BRONCO], rom_bitmapsHR[NUM_TYPES_BRONCO], + ori_bitmapsHR[NUM_TYPES_BRONCO], ind_bitmapsHR[NUM_TYPES_BRONCO]; // Planets W_Icon planet_unknown_bitmap; @@ -448,7 +448,7 @@ char defpasswd[PSEUDOSIZE]; char login[PSEUDOSIZE]; -struct ship shipvals[NUM_TYPES]; +struct ship shipvals[NUM_TYPES_BRONCO]; /* 10 Aug 96 - Added curt (short) names -SAC */ struct rank ranks[NUMRANKS] = { From modemhero at users.sourceforge.net Thu Apr 17 22:42:40 2008 From: modemhero at users.sourceforge.net (Bill Balcerski) Date: Fri, 18 Apr 2008 03:42:40 +0000 Subject: [netrek-cvs] client/netrekxp/src cowmain.c, 1.37, 1.38 data.c, 1.107, 1.108 defaults.c, 1.90, 1.91 enter.c, 1.16, 1.17 getname.c, 1.10, 1.11 getship.c, 1.6, 1.7 helpwin.c, 1.13, 1.14 input.c, 1.44, 1.45 newwin.c, 1.73, 1.74 option.c, 1.53, 1.54 playback.c, 1.24, 1.25 socket.c, 1.42, 1.43 Message-ID: <20080418034250.7B0DEB42A@smtpgrey-2.real-time.com> Update of /cvsroot/netrek/client/netrekxp/src In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv31222/src Modified Files: cowmain.c data.c defaults.c enter.c getname.c getship.c helpwin.c input.c newwin.c option.c playback.c socket.c Log Message: First pass at creating a dynamic rather than static shiplist. Struct shiplist is a linked list of ships that contains all the ship info (fuel, hull, etc). This shiplist is updated by shipcap packet. Replaced old static shipvals struct. Struct ship now has entries for keymaps and buttonmaps - this info has been moved out of the stats struct. This eliminates the need for struct shipdef, which was just a static struct that held ship name and keymap/buttonmap strings. Much of the keymap/buttonmap handling had to be redone, as well as initialization of ships and keymaps. Still some bugs to work out, keymaps are not working right. Going to remove the invidivual rcfile for each ship - this feature isn't very useful, as you can already define ship specific keymaps and buttonmaps in a single rc file. This patch removed the last ifdef PARADISE so that config value is now set to defined for posterity purposes, but it doesn't do anything. Index: getship.c =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/src/getship.c,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- getship.c 16 Apr 2008 00:08:13 -0000 1.6 +++ getship.c 18 Apr 2008 03:42:37 -0000 1.7 @@ -21,325 +21,408 @@ #include "data.h" #include "proto.h" -/* fill in ship characteristics */ - void -getshipdefaults () +initialize_shiptypes () { - shipvals[SCOUT].s_phaserdamage = 75; /* scout: was 75 */ - shipvals[SCOUT].s_torpspeed = 16; /* scout: was 16 */ - shipvals[SCOUT].s_maxspeed = 12; /* scout: */ - shipvals[SCOUT].s_maxfuel = 5000; /* scout: */ - shipvals[SCOUT].s_maxarmies = 2; /* scout: */ - shipvals[SCOUT].s_maxshield = 75; /* scout: was 75 */ - shipvals[SCOUT].s_maxdamage = 75; /* scout: */ - shipvals[SCOUT].s_maxwpntemp = 1000; /* scout: */ - shipvals[SCOUT].s_maxegntemp = 1000; /* scout: */ - shipvals[SCOUT].s_type = SCOUT; /* scout: */ - shipvals[SCOUT].s_width = 20; /* scout: */ - shipvals[SCOUT].s_height = 20; /* scout: */ - shipvals[SCOUT].s_phaserfuse = 10; /* scout: */ - shipvals[SCOUT].s_repair = 80; /* scout: */ - shipvals[SCOUT].s_letter = 's'; - shipvals[SCOUT].s_desig[0] = 'S'; - shipvals[SCOUT].s_desig[1] = 'C'; - shipvals[SCOUT].s_bitmap = SCOUT; - - shipvals[DESTROYER].s_phaserdamage = 85; /* destroyer: */ - shipvals[DESTROYER].s_torpspeed = 14; /* destroyer: */ - shipvals[DESTROYER].s_maxspeed = 10; /* destroyer: */ - shipvals[DESTROYER].s_maxfuel = 7000; /* destroyer: */ - shipvals[DESTROYER].s_maxarmies = 5; /* destroyer: */ - shipvals[DESTROYER].s_maxshield = 85; /* destroyer: */ - shipvals[DESTROYER].s_maxdamage = 85; /* destroyer: */ - shipvals[DESTROYER].s_maxwpntemp = 1000; /* destroyer: */ - shipvals[DESTROYER].s_maxegntemp = 1000; /* destroyer: */ - shipvals[DESTROYER].s_width = 20; /* destroyer: */ - shipvals[DESTROYER].s_height = 20; /* destroyer: */ - shipvals[DESTROYER].s_type = DESTROYER; /* destroyer: */ - shipvals[DESTROYER].s_phaserfuse = 10; /* destroyer: */ - shipvals[DESTROYER].s_repair = 100; /* destroyer: */ - shipvals[DESTROYER].s_letter = 'd'; - shipvals[DESTROYER].s_desig[0] = 'D'; - shipvals[DESTROYER].s_desig[1] = 'D'; - shipvals[DESTROYER].s_bitmap = DESTROYER; - - shipvals[BATTLESHIP].s_phaserdamage = 105; /* battleship: */ - shipvals[BATTLESHIP].s_torpspeed = 12; /* battleship: */ - shipvals[BATTLESHIP].s_maxspeed = 8; /* battleship: */ - shipvals[BATTLESHIP].s_maxfuel = 14000; /* battleship: */ - shipvals[BATTLESHIP].s_maxarmies = 6; /* battleship: */ - shipvals[BATTLESHIP].s_maxshield = 130; /* battleship: */ - shipvals[BATTLESHIP].s_maxdamage = 130; /* battleship: */ - shipvals[BATTLESHIP].s_maxwpntemp = 1000; /* battleship: */ - shipvals[BATTLESHIP].s_maxegntemp = 1000; /* battleship: */ - shipvals[BATTLESHIP].s_width = 20; /* battleship: */ - shipvals[BATTLESHIP].s_height = 20; /* battleship: */ - shipvals[BATTLESHIP].s_type = BATTLESHIP; /* battleship: */ - shipvals[BATTLESHIP].s_phaserfuse = 10; /* battleship: */ - shipvals[BATTLESHIP].s_repair = 125; /* battleship: */ - shipvals[BATTLESHIP].s_letter = 'b'; - shipvals[BATTLESHIP].s_desig[0] = 'B'; - shipvals[BATTLESHIP].s_desig[1] = 'B'; - shipvals[BATTLESHIP].s_bitmap = BATTLESHIP; - - shipvals[ASSAULT].s_phaserdamage = 80; /* assault */ - shipvals[ASSAULT].s_torpspeed = 16; /* assault */ - shipvals[ASSAULT].s_maxspeed = 8; /* assault */ - shipvals[ASSAULT].s_maxfuel = 6000; /* assault */ - shipvals[ASSAULT].s_maxarmies = 20; /* assault */ - shipvals[ASSAULT].s_maxshield = 80; /* assault */ - shipvals[ASSAULT].s_maxdamage = 200; /* assault */ - shipvals[ASSAULT].s_maxwpntemp = 1000; /* assault */ - shipvals[ASSAULT].s_maxegntemp = 1200; /* assault */ - shipvals[ASSAULT].s_width = 20; /* assault */ - shipvals[ASSAULT].s_height = 20; /* assault */ - shipvals[ASSAULT].s_type = ASSAULT; /* assault */ - shipvals[ASSAULT].s_phaserfuse = 10; /* assault */ - shipvals[ASSAULT].s_repair = 120; /* assault */ - shipvals[ASSAULT].s_letter = 'a'; - shipvals[ASSAULT].s_desig[0] = 'A'; - shipvals[ASSAULT].s_desig[1] = 'S'; - shipvals[ASSAULT].s_bitmap = ASSAULT; - - shipvals[STARBASE].s_phaserdamage = 120; /* starbase */ - shipvals[STARBASE].s_torpspeed = 14; /* starbase */ - shipvals[STARBASE].s_maxfuel = 60000; /* starbase */ - shipvals[STARBASE].s_maxarmies = 25; /* starbase */ - shipvals[STARBASE].s_maxshield = 500; /* starbase */ - shipvals[STARBASE].s_maxdamage = 600; /* starbase */ - shipvals[STARBASE].s_maxspeed = 2; /* starbase */ - shipvals[STARBASE].s_maxwpntemp = 1300; /* starbase */ - shipvals[STARBASE].s_maxegntemp = 1000; /* starbase */ - shipvals[STARBASE].s_width = 20; /* starbase */ - shipvals[STARBASE].s_height = 20; /* starbase */ - shipvals[STARBASE].s_type = STARBASE; /* starbase */ - shipvals[STARBASE].s_phaserfuse = 4; /* starbase */ - shipvals[STARBASE].s_repair = 140; /* starbase */ - shipvals[STARBASE].s_letter = 'o'; - shipvals[STARBASE].s_desig[0] = 'S'; - shipvals[STARBASE].s_desig[1] = 'B'; - shipvals[STARBASE].s_bitmap = STARBASE; - - shipvals[ATT].s_phaserdamage = 10000; /* att: */ - shipvals[ATT].s_torpspeed = 30; /* att: */ - shipvals[ATT].s_maxspeed = 60; /* att: */ - shipvals[ATT].s_maxfuel = 60000; /* att: */ - shipvals[ATT].s_maxarmies = 1000; /* att: */ - shipvals[ATT].s_maxshield = 30000; /* att: */ - shipvals[ATT].s_maxdamage = 30000; /* att: */ - shipvals[ATT].s_maxwpntemp = 10000; /* att: */ - shipvals[ATT].s_maxegntemp = 10000; /* att: */ - shipvals[ATT].s_width = 20; /* att: */ - shipvals[ATT].s_height = 20; /* att: */ - shipvals[ATT].s_type = ATT; /* att: */ - shipvals[ATT].s_phaserfuse = 2; /* att: */ - shipvals[ATT].s_repair = 30000; /* att: */ - shipvals[ATT].s_letter = 'X'; - shipvals[ATT].s_desig[0] = 'A'; - shipvals[ATT].s_desig[1] = 'T'; - shipvals[ATT].s_bitmap = ATT; - - shipvals[SGALAXY].s_phaserdamage = 100; /* galaxy: */ - shipvals[SGALAXY].s_torpspeed = 13; /* galaxy: */ - shipvals[SGALAXY].s_maxspeed = 9; /* galaxy: */ - shipvals[SGALAXY].s_maxfuel = 12000; /* galaxy: */ - shipvals[SGALAXY].s_maxarmies = 5; /* galaxy: */ - shipvals[SGALAXY].s_maxshield = 140; /* galaxy: */ - shipvals[SGALAXY].s_maxdamage = 120; /* galaxy: */ - shipvals[SGALAXY].s_maxwpntemp = 1000; /* galaxy: */ - shipvals[SGALAXY].s_maxegntemp = 1000; /* galaxy: */ - shipvals[SGALAXY].s_width = 20; /* galaxy: */ - shipvals[SGALAXY].s_height = 20; /* galaxy: */ - shipvals[SGALAXY].s_type = SGALAXY; /* galaxy: */ - shipvals[SGALAXY].s_phaserfuse = 10; /* galaxy: */ - shipvals[SGALAXY].s_repair = 112; /* galaxy: */ - shipvals[SGALAXY].s_letter = 'g'; - shipvals[SGALAXY].s_desig[0] = 'G'; - shipvals[SGALAXY].s_desig[1] = 'A'; - shipvals[SGALAXY].s_bitmap = SGALAXY; - - shipvals[CRUISER].s_phaserdamage = 100; /* cruiser: */ - shipvals[CRUISER].s_torpspeed = 12; /* cruiser: */ - shipvals[CRUISER].s_maxspeed = 9; /* cruiser: */ - shipvals[CRUISER].s_maxfuel = 10000; /* cruiser: */ - shipvals[CRUISER].s_maxarmies = 10; /* cruiser: */ - shipvals[CRUISER].s_maxshield = 100; /* cruiser: */ - shipvals[CRUISER].s_maxdamage = 100; /* cruiser: */ - shipvals[CRUISER].s_maxwpntemp = 1000; /* cruiser: */ - shipvals[CRUISER].s_maxegntemp = 1000; /* cruiser: */ - shipvals[CRUISER].s_width = 20; /* cruiser: */ - shipvals[CRUISER].s_height = 20; /* cruiser: */ - shipvals[CRUISER].s_type = CRUISER; /* cruiser: */ - shipvals[CRUISER].s_phaserfuse = 10; /* cruiser: */ - shipvals[CRUISER].s_repair = 110; /* cruiser: */ - shipvals[CRUISER].s_letter = 'c'; - shipvals[CRUISER].s_desig[0] = 'C'; - shipvals[CRUISER].s_desig[1] = 'A'; - shipvals[CRUISER].s_bitmap = CRUISER; - -#ifdef PARADISE - shipvals[JUMPSHIP].s_phaserdamage = 25; - shipvals[JUMPSHIP].s_torpspeed = 18; - shipvals[JUMPSHIP].s_maxspeed = 20; - shipvals[JUMPSHIP].s_maxfuel = 50000; - shipvals[JUMPSHIP].s_maxarmies = 0; - shipvals[JUMPSHIP].s_maxshield = 5; - shipvals[JUMPSHIP].s_maxdamage = 60; - shipvals[JUMPSHIP].s_maxwpntemp = 1300; - shipvals[JUMPSHIP].s_maxegntemp = 5000; - shipvals[JUMPSHIP].s_type = JUMPSHIP; - shipvals[JUMPSHIP].s_width = 20; - shipvals[JUMPSHIP].s_height = 20; - shipvals[JUMPSHIP].s_phaserfuse = 4; - shipvals[JUMPSHIP].s_repair = 200; - shipvals[JUMPSHIP].s_letter = 'j'; - shipvals[JUMPSHIP].s_desig[0] = 'J'; - shipvals[JUMPSHIP].s_desig[1] = 'S'; - shipvals[JUMPSHIP].s_bitmap = JUMPSHIP; - - shipvals[FLAGSHIP].s_phaserdamage = 102; - shipvals[FLAGSHIP].s_torpspeed = 12; - shipvals[FLAGSHIP].s_maxspeed = 9; - shipvals[FLAGSHIP].s_maxfuel = 12500; - shipvals[FLAGSHIP].s_maxarmies = 6; - shipvals[FLAGSHIP].s_maxshield = 115; - shipvals[FLAGSHIP].s_maxdamage = 115; - shipvals[FLAGSHIP].s_maxwpntemp = 1000; - shipvals[FLAGSHIP].s_maxegntemp = 1500; - shipvals[FLAGSHIP].s_type = FLAGSHIP; - shipvals[FLAGSHIP].s_width = 20; - shipvals[FLAGSHIP].s_height = 20; - shipvals[FLAGSHIP].s_phaserfuse = 10; - shipvals[FLAGSHIP].s_repair = 118; - shipvals[FLAGSHIP].s_letter = 'f'; - shipvals[FLAGSHIP].s_desig[0] = 'F'; - shipvals[FLAGSHIP].s_desig[1] = 'L'; - shipvals[FLAGSHIP].s_bitmap = FLAGSHIP; - - shipvals[WARBASE].s_phaserdamage = 125; - shipvals[WARBASE].s_torpspeed = 15; - shipvals[WARBASE].s_maxspeed = 3; - shipvals[WARBASE].s_maxfuel = 50000; - shipvals[WARBASE].s_maxarmies = 0; - shipvals[WARBASE].s_maxshield = 250; - shipvals[WARBASE].s_maxdamage = 500; - shipvals[WARBASE].s_maxwpntemp = 1500; - shipvals[WARBASE].s_maxegntemp = 1000; - shipvals[WARBASE].s_type = WARBASE; - shipvals[WARBASE].s_width = 20; - shipvals[WARBASE].s_height = 20; - shipvals[WARBASE].s_phaserfuse = 5; - shipvals[WARBASE].s_repair = 170; - shipvals[WARBASE].s_letter = 'w'; - shipvals[WARBASE].s_desig[0] = 'W'; - shipvals[WARBASE].s_desig[1] = 'B'; - shipvals[WARBASE].s_bitmap = WARBASE; - - shipvals[LIGHTCRUISER].s_phaserdamage = 90; - shipvals[LIGHTCRUISER].s_torpspeed = 13; - shipvals[LIGHTCRUISER].s_maxspeed = 10; - shipvals[LIGHTCRUISER].s_maxfuel = 8500; - shipvals[LIGHTCRUISER].s_maxarmies = 3; - shipvals[LIGHTCRUISER].s_maxshield = 95; - shipvals[LIGHTCRUISER].s_maxdamage = 90; - shipvals[LIGHTCRUISER].s_maxwpntemp = 1000; - shipvals[LIGHTCRUISER].s_maxegntemp = 1500; - shipvals[LIGHTCRUISER].s_type = LIGHTCRUISER; - shipvals[LIGHTCRUISER].s_width = 20; - shipvals[LIGHTCRUISER].s_height = 20; - shipvals[LIGHTCRUISER].s_phaserfuse = 10; - shipvals[LIGHTCRUISER].s_repair = 80; - shipvals[LIGHTCRUISER].s_letter = 'l'; - shipvals[LIGHTCRUISER].s_desig[0] = 'C'; - shipvals[LIGHTCRUISER].s_desig[1] = 'L'; - shipvals[LIGHTCRUISER].s_bitmap = LIGHTCRUISER; + int i; + struct shiplist *temp; - shipvals[CARRIER].s_phaserdamage = 95; - shipvals[CARRIER].s_torpspeed = 13; - shipvals[CARRIER].s_maxspeed = 9; - shipvals[CARRIER].s_maxfuel = 15000; - shipvals[CARRIER].s_maxarmies = 3; - shipvals[CARRIER].s_maxshield = 120; - shipvals[CARRIER].s_maxdamage = 150; - shipvals[CARRIER].s_maxwpntemp = 1000; - shipvals[CARRIER].s_maxegntemp = 1500; - shipvals[CARRIER].s_type = CARRIER; - shipvals[CARRIER].s_width = 20; - shipvals[CARRIER].s_height = 20; - shipvals[CARRIER].s_phaserfuse = 6; - shipvals[CARRIER].s_repair = 105; - shipvals[CARRIER].s_letter = 'v'; - shipvals[CARRIER].s_desig[0] = 'C'; - shipvals[CARRIER].s_desig[1] = 'V'; - shipvals[CARRIER].s_bitmap = CARRIER; + /* start at -1, the default shiptype */ + for (i = -1; i < nshiptypes; i++) { + temp = (struct shiplist *) malloc(sizeof(struct shiplist)); + temp->ship = (struct ship *) malloc(sizeof(struct ship)); + getshipdefaults(temp->ship, i); + temp->next = shiptypes; + if (temp->next) + temp->next->prev = temp; + temp->prev = NULL; + shiptypes = temp; + } +} - shipvals[UTILITY].s_phaserdamage = 80; - shipvals[UTILITY].s_torpspeed = 15; - shipvals[UTILITY].s_maxspeed = 7; - shipvals[UTILITY].s_maxfuel = 16000; - shipvals[UTILITY].s_maxarmies = 12; - shipvals[UTILITY].s_maxshield = 120; - shipvals[UTILITY].s_maxdamage = 220; - shipvals[UTILITY].s_maxwpntemp = 1000; - shipvals[UTILITY].s_maxegntemp = 1800; - shipvals[UTILITY].s_type = UTILITY; - shipvals[UTILITY].s_width = 20; - shipvals[UTILITY].s_height = 20; - shipvals[UTILITY].s_phaserfuse = 8; - shipvals[UTILITY].s_repair = 120; - shipvals[UTILITY].s_letter = 'u'; - shipvals[UTILITY].s_desig[0] = 'U'; - shipvals[UTILITY].s_desig[1] = 'T'; - shipvals[UTILITY].s_bitmap = UTILITY; +/* now returns a pointer to where the ship data is located. This way + if the data is later changed by the server everybody gets updated. + Plus as a bonus it's more efficient :) [Bill Dyess] */ +struct ship * +getship(int s_type) +{ + struct shiplist *temp, *new; - shipvals[PATROL].s_phaserdamage = 50; - shipvals[PATROL].s_torpspeed = 15; - shipvals[PATROL].s_maxspeed = 13; - shipvals[PATROL].s_maxfuel = 4000; - shipvals[PATROL].s_maxarmies = 1; - shipvals[PATROL].s_maxshield = 50; - shipvals[PATROL].s_maxdamage = 40; - shipvals[PATROL].s_maxwpntemp = 1000; - shipvals[PATROL].s_maxegntemp = 1500; - shipvals[PATROL].s_type = PATROL; - shipvals[PATROL].s_width = 20; - shipvals[PATROL].s_height = 20; - shipvals[PATROL].s_phaserfuse = 8; - shipvals[PATROL].s_repair = 50; - shipvals[PATROL].s_letter = 'p'; - shipvals[PATROL].s_desig[0] = 'P'; - shipvals[PATROL].s_desig[1] = 'T'; - shipvals[PATROL].s_bitmap = PATROL; + temp = shiptypes; + while (temp) { + if (temp->ship->s_type == s_type) { + return temp->ship; + } + temp = temp->next; + } + /* + ok, that shiptype is unheard of. Assume a new shiptype, and get the + values for CA. Also add the ship to the list so if it gets updated by + the server later everyone stays happy. [Bill Dyess] + */ + printf("Error: getship of unknown ship type %d, using CA defaults\n", s_type); + temp = shiptypes; + while (temp) { + if (temp->ship->s_type == DEFAULT) { + printf("Adding ship type %d\n", s_type); + /* now add the new ship to the list */ + new = (struct shiplist *) malloc(sizeof(struct shiplist)); + new->ship = (struct ship *) malloc(sizeof(struct ship)); + new->next = shiptypes; + new->prev = NULL; + if (shiptypes) + shiptypes->prev = new; + shiptypes = new; + memmove(new->ship, temp->ship, sizeof(struct ship)); + new->ship->s_type = s_type; + return new->ship; + } + temp = temp->next; + } + return temp->ship; - shipvals[PUCK].s_phaserdamage = 75; - shipvals[PUCK].s_torpspeed = 16; - shipvals[PUCK].s_maxspeed = 12; - shipvals[PUCK].s_maxfuel = 5000; - shipvals[PUCK].s_maxarmies = 2; - shipvals[PUCK].s_maxshield = 75; - shipvals[PUCK].s_maxdamage = 75; - shipvals[PUCK].s_maxwpntemp = 1000; - shipvals[PUCK].s_maxegntemp = 1000; - shipvals[PUCK].s_type = PUCK; - shipvals[PUCK].s_width = 20; - shipvals[PUCK].s_height = 20; - shipvals[PUCK].s_phaserfuse = 10; - shipvals[PUCK].s_repair = 80; - shipvals[PUCK].s_letter = 'k'; - shipvals[PUCK].s_desig[0] = 'P'; - shipvals[PUCK].s_desig[1] = 'U'; - shipvals[PUCK].s_bitmap = PUCK; -#endif } -/******************************************************************************/ -/*** getship() ***/ -/******************************************************************************/ +/* fill in ship characteristics */ void -getship (struct ship *shipp, - int s_type) +getshipdefaults (struct ship *shipp, int s_type) { - memcpy ((char *) shipp, (char *) &(shipvals[s_type]), - sizeof (struct ship)); + switch (s_type) { + case SCOUT: + case PUCK: + shipp->s_phaserdamage = 75; /* scout: was 75 */ + shipp->s_torpspeed = 16; /* scout: was 16 */ + shipp->s_maxspeed = 12; /* scout: */ + shipp->s_maxfuel = 5000; /* scout: */ + shipp->s_maxarmies = 2; /* scout: */ + shipp->s_maxshield = 75; /* scout: was 75 */ + shipp->s_maxdamage = 75; /* scout: */ + shipp->s_maxwpntemp = 1000; /* scout: */ + shipp->s_maxegntemp = 1000; /* scout: */ + shipp->s_type = SCOUT; /* scout: */ + shipp->s_width = 20; /* scout: */ + shipp->s_height = 20; /* scout: */ + shipp->s_phaserfuse = 10; /* scout: */ + shipp->s_repair = 80; /* scout: */ + if(s_type == PUCK) { + shipp->s_type = PUCK; + shipp->s_letter = 'k'; + shipp->s_desig[0] = 'P'; + shipp->s_desig[1] = 'U'; + shipp->s_bitmap = PUCK; + } else { + shipp->s_type = SCOUT; + shipp->s_letter = 's'; + shipp->s_desig[0] = 'S'; + shipp->s_desig[1] = 'C'; + shipp->s_bitmap = SCOUT; + } + break; + case DESTROYER: + shipp->s_phaserdamage = 85; /* destroyer: */ + shipp->s_torpspeed = 14; /* destroyer: */ + shipp->s_maxspeed = 10; /* destroyer: */ + shipp->s_maxfuel = 7000; /* destroyer: */ + shipp->s_maxarmies = 5; /* destroyer: */ + shipp->s_maxshield = 85; /* destroyer: */ + shipp->s_maxdamage = 85; /* destroyer: */ + shipp->s_maxwpntemp = 1000; /* destroyer: */ + shipp->s_maxegntemp = 1000; /* destroyer: */ + shipp->s_width = 20; /* destroyer: */ + shipp->s_height = 20; /* destroyer: */ + shipp->s_type = DESTROYER; /* destroyer: */ + shipp->s_phaserfuse = 10; /* destroyer: */ + shipp->s_repair = 100; /* destroyer: */ + shipp->s_letter = 'd'; + shipp->s_desig[0] = 'D'; + shipp->s_desig[1] = 'D'; + shipp->s_bitmap = DESTROYER; + break; + default: + case DEFAULT: + case CRUISER: + shipp->s_phaserdamage = 100; /* cruiser: */ + shipp->s_torpspeed = 12; /* cruiser: */ + shipp->s_maxspeed = 9; /* cruiser: */ + shipp->s_maxfuel = 10000; /* cruiser: */ + shipp->s_maxarmies = 10; /* cruiser: */ + shipp->s_maxshield = 100; /* cruiser: */ + shipp->s_maxdamage = 100; /* cruiser: */ + shipp->s_maxwpntemp = 1000; /* cruiser: */ + shipp->s_maxegntemp = 1000; /* cruiser: */ + shipp->s_width = 20; /* cruiser: */ + shipp->s_height = 20; /* cruiser: */ + shipp->s_type = s_type; /* cruiser OR default */ + shipp->s_phaserfuse = 10; /* cruiser: */ + shipp->s_repair = 110; /* cruiser: */ + shipp->s_letter = 'c'; + shipp->s_desig[0] = 'C'; + shipp->s_desig[1] = 'A'; + shipp->s_bitmap = CRUISER; + break; + case BATTLESHIP: + shipp->s_phaserdamage = 105; /* battleship: */ + shipp->s_torpspeed = 12; /* battleship: */ + shipp->s_maxspeed = 8; /* battleship: */ + shipp->s_maxfuel = 14000; /* battleship: */ + shipp->s_maxarmies = 6; /* battleship: */ + shipp->s_maxshield = 130; /* battleship: */ + shipp->s_maxdamage = 130; /* battleship: */ + shipp->s_maxwpntemp = 1000; /* battleship: */ + shipp->s_maxegntemp = 1000; /* battleship: */ + shipp->s_width = 20; /* battleship: */ + shipp->s_height = 20; /* battleship: */ + shipp->s_type = BATTLESHIP; /* battleship: */ + shipp->s_phaserfuse = 10; /* battleship: */ + shipp->s_repair = 125; /* battleship: */ + shipp->s_letter = 'b'; + shipp->s_desig[0] = 'B'; + shipp->s_desig[1] = 'B'; + shipp->s_bitmap = BATTLESHIP; + break; + case ASSAULT: + shipp->s_phaserdamage = 80; /* assault */ + shipp->s_torpspeed = 16; /* assault */ + shipp->s_maxspeed = 8; /* assault */ + shipp->s_maxfuel = 6000; /* assault */ + shipp->s_maxarmies = 20; /* assault */ + shipp->s_maxshield = 80; /* assault */ + shipp->s_maxdamage = 200; /* assault */ + shipp->s_maxwpntemp = 1000; /* assault */ + shipp->s_maxegntemp = 1200; /* assault */ + shipp->s_width = 20; /* assault */ + shipp->s_height = 20; /* assault */ + shipp->s_type = ASSAULT; /* assault */ + shipp->s_phaserfuse = 10; /* assault */ + shipp->s_repair = 120; /* assault */ + shipp->s_letter = 'a'; + shipp->s_desig[0] = 'A'; + shipp->s_desig[1] = 'S'; + shipp->s_bitmap = ASSAULT; + break; + case STARBASE: + shipp->s_phaserdamage = 120; /* starbase */ + shipp->s_torpspeed = 14; /* starbase */ + shipp->s_maxfuel = 60000; /* starbase */ + shipp->s_maxarmies = 25; /* starbase */ + shipp->s_maxshield = 500; /* starbase */ + shipp->s_maxdamage = 600; /* starbase */ + shipp->s_maxspeed = 2; /* starbase */ + shipp->s_maxwpntemp = 1300; /* starbase */ + shipp->s_maxegntemp = 1000; /* starbase */ + shipp->s_width = 20; /* starbase */ + shipp->s_height = 20; /* starbase */ + shipp->s_type = STARBASE; /* starbase */ + shipp->s_phaserfuse = 4; /* starbase */ + shipp->s_repair = 140; /* starbase */ + shipp->s_letter = 'o'; + shipp->s_desig[0] = 'S'; + shipp->s_desig[1] = 'B'; + shipp->s_bitmap = STARBASE; + break; + case ATT: /* or GALAXY */ + if (paradise) { + shipp->s_phaserdamage = 10000; /* att: */ + shipp->s_torpspeed = 30; /* att: */ + shipp->s_maxspeed = 60; /* att: */ + shipp->s_maxfuel = 60000; /* att: */ + shipp->s_maxarmies = 1000; /* att: */ + shipp->s_maxshield = 30000; /* att: */ + shipp->s_maxdamage = 30000; /* att: */ + shipp->s_maxwpntemp = 10000; /* att: */ + shipp->s_maxegntemp = 10000; /* att: */ + shipp->s_width = 20; /* att: */ + shipp->s_height = 20; /* att: */ + shipp->s_type = ATT; /* att: */ + shipp->s_phaserfuse = 2; /* att: */ + shipp->s_repair = 30000; /* att: */ + shipp->s_letter = 'X'; + shipp->s_desig[0] = 'A'; + shipp->s_desig[1] = 'T'; + shipp->s_bitmap = ATT; + } + else { + shipp->s_phaserdamage = 100; /* galaxy: */ + shipp->s_torpspeed = 13; /* galaxy: */ + shipp->s_maxspeed = 9; /* galaxy: */ + shipp->s_maxfuel = 12000; /* galaxy: */ + shipp->s_maxarmies = 5; /* galaxy: */ + shipp->s_maxshield = 140; /* galaxy: */ + shipp->s_maxdamage = 120; /* galaxy: */ + shipp->s_maxwpntemp = 1000; /* galaxy: */ + shipp->s_maxegntemp = 1000; /* galaxy: */ + shipp->s_width = 20; /* galaxy: */ + shipp->s_height = 20; /* galaxy: */ + shipp->s_type = SGALAXY; /* galaxy: */ + shipp->s_phaserfuse = 10; /* galaxy: */ + shipp->s_repair = 112; /* galaxy: */ + shipp->s_letter = 'g'; + shipp->s_desig[0] = 'G'; + shipp->s_desig[1] = 'A'; + shipp->s_bitmap = SGALAXY; + } + break; + case JUMPSHIP: /* or ATT */ + if (paradise) { + shipp->s_phaserdamage = 25; + shipp->s_torpspeed = 18; + shipp->s_maxspeed = 20; + shipp->s_maxfuel = 50000; + shipp->s_maxarmies = 0; + shipp->s_maxshield = 5; + shipp->s_maxdamage = 60; + shipp->s_maxwpntemp = 1300; + shipp->s_maxegntemp = 5000; + shipp->s_type = JUMPSHIP; + shipp->s_width = 20; + shipp->s_height = 20; + shipp->s_phaserfuse = 4; + shipp->s_repair = 200; + shipp->s_letter = 'j'; + shipp->s_desig[0] = 'J'; + shipp->s_desig[1] = 'S'; + shipp->s_bitmap = JUMPSHIP; + } + else { + shipp->s_phaserdamage = 10000; /* att: */ + shipp->s_torpspeed = 30; /* att: */ + shipp->s_maxspeed = 60; /* att: */ + shipp->s_maxfuel = 60000; /* att: */ + shipp->s_maxarmies = 1000; /* att: */ + shipp->s_maxshield = 30000; /* att: */ + shipp->s_maxdamage = 30000; /* att: */ + shipp->s_maxwpntemp = 10000; /* att: */ + shipp->s_maxegntemp = 10000; /* att: */ + shipp->s_width = 20; /* att: */ + shipp->s_height = 20; /* att: */ + shipp->s_type = ATT; /* att: */ + shipp->s_phaserfuse = 2; /* att: */ + shipp->s_repair = 30000; /* att: */ + shipp->s_letter = 'X'; + shipp->s_desig[0] = 'A'; + shipp->s_desig[1] = 'T'; + shipp->s_bitmap = ATT; + } + break; + case FLAGSHIP: + shipp->s_phaserdamage = 102; + shipp->s_torpspeed = 12; + shipp->s_maxspeed = 9; + shipp->s_maxfuel = 12500; + shipp->s_maxarmies = 6; + shipp->s_maxshield = 115; + shipp->s_maxdamage = 115; + shipp->s_maxwpntemp = 1000; + shipp->s_maxegntemp = 1500; + shipp->s_type = FLAGSHIP; + shipp->s_width = 20; + shipp->s_height = 20; + shipp->s_phaserfuse = 10; + shipp->s_repair = 118; + shipp->s_letter = 'f'; + shipp->s_desig[0] = 'F'; + shipp->s_desig[1] = 'L'; + shipp->s_bitmap = FLAGSHIP; + break; + case WARBASE: + shipp->s_phaserdamage = 125; + shipp->s_torpspeed = 15; + shipp->s_maxspeed = 3; + shipp->s_maxfuel = 50000; + shipp->s_maxarmies = 0; + shipp->s_maxshield = 250; + shipp->s_maxdamage = 500; + shipp->s_maxwpntemp = 1500; + shipp->s_maxegntemp = 1000; + shipp->s_type = WARBASE; + shipp->s_width = 20; + shipp->s_height = 20; + shipp->s_phaserfuse = 5; + shipp->s_repair = 170; + shipp->s_letter = 'w'; + shipp->s_desig[0] = 'W'; + shipp->s_desig[1] = 'B'; + shipp->s_bitmap = WARBASE; + break; + case LIGHTCRUISER: + shipp->s_phaserdamage = 90; + shipp->s_torpspeed = 13; + shipp->s_maxspeed = 10; + shipp->s_maxfuel = 8500; + shipp->s_maxarmies = 3; + shipp->s_maxshield = 95; + shipp->s_maxdamage = 90; + shipp->s_maxwpntemp = 1000; + shipp->s_maxegntemp = 1500; + shipp->s_type = LIGHTCRUISER; + shipp->s_width = 20; + shipp->s_height = 20; + shipp->s_phaserfuse = 10; + shipp->s_repair = 80; + shipp->s_letter = 'l'; + shipp->s_desig[0] = 'C'; + shipp->s_desig[1] = 'L'; + shipp->s_bitmap = LIGHTCRUISER; + break; + case CARRIER: + shipp->s_phaserdamage = 95; + shipp->s_torpspeed = 13; + shipp->s_maxspeed = 9; + shipp->s_maxfuel = 15000; + shipp->s_maxarmies = 3; + shipp->s_maxshield = 120; + shipp->s_maxdamage = 150; + shipp->s_maxwpntemp = 1000; + shipp->s_maxegntemp = 1500; + shipp->s_type = CARRIER; + shipp->s_width = 20; + shipp->s_height = 20; + shipp->s_phaserfuse = 6; + shipp->s_repair = 105; + shipp->s_letter = 'v'; + shipp->s_desig[0] = 'C'; + shipp->s_desig[1] = 'V'; + shipp->s_bitmap = CARRIER; + break; + case UTILITY: + shipp->s_phaserdamage = 80; + shipp->s_torpspeed = 15; + shipp->s_maxspeed = 7; + shipp->s_maxfuel = 16000; + shipp->s_maxarmies = 12; + shipp->s_maxshield = 120; + shipp->s_maxdamage = 220; + shipp->s_maxwpntemp = 1000; + shipp->s_maxegntemp = 1800; + shipp->s_type = UTILITY; + shipp->s_width = 20; + shipp->s_height = 20; + shipp->s_phaserfuse = 8; + shipp->s_repair = 120; + shipp->s_letter = 'u'; + shipp->s_desig[0] = 'U'; + shipp->s_desig[1] = 'T'; + shipp->s_bitmap = UTILITY; + break; + case PATROL: + shipp->s_phaserdamage = 50; + shipp->s_torpspeed = 15; + shipp->s_maxspeed = 13; + shipp->s_maxfuel = 4000; + shipp->s_maxarmies = 1; + shipp->s_maxshield = 50; + shipp->s_maxdamage = 40; + shipp->s_maxwpntemp = 1000; + shipp->s_maxegntemp = 1500; + shipp->s_type = PATROL; + shipp->s_width = 20; + shipp->s_height = 20; + shipp->s_phaserfuse = 8; + shipp->s_repair = 50; + shipp->s_letter = 'p'; + shipp->s_desig[0] = 'P'; + shipp->s_desig[1] = 'T'; + shipp->s_bitmap = PATROL; + break; + } } Index: newwin.c =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/src/newwin.c,v retrieving revision 1.73 retrieving revision 1.74 diff -u -d -r1.73 -r1.74 --- newwin.c 16 Apr 2008 02:57:09 -0000 1.73 +++ newwin.c 18 Apr 2008 03:42:37 -0000 1.74 @@ -916,7 +916,7 @@ { if (messageKeyOnly && messageon == 0) { - if (mystats->st_keymap[(event->key)-32] != 109) /* Not a message key (Key109)*/ + if (myship->s_keymap[(event->key)-32] != 109) /* Not a message key (Key109)*/ return; else /* It is a message key, allow them to start a message */ Key109(); @@ -1585,6 +1585,7 @@ entrywindow (int *team, int *s_type) { + struct shiplist *shipscan; int typeok = 0, i = 0; time_t startTime; W_Event event; @@ -1747,79 +1748,21 @@ if (!W_EventsPending ()) continue; W_NextEvent (&event); - typeok = 1; + typeok = 0; switch ((int) event.type) { case W_EV_KEY: - switch (event.key) + shipscan = shiptypes; + while (shipscan) { + if (shipscan->ship->s_letter == event.key) { + *s_type = shipscan->ship->s_type; + typeok = 1; + break; + } + shipscan = shipscan->next; + } + if (event.key == ' ') { - case 's': - *s_type = SCOUT; - break; - case 'd': - *s_type = DESTROYER; - break; - case 'c': - *s_type = CRUISER; - break; - case 'b': - *s_type = BATTLESHIP; - break; - case 'g': - *s_type = SGALAXY; - break; - case '*': - *s_type = ATT; - break; - case 'a': - *s_type = ASSAULT; - break; - case 'o': - *s_type = STARBASE; - break; - case 'j': - if (paradise) - *s_type = JUMPSHIP; - else - typeok = 0; - break; - case 'f': - if (paradise) - *s_type = FLAGSHIP; - else - typeok = 0; - break; - case 'w': - if (paradise) - *s_type = WARBASE; - else - typeok = 0; - break; - case 'l': - if (paradise) - *s_type = LIGHTCRUISER; - else - typeok = 0; - break; - case 'v': - if (paradise) - *s_type = CARRIER; - else - typeok = 0; - break; - case 'u': - if (paradise) - *s_type = UTILITY; - else - typeok = 0; - break; - case 'p': - if (paradise) - *s_type = PATROL; - else - typeok = 0; - break; - case ' ': switch (me->p_team) { case FED: @@ -1838,9 +1781,6 @@ break; } break; - default: - typeok = 0; - break; } if (event.Window == w) { Index: input.c =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/src/input.c,v retrieving revision 1.44 retrieving revision 1.45 diff -u -d -r1.44 -r1.45 --- input.c 16 Apr 2008 00:08:16 -0000 1.44 +++ input.c 18 Apr 2008 03:42:37 -0000 1.45 @@ -440,32 +440,18 @@ return (unsigned char) (c - 96); } - -/* Defined in defaults.c */ -extern struct shipdef *myshipdef; - /******************************************************************************/ -/*** initkeymap() ***/ +/*** initkeymap() - sets up default keymaps and buttonmaps, then builds the + ship specific versions ***/ /******************************************************************************/ void initkeymap (void) { + int j; unsigned char *str; - /* in the future let me strongly recommed we move keymap * completely - * outside of the stats structure. - jn */ - - if ((str = myshipdef->keymap) != NULL) - { - while (*str != '\0' && *(str + 1) != '\0') - { - if (*str >= 32 && *str < 128) - { - mystats->st_keymap[*str - 32] = *(str + 1); - } - str += 2; - } - } + if ((str = (unsigned char *) stringDefault ("keymap")) != NULL) + keymapAdd(str, default_keymap); /* See if we can get macroKey to work. What a hack -SAC */ if ((str = (unsigned char *) stringDefault ("macroKey")) != NULL) @@ -476,36 +462,22 @@ { /* This is a little pointless, but it'll preform as per * the documentation */ - mystats->st_keymap[*str - 32] = 'X'; + default_keymap[*str - 32] = 'X'; } else if (!strcmpi (str, "TAB")) { p = "^i"; - mystats->st_keymap[getctrlkey (&p) - 32] = 'X'; + default_keymap[getctrlkey (&p) - 32] = 'X'; } else if (!strcmpi (str, "ESC")) { p = "^["; - mystats->st_keymap[getctrlkey (&p) - 32] = 'X'; + default_keymap[getctrlkey (&p) - 32] = 'X'; } } - if ((str = myshipdef->ckeymap) != NULL) - { - unsigned char c1, c2; - - while (*str != '\0') - { - - if (*str >= 32 && *str < MAXASCII) - { - c1 = (unsigned char) (getctrlkey (&str) - 32); - c2 = getctrlkey (&str); - mystats->st_keymap[c1] = c2; - } - - } - } + if ((str = (unsigned char *) stringDefault ("ckeymap")) != NULL) + ckeymapAdd(str, default_keymap); #ifdef MOUSE_AS_SHIFT if ((str = (unsigned char *) stringDefault ("b1keymap")) != NULL) @@ -515,7 +487,7 @@ { if (*str >= 32 && *str < 176) { - mystats->st_keymap[*str - 32 + 192] = *(str + 1); + default_keymap[*str - 32 + 192] = *(str + 1); } str += 2; } @@ -528,7 +500,7 @@ { if (*str >= 32 && *str < 176) { - mystats->st_keymap[*str - 32 + 288] = *(str + 1); + default_keymap[*str - 32 + 288] = *(str + 1); } str += 2; } @@ -541,7 +513,7 @@ { if (*str >= 32 && *str < 176) { - mystats->st_keymap[*str - 32 + 384] = *(str + 1); + default_keymap[*str - 32 + 384] = *(str + 1); } str += 2; } @@ -554,7 +526,7 @@ { if (*str >= 32 && *str < 176) { - mystats->st_keymap[*str - 32 + 480] = *(str + 1); + default_keymap[*str - 32 + 480] = *(str + 1); } str += 2; } @@ -567,7 +539,7 @@ { if (*str >= 32 && *str < 176) { - mystats->st_keymap[*str - 32 + 576] = *(str + 1); + default_keymap[*str - 32 + 576] = *(str + 1); } str += 2; } @@ -576,93 +548,160 @@ #endif /* note: not stored on server */ - if ((str = myshipdef->buttonmap) != NULL) + if ((str = (unsigned char *) stringDefault ("buttonmap")) != NULL) + buttonmapAdd(str, default_buttonmap); + + /* Build ship specific keymaps */ + for (j = 0; j < nshiptypes; j++) + buildShipKeymap(getship(j)); +} + +void +keymapAdd(char *str, char *kmap) +{ + while (*str != '\0' && *(str + 1) != '\0') { - while (*str != '\0' && *(str + 1) != '\0') + if (*str >= 32 && *str < 128) + { + kmap[*str - 32] = *(str + 1); + } + str += 2; + } +} + +void +ckeymapAdd(char *cstr, char *kmap) +{ + unsigned char c1, c2; + + while (*cstr != '\0') + { + if (*cstr >= 32 && *cstr < MAXASCII) + { + c1 = (unsigned char) (getctrlkey (&cstr) - 32); + c2 = getctrlkey (&cstr); + kmap[c1] = c2; + } + } +} + +void +buttonmapAdd(char *str, char *bmap) +{ + while (*str != '\0' && *(str + 1) != '\0') + { + switch (*str++) { - switch (*str++) - { case '1': - buttonmap[1] = getctrlkey (&str); + bmap[1] = getctrlkey (&str); break; case '2': - buttonmap[2] = getctrlkey (&str); + bmap[2] = getctrlkey (&str); break; case '3': - buttonmap[3] = getctrlkey (&str); + bmap[3] = getctrlkey (&str); break; /* XButton 1 */ case '4': - buttonmap[4] = getctrlkey (&str); + bmap[4] = getctrlkey (&str); break; /* XButton 2 */ case '5': - buttonmap[5] = getctrlkey (&str); + bmap[5] = getctrlkey (&str); break; /* Wheel Up */ case '6': - buttonmap[6] = getctrlkey (&str); + bmap[6] = getctrlkey (&str); break; /* Wheel Down */ case '7': - buttonmap[7] = getctrlkey (&str); + bmap[7] = getctrlkey (&str); break; #ifdef SHIFTED_MOUSE case '8': - buttonmap[8] = getctrlkey (&str); + bmap[8] = getctrlkey (&str); break; case '9': - buttonmap[9] = getctrlkey (&str); + bmap[9] = getctrlkey (&str); break; case 'a': - buttonmap[10] = getctrlkey (&str); + bmap[10] = getctrlkey (&str); break; case 'b': - buttonmap[11] = getctrlkey (&str); + bmap[11] = getctrlkey (&str); break; case 'c': - buttonmap[12] = getctrlkey (&str); + bmap[12] = getctrlkey (&str); break; case 'd': - buttonmap[13] = getctrlkey (&str); + bmap[13] = getctrlkey (&str); break; case 'e': - buttonmap[14] = getctrlkey (&str); + bmap[14] = getctrlkey (&str); break; case 'f': - buttonmap[15] = getctrlkey (&str); + bmap[15] = getctrlkey (&str); break; case 'g': - buttonmap[16] = getctrlkey (&str); + bmap[16] = getctrlkey (&str); break; case 'h': - buttonmap[17] = getctrlkey (&str); + bmap[17] = getctrlkey (&str); break; case 'i': - buttonmap[18] = getctrlkey (&str); + bmap[18] = getctrlkey (&str); break; case 'j': - buttonmap[19] = getctrlkey (&str); + bmap[19] = getctrlkey (&str); break; case 'k': - buttonmap[20] = getctrlkey (&str); + bmap[20] = getctrlkey (&str); break; case 'l': - buttonmap[21] = getctrlkey (&str); + bmap[21] = getctrlkey (&str); break; case 'm': - buttonmap[22] = getctrlkey (&str); + bmap[22] = getctrlkey (&str); break; #endif /* SHIFTED_MOUSE */ default: LineToConsole ("%c ignored in buttonmap\n", *(str - 1)); break; - } } } +} + +/******************************************************************************/ +/*** buildShipKeymap() - initializes the ship specific keymaps and + buttonmaps, then searches defaults file for the ship specific entries */ +/******************************************************************************/ +void +buildShipKeymap(struct ship *shipp) +{ + char keybuf[40], ckeybuf[40], buttonbuf[40]; + char *pek; + +#ifdef MOUSE_AS_SHIFT + memcpy(shipp->s_keymap, default_keymap, 672); +#else + memcpy(shipp->s_keymap, default_keymap, 96); +#endif + memcpy(shipp->s_buttonmap, default_buttonmap, 23); + + sprintf(keybuf, "keymap-%c%c", shipp->s_desig[0], shipp->s_desig[1]); + sprintf(ckeybuf, "ckeymap-%c%c", shipp->s_desig[0], shipp->s_desig[1]); + sprintf(buttonbuf, "buttonmap-%c%c", shipp->s_desig[0], shipp->s_desig[1]); + + if (pek = stringDefault (keybuf)) + keymapAdd(pek, shipp->s_keymap); + if (pek = stringDefault (ckeybuf)) + ckeymapAdd(pek, shipp->s_keymap); + + if (pek = stringDefault (buttonbuf)) + buttonmapAdd(pek, shipp->s_buttonmap); } /******************************************************************************/ @@ -1245,105 +1284,25 @@ } } - - /* this may represent a considerable efficiency improvement */ - /* removes the need for an INDEX and a couple tests */ if (localflags & (PFREFIT)) { - switch (key) - { - case 'c': - sendRefitReq (CRUISER); - localflags &= ~(PFREFIT); - return; - break; - case 'o': - sendRefitReq (STARBASE); - localflags &= ~(PFREFIT); - return; - break; - case 'a': - sendRefitReq (ASSAULT); - localflags &= ~(PFREFIT); - return; - break; - case 'd': - sendRefitReq (DESTROYER); - localflags &= ~(PFREFIT); - return; - break; - case 'g': - sendRefitReq (SGALAXY); - localflags &= ~(PFREFIT); - return; - break; - case 'b': - sendRefitReq (BATTLESHIP); - localflags &= ~(PFREFIT); - return; - break; - case 's': - sendRefitReq (SCOUT); - localflags &= ~(PFREFIT); - return; - break; - case '*': - sendRefitReq (ATT); - localflags &= ~(PFREFIT); - return; - break; - case 'j': - if (paradise) - sendRefitReq (JUMPSHIP); - localflags &= ~(PFREFIT); - return; - break; - case 'f': - if (paradise) - sendRefitReq (FLAGSHIP); - localflags &= ~(PFREFIT); - return; - break; - case 'w': - if (paradise) - sendRefitReq (WARBASE); - localflags &= ~(PFREFIT); - return; - break; - case 'l': - if (paradise) - sendRefitReq (LIGHTCRUISER); - localflags &= ~(PFREFIT); - return; - break; - case 'v': - if (paradise) - sendRefitReq (CARRIER); - localflags &= ~(PFREFIT); - return; - break; - case 'u': - if (paradise) - sendRefitReq (UTILITY); - localflags &= ~(PFREFIT); - return; - break; - case 'p': - if (paradise) - sendRefitReq (PATROL); - localflags &= ~(PFREFIT); - return; - break; - default: - localflags &= ~(PFREFIT); - return; - break; + struct shiplist *temp; + temp = shiptypes; + while (temp) { + if (temp->ship->s_letter == key) { + sendRefitReq(temp->ship->s_type); + localflags &= ~(PFREFIT); + return; + } + temp = temp->next; } + localflags &= ~(PFREFIT); + return; } if (key >= 32 && key < MAXKEY) { - key = mystats->st_keymap[key - 32]; + key = myship->s_keymap[key - 32]; } else { @@ -1534,7 +1493,7 @@ break; } - key = mystats->st_keymap[key - 32 + offset]; + key = myship->s_keymap[key - 32 + offset]; } } @@ -1659,9 +1618,9 @@ if (data->key >= W_LBUTTON && data->key <= W_WHEELDOWN) #endif { - if (buttonmap[data->key] != '\0') + if (myship->s_buttonmap[data->key] != '\0') { - data->key = buttonmap[data->key]; + data->key = myship->s_buttonmap[data->key]; keyaction (data); return; } Index: enter.c =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/src/enter.c,v retrieving revision 1.16 retrieving revision 1.17 diff -u -d -r1.16 -r1.17 --- enter.c 16 Apr 2008 00:08:11 -0000 1.16 +++ enter.c 18 Apr 2008 03:42:36 -0000 1.17 @@ -48,6 +48,7 @@ { /* Used to be struct memory universe, but leaving room for flexible struct sizes is better, and necessary for paradise - BB */ + initialize_shiptypes(); initialize_players(); initialize_torps(); initialize_plasmas(); Index: cowmain.c =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/src/cowmain.c,v retrieving revision 1.37 retrieving revision 1.38 diff -u -d -r1.37 -r1.38 --- cowmain.c 16 Apr 2008 00:08:06 -0000 1.37 +++ cowmain.c 18 Apr 2008 03:42:36 -0000 1.38 @@ -1001,7 +1001,8 @@ #endif /* RWATCH */ sendVersion (); - getship (myship, myship->s_type); + myship = getship(myship->s_type); + currentship = myship->s_type; #ifdef BRMH redrawall = 2; Index: getname.c =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/src/getname.c,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- getname.c 6 Apr 2008 23:29:56 -0000 1.10 +++ getname.c 18 Apr 2008 03:42:37 -0000 1.11 @@ -420,18 +420,18 @@ // Reset the keymap for our player record for (j = 0; j < 95; j++) { - mystats->st_keymap[j] = (unsigned char) (j + 32); - mystats->st_keymap[j + 96] = (unsigned char) (j + 32 + 96); + myship->s_keymap[j] = (unsigned char) (j + 32); + myship->s_keymap[j + 96] = (unsigned char) (j + 32 + 96); #ifdef MOUSE_AS_SHIFT - mystats->st_keymap[j + 192] = (unsigned char) (j + 32); - mystats->st_keymap[j + 288] = (unsigned char) (j + 32); - mystats->st_keymap[j + 384] = (unsigned char) (j + 32); - mystats->st_keymap[j + 480] = (unsigned char) (j + 32); - mystats->st_keymap[j + 576] = (unsigned char) (j + 32); + myship->s_keymap[j + 192] = (unsigned char) (j + 32); + myship->s_keymap[j + 288] = (unsigned char) (j + 32); + myship->s_keymap[j + 384] = (unsigned char) (j + 32); + myship->s_keymap[j + 480] = (unsigned char) (j + 32); + myship->s_keymap[j + 576] = (unsigned char) (j + 32); #endif } - mystats->st_keymap[95] = 0; + myship->s_keymap[95] = 0; mystats->st_tticks = 1; mystats->st_flags = ST_MAPMODE + ST_NAMEMODE + ST_SHOWSHIELDS + ST_KEEPPEACE + ST_SHOWLOCAL * 2 + ST_SHOWGLOBAL * 2; Index: playback.c =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/src/playback.c,v retrieving revision 1.24 retrieving revision 1.25 diff -u -d -r1.24 -r1.25 --- playback.c 16 Apr 2008 00:08:20 -0000 1.24 +++ playback.c 18 Apr 2008 03:42:37 -0000 1.25 @@ -221,7 +221,7 @@ mystats = &(me->p_stats); me->p_x = me->p_y = 50000; - getship (myship, CRUISER); + myship = getship(CRUISER); shipchange (CRUISER); displayme = me; packetsme = me; @@ -243,18 +243,18 @@ mystats->st_tticks = 1; for (i = 0; i < 95; i++) { - mystats->st_keymap[i] = (unsigned char) (i + 32); - mystats->st_keymap[i + 96] = (unsigned char) (i + 32 + 96); + myship->s_keymap[i] = (unsigned char) (i + 32); + myship->s_keymap[i + 96] = (unsigned char) (i + 32 + 96); #ifdef MOUSE_AS_SHIFT - mystats->st_keymap[i + 192] = (unsigned char) (i + 32); - mystats->st_keymap[i + 288] = (unsigned char) (i + 32); - mystats->st_keymap[i + 384] = (unsigned char) (i + 32); - mystats->st_keymap[i + 480] = (unsigned char) (i + 32); - mystats->st_keymap[i + 576] = (unsigned char) (i + 32); + myship->s_keymap[i + 192] = (unsigned char) (i + 32); + myship->s_keymap[i + 288] = (unsigned char) (i + 32); + myship->s_keymap[i + 384] = (unsigned char) (i + 32); + myship->s_keymap[i + 480] = (unsigned char) (i + 32); + myship->s_keymap[i + 576] = (unsigned char) (i + 32); #endif } - mystats->st_keymap[95] = 0; + myship->s_keymap[95] = 0; mystats->st_flags = ST_MAPMODE + ST_NAMEMODE + ST_SHOWSHIELDS + ST_KEEPPEACE + ST_SHOWLOCAL * 2 + ST_SHOWGLOBAL * 2; @@ -327,7 +327,7 @@ redrawall = 1; #endif - getship (myship, myship->s_type); + myship = getship (myship->s_type); shipchange (myship->s_type); enter (); calibrate_stats (); Index: socket.c =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/src/socket.c,v retrieving revision 1.42 retrieving revision 1.43 diff -u -d -r1.42 -r1.43 --- socket.c 16 Apr 2008 00:08:22 -0000 1.42 +++ socket.c 18 Apr 2008 03:42:37 -0000 1.43 @@ -2274,7 +2274,7 @@ ST_NAMEMODE * showPlanetNames + ST_SHOWSHIELDS + /* always on */ ST_KEEPPEACE * keepPeace + ST_SHOWLOCAL * 1 + /* This client no longer supports */ ST_SHOWGLOBAL * 1); /* showlocal and showgalactic, set to 1 */ - MCOPY (mystats->st_keymap, optPacket.keymap, 96); + MCOPY (myship->s_keymap, optPacket.keymap, 96); sendServerPacket ((struct player_spacket *) &optPacket); } @@ -2552,13 +2552,14 @@ redrawall = 1; /* Update the map if I * change teams */ } - - getship (&pl->p_ship, packet->shiptype); + pl->p_ship = *getship(packet->shiptype); pl->p_mapchars[1] = shipnos[pl->p_no]; + if (packet->pnum == me->p_no && currentship != packet->shiptype) + currentship = packet->shiptype; - - if (me == pl && lastship != me->p_ship.s_type) + if (me == pl && lastship != currentship) { + lastship = currentship; redrawTstats (); calibrate_stats (); redrawStats (); /* TSH */ @@ -2704,7 +2705,7 @@ shipvals[stype].s_desig[2] = packet->s_desig2; shipvals[stype].s_bitmap = ntohs (packet->s_bitmap); /* strncpy(shipvals[stype].s_name, packet->s_name, 16); */ - getship (myship, myship->s_type); + myship = getship (myship->s_type); redrawTstats (); /* Redraw dashboard */ calibrate_stats (); /* Redefine colored statwin sliders */ Index: data.c =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/src/data.c,v retrieving revision 1.107 retrieving revision 1.108 diff -u -d -r1.107 -r1.108 --- data.c 16 Apr 2008 02:57:08 -0000 1.107 +++ data.c 18 Apr 2008 03:42:36 -0000 1.108 @@ -28,6 +28,7 @@ struct thingy *thingies; struct t_unit *terrainInfo; struct ship *myship; +struct shiplist *shiptypes = NULL; struct stats *mystats; struct planet *planets; struct phaser *phasers; @@ -104,7 +105,13 @@ int tryUdp = 1; int tryUdp1 = 1; struct plupdate pl_update[MAXPLANETS]; -char buttonmap[23] = { '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0' }; +#ifdef MOUSE_AS_SHIFT +unsigned char default_keymap[672] = ""; +#else +unsigned char default_keymap[96] = ""; +#endif +unsigned char default_buttonmap[23] = ""; +int currentship; int lastm = 0; time_t delay = 0; /* time stamp for decaring war */ time_t rdelay = 0; /* time stamp for refitting */ Index: helpwin.c =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/src/helpwin.c,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -r1.13 -r1.14 --- helpwin.c 16 Apr 2008 00:08:16 -0000 1.13 +++ helpwin.c 18 Apr 2008 03:42:37 -0000 1.14 @@ -288,7 +288,7 @@ if (message_number != -1) { /* And now we will remap the key in that message */ - mystats->st_keymap[(data->key) - 32] = help_message[message_number][0]; + myship->s_keymap[(data->key) - 32] = help_message[message_number][0]; /* Finally we want to update window */ fillhelp (); @@ -355,7 +355,7 @@ for (i = 0; i < 96; i++) { - if (mystats->st_keymap[i] != key) + if (myship->s_keymap[i] != key) continue; if (i + 32 == key) { Index: option.c =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/src/option.c,v retrieving revision 1.53 retrieving revision 1.54 diff -u -d -r1.53 -r1.54 --- option.c 16 Apr 2008 00:08:18 -0000 1.53 +++ option.c 18 Apr 2008 03:42:37 -0000 1.54 @@ -1041,7 +1041,7 @@ { if (*(str + 1) == '\0') break; - mystats->st_keymap[*str - 32] = *(str + 1); + myship->s_keymap[*str - 32] = *(str + 1); } if (*(str + 1) == '\0') break; @@ -1055,76 +1055,76 @@ switch (*str++) { case '1': - buttonmap[1] = getctrlkey (&str); + myship->s_buttonmap[1] = getctrlkey (&str); break; case '2': - buttonmap[2] = getctrlkey (&str); + myship->s_buttonmap[2] = getctrlkey (&str); break; case '3': - buttonmap[3] = getctrlkey (&str); + myship->s_buttonmap[3] = getctrlkey (&str); break; /* XButton 1 */ case '4': - buttonmap[4] = getctrlkey (&str); + myship->s_buttonmap[4] = getctrlkey (&str); break; /* XButton 2 */ case '5': - buttonmap[5] = getctrlkey (&str); + myship->s_buttonmap[5] = getctrlkey (&str); break; /* Wheel Up */ case '6': - buttonmap[6] = getctrlkey (&str); + myship->s_buttonmap[6] = getctrlkey (&str); break; /* Wheel Down */ case '7': - buttonmap[7] = getctrlkey (&str); + myship->s_buttonmap[7] = getctrlkey (&str); break; #ifdef SHIFTED_MOUSE case '8': - buttonmap[8] = getctrlkey (&str); + myship->s_buttonmap[8] = getctrlkey (&str); break; case '9': - buttonmap[9] = getctrlkey (&str); + myship->s_buttonmap[9] = getctrlkey (&str); break; case 'a': - buttonmap[10] = getctrlkey (&str); + myship->s_buttonmap[10] = getctrlkey (&str); break; case 'b': - buttonmap[11] = getctrlkey (&str); + myship->s_buttonmap[11] = getctrlkey (&str); break; case 'c': - buttonmap[12] = getctrlkey (&str); + myship->s_buttonmap[12] = getctrlkey (&str); break; case 'd': - buttonmap[13] = getctrlkey (&str); + myship->s_buttonmap[13] = getctrlkey (&str); break; case 'e': - buttonmap[14] = getctrlkey (&str); + myship->s_buttonmap[14] = getctrlkey (&str); break; case 'f': - buttonmap[15] = getctrlkey (&str); + myship->s_buttonmap[15] = getctrlkey (&str); break; case 'g': - buttonmap[16] = getctrlkey (&str); + myship->s_buttonmap[16] = getctrlkey (&str); break; case 'h': - buttonmap[17] = getctrlkey (&str); + myship->s_buttonmap[17] = getctrlkey (&str); break; case 'i': - buttonmap[18] = getctrlkey (&str); + myship->s_buttonmap[18] = getctrlkey (&str); break; case 'j': - buttonmap[19] = getctrlkey (&str); + myship->s_buttonmap[19] = getctrlkey (&str); break; case 'k': - buttonmap[20] = getctrlkey (&str); + myship->s_buttonmap[20] = getctrlkey (&str); break; case 'l': - buttonmap[21] = getctrlkey (&str); + myship->s_buttonmap[21] = getctrlkey (&str); break; case 'm': - buttonmap[22] = getctrlkey (&str); + myship->s_buttonmap[22] = getctrlkey (&str); break; #endif /* SHIFTED_MOUSE */ Index: defaults.c =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/src/defaults.c,v retrieving revision 1.90 retrieving revision 1.91 diff -u -d -r1.90 -r1.91 --- defaults.c 16 Apr 2008 02:57:08 -0000 1.90 +++ defaults.c 18 Apr 2008 03:42:36 -0000 1.91 @@ -21,44 +21,6 @@ #include "proto.h" #include "version.h" -#ifdef PARADISE -#define DEFAULTSHIP NUM_TYPES_PARADISE -struct shipdef shipdefaults[NUM_TYPES_PARADISE + 1] = { - {"sc", NULL, NULL, NULL, NULL}, - {"dd", NULL, NULL, NULL, NULL}, - {"ca", NULL, NULL, NULL, NULL}, - {"bb", NULL, NULL, NULL, NULL}, - {"as", NULL, NULL, NULL, NULL}, - {"sb", NULL, NULL, NULL, NULL}, - {"att", NULL, NULL, NULL, NULL}, - {"js", NULL, NULL, NULL, NULL}, - {"fl", NULL, NULL, NULL, NULL}, - {"wb", NULL, NULL, NULL, NULL}, - {"cl", NULL, NULL, NULL, NULL}, - {"cv", NULL, NULL, NULL, NULL}, - {"ut", NULL, NULL, NULL, NULL}, - {"pt", NULL, NULL, NULL, NULL}, - {"pu", NULL, NULL, NULL, NULL}, - {"default", NULL, NULL, NULL, NULL} -}; -#else -#define DEFAULTSHIP NUM_TYPES_BRONCO -struct shipdef shipdefaults[NUM_TYPES_BRONCO + 1] = { - {"sc", NULL, NULL, NULL, NULL}, - {"dd", NULL, NULL, NULL, NULL}, - {"ca", NULL, NULL, NULL, NULL}, - {"bb", NULL, NULL, NULL, NULL}, - {"as", NULL, NULL, NULL, NULL}, - {"sb", NULL, NULL, NULL, NULL}, - {"ga", NULL, NULL, NULL, NULL}, - {"att", NULL, NULL, NULL, NULL}, - {"default", NULL, NULL, NULL, NULL} -}; -#endif - -int myshiptype = DEFAULTSHIP; -struct shipdef *myshipdef = &shipdefaults[DEFAULTSHIP]; - struct save_options save_options[] = { {"agriCAPS", &agriCAPS, RC_BOOL, { @@ -1124,8 +1086,6 @@ /* sizeof doesn't work if it isn't in the same source file, shoot me */ MCOPY (dist_defaults, dist_prefered, sizedist); - getshipdefaults (); - if (!deffile) if (findDefaults (deffile, file)) deffile = file; @@ -1750,7 +1710,6 @@ { char *pek; char tmp[100]; - int i; if (strlen (pigcall) == 0) sprintf (pigcall, "Netrek XP 2009 (%s) - the smarter netrek eXPerience!", mvers); @@ -1988,42 +1947,6 @@ tts_ypos = intDefault("tts_ypos", TWINSIDE / 2 - 16); #endif /* BEEPLITE */ - shipdefaults[DEFAULTSHIP].keymap = (unsigned char *) stringDefault ("keymap"); - shipdefaults[DEFAULTSHIP].buttonmap = (unsigned char *) stringDefault ("buttonmap"); - shipdefaults[DEFAULTSHIP].ckeymap = (unsigned char *) stringDefault ("ckeymap"); - - for (i = DEFAULTSHIP; i >= 0; i--) - { - STRNCPY (tmp, "rcfile-", 8); - strcat (tmp, shipdefaults[i].name); - if (pek = stringDefault (tmp)) - shipdefaults[i].rcfile = pek; - else - shipdefaults[i].rcfile = shipdefaults[DEFAULTSHIP].rcfile; - - STRNCPY (tmp, "keymap-", 8); - strcat (tmp, shipdefaults[i].name); - if (pek = stringDefault (tmp)) - shipdefaults[i].keymap = (unsigned char *) pek; - else - shipdefaults[i].keymap = shipdefaults[DEFAULTSHIP].keymap; - - STRNCPY (tmp, "ckeymap-", 9); - strcat (tmp, shipdefaults[i].name); - if (pek = stringDefault (tmp)) - shipdefaults[i].ckeymap = (unsigned char *) pek; - else - shipdefaults[i].ckeymap = shipdefaults[DEFAULTSHIP].ckeymap; - - STRNCPY (tmp, "buttonmap-", 11); - strcat (tmp, shipdefaults[i].name); - if (pek = stringDefault (tmp)) - shipdefaults[i].buttonmap = (unsigned char *) pek; - else - shipdefaults[i].buttonmap = shipdefaults[DEFAULTSHIP].buttonmap; - } - myshipdef = &shipdefaults[myshiptype]; - /* Let's check whether windows settings had changed */ /* Read in defaults was moved before window generation, thus this code is obsolete and not worth fixing - BB 04/07 */ @@ -2078,7 +2001,7 @@ void shipchange (int type) { - if (type == myshiptype) +/* if (type == myshiptype) return; myshiptype = type; myshipdef = &shipdefaults[type]; @@ -2087,10 +2010,9 @@ initDefaults (shipdefaults[type].rcfile); resetdefaults (); } - initkeymap (); + initkeymap ();*/ } - - + /* Generally useful function that searches for a file in the current and home directories, also the executable directory on Win32 */ @@ -2270,13 +2192,13 @@ for (c = 1; c < 95; c++) { - if (c + 32 != mystats->st_keymap[c]) + if (c + 32 != default_keymap[c]) { - if (mystats->st_keymap[c] != 'X' && - (mystats->st_keymap[c] >= 32 && - mystats->st_keymap[c] < 127)) + if (default_keymap[c] != 'X' && + (default_keymap[c] >= 32 && + default_keymap[c] < 127)) { - sprintf (str1, "%c%c", c + 32, mystats->st_keymap[c]); + sprintf (str1, "%c%c", c + 32, default_keymap[c]); strcat (str, str1); } else @@ -2284,9 +2206,9 @@ } } // space time - if (mystats->st_keymap[0] != 32) + if (default_keymap[0] != 32) { - sprintf (str1, " %c", mystats->st_keymap[0]); + sprintf (str1, " %c", default_keymap[0]); strcat (str, str1); } if (saveBig && strlen (str) != 0) @@ -2331,13 +2253,13 @@ for (i = W_LBUTTON; i <= W_WHEELDOWN; i++) #endif { - if (buttonmap[i] != 0) + if (default_buttonmap[i] != 0) { - c = getkeyfromctrl (buttonmap[i]); + c = getkeyfromctrl (default_buttonmap[i]); if (c == '^') sprintf (str, "%c^^", getcharfromdec (i)); else - sprintf (str, "%c%c", getcharfromdec (i), getkeyfromctrl (buttonmap[i])); + sprintf (str, "%c%c", getcharfromdec (i), getkeyfromctrl (default_buttonmap[i])); strcat (str1, str); } } @@ -2368,11 +2290,11 @@ // macroKey if (strlen (macroKey) == 0) { - if (mystats->st_keymap[169] == 'X') + if (default_keymap[169] == 'X') strcpy (macroKey, "TAB"); - else if (mystats->st_keymap[155] == 'X') + else if (default_keymap[155] == 'X') strcpy (macroKey, "ESC"); - else if (mystats->st_keymap[56] == 'X') + else if (default_keymap[56] == 'X') strcpy (macroKey, "X"); } @@ -3435,10 +3357,12 @@ fputs ("# button keymaps (b1keymap through b5keymap)\n", fp); } // Individual ship type settings - for (j = (paradise ? NUM_TYPES_PARADISE : NUM_TYPES_BRONCO); j >= 0; j--) + for (j = 0; j < nshiptypes; j++) { - STRNCPY (str1, "rcfile-", 8); - strcat (str1, shipdefaults[j].name); + struct ship *shipp; + + shipp = getship(j); + sprintf(str1, "rcfile-%c%c", shipp->s_desig[0], shipp->s_desig[1]); adefault = stringDefault (str1); if (adefault != NULL) { @@ -3446,9 +3370,7 @@ fputs (str, fp); } - - STRNCPY (str1, "keymap-", 8); - strcat (str1, shipdefaults[j].name); + sprintf(str1, "keymap-%c%c", shipp->s_desig[0], shipp->s_desig[1]); adefault = stringDefault (str1); if (adefault != NULL) { @@ -3456,8 +3378,7 @@ fputs (str, fp); } - STRNCPY (str1, "ckeymap-", 9); - strcat (str1, shipdefaults[j].name); + sprintf(str1, "ckeymap-%c%c", shipp->s_desig[0], shipp->s_desig[1]); adefault = stringDefault (str1); if (adefault != NULL) { @@ -3465,8 +3386,7 @@ fputs (str, fp); } - STRNCPY (str1, "buttonmap-", 11); - strcat (str1, shipdefaults[j].name); + sprintf(str1, "buttonmap-%c%c", shipp->s_desig[0], shipp->s_desig[1]); adefault = stringDefault (str1); if (adefault != NULL) { From modemhero at users.sourceforge.net Thu Apr 17 22:42:38 2008 From: modemhero at users.sourceforge.net (Bill Balcerski) Date: Fri, 18 Apr 2008 03:42:38 +0000 Subject: [netrek-cvs] client/netrekxp NetrekXP to do list.C, 1.162, 1.163 clientr.suo, 1.147, 1.148 Message-ID: <20080418034248.2F948B42A@smtpgrey-2.real-time.com> Update of /cvsroot/netrek/client/netrekxp In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv31222 Modified Files: NetrekXP to do list.C clientr.suo Log Message: First pass at creating a dynamic rather than static shiplist. Struct shiplist is a linked list of ships that contains all the ship info (fuel, hull, etc). This shiplist is updated by shipcap packet. Replaced old static shipvals struct. Struct ship now has entries for keymaps and buttonmaps - this info has been moved out of the stats struct. This eliminates the need for struct shipdef, which was just a static struct that held ship name and keymap/buttonmap strings. Much of the keymap/buttonmap handling had to be redone, as well as initialization of ships and keymaps. Still some bugs to work out, keymaps are not working right. Going to remove the invidivual rcfile for each ship - this feature isn't very useful, as you can already define ship specific keymaps and buttonmaps in a single rc file. This patch removed the last ifdef PARADISE so that config value is now set to defined for posterity purposes, but it doesn't do anything. Index: NetrekXP to do list.C =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/NetrekXP to do list.C,v retrieving revision 1.162 retrieving revision 1.163 diff -u -d -r1.162 -r1.163 --- NetrekXP to do list.C 16 Apr 2008 00:07:54 -0000 1.162 +++ NetrekXP to do list.C 18 Apr 2008 03:42:34 -0000 1.163 @@ -53,6 +53,8 @@ 14) Don't think there is gettarget support for astral bodies like nebulae and stars and black holes. Might be an issue with macros. 15) support variable # of ship types +16) add terrain feature packet +17) add POBSERV and PTQUEUE support Wish list: 1) Rewrite graphics engine using SDL Index: clientr.suo =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/clientr.suo,v retrieving revision 1.147 retrieving revision 1.148 diff -u -d -r1.147 -r1.148 Binary files /tmp/cvsKjLmBv and /tmp/cvsCkaWgO differ From modemhero at users.sourceforge.net Thu Apr 17 22:42:38 2008 From: modemhero at users.sourceforge.net (Bill Balcerski) Date: Fri, 18 Apr 2008 03:42:38 +0000 Subject: [netrek-cvs] client/netrekxp/include data.h, 1.98, 1.99 proto.h, 1.61, 1.62 struct.h, 1.26, 1.27 Message-ID: <20080418034247.EF5603B408F@smtpgrey-1.real-time.com> Update of /cvsroot/netrek/client/netrekxp/include In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv31222/include Modified Files: data.h proto.h struct.h Log Message: First pass at creating a dynamic rather than static shiplist. Struct shiplist is a linked list of ships that contains all the ship info (fuel, hull, etc). This shiplist is updated by shipcap packet. Replaced old static shipvals struct. Struct ship now has entries for keymaps and buttonmaps - this info has been moved out of the stats struct. This eliminates the need for struct shipdef, which was just a static struct that held ship name and keymap/buttonmap strings. Much of the keymap/buttonmap handling had to be redone, as well as initialization of ships and keymaps. Still some bugs to work out, keymaps are not working right. Going to remove the invidivual rcfile for each ship - this feature isn't very useful, as you can already define ship specific keymaps and buttonmaps in a single rc file. This patch removed the last ifdef PARADISE so that config value is now set to defined for posterity purposes, but it doesn't do anything. Index: data.h =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/include/data.h,v retrieving revision 1.98 retrieving revision 1.99 diff -u -d -r1.98 -r1.99 --- data.h 16 Apr 2008 02:57:07 -0000 1.98 +++ data.h 18 Apr 2008 03:42:36 -0000 1.99 @@ -41,6 +41,7 @@ extern struct thingy *thingies; extern struct t_unit *terrainInfo; extern struct ship *myship; +extern struct shiplist *shiptypes; extern struct stats *mystats; extern struct planet *planets; extern struct phaser *phasers; @@ -70,7 +71,13 @@ extern int udcounter; extern char *title; extern struct plupdate pl_update[]; -extern char buttonmap[]; +#ifdef MOUSE_AS_SHIFT +extern unsigned char default_keymap[672]; +#else +extern unsigned char default_keymap[96]; +#endif +extern unsigned char default_buttonmap[23]; +extern int currentship; extern int messpend; #ifdef XTRA_MESSAGE_UI extern int messageHUD; /* Show message being typed on the local display */ Index: struct.h =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/include/struct.h,v retrieving revision 1.26 retrieving revision 1.27 diff -u -d -r1.26 -r1.27 --- struct.h 16 Apr 2008 02:57:08 -0000 1.26 +++ struct.h 18 Apr 2008 03:42:36 -0000 1.27 @@ -237,22 +237,18 @@ #define PARADISE_SHIP_OFFSET 7 /* To make jumpship first entry in the paradise ship bitmap array */ #define NUM_TYPES_PARADISE 15 /* Typical total number of ships on a paradise server */ #define NUM_TYPES_BRONCO 8 /* Concrete total number of ships on a bronco server */ -#ifdef PARADISE -#define ATT 6 -#define JUMPSHIP 7 -#define SGALAXY 8 /* Not sure where to put this .. */ -#else -#define SGALAXY 6 -#define ATT 7 -#define JUMPSHIP 8 -#endif + +#define DEFAULT -1 #define SCOUT 0 #define DESTROYER 1 #define CRUISER 2 #define BATTLESHIP 3 #define ASSAULT 4 #define STARBASE 5 -#define FLAGSHIP 8 /* shares bitmap with galaxy class */ +#define ATT 6 /* paradise */ +#define SGALAXY 6 /* bronco */ +#define JUMPSHIP 7 /* can be ATT on bronco */ +#define FLAGSHIP 8 #define WARBASE 9 #define LIGHTCRUISER 10 #define CARRIER 11 @@ -260,6 +256,11 @@ #define PATROL 13 #define PUCK 14 +struct shiplist { + struct ship *ship; + struct shiplist *prev, *next; +}; + struct ship { short s_phaserdamage; @@ -281,6 +282,13 @@ /* char s_name[16]; */ char s_desig[2]; short s_bitmap; +#ifdef MOUSE_AS_SHIFT + unsigned char s_keymap[672]; /* keymap for this ship */ +#else + unsigned char s_keymap[96]; /* keymap for this ship */ +#endif + unsigned char s_buttonmap[23]; /* buttonmap for this ship */ + char *rcfile; /* pointer to ship specific rcfile */ }; struct stats @@ -305,12 +313,6 @@ LONG st_lastlogin; /* Last time this player was * played */ int st_flags; /* Misc option flags */ - -#ifdef MOUSE_AS_SHIFT - unsigned char st_keymap[672]; /* keymap for this player */ -#else - unsigned char st_keymap[96]; /* keymap for this player */ -#endif int st_rank; /* Ranking of the player */ }; @@ -837,15 +839,6 @@ #endif /* HOCKEY_LINES */ -struct shipdef -{ - char *name; - char *rcfile; - unsigned char *keymap; - unsigned char *buttonmap; - unsigned char *ckeymap; -}; - #ifdef TOOLS struct key_list { Index: proto.h =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/include/proto.h,v retrieving revision 1.61 retrieving revision 1.62 diff -u -d -r1.61 -r1.62 --- proto.h 16 Apr 2008 00:08:02 -0000 1.61 +++ proto.h 18 Apr 2008 03:42:36 -0000 1.62 @@ -219,9 +219,9 @@ /******************************************************************************/ /*** getship.c /******************************************************************************/ -void getshipdefaults (); -void getship (struct ship *shipp, - int s_type); +void initialize_shiptypes(); +void getshipdefaults (struct ship *shipp, int s_type); +struct ship * getship (int s_type); /******************************************************************************/ /*** helpwin.c @@ -255,6 +255,10 @@ unsigned char getctrlkey (unsigned char **s); unsigned char getkeyfromctrl (unsigned char c); void initkeymap (void); +void buildShipKeymap (struct ship *shipp); +void keymapAdd (char *str, char *kmap); +void ckeymapAdd (char *cstr, char *kmap); +void buttonmapAdd (char *str, char *bmap); void initinput (void); RETSIGTYPE detsetallow (int _dummy); void input (); From modemhero at users.sourceforge.net Sat Apr 19 11:23:04 2008 From: modemhero at users.sourceforge.net (Bill Balcerski) Date: Sat, 19 Apr 2008 16:23:04 +0000 Subject: [netrek-cvs] client/netrekxp/win32 config.h,1.20,1.21 Message-ID: <20080419162316.DDA22B42B@smtpgrey-2.real-time.com> Update of /cvsroot/netrek/client/netrekxp/win32 In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv14778/win32 Modified Files: config.h Log Message: Second round of the ship and keymap changes, this one focused on fixing the things the last patch broke. Removed shipchange(function) Defined ATT_BRONCO since it's defined statically on bronco as type 7 but as type 6 on paradise. Was necessary to get ATT working right on both. Removed option for ship specific netrekrc file (rcfile-). Still can use ship specific keymaps and buttonmaps. Refit string (displayed by client in message window upon entering refit state) now works on paradise servers to provide the correct list of available ships. Fixed keymap bug in getname and playback - was incorrectly using ship keymap instead of default keymap. Added call to buildShipKeymap() in getshipdefaults(), which is in turn called during ship initialization by initialize_shiptypes(). This will set up the individual ship keymaps and buttonmaps at client startup. Fixed help window key remapping to effect not only current ship, but the default keymap and every individual ship keymap as well. Fixed buildShipKeymap() function so it properly resets the ship's individual keymap before trying to parse the keymap from the netrekrc file. Same with buttonmap. Fixed broken logic in the team select screen. Spacebar and clicking on a team window now both work properly again. Fixed options window key remapping to effect not only current ship, but the default keymap and every individual ship keymap as well. Same with buttonmap. Also reduced the amount of duplicate code considerably by calling the keymapAdd and buttonmapAdd functions instead of trying to reprocess the strings inline. Fixed incorrect comment on how SP_SHIP_CAP is sent by bronco vs paradise. Redid handleShipCap() so it works the way it is supposed to. It obeys the operation value in the ship cap packet. And adds news ships or modifies ships correctly. Index: config.h =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/win32/config.h,v retrieving revision 1.20 retrieving revision 1.21 diff -u -d -r1.20 -r1.21 --- config.h 7 Jun 2007 06:29:06 -0000 1.20 +++ config.h 19 Apr 2008 16:23:01 -0000 1.21 @@ -115,7 +115,7 @@ #undef WARP_DEAD /* PARADISE - Support paradise servers */ -#undef PARADISE +#define PARADISE /* RCM - Receiver configurable Server messages */ #define RCM From modemhero at users.sourceforge.net Sat Apr 19 11:22:58 2008 From: modemhero at users.sourceforge.net (Bill Balcerski) Date: Sat, 19 Apr 2008 16:22:58 +0000 Subject: [netrek-cvs] client/netrekxp clientr.suo,1.148,1.149 Message-ID: <20080419162339.90F11B42B@smtpgrey-2.real-time.com> Update of /cvsroot/netrek/client/netrekxp In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv14778 Modified Files: clientr.suo Log Message: Second round of the ship and keymap changes, this one focused on fixing the things the last patch broke. Removed shipchange(function) Defined ATT_BRONCO since it's defined statically on bronco as type 7 but as type 6 on paradise. Was necessary to get ATT working right on both. Removed option for ship specific netrekrc file (rcfile-). Still can use ship specific keymaps and buttonmaps. Refit string (displayed by client in message window upon entering refit state) now works on paradise servers to provide the correct list of available ships. Fixed keymap bug in getname and playback - was incorrectly using ship keymap instead of default keymap. Added call to buildShipKeymap() in getshipdefaults(), which is in turn called during ship initialization by initialize_shiptypes(). This will set up the individual ship keymaps and buttonmaps at client startup. Fixed help window key remapping to effect not only current ship, but the default keymap and every individual ship keymap as well. Fixed buildShipKeymap() function so it properly resets the ship's individual keymap before trying to parse the keymap from the netrekrc file. Same with buttonmap. Fixed broken logic in the team select screen. Spacebar and clicking on a team window now both work properly again. Fixed options window key remapping to effect not only current ship, but the default keymap and every individual ship keymap as well. Same with buttonmap. Also reduced the amount of duplicate code considerably by calling the keymapAdd and buttonmapAdd functions instead of trying to reprocess the strings inline. Fixed incorrect comment on how SP_SHIP_CAP is sent by bronco vs paradise. Redid handleShipCap() so it works the way it is supposed to. It obeys the operation value in the ship cap packet. And adds news ships or modifies ships correctly. Index: clientr.suo =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/clientr.suo,v retrieving revision 1.148 retrieving revision 1.149 diff -u -d -r1.148 -r1.149 Binary files /tmp/cvsVpfqRr and /tmp/cvsuuAhqM differ From modemhero at users.sourceforge.net Sat Apr 19 11:22:59 2008 From: modemhero at users.sourceforge.net (Bill Balcerski) Date: Sat, 19 Apr 2008 16:22:59 +0000 Subject: [netrek-cvs] client/netrekxp/resources/docs changes.txt, 1.203, 1.204 netrekrc_options.txt, 1.55, 1.56 Message-ID: <20080419162338.E0D2A3B407D@smtpgrey-1.real-time.com> Update of /cvsroot/netrek/client/netrekxp/resources/docs In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv14778/resources/docs Modified Files: changes.txt netrekrc_options.txt Log Message: Second round of the ship and keymap changes, this one focused on fixing the things the last patch broke. Removed shipchange(function) Defined ATT_BRONCO since it's defined statically on bronco as type 7 but as type 6 on paradise. Was necessary to get ATT working right on both. Removed option for ship specific netrekrc file (rcfile-). Still can use ship specific keymaps and buttonmaps. Refit string (displayed by client in message window upon entering refit state) now works on paradise servers to provide the correct list of available ships. Fixed keymap bug in getname and playback - was incorrectly using ship keymap instead of default keymap. Added call to buildShipKeymap() in getshipdefaults(), which is in turn called during ship initialization by initialize_shiptypes(). This will set up the individual ship keymaps and buttonmaps at client startup. Fixed help window key remapping to effect not only current ship, but the default keymap and every individual ship keymap as well. Fixed buildShipKeymap() function so it properly resets the ship's individual keymap before trying to parse the keymap from the netrekrc file. Same with buttonmap. Fixed broken logic in the team select screen. Spacebar and clicking on a team window now both work properly again. Fixed options window key remapping to effect not only current ship, but the default keymap and every individual ship keymap as well. Same with buttonmap. Also reduced the amount of duplicate code considerably by calling the keymapAdd and buttonmapAdd functions instead of trying to reprocess the strings inline. Fixed incorrect comment on how SP_SHIP_CAP is sent by bronco vs paradise. Redid handleShipCap() so it works the way it is supposed to. It obeys the operation value in the ship cap packet. And adds news ships or modifies ships correctly. Index: netrekrc_options.txt =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/resources/docs/netrekrc_options.txt,v retrieving revision 1.55 retrieving revision 1.56 diff -u -d -r1.55 -r1.56 --- netrekrc_options.txt 29 Jul 2007 01:38:39 -0000 1.55 +++ netrekrc_options.txt 19 Apr 2008 16:22:57 -0000 1.56 @@ -224,7 +224,6 @@ portSwap: (on/off) use UDP port swap code (use if you behind NAT) puckArrow: (on/off) put a small tic mark on the puck to indicate its direction puckCircle: (on/off) show the puck's max shot range as a circle around your ship -rcfile-: (path) use this file as netrekrc for ship (sc,dd,ca,bb,as,sb,ga,att) redrawDelay: (0-10) how many updates to wait before redraw rejectMacro: (on/off) reject macros reportKills: (on/off) report kills Index: changes.txt =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/resources/docs/changes.txt,v retrieving revision 1.203 retrieving revision 1.204 diff -u -d -r1.203 -r1.204 --- changes.txt 12 Apr 2008 23:28:29 -0000 1.203 +++ changes.txt 19 Apr 2008 16:22:56 -0000 1.204 @@ -9,6 +9,10 @@ 1) Addition of 3rd metaserver to the metaserver list. 2) Added support for new server feature packets (lame_refit and whydead_2). +General changes: +1) Removed option for ship specific netrekrc file (rcfile-). Still can +use ship specific keymaps and buttonmaps. + Netrek XP 2006, Version 1.3: (Released July-2007) From modemhero at users.sourceforge.net Sat Apr 19 11:23:03 2008 From: modemhero at users.sourceforge.net (Bill Balcerski) Date: Sat, 19 Apr 2008 16:23:03 +0000 Subject: [netrek-cvs] client/netrekxp/src cowmain.c, 1.38, 1.39 dashboard.c, 1.26, 1.27 data.c, 1.108, 1.109 defaults.c, 1.91, 1.92 getname.c, 1.11, 1.12 getship.c, 1.7, 1.8 helpwin.c, 1.14, 1.15 input.c, 1.45, 1.46 newwin.c, 1.74, 1.75 option.c, 1.54, 1.55 playback.c, 1.25, 1.26 redraw.c, 1.15, 1.16 socket.c, 1.43, 1.44 Message-ID: <20080419162348.AF43DB42B@smtpgrey-2.real-time.com> Update of /cvsroot/netrek/client/netrekxp/src In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv14778/src Modified Files: cowmain.c dashboard.c data.c defaults.c getname.c getship.c helpwin.c input.c newwin.c option.c playback.c redraw.c socket.c Log Message: Second round of the ship and keymap changes, this one focused on fixing the things the last patch broke. Removed shipchange(function) Defined ATT_BRONCO since it's defined statically on bronco as type 7 but as type 6 on paradise. Was necessary to get ATT working right on both. Removed option for ship specific netrekrc file (rcfile-). Still can use ship specific keymaps and buttonmaps. Refit string (displayed by client in message window upon entering refit state) now works on paradise servers to provide the correct list of available ships. Fixed keymap bug in getname and playback - was incorrectly using ship keymap instead of default keymap. Added call to buildShipKeymap() in getshipdefaults(), which is in turn called during ship initialization by initialize_shiptypes(). This will set up the individual ship keymaps and buttonmaps at client startup. Fixed help window key remapping to effect not only current ship, but the default keymap and every individual ship keymap as well. Fixed buildShipKeymap() function so it properly resets the ship's individual keymap before trying to parse the keymap from the netrekrc file. Same with buttonmap. Fixed broken logic in the team select screen. Spacebar and clicking on a team window now both work properly again. Fixed options window key remapping to effect not only current ship, but the default keymap and every individual ship keymap as well. Same with buttonmap. Also reduced the amount of duplicate code considerably by calling the keymapAdd and buttonmapAdd functions instead of trying to reprocess the strings inline. Fixed incorrect comment on how SP_SHIP_CAP is sent by bronco vs paradise. Redid handleShipCap() so it works the way it is supposed to. It obeys the operation value in the ship cap packet. And adds news ships or modifies ships correctly. Index: redraw.c =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/src/redraw.c,v retrieving revision 1.15 retrieving revision 1.16 diff -u -d -r1.15 -r1.16 --- redraw.c 16 Apr 2008 00:08:20 -0000 1.15 +++ redraw.c 19 Apr 2008 16:23:00 -0000 1.16 @@ -220,7 +220,7 @@ else buf[16] = ' '; buf[17] = ' '; - if (me->p_ship.s_type != ATT) + if ((paradise && me->p_ship.s_type != ATT) || (!paradise && me->p_ship.s_type != ATT_BRONCO)) { buf[18] = (char) ('0' + (me->p_damage / 100)); if (buf[18] == '0') @@ -239,7 +239,7 @@ buf[20] = 'k'; } buf[21] = ' '; - if (me->p_ship.s_type != ATT) + if ((paradise && me->p_ship.s_type != ATT) || (!paradise && me->p_ship.s_type != ATT_BRONCO)) { buf[22] = (char) ('0' + (me->p_shield / 100)); if (buf[22] == '0') @@ -445,7 +445,7 @@ sprintf (buf, "Flags Warp Dam Shd Torps Kills Armies Fuel Wtemp Etemp Time"); W_WriteText (tstatw, 50, 5, textColor, buf, strlen (buf), W_RegularFont); - if (me->p_ship.s_type != ATT) + if ((paradise && me->p_ship.s_type != ATT) || (!paradise && me->p_ship.s_type != ATT_BRONCO)) sprintf (buf, "Maximum: %2d/%2d %3d %3d %2d/%2d %6d %3d %3d", maxspeed, me->p_ship.s_maxspeed, Index: getship.c =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/src/getship.c,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- getship.c 18 Apr 2008 03:42:37 -0000 1.7 +++ getship.c 19 Apr 2008 16:22:59 -0000 1.8 @@ -262,7 +262,7 @@ shipp->s_bitmap = SGALAXY; } break; - case JUMPSHIP: /* or ATT */ + case JUMPSHIP: /* or ATT_BRONCO */ if (paradise) { shipp->s_phaserdamage = 25; shipp->s_torpspeed = 18; @@ -295,13 +295,13 @@ shipp->s_maxegntemp = 10000; /* att: */ shipp->s_width = 20; /* att: */ shipp->s_height = 20; /* att: */ - shipp->s_type = ATT; /* att: */ + shipp->s_type = ATT_BRONCO; /* att: */ shipp->s_phaserfuse = 2; /* att: */ shipp->s_repair = 30000; /* att: */ - shipp->s_letter = 'X'; + shipp->s_letter = '*'; shipp->s_desig[0] = 'A'; shipp->s_desig[1] = 'T'; - shipp->s_bitmap = ATT; + shipp->s_bitmap = ATT_BRONCO; } break; case FLAGSHIP: @@ -425,4 +425,5 @@ shipp->s_bitmap = PATROL; break; } + buildShipKeymap(shipp); } Index: dashboard.c =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/src/dashboard.c,v retrieving revision 1.26 retrieving revision 1.27 diff -u -d -r1.26 -r1.27 --- dashboard.c 16 Apr 2008 00:08:07 -0000 1.26 +++ dashboard.c 19 Apr 2008 16:22:58 -0000 1.27 @@ -763,7 +763,7 @@ color = W_Yellow; else color = W_Green; - if (me->p_ship.s_type == ATT) + if ((paradise && me->p_ship.s_type == ATT) || (!paradise && me->p_ship.s_type == ATT_BRONCO)) db_bar ("Sh", 15 * W_Textwidth, 3 + W_Textheight + SPACING, me->p_shield, me->p_ship.s_maxshield, me->p_ship.s_maxshield, DB_5DIGITS, color); @@ -785,7 +785,7 @@ color = W_Yellow; else color = W_Green; - if (me->p_ship.s_type == ATT) + if ((paradise && me->p_ship.s_type == ATT) || (!paradise && me->p_ship.s_type == ATT_BRONCO)) db_bar ("Hu", 15 * W_Textwidth, 3 + 2 * (W_Textheight + SPACING), (me->p_ship.s_maxdamage - me->p_damage), me->p_ship.s_maxdamage, me->p_ship.s_maxdamage, DB_5DIGITS, @@ -833,7 +833,7 @@ color = W_Yellow; else color = W_Red; - if (me->p_ship.s_type != ATT) + if ((paradise && me->p_ship.s_type != ATT) || (!paradise && me->p_ship.s_type != ATT_BRONCO)) db_bar ("Wt", 109 * W_Textwidth / 3, 3 + W_Textheight + SPACING, me->p_wtemp / 10, me->p_ship.s_maxwpntemp / 10, me->p_ship.s_maxwpntemp / 10, DB_3DIGITS, color); @@ -849,7 +849,7 @@ color = W_Yellow; else color = W_Red; - if (me->p_ship.s_type != ATT) + if ((paradise && me->p_ship.s_type != ATT) || (!paradise && me->p_ship.s_type != ATT_BRONCO)) db_bar ("Et", 109 * W_Textwidth / 3, 3 + 2 * (W_Textheight + SPACING), me->p_etemp / 10, me->p_ship.s_maxegntemp / 10, me->p_ship.s_maxegntemp / 10, DB_3DIGITS, color); @@ -938,7 +938,7 @@ color = W_Yellow; else color = W_White; - if (me->p_ship.s_type == ATT) + if ((paradise && me->p_ship.s_type == ATT) || (!paradise && me->p_ship.s_type == ATT_BRONCO)) db_bar ("Sh", 15 * W_Textwidth, 3 + W_Textheight + SPACING, me->p_ship.s_maxshield - me->p_shield, me->p_ship.s_maxshield, me->p_ship.s_maxshield, DB_5DIGITS, color); @@ -958,7 +958,7 @@ color = W_Red; else color = W_Yellow; - if (me->p_ship.s_type == ATT) + if ((paradise && me->p_ship.s_type == ATT) || (!paradise && me->p_ship.s_type == ATT_BRONCO)) db_bar ("Da", 15 * W_Textwidth, 3 + 2 * (W_Textheight + SPACING), me->p_damage, me->p_ship.s_maxdamage, me->p_ship.s_maxdamage, DB_5DIGITS, color); @@ -1005,7 +1005,7 @@ color = W_White; else color = W_Yellow; - if (me->p_ship.s_type != ATT) + if ((paradise && me->p_ship.s_type != ATT) || (!paradise && me->p_ship.s_type != ATT_BRONCO)) db_bar ("Wt", 109 * W_Textwidth / 3, 3 + W_Textheight + SPACING, me->p_wtemp / 10, me->p_ship.s_maxwpntemp / 10, me->p_ship.s_maxwpntemp / 10, DB_3DIGITS, color); @@ -1022,7 +1022,7 @@ color = W_Yellow; else color = W_Red; - if (me->p_ship.s_type != ATT) + if ((paradise && me->p_ship.s_type != ATT) || (!paradise && me->p_ship.s_type != ATT_BRONCO)) db_bar ("Et", 109 * W_Textwidth / 3, 3 + 2 * (W_Textheight + SPACING), me->p_etemp / 10, me->p_ship.s_maxegntemp / 10, me->p_ship.s_maxegntemp / 10, DB_3DIGITS, color); Index: newwin.c =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/src/newwin.c,v retrieving revision 1.74 retrieving revision 1.75 diff -u -d -r1.74 -r1.75 --- newwin.c 18 Apr 2008 03:42:37 -0000 1.74 +++ newwin.c 19 Apr 2008 16:23:00 -0000 1.75 @@ -1586,7 +1586,7 @@ int *s_type) { struct shiplist *shipscan; - int typeok = 0, i = 0; + int typeok = 0, ship_found = 0, i = 0; time_t startTime; W_Event event; int lastplayercount[4]; @@ -1748,7 +1748,7 @@ if (!W_EventsPending ()) continue; W_NextEvent (&event); - typeok = 0; + typeok = 1; switch ((int) event.type) { case W_EV_KEY: @@ -1756,31 +1756,38 @@ while (shipscan) { if (shipscan->ship->s_letter == event.key) { *s_type = shipscan->ship->s_type; - typeok = 1; + ship_found = 1; break; } shipscan = shipscan->next; } + /* Tried to find ship key but couldn't? */ + if (ship_found == 0) + typeok = 0; + /* Failing to find ship via key, check spacebar */ if (event.key == ' ') { switch (me->p_team) { - case FED: - *team = 0; - break; - case ROM: - *team = 1; - break; - case KLI: - *team = 2; - break; - case ORI: - *team = 3; - break; - default: - break; + case FED: + *team = 0; + typeok = 1; + break; + case ROM: + *team = 1; + typeok = 1; + break; + case KLI: + *team = 2; + typeok = 1; + break; + case ORI: + *team = 3; + typeok = 1; + break; + default: + break; } - break; } if (event.Window == w) { @@ -2293,15 +2300,15 @@ if (strncmp("BLK: ", line, 5) == 0) { /* See if it's a refit string.*/ if (strncmp(&line[5], "REFIT", 5) == 0) { - strncpy(blk_refitstring, &line[10], 79); - blk_refitstring[79] = '\0'; + strncpy(blk_refitstring, &line[10], 79); + blk_refitstring[79] = '\0'; } /* Check to see if it's a borgish feature being enabled. */ else if (strncmp(&line[5], "BORGISH ", 8) == 0) { - if (strncmp(&line[13], "FRCLOAK", 7) == 0) - blk_friendlycloak = 1; + if (strncmp(&line[13], "FRCLOAK", 7) == 0) + blk_friendlycloak = 1; } - return; + return; } if ( strncmp("\t@@b", line, 4) == 0) // Between pages return; Index: input.c =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/src/input.c,v retrieving revision 1.45 retrieving revision 1.46 diff -u -d -r1.45 -r1.46 --- input.c 18 Apr 2008 03:42:37 -0000 1.45 +++ input.c 19 Apr 2008 16:23:00 -0000 1.46 @@ -451,7 +451,7 @@ unsigned char *str; if ((str = (unsigned char *) stringDefault ("keymap")) != NULL) - keymapAdd(str, default_keymap); + keymapAdd(str, (char*) default_keymap); /* See if we can get macroKey to work. What a hack -SAC */ if ((str = (unsigned char *) stringDefault ("macroKey")) != NULL) @@ -477,7 +477,7 @@ } if ((str = (unsigned char *) stringDefault ("ckeymap")) != NULL) - ckeymapAdd(str, default_keymap); + ckeymapAdd(str, (char*) default_keymap); #ifdef MOUSE_AS_SHIFT if ((str = (unsigned char *) stringDefault ("b1keymap")) != NULL) @@ -549,7 +549,7 @@ /* note: not stored on server */ if ((str = (unsigned char *) stringDefault ("buttonmap")) != NULL) - buttonmapAdd(str, default_buttonmap); + buttonmapAdd(str, (char*) default_buttonmap); /* Build ship specific keymaps */ for (j = 0; j < nshiptypes; j++) @@ -681,7 +681,8 @@ buildShipKeymap(struct ship *shipp) { char keybuf[40], ckeybuf[40], buttonbuf[40]; - char *pek; + char *keymap_str, *ckeymap_str, *buttonmap_str; + int i; #ifdef MOUSE_AS_SHIFT memcpy(shipp->s_keymap, default_keymap, 672); @@ -694,14 +695,47 @@ sprintf(ckeybuf, "ckeymap-%c%c", shipp->s_desig[0], shipp->s_desig[1]); sprintf(buttonbuf, "buttonmap-%c%c", shipp->s_desig[0], shipp->s_desig[1]); - if (pek = stringDefault (keybuf)) - keymapAdd(pek, shipp->s_keymap); - if (pek = stringDefault (ckeybuf)) - ckeymapAdd(pek, shipp->s_keymap); + keymap_str = stringDefault (keybuf); + ckeymap_str = stringDefault (ckeybuf); + buttonmap_str = stringDefault (buttonbuf); + + /* If individual ship keymap is found, reset the ship's keymap first before + parsing the keymap string */ + if (keymap_str || ckeymap_str) + { + for (i = 0; i < 95; i++) + { + shipp->s_keymap[i] = (unsigned char) (i + 32); + shipp->s_keymap[i + 96] = (unsigned char) (i + 32 + 96); + +#ifdef MOUSE_AS_SHIFT + shipp->s_keymap[i + 192] = (unsigned char) (i + 32); + shipp->s_keymap[i + 288] = (unsigned char) (i + 32); + shipp->s_keymap[i + 384] = (unsigned char) (i + 32); + shipp->s_keymap[i + 480] = (unsigned char) (i + 32); + shipp->s_keymap[i + 576] = (unsigned char) (i + 32); +#endif + } + shipp->s_keymap[95] = 0; + } + + /* If individual ship buttonmap is found, reset the ship's buttonmap first before + parsing the buttonmap string */ + if (buttonmap_str) + { + for (i = 1; i < 23; i++) + shipp->s_buttonmap[i] = 0; + } + + if (keymap_str) + keymapAdd(keymap_str, (char*) shipp->s_keymap); + + if (ckeymap_str) + ckeymapAdd(ckeymap_str, (char*) shipp->s_keymap); - if (pek = stringDefault (buttonbuf)) - buttonmapAdd(pek, shipp->s_buttonmap); + if (buttonmap_str) + buttonmapAdd(buttonmap_str, (char*) shipp->s_buttonmap); } /******************************************************************************/ @@ -3338,8 +3372,7 @@ Key114 (void) { localflags |= PFREFIT; - warning - ("s=scout, d=destroyer, c=cruiser, b=battleship, a=assault, g=galaxy, o=starbase"); + warning(blk_refitstring); } /******************************************************************************/ Index: cowmain.c =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/src/cowmain.c,v retrieving revision 1.38 retrieving revision 1.39 diff -u -d -r1.38 -r1.39 --- cowmain.c 18 Apr 2008 03:42:36 -0000 1.38 +++ cowmain.c 19 Apr 2008 16:22:58 -0000 1.39 @@ -1010,7 +1010,6 @@ redrawall = 1; #endif - shipchange (s_type); enter (); calibrate_stats (); W_ClearWindow (w); Index: getname.c =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/src/getname.c,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- getname.c 18 Apr 2008 03:42:37 -0000 1.11 +++ getname.c 19 Apr 2008 16:22:59 -0000 1.12 @@ -417,21 +417,21 @@ MZERO (mystats, sizeof (struct stats)); - // Reset the keymap for our player record + // Set up the default keymap for (j = 0; j < 95; j++) { - myship->s_keymap[j] = (unsigned char) (j + 32); - myship->s_keymap[j + 96] = (unsigned char) (j + 32 + 96); + default_keymap[j] = (unsigned char) (j + 32); + default_keymap[j + 96] = (unsigned char) (j + 32 + 96); #ifdef MOUSE_AS_SHIFT - myship->s_keymap[j + 192] = (unsigned char) (j + 32); - myship->s_keymap[j + 288] = (unsigned char) (j + 32); - myship->s_keymap[j + 384] = (unsigned char) (j + 32); - myship->s_keymap[j + 480] = (unsigned char) (j + 32); - myship->s_keymap[j + 576] = (unsigned char) (j + 32); + default_keymap[j + 192] = (unsigned char) (j + 32); + default_keymap[j + 288] = (unsigned char) (j + 32); + default_keymap[j + 384] = (unsigned char) (j + 32); + default_keymap[j + 480] = (unsigned char) (j + 32); + default_keymap[j + 576] = (unsigned char) (j + 32); #endif } - myship->s_keymap[95] = 0; + default_keymap[95] = 0; mystats->st_tticks = 1; mystats->st_flags = ST_MAPMODE + ST_NAMEMODE + ST_SHOWSHIELDS + ST_KEEPPEACE + ST_SHOWLOCAL * 2 + ST_SHOWGLOBAL * 2; Index: playback.c =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/src/playback.c,v retrieving revision 1.25 retrieving revision 1.26 diff -u -d -r1.25 -r1.26 --- playback.c 18 Apr 2008 03:42:37 -0000 1.25 +++ playback.c 19 Apr 2008 16:23:00 -0000 1.26 @@ -222,7 +222,6 @@ me->p_x = me->p_y = 50000; myship = getship(CRUISER); - shipchange (CRUISER); displayme = me; packetsme = me; @@ -243,18 +242,18 @@ mystats->st_tticks = 1; for (i = 0; i < 95; i++) { - myship->s_keymap[i] = (unsigned char) (i + 32); - myship->s_keymap[i + 96] = (unsigned char) (i + 32 + 96); + default_keymap[i] = (unsigned char) (i + 32); + default_keymap[i + 96] = (unsigned char) (i + 32 + 96); #ifdef MOUSE_AS_SHIFT - myship->s_keymap[i + 192] = (unsigned char) (i + 32); - myship->s_keymap[i + 288] = (unsigned char) (i + 32); - myship->s_keymap[i + 384] = (unsigned char) (i + 32); - myship->s_keymap[i + 480] = (unsigned char) (i + 32); - myship->s_keymap[i + 576] = (unsigned char) (i + 32); + default_keymap[i + 192] = (unsigned char) (i + 32); + default_keymap[i + 288] = (unsigned char) (i + 32); + default_keymap[i + 384] = (unsigned char) (i + 32); + default_keymap[i + 480] = (unsigned char) (i + 32); + default_keymap[i + 576] = (unsigned char) (i + 32); #endif } - myship->s_keymap[95] = 0; + default_keymap[95] = 0; mystats->st_flags = ST_MAPMODE + ST_NAMEMODE + ST_SHOWSHIELDS + ST_KEEPPEACE + ST_SHOWLOCAL * 2 + ST_SHOWGLOBAL * 2; @@ -328,7 +327,6 @@ #endif myship = getship (myship->s_type); - shipchange (myship->s_type); enter (); calibrate_stats (); W_ClearWindow (w); Index: socket.c =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/src/socket.c,v retrieving revision 1.43 retrieving revision 1.44 diff -u -d -r1.43 -r1.44 --- socket.c 18 Apr 2008 03:42:37 -0000 1.43 +++ socket.c 19 Apr 2008 16:23:00 -0000 1.44 @@ -2677,40 +2677,108 @@ #endif /* defined(BORG) */ } -/* SP_SHIP_CAP is sent frequenly by bronco servers but only once - by a paradise server. The paradise server packet contains ship - data for all ships. The bronco server packet contains data on - only one ship. */ +/* SP_SHIP_CAP packets are sent frequently by bronco servers but only + during initial connect by a paradise server. */ void handleShipCap (struct ship_cap_spacket *packet) { - unsigned short stype; + struct shiplist *temp; - stype = ntohs (packet->s_type); - if (!paradise) - { - shipvals[stype].s_torpspeed = ntohs (packet->s_torpspeed); - shipvals[stype].s_maxshield = ntohl (packet->s_maxshield); - shipvals[stype].s_maxdamage = ntohl (packet->s_maxdamage); - shipvals[stype].s_maxegntemp = ntohl (packet->s_maxegntemp); - shipvals[stype].s_maxwpntemp = ntohl (packet->s_maxwpntemp); - shipvals[stype].s_maxarmies = ntohs (packet->s_maxarmies); - shipvals[stype].s_maxfuel = ntohl (packet->s_maxfuel); - shipvals[stype].s_maxspeed = ntohl (packet->s_maxspeed); - shipvals[stype].s_width = ntohs (packet->s_width); - shipvals[stype].s_height = ntohs (packet->s_height); - shipvals[stype].s_phaserdamage = ntohs (packet->s_phaserrange); - shipvals[stype].s_letter = packet->s_letter; - shipvals[stype].s_desig[1] = packet->s_desig1; - shipvals[stype].s_desig[2] = packet->s_desig2; - shipvals[stype].s_bitmap = ntohs (packet->s_bitmap); - /* strncpy(shipvals[stype].s_name, packet->s_name, 16); */ - myship = getship (myship->s_type); + /* + What are we supposed to do? + */ - redrawTstats (); /* Redraw dashboard */ - calibrate_stats (); /* Redefine colored statwin sliders */ - redrawStats (); /* Redraw statwin */ + if (packet->operation) { /* remove ship from list */ + temp = shiptypes; + if (temp->ship->s_type == (int) ntohs(packet->s_type)) { + shiptypes = temp->next; + shiptypes->prev = NULL; + } + while (temp->next != NULL) { + if (temp->next->ship->s_type == (int) ntohs(packet->s_type)) { + temp = temp->next; + temp->prev->next = temp->next; + if (temp->next) + temp->next->prev = temp->prev; + free(temp->ship); + free(temp); + return; + } else { + temp = temp->next; + } + } + } + /* + Since we're adding the ship, we need to find out if we already have + that ship, and if so, replace it. + */ + + temp = shiptypes; + while (temp != NULL) { + if (temp->ship->s_type == (int) ntohs(packet->s_type)) { + temp->ship->s_type = ntohs(packet->s_type); + temp->ship->s_torpspeed = ntohs(packet->s_torpspeed); + temp->ship->s_phaserdamage = ntohs(packet->s_phaserrange); + if (paradise) /* paradise compatibility */ + temp->ship->s_phaserdamage *= PHASEDIST / 100; + temp->ship->s_maxspeed = ntohl(packet->s_maxspeed); + temp->ship->s_width = ntohs (packet->s_width); + temp->ship->s_height = ntohs (packet->s_height); + temp->ship->s_maxfuel = ntohl(packet->s_maxfuel); + temp->ship->s_maxshield = ntohl(packet->s_maxshield); + temp->ship->s_maxdamage = ntohl(packet->s_maxdamage); + temp->ship->s_maxwpntemp = ntohl(packet->s_maxwpntemp); + temp->ship->s_maxegntemp = ntohl(packet->s_maxegntemp); + temp->ship->s_maxarmies = ntohs(packet->s_maxarmies); + //if(F_armies_shipcap == 1) + // temp->ship->s_armies = packet->s_armies; + temp->ship->s_letter = packet->s_letter; + temp->ship->s_desig[0] = packet->s_desig1; + temp->ship->s_desig[1] = packet->s_desig2; + temp->ship->s_bitmap = ntohs(packet->s_bitmap); + //buildShipKeymap(temp->ship); + myship = getship (myship->s_type); + redrawTstats (); /* Redraw dashboard */ + calibrate_stats (); /* Redefine colored statwin sliders */ + redrawStats (); /* Redraw statwin */ + return; + } + temp = temp->next; } + + /* + Not there, so we need to make a new entry in the list for it. + */ + temp = (struct shiplist *) malloc(sizeof(struct shiplist)); + temp->next = shiptypes; + temp->prev = NULL; + if (shiptypes) + shiptypes->prev = temp; + shiptypes = temp; + temp->ship = (struct ship *) malloc(sizeof(struct ship)); + temp->ship->s_type = ntohs(packet->s_type); + temp->ship->s_torpspeed = ntohs(packet->s_torpspeed); + temp->ship->s_phaserdamage = ntohs(packet->s_phaserrange); + if (paradise) /* paradise compatibility */ + temp->ship->s_phaserdamage *= PHASEDIST / 100; + temp->ship->s_maxspeed = ntohl(packet->s_maxspeed); + temp->ship->s_width = ntohs (packet->s_width); + temp->ship->s_height = ntohs (packet->s_height); + temp->ship->s_maxfuel = ntohl(packet->s_maxfuel); + temp->ship->s_maxshield = ntohl(packet->s_maxshield); + temp->ship->s_maxdamage = ntohl(packet->s_maxdamage); + temp->ship->s_maxwpntemp = ntohl(packet->s_maxwpntemp); + temp->ship->s_maxegntemp = ntohl(packet->s_maxegntemp); + temp->ship->s_maxarmies = ntohs(packet->s_maxarmies); + temp->ship->s_armies = packet->s_armies; + temp->ship->s_letter = packet->s_letter; + temp->ship->s_desig[0] = packet->s_desig1; + temp->ship->s_desig[1] = packet->s_desig2; + temp->ship->s_bitmap = ntohs(packet->s_bitmap); + myship = getship (myship->s_type); + redrawTstats (); /* Redraw dashboard */ + calibrate_stats (); /* Redefine colored statwin sliders */ + redrawStats (); /* Redraw statwin */ } void Index: data.c =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/src/data.c,v retrieving revision 1.108 retrieving revision 1.109 diff -u -d -r1.108 -r1.109 --- data.c 18 Apr 2008 03:42:36 -0000 1.108 +++ data.c 19 Apr 2008 16:22:58 -0000 1.109 @@ -305,7 +305,7 @@ /* MOTD data */ struct page *currpage = NULL; struct page *pmotddata = NULL; -char blk_refitstring[80] = "s=scout, d=destroyer, c=cruiser, b=battleship, a=assault, o=starbase"; +char blk_refitstring[80] = "s=scout, d=destroyer, c=cruiser, b=battleship, a=assault, g=galaxy, o=starbase"; int blk_friendlycloak = 0; /* Show color of cloakers who are friendly. */ Index: helpwin.c =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/src/helpwin.c,v retrieving revision 1.14 retrieving revision 1.15 diff -u -d -r1.14 -r1.15 --- helpwin.c 18 Apr 2008 03:42:37 -0000 1.14 +++ helpwin.c 19 Apr 2008 16:22:59 -0000 1.15 @@ -251,6 +251,9 @@ { int i, message_number = -1; int row, column = 0; + int shpn; + char newkeys[4]; + struct ship *shipp; /* Close window? */ if (data->key == W_MBUTTON @@ -287,9 +290,20 @@ if (message_number != -1) { - /* And now we will remap the key in that message */ - myship->s_keymap[(data->key) - 32] = help_message[message_number][0]; - + /* First we will place the key and the help message into typical + keymap string form */ + newkeys[0] = data->key; + newkeys[1] = help_message[message_number][0]; + newkeys[2] = 0; + /* And then we will update default, myship, and individual ship + keymaps/buttonmaps with that string */ + keymapAdd(newkeys, (char*) default_keymap); + keymapAdd(newkeys, (char*) myship->s_keymap); + for (shpn = 0; shpn < nshiptypes; shpn++) + { + shipp = getship(shpn); + keymapAdd(newkeys, (char*) shipp->s_keymap); + } /* Finally we want to update window */ fillhelp (); } Index: option.c =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/src/option.c,v retrieving revision 1.54 retrieving revision 1.55 diff -u -d -r1.54 -r1.55 --- option.c 18 Apr 2008 03:42:37 -0000 1.54 +++ option.c 19 Apr 2008 16:23:00 -0000 1.55 @@ -1029,110 +1029,24 @@ void optiondone (void) { - char *str; + int shpn; + struct ship *shipp; /* Unmap window */ W_UnmapWindow (optionWin); - /* update keymap */ - for (str = newkeys; *str != '\0'; str += 2) + /* update default, myship, and individual ship keymaps/buttonmaps */ + keymapAdd(newkeys, (char*) default_keymap); + buttonmapAdd(newbuttons, (char*) default_buttonmap); + keymapAdd(newkeys, (char*) myship->s_keymap); + buttonmapAdd(newbuttons, (char*) myship->s_buttonmap); + for (shpn = 0; shpn < nshiptypes; shpn++) { - if ((*str >= 32 && *str < 127) || *str == 'O') - { - if (*(str + 1) == '\0') - break; - myship->s_keymap[*str - 32] = *(str + 1); - } - if (*(str + 1) == '\0') - break; + shipp = getship(shpn); + keymapAdd(newkeys, (char*) shipp->s_keymap); + buttonmapAdd(newbuttons, (char*) shipp->s_buttonmap); } *newkeys = '\0'; - - /* update buttonmap */ - str = newbuttons; - while (*str != '\0' && *(str + 1) != '\0') - { - switch (*str++) - { - case '1': - myship->s_buttonmap[1] = getctrlkey (&str); - break; - case '2': - myship->s_buttonmap[2] = getctrlkey (&str); - break; - case '3': - myship->s_buttonmap[3] = getctrlkey (&str); - break; - /* XButton 1 */ - case '4': - myship->s_buttonmap[4] = getctrlkey (&str); - break; - /* XButton 2 */ - case '5': - myship->s_buttonmap[5] = getctrlkey (&str); - break; - /* Wheel Up */ - case '6': - myship->s_buttonmap[6] = getctrlkey (&str); - break; - /* Wheel Down */ - case '7': - myship->s_buttonmap[7] = getctrlkey (&str); - break; - -#ifdef SHIFTED_MOUSE - case '8': - myship->s_buttonmap[8] = getctrlkey (&str); - break; - case '9': - myship->s_buttonmap[9] = getctrlkey (&str); - break; - case 'a': - myship->s_buttonmap[10] = getctrlkey (&str); - break; - case 'b': - myship->s_buttonmap[11] = getctrlkey (&str); - break; - case 'c': - myship->s_buttonmap[12] = getctrlkey (&str); - break; - case 'd': - myship->s_buttonmap[13] = getctrlkey (&str); - break; - case 'e': - myship->s_buttonmap[14] = getctrlkey (&str); - break; - case 'f': - myship->s_buttonmap[15] = getctrlkey (&str); - break; - case 'g': - myship->s_buttonmap[16] = getctrlkey (&str); - break; - case 'h': - myship->s_buttonmap[17] = getctrlkey (&str); - break; - case 'i': - myship->s_buttonmap[18] = getctrlkey (&str); - break; - case 'j': - myship->s_buttonmap[19] = getctrlkey (&str); - break; - case 'k': - myship->s_buttonmap[20] = getctrlkey (&str); - break; - case 'l': - myship->s_buttonmap[21] = getctrlkey (&str); - break; - case 'm': - myship->s_buttonmap[22] = getctrlkey (&str); - break; -#endif /* SHIFTED_MOUSE */ - - default: - LineToConsole ("%c ignored in buttonmap\n", *(str - 1)); - break; - } - } *newbuttons = '\0'; /* update login */ Index: defaults.c =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/src/defaults.c,v retrieving revision 1.91 retrieving revision 1.92 diff -u -d -r1.91 -r1.92 --- defaults.c 18 Apr 2008 03:42:36 -0000 1.91 +++ defaults.c 19 Apr 2008 16:22:59 -0000 1.92 @@ -1994,24 +1994,6 @@ updateWindowsGeometry (war); */ } - -/******************************************************************************/ -/*** shipchange() ***/ -/******************************************************************************/ -void -shipchange (int type) -{ -/* if (type == myshiptype) - return; - myshiptype = type; - myshipdef = &shipdefaults[type]; - if (shipdefaults[type].rcfile) - { - initDefaults (shipdefaults[type].rcfile); - resetdefaults (); - } - initkeymap ();*/ -} /* Generally useful function that searches for a file in the current and home directories, also @@ -3351,7 +3333,7 @@ if (saveBig) { - fputs ("# Esoteric features such as individual ship rcfiles/keymaps\n", fp); + fputs ("# Esoteric features such as individual ship keymaps\n", fp); fputs ("# /ckeymaps/buttonmaps (i.e. keymap-ca: ), observer\n", fp); fputs ("# /servertype options (i.e. keymap.bronco: ), and\n", fp); fputs ("# button keymaps (b1keymap through b5keymap)\n", fp); @@ -3362,14 +3344,6 @@ struct ship *shipp; shipp = getship(j); - sprintf(str1, "rcfile-%c%c", shipp->s_desig[0], shipp->s_desig[1]); - adefault = stringDefault (str1); - if (adefault != NULL) - { - sprintf (str, "%s: %s\n", str1, adefault); - fputs (str, fp); - } - sprintf(str1, "keymap-%c%c", shipp->s_desig[0], shipp->s_desig[1]); adefault = stringDefault (str1); if (adefault != NULL) From modemhero at users.sourceforge.net Sat Apr 19 11:22:58 2008 From: modemhero at users.sourceforge.net (Bill Balcerski) Date: Sat, 19 Apr 2008 16:22:58 +0000 Subject: [netrek-cvs] client/netrekxp/include defs.h, 1.32, 1.33 proto.h, 1.62, 1.63 struct.h, 1.27, 1.28 Message-ID: <20080419162340.213A3B42B@smtpgrey-2.real-time.com> Update of /cvsroot/netrek/client/netrekxp/include In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv14778/include Modified Files: defs.h proto.h struct.h Log Message: Second round of the ship and keymap changes, this one focused on fixing the things the last patch broke. Removed shipchange(function) Defined ATT_BRONCO since it's defined statically on bronco as type 7 but as type 6 on paradise. Was necessary to get ATT working right on both. Removed option for ship specific netrekrc file (rcfile-). Still can use ship specific keymaps and buttonmaps. Refit string (displayed by client in message window upon entering refit state) now works on paradise servers to provide the correct list of available ships. Fixed keymap bug in getname and playback - was incorrectly using ship keymap instead of default keymap. Added call to buildShipKeymap() in getshipdefaults(), which is in turn called during ship initialization by initialize_shiptypes(). This will set up the individual ship keymaps and buttonmaps at client startup. Fixed help window key remapping to effect not only current ship, but the default keymap and every individual ship keymap as well. Fixed buildShipKeymap() function so it properly resets the ship's individual keymap before trying to parse the keymap from the netrekrc file. Same with buttonmap. Fixed broken logic in the team select screen. Spacebar and clicking on a team window now both work properly again. Fixed options window key remapping to effect not only current ship, but the default keymap and every individual ship keymap as well. Same with buttonmap. Also reduced the amount of duplicate code considerably by calling the keymapAdd and buttonmapAdd functions instead of trying to reprocess the strings inline. Fixed incorrect comment on how SP_SHIP_CAP is sent by bronco vs paradise. Redid handleShipCap() so it works the way it is supposed to. It obeys the operation value in the ship cap packet. And adds news ships or modifies ships correctly. Index: defs.h =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/include/defs.h,v retrieving revision 1.32 retrieving revision 1.33 diff -u -d -r1.32 -r1.33 --- defs.h 16 Apr 2008 00:08:00 -0000 1.32 +++ defs.h 19 Apr 2008 16:22:56 -0000 1.33 @@ -298,7 +298,7 @@ #define sendBombReq(state) sendShortPacket(CP_BOMB, (char) state) #define sendPractrReq() sendShortPacket(CP_PRACTR, 0) #define sendWarReq(mask) sendShortPacket(CP_WAR, (char) mask) -#define sendRefitReq(ship) {sendShortPacket(CP_REFIT, (char) ship); shipchange(ship);} +#define sendRefitReq(ship) sendShortPacket(CP_REFIT, (char) ship) #define sendPlaylockReq(pnum) sendShortPacket(CP_PLAYLOCK, (char) pnum) #define sendPlanlockReq(pnum) sendShortPacket(CP_PLANLOCK, (char) pnum) #define sendCoupReq() sendShortPacket(CP_COUP, 0) Index: struct.h =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/include/struct.h,v retrieving revision 1.27 retrieving revision 1.28 diff -u -d -r1.27 -r1.28 --- struct.h 18 Apr 2008 03:42:36 -0000 1.27 +++ struct.h 19 Apr 2008 16:22:56 -0000 1.28 @@ -248,6 +248,7 @@ #define ATT 6 /* paradise */ #define SGALAXY 6 /* bronco */ #define JUMPSHIP 7 /* can be ATT on bronco */ +#define ATT_BRONCO 7 #define FLAGSHIP 8 #define WARBASE 9 #define LIGHTCRUISER 10 @@ -288,7 +289,6 @@ unsigned char s_keymap[96]; /* keymap for this ship */ #endif unsigned char s_buttonmap[23]; /* buttonmap for this ship */ - char *rcfile; /* pointer to ship specific rcfile */ }; struct stats Index: proto.h =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/include/proto.h,v retrieving revision 1.62 retrieving revision 1.63 diff -u -d -r1.62 -r1.63 --- proto.h 18 Apr 2008 03:42:36 -0000 1.62 +++ proto.h 19 Apr 2008 16:22:56 -0000 1.63 @@ -112,7 +112,6 @@ char *geometryDefault (char *str); int findDefaults (char *deffile, char *file); void resetdefaults (void); -void shipchange (int type); int findfile (char *fname, char *found); From modemhero at users.sourceforge.net Sat Apr 19 11:23:00 2008 From: modemhero at users.sourceforge.net (Bill Balcerski) Date: Sat, 19 Apr 2008 16:23:00 +0000 Subject: [netrek-cvs] client/netrekxp/resources/htmlhelp/html generalconfig.html, 1.56, 1.57 Message-ID: <20080419162340.89B1CB42B@smtpgrey-2.real-time.com> Update of /cvsroot/netrek/client/netrekxp/resources/htmlhelp/html In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv14778/resources/htmlhelp/html Modified Files: generalconfig.html Log Message: Second round of the ship and keymap changes, this one focused on fixing the things the last patch broke. Removed shipchange(function) Defined ATT_BRONCO since it's defined statically on bronco as type 7 but as type 6 on paradise. Was necessary to get ATT working right on both. Removed option for ship specific netrekrc file (rcfile-). Still can use ship specific keymaps and buttonmaps. Refit string (displayed by client in message window upon entering refit state) now works on paradise servers to provide the correct list of available ships. Fixed keymap bug in getname and playback - was incorrectly using ship keymap instead of default keymap. Added call to buildShipKeymap() in getshipdefaults(), which is in turn called during ship initialization by initialize_shiptypes(). This will set up the individual ship keymaps and buttonmaps at client startup. Fixed help window key remapping to effect not only current ship, but the default keymap and every individual ship keymap as well. Fixed buildShipKeymap() function so it properly resets the ship's individual keymap before trying to parse the keymap from the netrekrc file. Same with buttonmap. Fixed broken logic in the team select screen. Spacebar and clicking on a team window now both work properly again. Fixed options window key remapping to effect not only current ship, but the default keymap and every individual ship keymap as well. Same with buttonmap. Also reduced the amount of duplicate code considerably by calling the keymapAdd and buttonmapAdd functions instead of trying to reprocess the strings inline. Fixed incorrect comment on how SP_SHIP_CAP is sent by bronco vs paradise. Redid handleShipCap() so it works the way it is supposed to. It obeys the operation value in the ship cap packet. And adds news ships or modifies ships correctly. Index: generalconfig.html =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/resources/htmlhelp/html/generalconfig.html,v retrieving revision 1.56 retrieving revision 1.57 diff -u -d -r1.56 -r1.57 --- generalconfig.html 29 Jul 2007 01:38:39 -0000 1.56 +++ generalconfig.html 19 Apr 2008 16:22:57 -0000 1.57 @@ -943,11 +943,6 @@ -rcfile-<ship>
<ship> can be one of sc,dd,cs,bb,as,sb,ga,att
-Path to separate defaults for specific ship -path - - redrawDelay Number of updates before redraw 1-10
default: 0 From modemhero at users.sourceforge.net Sat Apr 19 15:03:10 2008 From: modemhero at users.sourceforge.net (Bill Balcerski) Date: Sat, 19 Apr 2008 20:03:10 +0000 Subject: [netrek-cvs] client/netrekxp/src dashboard.c, 1.27, 1.28 dashboard3.c, 1.12, 1.13 data.c, 1.109, 1.110 feature.c, 1.21, 1.22 local.c, 1.111, 1.112 map.c, 1.64, 1.65 socket.c, 1.44, 1.45 Message-ID: <20080419200325.E15013B408C@smtpgrey-1.real-time.com> Update of /cvsroot/netrek/client/netrekxp/src In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv6042/src Modified Files: dashboard.c dashboard3.c data.c feature.c local.c map.c socket.c Log Message: Fixed phaser length bug with paradise servers. Paradise servers use different protocol for transmitting phaser damage to client. Added support for paradise feature packets for terrain and ship army cap. Cleaned up todo list. Index: dashboard.c =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/src/dashboard.c,v retrieving revision 1.27 retrieving revision 1.28 diff -u -d -r1.27 -r1.28 --- dashboard.c 19 Apr 2008 16:22:58 -0000 1.27 +++ dashboard.c 19 Apr 2008 20:03:00 -0000 1.28 @@ -798,14 +798,27 @@ old_dam = me->p_damage; } - if (me->p_ship.s_type == ASSAULT) - cur_max = (((kills * 3) > me->p_ship.s_maxarmies) ? - me->p_ship.s_maxarmies : (int) (kills * 3)); - else if (me->p_ship.s_type == STARBASE) - cur_max = me->p_ship.s_maxarmies; + if (!paradise && !F_armies_shipcap) + { + if (me->p_ship.s_type == ASSAULT) + cur_max = (((kills * 3) > me->p_ship.s_maxarmies) ? + me->p_ship.s_maxarmies : (int) (kills * 3)); + else if (me->p_ship.s_type == STARBASE) + cur_max = me->p_ship.s_maxarmies; + else + cur_max = (((kills * 2) > me->p_ship.s_maxarmies) ? + me->p_ship.s_maxarmies : (int) (kills * 2)); + } else - cur_max = (((kills * 2) > me->p_ship.s_maxarmies) ? - me->p_ship.s_maxarmies : (int) (kills * 2)); + { + if (me->p_ship.s_armies & 0x80) + cur_max = (int) (kills * (me->p_ship.s_armies & 0x7f) / 10); + else + cur_max = me->p_ship.s_maxarmies; + + if(cur_max > me->p_ship.s_maxarmies) + cur_max = me->p_ship.s_maxarmies; + } if (fr || me->p_armies != old_arm || cur_max != old_cur_arm) { @@ -969,14 +982,27 @@ old_dam = me->p_damage; } - if (me->p_ship.s_type == ASSAULT) - cur_max = (((kills * 3) > me->p_ship.s_maxarmies) ? - me->p_ship.s_maxarmies : (int) (kills * 3)); - else if (me->p_ship.s_type == STARBASE) - cur_max = me->p_ship.s_maxarmies; + if (!paradise && !F_armies_shipcap) + { + if (me->p_ship.s_type == ASSAULT) + cur_max = (((kills * 3) > me->p_ship.s_maxarmies) ? + me->p_ship.s_maxarmies : (int) (kills * 3)); + else if (me->p_ship.s_type == STARBASE) + cur_max = me->p_ship.s_maxarmies; + else + cur_max = (((kills * 2) > me->p_ship.s_maxarmies) ? + me->p_ship.s_maxarmies : (int) (kills * 2)); + } else - cur_max = (((kills * 2) > me->p_ship.s_maxarmies) ? - me->p_ship.s_maxarmies : (int) (kills * 2)); + { + if (me->p_ship.s_armies & 0x80) + cur_max = (int) (kills * (me->p_ship.s_armies & 0x7f) / 10); + else + cur_max = me->p_ship.s_maxarmies; + + if(cur_max > me->p_ship.s_maxarmies) + cur_max = me->p_ship.s_maxarmies; + } if (fr || me->p_armies != old_arm || cur_max != old_cur_arm) { Index: local.c =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/src/local.c,v retrieving revision 1.111 retrieving revision 1.112 diff -u -d -r1.111 -r1.112 --- local.c 16 Apr 2008 00:08:17 -0000 1.111 +++ local.c 19 Apr 2008 20:03:03 -0000 1.112 @@ -1774,29 +1774,18 @@ /* Here I will have to compute end coordinate */ /* Server will sometimes send us this information though, so check if we have it first */ - if (!paradise && php->ph_x > 0 && php->ph_y > 0 && php->ph_x < GWIDTH && php->ph_y < GWIDTH) + if (php->ph_x > 0 && php->ph_y > 0 && php->ph_x < GWIDTH && php->ph_y < GWIDTH) { tx = (php->ph_x - me->p_x) / scaleFactor + TWINSIDE / 2; ty = (php->ph_y - me->p_y) / scaleFactor + TWINSIDE / 2; } else { - /* Paradise servers changed the ship cap protocol for - phaser damage :( */ - if (paradise) - { - tx = (int) (j->p_ship.s_phaserdamage * Cos[php->ph_dir]); - - ty = (int) (j->p_ship.s_phaserdamage * Sin[php->ph_dir]); - } - else - { - tx = (int) (PHASEDIST * j->p_ship.s_phaserdamage / 100 * - Cos[php->ph_dir]); + tx = (int) (PHASEDIST * j->p_ship.s_phaserdamage / 100 * + Cos[php->ph_dir]); - ty = (int) (PHASEDIST * j->p_ship.s_phaserdamage / 100 * - Sin[php->ph_dir]); - } + ty = (int) (PHASEDIST * j->p_ship.s_phaserdamage / 100 * + Sin[php->ph_dir]); tx = (j->p_x + tx - me->p_x) / scaleFactor + TWINSIDE / 2; ty = (j->p_y + ty - me->p_y) / scaleFactor + TWINSIDE / 2; Index: socket.c =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/src/socket.c,v retrieving revision 1.44 retrieving revision 1.45 diff -u -d -r1.44 -r1.45 --- socket.c 19 Apr 2008 16:23:00 -0000 1.44 +++ socket.c 19 Apr 2008 20:03:05 -0000 1.45 @@ -2719,8 +2719,8 @@ temp->ship->s_type = ntohs(packet->s_type); temp->ship->s_torpspeed = ntohs(packet->s_torpspeed); temp->ship->s_phaserdamage = ntohs(packet->s_phaserrange); - if (paradise) /* paradise compatibility */ - temp->ship->s_phaserdamage *= PHASEDIST / 100; + if (paradise) /* paradise changed the protocol for this field :( */ + temp->ship->s_phaserdamage = (temp->ship->s_phaserdamage * 100) / PHASEDIST; temp->ship->s_maxspeed = ntohl(packet->s_maxspeed); temp->ship->s_width = ntohs (packet->s_width); temp->ship->s_height = ntohs (packet->s_height); @@ -2730,8 +2730,8 @@ temp->ship->s_maxwpntemp = ntohl(packet->s_maxwpntemp); temp->ship->s_maxegntemp = ntohl(packet->s_maxegntemp); temp->ship->s_maxarmies = ntohs(packet->s_maxarmies); - //if(F_armies_shipcap == 1) - // temp->ship->s_armies = packet->s_armies; + if (F_armies_shipcap == 1) + temp->ship->s_armies = packet->s_armies; temp->ship->s_letter = packet->s_letter; temp->ship->s_desig[0] = packet->s_desig1; temp->ship->s_desig[1] = packet->s_desig2; @@ -2759,8 +2759,8 @@ temp->ship->s_type = ntohs(packet->s_type); temp->ship->s_torpspeed = ntohs(packet->s_torpspeed); temp->ship->s_phaserdamage = ntohs(packet->s_phaserrange); - if (paradise) /* paradise compatibility */ - temp->ship->s_phaserdamage *= PHASEDIST / 100; + if (paradise) /* paradise changed the protocol for this field :( */ + temp->ship->s_phaserdamage = (temp->ship->s_phaserdamage * 100) / PHASEDIST; temp->ship->s_maxspeed = ntohl(packet->s_maxspeed); temp->ship->s_width = ntohs (packet->s_width); temp->ship->s_height = ntohs (packet->s_height); Index: dashboard3.c =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/src/dashboard3.c,v retrieving revision 1.12 retrieving revision 1.13 diff -u -d -r1.12 -r1.13 --- dashboard3.c 16 Apr 2008 00:08:07 -0000 1.12 +++ dashboard3.c 19 Apr 2008 20:03:00 -0000 1.13 @@ -531,17 +531,29 @@ } } } - - if (me->p_ship.s_type == ASSAULT) - cur_arm = (((kills * 3) > me->p_ship.s_maxarmies) ? - me->p_ship.s_maxarmies : (int) (kills * 3)); - else if (me->p_ship.s_type == STARBASE) - cur_arm = me->p_ship.s_maxarmies; + + if (!paradise && !F_armies_shipcap) + { + if (me->p_ship.s_type == ASSAULT) + cur_arm = (((kills * 3) > me->p_ship.s_maxarmies) ? + me->p_ship.s_maxarmies : (int) (kills * 3)); + else if (me->p_ship.s_type == STARBASE) + cur_arm = me->p_ship.s_maxarmies; + else + cur_arm = (((kills * 2) > me->p_ship.s_maxarmies) ? + me->p_ship.s_maxarmies : (int) (kills * 2)); + } else - cur_arm = (((kills * 2) > me->p_ship.s_maxarmies) ? - me->p_ship.s_maxarmies : (int) (kills * 2)); - - + { + if (me->p_ship.s_armies & 0x80) + cur_arm = (int) (kills * (me->p_ship.s_armies & 0x7f) / 10); + else + cur_arm = me->p_ship.s_maxarmies; + + if(cur_arm > me->p_ship.s_maxarmies) + cur_arm = me->p_ship.s_maxarmies; + } + if (fr || (old_arm != me->p_armies) || (old_cur_arm != cur_arm)) { W_ClearArea (tstatw, W_Textwidth/3 + 5 * (BAR_LENGTH + 5), 2, Index: data.c =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/src/data.c,v retrieving revision 1.109 retrieving revision 1.110 diff -u -d -r1.109 -r1.110 --- data.c 19 Apr 2008 16:22:58 -0000 1.109 +++ data.c 19 Apr 2008 20:03:00 -0000 1.110 @@ -772,6 +772,8 @@ int F_show_visibility_range = 0; int F_sp_flags_all = 0; int F_why_dead_2 = 0; +int F_terrain = 0; /* paradise */ +int F_armies_shipcap = 0; /* paradise */ #ifdef RECORDGAME int F_many_self = 0; Index: feature.c =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/src/feature.c,v retrieving revision 1.21 retrieving revision 1.22 diff -u -d -r1.21 -r1.22 --- feature.c 16 Apr 2008 00:08:11 -0000 1.21 +++ feature.c 19 Apr 2008 20:03:01 -0000 1.22 @@ -101,6 +101,10 @@ {"SHOW_VISIBILITY_RANGE", &F_show_visibility_range, 'S', 1, 0, 0}, {"SP_FLAGS_ALL", &F_sp_flags_all, 'S', 1, 0, 0}, {"WHY_DEAD_2", &F_why_dead_2, 'S', 1, 0, 0}, + /* paradise terrain features */ + {"TERRAIN", &F_terrain, 'S', 1, 0, 0}, + /* armies in paradise ship_cap_spacket */ + {"ARMIES_IN_SHIPCAP", &F_armies_shipcap, 'S', 1, 0, 0}, {0, 0, 0, 0, 0, 0} }; Index: map.c =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/src/map.c,v retrieving revision 1.64 retrieving revision 1.65 diff -u -d -r1.64 -r1.65 --- map.c 16 Apr 2008 00:08:17 -0000 1.64 +++ map.c 19 Apr 2008 20:03:04 -0000 1.65 @@ -1395,29 +1395,17 @@ /* Here I will have to compute end coordinate */ /* Server will sometimes send us this information though, so check if we have it first */ - if (!paradise && ph->ph_x > 0 && ph->ph_y > 0 && ph->ph_x < GWIDTH && ph->ph_y < GWIDTH) + if (ph->ph_x > 0 && ph->ph_y > 0 && ph->ph_x < GWIDTH && ph->ph_y < GWIDTH) { tx = ph->ph_x * GWINSIDE / GWIDTH; ty = ph->ph_y * GWINSIDE / GWIDTH; } else { - if (paradise) - { - /* Paradise servers changed the ship cap protocol for - phaser damage :( */ - tx = (int) (j->p_x + j->p_ship.s_phaserdamage - * Cos[ph->ph_dir]) * GWINSIDE / GWIDTH; - ty = (int) (j->p_y + j->p_ship.s_phaserdamage - * Sin[ph->ph_dir]) * GWINSIDE / GWIDTH; - } - else - { tx = (int) (j->p_x + PHASEDIST * j->p_ship.s_phaserdamage / 100 * Cos[ph->ph_dir]) * GWINSIDE / GWIDTH; ty = (int) (j->p_y + PHASEDIST * j->p_ship.s_phaserdamage / 100 * Sin[ph->ph_dir]) * GWINSIDE / GWIDTH; - } } break; case PHHIT2: From modemhero at users.sourceforge.net Sat Apr 19 15:03:02 2008 From: modemhero at users.sourceforge.net (Bill Balcerski) Date: Sat, 19 Apr 2008 20:03:02 +0000 Subject: [netrek-cvs] client/netrekxp/include data.h,1.99,1.100 Message-ID: <20080419200343.9C2F6B403@smtpgrey-2.real-time.com> Update of /cvsroot/netrek/client/netrekxp/include In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv6042/include Modified Files: data.h Log Message: Fixed phaser length bug with paradise servers. Paradise servers use different protocol for transmitting phaser damage to client. Added support for paradise feature packets for terrain and ship army cap. Cleaned up todo list. Index: data.h =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/include/data.h,v retrieving revision 1.99 retrieving revision 1.100 diff -u -d -r1.99 -r1.100 --- data.h 18 Apr 2008 03:42:36 -0000 1.99 +++ data.h 19 Apr 2008 20:03:00 -0000 1.100 @@ -668,6 +668,8 @@ extern int F_show_visibility_range; extern int F_sp_flags_all; extern int F_why_dead_2; +extern int F_terrain; /* paradise */ +extern int F_armies_shipcap; /* paradise */ #ifdef RECORDGAME extern int F_many_self; From modemhero at users.sourceforge.net Sat Apr 19 15:03:02 2008 From: modemhero at users.sourceforge.net (Bill Balcerski) Date: Sat, 19 Apr 2008 20:03:02 +0000 Subject: [netrek-cvs] client/netrekxp NetrekXP to do list.C, 1.163, 1.164 clientr.suo, 1.149, 1.150 Message-ID: <20080419200342.AF4923B408C@smtpgrey-1.real-time.com> Update of /cvsroot/netrek/client/netrekxp In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv6042 Modified Files: NetrekXP to do list.C clientr.suo Log Message: Fixed phaser length bug with paradise servers. Paradise servers use different protocol for transmitting phaser damage to client. Added support for paradise feature packets for terrain and ship army cap. Cleaned up todo list. Index: clientr.suo =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/clientr.suo,v retrieving revision 1.149 retrieving revision 1.150 diff -u -d -r1.149 -r1.150 Binary files /tmp/cvsddBbv4 and /tmp/cvsW8E9u0 differ Index: NetrekXP to do list.C =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/NetrekXP to do list.C,v retrieving revision 1.163 retrieving revision 1.164 diff -u -d -r1.163 -r1.164 --- NetrekXP to do list.C 18 Apr 2008 03:42:34 -0000 1.163 +++ NetrekXP to do list.C 19 Apr 2008 20:02:57 -0000 1.164 @@ -44,17 +44,12 @@ 3) A bunch of gridline/zoom options should be made into netrekrc options. 4) The galactic zoom doesn't work 5) Some of the paradise packet types may need some work -7) Still missing asteroids and (flashing) warpbeacons. -8) Show ratings on full/wide playerlist. -9) CV army capacity is wrong - waiting on word from server experts to the right value -11) Playing back recordings made by linux pclient is probably impossible. -12) Mysterious crash bug, not reproducible by me. -13) Issue with phaser misses on latest paradise server? on whitestar at least -14) Don't think there is gettarget support for astral bodies like nebulae and stars +6) Still missing asteroids and (flashing) warpbeacons. +7) Show ratings on full/wide playerlist. +8) Playing back recordings made by linux pclient is probably impossible. +9) Don't think there is gettarget support for astral bodies like nebulae and stars and black holes. Might be an issue with macros. -15) support variable # of ship types -16) add terrain feature packet -17) add POBSERV and PTQUEUE support +10) add POBSERV and PTQUEUE support Wish list: 1) Rewrite graphics engine using SDL