X-Git-Url: http://4ch.mooo.com/gitweb/?a=blobdiff_plain;f=src%2Flib%2F16_tdef.h;h=d7350bb29934b8f235ddac109251ec40235a15d5;hb=26536b16d4825df06a4e73380985afb3a0bfb7e4;hp=4700625ef6ef33979c4d44b8939400e6c20763dc;hpb=46ab351125c93564e17aacce420069f865188737;p=16.git diff --git a/src/lib/16_tdef.h b/src/lib/16_tdef.h index 4700625e..d7350bb2 100755 --- a/src/lib/16_tdef.h +++ b/src/lib/16_tdef.h @@ -48,14 +48,56 @@ typedef struct { word offset; } bitmap_t; +typedef struct { + byte far **data; + word ntiles; // the number of tiles + word twidth; // width of the tiles + word theight; // height of the tiles + byte *palette; // palette for the tile set +} tileset_t; + +typedef struct { + byte far *plane[4]; // 4 planes of image data + word width; // width of the image (spread across 4 planes) + word height; // height of the image (spread across 4 planes) + word pwidth; // the number of bytes in each plane + byte *palette; +} planar_buf_t; + //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 @@ -71,72 +113,81 @@ typedef struct sprite } sprite_t; #endif -typedef struct { - //byte far **data; -//#ifdef __WATCOMC__ - //sprite_t *spri; -//#endif - bitmap_t far *data; // actual tileset info -//in the bitmap_t -// byte *palette; // palette for the tile set - word ntiles; // the number of tiles - word twidth; // width of the tiles - word theight; // height of the tiles - byte imgname[8]; // image filename of tileset -} tileset_t; +//newer structs +typedef struct +{ + int x; //entity exact position on the viewable map + int y; //entity exact position on the viewable map + int tx; //entity tile position on the viewable map + int ty; //entity tile position on the viewable map + int triggerx; //entity's trigger box tile position on the viewable map + int triggery; //entity's trigger box tile position on the viewable map +// int sheetsetx; //NOT USED YET! entity sprite sheet set on the image x +// int sheetsety; //NOT USED YET! entity sprite sheet set on the image y + nibble d; //direction to render sprite!! wwww + nibble pred; //prev. direction for animation changing + word dire; //sprite in use + nibble q; //loop variable for anumation and locking the playing to compleate the animation cycle to prevent issues with misalignment www + word speed; //entity speed! + word spt; //speed per tile +#ifdef __WATCOMC__ + sprite_t spri; // sprite used by entity +#endif + sword hp; //hitpoints of the entity + nibble overdraww, overdrawh; // how many pixels to "overdraw" so that moving sprites with edge pixels don't leave streaks. + // if the sprite's edge pixels are clear anyway, you can set this to 0. + nibble /*int*/ persist_aniframe; // gonna be increased to 1 before being used, so 0 is ok for default +} entity_t; -//not currently using -typedef struct { - byte far *plane[4]; // 4 planes of image data - word width; // width of the image (spread across 4 planes) - word height; // height of the image (spread across 4 planes) - word pwidth; // the number of bytes in each plane - byte *palette; -} planar_buf_t; +typedef struct +{ + int x; //entity exact position on the viewable map + int y; //entity exact position on the viewable map + int tx; //entity tile position on the viewable map + int ty; //entity tile position on the viewable map -//tile properties +#ifdef __WATCOMC__ + sprite_t spri; // sprite used by entity +#endif + sword hp; //hitpoints of the entity +} static_map_entity_t; + +//===========================================================================// + +//TODO: 16_mm and 16_ca must handle this typedef struct { - //bitmap_t far *btdata; //old - tileset_t tileset; //new - word tileHeight, tileWidth; - word rows, cols; -} tiles_t; +#ifdef __WATCOMC__ + sprite_t *spri; // I will probibaly use this --sparky4 +#endif + word tileHeight, tileWidth; //defined by mapfile + unsigned int rows, cols; + byte imgname[8]; //image file of tileset (set to 8 because DOS ^^;) +} tiles_t; //seems to be the tileset properties //TODO: 16_mm and 16_ca must handle this //TODO: add variables from 16_ca -#define MAPLAYERS 4 -//#define __NEWMAPTILEDATAVARS__ - -#ifdef __NEWMAPTILEDATAVARS__ -#define MAPTILESPTR layertile[0] -#define MAPTILESPTK layertile[k] -#define MAPDATAPTR layerdata[0] -#define MAPDATAPTK layerdata[k] -#else -#define MAPTILESPTR tiles//layertile[0] -#define MAPTILESPTK tiles//layertile[k] -#define MAPDATAPTR data//layerdata[0] -#define MAPDATAPTK data//layerdata[k] -#endif +typedef struct { + byte layername[8]; + byte *data; //TODO: 16_mm and 16_ca must handle this +} mapl_t; //map layer array type def + +#define MAP_LAYERS 3 typedef struct { //long planestart[3]; //unsigned planelength[3]; -#ifndef __NEWMAPTILEDATAVARS__ - byte *data; //TODO: 16_mm and 16_ca must handle this - tiles_t *tiles; //TODO: 16_mm and 16_ca must handle this -#else - byte far *layerdata[MAPLAYERS]; //mapindex for specific layer - tiles_t far *layertile[MAPLAYERS]; -#endif + mapl_t layerdata[MAP_LAYERS]; // 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]; //mapname/maptitle + byte name[16]; } map_t; +//===================================// + typedef struct{ - word tw; /* screen width in tiles */ - word th; /* screen height in tiles */ - word tilesw; /* virtual screen width in tiles */ - word tilesh; /* virtual screen height in tiles */ + word tw; /* screen width in tiles */ + word th; /* screen height in tiles */ + word tilesw; /* virtual screen width in tiles */ + word tilesh; /* virtual screen height in tiles */ sword tilemidposscreenx; /* middle tile x position */ /* needed for scroll system to work accordingly */ sword tilemidposscreeny; /* middle tile y position */ /* needed for scroll system to work accordingly */ sword tileplayerposscreenx; /* player position on screen */ /* needed for scroll and map system to work accordingly */ @@ -146,50 +197,48 @@ typedef struct{ typedef struct { nibble/*word*/ id; /* the Identification number of the page~ For layering~ */ byte far* data; /* the data for the page */ - pagetileinfo_t ti; + pagetileinfo_t ti; // the tile information of the page word dx; /* col we are viewing on virtual screen (on page[0]) */ /* off screen buffer on the left size */ word dy; /* row we are viewing on virtual screen (on page[0]) */ /* off screen buffer on the top size */ word sw; /* screen width */ /* resolution */ word sh; /* screen heigth */ /* resolution */ word width; /* virtual width of the page */ word height; /* virtual height of the page */ - word stridew; /* width/4 */ /* VGA */ - word pagesize; /* page size */ - word pi; /* increment page by this much to preserve location */ + word stridew; /* width/4 */ /* VGA */ + word pagesize; /* page size */ + word pi; /* increment page by this much to preserve location */ int tlx,tly; //newer vars //TODO: find where they are used sword delta; // How much should we shift the page for smooth scrolling } page_t; -//newer structs -typedef struct -{ - int x; //entity exact position on the viewable map - int y; //entity exact position on the viewable map - int tx; //entity tile position on the viewable map - int ty; //entity tile position on the viewable map - int triggerx; //entity's trigger box tile position on the viewable map - int triggery; //entity's trigger box tile position on the viewable map -// int sheetsetx; //NOT USED YET! entity sprite sheet set on the image x -// int sheetsety; //NOT USED YET! entity sprite sheet set on the image y - nibble d; //direction to render sprite!! wwww - nibble pred; //prev. direction for animation changing - word dire; //sprite in use - nibble q; //loop variable for anumation and locking the playing to compleate the animation cycle to prevent issues with misalignment www - word speed; //entity speed! - word spt; //speed per tile -#ifdef __WATCOMC__ - sprite_t *spri; // sprite used by entity -#endif - sword hp; //hitpoints of the entity - nibble overdraww, overdrawh; // how many pixels to "overdraw" so that moving sprites with edge pixels don't leave streaks. - // if the sprite's edge pixels are clear anyway, you can set this to 0. - nibble /*int*/ persist_aniframe; // gonna be increased to 1 before being used, so 0 is ok for default -} entity_t; - //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 { @@ -205,12 +254,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; @@ -240,6 +287,28 @@ typedef struct { joyMultXH,joyMultYH; } JoystickDef; +/*typedef struct// inconfig +{ + boolean IN_Started; + boolean CapsLock; + ScanCode CurCode,LastCode; +// +// configuration variables +// + boolean Keyboard[NumCodes], + JoysPresent[MaxJoys], + MousePresent, + JoyPadPresent; + +// Global variables + boolean Paused; + char LastASCII; + ScanCode LastScan; + + KeyboardDef KbdDefs[MaxKbds]; + JoystickDef JoyDefs[MaxJoys]; +} in_info_t;*/ + //========================================================================== typedef struct @@ -247,10 +316,10 @@ typedef struct entity_t near enti; #ifdef __WATCOMC__ //struct sprite *spri; //supposively the sprite sheet data - memptr gr; + //memptr gr; #endif - bitmap_t *data; //supposively the sprite sheet data//old format - bitmap_t bmp; +// bitmap_t *data; //supposively the sprite sheet data//old format +// bitmap_t bmp; //input byte near pdir; //previous direction~ used in IN_16 in IN_ReadControl() @@ -277,20 +346,23 @@ typedef struct word clock_start; //timer start word *clock; //current time on clock boolean fpscap; //cap the fps var + nibble wcpu; //stored value of cpu type } kurokku_t; +//===================================// +#define PALSIZE 768 +#define NUMCHUNKS 416 //keen //video typedef struct { unsigned int offscreen_ofs; unsigned int pattern_ofs; -} ofs_t; -#define NUMCHUNKS 416 //keen +} ofs_t; //unfinished typedef struct { char old_mode; //old video mode before game! - byte palette[768]; //palette array + 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 @@ -356,7 +428,7 @@ 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; @@ -374,7 +446,7 @@ typedef struct boolean mmstarted, bombonerror, mmerror; void far *farheap; #ifdef __BORLANDC__ - void *nearheap; + void *nearheap; #endif #ifdef __WATCOMC__ void __near *nearheap; @@ -490,8 +562,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; @@ -505,6 +577,7 @@ typedef struct #define NUMMAPS 4//39 #define MAPPLANES 3 +#define NUMSNDCHUNKS 84 typedef struct { @@ -514,24 +587,47 @@ typedef struct typedef struct { int mapon, mapnum; - //__SEGA *mapsegs[4]; - //__SEGA *mapheaderseg[NUMMAPS]; - //__SEGA *tinf; - memptr mapsegs; + //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 } ca_handle_t; - -typedef struct +/* + 16/wf3d8086/id_ca.c:byte _seg *tinf; +16/wf3d8086/id_ca.c:unsigned _seg *mapsegs[MAPPLANES]; +16/wf3d8086/id_ca.c:maptype _seg *mapheaderseg[NUMMAPS]; +16/wf3d8086/id_ca.c:byte _seg *audiosegs[NUMSNDCHUNKS]; +16/wf3d8086/id_ca.c:void _seg *grsegs[NUMCHUNKS]; +16/wf3d8086/id_ca.c:long _seg *grstarts; // array of offsets in egagraph, -1 for sparse +16/wf3d8086/id_ca.c:long _seg *audiostarts; // array of offsets in audio / audiot +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 + byte ca_levelbit,ca_levelnum; + ca_handle_t file; //files to open ca_mapinfo_t camap; - __SEGA *grsegs[NUMCHUNKS]; - byte far grneeded[NUMCHUNKS]; + + unsigned _seg *mapsegs[MAP_LAYERS]; + void _seg *grsegs[NUMCHUNKS]; + byte far grneeded[NUMCHUNKS]; + 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 + byte _seg *tinf[4]; + huffnode huffnode; //TODO: extend! and learn from keen/wolf/catacomb's code wwww @@ -542,21 +638,25 @@ typedef struct //actual global game varables! typedef enum { - ENGI_EXIT, ENGI_QUIT, ENGI_RUN, - ENGI_INPUT, + ENGI_MENU, ENGI_PAUSE } engi_stat_t; +//ENGI_INPUT, typedef struct { + engi_stat_t engi_stat; 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]; } global_game_variables_t; #ifdef __WATCOMC__