X-Git-Url: http://4ch.mooo.com/gitweb/?a=blobdiff_plain;f=src%2Flib%2F16_spri.c;h=62c01aa44980ce3401d2f35c2639d8282667d3c1;hb=181c6beee3d42da41fc53f44f0aa3e9315016ad2;hp=f4c795371490c4eef4fdb2d2b5ecef499575f549;hpb=791c3fa594b0dfc3f1cea801a191ab12c80dca98;p=16.git diff --git a/src/lib/16_spri.c b/src/lib/16_spri.c index f4c79537..62c01aa4 100755 --- a/src/lib/16_spri.c +++ b/src/lib/16_spri.c @@ -25,7 +25,7 @@ char* get_curr_anim_name(struct sprite *spri) { // Retrive animation name list - struct vrs_header far *vrs = spri->spritesheet->vrs_hdr; + struct vrs_header far *vrs = spri->spritesheet.vrs_hdr; uint32_t far *anim_names_offsets = (uint32_t far *) ((byte far *)vrs + vrs->offset_table[VRS_HEADER_OFFSET_ANIMATION_NAME_LIST]); @@ -35,7 +35,7 @@ char* get_curr_anim_name(struct sprite *spri) void init_anim(struct sprite *spri, int anim_index) { - struct vrs_header far *vrs = spri->spritesheet->vrs_hdr; + struct vrs_header far *vrs = spri->spritesheet.vrs_hdr; uint32_t far *anim_lists_offsets = (uint32_t far *) ((byte far *)vrs + vrs->offset_table[VRS_HEADER_OFFSET_ANIMATION_LIST]); @@ -56,7 +56,7 @@ int set_anim_by_id(struct sprite *spri, int anim_id) { int new_anim_index = 0; int iter_id; - struct vrs_header far *vrs = spri->spritesheet->vrs_hdr; + struct vrs_header far *vrs = spri->spritesheet.vrs_hdr; // Retruve animation ids list uint16_t far *anim_ids = (uint16_t far *) ((byte far *)vrs + @@ -80,7 +80,7 @@ void print_anim_ids(struct sprite *spri) { int new_anim_index = 0; int iter_id; - struct vrs_header far *vrs = spri->spritesheet->vrs_hdr; + struct vrs_header far *vrs = spri->spritesheet.vrs_hdr; // Retruve animation ids list uint16_t far *anim_ids = (uint16_t far *) ((byte far *)vrs + @@ -101,6 +101,7 @@ void animate_spri(entity_t *enti, video_t *video) #define INC_PER_FRAME if(enti->q&1) enti->persist_aniframe++; if(enti->persist_aniframe>4) enti->persist_aniframe = 1; unsigned int i,o,o2; int j; int x,y,rx,ry,w,h; + static struct glob_game_vars *ggvv; VGA_RAM_PTR omemptr = (VGA_RAM_PTR)video->page[0].data;// save original mem ptr x=enti->spri.x; @@ -148,7 +149,7 @@ void animate_spri(entity_t *enti, video_t *video) // Draw sprite - j = get_vrl_by_id(enti->spri.spritesheet, enti->spri.curr_spri_id, enti->spri.sprite_vrl_cont); + j = get_vrl_by_id(&enti->spri.spritesheet, enti->spri.curr_spri_id, &enti->spri.sprite_vrl_cont); if(j < 0) { //Quit (gv, "Error retriving required sprite"); @@ -156,18 +157,18 @@ void animate_spri(entity_t *enti, video_t *video) } // render box bounds. y does not need modification, but x and width must be multiple of 4 - if(!video->rss) + if(!video->vga_state.rss) { if (x >= enti->overdraww) rx = (x - enti->overdraww) & (~3); else rx = -(video->page[0].dx); if (y >= enti->overdrawh) ry = (y - enti->overdrawh); else ry = -(video->page[0].dy); - h = enti->spri.sprite_vrl_cont->vrl_header->height + enti->overdrawh + y - ry; - w = (x + enti->spri.sprite_vrl_cont->vrl_header->width + (enti->overdraww*2) + 3 - rx) & (~3) - enti->overdraww;//round up + h = enti->spri.sprite_vrl_cont.vrl_header->height + enti->overdrawh + y - ry; + w = (x + enti->spri.sprite_vrl_cont.vrl_header->width + (enti->overdraww*2) + 3 - rx) & (~3) - enti->overdraww;//round up if ((rx+w) > video->page[0].width) w = video->page[0].width-rx; if ((ry+h) > video->page[0].height) h = video->page[0].height-ry; - if(!video->bgps){ + if(!video->vga_state.bgps){ // block copy pattern to where we will draw the sprite vga_setup_wm1_block_copy(); o2 = video->ofs.offscreen_ofs; @@ -190,18 +191,25 @@ void animate_spri(entity_t *enti, video_t *video) draw_vrl1_vgax_modex( x-rx, y-ry, - enti->spri.sprite_vrl_cont->vrl_header, - enti->spri.sprite_vrl_cont->line_offsets, - enti->spri.sprite_vrl_cont->buffer + sizeof(struct vrl1_vgax_header), - enti->spri.sprite_vrl_cont->data_size + enti->spri.sprite_vrl_cont.vrl_header, + enti->spri.sprite_vrl_cont.line_offsets, + enti->spri.sprite_vrl_cont.buffer + sizeof(struct vrl1_vgax_header), + enti->spri.sprite_vrl_cont.data_size ); #endif - if(!video->rss) +#ifdef __DEBUG_SPRI__ +// if(ggvv->player[0].enti.q<5) + if(dbg_delayanimation) + { + IN_Ack(ggvv);// delay(250);//{ while(!IN_KeyDown(sc_Space)/* && !IN_KeyDown(sc_Escape)*/){} delay(250); } + } +#endif + if(!video->vga_state.rss) { // restore ptr vga_state.vga_graphics_ram = omemptr; - if(!video->bgps){ + if(!video->vga_state.bgps){ // block copy to visible RAM from offscreen vga_setup_wm1_block_copy(); o = video->ofs.offscreen_ofs; // source offscreen @@ -214,6 +222,6 @@ void animate_spri(entity_t *enti, video_t *video) // restore stride vga_state.vga_draw_stride_limit = vga_state.vga_draw_stride = video->page[0].stridew; - vga_state.vga_graphics_ram = video->omemptr; + vga_state.vga_graphics_ram = video->vga_state.omemptr; video->dorender=1; }