X-Git-Url: https://jasonwoof.com/gitweb/?p=vor.git;a=blobdiff_plain;f=sprite.c;h=3898123ab222ff02c50d1f4c613a2a0c577a8f44;hp=36ca546bec9dc63e6ac04fad88237b50b1fe6205;hb=e3edccb30438fa531aca19132a7ca532d3ac5dc9;hpb=51d56bfe5830a41e61f4ceefb75217f647d994fe diff --git a/sprite.c b/sprite.c index 36ca546..3898123 100644 --- a/sprite.c +++ b/sprite.c @@ -48,7 +48,7 @@ get_shape(Sprite *s) exit(1); } - SDL_LockSurface(s->image); + if(SDL_MUSTLOCK(s->image)) { SDL_LockSurface(s->image); } px = s->image->pixels; transp = s->image->format->colorkey; p = s->mask; @@ -62,7 +62,7 @@ get_shape(Sprite *s) } px = (uint16_t *) ((uint8_t *) px + s->image->pitch - 2*s->image->w); } - SDL_UnlockSurface(s->image); + if(SDL_MUSTLOCK(s->image)) { SDL_UnlockSurface(s->image); } } @@ -128,11 +128,11 @@ reset_sprites(void) } void -move_sprite(Sprite *s, float ticks) +move_sprite(Sprite *s) { if(s->flags & MOVE) { - s->x += (s->dx - screendx)*ticks; - s->y += (s->dy - screendy)*ticks; + s->x += (s->dx - screendx)*t_frame; + s->y += (s->dy - screendy)*t_frame; } } @@ -148,7 +148,7 @@ sort_sprite(Sprite *s) } void -move_sprites(float ticks) +move_sprites(void) { int sq; Sprite **head; @@ -158,7 +158,7 @@ move_sprites(float ticks) head=&sprites[set][sq]; while(*head) { Sprite *s = remove_sprite(head); - move_sprite(s, ticks); sort_sprite(s); + move_sprite(s); sort_sprite(s); } } set = 1-set; // switch to other set of sprites.