clean up wram aliases

This commit is contained in:
YamaArashi 2015-07-23 06:07:12 -07:00
parent c34156c5fb
commit 04a6c306dc
11 changed files with 124 additions and 93 deletions

View file

@ -1,5 +1,5 @@
BattleTransition: ; 7096d (1c:496d)
ld a, $1
ld a, 1
ld [H_AUTOBGTRANSFERENABLED], a
call Delay3
xor a
@ -7,10 +7,13 @@ BattleTransition: ; 7096d (1c:496d)
dec a
ld [wUpdateSpritesEnabled], a
call DelayFrame
; Determine which OAM block is being used by the enemy trainer sprite (if there
; is one).
ld hl, wSpriteStateData1 + 2
ld a, [H_DOWNARROWBLINKCNT2]
ld a, [hSpriteIndexOrTextID] ; enemy trainer sprite index (0 if wild battle)
ld c, a
ld b, $0
ld b, 0
ld de, $10
.loop1
ld a, [hl]
@ -21,13 +24,15 @@ BattleTransition: ; 7096d (1c:496d)
add hl, de
dec c
jr nz, .loop1
; Clear OAM except for the blocks used by the player and enemy trainer sprites.
ld hl, wOAMBuffer + $10
ld c, $9
ld c, 9
.loop2
ld a, b
swap a
cp l
jr z, .skip2
jr z, .skip2 ; skip clearing the block if the enemy trainer is using it
push hl
push bc
ld bc, $10
@ -40,9 +45,10 @@ BattleTransition: ; 7096d (1c:496d)
add hl, de
dec c
jr nz, .loop2
call Delay3
call LoadBattleTransitionTile
ld bc, $0
ld bc, 0
ld a, [wLinkState]
cp LINK_STATE_BATTLING
jr z, .linkBattle
@ -103,7 +109,7 @@ GetBattleTransitionID_CompareLevels: ; 709ef (1c:49ef)
sub e
jr nc, .highLevelEnemy
res 1, c
ld a, $1
ld a, 1
ld [wBattleTransitionSpiralDirection], a
ret
.highLevelEnemy
@ -229,10 +235,10 @@ BattleTransition_Spiral: ; 70a72 (1c:4a72)
ret
BattleTransition_InwardSpiral: ; 70aaa (1c:4aaa)
ld a, $7
ld [wWhichTrade], a
ld a, 7
ld [wInwardSpiralUpdateScreenCounter], a
coord hl, 0, 0
ld c, $11
ld c, SCREEN_HEIGHT - 1
ld de, SCREEN_WIDTH
call BattleTransition_InwardSpiral_
inc c
@ -242,7 +248,7 @@ BattleTransition_InwardSpiral: ; 70aaa (1c:4aaa)
call BattleTransition_InwardSpiral_
.skip
inc c
ld de, $1
ld de, 1
call BattleTransition_InwardSpiral_
dec c
dec c
@ -264,13 +270,13 @@ BattleTransition_InwardSpiral_: ; 70ae0 (1c:4ae0)
ld [hl], $ff
add hl, de
push bc
ld a, [wWhichTrade]
ld a, [wInwardSpiralUpdateScreenCounter]
dec a
jr nz, .skip
call BattleTransition_TransferDelay3
ld a, $7
ld a, 7
.skip
ld [wWhichTrade], a
ld [wInwardSpiralUpdateScreenCounter], a
pop bc
dec c
jr nz, .loop
@ -385,7 +391,7 @@ BattleTransition_Shrink: ; 70b7f (1c:4b7f)
call BattleTransition_CopyTiles2
coord hl, 11, 0
coord de, 10, 0
ld bc, $2
ld bc, 2
call BattleTransition_CopyTiles2
ld a, $1
ld [H_AUTOBGTRANSFERENABLED], a
@ -419,7 +425,7 @@ BattleTransition_Split: ; 70bca (1c:4bca)
call BattleTransition_CopyTiles2
coord hl, 1, 0
coord de, 0, 0
ld bc, $2
ld bc, 2
call BattleTransition_CopyTiles2
call BattleTransition_TransferDelay3
call Delay3
@ -432,10 +438,10 @@ BattleTransition_Split: ; 70bca (1c:4bca)
BattleTransition_CopyTiles1: ; 70c12 (1c:4c12)
ld a, c
ld [wWhichTrade], a
ld [wBattleTransitionCopyTilesOffset], a
ld a, b
ld [wTrainerEngageDistance], a
ld c, $8
ld [wBattleTransitionCopyTilesOffset + 1], a
ld c, 8
.loop1
push bc
push hl
@ -444,9 +450,9 @@ BattleTransition_CopyTiles1: ; 70c12 (1c:4c12)
call CopyData
pop hl
pop de
ld a, [wWhichTrade]
ld a, [wBattleTransitionCopyTilesOffset]
ld c, a
ld a, [wTrainerEngageDistance]
ld a, [wBattleTransitionCopyTilesOffset + 1]
ld b, a
add hl, bc
pop bc
@ -464,9 +470,9 @@ BattleTransition_CopyTiles1: ; 70c12 (1c:4c12)
BattleTransition_CopyTiles2: ; 70c3f (1c:4c3f)
ld a, c
ld [wWhichTrade], a
ld [wBattleTransitionCopyTilesOffset], a
ld a, b
ld [wTrainerEngageDistance], a
ld [wBattleTransitionCopyTilesOffset + 1], a
ld c, SCREEN_HEIGHT / 2
.loop1
push bc
@ -492,9 +498,9 @@ BattleTransition_CopyTiles2: ; 70c3f (1c:4c3f)
jr nz, .loop2
pop hl
pop de
ld a, [wWhichTrade]
ld a, [wBattleTransitionCopyTilesOffset]
ld c, a
ld a, [wTrainerEngageDistance]
ld a, [wBattleTransitionCopyTilesOffset + 1]
ld b, a
add hl, bc
pop bc
@ -590,11 +596,11 @@ BattleTransition_HorizontalStripes_: ; 70cd8 (1c:4cd8)
; by animating each half circle one at a time
BattleTransition_Circle: ; 70ce4 (1c:4ce4)
call BattleTransition_FlashScreen
ld bc, SCREEN_WIDTH / 2
lb bc, 0, SCREEN_WIDTH / 2
ld hl, BattleTransition_HalfCircle1
call BattleTransition_Circle_Sub1
ld c, SCREEN_WIDTH / 2
ld b, $1
ld b, 1
ld hl, BattleTransition_HalfCircle2
call BattleTransition_Circle_Sub1
jp BattleTransition_BlackScreen
@ -612,7 +618,7 @@ BattleTransition_Circle_Sub1: ; 70d06 (1c:4d06)
ld a, b
call BattleTransition_Circle_Sub2
pop hl
ld bc, $0005
ld bc, 5
add hl, bc
call BattleTransition_TransferDelay3
pop bc
@ -621,7 +627,7 @@ BattleTransition_Circle_Sub1: ; 70d06 (1c:4d06)
ret
BattleTransition_TransferDelay3: ; 70d19 (1c:4d19)
ld a, $1
ld a, 1
ld [H_AUTOBGTRANSFERENABLED], a
call Delay3
xor a
@ -647,7 +653,7 @@ BattleTransition_DoubleCircle: ; 70d24 (1c:4d24)
ld a, $1
call BattleTransition_Circle_Sub2
pop hl
ld bc, $5
ld bc, 5
add hl, bc
ld e, l
ld d, h
@ -660,9 +666,9 @@ BattleTransition_DoubleCircle: ; 70d24 (1c:4d24)
jp BattleTransition_BlackScreen
BattleTransition_Circle_Sub2: ; 70d50 (1c:4d50)
ld [wWhichTrade], a
ld [wBattleTransitionCircleScreenQuadrantY], a
ld a, [hli]
ld [wTrainerEngageDistance], a
ld [wBattleTransitionCircleScreenQuadrantX], a
ld a, [hli]
ld e, a
ld a, [hli]
@ -761,7 +767,7 @@ BattleTransition_Circle_Sub3: ; 70dc5 (1c:4dc5)
inc de
.loop1
ld [hl], $ff
ld a, [wTrainerEngageDistance]
ld a, [wBattleTransitionCircleScreenQuadrantX]
and a
jr z, .skip1
inc hl
@ -772,7 +778,7 @@ BattleTransition_Circle_Sub3: ; 70dc5 (1c:4dc5)
dec c
jr nz, .loop1
pop hl
ld a, [wWhichTrade]
ld a, [wBattleTransitionCircleScreenQuadrantY]
and a
ld bc, SCREEN_WIDTH
jr z, .skip3
@ -787,7 +793,7 @@ BattleTransition_Circle_Sub3: ; 70dc5 (1c:4dc5)
jr z, BattleTransition_Circle_Sub3
ld c, a
.loop2
ld a, [wTrainerEngageDistance]
ld a, [wBattleTransitionCircleScreenQuadrantX]
and a
jr z, .skip4
dec hl

View file

@ -6,7 +6,7 @@ DrawAllPokeballs: ; 3a849 (e:6849)
ret z ; return if wild pokémon
jp SetupEnemyPartyPokeballs
DrawEnemyPokeballs: ; 0x3a857
DrawEnemyPokeballs: ; 3a857 (e:6857)
call LoadPartyPokeballGfx
jp SetupEnemyPartyPokeballs
@ -25,8 +25,8 @@ SetupOwnPartyPokeballs: ; 3a869 (e:6869)
ld hl, W_BASECOORDX
ld [hli], a
ld [hl], a
ld a, $8
ld [wTrainerEngageDistance], a
ld a, 8
ld [wHUDPokeballGfxOffsetX], a
ld hl, wOAMBuffer
jp WritePokeballOAMData
@ -39,8 +39,8 @@ SetupEnemyPartyPokeballs: ; 3a887 (e:6887)
ld a, $48
ld [hli], a
ld [hl], $20
ld a, $f8
ld [wTrainerEngageDistance], a
ld a, -8
ld [wHUDPokeballGfxOffsetX], a
ld hl, wOAMBuffer + PARTY_LENGTH * 4
jp WritePokeballOAMData
@ -90,8 +90,8 @@ PickPokeball: ; 3a8c2 (e:68c2)
.done
ld a, b
ld [de], a
ld bc, $0028 ; rest of mon struct
add hl, bc
ld bc, wPartyMon2 - wPartyMon1Status
add hl, bc ; next mon struct
ret
WritePokeballOAMData: ; 3a8e1 (e:68e1)
@ -108,7 +108,7 @@ WritePokeballOAMData: ; 3a8e1 (e:68e1)
ld [hli], a
ld a, [W_BASECOORDX]
ld b, a
ld a, [wTrainerEngageDistance]
ld a, [wHUDPokeballGfxOffsetX]
add b
ld [W_BASECOORDX], a
inc de
@ -118,11 +118,11 @@ WritePokeballOAMData: ; 3a8e1 (e:68e1)
PlacePlayerHUDTiles: ; 3a902 (e:6902)
ld hl, PlayerBattleHUDGraphicsTiles
ld de, wTrainerFacingDirection
ld de, wHUDGraphicsTiles
ld bc, $3
call CopyData
coord hl, 18, 10
ld de, rIE
ld de, -1
jr PlaceHUDTiles
PlayerBattleHUDGraphicsTiles: ; 3a916 (e:6916)
@ -133,7 +133,7 @@ PlayerBattleHUDGraphicsTiles: ; 3a916 (e:6916)
PlaceEnemyHUDTiles: ; 3a919 (e:6919)
ld hl, EnemyBattleHUDGraphicsTiles
ld de, wTrainerFacingDirection
ld de, wHUDGraphicsTiles
ld bc, $3
call CopyData
coord hl, 1, 2
@ -150,16 +150,16 @@ PlaceHUDTiles: ; 3a930 (e:6930)
ld [hl], $73
ld bc, SCREEN_WIDTH
add hl, bc
ld a, [wTrainerScreenY]
ld a, [wHUDGraphicsTiles + 1] ; leftmost tile
ld [hl], a
ld a, $8
.asm_3a93c
ld a, 8
.loop
add hl, de
ld [hl], $76
dec a
jr nz, .asm_3a93c
jr nz, .loop
add hl, de
ld a, [wTrainerScreenX]
ld a, [wHUDGraphicsTiles + 2] ; rightmost tile
ld [hl], a
ret
@ -172,8 +172,8 @@ SetupPlayerAndEnemyPokeballs: ; 3a948 (e:6948)
ld a, $50
ld [hli], a
ld [hl], $40
ld a, $8
ld [wTrainerEngageDistance], a
ld a, 8
ld [wHUDPokeballGfxOffsetX], a
ld hl, wOAMBuffer
call WritePokeballOAMData
ld hl, wEnemyMons

View file

@ -455,7 +455,7 @@ DisplayOptionMenu: ; 5e8a (1:5e8a)
ld [wLastMenuItem],a
inc a
ld [wLetterPrintingDelayFlags],a
ld [wTrainerScreenY],a
ld [wUnusedCD40],a
ld a,3 ; text speed cursor Y coordinate
ld [wTopMenuItemY],a
call SetCursorPositionsFromOptions

View file

@ -29,7 +29,7 @@ FoundHiddenItemText: ; 7675b (1d:675b)
call GiveItem
jr nc, .BagFull
ld hl, wObtainedHiddenItemsFlags
ld a, [wTrainerScreenX]
ld a, [wHiddenItemOrCoinsIndex]
ld c, a
ld b, FLAG_SET
predef FlagActionPredef
@ -100,7 +100,7 @@ HiddenCoins: ; 76799 (1d:6799)
ld c, $2
predef AddBCDPredef
ld hl, wObtainedHiddenCoinsFlags
ld a, [wTrainerScreenX]
ld a, [wHiddenItemOrCoinsIndex]
ld c, a
ld b, FLAG_SET
predef FlagActionPredef

View file

@ -256,7 +256,7 @@ ReadTrainerScreenPosition: ; 5698e (15:698e)
; a: distance player to sprite
CheckSpriteCanSeePlayer: ; 569af (15:69af)
ld b, a
ld a, [wTrainerEngageDistance] ; sprite line of sight (engage distance)
ld a, [wTrainerEngageDistance] ; how far the trainer can see
cp b
jr nc, .checkIfLinedUp
jr .notInLine ; player too far away

View file

@ -2052,7 +2052,7 @@ INCLUDE "data/map_songs.asm"
INCLUDE "data/map_header_banks.asm"
ClearVariablesAfterLoadingMapData: ; c335 (3:4335)
ld a, $90
ld a, SCREEN_HEIGHT_PIXELS
ld [hWY], a
ld [rWY], a
xor a

View file

@ -103,21 +103,21 @@ DayCareMText1: ; 56254 (15:6254)
ld a, [wPartyCount]
cp PARTY_LENGTH
ld hl, DayCareNoRoomForMonText
jp z, .asm_56403
ld de, wTrainerFacingDirection
jp z, .leaveMonInDayCare
ld de, wDayCareTotalCost
xor a
ld [de], a
inc de
ld [de], a
ld hl, wTrainerScreenX
ld hl, wDayCarePerLevelCost
ld a, $1
ld [hli], a
ld [hl], $0
ld a, [wDayCareNumLevelsGrown]
inc a
ld b, a
ld c, $2
.asm_56357
ld c, 2
.calcPriceLoop
push hl
push de
push bc
@ -126,29 +126,29 @@ DayCareMText1: ; 56254 (15:6254)
pop de
pop hl
dec b
jr nz, .asm_56357
jr nz, .calcPriceLoop
ld hl, DayCareOweMoneyText
call PrintText
ld a, $13
ld a, MONEY_BOX
ld [wTextBoxID], a
call DisplayTextBoxID
call YesNoChoice
ld hl, DayCareAllRightThenText
ld a, [wCurrentMenuItem]
and a
jp nz, .asm_56403
ld hl, wTrainerFacingDirection
jp nz, .leaveMonInDayCare
ld hl, wDayCareTotalCost
ld [hMoney], a
ld a, [hli]
ld [hMoney + 1], a
ld a, [hl]
ld [hMoney + 2], a
call HasEnoughMoney
jr nc, .asm_56396
jr nc, .enoughMoney
ld hl, DayCareNotEnoughMoneyText
jp .asm_56403
jp .leaveMonInDayCare
.asm_56396
.enoughMoney
xor a
ld [W_DAYCARE_IN_USE], a
ld hl, wDayCareNumLevelsGrown
@ -202,7 +202,7 @@ DayCareMText1: ; 56254 (15:6254)
ld hl, DayCareGotMonBackText
jr .done
.asm_56403
.leaveMonInDayCare
ld a, [wDayCareStartLevel]
ld [wDayCareMonBoxLevel], a

View file

@ -1,7 +1,7 @@
.xf1f77
ld hl,.ForJust500Text
call PrintText
ld a,$13
ld a,MONEY_BOX
ld [wTextBoxID],a
call DisplayTextBoxID
call YesNoChoice
@ -21,11 +21,11 @@
.xf1f9f
xor a
ld [$ff9f],a
ld [hMoney],a
ld a,$05
ld [$ffa0],a
ld [hMoney + 1],a
ld a,$00
ld [$ffa1],a
ld [hMoney + 2],a
call HasEnoughMoney
jr nc,.success
ld hl,.NotEnoughMoneyText
@ -36,19 +36,19 @@
.success
xor a
ld [wSubtrahend],a
ld [wPriceTemp],a
ld a,$05
ld [wSubtrahend+1],a
ld [wPriceTemp + 1],a
ld a,$00
ld [wSubtrahend+2],a
ld hl,wTrainerFacingDirection
ld [wPriceTemp + 2],a
ld hl,wPriceTemp + 2
ld de,wPlayerMoney + 2
ld c,3
predef SubBCDPredef
ld a,$b2
call $3736
call $373e
ld a,$13
ld a,MONEY_BOX
ld [wTextBoxID],a
call DisplayTextBoxID
ld hl,.MakePaymentText

View file

@ -145,7 +145,7 @@ SafariZoneEntranceTextPointers: ; 752b9 (1d:52b9)
.SafariZoneEntranceText4
TX_FAR SafariZoneEntranceText_9e6e4
TX_ASM
ld a, $13
ld a, MONEY_BOX
ld [wTextBoxID],a
call DisplayTextBoxID
call YesNoChoice
@ -166,16 +166,16 @@ SafariZoneEntranceTextPointers: ; 752b9 (1d:52b9)
.success
xor a
ld [wSubtrahend],a
ld [wPriceTemp],a
ld a,$05
ld [wSubtrahend+1],a
ld [wPriceTemp + 1],a
ld a,$00
ld [wSubtrahend+2],a
ld hl,wTrainerFacingDirection
ld [wPriceTemp + 2],a
ld hl,wPriceTemp + 2
ld de,wPlayerMoney + 2
ld c,3
predef SubBCDPredef
ld a,$13
ld a,MONEY_BOX
ld [wTextBoxID],a
call DisplayTextBoxID
ld hl,.MakePaymentText

View file

@ -39,7 +39,7 @@ _DayCareMonHasGrownText:: ; 8ac32 (22:6c32)
_DayCareOweMoneyText:: ; 8ac7d (22:6c7d)
text "You owe me ¥@"
TX_BCD wcd3f, $c2
TX_BCD wDayCareTotalCost, $c2
db $0
line "for the return"
cont "of this #MON."

View file

@ -644,6 +644,18 @@ wOverrideSimulatedJoypadStatesMask:: ; cd3b
ds 1
wBattleTransitionCircleScreenQuadrantY:: ; cd3d
; 0 = upper half (Y < 9)
; 1 = lower half (Y >= 9)
wBattleTransitionCopyTilesOffset:: ; cd3d
; 2 bytes
; after 1 row/column has been copied, the offset to the next one to copy from
wInwardSpiralUpdateScreenCounter:: ; cd3d
; counts down from 7 so that every time 7 more tiles of the spiral have been
; placed, the tile map buffer is copied to VRAM so that progress is visible
wHoFTeamIndex:: ; cd3d
wSSAnneSmokeDriftAmount:: ; cd3d
@ -726,9 +738,6 @@ wPlayerSpinWhileMovingUpOrDownAnimDeltaY:: ; cd3d
wHiddenObjectFunctionArgument:: ; cd3d
wSubtrahend:: ; cd3d
; subtract (BCD) wSubtrahend, wSubtrahend+1, wSubtrahend+2
wWhichTrade:: ; cd3d
; which entry from TradeMons to select
@ -737,6 +746,13 @@ wTrainerSpriteOffset:: ; cd3d
wUnusedCD3D:: ; cd3d
ds 1
wHUDPokeballGfxOffsetX:: ; cd3e
; difference in X between the next ball and the current one
wBattleTransitionCircleScreenQuadrantX:: ; cd3e
; 0 = left half (X < 10)
; 1 = right half (X >= 10)
wSSAnneSmokeX:: ; cd3e
wRivalStarterBallSpriteIndex:: ; cd3e
@ -775,6 +791,12 @@ wHiddenObjectFunctionRomBank:: ; cd3e
wTrainerEngageDistance:: ; cd3e
ds 1
wHUDGraphicsTiles:: ; cd3f
; 3 bytes
wDayCareTotalCost:: ; cd3f
; 2-byte BCD number
wJigglypuffFacingDirections:: ; cd3f
wOptionsBattleStyleCursorX:: ; cd3f
@ -801,7 +823,6 @@ wPlayerSpinWhileMovingUpOrDownAnimFrameDelay:: ; cd3f
wHiddenObjectIndex:: ; cd3f
wTrainerFacingDirection:: ; cd3f
wcd3f:: ; used with daycare text for money amount
ds 1
wHoFMonOrPlayer:: ; cd40
@ -816,8 +837,13 @@ wPlayerSpinInPlaceAnimSoundID:: ; cd40
wHiddenObjectY:: ; cd40
wTrainerScreenY:: ; cd40
wUnusedCD40:: ; cd40
ds 1
wDayCarePerLevelCost:: ; cd41
; 2-byte BCD number (always set to $0100)
wHoFTeamIndex2:: ; cd41
wHiddenItemOrCoinsIndex:: ; cd41
@ -842,8 +868,7 @@ wHoFTeamNo:: ; cd42
wSlotMachineWheel1MiddleTile:: ; cd42
wFieldMovesLeftmostXCoord:: ; cd42
wcd42:: ds 1 ; used in pewter center script, printing field mon moves, slot machines and HoF PC
ds 1
wLastFieldMoveID:: ; cd43
; unused