|
@@ -77,7 +77,7 @@ void pdex_main_box_species_fill(s8 n, u16 species, bool seen, bool caught) {
|
77
|
77
|
|
78
|
78
|
void pdex_update_balls(void) {
|
79
|
79
|
for (u8 i = 0; i < 8; ++i) {
|
80
|
|
- if (pokedex_context->lookup[i + pokedex_context->cursor_position_top].caught)
|
|
80
|
+ if (pdex_lazy_lookup_entry(i + pokedex_context->cursor_position_top)->caught)
|
81
|
81
|
OBJID_SHOW(pokedex_context->ball_oams[i]);
|
82
|
82
|
else
|
83
|
83
|
OBJID_HIDE(pokedex_context->ball_oams[i]);
|
|
@@ -87,8 +87,8 @@ void pdex_update_balls(void) {
|
87
|
87
|
void pdex_update_page_full() {
|
88
|
88
|
rboxid_clear_pixels(TB_MAIN, 0);
|
89
|
89
|
for (u16 i = pokedex_context->cursor_position_top; i < pokedex_context->cursor_position_top + 8; ++i) {
|
90
|
|
- pdex_main_box_species_fill(i - pokedex_context->cursor_position_top, pokedex_context->lookup[i].species,
|
91
|
|
- pokedex_context->lookup[i].seen, pokedex_context->lookup[i].caught);
|
|
90
|
+ pdex_main_box_species_fill(i - pokedex_context->cursor_position_top, pdex_lazy_lookup_entry(i)->species,
|
|
91
|
+ pdex_lazy_lookup_entry(i)->seen, pdex_lazy_lookup_entry(i)->caught);
|
92
|
92
|
}
|
93
|
93
|
pdex_update_balls();
|
94
|
94
|
rboxid_update_tilemap_and_tileset(TB_MAIN);
|
|
@@ -309,23 +309,7 @@ void pdex_load_scroll_ui(void) {
|
309
|
309
|
}
|
310
|
310
|
|
311
|
311
|
void pdex_data_setup(void) {
|
312
|
|
- /* fill the LUT */
|
313
|
|
- /* TODO: get data from various pokedex lists */
|
314
|
|
- pokedex_context->lookup = malloc_and_clear((PDEX_LAST_SHOWN + 1) * sizeof(struct PdexLookup));
|
315
|
|
- bool first = false;
|
316
|
|
- for (u32 i = 0; i <= PDEX_LAST_SHOWN; ++i) {
|
317
|
|
- u16 species = pokedex_index_to_species(i);
|
318
|
|
- if (species > 0) {
|
319
|
|
- pokedex_context->lookup[i].species = species;
|
320
|
|
- pokedex_context->lookup[i].seen = dex_flag_pokedex_index(i, DEX_FLAG_CHECK_SEEN);
|
321
|
|
- pokedex_context->lookup[i].caught = dex_flag_pokedex_index(i, DEX_FLAG_CHECK_CAUGHT);
|
322
|
|
- if (!first && (pokedex_context->lookup[i].seen)) {
|
323
|
|
- pokedex_context->first_seen = 1; //i
|
324
|
|
- //pokedex_context->cursor_position_top = 1; //i is set in region dex
|
325
|
|
- first = true;
|
326
|
|
- }
|
327
|
|
- }
|
328
|
|
- }
|
|
312
|
+ pokedex_context->first_seen = 1;
|
329
|
313
|
}
|
330
|
314
|
|
331
|
315
|
void pdex_hardware_scroll(bool up) {
|
|
@@ -351,14 +335,14 @@ void pdex_hardware_scroll(bool up) {
|
351
|
335
|
|
352
|
336
|
void pdex_fill_previous_slot(void) {
|
353
|
337
|
u16 pIndex = pokedex_context->cursor_position_top - 1;
|
354
|
|
- pdex_main_box_species_fill(-1, pokedex_context->lookup[pIndex].species, pokedex_context->lookup[pIndex].seen,
|
355
|
|
- pokedex_context->lookup[pIndex].caught);
|
|
338
|
+ pdex_main_box_species_fill(-1, pdex_lazy_lookup_entry(pIndex)->species, pdex_lazy_lookup_entry(pIndex)->seen,
|
|
339
|
+ pdex_lazy_lookup_entry(pIndex)->caught);
|
356
|
340
|
}
|
357
|
341
|
|
358
|
342
|
void pdex_fill_next_slot(void) {
|
359
|
343
|
u16 pIndex = pokedex_context->cursor_position_top + 8;
|
360
|
|
- pdex_main_box_species_fill(8, pokedex_context->lookup[pIndex].species, pokedex_context->lookup[pIndex].seen,
|
361
|
|
- pokedex_context->lookup[pIndex].caught);
|
|
344
|
+ pdex_main_box_species_fill(8, pdex_lazy_lookup_entry(pIndex)->species, pdex_lazy_lookup_entry(pIndex)->seen,
|
|
345
|
+ pdex_lazy_lookup_entry(pIndex)->caught);
|
362
|
346
|
}
|
363
|
347
|
|
364
|
348
|
void pdex_try_advance(u8 reverse) {
|
|
@@ -385,10 +369,10 @@ void pdex_try_advance(u8 reverse) {
|
385
|
369
|
}
|
386
|
370
|
|
387
|
371
|
u16 pkIndexToLoad = pokedex_context->cursor_position_internal + pokedex_context->cursor_position_top;
|
388
|
|
- if (pokedex_context->lookup[pkIndexToLoad].seen || pokedex_context->lookup[pkIndexToLoad].caught)
|
389
|
|
- pdex_pokemon_load(pokedex_context->lookup[pkIndexToLoad].species);
|
|
372
|
+ if (pdex_lazy_lookup_entry(pkIndexToLoad)->seen || pdex_lazy_lookup_entry(pkIndexToLoad)->caught)
|
|
373
|
+ pdex_pokemon_load(pdex_lazy_lookup_entry(pkIndexToLoad)->species);
|
390
|
374
|
else
|
391
|
|
- pdex_pokemon_load(pokedex_context->lookup[pkIndexToLoad].species); /* debug, just display the mofo */
|
|
375
|
+ pdex_pokemon_load(pdex_lazy_lookup_entry(pkIndexToLoad)->species); /* debug, just display the mofo */
|
392
|
376
|
pdex_update_balls();
|
393
|
377
|
}
|
394
|
378
|
|
|
@@ -409,7 +393,7 @@ void pdex_loop(u8 tid) {
|
409
|
393
|
|
410
|
394
|
pdex_pokeballs_init();
|
411
|
395
|
pdex_load_scroll_ui();
|
412
|
|
- pdex_pokemon_load(pokedex_context->lookup[pokedex_context->cursor_position_top + pokedex_context->cursor_position_internal].species);
|
|
396
|
+ pdex_pokemon_load(pdex_lazy_lookup_entry(pokedex_context->cursor_position_top + pokedex_context->cursor_position_internal)->species);
|
413
|
397
|
pdex_load_sc();
|
414
|
398
|
pdex_update_page_full();
|
415
|
399
|
|