mirror of
https://github.com/thornAvery/kep-hack.git
synced 2026-02-06 15:45:24 +13:00
Rename/organize part 1 of 4
rename functions, clean up address/wram comments, other misc only broken up so that all changes are viewable on github
This commit is contained in:
parent
ae420a4d8f
commit
cd649184f5
90 changed files with 1070 additions and 1066 deletions
|
|
@ -22,23 +22,23 @@ HiddenItemNear: ; 7481f (1d:481f)
|
|||
inc hl
|
||||
ld e, [hl]
|
||||
inc hl
|
||||
jr nz, .asm_74824 ; 0x74845 $dd
|
||||
jr nz, .asm_74824
|
||||
ld a, [W_YCOORD]
|
||||
call Func_7486b
|
||||
cp d
|
||||
jr nc, .asm_74824 ; 0x7484e $d4
|
||||
jr nc, .asm_74824
|
||||
ld a, [W_YCOORD]
|
||||
add $4
|
||||
cp d
|
||||
jr c, .asm_74824 ; 0x74856 $cc
|
||||
jr c, .asm_74824
|
||||
ld a, [W_XCOORD]
|
||||
call Func_7486b
|
||||
cp e
|
||||
jr nc, .asm_74824 ; 0x7485f $c3
|
||||
jr nc, .asm_74824
|
||||
ld a, [W_XCOORD]
|
||||
add $5
|
||||
cp e
|
||||
jr c, .asm_74824 ; 0x74867 $bb
|
||||
jr c, .asm_74824
|
||||
scf
|
||||
ret
|
||||
|
||||
|
|
|
|||
|
|
@ -115,7 +115,7 @@ ItemUseBall: ; d687 (3:5687)
|
|||
ld a,[W_NUMINBOX] ;is Box full?
|
||||
cp a,MONS_PER_BOX
|
||||
jp z,BoxFullCannotThrowBall
|
||||
.UseBall ;$56a7
|
||||
.UseBall
|
||||
;ok, you can use a ball
|
||||
xor a
|
||||
ld [wd11c],a
|
||||
|
|
@ -126,7 +126,7 @@ ItemUseBall: ; d687 (3:5687)
|
|||
; remove a Safari Ball from inventory
|
||||
ld hl,W_NUMSAFARIBALLS
|
||||
dec [hl]
|
||||
.skipSafariZoneCode ;$56b6
|
||||
.skipSafariZoneCode
|
||||
call GoPAL_SET_CF1C
|
||||
ld a,$43
|
||||
ld [wd11e],a
|
||||
|
|
@ -144,8 +144,8 @@ ItemUseBall: ; d687 (3:5687)
|
|||
ld de,wPlayerName
|
||||
ld bc,11
|
||||
call CopyData ; save the player's name in the Wild Monster data (part of the Cinnabar Island Missingno glitch)
|
||||
jp .BallSuccess ;$578b
|
||||
.notOldManBattle ;$56e9
|
||||
jp .BallSuccess
|
||||
.notOldManBattle
|
||||
ld a,[W_CURMAP]
|
||||
cp a,POKEMONTOWER_6
|
||||
jr nz,.loop
|
||||
|
|
@ -155,13 +155,13 @@ ItemUseBall: ; d687 (3:5687)
|
|||
jp z,.next12
|
||||
; if not fighting ghost Marowak, loop until a random number in the current
|
||||
; pokeball's allowed range is found
|
||||
.loop ;$56fa
|
||||
.loop
|
||||
call Random
|
||||
ld b,a
|
||||
ld hl,wcf91
|
||||
ld a,[hl]
|
||||
cp a,MASTER_BALL
|
||||
jp z,.BallSuccess ;$578b
|
||||
jp z,.BallSuccess
|
||||
cp a,POKE_BALL
|
||||
jr z,.checkForAilments
|
||||
ld a,200
|
||||
|
|
@ -173,7 +173,7 @@ ItemUseBall: ; d687 (3:5687)
|
|||
ld a,150 ;get only numbers <= 150 for Ultra Ball
|
||||
cp b
|
||||
jr c,.loop
|
||||
.checkForAilments ;$571a
|
||||
.checkForAilments
|
||||
; pokemon can be caught more easily with any (primary) status ailment
|
||||
; Frozen/Asleep pokemon are relatively even easier to catch
|
||||
; for Frozen/Asleep pokemon, any random number from 0-24 ensures a catch.
|
||||
|
|
@ -185,12 +185,12 @@ ItemUseBall: ; d687 (3:5687)
|
|||
ld c,12
|
||||
jr z,.notFrozenOrAsleep
|
||||
ld c,25
|
||||
.notFrozenOrAsleep ;$5728
|
||||
.notFrozenOrAsleep
|
||||
ld a,b
|
||||
sub c
|
||||
jp c,.BallSuccess ;$578b
|
||||
jp c,.BallSuccess
|
||||
ld b,a
|
||||
.noAilments ;$572e
|
||||
.noAilments
|
||||
push bc ;save RANDOM number
|
||||
xor a
|
||||
ld [H_MULTIPLICAND],a
|
||||
|
|
@ -207,7 +207,7 @@ ItemUseBall: ; d687 (3:5687)
|
|||
ld a,12 ;any other BallFactor
|
||||
jr nz,.next7
|
||||
ld a,8
|
||||
.next7 ;$574d
|
||||
.next7
|
||||
ld [H_DIVISOR],a
|
||||
ld b,4 ; number of bytes in dividend
|
||||
call Divide
|
||||
|
|
@ -226,7 +226,7 @@ ItemUseBall: ; d687 (3:5687)
|
|||
and a
|
||||
jr nz,.next8
|
||||
inc a
|
||||
.next8 ;$5766
|
||||
.next8
|
||||
ld [H_DIVISOR],a
|
||||
ld b,4
|
||||
call Divide ; ((MaxHP * 255) / BallFactor) / (CurHP / 4)
|
||||
|
|
@ -235,7 +235,7 @@ ItemUseBall: ; d687 (3:5687)
|
|||
jr z,.next9
|
||||
ld a,255
|
||||
ld [H_QUOTIENT + 3],a
|
||||
.next9 ;$5776
|
||||
.next9
|
||||
pop bc
|
||||
ld a,[wEnemyMonCatchRate] ;enemy: Catch Rate
|
||||
cp b
|
||||
|
|
@ -248,9 +248,9 @@ ItemUseBall: ; d687 (3:5687)
|
|||
ld a,[H_QUOTIENT + 3]
|
||||
cp b
|
||||
jr c,.next10
|
||||
.BallSuccess ;$578b
|
||||
.BallSuccess
|
||||
jr .BallSuccess2
|
||||
.next10 ;$578d
|
||||
.next10
|
||||
ld a,[H_QUOTIENT + 3]
|
||||
ld [wd11e],a
|
||||
xor a
|
||||
|
|
@ -271,7 +271,7 @@ ItemUseBall: ; d687 (3:5687)
|
|||
ld b,150
|
||||
cp a,ULTRA_BALL
|
||||
jr z,.next11
|
||||
.next11 ;$57b8
|
||||
.next11
|
||||
ld a,b
|
||||
ld [H_DIVISOR],a
|
||||
ld b,4
|
||||
|
|
@ -294,11 +294,11 @@ ItemUseBall: ; d687 (3:5687)
|
|||
ld b,5
|
||||
jr z,.next14
|
||||
ld b,10
|
||||
.next14 ;$57e6
|
||||
.next14
|
||||
ld a,[H_QUOTIENT + 3]
|
||||
add b
|
||||
ld [H_QUOTIENT + 3],a
|
||||
.next13 ;$57eb
|
||||
.next13
|
||||
ld a,[H_QUOTIENT + 3]
|
||||
cp a,10
|
||||
ld b,$20
|
||||
|
|
@ -310,10 +310,10 @@ ItemUseBall: ; d687 (3:5687)
|
|||
ld b,$62
|
||||
jr c,.next12
|
||||
ld b,$63
|
||||
.next12 ;$5801
|
||||
.next12
|
||||
ld a,b
|
||||
ld [wd11e],a
|
||||
.BallSuccess2 ;$5805
|
||||
.BallSuccess2
|
||||
ld c,20
|
||||
call DelayFrames
|
||||
ld a,TOSS_ANIM
|
||||
|
|
@ -362,14 +362,14 @@ ItemUseBall: ; d687 (3:5687)
|
|||
ld a,$4c
|
||||
ld [wEnemyMonSpecies2],a
|
||||
jr .next16
|
||||
.next15 ;$5871
|
||||
.next15
|
||||
set Transformed,[hl]
|
||||
ld hl,wcceb
|
||||
ld a,[wEnemyMonDVs]
|
||||
ld [hli],a
|
||||
ld a,[wEnemyMonDVs + 1]
|
||||
ld [hl],a
|
||||
.next16 ;$587e
|
||||
.next16
|
||||
ld a,[wcf91]
|
||||
push af
|
||||
ld a,[wEnemyMonSpecies2]
|
||||
|
|
@ -419,7 +419,7 @@ ItemUseBall: ; d687 (3:5687)
|
|||
ld a,[wEnemyMonSpecies] ;caught mon_ID
|
||||
ld [wd11e],a
|
||||
predef ShowPokedexData
|
||||
.checkParty ;$58f4
|
||||
.checkParty
|
||||
ld a,[wPartyCount]
|
||||
cp a,PARTY_LENGTH ;is party full?
|
||||
jr z,.sendToBox
|
||||
|
|
@ -428,7 +428,7 @@ ItemUseBall: ; d687 (3:5687)
|
|||
call ClearSprites
|
||||
call AddPartyMon ;add mon to Party
|
||||
jr .End
|
||||
.sendToBox ;$5907
|
||||
.sendToBox
|
||||
call ClearSprites
|
||||
call SendNewMonToBox
|
||||
ld hl,ItemUseBallText07
|
||||
|
|
@ -436,22 +436,22 @@ ItemUseBall: ; d687 (3:5687)
|
|||
bit 0,a ;already met Bill?
|
||||
jr nz,.sendToBox2
|
||||
ld hl,ItemUseBallText08
|
||||
.sendToBox2 ;$591a
|
||||
.sendToBox2
|
||||
call PrintText
|
||||
jr .End
|
||||
.printText1 ;$591f
|
||||
.printText1
|
||||
ld hl,ItemUseBallText05
|
||||
.printText0 ;$5922
|
||||
.printText0
|
||||
call PrintText
|
||||
call ClearSprites
|
||||
.End ;$5928
|
||||
.End
|
||||
ld a,[W_BATTLETYPE]
|
||||
and a
|
||||
ret nz
|
||||
ld hl,wNumBagItems
|
||||
inc a
|
||||
ld [wcf96],a
|
||||
jp RemoveItemFromInventory ;remove ITEM (XXX)
|
||||
jp RemoveItemFromInventory
|
||||
ItemUseBallText00: ; d937 (3:5937)
|
||||
;"It dodged the thrown ball!"
|
||||
;"This pokemon can't be caught"
|
||||
|
|
@ -645,8 +645,8 @@ ItemUseEvoStone: ; da5b (3:5a5b)
|
|||
ld a,$01
|
||||
ld [wccd4],a
|
||||
ld a,(SFX_02_3e - SFX_Headers_02) / 3
|
||||
call PlaySoundWaitForCurrent ; play sound
|
||||
call WaitForSoundToFinish ; wait for sound to end
|
||||
call PlaySoundWaitForCurrent
|
||||
call WaitForSoundToFinish
|
||||
callab TryEvolvingMon ; try to evolve pokemon
|
||||
ld a,[wd121]
|
||||
and a
|
||||
|
|
@ -918,7 +918,7 @@ ItemUseMedicine: ; dabb (3:5abb)
|
|||
ld bc,2 * 20
|
||||
call AddNTimes ; calculate coordinates of HP bar of pokemon that used Softboiled
|
||||
ld a,(SFX_02_3d - SFX_Headers_02) / 3
|
||||
call PlaySoundWaitForCurrent ; play sound
|
||||
call PlaySoundWaitForCurrent
|
||||
ld a,[hFlags_0xFFF6]
|
||||
set 0,a
|
||||
ld [hFlags_0xFFF6],a
|
||||
|
|
@ -1068,7 +1068,7 @@ ItemUseMedicine: ; dabb (3:5abb)
|
|||
cp a,FULL_HEAL
|
||||
jr z,.playStatusAilmentCuringSound
|
||||
ld a,(SFX_02_3d - SFX_Headers_02) / 3 ; HP healing sound
|
||||
call PlaySoundWaitForCurrent ; play sound
|
||||
call PlaySoundWaitForCurrent
|
||||
ld a,[hFlags_0xFFF6]
|
||||
set 0,a
|
||||
ld [hFlags_0xFFF6],a
|
||||
|
|
@ -1179,7 +1179,7 @@ ItemUseMedicine: ; dabb (3:5abb)
|
|||
ld bc,10
|
||||
call CopyData ; copy the stat's name to wcf4b
|
||||
ld a,(SFX_02_3e - SFX_Headers_02) / 3
|
||||
call PlaySound ; play sound
|
||||
call PlaySound
|
||||
ld hl,VitaminStatRoseText
|
||||
call PrintText
|
||||
jp RemoveUsedItem
|
||||
|
|
@ -1722,7 +1722,7 @@ PlayedFluteHadEffectText: ; e215 (3:6215)
|
|||
call PlaySound ; turn off music
|
||||
ld a, (SFX_02_5e - SFX_Headers_02) / 3
|
||||
ld c, BANK(SFX_02_5e)
|
||||
call PlayMusic ; play music
|
||||
call PlayMusic
|
||||
.musicWaitLoop ; wait for music to finish playing
|
||||
ld a,[wc028]
|
||||
cp a,$b8
|
||||
|
|
@ -1747,7 +1747,7 @@ OldRodCode: ; e24c (3:624c)
|
|||
jp c, ItemUseNotTime
|
||||
ld bc, (5 << 8) | MAGIKARP
|
||||
ld a, $1 ; set bite
|
||||
jr RodResponse ; 0xe257 $34
|
||||
jr RodResponse
|
||||
|
||||
GoodRodCode: ; e259 (3:6259)
|
||||
call FishingInit
|
||||
|
|
@ -1780,7 +1780,7 @@ INCLUDE "data/good_rod.asm"
|
|||
SuperRodCode: ; e283 (3:6283)
|
||||
call FishingInit
|
||||
jp c, ItemUseNotTime
|
||||
call ReadSuperRodData ; 0xe8ea
|
||||
call ReadSuperRodData
|
||||
ld a, e
|
||||
RodResponse: ; e28d (3:628d)
|
||||
ld [wWhichTrade], a
|
||||
|
|
@ -1825,7 +1825,7 @@ FishingInit: ; e2b4 (3:62b4)
|
|||
ld hl,ItemUseText00
|
||||
call PrintText
|
||||
ld a,(SFX_02_3e - SFX_Headers_02) / 3
|
||||
call PlaySound ; play sound
|
||||
call PlaySound
|
||||
ld c,80
|
||||
call DelayFrames
|
||||
and a
|
||||
|
|
@ -1848,9 +1848,9 @@ ItemUseItemfinder: ; e2e1 (3:62e1)
|
|||
ld c,4
|
||||
.loop
|
||||
ld a,(SFX_02_4a - SFX_Headers_02) / 3
|
||||
call PlaySoundWaitForCurrent ; play sound
|
||||
call PlaySoundWaitForCurrent
|
||||
ld a,(SFX_02_5a - SFX_Headers_02) / 3
|
||||
call PlaySoundWaitForCurrent ; play sound
|
||||
call PlaySoundWaitForCurrent
|
||||
dec c
|
||||
jr nz,.loop
|
||||
ld hl,ItemfinderFoundItemText
|
||||
|
|
@ -2147,7 +2147,7 @@ ItemUseTMHM: ; e479 (3:6479)
|
|||
jr nz,.checkIfAlreadyLearnedMove
|
||||
; if the pokemon can't learn the move
|
||||
ld a,(SFX_02_51 - SFX_Headers_02) / 3
|
||||
call PlaySoundWaitForCurrent ; play sound
|
||||
call PlaySoundWaitForCurrent
|
||||
ld hl,MonCannotLearnMachineMoveText
|
||||
call PrintText
|
||||
jr .chooseMon
|
||||
|
|
@ -2187,7 +2187,7 @@ PrintItemUseTextAndRemoveItem: ; e563 (3:6563)
|
|||
ld hl,ItemUseText00
|
||||
call PrintText
|
||||
ld a,(SFX_02_3e - SFX_Headers_02) / 3
|
||||
call PlaySound ; play sound
|
||||
call PlaySound
|
||||
call WaitForTextScrollButtonPress ; wait for button press
|
||||
|
||||
RemoveUsedItem: ; e571 (3:6571)
|
||||
|
|
@ -2568,7 +2568,7 @@ IsKeyItem_: ; e764 (3:6764)
|
|||
INCLUDE "data/key_items.asm"
|
||||
|
||||
SendNewMonToBox: ; e7a4 (3:67a4)
|
||||
ld de, W_NUMINBOX ; wda80
|
||||
ld de, W_NUMINBOX
|
||||
ld a, [de]
|
||||
inc a
|
||||
ld [de], a
|
||||
|
|
@ -2587,7 +2587,7 @@ SendNewMonToBox: ; e7a4 (3:67a4)
|
|||
call GetMonHeader
|
||||
ld hl, wBoxMonOT
|
||||
ld bc, $b
|
||||
ld a, [W_NUMINBOX] ; wda80
|
||||
ld a, [W_NUMINBOX]
|
||||
dec a
|
||||
jr z, .asm_e7ee
|
||||
dec a
|
||||
|
|
@ -2598,7 +2598,7 @@ SendNewMonToBox: ; e7a4 (3:67a4)
|
|||
ld d, h
|
||||
ld e, l
|
||||
pop hl
|
||||
ld a, [W_NUMINBOX] ; wda80
|
||||
ld a, [W_NUMINBOX]
|
||||
dec a
|
||||
ld b, a
|
||||
.asm_e7db
|
||||
|
|
@ -2615,11 +2615,11 @@ SendNewMonToBox: ; e7a4 (3:67a4)
|
|||
dec b
|
||||
jr nz, .asm_e7db
|
||||
.asm_e7ee
|
||||
ld hl, wPlayerName ; wd158
|
||||
ld hl, wPlayerName
|
||||
ld de, wBoxMonOT
|
||||
ld bc, $b
|
||||
call CopyData
|
||||
ld a, [W_NUMINBOX] ; wda80
|
||||
ld a, [W_NUMINBOX]
|
||||
dec a
|
||||
jr z, .asm_e82a
|
||||
ld hl, wBoxMonNicks
|
||||
|
|
@ -2632,7 +2632,7 @@ SendNewMonToBox: ; e7a4 (3:67a4)
|
|||
ld d, h
|
||||
ld e, l
|
||||
pop hl
|
||||
ld a, [W_NUMINBOX] ; wda80
|
||||
ld a, [W_NUMINBOX]
|
||||
dec a
|
||||
ld b, a
|
||||
.asm_e817
|
||||
|
|
@ -2653,7 +2653,7 @@ SendNewMonToBox: ; e7a4 (3:67a4)
|
|||
ld a, $2
|
||||
ld [wd07d], a
|
||||
predef AskName
|
||||
ld a, [W_NUMINBOX] ; wda80
|
||||
ld a, [W_NUMINBOX]
|
||||
dec a
|
||||
jr z, .asm_e867
|
||||
ld hl, wBoxMons
|
||||
|
|
@ -2666,7 +2666,7 @@ SendNewMonToBox: ; e7a4 (3:67a4)
|
|||
ld d, h
|
||||
ld e, l
|
||||
pop hl
|
||||
ld a, [W_NUMINBOX] ; wda80
|
||||
ld a, [W_NUMINBOX]
|
||||
dec a
|
||||
ld b, a
|
||||
.asm_e854
|
||||
|
|
@ -2683,13 +2683,13 @@ SendNewMonToBox: ; e7a4 (3:67a4)
|
|||
dec b
|
||||
jr nz, .asm_e854
|
||||
.asm_e867
|
||||
ld a, [wEnemyMonLevel] ; wEnemyMonLevel
|
||||
ld a, [wEnemyMonLevel]
|
||||
ld [wEnemyMonBoxLevel], a
|
||||
ld hl, wEnemyMon
|
||||
ld de, wBoxMon1
|
||||
ld bc, $c
|
||||
call CopyData
|
||||
ld hl, wPlayerID ; wPlayerID
|
||||
ld hl, wPlayerID
|
||||
ld a, [hli]
|
||||
ld [de], a
|
||||
inc de
|
||||
|
|
@ -2697,11 +2697,11 @@ SendNewMonToBox: ; e7a4 (3:67a4)
|
|||
ld [de], a
|
||||
inc de
|
||||
push de
|
||||
ld a, [W_CURENEMYLVL] ; W_CURENEMYLVL
|
||||
ld a, [W_CURENEMYLVL]
|
||||
ld d, a
|
||||
callab CalcExperience
|
||||
pop de
|
||||
ld a, [H_NUMTOPRINT] ; $ff96 (aliases: H_MULTIPLICAND)
|
||||
ld a, [H_NUMTOPRINT] ; (aliases: H_MULTIPLICAND)
|
||||
ld [de], a
|
||||
inc de
|
||||
ld a, [$ff97]
|
||||
|
|
@ -2723,7 +2723,7 @@ SendNewMonToBox: ; e7a4 (3:67a4)
|
|||
inc de
|
||||
ld a, [hli]
|
||||
ld [de], a
|
||||
ld hl, wEnemyMonPP ; wcffe
|
||||
ld hl, wEnemyMonPP
|
||||
ld b, $4
|
||||
.asm_e8b1
|
||||
ld a, [hli]
|
||||
|
|
@ -2777,7 +2777,7 @@ ReadSuperRodData: ; e8ea (3:68ea)
|
|||
ld e, $2 ; $2 if no fishing groups found
|
||||
ret
|
||||
|
||||
.ReadFishingGroup ; 0xe8f6
|
||||
.ReadFishingGroup
|
||||
; hl points to the fishing group entry in the index
|
||||
inc hl ; skip map id
|
||||
|
||||
|
|
@ -2790,7 +2790,7 @@ ReadSuperRodData: ; e8ea (3:68ea)
|
|||
inc hl ; point to data
|
||||
ld e, $0 ; no bite yet
|
||||
|
||||
.RandomLoop ; 0xe90c
|
||||
.RandomLoop
|
||||
call Random
|
||||
srl a
|
||||
ret c ; 50% chance of no battle
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ GetMachinePrice: ; 7bf86 (1e:7f86)
|
|||
sub TM_01
|
||||
ret c
|
||||
ld d, a
|
||||
ld hl, TechnicalMachinePrices ; $7fa7
|
||||
ld hl, TechnicalMachinePrices
|
||||
srl a
|
||||
ld c, a
|
||||
ld b, 0
|
||||
|
|
@ -17,9 +17,9 @@ GetMachinePrice: ; 7bf86 (1e:7f86)
|
|||
swap a
|
||||
.highNybbleIsPrice
|
||||
and $f0
|
||||
ld [H_DOWNARROWBLINKCNT2], a ; $ff8c
|
||||
ld [H_DOWNARROWBLINKCNT2], a
|
||||
xor a
|
||||
ld [H_DOWNARROWBLINKCNT1], a ; $ff8b
|
||||
ld [H_DOWNARROWBLINKCNT1], a
|
||||
ld [$ff8d], a
|
||||
ret
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue