JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
Removed unnecessary command-line options.
[vor.git] / sprite.c
index 447e482..6a20442 100644 (file)
--- 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)
+move_sprite(Sprite *s, float ticks)
 {
        if(s->flags & MOVE) {
-               s->x += (s->dx - screendx)*t_frame;
-               s->y += (s->dy - screendy)*t_frame;
+               s->x += (s->dx - screendx)*ticks;
+               s->y += (s->dy - screendy)*ticks;
        }
 }
 
@@ -148,7 +148,7 @@ sort_sprite(Sprite *s)
 }
 
 void
-move_sprites(void)
+move_sprites(float ticks)
 {
        int sq;
        Sprite **head;
@@ -158,7 +158,7 @@ move_sprites(void)
                head=&sprites[set][sq];
                while(*head) {
                        Sprite *s = remove_sprite(head);
-                       move_sprite(s); sort_sprite(s);
+                       move_sprite(s, ticks); sort_sprite(s);
                }
        }
        set = 1-set;  // switch to other set of sprites.