Skip to content

Commit

Permalink
Rename off-by-one wram labels
Browse files Browse the repository at this point in the history
  • Loading branch information
dannye committed Sep 29, 2024
1 parent 7d9858f commit 716f860
Show file tree
Hide file tree
Showing 26 changed files with 102 additions and 102 deletions.
66 changes: 33 additions & 33 deletions engine/battle/animations.asm
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ DrawFrameBlock:
inc a
ld [wFBTileCounter], a
ld a, $2
ld [wdef5], a
ld [wdef4], a
ld a, [wSubAnimTransform]
dec a
jr z, .flipHorizontalAndVertical ; SUBANIMTYPE_HVFLIP
Expand Down Expand Up @@ -50,9 +50,9 @@ DrawFrameBlock:
ld [de], a ; store X
cp 88
jr c, .asm_78056
ld a, [wdef5]
ld a, [wdef4]
inc a
ld [wdef5], a
ld [wdef4], a
.asm_78056
inc hl
inc de
Expand All @@ -62,7 +62,7 @@ DrawFrameBlock:
inc de
ld a, [hli]
ld b, a
ld a, [wdef5]
ld a, [wdef4]
or b
ld [de], a ; store flags
inc de
Expand All @@ -84,9 +84,9 @@ DrawFrameBlock:
ld [de], a ; store X
cp 88
jr c, .asm_78087
ld a, [wdef5]
ld a, [wdef4]
inc a
ld [wdef5], a
ld [wdef4], a
.asm_78087
inc hl
inc de
Expand All @@ -107,7 +107,7 @@ DrawFrameBlock:
jr z, .storeFlags1
ld b, 0
.storeFlags1
ld a, [wdef5]
ld a, [wdef4]
or b
ld [de], a
inc de
Expand All @@ -127,9 +127,9 @@ DrawFrameBlock:
ld [de], a ; store X
cp 88
jr c, .asm_780c8
ld a, [wdef5]
ld a, [wdef4]
inc a
ld [wdef5], a
ld [wdef4], a
.asm_780c8
inc hl
inc de
Expand All @@ -147,7 +147,7 @@ DrawFrameBlock:
res OAM_X_FLIP, a
.storeFlags2
ld b, a
ld a, [wdef5]
ld a, [wdef4]
or b
ld [de], a
inc de
Expand Down Expand Up @@ -1184,29 +1184,29 @@ _AnimationWaterDroplets:
ld hl, wShadowOAM
.loop
ld a, $1
ld [wdef5], a
ld [wdef4], a
ld a, [wBaseCoordY]
ld [hli], a ; Y
cp 40
jr c, .asm_792d7
ld a, [wdef5]
ld a, [wdef4]
inc a
ld [wdef5], a
ld [wdef4], a
.asm_792d7
ld a, [wBaseCoordX]
add 27
ld [wBaseCoordX], a
ld [hli], a ; X
cp 88
jr c, .asm_792ee
ld a, [wdef5]
ld a, [wdef4]
add $2
and $3
ld [wdef5], a
ld [wdef4], a
.asm_792ee
ld a, [wDropletTile]
ld [hli], a ; tile
ld a, [wdef5]
ld a, [wdef4]
ld [hli], a ; attribute
ld a, [wBaseCoordX]
cp 144
Expand Down Expand Up @@ -1351,28 +1351,28 @@ BattleAnimWriteOAMEntry:
; tile = d
; attributes = variable (depending on coords)
ld a, $1
ld [wdef5], a
ld [wdef4], a
ld a, e
add 8
ld e, a
ld [hli], a
cp 40
jr c, .asm_793d8
ld a, [wdef5]
ld a, [wdef4]
inc a
ld [wdef5], a
ld [wdef4], a
.asm_793d8
ld a, [wBaseCoordX]
ld [hli], a
cp 88
jr c, .asm_793e8
ld a, [wdef5]
ld a, [wdef4]
add $2
ld [wdef5], a
ld [wdef4], a
.asm_793e8
ld a, d
ld [hli], a
ld a, [wdef5]
ld a, [wdef4]
ld [hli], a
ret

Expand Down Expand Up @@ -1578,7 +1578,7 @@ AnimationSpiralBallsInward:
cp $ff
jr z, .done
ld a, $2
ld [wdef5], a
ld [wdef4], a
ld a, [wSpiralBallsBaseY]
add [hl]
ld [de], a ; Y
Expand All @@ -1590,15 +1590,15 @@ AnimationSpiralBallsInward:
cp 88
jr c, .asm_79524
ld a, $3
ld [wdef5], a
ld [wdef4], a
.asm_79524
inc hl
inc de
inc de
ld a, [de]
and $f0
ld b, a
ld a, [wdef5]
ld a, [wdef4]
or b
ld [de], a
inc de
Expand Down Expand Up @@ -2534,7 +2534,7 @@ FallingObjects_UpdateOAMEntry:
ld hl, wShadowOAM
add hl, de
ld a, $1
ld [wdef5], a
ld [wdef4], a
ld a, [hl]
inc a
inc a
Expand All @@ -2545,9 +2545,9 @@ FallingObjects_UpdateOAMEntry:
ld [hli], a ; Y
cp 40
jr c, .asm_79e51
ld a, [wdef5]
ld a, [wdef4]
inc a
ld [wdef5], a
ld [wdef4], a
.asm_79e51
ld a, [wFallingObjectMovementByte]
ld b, a
Expand All @@ -2567,10 +2567,10 @@ FallingObjects_UpdateOAMEntry:
ld [hli], a ; X
cp 88
jr c, .asm_79e75
ld a, [wdef5]
ld a, [wdef4]
add $2
and $3
ld [wdef5], a
ld [wdef4], a
.asm_79e75
inc hl
xor a ; no horizontal flip
Expand All @@ -2583,16 +2583,16 @@ FallingObjects_UpdateOAMEntry:
ld [hli], a ; X
cp 88
jr c, .asm_79e5c
ld a, [wdef5]
ld a, [wdef4]
add $2
and $3
ld [wdef5], a
ld [wdef4], a
.asm_79e5c
inc hl
ld a, (1 << OAM_X_FLIP)
.next2
ld b, a
ld a, [wdef5]
ld a, [wdef4]
or b
ld [hl], a ; attribute
ret
Expand Down
10 changes: 5 additions & 5 deletions engine/battle/draw_hud_pokeball_gfx.asm
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ SetupOwnPartyPokeballs:
ld a, 8
ld [wHUDPokeballGfxOffsetX], a
xor a
ld [wdef5], a
ld [wdef4], a
ld hl, wShadowOAM
jp WritePokeballOAMData

Expand All @@ -44,7 +44,7 @@ SetupEnemyPartyPokeballs:
ld a, -8
ld [wHUDPokeballGfxOffsetX], a
ld a, $1
ld [wdef5], a
ld [wdef4], a
ld hl, wShadowOAMSprite06
jp WritePokeballOAMData

Expand Down Expand Up @@ -108,7 +108,7 @@ WritePokeballOAMData:
ld [hli], a
ld a, [de]
ld [hli], a
ld a, [wdef5]
ld a, [wdef4]
ld [hli], a
ld a, [wBaseCoordX]
ld b, a
Expand Down Expand Up @@ -179,7 +179,7 @@ SetupPlayerAndEnemyPokeballs:
ld a, 8
ld [wHUDPokeballGfxOffsetX], a
xor a
ld [wdef5], a
ld [wdef4], a
ld hl, wShadowOAM
call WritePokeballOAMData
ld hl, wEnemyMons
Expand All @@ -190,7 +190,7 @@ SetupPlayerAndEnemyPokeballs:
ld [hli], a
ld [hl], $68
ld a, $1
ld [wdef5], a
ld [wdef4], a
ld hl, wShadowOAMSprite06
jp WritePokeballOAMData

Expand Down
2 changes: 1 addition & 1 deletion engine/events/black_out.asm
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
ResetStatusAndHalveMoneyOnBlackout::
; Reset player status on blackout.
xor a
ld [wd435], a
ld [wd434], a
xor a ; gamefreak copypasting functions (double xor a)
ld [wBattleResult], a
ld [wWalkBikeSurfState], a
Expand Down
4 changes: 2 additions & 2 deletions engine/events/hidden_objects/cinnabar_gym_quiz.asm
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ CinnabarGymQuiz::
text_asm
xor a
ld [wOpponentAfterWrongAnswer], a
ld hl, wd475
ld hl, wd474
res 7, [hl]
ld a, [wHiddenObjectFunctionArgument]
push af
Expand Down Expand Up @@ -125,7 +125,7 @@ CinnabarGymQuiz_AskQuestion:
ldh a, [hGymGateIndex]
add $2
ld [wOpponentAfterWrongAnswer], a
ld hl, wd475
ld hl, wd474
set 7, [hl]
ret

Expand Down
2 changes: 1 addition & 1 deletion engine/events/pikachu_happiness.asm
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ ModifyPikachuHappiness::
jr c, .decreased
cp b
jr nc, .done
ld a, [wd49c]
ld a, [wd49b]
and a
jr nz, .done
jr .update_mood
Expand Down
2 changes: 1 addition & 1 deletion engine/events/poison.asm
Original file line number Diff line number Diff line change
Expand Up @@ -148,5 +148,5 @@ Func_c4c7:
ret nz
.asm_c4ef
xor a
ld [wd49c], a
ld [wd49b], a
ret
2 changes: 1 addition & 1 deletion engine/events/try_pikachu_movement.asm
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
TryApplyPikachuMovementData::
ld a, [wd472]
ld a, [wd471]
bit 7, a
ret z
ld a, [wWalkBikeSurfState]
Expand Down
8 changes: 4 additions & 4 deletions engine/items/item_effects.asm
Original file line number Diff line number Diff line change
Expand Up @@ -562,7 +562,7 @@ ItemUseBall:

.skipShowingPokedexData
ld a, $1
ld [wd49c], a
ld [wd49b], a
ld a, $85
ld [wPikachuMood], a
ld a, [wPartyCount]
Expand Down Expand Up @@ -819,7 +819,7 @@ ItemUseEvoStone:
ld hl, RefusingText
call PrintText
ld a, $4
ld [wd49c], a
ld [wd49b], a
ld a, $82
ld [wPikachuMood], a
jr .canceledItemUse
Expand Down Expand Up @@ -2124,7 +2124,7 @@ FishingInit:
ld a, SFX_HEAL_AILMENT
call PlaySound
ld a, $2
ld [wd49c], a
ld [wd49b], a
ld a, $81
ld [wPikachuMood], a
ld c, 80
Expand Down Expand Up @@ -2507,7 +2507,7 @@ ItemUseTMHM:
jr nz, .notTeachingThunderboltOrThunderToPikachu
.teachingThunderboltOrThunderToPlayerPikachu
ld a, $5
ld [wd49c], a
ld [wd49b], a
ld a, $85
ld [wPikachuMood], a
.notTeachingThunderboltOrThunderToPikachu
Expand Down
4 changes: 2 additions & 2 deletions engine/menus/start_sub_menus.asm
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ StartMenu_Pokemon::
.surfingPikachu
ld a, $2
.continue
ld [wd473], a
ld [wd472], a
ld a, SURFBOARD
ld [wCurItem], a
ld [wPseudoItemID], a
Expand All @@ -188,7 +188,7 @@ StartMenu_Pokemon::
jp .goBackToMap
.reloadNormalSprite
xor a
ld [wd473], a
ld [wd472], a
jp .loop
.strength
bit BIT_RAINBOWBADGE, a
Expand Down
4 changes: 2 additions & 2 deletions engine/overworld/sprite_collisions.asm
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ DetectCollisionBetweenSprites:
and $f0 ; collision with pikachu?
jr nz, .asm_4cd9
xor a
ld [wd434], a
ld [wd433], a
ldh a, [hCollidingSpriteOffset]
cp $f
jr nz, .asm_4cd9
Expand Down Expand Up @@ -352,7 +352,7 @@ Func_4d0a:
.asm_4d19
ld a, c
and b
ld [wd434], a
ld [wd433], a
ld a, c
inc l
inc l
Expand Down
Loading

0 comments on commit 716f860

Please sign in to comment.