]> 4ch.mooo.com Git - 16.git/blobdiff - src/lib/16_sprite.c
wwwwwwwwwwwwwwwwwwwwwwwwwwww vrstest.c works wwwwww yakui-lover wwwww look! wwww
[16.git] / src / lib / 16_sprite.c
index 7667c25da8f482c6107a6312b8130935cd30d91c..11a063cd9b07811588f2b831624b58c31610900d 100755 (executable)
@@ -8,7 +8,7 @@ char* get_curr_anim_name(struct sprite *spri)
                                                ((byte huge *)vrs + 
                                                 vrs->offset_table[VRS_HEADER_OFFSET_ANIMATION_NAME_LIST]);
 
-       return (char *)(vrs + anim_names_offsets[spri->curr_anim_spri]);
+       return (char *)(vrs + anim_names_offsets[spri->curr_anim]);
 }
 
 void init_anim(struct sprite *spri, int anim_index)
@@ -22,6 +22,7 @@ void init_anim(struct sprite *spri, int anim_index)
                                                         anim_lists_offsets[anim_index]);
 
        // Upon new animation, start from the first sprite in it
+       spri->curr_anim = anim_index;
        spri->curr_anim_spri = 0;
        spri->curr_spri_id = anim_list[0].sprite_id;
        spri->delay = anim_list[0].delay;
@@ -44,7 +45,7 @@ int set_anim_by_id(struct sprite *spri, int anim_id)
        while(iter_id = anim_ids[new_anim_index])
        {
                // Return on successful match
-               if (iter_id = anim_id)
+               if (iter_id == anim_id)
                {
                        init_anim(spri, new_anim_index);
                        return 0;
@@ -64,7 +65,6 @@ void print_anim_ids(struct sprite *spri)
                                        ((byte huge *)vrs + 
                                         vrs->offset_table[VRS_HEADER_OFFSET_ANIMATION_ID_LIST]);
 
-       printf("\nPos %lld off %lld\n", (uint32_t)vrs, vrs->offset_table[VRS_HEADER_OFFSET_ANIMATION_ID_LIST]);
        if(!anim_ids[new_anim_index])
                exit(3);
        // Loop through animation id untill match or end of list
@@ -79,15 +79,14 @@ void print_anim_ids(struct sprite *spri)
 
 void animate_spri(struct sprite *spri)
 {
-       struct vrl_container *vrl_cont;
        // Events go here
        
        // Draw sprite
-       vrl_cont = get_vrl_by_id(spri->spritesheet, spri->curr_spri_id);
+       get_vrl_by_id(spri->spritesheet, spri->curr_spri_id, spri->sprite_vrl_cont);
        draw_vrl1_vgax_modex(   spri->x, spri->y, 
-                               vrl_cont->vrl_header, vrl_cont->line_offsets,   
-                               vrl_cont->buffer + sizeof(struct vrl1_vgax_header), 
-                               vrl_cont->size - sizeof(struct vrl1_vgax_header));
+                               spri->sprite_vrl_cont->vrl_header, spri->sprite_vrl_cont->line_offsets, 
+                               spri->sprite_vrl_cont->buffer + sizeof(struct vrl1_vgax_header), 
+                               spri->sprite_vrl_cont->data_size);
 
        // Depending on delay, update indices
        switch(spri->delay){