OSDN Git Service

guarantee an alter on oracle
[nethackexpress/trunk.git] / win / gnome / gnstatus.c
1 /*      SCCS Id: @(#)gnstatus.c 3.4     2000/07/16      */
2 /* Copyright (C) 1998 by Erik Andersen <andersee@debian.org> */
3 /* NetHack may be freely redistributed.  See license for details. */
4
5 #include "gnstatus.h"
6 #include "gnsignal.h"
7 #include "gn_xpms.h"
8 #include "gnomeprv.h"
9
10
11 extern const char *hu_stat[]; /* from eat.c */
12 extern const char *enc_stat[]; /* from botl.c */
13
14 void ghack_status_window_update_stats();
15 void ghack_status_window_clear(GtkWidget *win, gpointer data);
16 void ghack_status_window_destroy(GtkWidget *win, gpointer data);
17 void ghack_status_window_display(GtkWidget *win, boolean block, gpointer data);
18 void ghack_status_window_cursor_to(GtkWidget *win, int x, int y, gpointer data);
19 void ghack_status_window_put_string(GtkWidget *win, int attr, const char* text, gpointer data);
20
21 static void ghack_fade_highlighting();
22 static void ghack_highlight_widget( GtkWidget* widget, GtkStyle* oldStyle, 
23         GtkStyle* newStyle);
24
25 /* some junk to handle when to fade the highlighting */
26 #define NUM_TURNS_HIGHLIGHTED   3
27
28 static GList    *s_HighLightList;
29
30 typedef struct {
31     GtkWidget*  widget;
32     GtkStyle*   oldStyle;
33     int         nTurnsLeft;
34 } Highlight;
35
36
37 /* Ok, now for a LONG list of widgets... */
38 static GtkWidget* statTable = NULL;
39 static GtkWidget* titleLabel = NULL;
40 static GtkWidget* dgnLevelLabel = NULL;
41 static GtkWidget* strPix = NULL;
42 static GtkWidget* strLabel = NULL;
43 static GtkWidget* dexPix = NULL;
44 static GtkWidget* dexLabel = NULL;
45 static GtkWidget* intPix = NULL;
46 static GtkWidget* intLabel = NULL;
47 static GtkWidget* wisPix = NULL;
48 static GtkWidget* wisLabel = NULL;
49 static GtkWidget* conPix = NULL;
50 static GtkWidget* conLabel = NULL;
51 static GtkWidget* chaPix = NULL;
52 static GtkWidget* chaLabel = NULL;
53 static GtkWidget* goldLabel = NULL;
54 static GtkWidget* hpLabel = NULL;
55 static GtkWidget* powLabel = NULL;
56 static GtkWidget* acLabel = NULL;
57 static GtkWidget* levlLabel = NULL;
58 static GtkWidget* expLabel = NULL;
59 static GtkWidget* timeLabel = NULL;
60 static GtkWidget* scoreLabel = NULL;
61 static GtkWidget* alignPix = NULL;
62 static GtkWidget* alignLabel = NULL;
63 static GtkWidget* hungerPix = NULL;
64 static GtkWidget* hungerLabel = NULL;
65 static GtkWidget* sickPix = NULL;
66 static GtkWidget* sickLabel = NULL;
67 static GtkWidget* blindPix = NULL;
68 static GtkWidget* blindLabel = NULL;
69 static GtkWidget* stunPix = NULL;
70 static GtkWidget* stunLabel = NULL;
71 static GtkWidget* halluPix = NULL;
72 static GtkWidget* halluLabel = NULL;
73 static GtkWidget* confuPix = NULL;
74 static GtkWidget* confuLabel = NULL;
75 static GtkWidget* encumbPix = NULL;
76 static GtkWidget* encumbLabel = NULL;
77
78
79 static GtkStyle* normalStyle = NULL;
80 static GtkStyle* bigStyle = NULL;
81 static GtkStyle* redStyle = NULL;
82 static GtkStyle* greenStyle = NULL;
83 static GtkStyle* bigRedStyle = NULL;
84 static GtkStyle* bigGreenStyle = NULL;
85
86 /* Pure red */
87 static GdkColor color_red   = { 0, 0xff00, 0, 0 };
88 /* ForestGreen (looks better than just pure green) */
89 static GdkColor color_green = { 0, 0x2200, 0x8b00, 0x2200 };
90
91 static int lastDepth;
92 static int lastStr;
93 static int lastInt;
94 static int lastWis;
95 static int lastDex;
96 static int lastCon;
97 static int lastCha;
98 static long lastAu;
99 static int lastHP;
100 static int lastMHP;
101 static int lastLevel;
102 static int lastPOW;
103 static int lastMPOW;
104 static int lastAC;
105 static int lastExp;
106 static aligntyp lastAlignment;  
107 static unsigned lastHungr;
108 static long lastConf;
109 static long lastBlind;
110 static long lastStun;
111 static long lastHalu;
112 static long lastSick;
113 static int lastEncumb;
114
115 void ghack_status_window_clear( GtkWidget *win, gpointer data)
116 {
117     /* Don't think we need this at all */
118 }
119
120 void ghack_status_window_destroy(GtkWidget *win, gpointer data)
121 {
122     while (s_HighLightList) {
123         g_free( (Highlight*)s_HighLightList->data);
124         s_HighLightList = s_HighLightList->next;
125     }
126     g_list_free( s_HighLightList );
127 }
128
129 void ghack_status_window_display( GtkWidget *win, boolean block, gpointer data)
130 {
131     gtk_widget_show_all( GTK_WIDGET(win));
132 }
133
134 void ghack_status_window_cursor_to( GtkWidget *win, int x, int y, gpointer data)
135 {
136     /* Don't think we need this at all */
137 }
138
139 void ghack_status_window_put_string( GtkWidget *win, int attr, const char* text, gpointer data)
140 {
141     ghack_status_window_update_stats();
142 }
143
144
145
146 GtkWidget* ghack_init_status_window ()
147 {
148     GtkWidget *horizSep0, *horizSep1, *horizSep2, *horizSep3;
149     GtkWidget *statsHBox, *strVBox, *dexVBox, *intVBox, *statHBox;
150     GtkWidget *wisVBox, *conVBox, *chaVBox;
151     GtkWidget *alignVBox, *hungerVBox, *sickVBox, *blindVBox;
152     GtkWidget *stunVBox, *halluVBox, *confuVBox, *encumbVBox;
153    
154     /* Set up a (ridiculous) initial state */
155     lastDepth = 9999;
156     lastStr = 9999;
157     lastInt = 9999;
158     lastWis = 9999;
159     lastDex = 9999;
160     lastCon = 9999;
161     lastCha = 9999;
162     lastAu = 9999;
163     lastHP = 9999;
164     lastMHP = 9999;
165     lastLevel = 9999;
166     lastPOW = 9999;
167     lastMPOW = 9999;
168     lastAC = 9999;
169     lastExp = 9999;
170     lastAlignment = A_NEUTRAL;  /* start off guessing neutral */
171     lastHungr = 9999;
172     lastConf = 9999;
173     lastBlind = 9999;
174     lastStun = 9999;
175     lastHalu = 9999;
176     lastSick = 9999;
177     lastEncumb = 9999;
178
179     statTable = gtk_table_new( 10, 8, FALSE);
180     gtk_table_set_row_spacings( GTK_TABLE( statTable), 1);
181     gtk_table_set_col_spacings( GTK_TABLE( statTable), 1);
182
183
184     /* Begin the first row of the table -- the title */
185     titleLabel = gtk_label_new( _("GnomeHack!")); 
186     gtk_table_attach( GTK_TABLE( statTable), titleLabel, 
187             0, 8, 0, 1, GTK_FILL, 0, 0, 0);
188     if (!normalStyle)
189       normalStyle = gtk_style_copy (
190                 gtk_widget_get_style (GTK_WIDGET (titleLabel)));
191
192     /* Set up some styles to draw stuff with */
193     if (!redStyle) {
194       g_assert (greenStyle == NULL);
195       g_assert (bigStyle == NULL);
196       g_assert (bigRedStyle == NULL);
197       g_assert (bigGreenStyle == NULL);
198
199       greenStyle = gtk_style_copy (normalStyle);
200       redStyle = gtk_style_copy (normalStyle);
201       bigRedStyle = gtk_style_copy (normalStyle);
202       bigGreenStyle = gtk_style_copy (normalStyle);
203       bigStyle = gtk_style_copy (normalStyle);
204
205       greenStyle->fg[GTK_STATE_NORMAL] = color_green;
206       redStyle->fg[GTK_STATE_NORMAL] = color_red;
207       bigRedStyle->fg[GTK_STATE_NORMAL] = color_red;
208       bigGreenStyle->fg[GTK_STATE_NORMAL] = color_green;
209
210       gdk_font_unref (bigRedStyle->font);
211       gdk_font_unref (bigGreenStyle->font);
212       bigRedStyle->font = gdk_font_load("-misc-fixed-*-*-*-*-20-*-*-*-*-*-*-*");
213       bigGreenStyle->font = gdk_font_load("-misc-fixed-*-*-*-*-20-*-*-*-*-*-*-*");
214
215       gdk_font_unref (bigStyle->font);
216       bigStyle->font = gdk_font_load ("-misc-fixed-*-*-*-*-20-*-*-*-*-*-*-*");
217     }
218     gtk_widget_set_style (GTK_WIDGET (titleLabel), bigStyle);
219     
220     /* Begin the second row */
221     dgnLevelLabel = gtk_label_new (_ ("Nethack for Gnome")); 
222     gtk_table_attach (GTK_TABLE (statTable), dgnLevelLabel, 
223             0, 8, 1, 2, GTK_FILL, 0, 0, 0);
224     gtk_widget_set_style (GTK_WIDGET (dgnLevelLabel), bigStyle);
225     
226     /* Begin the third row */
227     horizSep0 = gtk_hseparator_new (); 
228     gtk_table_attach (GTK_TABLE (statTable), horizSep0, 
229             0, 8, 2, 3, GTK_FILL, GTK_FILL, 0, 0);
230
231
232     /* Begin the fourth row */
233     statsHBox = gtk_hbox_new (TRUE, 0);
234
235     strVBox = gtk_vbox_new (FALSE, 0);
236     strPix =  gnome_pixmap_new_from_xpm_d( str_xpm);
237     strLabel = gtk_label_new( "STR: ");
238     gtk_box_pack_start (GTK_BOX (strVBox), strPix, TRUE, TRUE, 2);
239     gtk_box_pack_start (GTK_BOX (strVBox), strLabel, TRUE, TRUE, 2);
240     gtk_box_pack_start (GTK_BOX(statsHBox), GTK_WIDGET(strVBox), TRUE, TRUE, 2);
241
242     dexVBox = gtk_vbox_new (FALSE, 0);
243     dexPix =  gnome_pixmap_new_from_xpm_d( dex_xpm);
244     dexLabel = gtk_label_new( "DEX: ");
245     gtk_box_pack_start (GTK_BOX (dexVBox), dexPix, TRUE, TRUE, 2);
246     gtk_box_pack_start (GTK_BOX (dexVBox), dexLabel, TRUE, TRUE, 2);
247     gtk_box_pack_start (GTK_BOX(statsHBox), GTK_WIDGET(dexVBox), TRUE, TRUE, 2);
248
249     conVBox = gtk_vbox_new (FALSE, 0);
250     conPix =  gnome_pixmap_new_from_xpm_d( cns_xpm);
251     conLabel = gtk_label_new( "CON: ");
252     gtk_box_pack_start (GTK_BOX (conVBox), conPix, TRUE, TRUE, 2);
253     gtk_box_pack_start (GTK_BOX (conVBox), conLabel, TRUE, TRUE, 2);
254     gtk_box_pack_start (GTK_BOX(statsHBox), GTK_WIDGET(conVBox), TRUE, TRUE, 2);
255
256     intVBox = gtk_vbox_new (FALSE, 0);
257     intPix =  gnome_pixmap_new_from_xpm_d( int_xpm);
258     intLabel = gtk_label_new( "INT: ");
259     gtk_box_pack_start (GTK_BOX (intVBox), intPix, TRUE, TRUE, 2);
260     gtk_box_pack_start (GTK_BOX (intVBox), intLabel, TRUE, TRUE, 2);
261     gtk_box_pack_start (GTK_BOX(statsHBox), GTK_WIDGET(intVBox), TRUE, TRUE, 2);
262
263
264     wisVBox = gtk_vbox_new (FALSE, 0);
265     wisPix =  gnome_pixmap_new_from_xpm_d( wis_xpm);
266     wisLabel = gtk_label_new( "WIS: ");
267     gtk_box_pack_start (GTK_BOX (wisVBox), wisPix, TRUE, TRUE, 2);
268     gtk_box_pack_start (GTK_BOX (wisVBox), wisLabel, TRUE, TRUE, 2);
269     gtk_box_pack_start (GTK_BOX(statsHBox), GTK_WIDGET(wisVBox), TRUE, TRUE, 2);
270
271
272     chaVBox = gtk_vbox_new (FALSE, 0);
273     chaPix =  gnome_pixmap_new_from_xpm_d( cha_xpm);
274     chaLabel = gtk_label_new( "CHA: ");
275     gtk_box_pack_start (GTK_BOX (chaVBox), chaPix, TRUE, TRUE, 2);
276     gtk_box_pack_start (GTK_BOX (chaVBox), chaLabel, TRUE, TRUE, 2);
277     gtk_box_pack_start (GTK_BOX(statsHBox), GTK_WIDGET(chaVBox), TRUE, TRUE, 2);
278     
279     gtk_table_attach( GTK_TABLE( statTable),  GTK_WIDGET(statsHBox), 
280             0, 8, 3, 4, GTK_FILL, 0, 0, 0);
281
282     /* Begin the fifth row */
283     horizSep1 = gtk_hseparator_new(); 
284     gtk_table_attach( GTK_TABLE( statTable), horizSep1, 
285             0, 8, 4, 5, GTK_FILL, GTK_FILL, 0, 0);
286
287     /* Begin the sixth row */
288     hpLabel = gtk_label_new( "HP: ");
289     gtk_table_attach( GTK_TABLE( statTable), hpLabel, 
290             0, 1, 5, 6, GTK_FILL, 0, 0, 0);
291         
292     acLabel = gtk_label_new( "AC: ");
293     gtk_table_attach( GTK_TABLE( statTable), acLabel, 
294             2, 3, 5, 6, GTK_FILL, 0, 0, 0);
295     
296     powLabel = gtk_label_new( "Power: ");
297     gtk_table_attach( GTK_TABLE( statTable), powLabel, 
298             4, 5, 5, 6, GTK_FILL, 0, 0, 0);
299     
300     goldLabel = gtk_label_new( "Au: ");
301     gtk_table_attach( GTK_TABLE( statTable), goldLabel, 
302             6, 7, 5, 6, GTK_FILL, 0, 0, 0);
303     
304
305     /* Begin the seventh row */
306     horizSep2 = gtk_hseparator_new(); 
307     gtk_table_attach( GTK_TABLE( statTable), horizSep2, 
308             0, 8, 6, 7, GTK_FILL, GTK_FILL, 0, 0);
309
310     
311     /* Begin the eigth row */
312     levlLabel = gtk_label_new( "Level: ");
313     gtk_table_attach( GTK_TABLE( statTable), levlLabel, 
314             0, 1, 7, 8, GTK_FILL, 0, 0, 0);
315         
316     expLabel = gtk_label_new( "Exp: ");
317     gtk_table_attach( GTK_TABLE( statTable), expLabel, 
318             2, 3, 7, 8, GTK_FILL, 0, 0, 0);
319    
320     timeLabel = gtk_label_new( "Time: ");
321     gtk_table_attach( GTK_TABLE( statTable), timeLabel, 
322             4, 5, 7, 8, GTK_FILL, 0, 0, 0);
323     
324     scoreLabel = gtk_label_new( "Score: ");
325     gtk_table_attach( GTK_TABLE( statTable), scoreLabel, 
326             6, 7, 7, 8, GTK_FILL, 0, 0, 0);
327     
328     /* Begin the ninth row */
329     horizSep3 = gtk_hseparator_new(); 
330     gtk_table_attach( GTK_TABLE( statTable), horizSep3, 
331             0, 8, 8, 9, GTK_FILL, GTK_FILL, 0, 0);
332     
333     /* Begin the tenth and last row */
334     statHBox = gtk_hbox_new (FALSE, 0);
335
336     alignVBox = gtk_vbox_new (FALSE, 0);
337     alignPix =  gnome_pixmap_new_from_xpm_d( neutral_xpm);
338     alignLabel = gtk_label_new( "Neutral");
339     gtk_box_pack_start (GTK_BOX (alignVBox), alignPix, TRUE, TRUE, 2);
340     gtk_box_pack_start (GTK_BOX (alignVBox), alignLabel, TRUE, TRUE, 2);
341     gtk_box_pack_start (GTK_BOX(statHBox), GTK_WIDGET(alignVBox), TRUE, FALSE, 2);
342     
343     hungerVBox = gtk_vbox_new (FALSE, 0);
344     hungerPix =  gnome_pixmap_new_from_xpm_d( hungry_xpm);
345     hungerLabel = gtk_label_new( "Hungry");
346     gtk_box_pack_start (GTK_BOX (hungerVBox), hungerPix, TRUE, TRUE, 2);
347     gtk_box_pack_start (GTK_BOX (hungerVBox), hungerLabel, TRUE, TRUE, 2);
348     gtk_box_pack_start (GTK_BOX(statHBox), GTK_WIDGET(hungerVBox), TRUE, FALSE, 2);
349     
350     sickVBox = gtk_vbox_new (FALSE, 0);
351     sickPix =  gnome_pixmap_new_from_xpm_d( sick_fp_xpm);
352     sickLabel = gtk_label_new( "FoodPois");
353     gtk_box_pack_start (GTK_BOX (sickVBox), sickPix, TRUE, TRUE, 2);
354     gtk_box_pack_start (GTK_BOX (sickVBox), sickLabel, TRUE, TRUE, 2);
355     gtk_box_pack_start (GTK_BOX(statHBox), GTK_WIDGET(sickVBox), TRUE, FALSE, 2);
356     
357     blindVBox = gtk_vbox_new (FALSE, 0);
358     blindPix =  gnome_pixmap_new_from_xpm_d( blind_xpm);
359     blindLabel = gtk_label_new( "Blind");
360     gtk_box_pack_start (GTK_BOX (blindVBox), blindPix, TRUE, TRUE, 2);
361     gtk_box_pack_start (GTK_BOX (blindVBox), blindLabel, TRUE, TRUE, 2);
362     gtk_box_pack_start (GTK_BOX(statHBox), GTK_WIDGET(blindVBox), TRUE, FALSE, 2);
363     
364     stunVBox = gtk_vbox_new (FALSE, 0);
365     stunPix =  gnome_pixmap_new_from_xpm_d( stunned_xpm);
366     stunLabel = gtk_label_new( "Stun");
367     gtk_box_pack_start (GTK_BOX (stunVBox), stunPix, TRUE, TRUE, 2);
368     gtk_box_pack_start (GTK_BOX (stunVBox), stunLabel, TRUE, TRUE, 2);
369     gtk_box_pack_start (GTK_BOX(statHBox), GTK_WIDGET(stunVBox), TRUE, FALSE, 2);
370     
371     confuVBox = gtk_vbox_new (FALSE, 0);
372     confuPix =  gnome_pixmap_new_from_xpm_d( confused_xpm);
373     confuLabel = gtk_label_new( "Confused");
374     gtk_box_pack_start (GTK_BOX (confuVBox), confuPix, TRUE, TRUE, 2);
375     gtk_box_pack_start (GTK_BOX (confuVBox), confuLabel, TRUE, TRUE, 2);
376     gtk_box_pack_start (GTK_BOX(statHBox), GTK_WIDGET(confuVBox), TRUE, FALSE, 2);
377     
378     halluVBox = gtk_vbox_new (FALSE, 0);
379     halluPix =  gnome_pixmap_new_from_xpm_d( hallu_xpm);
380     halluLabel = gtk_label_new( "Hallu");
381     gtk_box_pack_start (GTK_BOX (halluVBox), halluPix, TRUE, TRUE, 2);
382     gtk_box_pack_start (GTK_BOX (halluVBox), halluLabel, TRUE, TRUE, 2);
383     gtk_box_pack_start (GTK_BOX(statHBox), GTK_WIDGET(halluVBox), TRUE, FALSE, 2);
384     
385     encumbVBox = gtk_vbox_new (FALSE, 0);
386     encumbPix =  gnome_pixmap_new_from_xpm_d( slt_enc_xpm);
387     encumbLabel = gtk_label_new( "Burdened");
388     gtk_box_pack_start (GTK_BOX (encumbVBox), encumbPix, TRUE, TRUE, 2);
389     gtk_box_pack_start (GTK_BOX (encumbVBox), encumbLabel, TRUE, TRUE, 2);
390     gtk_box_pack_start (GTK_BOX(statHBox), GTK_WIDGET(encumbVBox), TRUE, FALSE, 2);
391
392     gtk_table_attach( GTK_TABLE( statTable), GTK_WIDGET(statHBox), 
393             0, 8, 9, 10, GTK_FILL, GTK_FILL, 0, 0);
394     
395     /* Set up the necessary signals */
396     gtk_signal_connect (GTK_OBJECT (statTable), 
397             "ghack_fade_highlight", 
398             GTK_SIGNAL_FUNC (ghack_fade_highlighting), 
399             NULL);
400
401     gtk_signal_connect (GTK_OBJECT (statTable), 
402             "ghack_putstr", 
403             GTK_SIGNAL_FUNC (ghack_status_window_put_string), 
404             NULL);
405
406     gtk_signal_connect (GTK_OBJECT (statTable), 
407             "ghack_clear", 
408             GTK_SIGNAL_FUNC (ghack_status_window_clear), 
409             NULL);
410
411     gtk_signal_connect (GTK_OBJECT (statTable), 
412             "ghack_curs", 
413             GTK_SIGNAL_FUNC (ghack_status_window_cursor_to), 
414             NULL);
415     gtk_signal_connect(GTK_OBJECT (statTable), 
416             "gnome_delay_output",
417             GTK_SIGNAL_FUNC(ghack_delay), 
418             NULL);
419
420     /* Lastly, show the status window and everything in it */
421     gtk_widget_show_all( statTable);
422
423     return GTK_WIDGET(statTable);
424 }
425
426
427
428 void ghack_status_window_update_stats()
429 {
430     char buf[BUFSZ];
431     gchar *buf1;
432     const char* hung;
433     const char* enc;
434     static int firstTime=TRUE;
435 #ifdef GOLDOBJ
436     long umoney;
437 #endif
438
439     /* First, fill in the player name and the dungeon level */
440     strcpy(buf, plname);
441     if ('a' <= buf[0] && buf[0] <= 'z') buf[0] += 'A'-'a';
442     strcat(buf, " the ");
443     if (u.mtimedone) {
444         char mname[BUFSZ];
445         int k = 0;
446
447         strcpy(mname, mons[u.umonnum].mname);
448         while(mname[k] != 0) {
449             if ((k == 0 || (k > 0 && mname[k-1] == ' '))
450              && 'a' <= mname[k] && mname[k] <= 'z')
451             {
452                 mname[k] += 'A' - 'a';
453             }
454             k++;
455         }
456         strcat(buf, mname);
457     } else {
458         strcat(buf, rank_of(u.ulevel, pl_character[0], flags.female));
459     }
460     gtk_label_get( GTK_LABEL( titleLabel), &buf1);
461     if (strcmp( buf1, buf) != 0 && firstTime==FALSE) {
462         /* Ok, this changed so add it to the highlighing list */
463         ghack_highlight_widget( titleLabel, bigStyle, bigGreenStyle);
464     }
465     gtk_label_set( GTK_LABEL( titleLabel), buf);
466
467
468     if (In_endgame(&u.uz)) {
469         strcpy(buf, (Is_astralevel(&u.uz) ? "Astral Plane":"End Game"));
470     } else {
471         sprintf(buf, "%s, level %d", dungeons[u.uz.dnum].dname, depth(&u.uz));
472     }
473     if (lastDepth > depth(&u.uz) && firstTime==FALSE) {
474         /* Ok, this changed so add it to the highlighing list */
475         ghack_highlight_widget( dgnLevelLabel, bigStyle, bigRedStyle);
476     }
477     else if (lastDepth < depth(&u.uz) && firstTime==FALSE) {
478         /* Ok, this changed so add it to the highlighing list */
479         ghack_highlight_widget( dgnLevelLabel, bigStyle, bigGreenStyle);
480     }
481     lastDepth = depth(&u.uz);
482     gtk_label_set( GTK_LABEL( dgnLevelLabel), buf);
483
484     /* Next, fill in the player's stats */
485     if (ACURR(A_STR) > 118) {
486         sprintf(buf,"STR:%d",ACURR(A_STR)-100);
487     } else if (ACURR(A_STR)==118) {
488         sprintf(buf,"STR:18/**");
489     } else if(ACURR(A_STR) > 18) {
490         sprintf(buf,"STR:18/%02d",ACURR(A_STR)-18);
491     } else {
492         sprintf(buf,"STR:%d",ACURR(A_STR));
493     }
494     if (lastStr < ACURR(A_STR) && firstTime==FALSE) {
495         /* Ok, this changed so add it to the highlighing list */
496         ghack_highlight_widget( strLabel, normalStyle, greenStyle);
497     }
498     else if (lastStr > ACURR(A_STR) && firstTime==FALSE) {
499         /* Ok, this changed so add it to the highlighing list */
500         ghack_highlight_widget( strLabel, normalStyle, redStyle);
501     }
502     lastStr = ACURR(A_STR);
503     gtk_label_set( GTK_LABEL( strLabel), buf);
504
505     sprintf(buf,"INT:%d",ACURR(A_INT));
506     if (lastInt < ACURR(A_INT) && firstTime==FALSE) {
507         /* Ok, this changed so add it to the highlighing list */
508         ghack_highlight_widget( intLabel, normalStyle, greenStyle);
509     }
510     else if (lastInt > ACURR(A_INT) && firstTime==FALSE) {
511         /* Ok, this changed so add it to the highlighing list */
512         ghack_highlight_widget( intLabel, normalStyle, redStyle);
513     }
514     lastInt = ACURR(A_INT);
515     gtk_label_set( GTK_LABEL( intLabel), buf);
516     
517     sprintf(buf,"WIS:%d",ACURR(A_WIS));
518     if (lastWis < ACURR(A_WIS) && firstTime==FALSE) {
519         /* Ok, this changed so add it to the highlighing list */
520         ghack_highlight_widget( wisLabel, normalStyle, greenStyle);
521     }
522     else if (lastWis > ACURR(A_WIS) && firstTime==FALSE) {
523         /* Ok, this changed so add it to the highlighing list */
524         ghack_highlight_widget( wisLabel, normalStyle, redStyle);
525     }
526     lastWis = ACURR(A_WIS);
527     gtk_label_set( GTK_LABEL( wisLabel), buf);
528     
529     sprintf(buf,"DEX:%d",ACURR(A_DEX));
530     if (lastDex < ACURR(A_DEX) && firstTime==FALSE) {
531         /* Ok, this changed so add it to the highlighing list */
532         ghack_highlight_widget( dexLabel, normalStyle, greenStyle);
533     }
534     else if (lastDex > ACURR(A_DEX) && firstTime==FALSE) {
535         /* Ok, this changed so add it to the highlighing list */
536         ghack_highlight_widget( dexLabel, normalStyle, redStyle);
537     }
538     lastDex = ACURR(A_DEX);
539     gtk_label_set( GTK_LABEL( dexLabel), buf);
540     
541     sprintf(buf,"CON:%d",ACURR(A_CON));
542     if (lastCon < ACURR(A_CON) && firstTime==FALSE) {
543         /* Ok, this changed so add it to the highlighing list */
544         ghack_highlight_widget( conLabel, normalStyle, greenStyle);
545     }
546     else if (lastCon > ACURR(A_CON) && firstTime==FALSE) {
547         /* Ok, this changed so add it to the highlighing list */
548         ghack_highlight_widget( conLabel, normalStyle, redStyle);
549     }
550     lastCon = ACURR(A_CON);
551     gtk_label_set( GTK_LABEL( conLabel), buf);
552     
553     sprintf(buf,"CHA:%d",ACURR(A_CHA));
554     if (lastCha < ACURR(A_CHA) && firstTime==FALSE) {
555         /* Ok, this changed so add it to the highlighing list */
556         ghack_highlight_widget( chaLabel, normalStyle, greenStyle);
557     }
558     else if (lastCha > ACURR(A_CHA) && firstTime==FALSE) {
559         /* Ok, this changed so add it to the highlighing list */
560         ghack_highlight_widget( chaLabel, normalStyle, redStyle);
561     }
562     lastCha = ACURR(A_CHA);
563     gtk_label_set( GTK_LABEL( chaLabel), buf);
564     
565     /* Now do the non-pixmaped stats (gold and such) */
566 #ifndef GOLDOBJ
567     sprintf(buf,"Au:%ld", u.ugold);
568     if (lastAu < u.ugold && firstTime==FALSE) {
569 #else
570     umoney = money_cnt(invent);
571     sprintf(buf,"Au:%ld", umoney);
572     if (lastAu < umoney && firstTime==FALSE) {
573 #endif
574         /* Ok, this changed so add it to the highlighing list */
575         ghack_highlight_widget( goldLabel, normalStyle, greenStyle);
576     }
577 #ifndef GOLDOBJ
578     else if (lastAu > u.ugold && firstTime==FALSE) {
579 #else
580     else if (lastAu > umoney && firstTime==FALSE) {
581 #endif
582         /* Ok, this changed so add it to the highlighing list */
583         ghack_highlight_widget( goldLabel, normalStyle, redStyle);
584     }
585 #ifndef GOLDOBJ
586     lastAu = u.ugold;
587 #else
588     lastAu = umoney;
589 #endif
590     gtk_label_set( GTK_LABEL( goldLabel), buf);
591     
592     if (u.mtimedone) {
593         /* special case: when polymorphed, show "HD", disable exp */
594         sprintf(buf,"HP:%d/%d", ( (u.mh  > 0)? u.mh  : 0), u.mhmax);
595         if ((lastHP < u.mh || lastMHP < u.mhmax ) && firstTime==FALSE) {
596             /* Ok, this changed so add it to the highlighing list */
597             ghack_highlight_widget( hpLabel, normalStyle, greenStyle);
598         }
599         else if ((lastHP > u.mh || lastMHP > u.mhmax ) && firstTime==FALSE) {
600             /* Ok, this changed so add it to the highlighing list */
601             ghack_highlight_widget( hpLabel, normalStyle, redStyle);
602         }
603         lastHP = u.mh;
604         lastMHP = u.mhmax;
605     } else {
606         sprintf(buf,"HP:%d/%d", ( (u.uhp  > 0)? u.uhp  : 0), u.uhpmax);
607         if ((lastHP < u.uhp || lastMHP < u.uhpmax ) && firstTime==FALSE) {
608             /* Ok, this changed so add it to the highlighing list */
609             ghack_highlight_widget( hpLabel, normalStyle, greenStyle);
610         }
611         else if ((lastHP > u.uhp || lastMHP > u.uhpmax ) && firstTime==FALSE) {
612             /* Ok, this changed so add it to the highlighing list */
613             ghack_highlight_widget( hpLabel, normalStyle, redStyle);
614         }
615         lastHP = u.uhp;
616         lastMHP = u.uhpmax;
617     }
618     gtk_label_set( GTK_LABEL( hpLabel), buf);
619     
620     if (u.mtimedone) {
621         /* special case: when polymorphed, show "HD", disable exp */
622         sprintf(buf,"HD:%d", mons[u.umonnum].mlevel);
623         if (lastLevel < mons[u.umonnum].mlevel && firstTime==FALSE) {
624             /* Ok, this changed so add it to the highlighing list */
625             ghack_highlight_widget( levlLabel, normalStyle, greenStyle);
626         }
627         else if (lastLevel > mons[u.umonnum].mlevel && firstTime==FALSE) {
628             /* Ok, this changed so add it to the highlighing list */
629             ghack_highlight_widget( levlLabel, normalStyle, redStyle);
630         }
631         lastLevel = mons[u.umonnum].mlevel;
632     } else {
633         sprintf(buf,"Level:%d", u.ulevel);
634         if (lastLevel < u.ulevel && firstTime==FALSE) {
635             /* Ok, this changed so add it to the highlighing list */
636             ghack_highlight_widget( levlLabel, normalStyle, greenStyle);
637         }
638         else if (lastLevel > u.ulevel && firstTime==FALSE) {
639             /* Ok, this changed so add it to the highlighing list */
640             ghack_highlight_widget( levlLabel, normalStyle, redStyle);
641         }
642         lastLevel = u.ulevel;
643     }
644     gtk_label_set( GTK_LABEL( levlLabel), buf);
645
646     sprintf(buf,"Power:%d/%d", u.uen, u.uenmax);
647     if ((lastPOW < u.uen || lastMPOW < u.uenmax) && firstTime==FALSE) {
648         /* Ok, this changed so add it to the highlighing list */
649         ghack_highlight_widget( powLabel, normalStyle, greenStyle);
650     }
651     if ((lastPOW > u.uen || lastMPOW > u.uenmax) && firstTime==FALSE) {
652         /* Ok, this changed so add it to the highlighing list */
653         ghack_highlight_widget( powLabel, normalStyle, redStyle);
654     }
655     lastPOW = u.uen;
656     lastMPOW = u.uenmax;
657     gtk_label_set( GTK_LABEL( powLabel), buf);
658     
659     sprintf(buf,"AC:%d", u.uac);
660     if (lastAC > u.uac && firstTime==FALSE) {
661         /* Ok, this changed so add it to the highlighing list */
662         ghack_highlight_widget( acLabel, normalStyle, greenStyle);
663     }
664     else if (lastAC < u.uac && firstTime==FALSE) {
665         /* Ok, this changed so add it to the highlighing list */
666         ghack_highlight_widget( acLabel, normalStyle, redStyle);
667     }
668     lastAC = u.uac;
669     gtk_label_set( GTK_LABEL( acLabel), buf);
670     
671 #ifdef EXP_ON_BOTL
672     if (flags.showexp) {
673         sprintf(buf,"Exp:%ld", u.uexp);
674         if (lastExp < u.uexp && firstTime==FALSE) {
675             /* Ok, this changed so add it to the highlighing list */
676             ghack_highlight_widget( expLabel, normalStyle, greenStyle);
677         }
678         else if (lastExp > u.uexp && firstTime==FALSE) {
679             /* Ok, this changed so add it to the highlighing list */
680             ghack_highlight_widget( expLabel, normalStyle, redStyle);
681         }
682         lastExp = u.uexp;
683         gtk_label_set( GTK_LABEL( expLabel), buf);
684    } else
685 #endif
686     {
687         gtk_label_set( GTK_LABEL( expLabel), "");
688     }
689
690     if (flags.time) {
691         sprintf(buf,"Time:%ld", moves);
692         gtk_label_set( GTK_LABEL( timeLabel), buf);
693     }
694     else
695         gtk_label_set( GTK_LABEL( timeLabel), "");
696 #ifdef SCORE_ON_BOTL
697     if (flags.showscore) {
698         sprintf(buf,"Score:%ld", botl_score());
699         gtk_label_set( GTK_LABEL( scoreLabel), buf);
700     } else
701         gtk_label_set( GTK_LABEL( scoreLabel), "");
702 #else
703     {
704         gtk_label_set( GTK_LABEL( scoreLabel), "");
705     }
706 #endif
707
708     /* See if their alignment has changed */
709     if (lastAlignment != u.ualign.type) {
710         if (firstTime==FALSE) {
711             /* Ok, this changed so add it to the highlighing list */
712             ghack_highlight_widget( alignLabel, normalStyle, redStyle);
713         }
714
715         lastAlignment = u.ualign.type;
716         /* looks like their alignment has changed -- change out the icon */
717         if (u.ualign.type==A_CHAOTIC) {
718             gtk_label_set( GTK_LABEL( alignLabel), "Chaotic");
719             gnome_pixmap_load_xpm_d( GNOME_PIXMAP(alignPix), chaotic_xpm);
720         } else if (u.ualign.type==A_NEUTRAL) {
721             gtk_label_set( GTK_LABEL( alignLabel), "Neutral");
722             gnome_pixmap_load_xpm_d( GNOME_PIXMAP(alignPix), neutral_xpm);
723         } else {
724             gtk_label_set( GTK_LABEL( alignLabel), "Lawful");
725             gnome_pixmap_load_xpm_d( GNOME_PIXMAP(alignPix), lawful_xpm);
726         }
727     }
728     
729     hung=hu_stat[u.uhs];
730     if (lastHungr != u.uhs) {
731         if (firstTime==FALSE) {
732             /* Ok, this changed so add it to the highlighing list */
733             ghack_highlight_widget( hungerLabel, normalStyle, redStyle);
734         }
735
736         lastHungr = u.uhs;
737         if (hung[0]==' ') {
738             gtk_label_set( GTK_LABEL( hungerLabel), "      ");
739             gnome_pixmap_load_xpm_d( GNOME_PIXMAP(hungerPix), nothing_xpm);
740         } else 
741           if (u.uhs == 0 /* SATIATED */) {
742             gtk_label_set( GTK_LABEL( hungerLabel), hung);
743             gnome_pixmap_load_xpm_d( GNOME_PIXMAP(hungerPix), satiated_xpm);
744         } else {
745             gtk_label_set( GTK_LABEL( hungerLabel), hung);
746             gnome_pixmap_load_xpm_d( GNOME_PIXMAP(hungerPix), hungry_xpm);
747         }
748     }
749
750     if (lastConf != Confusion) {
751         if (firstTime==FALSE) {
752             /* Ok, this changed so add it to the highlighing list */
753             ghack_highlight_widget( confuLabel, normalStyle, redStyle);
754         }
755
756         lastConf = Confusion;
757         if (Confusion) {
758             gtk_label_set( GTK_LABEL( confuLabel), "Confused");
759             gnome_pixmap_load_xpm_d( GNOME_PIXMAP(confuPix), confused_xpm);
760         }
761         else { 
762             gtk_label_set( GTK_LABEL( confuLabel), "        ");
763             gnome_pixmap_load_xpm_d( GNOME_PIXMAP(confuPix), nothing_xpm);
764         }
765     }
766
767     if (lastBlind != Blind) {
768         if (firstTime==FALSE) {
769             /* Ok, this changed so add it to the highlighing list */
770             ghack_highlight_widget( blindLabel, normalStyle, redStyle);
771         }
772
773         lastBlind = Blind;
774         if (Blind) {
775             gtk_label_set( GTK_LABEL( blindLabel), "Blind");
776             gnome_pixmap_load_xpm_d( GNOME_PIXMAP(blindPix), blind_xpm);
777         }
778         else { 
779             gtk_label_set( GTK_LABEL( blindLabel), "     ");
780             gnome_pixmap_load_xpm_d( GNOME_PIXMAP(blindPix), nothing_xpm);
781         }
782     }
783     if (lastStun != Stunned) {
784         if (firstTime==FALSE) {
785             /* Ok, this changed so add it to the highlighing list */
786             ghack_highlight_widget( stunLabel, normalStyle, redStyle);
787         }
788
789         lastStun = Stunned;
790         if (Stunned) {
791             gtk_label_set( GTK_LABEL( stunLabel), "Stun");
792             gnome_pixmap_load_xpm_d( GNOME_PIXMAP(stunPix), stunned_xpm);
793         }
794         else { 
795             gtk_label_set( GTK_LABEL( stunLabel), "    ");
796             gnome_pixmap_load_xpm_d( GNOME_PIXMAP(stunPix), nothing_xpm);
797         }
798     }
799     
800     if (lastHalu != Hallucination) {
801         if (firstTime==FALSE) {
802             /* Ok, this changed so add it to the highlighing list */
803             ghack_highlight_widget( halluLabel, normalStyle, redStyle);
804         }
805
806         lastHalu = Hallucination;
807         if (Hallucination) {
808             gtk_label_set( GTK_LABEL( halluLabel), "Hallu");
809             gnome_pixmap_load_xpm_d( GNOME_PIXMAP(halluPix), hallu_xpm);
810         }
811         else { 
812             gtk_label_set( GTK_LABEL( halluLabel), "     ");
813             gnome_pixmap_load_xpm_d( GNOME_PIXMAP(halluPix), nothing_xpm);
814         }
815     }
816
817     if (lastSick != Sick) {
818         if (firstTime==FALSE) {
819             /* Ok, this changed so add it to the highlighing list */
820             ghack_highlight_widget( sickLabel, normalStyle, redStyle);
821         }
822
823         lastSick = Sick;
824         if (Sick) {
825             if (u.usick_type & SICK_VOMITABLE) {
826                 gtk_label_set( GTK_LABEL( sickLabel), "FoodPois");
827                 gnome_pixmap_load_xpm_d( GNOME_PIXMAP(sickPix), sick_fp_xpm);
828             } else if (u.usick_type & SICK_NONVOMITABLE) {
829                 gtk_label_set( GTK_LABEL( sickLabel), "Ill");
830                 gnome_pixmap_load_xpm_d( GNOME_PIXMAP(sickPix), sick_il_xpm);
831             } else {
832                 gtk_label_set( GTK_LABEL( sickLabel), "FoodPois");
833                 gnome_pixmap_load_xpm_d( GNOME_PIXMAP(sickPix), sick_fp_xpm);
834             }
835         } else {
836             gtk_label_set( GTK_LABEL( sickLabel), "        ");
837             gnome_pixmap_load_xpm_d( GNOME_PIXMAP(sickPix), nothing_xpm);
838         }
839     }
840
841     enc=enc_stat[near_capacity()];
842     if (lastEncumb != near_capacity()) {
843         if (firstTime==FALSE) {
844             /* Ok, this changed so add it to the highlighing list */
845             ghack_highlight_widget( encumbLabel, normalStyle, redStyle);
846         }
847
848         lastEncumb = near_capacity();
849         switch ( lastEncumb ) {
850             case 0:
851                 gtk_label_set( GTK_LABEL( encumbLabel), "        ");
852                 gnome_pixmap_load_xpm_d( GNOME_PIXMAP(encumbPix), nothing_xpm);
853                 break;
854             case 1:
855                 gtk_label_set( GTK_LABEL( encumbLabel), enc);
856                 gnome_pixmap_load_xpm_d( GNOME_PIXMAP(encumbPix), slt_enc_xpm);
857                 break;
858             case 2:
859                 gtk_label_set( GTK_LABEL( encumbLabel), enc);
860                 gnome_pixmap_load_xpm_d( GNOME_PIXMAP(encumbPix), mod_enc_xpm);
861                 break;
862             case 3:
863                 gtk_label_set( GTK_LABEL( encumbLabel), enc);
864                 gnome_pixmap_load_xpm_d( GNOME_PIXMAP(encumbPix), hvy_enc_xpm);
865                 break;
866             case 4:
867                 gtk_label_set( GTK_LABEL( encumbLabel), enc);
868                 gnome_pixmap_load_xpm_d( GNOME_PIXMAP(encumbPix), ext_enc_xpm);
869                 break;
870             case 5:
871                 gtk_label_set( GTK_LABEL( encumbLabel), enc);
872                 gnome_pixmap_load_xpm_d( GNOME_PIXMAP(encumbPix), ovr_enc_xpm);
873         }
874     }
875     firstTime=FALSE;
876 }
877
878 static void ghack_fade_highlighting()
879 {
880     GList *item;
881     Highlight *highlt;
882
883     /* Remove any items from the queue if their time is up */
884     for (item = g_list_first( s_HighLightList) ; item ; ) {
885         highlt = (Highlight*) item->data;
886         if (highlt) {
887             if ( highlt->nTurnsLeft <= 0) {
888                 gtk_widget_set_style(  GTK_WIDGET( highlt->widget), 
889                         highlt->oldStyle);
890                 s_HighLightList = g_list_remove_link(s_HighLightList, item);
891                 g_free( highlt);
892                 g_list_free_1( item);
893                 item = g_list_first( s_HighLightList);
894                 continue;
895             } else
896                 (highlt->nTurnsLeft)--;
897         }
898         if (item)
899             item=item->next;
900         else
901             break;
902     }
903 }
904
905 /* Widget changed, so add it to the highlighing list */
906 static void ghack_highlight_widget( GtkWidget* widget, GtkStyle* oldStyle, 
907         GtkStyle* newStyle)
908 {
909     Highlight *highlt;
910     GList *item;
911     
912     /* Check if this widget is already in the queue.  If so then
913      * remove it, so we will only have the new entry in the queue  */
914     for (item = g_list_first( s_HighLightList) ; item ; ) {
915         highlt = (Highlight*) item->data;
916         if (highlt) {
917             if ( highlt->widget == widget) {
918                 s_HighLightList = g_list_remove_link(s_HighLightList, item);
919                 g_free( highlt);
920                 g_list_free_1( item);
921                 break;
922             }
923         }
924         if (item)
925             item=item->next;
926         else
927             break;
928     }
929
930     /* Ok, now highlight this widget and add it into the fade 
931      * highlighting queue  */
932     highlt = g_new( Highlight, 1);
933     highlt->nTurnsLeft=NUM_TURNS_HIGHLIGHTED;
934     highlt->oldStyle=oldStyle;
935     highlt->widget=widget;
936     s_HighLightList = g_list_prepend (s_HighLightList, highlt);
937     gtk_widget_set_style(  GTK_WIDGET( widget), newStyle);
938     
939
940     
941