|
@@ -48,9 +48,12 @@ static void get_sp(void) {
|
48
|
48
|
__endasm;
|
49
|
49
|
}
|
50
|
50
|
|
51
|
|
-static void fill_win(uint8_t x, uint8_t y, uint8_t w, uint8_t h, uint8_t tile, uint8_t attr) {
|
52
|
|
- VBK_REG = VBK_ATTRIBUTES;
|
53
|
|
- fill_win_rect(x, y, w, h, attr);
|
|
51
|
+void fill_win(uint8_t x, uint8_t y, uint8_t w, uint8_t h, uint8_t tile, uint8_t attr) BANKED {
|
|
52
|
+ if (_cpu == CGB_TYPE) {
|
|
53
|
+ VBK_REG = VBK_ATTRIBUTES;
|
|
54
|
+ fill_win_rect(x, y, w, h, attr);
|
|
55
|
+ }
|
|
56
|
+
|
54
|
57
|
VBK_REG = VBK_TILES;
|
55
|
58
|
fill_win_rect(x, y, w, h, tile);
|
56
|
59
|
}
|
|
@@ -72,8 +75,8 @@ void win_splash_mp(void) BANKED {
|
72
|
75
|
static uint8_t prev = 0;
|
73
|
76
|
if ((_cpu == CGB_TYPE) && (mp_connection_status != prev)) {
|
74
|
77
|
prev = mp_connection_status;
|
75
|
|
- char c = mp_connection_status & 0x1F;
|
76
|
|
- str_ascii_l(&c, 1, 19, 0, 1);
|
|
78
|
+ char c = mp_connection_status % SPINNER_LENGTH;
|
|
79
|
+ str_ascii_l(&get_string(STR_SPINNER)[c], 1, 19, 0, 0);
|
77
|
80
|
}
|
78
|
81
|
}
|
79
|
82
|
|
|
@@ -126,12 +129,6 @@ static void get_git(char *line_buff) NONBANKED {
|
126
|
129
|
} END_ROM_BANK
|
127
|
130
|
}
|
128
|
131
|
|
129
|
|
-void win_str_center(const char *s, uint8_t y_off, uint8_t is_black) NONBANKED {
|
130
|
|
- START_ROM_BANK(BANK(text)) {
|
131
|
|
- str_center(s, y_off, is_black);
|
132
|
|
- } END_ROM_BANK
|
133
|
|
-}
|
134
|
|
-
|
135
|
132
|
void win_about(void) BANKED {
|
136
|
133
|
map_fill(MAP_TITLE, 0);
|
137
|
134
|
|
|
@@ -170,8 +167,8 @@ void win_about_mp(void) BANKED {
|
170
|
167
|
static uint8_t prev = 0;
|
171
|
168
|
if ((_cpu == CGB_TYPE) && (mp_connection_status != prev)) {
|
172
|
169
|
prev = mp_connection_status;
|
173
|
|
- char c = mp_connection_status & 0x7F;
|
174
|
|
- str_ascii_l(&c, 1, 19, 12, 1);
|
|
170
|
+ uint8_t c = mp_connection_status % SPINNER_LENGTH;
|
|
171
|
+ str_ascii_l(&get_string(STR_SPINNER)[c], 1, 19, 12, 1);
|
175
|
172
|
}
|
176
|
173
|
}
|
177
|
174
|
|
|
@@ -200,15 +197,12 @@ static uint8_t get_debug(char *name_buff, uint8_t i) NONBANKED {
|
200
|
197
|
void win_debug(void) BANKED {
|
201
|
198
|
map_fill(MAP_TITLE, 0);
|
202
|
199
|
|
203
|
|
- // TODO prettier pagination
|
204
|
|
- uint8_t off = (10 - (DEBUG_ENTRY_COUNT - debug_menu_index)) / 2;
|
205
|
|
-
|
206
|
200
|
str_center(get_string(STR_DEBUG_MENU), 0, 0);
|
207
|
201
|
|
208
|
|
- for (uint8_t i = debug_menu_index; (i < DEBUG_ENTRY_COUNT) && (i < (8 + debug_menu_index)); i++) {
|
|
202
|
+ for (uint8_t i = debug_menu_index; i < (8 + debug_menu_index); i++) {
|
209
|
203
|
char name_buff[ENTRY_NAME_LEN + 2 + 1] = {0};
|
210
|
|
- uint8_t n_len = get_debug(name_buff, i);
|
211
|
|
- str(name_buff, (TEXT_LINE_WIDTH - n_len) * 2, ((i - debug_menu_index) * 2) + 3 + off, (debug_menu_index == i) ? 1 : 0);
|
|
204
|
+ uint8_t n_len = get_debug(name_buff, i % DEBUG_ENTRY_COUNT);
|
|
205
|
+ str(name_buff, (TEXT_LINE_WIDTH - n_len) * 2, ((i - debug_menu_index) * 2) + 3, (debug_menu_index == i) ? 1 : 0);
|
212
|
206
|
}
|
213
|
207
|
}
|
214
|
208
|
|
|
@@ -288,9 +282,12 @@ uint8_t win_game_draw(int32_t score, uint8_t initial) BANKED {
|
288
|
282
|
|
289
|
283
|
// TODO support one debug value on DMG
|
290
|
284
|
if ((_cpu == CGB_TYPE) && (conf_get()->debug_flags & DBG_OUT_ON)) {
|
|
285
|
+ uint8_t redraw = 0;
|
|
286
|
+
|
291
|
287
|
static int32_t prev_score = 0;
|
292
|
288
|
if (initial || (score != prev_score)) {
|
293
|
289
|
prev_score = score;
|
|
290
|
+ redraw = 1;
|
294
|
291
|
|
295
|
292
|
// TODO hard-coded black bg tile
|
296
|
293
|
fill_win(0, 0, 20, 2, 0x80, BKGF_CGB_PAL3);
|
|
@@ -302,7 +299,7 @@ uint8_t win_game_draw(int32_t score, uint8_t initial) BANKED {
|
302
|
299
|
if ((conf_get()->debug_flags & DBG_SHOW_FPS) && (y_off < 2)) {
|
303
|
300
|
static uint8_t prev_fps = 0;
|
304
|
301
|
uint8_t fps = game_get_fps();
|
305
|
|
- if (fps != prev_fps) {
|
|
302
|
+ if ((fps != prev_fps) || redraw) {
|
306
|
303
|
prev_fps = fps;
|
307
|
304
|
sprintf(str_buff, get_string(STR_PRINTF_FPS), (uint8_t)fps);
|
308
|
305
|
str_ascii(str_buff, x_off, y_off, 1);
|
|
@@ -313,7 +310,7 @@ uint8_t win_game_draw(int32_t score, uint8_t initial) BANKED {
|
313
|
310
|
if ((conf_get()->debug_flags & DBG_SHOW_FRAMES) && (y_off < 2)) {
|
314
|
311
|
static uint16_t prev_framecount = 0;
|
315
|
312
|
uint16_t framecount = game_get_framecount();
|
316
|
|
- if (framecount != prev_framecount) {
|
|
313
|
+ if ((framecount != prev_framecount) || redraw) {
|
317
|
314
|
prev_framecount = framecount;
|
318
|
315
|
sprintf(str_buff, get_string(STR_PRINTF_FRAMES), (uint16_t)framecount);
|
319
|
316
|
str_ascii(str_buff, x_off, y_off, 1);
|
|
@@ -324,7 +321,7 @@ uint8_t win_game_draw(int32_t score, uint8_t initial) BANKED {
|
324
|
321
|
if ((conf_get()->debug_flags & DBG_SHOW_TIMER) && (y_off < 2)) {
|
325
|
322
|
static uint16_t prev_timer = 0;
|
326
|
323
|
uint16_t timer = timer_get();
|
327
|
|
- if (timer != prev_timer) {
|
|
324
|
+ if ((timer != prev_timer) || redraw) {
|
328
|
325
|
sprintf(str_buff, get_string(STR_PRINTF_TIMER), (uint16_t)timer);
|
329
|
326
|
str_ascii(str_buff, x_off, y_off, 1);
|
330
|
327
|
}
|
|
@@ -334,7 +331,7 @@ uint8_t win_game_draw(int32_t score, uint8_t initial) BANKED {
|
334
|
331
|
if ((conf_get()->debug_flags & DBG_SHOW_STACK) && (y_off < 2)) {
|
335
|
332
|
static uint16_t prev_stack_pointer = 0;
|
336
|
333
|
get_sp();
|
337
|
|
- if (stack_pointer != prev_stack_pointer) {
|
|
334
|
+ if ((stack_pointer != prev_stack_pointer) || redraw) {
|
338
|
335
|
prev_stack_pointer = stack_pointer;
|
339
|
336
|
sprintf(str_buff, get_string(STR_PRINTF_STACK), (uint16_t)stack_pointer);
|
340
|
337
|
str_ascii(str_buff, x_off, y_off, 1);
|