1 struct maingame { 2 int ignorestuff; 3 }; 4 5 struct line { 6 int start; 7 int len; 8 int width; 9 }; 10 11 struct rect { 12 int x, y, w, h; 13 }; 14 15 struct scroll_interface { 16 struct player *py; 17 int x, y, h; 18 int top; 19 int visible; 20 int nlines; 21 int lineheight; 22 int grip; 23 int moved; 24 void (*redraw)(); 25 }; 26 27 #define MAXQUESTIONLENGTH (256) 28 #define MAXANSWERLENGTH (64) 29 30 struct target_list { 31 int num; 32 char **tnames; 33 int *tnums; 34 int size; 35 }; 36 37 struct answer { 38 struct query *query; /* NULL for just a message */ 39 int answer; 40 int done; 41 char qu_str[MAXQUESTIONLENGTH]; 42 char ans_str[MAXANSWERLENGTH]; 43 long rock; 44 }; 45 46 struct statthing { 47 int index, type; 48 int hp; 49 long stuff; 50 }; 51 52 struct player { 53 Display *dpy; 54 int scn; 55 Window win; 56 Pixmap backpm; 57 GC blackgc, whitegc; 58 XFontStruct *font; 59 Pixmap gesturebm[2][10]; 60 Pixmap spelllistbm[2][7]; 61 62 int backstore; 63 struct rect backrec; 64 int gotexpose; /* matters during backing store periods */ 65 int cursx; /* pixels, lines */ 66 int textx, texty; 67 int lineheight; 68 struct scroll_interface sitext, siquery, sistats; 69 struct scroll_interface *scroll_active; 70 71 int ascent, totalheight; 72 73 struct line *lineindex; 74 int lineindex_size; 75 int linesnum; /* number of complete lines actually in buffer */ 76 char *linebuf; /* null-terminated lines. The last one (pointed to by 77 lineindex[linesnum].start) is incomplete (or empty), 78 but still null-term. */ 79 int linebuf_size; 80 int addpoint; /* points to '\0' at end of incomplete line */ 81 82 int mousestate, mousebutton; 83 int button_lit; 84 int turn_active, turn_done; 85 int turn_blinklimit, turn_blinked; 86 int gesture_chosen[2]; 87 88 struct rect gesture_rect; 89 int gesture_hand, gesture_sel; 90 struct rect spelllist_rect; 91 int spelllist_way; 92 int query_hgt; 93 int query_hit; 94 int query_sel; 95 struct target_list *query_tl; 96 struct rect query_rect; 97 struct target_list TLRightHand, TLLeftHand; 98 struct answer *answers; 99 int answers_size; 100 struct statthing *statlist; 101 int statlist_size; 102 char *talk_buf; 103 int talk_size; 104 int talk_pt, talk_xlast, talk_x, talk_toobig; 105 }; 106 107 extern int win_wid, win_hgt; 108 109 #define SCROLL_W (16) 110 #define GEST_SIZE (48) 111 #define GEST_SMALL (16) 112 #define FRAME_SHADOW (3) 113 114 /* values for py->mousestate */ 115 #define ms_None (0) 116 #define ms_Gesture (1) 117 #define ms_DoneBtn (2) 118 #define ms_SpellBtn (3) 119 #define ms_Scroll (4) 120 #define ms_Query (5) 121 #define ms_Talk (6) 122 123 #define EVENTMASK (ButtonPressMask | ButtonReleaseMask | ButtonMotionMask | \ 124 KeyPressMask | ExposureMask) 125 126 extern int numplayers; 127 extern struct player *players; 128 extern game *gameval; 129 130 #define State_Init (0) 131 #define State_Top (1) 132 #define State_EQueries (2) /* Queries before gestures are revealed */ 133 #define State_Queries (3) 134 #define State_End (4) 135 136 #define Qu_SaveTranscript (-50) 137 138 extern int turnstate; 139 extern int movelist[]; 140 extern int blinklevel; 141