Merge branch 'porymap-6' into generate-map-constants

This commit is contained in:
GriffinR
2024-12-09 20:25:41 -05:00
committed by GitHub
17 changed files with 316 additions and 476 deletions

View File

@@ -266,6 +266,8 @@ include audio_rules.mk
# NOTE: Tools must have been built prior (FIXME)
# so you can't really call this rule directly
generated: $(AUTO_GEN_TARGETS)
@: # Silence the "Nothing to be done for `generated'" message, which some people were confusing for an error.
%.s: ;
%.png: ;
@@ -378,6 +380,7 @@ libagbsyscall:
@$(MAKE) -C libagbsyscall TOOLCHAIN=$(TOOLCHAIN) MODERN=$(MODERN)
# Elf from object files
LDFLAGS = -Map ../../$(MAP)
$(ELF): $(LD_SCRIPT) $(LD_SCRIPT_DEPS) $(OBJS) libagbsyscall
@cd $(OBJ_DIR) && $(LD) $(LDFLAGS) -T ../../$< --print-memory-usage -o ../../$@ $(OBJS_REL) $(LIB) | cat
@echo "cd $(OBJ_DIR) && $(LD) $(LDFLAGS) -T ../../$< --print-memory-usage -o ../../$@ <objs> <libs> | cat"

View File

@@ -1613,6 +1613,8 @@ AI_CV_Disable2:
AI_CV_Disable_End:
end
@ BUG: The original script would score up Counter when the target's types were not physical
@ This is incorrect since Counter only deals double the damage received if hit by a physical attack
AI_CV_Counter:
if_status AI_TARGET, STATUS1_SLEEP, AI_CV_Counter_ScoreDown1
if_status2 AI_TARGET, STATUS2_INFATUATION, AI_CV_Counter_ScoreDown1
@@ -1625,7 +1627,7 @@ AI_CV_Counter2:
if_random_less_than 100, AI_CV_Counter3
score -1
AI_CV_Counter3:
if_has_move AI_USER, MOVE_MIRROR_COAT, AI_CV_Counter7
if_has_move AI_USER, MOVE_MIRROR_COAT, AI_CV_Counter8
get_last_used_bank_move AI_TARGET
get_move_power_from_result
if_equal 0, AI_CV_Counter5
@@ -1645,15 +1647,24 @@ AI_CV_Counter5:
if_random_less_than 100, AI_CV_Counter6
score +1
AI_CV_Counter6:
#ifdef BUGFIX
get_target_type1
if_in_bytes AI_CV_Counter_PhysicalTypeList, AI_CV_Counter7
get_target_type2
if_in_bytes AI_CV_Counter_PhysicalTypeList, AI_CV_Counter7
goto AI_CV_Counter_End
#else
get_target_type1
if_in_bytes AI_CV_Counter_PhysicalTypeList, AI_CV_Counter_End
get_target_type2
if_in_bytes AI_CV_Counter_PhysicalTypeList, AI_CV_Counter_End
if_random_less_than 50, AI_CV_Counter_End
#endif
AI_CV_Counter7:
if_random_less_than 100, AI_CV_Counter8
score +4
if_random_less_than 50, AI_CV_Counter_End
AI_CV_Counter8:
if_random_less_than 100, AI_CV_Counter9
score +4
AI_CV_Counter9:
end
AI_CV_Counter_ScoreDown1:
@@ -2100,6 +2111,8 @@ AI_CV_PsychUp_ScoreDown2:
AI_CV_PsychUp_End:
end
@ BUG: The original script would score up Mirror Coat when the target's types were not special
@ This is incorrect since Mirror Coat only deals double the damage received if hit by a special attack
AI_CV_MirrorCoat:
if_status AI_TARGET, STATUS1_SLEEP, AI_CV_MirrorCoat_ScoreDown1
if_status2 AI_TARGET, STATUS2_INFATUATION, AI_CV_MirrorCoat_ScoreDown1
@@ -2132,10 +2145,19 @@ AI_CV_MirrorCoat5:
if_random_less_than 100, AI_CV_MirrorCoat6
score +1
AI_CV_MirrorCoat6:
#ifdef BUGFIX
get_target_type1
if_in_bytes AI_CV_MirrorCoat_SpecialTypeList, AI_CV_MirrorCoat7
get_target_type2
if_in_bytes AI_CV_MirrorCoat_SpecialTypeList, AI_CV_MirrorCoat7
goto AI_CV_MirrorCoat_End
#else
get_target_type1
if_in_bytes AI_CV_MirrorCoat_SpecialTypeList, AI_CV_MirrorCoat_End
get_target_type2
if_in_bytes AI_CV_MirrorCoat_SpecialTypeList, AI_CV_MirrorCoat_End
#endif
AI_CV_MirrorCoat7:
if_random_less_than 50, AI_CV_MirrorCoat_End
AI_CV_MirrorCoat_ScoreUp4:
if_random_less_than 100, AI_CV_MirrorCoat_ScoreUp4_End

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@@ -22,6 +22,7 @@ POKEDEXGFXDIR := graphics/pokedex
STARTERGFXDIR := graphics/starter_choose
NAMINGGFXDIR := graphics/naming_screen
SPINDAGFXDIR := graphics/pokemon/spinda/spots
TITLESCREENGFXDIR := graphics/title_screen
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
@@ -298,9 +299,13 @@ $(FONTGFXDIR)/frlg_female.fwjpnfont: $(FONTGFXDIR)/japanese_frlg_female.png
### Miscellaneous ###
graphics/title_screen/pokemon_logo.gbapal: %.gbapal: %.pal
$(TITLESCREENGFXDIR)/pokemon_logo.gbapal: %.gbapal: %.pal
$(GFX) $< $@ -num_colors 224
$(TITLESCREENGFXDIR)/emerald_version.8bpp: %.8bpp: %.png
$(GFX) $< $@ -mwidth 8 -mheight 4
graphics/pokemon_jump/bg.4bpp: %.4bpp: %.png
$(GFX) $< $@ -num_tiles 63 -Wnum_tiles

View File

@@ -1,6 +1,8 @@
#ifndef GUARD_BARD_MUSIC_H
#define GUARD_BARD_MUSIC_H
#define BARD_SOUND_MAX_LENGTH 6
struct BardSound
{
/*0x00*/ u8 songLengthId;
@@ -26,8 +28,8 @@ struct BardSong
/*0x06*/ u16 volume;
/*0x08*/ s16 pitch;
/*0x0A*/ s16 voiceInflection;
/*0x0C*/ u16 lyrics[6];
/*0x18*/ struct BardPhoneme phonemes[6];
/*0x0C*/ u16 lyrics[BARD_SOUND_MAX_LENGTH];
/*0x18*/ struct BardPhoneme phonemes[BARD_SOUND_MAX_LENGTH];
/*0x30*/ const struct BardSound *sound;
};

View File

@@ -1,4 +1,5 @@
# Will be moved to build/ eventually
map_groups.h
layouts.h
region_map_sections.h
map_event_ids.h

View File

@@ -1,227 +0,0 @@
#ifndef GUARD_REGIONMAPSEC_H
#define GUARD_REGIONMAPSEC_H
#define MAPSEC_LITTLEROOT_TOWN 0x00
#define MAPSEC_OLDALE_TOWN 0x01
#define MAPSEC_DEWFORD_TOWN 0x02
#define MAPSEC_LAVARIDGE_TOWN 0x03
#define MAPSEC_FALLARBOR_TOWN 0x04
#define MAPSEC_VERDANTURF_TOWN 0x05
#define MAPSEC_PACIFIDLOG_TOWN 0x06
#define MAPSEC_PETALBURG_CITY 0x07
#define MAPSEC_SLATEPORT_CITY 0x08
#define MAPSEC_MAUVILLE_CITY 0x09
#define MAPSEC_RUSTBORO_CITY 0x0A
#define MAPSEC_FORTREE_CITY 0x0B
#define MAPSEC_LILYCOVE_CITY 0x0C
#define MAPSEC_MOSSDEEP_CITY 0x0D
#define MAPSEC_SOOTOPOLIS_CITY 0x0E
#define MAPSEC_EVER_GRANDE_CITY 0x0F
#define MAPSEC_ROUTE_101 0x10
#define MAPSEC_ROUTE_102 0x11
#define MAPSEC_ROUTE_103 0x12
#define MAPSEC_ROUTE_104 0x13
#define MAPSEC_ROUTE_105 0x14
#define MAPSEC_ROUTE_106 0x15
#define MAPSEC_ROUTE_107 0x16
#define MAPSEC_ROUTE_108 0x17
#define MAPSEC_ROUTE_109 0x18
#define MAPSEC_ROUTE_110 0x19
#define MAPSEC_ROUTE_111 0x1A
#define MAPSEC_ROUTE_112 0x1B
#define MAPSEC_ROUTE_113 0x1C
#define MAPSEC_ROUTE_114 0x1D
#define MAPSEC_ROUTE_115 0x1E
#define MAPSEC_ROUTE_116 0x1F
#define MAPSEC_ROUTE_117 0x20
#define MAPSEC_ROUTE_118 0x21
#define MAPSEC_ROUTE_119 0x22
#define MAPSEC_ROUTE_120 0x23
#define MAPSEC_ROUTE_121 0x24
#define MAPSEC_ROUTE_122 0x25
#define MAPSEC_ROUTE_123 0x26
#define MAPSEC_ROUTE_124 0x27
#define MAPSEC_ROUTE_125 0x28
#define MAPSEC_ROUTE_126 0x29
#define MAPSEC_ROUTE_127 0x2A
#define MAPSEC_ROUTE_128 0x2B
#define MAPSEC_ROUTE_129 0x2C
#define MAPSEC_ROUTE_130 0x2D
#define MAPSEC_ROUTE_131 0x2E
#define MAPSEC_ROUTE_132 0x2F
#define MAPSEC_ROUTE_133 0x30
#define MAPSEC_ROUTE_134 0x31
#define MAPSEC_UNDERWATER_124 0x32
#define MAPSEC_UNDERWATER_126 0x33
#define MAPSEC_UNDERWATER_127 0x34
#define MAPSEC_UNDERWATER_128 0x35
#define MAPSEC_UNDERWATER_SOOTOPOLIS 0x36
#define MAPSEC_GRANITE_CAVE 0x37
#define MAPSEC_MT_CHIMNEY 0x38
#define MAPSEC_SAFARI_ZONE 0x39
#define MAPSEC_BATTLE_FRONTIER 0x3A
#define MAPSEC_PETALBURG_WOODS 0x3B
#define MAPSEC_RUSTURF_TUNNEL 0x3C
#define MAPSEC_ABANDONED_SHIP 0x3D
#define MAPSEC_NEW_MAUVILLE 0x3E
#define MAPSEC_METEOR_FALLS 0x3F
#define MAPSEC_METEOR_FALLS2 0x40
#define MAPSEC_MT_PYRE 0x41
#define MAPSEC_AQUA_HIDEOUT_OLD 0x42
#define MAPSEC_SHOAL_CAVE 0x43
#define MAPSEC_SEAFLOOR_CAVERN 0x44
#define MAPSEC_UNDERWATER_SEAFLOOR_CAVERN 0x45
#define MAPSEC_VICTORY_ROAD 0x46
#define MAPSEC_MIRAGE_ISLAND 0x47
#define MAPSEC_CAVE_OF_ORIGIN 0x48
#define MAPSEC_SOUTHERN_ISLAND 0x49
#define MAPSEC_FIERY_PATH 0x4A
#define MAPSEC_FIERY_PATH2 0x4B
#define MAPSEC_JAGGED_PASS 0x4C
#define MAPSEC_JAGGED_PASS2 0x4D
#define MAPSEC_SEALED_CHAMBER 0x4E
#define MAPSEC_UNDERWATER_SEALED_CHAMBER 0x4F
#define MAPSEC_SCORCHED_SLAB 0x50
#define MAPSEC_ISLAND_CAVE 0x51
#define MAPSEC_DESERT_RUINS 0x52
#define MAPSEC_ANCIENT_TOMB 0x53
#define MAPSEC_INSIDE_OF_TRUCK 0x54
#define MAPSEC_SKY_PILLAR 0x55
#define MAPSEC_SECRET_BASE 0x56
#define MAPSEC_DYNAMIC 0x57
#define MAPSEC_PALLET_TOWN 0x58
#define MAPSEC_VIRIDIAN_CITY 0x59
#define MAPSEC_PEWTER_CITY 0x5A
#define MAPSEC_CERULEAN_CITY 0x5B
#define MAPSEC_LAVENDER_TOWN 0x5C
#define MAPSEC_VERMILION_CITY 0x5D
#define MAPSEC_CELADON_CITY 0x5E
#define MAPSEC_FUCHSIA_CITY 0x5F
#define MAPSEC_CINNABAR_ISLAND 0x60
#define MAPSEC_INDIGO_PLATEAU 0x61
#define MAPSEC_SAFFRON_CITY 0x62
#define MAPSEC_ROUTE_4_POKECENTER 0x63
#define MAPSEC_ROUTE_10_POKECENTER 0x64
#define MAPSEC_ROUTE_1 0x65
#define MAPSEC_ROUTE_2 0x66
#define MAPSEC_ROUTE_3 0x67
#define MAPSEC_ROUTE_4 0x68
#define MAPSEC_ROUTE_5 0x69
#define MAPSEC_ROUTE_6 0x6A
#define MAPSEC_ROUTE_7 0x6B
#define MAPSEC_ROUTE_8 0x6C
#define MAPSEC_ROUTE_9 0x6D
#define MAPSEC_ROUTE_10 0x6E
#define MAPSEC_ROUTE_11 0x6F
#define MAPSEC_ROUTE_12 0x70
#define MAPSEC_ROUTE_13 0x71
#define MAPSEC_ROUTE_14 0x72
#define MAPSEC_ROUTE_15 0x73
#define MAPSEC_ROUTE_16 0x74
#define MAPSEC_ROUTE_17 0x75
#define MAPSEC_ROUTE_18 0x76
#define MAPSEC_ROUTE_19 0x77
#define MAPSEC_ROUTE_20 0x78
#define MAPSEC_ROUTE_21 0x79
#define MAPSEC_ROUTE_22 0x7A
#define MAPSEC_ROUTE_23 0x7B
#define MAPSEC_ROUTE_24 0x7C
#define MAPSEC_ROUTE_25 0x7D
#define MAPSEC_VIRIDIAN_FOREST 0x7E
#define MAPSEC_MT_MOON 0x7F
#define MAPSEC_S_S_ANNE 0x80
#define MAPSEC_UNDERGROUND_PATH 0x81
#define MAPSEC_UNDERGROUND_PATH_2 0x82
#define MAPSEC_DIGLETTS_CAVE 0x83
#define MAPSEC_KANTO_VICTORY_ROAD 0x84
#define MAPSEC_ROCKET_HIDEOUT 0x85
#define MAPSEC_SILPH_CO 0x86
#define MAPSEC_POKEMON_MANSION 0x87
#define MAPSEC_KANTO_SAFARI_ZONE 0x88
#define MAPSEC_POKEMON_LEAGUE 0x89
#define MAPSEC_ROCK_TUNNEL 0x8A
#define MAPSEC_SEAFOAM_ISLANDS 0x8B
#define MAPSEC_POKEMON_TOWER 0x8C
#define MAPSEC_CERULEAN_CAVE 0x8D
#define MAPSEC_POWER_PLANT 0x8E
#define MAPSEC_ONE_ISLAND 0x8F
#define MAPSEC_TWO_ISLAND 0x90
#define MAPSEC_THREE_ISLAND 0x91
#define MAPSEC_FOUR_ISLAND 0x92
#define MAPSEC_FIVE_ISLAND 0x93
#define MAPSEC_SEVEN_ISLAND 0x94
#define MAPSEC_SIX_ISLAND 0x95
#define MAPSEC_KINDLE_ROAD 0x96
#define MAPSEC_TREASURE_BEACH 0x97
#define MAPSEC_CAPE_BRINK 0x98
#define MAPSEC_BOND_BRIDGE 0x99
#define MAPSEC_THREE_ISLE_PORT 0x9A
#define MAPSEC_SEVII_ISLE_6 0x9B
#define MAPSEC_SEVII_ISLE_7 0x9C
#define MAPSEC_SEVII_ISLE_8 0x9D
#define MAPSEC_SEVII_ISLE_9 0x9E
#define MAPSEC_RESORT_GORGEOUS 0x9F
#define MAPSEC_WATER_LABYRINTH 0xA0
#define MAPSEC_FIVE_ISLE_MEADOW 0xA1
#define MAPSEC_MEMORIAL_PILLAR 0xA2
#define MAPSEC_OUTCAST_ISLAND 0xA3
#define MAPSEC_GREEN_PATH 0xA4
#define MAPSEC_WATER_PATH 0xA5
#define MAPSEC_RUIN_VALLEY 0xA6
#define MAPSEC_TRAINER_TOWER 0xA7
#define MAPSEC_CANYON_ENTRANCE 0xA8
#define MAPSEC_SEVAULT_CANYON 0xA9
#define MAPSEC_TANOBY_RUINS 0xAA
#define MAPSEC_SEVII_ISLE_22 0xAB
#define MAPSEC_SEVII_ISLE_23 0xAC
#define MAPSEC_SEVII_ISLE_24 0xAD
#define MAPSEC_NAVEL_ROCK_FRLG 0xAE
#define MAPSEC_MT_EMBER 0xAF
#define MAPSEC_BERRY_FOREST 0xB0
#define MAPSEC_ICEFALL_CAVE 0xB1
#define MAPSEC_ROCKET_WAREHOUSE 0xB2
#define MAPSEC_TRAINER_TOWER_2 0xB3
#define MAPSEC_DOTTED_HOLE 0xB4
#define MAPSEC_LOST_CAVE 0xB5
#define MAPSEC_PATTERN_BUSH 0xB6
#define MAPSEC_ALTERING_CAVE_FRLG 0xB7
#define MAPSEC_TANOBY_CHAMBERS 0xB8
#define MAPSEC_THREE_ISLE_PATH 0xB9
#define MAPSEC_TANOBY_KEY 0xBA
#define MAPSEC_BIRTH_ISLAND_FRLG 0xBB
#define MAPSEC_MONEAN_CHAMBER 0xBC
#define MAPSEC_LIPTOO_CHAMBER 0xBD
#define MAPSEC_WEEPTH_CHAMBER 0xBE
#define MAPSEC_DILFORD_CHAMBER 0xBF
#define MAPSEC_SCUFIB_CHAMBER 0xC0
#define MAPSEC_RIXY_CHAMBER 0xC1
#define MAPSEC_VIAPOIS_CHAMBER 0xC2
#define MAPSEC_EMBER_SPA 0xC3
#define MAPSEC_SPECIAL_AREA 0xC4
#define MAPSEC_AQUA_HIDEOUT 0xC5
#define MAPSEC_MAGMA_HIDEOUT 0xC6
#define MAPSEC_MIRAGE_TOWER 0xC7
#define MAPSEC_BIRTH_ISLAND 0xC8
#define MAPSEC_FARAWAY_ISLAND 0xC9
#define MAPSEC_ARTISAN_CAVE 0xCA
#define MAPSEC_MARINE_CAVE 0xCB
#define MAPSEC_UNDERWATER_MARINE_CAVE 0xCC
#define MAPSEC_TERRA_CAVE 0xCD
#define MAPSEC_UNDERWATER_105 0xCE
#define MAPSEC_UNDERWATER_125 0xCF
#define MAPSEC_UNDERWATER_129 0xD0
#define MAPSEC_DESERT_UNDERPASS 0xD1
#define MAPSEC_ALTERING_CAVE 0xD2
#define MAPSEC_NAVEL_ROCK 0xD3
#define MAPSEC_TRAINER_HILL 0xD4
#define MAPSEC_NONE 0xD5
#define METLOC_SPECIAL_EGG 0xFD
#define METLOC_IN_GAME_TRADE 0xFE
#define METLOC_FATEFUL_ENCOUNTER 0xFF
#define KANTO_MAPSEC_START MAPSEC_PALLET_TOWN
#define KANTO_MAPSEC_END MAPSEC_SPECIAL_AREA
#define KANTO_MAPSEC_COUNT (KANTO_MAPSEC_END - KANTO_MAPSEC_START + 1)
#endif //GUARD_REGIONMAPSEC_H

View File

@@ -12,3 +12,7 @@ $(DATA_SRC_SUBDIR)/region_map/region_map_entries.h: $(DATA_SRC_SUBDIR)/region_ma
$(JSONPROC) $^ $@
$(C_BUILDDIR)/region_map.o: c_dep += $(DATA_SRC_SUBDIR)/region_map/region_map_entries.h
AUTO_GEN_TARGETS += include/constants/region_map_sections.h
include/constants/region_map_sections.h: $(DATA_SRC_SUBDIR)/region_map/region_map_sections.json $(DATA_SRC_SUBDIR)/region_map/region_map_sections.constants.json.txt
$(JSONPROC) $^ $@

View File

@@ -48,7 +48,7 @@ void GetWordPhonemes(struct BardSong *song, u16 word)
const struct BardSound *sound;
song->length = 0;
for (i = 0; i < 6; i ++)
for (i = 0; i < BARD_SOUND_MAX_LENGTH; i ++)
{
sound = &song->sound[i];
if (sound->songLengthId != 0xFF)

View File

@@ -858,23 +858,22 @@ static const struct CompressedSpriteSheet sSpriteSheets_ContestantsTurnBlinkEffe
}
};
// Yup this is super dangerous but that's how it is here
static const struct SpritePalette sSpritePalettes_ContestantsTurnBlinkEffect[CONTESTANT_COUNT] =
{
{
.data = (u16 *)(gHeap + 0x1A0A4),
.data = eContestTempSave.cachedWindowPalettes[5],
.tag = TAG_BLINK_EFFECT_CONTESTANT0
},
{
.data = (u16 *)(gHeap + 0x1A0C4),
.data = eContestTempSave.cachedWindowPalettes[6],
.tag = TAG_BLINK_EFFECT_CONTESTANT1
},
{
.data = (u16 *)(gHeap + 0x1A0E4),
.data = eContestTempSave.cachedWindowPalettes[7],
.tag = TAG_BLINK_EFFECT_CONTESTANT2
},
{
.data = (u16 *)(gHeap + 0x1A104),
.data = eContestTempSave.cachedWindowPalettes[8],
.tag = TAG_BLINK_EFFECT_CONTESTANT3
}
};

View File

@@ -5,7 +5,7 @@
const u16 gNumBardWords_Moves = MOVES_COUNT;
const struct BardSound gBardSounds_Moves[MOVES_COUNT][6] = {
const struct BardSound gBardSounds_Moves[MOVES_COUNT][BARD_SOUND_MAX_LENGTH] = {
[MOVE_NONE] = {
NULL_BARD_SOUND,
NULL_BARD_SOUND,

View File

@@ -3,7 +3,7 @@
const u16 gNumBardWords_Species = NUM_SPECIES;
const struct BardSound gBardSounds_Pokemon[NUM_SPECIES][6] = {
const struct BardSound gBardSounds_Pokemon[NUM_SPECIES][BARD_SOUND_MAX_LENGTH] = {
[SPECIES_NONE] = {
NULL_BARD_SOUND,
NULL_BARD_SOUND,

View File

@@ -0,0 +1,22 @@
{{ doNotModifyHeader }}
#ifndef GUARD_CONSTANTS_REGION_MAP_SECTIONS_H
#define GUARD_CONSTANTS_REGION_MAP_SECTIONS_H
enum {
## for map_section in map_sections
{{ map_section.id }},
## endfor
MAPSEC_NONE,
MAPSEC_COUNT
};
// Special location IDs that use the same value space as MAPSECs.
#define METLOC_SPECIAL_EGG 0xFD
#define METLOC_IN_GAME_TRADE 0xFE
#define METLOC_FATEFUL_ENCOUNTER 0xFF
#define KANTO_MAPSEC_START MAPSEC_PALLET_TOWN
#define KANTO_MAPSEC_END MAPSEC_SPECIAL_AREA
#define KANTO_MAPSEC_COUNT (KANTO_MAPSEC_END - KANTO_MAPSEC_START + 1)
#endif // GUARD_CONSTANTS_REGION_MAP_SECTIONS_H

File diff suppressed because it is too large Load Diff

View File

@@ -3,21 +3,25 @@
#define GUARD_DATA_REGION_MAP_REGION_MAP_ENTRIES_H
## for map_section in map_sections
{% if isEmptyString(getVar(map_section.name)) and not existsIn(map_section, "name_clone") %}{{ setVar(map_section.name, map_section.map_section) }}{% endif %}
{% if existsIn(map_section, "name") and isEmptyString(getVar(map_section.name)) and not existsIn(map_section, "name_clone") %}{{ setVar(map_section.name, map_section.id) }}{% endif %}
## endfor
## for map_section in map_sections
{% if getVar(map_section.name) == map_section.map_section %}
{% if existsIn(map_section, "name") %}
{% if getVar(map_section.name) == map_section.id %}
static const u8 sMapName_{{ cleanString(map_section.name) }}[] = _("{{ map_section.name }}");
{% endif %}
{% if existsIn(map_section, "name_clone") %}
static const u8 sMapName_{{ cleanString(map_section.name) }}_Clone[] = _("{{ map_section.name }}");
{% endif %}
{% endif %}
## endfor
const struct RegionMapLocation gRegionMapEntries[] = {
## for map_section in map_sections
[{{ map_section.map_section }}] = { {{ map_section.x }}, {{ map_section.y }}, {{ map_section.width }}, {{ map_section.height }}, sMapName_{{ cleanString(map_section.name) }}{% if existsIn(map_section, "name_clone") %}_Clone{% endif %} },
{% if existsIn(map_section, "x") and existsIn(map_section, "y") and existsIn(map_section, "width") and existsIn(map_section, "height") and existsIn(map_section, "name") %}
[{{ map_section.id }}] = { {{ map_section.x }}, {{ map_section.y }}, {{ map_section.width }}, {{ map_section.height }}, sMapName_{{ cleanString(map_section.name) }}{% if existsIn(map_section, "name_clone") %}_Clone{% endif %} },
{% endif %}
## endfor
};

View File

@@ -69,7 +69,10 @@ static const u16 sMapPopUp_PaletteTable[][16] =
static const u16 sMapPopUp_Palette_Underwater[16] = INCBIN_U16("graphics/map_popup/underwater.gbapal");
static const u8 sRegionMapSectionId_To_PopUpThemeIdMapping[] =
// -1 in the size excludes MAPSEC_NONE.
// The MAPSEC values for Kanto (between MAPSEC_DYNAMIC and MAPSEC_AQUA_HIDEOUT) are also excluded,
// and this is then handled by subtracting KANTO_MAPSEC_COUNT here and in LoadMapNamePopUpWindowBg.
static const u8 sMapSectionToThemeId[MAPSEC_COUNT - KANTO_MAPSEC_COUNT - 1] =
{
[MAPSEC_LITTLEROOT_TOWN] = MAPPOPUP_THEME_WOOD,
[MAPSEC_OLDALE_TOWN] = MAPPOPUP_THEME_WOOD,
@@ -174,7 +177,7 @@ static const u8 sRegionMapSectionId_To_PopUpThemeIdMapping[] =
[MAPSEC_DESERT_UNDERPASS - KANTO_MAPSEC_COUNT] = MAPPOPUP_THEME_STONE,
[MAPSEC_ALTERING_CAVE - KANTO_MAPSEC_COUNT] = MAPPOPUP_THEME_STONE,
[MAPSEC_NAVEL_ROCK - KANTO_MAPSEC_COUNT] = MAPPOPUP_THEME_STONE,
[MAPSEC_TRAINER_HILL - KANTO_MAPSEC_COUNT] = MAPPOPUP_THEME_MARBLE
[MAPSEC_TRAINER_HILL - KANTO_MAPSEC_COUNT] = MAPPOPUP_THEME_MARBLE,
};
static const u8 sText_PyramidFloor1[] = _("PYRAMID FLOOR 1");
@@ -410,7 +413,7 @@ static void LoadMapNamePopUpWindowBg(void)
else
regionMapSectionId = 0; // Discard kanto region sections;
}
popUpThemeId = sRegionMapSectionId_To_PopUpThemeIdMapping[regionMapSectionId];
popUpThemeId = sMapSectionToThemeId[regionMapSectionId];
LoadBgTiles(GetWindowAttribute(popupWindowId, WINDOW_BG), sMapPopUp_OutlineTable[popUpThemeId], 0x400, 0x21D);
CallWindowFunction(popupWindowId, DrawMapNamePopUpFrame);

View File

@@ -5684,7 +5684,7 @@ u16 SpeciesToCryId(u16 species)
// To draw a spot pixel, add 4 to the color index
#define SPOT_COLOR_ADJUSTMENT 4
/*
The macro below handles drawing the randomly-placed spots on Spinda's front sprite.
The macros below handle drawing the randomly-placed spots on Spinda's front sprite.
Spinda has 4 spots, each with an entry in gSpindaSpotGraphics. Each entry contains
a base x and y coordinate for the spot and a 16x16 binary image. Each bit in the image
determines whether that pixel should be considered part of the spot.
@@ -5696,18 +5696,26 @@ u16 SpeciesToCryId(u16 species)
coordinate is calculated as (baseCoord + (given 4 bits of personality) - 8). In effect this
means each spot can start at any position -8 to +7 off of its base coordinates (256 possibilities).
The macro then loops over the 16x16 spot image. For each bit in the spot's binary image, if
DRAW_SPINDA_SPOTS loops over the 16x16 spot image. For each bit in the spot's binary image, if
the bit is set then it's part of the spot; try to draw it. A pixel is drawn on Spinda if the
pixel on Spinda satisfies the following formula: ((u8)(colorIndex - 1) <= 2). The -1 excludes
transparent pixels, as these are index 0. Therefore only colors 1, 2, or 3 on Spinda will
allow a spot to be drawn. These color indexes are Spinda's light brown body colors. To create
pixel is between FIRST_SPOT_COLOR and LAST_SPOT_COLOR (so only colors 1, 2, or 3 on Spinda will
allow a spot to be drawn). These color indexes are Spinda's light brown body colors. To create
the spot it adds 4 to the color index, so Spinda's spots will be colors 5, 6, and 7.
The above is done two different ways in the macro: one with << 4, and one without. This
is because Spinda's sprite is a 4 bits per pixel image, but the pointer to Spinda's pixels
The above is done in TRY_DRAW_SPOT_PIXEL two different ways: one with << 4, and one without.
This is because Spinda's sprite is a 4 bits per pixel image, but the pointer to Spinda's pixels
(destPixels) is an 8 bit pointer, so it addresses two pixels. Shifting by 4 accesses the 2nd
of these pixels, so this is done every other time.
*/
// Draw spot pixel if this is Spinda's body color
#define TRY_DRAW_SPOT_PIXEL(pixels, shift) \
if (((*(pixels) & (0xF << (shift))) >= (FIRST_SPOT_COLOR << (shift))) \
&& ((*(pixels) & (0xF << (shift))) <= (LAST_SPOT_COLOR << (shift)))) \
{ \
*(pixels) += (SPOT_COLOR_ADJUSTMENT << (shift)); \
}
#define DRAW_SPINDA_SPOTS(personality, dest) \
{ \
s32 i; \
@@ -5737,17 +5745,11 @@ u16 SpeciesToCryId(u16 species)
/* of the two pixels is being considered for drawing */ \
if (column & 1) \
{ \
/* Draw spot pixel if this is Spinda's body color */ \
if ((u8)((*destPixels & 0xF0) - (FIRST_SPOT_COLOR << 4))\
<= ((LAST_SPOT_COLOR - FIRST_SPOT_COLOR) << 4))\
*destPixels += (SPOT_COLOR_ADJUSTMENT << 4); \
TRY_DRAW_SPOT_PIXEL(destPixels, 4); \
} \
else \
{ \
/* Draw spot pixel if this is Spinda's body color */ \
if ((u8)((*destPixels & 0xF) - FIRST_SPOT_COLOR) \
<= (LAST_SPOT_COLOR - FIRST_SPOT_COLOR)) \
*destPixels += SPOT_COLOR_ADJUSTMENT; \
TRY_DRAW_SPOT_PIXEL(destPixels, 0); \
} \
} \
\