DragonflySotS 6 년 전
부모
커밋
6c071538ee
3개의 변경된 파일45개의 추가작업 그리고 25개의 파일을 삭제
  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 파일 보기

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

+ 2
- 0
src/pokedex/pokedex_common.h 파일 보기

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

+ 38
- 21
src/pokedex/pokedex_region.c 파일 보기

@@ -28,25 +28,16 @@ u8 region_text_y_offset[] = {7, 7, 7, 2, 2, 2, 2};
28 28
 u8 region_select_x_offset[] = {54, 128, 198, 38, 97, 156, 215};
29 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 42
 bool sm_pdex_init(void) {
52 43
     if (pal_fade_control.active)
@@ -147,9 +138,9 @@ void region_loop(u8 tid) {
147 138
 
148 139
         region_load_border();
149 140
         region_load_icon_palettes();
150
-        for(u8 i = 0; i < 21; ++i)
141
+        for (u8 i = 0; i < 21; ++i)
151 142
             region_load_icon(i);
152
-        
143
+
153 144
         palette_bg_faded_fill_black();
154 145
         pokedex_context->state++;
155 146
         break;
@@ -184,11 +175,37 @@ void region_loop(u8 tid) {
184 175
             if ((pokedex_context->region_selected > 2) && (pokedex_context->region_selected < 6))
185 176
                 pokedex_context->region_selected -= 3;
186 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 185
         default:
188 186
             break;
189 187
         }
190 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 207
     default:
208
+
192 209
         break;
193 210
     }
194 211
 }