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 <errno.h> #include <time.h> #include <process.h> -#ifdef PARADISE #include <zlib.h> -#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)