\r
void CAL_SetupMapFile (global_game_variables_t *gvar)\r
{\r
+#ifndef MAPHEADERLINKED\r
int handle;\r
long length;\r
+#endif\r
\r
//\r
// load maphead.ext (offsets and tileinfo for map file)\r
MM_GetPtr (MEMPTR gvar->ca.tinf,length,gvar);\r
CA_FarRead(handle, gvar->ca.tinf, length,gvar);\r
close(handle);\r
-#else\r
+//#else\r
\r
- tinf = (byte _seg *)FP_SEG(&maphead);\r
+ gvar->ca.tinf = (byte _seg *)FP_SEG(&maphead);\r
\r
#endif\r
\r
byte far *source;\r
int next;\r
\r
- gvar->video.grneeded[chunk] |= ca_levelbit; // make sure it doesn't get removed\r
+ gvar->ca.grneeded[chunk] |= ca_levelbit; // make sure it doesn't get removed\r
if (grsegs[chunk])\r
{\r
MM_SetPurge (&grsegs[chunk],0);\r
#define NOGRAPHICS\r
#define NOAUDIO\r
\r
-//#define MAPHEADERLINKED\r
+#define MAPHEADERLINKED\r
//#define GRHEADERLINKED\r
//#define AUDIOHEADERLINKED\r
\r
// modexClearRegion(&video->page[0], enti->x, enti->y, 16, 16, 2);\r
// modexClearRegion(&video->page[2], 0, 0, video->page[2].sw, video->page[2].sh, 45);\r
// modexClearRegion(&video->page[3], 0, 0, video->page[3].sw, video->page[3].sh, 47);\r
- if(!video->bgps){\r
+ if(!video->vga_state.bgps){\r
//video->ofs.pattern_ofs=(uint16_t)video->page[0].data;\r
//video->ofs.offscreen_ofs=(uint16_t)video->page[3].data;\r
w = (enti->x + 24) & (~3);\r
}\r
\r
// render box bounds. y does not need modification, but x and width must be multiple of 4\r
- if(!video->rss)\r
+ if(!video->vga_state.rss)\r
{\r
if (x >= enti->overdraww) rx = (x - enti->overdraww) & (~3);\r
else rx = -(video->page[0].dx);\r
if ((rx+w) > video->page[0].width) w = video->page[0].width-rx;\r
if ((ry+h) > video->page[0].height) h = video->page[0].height-ry;\r
\r
- if(!video->bgps){\r
+ if(!video->vga_state.bgps){\r
// block copy pattern to where we will draw the sprite\r
vga_setup_wm1_block_copy();\r
o2 = video->ofs.offscreen_ofs;\r
#ifdef __DEBUG_SPRI__\r
if(dbg_delayanimation) delay(250);//{ while(!IN_KeyDown(sc_Space)/* && !IN_KeyDown(sc_Escape)*/){} delay(250); }\r
#endif\r
- if(!video->rss)\r
+ if(!video->vga_state.rss)\r
{\r
// restore ptr\r
vga_state.vga_graphics_ram = omemptr;\r
\r
- if(!video->bgps){\r
+ if(!video->vga_state.bgps){\r
// block copy to visible RAM from offscreen\r
vga_setup_wm1_block_copy();\r
o = video->ofs.offscreen_ofs; // source offscreen\r
// restore stride\r
vga_state.vga_draw_stride_limit = vga_state.vga_draw_stride = video->page[0].stridew;\r
\r
- vga_state.vga_graphics_ram = video->omemptr;\r
+ vga_state.vga_graphics_ram = video->vga_state.omemptr;\r
video->dorender=1;\r
}\r
#define TAIL_FUNCTIONKEYFUNCTIONS0EXE \\r
if(gvar.in.inst->Keyboard[sc_F4]){ turboXT(12); IN_UserInput(1, &gvar); } \\r
if(gvar.in.inst->Keyboard[68/*sc_F10*/]){ gvar.kurokku.fpscap=!gvar.kurokku.fpscap; IN_UserInput(1, &gvar); } \\r
- if(gvar.in.inst->Keyboard[sc_F8]){ gvar.video.bgps=!gvar.video.bgps; IN_UserInput(1, &gvar); } \\r
+ if(gvar.in.inst->Keyboard[sc_F8]){ gvar.video.vga_state.bgps=!gvar.video.vga_state.bgps; IN_UserInput(1, &gvar); } \\r
if(gvar.in.inst->Keyboard[sc_F7]){ ZC_ShowMV(&gvar.mv, 0, 1); IN_UserInput(1, &gvar); } \\r
if(gvar.in.inst->Keyboard[sc_F6]){ ZC_ShowMV(&gvar.mv, 0, 0); IN_UserInput(1, &gvar); } \\r
- if(gvar.in.inst->Keyboard[sc_T]){ gvar.video.rss=!gvar.video.rss; IN_UserInput(1, &gvar); } \\r
+ if(gvar.in.inst->Keyboard[sc_T]){ gvar.video.vga_state.rss=!gvar.video.vga_state.rss; IN_UserInput(1, &gvar); } \\r
if(gvar.in.inst->Keyboard[sc_P]){ modexpdump(&gvar.video.page[0]); IN_UserInput(1, &gvar); } \\r
if(gvar.in.inst->Keyboard[sc_Y]){ dbg_delayanimation=!dbg_delayanimation; IN_UserInput(1, &gvar); } \\r
RFDEBUGFUNCTIONS\r
\r
typedef struct\r
{\r
- char old_mode; //old video mode before game!\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
- byte num_of_pages; //number of actual pages\r
- //doslib origi vars\r
+//doslib origi vars\r
byte far * omemptr;\r
byte vga_draw_stride;\r
byte vga_draw_stride_limit; // further X clipping\r
- //end of doslib origi vars\r
+//end of doslib origi vars\r
boolean __near rss; //render sprite switch\r
boolean __near bgps; //bg preservation render switch between old and new\r
+} vga_state_t;\r
+\r
+typedef struct\r
+{\r
+ char old_mode; //old video mode before game!\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
+ byte num_of_pages; //number of actual pages\r
+ vga_state_t vga_state;\r
sword __near sprifilei; //player file's i\r
nibble __near p; //render page number\r
nibble __near sp; //show page number(for showpage)\r
ofs_t ofs; //offset vars used for doslib\r
word vh; //video combined height\r
//0000word startclk; float clk, tickclk; //timer\r
-//newer vars\r
-//TODO: find out how they are used\r
-// byte grneeded[NUMCHUNKS];\r
} video_t;\r
\r
//from scroll16\r
\r
void VL_Initofs(video_t *video)\r
{\r
- if(!video->bgps)\r
+ if(!video->vga_state.bgps)\r
{\r
video->ofs.offscreen_ofs = video->page[0].pagesize+video->page[1].pagesize;//(vga_state.vga_stride * vga_state.vga_height);\r
video->ofs.pattern_ofs = (uint16_t)video->page[2].data;\r
\r
VL_Initofs(video);\r
//doslib origi var\r
- video->omemptr= vga_state.vga_graphics_ram;\r
- video->vga_draw_stride= vga_state.vga_draw_stride;\r
- video->vga_draw_stride_limit= vga_state.vga_draw_stride_limit;\r
+ video->vga_state.omemptr= vga_state.vga_graphics_ram;\r
+ video->vga_state.vga_draw_stride= vga_state.vga_draw_stride;\r
+ video->vga_state.vga_draw_stride_limit= vga_state.vga_draw_stride_limit;\r
//sprite render switch and bgpreservation switch\r
- video->rss= 1;\r
- video->bgps= 1;\r
+ video->vga_state.rss= 1;\r
+ video->vga_state.bgps= 1;\r
\r
//setup the buffersize\r
video->page[0].dx=video->page[0].dy=\r
// if(id==0)\r
mapDrawCol(&mv[id], mv[0].tx + mv[0].page->ti.tw, mv[0].ty-1, x, player, DRAWCOLNUM);\r
// else\r
-// if(mv[0].video->bgps)\r
+// if(mv[0].video->vga_state.bgps)\r
// modexCopyPageRegion(mv->page, mv[0].page, x, 0, x, 0, mv[0].map->tiles->tileWidth, mv[0].page->height);\r
//mv[0].video->dorender=1;//ScrollRight\r
}\r
// if(id==0)\r
mapDrawCol(&mv[id], mv[0].tx - 1, mv[0].ty-1, x, player, DRAWCOLNUM);\r
// else\r
-// if(mv[0].video->bgps)\r
+// if(mv[0].video->vga_state.bgps)\r
// modexCopyPageRegion(mv->page, mv[0].page, x, 0, x, 0, mv[0].map->tiles->tileWidth, mv[0].page->height);\r
//mv[0].video->dorender=1;//ScrollLeft\r
}\r
// if(id==0)\r
mapDrawRow(&mv[id], mv[0].tx - 1, mv[0].ty-1, y, player, DRAWROWNUM);\r
// else\r
-// if(mv[0].video->bgps)\r
+// if(mv[0].video->vga_state.bgps)\r
// modexCopyPageRegion(mv->page, mv[0].page, 0, y, 0, y, mv[0].page->width, mv[0].map->tiles->tileHeight);\r
//mv[0].video->dorender=1;//ScrollUp\r
}\r
// if(id==0)\r
mapDrawRow(&mv[id], mv[0].tx - 1, mv[0].ty+mv[0].page->ti.th, y, player, DRAWROWNUM);\r
// else\r
-// if(mv[0].video->bgps)\r
+// if(mv[0].video->vga_state.bgps)\r
// modexCopyPageRegion(mv->page, mv[0].page, 0, y, 0, y, mv[0].page->width, mv[0].map->tiles->tileHeight);\r
//mv[0].video->dorender=1;//ScrollDown\r
}\r
\r
void ZC_mapScroll(map_view_t *mv, player_t *player, word pn)\r
{\r
- word b = mv[0].video->bgps;\r
+ word b = mv[0].video->vga_state.bgps;\r
switch(player[pn].enti.d)\r
{\r
case 2://none\r
modexClearRegion(mv[0].page, 0, 0, mv[0].page->width, mv[0].page->height, 0);\r
ZC_mapredraw(mv, tx, ty);\r
\r
- //if(mv[0].video->bgps) modexCopyPageRegion(mv[1].page, mv[0].page, 0, 0, 0, 0, mv[0].page->width, mv[0].page->height);\r
+ //if(mv[0].video->vga_state.bgps) modexCopyPageRegion(mv[1].page, mv[0].page, 0, 0, 0, 0, mv[0].page->width, mv[0].page->height);\r
}\r
\r
void ZC_mapinitMV(map_view_t *mv, int tx, int ty)\r
}\r
}\r
\r
- if(pip[0].video->bgps && dd)//if moving wwww\r
+ if(pip[0].video->vga_state.bgps && dd)//if moving wwww\r
{\r
modexCopyPageRegion(pip[0].page, pip[1].page, x-4, y-4, x-4, y-4, 28, 40);\r
\r
\\r
printf("gvar.video:\n");\\r
printf(" r=%u ", gvar.video.dorender);\\r
- printf("bgps=%u ", gvar.video.bgps);\\r
+ printf("bgps=%u ", gvar.video.vga_state.bgps);\\r
printf("dbg_delayanimation=%u ", dbg_delayanimation);\\r
printf("\n\n");\r
\r
if(IN_KeyDown(sc_F11)){ pagedelayrendermap=!pagedelayrendermap; IN_UserInput(1, &gvar); }\r
if(IN_KeyDown(sc_F10)){ gvar.kurokku.fpscap=!gvar.kurokku.fpscap; IN_UserInput(1, &gvar); }\r
if(IN_KeyDown(sc_F9)){ pagenorendermap=!pagenorendermap; IN_UserInput(1, &gvar); }\r
- if(IN_KeyDown(sc_F8)){ gvar.video.bgps=!gvar.video.bgps; IN_UserInput(1, &gvar); }\r
- if(IN_KeyDown(sc_T)){ gvar.video.rss=!gvar.video.rss; IN_UserInput(1, &gvar); }\r
+ if(IN_KeyDown(sc_F8)){ gvar.video.vga_state.bgps=!gvar.video.vga_state.bgps; IN_UserInput(1, &gvar); }\r
+ if(IN_KeyDown(sc_T)){ gvar.video.vga_state.rss=!gvar.video.vga_state.rss; IN_UserInput(1, &gvar); }\r
*/\r
\r
-extern boolean pagenorendermap, pagedelayrendermap;\r
-\r
extern char global_temp_status_text[512];\r
extern char global_temp_status_text2[512];\r
\r