1 /* NetHack 3.6 mhstatus.h $NHDT-Date: 1432512812 2015/05/25 00:13:32 $ $NHDT-Branch: master $:$NHDT-Revision: 1.10 $ */ 2 /* Copyright (C) 2001 by Alex Kompel */ 3 /* NetHack may be freely redistributed. See license for details. */ 4 5 #ifndef MSWINStatusWindow_h 6 #define MSWINStatusWindow_h 7 8 #include "winMS.h" 9 #include "config.h" 10 #include "global.h" 11 12 #define NHSW_LINES 2 13 14 static const int fieldorder1[] = { BL_TITLE, BL_STR, BL_DX, BL_CO, BL_IN, 15 BL_WI, BL_CH, BL_ALIGN, BL_SCORE, -1 }; 16 static const int fieldorder2[] = { BL_LEVELDESC, BL_GOLD, BL_HP, BL_HPMAX, 17 BL_ENE, BL_ENEMAX, BL_AC, BL_XP, 18 BL_EXP, BL_HD, BL_TIME, BL_HUNGER, 19 BL_CAP, BL_CONDITION, -1 }; 20 static const int *fieldorders[] = { fieldorder1, fieldorder2, NULL }; 21 static const int fieldcounts[NHSW_LINES] = { SIZE(fieldorder1) - 1, SIZE(fieldorder2) - 1}; 22 23 #define MSWIN_MAX_LINE1_STRINGS (SIZE(fieldorder1) - 1) 24 #define MSWIN_MAX_LINE2_STRINGS (SIZE(fieldorder2) - 1 + BL_MASK_BITS) 25 #define MSWIN_MAX_LINE_STRINGS (MSWIN_MAX_LINE1_STRINGS > MSWIN_MAX_LINE2_STRINGS ? \ 26 MSWIN_MAX_LINE1_STRINGS : MSWIN_MAX_LINE2_STRINGS) 27 28 #define MSWIN_LINE1_FIELDS (SIZE(fieldorder1) - 1) 29 #define MSWIN_LINE2_FIELDS (SIZE(fieldorder2) - 1) 30 #define MSWIN_MAX_LINE_FIELDS (MSWIN_LINE1_FIELDS > MSWIN_LINE2_FIELDS ? \ 31 MSWIN_LINE1_FIELDS : MSWIN_LINE2_FIELDS) 32 33 /* when status hilites are enabled, we use an array of mswin_status_strings 34 * to represent what needs to be rendered. */ 35 typedef struct mswin_status_string { 36 const char * str; /* ascii string to be displayed */ 37 boolean space_in_front; /* render with a space in front of string */ 38 int color; /* string text color index */ 39 int attribute; /* string text attributes */ 40 boolean draw_bar; /* draw a percentage bar */ 41 int bar_percent; /* a percentage to indicate */ 42 int bar_color; /* color index of percentage bar */ 43 int bar_attribute; /* attributes of percentage bar */ 44 } mswin_status_string; 45 46 typedef struct mswin_status_strings 47 { 48 int count; 49 mswin_status_string * status_strings[MSWIN_MAX_LINE_STRINGS]; 50 } mswin_status_strings; 51 52 typedef struct mswin_status_field { 53 int field_index; // field index 54 boolean enabled; // whether the field is enabled 55 const char * name; // name of status field 56 const char * format; // format of field 57 boolean space_in_front; // add a space in front of the field 58 59 int percent; 60 int color; 61 int attribute; 62 char string[BUFSZ]; 63 64 } mswin_status_field; 65 66 typedef struct mswin_condition_field { 67 int mask; 68 const char * name; 69 int bit_position; 70 } mswin_condition_field; 71 72 typedef struct mswin_status_fields { 73 int count; 74 mswin_status_field * status_fields[MSWIN_MAX_LINE_FIELDS]; 75 } mswin_status_fields; 76 77 typedef struct mswin_status_line { 78 mswin_status_strings status_strings; 79 mswin_status_fields status_fields; 80 } mswin_status_line; 81 82 typedef struct mswin_status_lines { 83 mswin_status_line lines[NHSW_LINES]; /* number of strings to be rendered on each line */ 84 } mswin_status_lines; 85 86 HWND mswin_init_status_window(void); 87 void mswin_status_window_size(HWND hWnd, LPSIZE sz); 88 89 #endif /* MSWINStatusWindow_h */ 90