Factor stuff related to our_movie into separate file
[lsnes.git] / specialframes.cpp
blob97655098eb8c3f8d78ce053f2864b7129e03c627
1 #include <cstdint>
2 #include "render.hpp"
4 struct render_list_entry
6 uint32_t codepoint;
7 uint32_t x;
8 uint32_t y;
9 uint32_t scale;
12 struct render_list_entry rl_nosignal[] = {
13 {'N', 4, 168, 7},
14 {'O', 60, 168, 7},
15 {'S', 172, 168, 7},
16 {'I', 228, 168, 7},
17 {'G', 284, 168, 7},
18 {'N', 340, 168, 7},
19 {'A', 396, 168, 7},
20 {'L', 452, 168, 7},
21 {0, 0, 0, 0}
24 struct render_list_entry rl_corrupt[] = {
25 {'S', 88, 56, 7},
26 {'Y', 144, 56, 7},
27 {'S', 200, 56, 7},
28 {'T', 256, 56, 7},
29 {'E', 312, 56, 7},
30 {'M', 368, 56, 7},
31 {'S', 116, 168, 7},
32 {'T', 172, 168, 7},
33 {'A', 224, 168, 7},
34 {'T', 280, 168, 7},
35 {'E', 336, 168, 7},
36 {'C', 60, 280, 7},
37 {'O', 116, 280, 7},
38 {'R', 172, 280, 7},
39 {'R', 228, 280, 7},
40 {'U', 284, 280, 7},
41 {'P', 340, 280, 7},
42 {'T', 396, 280, 7},
43 {0, 0, 0, 0}
46 extern uint32_t fontdata[];
48 void draw_special_screen(uint16_t* target, struct render_list_entry* rlist)
50 while(rlist->scale) {
51 int32_t x;
52 int32_t y;
53 auto g = find_glyph(rlist->codepoint, 0, 0, 0, x, y);
54 for(uint32_t j = 0; j < 16; j++) {
55 for(uint32_t i = 0; i < 8; i++) {
56 uint32_t slice = g.second + j / 4;
57 uint32_t bit = 31 - ((j % 4) * 8 + i);
58 uint32_t value = (fontdata[slice] >> bit) & 1;
59 if(value) {
60 uint32_t basex = rlist->x + rlist->scale * i;
61 uint32_t basey = rlist->y + rlist->scale * j;
62 for(uint32_t j2 = 0; j2 < rlist->scale; j2++)
63 for(uint32_t i2 = 0; i2 < rlist->scale; i2++)
64 target[(basey + j2) * 512 + (basex + i2)] = 0x7FFF;
68 rlist++;
72 void draw_nosignal(uint16_t* target)
74 for(unsigned i = 0; i < 512 * 448; i++)
75 target[i] = 0x1F;
76 draw_special_screen(target, rl_nosignal);
79 void draw_corrupt(uint16_t* target)
81 for(unsigned i = 0; i < 512 * 448; i++)
82 target[i] = 0x1F;
83 draw_special_screen(target, rl_corrupt);