|
@@ -32,6 +32,8 @@
|
32
|
32
|
|
33
|
33
|
// TODO inverted score color not visible on DMG
|
34
|
34
|
|
|
35
|
+BANKREF(maps)
|
|
36
|
+
|
35
|
37
|
const unsigned char num_attr_1[104] = {
|
36
|
38
|
0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,
|
37
|
39
|
0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,
|
|
@@ -88,26 +90,29 @@ void win_init(uint8_t is_splash) NONBANKED {
|
88
|
90
|
}
|
89
|
91
|
|
90
|
92
|
static void set_win_based(uint8_t x, uint8_t y, uint8_t w, uint8_t h,
|
91
|
|
- const uint8_t *tiles, uint8_t base_tile, const uint8_t *attributes) NONBANKED {
|
|
93
|
+ const uint8_t *tiles, uint8_t base_tile, uint8_t tile_bank,
|
|
94
|
+ const uint8_t *attributes, uint8_t attr_bank) NONBANKED {
|
|
95
|
+ SWITCH_ROM(attr_bank);
|
92
|
96
|
VBK_REG = VBK_ATTRIBUTES;
|
93
|
97
|
set_win_tiles(x, y, w, h, attributes);
|
|
98
|
+
|
|
99
|
+ SWITCH_ROM(tile_bank);
|
94
|
100
|
VBK_REG = VBK_TILES;
|
95
|
101
|
set_win_based_tiles(x, y, w, h, tiles, base_tile);
|
96
|
102
|
}
|
97
|
103
|
|
98
|
104
|
static void character(uint8_t c, uint8_t pos, uint8_t x_off, uint8_t y_off, uint8_t is_black) NONBANKED {
|
99
|
|
- SWITCH_ROM(BANK(text_fnt));
|
100
|
105
|
uint8_t off = c * text_fnt_WIDTH / text_fnt_TILE_W;
|
101
|
106
|
|
102
|
107
|
set_win_based(x_off + (pos * text_fnt_WIDTH / text_fnt_TILE_W), y_off,
|
103
|
108
|
text_fnt_WIDTH / text_fnt_TILE_W, 1,
|
104
|
|
- text_fnt_map + off, fnt_off + numbers_fnt_TILE_COUNT,
|
105
|
|
- (is_black ? num_attr_2 : num_attr_1) + off);
|
|
109
|
+ text_fnt_map + off, fnt_off + numbers_fnt_TILE_COUNT, BANK(text_fnt),
|
|
110
|
+ (is_black ? num_attr_2 : num_attr_1) + off, BANK(maps));
|
106
|
111
|
|
107
|
112
|
set_win_based(x_off + (pos * text_fnt_WIDTH / text_fnt_TILE_W), y_off + 1,
|
108
|
113
|
text_fnt_WIDTH / text_fnt_TILE_W, 1,
|
109
|
|
- text_fnt_map + off + (sizeof(text_fnt_map) / 2), fnt_off + numbers_fnt_TILE_COUNT,
|
110
|
|
- (is_black ? num_attr_2 : num_attr_1) + off);
|
|
114
|
+ text_fnt_map + off + (sizeof(text_fnt_map) / 2), fnt_off + numbers_fnt_TILE_COUNT, BANK(text_fnt),
|
|
115
|
+ (is_black ? num_attr_2 : num_attr_1) + off, BANK(maps));
|
111
|
116
|
}
|
112
|
117
|
|
113
|
118
|
static void str3(uint16_t name, uint8_t x_off, uint8_t y_off, uint8_t is_black) NONBANKED {
|
|
@@ -132,18 +137,17 @@ static void str(const char *s, uint8_t x_off, uint8_t y_off, uint8_t is_black) N
|
132
|
137
|
}
|
133
|
138
|
|
134
|
139
|
static void digit(uint8_t val, uint8_t pos, uint8_t x_off, uint8_t y_off, uint8_t is_black) NONBANKED {
|
135
|
|
- SWITCH_ROM(BANK(numbers_fnt));
|
136
|
140
|
uint8_t off = val * numbers_fnt_WIDTH / numbers_fnt_TILE_W;
|
137
|
141
|
|
138
|
142
|
set_win_based(x_off + (pos * numbers_fnt_WIDTH / numbers_fnt_TILE_W), y_off,
|
139
|
143
|
numbers_fnt_WIDTH / numbers_fnt_TILE_W, 1,
|
140
|
|
- numbers_fnt_map + off, fnt_off,
|
141
|
|
- (is_black ? num_attr_2 : num_attr_1) + off);
|
|
144
|
+ numbers_fnt_map + off, fnt_off, BANK(numbers_fnt),
|
|
145
|
+ (is_black ? num_attr_2 : num_attr_1) + off, BANK(maps));
|
142
|
146
|
|
143
|
147
|
set_win_based(x_off + (pos * numbers_fnt_WIDTH / numbers_fnt_TILE_W), y_off + 1,
|
144
|
148
|
numbers_fnt_WIDTH / numbers_fnt_TILE_W, 1,
|
145
|
|
- numbers_fnt_map + off + (sizeof(numbers_fnt_map) / 2), fnt_off,
|
146
|
|
- (is_black ? num_attr_2 : num_attr_1) + off);
|
|
149
|
+ numbers_fnt_map + off + (sizeof(numbers_fnt_map) / 2), fnt_off, BANK(numbers_fnt),
|
|
150
|
+ (is_black ? num_attr_2 : num_attr_1) + off, BANK(maps));
|
147
|
151
|
}
|
148
|
152
|
|
149
|
153
|
static uint8_t number(int32_t score, uint8_t x_off, uint8_t y_off, uint8_t is_black) NONBANKED {
|
|
@@ -190,10 +194,9 @@ void win_splash_draw(int32_t lowest, int32_t highest) NONBANKED {
|
190
|
194
|
}
|
191
|
195
|
|
192
|
196
|
void win_score_clear(uint8_t is_black) NONBANKED {
|
193
|
|
- SWITCH_ROM(BANK(title_map));
|
194
|
197
|
set_win_based(0, 0,
|
195
|
198
|
title_map_WIDTH / title_map_TILE_W, title_map_HEIGHT / title_map_TILE_H,
|
196
|
|
- title_map_map, 0, title_map_MAP_ATTRIBUTES);
|
|
199
|
+ title_map_map, 0, BANK(title_map), title_map_MAP_ATTRIBUTES, BANK(title_map));
|
197
|
200
|
|
198
|
201
|
str(is_black ? "black" : "white", 10 - 5, 1, is_black);
|
199
|
202
|
}
|
|
@@ -204,13 +207,12 @@ void win_score_draw(struct scores score, uint8_t off, uint8_t is_black) NONBANKE
|
204
|
207
|
}
|
205
|
208
|
|
206
|
209
|
void win_name(int32_t score) NONBANKED {
|
207
|
|
- SWITCH_ROM(BANK(title_map));
|
208
|
210
|
set_win_based(0, 0,
|
209
|
211
|
title_map_WIDTH / title_map_TILE_W, title_map_HEIGHT / title_map_TILE_H,
|
210
|
|
- title_map_map, 0, title_map_MAP_ATTRIBUTES);
|
|
212
|
+ title_map_map, 0, BANK(title_map), title_map_MAP_ATTRIBUTES, BANK(title_map));
|
211
|
213
|
|
212
|
214
|
str("score", 10 - 5, 1, score < 0);
|
213
|
|
- number(score, 0xFF, 3, score < 0);
|
|
215
|
+ number(score < 0 ? -score : score, 0xFF, 3, score < 0);
|
214
|
216
|
|
215
|
217
|
str("enter", 10 - 5, 6, score < 0);
|
216
|
218
|
str("name", 10 - 4, 8, score < 0);
|