|
@@ -23,6 +23,7 @@
|
23
|
23
|
|
24
|
24
|
#include "banks.h"
|
25
|
25
|
#include "config.h"
|
|
26
|
+#include "gb/hardware.h"
|
26
|
27
|
#include "score.h"
|
27
|
28
|
#include "text.h"
|
28
|
29
|
#include "git.h"
|
|
@@ -32,10 +33,14 @@
|
32
|
33
|
#include "gbprinter.h"
|
33
|
34
|
#include "multiplayer.h"
|
34
|
35
|
#include "strings.h"
|
|
36
|
+#include "timer.h"
|
|
37
|
+#include "game.h"
|
35
|
38
|
#include "window.h"
|
36
|
39
|
|
37
|
40
|
BANKREF(window)
|
38
|
41
|
|
|
42
|
+static char str_buff[128];
|
|
43
|
+
|
39
|
44
|
static void fill_win(uint8_t x, uint8_t y, uint8_t w, uint8_t h, uint8_t tile, uint8_t attr) {
|
40
|
45
|
VBK_REG = VBK_ATTRIBUTES;
|
41
|
46
|
fill_win_rect(x, y, w, h, attr);
|
|
@@ -67,7 +72,7 @@ void win_splash_mp(void) BANKED {
|
67
|
72
|
|
68
|
73
|
void win_score_clear(uint8_t is_black, uint8_t no_bg) BANKED {
|
69
|
74
|
if (no_bg) {
|
70
|
|
- fill_win(0, 0, DEVICE_SCREEN_WIDTH, DEVICE_SCREEN_HEIGHT, 1, 0x00);
|
|
75
|
+ fill_win(0, 0, DEVICE_SCREEN_WIDTH, DEVICE_SCREEN_HEIGHT, 1, BKGF_CGB_PAL0);
|
71
|
76
|
} else {
|
72
|
77
|
map_fill(MAP_TITLE, 0);
|
73
|
78
|
}
|
|
@@ -83,8 +88,6 @@ void win_score_draw(struct scores score, uint8_t off, uint8_t is_black) BANKED {
|
83
|
88
|
}
|
84
|
89
|
|
85
|
90
|
void win_score_print(enum PRN_STATUS status) BANKED {
|
86
|
|
- static char buff[128];
|
87
|
|
-
|
88
|
91
|
if (_cpu == CGB_TYPE) {
|
89
|
92
|
str_ascii(get_string(STR_GB_PRINTER), 0, 0, 0);
|
90
|
93
|
str_ascii(get_string(STR_SCORE_PRINTOUT), 0, 1, 0);
|
|
@@ -93,11 +96,11 @@ void win_score_print(enum PRN_STATUS status) BANKED {
|
93
|
96
|
if (status == PRN_STATUS_OK) {
|
94
|
97
|
str_ascii(get_string(STR_SUCCESS), 0, 8, 0);
|
95
|
98
|
} else {
|
96
|
|
- sprintf(buff, get_string(STR_PRINTF_ERROR), (uint16_t)status);
|
97
|
|
- str_ascii(buff, 0, 5, 0);
|
|
99
|
+ sprintf(str_buff, get_string(STR_PRINTF_ERROR), (uint16_t)status);
|
|
100
|
+ str_ascii(str_buff, 0, 5, 0);
|
98
|
101
|
|
99
|
|
- gbprinter_error(status, buff);
|
100
|
|
- str_ascii_lines(buff, 6, 0);
|
|
102
|
+ gbprinter_error(status, str_buff);
|
|
103
|
+ str_ascii_lines(str_buff, 6, 0);
|
101
|
104
|
}
|
102
|
105
|
} else {
|
103
|
106
|
str(get_string(STR_PRINTOUT), 0, 4, 0);
|
|
@@ -256,13 +259,29 @@ void win_name_draw(uint16_t name, uint8_t is_black, uint8_t pos) BANKED {
|
256
|
259
|
}
|
257
|
260
|
|
258
|
261
|
uint8_t win_game_draw(int32_t score) BANKED {
|
259
|
|
- fill_win(0, 0, 10, 2, maps[FNT_ASCII_8].tile_offset, 0x81);
|
260
|
|
-
|
261
|
262
|
uint8_t is_black = 0;
|
262
|
263
|
if (score < 0) {
|
263
|
264
|
score = -score;
|
264
|
265
|
is_black = 1;
|
265
|
266
|
}
|
266
|
267
|
|
267
|
|
- return number(score, 0, 0, is_black);
|
|
268
|
+ if ((_cpu == CGB_TYPE) && (conf_get()->debug_flags)) {
|
|
269
|
+ // TODO hard-coded black bg tile
|
|
270
|
+ fill_win(0, 0, 20, 2, 0x80, BKGF_CGB_PAL3);
|
|
271
|
+
|
|
272
|
+ uint8_t x_off = number(score, 0, 0, is_black) >> 3;
|
|
273
|
+
|
|
274
|
+ sprintf(str_buff, get_string(STR_PRINTF_FRAMES), (uint16_t)game_get_framecount());
|
|
275
|
+ str_ascii(str_buff, x_off + 1, 0, 1);
|
|
276
|
+
|
|
277
|
+ sprintf(str_buff, get_string(STR_PRINTF_TIMER), (uint16_t)timer_get());
|
|
278
|
+ str_ascii(str_buff, x_off + 1, 1, 1);
|
|
279
|
+
|
|
280
|
+ return DEVICE_SCREEN_PX_WIDTH;
|
|
281
|
+ } else {
|
|
282
|
+ // TODO hard-coded black bg tile
|
|
283
|
+ fill_win(0, 0, 10, 2, 0x80, BKGF_CGB_PAL3);
|
|
284
|
+
|
|
285
|
+ return number(score, 0, 0, is_black);
|
|
286
|
+ }
|
268
|
287
|
}
|