Browse Source

pokedex files touched

SBird1337 6 years ago
parent
commit
ddce27690a
3 changed files with 45 additions and 25 deletions
  1. 5
    4
      src/pokedex/pokedex.c
  2. 2
    0
      src/pokedex/pokedex_common.h
  3. 38
    21
      src/pokedex/pokedex_region.c

+ 5
- 4
src/pokedex/pokedex.c View File

68
 }
68
 }
69
 
69
 
70
 void pdex_main_box_species_fill(s8 n, u16 species, bool seen, bool caught) {
70
 void pdex_main_box_species_fill(s8 n, u16 species, bool seen, bool caught) {
71
+    seen = true;
71
     s16 y = pdex_get_y_offset(n);
72
     s16 y = pdex_get_y_offset(n);
72
     dprintf("trying to print box to y: %d\n", y);
73
     dprintf("trying to print box to y: %d\n", y);
73
     rboxid_fill_rectangle(TB_MAIN, 0, 0, y, 11 * 8, 16);
74
     rboxid_fill_rectangle(TB_MAIN, 0, 0, y, 11 * 8, 16);
332
             pokedex_context->lookup[i].seen = dex_flag_pokedex_index(i, DEX_FLAG_CHECK_SEEN);
333
             pokedex_context->lookup[i].seen = dex_flag_pokedex_index(i, DEX_FLAG_CHECK_SEEN);
333
             pokedex_context->lookup[i].caught = dex_flag_pokedex_index(i, DEX_FLAG_CHECK_CAUGHT);
334
             pokedex_context->lookup[i].caught = dex_flag_pokedex_index(i, DEX_FLAG_CHECK_CAUGHT);
334
             if (!first && (pokedex_context->lookup[i].seen)) {
335
             if (!first && (pokedex_context->lookup[i].seen)) {
335
-                pokedex_context->first_seen = i;
336
-                pokedex_context->cursor_position_top = i;
336
+                pokedex_context->first_seen = 1; //i
337
+                pokedex_context->cursor_position_top = 1; //i
337
                 first = true;
338
                 first = true;
338
             }
339
             }
339
         }
340
         }
397
     if (pokedex_context->lookup[pkIndexToLoad].seen || pokedex_context->lookup[pkIndexToLoad].caught)
398
     if (pokedex_context->lookup[pkIndexToLoad].seen || pokedex_context->lookup[pkIndexToLoad].caught)
398
         pdex_pokemon_load(pokedex_context->lookup[pkIndexToLoad].species);
399
         pdex_pokemon_load(pokedex_context->lookup[pkIndexToLoad].species);
399
     else
400
     else
400
-        pdex_pokemon_load(0);
401
+        pdex_pokemon_load(pokedex_context->lookup[pkIndexToLoad].species); /* debug, just display the mofo */
401
     pdex_update_balls();
402
     pdex_update_balls();
402
 }
403
 }
403
 
404
 
493
     pdex_load_gfx();
494
     pdex_load_gfx();
494
 
495
 
495
     pokedex_context->pokemon_oam = -1;
496
     pokedex_context->pokemon_oam = -1;
496
-
497
+    pokedex_context->state = 0;
497
     task_add(pdex_loop, 0);
498
     task_add(pdex_loop, 0);
498
     set_callback2(pdex_cb_handler);
499
     set_callback2(pdex_cb_handler);
499
 }
500
 }

+ 2
- 0
src/pokedex/pokedex_common.h View File

33
 void pdex_vblank_handler(void);
33
 void pdex_vblank_handler(void);
34
 void pdex_vram_setup(void);
34
 void pdex_vram_setup(void);
35
 
35
 
36
+void pdex_load(void);
37
+
36
 const u16 pdex_text_pal[16];
38
 const u16 pdex_text_pal[16];
37
 const struct BgConfig pdex_bg_config[4];
39
 const struct BgConfig pdex_bg_config[4];
38
 struct TextColor pdex_text_color;
40
 struct TextColor pdex_text_color;

+ 38
- 21
src/pokedex/pokedex_region.c View File

28
 u8 region_select_x_offset[] = {54, 128, 198, 38, 97, 156, 215};
28
 u8 region_select_x_offset[] = {54, 128, 198, 38, 97, 156, 215};
29
 u8 region_select_y_offset[] = {40, 40, 40, 115, 115, 115, 115};
29
 u8 region_select_y_offset[] = {40, 40, 40, 115, 115, 115, 115};
30
 
30
 
31
-u16 region_icons[] = {PKMN_BISASAM,   PKMN_SCHIGGY,  PKMN_GLUMANDA, PKMN_ENDIVIE, PKMN_KARNIMANI, PKMN_FEURIGEL,
32
-                     PKMN_GECKARBOR, PKMN_HYDROPI, PKMN_FLEMMLI,  PKMN_CHELAST, PKMN_PLINFA,    PKMN_PANFLAM,
33
-                     PKMN_SERPIFEU,  PKMN_OTTARO,  PKMN_FLOINK,   PKMN_IGAMARO, PKMN_FROXY,     PKMN_FYNX,
34
-                     PKMN_BAUZ,      PKMN_ROBBALL, PKMN_FLAMIAU};
35
-
36
-u16 region_icons_x_offset[] = {37, 49, 58, 110, 122, 133, 182, 193, 206,
37
-                               22, 33, 43,
38
-                               80, 93, 103,
39
-                               139, 150, 161,
40
-                               196, 207, 219};
41
-
42
-u16 region_icons_y_offset[] = {39,  17,  39,
43
-                               39,  19,  39,
44
-                               39,  19,  39,
45
-                               117, 94, 116,
46
-                               116, 95, 115,
47
-                               116, 95, 116,
48
-                               120, 99, 120
49
-};
31
+u16 region_icons[] = {PKMN_BISASAM,   PKMN_SCHIGGY, PKMN_GLUMANDA, PKMN_ENDIVIE, PKMN_KARNIMANI, PKMN_FEURIGEL,
32
+                      PKMN_GECKARBOR, PKMN_HYDROPI, PKMN_FLEMMLI,  PKMN_CHELAST, PKMN_PLINFA,    PKMN_PANFLAM,
33
+                      PKMN_SERPIFEU,  PKMN_OTTARO,  PKMN_FLOINK,   PKMN_IGAMARO, PKMN_FROXY,     PKMN_FYNX,
34
+                      PKMN_BAUZ,      PKMN_ROBBALL, PKMN_FLAMIAU};
35
+
36
+u16 region_icons_x_offset[] = {37, 49, 58, 110, 122, 133, 182, 193, 206, 22, 33,
37
+                               43, 80, 93, 103, 139, 150, 161, 196, 207, 219};
38
+
39
+u16 region_icons_y_offset[] = {39,  17,  39, 39,  19,  39, 39,  19,  39, 117, 94,
40
+                               116, 116, 95, 115, 116, 95, 116, 120, 99, 120};
50
 
41
 
51
 bool sm_pdex_init(void) {
42
 bool sm_pdex_init(void) {
52
     if (pal_fade_control.active)
43
     if (pal_fade_control.active)
147
 
138
 
148
         region_load_border();
139
         region_load_border();
149
         region_load_icon_palettes();
140
         region_load_icon_palettes();
150
-        for(u8 i = 0; i < 21; ++i)
141
+        for (u8 i = 0; i < 21; ++i)
151
             region_load_icon(i);
142
             region_load_icon(i);
152
-        
143
+
153
         palette_bg_faded_fill_black();
144
         palette_bg_faded_fill_black();
154
         pokedex_context->state++;
145
         pokedex_context->state++;
155
         break;
146
         break;
184
             if ((pokedex_context->region_selected > 2) && (pokedex_context->region_selected < 6))
175
             if ((pokedex_context->region_selected > 2) && (pokedex_context->region_selected < 6))
185
                 pokedex_context->region_selected -= 3;
176
                 pokedex_context->region_selected -= 3;
186
             break;
177
             break;
178
+        case KEY_A:
179
+            fade_screen(0xFFFFFFFF, PDEX_FADEIN_SPD, 0, 16, 0x0000);
180
+            pokedex_context->state = 10;
181
+            break;
182
+        case KEY_B:
183
+            fade_screen(0xFFFFFFFF, PDEX_FADEIN_SPD, 0, 16, 0x0000);
184
+            pokedex_context->state = 11;
187
         default:
185
         default:
188
             break;
186
             break;
189
         }
187
         }
190
         break;
188
         break;
189
+    case 10:
190
+        if (!pal_fade_control.active) {
191
+            task_del(tid);
192
+            if(bgid_get_tilemap(2) != NULL)
193
+                free(bgid_get_tilemap(2));
194
+            set_callback2(pdex_load);
195
+        }
196
+        break;
197
+    case 11:
198
+        if (!pal_fade_control.active) {
199
+            task_del(tid);
200
+            if(pokedex_context->lookup != NULL)
201
+                free(pokedex_context->lookup);
202
+            free(pokedex_context);
203
+            set_callback2(c2_overworld_switch_start_menu);
204
+            set_callback1(c1_overworld);
205
+        }
206
+        break;
191
     default:
207
     default:
208
+
192
         break;
209
         break;
193
     }
210
     }
194
 }
211
 }