--- /dev/null
+/* Project 16 Source Code~\r
+ * Copyright (C) 2012-2017 sparky4 & pngwen & andrius4669 & joncampbell123 & yakui-lover\r
+ *\r
+ * This file is part of Project 16.\r
+ *\r
+ * Project 16 is free software; you can redistribute it and/or modify\r
+ * it under the terms of the GNU General Public License as published by\r
+ * the Free Software Foundation; either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ *\r
+ * Project 16 is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program. If not, see <http://www.gnu.org/licenses/>, or\r
+ * write to the Free Software Foundation, Inc., 51 Franklin Street,\r
+ * Fifth Floor, Boston, MA 02110-1301 USA.\r
+ *\r
+ */\r
+\r
+#include <conio.h>\r
+#include <stdio.h>\r
+#include <stdlib.h>\r
+#include "src/lib/16_vl.h"\r
+\r
+// big global status text buffer\r
+char global_temp_status_text[512];\r
+char global_temp_status_text2[512];\r
+\r
+#define PRINTTEXTBOXSTABLE\r
+\r
+void VL_modexPrintTextBox(global_game_variables_t *gvar)\r
+{\r
+#define PRINTTEXTBOXW gvar->video.page[0].width\r
+#define PRINTTEXTBOXH 160\r
+#define PRINTTEXTBOXHLINE 0xCD, 0xCD, 0xCD, 0xCD, 0xCD, 0xCD, 0xCD, 0xCD, 0xCD, 0xCD, 0xCD, 0xCD, 0xCD, 0xCD, 0xCD, 0xCD, 0xCD, 0xCD, 0xCD, 0xCD, 0xCD, 0xCD, 0xCD, 0xCD, 0xCD, 0xCD, 0xCD, 0xCD//, 0xCD, 0xCD, 0xCD, 0xCD\r
+#define PRINTTEXTBOXHLINETOP 0xCD, 0xCD, 0xCD, 0xCD, 0xCD, 0xCD, 0xCD, 0xCD, 0xCB, 0xCD, PRINTTEXTBOXHLINE\r
+#define PRINTTEXTBOXHLINEBOTTOM 0xCD, 0xCD, 0xCD, 0xCD, 0xCD, 0xCD, 0xCD, 0xCD, 0xCA, 0xCD, PRINTTEXTBOXHLINE\r
+#define PRINTTEXTBOXSLINE 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20//, 0x20, 0x20, 0x20, 0x20\r
+#define PRINTTEXTBOXSTRA2CHAR 0x20//07\r
+#define PRINTTEXTBOXSTRA2STR PRINTTEXTBOXSTRA2CHAR, PRINTTEXTBOXSTRA2CHAR, PRINTTEXTBOXSTRA2CHAR, PRINTTEXTBOXSTRA2CHAR, PRINTTEXTBOXSTRA2CHAR, PRINTTEXTBOXSTRA2CHAR, PRINTTEXTBOXSTRA2CHAR, PRINTTEXTBOXSTRA2CHAR\r
+ byte str1[41] = { 0xC9, PRINTTEXTBOXHLINETOP, 0xBB, 0x00 };\r
+#ifdef PRINTTEXTBOXSTABLE\r
+ byte str2[41] = { 0xBA, PRINTTEXTBOXSTRA2STR, 0xBA, PRINTTEXTBOXSLINE, 0xBA, 0x00 };\r
+#else\r
+ byte str2[2] = { 0xBA, 0x00 },\r
+ stra2[7] = { PRINTTEXTBOXSTRA2STR, 0x00 },\r
+ strb2[] = { 0xBA, PRINTTEXTBOXSLINE, 0xBA, 0x00 };\r
+#endif\r
+ byte str3[41] = { 0xC8, PRINTTEXTBOXHLINEBOTTOM, 0xBC, 0x00 };\r
+ word x = gvar->video.page[/*!*/(gvar->video.p)].dx; //(gv->video.page[(gv->video.p)].tlx) - // follow the screen\r
+ word y = gvar->video.page[/*!*/(gvar->video.p)].dy; //(gv->video.page[(gv->video.p)].tly) - // follow the screen\r
+ word col = 3, bgcol = 0, type = 1;//w = 64, h = 8,\r
+ word v = gvar->video.page[0].height-PRINTTEXTBOXH; //vertical offset\r
+ nibble i;\r
+ boolean done;\r
+ ScanCode scan;\r
+#ifndef PRINTTEXTBOXSTABLE\r
+ word q;\r
+#endif\r
+ //backuppart\r
+ modexCopyPageRegion(&gvar->video.page[0], &gvar->video.page[2],\r
+ 0,\r
+ 0,\r
+ x,\r
+ PRINTTEXTBOXH,\r
+ PRINTTEXTBOXW, PRINTTEXTBOXH);\r
+// mxOutText(xpos+1, ypos+gvar.video.page[0].height-40, "| |Chikyuu:$line1");\r
+// mxOutText(xpos+1, ypos+gvar.video.page[0].height-32, "| |$line2");\r
+// mxOutText(xpos+1, ypos+gvar.video.page[0].height-24, "| |$line3");\r
+// mxOutText(xpos+1, ypos+gvar.video.page[0].height-16, "| |$line4");\r
+// mxOutText(xpos+1, ypos+gvar.video.page[0].height-8, "========================================");\r
+\r
+ //modexprint(*page, x, y, type, tlsw, color, bgcolor, sw, *str)\r
+ sprintf(global_temp_status_text, "%s", str1);\r
+ modexprint(&(gvar->video.page[(gvar->video.p)]), x, y+gvar->video.page[0].height-v, type, 1, col, bgcol, 1, global_temp_status_text); v-=8;\r
+#ifdef PRINTTEXTBOXSTABLE\r
+ sprintf(global_temp_status_text, "%s", str2); for(i=0;i<8;i++)\r
+{ modexprint(&(gvar->video.page[(gvar->video.p)]), x, y+gvar->video.page[0].height-v, type, 1, col, bgcol, 1, global_temp_status_text); v-=8; }\r
+#else\r
+ for(i=0;i<8;i++)\r
+ {\r
+ q=0;\r
+ sprintf(global_temp_status_text, "%s", str2); modexprint(&(gvar->video.page[(gvar->video.p)]), x, y+gvar->video.page[0].height-v, type, 1, col, bgcol, 1, global_temp_status_text); q+=8;\r
+ sprintf(global_temp_status_text, "%s", stra2); modexprint(&(gvar->video.page[(gvar->video.p)]), x+q, y+gvar->video.page[0].height-v, type, 1, col, 3, 1, global_temp_status_text); q+=40;\r
+ sprintf(global_temp_status_text, "%s", strb2); modexprint(&(gvar->video.page[(gvar->video.p)]), x+q-8, y+gvar->video.page[0].height-v, type, 1, col, bgcol, 1, global_temp_status_text);\r
+ v-=8;\r
+ }\r
+#endif\r
+ sprintf(global_temp_status_text, "%s", str3);\r
+ modexprint(&(gvar->video.page[(gvar->video.p)]), x, y+gvar->video.page[0].height-v, type, 1, col, bgcol, 1, global_temp_status_text);\r
+ for (i = 0,done = false;!done;)\r
+ {\r
+ while (!(scan = gvar->in.inst->LastScan))\r
+ {}\r
+// SD_Poll();\r
+\r
+ IN_ClearKey(scan);\r
+ switch (scan)\r
+ {\r
+ default:\r
+ case sc_Escape:\r
+ done = true;\r
+ break;\r
+ case sc_Enter:\r
+ //PM_GetPage(i, gvar);\r
+ break;\r
+ }\r
+ }\r
+ modexCopyPageRegion(&gvar->video.page[2], &gvar->video.page[0],\r
+ x,\r
+ PRINTTEXTBOXH,\r
+ 0,\r
+ 0,\r
+ PRINTTEXTBOXW, PRINTTEXTBOXH);\r
+}\r
*/\r
#include "src/lib/scroll16.h"\r
\r
+//check map edge\r
+boolean ZCL_mapEdgeChk(map_view_t *map_v, nibble dir, int tx, int ty, boolean pansw, boolean noscrollsw)\r
+{\r
+ int w,h;\r
+\r
+ switch (pansw)\r
+ {\r
+ case 0:\r
+ w = map_v[0].map->width;\r
+ h = map_v[0].map->height;\r
+ break;\r
+ case 1:\r
+ w = map_v[0].page->ti.tilesw;\r
+ h = map_v[0].page->ti.tilesh;\r
+ break;\r
+ }\r
+\r
+ switch(dir)\r
+ {\r
+ default://no direction\r
+ case 2:\r
+ //0000pip[0].video->startclk = (*clockw);\r
+ return false;\r
+ break;\r
+ //right movement\r
+ case 3:\r
+ if(noscrollsw) return tx < map_v[0].map->width;\r
+ else return (map_v[0].tx >= 0 && map_v[0].tx+map_v[0].page->ti.tw < w);\r
+ break;\r
+ //left movement\r
+ case 1:\r
+ if(noscrollsw) return tx > 1;\r
+ else return (map_v[0].tx > 0 && map_v[0].tx+map_v[0].page->ti.tw <= w);\r
+ break;\r
+ //down movement\r
+ case 4:\r
+ if(noscrollsw) return ty < map_v[0].map->height;\r
+ else return (map_v[0].ty >= 0 && map_v[0].ty+map_v[0].page->ti.th < h);\r
+ break;\r
+ //up movement\r
+ case 0:\r
+ if(noscrollsw) return ty > 1;\r
+ else return (map_v[0].ty > 0 && map_v[0].ty+map_v[0].page->ti.th <= h);\r
+ break;\r
+ }\r
+ return false;\r
+}\r
+\r
+boolean ZCL_CollCheck(map_view_t *map_v, nibble dir, int tx, int ty)\r
+{\r
+ switch (dir)\r
+ {\r
+ default://no direction\r
+ case 2:\r
+ break;\r
+ case 3://right\r
+ return !(map_v[0].map->layerdata[0].data[(tx)+(map_v[0].map->width*(ty-1))] == 0);\r
+ break;\r
+ case 1://left\r
+ return !(map_v[0].map->layerdata[0].data[(tx-2)+(map_v[0].map->width*(ty-1))] == 0);\r
+ break;\r
+ case 4://down\r
+ return !(map_v[0].map->layerdata[0].data[(tx-1)+(map_v[0].map->width*(ty))] == 0);\r
+ break;\r
+ case 0://up\r
+ return !(map_v[0].map->layerdata[0].data[(tx-1)+(map_v[0].map->width*(ty-2))] == 0);\r
+ break;\r
+ }\r
+ return false;\r
+}\r
+\r
+boolean ZCL_ScreenMidPosChk(map_view_t *map_v, nibble dir, int tx, int ty)\r
+{\r
+ if(ZCL_mapEdgeChk(map_v, dir, 0, 0, 0, 0))\r
+ switch(dir)\r
+ {\r
+ default://no direction\r
+ case 2:\r
+ //0000map_v[0].video->startclk = (*clockw);\r
+ return false;\r
+ break;\r
+ //right movement\r
+ case 3:\r
+ return tx == map_v[0].tx+map_v[0].page->ti.tilemidposscreenx;\r
+ break;\r
+ //left movement\r
+ case 1:\r
+ return tx == map_v[0].tx+map_v[0].page->ti.tilemidposscreenx;\r
+ break;\r
+ //down movement\r
+ case 4:\r
+ return ty == map_v[0].ty+map_v[0].page->ti.tilemidposscreeny;\r
+ break;\r
+ //up movement\r
+ case 0:\r
+ return ty == map_v[0].ty+map_v[0].page->ti.tilemidposscreeny;\r
+ break;\r
+ }\r
+ return false;\r
+}\r
+\r
//#define INC_PER_FRAME if(player[pn].enti.q&1) player[pn].enti.persist_aniframe++; if(player[pn].enti.persist_aniframe>4) player[pn].enti.persist_aniframe = 1;\r
+#ifdef OLDWALKSHOWPAGESTUFF\r
+#define SHOWMVFUN__ ZC_ShowMV(pip, 1, 0);\r
+#endif\r
\r
void ZC_walk(map_view_t *pip, player_t *player, word pn)\r
{\r
break;\r
//right movement\r
case 3:\r
- if(ZC_mapEdgeChk(pip, player[pn].enti.d, 0) && player[pn].enti.tx == pip[0].tx+pip[0].page->ti.tilemidposscreenx &&\r
- !(pip[0].map->layerdata[0].data[(player[pn].enti.tx)+(pip[0].map->width*(player[pn].enti.ty-1))] == 0))//!(player[pn].enti.tx+1 == TRIGGX && player[pn].enti.ty == TRIGGY)) //collision detection!\r
+ if(ZCL_ScreenMidPosChk(pip, player[pn].enti.d, player[pn].enti.tx, player[pn].enti.ty) &&\r
+ ZCL_CollCheck(pip, player[pn].enti.d, player[pn].enti.tx, player[pn].enti.ty))//!(player[pn].enti.tx+1 == TRIGGX && player[pn].enti.ty == TRIGGY)) //collision detection!\r
{\r
player[pn].walktype=2;\r
if(player[pn].enti.q<=player[pn].enti.spt)\r
ZC_mapScroll(pip, player, pn);\r
player[pn].enti.q++;\r
//0000pip[0].video->clk = ((*clockw)-pip[0].video->startclk)/18.2;\r
+#ifdef OLDWALKSHOWPAGESTUFF\r
+ SHOWMVFUN__\r
+#endif\r
} else { player[pn].enti.q = 1; player[pn].enti.d = 2; player[pn].enti.tx++; }\r
}\r
- else if(player[pn].enti.tx < pip[0].map->width && !(pip[0].map->layerdata[0].data[(player[pn].enti.tx)+(pip[0].map->width*(player[pn].enti.ty-1))] == 0))//!(player[pn].enti.tx+1 == TRIGGX && player[pn].enti.ty == TRIGGY))\r
+ else if(ZCL_mapEdgeChk(pip, player[pn].enti.d, player[pn].enti.tx, player[pn].enti.ty, 0, 1) &&\r
+ ZCL_CollCheck(pip, player[pn].enti.d, player[pn].enti.tx, player[pn].enti.ty))//!(player[pn].enti.tx+1 == TRIGGX && player[pn].enti.ty == TRIGGY))\r
{\r
player[pn].walktype=1;\r
if(player[pn].enti.q<=player[pn].enti.spt)\r
player[pn].enti.x+=(player[pn].enti.speed);\r
ZC_animatePlayer(pip, player, pn);\r
player[pn].enti.q++;\r
+#ifdef OLDWALKSHOWPAGESTUFF\r
+ SHOWMVFUN__\r
+#endif\r
} else { player[pn].enti.q = 1; player[pn].enti.d = 2; player[pn].enti.tx++; }\r
}\r
else\r
player[pn].walktype=0;\r
ZC_animatePlayer(pip, player, pn);\r
player[pn].enti.d = 2;\r
+#ifdef OLDWALKSHOWPAGESTUFF\r
+ SHOWMVFUN__\r
+#endif\r
}\r
player[pn].enti.triggerx = player[pn].enti.tx+1;\r
player[pn].enti.triggery = player[pn].enti.ty;\r
break;\r
//left movement\r
case 1:\r
- if(ZC_mapEdgeChk(pip, player[pn].enti.d, 0) && player[pn].enti.tx == pip[0].tx+pip[0].page->ti.tilemidposscreenx &&\r
- !(pip[0].map->layerdata[0].data[(player[pn].enti.tx-2)+(pip[0].map->width*(player[pn].enti.ty-1))] == 0))//!(player[pn].enti.tx-1 == TRIGGX && player[pn].enti.ty == TRIGGY)) //collision detection!\r
+ if(ZCL_ScreenMidPosChk(pip, player[pn].enti.d, player[pn].enti.tx, player[pn].enti.ty) &&\r
+ ZCL_CollCheck(pip, player[pn].enti.d, player[pn].enti.tx, player[pn].enti.ty))//!(player[pn].enti.tx-1 == TRIGGX && player[pn].enti.ty == TRIGGY)) //collision detection!\r
{\r
player[pn].walktype=2;\r
if(player[pn].enti.q<=player[pn].enti.spt)\r
ZC_mapScroll(pip, player, pn);\r
player[pn].enti.q++;\r
//0000pip[0].video->clk = ((*clockw)-pip[0].video->startclk)/18.2;\r
+#ifdef OLDWALKSHOWPAGESTUFF\r
+ SHOWMVFUN__\r
+#endif\r
} else { player[pn].enti.q = 1; player[pn].enti.d = 2; player[pn].enti.tx--; }\r
}\r
- else if(player[pn].enti.tx > 1 && !(pip[0].map->layerdata[0].data[(player[pn].enti.tx-2)+(pip[0].map->width*(player[pn].enti.ty-1))] == 0))//!(player[pn].enti.tx-1 == TRIGGX && player[pn].enti.ty == TRIGGY))\r
+ else if(ZCL_mapEdgeChk(pip, player[pn].enti.d, player[pn].enti.tx, player[pn].enti.ty, 0, 1) &&\r
+ ZCL_CollCheck(pip, player[pn].enti.d, player[pn].enti.tx, player[pn].enti.ty))//!(player[pn].enti.tx-1 == TRIGGX && player[pn].enti.ty == TRIGGY))\r
{\r
player[pn].walktype=1;\r
if(player[pn].enti.q<=player[pn].enti.spt)\r
player[pn].enti.x-=(player[pn].enti.speed);\r
ZC_animatePlayer(pip, player, pn);\r
player[pn].enti.q++;\r
+#ifdef OLDWALKSHOWPAGESTUFF\r
+ SHOWMVFUN__\r
+#endif\r
} else { player[pn].enti.q = 1; player[pn].enti.d = 2; player[pn].enti.tx--; }\r
}\r
else\r
player[pn].walktype=0;\r
ZC_animatePlayer(pip, player, pn);\r
player[pn].enti.d = 2;\r
+#ifdef OLDWALKSHOWPAGESTUFF\r
+ SHOWMVFUN__\r
+#endif\r
}\r
player[pn].enti.triggerx = player[pn].enti.tx-1;\r
player[pn].enti.triggery = player[pn].enti.ty;\r
break;\r
//down movement\r
case 4:\r
- if(ZC_mapEdgeChk(pip, player[pn].enti.d, 0) && player[pn].enti.ty == pip[0].ty+pip[0].page->ti.tilemidposscreeny &&\r
- !(pip[0].map->layerdata[0].data[(player[pn].enti.tx-1)+(pip[0].map->width*(player[pn].enti.ty))] == 0))//!(player[pn].enti.tx == TRIGGX && player[pn].enti.ty+1 == TRIGGY)) //collision detection!\r
+ if(ZCL_ScreenMidPosChk(pip, player[pn].enti.d, player[pn].enti.tx, player[pn].enti.ty) &&\r
+ ZCL_CollCheck(pip, player[pn].enti.d, player[pn].enti.tx, player[pn].enti.ty))//!(player[pn].enti.tx == TRIGGX && player[pn].enti.ty+1 == TRIGGY)) //collision detection!\r
{\r
player[pn].walktype=2;\r
if(player[pn].enti.q<=player[pn].enti.spt)\r
ZC_mapScroll(pip, player, pn);\r
player[pn].enti.q++;\r
//0000pip[0].video->clk = ((*clockw)-pip[0].video->startclk)/18.2;\r
+#ifdef OLDWALKSHOWPAGESTUFF\r
+ SHOWMVFUN__\r
+#endif\r
} else { player[pn].enti.q = 1; player[pn].enti.d = 2; player[pn].enti.ty++; }\r
}\r
- else if(player[pn].enti.ty < pip[0].map->height && !(pip[0].map->layerdata[0].data[(player[pn].enti.tx-1)+(pip[0].map->width*(player[pn].enti.ty))] == 0))//!(player[pn].enti.tx == TRIGGX && player[pn].enti.ty+1 == TRIGGY))\r
+ else if(ZCL_mapEdgeChk(pip, player[pn].enti.d, player[pn].enti.tx, player[pn].enti.ty, 0, 1) &&\r
+ ZCL_CollCheck(pip, player[pn].enti.d, player[pn].enti.tx, player[pn].enti.ty))//!(player[pn].enti.tx == TRIGGX && player[pn].enti.ty+1 == TRIGGY))\r
{\r
player[pn].walktype=1;\r
if(player[pn].enti.q<=player[pn].enti.spt)\r
player[pn].enti.y+=(player[pn].enti.speed);\r
ZC_animatePlayer(pip, player, pn);\r
player[pn].enti.q++;\r
+#ifdef OLDWALKSHOWPAGESTUFF\r
+ SHOWMVFUN__\r
+#endif\r
} else { player[pn].enti.q = 1; player[pn].enti.d = 2; player[pn].enti.ty++; }\r
}\r
else\r
player[pn].walktype=0;\r
ZC_animatePlayer(pip, player, pn);\r
player[pn].enti.d = 2;\r
+#ifdef OLDWALKSHOWPAGESTUFF\r
+ SHOWMVFUN__\r
+#endif\r
}\r
player[pn].enti.triggerx = player[pn].enti.tx;\r
player[pn].enti.triggery = player[pn].enti.ty+1;\r
break;\r
//up movement\r
case 0:\r
- if(ZC_mapEdgeChk(pip, player[pn].enti.d, 0) && player[pn].enti.ty == pip[0].ty+pip[0].page->ti.tilemidposscreeny &&\r
- !(pip[0].map->layerdata[0].data[(player[pn].enti.tx-1)+(pip[0].map->width*(player[pn].enti.ty-2))] == 0))//!(player[pn].enti.tx == TRIGGX && player[pn].enti.ty-1 == TRIGGY)) //collision detection!\r
+ if(ZCL_ScreenMidPosChk(pip, player[pn].enti.d, player[pn].enti.tx, player[pn].enti.ty) &&\r
+ ZCL_CollCheck(pip, player[pn].enti.d, player[pn].enti.tx, player[pn].enti.ty))//!(player[pn].enti.tx == TRIGGX && player[pn].enti.ty-1 == TRIGGY)) //collision detection!\r
{\r
player[pn].walktype=2;\r
if(player[pn].enti.q<=player[pn].enti.spt)\r
ZC_mapScroll(pip, player, pn);\r
player[pn].enti.q++;\r
//0000pip[0].video->clk = ((*clockw)-pip[0].video->startclk)/18.2;\r
+#ifdef OLDWALKSHOWPAGESTUFF\r
+ SHOWMVFUN__\r
+#endif\r
} else { player[pn].enti.q = 1; player[pn].enti.d = 2; player[pn].enti.ty--; }\r
}\r
- else if(player[pn].enti.ty > 1 && !(pip[0].map->layerdata[0].data[(player[pn].enti.tx-1)+(pip[0].map->width*(player[pn].enti.ty-2))] == 0))//!(player[pn].enti.tx == TRIGGX && player[pn].enti.ty-1 == TRIGGY))\r
+ else if(ZCL_mapEdgeChk(pip, player[pn].enti.d, player[pn].enti.tx, player[pn].enti.ty, 0, 1) &&\r
+ ZCL_CollCheck(pip, player[pn].enti.d, player[pn].enti.tx, player[pn].enti.ty))//!(player[pn].enti.tx == TRIGGX && player[pn].enti.ty-1 == TRIGGY))\r
{\r
player[pn].walktype=1;\r
if(player[pn].enti.q<=player[pn].enti.spt)\r
player[pn].enti.y-=(player[pn].enti.speed);\r
ZC_animatePlayer(pip, player, pn);\r
player[pn].enti.q++;\r
+#ifdef OLDWALKSHOWPAGESTUFF\r
+ SHOWMVFUN__\r
+#endif\r
} else { player[pn].enti.q = 1; player[pn].enti.d = 2; player[pn].enti.ty--; }\r
}\r
else\r
player[pn].walktype=0;\r
ZC_animatePlayer(pip, player, pn);\r
player[pn].enti.d = 2;\r
+#ifdef OLDWALKSHOWPAGESTUFF\r
+ SHOWMVFUN__\r
+#endif\r
}\r
player[pn].enti.triggerx = player[pn].enti.tx;\r
player[pn].enti.triggery = player[pn].enti.ty-1;\r
{\r
//right movement\r
case 3:\r
- if(ZC_mapEdgeChk(pip, player[pn].enti.d, 1))\r
+ if(ZCL_mapEdgeChk(pip, player[pn].enti.d, player[pn].enti.tx, player[pn].enti.ty, 1, 0))\r
{\r
if(player[pn].enti.q<=player[pn].enti.spt)\r
{\r
\r
//left movement\r
case 1:\r
- if(ZC_mapEdgeChk(pip, player[pn].enti.d, 1))\r
+ if(ZCL_mapEdgeChk(pip, player[pn].enti.d, player[pn].enti.tx, player[pn].enti.ty, 1, 0))\r
{\r
if(player[pn].enti.q<=player[pn].enti.spt)\r
{\r
\r
//down movement\r
case 4:\r
- if(ZC_mapEdgeChk(pip, player[pn].enti.d, 1))\r
+ if(ZCL_mapEdgeChk(pip, player[pn].enti.d, player[pn].enti.tx, player[pn].enti.ty, 1, 0))\r
{\r
if(player[pn].enti.q<=player[pn].enti.spt)\r
{\r
\r
//up movement\r
case 0:\r
- if(ZC_mapEdgeChk(pip, player[pn].enti.d, 1))\r
+ if(ZCL_mapEdgeChk(pip, player[pn].enti.d, player[pn].enti.tx, player[pn].enti.ty, 1, 0))\r
{\r
if(player[pn].enti.q<=player[pn].enti.spt)\r
{\r
#define ZC_MVI 1\r
nibble i;\r
// 1st page\r
- pip[0].page = &gv->video.page[0];\r
- pip[0].map = map;\r
- pip[0].video = &gv->video;\r
- pip[0].p = &gv->video.p;\r
- pip[0].sp = &gv->video.sp;\r
+ pip[0].page = &gv->video.page[0];\r
+ pip[0].map = map;\r
+ pip[0].video = &gv->video;\r
+ pip[0].kurokku = &gv->kurokku;\r
+ pip[0].p = &gv->video.p;\r
+ pip[0].sp = &gv->video.sp;\r
ZC_MVInit(pip, 1, 1);\r
\r
for(i=ZC_MVI;i<gv->video.num_of_pages;i++)\r
\r
void ZC_ShowMV(map_view_t *moo, boolean vsync, boolean sr)\r
{\r
- word high_address, low_address, offset;\r
- byte crtcOffset;\r
-\r
- // calculate offset\r
- offset = (word) moo[moo[0].video->sp].page->data;\r
- offset += moo[0].page->dy * (moo[0].page->width >> 2 );\r
- offset += moo[0].page->dx >> 2;\r
-\r
- // calculate crtcOffset according to virtual width\r
- switch(sr)\r
- {\r
- case 1:\r
- crtcOffset = moo[moo[0].video->sp].page->sw >> 3;\r
- break;\r
- default:\r
- case 0:\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
- vga_state.vga_draw_stride_limit = vga_state.vga_draw_stride = moo[0].page->stridew;\r
+ VL_ShowPage(moo[0].page, vsync, sr);\r
}\r
\r
#if 0\r
\r
/* draw the next column */\r
x= mv[0].page->sw + mv[0].map->tiles->tileWidth;\r
- if(ZC_mapEdgeChk(mv, player[plid].enti.d, 0))\r
+ if(ZCL_mapEdgeChk(mv, player[plid].enti.d, player[plid].enti.tx, player[plid].enti.ty, 0, 0))\r
#ifndef FULLRCREND\r
if(player[plid].enti.q%4)\r
#else\r
\r
/* draw the next column */\r
x= 0;\r
- if(ZC_mapEdgeChk(mv, player[plid].enti.d, 0))\r
+ if(ZCL_mapEdgeChk(mv, player[plid].enti.d, player[plid].enti.tx, player[plid].enti.ty, 0, 0))\r
#ifndef FULLRCREND\r
if(player[plid].enti.q%4)\r
#else\r
\r
/* draw the next row */\r
y= 0;\r
- if(ZC_mapEdgeChk(mv, player[plid].enti.d, 0))\r
+ if(ZCL_mapEdgeChk(mv, player[plid].enti.d, player[plid].enti.tx, player[plid].enti.ty, 0, 0))\r
#ifndef FULLRCREND\r
if(player[plid].enti.q%3)\r
#else\r
\r
/* draw the next row */\r
y= mv[0].page->sh + mv[0].map->tiles->tileHeight;\r
- if(ZC_mapEdgeChk(mv, player[plid].enti.d, 0))\r
+ if(ZCL_mapEdgeChk(mv, player[plid].enti.d, player[plid].enti.tx, player[plid].enti.ty, 0, 0))\r
#ifndef FULLRCREND\r
if(player[plid].enti.q%3)\r
#else\r
}else //copy dat sheet\r
gv->kurokku.tiku++;\r
\r
- switch(gv->kurokku.fpscap)\r
- {\r
- case 0: //turn this off if XT\r
- //modexprint(&(gv->video.page[0]), x, y+8, type, 1, col, bgcol, "sanic!");\r
- gv->kurokku.frames_per_second=1;\r
- break;\r
- case 1:\r
- //modexWaitBorder();\r
- //modexWaitBorder_start();\r
- //vga_wait_for_vsync();\r
- vga_wait_for_vsync_end();\r
- gv->kurokku.frames_per_second=60;\r
- break;\r
- }\r
//render!!\r
- if(gv->video.dorender )\r
+ if(gv->video.dorender)\r
{//r=1\r
/*if(video->bgp s)\r
{\r
}else{\r
//modexCopyPageRegion(&video->page[0], &video->page[1], enti->x, enti->y, 0, 0, 24, 32);\r
}*/\r
+#ifndef OLDWALKSHOWPAGESTUFF\r
VL_ShowPage(&(gv->video.page[gv->video.sp]), gv->kurokku.fpscap, 0);\r
+#endif\r
gv->video.dorender =!gv->video.dorender;\r
//0000gv->video.tickclk = ((*clockw)-gv->video.startclk)/18.2;\r
}\r
+\r
+ switch(gv->kurokku.fpscap)\r
+ {\r
+ case 0: //turn this off if XT\r
+ //modexprint(&(gv->video.page[0]), x, y+8, type, 1, col, bgcol, "sanic!");\r
+ gv->kurokku.frames_per_second=1;\r
+ break;\r
+ case 1:\r
+#ifdef OLDWALKSHOWPAGESTUFF\r
+ //modexWaitBorder();\r
+ //modexWaitBorder_start();\r
+#else\r
+ vga_wait_for_vsync();\r
+ //vga_wait_for_vsync_end();\r
+#endif\r
+ gv->kurokku.frames_per_second=60;\r
+ break;\r
+ }\r
PM_NextFrame(gv);\r
}\r
\r
* end\r
*/\r
\r
+\r
+\r
void mapScroll(map_view_t *mv, player_t *player)\r
{\r
//word x, y; /* coordinate for drawing */\r