+ #define INC_PER_FRAME if(player.q&1) persist_aniframe++; if(persist_aniframe>4) persist_aniframe = 1;\r
+ /*#define INC_PER_FRAME_NPC if(npc0.q&1) persist_aniframe++; if(persist_aniframe>4) persist_aniframe = 1;\r
+\r
+ if(npc0.d == 0 && npc0.q == 1) npc0.d =rand()%8;\r
+ if(npc0.d>4)\r
+ npc0.d=0;\r
+\r
+ //right movement\r
+ if(npc0.d == 2)\r
+ {\r
+ if(npc0.tx < map.width && !(npc0.tx+1 == TRIGGX && npc0.ty == TRIGGY) && !(npc0.tx+1 == player.tx && npc0.ty == player.ty))\r
+ {\r
+ if(npc0.q<=(TILEWH/SPEED))\r
+ {\r
+ INC_PER_FRAME_NPC;\r
+ npc0.x+=SPEED;\r
+ //animatePlayer(bg, spri, mask, 1, 0, npc0.x, npc0.y, persist_aniframe, q, &npctmp);\r
+ animatePlayer(bg, spri, npc0.d-1, 0, npc0.x, npc0.y, persist_aniframe, npc0.q, &npctmp);\r
+ modexShowPage(spri->page);\r
+ npc0.q++;\r
+ } else { npc0.q = 1; npc0.d = 0; npc0.tx++; }\r
+ }\r
+ else\r
+ {\r
+ modexCopyPageRegion(spri->page, bg->page, npc0.x-4, npc0.y-TILEWH, npc0.x-4, npc0.y-TILEWH, 24, 32);\r
+ modexDrawSpriteRegion(spri->page, npc0.x-4, npc0.y-TILEWH, 24, 32, 24, 32, &npctmp);\r
+ modexShowPage(spri->page);\r
+ npc0.d = 0;\r
+ }\r
+ npc0.triggerx = npc0.tx+1;\r
+ npc0.triggery = npc0.ty;\r
+ }\r