#define FILENAME_1 "data/spri/chikyuu.vrl"\r
#define FILENAME_2 "data/spri/chikyuu.pal"\r
\r
-//#define PATTERN\r
+#define PATTERN\r
#define INITTNUM 1\r
\r
static unsigned char palette[768];\r
player[0].q = 1; player[0].d = 2;\r
x=y=0;\r
xdir=ydir=1;\r
+ TESTBG;\r
+ DRAWCORNERBOXES;\r
} //R\r
FUNCTIONKEYFUNCTIONS0EXE;\r
\r
outp(AC_INDEX, (page->dx & 0x03) << 1);\r
}\r
\r
+void\r
+modexShowPageVsync(page_t *page) {\r
+ word high_address, low_address, offset;\r
+ byte crtcOffset;\r
+\r
+ /* calculate offset */\r
+ offset = (word) page->data;\r
+ offset += page->dy * (page->width >> 2 );\r
+ offset += page->dx >> 2;\r
+\r
+ /* calculate crtcOffset according to virtual width */\r
+ crtcOffset = page->width >> 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->dx & 0x03) << 1);\r
+}\r
+\r
void\r
modexPanPage(page_t *page, int dx, int dy) {\r
page->dx = dx;\r
void modexHiganbanaPageSetup(video_t *video);\r
void modexShowPage(page_t *page);\r
void modexShowPage_(page_t *page);\r
+void modexShowPageVsync(page_t *page);\r
void modexPanPage(page_t *page, int dx, int dy);\r
void modexSelectPlane(byte plane);\r
void modexClearRegion(page_t *page, int x, int y, int w, int h, byte color);\r
}\r
\r
//panning page\r
-void panpagemanual(map_view_t *pip, player_t *player, word pn)\r
+void panPageManual(map_view_t *pip, player_t *player, word pn)\r
{\r
switch(player[pn].d)\r
{\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
+//panning vmem\r
+void panVmemManual(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[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
+ {\r
+ if(player[pn].q<=player[pn].spt)\r
+ {\r
+ pip[pip[0].pan->pn].page->dx+=4;\r
+ modexShowPageVsync(pip[pip[0].pan->pn].page);\r
+ player[pn].q++;\r
+ } else { player[pn].q = 1; player[pn].d = 2; pip[pip[0].pan->pn].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
+ {\r
+ if(player[pn].q<=player[pn].spt)\r
+ {\r
+ pip[pip[0].pan->pn].page->dx-=4;\r
+ modexShowPageVsync(pip[pip[0].pan->pn].page);\r
+ player[pn].q++;\r
+ } else { player[pn].q = 1; player[pn].d = 2; pip[pip[0].pan->pn].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+pip[pip[1].pan->pn].page->tilesh+pip[pip[2].pan->pn].page->tilesh+pip[pip[3].pan->pn].page->tilesh)\r
+ {\r
+ if(player[pn].q<=player[pn].spt)\r
+ {\r
+ pip[pip[0].pan->pn].page->dy+=4;\r
+ modexShowPageVsync(pip[pip[0].pan->pn].page);\r
+ player[pn].q++;\r
+ } else { player[pn].q = 1; player[pn].d = 2; pip[pip[0].pan->pn].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+pip[pip[1].pan->pn].page->tilesh+pip[pip[2].pan->pn].page->tilesh+pip[pip[3].pan->pn].page->tilesh)\r
+ {\r
+ if(player[pn].q<=player[pn].spt)\r
+ {\r
+ pip[pip[0].pan->pn].page->dy-=4;\r
+ modexShowPageVsync(pip[pip[0].pan->pn].page);\r
+ player[pn].q++;\r
+ } else { player[pn].q = 1; player[pn].d = 2; pip[pip[0].pan->pn].ty--; }\r
+ }\r
+ break;\r
+ }\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
/*map_t\r
allocMap(int w, int h) {\r
map_t result;\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 panPageManual(map_view_t *pip, player_t *player, word pn);\r
+void panVmemManual(map_view_t *pip, player_t *player, word pn);\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
if(!panswitch){\r
walk(mv, &player, 0);\r
}else{\r
- panpagemanual(mv, &player, 0);\r
+ 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
#include <hw/vga/vga.h>\r
#include <hw/vga/vrl.h>\r
\r
+//panPageManual(mv, player, 0);\r
#define PANKEY0EXE \\r
- panpagemanual(mv, player, 0); \\r
+ panVmemManual(mv, player, 0); \\r
if(IN_KeyDown(1+1)){ pan.pn=0; modexShowPage(&(gvar.video.page[pan.pn])); } \\r
if(IN_KeyDown(2+1)){ pan.pn=1; modexShowPage(&(gvar.video.page[pan.pn])); } \\r
if(IN_KeyDown(3+1)){ pan.pn=2; modexShowPage(&(gvar.video.page[pan.pn])); } \\r