|
@@ -0,0 +1,91 @@
|
|
1
|
+#include <agb_debug.h>
|
|
2
|
+#include <pokeagb/pokeagb.h>
|
|
3
|
+#include <pokedex/pdexDetailBg.h>
|
|
4
|
+
|
|
5
|
+#include "pokedex_common.h"
|
|
6
|
+
|
|
7
|
+#define TB_PKNAME 0
|
|
8
|
+#define TB_PKSIZE 2
|
|
9
|
+#define TB_PKWEIGHT 3
|
|
10
|
+#define TB_DESC 2
|
|
11
|
+
|
|
12
|
+#define TB_PKNAME_W 30
|
|
13
|
+#define TB_SW_W 20
|
|
14
|
+
|
|
15
|
+extern pchar pdex_entry_debug[];
|
|
16
|
+extern pchar pdex_str_size[];
|
|
17
|
+extern pchar pdex_str_weight[];
|
|
18
|
+extern pchar pdex_str_size_unit[];
|
|
19
|
+extern pchar pdex_str_weight_unit[];
|
|
20
|
+
|
|
21
|
+struct TextboxTemplate dexdetail_boxes[] = {
|
|
22
|
+ {.bg_id = 0, .x = 0, .y = 0, .width = TB_PKNAME_W, .height = 4, .pal_id = 15, .charbase = 1},
|
|
23
|
+
|
|
24
|
+ {.bg_id = 1, .x = 1, .y = 0, .width = 28, .height = 20, .pal_id = 15, .charbase = 121},
|
|
25
|
+
|
|
26
|
+ {.bg_id = 0xFF},
|
|
27
|
+};
|
|
28
|
+
|
|
29
|
+void dexdetail_load_pokemon(u16 dexindex) {
|
|
30
|
+ u16 species = pokedex_context->lookup[dexindex].species;
|
|
31
|
+ rboxid_clear_pixels(TB_PKNAME, 0);
|
|
32
|
+ u16 twidth = font_get_width_of_string(FONT_DEX_STD, &pokemon_names[species][0], 0x0000);
|
|
33
|
+ //rboxid_print(TB_PKNAME, FONT_DEX_STD, TB_STD_CENTER(twidth,8*TB_PKNAME_W), 0, &pdex_text_color, 0, &pokemon_names[species][0]);
|
|
34
|
+ rboxid_print(TB_PKNAME, FONT_DEX_STD, 0, 0, &pdex_text_color, 0, pdex_entry_debug);
|
|
35
|
+ pchar *strType = &pokedex_data[dexindex].category_name[0];
|
|
36
|
+ u16 typeTwidth = font_get_width_of_string(FONT_DEX_STD, strType, 0x0000);
|
|
37
|
+ rboxid_print(TB_PKNAME, FONT_DEX_STD, 50, 16, &pdex_text_color, 0, strType);
|
|
38
|
+ rboxid_update_tilemap_and_tileset(TB_PKNAME);
|
|
39
|
+
|
|
40
|
+}
|
|
41
|
+
|
|
42
|
+void dexdetail_loop(u8 tid) {
|
|
43
|
+ (void)tid;
|
|
44
|
+ switch (pokedex_context->state) {
|
|
45
|
+ case 0:
|
|
46
|
+ bgid_send_tilemap(2);
|
|
47
|
+ // rboxid_fill_rectangle(4, 1, 0, 0, 28 * 8, 20 * 8);
|
|
48
|
+ dexdetail_load_pokemon(pokedex_context->cursor_position_top + pokedex_context->cursor_position_internal);
|
|
49
|
+ //rboxid_clear_pixels(TB_DESC, 0);
|
|
50
|
+ //rboxid_print(TB_DESC, FONT_DEX_STD, 3, 2, &pdex_text_color, 0, pdex_entry_debug);
|
|
51
|
+ //rboxid_update_tilemap_and_tileset(TB_DESC);
|
|
52
|
+
|
|
53
|
+ palette_bg_faded_fill_black();
|
|
54
|
+ pokedex_context->state++;
|
|
55
|
+ break;
|
|
56
|
+ case 1:
|
|
57
|
+ gpu_sync_bg_show(0);
|
|
58
|
+ gpu_sync_bg_show(1);
|
|
59
|
+ gpu_sync_bg_hide(3);
|
|
60
|
+
|
|
61
|
+ gpu_sync_bg_show(2);
|
|
62
|
+ fade_screen(0xFFFFFFFF, PDEX_FADEIN_SPD, 16, 0, 0x0000);
|
|
63
|
+ pokedex_context->state++;
|
|
64
|
+ break;
|
|
65
|
+ default:
|
|
66
|
+ break;
|
|
67
|
+ }
|
|
68
|
+}
|
|
69
|
+
|
|
70
|
+void dexdetail_load_gfx(void) {
|
|
71
|
+ rbox_init_from_templates(&dexdetail_boxes[0]);
|
|
72
|
+ lz77UnCompVram(pdexDetailBgTiles, (void *)0x0600C000);
|
|
73
|
+ LZ77UnCompWram(pdexDetailBgMap, bgid_get_tilemap(2));
|
|
74
|
+ gpu_pal_apply_compressed(pdexDetailBgPal, 0, 32);
|
|
75
|
+ gpu_pal_apply(pdex_text_pal, 15 * 16, 32);
|
|
76
|
+
|
|
77
|
+ lcd_io_set(REG_ID_WIN0H, (8 << 8) | (232));
|
|
78
|
+ lcd_io_set(REG_ID_WIN0V, ((100 << 8) | (160)));
|
|
79
|
+ lcd_io_set(REG_ID_WININ, WIN_BG0 | WIN_BG1 | WIN_BG2 | WIN_BG3 | WIN_OBJ);
|
|
80
|
+ lcd_io_set(REG_ID_WINOUT, WIN_BG0 | WIN_BG2 | WIN_BG3 | WIN_OBJ);
|
|
81
|
+ bgid_mod_y_offset(1, -24576, 1);
|
|
82
|
+ bgid_mark_for_sync(0);
|
|
83
|
+}
|
|
84
|
+
|
|
85
|
+void dexdetail_load(void) {
|
|
86
|
+ pdex_vram_setup();
|
|
87
|
+ dexdetail_load_gfx();
|
|
88
|
+ pokedex_context->state = 0;
|
|
89
|
+ task_add(dexdetail_loop, 0);
|
|
90
|
+ set_callback2(pdex_cb_handler);
|
|
91
|
+}
|