fix variable naming

This commit is contained in:
YamaArashi 2015-07-18 08:17:29 -07:00
parent b85d7c65f3
commit fc9af362ae
106 changed files with 773 additions and 671 deletions

View file

@ -163,7 +163,7 @@ DrawFrameBlock: ; 78000 (1e:4000)
PlayAnimation: ; 780f1 (1e:40f1)
xor a
ld [$FF8B],a
ld [$FF8B],a ; it looks like nothing reads this
ld [W_SUBANIMTRANSFORM],a
ld a,[W_ANIMATIONID] ; get animation number
dec a

View file

@ -1310,7 +1310,7 @@ SevenSpacesText: ; 3c8d7 (f:48d7)
; if a is 8, the slide is to the right, else it is to the left
; bug: when this is called, [H_AUTOBGTRANSFERENABLED] is non-zero, so there is screen tearing
SlideTrainerPicOffScreen: ; 3c8df (f:48df)
ld [$FF8B], a
ld [hSlideAmount], a
ld c, a
.slideStepLoop ; each iteration, the trainer pic is slid one tile left/right
push bc
@ -1318,10 +1318,10 @@ SlideTrainerPicOffScreen: ; 3c8df (f:48df)
ld b, 7 ; number of rows
.rowLoop
push hl
ld a, [$FF8B]
ld a, [hSlideAmount]
ld c, a
.columnLoop
ld a, [$FF8B]
ld a, [hSlideAmount]
cp 8
jr z, .slideRight
.slideLeft ; slide player sprite off screen
@ -1590,14 +1590,14 @@ TryRunningFromBattle: ; 3cab9 (f:4ab9)
ld a, [hl]
ld [H_MULTIPLICAND + 2], a
ld a, [de]
ld [$ff8d], a
ld [hEnemySpeed], a
inc de
ld a, [de]
ld [$ff8e], a
ld [hEnemySpeed + 1], a
call LoadScreenTilesFromBuffer1
ld de, H_MULTIPLICAND + 1
ld hl, $ff8d
ld c, $2
ld hl, hEnemySpeed
ld c, 2
call StringCmp
jr nc, .canEscape ; jump if player speed greater than enemy speed
xor a
@ -1609,9 +1609,9 @@ TryRunningFromBattle: ; 3cab9 (f:4ab9)
ld [H_DIVIDEND], a
ld a, [H_PRODUCT + 3]
ld [H_DIVIDEND + 1], a
ld a, [$ff8d]
ld a, [hEnemySpeed]
ld b, a
ld a, [$ff8e]
ld a, [hEnemySpeed + 1]
; divide enemy speed by 4
srl b
rr a
@ -6411,7 +6411,7 @@ LoadPlayerBackPic: ; 3ec92 (f:6c92)
predef ScaleSpriteByTwo
ld hl, wOAMBuffer
xor a
ld [$FF8B], a ; initial tile number
ld [hOAMTile], a ; initial tile number
ld b, $7 ; 7 columns
ld e, $a0 ; X for the left-most column
.loop ; each loop iteration writes 3 OAM entries in a vertical column
@ -6425,16 +6425,16 @@ LoadPlayerBackPic: ; 3ec92 (f:6c92)
add d ; increase Y by height of tile
ld d, a
inc hl
ld a, [$FF8B]
ld a, [hOAMTile]
ld [hli], a ; OAM tile number
inc a ; increment tile number
ld [$FF8B], a
ld [hOAMTile], a
inc hl
dec c
jr nz, .innerLoop
ld a, [$FF8B]
ld a, [hOAMTile]
add $4 ; increase tile number by 4
ld [$FF8B], a
ld [hOAMTile], a
ld a, $8 ; width of tile
add e ; increase X by width of tile
ld e, a

View file

@ -89,7 +89,7 @@ TryDoWildEncounter: ; 13870 (4:7870)
jr .willEncounter
.lastRepelStep
ld [wRepelRemainingSteps], a
ld a, $d2
ld a, 210
ld [H_DOWNARROWBLINKCNT2], a
call EnableAutoTextBoxDrawing
call DisplayTextID

View file

@ -556,11 +556,11 @@ ItemUseSurfboard: ; d9b4 (3:59b4)
jp PrintText
.tryToStopSurfing
xor a
ld [$ff8c],a
ld [hSpriteIndexOrTextID],a
ld d,16 ; talking range in pixels (normal range)
call IsSpriteInFrontOfPlayer2
res 7,[hl]
ld a,[$ff8c]
ld a,[hSpriteIndexOrTextID]
and a ; is there a sprite in the way?
jr nz,.cannotStopSurfing
ld hl,TilePairCollisionsWater

View file

@ -1,7 +1,6 @@
GetMachinePrice: ; 7bf86 (1e:7f86)
; Input: [wcf91] = Item Id of a TM
; Output: Stores the 2-byte TM price in [H_DOWNARROWBLINKCNT1] and [H_DOWNARROWBLINKCNT2]
; as a BCD
; Output: Stores the TM price at hItemPrice
ld a, [wcf91] ; a contains TM item id
sub TM_01
ret c
@ -17,10 +16,10 @@ GetMachinePrice: ; 7bf86 (1e:7f86)
swap a
.highNybbleIsPrice
and $f0
ld [H_DOWNARROWBLINKCNT2], a
ld [hItemPrice + 1], a
xor a
ld [H_DOWNARROWBLINKCNT1], a
ld [$ff8d], a
ld [hItemPrice], a
ld [hItemPrice + 2], a
ret
INCLUDE "data/tm_prices.asm"

View file

@ -512,25 +512,25 @@ ShowPokedexDataInternal: ; 402e2 (10:42e2)
inc de
inc de ; de = address of upper byte of weight
push de
; put weight in big-endian order at $ff8b
ld hl,$ff8b
ld a,[hl] ; save existing value of [$ff8b]
; put weight in big-endian order at hDexWeight
ld hl,hDexWeight
ld a,[hl] ; save existing value of [hDexWeight]
push af
ld a,[de] ; a = upper byte of weight
ld [hli],a ; store upper byte of weight in [$ff8b]
ld a,[hl] ; save existing value of [$ff8c]
ld [hli],a ; store upper byte of weight in [hDexWeight]
ld a,[hl] ; save existing value of [hDexWeight + 1]
push af
dec de
ld a,[de] ; a = lower byte of weight
ld [hl],a ; store lower byte of weight in [$ff8c]
ld de,$ff8b
ld [hl],a ; store lower byte of weight in [hDexWeight + 1]
ld de,hDexWeight
hlCoord 11, 8
ld bc,$0205 ; no leading zeroes, right-aligned, 2 bytes, 5 digits
call PrintNumber ; print weight
hlCoord 14, 8
ld a,[$ff8c]
ld a,[hDexWeight + 1]
sub a,10
ld a,[$ff8b]
ld a,[hDexWeight]
sbc a,0
jr nc,.next
ld [hl],"0" ; if the weight is less than 10, put a 0 before the decimal point
@ -540,9 +540,9 @@ ShowPokedexDataInternal: ; 402e2 (10:42e2)
ld [hld],a ; make space for the decimal point by moving the last digit forward one tile
ld [hl],$f2 ; decimal point tile
pop af
ld [$ff8c],a ; restore original value of [$ff8c]
ld [hDexWeight + 1],a ; restore original value of [hDexWeight + 1]
pop af
ld [$ff8b],a ; restore original value of [$ff8b]
ld [hDexWeight],a ; restore original value of [hDexWeight]
pop hl
inc hl ; hl = address of pokedex description text
bcCoord 1, 11

View file

@ -58,13 +58,13 @@ WhichPrizeTextPtr: ; 52789 (14:6789)
GetPrizeMenuId: ; 5278e (14:678e)
; determine which one among the three
; prize-texts has been selected
; using the text ID (stored in [$FF8C])
; using the text ID (stored in [hSpriteIndexOrTextID])
; load the three prizes at wd13d-wd13f
; load the three prices at wd141-wd146
; display the three prizes' names
; (distinguishing between Pokemon names
; and Items (specifically TMs) names)
ld a,[$FF8C]
ld a,[hSpriteIndexOrTextID]
sub a,$03 ; prize-texts' id are 3, 4 and 5
ld [wd12f],a ; prize-texts' id (relative, i.e. 0, 1 or 2)
add a

View file

@ -524,7 +524,7 @@ StartMenu_TrainerInfo: ; 13460 (4:7460)
DrawTrainerInfo: ; 1349a (4:749a)
ld de,RedPicFront
ld bc,(BANK(RedPicFront) << 8) | $01
predef Predef3B
predef DisplayPicCenteredOrUpperRight
call DisableLCD
hlCoord 0, 2
ld a," "

View file

@ -34,9 +34,9 @@ SetDefaultNames: ; 60ca (1:60ca)
OakSpeech: ; 6115 (1:6115)
ld a,$FF
call PlaySound ; stop music
ld a, BANK(Music_Routes2) ; bank of song
ld a, BANK(Music_Routes2)
ld c,a
ld a, MUSIC_ROUTES2 ; song #
ld a, MUSIC_ROUTES2
call PlayMusic
call ClearScreen
call LoadTextBoxTilePatterns
@ -54,50 +54,49 @@ OakSpeech: ; 6115 (1:6115)
xor a
ld [hTilesetType],a
ld a,[wd732]
bit 1,a ; XXX when is bit 1 set?
jp nz,Func_61bc ; easter egg: skip the intro
bit 1,a ; possibly a debug mode bit
jp nz,.skipChoosingNames
ld de,ProfOakPic
ld bc, (Bank(ProfOakPic) << 8) | $00
call IntroPredef3B ; displays Oak pic?
call IntroDisplayPicCenteredOrUpperRight
call FadeInIntroPic
ld hl,OakSpeechText1
call PrintText ; prints text box
call PrintText
call GBFadeOutToWhite
call ClearScreen
ld a,NIDORINO
ld [wd0b5],a ; pic displayed is stored at this location
ld [wd0b5],a
ld [wcf91],a
call GetMonHeader ; this is also related to the pic
hlCoord 6, 4 ; position on tilemap the pic is displayed
call LoadFlippedFrontSpriteByMonIndex ; displays pic?
call GetMonHeader
hlCoord 6, 4
call LoadFlippedFrontSpriteByMonIndex
call MovePicLeft
ld hl,OakSpeechText2
call PrintText ; Prints text box
call PrintText
call GBFadeOutToWhite
call ClearScreen
ld de,RedPicFront
ld bc,(Bank(RedPicFront) << 8) | $00
call IntroPredef3B ; displays player pic?
call IntroDisplayPicCenteredOrUpperRight
call MovePicLeft
ld hl,IntroducePlayerText
call PrintText
call LoadDefaultNamesPlayer ; brings up NewName/Red/etc menu
call ChoosePlayerName
call GBFadeOutToWhite
call ClearScreen
ld de,Rival1Pic
ld bc,(Bank(Rival1Pic) << 8) | $00
call IntroPredef3B ; displays rival pic
call IntroDisplayPicCenteredOrUpperRight
call FadeInIntroPic
ld hl,IntroduceRivalText
call PrintText
call LoadDefaultNamesRival
Func_61bc: ; 61bc (1:61bc)
call ChooseRivalName
.skipChoosingNames
call GBFadeOutToWhite
call ClearScreen
ld de,RedPicFront
ld bc,(Bank(RedPicFront) << 8) | $00
call IntroPredef3B
call IntroDisplayPicCenteredOrUpperRight
call GBFadeInFromWhite
ld a,[wd72d]
and a
@ -120,12 +119,12 @@ Func_61bc: ; 61bc (1:61bc)
call CopyVideoData
ld de,ShrinkPic1
ld bc,(BANK(ShrinkPic1) << 8) | $00
call IntroPredef3B
call IntroDisplayPicCenteredOrUpperRight
ld c,4
call DelayFrames
ld de,ShrinkPic2
ld bc,(BANK(ShrinkPic2) << 8) | $00
call IntroPredef3B
call IntroDisplayPicCenteredOrUpperRight
call ResetPlayerSpriteData
ld a,[H_LOADEDROMBANK]
push af
@ -207,10 +206,12 @@ MovePicLeft: ; 6288 (1:6288)
ld [rWX],a
jr .next
Predef3B: ; 62a1 (1:62a1)
DisplayPicCenteredOrUpperRight: ; 62a1 (1:62a1)
call GetPredefRegisters
IntroPredef3B: ; 62a4 (1:62a4)
; bank of sprite given in b
IntroDisplayPicCenteredOrUpperRight: ; 62a4 (1:62a4)
; b = bank
; de = address of compressed pic
; c: 0 = centred, non-zero = upper-right
push bc
ld a,b
call UncompressSpriteFromDE

View file

@ -1,29 +1,29 @@
LoadDefaultNamesPlayer: ; 695d (1:695d)
call Func_6a12
ChoosePlayerName: ; 695d (1:695d)
call OakSpeechSlidePicRight
ld de, DefaultNamesPlayer
call DisplayIntroNameTextBox
ld a, [wCurrentMenuItem]
and a
jr z, .asm_697a
jr z, .customName
ld hl, DefaultNamesPlayerList
call Func_6ad6
call GetDefaultName
ld de, wPlayerName
call Func_69ec
jr .asm_6999
.asm_697a
call OakSpeechSlidePicLeft
jr .done
.customName
ld hl, wPlayerName
xor a ; NAME_PLAYER_SCREEN
ld [wNamingScreenType], a
call DisplayNamingScreen
ld a, [wcf4b]
cp $50
jr z, .asm_697a
cp "@"
jr z, .customName
call ClearScreen
call Delay3
ld de, RedPicFront
ld b, BANK(RedPicFront)
call IntroPredef3B
.asm_6999
call IntroDisplayPicCenteredOrUpperRight
.done
ld hl, YourNameIsText
jp PrintText
@ -31,32 +31,32 @@ YourNameIsText: ; 699f (1:699f)
TX_FAR _YourNameIsText
db "@"
LoadDefaultNamesRival: ; 69a4 (1:69a4)
call Func_6a12
ChooseRivalName: ; 69a4 (1:69a4)
call OakSpeechSlidePicRight
ld de, DefaultNamesRival
call DisplayIntroNameTextBox
ld a, [wCurrentMenuItem]
and a
jr z, .asm_69c1
jr z, .customName
ld hl, DefaultNamesRivalList
call Func_6ad6
call GetDefaultName
ld de, W_RIVALNAME
call Func_69ec
jr .asm_69e1
.asm_69c1
call OakSpeechSlidePicLeft
jr .done
.customName
ld hl, W_RIVALNAME
ld a, NAME_RIVAL_SCREEN
ld [wNamingScreenType], a
call DisplayNamingScreen
ld a, [wcf4b]
cp $50
jr z, .asm_69c1
cp "@"
jr z, .customName
call ClearScreen
call Delay3
ld de, Rival1Pic
ld b, $13
call IntroPredef3B
.asm_69e1
call IntroDisplayPicCenteredOrUpperRight
.done
ld hl, HisNameIsText
jp PrintText
@ -64,11 +64,11 @@ HisNameIsText: ; 69e7 (1:69e7)
TX_FAR _HisNameIsText
db "@"
Func_69ec: ; 69ec (1:69ec)
OakSpeechSlidePicLeft: ; 69ec (1:69ec)
push de
hlCoord 0, 0
ld bc, $c0b
call ClearScreenArea
lb bc, 12, 11
call ClearScreenArea ; clear the name list text box
ld c, 10
call DelayFrames
pop de
@ -77,77 +77,83 @@ Func_69ec: ; 69ec (1:69ec)
call CopyData
call Delay3
hlCoord 12, 4
ld de, $67d
lb de, 6, 6 * SCREEN_WIDTH + 5
ld a, $ff
jr asm_6a19
jr OakSpeechSlidePicCommon
Func_6a12: ; 6a12 (1:6a12)
OakSpeechSlidePicRight: ; 6a12 (1:6a12)
hlCoord 5, 4
ld de, $67d
lb de, 6, 6 * SCREEN_WIDTH + 5
xor a
asm_6a19: ; 6a19 (1:6a19)
OakSpeechSlidePicCommon: ; 6a19 (1:6a19)
push hl
push de
push bc
ld [$ff8d], a
ld [hSlideDirection], a
ld a, d
ld [H_DOWNARROWBLINKCNT1], a
ld [hSlideAmount], a
ld a, e
ld [H_DOWNARROWBLINKCNT2], a
ld [hSlidingRegionSize], a
ld c, a
ld a, [$ff8d]
ld a, [hSlideDirection]
and a
jr nz, .asm_6a2d
ld d, $0
jr nz, .next
; If sliding right, point hl to the end of the pic's tiles.
ld d, 0
add hl, de
.asm_6a2d
.next
ld d, h
ld e, l
.asm_6a2f
.loop
xor a
ld [H_AUTOBGTRANSFERENABLED], a
ld a, [$ff8d]
ld a, [hSlideDirection]
and a
jr nz, .asm_6a3c
jr nz, .slideLeft
; sliding right
ld a, [hli]
ld [hld], a
dec hl
jr .asm_6a3f
.asm_6a3c
jr .next2
.slideLeft
ld a, [hld]
ld [hli], a
inc hl
.asm_6a3f
.next2
dec c
jr nz, .asm_6a2f
ld a, [$ff8d]
jr nz, .loop
ld a, [hSlideDirection]
and a
jr z, .asm_6a4a
jr z, .next3
; If sliding left, we need to zero the last tile in the pic (there is no need
; to take a corresponding action when sliding right because hl initially points
; to a 0 tile in that case).
xor a
dec hl
ld [hl], a
.asm_6a4a
ld a, $1
.next3
ld a, 1
ld [H_AUTOBGTRANSFERENABLED], a
call Delay3
ld a, [H_DOWNARROWBLINKCNT2]
ld a, [hSlidingRegionSize]
ld c, a
ld h, d
ld l, e
ld a, [$ff8d]
ld a, [hSlideDirection]
and a
jr nz, .asm_6a5e
jr nz, .slideLeft2
inc hl
jr .asm_6a5f
.asm_6a5e
jr .next4
.slideLeft2
dec hl
.asm_6a5f
.next4
ld d, h
ld e, l
ld a, [H_DOWNARROWBLINKCNT1]
ld a, [hSlideAmount]
dec a
ld [H_DOWNARROWBLINKCNT1], a
jr nz, .asm_6a2f
ld [hSlideAmount], a
jr nz, .loop
pop bc
pop de
pop hl
@ -229,22 +235,24 @@ DefaultNamesRival:
db "@"
ENDC
Func_6ad6: ; 6ad6 (1:6ad6)
GetDefaultName: ; 6ad6 (1:6ad6)
; a = name index
; hl = name list
ld b, a
ld c, $0
.asm_6ad9
ld c, 0
.loop
ld d, h
ld e, l
.asm_6adb
.innerLoop
ld a, [hli]
cp $50
jr nz, .asm_6adb
cp "@"
jr nz, .innerLoop
ld a, b
cp c
jr z, .asm_6ae7
jr z, .foundName
inc c
jr .asm_6ad9
.asm_6ae7
jr .loop
.foundName
ld h, d
ld l, e
ld de, wcd6d

View file

@ -1,7 +1,7 @@
PickupItem:
PickUpItem:
call EnableAutoTextBoxDrawing
ld a, [H_DOWNARROWBLINKCNT2]
ld a, [hSpriteIndexOrTextID]
ld b, a
ld hl, W_MISSABLEOBJECTLIST
.missableObjectsListLoop
@ -18,7 +18,7 @@ PickupItem:
ld [$ffdb], a
ld hl, W_MAPSPRITEEXTRADATA
ld a, [H_DOWNARROWBLINKCNT2]
ld a, [hSpriteIndexOrTextID]
dec a
add a
ld d, 0

View file

@ -39,7 +39,7 @@ LoadMapSpriteTilePatterns: ; 17871 (5:7871)
ld b,$10 ; number of sprite slots
ld hl,wSpriteStateData2 + $0d
xor a
ld [$ff8e],a ; 4-tile sprite counter
ld [hFourTileSpriteCount],a
.copyPictureIDLoop ; loop to copy picture ID from $C2XD to $C2XE
ld a,[hli] ; $C2XD (sprite picture ID)
ld [hld],a ; $C2XE
@ -98,14 +98,14 @@ LoadMapSpriteTilePatterns: ; 17871 (5:7871)
cp a,SPRITE_BALL ; is it a 4-tile sprite?
jr c,.notFourTileSprite
pop af
ld a,[$ff8e] ; 4-tile sprite counter
ld a,[hFourTileSpriteCount]
add a,11
jr .storeVRAMSlot
.notFourTileSprite
pop af
.storeVRAMSlot
ld [hl],a ; store VRAM slot at $C2XE
ld [$ff8d],a ; used to determine if it's 4-tile sprite later
ld [hVRAMSlot],a ; used to determine if it's 4-tile sprite later
ld a,b ; a = current sprite picture ID
dec a
add a
@ -128,7 +128,7 @@ LoadMapSpriteTilePatterns: ; 17871 (5:7871)
push bc
ld hl,vNPCSprites ; VRAM base address
ld bc,$c0 ; number of bytes per VRAM slot
ld a,[$ff8d]
ld a,[hVRAMSlot]
cp a,11 ; is it a 4-tile sprite?
jr nc,.fourTileSpriteVRAMAddr
ld d,a
@ -142,13 +142,13 @@ LoadMapSpriteTilePatterns: ; 17871 (5:7871)
jr .loadStillTilePattern
.fourTileSpriteVRAMAddr
ld hl,vSprites + $7c0 ; address for second 4-tile sprite
ld a,[$ff8e] ; 4-tile sprite counter
and a ; is it the first 4-tile sprite?
ld a,[hFourTileSpriteCount]
and a
jr nz,.loadStillTilePattern
; if it's the first 4-tile sprite
ld hl,vSprites + $780 ; address for first 4-tile sprite
inc a
ld [$ff8e],a ; 4-tile sprite counter
ld [hFourTileSpriteCount],a
.loadStillTilePattern
pop bc
pop de
@ -168,7 +168,7 @@ LoadMapSpriteTilePatterns: ; 17871 (5:7871)
.skipFirstLoad
pop de
pop hl
ld a,[$ff8d]
ld a,[hVRAMSlot]
cp a,11 ; is it a 4-tile sprite?
jr nc,.skipSecondLoad ; if so, there is no second block
push de

View file

@ -111,7 +111,7 @@ PredefPointers:: ; 4fe79 (13:7e79)
add_predef InternalClockTradeAnim
add_predef TrainerEngage
add_predef IndexToPokedex
add_predef Predef3B; 3B display pic?
add_predef DisplayPicCenteredOrUpperRight; 3B display pic?
add_predef UsedCut
add_predef ShowPokedexData
add_predef WriteMonMoves
@ -144,7 +144,7 @@ PredefPointers:: ; 4fe79 (13:7e79)
add_predef GetTileTwoStepsInFrontOfPlayer
add_predef CheckForCollisionWhenPushingBoulder
add_predef PrintStrengthTxt
add_predef PickupItem
add_predef PickUpItem
add_predef PrintMoveType
add_predef LoadMovePPs
add_predef DrawHP ; 5F