diff options
-rw-r--r-- | INSTALL.md | 6 | ||||
-rw-r--r-- | Makefile | 4 | ||||
-rw-r--r-- | constants/map_data_constants.asm | 1 | ||||
-rw-r--r-- | constants/radio_constants.asm | 10 | ||||
-rw-r--r-- | constants/wram_constants.asm | 3 | ||||
-rw-r--r-- | data/items/buena_prizes.asm | 3 | ||||
-rw-r--r-- | data/radio/oaks_pkmn_talk_routes.asm | 2 | ||||
-rw-r--r-- | docs/bugs_and_glitches.md | 6 | ||||
-rw-r--r-- | docs/map_event_scripts.md | 31 | ||||
-rw-r--r-- | engine/battle/battle_transition.asm | 18 | ||||
-rw-r--r-- | engine/events/buena.asm | 8 | ||||
-rw-r--r-- | engine/events/overworld.asm | 2 | ||||
-rw-r--r-- | engine/items/pack.asm | 20 | ||||
-rw-r--r-- | engine/overworld/wildmons.asm | 13 | ||||
-rw-r--r-- | engine/pokegear/radio.asm | 6 | ||||
-rw-r--r-- | engine/tilesets/tileset_anims.asm | 2 | ||||
-rw-r--r-- | engine/tilesets/timeofday_pals.asm | 40 | ||||
-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.tilemap | bin | 0 -> 60 bytes | |||
-rw-r--r-- | home/text.asm | 12 |
21 files changed, 107 insertions, 80 deletions
diff --git a/INSTALL.md b/INSTALL.md index dd9a1c209..5ff11c92e 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -111,12 +111,10 @@ sudo make -C rgbds install To install the software required for **pokecrystal**: ```bash -sudo pacman -S make gcc git +sudo pacman -S make gcc git rgbds ``` -**rgbds** is available on the [AUR](https://aur.archlinux.org/packages/rgbds/). - -Alternatively, to install **rgbds** manually: +If you want to compile and install **rgbds** manually instead of using the Arch package: ```bash sudo pacman -S pkg-config flex bison libpng @@ -54,11 +54,9 @@ crystal_au: pokecrystal_au.gbc crystal_debug: pokecrystal_debug.gbc crystal11_debug: pokecrystal11_debug.gbc -clean: - rm -f $(roms) $(pokecrystal_obj) $(pokecrystal11_obj) $(pokecrystal_au_obj) $(pokecrystal_debug_obj) $(pokecrystal11_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 "*.sgb.tilemap" \) -delete find gfx/pokemon -mindepth 1 ! -path "gfx/pokemon/unown/*" \( -name "bitmask.asm" -o -name "frames.asm" -o -name "front.animated.tilemap" -o -name "front.dimensions" \) -delete - $(MAKE) clean -C tools/ tidy: rm -f $(roms) $(pokecrystal_obj) $(pokecrystal11_obj) $(pokecrystal_au_obj) $(pokecrystal_debug_obj) $(pokecrystal11_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 136456d95..d288e07d5 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 39eedbd84..11143f6ee 100644 --- a/constants/radio_constants.asm +++ b/constants/radio_constants.asm @@ -106,17 +106,23 @@ 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 ; BuenasPasswordTable sizes (see data/radio/buenas_passwords.asm) NUM_PASSWORD_CATEGORIES EQU 11 NUM_PASSWORDS_PER_CATEGORY EQU 3 +; BuenaPrizeItems size (see data/items/buena_prizes.asm) +NUM_BUENA_PRIZES EQU 9 + ; GetBuenasPassword.StringFunctionJumpTable indexes (see engine/pokegear/radio.asm) const_def const BUENA_MON diff --git a/constants/wram_constants.asm b/constants/wram_constants.asm index 0007bdaaf..c571faf8b 100644 --- a/constants/wram_constants.asm +++ b/constants/wram_constants.asm @@ -123,6 +123,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/items/buena_prizes.asm b/data/items/buena_prizes.asm index b0737aee2..673082a8d 100644 --- a/data/items/buena_prizes.asm +++ b/data/items/buena_prizes.asm @@ -1,5 +1,5 @@ BuenaPrizeItems: -; there are NUM_BUENA_PRIZES items (see engine/events/buena.asm) +; there are NUM_BUENA_PRIZES entries db ULTRA_BALL, 2 db FULL_RESTORE, 2 db NUGGET, 3 @@ -9,4 +9,3 @@ BuenaPrizeItems: db CARBOS, 5 db CALCIUM, 5 db HP_UP, 5 -.End diff --git a/data/radio/oaks_pkmn_talk_routes.asm b/data/radio/oaks_pkmn_talk_routes.asm index acef4bdd3..db2447401 100644 --- a/data/radio/oaks_pkmn_talk_routes.asm +++ b/data/radio/oaks_pkmn_talk_routes.asm @@ -1,6 +1,7 @@ ; Oak's Pokémon Talk will list wild Pokémon on these maps. OaksPKMNTalkRoutes: +; there are NUM_OAKS_POKEMON_TALK_ROUTES entries map_id ROUTE_29 map_id ROUTE_46 map_id ROUTE_30 @@ -16,4 +17,3 @@ OaksPKMNTalkRoutes: map_id ROUTE_45 map_id ROUTE_36 map_id ROUTE_31 -.End diff --git a/docs/bugs_and_glitches.md b/docs/bugs_and_glitches.md index 4fd24f7eb..25c68182b 100644 --- a/docs/bugs_and_glitches.md +++ b/docs/bugs_and_glitches.md @@ -1281,9 +1281,9 @@ CopyPokemonName_Buffer1_Buffer3: ```diff HappinessData_DaisysGrooming: -- db $ff, 2, HAPPINESS_GROOMING ; 99.6% chance -+ db $80, 2, HAPPINESS_GROOMING ; 50% chance -+ db $ff, 2, HAPPINESS_GROOMING ; 50% chance +- db 100 percent, 2, HAPPINESS_GROOMING ; 99.6% chance ++ db 50 percent + 1, 2, HAPPINESS_GROOMING ; 50% chance ++ db 100 percent, 2, HAPPINESS_GROOMING ; 50% chance ``` diff --git a/docs/map_event_scripts.md b/docs/map_event_scripts.md index dce205a1f..7050416fd 100644 --- a/docs/map_event_scripts.md +++ b/docs/map_event_scripts.md @@ -19,6 +19,7 @@ - [Object events](#object-events) - [Movement types](#movement-types) - [Object types](#object-types) +- [Template](#template) ## Object constants @@ -203,3 +204,33 @@ <pre> trainer <i>group_id</i>, <i>trainer_id</i>, <i>event_flag</i>, <i>seen_text</i>, <i>beaten_text</i>, <i>loss_text</i>, <i>script</i> </pre> + + +## Template + +<pre> + object_const_def +; const <i>MAPNAME</i>_<i>OBJECTNAME</i> + +<i>MapName</i>_MapScripts: + def_scene_scripts +; scene_script <i>script</i> + + def_callbacks +; callback <i>type</i>, <i>script</i> + +<i>MapName</i>_MapEvents: + db 0, 0 ; filler + + def_warp_events +; warp_event <i>x</i>, <i>y</i>, <i>map</i>, <i>warp_id</i> + + def_coord_events +; coord_event <i>x</i>, <i>y</i>, <i>scene_id</i>, <i>script</i> + + def_bg_events +; bg_event <i>x</i>, <i>y</i>, <i>type</i>, <i>script</i> + + def_object_events +; object_event <i>x</i>, <i>y</i>, <i>sprite</i>, <i>movement</i>, <i>rx</i>, <i>ry</i>, <i>h1</i>, <i>h2</i>, <i>palette</i>, <i>type</i>, <i>range</i>, <i>script</i>, <i>event_flag</i> +</pre> diff --git a/engine/battle/battle_transition.asm b/engine/battle/battle_transition.asm index 89760611b..8071d475e 100644 --- a/engine/battle/battle_transition.asm +++ b/engine/battle/battle_transition.asm @@ -270,7 +270,7 @@ StartTrainerBattle_Flash: .DoFlashAnimation: ld a, [wTimeOfDayPalset] - cp %11111111 ; dark cave + cp DARKNESS_PALSET jr z, .done ld hl, wcf64 ld a, [hl] @@ -651,13 +651,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 ldh a, [rSVBK] push af ld a, BANK(wBGPals1) @@ -702,11 +702,11 @@ StartTrainerBattle_LoadPokeBallGraphics: 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" .loadpokeballgfx ld a, [wOtherTrainerClass] diff --git a/engine/events/buena.asm b/engine/events/buena.asm index ef8c70bfc..452f5d62a 100644 --- a/engine/events/buena.asm +++ b/engine/events/buena.asm @@ -262,9 +262,7 @@ Buena_PrizeMenu: dba .prizeitem dba .prizepoints -NUM_BUENA_PRIZES EQU 9 ; ((BuenaPrizeItems.End - BuenaPrizeItems) / 2) - -.indices +.indices: db NUM_BUENA_PRIZES x = 1 rept NUM_BUENA_PRIZES @@ -273,7 +271,7 @@ x = x + 1 endr db -1 -.prizeitem +.prizeitem: ld a, [wMenuSelection] call Buena_getprize ld a, [hl] @@ -284,7 +282,7 @@ endr call PlaceString ret -.prizepoints +.prizepoints: ld a, [wMenuSelection] call Buena_getprize inc hl diff --git a/engine/events/overworld.asm b/engine/events/overworld.asm index d0ab25d62..eee3e2df3 100644 --- a/engine/events/overworld.asm +++ b/engine/events/overworld.asm @@ -289,7 +289,7 @@ FlashFunction: pop hl jr c, .useflash 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 bde5685cc..0aeb39843 100644 --- a/engine/items/pack.asm +++ b/engine/items/pack.asm @@ -1409,23 +1409,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 61ef89b18..902226041 100644 --- a/engine/overworld/wildmons.asm +++ b/engine/overworld/wildmons.asm @@ -705,11 +705,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 c4ca19255..803a7b036 100644 --- a/engine/pokegear/radio.asm +++ b/engine/pokegear/radio.asm @@ -194,10 +194,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 33e956df0..5e673356d 100644 --- a/engine/tilesets/tileset_anims.asm +++ b/engine/tilesets/tileset_anims.asm @@ -925,7 +925,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 ldh a, [rSVBK] diff --git a/engine/tilesets/timeofday_pals.asm b/engine/tilesets/timeofday_pals.asm index e890607d4..2f61f1930 100644 --- a/engine/tilesets/timeofday_pals.asm +++ b/engine/tilesets/timeofday_pals.asm @@ -190,7 +190,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 @@ -204,55 +204,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 b7d67891e..b7d67891e 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 d1a35f33b..d1a35f33b 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 Binary files differnew file mode 100644 index 000000000..6c29f22c6 --- /dev/null +++ b/gfx/pack/pack_menu.tilemap diff --git a/home/text.asm b/home/text.asm index 87ffdc7d9..d9236a7a7 100644 --- a/home/text.asm +++ b/home/text.asm @@ -181,22 +181,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 |