mirror of
https://gitlab.com/xCrystal/pokecrystal-board.git
synced 2024-11-16 11:27:33 -08:00
Identify some more uses of wBuffer1-6
This commit is contained in:
parent
c88c4a8340
commit
9f62d7911b
@ -3226,13 +3226,13 @@ AddBattleParticipant:
|
||||
|
||||
FindMonInOTPartyToSwitchIntoBattle:
|
||||
ld b, -1
|
||||
ld a, $1
|
||||
ld [wBuffer1], a
|
||||
ld [wBuffer2], a
|
||||
ld a, %000001
|
||||
ld [wEnemyEffectivenessVsPlayerMons], a
|
||||
ld [wPlayerEffectivenessVsEnemyMons], a
|
||||
.loop
|
||||
ld hl, wBuffer1
|
||||
ld hl, wEnemyEffectivenessVsPlayerMons
|
||||
sla [hl]
|
||||
inc hl
|
||||
inc hl ; wPlayerEffectivenessVsEnemyMons
|
||||
sla [hl]
|
||||
inc b
|
||||
ld a, [wOTPartyCount]
|
||||
@ -3256,7 +3256,7 @@ FindMonInOTPartyToSwitchIntoBattle:
|
||||
jr .loop
|
||||
|
||||
.discourage
|
||||
ld hl, wBuffer2
|
||||
ld hl, wPlayerEffectivenessVsEnemyMons
|
||||
set 0, [hl]
|
||||
jr .loop
|
||||
|
||||
@ -3291,7 +3291,7 @@ LookUpTheEffectivenessOfEveryMove:
|
||||
ld a, [wTypeMatchup]
|
||||
cp EFFECTIVE + 1
|
||||
jr c, .loop
|
||||
ld hl, wBuffer1
|
||||
ld hl, wEnemyEffectivenessVsPlayerMons
|
||||
set 0, [hl]
|
||||
ret
|
||||
.done
|
||||
@ -3334,10 +3334,10 @@ IsThePlayerMonTypesEffectiveAgainstOTMon:
|
||||
|
||||
.super_effective
|
||||
pop bc
|
||||
ld hl, wBuffer1
|
||||
ld hl, wEnemyEffectivenessVsPlayerMons
|
||||
bit 0, [hl]
|
||||
jr nz, .reset
|
||||
inc hl
|
||||
inc hl ; wPlayerEffectivenessVsEnemyMons
|
||||
set 0, [hl]
|
||||
ret
|
||||
|
||||
@ -3347,9 +3347,9 @@ IsThePlayerMonTypesEffectiveAgainstOTMon:
|
||||
|
||||
ScoreMonTypeMatchups:
|
||||
.loop1
|
||||
ld hl, wBuffer1
|
||||
ld hl, wEnemyEffectivenessVsPlayerMons
|
||||
sla [hl]
|
||||
inc hl
|
||||
inc hl ; wPlayerEffectivenessVsEnemyMons
|
||||
sla [hl]
|
||||
jr nc, .loop1
|
||||
ld a, [wOTPartyCount]
|
||||
@ -3363,7 +3363,7 @@ ScoreMonTypeMatchups:
|
||||
jr .loop2
|
||||
|
||||
.okay
|
||||
ld a, [wBuffer1]
|
||||
ld a, [wEnemyEffectivenessVsPlayerMons]
|
||||
and a
|
||||
jr z, .okay2
|
||||
ld b, -1
|
||||
@ -3376,7 +3376,7 @@ ScoreMonTypeMatchups:
|
||||
|
||||
.okay2
|
||||
ld b, -1
|
||||
ld a, [wBuffer2]
|
||||
ld a, [wPlayerEffectivenessVsEnemyMons]
|
||||
ld c, a
|
||||
.loop4
|
||||
inc b
|
||||
|
@ -8,12 +8,12 @@ GetPokeBallWobble:
|
||||
ld d, a
|
||||
push de
|
||||
|
||||
ld a, BANK(wBuffer2)
|
||||
ld a, BANK(wThrownBallWobbleCount) ; aka BANK(wFinalCatchRate)
|
||||
ldh [rSVBK], a
|
||||
|
||||
ld a, [wBuffer2]
|
||||
ld a, [wThrownBallWobbleCount]
|
||||
inc a
|
||||
ld [wBuffer2], a
|
||||
ld [wThrownBallWobbleCount], a
|
||||
|
||||
; Wobble up to 3 times.
|
||||
cp 3 + 1
|
||||
@ -25,7 +25,7 @@ GetPokeBallWobble:
|
||||
jr nz, .done
|
||||
|
||||
ld hl, WobbleProbabilities
|
||||
ld a, [wBuffer1]
|
||||
ld a, [wFinalCatchRate]
|
||||
ld b, a
|
||||
.loop
|
||||
ld a, [hli]
|
||||
|
@ -1,14 +1,14 @@
|
||||
CheckForHiddenItems:
|
||||
; Checks to see if there are hidden items on the screen that have not yet been found. If it finds one, returns carry.
|
||||
call GetMapScriptsBank
|
||||
ld [wBuffer1], a
|
||||
; Get the coordinate of the bottom right corner of the screen, and load it in wBuffer3/wBuffer4.
|
||||
ld [wCurMapScriptBank], a
|
||||
; Get the coordinate of the bottom right corner of the screen, and load it in wBottomRightYCoord/wBottomRightXCoord.
|
||||
ld a, [wXCoord]
|
||||
add SCREEN_WIDTH / 4
|
||||
ld [wBuffer4], a
|
||||
ld [wBottomRightXCoord], a
|
||||
ld a, [wYCoord]
|
||||
add SCREEN_HEIGHT / 4
|
||||
ld [wBuffer3], a
|
||||
ld [wBottomRightYCoord], a
|
||||
; Get the pointer for the first bg_event in the map...
|
||||
ld hl, wCurMapBGEventsPointer
|
||||
ld a, [hli]
|
||||
@ -20,14 +20,14 @@ CheckForHiddenItems:
|
||||
jr z, .nobgeventitems
|
||||
; For i = 1:wCurMapBGEventCount...
|
||||
.loop
|
||||
; Store the counter in wBuffer2, and store the bg_event pointer in the stack.
|
||||
ld [wBuffer2], a
|
||||
; Store the counter in wRemainingBGEventCount, and store the bg_event pointer in the stack.
|
||||
ld [wRemainingBGEventCount], a
|
||||
push hl
|
||||
; Get the Y coordinate of the BG event.
|
||||
call .GetFarByte
|
||||
ld e, a
|
||||
; Is the Y coordinate of the BG event on the screen? If not, go to the next BG event.
|
||||
ld a, [wBuffer3]
|
||||
ld a, [wBottomRightYCoord]
|
||||
sub e
|
||||
jr c, .next
|
||||
cp SCREEN_HEIGHT / 2
|
||||
@ -35,7 +35,7 @@ CheckForHiddenItems:
|
||||
; Is the X coordinate of the BG event on the screen? If not, go to the next BG event.
|
||||
call .GetFarByte
|
||||
ld d, a
|
||||
ld a, [wBuffer4]
|
||||
ld a, [wBottomRightXCoord]
|
||||
sub d
|
||||
jr c, .next
|
||||
cp SCREEN_WIDTH / 2
|
||||
@ -45,9 +45,9 @@ CheckForHiddenItems:
|
||||
cp BGEVENT_ITEM
|
||||
jr nz, .next
|
||||
; Has this item already been found? If not, set off the Itemfinder.
|
||||
ld a, [wBuffer1]
|
||||
ld a, [wCurMapScriptBank]
|
||||
call GetFarHalfword
|
||||
ld a, [wBuffer1]
|
||||
ld a, [wCurMapScriptBank]
|
||||
call GetFarHalfword
|
||||
ld d, h
|
||||
ld e, l
|
||||
@ -63,7 +63,7 @@ CheckForHiddenItems:
|
||||
ld bc, BG_EVENT_SIZE
|
||||
add hl, bc
|
||||
; Restore the BG event counter and decrement it. If it hits zero, there are no hidden items in range.
|
||||
ld a, [wBuffer2]
|
||||
ld a, [wRemainingBGEventCount]
|
||||
dec a
|
||||
jr nz, .loop
|
||||
|
||||
@ -77,7 +77,7 @@ CheckForHiddenItems:
|
||||
ret
|
||||
|
||||
.GetFarByte:
|
||||
ld a, [wBuffer1]
|
||||
ld a, [wCurMapScriptBank]
|
||||
call GetFarByte
|
||||
inc hl
|
||||
ret
|
||||
|
@ -1,14 +1,14 @@
|
||||
FieldMoveJumptableReset:
|
||||
xor a
|
||||
ld hl, wBuffer1
|
||||
ld bc, 7
|
||||
ld hl, wFieldMoveData
|
||||
ld bc, wFieldMoveDataEnd - wFieldMoveData
|
||||
call ByteFill
|
||||
ret
|
||||
|
||||
FieldMoveJumptable:
|
||||
ld a, [wBuffer1]
|
||||
ld a, [wFieldMoveJumptableIndex]
|
||||
rst JumpTable
|
||||
ld [wBuffer1], a
|
||||
ld [wFieldMoveJumptableIndex], a
|
||||
bit 7, a
|
||||
jr nz, .okay
|
||||
and a
|
||||
@ -183,17 +183,15 @@ CheckMapForSomethingToCut:
|
||||
call CheckOverworldTileArrays
|
||||
pop hl
|
||||
jr nc, .fail
|
||||
; Back up the wOverworldMapBlocks address to wBuffer3
|
||||
; Save the Cut field move data
|
||||
ld a, l
|
||||
ld [wBuffer3], a
|
||||
ld [wCutWhirlpoolOverworldBlockAddr], a
|
||||
ld a, h
|
||||
ld [wBuffer4], a
|
||||
; Back up the replacement tile to wBuffer5
|
||||
ld [wCutWhirlpoolOverworldBlockAddr + 1], a
|
||||
ld a, b
|
||||
ld [wBuffer5], a
|
||||
; Back up the animation index to wBuffer6
|
||||
ld [wCutWhirlpoolReplacementBlock], a
|
||||
ld a, c
|
||||
ld [wBuffer6], a
|
||||
ld [wCutWhirlpoolAnimationType], a
|
||||
xor a
|
||||
ret
|
||||
|
||||
@ -214,18 +212,18 @@ Script_Cut:
|
||||
end
|
||||
|
||||
CutDownTreeOrGrass:
|
||||
ld hl, wBuffer3 ; OverworldMapTile
|
||||
ld hl, wCutWhirlpoolOverworldBlockAddr
|
||||
ld a, [hli]
|
||||
ld h, [hl]
|
||||
ld l, a
|
||||
ld a, [wBuffer5] ; ReplacementTile
|
||||
ld a, [wCutWhirlpoolReplacementBlock]
|
||||
ld [hl], a
|
||||
xor a
|
||||
ldh [hBGMapMode], a
|
||||
call OverworldTextModeSwitch
|
||||
call UpdateSprites
|
||||
call DelayFrame
|
||||
ld a, [wBuffer6] ; Animation type
|
||||
ld a, [wCutWhirlpoolAnimationType]
|
||||
ld e, a
|
||||
farcall OWCutAnimation
|
||||
call BufferScreen
|
||||
@ -380,7 +378,7 @@ SurfFunction:
|
||||
|
||||
.DoSurf:
|
||||
call GetSurfType
|
||||
ld [wBuffer2], a
|
||||
ld [wSurfingPlayerState], a
|
||||
call GetPartyNick
|
||||
ld hl, SurfFromMenuScript
|
||||
call QueueScript
|
||||
@ -409,7 +407,7 @@ UsedSurfScript:
|
||||
|
||||
callasm .stubbed_fn
|
||||
|
||||
readmem wBuffer2
|
||||
readmem wSurfingPlayerState
|
||||
writevar VAR_MOVEMENT
|
||||
|
||||
special UpdatePlayerSprite
|
||||
@ -517,7 +515,7 @@ TrySurfOW::
|
||||
jr nz, .quit
|
||||
|
||||
call GetSurfType
|
||||
ld [wBuffer2], a
|
||||
ld [wSurfingPlayerState], a
|
||||
call GetPartyNick
|
||||
|
||||
ld a, BANK(AskSurfScript)
|
||||
@ -757,7 +755,7 @@ DigFunction:
|
||||
ld a, $2
|
||||
|
||||
EscapeRopeOrDig:
|
||||
ld [wBuffer2], a
|
||||
ld [wEscapeRopeOrDigType], a
|
||||
.loop
|
||||
ld hl, .DigTable
|
||||
call FieldMoveJumptable
|
||||
@ -801,7 +799,7 @@ EscapeRopeOrDig:
|
||||
ld bc, 3
|
||||
call CopyBytes
|
||||
call GetPartyNick
|
||||
ld a, [wBuffer2]
|
||||
ld a, [wEscapeRopeOrDigType]
|
||||
cp $2
|
||||
jr nz, .escaperope
|
||||
ld hl, .UsedDigScript
|
||||
@ -817,7 +815,7 @@ EscapeRopeOrDig:
|
||||
ret
|
||||
|
||||
.FailDig:
|
||||
ld a, [wBuffer2]
|
||||
ld a, [wEscapeRopeOrDigType]
|
||||
cp $2
|
||||
jr nz, .failescaperope
|
||||
ld hl, .CantUseDigText
|
||||
@ -1000,7 +998,7 @@ SetStrengthFlag:
|
||||
ld hl, wPartySpecies
|
||||
add hl, de
|
||||
ld a, [hl]
|
||||
ld [wBuffer6], a
|
||||
ld [wStrengthSpecies], a
|
||||
call GetPartyNick
|
||||
ret
|
||||
|
||||
@ -1011,8 +1009,8 @@ Script_StrengthFromMenu:
|
||||
Script_UsedStrength:
|
||||
callasm SetStrengthFlag
|
||||
writetext .UseStrengthText
|
||||
readmem wBuffer6
|
||||
cry 0
|
||||
readmem wStrengthSpecies
|
||||
cry 0 ; plays [wStrengthSpecies] cry
|
||||
pause 3
|
||||
writetext .MoveBoulderText
|
||||
closetext
|
||||
@ -1147,14 +1145,15 @@ TryWhirlpoolMenu:
|
||||
call CheckOverworldTileArrays
|
||||
pop hl
|
||||
jr nc, .failed
|
||||
; Save the Whirlpool field move data
|
||||
ld a, l
|
||||
ld [wBuffer3], a
|
||||
ld [wCutWhirlpoolOverworldBlockAddr], a
|
||||
ld a, h
|
||||
ld [wBuffer4], a
|
||||
ld [wCutWhirlpoolOverworldBlockAddr + 1], a
|
||||
ld a, b
|
||||
ld [wBuffer5], a
|
||||
ld [wCutWhirlpoolReplacementBlock], a
|
||||
ld a, c
|
||||
ld [wBuffer6], a
|
||||
ld [wCutWhirlpoolAnimationType], a
|
||||
xor a
|
||||
ret
|
||||
|
||||
@ -1175,16 +1174,16 @@ Script_UsedWhirlpool:
|
||||
end
|
||||
|
||||
DisappearWhirlpool:
|
||||
ld hl, wBuffer3
|
||||
ld hl, wCutWhirlpoolOverworldBlockAddr
|
||||
ld a, [hli]
|
||||
ld h, [hl]
|
||||
ld l, a
|
||||
ld a, [wBuffer5]
|
||||
ld a, [wCutWhirlpoolReplacementBlock]
|
||||
ld [hl], a
|
||||
xor a
|
||||
ldh [hBGMapMode], a
|
||||
call OverworldTextModeSwitch
|
||||
ld a, [wBuffer6]
|
||||
ld a, [wCutWhirlpoolAnimationType]
|
||||
ld e, a
|
||||
farcall PlayWhirlpoolSound
|
||||
call BufferScreen
|
||||
@ -1429,7 +1428,7 @@ FishFunction:
|
||||
push af
|
||||
call FieldMoveJumptableReset
|
||||
pop af
|
||||
ld [wBuffer2], a
|
||||
ld [wFishingRodUsed], a
|
||||
.loop
|
||||
ld hl, .FishTable
|
||||
call FieldMoveJumptable
|
||||
@ -1468,7 +1467,7 @@ FishFunction:
|
||||
|
||||
.goodtofish
|
||||
ld d, a
|
||||
ld a, [wBuffer2]
|
||||
ld a, [wFishingRodUsed]
|
||||
ld e, a
|
||||
farcall Fish
|
||||
ld a, d
|
||||
@ -1492,7 +1491,7 @@ FishFunction:
|
||||
|
||||
.FishGotSomething:
|
||||
ld a, $1
|
||||
ld [wBuffer6], a
|
||||
ld [wFishingResult], a
|
||||
ld hl, Script_GotABite
|
||||
call QueueScript
|
||||
ld a, $81
|
||||
@ -1500,7 +1499,7 @@ FishFunction:
|
||||
|
||||
.FishNoBite:
|
||||
ld a, $2
|
||||
ld [wBuffer6], a
|
||||
ld [wFishingResult], a
|
||||
ld hl, Script_NotEvenANibble
|
||||
call QueueScript
|
||||
ld a, $81
|
||||
@ -1508,7 +1507,7 @@ FishFunction:
|
||||
|
||||
.FishNoFish:
|
||||
ld a, $0
|
||||
ld [wBuffer6], a
|
||||
ld [wFishingResult], a
|
||||
ld hl, Script_NotEvenANibble2
|
||||
call QueueScript
|
||||
ld a, $81
|
||||
|
@ -360,7 +360,7 @@ PokeBallEffect:
|
||||
|
||||
.skip_hp_calc
|
||||
ld b, a
|
||||
ld [wBuffer1], a
|
||||
ld [wFinalCatchRate], a
|
||||
call Random
|
||||
|
||||
cp b
|
||||
@ -390,28 +390,28 @@ PokeBallEffect:
|
||||
ld [wFXAnimID + 1], a
|
||||
xor a
|
||||
ldh [hBattleTurn], a
|
||||
ld [wBuffer2], a
|
||||
ld [wThrownBallWobbleCount], a
|
||||
ld [wNumHits], a
|
||||
predef PlayBattleAnim
|
||||
|
||||
ld a, [wWildMon]
|
||||
and a
|
||||
jr nz, .caught
|
||||
ld a, [wBuffer2]
|
||||
cp $1
|
||||
ld a, [wThrownBallWobbleCount]
|
||||
cp 1
|
||||
ld hl, BallBrokeFreeText
|
||||
jp z, .shake_and_break_free
|
||||
cp $2
|
||||
cp 2
|
||||
ld hl, BallAppearedCaughtText
|
||||
jp z, .shake_and_break_free
|
||||
cp $3
|
||||
cp 3
|
||||
ld hl, BallAlmostHadItText
|
||||
jp z, .shake_and_break_free
|
||||
cp $4
|
||||
cp 4
|
||||
ld hl, BallSoCloseText
|
||||
jp z, .shake_and_break_free
|
||||
.caught
|
||||
|
||||
.caught
|
||||
ld hl, wEnemyMonStatus
|
||||
ld a, [hli]
|
||||
push af
|
||||
@ -2723,12 +2723,12 @@ ApplyPPUp:
|
||||
ld a, MON_MOVES
|
||||
call GetPartyParamLocation
|
||||
push hl
|
||||
ld de, wBuffer1
|
||||
ld de, wPPUpPPBuffer
|
||||
predef FillPP
|
||||
pop hl
|
||||
ld bc, MON_PP - MON_MOVES
|
||||
add hl, bc
|
||||
ld de, wBuffer1
|
||||
ld de, wPPUpPPBuffer
|
||||
ld b, 0
|
||||
.loop
|
||||
inc b
|
||||
|
38
wram.asm
38
wram.asm
@ -2248,13 +2248,23 @@ wCurHPAnimLowHP:: db
|
||||
wCurHPAnimHighHP:: db
|
||||
|
||||
NEXTU
|
||||
; battle AI
|
||||
; move AI
|
||||
wEnemyAIMoveScores:: ds NUM_MOVES
|
||||
|
||||
NEXTU
|
||||
; switch AI
|
||||
wEnemyEffectivenessVsPlayerMons:: flag_array PARTY_LENGTH
|
||||
wPlayerEffectivenessVsEnemyMons:: flag_array PARTY_LENGTH
|
||||
|
||||
NEXTU
|
||||
; battle HUD
|
||||
wBattleHUDTiles:: ds PARTY_LENGTH
|
||||
|
||||
NEXTU
|
||||
; thrown ball data
|
||||
wFinalCatchRate:: db
|
||||
wThrownBallWobbleCount:: db
|
||||
|
||||
NEXTU
|
||||
; evolution data
|
||||
wEvolutionOldSpecies:: db
|
||||
@ -2266,6 +2276,10 @@ NEXTU
|
||||
; experience
|
||||
wExpToNextLevel:: ds 3
|
||||
|
||||
NEXTU
|
||||
; PP Up
|
||||
wPPUpPPBuffer:: ds NUM_MOVES
|
||||
|
||||
NEXTU
|
||||
; lucky number show
|
||||
wMonIDDigitsBuffer:: ds 5
|
||||
@ -2275,6 +2289,28 @@ NEXTU
|
||||
wMonSubmenuCount:: db
|
||||
wMonSubmenuItems:: ds NUM_MONMENU_ITEMS + 1
|
||||
|
||||
NEXTU
|
||||
; field move data
|
||||
wFieldMoveData::
|
||||
wFieldMoveJumptableIndex:: db
|
||||
wEscapeRopeOrDigType::
|
||||
wSurfingPlayerState::
|
||||
wFishingRodUsed:: db
|
||||
wCutWhirlpoolOverworldBlockAddr:: dw
|
||||
wCutWhirlpoolReplacementBlock:: db
|
||||
wCutWhirlpoolAnimationType::
|
||||
wStrengthSpecies::
|
||||
wFishingResult:: db
|
||||
ds 1
|
||||
wFieldMoveDataEnd::
|
||||
|
||||
NEXTU
|
||||
; hidden items
|
||||
wCurMapScriptBank:: db
|
||||
wRemainingBGEventCount:: db
|
||||
wBottomRightYCoord:: db
|
||||
wBottomRightXCoord:: db
|
||||
|
||||
NEXTU
|
||||
; heal machine anim
|
||||
wHealMachineAnimType:: db
|
||||
|
Loading…
Reference in New Issue
Block a user