switch source tree from k&r to c99

This commit is contained in:
nhmall
2021-01-26 21:06:16 -05:00
parent a2a9cb7b4f
commit f963c5aca7
232 changed files with 12099 additions and 17782 deletions

View File

@@ -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;

View File

@@ -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)

View File

@@ -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;

View File

@@ -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) */

View File

@@ -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 */

View File

@@ -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;

View File

@@ -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 */

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;