]> 4ch.mooo.com Git - 16.git/commitdiff
added toxic tile wwww
authorsparky4 <sparky4@lappy4.4ch.mooo.com>
Mon, 8 Dec 2014 22:34:49 +0000 (16:34 -0600)
committersparky4 <sparky4@lappy4.4ch.mooo.com>
Mon, 8 Dec 2014 22:34:49 +0000 (16:34 -0600)
modified:   scroll.exe
modified:   src/scroll.c

scroll.exe
src/scroll.c

index b045791a063d82c840785344ae9b09966a7df2e8..da43258cfa0d390bd9b0293c6d5d28d65f733fa0 100644 (file)
Binary files a/scroll.exe and b/scroll.exe differ
index 9000d63e4b7c8a30e7ceac66a3977c95c55af85d..18d8ace702f9eed3ff632a83ef1c4f43c5265e2c 100644 (file)
@@ -38,7 +38,9 @@ typedef struct {
        int tx; //player tile position on the viewable map\r
        int ty; //player tile position on the viewable map\r
        int triggerx; //player's trigger box tile position on the viewable map\r
-       int triggery; //player's trigger box tile position on the viewable map\r
+       int triggery; //player's trigger box tile position on the viewable map
+       int setx; //NOT USED YET! player sprite sheet set on the image x
+       int sety; //NOT USED YET! player sprite sheet set on the image y\r
        word q; //loop variable\r
        word d; //direction\r
        int hp; //hitpoints of the player\r
@@ -69,7 +71,7 @@ void animatePlayer(map_view_t *src, map_view_t *dest, /*map_view_t *top, */sword
 #define TRIGGY 9\r
 //#define SWAP(a, b) tmp=a; a=b; b=tmp;\r
 void main() {\r
-       bitmap_t ptmp; // player sprite\r
+       bitmap_t ptmp;//, npctmp; // player sprite\r
        const char *cpus;\r
        static int persist_aniframe = 0;    /* gonna be increased to 1 before being used, so 0 is ok for default */\r
        page_t screen, screen2, screen3;\r
@@ -79,7 +81,7 @@ void main() {
        byte *pal;\r
        byte *ptr;\r
        actor_t player;\r
-\r
+       //actor_t npc0;\r
 \r
        /* save the palette */\r
        pal  = modexNewPal();\r
@@ -96,8 +98,9 @@ void main() {
 \r
        /* draw the tiles */\r
        ptr = map.data;\r
-       /*data\\*/\r
-       ptmp = bitmapLoadPcx("ptmp.pcx"); // load sprite\r
+       /* data */\r
+       ptmp = bitmapLoadPcx("ptmp.pcx"); // load sprite
+       //npctmp = bitmapLoadPcx("ptmp1.pcx"); // load sprite\r
        setkb(1);\r
        modexEnter();\r
        modexPalBlack();\r
@@ -131,19 +134,148 @@ void main() {
        player.triggerx = player.tx;\r
        player.triggery = player.ty+1;\r
        player.q=1;\r
-       player.d=0;\r
+       player.d=0;
+       player.hp=4;
+       //npc
+       /*npc0.tx = bg->tx + 1;\r
+       npc0.ty = bg->ty + 1;\r
+       npc0.x = npc0.tx*TILEWH;\r
+       npc0.y = npc0.ty*TILEWH;\r
+       npc0.triggerx = npc0.tx;\r
+       npc0.triggery = npc0.ty+1;\r
+       npc0.q=1;\r
+       npc0.d=0;
+       modexDrawSpriteRegion(spri->page, npc0.x-4, npc0.y-TILEWH, 24, 64, 24, 32, &npctmp);*/\r
        modexDrawSpriteRegion(spri->page, player.x-4, player.y-TILEWH, 24, 64, 24, 32, &ptmp);\r
 \r
        modexClearRegion(spri->page, player.triggerx*16, player.triggery*16, 16, 16, 1);\r
-       modexClearRegion(bg->page, player.triggerx*16, player.triggery*16, 16, 16, 1);\r
+       modexClearRegion(bg->page, player.triggerx*16, player.triggery*16, 16, 16, 1);
+
+       modexClearRegion(spri->page, 5*16, 5*16, 16, 16, 255);\r
+       modexClearRegion(bg->page, 5*16, 5*16, 16, 16, 255);\r
+
        modexShowPage(spri->page);\r
-       while(!keyp(1))\r
+       while(!keyp(1) && player.hp!=0)\r
        {\r
        //top left corner & bottem right corner of map veiw be set as map edge trigger since maps are actually square\r
        //to stop scrolling and have the player position data move to the edge of the screen with respect to the direction\r
        //when player.tx or player.ty == 0 or player.tx == 20 or player.ty == 15 then stop because that is edge of map and you do not want to walk of the map\r
        #define INC_PER_FRAME if(player.q&1) persist_aniframe++; if(persist_aniframe>4) persist_aniframe = 1;
+       /*#define INC_PER_FRAME_NPC if(npc0.q&1) persist_aniframe++; if(persist_aniframe>4) persist_aniframe = 1;
+
+       if(npc0.d == 0 && npc0.q == 1) npc0.d =rand()%8;
+       if(npc0.d>4)
+               npc0.d=0;
 
+       //right movement\r
+       if(npc0.d == 2)\r
+       {
+               if(npc0.tx < MAPX && !(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
+       //left movement\r
+       if(npc0.d == 4)\r
+       {
+               if(npc0.tx > 1 && !(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, 3, 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, 96, 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
+       //down movement\r
+       if(npc0.d == 3)\r
+       {
+               if(npc0.ty < MAPY && !(npc0.tx == TRIGGX && npc0.ty+1 == TRIGGY) && !(npc0.tx == player.tx && npc0.ty == player.ty+1))\r
+               {\r
+                       if(npc0.q<=(TILEWH/SPEED))\r
+                       {\r
+                               INC_PER_FRAME_NPC;\r
+                               npc0.y+=SPEED;\r
+                               //animatePlayer(bg, spri, mask, 2, 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.ty++; }\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, 64, 24, 32, &npctmp);\r
+                       modexShowPage(spri->page);\r
+                       npc0.d = 0;\r
+               }\r
+               npc0.triggerx = npc0.tx;\r
+               npc0.triggery = npc0.ty+1;\r
+       }\r
+
+       //up movement\r
+       if(npc0.d == 1)\r
+       {
+               if(npc0.ty > 1 && !(npc0.tx == TRIGGX &&  npc0.ty-1 == TRIGGY) && !(npc0.tx+1 == player.tx && npc0.ty == player.ty-1))\r
+               {\r
+                       if(npc0.q<=(TILEWH/SPEED))\r
+                       {\r
+                               INC_PER_FRAME_NPC;\r
+                               npc0.y-=SPEED;\r
+                               //animatePlayer(bg, spri, mask, 0, 0, npc0.x, npc0.y, persist_aniframe, q, &npctmp);\r
+                               modexShowPage(spri->page);\r
+                               animatePlayer(bg, spri, npc0.d-1, 0, npc0.x, npc0.y, persist_aniframe, npc0.q, &npctmp);\r
+                               npc0.q++;\r
+                       } else { npc0.q = 1; npc0.d = 0; npc0.ty--; }\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, 0, 24, 32, &npctmp);\r
+                       modexShowPage(spri->page);\r
+                       npc0.d = 0;\r
+               }\r
+               npc0.triggerx = npc0.tx;\r
+               npc0.triggery = npc0.ty-1;\r
+       }
+
+       if((npc0.triggery == player.ty && npc0.triggerx == player.tx) || (npc0.ty == player.ty && npc0.tx == player.tx)){ player.hp--; }
+*/
+
+       //player movement
+       //TODO: make movement into aa function!
        //right movement\r
        if((keyp(77) && !keyp(75) && player.d == 0) || player.d == 2)\r
        {
@@ -308,16 +440,17 @@ void main() {
                player.triggery = player.ty-1;\r
        }\r
        //modexClearRegion(mask->page, 66, 66, 2, 40, 0);\r
-\r
-       if((player.triggerx == TRIGGX && player.triggery == TRIGGY) && keyp(KEY_ENTER))\r
+
+       if(((player.triggerx == TRIGGX && player.triggery == TRIGGY) && keyp(KEY_ENTER))||(player.tx == 5 && player.ty == 5))\r
        {\r
                short i;\r
-               for(i=600; i>=400; i--)\r
+               for(i=800; i>=400; i--)\r
                {\r
                        sound(i);\r
                }\r
                nosound();\r
-       }\r
+       }
+       if(player.q == (TILEWH/SPEED)+1 && player.d > 0 && (player.triggerx == 5 && player.triggery == 5)){ player.hp--; }\r
        }\r
 \r
        /* fade back to text mode */\r
@@ -333,7 +466,8 @@ void main() {
        printf("player.tx: %d\n", player.tx);\r
        printf("player.ty: %d\n", player.ty);\r
        printf("player.triggx: %d\n", player.triggerx);\r
-       printf("player.triggy: %d\n", player.triggery);\r
+       printf("player.triggy: %d\n", player.triggery);
+       printf("player.hp: %d\n", player.hp);\r
        printf("player.q: %d\n", player.q);\r
        printf("player.d: %d\n", player.d);\r
        printf("temporary player sprite 0: http://www.pixiv.net/member_illust.php?mode=medium&illust_id=45556867\n");\r
@@ -566,7 +700,12 @@ mapDrawCol(map_view_t *mv, int tx, int ty, word x) {
        }\r
        i += mv->map->width;\r
        }\r
-}\r
+}
+
+/*void npcmove(map_view_t bg, map_view_t fg, )
+{
+       
+}*/\r
 \r
 void\r
 animatePlayer(map_view_t *src, map_view_t *dest, /*map_view_t *top, */sword d, short scrolloffsetswitch, int x, int y, int ls, int lp, bitmap_t *bmp)\r