Gnome updates (from <Someone> <Someone> Simon)

- fix destruction of primary game windows
- One, it makes the color of the cursor box dynamic (these are the gnmap.c
changes), based on hp/hpmax (continuous colors white -> yellow -> red ->
magenta rather than discrete like in Qt).
- Two, it adds a new window, NHW_WORN (all the other changes and new files
gnworn.[ch]), placed at the end of the first row, to the right of the status,
with tiles of all the items currently equiped.  I had to change the spacing of
the first row (no longer homogeneous) to accomodate this, but I think it still
looks okay.  It's mostly like the Qt version but the equiped items are in
slightly different places, and a bit more compactly (added quiver, ball/chain,
monster skin armor; see the definition in gnworn.c for the layout).
This commit is contained in:
cohrs
2002-04-21 17:09:34 +00:00
parent a277db8f73
commit b1055ae7c1
11 changed files with 169 additions and 9 deletions

View File

@@ -341,22 +341,30 @@ ghack_map_cursor_to( GtkWidget *win, int x, int y, gpointer data)
static GnomeCanvasRE *cursor = NULL;
double x1, y1, x2, y2;
float hp;
guint r, g, b;
x1 = x * ghack_glyph_width() - 1;
y1 = y * ghack_glyph_height() - 1;
x2 = x1 + ghack_glyph_width() + 2;
y2 = y1 + ghack_glyph_height() + 2;
hp = u.mtimedone
? (u.mhmax ? (float)u.mh/u.mhmax : 1)
: (u.uhpmax ? (float)u.uhp/u.uhpmax : 1);
r = 255;
g = (hp >= 0.75) ? 255 : (hp >= 0.25 ? 255*2*(hp-0.25) : 0);
b = (hp >= 0.75) ? 255*4*(hp-0.75) : (hp >= 0.25 ? 0 : 255*4*(0.25-hp));
group = gnome_canvas_root(GNOME_CANVAS(ghack_map.canvas));
if (!cursor) {
cursor = GNOME_CANVAS_RE (gnome_canvas_item_new (group,
gnome_canvas_rect_get_type (),
"outline_color", "antiquewhite2",
"width_units", 1.0, NULL));
}
gnome_canvas_item_set (GNOME_CANVAS_ITEM (cursor),
"outline_color_rgba", GNOME_CANVAS_COLOR(r, g, b),
"x1", x1,
"y1", y1,
"x2", x2,