summaryrefslogtreecommitdiff
path: root/engine
diff options
context:
space:
mode:
authorRangi <35663410+Rangi42@users.noreply.github.com>2020-07-19 23:04:16 -0400
committerGitHub <noreply@github.com>2020-07-19 23:04:16 -0400
commit0177688ad4d923c4970009fa87df48605bb43ed6 (patch)
tree4c44fbb1813e78eb00f7c1690d2c23099a49113b /engine
parentd44c7c305c3f94b59e3e2c008408779836a0020a (diff)
parentdf62b8e81a4b0964d5f21dcc37916f996b5bd241 (diff)
Merge pull request #279 from Rangi42/master
Identify sprite and battle animation data
Diffstat (limited to 'engine')
-rwxr-xr-xengine/battle/animations.asm226
-rw-r--r--engine/battle/battle_transitions.asm109
-rwxr-xr-xengine/battle/core.asm4
-rw-r--r--engine/battle/get_trainer_name.asm6
-rwxr-xr-xengine/battle/read_trainer_party.asm2
-rw-r--r--engine/battle/scale_sprites.asm20
-rw-r--r--engine/events/hidden_objects/cinnabar_gym_quiz.asm22
-rwxr-xr-xengine/link/cable_club.asm2
-rwxr-xr-xengine/menus/naming_screen.asm2
-rwxr-xr-xengine/menus/pokedex.asm6
-rwxr-xr-xengine/movie/gamefreak.asm74
-rwxr-xr-xengine/movie/hall_of_fame.asm2
-rwxr-xr-xengine/movie/intro.asm16
-rwxr-xr-xengine/movie/trade.asm52
-rwxr-xr-xengine/overworld/auto_movement.asm6
-rwxr-xr-xengine/overworld/cut.asm4
-rwxr-xr-xengine/overworld/emotion_bubbles.asm4
-rwxr-xr-xengine/overworld/healing_machine.asm16
-rwxr-xr-xengine/overworld/ledges.asm4
-rwxr-xr-xengine/overworld/map_sprites.asm2
-rwxr-xr-xengine/overworld/player_animations.asm12
21 files changed, 230 insertions, 361 deletions
diff --git a/engine/battle/animations.asm b/engine/battle/animations.asm
index 4e836510..85019fa1 100755
--- a/engine/battle/animations.asm
+++ b/engine/battle/animations.asm
@@ -17,11 +17,11 @@ DrawFrameBlock:
ld [wFBTileCounter], a
ld a, [wSubAnimTransform]
dec a
- jr z, .flipHorizontalAndVertical ; 1
+ jr z, .flipHorizontalAndVertical ; SUBANIMTYPE_HVFLIP
dec a
- jp z, .flipHorizontalTranslateDown ; 2
+ jp z, .flipHorizontalTranslateDown ; SUBANIMTYPE_HFLIP
dec a
- jr z, .flipBaseCoords ; 3
+ jr z, .flipBaseCoords ; SUBANIMTYPE_COORDFLIP
.noTransformation
ld a, [wBaseCoordY]
add [hl]
@@ -43,7 +43,7 @@ DrawFrameBlock:
ld b, a
ld a, 168
sub b ; flip X base coordinate
-.finishCopying ; finish copying values to OAM (when [wSubAnimTransform] not 1 or 2)
+.finishCopying ; finish copying values to OAM (when subanimation not transformed)
add [hl] ; X offset
ld [de], a ; store X
inc hl
@@ -132,15 +132,15 @@ DrawFrameBlock:
jp nz, .loop ; go back up if there are more tiles to draw
.afterDrawingTiles
ld a, [wFBMode]
- cp 2
+ cp FRAMEBLOCKMODE_02
jr z, .advanceFrameBlockDestAddr; skip delay and don't clean OAM buffer
ld a, [wSubAnimFrameDelay]
ld c, a
call DelayFrames
ld a, [wFBMode]
- cp 3
+ cp FRAMEBLOCKMODE_03
jr z, .advanceFrameBlockDestAddr ; skip cleaning OAM buffer
- cp 4
+ cp FRAMEBLOCKMODE_04
jr z, .done ; skip cleaning OAM buffer and don't advance the frame block destination address
ld a, [wAnimationID]
cp GROWL
@@ -177,9 +177,9 @@ PlayAnimation:
ld l, a
.animationLoop
ld a, [hli]
- cp $FF
+ cp -1
jr z, .AnimationOver
- cp $C0 ; is this subanimation or a special effect?
+ cp FIRST_SE_ID ; is this subanimation or a special effect?
jr c, .playSubanimation
.doSpecialEffect
ld c, a
@@ -194,7 +194,7 @@ PlayAnimation:
jr .searchSpecialEffectTableLoop
.foundMatch
ld a, [hli]
- cp $FF ; is there a sound to play?
+ cp NO_MOVE - 1 ; is there a sound to play?
jr z, .skipPlayingSound
ld [wAnimSoundID], a ; store sound
push hl
@@ -267,11 +267,11 @@ LoadSubanimation:
ld d, a ; de = address of subanimation
ld a, [de]
ld b, a
- and 31
+ and %00011111
ld [wSubAnimCounter], a ; number of frame blocks
ld a, b
and %11100000
- cp 5 << 5 ; is subanimation type 5?
+ cp SUBANIMTYPE_ENEMY << 5
jr nz, .isNotType5
.isType5
call GetSubanimationTransform2
@@ -283,7 +283,7 @@ LoadSubanimation:
srl a
swap a
ld [wSubAnimTransform], a
- cp 4 ; is the animation reversed?
+ cp SUBANIMTYPE_REVERSE
ld hl, 0
jr nz, .storeSubentryAddr
; if the animation is reversed, then place the initial subentry address at the end of the list of subentries
@@ -303,8 +303,8 @@ LoadSubanimation:
ld [wSubAnimSubEntryAddr + 1], a
ret
-; called if the subanimation type is not 5
-; sets the transform to 0 (i.e. no transform) if it's the player's turn
+; called if the subanimation type is not SUBANIMTYPE_ENEMY
+; sets the transform to SUBANIMTYPE_NORMAL if it's the player's turn
; sets the transform to the subanimation type if it's the enemy's turn
GetSubanimationTransform1:
ld b, a
@@ -312,18 +312,18 @@ GetSubanimationTransform1:
and a
ld a, b
ret nz
- xor a
+ xor a ; SUBANIMTYPE_NORMAL << 5
ret
-; called if the subanimation type is 5
-; sets the transform to 2 (i.e. horizontal and vertical flip) if it's the player's turn
-; sets the transform to 0 (i.e. no transform) if it's the enemy's turn
+; called if the subanimation type is SUBANIMTYPE_ENEMY
+; sets the transform to SUBANIMTYPE_HFLIP if it's the player's turn
+; sets the transform to SUBANIMTYPE_NORMAL if it's the enemy's turn
GetSubanimationTransform2:
ldh a, [hWhoseTurn]
and a
- ld a, 2 << 5
+ ld a, SUBANIMTYPE_HFLIP << 5
ret z
- xor a
+ xor a ; SUBANIMTYPE_NORMAL << 5
ret
; loads tile patterns for battle animations
@@ -347,18 +347,17 @@ LoadAnimationTileset:
ld c, a ; number of tiles
jp CopyVideoData ; load tileset
-AnimationTilesetPointers:
- db 79 ; number of tiles
- dw AnimationTileset1
- db $FF
+anim_tileset: MACRO
+ db \1
+ dw \2
+ db -1 ; padding
+ENDM
- db 79 ; number of tiles
- dw AnimationTileset2
- db $FF
-
- db 64 ; number of tiles
- dw AnimationTileset1
- db $FF
+AnimationTilesetPointers:
+ ; number of tiles, gfx pointer
+ anim_tileset 79, AnimationTileset1
+ anim_tileset 79, AnimationTileset2
+ anim_tileset 64, AnimationTileset1
AnimationTileset1:
INCBIN "gfx/battle/attack_anim_1.2bpp"
@@ -412,7 +411,7 @@ MoveAnimation:
ld [wSubAnimSubEntryAddr], a
ld [wUnusedD09B], a
ld [wSubAnimTransform], a
- dec a
+ dec a ; NO_MOVE - 1
ld [wAnimSoundID], a
pop af
pop bc
@@ -461,10 +460,10 @@ PlayApplyingAttackAnimation:
jp hl
AnimationTypePointerTable:
- dw ShakeScreenVertically ; enemy mon has used a damaging move without a side effect
+ dw ShakeScreenVertically ; enemy mon has used a damaging move without a side effect
dw ShakeScreenHorizontallyHeavy ; enemy mon has used a damaging move with a side effect
- dw ShakeScreenHorizontallySlow ; enemy mon has used a non-damaging move
- dw BlinkEnemyMonSprite ; player mon has used a damaging move without a side effect
+ dw ShakeScreenHorizontallySlow ; enemy mon has used a non-damaging move
+ dw BlinkEnemyMonSprite ; player mon has used a damaging move without a side effect
dw ShakeScreenHorizontallyLight ; player mon has used a damaging move with a side effect
dw ShakeScreenHorizontallySlow2 ; player mon has used a non-damaging move
@@ -549,7 +548,7 @@ SetAnimationPalette:
PlaySubanimation:
ld a, [wAnimSoundID]
- cp $FF
+ cp NO_MOVE - 1
jr z, .skipPlayingSound
call GetMoveSound
call PlaySound
@@ -601,7 +600,7 @@ PlaySubanimation:
ld a, [wSubAnimSubEntryAddr]
ld l, a
ld a, [wSubAnimTransform]
- cp 4 ; is the animation reversed?
+ cp SUBANIMTYPE_REVERSE
ld bc, 3
jr nz, .nextSubanimationSubentry
ld bc, -3
@@ -650,7 +649,7 @@ DoSpecialEffectByAnimationId:
pop hl
ret
-INCLUDE "data/moves/animation_special_effects.asm"
+INCLUDE "data/battle_anims/special_effects.asm"
DoBallTossSpecialEffects:
ld a, [wcf91]
@@ -912,7 +911,7 @@ TailWhipAnimationUnused:
ld c, 20
jp DelayFrames
-INCLUDE "data/moves/animation_special_effect_pointers.asm"
+INCLUDE "data/battle_anims/special_effect_pointers.asm"
AnimationDelay10:
ld c, 10
@@ -1149,7 +1148,7 @@ AnimationSlideMonUp:
AnimationSlideMonDown:
; Slides the mon's sprite down out of the screen.
- xor a
+ xor a ; TILEMAP_MON_PIC
call GetTileIDList
.loop
call GetMonSpriteTileMapPointerFromRowCount
@@ -1356,7 +1355,7 @@ AnimationFlashEnemyMonPic:
jp CallWithTurnFlipped
AnimationShowMonPic:
- xor a
+ xor a ; TILEMAP_MON_PIC
call GetTileIDList
call GetMonSpriteTileMapPointerFromRowCount
call CopyPicTiles
@@ -1380,7 +1379,7 @@ AnimationShakeBackAndForth:
decoord 13, 0
.next
- xor a
+ xor a ; TILEMAP_MON_PIC
ld c, $10
.loop
push af
@@ -1425,7 +1424,7 @@ AnimationMoveMonHorizontally:
jr z, .next
hlcoord 11, 0
.next
- xor a
+ xor a ; TILEMAP_MON_PIC
push hl
call GetTileIDList
pop hl
@@ -1716,8 +1715,8 @@ MinimizedMonSpriteEnd:
AnimationSlideMonDownAndHide:
; Slides the mon's sprite down and disappears. Used in Acid Armor.
- ld a, $1
- ld c, $2
+ ld a, TILEMAP_SLIDE_DOWN_MON_PIC_7X5
+ ld c, 2
.loop
push bc
push af
@@ -1736,7 +1735,7 @@ AnimationSlideMonDownAndHide:
jr nz, .loop
call AnimationHideMonPic
ld hl, wTempPic
- ld bc, $310
+ ld bc, 7 * 7 tiles
xor a
call FillMemory
jp CopyTempPicToMonPic
@@ -1902,39 +1901,39 @@ AnimationSubstitute:
ldh a, [hWhoseTurn]
and a
jr z, .playerTurn
- ld hl, SlowbroSprite ; facing down sprite
+ ld hl, MonsterSprite tile 0 ; facing down sprite
ld de, wTempPic + $120
- call CopySlowbroSpriteData
- ld hl, SlowbroSprite + $10
+ call CopyMonsterSpriteData
+ ld hl, MonsterSprite tile 1
ld de, wTempPic + $120 + $70
- call CopySlowbroSpriteData
- ld hl, SlowbroSprite + $20
+ call CopyMonsterSpriteData
+ ld hl, MonsterSprite tile 2
ld de, wTempPic + $120 + $10
- call CopySlowbroSpriteData
- ld hl, SlowbroSprite + $30
+ call CopyMonsterSpriteData
+ ld hl, MonsterSprite tile 3
ld de, wTempPic + $120 + $10 + $70
- call CopySlowbroSpriteData
+ call CopyMonsterSpriteData
jr .next
.playerTurn
- ld hl, SlowbroSprite + $40 ; facing up sprite
+ ld hl, MonsterSprite tile 4 ; facing up sprite
ld de, wTempPic + $120 + $70
- call CopySlowbroSpriteData
- ld hl, SlowbroSprite + $50
+ call CopyMonsterSpriteData
+ ld hl, MonsterSprite tile 5
ld de, wTempPic + $120 + $e0
- call CopySlowbroSpriteData
- ld hl, SlowbroSprite + $60
+ call CopyMonsterSpriteData
+ ld hl, MonsterSprite tile 6
ld de, wTempPic + $120 + $80
- call CopySlowbroSpriteData
- ld hl, SlowbroSprite + $70
+ call CopyMonsterSpriteData
+ ld hl, MonsterSprite tile 7
ld de, wTempPic + $120 + $f0
- call CopySlowbroSpriteData
+ call CopyMonsterSpriteData
.next
call CopyTempPicToMonPic
jp AnimationShowMonPic
-CopySlowbroSpriteData:
- ld bc, $10
- ld a, BANK(SlowbroSprite)
+CopyMonsterSpriteData:
+ ld bc, 1 tiles
+ ld a, BANK(MonsterSprite)
jp FarCopyData2
HideSubstituteShowMonAnim:
@@ -2008,7 +2007,7 @@ ChangeMonPic:
ld [wd0b5], a
call GetMonHeader
predef LoadMonBackPic
- xor a
+ xor a ; TILEMAP_MON_PIC
call GetTileIDList
call GetMonSpriteTileMapPointerFromRowCount
call CopyPicTiles
@@ -2266,98 +2265,7 @@ CopyTileIDs:
pop hl
ret
-TileIDListPointerTable:
- dw Unknown_79b24
- dn 7, 7
- dw Unknown_79b55
- dn 5, 7
- dw Unknown_79b78
- dn 3, 7
- dw GengarIntroTiles1
- dn 7, 7
- dw GengarIntroTiles2
- dn 7, 7
- dw GengarIntroTiles3
- dn 7, 7
- dw Unknown_79c20
- dn 8, 6
- dw Unknown_79c50
- dn 3, 12
-
-DownscaledMonTiles_5x5:
- db $31,$38,$46,$54,$5B
- db $32,$39,$47,$55,$5C
- db $34,$3B,$49,$57,$5E
- db $36,$3D,$4B,$59,$60
- db $37,$3E,$4C,$5A,$61
-
-DownscaledMonTiles_3x3:
- db $31,$46,$5B
- db $34,$49,$5E
- db $37,$4C,$61
-
-Unknown_79b24:
- db $00,$07,$0E,$15,$1C,$23,$2A
- db $01,$08,$0F,$16,$1D,$24,$2B
- db $02,$09,$10,$17,$1E,$25,$2C
- db $03,$0A,$11,$18,$1F,$26,$2D
- db $04,$0B,$12,$19,$20,$27,$2E
- db $05,$0C,$13,$1A,$21,$28,$2F
- db $06,$0D,$14,$1B,$22,$29,$30
-
-Unknown_79b55:
- db $00,$07,$0E,$15,$1C,$23,$2A
- db $01,$08,$0F,$16,$1D,$24,$2B
- db $03,$0A,$11,$18,$1F,$26,$2D
- db $04,$0B,$12,$19,$20,$27,$2E
- db $05,$0C,$13,$1A,$21,$28,$2F
-
-Unknown_79b78:
- db $00,$07,$0E,$15,$1C,$23,$2A
- db $02,$09,$10,$17,$1E,$25,$2C
- db $04,$0B,$12,$19,$20,$27,$2E
-
-GengarIntroTiles1:
- db $00,$00,$00,$00,$00,$00,$00
- db $00,$00,$00,$00,$00,$19,$00
- db $02,$06,$0B,$10,$14,$1A,$00
- db $00,$07,$0C,$11,$15,$1B,$00
- db $03,$08,$0D,$12,$16,$1C,$00
- db $04,$09,$0E,$13,$17,$1D,$1F
- db $05,$0A,$0F,$01,$18,$1E,$20
-
-GengarIntroTiles2:
- db $00,$00,$00,$30,$00,$37,$00
- db $00,$00,$2B,$31,$34,$38,$3D
- db $21,$26,$2C,$01,$35,$39,$3E
- db $22,$27,$2D,$32,$36,$01,$00
- db $23,$28,$2E,$33,$01,$3A,$00
- db $24,$29,$2F,$01,$01,$3B,$00
- db $25,$2A,$01,$01,$01,$3C,$00
-
-GengarIntroTiles3:
- db $00,$00,$00,$00,$00,$00,$00
- db $00,$00,$47,$4D,$00,$00,$00
- db $00,$00,$48,$4E,$52,$56,$5B
- db $3F,$43,$49,$4F,$53,$57,$5C
- db $40,$44,$4A,$50,$54,$58,$00
- db $41,$45,$4B,$51,$4C,$59,$5D
- db $42,$46,$4C,$4C,$55,$5A,$5E
-
-Unknown_79c20:
- db $31,$32,$32,$32,$32,$33
- db $34,$35,$36,$36,$37,$38
- db $34,$39,$3A,$3A,$3B,$38
- db $3C,$3D,$3E,$3E,$3F,$40
- db $41,$42,$43,$43,$44,$45
- db $46,$47,$43,$48,$49,$4A
- db $41,$43,$4B,$4C,$4D,$4E
- db $4F,$50,$50,$50,$51,$52
-
-Unknown_79c50:
- db $43,$55,$56,$53,$53,$53,$53,$53,$53,$53,$53,$53
- db $43,$57,$58,$54,$54,$54,$54,$54,$54,$54,$54,$54
- db $43,$59,$5A,$43,$43,$43,$43,$43,$43,$43,$43,$43
+INCLUDE "data/tilemaps.asm"
AnimationLeavesFalling:
; Makes leaves float down from the top of the screen. This is used
diff --git a/engine/battle/battle_transitions.asm b/engine/battle/battle_transitions.asm
index 34b3fbdb..98040fa1 100644
--- a/engine/battle/battle_transitions.asm
+++ b/engine/battle/battle_transitions.asm
@@ -326,7 +326,7 @@ BattleTransition_FlashScreen_:
ld hl, BattleTransition_FlashScreenPalettes
.loop
ld a, [hli]
- cp $1
+ cp 1
jr z, .done
ldh [rBGP], a
ld c, 2
@@ -339,7 +339,7 @@ BattleTransition_FlashScreen_:
BattleTransition_FlashScreenPalettes:
db $F9,$FE,$FF,$FE,$F9,$E4,$90,$40,$00,$40,$90,$E4
- db $01 ; terminator
+ db 1 ; end
; used for low level trainer dungeon battles
BattleTransition_Shrink:
@@ -649,87 +649,36 @@ BattleTransition_Circle_Sub2:
ld l, a
jp BattleTransition_Circle_Sub3
-BattleTransition_HalfCircle1:
- db $01
- dw BattleTransition_CircleData1
- dwcoord 18, 6
-
- db $01
- dw BattleTransition_CircleData2
- dwcoord 19, 3
-
- db $01
- dw BattleTransition_CircleData3
- dwcoord 18, 0
-
- db $01
- dw BattleTransition_CircleData4
- dwcoord 14, 0
-
- db $01
- dw BattleTransition_CircleData5
- dwcoord 10, 0
-
- db $00
- dw BattleTransition_CircleData5
- dwcoord 9, 0
-
- db $00
- dw BattleTransition_CircleData4
- dwcoord 5, 0
-
- db $00
- dw BattleTransition_CircleData3
- dwcoord 1, 0
-
- db $00
- dw BattleTransition_CircleData2
- dwcoord 0, 3
+half_circle: MACRO
+ ; quadrant x, circle data, target coord
+ db \1
+ dw \2
+ dwcoord \3, \4
+ENDM
- db $00
- dw BattleTransition_CircleData1
- dwcoord 1, 6
+BattleTransition_HalfCircle1:
+ half_circle $01, BattleTransition_CircleData1, 18, 6
+ half_circle $01, BattleTransition_CircleData2, 19, 3
+ half_circle $01, BattleTransition_CircleData3, 18, 0
+ half_circle $01, BattleTransition_CircleData4, 14, 0
+ half_circle $01, BattleTransition_CircleData5, 10, 0
+ half_circle $00, BattleTransition_CircleData5, 9, 0
+ half_circle $00, BattleTransition_CircleData4, 5, 0
+ half_circle $00, BattleTransition_CircleData3, 1, 0
+ half_circle $00, BattleTransition_CircleData2, 0, 3
+ half_circle $00, BattleTransition_CircleData1, 1, 6
BattleTransition_HalfCircle2:
- db $00
- dw BattleTransition_CircleData1
- dwcoord 1, 11
-
- db $00
- dw BattleTransition_CircleData2
- dwcoord 0, 14
-
- db $00
- dw BattleTransition_CircleData3
- dwcoord 1, 17
-
- db $00
- dw BattleTransition_CircleData4
- dwcoord 5, 17
-
- db $00
- dw BattleTransition_CircleData5
- dwcoord 9, 17
-
- db $01
- dw BattleTransition_CircleData5
- dwcoord 10, 17
-
- db $01
- dw BattleTransition_CircleData4
- dwcoord 14, 17
-
- db $01
- dw BattleTransition_CircleData3
- dwcoord 18, 17
-
- db $01
- dw BattleTransition_CircleData2
- dwcoord 19, 14
-
- db $01
- dw BattleTransition_CircleData1
- dwcoord 18, 11
+ half_circle $00, BattleTransition_CircleData1, 1, 11
+ half_circle $00, BattleTransition_CircleData2, 0, 14
+ half_circle $00, BattleTransition_CircleData3, 1, 17
+ half_circle $00, BattleTransition_CircleData4, 5, 17
+ half_circle $00, BattleTransition_CircleData5, 9, 17
+ half_circle $01, BattleTransition_CircleData5, 10, 17
+ half_circle $01, BattleTransition_CircleData4, 14, 17
+ half_circle $01, BattleTransition_CircleData3, 18, 17
+ half_circle $01, BattleTransition_CircleData2, 19, 14
+ half_circle $01, BattleTransition_CircleData1, 18, 11
BattleTransition_Circle_Sub3:
push hl
diff --git a/engine/battle/core.asm b/engine/battle/core.asm
index b5c37f1e..4f35ba39 100755
--- a/engine/battle/core.asm
+++ b/engine/battle/core.asm
@@ -921,7 +921,7 @@ TrainerBattleVictory:
ld b, MUSIC_DEFEATED_TRAINER
.gymleader
ld a, [wTrainerClass]
- cp SONY3 ; final battle against rival
+ cp RIVAL3 ; final battle against rival
jr nz, .notrival
ld b, MUSIC_DEFEATED_GYM_LEADER
ld hl, wFlags_D733
@@ -1134,7 +1134,7 @@ HandlePlayerBlackOut:
cp LINK_STATE_BATTLING
jr z, .notSony1Battle
ld a, [wCurOpponent]
- cp OPP_SONY1
+ cp OPP_RIVAL1
jr nz, .notSony1Battle
hlcoord 0, 0 ; sony 1 battle
lb bc, 8, 21
diff --git a/engine/battle/get_trainer_name.asm b/engine/battle/get_trainer_name.asm
index 478cdc26..b2daebfe 100644
--- a/engine/battle/get_trainer_name.asm
+++ b/engine/battle/get_trainer_name.asm
@@ -5,11 +5,11 @@ GetTrainerName_::
jr nz, .foundName
ld hl, wRivalName
ld a, [wTrainerClass]
- cp SONY1
+ cp RIVAL1
jr z, .foundName
- cp SONY2
+ cp RIVAL2
jr z, .foundName
- cp SONY3
+ cp RIVAL3
jr z, .foundName
ld [wd0b5], a
ld a, TRAINER_NAME
diff --git a/engine/battle/read_trainer_party.asm b/engine/battle/read_trainer_party.asm
index ba4f6f8e..7e5c1249 100755
--- a/engine/battle/read_trainer_party.asm
+++ b/engine/battle/read_trainer_party.asm
@@ -116,7 +116,7 @@ ReadTrainer:
; no matches found. is this trainer champion rival?
ld a, b
- cp SONY3
+ cp RIVAL3
jr z, .ChampionRival
jr .FinishUp ; nope
.GiveTeamMoves
diff --git a/engine/battle/scale_sprites.asm b/engine/battle/scale_sprites.asm
index 69979412..87b4398d 100644
--- a/engine/battle/scale_sprites.asm
+++ b/engine/battle/scale_sprites.asm
@@ -79,7 +79,19 @@ ScalePixelsByTwo:
; repeats each input bit twice
DuplicateBitsTable:
- db $00, $03, $0c, $0f
- db $30, $33, $3c, $3f
- db $c0, $c3, $cc, $cf
- db $f0, $f3, $fc, $ff
+ db %00000000
+ db %00000011
+ db %00001100
+ db %00001111
+ db %00110000
+ db %00110011
+ db %00111100
+ db %00111111
+ db %11000000
+ db %11000011
+ db %11001100
+ db %11001111
+ db %11110000
+ db %11110011
+ db %11111100
+ db %11111111
diff --git a/engine/events/hidden_objects/cinnabar_gym_quiz.asm b/engine/events/hidden_objects/cinnabar_gym_quiz.asm
index 2e4f48f3..e2ae7fbe 100644
--- a/engine/events/hidden_objects/cinnabar_gym_quiz.asm
+++ b/engine/events/hidden_objects/cinnabar_gym_quiz.asm
@@ -183,12 +183,18 @@ UpdateCinnabarGymGateTileBlocks_::
jr nz, .loop
ret
+gym_gate_coord: MACRO
+ db \1, \2, \3, 0
+ENDM
+
+HORIZONTAL_GATE_BLOCK EQU $54
+VERTICAL_GATE_BLOCK EQU $5f
+
CinnabarGymGateCoords:
- ; format: x-coord, y-coord, direction, padding
- ; direction: $54 = horizontal gate, $5f = vertical gate
- db $09,$03,$54,$00
- db $06,$03,$54,$00
- db $06,$06,$54,$00
- db $03,$08,$5f,$00
- db $02,$06,$54,$00
- db $02,$03,$54,$00
+ ; x coord, y coord, block id
+ gym_gate_coord 9, 3, HORIZONTAL_GATE_BLOCK
+ gym_gate_coord 6, 3, HORIZONTAL_GATE_BLOCK
+ gym_gate_coord 6, 6, HORIZONTAL_GATE_BLOCK
+ gym_gate_coord 3, 8, VERTICAL_GATE_BLOCK
+ gym_gate_coord 2, 6, HORIZONTAL_GATE_BLOCK
+ gym_gate_coord 2, 3, HORIZONTAL_GATE_BLOCK
diff --git a/engine/link/cable_club.asm b/engine/link/cable_club.asm
index 2bfda595..71afde1e 100755
--- a/engine/link/cable_club.asm
+++ b/engine/link/cable_club.asm
@@ -274,7 +274,7 @@ CableClub_DoBattleOrTradeAgain:
jr nz, .trading
ld a, LINK_STATE_BATTLING
ld [wLinkState], a
- ld a, OPP_SONY1
+ ld a, OPP_RIVAL1
ld [wCurOpponent], a
call ClearScreen
call Delay3
diff --git a/engine/menus/naming_screen.asm b/engine/menus/naming_screen.asm
index 8ca2ec9b..34c1aad3 100755
--- a/engine/menus/naming_screen.asm
+++ b/engine/menus/naming_screen.asm
@@ -469,7 +469,7 @@ PrintNamingText:
call PlaceString
ld hl, $1
add hl, bc
- ld [hl], $c9
+ ld [hl], "の" ; leftover from Japanese version; blank tile $c9 in English
hlcoord 1, 3
ld de, NicknameTextString
jr .placeString
diff --git a/engine/menus/pokedex.asm b/engine/menus/pokedex.asm
index 53719712..5660ecfb 100755
--- a/engine/menus/pokedex.asm
+++ b/engine/menus/pokedex.asm
@@ -599,10 +599,8 @@ PokeText:
; horizontal line that divides the pokedex text description from the rest of the data
PokedexDataDividerLine:
- db $68,$69,$6B,$69,$6B
- db $69,$6B,$69,$6B,$6B
- db $6B,$6B,$69,$6B,$69
- db $6B,$69,$6B,$69,$6A
+ db $68, $69, $6B, $69, $6B, $69, $6B, $69, $6B, $6B
+ db $6B, $6B, $69, $6B, $69, $6B, $69, $6B, $69, $6A
db "@"
; draws a line of tiles
diff --git a/engine/movie/gamefreak.asm b/engine/movie/gamefreak.asm
index 1463eb4f..1f837443 100755
--- a/engine/movie/gamefreak.asm
+++ b/engine/movie/gamefreak.asm
@@ -146,7 +146,7 @@ AnimateShootingStar:
ret
SmallStarsOAM:
- db $00,$00,$A2,$90
+ dbsprite 0, 0, 0, 0, $A2, OAM_BEHIND_BG | OAM_OBP1
SmallStarsOAMEnd:
SmallStarsWaveCoordsPointerTable:
@@ -161,28 +161,28 @@ SmallStarsWaveCoordsPointerTable:
; These arrays contain the Y and X coordinates of each OAM entry.
SmallStarsWave1Coords:
- db $68,$30
- db $68,$40
- db $68,$58
- db $68,$78
+ db $68, $30
+ db $68, $40
+ db $68, $58
+ db $68, $78
SmallStarsWave2Coords:
- db $68,$38
- db $68,$48
- db $68,$60
- db $68,$70
+ db $68, $38
+ db $68, $48
+ db $68, $60
+ db $68, $70
SmallStarsWave3Coords:
- db $68,$34
- db $68,$4C
- db $68,$54
- db $68,$64
+ db $68, $34
+ db $68, $4C
+ db $68, $54
+ db $68, $64
SmallStarsWave4Coords:
- db $68,$3C
- db $68,$5C
- db $68,$6C
- db $68,$74
+ db $68, $3C
+ db $68, $5C
+ db $68, $6C
+ db $68, $74
SmallStarsEmptyWave:
db $FF
@@ -213,29 +213,29 @@ MoveDownSmallStars:
ret
GameFreakLogoOAMData:
- db $48,$50,$8D,$00
- db $48,$58,$8E,$00
- db $50,$50,$8F,$00
- db $50,$58,$90,$00
- db $58,$50,$91,$00
- db $58,$58,$92,$00
- db $60,$30,$80,$00
- db $60,$38,$81,$00
- db $60,$40,$82,$00
- db $60,$48,$83,$00
- db $60,$50,$93,$00
- db $60,$58,$84,$00
- db $60,$60,$85,$00
- db $60,$68,$83,$00
- db $60,$70,$81,$00
- db $60,$78,$86,$00
+ dbsprite 10, 9, 0, 0, $8d, 0
+ dbsprite 11, 9, 0, 0, $8e, 0
+ dbsprite 10, 10, 0, 0, $8f, 0
+ dbsprite 11, 10, 0, 0, $90, 0
+ dbsprite 10, 11, 0, 0, $91, 0
+ dbsprite 11, 11, 0, 0, $92, 0
+ dbsprite 6, 12, 0, 0, $80, 0
+ dbsprite 7, 12, 0, 0, $81, 0
+ dbsprite 8, 12, 0, 0, $82, 0
+ dbsprite 9, 12, 0, 0, $83, 0
+ dbsprite 10, 12, 0, 0, $93, 0
+ dbsprite 11, 12, 0, 0, $84, 0
+ dbsprite 12, 12, 0, 0, $85, 0
+ dbsprite 13, 12, 0, 0, $83, 0
+ dbsprite 14, 12, 0, 0, $81, 0
+ dbsprite 15, 12, 0, 0, $86, 0
GameFreakLogoOAMDataEnd:
GameFreakShootingStarOAMData:
- db $00,$A0,$A0,$10
- db $00,$A8,$A0,$30
- db $08,$A0,$A1,$10
- db $08,$A8,$A1,$30
+ dbsprite 20, 0, 0, 0, $a0, OAM_OBP1
+ dbsprite 21, 0, 0, 0, $a0, OAM_OBP1 | OAM_HFLIP
+ dbsprite 20, 1, 0, 0, $a1, OAM_OBP1
+ dbsprite 21, 1, 0, 0, $a1, OAM_OBP1 | OAM_HFLIP
GameFreakShootingStarOAMDataEnd:
FallingStar:
diff --git a/engine/movie/hall_of_fame.asm b/engine/movie/hall_of_fame.asm
index 071e7ca1..a7d3ed40 100755
--- a/engine/movie/hall_of_fame.asm
+++ b/engine/movie/hall_of_fame.asm
@@ -202,7 +202,7 @@ HoFLoadPlayerPics:
HoFLoadMonPlayerPicTileIDs:
; c = base tile ID
- ld b, 0
+ ld b, TILEMAP_MON_PIC
hlcoord 12, 5
predef_jump CopyTileIDsFromList
diff --git a/engine/movie/intro.asm b/engine/movie/intro.asm
index 215b54ae..d8ec8e6e 100755
--- a/engine/movie/intro.asm
+++ b/engine/movie/intro.asm
@@ -1,15 +1,10 @@
-const_value = -1
+ const_def -1
const MOVE_NIDORINO_RIGHT
const MOVE_GENGAR_RIGHT
const MOVE_GENGAR_LEFT
ANIMATION_END EQU 80
-const_value = 3
- const GENGAR_INTRO_TILES1
- const GENGAR_INTRO_TILES2
- const GENGAR_INTRO_TILES3
-
PlayIntro:
xor a
ldh [hJoyHeld], a
@@ -34,7 +29,7 @@ PlayIntroScene:
ldh [rOBP1], a
xor a
ldh [hSCX], a
- ld b, GENGAR_INTRO_TILES1
+ ld b, TILEMAP_GENGAR_INTRO_1
call IntroCopyTiles
ld a, 0
ld [wBaseCoordX], a
@@ -77,7 +72,7 @@ PlayIntroScene:
ret c
; raise
- ld b, GENGAR_INTRO_TILES2
+ ld b, TILEMAP_GENGAR_INTRO_2
call IntroCopyTiles
ld a, SFX_INTRO_RAISE
call PlaySound
@@ -88,7 +83,7 @@ PlayIntroScene:
ret c
; slash
- ld b, GENGAR_INTRO_TILES3
+ ld b, TILEMAP_GENGAR_INTRO_3
call IntroCopyTiles
ld a, SFX_INTRO_CRASH
call PlaySound
@@ -107,7 +102,7 @@ PlayIntroScene:
lb de, 8 / 2, MOVE_GENGAR_LEFT
call IntroMoveMon
- ld b, GENGAR_INTRO_TILES1
+ ld b, TILEMAP_GENGAR_INTRO_1
call IntroCopyTiles
ld c, 60
call CheckForUserInterruption
@@ -445,6 +440,7 @@ GameFreakIntroEnd:
FightIntroBackMon:
INCBIN "gfx/intro_credits/gengar.2bpp"
+ ds 16, $00 ; blank tile
FightIntroBackMonEnd:
FightIntroFrontMon:
diff --git a/engine/movie/trade.asm b/engine/movie/trade.asm
index fc2da9bd..fa84e01d 100755
--- a/engine/movie/trade.asm
+++ b/engine/movie/trade.asm
@@ -59,11 +59,11 @@ TradeAnimCommon:
addtradefunc: MACRO
\1TradeFunc::
dw \1
- ENDM
+ENDM
tradefunc: MACRO
db (\1TradeFunc - TradeFuncPointerTable) / 2
- ENDM
+ENDM
; The functions in the sequences below are executed in order by TradeFuncCommon.
; They are from opposite perspectives. The external clock one makes use of
@@ -86,7 +86,7 @@ InternalClockTradeFuncSequence:
tradefunc Trade_ShowEnemyMon
tradefunc Trade_Delay100
tradefunc Trade_Cleanup
- db $FF
+ db -1 ; end
ExternalClockTradeFuncSequence:
tradefunc LoadTradingGFXAndMonNames
@@ -110,7 +110,7 @@ ExternalClockTradeFuncSequence:
tradefunc Trade_ShowClearedWindow
tradefunc PrintTradeWentToText
tradefunc Trade_Cleanup
- db $FF
+ db -1 ; end
TradeFuncPointerTable:
addtradefunc LoadTradingGFXAndMonNames
@@ -282,7 +282,7 @@ Trade_DrawOpenEndOfLinkCable:
ld a, %10001011
ldh [rLCDC], a
hlcoord 6, 2
- ld b, $7 ; open end of link cable tile ID list index
+ ld b, TILEMAP_LINK_CABLE
call CopyTileIDsFromList_ZeroBaseTileID
call Trade_CopyTileMapToVRAM
ld a, SFX_HEAL_HP
@@ -346,8 +346,8 @@ Trade_AnimateBallEnteringLinkCable:
ret
Trade_BallInsideLinkCableOAM:
- db $7E,$00,$7E,$20
- db $7E,$40,$7E,$60
+ dbsprite 0, 15, 0, 6, $7e, OAM_HFLIP
+ dbsprite 8, 15, 0, 6, $7e, OAM_HFLIP | OAM_VFLIP
Trade_ShowEnemyMon:
ld a, TRADE_BALL_TILT_ANIM
@@ -474,7 +474,7 @@ Trade_DrawLeftGameboy:
; draw gameboy pic
hlcoord 5, 3
- ld b, $6
+ ld b, TILEMAP_GAME_BOY
call CopyTileIDsFromList_ZeroBaseTileID
; draw text box with player name below gameboy pic
@@ -521,7 +521,7 @@ Trade_DrawRightGameboy:
; draw gameboy pic
hlcoord 7, 8
- ld b, $6
+ ld b, TILEMAP_GAME_BOY
call CopyTileIDsFromList_ZeroBaseTileID
; draw text box with enemy name above link cable
@@ -697,31 +697,33 @@ Trade_WriteCircleOAM:
jr nz, .loop
ret
+trade_circle_oam: MACRO
+ dw \1
+ db \2, \3
+ENDM
+
Trade_CircleOAMPointers:
- dw Trade_CircleOAM0
- db $08,$08
- dw Trade_CircleOAM1
- db $18,$08
- dw Trade_CircleOAM2
- db $08,$18
- dw Trade_CircleOAM3
- db $18,$18
+ ; oam pointer, upper-left x coord, upper-left y coord
+ trade_circle_oam Trade_CircleOAM0, $08, $08
+ trade_circle_oam Trade_CircleOAM1, $18, $08
+ trade_circle_oam Trade_CircleOAM2, $08, $18
+ trade_circle_oam Trade_CircleOAM3, $18, $18
Trade_CircleOAM0:
- db $38,$10,$39,$10
- db $3A,$10,$3B,$10
+ dbsprite 2, 7, 0, 0, $39, OAM_OBP1
+ dbsprite 2, 7, 0, 2, $3b, OAM_OBP1
Trade_CircleOAM1:
- db $39,$30,$38,$30
- db $3B,$30,$3A,$30
+ dbsprite 6, 7, 0, 1, $38, OAM_OBP1 | OAM_HFLIP
+ dbsprite 6, 7, 0, 3, $3a, OAM_OBP1 | OAM_HFLIP
Trade_CircleOAM2:
- db $3A,$50,$3B,$50
- db $38,$50,$39,$50
+ dbsprite 10, 7, 0, 2, $3b, OAM_OBP1 | OAM_VFLIP
+ dbsprite 10, 7, 0, 0, $39, OAM_OBP1 | OAM_VFLIP
Trade_CircleOAM3:
- db $3B,$70,$3A,$70
- db $39,$70,$38,$70
+ dbsprite 14, 7, 0, 3, $3a, OAM_OBP1 | OAM_HFLIP | OAM_VFLIP
+ dbsprite 14, 7, 0, 1, $38, OAM_OBP1 | OAM_HFLIP | OAM_VFLIP
; a = species
Trade_LoadMonSprite:
diff --git a/engine/overworld/auto_movement.asm b/engine/overworld/auto_movement.asm
index 31f7d7b9..9c078f08 100755
--- a/engine/overworld/auto_movement.asm
+++ b/engine/overworld/auto_movement.asm
@@ -286,7 +286,7 @@ FreezeEnemyTrainerSprite::
jp SetSpriteMovementBytesToFF
RivalIDs:
- db OPP_SONY1
- db OPP_SONY2
- db OPP_SONY3
+ db OPP_RIVAL1
+ db OPP_RIVAL2
+ db OPP_RIVAL3
db -1 ; end
diff --git a/engine/overworld/cut.asm b/engine/overworld/cut.asm
index 07039e03..6a92ccc0 100755
--- a/engine/overworld/cut.asm
+++ b/engine/overworld/cut.asm
@@ -123,8 +123,8 @@ WriteCutOrBoulderDustAnimationOAMBlock:
jp WriteOAMBlock
CutOrBoulderDustAnimationTilesAndAttributes:
- db $FC,$10,$FD,$10
- db $FE,$10,$FF,$10
+ dbsprite 2, -1, 0, 4, $fd, OAM_OBP1
+ dbsprite 2, -1, 0, 6, $ff, OAM_OBP1
GetCutOrBoulderDustAnimationOffsets:
ld hl, wSpritePlayerStateData1YPixels
diff --git a/engine/overworld/emotion_bubbles.asm b/engine/overworld/emotion_bubbles.asm
index 298858a2..0315687d 100755
--- a/engine/overworld/emotion_bubbles.asm
+++ b/engine/overworld/emotion_bubbles.asm
@@ -67,8 +67,8 @@ EmotionBubblesPointerTable:
dw HappyEmote
EmotionBubblesOAM:
- db $F8,$00,$F9,$00
- db $FA,$00,$FB,$00
+ dbsprite 0, -1, 0, 0, $f9, 0
+ dbsprite 0, -1, 0, 2, $fb, 0
EmotionBubbles:
ShockEmote: INCBIN "gfx/emotes/shock.2bpp"
diff --git a/engine/overworld/healing_machine.asm b/engine/overworld/healing_machine.asm
index eaa396d0..40ca6f65 100755
--- a/engine/overworld/healing_machine.asm
+++ b/engine/overworld/healing_machine.asm
@@ -66,13 +66,15 @@ PokeCenterFlashingMonitorAndHealBall:
INCBIN "gfx/overworld/heal_machine.2bpp"
PokeCenterOAMData:
- db $24,$34,$7C,$10 ; heal machine monitor
- db $2B,$30,$7D,$10 ; pokeballs 1-6
- db $2B,$38,$7D,$30
- db $30,$30,$7D,$10
- db $30,$38,$7D,$30
- db $35,$30,$7D,$10
- db $35,$38,$7D,$30
+ ; heal machine monitor
+ dbsprite 6, 4, 4, 4, $7c, OAM_OBP1
+ ; poke balls 1-6
+ dbsprite 6, 5, 0, 3, $7d, OAM_OBP1
+ dbsprite 7, 5, 0, 3, $7d, OAM_OBP1 | OAM_HFLIP
+ dbsprite 6, 6, 0, 0, $7d, OAM_OBP1
+ dbsprite 7, 6, 0, 0, $7d, OAM_OBP1 | OAM_HFLIP
+ dbsprite 6, 6, 0, 5, $7d, OAM_OBP1
+ dbsprite 7, 6, 0, 5, $7d, OAM_OBP1 | OAM_HFLIP
; d = value to xor with palette
FlashSprite8Times:
diff --git a/engine/overworld/ledges.asm b/engine/overworld/ledges.asm
index 0e006c5e..f01ae5ef 100755
--- a/engine/overworld/ledges.asm
+++ b/engine/overworld/ledges.asm
@@ -72,5 +72,5 @@ LedgeHoppingShadow:
LedgeHoppingShadowEnd:
LedgeHoppingShadowOAM:
- db $FF,$10,$FF,$20
- db $FF,$40,$FF,$60
+ dbsprite 2, -1, 0, 7, $ff, OAM_HFLIP
+ dbsprite 8, -1, 0, 7, $ff, OAM_HFLIP | OAM_VFLIP
diff --git a/engine/overworld/map_sprites.asm b/engine/overworld/map_sprites.asm
index 8f1f3931..031ddc76 100755
--- a/engine/overworld/map_sprites.asm
+++ b/engine/overworld/map_sprites.asm
@@ -98,7 +98,7 @@ LoadMapSpriteTilePatterns:
push af
ld a, [hl] ; [x#SPRITESTATEDATA2_IMAGEBASEOFFSET]
ld b, a ; b = current sprite picture ID
- cp SPRITE_BALL ; is it a 4-tile sprite?
+ cp FIRST_STILL_SPRITE ; is it a 4-tile sprite?
jr c, .notFourTileSprite
pop af
ldh a, [hFourTileSpriteCount]
diff --git a/engine/overworld/player_animations.asm b/engine/overworld/player_animations.asm
index 9e9b4073..c458a013 100755
--- a/engine/overworld/player_animations.asm
+++ b/engine/overworld/player_animations.asm
@@ -470,14 +470,10 @@ ItsABiteText:
FishingRodOAM:
; specifies how the fishing rod should be drawn on the screen
-; first byte = screen y coordinate
-; second byte = screen x coordinate
-; third byte = tile number
-; fourth byte = sprite properties
- db $5B, $4C, $FD, $00 ; player facing down
- db $44, $4C, $FD, $00 ; player facing up
- db $50, $40, $FE, $00 ; player facing left
- db $50, $58, $FE, $20 ; player facing right ($20 means "horizontally flip the tile")
+ dbsprite 9, 11, 4, 3, $fd, 0 ; down
+ dbsprite 9, 8, 4, 4, $fd, 0 ; up
+ dbsprite 8, 10, 0, 0, $fe, 0 ; left
+ dbsprite 11, 10, 0, 0, $fe, OAM_HFLIP ; right
fishing_gfx: MACRO
dw \1