/* setup camera and screen~ */\r
modexHiganbanaPageSetup(&gvar.video);\r
ZC_MVSetup(&mv, &map, &pan, &gvar);\r
- VL_ShowPage(&(gvar.video.page[pan.pn]), 0, 0);\r
+ //VL_ShowPage(&(gvar.video.page[pan.pn]), 0, 0);\r
+ ZC_ShowMV(&mv, 0, 0);\r
\r
//DRAWCORNERBOXES;\r
\r
{\r
IN_ReadControl(0,&player);\r
if(IN_KeyDown(68)){ gvar.kurokku.fpscap=!gvar.kurokku.fpscap; IN_UserInput(1,1); } //f10\r
- PANKEY0EXE;\r
+ PANKEYFUN;\r
if(IN_KeyDown(sc_Space)) //space\r
{\r
anim=!anim;\r
\r
//===========================================================================//\r
\r
- modexShowPage(&(gvar.video.page[0]));\r
+ //modexShowPage(&(gvar.video.page[0]));\r
+ ZC_ShowMV(&mv, 0, 0);\r
if(!noanim) {\r
/* another handy "demo" effect using VGA write mode 1.\r
* we can take what's on screen and vertically squash it like an old analog TV set turning off. */\r
#include "src/lib/16_in.h"\r
\r
#define FUNCTIONKEYFUNCTIONS \\r
- if(IN_KeyDown(sc_F6)){ modexShowPage(&gvar.video.page[0]); IN_UserInput(1,1); } \\r
- if(IN_KeyDown(sc_F7)){ modexShowPage_(&gvar.video.page[0]); IN_UserInput(1,1); }\r
+ if(IN_KeyDown(sc_F6)){ VL_ShowPage(&gvar.video.page[0], 0, 0); IN_UserInput(1,1); } \\r
+ if(IN_KeyDown(sc_F7)){ VL_ShowPage(&gvar.video.page[0], 0, 1); IN_UserInput(1,1); }\r
#define FUNCTIONKEYFUNCTIONS0EXE \\r
- if(IN_KeyDown(sc_F6)){ modexShowPage(&gvar.video.page[pan.pn]); IN_UserInput(1,1); } \\r
- if(IN_KeyDown(sc_F7)){ modexShowPage_(&gvar.video.page[pan.pn]); IN_UserInput(1,1); }\r
+ if(IN_KeyDown(sc_F6)){ VL_ShowPage(&gvar.video.page[pan.pn], 0, 0); IN_UserInput(1,1); } \\r
+ if(IN_KeyDown(sc_F7)){ VL_ShowPage(&gvar.video.page[pan.pn], 0, 1); IN_UserInput(1,1); }\r
\r
void DebugMemory_(global_game_variables_t *gvar, boolean q);\r
void Shutdown16(global_game_variables_t *gvar);\r
outp(AC_INDEX, (page[0].dx & 0x03) << 1);\r
}\r
\r
-//\r
-// testing version of void modexShowPage()\r
-//\r
-void\r
-modexShowPage_(page_t *page)\r
-{\r
- word high_address, low_address, offset;\r
- byte crtcOffset;\r
-\r
- /* calculate offset */\r
- offset = (word) page->data;\r
- offset += page[0].dy * (page->width >> 2 );\r
- offset += page[0].dx >> 2;\r
-\r
- /* calculate crtcOffset according to virtual width */\r
- crtcOffset = page->sw >> 3;\r
-\r
- high_address = HIGH_ADDRESS | (offset & 0xff00);\r
- low_address = LOW_ADDRESS | (offset << 8);\r
-\r
- /* wait for appropriate timing and then program CRTC */\r
-//+=+= while ((inp(INPUT_STATUS_1) & DISPLAY_ENABLE));\r
- outpw(CRTC_INDEX, high_address);\r
- outpw(CRTC_INDEX, low_address);\r
- outp(CRTC_INDEX, 0x13);\r
- outp(CRTC_DATA, crtcOffset);\r
-\r
- /* wait for one retrace */\r
-//+=+= while (!(inp(INPUT_STATUS_1) & VRETRACE));\r
-\r
- /* do PEL panning here */\r
- outp(AC_INDEX, 0x33);\r
- outp(AC_INDEX, (page[0].dx & 0x03) << 1);\r
-}\r
-\r
-//yet another variant\r
+//another variant\r
//args: page, vertical sync switch, screen resolution switch, page0 switch\r
void\r
VL_ShowPage(page_t *page, boolean vsync, boolean sr) {\r
void modexCalcVmemRemain(video_t *video);\r
void modexHiganbanaPageSetup(video_t *video);\r
void modexShowPage(page_t *page);\r
-void modexShowPage_(page_t *page);\r
void VL_ShowPage(page_t *page, boolean vsync, boolean sr);\r
void modexPanPage(page_t *page, int dx, int dy);\r
void modexSelectPlane(byte plane);\r
}\r
\r
//panning page\r
-void panPageManual(map_view_t *pip, player_t *player, word pn)\r
+void ZC_panPageManual(map_view_t *pip, player_t *player, word pn)\r
{\r
+#define SHOWMVFUN_ ZC_ShowMV(pip, 0, 0);\r
switch(player[pn].d)\r
{\r
//right movement\r
case 3:\r
- if(pip[pip[0].pan->pn].tx >= 0 && pip[pip[0].pan->pn].tx+pip[pip[0].pan->pn].page->tw < pip[pip[0].pan->pn].page->tilesw)\r
+ if(pip[0].tx >= 0 && pip[0].tx+pip[0].page->tw < pip[0].page->tilesw)\r
{\r
if(player[pn].q<=player[pn].spt)\r
{\r
- pip[pip[0].pan->pn].page[0].dx+=4;\r
- modexShowPage(pip[pip[0].pan->pn].page);\r
+ pip[0].page->dx+=4;\r
+ SHOWMVFUN_;\r
player[pn].q++;\r
- } else { player[pn].q = 1; player[pn].d = 2; pip[pip[0].pan->pn].tx++; }\r
+ } else { player[pn].q = 1; player[pn].d = 2; pip[0].tx++; }\r
}\r
break;\r
\r
//left movement\r
case 1:\r
- if(pip[pip[0].pan->pn].tx > 0 && pip[pip[0].pan->pn].tx+pip[pip[0].pan->pn].page->tw <= pip[pip[0].pan->pn].page->tilesw)\r
+ if(pip[0].tx > 0 && pip[0].tx+pip[0].page->tw <= pip[0].page->tilesw)\r
{\r
if(player[pn].q<=player[pn].spt)\r
{\r
- pip[pip[0].pan->pn].page[0].dx-=4;\r
- modexShowPage(pip[pip[0].pan->pn].page);\r
+ pip[0].page->dx-=4;\r
+ SHOWMVFUN;\r
player[pn].q++;\r
- } else { player[pn].q = 1; player[pn].d = 2; pip[pip[0].pan->pn].tx--; }\r
+ } else { player[pn].q = 1; player[pn].d = 2; pip[0].tx--; }\r
}\r
break;\r
\r
//down movement\r
case 4:\r
- if(pip[pip[0].pan->pn].ty >= 0 && pip[pip[0].pan->pn].ty+pip[pip[0].pan->pn].page->th < pip[pip[0].pan->pn].page->tilesh)\r
+ if(pip[0].ty >= 0 && pip[0].ty+pip[0].page->th < pip[0].page->tilesh)\r
{\r
if(player[pn].q<=player[pn].spt)\r
{\r
- pip[pip[0].pan->pn].page[0].dy+=4;\r
- modexShowPage(pip[pip[0].pan->pn].page);\r
+ pip[0].page->dy+=4;\r
+ SHOWMVFUN_;\r
player[pn].q++;\r
- } else { player[pn].q = 1; player[pn].d = 2; pip[pip[0].pan->pn].ty++; }\r
+ } else { player[pn].q = 1; player[pn].d = 2; pip[0].ty++; }\r
}\r
break;\r
\r
//up movement\r
case 0:\r
- if(pip[pip[0].pan->pn].ty > 0 && pip[pip[0].pan->pn].ty+pip[pip[0].pan->pn].page->th <= pip[pip[0].pan->pn].page->tilesh)\r
+ if(pip[0].ty > 0 && pip[0].ty+pip[0].page->th <= pip[0].page->tilesh)\r
{\r
if(player[pn].q<=player[pn].spt)\r
{\r
- pip[pip[0].pan->pn].page[0].dy-=4;\r
- modexShowPage(pip[pip[0].pan->pn].page);\r
+ pip[0].page->dy-=4;\r
+ SHOWMVFUN_;\r
player[pn].q++;\r
- } else { player[pn].q = 1; player[pn].d = 2; pip[pip[0].pan->pn].ty--; }\r
+ } else { player[pn].q = 1; player[pn].d = 2; pip[0].ty--; }\r
}\r
break;\r
}\r
- //ZC_MVSync(pip);//&(pip[pip[0].pan->pn]));\r
- //if (player[pn].d!=2) printf("player[%u].d=%u player[%u].q=%u\n", pn, player[pn].d, pn, player[pn].q);\r
}\r
\r
/*\r
//pip[0].ty = pip[1].ty = ty;\r
}\r
\r
-void\r
-ZC_MVSync(map_view_t *pip)\r
+void ZC_ShowMV(map_view_t *moo, boolean vsync, boolean sr)\r
{\r
- //printf("0 dx=%d %d dy=%d %d\n", pip->dx, pip[!pip[0].pan->pn].dx, pip->dy, pip[!pip[0].pan->pn].dy);\r
- //printf("1 dx=%d %d dy=%d %d\n", pip[1].dx, pip[pip[0].pan->pn].dx, pip[1].dy, pip[pip[0].pan->pn].dy);\r
- pip[!pip[0].pan->pn].dx = pip[pip[0].pan->pn].dx;// = pip[pip[0].pan->pn].tx*TILEWH;\r
- pip[!pip[0].pan->pn].dy = pip[pip[0].pan->pn].dy;// = pip[pip[0].pan->pn].ty*TILEWH;\r
-}\r
+ word high_address, low_address, offset;\r
+ byte crtcOffset;\r
\r
-void ZC_panPageManual(map_view_t *pip, player_t *player, word pn)\r
-{\r
- switch(player[pn].d)\r
- {\r
- //right movement\r
- case 3:\r
- if(pip[0].tx >= 0 && pip[0].tx+pip[0].page->tw < pip[0].page->tilesw)\r
- {\r
- if(player[pn].q<=player[pn].spt)\r
- {\r
- pip[0].page->dx+=4;\r
- //modexShowPage(pip[0].page);\r
- VL_ShowPage(&(pip->video->page[pip[0].pan->pn]), 0, 0);\r
- player[pn].q++;\r
- } else { player[pn].q = 1; player[pn].d = 2; pip[0].tx++; }\r
- }\r
- break;\r
+ /* calculate offset */\r
+ offset = (word) moo[moo[0].pan->pn].page->data;\r
+ offset += moo[0].page->dy * (moo[0].page->width >> 2 );\r
+ offset += moo[0].page->dx >> 2;\r
\r
- //left movement\r
+ /* calculate crtcOffset according to virtual width */\r
+ switch(sr)\r
+ {\r
case 1:\r
- if(pip[0].tx > 0 && pip[0].tx+pip[0].page->tw <= pip[0].page->tilesw)\r
- {\r
- if(player[pn].q<=player[pn].spt)\r
- {\r
- pip[0].page->dx-=4;\r
- //modexShowPage(pip[0].page);\r
- VL_ShowPage(&(pip->video->page[pip[0].pan->pn]), 0, 0);\r
- player[pn].q++;\r
- } else { player[pn].q = 1; player[pn].d = 2; pip[0].tx--; }\r
- }\r
+ crtcOffset = moo[0].page->sw >> 3;\r
break;\r
-\r
- //down movement\r
- case 4:\r
- if(pip[0].ty >= 0 && pip[0].ty+pip[0].page->th < pip[0].page->tilesh)\r
- {\r
- if(player[pn].q<=player[pn].spt)\r
- {\r
- pip[0].page->dy+=4;\r
- //modexShowPage(pip[0].page);\r
- VL_ShowPage(&(pip->video->page[pip[0].pan->pn]), 0, 0);\r
- player[pn].q++;\r
- } else { player[pn].q = 1; player[pn].d = 2; pip[0].ty++; }\r
- }\r
- break;\r
-\r
- //up movement\r
+ default:\r
case 0:\r
- if(pip[0].ty > 0 && pip[0].ty+pip[0].page->th <= pip[0].page->tilesh)\r
- {\r
- if(player[pn].q<=player[pn].spt)\r
- {\r
- pip[0].page->dy-=4;\r
- //modexShowPage(pip[0].page);\r
- VL_ShowPage(&(pip->video->page[pip[0].pan->pn]), 0, 0);\r
- player[pn].q++;\r
- } else { player[pn].q = 1; player[pn].d = 2; pip[0].ty--; }\r
- }\r
+ crtcOffset = moo[0].page->width >> 3;\r
break;\r
}\r
+\r
+ high_address = HIGH_ADDRESS | (offset & 0xff00);\r
+ low_address = LOW_ADDRESS | (offset << 8);\r
+\r
+ /* wait for appropriate timing and then program CRTC */\r
+ if(vsync) while ((inp(INPUT_STATUS_1) & DISPLAY_ENABLE));\r
+ outpw(CRTC_INDEX, high_address);\r
+ outpw(CRTC_INDEX, low_address);\r
+ outp(CRTC_INDEX, 0x13);\r
+ outp(CRTC_DATA, crtcOffset);\r
+\r
+ /* wait for one retrace */\r
+ if(vsync) while (!(inp(INPUT_STATUS_1) & VRETRACE));\r
+\r
+ /* do PEL panning here */\r
+ outp(AC_INDEX, 0x33);\r
+ outp(AC_INDEX, (moo[0].page->dx & 0x03) << 1);\r
}\r
\r
/*map_t\r
printf("pageflipflop=%u\n", pageflipflop);\\r
printf("\n");\r
\r
+#define SHOWMVFUN ZC_ShowMV(&mv, 0, 0);\r
+#define PANKEYFUN \\r
+ ZC_panPageManual(&mv, &player, 0); \\r
+ if(IN_KeyDown(1+1) || IN_KeyDown(sc_Z)){ pan.pn=0; SHOWMVFUN; } \\r
+ if(IN_KeyDown(2+1) || IN_KeyDown(sc_X)){ pan.pn=1; SHOWMVFUN; } \\r
+ if(IN_KeyDown(3+1) || IN_KeyDown(sc_C)){ pan.pn=2; SHOWMVFUN; if(IN_KeyDown(sc_C)) modexClearRegion(&gvar.video.page[2], 0, 0, gvar.video.page[2].sw, gvar.video.page[2].sh, 47); } \\r
+ if(IN_KeyDown(4+1) || IN_KeyDown(sc_V)){ pan.pn=3; SHOWMVFUN; if(IN_KeyDown(sc_V)) modexClearRegion(&gvar.video.page[3], 0, 0, gvar.video.page[3].sw, gvar.video.page[3].sh, 45); } \\r
+ if(IN_KeyDown(25)){ modexpdump(mv[1].page); modexShowPage(&(gvar.video.page[1])); IN_UserInput(1,1); }\r
+\r
extern boolean pageflipflop, pageploop;\r
extern unsigned char shinku_fps_indicator_page;\r
\r
//map_t allocMap(int w, int h);\r
//void initMap(map_t *map);\r
void walk(map_view_t *pip, player_t *player, word pn);\r
-void panPageManual(map_view_t *pip, player_t *player, word pn);\r
+void ZC_panPageManual(map_view_t *pip, player_t *player, word pn);\r
void ZC_MVSetup(map_view_t *pip, map_t *map, pan_t *pan, global_game_variables_t *gv);\r
void ZC_MVInit(map_view_t *pip, int tx, int ty);\r
-void ZC_MVSync(map_view_t *pip);\r
-void ZC_panPageManual(map_view_t *pip, player_t *player, word pn);\r
+void ZC_ShowMV(map_view_t *moo, boolean vsync, boolean sr);\r
void near mapScrollRight(map_view_t *mv, player_t *player, word id, word plid);\r
void near mapScrollLeft(map_view_t *mv, player_t *player, word id, word plid);\r
void near mapScrollUp(map_view_t *mv, player_t *player, word id, word plid);\r
\r
/* set up paging */\r
//TODO: LOAD map data and position the map in the middle of the screen if smaller then screen\r
- mapGoTo(mv, 0, 0);\r
+ mapGoTo(&mv, 0, 0);\r
//_fmemcpy(mv[1].page->data, mv[0].page->data, mv[0].page->pagesize);\r
\r
playerXYpos(0, 0, &player, &mv, 0);\r
#endif\r
\r
if(!pageflipflop) VL_ShowPage(mv[1].page, 0, 0);//modexShowPage(mv[1].page);\r
- else VL_ShowPage(mv[0].page, 0, 0);//modexShowPage(mv[0].page);//!(gvar.video.p)\r
+ else ZC_ShowMV(&mv, 0, 0);//modexShowPage(mv[0].page);//!(gvar.video.p)\r
shinku_fps_indicator_page = 0; // we're on page 1 now, shinku(). follow along please or it will not be visible.\r
\r
/* buffer pages */\r
//player movement\r
IN_ReadControl(0, &player);\r
if(!panswitch){\r
- walk(mv, &player, 0);\r
+ walk(&mv, &player, 0);\r
}else{\r
- panPageManual(mv, &player, 0);\r
+ PANKEYFUN;//panPageManual(&mv, &player, 0);\r
//printf(" player[0].q: %d", player[0].q); printf(" player[0].d: %d\n", player[0].d);\r
}\r
\r
}\r
if(player[0].q == (TILEWH/(player[0].speed))+1 && player[0].info.dir != 2 && (player[0].triggerx == 5 && player[0].triggery == 5)){ player[0].hp--; }\r
//debugging binds!\r
- if(IN_KeyDown(2)){ VL_ShowPage(mv[0].page, 0, 0); pan.pn=0; }\r
- if(IN_KeyDown(3)){ VL_ShowPage(mv[1].page, 0, 0); pan.pn=1; }\r
- if(IN_KeyDown(4)){ VL_ShowPage(mv[2].page, 0, 0); pan.pn=2; }\r
- if(IN_KeyDown(4+1)){ VL_ShowPage(mv[3].page, 0, 0); pan.pn=3; }\r
- if(IN_KeyDown(25)){ modexpdump(mv[0].page); modexpdump(mv[1].page);\r
- IN_UserInput(1,1);\r
- } //p\r
#ifdef MODEX\r
#ifdef FADE\r
if(IN_KeyDown(24)){ modexPalUpdate0(gpal); paloffset=0; modexpdump(mv[0].page); modexpdump(mv[1].page); IN_UserInput(1,1); } //p\r
while(!IN_KeyDown(sc_Escape))\r
{\r
IN_ReadControl(0,&player);\r
- ZC_panPageManual(&mv[pan.pn], &player, 0);\r
+ ZC_panPageManual(&mv, &player, 0);\r
+ //[pan.pn]\r
//ZC_MVSync(&mv);\r
\r
/*if(i<5){\r
// modexClearRegion(&gvar.video.page[1], 48, 48, gvar.video.page[1].sw-64, gvar.video.page[1].sh-64, 128);\r
// }\r
//}\r
- if(IN_KeyDown(1+1)){ pan.pn=0; }\r
- if(IN_KeyDown(2+1)){ pan.pn=1; }\r
- if(IN_KeyDown(3+1)){ pan.pn=2; }\r
- if(IN_KeyDown(4+1)){ pan.pn=3; }\r
+ PANKEYFUN;\r
if(IN_KeyDown(12)) modexClearRegion(&gvar.video.page[0], (gvar.video.page[0].width/2)-4, (gvar.video.page[0].height/2)-16, 24, 32, 15);\r
if(IN_KeyDown(13)) modexClearRegion(&gvar.video.page[1], (gvar.video.page[1].width/2)-4, (gvar.video.page[1].height/2)-16, 24, 32, 15);\r
/*==== if(IN_KeyDown(7)){\r
// if(i>PAL_SIZE) i=0;\r
}//9*/\r
if(IN_KeyDown(25)){ modexpdump(&gvar.video.page[pan.pn]); IN_UserInput(1,1); }//p\r
- VL_ShowPage(&gvar.video.page[pan.pn], 0, 0);\r
+ //VL_ShowPage(&gvar.video.page[pan.pn], 0, 0);\r
+ ZC_ShowMV(&mv, 0, 0);\r
}\r
\r
endclk = *clockw;\r
#include <hw/vga/vga.h>\r
#include <hw/vga/vrl.h>\r
\r
-//panVmemManual(mv, player, 0);\r
-\r
-#define SHOWPAGEFUN VL_ShowPage(&(gvar.video.page[pan.pn]), 0, 0)\r
-//modexShowPage(&(gvar.video.page[pan.pn]))\r
-\r
-#define PANKEY0EXE \\r
- panPageManual(&mv, &player, 0); \\r
- if(IN_KeyDown(1+1) || IN_KeyDown(sc_Z)){ pan.pn=0; SHOWPAGEFUN; } \\r
- if(IN_KeyDown(2+1) || IN_KeyDown(sc_X)){ pan.pn=1; SHOWPAGEFUN; } \\r
- if(IN_KeyDown(3+1) || IN_KeyDown(sc_C)){ pan.pn=2; SHOWPAGEFUN; if(IN_KeyDown(sc_C)) modexClearRegion(&gvar.video.page[2], 0, 0, gvar.video.page[2].sw, gvar.video.page[2].sh, 47); } \\r
- if(IN_KeyDown(4+1) || IN_KeyDown(sc_V)){ pan.pn=3; SHOWPAGEFUN; if(IN_KeyDown(sc_V)) modexClearRegion(&gvar.video.page[3], 0, 0, gvar.video.page[3].sw, gvar.video.page[3].sh, 45); } \\r
- if(IN_KeyDown(25)){ modexpdump(mv[1].page); modexShowPage(&(gvar.video.page[1])); IN_UserInput(1,1); }\r
-\r
////corner markers\r
#define GVPO gvar.video.page[0]\r
#define GVPI gvar.video.page[1]\r
\r
VGAmodeX(1, 1, &gvar);\r
modexHiganbanaPageSetup(&gvar.video);\r
- modexShowPage_(&gvar.video.page[0]);\r
+ VL_ShowPage(&gvar.video.page[0], 0, 1);\r
\r
/* non sprite comparison */\r
start = *clockw;\r
if(IN_KeyDown(22)){ modexPalUpdate0(gpal); } //u\r
\r
//pan switch\r
- if(IN_KeyDown(88)){panswitch=!panswitch; IN_UserInput(1,1);} //f12\r
+ //if(IN_KeyDown(88)){panswitch=!panswitch; IN_UserInput(1,1);} //f12\r
if(IN_KeyDown(87)) //f11\r
{\r
pageflipflop=!pageflipflop;\r