2 "$Id: gx11.c 9581 2008-07-20 00:54:34Z kbulgrien $";
70 #include <gdk/gdkwin32.h>
72 #include <gdk/gdkkeysyms.h>
76 #include <SDL_image.h>
83 #include "pixmaps/crossfiretitle.xpm"
95 extern SDL_Surface* mapsurface;
114 #define DEFAULT_IMAGE_SIZE 32
122 #define PU_NOTHING 0x00000000
124 #define PU_DEBUG 0x10000000
125 #define PU_INHIBIT 0x20000000
126 #define PU_STOP 0x40000000
127 #define PU_NEWMODE 0x80000000
129 #define PU_RATIO 0x0000000F
131 #define PU_FOOD 0x00000010
132 #define PU_DRINK 0x00000020
133 #define PU_VALUABLES 0x00000040
134 #define PU_BOW 0x00000080
136 #define PU_ARROW 0x00000100
137 #define PU_HELMET 0x00000200
138 #define PU_SHIELD 0x00000400
139 #define PU_ARMOUR 0x00000800
141 #define PU_BOOTS 0x00001000
142 #define PU_GLOVES 0x00002000
143 #define PU_CLOAK 0x00004000
144 #define PU_KEY 0x00008000
146 #define PU_MISSILEWEAPON 0x00010000
147 #define PU_ALLWEAPON 0x00020000
148 #define PU_MAGICAL 0x00040000
149 #define PU_POTION 0x00080000
151 #define PU_SPELLBOOK 0x00100000
152 #define PU_SKILLSCROLL 0x00200000
153 #define PU_READABLES 0x00400000
154 #define PU_MAGIC_DEVICE 0x00800000
156 #define PU_NOT_CURSED 0x01000000
157 #define PU_JEWELS 0x02000000
158 #define PU_FLESH 0x04000000
188 #define MAX_HISTORY 50
189 #define MAX_COMMAND_LEN 256
353 if (updatelock < 20) {
357 pollret = select(
maxfd, &tmp_read, NULL, NULL, &
timeout);
359 LOG(
LOG_WARNING,
"gtk::do_network",
"Got errno %d on select call.", errno);
361 else if ( pollret>0 ) {
373 LOG(
LOG_INFO,
"gtk::do_network",
"locked for network recieves.\n");
387 int do_scriptout(
void)
411 fleep = gtk_timeout_add (100,
412 (GtkFunction) do_timeout,
416 gtk_timeout_add (25, (GtkFunction) do_scriptout, NULL);
425 gtk_timeout_remove(tag);
428 LOG(
LOG_INFO,
"gtk::event_loop",
"gtk_main exited, returning from event_loop");
437 int dx, dy, i, x, y, xmidl, xmidh, ymidl, ymidh;
448 switch (event->button) {
466 if (event->button==2) {
508 #include "pixmaps/question.xpm"
517 &style->bg[GTK_STATE_NORMAL],
518 (gchar **)question_xpm);
524 #include "pixmaps/question.sdl"
525 pixmaps[0]->
map_image = SDL_CreateRGBSurfaceFrom(question_sdl,
526 32, 32, 1, 4, 1, 1, 1, 1);
527 SDL_SetAlpha(pixmaps[0]->map_image, SDL_SRCALPHA, 70);
528 pixmaps[0]->
fog_image = SDL_CreateRGBSurfaceFrom(question_sdl,
529 32, 32, 1, 4, 1, 1, 1, 1);
530 SDL_SetAlpha(pixmaps[0]->fog_image, SDL_SRCALPHA, 70);
548 pixmaps[i] = pixmaps[0];
570 gtk_entry_set_text(GTK_ENTRY(
entrytext),
"");
571 gtk_entry_set_position(GTK_ENTRY(
entrytext), 0);
577 if (
history[i][0] == 0)
return;
583 gtk_widget_grab_focus (GTK_WIDGET(
entrytext));
589 const gchar *entry_text, *newcommand;
591 entry_text = gtk_entry_get_text(GTK_ENTRY(
entrytext));
594 if (newcommand != NULL) {
596 gtk_entry_set_text(GTK_ENTRY(
entrytext), newcommand);
600 gtk_widget_grab_focus (GTK_WIDGET(
entrytext));
601 gtk_entry_set_position(GTK_ENTRY(
entrytext), -1);
614 static sint16 ox=-1, oy=-1;
623 if (event->type == GDK_CONFIGURE) {
624 if (((GdkEventConfigure*)event)->
width == ox && ((GdkEventConfigure*)event)->
height == oy)
628 fprintf(stderr,
"ox=%d != %d, oy=%d != %d\n", ox, ((GdkEventConfigure*)event)->
width,
629 oy, ((GdkEventConfigure*)event)->
height);
631 ox = ((GdkEventConfigure*)event)->width;
632 oy = ((GdkEventConfigure*)event)->height;
642 SDL_UpdateRect( mapsurface, 0, 0, 0, 0);
663 darkgc = gdk_gc_new(
dark1);
681 gdk_draw_point(
dark1, darkgc, x, y);
684 gdk_draw_point(
dark2, darkgc, x, y);
687 gdk_draw_point(
dark3, darkgc, x, y);
697 gdk_gc_unref(darkgc);
711 SDL_UpdateRect( mapsurface, 0, 0, 0, 0);
726 GtkWidget *gtvbox, *gthbox;
728 gtvbox = gtk_vbox_new (
FALSE, 0);
729 gtk_container_add (GTK_CONTAINER (frame), gtvbox);
730 gthbox = gtk_hbox_new (
FALSE, 0);
731 gtk_box_pack_start (GTK_BOX (gtvbox), gthbox,
FALSE,
FALSE, 1);
737 gtk_widget_set_events (
drawingarea, GDK_BUTTON_PRESS_MASK);
740 gtk_signal_connect (GTK_OBJECT (
drawingarea),
"expose_event",
742 gtk_signal_connect (GTK_OBJECT(
drawingarea),
"configure_event",
747 "button_press_event",
757 gtk_widget_show(gthbox);
758 gtk_widget_show(gtvbox);
761 gtk_signal_connect (GTK_OBJECT (frame),
"expose_event",
762 (GtkSignalFunc) expose_event, NULL);
763 gtk_signal_connect (GTK_OBJECT(frame),
"configure_event",
764 (GtkSignalFunc) configure_event, NULL);
766 gtk_widget_show (frame);
781 const gchar *entry_text;
786 entry_text = gtk_entry_get_text(GTK_ENTRY(
entrytext));
803 if (entry_text[0] != 0) {
806 cur_history_position++;
812 gtk_entry_set_text(GTK_ENTRY(
entrytext),
"");
835 vadj = GTK_TEXT (widget)->vadj;
836 v_value = vadj->value;
838 shifted = (
event->state & GDK_SHIFT_MASK) != 0;
840 switch (event->button)
844 v_value -= vadj->page_size;
846 v_value -= vadj->step_increment * 5;
851 v_value += vadj->page_size;
853 v_value += vadj->step_increment * 5;
860 v_value = CLAMP (v_value, vadj->lower, vadj->upper - vadj->page_size);
862 gtk_adjustment_set_value (vadj, v_value);
871 GtkWidget *vscrollbar;
874 box1 = gtk_vbox_new (
FALSE, 0);
877 gtk_container_add (GTK_CONTAINER (frame),
info_vpane);
881 gtk_container_add (GTK_CONTAINER (frame), box1);
883 gtk_widget_show (box1);
885 box2 = gtk_vbox_new (
FALSE, 3);
886 gtk_container_border_width (GTK_CONTAINER (box2), 3);
887 gtk_box_pack_start (GTK_BOX (box1), box2,
TRUE,
TRUE, 0);
888 gtk_widget_show (box2);
891 tablet = gtk_table_new (2, 2,
FALSE);
892 gtk_table_set_row_spacing (GTK_TABLE (tablet), 0, 2);
893 gtk_table_set_col_spacing (GTK_TABLE (tablet), 0, 2);
894 gtk_box_pack_start (GTK_BOX (box2), tablet,
TRUE,
TRUE, 0);
895 gtk_widget_show (tablet);
897 text_hadj = gtk_adjustment_new(1, 0, 1, 0.01, 0.1, 40);
898 text_vadj = gtk_adjustment_new(1, 0, 1, 0.01, 0.1, 40);
903 GTK_EXPAND | GTK_SHRINK | GTK_FILL,
904 GTK_EXPAND | GTK_SHRINK | GTK_FILL, 0, 0);
909 gtk_table_attach (GTK_TABLE (tablet), vscrollbar, 1, 2, 0, 1,
910 GTK_FILL, GTK_EXPAND | GTK_SHRINK | GTK_FILL, 0, 0);
911 gtk_widget_show (vscrollbar);
923 box1 = gtk_vbox_new (
FALSE, 0);
924 gtk_widget_show (box1);
927 tablet = gtk_table_new (2, 2,
FALSE);
928 gtk_table_set_row_spacing (GTK_TABLE (tablet), 0, 2);
929 gtk_table_set_col_spacing (GTK_TABLE (tablet), 0, 2);
930 gtk_box_pack_start (GTK_BOX (box1), tablet,
TRUE,
TRUE, 0);
931 gtk_widget_show (tablet);
933 text_hadj2 = gtk_adjustment_new(1, 0, 1, 0.01, 0.1, 40);
934 text_vadj2 = gtk_adjustment_new(1, 0, 1, 0.01, 0.1, 40);
940 GTK_EXPAND | GTK_SHRINK | GTK_FILL,
941 GTK_EXPAND | GTK_SHRINK | GTK_FILL, 0, 0);
945 gtk_table_attach (GTK_TABLE (tablet), vscrollbar, 1, 2, 0, 1,
946 GTK_FILL, GTK_EXPAND | GTK_SHRINK | GTK_FILL, 0, 0);
947 gtk_widget_show (vscrollbar);
955 infile = fopen(
"Welcome",
"r");
964 nchars = fread(buffer, 1, 1024, infile);
966 NULL, buffer, nchars);
979 gtk_signal_connect(GTK_OBJECT(
entrytext),
"activate",
983 GTK_WIDGET_SET_FLAGS (
entrytext, GTK_CAN_DEFAULT);
1009 const gchar *dialog_text;
1010 dialog_text = gtk_entry_get_text(GTK_ENTRY(
dialogtext));
1031 user=gtk_editable_get_chars (GTK_EDITABLE(userText),0,-1);
1032 pass=gtk_editable_get_chars (GTK_EDITABLE(passwordText),0,-1);
1033 strncpy(password,pass,
sizeof(password));
1046 gtk_widget_hide(loginWindow);
1050 pass=gtk_editable_get_chars (GTK_EDITABLE(passwordText2),0,-1);
1054 gtk_widget_hide(loginWindow);
1057 gtk_widget_hide(loginWindow);
1063 gchar *passcontent,*txtcontent;
1064 txtcontent = gtk_editable_get_chars(GTK_EDITABLE(userText),0,-1);
1065 passcontent= gtk_editable_get_chars(GTK_EDITABLE(passwordText) ,0,-1);
1066 if ( passcontent && txtcontent &&
1067 (strlen(txtcontent)>=1)&&
1068 (strlen(passcontent)>=1))
1069 gtk_widget_set_sensitive(GTK_WIDGET(loginButtonOk),
TRUE);
1071 gtk_widget_set_sensitive(GTK_WIDGET(loginButtonOk),
FALSE);
1072 if (txtcontent && (strlen (txtcontent)>0))
1073 gtk_widget_show(passwordText);
1075 gtk_widget_hide(passwordText);
1077 g_free(passcontent);
1081 char *txtcontent = gtk_editable_get_chars(entry,0,-1);
1083 if (txtcontent && (strlen(txtcontent)>0))
1084 gtk_widget_grab_focus(focusTo);
1087 char *txtcontent = gtk_editable_get_chars(entry,0,-1);
1088 if (txtcontent && (strlen(txtcontent)>0))
1089 gtk_widget_activate(button);
1110 if (loginWindow==NULL){
1112 GtkWidget *vbox, *table, *label, *hbox, *vscroll;
1113 loginWindow= gtk_window_new(GTK_WINDOW_TOPLEVEL);
1114 gtk_window_set_policy (GTK_WINDOW (loginWindow),
TRUE,
TRUE,
1116 gtk_window_set_transient_for (GTK_WINDOW (loginWindow),
1118 gtk_window_set_title (GTK_WINDOW (loginWindow),
"Login");
1119 gtk_window_set_transient_for(GTK_WINDOW (loginWindow),
1121 vbox=gtk_vbox_new(
FALSE,4);
1124 loginTabs = gtk_notebook_new();
1126 hbox=gtk_hbox_new(
FALSE,2);
1127 newsText = gtk_text_new(NULL,NULL);
1128 gtk_text_set_word_wrap(GTK_TEXT(newsText),
TRUE);
1129 gtk_text_set_line_wrap(GTK_TEXT(newsText),
TRUE);
1130 vscroll = gtk_vscrollbar_new (GTK_TEXT (newsText)->vadj);
1131 gtk_box_pack_start(GTK_BOX(hbox),newsText,
TRUE,
TRUE,0);
1132 gtk_box_pack_start(GTK_BOX(hbox),vscroll,
FALSE,
TRUE,0);
1133 label = gtk_label_new(
"News");
1134 gtk_notebook_append_page(GTK_NOTEBOOK(loginTabs),hbox,label);
1135 gtk_widget_show(vscroll);
1136 gtk_widget_show(newsText);
1137 gtk_widget_show(hbox);
1139 hbox=gtk_hbox_new(
FALSE,2);
1140 rulesText = gtk_text_new(NULL,NULL);
1141 gtk_text_set_word_wrap(GTK_TEXT(rulesText),
TRUE);
1142 gtk_text_set_line_wrap(GTK_TEXT(rulesText),
TRUE);
1143 vscroll = gtk_vscrollbar_new (GTK_TEXT (rulesText)->vadj);
1144 gtk_box_pack_start(GTK_BOX(hbox),rulesText,
TRUE,
TRUE,0);
1145 gtk_box_pack_start(GTK_BOX(hbox),vscroll,
FALSE,
TRUE,0);
1146 label = gtk_label_new(
"Rules");
1147 gtk_notebook_append_page(GTK_NOTEBOOK(loginTabs),hbox,label);
1148 gtk_widget_show(vscroll);
1149 gtk_widget_show(rulesText);
1150 gtk_widget_show(hbox);
1153 hbox=gtk_hbox_new(
FALSE,2);
1154 motdText = gtk_text_new(NULL,NULL);
1155 vscroll = gtk_vscrollbar_new (GTK_TEXT (motdText)->vadj);
1156 gtk_box_pack_start(GTK_BOX(hbox),motdText,
TRUE,
TRUE,0);
1157 gtk_box_pack_start(GTK_BOX(hbox),vscroll,
FALSE,
TRUE,0);
1158 gtk_widget_show(hbox);
1159 gtk_widget_show(motdText);
1160 gtk_widget_show(vscroll);
1161 gtk_box_pack_start(GTK_BOX(vbox),hbox,
TRUE,
TRUE,0);
1165 loginMessage = gtk_label_new(NULL);
1166 gtk_box_pack_start(GTK_BOX(vbox),loginMessage,
FALSE,
FALSE,0);
1167 gtk_widget_show(loginMessage);
1170 table=gtk_table_new(3,2,
FALSE);
1173 label=gtk_label_new(
"User:");
1174 gtk_table_attach(GTK_TABLE(table),label,0,1,0,1,GTK_EXPAND|GTK_FILL,0,2,2);
1175 gtk_label_set_justify(GTK_LABEL(label),GTK_JUSTIFY_RIGHT);
1176 gtk_widget_show(label);
1177 label=gtk_label_new(
"Password:");
1178 gtk_table_attach(GTK_TABLE(table),label,0,1,1,2,GTK_EXPAND|GTK_FILL,0,2,2);
1179 gtk_label_set_justify(GTK_LABEL(label),GTK_JUSTIFY_RIGHT);
1180 gtk_widget_show(label);
1181 label=gtk_label_new(
"Re-type password:");
1182 gtk_table_attach(GTK_TABLE(table),label,0,1,2,3,GTK_EXPAND|GTK_FILL,0,2,2);
1183 gtk_label_set_justify(GTK_LABEL(label),GTK_JUSTIFY_RIGHT);
1184 gtk_widget_show(label);
1185 userText=gtk_entry_new();
1186 gtk_widget_show(userText);
1187 gtk_table_attach(GTK_TABLE(table),userText,1,2,0,1,GTK_EXPAND|GTK_FILL,0,2,2);
1188 passwordText= gtk_entry_new();
1189 gtk_entry_set_visibility(GTK_ENTRY(passwordText),
FALSE);
1190 gtk_widget_show(passwordText);
1191 gtk_table_attach(GTK_TABLE(table),passwordText,1,2,1,2,GTK_EXPAND|GTK_FILL,0,2,2);
1192 passwordText2= gtk_entry_new();
1193 gtk_entry_set_visibility(GTK_ENTRY(passwordText2),
FALSE);
1194 gtk_entry_set_editable(GTK_ENTRY(passwordText2),
FALSE);
1195 gtk_table_attach(GTK_TABLE(table),passwordText2,1,2,2,3,GTK_EXPAND|GTK_FILL,0,2,2);
1196 gtk_widget_show(passwordText2);
1197 gtk_box_pack_start(GTK_BOX(vbox),table,
FALSE,
FALSE,0);
1200 hbox=gtk_hbox_new(
FALSE,2);
1201 loginButtonOk = gtk_button_new_with_label(
"Ok");
1202 loginButtonCancel = gtk_button_new_with_label(
"Cancel");
1203 gtk_box_pack_start(GTK_BOX(hbox),loginButtonOk,
TRUE,
FALSE,0);
1204 gtk_box_pack_start(GTK_BOX(hbox),loginButtonCancel,
TRUE,
FALSE,0);
1205 gtk_widget_show(hbox);
1206 gtk_widget_show(loginButtonOk);
1207 gtk_widget_show(loginButtonCancel);
1210 gtk_signal_connect_object (GTK_OBJECT (loginWindow),
1214 gtk_signal_connect_object (GTK_OBJECT (loginButtonCancel),
1218 gtk_signal_connect_object (GTK_OBJECT (userText),
1221 GINT_TO_POINTER(loginButtonOk));
1222 gtk_signal_connect_object (GTK_OBJECT (passwordText),
1225 GINT_TO_POINTER(loginButtonOk));
1226 gtk_signal_connect_object (GTK_OBJECT (userText),
1229 GINT_TO_POINTER(passwordText));
1230 gtk_signal_connect_object (GTK_OBJECT (userText),
1233 GINT_TO_POINTER(passwordText));
1234 gtk_box_pack_start(GTK_BOX(vbox),hbox,
FALSE,
FALSE,0);
1235 gtk_signal_connect_object (GTK_OBJECT (passwordText),
1238 GINT_TO_POINTER(loginButtonOk));
1239 gtk_signal_connect_object (GTK_OBJECT (passwordText2),
1242 GINT_TO_POINTER(loginButtonOk));
1243 gtk_box_pack_start(GTK_BOX(vbox),hbox,
FALSE,
FALSE,0);
1244 gtk_widget_show(table);
1245 gtk_widget_show(vbox);
1246 label=gtk_label_new(
"login");
1247 gtk_notebook_append_page(GTK_NOTEBOOK(loginTabs),vbox,label);
1248 gtk_container_add(GTK_CONTAINER(loginWindow),loginTabs);
1249 gtk_widget_show(loginTabs);
1250 gtk_window_set_default_size(GTK_WINDOW(loginWindow),500,400);
1251 gtk_window_set_position(GTK_WINDOW(loginWindow),GTK_WIN_POS_CENTER);
1253 gtk_editable_delete_text(GTK_EDITABLE(motdText),0,-1);
1255 gtk_editable_delete_text(GTK_EDITABLE(rulesText),0,-1);
1257 gtk_editable_delete_text(GTK_EDITABLE(newsText),0,-1);
1259 gtk_widget_show(loginWindow);
1264 gtk_label_set_text(GTK_LABEL(loginMessage),
"Type in user name and password");
1265 gtk_entry_set_editable(GTK_ENTRY(userText),
TRUE);
1266 gtk_entry_set_editable(GTK_ENTRY(passwordText),
TRUE);
1267 gtk_entry_set_editable(GTK_ENTRY(passwordText2),
FALSE);
1268 gtk_widget_show(GTK_WIDGET(passwordText));
1269 gtk_widget_hide(GTK_WIDGET(passwordText2));
1270 if (signalLoginDialogClicked!=-1)
1271 gtk_signal_disconnect(GTK_OBJECT (loginButtonOk),
1272 signalLoginDialogClicked);
1273 signalLoginDialogClicked = gtk_signal_connect_object (GTK_OBJECT (loginButtonOk),
1277 gtk_widget_set_sensitive(GTK_WIDGET(loginButtonOk),
TRUE);
1278 gtk_entry_set_text(GTK_ENTRY(userText),
"");
1279 gtk_entry_set_text(GTK_ENTRY(passwordText),
"");
1280 gtk_entry_set_text(GTK_ENTRY(passwordText2),
"");
1281 gtk_widget_grab_focus(userText);
1289 gtk_label_set_text(GTK_LABEL(loginMessage),
"Creating new user, please confirm password");
1290 gtk_entry_set_editable(GTK_ENTRY(userText),
FALSE);
1291 gtk_entry_set_editable(GTK_ENTRY(passwordText),
FALSE);
1292 gtk_entry_set_editable(GTK_ENTRY(passwordText2),
TRUE);
1293 gtk_widget_hide(GTK_WIDGET(passwordText));
1294 gtk_widget_show(GTK_WIDGET(passwordText2));
1295 if (signalLoginDialogClicked!=-1)
1296 gtk_signal_disconnect(GTK_OBJECT (loginButtonOk),
1297 signalLoginDialogClicked);
1298 signalLoginDialogClicked = gtk_signal_connect_object (GTK_OBJECT (loginButtonOk),
1302 gtk_widget_grab_focus(passwordText2);
1314 GtkWidget *dialoglabel;
1315 GtkWidget *yesbutton, *nobutton;
1316 GtkWidget *strbutton, *dexbutton, *conbutton, *intbutton, *wisbutton,
1317 *powbutton, *chabutton;
1331 gtk_window_set_title (GTK_WINDOW (
dialog_window),
"Dialog");
1335 dbox = gtk_vbox_new (
FALSE, 6);
1343 if (!strcmp (str,
":"))
1345 if (!strcmp (
last_str,
"What is your name?"))
1351 if (!strcmp (
last_str,
"What is your password?"))
1357 (
last_str,
"Please type your password again."))
1364 if (!strcmp (
last_str,
"[1-7] [1-7] to swap stats.")
1371 || !strncmp (
last_str,
"Cha d", 5))
1375 gtk_label_new (
"Roll again or exchange ability.");
1376 gtk_box_pack_start (GTK_BOX (dbox), dialoglabel,
FALSE,
1378 gtk_widget_show (dialoglabel);
1380 hbox = gtk_hbox_new (
TRUE, 2);
1381 strbutton = gtk_button_new_with_label (
"Str");
1382 gtk_box_pack_start (GTK_BOX (hbox), strbutton,
TRUE,
1384 gtk_signal_connect_object (GTK_OBJECT (strbutton),
1387 GINT_TO_POINTER (
"1"));
1390 dexbutton = gtk_button_new_with_label (
"Dex");
1391 gtk_box_pack_start (GTK_BOX (hbox), dexbutton,
TRUE,
1393 gtk_signal_connect_object (GTK_OBJECT (dexbutton),
1396 GINT_TO_POINTER (
"2"));
1398 conbutton = gtk_button_new_with_label (
"Con");
1399 gtk_box_pack_start (GTK_BOX (hbox), conbutton,
TRUE,
1401 gtk_signal_connect_object (GTK_OBJECT (conbutton),
1404 GINT_TO_POINTER (
"3"));
1406 intbutton = gtk_button_new_with_label (
"Int");
1407 gtk_box_pack_start (GTK_BOX (hbox), intbutton,
TRUE,
1409 gtk_signal_connect_object (GTK_OBJECT (intbutton),
1412 GINT_TO_POINTER (
"4"));
1414 wisbutton = gtk_button_new_with_label (
"Wis");
1415 gtk_box_pack_start (GTK_BOX (hbox), wisbutton,
TRUE,
1417 gtk_signal_connect_object (GTK_OBJECT (wisbutton),
1420 GINT_TO_POINTER (
"5"));
1422 powbutton = gtk_button_new_with_label (
"Pow");
1423 gtk_box_pack_start (GTK_BOX (hbox), powbutton,
TRUE,
1425 gtk_signal_connect_object (GTK_OBJECT (powbutton),
1428 GINT_TO_POINTER (
"6"));
1430 chabutton = gtk_button_new_with_label (
"Cha");
1431 gtk_box_pack_start (GTK_BOX (hbox), chabutton,
TRUE,
1433 gtk_signal_connect_object (GTK_OBJECT (chabutton),
1436 GINT_TO_POINTER (
"7"));
1438 gtk_widget_show (strbutton);
1439 gtk_widget_show (dexbutton);
1440 gtk_widget_show (conbutton);
1441 gtk_widget_show (intbutton);
1442 gtk_widget_show (wisbutton);
1443 gtk_widget_show (powbutton);
1444 gtk_widget_show (chabutton);
1448 gtk_box_pack_start (GTK_BOX (dbox), hbox,
FALSE,
TRUE,
1450 gtk_widget_show (hbox);
1452 hbox = gtk_hbox_new (
FALSE, 6);
1454 yesbutton = gtk_button_new_with_label (
"Roll again");
1455 gtk_box_pack_start (GTK_BOX (hbox), yesbutton,
TRUE,
1457 gtk_signal_connect_object (GTK_OBJECT (yesbutton),
1460 GINT_TO_POINTER (
"y"));
1462 nobutton = gtk_button_new_with_label (
"Keep this");
1463 gtk_box_pack_start (GTK_BOX (hbox), nobutton,
TRUE,
1465 gtk_signal_connect_object (GTK_OBJECT (nobutton),
1468 GINT_TO_POINTER (
"n"));
1470 gtk_box_pack_start (GTK_BOX (dbox), hbox,
FALSE,
TRUE,
1473 gtk_widget_show (yesbutton);
1474 gtk_widget_show (nobutton);
1475 gtk_widget_show (hbox);
1480 if (!strncmp (
last_str,
"Str -", 5) ||
1486 || !strncmp (
last_str,
"Cha -", 5))
1491 gtk_label_new (
"Exchange with which ability?");
1492 gtk_box_pack_start (GTK_BOX (dbox), dialoglabel,
FALSE,
1494 gtk_widget_show (dialoglabel);
1496 hbox = gtk_hbox_new (
TRUE, 2);
1497 strbutton = gtk_button_new_with_label (
"Str");
1498 gtk_box_pack_start (GTK_BOX (hbox), strbutton,
TRUE,
1500 gtk_signal_connect_object (GTK_OBJECT (strbutton),
1503 GINT_TO_POINTER (
"1"));
1506 dexbutton = gtk_button_new_with_label (
"Dex");
1507 gtk_box_pack_start (GTK_BOX (hbox), dexbutton,
TRUE,
1509 gtk_signal_connect_object (GTK_OBJECT (dexbutton),
1512 GINT_TO_POINTER (
"2"));
1514 conbutton = gtk_button_new_with_label (
"Con");
1515 gtk_box_pack_start (GTK_BOX (hbox), conbutton,
TRUE,
1517 gtk_signal_connect_object (GTK_OBJECT (conbutton),
1520 GINT_TO_POINTER (
"3"));
1522 intbutton = gtk_button_new_with_label (
"Int");
1523 gtk_box_pack_start (GTK_BOX (hbox), intbutton,
TRUE,
1525 gtk_signal_connect_object (GTK_OBJECT (intbutton),
1528 GINT_TO_POINTER (
"4"));
1530 wisbutton = gtk_button_new_with_label (
"Wis");
1531 gtk_box_pack_start (GTK_BOX (hbox), wisbutton,
TRUE,
1533 gtk_signal_connect_object (GTK_OBJECT (wisbutton),
1536 GINT_TO_POINTER (
"5"));
1538 powbutton = gtk_button_new_with_label (
"Pow");
1539 gtk_box_pack_start (GTK_BOX (hbox), powbutton,
TRUE,
1541 gtk_signal_connect_object (GTK_OBJECT (powbutton),
1544 GINT_TO_POINTER (
"6"));
1546 chabutton = gtk_button_new_with_label (
"Cha");
1547 gtk_box_pack_start (GTK_BOX (hbox), chabutton,
TRUE,
1549 gtk_signal_connect_object (GTK_OBJECT (chabutton),
1552 GINT_TO_POINTER (
"7"));
1554 gtk_widget_show (strbutton);
1555 gtk_widget_show (dexbutton);
1556 gtk_widget_show (conbutton);
1557 gtk_widget_show (intbutton);
1558 gtk_widget_show (wisbutton);
1559 gtk_widget_show (powbutton);
1560 gtk_widget_show (chabutton);
1563 gtk_box_pack_start (GTK_BOX (dbox), hbox,
FALSE,
TRUE,
1565 gtk_widget_show (hbox);
1571 if (!strncmp (
last_str,
"Press `d'", 9))
1575 dialoglabel = gtk_label_new (
"Choose a character.");
1576 gtk_box_pack_start (GTK_BOX (dbox), dialoglabel,
FALSE,
1578 gtk_widget_show (dialoglabel);
1580 hbox = gtk_hbox_new (
FALSE, 6);
1582 yesbutton = gtk_button_new_with_label (
"Show next");
1583 gtk_box_pack_start (GTK_BOX (hbox), yesbutton,
TRUE,
1585 gtk_signal_connect_object (GTK_OBJECT (yesbutton),
1588 GINT_TO_POINTER (
" "));
1590 nobutton = gtk_button_new_with_label (
"Keep this");
1591 gtk_box_pack_start (GTK_BOX (hbox), nobutton,
TRUE,
1593 gtk_signal_connect_object (GTK_OBJECT (nobutton),
1596 GINT_TO_POINTER (
"d"));
1598 gtk_box_pack_start (GTK_BOX (dbox), hbox,
FALSE,
TRUE,
1601 gtk_widget_show (yesbutton);
1602 gtk_widget_show (nobutton);
1603 gtk_widget_show (hbox);
1609 if (!strncmp (str,
"Do you want to play", 18))
1614 gtk_label_new (
"Do you want to play again?");
1615 gtk_box_pack_start (GTK_BOX (dbox), dialoglabel,
FALSE,
1617 gtk_widget_show (dialoglabel);
1619 hbox = gtk_hbox_new (
FALSE, 6);
1621 yesbutton = gtk_button_new_with_label (
"Play again");
1622 gtk_box_pack_start (GTK_BOX (hbox), yesbutton,
TRUE,
1624 gtk_signal_connect_object (GTK_OBJECT (yesbutton),
1627 GINT_TO_POINTER (
"a"));
1629 nobutton = gtk_button_new_with_label (
"Quit");
1630 gtk_box_pack_start (GTK_BOX (hbox), nobutton,
TRUE,
1632 gtk_signal_connect_object (GTK_OBJECT (nobutton),
1635 GINT_TO_POINTER (
"q"));
1637 gtk_box_pack_start (GTK_BOX (dbox), hbox,
FALSE,
TRUE,
1640 gtk_widget_show (yesbutton);
1641 gtk_widget_show (nobutton);
1642 gtk_widget_show (hbox);
1648 if (!strncmp (str,
"Are you sure you want", 21))
1653 gtk_label_new (
"Are you sure you want to quit?");
1654 gtk_box_pack_start (GTK_BOX (dbox), dialoglabel,
FALSE,
1656 gtk_widget_show (dialoglabel);
1658 hbox = gtk_hbox_new (
FALSE, 6);
1660 yesbutton = gtk_button_new_with_label (
"Yes, quit");
1661 gtk_box_pack_start (GTK_BOX (hbox), yesbutton,
TRUE,
1663 gtk_signal_connect_object (GTK_OBJECT (yesbutton),
1666 GINT_TO_POINTER (
"y"));
1668 nobutton = gtk_button_new_with_label (
"Don't quit");
1669 gtk_box_pack_start (GTK_BOX (hbox), nobutton,
TRUE,
1671 gtk_signal_connect_object (GTK_OBJECT (nobutton),
1674 GINT_TO_POINTER (
"n"));
1676 gtk_box_pack_start (GTK_BOX (dbox), hbox,
FALSE,
TRUE,
1679 gtk_widget_show (yesbutton);
1680 gtk_widget_show (nobutton);
1681 gtk_widget_show (hbox);
1687 if (!strcmp (
last_str,
"What is the password?"))
1691 gtk_label_new (
"What is the party password?");
1692 gtk_box_pack_start (GTK_BOX (dbox), dialoglabel,
1694 gtk_widget_show (dialoglabel);
1696 hbox = gtk_hbox_new (
FALSE, 6);
1698 gtk_entry_set_visibility (GTK_ENTRY (
dialogtext),
1705 gtk_box_pack_start (GTK_BOX (hbox),
dialogtext,
1707 gtk_box_pack_start (GTK_BOX (dbox), hbox,
FALSE,
1710 gtk_widget_show (hbox);
1720 dialoglabel = gtk_label_new (str);
1721 gtk_box_pack_start (GTK_BOX (dbox), dialoglabel,
FALSE,
1723 gtk_widget_show (dialoglabel);
1725 hbox = gtk_hbox_new (
FALSE, 6);
1730 gtk_signal_connect (GTK_OBJECT (
dialogtext),
"activate",
1735 gtk_box_pack_start (GTK_BOX (dbox), hbox,
FALSE,
TRUE,
1738 gtk_widget_show (hbox);
1749 gtk_widget_show (dbox);
1775 char timestamp[11]=
"";
1782 time_t currenttime = time(0);
1783 now = localtime(¤ttime);
1784 strftime(timestamp, 10,
"%I:%M: ", now);
1830 "trim_info_window, deleted %d characters, %d remaining",
1862 GtkWidget *stats_vbox;
1863 GtkWidget *stats_box_1;
1864 GtkWidget *stats_box_2;
1865 GtkWidget *stats_box_4;
1866 GtkWidget *stats_box_5;
1867 GtkWidget *stats_box_6;
1868 GtkWidget *stats_box_7;
1873 stats_vbox = gtk_vbox_new (
FALSE, 0);
1876 stats_box_1 = gtk_hbox_new (
FALSE, 0);
1878 statwindow.
playername = gtk_label_new(
"Player: ");
1882 gtk_box_pack_start (GTK_BOX (stats_vbox), stats_box_1,
FALSE,
FALSE, 0);
1883 gtk_widget_show (stats_box_1);
1886 stats_box_2 = gtk_hbox_new (
FALSE, 0);
1887 statwindow.
score = gtk_label_new(
"Score: 0");
1888 gtk_box_pack_start (GTK_BOX (stats_box_2), statwindow.
score,
FALSE,
FALSE, 5);
1889 gtk_widget_show (statwindow.
score);
1891 statwindow.
level = gtk_label_new(
"Level: 0");
1892 gtk_box_pack_start (GTK_BOX (stats_box_2), statwindow.
level,
FALSE,
FALSE, 5);
1893 gtk_widget_show (statwindow.
level);
1895 gtk_box_pack_start (GTK_BOX (stats_vbox), stats_box_2,
FALSE,
FALSE, 0);
1896 gtk_widget_show (stats_box_2);
1900 stats_box_4 = gtk_hbox_new (
FALSE, 0);
1902 statwindow.
Str = gtk_label_new(
"S 0");
1903 gtk_box_pack_start (GTK_BOX (stats_box_4), statwindow.
Str,
FALSE,
FALSE, 5);
1904 gtk_widget_show (statwindow.
Str);
1906 statwindow.
Dex = gtk_label_new(
"D 0");
1907 gtk_box_pack_start (GTK_BOX (stats_box_4), statwindow.
Dex,
FALSE,
FALSE, 5);
1908 gtk_widget_show (statwindow.
Dex);
1910 statwindow.
Con = gtk_label_new(
"Co 0");
1911 gtk_box_pack_start (GTK_BOX (stats_box_4), statwindow.
Con,
FALSE,
FALSE, 5);
1912 gtk_widget_show (statwindow.
Con);
1914 statwindow.
Int = gtk_label_new(
"I 0");
1915 gtk_box_pack_start (GTK_BOX (stats_box_4), statwindow.
Int,
FALSE,
FALSE, 5);
1916 gtk_widget_show (statwindow.
Int);
1918 statwindow.
Wis = gtk_label_new(
"W 0");
1919 gtk_box_pack_start (GTK_BOX (stats_box_4), statwindow.
Wis,
FALSE,
FALSE, 5);
1920 gtk_widget_show (statwindow.
Wis);
1922 statwindow.
Pow = gtk_label_new(
"P 0");
1923 gtk_box_pack_start (GTK_BOX (stats_box_4), statwindow.
Pow,
FALSE,
FALSE, 5);
1924 gtk_widget_show (statwindow.
Pow);
1926 statwindow.
Cha = gtk_label_new(
"Ch 0");
1927 gtk_box_pack_start (GTK_BOX (stats_box_4), statwindow.
Cha,
FALSE,
FALSE, 5);
1928 gtk_widget_show (statwindow.
Cha);
1930 gtk_box_pack_start (GTK_BOX (stats_vbox), stats_box_4,
FALSE,
FALSE, 0);
1931 gtk_widget_show (stats_box_4);
1935 stats_box_5 = gtk_hbox_new (
FALSE, 0);
1937 statwindow.
wc = gtk_label_new(
"Wc: 0");
1938 gtk_box_pack_start (GTK_BOX (stats_box_5), statwindow.
wc,
FALSE,
FALSE, 5);
1939 gtk_widget_show (statwindow.
wc);
1941 statwindow.
dam = gtk_label_new(
"Dam: 0");
1942 gtk_box_pack_start (GTK_BOX (stats_box_5), statwindow.
dam,
FALSE,
FALSE, 5);
1943 gtk_widget_show (statwindow.
dam);
1945 statwindow.
ac = gtk_label_new(
"Ac: 0");
1946 gtk_box_pack_start (GTK_BOX (stats_box_5), statwindow.
ac,
FALSE,
FALSE, 5);
1947 gtk_widget_show (statwindow.
ac);
1949 statwindow.
armor = gtk_label_new(
"Armor: 0");
1950 gtk_box_pack_start (GTK_BOX (stats_box_5), statwindow.
armor,
FALSE,
FALSE, 5);
1951 gtk_widget_show (statwindow.
armor);
1953 gtk_box_pack_start (GTK_BOX (stats_vbox), stats_box_5,
FALSE,
FALSE, 0);
1954 gtk_widget_show (stats_box_5);
1958 stats_box_6 = gtk_hbox_new (
FALSE, 0);
1960 statwindow.
speed = gtk_label_new(
"Speed: 0");
1961 gtk_box_pack_start (GTK_BOX (stats_box_6), statwindow.
speed,
FALSE,
FALSE, 5);
1962 gtk_widget_show (statwindow.
speed);
1964 gtk_box_pack_start (GTK_BOX (stats_vbox), stats_box_6,
FALSE,
FALSE, 0);
1965 gtk_widget_show (stats_box_6);
1969 stats_box_7 = gtk_hbox_new (
FALSE, 0);
1971 statwindow.
skill = gtk_label_new(
"Skill: 0");
1972 gtk_box_pack_start (GTK_BOX (stats_box_7), statwindow.
skill,
FALSE,
FALSE, 5);
1973 gtk_widget_show (statwindow.
skill);
1974 gtk_box_pack_start (GTK_BOX (stats_vbox), stats_box_7,
FALSE,
FALSE, 0);
1975 gtk_widget_show (stats_box_7);
1984 table = gtk_table_new (4, 4,
FALSE);
1989 statwindow.
skill_exp[i] = gtk_label_new(
"");
1990 gtk_table_attach(GTK_TABLE(table), statwindow.
skill_exp[i], x, x+1, y, y+1, GTK_FILL | GTK_EXPAND, 0, 10, 0);
1992 if (x==4) { x=0; y++; }
1993 gtk_widget_show(statwindow.
skill_exp[i]);
1997 gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (
skill_scrolled_window),GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
2001 gtk_widget_show(table);
2003 gtk_container_add (GTK_CONTAINER (frame), stats_vbox);
2004 gtk_widget_show (stats_vbox);
2018 static int init_before=0, lastbeep=0, max_drawn_skill=0;
2026 memset(&last_stats, 0,
sizeof(
Stats));
2031 if (strcmp(
cpl.
title, last_name) || redraw) {
2035 gtk_widget_draw (statwindow.
playername, NULL);
2042 gtk_label_set (GTK_LABEL(statwindow.
score), buff);
2043 gtk_widget_draw (statwindow.
score, NULL);
2049 gtk_label_set (GTK_LABEL(statwindow.
level), buff);
2050 gtk_widget_draw (statwindow.
level, NULL);
2058 gtk_label_set (GTK_LABEL(statwindow.
hp), buff);
2059 gtk_widget_draw (statwindow.
hp, NULL);
2067 gtk_label_set (GTK_LABEL(statwindow.
sp), buff);
2068 gtk_widget_draw (statwindow.
sp, NULL);
2076 gtk_label_set (GTK_LABEL(statwindow.
gr), buff);
2077 gtk_widget_draw (statwindow.
gr, NULL);
2083 gtk_label_set (GTK_LABEL(statwindow.
Str), buff);
2084 gtk_widget_draw (statwindow.
Str, NULL);
2090 gtk_label_set (GTK_LABEL(statwindow.
Dex), buff);
2091 gtk_widget_draw (statwindow.
Dex, NULL);
2097 gtk_label_set (GTK_LABEL(statwindow.
Con), buff);
2098 gtk_widget_draw (statwindow.
Con, NULL);
2104 gtk_label_set (GTK_LABEL(statwindow.
Int), buff);
2105 gtk_widget_draw (statwindow.
Int, NULL);
2111 gtk_label_set (GTK_LABEL(statwindow.
Wis), buff);
2112 gtk_widget_draw (statwindow.
Wis, NULL);
2118 gtk_label_set (GTK_LABEL(statwindow.
Pow), buff);
2119 gtk_widget_draw (statwindow.
Pow, NULL);
2125 gtk_label_set (GTK_LABEL(statwindow.
Cha), buff);
2126 gtk_widget_draw (statwindow.
Cha, NULL);
2132 gtk_label_set (GTK_LABEL(statwindow.
wc), buff);
2133 gtk_widget_draw (statwindow.
wc, NULL);
2139 gtk_label_set (GTK_LABEL(statwindow.
dam), buff);
2140 gtk_widget_draw (statwindow.
dam, NULL);
2146 gtk_label_set (GTK_LABEL(statwindow.
ac), buff);
2147 gtk_widget_draw (statwindow.
ac, NULL);
2153 gtk_label_set (GTK_LABEL(statwindow.
armor), buff);
2154 gtk_widget_draw (statwindow.
armor, NULL);
2163 gtk_label_set (GTK_LABEL(statwindow.
speed), buff);
2164 gtk_widget_draw (statwindow.
speed, NULL);
2170 gtk_label_set (GTK_LABEL(statwindow.
food), buff);
2171 gtk_widget_draw (statwindow.
food, NULL);
2174 XBell(GDK_DISPLAY(), 0);
2181 XBell(GDK_DISPLAY(), 0);
2187 if(redraw || strcmp(
cpl.
range, last_range)) {
2190 gtk_widget_draw (statwindow.
skill, NULL);
2203 gtk_label_set(GTK_LABEL(statwindow.
skill_exp[on_skill++]), buff);
2217 if (on_skill < max_drawn_skill) {
2220 for (k = on_skill; k <= max_drawn_skill; k++)
2221 gtk_label_set(GTK_LABEL(statwindow.
skill_exp[k]),
"");
2223 max_drawn_skill = on_skill;
2235 static void create_stat_bar(GtkWidget *mtable, gint row,
const gchar *label, gint bar, GtkWidget **plabel) {
2238 *plabel = gtk_label_new (label);
2239 gtk_table_attach (GTK_TABLE (mtable), *plabel, 0, 1, row, row+1, GTK_EXPAND,GTK_FILL | GTK_EXPAND,0,0);
2240 gtk_widget_show (*plabel);
2242 vitals[bar].
bar = gtk_progress_bar_new ();
2243 gtk_table_attach(GTK_TABLE(mtable), vitals[bar].bar, 0,1,row+1,row+2,GTK_FILL | GTK_EXPAND, 0 ,3,0);
2244 gtk_widget_set_usize (vitals[bar].bar,100,15);
2247 gtk_widget_show (vitals[bar].bar);
2251 vitals[bar].
state=1;
2253 vitals[bar].
style[0] = gtk_style_new ();
2255 gtk_widget_set_style (vitals[bar].bar, vitals[bar].style[0]);
2256 vitals[bar].
style[1] = gtk_style_new ();
2257 vitals[bar].
style[1]->bg[GTK_STATE_PRELIGHT] =
gdk_red;
2267 for (i=0; i<4; i++) {
2274 gtk_widget_set_style(vitals[i].bar, vitals[i].style[1]);
2275 gtk_widget_set_style(vitals[i].bar, vitals[i].style[0]);
2276 vitals[i].
state = 0;
2285 GtkWidget *res_mainbox;
2286 GtkWidget *reswindow;
2289 res_mainbox = gtk_hbox_new (
TRUE,0);
2290 gtk_container_add (GTK_CONTAINER(frame), res_mainbox);
2297 vbox = gtk_vbox_new (
FALSE, 0);
2298 gtk_box_pack_start (GTK_BOX(res_mainbox), vbox,
FALSE,
TRUE, 0);
2301 mtable = gtk_table_new (2,4,
FALSE);
2302 gtk_box_pack_start (GTK_BOX(vbox),mtable,
FALSE,
FALSE,0);
2316 reswindow = gtk_hbox_new (
TRUE, 0);
2317 gtk_box_pack_start(GTK_BOX(res_mainbox), reswindow,
FALSE,
TRUE, 0);
2326 GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
2337 gtk_widget_show (res_mainbox);
2338 gtk_widget_show (reswindow);
2340 gtk_widget_show (mtable);
2341 gtk_widget_show (vbox);
2351 int i, left=0, right=0;
2353 while (GTK_TABLE(
restable)->children) {
2354 GtkTableChild *child;
2355 child = GTK_TABLE(
restable)->children->data;
2357 gtk_container_remove(GTK_CONTAINER(
restable),
2367 gtk_table_resize(GTK_TABLE(
restable), 4,12);
2368 gtk_table_attach (GTK_TABLE(
restable),
fire_label, 1, 2, 0, 1, GTK_FILL | GTK_EXPAND, 0, 0, 0);
2369 gtk_table_attach (GTK_TABLE(
restable),
run_label, 3, 4, 0, 1, GTK_FILL | GTK_EXPAND, 0, 0, 0);
2372 gtk_table_resize(GTK_TABLE(
restable), 2,24);
2373 gtk_table_attach (GTK_TABLE(
restable),
fire_label, 0, 1, 0, 1, GTK_FILL | GTK_EXPAND, 0, 0, 0);
2374 gtk_table_attach (GTK_TABLE(
restable),
run_label, 1, 2, 0, 1, GTK_FILL | GTK_EXPAND, 0, 0, 0);
2382 resists[i] = gtk_label_new(
" ");
2388 gtk_table_attach (GTK_TABLE(
restable),
resists[i], 1, 2, 3+left, 4+left, GTK_FILL | GTK_EXPAND, 0, 0, 0);
2391 gtk_table_attach (GTK_TABLE(
restable),
resists[i], 3, 4, 3+right, 4+right, GTK_FILL | GTK_EXPAND, 0, 0, 0);
2396 gtk_table_attach (GTK_TABLE(
restable),
resists[i], 0, 2, 3+i, 4+i, GTK_FILL | GTK_EXPAND, 0, 0, 0);
2400 gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (
res_scrolled_window),GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
2418 if (gtk_widget_get_style(vitals[bar_pos].bar) == vitals[bar_pos].style[0]) nstyle=1;
2422 if (bar>2.0) bar=2.0;
2423 ncolor.blue = 65535.0 * (bar - 1.0);
2424 ncolor.green = 53247.0 * (2.0 - bar);
2432 if (bar < 0.0) bar=0.0;
2433 if (bar >= 0.5) ncolor.green = 0xcfff;
2434 else ncolor.green = 106494.0 * bar;
2435 if (bar <= 0.5) ncolor.red = 0xcfff;
2436 else ncolor.red = 106494.0 * (1.0 - bar);
2439 vitals[bar_pos].
style[nstyle]->bg[GTK_STATE_PRELIGHT] = ncolor;
2440 gtk_widget_set_style(vitals[bar_pos].bar, vitals[bar_pos].style[nstyle]);
2441 vitals[bar_pos].
state=is_alert;
2443 if (bar>1.0) bar=1.0;
2444 if (is_alert) is_alert=1;
2445 if (vitals[bar_pos].state!=is_alert) {
2446 gtk_widget_set_style (vitals[bar_pos].bar, vitals[bar_pos].style[is_alert]);
2447 vitals[bar_pos].
state=is_alert;
2450 gtk_progress_bar_update (GTK_PROGRESS_BAR (vitals[bar_pos].bar),bar );
2451 gtk_widget_draw (vitals[bar_pos].bar, NULL);
2461 static uint16 scrollsize_hp=0, scrollsize_sp=0, scrollsize_food=0,
2464 scrollfood_alert=
FALSE, scrollgrace_alert=
FALSE;
2482 if (redraw || scrollsize_hp!=bar || scrollhp_alert!=is_alert)
2486 scrollhp_alert=is_alert;
2495 if (redraw || scrollsize_sp!=bar || scrollsp_alert!=is_alert)
2499 scrollsp_alert=is_alert;
2508 if (redraw || scrollsize_grace!=bar || scrollgrace_alert!=is_alert)
2511 scrollsize_grace=bar;
2512 scrollgrace_alert=is_alert;
2520 if (redraw || scrollsize_food!=bar || scrollfood_alert!=is_alert)
2523 scrollsize_food=bar;
2524 scrollfood_alert=is_alert;
2535 sprintf(buf,
"%-10s %+4d",
2537 gtk_label_set(GTK_LABEL(
resists[j]), buf);
2538 gtk_widget_draw(
resists[j], NULL);
2540 if (j >= NUM_RESISTS)
break;
2544 while (j<NUM_RESISTS) {
2545 gtk_label_set(GTK_LABEL(
resists[j]),
" ");
2546 gtk_widget_draw(
resists[j], NULL);
2572 GtkWidget *aboutlabel;
2573 GtkWidget *vscrollbar;
2574 GtkWidget *aboutbutton;
2575 GtkWidget *aboutgtkpixmap;
2576 GdkPixmap *aboutgdkpixmap;
2577 GdkBitmap *aboutgdkmask;
2584 gtk_window_position (GTK_WINDOW (
gtkwin_about), GTK_WIN_POS_CENTER);
2586 gtk_window_set_title (GTK_WINDOW (
gtkwin_about),
"About Crossfire");
2590 gtk_container_border_width (GTK_CONTAINER (
gtkwin_about), 0);
2591 vbox = gtk_vbox_new(
FALSE, 2);
2595 aboutgdkpixmap = gdk_pixmap_create_from_xpm_d(
gtkwin_about->window,
2597 &style->bg[GTK_STATE_NORMAL],
2598 (gchar **)crossfiretitle_xpm);
2599 aboutgtkpixmap= gtk_pixmap_new (aboutgdkpixmap, aboutgdkmask);
2600 gtk_box_pack_start (GTK_BOX (vbox),aboutgtkpixmap,
FALSE,
TRUE, 0);
2601 gtk_widget_show (aboutgtkpixmap);
2603 hbox = gtk_hbox_new(
FALSE, 2);
2604 gtk_box_pack_start (GTK_BOX (vbox), hbox,
TRUE,
TRUE, 0);
2606 aboutlabel = gtk_text_new (NULL, NULL);
2607 gtk_text_set_editable (GTK_TEXT (aboutlabel),
FALSE);
2608 gtk_box_pack_start (GTK_BOX (hbox),aboutlabel,
TRUE,
TRUE, 0);
2609 gtk_widget_show (aboutlabel);
2611 vscrollbar = gtk_vscrollbar_new (GTK_TEXT (aboutlabel)->vadj);
2612 gtk_box_pack_start (GTK_BOX (hbox),vscrollbar,
FALSE,
FALSE, 0);
2614 gtk_widget_show (vscrollbar);
2616 gtk_widget_show (hbox);
2618 hbox = gtk_hbox_new(
FALSE, 2);
2620 aboutbutton = gtk_button_new_with_label (
"Close");
2621 gtk_signal_connect_object (GTK_OBJECT (aboutbutton),
"clicked",
2622 GTK_SIGNAL_FUNC(gtk_widget_destroy),
2624 gtk_box_pack_start (GTK_BOX (hbox), aboutbutton,
TRUE,
FALSE, 0);
2625 gtk_box_pack_start (GTK_BOX (vbox), hbox,
FALSE,
FALSE, 0);
2626 gtk_widget_show (aboutbutton);
2627 gtk_widget_show (hbox);
2629 gtk_widget_show (vbox);
2631 gtk_text_insert (GTK_TEXT (aboutlabel), NULL, &aboutlabel->style->black,
2633 gtk_text_insert (GTK_TEXT (aboutlabel), NULL, &aboutlabel->style->black,
2635 gtk_adjustment_set_value(GTK_TEXT(aboutlabel)->vadj, 0.0);
2645 bugtrack = gtk_text_new (NULL, NULL);
2646 gtk_signal_connect (GTK_OBJECT (
bugtrack),
"destroy", GTK_SIGNAL_FUNC(gtk_widget_destroyed), &
bugtrack);
2648 gtk_text_insert (GTK_TEXT (
bugtrack), NULL, &
bugtrack->style->black,NULL,
"MESSAGES TRACK:\n" , -1);
2659 GtkWidget *buglabel;
2660 GtkWidget *vscrollbar;
2661 GtkWidget *bugbutton;
2662 GtkWidget *buggtkpixmap;
2663 GdkPixmap *buggdkpixmap;
2664 GdkBitmap *buggdkmask;
2673 gtkwin_bug = gtk_window_new (GTK_WINDOW_DIALOG);
2674 gtk_window_position (GTK_WINDOW (
gtkwin_bug), GTK_WIN_POS_CENTER);
2676 gtk_window_set_title (GTK_WINDOW (
gtkwin_bug),
"Report a bug in Crossfire");
2678 gtk_signal_connect (GTK_OBJECT (
gtkwin_bug),
"destroy", GTK_SIGNAL_FUNC(gtk_widget_destroyed), &
gtkwin_bug);
2681 gtk_container_border_width (GTK_CONTAINER (
gtkwin_bug), 0);
2682 vbox = gtk_vbox_new(
FALSE, 2);
2683 gtk_container_add (GTK_CONTAINER(
gtkwin_bug),vbox);
2686 buggdkpixmap = gdk_pixmap_create_from_xpm_d(
gtkwin_bug->window,
2688 &style->bg[GTK_STATE_NORMAL],
2689 (gchar **)crossfiretitle_xpm);
2690 buggtkpixmap= gtk_pixmap_new (buggdkpixmap, buggdkmask);
2691 gtk_box_pack_start (GTK_BOX (vbox),buggtkpixmap,
FALSE,
TRUE, 0);
2692 gtk_widget_show (buggtkpixmap);
2694 hbox = gtk_hbox_new(
FALSE, 2);
2695 gtk_box_pack_start (GTK_BOX (vbox), hbox,
TRUE,
TRUE, 0);
2697 buglabel = gtk_text_new (NULL, NULL);
2698 gtk_widget_set_style(buglabel,style);
2700 gtk_text_set_editable (GTK_TEXT (buglabel),
FALSE);
2701 gtk_box_pack_start (GTK_BOX (hbox),buglabel,
TRUE,
TRUE, 0);
2702 gtk_widget_show (buglabel);
2704 vscrollbar = gtk_vscrollbar_new (GTK_TEXT (buglabel)->vadj);
2705 gtk_box_pack_start (GTK_BOX (hbox),vscrollbar,
FALSE,
FALSE, 0);
2707 gtk_widget_show (vscrollbar);
2709 gtk_widget_show (hbox);
2710 hbox = gtk_hbox_new(
FALSE, 2);
2714 font = gdk_font_load (
"-*-fixed-*-*-*-*-12-*-*-*-*-*-*-*");
2716 style = gtk_style_copy(gtk_widget_get_style (
bugtrack));
2717 gdk_font_unref(style->font);
2720 gtk_widget_set_style(
bugtrack,style);
2725 vscrollbar = gtk_vscrollbar_new (GTK_TEXT (
bugtrack)->vadj);
2726 gtk_box_pack_start (GTK_BOX (hbox),vscrollbar,
FALSE,
FALSE, 0);
2727 gtk_box_pack_start (GTK_BOX (vbox), hbox,
TRUE,
TRUE, 0);
2728 gtk_widget_show (vscrollbar);
2729 gtk_widget_show (hbox);
2730 hbox = gtk_hbox_new(
FALSE, 2);
2731 bugbutton = gtk_button_new_with_label (
"Close");
2732 gtk_signal_connect_object (GTK_OBJECT (bugbutton),
"clicked",
2733 GTK_SIGNAL_FUNC(gtk_widget_destroy),
2735 gtk_box_pack_start (GTK_BOX (hbox), bugbutton,
TRUE,
FALSE, 0);
2736 gtk_box_pack_start (GTK_BOX (vbox), hbox,
FALSE,
FALSE, 0);
2737 gtk_widget_show (bugbutton);
2738 gtk_widget_show (hbox);
2740 gtk_widget_show (vbox);
2742 gtk_text_insert (GTK_TEXT (buglabel), NULL, &buglabel->style->black,
2744 gtk_text_insert (GTK_TEXT (buglabel), NULL, &buglabel->style->black,
2747 gtk_text_insert (GTK_TEXT (buglabel), NULL, &buglabel->style->black,
2748 NULL,
"\n\nVersion Information\n" , -1);
2751 gtk_adjustment_set_value(GTK_TEXT(buglabel)->vadj, 0.0);
2760 if (event->button==1) {
2761 gtk_clist_get_text (GTK_CLIST(
cclist), row, 0, &buf);
2763 gtk_clist_get_text (GTK_CLIST(
cclist), row, 1, &buf);
2765 gtk_clist_get_text (GTK_CLIST(
cclist), row, 3, &buf);
2767 gtk_clist_get_text (GTK_CLIST(
cclist), row, 4, &buf);
2794 GtkWidget *shelptext;
2795 GtkWidget *helpbutton;
2796 GtkWidget *vscrollbar;
2802 gtk_window_position (GTK_WINDOW (
gtkwin_shelp), GTK_WIN_POS_CENTER);
2804 gtk_window_set_title (GTK_WINDOW (
gtkwin_shelp),
"Crossfire Server Help");
2809 gtk_container_border_width (GTK_CONTAINER (
gtkwin_shelp), 0);
2810 vbox = gtk_vbox_new(
FALSE, 2);
2812 hbox = gtk_hbox_new(
FALSE, 2);
2813 gtk_box_pack_start (GTK_BOX (vbox), hbox,
TRUE,
TRUE, 0);
2815 shelptext = gtk_text_new (NULL, NULL);
2816 gtk_text_set_editable (GTK_TEXT (shelptext),
FALSE);
2817 gtk_box_pack_start (GTK_BOX (hbox),shelptext,
TRUE,
TRUE, 0);
2818 gtk_widget_show (shelptext);
2820 vscrollbar = gtk_vscrollbar_new (GTK_TEXT (shelptext)->vadj);
2821 gtk_box_pack_start (GTK_BOX (hbox),vscrollbar,
FALSE,
FALSE, 0);
2823 gtk_widget_show (vscrollbar);
2824 gtk_widget_show (hbox);
2826 hbox = gtk_hbox_new(
FALSE, 2);
2828 helpbutton = gtk_button_new_with_label (
"Close");
2829 gtk_signal_connect_object (GTK_OBJECT (helpbutton),
"clicked",
2830 GTK_SIGNAL_FUNC(gtk_widget_destroy),
2832 gtk_box_pack_start (GTK_BOX (hbox), helpbutton,
TRUE,
FALSE, 0);
2833 gtk_box_pack_start (GTK_BOX (vbox), hbox,
FALSE,
FALSE, 0);
2834 gtk_widget_show (helpbutton);
2835 gtk_widget_show (hbox);
2837 gtk_widget_show (vbox);
2839 gtk_text_insert (GTK_TEXT (shelptext), NULL, &shelptext->style->black, NULL,
text , -1);
2853 if(GTK_CHECK_MENU_ITEM (button)->active) {
2864 fprintf(stderr,
"val=0x%8x\n",val);
2865 fprintf(stderr,
"mode=0x%8x\n",
pmode);
2933 gtk_entry_set_text(GTK_ENTRY(
entrytext),
"cast ");
2934 gtk_widget_grab_focus (GTK_WIDGET(
entrytext));
2949 gint row, selected = -1;
2951 if (GTK_CLIST(list)->selection != NULL)
2952 selected = GPOINTER_TO_INT(GTK_CLIST(list)->selection->data);
2954 gtk_clist_freeze(GTK_CLIST(list));
2955 gtk_clist_clear(GTK_CLIST(list));
2957 columns[0] = buffer[0];
2958 columns[1] = buffer[1];
2963 snprintf(buffer[0],
sizeof(buffer[0]),
" ");
2964 snprintf(buffer[1],
sizeof(buffer[1]), ob->
d_name);
2965 row = gtk_clist_append(GTK_CLIST(list), columns);
2966 gtk_clist_set_pixmap (GTK_CLIST (list), row, 0,
2969 gtk_clist_set_row_data (GTK_CLIST(list), row, ob);
2972 gtk_clist_thaw(GTK_CLIST(list));
2974 if (selected != -1) {
2975 gtk_clist_select_row(GTK_CLIST(list), selected, 1);
2976 gtk_clist_moveto(GTK_CLIST(list), selected, 0, 0, 0);
2992 if (GTK_CLIST(spellinventory)->selection != NULL && GTK_CLIST(list)->selection != NULL) {
2993 selection = GPOINTER_TO_INT(GTK_CLIST(spellinventory)->selection->data);
2994 scroll = (
item*)gtk_clist_get_row_data(GTK_CLIST(spellinventory), selection);
2996 selection = GPOINTER_TO_INT(GTK_CLIST(list)->selection->data);
2997 spell = (
Spell*)gtk_clist_get_row_data(GTK_CLIST(list), selection);
3004 GdkEventButton *
event) {
3007 Spell *spell = gtk_clist_get_row_data (GTK_CLIST(gtklist), row);
3008 char *options = NULL;
3012 gtk_text_freeze(GTK_TEXT(description));
3013 gtk_text_set_point(GTK_TEXT(description), 0);
3014 gtk_text_forward_delete(GTK_TEXT(description), gtk_text_get_length(GTK_TEXT(description)));
3015 sprintf(message,
"%s - level %d %s spell\n\n%s", spell->
name, spell->
level,
3017 gtk_text_insert(GTK_TEXT(description), NULL, NULL, NULL, message, -1);
3018 gtk_text_thaw(GTK_TEXT(description));
3019 if (event->button==2) {
3020 options = gtk_editable_get_chars(GTK_EDITABLE(spelloptions), 0, -1);
3021 sprintf(command,
"invoke %d %s", spell->
tag, options);
3025 else if (event->button==3) {
3026 options = gtk_editable_get_chars(GTK_EDITABLE(spelloptions), 0, -1);
3027 sprintf(command,
"cast %d %s", spell->
tag, options);
3042 if (!gtkwin_spell || !GTK_IS_CLIST(list) || !GTK_WIDGET_VISIBLE(gtkwin_spell))
return;
3044 gtk_clist_freeze(GTK_CLIST(list));
3047 gtk_clist_clear(GTK_CLIST(list));
3051 pixmap = pixmaps[spell->
face];
3054 strcpy(buffer[1], spell->
name);
3055 columns[0] = buffer[0];
3056 columns[1] = buffer[1];
3057 columns[2] = buffer[2];
3058 if (spell->
sp) sprintf(buffer[2],
"%d mana ", spell->
sp);
3059 if (spell->
grace) sprintf(buffer[2]+strlen(buffer[2]),
"%d grace ", spell->
grace);
3060 if (spell->
dam) sprintf(buffer[2]+strlen(buffer[2]),
"%d damage ", spell->
dam);
3066 row = gtk_clist_append(GTK_CLIST(list), columns);
3067 gtk_clist_set_row_data(GTK_CLIST(list), row, spell);
3070 strcat(buffer[2],
"(DENIED) ");
3074 strcat(buffer[2],
"(attuned) ");
3078 strcat(buffer[2],
"(repelled) ");
3080 gtk_clist_set_text(GTK_CLIST(list), row, 2, columns[2]);
3081 gtk_clist_set_pixmap (GTK_CLIST (list), row, 0,
3084 gtk_clist_thaw(GTK_CLIST(list));
3089 GtkWidget * scroll_window;
3090 GtkStyle * liststyle;
3091 GtkWidget *cancelbutton;
3093 GtkWidget * optionsbox;
3094 GtkWidget * spelloptionslabel;
3095 GtkWidget * notebook;
3098 GtkWidget * inscribebutton;
3099 GtkWidget * inscribewindow;
3100 gchar *titles[] = {
" ",
"Name",
"Cost"};
3101 gchar *titles_inv[] = {
" ",
"Name"};
3103 if (gtkwin_spell && GTK_IS_CLIST(list)) {
3105 if (GTK_WIDGET_VISIBLE(gtkwin_spell)) {
3106 gdk_window_raise(gtkwin_spell->window);
3113 gtk_widget_show_all(gtkwin_spell);
3120 gtkwin_spell = gtk_window_new (GTK_WINDOW_DIALOG);
3122 gtk_window_set_title(GTK_WINDOW (gtkwin_spell),
"Cast Spell");
3125 spelloptions = gtk_entry_new();
3126 spelloptionslabel = gtk_label_new(
"Spell Options:");
3127 optionsbox = gtk_hbox_new(
FALSE, 2);
3128 gtk_box_pack_start(GTK_BOX(optionsbox), spelloptionslabel,
FALSE,
FALSE, 0);
3129 gtk_box_pack_start(GTK_BOX(optionsbox), spelloptions,
TRUE,
TRUE, 0);
3132 scroll_window = gtk_scrolled_window_new (0,0);
3133 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scroll_window),
3134 GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
3137 list = gtk_clist_new_with_titles(3, titles);
3138 gtk_clist_set_column_width(GTK_CLIST(list), 1,
image_size);
3139 gtk_clist_set_column_width(GTK_CLIST(list), 1, 200);
3140 gtk_clist_set_column_width(GTK_CLIST(list), 2, 200);
3141 gtk_clist_set_selection_mode(GTK_CLIST(list) , GTK_SELECTION_BROWSE);
3142 gtk_clist_set_row_height (GTK_CLIST(list),
image_size);
3143 liststyle = gtk_rc_get_style(list);
3145 liststyle->bg[GTK_STATE_SELECTED] =
gdk_grey;
3146 liststyle->fg[GTK_STATE_SELECTED] =
gdk_black;
3147 gtk_widget_set_style (list, liststyle);
3150 gtk_clist_set_button_actions(GTK_CLIST(list), 1, GTK_BUTTON_SELECTS);
3151 gtk_clist_set_button_actions(GTK_CLIST(list), 2, GTK_BUTTON_SELECTS);
3152 gtk_signal_connect(GTK_OBJECT(list),
"select_row",
3156 gtk_container_add(GTK_CONTAINER(scroll_window), list);
3159 description = gtk_text_new(NULL, NULL);
3160 gtk_text_set_editable(GTK_TEXT (description),
FALSE);
3163 cancelbutton = gtk_button_new_with_label(
"Close");
3164 gtk_signal_connect_object (GTK_OBJECT (cancelbutton),
"clicked",
3165 GTK_SIGNAL_FUNC(gtk_widget_hide_all), GTK_OBJECT (gtkwin_spell));
3167 notebook = gtk_notebook_new ();
3168 gtk_notebook_set_tab_pos (GTK_NOTEBOOK (notebook), GTK_POS_TOP );
3170 label = gtk_label_new (
"Information");
3171 gtk_widget_show (label);
3173 frame = gtk_frame_new(
"Spell information");
3174 gtk_frame_set_shadow_type (GTK_FRAME(frame), GTK_SHADOW_ETCHED_IN);
3175 gtk_notebook_append_page(GTK_NOTEBOOK(notebook), frame, label);
3176 vbox = gtk_vbox_new(
FALSE, 0);
3177 gtk_box_pack_start(GTK_BOX(vbox), optionsbox,
FALSE,
FALSE, 0);
3178 gtk_box_pack_start(GTK_BOX(vbox), description,
TRUE,
TRUE, 0);
3179 gtk_container_add (GTK_CONTAINER(frame), vbox);
3183 label = gtk_label_new (
"Inscribe");
3184 gtk_widget_show (label);
3186 frame = gtk_frame_new(
"Inscribe a spell");
3187 gtk_frame_set_shadow_type (GTK_FRAME(frame), GTK_SHADOW_ETCHED_IN);
3188 gtk_notebook_append_page(GTK_NOTEBOOK(notebook), frame, label);
3189 vbox = gtk_vbox_new(
FALSE, 0);
3190 label = gtk_label_new (
"Choose the item to write on:");
3191 gtk_box_pack_start(GTK_BOX(vbox), label,
FALSE,
FALSE, 0);
3193 inscribewindow = gtk_scrolled_window_new (0,0);
3194 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(inscribewindow),
3195 GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
3197 spellinventory = gtk_clist_new_with_titles(2, titles_inv);
3198 gtk_clist_set_column_width(GTK_CLIST(spellinventory), 0,
image_size);
3199 gtk_clist_set_selection_mode(GTK_CLIST(spellinventory) , GTK_SELECTION_BROWSE);
3200 gtk_clist_set_row_height (GTK_CLIST(spellinventory),
image_size);
3201 liststyle = gtk_rc_get_style(spellinventory);
3203 liststyle->bg[GTK_STATE_SELECTED] =
gdk_grey;
3204 liststyle->fg[GTK_STATE_SELECTED] =
gdk_black;
3205 gtk_widget_set_style (spellinventory, liststyle);
3207 gtk_signal_connect(GTK_OBJECT(spellinventory),
3208 "visibility-notify-event",
3210 gtk_widget_add_events(spellinventory, GDK_VISIBILITY_NOTIFY_MASK);
3212 gtk_container_add(GTK_CONTAINER(inscribewindow), spellinventory);
3213 gtk_box_pack_start(GTK_BOX(vbox), inscribewindow,
TRUE,
TRUE, 0);
3215 inscribebutton = gtk_button_new_with_label(
"Inscribe");
3216 gtk_signal_connect_object (GTK_OBJECT (inscribebutton),
"clicked",
3218 gtk_box_pack_start(GTK_BOX(vbox), inscribebutton,
FALSE,
FALSE, 0);
3220 gtk_container_add (GTK_CONTAINER(frame), vbox);
3225 vbox = gtk_vbox_new(
FALSE, 2);
3228 gtk_container_add(GTK_CONTAINER(gtkwin_spell), vbox);
3229 gtk_box_pack_start(GTK_BOX(vbox), scroll_window,
TRUE,
TRUE, 0);
3231 gtk_box_pack_start (GTK_BOX(vbox),notebook,
TRUE,
TRUE, 0);
3233 gtk_box_pack_start(GTK_BOX(vbox), cancelbutton,
FALSE,
FALSE, 0);
3235 gtk_widget_show_all(gtkwin_spell);
3270 LOG(
LOG_INFO,
"gtk::client_exit",
"Exiting with return value 0.");
3287 GtkWidget *filemenu;
3288 GtkWidget *actionmenu;
3289 GtkWidget *pickupmenu;
3290 GtkWidget *newpickupmenu;
3291 GtkWidget *ratiopickupmenu;
3292 GtkWidget *weaponpickupmenu;
3293 GtkWidget *armourpickupmenu;
3294 GtkWidget *bookspickupmenu;
3295 GtkWidget *clientmenu;
3296 GtkWidget *helpmenu;
3297 GtkWidget *menu_bar;
3298 GtkWidget *root_filemenu;
3299 GtkWidget *root_helpmenu;
3300 GtkWidget *root_actionmenu;
3302 GtkWidget *root_clientmenu;
3303 GtkWidget *menu_items;
3304 GtkWidget *pickup_menu_item;
3305 GtkWidget *newpickup_menu_item;
3306 GtkWidget *ratiopickup_menu_item;
3307 GtkWidget *weaponpickup_menu_item;
3308 GtkWidget *armourpickup_menu_item;
3309 GtkWidget *bookspickup_menu_item;
3310 GSList *pickupgroup;
3311 GSList *ratiopickupgroup;
3313 char menustring[128];
3320 filemenu = gtk_menu_new();
3328 menu_items = gtk_tearoff_menu_item_new ();
3329 gtk_menu_append (GTK_MENU (filemenu), menu_items);
3330 gtk_widget_show (menu_items);
3332 menu_items = gtk_menu_item_new_with_label(
"Save config");
3333 gtk_menu_append(GTK_MENU (filemenu), menu_items);
3334 gtk_signal_connect_object(GTK_OBJECT(menu_items),
"activate",
3336 gtk_widget_show(menu_items);
3338 menu_items = gtk_menu_item_new_with_label(
"Save window positions");
3339 gtk_menu_append(GTK_MENU (filemenu), menu_items);
3340 gtk_signal_connect_object(GTK_OBJECT(menu_items),
"activate",
3342 gtk_widget_show(menu_items);
3344 menu_items = gtk_menu_item_new ();
3345 gtk_menu_append(GTK_MENU (filemenu), menu_items);
3346 gtk_widget_show(menu_items);
3349 menu_items = gtk_menu_item_new_with_label(
"Quit character");
3350 gtk_menu_append(GTK_MENU (filemenu), menu_items);
3351 gtk_signal_connect_object(GTK_OBJECT(menu_items),
"activate",
3352 GTK_SIGNAL_FUNC(
sexit), NULL);
3353 gtk_widget_show(menu_items);
3355 menu_items = gtk_menu_item_new_with_label(
"Quit client");
3356 gtk_menu_append(GTK_MENU (filemenu), menu_items);
3357 gtk_signal_connect_object(GTK_OBJECT(menu_items),
"activate",
3359 gtk_widget_show(menu_items);
3364 root_filemenu = gtk_menu_item_new_with_label(
"File");
3366 gtk_widget_show(root_filemenu);
3370 gtk_menu_item_set_submenu(GTK_MENU_ITEM (root_filemenu), filemenu);
3374 clientmenu = gtk_menu_new();
3382 menu_items = gtk_tearoff_menu_item_new ();
3383 gtk_menu_append (GTK_MENU (clientmenu), menu_items);
3384 gtk_widget_show (menu_items);
3386 menu_items = gtk_menu_item_new_with_label(
"Clear info");
3387 gtk_menu_append(GTK_MENU (clientmenu), menu_items);
3388 gtk_signal_connect_object(GTK_OBJECT(menu_items),
"activate",
3390 gtk_widget_show(menu_items);
3393 menu_items = gtk_menu_item_new_with_label(
"Spells");
3394 gtk_menu_append(GTK_MENU (clientmenu), menu_items);
3395 gtk_signal_connect_object(GTK_OBJECT(menu_items),
"activate",
3397 gtk_widget_show(menu_items);
3399 menu_items = gtk_menu_item_new_with_label(
"Configure");
3400 gtk_menu_append(GTK_MENU (clientmenu), menu_items);
3401 gtk_signal_connect_object(GTK_OBJECT(menu_items),
"activate",
3403 gtk_widget_show(menu_items);
3406 menu_items = gtk_menu_item_new_with_label(
"Disconnect");
3407 gtk_menu_append(GTK_MENU (clientmenu), menu_items);
3408 gtk_signal_connect_object(GTK_OBJECT(menu_items),
"activate",
3410 gtk_widget_show(menu_items);
3413 root_clientmenu = gtk_menu_item_new_with_label(
"Client");
3415 gtk_widget_show(root_clientmenu);
3416 gtk_menu_item_set_submenu(GTK_MENU_ITEM (root_clientmenu), clientmenu);
3420 actionmenu = gtk_menu_new();
3422 menu_items = gtk_tearoff_menu_item_new ();
3423 gtk_menu_append (GTK_MENU (actionmenu), menu_items);
3424 gtk_widget_show (menu_items);
3426 menu_items = gtk_menu_item_new_with_label(
"Who");
3427 gtk_menu_append(GTK_MENU (actionmenu), menu_items);
3428 gtk_signal_connect_object(GTK_OBJECT(menu_items),
"activate",
3430 gtk_widget_show(menu_items);
3432 menu_items = gtk_menu_item_new_with_label(
"Cast...");
3433 gtk_menu_append(GTK_MENU (actionmenu), menu_items);
3434 gtk_signal_connect_object(GTK_OBJECT(menu_items),
"activate",
3436 gtk_widget_show(menu_items);
3438 menu_items = gtk_menu_item_new_with_label(
"Apply");
3439 gtk_menu_append(GTK_MENU (actionmenu), menu_items);
3440 gtk_signal_connect_object(GTK_OBJECT(menu_items),
"activate",
3442 gtk_widget_show(menu_items);
3444 pickup_menu_item = gtk_menu_item_new_with_label(
"Pickup");
3445 gtk_menu_append(GTK_MENU (actionmenu), pickup_menu_item);
3448 gtk_widget_show(pickup_menu_item);
3450 newpickup_menu_item = gtk_menu_item_new_with_label(
"NEWPickup");
3451 gtk_menu_append(GTK_MENU (actionmenu), newpickup_menu_item);
3452 gtk_widget_show(newpickup_menu_item);
3454 menu_items = gtk_menu_item_new_with_label(
"Search");
3455 gtk_menu_append(GTK_MENU (actionmenu), menu_items);
3456 gtk_signal_connect_object(GTK_OBJECT(menu_items),
"activate",
3458 gtk_widget_show(menu_items);
3460 menu_items = gtk_menu_item_new_with_label(
"Disarm");
3461 gtk_menu_append(GTK_MENU (actionmenu), menu_items);
3462 gtk_signal_connect_object(GTK_OBJECT(menu_items),
"activate",
3464 gtk_widget_show(menu_items);
3467 root_actionmenu = gtk_menu_item_new_with_label(
"Action");
3469 gtk_widget_show(root_actionmenu);
3470 gtk_menu_item_set_submenu(GTK_MENU_ITEM (root_actionmenu), actionmenu);
3474 pickupmenu = gtk_menu_new();
3481 menu_items = gtk_tearoff_menu_item_new ();
3482 gtk_menu_append (GTK_MENU (pickupmenu), menu_items);
3483 gtk_widget_show (menu_items);
3485 menu_items = gtk_radio_menu_item_new_with_label(pickupgroup,
"Don't pick up");
3486 pickupgroup = gtk_radio_menu_item_group (GTK_RADIO_MENU_ITEM (menu_items));
3487 gtk_check_menu_item_set_show_toggle (GTK_CHECK_MENU_ITEM (menu_items),
TRUE);
3488 gtk_menu_append(GTK_MENU (pickupmenu), menu_items);
3489 gtk_signal_connect_object(GTK_OBJECT(menu_items),
"activate",
3491 gtk_widget_show(menu_items);
3493 menu_items = gtk_radio_menu_item_new_with_label(pickupgroup,
"Pick up 1 item");
3494 pickupgroup = gtk_radio_menu_item_group (GTK_RADIO_MENU_ITEM (menu_items));
3495 gtk_check_menu_item_set_show_toggle (GTK_CHECK_MENU_ITEM (menu_items),
TRUE);
3496 gtk_menu_append(GTK_MENU (pickupmenu), menu_items);
3497 gtk_signal_connect_object(GTK_OBJECT(menu_items),
"activate",
3499 gtk_widget_show(menu_items);
3502 menu_items = gtk_radio_menu_item_new_with_label(pickupgroup,
"Pick up 1 item and stop");
3503 pickupgroup = gtk_radio_menu_item_group (GTK_RADIO_MENU_ITEM (menu_items));
3504 gtk_check_menu_item_set_show_toggle (GTK_CHECK_MENU_ITEM (menu_items),
TRUE);
3505 gtk_menu_append(GTK_MENU (pickupmenu), menu_items);
3506 gtk_signal_connect_object(GTK_OBJECT(menu_items),
"activate",
3508 gtk_widget_show(menu_items);
3510 menu_items = gtk_radio_menu_item_new_with_label(pickupgroup,
"Stop before picking up.");
3511 pickupgroup = gtk_radio_menu_item_group (GTK_RADIO_MENU_ITEM (menu_items));
3512 gtk_check_menu_item_set_show_toggle (GTK_CHECK_MENU_ITEM (menu_items),
TRUE);
3513 gtk_menu_append(GTK_MENU (pickupmenu), menu_items);
3514 gtk_signal_connect_object(GTK_OBJECT(menu_items),
"activate",
3516 gtk_widget_show(menu_items);
3518 menu_items = gtk_radio_menu_item_new_with_label(pickupgroup,
"Pick up all items.");
3519 pickupgroup = gtk_radio_menu_item_group (GTK_RADIO_MENU_ITEM (menu_items));
3520 gtk_check_menu_item_set_show_toggle (GTK_CHECK_MENU_ITEM (menu_items),
TRUE);
3521 gtk_menu_append(GTK_MENU (pickupmenu), menu_items);
3522 gtk_signal_connect_object(GTK_OBJECT(menu_items),
"activate",
3524 gtk_widget_show(menu_items);
3526 menu_items = gtk_radio_menu_item_new_with_label(pickupgroup,
"Pick up all items and stop.");
3527 pickupgroup = gtk_radio_menu_item_group (GTK_RADIO_MENU_ITEM (menu_items));
3528 gtk_check_menu_item_set_show_toggle (GTK_CHECK_MENU_ITEM (menu_items),
TRUE);
3529 gtk_menu_append(GTK_MENU (pickupmenu), menu_items);
3530 gtk_signal_connect_object(GTK_OBJECT(menu_items),
"activate",
3532 gtk_widget_show(menu_items);
3534 menu_items = gtk_radio_menu_item_new_with_label(pickupgroup,
"Pick up all magic items.");
3535 pickupgroup = gtk_radio_menu_item_group (GTK_RADIO_MENU_ITEM (menu_items));
3536 gtk_check_menu_item_set_show_toggle (GTK_CHECK_MENU_ITEM (menu_items),
TRUE);
3537 gtk_menu_append(GTK_MENU (pickupmenu), menu_items);
3538 gtk_signal_connect_object(GTK_OBJECT(menu_items),
"activate",
3540 gtk_widget_show(menu_items);
3542 menu_items = gtk_radio_menu_item_new_with_label(pickupgroup,
"Pick up all coins and gems.");
3543 pickupgroup = gtk_radio_menu_item_group (GTK_RADIO_MENU_ITEM (menu_items));
3544 gtk_check_menu_item_set_show_toggle (GTK_CHECK_MENU_ITEM (menu_items),
TRUE);
3545 gtk_menu_append(GTK_MENU (pickupmenu), menu_items);
3546 gtk_signal_connect_object(GTK_OBJECT(menu_items),
"activate",
3548 gtk_widget_show(menu_items);
3550 menu_items = gtk_radio_menu_item_new_with_label(pickupgroup,
"Pickup silver and higher value/weight.");
3551 pickupgroup = gtk_radio_menu_item_group (GTK_RADIO_MENU_ITEM (menu_items));
3552 gtk_check_menu_item_set_show_toggle (GTK_CHECK_MENU_ITEM (menu_items),
TRUE);
3553 gtk_menu_append(GTK_MENU (pickupmenu), menu_items);
3554 gtk_signal_connect_object(GTK_OBJECT(menu_items),
"activate",
3556 gtk_widget_show(menu_items);
3562 gtk_menu_item_set_submenu(GTK_MENU_ITEM (pickup_menu_item), pickupmenu);
3572 newpickupmenu = gtk_menu_new();
3573 gtk_menu_item_set_submenu(GTK_MENU_ITEM(newpickup_menu_item), newpickupmenu);
3575 menu_items = gtk_tearoff_menu_item_new();
3576 gtk_menu_append(GTK_MENU(newpickupmenu), menu_items);
3577 gtk_widget_show(menu_items);
3579 menu_items = gtk_check_menu_item_new_with_label(
"Enable NEW autopickup");
3580 gtk_check_menu_item_set_show_toggle(GTK_CHECK_MENU_ITEM(menu_items),
TRUE);
3581 gtk_menu_append(GTK_MENU(newpickupmenu), menu_items);
3582 gtk_signal_connect(GTK_OBJECT(menu_items),
"activate",
3584 gtk_widget_show(menu_items);
3588 menu_items = gtk_check_menu_item_new_with_label(
"Inhibit autopickup");
3589 gtk_check_menu_item_set_show_toggle(GTK_CHECK_MENU_ITEM(menu_items),
TRUE);
3590 gtk_menu_append(GTK_MENU(newpickupmenu), menu_items);
3591 gtk_signal_connect(GTK_OBJECT(menu_items),
"activate",
3593 gtk_widget_show(menu_items);
3597 menu_items = gtk_check_menu_item_new_with_label(
"Stop before pickup");
3598 gtk_check_menu_item_set_show_toggle(GTK_CHECK_MENU_ITEM(menu_items),
TRUE);
3599 gtk_menu_append(GTK_MENU(newpickupmenu), menu_items);
3600 gtk_signal_connect(GTK_OBJECT(menu_items),
"activate",
3602 gtk_widget_show(menu_items);
3604 pickup_value[pickup_count++] =
PU_STOP;
3606 menu_items = gtk_check_menu_item_new_with_label(
"Debug autopickup");
3607 gtk_check_menu_item_set_show_toggle(GTK_CHECK_MENU_ITEM(menu_items),
TRUE);
3608 gtk_menu_append(GTK_MENU(newpickupmenu), menu_items);
3609 gtk_signal_connect(GTK_OBJECT(menu_items),
"activate",
3611 gtk_widget_show(menu_items);
3613 pickup_value[pickup_count++] =
PU_DEBUG;
3617 ratiopickupmenu = gtk_menu_new();
3618 ratiopickup_menu_item = gtk_menu_item_new_with_label(
"Weight/Value Ratio");
3619 gtk_menu_append(GTK_MENU(newpickupmenu), ratiopickup_menu_item);
3620 gtk_widget_show(ratiopickup_menu_item);
3621 gtk_menu_item_set_submenu(GTK_MENU_ITEM(ratiopickup_menu_item), ratiopickupmenu);
3623 ratiopickupgroup=NULL;
3625 menu_items = gtk_tearoff_menu_item_new();
3626 gtk_menu_append(GTK_MENU(ratiopickupmenu), menu_items);
3627 gtk_widget_show(menu_items);
3631 if (i==0) sprintf(menustring,
"Ratio pickup OFF");
3632 else sprintf(menustring,
"Ratio >= %d",i*5);
3633 menu_items = gtk_radio_menu_item_new_with_label(ratiopickupgroup, menustring);
3634 ratiopickupgroup = gtk_radio_menu_item_group(GTK_RADIO_MENU_ITEM(menu_items));
3635 gtk_check_menu_item_set_show_toggle(GTK_CHECK_MENU_ITEM(menu_items),
TRUE);
3636 gtk_menu_append(GTK_MENU(ratiopickupmenu), menu_items);
3637 gtk_signal_connect(GTK_OBJECT(menu_items),
"activate",
3639 gtk_widget_show(menu_items);
3641 pickup_value[pickup_count++] = i;
3646 weaponpickupmenu = gtk_menu_new();
3647 weaponpickup_menu_item = gtk_menu_item_new_with_label(
"Weapons");
3648 gtk_menu_append(GTK_MENU(newpickupmenu), weaponpickup_menu_item);
3649 gtk_widget_show(weaponpickup_menu_item);
3650 gtk_menu_item_set_submenu(GTK_MENU_ITEM(weaponpickup_menu_item), weaponpickupmenu);
3652 menu_items = gtk_tearoff_menu_item_new();
3653 gtk_menu_append(GTK_MENU(weaponpickupmenu), menu_items);
3654 gtk_widget_show(menu_items);
3656 menu_items = gtk_check_menu_item_new_with_label(
"All weapons");
3657 gtk_check_menu_item_set_show_toggle(GTK_CHECK_MENU_ITEM(menu_items),
TRUE);
3658 gtk_menu_append(GTK_MENU(weaponpickupmenu), menu_items);
3659 gtk_signal_connect(GTK_OBJECT(menu_items),
"activate",
3661 gtk_widget_show(menu_items);
3665 menu_items = gtk_check_menu_item_new_with_label(
"Missile Weapons");
3666 gtk_check_menu_item_set_show_toggle(GTK_CHECK_MENU_ITEM(menu_items),
TRUE);
3667 gtk_menu_append(GTK_MENU(weaponpickupmenu), menu_items);
3668 gtk_signal_connect(GTK_OBJECT(menu_items),
"activate",
3670 gtk_widget_show(menu_items);
3674 menu_items = gtk_check_menu_item_new_with_label(
"Bows");
3675 gtk_check_menu_item_set_show_toggle(GTK_CHECK_MENU_ITEM(menu_items),
TRUE);
3676 gtk_menu_append(GTK_MENU(weaponpickupmenu), menu_items);
3677 gtk_signal_connect(GTK_OBJECT(menu_items),
"activate",
3679 gtk_widget_show(menu_items);
3681 pickup_value[pickup_count++] =
PU_BOW;
3683 menu_items = gtk_check_menu_item_new_with_label(
"Arrows");
3684 gtk_check_menu_item_set_show_toggle(GTK_CHECK_MENU_ITEM(menu_items),
TRUE);
3685 gtk_menu_append(GTK_MENU(weaponpickupmenu), menu_items);
3686 gtk_signal_connect(GTK_OBJECT(menu_items),
"activate",
3688 gtk_widget_show(menu_items);
3690 pickup_value[pickup_count++] =
PU_ARROW;
3694 armourpickupmenu = gtk_menu_new();
3695 armourpickup_menu_item = gtk_menu_item_new_with_label(
"Armour");
3696 gtk_menu_append(GTK_MENU(newpickupmenu), armourpickup_menu_item);
3697 gtk_widget_show(armourpickup_menu_item);
3698 gtk_menu_item_set_submenu(GTK_MENU_ITEM(armourpickup_menu_item), armourpickupmenu);
3700 menu_items = gtk_tearoff_menu_item_new();
3701 gtk_menu_append(GTK_MENU(armourpickupmenu), menu_items);
3702 gtk_widget_show(menu_items);
3704 menu_items = gtk_check_menu_item_new_with_label(
"Helmets");
3705 gtk_check_menu_item_set_show_toggle(GTK_CHECK_MENU_ITEM(menu_items),
TRUE);
3706 gtk_menu_append(GTK_MENU(armourpickupmenu), menu_items);
3707 gtk_signal_connect(GTK_OBJECT(menu_items),
"activate",
3709 gtk_widget_show(menu_items);
3711 pickup_value[pickup_count++] =
PU_HELMET;
3713 menu_items = gtk_check_menu_item_new_with_label(
"Shields");
3714 gtk_check_menu_item_set_show_toggle(GTK_CHECK_MENU_ITEM(menu_items),
TRUE);
3715 gtk_menu_append(GTK_MENU(armourpickupmenu), menu_items);
3716 gtk_signal_connect(GTK_OBJECT(menu_items),
"activate",
3718 gtk_widget_show(menu_items);
3720 pickup_value[pickup_count++] =
PU_SHIELD;
3722 menu_items = gtk_check_menu_item_new_with_label(
"Body Armour");
3723 gtk_check_menu_item_set_show_toggle(GTK_CHECK_MENU_ITEM(menu_items),
TRUE);
3724 gtk_menu_append(GTK_MENU(armourpickupmenu), menu_items);
3725 gtk_signal_connect(GTK_OBJECT(menu_items),
"activate",
3727 gtk_widget_show(menu_items);
3729 pickup_value[pickup_count++] =
PU_ARMOUR;
3731 menu_items = gtk_check_menu_item_new_with_label(
"Boots");
3732 gtk_check_menu_item_set_show_toggle(GTK_CHECK_MENU_ITEM(menu_items),
TRUE);
3733 gtk_menu_append(GTK_MENU(armourpickupmenu), menu_items);
3734 gtk_signal_connect(GTK_OBJECT(menu_items),
"activate",
3736 gtk_widget_show(menu_items);
3738 pickup_value[pickup_count++] =
PU_BOOTS;
3740 menu_items = gtk_check_menu_item_new_with_label(
"Gloves");
3741 gtk_check_menu_item_set_show_toggle(GTK_CHECK_MENU_ITEM(menu_items),
TRUE);
3742 gtk_menu_append(GTK_MENU(armourpickupmenu), menu_items);
3743 gtk_signal_connect(GTK_OBJECT(menu_items),
"activate",
3745 gtk_widget_show(menu_items);
3747 pickup_value[pickup_count++] =
PU_GLOVES;
3749 menu_items = gtk_check_menu_item_new_with_label(
"Cloaks");
3750 gtk_check_menu_item_set_show_toggle(GTK_CHECK_MENU_ITEM(menu_items),
TRUE);
3751 gtk_menu_append(GTK_MENU(armourpickupmenu), menu_items);
3752 gtk_signal_connect(GTK_OBJECT(menu_items),
"activate",
3754 gtk_widget_show(menu_items);
3756 pickup_value[pickup_count++] =
PU_CLOAK;
3760 bookspickupmenu = gtk_menu_new();
3761 bookspickup_menu_item = gtk_menu_item_new_with_label(
"Books");
3762 gtk_menu_append(GTK_MENU(newpickupmenu), bookspickup_menu_item);
3763 gtk_widget_show(bookspickup_menu_item);
3764 gtk_menu_item_set_submenu(GTK_MENU_ITEM(bookspickup_menu_item), bookspickupmenu);
3766 menu_items = gtk_tearoff_menu_item_new();
3767 gtk_menu_append(GTK_MENU(bookspickupmenu), menu_items);
3768 gtk_widget_show(menu_items);
3770 menu_items = gtk_check_menu_item_new_with_label(
"Spellbooks");
3771 gtk_check_menu_item_set_show_toggle(GTK_CHECK_MENU_ITEM(menu_items),
TRUE);
3772 gtk_menu_append(GTK_MENU(bookspickupmenu), menu_items);
3773 gtk_signal_connect(GTK_OBJECT(menu_items),
"activate",
3775 gtk_widget_show(menu_items);
3779 menu_items = gtk_check_menu_item_new_with_label(
"Skillscrolls");
3780 gtk_check_menu_item_set_show_toggle(GTK_CHECK_MENU_ITEM(menu_items),
TRUE);
3781 gtk_menu_append(GTK_MENU(bookspickupmenu), menu_items);
3782 gtk_signal_connect(GTK_OBJECT(menu_items),
"activate",
3784 gtk_widget_show(menu_items);
3788 menu_items = gtk_check_menu_item_new_with_label(
"Normal Books/Scrolls");
3789 gtk_check_menu_item_set_show_toggle(GTK_CHECK_MENU_ITEM(menu_items),
TRUE);
3790 gtk_menu_append(GTK_MENU(bookspickupmenu), menu_items);
3791 gtk_signal_connect(GTK_OBJECT(menu_items),
"activate",
3793 gtk_widget_show(menu_items);
3800 menu_items = gtk_check_menu_item_new_with_label(
"Food");
3801 gtk_check_menu_item_set_show_toggle(GTK_CHECK_MENU_ITEM(menu_items),
TRUE);
3802 gtk_menu_append(GTK_MENU(newpickupmenu), menu_items);
3803 gtk_signal_connect(GTK_OBJECT(menu_items),
"activate",
3805 gtk_widget_show(menu_items);
3807 pickup_value[pickup_count++] =
PU_FOOD;
3809 menu_items = gtk_check_menu_item_new_with_label(
"Drinks");
3810 gtk_check_menu_item_set_show_toggle(GTK_CHECK_MENU_ITEM(menu_items),
TRUE);
3811 gtk_menu_append(GTK_MENU(newpickupmenu), menu_items);
3812 gtk_signal_connect(GTK_OBJECT(menu_items),
"activate",
3814 gtk_widget_show(menu_items);
3816 pickup_value[pickup_count++] =
PU_DRINK;
3818 menu_items = gtk_check_menu_item_new_with_label(
"Flesh");
3819 gtk_check_menu_item_set_show_toggle(GTK_CHECK_MENU_ITEM(menu_items),
TRUE);
3820 gtk_menu_append(GTK_MENU(newpickupmenu), menu_items);
3821 gtk_signal_connect(GTK_OBJECT(menu_items),
"activate",
3823 gtk_widget_show(menu_items);
3825 pickup_value[pickup_count++] =
PU_FLESH;
3827 menu_items = gtk_check_menu_item_new_with_label(
"Valuables (Money, Gems)");
3828 gtk_check_menu_item_set_show_toggle(GTK_CHECK_MENU_ITEM(menu_items),
TRUE);
3829 gtk_menu_append(GTK_MENU(newpickupmenu), menu_items);
3830 gtk_signal_connect(GTK_OBJECT(menu_items),
"activate",
3832 gtk_widget_show(menu_items);
3836 menu_items = gtk_check_menu_item_new_with_label(
"Keys");
3837 gtk_check_menu_item_set_show_toggle(GTK_CHECK_MENU_ITEM(menu_items),
TRUE);
3838 gtk_menu_append(GTK_MENU(newpickupmenu), menu_items);
3839 gtk_signal_connect(GTK_OBJECT(menu_items),
"activate",
3841 gtk_widget_show(menu_items);
3843 pickup_value[pickup_count++] =
PU_KEY;
3845 menu_items = gtk_check_menu_item_new_with_label(
"Magical Items");
3846 gtk_check_menu_item_set_show_toggle(GTK_CHECK_MENU_ITEM(menu_items),
TRUE);
3847 gtk_menu_append(GTK_MENU(newpickupmenu), menu_items);
3848 gtk_signal_connect(GTK_OBJECT(menu_items),
"activate",
3850 gtk_widget_show(menu_items);
3854 menu_items = gtk_check_menu_item_new_with_label(
"Potions");
3855 gtk_check_menu_item_set_show_toggle(GTK_CHECK_MENU_ITEM(menu_items),
TRUE);
3856 gtk_menu_append(GTK_MENU(newpickupmenu), menu_items);
3857 gtk_signal_connect(GTK_OBJECT(menu_items),
"activate",
3859 gtk_widget_show(menu_items);
3861 pickup_value[pickup_count++] =
PU_POTION;
3863 menu_items = gtk_check_menu_item_new_with_label(
"Magic Devices");
3864 gtk_check_menu_item_set_show_toggle(GTK_CHECK_MENU_ITEM(menu_items),
TRUE);
3865 gtk_menu_append(GTK_MENU(newpickupmenu), menu_items);
3866 gtk_signal_connect(GTK_OBJECT(menu_items),
"activate",
3868 gtk_widget_show(menu_items);
3872 menu_items = gtk_check_menu_item_new_with_label(
"Ignore cursed");
3873 gtk_check_menu_item_set_show_toggle(GTK_CHECK_MENU_ITEM(menu_items),
TRUE);
3874 gtk_menu_append(GTK_MENU(newpickupmenu), menu_items);
3875 gtk_signal_connect(GTK_OBJECT(menu_items),
"activate",
3877 gtk_widget_show(menu_items);
3881 menu_items = gtk_check_menu_item_new_with_label(
"Jewelry");
3882 gtk_check_menu_item_set_show_toggle(GTK_CHECK_MENU_ITEM(menu_items),
TRUE);
3883 gtk_menu_append(GTK_MENU(newpickupmenu), menu_items);
3884 gtk_signal_connect(GTK_OBJECT(menu_items),
"activate",
3886 gtk_widget_show(menu_items);
3888 pickup_value[pickup_count++] =
PU_JEWELS;
3896 helpmenu = gtk_menu_new();
3898 menu_items = gtk_tearoff_menu_item_new ();
3899 gtk_menu_append (GTK_MENU (helpmenu), menu_items);
3900 gtk_widget_show (menu_items);
3902 menu_items = gtk_menu_item_new_with_label(
"Client commands");
3903 gtk_menu_append(GTK_MENU (helpmenu), menu_items);
3904 gtk_signal_connect_object(GTK_OBJECT(menu_items),
"activate",
3906 gtk_widget_show(menu_items);
3908 menu_items = gtk_menu_item_new_with_label(
"Server help");
3909 gtk_menu_append(GTK_MENU (helpmenu), menu_items);
3910 gtk_signal_connect_object(GTK_OBJECT(menu_items),
"activate",
3912 gtk_widget_show(menu_items);
3914 menu_items = gtk_menu_item_new ();
3915 gtk_menu_append(GTK_MENU (helpmenu), menu_items);
3916 gtk_widget_show(menu_items);
3920 menu_items = gtk_menu_item_new_with_label(
"Report a bug");
3921 gtk_menu_append(GTK_MENU (helpmenu), menu_items);
3922 gtk_signal_connect_object(GTK_OBJECT(menu_items),
"activate",
3924 gtk_widget_show(menu_items);
3926 menu_items = gtk_menu_item_new ();
3927 gtk_menu_append(GTK_MENU (helpmenu), menu_items);
3928 gtk_widget_show(menu_items);
3931 menu_items = gtk_menu_item_new_with_label(
"About");
3932 gtk_menu_append(GTK_MENU (helpmenu), menu_items);
3933 gtk_signal_connect_object(GTK_OBJECT(menu_items),
"activate",
3935 gtk_widget_show(menu_items);
3937 root_helpmenu = gtk_menu_item_new_with_label(
"Help");
3939 gtk_widget_show(root_helpmenu);
3940 gtk_menu_item_set_submenu(GTK_MENU_ITEM (root_helpmenu), helpmenu);
3945 menu_bar = gtk_menu_bar_new();
3946 gtk_box_pack_start(GTK_BOX(box), menu_bar,
FALSE,
FALSE, 2);
3947 gtk_widget_show(menu_bar);
3953 gtk_menu_bar_append(GTK_MENU_BAR (menu_bar), root_filemenu);
3954 gtk_menu_bar_append(GTK_MENU_BAR (menu_bar), root_clientmenu);
3955 gtk_menu_bar_append(GTK_MENU_BAR (menu_bar), root_actionmenu);
3956 gtk_menu_item_right_justify (GTK_MENU_ITEM(root_helpmenu));
3957 gtk_menu_bar_append(GTK_MENU_BAR (menu_bar), root_helpmenu);
3982 GtkWidget *aboutgtkpixmap;
3983 GdkPixmap *aboutgdkpixmap;
3984 GdkBitmap *aboutgdkmask;
3988 gtk_window_position (GTK_WINDOW (
gtkwin_splash), GTK_WIN_POS_CENTER);
3990 gtk_window_set_title (GTK_WINDOW (
gtkwin_splash),
"Welcome to Crossfire");
3993 gtk_container_border_width (GTK_CONTAINER (
gtkwin_splash), 0);
3994 vbox = gtk_vbox_new(
FALSE, 0);
3998 aboutgdkpixmap = gdk_pixmap_create_from_xpm_d(
gtkwin_splash->window,
4000 &style->bg[GTK_STATE_NORMAL],
4001 (gchar **)crossfiretitle_xpm);
4002 aboutgtkpixmap= gtk_pixmap_new (aboutgdkpixmap, aboutgdkmask);
4003 gtk_box_pack_start (GTK_BOX (vbox),aboutgtkpixmap,
FALSE,
TRUE, 0);
4004 gtk_widget_show (aboutgtkpixmap);
4006 gtk_widget_show (vbox);
4010 while ( gtk_events_pending() ) {
4011 gtk_main_iteration();
4014 while ( gtk_events_pending() ) {
4015 gtk_main_iteration();
4033 GtkWidget *rootvbox;
4046 gtkwin_root = gtk_window_new (GTK_WINDOW_TOPLEVEL);
4050 gcw = gdk_char_width(gdk_font_from_description(style->font_desc),
'0') + 4;
4051 gch = gdk_char_height(gdk_font_from_description(style->font_desc),
'0') + 2;
4053 gcw = gdk_char_width(style->font,
'0') + 4;
4054 gch = gdk_char_height(style->font,
'0') + 2;
4062 gtk_widget_set_events (
gtkwin_root, GDK_KEY_RELEASE_MASK);
4066 rootwin_width = gdk_screen_width() - 30;
4070 rootwin_height = gdk_screen_height() - 50;
4073 gtk_widget_set_usize (
gtkwin_root,rootwin_width,rootwin_height);
4074 gtk_window_set_title (GTK_WINDOW (
gtkwin_root),
"Crossfire GTK Client");
4077 gtk_container_border_width (GTK_CONTAINER (
gtkwin_root), 0);
4080 for (i=0; i<=12; i++ ) {
4082 printf (
"cparse failed (%s)\n",
colorname[i]);
4085 printf (
"calloc failed\n");
4090 rootvbox = gtk_vbox_new(
FALSE, 0);
4091 gtk_container_add (GTK_CONTAINER (
gtkwin_root), rootvbox);
4092 gtk_widget_show (rootvbox);
4101 gtk_container_border_width (GTK_CONTAINER(
inv_hpane), 5);
4111 frame = gtk_frame_new (NULL);
4112 gtk_frame_set_shadow_type (GTK_FRAME(frame), GTK_SHADOW_ETCHED_IN);
4113 gtk_widget_set_usize (frame, (25*gcw), (30*gch));
4117 gtk_widget_show (frame);
4142 gtk_frame_set_shadow_type (GTK_FRAME(
message_frame), GTK_SHADOW_ETCHED_IN);
4152 gtk_frame_set_shadow_type (GTK_FRAME(
gameframe), GTK_SHADOW_ETCHED_IN);
4166 gtk_frame_set_shadow_type (GTK_FRAME(
stat_frame), GTK_SHADOW_ETCHED_IN);
4183 frame = gtk_frame_new (NULL);
4184 gtk_frame_set_shadow_type (GTK_FRAME(frame), GTK_SHADOW_ETCHED_IN);
4185 gtk_widget_set_usize (frame, (24*gcw), (33*gch));
4190 gtk_widget_show (frame);
4193 frame = gtk_frame_new (NULL);
4194 gtk_frame_set_shadow_type (GTK_FRAME(frame), GTK_SHADOW_ETCHED_IN);
4195 gtk_widget_set_usize (frame, (24*gcw), (12*gch));
4200 gtk_widget_show (frame);
4211 gtk_signal_connect_object (GTK_OBJECT (
gtkwin_root),
"key_press_event",
4213 gtk_signal_connect_object (GTK_OBJECT (
gtkwin_root),
"key_release_event",
4227 gtkwin_root = gtk_window_new (GTK_WINDOW_TOPLEVEL);
4228 gtk_widget_set_events (
gtkwin_root, GDK_KEY_RELEASE_MASK);
4231 gtk_window_set_title (GTK_WINDOW (
gtkwin_root),
"Crossfire - view");
4236 gtk_container_border_width (GTK_CONTAINER (
gtkwin_root), 0);
4239 rootvbox = gtk_vbox_new(
FALSE, 0);
4240 gtk_container_add (GTK_CONTAINER (
gtkwin_root), rootvbox);
4242 gtk_widget_realize (rootvbox);
4248 gtk_widget_show (rootvbox);
4251 gtk_widget_draw (rootvbox,NULL);
4259 gtk_widget_set_events (
gtkwin_stats, GDK_KEY_RELEASE_MASK);
4262 gtk_window_set_title (GTK_WINDOW (
gtkwin_stats),
"Crossfire GTK Client");
4266 gtk_container_border_width (GTK_CONTAINER (
gtkwin_stats), 0);
4269 rootvbox = gtk_vbox_new(
FALSE, 0);
4270 gtk_container_add (GTK_CONTAINER (
gtkwin_stats), rootvbox);
4271 gtk_widget_show (rootvbox);
4281 gtkwin_info = gtk_window_new (GTK_WINDOW_TOPLEVEL);
4282 gtk_widget_set_events (
gtkwin_info, GDK_KEY_RELEASE_MASK);
4285 gtk_window_set_title (GTK_WINDOW (
gtkwin_info),
"Crossfire - info");
4289 gtk_container_border_width (GTK_CONTAINER (
gtkwin_info), 0);
4293 for (i=0; i<=12; i++ ) {
4295 printf (
"cparse failed (%s)\n",
colorname[i]);
4298 printf (
"calloc failed\n");
4302 rootvbox = gtk_vbox_new(
FALSE, 0);
4303 gtk_container_add (GTK_CONTAINER (
gtkwin_info), rootvbox);
4304 gtk_widget_show (rootvbox);
4317 gtk_window_set_title (GTK_WINDOW (
gtkwin_message),
"Crossfire - vitals");
4324 rootvbox = gtk_vbox_new(
FALSE, 0);
4326 gtk_widget_show (rootvbox);
4335 gtkwin_inv = gtk_window_new (GTK_WINDOW_TOPLEVEL);
4336 gtk_widget_set_events (
gtkwin_inv, GDK_KEY_RELEASE_MASK);
4339 gtk_window_set_title (GTK_WINDOW (
gtkwin_inv),
"Crossfire - inventory");
4343 gtk_container_border_width (GTK_CONTAINER (
gtkwin_inv), 0);
4346 rootvbox = gtk_vbox_new(
FALSE, 0);
4347 gtk_container_add (GTK_CONTAINER (
gtkwin_inv), rootvbox);
4348 gtk_widget_show (rootvbox);
4356 gtkwin_look = gtk_window_new (GTK_WINDOW_TOPLEVEL);
4357 gtk_widget_set_events (
gtkwin_look, GDK_KEY_RELEASE_MASK);
4360 gtk_window_set_title (GTK_WINDOW (
gtkwin_look),
"Crossfire - look");
4364 gtk_container_border_width (GTK_CONTAINER (
gtkwin_look), 0);
4367 rootvbox = gtk_vbox_new(
FALSE, 0);
4368 gtk_container_add (GTK_CONTAINER (
gtkwin_look), rootvbox);
4369 gtk_widget_show (rootvbox);
4378 gtk_signal_connect_object (GTK_OBJECT (
gtkwin_message),
"key_press_event",
4380 gtk_signal_connect_object (GTK_OBJECT (
gtkwin_message),
"key_release_event",
4383 gtk_signal_connect_object (GTK_OBJECT (
gtkwin_root),
"key_press_event",
4385 gtk_signal_connect_object (GTK_OBJECT (
gtkwin_root),
"key_release_event",
4388 gtk_signal_connect_object (GTK_OBJECT (
gtkwin_info),
"key_press_event",
4390 gtk_signal_connect_object (GTK_OBJECT (
gtkwin_info),
"key_release_event",
4393 gtk_signal_connect_object (GTK_OBJECT (
gtkwin_look),
"key_press_event",
4395 gtk_signal_connect_object (GTK_OBJECT (
gtkwin_look),
"key_release_event",
4398 gtk_signal_connect_object (GTK_OBJECT (
gtkwin_inv),
"key_press_event",
4400 gtk_signal_connect_object (GTK_OBJECT (
gtkwin_inv),
"key_release_event",
4403 gtk_signal_connect_object (GTK_OBJECT (
gtkwin_stats),
"key_press_event",
4405 gtk_signal_connect_object (GTK_OBJECT (
gtkwin_stats),
"key_release_event",
4417 gtk_tooltips_set_delay(
tooltips, 1000 );
4425 gtk_init (&gargc,&gargv);
4532 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(pickup_menus[menu]), (pickup & pickup_value[menu]) ? 1 : 0);
4581 static GtkWidget *magicgtkpixmap;
4584 static GdkBitmap *magicgdkmask;
4595 gtk_window_position (GTK_WINDOW (
gtkwin_magicmap), GTK_WIN_POS_CENTER);
4603 gtk_widget_set_usize (
mapvbox,264,300);
4616 gtk_widget_show (magicgtkpixmap);
4618 hbox = gtk_hbox_new(
FALSE, 2);
4620 closebutton = gtk_button_new_with_label (
"Close");
4621 gtk_signal_connect_object (GTK_OBJECT (closebutton),
"clicked",
4622 GTK_SIGNAL_FUNC(gtk_widget_destroy),
4624 gtk_box_pack_start (GTK_BOX (hbox), closebutton,
TRUE,
FALSE, 0);
4626 gtk_widget_show (closebutton);
4627 gtk_widget_show (hbox);
4633 gdk_color_parse(
"Black", &
map_color[0]);
4634 gdk_color_alloc (gtk_widget_get_colormap (magicgtkpixmap), &
map_color[0]);
4635 gdk_color_parse(
"White", &
map_color[1]);
4636 gdk_color_alloc (gtk_widget_get_colormap (magicgtkpixmap), &
map_color[1]);
4638 gdk_color_alloc (gtk_widget_get_colormap (magicgtkpixmap), &
map_color[2]);
4640 gdk_color_alloc (gtk_widget_get_colormap (magicgtkpixmap), &
map_color[3]);
4641 gdk_color_parse(
"Orange", &
map_color[4]);
4642 gdk_color_alloc (gtk_widget_get_colormap (magicgtkpixmap), &
map_color[4]);
4643 gdk_color_parse(
"DodgerBlue", &
map_color[5]);
4644 gdk_color_alloc (gtk_widget_get_colormap (magicgtkpixmap), &
map_color[5]);
4645 gdk_color_parse(
"DarkOrange2", &
map_color[6]);
4646 gdk_color_alloc (gtk_widget_get_colormap (magicgtkpixmap), &
map_color[6]);
4647 gdk_color_parse(
"SeaGreen", &
map_color[7]);
4648 gdk_color_alloc (gtk_widget_get_colormap (magicgtkpixmap), &
map_color[7]);
4649 gdk_color_parse(
"DarkSeaGreen", &
map_color[8]);
4650 gdk_color_alloc (gtk_widget_get_colormap (magicgtkpixmap), &
map_color[8]);
4651 gdk_color_parse(
"Grey50", &
map_color[9]);
4652 gdk_color_alloc (gtk_widget_get_colormap (magicgtkpixmap), &
map_color[9]);
4653 gdk_color_parse(
"Sienna", &
map_color[10]);
4654 gdk_color_alloc (gtk_widget_get_colormap (magicgtkpixmap), &
map_color[10]);
4655 gdk_color_parse(
"Gold", &
map_color[11]);
4656 gdk_color_alloc (gtk_widget_get_colormap (magicgtkpixmap), &
map_color[11]);
4657 gdk_color_parse(
"Khaki", &
map_color[12]);
4658 gdk_color_alloc (gtk_widget_get_colormap (magicgtkpixmap), &
map_color[12]);
4674 LOG(
LOG_WARNING,
"gtk::draw_magic_map",
"magic map resolution less than 1, map is %dx%d",
4707 gtk_widget_draw (
mapvbox,NULL);
4727 LOG(
LOG_WARNING,
"gtk::draw_magic_map",
"magic map resolution less than 1, map is %dx%d\n",
4760 gtk_widget_draw (
mapvbox,NULL);
4782 gtk_widget_draw (
mapvbox,NULL);
4795 gdk_window_get_geometry (win->window, x, y, w, h, &tmp);
4798 gdk_window_get_origin (win->window, wx, wy);
4811 sprintf(savename,
"%s/.crossfire/gwinpos", getenv(
"HOME"));
4813 sprintf(savename,
"%s/.crossfire/winpos", getenv(
"HOME"));
4815 if (!(fp=fopen(savename,
"w"))) {
4816 sprintf(buf,
"Unable to open %s, window positions not saved",savename);
4822 fprintf(fp,
"win_game: %d %d %d %d\n", wx,wy, w, h);
4825 fprintf(fp,
"win_stats: %d %d %d %d\n", wx,wy, w, h);
4827 fprintf(fp,
"win_info: %d %d %d %d\n", wx,wy, w, h);
4829 fprintf(fp,
"win_inv: %d %d %d %d\n", wx,wy, w, h);
4831 fprintf(fp,
"win_look: %d %d %d %d\n", wx,wy, w, h);
4833 fprintf(fp,
"win_message: %d %d %d %d\n", wx,wy, w, h);
4842 fprintf(fp,
"inv_hpane: %d\n",
4844 fprintf(fp,
"stat_info_hpane: %d\n",
4846 fprintf(fp,
"stat_game_vpane: %d\n",
4848 fprintf(fp,
"game_bar_vpane: %d\n",
4850 fprintf(fp,
"inv_look_vpane: %d\n",
4853 fprintf(fp,
"info_vpane: %d\n",
4857 sprintf(buf,
"Window positions saved to %s",savename);
4876 sprintf(buf,
"%s/.crossfire/winpos", getenv(
"HOME"));
4878 sprintf(buf,
"%s/.crossfire/gwinpos", getenv(
"HOME"));
4880 if (!(fp=fopen(buf,
"r")))
return;
4882 while(fgets(buf,
MAX_BUF-1, fp)!=NULL) {
4884 if (!(cp=strchr(buf,
' ')))
continue;
4886 if (sscanf(cp,
"%d %d %d %d",&wx,&wy,&w,&h)!=4) {
4887 gint pos = atoi(cp);
4888 if (pos == 0)
continue;
4890 if (!strcmp(buf,
"inv_hpane:")) gtk_paned_set_position(GTK_PANED(
inv_hpane),pos);
4891 else if (!strcmp(buf,
"stat_info_hpane:")) gtk_paned_set_position(GTK_PANED(
stat_info_hpane),pos);
4892 else if (!strcmp(buf,
"stat_game_vpane:")) gtk_paned_set_position(GTK_PANED(
stat_game_vpane),pos);
4893 else if (!strcmp(buf,
"game_bar_vpane:")) gtk_paned_set_position(GTK_PANED(
game_bar_vpane),pos);
4894 else if (!strcmp(buf,
"inv_look_vpane:")) gtk_paned_set_position(GTK_PANED(
inv_look_vpane),pos);
4896 else LOG(
LOG_ERROR,
"gtk::set_window_pos",
"Found bogus line in window position file:\n/%s/ /%s/", buf, cp);
4898 if (!strcmp(buf,
"win_game:")) {
4899 gdk_window_move_resize(
gtkwin_root->window, wx, wy, w, h);
4903 LOG(
LOG_ERROR,
"gtk::set_window_pos",
"Found bogus line in window position file:\n%s %s", buf, cp);
4906 if (!strcmp(buf,
"win_stats:")) {
4907 gdk_window_move_resize(
gtkwin_stats->window, wx, wy, w, h);
4909 if (!strcmp(buf,
"win_info:")) {
4910 gdk_window_move_resize(
gtkwin_info->window, wx, wy, w, h);
4912 if (!strcmp(buf,
"win_inv:")) {
4913 gdk_window_move_resize(
gtkwin_inv->window, wx, wy, w, h);
4915 if (!strcmp(buf,
"win_look:")) {
4916 gdk_window_move_resize(
gtkwin_look->window, wx, wy, w, h);
4918 if (!strcmp(buf,
"win_message:")) {
4944 puts(
"Usage of crossfire-client-gtk:\n\n");
4945 puts(
"-cache - Cache images for future use.");
4946 puts(
"-nocache - Do not cache images (default action).");
4947 puts(
"-darkness - Enables darkness code (default)");
4948 puts(
"-nodarkness - Disables darkness code");
4949 puts(
"-display <name> - Use <name> instead if DISPLAY environment variable.");
4950 puts(
"-download_all_faces - Download all needed faces before play starts");
4951 puts(
"-echo - Echo the bound commands");
4952 puts(
"-noecho - Do not echo the bound commands (default)");
4953 puts(
"-faceset <name> - Use faceset <name> if available");
4954 puts(
"-fasttcpsend - Send data immediately to server, may increase bandwidth");
4955 puts(
"-nofasttcpsend - Disables fasttcpsend");
4956 puts(
"-fog - Enable fog of war code");
4957 puts(
"-help - Display this message.");
4958 puts(
"-loglevel <val> - Set default logging level (0 is most verbose)");
4959 puts(
"-iconscale %% - Set icon scale percentage");
4960 puts(
"-mapscale %% - Set map scale percentage");
4961 puts(
"-mapsize xXy - Set the mapsize to be X by Y spaces. (default 11x11)");
4962 puts(
"-splash - Display the splash screen (default)");
4963 puts(
"-nosplash - Don't display the splash screen (startup logo)");
4964 puts(
"-popups - Use pop up windows for input (default)");
4965 puts(
"-nopopups - Don't use pop up windows for input");
4966 puts(
"-port <number> - Use port <number> instead of the standard port number");
4967 puts(
"-sdl - Use sdl for drawing png (may not work on all hardware");
4968 puts(
"-server <name> - Connect to <name> instead of localhost.");
4969 puts(
"-showicon - Print status icons in inventory window");
4970 puts(
"-smooth - Enable smooth");
4971 puts(
"-nosmooth - Disable smooth");
4972 puts(
"-mapscroll - Enable mapscrolling by bitmap operations");
4973 puts(
"-nomapscroll - Disable mapscrolling by bitmap operations");
4974 puts(
"-sound - Enable sound output (default).");
4975 puts(
"-nosound - Disable sound output.");
4976 puts(
"-sound_server <path> - Executable to use to play sounds.");
4977 puts(
"-resists <val> - Control look of resistances.");
4978 puts(
"-split - Use split windows.");
4979 puts(
"-splitinfo - Use two information windows, segregated by information type.");
4980 puts(
"-timemapredraw - Print out timing information for map generation");
4981 puts(
"-triminfowindow - Trims size of information window(s)");
4982 puts(
"-notriminfowindow - Do not trims size of information window(s) (default)");
4983 puts(
"-updatekeycodes - Update the saved bindings for this keyboard.");
5000 char *display_name=
"";
5012 for (on_arg=1; on_arg<argc; on_arg++) {
5013 if (!strcmp(argv[on_arg],
"-cache")) {
5017 else if (!strcmp(argv[on_arg],
"-nocache")) {
5021 else if (!strcmp(argv[on_arg],
"-darkness")) {
5025 else if (!strcmp(argv[on_arg],
"-nodarkness")) {
5029 else if (!strcmp(argv[on_arg],
"-display")) {
5030 if (++on_arg == argc) {
5031 LOG(
LOG_WARNING,
"gtk::init_windows",
"-display requires a display name");
5034 display_name = argv[on_arg];
5037 else if (!strcmp(argv[on_arg],
"-download_all_faces")) {
5041 else if (!strcmp(argv[on_arg],
"-echo")) {
5045 else if (!strcmp(argv[on_arg],
"-noecho")) {
5049 else if (!strcmp(argv[on_arg],
"-faceset")) {
5050 if (++on_arg == argc) {
5051 LOG(
LOG_WARNING,
"gtk::init_windows",
"-faceset requires a faceset name/number");
5057 else if( !strcmp( argv[on_arg],
"-fog")) {
5061 else if( !strcmp( argv[on_arg],
"-nofog")) {
5065 else if (!strcmp(argv[on_arg],
"-help")) {
5069 else if( !strcmp( argv[on_arg],
"-iconscale")) {
5070 if (++on_arg == argc) {
5071 LOG(
LOG_WARNING,
"gtk::init_windows",
"-iconscale requires a percentage value");
5076 LOG(
LOG_WARNING,
"gtk::init_windows",
"Valid range for -iconscale is 25 through 200");
5082 else if( !strcmp( argv[on_arg],
"-mapscale")) {
5083 if (++on_arg == argc) {
5084 LOG(
LOG_WARNING,
"gtk::init_windows",
"-mapscale requires a percentage value");
5089 LOG(
LOG_WARNING,
"gtk::init_windows",
"Valid range for -mapscale is 25 through 200");
5095 else if (!strcmp(argv[on_arg],
"-mapsize")) {
5097 if (++on_arg == argc) {
5098 LOG(
LOG_WARNING,
"gtk::init_windows",
"-mapsize requires a XxY value");
5101 x = atoi(argv[on_arg]);
5102 for (cp = argv[on_arg]; *cp!=
'\0'; cp++)
5103 if (*cp ==
'x' || *cp ==
'X')
break;
5106 LOG(
LOG_WARNING,
"gtk::init_windows",
"-mapsize requires both and X and Y value (ie, XxY - note the\nx in between.");
5111 LOG(
LOG_WARNING,
"gtk::init_windows",
"map size must be positive values of at least 9");
5121 else if (!strcmp(argv[on_arg],
"-fasttcpsend")) {
5125 else if (!strcmp(argv[on_arg],
"-nofasttcpsend")) {
5129 else if (!strcmp(argv[on_arg],
"-popups")) {
5133 else if (!strcmp(argv[on_arg],
"-nopopups")) {
5137 else if (!strcmp(argv[on_arg],
"-port")) {
5138 if (++on_arg == argc) {
5139 LOG(
LOG_WARNING,
"gtk::init_windows",
"-port requires a port number");
5145 else if (!strcmp(argv[on_arg],
"-sdl")) {
5147 LOG(
LOG_WARNING,
"gtk::init_windows",
"client not compiled with sdl support. Ignoring -sdl");
5153 else if (!strcmp(argv[on_arg],
"+sdl")) {
5157 else if (!strcmp(argv[on_arg],
"-server")) {
5158 if (++on_arg == argc) {
5159 LOG(
LOG_WARNING,
"gtk::init_windows",
"-server requires a host name");
5165 else if (!strcmp(argv[on_arg],
"-showicon")) {
5169 else if (!strcmp(argv[on_arg],
"-smooth")) {
5172 else if (!strcmp(argv[on_arg],
"-nosmooth")) {
5175 else if (!strcmp(argv[on_arg],
"-mapscroll")) {
5178 else if (!strcmp(argv[on_arg],
"-nomapscroll")) {
5181 else if (!strcmp(argv[on_arg],
"-sound")) {
5185 else if (!strcmp(argv[on_arg],
"-nosound")) {
5189 else if (!strcmp(argv[on_arg],
"-sound_server")) {
5190 if (++on_arg == argc) {
5191 LOG(
LOG_WARNING,
"gtk::init_windows",
"-sound_server requires an executable pathname");
5197 else if (!strcmp(argv[on_arg],
"-split")) {
5201 else if (!strcmp(argv[on_arg],
"-nosplit")) {
5205 else if (!strcmp(argv[on_arg],
"-resists")) {
5206 if (++on_arg == argc) {
5207 LOG(
LOG_WARNING,
"gtk::init_windows",
"-resists requires a value");
5213 else if (!strcmp(argv[on_arg],
"-loglevel")) {
5216 if (++on_arg == argc) {
5217 LOG(
LOG_WARNING,
"gtk::init_windows",
"-loglevel requires a value");
5220 MINLOG = atoi(argv[on_arg]);
5223 else if (!strcmp(argv[on_arg],
"-splitinfo")) {
5227 else if (!strcmp(argv[on_arg],
"-timemapredraw")) {
5231 else if (!strcmp(argv[on_arg],
"-triminfowindow")) {
5235 else if (!strcmp(argv[on_arg],
"-notriminfowindow")) {
5239 else if (!strcmp(argv[on_arg],
"-updatekeycodes")) {
5243 else if (!strcmp(argv[on_arg],
"-splash")) {
5247 else if (!strcmp(argv[on_arg],
"-nosplash")) {
5252 LOG(
LOG_WARNING,
"gtk::init_windows",
"Do not understand option %s", argv[on_arg]);
5341 newpane = gtk_vpaned_new();
5362 gtk_paned_add1(GTK_PANED(newpane),
gameframe);
5367 gtk_widget_show(newpane);
5372 }
else if (!
bigmap && x>=15) {
5376 newpane = gtk_hpaned_new();
5389 gtk_paned_add1(GTK_PANED(newpane),
stat_frame);
5409 gtk_widget_show(newpane);
5449 #define MAX_LOG_CHARACTERS 10000
5452 gtk_text_freeze (GTK_TEXT (
bugtrack));
5454 printf (
"current gtk len: %d\n",gtk_text_get_length(GTK_TEXT (
bugtrack)));
5458 printf(
"Deleteing..%d\n",toomuch);
5459 gtk_text_set_point(GTK_TEXT (
bugtrack),toomuch);
5460 gtk_text_backward_delete(GTK_TEXT (
bugtrack),toomuch);
5461 gtk_text_set_point(GTK_TEXT (
bugtrack),gtk_text_get_length(GTK_TEXT (
bugtrack)));
5464 gtk_text_thaw (GTK_TEXT (
bugtrack));
5467 #define MAX_RECURSE 50
5471 void gLogHandler (
const gchar *log_domain, GLogLevelFlags log_level,
const gchar *message, gpointer user_data){
5472 static char LogOrigin[4096];
5473 static int recurse = 0;
5475 gboolean in_recursion;
5482 LOG(
LOG_ERROR,
"gtk::gLogHandler",
"Too many recurse, reached limit: %d",recurse);
5487 strcat (LogOrigin,
"Library::");
5488 in_recursion = (log_level & G_LOG_FLAG_RECURSION) != 0;
5489 is_fatal = (log_level & G_LOG_FLAG_FATAL) != 0;
5490 log_level &= G_LOG_LEVEL_MASK;
5493 message =
"gLogHandler: (NULL) message";
5495 strcat(LogOrigin,log_domain);
5496 strcat(LogOrigin,
"-");
5498 strcat(LogOrigin,
"** ");
5503 case G_LOG_LEVEL_ERROR:
5504 strcat (LogOrigin,
"ERROR");
5507 case G_LOG_LEVEL_CRITICAL:
5508 strcat (LogOrigin,
"CRITICAL");
5511 case G_LOG_LEVEL_WARNING:
5512 strcat (LogOrigin,
"WARNING");
5515 case G_LOG_LEVEL_MESSAGE:
5516 strcat (LogOrigin,
"Message");
5519 case G_LOG_LEVEL_INFO:
5520 strcat (LogOrigin,
"Info");
5523 case G_LOG_LEVEL_DEBUG:
5524 strcat (LogOrigin,
"DEBUG");
5528 strcat (LogOrigin,
"LOG");
5533 strcat(LogOrigin,
" (recursed)");
5537 LOG(level,LogOrigin,
"%s",message);
5539 LOG(level,LogOrigin,
"Last Message was fatal, aborting...");
5549 static char file_cache[
MAX_BUF ];
5551 g_log_set_handler (NULL,G_LOG_FLAG_RECURSION|G_LOG_FLAG_FATAL|G_LOG_LEVEL_ERROR|
5552 G_LOG_LEVEL_CRITICAL|G_LOG_LEVEL_WARNING |G_LOG_LEVEL_MESSAGE|G_LOG_LEVEL_INFO|
5554 g_log_set_handler (
"Gtk",G_LOG_FLAG_RECURSION|G_LOG_FLAG_FATAL|G_LOG_LEVEL_ERROR|
5555 G_LOG_LEVEL_CRITICAL|G_LOG_LEVEL_WARNING |G_LOG_LEVEL_MESSAGE|G_LOG_LEVEL_INFO|
5556 G_LOG_LEVEL_DEBUG,(GLogFunc)gLogHandler,NULL);
5557 g_log_set_handler (
"Gdk",G_LOG_FLAG_RECURSION|G_LOG_FLAG_FATAL|G_LOG_LEVEL_ERROR|
5558 G_LOG_LEVEL_CRITICAL|G_LOG_LEVEL_WARNING |G_LOG_LEVEL_MESSAGE|G_LOG_LEVEL_INFO|
5559 G_LOG_LEVEL_DEBUG,(GLogFunc)gLogHandler,NULL);
5575 snprintf( file_cache,
MAX_BUF,
"%s/.crossfire/servers.cache", getenv(
"HOME" ) );
5576 cached_server_file = file_cache;
5598 WORD Version = 0x0202;
5600 if (WSAStartup( Version, &wsaData ) != 0) {
5607 maxfd = sysconf(_SC_OPEN_MAX);
5609 maxfd = getdtablesize();
5633 if (!
server || got_one) {
static gboolean info_text_button_press_event(GtkWidget *widget, GdkEventButton *event, gpointer user_data)
void negotiate_connection(int sound)
static char history[MAX_HISTORY][MAX_COMMAND_LEN]
static GtkWidget * gtkwin_shelp
static GtkWidget * stat_info_hpane
static int get_info_display(GtkWidget *frame)
static GdkColor map_color[16]
static XFontStruct * font
static void menu_disarm(void)
static void usage(const char *progname)
news_entry * get_news(void)
void init_SDL(GtkWidget *sdl_window, int just_lightmap)
struct FaceCache facecache[MAXPIXMAPNUM]
static void shelpdialog(GtkWidget *widget)
int can_write_spell_on(item *it)
void move_player(int dir)
static GtkWidget * info_vpane
#define DEFAULT_IMAGE_SIZE
void mapdata_animation(void)
static GtkWidget * bugtrack
static GtkObject * text_vadj2
void init_client_vars(void)
static GdkGC * magic_map_gc
static GtkWidget * loginMessage
static void menu_apply(void)
static void init_cache_data(void)
static void create_stat_bar(GtkWidget *mtable, gint row, const gchar *label, gint bar, GtkWidget **plabel)
void configdialog(GtkWidget *widget)
static GtkWidget * inv_hpane
void draw_info_windows(void)
void gtkLogListener(LogEntry *le)
int init_windows(int argc, char **argv)
static void menu_pickup5(void)
static void cancelConnection(GtkButton *button, gpointer func_data)
void keyfunc(GtkWidget *widget, GdkEventKey *event, GtkWidget *window)
static int info2_num_chars
static void sendPassword(void)
void display_map_doneupdate(int redraw, int notice)
struct item_struct * next
static gboolean draw_info_freeze1
static GtkWidget * rulesText
static GtkObject * text_vadj
static void new_menu_pickup(GtkWidget *button, int val)
Face_Information face_info
static void create_splash(void)
sint16 want_config[CONFIG_NUMS]
GtkWidget * ckeyentrytext
void inventory_tick(void)
void gtk_draw_map(int redraw)
const char *const resists_name[NUM_RESISTS]
static void buildLoginDialog(void)
sint64 skill_exp[MAX_SKILL]
static void bugdialog(GtkWidget *widget)
int setLogListener(LogListener li)
static GtkWidget * resists[NUM_RESISTS]
void set_scroll(const char *s)
static void confirmUserPass(GtkButton *button, gpointer func_data)
static GtkWidget * gtkwin_splash
char * skill_names[MAX_SKILL]
static void do_network(void)
static void select_spell_event(GtkWidget *gtklist, gint row, gint column, GdkEventButton *event)
void client_tick(uint32 tick)
PixmapInfo * pixmaps[MAXPIXMAPNUM]
static void setUserPass(GtkButton *button, gpointer func_data)
static GtkWidget * gtkwin_magicmap
static GtkWidget * spelloptions
static GtkWidget * dialogtext
static void event_loop(void)
static void click_inscribe_spell(void)
char * get_metaserver(void)
static StatWindow statwindow
static void menu_pickup7(void)
GtkWidget * gtkwin_info_text
int init_connection(char *host, int port)
void draw_stats(int redraw)
static int info1_num_chars
void LOG(LogLevel level, const char *origin, const char *format,...)
static int pickup_value[43]
void reset_client_vars(void)
static void draw_stat_bar(int bar_pos, float bar, int is_alert)
static GtkWidget * newsText
static void menu_pickup0(void)
void gtk_command_history(int direction)
void draw_prompt(const char *str)
static unsigned int pmode
void reset_image_data(void)
void draw_color_info(int colr, const char *buf)
void look_at(int x, int y)
static void fill_news(GtkWidget *o, news_entry *news)
static void menu_pickup10(void)
int gtk_checkchilds(void)
static void menu_search(void)
static void menu_who(void)
static GtkWidget * loginTabs
static GtkObject * text_hadj2
void client_pickup(uint32 pickup)
static GtkWidget * loginWindow
static void menu_pickup1(void)
const char * getMOTD(void)
static void confirmPassword(void)
int send_command(const char *command, int repeat, int must_send)
sint16 use_config[CONFIG_NUMS]
char * getLogText(const LogEntry *le)
static GtkWidget * gtkwin_about
static GtkWidget * motdText
static void menu_spells(void)
#define CONFIG_GRAD_COLOR
static void enter_callback(GtkWidget *widget, GtkWidget *entry)
static void disable_ok_if_empty(gpointer button, GtkEditable *entry)
static GtkWidget * dialog_window
static GtkWidget * stat_game_vpane
static GtkWidget * skill_scrolled_window
void inscribe_magical_scroll(item *scroll, Spell *spell)
void reset_stat_bars(void)
void draw_info(const char *str, int color)
static GtkWidget * gtkwin_spell
void cclist_button_event(GtkWidget *gtklist, gint row, gint column, GdkEventButton *event)
void set_look_list_env(item *op)
GtkWidget * cnumentrytext
static int scroll_history_position
void extended_command(const char *ocommand)
void create_windows(void)
void chelpdialog(GtkWidget *widget)
void send_reply(const char *text)
static void destroy_splash(void)
static GtkWidget * description
int main(int argc, char *argv[])
static void menu_pickup6(void)
void display_map_newmap(void)
static const char *const colorname[]
static void activate_ok_if_not_empty(GtkWidget *button, GtkEditable *entry)
const char * complete_command(const char *command)
struct Spell_struct * next
static int cur_history_position
static void createBugTracker(void)
void main_window_destroyed(void)
static void menu_pickup3(void)
GtkWidget * gtkwin_message
static unsigned int pickup_mode
static int info1_max_chars
static int get_stats_display(GtkWidget *frame)
void gLogHandler(const gchar *log_domain, GLogLevelFlags log_level, const gchar *message, gpointer user_data)
void get_window_coord(GtkWidget *win, int *x, int *y, int *wx, int *wy, int *w, int *h)
static gint dialog_delete_event_callback(GtkWidget *widget, GdkEvent *event, gpointer data)
void draw_message_window(int redraw)
void get_inv_display(GtkWidget *frame)
GtkWidget * spellinventory
static int get_root_display(char *display_name, int gargc, char **gargv)
static void change_focus(GtkWidget *focusTo, GtkEditable *entry)
static void aboutdialog(GtkWidget *widget)
static void dialog_callback(GtkWidget *dialog)
static void update_spell_list(int force)
void cleanup_connection(void)
GtkWidget * skill_exp[MAX_SKILL *2]
static int info2_max_chars
void script_fdset(int *maxfd, fd_set *set)
void remove_item_inventory(item *op)
void resize_map_window(int x, int y)
void draw_magic_map(void)
static GtkWidget * restable
void set_window_pos(void)
void magic_map_flash_pos(void)
void get_look_display(GtkWidget *frame)
static GtkWidget * pickup_menus[43]
void display_map_startupdate(void)
static GtkWidget * passwordText2
void set_autorepeat(const char *s)
static GtkWidget * res_scrolled_window
static GtkWidget * mapvbox
void init_common_cache_data(void)
const char *const rcsid_gtk_gx11_c
void DoClient(ClientSocket *csocket)
guint signalLoginDialogClicked
const char * cached_server_file
#define CONFIG_DISPLAYMODE
static GtkWidget * loginButtonOk
static gint expose_event(GtkWidget *widget, GdkEventExpose *event)
void resize_resistance_table(int resists_show)
media_state write_media(GtkText *textarea, const char *message)
static GtkWidget * passwordText
static GtkObject * text_hadj
static void button_map_event(GtkWidget *widget, GdkEventButton *event)
void gtk_complete_command(void)
static GdkPixmap * magicgdkpixmap
sint16 skill_level[MAX_SKILL]
GtkWidget * cmodentrytext
static GtkWidget * gtkwin_bug
static void logUserIn(void)
void cleanup_textmanagers(void)
static void menu_pickup2(void)
static int get_menu_display(GtkWidget *box)
static GtkWidget * message_frame
void init_text_callbacks(void)
void script_process(fd_set *set)
media_state write_media_with_state(GtkText *textarea, const char *message, media_state current_state)
static GtkWidget * inv_look_vpane
void disconnect(GtkWidget *widget)
static int get_game_display(GtkWidget *frame)
void itemlist_set_show_icon(itemlist *l, int new_setting)
static GtkWidget * stat_frame
void sdl_gen_map(int redraw)
static GtkWidget * userText
static GtkWidget * gameframe
static void menu_cast(void)
#define MAX_LOG_CHARACTERS
static GtkWidget * loginButtonCancel
static GtkWidget * game_bar_vpane
GtkWidget * gtkwin_info_text2
void keyrelfunc(GtkWidget *widget, GdkEventKey *event, GtkWidget *window)
static gint configure_event(GtkWidget *widget, GdkEventConfigure *event)
static void menu_pickup4(void)
static void spellinventory_redraw(GtkWidget *list, GdkEventVisibility *event, gpointer view_x)
static gboolean draw_info_freeze2
static int get_message_display(GtkWidget *frame)
const char * get_rules(void)
static void sendstr(char *sendstr)