Update of /cvsroot/netrek/client/netrekxp/include
In directory sc8-pr-cvs16:/tmp/cvs-serv31445/include

Modified Files:
	bitmaps.h data.h defs.h packets.h proto.h struct.h wlib.h 
Log Message:
A bunch of paradise additions, mostly separated by #ifdef's but a few things
impact outside that condition, which are listed below.
1) Added paradise ships (CL, CV, FL, JS, PT, UT, WB) bitmap set and
bitmaps for stars (local and map).
2) New function W_WriteRectangle, only used in paradise gridbox
drawing, but it's available for general use.
3) Removed unused PLCLEAR flag.  It overlapped with a paradise flag,
and it wasn't used at all with current code so I just removed it.
4) Moved the redrawall = 0 from near top of main map function to bottom.
I don't see any harm in doing this, and it was necessary to get a paradise
draw function to work.
5) The BIGBITMAP_WIDTH size was changed from 240x240 to 500x500
to accomodate MOTD pics from paradise servers.  Again I don't see any
harm in increasing size.  And this wasn't even used with bitmap storage,
the StoreBitmap() function had been completely phased out.
Along the way of adding in paradise functionality, numerous problems with
defines have come up, ie MAXSECTOR, GWIDTH, ship array, and most
seriously, overlapping packet types.
There are also very serious problems with overlapping p_flag and p_status
values, namely observers overlap with warp states and tournament queue
status.  Some p_whydead messages also overlap.  Also paradise servers
send phaser damage caps differently.
Things that could use work are the motd paging system (gutted it for sake
of simplicity), planet window (paradise has 2 planet windows, also sorting
doesn't work), a bunch of gridline/zoom options should be made into
netrekrc options.  The galactic zoom doesn't work.  Ships disappear while
warping (due to the aforementioned problem with PFOBSERV overlap
with PFWARP).  Most of the paradise packet types, including special
weapons and game parameters, are still not handled.  Gwidth is not
malleable based on paradise vs bronco server.  No color ship bitmaps
were added.  No special items other than stars were added.  No new
weapon types like fighters were added.  A bunch of keys like afterburners
and engage warp don't exist.  Info windows and rank windows not
working right with paradise.

Index: bitmaps.h
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/include/bitmaps.h,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -d -r1.18 -r1.19
--- bitmaps.h	7 Apr 2007 11:35:26 -0000	1.18
+++ bitmaps.h	17 May 2007 08:49:47 -0000	1.19
@@ -26,7 +26,9 @@
 #define BMP_KLI_SHIP 3
 #define BMP_ROM_SHIP 5
 #define BMP_IND_SHIP 2
-
+#ifdef PARADISE
+#define BMP_PSHIP 6
+#endif
 
 // Weapons
 // -------
@@ -188,3 +190,13 @@
 #define BMP_CPLANET_HEIGHT 120
 
 #define CPLANET_VIEWS 16
+
+#ifdef PARADISE
+#define BMP_STAR 12
+#define BMP_MSTAR 13
+#define BMP_STAR_WIDTH 30
+#define BMP_STAR_HEIGHT 30
+#define BMP_MSTAR_WIDTH 16
+#define BMP_MSTAR_HEIGHT 16
+#define STAR_VIEWS 5
+#endif

Index: defs.h
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/include/defs.h,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -d -r1.25 -r1.26
--- defs.h	16 May 2007 00:05:11 -0000	1.25
+++ defs.h	17 May 2007 08:49:47 -0000	1.26
@@ -9,6 +9,8 @@
 #include "copyright.h"
 
 #ifdef PARADISE
+#define GRIDSIZE 33333
+
 /* defs for updatePlayer [BDyess] */
 #define NO_UPDATE	0
 #define SMALL_UPDATE	1	/* update non-blk_bozo players */
@@ -110,7 +112,11 @@
                                 /* At this range a player can be
                                    seen while visible (uncloaked) */
 
+#ifdef PARADISE
+#define MAXSECTORS 20
+#else
 #define MAXSECTORS 10           /* Max # of star sectors */
+#endif
 #define MAXSTARS 100            /* Max # of stars in a sector */
 
 /* 6 minutes is maximum for autoquit -- anything more causes problems in the

Index: packets.h
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/include/packets.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- packets.h	16 May 2007 00:05:12 -0000	1.8
+++ packets.h	17 May 2007 08:49:47 -0000	1.9
@@ -1292,7 +1292,154 @@
     char   type;
     char   subtype;		/* this packet is not real */
     /* generic game parameter packet */
-    int pad;
+    short pad;
 };
 
+struct gp_sizes_spacket {
+    char    type;
+    char    subtype;		/* =0 */
+
+    char   nplayers;
+    char   nteams;		/* max of 8 */
+
+    char   nshiptypes;
+    char   nranks;		/* number of ranks */
+    char   nroyal;		/* number of royalties */
+    char   nphasers;
+
+    char   ntorps;
+    char   nplasmas;
+    char   nthingies;		/* per-player */
+    char   gthingies;		/* auxiliary thingies */
+
+    unsigned int  gwidth;		/* galaxy width */
+    /* 16 bytes */
+    unsigned int  flags;		/* some game parameter flags */
+#define	GP_WRAPVERT	(1<<0)
+#define	GP_WRAPHORIZ	(1<<1)
+#define GP_WRAPALL	(GP_WRAPVERT|GP_WRAPHORIZ)
+
+    /*
+       The following bytes are room for growth. The size of this packet is
+       unimportant because it only gets sent once.  hopefully we've got
+       plenty of room.
+    */
+    int   ext1;		/* maybe more flags? */
+    int   ext2;
+    int   ext3;
+    /* 32 bytes */
+
+    int   ext4;
+    int   ext5;
+    int   ext6;
+    int   ext7;
+
+    int   ext8;
+    int   ext9;
+    int   ext10;
+    int   ext11;		/* 16 ints, 64 bytes */
+};
+
+struct gp_team_spacket {
+    char    type;
+    char    subtype;		/* =1 */
+
+    char   index;		/* team index */
+    char    letter;		/* team letter 'F' */
+
+    char    shortname[3];	/* non-null-terminated 3-letter abbrev 'FED' */
+    char   pad;
+    /* 8 bytes */
+    char    teamname[56];	/* padding to 64 byte packet */
+};
+
+struct gp_teamlogo_spacket {
+    /*
+       This packet contains several adjacent rows of a team's logo bitmap
+       Data is in raw XBM format (scanline-padded to 8 bits). Maximum bitmap
+       size is 99x99, which takes 1287 (99x13) bytes.
+    */
+    char    type;
+    char    subtype;		/* =2 */
+
+    char    logowidth;		/* <= 99 */
+    char    logoheight;		/* <= 99 */
+
+    char    y;			/* y coord of the start of this packets info */
+    char    thisheight;		/* the height of this packet's info */
+    char    teamindex;		/* which team's logo this is */
+
+    char    data[768 - 7];	/* pad packet to 768 bytes. */
+};
+
+struct gp_shipshape_spacket {
+    char    type;
+    char    subtype;		/* =3 */
+
+    char   shipno;
+    char    race;		/* -1 is independent */
+    char   nviews;		/* typically 16 */
+
+    char   width, height;
+    char   pad1;
+};
+
+struct gp_shipbitmap_spacket {
+    char    type;
+    char    subtype;		/* =4 */
+
+    char   shipno;
+    char    race;		/* -1 is independent */
+    char   thisview;		/* 0..nviews-1 */
+
+    char   bitmapdata[999];
+};
+
+struct gp_rank_spacket {
+    char    type;
+    char    subtype;		/* =5 */
+
+    char    rankn;		/* rank number */
+
+    char    name[-3 + 64 - 20];	/* name of the rank */
+
+    int   genocides;
+    int   milliDI;		/* DI*1000 */
+    int   millibattle;	/* battle*1000 */
+    int   millistrat;		/* strategy*1000 */
+    int   millispec;		/* special ships*1000 */
+};
+
+struct gp_royal_spacket {
+    char    type;
+    char    subtype;		/* =6 */
+
+    char   rankn;		/* rank number */
+
+    char    name[-3 + 64];	/* name of the rank */
+};
+
+struct gp_teamplanet_spacket {
+    char    type;
+    char    subtype;		/* =7 */
+
+    char    teamn;		/* 0..7 */
+    char   pad1;
+
+    int   ext1;		/* extensions? */
+
+    /*
+       Bitmaps of the team logo and masks.  The bitmap of the planet will be
+       constructed with (mask ? logo : planet), applied bitwise. This
+       calculation is equivalent to (logo&mask)|(planet&~mask)
+    */
+
+    /* bitmap 30x30, X bitmap format (scanline padded to 8 bits) */
+    char   tactical[120];
+    char   tacticalM[120];
+
+    /* bitmap 16x16, X bitmap format (scanline padded to 8 bits) */
+    char   galactic[32];
+    char   galacticM[32];
+};
 #endif

Index: struct.h
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/include/struct.h,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -d -r1.19 -r1.20
--- struct.h	16 May 2007 00:05:13 -0000	1.19
+++ struct.h	17 May 2007 08:49:47 -0000	1.20
@@ -71,6 +71,32 @@
     int     gameup;		/* is game up */
     unsigned long clock;	/* clock for planet info timestamp */
 };
+
+struct teaminfo_s {
+    char    name[32];		/* this is not meant to limit the length of
+				   team names */
+    W_Icon  shield_logo;	/* logo that appears in the team choice
+				   window */
+    char    letter;		/* 1-letter abbreviation */
+    char    shortname[4];	/* 3-letter abbreviation */
+};
+
+/* MOTD structures */
+struct piclist {
+    int     page;
+    W_Icon  thepic;
+    int     x, y;
+    int     width, height;
+    struct piclist *next;
+};
+struct page {
+    struct list *text;
+    struct page *next;
+    struct page *prev;
+    int     first;
+    int     page;
+};
+
 #endif
 
 enum dist_type
@@ -161,6 +187,15 @@
 #define PFPRESS  	0x800000        /* pressor beam activated */
 #define PFDOCKOK	0x1000000       /* docking permission */
 #define PFSEEN      0x2000000       /* seen by enemy on galactic map? */
+#ifdef PARADISE
+/* Note overlap with PFWARP/PFOBSERV and PFSNAKE/PFTWARP */
+#define PFWARPPREP	  (1<<26)	/* in warp prep [BDyess] */
+#define PFWARP		  (1<<27)	/* ship warping */
+#define PFAFTER		  (1<<28)	/* after burners on */
+#define PFWPSUSPENDED     (1<<29)	/* warp prep suspended [BDyess] */
+#define PFSNAKE	          (1<<30)	/* it's a space snake */
+#define PFBIRD	          (1<<31)	/* it's a space bird */
+#endif
 #define PFOBSERV	0x8000000       /* for observers */
 #define PFTWARP     0x40000000      /* transwarping to base */
 
@@ -183,7 +218,33 @@
 #define KTORP2      0x10    /* killed by detted torps */
 #define KSHIP2      0x11    /* chain-reaction explosions */
 #define KPLASMA2    0x12    /* killed by zapped plasma */
+#ifdef PARADISE
+#define KMISSILE      0x10    /* missile, note the overlap with KTORP2! */
+#define KASTEROID     0x11    /* asteroid, note the overlap with KSHIP2! */
+#endif
 
+#ifdef PARADISE
+#define NUM_TYPES 15
+#define NUM_PSHIP_TYPES 7
+#define PARADISE_SHIP_OFFSET 7	/* To make jumpship first entry in the paradise ship bitmap array */
+#define SCOUT 0
+#define DESTROYER 1
+#define CRUISER 2
+#define BATTLESHIP 3
+#define ASSAULT 4
+#define STARBASE 5
+#define ATT 6
+#define SGALAXY 6		/* galaxy ships now supported - they look
+				   extremely similar to flagships :) [BDyess] */
+#define JUMPSHIP 7
+#define FLAGSHIP 8
+#define WARBASE 9
+#define LIGHTCRUISER 10
+#define CARRIER 11
+#define UTILITY 12
+#define PATROL 13
+#define PUCK 14
+#else
 #define NUM_TYPES 8
 #define SCOUT 0
 #define DESTROYER 1
@@ -193,6 +254,7 @@
 #define STARBASE 5
 #define SGALAXY	6
 #define ATT	7
+#endif
 
 struct ship
 {
@@ -446,6 +508,94 @@
  * are in a 'known' order.  Ten planets per team, the first being the home
  * planet. */
 
+#ifdef PARADISE
+/*
+   pl_flags is an int of 32 bits:
+
+   bits 16 and 23 currently define the type of the planet.  The
+   interpretation of the other bits is dependent upon the planet
+   type.
+
+   Here is the interpretation for a planet
+   bits 0..3			unknown
+   bits 4..6			planetary facilities (REPAIR,FUEL,AGRI)
+   bit  7			redraw (archaic, recyclable?)
+   bits 8..11			old flags (archaic, recyclable?)
+   bits 12..15			paradise planetary facilities
+				(REPAIR,FUEL,AGRI,SHIPY)
+   bit  16			cosmic object type (also bit 23)
+   bits 17,18			planet atmosphere type
+   bits 19..21			planetary surface properties
+				(DILYTH,METAL,ARABLE)
+   bit  22			paradise planet flag (why?)
+   bits 23,24			cosmic object type (also bit 16)
+   bits 25..31	currently unallocated (7 bits to play with)
+
+   Asteroids are NYI but here is a draft standard:
+   bits 12,15			facilities
+				(REPAIR,FUEL,SHIPY)
+   bit  20			surface properties
+				(DILYTH,METAL)
+   other bits	currently unallocated
+
+   */
+
+/* facilities, bits 4..6 and 12..15
+   valid for planets and asteroids */
+#define PLREPAIR   ((1<<12) | (1<<4))	/* planet can repair ships */
+#define PLFUEL     ((1<<13) | (1<<5))	/* planet has fuel depot */
+#define PLAGRI     ((1<<14) | (1<<6))	/* agricultural thingies built here */
+#define PLSHIPYARD ((1<<15))	/* planet has a shipyard on it */
+#define PLORESMASK (0x7<<4)	/* mask for original resource flags */
+#define PLRESSHIFT       12	/* bit to shift right by for resources */
+#define PLRESMASK  (0xF<<PLRESSHIFT)	/* to mask off all but resource bits */
+
+#define PLREDRAW   (1<<7)	/* Player close for redraw */
+
+#define PLHOME 	   (1<< 8)	/* These 4 flags no longer are */
+#define PLCOUP     (1<< 9)	/* used in the server */
+#define PLCHEAP    (1<<10)
+#define PLCORE     (1<<11)
+
+/* cosmic object types, bits 16 and 23, and 24 */
+#define PLPLANET	0	/* object is a planet */
+#define PLSTAR     (1<<16)	/* object is a star */
+#define PLAST	   (1<<23)	/* object is an asteroid NYI */
+#define PLNEB	   ((1<<16)|(1<<23))	/* object is a nebula NYI */
+#define PLBHOLE    (1<<24)	/* object is a black hole NYI */
+#define PLPULSAR   ((1<<16)|(1<<24))	/* object is a pulsar NYI */
+#define PLUK1      ((1<<23)|(1<<24))	/* future expansion */
+#define PLWHOLE    ((1<<16)|(1<<23)|(1<<24))	/* object is a wormhole */
+#define PLTYPEMASK ((1<<16)|(1<<23)|(1<<24))	/* mask to extract object
+						   type */
+#define PL_TYPE(p) ( (p).pl_flags & PLTYPEMASK )
+
+/* Atmosphere Types, bits 17 and 18.
+   Valid for planets.
+   */
+#define PLATSHIFT	 17	/* number of right bit shifts for atmos bits */
+#define PLPOISON   (0<<PLATSHIFT)	/* poison atmosphere, no army growth */
+#define PLATYPE3   (1<<PLATSHIFT)	/* slightly toxic, very slow army
+					   growth */
+#define PLATYPE2   (2<<PLATSHIFT)	/* thin atmosphere, slow army growth */
+#define PLATYPE1   (3<<PLATSHIFT)	/* normal human atmosphere, normal
+					   growth */
+#define PLATMASK   (0x3<<PLATSHIFT)	/* to mask off everything but atmos
+					   bits */
+
+/* Surface Properties, bits 19..21
+   Valid for planets and asteroids.
+   */
+#define PLBARREN   0		/* rocky barren surface */
+#define PLSURSHIFT 	 19	/* number of bit shift to surface */
+#define PLDILYTH   (1<<(PLSURSHIFT+0))	/* dilythium deposits on the planet */
+#define PLMETAL    (1<<(PLSURSHIFT+1))	/* metal deposits on the planet */
+#define PLARABLE   (1<<(PLSURSHIFT+2))	/* planet has farmland */
+#define PLSURMASK  (0x7<<PLSURSHIFT)	/* number of surface combinations */
+
+
+#define PLPARADISE (1<<22)	/* Paradise server flag set to 1 for P server */
+#else
 /* the lower bits represent the original owning team */
 #define PLREPAIR 0x010
 #define PLFUEL 0x020
@@ -458,9 +608,7 @@
                                  * undefended team */
 #define PLCORE 0x800		/* A core world planet */
 
-#ifdef BRMH
-#define PLCLEAR 0x1000
-#endif
+#endif /* PARADISE */
 
 struct planet
 {
@@ -478,6 +626,9 @@
                                  * support life */
     int pl_couptime;            /* Time before coup may take
                                  * place */
+#ifdef PARADISE
+    int pl_timestamp;           /* time the info was taken */
+#endif
 };
 
 #define MVALID 0x01

Index: proto.h
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/include/proto.h,v
retrieving revision 1.55
retrieving revision 1.56
diff -u -d -r1.55 -r1.56
--- proto.h	16 May 2007 00:05:12 -0000	1.55
+++ proto.h	17 May 2007 08:49:47 -0000	1.56
@@ -628,6 +628,13 @@
                       int s,
                       int t,
                       W_Color color);
+void W_WriteRectangle (W_Window window,
+                       int x,
+                       int y,
+                       int width,
+                       int height,
+                       int dashed,
+                       W_Color color);
 void W_WriteText (W_Window window,
                   int x,
                   int y,
@@ -816,6 +823,9 @@
 struct list;
 void showValues (struct list *data);
 void newMotdLine (char *line);
+#ifdef PARADISE
+void newMotdPic (int x, int y, int width, int height, char *bits, int page);
+#endif
 void getResources (char *prog);
 void redrawTeam (W_Window win,
                  int teamNo,

Index: wlib.h
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/include/wlib.h,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- wlib.h	13 Apr 2007 07:12:21 -0000	1.13
+++ wlib.h	17 May 2007 08:49:48 -0000	1.14
@@ -210,6 +210,13 @@
                              int,
                              int,
                              W_Color);
+extern void W_WriteRectangle (W_Window,
+                              int,
+                              int,
+                              int,
+                              int,
+                              int,
+                              W_Color);
 extern void W_CacheClearArea (W_Window,
                               int,
                               int,

Index: data.h
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/include/data.h,v
retrieving revision 1.85
retrieving revision 1.86
diff -u -d -r1.85 -r1.86
--- data.h	16 May 2007 00:05:11 -0000	1.85
+++ data.h	17 May 2007 08:49:47 -0000	1.86
@@ -277,6 +277,29 @@
 
 extern double Sin[], Cos[];
 
+#ifdef PARADISE
+extern int paradise;		/* is the server a paradise server? */
+extern int noParadiseBitmaps;
+extern int gwidth;		/* galaxy width, adjusted for zoom [BDyess] */
+extern int offsetx;
+extern int offsety;		/* offsets when zooming [BDyess] */
+extern int nplayers;
+extern int nshiptypes;
+extern int ntorps;
+extern int npthingies;
+extern int ngthingies;
+extern int nplasmas;
+extern int nphasers;
+extern int nplanets;
+extern struct teaminfo_s *teaminfo;
+extern int number_of_teams;
+/* MOTD data */
+extern struct page *currpage;
+extern struct page *pmotddata;
+extern char blk_refitstring[80];
+extern int blk_friendlycloak;
+#endif
+
 extern W_Icon fedteam, romteam, kliteam, oriteam;
 extern W_Icon stipple, clockpic, clockhandpic, genopic, genopic2;
 
@@ -321,6 +344,15 @@
 
 extern W_Icon tractbits, pressbits;
 
+//Paradise bitmaps
+#ifdef PARADISE
+extern W_Icon base_star_bitmap;
+extern W_Icon star_bitmap[STAR_VIEWS];
+extern W_Icon star_mbitmap;
+extern W_Icon paradise_ship_bitmaps;
+extern W_Icon paradise_ships[NUM_PSHIP_TYPES][NUMTEAMS];
+#endif
+
 //Ships
 extern W_Icon ship_bitmaps[5];
 extern W_Icon fed_bitmaps[NUM_TYPES][SHIP_VIEWS],