Update of /cvsroot/netrek/client/netrekxp/src
In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv13111/src
Modified Files:
dashboard.c dashboard3.c data.c getship.c redraw.c warning.c
Log Message:
Some bitmap modifications (with new art)
Added timer/clock back to text dashboard
Added torp count to LAB dashboard
-Added new status line to KRP, COW and LAB dashboard. In order of priority, it shows the following:
1) time left in declare war delay
2) time left in refit delay
3) time left to fully repair (if you are at warp 0 in repair mode)
4) time left in grace period after T mode drops to still take planets (15 second timer)
5) whether you are in transwarp
6) whether you are under impulse power (default)
Index: redraw.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/redraw.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- redraw.c 7 May 2006 16:59:27 -0000 1.6
+++ redraw.c 18 May 2006 07:15:35 -0000 1.7
@@ -185,6 +185,9 @@
buf = buf2;
oldbuf = buf1;
}
+ /* TIMER */
+ db_timer (flag, WINSIDE - 12 * W_Textwidth, 27);
+
buf[0] = (char) (me->p_flags & PFSHIELD ? 'S' : ' ');
if (me->p_flags & PFGREEN)
buf[1] = 'G';
Index: getship.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/getship.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- getship.c 21 Jan 2003 21:28:30 -0000 1.1.1.1
+++ getship.c 18 May 2006 07:15:35 -0000 1.2
@@ -39,6 +39,7 @@
shipvals[SCOUT].s_width = 20; /* scout: */
shipvals[SCOUT].s_height = 20; /* scout: */
shipvals[SCOUT].s_phaserfuse = 10; /* scout: */
+ shipvals[SCOUT].s_repair = 80; /* scout: */
shipvals[DESTROYER].s_phaserdamage = 85; /* destroyer: */
shipvals[DESTROYER].s_torpspeed = 14; /* destroyer: */
@@ -53,6 +54,7 @@
shipvals[DESTROYER].s_height = 20; /* destroyer: */
shipvals[DESTROYER].s_type = DESTROYER; /* destroyer: */
shipvals[DESTROYER].s_phaserfuse = 10; /* destroyer: */
+ shipvals[DESTROYER].s_repair = 100; /* destroyer: */
shipvals[BATTLESHIP].s_phaserdamage = 105; /* battleship: */
shipvals[BATTLESHIP].s_torpspeed = 12; /* battleship: */
@@ -67,6 +69,7 @@
shipvals[BATTLESHIP].s_height = 20; /* battleship: */
shipvals[BATTLESHIP].s_type = BATTLESHIP; /* battleship: */
shipvals[BATTLESHIP].s_phaserfuse = 10; /* battleship: */
+ shipvals[BATTLESHIP].s_repair = 125; /* battleship: */
shipvals[ASSAULT].s_phaserdamage = 80; /* assault */
shipvals[ASSAULT].s_torpspeed = 16; /* assault */
@@ -81,6 +84,7 @@
shipvals[ASSAULT].s_height = 20; /* assault */
shipvals[ASSAULT].s_type = ASSAULT; /* assault */
shipvals[ASSAULT].s_phaserfuse = 10; /* assault */
+ shipvals[ASSAULT].s_repair = 120; /* assault */
shipvals[STARBASE].s_phaserdamage = 120; /* starbase */
shipvals[STARBASE].s_torpspeed = 14; /* starbase */
@@ -95,7 +99,8 @@
shipvals[STARBASE].s_height = 20; /* starbase */
shipvals[STARBASE].s_type = STARBASE; /* starbase */
shipvals[STARBASE].s_phaserfuse = 4; /* starbase */
-
+ shipvals[STARBASE].s_repair = 140; /* starbase */
+
shipvals[ATT].s_phaserdamage = 10000; /* att: */
shipvals[ATT].s_torpspeed = 30; /* att: */
shipvals[ATT].s_maxspeed = 60; /* att: */
@@ -109,6 +114,7 @@
shipvals[ATT].s_height = 20; /* att: */
shipvals[ATT].s_type = ATT; /* att: */
shipvals[ATT].s_phaserfuse = 1; /* att: */
+ shipvals[ATT].s_repair = 30000; /* att: */
shipvals[SGALAXY].s_phaserdamage = 100; /* galaxy: */
shipvals[SGALAXY].s_torpspeed = 13; /* galaxy: */
@@ -123,6 +129,7 @@
shipvals[SGALAXY].s_height = 20; /* galaxy: */
shipvals[SGALAXY].s_type = SGALAXY; /* galaxy: */
shipvals[SGALAXY].s_phaserfuse = 10; /* galaxy: */
+ shipvals[SGALAXY].s_repair = 112; /* galaxy: */
shipvals[CRUISER].s_phaserdamage = 100; /* cruiser: */
shipvals[CRUISER].s_torpspeed = 12; /* cruiser: */
@@ -137,6 +144,7 @@
shipvals[CRUISER].s_height = 20; /* cruiser: */
shipvals[CRUISER].s_type = CRUISER; /* cruiser: */
shipvals[CRUISER].s_phaserfuse = 10; /* cruiser: */
+ shipvals[CRUISER].s_repair = 110; /* cruiser: */
}
/******************************************************************************/
Index: dashboard.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/dashboard.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- dashboard.c 7 May 2006 16:59:27 -0000 1.3
+++ dashboard.c 18 May 2006 07:15:35 -0000 1.4
@@ -38,6 +38,7 @@
#define BAR_LENGTH 56
#define SPACING 4
+
/******************************************************************************/
/*** timerString() ***/
/******************************************************************************/
@@ -90,7 +91,10 @@
switch (timerType)
{
case T_NONE:
- W_ClearArea(tstatw, xloc, yloc, 12 * W_Textwidth, W_Textheight);
+ if (newDashboard)
+ W_ClearArea(tstatw, xloc, yloc, 12 * W_Textwidth, W_Textheight);
+ else
+ W_ClearArea(tstatw, xloc + 4 * W_Textwidth, yloc - W_Textheight, 8 * W_Textwidth, 2 * W_Textheight);
strcpy(lasttimer, " ");
oldtime = now;
break;
@@ -109,7 +113,10 @@
}
if(s)
{
- W_WriteText(tstatw, xloc, yloc, textColor, s, 3, W_RegularFont);
+ if (newDashboard)
+ W_WriteText(tstatw, xloc, yloc, textColor, s, 3, W_RegularFont);
+ else
+ W_WriteText(tstatw, xloc + 4 * W_Textwidth, yloc - W_Textheight, textColor, s, 3, W_RegularFont);
}
}
if (!timerType)
@@ -266,6 +273,88 @@
}
/******************************************************************************/
+/*** db_special() - for showing prioritized timer info in dashboard ***/
+/******************************************************************************/
+static void
+db_special (void)
+{
+ char buf[16];
+ struct player *plr;
+ int repairtime;
+
+ if ((me->p_flags & (PFPLOCK | PFOBSERV)) == (PFPLOCK | PFOBSERV))
+ plr = players + me->p_playerl;
+ else
+ plr = me;
+
+ /* Start with low priority messages, clear as necessary for higher
+ priority ones */
+
+ /* Default impulse text */
+ W_ClearArea (tstatw, 38, 3, W_Textwidth * 8, W_Textheight);
+ W_WriteText (tstatw, 38, 3, W_Yellow, "Impulse", 7, W_BoldFont);
+
+ /* Transwarp text */
+ if (me->p_flags & PFTWARP)
+ {
+ W_ClearArea (tstatw, 38, 3, W_Textwidth * 8, W_Textheight);
+ W_WriteText (tstatw, 38, 3, W_White, "Twarp", 5, W_BoldFont);
+ }
+ /* Tournament extension text */
+ if (tdelay)
+ {
+ if (time (0) > tdelay)
+ tdelay = 0;
+ else
+ {
+ W_ClearArea (tstatw, 38, 3, W_Textwidth * 8, W_Textheight);
+ W_WriteText (tstatw, 38, 3, W_Grey, "Tmod", 4, W_BoldFont);
+ sprintf(buf, "%d", tdelay - time (0));
+ W_WriteText (tstatw, 68, 3, textColor, buf, strlen (buf), W_RegularFont);
+ }
+ }
+
+ /* Repair text */
+ if ((me->p_flags & PFREPAIR) && plr->p_speed == 0)
+ {
+ repairtime = repair_time();
+ W_ClearArea (tstatw, 38, 3, W_Textwidth * 8, W_Textheight);
+ W_WriteText (tstatw, 38, 3, W_Cyan, "Fix", 3, W_BoldFont);
+ sprintf(buf, "%d", repairtime);
+ W_WriteText (tstatw, 62, 3, textColor, buf, strlen (buf), W_RegularFont);
+ }
+
+ /* Refit text */
+ if (rdelay)
+ {
+ if (time (0) > rdelay)
+ rdelay = 0;
+ else
+ {
+ W_ClearArea (tstatw, 38, 3, W_Textwidth * 8, W_Textheight);
+ W_WriteText (tstatw, 38, 3, W_Green, "Refit", 5, W_BoldFont);
+ sprintf(buf, "%d", rdelay - time (0));
+ W_WriteText (tstatw, 74, 3, textColor, buf, strlen (buf), W_RegularFont);
+ }
+ }
+
+ /* Declare War text */
+ if (delay)
+ {
+ if (time (0) > delay)
+ delay = 0;
+ else
+ {
+ W_ClearArea (tstatw, 38, 3, W_Textwidth * 8, W_Textheight);
+ W_WriteText (tstatw, 38, 3, W_Red, "War", 3, W_BoldFont);
+ sprintf(buf, "%d", delay - time (0));
+ W_WriteText (tstatw, 62, 3, textColor, buf, strlen (buf), W_RegularFont);
+ }
+ }
+}
+
+
+/******************************************************************************/
/*** db_flags() ***/
/******************************************************************************/
static void
@@ -274,7 +363,7 @@
static float old_kills = -1.0;
static int old_torp = -1;
static unsigned int old_flags = (unsigned int) -1;
- static int old_tourn = -1;
+ static int old_tourn = 0;
char buf[16];
struct player *plr;
@@ -315,19 +404,25 @@
buf[11] = 'd';
else
buf[11] = ' ';
-
+
W_WriteText (tstatw, 2, 3, textColor, "Flags", 5, W_RegularFont);
W_WriteText (tstatw, 2, 17, textColor, buf, 12, W_RegularFont);
old_flags = me->p_flags;
}
-
+
if (fr || status->tourn != old_tourn)
{
if (status->tourn)
+ {
W_WriteText (tstatw, 74, 17, textColor, "T", 1, W_BoldFont);
+ tdelay = 0;
+ }
else
+ {
+ if (status->tourn != old_tourn && !tdelay)
+ tdelay = time (0) + TOURNEXTENDTIME;
W_WriteText (tstatw, 74, 17, textColor, " ", 1, W_BoldFont);
-
+ }
old_tourn = status->tourn;
}
@@ -391,6 +486,7 @@
W_ClearWindow (tstatw);
db_flags (fr);
+ db_special ();
/* TIMER */
db_timer (fr, 2, 3 + 2 * (W_Textheight + SPACING));
@@ -550,6 +646,7 @@
W_ClearWindow (tstatw);
db_flags (fr);
+ db_special ();
db_timer (fr, 2, 3 + 2 * (W_Textheight + SPACING));
@@ -700,3 +797,59 @@
db_redraw_COW (fr);
}
}
+
+/******************************************************************************/
+/*** repair_time() - calculate time left till ship is fully repaired
+ using server defined repair rates. Only called when
+ ship is at warp 0 and under repair ***/
+/******************************************************************************/
+int
+repair_time (void)
+{
+ int shieldtime = 0;
+ int hulltime = 0;
+ int shieldneeded, hullneeded;
+ float shieldrate = 0.0, hullrate = 0.0;
+
+ /* 100 subshield or subdamage = 1 shield or hull repaired
+ This routine is used by server every update (and 10 updates/sec) */
+ /* calculate shield repair rate */
+ if ((shieldneeded = (me->p_ship.s_maxshield - me->p_shield)) > 0)
+ {
+ me->p_subshield = me->p_ship.s_repair * 4;
+ if ((me->p_flags & PFORBIT)
+ && (planets[me->p_planet].pl_flags & PLREPAIR)
+ &&(!(planets[me->p_planet].pl_owner & (me->p_swar | me->p_hostile))))
+ {
+ me->p_subshield += me->p_ship.s_repair * 4;
+ }
+ if (me->p_flags & PFDOCK)
+ {
+ me->p_subshield += me->p_ship.s_repair * 6;
+ }
+ /* Calculate time needed to repair shields */
+ shieldrate = (float)(me->p_subshield)/(float)100.0;
+ shieldtime = (int)(shieldneeded/shieldrate);
+ }
+
+ /* calculate hull repair rate */
+ if (((hullneeded = me->p_damage) > 0) && !(me->p_flags & PFSHIELD))
+ {
+ me->p_subdamage = me->p_ship.s_repair * 2;
+ if ((me->p_flags & PFORBIT)
+ && (planets[me->p_planet].pl_flags & PLREPAIR)
+ && (!(planets[me->p_planet].pl_owner & (me->p_swar | me->p_hostile))))
+ {
+ me->p_subdamage += me->p_ship.s_repair * 2;
+ }
+ if (me->p_flags & PFDOCK)
+ {
+ me->p_subdamage += me->p_ship.s_repair * 3;
+ }
+ /* Calculate time needed to repair hull */
+ hullrate = (float)(me->p_subdamage)/(float)100.0;
+ hulltime = (int)(hullneeded/hullrate);
+ }
+
+ return MAX(shieldtime, hulltime);
+};
\ No newline at end of file
Index: data.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/data.c,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -d -r1.19 -r1.20
--- data.c 16 May 2006 05:10:13 -0000 1.19
+++ data.c 18 May 2006 07:15:35 -0000 1.20
@@ -79,8 +79,9 @@
struct plupdate pl_update[MAXPLANETS];
char buttonmap[23] = { '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0' };
int lastm = 0;
-int delay = 0; /* delay for decaring war */
-int rdelay = 0; /* delay for refitting */
+time_t delay = 0; /* time stamp for decaring war */
+time_t rdelay = 0; /* time stamp for refitting */
+time_t tdelay = 0; /* time stamp for T mode extension */
int showPlanetNames = 1;
int autoQuit = 60;
int showStats = 0;
Index: warning.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/warning.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- warning.c 7 May 2006 16:59:27 -0000 1.5
+++ warning.c 18 May 2006 07:15:35 -0000 1.6
@@ -27,7 +27,7 @@
void
warning (char *text)
{
- int doPhaser;
+ int doPhaser, doRefit, doDeclare;
time_t curtime;
struct tm *tm;
char newtext[128];
@@ -40,8 +40,14 @@
}
doPhaser = (strncmp (text, "Phaser burst", 12) == 0);
-
+ doRefit = (strncmp (text, "You are being transported", 25) == 0);
+ doDeclare = (strncmp (text, "Pausing ten seconds to re-program", 33) == 0);
warncount = strlen (text);
+
+ if (doRefit)
+ rdelay = time (0) + REFITTIME;
+ if (doDeclare)
+ delay = time (0) + DECLARETIME;
#ifdef PHASER_STATS
if (doPhaser && phaserStats)
{
Index: dashboard3.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/dashboard3.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- dashboard3.c 7 May 2006 16:59:27 -0000 1.4
+++ dashboard3.c 18 May 2006 07:15:35 -0000 1.5
@@ -241,13 +241,95 @@
/******************************************************************************/
+/*** db_special() - for showing prioritized timer info in dashboard ***/
+/******************************************************************************/
+static void
+db_special (void)
+{
+ char buf[16];
+ struct player *plr;
+ int repairtime;
+
+ if ((me->p_flags & (PFPLOCK | PFOBSERV)) == (PFPLOCK | PFOBSERV))
+ plr = players + me->p_playerl;
+ else
+ plr = me;
+
+ /* Start with low priority messages, clear as necessary for higher
+ priority ones */
+
+ /* Default impulse text */
+ W_ClearArea (tstatw, 160, 32, W_Textwidth * 8, W_Textheight);
+ W_WriteText (tstatw, 160, 32, W_Yellow, "Impulse", 7, W_BoldFont);
+
+ /* Transwarp text */
+ if (me->p_flags & PFTWARP)
+ {
+ W_ClearArea (tstatw, 160, 32, W_Textwidth * 8, W_Textheight);
+ W_WriteText (tstatw, 160, 32, W_White, "Twarp", 5, W_BoldFont);
+ }
+ /* Tournament extension text */
+ if (tdelay)
+ {
+ if (time (0) > tdelay)
+ tdelay = 0;
+ else
+ {
+ W_ClearArea (tstatw, 160, 32, W_Textwidth * 8, W_Textheight);
+ W_WriteText (tstatw, 160, 32, W_Grey, "Tmod", 4, W_BoldFont);
+ sprintf(buf, "%d", tdelay - time (0));
+ W_WriteText (tstatw, 190, 32, textColor, buf, strlen (buf), W_RegularFont);
+ }
+ }
+
+ /* Repair text */
+ if ((me->p_flags & PFREPAIR) && plr->p_speed == 0)
+ {
+ repairtime = repair_time();
+ W_ClearArea (tstatw, 160, 32, W_Textwidth * 8, W_Textheight);
+ W_WriteText (tstatw, 160, 32, W_Cyan, "Fix", 3, W_BoldFont);
+ sprintf(buf, "%d", repairtime);
+ W_WriteText (tstatw, 184, 32, textColor, buf, strlen (buf), W_RegularFont);
+ }
+
+ /* Refit text */
+ if (rdelay)
+ {
+ if (time (0) > rdelay)
+ rdelay = 0;
+ else
+ {
+ W_ClearArea (tstatw, 160, 32, W_Textwidth * 8, W_Textheight);
+ W_WriteText (tstatw, 160, 32, W_Green, "Refit", 5, W_BoldFont);
+ sprintf(buf, "%d", rdelay - time (0));
+ W_WriteText (tstatw, 196, 32, textColor, buf, strlen (buf), W_RegularFont);
+ }
+ }
+
+ /* Declare War text */
+ if (delay)
+ {
+ if (time (0) > delay)
+ delay = 0;
+ else
+ {
+ W_ClearArea (tstatw, 160, 32, W_Textwidth * 8, W_Textheight);
+ W_WriteText (tstatw, 160, 32, W_Red, "War", 3, W_BoldFont);
+ sprintf(buf, "%d", delay - time (0));
+ W_WriteText (tstatw, 184, 32, textColor, buf, strlen (buf), W_RegularFont);
+ }
+ }
+}
+
+
+/******************************************************************************/
/*** db_flags() ***/
/******************************************************************************/
static void
db_flags (int fr)
{
static unsigned int old_flags = (unsigned int) -1;
- static unsigned char old_tourn = (unsigned char) -1;
+ static unsigned char old_tourn = (unsigned char) 0;
char buf[13];
@@ -315,10 +397,13 @@
if (status->tourn)
{
buf[12] = 't';
+ tdelay = 0;
}
else
{
buf[12] = ' ';
+ if (status->tourn != old_tourn && !tdelay)
+ tdelay = time (0) + TOURNEXTENDTIME;
}
W_WriteText (tstatw, 2, 32, W_White, buf, 13, W_RegularFont);
@@ -340,19 +425,28 @@
static int old_wpn = -1, old_egn = -1;
static int old_ful = -1;
static float old_kills = -1;
+ static int old_torp = -1;
int cur_max, cur_arm, label_len;
char label[32];
float kills;
+ int torp;
if ((me->p_flags & (PFPLOCK | PFOBSERV)) == (PFPLOCK | PFOBSERV))
+ {
kills = players[me->p_playerl].p_kills;
+ torp = players[me->p_playerl].p_ntorp;
+ }
else
+ {
kills = me->p_kills;
+ torp = me->p_ntorp;
+ }
if (fr)
W_ClearWindow (tstatw);
db_flags (fr);
+ db_special ();
/* TIMER */
db_timer (fr, WINSIDE - 12 * W_Textwidth, 32);
@@ -551,7 +645,30 @@
old_kills = kills;
}
-
+
+ if (fr || (old_torp != torp))
+ {
+ W_ClearArea (tstatw, 242, 32, 72, W_Textheight);
+
+ if (torp > 0)
+ {
+ label[0] = ' ';
+ label[1] = 'T';
+ label[2] = 'o';
+ label[3] = 'r';
+ label[4] = 'p';
+ label[5] = 's';
+ label[6] = ':';
+ label[7] = ' ';
+ label_len = 8 + db_itoa (&label[8], torp);
+
+ W_WriteText (tstatw,
+ 242, 32,
+ W_White, label, label_len, W_RegularFont);
+ }
+ old_torp = torp;
+ }
+
old_spd = me->p_speed;
old_cur_max = cur_max;
old_shl = me->p_shield;