Skip to content

Commit

Permalink
wOAMBuffer -> wShadowOAM (#95)
Browse files Browse the repository at this point in the history
  • Loading branch information
rawr51919 authored Jul 9, 2022
1 parent 05d4510 commit c0085ea
Show file tree
Hide file tree
Showing 36 changed files with 145 additions and 145 deletions.
2 changes: 1 addition & 1 deletion constants/gfx_constants.asm
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,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 @@ -174,7 +174,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 @@ -622,7 +622,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 @@ -895,7 +895,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 @@ -925,7 +925,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 @@ -965,8 +965,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 @@ -1180,7 +1180,7 @@ AnimationWaterDropletsEverywhere:
ret

_AnimationWaterDroplets:
ld hl, wOAMBuffer
ld hl, wShadowOAM
.loop
ld a, $1
ld [wdef5], a
Expand Down Expand Up @@ -1323,7 +1323,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 @@ -1571,7 +1571,7 @@ AnimationSpiralBallsInward:
.loop
push hl
ld c, 3
ld de, wOAMBuffer
ld de, wShadowOAM
.innerLoop
ld a, [hl]
cp $ff
Expand Down Expand Up @@ -1723,7 +1723,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 @@ -1737,7 +1737,7 @@ _AnimationShootBallsUpward:
ld [wNumShootingBalls], a
.loop
push bc
ld hl, wOAMBuffer
ld hl, wShadowOAM
.innerLoop
ld a, [wBaseCoordY]
add 8
Expand Down Expand Up @@ -2240,7 +2240,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 @@ -2494,7 +2494,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 @@ -2521,7 +2521,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 @@ -2530,7 +2530,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, $1
ld [wdef5], a
Expand Down Expand Up @@ -2616,7 +2616,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 @@ -108,7 +108,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 @@ -6511,7 +6511,7 @@ LoadPlayerBackPic:
ASSERT BANK(RedPicBack) == BANK(ProfOakPicBack)
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 @@ -29,7 +29,7 @@ SetupOwnPartyPokeballs:
ld [wHUDPokeballGfxOffsetX], a
xor a
ld [wdef5], a
ld hl, wOAMBuffer
ld hl, wShadowOAM
jp WritePokeballOAMData

SetupEnemyPartyPokeballs:
Expand All @@ -45,7 +45,7 @@ SetupEnemyPartyPokeballs:
ld [wHUDPokeballGfxOffsetX], a
ld a, $1
ld [wdef5], a
ld hl, wOAMBuffer + PARTY_LENGTH * 4
ld hl, wShadowOAMSprite06
jp WritePokeballOAMData

SetupPokeballs:
Expand Down Expand Up @@ -180,7 +180,7 @@ SetupPlayerAndEnemyPokeballs:
ld [wHUDPokeballGfxOffsetX], a
xor a
ld [wdef5], a
ld hl, wOAMBuffer
ld hl, wShadowOAM
call WritePokeballOAMData
ld hl, wEnemyMons
ld de, wEnemyPartyCount
Expand All @@ -191,7 +191,7 @@ SetupPlayerAndEnemyPokeballs:
ld [hl], $68
ld a, $1
ld [wdef5], a
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 @@ -61,7 +61,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
8 changes: 4 additions & 4 deletions engine/gfx/animated_objects.asm
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ RunObjectAnimations:
jr nz, .loop
ld a, [wCurrentAnimatedObjectOAMBufferOffset]
ld l, a
ld h, HIGH(wOAMBuffer)
ld h, HIGH(wShadowOAM)
.deinit_unused_oam_loop
ld a, l
cp LOW(wOAMBufferEnd)
cp LOW(wShadowOAMEnd)
jr nc, .quit
xor a
ld [hli], a
Expand Down Expand Up @@ -158,7 +158,7 @@ UpdateCurrentAnimatedObjectFrame:
push bc
ld a, [wCurrentAnimatedObjectOAMBufferOffset]
ld e, a
ld d, HIGH(wOAMBuffer)
ld d, HIGH(wShadowOAM)
ld a, [hli]
ld c, a
.loop
Expand Down Expand Up @@ -205,7 +205,7 @@ UpdateCurrentAnimatedObjectFrame:
inc de
ld a, e
ld [wCurrentAnimatedObjectOAMBufferOffset], a
cp LOW(wOAMBufferEnd)
cp LOW(wShadowOAMEnd)
jr nc, .oam_is_full
dec c
jr nz, .loop
Expand Down
10 changes: 5 additions & 5 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 @@ -186,7 +186,7 @@ WriteMonPartySpriteOAMByPartyIndex:
ret

.asm_7191f
ld hl, wOAMBuffer
ld hl, wShadowOAM
ld de, wMonPartySpritesSavedOAM
ld bc, $60
call CopyData
Expand Down Expand Up @@ -248,7 +248,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 @@ -264,7 +264,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.
; Yellow code has been changed to use registers more efficiently
; as well as tweaking the code to show gbc palettes

Expand Down Expand Up @@ -83,7 +83,7 @@ PrepareOAMData::
ldh a, [hOAMBufferOffset]

ld e, a
ld d, HIGH(wOAMBuffer)
ld d, HIGH(wShadowOAM)

.tileLoop
ld a, [hli]
Expand Down Expand Up @@ -153,7 +153,7 @@ PrepareOAMData::
cp c
ret nc
ld l, a
ld h, HIGH(wOAMBuffer)
ld h, HIGH(wShadowOAM)
ld a, c
ld de, $4 ; entry size
ld b, $a0
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 @@ -1295,7 +1295,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
Loading

0 comments on commit c0085ea

Please sign in to comment.