Update of /cvsroot/netrek/client/netrekxp/src
In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv18320/src

Modified Files:
	dashboard.c data.c death.c enter.c input.c local.c mswindow.c 
	newwin.c playerlist.c ranklist.c socket.c 
Log Message:
Paradise only changes:
1) Colorized drone bitmaps by team.
2) Support for terrain, terrain info, status2, temp, exentension1, and game
conf packets.
3) Support for ranks and royalties, including paradise rank window.
Paradise changes with overall impact:
1) Added zdll.lib to linked libs, needed for uncompress of paradise terrain
packets.
Regular changes:
1) Wheel mouse up/down now is zoom in/out instead of accel/decel.
2) Bug fix for mono plasma and torp animations, last frame was being
cut off.

Index: mswindow.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/mswindow.c,v
retrieving revision 1.84
retrieving revision 1.85
diff -u -d -r1.84 -r1.85
--- mswindow.c	18 May 2007 19:54:38 -0000	1.84
+++ mswindow.c	25 May 2007 03:36:46 -0000	1.85
@@ -470,7 +470,7 @@
     free (oriteam);
     free (clockpic);
     free (clockhandpic);
-    
+
     for (j = 0; j < NUM_CTORP_TYPES; j++)
     {
         for (i = 0; i < BMP_TORPDET_FRAMES; i++)
@@ -580,8 +580,9 @@
 
 #ifdef PARADISE
     free (drone_bitmap);
-    free (dronec_bitmap);
-    free (mdronec_bitmap);
+    free (base_dronec_bitmap);
+    for (i = 0; i < NUM_CTORP_TYPES; i++)
+        free (dronec_bitmap[i]);
     free (base_drone_explosion_bitmap);
     for (i = 0; i < BMP_DRONEDET_FRAMES; i++)
         free (drone_explosion_bitmap[i]);

Index: dashboard.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/dashboard.c,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -d -r1.23 -r1.24
--- dashboard.c	18 May 2007 19:54:36 -0000	1.23
+++ dashboard.c	25 May 2007 03:36:46 -0000	1.24
@@ -1080,7 +1080,7 @@
     int obs = 0;
     int shieldtime = 0;
     int hulltime = 0;
-    int shieldneeded, hullneeded;
+    int shieldneeded = 0, hullneeded = 0;
     float shieldrate = 0.0, hullrate = 0.0;
     short planet;
     struct player *plr;

Index: newwin.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/newwin.c,v
retrieving revision 1.65
retrieving revision 1.66
diff -u -d -r1.65 -r1.66
--- newwin.c	18 May 2007 19:54:38 -0000	1.65
+++ newwin.c	25 May 2007 03:36:47 -0000	1.66
@@ -508,12 +508,12 @@
     drone_bitmap =
         W_StoreBitmap3 ("bitmaps/paradise/drone.bmp", BMP_DRONE_WIDTH,
                         BMP_DRONE_HEIGHT, BMP_DRONE, w, LR_MONOCHROME);
-    dronec_bitmap =
-        W_StoreBitmap3 ("bitmaps/paradise/droneC.bmp", BMP_DRONE_WIDTH,
+    base_dronec_bitmap =
+        W_StoreBitmap3 ("bitmaps/paradise/droneC.bmp", BMP_DRONE_WIDTH * NUM_CTORP_TYPES,
                         BMP_DRONE_HEIGHT, BMP_DRONEC, w, LR_DEFAULTCOLOR);
-    mdronec_bitmap =
-        W_StoreBitmap3 ("bitmaps/paradise/mdroneC.bmp", BMP_DRONE_WIDTH,
-                        BMP_DRONE_HEIGHT, BMP_MDRONEC, w, LR_DEFAULTCOLOR);
+    for (i = 0; i < NUM_CTORP_TYPES; i++)
+        dronec_bitmap[i] =
+            W_PointBitmap2 (base_dronec_bitmap, i, 0, BMP_DRONE_WIDTH, BMP_DRONE_HEIGHT);
 
     base_drone_explosion_bitmap =
         W_StoreBitmap3 ("bitmaps/paradise/dronecloud.bmp", BMP_DRONEDET_WIDTH,
@@ -975,7 +975,11 @@
 #endif
     W_SetWindowExposeHandler (planetw, planetlist);
 
+#ifdef PARADISE
+    rankw = W_MakeTextWindow ("rank", 10, 100, 80, nranks2 + 9, baseWin, 2);
+#else
     rankw = W_MakeTextWindow ("rank", 10, 300, 80, NUMRANKS + 9, baseWin, 2);
+#endif
     W_SetWindowExposeHandler (rankw, ranklist);
 
     playerw = W_MakeTextWindow ("player", 0, TWINSIDE + 2 * THICKBORDER + STATSIZE + 2 * BORDER,
@@ -1931,7 +1935,12 @@
     {
         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
         warning (buf);
     }
 
@@ -2273,7 +2282,7 @@
 /***  ClearMotd()
 /***   Free the current motdData
 /******************************************************************************/
-ClearMotd (void)
+void ClearMotd (void)
 {
     struct list *temp, *temp2;
 
@@ -2285,6 +2294,9 @@
         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 */

Index: input.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/input.c,v
retrieving revision 1.41
retrieving revision 1.42
diff -u -d -r1.41 -r1.42
--- input.c	18 May 2007 19:54:38 -0000	1.41
+++ input.c	25 May 2007 03:36:46 -0000	1.42
@@ -1732,7 +1732,24 @@
         bomb_planet ();
 #endif /* AUTOKEY */
     }
-
+    else if (data->key == W_WHEELUP)
+    {
+        scaleFactor -= 2;
+        if (scaleFactor < 10)
+            scaleFactor = 10;
+        W_FastClear = 1;
+        if (viewBox)
+            redrawall = 1;
+    }
+    else if (data->key == W_WHEELDOWN)
+    {
+        scaleFactor += 2;
+        if (scaleFactor > 40)
+            scaleFactor = 40;
+        W_FastClear = 1;
+        if (viewBox)
+            redrawall = 1;
+    }
 #ifdef SHIFTED_MOUSE
     else if (data->key == W_RBUTTON2)
     {

Index: local.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/local.c,v
retrieving revision 1.103
retrieving revision 1.104
diff -u -d -r1.103 -r1.104
--- local.c	18 May 2007 19:54:38 -0000	1.103
+++ local.c	25 May 2007 03:36:46 -0000	1.104
@@ -2527,8 +2527,10 @@
 void
 draw_one_thingy(struct thingy *k)
 {
+    struct player *j;
     int dx, dy;
     int frame;
+    int droneTeam;
     int view = scaleFactor * TWINSIDE / 2;
 
     if (k->t_shape == SHP_BLANK)
@@ -2554,6 +2556,7 @@
 	frame = image->frames - k->t_fuse;
 	break;*/
     case SHP_MISSILE:
+        j = &players[k->t_owner];
 #ifdef SOUND
         if (k->t_owner != me->p_no)
         {
@@ -2566,16 +2569,54 @@
             }   	
         }
 #endif
-	W_WriteScaleBitmap (dx - (BMP_DRONE_WIDTH / 2) * SCALE / scaleFactor,
-                            dy - (BMP_DRONE_HEIGHT / 2) * SCALE / scaleFactor,
-                            BMP_DRONE_WIDTH * SCALE / scaleFactor,
-                            BMP_DRONE_HEIGHT * SCALE / scaleFactor,
-                            BMP_DRONE_WIDTH,
-                            BMP_DRONE_HEIGHT,
-                            (360 * k->t_dir/255),
-                            (colorWeapons ? (myPlayer(&players[k->t_owner]) ? mdronec_bitmap : dronec_bitmap) : drone_bitmap),
-                            playerColor (&players[k->t_owner]),
-                            w);
+        if (colorWeapons)
+        {
+            if (myPlayer(j))
+                droneTeam = 0;
+            else
+            {
+                switch (j->p_team)
+                {
+                case FED:
+                    droneTeam = 1;
+                    break;
+                case KLI:
+                    droneTeam = 3;
+                    break;
+                case ORI:
+                    droneTeam = 4;
+                    break;
+                case ROM:
+                    droneTeam = 5;
+                    break;
+                default: // IND
+                    droneTeam = 2;
+                }
+            }
+	    W_WriteScaleBitmap (dx - (BMP_DRONE_WIDTH / 2) * SCALE / scaleFactor,
+                                dy - (BMP_DRONE_HEIGHT / 2) * SCALE / scaleFactor,
+                                BMP_DRONE_WIDTH * SCALE / scaleFactor,
+                                BMP_DRONE_HEIGHT * SCALE / scaleFactor,
+                                BMP_DRONE_WIDTH,
+                                BMP_DRONE_HEIGHT,
+                                (360 * k->t_dir/255),
+                                dronec_bitmap[droneTeam],
+                                playerColor (j),
+                                w);
+        }
+        else
+        {
+	    W_WriteScaleBitmap (dx - (BMP_DRONE_WIDTH / 2) * SCALE / scaleFactor,
+                                dy - (BMP_DRONE_HEIGHT / 2) * SCALE / scaleFactor,
+                                BMP_DRONE_WIDTH * SCALE / scaleFactor,
+                                BMP_DRONE_HEIGHT * SCALE / scaleFactor,
+                                BMP_DRONE_WIDTH,
+                                BMP_DRONE_HEIGHT,
+                                (360 * k->t_dir/255),
+                                drone_bitmap,
+                                playerColor (j),
+                                w);
+        }
         clearzone[0][clearcount] = dx - (BMP_DRONE_WIDTH / 2) * SCALE / scaleFactor - 1;
         clearzone[1][clearcount] = dy - (BMP_DRONE_HEIGHT / 2) * SCALE / scaleFactor - 1;
         clearzone[2][clearcount] = BMP_DRONE_WIDTH * SCALE / scaleFactor + 2;
@@ -2647,7 +2688,7 @@
                             BMP_DRONEDET_WIDTH,
                             BMP_DRONEDET_HEIGHT,
                             0,
-                            drone_explosion_bitmap[frame],
+                            colorWeapons ? dronec_explosion_bitmap[frame] : drone_explosion_bitmap[frame],
                             playerColor (&players[k->t_owner]),
                             w);
         clearzone[0][clearcount] = dx - (BMP_DRONEDET_WIDTH / 2) * SCALE / scaleFactor ;

Index: enter.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/enter.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- enter.c	18 May 2007 19:54:37 -0000	1.11
+++ enter.c	25 May 2007 03:36:46 -0000	1.12
@@ -53,6 +53,10 @@
     plasmatorps = universe.plasmatorps;
 #ifdef PARADISE
     thingies = universe.thingies;
+    ranks2 = universe.ranks2;
+    teaminfo = universe.teaminfo;
+    royal = universe.royal;
+    status2 = universe.status2;
 #endif
     status = universe.status;
     planets = universe.planets;

Index: death.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/death.c,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -d -r1.20 -r1.21
--- death.c	17 May 2007 08:49:48 -0000	1.20
+++ death.c	25 May 2007 03:36:46 -0000	1.21
@@ -90,7 +90,11 @@
     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
         W_WriteText (w, 50, 80, W_Yellow, rankmessage,
                      strlen (rankmessage), W_BoldFont);
     }

Index: playerlist.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/playerlist.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- playerlist.c	18 May 2007 19:54:39 -0000	1.14
+++ playerlist.c	25 May 2007 03:36:47 -0000	1.15
@@ -1129,12 +1129,20 @@
             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
             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
             buffPoint += 10;
             break;
 

Index: ranklist.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/ranklist.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- ranklist.c	2 Apr 2007 21:12:42 -0000	1.3
+++ ranklist.c	25 May 2007 03:36:47 -0000	1.4
@@ -72,9 +72,48 @@
         return (-1);
 }
 
+#ifdef PARADISE
+void
+print_ranks_paradise(void)
+{
+    register int i;
+    char    buf[80];
+
+    W_ResizeTextWindow(rankw, 65, nranks2 + 8);
+
+    (void) strcpy(buf, "  Rank       genocides  DI    battle strategy  special ships");
+    W_WriteText(rankw, 1, 1, textColor, buf, strlen(buf), W_BoldFont);
+    for (i = 0; i < nranks2; i++) {
+	sprintf(buf, "%-11.11s %5d %8.2f %8.2f %8.2f   %7.2f",
+		ranks2[i].name,
+		ranks2[i].genocides,
+		ranks2[i].di,
+		ranks2[i].battle,
+		ranks2[i].strategy,
+		ranks2[i].specship);
+	if (mystats->st_rank == i) {
+	    W_WriteText(rankw, 1, i + 2, W_Cyan, buf, strlen(buf), W_BoldFont);
+	} else {
+	    W_WriteText(rankw, 1, i + 2, textColor, buf, strlen(buf), W_RegularFont);
+	}
+    }
+    strcpy(buf, "To achieve a rank, you need a high enough number of");
+    W_WriteText(rankw, 1, i + 3, textColor, buf, strlen(buf), W_RegularFont);
+    strcpy(buf, "genocides, a high enough DI, a high enough battle");
+    W_WriteText(rankw, 1, i + 4, textColor, buf, strlen(buf), W_RegularFont);
+    strcpy(buf, "rating, a high enough strategy rating, and a high");
+    W_WriteText(rankw, 1, i + 5, textColor, buf, strlen(buf), W_RegularFont);
+    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
     register int i;
     char buf[100];
 
@@ -126,4 +165,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: data.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/data.c,v
retrieving revision 1.94
retrieving revision 1.95
diff -u -d -r1.94 -r1.95
--- data.c	18 May 2007 19:54:37 -0000	1.94
+++ data.c	25 May 2007 03:36:46 -0000	1.95
@@ -27,6 +27,7 @@
 #ifdef PARADISE
 struct status2 *status2;
 struct thingy *thingies;
+struct t_unit *terrainInfo;
 #endif
 struct ship *myship;
 struct stats *mystats;
@@ -275,6 +276,9 @@
 extern double Sin[], Cos[];
 
 #ifdef PARADISE
+int received_terrain_info = 0;
+int terrain_x;
+int terrain_y;
 int gwidth = GWIDTH;			/* galaxy width, adjusted for zoom [BDyess] */
 int offsetx = 0;
 int offsety = 0;			/* offsets when zooming [BDyess] */
@@ -341,7 +345,9 @@
 
 // Paradise bitmaps
 #ifdef PARADISE
-W_Icon drone_bitmap, dronec_bitmap, mdronec_bitmap;
+W_Icon drone_bitmap;
+W_Icon base_dronec_bitmap;
+W_Icon dronec_bitmap[NUM_CTORP_TYPES];
 W_Icon base_drone_explosion_bitmap;
 W_Icon drone_explosion_bitmap[BMP_DRONEDET_FRAMES];
 W_Icon base_dronec_explosion_bitmap;
@@ -440,6 +446,12 @@
     {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: socket.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/socket.c,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -d -r1.34 -r1.35
--- socket.c	18 May 2007 19:54:39 -0000	1.34
+++ socket.c	25 May 2007 03:36:47 -0000	1.35
@@ -19,6 +19,9 @@
 #include <errno.h>
 #include <time.h>
 #include <process.h>
+#ifdef PARADISE
+#include <zlib.h>
+#endif
 
 #include "Wlib.h"
 #include "defs.h"
@@ -2784,7 +2787,6 @@
 
 void handleStatus2 (struct status_spacket2 *packet)
 {
-/*
     updatePlayer[me->p_no] |= LARGE_UPDATE;
     if (infomapped && infotype == PLAYERTYPE &&
 	((struct player *) infothing)->p_no == me->p_no)
@@ -2806,7 +2808,6 @@
     status2->jstime = ntohl(packet->jstime);
     status2->time = ntohl(packet->time);
     status2->timeprod = ntohl(packet->timeprod);
-*/
 }
 
 void handlePlanet2 (struct planet_spacket2 *packet)
@@ -2852,7 +2853,7 @@
 
 void handleTerrainInfo2 (struct terrain_info_packet2 *pkt)
 {
-/*
+
 #ifdef ZDIAG2
     fprintf( stderr, "Receiving terrain info packet\n" );
     fprintf( stderr, "Terrain dims: %d x %d\n", ntohs(pkt->xdim), ntohs(pkt->ydim) );
@@ -2860,12 +2861,11 @@
     received_terrain_info = TERRAIN_STARTED;
     terrain_x = ntohs(pkt->xdim);
     terrain_y = ntohs(pkt->ydim);
-*/
+
 }; 
 
 void handleTerrain2 (struct terrain_packet2 *pkt)
 {
-/*
     static int curseq = 0, totbytes = 0, done = 0;
     int i;
 #if defined(ZDIAG) || defined(ZDIAG2)
@@ -2879,7 +2879,7 @@
     static unsigned char *gzipTerrain = NULL, *orgTerrain = NULL;
     
 #ifdef ZDIAG2
-    fprintf( stderr, "Receiving Terrain packet.  This should be %d.\n", curseq+1 );
+    LineToConsole("Receiving Terrain packet.  This should be %d.\n", curseq+1 );
 #endif
 
     if( (done == TERRAIN_DONE) && (received_terrain_info == TERRAIN_STARTED ) ){
@@ -2896,16 +2896,16 @@
     if( (curseq != pkt->sequence) || !(received_terrain_info) ){
       // Should fill in a list of all packets missed
       // or request header packet from server
-      fprintf( stderr, "Blech!  Received terrain packet before terrain_info\n" );
+      LineToConsole("Blech!  Received terrain packet before terrain_info\n" );
       return;
     }
 #ifdef ZDIAG2
-    fprintf( stderr, "Receiving packet %d out of %d\n", curseq, pkt->total_pkts );
+    LineToConsole("Receiving packet %d out of %d\n", curseq, pkt->total_pkts );
 #endif
     if( !gzipTerrain ){
       gzipTerrain = (unsigned char *)malloc( pkt->total_pkts << 7 );
 #if defined(ZDIAG) || defined(ZDIAG2)
-      fprintf( stderr, "Allocating %d bytes for gzipTerrain.\n", pkt->total_pkts << 7 );
+      LineToConsole("Allocating %d bytes for gzipTerrain.\n", pkt->total_pkts << 7 );
 #endif
 		// another yukko constant
     }
@@ -2913,13 +2913,13 @@
       orgTerrain = (unsigned char *)malloc( terrain_x*terrain_y );
       dlen = terrain_x * terrain_y;
 #if defined(ZDIAG) || defined(ZDIAG2)
-      fprintf( stderr, "Allocating %d bytes for orgTerrain.\n", dlen );
+      LineToConsole("Allocating %d bytes for orgTerrain.\n", dlen );
 #endif
     }
     for( i = 0; i < pkt->length; i++ ){
 #ifdef ZDIAG2
       if( !(i%10) ){
-        fprintf( stderr, "Params: %d, %d\n", ((curseq-1)<<7)+i, i );
+        LineToConsole("Params: %d, %d\n", ((curseq-1)<<7)+i, i );
       }
 #endif
       gzipTerrain[((curseq-1)<<7)+i] = pkt->terrain_type[i];
@@ -2930,23 +2930,23 @@
       status = uncompress( orgTerrain, &dlen, gzipTerrain, totbytes );
       if( status != Z_OK ){
         if( status == Z_BUF_ERROR ){
-          fprintf( stderr, "Unable to uncompress -- Z_BUF_ERROR.\n" );
+          LineToConsole("Unable to uncompress -- Z_BUF_ERROR.\n" );
         }
         if( status == Z_MEM_ERROR ){
-          fprintf( stderr, "Unable to uncompress -- Z_MEM_ERROR.\n" );
+          LineToConsole("Unable to uncompress -- Z_MEM_ERROR.\n" );
         }
         if( status = Z_DATA_ERROR ){
-          fprintf( stderr, "Unable to uncompress -- Z_DATA_ERROR!\n" );
+          LineToConsole("Unable to uncompress -- Z_DATA_ERROR!\n" );
         }
       }
       else{
-        fprintf( stderr, "Total zipped terrain received: %d bytes\n", totbytes );
+        LineToConsole("Total zipped terrain received: %d bytes\n", totbytes );
       }
 #else
       uncompress( orgTerrain, &dlen, gzipTerrain, totbytes );
 #endif
       terrainInfo = (struct t_unit *)malloc( dlen * sizeof( struct t_unit ) );
-      for( i = 0; i < dlen; i++ ){
+      for( i = 0; i < (long) dlen; i++ ){
         terrainInfo[i].types = orgTerrain[i];
 #ifdef ZDIAG2
 	sum |= orgTerrain[i];
@@ -2957,21 +2957,18 @@
       }
       done = received_terrain_info = TERRAIN_DONE;
 #ifdef ZDIAG2
-      fprintf( stderr, "Sum = %d, numnz = %d\n", sum, numnz );
+      LineToConsole("Sum = %d, numnz = %d\n", sum, numnz );
 #endif
     }
-*/
 }    
 
 void handleTempPack (struct obvious_packet *packet)
 {
-/*
     struct obvious_packet reply;
-    // printf("New MOTD info available\n");
-    erase_motd();
+    // LineToConsole("New MOTD info available\n");
+    ClearMotd();
     reply.type = CP_ASK_MOTD;
     sendServerPacket((struct player_spacket *) & reply);
-*/
 }
 
 /* handlers for the extension1 packet */
@@ -2993,13 +2990,10 @@
 
 void handleExtension1 (struct paradiseext1_spacket *packet)
 {
-/*
     switch (packet->subtype) {
     case SP_PE1_MISSING_BITMAP:
 	{
-	    struct pe1_missing_bitmap_spacket *pkt =
-	    (struct pe1_missing_bitmap_spacket *) packet;
-
+	    struct pe1_missing_bitmap_spacket *pkt = (struct pe1_missing_bitmap_spacket *) packet;
 	    newMotdPic(ntohs(pkt->x), ntohs(pkt->y), ntohs(pkt->width), ntohs(pkt->height), 0, ntohs(pkt->page));
 	}
 	break;
@@ -3007,13 +3001,12 @@
 	me->p_totmissiles = ntohs(((struct pe1_num_missiles_spacket *) packet)->num);
 	// printf("updated totmissiles to %d\n",me->p_totmissiles);
 	if (me->p_totmissiles < 0)
-	    me->p_totmissiles = 0;	// SB/WB have
+	    me->p_totmissiles = 0;	// SB/WB have -1
 	break;
     default:
 	printf("unknown paradise extension packet 1 subtype = %d\n",
 	       packet->subtype);
     }
-*/
 }
 void handleThingy (struct thingy_spacket *packet)
 {
@@ -3133,7 +3126,7 @@
     free_phasers();
     free_plasmas();
     free_thingies();
-
+*/
     nplayers = pkt->nplayers;
     number_of_teams = pkt->nteams;
     // shiptypes
@@ -3144,7 +3137,7 @@
     nplasmas = pkt->nplasmas;
     npthingies = pkt->nthingies;
     ngthingies = pkt->gthingies;
-
+/*
     // gwidth
     // flags
 
@@ -3163,11 +3156,10 @@
 
 void handleGPteam (struct gp_team_spacket *pkt)
 {
-/*
     struct teaminfo_s *currteam;
 
     if ((int) pkt->index >= number_of_teams) {
-	fprintf(stderr, "Team #%d %s is out of range (0..%d)\n", pkt->index,
+	LineToConsole ("Team #%d %s is out of range (0..%d)\n", pkt->index,
 		pkt->teamname, number_of_teams);
 	return;
     }
@@ -3180,25 +3172,23 @@
 
     strncpy(currteam->name, pkt->teamname, sizeof(currteam->name) - 1);
     currteam->name[sizeof(currteam->name) - 1] = 0;
-*/
 }
 
 void handleGPteamlogo (struct gp_teamlogo_spacket *pkt)
 {
-/*
     static char buf[13 * 99];	// 99x99
     static int curr_height = 0;
     static int lwidth, lheight;
     static int teamindex;
     int     pwidth;
 
-    if ((unsigned) pkt->teamindex >= number_of_teams) {
-	fprintf(stderr, "Team #%d is out of range (0..%d)\n", pkt->teamindex,
+    if (pkt->teamindex >= number_of_teams) {
+	LineToConsole ("Team #%d is out of range (0..%d)\n", pkt->teamindex,
 		number_of_teams);
 	return;
     }
     if (pkt->y != curr_height) {
-	fprintf(stderr, "Bad gp_teamlogo packet sequence y(%d) != curr_height(%d)\n",
+	LineToConsole ("Bad gp_teamlogo packet sequence y(%d) != curr_height(%d)\n",
 		pkt->y, curr_height);
 	curr_height = 0;
 	return;
@@ -3206,7 +3196,7 @@
     if (curr_height) {
 	if (lwidth != pkt->logowidth || lheight != pkt->logoheight ||
 	    teamindex != pkt->teamindex) {
-	    fprintf(stderr, "gp_teamlogo packet sequence error, %d!=%d || %d!=%d || %d!=%d\n",
+	    LineToConsole ("gp_teamlogo packet sequence error, %d!=%d || %d!=%d || %d!=%d\n",
 		    lwidth, pkt->logowidth, lheight, pkt->logoheight,
 		    teamindex, pkt->teamindex);
 	    curr_height = 0;
@@ -3217,7 +3207,7 @@
 	lwidth = pkt->logowidth;
 	lheight = pkt->logoheight;
 	if (lwidth > 99 || lheight > 99) {
-	    fprintf(stderr, "logo too big (%dx%d), rejecting\n", lwidth, lheight);
+	    LineToConsole ("logo too big (%dx%d), rejecting\n", lwidth, lheight);
 	    curr_height = 0;
 	    return;
 	}
@@ -3228,24 +3218,22 @@
     curr_height += pkt->thisheight;
 
     if (curr_height >= lheight) {
-	W_FreeImage(teaminfo[teamindex].shield_logo);
+	free (teaminfo[teamindex].shield_logo);
 	teaminfo[teamindex].shield_logo = 
-	                                W_BitmapToImage(lwidth, lheight, buf);
+	                                 W_StoreBitmap(lwidth, lheight, buf, w);
 	curr_height = 0;
     }
-*/
 }
 
 void handleGPshipshape (struct gp_shipshape_spacket *pkt)
 {
-/*
     if (pkt->race < -1 || pkt->race >= number_of_teams) {
-	fprintf(stderr, "race #%d out of range (-1..%d)\n", pkt->race,
+	LineToConsole ("race #%d out of range (-1..%d)\n", pkt->race,
 		number_of_teams - 1);
 	return;
     }
     if ( (int) pkt->shipno >= nshiptypes) {
-	fprintf(stderr, "ship class #%d out of range (0..%d)\n", pkt->shipno,
+	LineToConsole ("ship class #%d out of range (0..%d)\n", pkt->shipno,
 		nshiptypes - 1);
 	return;
     }
@@ -3253,34 +3241,30 @@
     replace_shipshape(pkt->race, pkt->shipno, pkt->nviews,
 		      pkt->width, pkt->height);
 #endif
-*/
 }
 
 void handleGPshipbitmap (struct gp_shipbitmap_spacket *pkt)
 {
-/*
     if (pkt->race < -1 || pkt->race >= number_of_teams) {
-	fprintf(stderr, "race #%d out of range (-1..%d)\n", pkt->race,
+	LineToConsole ("race #%d out of range (-1..%d)\n", pkt->race,
 		number_of_teams - 1);
 	return;
     }
     if ( (int) pkt->shipno >= nshiptypes) {
-	fprintf(stderr, "ship class #%d out of range (0..%d)\n", pkt->shipno,
+	LineToConsole ("ship class #%d out of range (0..%d)\n", pkt->shipno,
 		nshiptypes - 1);
 	return;
     }
 #ifdef FIXME
     replace_ship_bitmap(pkt->race, pkt->shipno, pkt->thisview, pkt->bitmapdata);
 #endif
-*/
 }
 
 void handleGPrank (struct gp_rank_spacket *pkt)
 {
-/*
     struct rank2 *curr;
     if (pkt->rankn >= nranks2) {
-	fprintf(stderr, "rank #%d %s out of range (0..%d)\n", pkt->rankn,
+	LineToConsole("rank #%d %s out of range (0..%d)\n", pkt->rankn,
 		pkt->name, nranks2 - 1);
 	return;
     }
@@ -3288,25 +3272,22 @@
     free(curr->name);
 
     curr->genocides = htonl(pkt->genocides);
-    curr->di = htonl(pkt->milliDI) / 1000.0;
-    curr->battle = htonl(pkt->millibattle) / 1000.0;
-    curr->strategy = htonl(pkt->millistrat) / 1000.0;
-    curr->specship = htonl(pkt->millispec) / 1000.0;
+    curr->di = htonl(pkt->milliDI) / (float) 1000.0;
+    curr->battle = htonl(pkt->millibattle) / (float) 1000.0;
+    curr->strategy = htonl(pkt->millistrat) / (float) 1000.0;
+    curr->specship = htonl(pkt->millispec) / (float) 1000.0;
     curr->name = strdup(pkt->name);
-*/
 }
 
 void handleGProyal (struct gp_royal_spacket *pkt)
 {
-/*
     if ((int) pkt->rankn >= nroyals) {
-	fprintf(stderr, "Royalty #%d %s out of range (0..%d)\n", pkt->rankn,
+	LineToConsole("Royalty #%d %s out of range (0..%d)\n", pkt->rankn,
 		pkt->name, nroyals - 1);
 	return;
     }
     free(royal[pkt->rankn].name);
     royal[pkt->rankn].name = strdup(pkt->name);
-*/
 }
 
 #ifdef FIXME
@@ -3329,7 +3310,6 @@
 
 void handleGPteamplanet (struct gp_teamplanet_spacket *pkt)
 {
-/*
 #ifdef FIXME
     {
 #define	TACTICALSIZE	sizeof(pkt->tactical)
@@ -3375,7 +3355,6 @@
 #undef GALACTICSIZE
     }
 #endif
-*/
 }
 
 void handleGameparams (struct gameparam_spacket *packet)