more naming variables

This commit is contained in:
YamaArashi 2015-07-24 20:27:59 -07:00
parent 12db77201f
commit 7f6d0d49b6
57 changed files with 374 additions and 294 deletions

View file

@ -225,7 +225,7 @@ StartBattle: ; 3c11e (f:411e)
ld [wPartyFoughtCurrentEnemyFlags], a
ld [wActionResultOrTookBattleTurn], a
inc a
ld [wd11d], a
ld [wFirstMonsNotOutYet], a
ld hl, wEnemyMon1HP
ld bc, wEnemyMon2 - wEnemyMon1 - 1
ld d, $3
@ -379,7 +379,7 @@ MainInBattleLoop: ; 3c233 (f:4233)
jp z, HandleEnemyMonFainted ; if enemy mon HP is 0, jump
call SaveScreenTilesToBuffer1
xor a
ld [wd11d], a
ld [wFirstMonsNotOutYet], a
ld a, [W_PLAYERBATTSTATUS2]
and (1 << NeedsToRecharge) | (1 << UsingRage) ; check if the player is using Rage or needs to recharge
jr nz, .selectEnemyMove
@ -1434,7 +1434,7 @@ EnemySendOutFirstMon: ; 3c92a (f:492a)
ld [wLastSwitchInEnemyMonHP + 1],a
ld a,1
ld [wCurrentMenuItem],a
ld a,[wd11d]
ld a,[wFirstMonsNotOutYet]
dec a
jr z,.next4
ld a,[wPartyCount]
@ -1549,7 +1549,7 @@ HasMonFainted: ; 3ca97 (f:4a97)
ld a, [hli]
or [hl]
ret nz
ld a, [wd11d]
ld a, [wFirstMonsNotOutYet]
and a
jr nz, .done
ld hl, NoWillText
@ -1647,8 +1647,8 @@ TryRunningFromBattle: ; 3cab9 (f:4ab9)
ld hl, NoRunningText
.printCantEscapeOrNoRunningText
call PrintText
ld a, $1
ld [wd11f], a
ld a, 1
ld [wForcePlayerToChooseMon], a
call SaveScreenTilesToBuffer1
and a ; reset carry
ret
@ -2334,7 +2334,7 @@ UseBagItem:
res UsingTrappingMove, [hl] ; not using multi-turn move any more
.checkIfMonCaptured
ld a, [wd11c]
ld a, [wCapturedMonSpecies]
and a ; was the enemy mon captured with a ball?
jr nz, .returnAfterCapturingMon
@ -2354,7 +2354,7 @@ UseBagItem:
.returnAfterCapturingMon
call GBPalNormal
xor a
ld [wd11c], a
ld [wCapturedMonSpecies], a
ld a, $2
ld [wBattleResult], a
scf ; set carry
@ -2516,8 +2516,8 @@ BattleMenu_RunWasSelected: ; 3d1fa (f:51fa)
ld hl, wBattleMonSpeed
ld de, wEnemyMonSpeed
call TryRunningFromBattle
ld a, $0
ld [wd11f], a
ld a, 0
ld [wForcePlayerToChooseMon], a
ret c
ld a, [wActionResultOrTookBattleTurn]
and a
@ -3035,18 +3035,18 @@ SelectEnemyMove: ; 3d564 (f:5564)
push hl
call BattleRandom
ld b, $1
cp $3f ; select move 1 in [0,3e] (63/256 chance)
cp $3f ; select move 1, [0,3e] (63/256 chance)
jr c, .moveChosen
inc hl
inc b
cp $7f ; select move 1 in [3f,7e] (64/256 chance)
cp $7f ; select move 2, [3f,7e] (64/256 chance)
jr c, .moveChosen
inc hl
inc b
cp $be ; select move 1 in [7f,bd] (63/256 chance)
cp $be ; select move 3, [7f,bd] (63/256 chance)
jr c, .moveChosen
inc hl
inc b ; select move 4 in [be,ff] (66/256 chance)
inc b ; select move 4, [be,ff] (66/256 chance)
.moveChosen
ld a, b
dec a

View file

@ -51,7 +51,7 @@ EndOfBattle: ; 137aa (4:77aa)
ld [W_BATTLETYPE], a
ld [W_MOVEMISSED], a
ld [W_CUROPPONENT], a
ld [wd11f], a
ld [wForcePlayerToChooseMon], a
ld [wNumRunAttempts], a
ld [wEscapedFromBattle], a
ld hl, wPartyAndBillsPCSavedMenuItem

View file

@ -154,7 +154,7 @@ ReadTrainer: ; 39c53 (e:5c53)
ld b,a
.LastLoop
; update wAmountMoneyWon addresses (money to win) based on enemy's level
ld hl,wd047
ld hl,wTrainerBaseMoney + 1
ld c,2 ; wAmountMoneyWon is a 3-byte number
push bc
predef AddBCDPredef

View file

@ -2,7 +2,7 @@
; unused slots are filled with 0, all used slots may be chosen with equal probability
AIEnemyTrainerChooseMoves: ; 39719 (e:5719)
ld a, $a
ld hl, wHPBarMaxHP ; init temporary move selection array. Only the moves with the lowest numbers are chosen in the end
ld hl, wBuffer ; init temporary move selection array. Only the moves with the lowest numbers are chosen in the end
ld [hli], a ; move 1
ld [hli], a ; move 2
ld [hli], a ; move 3
@ -11,14 +11,14 @@ AIEnemyTrainerChooseMoves: ; 39719 (e:5719)
swap a
and $f
jr z, .noMoveDisabled
ld hl, wHPBarMaxHP
ld hl, wBuffer
dec a
ld c, a
ld b, $0
add hl, bc ; advance pointer to forbidden move
ld [hl], $50 ; forbid (highly discourage) disabled move
.noMoveDisabled
ld hl, TrainerClassMoveChoiceModifications ; 589B
ld hl, TrainerClassMoveChoiceModifications
ld a, [W_TRAINERCLASS]
ld b, a
.loopTrainerClasses
@ -44,7 +44,7 @@ AIEnemyTrainerChooseMoves: ; 39719 (e:5719)
dec a
add a
ld c, a
ld b, $0
ld b, 0
add hl, bc ; skip to pointer
ld a, [hli] ; read pointer into hl
ld h, [hl]
@ -53,9 +53,9 @@ AIEnemyTrainerChooseMoves: ; 39719 (e:5719)
push de
jp [hl] ; execute modification function
.loopFindMinimumEntries ; all entries will be decremented sequentially until one of them is zero
ld hl, wHPBarMaxHP ; temp move selection array
ld hl, wBuffer ; temp move selection array
ld de, wEnemyMonMoves ; enemy moves
ld c, $4
ld c, NUM_MOVES
.loopDecrementEntries
ld a, [de]
inc de
@ -73,11 +73,11 @@ AIEnemyTrainerChooseMoves: ; 39719 (e:5719)
inc [hl]
dec hl
inc a
cp $5
cp NUM_MOVES + 1
jr nz, .loopUndoPartialIteration
ld hl, wHPBarMaxHP ; temp move selection array
ld hl, wBuffer ; temp move selection array
ld de, wEnemyMonMoves ; enemy moves
ld c, $4
ld c, NUM_MOVES
.filterMinimalEntries ; all minimal entries now have value 1. All other slots will be disabled (move set to 0)
ld a, [de]
and a
@ -97,7 +97,7 @@ AIEnemyTrainerChooseMoves: ; 39719 (e:5719)
inc de
dec c
jr nz, .filterMinimalEntries
ld hl, wHPBarMaxHP ; use created temporary array as move set
ld hl, wBuffer ; use created temporary array as move set
ret
.useOriginalMoveSet
ld hl, wEnemyMonMoves ; use original move set
@ -694,11 +694,13 @@ SwitchEnemyMon: ; 3a74b (e:674b)
ld hl, AIBattleWithdrawText
call PrintText
; This wFirstMonsNotOutYet variable is abused to prevent the player from
; switching in a new mon in response to this switch.
ld a,1
ld [wd11d],a
ld [wFirstMonsNotOutYet],a
callab EnemySendOut
xor a
ld [wd11d],a
ld [wFirstMonsNotOutYet],a
ld a,[wLinkState]
cp LINK_STATE_BATTLING

View file

@ -14,7 +14,7 @@ EvolutionAfterBattle: ; 3ad1c (e:6d1c)
ld a, [hTilesetType]
push af
xor a
ld [wd121], a
ld [wEvolutionOccurred], a
dec a
ld [wWhichPokemon], a
push hl
@ -91,7 +91,7 @@ Evolution_PartyMonLoop: ; loop over party mons
ld a, [wLoadedMonLevel]
cp b ; is the mon's level greater than the evolution requirement?
jp c, Evolution_PartyMonLoop ; if so, go the next mon
jr .asm_3adb6
jr .doEvolution
.checkItemEvo
ld a, [hli]
ld b, a ; evolution item
@ -104,10 +104,10 @@ Evolution_PartyMonLoop: ; loop over party mons
ld a, [wLoadedMonLevel]
cp b ; is the mon's level greater than the evolution requirement?
jp c, .nextEvoEntry2 ; if so, go the next evolution entry
.asm_3adb6
.doEvolution
ld [W_CURENEMYLVL], a
ld a, $1
ld [wd121], a
ld a, 1
ld [wEvolutionOccurred], a
push hl
ld a, [hl]
ld [wEvoNewSpecies], a
@ -252,7 +252,7 @@ Evolution_PartyMonLoop: ; loop over party mons
ld a, [W_ISINBATTLE]
and a
ret nz
ld a, [wd121]
ld a, [wEvolutionOccurred]
and a
call nz, PlayDefaultMusic
ret

View file

@ -311,7 +311,7 @@ VermilionGymTrashText: ; 5ddf7 (17:5df7)
GymTrashScript: ; 5ddfc (17:5dfc)
call EnableAutoTextBoxDrawing
ld a, [wHiddenObjectFunctionArgument]
ld [wcd5b], a
ld [wGymTrashCanIndex], a
; Don't do the trash can puzzle if it's already been done.
CheckEvent EVENT_2ND_LOCK_OPENED
@ -320,12 +320,12 @@ GymTrashScript: ; 5ddfc (17:5dfc)
tx_pre_jump VermilionGymTrashText
.ok
bit 1, a
CheckEventReuseA EVENT_1ST_LOCK_OPENED
jr nz, .trySecondLock
ld a, [wd743]
ld a, [wFirstLockTrashCanIndex]
ld b, a
ld a, [wcd5b]
ld a, [wGymTrashCanIndex]
cp b
jr z, .openFirstLock
@ -337,7 +337,7 @@ GymTrashScript: ; 5ddfc (17:5dfc)
SetEvent EVENT_1ST_LOCK_OPENED
ld hl, GymTrashCans
ld a, [wcd5b]
ld a, [wGymTrashCanIndex]
; * 5
ld b, a
add a
@ -364,15 +364,15 @@ GymTrashScript: ; 5ddfc (17:5dfc)
add hl, de
ld a, [hl]
and $f
ld [wd744], a
ld [wSecondLockTrashCanIndex], a
tx_pre_id VermilionGymTrashSuccesText1
jr .done
.trySecondLock
ld a, [wd744]
ld a, [wSecondLockTrashCanIndex]
ld b, a
ld a, [wcd5b]
ld a, [wGymTrashCanIndex]
cp b
jr z, .openSecondLock
@ -381,7 +381,7 @@ GymTrashScript: ; 5ddfc (17:5dfc)
call Random
and $e
ld [wd743], a
ld [wFirstLockTrashCanIndex], a
tx_pre_id VermilionGymTrashFailText
jr .done

View file

@ -205,20 +205,21 @@ UpdateHPBar_PrintHPNumber: ; faf5 (3:7af5)
push de
ld a, [wHPBarType]
and a
jr z, .asm_fb2d
jr z, .done ; don't print number in enemy HUD
; convert from little-endian to big-endian for PrintNumber
ld a, [wHPBarOldHP]
ld [wcef1], a
ld a, [wHPBarOldHP+1]
ld [wcef0], a
ld [wHPBarTempHP + 1], a
ld a, [wHPBarOldHP + 1]
ld [wHPBarTempHP], a
push hl
ld a, [hFlags_0xFFF6]
bit 0, a
jr z, .asm_fb15
ld de, $9
jr .asm_fb18
jr .next
.asm_fb15
ld de, $15
.asm_fb18
.next
add hl, de
push hl
ld a, $7f
@ -226,12 +227,12 @@ UpdateHPBar_PrintHPNumber: ; faf5 (3:7af5)
ld [hli], a
ld [hli], a
pop hl
ld de, wcef0
ld de, wHPBarTempHP
ld bc, $203
call PrintNumber
call DelayFrame
pop hl
.asm_fb2d
.done
pop de
pop af
ret

View file

@ -118,7 +118,7 @@ ItemUseBall: ; d687 (3:5687)
.UseBall
;ok, you can use a ball
xor a
ld [wd11c],a
ld [wCapturedMonSpecies],a
ld a,[W_BATTLETYPE]
cp a,2 ;SafariBattle
jr nz,.skipSafariZoneCode
@ -388,7 +388,7 @@ ItemUseBall: ; d687 (3:5687)
pop af
ld [hl],a
ld a,[wEnemyMonSpecies] ;enemy
ld [wd11c],a
ld [wCapturedMonSpecies],a
ld [wcf91],a
ld [wd11e],a
ld a,[W_BATTLETYPE]
@ -645,7 +645,7 @@ ItemUseEvoStone: ; da5b (3:5a5b)
call PlaySoundWaitForCurrent
call WaitForSoundToFinish
callab TryEvolvingMon ; try to evolve pokemon
ld a,[wd121]
ld a,[wEvolutionOccurred]
and a
jr z,.noEffect
pop af
@ -2537,13 +2537,13 @@ IsKeyItem_: ; e764 (3:6764)
; if the item is not an HM or TM
push af
ld hl,KeyItemBitfield
ld de,wHPBarMaxHP
ld de,wBuffer
ld bc,15 ; only 11 bytes are actually used
call CopyData
pop af
dec a
ld c,a
ld hl,wHPBarMaxHP
ld hl,wBuffer
ld b,FLAG_TEST
predef FlagActionPredef
ld a,c

View file

@ -46,10 +46,10 @@ DontAbandonLearning: ; 6e5b (1:6e5b)
ld hl, Moves
ld bc, $6
call AddNTimes
ld de, wHPBarMaxHP
ld de, wBuffer
ld a, BANK(Moves)
call FarCopyData
ld a, [wHPBarNewHP + 1]
ld a, [wBuffer + 5] ; a = move's max PP
pop de
pop hl
ld [hl], a

View file

@ -54,7 +54,7 @@ DoYouWantToNicknameText: ; 0x6557
db "@"
DisplayNameRaterScreen: ; 655c (1:655c)
ld hl, wHPBarMaxHP
ld hl, wBuffer
xor a
ld [wUpdateSpritesEnabled], a
ld a, NAME_MON_SCREEN
@ -72,7 +72,7 @@ DisplayNameRaterScreen: ; 655c (1:655c)
call AddNTimes
ld e, l
ld d, h
ld hl, wHPBarMaxHP
ld hl, wBuffer
ld bc, 11
call CopyData
and a
@ -94,24 +94,24 @@ DisplayNamingScreen: ; 6596 (1:6596)
call LoadEDTile
callba LoadMonPartySpriteGfx
coord hl, 0, 4
ld b, $9
ld c, $12
ld b, 9
ld c, 18
call TextBoxBorder
call PrintNamingText
ld a, $3
ld a, 3
ld [wTopMenuItemY], a
ld a, $1
ld a, 1
ld [wTopMenuItemX], a
ld [wLastMenuItem], a
ld [wCurrentMenuItem], a
ld a, $ff
ld [wMenuWatchedKeys], a
ld a, $7
ld a, 7
ld [wMaxMenuItem], a
ld a, $50
ld [wcf4b], a
xor a
ld hl, wHPBarMaxHP + 1
ld hl, wNamingScreenSubmitName
ld [hli], a
ld [hli], a
ld [wAnimCounter], a
@ -119,7 +119,7 @@ DisplayNamingScreen: ; 6596 (1:6596)
call PrintAlphabet
call GBPalNormal
.ABStartReturnPoint
ld a, [wHPBarMaxHP + 1]
ld a, [wNamingScreenSubmitName]
and a
jr nz, .submitNickname
call PrintNicknameAndUnderscores
@ -197,14 +197,14 @@ DisplayNamingScreen: ; 6596 (1:6596)
ld de, .selectReturnPoint
push de
.pressedSelect
ld a, [wHPBarOldHP]
ld a, [wAlphabetCase]
xor $1
ld [wHPBarOldHP], a
ld [wAlphabetCase], a
ret
.pressedStart
ld a, $1
ld [wHPBarMaxHP + 1], a
ld a, 1
ld [wNamingScreenSubmitName], a
ret
.pressedA
@ -216,7 +216,7 @@ DisplayNamingScreen: ; 6596 (1:6596)
jr z, .pressedStart
.didNotPressED
ld a, [wCurrentMenuItem]
cp $6 ; case swtich row
cp $6 ; case switch row
jr nz, .didNotPressCaseSwtich
ld a, [wTopMenuItemX]
cp $1 ; case switch column
@ -228,9 +228,9 @@ DisplayNamingScreen: ; 6596 (1:6596)
ld l, a
inc hl
ld a, [hl]
ld [wHPBarNewHP], a
ld [wNamingScreenLetter], a
call CalcStringLength
ld a, [wHPBarNewHP]
ld a, [wNamingScreenLetter]
cp $e5
ld de, Dakutens
jr z, .dakutensAndHandakutens
@ -240,11 +240,11 @@ DisplayNamingScreen: ; 6596 (1:6596)
ld a, [wNamingScreenType]
cp NAME_MON_SCREEN
jr nc, .checkMonNameLength
ld a, [wHPBarMaxHP]
ld a, [wNamingScreenNameLength]
cp $7 ; max length of player/rival names
jr .checkNameLength
.checkMonNameLength
ld a, [wHPBarMaxHP]
ld a, [wNamingScreenNameLength]
cp $a ; max length of pokemon nicknames
.checkNameLength
jr c, .addLetter
@ -257,14 +257,14 @@ DisplayNamingScreen: ; 6596 (1:6596)
ret nc
dec hl
.addLetter
ld a, [wHPBarNewHP]
ld a, [wNamingScreenLetter]
ld [hli], a
ld [hl], $50
ld a, SFX_PRESS_AB
call PlaySound
ret
.pressedB
ld a, [wHPBarMaxHP]
ld a, [wNamingScreenNameLength]
and a
ret z
call CalcStringLength
@ -335,7 +335,7 @@ ED_Tile: ; 6767 (1:6767)
PrintAlphabet: ; 676f (1:676f)
xor a
ld [H_AUTOBGTRANSFERENABLED], a
ld a, [wHPBarOldHP]
ld a, [wAlphabetCase]
and a
ld de, LowerCaseAlphabet
jr nz, .lowercase
@ -371,7 +371,7 @@ UpperCaseAlphabet: ; 67d6 (1:67d6)
PrintNicknameAndUnderscores: ; 680e (1:680e)
call CalcStringLength
ld a, c
ld [wHPBarMaxHP], a
ld [wNamingScreenNameLength], a
coord hl, 10, 2
ld bc, $10a
call ClearScreenArea
@ -394,7 +394,7 @@ PrintNicknameAndUnderscores: ; 680e (1:680e)
jr nz, .placeUnderscoreLoop
ld a, [wNamingScreenType]
cp NAME_MON_SCREEN
ld a, [wHPBarMaxHP]
ld a, [wNamingScreenNameLength]
jr nc, .pokemon2
cp 7 ; player or rival max name length
jr .playerOrRival2
@ -433,7 +433,7 @@ DakutensAndHandakutens: ; 6871 (1:6871)
ret nc
inc hl
ld a, [hl]
ld [wHPBarNewHP], a
ld [wNamingScreenLetter], a
ret
Dakutens: ; 6885 (1:6885)

View file

@ -31,7 +31,7 @@ PickUpItem:
jr nc, .BagFull
ld a, [$ffdb]
ld [wcc4d], a
ld [wMissableObjectIndex], a
predef HideObject
ld a, 1
ld [wDoNotWaitForButtonPressAfterDisplayingText], a

View file

@ -149,7 +149,7 @@ PalletMovementScript_Done: ; 1a4f4 (6:64f4)
and a
ret nz
ld a, $0
ld [wcc4d], a
ld [wMissableObjectIndex], a
predef HideObject
ld hl, wd730
res 7, [hl]

View file

@ -370,10 +370,10 @@ IsPlayerStandingOnWarpPadOrHole: ; 70787 (1c:4787)
ld b, [hl]
.done
ld a, b
ld [wcd5b], a
ld [wStandingOnWarpPadOrHole], a
ret
; format: db tileset id, tile id, value to be put in wcd5b
; format: db tileset id, tile id, value to be put in [wStandingOnWarpPadOrHole]
.warpPadAndHoleData: ; 707a9 (1c:47a9)
db FACILITY, $20, 1 ; warp pad
db FACILITY, $11, 2 ; hole

View file

@ -487,24 +487,24 @@ WriteSymmetricMonPartySpriteOAM: ; 712a6 (1c:52a6)
; the X-flip OAM bit to be used so that only 2 rather than 4 tile patterns are
; needed.
xor a
ld [wcd5c], a
ld de, $202
ld [wSymmetricSpriteOAMAttributes], a
lb de, 2, 2
.loop
push de
push bc
.innerLoop
ld a, b
ld [hli], a
ld [hli], a ; Y
ld a, c
ld [hli], a
ld [hli], a ; X
ld a, [wOAMBaseTile]
ld [hli], a
ld a, [wcd5c]
ld [hli], a
xor $20
ld [wcd5c], a
ld [hli], a ; tile
ld a, [wSymmetricSpriteOAMAttributes]
ld [hli], a ; attributes
xor (1 << OAM_X_FLIP)
ld [wSymmetricSpriteOAMAttributes], a
inc d
ld a, $8
ld a, 8
add c
ld c, a
dec e
@ -516,7 +516,7 @@ WriteSymmetricMonPartySpriteOAM: ; 712a6 (1c:52a6)
inc [hl]
inc [hl]
pop hl
ld a, $8
ld a, 8
add b
ld b, a
dec d