diff --git a/src/sdl-instead/game.c b/src/sdl-instead/game.c index 8f00527..7c4cf26 100644 --- a/src/sdl-instead/game.c +++ b/src/sdl-instead/game.c @@ -459,24 +459,40 @@ static void anigif_do(void *data) { void *v; img_t img; - if (gfx_frame_gif(el_img(el_spic))) { + + if (gfx_frame_gif(el_img(el_spic))) { /* scene */ game_cursor(CURSOR_ON); gfx_update_gif(el_img(el_spic)); } + + for (v = NULL; (img = txt_layout_images(txt_box_layout(el_box(el_scene)), &v)); ) { /* scene */ + if ((img != el_img(el_spic)) && gfx_frame_gif(img)) { + game_cursor(CURSOR_ON); + gfx_update_gif(img); + } + } - for (v = NULL; (img = txt_layout_image(txt_box_layout(el_box(el_inv)), &v)); ) { + for (v = NULL; (img = txt_layout_images(txt_box_layout(el_box(el_inv)), &v)); ) { /* inv */ if (gfx_frame_gif(img)) { game_cursor(CURSOR_ON); gfx_update_gif(img); } } - for (v = NULL; (img = txt_layout_image(txt_box_layout(el_box(el_scene)), &v)); ) { - if ((img != el_img(el_spic)) && gfx_frame_gif(img)) { + for (v = NULL; (img = txt_layout_images(el_layout(el_title), &v)); ) { /* title */ + if (gfx_frame_gif(img)) { game_cursor(CURSOR_ON); gfx_update_gif(img); } } + + for (v = NULL; (img = txt_layout_images(el_layout(el_ways), &v)); ) { /* ways */ + if (gfx_frame_gif(img)) { + game_cursor(CURSOR_ON); + gfx_update_gif(img); + } + } + } int counter_fn(int interval, void *p) @@ -645,10 +661,10 @@ int el_clear(int n) o->drawn = 0; game_clear(x, y, w, h); if (o->type == elt_box) { - for (v = NULL; (img = txt_layout_image(txt_box_layout(el_box(n)), &v)); ) + for (v = NULL; (img = txt_layout_images(txt_box_layout(el_box(n)), &v)); ) gfx_dispose_gif(img); } else if (o->type == elt_layout) { - for (v = NULL; (img = txt_layout_image(el_layout(n), &v)); ) + for (v = NULL; (img = txt_layout_images(el_layout(n), &v)); ) gfx_dispose_gif(img); } return 1; diff --git a/src/sdl-instead/graphics.c b/src/sdl-instead/graphics.c index 9abb836..a8fb708 100644 --- a/src/sdl-instead/graphics.c +++ b/src/sdl-instead/graphics.c @@ -1173,10 +1173,14 @@ struct image *_layout_lookup_image(struct layout *layout, const char *name) return NULL; } -img_t txt_layout_image(layout_t lay, void **v) +img_t txt_layout_images(layout_t lay, void **v) { struct image **g = (struct image **)v; struct layout *layout = (struct layout *)lay; + + if (!layout) + return NULL; + if (!*g) *g = layout->images; else diff --git a/src/sdl-instead/graphics.h b/src/sdl-instead/graphics.h index 5a3639d..440af92 100644 --- a/src/sdl-instead/graphics.h +++ b/src/sdl-instead/graphics.h @@ -83,7 +83,7 @@ extern void txt_layout_link_color(layout_t lay, color_t link); extern void txt_layout_active_color(layout_t lay, color_t link); extern void txt_layout_link_style(layout_t lay, int style); extern int txt_layout_add_img(layout_t lay, const char *name, img_t img); -extern img_t txt_layout_image(layout_t lay, void **v); /* enumerator */ +extern img_t txt_layout_images(layout_t lay, void **v); /* enumerator */ extern void txt_layout_size(layout_t lay, int *w, int *h); extern textbox_t txt_box(int w, int h); extern layout_t txt_box_layout(textbox_t tbox);