X-Git-Url: http://4ch.mooo.com/gitweb/?a=blobdiff_plain;f=src%2Flib%2F16_tdef.h;h=d1220d54c67826e1af1020a116b95e934f10ab2a;hb=d26e0714368d1cfbe4caee5d6309cf97e0af55db;hp=e2b2161d1fd61095a0aa908d53ff6252f3e8505e;hpb=24e783f1e4c16bafa56e6cff2c8c915c1f2c7cda;p=16.git diff --git a/src/lib/16_tdef.h b/src/lib/16_tdef.h index e2b2161d..d1220d54 100755 --- a/src/lib/16_tdef.h +++ b/src/lib/16_tdef.h @@ -1,5 +1,5 @@ /* Project 16 Source Code~ - * Copyright (C) 2012-2016 sparky4 & pngwen & andrius4669 & joncampbell123 & yakui-lover + * Copyright (C) 2012-2017 sparky4 & pngwen & andrius4669 & joncampbell123 & yakui-lover * * This file is part of Project 16. * @@ -50,10 +50,10 @@ typedef struct { 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 */ + 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 { @@ -64,32 +64,48 @@ typedef struct { byte *palette; } planar_buf_t; +//===========================================================================// + //TODO: 16_mm and 16_ca must handle this typedef struct { - bitmap_t far *btdata; //old - planar_buf_t far *data; //old - word tileHeight, tileWidth; + bitmap_t far *pcximg; //I will probibaly use this --sparky4 + //planar_buf_t far *pbdata; //old + word tileHeight, tileWidth; //defined by mapfile unsigned int rows, cols; -// #ifdef __DEBUG__ -// boolean debug_text; //show the value of the tile! wwww -// byte *debug_data; -// #endif -} tiles_t; + 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 __NEWMAPTILEDATAVARS__ +#define MAPLAYERS 4 +#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 { //long planestart[3]; //unsigned planelength[3]; +#ifndef __NEWMAPTILEDATAVARS__ byte *data; //TODO: 16_mm and 16_ca must handle this - byte * far *layerdata; //TODO: 16_mm and 16_ca must handle this tiles_t *tiles; //TODO: 16_mm and 16_ca must handle this - tiles_t * far *layertile; //TODO: 16_mm and 16_ca must handle this +#else + byte far *layerdata[MAPLAYERS]; // mapdata for multilayer (map index values for rendering which image on the tile) + tiles_t far *layertile[MAPLAYERS]; // tilesets for layers (currently ony 4 can be loaded wwww) +#endif int width, height; //this has to be signed! - char name[16]; + byte name[16]; } map_t; -//TODO USE THIS tile info +//===================================// + typedef struct{ word tw; /* screen width in tiles */ word th; /* screen height in tiles */ @@ -99,34 +115,51 @@ typedef struct{ 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 */ sword tileplayerposscreeny; /* player position on screen */ /* needed for scroll and map system to work accordingly */ -} ti_t; +} pagetileinfo_t; typedef struct { nibble/*word*/ id; /* the Identification number of the page~ For layering~ */ byte far* data; /* the data for the page */ + pagetileinfo_t ti; 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 tw; /* screen width in tiles */ - word th; /* screen height in tiles */ word width; /* virtual width of the page */ word height; /* virtual height of the page */ - 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 */ - sword tileplayerposscreeny; /* player position on screen */ /* needed for scroll and map system to work accordingly */ 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; -//new structs +//from 16_sprit.h +#ifdef __WATCOMC__ +typedef struct sprite +{ + // VRS container from which we will extract animation and image data + struct vrs_container *spritesheet; + // Container for a vrl sprite + struct vrl_container *sprite_vrl_cont; + // Current sprite id + int curr_spri_id; + // Index of a current sprite in an animation sequence + int curr_anim_spri; + // Current animation sequence + struct vrs_animation_list_entry_t *curr_anim_list; + // Index of current animation in relevant VRS offsets table + int curr_anim; + // Delay in time units untill we should change sprite + int delay; + // Position of sprite on screen + int x, y; +} sprite_t; +#endif + +//newer structs typedef struct { int x; //entity exact position on the viewable map @@ -135,31 +168,23 @@ typedef struct 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 - byte d; //direction to render sprite!! wwww - byte q; //loop variable for anumation and locking the playing to compleate the animation cycle to prevent issues with misalignment www +// 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 - struct sprite *spri; // sprite used by entity +#ifdef __WATCOMC__ + sprite_t *spri; // sprite used by entity +#endif sword hp; //hitpoints of the entity - int persist_aniframe; /* gonna be increased to 1 before being used, so 0 is ok for default */ + 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; -//TODO: MAKE THIS WWWW -typedef struct -{ - //sprite .... - boolean wwww; -} spri_t; - -//TODO: MAKE THIS TO WWWW -typedef struct -{ - //vrs with sprite .... - spri_t *spri; -} vrs_t; - //from 16_in //========================================================================== typedef byte ScanCode; @@ -217,7 +242,6 @@ typedef struct { typedef struct { entity_t near enti; - entity_t *ent; #ifdef __WATCOMC__ //struct sprite *spri; //supposively the sprite sheet data memptr gr; @@ -229,6 +253,7 @@ typedef struct byte near pdir; //previous direction~ used in IN_16 in IN_ReadControl() CursorInfo info; ControlType Controls; + word walktype; //newer vars int dx, dy, delta; //TODO: what is this? ^^ } player_t; @@ -252,11 +277,17 @@ typedef struct } kurokku_t; //video +typedef struct +{ + unsigned int offscreen_ofs; + unsigned int pattern_ofs; +} ofs_t; #define NUMCHUNKS 416 //keen typedef struct { char old_mode; //old video mode before game! + byte palette[768]; //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 @@ -264,21 +295,54 @@ typedef struct byte far * omemptr; byte vga_draw_stride; byte vga_draw_stride_limit; // further X clipping -// - word __near rs; //render switch - int __near playerfilei; //player file's i - boolean __near p; //render page number //BLEH - boolean __near r; //page flip if true + //end of doslib origi vars + boolean __near rss; //render sprite switch + boolean __near bgps; //bg preservation render switch between old and new + sword __near sprifilei; //player file's i + nibble __near p; //render page number + nibble __near sp; //show page number(for showpage) + boolean __near dorender; //page flip, showpage, or render if true word pr[MAXPAGE][4]; //render sections of pages (this is supposed to be set up to draw sections of the screen if updated) - nibble sfip;//shinku_fps_indicator_page; // we're on page 1 now, shinku(). follow along please or it will not be visible. - nibble panp; //pan_t replacement + 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 //0000word startclk; float clk, tickclk; //timer //newer vars //TODO: find out how they are used byte grneeded[NUMCHUNKS]; } video_t; +//from scroll16 +//========================================================================== +typedef struct +{ + map_t *map; + page_t *page; + 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 + 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 +//newer vars! + int delta, d; +} map_view_t; +/* Map is presumed to: + * 1. Have all the required layers and tilesets within itself + * 2. Have a 'fence' around accessible blocks to simplify boundary logic + * 3. Have a persistent map and tile size among the layers + * Map view is presumed to: + * 1. Calculate, store and update a panning info, which includes, but not limited to: + * combined layer information, actual map representation (reflecting real state of the game), + * pixel shift for smooth tile scrolling. + * 2. Provide ways to draw a visible part of map. For simplicity with smooth scrolling, + * additional row/column is always drawn at the each side of the map. This implies that 'fence' + * should have a sprite too. Map is drawn left-to-right, top-to-bottom. + */ + +//========================================================================== + //from 16_mm //========================================================================== @@ -447,9 +511,10 @@ typedef struct typedef struct { int mapon, mapnum; - __SEGA *mapsegs[4]; - __SEGA *mapheaderseg[NUMMAPS]; - __SEGA *tinf; + //__SEGA *mapsegs[4]; + //__SEGA *mapheaderseg[NUMMAPS]; + //__SEGA *tinf; + memptr mapsegs; } ca_mapinfo_t; typedef struct @@ -465,6 +530,9 @@ typedef struct __SEGA *grsegs[NUMCHUNKS]; byte far grneeded[NUMCHUNKS]; huffnode huffnode; + + //TODO: extend! and learn from keen/wolf/catacomb's code wwww + memptr spribuff; } ca_t; //========================================================================== @@ -488,8 +556,9 @@ typedef struct mminfo_t mm; mminfotype mmi; } global_game_variables_t; -extern char global_temp_status_text[512]; #ifdef __WATCOMC__ +extern char global_temp_status_text[512]; +extern char global_temp_status_text2[512]; #define EINVFMT EMFILE #endif #endif /* _TYPEDEFSTRUCT_H_ */