1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202
|
/* Copyright (C) 2001 by Alex Kompel <shurikk@pacbell.net> */
/* NetHack may be freely redistributed. See license for details. */
#ifndef WINMS_H
#define WINMS_H
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <commctrl.h>
#include <tchar.h>
#include "hack.h"
/* Create an array to keep track of the various windows */
#ifndef MAXWINDOWS
#define MAXWINDOWS 15
#endif
#define NHW_RIP 32
#ifndef TILE_X
#define TILE_X 16
#endif
#define TILE_Y 16
#define TILES_PER_LINE 40
/* tile background color */
#define TILE_BK_COLOR RGB(71, 108, 108)
/* minimum/maximum font size (in points - 1/72 inch) */
#define NHFONT_DEFAULT_SIZE 9
#define NHFONT_SIZE_MIN 3
#define NHFONT_SIZE_MAX 20
#define MAX_LOADSTRING 100
typedef struct mswin_nhwindow_data {
HWND win;
int type;
int dead;
} MSNHWinData, *PMSNHWinData;
typedef struct mswin_nhwindow_app {
HINSTANCE hApp;
HWND hMainWnd;
HACCEL hAccelTable;
HWND hPopupWnd; /* current popup window */
MSNHWinData windowlist[MAXWINDOWS];
HBITMAP bmpTiles;
HBITMAP bmpPetMark;
HBITMAP bmpMapTiles; /* custom tiles bitmap */
HBITMAP bmpRip;
HBITMAP bmpSplash;
int mapTile_X; /* tile width */
int mapTile_Y; /* tile height */
int mapTilesPerLine; /* number of tile per row in the bitmap */
boolean bNoHScroll; /* disable cliparound for horizontal grid (map) */
boolean bNoVScroll; /* disable cliparound for vertical grid (map) */
int mapDisplayModeSave; /* saved map display mode */
char* saved_text;
DWORD saveRegistrySettings; /* Flag if we should save this time */
DWORD regNetHackMode; /* NetHack mode means no Windows keys in some places */
LONG regMainMinX;
LONG regMainMinY;
LONG regMainMaxX;
LONG regMainMaxY;
LONG regMainLeft;
LONG regMainTop;
LONG regMainBottom;
LONG regMainRight;
DWORD regMainShowState;
} NHWinApp, *PNHWinApp;
#define E extern
E PNHWinApp GetNHApp(void);
E struct window_procs mswin_procs;
#undef E
/* Some prototypes */
void mswin_init_nhwindows(int* argc, char** argv);
void mswin_player_selection(void);
void mswin_askname(void);
void mswin_get_nh_event(void);
void mswin_exit_nhwindows(const char *);
void mswin_suspend_nhwindows(const char *);
void mswin_resume_nhwindows(void);
winid mswin_create_nhwindow(int type);
void mswin_clear_nhwindow(winid wid);
void mswin_display_nhwindow(winid wid, BOOLEAN_P block);
void mswin_destroy_nhwindow(winid wid);
void mswin_curs(winid wid, int x, int y);
void mswin_putstr(winid wid, int attr, const char *text);
void mswin_putstr_ex(winid wid, int attr, const char *text, int);
void mswin_display_file(const char *filename,BOOLEAN_P must_exist);
void mswin_start_menu(winid wid);
void mswin_add_menu(winid wid, int glyph, const ANY_P * identifier,
CHAR_P accelerator, CHAR_P group_accel, int attr,
const char *str, BOOLEAN_P presel);
void mswin_end_menu(winid wid, const char *prompt);
int mswin_select_menu(winid wid, int how, MENU_ITEM_P **selected);
void mswin_update_inventory(void);
void mswin_mark_synch(void);
void mswin_wait_synch(void);
void mswin_cliparound(int x, int y);
void mswin_print_glyph(winid wid,XCHAR_P x,XCHAR_P y,int glyph);
void mswin_raw_print(const char *str);
void mswin_raw_print_bold(const char *str);
int mswin_nhgetch(void);
int mswin_nh_poskey(int *x, int *y, int *mod);
void mswin_nhbell(void);
int mswin_doprev_message(void);
char mswin_yn_function(const char *question, const char *choices,
CHAR_P def);
void mswin_getlin(const char *question, char *input);
int mswin_get_ext_cmd(void);
void mswin_number_pad(int state);
void mswin_delay_output(void);
void mswin_change_color(void);
char *mswin_get_color_string(void);
void mswin_start_screen(void);
void mswin_end_screen(void);
void mswin_outrip(winid wid, int how);
void mswin_preference_update(const char *pref);
/* helper function */
HWND mswin_hwnd_from_winid(winid wid);
winid mswin_winid_from_type(int type);
winid mswin_winid_from_handle(HWND hWnd);
void mswin_window_mark_dead(winid wid);
void bail(const char *mesg);
void nhapply_image_transparent(
HDC hDC, int x, int y, int width, int height,
HDC sourceDC, int s_x, int s_y, int s_width, int s_height,
COLORREF cTransparent
);
void mswin_popup_display(HWND popup, int* done_indicator);
void mswin_popup_destroy(HWND popup);
void mswin_read_reg(void);
void mswin_destroy_reg(void);
void mswin_write_reg(void);
int NHMessageBox(HWND hWnd, LPCTSTR text, UINT type);
extern HBRUSH menu_bg_brush;
extern HBRUSH menu_fg_brush;
extern HBRUSH text_bg_brush;
extern HBRUSH text_fg_brush;
extern HBRUSH status_bg_brush;
extern HBRUSH status_fg_brush;
extern HBRUSH message_bg_brush;
extern HBRUSH message_fg_brush;
extern COLORREF menu_bg_color;
extern COLORREF menu_fg_color;
extern COLORREF text_bg_color;
extern COLORREF text_fg_color;
extern COLORREF status_bg_color;
extern COLORREF status_fg_color;
extern COLORREF message_bg_color;
extern COLORREF message_fg_color;
#define SYSCLR_TO_BRUSH(x) ((HBRUSH)((x) + 1))
/* unicode stuff */
#ifdef UNICODE
#define NH_W2A(w, a, cb) ( WideCharToMultiByte( \
CP_ACP, \
0, \
(w), \
-1, \
(a), \
(cb), \
NULL, \
NULL), (a) )
#define NH_A2W(a, w, cb) ( MultiByteToWideChar( \
CP_ACP, \
0, \
(a), \
-1, \
(w), \
(cb)), (w) )
#else
#define NH_W2A(w, a, cb) (strncpy((a), (w), (cb)))
#define NH_A2W(a, w, cb) (strncpy((w), (a), (cb)))
#endif
#endif /* WINmswin_H */
|