Merge pull request #1586 from GriffinRichards/clean-areascreen

Clean up pokedex_area_screen
This commit is contained in:
GriffinR 2022-01-06 23:02:23 -05:00 committed by GitHub
commit 577e6cc740
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 610 additions and 335 deletions

View File

@ -8,6 +8,7 @@
#include "constants/songs.h"
#include "constants/species.h"
#include "constants/vars.h"
#include "constants/wild_encounter.h"
.include "asm/macros.inc"
.include "asm/macros/event.inc"
.include "constants/constants.inc"

View File

@ -1,7 +1,7 @@
MysteryGiftScript_AlteringCave::
setvaddress MysteryGiftScript_AlteringCave
addvar VAR_ALTERING_CAVE_WILD_SET, 1
vgoto_if_ne VAR_ALTERING_CAVE_WILD_SET, 10, MysteryGiftScript_AlteringCave_
vgoto_if_ne VAR_ALTERING_CAVE_WILD_SET, (NUM_ALTERING_CAVE_TABLES + 1), MysteryGiftScript_AlteringCave_
setvar VAR_ALTERING_CAVE_WILD_SET, 0
MysteryGiftScript_AlteringCave_:
lock

View File

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 18 KiB

View File

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 18 KiB

View File

@ -18,6 +18,7 @@ WALLPAPERGFXDIR := graphics/pokemon_storage/wallpapers
OBJEVENTGFXDIR := graphics/object_events
MISCGFXDIR := graphics/misc
JPCONTESTGFXDIR := graphics/contest/japanese
POKEDEXGFXDIR := graphics/pokedex
types := normal fight flying poison ground rock bug ghost steel mystery fire water grass electric psychic ice dragon dark
contest_types := cool beauty cute smart tough
@ -700,10 +701,10 @@ $(PKNAVGFXDIR)/device_outline.4bpp: %.4bpp: %.png
$(PKNAVGFXDIR)/match_call/ui.4bpp: %.4bpp: %.png
$(GFX) $< $@ -num_tiles 13
$(INTERFACEGFXDIR)/region_map.8bpp: %.8bpp: %.png
$(POKEDEXGFXDIR)/region_map.8bpp: %.8bpp: %.png
$(GFX) $< $@ -num_tiles 232
$(INTERFACEGFXDIR)/region_map_affine.8bpp: %.8bpp: %.png
$(POKEDEXGFXDIR)/region_map_affine.8bpp: %.8bpp: %.png
$(GFX) $< $@ -num_tiles 233
$(MISCGFXDIR)/birch_help.4bpp: $(MISCGFXDIR)/birch_bag.4bpp $(MISCGFXDIR)/birch_grass.4bpp

View File

@ -9,12 +9,6 @@
#define MAP_GROUP(map) (MAP_##map >> 8)
#define MAP_NUM(map) (MAP_##map & 0xFF)
// These groups are used by pokedex_area_screen.c to find wild
// pokemon locations.
#define MAP_GROUP_OVERWORLD_MONS MAP_GROUP(PETALBURG_CITY)
#define MAP_GROUP_SPECIAL_MONS_1 MAP_GROUP(METEOR_FALLS_1F_1R)
#define MAP_GROUP_SPECIAL_MONS_2 MAP_GROUP(SAFARI_ZONE_NORTHWEST)
// IDs for dynamic warps. Both are used in the dest_warp_id field for warp events, but they
// are never read in practice. A dest_map of MAP_NONE is used to indicate that a
// dynamic warp should be used, at which point the warp id is ignored. It can be passed to

View File

@ -0,0 +1,11 @@
#ifndef GUARD_CONSTANTS_WILD_ENCOUNTER_H
#define GUARD_CONSTANTS_WILD_ENCOUNTER_H
#define LAND_WILD_COUNT 12
#define WATER_WILD_COUNT 5
#define ROCK_WILD_COUNT 5
#define FISH_WILD_COUNT 10
#define NUM_ALTERING_CAVE_TABLES 9
#endif // GUARD_CONSTANTS_WILD_ENCOUNTER_H

View File

@ -1,10 +1,7 @@
#ifndef GUARD_WILD_ENCOUNTER_H
#define GUARD_WILD_ENCOUNTER_H
#define LAND_WILD_COUNT 12
#define WATER_WILD_COUNT 5
#define ROCK_WILD_COUNT 5
#define FISH_WILD_COUNT 10
#include "constants/wild_encounter.h"
struct WildPokemon
{

View File

@ -0,0 +1,315 @@
// These tile numbers correspond to the 8x8 tiles in graphics/pokedex/area_glow.png
// Left/Right/Top/Bottom are shortened to L/R/T/B
enum {
GLOW_TILE_EMPTY,
GLOW_TILE_EDGE_R,
GLOW_TILE_EDGE_L,
GLOW_TILE_EDGE_L_R,
GLOW_TILE_EDGE_B,
GLOW_TILE_EDGE_B_R,
GLOW_TILE_EDGE_B_L,
GLOW_TILE_EDGE_B_L_R,
GLOW_TILE_EDGE_T,
GLOW_TILE_EDGE_T_R,
GLOW_TILE_EDGE_T_L,
GLOW_TILE_EDGE_T_L_R,
GLOW_TILE_EDGE_T_B,
GLOW_TILE_EDGE_T_B_R,
GLOW_TILE_EDGE_T_B_L,
GLOW_TILE_EDGE_T_B_L_R, // This tile has a misplaced pixel in the top-left corner
GLOW_TILE_FULL,
GLOW_TILE_CORNER_TL,
GLOW_TILE_CORNER_BL,
GLOW_TILE_CORNER_BL_TL,
GLOW_TILE_CORNER_TR,
GLOW_TILE_CORNER_TR_TL,
GLOW_TILE_CORNER_TR_BL,
GLOW_TILE_CORNER_TR_BL_TL,
GLOW_TILE_CORNER_BR,
GLOW_TILE_CORNER_BR_TL,
GLOW_TILE_CORNER_BR_BL,
GLOW_TILE_CORNER_BR_BL_TL,
GLOW_TILE_CORNER_BR_TR,
GLOW_TILE_CORNER_BR_TR_TL,
GLOW_TILE_CORNER_BR_TR_BL,
GLOW_TILE_CORNER_BR_TR_BL_TL,
GLOW_TILE_EDGE_R_CORNER_TL,
GLOW_TILE_EDGE_R_CORNER_BL,
GLOW_TILE_EDGE_R_CORNER_BL_TL,
GLOW_TILE_EDGE_L_CORNER_TR,
GLOW_TILE_EDGE_L_CORNER_BR,
GLOW_TILE_EDGE_L_CORNER_BR_TR,
GLOW_TILE_EDGE_B_CORNER_TR,
GLOW_TILE_EDGE_B_CORNER_TL,
GLOW_TILE_EDGE_B_CORNER_TL_TR,
GLOW_TILE_EDGE_T_CORNER_BR,
GLOW_TILE_EDGE_T_CORNER_BL,
GLOW_TILE_EDGE_T_CORNER_BL_BR,
GLOW_TILE_EDGE_B_L_CORNER_TR,
GLOW_TILE_EDGE_B_R_CORNER_TL,
GLOW_TILE_EDGE_T_R_CORNER_BL,
GLOW_TILE_EDGE_T_L_CORNER_BR
};
// This array converts a set of glow position flags to one of the above tile values.
// Only some parts of this array are actually used, because corner flags that overlap
// with edge flags are cancelled out before lookup. For example, GLOW_CORNER_TL | GLOW_EDGE_L
// will never be read, and has the same value as GLOW_EDGE_L.
static const u8 sAreaGlowTilemapMapping[] = {
[0] = GLOW_TILE_EMPTY,
[GLOW_EDGE_R] = GLOW_TILE_EDGE_R,
[GLOW_EDGE_L] = GLOW_TILE_EDGE_L,
[GLOW_EDGE_L | GLOW_EDGE_R] = GLOW_TILE_EDGE_L_R,
[GLOW_EDGE_B] = GLOW_TILE_EDGE_B,
[GLOW_EDGE_B | GLOW_EDGE_R] = GLOW_TILE_EDGE_B_R,
[GLOW_EDGE_B | GLOW_EDGE_L] = GLOW_TILE_EDGE_B_L,
[GLOW_EDGE_B | GLOW_EDGE_L | GLOW_EDGE_R] = GLOW_TILE_EDGE_B_L_R,
[GLOW_EDGE_T] = GLOW_TILE_EDGE_T,
[GLOW_EDGE_T | GLOW_EDGE_R] = GLOW_TILE_EDGE_T_R,
[GLOW_EDGE_T | GLOW_EDGE_L] = GLOW_TILE_EDGE_T_L,
[GLOW_EDGE_T | GLOW_EDGE_L | GLOW_EDGE_R] = GLOW_TILE_EDGE_T_L_R,
[GLOW_EDGE_T | GLOW_EDGE_B] = GLOW_TILE_EDGE_T_B,
[GLOW_EDGE_T | GLOW_EDGE_B | GLOW_EDGE_R] = GLOW_TILE_EDGE_T_B_R,
[GLOW_EDGE_T | GLOW_EDGE_B | GLOW_EDGE_L] = GLOW_TILE_EDGE_T_B_L,
[GLOW_EDGE_T | GLOW_EDGE_B | GLOW_EDGE_L | GLOW_EDGE_R] = GLOW_TILE_EDGE_T_B_L_R,
[GLOW_CORNER_TL] = GLOW_TILE_CORNER_TL,
[GLOW_CORNER_TL | GLOW_EDGE_R] = GLOW_TILE_EDGE_R_CORNER_TL,
[GLOW_CORNER_TL | GLOW_EDGE_L] = GLOW_TILE_EDGE_L,
[GLOW_CORNER_TL | GLOW_EDGE_L | GLOW_EDGE_R] = GLOW_TILE_EDGE_L_R,
[GLOW_CORNER_TL | GLOW_EDGE_B] = GLOW_TILE_EDGE_B_CORNER_TL,
[GLOW_CORNER_TL | GLOW_EDGE_B | GLOW_EDGE_R] = GLOW_TILE_EDGE_B_R_CORNER_TL,
[GLOW_CORNER_TL | GLOW_EDGE_B | GLOW_EDGE_L] = GLOW_TILE_EDGE_B_L,
[GLOW_CORNER_TL | GLOW_EDGE_B | GLOW_EDGE_L | GLOW_EDGE_R] = GLOW_TILE_EDGE_B_L_R,
[GLOW_CORNER_TL | GLOW_EDGE_T] = GLOW_TILE_EDGE_T,
[GLOW_CORNER_TL | GLOW_EDGE_T | GLOW_EDGE_R] = GLOW_TILE_EDGE_T_R,
[GLOW_CORNER_TL | GLOW_EDGE_T | GLOW_EDGE_L] = GLOW_TILE_EDGE_T_L,
[GLOW_CORNER_TL | GLOW_EDGE_T | GLOW_EDGE_L | GLOW_EDGE_R] = GLOW_TILE_EDGE_T_L_R,
[GLOW_CORNER_TL | GLOW_EDGE_T | GLOW_EDGE_B] = GLOW_TILE_EDGE_T_B,
[GLOW_CORNER_TL | GLOW_EDGE_T | GLOW_EDGE_B | GLOW_EDGE_R] = GLOW_TILE_EDGE_T_B_R,
[GLOW_CORNER_TL | GLOW_EDGE_T | GLOW_EDGE_B | GLOW_EDGE_L] = GLOW_TILE_EDGE_T_B_L,
[GLOW_CORNER_TL | GLOW_EDGE_T | GLOW_EDGE_B | GLOW_EDGE_L | GLOW_EDGE_R] = GLOW_TILE_EDGE_T_B_L_R,
[GLOW_CORNER_BL] = GLOW_TILE_CORNER_BL,
[GLOW_CORNER_BL | GLOW_EDGE_R] = GLOW_TILE_EDGE_R_CORNER_BL,
[GLOW_CORNER_BL | GLOW_EDGE_L] = GLOW_TILE_EDGE_L,
[GLOW_CORNER_BL | GLOW_EDGE_L | GLOW_EDGE_R] = GLOW_TILE_EDGE_L_R,
[GLOW_CORNER_BL | GLOW_EDGE_B] = GLOW_TILE_EDGE_B,
[GLOW_CORNER_BL | GLOW_EDGE_B | GLOW_EDGE_R] = GLOW_TILE_EDGE_B_R,
[GLOW_CORNER_BL | GLOW_EDGE_B | GLOW_EDGE_L] = GLOW_TILE_EDGE_B_L,
[GLOW_CORNER_BL | GLOW_EDGE_B | GLOW_EDGE_L | GLOW_EDGE_R] = GLOW_TILE_EDGE_B_L_R,
[GLOW_CORNER_BL | GLOW_EDGE_T] = GLOW_TILE_EDGE_T_CORNER_BL,
[GLOW_CORNER_BL | GLOW_EDGE_T | GLOW_EDGE_R] = GLOW_TILE_EDGE_T_R_CORNER_BL,
[GLOW_CORNER_BL | GLOW_EDGE_T | GLOW_EDGE_L] = GLOW_TILE_EDGE_T_L,
[GLOW_CORNER_BL | GLOW_EDGE_T | GLOW_EDGE_L | GLOW_EDGE_R] = GLOW_TILE_EDGE_T_L_R,
[GLOW_CORNER_BL | GLOW_EDGE_T | GLOW_EDGE_B] = GLOW_TILE_EDGE_T_B,
[GLOW_CORNER_BL | GLOW_EDGE_T | GLOW_EDGE_B | GLOW_EDGE_R] = GLOW_TILE_EDGE_T_B_R,
[GLOW_CORNER_BL | GLOW_EDGE_T | GLOW_EDGE_B | GLOW_EDGE_L] = GLOW_TILE_EDGE_T_B_L,
[GLOW_CORNER_BL | GLOW_EDGE_T | GLOW_EDGE_B | GLOW_EDGE_L | GLOW_EDGE_R] = GLOW_TILE_EDGE_T_B_L_R,
[GLOW_CORNER_BL | GLOW_CORNER_TL] = GLOW_TILE_CORNER_BL_TL,
[GLOW_CORNER_BL | GLOW_CORNER_TL | GLOW_EDGE_R] = GLOW_TILE_EDGE_R_CORNER_BL_TL,
[GLOW_CORNER_BL | GLOW_CORNER_TL | GLOW_EDGE_L] = GLOW_TILE_EDGE_L,
[GLOW_CORNER_BL | GLOW_CORNER_TL | GLOW_EDGE_L | GLOW_EDGE_R] = GLOW_TILE_EDGE_L_R,
[GLOW_CORNER_BL | GLOW_CORNER_TL | GLOW_EDGE_B] = GLOW_TILE_EDGE_B_CORNER_TL,
[GLOW_CORNER_BL | GLOW_CORNER_TL | GLOW_EDGE_B | GLOW_EDGE_R] = GLOW_TILE_EDGE_B_R_CORNER_TL,
[GLOW_CORNER_BL | GLOW_CORNER_TL | GLOW_EDGE_B | GLOW_EDGE_L] = GLOW_TILE_EDGE_B_L,
[GLOW_CORNER_BL | GLOW_CORNER_TL | GLOW_EDGE_B | GLOW_EDGE_L | GLOW_EDGE_R] = GLOW_TILE_EDGE_B_L_R,
[GLOW_CORNER_BL | GLOW_CORNER_TL | GLOW_EDGE_T] = GLOW_TILE_EDGE_T_CORNER_BL,
[GLOW_CORNER_BL | GLOW_CORNER_TL | GLOW_EDGE_T | GLOW_EDGE_R] = GLOW_TILE_EDGE_T_R_CORNER_BL,
[GLOW_CORNER_BL | GLOW_CORNER_TL | GLOW_EDGE_T | GLOW_EDGE_L] = GLOW_TILE_EDGE_T_L,
[GLOW_CORNER_BL | GLOW_CORNER_TL | GLOW_EDGE_T | GLOW_EDGE_L | GLOW_EDGE_R] = GLOW_TILE_EDGE_T_L_R,
[GLOW_CORNER_BL | GLOW_CORNER_TL | GLOW_EDGE_T | GLOW_EDGE_B] = GLOW_TILE_EDGE_T_B,
[GLOW_CORNER_BL | GLOW_CORNER_TL | GLOW_EDGE_T | GLOW_EDGE_B | GLOW_EDGE_R] = GLOW_TILE_EDGE_T_B_R,
[GLOW_CORNER_BL | GLOW_CORNER_TL | GLOW_EDGE_T | GLOW_EDGE_B | GLOW_EDGE_L] = GLOW_TILE_EDGE_T_B_L,
[GLOW_CORNER_BL | GLOW_CORNER_TL | GLOW_EDGE_T | GLOW_EDGE_B | GLOW_EDGE_L | GLOW_EDGE_R] = GLOW_TILE_EDGE_T_B_L_R,
[GLOW_CORNER_TR] = GLOW_TILE_CORNER_TR,
[GLOW_CORNER_TR | GLOW_EDGE_R] = GLOW_TILE_EDGE_R,
[GLOW_CORNER_TR | GLOW_EDGE_L] = GLOW_TILE_EDGE_L_CORNER_TR,
[GLOW_CORNER_TR | GLOW_EDGE_L | GLOW_EDGE_R] = GLOW_TILE_EDGE_L_R,
[GLOW_CORNER_TR | GLOW_EDGE_B] = GLOW_TILE_EDGE_B_CORNER_TR,
[GLOW_CORNER_TR | GLOW_EDGE_B | GLOW_EDGE_R] = GLOW_TILE_EDGE_B_R,
[GLOW_CORNER_TR | GLOW_EDGE_B | GLOW_EDGE_L] = GLOW_TILE_EDGE_B_L_CORNER_TR,
[GLOW_CORNER_TR | GLOW_EDGE_B | GLOW_EDGE_L | GLOW_EDGE_R] = GLOW_TILE_EDGE_B_L_R,
[GLOW_CORNER_TR | GLOW_EDGE_T] = GLOW_TILE_EDGE_T,
[GLOW_CORNER_TR | GLOW_EDGE_T | GLOW_EDGE_R] = GLOW_TILE_EDGE_T_R,
[GLOW_CORNER_TR | GLOW_EDGE_T | GLOW_EDGE_L] = GLOW_TILE_EDGE_T_L,
[GLOW_CORNER_TR | GLOW_EDGE_T | GLOW_EDGE_L | GLOW_EDGE_R] = GLOW_TILE_EDGE_T_L_R,
[GLOW_CORNER_TR | GLOW_EDGE_T | GLOW_EDGE_B] = GLOW_TILE_EDGE_T_B,
[GLOW_CORNER_TR | GLOW_EDGE_T | GLOW_EDGE_B | GLOW_EDGE_R] = GLOW_TILE_EDGE_T_B_R,
[GLOW_CORNER_TR | GLOW_EDGE_T | GLOW_EDGE_B | GLOW_EDGE_L] = GLOW_TILE_EDGE_T_B_L,
[GLOW_CORNER_TR | GLOW_EDGE_T | GLOW_EDGE_B | GLOW_EDGE_L | GLOW_EDGE_R] = GLOW_TILE_EDGE_T_B_L_R,
[GLOW_CORNER_TR | GLOW_CORNER_TL] = GLOW_TILE_CORNER_TR_TL,
[GLOW_CORNER_TR | GLOW_CORNER_TL | GLOW_EDGE_R] = GLOW_TILE_EDGE_R_CORNER_TL,
[GLOW_CORNER_TR | GLOW_CORNER_TL | GLOW_EDGE_L] = GLOW_TILE_EDGE_L_CORNER_TR,
[GLOW_CORNER_TR | GLOW_CORNER_TL | GLOW_EDGE_L | GLOW_EDGE_R] = GLOW_TILE_EDGE_L_R,
[GLOW_CORNER_TR | GLOW_CORNER_TL | GLOW_EDGE_B] = GLOW_TILE_EDGE_B_CORNER_TL_TR,
[GLOW_CORNER_TR | GLOW_CORNER_TL | GLOW_EDGE_B | GLOW_EDGE_R] = GLOW_TILE_EDGE_B_R_CORNER_TL,
[GLOW_CORNER_TR | GLOW_CORNER_TL | GLOW_EDGE_B | GLOW_EDGE_L] = GLOW_TILE_EDGE_B_L_CORNER_TR,
[GLOW_CORNER_TR | GLOW_CORNER_TL | GLOW_EDGE_B | GLOW_EDGE_L | GLOW_EDGE_R] = GLOW_TILE_EDGE_B_L_R,
[GLOW_CORNER_TR | GLOW_CORNER_TL | GLOW_EDGE_T] = GLOW_TILE_EDGE_T,
[GLOW_CORNER_TR | GLOW_CORNER_TL | GLOW_EDGE_T | GLOW_EDGE_R] = GLOW_TILE_EDGE_T_R,
[GLOW_CORNER_TR | GLOW_CORNER_TL | GLOW_EDGE_T | GLOW_EDGE_L] = GLOW_TILE_EDGE_T_L,
[GLOW_CORNER_TR | GLOW_CORNER_TL | GLOW_EDGE_T | GLOW_EDGE_L | GLOW_EDGE_R] = GLOW_TILE_EDGE_T_L_R,
[GLOW_CORNER_TR | GLOW_CORNER_TL | GLOW_EDGE_T | GLOW_EDGE_B] = GLOW_TILE_EDGE_T_B,
[GLOW_CORNER_TR | GLOW_CORNER_TL | GLOW_EDGE_T | GLOW_EDGE_B | GLOW_EDGE_R] = GLOW_TILE_EDGE_T_B_R,
[GLOW_CORNER_TR | GLOW_CORNER_TL | GLOW_EDGE_T | GLOW_EDGE_B | GLOW_EDGE_L] = GLOW_TILE_EDGE_T_B_L,
[GLOW_CORNER_TR | GLOW_CORNER_TL | GLOW_EDGE_T | GLOW_EDGE_B | GLOW_EDGE_L | GLOW_EDGE_R] = GLOW_TILE_EDGE_T_B_L_R,
[GLOW_CORNER_TR | GLOW_CORNER_BL] = GLOW_TILE_CORNER_TR_BL,
[GLOW_CORNER_TR | GLOW_CORNER_BL | GLOW_EDGE_R] = GLOW_TILE_EDGE_R_CORNER_BL,
[GLOW_CORNER_TR | GLOW_CORNER_BL | GLOW_EDGE_L] = GLOW_TILE_EDGE_L_CORNER_TR,
[GLOW_CORNER_TR | GLOW_CORNER_BL | GLOW_EDGE_L | GLOW_EDGE_R] = GLOW_TILE_EDGE_L_R,
[GLOW_CORNER_TR | GLOW_CORNER_BL | GLOW_EDGE_B] = GLOW_TILE_EDGE_B_CORNER_TR,
[GLOW_CORNER_TR | GLOW_CORNER_BL | GLOW_EDGE_B | GLOW_EDGE_R] = GLOW_TILE_EDGE_B_R,
[GLOW_CORNER_TR | GLOW_CORNER_BL | GLOW_EDGE_B | GLOW_EDGE_L] = GLOW_TILE_EDGE_B_L_CORNER_TR,
[GLOW_CORNER_TR | GLOW_CORNER_BL | GLOW_EDGE_B | GLOW_EDGE_L | GLOW_EDGE_R] = GLOW_TILE_EDGE_B_L_R,
[GLOW_CORNER_TR | GLOW_CORNER_BL | GLOW_EDGE_T] = GLOW_TILE_EDGE_T_CORNER_BL,
[GLOW_CORNER_TR | GLOW_CORNER_BL | GLOW_EDGE_T | GLOW_EDGE_R] = GLOW_TILE_EDGE_T_R_CORNER_BL,
[GLOW_CORNER_TR | GLOW_CORNER_BL | GLOW_EDGE_T | GLOW_EDGE_L] = GLOW_TILE_EDGE_T_L,
[GLOW_CORNER_TR | GLOW_CORNER_BL | GLOW_EDGE_T | GLOW_EDGE_L | GLOW_EDGE_R] = GLOW_TILE_EDGE_T_L_R,
[GLOW_CORNER_TR | GLOW_CORNER_BL | GLOW_EDGE_T | GLOW_EDGE_B] = GLOW_TILE_EDGE_T_B,
[GLOW_CORNER_TR | GLOW_CORNER_BL | GLOW_EDGE_T | GLOW_EDGE_B | GLOW_EDGE_R] = GLOW_TILE_EDGE_T_B_R,
[GLOW_CORNER_TR | GLOW_CORNER_BL | GLOW_EDGE_T | GLOW_EDGE_B | GLOW_EDGE_L] = GLOW_TILE_EDGE_T_B_L,
[GLOW_CORNER_TR | GLOW_CORNER_BL | GLOW_EDGE_T | GLOW_EDGE_B | GLOW_EDGE_L | GLOW_EDGE_R] = GLOW_TILE_EDGE_T_B_L_R,
[GLOW_CORNER_TR | GLOW_CORNER_BL | GLOW_CORNER_TL] = GLOW_TILE_CORNER_TR_BL_TL,
[GLOW_CORNER_TR | GLOW_CORNER_BL | GLOW_CORNER_TL | GLOW_EDGE_R] = GLOW_TILE_EDGE_R_CORNER_BL_TL,
[GLOW_CORNER_TR | GLOW_CORNER_BL | GLOW_CORNER_TL | GLOW_EDGE_L] = GLOW_TILE_EDGE_L_CORNER_TR,
[GLOW_CORNER_TR | GLOW_CORNER_BL | GLOW_CORNER_TL | GLOW_EDGE_L | GLOW_EDGE_R] = GLOW_TILE_EDGE_L_R,
[GLOW_CORNER_TR | GLOW_CORNER_BL | GLOW_CORNER_TL | GLOW_EDGE_B] = GLOW_TILE_EDGE_B_CORNER_TL_TR,
[GLOW_CORNER_TR | GLOW_CORNER_BL | GLOW_CORNER_TL | GLOW_EDGE_B | GLOW_EDGE_R] = GLOW_TILE_EDGE_B_R_CORNER_TL,
[GLOW_CORNER_TR | GLOW_CORNER_BL | GLOW_CORNER_TL | GLOW_EDGE_B | GLOW_EDGE_L] = GLOW_TILE_EDGE_B_L_CORNER_TR,
[GLOW_CORNER_TR | GLOW_CORNER_BL | GLOW_CORNER_TL | GLOW_EDGE_B | GLOW_EDGE_L | GLOW_EDGE_R] = GLOW_TILE_EDGE_B_L_R,
[GLOW_CORNER_TR | GLOW_CORNER_BL | GLOW_CORNER_TL | GLOW_EDGE_T] = GLOW_TILE_EDGE_T_CORNER_BL,
[GLOW_CORNER_TR | GLOW_CORNER_BL | GLOW_CORNER_TL | GLOW_EDGE_T | GLOW_EDGE_R] = GLOW_TILE_EDGE_T_R_CORNER_BL,
[GLOW_CORNER_TR | GLOW_CORNER_BL | GLOW_CORNER_TL | GLOW_EDGE_T | GLOW_EDGE_L] = GLOW_TILE_EDGE_T_L,
[GLOW_CORNER_TR | GLOW_CORNER_BL | GLOW_CORNER_TL | GLOW_EDGE_T | GLOW_EDGE_L | GLOW_EDGE_R] = GLOW_TILE_EDGE_T_L_R,
[GLOW_CORNER_TR | GLOW_CORNER_BL | GLOW_CORNER_TL | GLOW_EDGE_T | GLOW_EDGE_B] = GLOW_TILE_EDGE_T_B,
[GLOW_CORNER_TR | GLOW_CORNER_BL | GLOW_CORNER_TL | GLOW_EDGE_T | GLOW_EDGE_B | GLOW_EDGE_R] = GLOW_TILE_EDGE_T_B_R,
[GLOW_CORNER_TR | GLOW_CORNER_BL | GLOW_CORNER_TL | GLOW_EDGE_T | GLOW_EDGE_B | GLOW_EDGE_L] = GLOW_TILE_EDGE_T_B_L,
[GLOW_CORNER_TR | GLOW_CORNER_BL | GLOW_CORNER_TL | GLOW_EDGE_T | GLOW_EDGE_B | GLOW_EDGE_L | GLOW_EDGE_R] = GLOW_TILE_EDGE_T_B_L_R,
[GLOW_CORNER_BR] = GLOW_TILE_CORNER_BR,
[GLOW_CORNER_BR | GLOW_EDGE_R] = GLOW_TILE_EDGE_R,
[GLOW_CORNER_BR | GLOW_EDGE_L] = GLOW_TILE_EDGE_L_CORNER_BR,
[GLOW_CORNER_BR | GLOW_EDGE_L | GLOW_EDGE_R] = GLOW_TILE_EDGE_L_R,
[GLOW_CORNER_BR | GLOW_EDGE_B] = GLOW_TILE_EDGE_B,
[GLOW_CORNER_BR | GLOW_EDGE_B | GLOW_EDGE_R] = GLOW_TILE_EDGE_B_R,
[GLOW_CORNER_BR | GLOW_EDGE_B | GLOW_EDGE_L] = GLOW_TILE_EDGE_B_L,
[GLOW_CORNER_BR | GLOW_EDGE_B | GLOW_EDGE_L | GLOW_EDGE_R] = GLOW_TILE_EDGE_B_L_R,
[GLOW_CORNER_BR | GLOW_EDGE_T] = GLOW_TILE_EDGE_T_CORNER_BR,
[GLOW_CORNER_BR | GLOW_EDGE_T | GLOW_EDGE_R] = GLOW_TILE_EDGE_T_R,
[GLOW_CORNER_BR | GLOW_EDGE_T | GLOW_EDGE_L] = GLOW_TILE_EDGE_T_L_CORNER_BR,
[GLOW_CORNER_BR | GLOW_EDGE_T | GLOW_EDGE_L | GLOW_EDGE_R] = GLOW_TILE_EDGE_T_L_R,
[GLOW_CORNER_BR | GLOW_EDGE_T | GLOW_EDGE_B] = GLOW_TILE_EDGE_T_B,
[GLOW_CORNER_BR | GLOW_EDGE_T | GLOW_EDGE_B | GLOW_EDGE_R] = GLOW_TILE_EDGE_T_B_R,
[GLOW_CORNER_BR | GLOW_EDGE_T | GLOW_EDGE_B | GLOW_EDGE_L] = GLOW_TILE_EDGE_T_B_L,
[GLOW_CORNER_BR | GLOW_EDGE_T | GLOW_EDGE_B | GLOW_EDGE_L | GLOW_EDGE_R] = GLOW_TILE_EDGE_T_B_L_R,
[GLOW_CORNER_BR | GLOW_CORNER_TL] = GLOW_TILE_CORNER_BR_TL,
[GLOW_CORNER_BR | GLOW_CORNER_TL | GLOW_EDGE_R] = GLOW_TILE_EDGE_R_CORNER_TL,
[GLOW_CORNER_BR | GLOW_CORNER_TL | GLOW_EDGE_L] = GLOW_TILE_EDGE_L_CORNER_BR,
[GLOW_CORNER_BR | GLOW_CORNER_TL | GLOW_EDGE_L | GLOW_EDGE_R] = GLOW_TILE_EDGE_L_R,
[GLOW_CORNER_BR | GLOW_CORNER_TL | GLOW_EDGE_B] = GLOW_TILE_EDGE_B_CORNER_TL,
[GLOW_CORNER_BR | GLOW_CORNER_TL | GLOW_EDGE_B | GLOW_EDGE_R] = GLOW_TILE_EDGE_B_R_CORNER_TL,
[GLOW_CORNER_BR | GLOW_CORNER_TL | GLOW_EDGE_B | GLOW_EDGE_L] = GLOW_TILE_EDGE_B_L,
[GLOW_CORNER_BR | GLOW_CORNER_TL | GLOW_EDGE_B | GLOW_EDGE_L | GLOW_EDGE_R] = GLOW_TILE_EDGE_B_L_R,
[GLOW_CORNER_BR | GLOW_CORNER_TL | GLOW_EDGE_T] = GLOW_TILE_EDGE_T_CORNER_BR,
[GLOW_CORNER_BR | GLOW_CORNER_TL | GLOW_EDGE_T | GLOW_EDGE_R] = GLOW_TILE_EDGE_T_R,
[GLOW_CORNER_BR | GLOW_CORNER_TL | GLOW_EDGE_T | GLOW_EDGE_L] = GLOW_TILE_EDGE_T_L_CORNER_BR,
[GLOW_CORNER_BR | GLOW_CORNER_TL | GLOW_EDGE_T | GLOW_EDGE_L | GLOW_EDGE_R] = GLOW_TILE_EDGE_T_L_R,
[GLOW_CORNER_BR | GLOW_CORNER_TL | GLOW_EDGE_T | GLOW_EDGE_B] = GLOW_TILE_EDGE_T_B,
[GLOW_CORNER_BR | GLOW_CORNER_TL | GLOW_EDGE_T | GLOW_EDGE_B | GLOW_EDGE_R] = GLOW_TILE_EDGE_T_B_R,
[GLOW_CORNER_BR | GLOW_CORNER_TL | GLOW_EDGE_T | GLOW_EDGE_B | GLOW_EDGE_L] = GLOW_TILE_EDGE_T_B_L,
[GLOW_CORNER_BR | GLOW_CORNER_TL | GLOW_EDGE_T | GLOW_EDGE_B | GLOW_EDGE_L | GLOW_EDGE_R] = GLOW_TILE_EDGE_T_B_L_R,
[GLOW_CORNER_BR | GLOW_CORNER_BL] = GLOW_TILE_CORNER_BR_BL,
[GLOW_CORNER_BR | GLOW_CORNER_BL | GLOW_EDGE_R] = GLOW_TILE_EDGE_R_CORNER_BL,
[GLOW_CORNER_BR | GLOW_CORNER_BL | GLOW_EDGE_L] = GLOW_TILE_EDGE_L_CORNER_BR,
[GLOW_CORNER_BR | GLOW_CORNER_BL | GLOW_EDGE_L | GLOW_EDGE_R] = GLOW_TILE_EDGE_L_R,
[GLOW_CORNER_BR | GLOW_CORNER_BL | GLOW_EDGE_B] = GLOW_TILE_EDGE_B,
[GLOW_CORNER_BR | GLOW_CORNER_BL | GLOW_EDGE_B | GLOW_EDGE_R] = GLOW_TILE_EDGE_B_R,
[GLOW_CORNER_BR | GLOW_CORNER_BL | GLOW_EDGE_B | GLOW_EDGE_L] = GLOW_TILE_EDGE_B_L,
[GLOW_CORNER_BR | GLOW_CORNER_BL | GLOW_EDGE_B | GLOW_EDGE_L | GLOW_EDGE_R] = GLOW_TILE_EDGE_B_L_R,
[GLOW_CORNER_BR | GLOW_CORNER_BL | GLOW_EDGE_T] = GLOW_TILE_EDGE_T_CORNER_BL_BR,
[GLOW_CORNER_BR | GLOW_CORNER_BL | GLOW_EDGE_T | GLOW_EDGE_R] = GLOW_TILE_EDGE_T_R_CORNER_BL,
[GLOW_CORNER_BR | GLOW_CORNER_BL | GLOW_EDGE_T | GLOW_EDGE_L] = GLOW_TILE_EDGE_T_L_CORNER_BR,
[GLOW_CORNER_BR | GLOW_CORNER_BL | GLOW_EDGE_T | GLOW_EDGE_L | GLOW_EDGE_R] = GLOW_TILE_EDGE_T_L_R,
[GLOW_CORNER_BR | GLOW_CORNER_BL | GLOW_EDGE_T | GLOW_EDGE_B] = GLOW_TILE_EDGE_T_B,
[GLOW_CORNER_BR | GLOW_CORNER_BL | GLOW_EDGE_T | GLOW_EDGE_B | GLOW_EDGE_R] = GLOW_TILE_EDGE_T_B_R,
[GLOW_CORNER_BR | GLOW_CORNER_BL | GLOW_EDGE_T | GLOW_EDGE_B | GLOW_EDGE_L] = GLOW_TILE_EDGE_T_B_L,
[GLOW_CORNER_BR | GLOW_CORNER_BL | GLOW_EDGE_T | GLOW_EDGE_B | GLOW_EDGE_L | GLOW_EDGE_R] = GLOW_TILE_EDGE_T_B_L_R,
[GLOW_CORNER_BR | GLOW_CORNER_BL | GLOW_CORNER_TL] = GLOW_TILE_CORNER_BR_BL_TL,
[GLOW_CORNER_BR | GLOW_CORNER_BL | GLOW_CORNER_TL | GLOW_EDGE_R] = GLOW_TILE_EDGE_R_CORNER_BL_TL,
[GLOW_CORNER_BR | GLOW_CORNER_BL | GLOW_CORNER_TL | GLOW_EDGE_L] = GLOW_TILE_EDGE_L_CORNER_BR,
[GLOW_CORNER_BR | GLOW_CORNER_BL | GLOW_CORNER_TL | GLOW_EDGE_L | GLOW_EDGE_R] = GLOW_TILE_EDGE_L_R,
[GLOW_CORNER_BR | GLOW_CORNER_BL | GLOW_CORNER_TL | GLOW_EDGE_B] = GLOW_TILE_EDGE_B_CORNER_TL,
[GLOW_CORNER_BR | GLOW_CORNER_BL | GLOW_CORNER_TL | GLOW_EDGE_B | GLOW_EDGE_R] = GLOW_TILE_EDGE_B_R_CORNER_TL,
[GLOW_CORNER_BR | GLOW_CORNER_BL | GLOW_CORNER_TL | GLOW_EDGE_B | GLOW_EDGE_L] = GLOW_TILE_EDGE_B_L,
[GLOW_CORNER_BR | GLOW_CORNER_BL | GLOW_CORNER_TL | GLOW_EDGE_B | GLOW_EDGE_L | GLOW_EDGE_R] = GLOW_TILE_EDGE_B_L_R,
[GLOW_CORNER_BR | GLOW_CORNER_BL | GLOW_CORNER_TL | GLOW_EDGE_T] = GLOW_TILE_EDGE_T_CORNER_BL_BR,
[GLOW_CORNER_BR | GLOW_CORNER_BL | GLOW_CORNER_TL | GLOW_EDGE_T | GLOW_EDGE_R] = GLOW_TILE_EDGE_T_R_CORNER_BL,
[GLOW_CORNER_BR | GLOW_CORNER_BL | GLOW_CORNER_TL | GLOW_EDGE_T | GLOW_EDGE_L] = GLOW_TILE_EDGE_T_L_CORNER_BR,
[GLOW_CORNER_BR | GLOW_CORNER_BL | GLOW_CORNER_TL | GLOW_EDGE_T | GLOW_EDGE_L | GLOW_EDGE_R] = GLOW_TILE_EDGE_T_L_R,
[GLOW_CORNER_BR | GLOW_CORNER_BL | GLOW_CORNER_TL | GLOW_EDGE_T | GLOW_EDGE_B] = GLOW_TILE_EDGE_T_B,
[GLOW_CORNER_BR | GLOW_CORNER_BL | GLOW_CORNER_TL | GLOW_EDGE_T | GLOW_EDGE_B | GLOW_EDGE_R] = GLOW_TILE_EDGE_T_B_R,
[GLOW_CORNER_BR | GLOW_CORNER_BL | GLOW_CORNER_TL | GLOW_EDGE_T | GLOW_EDGE_B | GLOW_EDGE_L] = GLOW_TILE_EDGE_T_B_L,
[GLOW_CORNER_BR | GLOW_CORNER_BL | GLOW_CORNER_TL | GLOW_EDGE_T | GLOW_EDGE_B | GLOW_EDGE_L | GLOW_EDGE_R] = GLOW_TILE_EDGE_T_B_L_R,
[GLOW_CORNER_BR | GLOW_CORNER_TR] = GLOW_TILE_CORNER_BR_TR,
[GLOW_CORNER_BR | GLOW_CORNER_TR | GLOW_EDGE_R] = GLOW_TILE_EDGE_R,
[GLOW_CORNER_BR | GLOW_CORNER_TR | GLOW_EDGE_L] = GLOW_TILE_EDGE_L_CORNER_BR_TR,
[GLOW_CORNER_BR | GLOW_CORNER_TR | GLOW_EDGE_L | GLOW_EDGE_R] = GLOW_TILE_EDGE_L_R,
[GLOW_CORNER_BR | GLOW_CORNER_TR | GLOW_EDGE_B] = GLOW_TILE_EDGE_B_CORNER_TR,
[GLOW_CORNER_BR | GLOW_CORNER_TR | GLOW_EDGE_B | GLOW_EDGE_R] = GLOW_TILE_EDGE_B_R,
[GLOW_CORNER_BR | GLOW_CORNER_TR | GLOW_EDGE_B | GLOW_EDGE_L] = GLOW_TILE_EDGE_B_L_CORNER_TR,
[GLOW_CORNER_BR | GLOW_CORNER_TR | GLOW_EDGE_B | GLOW_EDGE_L | GLOW_EDGE_R] = GLOW_TILE_EDGE_B_L_R,
[GLOW_CORNER_BR | GLOW_CORNER_TR | GLOW_EDGE_T] = GLOW_TILE_EDGE_T_CORNER_BR,
[GLOW_CORNER_BR | GLOW_CORNER_TR | GLOW_EDGE_T | GLOW_EDGE_R] = GLOW_TILE_EDGE_T_R,
[GLOW_CORNER_BR | GLOW_CORNER_TR | GLOW_EDGE_T | GLOW_EDGE_L] = GLOW_TILE_EDGE_T_L_CORNER_BR,
[GLOW_CORNER_BR | GLOW_CORNER_TR | GLOW_EDGE_T | GLOW_EDGE_L | GLOW_EDGE_R] = GLOW_TILE_EDGE_T_L_R,
[GLOW_CORNER_BR | GLOW_CORNER_TR | GLOW_EDGE_T | GLOW_EDGE_B] = GLOW_TILE_EDGE_T_B,
[GLOW_CORNER_BR | GLOW_CORNER_TR | GLOW_EDGE_T | GLOW_EDGE_B | GLOW_EDGE_R] = GLOW_TILE_EDGE_T_B_R,
[GLOW_CORNER_BR | GLOW_CORNER_TR | GLOW_EDGE_T | GLOW_EDGE_B | GLOW_EDGE_L] = GLOW_TILE_EDGE_T_B_L,
[GLOW_CORNER_BR | GLOW_CORNER_TR | GLOW_EDGE_T | GLOW_EDGE_B | GLOW_EDGE_L | GLOW_EDGE_R] = GLOW_TILE_EDGE_T_B_L_R,
[GLOW_CORNER_BR | GLOW_CORNER_TR | GLOW_CORNER_TL] = GLOW_TILE_CORNER_BR_TR_TL,
[GLOW_CORNER_BR | GLOW_CORNER_TR | GLOW_CORNER_TL | GLOW_EDGE_R] = GLOW_TILE_EDGE_R_CORNER_TL,
[GLOW_CORNER_BR | GLOW_CORNER_TR | GLOW_CORNER_TL | GLOW_EDGE_L] = GLOW_TILE_EDGE_L_CORNER_BR_TR,
[GLOW_CORNER_BR | GLOW_CORNER_TR | GLOW_CORNER_TL | GLOW_EDGE_L | GLOW_EDGE_R] = GLOW_TILE_EDGE_L_R,
[GLOW_CORNER_BR | GLOW_CORNER_TR | GLOW_CORNER_TL | GLOW_EDGE_B] = GLOW_TILE_EDGE_B_CORNER_TL_TR,
[GLOW_CORNER_BR | GLOW_CORNER_TR | GLOW_CORNER_TL | GLOW_EDGE_B | GLOW_EDGE_R] = GLOW_TILE_EDGE_B_R_CORNER_TL,
[GLOW_CORNER_BR | GLOW_CORNER_TR | GLOW_CORNER_TL | GLOW_EDGE_B | GLOW_EDGE_L] = GLOW_TILE_EDGE_B_L_CORNER_TR,
[GLOW_CORNER_BR | GLOW_CORNER_TR | GLOW_CORNER_TL | GLOW_EDGE_B | GLOW_EDGE_L | GLOW_EDGE_R] = GLOW_TILE_EDGE_B_L_R,
[GLOW_CORNER_BR | GLOW_CORNER_TR | GLOW_CORNER_TL | GLOW_EDGE_T] = GLOW_TILE_EDGE_T_CORNER_BR,
[GLOW_CORNER_BR | GLOW_CORNER_TR | GLOW_CORNER_TL | GLOW_EDGE_T | GLOW_EDGE_R] = GLOW_TILE_EDGE_T_R,
[GLOW_CORNER_BR | GLOW_CORNER_TR | GLOW_CORNER_TL | GLOW_EDGE_T | GLOW_EDGE_L] = GLOW_TILE_EDGE_T_L_CORNER_BR,
[GLOW_CORNER_BR | GLOW_CORNER_TR | GLOW_CORNER_TL | GLOW_EDGE_T | GLOW_EDGE_L | GLOW_EDGE_R] = GLOW_TILE_EDGE_T_L_R,
[GLOW_CORNER_BR | GLOW_CORNER_TR | GLOW_CORNER_TL | GLOW_EDGE_T | GLOW_EDGE_B] = GLOW_TILE_EDGE_T_B,
[GLOW_CORNER_BR | GLOW_CORNER_TR | GLOW_CORNER_TL | GLOW_EDGE_T | GLOW_EDGE_B | GLOW_EDGE_R] = GLOW_TILE_EDGE_T_B_R,
[GLOW_CORNER_BR | GLOW_CORNER_TR | GLOW_CORNER_TL | GLOW_EDGE_T | GLOW_EDGE_B | GLOW_EDGE_L] = GLOW_TILE_EDGE_T_B_L,
[GLOW_CORNER_BR | GLOW_CORNER_TR | GLOW_CORNER_TL | GLOW_EDGE_T | GLOW_EDGE_B | GLOW_EDGE_L | GLOW_EDGE_R] = GLOW_TILE_EDGE_T_B_L_R,
[GLOW_CORNER_BR | GLOW_CORNER_TR | GLOW_CORNER_BL] = GLOW_TILE_CORNER_BR_TR_BL,
[GLOW_CORNER_BR | GLOW_CORNER_TR | GLOW_CORNER_BL | GLOW_EDGE_R] = GLOW_TILE_EDGE_R_CORNER_BL,
[GLOW_CORNER_BR | GLOW_CORNER_TR | GLOW_CORNER_BL | GLOW_EDGE_L] = GLOW_TILE_EDGE_L_CORNER_BR_TR,
[GLOW_CORNER_BR | GLOW_CORNER_TR | GLOW_CORNER_BL | GLOW_EDGE_L | GLOW_EDGE_R] = GLOW_TILE_EDGE_L_R,
[GLOW_CORNER_BR | GLOW_CORNER_TR | GLOW_CORNER_BL | GLOW_EDGE_B] = GLOW_TILE_EDGE_B_CORNER_TR,
[GLOW_CORNER_BR | GLOW_CORNER_TR | GLOW_CORNER_BL | GLOW_EDGE_B | GLOW_EDGE_R] = GLOW_TILE_EDGE_B_R,
[GLOW_CORNER_BR | GLOW_CORNER_TR | GLOW_CORNER_BL | GLOW_EDGE_B | GLOW_EDGE_L] = GLOW_TILE_EDGE_B_L_CORNER_TR,
[GLOW_CORNER_BR | GLOW_CORNER_TR | GLOW_CORNER_BL | GLOW_EDGE_B | GLOW_EDGE_L | GLOW_EDGE_R] = GLOW_TILE_EDGE_B_L_R,
[GLOW_CORNER_BR | GLOW_CORNER_TR | GLOW_CORNER_BL | GLOW_EDGE_T] = GLOW_TILE_EDGE_T_CORNER_BL_BR,
[GLOW_CORNER_BR | GLOW_CORNER_TR | GLOW_CORNER_BL | GLOW_EDGE_T | GLOW_EDGE_R] = GLOW_TILE_EDGE_T_R_CORNER_BL,
[GLOW_CORNER_BR | GLOW_CORNER_TR | GLOW_CORNER_BL | GLOW_EDGE_T | GLOW_EDGE_L] = GLOW_TILE_EDGE_T_L_CORNER_BR,
[GLOW_CORNER_BR | GLOW_CORNER_TR | GLOW_CORNER_BL | GLOW_EDGE_T | GLOW_EDGE_L | GLOW_EDGE_R] = GLOW_TILE_EDGE_T_L_R,
[GLOW_CORNER_BR | GLOW_CORNER_TR | GLOW_CORNER_BL | GLOW_EDGE_T | GLOW_EDGE_B] = GLOW_TILE_EDGE_T_B,
[GLOW_CORNER_BR | GLOW_CORNER_TR | GLOW_CORNER_BL | GLOW_EDGE_T | GLOW_EDGE_B | GLOW_EDGE_R] = GLOW_TILE_EDGE_T_B_R,
[GLOW_CORNER_BR | GLOW_CORNER_TR | GLOW_CORNER_BL | GLOW_EDGE_T | GLOW_EDGE_B | GLOW_EDGE_L] = GLOW_TILE_EDGE_T_B_L,
[GLOW_CORNER_BR | GLOW_CORNER_TR | GLOW_CORNER_BL | GLOW_EDGE_T | GLOW_EDGE_B | GLOW_EDGE_L | GLOW_EDGE_R] = GLOW_TILE_EDGE_T_B_L_R,
[GLOW_CORNER_BR | GLOW_CORNER_TR | GLOW_CORNER_BL | GLOW_CORNER_TL] = GLOW_TILE_CORNER_BR_TR_BL_TL,
[GLOW_CORNER_BR | GLOW_CORNER_TR | GLOW_CORNER_BL | GLOW_CORNER_TL | GLOW_EDGE_R] = GLOW_TILE_EDGE_R_CORNER_BL_TL,
[GLOW_CORNER_BR | GLOW_CORNER_TR | GLOW_CORNER_BL | GLOW_CORNER_TL | GLOW_EDGE_L] = GLOW_TILE_EDGE_L_CORNER_BR_TR,
[GLOW_CORNER_BR | GLOW_CORNER_TR | GLOW_CORNER_BL | GLOW_CORNER_TL | GLOW_EDGE_L | GLOW_EDGE_R] = GLOW_TILE_EDGE_L_R,
[GLOW_CORNER_BR | GLOW_CORNER_TR | GLOW_CORNER_BL | GLOW_CORNER_TL | GLOW_EDGE_B] = GLOW_TILE_EDGE_B_CORNER_TL_TR,
[GLOW_CORNER_BR | GLOW_CORNER_TR | GLOW_CORNER_BL | GLOW_CORNER_TL | GLOW_EDGE_B | GLOW_EDGE_R] = GLOW_TILE_EDGE_B_R_CORNER_TL,
[GLOW_CORNER_BR | GLOW_CORNER_TR | GLOW_CORNER_BL | GLOW_CORNER_TL | GLOW_EDGE_B | GLOW_EDGE_L] = GLOW_TILE_EDGE_B_L_CORNER_TR,
[GLOW_CORNER_BR | GLOW_CORNER_TR | GLOW_CORNER_BL | GLOW_CORNER_TL | GLOW_EDGE_B | GLOW_EDGE_L | GLOW_EDGE_R] = GLOW_TILE_EDGE_B_L_R,
[GLOW_CORNER_BR | GLOW_CORNER_TR | GLOW_CORNER_BL | GLOW_CORNER_TL | GLOW_EDGE_T] = GLOW_TILE_EDGE_T_CORNER_BL_BR,
[GLOW_CORNER_BR | GLOW_CORNER_TR | GLOW_CORNER_BL | GLOW_CORNER_TL | GLOW_EDGE_T | GLOW_EDGE_R] = GLOW_TILE_EDGE_T_R_CORNER_BL,
[GLOW_CORNER_BR | GLOW_CORNER_TR | GLOW_CORNER_BL | GLOW_CORNER_TL | GLOW_EDGE_T | GLOW_EDGE_L] = GLOW_TILE_EDGE_T_L_CORNER_BR,
[GLOW_CORNER_BR | GLOW_CORNER_TR | GLOW_CORNER_BL | GLOW_CORNER_TL | GLOW_EDGE_T | GLOW_EDGE_L | GLOW_EDGE_R] = GLOW_TILE_EDGE_T_L_R,
[GLOW_CORNER_BR | GLOW_CORNER_TR | GLOW_CORNER_BL | GLOW_CORNER_TL | GLOW_EDGE_T | GLOW_EDGE_B] = GLOW_TILE_EDGE_T_B,
[GLOW_CORNER_BR | GLOW_CORNER_TR | GLOW_CORNER_BL | GLOW_CORNER_TL | GLOW_EDGE_T | GLOW_EDGE_B | GLOW_EDGE_R] = GLOW_TILE_EDGE_T_B_R,
[GLOW_CORNER_BR | GLOW_CORNER_TR | GLOW_CORNER_BL | GLOW_CORNER_TL | GLOW_EDGE_T | GLOW_EDGE_B | GLOW_EDGE_L] = GLOW_TILE_EDGE_T_B_L,
[GLOW_CORNER_BR | GLOW_CORNER_TR | GLOW_CORNER_BL | GLOW_CORNER_TL | GLOW_EDGE_T | GLOW_EDGE_B | GLOW_EDGE_L | GLOW_EDGE_R] = GLOW_TILE_EDGE_T_B_L_R,
};

View File

@ -8,11 +8,11 @@
static EWRAM_DATA u8 *sPokedexAreaMapBgNum = NULL;
static const u16 sPokedexAreaMap_Pal[] = INCBIN_U16("graphics/interface/region_map.gbapal");
static const u32 sPokedexAreaMap_Gfx[] = INCBIN_U32("graphics/interface/region_map.8bpp.lz");
static const u32 sPokedexAreaMap_Tilemap[] = INCBIN_U32("graphics/interface/region_map.bin.lz");
static const u32 sPokedexAreaMapAffine_Gfx[] = INCBIN_U32("graphics/interface/region_map_affine.8bpp.lz");
static const u32 sPokedexAreaMapAffine_Tilemap[] = INCBIN_U32("graphics/interface/region_map_affine.bin.lz");
static const u16 sPokedexAreaMap_Pal[] = INCBIN_U16("graphics/pokedex/region_map.gbapal");
static const u32 sPokedexAreaMap_Gfx[] = INCBIN_U32("graphics/pokedex/region_map.8bpp.lz");
static const u32 sPokedexAreaMap_Tilemap[] = INCBIN_U32("graphics/pokedex/region_map.bin.lz");
static const u32 sPokedexAreaMapAffine_Gfx[] = INCBIN_U32("graphics/pokedex/region_map_affine.8bpp.lz");
static const u32 sPokedexAreaMapAffine_Tilemap[] = INCBIN_U32("graphics/pokedex/region_map_affine.bin.lz");
void LoadPokedexAreaMapGfx(const struct PokedexAreaMapTemplate *template)
{
@ -41,7 +41,7 @@ void LoadPokedexAreaMapGfx(const struct PokedexAreaMapTemplate *template)
ChangeBgX(template->bg, 0, BG_COORD_SET);
ChangeBgY(template->bg, 0, BG_COORD_SET);
SetBgAttribute(template->bg, BG_ATTR_PALETTEMODE, 1);
CpuCopy32(sPokedexAreaMap_Pal, &gPlttBufferUnfaded[0x70], 0x60);
CpuCopy32(sPokedexAreaMap_Pal, &gPlttBufferUnfaded[0x70], sizeof(sPokedexAreaMap_Pal));
*sPokedexAreaMapBgNum = template->bg;
}

View File

@ -20,65 +20,84 @@
#include "constants/rgb.h"
#include "constants/songs.h"
// There are two types of indicators for the area screen to show where a Pokémon can occur:
// - Area glows, which highlight any of the maps in MAP_GROUP_TOWNS_AND_ROUTES that have the species.
// These are a tilemap with colored rectangular areas that blends in and out. The positions of the
// rectangles is determined by the positions of the matching MAPSEC values on the region map layout.
// - Area markers, which highlight any of the maps in MAP_GROUP_DUNGEONS or MAP_GROUP_SPECIAL_AREA that
// have the species. These are circular sprites that flash twice. The positions of the sprites is
// determined by the data for the corresponding MAPSEC in gRegionMapEntries.
// Only maps in the following map groups have their encounters considered for the area screen
#define MAP_GROUP_TOWNS_AND_ROUTES MAP_GROUP(PETALBURG_CITY)
#define MAP_GROUP_DUNGEONS MAP_GROUP(METEOR_FALLS_1F_1R)
#define MAP_GROUP_SPECIAL_AREA MAP_GROUP(SAFARI_ZONE_NORTHWEST)
#define AREA_SCREEN_WIDTH 32
#define AREA_SCREEN_HEIGHT 20
#define GLOW_TILE_FULL 0xFFFF
#define GLOW_TILE_LEFT (1 << 0)
#define GLOW_TILE_RIGHT (1 << 1)
#define GLOW_TILE_TOP (1 << 2)
#define GLOW_TILE_BOTTOM (1 << 3)
#define GLOW_TILE_BOTTOM_RIGHT (1 << 4)
#define GLOW_TILE_TOP_RIGHT (1 << 5)
#define GLOW_TILE_BOTTOM_LEFT (1 << 6)
#define GLOW_TILE_TOP_LEFT (1 << 7)
#define GLOW_FULL 0xFFFF
#define GLOW_EDGE_R (1 << 0)
#define GLOW_EDGE_L (1 << 1)
#define GLOW_EDGE_B (1 << 2)
#define GLOW_EDGE_T (1 << 3)
#define GLOW_CORNER_TL (1 << 4)
#define GLOW_CORNER_BL (1 << 5)
#define GLOW_CORNER_TR (1 << 6)
#define GLOW_CORNER_BR (1 << 7)
struct PokeDexAreaScreenMapIdentity
#define GLOW_PALETTE 10
#define TAG_AREA_MARKER 2
#define TAG_AREA_UNKNOWN 3
#define MAX_AREA_HIGHLIGHTS 64 // Maximum number of rectangular route highlights
#define MAX_AREA_MARKERS 32 // Maximum number of circular spot highlights
struct OverworldArea
{
u8 mapGroup;
u8 mapNum;
u16 regionMapSectionId;
};
struct PokeDexAreaScreen
struct
{
/*0x000*/ void (*callback)(void); // unused
/*0x004*/ MainCallback prev; // unused
/*0x008*/ MainCallback next; // unused
/*0x00C*/ u16 state; // unused
/*0x00E*/ u16 species;
/*0x010*/ struct PokeDexAreaScreenMapIdentity overworldAreasWithMons[0x40];
/*0x010*/ struct OverworldArea overworldAreasWithMons[MAX_AREA_HIGHLIGHTS];
/*0x110*/ u16 numOverworldAreas;
/*0x112*/ u16 numSpecialAreas;
/*0x114*/ u16 drawAreaGlowState;
/*0x116*/ u16 areaGlowTilemap[0x280];
/*0x616*/ u16 areaShadeOrMarkerFrameCounter;
/*0x618*/ u16 areaShadeFrameCounter;
/*0x116*/ u16 areaGlowTilemap[AREA_SCREEN_WIDTH * AREA_SCREEN_HEIGHT];
/*0x616*/ u16 markerTimer;
/*0x618*/ u16 glowTimer;
/*0x61A*/ u16 areaShadeBldArgLo;
/*0x61C*/ u16 areaShadeBldArgHi;
/*0x61E*/ u8 whichMarkersFlashing;
/*0x61F*/ u8 specialMarkerCycleCounter;
/*0x620*/ u16 specialAreaRegionMapSectionIds[0x20];
/*0x660*/ struct Sprite *areaMarkerSprites[0x20];
/*0x61E*/ bool8 showingMarkers;
/*0x61F*/ u8 markerFlashCounter;
/*0x620*/ u16 specialAreaRegionMapSectionIds[MAX_AREA_MARKERS];
/*0x660*/ struct Sprite *areaMarkerSprites[MAX_AREA_MARKERS];
/*0x6E0*/ u16 numAreaMarkerSprites;
/*0x6E2*/ u16 unk6E2;
/*0x6E4*/ u16 unk6E4;
/*0x6E2*/ u16 alteringCaveCounter;
/*0x6E4*/ u16 alteringCaveId;
/*0x6E8*/ u8 *screenSwitchState;
/*0x6EC*/ struct RegionMap regionMap;
/*0xF70*/ u8 charBuffer[0x40];
/*0xF70*/ u8 charBuffer[64];
/*0xFB0*/ struct Sprite * areaUnknownSprites[3];
/*0xFBC*/ u8 areaUnknownGraphicsBuffer[0x600];
};
static EWRAM_DATA struct PokeDexAreaScreen *sPokedexAreaScreen = NULL;
} static EWRAM_DATA *sPokedexAreaScreen = NULL;
static void FindMapsWithMon(u16);
static void BuildAreaGlowTilemap(void);
static void SetAreaHasMon(u16, u16);
static void SetSpecialMapHasMon(u16, u16);
static u16 GetRegionMapSectionId(u8, u8);
static bool8 MapHasMon(const struct WildPokemonHeader *, u16);
static bool8 MonListHasMon(const struct WildPokemonInfo *, u16, u16);
static bool8 MapHasSpecies(const struct WildPokemonHeader *, u16);
static bool8 MonListHasSpecies(const struct WildPokemonInfo *, u16, u16);
static void DoAreaGlow(void);
static void Task_ShowPokedexAreaScreen(u8);
static void CreateAreaMarkerSprites(void);
@ -86,7 +105,7 @@ static void LoadAreaUnknownGraphics(void);
static void CreateAreaUnknownSprites(void);
static void Task_HandlePokedexAreaScreenInput(u8);
static void ResetPokedexAreaMapBg(void);
static void DestroyAreaMarkerSprites(void);
static void DestroyAreaScreenSprites(void);
static const u32 sAreaGlow_Pal[] = INCBIN_U32("graphics/pokedex/area_glow.gbapal");
static const u32 sAreaGlow_Gfx[] = INCBIN_U32("graphics/pokedex/area_glow.4bpp.lz");
@ -117,115 +136,7 @@ static const u16 sLandmarkData[][2] =
{MAPSEC_NONE}
};
// Only some parts of this array are acutally used, because corner flags that overlap
// with edge flags are cancelled out before lookup. For example, GLOW_TILE_BOTTOM_RIGHT | GLOW_TILE_RIGHT
// will never be read.
//
// The rest of the bytes seem to be old data from before the cancellation was implemented.
// Most of them line up as you would expect ([BOTTOM_RIGHT | RIGHT] has the same value as [RIGHT]).
//
// Any unreachable entries are simply listed in order, without the fancy "[FLAGS] = 0xXX" notation.
static const u8 sAreaGlowTilemapMapping[] = {
[0] = 0x00,
[GLOW_TILE_LEFT] = 0x01,
[GLOW_TILE_RIGHT] = 0x02,
[GLOW_TILE_RIGHT | GLOW_TILE_LEFT] = 0x03,
[GLOW_TILE_TOP] = 0x04,
[GLOW_TILE_TOP | GLOW_TILE_LEFT] = 0x05,
[GLOW_TILE_TOP | GLOW_TILE_RIGHT] = 0x06,
[GLOW_TILE_TOP | GLOW_TILE_RIGHT | GLOW_TILE_LEFT] = 0x07,
[GLOW_TILE_BOTTOM] = 0x08,
[GLOW_TILE_BOTTOM | GLOW_TILE_LEFT] = 0x09,
[GLOW_TILE_BOTTOM | GLOW_TILE_RIGHT] = 0x0a,
[GLOW_TILE_BOTTOM | GLOW_TILE_RIGHT | GLOW_TILE_LEFT] = 0x0b,
[GLOW_TILE_BOTTOM | GLOW_TILE_TOP] = 0x0c,
[GLOW_TILE_BOTTOM | GLOW_TILE_TOP | GLOW_TILE_LEFT] = 0x0d,
[GLOW_TILE_BOTTOM | GLOW_TILE_TOP | GLOW_TILE_RIGHT] = 0x0e,
[GLOW_TILE_BOTTOM | GLOW_TILE_TOP | GLOW_TILE_RIGHT | GLOW_TILE_LEFT] = 0x0f,
[GLOW_TILE_BOTTOM_RIGHT] = 0x11,
[GLOW_TILE_BOTTOM_RIGHT | GLOW_TILE_LEFT] = 0x20,
0x02, 0x03,
[GLOW_TILE_BOTTOM_RIGHT | GLOW_TILE_TOP] = 0x27,
[GLOW_TILE_BOTTOM_RIGHT | GLOW_TILE_TOP | GLOW_TILE_LEFT] = 0x2d,
0x06, 0x07, 0x08, 0x09, 0x0a,
0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
[GLOW_TILE_TOP_RIGHT] = 0x12,
[GLOW_TILE_TOP_RIGHT | GLOW_TILE_LEFT] = 0x21,
0x02, 0x03, 0x04, 0x05, 0x06,
0x07,
[GLOW_TILE_TOP_RIGHT | GLOW_TILE_BOTTOM] = 0x2a,
[GLOW_TILE_TOP_RIGHT | GLOW_TILE_BOTTOM | GLOW_TILE_LEFT] = 0x2e,
0x0a, 0x0b, 0x0c, 0x0d, 0x0e,
0x0f,
[GLOW_TILE_TOP_RIGHT | GLOW_TILE_BOTTOM_RIGHT] = 0x13,
[GLOW_TILE_TOP_RIGHT | GLOW_TILE_BOTTOM_RIGHT | GLOW_TILE_LEFT] = 0x22,
0x02, 0x03, 0x27, 0x2d, 0x06,
0x07, 0x2a, 0x2e, 0x0a, 0x0b,
0x0c, 0x0d, 0x0e, 0x0f,
[GLOW_TILE_BOTTOM_LEFT] = 0x14,
0x01,
[GLOW_TILE_BOTTOM_LEFT | GLOW_TILE_RIGHT] = 0x23,
0x03,
[GLOW_TILE_BOTTOM_LEFT | GLOW_TILE_TOP] = 0x26,
0x05,
[GLOW_TILE_BOTTOM_LEFT | GLOW_TILE_TOP | GLOW_TILE_RIGHT] = 0x2c,
0x07, 0x08, 0x09, 0x0a, 0x0b,
0x0c, 0x0d, 0x0e, 0x0f,
[GLOW_TILE_BOTTOM_LEFT | GLOW_TILE_BOTTOM_RIGHT] = 0x15,
0x20, 0x23, 0x03,
[GLOW_TILE_BOTTOM_LEFT | GLOW_TILE_BOTTOM_RIGHT | GLOW_TILE_TOP] = 0x28,
0x2d, 0x2c, 0x07, 0x08, 0x09,
0x0a, 0x0b, 0x0c, 0x0d, 0x0e,
0x0f,
[GLOW_TILE_BOTTOM_LEFT | GLOW_TILE_TOP_RIGHT] = 0x16,
0x21, 0x23, 0x03, 0x26, 0x05,
0x2c, 0x07, 0x2a, 0x2e, 0x0a,
0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
[GLOW_TILE_BOTTOM_LEFT | GLOW_TILE_TOP_RIGHT | GLOW_TILE_BOTTOM_RIGHT] = 0x17,
0x22, 0x23, 0x03, 0x28, 0x2d,
0x2c, 0x07, 0x2a, 0x2e, 0x0a,
0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
[GLOW_TILE_TOP_LEFT] = 0x18,
0x01,
[GLOW_TILE_TOP_LEFT | GLOW_TILE_RIGHT] = 0x24,
0x03, 0x04, 0x05, 0x06, 0x07,
[GLOW_TILE_TOP_LEFT | GLOW_TILE_BOTTOM] = 0x29,
0x09,
[GLOW_TILE_TOP_LEFT | GLOW_TILE_BOTTOM | GLOW_TILE_RIGHT] = 0x2f,
0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
[GLOW_TILE_TOP_LEFT | GLOW_TILE_BOTTOM_RIGHT] = 0x19,
0x20, 0x24, 0x03, 0x27, 0x2d,
0x06, 0x07, 0x29, 0x09, 0x2f,
0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
[GLOW_TILE_TOP_LEFT | GLOW_TILE_TOP_RIGHT] = 0x1a,
0x21, 0x24, 0x03, 0x04, 0x05,
0x06, 0x07,
[GLOW_TILE_TOP_LEFT | GLOW_TILE_TOP_RIGHT | GLOW_TILE_BOTTOM] = 0x2b,
0x2e, 0x2f, 0x0b, 0x0c, 0x0d,
0x0e, 0x0f,
[GLOW_TILE_TOP_LEFT | GLOW_TILE_TOP_RIGHT | GLOW_TILE_BOTTOM_RIGHT] = 0x1b,
0x22, 0x24, 0x03, 0x27, 0x2d,
0x06, 0x07, 0x2b, 0x2e, 0x2f,
0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
[GLOW_TILE_TOP_LEFT | GLOW_TILE_BOTTOM_LEFT] = 0x1c,
0x01,
[GLOW_TILE_TOP_LEFT | GLOW_TILE_BOTTOM_LEFT | GLOW_TILE_RIGHT] = 0x25,
0x03, 0x26, 0x05, 0x2c, 0x07,
0x29, 0x09, 0x2f, 0x0b, 0x0c,
0x0d, 0x0e, 0x0f,
[GLOW_TILE_TOP_LEFT | GLOW_TILE_BOTTOM_LEFT | GLOW_TILE_BOTTOM_RIGHT] = 0x1d,
0x20, 0x25, 0x03, 0x28, 0x2d,
0x2c, 0x07, 0x29, 0x09, 0x2f,
0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
[GLOW_TILE_TOP_LEFT | GLOW_TILE_BOTTOM_LEFT | GLOW_TILE_TOP_RIGHT] = 0x1e,
0x21, 0x25, 0x03, 0x26, 0x05,
0x2c, 0x07, 0x2b, 0x2e, 0x2f,
0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
[GLOW_TILE_TOP_LEFT | GLOW_TILE_BOTTOM_LEFT | GLOW_TILE_TOP_RIGHT | GLOW_TILE_BOTTOM_RIGHT] = 0x1f,
0x22, 0x25, 0x03, 0x28, 0x2d,
0x2c, 0x07, 0x2b, 0x2e, 0x2f,
0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
};
#include "data/pokedex_area_glow.h"
static const struct PokedexAreaMapTemplate sPokedexAreaMapTemplate =
{
@ -238,13 +149,13 @@ static const struct PokedexAreaMapTemplate sPokedexAreaMapTemplate =
static const u8 sAreaMarkerTiles[];
static const struct SpriteSheet sAreaMarkerSpriteSheet =
{
sAreaMarkerTiles, 0x80, 2
.data = sAreaMarkerTiles, .size = 0x80, .tag = TAG_AREA_MARKER
};
static const u16 sAreaMarkerPalette[];
static const struct SpritePalette sAreaMarkerSpritePalette =
{
sAreaMarkerPalette, 2
.data = sAreaMarkerPalette, .tag = TAG_AREA_MARKER
};
static const struct OamData sAreaMarkerOamData =
@ -256,13 +167,13 @@ static const struct OamData sAreaMarkerOamData =
static const struct SpriteTemplate sAreaMarkerSpriteTemplate =
{
2,
2,
&sAreaMarkerOamData,
gDummySpriteAnimTable,
NULL,
gDummySpriteAffineAnimTable,
SpriteCallbackDummy
.tileTag = TAG_AREA_MARKER,
.paletteTag = TAG_AREA_MARKER,
.oam = &sAreaMarkerOamData,
.anims = gDummySpriteAnimTable,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
.callback = SpriteCallbackDummy
};
static const u16 sAreaMarkerPalette[] = INCBIN_U16("graphics/pokedex/area_marker.gbapal");
@ -270,7 +181,7 @@ static const u8 sAreaMarkerTiles[] = INCBIN_U8("graphics/pokedex/area_marker.4bp
static const struct SpritePalette sAreaUnknownSpritePalette =
{
gPokedexAreaScreenAreaUnknown_Pal, 3
.data = gPokedexAreaScreenAreaUnknown_Pal, .tag = TAG_AREA_UNKNOWN
};
static const struct OamData sAreaUnknownOamData =
@ -282,13 +193,13 @@ static const struct OamData sAreaUnknownOamData =
static const struct SpriteTemplate sAreaUnknownSpriteTemplate =
{
3,
3,
&sAreaUnknownOamData,
gDummySpriteAnimTable,
NULL,
gDummySpriteAffineAnimTable,
SpriteCallbackDummy
.tileTag = TAG_AREA_UNKNOWN,
.paletteTag = TAG_AREA_UNKNOWN,
.oam = &sAreaUnknownOamData,
.anims = gDummySpriteAnimTable,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
.callback = SpriteCallbackDummy
};
static void ResetDrawAreaGlowState(void)
@ -308,17 +219,17 @@ static bool8 DrawAreaGlow(void)
break;
case 2:
DecompressAndCopyTileDataToVram(2, sAreaGlow_Gfx, 0, 0, 0);
LoadBgTilemap(2, sPokedexAreaScreen->areaGlowTilemap, 0x500, 0);
LoadBgTilemap(2, sPokedexAreaScreen->areaGlowTilemap, sizeof(sPokedexAreaScreen->areaGlowTilemap), 0);
break;
case 3:
if (!FreeTempTileDataBuffersIfPossible())
{
CpuCopy32(sAreaGlow_Pal, gPlttBufferUnfaded + 0xA0, 0x20);
CpuCopy32(sAreaGlow_Pal, &gPlttBufferUnfaded[GLOW_PALETTE * 16], sizeof(sAreaGlow_Pal));
sPokedexAreaScreen->drawAreaGlowState++;
}
return TRUE;
case 4:
ChangeBgY(2, -0x800, BG_COORD_SET);
ChangeBgY(2, -BG_SCREEN_SIZE, BG_COORD_SET);
break;
default:
return FALSE;
@ -333,50 +244,58 @@ static void FindMapsWithMon(u16 species)
u16 i;
struct Roamer *roamer;
sPokedexAreaScreen->unk6E2 = 0;
sPokedexAreaScreen->unk6E4 = VarGet(VAR_ALTERING_CAVE_WILD_SET);
if (sPokedexAreaScreen->unk6E4 > 8)
sPokedexAreaScreen->unk6E4 = 0;
sPokedexAreaScreen->alteringCaveCounter = 0;
sPokedexAreaScreen->alteringCaveId = VarGet(VAR_ALTERING_CAVE_WILD_SET);
if (sPokedexAreaScreen->alteringCaveId >= NUM_ALTERING_CAVE_TABLES)
sPokedexAreaScreen->alteringCaveId = 0;
roamer = &gSaveBlock1Ptr->roamer;
if (species != roamer->species)
{
sPokedexAreaScreen->numOverworldAreas = 0;
sPokedexAreaScreen->numSpecialAreas = 0;
// Check if this species should be hidden from the area map.
// This only applies to Wynaut, to hide the encounters on Mirage Island.
for (i = 0; i < ARRAY_COUNT(sSpeciesHiddenFromAreaScreen); i++)
{
if (sSpeciesHiddenFromAreaScreen[i] == species)
return;
}
// Add Pokémon with special encounter circumstances (i.e. not listed
// in the regular wild encounter table) to the area map.
// This only applies to Feebas on Route 119, but it was clearly set
// up to allow handling others.
for (i = 0; sFeebasData[i][0] != NUM_SPECIES; i++)
{
if (species == sFeebasData[i][0])
{
switch (sFeebasData[i][1])
{
case MAP_GROUP_OVERWORLD_MONS:
case MAP_GROUP_TOWNS_AND_ROUTES:
SetAreaHasMon(sFeebasData[i][1], sFeebasData[i][2]);
break;
case MAP_GROUP_SPECIAL_MONS_1:
case MAP_GROUP_SPECIAL_MONS_2:
case MAP_GROUP_DUNGEONS:
case MAP_GROUP_SPECIAL_AREA:
SetSpecialMapHasMon(sFeebasData[i][1], sFeebasData[i][2]);
break;
}
}
}
// Add regular species to the area map
for (i = 0; gWildMonHeaders[i].mapGroup != MAP_GROUP(UNDEFINED); i++)
{
if (MapHasMon(&gWildMonHeaders[i], species))
if (MapHasSpecies(&gWildMonHeaders[i], species))
{
switch (gWildMonHeaders[i].mapGroup)
{
case MAP_GROUP_OVERWORLD_MONS:
case MAP_GROUP_TOWNS_AND_ROUTES:
SetAreaHasMon(gWildMonHeaders[i].mapGroup, gWildMonHeaders[i].mapNum);
break;
case MAP_GROUP_SPECIAL_MONS_1:
case MAP_GROUP_SPECIAL_MONS_2:
case MAP_GROUP_DUNGEONS:
case MAP_GROUP_SPECIAL_AREA:
SetSpecialMapHasMon(gWildMonHeaders[i].mapGroup, gWildMonHeaders[i].mapNum);
break;
}
@ -385,6 +304,7 @@ static void FindMapsWithMon(u16 species)
}
else
{
// This is the roamer's species, show where the roamer is currently
sPokedexAreaScreen->numSpecialAreas = 0;
if (roamer->active)
{
@ -401,7 +321,7 @@ static void FindMapsWithMon(u16 species)
static void SetAreaHasMon(u16 mapGroup, u16 mapNum)
{
if (sPokedexAreaScreen->numOverworldAreas < 0x40)
if (sPokedexAreaScreen->numOverworldAreas < MAX_AREA_HIGHLIGHTS)
{
sPokedexAreaScreen->overworldAreasWithMons[sPokedexAreaScreen->numOverworldAreas].mapGroup = mapGroup;
sPokedexAreaScreen->overworldAreasWithMons[sPokedexAreaScreen->numOverworldAreas].mapNum = mapNum;
@ -414,23 +334,26 @@ static void SetSpecialMapHasMon(u16 mapGroup, u16 mapNum)
{
int i;
if (sPokedexAreaScreen->numSpecialAreas < 0x20)
if (sPokedexAreaScreen->numSpecialAreas < MAX_AREA_MARKERS)
{
u16 regionMapSectionId = GetRegionMapSectionId(mapGroup, mapNum);
if (regionMapSectionId < MAPSEC_NONE)
{
// Don't highlight the area if it's a moving area (Marine/Terra Cave)
for (i = 0; i < ARRAY_COUNT(sMovingRegionMapSections); i++)
{
if (regionMapSectionId == sMovingRegionMapSections[i])
return;
}
// Don't highlight the area if it's an undiscovered landmark (e.g. Sky Pillar)
for (i = 0; sLandmarkData[i][0] != MAPSEC_NONE; i++)
{
if (regionMapSectionId == sLandmarkData[i][0] && !FlagGet(sLandmarkData[i][1]))
return;
}
// Check if this special area is already being tracked
for (i = 0; i < sPokedexAreaScreen->numSpecialAreas; i++)
{
if (sPokedexAreaScreen->specialAreaRegionMapSectionIds[i] == regionMapSectionId)
@ -439,6 +362,7 @@ static void SetSpecialMapHasMon(u16 mapGroup, u16 mapNum)
if (i == sPokedexAreaScreen->numSpecialAreas)
{
// New special area
sPokedexAreaScreen->specialAreaRegionMapSectionIds[i] = regionMapSectionId;
sPokedexAreaScreen->numSpecialAreas++;
}
@ -451,27 +375,34 @@ static u16 GetRegionMapSectionId(u8 mapGroup, u8 mapNum)
return Overworld_GetMapHeaderByGroupAndId(mapGroup, mapNum)->regionMapSectionId;
}
static bool8 MapHasMon(const struct WildPokemonHeader *info, u16 species)
static bool8 MapHasSpecies(const struct WildPokemonHeader *info, u16 species)
{
// If this is a header for Altering Cave, skip it if it's not the current Altering Cave encounter set
if (GetRegionMapSectionId(info->mapGroup, info->mapNum) == MAPSEC_ALTERING_CAVE)
{
sPokedexAreaScreen->unk6E2++;
if (sPokedexAreaScreen->unk6E2 != sPokedexAreaScreen->unk6E4 + 1)
sPokedexAreaScreen->alteringCaveCounter++;
if (sPokedexAreaScreen->alteringCaveCounter != sPokedexAreaScreen->alteringCaveId + 1)
return FALSE;
}
if (MonListHasMon(info->landMonsInfo, species, 12))
if (MonListHasSpecies(info->landMonsInfo, species, LAND_WILD_COUNT))
return TRUE;
if (MonListHasMon(info->waterMonsInfo, species, 5))
if (MonListHasSpecies(info->waterMonsInfo, species, WATER_WILD_COUNT))
return TRUE;
if (MonListHasMon(info->fishingMonsInfo, species, 12))
// When searching the fishing encounters, this incorrectly uses the size of the land encounters.
// As a result it's reading out of bounds of the fishing encounters tables.
#ifdef BUGFIX
if (MonListHasSpecies(info->fishingMonsInfo, species, FISH_WILD_COUNT))
#else
if (MonListHasSpecies(info->fishingMonsInfo, species, LAND_WILD_COUNT))
#endif
return TRUE;
if (MonListHasMon(info->rockSmashMonsInfo, species, 5))
if (MonListHasSpecies(info->rockSmashMonsInfo, species, ROCK_WILD_COUNT))
return TRUE;
return FALSE;
}
static bool8 MonListHasMon(const struct WildPokemonInfo *info, u16 species, u16 size)
static bool8 MonListHasSpecies(const struct WildPokemonInfo *info, u16 species, u16 size)
{
u16 i;
if (info != NULL)
@ -489,9 +420,12 @@ static void BuildAreaGlowTilemap(void)
{
u16 i, y, x, j;
// Reset tilemap
for (i = 0; i < ARRAY_COUNT(sPokedexAreaScreen->areaGlowTilemap); i++)
sPokedexAreaScreen->areaGlowTilemap[i] = 0;
// For each area with this species, scan the region map layout and find any locations that have a matching mapsec.
// Add a "full glow" indicator for these matching spaces.
for (i = 0; i < sPokedexAreaScreen->numOverworldAreas; i++)
{
j = 0;
@ -500,69 +434,73 @@ static void BuildAreaGlowTilemap(void)
for (x = 0; x < AREA_SCREEN_WIDTH; x++)
{
if (GetRegionMapSecIdAt(x, y) == sPokedexAreaScreen->overworldAreasWithMons[i].regionMapSectionId)
sPokedexAreaScreen->areaGlowTilemap[j] = GLOW_TILE_FULL;
sPokedexAreaScreen->areaGlowTilemap[j] = GLOW_FULL;
j++;
}
}
}
// Scan the tilemap. For every "full glow" indicator added above, fill in its edges and corners.
j = 0;
for (y = 0; y < AREA_SCREEN_HEIGHT; y++)
{
for (x = 0; x < AREA_SCREEN_WIDTH; x++)
{
if (sPokedexAreaScreen->areaGlowTilemap[j] == GLOW_TILE_FULL)
if (sPokedexAreaScreen->areaGlowTilemap[j] == GLOW_FULL)
{
// The "tile != GLOW_TILE_FULL" check is pointless in all of these conditionals,
// The "tile != GLOW_FULL" check is pointless in all of these conditionals,
// since there's no harm in OR'ing 0xFFFF with anything else.
// Edges
if (x != 0 && sPokedexAreaScreen->areaGlowTilemap[j - 1] != GLOW_TILE_FULL)
sPokedexAreaScreen->areaGlowTilemap[j - 1] |= GLOW_TILE_RIGHT;
if (x != AREA_SCREEN_WIDTH - 1 && sPokedexAreaScreen->areaGlowTilemap[j + 1] != GLOW_TILE_FULL)
sPokedexAreaScreen->areaGlowTilemap[j + 1] |= GLOW_TILE_LEFT;
if (y != 0 && sPokedexAreaScreen->areaGlowTilemap[j - AREA_SCREEN_WIDTH] != GLOW_TILE_FULL)
sPokedexAreaScreen->areaGlowTilemap[j - AREA_SCREEN_WIDTH] |= GLOW_TILE_BOTTOM;
if (y != AREA_SCREEN_HEIGHT - 1 && sPokedexAreaScreen->areaGlowTilemap[j + AREA_SCREEN_WIDTH] != GLOW_TILE_FULL)
sPokedexAreaScreen->areaGlowTilemap[j + AREA_SCREEN_WIDTH] |= GLOW_TILE_TOP;
if (x != 0 && sPokedexAreaScreen->areaGlowTilemap[j - 1] != GLOW_FULL)
sPokedexAreaScreen->areaGlowTilemap[j - 1] |= GLOW_EDGE_L;
if (x != AREA_SCREEN_WIDTH - 1 && sPokedexAreaScreen->areaGlowTilemap[j + 1] != GLOW_FULL)
sPokedexAreaScreen->areaGlowTilemap[j + 1] |= GLOW_EDGE_R;
if (y != 0 && sPokedexAreaScreen->areaGlowTilemap[j - AREA_SCREEN_WIDTH] != GLOW_FULL)
sPokedexAreaScreen->areaGlowTilemap[j - AREA_SCREEN_WIDTH] |= GLOW_EDGE_T;
if (y != AREA_SCREEN_HEIGHT - 1 && sPokedexAreaScreen->areaGlowTilemap[j + AREA_SCREEN_WIDTH] != GLOW_FULL)
sPokedexAreaScreen->areaGlowTilemap[j + AREA_SCREEN_WIDTH] |= GLOW_EDGE_B;
// Diagonals
if (x != 0 && y != 0 && sPokedexAreaScreen->areaGlowTilemap[j - AREA_SCREEN_WIDTH - 1] != GLOW_TILE_FULL)
sPokedexAreaScreen->areaGlowTilemap[j - AREA_SCREEN_WIDTH - 1] |= GLOW_TILE_BOTTOM_RIGHT;
if (x != AREA_SCREEN_WIDTH - 1 && y != 0 && sPokedexAreaScreen->areaGlowTilemap[j - AREA_SCREEN_WIDTH + 1] != GLOW_TILE_FULL)
sPokedexAreaScreen->areaGlowTilemap[j - AREA_SCREEN_WIDTH + 1] |= GLOW_TILE_BOTTOM_LEFT;
if (x != 0 && y != AREA_SCREEN_HEIGHT - 1 && sPokedexAreaScreen->areaGlowTilemap[j + AREA_SCREEN_WIDTH - 1] != GLOW_TILE_FULL)
sPokedexAreaScreen->areaGlowTilemap[j + AREA_SCREEN_WIDTH - 1] |= GLOW_TILE_TOP_RIGHT;
if (x != AREA_SCREEN_WIDTH - 1 && y != AREA_SCREEN_HEIGHT - 1 && sPokedexAreaScreen->areaGlowTilemap[j + AREA_SCREEN_WIDTH + 1] != GLOW_TILE_FULL)
sPokedexAreaScreen->areaGlowTilemap[j + AREA_SCREEN_WIDTH + 1] |= GLOW_TILE_TOP_LEFT;
// Corners
if (x != 0 && y != 0 && sPokedexAreaScreen->areaGlowTilemap[j - AREA_SCREEN_WIDTH - 1] != GLOW_FULL)
sPokedexAreaScreen->areaGlowTilemap[j - AREA_SCREEN_WIDTH - 1] |= GLOW_CORNER_TL;
if (x != AREA_SCREEN_WIDTH - 1 && y != 0 && sPokedexAreaScreen->areaGlowTilemap[j - AREA_SCREEN_WIDTH + 1] != GLOW_FULL)
sPokedexAreaScreen->areaGlowTilemap[j - AREA_SCREEN_WIDTH + 1] |= GLOW_CORNER_TR;
if (x != 0 && y != AREA_SCREEN_HEIGHT - 1 && sPokedexAreaScreen->areaGlowTilemap[j + AREA_SCREEN_WIDTH - 1] != GLOW_FULL)
sPokedexAreaScreen->areaGlowTilemap[j + AREA_SCREEN_WIDTH - 1] |= GLOW_CORNER_BL;
if (x != AREA_SCREEN_WIDTH - 1 && y != AREA_SCREEN_HEIGHT - 1 && sPokedexAreaScreen->areaGlowTilemap[j + AREA_SCREEN_WIDTH + 1] != GLOW_FULL)
sPokedexAreaScreen->areaGlowTilemap[j + AREA_SCREEN_WIDTH + 1] |= GLOW_CORNER_BR;
}
j++;
}
}
// Scan the tilemap again. Replace the "full tile" indicators with the actual tile id,
// and remove corner flags when they're overlapped by an edge.
for (i = 0; i < ARRAY_COUNT(sPokedexAreaScreen->areaGlowTilemap); i++)
{
if (sPokedexAreaScreen->areaGlowTilemap[i] == GLOW_TILE_FULL)
if (sPokedexAreaScreen->areaGlowTilemap[i] == GLOW_FULL)
{
sPokedexAreaScreen->areaGlowTilemap[i] = 0x10;
sPokedexAreaScreen->areaGlowTilemap[i] |= 0xA000;
sPokedexAreaScreen->areaGlowTilemap[i] = GLOW_TILE_FULL;
sPokedexAreaScreen->areaGlowTilemap[i] |= (GLOW_PALETTE << 12);
}
else if (sPokedexAreaScreen->areaGlowTilemap[i])
{
// Get rid of overlapping flags
if (sPokedexAreaScreen->areaGlowTilemap[i] & GLOW_TILE_RIGHT)
sPokedexAreaScreen->areaGlowTilemap[i] &= ~(GLOW_TILE_BOTTOM_RIGHT | GLOW_TILE_TOP_RIGHT);
if (sPokedexAreaScreen->areaGlowTilemap[i] & GLOW_TILE_LEFT)
sPokedexAreaScreen->areaGlowTilemap[i] &= ~(GLOW_TILE_BOTTOM_LEFT | GLOW_TILE_TOP_LEFT);
if (sPokedexAreaScreen->areaGlowTilemap[i] & GLOW_TILE_BOTTOM)
sPokedexAreaScreen->areaGlowTilemap[i] &= ~(GLOW_TILE_BOTTOM_LEFT | GLOW_TILE_BOTTOM_RIGHT);
if (sPokedexAreaScreen->areaGlowTilemap[i] & GLOW_TILE_TOP)
sPokedexAreaScreen->areaGlowTilemap[i] &= ~(GLOW_TILE_TOP_LEFT | GLOW_TILE_TOP_RIGHT);
// Get rid of overlapping flags.
// This is pointless, as sAreaGlowTilemapMapping can handle overlaps.
if (sPokedexAreaScreen->areaGlowTilemap[i] & GLOW_EDGE_L)
sPokedexAreaScreen->areaGlowTilemap[i] &= ~(GLOW_CORNER_TL | GLOW_CORNER_BL);
if (sPokedexAreaScreen->areaGlowTilemap[i] & GLOW_EDGE_R)
sPokedexAreaScreen->areaGlowTilemap[i] &= ~(GLOW_CORNER_TR | GLOW_CORNER_BR);
if (sPokedexAreaScreen->areaGlowTilemap[i] & GLOW_EDGE_T)
sPokedexAreaScreen->areaGlowTilemap[i] &= ~(GLOW_CORNER_TR | GLOW_CORNER_TL);
if (sPokedexAreaScreen->areaGlowTilemap[i] & GLOW_EDGE_B)
sPokedexAreaScreen->areaGlowTilemap[i] &= ~(GLOW_CORNER_BR | GLOW_CORNER_BL);
// Assign tile id
sPokedexAreaScreen->areaGlowTilemap[i] = sAreaGlowTilemapMapping[sPokedexAreaScreen->areaGlowTilemap[i]];
sPokedexAreaScreen->areaGlowTilemap[i] |= 0xA000;
sPokedexAreaScreen->areaGlowTilemap[i] |= (GLOW_PALETTE << 12);
}
}
}
@ -570,15 +508,15 @@ static void BuildAreaGlowTilemap(void)
static void StartAreaGlow(void)
{
if (sPokedexAreaScreen->numSpecialAreas && sPokedexAreaScreen->numOverworldAreas == 0)
sPokedexAreaScreen->whichMarkersFlashing = 1;
sPokedexAreaScreen->showingMarkers = TRUE;
else
sPokedexAreaScreen->whichMarkersFlashing = 0;
sPokedexAreaScreen->showingMarkers = FALSE;
sPokedexAreaScreen->areaShadeOrMarkerFrameCounter = 0;
sPokedexAreaScreen->areaShadeFrameCounter = 0;
sPokedexAreaScreen->markerTimer = 0;
sPokedexAreaScreen->glowTimer = 0;
sPokedexAreaScreen->areaShadeBldArgLo = 0;
sPokedexAreaScreen->areaShadeBldArgHi = 0x40;
sPokedexAreaScreen->specialMarkerCycleCounter = 1;
sPokedexAreaScreen->areaShadeBldArgHi = 64;
sPokedexAreaScreen->markerFlashCounter = 1;
SetGpuReg(REG_OFFSET_BLDCNT, BLDCNT_TGT1_BG2 | BLDCNT_EFFECT_BLEND | BLDCNT_TGT2_ALL);
SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(0, 16));
DoAreaGlow();
@ -589,12 +527,13 @@ static void DoAreaGlow(void)
u16 x, y;
u16 i;
if (sPokedexAreaScreen->whichMarkersFlashing == 0)
if (!sPokedexAreaScreen->showingMarkers)
{
if (sPokedexAreaScreen->areaShadeOrMarkerFrameCounter == 0)
// Showing area glow
if (sPokedexAreaScreen->markerTimer == 0)
{
sPokedexAreaScreen->areaShadeFrameCounter++;
if (sPokedexAreaScreen->areaShadeFrameCounter & 1)
sPokedexAreaScreen->glowTimer++;
if (sPokedexAreaScreen->glowTimer & 1)
sPokedexAreaScreen->areaShadeBldArgLo = (sPokedexAreaScreen->areaShadeBldArgLo + 4) & 0x7f;
else
sPokedexAreaScreen->areaShadeBldArgHi = (sPokedexAreaScreen->areaShadeBldArgHi + 4) & 0x7f;
@ -602,32 +541,38 @@ static void DoAreaGlow(void)
x = gSineTable[sPokedexAreaScreen->areaShadeBldArgLo] >> 4;
y = gSineTable[sPokedexAreaScreen->areaShadeBldArgHi] >> 4;
SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(x, y));
sPokedexAreaScreen->areaShadeOrMarkerFrameCounter = 0;
if (sPokedexAreaScreen->areaShadeFrameCounter == 0x40)
sPokedexAreaScreen->markerTimer = 0;
if (sPokedexAreaScreen->glowTimer == 64)
{
sPokedexAreaScreen->areaShadeFrameCounter = 0;
// Done glowing, reset and try to switch to the special area markers
sPokedexAreaScreen->glowTimer = 0;
if (sPokedexAreaScreen->numSpecialAreas != 0)
sPokedexAreaScreen->whichMarkersFlashing = 1;
sPokedexAreaScreen->showingMarkers = TRUE;
}
}
else
sPokedexAreaScreen->areaShadeOrMarkerFrameCounter--;
sPokedexAreaScreen->markerTimer--;
}
else
{
sPokedexAreaScreen->areaShadeOrMarkerFrameCounter++;
if (sPokedexAreaScreen->areaShadeOrMarkerFrameCounter > 12)
// Showing special area markers
sPokedexAreaScreen->markerTimer++;
if (sPokedexAreaScreen->markerTimer > 12)
{
sPokedexAreaScreen->areaShadeOrMarkerFrameCounter = 0;
sPokedexAreaScreen->specialMarkerCycleCounter++;
for (i = 0; i < sPokedexAreaScreen->numSpecialAreas; i++)
sPokedexAreaScreen->areaMarkerSprites[i]->invisible = sPokedexAreaScreen->specialMarkerCycleCounter & 1;
sPokedexAreaScreen->markerTimer = 0;
if (sPokedexAreaScreen->specialMarkerCycleCounter > 4)
// Flash the marker
// With a max of 4, the marker will disappear twice
sPokedexAreaScreen->markerFlashCounter++;
for (i = 0; i < sPokedexAreaScreen->numSpecialAreas; i++)
sPokedexAreaScreen->areaMarkerSprites[i]->invisible = sPokedexAreaScreen->markerFlashCounter & 1;
if (sPokedexAreaScreen->markerFlashCounter > 4)
{
sPokedexAreaScreen->specialMarkerCycleCounter = 1;
// Done flashing, reset and try to switch to the area glow
sPokedexAreaScreen->markerFlashCounter = 1;
if (sPokedexAreaScreen->numOverworldAreas != 0)
sPokedexAreaScreen->whichMarkersFlashing = 0;
sPokedexAreaScreen->showingMarkers = FALSE;
}
}
}
@ -690,7 +635,7 @@ static void Task_ShowPokedexAreaScreen(u8 taskId)
CreateAreaUnknownSprites();
break;
case 9:
BeginNormalPaletteFade(PALETTES_ALL & ~(0x14), 0, 16, 0, RGB(0, 0, 0));
BeginNormalPaletteFade(PALETTES_ALL & ~(0x14), 0, 16, 0, RGB_BLACK);
break;
case 10:
SetGpuReg(REG_OFFSET_BLDCNT, BLDCNT_TGT1_BG0 | BLDCNT_EFFECT_BLEND | BLDCNT_TGT2_BG0 | BLDCNT_TGT2_ALL);
@ -740,7 +685,7 @@ static void Task_HandlePokedexAreaScreenInput(u8 taskId)
case 3:
if (gPaletteFade.active)
return;
DestroyAreaMarkerSprites();
DestroyAreaScreenSprites();
sPokedexAreaScreen->screenSwitchState[0] = gTasks[taskId].data[1];
ResetPokedexAreaMapBg();
DestroyTask(taskId);
@ -758,6 +703,7 @@ static void ResetPokedexAreaMapBg(void)
SetBgAttribute(3, BG_ATTR_PALETTEMODE, 0);
}
// Creates the circular sprites to highlight special areas (like caves) where a Pokémon can be found
static void CreateAreaMarkerSprites(void)
{
u8 spriteId;
@ -788,17 +734,20 @@ static void CreateAreaMarkerSprites(void)
sPokedexAreaScreen->numAreaMarkerSprites = numSprites;
}
static void DestroyAreaMarkerSprites(void)
static void DestroyAreaScreenSprites(void)
{
u16 i;
FreeSpriteTilesByTag(2);
FreeSpritePaletteByTag(2);
// Destroy area marker sprites
FreeSpriteTilesByTag(TAG_AREA_MARKER);
FreeSpritePaletteByTag(TAG_AREA_MARKER);
for (i = 0; i < sPokedexAreaScreen->numAreaMarkerSprites; i++)
DestroySprite(sPokedexAreaScreen->areaMarkerSprites[i]);
FreeSpriteTilesByTag(3);
FreeSpritePaletteByTag(3);
for (i = 0; i < 3; i++)
// Destroy "Area Unknown" sprites
FreeSpriteTilesByTag(TAG_AREA_UNKNOWN);
FreeSpritePaletteByTag(TAG_AREA_UNKNOWN);
for (i = 0; i < ARRAY_COUNT(sPokedexAreaScreen->areaUnknownSprites); i++)
{
if (sPokedexAreaScreen->areaUnknownSprites[i])
DestroySprite(sPokedexAreaScreen->areaUnknownSprites[i]);
@ -809,8 +758,8 @@ static void LoadAreaUnknownGraphics(void)
{
struct SpriteSheet spriteSheet = {
.data = sPokedexAreaScreen->areaUnknownGraphicsBuffer,
.size = 0x600,
.tag = 3,
.size = sizeof(sPokedexAreaScreen->areaUnknownGraphicsBuffer),
.tag = TAG_AREA_UNKNOWN,
};
LZ77UnCompWram(gPokedexAreaScreenAreaUnknown_Gfx, sPokedexAreaScreen->areaUnknownGraphicsBuffer);
LoadSpriteSheet(&spriteSheet);
@ -820,25 +769,27 @@ static void LoadAreaUnknownGraphics(void)
static void CreateAreaUnknownSprites(void)
{
u16 i;
u8 spriteId;
if (sPokedexAreaScreen->numOverworldAreas || sPokedexAreaScreen->numSpecialAreas)
{
for (i = 0; i < 3; i++)
// The current species is present on the map, don't create any "Area Unknown" sprites
for (i = 0; i < ARRAY_COUNT(sPokedexAreaScreen->areaUnknownSprites); i++)
sPokedexAreaScreen->areaUnknownSprites[i] = NULL;
}
else
{
for (i = 0; i < 3; i++)
// The current species is absent on the map, try to create "Area Unknown" sprites
for (i = 0; i < ARRAY_COUNT(sPokedexAreaScreen->areaUnknownSprites); i++)
{
spriteId = CreateSprite(&sAreaUnknownSpriteTemplate, i * 32 + 0xa0, 0x8c, 0);
u8 spriteId = CreateSprite(&sAreaUnknownSpriteTemplate, i * 32 + 160, 140, 0);
if (spriteId != MAX_SPRITES)
{
gSprites[spriteId].oam.tileNum += i * 16;
sPokedexAreaScreen->areaUnknownSprites[i] = gSprites + spriteId;
sPokedexAreaScreen->areaUnknownSprites[i] = &gSprites[spriteId];
}
else
{
// Failed to create sprite
sPokedexAreaScreen->areaUnknownSprites[i] = NULL;
}
}

View File

@ -45,6 +45,8 @@ enum {
#define WILD_CHECK_REPEL (1 << 0)
#define WILD_CHECK_KEEN_EYE (1 << 1)
#define HEADER_NONE 0xFFFF
static u16 FeebasRandom(void);
static void FeebasSeedRng(u16 seed);
static bool8 IsWildLevelAllowedByRepel(u8 level);
@ -172,6 +174,7 @@ static void FeebasSeedRng(u16 seed)
sFeebasRngValue = seed;
}
// LAND_WILD_COUNT
static u8 ChooseWildMonIndex_Land(void)
{
u8 rand = Random() % ENCOUNTER_CHANCE_LAND_MONS_TOTAL;
@ -202,6 +205,7 @@ static u8 ChooseWildMonIndex_Land(void)
return 11;
}
// ROCK_WILD_COUNT / WATER_WILD_COUNT
static u8 ChooseWildMonIndex_WaterRock(void)
{
u8 rand = Random() % ENCOUNTER_CHANCE_WATER_MONS_TOTAL;
@ -218,6 +222,7 @@ static u8 ChooseWildMonIndex_WaterRock(void)
return 4;
}
// FISH_WILD_COUNT
static u8 ChooseWildMonIndex_Fishing(u8 rod)
{
u8 wildMonIndex = 0;
@ -310,7 +315,7 @@ static u16 GetCurrentMapWildMonHeaderId(void)
gSaveBlock1Ptr->location.mapNum == MAP_NUM(ALTERING_CAVE))
{
u16 alteringCaveId = VarGet(VAR_ALTERING_CAVE_WILD_SET);
if (alteringCaveId > 8)
if (alteringCaveId >= NUM_ALTERING_CAVE_TABLES)
alteringCaveId = 0;
i += alteringCaveId;
@ -320,7 +325,7 @@ static u16 GetCurrentMapWildMonHeaderId(void)
}
}
return -1;
return HEADER_NONE;
}
static u8 PickWildMonNature(void)
@ -541,7 +546,7 @@ bool8 StandardWildEncounter(u16 currMetaTileBehavior, u16 previousMetaTileBehavi
return FALSE;
headerId = GetCurrentMapWildMonHeaderId();
if (headerId == 0xFFFF)
if (headerId == HEADER_NONE)
{
if (gMapHeader.mapLayoutId == LAYOUT_BATTLE_FRONTIER_BATTLE_PIKE_ROOM_WILD_MONS)
{
@ -652,7 +657,7 @@ void RockSmashWildEncounter(void)
{
u16 headerId = GetCurrentMapWildMonHeaderId();
if (headerId != 0xFFFF)
if (headerId != HEADER_NONE)
{
const struct WildPokemonInfo *wildPokemonInfo = gWildMonHeaders[headerId].rockSmashMonsInfo;
@ -684,7 +689,7 @@ bool8 SweetScentWildEncounter(void)
PlayerGetDestCoords(&x, &y);
headerId = GetCurrentMapWildMonHeaderId();
if (headerId == 0xFFFF)
if (headerId == HEADER_NONE)
{
if (gMapHeader.mapLayoutId == LAYOUT_BATTLE_FRONTIER_BATTLE_PIKE_ROOM_WILD_MONS)
{
@ -754,7 +759,7 @@ bool8 DoesCurrentMapHaveFishingMons(void)
{
u16 headerId = GetCurrentMapWildMonHeaderId();
if (headerId != 0xFFFF && gWildMonHeaders[headerId].fishingMonsInfo != NULL)
if (headerId != HEADER_NONE && gWildMonHeaders[headerId].fishingMonsInfo != NULL)
return TRUE;
else
return FALSE;
@ -788,7 +793,7 @@ u16 GetLocalWildMon(bool8 *isWaterMon)
*isWaterMon = FALSE;
headerId = GetCurrentMapWildMonHeaderId();
if (headerId == 0xFFFF)
if (headerId == HEADER_NONE)
return SPECIES_NONE;
landMonsInfo = gWildMonHeaders[headerId].landMonsInfo;
waterMonsInfo = gWildMonHeaders[headerId].waterMonsInfo;
@ -820,7 +825,7 @@ u16 GetLocalWaterMon(void)
{
u16 headerId = GetCurrentMapWildMonHeaderId();
if (headerId != 0xFFFF)
if (headerId != HEADER_NONE)
{
const struct WildPokemonInfo *waterMonsInfo = gWildMonHeaders[headerId].waterMonsInfo;