The walls for the mines, gehennom, knox, and sokoban had been changed at the "tile"-level, with no awareness of the core game, or non-tile interfaces. - Expand the glyphs to include a set of walls for the main level as well as each of those mentioned above. Altars had been adjusted at the map_glyphinfo() level to substitute some color variations on-the-fly for unaligned, chaotic, neutral, lawful altars, and shrines. The tile interface had no awareness of the feature. - Expand the glyphs to include each of the altar variations that had been implemented in the display code for tty-only. This required the addition of four placeholder tiles in other.txt. Someone with artistic skill will hopefully alter the additional tiles to better reflect their intended purpose. Explosions had unique tiles in the tile window port, and the display code for tty tinkered with the colors, but the game had very little awareness of the different types of explosions. - Expand the glyphs to include each of the explosion types: dark, noxious, muddy, wet, magical, fiery and frosty. Pile-markers to represent a pile had been introduced at the display-level, without little to no awareness by the core game. - Expand the glyphs to include piletops, including objects, bodys, and statues. Recently male and female variations of tiles and monsters had been had been introduced, but the mechanics had been mostly done at the display-level through a marker flag. The window port interface then had to increment the tile mapped to the glyph to get the female version of the tile. - Expand the glyphs to include the male and female versions of the monsters, and their corresponding pet versions, ridden, detected versions and statues of them. Direct references to GLYPH_BODY_OFF and GLYPH_STATUE_OFF in object_from_map() in pager.c were getting incomplete results. - Add macros glyph_to_body_corpsenm(glyph) and glyph_to_statue_corpsenm(glyph) macros for obtaining the corpsenm value after passing the glyph_is_body() or glyph_is_statue() test. Other relevant notes: - The tile ordering in the win/share/*.txt tile files has been altered, other.txt in particular. - tilemap.c has had a lot of alterations to accommodate the expanded glyphs. Output that is useful for troubleshooting will end up in tilemappings.lst if OBTAIN_TILEMAP is defined during build. It lists all of the glyphs and which tile it gets mapped to, and also lists each tile and some of the references to it by various glyphs. - An array glyphmap[MAXGLYPH] is now used. It has an entry for each glyph, ordered by glyph, and once reset_glyphs(glyph) has been run, it contains the mapped symindex, default color, glyphflags, and tile index. If USE_TILES is defined during build, the tile.c produced from the tilemap utility populates the tileidx field of each array element with a glyph-to-tile mapping for the glyph. Later on, when reset_glyphmap() is run, the other fields of each element will get populated. - The glyph-to-tile mapping is an added field available to a window port via the glyphinfo struct passed in the documented interface. The old glyph2tile[] array is gone. The various active window ports that had been using glyph2tile[] have been updated to use the new interface mechanism. Disclaimer: There may be some bug fixing or tidying required in the window port code. - reset_glyphmap() is called after config file options parsing has finished, because some config file settings can impact the results produced by reset_glyphmap(). - Everything that passes the glyph_is_cmap(glyph) test must return a valid cmap value from glyph_to_cmap(glyph). - An 'extern glyph_info glyphmap[MAX_GLYPH];' is inserted into the top of only the files which need awareness of it, not inserted into display.h. Presently, the only files that actually need to directly reference the glyphmap[] array are display.c, o_init.c (for shuffling the tiles), and the generated tile.c (if USE_TILES is defined). - Added an MG_MALE glyphflag to complement the MG_FEMALE glyphflag. - Provide an array for wall colorizations. reset_glyphmap() will draw the colors from this array: int array wallcolors[sokoban_walls + 1]; The indices of the wallcolors array are main_walls (0), mines_walls (1), gehennom_walls (2), knox_walls (3), and sokoban_walls (4). In future, a config file option for adjusting the wall colors and/or an 'O' option menu to do the same could be added. Right now, the initializaton of the wallcolors[] array entries in display.c leaves the walls at CLR_GRAY, matching the defsym color. - Most of the display-level kludges for some of the on-the-fly interface features have been removed from map_glyphinfo() as they aren't needed any longer. These glyph expansions adhere more closely to the original glyph mechanics of the game. - Because the glyphs are re-ordered and expanded, an update to editlevel will be required upon merge of these changes.
319 lines
9.1 KiB
C
319 lines
9.1 KiB
C
/* NetHack 3.7 pcvideo.h $NHDT-Date: 1596498273 2020/08/03 23:44:33 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.11 $ */
|
|
/* Copyright (c) NetHack PC Development Team 1993, 1994 */
|
|
/* NetHack may be freely redistributed. See license for details. */
|
|
/* */
|
|
/*
|
|
* pcvideo.h - Hardware video support definitions and prototypes
|
|
*
|
|
*Edit History:
|
|
* Initial Creation M. Allison 93/10/30
|
|
*
|
|
*/
|
|
|
|
#ifndef PCVIDEO_H
|
|
#define PCVIDEO_H
|
|
|
|
#include "portio.h"
|
|
|
|
#ifdef SCREEN_BIOS
|
|
#if !defined(PC9800)
|
|
#define MONO_CHECK /* Video BIOS can do the check */
|
|
#endif
|
|
#endif
|
|
|
|
#ifdef SCREEN_DJGPPFAST
|
|
/*# define MONO_CHECK */ /* djgpp should be able to do check */
|
|
#endif
|
|
|
|
/*
|
|
* PC interrupts
|
|
*/
|
|
#ifdef PC9800
|
|
#define CRT_BIOS 0x18
|
|
#define DOS_EXT_FUNC 0xdc
|
|
#define DIRECT_CON_IO 0x10
|
|
#else
|
|
#define VIDEO_BIOS 0x10
|
|
#endif
|
|
#define DOSCALL 0x21
|
|
|
|
/*
|
|
* Video BIOS functions
|
|
*/
|
|
#if defined(PC9800)
|
|
#define SENSEMODE 0x0b /* Sense CRT Mode */
|
|
|
|
#define PUTCHAR 0x00 /* Put Character */
|
|
#define SETATT 0x02 /* Set Attribute */
|
|
#define SETCURPOS 0x03 /* Set Cursor Position */
|
|
#define CURSOR_RIGHT 0x08 /* Move Cursor Right */
|
|
#define CURSOR_LEFT 0x09 /* Move Cursor Left */
|
|
#define SCREEN_CLEAR 0x0a /* Clear Screen */
|
|
#define LINE_CLEAR 0x0b /* Clear Line */
|
|
#else
|
|
#define SETCURPOS 0x02 /* Set Cursor Position */
|
|
#endif
|
|
|
|
#define GETCURPOS 0x03 /* Get Cursor Position */
|
|
#define GETMODE 0x0f /* Get Video Mode */
|
|
#define SETMODE 0x00 /* Set Video Mode */
|
|
#define SETPAGE 0x05 /* Set Video Page */
|
|
#define FONTINFO 0x1130 /* Get Font Info */
|
|
#define SCROLL 0x06 /* Scroll or initialize window */
|
|
#define PUTCHARATT 0x09 /* Write attribute & char at cursor */
|
|
|
|
/*
|
|
* VGA Specific Stuff
|
|
*/
|
|
#ifdef SCREEN_VGA
|
|
/* #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 SCREENBYTES 128
|
|
#define CharRows 30
|
|
#define VERT_RETRACE \
|
|
{ \
|
|
while (!(inportb(crt_status) & 0x08)) \
|
|
; \
|
|
}
|
|
#define VERT_RETRACE_END \
|
|
{ \
|
|
while ((inportb(crt_status) & 0x08)) \
|
|
; \
|
|
}
|
|
#else
|
|
#define SCREENBYTES 80
|
|
#endif
|
|
|
|
#define CharacterWidth 8
|
|
#define SCREENHEIGHT 480
|
|
#define SCREENWIDTH (SCREENBYTES * CharacterWidth)
|
|
#define VIDEOSEG 0xa000
|
|
#define FONT_PTR_SEGMENT 0x0000
|
|
#define FONT_PTR_OFFSET 0x010C
|
|
#define SCREENPLANES 4
|
|
#define COLORDEPTH 16
|
|
#define egawriteplane(n) \
|
|
{ \
|
|
outportb(0x3c4, 2); \
|
|
outportb(0x3c5, n); \
|
|
}
|
|
#define egareadplane(n) \
|
|
{ \
|
|
outportb(0x3ce, 4); \
|
|
outportb(0x3cf, n); \
|
|
}
|
|
#define col2x8(c) ((c) *8)
|
|
#define col2x16(c) ((c) *16)
|
|
#define col2x(c) ((c) *2)
|
|
#define row2y(c) ((c) *16)
|
|
#define MAX_ROWS_PER_CELL 16
|
|
#define MAX_COLS_PER_CELL 16
|
|
#define MAX_BYTES_PER_CELL 2 /* MAX_COLS_PER_CELL/8 */
|
|
#define ROWS_PER_CELL MAX_ROWS_PER_CELL
|
|
#define COLS_PER_CELL MAX_COLS_PER_CELL
|
|
#define BYTES_PER_CELL MAX_BYTES_PER_CELL
|
|
|
|
struct cellplane {
|
|
char image[MAX_ROWS_PER_CELL][MAX_BYTES_PER_CELL];
|
|
};
|
|
|
|
struct planar_cell_struct {
|
|
struct cellplane plane[SCREENPLANES];
|
|
};
|
|
|
|
struct overview_cellplane {
|
|
char image[MAX_ROWS_PER_CELL][1];
|
|
};
|
|
|
|
struct overview_planar_cell_struct {
|
|
struct overview_cellplane plane[SCREENPLANES];
|
|
};
|
|
|
|
#endif /* SCREEN_VGA */
|
|
|
|
/*
|
|
* Default color Indexes for hardware palettes
|
|
*
|
|
* Do not change the values below.
|
|
* These are the color mappings defined by the particular video
|
|
* hardware/mode. You can rearrange the NetHack color mappings at
|
|
* run-time via the defaults.nh "videocolors" and "videoshades"
|
|
* settings.
|
|
*
|
|
*/
|
|
|
|
#if defined(SCREEN_BIOS) || defined(SCREEN_DJGPPFAST)
|
|
#define M_BLACK 8
|
|
#define M_WHITE 15
|
|
#define M_GRAY 7 /* low-intensity white */
|
|
#define M_RED 4
|
|
#define M_GREEN 2
|
|
#define M_BROWN 6 /* low-intensity yellow */
|
|
#define M_BLUE 1
|
|
#define M_MAGENTA 5
|
|
#define M_CYAN 3
|
|
#define M_ORANGE 12
|
|
#define M_BRIGHTGREEN 10
|
|
#define M_YELLOW 14
|
|
#define M_BRIGHTBLUE 9
|
|
#define M_BRIGHTMAGENTA 13
|
|
#define M_BRIGHTCYAN 11
|
|
|
|
#define M_TEXT M_GRAY
|
|
#define BACKGROUND_COLOR 1
|
|
#define ATTRIB_NORMAL M_TEXT /* Normal attribute */
|
|
#define ATTRIB_INTENSE M_WHITE /* Intense White */
|
|
#define ATTRIB_MONO_NORMAL 0x01 /* Underlined,white */
|
|
#define ATTRIB_MONO_UNDERLINE 0x01 /* Underlined,white */
|
|
#define ATTRIB_MONO_BLINK 0x87 /* Flash bit, white */
|
|
#define ATTRIB_MONO_REVERSE 0x70 /* Black on white */
|
|
#endif /*SCREEN_BIOS || SCREEN_DJGPPFAST */
|
|
|
|
#if defined(SCREEN_VGA) || defined(SCREEN_8514)
|
|
#define BACKGROUND_VGA_COLOR 1
|
|
#define ATTRIB_VGA_NORMAL CLR_GRAY /* Normal attribute */
|
|
#define ATTRIB_VGA_INTENSE 14 /* Intense White 94/06/07 palette chg*/
|
|
#endif /*SCREEN_VGA || SCREEN_8514*/
|
|
|
|
#if defined(SCREEN_VESA)
|
|
#define BACKGROUND_VESA_COLOR 240
|
|
#endif /*SCREEN_VESA*/
|
|
|
|
#if defined(PC9800)
|
|
static unsigned char attr98[CLR_MAX] = {
|
|
0xe1, /* 0 white */
|
|
0x21, /* 1 blue */
|
|
0x81, /* 2 green */
|
|
0xa1, /* 3 cyan */
|
|
0x41, /* 4 red */
|
|
0x61, /* 5 magenta */
|
|
0xc1, /* 6 yellow */
|
|
0xe1, /* 7 white */
|
|
0xe1, /* 8 white */
|
|
0x25, /* 9 reversed blue */
|
|
0x85, /* 10 reversed green */
|
|
0xa5, /* 11 reversed cyan */
|
|
0x45, /* 12 reversed red */
|
|
0x65, /* 13 reversed magenta */
|
|
0xc5, /* 14 reversed yellow */
|
|
0xe5, /* 15 reversed white */
|
|
};
|
|
#endif
|
|
|
|
#ifdef SIMULATE_CURSOR
|
|
#define CURSOR_HEIGHT 3 /* this should go - MJA */
|
|
/* cursor styles */
|
|
#define CURSOR_INVIS 0 /* cursor not visible at all */
|
|
#define CURSOR_FRAME 1 /* block around the current tile */
|
|
#define CURSOR_UNDERLINE 2 /* thin line at bottom of the tile */
|
|
#define CURSOR_CORNER 3 /* cursor visible at the 4 tile corners */
|
|
#define NUM_CURSOR_TYPES 4 /* number of different cursor types */
|
|
#define CURSOR_DEFAULT_STYLE CURSOR_CORNER
|
|
#define CURSOR_DEFAULT_COLOR M_GRAY
|
|
/* global variables for cursor */
|
|
extern int cursor_type;
|
|
extern int cursor_flag;
|
|
extern int cursor_color;
|
|
#endif
|
|
|
|
/*
|
|
* Function Prototypes
|
|
*
|
|
*/
|
|
|
|
/* ### video.c ### */
|
|
|
|
#ifdef SIMULATE_CURSOR
|
|
extern void DrawCursor(void);
|
|
extern void HideCursor(void);
|
|
#endif
|
|
|
|
/* ### vidtxt.c ### */
|
|
|
|
#ifdef NO_TERMS
|
|
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
|
|
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
|
|
extern void vga_DrawCursor(void);
|
|
#endif
|
|
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
|
|
extern void vga_update_positionbar(char *);
|
|
#endif
|
|
#ifdef SIMULATE_CURSOR
|
|
extern void vga_HideCursor(void);
|
|
#endif
|
|
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(const glyph_info *);
|
|
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
|
|
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
|
|
extern void vesa_DrawCursor(void);
|
|
#endif
|
|
extern void vesa_Finish(void);
|
|
extern void vesa_get_scr_size(void);
|
|
extern void vesa_gotoloc(int, int);
|
|
#ifdef POSITIONBAR
|
|
extern void vesa_update_positionbar(char *);
|
|
#endif
|
|
#ifdef SIMULATE_CURSOR
|
|
extern void vesa_HideCursor(void);
|
|
#endif
|
|
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(const glyph_info *);
|
|
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 */
|
|
|
|
#endif /* PCVIDEO_H */
|
|
/* pcvideo.h */
|