]> 4ch.mooo.com Git - 16.git/blobdiff - src/lib/scroll16.c
pbuf????
[16.git] / src / lib / scroll16.c
index d5441ce2c124f81b3174ceaaadbdd388ff43a7ee..7dd610f772586167c56d823935415e4266940fff 100755 (executable)
@@ -31,6 +31,7 @@ void walk(map_view_t *pip, player_t *player, word pn)
        {
                //right movement
                case 3:
+                       //printf("pip[0].page->tilesw=%d\n", pip[0].page->tilesw);
                        if(pip[0].tx >= 0 && pip[0].tx+pip[0].page->tilesw < pip[0].map->width && player[pn].tx == pip[0].tx+pip[0].page->tilemidposscreenx &&
                        !(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!
                        {
@@ -59,7 +60,7 @@ void walk(map_view_t *pip, player_t *player, word pn)
                        {
                                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);
+                               PBUFSFUN(pip[1].page, player[pn].x-4, player[pn].y-TILEWH, 24, 32, 24, 32, PLAYERBMPDATA);
 #else
                                modexClearRegion(pip[1].page, player[pn].x-4, player[pn].y-TILEWH, 24, 32, 14);
 #endif
@@ -100,7 +101,7 @@ void walk(map_view_t *pip, player_t *player, word pn)
                        {
                                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);
+                               PBUFSFUN(pip[1].page, player[pn].x-4, player[pn].y-TILEWH, 24, 96, 24, 32, PLAYERBMPDATA);
 #else
                                modexClearRegion(pip[1].page, player[pn].x-4, player[pn].y-TILEWH, 24, 32, 10);
 #endif
@@ -141,7 +142,7 @@ void walk(map_view_t *pip, player_t *player, word pn)
                        {
                                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);
+                               PBUFSFUN(pip[1].page, player[pn].x-4, player[pn].y-TILEWH, 24, 64, 24, 32, PLAYERBMPDATA);
 #else
                                modexClearRegion(pip[1].page, player[pn].x-4, player[pn].y-TILEWH, 24, 32, 9);
 #endif
@@ -182,7 +183,7 @@ void walk(map_view_t *pip, player_t *player, word pn)
                        {
                                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);
+                               PBUFSFUN(pip[1].page, player[pn].x-4, player[pn].y-TILEWH, 24, 0, 24, 32, PLAYERBMPDATA);
 #else
                                modexClearRegion(pip[1].page, player[pn].x-4, player[pn].y-TILEWH, 24, 32, 12);
 #endif
@@ -300,12 +301,12 @@ void near mapScrollRight(map_view_t *mv, player_t *player, word id, word plid)
        }
 
        /* draw the next column */
-       x= SCREEN_WIDTH + mv[id].map->tiles->tileWidth;
+       x= mv[0].page->sw + mv[id].map->tiles->tileWidth;
        if(player[plid].q%4)
                if(id==0)
-                       mapDrawCol(&mv[0], mv[0].tx + 20 , mv[0].ty-1, x, player, mv->page->dx);
+                       mapDrawCol(&mv[0], mv[0].tx + mv[0].page->tilesw, mv[0].ty-1, x, player, mv->page->dx);
                else
-                       modexCopyPageRegion(mv[id].page, mv[0].page, x, 0, x, 0, mv[id].map->tiles->tileWidth, mv[id].map->tiles->tileHeight*17);
+                       modexCopyPageRegion(mv[id].page, mv[0].page, x, 0, x, 0, mv[id].map->tiles->tileWidth, mv[id].map->tiles->tileHeight*(mv[0].page->tilesh+2));
        //}
 }
 
@@ -334,7 +335,7 @@ void near mapScrollLeft(map_view_t *mv, player_t *player, word id, word plid)
                if(id==0)
                        mapDrawCol(&mv[0], mv[0].tx - 1, mv[0].ty-1, x, player, mv->page->dx);
                else
-                       modexCopyPageRegion(mv[id].page, mv[0].page, x, 0, x, 0, mv[id].map->tiles->tileWidth, mv[id].map->tiles->tileHeight*17);
+                       modexCopyPageRegion(mv[id].page, mv[0].page, x, 0, x, 0, mv[id].map->tiles->tileWidth, mv[id].map->tiles->tileHeight*(mv[0].page->tilesh+2));
        //}
 }
 
@@ -362,7 +363,7 @@ void near mapScrollUp(map_view_t *mv, player_t *player, word id, word plid)
                if(id==0)
                        mapDrawRow(&mv[0], mv[0].tx - 1, mv[0].ty-1, y, player, mv->page->dy);
                else
-                       modexCopyPageRegion(mv[id].page, mv[0].page, 0, y, 0, y, mv[id].map->tiles->tileWidth*22, mv[id].map->tiles->tileHeight);
+                       modexCopyPageRegion(mv[id].page, mv[0].page, 0, y, 0, y, mv[id].map->tiles->tileWidth*(mv[0].page->tilesw+2), mv[id].map->tiles->tileHeight);
        //}
 }
 
@@ -384,12 +385,12 @@ void near mapScrollDown(map_view_t *mv, player_t *player, word id, word plid)
        }
 
        /* draw the next row */
-       y= SCREEN_HEIGHT + mv[id].map->tiles->tileHeight;
+       y= mv[0].page->sh + mv[id].map->tiles->tileHeight;
        if(player[plid].q%3)
                if(id==0)
-                       mapDrawRow(&mv[0], mv[0].tx - 1, mv[0].ty+15, y, player, mv->page->dy);
+                       mapDrawRow(&mv[0], mv[0].tx - 1, mv[0].ty+mv[0].page->tilesh, y, player, mv->page->dy);
                else
-                       modexCopyPageRegion(mv[id].page, mv[0].page, 0, y, 0, y, mv[id].map->tiles->tileWidth*22, mv[id].map->tiles->tileHeight);
+                       modexCopyPageRegion(mv[id].page, mv[0].page, 0, y, 0, y, mv[id].map->tiles->tileWidth*(mv[0].page->tilesw+2), mv[id].map->tiles->tileHeight);
        //}
 }
 
@@ -455,7 +456,7 @@ void mapGoTo(map_view_t *mv, int tx, int ty)
        modexClearRegion(mv->page, 0, 0, mv->page->width, mv->page->height, 0);
        py=0;
        i=mv->ty * mv->map->width + mv->tx;
-       for(ty=mv->ty-1; py < SCREEN_HEIGHT+mv->dyThresh && ty < mv->map->height; ty++, py+=mv->map->tiles->tileHeight) {
+       for(ty=mv->ty-1; py < mv->page->sh+mv->dyThresh && ty < mv->map->height; ty++, py+=mv->map->tiles->tileHeight) {
                mapDrawWRow(mv, tx-1, ty, py);
        i+=mv->map->width - tx;
        }
@@ -477,17 +478,18 @@ mapDrawTile(tiles_t *t, word i, page_t *page, word x, word y)
        }
        else
        {
-               rx = (((i-1) % ((t->data->width)/t->tileWidth)) * t->tileWidth);
-               ry = (((i-1) / ((t->data->height)/t->tileHeight)) * t->tileHeight);
+               rx = (((i-1) % ((t->data.width)/t->tileWidth)) * t->tileWidth);
+               ry = (((i-1) / ((t->data.height)/t->tileHeight)) * t->tileHeight);
 ////0000printf("i=%d\n", i);
                switch(t->debug_text)
                {
                        case 0:
-#ifndef SPRITE
+#ifndef TILERENDER
                                modexClearRegion(page, x, y, t->tileWidth, t->tileHeight, ((t->debug_data[i])+1)*2);
                                //cannot print number value du to it being slow as bakapee
 #else
-                               modexDrawBmpRegion(page, x, y, rx, ry, t->tileWidth, t->tileHeight, (t->data));
+                               PBUFBFUN(page, x, y, rx, ry, t->tileWidth, t->tileHeight, &(t->data));
+                               //modexDrawBmpRegion(page, x, y, rx, ry, t->tileWidth, t->tileHeight, (t->btdata));
 #endif
                        break;
                        case 1:
@@ -513,7 +515,7 @@ void near mapDrawRow(map_view_t *mv, int tx, int ty, word y, player_t *p, word p
 //printf("y: %d\n", poopoffset);
        /* the position within the map array */
        i=ty * mv->map->width + tx;
-       for(x=poopoffset; x<(SCREEN_WIDTH+mv->dxThresh)/(poopoffset+1) && tx < mv->map->width; x+=mv->map->tiles->tileWidth, tx++) {
+       for(x=poopoffset; x<(mv->page->sw+mv->dxThresh)/(poopoffset+1) && tx < mv->map->width; x+=mv->map->tiles->tileWidth, tx++) {
        if(i>=0) {
                /* we are in the map, so copy! */
                mapDrawTile(mv->map->tiles, mv->map->data[i], mv->page, x, y);
@@ -533,7 +535,7 @@ void near mapDrawCol(map_view_t *mv, int tx, int ty, word x, player_t *p, word p
 
        /* We'll copy all of the columns in the screen,
           i + 1 row above and one below */
-       for(y=poopoffset; y<(SCREEN_HEIGHT+mv->dyThresh)/(poopoffset+1) && ty < mv->map->height; y+=mv->map->tiles->tileHeight, ty++) {
+       for(y=poopoffset; y<(mv->page->sh+mv->dyThresh)/(poopoffset+1) && ty < mv->map->height; y+=mv->map->tiles->tileHeight, ty++) {
        if(i>=0) {
                /* we are in the map, so copy away! */
                mapDrawTile(mv->map->tiles, mv->map->data[i], mv->page, x, y);
@@ -549,7 +551,7 @@ void mapDrawWRow(map_view_t *mv, int tx, int ty, word y)
 
        /* the position within the map array */
        i=ty * mv->map->width + tx;
-       for(x=0; x<SCREEN_WIDTH+mv->dxThresh && tx < mv->map->width; x+=mv->map->tiles->tileWidth, tx++) {
+       for(x=0; x<mv->page->sw+mv->dxThresh && tx < mv->map->width; x+=mv->map->tiles->tileWidth, tx++) {
        if(i>=0) {
                /* we are in the map, so copy! */
                mapDrawTile(mv->map->tiles, mv->map->data[i], mv->page, x, y);
@@ -568,7 +570,7 @@ void mapDrawWCol(map_view_t *mv, int tx, int ty, word x)
 
        /* We'll copy all of the columns in the screen,
           i + 1 row above and one below */
-       for(y=0; y<SCREEN_HEIGHT+mv->dyThresh && ty < mv->map->height; y+=mv->map->tiles->tileHeight, ty++) {
+       for(y=0; y<mv->page->sh+mv->dyThresh && ty < mv->map->height; y+=mv->map->tiles->tileHeight, ty++) {
        if(i>=0) {
                /* we are in the map, so copy away! */
                mapDrawTile(mv->map->tiles, mv->map->data[i], mv->page, x, y);
@@ -616,60 +618,53 @@ void shinku(map_view_t *pip, global_game_variables_t *gv)
        }
 }
 
-void near animatePlayer(map_view_t *pip, player_t *player, word playnum, sword scrollswitch)
+void near animatePlayer(map_view_t *pip, player_t *player, word pn, sword scrollswitch)
 {
-       sword x = player[playnum].x;
-       sword y = player[playnum].y;
+       sword x = player[pn].x;
+       sword y = player[pn].y;
 #ifdef SPRITE
        word dire=32; //direction
 #else
        word dire=8; //direction
 #endif
        sword qq; //scroll offset
-       word ls = player[playnum].persist_aniframe;
+       word ls = player[pn].persist_aniframe;
 
        if(scrollswitch==0) qq = 0;
-       else qq = ((player[playnum].q)*(player[playnum].speed));
+       else qq = ((player[pn].q)*(player[pn].speed));
        x-=4;
        y-=TILEWH;
-       switch (player[playnum].d)
+       switch (player[pn].d)
        {
                case 0:
                        //up
-                       dire*=player[playnum].d;
+                       dire*=player[pn].d;
                        y-=qq;
                break;
                case 3:
                        // right
-                       dire*=(player[playnum].d-2);
+                       dire*=(player[pn].d-2);
                        x+=qq;
                break;
                case 2:
                break;
                case 4:
                        //down
-                       dire*=(player[playnum].d-2);
+                       dire*=(player[pn].d-2);
                        y+=qq;
                break;
                case 1:
                        //left
-                       dire*=(player[playnum].d+2);
+                       dire*=(player[pn].d+2);
                        x-=qq;
                break;
        }
 
 #ifdef SPRITE
-#ifdef BMPTYPE
-#define FRAME1 oldDrawBmp(VGA, x, y, &player[playnum].data, 1);
-#define FRAME2 oldDrawBmp(VGA, x, y, &player[playnum].data, 1);
-#define FRAME3 oldDrawBmp(VGA, x, y, &player[playnum].data, 1);
-#define FRAME4 oldDrawBmp(VGA, x, y, &player[playnum].data, 1);
-#else
-#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);
-#endif
+#define FRAME1 PBUFSFUN(pip[1].page, x, y, 48, dire, 24, 32,   PLAYERBMPDATA);
+#define FRAME2 PBUFSFUN(pip[1].page, x, y, 24, dire, 24, 32,   PLAYERBMPDATA);
+#define FRAME3 PBUFSFUN(pip[1].page, x, y, 0, dire, 24, 32,    PLAYERBMPDATA);
+#define FRAME4 PBUFSFUN(pip[1].page, x, y, 24, dire, 24, 32,   PLAYERBMPDATA);
 #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);