switch source tree from k&r to c99
This commit is contained in:
@@ -27,46 +27,42 @@ void js_globals_init();
|
||||
#if !defined(_BULL_SOURCE) && !defined(__sgi) && !defined(_M_UNIX)
|
||||
#if !defined(SUNOS4) && !(defined(ULTRIX) && defined(__GNUC__))
|
||||
#if defined(POSIX_TYPES) || defined(SVR4) || defined(HPUX)
|
||||
extern struct passwd *FDECL(getpwuid, (uid_t));
|
||||
extern struct passwd *getpwuid(uid_t);
|
||||
#else
|
||||
extern struct passwd *FDECL(getpwuid, (int));
|
||||
extern struct passwd *getpwuid, (int);
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
extern struct passwd *FDECL(getpwnam, (const char *));
|
||||
extern struct passwd *getpwnam(const char *);
|
||||
#ifdef CHDIR
|
||||
static void FDECL(chdirx, (const char *, BOOLEAN_P));
|
||||
static void chdirx(const char *, boolean);
|
||||
#endif /* CHDIR */
|
||||
static boolean NDECL(whoami);
|
||||
static void FDECL(process_options, (int, char **));
|
||||
static boolean whoami(void);
|
||||
static void process_options(int, char **);
|
||||
|
||||
#ifdef _M_UNIX
|
||||
extern void NDECL(check_sco_console);
|
||||
extern void NDECL(init_sco_cons);
|
||||
extern void check_sco_console(void);
|
||||
extern void init_sco_cons(void);
|
||||
#endif
|
||||
#ifdef __linux__
|
||||
extern void NDECL(check_linux_console);
|
||||
extern void NDECL(init_linux_cons);
|
||||
extern void check_linux_console(void);
|
||||
extern void init_linux_cons(void);
|
||||
#endif
|
||||
|
||||
static void NDECL(wd_message);
|
||||
static void wd_message(void);
|
||||
static boolean wiz_error_flag = FALSE;
|
||||
static struct passwd *NDECL(get_unix_pw);
|
||||
static struct passwd *get_unix_pw(void);
|
||||
|
||||
#ifdef __EMSCRIPTEN__
|
||||
/* if WebAssembly, export this API and don't optimize it out */
|
||||
EMSCRIPTEN_KEEPALIVE
|
||||
int
|
||||
main(argc, argv)
|
||||
int argc;
|
||||
char *argv[];
|
||||
main(int argc, char *argv[])
|
||||
|
||||
#else /* !__EMSCRIPTEN__ */
|
||||
|
||||
int
|
||||
nhmain(argc, argv)
|
||||
int argc;
|
||||
char *argv[];
|
||||
nhmain(int argc, char *argv[])
|
||||
|
||||
#endif /* __EMSCRIPTEN__ */
|
||||
{
|
||||
@@ -342,9 +338,7 @@ char *argv[];
|
||||
|
||||
/* caveat: argv elements might be arbitrary long */
|
||||
static void
|
||||
process_options(argc, argv)
|
||||
int argc;
|
||||
char *argv[];
|
||||
process_options(int argc, char *argv[])
|
||||
{
|
||||
int i, l;
|
||||
|
||||
@@ -464,9 +458,7 @@ char *argv[];
|
||||
|
||||
#ifdef CHDIR
|
||||
static void
|
||||
chdirx(dir, wr)
|
||||
const char *dir;
|
||||
boolean wr;
|
||||
chdirx(const char *dir, boolean wr)
|
||||
{
|
||||
if (dir /* User specified directory? */
|
||||
#ifdef HACKDIR
|
||||
@@ -524,7 +516,7 @@ boolean wr;
|
||||
|
||||
/* returns True iff we set plname[] to username which contains a hyphen */
|
||||
static boolean
|
||||
whoami()
|
||||
whoami(void)
|
||||
{
|
||||
/*
|
||||
* Who am i? Algorithm: 1. Use name as specified in NETHACKOPTIONS
|
||||
@@ -557,8 +549,7 @@ whoami()
|
||||
|
||||
#ifndef NO_SIGNAL
|
||||
void
|
||||
sethanguphandler(handler)
|
||||
void FDECL((*handler), (int));
|
||||
sethanguphandler(void (*handler)(int))
|
||||
{
|
||||
#ifdef SA_RESTART
|
||||
/* don't want reads to restart. If SA_RESTART is defined, we know
|
||||
@@ -586,7 +577,7 @@ void FDECL((*handler), (int));
|
||||
|
||||
#ifdef PORT_HELP
|
||||
void
|
||||
port_help()
|
||||
port_help(void)
|
||||
{
|
||||
/*
|
||||
* Display unix-specific help. Just show contents of the helpfile
|
||||
@@ -598,7 +589,7 @@ port_help()
|
||||
|
||||
/* validate wizard mode if player has requested access to it */
|
||||
boolean
|
||||
authorize_wizard_mode()
|
||||
authorize_wizard_mode(void)
|
||||
{
|
||||
struct passwd *pw = get_unix_pw();
|
||||
|
||||
@@ -611,7 +602,7 @@ authorize_wizard_mode()
|
||||
}
|
||||
|
||||
static void
|
||||
wd_message()
|
||||
wd_message(void)
|
||||
{
|
||||
if (wiz_error_flag) {
|
||||
if (sysopt.wizards && sysopt.wizards[0]) {
|
||||
@@ -631,8 +622,7 @@ wd_message()
|
||||
* be room for the /
|
||||
*/
|
||||
void
|
||||
append_slash(name)
|
||||
char *name;
|
||||
append_slash(char *name)
|
||||
{
|
||||
char *ptr;
|
||||
|
||||
@@ -647,8 +637,7 @@ char *name;
|
||||
}
|
||||
|
||||
boolean
|
||||
check_user_string(optstr)
|
||||
const char *optstr;
|
||||
check_user_string(const char *optstr)
|
||||
{
|
||||
struct passwd *pw;
|
||||
int pwlen;
|
||||
@@ -684,7 +673,7 @@ const char *optstr;
|
||||
}
|
||||
|
||||
static struct passwd *
|
||||
get_unix_pw()
|
||||
get_unix_pw(void)
|
||||
{
|
||||
char *user;
|
||||
unsigned uid;
|
||||
@@ -715,7 +704,7 @@ get_unix_pw()
|
||||
}
|
||||
|
||||
char *
|
||||
get_login_name()
|
||||
get_login_name(void)
|
||||
{
|
||||
static char buf[BUFSZ];
|
||||
struct passwd *pw = get_unix_pw();
|
||||
@@ -728,7 +717,7 @@ get_login_name()
|
||||
}
|
||||
|
||||
unsigned long
|
||||
sys_random_seed()
|
||||
sys_random_seed(void)
|
||||
{
|
||||
unsigned long seed = 0L;
|
||||
unsigned long pid = (unsigned long) getpid();
|
||||
|
||||
@@ -45,22 +45,25 @@
|
||||
#define GETKEYFLAGS 0x02 /* Get Keyboard Flags */
|
||||
/*#define KEY_DEBUG */ /* print values of unexpected key codes - devel*/
|
||||
|
||||
void FDECL(get_cursor, (int *, int *));
|
||||
void get_cursor(int *, int *);
|
||||
|
||||
/* direct bios calls are used only when iflags.BIOS is set */
|
||||
|
||||
static char NDECL(DOSgetch);
|
||||
static char NDECL(BIOSgetch);
|
||||
static char DOSgetch(void);
|
||||
static char BIOSgetch(void);
|
||||
/* static long freediskspace(char *path); */
|
||||
unsigned long sys_random_seed(void);
|
||||
|
||||
#ifndef __GO32__
|
||||
static char *NDECL(getdta);
|
||||
static char *getdta(void);
|
||||
#endif
|
||||
static unsigned int FDECL(dos_ioctl, (int, int, unsigned));
|
||||
static unsigned int dos_ioctl(int, int, unsigned);
|
||||
#ifdef USE_TILES
|
||||
extern boolean FDECL(pckeys, (unsigned char, unsigned char)); /* pckeys.c */
|
||||
extern boolean pckeys(unsigned char, unsigned char); /* pckeys.c */
|
||||
#endif
|
||||
|
||||
int
|
||||
tgetch()
|
||||
tgetch(void)
|
||||
{
|
||||
char ch;
|
||||
|
||||
@@ -249,7 +252,7 @@ static const char numeric_scanmap[] = { /* ... */
|
||||
#endif /* PC9800 */
|
||||
|
||||
static char
|
||||
BIOSgetch()
|
||||
BIOSgetch(void)
|
||||
{
|
||||
unsigned char scan, shift, ch = 0;
|
||||
const struct pad *kpad;
|
||||
@@ -309,7 +312,7 @@ BIOSgetch()
|
||||
}
|
||||
|
||||
static char
|
||||
DOSgetch()
|
||||
DOSgetch(void)
|
||||
{
|
||||
union REGS regs;
|
||||
char ch;
|
||||
@@ -348,7 +351,7 @@ DOSgetch()
|
||||
}
|
||||
|
||||
char
|
||||
switchar()
|
||||
switchar(void)
|
||||
{
|
||||
union REGS regs;
|
||||
|
||||
@@ -357,9 +360,9 @@ switchar()
|
||||
return regs.h.dl;
|
||||
}
|
||||
|
||||
long
|
||||
freediskspace(path)
|
||||
char *path;
|
||||
#if 0
|
||||
static long
|
||||
freediskspace(char *path)
|
||||
{
|
||||
union REGS regs;
|
||||
|
||||
@@ -374,14 +377,14 @@ char *path;
|
||||
else
|
||||
return ((long) regs.x.bx * regs.x.cx * regs.x.ax);
|
||||
}
|
||||
#endif /* 0 */
|
||||
|
||||
#ifndef __GO32__
|
||||
/*
|
||||
* Functions to get filenames using wildcards
|
||||
*/
|
||||
int
|
||||
findfirst_file(path)
|
||||
char *path;
|
||||
findfirst_file(char *path)
|
||||
{
|
||||
union REGS regs;
|
||||
struct SREGS sregs;
|
||||
@@ -395,7 +398,7 @@ char *path;
|
||||
}
|
||||
|
||||
int
|
||||
findnext_file()
|
||||
findnext_file(void)
|
||||
{
|
||||
union REGS regs;
|
||||
|
||||
@@ -405,14 +408,14 @@ findnext_file()
|
||||
}
|
||||
|
||||
char *
|
||||
foundfile_buffer()
|
||||
foundfile_buffer(void)
|
||||
{
|
||||
return (getdta() + 30);
|
||||
}
|
||||
|
||||
/* Get disk transfer area */
|
||||
static char *
|
||||
getdta()
|
||||
getdta(void)
|
||||
{
|
||||
union REGS regs;
|
||||
struct SREGS sregs;
|
||||
@@ -430,8 +433,7 @@ getdta()
|
||||
}
|
||||
|
||||
long
|
||||
filesize_nh(file)
|
||||
char *file;
|
||||
filesize_nh(char *file)
|
||||
{
|
||||
char *dta;
|
||||
|
||||
@@ -448,8 +450,7 @@ char *file;
|
||||
* Chdrive() changes the default drive.
|
||||
*/
|
||||
void
|
||||
chdrive(str)
|
||||
char *str;
|
||||
chdrive(char *str)
|
||||
{
|
||||
#define SELECTDISK 0x0E
|
||||
char *ptr;
|
||||
@@ -482,7 +483,7 @@ char *str;
|
||||
static unsigned int old_stdin, old_stdout;
|
||||
|
||||
void
|
||||
disable_ctrlP()
|
||||
disable_ctrlP(void)
|
||||
{
|
||||
if (!iflags.rawio)
|
||||
return;
|
||||
@@ -497,7 +498,7 @@ disable_ctrlP()
|
||||
}
|
||||
|
||||
void
|
||||
enable_ctrlP()
|
||||
enable_ctrlP(void)
|
||||
{
|
||||
if (!iflags.rawio)
|
||||
return;
|
||||
@@ -509,9 +510,7 @@ enable_ctrlP()
|
||||
}
|
||||
|
||||
static unsigned int
|
||||
dos_ioctl(handle, mode, setvalue)
|
||||
int handle, mode;
|
||||
unsigned setvalue;
|
||||
dos_ioctl(int handle, int mode, unsigned setvalue)
|
||||
{
|
||||
union REGS regs;
|
||||
|
||||
@@ -525,7 +524,7 @@ unsigned setvalue;
|
||||
}
|
||||
|
||||
unsigned long
|
||||
sys_random_seed(VOID_ARGS)
|
||||
sys_random_seed(void)
|
||||
{
|
||||
unsigned long ourseed = 0UL;
|
||||
time_t datetime = 0;
|
||||
|
||||
@@ -13,11 +13,11 @@
|
||||
#include "wintty.h"
|
||||
#include "pcvideo.h"
|
||||
|
||||
boolean FDECL(pckeys, (unsigned char, unsigned char));
|
||||
static void FDECL(userpan, (BOOLEAN_P));
|
||||
static void FDECL(overview, (BOOLEAN_P));
|
||||
static void FDECL(traditional, (BOOLEAN_P));
|
||||
static void NDECL(refresh);
|
||||
boolean pckeys(unsigned char, unsigned char);
|
||||
static void userpan(boolean);
|
||||
static void overview(boolean);
|
||||
static void traditional(boolean);
|
||||
static void refresh(void);
|
||||
|
||||
extern struct WinDesc *wins[MAXWIN]; /* from wintty.c */
|
||||
extern boolean inmap; /* from video.c */
|
||||
@@ -32,9 +32,7 @@ extern boolean inmap; /* from video.c */
|
||||
*
|
||||
*/
|
||||
boolean
|
||||
pckeys(scancode, shift)
|
||||
unsigned char scancode;
|
||||
unsigned char shift;
|
||||
pckeys(unsigned char scancode, unsigned char shift)
|
||||
{
|
||||
boolean opening_dialog;
|
||||
|
||||
@@ -78,8 +76,7 @@ unsigned char shift;
|
||||
}
|
||||
|
||||
static void
|
||||
userpan(on)
|
||||
boolean on;
|
||||
userpan(boolean on)
|
||||
{
|
||||
#ifdef SCREEN_VGA
|
||||
if (iflags.usevga)
|
||||
@@ -92,8 +89,7 @@ boolean on;
|
||||
}
|
||||
|
||||
static void
|
||||
overview(on)
|
||||
boolean on;
|
||||
overview(boolean on)
|
||||
{
|
||||
#ifdef SCREEN_VGA
|
||||
if (iflags.usevga)
|
||||
@@ -106,8 +102,7 @@ boolean on;
|
||||
}
|
||||
|
||||
static void
|
||||
traditional(on)
|
||||
boolean on;
|
||||
traditional(boolean on)
|
||||
{
|
||||
#ifdef SCREEN_VGA
|
||||
if (iflags.usevga)
|
||||
@@ -120,7 +115,7 @@ boolean on;
|
||||
}
|
||||
|
||||
static void
|
||||
refresh()
|
||||
refresh(void)
|
||||
{
|
||||
#ifdef SCREEN_VGA
|
||||
if (iflags.usevga)
|
||||
|
||||
@@ -54,9 +54,7 @@ extern int total_tiles_used; /* tile.c */
|
||||
*
|
||||
*/
|
||||
int
|
||||
ReadTileFileHeader(tibhdr, filestyle)
|
||||
struct tibhdr_struct *tibhdr;
|
||||
boolean filestyle;
|
||||
ReadTileFileHeader(struct tibhdr_struct *tibhdr, boolean filestyle)
|
||||
{
|
||||
FILE *x;
|
||||
x = filestyle ? tilefile_O : tilefile;
|
||||
@@ -85,9 +83,7 @@ boolean filestyle;
|
||||
*
|
||||
*/
|
||||
int
|
||||
OpenTileFile(tilefilename, filestyle)
|
||||
char *tilefilename;
|
||||
boolean filestyle;
|
||||
OpenTileFile(char *tilefilename, boolean filestyle)
|
||||
{
|
||||
#ifdef TILES_IN_RAM
|
||||
int k;
|
||||
@@ -150,8 +146,7 @@ boolean filestyle;
|
||||
}
|
||||
|
||||
void
|
||||
CloseTileFile(filestyle)
|
||||
boolean filestyle;
|
||||
CloseTileFile(boolean filestyle)
|
||||
{
|
||||
fclose(filestyle ? tilefile_O : tilefile);
|
||||
#ifdef TILES_IN_RAM
|
||||
@@ -191,9 +186,7 @@ struct overview_planar_cell_struct oplancell;
|
||||
*/
|
||||
#ifdef PLANAR_FILE
|
||||
int
|
||||
ReadPlanarTileFile(tilenum, gp)
|
||||
int tilenum;
|
||||
struct planar_cell_struct **gp;
|
||||
ReadPlanarTileFile(int tilenum, struct planar_cell_struct **gp)
|
||||
{
|
||||
long fpos;
|
||||
|
||||
@@ -214,9 +207,7 @@ struct planar_cell_struct **gp;
|
||||
return 0;
|
||||
}
|
||||
int
|
||||
ReadPlanarTileFile_O(tilenum, gp)
|
||||
int tilenum;
|
||||
struct overview_planar_cell_struct **gp;
|
||||
ReadPlanarTileFile_O(int tilenum, struct overview_planar_cell_struct **gp)
|
||||
{
|
||||
long fpos;
|
||||
|
||||
@@ -242,9 +233,7 @@ struct overview_planar_cell_struct **gp;
|
||||
|
||||
#ifdef PACKED_FILE
|
||||
int
|
||||
ReadPackedTileFile(tilenum, pta)
|
||||
int tilenum;
|
||||
char (*pta)[TILE_X];
|
||||
ReadPackedTileFile(int tilenum, char (*pta)[TILE_X])
|
||||
{
|
||||
long fpos;
|
||||
|
||||
|
||||
@@ -45,20 +45,19 @@ struct tibhdr_struct {
|
||||
* char packtile[TILE_Y][TILE_X];
|
||||
*/
|
||||
|
||||
extern void FDECL(CloseTileFile, (BOOLEAN_P));
|
||||
extern int FDECL(OpenTileFile, (char *, BOOLEAN_P));
|
||||
extern int FDECL(ReadTileFileHeader, (struct tibhdr_struct *, BOOLEAN_P));
|
||||
extern void CloseTileFile(boolean);
|
||||
extern int OpenTileFile(char *, boolean);
|
||||
extern int ReadTileFileHeader(struct tibhdr_struct *, boolean);
|
||||
|
||||
#ifdef PLANAR_FILE
|
||||
#ifdef SCREEN_VGA
|
||||
extern int FDECL(ReadPlanarTileFile, (int, struct planar_cell_struct **));
|
||||
extern int FDECL(ReadPlanarTileFile_O,
|
||||
(int, struct overview_planar_cell_struct **));
|
||||
extern int ReadPlanarTileFile(int, struct planar_cell_struct **);
|
||||
extern int ReadPlanarTileFile_O(int, struct overview_planar_cell_struct **);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef PACKED_FILE
|
||||
extern int FDECL(ReadPackedTileFile, (int, char (*)[TILE_X]));
|
||||
extern int ReadPackedTileFile(int, char (*)[TILE_X]);
|
||||
#endif
|
||||
|
||||
extern short glyph2tile[MAX_GLYPH]; /* in tile.c (made from tilemap.c) */
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
#endif
|
||||
|
||||
#ifdef SCREEN_DJGPPFAST
|
||||
/*# define MONO_CHECK /* djgpp should be able to do check */
|
||||
/*# define MONO_CHECK */ /* djgpp should be able to do check */
|
||||
#endif
|
||||
|
||||
/*
|
||||
@@ -66,14 +66,14 @@
|
||||
* VGA Specific Stuff
|
||||
*/
|
||||
#ifdef SCREEN_VGA
|
||||
/* #define HW_PANNING /* Hardware panning enabled */
|
||||
/* #define HW_PANNING */ /* Hardware panning enabled */
|
||||
#define USHORT unsigned short
|
||||
#define MODE640x480 0x0012 /* Switch to VGA 640 x 480 Graphics mode */
|
||||
#define MODETEXT 0x0003 /* Switch to Text mode 3 */
|
||||
|
||||
#ifdef HW_PANNING
|
||||
#define PIXELINC 16 /* How much to increment by when panning */
|
||||
/*#define PIXELINC 1 /* How much to increment by when panning */
|
||||
/*#define PIXELINC 1 */ /* How much to increment by when panning */
|
||||
#define SCREENBYTES 128
|
||||
#define CharRows 30
|
||||
#define VERT_RETRACE \
|
||||
@@ -227,96 +227,92 @@ extern int cursor_color;
|
||||
*
|
||||
*/
|
||||
|
||||
#define E extern
|
||||
|
||||
/* ### video.c ### */
|
||||
|
||||
#ifdef SIMULATE_CURSOR
|
||||
E void NDECL(DrawCursor);
|
||||
E void NDECL(HideCursor);
|
||||
extern void DrawCursor(void);
|
||||
extern void HideCursor(void);
|
||||
#endif
|
||||
|
||||
/* ### vidtxt.c ### */
|
||||
|
||||
#ifdef NO_TERMS
|
||||
E void NDECL(txt_backsp);
|
||||
E void NDECL(txt_clear_screen);
|
||||
E void FDECL(txt_cl_end, (int, int));
|
||||
E void NDECL(txt_cl_eos);
|
||||
E void NDECL(txt_get_scr_size);
|
||||
E void FDECL(txt_gotoxy, (int, int));
|
||||
E int NDECL(txt_monoadapt_check);
|
||||
E void NDECL(txt_nhbell);
|
||||
E void FDECL(txt_startup, (int *, int *));
|
||||
E void FDECL(txt_xputs, (const char *, int, int));
|
||||
E void FDECL(txt_xputc, (CHAR_P, int));
|
||||
extern void txt_backsp(void);
|
||||
extern void txt_clear_screen(void);
|
||||
extern void txt_cl_end(int, int);
|
||||
extern void txt_cl_eos(void);
|
||||
extern void txt_get_scr_size(void);
|
||||
extern void txt_gotoxy(int, int);
|
||||
extern int txt_monoadapt_check(void);
|
||||
extern void txt_nhbell(void);
|
||||
extern void txt_startup(int *, int *);
|
||||
extern void txt_xputs(const char *, int, int);
|
||||
extern void txt_xputc(char, int);
|
||||
|
||||
/* ### vidvga.c ### */
|
||||
|
||||
enum vga_pan_direction { pan_left, pan_up, pan_right, pan_down };
|
||||
#ifdef SCREEN_VGA
|
||||
E void NDECL(vga_backsp);
|
||||
E void FDECL(vga_clear_screen, (int));
|
||||
E void FDECL(vga_cl_end, (int, int));
|
||||
E void FDECL(vga_cl_eos, (int));
|
||||
E int NDECL(vga_detect);
|
||||
extern void vga_backsp(void);
|
||||
extern void vga_clear_screen(int);
|
||||
extern void vga_cl_end(int, int);
|
||||
extern void vga_cl_eos(int);
|
||||
extern int vga_detect(void);
|
||||
#ifdef SIMULATE_CURSOR
|
||||
E void NDECL(vga_DrawCursor);
|
||||
extern void vga_DrawCursor(void);
|
||||
#endif
|
||||
E void NDECL(vga_Finish);
|
||||
E char __far *NDECL(vga_FontPtrs);
|
||||
E void NDECL(vga_get_scr_size);
|
||||
E void FDECL(vga_gotoloc, (int, int));
|
||||
extern void vga_Finish(void);
|
||||
extern char __far *vga_FontPtrs(void);
|
||||
extern void vga_get_scr_size(void);
|
||||
extern void vga_gotoloc(int, int);
|
||||
#ifdef POSITIONBAR
|
||||
E void FDECL(vga_update_positionbar, (char *));
|
||||
extern void vga_update_positionbar(char *);
|
||||
#endif
|
||||
#ifdef SIMULATE_CURSOR
|
||||
E void NDECL(vga_HideCursor);
|
||||
extern void vga_HideCursor(void);
|
||||
#endif
|
||||
E void NDECL(vga_Init);
|
||||
E void NDECL(vga_tty_end_screen);
|
||||
E void FDECL(vga_tty_startup, (int *, int *));
|
||||
E void FDECL(vga_xputs, (const char *, int, int));
|
||||
E void FDECL(vga_xputc, (CHAR_P, int));
|
||||
E void FDECL(vga_xputg, (int, int, unsigned));
|
||||
E void FDECL(vga_userpan, (enum vga_pan_direction));
|
||||
E void FDECL(vga_overview, (BOOLEAN_P));
|
||||
E void FDECL(vga_traditional, (BOOLEAN_P));
|
||||
E void NDECL(vga_refresh);
|
||||
extern void vga_Init(void);
|
||||
extern void vga_tty_end_screen(void);
|
||||
extern void vga_tty_startup(int *, int *);
|
||||
extern void vga_xputs(const char *, int, int);
|
||||
extern void vga_xputc(char, int);
|
||||
extern void vga_xputg(int, int, unsigned);
|
||||
extern void vga_userpan(enum vga_pan_direction);
|
||||
extern void vga_overview(boolean);
|
||||
extern void vga_traditional(boolean);
|
||||
extern void vga_refresh(void);
|
||||
#endif /* SCREEN_VGA */
|
||||
#ifdef SCREEN_VESA
|
||||
E void NDECL(vesa_backsp);
|
||||
E void FDECL(vesa_clear_screen, (int));
|
||||
E void FDECL(vesa_cl_end, (int, int));
|
||||
E void FDECL(vesa_cl_eos, (int));
|
||||
E int NDECL(vesa_detect);
|
||||
extern void vesa_backsp(void);
|
||||
extern void vesa_clear_screen(int);
|
||||
extern void vesa_cl_end(int, int);
|
||||
extern void vesa_cl_eos(int);
|
||||
extern int vesa_detect(void);
|
||||
#ifdef SIMULATE_CURSOR
|
||||
E void NDECL(vesa_DrawCursor);
|
||||
extern void vesa_DrawCursor(void);
|
||||
#endif
|
||||
E void NDECL(vesa_Finish);
|
||||
E void NDECL(vesa_get_scr_size);
|
||||
E void FDECL(vesa_gotoloc, (int, int));
|
||||
extern void vesa_Finish(void);
|
||||
extern void vesa_get_scr_size(void);
|
||||
extern void vesa_gotoloc(int, int);
|
||||
#ifdef POSITIONBAR
|
||||
E void FDECL(vesa_update_positionbar, (char *));
|
||||
extern void vesa_update_positionbar(char *);
|
||||
#endif
|
||||
#ifdef SIMULATE_CURSOR
|
||||
E void NDECL(vesa_HideCursor);
|
||||
extern void vesa_HideCursor(void);
|
||||
#endif
|
||||
E void NDECL(vesa_Init);
|
||||
E void NDECL(vesa_tty_end_screen);
|
||||
E void FDECL(vesa_tty_startup, (int *, int *));
|
||||
E void FDECL(vesa_xputs, (const char *, int, int));
|
||||
E void FDECL(vesa_xputc, (CHAR_P, int));
|
||||
E void FDECL(vesa_xputg, (int, int, unsigned));
|
||||
E void FDECL(vesa_userpan, (enum vga_pan_direction));
|
||||
E void FDECL(vesa_overview, (BOOLEAN_P));
|
||||
E void FDECL(vesa_traditional, (BOOLEAN_P));
|
||||
E void NDECL(vesa_refresh);
|
||||
E void NDECL(vesa_flush_text);
|
||||
extern void vesa_Init(void);
|
||||
extern void vesa_tty_end_screen(void);
|
||||
extern void vesa_tty_startup(int *, int *);
|
||||
extern void vesa_xputs(const char *, int, int);
|
||||
extern void vesa_xputc(char, int);
|
||||
extern void vesa_xputg(int, int, unsigned);
|
||||
extern void vesa_userpan(enum vga_pan_direction);
|
||||
extern void vesa_overview(boolean);
|
||||
extern void vesa_traditional(boolean);
|
||||
extern void vesa_refresh(void);
|
||||
extern void vesa_flush_text(void);
|
||||
#endif /* SCREEN_VESA */
|
||||
#endif /* NO_TERMS */
|
||||
|
||||
#undef E
|
||||
|
||||
#endif /* PCVIDEO_H */
|
||||
/* pcvideo.h */
|
||||
|
||||
@@ -44,7 +44,7 @@ extern unsigned _stklen = STKSIZ;
|
||||
#undef PACKED_FILE
|
||||
#endif
|
||||
|
||||
extern char *FDECL(tilename, (int, int));
|
||||
extern char *tilename(int, int);
|
||||
|
||||
#ifdef PLANAR_FILE
|
||||
char masktable[8] = { 0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x01 };
|
||||
@@ -66,10 +66,10 @@ int num_colors;
|
||||
pixel pixels[TILE_Y][TILE_X];
|
||||
struct tibhdr_struct tibheader;
|
||||
|
||||
static void FDECL(write_tibtile, (int));
|
||||
static void FDECL(write_tibheader, (FILE *, struct tibhdr_struct *));
|
||||
static void FDECL(build_tibtile, (pixel(*) [TILE_X], BOOLEAN_P));
|
||||
static void NDECL(remap_colors);
|
||||
static void write_tibtile(int);
|
||||
static void write_tibheader(FILE *, struct tibhdr_struct *);
|
||||
static void build_tibtile(pixel(*) [TILE_X], boolean);
|
||||
static void remap_colors(void);
|
||||
|
||||
#ifndef OVERVIEW_FILE
|
||||
char *tilefiles[] = { "../win/share/monsters.txt", "../win/share/objects.txt",
|
||||
@@ -84,9 +84,7 @@ int filenum;
|
||||
int paletteflag;
|
||||
|
||||
int
|
||||
main(argc, argv)
|
||||
int argc;
|
||||
char *argv[];
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
int i;
|
||||
struct tm *newtime;
|
||||
@@ -223,9 +221,7 @@ char *argv[];
|
||||
}
|
||||
|
||||
static void
|
||||
write_tibheader(fileptr, tibhdr)
|
||||
FILE *fileptr;
|
||||
struct tibhdr_struct *tibhdr;
|
||||
write_tibheader(FILE *fileptr, struct tibhdr_struct *tibhdr)
|
||||
{
|
||||
if (fseek(fileptr, 0L, SEEK_SET)) {
|
||||
Fprintf(stderr, "Error writing header to tile file\n");
|
||||
@@ -234,9 +230,7 @@ struct tibhdr_struct *tibhdr;
|
||||
}
|
||||
|
||||
static void
|
||||
build_tibtile(pixels, statues)
|
||||
pixel (*pixels)[TILE_X];
|
||||
boolean statues;
|
||||
build_tibtile(pixel (*pixels)[TILE_X], boolean statues)
|
||||
{
|
||||
static int graymappings[] = {
|
||||
/* . A B C D E F G H I J K L M N O P */
|
||||
@@ -314,8 +308,7 @@ boolean statues;
|
||||
}
|
||||
|
||||
static void
|
||||
write_tibtile(recnum)
|
||||
int recnum;
|
||||
write_tibtile(int recnum)
|
||||
{
|
||||
long fpos;
|
||||
|
||||
@@ -352,7 +345,7 @@ int recnum;
|
||||
}
|
||||
|
||||
static void
|
||||
remap_colors()
|
||||
remap_colors(void)
|
||||
{
|
||||
char swap;
|
||||
|
||||
|
||||
@@ -73,7 +73,7 @@
|
||||
*/
|
||||
|
||||
void
|
||||
get_scr_size()
|
||||
get_scr_size(void)
|
||||
{
|
||||
#ifdef SCREEN_VGA
|
||||
if (iflags.usevga) {
|
||||
@@ -116,13 +116,13 @@ typedef long clock_t;
|
||||
#endif
|
||||
|
||||
#ifdef SCREEN_BIOS
|
||||
void FDECL(get_cursor, (int *, int *));
|
||||
void get_cursor(int *, int *);
|
||||
#endif
|
||||
|
||||
void FDECL(adjust_cursor_flags, (struct WinDesc *));
|
||||
void FDECL(cmov, (int, int));
|
||||
void FDECL(nocmov, (int, int));
|
||||
static void NDECL(init_ttycolor);
|
||||
void adjust_cursor_flags(struct WinDesc *);
|
||||
void cmov(int, int);
|
||||
void nocmov(int, int);
|
||||
static void init_ttycolor(void);
|
||||
|
||||
int savevmode; /* store the original video mode in here */
|
||||
int curcol, currow; /* graphics mode current cursor locations */
|
||||
@@ -139,7 +139,7 @@ char ttycolors[CLR_MAX]; /* also used/set in options.c */
|
||||
#endif /* TEXTCOLOR */
|
||||
|
||||
void
|
||||
backsp()
|
||||
backsp(void)
|
||||
{
|
||||
if (!iflags.grmode) {
|
||||
txt_backsp();
|
||||
@@ -155,7 +155,7 @@ backsp()
|
||||
}
|
||||
|
||||
void
|
||||
clear_screen()
|
||||
clear_screen(void)
|
||||
{
|
||||
if (!iflags.grmode) {
|
||||
txt_clear_screen();
|
||||
@@ -170,7 +170,7 @@ clear_screen()
|
||||
}
|
||||
}
|
||||
|
||||
void cl_end() /* clear to end of line */
|
||||
void cl_end(void) /* clear to end of line */
|
||||
{
|
||||
int col, row;
|
||||
|
||||
@@ -190,7 +190,7 @@ void cl_end() /* clear to end of line */
|
||||
tty_curs(BASE_WINDOW, (int) ttyDisplay->curx + 1, (int) ttyDisplay->cury);
|
||||
}
|
||||
|
||||
void cl_eos() /* clear to end of screen */
|
||||
void cl_eos(void) /* clear to end of screen */
|
||||
{
|
||||
int cy = (int) ttyDisplay->cury + 1;
|
||||
|
||||
@@ -209,8 +209,7 @@ void cl_eos() /* clear to end of screen */
|
||||
}
|
||||
|
||||
void
|
||||
cmov(col, row)
|
||||
register int col, row;
|
||||
cmov(int col, int row)
|
||||
{
|
||||
ttyDisplay->cury = (uchar) row;
|
||||
ttyDisplay->curx = (uchar) col;
|
||||
@@ -241,7 +240,7 @@ has_color(int color)
|
||||
#endif
|
||||
|
||||
void
|
||||
home()
|
||||
home(void)
|
||||
{
|
||||
tty_curs(BASE_WINDOW, 1, 0);
|
||||
ttyDisplay->curx = ttyDisplay->cury = (uchar) 0;
|
||||
@@ -259,8 +258,7 @@ home()
|
||||
}
|
||||
|
||||
void
|
||||
nocmov(col, row)
|
||||
int col, row;
|
||||
nocmov(int col, int row)
|
||||
{
|
||||
if (!iflags.grmode) {
|
||||
txt_gotoxy(col, row);
|
||||
@@ -276,13 +274,13 @@ int col, row;
|
||||
}
|
||||
|
||||
void
|
||||
standoutbeg()
|
||||
standoutbeg(void)
|
||||
{
|
||||
g_attribute = iflags.grmode ? attrib_gr_intense : attrib_text_intense;
|
||||
}
|
||||
|
||||
void
|
||||
standoutend()
|
||||
standoutend(void)
|
||||
{
|
||||
g_attribute = iflags.grmode ? attrib_gr_normal : attrib_text_normal;
|
||||
}
|
||||
@@ -379,7 +377,7 @@ term_start_raw_bold(void)
|
||||
}
|
||||
|
||||
void
|
||||
tty_delay_output()
|
||||
tty_delay_output(void)
|
||||
{
|
||||
#ifdef TIMED_DELAY
|
||||
if (flags.nap) {
|
||||
@@ -391,7 +389,7 @@ tty_delay_output()
|
||||
}
|
||||
|
||||
void
|
||||
tty_end_screen()
|
||||
tty_end_screen(void)
|
||||
{
|
||||
if (!iflags.grmode) {
|
||||
txt_clear_screen();
|
||||
@@ -410,21 +408,19 @@ tty_end_screen()
|
||||
}
|
||||
|
||||
void
|
||||
tty_nhbell()
|
||||
tty_nhbell(void)
|
||||
{
|
||||
txt_nhbell();
|
||||
}
|
||||
|
||||
void
|
||||
tty_number_pad(state)
|
||||
int state;
|
||||
tty_number_pad(int state)
|
||||
{
|
||||
++state; /* prevents compiler warning (unref. param) */
|
||||
}
|
||||
|
||||
void
|
||||
tty_startup(wid, hgt)
|
||||
int *wid, *hgt;
|
||||
tty_startup(int *wid, int *hgt)
|
||||
{
|
||||
/* code to sense display adapter is required here - MJA */
|
||||
|
||||
@@ -468,7 +464,7 @@ int *wid, *hgt;
|
||||
}
|
||||
|
||||
void
|
||||
tty_start_screen()
|
||||
tty_start_screen(void)
|
||||
{
|
||||
#ifdef PC9800
|
||||
fputs("\033[>1h", stdout);
|
||||
@@ -478,7 +474,7 @@ tty_start_screen()
|
||||
}
|
||||
|
||||
void
|
||||
gr_init()
|
||||
gr_init(void)
|
||||
{
|
||||
#ifdef SCREEN_VGA
|
||||
if (iflags.usevga) {
|
||||
@@ -499,7 +495,7 @@ gr_init()
|
||||
}
|
||||
|
||||
void
|
||||
gr_finish()
|
||||
gr_finish(void)
|
||||
{
|
||||
if (iflags.grmode) {
|
||||
#ifdef SCREEN_VGA
|
||||
@@ -552,8 +548,7 @@ gr_finish()
|
||||
*/
|
||||
|
||||
void
|
||||
xputs(s)
|
||||
const char *s;
|
||||
xputs(const char *s)
|
||||
{
|
||||
int col, row;
|
||||
|
||||
@@ -575,8 +570,7 @@ const char *s;
|
||||
|
||||
/* same signature as 'putchar()' with potential failure result ignored */
|
||||
int
|
||||
xputc(ch) /* write out character (and attribute) */
|
||||
int ch;
|
||||
xputc(int ch) /* write out character (and attribute) */
|
||||
{
|
||||
int i;
|
||||
char attribute;
|
||||
@@ -599,10 +593,7 @@ int ch;
|
||||
}
|
||||
|
||||
/* write out a glyph picture at current location */
|
||||
void xputg(glyphnum, ch, special)
|
||||
int glyphnum;
|
||||
int ch;
|
||||
unsigned special;
|
||||
void xputg(int glyphnum, int ch, unsigned special)
|
||||
{
|
||||
if (!iflags.grmode || !iflags.tile_view) {
|
||||
(void) xputc((char) ch);
|
||||
@@ -619,8 +610,7 @@ unsigned special;
|
||||
|
||||
#ifdef POSITIONBAR
|
||||
void
|
||||
video_update_positionbar(posbar)
|
||||
char *posbar;
|
||||
video_update_positionbar(char *posbar)
|
||||
{
|
||||
if (!iflags.grmode)
|
||||
return;
|
||||
@@ -636,8 +626,7 @@ char *posbar;
|
||||
#endif
|
||||
|
||||
void
|
||||
adjust_cursor_flags(cw)
|
||||
struct WinDesc *cw;
|
||||
adjust_cursor_flags(struct WinDesc *cw)
|
||||
{
|
||||
#ifdef SIMULATE_CURSOR
|
||||
#if 0
|
||||
@@ -664,7 +653,7 @@ int cursor_flag;
|
||||
|
||||
/* The check for iflags.grmode is made BEFORE calling these. */
|
||||
void
|
||||
DrawCursor()
|
||||
DrawCursor(void)
|
||||
{
|
||||
#ifdef SCREEN_VGA
|
||||
if (iflags.usevga)
|
||||
@@ -677,7 +666,7 @@ DrawCursor()
|
||||
}
|
||||
|
||||
void
|
||||
HideCursor()
|
||||
HideCursor(void)
|
||||
{
|
||||
#ifdef SCREEN_VGA
|
||||
if (iflags.usevga)
|
||||
@@ -720,12 +709,12 @@ HideCursor()
|
||||
|
||||
int shadeflag; /* shades are initialized */
|
||||
int colorflag; /* colors are initialized */
|
||||
char *schoice[3] = { "dark", "normal", "light" };
|
||||
char *shade[3];
|
||||
const char *schoice[3] = { "dark", "normal", "light" };
|
||||
const char *shade[3];
|
||||
#endif /* VIDEOSHADES */
|
||||
|
||||
static void
|
||||
init_ttycolor()
|
||||
init_ttycolor(void)
|
||||
{
|
||||
#ifdef VIDEOSHADES
|
||||
if (!shadeflag) {
|
||||
@@ -763,7 +752,7 @@ init_ttycolor()
|
||||
#endif
|
||||
}
|
||||
|
||||
static int FDECL(convert_uchars, (char *, uchar *, int));
|
||||
static int convert_uchars(char *, uchar *, int);
|
||||
#ifdef VIDEOSHADES
|
||||
int
|
||||
assign_videoshades(char *choiceptr)
|
||||
@@ -872,10 +861,9 @@ assign_videocolors(char *colorvals)
|
||||
}
|
||||
|
||||
static int
|
||||
convert_uchars(bufp, list, size)
|
||||
char *bufp; /* current pointer */
|
||||
uchar *list; /* return list */
|
||||
int size;
|
||||
convert_uchars(char *bufp, /* current pointer */
|
||||
uchar *list, /* return list */
|
||||
int size)
|
||||
{
|
||||
unsigned int num = 0;
|
||||
int count = 0;
|
||||
@@ -928,8 +916,7 @@ int size;
|
||||
* vga (use vga adapter code)
|
||||
*/
|
||||
int
|
||||
assign_video(sopt)
|
||||
char *sopt;
|
||||
assign_video(char *sopt)
|
||||
{
|
||||
/*
|
||||
* debug
|
||||
@@ -994,8 +981,7 @@ char *sopt;
|
||||
}
|
||||
|
||||
void
|
||||
tileview(enable)
|
||||
boolean enable;
|
||||
tileview(boolean enable)
|
||||
{
|
||||
#ifdef SCREEN_VGA
|
||||
if (iflags.grmode && iflags.usevga)
|
||||
@@ -1011,8 +997,7 @@ boolean enable;
|
||||
#else /* STUBVIDEO */
|
||||
|
||||
void
|
||||
tileview(enable)
|
||||
boolean enable;
|
||||
tileview(boolean enable)
|
||||
{
|
||||
}
|
||||
#endif /* STUBVIDEO */
|
||||
|
||||
@@ -24,14 +24,14 @@
|
||||
#if _MSC_VER >= 700
|
||||
#pragma warning(disable : 4018) /* signed/unsigned mismatch */
|
||||
#pragma warning(disable : 4127) /* conditional expression is constant */
|
||||
#pragma warning(disable : 4131) /* old style declarator */
|
||||
/* #pragma warning(disable : 4131) */ /* old style declarator */
|
||||
#pragma warning(disable : 4305) /* prevents complaints with MK_FP */
|
||||
#pragma warning(disable : 4309) /* initializing */
|
||||
#pragma warning(disable : 4759) /* prevents complaints with MK_FP */
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* void FDECL(txt_xputc,(char, int)); */ /* write out character (and
|
||||
/* void txt_xputc(char, int);*/ /* write out character (and
|
||||
attribute) */
|
||||
|
||||
extern int attrib_text_normal; /* text mode normal attribute */
|
||||
@@ -40,7 +40,7 @@ extern int attrib_text_intense; /* text mode intense attribute */
|
||||
extern int attrib_gr_intense; /* graphics mode intense attribute */
|
||||
|
||||
void
|
||||
txt_get_scr_size()
|
||||
txt_get_scr_size(void)
|
||||
{
|
||||
union REGS regs;
|
||||
|
||||
@@ -98,10 +98,10 @@ txt_get_scr_size()
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
void FDECL(txt_gotoxy, (int, int));
|
||||
void txt_gotoxy(int, int);
|
||||
|
||||
#if defined(SCREEN_BIOS) && !defined(PC9800)
|
||||
void FDECL(txt_get_cursor, (int *, int *));
|
||||
void txt_get_cursor(int *, int *);
|
||||
#endif
|
||||
|
||||
#ifdef SCREEN_DJGPPFAST
|
||||
@@ -112,7 +112,7 @@ extern int g_attribute; /* Current attribute to use */
|
||||
extern int monoflag; /* 0 = not monochrome, else monochrome */
|
||||
|
||||
void
|
||||
txt_backsp()
|
||||
txt_backsp(void)
|
||||
{
|
||||
#ifdef PC9800
|
||||
union REGS regs;
|
||||
@@ -134,7 +134,7 @@ txt_backsp()
|
||||
}
|
||||
|
||||
void
|
||||
txt_nhbell()
|
||||
txt_nhbell(void)
|
||||
{
|
||||
union REGS regs;
|
||||
|
||||
@@ -146,7 +146,7 @@ txt_nhbell()
|
||||
}
|
||||
|
||||
void
|
||||
txt_clear_screen()
|
||||
txt_clear_screen(void)
|
||||
/* djgpp provides ScreenClear(), but in version 1.09 it is broken
|
||||
* so for now we just use the BIOS Routines
|
||||
*/
|
||||
@@ -178,8 +178,8 @@ txt_clear_screen()
|
||||
#endif
|
||||
}
|
||||
|
||||
void txt_cl_end(col, row) /* clear to end of line */
|
||||
int col, row;
|
||||
/* clear to end of line */
|
||||
void txt_cl_end(int col, int row)
|
||||
{
|
||||
union REGS regs;
|
||||
#ifndef PC9800
|
||||
@@ -213,7 +213,7 @@ int col, row;
|
||||
#endif
|
||||
}
|
||||
|
||||
void txt_cl_eos() /* clear to end of screen */
|
||||
void txt_cl_eos(void) /* clear to end of screen */
|
||||
{
|
||||
union REGS regs;
|
||||
#ifndef PC9800
|
||||
@@ -252,8 +252,7 @@ void txt_cl_eos() /* clear to end of screen */
|
||||
}
|
||||
|
||||
void
|
||||
txt_startup(wid, hgt)
|
||||
int *wid, *hgt;
|
||||
txt_startup(int *wid, int *hgt)
|
||||
{
|
||||
txt_get_scr_size();
|
||||
*wid = CO;
|
||||
@@ -289,9 +288,7 @@ int *wid, *hgt;
|
||||
*/
|
||||
|
||||
void
|
||||
txt_xputs(s, col, row)
|
||||
const char *s;
|
||||
int col, row;
|
||||
txt_xputs(const char *s, int col, int row)
|
||||
{
|
||||
char c;
|
||||
|
||||
@@ -307,9 +304,8 @@ int col, row;
|
||||
}
|
||||
}
|
||||
|
||||
void txt_xputc(ch, attr) /* write out character (and attribute) */
|
||||
char ch;
|
||||
int attr;
|
||||
/* write out character (and attribute) */
|
||||
void txt_xputc(char ch, int attr)
|
||||
{
|
||||
#ifdef PC9800
|
||||
union REGS regs;
|
||||
@@ -390,10 +386,11 @@ int attr;
|
||||
|
||||
#if defined(SCREEN_BIOS) && !defined(PC9800)
|
||||
/*
|
||||
* get cursor position
|
||||
*
|
||||
* This is implemented as a macro under DJGPPFAST.
|
||||
*/
|
||||
void txt_get_cursor(x, y) /* get cursor position */
|
||||
int *x, *y;
|
||||
void txt_get_cursor(int *x, int *y)
|
||||
{
|
||||
union REGS regs;
|
||||
|
||||
@@ -408,8 +405,7 @@ int *x, *y;
|
||||
#endif /* SCREEN_BIOS && !PC9800 */
|
||||
|
||||
void
|
||||
txt_gotoxy(x, y)
|
||||
int x, y;
|
||||
txt_gotoxy(int x, int y)
|
||||
{
|
||||
#ifdef SCREEN_BIOS
|
||||
union REGS regs;
|
||||
@@ -445,7 +441,7 @@ int x, y;
|
||||
|
||||
#ifdef MONO_CHECK
|
||||
int
|
||||
txt_monoadapt_check()
|
||||
txt_monoadapt_check(void)
|
||||
{
|
||||
union REGS regs;
|
||||
|
||||
|
||||
@@ -26,46 +26,43 @@ struct VesaCharacter {
|
||||
int chr;
|
||||
};
|
||||
|
||||
static unsigned long FDECL(vesa_SetWindow, (int window, unsigned long offset));
|
||||
static unsigned long FDECL(vesa_ReadPixel32, (unsigned x, unsigned y));
|
||||
static void FDECL(vesa_WritePixel32, (unsigned x, unsigned y,
|
||||
unsigned long color));
|
||||
static void FDECL(vesa_WritePixel, (unsigned x, unsigned y, unsigned color));
|
||||
static void FDECL(vesa_WritePixelRow, (unsigned long offset,
|
||||
unsigned char const *p_row, unsigned p_row_size));
|
||||
static unsigned long FDECL(vesa_MakeColor, (struct Pixel));
|
||||
static void FDECL(vesa_FillRect, (
|
||||
unsigned left, unsigned top,
|
||||
unsigned width, unsigned height,
|
||||
unsigned color));
|
||||
static unsigned long vesa_SetWindow(int window, unsigned long offset);
|
||||
static unsigned long vesa_ReadPixel32(unsigned x, unsigned y);
|
||||
static void vesa_WritePixel32(unsigned x, unsigned y, unsigned long color);
|
||||
static void vesa_WritePixel(unsigned x, unsigned y, unsigned color);
|
||||
static void vesa_WritePixelRow(unsigned long offset,
|
||||
unsigned char const *p_row, unsigned p_row_size);
|
||||
static unsigned long vesa_MakeColor(struct Pixel);
|
||||
static void vesa_FillRect(unsigned left, unsigned top, unsigned width,
|
||||
unsigned height, unsigned color);
|
||||
|
||||
static void NDECL(vesa_redrawmap);
|
||||
static void FDECL(vesa_cliparound, (int, int));
|
||||
static void vesa_redrawmap(void);
|
||||
static void vesa_cliparound(int, int);
|
||||
#if 0
|
||||
static void FDECL(decal_packed, (const struct TileImage *tile, unsigned special));
|
||||
static void decal_packed(const struct TileImage *tile, unsigned special);
|
||||
#endif
|
||||
static void FDECL(vesa_SwitchMode, (unsigned mode));
|
||||
static void NDECL(vesa_SetViewPort);
|
||||
static boolean FDECL(vesa_SetPalette, (const struct Pixel *));
|
||||
static boolean FDECL(vesa_SetHardPalette, (const struct Pixel *));
|
||||
static boolean FDECL(vesa_SetSoftPalette, (const struct Pixel *));
|
||||
static void FDECL(vesa_DisplayCell, (int, int, int));
|
||||
static unsigned FDECL(vesa_FindMode, (unsigned long mode_addr, unsigned bits));
|
||||
static void FDECL(vesa_WriteChar, (int, int, int, int));
|
||||
static void FDECL(vesa_WriteCharXY, (int, int, int, int));
|
||||
static void FDECL(vesa_WriteCharTransparent, (int, int, int, int));
|
||||
static void FDECL(vesa_WriteTextRow, (int pixx, int pixy,
|
||||
struct VesaCharacter const *t_row, unsigned t_row_width));
|
||||
static boolean FDECL(vesa_GetCharPixel, (int, unsigned, unsigned));
|
||||
static unsigned char FDECL(vesa_GetCharPixelRow, (int, unsigned, unsigned));
|
||||
static unsigned long FDECL(vesa_DoublePixels, (unsigned long));
|
||||
static unsigned long FDECL(vesa_TriplePixels, (unsigned long));
|
||||
static void FDECL(vesa_WriteStr, (const char *, int, int, int, int));
|
||||
static unsigned char __far *NDECL(vesa_FontPtrs);
|
||||
static void FDECL(vesa_process_tile, (struct TileImage *tile));
|
||||
static void vesa_SwitchMode(unsigned mode);
|
||||
static void vesa_SetViewPort(void);
|
||||
static boolean vesa_SetPalette(const struct Pixel *);
|
||||
static boolean vesa_SetHardPalette(const struct Pixel *);
|
||||
static boolean vesa_SetSoftPalette(const struct Pixel *);
|
||||
static void vesa_DisplayCell(int, int, int);
|
||||
static unsigned vesa_FindMode(unsigned long mode_addr, unsigned bits);
|
||||
static void vesa_WriteChar(int, int, int, int);
|
||||
static void vesa_WriteCharXY(int, int, int, int);
|
||||
static void vesa_WriteCharTransparent(int, int, int, int);
|
||||
static void vesa_WriteTextRow(int pixx, int pixy,
|
||||
struct VesaCharacter const *t_row, unsigned t_row_width);
|
||||
static boolean vesa_GetCharPixel(int, unsigned, unsigned);
|
||||
static unsigned char vesa_GetCharPixelRow(int, unsigned, unsigned);
|
||||
static unsigned long vesa_DoublePixels(unsigned long);
|
||||
static unsigned long vesa_TriplePixels(unsigned long);
|
||||
static void vesa_WriteStr(const char *, int, int, int, int);
|
||||
static unsigned char __far *vesa_FontPtrs(void);
|
||||
/* static void vesa_process_tile(struct TileImage *tile); */
|
||||
|
||||
#ifdef POSITIONBAR
|
||||
static void NDECL(positionbar);
|
||||
static void positionbar(void);
|
||||
#endif
|
||||
|
||||
extern int clipx, clipxmax; /* current clipping column from wintty.c */
|
||||
@@ -193,9 +190,7 @@ static const struct OldModeInfo old_mode_table[] = {
|
||||
|
||||
/* Retrieve the mode info block */
|
||||
static boolean
|
||||
vesa_GetModeInfo(mode, info)
|
||||
unsigned mode;
|
||||
struct ModeInfoBlock *info;
|
||||
vesa_GetModeInfo(unsigned mode, struct ModeInfoBlock *info)
|
||||
{
|
||||
int mode_info_sel = -1; /* custodial */
|
||||
int mode_info_seg;
|
||||
@@ -266,9 +261,7 @@ vesa_map_frame_buffer(unsigned phys_addr, unsigned size)
|
||||
|
||||
/* Set the memory window and return the offset */
|
||||
static unsigned long
|
||||
vesa_SetWindow(window, offset)
|
||||
int window;
|
||||
unsigned long offset;
|
||||
vesa_SetWindow(int window, unsigned long offset)
|
||||
{
|
||||
/* If the desired offset is already within the window, leave the window
|
||||
as it is and return the address based on the current window position.
|
||||
@@ -311,8 +304,7 @@ unsigned long offset;
|
||||
}
|
||||
|
||||
static unsigned long
|
||||
vesa_ReadPixel32(x, y)
|
||||
unsigned x, y;
|
||||
vesa_ReadPixel32(unsigned x, unsigned y)
|
||||
{
|
||||
unsigned long offset = y * vesa_scan_line + x * vesa_pixel_bytes;
|
||||
unsigned long addr, color;
|
||||
@@ -383,9 +375,7 @@ unsigned x, y;
|
||||
}
|
||||
|
||||
static void
|
||||
vesa_WritePixel32(x, y, color)
|
||||
unsigned x, y;
|
||||
unsigned long color;
|
||||
vesa_WritePixel32(unsigned x, unsigned y, unsigned long color)
|
||||
{
|
||||
unsigned long offset = y * vesa_scan_line + x * vesa_pixel_bytes;
|
||||
unsigned long addr;
|
||||
@@ -451,9 +441,7 @@ unsigned long color;
|
||||
}
|
||||
|
||||
static void
|
||||
vesa_WritePixel(x, y, color)
|
||||
unsigned x, y;
|
||||
unsigned color;
|
||||
vesa_WritePixel(unsigned x, unsigned y, unsigned color)
|
||||
{
|
||||
if (vesa_pixel_size == 8) {
|
||||
vesa_WritePixel32(x, y, color);
|
||||
@@ -463,10 +451,8 @@ unsigned color;
|
||||
}
|
||||
|
||||
static void
|
||||
vesa_WritePixelRow(offset, p_row, p_row_size)
|
||||
unsigned long offset;
|
||||
unsigned char const *p_row;
|
||||
unsigned p_row_size;
|
||||
vesa_WritePixelRow(unsigned long offset,
|
||||
unsigned char const *p_row, unsigned p_row_size)
|
||||
{
|
||||
if (vesa_segment != 0) {
|
||||
/* Linear frame buffer in use */
|
||||
@@ -489,20 +475,19 @@ unsigned p_row_size;
|
||||
}
|
||||
|
||||
static unsigned long
|
||||
vesa_MakeColor(p)
|
||||
struct Pixel p;
|
||||
vesa_MakeColor(struct Pixel p)
|
||||
{
|
||||
unsigned long r = p.r >> vesa_red_shift;
|
||||
unsigned long g = p.g >> vesa_green_shift;
|
||||
unsigned long gr = p.g >> vesa_green_shift;
|
||||
unsigned long b = p.b >> vesa_blue_shift;
|
||||
return (r << vesa_red_pos)
|
||||
| (g << vesa_green_pos)
|
||||
| (gr << vesa_green_pos)
|
||||
| (b << vesa_blue_pos);
|
||||
}
|
||||
|
||||
static void
|
||||
vesa_FillRect(left, top, width, height, color)
|
||||
unsigned left, top, width, height, color;
|
||||
vesa_FillRect(unsigned left, unsigned top, unsigned width,
|
||||
unsigned height, unsigned color)
|
||||
{
|
||||
unsigned p_row_size = width * vesa_pixel_bytes;
|
||||
unsigned char *p_row = (unsigned char *) alloc(p_row_size);
|
||||
@@ -545,14 +530,14 @@ unsigned left, top, width, height, color;
|
||||
}
|
||||
|
||||
void
|
||||
vesa_get_scr_size()
|
||||
vesa_get_scr_size(void)
|
||||
{
|
||||
CO = vesa_x_res / vesa_char_width;
|
||||
LI = vesa_y_res / vesa_char_height - 1;
|
||||
}
|
||||
|
||||
void
|
||||
vesa_backsp()
|
||||
vesa_backsp(void)
|
||||
{
|
||||
int col, row;
|
||||
|
||||
@@ -565,8 +550,7 @@ vesa_backsp()
|
||||
}
|
||||
|
||||
void
|
||||
vesa_clear_screen(colour)
|
||||
int colour;
|
||||
vesa_clear_screen(int colour)
|
||||
{
|
||||
vesa_FillRect(0, 0, vesa_x_res, vesa_y_res, colour);
|
||||
if (iflags.tile_view)
|
||||
@@ -576,8 +560,7 @@ int colour;
|
||||
|
||||
/* clear to end of line */
|
||||
void
|
||||
vesa_cl_end(col, row)
|
||||
int col, row;
|
||||
vesa_cl_end(int col, int row)
|
||||
{
|
||||
unsigned left = vesa_x_center + col * vesa_char_width;
|
||||
unsigned top = vesa_y_center + row * vesa_char_height;
|
||||
@@ -590,8 +573,7 @@ int col, row;
|
||||
|
||||
/* clear to end of screen */
|
||||
void
|
||||
vesa_cl_eos(cy)
|
||||
int cy;
|
||||
vesa_cl_eos(int cy)
|
||||
{
|
||||
cl_end();
|
||||
if (cy < LI - 1) {
|
||||
@@ -605,15 +587,14 @@ int cy;
|
||||
}
|
||||
|
||||
void
|
||||
vesa_tty_end_screen()
|
||||
vesa_tty_end_screen(void)
|
||||
{
|
||||
vesa_clear_screen(BACKGROUND_VESA_COLOR);
|
||||
vesa_SwitchMode(MODETEXT);
|
||||
}
|
||||
|
||||
void
|
||||
vesa_tty_startup(wid, hgt)
|
||||
int *wid, *hgt;
|
||||
vesa_tty_startup(int *wid, int *hgt)
|
||||
{
|
||||
/* code to sense display adapter is required here - MJA */
|
||||
|
||||
@@ -650,9 +631,7 @@ int *wid, *hgt;
|
||||
*/
|
||||
|
||||
void
|
||||
vesa_xputs(s, col, row)
|
||||
const char *s;
|
||||
int col, row;
|
||||
vesa_xputs(const char *s, int col, int row)
|
||||
{
|
||||
if (s != NULL) {
|
||||
vesa_WriteStr(s, strlen(s), col, row, g_attribute);
|
||||
@@ -661,9 +640,7 @@ int col, row;
|
||||
|
||||
/* write out character (and attribute) */
|
||||
void
|
||||
vesa_xputc(ch, attr)
|
||||
char ch;
|
||||
int attr;
|
||||
vesa_xputc(char ch, int attr)
|
||||
{
|
||||
int col, row;
|
||||
|
||||
@@ -690,12 +667,9 @@ int attr;
|
||||
#if defined(USE_TILES)
|
||||
/* Place tile represent. a glyph at current location */
|
||||
void
|
||||
vesa_xputg(glyphnum, ch,
|
||||
special)
|
||||
int glyphnum;
|
||||
int ch;
|
||||
unsigned special; /* special feature: corpse, invis, detected, pet, ridden -
|
||||
hack.h */
|
||||
vesa_xputg(int glyphnum, int ch,
|
||||
unsigned special) /* special feature: corpse, invis, detected, pet, ridden -
|
||||
hack.h */
|
||||
{
|
||||
int col, row;
|
||||
int attr;
|
||||
@@ -747,8 +721,7 @@ unsigned special; /* special feature: corpse, invis, detected, pet, ridden -
|
||||
*/
|
||||
|
||||
void
|
||||
vesa_gotoloc(col, row)
|
||||
int col, row;
|
||||
vesa_gotoloc(int col, int row)
|
||||
{
|
||||
curcol = min(col, CO - 1); /* protection from callers */
|
||||
currow = min(row, LI - 1);
|
||||
@@ -756,8 +729,7 @@ int col, row;
|
||||
|
||||
#if defined(USE_TILES) && defined(CLIPPING)
|
||||
static void
|
||||
vesa_cliparound(x, y)
|
||||
int x, y;
|
||||
vesa_cliparound(int x, int y)
|
||||
{
|
||||
int oldx = clipx, oldy = clipy;
|
||||
|
||||
@@ -796,12 +768,12 @@ int x, y;
|
||||
}
|
||||
|
||||
static void
|
||||
vesa_redrawmap()
|
||||
vesa_redrawmap(void)
|
||||
{
|
||||
unsigned y_top = TOP_MAP_ROW * vesa_char_height;
|
||||
unsigned y_bottom = vesa_y_res - 5 * vesa_char_height;
|
||||
unsigned x, y, cx, cy, px, py;
|
||||
unsigned long color;
|
||||
unsigned x, y, cx, cy, py /*, px */ ;
|
||||
/* unsigned long color; */
|
||||
unsigned long offset = y_top * (unsigned long) vesa_scan_line;
|
||||
unsigned char *p_row = NULL;
|
||||
unsigned p_row_width;
|
||||
@@ -813,9 +785,9 @@ vesa_redrawmap()
|
||||
if (iflags.traditional_view) {
|
||||
/* Text mode */
|
||||
y = y_top;
|
||||
for (cy = clipy; cy <= clipymax && cy < ROWNO; ++cy) {
|
||||
for (cy = clipy; cy <= (unsigned) clipymax && cy < ROWNO; ++cy) {
|
||||
struct VesaCharacter t_row[COLNO];
|
||||
for (cx = clipx; cx <= clipxmax && cx < COLNO; ++cx) {
|
||||
for (cx = clipx; cx <= (unsigned) clipxmax && cx < COLNO; ++cx) {
|
||||
t_row[cx].chr = map[cy][cx].ch;
|
||||
t_row[cx].colour = map[cy][cx].attr;
|
||||
}
|
||||
@@ -852,9 +824,9 @@ vesa_redrawmap()
|
||||
|
||||
p_row_width = iflags.wc_tile_width * vesa_pixel_bytes;
|
||||
y = y_top;
|
||||
for (cy = clipy; cy <= clipymax && cy < ROWNO; ++cy) {
|
||||
for (py = 0; py < iflags.wc_tile_height; ++py) {
|
||||
for (cx = clipx; cx <= clipxmax && cx < COLNO; ++cx) {
|
||||
for (cy = clipy; cy <= (unsigned) clipymax && cy < ROWNO; ++cy) {
|
||||
for (py = 0; py < (unsigned) iflags.wc_tile_height; ++py) {
|
||||
for (cx = clipx; cx <= (unsigned) clipxmax && cx < COLNO; ++cx) {
|
||||
tile = vesa_tiles[glyph2tile[map[cy][cx].glyph]];
|
||||
vesa_WritePixelRow(offset + p_row_width * (cx - clipx), tile + p_row_width * py, p_row_width);
|
||||
}
|
||||
@@ -877,8 +849,7 @@ vesa_redrawmap()
|
||||
#endif /* USE_TILES && CLIPPING */
|
||||
|
||||
void
|
||||
vesa_userpan(pan)
|
||||
enum vga_pan_direction pan;
|
||||
vesa_userpan(enum vga_pan_direction pan)
|
||||
{
|
||||
/* pline("Into userpan"); */
|
||||
if (iflags.over_view || iflags.traditional_view)
|
||||
@@ -934,8 +905,7 @@ enum vga_pan_direction pan;
|
||||
}
|
||||
|
||||
void
|
||||
vesa_overview(on)
|
||||
boolean on;
|
||||
vesa_overview(boolean on)
|
||||
{
|
||||
/* vesa_HideCursor(); */
|
||||
if (on) {
|
||||
@@ -968,8 +938,7 @@ boolean on;
|
||||
}
|
||||
|
||||
void
|
||||
vesa_traditional(on)
|
||||
boolean on;
|
||||
vesa_traditional(boolean on)
|
||||
{
|
||||
/* vesa_HideCursor(); */
|
||||
if (on) {
|
||||
@@ -1005,7 +974,7 @@ boolean on;
|
||||
}
|
||||
|
||||
void
|
||||
vesa_refresh()
|
||||
vesa_refresh(void)
|
||||
{
|
||||
positionbar();
|
||||
vesa_redrawmap();
|
||||
@@ -1014,9 +983,7 @@ vesa_refresh()
|
||||
|
||||
#if 0
|
||||
static void
|
||||
decal_packed(gp, special)
|
||||
const struct TileImage *gp;
|
||||
unsigned special;
|
||||
decal_packed(const struct TileImage *gp, unsigned special)
|
||||
{
|
||||
/* FIXME: the tile array is fixed in memory and should not be changed;
|
||||
if we ever implement this, we'll have to copy the pixels */
|
||||
@@ -1114,13 +1081,13 @@ vesa_Init(void)
|
||||
|
||||
/* Set the size of the tiles for the overview mode */
|
||||
vesa_oview_width = vesa_x_res / COLNO;
|
||||
if (vesa_oview_width > iflags.wc_tile_width) {
|
||||
vesa_oview_width = iflags.wc_tile_width;
|
||||
if (vesa_oview_width > (unsigned) iflags.wc_tile_width) {
|
||||
vesa_oview_width = (unsigned) iflags.wc_tile_width;
|
||||
}
|
||||
vesa_oview_height = (vesa_y_res - (TOP_MAP_ROW + 4) * vesa_char_height)
|
||||
/ ROWNO;
|
||||
if (vesa_oview_height > iflags.wc_tile_height) {
|
||||
vesa_oview_height = iflags.wc_tile_height;
|
||||
if (vesa_oview_height > (unsigned) iflags.wc_tile_height) {
|
||||
vesa_oview_height = (unsigned) iflags.wc_tile_height;
|
||||
}
|
||||
|
||||
/* Use the map font size to set the font size */
|
||||
@@ -1146,7 +1113,7 @@ vesa_Init(void)
|
||||
num_pixels = iflags.wc_tile_width * iflags.wc_tile_height;
|
||||
num_oview_pixels = vesa_oview_width * vesa_oview_height;
|
||||
set_tile_type(vesa_pixel_size > 8);
|
||||
for (i = 0; i < total_tiles_used; ++i) {
|
||||
for (i = 0; i < (unsigned) total_tiles_used; ++i) {
|
||||
const struct TileImage *tile = get_tile(i);
|
||||
struct TileImage *ov_tile = stretch_tile(tile, vesa_oview_width, vesa_oview_height);
|
||||
unsigned j;
|
||||
@@ -1200,7 +1167,7 @@ vesa_Init(void)
|
||||
|
||||
/* Set the size of the map viewport */
|
||||
static void
|
||||
vesa_SetViewPort()
|
||||
vesa_SetViewPort(void)
|
||||
{
|
||||
unsigned y_reserved = (TOP_MAP_ROW + 5) * vesa_char_height;
|
||||
unsigned y_map = vesa_y_res - y_reserved;
|
||||
@@ -1220,8 +1187,7 @@ vesa_SetViewPort()
|
||||
*
|
||||
*/
|
||||
static void
|
||||
vesa_SwitchMode(mode)
|
||||
unsigned mode;
|
||||
vesa_SwitchMode(unsigned mode)
|
||||
{
|
||||
__dpmi_regs regs;
|
||||
|
||||
@@ -1307,7 +1273,7 @@ vesa_FontPtrs(void)
|
||||
* returns a VbeInfoBlock describing the features of the VESA BIOS.
|
||||
*/
|
||||
int
|
||||
vesa_detect()
|
||||
vesa_detect(void)
|
||||
{
|
||||
int vbe_info_sel = -1; /* custodial */
|
||||
int vbe_info_seg;
|
||||
@@ -1489,9 +1455,7 @@ error:
|
||||
}
|
||||
|
||||
static unsigned
|
||||
vesa_FindMode(mode_addr, bits)
|
||||
unsigned long mode_addr;
|
||||
unsigned bits;
|
||||
vesa_FindMode(unsigned long mode_addr, unsigned bits)
|
||||
{
|
||||
unsigned selected_mode;
|
||||
struct ModeInfoBlock mode_info0, mode_info;
|
||||
@@ -1542,8 +1506,7 @@ unsigned bits;
|
||||
*
|
||||
*/
|
||||
static void
|
||||
vesa_WriteChar(chr, col, row, colour)
|
||||
int chr, col, row, colour;
|
||||
vesa_WriteChar(int chr, int col, int row, int colour)
|
||||
{
|
||||
int pixx, pixy;
|
||||
|
||||
@@ -1562,17 +1525,16 @@ int chr, col, row, colour;
|
||||
* transparency
|
||||
*/
|
||||
static void
|
||||
vesa_WriteCharXY(chr, pixx, pixy, colour)
|
||||
int chr, pixx, pixy, colour;
|
||||
vesa_WriteCharXY(int chr, int pixx, int pixy, int colour)
|
||||
{
|
||||
/* Flush if cache is full or if not contiguous to the last character */
|
||||
if (chr_cache_size >= SIZE(chr_cache)) {
|
||||
vesa_flush_text();
|
||||
}
|
||||
if (chr_cache_size != 0 && chr_cache_lastx + vesa_char_width != pixx) {
|
||||
if (chr_cache_size != 0 && chr_cache_lastx + vesa_char_width != (unsigned) pixx) {
|
||||
vesa_flush_text();
|
||||
}
|
||||
if (chr_cache_size != 0 && chr_cache_pixy != pixy) {
|
||||
if (chr_cache_size != 0 && chr_cache_pixy != (unsigned) pixy) {
|
||||
vesa_flush_text();
|
||||
}
|
||||
/* Add to cache and write later */
|
||||
@@ -1591,13 +1553,12 @@ int chr, pixx, pixy, colour;
|
||||
* Don't bother cacheing; only the position bar and the cursor use this
|
||||
*/
|
||||
static void
|
||||
vesa_WriteCharTransparent(chr, pixx, pixy, colour)
|
||||
int chr, pixx, pixy, colour;
|
||||
vesa_WriteCharTransparent(int chr, int pixx, int pixy, int colour)
|
||||
{
|
||||
int px, py;
|
||||
|
||||
for (py = 0; py < vesa_char_height; ++py) {
|
||||
for (px = 0; px < vesa_char_width; ++px) {
|
||||
for (py = 0; py < (int) vesa_char_height; ++py) {
|
||||
for (px = 0; px < (int) vesa_char_width; ++px) {
|
||||
if (vesa_GetCharPixel(chr, px, py)) {
|
||||
vesa_WritePixel(pixx + px, pixy + py, colour + FIRST_TEXT_COLOR);
|
||||
}
|
||||
@@ -1606,7 +1567,7 @@ int chr, pixx, pixy, colour;
|
||||
}
|
||||
|
||||
void
|
||||
vesa_flush_text()
|
||||
vesa_flush_text(void)
|
||||
{
|
||||
if (chr_cache_size == 0) return;
|
||||
|
||||
@@ -1615,10 +1576,8 @@ vesa_flush_text()
|
||||
}
|
||||
|
||||
static void
|
||||
vesa_WriteTextRow(pixx, pixy, t_row, t_row_width)
|
||||
int pixx, pixy;
|
||||
struct VesaCharacter const *t_row;
|
||||
unsigned t_row_width;
|
||||
vesa_WriteTextRow(int pixx, int pixy, struct VesaCharacter const *t_row,
|
||||
unsigned t_row_width)
|
||||
{
|
||||
int x, px, py;
|
||||
unsigned i;
|
||||
@@ -1639,7 +1598,7 @@ unsigned t_row_width;
|
||||
}
|
||||
|
||||
/* First loop: draw one raster line of all row entries */
|
||||
for (py = 0; py < vesa_char_height; ++py) {
|
||||
for (py = 0; py < (int) vesa_char_height; ++py) {
|
||||
/* Second loop: draw one raster line of one character */
|
||||
x = 0;
|
||||
for (i = 0; i < t_row_width; ++i) {
|
||||
@@ -1656,7 +1615,7 @@ unsigned t_row_width;
|
||||
fg[3] = (pix >> 24) & 0xFF;
|
||||
}
|
||||
/* Third loop: draw eight pixels */
|
||||
for (px = 0; px < vesa_char_width; px += 8) {
|
||||
for (px = 0; px < (int) vesa_char_width; px += 8) {
|
||||
/* Fourth loop: draw one pixel */
|
||||
int px2;
|
||||
unsigned char fnt = vesa_GetCharPixelRow(chr, px, py);
|
||||
@@ -1682,9 +1641,7 @@ unsigned t_row_width;
|
||||
}
|
||||
|
||||
static boolean
|
||||
vesa_GetCharPixel(ch, x, y)
|
||||
int ch;
|
||||
unsigned x, y;
|
||||
vesa_GetCharPixel(int ch, unsigned x, unsigned y)
|
||||
{
|
||||
unsigned x2;
|
||||
unsigned char fnt;
|
||||
@@ -1696,9 +1653,7 @@ unsigned x, y;
|
||||
}
|
||||
|
||||
static unsigned char
|
||||
vesa_GetCharPixelRow(ch, x, y)
|
||||
int ch;
|
||||
unsigned x, y;
|
||||
vesa_GetCharPixelRow(int ch, unsigned x, unsigned y)
|
||||
{
|
||||
unsigned x1;
|
||||
unsigned char fnt;
|
||||
@@ -1736,8 +1691,7 @@ unsigned x, y;
|
||||
|
||||
/* Scale font pixels horizontally */
|
||||
static unsigned long
|
||||
vesa_DoublePixels(fnt)
|
||||
unsigned long fnt;
|
||||
vesa_DoublePixels(unsigned long fnt)
|
||||
{
|
||||
static const unsigned char double_bits[] = {
|
||||
0x00, 0x03, 0x0C, 0x0F,
|
||||
@@ -1757,8 +1711,7 @@ unsigned long fnt;
|
||||
}
|
||||
|
||||
static unsigned long
|
||||
vesa_TriplePixels(fnt)
|
||||
unsigned long fnt;
|
||||
vesa_TriplePixels(unsigned long fnt)
|
||||
{
|
||||
static const unsigned short triple_bits[] = {
|
||||
00000, 00007, 00070, 00077,
|
||||
@@ -1787,14 +1740,12 @@ unsigned long fnt;
|
||||
*
|
||||
*/
|
||||
static void
|
||||
vesa_DisplayCell(tilenum, col, row)
|
||||
int tilenum;
|
||||
int col, row;
|
||||
vesa_DisplayCell(int tilenum, int col, int row)
|
||||
{
|
||||
unsigned char const *tile;
|
||||
unsigned t_width, t_height;
|
||||
unsigned char const *tptr;
|
||||
int px, py, pixx, pixy;
|
||||
int /* px, */ py, pixx, pixy;
|
||||
unsigned long offset;
|
||||
unsigned p_row_width;
|
||||
|
||||
@@ -1817,7 +1768,7 @@ int col, row;
|
||||
offset = pixy * (unsigned long)vesa_scan_line + pixx * vesa_pixel_bytes;
|
||||
tptr = tile;
|
||||
|
||||
for (py = 0; py < t_height; ++py) {
|
||||
for (py = 0; py < (int) t_height; ++py) {
|
||||
vesa_WritePixelRow(offset, tptr, p_row_width);
|
||||
offset += vesa_scan_line;
|
||||
tptr += p_row_width;
|
||||
@@ -1830,9 +1781,7 @@ int col, row;
|
||||
*
|
||||
*/
|
||||
static void
|
||||
vesa_WriteStr(s, len, col, row, colour)
|
||||
const char *s;
|
||||
int len, col, row, colour;
|
||||
vesa_WriteStr(const char *s, int len, int col, int row, int colour)
|
||||
{
|
||||
const unsigned char *us;
|
||||
int i = 0;
|
||||
@@ -1859,8 +1808,7 @@ int len, col, row, colour;
|
||||
*
|
||||
*/
|
||||
static boolean
|
||||
vesa_SetPalette(palette)
|
||||
const struct Pixel *palette;
|
||||
vesa_SetPalette(const struct Pixel *palette)
|
||||
{
|
||||
if (vesa_pixel_size == 8) {
|
||||
return vesa_SetHardPalette(palette);
|
||||
@@ -1870,8 +1818,7 @@ const struct Pixel *palette;
|
||||
}
|
||||
|
||||
static boolean
|
||||
vesa_SetHardPalette(palette)
|
||||
const struct Pixel *palette;
|
||||
vesa_SetHardPalette(const struct Pixel *palette)
|
||||
{
|
||||
int palette_sel = -1; /* custodial */
|
||||
int palette_seg;
|
||||
@@ -1958,8 +1905,7 @@ error:
|
||||
}
|
||||
|
||||
static boolean
|
||||
vesa_SetSoftPalette(palette)
|
||||
const struct Pixel *palette;
|
||||
vesa_SetSoftPalette(const struct Pixel *palette)
|
||||
{
|
||||
const struct Pixel *p;
|
||||
unsigned i;
|
||||
@@ -1993,8 +1939,7 @@ const struct Pixel *palette;
|
||||
static unsigned char pbar[COLNO];
|
||||
|
||||
void
|
||||
vesa_update_positionbar(posbar)
|
||||
char *posbar;
|
||||
vesa_update_positionbar(char *posbar)
|
||||
{
|
||||
unsigned char *p = pbar;
|
||||
if (posbar)
|
||||
@@ -2004,7 +1949,7 @@ char *posbar;
|
||||
}
|
||||
|
||||
static void
|
||||
positionbar()
|
||||
positionbar(void)
|
||||
{
|
||||
unsigned char *posbar = pbar;
|
||||
int feature, ucol;
|
||||
@@ -2084,7 +2029,7 @@ positionbar()
|
||||
#ifdef SIMULATE_CURSOR
|
||||
|
||||
void
|
||||
vesa_DrawCursor()
|
||||
vesa_DrawCursor(void)
|
||||
{
|
||||
static boolean last_inmap = FALSE;
|
||||
unsigned x, y, left, top, right, bottom, width, height;
|
||||
@@ -2111,7 +2056,8 @@ vesa_DrawCursor()
|
||||
x = min(curcol, (CO - 1)); /* protection from callers */
|
||||
y = min(currow, (LI - 1)); /* protection from callers */
|
||||
if (!halfwidth
|
||||
&& ((x < clipx) || (x > clipxmax) || (y < clipy) || (y > clipymax)))
|
||||
&& ((x < (unsigned) clipx) || (x > (unsigned) clipxmax)
|
||||
|| (y < (unsigned) clipy) || (y > (unsigned) clipymax)))
|
||||
return;
|
||||
if (inmap) {
|
||||
x -= clipx;
|
||||
@@ -2198,7 +2144,7 @@ vesa_DrawCursor()
|
||||
}
|
||||
|
||||
void
|
||||
vesa_HideCursor()
|
||||
vesa_HideCursor(void)
|
||||
{
|
||||
unsigned x, y, left, top, width, height;
|
||||
boolean isrogue = Is_rogue_level(&u.uz);
|
||||
@@ -2213,7 +2159,9 @@ vesa_HideCursor()
|
||||
x = min(curcol, (CO - 1)); /* protection from callers */
|
||||
y = min(currow, (LI - 1)); /* protection from callers */
|
||||
if (!halfwidth
|
||||
&& ((x < clipx) || (x > clipxmax) || (y < clipy) || (y > clipymax)))
|
||||
&& ((x < (unsigned) clipx) || (x > (unsigned) clipxmax)
|
||||
|| (y < (unsigned) clipy)
|
||||
|| (y > (unsigned) clipymax)))
|
||||
return;
|
||||
if (inmap) {
|
||||
x -= clipx;
|
||||
|
||||
@@ -92,7 +92,7 @@
|
||||
#if _MSC_VER >= 700
|
||||
#pragma warning(disable : 4018) /* signed/unsigned mismatch */
|
||||
#pragma warning(disable : 4127) /* conditional expression is constant */
|
||||
#pragma warning(disable : 4131) /* old style declarator */
|
||||
/* #pragma warning(disable : 4131) */ /* old style declarator */
|
||||
#pragma warning(disable : 4305) /* prevents complaints with MK_FP */
|
||||
#pragma warning(disable : 4309) /* initializing */
|
||||
#if _MSC_VER > 700
|
||||
@@ -104,33 +104,34 @@
|
||||
|
||||
extern short glyph2tile[];
|
||||
|
||||
/* static void FDECL(vga_NoBorder, (int)); */
|
||||
void FDECL(vga_gotoloc, (int, int)); /* This should be made a macro */
|
||||
void NDECL(vga_backsp);
|
||||
/* static void vga_NoBorder(int); */
|
||||
void vga_gotoloc(int, int); /* This should be made a macro */
|
||||
void vga_backsp(void);
|
||||
|
||||
#ifdef SCROLLMAP
|
||||
static void FDECL(vga_scrollmap, (BOOLEAN_P));
|
||||
static void vga_scrollmap(boolean);
|
||||
#endif
|
||||
static void FDECL(vga_redrawmap, (BOOLEAN_P));
|
||||
static void FDECL(vga_cliparound, (int, int));
|
||||
static void FDECL(decal_planar, (struct planar_cell_struct *, unsigned));
|
||||
static void vga_redrawmap(boolean);
|
||||
static void vga_cliparound(int, int);
|
||||
static void decal_planar(struct planar_cell_struct *, unsigned);
|
||||
|
||||
#ifdef POSITIONBAR
|
||||
static void NDECL(positionbar);
|
||||
static void FDECL(vga_special, (int, int, int));
|
||||
static void positionbar(void);
|
||||
static void vga_special(int, int, int);
|
||||
#endif
|
||||
|
||||
static void FDECL(vga_DisplayCell, (struct planar_cell_struct *, int, int));
|
||||
static void FDECL(vga_DisplayCell_O,
|
||||
(struct overview_planar_cell_struct *, int, int));
|
||||
static void FDECL(vga_SwitchMode, (unsigned int));
|
||||
static void FDECL(vga_SetPalette, (const struct Pixel *));
|
||||
static void FDECL(vga_WriteChar, (int, int, int, int));
|
||||
static void FDECL(vga_WriteStr, (char *, int, int, int, int));
|
||||
static void vga_DisplayCell(struct planar_cell_struct *, int, int);
|
||||
static void vga_DisplayCell_O(struct overview_planar_cell_struct *, int,
|
||||
int);
|
||||
static void vga_SwitchMode(unsigned int);
|
||||
static void vga_SetPalette(const struct Pixel *);
|
||||
static void vga_WriteChar(int, int, int, int);
|
||||
static void vga_WriteStr(char *, int, int, int, int);
|
||||
|
||||
static void FDECL(read_planar_tile, (unsigned, struct planar_cell_struct *));
|
||||
static void FDECL(read_planar_tile_O,
|
||||
(unsigned, struct overview_planar_cell_struct *));
|
||||
static void FDECL(read_tile_indexes, (unsigned, unsigned char (*)[TILE_X]));
|
||||
static void read_planar_tile(unsigned, struct planar_cell_struct *);
|
||||
static void read_planar_tile_O(unsigned,
|
||||
struct overview_planar_cell_struct *);
|
||||
static void read_tile_indexes(unsigned, unsigned char (*)[TILE_X]);
|
||||
|
||||
extern int clipx, clipxmax; /* current clipping column from wintty.c */
|
||||
extern boolean clipping; /* clipping on? from wintty.c */
|
||||
@@ -208,14 +209,14 @@ static struct overview_planar_cell_struct planecell_O;
|
||||
/* static int g_attribute; */ /* Current attribute to use */
|
||||
|
||||
void
|
||||
vga_get_scr_size()
|
||||
vga_get_scr_size(void)
|
||||
{
|
||||
CO = 80;
|
||||
LI = 29;
|
||||
}
|
||||
|
||||
void
|
||||
vga_backsp()
|
||||
vga_backsp(void)
|
||||
{
|
||||
int col, row;
|
||||
|
||||
@@ -228,8 +229,7 @@ vga_backsp()
|
||||
}
|
||||
|
||||
void
|
||||
vga_clear_screen(colour)
|
||||
int colour;
|
||||
vga_clear_screen(int colour)
|
||||
{
|
||||
unsigned long __far *pch;
|
||||
unsigned j;
|
||||
@@ -250,8 +250,8 @@ int colour;
|
||||
vga_gotoloc(0, 0); /* is this needed? */
|
||||
}
|
||||
|
||||
void vga_cl_end(col, row) /* clear to end of line */
|
||||
int col, row;
|
||||
/* clear to end of line */
|
||||
void vga_cl_end(int col, int row)
|
||||
{
|
||||
int count;
|
||||
|
||||
@@ -265,8 +265,8 @@ int col, row;
|
||||
}
|
||||
}
|
||||
|
||||
void vga_cl_eos(cy) /* clear to end of screen */
|
||||
int cy;
|
||||
/* clear to end of screen */
|
||||
void vga_cl_eos(int cy)
|
||||
{
|
||||
int count;
|
||||
|
||||
@@ -280,15 +280,14 @@ int cy;
|
||||
}
|
||||
|
||||
void
|
||||
vga_tty_end_screen()
|
||||
vga_tty_end_screen(void)
|
||||
{
|
||||
vga_clear_screen(BACKGROUND_VGA_COLOR);
|
||||
vga_SwitchMode(MODETEXT);
|
||||
}
|
||||
|
||||
void
|
||||
vga_tty_startup(wid, hgt)
|
||||
int *wid, *hgt;
|
||||
vga_tty_startup(int *wid, int *hgt)
|
||||
{
|
||||
/* code to sense display adapter is required here - MJA */
|
||||
|
||||
@@ -325,18 +324,15 @@ int *wid, *hgt;
|
||||
*/
|
||||
|
||||
void
|
||||
vga_xputs(s, col, row)
|
||||
const char *s;
|
||||
int col, row;
|
||||
vga_xputs(const char *s, int col, int row)
|
||||
{
|
||||
if (s != (char *) 0) {
|
||||
vga_WriteStr((char *) s, strlen(s), col, row, g_attribute);
|
||||
}
|
||||
}
|
||||
|
||||
void vga_xputc(ch, attr) /* write out character (and attribute) */
|
||||
char ch;
|
||||
int attr;
|
||||
/* write out character (and attribute) */
|
||||
void vga_xputc(char ch, int attr)
|
||||
{
|
||||
int col, row;
|
||||
|
||||
@@ -358,13 +354,11 @@ int attr;
|
||||
}
|
||||
|
||||
#if defined(USE_TILES)
|
||||
/* Place tile represent. a glyph at current location */
|
||||
void
|
||||
vga_xputg(glyphnum, ch,
|
||||
special) /* Place tile represent. a glyph at current location */
|
||||
int glyphnum;
|
||||
int ch;
|
||||
unsigned special; /* special feature: corpse, invis, detected, pet, ridden -
|
||||
hack.h */
|
||||
vga_xputg(int glyphnum, int ch,
|
||||
unsigned special) /* special feature: corpse, invis, detected, pet, ridden -
|
||||
hack.h */
|
||||
{
|
||||
int col, row;
|
||||
int attr;
|
||||
@@ -418,8 +412,7 @@ unsigned special; /* special feature: corpse, invis, detected, pet, ridden -
|
||||
*/
|
||||
|
||||
void
|
||||
vga_gotoloc(col, row)
|
||||
int col, row;
|
||||
vga_gotoloc(int col, int row)
|
||||
{
|
||||
curcol = min(col, CO - 1); /* protection from callers */
|
||||
currow = min(row, LI - 1);
|
||||
@@ -427,8 +420,7 @@ int col, row;
|
||||
|
||||
#if defined(USE_TILES) && defined(CLIPPING)
|
||||
static void
|
||||
vga_cliparound(x, y)
|
||||
int x, y;
|
||||
vga_cliparound(int x, int y UNUSED)
|
||||
{
|
||||
int oldx = clipx;
|
||||
|
||||
@@ -450,8 +442,7 @@ int x, y;
|
||||
}
|
||||
|
||||
static void
|
||||
vga_redrawmap(clearfirst)
|
||||
boolean clearfirst;
|
||||
vga_redrawmap(boolean clearfirst)
|
||||
{
|
||||
int x, y, t;
|
||||
unsigned long __far *pch;
|
||||
@@ -501,8 +492,7 @@ boolean clearfirst;
|
||||
#endif /* USE_TILES && CLIPPING */
|
||||
|
||||
void
|
||||
vga_userpan(pan)
|
||||
enum vga_pan_direction pan;
|
||||
vga_userpan(enum vga_pan_direction pan)
|
||||
{
|
||||
int x;
|
||||
|
||||
@@ -521,8 +511,7 @@ enum vga_pan_direction pan;
|
||||
}
|
||||
|
||||
void
|
||||
vga_overview(on)
|
||||
boolean on;
|
||||
vga_overview(boolean on)
|
||||
{
|
||||
/* vga_HideCursor(); */
|
||||
if (on) {
|
||||
@@ -539,8 +528,7 @@ boolean on;
|
||||
}
|
||||
|
||||
void
|
||||
vga_traditional(on)
|
||||
boolean on;
|
||||
vga_traditional(boolean on)
|
||||
{
|
||||
/* vga_HideCursor(); */
|
||||
if (on) {
|
||||
@@ -560,7 +548,7 @@ boolean on;
|
||||
}
|
||||
|
||||
void
|
||||
vga_refresh()
|
||||
vga_refresh(void)
|
||||
{
|
||||
positionbar();
|
||||
vga_redrawmap(1);
|
||||
@@ -632,9 +620,7 @@ boolean left;
|
||||
#endif /* SCROLLMAP */
|
||||
|
||||
static void
|
||||
read_planar_tile(glyph, cell)
|
||||
unsigned glyph;
|
||||
struct planar_cell_struct *cell;
|
||||
read_planar_tile(unsigned glyph, struct planar_cell_struct *cell)
|
||||
{
|
||||
unsigned char indexes[TILE_Y][TILE_X];
|
||||
unsigned plane, y, byte, bit;
|
||||
@@ -658,9 +644,7 @@ struct planar_cell_struct *cell;
|
||||
}
|
||||
|
||||
static void
|
||||
read_planar_tile_O(glyph, cell)
|
||||
unsigned glyph;
|
||||
struct overview_planar_cell_struct *cell;
|
||||
read_planar_tile_O(unsigned glyph, struct overview_planar_cell_struct *cell)
|
||||
{
|
||||
unsigned char indexes[TILE_Y][TILE_X];
|
||||
unsigned plane, y, bit;
|
||||
@@ -682,9 +666,7 @@ struct overview_planar_cell_struct *cell;
|
||||
}
|
||||
|
||||
static void
|
||||
read_tile_indexes(glyph, indexes)
|
||||
unsigned glyph;
|
||||
unsigned char (*indexes)[TILE_X];
|
||||
read_tile_indexes(unsigned glyph, unsigned char (*indexes)[TILE_X])
|
||||
{
|
||||
const struct TileImage *tile;
|
||||
unsigned x, y;
|
||||
@@ -708,7 +690,6 @@ unsigned char (*indexes)[TILE_X];
|
||||
tile = get_tile(tilenum);
|
||||
|
||||
/* Map to a 16 bit palette; assume colors laid out as in default tileset */
|
||||
memset(indexes, 0, sizeof(indexes));
|
||||
for (y = 0; y < TILE_Y && y < tile->height; ++y) {
|
||||
for (x = 0; x < TILE_X && x < tile->width; ++x) {
|
||||
unsigned i = tile->indexes[y * tile->width + x];
|
||||
@@ -725,9 +706,7 @@ unsigned char (*indexes)[TILE_X];
|
||||
}
|
||||
|
||||
static void
|
||||
decal_planar(gp, special)
|
||||
struct planar_cell_struct *gp;
|
||||
unsigned special;
|
||||
decal_planar(struct planar_cell_struct *gp UNUSED, unsigned special)
|
||||
{
|
||||
if (special & MG_CORPSE) {
|
||||
} else if (special & MG_INVIS) {
|
||||
@@ -798,7 +777,7 @@ vga_Init(void)
|
||||
#endif
|
||||
vga_SetPalette(paletteptr);
|
||||
g_attribute = attrib_gr_normal;
|
||||
font = vga_FontPtrs();
|
||||
font = (unsigned char __far *) vga_FontPtrs();
|
||||
clear_screen();
|
||||
clipx = 0;
|
||||
clipxmax = clipx + (viewport_size - 1);
|
||||
@@ -907,7 +886,7 @@ vga_FontPtrs(void)
|
||||
* 0xB=MCGA(mono-monitor), 0xC=MCGA(color-monitor), 0xFF=unknown)
|
||||
*/
|
||||
int
|
||||
vga_detect()
|
||||
vga_detect(void)
|
||||
{
|
||||
union REGS regs;
|
||||
|
||||
@@ -935,8 +914,7 @@ vga_detect()
|
||||
*
|
||||
*/
|
||||
static void
|
||||
vga_WriteChar(chr, col, row, colour)
|
||||
int chr, col, row, colour;
|
||||
vga_WriteChar(int chr, int col, int row, int colour)
|
||||
{
|
||||
int i;
|
||||
int x, pixy;
|
||||
@@ -999,9 +977,7 @@ int chr, col, row, colour;
|
||||
*
|
||||
*/
|
||||
static void
|
||||
vga_DisplayCell(gp, col, row)
|
||||
struct planar_cell_struct *gp;
|
||||
int col, row;
|
||||
vga_DisplayCell(struct planar_cell_struct *gp, int col, int row)
|
||||
{
|
||||
int i, pixx, pixy;
|
||||
char __far *tmp_s; /* source pointer */
|
||||
@@ -1030,9 +1006,7 @@ int col, row;
|
||||
}
|
||||
|
||||
static void
|
||||
vga_DisplayCell_O(gp, col, row)
|
||||
struct overview_planar_cell_struct *gp;
|
||||
int col, row;
|
||||
vga_DisplayCell_O(struct overview_planar_cell_struct *gp, int col, int row)
|
||||
{
|
||||
int i, pixx, pixy;
|
||||
char __far *tmp_s; /* source pointer */
|
||||
@@ -1063,9 +1037,7 @@ int col, row;
|
||||
*
|
||||
*/
|
||||
static void
|
||||
vga_WriteStr(s, len, col, row, colour)
|
||||
char *s;
|
||||
int len, col, row, colour;
|
||||
vga_WriteStr(char *s, int len, int col, int row, int colour)
|
||||
{
|
||||
unsigned char *us;
|
||||
int i = 0;
|
||||
@@ -1091,8 +1063,7 @@ int len, col, row, colour;
|
||||
*
|
||||
*/
|
||||
static void
|
||||
vga_SetPalette(p)
|
||||
const struct Pixel *p;
|
||||
vga_SetPalette(const struct Pixel *p)
|
||||
{
|
||||
union REGS regs;
|
||||
int i;
|
||||
@@ -1127,20 +1098,24 @@ static unsigned char colorbits[] = { 0x08, 0x04, 0x02, 0x01 };
|
||||
static unsigned char pbar[COLNO];
|
||||
|
||||
void
|
||||
vga_update_positionbar(posbar)
|
||||
char *posbar;
|
||||
vga_update_positionbar(char *posbar)
|
||||
{
|
||||
char *p = pbar;
|
||||
char *p = (char *) pbar;
|
||||
if (posbar)
|
||||
while (*posbar)
|
||||
*p++ = *posbar++;
|
||||
*p = 0;
|
||||
}
|
||||
|
||||
#ifdef __DJGPP__
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wunused-but-set-variable"
|
||||
#endif /* __DJGPP__ */
|
||||
|
||||
static void
|
||||
positionbar()
|
||||
positionbar(void)
|
||||
{
|
||||
char *posbar = pbar;
|
||||
char *posbar = (char *) pbar;
|
||||
int feature, ucol;
|
||||
int k, y, colour, row;
|
||||
char __far *pch;
|
||||
@@ -1238,9 +1213,12 @@ positionbar()
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef __DJGPP__
|
||||
#pragma GCC diagnostic pop
|
||||
#endif /* __DJGPP__ */
|
||||
|
||||
void
|
||||
vga_special(chr, col, color)
|
||||
int chr, col, color;
|
||||
vga_special(int chr, int col, int color)
|
||||
{
|
||||
int i, y, pixy;
|
||||
char __far *tmp_d; /* destination pointer */
|
||||
@@ -1272,7 +1250,6 @@ int chr, col, color;
|
||||
}
|
||||
egawriteplane(15);
|
||||
}
|
||||
|
||||
#endif /*POSITIONBAR*/
|
||||
|
||||
#ifdef SIMULATE_CURSOR
|
||||
@@ -1281,7 +1258,7 @@ static struct planar_cell_struct undercursor;
|
||||
static struct planar_cell_struct cursor;
|
||||
|
||||
void
|
||||
vga_DrawCursor()
|
||||
vga_DrawCursor(void)
|
||||
{
|
||||
int i, pixx, pixy, x, y, p;
|
||||
char __far *tmp1;
|
||||
@@ -1496,7 +1473,7 @@ vga_DrawCursor()
|
||||
}
|
||||
|
||||
void
|
||||
vga_HideCursor()
|
||||
vga_HideCursor(void)
|
||||
{
|
||||
int i, pixx, pixy, x, y;
|
||||
char __far *tmp1;
|
||||
|
||||
@@ -75,17 +75,17 @@ struct termio termio;
|
||||
#endif
|
||||
|
||||
#ifdef _M_UNIX
|
||||
extern void NDECL(sco_mapon);
|
||||
extern void NDECL(sco_mapoff);
|
||||
extern void sco_mapon(void);
|
||||
extern void sco_mapoff(void);
|
||||
#endif
|
||||
#ifdef __linux__
|
||||
extern void NDECL(linux_mapon);
|
||||
extern void NDECL(linux_mapoff);
|
||||
extern void linux_mapon(void);
|
||||
extern void linux_mapoff(void);
|
||||
#endif
|
||||
|
||||
#ifdef AUX
|
||||
void
|
||||
catch_stp()
|
||||
catch_stp(void)
|
||||
{
|
||||
signal(SIGTSTP, SIG_DFL);
|
||||
dosuspend();
|
||||
@@ -93,7 +93,7 @@ catch_stp()
|
||||
#endif /* AUX */
|
||||
|
||||
void
|
||||
getwindowsz()
|
||||
getwindowsz(void)
|
||||
{
|
||||
#ifdef USE_WIN_IOCTL
|
||||
/*
|
||||
@@ -116,7 +116,7 @@ getwindowsz()
|
||||
}
|
||||
|
||||
void
|
||||
getioctls()
|
||||
getioctls(void)
|
||||
{
|
||||
#ifdef BSD_JOB_CONTROL
|
||||
(void) ioctl(fileno(stdin), (int) TIOCGLTC, (char *) <chars);
|
||||
@@ -139,7 +139,7 @@ getioctls()
|
||||
}
|
||||
|
||||
void
|
||||
setioctls()
|
||||
setioctls(void)
|
||||
{
|
||||
#ifdef BSD_JOB_CONTROL
|
||||
(void) ioctl(fileno(stdin), (int) TIOCSLTC, (char *) <chars);
|
||||
@@ -158,7 +158,7 @@ setioctls()
|
||||
|
||||
#ifdef SUSPEND /* No longer implies BSD */
|
||||
int
|
||||
dosuspend()
|
||||
dosuspend(void)
|
||||
{
|
||||
#ifdef SYSCF
|
||||
/* NB: check_user_string() is port-specific. */
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
#ifdef LAN_FEATURES
|
||||
|
||||
void
|
||||
init_lan_features()
|
||||
init_lan_features(void)
|
||||
{
|
||||
lan_username();
|
||||
}
|
||||
@@ -29,7 +29,7 @@ init_lan_features()
|
||||
*/
|
||||
|
||||
char *
|
||||
lan_username()
|
||||
lan_username(void)
|
||||
{
|
||||
char *lu;
|
||||
lu = get_username(&g.lusername_size);
|
||||
|
||||
@@ -24,6 +24,13 @@
|
||||
#include <unistd.h> /* for getcwd() prototype */
|
||||
#endif
|
||||
|
||||
#if defined(MICRO) || defined(OS2)
|
||||
void nethack_exit(int) NORETURN;
|
||||
#else
|
||||
#define nethack_exit exit
|
||||
#endif
|
||||
|
||||
char *exepath(char *);
|
||||
char orgdir[PATHLEN]; /* also used in pcsys.c, amidos.c */
|
||||
|
||||
#ifdef TOS
|
||||
@@ -35,28 +42,24 @@ long _stksize = 16 * 1024;
|
||||
|
||||
#ifdef AMIGA
|
||||
extern int bigscreen;
|
||||
void NDECL(preserve_icon);
|
||||
void preserve_icon(void);
|
||||
#endif
|
||||
|
||||
static void FDECL(process_options, (int argc, char **argv));
|
||||
static void NDECL(nhusage);
|
||||
static void process_options(int argc, char **argv);
|
||||
static void nhusage(void);
|
||||
|
||||
#if defined(MICRO) || defined(OS2)
|
||||
extern void FDECL(nethack_exit, (int)) NORETURN;
|
||||
#else
|
||||
#define nethack_exit exit
|
||||
#endif
|
||||
#ifdef PORT_HELP
|
||||
#if defined(MSDOS)
|
||||
void port_help(void);
|
||||
#endif /* MSDOS */
|
||||
#endif /* PORT_HELP */
|
||||
|
||||
#ifdef EXEPATH
|
||||
static char *FDECL(exepath, (char *));
|
||||
#endif
|
||||
int main(int, char **);
|
||||
|
||||
int FDECL(main, (int, char **));
|
||||
|
||||
extern boolean FDECL(pcmain, (int, char **));
|
||||
extern boolean pcmain(int, char **);
|
||||
|
||||
#if defined(__BORLANDC__)
|
||||
void NDECL(startup);
|
||||
void startup(void);
|
||||
unsigned _stklen = STKSIZ;
|
||||
#endif
|
||||
|
||||
@@ -66,12 +69,10 @@ unsigned _stklen = STKSIZ;
|
||||
*/
|
||||
int
|
||||
#ifndef __MINGW32__
|
||||
main(argc, argv)
|
||||
main(int argc, char *argv[])
|
||||
#else
|
||||
mingw_main(argc, argv)
|
||||
mingw_main(int argc, char *argv[])
|
||||
#endif
|
||||
int argc;
|
||||
char *argv[];
|
||||
{
|
||||
boolean resuming;
|
||||
|
||||
@@ -84,9 +85,7 @@ char *argv[];
|
||||
}
|
||||
|
||||
boolean
|
||||
pcmain(argc, argv)
|
||||
int argc;
|
||||
char *argv[];
|
||||
pcmain(int argc, char *argv[])
|
||||
{
|
||||
NHFILE *nhfp;
|
||||
register char *dir;
|
||||
@@ -455,7 +454,7 @@ _CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR);*/
|
||||
* We'll return here if new game player_selection() renames the hero.
|
||||
*/
|
||||
attempt_restore:
|
||||
if ((nhfp = restore_saved_game()) > 0) {
|
||||
if ((nhfp = restore_saved_game()) != 0) {
|
||||
#ifndef NO_SIGNAL
|
||||
(void) signal(SIGINT, (SIG_RET_TYPE) done1);
|
||||
#endif
|
||||
@@ -515,9 +514,7 @@ attempt_restore:
|
||||
}
|
||||
|
||||
static void
|
||||
process_options(argc, argv)
|
||||
int argc;
|
||||
char *argv[];
|
||||
process_options(int argc, char *argv[])
|
||||
{
|
||||
int i;
|
||||
|
||||
@@ -637,7 +634,7 @@ char *argv[];
|
||||
}
|
||||
|
||||
static void
|
||||
nhusage()
|
||||
nhusage(void)
|
||||
{
|
||||
char buf1[BUFSZ], buf2[BUFSZ], *bufptr;
|
||||
|
||||
@@ -678,9 +675,7 @@ nhusage()
|
||||
|
||||
#ifdef CHDIR
|
||||
void
|
||||
chdirx(dir, wr)
|
||||
char *dir;
|
||||
boolean wr;
|
||||
chdirx(char *dir, boolean wr)
|
||||
{
|
||||
#ifdef AMIGA
|
||||
static char thisdir[] = "";
|
||||
@@ -708,7 +703,7 @@ boolean wr;
|
||||
#ifdef PORT_HELP
|
||||
#if defined(MSDOS)
|
||||
void
|
||||
port_help()
|
||||
port_help(void)
|
||||
{
|
||||
/* display port specific help file */
|
||||
display_file(PORT_HELP, 1);
|
||||
@@ -718,7 +713,7 @@ port_help()
|
||||
|
||||
/* validate wizard mode if player has requested access to it */
|
||||
boolean
|
||||
authorize_wizard_mode()
|
||||
authorize_wizard_mode(void)
|
||||
{
|
||||
if (!strcmp(g.plname, WIZARD_NAME))
|
||||
return TRUE;
|
||||
@@ -736,15 +731,12 @@ authorize_wizard_mode()
|
||||
char exepathbuf[EXEPATHBUFSZ];
|
||||
|
||||
char *
|
||||
exepath(str)
|
||||
char *str;
|
||||
exepath(char *str)
|
||||
{
|
||||
char *tmp, *tmp2;
|
||||
int bsize;
|
||||
|
||||
if (!str)
|
||||
return (char *) 0;
|
||||
bsize = EXEPATHBUFSZ;
|
||||
tmp = exepathbuf;
|
||||
Strcpy(tmp, str);
|
||||
tmp2 = strrchr(tmp, PATH_SEPARATOR);
|
||||
@@ -767,7 +759,7 @@ VA_DECL(const char *, fmt)
|
||||
}
|
||||
|
||||
unsigned long
|
||||
sys_random_seed()
|
||||
sys_random_seed(void)
|
||||
{
|
||||
unsigned long seed = 0L;
|
||||
unsigned long pid = (unsigned long) getpid();
|
||||
|
||||
@@ -29,11 +29,11 @@
|
||||
#endif
|
||||
|
||||
#if defined(MICRO) || defined(OS2)
|
||||
void FDECL(nethack_exit, (int)) NORETURN;
|
||||
void nethack_exit(int) NORETURN;
|
||||
#else
|
||||
#define nethack_exit exit
|
||||
#endif
|
||||
static void NDECL(msexit);
|
||||
static void msexit(void);
|
||||
|
||||
#ifdef MOVERLAY
|
||||
extern void __far __cdecl _movepause(void);
|
||||
@@ -43,11 +43,12 @@ extern unsigned short __far __cdecl _movefpaused;
|
||||
#define __MOVE_PAUSE_DISK 2 /* Represents the executable file */
|
||||
#define __MOVE_PAUSE_CACHE 4 /* Represents the cache memory */
|
||||
#endif /* MOVERLAY */
|
||||
FILE * fopenp(const char *name, const char *mode);
|
||||
|
||||
#if defined(MICRO)
|
||||
|
||||
void
|
||||
flushout()
|
||||
flushout(void)
|
||||
{
|
||||
(void) fflush(stdout);
|
||||
return;
|
||||
@@ -64,9 +65,11 @@ static const char *COMSPEC =
|
||||
|
||||
#ifdef SHELL
|
||||
int
|
||||
dosh()
|
||||
dosh(void)
|
||||
{
|
||||
#ifndef NOCWD_ASSUMPTIONS
|
||||
extern char orgdir[];
|
||||
#endif
|
||||
char *comspec;
|
||||
#ifndef __GO32__
|
||||
int spawnstat;
|
||||
@@ -132,8 +135,7 @@ dosh()
|
||||
* be room for the \
|
||||
*/
|
||||
void
|
||||
append_slash(name)
|
||||
char *name;
|
||||
append_slash(char *name)
|
||||
{
|
||||
char *ptr;
|
||||
|
||||
@@ -148,8 +150,7 @@ char *name;
|
||||
}
|
||||
|
||||
void
|
||||
getreturn(str)
|
||||
const char *str;
|
||||
getreturn(const char *str)
|
||||
{
|
||||
#ifdef TOS
|
||||
msmsg("Hit <Return> %s.", str);
|
||||
@@ -194,8 +195,7 @@ VA_DECL(const char *, fmt)
|
||||
#endif
|
||||
|
||||
FILE *
|
||||
fopenp(name, mode)
|
||||
const char *name, *mode;
|
||||
fopenp(const char *name, const char *mode)
|
||||
{
|
||||
char buf[BUFSIZ], *bp, *pp, lastch = 0;
|
||||
FILE *fp;
|
||||
@@ -243,8 +243,7 @@ const char *name, *mode;
|
||||
|
||||
#if defined(MICRO) || defined(OS2)
|
||||
void
|
||||
nethack_exit(code)
|
||||
int code;
|
||||
nethack_exit(int code)
|
||||
{
|
||||
msexit();
|
||||
exit(code);
|
||||
@@ -257,9 +256,9 @@ extern boolean run_from_desktop; /* set in pcmain.c */
|
||||
#endif
|
||||
|
||||
static void
|
||||
msexit()
|
||||
msexit(void)
|
||||
{
|
||||
#ifdef CHDIR
|
||||
#if defined(CHDIR) && !defined(NOCWD_ASSUMPTIONS)
|
||||
extern char orgdir[];
|
||||
#endif
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ char erase_char, kill_char;
|
||||
* Called by startup() in termcap.c and after returning from ! or ^Z
|
||||
*/
|
||||
void
|
||||
gettty()
|
||||
gettty(void)
|
||||
{
|
||||
erase_char = '\b';
|
||||
kill_char = 21; /* cntl-U */
|
||||
@@ -33,8 +33,7 @@ gettty()
|
||||
|
||||
/* reset terminal to original state */
|
||||
void
|
||||
settty(s)
|
||||
const char *s;
|
||||
settty(const char *s)
|
||||
{
|
||||
#if defined(MSDOS) && defined(NO_TERMS)
|
||||
gr_finish();
|
||||
@@ -49,15 +48,14 @@ const char *s;
|
||||
|
||||
/* called by init_nhwindows() and resume_nhwindows() */
|
||||
void
|
||||
setftty()
|
||||
setftty(void)
|
||||
{
|
||||
start_screen();
|
||||
}
|
||||
|
||||
#if defined(TIMED_DELAY) && defined(_MSC_VER)
|
||||
void
|
||||
msleep(mseconds)
|
||||
unsigned mseconds;
|
||||
msleep(unsigned mseconds)
|
||||
{
|
||||
/* now uses clock() which is ANSI C */
|
||||
clock_t goal;
|
||||
|
||||
@@ -18,8 +18,8 @@ extern char orgdir[];
|
||||
#endif
|
||||
|
||||
#if defined(TTY_GRAPHICS)
|
||||
extern void NDECL(backsp);
|
||||
extern void NDECL(clear_screen);
|
||||
extern void backsp(void);
|
||||
extern void clear_screen(void);
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
@@ -30,14 +30,13 @@ static struct stat buf;
|
||||
static struct stat hbuf;
|
||||
#endif
|
||||
|
||||
#ifdef PC_LOCKING
|
||||
static int NDECL(eraseoldlocks);
|
||||
#if defined(PC_LOCKING) && !defined(SELF_RECOVER)
|
||||
static int eraseoldlocks(void);
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
int
|
||||
uptodate(fd)
|
||||
int fd;
|
||||
uptodate(int fd)
|
||||
{
|
||||
#ifdef WANT_GETHDATE
|
||||
if(fstat(fd, &buf)) {
|
||||
@@ -73,9 +72,10 @@ int fd;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef PC_LOCKING
|
||||
#if defined(PC_LOCKING)
|
||||
#if !defined(SELF_RECOVER)
|
||||
static int
|
||||
eraseoldlocks()
|
||||
eraseoldlocks(void)
|
||||
{
|
||||
register int i;
|
||||
|
||||
@@ -96,11 +96,12 @@ eraseoldlocks()
|
||||
return 0; /* cannot remove it */
|
||||
return (1); /* success! */
|
||||
}
|
||||
#endif /* SELF_RECOVER */
|
||||
|
||||
void
|
||||
getlock()
|
||||
getlock(void)
|
||||
{
|
||||
register int fd, c, ci, ct, ern;
|
||||
register int fd, c, ci, ct;
|
||||
int fcmask = FCMASK;
|
||||
char tbuf[BUFSZ];
|
||||
const char *fq_lock;
|
||||
@@ -209,8 +210,6 @@ getlock()
|
||||
|
||||
gotlock:
|
||||
fd = creat(fq_lock, fcmask);
|
||||
if (fd == -1)
|
||||
ern = errno;
|
||||
unlock_file(HLOCK);
|
||||
if (fd == -1) {
|
||||
#if defined(CHDIR) && !defined(NOCWD_ASSUMPTIONS)
|
||||
@@ -240,12 +239,11 @@ gotlock:
|
||||
#endif /* PC_LOCKING */
|
||||
|
||||
void
|
||||
regularize(s)
|
||||
regularize(register char *s)
|
||||
/*
|
||||
* normalize file name - we don't like .'s, /'s, spaces, and
|
||||
* lots of other things
|
||||
*/
|
||||
register char *s;
|
||||
{
|
||||
register char *lp;
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ struct nhregex {
|
||||
};
|
||||
|
||||
struct nhregex *
|
||||
regex_init()
|
||||
regex_init(void)
|
||||
{
|
||||
struct nhregex *re;
|
||||
|
||||
@@ -30,9 +30,7 @@ regex_init()
|
||||
}
|
||||
|
||||
boolean
|
||||
regex_compile(s, re)
|
||||
const char *s;
|
||||
struct nhregex *re;
|
||||
regex_compile(const char *s, struct nhregex *re)
|
||||
{
|
||||
if (!re)
|
||||
return FALSE;
|
||||
@@ -44,16 +42,13 @@ struct nhregex *re;
|
||||
}
|
||||
|
||||
const char *
|
||||
regex_error_desc(re)
|
||||
struct nhregex *re UNUSED;
|
||||
regex_error_desc(struct nhregex *re UNUSED)
|
||||
{
|
||||
return "pattern match compilation error";
|
||||
}
|
||||
|
||||
boolean
|
||||
regex_match(s, re)
|
||||
const char *s;
|
||||
struct nhregex *re;
|
||||
regex_match(const char *s, struct nhregex *re)
|
||||
{
|
||||
if (!re || !re->pat || !s)
|
||||
return FALSE;
|
||||
@@ -62,8 +57,7 @@ struct nhregex *re;
|
||||
}
|
||||
|
||||
void
|
||||
regex_free(re)
|
||||
struct nhregex *re;
|
||||
regex_free(struct nhregex *re)
|
||||
{
|
||||
if (re) {
|
||||
if (re->pat)
|
||||
|
||||
@@ -52,7 +52,7 @@ struct nhregex {
|
||||
};
|
||||
|
||||
struct nhregex *
|
||||
regex_init()
|
||||
regex_init(void)
|
||||
{
|
||||
return (struct nhregex *) alloc(sizeof(struct nhregex));
|
||||
}
|
||||
|
||||
@@ -21,13 +21,13 @@ char *BC, *UP;
|
||||
short ospeed;
|
||||
|
||||
/* exported routines */
|
||||
int FDECL(tgetent, (char *, const char *));
|
||||
int FDECL(tgetflag, (const char *));
|
||||
int FDECL(tgetnum, (const char *));
|
||||
char *FDECL(tgetstr, (const char *, char **));
|
||||
char *FDECL(tgoto, (const char *, int, int));
|
||||
char *FDECL(tparam, (const char *, char *, int, int, int, int, int));
|
||||
void FDECL(tputs, (const char *, int, int (*)(int)));
|
||||
int tgetent(char *, const char *);
|
||||
int tgetflag(const char *);
|
||||
int tgetnum(const char *);
|
||||
char *tgetstr(const char *, char **);
|
||||
char *tgoto(const char *, int, int);
|
||||
char *tparam(const char *, char *, int, int, int, int, int);
|
||||
void tputs(const char *, int, int (*)(int));
|
||||
|
||||
/* local support data */
|
||||
static char *tc_entry;
|
||||
@@ -49,10 +49,10 @@ static short baud_rates[] = {
|
||||
#endif /* !NO_DELAY_PADDING */
|
||||
|
||||
/* local support code */
|
||||
static int FDECL(tc_store, (const char *, const char *));
|
||||
static char *FDECL(tc_find, (FILE *, const char *, char *, int));
|
||||
static char *FDECL(tc_name, (const char *, char *));
|
||||
static const char *FDECL(tc_field, (const char *, const char **));
|
||||
static int tc_store(const char *, const char *);
|
||||
static char *tc_find(FILE *, const char *, char *, int);
|
||||
static char *tc_name(const char *, char *);
|
||||
static const char *tc_field(const char *, const char **);
|
||||
|
||||
#ifndef min
|
||||
#define min(a, b) ((a) < (b) ? (a) : (b))
|
||||
@@ -60,9 +60,8 @@ static const char *FDECL(tc_field, (const char *, const char **));
|
||||
|
||||
/* retrieve the specified terminal entry and return it in `entbuf' */
|
||||
int
|
||||
tgetent(entbuf, term)
|
||||
char *entbuf; /* size must be at least [TCBUFSIZ] */
|
||||
const char *term;
|
||||
tgetent(char *entbuf, /* size must be at least [TCBUFSIZ] */
|
||||
const char *term)
|
||||
{
|
||||
int result;
|
||||
FILE *fp;
|
||||
@@ -96,8 +95,7 @@ const char *term;
|
||||
|
||||
/* copy the entry into the output buffer */
|
||||
static int
|
||||
tc_store(trm, ent)
|
||||
const char *trm, *ent;
|
||||
tc_store(const char *trm, const char *ent)
|
||||
{
|
||||
const char *bar, *col;
|
||||
char *s;
|
||||
@@ -137,11 +135,7 @@ const char *trm, *ent;
|
||||
|
||||
/* search for an entry in the termcap file */
|
||||
static char *
|
||||
tc_find(fp, term, buffer, bufsiz)
|
||||
FILE *fp;
|
||||
const char *term;
|
||||
char *buffer;
|
||||
int bufsiz;
|
||||
tc_find(FILE *fp, const char *term, char *buffer, int bufsiz)
|
||||
{
|
||||
int in, len, first, skip;
|
||||
char *ip, *op, *tc_fetch, tcbuf[TCBUFSIZ];
|
||||
@@ -198,9 +192,7 @@ int bufsiz;
|
||||
|
||||
/* check whether `ent' contains `nam'; return start of field entries */
|
||||
static char *
|
||||
tc_name(nam, ent)
|
||||
const char *nam;
|
||||
char *ent;
|
||||
tc_name(const char *nam, char *ent)
|
||||
{
|
||||
char *nxt, *lst, *p = ent;
|
||||
size_t n = strlen(nam);
|
||||
@@ -220,8 +212,7 @@ char *ent;
|
||||
|
||||
/* look up a numeric entry */
|
||||
int
|
||||
tgetnum(which)
|
||||
const char *which;
|
||||
tgetnum(const char *which)
|
||||
{
|
||||
const char *q, *p = tc_field(which, &q);
|
||||
char numbuf[32];
|
||||
@@ -239,8 +230,7 @@ const char *which;
|
||||
|
||||
/* look up a boolean entry */
|
||||
int
|
||||
tgetflag(which)
|
||||
const char *which;
|
||||
tgetflag(const char *which)
|
||||
{
|
||||
const char *p = tc_field(which, (const char **) 0);
|
||||
|
||||
@@ -249,9 +239,7 @@ const char *which;
|
||||
|
||||
/* look up a string entry; update `*outptr' */
|
||||
char *
|
||||
tgetstr(which, outptr)
|
||||
const char *which;
|
||||
char **outptr;
|
||||
tgetstr(const char *which, char **outptr)
|
||||
{
|
||||
int n;
|
||||
char c, *r, *result;
|
||||
@@ -326,9 +314,7 @@ char **outptr;
|
||||
|
||||
/* look for a particular field name */
|
||||
static const char *
|
||||
tc_field(field, tc_end)
|
||||
const char *field;
|
||||
const char **tc_end;
|
||||
tc_field(const char *field, const char **tc_end)
|
||||
{
|
||||
const char *end, *q, *p = tc_entry;
|
||||
|
||||
@@ -356,20 +342,17 @@ static char cmbuf[64];
|
||||
|
||||
/* produce a string which will position the cursor at <row,col> if output */
|
||||
char *
|
||||
tgoto(cm, col, row)
|
||||
const char *cm;
|
||||
int col, row;
|
||||
tgoto(const char *cm, int col, int row)
|
||||
{
|
||||
return tparam(cm, cmbuf, (int) (sizeof cmbuf), row, col, 0, 0);
|
||||
}
|
||||
|
||||
/* format a parameterized string, ala sprintf */
|
||||
char *
|
||||
tparam(ctl, buf, buflen, row, col, row2, col2)
|
||||
const char *ctl; /* parameter control string */
|
||||
char *buf; /* output buffer */
|
||||
int buflen; /* ought to have been `size_t'... */
|
||||
int row, col, row2, col2;
|
||||
tparam(const char *ctl, /* parameter control string */
|
||||
char *buf, /* output buffer */
|
||||
int buflen, /* ought to have been `size_t'... */
|
||||
int row, int col, int row2, int col2)
|
||||
{
|
||||
int atmp, ac, av[5];
|
||||
char c, *r, *z, *bufend, numbuf[32];
|
||||
@@ -501,10 +484,9 @@ int row, col, row2, col2;
|
||||
|
||||
/* send a string to the terminal, possibly padded with trailing NULs */
|
||||
void
|
||||
tputs(string, range, output_func)
|
||||
const char *string; /* characters to output */
|
||||
int range; /* number of lines affected, used for `*' delays */
|
||||
int FDECL((*output_func),(int)); /* actual output routine;
|
||||
tputs(const char *string, /* characters to output */
|
||||
int range, /* number of lines affected, used for `*' delays */
|
||||
int (*output_func)(int)) /* actual output routine;
|
||||
* return value ignored */
|
||||
{
|
||||
register int c, num = 0;
|
||||
|
||||
@@ -131,7 +131,7 @@ struct tchars inittyb2, curttyb2;
|
||||
* used unconditionally because it conflicts with the 'bool' one.
|
||||
*/
|
||||
#ifdef NEED_HAS_COLORS_DECL
|
||||
int has_colors();
|
||||
int has_colors(void);
|
||||
#endif
|
||||
|
||||
#if defined(TTY_GRAPHICS) && ((!defined(SYSV) && !defined(HPUX)) \
|
||||
@@ -154,8 +154,7 @@ struct termstruct inittyb, curttyb;
|
||||
|
||||
#ifdef POSIX_TYPES
|
||||
static int
|
||||
speednum(speed)
|
||||
speed_t speed;
|
||||
speednum(speed_t speed)
|
||||
{
|
||||
switch (speed) {
|
||||
case B0:
|
||||
@@ -197,7 +196,7 @@ speed_t speed;
|
||||
#endif
|
||||
|
||||
static void
|
||||
setctty()
|
||||
setctty(void)
|
||||
{
|
||||
if (STTY(&curttyb) < 0 || STTY2(&curttyb2) < 0)
|
||||
perror("NetHack (setctty)");
|
||||
@@ -209,7 +208,7 @@ setctty()
|
||||
* Called by startup() in termcap.c and after returning from ! or ^Z
|
||||
*/
|
||||
void
|
||||
gettty()
|
||||
gettty(void)
|
||||
{
|
||||
if (GTTY(&inittyb) < 0 || GTTY2(&inittyb2) < 0)
|
||||
perror("NetHack (gettty)");
|
||||
@@ -231,8 +230,7 @@ gettty()
|
||||
|
||||
/* reset terminal to original state */
|
||||
void
|
||||
settty(s)
|
||||
const char *s;
|
||||
settty(const char *s)
|
||||
{
|
||||
end_screen();
|
||||
if (s)
|
||||
@@ -247,7 +245,7 @@ const char *s;
|
||||
}
|
||||
|
||||
void
|
||||
setftty()
|
||||
setftty(void)
|
||||
{
|
||||
unsigned ef, cf;
|
||||
int change = 0;
|
||||
@@ -314,7 +312,7 @@ setftty()
|
||||
start_screen();
|
||||
}
|
||||
|
||||
void intron() /* enable kbd interupts if enabled when game started */
|
||||
void intron(void) /* enable kbd interupts if enabled when game started */
|
||||
{
|
||||
#ifdef TTY_GRAPHICS
|
||||
/* Ugly hack to keep from changing tty modes for non-tty games -dlc */
|
||||
@@ -326,7 +324,7 @@ void intron() /* enable kbd interupts if enabled when game started */
|
||||
#endif
|
||||
}
|
||||
|
||||
void introff() /* disable kbd interrupts if required*/
|
||||
void introff(void) /* disable kbd interrupts if required*/
|
||||
{
|
||||
#ifdef TTY_GRAPHICS
|
||||
/* Ugly hack to keep from changing tty modes for non-tty games -dlc */
|
||||
@@ -349,13 +347,13 @@ int sco_flag_console = 0;
|
||||
int sco_map_valid = -1;
|
||||
unsigned char sco_chanmap_buf[BSIZE];
|
||||
|
||||
void NDECL(sco_mapon);
|
||||
void NDECL(sco_mapoff);
|
||||
void NDECL(check_sco_console);
|
||||
void NDECL(init_sco_cons);
|
||||
void sco_mapon(void);
|
||||
void sco_mapoff(void);
|
||||
void check_sco_console(void);
|
||||
void init_sco_cons(void);
|
||||
|
||||
void
|
||||
sco_mapon()
|
||||
sco_mapon(void)
|
||||
{
|
||||
#ifdef TTY_GRAPHICS
|
||||
if (WINDOWPORT("tty") && sco_flag_console) {
|
||||
@@ -368,7 +366,7 @@ sco_mapon()
|
||||
}
|
||||
|
||||
void
|
||||
sco_mapoff()
|
||||
sco_mapoff(void)
|
||||
{
|
||||
#ifdef TTY_GRAPHICS
|
||||
if (WINDOWPORT("tty") && sco_flag_console) {
|
||||
@@ -381,7 +379,7 @@ sco_mapoff()
|
||||
}
|
||||
|
||||
void
|
||||
check_sco_console()
|
||||
check_sco_console(void)
|
||||
{
|
||||
if (isatty(0) && ioctl(0, CONS_GET, 0) != -1) {
|
||||
sco_flag_console = 1;
|
||||
@@ -389,7 +387,7 @@ check_sco_console()
|
||||
}
|
||||
|
||||
void
|
||||
init_sco_cons()
|
||||
init_sco_cons(void)
|
||||
{
|
||||
#ifdef TTY_GRAPHICS
|
||||
if (WINDOWPORT("tty") && sco_flag_console) {
|
||||
@@ -413,13 +411,13 @@ init_sco_cons()
|
||||
|
||||
int linux_flag_console = 0;
|
||||
|
||||
void NDECL(linux_mapon);
|
||||
void NDECL(linux_mapoff);
|
||||
void NDECL(check_linux_console);
|
||||
void NDECL(init_linux_cons);
|
||||
void linux_mapon(void);
|
||||
void linux_mapoff(void);
|
||||
void check_linux_console(void);
|
||||
void init_linux_cons(void);
|
||||
|
||||
void
|
||||
linux_mapon()
|
||||
linux_mapon(void)
|
||||
{
|
||||
#ifdef TTY_GRAPHICS
|
||||
if (WINDOWPORT("tty") && linux_flag_console) {
|
||||
@@ -429,7 +427,7 @@ linux_mapon()
|
||||
}
|
||||
|
||||
void
|
||||
linux_mapoff()
|
||||
linux_mapoff(void)
|
||||
{
|
||||
#ifdef TTY_GRAPHICS
|
||||
if (WINDOWPORT("tty") && linux_flag_console) {
|
||||
@@ -439,7 +437,7 @@ linux_mapoff()
|
||||
}
|
||||
|
||||
void
|
||||
check_linux_console()
|
||||
check_linux_console(void)
|
||||
{
|
||||
struct vt_mode vtm;
|
||||
|
||||
@@ -449,7 +447,7 @@ check_linux_console()
|
||||
}
|
||||
|
||||
void
|
||||
init_linux_cons()
|
||||
init_linux_cons(void)
|
||||
{
|
||||
#ifdef TTY_GRAPHICS
|
||||
if (WINDOWPORT("tty") && linux_flag_console) {
|
||||
@@ -466,20 +464,19 @@ init_linux_cons()
|
||||
|
||||
#ifndef __begui__ /* the Be GUI will define its own error proc */
|
||||
/* fatal error */
|
||||
/*VARARGS1*/
|
||||
void error
|
||||
VA_DECL(const char *, s)
|
||||
void
|
||||
error(const char *s, ...)
|
||||
{
|
||||
VA_START(s);
|
||||
VA_INIT(s, const char *);
|
||||
va_list the_args;
|
||||
|
||||
va_start(the_args, s);
|
||||
if (iflags.window_inited)
|
||||
exit_nhwindows((char *) 0); /* for tty, will call settty() */
|
||||
if (settty_needed)
|
||||
settty((char *) 0);
|
||||
Vprintf(s, VA_ARGS);
|
||||
Vprintf(s, the_args);
|
||||
(void) putchar('\n');
|
||||
VA_END();
|
||||
va_end(the_args);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
#endif /* !__begui__ */
|
||||
|
||||
@@ -88,9 +88,7 @@ static void outdec(char *, FILE *, int);
|
||||
#define DEC(c) (((c) - ' ') & 077)
|
||||
|
||||
int
|
||||
main(argc, argv)
|
||||
int argc;
|
||||
char **argv;
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
FILE *in, *out;
|
||||
int mode;
|
||||
@@ -179,9 +177,7 @@ char **argv;
|
||||
* copy from in to out, decoding as you go along.
|
||||
*/
|
||||
void
|
||||
decode(in, out)
|
||||
FILE *in;
|
||||
FILE *out;
|
||||
decode(FILE *in, FILE *out)
|
||||
{
|
||||
char buf[80];
|
||||
char *bp;
|
||||
@@ -218,10 +214,7 @@ FILE *out;
|
||||
* output all of them at the end of the file.
|
||||
*/
|
||||
void
|
||||
outdec(p, f, n)
|
||||
char *p;
|
||||
FILE *f;
|
||||
int n;
|
||||
outdec(char *p, FILE *f, int n)
|
||||
{
|
||||
int c1, c2, c3;
|
||||
|
||||
|
||||
@@ -68,9 +68,8 @@ endif # clang
|
||||
# leave it out by default.
|
||||
#CFLAGS+=-Wunreachable-code
|
||||
#
|
||||
# Can't use these; NetHack uses old-style-definitions
|
||||
#CFLAGS+=-Wold-style-definition
|
||||
#CFLAGS+=-Wstrict-prototypes
|
||||
CFLAGS+=-Wold-style-definition
|
||||
CFLAGS+=-Wstrict-prototypes
|
||||
|
||||
#end of compiler.2020
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
@@ -165,7 +165,11 @@ override TARGET_AR = $(TOOLTOP1)/i586-pc-msdosdjgpp-gcc-ar
|
||||
override TARGET_STUBEDIT = ../lib/djgpp/i586-pc-msdosdjgpp/bin/stubedit
|
||||
override TARGET_CFLAGS = -c -O -I../include -I../sys/msdos -I../win/share \
|
||||
$(LUAINCL) -DDLB $(PDCURSESDEF) \
|
||||
-DUSE_TILES -DCROSSCOMPILE -DCROSSCOMPILE_TARGET -DCROSS_TO_MSDOS
|
||||
-DUSE_TILES -DCROSSCOMPILE -DCROSSCOMPILE_TARGET -DCROSS_TO_MSDOS \
|
||||
-Wall -Wextra -Wno-missing-field-initializers -Wimplicit \
|
||||
-Wreturn-type -Wunused -Wformat -Wswitch -Wshadow -Wwrite-strings \
|
||||
-Wimplicit-function-declaration -Wimplicit-int \
|
||||
-Wmissing-declarations -Wmissing-prototypes -Wmissing-parameter-type
|
||||
override TARGET_CXXFLAGS = $(TARGET_CFLAGS)
|
||||
override TARGET_LINK = $(TOOLTOP1)/i586-pc-msdosdjgpp-gcc
|
||||
override TARGET_LFLAGS=
|
||||
|
||||
@@ -19,36 +19,34 @@
|
||||
#if !defined(_BULL_SOURCE) && !defined(__sgi) && !defined(_M_UNIX)
|
||||
#if !defined(SUNOS4) && !(defined(ULTRIX) && defined(__GNUC__))
|
||||
#if defined(POSIX_TYPES) || defined(SVR4) || defined(HPUX)
|
||||
extern struct passwd *FDECL(getpwuid, (uid_t));
|
||||
extern struct passwd *getpwuid(uid_t);
|
||||
#else
|
||||
extern struct passwd *FDECL(getpwuid, (int));
|
||||
extern struct passwd *getpwuid(int);
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
extern struct passwd *FDECL(getpwnam, (const char *));
|
||||
extern struct passwd *getpwnam(const char *);
|
||||
#ifdef CHDIR
|
||||
static void FDECL(chdirx, (const char *, BOOLEAN_P));
|
||||
static void chdirx(const char *, boolean);
|
||||
#endif /* CHDIR */
|
||||
static boolean NDECL(whoami);
|
||||
static void FDECL(process_options, (int, char **));
|
||||
static boolean whoami(void);
|
||||
static void process_options(int, char **);
|
||||
|
||||
#ifdef _M_UNIX
|
||||
extern void NDECL(check_sco_console);
|
||||
extern void NDECL(init_sco_cons);
|
||||
extern void check_sco_console(void);
|
||||
extern void init_sco_cons(void);
|
||||
#endif
|
||||
#ifdef __linux__
|
||||
extern void NDECL(check_linux_console);
|
||||
extern void NDECL(init_linux_cons);
|
||||
extern void check_linux_console(void);
|
||||
extern void init_linux_cons(void);
|
||||
#endif
|
||||
|
||||
static void NDECL(wd_message);
|
||||
static void wd_message(void);
|
||||
static boolean wiz_error_flag = FALSE;
|
||||
static struct passwd *NDECL(get_unix_pw);
|
||||
static struct passwd *get_unix_pw(void);
|
||||
|
||||
int
|
||||
main(argc, argv)
|
||||
int argc;
|
||||
char *argv[];
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
#ifdef CHDIR
|
||||
register char *dir;
|
||||
@@ -343,9 +341,7 @@ char *argv[];
|
||||
|
||||
/* caveat: argv elements might be arbitrary long */
|
||||
static void
|
||||
process_options(argc, argv)
|
||||
int argc;
|
||||
char *argv[];
|
||||
process_options(int argc, char *argv[])
|
||||
{
|
||||
int i, l;
|
||||
|
||||
@@ -465,9 +461,7 @@ char *argv[];
|
||||
|
||||
#ifdef CHDIR
|
||||
static void
|
||||
chdirx(dir, wr)
|
||||
const char *dir;
|
||||
boolean wr;
|
||||
chdirx(const char *dir, boolean wr)
|
||||
{
|
||||
if (dir /* User specified directory? */
|
||||
#ifdef HACKDIR
|
||||
@@ -525,7 +519,7 @@ boolean wr;
|
||||
|
||||
/* returns True iff we set plname[] to username which contains a hyphen */
|
||||
static boolean
|
||||
whoami()
|
||||
whoami(void)
|
||||
{
|
||||
/*
|
||||
* Who am i? Algorithm: 1. Use name as specified in NETHACKOPTIONS
|
||||
@@ -557,8 +551,7 @@ whoami()
|
||||
}
|
||||
|
||||
void
|
||||
sethanguphandler(handler)
|
||||
void FDECL((*handler), (int));
|
||||
sethanguphandler(void (*handler)(int))
|
||||
{
|
||||
#ifdef SA_RESTART
|
||||
/* don't want reads to restart. If SA_RESTART is defined, we know
|
||||
@@ -585,7 +578,7 @@ void FDECL((*handler), (int));
|
||||
|
||||
#ifdef PORT_HELP
|
||||
void
|
||||
port_help()
|
||||
port_help(void)
|
||||
{
|
||||
/*
|
||||
* Display unix-specific help. Just show contents of the helpfile
|
||||
@@ -597,7 +590,7 @@ port_help()
|
||||
|
||||
/* validate wizard mode if player has requested access to it */
|
||||
boolean
|
||||
authorize_wizard_mode()
|
||||
authorize_wizard_mode(void)
|
||||
{
|
||||
struct passwd *pw = get_unix_pw();
|
||||
|
||||
@@ -610,7 +603,7 @@ authorize_wizard_mode()
|
||||
}
|
||||
|
||||
static void
|
||||
wd_message()
|
||||
wd_message(void)
|
||||
{
|
||||
if (wiz_error_flag) {
|
||||
if (sysopt.wizards && sysopt.wizards[0]) {
|
||||
@@ -630,8 +623,7 @@ wd_message()
|
||||
* be room for the /
|
||||
*/
|
||||
void
|
||||
append_slash(name)
|
||||
char *name;
|
||||
append_slash(char *name)
|
||||
{
|
||||
char *ptr;
|
||||
|
||||
@@ -646,8 +638,7 @@ char *name;
|
||||
}
|
||||
|
||||
boolean
|
||||
check_user_string(optstr)
|
||||
const char *optstr;
|
||||
check_user_string(const char *optstr)
|
||||
{
|
||||
struct passwd *pw;
|
||||
int pwlen;
|
||||
@@ -683,7 +674,7 @@ const char *optstr;
|
||||
}
|
||||
|
||||
static struct passwd *
|
||||
get_unix_pw()
|
||||
get_unix_pw(void)
|
||||
{
|
||||
char *user;
|
||||
unsigned uid;
|
||||
@@ -714,7 +705,7 @@ get_unix_pw()
|
||||
}
|
||||
|
||||
char *
|
||||
get_login_name()
|
||||
get_login_name(void)
|
||||
{
|
||||
static char buf[BUFSZ];
|
||||
struct passwd *pw = get_unix_pw();
|
||||
@@ -730,8 +721,7 @@ get_login_name()
|
||||
extern int errno;
|
||||
|
||||
void
|
||||
port_insert_pastebuf(buf)
|
||||
char *buf;
|
||||
port_insert_pastebuf(char *buf)
|
||||
{
|
||||
/* This should be replaced when there is a Cocoa port. */
|
||||
const char *errfmt;
|
||||
@@ -765,7 +755,7 @@ char *buf;
|
||||
#endif /* __APPLE__ */
|
||||
|
||||
unsigned long
|
||||
sys_random_seed()
|
||||
sys_random_seed(void)
|
||||
{
|
||||
unsigned long seed = 0L;
|
||||
unsigned long pid = (unsigned long) getpid();
|
||||
|
||||
@@ -24,8 +24,7 @@
|
||||
#include <dlfcn.h>
|
||||
|
||||
static int
|
||||
real_getresuid(ruid, euid, suid)
|
||||
uid_t *ruid, *euid, *suid;
|
||||
real_getresuid(uid_t *ruid, uid_t *euid, uid_t *suid)
|
||||
{
|
||||
int (*f)(uid_t *, uid_t *, uid_t *); /* getresuid signature */
|
||||
|
||||
@@ -37,8 +36,7 @@ uid_t *ruid, *euid, *suid;
|
||||
}
|
||||
|
||||
static int
|
||||
real_getresgid(rgid, egid, sgid)
|
||||
gid_t *rgid, *egid, *sgid;
|
||||
real_getresgid(gid_t *rgid, gid_t *egid, gid_t *sgid)
|
||||
{
|
||||
int (*f)(gid_t *, gid_t *, gid_t *); /* getresgid signature */
|
||||
|
||||
@@ -55,8 +53,7 @@ gid_t *rgid, *egid, *sgid;
|
||||
#ifdef SYS_getresuid
|
||||
|
||||
static int
|
||||
real_getresuid(ruid, euid, suid)
|
||||
uid_t *ruid, *euid, *suid;
|
||||
real_getresuid(uid_t *ruid, uid_t *euid, uid_t *suid)
|
||||
{
|
||||
return syscall(SYS_getresuid, ruid, euid, suid);
|
||||
}
|
||||
@@ -68,8 +65,7 @@ uid_t *ruid, *euid, *suid;
|
||||
#endif /* SVR4 */
|
||||
|
||||
static int
|
||||
real_getresuid(ruid, euid, suid)
|
||||
uid_t *ruid, *euid, *suid;
|
||||
real_getresuid(uid_t *ruid, uid_t *euid, uid_t *suid)
|
||||
{
|
||||
int retval;
|
||||
int pfd[2];
|
||||
@@ -93,8 +89,7 @@ uid_t *ruid, *euid, *suid;
|
||||
#ifdef SYS_getresgid
|
||||
|
||||
static int
|
||||
real_getresgid(rgid, egid, sgid)
|
||||
gid_t *rgid, *egid, *sgid;
|
||||
real_getresgid(gid_t *rgid, gid_t *egid, gid_t *sgid)
|
||||
{
|
||||
return syscall(SYS_getresgid, rgid, egid, sgid);
|
||||
}
|
||||
@@ -102,8 +97,7 @@ gid_t *rgid, *egid, *sgid;
|
||||
#else /* SYS_getresgid */
|
||||
|
||||
static int
|
||||
real_getresgid(rgid, egid, sgid)
|
||||
gid_t *rgid, *egid, *sgid;
|
||||
real_getresgid(gid_t *rgid, gid_t *egid, gid_t *sgid)
|
||||
{
|
||||
int retval;
|
||||
int pfd[2];
|
||||
@@ -133,8 +127,7 @@ static unsigned int hiding_privileges = 0;
|
||||
*/
|
||||
|
||||
int
|
||||
hide_privileges(flag)
|
||||
boolean flag;
|
||||
hide_privileges(boolean flag)
|
||||
{
|
||||
if (flag)
|
||||
hiding_privileges++;
|
||||
@@ -144,8 +137,7 @@ boolean flag;
|
||||
}
|
||||
|
||||
int
|
||||
nh_getresuid(ruid, euid, suid)
|
||||
uid_t *ruid, *euid, *suid;
|
||||
nh_getresuid(uid_t *ruid, uid_t *euid, uid_t *suid)
|
||||
{
|
||||
int retval = real_getresuid(ruid, euid, suid);
|
||||
|
||||
@@ -155,7 +147,7 @@ uid_t *ruid, *euid, *suid;
|
||||
}
|
||||
|
||||
uid_t
|
||||
nh_getuid()
|
||||
nh_getuid(void)
|
||||
{
|
||||
uid_t ruid, euid, suid;
|
||||
|
||||
@@ -164,7 +156,7 @@ nh_getuid()
|
||||
}
|
||||
|
||||
uid_t
|
||||
nh_geteuid()
|
||||
nh_geteuid(void)
|
||||
{
|
||||
uid_t ruid, euid, suid;
|
||||
|
||||
@@ -175,8 +167,7 @@ nh_geteuid()
|
||||
}
|
||||
|
||||
int
|
||||
nh_getresgid(rgid, egid, sgid)
|
||||
gid_t *rgid, *egid, *sgid;
|
||||
nh_getresgid(gid_t *rgid, gid_t *egid, gid_t *sgid)
|
||||
{
|
||||
int retval = real_getresgid(rgid, egid, sgid);
|
||||
|
||||
@@ -186,7 +177,7 @@ gid_t *rgid, *egid, *sgid;
|
||||
}
|
||||
|
||||
gid_t
|
||||
nh_getgid()
|
||||
nh_getgid(void)
|
||||
{
|
||||
gid_t rgid, egid, sgid;
|
||||
|
||||
@@ -195,7 +186,7 @@ nh_getgid()
|
||||
}
|
||||
|
||||
gid_t
|
||||
nh_getegid()
|
||||
nh_getegid(void)
|
||||
{
|
||||
gid_t rgid, egid, sgid;
|
||||
|
||||
@@ -209,8 +200,7 @@ nh_getegid()
|
||||
|
||||
#ifdef GNOME_GRAPHICS
|
||||
int
|
||||
hide_privileges(flag)
|
||||
boolean flag;
|
||||
hide_privileges(boolean flag)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -15,12 +15,12 @@
|
||||
#include <signal.h>
|
||||
|
||||
#ifdef _M_UNIX
|
||||
extern void NDECL(sco_mapon);
|
||||
extern void NDECL(sco_mapoff);
|
||||
extern void sco_mapon(void);
|
||||
extern void sco_mapoff(void);
|
||||
#endif
|
||||
#ifdef __linux__
|
||||
extern void NDECL(linux_mapon);
|
||||
extern void NDECL(linux_mapoff);
|
||||
extern void linux_mapon(void);
|
||||
extern void linux_mapoff(void);
|
||||
#endif
|
||||
|
||||
#ifndef NHSTDC
|
||||
@@ -32,8 +32,7 @@ static struct stat buf;
|
||||
/* see whether we should throw away this xlock file;
|
||||
if yes, close it, otherwise leave it open */
|
||||
static int
|
||||
veryold(fd)
|
||||
int fd;
|
||||
veryold(int fd)
|
||||
{
|
||||
time_t date;
|
||||
|
||||
@@ -71,7 +70,7 @@ int fd;
|
||||
}
|
||||
|
||||
static int
|
||||
eraseoldlocks()
|
||||
eraseoldlocks(void)
|
||||
{
|
||||
register int i;
|
||||
|
||||
@@ -92,7 +91,7 @@ eraseoldlocks()
|
||||
}
|
||||
|
||||
void
|
||||
getlock()
|
||||
getlock(void)
|
||||
{
|
||||
register int i = 0, fd, c;
|
||||
const char *fq_lock;
|
||||
@@ -215,8 +214,7 @@ gotlock:
|
||||
|
||||
/* normalize file name - we don't like .'s, /'s, spaces */
|
||||
void
|
||||
regularize(s)
|
||||
register char *s;
|
||||
regularize(char *s)
|
||||
{
|
||||
register char *lp;
|
||||
|
||||
@@ -250,8 +248,7 @@ register char *s;
|
||||
#include <poll.h>
|
||||
|
||||
void
|
||||
msleep(msec)
|
||||
unsigned msec; /* milliseconds */
|
||||
msleep(unsigned msec) /* milliseconds */
|
||||
{
|
||||
struct pollfd unused;
|
||||
int msecs = msec; /* poll API is signed */
|
||||
@@ -264,7 +261,7 @@ unsigned msec; /* milliseconds */
|
||||
|
||||
#ifdef SHELL
|
||||
int
|
||||
dosh()
|
||||
dosh(void)
|
||||
{
|
||||
char *str;
|
||||
|
||||
@@ -290,8 +287,7 @@ dosh()
|
||||
|
||||
#if defined(SHELL) || defined(DEF_PAGER) || defined(DEF_MAILREADER)
|
||||
int
|
||||
child(wt)
|
||||
int wt;
|
||||
child(int wt)
|
||||
{
|
||||
register int f;
|
||||
|
||||
@@ -342,44 +338,42 @@ int wt;
|
||||
|
||||
#ifdef GETRES_SUPPORT
|
||||
|
||||
extern int FDECL(nh_getresuid, (uid_t *, uid_t *, uid_t *));
|
||||
extern uid_t NDECL(nh_getuid);
|
||||
extern uid_t NDECL(nh_geteuid);
|
||||
extern int FDECL(nh_getresgid, (gid_t *, gid_t *, gid_t *));
|
||||
extern gid_t NDECL(nh_getgid);
|
||||
extern gid_t NDECL(nh_getegid);
|
||||
extern int nh_getresuid(uid_t *, uid_t *, uid_t *);
|
||||
extern uid_t nh_getuid(void);
|
||||
extern uid_t nh_geteuid(void);
|
||||
extern int nh_getresgid(gid_t *, gid_t *, gid_t *);
|
||||
extern gid_t nh_getgid(void);
|
||||
extern gid_t nh_getegid(void);
|
||||
|
||||
/* the following several functions assume __STDC__ where parentheses
|
||||
around the name of a function-like macro prevent macro expansion */
|
||||
|
||||
int (getresuid)(ruid, euid, suid)
|
||||
uid_t *ruid, *euid, *suid;
|
||||
int (getresuid)(uid_t *ruid, *euid, *suid)
|
||||
{
|
||||
return nh_getresuid(ruid, euid, suid);
|
||||
}
|
||||
|
||||
uid_t (getuid)()
|
||||
uid_t (getuid)(void)
|
||||
{
|
||||
return nh_getuid();
|
||||
}
|
||||
|
||||
uid_t (geteuid)()
|
||||
uid_t (geteuid)(void)
|
||||
{
|
||||
return nh_geteuid();
|
||||
}
|
||||
|
||||
int (getresgid)(rgid, egid, sgid)
|
||||
gid_t *rgid, *egid, *sgid;
|
||||
int (getresgid)(gid_t *rgid, *egid, *sgid)
|
||||
{
|
||||
return nh_getresgid(rgid, egid, sgid);
|
||||
}
|
||||
|
||||
gid_t (getgid)()
|
||||
gid_t (getgid)(void)
|
||||
{
|
||||
return nh_getgid();
|
||||
}
|
||||
|
||||
gid_t (getegid)()
|
||||
gid_t (getegid)(void)
|
||||
{
|
||||
return nh_getegid();
|
||||
}
|
||||
@@ -389,8 +383,7 @@ gid_t (getegid)()
|
||||
/* XXX should be ifdef PANICTRACE_GDB, but there's no such symbol yet */
|
||||
#ifdef PANICTRACE
|
||||
boolean
|
||||
file_exists(path)
|
||||
const char *path;
|
||||
file_exists(const char *path)
|
||||
{
|
||||
struct stat sb;
|
||||
|
||||
|
||||
@@ -22,9 +22,8 @@ extern INPUT_RECORD ir;
|
||||
char dllname[512];
|
||||
char *shortdllname;
|
||||
|
||||
int FDECL(__declspec(dllexport) __stdcall ProcessKeystroke,
|
||||
(HANDLE hConIn, INPUT_RECORD *ir, boolean *valid,
|
||||
BOOLEAN_P numberpad, int portdebug));
|
||||
int __declspec(dllexport) __stdcall ProcessKeystroke(HANDLE hConIn,
|
||||
INPUT_RECORD *ir, boolean *valid, boolean numberpad, int portdebug);
|
||||
|
||||
int WINAPI
|
||||
DllMain(HINSTANCE hInstance, DWORD fdwReason, PVOID pvReserved)
|
||||
@@ -101,17 +100,16 @@ static const struct pad {
|
||||
|
||||
#define inmap(x, vk) (((x) > 'A' && (x) < 'Z') || (vk) == 0xBF || (x) == '2')
|
||||
|
||||
int __declspec(dllexport) __stdcall ProcessKeystroke(hConIn, ir, valid,
|
||||
numberpad, portdebug)
|
||||
HANDLE hConIn;
|
||||
INPUT_RECORD *ir;
|
||||
boolean *valid;
|
||||
boolean numberpad;
|
||||
int portdebug;
|
||||
int __declspec(dllexport) __stdcall
|
||||
ProcessKeystroke(
|
||||
HANDLE hConIn,
|
||||
INPUT_RECORD *ir,
|
||||
boolean *valid,
|
||||
boolean numberpad,
|
||||
int portdebug)
|
||||
{
|
||||
int metaflags = 0, k = 0;
|
||||
int keycode, vk;
|
||||
unsigned char ch, pre_ch, mk = 0;
|
||||
unsigned char ch, pre_ch;
|
||||
unsigned short int scan;
|
||||
unsigned long shiftstate;
|
||||
int altseq = 0;
|
||||
@@ -193,9 +191,10 @@ int portdebug;
|
||||
return ch;
|
||||
}
|
||||
|
||||
int __declspec(dllexport) __stdcall NHkbhit(hConIn, ir)
|
||||
HANDLE hConIn;
|
||||
INPUT_RECORD *ir;
|
||||
int __declspec(dllexport) __stdcall
|
||||
NHkbhit(
|
||||
HANDLE hConIn,
|
||||
INPUT_RECORD *ir)
|
||||
{
|
||||
int done = 0; /* true = "stop searching" */
|
||||
int retval; /* true = "we had a match" */
|
||||
@@ -247,20 +246,19 @@ INPUT_RECORD *ir;
|
||||
return retval;
|
||||
}
|
||||
|
||||
int __declspec(dllexport) __stdcall CheckInput(hConIn, ir, count, numpad,
|
||||
mode, mod, cc)
|
||||
HANDLE hConIn;
|
||||
INPUT_RECORD *ir;
|
||||
DWORD *count;
|
||||
boolean numpad;
|
||||
int mode;
|
||||
int *mod;
|
||||
coord *cc;
|
||||
int __declspec(dllexport) __stdcall CheckInput(
|
||||
HANDLE hConIn,
|
||||
INPUT_RECORD *ir,
|
||||
DWORD *count,
|
||||
boolean numpad,
|
||||
int mode,
|
||||
int *mod,
|
||||
coord *cc)
|
||||
{
|
||||
#if defined(SAFERHANGUP)
|
||||
DWORD dwWait;
|
||||
#endif
|
||||
int ch;
|
||||
int ch = 0;
|
||||
boolean valid = 0, done = 0;
|
||||
|
||||
#ifdef QWERTZ_SUPPORT
|
||||
@@ -324,8 +322,8 @@ coord *cc;
|
||||
return mode ? 0 : ch;
|
||||
}
|
||||
|
||||
int __declspec(dllexport) __stdcall SourceWhere(buf)
|
||||
char **buf;
|
||||
int __declspec(dllexport) __stdcall
|
||||
SourceWhere(char** buf)
|
||||
{
|
||||
if (!buf)
|
||||
return 0;
|
||||
@@ -333,8 +331,8 @@ char **buf;
|
||||
return 1;
|
||||
}
|
||||
|
||||
int __declspec(dllexport) __stdcall SourceAuthor(buf)
|
||||
char **buf;
|
||||
int __declspec(dllexport) __stdcall
|
||||
SourceAuthor(char** buf)
|
||||
{
|
||||
if (!buf)
|
||||
return 0;
|
||||
@@ -342,9 +340,8 @@ char **buf;
|
||||
return 1;
|
||||
}
|
||||
|
||||
int __declspec(dllexport) __stdcall KeyHandlerName(buf, full)
|
||||
char **buf;
|
||||
int full;
|
||||
int __declspec(dllexport) __stdcall
|
||||
KeyHandlerName(char** buf, int full)
|
||||
{
|
||||
if (!buf)
|
||||
return 0;
|
||||
|
||||
@@ -29,9 +29,8 @@ extern INPUT_RECORD ir;
|
||||
char dllname[512];
|
||||
char *shortdllname;
|
||||
|
||||
int FDECL(__declspec(dllexport) __stdcall ProcessKeystroke,
|
||||
(HANDLE hConIn, INPUT_RECORD *ir, boolean *valid,
|
||||
BOOLEAN_P numberpad, int portdebug));
|
||||
int __declspec(dllexport) __stdcall ProcessKeystroke(HANDLE hConIn,
|
||||
INPUT_RECORD *ir, boolean *valid, boolean numberpad, int portdebug);
|
||||
|
||||
int WINAPI
|
||||
DllMain(HINSTANCE hInstance, DWORD fdwReason, PVOID pvReserved)
|
||||
@@ -110,17 +109,17 @@ static const struct pad {
|
||||
|
||||
static BYTE KeyState[256];
|
||||
|
||||
int __declspec(dllexport) __stdcall ProcessKeystroke(hConIn, ir, valid,
|
||||
numberpad, portdebug)
|
||||
HANDLE hConIn;
|
||||
INPUT_RECORD *ir;
|
||||
boolean *valid;
|
||||
boolean numberpad;
|
||||
int portdebug;
|
||||
int __declspec(dllexport) __stdcall
|
||||
ProcessKeystroke(
|
||||
HANDLE hConIn,
|
||||
INPUT_RECORD* ir,
|
||||
boolean* valid,
|
||||
boolean numberpad,
|
||||
int portdebug)
|
||||
{
|
||||
int metaflags = 0, k = 0;
|
||||
int k = 0;
|
||||
int keycode, vk;
|
||||
unsigned char ch, pre_ch, mk = 0;
|
||||
unsigned char ch, pre_ch;
|
||||
unsigned short int scan;
|
||||
unsigned long shiftstate;
|
||||
int altseq = 0;
|
||||
@@ -224,9 +223,8 @@ int portdebug;
|
||||
return ch;
|
||||
}
|
||||
|
||||
int __declspec(dllexport) __stdcall NHkbhit(hConIn, ir)
|
||||
HANDLE hConIn;
|
||||
INPUT_RECORD *ir;
|
||||
int __declspec(dllexport) __stdcall
|
||||
NHkbhit(HANDLE hConIn, INPUT_RECORD *ir)
|
||||
{
|
||||
int done = 0; /* true = "stop searching" */
|
||||
int retval; /* true = "we had a match" */
|
||||
@@ -278,20 +276,20 @@ INPUT_RECORD *ir;
|
||||
return retval;
|
||||
}
|
||||
|
||||
int __declspec(dllexport) __stdcall CheckInput(hConIn, ir, count, numpad,
|
||||
mode, mod, cc)
|
||||
HANDLE hConIn;
|
||||
INPUT_RECORD *ir;
|
||||
DWORD *count;
|
||||
boolean numpad;
|
||||
int mode;
|
||||
int *mod;
|
||||
coord *cc;
|
||||
int __declspec(dllexport) __stdcall
|
||||
CheckInput(
|
||||
HANDLE hConIn,
|
||||
INPUT_RECORD *ir,
|
||||
DWORD* count,
|
||||
boolean numpad,
|
||||
int mode,
|
||||
int *mod,
|
||||
coord *cc)
|
||||
{
|
||||
#if defined(SAFERHANGUP)
|
||||
DWORD dwWait;
|
||||
#endif
|
||||
int ch;
|
||||
int ch = 0;
|
||||
boolean valid = 0, done = 0;
|
||||
|
||||
#ifdef QWERTZ_SUPPORT
|
||||
@@ -355,8 +353,8 @@ coord *cc;
|
||||
return mode ? 0 : ch;
|
||||
}
|
||||
|
||||
int __declspec(dllexport) __stdcall SourceWhere(buf)
|
||||
char **buf;
|
||||
int __declspec(dllexport) __stdcall
|
||||
SourceWhere(char** buf)
|
||||
{
|
||||
if (!buf)
|
||||
return 0;
|
||||
@@ -364,8 +362,8 @@ char **buf;
|
||||
return 1;
|
||||
}
|
||||
|
||||
int __declspec(dllexport) __stdcall SourceAuthor(buf)
|
||||
char **buf;
|
||||
int __declspec(dllexport) __stdcall
|
||||
SourceAuthor(char **buf)
|
||||
{
|
||||
if (!buf)
|
||||
return 0;
|
||||
@@ -373,9 +371,8 @@ char **buf;
|
||||
return 1;
|
||||
}
|
||||
|
||||
int __declspec(dllexport) __stdcall KeyHandlerName(buf, full)
|
||||
char **buf;
|
||||
int full;
|
||||
int __declspec(dllexport) __stdcall
|
||||
KeyHandlerName(char **buf, int full)
|
||||
{
|
||||
if (!buf)
|
||||
return 0;
|
||||
|
||||
@@ -169,9 +169,8 @@ extern INPUT_RECORD ir;
|
||||
char dllname[512];
|
||||
char *shortdllname;
|
||||
|
||||
int FDECL(__declspec(dllexport) __stdcall ProcessKeystroke,
|
||||
(HANDLE hConIn, INPUT_RECORD *ir, boolean *valid,
|
||||
BOOLEAN_P numberpad, int portdebug));
|
||||
int __declspec(dllexport) __stdcall ProcessKeystroke(HANDLE hConIn,
|
||||
INPUT_RECORD *ir, boolean *valid, boolean numberpad, int portdebug);
|
||||
|
||||
static INPUT_RECORD bogus_key;
|
||||
|
||||
@@ -262,14 +261,13 @@ static const struct pad {
|
||||
#define inmap(x, vk) (((x) > 'A' && (x) < 'Z') || (vk) == 0xBF || (x) == '2')
|
||||
|
||||
/* Use process_keystroke for key commands, process_keystroke2 for prompts */
|
||||
/* int FDECL(process_keystroke, (INPUT_RECORD *ir, boolean *valid, int
|
||||
* portdebug)); */
|
||||
int FDECL(process_keystroke2, (HANDLE, INPUT_RECORD *ir, boolean *valid));
|
||||
static int FDECL(is_altseq, (unsigned long shiftstate));
|
||||
/* int process_keystroke(INPUT_RECORD *ir, boolean *valid, int
|
||||
* portdebug); */
|
||||
int process_keystroke2(HANDLE, INPUT_RECORD *ir, boolean *valid);
|
||||
static int is_altseq(unsigned long shiftstate);
|
||||
|
||||
static int
|
||||
is_altseq(shiftstate)
|
||||
unsigned long shiftstate;
|
||||
is_altseq(unsigned long shiftstate)
|
||||
{
|
||||
/* We need to distinguish the Alt keys from the AltGr key.
|
||||
* On NT-based Windows, AltGr signals as right Alt and left Ctrl together;
|
||||
@@ -291,17 +289,16 @@ unsigned long shiftstate;
|
||||
}
|
||||
}
|
||||
|
||||
int __declspec(dllexport) __stdcall ProcessKeystroke(hConIn, ir, valid,
|
||||
numberpad, portdebug)
|
||||
HANDLE hConIn;
|
||||
INPUT_RECORD *ir;
|
||||
boolean *valid;
|
||||
boolean numberpad;
|
||||
int portdebug;
|
||||
int __declspec(dllexport) __stdcall
|
||||
ProcessKeystroke(
|
||||
HANDLE hConIn,
|
||||
INPUT_RECORD *ir,
|
||||
boolean *valid,
|
||||
boolean numberpad,
|
||||
int portdebug)
|
||||
{
|
||||
int metaflags = 0, k = 0;
|
||||
int keycode, vk;
|
||||
unsigned char ch, pre_ch, mk = 0;
|
||||
unsigned char ch, pre_ch;
|
||||
unsigned short int scan;
|
||||
unsigned long shiftstate;
|
||||
int altseq = 0;
|
||||
@@ -413,10 +410,10 @@ int portdebug;
|
||||
}
|
||||
|
||||
int
|
||||
process_keystroke2(hConIn, ir, valid)
|
||||
HANDLE hConIn;
|
||||
INPUT_RECORD *ir;
|
||||
boolean *valid;
|
||||
process_keystroke2(
|
||||
HANDLE hConIn,
|
||||
INPUT_RECORD *ir,
|
||||
boolean *valid)
|
||||
{
|
||||
/* Use these values for the numeric keypad */
|
||||
static const char keypad_nums[] = "789-456+1230.";
|
||||
@@ -479,20 +476,20 @@ boolean *valid;
|
||||
return ch;
|
||||
}
|
||||
|
||||
int __declspec(dllexport) __stdcall CheckInput(hConIn, ir, count, numpad,
|
||||
mode, mod, cc)
|
||||
HANDLE hConIn;
|
||||
INPUT_RECORD *ir;
|
||||
DWORD *count;
|
||||
int mode;
|
||||
int *mod;
|
||||
boolean numpad;
|
||||
coord *cc;
|
||||
int __declspec(dllexport) __stdcall
|
||||
CheckInput(
|
||||
HANDLE hConIn,
|
||||
INPUT_RECORD *ir,
|
||||
DWORD *count,
|
||||
boolean numpad,
|
||||
int mode,
|
||||
int *mod,
|
||||
coord *cc)
|
||||
{
|
||||
#if defined(SAFERHANGUP)
|
||||
DWORD dwWait;
|
||||
#endif
|
||||
int ch;
|
||||
int ch = 0;
|
||||
boolean valid = 0, done = 0;
|
||||
|
||||
#ifdef QWERTZ_SUPPORT
|
||||
@@ -577,9 +574,9 @@ coord *cc;
|
||||
return ch;
|
||||
}
|
||||
|
||||
int __declspec(dllexport) __stdcall NHkbhit(hConIn, ir)
|
||||
HANDLE hConIn;
|
||||
INPUT_RECORD *ir;
|
||||
int __declspec(dllexport) __stdcall NHkbhit(
|
||||
HANDLE hConIn,
|
||||
INPUT_RECORD *ir)
|
||||
{
|
||||
int done = 0; /* true = "stop searching" */
|
||||
int retval; /* true = "we had a match" */
|
||||
@@ -637,8 +634,8 @@ INPUT_RECORD *ir;
|
||||
return retval;
|
||||
}
|
||||
|
||||
int __declspec(dllexport) __stdcall SourceWhere(buf)
|
||||
char **buf;
|
||||
int __declspec(dllexport) __stdcall
|
||||
SourceWhere(char** buf)
|
||||
{
|
||||
if (!buf)
|
||||
return 0;
|
||||
@@ -646,8 +643,8 @@ char **buf;
|
||||
return 1;
|
||||
}
|
||||
|
||||
int __declspec(dllexport) __stdcall SourceAuthor(buf)
|
||||
char **buf;
|
||||
int __declspec(dllexport) __stdcall
|
||||
SourceAuthor(char** buf)
|
||||
{
|
||||
if (!buf)
|
||||
return 0;
|
||||
@@ -655,9 +652,9 @@ char **buf;
|
||||
return 1;
|
||||
}
|
||||
|
||||
int __declspec(dllexport) __stdcall KeyHandlerName(buf, full)
|
||||
char **buf;
|
||||
int full;
|
||||
int __declspec(dllexport) __stdcall KeyHandlerName(
|
||||
char **buf,
|
||||
int full)
|
||||
{
|
||||
if (!buf)
|
||||
return 0;
|
||||
|
||||
@@ -17,9 +17,7 @@
|
||||
#ifdef USER_SOUNDS
|
||||
|
||||
void
|
||||
play_usersound(filename, volume)
|
||||
const char *filename;
|
||||
int volume;
|
||||
play_usersound(const char* filename, int volume)
|
||||
{
|
||||
/* pline("play_usersound: %s (%d).", filename, volume); */
|
||||
(void) sndPlaySound(filename, SND_ASYNC | SND_NODEFAULT);
|
||||
|
||||
@@ -70,19 +70,19 @@ cell_t undefined_cell = { CONSOLE_UNDEFINED_CHARACTER,
|
||||
* GetConsoleOutputCP
|
||||
*/
|
||||
|
||||
static BOOL FDECL(CtrlHandler, (DWORD));
|
||||
static void FDECL(xputc_core, (char));
|
||||
void FDECL(cmov, (int, int));
|
||||
void FDECL(nocmov, (int, int));
|
||||
int FDECL(process_keystroke,
|
||||
(INPUT_RECORD *, boolean *, BOOLEAN_P numberpad, int portdebug));
|
||||
static void NDECL(init_ttycolor);
|
||||
static void NDECL(really_move_cursor);
|
||||
static void NDECL(check_and_set_font);
|
||||
static boolean NDECL(check_font_widths);
|
||||
static void NDECL(set_known_good_console_font);
|
||||
static void NDECL(restore_original_console_font);
|
||||
extern void NDECL(safe_routines);
|
||||
static BOOL CtrlHandler(DWORD);
|
||||
static void xputc_core(char);
|
||||
void cmov(int, int);
|
||||
void nocmov(int, int);
|
||||
int process_keystroke(INPUT_RECORD *, boolean *, boolean numberpad,
|
||||
int portdebug);
|
||||
static void init_ttycolor(void);
|
||||
static void really_move_cursor(void);
|
||||
static void check_and_set_font(void);
|
||||
static boolean check_font_widths(void);
|
||||
static void set_known_good_console_font(void);
|
||||
static void restore_original_console_font(void);
|
||||
extern void safe_routines(void);
|
||||
|
||||
/* Win32 Screen buffer,coordinate,console I/O information */
|
||||
COORD ntcoord;
|
||||
@@ -105,8 +105,8 @@ static boolean init_ttycolor_completed;
|
||||
static boolean display_cursor_info = FALSE;
|
||||
#endif
|
||||
#ifdef CHANGE_COLOR
|
||||
static void NDECL(adjust_palette);
|
||||
static int FDECL(match_color_name, (const char *));
|
||||
static void adjust_palette(void);
|
||||
static int match_color_name(const char *);
|
||||
typedef HWND(WINAPI *GETCONSOLEWINDOW)();
|
||||
static HWND GetConsoleHandle(void);
|
||||
static HWND GetConsoleHwnd(void);
|
||||
@@ -181,11 +181,11 @@ char erase_char, kill_char;
|
||||
|
||||
/* dynamic keystroke handling .DLL support */
|
||||
typedef int(__stdcall *PROCESS_KEYSTROKE)(HANDLE, INPUT_RECORD *, boolean *,
|
||||
BOOLEAN_P, int);
|
||||
boolean, int);
|
||||
|
||||
typedef int(__stdcall *NHKBHIT)(HANDLE, INPUT_RECORD *);
|
||||
|
||||
typedef int(__stdcall *CHECKINPUT)(HANDLE, INPUT_RECORD *, DWORD *, BOOLEAN_P,
|
||||
typedef int(__stdcall *CHECKINPUT)(HANDLE, INPUT_RECORD *, DWORD *, boolean,
|
||||
int, int *, coord *);
|
||||
|
||||
typedef int(__stdcall *SOURCEWHERE)(char **);
|
||||
@@ -305,8 +305,7 @@ gettty()
|
||||
|
||||
/* reset terminal to original state */
|
||||
void
|
||||
settty(s)
|
||||
const char *s;
|
||||
settty(const char* s)
|
||||
{
|
||||
cmov(ttyDisplay->curx, ttyDisplay->cury);
|
||||
end_screen();
|
||||
@@ -334,8 +333,7 @@ setftty()
|
||||
}
|
||||
|
||||
void
|
||||
tty_startup(wid, hgt)
|
||||
int *wid, *hgt;
|
||||
tty_startup(int *wid, int *hgt)
|
||||
{
|
||||
*wid = console.width;
|
||||
*hgt = console.height;
|
||||
@@ -343,8 +341,7 @@ int *wid, *hgt;
|
||||
}
|
||||
|
||||
void
|
||||
tty_number_pad(state)
|
||||
int state;
|
||||
tty_number_pad(int state)
|
||||
{
|
||||
// do nothing
|
||||
}
|
||||
@@ -367,8 +364,7 @@ tty_end_screen()
|
||||
}
|
||||
|
||||
static BOOL
|
||||
CtrlHandler(ctrltype)
|
||||
DWORD ctrltype;
|
||||
CtrlHandler(DWORD ctrltype)
|
||||
{
|
||||
switch (ctrltype) {
|
||||
/* case CTRL_C_EVENT: */
|
||||
@@ -392,8 +388,7 @@ DWORD ctrltype;
|
||||
|
||||
/* called by pcmain() and process_options() */
|
||||
void
|
||||
nttty_open(mode)
|
||||
int mode; // unused
|
||||
nttty_open(int mode)
|
||||
{
|
||||
DWORD cmode;
|
||||
|
||||
@@ -421,11 +416,11 @@ nttty_exit()
|
||||
}
|
||||
|
||||
int
|
||||
process_keystroke(ir, valid, numberpad, portdebug)
|
||||
INPUT_RECORD *ir;
|
||||
boolean *valid;
|
||||
boolean numberpad;
|
||||
int portdebug;
|
||||
process_keystroke(
|
||||
INPUT_RECORD *ir,
|
||||
boolean *valid,
|
||||
boolean numberpad,
|
||||
int portdebug)
|
||||
{
|
||||
int ch;
|
||||
|
||||
@@ -473,11 +468,10 @@ tgetch()
|
||||
}
|
||||
|
||||
int
|
||||
ntposkey(x, y, mod)
|
||||
int *x, *y, *mod;
|
||||
ntposkey(int *x, int *y, int *mod)
|
||||
{
|
||||
int ch;
|
||||
coord cc;
|
||||
coord cc = { 0, 0 };
|
||||
DWORD count;
|
||||
boolean numpad = iflags.num_pad;
|
||||
|
||||
@@ -542,8 +536,7 @@ really_move_cursor()
|
||||
}
|
||||
|
||||
void
|
||||
cmov(x, y)
|
||||
register int x, y;
|
||||
cmov(int x, int y)
|
||||
{
|
||||
ttyDisplay->cury = y;
|
||||
ttyDisplay->curx = x;
|
||||
@@ -552,8 +545,7 @@ register int x, y;
|
||||
}
|
||||
|
||||
void
|
||||
nocmov(x, y)
|
||||
int x, y;
|
||||
nocmov(int x, int y)
|
||||
{
|
||||
ttyDisplay->curx = x;
|
||||
ttyDisplay->cury = y;
|
||||
@@ -563,8 +555,7 @@ int x, y;
|
||||
|
||||
/* same signature as 'putchar()' with potential failure result ignored */
|
||||
int
|
||||
xputc(ch)
|
||||
int ch;
|
||||
xputc(int ch)
|
||||
{
|
||||
set_console_cursor(ttyDisplay->curx, ttyDisplay->cury);
|
||||
xputc_core((char) ch);
|
||||
@@ -572,8 +563,7 @@ int ch;
|
||||
}
|
||||
|
||||
void
|
||||
xputs(s)
|
||||
const char *s;
|
||||
xputs(const char* s)
|
||||
{
|
||||
int k;
|
||||
int slen = (int) strlen(s);
|
||||
@@ -592,8 +582,7 @@ const char *s;
|
||||
* on the display.
|
||||
*/
|
||||
void
|
||||
xputc_core(ch)
|
||||
char ch;
|
||||
xputc_core(char ch)
|
||||
{
|
||||
nhassert(console.cursor.X >= 0 && console.cursor.X < console.width);
|
||||
nhassert(console.cursor.Y >= 0 && console.cursor.Y < console.height);
|
||||
@@ -652,8 +641,7 @@ char ch;
|
||||
*/
|
||||
|
||||
void
|
||||
g_putch(in_ch)
|
||||
int in_ch;
|
||||
g_putch(int in_ch)
|
||||
{
|
||||
boolean inverse = FALSE;
|
||||
unsigned char ch = (unsigned char) in_ch;
|
||||
@@ -676,7 +664,7 @@ int in_ch;
|
||||
}
|
||||
|
||||
void
|
||||
cl_end()
|
||||
cl_end(void)
|
||||
{
|
||||
set_console_cursor(ttyDisplay->curx, ttyDisplay->cury);
|
||||
buffer_clear_to_end_of_line(console.back_buffer, console.cursor.X,
|
||||
@@ -685,7 +673,7 @@ cl_end()
|
||||
}
|
||||
|
||||
void
|
||||
raw_clear_screen()
|
||||
raw_clear_screen(void)
|
||||
{
|
||||
if (WINDOWPORT("tty")) {
|
||||
cell_t * back = console.back_buffer;
|
||||
@@ -715,28 +703,28 @@ raw_clear_screen()
|
||||
}
|
||||
|
||||
void
|
||||
clear_screen()
|
||||
clear_screen(void)
|
||||
{
|
||||
buffer_fill_to_end(console.back_buffer, &clear_cell, 0, 0);
|
||||
home();
|
||||
}
|
||||
|
||||
void
|
||||
home()
|
||||
home(void)
|
||||
{
|
||||
ttyDisplay->curx = ttyDisplay->cury = 0;
|
||||
set_console_cursor(ttyDisplay->curx, ttyDisplay->cury);
|
||||
}
|
||||
|
||||
void
|
||||
backsp()
|
||||
backsp(void)
|
||||
{
|
||||
set_console_cursor(ttyDisplay->curx, ttyDisplay->cury);
|
||||
xputc_core('\b');
|
||||
}
|
||||
|
||||
void
|
||||
cl_eos()
|
||||
cl_eos(void)
|
||||
{
|
||||
buffer_fill_to_end(console.back_buffer, &clear_cell, ttyDisplay->curx,
|
||||
ttyDisplay->cury);
|
||||
@@ -744,7 +732,7 @@ cl_eos()
|
||||
}
|
||||
|
||||
void
|
||||
tty_nhbell()
|
||||
tty_nhbell(void)
|
||||
{
|
||||
if (flags.silent || iflags.debug_fuzzer)
|
||||
return;
|
||||
@@ -754,7 +742,7 @@ tty_nhbell()
|
||||
volatile int junk; /* prevent optimizer from eliminating loop below */
|
||||
|
||||
void
|
||||
tty_delay_output()
|
||||
tty_delay_output(void)
|
||||
{
|
||||
/* delay 50 ms - uses ANSI C clock() function now */
|
||||
clock_t goal;
|
||||
@@ -792,7 +780,7 @@ tty_delay_output()
|
||||
*/
|
||||
|
||||
static void
|
||||
init_ttycolor()
|
||||
init_ttycolor(void)
|
||||
{
|
||||
#ifdef TEXTCOLOR
|
||||
ttycolors[CLR_BLACK] = FOREGROUND_INTENSITY; /* fix by Quietust */
|
||||
@@ -927,20 +915,20 @@ term_end_color(void)
|
||||
}
|
||||
|
||||
void
|
||||
standoutbeg()
|
||||
standoutbeg(void)
|
||||
{
|
||||
term_start_attr(ATR_BOLD);
|
||||
}
|
||||
|
||||
void
|
||||
standoutend()
|
||||
standoutend(void)
|
||||
{
|
||||
term_end_attr(ATR_BOLD);
|
||||
}
|
||||
|
||||
#ifndef NO_MOUSE_ALLOWED
|
||||
void
|
||||
toggle_mouse_support()
|
||||
toggle_mouse_support(void)
|
||||
{
|
||||
static int qeinit = 0;
|
||||
DWORD cmode;
|
||||
@@ -972,8 +960,7 @@ toggle_mouse_support()
|
||||
|
||||
/* handle tty options updates here */
|
||||
void
|
||||
nttty_preference_update(pref)
|
||||
const char *pref;
|
||||
nttty_preference_update(const char* pref)
|
||||
{
|
||||
if (stricmp(pref, "mouse_support") == 0) {
|
||||
#ifndef NO_MOUSE_ALLOWED
|
||||
@@ -987,11 +974,11 @@ const char *pref;
|
||||
|
||||
#ifdef PORT_DEBUG
|
||||
void
|
||||
win32con_debug_keystrokes()
|
||||
win32con_debug_keystrokes(void)
|
||||
{
|
||||
DWORD count;
|
||||
boolean valid = 0;
|
||||
int ch;
|
||||
int ch = 0;
|
||||
xputs("\n");
|
||||
while (!valid || ch != 27) {
|
||||
nocmov(ttyDisplay->curx, ttyDisplay->cury);
|
||||
@@ -1002,7 +989,7 @@ win32con_debug_keystrokes()
|
||||
(void) doredraw();
|
||||
}
|
||||
void
|
||||
win32con_handler_info()
|
||||
win32con_handler_info(void)
|
||||
{
|
||||
char *buf;
|
||||
int ci;
|
||||
@@ -1034,15 +1021,14 @@ win32con_handler_info()
|
||||
}
|
||||
|
||||
void
|
||||
win32con_toggle_cursor_info()
|
||||
win32con_toggle_cursor_info(void)
|
||||
{
|
||||
display_cursor_info = !display_cursor_info;
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
map_subkeyvalue(op)
|
||||
register char *op;
|
||||
map_subkeyvalue(char* op)
|
||||
{
|
||||
char digits[] = "0123456789";
|
||||
int length, i, idx, val;
|
||||
@@ -1074,7 +1060,7 @@ register char *op;
|
||||
key_overrides[idx] = val;
|
||||
}
|
||||
|
||||
void unload_keyboard_handler()
|
||||
void unload_keyboard_handler(void)
|
||||
{
|
||||
nhassert(keyboard_handler.hLibrary != NULL);
|
||||
|
||||
@@ -1170,7 +1156,7 @@ VA_DECL(const char *, s)
|
||||
}
|
||||
|
||||
void
|
||||
synch_cursor()
|
||||
synch_cursor(void)
|
||||
{
|
||||
really_move_cursor();
|
||||
}
|
||||
@@ -1396,7 +1382,7 @@ static void GetConsoleSizeInfo(CONSOLE_INFO *pci);
|
||||
VOID WINAPI SetConsolePalette(COLORREF crPalette[16]);
|
||||
|
||||
void
|
||||
adjust_palette(VOID_ARGS)
|
||||
adjust_palette(void)
|
||||
{
|
||||
SetConsolePalette(UserDefinedColors);
|
||||
altered_palette = 0;
|
||||
@@ -1639,6 +1625,9 @@ check_font_widths()
|
||||
/* select font */
|
||||
HGDIOBJ saved_font = SelectObject(hDC, console_font);
|
||||
|
||||
/* measure the set of used glyphs to ensure they fit */
|
||||
boolean all_glyphs_fit = FALSE;
|
||||
|
||||
/* determine whether it is a true type font */
|
||||
TEXTMETRICA tm;
|
||||
success = GetTextMetricsA(hDC, &tm);
|
||||
@@ -1664,8 +1653,7 @@ check_font_widths()
|
||||
if (used[i])
|
||||
wcUsed[wcUsedCount++] = cp437[i];
|
||||
|
||||
/* measure the set of used glyphs to ensure they fit */
|
||||
boolean all_glyphs_fit = TRUE;
|
||||
all_glyphs_fit = TRUE;
|
||||
|
||||
for (int i = 0; i < wcUsedCount; i++) {
|
||||
int width;
|
||||
@@ -1911,12 +1899,12 @@ void nethack_enter_nttty()
|
||||
|
||||
/* grow the size of the console buffer if it is not wide enough */
|
||||
if (console.origcsbi.dwSize.X < console.width) {
|
||||
COORD size = {
|
||||
size.Y = console.origcsbi.dwSize.Y,
|
||||
size.X = console.width
|
||||
COORD screen_size = {
|
||||
screen_size.Y = console.origcsbi.dwSize.Y,
|
||||
screen_size.X = console.width
|
||||
};
|
||||
|
||||
SetConsoleScreenBufferSize(console.hConOut, size);
|
||||
SetConsoleScreenBufferSize(console.hConOut, screen_size);
|
||||
}
|
||||
|
||||
/* setup front and back buffers */
|
||||
|
||||
@@ -18,12 +18,12 @@ struct window_procs Qt_procs = { "-guistubs" };
|
||||
int qt_tilewidth, qt_tileheight, qt_fontsize, qt_compact_mode;
|
||||
#endif
|
||||
void
|
||||
mswin_destroy_reg()
|
||||
mswin_destroy_reg(void)
|
||||
{
|
||||
return;
|
||||
}
|
||||
void
|
||||
mswin_raw_print_flush()
|
||||
mswin_raw_print_flush(void)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -41,9 +41,7 @@ extern char default_window_sys[];
|
||||
extern int mingw_main(int argc, char **argv);
|
||||
|
||||
int
|
||||
main(argc, argv)
|
||||
int argc;
|
||||
char *argv[];
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
boolean resuming;
|
||||
|
||||
@@ -69,54 +67,50 @@ char erase_char, kill_char;
|
||||
#endif
|
||||
|
||||
void
|
||||
win_tty_init(dir)
|
||||
int dir;
|
||||
win_tty_init(int dir)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
void
|
||||
nttty_open(mode)
|
||||
int mode;
|
||||
nttty_open(int mode)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
int
|
||||
xputc(ch)
|
||||
int ch;
|
||||
xputc(int ch)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
xputs(s)
|
||||
const char *s;
|
||||
xputs(const char *s)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
void
|
||||
raw_clear_screen()
|
||||
raw_clear_screen(void)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
void
|
||||
clear_screen()
|
||||
clear_screen(void)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
void
|
||||
backsp()
|
||||
backsp(void)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
#ifndef NO_MOUSE_ALLOWED
|
||||
void
|
||||
toggle_mouse_support()
|
||||
toggle_mouse_support(void)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -124,20 +118,19 @@ toggle_mouse_support()
|
||||
|
||||
#ifdef PORT_DEBUG
|
||||
void
|
||||
win32con_debug_keystrokes()
|
||||
win32con_debug_keystrokes(void)
|
||||
{
|
||||
return;
|
||||
}
|
||||
void
|
||||
win32con_handler_info()
|
||||
win32con_handler_info(void)
|
||||
{
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
map_subkeyvalue(op)
|
||||
register char *op;
|
||||
map_subkeyvalue(char *op)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -166,20 +159,20 @@ VA_DECL(const char *, s)
|
||||
|
||||
#ifdef TTY_GRAPHICS
|
||||
void
|
||||
synch_cursor()
|
||||
synch_cursor(void)
|
||||
{
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
more()
|
||||
more(void)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
void
|
||||
nethack_enter_nttty()
|
||||
nethack_enter_nttty(void)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -192,8 +185,7 @@ set_altkeyhandler(const char *inName)
|
||||
|
||||
#if defined(USER_SOUNDS) && defined(TTY_SOUND_ESCCODES)
|
||||
void
|
||||
play_usersound_via_idx(idx, volume)
|
||||
int idx, volume;
|
||||
play_usersound_via_idx(int idx, int volume)
|
||||
{
|
||||
}
|
||||
#endif /* USER_SOUNDS && TTY_SOUND_ESCCODES */
|
||||
|
||||
@@ -25,7 +25,7 @@ typedef struct {
|
||||
|
||||
Win10 gWin10 = { 0 };
|
||||
|
||||
void win10_init()
|
||||
void win10_init(void)
|
||||
{
|
||||
if (IsWindows10OrGreater())
|
||||
{
|
||||
@@ -107,7 +107,7 @@ void win10_monitor_info(HWND hWnd, MonitorInfo * monitorInfo)
|
||||
}
|
||||
|
||||
BOOL
|
||||
win10_is_desktop_bridge_application()
|
||||
win10_is_desktop_bridge_application(void)
|
||||
{
|
||||
if (gWin10.Valid) {
|
||||
UINT32 length = 0;
|
||||
|
||||
@@ -17,23 +17,21 @@
|
||||
#error You must #define SAFEPROCS to build windmain.c
|
||||
#endif
|
||||
|
||||
#define E extern
|
||||
static void FDECL(process_options, (int argc, char **argv));
|
||||
static void NDECL(nhusage);
|
||||
static char *NDECL(get_executable_path);
|
||||
char *FDECL(translate_path_variables, (const char *, char *));
|
||||
char *NDECL(exename);
|
||||
boolean NDECL(fakeconsole);
|
||||
void NDECL(freefakeconsole);
|
||||
E void FDECL(nethack_exit, (int)) NORETURN;
|
||||
static void process_options(int argc, char **argv);
|
||||
static void nhusage(void);
|
||||
static char *get_executable_path(void);
|
||||
char *translate_path_variables(const char *, char *);
|
||||
char *exename(void);
|
||||
boolean fakeconsole(void);
|
||||
void freefakeconsole(void);
|
||||
extern void nethack_exit(int) NORETURN;
|
||||
#if defined(MSWIN_GRAPHICS)
|
||||
E void NDECL(mswin_destroy_reg);
|
||||
extern void mswin_destroy_reg(void);
|
||||
#endif
|
||||
#ifdef TTY_GRAPHICS
|
||||
extern void NDECL(backsp);
|
||||
extern void backsp(void);
|
||||
#endif
|
||||
extern void NDECL(clear_screen);
|
||||
#undef E
|
||||
extern void clear_screen(void);
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#ifdef kbhit
|
||||
@@ -43,18 +41,18 @@ extern void NDECL(clear_screen);
|
||||
#endif
|
||||
|
||||
#ifdef PC_LOCKING
|
||||
static int NDECL(eraseoldlocks);
|
||||
static int eraseoldlocks(void);
|
||||
#endif
|
||||
int NDECL(windows_nhgetch);
|
||||
void NDECL(windows_nhbell);
|
||||
int FDECL(windows_nh_poskey, (int *, int *, int *));
|
||||
void FDECL(windows_raw_print, (const char *));
|
||||
char FDECL(windows_yn_function, (const char *, const char *, CHAR_P));
|
||||
static void FDECL(windows_getlin, (const char *, char *));
|
||||
extern int NDECL(windows_console_custom_nhgetch);
|
||||
void NDECL(safe_routines);
|
||||
int NDECL(tty_self_recover_prompt);
|
||||
int NDECL(other_self_recover_prompt);
|
||||
int windows_nhgetch(void);
|
||||
void windows_nhbell(void);
|
||||
int windows_nh_poskey(int *, int *, int *);
|
||||
void windows_raw_print(const char *);
|
||||
char windows_yn_function(const char *, const char *, char);
|
||||
static void windows_getlin(const char *, char *);
|
||||
extern int windows_console_custom_nhgetch(void);
|
||||
void safe_routines(void);
|
||||
int tty_self_recover_prompt(void);
|
||||
int other_self_recover_prompt(void);
|
||||
|
||||
char orgdir[PATHLEN];
|
||||
boolean getreturn_enabled;
|
||||
@@ -233,9 +231,6 @@ const char *get_portable_device()
|
||||
void
|
||||
set_default_prefix_locations(const char *programPath)
|
||||
{
|
||||
char *envp = NULL;
|
||||
char *sptr = NULL;
|
||||
|
||||
static char executable_path[MAX_PATH];
|
||||
static char profile_path[MAX_PATH];
|
||||
static char versioned_profile_path[MAX_PATH];
|
||||
@@ -404,18 +399,14 @@ copy_hack_content()
|
||||
*/
|
||||
int
|
||||
#ifndef __MINGW32__
|
||||
main(argc, argv)
|
||||
main(int argc, char *argv[])
|
||||
#else
|
||||
mingw_main(argc, argv)
|
||||
mingw_main(int argc, char *argv[])
|
||||
#endif
|
||||
int argc;
|
||||
char *argv[];
|
||||
{
|
||||
boolean resuming = FALSE; /* assume new game */
|
||||
NHFILE *nhfp;
|
||||
char *windowtype = NULL;
|
||||
char *envp = NULL;
|
||||
char *sptr = NULL;
|
||||
char fnamebuf[BUFSZ], encodedfnamebuf[BUFSZ];
|
||||
char failbuf[BUFSZ];
|
||||
|
||||
@@ -639,9 +630,7 @@ attempt_restore:
|
||||
}
|
||||
|
||||
static void
|
||||
process_options(argc, argv)
|
||||
int argc;
|
||||
char *argv[];
|
||||
process_options(int argc, char * argv[])
|
||||
{
|
||||
int i;
|
||||
|
||||
@@ -805,7 +794,7 @@ char *argv[];
|
||||
}
|
||||
|
||||
static void
|
||||
nhusage()
|
||||
nhusage(void)
|
||||
{
|
||||
char buf1[BUFSZ], buf2[BUFSZ], *bufptr;
|
||||
|
||||
@@ -842,7 +831,7 @@ nhusage()
|
||||
}
|
||||
|
||||
void
|
||||
safe_routines(VOID_ARGS)
|
||||
safe_routines(void)
|
||||
{
|
||||
/*
|
||||
* Get a set of valid safe windowport function
|
||||
@@ -856,7 +845,7 @@ safe_routines(VOID_ARGS)
|
||||
|
||||
#ifdef PORT_HELP
|
||||
void
|
||||
port_help()
|
||||
port_help(void)
|
||||
{
|
||||
/* display port specific help file */
|
||||
display_file(PORT_HELP, 1);
|
||||
@@ -865,7 +854,7 @@ port_help()
|
||||
|
||||
/* validate wizard mode if player has requested access to it */
|
||||
boolean
|
||||
authorize_wizard_mode()
|
||||
authorize_wizard_mode(void)
|
||||
{
|
||||
if (!strcmp(g.plname, WIZARD_NAME))
|
||||
return TRUE;
|
||||
@@ -881,7 +870,7 @@ extern HANDLE hConOut;
|
||||
boolean has_fakeconsole;
|
||||
|
||||
char *
|
||||
exename()
|
||||
exename(void)
|
||||
{
|
||||
int bsize = PATHLEN;
|
||||
char *tmp = exenamebuf, *tmp2;
|
||||
@@ -940,7 +929,7 @@ void freefakeconsole()
|
||||
#endif
|
||||
|
||||
char *
|
||||
get_executable_path()
|
||||
get_executable_path(void)
|
||||
{
|
||||
static char path_buffer[MAX_PATH];
|
||||
|
||||
@@ -964,9 +953,7 @@ get_executable_path()
|
||||
}
|
||||
|
||||
char *
|
||||
translate_path_variables(str, buf)
|
||||
const char *str;
|
||||
char *buf;
|
||||
translate_path_variables(const char* str, char* buf)
|
||||
{
|
||||
const char *src;
|
||||
char evar[BUFSZ], *dest, *envp, *eptr = (char *) 0;
|
||||
@@ -1020,8 +1007,7 @@ char *buf;
|
||||
|
||||
/*ARGSUSED*/
|
||||
void
|
||||
windows_raw_print(str)
|
||||
const char *str;
|
||||
windows_raw_print(const char* str)
|
||||
{
|
||||
if (str)
|
||||
fprintf(stdout, "%s\n", str);
|
||||
@@ -1031,56 +1017,49 @@ const char *str;
|
||||
|
||||
/*ARGSUSED*/
|
||||
void
|
||||
windows_raw_print_bold(str)
|
||||
const char *str;
|
||||
windows_raw_print_bold(const char* str)
|
||||
{
|
||||
windows_raw_print(str);
|
||||
return;
|
||||
}
|
||||
|
||||
int
|
||||
windows_nhgetch()
|
||||
windows_nhgetch(void)
|
||||
{
|
||||
return getchar();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
windows_nhbell()
|
||||
windows_nhbell(void)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
/*ARGSUSED*/
|
||||
int
|
||||
windows_nh_poskey(x, y, mod)
|
||||
int *x, *y, *mod;
|
||||
windows_nh_poskey(int *x, int *y, int *mod)
|
||||
{
|
||||
return '\033';
|
||||
}
|
||||
|
||||
/*ARGSUSED*/
|
||||
char
|
||||
windows_yn_function(query, resp, def)
|
||||
const char *query;
|
||||
const char *resp;
|
||||
char def;
|
||||
windows_yn_function(const char* query, const char* resp, char def)
|
||||
{
|
||||
return '\033';
|
||||
}
|
||||
|
||||
/*ARGSUSED*/
|
||||
static void
|
||||
windows_getlin(prompt, outbuf)
|
||||
const char *prompt UNUSED;
|
||||
char *outbuf;
|
||||
windows_getlin(const char* prompt UNUSED, char* outbuf)
|
||||
{
|
||||
Strcpy(outbuf, "\033");
|
||||
}
|
||||
|
||||
#ifdef PC_LOCKING
|
||||
static int
|
||||
eraseoldlocks()
|
||||
eraseoldlocks(void)
|
||||
{
|
||||
register int i;
|
||||
|
||||
@@ -1103,9 +1082,9 @@ eraseoldlocks()
|
||||
}
|
||||
|
||||
int
|
||||
getlock()
|
||||
getlock(void)
|
||||
{
|
||||
register int fd, ern, prompt_result = 0;
|
||||
int fd, ern = 0, prompt_result = 0;
|
||||
int fcmask = FCMASK;
|
||||
#ifndef SELF_RECOVER
|
||||
char tbuf[BUFSZ];
|
||||
@@ -1230,8 +1209,7 @@ gotlock:
|
||||
#endif /* PC_LOCKING */
|
||||
|
||||
boolean
|
||||
file_exists(path)
|
||||
const char *path;
|
||||
file_exists(const char* path)
|
||||
{
|
||||
struct stat sb;
|
||||
|
||||
@@ -1248,9 +1226,7 @@ const char *path;
|
||||
does not exist, it returns TRUE.
|
||||
*/
|
||||
boolean
|
||||
file_newer(a_path, b_path)
|
||||
const char * a_path;
|
||||
const char * b_path;
|
||||
file_newer(const char* a_path, const char* b_path)
|
||||
{
|
||||
struct stat a_sb;
|
||||
struct stat b_sb;
|
||||
@@ -1272,7 +1248,7 @@ const char * b_path;
|
||||
* -1 if old game should be destroyed, allowing new game to proceed.
|
||||
*/
|
||||
int
|
||||
tty_self_recover_prompt()
|
||||
tty_self_recover_prompt(void)
|
||||
{
|
||||
register int c, ci, ct, pl, retval = 0;
|
||||
/* for saving/replacing functions, if needed */
|
||||
@@ -1339,7 +1315,7 @@ tty_self_recover_prompt()
|
||||
}
|
||||
|
||||
int
|
||||
other_self_recover_prompt()
|
||||
other_self_recover_prompt(void)
|
||||
{
|
||||
register int c, ci, ct, pl, retval = 0;
|
||||
boolean ismswin = WINDOWPORT("mswin"),
|
||||
|
||||
@@ -52,10 +52,10 @@ typedef HWND(WINAPI *GETCONSOLEWINDOW)();
|
||||
static HWND GetConsoleHandle(void);
|
||||
static HWND GetConsoleHwnd(void);
|
||||
#if !defined(TTY_GRAPHICS)
|
||||
extern void NDECL(backsp);
|
||||
extern void backsp(void);
|
||||
#endif
|
||||
int NDECL(windows_console_custom_nhgetch);
|
||||
extern void NDECL(safe_routines);
|
||||
int windows_console_custom_nhgetch(void);
|
||||
extern void safe_routines(void);
|
||||
|
||||
/* The function pointer nt_kbhit contains a kbhit() equivalent
|
||||
* which varies depending on which window port is active.
|
||||
@@ -68,15 +68,14 @@ int def_kbhit(void);
|
||||
int (*nt_kbhit)() = def_kbhit;
|
||||
|
||||
char
|
||||
switchar()
|
||||
switchar(void)
|
||||
{
|
||||
/* Could not locate a WIN32 API call for this- MJA */
|
||||
return '-';
|
||||
}
|
||||
|
||||
long
|
||||
freediskspace(path)
|
||||
char *path;
|
||||
freediskspace(char* path)
|
||||
{
|
||||
char tmppath[4];
|
||||
DWORD SectorsPerCluster = 0;
|
||||
@@ -97,8 +96,7 @@ char *path;
|
||||
* Functions to get filenames using wildcards
|
||||
*/
|
||||
int
|
||||
findfirst(path)
|
||||
char *path;
|
||||
findfirst(char* path)
|
||||
{
|
||||
if (ffhandle) {
|
||||
FindClose(ffhandle);
|
||||
@@ -109,20 +107,19 @@ char *path;
|
||||
}
|
||||
|
||||
int
|
||||
findnext()
|
||||
findnext(void)
|
||||
{
|
||||
return FindNextFile(ffhandle, &ffd) ? 1 : 0;
|
||||
}
|
||||
|
||||
char *
|
||||
foundfile_buffer()
|
||||
foundfile_buffer(void)
|
||||
{
|
||||
return &ffd.cFileName[0];
|
||||
}
|
||||
|
||||
long
|
||||
filesize(file)
|
||||
char *file;
|
||||
filesize(char* file)
|
||||
{
|
||||
if (findfirst(file)) {
|
||||
return ((long) ffd.nFileSizeLow);
|
||||
@@ -134,8 +131,7 @@ char *file;
|
||||
* Chdrive() changes the default drive.
|
||||
*/
|
||||
void
|
||||
chdrive(str)
|
||||
char *str;
|
||||
chdrive(char* str)
|
||||
{
|
||||
char *ptr;
|
||||
char drive;
|
||||
@@ -146,7 +142,7 @@ char *str;
|
||||
}
|
||||
|
||||
static int
|
||||
max_filename()
|
||||
max_filename(void)
|
||||
{
|
||||
DWORD maxflen;
|
||||
int status = 0;
|
||||
@@ -160,7 +156,7 @@ max_filename()
|
||||
}
|
||||
|
||||
int
|
||||
def_kbhit()
|
||||
def_kbhit(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
@@ -169,12 +165,11 @@ def_kbhit()
|
||||
* Strip out troublesome file system characters.
|
||||
*/
|
||||
|
||||
void nt_regularize(s) /* normalize file name */
|
||||
register char *s;
|
||||
void nt_regularize(char* s) /* normalize file name */
|
||||
{
|
||||
register unsigned char *lp;
|
||||
unsigned char *lp;
|
||||
|
||||
for (lp = s; *lp; lp++)
|
||||
for (lp = (unsigned char *) s; *lp; lp++)
|
||||
if (*lp == '?' || *lp == '"' || *lp == '\\' || *lp == '/'
|
||||
|| *lp == '>' || *lp == '<' || *lp == '*' || *lp == '|'
|
||||
|| *lp == ':' || (*lp > 127))
|
||||
@@ -185,8 +180,7 @@ register char *s;
|
||||
* This is used in nhlan.c to implement some of the LAN_FEATURES.
|
||||
*/
|
||||
char *
|
||||
get_username(lan_username_size)
|
||||
int *lan_username_size;
|
||||
get_username(int *lan_username_size)
|
||||
{
|
||||
static TCHAR username_buffer[BUFSZ];
|
||||
DWORD i = BUFSZ - 1;
|
||||
@@ -215,7 +209,7 @@ int *lan_username_size;
|
||||
}
|
||||
|
||||
#if 0
|
||||
char *getxxx()
|
||||
char *getxxx(void)
|
||||
{
|
||||
char szFullPath[MAX_PATH] = "";
|
||||
HMODULE hInst = NULL; /* NULL gets the filename of this module */
|
||||
@@ -225,8 +219,8 @@ return &szFullPath[0];
|
||||
}
|
||||
#endif
|
||||
|
||||
extern void NDECL(mswin_raw_print_flush);
|
||||
extern void FDECL(mswin_raw_print, (const char *));
|
||||
extern void mswin_raw_print_flush(void);
|
||||
extern void mswin_raw_print(const char *);
|
||||
|
||||
/* fatal error */
|
||||
/*VARARGS1*/
|
||||
@@ -262,7 +256,7 @@ Delay(int ms)
|
||||
}
|
||||
|
||||
void
|
||||
win32_abort()
|
||||
win32_abort(void)
|
||||
{
|
||||
int c;
|
||||
|
||||
@@ -285,11 +279,7 @@ static char interjection_buf[INTERJECTION_TYPES][1024];
|
||||
static int interjection[INTERJECTION_TYPES];
|
||||
|
||||
void
|
||||
interject_assistance(num, interjection_type, ptr1, ptr2)
|
||||
int num;
|
||||
int interjection_type;
|
||||
genericptr_t ptr1;
|
||||
genericptr_t ptr2;
|
||||
interject_assistance(int num, int interjection_type, genericptr_t ptr1, genericptr_t ptr2)
|
||||
{
|
||||
switch (num) {
|
||||
case 1: {
|
||||
@@ -334,8 +324,7 @@ genericptr_t ptr2;
|
||||
}
|
||||
|
||||
void
|
||||
interject(interjection_type)
|
||||
int interjection_type;
|
||||
interject(int interjection_type)
|
||||
{
|
||||
if (interjection_type >= 0 && interjection_type < INTERJECTION_TYPES)
|
||||
msmsg(interjection_buf[interjection_type]);
|
||||
@@ -343,14 +332,12 @@ int interjection_type;
|
||||
|
||||
#ifdef RUNTIME_PASTEBUF_SUPPORT
|
||||
|
||||
void port_insert_pastebuf(buf)
|
||||
char *buf;
|
||||
void port_insert_pastebuf(char *buf)
|
||||
{
|
||||
/* This implementation will utilize the windows clipboard
|
||||
* to accomplish this.
|
||||
*/
|
||||
|
||||
char *tmp = buf;
|
||||
HGLOBAL hglbCopy;
|
||||
WCHAR *w, w2[2];
|
||||
int cc, rc, abytes;
|
||||
@@ -475,8 +462,7 @@ GetConsoleHwnd(void)
|
||||
#endif
|
||||
|
||||
char *
|
||||
get_port_id(buf)
|
||||
char *buf;
|
||||
get_port_id(char *buf)
|
||||
{
|
||||
Strcpy(buf, TARGET_PORT);
|
||||
return buf;
|
||||
@@ -484,8 +470,7 @@ char *buf;
|
||||
#endif /* RUNTIME_PORT_ID */
|
||||
|
||||
void
|
||||
nethack_exit(code)
|
||||
int code;
|
||||
nethack_exit(int code)
|
||||
{
|
||||
/* Only if we started from the GUI, not the command prompt,
|
||||
* we need to get one last return, so the score board does
|
||||
@@ -511,15 +496,14 @@ int code;
|
||||
#include <conio.h>
|
||||
|
||||
int
|
||||
windows_console_custom_nhgetch(VOID_ARGS)
|
||||
windows_console_custom_nhgetch(void)
|
||||
{
|
||||
return _getch();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
getreturn(str)
|
||||
const char *str;
|
||||
getreturn(const char *str)
|
||||
{
|
||||
static boolean in_getreturn = FALSE;
|
||||
char buf[BUFSZ];
|
||||
@@ -536,7 +520,7 @@ const char *str;
|
||||
|
||||
/* nethack_enter_winnt() is called from main immediately after
|
||||
initializing the window port */
|
||||
void nethack_enter_winnt()
|
||||
void nethack_enter_winnt(void)
|
||||
{
|
||||
if (WINDOWPORT("tty"))
|
||||
nethack_enter_nttty();
|
||||
@@ -631,8 +615,7 @@ BOOL winos_font_support_cp437(HFONT hFont)
|
||||
}
|
||||
|
||||
int
|
||||
windows_early_options(window_opt)
|
||||
const char *window_opt;
|
||||
windows_early_options(const char *window_opt)
|
||||
{
|
||||
/*
|
||||
* If you return 2, the game will exit before it begins.
|
||||
@@ -655,8 +638,7 @@ const char *window_opt;
|
||||
* be room for the \
|
||||
*/
|
||||
void
|
||||
append_slash(name)
|
||||
char *name;
|
||||
append_slash(char *name)
|
||||
{
|
||||
char *ptr;
|
||||
|
||||
@@ -683,7 +665,7 @@ char *name;
|
||||
#endif
|
||||
|
||||
unsigned long
|
||||
sys_random_seed(VOID_ARGS)
|
||||
sys_random_seed(void)
|
||||
{
|
||||
unsigned long ourseed = 0UL;
|
||||
BCRYPT_ALG_HANDLE hRa = (BCRYPT_ALG_HANDLE) 0;
|
||||
@@ -719,10 +701,7 @@ sys_random_seed(VOID_ARGS)
|
||||
|
||||
/* nt_assert_failed is called when an nhassert's condition is false */
|
||||
void
|
||||
nt_assert_failed(expression, filepath, line)
|
||||
const char * expression;
|
||||
const char * filepath;
|
||||
int line;
|
||||
nt_assert_failed(const char *expression, const char *filepath, int line)
|
||||
{
|
||||
const char * filename;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user