]> 4ch.mooo.com Git - 16.git/blobdiff - src/lib/16_sprit.c
palllist not being worked on right now... i will work on sprite animation VERY soon
[16.git] / src / lib / 16_sprit.c
index db5c3c1d257e7763705b86a7add5b0ccd014ec0f..2ca0a59a55b50cd6086f2a61db446ba5ba0982d7 100755 (executable)
@@ -155,7 +155,7 @@ void animate_spri(struct sprite *spri, global_game_variables_t *gv)
 #define VMEMPAGESIZE2  gv->video.page[0].pagesize+gv->video.page[1].pagesize\r
 #define VMEMPAGEDATA2  gv->video.page[2].data\r
        unsigned int i,o,o2; int j;\r
-       int x,rx,ry,w,h;\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
@@ -165,6 +165,7 @@ void animate_spri(struct sprite *spri, global_game_variables_t *gv)
 \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
@@ -176,9 +177,9 @@ void animate_spri(struct sprite *spri, global_game_variables_t *gv)
        // 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 = -(gv->video.page[0].dx);\r
-       if (spri->y >= overdraw) ry = (spri->y - overdraw);\r
+       if (y >= overdraw) ry = (y - overdraw);\r
                else ry = -(gv->video.page[0].dy);\r
-       h = spri->sprite_vrl_cont->vrl_header->height + overdraw + spri->y - ry;\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) > gv->video.page[0].width) w = gv->video.page[0].width-rx;\r
        if ((ry+h) > gv->video.page[0].height) h = gv->video.page[0].height-ry;\r
@@ -200,7 +201,7 @@ void animate_spri(struct sprite *spri, global_game_variables_t *gv)
        // then the sprite. note modding ram ptr means we just draw to (x&3,0)\r
        draw_vrl1_vgax_modex(\r
                x-rx,\r
-               spri->y-ry,\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