X-Git-Url: http://4ch.mooo.com/gitweb/?a=blobdiff_plain;f=src%2Flib%2F16_tdef.h;h=f45195d698b9a93d9336987d3ed69157b18a4a1e;hb=28b1be191222717943878f024cddac30b026318e;hp=10fd1eea58a9ef02f36f113d7666fcedb353d198;hpb=6cba56b1dbbb43864494ad852fecb24f5a75df7f;p=16.git diff --git a/src/lib/16_tdef.h b/src/lib/16_tdef.h index 10fd1eea..f45195d6 100755 --- a/src/lib/16_tdef.h +++ b/src/lib/16_tdef.h @@ -37,6 +37,10 @@ #define MAXPAGE 4 +#define BDOFSCONV (unsigned __near) +#define BOFS page[1].data +#define DOFS page[0].data + /* * typedefs of the game variables! */ @@ -66,12 +70,38 @@ typedef struct { //from 16_sprit.h #ifdef __WATCOMC__ +#include + +typedef struct vrs_container{ + // Size of a .vrs blob in memory + // minus header + dword data_size; + union{ + byte far *buffer; + struct vrs_header far *vrs_hdr; + }; + // Array of corresponding vrl line offsets + vrl1_vgax_offset_t **vrl_line_offsets; +} vrs_container_t; + +typedef struct vrl_container{ + // Size of a .vrl blob in memory + // minus header + dword data_size; + union{ + byte far *buffer; + struct vrl1_vgax_header far *vrl_header; + }; + // Pointer to a corresponding vrl line offsets struct + vrl1_vgax_offset_t *line_offsets; +} vrl_container_t; + typedef struct sprite { // VRS container from which we will extract animation and image data - struct vrs_container *spritesheet; + vrs_container_t spritesheet; // Container for a vrl sprite - struct vrl_container *sprite_vrl_cont; + vrl_container_t sprite_vrl_cont; // Current sprite id int curr_spri_id; // Index of a current sprite in an animation sequence @@ -145,11 +175,11 @@ typedef struct { byte *data; //TODO: 16_mm and 16_ca must handle this } mapl_t; //map layer array type def -#define MAP_LAYERS 3 +#define MAPPLANES 3 typedef struct { //long planestart[3]; //unsigned planelength[3]; - mapl_t layerdata[MAP_LAYERS]; // mapdata for multilayer (map index values for rendering which image on the tile) + mapl_t layerdata[MAPPLANES]; // mapdata for multilayer (map index values for rendering which image on the tile) tiles_t *tiles; //TODO: 16_mm and 16_ca must handle this // tilesets for layers (currently ony 4 can be loaded wwww) int width, height; //this has to be signed! byte name[16]; @@ -189,6 +219,30 @@ typedef struct { //from 16_in //========================================================================== +#define KeyInt 9 // The keyboard ISR number + +// +// mouse constants +// +#define MReset 0 +#define MButtons 3 +#define MDelta 11 + +#define MouseInt 0x33 +//#define Mouse(x) _AX = x,geninterrupt(MouseInt) + +// +// joystick constants +// +#define JoyScaleMax 32768 +#define JoyScaleShift 8 +#define MaxJoyValue 5000 + +#define MaxPlayers 4 +#define MaxKbds 2 +#define MaxJoys 2 +#define NumCodes 128 + typedef byte ScanCode; typedef enum { @@ -204,12 +258,10 @@ typedef enum { motion_None = 0, motion_Right = 1,motion_Down = 1 } Motion; -typedef enum { - dir_North,//dir_NorthEast, - dir_West,//dir_Nortinest, - dir_None, - dir_East,//,dir_SouthEast, - dir_South,//dir_Soutinest, +typedef enum { // Quick lookup for total direction + /*dir_NorthWest, */dir_North,/* dir_NorthEast,*/ + dir_West, dir_None, dir_East, + /*dir_SouthWest, */dir_South/*, dir_SouthEast*/ } Direction; typedef struct { boolean near button0,button1,button2,button3; @@ -239,6 +291,32 @@ typedef struct { joyMultXH,joyMultYH; } JoystickDef; +typedef struct instat { + boolean CapsLock; + ScanCode CurCode,LastCode; + + boolean Keyboard[NumCodes]; + boolean Paused; + char LastASCII; + ScanCode LastScan; +} inst_t; + +typedef struct// inconfig +{ + boolean IN_Started; +// +// configuration variables +// + boolean JoysPresent[MaxJoys], + MousePresent, + JoyPadPresent; + +// Global variables + KeyboardDef KbdDefs[MaxKbds]; + JoystickDef JoyDefs[MaxJoys]; + inst_t *inst; +} in_info_t; + //========================================================================== typedef struct @@ -280,29 +358,63 @@ typedef struct } kurokku_t; //===================================// -#define PALSIZE 768 +#define PALSIZE 768 #define NUMCHUNKS 416 //keen +#define MAXSCANLINES 240 // size of ylookup table + +typedef struct +{ + int width,height; +} pictabletype; + //video typedef struct { + word tileHeight, tileWidth; //defined by mapfile + word quadwh; //preproccessed quad size of tilewidth and tileheight +} tile_dimention_t; + +#define MAXSCROLLEDGES 6 +typedef struct +{ + unsigned panx,pany; // panning adjustments inside port in pixels + unsigned pansx,pansy; + unsigned panadjust; // panx/pany adjusted by screen resolution + int hscrollblocks,vscrollblocks; + int hscrolledge[MAXSCROLLEDGES],vscrolledge[MAXSCROLLEDGES]; +} pan_t; + +typedef struct +{ + //ylookup[MAXSCANLINES], unsigned int offscreen_ofs; unsigned int pattern_ofs; +// unsigned bufferofs,linewidth,displayofs; + pan_t pan; + } ofs_t; //unfinished typedef struct { - char old_mode; //old video mode before game! - byte palette[PALSIZE], dpal[PALSIZE]; //palette array - page_t page[MAXPAGE]; //can be used as a pointer to root page[0] - word vmem_remain; //remaining video memory - byte num_of_pages; //number of actual pages - //doslib origi vars +//doslib origi vars byte far * omemptr; byte vga_draw_stride; byte vga_draw_stride_limit; // further X clipping - //end of doslib origi vars +//end of doslib origi vars boolean __near rss; //render sprite switch boolean __near bgps; //bg preservation render switch between old and new +} vga_state_t; + +typedef struct +{ + boolean VL_Started,VL_Initiated; + char old_mode; //old video mode before game! + sword curr_mode; //modex curent mode + byte palette[PALSIZE], dpal[PALSIZE]; //palette array + page_t page[MAXPAGE]; //can be used as a pointer to root page[0] + word vmem_remain; //remaining video memory + byte num_of_pages; //number of actual pages + vga_state_t vga_state; sword __near sprifilei; //player file's i nibble __near p; //render page number nibble __near sp; //show page number(for showpage) @@ -312,10 +424,14 @@ typedef struct nibble sfip; //shinku_fps_indicator_page; // we're on page 1 now, shinku(). follow along please or it will not be visible. ofs_t ofs; //offset vars used for doslib word vh; //video combined height + tile_dimention_t td; //0000word startclk; float clk, tickclk; //timer -//newer vars -//TODO: find out how they are used - byte grneeded[NUMCHUNKS]; + //wolf3d vars + boolean screenfaded; + word bordercolor; + boolean fastpalette; + byte far palette1[256][3],far palette2[256][3]; + pictabletype _seg *pictable; } video_t; //from scroll16 @@ -327,6 +443,7 @@ typedef struct int tx,ty; //appears to be the top left tile position on the viewable screen map word dxThresh,dyThresh; //Threshold for physical tile switch video_t *video; //pointer to game variables of the video + kurokku_t *kurokku; //pointer to game variables of the kurokku nibble __near *p; // pointer to video's render page num nibble __near *sp; // pointer to video's show page num int dx, dy; // draw row and col var @@ -351,19 +468,25 @@ typedef struct //from 16_mm //========================================================================== -#define MAXBLOCKS 1024 -#define MAXUMBS 12 +#define MAXBLOCKS 1024//kd=1300 wolf3d=700 cata=600 +//----#define MAXUMBS 12 typedef struct mmblockstruct { word start,length; //word start; dword length; - word blob; //for data larger than 64k +//++++ word blob; //for data larger than 64k unsigned attributes; memptr *useptr; // pointer to the segment start struct mmblockstruct far *next; } mmblocktype; +typedef struct mmshowmemoryinfo +{ + word x,y; + mmblocktype far *scan; +} mmshowmemoryinfo_t; + typedef struct { dword nearheap,farheap,EMSmem,XMSmem,mainmem; @@ -372,20 +495,20 @@ typedef struct typedef struct { - memptr bufferseg; boolean mmstarted, bombonerror, mmerror; void far *farheap; #ifdef __BORLANDC__ - void *nearheap; + void *nearheap; #endif #ifdef __WATCOMC__ void __near *nearheap; #endif - unsigned int EMSVer; - word numUMBs,UMBbase[MAXUMBS]; - word totalEMSpages, freeEMSpages, EMSpagesmapped, EMSHandle, EMSPageFrame; - //dword numUMBs,UMBbase[MAXUMBS]; +//---- unsigned int EMSVer; +//---- word numUMBs,UMBbase[MAXUMBS]; +//---- word totalEMSpages, freeEMSpages, EMSpagesmapped, EMSHandle, EMSPageFrame; +//---- dword numUMBs,UMBbase[MAXUMBS]; mmblocktype far mmblocks[MAXBLOCKS],far *mmhead,far *mmfree,far *mmrover,far *mmnew; + memptr bufferseg; //Allocates bufferseg misc buffer } mminfo_t; //========================================================================== @@ -492,8 +615,8 @@ typedef struct MainPagesUsed, PMNumBlocks; long PMFrameCount; - PageListStruct far *PMPages; - __SEGA *PMSegPages; + PageListStruct far *PMPages, + _seg *PMSegPages; pm_mmi_t mm; pm_emmi_t emm; pm_xmmi_t xmm; @@ -502,47 +625,117 @@ typedef struct //========================================================================== +//for 16_sd +//========================================================================== +#pragma pack(push,1) +typedef struct imf_entry +{ + byte reg,data; + word delay; +} imf_entry_t; +#pragma pack(pop) + +typedef struct +{ + volatile unsigned long irq0_ticks;//=0; + volatile unsigned int irq0_cnt,irq0_add,irq0_max;//=0; + imf_entry_t* imf_music;//=NULL; + imf_entry_t* imf_play_ptr;//=NULL; + imf_entry_t* imf_music_end;//=NULL; + word imf_delay_countdown;//=0; +} sd_t; + +//========================================================================== + //from 16_ca //========================================================================== +#define NOMAPS +//#define NOGRAPHICS +#define NOAUDIO + +#define MAPHEADERLINKED +//#define GRHEADERLINKED +#define AUDIOHEADERLINKED + #define NUMMAPS 4//39 -#define MAPPLANES 3 -#define NUMSNDCHUNKS 84 +#define NUMSNDCHUNKS 4//3 +//#define NUMPICS 132//wolf3d wl6 + +#define STRUCTPIC 0 + + +#define DATADIR "data/" +#define GDICTNAME DATADIR"vgadict." +#define GHEADNAME DATADIR"vgahead." +#define GFILENAME DATADIR"vgagraph." +#define EXTENSION "hb1" + typedef struct { word bit0,bit1; // 0-255 is a character, > is a pointer to a node } huffnode; +typedef struct +{ + long planestart[3]; + unsigned planelength[3]; + unsigned width,height; + char name[16]; +} maptype; + typedef struct { int mapon, mapnum; - //__SEGA *mapheaderseg[NUMMAPS]; + maptype _seg *mapheaderseg[NUMMAPS]; } ca_mapinfo_t; typedef struct { - int maphandle[4]; // handle to MAPTEMP / GAMEMAPS - int grhandle[4]; // handle to EGAGRAPH - int audiohandle[4]; // handle to AUDIOT / AUDIO + int maphandle; // handle to MAPTEMP / GAMEMAPS + int grhandle; // handle to EGAGRAPH + int audiohandle; // handle to AUDIOT / AUDIO } ca_handle_t; - +/* +16/wf3d8086/id_ca.c: grstarts = (long _seg *)FP_SEG(&EGAhead); +16/wf3d8086/id_ca.c: tinf = (byte _seg *)FP_SEG(&maphead); +16/wf3d8086/id_ca.c: pos = ((mapfiletype _seg *)tinf)->headeroffsets[i]; +16/wf3d8086/id_ca.c: audiostarts = (long _seg *)FP_SEG(&audiohead); +16/wf3d8086/id_ca.c: ((mapfiletype _seg *)tinf)->RLEWtag); +16/wf3d8086/id_ca.c: ((mapfiletype _seg *)tinf)->RLEWtag); +16/wf3d8086/id_ca.c: source = (byte _seg *)bufferseg+(pos-bufferstart); +*/ typedef struct //TODO: USE THIS!!!! { byte ca_levelbit,ca_levelnum; ca_handle_t file; //files to open ca_mapinfo_t camap; - memptr/*__SEGA*/ mapsegs[MAP_LAYERS]; - memptr/*__SEGA*/ *grsegs[NUMCHUNKS]; + byte _seg *tinf;//?? where in the id engine is this used and what is it? --sparky4 + unsigned _seg *mapsegs[MAPPLANES]; + void _seg *grsegs[NUMCHUNKS]; byte far grneeded[NUMCHUNKS]; - memptr/*byte _seg*/ *audiosegs[NUMSNDCHUNKS]; + word _seg *audiosegs[NUMSNDCHUNKS];//long + + word _seg *grstarts; // array of offsets in egagraph, -1 for sparse//long + word _seg *audiostarts; // array of offsets in audio / audiot//long - //misc memptr - memptr tinf[4]; +#ifdef GRHEADERLINKED + huffnode *grhuffman; +#else + huffnode grhuffman[255]; +#endif + +#ifdef AUDIOHEADERLINKED + huffnode *audiohuffman; +#else + huffnode audiohuffman[255]; +#endif - huffnode huffnode; + long chunkcomplen,chunkexplen; + sd_t sd; //TODO: extend! and learn from keen/wolf/catacomb's code wwww memptr spribuff; } ca_t; @@ -550,22 +743,29 @@ typedef struct //TODO: USE THIS!!!! //========================================================================== //actual global game varables! -typedef enum { - ENGI_EXIT, - ENGI_QUIT, - ENGI_RUN, - ENGI_INPUT, - ENGI_PAUSE -} engi_stat_t; +/*typedef struct { + boolean clearmem; +} vidsw_t; -typedef struct +typedef struct { + vidsw_t vsw; +} sw_t;*/ + + + +typedef struct glob_game_vars { video_t video; // video settings variable ca_t ca; // ca stuff pm_t pm; // pm stuff - loghandle_t handle; //handles for file logging - kurokku_t kurokku; //clock struct - mminfo_t mm; mminfotype mmi; + loghandle_t handle; //handles for file logging + kurokku_t kurokku; //clock struct + mminfo_t mm; mminfotype mmi; // mm stuff + in_info_t in; // 16_in info + player_t player[MaxPlayers]; // player vars + map_view_t mv[4]; +// sw_t sw; + boolean DLStarted; } global_game_variables_t; #ifdef __WATCOMC__