]> 4ch.mooo.com Git - 16.git/blob - src/lib/16_tdef.h
__seguse.txt added to show _seg usage also OpenVGMFile needs to be ported to 16_snd...
[16.git] / src / lib / 16_tdef.h
1 /* Project 16 Source Code~\r
2  * Copyright (C) 2012-2017 sparky4 & pngwen & andrius4669 & joncampbell123 & yakui-lover\r
3  *\r
4  * This file is part of Project 16.\r
5  *\r
6  * Project 16 is free software; you can redistribute it and/or modify\r
7  * it under the terms of the GNU General Public License as published by\r
8  * the Free Software Foundation; either version 3 of the License, or\r
9  * (at your option) any later version.\r
10  *\r
11  * Project 16 is distributed in the hope that it will be useful,\r
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
14  * GNU General Public License for more details.\r
15  *\r
16  * You should have received a copy of the GNU General Public License\r
17  * along with this program.  If not, see <http://www.gnu.org/licenses/>, or\r
18  * write to the Free Software Foundation, Inc., 51 Franklin Street,\r
19  * Fifth Floor, Boston, MA 02110-1301 USA.\r
20  *\r
21  */\r
22 \r
23 #ifndef _TYPEDEFSTRUCT_H_\r
24 #define _TYPEDEFSTRUCT_H_\r
25 \r
26 #include "src/lib/16_t.h"\r
27 \r
28 #define AARED           "\x1b[41;31m"\r
29 #define AABLUE          "\x1b[44;34m"\r
30 #define AAGREEN "\x1b[42;32m"\r
31 #define AAYELLOW        "\x1b[43;33m"\r
32 #define AAGREY          "\x1b[47;37m"\r
33 #define AABLACK "\x1b[40;30m"\r
34 #define AAWHITE         "\x1b[47;37m"\r
35 #define AAMAGENTA       "\x1b[45;35m"\r
36 #define AARESET "\x1b[0m"\r
37 \r
38 #define MAXPAGE 4\r
39 \r
40 /*\r
41  * typedefs of the game variables!\r
42  */\r
43 typedef struct {\r
44         byte *data;\r
45         word width;\r
46         word height;\r
47         byte *palette;\r
48         word offset;\r
49 } bitmap_t;\r
50 \r
51 typedef struct {\r
52         byte far **data;\r
53         word ntiles;            // the number of tiles\r
54         word twidth;    // width of the tiles\r
55         word theight;   // height of the tiles\r
56         byte *palette;  // palette for the tile set\r
57 } tileset_t;\r
58 \r
59 typedef struct {\r
60         byte far *plane[4];     // 4 planes of image data\r
61         word width;                     // width of the image (spread across 4 planes)\r
62         word height;            // height of the image (spread across 4 planes)\r
63         word pwidth;            // the number of bytes in each plane\r
64         byte *palette;\r
65 } planar_buf_t;\r
66 \r
67 //from 16_sprit.h\r
68 #ifdef  __WATCOMC__\r
69 #include <hw/vga/vrl.h>\r
70 #define VRSVRLNONPTR\r
71 \r
72 typedef struct vrs_container{\r
73         // Size of a .vrs blob in memory\r
74         // minus header\r
75         dword data_size;\r
76         union{\r
77                 byte far *buffer;\r
78                 struct vrs_header far *vrs_hdr;\r
79         };\r
80         // Array of corresponding vrl line offsets\r
81         vrl1_vgax_offset_t **vrl_line_offsets;\r
82 } vrs_container_t;\r
83 \r
84 typedef struct vrl_container{\r
85         // Size of a .vrl blob in memory\r
86         // minus header\r
87         dword data_size;\r
88         union{\r
89                 byte far *buffer;\r
90                 struct vrl1_vgax_header far *vrl_header;\r
91         };\r
92         // Pointer to a corresponding vrl line offsets struct\r
93         vrl1_vgax_offset_t *line_offsets;\r
94 } vrl_container_t;\r
95 \r
96 typedef struct sprite\r
97 {\r
98         // VRS container from which we will extract animation and image data\r
99 #ifndef VRSVRLNONPTR\r
100         vrs_container_t *spritesheet;\r
101 #else\r
102         vrs_container_t spritesheet;\r
103 #endif\r
104         // Container for a vrl sprite\r
105 #ifndef VRSVRLNONPTR\r
106         vrl_container_t *sprite_vrl_cont;\r
107 #else\r
108         vrl_container_t sprite_vrl_cont;\r
109 #endif\r
110         // Current sprite id\r
111         int curr_spri_id;\r
112         // Index of a current sprite in an animation sequence\r
113         int curr_anim_spri;\r
114         // Current animation sequence\r
115         struct vrs_animation_list_entry_t *curr_anim_list;\r
116         // Index of current animation in relevant VRS offsets table\r
117         int curr_anim;\r
118         // Delay in time units untill we should change sprite\r
119         int delay;\r
120         // Position of sprite on screen\r
121         int x, y;\r
122 } sprite_t;\r
123 #endif\r
124 \r
125 //newer structs\r
126 typedef struct\r
127 {\r
128         int x; //entity exact position on the viewable map\r
129         int y; //entity exact position on the viewable map\r
130         int tx; //entity tile position on the viewable map\r
131         int ty; //entity tile position on the viewable map\r
132         int triggerx; //entity's trigger box tile position on the viewable map\r
133         int triggery; //entity's trigger box tile position on the viewable map\r
134 //      int sheetsetx; //NOT USED YET! entity sprite sheet set on the image x\r
135 //      int sheetsety; //NOT USED YET! entity sprite sheet set on the image y\r
136         nibble d;               //direction to render sprite!! wwww\r
137         nibble pred;    //prev. direction for animation changing\r
138         word dire;              //sprite in use\r
139         nibble q;               //loop variable for anumation and locking the playing to compleate the animation cycle to prevent issues with misalignment www\r
140         word speed;             //entity speed!\r
141         word spt;               //speed per tile\r
142 #ifdef  __WATCOMC__\r
143         sprite_t spri; // sprite used by entity\r
144 #endif\r
145         sword hp; //hitpoints of the entity\r
146         nibble overdraww, overdrawh;    // how many pixels to "overdraw" so that moving sprites with edge pixels don't leave streaks.\r
147                                                 // if the sprite's edge pixels are clear anyway, you can set this to 0.\r
148         nibble /*int*/ persist_aniframe;    // gonna be increased to 1 before being used, so 0 is ok for default\r
149 } entity_t;\r
150 \r
151 typedef struct\r
152 {\r
153         int x; //entity exact position on the viewable map\r
154         int y; //entity exact position on the viewable map\r
155         int tx; //entity tile position on the viewable map\r
156         int ty; //entity tile position on the viewable map\r
157 \r
158 #ifdef  __WATCOMC__\r
159         sprite_t spri; // sprite used by entity\r
160 #endif\r
161         sword hp; //hitpoints of the entity\r
162 } static_map_entity_t;\r
163 \r
164 //===========================================================================//\r
165 \r
166 //TODO: 16_mm and 16_ca must handle this\r
167 typedef struct {\r
168 #ifdef  __WATCOMC__\r
169         sprite_t *spri;                 // I will probibaly use this --sparky4\r
170 #endif\r
171         word tileHeight, tileWidth;     //defined by mapfile\r
172         unsigned int rows, cols;\r
173         byte    imgname[8];             //image file of tileset (set to 8 because DOS ^^;)\r
174 } tiles_t;      //seems to be the tileset properties\r
175 \r
176 //TODO: 16_mm and 16_ca must handle this\r
177 //TODO: add variables from 16_ca\r
178 typedef struct {\r
179         byte    layername[8];\r
180         byte    *data;                  //TODO: 16_mm and 16_ca must handle this\r
181 } mapl_t;       //map layer array type def\r
182 \r
183 #define MAP_LAYERS 3\r
184 typedef struct {\r
185         //long          planestart[3];\r
186         //unsigned      planelength[3];\r
187         mapl_t layerdata[MAP_LAYERS];   // mapdata for multilayer (map index values for rendering which image on the tile)\r
188         tiles_t *tiles;         //TODO: 16_mm and 16_ca must handle this        // tilesets for layers (currently ony 4 can be loaded wwww)\r
189         int width, height;              //this has to be signed!\r
190         byte name[16];\r
191 } map_t;\r
192 \r
193 //===================================//\r
194 \r
195 typedef struct{\r
196         word tw;                                /* screen width in tiles */\r
197         word th;                                /* screen height in tiles */\r
198         word tilesw;                            /* virtual screen width in tiles */\r
199         word tilesh;                            /* virtual screen height in tiles */\r
200         sword tilemidposscreenx;        /* middle tile x position */    /* needed for scroll system to work accordingly */\r
201         sword tilemidposscreeny;        /* middle tile y position */    /* needed for scroll system to work accordingly */\r
202         sword tileplayerposscreenx;     /* player position on screen */ /* needed for scroll and map system to work accordingly */\r
203         sword tileplayerposscreeny;     /* player position on screen */ /* needed for scroll and map system to work accordingly */\r
204 } pagetileinfo_t;\r
205 \r
206 typedef struct {\r
207         nibble/*word*/ id;      /* the Identification number of the page~ For layering~ */\r
208         byte far* data; /* the data for the page */\r
209         pagetileinfo_t ti;      // the tile information of the page\r
210         word dx;                /* col we are viewing on virtual screen (on page[0]) */ /* off screen buffer on the left size */\r
211         word dy;                /* row we are viewing on virtual screen (on page[0]) */ /* off screen buffer on the top size */\r
212         word sw;                /* screen width */      /* resolution */\r
213         word sh;                /* screen heigth */     /* resolution */\r
214         word width;             /* virtual width of the page */\r
215         word height;    /* virtual height of the page */\r
216         word stridew;   /* width/4 */   /* VGA */\r
217         word pagesize;  /* page size */\r
218         word pi;                /* increment page by this much to preserve location */\r
219         int tlx,tly;\r
220 //newer vars\r
221 //TODO: find where they are used\r
222         sword delta;                    // How much should we shift the page for smooth scrolling\r
223 } page_t;\r
224 \r
225 //from 16_in\r
226 //==========================================================================\r
227 #define KeyInt          9       // The keyboard ISR number\r
228 \r
229 //\r
230 // mouse constants\r
231 //\r
232 #define MReset          0\r
233 #define MButtons        3\r
234 #define MDelta          11\r
235 \r
236 #define MouseInt        0x33\r
237 //#define       Mouse(x)        _AX = x,geninterrupt(MouseInt)\r
238 \r
239 //\r
240 // joystick constants\r
241 //\r
242 #define JoyScaleMax             32768\r
243 #define JoyScaleShift   8\r
244 #define MaxJoyValue             5000\r
245 \r
246 #define MaxPlayers      4\r
247 #define MaxKbds         2\r
248 #define MaxJoys         2\r
249 #define NumCodes        128\r
250 \r
251 typedef byte            ScanCode;\r
252 \r
253 typedef enum            {\r
254                                                 //ctrl_None,                            // MDM (GAMERS EDGE) - added\r
255                                                 ctrl_Keyboard,\r
256                                                         ctrl_Keyboard1 = ctrl_Keyboard,ctrl_Keyboard2,\r
257                                                 ctrl_Joystick,\r
258                                                         ctrl_Joystick1 = ctrl_Joystick,ctrl_Joystick2,\r
259                                                 ctrl_Mouse,\r
260                                         } ControlType;\r
261 typedef enum            {\r
262                                                 motion_Left = -1,motion_Up = -1,\r
263                                                 motion_None = 0,\r
264                                                 motion_Right = 1,motion_Down = 1\r
265                                         } Motion;\r
266 typedef enum            {               // Quick lookup for total direction\r
267                                                 /*dir_NorthWest,        */dir_North,/*  dir_NorthEast,*/\r
268                                                 dir_West,               dir_None,       dir_East,\r
269                                                 /*dir_SouthWest,        */dir_South/*,  dir_SouthEast*/\r
270                                         } Direction;\r
271 typedef struct          {\r
272                                                 boolean near    button0,button1,button2,button3;\r
273                                                 int     near            x,y;\r
274                                                 Motion  near    xaxis,yaxis;\r
275                                                 Direction near  dir;\r
276                                         } CursorInfo;\r
277 \r
278 typedef struct          {\r
279                                                 ScanCode near   button0,button1,\r
280                                                                         //upleft,\r
281                                                                         up,\r
282                                                                         down,\r
283                                                                         left,\r
284                                                                         right\r
285                                                                         //upright,\r
286                                                                         //downleft,\r
287                                                                         //,downright\r
288                                                                         ;\r
289                                         } KeyboardDef;\r
290 typedef struct          {\r
291                                                 word    near    joyMinX,joyMinY,\r
292                                                                         threshMinX,threshMinY,\r
293                                                                         threshMaxX,threshMaxY,\r
294                                                                         joyMaxX,joyMaxY,\r
295                                                                         joyMultXL,joyMultYL,\r
296                                                                         joyMultXH,joyMultYH;\r
297                                         } JoystickDef;\r
298 \r
299 /*typedef struct// inconfig\r
300 {\r
301         boolean         IN_Started;\r
302         boolean         CapsLock;\r
303         ScanCode        CurCode,LastCode;\r
304 //\r
305 // configuration variables\r
306 //\r
307         boolean         Keyboard[NumCodes],\r
308                                         JoysPresent[MaxJoys],\r
309                                         MousePresent,\r
310                                         JoyPadPresent;\r
311 \r
312 //      Global variables\r
313         boolean         Paused;\r
314         char            LastASCII;\r
315         ScanCode        LastScan;\r
316 \r
317         KeyboardDef     KbdDefs[MaxKbds];\r
318         JoystickDef     JoyDefs[MaxJoys];\r
319 } in_info_t;*/\r
320 \r
321 //==========================================================================\r
322 \r
323 typedef struct\r
324 {\r
325         entity_t near   enti;\r
326 #ifdef  __WATCOMC__\r
327         //struct sprite *spri;  //supposively the sprite sheet data\r
328         //memptr                gr;\r
329 #endif\r
330 //      bitmap_t        *data;          //supposively the sprite sheet data//old format\r
331 //      bitmap_t        bmp;\r
332 \r
333         //input\r
334         byte near               pdir;   //previous direction~ used in IN_16 in IN_ReadControl()\r
335         CursorInfo              info;\r
336         ControlType     Controls;\r
337         word walktype;\r
338 //newer vars\r
339         int dx, dy, delta;      //TODO: what is this? ^^\r
340 } player_t;\r
341 \r
342 //===========================================//\r
343 \r
344 typedef struct\r
345 {\r
346         int profilehandle,debughandle,showmemhandle;\r
347         int heaphandle;\r
348 } loghandle_t;\r
349 \r
350 typedef struct\r
351 {\r
352         word frames_per_second;\r
353         clock_t t;\r
354         dword tiku;             //frames passed\r
355         word clock_start;       //timer start\r
356         word *clock;    //current time on clock\r
357         boolean fpscap; //cap the fps var\r
358         nibble wcpu;    //stored value of cpu type\r
359 } kurokku_t;\r
360 \r
361 //===================================//\r
362 #define     PALSIZE            768\r
363 #define NUMCHUNKS       416     //keen\r
364 //video\r
365 typedef struct\r
366 {\r
367         unsigned int offscreen_ofs;\r
368         unsigned int pattern_ofs;\r
369 } ofs_t;        //unfinished\r
370 \r
371 typedef struct\r
372 {\r
373         char old_mode;          //old video mode before game!\r
374         byte palette[PALSIZE], dpal[PALSIZE];   //palette array\r
375         page_t page[MAXPAGE];   //can be used as a pointer to root page[0]\r
376         word vmem_remain;       //remaining video memory\r
377         byte num_of_pages;      //number of actual pages\r
378         //doslib origi vars\r
379         byte far * omemptr;\r
380         byte vga_draw_stride;\r
381         byte vga_draw_stride_limit;             // further X clipping\r
382         //end of doslib origi vars\r
383         boolean __near rss;             //render sprite switch\r
384         boolean __near bgps;            //bg preservation render switch between old and new\r
385         sword __near sprifilei;         //player file's i\r
386         nibble __near p;                        //render page number\r
387         nibble __near sp;                       //show page number(for showpage)\r
388         boolean __near dorender;        //page flip, showpage, or render        if true\r
389         word pr[MAXPAGE][4];    //render sections of pages (this is supposed to be set up to draw sections of the screen if updated)\r
390 \r
391         nibble sfip;            //shinku_fps_indicator_page; // we're on page 1 now, shinku(). follow along please or it will not be visible.\r
392         ofs_t   ofs;            //offset vars used for doslib\r
393         word    vh;             //video combined height\r
394         //0000word startclk; float clk, tickclk;        //timer\r
395 //newer vars\r
396 //TODO: find out how they are used\r
397         byte grneeded[NUMCHUNKS];\r
398 } video_t;\r
399 \r
400 //from scroll16\r
401 //==========================================================================\r
402 typedef struct\r
403 {\r
404         map_t *map;\r
405         page_t *page;\r
406         int tx,ty; //appears to be the top left tile position on the viewable screen map\r
407         word dxThresh,dyThresh; //Threshold for physical tile switch\r
408         video_t *video; //pointer to game variables of the video\r
409         nibble __near *p;       // pointer to video's render page num\r
410         nibble __near *sp;      // pointer to video's show page num\r
411         int dx, dy;     // draw row and col var\r
412 //newer vars!\r
413         int delta, d;\r
414 } map_view_t;\r
415 /* Map is presumed to:\r
416  * 1. Have all the required layers and tilesets within itself\r
417  * 2. Have a 'fence' around accessible blocks to simplify boundary logic\r
418  * 3. Have a persistent map and tile size among the layers\r
419  * Map view is presumed to:\r
420  * 1. Calculate, store and update a panning info, which includes, but not limited to:\r
421  *      combined layer information, actual map representation (reflecting real state of the game),\r
422  *      pixel shift for smooth tile scrolling.\r
423  * 2. Provide ways to draw a visible part of map. For simplicity with smooth scrolling,\r
424  *      additional row/column is always drawn at the each side of the map. This implies that 'fence'\r
425  *      should have a sprite too. Map is drawn left-to-right, top-to-bottom.\r
426  */\r
427 \r
428 //==========================================================================\r
429 \r
430 //from 16_mm\r
431 //==========================================================================\r
432 \r
433 #define MAXBLOCKS               1024\r
434 #define MAXUMBS         12\r
435 \r
436 typedef struct mmblockstruct\r
437 {\r
438         word    start,length;\r
439         //word  start;  dword length;\r
440         word    blob;   //for data larger than 64k\r
441         unsigned        attributes;\r
442         memptr          *useptr;        // pointer to the segment start\r
443         struct mmblockstruct far *next;\r
444 } mmblocktype;\r
445 \r
446 typedef struct\r
447 {\r
448         dword   nearheap,farheap,EMSmem,XMSmem,mainmem;\r
449 //      boolean         PMStarted, MainPresent, EMSPresent, XMSPresent;\r
450 } mminfotype;\r
451 \r
452 typedef struct\r
453 {\r
454         memptr bufferseg;\r
455         boolean         mmstarted, bombonerror, mmerror;\r
456         void far        *farheap;\r
457 #ifdef __BORLANDC__\r
458         void            *nearheap;\r
459 #endif\r
460 #ifdef __WATCOMC__\r
461         void __near     *nearheap;\r
462 #endif\r
463         unsigned int            EMSVer;\r
464         word numUMBs,UMBbase[MAXUMBS];\r
465         word                    totalEMSpages, freeEMSpages, EMSpagesmapped, EMSHandle, EMSPageFrame;\r
466         //dword numUMBs,UMBbase[MAXUMBS];\r
467         mmblocktype     far mmblocks[MAXBLOCKS],far *mmhead,far *mmfree,far *mmrover,far *mmnew;\r
468 } mminfo_t;\r
469 \r
470 //==========================================================================\r
471 \r
472 \r
473 //from 16_pm\r
474 //==========================================================================\r
475 \r
476 //      NOTE! PMPageSize must be an even divisor of EMSPageSize, and >= 1024\r
477 #define EMSPageSize             16384\r
478 #define EMSPageSizeSeg  (EMSPageSize >> 4)\r
479 #define EMSPageSizeKB   (EMSPageSize >> 10)\r
480 #define EMSFrameCount   4\r
481 #define PMPageSize              4096\r
482 #define PMPageSizeSeg   (PMPageSize >> 4)\r
483 #define PMPageSizeKB    (PMPageSize >> 10)\r
484 #define PMEMSSubPage    (EMSPageSize / PMPageSize)\r
485 \r
486 #define PMMinMainMem    10                      // Min acceptable # of pages from main\r
487 #define PMMaxMainMem    100                     // Max number of pages in main memory\r
488 \r
489 #define PMThrashThreshold       1       // Number of page thrashes before panic mode\r
490 #define PMUnThrashThreshold     5       // Number of non-thrashing frames before leaving panic mode\r
491 \r
492 typedef enum\r
493                 {\r
494                         pml_Unlocked,\r
495                         pml_Locked\r
496                 } PMLockType;\r
497 \r
498 typedef enum\r
499                 {\r
500                         pmba_Unused = 0,\r
501                         pmba_Used = 1,\r
502                         pmba_Allocated = 2\r
503                 } PMBlockAttr;\r
504 \r
505 typedef struct\r
506                 {\r
507                         dword   offset;         // Offset of chunk into file\r
508                         word            length;         // Length of the chunk\r
509 \r
510                         int                     xmsPage;        // If in XMS, (xmsPage * PMPageSize) gives offset into XMS handle\r
511 \r
512                         PMLockType      locked;         // If set, this page can't be purged\r
513                         int                     emsPage;        // If in EMS, logical page/offset into page\r
514                         int                     mainPage;       // If in Main, index into handle array\r
515 \r
516                         dword   lastHit;        // Last frame number of hit\r
517                 } PageListStruct;\r
518 \r
519 typedef struct\r
520                 {\r
521                         int                     baseEMSPage;    // Base EMS page for this phys frame\r
522                         dword   lastHit;                // Last frame number of hit\r
523                 } EMSListStruct;\r
524 \r
525 //      Main Mem specific variables\r
526 typedef struct\r
527 {\r
528         boolean                 MainPresent;\r
529         memptr                  MainMemPages[PMMaxMainMem];\r
530         PMBlockAttr             MainMemUsed[PMMaxMainMem];\r
531         int                             MainPagesAvail;\r
532 } pm_mmi_t;\r
533 \r
534 //      EMS specific variables\r
535 typedef struct\r
536 {\r
537         boolean                 EMSPresent;\r
538         unsigned int                    EMSVer;\r
539         word                    EMSAvail,EMSPagesAvail,EMSHandle,\r
540                                         EMSPageFrame,EMSPhysicalPage;\r
541         word                    totalEMSpages, freeEMSpages, EMSpagesmapped;\r
542         EMSListStruct   EMSList[EMSFrameCount];\r
543 } pm_emmi_t;\r
544 \r
545 //      XMS specific variables\r
546 typedef struct\r
547 {\r
548         boolean                 XMSPresent;\r
549         word                    XMSAvail,XMSPagesAvail,XMSHandle;//,XMSVer;\r
550         dword                   XMSDriver;\r
551         int                             XMSProtectPage;// = -1;\r
552 } pm_xmmi_t;\r
553 \r
554 //      File specific variables\r
555 typedef struct\r
556 {\r
557         char                    PageFileName[13];// = {"VSWAP."};\r
558         int                             PageFile;// = -1;\r
559         word                    ChunksInFile;\r
560         word                    PMSpriteStart,PMSoundStart;\r
561 } pm_fi_t;\r
562 \r
563 //      General usage variables\r
564 typedef struct\r
565 {\r
566         boolean                 PMStarted,\r
567                                         PMPanicMode,\r
568                                         PMThrashing;\r
569         word                    XMSPagesUsed,\r
570                                         EMSPagesUsed,\r
571                                         MainPagesUsed,\r
572                                         PMNumBlocks;\r
573         long                    PMFrameCount;\r
574         PageListStruct  far *PMPages;\r
575         memptr/*__SEGA*/ *PMSegPages;\r
576         pm_mmi_t        mm;\r
577         pm_emmi_t       emm;\r
578         pm_xmmi_t       xmm;\r
579         pm_fi_t fi;\r
580 } pm_t;\r
581 \r
582 //==========================================================================\r
583 \r
584 //from 16_ca\r
585 //==========================================================================\r
586 \r
587 #define NUMMAPS         4//39\r
588 #define MAPPLANES               3\r
589 #define NUMSNDCHUNKS            84\r
590 \r
591 typedef struct\r
592 {\r
593   word bit0,bit1;       // 0-255 is a character, > is a pointer to a node\r
594 } huffnode;\r
595 \r
596 typedef struct\r
597 {\r
598         int             mapon, mapnum;\r
599         //__SEGA        *mapheaderseg[NUMMAPS];\r
600 } ca_mapinfo_t;\r
601 \r
602 typedef struct\r
603 {\r
604         int                     maphandle[4];           // handle to MAPTEMP / GAMEMAPS\r
605         int                     grhandle[4];            // handle to EGAGRAPH\r
606         int                     audiohandle[4]; // handle to AUDIOT / AUDIO\r
607 } ca_handle_t;\r
608 \r
609 typedef struct  //TODO: USE THIS!!!!\r
610 {\r
611         byte    ca_levelbit,ca_levelnum;\r
612         ca_handle_t             file;           //files to open\r
613         ca_mapinfo_t    camap;\r
614 \r
615         memptr/*__SEGA*/        mapsegs[MAP_LAYERS];\r
616         memptr/*__SEGA*/        *grsegs[NUMCHUNKS];\r
617         byte            far             grneeded[NUMCHUNKS];\r
618         memptr/*byte _seg*/     *audiosegs[NUMSNDCHUNKS];\r
619 \r
620         long            _seg *grstarts; // array of offsets in egagraph, -1 for sparse\r
621         long            _seg *audiostarts;      // array of offsets in audio / audiot\r
622 \r
623         //misc memptr\r
624         memptr tinf[4];\r
625 \r
626         huffnode huffnode;\r
627 \r
628         //TODO: extend! and learn from keen/wolf/catacomb's code wwww\r
629         memptr  spribuff;\r
630 } ca_t;\r
631 \r
632 //==========================================================================\r
633 \r
634 //actual global game varables!\r
635 typedef enum {\r
636         ENGI_QUIT,\r
637         ENGI_RUN,\r
638         ENGI_MENU,\r
639         ENGI_PAUSE\r
640 } engi_stat_t;\r
641 //ENGI_INPUT,\r
642 \r
643 typedef struct\r
644 {\r
645         engi_stat_t     engi_stat;\r
646         video_t video;  // video settings variable\r
647         ca_t            ca;     // ca stuff\r
648         pm_t            pm;     // pm stuff\r
649         loghandle_t     handle; //handles for file logging\r
650         kurokku_t       kurokku;        //clock struct\r
651         mminfo_t        mm; mminfotype  mmi;    // mm stuff\r
652 //++++  in_info_t       in;             // 16_in info\r
653         player_t        player[MaxPlayers];     // player vars\r
654         map_view_t      mv[4];\r
655 } global_game_variables_t;\r
656 \r
657 #ifdef __WATCOMC__\r
658 extern char global_temp_status_text[512];\r
659 extern char global_temp_status_text2[512];\r
660 #define EINVFMT EMFILE\r
661 #endif\r
662 #endif /* _TYPEDEFSTRUCT_H_ */\r