\r
#define ANIMATESPRIFUN ZC_animatePlayer\r
\r
-void oldwalk(map_view_t *pip, player_t *player, word pn)\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
+\r
+void ZC_walk(map_view_t *pip, player_t *player, word pn)\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
- //printf("player[%d].d=%d\n", pn, player[pn].enti.d);\r
switch(player[pn].enti.d)\r
{\r
//no direction\r
break;\r
//right movement\r
case 3:\r
- //printf("pip[0].page->tilesw=%d ", pip[0].page->tilesw); printf("pip[0].page->tw=%d\n", pip[0].page->tw);\r
if(pip[0].tx >= 0 && pip[0].tx+pip[0].page->tw < pip[0].map->width && player[pn].enti.tx == pip[0].tx+pip[0].page->tilemidposscreenx &&\r
!(pip[0].map->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
{\r
ANIMATESPRIFUN(pip, player, pn, 1);\r
ScrollRight(pip, player, 3, pn);\r
ScrollRight(pip, player, 2, pn);\r
- //mapScrollRight(pip, player, !(pip[0].video->p), pn);\r
mapScrollRight(pip, player, (pip[0].video->p), pn);\r
- if(!pageflipflop) modexShowPage(pip[1].page);\r
player[pn].enti.q++;\r
//0000pip[0].video->clk = ((*clockw)-pip[0].video->startclk)/18.2;\r
} else { player[pn].enti.q = 1; player[pn].enti.d = 2; player[pn].enti.tx++; }\r
INC_PER_FRAME;\r
player[pn].enti.x+=(player[pn].enti.speed);\r
ANIMATESPRIFUN(pip, player, pn, 0);\r
- if(!pageflipflop) modexShowPage(pip[1].page);\r
player[pn].enti.q++;\r
} else { player[pn].enti.q = 1; player[pn].enti.d = 2; player[pn].enti.tx++; }\r
}\r
else\r
{\r
- if(!pageflipflop) modexCopyPageRegion(pip[1].page, pip[0].page, player[pn].enti.x, player[pn].enti.y-TILEWH, player[pn].enti.x, player[pn].enti.y-TILEWH, 24, 32);\r
-#ifdef SPRITE\r
- modexDrawSpriteRegion(pip[0].page, player[pn].enti.x, player[pn].enti.y-TILEWH, 24, 32, 24, 32, PLAYERBMPDATAPTR);\r
-#else\r
- modexClearRegion(pip[1].page, player[pn].enti.x, player[pn].enti.y-TILEWH, 24, 32, 14);\r
-#endif\r
- if(!pageflipflop) modexShowPage(pip[1].page);\r
+//#ifdef SPRITE\r
+//modexDrawSpriteRegion(pip[0].page, player[pn].enti.x, player[pn].enti.y-TILEWH, 24, 32, 24, 32, PLAYERBMPDATAPTR);\r
+ ANIMATESPRIFUN(pip, player, pn, 0);\r
+//#else\r
+// modexClearRegion(pip[1].page, player[pn].enti.x, player[pn].enti.y-TILEWH, 24, 32, 14);\r
+//#endif\r
player[pn].enti.d = 2;\r
}\r
player[pn].enti.triggerx = player[pn].enti.tx+1;\r
player[pn].enti.triggery = player[pn].enti.ty;\r
break;\r
-\r
//left movement\r
case 1:\r
if(pip[0].tx > 0 && pip[0].tx+pip[0].page->tw <= pip[0].map->width && player[pn].enti.tx == pip[0].tx+pip[0].page->tilemidposscreenx &&\r
ANIMATESPRIFUN(pip, player, pn, 1);\r
ScrollLeft(pip, player, 3, pn);\r
ScrollLeft(pip, player, 2, pn);\r
- //mapScrollLeft(pip, player, !(pip[0].video->p), pn);\r
mapScrollLeft(pip, player, (pip[0].video->p), pn);\r
- if(!pageflipflop) modexShowPage(pip[1].page);\r
player[pn].enti.q++;\r
//0000pip[0].video->clk = ((*clockw)-pip[0].video->startclk)/18.2;\r
} else { player[pn].enti.q = 1; player[pn].enti.d = 2; player[pn].enti.tx--; }\r
INC_PER_FRAME;\r
player[pn].enti.x-=(player[pn].enti.speed);\r
ANIMATESPRIFUN(pip, player, pn, 0);\r
- if(!pageflipflop) modexShowPage(pip[1].page);\r
player[pn].enti.q++;\r
} else { player[pn].enti.q = 1; player[pn].enti.d = 2; player[pn].enti.tx--; }\r
}\r
else\r
{\r
- if(!pageflipflop) modexCopyPageRegion(pip[1].page, pip[0].page, player[pn].enti.x, player[pn].enti.y-TILEWH, player[pn].enti.x, player[pn].enti.y-TILEWH, 24, 32);\r
-#ifdef SPRITE\r
- modexDrawSpriteRegion(pip[0].page, player[pn].enti.x, player[pn].enti.y-TILEWH, 24, 96, 24, 32, PLAYERBMPDATAPTR);\r
-#else\r
- modexClearRegion(pip[1].page, player[pn].enti.x, player[pn].enti.y-TILEWH, 24, 32, 10);\r
-#endif\r
- if(!pageflipflop) modexShowPage(pip[1].page);\r
+//#ifdef SPRITE\r
+//modexDrawSpriteRegion(pip[0].page, player[pn].enti.x, player[pn].enti.y-TILEWH, 24, 96, 24, 32, PLAYERBMPDATAPTR);\r
+ ANIMATESPRIFUN(pip, player, pn, 0);\r
+//#else\r
+// modexClearRegion(pip[1].page, player[pn].enti.x, player[pn].enti.y-TILEWH, 24, 32, 10);\r
+//#endif\r
player[pn].enti.d = 2;\r
}\r
player[pn].enti.triggerx = player[pn].enti.tx-1;\r
player[pn].enti.triggery = player[pn].enti.ty;\r
break;\r
-\r
//down movement\r
case 4:\r
if(pip[0].ty >= 0 && pip[0].ty+pip[0].page->th < pip[0].map->height && player[pn].enti.ty == pip[0].ty+pip[0].page->tilemidposscreeny &&\r
ANIMATESPRIFUN(pip, player, pn, 1);\r
ScrollDown(pip, player, 3, pn);\r
ScrollDown(pip, player, 2, pn);\r
- //mapScrollDown(pip, player, !(pip[0].video->p), pn);\r
mapScrollDown(pip, player, (pip[0].video->p), pn);\r
- if(!pageflipflop) modexShowPage(pip[1].page);\r
player[pn].enti.q++;\r
//0000pip[0].video->clk = ((*clockw)-pip[0].video->startclk)/18.2;\r
} else { player[pn].enti.q = 1; player[pn].enti.d = 2; player[pn].enti.ty++; }\r
INC_PER_FRAME;\r
player[pn].enti.y+=(player[pn].enti.speed);\r
ANIMATESPRIFUN(pip, player, pn, 0);\r
- if(!pageflipflop) modexShowPage(pip[1].page);\r
player[pn].enti.q++;\r
} else { player[pn].enti.q = 1; player[pn].enti.d = 2; player[pn].enti.ty++; }\r
}\r
else\r
{\r
- if(!pageflipflop) modexCopyPageRegion(pip[1].page, pip[0].page, player[pn].enti.x, player[pn].enti.y-TILEWH, player[pn].enti.x, player[pn].enti.y-TILEWH, 24, 32);\r
-#ifdef SPRITE\r
- modexDrawSpriteRegion(pip[0].page, player[pn].enti.x, player[pn].enti.y-TILEWH, 24, 64, 24, 32, PLAYERBMPDATAPTR);\r
-#else\r
- modexClearRegion(pip[1].page, player[pn].enti.x, player[pn].enti.y-TILEWH, 24, 32, 9);\r
-#endif\r
- if(!pageflipflop) modexShowPage(pip[1].page);\r
+//#ifdef SPRITE\r
+//modexDrawSpriteRegion(pip[0].page, player[pn].enti.x, player[pn].enti.y-TILEWH, 24, 64, 24, 32, PLAYERBMPDATAPTR);\r
+ ANIMATESPRIFUN(pip, player, pn, 0);\r
+//#else\r
+// modexClearRegion(pip[1].page, player[pn].enti.x, player[pn].enti.y-TILEWH, 24, 32, 9);\r
+//#endif\r
player[pn].enti.d = 2;\r
}\r
player[pn].enti.triggerx = player[pn].enti.tx;\r
player[pn].enti.triggery = player[pn].enti.ty+1;\r
break;\r
-\r
//up movement\r
case 0:\r
if(pip[0].ty > 0 && pip[0].ty+pip[0].page->th <= pip[0].map->height && player[pn].enti.ty == pip[0].ty+pip[0].page->tilemidposscreeny &&\r
ANIMATESPRIFUN(pip, player, pn, 1);\r
ScrollUp(pip, player, 3, pn);\r
ScrollUp(pip, player, 2, pn);\r
- //mapScrollUp(pip, player, !(pip[0].video->p), pn);\r
mapScrollUp(pip, player, (pip[0].video->p), pn);\r
- if(!pageflipflop) modexShowPage(pip[1].page);\r
player[pn].enti.q++;\r
//0000pip[0].video->clk = ((*clockw)-pip[0].video->startclk)/18.2;\r
} else { player[pn].enti.q = 1; player[pn].enti.d = 2; player[pn].enti.ty--; }\r
INC_PER_FRAME;\r
player[pn].enti.y-=(player[pn].enti.speed);\r
ANIMATESPRIFUN(pip, player, 0, pn);\r
- if(!pageflipflop) modexShowPage(pip[1].page);\r
player[pn].enti.q++;\r
} else { player[pn].enti.q = 1; player[pn].enti.d = 2; player[pn].enti.ty--; }\r
}\r
else\r
{\r
- if(!pageflipflop) modexCopyPageRegion(pip[1].page, pip[0].page, player[pn].enti.x, player[pn].enti.y-TILEWH, player[pn].enti.x, player[pn].enti.y-TILEWH, 24, 32);\r
-#ifdef SPRITE\r
- modexDrawSpriteRegion(pip[0].page, player[pn].enti.x, player[pn].enti.y-TILEWH, 24, 0, 24, 32, PLAYERBMPDATAPTR);\r
-#else\r
- modexClearRegion(pip[1].page, player[pn].enti.x, player[pn].enti.y-TILEWH, 24, 32, 12);\r
-#endif\r
- if(!pageflipflop) modexShowPage(pip[1].page);\r
+//#ifdef SPRITE\r
+//modexDrawSpriteRegion(pip[0].page, player[pn].enti.x, player[pn].enti.y-TILEWH, 24, 0, 24, 32, PLAYERBMPDATAPTR);\r
+ ANIMATESPRIFUN(pip, player, pn, 0);\r
+//#else\r
+// modexClearRegion(pip[1].page, player[pn].enti.x, player[pn].enti.y-TILEWH, 24, 32, 12);\r
+//#endif\r
player[pn].enti.d = 2;\r
}\r
player[pn].enti.triggerx = player[pn].enti.tx;\r
src/lib/scroll16.c: mv->video->r=1;\r
*/\r
\r
-void ZC_walk(map_view_t *pip, player_t *player, word pn)\r
+void oldwalk(map_view_t *pip, player_t *player, word pn)\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
+ //printf("player[%d].d=%d\n", pn, player[pn].enti.d);\r
switch(player[pn].enti.d)\r
{\r
//no direction\r
break;\r
//right movement\r
case 3:\r
+ //printf("pip[0].page->tilesw=%d ", pip[0].page->tilesw); printf("pip[0].page->tw=%d\n", pip[0].page->tw);\r
if(pip[0].tx >= 0 && pip[0].tx+pip[0].page->tw < pip[0].map->width && player[pn].enti.tx == pip[0].tx+pip[0].page->tilemidposscreenx &&\r
!(pip[0].map->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
{\r
ANIMATESPRIFUN(pip, player, pn, 1);\r
ScrollRight(pip, player, 3, pn);\r
ScrollRight(pip, player, 2, pn);\r
+ //mapScrollRight(pip, player, !(pip[0].video->p), pn);\r
mapScrollRight(pip, player, (pip[0].video->p), pn);\r
+ if(!pageflipflop) modexShowPage(pip[1].page);\r
player[pn].enti.q++;\r
//0000pip[0].video->clk = ((*clockw)-pip[0].video->startclk)/18.2;\r
} else { player[pn].enti.q = 1; player[pn].enti.d = 2; player[pn].enti.tx++; }\r
INC_PER_FRAME;\r
player[pn].enti.x+=(player[pn].enti.speed);\r
ANIMATESPRIFUN(pip, player, pn, 0);\r
+ if(!pageflipflop) modexShowPage(pip[1].page);\r
player[pn].enti.q++;\r
} else { player[pn].enti.q = 1; player[pn].enti.d = 2; player[pn].enti.tx++; }\r
}\r
else\r
{\r
+ if(!pageflipflop) modexCopyPageRegion(pip[1].page, pip[0].page, player[pn].enti.x, player[pn].enti.y-TILEWH, player[pn].enti.x, player[pn].enti.y-TILEWH, 24, 32);\r
#ifdef SPRITE\r
modexDrawSpriteRegion(pip[0].page, player[pn].enti.x, player[pn].enti.y-TILEWH, 24, 32, 24, 32, PLAYERBMPDATAPTR);\r
#else\r
modexClearRegion(pip[1].page, player[pn].enti.x, player[pn].enti.y-TILEWH, 24, 32, 14);\r
#endif\r
+ if(!pageflipflop) modexShowPage(pip[1].page);\r
player[pn].enti.d = 2;\r
}\r
player[pn].enti.triggerx = player[pn].enti.tx+1;\r
player[pn].enti.triggery = player[pn].enti.ty;\r
break;\r
+\r
//left movement\r
case 1:\r
if(pip[0].tx > 0 && pip[0].tx+pip[0].page->tw <= pip[0].map->width && player[pn].enti.tx == pip[0].tx+pip[0].page->tilemidposscreenx &&\r
ANIMATESPRIFUN(pip, player, pn, 1);\r
ScrollLeft(pip, player, 3, pn);\r
ScrollLeft(pip, player, 2, pn);\r
+ //mapScrollLeft(pip, player, !(pip[0].video->p), pn);\r
mapScrollLeft(pip, player, (pip[0].video->p), pn);\r
+ if(!pageflipflop) modexShowPage(pip[1].page);\r
player[pn].enti.q++;\r
//0000pip[0].video->clk = ((*clockw)-pip[0].video->startclk)/18.2;\r
} else { player[pn].enti.q = 1; player[pn].enti.d = 2; player[pn].enti.tx--; }\r
INC_PER_FRAME;\r
player[pn].enti.x-=(player[pn].enti.speed);\r
ANIMATESPRIFUN(pip, player, pn, 0);\r
+ if(!pageflipflop) modexShowPage(pip[1].page);\r
player[pn].enti.q++;\r
} else { player[pn].enti.q = 1; player[pn].enti.d = 2; player[pn].enti.tx--; }\r
}\r
else\r
{\r
+ if(!pageflipflop) modexCopyPageRegion(pip[1].page, pip[0].page, player[pn].enti.x, player[pn].enti.y-TILEWH, player[pn].enti.x, player[pn].enti.y-TILEWH, 24, 32);\r
#ifdef SPRITE\r
modexDrawSpriteRegion(pip[0].page, player[pn].enti.x, player[pn].enti.y-TILEWH, 24, 96, 24, 32, PLAYERBMPDATAPTR);\r
#else\r
modexClearRegion(pip[1].page, player[pn].enti.x, player[pn].enti.y-TILEWH, 24, 32, 10);\r
#endif\r
+ if(!pageflipflop) modexShowPage(pip[1].page);\r
player[pn].enti.d = 2;\r
}\r
player[pn].enti.triggerx = player[pn].enti.tx-1;\r
player[pn].enti.triggery = player[pn].enti.ty;\r
break;\r
+\r
//down movement\r
case 4:\r
if(pip[0].ty >= 0 && pip[0].ty+pip[0].page->th < pip[0].map->height && player[pn].enti.ty == pip[0].ty+pip[0].page->tilemidposscreeny &&\r
ANIMATESPRIFUN(pip, player, pn, 1);\r
ScrollDown(pip, player, 3, pn);\r
ScrollDown(pip, player, 2, pn);\r
+ //mapScrollDown(pip, player, !(pip[0].video->p), pn);\r
mapScrollDown(pip, player, (pip[0].video->p), pn);\r
+ if(!pageflipflop) modexShowPage(pip[1].page);\r
player[pn].enti.q++;\r
//0000pip[0].video->clk = ((*clockw)-pip[0].video->startclk)/18.2;\r
} else { player[pn].enti.q = 1; player[pn].enti.d = 2; player[pn].enti.ty++; }\r
INC_PER_FRAME;\r
player[pn].enti.y+=(player[pn].enti.speed);\r
ANIMATESPRIFUN(pip, player, pn, 0);\r
+ if(!pageflipflop) modexShowPage(pip[1].page);\r
player[pn].enti.q++;\r
} else { player[pn].enti.q = 1; player[pn].enti.d = 2; player[pn].enti.ty++; }\r
}\r
else\r
{\r
+ if(!pageflipflop) modexCopyPageRegion(pip[1].page, pip[0].page, player[pn].enti.x, player[pn].enti.y-TILEWH, player[pn].enti.x, player[pn].enti.y-TILEWH, 24, 32);\r
#ifdef SPRITE\r
modexDrawSpriteRegion(pip[0].page, player[pn].enti.x, player[pn].enti.y-TILEWH, 24, 64, 24, 32, PLAYERBMPDATAPTR);\r
#else\r
modexClearRegion(pip[1].page, player[pn].enti.x, player[pn].enti.y-TILEWH, 24, 32, 9);\r
#endif\r
+ if(!pageflipflop) modexShowPage(pip[1].page);\r
player[pn].enti.d = 2;\r
}\r
player[pn].enti.triggerx = player[pn].enti.tx;\r
player[pn].enti.triggery = player[pn].enti.ty+1;\r
break;\r
+\r
//up movement\r
case 0:\r
if(pip[0].ty > 0 && pip[0].ty+pip[0].page->th <= pip[0].map->height && player[pn].enti.ty == pip[0].ty+pip[0].page->tilemidposscreeny &&\r
ANIMATESPRIFUN(pip, player, pn, 1);\r
ScrollUp(pip, player, 3, pn);\r
ScrollUp(pip, player, 2, pn);\r
+ //mapScrollUp(pip, player, !(pip[0].video->p), pn);\r
mapScrollUp(pip, player, (pip[0].video->p), pn);\r
+ if(!pageflipflop) modexShowPage(pip[1].page);\r
player[pn].enti.q++;\r
//0000pip[0].video->clk = ((*clockw)-pip[0].video->startclk)/18.2;\r
} else { player[pn].enti.q = 1; player[pn].enti.d = 2; player[pn].enti.ty--; }\r
INC_PER_FRAME;\r
player[pn].enti.y-=(player[pn].enti.speed);\r
ANIMATESPRIFUN(pip, player, 0, pn);\r
+ if(!pageflipflop) modexShowPage(pip[1].page);\r
player[pn].enti.q++;\r
} else { player[pn].enti.q = 1; player[pn].enti.d = 2; player[pn].enti.ty--; }\r
}\r
else\r
{\r
+ if(!pageflipflop) modexCopyPageRegion(pip[1].page, pip[0].page, player[pn].enti.x, player[pn].enti.y-TILEWH, player[pn].enti.x, player[pn].enti.y-TILEWH, 24, 32);\r
#ifdef SPRITE\r
modexDrawSpriteRegion(pip[0].page, player[pn].enti.x, player[pn].enti.y-TILEWH, 24, 0, 24, 32, PLAYERBMPDATAPTR);\r
#else\r
modexClearRegion(pip[1].page, player[pn].enti.x, player[pn].enti.y-TILEWH, 24, 32, 12);\r
#endif\r
+ if(!pageflipflop) modexShowPage(pip[1].page);\r
player[pn].enti.d = 2;\r
}\r
player[pn].enti.triggerx = player[pn].enti.tx;\r
#define FRAME3 modexDrawSpriteRegion(pip[/*!*/(pip->video->p)].page, x, y, 0, dire, 24, 32, PLAYERBMPDATAPTR);\r
#define FRAME4 modexDrawSpriteRegion(pip[/*!*/(pip->video->p)].page, x, y, 24, dire, 24, 32, PLAYERBMPDATAPTR);\r
#else\r
-#define FRAME1 modexClearRegion(pip[/*!*/(pip->video->p)].page, x, y, 24, 32, 2+dire);\r
-#define FRAME2 modexClearRegion(pip[/*!*/(pip->video->p)].page, x, y, 24, 32, 1+dire);\r
-#define FRAME3 modexClearRegion(pip[/*!*/(pip->video->p)].page, x, y, 24, 32, dire);\r
-#define FRAME4 modexClearRegion(pip[/*!*/(pip->video->p)].page, x, y, 24, 32, 1+dire);\r
+#define FRAME1 modexClearRegion(pip[/*!*/(pip->video->p)].page, x, y, 16, 32, 2+dire);\r
+#define FRAME2 modexClearRegion(pip[/*!*/(pip->video->p)].page, x, y, 16, 32, 1+dire);\r
+#define FRAME3 modexClearRegion(pip[/*!*/(pip->video->p)].page, x, y, 16, 32, dire);\r
+#define FRAME4 modexClearRegion(pip[/*!*/(pip->video->p)].page, x, y, 16, 32, 1+dire);\r
#endif\r
\r
void near animatePlayer(map_view_t *pip, player_t *player, word pn, sword scrollswitch)\r
pip->video->r=1;\r
}\r
\r
-/*\r
-void animate_spri(struct sprite *spri, global_game_variables_t *gv)\r
-{\r
-#define GVARVIDEO gv->video\r
-#define VMEMPAGESIZE2 GVARVIDEO.page[0].pagesize+GVARVIDEO.page[1].pagesize\r
-#define VMEMPAGEDATA2 GVARVIDEO.page[2].data\r
- unsigned int i,o,o2; int j;\r
- int x,y,rx,ry,w,h;\r
- int overdraw = 1; // how many pixels to "overdraw" so that moving sprites with edge pixels don't leave streaks.\r
- // if the sprite's edge pixels are clear anyway, you can set this to 0.\r
- VGA_RAM_PTR omemptr;\r
-\r
- // Events go here\r
\r
-\r
- omemptr = vga_state.vga_graphics_ram; // save original mem ptr\r
- x=spri->x-4;\r
- y=spri->y;\r
-\r
- // Draw sprite\r
- j = get_vrl_by_id(spri->spritesheet, spri->curr_spri_id, spri->sprite_vrl_cont);\r
- if(j < 0)\r
- {\r
- Quit (gv, "Error retriving required sprite");\r
- }\r
-\r
- // render box bounds. y does not need modification, but x and width must be multiple of 4\r
- if (x >= overdraw) rx = (x - overdraw) & (~3);\r
- else rx = -(GVARVIDEO.page[0].dx);\r
- if (y >= overdraw) ry = (y - overdraw);\r
- else ry = -(GVARVIDEO.page[0].dy);\r
- h = spri->sprite_vrl_cont->vrl_header->height + overdraw + y - ry;\r
- w = (x + spri->sprite_vrl_cont->vrl_header->width + (overdraw*2) + 3 - rx) & (~3);//round up\r
- if ((rx+w) > GVARVIDEO.page[0].width) w = GVARVIDEO.page[0].width-rx;\r
- if ((ry+h) > GVARVIDEO.page[0].height) h = GVARVIDEO.page[0].height-ry;\r
-\r
- // block copy pattern to where we will draw the sprite\r
- vga_setup_wm1_block_copy();\r
- o2 = VMEMPAGESIZE2;\r
- o = (0x10000UL - (uint16_t)VMEMPAGEDATA2) + (ry * GVARVIDEO.page[0].stridew) + (rx >> 2); // source offscreen\r
- for (i=0;i < h;i++,o += GVARVIDEO.page[0].stridew,o2 += (w >> 2)) vga_wm1_mem_block_copy(o2,o,w >> 2);\r
-\r
- // must restore Write Mode 0/Read Mode 0 for this code to continue drawing normally\r
- vga_restore_rm0wm0();\r
-\r
- // replace VGA stride with our own and mem ptr. then sprite rendering at this stage is just (0,0)\r
- vga_state.vga_draw_stride_limit = (GVARVIDEO.page[0].width + 3 - x) >> 2;//round up\r
- vga_state.vga_draw_stride = w >> 2;\r
- vga_state.vga_graphics_ram = omemptr + VMEMPAGESIZE2;\r
-\r
- // then the sprite. note modding ram ptr means we just draw to (x&3,0)\r
- draw_vrl1_vgax_modex(\r
- x-rx,\r
- y-ry,\r
- spri->sprite_vrl_cont->vrl_header,\r
- spri->sprite_vrl_cont->line_offsets,\r
- spri->sprite_vrl_cont->buffer + sizeof(struct vrl1_vgax_header),\r
- spri->sprite_vrl_cont->data_size\r
- );\r
-\r
- // restore ptr\r
- vga_state.vga_graphics_ram = omemptr;\r
-\r
- // block copy to visible RAM from offscreen\r
- vga_setup_wm1_block_copy();\r
- o = VMEMPAGESIZE2; // source offscreen\r
- o2 = (ry * GVARVIDEO.page[0].stridew) + (rx >> 2); // dest visible (original stride)\r
- for (i=0;i < h;i++,o += vga_state.vga_draw_stride,o2 += GVARVIDEO.page[0].stridew) vga_wm1_mem_block_copy(o2,o,w >> 2);\r
- // must restore Write Mode 0/Read Mode 0 for this code to continue drawing normally\r
- vga_restore_rm0wm0();\r
-\r
- // restore stride\r
- vga_state.vga_draw_stride_limit = vga_state.vga_draw_stride = GVARVIDEO.page[0].stridew;\r
-\r
- // Depending on delay, update indices\r
- switch(spri->delay){\r
- // Delay = 0 means that sprite should loop. Nothing to change here\r
- case 0:\r
- break;\r
-\r
- // Delay = 1 means that on next time unit sprite should be changed\r
- case 1:\r
- spri->curr_anim_spri++;\r
-\r
- // If we hit the end of an animation sequence, restart it\r
- if(!(spri->curr_spri_id = spri->curr_anim_list[spri->curr_anim_spri].sprite_id)){\r
- spri->curr_anim_spri = 0;\r
- spri->curr_spri_id = spri->curr_anim_list[spri->curr_anim_spri].sprite_id;\r
- }\r
- spri->delay = spri->curr_anim_list[spri->curr_anim_spri].delay;\r
-\r
- // Delay > 1 means that we should not change sprite yet. Decrease delay\r
- default:\r
- spri->delay--;\r
- break;\r
- }\r
-}\r
-*/\r
-//void animate_spri(struct sprite *spri, global_game_variables_t *gv)\r
void near ZC_animatePlayer(map_view_t *pip, player_t *player, word pn, sword scrollswitch)\r
{\r
sword x = player[pn].enti.x;\r
sword y = player[pn].enti.y;\r
word dire=10; //direction\r
- sword i;\r
sword qq; //scroll offset\r
word ls = player[pn].enti.persist_aniframe;\r
-\r
+#ifdef SPRITE\r
+ int i=0;\r
+#endif\r
switch(scrollswitch)\r
{\r
case 0:\r
qq = ((player[pn].enti.q)*(player[pn].enti.speed));\r
break;\r
}\r
- //x-=4;\r
+#ifdef SPRITE\r
+ x-=4;\r
+#endif\r
y-=pip[0].map->tiles->tileHeight;\r
switch (player[pn].enti.d)\r
{\r
case 0:\r
//up\r
- dire*=(player[pn].enti.d+1);// dire++;\r
+ dire*=player[pn].enti.d+1;\r
y-=qq;\r
break;\r
case 3:\r
// right\r
- dire*=(player[pn].enti.d-1);// dire++;\r
+ dire*=(player[pn].enti.d-1);\r
x+=qq;\r
break;\r
case 2:\r
break;\r
case 4:\r
//down\r
- dire*=(player[pn].enti.d-1);// dire++;\r
+ dire*=(player[pn].enti.d-1);\r
y+=qq;\r
break;\r
case 1:\r
//left\r
- dire*=(player[pn].enti.d+3);// dire++;\r
+ dire*=(player[pn].enti.d+3);\r
x-=qq;\r
break;\r
}\r
//#define FRAME2 modexClearRegion(pip[/*!*/(pip->video->p)].page, x, y, 24, 32, 1+dire);\r
//#define FRAME3 modexClearRegion(pip[/*!*/(pip->video->p)].page, x, y, 24, 32, dire);\r
//#define FRAME4 modexClearRegion(pip[/*!*/(pip->video->p)].page, x, y, 24, 32, 1+dire);\r
+#ifdef SPRITE\r
+//#define DRAWFRAME if (i == -1) return; oldanimate_spri(player[pn].ent->spri, pip->video)\r
#define DRAWFRAME if (i == -1) return; animate_spri(player[pn].ent->spri, pip->video)\r
#define NFRAME1 i = set_anim_by_id(player[pn].ent->spri, 2+dire); DRAWFRAME;\r
#define NFRAME2 i = set_anim_by_id(player[pn].ent->spri, 1+dire); DRAWFRAME;\r
#define NFRAME3 i = set_anim_by_id(player[pn].ent->spri, dire); DRAWFRAME;\r
#define NFRAME4 i = set_anim_by_id(player[pn].ent->spri, 2+dire); DRAWFRAME;\r
+#else\r
+#define NFRAME1 modexClearRegion(pip[/*!*/(pip->video->p)].page, x, y, 16, 32, 2+dire);\r
+#define NFRAME2 modexClearRegion(pip[/*!*/(pip->video->p)].page, x, y, 16, 32, 1+dire);\r
+#define NFRAME3 modexClearRegion(pip[/*!*/(pip->video->p)].page, x, y, 16, 32, dire);\r
+#define NFRAME4 modexClearRegion(pip[/*!*/(pip->video->p)].page, x, y, 16, 32, 1+dire);\r
+#endif\r
\r
switch(ls)\r
{\r
NFRAME1\r
break;\r
case 2:\r
- NFRAME2;\r
+ NFRAME2\r
break;\r
case 3:\r
NFRAME3\r