Update of /cvsroot/netrek/client/netrekxp/src
In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv20941/src
Modified Files:
check.c cowmain.c dashboard.c data.c death.c defaults.c
input.c local.c main.c map.c mswindow.c newwin.c option.c
Log Message:
Rewrote doublebuffering to make it an rc option and not a #define - removes a lot of extra work in terms
of needing twice as many write bitmap functions (client had one for regular draw, and one for DB)
Added observer support to show repair/declare war flags on dashboard. Observers can also
now change lock if they are observing a transwarper (server side fix, but good to know).
Changed alert borders so they always redraw instead of on an alert change - was causing lots
of problems with bitmaps at edge of screen, as well as with double buffering
Readded the ability to see tractor/pressors if they go off screen (such as in the case of
ATT tractors).
Added "doubleBuffering: (on)/off" to control whether to draw with double buffering (it's
recommended you do so if using the new planet and ship bitmaps). Can be changed in game
through the options menu.
Fixed the -c (report players on server) option so it doesn't crash the client
Readded the ability to autologin by using -C name -A password. No more extra typing :).
Fixed a whole bunch of startup options (-C, -A, -h, -g, etc) that were crashing client if
not entered properly. Also made it so it prints out option list on a misused option.
Bunch of other write bitmap function optimizations
Index: mswindow.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/mswindow.c,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -d -r1.23 -r1.24
--- mswindow.c 20 May 2006 17:09:39 -0000 1.23
+++ mswindow.c 21 May 2006 09:56:38 -0000 1.24
@@ -155,6 +155,56 @@
return;\
win = (Window *)window
+#define DBHEADER_VOID\
+ HDC hdc;\
+ SDBUFFER * sdb;\
+ register Window *win;\
+ if (!window)\
+ return;\
+ sdb = SDB_lookup (window);\
+ if (doubleBuffering && sdb && ingame)\
[...1764 lines suppressed...]
- SetWorldTransform(sdb->mem_dc,&xForm);
- BitBlt(sdb->mem_dc, 0, 0, newwidth, newheight, GlobalMemDC2, srcx, srcy, SRCCOPY);
-
- // Reset xForm
- xForm.eM11 = (FLOAT) 1.0;
- xForm.eM12 = (FLOAT) 0.0;
- xForm.eM21 = (FLOAT) 0.0;
- xForm.eM22 = (FLOAT) 1.0;
- xForm.eDx = (FLOAT) 0.0;
- xForm.eDy = (FLOAT) 0.0;
-
- SetWorldTransform(sdb->mem_dc,&xForm);
-
- DeleteObject (newbmp);
+ BitBlt (sdb->win_dc, 0, 0, sdb->wr.right, sdb->wr.bottom, sdb->mem_dc, 0, 0, SRCCOPY);
}
-#endif /* DOUBLE_BUFFERING */
// Make a WIN_SCROLL type window.
// We use a scrollbar so we can look through the text, something the X version
Index: dashboard.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/dashboard.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- dashboard.c 20 May 2006 17:09:39 -0000 1.7
+++ dashboard.c 21 May 2006 09:56:38 -0000 1.8
@@ -306,20 +306,26 @@
of importance */
/* Declare War text */
- if (delay)
+ if (me->p_flags & PFWAR)
{
sprintf (buf, "War ");
- sprintf(buf2, "%d", delay - time (0));
- strcat (buf, buf2);
+ if (delay)
+ {
+ sprintf(buf2, "%d", delay - time (0));
+ strcat (buf, buf2);
+ }
msgtype = 0;
color = W_Red;
}
/* Refit text */
- else if (rdelay)
+ else if (me->p_flags & PFREFITTING)
{
sprintf (buf, "Refit ");
- sprintf(buf2, "%d", rdelay - time (0));
- strcat (buf, buf2);
+ if (rdelay)
+ {
+ sprintf(buf2, "%d", rdelay - time (0));
+ strcat (buf, buf2);
+ }
msgtype = 1;
color = W_Green;
}
Index: newwin.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/newwin.c,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -d -r1.24 -r1.25
--- newwin.c 20 May 2006 17:09:39 -0000 1.24
+++ newwin.c 21 May 2006 09:56:39 -0000 1.25
@@ -690,16 +690,12 @@
w = W_MakeWindow ("local", 0, 0, WINSIDE, WINSIDE, baseWin, THICKBORDER, foreColor);
-#ifdef DOUBLE_BUFFERING
localSDB = W_InitSDB (w);
-#endif
mapw = W_MakeWindow ("map", WINSIDE + 6, 0, WINSIDE, WINSIDE, baseWin,
THICKBORDER, foreColor);
-#ifdef DOUBLE_BUFFERING
mapSDB = W_InitSDB (mapw);
-#endif
tstatw = W_MakeWindow ("tstat", 0, WINSIDE + 6, WINSIDE + 3,
STATSIZE + 2, baseWin, BORDER, foreColor);
@@ -1995,14 +1991,13 @@
cy = CLOCK_Y + CLOCK_HEI / 2;
angle = (int)(-360 * time / max);
- W_WriteBitmap ( CLOCK_BDR, CLOCK_BDR, clockpic, foreColor);
+ W_WriteBitmap ( CLOCK_BDR, CLOCK_BDR, clockpic, foreColor, qwin);
W_OverlayScaleBitmap (CLOCK_BDR, CLOCK_BDR, BMP_CHAND_WIDTH, BMP_CHAND_HEIGHT,
BMP_CHAND_WIDTH, BMP_CHAND_HEIGHT,
angle, clockhandmask, foreColor, qwin);
- angle = (int)(255-time*255/max);
W_WriteScaleBitmap (CLOCK_BDR, CLOCK_BDR, BMP_CHAND_WIDTH, BMP_CHAND_HEIGHT,
BMP_CHAND_WIDTH, BMP_CHAND_HEIGHT,
- (unsigned char)(angle), clockhandpic, foreColor, qwin);
+ angle, clockhandpic, foreColor, qwin);
sprintf (buf, "%d", max - time);
tx = cx - W_Textwidth * strlen (buf) / 2;
ty = 2*(cy - W_Textheight / 2)/3;
@@ -2015,7 +2010,7 @@
cy = CLOCK_Y + (CLOCK_HEI - W_Textheight) / 2;
ex = cx - BMP_CLOCK_WIDTH / 2;
ey = cy - BMP_CLOCK_HEIGHT / 2;
- W_WriteBitmap (ex, ey, clockpic, foreColor);
+ W_WriteBitmap (ex, ey, clockpic, foreColor, qwin);
ex = (int) (cx - BMP_CLOCK_WIDTH * sin (2 * XPI * time / max) / 2);
ey = (int) (cy - BMP_CLOCK_HEIGHT * cos (2 * XPI * time / max) / 2);
Index: input.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/input.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- input.c 7 May 2006 21:10:51 -0000 1.10
+++ input.c 21 May 2006 09:56:38 -0000 1.11
@@ -692,7 +692,8 @@
while (W_EventsPending ())
W_NextEvent (&event);
-
+
+ ingame = 0;
longjmp (env, 0);
}
Index: local.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/local.c,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -d -r1.23 -r1.24
--- local.c 20 May 2006 17:09:39 -0000 1.23
+++ local.c 21 May 2006 09:56:38 -0000 1.24
@@ -26,6 +26,7 @@
/* Local Variables */
#define XPI 3.1415926
+static int playalert = 0;
static int clearcount = 0;
static int clearzone[4][(MAXTORP + 1) * MAXPLAYER +
(MAXPLASMA + 1) * MAXPLAYER + MAXPLANETS];
@@ -266,11 +267,7 @@
dx = scaleLocal (dx);
dy = scaleLocal (dy);
-#ifndef DOUBLE_BUFFERING
W_CacheLine (w, dx, dy, dx - dxx, dy - dyy, s->s_color);
-#else
- W_CacheLineDB (localSDB, dx, dy, dx - dxx, dy - dyy, s->s_color);
-#endif
clearline[0][clearlcount] = dx;
clearline[1][clearlcount] = dy;
@@ -290,11 +287,7 @@
dx = scaleLocal (dx);
dy = scaleLocal (dy);
-#ifndef DOUBLE_BUFFERING
W_CachePoint (w, dx, dy, s->s_color);
-#else
- W_CachePointDB (localSDB, dx, dy, s->s_color);
-#endif
clearline[0][clearlcount] = dx;
clearline[1][clearlcount] = dy;
@@ -357,7 +350,6 @@
if (planetBitmap == 3)
{
-#ifndef DOUBLE_BUFFERING
W_WriteScaleBitmap (dx - (BMP_PLANET_WIDTH / 2),
dy - (BMP_PLANET_HEIGHT / 2),
BMP_PLANET_WIDTH,
@@ -368,32 +360,14 @@
planetBitmapC (l),
planetColor (l),
w);
-#else
- W_WriteScaleBitmapDB (localSDB, dx - (BMP_PLANET_WIDTH / 2),
- dy - (BMP_PLANET_HEIGHT / 2),
- BMP_PLANET_WIDTH,
- BMP_PLANET_HEIGHT,
- BMP_CPLANET_WIDTH,
- BMP_CPLANET_HEIGHT,
- 0,
- planetBitmapC (l),
- planetColor (l),
- w);
/* Draw planet resources */
- planetResourcesC(localSDB, l, BMP_PLANET_WIDTH, BMP_PLANET_HEIGHT, dx, dy, w);
-#endif
+ planetResourcesC(l, BMP_PLANET_WIDTH, BMP_PLANET_HEIGHT, dx, dy, w);
}
else
{
-#ifndef DOUBLE_BUFFERING
W_WriteBitmap (dx - (BMP_PLANET_WIDTH / 2),
dy - (BMP_PLANET_HEIGHT / 2), getPlanetBitmap (l),
- planetColor (l));
-#else
- W_WriteBitmapDB (localSDB, dx - (BMP_PLANET_WIDTH / 2),
- dy - (BMP_PLANET_HEIGHT / 2), getPlanetBitmap (l),
- planetColor (l));
-#endif
+ planetColor (l), w);
}
if (showIND && ((l->pl_info & me->p_team)
#ifdef RECORDGAME
@@ -401,7 +375,6 @@
#endif
) && (l->pl_owner == NOBODY))
{
-#ifndef DOUBLE_BUFFERING
W_CacheLine (w, dx - (BMP_PLANET_WIDTH / 2),
dy - (BMP_PLANET_HEIGHT / 2),
dx + (BMP_PLANET_WIDTH / 2 - 1),
@@ -410,40 +383,33 @@
dy - (BMP_PLANET_HEIGHT / 2),
dx - (BMP_PLANET_WIDTH / 2),
dy + (BMP_PLANET_HEIGHT / 2 - 1), W_White);
-#else
- W_CacheLineDB (localSDB, dx - (BMP_PLANET_WIDTH / 2),
- dy - (BMP_PLANET_HEIGHT / 2),
- dx + (BMP_PLANET_WIDTH / 2 - 1),
- dy + (BMP_PLANET_HEIGHT / 2 - 1), W_White);
- W_CacheLineDB (localSDB, dx + (BMP_PLANET_WIDTH / 2 - 1),
- dy - (BMP_PLANET_HEIGHT / 2),
- dx - (BMP_PLANET_WIDTH / 2),
- dy + (BMP_PLANET_HEIGHT / 2 - 1), W_White);
-#endif
}
if (showPlanetNames)
{
-#ifndef DOUBLE_BUFFERING
W_MaskText (w, dx - (BMP_PLANET_WIDTH / 2),
dy + (BMP_PLANET_HEIGHT / 2), planetColor (l),
l->pl_name, l->pl_namelen, planetFont (l));
-#else
- W_MaskTextDB (localSDB, dx - (BMP_PLANET_WIDTH / 2),
- dy + (BMP_PLANET_HEIGHT / 2), planetColor (l),
- l->pl_name, l->pl_namelen, planetFont (l));
-#endif
clearzone[0][clearcount] = dx - (BMP_PLANET_WIDTH / 2);
clearzone[1][clearcount] = dy + (BMP_PLANET_HEIGHT / 2);
clearzone[2][clearcount] = W_Textwidth * l->pl_namelen;
clearzone[3][clearcount] = W_Textheight;
clearcount++;
}
-
- clearzone[0][clearcount] = dx - (7 * BMP_PLANET_WIDTH / 8);
- clearzone[1][clearcount] = dy - (5 * BMP_PLANET_HEIGHT / 6);
- clearzone[2][clearcount] = 7 * BMP_PLANET_WIDTH / 4 + 1;
- clearzone[3][clearcount] = 4 * BMP_PLANET_HEIGHT / 3 + 1;
+ if (planetBitmap == 3) // Needs adjusting
+ {
+ clearzone[0][clearcount] = dx - (7 * BMP_PLANET_WIDTH / 8);
+ clearzone[1][clearcount] = dy - (5 * BMP_PLANET_HEIGHT / 6);
+ clearzone[2][clearcount] = 7 * BMP_PLANET_WIDTH / 4 + 1;
+ clearzone[3][clearcount] = 4 * BMP_PLANET_HEIGHT / 3 + 1;
+ }
+ else
+ {
+ clearzone[0][clearcount] = dx - (BMP_PLANET_WIDTH / 2);
+ clearzone[1][clearcount] = dy - (BMP_PLANET_HEIGHT / 2);
+ clearzone[2][clearcount] = BMP_PLANET_WIDTH;
+ clearzone[3][clearcount] = BMP_PLANET_HEIGHT;
+ }
clearcount++;
}
}
@@ -676,14 +642,8 @@
#endif
)
{
-#ifndef DOUBLE_BUFFERING
W_WriteBitmap (dx - (cloak_width / 2),
- dy - (cloak_height / 2), cloakicon, myColor);
-#else
- W_WriteBitmapDB (localSDB, dx - (cloak_width / 2),
- dy - (cloak_height / 2), cloakicon, myColor);
-#endif
-
+ dy - (cloak_height / 2), cloakicon, myColor, w);
clearzone[0][clearcount] = dx - (shield_width / 2);
clearzone[1][clearcount] = dy - (shield_height / 2);
clearzone[2][clearcount] = shield_width;
@@ -849,56 +809,30 @@
if (colorClient != 4)
{
-#ifndef DOUBLE_BUFFERING
W_WriteBitmap (dx - (j->p_ship.s_width / 2),
dy - (j->p_ship.s_height / 2),
ship_bits[j->p_ship.s_type][rosette (j->p_dir)],
- playerColor (j));
-#else
- W_WriteBitmapDB (localSDB, dx - (j->p_ship.s_width / 2),
- dy - (j->p_ship.s_height / 2),
- ship_bits[j->p_ship.s_type][rosette (j->p_dir)],
- playerColor (j));
-#endif
+ playerColor (j), w);
}
else
{
-#ifndef DOUBLE_BUFFERING
W_WriteScaleBitmap (dx - (j->p_ship.s_width / 2),
dy - (j->p_ship.s_height / 2),
j->p_ship.s_width,
j->p_ship.s_height,
BMP_SHIP_WIDTH_HR,
BMP_SHIP_HEIGHT_HR,
- j->p_dir,
+ (360 * j->p_dir/255), // Converted to angle
ship_bitsHR[j->p_ship.s_type],
playerColor (j),
w);
-#else
- W_WriteScaleBitmapDB (localSDB, dx - (j->p_ship.s_width / 2),
- dy - (j->p_ship.s_height / 2),
- j->p_ship.s_width,
- j->p_ship.s_height,
- BMP_SHIP_WIDTH_HR,
- BMP_SHIP_HEIGHT_HR,
- j->p_dir,
- ship_bitsHR[j->p_ship.s_type],
- playerColor (j),
- w);
-#endif
}
if (j->p_cloakphase > 0)
{
-#ifndef DOUBLE_BUFFERING
W_WriteBitmap (dx - (cloak_width / 2),
dy - (cloak_height / 2), cloakicon,
- playerColor (j));
-#else
- W_WriteBitmapDB (localSDB, dx - (cloak_width / 2),
- dy - (cloak_height / 2), cloakicon,
- playerColor (j));
-#endif
+ playerColor (j), w);
if (!myPlayer (j)) /* if myplayer draw the
* shield */
continue;
@@ -911,18 +845,10 @@
&& (liteflag & LITE_PLAYERS_LOCAL))
{
int seq_n = emph_player_seq_n[j->p_no] % emph_player_seql_frames;
-
-#ifndef DOUBLE_BUFFERING
W_WriteBitmap (dx - (emph_player_seql_width / 2),
dy - (emph_player_seql_height / 2),
emph_player_seql[seq_n],
- W_White);
-#else
- W_WriteBitmapDB (localSDB, dx - (emph_player_seql_width / 2),
- dy - (emph_player_seql_height / 2),
- emph_player_seql[seq_n],
- W_White);
-#endif
+ W_White, w);
}
#endif
@@ -1006,23 +932,12 @@
}
#ifdef VSHIELD_BITMAPS
-#ifndef DOUBLE_BUFFERING
W_WriteBitmap (dx - (shield_width / 2),
dy - (shield_height / 2), shield[shieldnum],
- color);
-#else
- W_WriteBitmapDB (localSDB, dx - (shield_width / 2),
- dy - (shield_height / 2), shield[shieldnum],
- color);
-#endif /* DOUBLE_BUFFERING */
+ color, w);
#else
-#ifndef DOUBLE_BUFFERING
W_WriteBitmap (dx - (shield_width / 2),
- dy - (shield_height / 2), shield, color);
-#else
- W_WriteBitmapDB (localSDB, dx - (shield_width / 2),
- dy - (shield_height / 2), shield, color);
-#endif /* DOUBLE_BUFFERING */
+ dy - (shield_height / 2), shield, color, w);
#endif
}
if (j->p_flags & PFCLOAK) /* when cloaked stop here */
@@ -1083,16 +998,9 @@
}
}
}
-#ifndef DOUBLE_BUFFERING
W_MaskText (w, dx + (j->p_ship.s_width / 2),
dy - (j->p_ship.s_height / 2), color,
idbuf, buflen, shipFont (j));
-#else
- W_MaskTextDB (localSDB, dx + (j->p_ship.s_width / 2),
- dy - (j->p_ship.s_height / 2), color,
- idbuf, buflen, shipFont (j));
-#endif
-
clearzone[0][clearcount] = dx + (j->p_ship.s_width / 2);
clearzone[1][clearcount] = dy - (j->p_ship.s_height / 2);
clearzone[2][clearcount] = buflen * W_Textwidth;
@@ -1169,15 +1077,9 @@
if (j->p_ship.s_type == STARBASE)
{
-#ifndef DOUBLE_BUFFERING
W_WriteBitmap (dx - (BMP_SBEXPL_WIDTH / 2),
dy - (BMP_SBEXPL_HEIGHT / 2), sbexpview[i],
- playerColor (j));
-#else
- W_WriteBitmapDB (localSDB, dx - (BMP_SBEXPL_WIDTH / 2),
- dy - (BMP_SBEXPL_HEIGHT / 2), sbexpview[i],
- playerColor (j));
-#endif
+ playerColor (j), w);
clearzone[0][clearcount] = dx - (BMP_SBEXPL_WIDTH / 2);
clearzone[1][clearcount] = dy - (BMP_SBEXPL_HEIGHT / 2);
clearzone[2][clearcount] = BMP_SBEXPL_WIDTH;
@@ -1185,15 +1087,9 @@
}
else
{
-#ifndef DOUBLE_BUFFERING
W_WriteBitmap (dx - (BMP_SHIPEXPL_WIDTH / 2),
dy - (BMP_SHIPEXPL_HEIGHT / 2), expview[i],
- playerColor (j));
-#else
- W_WriteBitmapDB (localSDB, dx - (BMP_SHIPEXPL_WIDTH / 2),
- dy - (BMP_SHIPEXPL_HEIGHT / 2), expview[i],
- playerColor (j));
-#endif
+ playerColor (j), w);
clearzone[0][clearcount] = dx - (BMP_SHIPEXPL_WIDTH / 2);
clearzone[1][clearcount] = dy - (BMP_SHIPEXPL_HEIGHT / 2);
clearzone[2][clearcount] = BMP_SHIPEXPL_WIDTH;
@@ -1360,11 +1256,7 @@
px = new_dx;
py = new_dy;
}
-#ifndef DOUBLE_BUFFERING
W_CacheLine (w, px, py, tx, ty, col);
-#else
- W_CacheLineDB (localSDB, px, py, tx, ty, col);
-#endif
}
else
{
@@ -1379,55 +1271,27 @@
py = new_dy;
}
if (highlightFriendlyPhasers)
-#ifndef DOUBLE_BUFFERING
W_CacheLine (w, px, py, tx, ty, foreColor);
-#else
- W_CacheLineDB (localSDB, px, py, tx, ty, foreColor);
-#endif
else
{
if ((php->ph_fuse % 2) == 1)
-#ifndef DOUBLE_BUFFERING
W_CacheLine (w, px, py, tx, ty, foreColor);
-#else
- W_CacheLineDB (localSDB, px, py, tx, ty, foreColor);
-#endif
else
-#ifndef DOUBLE_BUFFERING
W_CacheLine (w, px, py, tx, ty, shipCol[remap[j->p_team]]);
-#else
- W_CacheLineDB (localSDB, px, py, tx, ty, shipCol[remap[j->p_team]]);
-#endif
}
}
else
-#ifndef DOUBLE_BUFFERING
W_CacheLine (w, px, py, tx, ty, shipCol[remap[j->p_team]]);
-#else
- W_CacheLineDB (localSDB, px, py, tx, ty, shipCol[remap[j->p_team]]);
-#endif
}
#else
if (highlightFriendlyPhasers && (php->ph_status == PHHIT))
-#ifndef DOUBLE_BUFFERING
W_CacheLine (w, px, py, tx, ty, foreColor);
-#else
- W_CacheLineDB (localSDB, px, py, tx, ty, foreColor);
-#endif
else
{
if ((php->ph_fuse % 2) == 1)
-#ifndef DOUBLE_BUFFERING
W_CacheLine (w, px, py, tx, ty, foreColor);
-#else
- W_CacheLineDB (localSDB, px, py, tx, ty, foreColor);
-#endif
else
-#ifndef DOUBLE_BUFFERING
W_CacheLine (w, px, py, tx, ty, shipCol[remap[j->p_team]]);
-#else
- W_CacheLineDB (localSDB, px, py, tx, ty, shipCol[remap[j->p_team]]);
-#endif
}
#endif
php->ph_fuse++;
@@ -1464,13 +1328,8 @@
lx = (int) (px - enemyPhasers * Cos[dir]);
ly = (int) (py - enemyPhasers * Sin[dir]);
-#ifndef DOUBLE_BUFFERING
W_MakePhaserLine (w, wx, wy, tx, ty, shipCol[remap[j->p_team]]);
W_MakePhaserLine (w, lx, ly, tx, ty, shipCol[remap[j->p_team]]);
-#else
- W_MakePhaserLineDB (localSDB, wx, wy, tx, ty, shipCol[remap[j->p_team]]);
- W_MakePhaserLineDB (localSDB, lx, ly, tx, ty, shipCol[remap[j->p_team]]);
-#endif
php->ph_fuse++;
@@ -1488,11 +1347,7 @@
}
else
{
-#ifndef DOUBLE_BUFFERING
W_MakePhaserLine (w, px, py, tx, ty, shipCol[remap[j->p_team]]);
-#else
- W_MakePhaserLineDB (localSDB, px, py, tx, ty, shipCol[remap[j->p_team]]);
-#endif
php->ph_fuse++;
@@ -1543,8 +1398,6 @@
px = (tractee->p_x - me->p_x);
py = (tractee->p_y - me->p_y);
- if(px > view || px < -view || py > view || py < -view)
- continue;
px = px / SCALE + WINSIDE / 2;
py = py / SCALE + WINSIDE / 2;
@@ -1567,23 +1420,13 @@
ly[1] = (int) (py - (Sin[dir] * (target_width / 2)));
if (j->p_flags & PFPRESS)
{
-#ifndef DOUBLE_BUFFERING
W_MakeTractLine (w, dx, dy, lx[0], ly[0], W_Yellow);
W_MakeTractLine (w, dx, dy, lx[1], ly[1], W_Yellow);
-#else
- W_MakeTractLineDB (localSDB, dx, dy, lx[0], ly[0], W_Yellow);
- W_MakeTractLineDB (localSDB, dx, dy, lx[1], ly[1], W_Yellow);
-#endif
}
else
{
-#ifndef DOUBLE_BUFFERING
W_MakeTractLine (w, dx, dy, lx[0], ly[0], W_Green);
W_MakeTractLine (w, dx, dy, lx[1], ly[1], W_Green);
-#else
- W_MakeTractLineDB (localSDB, dx, dy, lx[0], ly[0], W_Green);
- W_MakeTractLineDB (localSDB, dx, dy, lx[1], ly[1], W_Green);
-#endif
}
/*
@@ -1793,15 +1636,9 @@
torpTeam = 2;
}
}
-#ifndef DOUBLE_BUFFERING
W_WriteBitmap (dx - (BMP_CTORPDET_WIDTH / 2),
dy - (BMP_CTORPDET_HEIGHT / 2),
- cloudC[torpTeam][k->t_fuse], torpColor (k));
-#else
- W_WriteBitmapDB (localSDB, dx - (BMP_CTORPDET_WIDTH / 2),
- dy - (BMP_CTORPDET_HEIGHT / 2),
- cloudC[torpTeam][k->t_fuse], torpColor (k));
-#endif
+ cloudC[torpTeam][k->t_fuse], torpColor (k), w);
clearzone[0][clearcount] = dx - (BMP_CTORPDET_WIDTH / 2);
clearzone[1][clearcount] = dy - (BMP_CTORPDET_HEIGHT / 2);
clearzone[2][clearcount] = BMP_CTORPDET_WIDTH;
@@ -1810,15 +1647,9 @@
}
else
{
-#ifndef DOUBLE_BUFFERING
W_WriteBitmap (dx - (BMP_TORPDET_WIDTH / 2),
dy - (BMP_TORPDET_HEIGHT / 2),
- cloud[k->t_fuse], torpColor (k));
-#else
- W_WriteBitmapDB (localSDB, dx - (BMP_TORPDET_WIDTH / 2),
- dy - (BMP_TORPDET_HEIGHT / 2),
- cloud[k->t_fuse], torpColor (k));
-#endif
+ cloud[k->t_fuse], torpColor (k), w);
clearzone[0][clearcount] = dx - (BMP_TORPDET_WIDTH / 2);
clearzone[1][clearcount] = dy - (BMP_TORPDET_HEIGHT / 2);
clearzone[2][clearcount] = BMP_TORPDET_WIDTH;
@@ -1859,28 +1690,15 @@
if (j != me && ((k->t_war & me->p_team) ||
(j->p_team & (me->p_hostile | me->p_swar))))
{
-#ifndef DOUBLE_BUFFERING
W_WriteBitmap (dx - (BMP_CTORP_WIDTH / 2),
dy - (BMP_CTORP_HEIGHT / 2),
- torpC[torpTeam][k->t_fuse], torpColor (k));
-#else
- W_WriteBitmapDB (localSDB, dx - (BMP_CTORP_WIDTH / 2),
- dy - (BMP_CTORP_HEIGHT / 2),
- torpC[torpTeam][k->t_fuse], torpColor (k));
-#endif
-
+ torpC[torpTeam][k->t_fuse], torpColor (k), w);
}
else
{
-#ifndef DOUBLE_BUFFERING
W_WriteBitmap (dx - (BMP_CTORP_WIDTH / 2),
dy - (BMP_CTORP_HEIGHT / 2),
- mtorpC[torpTeam][k->t_fuse], torpColor (k));
-#else
- W_WriteBitmapDB (localSDB, dx - (BMP_CTORP_WIDTH / 2),
- dy - (BMP_CTORP_HEIGHT / 2),
- mtorpC[torpTeam][k->t_fuse], torpColor (k));
-#endif
+ mtorpC[torpTeam][k->t_fuse], torpColor (k), w);
}
clearzone[0][clearcount] = dx - (BMP_CTORP_WIDTH / 2);
@@ -1899,13 +1717,8 @@
* torpColor(k)); */
/* XFIX */
-#ifndef DOUBLE_BUFFERING
W_WriteBitmap (dx - (etorp_width / 2),
- dy - (etorp_height / 2), etorp, torpColor (k));
-#else
- W_WriteBitmapDB (localSDB, dx - (etorp_width / 2),
- dy - (etorp_height / 2), etorp, torpColor (k));
-#endif
+ dy - (etorp_height / 2), etorp, torpColor (k), w);
clearzone[0][clearcount] = dx - (etorp_width / 2);
clearzone[1][clearcount] = dy - (etorp_height / 2);
clearzone[2][clearcount] = etorp_width;
@@ -1914,13 +1727,8 @@
}
else
{
-#ifndef DOUBLE_BUFFERING
W_WriteBitmap (dx - (mtorp_width / 2),
- dy - (mtorp_height / 2), mtorp, torpColor (k));
-#else
- W_WriteBitmapDB (localSDB, dx - (mtorp_width / 2),
- dy - (mtorp_height / 2), mtorp, torpColor (k));
-#endif
+ dy - (mtorp_height / 2), mtorp, torpColor (k), w);
clearzone[0][clearcount] = dx - (mtorp_width / 2);
clearzone[1][clearcount] = dy - (mtorp_height / 2);
clearzone[2][clearcount] = mtorp_width;
@@ -2079,17 +1887,10 @@
ptorpTeam = 2;
}
}
-#ifndef DOUBLE_BUFFERING
W_WriteBitmap (dx - (BMP_CPLASMATORPDET_WIDTH / 2),
dy - (BMP_CPLASMATORPDET_HEIGHT / 2),
plcloudC[ptorpTeam][pt->pt_fuse],
- plasmatorpColor (pt));
-#else
- W_WriteBitmapDB (localSDB, dx - (BMP_CPLASMATORPDET_WIDTH / 2),
- dy - (BMP_CPLASMATORPDET_HEIGHT / 2),
- plcloudC[ptorpTeam][pt->pt_fuse],
- plasmatorpColor (pt));
-#endif
+ plasmatorpColor (pt), w);
clearzone[0][clearcount] = dx - (BMP_CPLASMATORPDET_WIDTH / 2);
clearzone[1][clearcount] = dy - (BMP_CPLASMATORPDET_HEIGHT / 2);
clearzone[2][clearcount] = BMP_CPLASMATORPDET_WIDTH;
@@ -2098,15 +1899,9 @@
}
else
{
-#ifndef DOUBLE_BUFFERING
W_WriteBitmap (dx - (BMP_PLASMATORPDET_WIDTH / 2),
dy - (BMP_PLASMATORPDET_HEIGHT / 2),
- plasmacloud[pt->pt_fuse], plasmatorpColor (pt));
-#else
- W_WriteBitmapDB (localSDB, dx - (BMP_PLASMATORPDET_WIDTH / 2),
- dy - (BMP_PLASMATORPDET_HEIGHT / 2),
- plasmacloud[pt->pt_fuse], plasmatorpColor (pt));
-#endif
+ plasmacloud[pt->pt_fuse], plasmatorpColor (pt), w);
clearzone[0][clearcount] = dx - (BMP_PLASMATORPDET_WIDTH / 2);
clearzone[1][clearcount] = dy - (BMP_PLASMATORPDET_HEIGHT / 2);
clearzone[2][clearcount] = BMP_PLASMATORPDET_WIDTH;
@@ -2148,31 +1943,17 @@
p_team & (me->p_hostile | me->
p_swar))))
{
-#ifndef DOUBLE_BUFFERING
W_WriteBitmap (dx - (BMP_CPLASMATORP_WIDTH / 2),
dy - (BMP_CPLASMATORP_HEIGHT / 2),
plasmaC[ptorpTeam][pt->pt_fuse],
- plasmatorpColor (pt));
-#else
- W_WriteBitmapDB (localSDB, dx - (BMP_CPLASMATORP_WIDTH / 2),
- dy - (BMP_CPLASMATORP_HEIGHT / 2),
- plasmaC[ptorpTeam][pt->pt_fuse],
- plasmatorpColor (pt));
-#endif
+ plasmatorpColor (pt), w);
}
else
{
-#ifndef DOUBLE_BUFFERING
W_WriteBitmap (dx - (BMP_CPLASMATORP_WIDTH / 2),
dy - (BMP_CPLASMATORP_HEIGHT / 2),
mplasmaC[ptorpTeam][pt->pt_fuse],
- plasmatorpColor (pt));
-#else
- W_WriteBitmapDB (localSDB, dx - (BMP_CPLASMATORP_WIDTH / 2),
- dy - (BMP_CPLASMATORP_HEIGHT / 2),
- mplasmaC[ptorpTeam][pt->pt_fuse],
- plasmatorpColor (pt));
-#endif
+ plasmatorpColor (pt), w);
}
clearzone[0][clearcount] = dx - (BMP_CPLASMATORP_WIDTH / 2);
clearzone[1][clearcount] = dy - (BMP_CPLASMATORP_HEIGHT / 2);
@@ -2188,15 +1969,9 @@
p_team & (me->p_hostile | me->
p_swar))))
{
-#ifndef DOUBLE_BUFFERING
W_WriteBitmap (dx - (eplasmatorp_width / 2),
dy - (eplasmatorp_height / 2),
- eplasmatorp, plasmatorpColor (pt));
-#else
- W_WriteBitmapDB (localSDB, dx - (eplasmatorp_width / 2),
- dy - (eplasmatorp_height / 2),
- eplasmatorp, plasmatorpColor (pt));
-#endif
+ eplasmatorp, plasmatorpColor (pt), w);
clearzone[0][clearcount] = dx - (eplasmatorp_width / 2);
clearzone[1][clearcount] = dy - (eplasmatorp_height / 2);
clearzone[2][clearcount] = eplasmatorp_width;
@@ -2205,15 +1980,9 @@
}
else
{
-#ifndef DOUBLE_BUFFERING
W_WriteBitmap (dx - (mplasmatorp_width / 2),
dy - (mplasmatorp_height / 2),
- mplasmatorp, plasmatorpColor (pt));
-#else
- W_WriteBitmapDB (localSDB, dx - (mplasmatorp_width / 2),
- dy - (mplasmatorp_height / 2),
- mplasmatorp, plasmatorpColor (pt));
-#endif
+ mplasmatorp, plasmatorpColor (pt), w);
clearzone[0][clearcount] = dx - (mplasmatorp_width / 2);
clearzone[1][clearcount] = dy - (mplasmatorp_height / 2);
clearzone[2][clearcount] = mplasmatorp_width;
@@ -2296,11 +2065,7 @@
else
continue;
-#ifndef DOUBLE_BUFFERING
W_CacheLine (w, sx, sy, ex, ey, sl->color);
-#else
- W_CacheLineDB (localSDB, sx, sy, ex, ey, sl->color);
-#endif
clearline[0][clearlcount] = sx;
clearline[1][clearlcount] = sy;
clearline[2][clearlcount] = ex;
@@ -2321,11 +2086,7 @@
if (ey > WINSIDE - 1)
ey = WINSIDE - 1;
/* XFIX */
-#ifndef DOUBLE_BUFFERING
W_CacheLine (w, dx, sy, dx, ey, warningColor);
-#else
- W_CacheLineDB (localSDB, dx, sy, dx, ey, warningColor);
-#endif
clearline[0][clearlcount] = dx;
clearline[1][clearlcount] = sy;
clearline[2][clearlcount] = dx;
@@ -2343,11 +2104,7 @@
if (ey > WINSIDE - 1)
ey = WINSIDE - 1;
/* XFIX */
-#ifndef DOUBLE_BUFFERING
W_CacheLine (w, dx, sy, dx, ey, warningColor);
-#else
- W_CacheLineDB (localSDB, dx, sy, dx, ey, warningColor);
-#endif
clearline[0][clearlcount] = dx;
clearline[1][clearlcount] = sy;
clearline[2][clearlcount] = dx;
@@ -2365,11 +2122,7 @@
if (ex > WINSIDE - 1)
ex = WINSIDE - 1;
/* XFIX */
-#ifndef DOUBLE_BUFFERING
W_CacheLine (w, sx, dy, ex, dy, warningColor);
-#else
- W_CacheLineDB (localSDB, sx, dy, ex, dy, warningColor);
-#endif
clearline[0][clearlcount] = sx;
clearline[1][clearlcount] = dy;
clearline[2][clearlcount] = ex;
@@ -2387,11 +2140,7 @@
if (ex > WINSIDE - 1)
ex = WINSIDE - 1;
/* XFIX */
-#ifndef DOUBLE_BUFFERING
W_CacheLine (w, sx, dy, ex, dy, warningColor);
-#else
- W_CacheLineDB (localSDB, sx, dy, ex, dy, warningColor);
-#endif
clearline[0][clearlcount] = sx;
clearline[1][clearlcount] = dy;
clearline[2][clearlcount] = ex;
@@ -2400,27 +2149,24 @@
}
- /* Change border color to signify alert status */
-
+ /* Decided to always redraw alert borders, was causing too many problems with
+ the infrequent draw rate - BB */
if (oldalert != (me->p_flags & (PFGREEN | PFYELLOW | PFRED)))
+ playalert = 1;
+ oldalert = (me->p_flags & (PFGREEN | PFYELLOW | PFRED));
+ switch (oldalert)
{
- oldalert = (me->p_flags & (PFGREEN | PFYELLOW | PFRED));
- switch (oldalert)
+ case PFGREEN:
+ if (extraAlertBorder)
{
- case PFGREEN:
- if (extraAlertBorder)
- {
-#ifndef DOUBLE_BUFFERING
- W_ChangeBorder (w, gColor);
- W_ChangeBorder (mapw, gColor);
-#else
- W_ChangeBorderDB (localSDB, gColor);
- W_ChangeBorderDB (mapSDB, gColor);
-#endif
- }
- W_ChangeBorder (baseWin, gColor);
+ W_ChangeBorder (w, gColor);
+ W_ChangeBorder (mapw, gColor);
+ }
+ W_ChangeBorder (baseWin, gColor);
#if defined(SOUND)
+ if (playalert)
+ {
if (newSound) // Kill any channels with WARNING_WAV or RED_ALERT_WAV (group 2)
Mix_HaltGroup(2);
else
@@ -2428,25 +2174,20 @@
Abort_Sound(WARNING_SOUND);
Abort_Sound(RED_ALERT_SOUND);
}
-
-#endif
-
- break;
- case PFYELLOW:
- if (extraAlertBorder)
- {
-#ifndef DOUBLE_BUFFERING
- W_ChangeBorder (w, yColor);
- W_ChangeBorder (mapw, yColor);
-#else
- W_ChangeBorderDB (localSDB, yColor);
- W_ChangeBorderDB (mapSDB, yColor);
+ }
#endif
- }
- W_ChangeBorder (baseWin, yColor);
+ break;
+ case PFYELLOW:
+ if (extraAlertBorder)
+ {
+ W_ChangeBorder (w, yColor);
+ W_ChangeBorder (mapw, yColor);
+ }
+ W_ChangeBorder (baseWin, yColor);
#if defined(SOUND)
-
+ if (playalert)
+ {
if (newSound) // Kill any channels with RED_ALERT_WAV (group 2)
{
Mix_HaltGroup(2);
@@ -2457,33 +2198,29 @@
Abort_Sound(RED_ALERT_SOUND);
Play_Sound(WARNING_SOUND);
}
-
-#endif
-
- break;
- case PFRED:
- if (extraAlertBorder)
- {
-#ifndef DOUBLE_BUFFERING
- W_ChangeBorder (w, rColor);
- W_ChangeBorder (mapw, rColor);
-#else
- W_ChangeBorderDB (localSDB, rColor);
- W_ChangeBorderDB (mapSDB, rColor);
+ }
#endif
- }
- W_ChangeBorder (baseWin, rColor);
-
+ break;
+ case PFRED:
+ if (extraAlertBorder)
+ {
+ W_ChangeBorder (w, rColor);
+ W_ChangeBorder (mapw, rColor);
+ }
+ W_ChangeBorder (baseWin, rColor);
+
#if defined(SOUND)
+ if (playalert)
+ {
if (newSound)
Play_Sound(RED_ALERT_WAV);
else
Play_Sound(RED_ALERT_SOUND);
-#endif
-
- break;
}
+#endif
+ break;
}
+ playalert = 0;
#if defined(SOUND)
if (newSound)
@@ -2577,11 +2314,7 @@
}
if (tri_x != -1)
{
-#ifndef DOUBLE_BUFFERING
W_WriteTriangle (w, tri_x, tri_y, 4, facing, foreColor);
-#else
- W_WriteTriangleDB (localSDB, tri_x, tri_y, 4, facing, foreColor);
-#endif
clearzone[0][clearcount] = tri_x - tri_size - 1;
clearzone[1][clearcount] = tri_y - 1 + (facing ? 0 : -tri_size);
clearzone[2][clearcount] = tri_size * 2 + 2;
@@ -2598,9 +2331,8 @@
Draw out the 'tactical' map
*/
{
-#ifdef DOUBLE_BUFFERING
- W_Win2Mem (localSDB);
-#endif
+ if (doubleBuffering)
+ W_Win2Mem (localSDB);
clearLocal ();
@@ -2619,9 +2351,8 @@
weaponUpdate = 0;
DrawMisc ();
-#ifdef DOUBLE_BUFFERING
- W_Mem2Win (localSDB);
-#endif
+ if (doubleBuffering)
+ W_Mem2Win (localSDB);
}
@@ -2635,11 +2366,7 @@
{
if (W_FastClear)
{
-#ifndef DOUBLE_BUFFERING
W_ClearWindow (w);
-#else
- W_ClearWindowDB (localSDB);
-#endif
clearcount = 0;
clearlcount = 0;
tractcurrent = tracthead;
@@ -2647,44 +2374,25 @@
else
{
// Much more efficient way of clearing -- X programmers take note!
-#ifndef DOUBLE_BUFFERING
W_ClearAreas (w, clearzone[0], clearzone[1], clearzone[2],
clearzone[3], clearcount);
-#else
- W_ClearAreasDB (localSDB, clearzone[0], clearzone[1], clearzone[2],
- clearzone[3], clearcount);
-#endif
clearcount = 0;
/* erase the tractor lines [BDyess] */
for (tractrunner = tracthead; tractrunner != tractcurrent;
tractrunner = tractrunner->next)
{
-#ifndef DOUBLE_BUFFERING
W_MakeTractLine (w, tractrunner->sx, tractrunner->sy,
tractrunner->d1x, tractrunner->d1y,
backColor);
W_MakeTractLine (w, tractrunner->sx, tractrunner->sy,
tractrunner->d2x, tractrunner->d2y,
backColor);
-#else
- W_MakeTractLineDB (localSDB, tractrunner->sx, tractrunner->sy,
- tractrunner->d1x, tractrunner->d1y,
- backColor);
- W_MakeTractLineDB (localSDB, tractrunner->sx, tractrunner->sy,
- tractrunner->d2x, tractrunner->d2y,
- backColor);
-#endif
}
tractcurrent = tracthead;
-#ifndef DOUBLE_BUFFERING
W_MakeLines (w, clearline[0], clearline[1], clearline[2],
clearline[3], clearlcount, backColor);
-#else
- W_MakeLinesDB (localSDB, clearline[0], clearline[1], clearline[2],
- clearline[3], clearlcount, backColor);
-#endif
clearlcount = 0;
}
}
Index: death.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/death.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- death.c 14 May 2006 02:14:54 -0000 1.6
+++ death.c 21 May 2006 09:56:38 -0000 1.7
@@ -39,6 +39,7 @@
{
W_Event event;
+ ingame = 0;
#ifdef AUTOKEY
if (autoKey)
autoKeyAllOff ();
@@ -51,13 +52,8 @@
{
if (extraAlertBorder)
{
-#ifndef DOUBLE_BUFFERING
W_ChangeBorder (w, gColor);
W_ChangeBorder (mapw, gColor);
-#else
- W_ChangeBorderDB (localSDB, gColor);
- W_ChangeBorderDB (mapSDB, gColor);
-#endif
}
W_ChangeBorder (baseWin, gColor);
oldalert = PFGREEN;
@@ -223,7 +219,8 @@
{ /* Otherwise we aren't within a thread, so... */
while (W_EventsPending ())
W_NextEvent (&event);
-
+
+ ingame = 0;
longjmp (env, 0);
}
#endif /* Threaded */
Index: option.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/option.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- option.c 14 May 2006 02:14:54 -0000 1.14
+++ option.c 21 May 2006 09:56:39 -0000 1.15
@@ -387,6 +387,7 @@
#ifdef XTRA_MESSAGE_UI
{1, "", &messageHUD, 0, 0, 0, messagehudmess, &messagehud_range},
#endif
+ {1, "use double buffering", &doubleBuffering, 0, 0, 0, NULL, NULL},
{1, "done", ¬done, 0, 0, 0, NULL, NULL},
{-1, NULL, 0, 0, 0, 0, NULL, NULL}
};
@@ -890,6 +891,13 @@
showHockeyScore = 0;
}
#endif
+ /* Let's see if this is our double buffering changed */
+ else if (op->op_option == &doubleBuffering)
+ {
+ W_ClearWindow (w);
+ W_ClearWindow (mapw);
+ redrawall = 1;
+ }
else if (op->op_option == &partitionPlist)
RedrawPlayerList ();
else if (op->op_option == &sortPlayers)
Index: check.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/check.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- check.c 21 Apr 2006 12:00:06 -0000 1.3
+++ check.c 21 May 2006 09:56:38 -0000 1.4
@@ -77,7 +77,6 @@
if (connect (sock, (struct sockaddr *) &addr, sizeof (addr)) < 0)
{
perror ("connect");
- close (sock);
terminate (0);
}
@@ -89,6 +88,5 @@
{
perror ("read");
}
- close (sock);
terminate (0);
}
Index: data.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/data.c,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -d -r1.22 -r1.23
--- data.c 20 May 2006 17:09:39 -0000 1.22
+++ data.c 21 May 2006 09:56:38 -0000 1.23
@@ -32,6 +32,8 @@
struct mctl *mctl;
struct memory universe;
+int ingame = 0; /* If player is in game - to distinguish between whether
+ to use double buffering on the local and map window */
int ghoststart = 0; /* is this a ghostbust
* restart? */
int ghost_pno = 0; /* is this a ghostbust
@@ -733,10 +735,10 @@
struct stringlist *defaults = NULL;
-#ifdef DOUBLE_BUFFERING
SDBUFFER * localSDB = NULL;
SDBUFFER * mapSDB = NULL;
-#endif
+
+int doubleBuffering = 1; /* Use double buffering to draw map/local */
int disableWinkey = 1; /* disable WinKey + ContextKey by default */
Index: main.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/main.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- main.c 7 May 2006 16:59:27 -0000 1.5
+++ main.c 21 May 2006 09:56:38 -0000 1.6
@@ -121,9 +121,9 @@
{
case 'C': /* character name */
- if (i < argc)
+ if (i < argc && argv[i + 1])
{
- (void) STRNCPY (pseudo, argv[i], sizeof (pseudo));
+ (void) STRNCPY (pseudo, argv[i + 1], sizeof (argv[i + 1]));
i++;
}
else
@@ -131,9 +131,9 @@
break;
case 'A': /* authorization password */
- if (i < argc)
+ if (i < argc && argv[i + 1])
{
- (void) STRNCPY (defpasswd, argv[i], sizeof (defpasswd));
+ (void) STRNCPY (defpasswd, argv[i + 1], sizeof (argv[i + 1]));
i++;
}
else
@@ -151,7 +151,7 @@
break;
case 's': /* listen socket number */
- if (i < argc)
+ if (i < argc && argv[i + 1])
{
xtrekPort = atoi (argv[i + 1]);
passive = 1;
@@ -166,7 +166,7 @@
/* No break */
case 'f': /* record to cambot file */
- if (i < argc)
+ if (i < argc && argv[i + 1])
{
recordFileName = argv[i + 1];
i++;
@@ -176,7 +176,7 @@
break;
#endif
case 'l': /* log to file */
- if (i < argc)
+ if (i < argc && argv[i + 1])
{
logFileName = argv[i + 1];
i++;
@@ -186,7 +186,7 @@
break;
case 'p': /* port to connect to */
- if (i < argc)
+ if (i < argc && argv[i + 1])
{
xtrekPort = atoi (argv[i + 1]);
i++;
@@ -196,7 +196,7 @@
break;
case 'd':
- if (i < argc)
+ if (i < argc && argv[i + 1])
{
display_host = argv[i + 1];
i++;
@@ -253,7 +253,7 @@
#endif
case 'h': /* server to connect to */
- if (i < argc)
+ if (i < argc && argv[i + 1])
{
servertmp = argv[i + 1];
if (metablock(servertmp))
@@ -276,7 +276,7 @@
#ifdef GATEWAY
case 'H': /* gateway to connect through */
hset++;
- if (i < argc)
+ if (i < argc && argv[i + 1])
{
netaddr = strToNetaddr (argv[i + 1];
i++;
@@ -286,7 +286,7 @@
break;
#endif
case 'U': /* local UDP port */
- if (i < argc)
+ if (i < argc && argv[i + 1])
{
if ((baseUdpLocalPort = atoi (argv[i + 1])) == 0)
{
@@ -305,7 +305,7 @@
break;
#endif
case 'G': /* try restarting previous session */
- if (i < argc)
+ if (i < argc && argv[i + 1])
{
ghoststart++;
ghost_pno = atoi (argv[i + 1]);
@@ -317,7 +317,7 @@
break;
case 't': /* window title */
- if (i < argc)
+ if (i < argc && argv[i + 1])
{
title = argv[i + 1];
i++;
@@ -327,7 +327,7 @@
break;
case 'r': /* defaults file */
- if (i < argc)
+ if (i < argc && argv[i + 1])
{
deffile = argv[i + 1];
i++;
@@ -371,15 +371,16 @@
if (!usemeta && !servertmp) /* no meta type was selected, pick metaserver */
usemeta = 1;
-
- if (hideConsole)
- FreeConsole ();
if (usage || err)
{
printUsage (name);
+ if (hideConsole)
+ FreeConsole ();
exit (err);
}
+ if (hideConsole)
+ FreeConsole ();
#ifdef GATEWAY
if (!hset) use_trekhopd = 0; /* allow use via normal connections */
Index: cowmain.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/cowmain.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- cowmain.c 7 May 2006 16:59:27 -0000 1.12
+++ cowmain.c 21 May 2006 09:56:38 -0000 1.13
@@ -555,7 +555,7 @@
serverName = gateway;
#endif
- pseudo[0] = defpasswd[0] = '\0';
+// pseudo[0] = defpasswd[0] = '\0'; /* Why was this ever put in? */
#ifdef RECORDGAME
if (recordFileName != NULL)
@@ -1082,7 +1082,7 @@
Play_Sound(ENGINE_SOUND);
}
#endif
-
+ ingame = 1;
/* Get input until the player quits or dies */
input ();
Index: map.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/map.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- map.c 20 May 2006 17:09:39 -0000 1.10
+++ map.c 21 May 2006 09:56:38 -0000 1.11
@@ -333,7 +333,7 @@
/*** planetResourcesC()
/******************************************************************************/
extern inline void
-planetResourcesC (SDBUFFER * sdb, register struct planet *p, int destwidth, int destheight,
+planetResourcesC (register struct planet *p, int destwidth, int destheight,
int dx, int dy, W_Window window)
/*
* Draw the resources for a colorized planet.
@@ -347,35 +347,35 @@
{
/* Select resources */
if (p->pl_armies > 4)
- W_OverlayScaleBitmapDB(sdb, dx - 7 * destwidth / 8,
- dy - (destheight / 2),
- destwidth/3,
- destheight,
- BMP_ARMY_WIDTH,
- BMP_ARMY_HEIGHT,
- 0,
- army_bitmap, planetColor(p),
- window);
+ W_WriteScaleBitmap(dx - 7 * destwidth / 8,
+ dy - (destheight / 2),
+ destwidth/3,
+ destheight,
+ BMP_ARMY_WIDTH,
+ BMP_ARMY_HEIGHT,
+ 0,
+ army_bitmap, planetColor(p),
+ window);
if (p->pl_flags & PLREPAIR)
- W_OverlayScaleBitmapDB(sdb, dx - (destwidth / 2),
- dy - (5 * destheight / 6),
- destwidth,
- destheight/3,
- BMP_WRENCH_WIDTH,
- BMP_WRENCH_HEIGHT,
- 0,
- wrench_bitmap, planetColor(p),
- window);
+ W_WriteScaleBitmap(dx - (destwidth / 2),
+ dy - (5 * destheight / 6),
+ destwidth,
+ destheight/3,
+ BMP_WRENCH_WIDTH,
+ BMP_WRENCH_HEIGHT,
+ 0,
+ wrench_bitmap, planetColor(p),
+ window);
if (p->pl_flags & PLFUEL)
- W_OverlayScaleBitmapDB(sdb, dx + 3 * destwidth / 5,
- dy - (destheight / 2),
- destwidth/3,
- destheight,
- BMP_FUEL_WIDTH,
- BMP_FUEL_HEIGHT,
- 0,
- fuel_bitmap, planetColor(p),
- window);
+ W_WriteScaleBitmap(dx + 3 * destwidth / 5,
+ dy - (destheight / 2),
+ destwidth/3,
+ destheight,
+ BMP_FUEL_WIDTH,
+ BMP_FUEL_HEIGHT,
+ 0,
+ fuel_bitmap, planetColor(p),
+ window);
}
return;
}
@@ -429,21 +429,17 @@
ody = pl_update[l->pl_no].plu_y * WINSIDE / GWIDTH;
/* XFIX */
-#ifndef DOUBLE_BUFFERING
- W_ClearArea (mapw, odx - (BMP_MPLANET_WIDTH / 2),
- ody - (BMP_MPLANET_HEIGHT / 2),
- BMP_MPLANET_WIDTH, BMP_MPLANET_HEIGHT);
+ if (planetBitmapGalaxy == 3) // Needs adjusting
+ W_ClearArea (mapw, odx - 7 * BMP_MPLANET_WIDTH / 8,
+ ody - (5 * BMP_MPLANET_HEIGHT / 6),
+ 7 * BMP_MPLANET_WIDTH / 4, 4 * BMP_MPLANET_HEIGHT / 3);
+ else
+ W_ClearArea (mapw, odx - (BMP_MPLANET_WIDTH / 2),
+ ody - (BMP_MPLANET_HEIGHT / 2),
+ BMP_MPLANET_WIDTH, BMP_MPLANET_HEIGHT);
W_WriteText (mapw, odx - (BMP_MPLANET_WIDTH / 2),
ody + (BMP_MPLANET_HEIGHT / 2),
backColor, l->pl_name, 3, planetFont (l));
-#else
- W_ClearAreaDB (mapSDB, odx - (BMP_MPLANET_WIDTH / 2),
- ody - (BMP_MPLANET_HEIGHT / 2),
- BMP_MPLANET_WIDTH, BMP_MPLANET_HEIGHT);
- W_WriteTextDB (mapSDB, odx - (BMP_MPLANET_WIDTH / 2),
- ody + (BMP_MPLANET_HEIGHT / 2),
- backColor, l->pl_name, 3, planetFont (l));
-#endif
pl_update[l->pl_no].plu_update = 0;
}
else
@@ -451,15 +447,15 @@
/* Clear the planet normally */
/* XFIX */
-#ifndef DOUBLE_BUFFERING
- W_ClearArea (mapw, dx - (BMP_MPLANET_WIDTH / 2 + 8),
- dy - (BMP_MPLANET_HEIGHT / 2 + 4),
- BMP_MPLANET_WIDTH + 8, BMP_MPLANET_HEIGHT + 8);
-#else
- W_ClearAreaDB (mapSDB, dx - 7 * BMP_MPLANET_WIDTH / 8,
- dy - (5 * BMP_MPLANET_HEIGHT / 6),
- 7 * BMP_MPLANET_WIDTH / 4, 4 * BMP_MPLANET_HEIGHT / 3);
-#endif
+ if (planetBitmapGalaxy == 3) // Needs adjusting
+ W_ClearArea (mapw, dx - 7 * BMP_MPLANET_WIDTH / 8,
+ dy - (5 * BMP_MPLANET_HEIGHT / 6),
+ 7 * BMP_MPLANET_WIDTH / 4, 4 * BMP_MPLANET_HEIGHT / 3);
+
+ else
+ W_ClearArea (mapw, dx - (BMP_MPLANET_WIDTH / 2 + 4),
+ dy - (BMP_MPLANET_HEIGHT / 2 + 4),
+ BMP_MPLANET_WIDTH + 8, BMP_MPLANET_HEIGHT + 8);
l->pl_flags &= ~PLCLEAR;
}
@@ -473,11 +469,10 @@
if (planetBitmapGalaxy == 3)
{
-#ifndef DOUBLE_BUFFERING
- W_OverlayBitmap(dx - (emph_planet_seq_width / 2 + 1),
+ W_WriteBitmap(dx - (emph_planet_seq_width / 2 + 1),
dy - (emph_planet_seq_height / 2),
emph_planet_seq[seq_n],
- W_White);
+ W_White, mapw);
W_WriteScaleBitmap(dx - (BMP_MPLANET_WIDTH / 2),
dy - (BMP_MPLANET_HEIGHT / 2),
@@ -490,45 +485,17 @@
mapw);
/* Draw planet resources */
- planetResourcesC(mapSDB, l, BMP_MPLANET_WIDTH, BMP_MPLANET_HEIGHT, dx, dy, mapw);
-#else
- W_OverlayBitmapDB(mapSDB, dx - (emph_planet_seq_width / 2 + 1),
- dy - (emph_planet_seq_height / 2),
- emph_planet_seq[seq_n],
- W_White);
-
- W_WriteScaleBitmapDB(mapSDB, dx - (BMP_MPLANET_WIDTH / 2),
- dy - (BMP_MPLANET_HEIGHT / 2),
- BMP_MPLANET_WIDTH,
- BMP_MPLANET_HEIGHT,
- BMP_CPLANET_WIDTH,
- BMP_CPLANET_HEIGHT,
- 0,
- planetBitmapC(l), planetColor(l),
- mapw);
- /* Draw planet resources */
- planetResourcesC(mapSDB, l, BMP_MPLANET_WIDTH, BMP_MPLANET_HEIGHT, dx, dy, mapw);
-#endif
+ planetResourcesC(l, BMP_MPLANET_WIDTH, BMP_MPLANET_HEIGHT, dx, dy, mapw);
}
else
{
-#ifndef DOUBLE_BUFFERING
- W_OverlayBitmap(dx - (emph_planet_seq_width / 2 + 1),
+ W_WriteBitmap(dx - (emph_planet_seq_width / 2 + 1),
dy - (emph_planet_seq_height / 2),
emph_planet_seq[seq_n],
- W_White);
+ W_White, mapw);
W_WriteBitmap(dx - (BMP_MPLANET_WIDTH / 2), dy - (BMP_MPLANET_HEIGHT / 2),
- planetmBitmap(l), planetColor(l));
-#else
- W_OverlayBitmapDB(mapSDB, dx - (emph_planet_seq_width / 2 + 1),
- dy - (emph_planet_seq_height / 2),
- emph_planet_seq[seq_n],
- W_White);
-
- W_WriteBitmapDB(mapSDB, dx - (BMP_MPLANET_WIDTH / 2), dy - (BMP_MPLANET_HEIGHT / 2),
- planetmBitmap(l), planetColor(l));
-#endif
+ planetmBitmap(l), planetColor(l), mapw);
}
emph_planet_seq_n[l->pl_no] -= 1;
l->pl_flags |= PLREDRAW; /* Leave redraw on until * *
@@ -541,7 +508,6 @@
#endif // Beeplite end
if (planetBitmapGalaxy == 3)
{
-#ifndef DOUBLE_BUFFERING
W_WriteScaleBitmap (dx - (BMP_MPLANET_WIDTH / 2),
dy - (BMP_MPLANET_HEIGHT / 2),
BMP_MPLANET_WIDTH,
@@ -553,33 +519,13 @@
planetColor (l),
mapw);
/* Draw planet resources */
- planetResourcesC(mapSDB, l, BMP_MPLANET_WIDTH, BMP_MPLANET_HEIGHT, dx, dy, mapw);
-#else
- W_WriteScaleBitmapDB (mapSDB, dx - (BMP_MPLANET_WIDTH / 2),
- dy - (BMP_MPLANET_HEIGHT / 2),
- BMP_MPLANET_WIDTH,
- BMP_MPLANET_HEIGHT,
- BMP_CPLANET_WIDTH,
- BMP_CPLANET_HEIGHT,
- 0,
- planetBitmapC (l),
- planetColor (l),
- mapw);
- /* Draw planet resources */
- planetResourcesC(mapSDB, l, BMP_MPLANET_WIDTH, BMP_MPLANET_HEIGHT, dx, dy, mapw);
-#endif
+ planetResourcesC(l, BMP_MPLANET_WIDTH, BMP_MPLANET_HEIGHT, dx, dy, mapw);
}
else
{
-#ifndef DOUBLE_BUFFERING
- W_OverlayBitmap (dx - (BMP_MPLANET_WIDTH / 2),
+ W_WriteBitmap (dx - (BMP_MPLANET_WIDTH / 2),
dy - (BMP_MPLANET_HEIGHT / 2), planetmBitmap (l),
- planetColor (l));
-#else
- W_OverlayBitmapDB (mapSDB, dx - (BMP_MPLANET_WIDTH / 2),
- dy - (BMP_MPLANET_HEIGHT / 2), planetmBitmap (l),
- planetColor (l));
-#endif
+ planetColor (l), mapw);
}
#ifdef BEEPLITE
}
@@ -592,40 +538,22 @@
agri_name[0] = (char) (toupper (l->pl_name[0]));
agri_name[1] = (char) (toupper (l->pl_name[1]));
agri_name[2] = (char) (toupper (l->pl_name[2]));
-#ifndef DOUBLE_BUFFERING
W_WriteText (mapw, dx - (BMP_MPLANET_WIDTH / 2),
dy + (BMP_MPLANET_HEIGHT / 2), getAgriColor (l),
agri_name, 3, planetFont (l));
-#else
- W_WriteTextDB (mapSDB, dx - (BMP_MPLANET_WIDTH / 2),
- dy + (BMP_MPLANET_HEIGHT / 2), getAgriColor (l),
- agri_name, 3, planetFont (l));
-#endif
}
else
{
-#ifndef DOUBLE_BUFFERING
W_WriteText (mapw, dx - (BMP_MPLANET_WIDTH / 2),
dy + (BMP_MPLANET_HEIGHT / 2), getAgriColor (l),
l->pl_name, 3, planetFont (l));
-#else
- W_WriteTextDB (mapSDB, dx - (BMP_MPLANET_WIDTH / 2),
- dy + (BMP_MPLANET_HEIGHT / 2), getAgriColor (l),
- l->pl_name, 3, planetFont (l));
-#endif
}
}
else
{
-#ifndef DOUBLE_BUFFERING
W_WriteText (mapw, dx - (BMP_MPLANET_WIDTH / 2),
dy + (BMP_MPLANET_HEIGHT / 2), planetColor (l),
l->pl_name, 3, planetFont (l));
-#else
- W_WriteTextDB (mapSDB, dx - (BMP_MPLANET_WIDTH / 2),
- dy + (BMP_MPLANET_HEIGHT / 2), planetColor (l),
- l->pl_name, 3, planetFont (l));
-#endif
}
if (showIND && ((l->pl_info & me->p_team)
@@ -634,7 +562,6 @@
#endif
) && (l->pl_owner == NOBODY))
{
-#ifndef DOUBLE_BUFFERING
W_MakeLine (mapw, dx + (BMP_MPLANET_WIDTH / 2 - 1),
dy + (BMP_MPLANET_HEIGHT / 2 - 1),
dx - (BMP_MPLANET_WIDTH / 2),
@@ -643,16 +570,6 @@
dy + (BMP_MPLANET_HEIGHT / 2 - 1),
dx + (BMP_MPLANET_WIDTH / 2 - 1),
dy - (BMP_MPLANET_HEIGHT / 2), W_White);
-#else
- W_MakeLineDB (mapSDB, dx + (BMP_MPLANET_WIDTH / 2 - 1),
- dy + (BMP_MPLANET_HEIGHT / 2 - 1),
- dx - (BMP_MPLANET_WIDTH / 2),
- dy - (BMP_MPLANET_HEIGHT / 2), W_White);
- W_MakeLineDB (mapSDB, dx - (BMP_MPLANET_WIDTH / 2),
- dy + (BMP_MPLANET_HEIGHT / 2 - 1),
- dx + (BMP_MPLANET_WIDTH / 2 - 1),
- dy - (BMP_MPLANET_HEIGHT / 2), W_White);
-#endif
}
if (showPlanetOwner)
@@ -662,13 +579,8 @@
|| playback
#endif
)? tolower (teamlet[l->pl_owner]) : '?');
-#ifndef DOUBLE_BUFFERING
W_WriteText (mapw, dx + (BMP_MPLANET_WIDTH / 2) + 2,
dy - 6, planetColor (l), &ch, 1, planetFont (l));
-#else
- W_WriteTextDB (mapSDB, dx + (BMP_MPLANET_WIDTH / 2) + 2,
- dy - 6, planetColor (l), &ch, 1, planetFont (l));
-#endif
}
}
}
@@ -684,12 +596,7 @@
for (sl = map_hockey_lines + NUM_HOCKEY_LINES - 1; sl >= map_hockey_lines;
--sl)
{
-#ifndef DOUBLE_BUFFERING
W_CacheLine (mapw, sl->begin_x, sl->begin_y, sl->end_x, sl->end_y, sl->color);
-#else
- W_CacheLineDB (mapSDB, sl->begin_x, sl->begin_y, sl->end_x, sl->end_y, sl->color);
-#endif
-
}
}
@@ -745,23 +652,12 @@
ori_offset = 3;
kli_offset = 8;
}
-
-#ifndef DOUBLE_BUFFERING
W_WriteText (mapw, ori_offset * W_Textwidth, 1 * W_Textheight, W_Ori,
ori_score_line, strlen (ori_score_line), W_RegularFont);
W_WriteText (mapw, 6 * W_Textwidth, 1 * W_Textheight, W_White,
":", 1, W_RegularFont);
W_WriteText (mapw, kli_offset * W_Textwidth, 1 * W_Textheight, W_Kli,
kli_score_line, strlen (kli_score_line), W_RegularFont);
-#else
- W_WriteTextDB (mapSDB, ori_offset * W_Textwidth, 1 * W_Textheight, W_Ori,
- ori_score_line, strlen (ori_score_line), W_RegularFont);
- W_WriteTextDB (mapSDB, 6 * W_Textwidth, 1 * W_Textheight, W_White,
- ":", 1, W_RegularFont);
- W_WriteTextDB (mapSDB, kli_offset * W_Textwidth, 1 * W_Textheight, W_Kli,
- kli_score_line, strlen (kli_score_line), W_RegularFont);
-#endif
-
}
#endif /* HOCKEY_LINES */
@@ -793,9 +689,8 @@
int view = WINSIDE * SCALE / 2;
int mvx, mvy;
-#ifdef DOUBLE_BUFFERING
- W_Win2Mem (mapSDB);
-#endif
+ if (doubleBuffering)
+ W_Win2Mem (mapSDB);
dx = (me->p_x) / (GWIDTH / WINSIDE);
dy = (me->p_y) / (GWIDTH / WINSIDE);
@@ -813,12 +708,8 @@
/* Don't do anything if initPlanets() has not been called */
return;
}
-
-#ifndef DOUBLE_BUFFERING
W_ClearWindow (mapw);
-#else
- W_ClearWindowDB (mapSDB);
-#endif
+
clearlock = 0;
clearviewbox = 0;
viewboxcleared = 0;
@@ -840,13 +731,8 @@
if (clearlock)
{
clearlock = 0;
-#ifndef DOUBLE_BUFFERING
W_WriteTriangle (mapw, clearlmark[0], clearlmark[1],
clearlmark[2], clearlmark[3], backColor);
-#else
- W_WriteTriangleDB (mapSDB, clearlmark[0], clearlmark[1],
- clearlmark[2], clearlmark[3], backColor);
-#endif
}
if (clearviewbox)
@@ -854,30 +740,13 @@
clearviewbox = 0;
/* clear old dots - placed here for less flicker */
if (viewx + viewdist < WINSIDE && viewy + viewdist < WINSIDE)
-#ifndef DOUBLE_BUFFERING
W_MakePoint (mapw, viewx + viewdist, viewy + viewdist, backColor);
-#else
- W_MakePointDB (mapSDB, viewx + viewdist, viewy + viewdist, backColor);
-#endif
if (viewx + viewdist < WINSIDE && viewy - viewdist > 0)
-#ifndef DOUBLE_BUFFERING
W_MakePoint (mapw, viewx + viewdist, viewy - viewdist, backColor);
-#else
- W_MakePointDB (mapSDB, viewx + viewdist, viewy - viewdist, backColor);
-#endif
if (viewx - viewdist > 0 && viewy + viewdist < WINSIDE)
-#ifndef DOUBLE_BUFFERING
W_MakePoint (mapw, viewx - viewdist, viewy + viewdist, backColor);
-#else
- W_MakePointDB (mapSDB, viewx - viewdist, viewy + viewdist, backColor);
-#endif
if (viewx - viewdist > 0 && viewy - viewdist > 0)
-#ifndef DOUBLE_BUFFERING
W_MakePoint (mapw, viewx - viewdist, viewy - viewdist, backColor);
-#else
- W_MakePointDB (mapSDB, viewx - viewdist, viewy - viewdist, backColor);
-#endif
-
/* redraw any planets they overwrote */
mvx = viewx * (GWIDTH / WINSIDE); /* correct from view scale */
mvy = viewy * (GWIDTH / WINSIDE);
@@ -900,14 +769,8 @@
if (mclearzone[2][i])
{
/* XFIX */
-#ifndef DOUBLE_BUFFERING
W_ClearArea (mapw, mclearzone[0][i], mclearzone[1][i],
mclearzone[2][i], mclearzone[3][i]);
-#else
- W_ClearAreaDB (mapSDB, mclearzone[0][i], mclearzone[1][i],
- mclearzone[2][i], mclearzone[3][i]);
-#endif
-
/* Redraw the hole just left next update */
checkRedraw (mclearzone[4][i], mclearzone[5][i]);
mclearzone[2][i] = 0;
@@ -946,29 +809,13 @@
{
/* draw the new points */
if (dx + viewdist < WINSIDE && dy + viewdist < WINSIDE)
-#ifndef DOUBLE_BUFFERING
W_MakePoint (mapw, dx + viewdist, dy + viewdist, W_White);
-#else
- W_MakePointDB (mapSDB, dx + viewdist, dy + viewdist, W_White);
-#endif
if (dx + viewdist < WINSIDE && dy - viewdist > 0)
-#ifndef DOUBLE_BUFFERING
W_MakePoint (mapw, dx + viewdist, dy - viewdist, W_White);
-#else
- W_MakePointDB (mapSDB, dx + viewdist, dy - viewdist, W_White);
-#endif
if (dx - viewdist > 0 && dy + viewdist < WINSIDE)
-#ifndef DOUBLE_BUFFERING
W_MakePoint (mapw, dx - viewdist, dy + viewdist, W_White);
-#else
- W_MakePointDB (mapSDB, dx - viewdist, dy + viewdist, W_White);
-#endif
if (dx - viewdist > 0 && dy - viewdist > 0)
-#ifndef DOUBLE_BUFFERING
W_MakePoint (mapw, dx - viewdist, dy - viewdist, W_White);
-#else
- W_MakePointDB (mapSDB, dx - viewdist, dy - viewdist, W_White);
-#endif
viewx = dx; /* store the points for later */
viewy = dy; /* clearing */
@@ -1014,48 +861,24 @@
if (j->p_flags & PFCLOAK)
{
if (omitTeamLetter)
-#ifndef DOUBLE_BUFFERING
W_WriteText (mapw, dx - (W_Textwidth / 2),
dy - W_Textheight / 2, unColor, cloakChars,
1, W_RegularFont);
-#else
- W_WriteTextDB (mapSDB, dx - (W_Textwidth / 2),
- dy - W_Textheight / 2, unColor, cloakChars,
- (cloakChars[1] == '\0' ? 1 : 2), W_RegularFont);
-#endif
else
-#ifndef DOUBLE_BUFFERING
W_WriteText (mapw, dx - W_Textwidth,
dy - W_Textheight / 2, unColor, cloakChars,
(cloakChars[1] == '\0' ? 1 : 2), W_RegularFont);
-#else
- W_WriteTextDB (mapSDB, dx - W_Textwidth,
- dy - W_Textheight / 2, unColor, cloakChars,
- (cloakChars[1] == '\0' ? 1 : 2), W_RegularFont);
-#endif
}
else
{
if (omitTeamLetter)
-#ifndef DOUBLE_BUFFERING
W_WriteText (mapw, dx - (W_Textwidth / 2),
dy - W_Textheight / 2, playerColor (j),
(j->p_mapchars)+1, 1, shipFont (j));
-#else
- W_WriteTextDB (mapSDB, dx - (W_Textwidth / 2),
- dy - W_Textheight / 2, playerColor (j),
- (j->p_mapchars)+1, 1, shipFont (j));
-#endif
else
-#ifndef DOUBLE_BUFFERING
W_WriteText (mapw, dx - W_Textwidth,
dy - W_Textheight / 2, playerColor (j),
j->p_mapchars, 2, shipFont (j));
-#else
- W_WriteTextDB (mapSDB, dx - W_Textwidth,
- dy - W_Textheight / 2, playerColor (j),
- j->p_mapchars, 2, shipFont (j));
-#endif
}
#ifdef BEEPLITE
@@ -1064,17 +887,10 @@
{
int seq_n = emph_player_seq_n[i] % emph_player_seq_frames;
-#ifndef DOUBLE_BUFFERING
W_WriteBitmap(dx - (emph_player_seq_width / 2 - 1),
dy - (emph_player_seq_height / 2 + 1),
emph_player_seq[seq_n],
- W_White);
-#else
- W_WriteBitmapDB(mapSDB, dx - (emph_player_seq_width / 2 - 1),
- dy - (emph_player_seq_height / 2 + 1),
- emph_player_seq[seq_n],
- W_White);
-#endif
+ W_White, mapw);
emph_player_seq_n[i] -= 1;
mclearzone[0][i] = dx - (emph_player_seq_width / 2 - 1);
mclearzone[1][i] = dy - (emph_player_seq_height / 2 + 1);
@@ -1114,11 +930,7 @@
{
dx = j->p_x * WINSIDE / GWIDTH;
dy = j->p_y * WINSIDE / GWIDTH;
-#ifndef DOUBLE_BUFFERING
W_WriteTriangle (mapw, dx, dy + 6, 4, 1, foreColor);
-#else
- W_WriteTriangleDB (mapSDB, dx, dy + 6, 4, 1, foreColor);
-#endif
clearlmark[0] = dx;
clearlmark[1] = dy + 6;
@@ -1133,11 +945,7 @@
dx = l->pl_x * WINSIDE / GWIDTH;
dy = l->pl_y * WINSIDE / GWIDTH;
-#ifndef DOUBLE_BUFFERING
W_WriteTriangle (mapw, dx, dy - (BMP_MPLANET_HEIGHT) / 2 - 4, 4, 0, foreColor);
-#else
- W_WriteTriangleDB (mapSDB, dx, dy - (BMP_MPLANET_HEIGHT) / 2 - 4, 4, 0, foreColor);
-#endif
clearlmark[0] = dx;
clearlmark[1] = dy - (BMP_MPLANET_HEIGHT) / 2 - 4;
@@ -1146,7 +954,6 @@
clearlock = 1;
}
-#ifdef DOUBLE_BUFFERING
- W_Mem2Win (mapSDB);
-#endif
+ if (doubleBuffering)
+ W_Mem2Win (mapSDB);
}
\ No newline at end of file
Index: defaults.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/defaults.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- defaults.c 16 May 2006 05:10:13 -0000 1.17
+++ defaults.c 21 May 2006 09:56:38 -0000 1.18
@@ -130,6 +130,12 @@
NULL
}
},
+ {"doubleBuffering", &doubleBuffering, RC_BOOL,
+ {
+ "Use double buffering to reduce screen flicker",
+ NULL
+ }
+ },
{"dynamicBitmaps", &dynamicBitmaps, RC_BOOL,
{
"Allow switching of ship bitmaps in game. With this option disabled",
@@ -1390,6 +1396,7 @@
if (timerType < T_NONE || timerType >= T_TOTAL)
timerType = T_SHIP;
+ doubleBuffering = booleanDefault ("doubleBuffering", doubleBuffering);
allowWheelActions = booleanDefault ("allowWheelActions", allowWheelActions);
newQuit = booleanDefault ("newQuit", newQuit);
newSound = booleanDefault ("newSound", newSound);