Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wOAMBuffer -> wShadowOAM #370

Merged
merged 5 commits into from
Jul 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion constants/gfx_constants.asm
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ DEF HP_BAR_GREEN EQU 0
DEF HP_BAR_YELLOW EQU 1
DEF HP_BAR_RED EQU 2

; wOAMBuffer
; wShadowOAM
DEF NUM_SPRITE_OAM_STRUCTS EQU 40

; hAutoBGTransferEnabled
Expand Down
32 changes: 16 additions & 16 deletions engine/battle/animations.asm
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ DrawFrameBlock:
jr z, .resetFrameBlockDestAddr
call AnimationCleanOAM
.resetFrameBlockDestAddr
ld hl, wOAMBuffer ; OAM buffer
ld hl, wShadowOAM
ld a, l
ld [wFBDestAddr + 1], a
ld a, h
Expand Down Expand Up @@ -583,7 +583,7 @@ PlaySubanimation:
call GetMoveSound
call PlaySound
.skipPlayingSound
ld hl, wOAMBuffer ; base address of OAM buffer
ld hl, wShadowOAM
ld a, l
ld [wFBDestAddr + 1], a
ld a, h
Expand Down Expand Up @@ -855,7 +855,7 @@ TradeShakePokeball:
; if it's the end of the animation, make the ball jump up
ld de, BallMoveDistances1
.loop
ld hl, wOAMBuffer ; OAM buffer
ld hl, wShadowOAM
ld bc, 4
.innerLoop
ld a, [de]
Expand Down Expand Up @@ -885,7 +885,7 @@ BallMoveDistances1:
TradeJumpPokeball:
ld de, BallMoveDistances2
.loop
ld hl, wOAMBuffer ; OAM buffer
ld hl, wShadowOAM
ld bc, 4
.innerLoop
ld a, [de]
Expand Down Expand Up @@ -925,8 +925,8 @@ BallMoveDistances2:
; this function copies the current musical note graphic
; so that there are two musical notes flying towards the defending pokemon
DoGrowlSpecialEffects:
ld hl, wOAMBuffer ; OAM buffer
ld de, wOAMBuffer + $10
ld hl, wShadowOAM
ld de, wShadowOAMSprite04
ld bc, $10
call CopyData ; copy the musical note graphic
ld a, [wSubAnimCounter]
Expand Down Expand Up @@ -1136,7 +1136,7 @@ AnimationWaterDropletsEverywhere:
ret

_AnimationWaterDroplets:
ld hl, wOAMBuffer
ld hl, wShadowOAM
.loop
ld a, [wBaseCoordY]
ld [hli], a ; Y
Expand Down Expand Up @@ -1264,7 +1264,7 @@ ShakeEnemyHUD_WritePlayerMonPicOAM:
ld [wBaseCoordX], a
ld a, $30
ld [wBaseCoordY], a
ld hl, wOAMBuffer
ld hl, wShadowOAM
ld d, 0
ld c, 7
.loop
Expand Down Expand Up @@ -1498,7 +1498,7 @@ AnimationSpiralBallsInward:
.loop
push hl
ld c, 3
ld de, wOAMBuffer
ld de, wShadowOAM
.innerLoop
ld a, [hl]
cp $ff
Expand Down Expand Up @@ -1637,7 +1637,7 @@ _AnimationShootBallsUpward:
call LoadAnimationTileset
pop bc
ld d, $7a ; ball tile
ld hl, wOAMBuffer
ld hl, wShadowOAM
push bc
ld a, [wBaseCoordY]
ld e, a
Expand All @@ -1651,7 +1651,7 @@ _AnimationShootBallsUpward:
ld [wNumShootingBalls], a
.loop
push bc
ld hl, wOAMBuffer
ld hl, wShadowOAM
.innerLoop
ld a, [wBaseCoordY]
add 8
Expand Down Expand Up @@ -2080,7 +2080,7 @@ InitMultipleObjectsOAM:
xor a
ld e, a
ld [wBaseCoordX], a
ld hl, wOAMBuffer
ld hl, wShadowOAM
.loop
call BattleAnimWriteOAMEntry
dec c
Expand Down Expand Up @@ -2336,7 +2336,7 @@ AnimationFallingObjects:
call InitMultipleObjectsOAM
call FallingObjects_InitXCoords
call FallingObjects_InitMovementData
ld hl, wOAMBuffer
ld hl, wShadowOAM
ld [hl], 0
.loop
ld hl, wFallingObjectsMovementData
Expand All @@ -2363,7 +2363,7 @@ AnimationFallingObjects:
dec c
jr nz, .innerLoop
call Delay3
ld hl, wOAMBuffer
ld hl, wShadowOAM
ld a, [hl] ; Y
cp 104 ; has the top falling object reached 104 yet?
jr nz, .loop ; keep moving the falling objects down until it does
Expand All @@ -2372,7 +2372,7 @@ AnimationFallingObjects:
FallingObjects_UpdateOAMEntry:
; Increases Y by 2 pixels and adjusts X and X flip based on the falling object's
; movement byte.
ld hl, wOAMBuffer
ld hl, wShadowOAM
add hl, de
ld a, [hl]
inc a
Expand Down Expand Up @@ -2433,7 +2433,7 @@ FallingObjects_UpdateMovementByte:
ret

FallingObjects_InitXCoords:
ld hl, wOAMBuffer + $01
ld hl, wShadowOAMSprite00XCoord
ld de, FallingObjects_InitialXCoords
ld a, [wNumFallingObjects]
ld c, a
Expand Down
2 changes: 1 addition & 1 deletion engine/battle/battle_transitions.asm
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ BattleTransition:
jr nz, .loop1

; Clear OAM except for the blocks used by the player and enemy trainer sprites.
ld hl, wOAMBuffer + $10
ld hl, wShadowOAMSprite04
ld c, 9
.loop2
ld a, b
Expand Down
4 changes: 2 additions & 2 deletions engine/battle/core.asm
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ SlidePlayerAndEnemySilhouettesOnScreen:
; instead, the enemy pic is part of the background and uses the scroll register, while the player's head is a sprite and is slid by changing its X coordinates in a loop
SlidePlayerHeadLeft:
push bc
ld hl, wOAMBuffer + $01
ld hl, wShadowOAMSprite00XCoord
ld c, $15 ; number of OAM entries
ld de, $4 ; size of OAM entry
.loop
Expand Down Expand Up @@ -6327,7 +6327,7 @@ LoadPlayerBackPic:
ASSERT BANK(RedPicBack) == BANK(OldManPicBack)
call UncompressSpriteFromDE
predef ScaleSpriteByTwo
ld hl, wOAMBuffer
ld hl, wShadowOAM
xor a
ldh [hOAMTile], a ; initial tile number
ld b, $7 ; 7 columns
Expand Down
8 changes: 4 additions & 4 deletions engine/battle/draw_hud_pokeball_gfx.asm
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ SetupOwnPartyPokeballs:
ld [hl], a
ld a, 8
ld [wHUDPokeballGfxOffsetX], a
ld hl, wOAMBuffer
ld hl, wShadowOAM
jp WritePokeballOAMData

SetupEnemyPartyPokeballs:
Expand All @@ -41,7 +41,7 @@ SetupEnemyPartyPokeballs:
ld [hl], $20
ld a, -8
ld [wHUDPokeballGfxOffsetX], a
ld hl, wOAMBuffer + PARTY_LENGTH * 4
ld hl, wShadowOAMSprite06
jp WritePokeballOAMData

SetupPokeballs:
Expand Down Expand Up @@ -174,7 +174,7 @@ SetupPlayerAndEnemyPokeballs:
ld [hl], $40
ld a, 8
ld [wHUDPokeballGfxOffsetX], a
ld hl, wOAMBuffer
ld hl, wShadowOAM
call WritePokeballOAMData
ld hl, wEnemyMons
ld de, wEnemyPartyCount
Expand All @@ -183,7 +183,7 @@ SetupPlayerAndEnemyPokeballs:
ld a, $50
ld [hli], a
ld [hl], $68
ld hl, wOAMBuffer + $18
ld hl, wShadowOAMSprite06
jp WritePokeballOAMData

; four tiles: pokeball, black pokeball (status ailment), crossed out pokeball (fainted) and pokeball slot (no mon)
Expand Down
2 changes: 1 addition & 1 deletion engine/battle/ghost_marowak_anim.asm
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ CopyMonPicFromBGToSpriteVRAM:
ld [wBaseCoordY], a
ld a, $70
ld [wBaseCoordX], a
ld hl, wOAMBuffer
ld hl, wShadowOAM
lb bc, 6, 6
ld d, $8
.oamLoop
Expand Down
2 changes: 1 addition & 1 deletion engine/events/diploma.asm
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ DisplayDiploma::

; Move the player 33 pixels right and set the priority bit so he appears
; behind the background layer.
ld hl, wOAMBuffer + $01
ld hl, wShadowOAMSprite00XCoord
lb bc, $80, $28
.adjustPlayerGfxLoop
ld a, [hl] ; X
Expand Down
8 changes: 4 additions & 4 deletions engine/gfx/mon_icons.asm
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,15 @@ GetAnimationSpeed:
.resetSprites
push bc
ld hl, wMonPartySpritesSavedOAM
ld de, wOAMBuffer
ld de, wShadowOAM
ld bc, $60
call CopyData
pop bc
xor a
jr .incTimer
.animateSprite
push bc
ld hl, wOAMBuffer + $02 ; OAM tile id
ld hl, wShadowOAMSprite00TileID
ld bc, $10
ld a, [wCurrentMenuItem]
call AddNTimes
Expand Down Expand Up @@ -236,7 +236,7 @@ WriteMonPartySpriteOAM:
; make a copy at wMonPartySpritesSavedOAM.
push af
ld c, $10
ld h, HIGH(wOAMBuffer)
ld h, HIGH(wShadowOAM)
ldh a, [hPartyMonIndex]
swap a
ld l, a
Expand All @@ -252,7 +252,7 @@ WriteMonPartySpriteOAM:
; Make a copy of the OAM buffer with the first animation frame written so that
; we can flip back to it from the second frame by copying it back.
.makeCopy
ld hl, wOAMBuffer
ld hl, wShadowOAM
ld de, wMonPartySpritesSavedOAM
ld bc, $60
jp CopyData
Expand Down
2 changes: 1 addition & 1 deletion engine/gfx/oam_dma.asm
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ DMARoutine:
LOAD "OAM DMA", HRAM
hDMARoutine::
; initiate DMA
ld a, HIGH(wOAMBuffer)
ld a, HIGH(wShadowOAM)
ldh [rDMA], a
; wait for DMA to finish
ld a, $28
Expand Down
6 changes: 3 additions & 3 deletions engine/gfx/sprite_oam.asm
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
PrepareOAMData::
; Determine OAM data for currently visible
; sprites and write it to wOAMBuffer.
; sprites and write it to wShadowOAM.

ld a, [wUpdateSpritesEnabled]
dec a
Expand Down Expand Up @@ -79,7 +79,7 @@ PrepareOAMData::

ldh a, [hOAMBufferOffset]
ld e, a
ld d, HIGH(wOAMBuffer)
ld d, HIGH(wShadowOAM)

.tileLoop
ldh a, [hSpriteScreenY] ; temp for sprite Y position
Expand Down Expand Up @@ -147,7 +147,7 @@ PrepareOAMData::
; Clear unused OAM.
ldh a, [hOAMBufferOffset]
ld l, a
ld h, HIGH(wOAMBuffer)
ld h, HIGH(wShadowOAM)
ld de, $4
ld b, $a0
ld a, [wd736]
Expand Down
2 changes: 1 addition & 1 deletion engine/items/item_effects.asm
Original file line number Diff line number Diff line change
Expand Up @@ -1175,7 +1175,7 @@ ItemUseMedicine:
xor a
ld [wBattleMonStatus], a ; remove the status ailment in the in-battle pokemon data
.calculateHPBarCoords
ld hl, wOAMBuffer + $90
ld hl, wShadowOAMSprite36
ld bc, 2 * SCREEN_WIDTH
inc d
.calculateHPBarCoordsLoop
Expand Down
20 changes: 10 additions & 10 deletions engine/items/town_map.asm
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ DisplayTownMap:
hlcoord 1, 0
ld de, wcd6d
call PlaceString
ld hl, wOAMBuffer
ld hl, wShadowOAM
ld de, wTileMapBackup
ld bc, $10
call CopyData
Expand Down Expand Up @@ -47,7 +47,7 @@ DisplayTownMap:
call TownMapCoordsToOAMCoords
ld a, $4
ld [wOAMBaseTile], a
ld hl, wOAMBuffer + $10
ld hl, wShadowOAMSprite04
call WriteTownMapSpriteOAM ; town map cursor sprite
pop hl
ld de, wcd6d
Expand All @@ -60,7 +60,7 @@ DisplayTownMap:
hlcoord 1, 0
ld de, wcd6d
call PlaceString
ld hl, wOAMBuffer + $10
ld hl, wShadowOAMSprite04
ld de, wTileMapBackup + 16
ld bc, $10
call CopyData
Expand Down Expand Up @@ -362,15 +362,15 @@ DrawPlayerOrBirdSprite:
inc de
cp "@"
jr nz, .loop
ld hl, wOAMBuffer
ld hl, wShadowOAM
ld de, wTileMapBackup
ld bc, $a0
jp CopyData

DisplayWildLocations:
farcall FindWildLocationsOfMon
call ZeroOutDuplicatesInList
ld hl, wOAMBuffer
ld hl, wShadowOAM
ld de, wTownMapCoords
.loop
ld a, [de]
Expand Down Expand Up @@ -410,7 +410,7 @@ DisplayWildLocations:
ld b, $0
call DrawPlayerOrBirdSprite
.done
ld hl, wOAMBuffer
ld hl, wShadowOAM
ld de, wTileMapBackup
ld bc, $a0
jp CopyData
Expand Down Expand Up @@ -439,9 +439,9 @@ TownMapCoordsToOAMCoords:
WritePlayerOrBirdSpriteOAM:
ld a, [wOAMBaseTile]
and a
ld hl, wOAMBuffer + $90 ; for player sprite
ld hl, wShadowOAMSprite36 ; for player sprite
jr z, WriteTownMapSpriteOAM
ld hl, wOAMBuffer + $80 ; for bird sprite
ld hl, wShadowOAMSprite32 ; for bird sprite

WriteTownMapSpriteOAM:
push hl
Expand Down Expand Up @@ -600,13 +600,13 @@ TownMapSpriteBlinkingAnimation::
jr nz, .done
; show sprites when the counter reaches 50
ld hl, wTileMapBackup
ld de, wOAMBuffer
ld de, wShadowOAM
ld bc, $90
call CopyData
xor a
jr .done
.hideSprites
ld hl, wOAMBuffer
ld hl, wShadowOAM
ld b, $24
ld de, $4
.hideSpritesLoop
Expand Down
2 changes: 1 addition & 1 deletion engine/menus/start_sub_menus.asm
Original file line number Diff line number Diff line change
Expand Up @@ -677,7 +677,7 @@ SwitchPartyMon_ClearGfx:
dec c
jr nz, .clearMonBGLoop
pop af
ld hl, wOAMBuffer
ld hl, wShadowOAM
ld bc, $10
call AddNTimes
ld de, $4
Expand Down
Loading