comparison libmlk-rpg/mlk/rpg/battle-state-check.c @ 449:f2f0e73ea9da

core: drawable -> mlk_drawable
author David Demelier <markand@malikania.fr>
date Sat, 18 Feb 2023 13:16:40 +0100
parents 773a082f0b91
children 8fa69c770569
comparison
equal deleted inserted replaced
448:0c4cd552879d 449:f2f0e73ea9da
35 35
36 struct fadeout { 36 struct fadeout {
37 struct character *ch; 37 struct character *ch;
38 int x; 38 int x;
39 int y; 39 int y;
40 struct drawable dw; 40 struct mlk_drawable dw;
41 unsigned int alpha; 41 unsigned int alpha;
42 unsigned int elapsed; 42 unsigned int elapsed;
43 }; 43 };
44 44
45 static int 45 static int
46 fadeout_update(struct drawable *dw, unsigned int ticks) 46 fadeout_update(struct mlk_drawable *dw, unsigned int ticks)
47 { 47 {
48 struct fadeout *fade = dw->data; 48 struct fadeout *fade = dw->data;
49 49
50 fade->elapsed += ticks; 50 fade->elapsed += ticks;
51 51
60 60
61 return 0; 61 return 0;
62 } 62 }
63 63
64 static void 64 static void
65 fadeout_draw(struct drawable *dw) 65 fadeout_draw(struct mlk_drawable *dw)
66 { 66 {
67 const struct fadeout *fade = dw->data; 67 const struct fadeout *fade = dw->data;
68 struct sprite *sprite = fade->ch->sprites[CHARACTER_SPRITE_NORMAL]; 68 struct sprite *sprite = fade->ch->sprites[CHARACTER_SPRITE_NORMAL];
69 69
70 texture_set_alpha_mod(sprite->texture, fade->alpha); 70 texture_set_alpha_mod(sprite->texture, fade->alpha);
71 sprite_draw(sprite, 0, 0, fade->x, fade->y); 71 sprite_draw(sprite, 0, 0, fade->x, fade->y);
72 texture_set_alpha_mod(sprite->texture, 255); 72 texture_set_alpha_mod(sprite->texture, 255);
73 } 73 }
74 74
75 static void 75 static void
76 fadeout_finish(struct drawable *dw) 76 fadeout_finish(struct mlk_drawable *dw)
77 { 77 {
78 free(dw->data); 78 free(dw->data);
79 } 79 }
80 80
81 static void 81 static void
96 fade->dw.data = fade; 96 fade->dw.data = fade;
97 fade->dw.draw = fadeout_draw; 97 fade->dw.draw = fadeout_draw;
98 fade->dw.update = fadeout_update; 98 fade->dw.update = fadeout_update;
99 fade->dw.finish = fadeout_finish; 99 fade->dw.finish = fadeout_finish;
100 100
101 if (drawable_stack_add(bt->effects, &fade->dw) < 0) 101 if (mlk_drawable_stack_add(bt->effects, &fade->dw) < 0)
102 mlk_alloc_free(fade); 102 mlk_alloc_free(fade);
103 } 103 }
104 104
105 static int 105 static int
106 is_dead(const struct battle *bt) 106 is_dead(const struct battle *bt)