Update of /cvsroot/netrek/client/netrekxp/src In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv27015/src Modified Files: dashboard.c data.c defaults.c local.c mswindow.c newwin.c option.c Log Message: Fixed KRP dashboard hull display upon death Added "warnHull: on/(off)" to visually display hull status as a series of dots around your ship. Modelled after warnHull implementation in COW, except that I use an actual bitmap rather than the hullbitmap header file to define the bitmaps. Index: mswindow.c =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/src/mswindow.c,v retrieving revision 1.35 retrieving revision 1.36 diff -u -d -r1.35 -r1.36 --- mswindow.c 12 Jun 2006 14:10:31 -0000 1.35 +++ mswindow.c 13 Jun 2006 11:18:23 -0000 1.36 @@ -604,6 +604,9 @@ free (shield); #endif + for (i = 0; i < BMP_HULL_FRAMES; i++) + free (hull[i]); + free (cloakicon); free (stipple); free (genopic); @@ -4586,7 +4589,7 @@ SetScrollRange (win->hwnd, SB_VERT, 0, y, FALSE); SetScrollPos (win->hwnd, SB_VERT, y, TRUE); - //Scroll up however many lines. Use ScrollDC se we don't invalidate the window + //Scroll up however many lines. Use ScrollDC so we don't invalidate the window y = win->TextHeight - win->AddedStrings; if (y < 0) //Pathalogical case (but it does happen): Index: dashboard.c =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/src/dashboard.c,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- dashboard.c 3 Jun 2006 21:52:11 -0000 1.11 +++ dashboard.c 13 Jun 2006 11:18:23 -0000 1.12 @@ -591,7 +591,7 @@ else color = W_Green; db_bar ("Hu", 90, 31, - (me->p_ship.s_maxdamage - me->p_damage), + max(0,(me->p_ship.s_maxdamage - me->p_damage)), // Can't display negative hull values me->p_ship.s_maxdamage, me->p_ship.s_maxdamage, DB_3DIGITS, color); old_dam = me->p_damage; Index: newwin.c =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/src/newwin.c,v retrieving revision 1.38 retrieving revision 1.39 diff -u -d -r1.38 -r1.39 --- newwin.c 12 Jun 2006 14:10:31 -0000 1.38 +++ newwin.c 13 Jun 2006 11:18:23 -0000 1.39 @@ -1296,10 +1296,17 @@ LR_MONOCHROME); for (i = 0; i < SHIELD_FRAMES; i++) shield[i] = - W_PointBitmap2 (base_vshield, 0, i, BMP_SHIELD_WIDTH, - BMP_SHIELD_HEIGHT); + W_PointBitmap2 (base_vshield, 0, i, BMP_SHIELD_WIDTH, BMP_SHIELD_HEIGHT); #endif + base_hull = + W_StoreBitmap3 ("bitmaps/misclib/varyhull.bmp", hull_width, + hull_height * BMP_HULL_FRAMES, BMP_HULL, w, + LR_MONOCHROME); + for (i = 0; i < BMP_HULL_FRAMES; i++) + hull[i] = + W_PointBitmap2 (base_hull, 0, i, hull_width, hull_height); + cloakicon = W_StoreBitmap3 ("bitmaps/misclib/cloak.bmp", BMP_CLOAK_WIDTH, BMP_CLOAK_HEIGHT, BMP_CLOAK, w, LR_MONOCHROME); Index: local.c =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/src/local.c,v retrieving revision 1.42 retrieving revision 1.43 diff -u -d -r1.42 -r1.43 --- local.c 12 Jun 2006 14:10:30 -0000 1.42 +++ local.c 13 Jun 2006 11:18:23 -0000 1.43 @@ -1107,6 +1107,65 @@ dy - (shield_height / 2), shield, color, w); #endif } + /* Warning hull */ + if (vary_hull) + { + if (myPlayer(j) || isObsLockPlayer(j)) + { + int hull_left = (100 * (me->p_ship.s_maxdamage - + me->p_damage)) / me->p_ship.s_maxdamage; + int hull_num = 7; + int hull_color; + + if (hull_left <= 16) + { + hull_num = 0; + hull_color = W_Red; + } + else if (hull_left <= 28) + { + hull_num = 1; + hull_color = W_Red; + } + else if (hull_left <= 40) + { + hull_num = 2; + hull_color = W_Red; + } + else if (hull_left <= 52) + { + hull_num = 3; + hull_color = W_Yellow; + } + else if (hull_left <= 64) + { + hull_num = 4; + hull_color = W_Yellow; + } + else if (hull_left <= 76) + { + hull_num = 5; + hull_color = W_Yellow; + } + else if (hull_left <= 88) + { + hull_num = 6; + hull_color = W_Yellow; + } + else + hull_color = playerColor(j); + + W_WriteBitmap(dx - (shield_width / 2 + 1), + dy - (shield_height / 2 + 1), + hull[hull_num], hull_color, w); + + clearzone[0][clearcount] = dx - (shield_width / 2 + 1); + clearzone[1][clearcount] = dy - (shield_height / 2 + 1); + clearzone[2][clearcount] = shield_width + 2; + clearzone[3][clearcount] = shield_height + 2; + clearcount++; + } + } /* Det circle */ if (detCircle) { Index: defaults.c =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/src/defaults.c,v retrieving revision 1.25 retrieving revision 1.26 diff -u -d -r1.25 -r1.26 --- defaults.c 9 Jun 2006 02:14:08 -0000 1.25 +++ defaults.c 13 Jun 2006 11:18:23 -0000 1.26 @@ -750,6 +750,12 @@ NULL } }, + {"warnHull", &vary_hull, RC_BOOL, + { + "Warn hull state based on damage", + NULL + } + }, {"warnShields", &warnShields, RC_BOOL, { "Change shields color on enemy approach", @@ -1495,6 +1501,7 @@ #endif warnShields = booleanDefault ("warnShields", warnShields); + vary_hull = booleanDefault("warnHull", vary_hull); #ifdef RSA if (useRsa >= 0) Index: data.c =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/src/data.c,v retrieving revision 1.36 retrieving revision 1.37 diff -u -d -r1.36 -r1.37 --- data.c 12 Jun 2006 14:10:29 -0000 1.36 +++ data.c 13 Jun 2006 11:18:23 -0000 1.37 @@ -284,6 +284,10 @@ #endif +W_Icon base_hull; +W_Icon hull[BMP_HULL_FRAMES]; +int vary_hull = 0; + // Ships W_Icon ship_bitmaps[5]; W_Icon fed_bitmaps[NUM_TYPES][SHIP_VIEWS], kli_bitmaps[NUM_TYPES][SHIP_VIEWS], Index: option.c =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/src/option.c,v retrieving revision 1.22 retrieving revision 1.23 diff -u -d -r1.22 -r1.23 --- option.c 6 Jun 2006 19:50:39 -0000 1.22 +++ option.c 13 Jun 2006 11:18:23 -0000 1.23 @@ -255,6 +255,7 @@ {1, "vary shields bitmap", &varyShields, 0, 0, 0, NULL, NULL}, #endif {1, "use warning shields", &warnShields, 0, 0, 0, NULL, NULL}, + {1, "use warning hull", &vary_hull, 0, 0, 0, NULL, NULL}, {1, "show speed on tactical", &showMySpeed, 0, 0, 0, NULL, NULL}, #ifdef JUBILEE_PHASERS {1, "use colorful phasers", &colorfulPhasers, 0, 0, 0, NULL, NULL},