summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile4
-rw-r--r--constants/map_data_constants.asm1
-rw-r--r--constants/radio_constants.asm7
-rw-r--r--constants/wram_constants.asm3
-rw-r--r--data/radio/oaks_pkmn_talk_routes.asm3
-rw-r--r--engine/battle/battle_transition.asm18
-rw-r--r--engine/events/overworld.asm2
-rw-r--r--engine/items/pack.asm20
-rw-r--r--engine/overworld/wildmons.asm13
-rw-r--r--engine/pokegear/radio.asm6
-rw-r--r--engine/tilesets/tileset_anims.asm2
-rw-r--r--engine/tilesets/timeofday_pals.asm40
-rw-r--r--gfx/overworld/trainer_battle.pal (renamed from gfx/overworld/trainer_battle_day.pal)0
-rw-r--r--gfx/overworld/trainer_battle_dark.pal (renamed from gfx/overworld/trainer_battle_nite.pal)0
-rw-r--r--gfx/pack/pack_menu.tilemapbin0 -> 60 bytes
-rw-r--r--home/text.asm12
16 files changed, 64 insertions, 67 deletions
diff --git a/Makefile b/Makefile
index 7853c5b4..198de6cc 100644
--- a/Makefile
+++ b/Makefile
@@ -59,10 +59,8 @@ silver: pokesilver.gbc
gold_debug: pokegold_debug.gbc
silver_debug: pokesilver_debug.gbc
-clean:
- rm -f $(roms) $(pokegold_obj) $(pokesilver_obj) $(pokegold_debug_obj) $(pokesilver_debug_obj) $(roms:.gbc=.map) $(roms:.gbc=.sym) rgbdscheck.o
+clean: tidy
find gfx \( -name "*.[12]bpp" -o -name "*.lz" -o -name "*.gbcpal" -o -name "*.dimensions" -o -name "*.sgb.tilemap" \) -delete
- $(MAKE) clean -C tools/
tidy:
rm -f $(roms) $(pokegold_obj) $(pokesilver_obj) $(pokegold_debug_obj) $(pokesilver_debug_obj) $(roms:.gbc=.map) $(roms:.gbc=.sym) rgbdscheck.o
diff --git a/constants/map_data_constants.asm b/constants/map_data_constants.asm
index b2c47006..386d7229 100644
--- a/constants/map_data_constants.asm
+++ b/constants/map_data_constants.asm
@@ -32,6 +32,7 @@ MAP_NONE EQU 0
const PALETTE_NITE
const PALETTE_MORN
const PALETTE_DARK
+NUM_MAP_PALETTES EQU const_value
; FishGroups indexes (see data/wild/fish.asm)
const_def
diff --git a/constants/radio_constants.asm b/constants/radio_constants.asm
index e9b54176..557b7dde 100644
--- a/constants/radio_constants.asm
+++ b/constants/radio_constants.asm
@@ -85,9 +85,12 @@
const MAPRADIO_LETS_ALL_SING
const MAPRADIO_ROCKET
+; OaksPKMNTalkRoutes size (see data/radio/oaks_pkmn_talk_routes.asm)
+NUM_OAKS_POKEMON_TALK_ROUTES EQU 15
+
; These tables in engine/pokegear/radio.asm are all sized to a power of 2
; so there's no need for a rejection sampling loop
NUM_OAKS_POKEMON_TALK_ADVERBS EQU 16 ; OaksPKMNTalk8.Adverbs
NUM_OAKS_POKEMON_TALK_ADJECTIVES EQU 16 ; OaksPKMNTalk9.Adjectives
-NUM_PNP_PEOPLE_ADJECTIVES EQU 16 ; PeoplePlaces5.Adjectives
-NUM_PNP_PLACES_ADJECTIVES EQU 16 ; PeoplePlaces7.Adjectives
+NUM_PNP_PEOPLE_ADJECTIVES EQU 16 ; PeoplePlaces5.Adjectives
+NUM_PNP_PLACES_ADJECTIVES EQU 16 ; PeoplePlaces7.Adjectives
diff --git a/constants/wram_constants.asm b/constants/wram_constants.asm
index 146d24f2..9150cc21 100644
--- a/constants/wram_constants.asm
+++ b/constants/wram_constants.asm
@@ -122,6 +122,9 @@ DARKNESS EQU 1 << DARKNESS_F
ANYTIME EQU MORN | DAY | NITE
+; wTimeOfDayPalset::
+DARKNESS_PALSET EQU (DARKNESS_F << 6) | (DARKNESS_F << 4) | (DARKNESS_F << 2) | DARKNESS_F
+
; wBattleAnimFlags::
const_def
const BATTLEANIM_STOP_F ; 0
diff --git a/data/radio/oaks_pkmn_talk_routes.asm b/data/radio/oaks_pkmn_talk_routes.asm
index acef4bdd..254dd8e5 100644
--- a/data/radio/oaks_pkmn_talk_routes.asm
+++ b/data/radio/oaks_pkmn_talk_routes.asm
@@ -1,6 +1,6 @@
; Oak's Pokémon Talk will list wild Pokémon on these maps.
-OaksPKMNTalkRoutes:
+OaksPKMNTalkRoutes:; there are NUM_OAKS_POKEMON_TALK_ROUTES entries
map_id ROUTE_29
map_id ROUTE_46
map_id ROUTE_30
@@ -16,4 +16,3 @@ OaksPKMNTalkRoutes:
map_id ROUTE_45
map_id ROUTE_36
map_id ROUTE_31
-.End
diff --git a/engine/battle/battle_transition.asm b/engine/battle/battle_transition.asm
index b26feaa2..cc324922 100644
--- a/engine/battle/battle_transition.asm
+++ b/engine/battle/battle_transition.asm
@@ -220,7 +220,7 @@ StartTrainerBattle_Flash:
.DoFlashAnimation:
ld a, [wTimeOfDayPalset]
- cp %11111111 ; dark cave
+ cp DARKNESS_PALSET
jr z, .done
ld hl, wce64
ld a, [hl]
@@ -578,13 +578,13 @@ StartTrainerBattle_LoadPokeBallGraphics:
jr .nextscene
.cgb
- ld hl, .daypals
+ ld hl, .pals
ld a, [wTimeOfDayPal]
maskbits NUM_DAYTIMES
cp DARKNESS_F
- jr nz, .daytime
- ld hl, .nightpals
-.daytime
+ jr nz, .not_dark
+ ld hl, .darkpals
+.not_dark
call .copypals
push hl
ld de, wBGPals1 palette PAL_BG_TEXT
@@ -651,11 +651,11 @@ popo
pop hl
ret
-.daypals
-INCLUDE "gfx/overworld/trainer_battle_day.pal"
+.pals
+INCLUDE "gfx/overworld/trainer_battle.pal"
-.nightpals
-INCLUDE "gfx/overworld/trainer_battle_nite.pal"
+.darkpals
+INCLUDE "gfx/overworld/trainer_battle_dark.pal"
WipeLYOverrides:
ld hl, wLYOverrides
diff --git a/engine/events/overworld.asm b/engine/events/overworld.asm
index 15c00bb6..9350fb1e 100644
--- a/engine/events/overworld.asm
+++ b/engine/events/overworld.asm
@@ -282,7 +282,7 @@ FlashFunction:
farcall CheckBadge
jr c, .nozephyrbadge
ld a, [wTimeOfDayPalset]
- cp %11111111 ; 3, 3, 3, 3
+ cp DARKNESS_PALSET
jr nz, .notadarkcave
.useflash
call UseFlash
diff --git a/engine/items/pack.asm b/engine/items/pack.asm
index 0f36222b..cb3a87d4 100644
--- a/engine/items/pack.asm
+++ b/engine/items/pack.asm
@@ -1398,23 +1398,9 @@ DrawPocketName:
jr nz, .row
ret
-.tilemap
-; ITEM_POCKET
- db $00, $04, $04, $04, $01 ; top border
- db $06, $07, $08, $09, $0a ; Items
- db $02, $05, $05, $05, $03 ; bottom border
-; BALL_POCKET
- db $00, $04, $04, $04, $01 ; top border
- db $15, $16, $17, $18, $19 ; Balls
- db $02, $05, $05, $05, $03 ; bottom border
-; KEY_ITEM_POCKET
- db $00, $04, $04, $04, $01 ; top border
- db $0b, $0c, $0d, $0e, $0f ; Key Items
- db $02, $05, $05, $05, $03 ; bottom border
-; TM_HM_POCKET
- db $00, $04, $04, $04, $01 ; top border
- db $10, $11, $12, $13, $14 ; TM/HM
- db $02, $05, $05, $05, $03 ; bottom border
+.tilemap: ; 5x12
+; the 5x3 pieces correspond to *_POCKET constants
+INCBIN "gfx/pack/pack_menu.tilemap"
Pack_GetItemName:
ld a, [wCurItem]
diff --git a/engine/overworld/wildmons.asm b/engine/overworld/wildmons.asm
index c06020e1..124a7bbf 100644
--- a/engine/overworld/wildmons.asm
+++ b/engine/overworld/wildmons.asm
@@ -710,11 +710,14 @@ JumpRoamMons:
JumpRoamMon:
.loop
ld hl, RoamMaps
-.innerloop1 ; This loop happens to be unnecessary.
- call Random ; Choose a random number.
- maskbits NUM_ROAMMON_MAPS ; Mask the number to limit it between 0 and 15.
- cp NUM_ROAMMON_MAPS ; If the number is not less than 16, try again.
- jr nc, .innerloop1 ; I'm sure you can guess why this check is bogus.
+.innerloop1
+ ; 0-15 are all valid indexes into RoamMaps,
+ ; so this retry loop is unnecessary
+ ; since NUM_ROAMMON_MAPS happens to be 16
+ call Random
+ maskbits NUM_ROAMMON_MAPS
+ cp NUM_ROAMMON_MAPS
+ jr nc, .innerloop1
inc a
ld b, a
.innerloop2 ; Loop to get hl to the address of the chosen roam map.
diff --git a/engine/pokegear/radio.asm b/engine/pokegear/radio.asm
index c1b940d5..2cc8c1bb 100644
--- a/engine/pokegear/radio.asm
+++ b/engine/pokegear/radio.asm
@@ -172,10 +172,10 @@ OaksPKMNTalk4:
; Choose a random route, and a random Pokemon from that route.
.sample
call Random
- and %11111
- cp (OaksPKMNTalkRoutes.End - OaksPKMNTalkRoutes) / 2
+ and %11111 ; maskbits NUM_OAKS_POKEMON_TALK_ROUTES would be more efficient
+ cp NUM_OAKS_POKEMON_TALK_ROUTES
jr nc, .sample
- ; We now have a number between 0 and 14.
+ ; We now have a number between 0 and NUM_OAKS_POKEMON_TALK_ROUTES - 1.
ld hl, OaksPKMNTalkRoutes
ld c, a
ld b, 0
diff --git a/engine/tilesets/tileset_anims.asm b/engine/tilesets/tileset_anims.asm
index 00cd4a86..b9bf42a3 100644
--- a/engine/tilesets/tileset_anims.asm
+++ b/engine/tilesets/tileset_anims.asm
@@ -695,7 +695,7 @@ FlickeringCaveEntrancePalette:
ret nz
; We only want to be here if we're in a dark cave.
ld a, [wTimeOfDayPalset]
- cp %11111111 ; 3,3,3,3
+ cp DARKNESS_PALSET
ret nz
; Ready for BGPD input...
diff --git a/engine/tilesets/timeofday_pals.asm b/engine/tilesets/timeofday_pals.asm
index 24b2211a..9be1147c 100644
--- a/engine/tilesets/timeofday_pals.asm
+++ b/engine/tilesets/timeofday_pals.asm
@@ -116,7 +116,7 @@ ReplaceTimeOfDayPals::
ld a, [wMapTimeOfDay]
cp PALETTE_DARK
jr z, .NeedsFlash
- and $7
+ maskbits NUM_MAP_PALETTES
add l
ld l, a
ld a, 0
@@ -130,55 +130,57 @@ ReplaceTimeOfDayPals::
ld a, [wStatusFlags]
bit STATUSFLAGS_FLASH_F, a
jr nz, .UsedFlash
- ld a, %11111111 ; 3, 3, 3, 3
+ ld a, DARKNESS_PALSET
ld [wTimeOfDayPalset], a
ret
.UsedFlash:
- ld a, %10101010 ; 2, 2, 2, 2
+ ld a, (NITE_F << 6) | (NITE_F << 4) | (NITE_F << 2) | NITE_F
ld [wTimeOfDayPalset], a
ret
.BrightnessLevels:
- dc 3, 2, 1, 0
- dc 1, 1, 1, 1
- dc 2, 2, 2, 2
- dc 0, 0, 0, 0
- dc 3, 3, 3, 3
- dc 3, 2, 1, 0
- dc 3, 2, 1, 0
- dc 3, 2, 1, 0
+; actual palettes used when time is
+; DARKNESS_F, NITE_F, DAY_F, MORN_F
+ dc DARKNESS_F, NITE_F, DAY_F, MORN_F ; PALETTE_AUTO
+ dc DAY_F, DAY_F, DAY_F, DAY_F ; PALETTE_DAY
+ dc NITE_F, NITE_F, NITE_F, NITE_F ; PALETTE_NITE
+ dc MORN_F, MORN_F, MORN_F, MORN_F ; PALETTE_MORN
+ dc DARKNESS_F, DARKNESS_F, DARKNESS_F, DARKNESS_F ; PALETTE_DARK
+ dc DARKNESS_F, NITE_F, DAY_F, MORN_F
+ dc DARKNESS_F, NITE_F, DAY_F, MORN_F
+ dc DARKNESS_F, NITE_F, DAY_F, MORN_F
GetTimePalette:
jumptable .TimePalettes, wTimeOfDay
.TimePalettes:
- dw .MorningPalette
- dw .DayPalette
- dw .NitePalette
- dw .DarknessPalette
+ dw .MorningPalette ; MORN_F
+ dw .DayPalette ; DAY_F
+ dw .NitePalette ; NITE_F
+ dw .DarknessPalette ; DARKNESS_F
.MorningPalette:
ld a, [wTimeOfDayPalset]
- and %00000011 ; 0
+ and %00000011
ret
.DayPalette:
ld a, [wTimeOfDayPalset]
- and %00001100 ; 1
+ and %00001100
srl a
srl a
ret
.NitePalette:
ld a, [wTimeOfDayPalset]
- and %00110000 ; 2
+ and %00110000
swap a
ret
.DarknessPalette:
ld a, [wTimeOfDayPalset]
- and %11000000 ; 3
+ and %11000000
rlca
rlca
ret
diff --git a/gfx/overworld/trainer_battle_day.pal b/gfx/overworld/trainer_battle.pal
index b7d67891..b7d67891 100644
--- a/gfx/overworld/trainer_battle_day.pal
+++ b/gfx/overworld/trainer_battle.pal
diff --git a/gfx/overworld/trainer_battle_nite.pal b/gfx/overworld/trainer_battle_dark.pal
index d1a35f33..d1a35f33 100644
--- a/gfx/overworld/trainer_battle_nite.pal
+++ b/gfx/overworld/trainer_battle_dark.pal
diff --git a/gfx/pack/pack_menu.tilemap b/gfx/pack/pack_menu.tilemap
new file mode 100644
index 00000000..6c29f22c
--- /dev/null
+++ b/gfx/pack/pack_menu.tilemap
Binary files differ
diff --git a/home/text.asm b/home/text.asm
index f7ce3395..9d3428ac 100644
--- a/home/text.asm
+++ b/home/text.asm
@@ -172,22 +172,24 @@ NextChar::
CheckDict::
dict: MACRO
-if \1 == "<NULL>"
+if \1 == 0
and a
else
cp \1
endc
-if STRSUB("\2", 1, 1) == "\""
+if ISCONST(\2)
; Replace a character with another one
jr nz, ._\@
ld a, \2
._\@:
-elif STRSUB("\2", 1, 1) == "."
-; Locals can use a short jump
- jr z, \2
else
+ if STRSUB("\2", 1, 1) == "."
+ ; Locals can use a short jump
+ jr z, \2
+ else
jp z, \2
+ endc
endc
ENDM