Mirai's Miscellaneous Misadventures
M50 / core / logos.c
1
2
3
4#include <mimimi.h>
5
6void mimimi_logo(struct mimimi_engine *engine, struct mimimi_logo *logo, struct mimimi_logo_line *lines, int count)
7{
8 int i;
9 struct mimimi_image *image;
10 struct mimimi_logo_line *line;
11
12 logo->lines = lines;
13 logo->count = count;
14
15 for (i = 0 ; i < count ; i++)
16 {
17 line = logo->lines + i;
18 image = logo->images + i;
19
20 logo->y_offsets[i] = 8192;
21
22 image->colors = logo->colors[i];
23 image->width = line->size.width;
24 image->height = line->size.height;
25
26 mimimi_unpack_bits(image->width * image->height, image->colors, line->packed);
27
28 logo->textures[i] = (*engine->texture)(engine->data, image);
29 }
30}
31
32unsigned char mimimi_logo_tick(struct mimimi_engine *engine, struct mimimi_logo *logo, int x, int y)
33{
34 int i;
35 struct mimimi_logo_line *line;
36
37 for (i = 0 ; i < logo->count ; i++)
38 {
39 line = logo->lines + i;
40 (*engine->stamp)(engine->data, x + line->position.x, y + line->position.y + logo->y_offsets[i] / 256, logo->textures[i]);
41 if (logo->y_offsets[i] <= 0) continue;
42 logo->y_offsets[i] = mimimi_div_down(logo->y_offsets[i] * 15, 16);
43 return 0;
44 }
45 return 1;
46}