]> 4ch.mooo.com Git - 16.git/commitdiff
trying to fix!!
authorsparky4 <sparky4@cock.li>
Fri, 31 Jul 2015 04:54:14 +0000 (23:54 -0500)
committersparky4 <sparky4@cock.li>
Fri, 31 Jul 2015 04:54:14 +0000 (23:54 -0500)
modified:   scroll.exe
modified:   src/lib/scroll16.c
modified:   src/lib/scroll16.h
modified:   src/scroll.c

scroll.exe
src/lib/scroll16.c
src/lib/scroll16.h
src/scroll.c

index c35387abaf88f322aecccc6e1c334fb4e674f19d..c1e26bc0f29577c4e3764f181311919db36c0006 100644 (file)
Binary files a/scroll.exe and b/scroll.exe differ
index c5fe5feb48d8c38b9796565cfe67965455d9da08..24cb139b91f316576b9f6321caefe221af68e584 100644 (file)
 void walk(map_view_t *pip, player_t *player, word pn)
 {
        #define INC_PER_FRAME if(player[pn].q&1) player[pn].persist_aniframe++; if(player[pn].persist_aniframe>4) player[pn].persist_aniframe = 1;
-       //right movement
        switch(player[pn].info.dir)
        {
+               //right movement
                case 3:
                        if(pip[0].tx >= 0 && pip[0].tx+20 < pip[0].map->width && player[pn].tx == pip[0].tx + 10 &&
                        !(pip[0].map->data[(player[pn].tx)+(pip[0].map->width*(player[pn].ty-1))] == 0))//!(player[pn].tx+1 == TRIGGX && player[pn].ty == TRIGGY))      //collision detection!
                        {
-                               modexprint(pip[1].page, 320, (player[pn].q*8), 1, player[pn].q, 0, (byte *)player[pn].q);
                                if(player[pn].q<=(TILEWH/(player[pn].speed)))
                                {
                                        INC_PER_FRAME;
@@ -59,7 +58,11 @@ void walk(map_view_t *pip, player_t *player, word pn)
                        else
                        {
                                modexCopyPageRegion(pip[1].page, pip[0].page, player[pn].x-4, player[pn].y-TILEWH, player[pn].x-4, player[pn].y-TILEWH, 24, 32);
+#ifdef SPRITE
                                modexDrawSpriteRegion(pip[1].page, player[pn].x-4, player[pn].y-TILEWH, 24, 32, 24, 32, &player[pn].data);
+#else
+                               modexClearRegion(pip[1].page, player[pn].x-4, player[pn].y-TILEWH, 24, 32, 14);
+#endif
                                modexShowPage(pip[1].page);
                                player[pn].info.dir = 2;
                        }
@@ -72,7 +75,6 @@ void walk(map_view_t *pip, player_t *player, word pn)
                        if(pip[0].tx > 0 && pip[0].tx+20 <= pip[0].map->width && player[pn].tx == pip[0].tx + 10 &&
                        !(pip[0].map->data[(player[pn].tx-2)+(pip[0].map->width*(player[pn].ty-1))] == 0))//!(player[pn].tx-1 == TRIGGX && player[pn].ty == TRIGGY))    //collision detection!
                        {
-                               modexprint(pip[1].page, 320, (player[pn].q*8), 1, player[pn].q, 0, (byte *)player[pn].q);
                                if(player[pn].q<=(TILEWH/(player[pn].speed)))
                                {
                                        INC_PER_FRAME;
@@ -85,6 +87,7 @@ void walk(map_view_t *pip, player_t *player, word pn)
                        }
                        else if(player[pn].tx > 1 && !(pip[0].map->data[(player[pn].tx-2)+(pip[0].map->width*(player[pn].ty-1))] == 0))//!(player[pn].tx-1 == TRIGGX && player[pn].ty == TRIGGY))
                        {
+                               modexprint(pip[1].page, 320, (player[pn].q*8), 1, player[pn].q, 0, (byte *)(player[pn].q));
                                if(player[pn].q<=(TILEWH/(player[pn].speed)))
                                {
                                        INC_PER_FRAME;
@@ -97,7 +100,11 @@ void walk(map_view_t *pip, player_t *player, word pn)
                        else
                        {
                                modexCopyPageRegion(pip[1].page, pip[0].page, player[pn].x-4, player[pn].y-TILEWH, player[pn].x-4, player[pn].y-TILEWH, 24, 32);
+#ifdef SPRITE
                                modexDrawSpriteRegion(pip[1].page, player[pn].x-4, player[pn].y-TILEWH, 24, 96, 24, 32, &player[pn].data);
+#else
+                               modexClearRegion(pip[1].page, player[pn].x-4, player[pn].y-TILEWH, 24, 32, 10);
+#endif
                                modexShowPage(pip[1].page);
                                player[pn].info.dir = 2;
                        }
@@ -110,7 +117,6 @@ void walk(map_view_t *pip, player_t *player, word pn)
                        if(pip[0].ty >= 0 && pip[0].ty+15 < pip[0].map->height && player[pn].ty == pip[0].ty + 8 &&
                        !(pip[0].map->data[(player[pn].tx-1)+(pip[0].map->width*(player[pn].ty))] == 0))//!(player[pn].tx == TRIGGX && player[pn].ty+1 == TRIGGY))      //collision detection!
                        {
-                               modexprint(pip[1].page, 320, (player[pn].q*8), 1, player[pn].q, 0, (byte *)player[pn].q);
                                if(player[pn].q<=(TILEWH/(player[pn].speed)))
                                {
                                        INC_PER_FRAME;
@@ -135,7 +141,11 @@ void walk(map_view_t *pip, player_t *player, word pn)
                        else
                        {
                                modexCopyPageRegion(pip[1].page, pip[0].page, player[pn].x-4, player[pn].y-TILEWH, player[pn].x-4, player[pn].y-TILEWH, 24, 32);
+#ifdef SPRITE
                                modexDrawSpriteRegion(pip[1].page, player[pn].x-4, player[pn].y-TILEWH, 24, 64, 24, 32, &player[pn].data);
+#else
+                               modexClearRegion(pip[1].page, player[pn].x-4, player[pn].y-TILEWH, 24, 32, 9);
+#endif
                                modexShowPage(pip[1].page);
                                player[pn].info.dir = 2;
                        }
@@ -148,7 +158,6 @@ void walk(map_view_t *pip, player_t *player, word pn)
                        if(pip[0].ty > 0 && pip[0].ty+15 <= pip[0].map->height && player[pn].ty == pip[0].ty + 8 &&
                        !(pip[0].map->data[(player[pn].tx-1)+(pip[0].map->width*(player[pn].ty-2))] == 0))//!(player[pn].tx == TRIGGX && player[pn].ty-1 == TRIGGY))    //collision detection!
                        {
-                               modexprint(pip[1].page, 320, (player[pn].q*8), 1, player[pn].q, 0, (byte *)player[pn].q);
                                if(player[pn].q<=(TILEWH/(player[pn].speed)))
                                {
                                        INC_PER_FRAME;
@@ -161,6 +170,7 @@ void walk(map_view_t *pip, player_t *player, word pn)
                        }
                        else if(player[pn].ty > 1 && !(pip[0].map->data[(player[pn].tx-1)+(pip[0].map->width*(player[pn].ty-2))] == 0))//!(player[pn].tx == TRIGGX &&  player[pn].ty-1 == TRIGGY))
                        {
+                               modexprint(pip[1].page, 320, (player[pn].q*8), 1, player[pn].q, 0, (byte *)(player[pn].q));
                                if(player[pn].q<=(TILEWH/(player[pn].speed)))
                                {
                                        INC_PER_FRAME;
@@ -173,7 +183,11 @@ void walk(map_view_t *pip, player_t *player, word pn)
                        else
                        {
                                modexCopyPageRegion(pip[1].page, pip[0].page, player[pn].x-4, player[pn].y-TILEWH, player[pn].x-4, player[pn].y-TILEWH, 24, 32);
+#ifdef SPRITE
                                modexDrawSpriteRegion(pip[1].page, player[pn].x-4, player[pn].y-TILEWH, 24, 0, 24, 32, &player[pn].data);
+#else
+                               modexClearRegion(pip[1].page, player[pn].x-4, player[pn].y-TILEWH, 24, 32, 12);
+#endif
                                modexShowPage(pip[1].page);
                                player[pn].info.dir = 2;
                        }
@@ -457,7 +471,7 @@ mapDrawTile(tiles_t *t, word i, page_t *page, word x, word y)
                                modexDrawBmpRegion(page, x, y, rx, ry, t->tileWidth, t->tileHeight, (t->data));
                        break;
                        case 1:
-                               modexClearRegion(page, x, y, t->tileWidth, t->tileHeight, ((word)(t->debug_data))); //currently the over scan color!
+                               modexClearRegion(page, x, y, t->tileWidth, t->tileHeight, (t->debug_data[(x+(t->data->width*y))]));
                                //modexprintbig(page, x, y, 1, 15, 0, (t->debug_data));
                                /*for(texty=0; texty<2; texty++)
                                {
@@ -591,7 +605,7 @@ void animatePlayer(map_view_t *pip, player_t *player, word playnum, sword scroll
        sword qq; //scroll offset
        word ls = player[playnum].persist_aniframe;
 
-       if(scrollswitch==0) qq = 0;
+       if(!scrollswitch) qq = 0;
        else qq = ((ls)*player[playnum].speed);
        switch (player[playnum].info.dir)
        {
@@ -601,32 +615,43 @@ void animatePlayer(map_view_t *pip, player_t *player, word playnum, sword scroll
                        x-=4;
                        y-=(qq-TILEWH);
                break;
-               case 1:
+               case 3:
                        // right
                        dire*=(player[playnum].info.dir-2);
-                       x+=qq-4;
+                       x+=(qq-4);
                        y-=TILEWH;
                break;
                case 2:
                break;
-               case 3:
+               case 4:
                        //down
                        dire*=(player[playnum].info.dir-2);
                        x-=4;
                        y+=(qq-TILEWH);
                break;
-               case 4:
+               case 1:
                        //left
                        dire*=(player[playnum].info.dir+2);
-                       x-=qq-4;
+                       x-=(qq-4);
                        y-=TILEWH;
                break;
        }
+#ifdef SPRITE
+#define FRAME1 modexDrawSpriteRegion(pip[1].page, x, y, 48, dire, 24, 32, &player[playnum].data);
+#define FRAME2 modexDrawSpriteRegion(pip[1].page, x, y, 24, dire, 24, 32, &player[playnum].data)
+#define FRAME3 modexDrawSpriteRegion(pip[1].page, x, y, 0, dire, 24, 32, &player[playnum].data);
+#define FRAME4 modexDrawSpriteRegion(pip[1].page, x, y, 24, dire, 24, 32, &player[playnum].data);
+#else
+#define FRAME1 modexClearRegion(pip[1].page, x, y, 24, 32, 2+dire);
+#define FRAME2 modexClearRegion(pip[1].page, x, y, 24, 32, 1+dire);
+#define FRAME3 modexClearRegion(pip[1].page, x, y, 24, 32, dire);
+#define FRAME4 modexClearRegion(pip[1].page, x, y, 24, 32, 1+dire);
+#endif
        modexCopyPageRegion(pip[1].page, pip[0].page, x-4, y-4, x-4, y-4, 28, 40);
-       if(2>ls && ls>=1) { modexDrawSpriteRegion(pip[1].page, x, y, 48, dire, 24, 32, &player[playnum].data); }else
-       if(3>ls && ls>=2) { modexDrawSpriteRegion(pip[1].page, x, y, 24, dire, 24, 32, &player[playnum].data); }else
-       if(4>ls && ls>=3) { modexDrawSpriteRegion(pip[1].page, x, y, 0, dire, 24, 32, &player[playnum].data); }else
-       if(5>ls && ls>=4) { modexDrawSpriteRegion(pip[1].page, x, y, 24, dire, 24, 32, &player[playnum].data); }
+       if(2>ls && ls>=1) { FRAME1 }else
+       if(3>ls && ls>=2) { FRAME2 }else
+       if(4>ls && ls>=3) { FRAME3 }else
+       if(5>ls && ls>=4) { FRAME4 }
        //TODO: mask copy //modexCopyPageRegion(dest->page, src->page, x-4, y-4, x-4, y-4, 28, 40);
        //modexClearRegion(top->page, 66, 66, 2, 40, 0);
        //modexCopyPageRegion(dest->page, top->page, 66, 66, 66, 66, 2, 40);
index 46d1f18495d676b5cd43c02ea6f206bd100dbb7e..078b27a381017f4ce9870c6e0435a4dbb1ec24fc 100644 (file)
@@ -31,6 +31,8 @@
 #include "src/lib/mapread.h"
 #include "src/lib/timer.h"
 
+//#define SPRITE
+
 typedef struct {
        map_t *map;
        page_t *page;
index 9afbbcd8b005467175d7f9dbac871be87564fd42..726753e1f02900fe493bc4c08c07bcdedec9c174 100644 (file)
@@ -25,6 +25,7 @@
 #include "src/lib/wcpu/wcpu.h"
 
 //#define FADE
+//#define SPRITE
 
 //word far *clock= (word far*) 0x046C; /* 18.2hz clock */
 
@@ -158,6 +159,8 @@ void main()
        player[0].q=1;
        player[0].info.dir=2;
        player[0].hp=4;
+       player[0].speed=4;
+       player[0].persist_aniframe=0;
        //npc
        /*npc0.tx = bg->tx + 1;
        npc0.ty = bg->ty + 1;
@@ -168,7 +171,11 @@ void main()
        npc0.q=1;
        npc0.d=0;
        modexDrawSpriteRegion(spri->page, npc0.x-4, npc0.y-TILEWH, 24, 64, 24, 32, &npctmp);*/
+#ifdef SPRITE
        modexDrawSpriteRegion(spri->page, player[0].x-4, player[0].y-TILEWH, 24, 64, 24, 32, &player[0].data);
+#else
+       modexClearRegion(mv[1].page, player[0].x-4, player[0].y-TILEWH, 24, 32, 15);
+#endif
 
        modexShowPage(spri->page);
 //     printf("Total used @ before loop:                       %zu\n", oldfreemem-GetFreeSize());
@@ -376,7 +383,6 @@ void main()
        printf("Screen: %dx", screen.width);    printf("%d\n", screen.height);
        printf("Screen2: %dx", screen2.width);  printf("%d\n", screen2.height);
        printf("map: %dx%d\n", map.width, map.height);
-       printf("player[0].info.dir: %u\n", player[0].info.dir);
        //printf("map.width=%d  map.height=%d   map.data[0]=%d\n", bg->map->width, bg->map->height, bg->map->data[0]);
        //xmsfree(&map);
        //xmsfree(bg);