]> 4ch.mooo.com Git - 16.git/blobdiff - src/lib/16_tdef.h
16_sd official port started. but class and work in the way
[16.git] / src / lib / 16_tdef.h
index c57753875ecfbcb88264be8f60fef0fb41948aa6..902225268101cbf35aaf29d2de8e8a6d9fc7c2fd 100755 (executable)
 \r
 #define MAXPAGE 4\r
 \r
+#define BDOFSCONV (unsigned __near)\r
+#define BOFS page[1].data\r
+#define DOFS page[0].data\r
+\r
+#define CONFIGNAME "config.16"\r
+\r
 /*\r
  * typedefs of the game variables!\r
  */\r
-typedef struct {\r
-       byte *data;\r
-       word width;\r
-       word height;\r
-       byte *palette;\r
-       word offset;\r
-} bitmap_t;\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
-} tileset_t;\r
-\r
 typedef struct {\r
        byte far *plane[4];     // 4 planes of image data\r
        word width;                     // width of the image (spread across 4 planes)\r
@@ -78,6 +68,8 @@ typedef struct vrs_container{
        };\r
        // Array of corresponding vrl line offsets\r
        vrl1_vgax_offset_t **vrl_line_offsets;\r
+       //sprite buffer\r
+       byte far _seg *spribuff;\r
 } vrs_container_t;\r
 \r
 typedef struct vrl_container{\r
@@ -90,6 +82,8 @@ typedef struct vrl_container{
        };\r
        // Pointer to a corresponding vrl line offsets struct\r
        vrl1_vgax_offset_t *line_offsets;\r
+       //sprite buffer\r
+       byte far _seg *spribuff;\r
 } vrl_container_t;\r
 \r
 typedef struct sprite\r
@@ -128,7 +122,7 @@ typedef     struct
        nibble pred;    //prev. direction for animation changing\r
        word dire;              //sprite in use\r
        nibble q;               //loop variable for anumation and locking the playing to compleate the animation cycle to prevent issues with misalignment www\r
-       word speed;             //entity speed!\r
+//     word speed;             //entity speed!\r
        word spt;               //speed per tile\r
 #ifdef __WATCOMC__\r
        sprite_t spri; // sprite used by entity\r
@@ -340,6 +334,8 @@ typedef struct
 {\r
        int profilehandle,debughandle,showmemhandle;\r
        int heaphandle;\r
+       byte datadumpfilename[12];\r
+       byte heapdumpfilename[12];\r
 } loghandle_t;\r
 \r
 typedef struct\r
@@ -354,9 +350,34 @@ typedef struct
 } kurokku_t;\r
 \r
 //===================================//\r
-#define PALSIZE        768\r
-#define NUMCHUNKS      416     //keen\r
-#define MAXSCANLINES   240                     // size of ylookup table\r
+#define PALSIZE                        768     //vga\r
+#define NUMCHUNKS              416     //keen\r
+//#define MAXSCANLINES 240     // size of ylookup table\r
+\r
+#define MAXSHIFTS              4\r
+#define STARTSPRITES   0       //temp\r
+\r
+typedef struct\r
+{\r
+       int     width,\r
+               height,\r
+               orgx,orgy,\r
+               xl,yl,xh,yh,\r
+               shifts;\r
+} spritetabletype;\r
+\r
+typedef        struct\r
+{\r
+       unsigned        sourceoffset[MAXSHIFTS];\r
+       unsigned        planesize[MAXSHIFTS];\r
+       unsigned        width[MAXSHIFTS];\r
+       byte            data[];\r
+} spritetype;          // the memptr for each sprite points to this\r
+\r
+typedef struct\r
+{\r
+       int width,height;\r
+} pictabletype;\r
 \r
 //video\r
 typedef struct\r
@@ -365,11 +386,34 @@ typedef struct
        word    quadwh;                 //preproccessed quad size of tilewidth and tileheight\r
 } tile_dimention_t;\r
 \r
+#define MAXSCROLLEDGES 2\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
+       sword x;\r
+       sword y;\r
+       word t;\r
+       boolean tlsw;\r
+       word color;\r
+       word bgcolor;\r
+} modexprint_t;\r
+\r
+typedef struct\r
+{\r
+//---- ylookup[MAXSCANLINES],\r
        unsigned int offscreen_ofs;\r
        unsigned int pattern_ofs;\r
-       unsigned        bufferofs,      ylookup[MAXSCANLINES], linewidth,displayofs;\r
+//+-+- unsigned        bufferofs,linewidth,displayofs;\r
+       pan_t           pan;\r
+\r
 } ofs_t;       //unfinished\r
 \r
 typedef struct\r
@@ -387,6 +431,7 @@ typedef struct
 {\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
@@ -401,6 +446,7 @@ typedef struct
        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
+       modexprint_t    print;  //modexprint variables\r
        tile_dimention_t        td;\r
        //0000word startclk; float clk, tickclk;        //timer\r
        //wolf3d vars\r
@@ -408,6 +454,10 @@ typedef struct
        word            bordercolor;\r
        boolean fastpalette;\r
        byte            far     palette1[256][3],far palette2[256][3];\r
+//???? pictabletype    _seg *pictable;\r
+       //keen/cata vars\r
+//     spritetabletype _seg *spritetable;\r
+//     unsigned        *shifttabletable[8];\r
 } video_t;\r
 \r
 //from scroll16\r
@@ -419,6 +469,7 @@ typedef struct
        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
@@ -443,19 +494,23 @@ typedef struct
 //from 16_mm\r
 //==========================================================================\r
 \r
-#define MAXBLOCKS              1024//kd=1300 wolf3d=700 cata=600\r
-//----#define MAXUMBS          12\r
+#define MAXBLOCKS              1024            //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
+       //word  start,length,           blob;   //for data larger than 64k\r
+       word    start;  dword 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
+//     unsigned x,y;\r
+       mmblocktype far *scan;\r
+} mmshowmemoryinfo_t;\r
+\r
 typedef struct\r
 {\r
        dword   nearheap,farheap,EMSmem,XMSmem,mainmem;\r
@@ -594,11 +649,100 @@ typedef struct
 \r
 //==========================================================================\r
 \r
+//for 16_sd\r
+//==========================================================================\r
+\r
+/////////////////////////////////////////////////\r
+//\r
+// MUSE Header for .WL6\r
+// Created Tue Jul 14 15:04:53 1992\r
+//\r
+/////////////////////////////////////////////////\r
+\r
+#define NUMSOUNDS              87\r
+//--#define NUMSNDCHUNKS               288\r
+\r
+//\r
+// Sound names & indexes\r
+//\r
+typedef enum {\r
+               HITWALLSND,              // 0\r
+               SELECTWPNSND,            // 1\r
+               SELECTITEMSND,           // 2\r
+               LASTSOUND\r
+            } soundnames;\r
+\r
+//\r
+// Base offsets\r
+//\r
+#define STARTPCSOUNDS          0\r
+#define STARTADLIBSOUNDS       87\r
+#define STARTDIGISOUNDS                174\r
+#define STARTMUSIC             261\r
+\r
+//\r
+// Music names & indexes\r
+//\r
+typedef enum {\r
+               CORNER_MUS,              // 0\r
+               LASTMUSIC\r
+            } musicnames;\r
+\r
+/////////////////////////////////////////////////\r
+//\r
+// Thanks for playing with MUSE!\r
+//\r
+/////////////////////////////////////////////////\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
+       dword           ptick,tickrate;\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 NUMSNDCHUNKS           84\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
+\r
+\r
+#define MAPSEGBUF      mapsegs\r
+#define MAPSEGPTR      MAPSEGBUF[0]\r
+#define MAPSEGINLM     (gvar->ca.MAPSEGPTR)\r
 \r
 typedef struct\r
 {\r
@@ -615,15 +759,16 @@ typedef   struct
 \r
 typedef struct\r
 {\r
-       int             mapon, mapnum;\r
-       maptype         _seg    *mapheaderseg[NUMMAPS];\r
-} ca_mapinfo_t;\r
+       unsigned        RLEWtag;\r
+       long            headeroffsets[100];\r
+       byte            tileinfo[];\r
+} mapfiletype;\r
 \r
 typedef struct\r
 {\r
-       int                     maphandle[4];           // handle to MAPTEMP / GAMEMAPS\r
-       int                     grhandle[4];            // handle to EGAGRAPH\r
-       int                     audiohandle[4]; // handle to AUDIOT / AUDIO\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
 16/wf3d8086/id_ca.c:   grstarts = (long _seg *)FP_SEG(&EGAhead);\r
@@ -638,21 +783,35 @@ typedef struct    //TODO: USE THIS!!!!
 {\r
        byte    ca_levelbit,ca_levelnum;\r
        ca_handle_t             file;           //files to open\r
-       ca_mapinfo_t    camap;\r
 \r
        byte            _seg    *tinf;//?? where in the id engine is this used and what is it? --sparky4\r
+       int             mapon, mapnum;\r
+       maptype         _seg    *mapheaderseg[NUMMAPS];\r
        unsigned        _seg    *mapsegs[MAPPLANES];\r
        void            _seg    *grsegs[NUMCHUNKS];\r
        byte            far             grneeded[NUMCHUNKS];\r
        word            _seg *audiosegs[NUMSNDCHUNKS];//long\r
 \r
-       word            _seg    *grstarts;      // array of offsets in egagraph, -1 for sparse//long\r
-       word            _seg    *audiostarts;   // array of offsets in audio / audiot//long\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[63];\r
+#endif\r
+\r
+#ifdef AUDIOHEADERLINKED\r
+       huffnode        *audiohuffman;\r
+#else\r
+       huffnode        audiohuffman[63];\r
+#endif\r
 \r
-       huffnode huffnode;\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
+       memptr  spribuff[64];   //temp\r
 } ca_t;\r
 \r
 //==========================================================================\r
@@ -666,7 +825,10 @@ typedef struct {
        vidsw_t vsw;\r
 } sw_t;*/\r
 \r
-\r
+#ifdef __WATCOMC__\r
+extern char global_temp_status_text[512];\r
+extern char global_temp_status_text2[512];\r
+#endif\r
 \r
 typedef struct glob_game_vars\r
 {\r
@@ -679,12 +841,9 @@ typedef struct glob_game_vars
        in_info_t       in;             // 16_in info\r
        player_t        player[MaxPlayers];     // player vars\r
        map_view_t      mv[4];\r
+       map_t           map;\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