|
@@ -5,23 +5,23 @@
|
5
|
5
|
#include "pokedex_common.h"
|
6
|
6
|
|
7
|
7
|
#define TB_PKNAME 0
|
8
|
|
-#define TB_PKSIZE 2
|
9
|
|
-#define TB_PKWEIGHT 3
|
|
8
|
+#define TB_PKSIZE 1
|
10
|
9
|
#define TB_DESC 2
|
11
|
10
|
|
12
|
11
|
#define TB_PKNAME_W 30
|
13
|
|
-#define TB_SW_W 20
|
|
12
|
+#define TB_SW_W 12
|
14
|
13
|
|
15
|
14
|
extern pchar pdex_entry_debug[];
|
16
|
15
|
extern pchar pdex_str_size[];
|
17
|
16
|
extern pchar pdex_str_weight[];
|
18
|
17
|
extern pchar pdex_str_size_unit[];
|
19
|
18
|
extern pchar pdex_str_weight_unit[];
|
|
19
|
+extern pchar pdex_str_comma[];
|
20
|
20
|
|
21
|
21
|
struct TextboxTemplate dexdetail_boxes[] = {
|
22
|
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},
|
|
23
|
+ {.bg_id = 0, .x = 17, .y = 5, .width = TB_SW_W, .height = 4, .pal_id = 15, .charbase = 121},
|
|
24
|
+ {.bg_id = 1, .x = 1, .y = 0, .width = 28, .height = 20, .pal_id = 15, .charbase = 161},
|
25
|
25
|
|
26
|
26
|
{.bg_id = 0xFF},
|
27
|
27
|
};
|
|
@@ -29,14 +29,71 @@ struct TextboxTemplate dexdetail_boxes[] = {
|
29
|
29
|
void dexdetail_load_pokemon(u16 dexindex) {
|
30
|
30
|
u16 species = pokedex_context->lookup[dexindex].species;
|
31
|
31
|
rboxid_clear_pixels(TB_PKNAME, 0);
|
|
32
|
+ rboxid_clear_pixels(TB_PKSIZE, 0);
|
|
33
|
+ rboxid_clear_pixels(TB_DESC, 0);
|
32
|
34
|
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
|
+ rboxid_print(TB_PKNAME, FONT_DEX_STD, TB_STD_CENTER(twidth, 8 * TB_PKNAME_W), 0, &pdex_text_color, 0,
|
|
36
|
+ &pokemon_names[species][0]);
|
|
37
|
+
|
35
|
38
|
pchar *strType = &pokedex_data[dexindex].category_name[0];
|
36
|
39
|
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);
|
|
40
|
+ rboxid_print(TB_PKNAME, FONT_DEX_STD, TB_STD_CENTER(typeTwidth, 88) + 110, 14, &pdex_text_color, 0, strType);
|
|
41
|
+ rboxid_print(TB_PKSIZE, FONT_DEX_STD, 4, 1, &pdex_text_color, 0, pdex_str_size);
|
|
42
|
+ rboxid_print(TB_PKSIZE, FONT_DEX_STD, 4, 14, &pdex_text_color, 0, pdex_str_weight);
|
|
43
|
+
|
|
44
|
+ u16 weightNumber = pokedex_data[dexindex].weight / 10;
|
|
45
|
+ u16 weightDecimal = pokedex_data[dexindex].weight % 10;
|
|
46
|
+ pchar buffer[20];
|
|
47
|
+ fmt_int_10(string_buffer, weightNumber, 0, 3);
|
|
48
|
+ fmt_int_10(&buffer[0], weightDecimal, 0, 1);
|
|
49
|
+ pstrcat(string_buffer, pdex_str_comma);
|
|
50
|
+ pstrcat(string_buffer, buffer);
|
|
51
|
+ pstrcat(string_buffer, pdex_str_weight_unit);
|
|
52
|
+ u16 weightTwidth = font_get_width_of_string(FONT_DEX_STD, string_buffer, 0x0000);
|
|
53
|
+
|
|
54
|
+ rboxid_print(TB_PKSIZE, FONT_DEX_STD, TB_STD_RIGHT(weightTwidth, TB_SW_W * 8) - 6, 1, &pdex_text_color, 0,
|
|
55
|
+ string_buffer);
|
|
56
|
+
|
|
57
|
+ u16 sizeNumber = pokedex_data[dexindex].height / 10;
|
|
58
|
+ u16 sizeDecimal = pokedex_data[dexindex].height % 10;
|
|
59
|
+ fmt_int_10(string_buffer, sizeNumber, 0, 3);
|
|
60
|
+ fmt_int_10(&buffer[0], sizeDecimal, 0, 1);
|
|
61
|
+ pstrcat(string_buffer, pdex_str_comma);
|
|
62
|
+ pstrcat(string_buffer, buffer);
|
|
63
|
+ pstrcat(string_buffer, pdex_str_size_unit);
|
|
64
|
+
|
|
65
|
+ rboxid_print(TB_PKSIZE, FONT_DEX_STD, TB_STD_RIGHT(weightTwidth, TB_SW_W * 8) - 6, 14, &pdex_text_color, 0,
|
|
66
|
+ string_buffer);
|
39
|
67
|
|
|
68
|
+ rboxid_print(TB_DESC, FONT_DEX_STD, 3, 2, &pdex_text_color, 0, pokedex_data[dexindex].description1);
|
|
69
|
+
|
|
70
|
+ /* load the species sprite */
|
|
71
|
+ if (pokedex_context->detail_pokemon_oam != -1) {
|
|
72
|
+
|
|
73
|
+ } else {
|
|
74
|
+ struct SpriteTiles pkmnTiles = {pokemon_graphics_front[species].data, 2048, DEX_PKMN_TAG};
|
|
75
|
+ struct SpritePalette pkmnPal = {pokemon_palette_normal[species].data, DEX_PKMN_TAG};
|
|
76
|
+ const struct Template pkmnTemplate = {
|
|
77
|
+ .tiles_tag = DEX_PKMN_TAG,
|
|
78
|
+ .pal_tag = DEX_PKMN_TAG,
|
|
79
|
+ .oam = &pdex_oam_pkmn,
|
|
80
|
+ .animation = &anim_image_empty,
|
|
81
|
+ .graphics = &pkmnTiles,
|
|
82
|
+ .rotscale = &rotscale_empty,
|
|
83
|
+ .callback = oac_nullsub,
|
|
84
|
+ };
|
|
85
|
+ gpu_tile_obj_decompress_alloc_tag_and_upload(&pkmnTiles);
|
|
86
|
+
|
|
87
|
+ gpu_pal_decompress_alloc_tag_and_upload(&pkmnPal);
|
|
88
|
+ pokedex_context->detail_pokemon_oam = (s8)template_instanciate_forward_search(&pkmnTemplate, 10, 10, 0);
|
|
89
|
+
|
|
90
|
+ objects[pokedex_context->detail_pokemon_oam].pos1.x = 55;
|
|
91
|
+ objects[pokedex_context->detail_pokemon_oam].pos1.y = 55;
|
|
92
|
+ }
|
|
93
|
+
|
|
94
|
+ rboxid_update_tilemap_and_tileset(TB_DESC);
|
|
95
|
+ rboxid_update_tilemap_and_tileset(TB_PKNAME);
|
|
96
|
+ rboxid_update_tilemap_and_tileset(TB_PKSIZE);
|
40
|
97
|
}
|
41
|
98
|
|
42
|
99
|
void dexdetail_loop(u8 tid) {
|
|
@@ -44,11 +101,7 @@ void dexdetail_loop(u8 tid) {
|
44
|
101
|
switch (pokedex_context->state) {
|
45
|
102
|
case 0:
|
46
|
103
|
bgid_send_tilemap(2);
|
47
|
|
- // rboxid_fill_rectangle(4, 1, 0, 0, 28 * 8, 20 * 8);
|
48
|
104
|
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
|
105
|
|
53
|
106
|
palette_bg_faded_fill_black();
|
54
|
107
|
pokedex_context->state++;
|
|
@@ -86,6 +139,7 @@ void dexdetail_load(void) {
|
86
|
139
|
pdex_vram_setup();
|
87
|
140
|
dexdetail_load_gfx();
|
88
|
141
|
pokedex_context->state = 0;
|
|
142
|
+ pokedex_context->detail_pokemon_oam = -1;
|
89
|
143
|
task_add(dexdetail_loop, 0);
|
90
|
144
|
set_callback2(pdex_cb_handler);
|
91
|
145
|
}
|