Merge pull request #539 from Rangi42/master

[RTM] Miscellaneous reorganization fixes
This commit is contained in:
yenatch 2018-07-17 18:16:12 -04:00 committed by GitHub
commit 3e14c1f26e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
45 changed files with 487 additions and 467 deletions

36
FAQ.md
View File

@ -4,9 +4,12 @@
## Questions
- [What is pokecrystal11.gbc?](#what-is-pokecrystal11gbc)
- [Can't build ROM; "ERROR: `UNION` already defined"](#cant-build-rom-error-union-already-defined)
- [Can't build ROM; "Segmentation fault" from `rgbgfx`](#cant-build-rom-segmentation-fault-from-rgbgfx)
- [Can't build ROM; "Section is too big" or "Unable to place section in bank"](#cant-build-rom-section-is-too-big-or-unable-to-place-section-in-bank)
- [I can't build the ROM, `make` just prints an error!](#i-cant-build-the-rom-make-just-prints-an-error)
- [`gcc`: command not found](#gcc-command-not-found)
- ["ERROR: `UNION` already defined"](#error-union-already-defined)
- ["Segmentation fault" from `rgbgfx`](#segmentation-fault-from-rgbgfx)
- ["Section is too big" or "Unable to place section in bank"](#section-is-too-big-or-unable-to-place-section-in-bank)
- ["Invalid file or object file version"](#invalid-file-or-object-file-version)
- [How do I edit maps?](#how-do-i-edit-maps)
- [How do I write new features?](#how-do-i-write-new-features)
- [I need more help!](#i-need-more-help)
@ -17,31 +20,41 @@
Version 1.1 of Pokémon Crystal, which fixed some issues with the initial international release. `make crystal11` defines `_CRYSTAL11` so the assembly builds the changed version.
## Can't build ROM; "ERROR: `UNION` already defined"
## I can't build the ROM, `make` just prints an error!
Download [**rgbds 0.3.3**][rgbds]. Earlier versions will not work.
Reread [INSTALL.md](INSTALL.md) carefully, and make sure you're following all its steps.
### `gcc`: command not found
## Can't build ROM; "Segmentation fault" from `rgbgfx`
You need to install `gcc`. If you're using Cygwin, re-run its setup, and at "Select Packages", choose to install `gcc-core`.
### "ERROR: `UNION` already defined"
Download [the latest **rgbds** release][rgbds]. Versions earlier than 0.3.3 will not work.
### "Segmentation fault" from `rgbgfx`
If you are using 64-bit Windows, download [**64-bit Cygwin**][cygwin] and [**64-bit rgbds**][rgbds].
## Can't build ROM; "Section is too big" or "Unable to place section in bank"
### "Section is too big" or "Unable to place section in bank"
If you have not changed any of the asm, make sure you have the latest version of pokecrystal and the correct version of rgbds (see [INSTALL.md](INSTALL.md)).
If you added or changed any code, it has to fit in the **memory banks**. The 2MB ROM is divided into 128 banks of 4KB each, numbered $00 to $7F. The linkerscript **pokecrystal.link** lists which `SECTION`s go in which banks. Try moving some code into a new section.
### "Invalid file or object file version"
Run `make clean` to remove all the old `o` files, then re-run `make`.
## How do I edit maps?
For `asm` scripts, read [docs/map_event_scripts.md](docs/map_event_scripts.md). For `blk` layouts, try [crowdmap][crowdmap] or [Polished Map][polished-map].
For `asm` scripts, read [docs/map_event_scripts.md](docs/map_event_scripts.md). For `blk` layouts, try [Polished Map][polished-map] or [crowdmap][crowdmap].
## How do I write new features?
There are a number of special-purpose scripting languages, as described in [docs](docs/). For more general features, you'll need to code directly in assembly language. See [docs/assembly_programming.md](docs/assembly_programming.md).
There are a number of special-purpose scripting languages, as described in [docs](docs/). For more general features, you'll need to code directly in assembly language. See [docs/assembly_programming.md](docs/assembly_programming.md). Some of the [tutorials][tutorials] may also be helpful.
## I need more help!
@ -50,5 +63,6 @@ Try asking on IRC or Discord (see [README.md](README.md)).
[cygwin]: https://cygwin.com/install.html
[rgbds]: https://github.com/rednex/rgbds/releases
[crowdmap]: https://github.com/yenatch/crowdmap/
[polished-map]: https://github.com/Rangi42/polished-map
[crowdmap]: https://github.com/yenatch/crowdmap/
[tutorials]: https://github.com/pret/pokecrystal/wiki/Tutorials

View File

@ -3650,8 +3650,8 @@ Sfx_2Boops_Ch5:
soundinput $8
endchannel
Sfx_UnknownCB:
musicheader 1, 8, Sfx_UnknownCB_Ch8
Sfx_IntroWhoosh:
musicheader 1, 8, Sfx_IntroWhoosh_Ch8
Sfx_Menu_Ch8:
noise __, 2, $e2, $33
@ -4703,7 +4703,7 @@ Sfx_Unknown60_Ch8:
noise __, 16, $f2, $43
endchannel
Sfx_UnknownCB_Ch8:
Sfx_IntroWhoosh_Ch8:
noise __, 2, $10, $10
noise __, 3, $20, $10
noise __, 3, $30, $20

View File

@ -204,7 +204,7 @@ SFX:
dba Sfx_IntroSuicune4
dba Sfx_GameFreakPresents
dba Sfx_Tingle
dba Sfx_UnknownCB
dba Sfx_IntroWhoosh
dba Sfx_TwoPcBeeps
dba Sfx_4NoteDitty
dba Sfx_Twinkle

View File

@ -61,6 +61,7 @@ MOVE_LENGTH EQU const_value
const STAT_DEF
const STAT_SPD
const STAT_SATK
NUM_EXP_STATS EQU const_value + -1
const STAT_SDEF
NUM_STATS EQU const_value
STAT_SPC EQU STAT_SATK

View File

@ -58,10 +58,6 @@ X_FLIP EQU 1 << OAM_X_FLIP ; $20
Y_FLIP EQU 1 << OAM_Y_FLIP ; $40
PRIORITY EQU 1 << OAM_PRIORITY ; $80
; Other useful constants
LCDC_DEFAULT EQU %11100011
LY_VBLANK EQU 144
; Hardware registers
rJOYP EQU $ff00 ; Joypad (R/W)
rSB EQU $ff01 ; Serial transfer data (R/W)
@ -119,14 +115,20 @@ rWave_d EQU $ff3d
rWave_e EQU $ff3e
rWave_f EQU $ff3f
rLCDC EQU $ff40 ; LCD Control (R/W)
rLCDC_BG_PRIORITY EQU 0 ; 0=Off, 1=On
rLCDC_SPRITES_ENABLE EQU 1 ; 0=Off, 1=On
rLCDC_SPRITE_SIZE EQU 2 ; 0=8x8, 1=8x16
rLCDC_BG_TILEMAP EQU 3 ; 0=9800-9BFF, 1=9C00-9FFF
rLCDC_TILE_DATA EQU 4 ; 0=8800-97FF, 1=8000-8FFF
rLCDC_WINDOW_ENABLE EQU 5 ; 0=Off, 1=On
rLCDC_WINDOW_TILEMAP EQU 6 ; 0=9800-9BFF, 1=9C00-9FFF
rLCDC_ENABLE EQU 7 ; 0=Off, 1=On
LCDC_DEFAULT EQU (1 << rLCDC_ENABLE) | (1 << rLCDC_WINDOW_TILEMAP) | (1 << rLCDC_WINDOW_ENABLE) | (1 << rLCDC_SPRITES_ENABLE) | (1 << rLCDC_BG_PRIORITY)
rSTAT EQU $ff41 ; LCDC Status (R/W)
rSCY EQU $ff42 ; Scroll Y (R/W)
rSCX EQU $ff43 ; Scroll X (R/W)
rLY EQU $ff44 ; LCDC Y-Coordinate (R)
LY_VBLANK EQU 144
rLYC EQU $ff45 ; LY Compare (R/W)
rDMA EQU $ff46 ; DMA Transfer and Start Address (W)
rBGP EQU $ff47 ; BG Palette Data (R/W) - Non CGB Mode Only

View File

@ -19,6 +19,7 @@ NPCTRADE_PADDING EQU 31 ; db
const NPC_TRADE_CHRIS ; 4
const NPC_TRADE_KIM ; 5
const NPC_TRADE_FOREST ; 6
NUM_NPC_TRADES EQU const_value
; trade gender limits
const_def

View File

@ -128,7 +128,7 @@
const SFX_SWEET_KISS ; 7c
const SFX_SWEET_KISS_2 ; 7d
const SFX_BELLY_DRUM ; 7e
const SFX_UNKNOWN_7F ; 7f
const SFX_TOXIC ; 7f
const SFX_SLUDGE_BOMB ; 80
const SFX_FORESIGHT ; 81
const SFX_SPITE ; 82
@ -206,7 +206,7 @@
const SFX_INTRO_SUICUNE_4 ; c8
const SFX_GAME_FREAK_PRESENTS ; c9
const SFX_TINGLE ; ca
const SFX_UNKNOWN_CB ; cb
const SFX_INTRO_WHOOSH ; cb
const SFX_TWO_PC_BEEPS ; cc
const SFX_4_NOTE_DITTY ; cd
const SFX_TWINKLE ; ce

View File

@ -20,17 +20,17 @@ AUTO_INPUT EQU $ff
GAMETIMERPAUSE_TIMER_PAUSED_F EQU 0
GAMETIMERPAUSE_MOBILE_7_F EQU 7
; wOptions:: (bits 4-7) ; cfcc
; wOptions:: ; cfcc
TEXT_DELAY_MASK EQU %111
const_def 4
const NO_TEXT_SCROLL ; 4
const STEREO ; 5
const BATTLE_SHIFT ; 6
const BATTLE_SCENE ; 7
; wOptions:: (bits 0-2) ; cfcc
TEXT_DELAY_FAST EQU 1
TEXT_DELAY_MED EQU 3
TEXT_DELAY_SLOW EQU 5
TEXT_DELAY_FAST EQU %001 ; 1
TEXT_DELAY_MED EQU %011 ; 3
TEXT_DELAY_SLOW EQU %101 ; 5
; wTextBoxFrame:: ; cfce
const_def

View File

@ -1,13 +1,3 @@
CriticalHitMoves:
db KARATE_CHOP
db RAZOR_WIND
db RAZOR_LEAF
db CRABHAMMER
db SLASH
db AEROBLAST
db CROSS_CHOP
db -1
CriticalHitChances:
db 7 percent ; 0
db 12 percent + 2 ; +1

File diff suppressed because it is too large Load Diff

View File

@ -2,7 +2,7 @@ DefaultOptions:
; wOptions: med text speed
db TEXT_DELAY_MED
; wSaveFileExists: no
db $00
db FALSE
; wTextBoxFrame: frame 1
db FRAME_1
; wTextBoxFlags: use text speed

View File

@ -41,7 +41,7 @@ OddEgg1:
bigdw 0
bigdw 0
bigdw 0
db $0, $0 ; DVs
dn 0, 0, 0, 0 ; DVs
db 30, 20, 10, 0 ; PP
db 20 ; Happiness
db 0, 0, 0 ; Pokerus, Caught data
@ -55,8 +55,8 @@ OddEgg1:
bigdw 8 ; SAtk
bigdw 8 ; SDef
db "EGG@@@@@@@@"
OddEgg1End:
OddEgg2:
db PICHU
db NO_ITEM
db THUNDERSHOCK, CHARM, DIZZY_PUNCH, 0
@ -68,7 +68,7 @@ OddEgg2:
bigdw 0
bigdw 0
bigdw 0
db $2a, $aa ; DVs
dn 2, 10, 10, 10 ; DVs
db 30, 20, 10, 0 ; PP
db 20 ; Happiness
db 0, 0, 0 ; Pokerus, Caught data
@ -120,7 +120,7 @@ OddEgg2:
bigdw 0
bigdw 0
bigdw 0
db $2a, $aa ; DVs
dn 2, 10, 10, 10 ; DVs
db 35, 20, 10, 0 ; PP
db 20 ; Happiness
db 0, 0, 0 ; Pokerus, Caught data
@ -172,7 +172,7 @@ OddEgg2:
bigdw 0
bigdw 0
bigdw 0
db $2a, $aa ; DVs
dn 2, 10, 10, 10 ; DVs
db 15, 20, 10, 0 ; PP
db 20 ; Happiness
db 0, 0, 0 ; Pokerus, Caught data
@ -224,7 +224,7 @@ OddEgg2:
bigdw 0
bigdw 0
bigdw 0
db $2a, $aa ; DVs
dn 2, 10, 10, 10 ; DVs
db 35, 30, 10, 0 ; PP
db 20 ; Happiness
db 0, 0, 0 ; Pokerus, Caught data
@ -276,7 +276,7 @@ OddEgg2:
bigdw 0
bigdw 0
bigdw 0
db $2a, $aa ; DVs
dn 2, 10, 10, 10 ; DVs
db 25, 10, 0, 0 ; PP
db 20 ; Happiness
db 0, 0, 0 ; Pokerus, Caught data
@ -328,7 +328,7 @@ OddEgg2:
bigdw 0
bigdw 0
bigdw 0
db $2a, $aa ; DVs
dn 2, 10, 10, 10 ; DVs
db 30, 30, 10, 0 ; PP
db 20 ; Happiness
db 0, 0, 0 ; Pokerus, Caught data
@ -380,7 +380,7 @@ OddEgg2:
bigdw 0
bigdw 0
bigdw 0
db $2a, $aa ; DVs
dn 2, 10, 10, 10 ; DVs
db 35, 10, 0, 0 ; PP
db 20 ; Happiness
db 0, 0, 0 ; Pokerus, Caught data

View File

@ -1,107 +1,107 @@
landmark: MACRO
; x, y, name
db \1, \2
db \1 + 8, \2 + 16
dw \3
ENDM
Landmarks:
; entries correspond to constants/landmark_constants.asm
landmark 0, 0, SpecialMapName
landmark 148, 116, NewBarkTownName
landmark 136, 116, Route29Name
landmark 108, 116, CherrygroveCityName
landmark 108, 96, Route30Name
landmark 104, 76, Route31Name
landmark 92, 76, VioletCityName
landmark 93, 74, SproutTowerName
landmark 92, 108, Route32Name
landmark 84, 92, RuinsOfAlphName
landmark 92, 140, UnionCaveName
landmark 90, 140, Route33Name
landmark 76, 140, AzaleaTownName
landmark 78, 138, SlowpokeWellName
landmark 60, 136, IlexForestName
landmark 60, 128, Route34Name
landmark 60, 108, GoldenrodCityName
landmark 58, 108, RadioTowerName
landmark 60, 92, Route35Name
landmark 60, 76, NationalParkName
landmark 72, 76, Route36Name
landmark 76, 68, Route37Name
landmark 76, 60, EcruteakCityName
landmark 78, 58, TinTowerName
landmark 74, 58, BurnedTowerName
landmark 60, 60, Route38Name
landmark 44, 64, Route39Name
landmark 44, 76, OlivineCityName
landmark 46, 78, LighthouseName
landmark 36, 72, BattleTowerName
landmark 36, 80, Route40Name
landmark 36, 108, WhirlIslandsName
landmark 36, 116, Route41Name
landmark 28, 116, CianwoodCityName
landmark 100, 60, Route42Name
landmark 92, 60, MtMortarName
landmark 116, 60, MahoganyTownName
landmark 116, 52, Route43Name
landmark 116, 44, LakeOfRageName
landmark 128, 60, Route44Name
landmark 138, 54, IcePathName
landmark 140, 60, BlackthornCityName
landmark 140, 52, DragonsDenName
landmark 140, 80, Route45Name
landmark 120, 88, DarkCaveName
landmark 132, 104, Route46Name
landmark 156, 84, SilverCaveName
landmark 60, 124, PalletTownName
landmark 60, 108, Route1Name
landmark 60, 92, ViridianCityName
landmark 60, 80, Route2Name
landmark 60, 68, PewterCityName
landmark 72, 68, Route3Name
landmark 84, 68, MtMoonName
landmark 96, 68, Route4Name
landmark 108, 68, CeruleanCityName
landmark 108, 60, Route24Name
landmark 116, 52, Route25Name
landmark 108, 76, Route5Name
landmark 116, 92, UndergroundName
landmark 108, 92, Route6Name
landmark 108, 100, VermilionCityName
landmark 96, 76, DiglettsCaveName
landmark 96, 84, Route7Name
landmark 124, 84, Route8Name
landmark 124, 68, Route9Name
landmark 140, 68, RockTunnelName
landmark 140, 72, Route10Name
landmark 140, 76, PowerPlantName
landmark 140, 84, LavenderTownName
landmark 148, 84, LavRadioTowerName
landmark 84, 84, CeladonCityName
landmark 108, 84, SaffronCityName
landmark 124, 100, Route11Name
landmark 140, 96, Route12Name
landmark 132, 116, Route13Name
landmark 124, 128, Route14Name
landmark 112, 132, Route15Name
landmark 76, 84, Route16Name
landmark 76, 108, Route17Name
landmark 88, 132, Route18Name
landmark 100, 132, FuchsiaCityName
landmark 100, 144, Route19Name
landmark 84, 148, Route20Name
landmark 76, 148, SeafoamIslandsName
landmark 60, 148, CinnabarIslandName
landmark 60, 136, Route21Name
landmark 44, 84, Route22Name
landmark 36, 68, VictoryRoadName
landmark 36, 60, Route23Name
landmark 36, 52, IndigoPlateauName
landmark 36, 108, Route26Name
landmark 28, 116, Route27Name
landmark 20, 116, TohjoFallsName
landmark 28, 84, Route28Name
landmark 148, 132, FastShipName
dbbw 0, 0, SpecialMapName
landmark 140, 100, NewBarkTownName
landmark 128, 100, Route29Name
landmark 100, 100, CherrygroveCityName
landmark 100, 80, Route30Name
landmark 96, 60, Route31Name
landmark 84, 60, VioletCityName
landmark 85, 58, SproutTowerName
landmark 84, 92, Route32Name
landmark 76, 76, RuinsOfAlphName
landmark 84, 124, UnionCaveName
landmark 82, 124, Route33Name
landmark 68, 124, AzaleaTownName
landmark 70, 122, SlowpokeWellName
landmark 52, 120, IlexForestName
landmark 52, 112, Route34Name
landmark 52, 92, GoldenrodCityName
landmark 50, 92, RadioTowerName
landmark 52, 76, Route35Name
landmark 52, 60, NationalParkName
landmark 64, 60, Route36Name
landmark 68, 52, Route37Name
landmark 68, 44, EcruteakCityName
landmark 70, 42, TinTowerName
landmark 66, 42, BurnedTowerName
landmark 52, 44, Route38Name
landmark 36, 48, Route39Name
landmark 36, 60, OlivineCityName
landmark 38, 62, LighthouseName
landmark 28, 56, BattleTowerName
landmark 28, 64, Route40Name
landmark 28, 92, WhirlIslandsName
landmark 28, 100, Route41Name
landmark 20, 100, CianwoodCityName
landmark 92, 44, Route42Name
landmark 84, 44, MtMortarName
landmark 108, 44, MahoganyTownName
landmark 108, 36, Route43Name
landmark 108, 28, LakeOfRageName
landmark 120, 44, Route44Name
landmark 130, 38, IcePathName
landmark 132, 44, BlackthornCityName
landmark 132, 36, DragonsDenName
landmark 132, 64, Route45Name
landmark 112, 72, DarkCaveName
landmark 124, 88, Route46Name
landmark 148, 68, SilverCaveName
landmark 52, 108, PalletTownName
landmark 52, 92, Route1Name
landmark 52, 76, ViridianCityName
landmark 52, 64, Route2Name
landmark 52, 52, PewterCityName
landmark 64, 52, Route3Name
landmark 76, 52, MtMoonName
landmark 88, 52, Route4Name
landmark 100, 52, CeruleanCityName
landmark 100, 44, Route24Name
landmark 108, 36, Route25Name
landmark 100, 60, Route5Name
landmark 108, 76, UndergroundName
landmark 100, 76, Route6Name
landmark 100, 84, VermilionCityName
landmark 88, 60, DiglettsCaveName
landmark 88, 68, Route7Name
landmark 116, 68, Route8Name
landmark 116, 52, Route9Name
landmark 132, 52, RockTunnelName
landmark 132, 56, Route10Name
landmark 132, 60, PowerPlantName
landmark 132, 68, LavenderTownName
landmark 140, 68, LavRadioTowerName
landmark 76, 68, CeladonCityName
landmark 100, 68, SaffronCityName
landmark 116, 84, Route11Name
landmark 132, 80, Route12Name
landmark 124, 100, Route13Name
landmark 116, 112, Route14Name
landmark 104, 116, Route15Name
landmark 68, 68, Route16Name
landmark 68, 92, Route17Name
landmark 80, 116, Route18Name
landmark 92, 116, FuchsiaCityName
landmark 92, 128, Route19Name
landmark 76, 132, Route20Name
landmark 68, 132, SeafoamIslandsName
landmark 52, 132, CinnabarIslandName
landmark 52, 120, Route21Name
landmark 36, 68, Route22Name
landmark 28, 52, VictoryRoadName
landmark 28, 44, Route23Name
landmark 28, 36, IndigoPlateauName
landmark 28, 92, Route26Name
landmark 20, 100, Route27Name
landmark 12, 100, TohjoFallsName
landmark 20, 68, Route28Name
landmark 140, 116, FastShipName
NewBarkTownName: db "NEW BARK¯TOWN@"
CherrygroveCityName: db "CHERRYGROVE¯CITY@"

View File

@ -4738,13 +4738,13 @@ BattleAnim_SludgeBomb_branch_cbc15:
BattleAnim_Sludge_branch_cbc15:
BattleAnim_Toxic_branch_cbc15:
.loop
anim_sound 0, 1, SFX_UNKNOWN_7F
anim_sound 0, 1, SFX_TOXIC
anim_obj ANIM_OBJ_1A, 132, 72, $0
anim_wait 8
anim_sound 0, 1, SFX_UNKNOWN_7F
anim_sound 0, 1, SFX_TOXIC
anim_obj ANIM_OBJ_1A, 116, 72, $0
anim_wait 8
anim_sound 0, 1, SFX_UNKNOWN_7F
anim_sound 0, 1, SFX_TOXIC
anim_obj ANIM_OBJ_1A, 148, 72, $0
anim_wait 8
anim_loop 5, .loop

View File

@ -0,0 +1,9 @@
CriticalHitMoves:
db KARATE_CHOP
db RAZOR_WIND
db RAZOR_LEAF
db CRABHAMMER
db SLASH
db AEROBLAST
db CROSS_CHOP
db -1

View File

@ -2,20 +2,20 @@ emote: MACRO
; graphics pointer, length, starting tile
dw \1
db \2 tiles, BANK(\1)
dw vTiles1 tile \3
dw vTiles0 tile \3
ENDM
Emotes:
; entries correspond to EMOTE_* constants
emote ShockEmote, 4, $78
emote QuestionEmote, 4, $78
emote HappyEmote, 4, $78
emote SadEmote, 4, $78
emote HeartEmote, 4, $78
emote BoltEmote, 4, $78
emote SleepEmote, 4, $78
emote FishEmote, 4, $78
emote JumpShadowGFX, 1, $7c
emote FishingRodGFX, 2, $7c
emote BoulderDustGFX, 2, $7e
emote GrassRustleGFX, 1, $7e
emote ShockEmote, 4, $f8
emote QuestionEmote, 4, $f8
emote HappyEmote, 4, $f8
emote SadEmote, 4, $f8
emote HeartEmote, 4, $f8
emote BoltEmote, 4, $f8
emote SleepEmote, 4, $f8
emote FishEmote, 4, $f8
emote JumpShadowGFX, 1, $fc
emote FishingRodGFX, 2, $fc
emote BoulderDustGFX, 2, $fe
emote GrassRustleGFX, 1, $fe

View File

@ -93,7 +93,7 @@ UnknownText_0x1bc14f::
line "level @"
deciram wCurPartyLevel, 1, 3
text "!@"
sound_dex_fanfare_50_79
sound_dex_fanfare_50_79 ; plays SFX_DEX_FANFARE_50_79, identical to SFX_LEVEL_UP
text_waitbutton
db "@@"

View File

@ -8,7 +8,7 @@ ENDM
; Associated data:
; - The *GFX, *Meta, and *Coll are defined in gfx/tilesets.asm
; - The *PalMap are defined in gfx/tileset_palette_maps.asm
; - The *Anim are defined in engine/tileset_anims.asm
; - The *Anim are defined in engine/tilesets/tileset_anims.asm
Tilesets::
; entries correspond to TILESET_* constants

View File

@ -3619,10 +3619,10 @@ CheckPlayerPartyForFitMon:
ld e, a
xor a
ld hl, wPartyMon1HP
ld bc, wPartyMon2 - (wPartyMon1 + 1)
ld bc, PARTYMON_STRUCT_LENGTH - 1
.loop
or [hl]
inc hl
inc hl ; + 1
or [hl]
add hl, bc
dec e
@ -6992,7 +6992,7 @@ GiveExperiencePoints:
ld a, [wCurPartyMon]
ld c, a
ld b, CHECK_FLAG
ld d, $0
ld d, FALSE
predef SmallFarFlagAction
ld a, c
and a
@ -7006,7 +7006,7 @@ GiveExperiencePoints:
ld e, l
ld hl, wEnemyMonBaseStats - 1
push bc
ld c, $5
ld c, NUM_EXP_STATS
.loop1
inc hl
ld a, [de]
@ -7286,13 +7286,13 @@ GiveExperiencePoints:
ld [wMonType], a
predef CopyMonToTempMon
hlcoord 9, 0
ld b, $a
ld c, $9
ld b, 10
ld c, 9
call TextBox
hlcoord 11, 1
ld bc, 4
predef PrintTempMonStats
ld c, $1e
ld c, 30
call DelayFrames
call WaitPressAorB_BlinkCursor
call Call_LoadTempTileMapToTileMap

View File

@ -1210,7 +1210,9 @@ BattleCommand_Critical:
ld [wCriticalHit], a
ret
INCLUDE "data/battle/critical_hits.asm"
INCLUDE "data/moves/critical_hit_moves.asm"
INCLUDE "data/battle/critical_hit_chances.asm"
INCLUDE "engine/battle/move_effects/triple_kick.asm"

View File

@ -40,4 +40,4 @@ BattleCommand_Metronome:
call UpdateMoveData
jp ResetTurn
INCLUDE "data/battle/metronome_exception_moves.asm"
INCLUDE "data/moves/metronome_exception_moves.asm"

View File

@ -16,7 +16,7 @@ FindFirstAliveMonAndStartBattle:
xor a
ld [hMapAnims], a
call DelayFrame
ld b, 6
ld b, PARTY_LENGTH
ld hl, wPartyMon1HP
ld de, PARTYMON_STRUCT_LENGTH - 1

View File

@ -104,7 +104,7 @@ Function_LoadRandomBattleTowerMon:
ld a, [wBTChoiceOfLvlGroup]
dec a
ld hl, BattleTowerMons
ld bc, BattleTowerMons2 - BattleTowerMons1
ld bc, BattleTowerMons2 - BattleTowerMons1 ; size of one level group
call AddNTimes
ld a, [hRandomAdd]

View File

@ -31,7 +31,7 @@ CelebiShrineEvent:
call GetCelebiSpriteTile
inc d
push de
ld a, $90
ld a, 36 * SPRITEOAMSTRUCT_LENGTH
ld [wCurrSpriteOAMAddr], a
farcall DoNextFrameForAllSprites
call CelebiEvent_CountDown

View File

@ -1,3 +1,7 @@
FIELDMOVE_GRASS EQU $80
FIELDMOVE_TREE EQU $84
FIELDMOVE_FLY EQU $84
PlayWhirlpoolSound:
call WaitSFX
ld de, SFX_SURF
@ -20,11 +24,11 @@ BlindingFlash:
ShakeHeadbuttTree:
farcall ClearSpriteAnims
ld de, CutGrassGFX
ld hl, vTiles1 tile $00
ld hl, vTiles0 tile FIELDMOVE_GRASS
lb bc, BANK(CutGrassGFX), 4
call Request2bpp
ld de, HeadbuttTreeGFX
ld hl, vTiles1 tile $04
ld hl, vTiles0 tile FIELDMOVE_TREE
lb bc, BANK(HeadbuttTreeGFX), 8
call Request2bpp
call Cut_Headbutt_GetPixelFacing
@ -32,8 +36,8 @@ ShakeHeadbuttTree:
call _InitSpriteAnimStruct
ld hl, SPRITEANIMSTRUCT_TILE_ID
add hl, bc
ld [hl], $84
ld a, 36 * 4
ld [hl], FIELDMOVE_TREE
ld a, 36 * SPRITEOAMSTRUCT_LENGTH
ld [wCurrSpriteOAMAddr], a
farcall DoNextFrameForAllSprites
call HideHeadbuttTree
@ -48,7 +52,7 @@ ShakeHeadbuttTree:
and a
jr z, .done
dec [hl]
ld a, 36 * 4
ld a, 36 * SPRITEOAMSTRUCT_LENGTH
ld [wCurrSpriteOAMAddr], a
farcall DoNextFrameForAllSprites
call DelayFrame
@ -111,7 +115,7 @@ OWCutAnimation:
; 0: Split tree in half
; 1: Mow the lawn
ld a, e
and $1
and 1
ld [wJumptableIndex], a
call .LoadCutGFX
call WaitSFX
@ -121,7 +125,7 @@ OWCutAnimation:
ld a, [wJumptableIndex]
bit 7, a
jr nz, .finish
ld a, 36 * 4
ld a, 36 * SPRITEOAMSTRUCT_LENGTH
ld [wCurrSpriteOAMAddr], a
callfar DoNextFrameForAllSprites
call OWCutJumptable
@ -134,11 +138,11 @@ OWCutAnimation:
.LoadCutGFX:
callfar ClearSpriteAnims ; pointless to farcall
ld de, CutGrassGFX
ld hl, vTiles1 tile $00
ld hl, vTiles0 tile FIELDMOVE_GRASS
lb bc, BANK(CutGrassGFX), 4
call Request2bpp
ld de, CutTreeGFX
ld hl, vTiles1 tile $04
ld hl, vTiles0 tile FIELDMOVE_TREE
lb bc, BANK(CutTreeGFX), 4
call Request2bpp
ret
@ -173,7 +177,7 @@ Cut_SpawnAnimateTree:
call _InitSpriteAnimStruct
ld hl, SPRITEANIMSTRUCT_TILE_ID
add hl, bc
ld [hl], $84
ld [hl], FIELDMOVE_TREE
ld a, 32
ld [wFrameCounter], a
; Cut_StartWaiting
@ -226,7 +230,7 @@ Cut_SpawnLeaf:
call _InitSpriteAnimStruct
ld hl, SPRITEANIMSTRUCT_TILE_ID
add hl, bc
ld [hl], $80
ld [hl], FIELDMOVE_GRASS
ld hl, SPRITEANIMSTRUCT_0E
add hl, bc
ld [hl], $4
@ -313,7 +317,7 @@ FlyFromAnim:
call _InitSpriteAnimStruct
ld hl, SPRITEANIMSTRUCT_TILE_ID
add hl, bc
ld [hl], $84
ld [hl], FIELDMOVE_FLY
ld hl, SPRITEANIMSTRUCT_ANIM_SEQ_ID
add hl, bc
ld [hl], SPRITE_ANIM_SEQ_FLY_FROM
@ -323,7 +327,7 @@ FlyFromAnim:
ld a, [wJumptableIndex]
bit 7, a
jr nz, .exit
ld a, 0 * 4
ld a, 0 * SPRITEOAMSTRUCT_LENGTH
ld [wCurrSpriteOAMAddr], a
callfar DoNextFrameForAllSprites
call FlyFunction_FrameTimer
@ -347,7 +351,7 @@ FlyToAnim:
call _InitSpriteAnimStruct
ld hl, SPRITEANIMSTRUCT_TILE_ID
add hl, bc
ld [hl], $84
ld [hl], FIELDMOVE_FLY
ld hl, SPRITEANIMSTRUCT_ANIM_SEQ_ID
add hl, bc
ld [hl], SPRITE_ANIM_SEQ_FLY_TO
@ -360,7 +364,7 @@ FlyToAnim:
ld a, [wJumptableIndex]
bit 7, a
jr nz, .exit
ld a, 0 * 4
ld a, 0 * SPRITEOAMSTRUCT_LENGTH
ld [wCurrSpriteOAMAddr], a
callfar DoNextFrameForAllSprites
call FlyFunction_FrameTimer
@ -394,7 +398,7 @@ endr
FlyFunction_InitGFX:
callfar ClearSpriteAnims
ld de, CutGrassGFX
ld hl, vTiles1 tile $00
ld hl, vTiles0 tile FIELDMOVE_GRASS
lb bc, BANK(CutGrassGFX), 4
call Request2bpp
ld a, [wCurPartyMon]
@ -404,7 +408,7 @@ FlyFunction_InitGFX:
add hl, de
ld a, [hl]
ld [wd265], a
ld e, $84
ld e, FIELDMOVE_FLY
farcall FlyFunction_GetMonIcon
xor a
ld [wJumptableIndex], a
@ -446,5 +450,5 @@ FlyFunction_FrameTimer:
call _InitSpriteAnimStruct
ld hl, SPRITEANIMSTRUCT_TILE_ID
add hl, bc
ld [hl], $80
ld [hl], FIELDMOVE_GRASS
ret

View File

@ -17,7 +17,7 @@ LoadFishingGFX:
call .LoadGFX
ld hl, vTiles0 tile $0a
call .LoadGFX
ld hl, vTiles1 tile $7c
ld hl, vTiles0 tile $fc
call .LoadGFX
pop af

View File

@ -39,7 +39,7 @@ _GiveOddEgg:
.done
ld hl, OddEggs
ld a, OddEgg2 - OddEgg1
ld a, OddEgg1End - OddEgg1
call AddNTimes
ld de, wOddEggSpecies

View File

@ -19,11 +19,11 @@ _UnownPuzzle:
xor a
call ByteFill
ld hl, UnownPuzzleCursorGFX
ld de, vTiles1 tile $60
ld de, vTiles0 tile $e0
ld bc, 4 tiles
call CopyBytes
ld hl, UnownPuzzleStartCancelLZ
ld de, vTiles1 tile $6d
ld de, vTiles0 tile $ed
call Decompress
call LoadUnownPuzzlePiecesGFX
hlcoord 0, 0

View File

@ -2039,7 +2039,7 @@ CheckTimeCapsuleCompatibility:
jr nc, .move_too_new
dec c
jr nz, .move_next
ld de, wPartyMon2 - (wPartyMon1 + NUM_MOVES)
ld de, PARTYMON_STRUCT_LENGTH - NUM_MOVES
add hl, de
dec b
jr nz, .move_loop

View File

@ -165,7 +165,7 @@ GetTextSpeed:
; converts TEXT_DELAY_* value in a to OPT_TEXT_SPEED_* value in c,
; with previous/next TEXT_DELAY_* values in d/e
ld a, [wOptions]
and $7
and TEXT_DELAY_MASK
cp TEXT_DELAY_SLOW
jr z, .slow
cp TEXT_DELAY_FAST
@ -467,7 +467,7 @@ Options_Frame:
dec a
.Save:
and $7
maskbits NUM_FRAMES
ld [hl], a
UpdateFrame:
ld a, [wTextBoxFrame]

View File

@ -89,7 +89,7 @@ MoveMonWOMail_InsertMon_SaveGame:
pop de
ld a, e
ld [wCurBox], a
ld a, $1
ld a, TRUE
ld [wSaveFileExists], a
farcall StageRTCTimeForSave
farcall BackupMysteryGift
@ -253,7 +253,7 @@ SavedTheGame:
ret
SaveGameData_:
ld a, 1
ld a, TRUE
ld [wSaveFileExists], a
farcall StageRTCTimeForSave
farcall BackupMysteryGift
@ -627,7 +627,7 @@ TryLoadSaveFile:
ret
TryLoadSaveData:
xor a
xor a ; FALSE
ld [wSaveFileExists], a
call CheckPrimarySaveFile
ld a, [wSaveFileExists]
@ -690,7 +690,7 @@ CheckPrimarySaveFile:
ld bc, wOptionsEnd - wOptions
call CopyBytes
call CloseSRAM
ld a, $1
ld a, TRUE
ld [wSaveFileExists], a
.nope

View File

@ -1481,7 +1481,7 @@ IntroScene28:
cp $8
ret nz
ld de, SFX_UNKNOWN_CB
ld de, SFX_INTRO_WHOOSH
call PlaySFX
ret

View File

@ -246,8 +246,8 @@ SuicuneFrameIterator:
ret
.Frames:
db $80 ; vTiles4 tile $00
db $88 ; vTiles4 tile $08
db $80 ; vTiles3 tile $80
db $88 ; vTiles3 tile $88
db $00 ; vTiles5 tile $00
db $08 ; vTiles5 tile $08

View File

@ -1085,17 +1085,18 @@ DecorationDesc_GiantOrnament:
db "@"
ToggleMaptileDecorations:
lb de, 0, 4
; tile coordinates work the same way as for changeblock
lb de, 0, 4 ; bed coordinates
ld a, [wDecoBed]
call SetDecorationTile
lb de, 7, 4
lb de, 7, 4 ; plant coordinates
ld a, [wDecoPlant]
call SetDecorationTile
lb de, 6, 0
lb de, 6, 0 ; poster coordinates
ld a, [wDecoPoster]
call SetDecorationTile
call SetPosterVisibility
lb de, 0, 0
lb de, 0, 0 ; carpet top-left coordinates
call PadCoords_de
ld a, [wDecoCarpet]
and a
@ -1103,15 +1104,15 @@ ToggleMaptileDecorations:
call _GetDecorationSprite
ld [hl], a
push af
lb de, 0, 2
lb de, 0, 2 ; carpet bottom-left coordinates
call PadCoords_de
pop af
inc a
ld [hli], a
ld [hli], a ; carpet bottom-left block
inc a
ld [hli], a
ld [hli], a ; carpet bottom-middle block
dec a
ld [hl], a
ld [hl], a ; carpet bottom-right block
ret
SetPosterVisibility:
@ -1177,6 +1178,7 @@ _GetDecorationSprite:
ret
PadCoords_de:
; adjusts coordinates, the same way as Script_changeblock
ld a, d
add 4
ld d, a

View File

@ -562,8 +562,8 @@ DoPlayerMovement::
.GetAction:
; Poll player input and update movement info.
ld hl, .table
ld de, .table2 - .table1
ld hl, .action_table
ld de, .action_table_1_end - .action_table_1
ld a, [wCurInput]
bit D_DOWN_F, a
jr nz, .d_down
@ -597,25 +597,20 @@ DoPlayerMovement::
ld [wWalkingTile], a
ret
.table
; struct:
; walk direction
; facing
; x movement
; y movement
; tile collision pointer
.table1
db STANDING, FACE_CURRENT, 0, 0
dw wPlayerStandingTile
.table2
db RIGHT, FACE_RIGHT, 1, 0
dw wTileRight
db LEFT, FACE_LEFT, -1, 0
dw wTileLeft
db UP, FACE_UP, 0, -1
dw wTileUp
db DOWN, FACE_DOWN, 0, 1
dw wTileDown
player_action: MACRO
; walk direction, facing, x movement, y movement, tile collision pointer
db \1, \2, \3, \4
dw \5
ENDM
.action_table:
.action_table_1
player_action STANDING, FACE_CURRENT, 0, 0, wPlayerStandingTile
.action_table_1_end
player_action RIGHT, FACE_RIGHT, 1, 0, wTileRight
player_action LEFT, FACE_LEFT, -1, 0, wTileLeft
player_action UP, FACE_UP, 0, -1, wTileUp
player_action DOWN, FACE_DOWN, 0, 1, wTileDown
.CheckNPC:
; Returns 0 if there is an NPC in front that you can't move

View File

@ -1403,7 +1403,7 @@ CalcMonStats:
; hl is the path to the Stat EXP
; de points to where the final stats will be saved
ld c, $0
ld c, STAT_HP - 1 ; first stat
.loop
inc c
call CalcMonStatC
@ -1414,7 +1414,7 @@ CalcMonStats:
ld [de], a
inc de
ld a, c
cp STAT_SDEF
cp STAT_SDEF ; last stat
jr nz, .loop
ret
@ -1434,14 +1434,14 @@ CalcMonStatC:
push hl
ld hl, wBaseStats
dec hl ; has to be decreased, because 'c' begins with 1
ld b, $0
ld b, 0
add hl, bc
ld a, [hl]
ld e, a
pop hl
push hl
ld a, c
cp STAT_SDEF
cp STAT_SDEF ; last stat
jr nz, .not_spdef
dec hl
dec hl

View File

@ -40,7 +40,7 @@ TilesetKantoAnim:
dw NULL, WaitTileAnimation
dw NULL, WaitTileAnimation
dw NULL, WaitTileAnimation
dw NULL, TileAnimationPalette
dw NULL, AnimateWaterPalette
dw NULL, WaitTileAnimation
dw NULL, AnimateFlowerTile
dw NULL, WaitTileAnimation
@ -53,7 +53,7 @@ TilesetParkAnim:
dw NULL, WaitTileAnimation
dw vTiles2 tile $5f, AnimateFountain
dw NULL, WaitTileAnimation
dw NULL, TileAnimationPalette
dw NULL, AnimateWaterPalette
dw NULL, WaitTileAnimation
dw NULL, AnimateFlowerTile
dw NULL, WaitTileAnimation
@ -71,7 +71,7 @@ TilesetForestAnim:
dw NULL, ForestTreeRightAnimation2
dw NULL, AnimateFlowerTile
dw vTiles2 tile $14, AnimateWaterTile
dw NULL, TileAnimationPalette
dw NULL, AnimateWaterPalette
dw NULL, StandingTileFrame8
dw NULL, DoneTileAnimation
@ -79,7 +79,7 @@ TilesetJohtoAnim:
dw vTiles2 tile $14, AnimateWaterTile
dw NULL, WaitTileAnimation
dw NULL, WaitTileAnimation
dw NULL, TileAnimationPalette
dw NULL, AnimateWaterPalette
dw NULL, WaitTileAnimation
dw NULL, AnimateFlowerTile
dw WhirlpoolFrames1, AnimateWhirlpoolTile
@ -122,7 +122,7 @@ TilesetPortAnim:
dw NULL, WaitTileAnimation
dw NULL, WaitTileAnimation
dw NULL, WaitTileAnimation
dw NULL, TileAnimationPalette
dw NULL, AnimateWaterPalette
dw NULL, WaitTileAnimation
dw NULL, WaitTileAnimation
dw NULL, WaitTileAnimation
@ -178,7 +178,7 @@ TilesetDarkCaveAnim:
dw NULL, FlickeringCaveEntrancePalette
dw vTiles2 tile $14, WriteTileFromBuffer
dw NULL, FlickeringCaveEntrancePalette
dw NULL, TileAnimationPalette
dw NULL, AnimateWaterPalette
dw NULL, FlickeringCaveEntrancePalette
dw vTiles2 tile $40, WriteTileToBuffer
dw NULL, FlickeringCaveEntrancePalette
@ -199,7 +199,7 @@ TilesetIcePathAnim:
dw NULL, FlickeringCaveEntrancePalette
dw vTiles2 tile $35, WriteTileFromBuffer
dw NULL, FlickeringCaveEntrancePalette
dw NULL, TileAnimationPalette
dw NULL, AnimateWaterPalette
dw NULL, FlickeringCaveEntrancePalette
dw vTiles2 tile $31, WriteTileToBuffer
dw NULL, FlickeringCaveEntrancePalette
@ -852,7 +852,7 @@ endr
ld sp, hl
ret
TileAnimationPalette:
AnimateWaterPalette:
; Transition between color values 0-2 for color 0 in palette 3.
; No palette changes on DMG.

View File

@ -1176,7 +1176,7 @@ ScrollMapUp::
ld l, a
ld a, [wBGMapAnchor + 1]
ld h, a
ld bc, $0200
ld bc, BG_MAP_WIDTH tiles
add hl, bc
; cap d at HIGH(vBGMap0)
ld a, h

View File

@ -1,11 +1,11 @@
; Syntactic sugar macros
lb: MACRO ; r, hi, lo
ld \1, (((\2) & $ff) << 8) | (((\3) & $ff))
ld \1, ((\2) & $ff) << 8 | ((\3) & $ff)
ENDM
ln: MACRO ; r, hi, lo
ld \1, (((\2) & $f) << 4) | (((\3) & $f))
ld \1, ((\2) & $f) << 4 | ((\3) & $f)
ENDM
ldpixel: MACRO

View File

@ -586,7 +586,7 @@ Function8b690:
ld a, BANK(GFX_17afa5)
call FarCopyBytes
ld hl, GFX_17afa5 + $514 + $160
ld de, vTiles1 tile $6e
ld de, vTiles0 tile $ee
ld bc, $10
ld a, BANK(GFX_17afa5)
call FarCopyBytes

View File

@ -5543,7 +5543,7 @@ Function11ac51:
call Function11b314
call Function11acb7
call Function11ad6e
ld a, 30 * 4
ld a, 30 * SPRITEOAMSTRUCT_LENGTH
ld [wCurrSpriteOAMAddr], a
farcall DoNextFrameForAllSprites
farcall ReloadMapPart

View File

@ -279,7 +279,7 @@ Function170d02:
ld a, $1
ld [rVBK], a
ld de, GFX_171848
ld hl, vTiles1 tile $41
ld hl, vTiles0 tile $c1
lb bc, BANK(GFX_171848), 24
call Get2bpp
xor a

View File

@ -605,7 +605,7 @@ Function17d370:
call ClearScreen
farcall ReloadMapPart
call DisableLCD
ld hl, vTiles1 tile $6e
ld hl, vTiles0 tile $ee
ld de, $c608
ld bc, 1 tiles
call CopyBytes
@ -620,7 +620,7 @@ Function17d370:
ld bc, 1 tiles
call ByteFill
ld hl, $c608
ld de, vTiles1 tile $6e
ld de, vTiles0 tile $ee
ld bc, 1 tiles
call CopyBytes
xor a
@ -652,7 +652,7 @@ Function17d3f6:
Function17d405:
call DisableLCD
ld hl, vTiles1 tile $6e
ld hl, vTiles0 tile $ee
ld de, $c608
ld bc, 1 tiles
call CopyBytes
@ -667,7 +667,7 @@ Function17d405:
ld bc, 1 tiles
call ByteFill
ld hl, $c608
ld de, vTiles1 tile $6e
ld de, vTiles0 tile $ee
ld bc, 1 tiles
call CopyBytes
xor a

View File

@ -2507,7 +2507,7 @@ wRegisteredItem:: db ; d95c
wPlayerState:: db ; d95d
wHallOfFameCount:: dw
wTradeFlags:: flag_array PARTY_LENGTH ; d960
wTradeFlags:: flag_array NUM_NPC_TRADES ; d960
ds 1
wMooMooBerries:: db ; d962
wUndergroundSwitchPositions:: db ; d963