1.1 --- a/lib/image.c Tue Nov 13 15:17:37 2018 +0100
1.2 +++ b/lib/image.c Tue Nov 13 17:54:21 2018 +0100
1.3 @@ -39,9 +39,28 @@
1.4
1.5
1.6
1.7 +/* Get a sprite's position. */
1.8 +
1.9 +position_t *image_get_sprite_position(sprite_t *s)
1.10 +{
1.11 + return image_get_stored_position(s, s->cfg->frame);
1.12 +}
1.13 +
1.14 +/* Set a sprite's position. */
1.15 +
1.16 +void image_set_sprite_position(sprite_t *s, int x, int y)
1.17 +{
1.18 + position_t *p = image_get_sprite_position(s);
1.19 +
1.20 + p->x = x;
1.21 + p->y = y;
1.22 +}
1.23 +
1.24 +
1.25 +
1.26 /* Copy a region from the screen to the store, then blit the image. */
1.27
1.28 -void image_plot_sprite(sprite_t *s, int x, int y, int key)
1.29 +void image_plot_sprite(sprite_t *s)
1.30 {
1.31 int frame = 0;
1.32 position_t *p = 0;
1.33 @@ -55,22 +74,19 @@
1.34
1.35 display_copy(s->cfg, image_get_stored_region(s->regions, frame),
1.36 s->image->width, s->image->height / s->yscale, 1,
1.37 - x, y, -1, 0);
1.38 + p->x, p->y, -1, 0);
1.39 }
1.40
1.41 /* Plot to the screen. */
1.42
1.43 display_copy(s->cfg, s->image->image,
1.44 s->image->width, s->image->height, s->yscale,
1.45 - x, y, key, 1);
1.46 + p->x, p->y, s->key, 1);
1.47
1.48 if (s->regions)
1.49 {
1.50 /* Record the stored background details. */
1.51
1.52 - p->x = x;
1.53 - p->y = y;
1.54 -
1.55 if (frame >= s->regions->stored)
1.56 s->regions->stored = frame + 1;
1.57 }