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

Modified Files:
	data.c local.c map.c mswindow.c newwin.c 
Log Message:
Adds support for paradise fighters, haven't been tested yet, no
server available that has them.

Index: data.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/data.c,v
retrieving revision 1.97
retrieving revision 1.98
diff -u -d -r1.97 -r1.98
--- data.c	7 Jun 2007 06:29:05 -0000	1.97
+++ data.c	12 Jun 2007 01:23:17 -0000	1.98
@@ -352,6 +352,13 @@
 W_Icon drone_explosion_bitmap[BMP_DRONEDET_FRAMES];
 W_Icon base_dronec_explosion_bitmap;
 W_Icon dronec_explosion_bitmap[BMP_DRONEDET_FRAMES];
+W_Icon fighter_bitmap;
+W_Icon base_fighterc_bitmap;
+W_Icon fighterc_bitmap[NUM_CTORP_TYPES];
+W_Icon base_fighter_explosion_bitmap;
+W_Icon fighter_explosion_bitmap[BMP_FIGHTERDET_FRAMES];
+W_Icon base_fighterc_explosion_bitmap;
+W_Icon fighterc_explosion_bitmap[BMP_FIGHTERDET_FRAMES];
 W_Icon gear_bitmap, mgear_bitmap;
 W_Icon base_star_bitmap;
 W_Icon star_bitmap[STAR_VIEWS];

Index: newwin.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/newwin.c,v
retrieving revision 1.68
retrieving revision 1.69
diff -u -d -r1.68 -r1.69
--- newwin.c	7 Jun 2007 06:29:06 -0000	1.68
+++ newwin.c	12 Jun 2007 01:23:18 -0000	1.69
@@ -542,6 +542,32 @@
     for (i = 0; i < BMP_DRONEDET_FRAMES; i++)
         dronec_explosion_bitmap[i] =
             W_PointBitmap2 (base_dronec_explosion_bitmap, 0, i, BMP_DRONEDET_WIDTH, BMP_DRONEDET_HEIGHT);
+
+    fighter_bitmap =
+        W_StoreBitmap3 ("bitmaps/paradise/fighter.bmp", BMP_FIGHTER_WIDTH,
+                        BMP_FIGHTER_HEIGHT, BMP_FIGHTER, w, LR_MONOCHROME);
+    base_fighterc_bitmap =
+        W_StoreBitmap3 ("bitmaps/paradise/fighterC.bmp", BMP_FIGHTER_WIDTH * NUM_CTORP_TYPES,
+                        BMP_FIGHTER_HEIGHT, BMP_FIGHTERC, w, LR_DEFAULTCOLOR);
+    for (i = 0; i < NUM_CTORP_TYPES; i++)
+        fighterc_bitmap[i] =
+            W_PointBitmap2 (base_fighterc_bitmap, i, 0, BMP_FIGHTER_WIDTH, BMP_FIGHTER_HEIGHT);
+
+    base_fighter_explosion_bitmap =
+        W_StoreBitmap3 ("bitmaps/paradise/fightercloud.bmp", BMP_FIGHTERDET_WIDTH,
+                        BMP_FIGHTERDET_HEIGHT * BMP_FIGHTERDET_FRAMES, BMP_FIGHTERCLOUD, w,
+                        LR_MONOCHROME);
+    for (i = 0; i < BMP_FIGHTERDET_FRAMES; i++)
+        fighter_explosion_bitmap[i] =
+            W_PointBitmap2 (base_fighter_explosion_bitmap, 0, i, BMP_FIGHTERDET_WIDTH, BMP_FIGHTERDET_HEIGHT);
+
+    base_fighterc_explosion_bitmap =
+        W_StoreBitmap3 ("bitmaps/paradise/fightercloudC.bmp", BMP_FIGHTERDET_WIDTH,
+                        BMP_FIGHTERDET_HEIGHT * BMP_FIGHTERDET_FRAMES, BMP_FIGHTERCLOUD, w,
+                        LR_DEFAULTCOLOR);
+    for (i = 0; i < BMP_FIGHTERDET_FRAMES; i++)
+        fighterc_explosion_bitmap[i] =
+            W_PointBitmap2 (base_fighterc_explosion_bitmap, 0, i, BMP_FIGHTERDET_WIDTH, BMP_FIGHTERDET_HEIGHT);
 }
 #endif
 

Index: mswindow.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/mswindow.c,v
retrieving revision 1.86
retrieving revision 1.87
diff -u -d -r1.86 -r1.87
--- mswindow.c	7 Jun 2007 06:29:06 -0000	1.86
+++ mswindow.c	12 Jun 2007 01:23:18 -0000	1.87
@@ -589,6 +589,16 @@
     free (base_dronec_explosion_bitmap);
     for (i = 0; i < BMP_DRONEDET_FRAMES; i++)
         free (dronec_explosion_bitmap[i]);
+    free (fighter_bitmap);
+    free (base_fighterc_bitmap);
+    for (i = 0; i < NUM_CTORP_TYPES; i++)
+        free (fighterc_bitmap[i]);
+    free (base_fighter_explosion_bitmap);
+    for (i = 0; i < BMP_FIGHTERDET_FRAMES; i++)
+        free (fighter_explosion_bitmap[i]);
+    free (base_fighterc_explosion_bitmap);
+    for (i = 0; i < BMP_FIGHTERDET_FRAMES; i++)
+        free (fighterc_explosion_bitmap[i]);
     free (gear_bitmap);
     free (mgear_bitmap);
     free (base_star_bitmap);

Index: map.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/map.c,v
retrieving revision 1.59
retrieving revision 1.60
diff -u -d -r1.59 -r1.60
--- map.c	7 Jun 2007 06:29:06 -0000	1.59
+++ map.c	12 Jun 2007 01:23:18 -0000	1.60
@@ -744,7 +744,11 @@
 #ifdef BEEPLITE
 	}
 #endif
-        if (planetHighlighting && (l->pl_info & me->p_team)) /* Draw halo */
+        if (planetHighlighting && (l->pl_info & me->p_team)
+#ifdef PARADISE
+         && PL_TYPE(*l) != PLSTAR && PL_TYPE(*l) != PLWHOLE
+#endif
+        ) /* Draw halo */
             W_WriteCircle(mapw, dx, dy, BMP_MPLANET_WIDTH / 2,
                           l->pl_armies > 4 ? 1 : 0, 0, planetColor(l));
 
@@ -1580,7 +1584,7 @@
                 checkRedraw(pt->pt_x, pt->pt_y);
             }
 #ifdef PARADISE
-            /* missiles */
+            /* missiles/fighters */
             for (h = i * npthingies, th = &thingies[i * npthingies]; h < npthingies * (i + 1); h++, th++)
             {
                 if (th->t_x < 0 || th->t_y < 0)

Index: local.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/local.c,v
retrieving revision 1.105
retrieving revision 1.106
diff -u -d -r1.105 -r1.106
--- local.c	7 Jun 2007 06:29:06 -0000	1.105
+++ local.c	12 Jun 2007 01:23:18 -0000	1.106
@@ -2572,7 +2572,7 @@
     struct player *j;
     int dx, dy;
     int frame;
-    int droneTeam;
+    int droneTeam, fighterTeam;
     int view = scaleFactor * TWINSIDE / 2;
 
     if (k->t_shape == SHP_BLANK)
@@ -2586,17 +2586,6 @@
     dx = scaleLocal(dx);
     dy = scaleLocal(dy);
     switch (k->t_shape) {
-/*    case SHP_BOOM:
-	k->t_fuse--;
-	if (k->t_fuse <= 0) {
-	    k->t_shape = SHP_BLANK;
-	    return;
-	}
-	if (k->t_fuse > image->frames)
-	    k->t_fuse = image->frames;
-
-	frame = image->frames - k->t_fuse;
-	break;*/
     case SHP_MISSILE:
         j = &players[k->t_owner];
 #ifdef SOUND
@@ -2665,40 +2654,48 @@
         clearzone[3][clearcount] = BMP_DRONE_HEIGHT * SCALE / scaleFactor + 2;
         clearcount++;
 	break;
-/*    case SHP_TORP:
-        image = getImage(friendlyThingy(k) ? I_MTORP : I_ETORP);
-	frame = udcounter + k->t_no;
-	break;
-    case SHP_PLASMA:
-    case SHP_MINE:		// use plasma until I get a nifty bitmap
-        image = getImage(friendlyThingy(k) ? I_MPLASMATORP : I_EPLASMATORP);
-	frame = udcounter + k->t_no;
-	break;
-    case SHP_PBOOM:
-	image = getImage(friendlyThingy(k) ? I_MPLASMACLOUD : I_EPLASMACLOUD);
-	k->t_fuse--;
-	if (k->t_fuse < 0) {
-	    k->t_shape = SHP_BLANK;
-	    return;
-	}
-	if (k->t_fuse > image->frames) {
-	    k->t_fuse = image->frames;
-	}
-	frame = image->frames - k->t_fuse;
-	break;
     case SHP_FBOOM:
-	image = getImage(friendlyThingy(k) ? I_MFIGHTERCLOUD : I_EFIGHTERCLOUD);
-	k->t_fuse--;
-	if (k->t_fuse < 0) {
-	    k->t_shape = SHP_BLANK;
-	    return;
-	}
-	if (k->t_fuse > image->frames) {
-	    k->t_fuse = image->frames;
-	}
-	frame = image->frames - k->t_fuse;
+        k->t_fuse--;
+        frame = k->t_fuse * 10 / server_ups;
+                
+        if (k->t_fuse < 0)
+        {
+            k->t_shape = SHP_BLANK;
+            return;
+        }
+
+        if (frame >= BMP_FIGHTERDET_FRAMES)
+            frame = BMP_FIGHTERDET_FRAMES - 1;
+
+#ifdef SOUND
+                if (k->t_fuse == (MAX(2, BMP_FIGHTERDET_FRAMES * server_ups / 10) - 1))
+                {
+                    SetDistAngle(dx, dy);
+                    // At short distances, don't use angular sound
+                    if (!soundAngles || distance < SCALE/2)
+                        Play_Sound_Loc(PLASMA_HIT_WAV, SF_WEAPONS, -1, distance);
+                    else
+                        Play_Sound_Loc(PLASMA_HIT_WAV, SF_WEAPONS, angle, distance);
+                }
+#endif
+	W_WriteScaleBitmap (dx - (BMP_FIGHTERDET_WIDTH / 2) * SCALE / scaleFactor,
+                            dy - (BMP_FIGHTERDET_HEIGHT / 2) * SCALE / scaleFactor,
+                            BMP_FIGHTERDET_WIDTH * SCALE / scaleFactor,
+                            BMP_FIGHTERDET_HEIGHT * SCALE / scaleFactor,
+                            BMP_FIGHTERDET_WIDTH,
+                            BMP_FIGHTERDET_HEIGHT,
+                            0,
+                            colorWeapons ? fighterc_explosion_bitmap[frame] : fighter_explosion_bitmap[frame],
+                            playerColor (&players[k->t_owner]),
+                            w);
+        clearzone[0][clearcount] = dx - (BMP_FIGHTERDET_WIDTH / 2) * SCALE / scaleFactor ;
+        clearzone[1][clearcount] = dy - (BMP_FIGHTERDET_HEIGHT / 2) * SCALE / scaleFactor;
+        clearzone[2][clearcount] = BMP_FIGHTERDET_WIDTH * SCALE / scaleFactor;
+        clearzone[3][clearcount] = BMP_FIGHTERDET_HEIGHT * SCALE / scaleFactor;
+        clearcount++;
 	break;
-	*/
+    /* It appears all missile/fighter explosions are sent as SHP_PBOOM, oh well */
+    case SHP_PBOOM:
     case SHP_DBOOM:
         k->t_fuse--;
         frame = k->t_fuse * 10 / server_ups;
@@ -2713,7 +2710,7 @@
             frame = BMP_DRONEDET_FRAMES - 1;
 
 #ifdef SOUND
-                if (k->t_fuse == (MAX(2, BMP_TORPDET_FRAMES * server_ups / 10) - 1))
+                if (k->t_fuse == (MAX(2, BMP_DRONEDET_FRAMES * server_ups / 10) - 1))
                 {
                     SetDistAngle(dx, dy);
                     // At short distances, don't use angular sound
@@ -2739,11 +2736,83 @@
         clearzone[3][clearcount] = BMP_DRONEDET_HEIGHT * SCALE / scaleFactor;
         clearcount++;
 	break;
-	/*
     case SHP_FIGHTER:
-	image = getImage(friendlyThingy(k) ? I_MFIGHTER : I_EFIGHTER);
-	frame = (int) (k->t_dir * image->frames + 128) / 256;
-	break;
+        j = &players[k->t_owner];
+#ifdef SOUND
+        if (k->t_owner != me->p_no)
+        {
+            num_other_missiles++;
+            SetDistAngle(dx, dy);
+            if (distance < other_missile_dist)
+            {
+                other_missile_dist = distance;
+                other_missile_angle = angle;
+            }   	
+        }
+#endif
+        if (colorWeapons)
+        {
+            if (myPlayer(j))
+                fighterTeam = 0;
+            else
+            {
+                switch (j->p_team)
+                {
+                case FED:
+                    fighterTeam = 1;
+                    break;
+                case KLI:
+                    fighterTeam = 3;
+                    break;
+                case ORI:
+                    fighterTeam = 4;
+                    break;
+                case ROM:
+                    fighterTeam = 5;
+                    break;
+                default: // IND
+                    fighterTeam = 2;
+                }
+            }
+	    W_WriteScaleBitmap (dx - (BMP_FIGHTER_WIDTH / 2) * SCALE / scaleFactor,
+                                dy - (BMP_FIGHTER_HEIGHT / 2) * SCALE / scaleFactor,
+                                BMP_FIGHTER_WIDTH * SCALE / scaleFactor,
+                                BMP_FIGHTER_HEIGHT * SCALE / scaleFactor,
+                                BMP_FIGHTER_WIDTH,
+                                BMP_FIGHTER_HEIGHT,
+                                (360 * k->t_dir/255),
+                                fighterc_bitmap[fighterTeam],
+                                playerColor (j),
+                                w);
+        }
+        else
+        {
+	    W_WriteScaleBitmap (dx - (BMP_FIGHTER_WIDTH / 2) * SCALE / scaleFactor,
+                                dy - (BMP_FIGHTER_HEIGHT / 2) * SCALE / scaleFactor,
+                                BMP_FIGHTER_WIDTH * SCALE / scaleFactor,
+                                BMP_FIGHTER_HEIGHT * SCALE / scaleFactor,
+                                BMP_FIGHTER_WIDTH,
+                                BMP_FIGHTER_HEIGHT,
+                                (360 * k->t_dir/255),
+                                fighter_bitmap,
+                                playerColor (j),
+                                w);
+        }
+        clearzone[0][clearcount] = dx - (BMP_FIGHTER_WIDTH / 2) * SCALE / scaleFactor - 1;
+        clearzone[1][clearcount] = dy - (BMP_FIGHTER_HEIGHT / 2) * SCALE / scaleFactor - 1;
+        clearzone[2][clearcount] = BMP_FIGHTER_WIDTH * SCALE / scaleFactor + 2;
+        clearzone[3][clearcount] = BMP_FIGHTER_HEIGHT * SCALE / scaleFactor + 2;
+        clearcount++;
+        break;
+/*  
+    These 4 appear unused....
+
+    case SHP_TORP:
+    case SHP_PLASMA:
+    case SHP_MINE:
+    case SHP_BOOM:
+*/
+/*
     case SHP_WARP_BEACON:
 	image = getImage(I_WARPBEACON);
 	frame = udcounter;