aboutsummaryrefslogtreecommitdiffstats
path: root/engine
diff options
context:
space:
mode:
Diffstat (limited to 'engine')
-rw-r--r--engine/battle/animations.asm31
-rw-r--r--engine/movie/splash.asm8
-rw-r--r--engine/overworld/cut.asm4
-rw-r--r--engine/overworld/map_sprites.asm68
4 files changed, 57 insertions, 54 deletions
diff --git a/engine/battle/animations.asm b/engine/battle/animations.asm
index 9a58c221..ffa7e5a8 100644
--- a/engine/battle/animations.asm
+++ b/engine/battle/animations.asm
@@ -275,7 +275,7 @@ PlayAnimation:
ld a, [wAnimPalette]
ldh [rOBP0], a
call UpdateGBCPal_OBP0
- call LoadAnimationTileset
+ call LoadMoveAnimationTiles
call LoadSubanimation
call PlaySubanimation
pop af
@@ -372,11 +372,11 @@ GetSubanimationTransform2:
ret
; loads tile patterns for battle animations
-LoadAnimationTileset:
+LoadMoveAnimationTiles:
ld a, [wWhichBattleAnimTileset]
add a
add a
- ld hl, AnimationTilesetPointers
+ ld hl, MoveAnimationTilesPointers
ld e, a
ld d, 0
add hl, de
@@ -387,7 +387,7 @@ LoadAnimationTileset:
ld a, [hl]
ld d, a ; de = address of tileset
ld hl, vSprites tile $31
- ld b, BANK(AnimationTileset1) ; ROM bank
+ ld b, BANK(MoveAnimationTiles0) ; ROM bank
ld a, [wTempTilesetNumTiles]
ld c, a ; number of tiles
jp CopyVideoData ; load tileset
@@ -398,17 +398,18 @@ MACRO anim_tileset
db -1 ; padding
ENDM
-AnimationTilesetPointers:
+MoveAnimationTilesPointers:
; number of tiles, gfx pointer
- anim_tileset 79, AnimationTileset1
- anim_tileset 79, AnimationTileset2
- anim_tileset 64, AnimationTileset1
+ anim_tileset 79, MoveAnimationTiles0
+ anim_tileset 79, MoveAnimationTiles1
+ anim_tileset 64, MoveAnimationTiles2
-AnimationTileset1:
- INCBIN "gfx/battle/attack_anim_1.2bpp"
+MoveAnimationTiles0:
+MoveAnimationTiles2:
+ INCBIN "gfx/battle/move_anim_0.2bpp"
-AnimationTileset2:
- INCBIN "gfx/battle/attack_anim_2.2bpp"
+MoveAnimationTiles1:
+ INCBIN "gfx/battle/move_anim_1.2bpp"
SlotMachineTiles2:
INCBIN "gfx/slots/slots_2.2bpp"
@@ -1158,7 +1159,7 @@ AnimationWaterDropletsEverywhere:
; in Surf/Mist/Toxic.
xor a
ld [wWhichBattleAnimTileset], a
- call LoadAnimationTileset
+ call LoadMoveAnimationTiles
ld d, 32
ld a, -16
ld [wBaseCoordX], a
@@ -1720,7 +1721,7 @@ _AnimationShootBallsUpward:
push bc
xor a
ld [wWhichBattleAnimTileset], a
- call LoadAnimationTileset
+ call LoadMoveAnimationTiles
pop bc
ld d, $7a ; ball tile
ld hl, wShadowOAM
@@ -2234,7 +2235,7 @@ InitMultipleObjectsOAM:
push bc
push de
ld [wWhichBattleAnimTileset], a
- call LoadAnimationTileset
+ call LoadMoveAnimationTiles
pop de
pop bc
xor a
diff --git a/engine/movie/splash.asm b/engine/movie/splash.asm
index 03337525..b393d319 100644
--- a/engine/movie/splash.asm
+++ b/engine/movie/splash.asm
@@ -5,13 +5,13 @@ LoadShootingStarGraphics:
ldh [rOBP1], a
call UpdateGBCPal_OBP0
call UpdateGBCPal_OBP1
- ld de, AnimationTileset2 tile 3 ; star tile (top left quadrant)
+ ld de, MoveAnimationTiles1 tile 3 ; star tile (top left quadrant)
ld hl, vChars1 tile $20
- lb bc, BANK(AnimationTileset2), 1
+ lb bc, BANK(MoveAnimationTiles1), 1
call CopyVideoData
- ld de, AnimationTileset2 tile 19 ; star tile (bottom left quadrant)
+ ld de, MoveAnimationTiles1 tile 19 ; star tile (bottom left quadrant)
ld hl, vChars1 tile $21
- lb bc, BANK(AnimationTileset2), 1
+ lb bc, BANK(MoveAnimationTiles1), 1
call CopyVideoData
ld de, FallingStar
ld hl, vChars1 tile $22
diff --git a/engine/overworld/cut.asm b/engine/overworld/cut.asm
index ccc59846..1373f5dd 100644
--- a/engine/overworld/cut.asm
+++ b/engine/overworld/cut.asm
@@ -113,8 +113,8 @@ InitCutAnimOAM:
ret
LoadCutGrassAnimationTilePattern:
- ld de, AnimationTileset2 tile 6 ; tile depicting a leaf
- lb bc, BANK(AnimationTileset2), 1
+ ld de, MoveAnimationTiles1 tile 6 ; tile depicting a leaf
+ lb bc, BANK(MoveAnimationTiles1), 1
jp CopyVideoData
WriteCutOrBoulderDustAnimationOAMBlock:
diff --git a/engine/overworld/map_sprites.asm b/engine/overworld/map_sprites.asm
index c0fb4863..d1bc7832 100644
--- a/engine/overworld/map_sprites.asm
+++ b/engine/overworld/map_sprites.asm
@@ -11,7 +11,7 @@
_InitMapSprites::
call InitOutsideMapSprites
ret c ; return if the map is an outside map (already handled by above call)
-; if the map is an inside map (i.e. mapID >= $25)
+; if the map is an inside map (i.e. mapID >= FIRST_INDOOR_MAP)
call LoadSpriteSetFromMapHeader
call LoadMapSpriteTilePatterns
call Func_14150
@@ -38,11 +38,11 @@ InitOutsideMapSprites:
dec a
ld c, a
ld b, 0
- ld a, (wSpriteSetID - wSpriteSet)
+ ld a, wSpriteSetID - wSpriteSet
ld hl, SpriteSets
call AddNTimes ; get sprite set offset
ld de, wSpriteSet
- ld bc, (wSpriteSetID - wSpriteSet)
+ ld bc, wSpriteSetID - wSpriteSet
call CopyData ; copy it to wSpriteSet
call LoadMapSpriteTilePatterns
.skipLoadingSpriteSet
@@ -186,7 +186,7 @@ LoadWalkingTilePattern:
ld d, h
ld e, l
call GetSpriteVRAMAddress
- set 3, h ; add $800 to hl
+ set 3, h ; add $80 tiles to hl
call CopyVideoDataAlternate
ret
@@ -205,19 +205,17 @@ GetSpriteVRAMAddress:
ret
SpriteVRAMAddresses:
-; Equivalent to multiplying $C0 (number of bytes in 12 tiles) times the VRAM
-; slot and adding the result to $8000 (the VRAM base address).
- dw vChars0 + $0c0
- dw vChars0 + $180
- dw vChars0 + $240
- dw vChars0 + $300
- dw vChars0 + $3c0
- dw vChars0 + $480
- dw vChars0 + $540
- dw vChars0 + $600
- dw vChars0 + $6c0
- dw vChars0 + $780 ; 4-tile sprites
- dw vChars0 + $7c0 ; 4-tile sprites
+ dw vChars0 + (1 * 12) tiles
+ dw vChars0 + (2 * 12) tiles
+ dw vChars0 + (3 * 12) tiles
+ dw vChars0 + (4 * 12) tiles
+ dw vChars0 + (5 * 12) tiles
+ dw vChars0 + (6 * 12) tiles
+ dw vChars0 + (7 * 12) tiles
+ dw vChars0 + (8 * 12) tiles
+ dw vChars0 + (9 * 12) tiles
+ dw vChars0 + (10 * 12) tiles ; 4-tile sprites
+ dw vChars0 + (10 * 12 + 4) tiles ; 4-tile sprites
ReadSpriteSheetData:
ldh a, [hVRAMSlot]
@@ -263,7 +261,7 @@ Func_14150:
jr z, .spriteUnused
call Func_14179
push hl
- ld de, (wSpritePlayerStateData2ImageBaseOffset) - (wSpriteStateData1) ; $10e
+ ld de, wSpritePlayerStateData2ImageBaseOffset - wSpriteStateData1
add hl, de ; [x#SPRITESTATEDATA2_IMAGEBASEOFFSET]
ld [hl], a ; write offset
pop hl
@@ -304,11 +302,11 @@ GetSplitMapSpriteSetID:
ld hl, MapSpriteSets
add hl, de
ld a, [hl] ; a = spriteSetID
- cp $f0 ; does the map have 2 sprite sets?
+ cp FIRST_SPLIT_SET - 1 ; does the map have 2 sprite sets?
ret c
; Chooses the correct sprite set ID depending on the player's position within
; the map for maps with two sprite sets.
- cp $f8
+ cp SPLITSET_ROUTE_20
jr z, .route20
ld hl, SplitMapSpriteSets
and $0f
@@ -320,8 +318,8 @@ GetSplitMapSpriteSetID:
jr nc, .noCarry
inc h
.noCarry
- ld a, [hli] ; determines whether the map is split East/West or North/South
- cp $01
+ ld a, [hli] ; whether the map is split EAST_WEST or NORTH_SOUTH
+ cp EAST_WEST
ld a, [hli] ; position of dividing line
ld b, a
jr z, .eastWestDivide
@@ -333,35 +331,39 @@ GetSplitMapSpriteSetID:
.compareCoord
cp b
jr c, .loadSpriteSetID
-; if in the East side or South side
+; if in the east side or south side
inc hl
.loadSpriteSetID
ld a, [hl]
ret
-; Uses sprite set $01 for West side and $0A for East side.
+; Uses sprite set SPRITESET_PALLET_VIRIDIAN for west side and SPRITESET_FUCHSIA for east side.
; Route 20 is a special case because the two map sections have a more complex
; shape instead of the map simply being split horizontally or vertically.
.route20
ld hl, wXCoord
+ ; Use SPRITESET_PALLET_VIRIDIAN if X < 43
ld a, [hl]
- cp $2b
- ld a, $01
+ cp 43
+ ld a, SPRITESET_PALLET_VIRIDIAN
ret c
+ ; Use SPRITESET_FUCHSIA if X >= 62.
ld a, [hl]
- cp $3e
- ld a, $0a
+ cp 62
+ ld a, SPRITESET_FUCHSIA
ret nc
+ ; If 55 <= X < 62, split Y at 8; else 43 <= X < 55, so split Y at 13
ld a, [hl]
- cp $37
- ld b, $08
+ cp 55
+ ld b, 8
jr nc, .next
- ld b, $0d
+ ld b, 13
.next
+ ; Use SPRITESET_FUCHSIA if Y < split; else use SPRITESET_PALLET_VIRIDIAN
ld a, [wYCoord]
cp b
- ld a, $0a
+ ld a, SPRITESET_FUCHSIA
ret c
- ld a, $01
+ ld a, SPRITESET_PALLET_VIRIDIAN
ret
INCLUDE "data/maps/sprite_sets.asm"