\r
#define MAXPAGE 4\r
\r
+#define BDOFSCONV (unsigned __near)\r
+#define BOFS page[1].data\r
+#define DOFS page[0].data\r
+\r
/*\r
* typedefs of the game variables!\r
*/\r
\r
typedef struct {\r
byte far **data;\r
- word ntiles; /* the number of tiles */\r
- word twidth; /* width of the tiles */\r
- word theight; /* height of the tiles */\r
- byte *palette; /* palette for the tile set */\r
+ word ntiles; // the number of tiles\r
+ word twidth; // width of the tiles\r
+ word theight; // height of the tiles\r
+ byte *palette; // palette for the tile set\r
} tileset_t;\r
\r
typedef struct {\r
byte *palette;\r
} planar_buf_t;\r
\r
-//TODO: 16_mm and 16_ca must handle this\r
-typedef struct {\r
- bitmap_t far *btdata; //old\r
- planar_buf_t far *data; //old\r
- word tileHeight, tileWidth;\r
- unsigned int rows, cols;\r
-// #ifdef __DEBUG__\r
-// boolean debug_text; //show the value of the tile! wwww\r
-// byte *debug_data;\r
-// #endif\r
-} tiles_t;\r
-\r
-//TODO: 16_mm and 16_ca must handle this\r
-//TODO: add variables from 16_ca\r
-typedef struct {\r
- //long planestart[3];\r
- //unsigned planelength[3];\r
- byte *data; //TODO: 16_mm and 16_ca must handle this\r
- byte * far *layerdata; //TODO: 16_mm and 16_ca must handle this\r
- tiles_t *tiles; //TODO: 16_mm and 16_ca must handle this\r
- tiles_t * far *layertile; //TODO: 16_mm and 16_ca must handle this\r
- int width, height; //this has to be signed!\r
- char name[16];\r
-} map_t;\r
-\r
-typedef struct{\r
- word tw; /* screen width in tiles */\r
- word th; /* screen height in tiles */\r
- word tilesw; /* virtual screen width in tiles */\r
- word tilesh; /* virtual screen height in tiles */\r
- sword tilemidposscreenx; /* middle tile x position */ /* needed for scroll system to work accordingly */\r
- sword tilemidposscreeny; /* middle tile y position */ /* needed for scroll system to work accordingly */\r
- sword tileplayerposscreenx; /* player position on screen */ /* needed for scroll and map system to work accordingly */\r
- sword tileplayerposscreeny; /* player position on screen */ /* needed for scroll and map system to work accordingly */\r
-} tileinfo_t;\r
-\r
-typedef struct {\r
- nibble/*word*/ id; /* the Identification number of the page~ For layering~ */\r
- byte far* data; /* the data for the page */\r
- tileinfo_t ti;\r
- word dx; /* col we are viewing on virtual screen (on page[0]) */ /* off screen buffer on the left size */\r
- word dy; /* row we are viewing on virtual screen (on page[0]) */ /* off screen buffer on the top size */\r
- word sw; /* screen width */ /* resolution */\r
- word sh; /* screen heigth */ /* resolution */\r
- word width; /* virtual width of the page */\r
- word height; /* virtual height of the page */\r
- word stridew; /* width/4 */ /* VGA */\r
- word pagesize; /* page size */\r
- word pi; /* increment page by this much to preserve location */\r
- int tlx,tly;\r
-//newer vars\r
-//TODO: find where they are used\r
- sword delta; // How much should we shift the page for smooth scrolling\r
-} page_t;\r
-\r
//from 16_sprit.h\r
#ifdef __WATCOMC__\r
+#include <hw/vga/vrl.h>\r
+\r
+typedef struct vrs_container{\r
+ // Size of a .vrs blob in memory\r
+ // minus header\r
+ dword data_size;\r
+ union{\r
+ byte far *buffer;\r
+ struct vrs_header far *vrs_hdr;\r
+ };\r
+ // Array of corresponding vrl line offsets\r
+ vrl1_vgax_offset_t **vrl_line_offsets;\r
+} vrs_container_t;\r
+\r
+typedef struct vrl_container{\r
+ // Size of a .vrl blob in memory\r
+ // minus header\r
+ dword data_size;\r
+ union{\r
+ byte far *buffer;\r
+ struct vrl1_vgax_header far *vrl_header;\r
+ };\r
+ // Pointer to a corresponding vrl line offsets struct\r
+ vrl1_vgax_offset_t *line_offsets;\r
+} vrl_container_t;\r
+\r
typedef struct sprite\r
{\r
// VRS container from which we will extract animation and image data\r
- struct vrs_container *spritesheet;\r
+ vrs_container_t spritesheet;\r
// Container for a vrl sprite\r
- struct vrl_container *sprite_vrl_cont;\r
+ vrl_container_t sprite_vrl_cont;\r
// Current sprite id\r
int curr_spri_id;\r
// Index of a current sprite in an animation sequence\r
word speed; //entity speed!\r
word spt; //speed per tile\r
#ifdef __WATCOMC__\r
- sprite_t *spri; // sprite used by entity\r
+ sprite_t spri; // sprite used by entity\r
#endif\r
sword hp; //hitpoints of the entity\r
nibble overdraww, overdrawh; // how many pixels to "overdraw" so that moving sprites with edge pixels don't leave streaks.\r
nibble /*int*/ persist_aniframe; // gonna be increased to 1 before being used, so 0 is ok for default\r
} entity_t;\r
\r
+typedef struct\r
+{\r
+ int x; //entity exact position on the viewable map\r
+ int y; //entity exact position on the viewable map\r
+ int tx; //entity tile position on the viewable map\r
+ int ty; //entity tile position on the viewable map\r
+\r
+#ifdef __WATCOMC__\r
+ sprite_t spri; // sprite used by entity\r
+#endif\r
+ sword hp; //hitpoints of the entity\r
+} static_map_entity_t;\r
+\r
+//===========================================================================//\r
+\r
+//TODO: 16_mm and 16_ca must handle this\r
+typedef struct {\r
+#ifdef __WATCOMC__\r
+ sprite_t *spri; // I will probibaly use this --sparky4\r
+#endif\r
+ word tileHeight, tileWidth; //defined by mapfile\r
+ unsigned int rows, cols;\r
+ byte imgname[8]; //image file of tileset (set to 8 because DOS ^^;)\r
+} tiles_t; //seems to be the tileset properties\r
+\r
+//TODO: 16_mm and 16_ca must handle this\r
+//TODO: add variables from 16_ca\r
+typedef struct {\r
+ byte layername[8];\r
+ byte *data; //TODO: 16_mm and 16_ca must handle this\r
+} mapl_t; //map layer array type def\r
+\r
+#define MAPPLANES 3\r
+typedef struct {\r
+ //long planestart[3];\r
+ //unsigned planelength[3];\r
+ mapl_t layerdata[MAPPLANES]; // mapdata for multilayer (map index values for rendering which image on the tile)\r
+ tiles_t *tiles; //TODO: 16_mm and 16_ca must handle this // tilesets for layers (currently ony 4 can be loaded wwww)\r
+ int width, height; //this has to be signed!\r
+ byte name[16];\r
+} map_t;\r
+\r
+//===================================//\r
+\r
+typedef struct{\r
+ word tw; /* screen width in tiles */\r
+ word th; /* screen height in tiles */\r
+ word tilesw; /* virtual screen width in tiles */\r
+ word tilesh; /* virtual screen height in tiles */\r
+ sword tilemidposscreenx; /* middle tile x position */ /* needed for scroll system to work accordingly */\r
+ sword tilemidposscreeny; /* middle tile y position */ /* needed for scroll system to work accordingly */\r
+ sword tileplayerposscreenx; /* player position on screen */ /* needed for scroll and map system to work accordingly */\r
+ sword tileplayerposscreeny; /* player position on screen */ /* needed for scroll and map system to work accordingly */\r
+} pagetileinfo_t;\r
+\r
+typedef struct {\r
+ nibble/*word*/ id; /* the Identification number of the page~ For layering~ */\r
+ byte far* data; /* the data for the page */\r
+ pagetileinfo_t ti; // the tile information of the page\r
+ word dx; /* col we are viewing on virtual screen (on page[0]) */ /* off screen buffer on the left size */\r
+ word dy; /* row we are viewing on virtual screen (on page[0]) */ /* off screen buffer on the top size */\r
+ word sw; /* screen width */ /* resolution */\r
+ word sh; /* screen heigth */ /* resolution */\r
+ word width; /* virtual width of the page */\r
+ word height; /* virtual height of the page */\r
+ word stridew; /* width/4 */ /* VGA */\r
+ word pagesize; /* page size */\r
+ word pi; /* increment page by this much to preserve location */\r
+ int tlx,tly;\r
+//newer vars\r
+//TODO: find where they are used\r
+ sword delta; // How much should we shift the page for smooth scrolling\r
+} page_t;\r
+\r
//from 16_in\r
//==========================================================================\r
+#define KeyInt 9 // The keyboard ISR number\r
+\r
+//\r
+// mouse constants\r
+//\r
+#define MReset 0\r
+#define MButtons 3\r
+#define MDelta 11\r
+\r
+#define MouseInt 0x33\r
+//#define Mouse(x) _AX = x,geninterrupt(MouseInt)\r
+\r
+//\r
+// joystick constants\r
+//\r
+#define JoyScaleMax 32768\r
+#define JoyScaleShift 8\r
+#define MaxJoyValue 5000\r
+\r
+#define MaxPlayers 4\r
+#define MaxKbds 2\r
+#define MaxJoys 2\r
+#define NumCodes 128\r
+\r
typedef byte ScanCode;\r
\r
typedef enum {\r
motion_None = 0,\r
motion_Right = 1,motion_Down = 1\r
} Motion;\r
-typedef enum {\r
- dir_North,//dir_NorthEast,\r
- dir_West,//dir_Nortinest,\r
- dir_None,\r
- dir_East,//,dir_SouthEast,\r
- dir_South,//dir_Soutinest,\r
+typedef enum { // Quick lookup for total direction\r
+ /*dir_NorthWest, */dir_North,/* dir_NorthEast,*/\r
+ dir_West, dir_None, dir_East,\r
+ /*dir_SouthWest, */dir_South/*, dir_SouthEast*/\r
} Direction;\r
typedef struct {\r
boolean near button0,button1,button2,button3;\r
joyMultXH,joyMultYH;\r
} JoystickDef;\r
\r
+typedef struct instat {\r
+ boolean CapsLock;\r
+ ScanCode CurCode,LastCode;\r
+\r
+ boolean Keyboard[NumCodes];\r
+ boolean Paused;\r
+ char LastASCII;\r
+ ScanCode LastScan;\r
+} inst_t;\r
+\r
+typedef struct// inconfig\r
+{\r
+ boolean IN_Started;\r
+//\r
+// configuration variables\r
+//\r
+ boolean JoysPresent[MaxJoys],\r
+ MousePresent,\r
+ JoyPadPresent;\r
+\r
+// Global variables\r
+ KeyboardDef KbdDefs[MaxKbds];\r
+ JoystickDef JoyDefs[MaxJoys];\r
+ inst_t *inst;\r
+} in_info_t;\r
+\r
//==========================================================================\r
\r
typedef struct\r
entity_t near enti;\r
#ifdef __WATCOMC__\r
//struct sprite *spri; //supposively the sprite sheet data\r
- memptr gr;\r
+ //memptr gr;\r
#endif\r
- bitmap_t *data; //supposively the sprite sheet data//old format\r
- bitmap_t bmp;\r
+// bitmap_t *data; //supposively the sprite sheet data//old format\r
+// bitmap_t bmp;\r
\r
//input\r
byte near pdir; //previous direction~ used in IN_16 in IN_ReadControl()\r
word clock_start; //timer start\r
word *clock; //current time on clock\r
boolean fpscap; //cap the fps var\r
+ nibble wcpu; //stored value of cpu type\r
} kurokku_t;\r
\r
+//===================================//\r
+#define PALSIZE 768\r
+#define NUMCHUNKS 416 //keen\r
+#define MAXSCANLINES 240 // size of ylookup table\r
+\r
+typedef struct\r
+{\r
+ int width,height;\r
+} pictabletype;\r
+\r
//video\r
typedef struct\r
{\r
+ word tileHeight, tileWidth; //defined by mapfile\r
+ word quadwh; //preproccessed quad size of tilewidth and tileheight\r
+} tile_dimention_t;\r
+\r
+#define MAXSCROLLEDGES 6\r
+typedef struct\r
+{\r
+ unsigned panx,pany; // panning adjustments inside port in pixels\r
+ unsigned pansx,pansy;\r
+ unsigned panadjust; // panx/pany adjusted by screen resolution\r
+ int hscrollblocks,vscrollblocks;\r
+ int hscrolledge[MAXSCROLLEDGES],vscrolledge[MAXSCROLLEDGES];\r
+} pan_t;\r
+\r
+typedef struct\r
+{\r
+ //ylookup[MAXSCANLINES],\r
unsigned int offscreen_ofs;\r
unsigned int pattern_ofs;\r
-} ofs_t;\r
-#define NUMCHUNKS 416 //keen\r
+// unsigned bufferofs,linewidth,displayofs;\r
+ pan_t pan;\r
+\r
+} ofs_t; //unfinished\r
\r
typedef struct\r
{\r
- char old_mode; //old video mode before game!\r
- byte palette[768]; //palette array\r
- page_t page[MAXPAGE]; //can be used as a pointer to root page[0]\r
- word vmem_remain; //remaining video memory\r
- byte num_of_pages; //number of actual pages\r
- //doslib origi vars\r
+//doslib origi vars\r
byte far * omemptr;\r
byte vga_draw_stride;\r
byte vga_draw_stride_limit; // further X clipping\r
- //end of doslib origi vars\r
+//end of doslib origi vars\r
boolean __near rss; //render sprite switch\r
boolean __near bgps; //bg preservation render switch between old and new\r
+} vga_state_t;\r
+\r
+typedef struct\r
+{\r
+ boolean VL_Started,VL_Initiated;\r
+ char old_mode; //old video mode before game!\r
+ sword curr_mode; //modex curent mode\r
+ byte palette[PALSIZE], dpal[PALSIZE]; //palette array\r
+ page_t page[MAXPAGE]; //can be used as a pointer to root page[0]\r
+ word vmem_remain; //remaining video memory\r
+ byte num_of_pages; //number of actual pages\r
+ vga_state_t vga_state;\r
sword __near sprifilei; //player file's i\r
nibble __near p; //render page number\r
nibble __near sp; //show page number(for showpage)\r
nibble sfip; //shinku_fps_indicator_page; // we're on page 1 now, shinku(). follow along please or it will not be visible.\r
ofs_t ofs; //offset vars used for doslib\r
word vh; //video combined height\r
+ tile_dimention_t td;\r
//0000word startclk; float clk, tickclk; //timer\r
-//newer vars\r
-//TODO: find out how they are used\r
- byte grneeded[NUMCHUNKS];\r
+ //wolf3d vars\r
+ boolean screenfaded;\r
+ word bordercolor;\r
+ boolean fastpalette;\r
+ byte far palette1[256][3],far palette2[256][3];\r
+ pictabletype _seg *pictable;\r
} video_t;\r
\r
//from scroll16\r
int tx,ty; //appears to be the top left tile position on the viewable screen map\r
word dxThresh,dyThresh; //Threshold for physical tile switch\r
video_t *video; //pointer to game variables of the video\r
+ kurokku_t *kurokku; //pointer to game variables of the kurokku\r
nibble __near *p; // pointer to video's render page num\r
nibble __near *sp; // pointer to video's show page num\r
int dx, dy; // draw row and col var\r
//from 16_mm\r
//==========================================================================\r
\r
-#define MAXBLOCKS 1024\r
-#define MAXUMBS 12\r
+#define MAXBLOCKS 800//kd=1300 wolf3d=700 cata=600\r
\r
typedef struct mmblockstruct\r
{\r
- word start,length;\r
- //word start; dword length;\r
- word blob; //for data larger than 64k\r
+ unsigned start,length;\r
unsigned attributes;\r
memptr *useptr; // pointer to the segment start\r
struct mmblockstruct far *next;\r
} mmblocktype;\r
\r
+typedef struct mmshowmemoryinfo\r
+{\r
+ word x,y;\r
+ mmblocktype far *scan;\r
+} mmshowmemoryinfo_t;\r
+\r
typedef struct\r
{\r
dword nearheap,farheap,EMSmem,XMSmem,mainmem;\r
\r
typedef struct\r
{\r
- memptr bufferseg;\r
boolean mmstarted, bombonerror, mmerror;\r
void far *farheap;\r
#ifdef __BORLANDC__\r
- void *nearheap;\r
+ void *nearheap;\r
#endif\r
#ifdef __WATCOMC__\r
void __near *nearheap;\r
#endif\r
- unsigned int EMSVer;\r
- word numUMBs,UMBbase[MAXUMBS];\r
- word totalEMSpages, freeEMSpages, EMSpagesmapped, EMSHandle, EMSPageFrame;\r
- //dword numUMBs,UMBbase[MAXUMBS];\r
+//---- unsigned int EMSVer;\r
+//---- word numUMBs,UMBbase[MAXUMBS];\r
+//---- word totalEMSpages, freeEMSpages, EMSpagesmapped, EMSHandle, EMSPageFrame;\r
+//---- dword numUMBs,UMBbase[MAXUMBS];\r
mmblocktype far mmblocks[MAXBLOCKS],far *mmhead,far *mmfree,far *mmrover,far *mmnew;\r
+ memptr bufferseg; //Allocates bufferseg misc buffer\r
} mminfo_t;\r
\r
//==========================================================================\r
MainPagesUsed,\r
PMNumBlocks;\r
long PMFrameCount;\r
- PageListStruct far *PMPages;\r
- __SEGA *PMSegPages;\r
+ PageListStruct far *PMPages,\r
+ _seg *PMSegPages;\r
pm_mmi_t mm;\r
pm_emmi_t emm;\r
pm_xmmi_t xmm;\r
\r
//==========================================================================\r
\r
+//for 16_sd\r
+//==========================================================================\r
+#pragma pack(push,1)\r
+typedef struct imf_entry\r
+{\r
+ byte reg,data;\r
+ word delay;\r
+} imf_entry_t;\r
+#pragma pack(pop)\r
+\r
+typedef struct\r
+{\r
+ volatile unsigned long irq0_ticks;//=0;\r
+ volatile unsigned int irq0_cnt,irq0_add,irq0_max;//=0;\r
+ imf_entry_t* imf_music;//=NULL;\r
+ imf_entry_t* imf_play_ptr;//=NULL;\r
+ imf_entry_t* imf_music_end;//=NULL;\r
+ word imf_delay_countdown;//=0;\r
+} sd_t;\r
+\r
+//==========================================================================\r
+\r
//from 16_ca\r
//==========================================================================\r
\r
+#define NOMAPS\r
+//#define NOGRAPHICS\r
+#define NOAUDIO\r
+\r
+#define MAPHEADERLINKED\r
+//#define GRHEADERLINKED\r
+#define AUDIOHEADERLINKED\r
+\r
#define NUMMAPS 4//39\r
-#define MAPPLANES 3\r
+#define NUMSNDCHUNKS 4//3\r
+//#define NUMPICS 4//132//wolf3d wl6\r
+\r
+#define STRUCTPIC 0\r
+#define CASVT dword //*start var type\r
+\r
+\r
+#define DATADIR "data/"\r
+#define GDICTNAME DATADIR"vgadict."\r
+#define GHEADNAME DATADIR"vgahead."\r
+#define GFILENAME DATADIR"vgagraph."\r
+#define EXTENSION "hb1"\r
+\r
\r
typedef struct\r
{\r
word bit0,bit1; // 0-255 is a character, > is a pointer to a node\r
} huffnode;\r
\r
+typedef struct\r
+{\r
+ long planestart[3];\r
+ unsigned planelength[3];\r
+ unsigned width,height;\r
+ char name[16];\r
+} maptype;\r
+\r
typedef struct\r
{\r
int mapon, mapnum;\r
- __SEGA *mapsegs[4];\r
- __SEGA *mapheaderseg[NUMMAPS];\r
- __SEGA *tinf;\r
+ maptype _seg *mapheaderseg[NUMMAPS];\r
} ca_mapinfo_t;\r
\r
typedef struct\r
{\r
- int maphandle[4]; // handle to MAPTEMP / GAMEMAPS\r
+ int maphandle; // handle to MAPTEMP / GAMEMAPS\r
+ int grhandle; // handle to EGAGRAPH\r
+ int audiohandle; // handle to AUDIOT / AUDIO\r
} ca_handle_t;\r
-\r
-typedef struct\r
+/*\r
+16/wf3d8086/id_ca.c: grstarts = (long _seg *)FP_SEG(&EGAhead);\r
+16/wf3d8086/id_ca.c: tinf = (byte _seg *)FP_SEG(&maphead);\r
+16/wf3d8086/id_ca.c: pos = ((mapfiletype _seg *)tinf)->headeroffsets[i];\r
+16/wf3d8086/id_ca.c: audiostarts = (long _seg *)FP_SEG(&audiohead);\r
+16/wf3d8086/id_ca.c: ((mapfiletype _seg *)tinf)->RLEWtag);\r
+16/wf3d8086/id_ca.c: ((mapfiletype _seg *)tinf)->RLEWtag);\r
+16/wf3d8086/id_ca.c: source = (byte _seg *)bufferseg+(pos-bufferstart);\r
+*/\r
+typedef struct //TODO: USE THIS!!!!\r
{\r
- byte ca_levelbit,ca_levelnum;\r
- ca_handle_t file; //files to open\r
+ byte ca_levelbit,ca_levelnum;\r
+ ca_handle_t file; //files to open\r
ca_mapinfo_t camap;\r
- __SEGA *grsegs[NUMCHUNKS];\r
- byte far grneeded[NUMCHUNKS];\r
- huffnode huffnode;\r
\r
+ byte _seg *tinf;//?? where in the id engine is this used and what is it? --sparky4\r
+ unsigned _seg *mapsegs[MAPPLANES];\r
+ void _seg *grsegs[NUMCHUNKS];\r
+ byte far grneeded[NUMCHUNKS];\r
+ word _seg *audiosegs[NUMSNDCHUNKS];//long\r
+\r
+ CASVT _seg *grstarts; // array of offsets in egagraph, -1 for sparse//long\r
+ CASVT _seg *audiostarts; // array of offsets in audio / audiot//long\r
+\r
+#ifdef GRHEADERLINKED\r
+ huffnode *grhuffman;\r
+#else\r
+ huffnode grhuffman[255];\r
+#endif\r
+\r
+#ifdef AUDIOHEADERLINKED\r
+ huffnode *audiohuffman;\r
+#else\r
+ huffnode audiohuffman[255];\r
+#endif\r
+\r
+ CASVT chunkcomplen,chunkexplen;//long\r
+\r
+ sd_t sd;\r
//TODO: extend! and learn from keen/wolf/catacomb's code wwww\r
memptr spribuff;\r
} ca_t;\r
//==========================================================================\r
\r
//actual global game varables!\r
-typedef enum {\r
- ENGI_EXIT,\r
- ENGI_QUIT,\r
- ENGI_RUN,\r
- ENGI_INPUT,\r
- ENGI_PAUSE\r
-} engi_stat_t;\r
+/*typedef struct {\r
+ boolean clearmem;\r
+} vidsw_t;\r
\r
-typedef struct\r
+typedef struct {\r
+ vidsw_t vsw;\r
+} sw_t;*/\r
+\r
+\r
+\r
+typedef struct glob_game_vars\r
{\r
video_t video; // video settings variable\r
ca_t ca; // ca stuff\r
pm_t pm; // pm stuff\r
- loghandle_t handle; //handles for file logging\r
- kurokku_t kurokku; //clock struct\r
- mminfo_t mm; mminfotype mmi;\r
+ loghandle_t handle; //handles for file logging\r
+ kurokku_t kurokku; //clock struct\r
+ mminfo_t mm; mminfotype mmi; // mm stuff\r
+ in_info_t in; // 16_in info\r
+ player_t player[MaxPlayers]; // player vars\r
+ map_view_t mv[4];\r
+// sw_t sw;\r
+ boolean DLStarted;\r
} global_game_variables_t;\r
\r
#ifdef __WATCOMC__\r
extern char global_temp_status_text[512];\r
+extern char global_temp_status_text2[512];\r
#define EINVFMT EMFILE\r
#endif\r
#endif /* _TYPEDEFSTRUCT_H_ */\r