diff options
Diffstat (limited to 'engine')
99 files changed, 1222 insertions, 1199 deletions
diff --git a/engine/HoF_room_pc.asm b/engine/HoF_room_pc.asm index ae4ecb0d..c33e9141 100755 --- a/engine/HoF_room_pc.asm +++ b/engine/HoF_room_pc.asm @@ -1,7 +1,7 @@ HallOfFamePC: ; 7405c (1d:405c) callba AnimateHallOfFame call ClearScreen - ld c, $64 + ld c, 100 call DelayFrames call DisableLCD ld hl, vFont @@ -19,27 +19,27 @@ HallOfFamePC: ; 7405c (1d:405c) hlCoord 0, 14 call Func_7417b ld a, $c0 - ld [rBGP], a ; $ff47 + ld [rBGP], a call EnableLCD ld a, $ff call PlaySoundWaitForCurrent ld c, BANK(Music_Credits) ld a, MUSIC_CREDITS call PlayMusic - ld c, $80 + ld c, 128 call DelayFrames xor a - ld [wWhichTrade], a ; wWhichTrade + ld [wWhichTrade], a ld [wTrainerEngageDistance], a jp Credits Func_740ba: ; 740ba (1d:40ba) - ld hl, DataTable_74160 ; $4160 + ld hl, DataTable_74160 ld b, $4 .asm_740bf ld a, [hli] - ld [rBGP], a ; $ff47 - ld c, $5 + ld [rBGP], a + ld c, 5 call DelayFrames dec b jr nz, .asm_740bf @@ -116,7 +116,7 @@ Func_74152: ; 74152 (1d:4152) cp l jr nz, Func_74152 ld a, h - ld [rSCX], a ; $ff43 + ld [rSCX], a .asm_7415a ld a, [$ff44] cp h @@ -128,11 +128,11 @@ DataTable_74160: ; 74160 (1d:4160) Func_74164: ; 74164 (1d:4164) ld a, l - ld [H_AUTOBGTRANSFERDEST], a ; $ffbc + ld [H_AUTOBGTRANSFERDEST], a ld a, h ld [$ffbd], a ld a, $1 - ld [H_AUTOBGTRANSFERENABLED], a ; $ffba + ld [H_AUTOBGTRANSFERENABLED], a jp Delay3 Func_74171: ; 74171 (1d:4171) @@ -157,7 +157,7 @@ FillMiddleOfScreenWithWhite: ; 74183 (1d:4183) jp FillMemory Credits: ; 7418e (1d:418e) - ld de, CreditsOrder ; $4243 + ld de, CreditsOrder push de .asm_74192 pop de @@ -183,7 +183,7 @@ Credits: ; 7418e (1d:418e) jr z, .showTheEnd push hl push hl - ld hl, CreditsTextPointers ; $42c3 + ld hl, CreditsTextPointers add a ld c, a ld b, $0 @@ -205,20 +205,20 @@ Credits: ; 7418e (1d:418e) jr .asm_7419b .asm_741d5 call Func_740ba - ld c, $5a + ld c, 90 jr .asm_741de .asm_741dc - ld c, $6e + ld c, 110 .asm_741de call DelayFrames call DisplayCreditsMon jr .asm_74192 .asm_741e6 call Func_740ba - ld c, $78 + ld c, 120 jr .asm_741ef .asm_741ed - ld c, $8c + ld c, 140 .asm_741ef call DelayFrames jr .asm_74192 @@ -229,7 +229,7 @@ Credits: ; 7418e (1d:418e) pop de jr .asm_7419b .showTheEnd - ld c, $10 + ld c, 16 call DelayFrames call FillMiddleOfScreenWithWhite pop de diff --git a/engine/battle/animations.asm b/engine/battle/animations.asm index dc08e0e1..cdd28422 100755 --- a/engine/battle/animations.asm +++ b/engine/battle/animations.asm @@ -170,7 +170,7 @@ PlayAnimation: ; 780f1 (1e:40f1) ld l,a ld h,0 add hl,hl - ld de,AttackAnimationPointers ; $607d ; animation command stream pointers + ld de,AttackAnimationPointers ; animation command stream pointers add hl,de ld a,[hli] ld h,[hl] @@ -199,7 +199,7 @@ PlayAnimation: ; 780f1 (1e:40f1) ld [wAnimSoundID],a ; store sound push hl push de - call Func_7986f + call GetMoveSound call PlaySound pop de pop hl @@ -383,7 +383,7 @@ MoveAnimation: ; 78d5e (1e:4d5e) push bc push af call WaitForSoundToFinish - call Func_78e23 + call SetAnimationPalette ld a,[W_ANIMATIONID] and a jr z,.AnimationFinished @@ -500,19 +500,19 @@ AnimationShakeScreenHorizontallySlow: ; 78e01 (1e:4e01) push bc push bc .asm_78e03 - ld a, [rWX] ; $ff4b + ld a, [rWX] inc a - ld [rWX], a ; $ff4b - ld c, $2 + ld [rWX], a + ld c, 2 call DelayFrames dec b jr nz, .asm_78e03 pop bc .asm_78e11 - ld a, [rWX] ; $ff4b + ld a, [rWX] dec a - ld [rWX], a ; $ff4b - ld c, $2 + ld [rWX], a + ld c, 2 call DelayFrames dec b jr nz, .asm_78e11 @@ -521,7 +521,7 @@ AnimationShakeScreenHorizontallySlow: ; 78e01 (1e:4e01) jr nz, AnimationShakeScreenHorizontallySlow ret -Func_78e23: ; 78e23 (1e:4e23) +SetAnimationPalette: ; 78e23 (1e:4e23) ld a, [wOnSGB] and a ld a, $e4 @@ -529,7 +529,7 @@ Func_78e23: ; 78e23 (1e:4e23) ld a, $f0 ld [wcc79], a ld b, $e4 - ld a, [W_ANIMATIONID] ; W_ANIMATIONID + ld a, [W_ANIMATIONID] cp TRADE_BALL_DROP_ANIM jr c, .asm_78e3f cp TRADE_BALL_POOF_ANIM + 1 @@ -537,24 +537,24 @@ Func_78e23: ; 78e23 (1e:4e23) ld b, $f0 .asm_78e3f ld a, b - ld [rOBP0], a ; $ff48 + ld [rOBP0], a ld a, $6c - ld [rOBP1], a ; $ff49 + ld [rOBP1], a ret .asm_78e47 ld a, $e4 ld [wcc79], a - ld [rOBP0], a ; $ff48 + ld [rOBP0], a ld a, $6c - ld [rOBP1], a ; $ff49 + ld [rOBP1], a ret PlaySubanimation: ; 78e53 (1e:4e53) ld a,[wAnimSoundID] cp a,$FF jr z,.skipPlayingSound - call Func_7986f - call PlaySound ; play sound effect + call GetMoveSound + call PlaySound .skipPlayingSound ld hl,wOAMBuffer ; base address of OAM buffer ld a,l @@ -581,7 +581,7 @@ PlaySubanimation: ; 78e53 (1e:4e53) push hl ld e,[hl] ; base coordinate ID ld d,0 - ld hl,FrameBlockBaseCoords ; $7c85 ; base coordinate table + ld hl,FrameBlockBaseCoords ; base coordinate table add hl,de add hl,de ld a,[hli] @@ -667,7 +667,7 @@ AnimationIdSpecialEffects: ; 78ef5 (1e:4ef5) dw AnimationFlashScreen db TAIL_WHIP - dw Func_790d0 + dw TailWhipAnimationUnused db GROWL dw DoGrowlSpecialEffects @@ -703,13 +703,13 @@ AnimationIdSpecialEffects: ; 78ef5 (1e:4ef5) dw DoRockSlideSpecialEffects db TRADE_BALL_DROP_ANIM - dw Func_79041 + dw TradeHidePokemon db TRADE_BALL_SHAKE_ANIM - dw Func_7904c + dw TradeShakePokeball db TRADE_BALL_TILT_ANIM - dw Func_7907c + dw TradeJumpPokeball db TOSS_ANIM dw DoBallTossSpecialEffects @@ -742,7 +742,7 @@ DoBallTossSpecialEffects: ; 78f3e (1e:4f3e) jr nz,.skipPlayingSound ; if it is the beginning of the subanimation, play a sound ld a,(SFX_08_41 - SFX_Headers_08) / 3 - call PlaySound ; play sound + call PlaySound .skipPlayingSound ld a,[W_ISINBATTLE] cp a,02 ; is it a trainer battle? @@ -788,7 +788,7 @@ DoBallShakeSpecialEffects: ; 78f96 (1e:4f96) jr nz,.skipPlayingSound ; if it is the beginning of a shake, play a sound and wait 2/3 of a second ld a,(SFX_08_3c - SFX_Headers_08) / 3 - call PlaySound ; play sound + call PlaySound ld c,40 call DelayFrames .skipPlayingSound @@ -875,8 +875,8 @@ DoBlizzardSpecialEffects: ; 79016 (1e:5016) ret ; flashes the screen at 3 points in the subanimation -; XXX is this unused? -Func_7902e: ; 7902e (1e:502e) +; unused +FlashScreenUnused: ; 7902e (1e:502e) ld a,[W_SUBANIMCOUNTER] cp a,14 jp z,AnimationFlashScreen @@ -887,8 +887,7 @@ Func_7902e: ; 7902e (1e:502e) ret ; function to make the pokemon disappear at the beginning of the animation -; XXX probably a trade-related animation -Func_79041: ; 79041 (1e:5041) +TradeHidePokemon: ; 79041 (1e:5041) ld a,[W_SUBANIMCOUNTER] cp a,6 ret nz @@ -896,8 +895,7 @@ Func_79041: ; 79041 (1e:5041) jp Func_7980c ; make pokemon disappear ; function to make a shaking pokeball jump up at the end of the animation -; XXX probably a trade-related animation -Func_7904c: ; 7904c (1e:504c) +TradeShakePokeball: ; 7904c (1e:504c) ld a,[W_SUBANIMCOUNTER] cp a,1 ret nz @@ -924,15 +922,14 @@ Func_7904c: ; 7904c (1e:504c) .done call AnimationCleanOAM ld a,(SFX_02_44 - SFX_Headers_02) / 3 - jp PlaySound ; play sound + jp PlaySound BallMoveDistances1: ; 79078 (1e:5078) db -12,-12,-8 db $ff ; terminator ; function to make the pokeball jump up -; XXX probably a trade-related animation -Func_7907c ; 507C +TradeJumpPokeball: ; 507C ld de,BallMoveDistances2 .loop ld hl,wOAMBuffer ; OAM buffer @@ -985,7 +982,7 @@ DoGrowlSpecialEffects: ; 790bc (1e:50bc) ret ; this is associated with Tail Whip, but Tail Whip doesn't use any subanimations -Func_790d0: ; 790d0 (1e:50d0) +TailWhipAnimationUnused: ; 790d0 (1e:50d0) ld a,1 ld [W_SUBANIMCOUNTER],a ld c,20 @@ -1183,46 +1180,46 @@ AnimationFlashScreen: ; 791be (1e:51be) AnimationDarkScreenPalette: ; 791d6 (1e:51d6) ; Changes the screen's palette to a dark palette. ld bc, $6f6f - jr Func_791fc + jr SetAnimationBGPalette AnimationDarkenMonPalette: ; 791db (1e:51db) ; Darkens the mon sprite's palette. ld bc, $f9f4 - jr Func_791fc + jr SetAnimationBGPalette -Func_791e0: ; 791e0 (1e:51e0) +AnimationUnusedPalette1: ; 791e0 (1e:51e0) ld bc, $fef8 - jr Func_791fc + jr SetAnimationBGPalette -Func_791e5: ; 791e5 (1e:51e5) +AnimationUnusedPalette2: ; 791e5 (1e:51e5) ld bc, $ffff - jr Func_791fc + jr SetAnimationBGPalette AnimationResetScreenPalette: ; 791ea (1e:51ea) ; Restores the screen's palette to the normal palette. ld bc, $e4e4 - jr Func_791fc + jr SetAnimationBGPalette -Func_791ef: ; 791ef (1e:51ef) +AnimationUnusedPalette3: ; 791ef (1e:51ef) ld bc, $0000 - jr Func_791fc + jr SetAnimationBGPalette AnimationLightScreenPalette: ; 791f4 (1e:51f4) ; Changes the screen to use a palette with light colors. ld bc, $9090 - jr Func_791fc + jr SetAnimationBGPalette -Func_791f9: ; 791f9 (1e:51f9) +AnimationUnusedPalette4: ; 791f9 (1e:51f9) ld bc, $4040 -Func_791fc: ; 791fc (1e:51fc) +SetAnimationBGPalette: ; 791fc (1e:51fc) ld a, [wOnSGB] and a ld a, b jr z, .asm_79204 ld a, c .asm_79204 - ld [rBGP], a ; $ff47 + ld [rBGP], a ret ld b, $5 @@ -1246,45 +1243,45 @@ AnimationWaterDropletsEverywhere: ; 79215 (1e:5215) call LoadAnimationTileset ld d, $20 ld a, $f0 - ld [W_BASECOORDX], a ; wd081 + ld [W_BASECOORDX], a ld a, $71 ld [wd09f], a .asm_79228 ld a, $10 - ld [W_BASECOORDY], a ; wd082 + ld [W_BASECOORDY], a ld a, $0 ld [wd08a], a - call Func_79246 + call _AnimationWaterDroplets ld a, $18 - ld [W_BASECOORDY], a ; wd082 + ld [W_BASECOORDY], a ld a, $20 ld [wd08a], a - call Func_79246 + call _AnimationWaterDroplets dec d jr nz, .asm_79228 ret -Func_79246: ; 79246 (1e:5246) +_AnimationWaterDroplets: ; 79246 (1e:5246) ld hl, wOAMBuffer .asm_79249 - ld a, [W_BASECOORDY] ; wd082 + ld a, [W_BASECOORDY] ld [hli], a - ld a, [W_BASECOORDX] ; wd081 + ld a, [W_BASECOORDX] add $1b - ld [W_BASECOORDX], a ; wd081 + ld [W_BASECOORDX], a ld [hli], a ld a, [wd09f] ld [hli], a xor a ld [hli], a - ld a, [W_BASECOORDX] ; wd081 + ld a, [W_BASECOORDX] cp $90 jr c, .asm_79249 sub $a8 - ld [W_BASECOORDX], a ; wd081 - ld a, [W_BASECOORDY] ; wd082 + ld [W_BASECOORDX], a + ld a, [W_BASECOORDY] add $10 - ld [W_BASECOORDY], a ; wd082 + ld [W_BASECOORDY], a cp $70 jr c, .asm_79249 call AnimationCleanOAM @@ -1304,7 +1301,7 @@ AnimationSlideMonUp: ; 7927a (1e:527a) ld a, $ff .asm_79291 ld [wd09f], a - jp Func_792bf + jp _AnimationSlideMonUp AnimationSlideMonDown: ; 79297 (1e:5297) ; Slides the mon's sprite down out of the screen. @@ -1314,7 +1311,7 @@ AnimationSlideMonDown: ; 79297 (1e:5297) call GetMonSpriteTileMapPointerFromRowCount push bc push de - call Func_79aae + call CopyPicTiles call Delay3 call AnimationHideMonPic pop de @@ -1327,15 +1324,15 @@ AnimationSlideMonOut: ; 792af (1e:52af) ; Slides the mon's sprite out of the screen horizontally. ld e, $8 ld a, $3 - ld [W_SUBANIMTRANSFORM], a ; W_SUBANIMTRANSFORM - jp Func_795f8 + ld [W_SUBANIMTRANSFORM], a + jp AnimationSlideMonLeft AnimationSlideEnemyMonOut: ; 792b9 (1e:52b9) ; Slides the enemy mon out of the screen horizontally. - ld hl, AnimationSlideMonOut ; $52af + ld hl, AnimationSlideMonOut jp CallWithTurnFlipped -Func_792bf: ; 792bf (1e:52bf) +_AnimationSlideMonUp: ; 792bf (1e:52bf) push de push hl push bc @@ -1368,16 +1365,16 @@ Func_792bf: ; 792bf (1e:52bf) add $7 dec c jr nz, .asm_792eb - ld c, $2 + ld c, 2 call DelayFrames pop bc pop hl pop de dec c - jr nz, Func_792bf + jr nz, _AnimationSlideMonUp ret -Func_792fd: ; 792fd (1e:52fd) +_AnimationShakeEnemyHUD: ; 792fd (1e:52fd) ld a, $10 ld [W_BASECOORDX], a ld a, $30 @@ -1390,7 +1387,7 @@ Func_792fd: ; 792fd (1e:52fd) ld e, a ld b, $5 .asm_79314 - call Func_79329 + call Animations_79329 inc d dec b jr nz, .asm_79314 @@ -1403,12 +1400,12 @@ Func_792fd: ; 792fd (1e:52fd) ld [W_BASECOORDX], a jr .asm_7930e -Func_79329: ; 79329 (1e:5329) +Animations_79329: ; 79329 (1e:5329) ld a, e add $8 ld e, a ld [hli], a - ld a, [W_BASECOORDX] ; wd081 + ld a, [W_BASECOORDX] ld [hli], a ld a, d ld [hli], a @@ -1464,7 +1461,7 @@ AdjustOAMBlockYPos2: ; 79352 (1e:5352) AnimationBlinkEnemyMon: ; 79369 (1e:5369) ; Make the enemy mon's sprite blink on and off for a second or two - ld hl, AnimationBlinkMon ; $536f + ld hl, AnimationBlinkMon jp CallWithTurnFlipped AnimationBlinkMon: ; 7936f (1e:536f) @@ -1474,10 +1471,10 @@ AnimationBlinkMon: ; 7936f (1e:536f) .asm_79372 push bc call AnimationHideMonPic - ld c, $5 + ld c, 5 call DelayFrames call AnimationShowMonPic - ld c, $5 + ld c, 5 call DelayFrames pop bc dec c @@ -1502,7 +1499,7 @@ AnimationShowMonPic: ; 7939e (1e:539e) xor a call GetTileIDList call GetMonSpriteTileMapPointerFromRowCount - call Func_79aae + call CopyPicTiles jp Delay3 AnimationShowEnemyMonPic: ; 793ab (1e:53ab) @@ -1537,7 +1534,7 @@ AnimationShakeBackAndForth: ; 793b1 (1e:53b1) push hl call GetTileIDList pop hl - call Func_79aae + call CopyPicTiles call Delay3 pop hl ld bc, $0709 @@ -1545,7 +1542,7 @@ AnimationShakeBackAndForth: ; 793b1 (1e:53b1) pop af call GetTileIDList pop hl - call Func_79aae + call CopyPicTiles call Delay3 pop hl ld bc, $0709 @@ -1562,7 +1559,7 @@ AnimationMoveMonHorizontally: ; 793f9 (1e:53f9) ; Shifts the mon's sprite horizontally to a fixed location. Used by lots of ; animations like Tackle/Body Slam. call AnimationHideMonPic - ld a, [H_WHOSETURN] ; $fff3 + ld a, [H_WHOSETURN] and a hlCoord 2, 5 jr z, .asm_79407 @@ -1572,13 +1569,13 @@ AnimationMoveMonHorizontally: ; 793f9 (1e:53f9) push hl call GetTileIDList pop hl - call Func_79aae - ld c, $3 + call CopyPicTiles + ld c, 3 jp DelayFrames AnimationResetMonPosition: ; 79415 (1e:5415) ; Resets the mon's sprites to be located at the normal coordinates. - ld a, [H_WHOSETURN] ; $fff3 + ld a, [H_WHOSETURN] and a ld a, $66 jr z, .asm_7941e @@ -1590,24 +1587,24 @@ AnimationResetMonPosition: ; 79415 (1e:5415) AnimationSpiralBallsInward: ; 79424 (1e:5424) ; Creates an effect that looks like energy balls sprialing into the ; player mon's sprite. Used in Focus Energy, for example. - ld a, [H_WHOSETURN] ; $fff3 + ld a, [H_WHOSETURN] and a jr z, .asm_79435 ld a, $d8 ld [wd08a], a ld a, $50 - ld [W_SUBANIMTRANSFORM], a ; W_SUBANIMTRANSFORM + ld [W_SUBANIMTRANSFORM], a jr .asm_7943c .asm_79435 xor a ld [wd08a], a - ld [W_SUBANIMTRANSFORM], a ; W_SUBANIMTRANSFORM + ld [W_SUBANIMTRANSFORM], a .asm_7943c ld d, $7a ld c, $3 xor a call Func_797e8 - ld hl, SpiralBallAnimationCoordinates ; $5476 + ld hl, SpiralBallAnimationCoordinates .asm_79447 push hl ld c, $3 @@ -1621,7 +1618,7 @@ AnimationSpiralBallsInward: ; 79424 (1e:5424) ld [de], a inc de inc hl - ld a, [W_SUBANIMTRANSFORM] ; W_SUBANIMTRANSFORM + ld a, [W_SUBANIMTRANSFORM] add [hl] ld [de], a inc hl @@ -1630,7 +1627,7 @@ AnimationSpiralBallsInward: ; 79424 (1e:5424) inc de dec c jr nz, .asm_7944d - ld c, $5 + ld c, 5 call DelayFrames pop hl inc hl @@ -1674,7 +1671,7 @@ AnimationSquishMonPic: ; 794a1 (1e:54a1) ld c, $4 .asm_794a3 push bc - ld a, [H_WHOSETURN] ; $fff3 + ld a, [H_WHOSETURN] and a jr z, .asm_794b1 hlCoord 16, 0 @@ -1687,11 +1684,11 @@ AnimationSquishMonPic: ; 794a1 (1e:54a1) push de xor a ld [wd09f], a - call Func_794d4 + call _AnimationSquishMonPic pop hl ld a, $1 ld [wd09f], a - call Func_794d4 + call _AnimationSquishMonPic pop bc dec c jr nz, .asm_794a3 @@ -1699,7 +1696,7 @@ AnimationSquishMonPic: ; 794a1 (1e:54a1) ld c, $2 jp DelayFrame -Func_794d4: ; 794d4 (1e:54d4) +_AnimationSquishMonPic: ; 794d4 (1e:54d4) ld c, $7 .asm_794d6 push bc @@ -1727,7 +1724,7 @@ Func_794d4: ; 794d4 (1e:54d4) AnimationShootBallsUpward: ; 794f9 (1e:54f9) ; Shoots one pillar of "energy" balls upwards. Used in Teleport/Sky Attack ; animations. - ld a, [H_WHOSETURN] ; $fff3 + ld a, [H_WHOSETURN] and a jr z, .asm_79503 ld bc, $80 @@ -1736,14 +1733,14 @@ AnimationShootBallsUpward: ; 794f9 (1e:54f9) ld bc, $3028 .asm_79506 ld a, b - ld [W_BASECOORDY], a ; wd082 + ld [W_BASECOORDY], a ld a, c - ld [W_BASECOORDX], a ; wd081 + ld [W_BASECOORDX], a ld bc, $501 - call Func_79517 + call _AnimationShootBallsUpward jp AnimationCleanOAM -Func_79517: ; 79517 (1e:5517) +_AnimationShootBallsUpward: ; 79517 (1e:5517) push bc xor a ld [wd09f], a @@ -1752,10 +1749,10 @@ Func_79517: ; 79517 (1e:5517) ld d, $7a ld hl, wOAMBuffer push bc - ld a, [W_BASECOORDY] ; wd082 + ld a, [W_BASECOORDY] ld e, a .asm_7952a - call Func_79329 + call Animations_79329 dec b jr nz, .asm_7952a call DelayFrame @@ -1766,7 +1763,7 @@ Func_79517: ; 79517 (1e:5517) push bc ld hl, wOAMBuffer .asm_7953c - ld a, [W_BASECOORDY] ; wd082 + ld a, [W_BASECOORDY] add $8 ld e, a ld a, [hl] @@ -1812,7 +1809,7 @@ AnimationShootManyBallsUpward: ; 79566 (1e:5566) ld [W_BASECOORDX], a ld bc, $0401 push hl - call Func_79517 + call _AnimationShootBallsUpward pop hl jr .loop @@ -1839,7 +1836,7 @@ AnimationMinimizeMon: ; 7959f (1e:559f) pop hl ld de, $194 add hl, de - ld de, MinimizedMonSprite ; $55c4 + ld de, MinimizedMonSprite ld c, $5 .asm_795b4 ld a, [de] @@ -1867,8 +1864,8 @@ AnimationSlideMonDownAndHide: ; 795c9 (1e:55c9) push af call GetTileIDList call GetMonSpriteTileMapPointerFromRowCount - call Func_79aae - ld c, $8 + call CopyPicTiles + ld c, 8 call DelayFrames pop af inc a @@ -1882,8 +1879,8 @@ AnimationSlideMonDownAndHide: ; 795c9 (1e:55c9) call FillMemory jp Func_79652 -Func_795f8: ; 795f8 (1e:55f8) - ld a, [H_WHOSETURN] ; $fff3 +AnimationSlideMonLeft: ; 795f8 (1e:55f8) + ld a, [H_WHOSETURN] and a jr z, .asm_79602 hlCoord 12, 0 @@ -1898,7 +1895,7 @@ Func_795f8: ; 795f8 (1e:55f8) .asm_7960a ld c, $8 .asm_7960c - ld a, [H_WHOSETURN] ; $fff3 + ld a, [H_WHOSETURN] and a jr z, .asm_79616 call Func_7963c @@ -1915,7 +1912,7 @@ Func_795f8: ; 795f8 (1e:55f8) pop de dec b jr nz, .asm_7960a - ld a, [W_SUBANIMTRANSFORM] ; W_SUBANIMTRANSFORM + ld a, [W_SUBANIMTRANSFORM] ld c, a call DelayFrames pop hl @@ -1945,11 +1942,11 @@ AnimationSlideMonHalfLeft: ; 79645 (1e:5645) ld e, $4 ld a, $4 ld [W_SUBANIMTRANSFORM], a - call Func_795f8 + call AnimationSlideMonLeft jp Delay3 Func_79652: ; 79652 (1e:5652) - ld a, [H_WHOSETURN] ; $fff3 + ld a, [H_WHOSETURN] and a ld hl, vBackPic jr z, .asm_7965d @@ -2028,7 +2025,7 @@ AnimationSubstitute: ; 796e0 (1e:56e0) call FillMemory ld a, [$fff3] and a - jr z, .asm_79715 ; 0x796ed $26 + jr z, .asm_79715 ld hl, SlowbroSprite ; facing down sprite ld de, wTempPic + $120 call CopySlowbroSpriteData @@ -2065,13 +2062,13 @@ CopySlowbroSpriteData: ; 7973f (1e:573f) jp FarCopyData2 Func_79747: ; 79747 (1e:5747) - ld a, [H_WHOSETURN] ; $fff3 + ld a, [H_WHOSETURN] and a ld hl, wccf7 - ld a, [W_PLAYERBATTSTATUS2] ; W_PLAYERBATTSTATUS2 + ld a, [W_PLAYERBATTSTATUS2] jr z, .asm_79758 ld hl, wccf3 - ld a, [W_ENEMYBATTSTATUS2] ; W_ENEMYBATTSTATUS2 + ld a, [W_ENEMYBATTSTATUS2] .asm_79758 push hl bit 4, a @@ -2102,7 +2099,7 @@ AnimationBoundUpAndDown: ; 7977a (1e:577a) call AnimationSlideMonDown pop bc dec c - jr nz, .asm_7977c ; 0x79782 $f8 + jr nz, .asm_7977c jp AnimationShowMonPic AnimationTransformMon: ; 79787 (1e:5787) @@ -2114,7 +2111,7 @@ AnimationTransformMon: ; 79787 (1e:5787) ld [wHPBarMaxHP], a Func_79793: ; 79793 (1e:5793) - ld a, [H_WHOSETURN] ; $fff3 + ld a, [H_WHOSETURN] and a jr z, .asm_797b0 ld a, [wHPBarMaxHP] @@ -2137,7 +2134,7 @@ Func_79793: ; 79793 (1e:5793) xor a call GetTileIDList call GetMonSpriteTileMapPointerFromRowCount - call Func_79aae + call CopyPicTiles pop af ld [wBattleMonSpecies2], a .asm_797d3 @@ -2147,11 +2144,11 @@ Func_79793: ; 79793 (1e:5793) AnimationHideEnemyMonPic: ; 797d8 (1e:57d8) ; Hides the enemy mon's sprite xor a - ld [H_AUTOBGTRANSFERENABLED], a ; $ffba - ld hl, AnimationHideMonPic ; $5801 + ld [H_AUTOBGTRANSFERENABLED], a + ld hl, AnimationHideMonPic call CallWithTurnFlipped ld a, $1 - ld [H_AUTOBGTRANSFERENABLED], a ; $ffba + ld [H_AUTOBGTRANSFERENABLED], a jp Delay3 Func_797e8: ; 797e8 (1e:57e8) @@ -2163,17 +2160,17 @@ Func_797e8: ; 797e8 (1e:57e8) pop bc xor a ld e, a - ld [W_BASECOORDX], a ; wd081 + ld [W_BASECOORDX], a ld hl, wOAMBuffer .asm_797fa - call Func_79329 + call Animations_79329 dec c jr nz, .asm_797fa ret AnimationHideMonPic: ; 79801 (1e:5801) ; Hides the mon's sprite. - ld a, [H_WHOSETURN] ; $fff3 + ld a, [H_WHOSETURN] and a jr z, .asm_7980a ld a, $c @@ -2269,13 +2266,15 @@ Func_79862: ; 79862 (1e:5862) jr nz, Func_79862 ret -Func_79869: ; 79869 (1e:5869) +; get the sound of the move id in b +GetMoveSoundB: ; 79869 (1e:5869) ld a, b - call Func_7986f + call GetMoveSound ld b, a ret -Func_7986f: ; 7986f (1e:586f) +; get the sound of the move id in a +GetMoveSound: ; 7986f (1e:586f) ld hl,MoveSoundTable ld e,a ld d,0 @@ -2496,7 +2495,7 @@ MoveSoundTable: ; 798bc (1e:58bc) db (SFX_08_4b - SFX_Headers_08) / 3,$00,$80 db (SFX_08_4b - SFX_Headers_08) / 3,$00,$80 -Func_79aae: ; 79aae (1e:5aae) +CopyPicTiles: ; 79aae (1e:5aae) ld a, [H_WHOSETURN] and a ld a, $31 ; base tile ID of player mon sprite @@ -2507,15 +2506,17 @@ Func_79aae: ; 79aae (1e:5aae) ld [hBaseTileID], a jr asm_79acb -Func_79aba: ; 79aba (1e:5aba) +; copy the tiles used when a mon is being sent out +; and "growing" out of the pokeball +CopyGrowingMonTiles: ; 79aba (1e:5aba) call GetPredefRegisters ld a, [wcd6c] and a jr nz, .asm_79ac8 - ld de, Unknown_79b02 ; $5b02 + ld de, Unknown_79b02 ; 5x5 jr asm_79acb .asm_79ac8 - ld de, Unknown_79b1b ; $5b1b + ld de, Unknown_79b1b ; 3x3 asm_79acb: ; 79acb (1e:5acb) xor a ld [H_AUTOBGTRANSFERENABLED], a @@ -2811,7 +2812,7 @@ AnimationShakeEnemyHUD: ; 79d77 (1e:5d77) call Func_79e0d ld a, $38 ld [hWY], a - call Func_792fd + call _AnimationShakeEnemyHUD ld hl, vBGMap0 call Func_79e0d call AnimationHideMonPic @@ -2854,12 +2855,12 @@ Func_79de9: ; 79de9 (1e:5de9) ld a, [wTrainerSpriteOffset] add d ld [hSCX], a - ld c, $2 + ld c, 2 call DelayFrames ld a, [wTrainerSpriteOffset] sub d ld [hSCX], a - ld c, $2 + ld c, 2 call DelayFrames dec e jr nz, .asm_79dee @@ -2926,7 +2927,7 @@ TossBallAnimation: ; 79e16 (1e:5e16) ld [W_ANIMATIONID],a call PlayAnimation ld a,(SFX_08_43 - SFX_Headers_08) / 3 - call PlaySound ; play sound effect + call PlaySound ld a,BLOCKBALL_ANIM ld [W_ANIMATIONID],a jp PlayAnimation diff --git a/engine/battle/bank_e_misc.asm b/engine/battle/bank_e_misc.asm index 78b27108..80fa971a 100644..100755 --- a/engine/battle/bank_e_misc.asm +++ b/engine/battle/bank_e_misc.asm @@ -52,40 +52,40 @@ FormatMovesString: ; 39b87 (e:5b87) ret ; XXX this is called in a few places, but it doesn't appear to do anything useful -Func_39bd5: ; 39bd5 (e:5bd5) +InitList: ; 39bd5 (e:5bd5) ld a, [wd11b] cp $1 - jr nz, .asm_39be6 + jr nz, .notEnemy ld hl, wEnemyPartyCount ld de, wEnemyMonOT ld a, ENEMYOT_NAME - jr .asm_39c18 -.asm_39be6 + jr .done +.notEnemy cp $4 - jr nz, .calcAttackStat4 + jr nz, .notPlayer ld hl, wPartyCount ld de, wPartyMonOT ld a, PLAYEROT_NAME - jr .asm_39c18 -.calcAttackStat4 + jr .done +.notPlayer cp $5 - jr nz, .asm_39c02 + jr nz, .notMonster ld hl, wStringBuffer2 + 11 ld de, MonsterNames ld a, MONSTER_NAME - jr .asm_39c18 -.asm_39c02 + jr .done +.notMonster cp $2 - jr nz, .asm_39c10 + jr nz, .notBag ld hl, wNumBagItems ld de, ItemNames ld a, ITEM_NAME - jr .asm_39c18 -.asm_39c10 + jr .done +.notBag ld hl, wStringBuffer2 + 11 ld de, ItemNames ld a, ITEM_NAME -.asm_39c18 +.done ld [wNameListType], a ld a, l ld [wList], a @@ -119,4 +119,4 @@ GetMonSpecies: ; 39c37 (e:5c37) add hl, de ld a, [hl] ld [wcf91], a - ret
\ No newline at end of file + ret diff --git a/engine/battle/battle_transitions.asm b/engine/battle/battle_transitions.asm index f1aa4161..b231459d 100644 --- a/engine/battle/battle_transitions.asm +++ b/engine/battle/battle_transitions.asm @@ -352,7 +352,7 @@ BattleTransition_FlashScreen_: ; 70b5d (1c:4b5d) cp $1 jr z, .done ld [rBGP], a - ld c, $2 + ld c, 2 call DelayFrames jr .loop .done @@ -389,13 +389,13 @@ BattleTransition_Shrink: ; 70b7f (1c:4b7f) call BattleTransition_CopyTiles2 ld a, $1 ld [H_AUTOBGTRANSFERENABLED], a - ld c, $6 + ld c, 6 call DelayFrames pop bc dec c jr nz, .loop call BattleTransition_BlackScreen - ld c, $a + ld c, 10 jp DelayFrames ; used for high level trainer dungeon battles @@ -427,7 +427,7 @@ BattleTransition_Split: ; 70bca (1c:4bca) dec c jr nz, .loop call BattleTransition_BlackScreen - ld c, $a + ld c, 10 jp DelayFrames BattleTransition_CopyTiles1: ; 70c12 (1c:4c12) diff --git a/engine/battle/common_text.asm b/engine/battle/common_text.asm index 9a00bd98..11309a86 100644 --- a/engine/battle/common_text.asm +++ b/engine/battle/common_text.asm @@ -1,8 +1,8 @@ PrintBeginningBattleText: ; 58d99 (16:4d99) - ld a, [W_ISINBATTLE] ; W_ISINBATTLE + ld a, [W_ISINBATTLE] dec a jr nz, .trainerBattle - ld a, [W_CURMAP] ; W_CURMAP + ld a, [W_CURMAP] cp POKEMONTOWER_3 jr c, .notPokemonTower cp LAVENDER_HOUSE_1 @@ -11,7 +11,7 @@ PrintBeginningBattleText: ; 58d99 (16:4d99) ld a, [wEnemyMonSpecies2] call PlayCry ld hl, WildMonAppearedText - ld a, [W_MOVEMISSED] ; W_MOVEMISSED + ld a, [W_MOVEMISSED] and a jr z, .notFishing ld hl, HookedMonAttackedText @@ -19,7 +19,7 @@ PrintBeginningBattleText: ; 58d99 (16:4d99) jr .wildBattle .trainerBattle call .playSFX - ld c, $14 + ld c, 20 call DelayFrames ld hl, TrainerWantsToFightText .wildBattle @@ -139,22 +139,22 @@ PrintSendOutMonMessage: ; 58e59 (16:4e59) GoText: ; 58eae (16:4eae) TX_FAR _GoText - db $08 ; asm + TX_ASM jr PrintPlayerMon1Text DoItText: ; 58eb5 (16:4eb5) TX_FAR _DoItText - db $08 ; asm + TX_ASM jr PrintPlayerMon1Text GetmText: ; 58ebc (16:4ebc) TX_FAR _GetmText - db $08 ; asm + TX_ASM jr PrintPlayerMon1Text EnemysWeakText: ; 58ec3 (16:4ec3) TX_FAR _EnemysWeakText - db $08 ; asm + TX_ASM PrintPlayerMon1Text: ld hl, PlayerMon1Text @@ -170,7 +170,7 @@ RetreatMon: ; 58ed1 (16:4ed1) PlayerMon2Text: ; 58ed7 (16:4ed7) TX_FAR _PlayerMon2Text - db $08 ; asm + TX_ASM push de push bc ld hl, wEnemyMonHP + 1 @@ -216,17 +216,17 @@ PlayerMon2Text: ; 58ed7 (16:4ed7) EnoughText: ; 58f25 (16:4f25) TX_FAR _EnoughText - db $08 ; asm + TX_ASM jr PrintComeBackText OKExclamationText: ; 58f2c (16:4f2c) TX_FAR _OKExclamationText - db $08 ; asm + TX_ASM jr PrintComeBackText GoodText: ; 58f33 (16:4f33) TX_FAR _GoodText - db $08 ; asm + TX_ASM jr PrintComeBackText PrintComeBackText: ; 58f3a (16:4f3a) diff --git a/engine/battle/core.asm b/engine/battle/core.asm index 04a6de1c..ec67d094 100755 --- a/engine/battle/core.asm +++ b/engine/battle/core.asm @@ -177,7 +177,7 @@ SlidePlayerAndEnemySilhouettesOnScreen: ; 3c04c (f:404c) ld a, $31 ld [$ffe1], a hlCoord 1, 5 - predef Func_3f0c6 + predef CopyUncompressedPicToTilemap xor a ld [hWY], a ld [rWY], a @@ -620,7 +620,7 @@ HandlePoisonBurnLeechSeed: ; 3c3bd (f:43bd) or [hl] ret nz ; test if fainted call DrawHUDsAndHPBars - ld c, $14 + ld c, 20 call DelayFrames xor a ret @@ -823,7 +823,7 @@ HandleEnemyMonFainted: ; 3c525 (f:4525) ld [wcd6a], a jp MainInBattleLoop -FaintEnemyPokemon ; 0x3c567 +FaintEnemyPokemon: ; 0x3c567 call ReadPlayerMonCurHPAndStatus ld a, [W_ISINBATTLE] dec a @@ -1020,10 +1020,10 @@ TrainerBattleVictory: ; 3c696 (f:4696) cp LINK_STATE_BATTLING ret z call ScrollTrainerPicAfterBattle - ld c, $28 + ld c, 40 call DelayFrames call PrintEndBattleText -; win money +; win money ld hl, MoneyForWinningText call PrintText ld de, wPlayerMoney + 2 @@ -1218,7 +1218,7 @@ HandlePlayerBlackOut: ; 3c837 (f:4837) ld bc, $815 call ClearScreenArea call ScrollTrainerPicAfterBattle - ld c, $28 + ld c, 40 call DelayFrames ld hl, Sony1WinText call PrintText @@ -1506,7 +1506,7 @@ EnemySendOutFirstMon: ; 3c92a (f:492a) ld a,$CF ld [$FFE1],a hlCoord 15, 6 - predef Func_3f073 + predef AnimateSendingOutMon ld a,[wEnemyMonSpecies2] call PlayCry call DrawEnemyHUDAndHPBar @@ -1642,7 +1642,7 @@ TryRunningFromBattle: ; 3cab9 (f:4ab9) ld b, a ld a, [H_QUOTIENT + 3] cp b - jr nc, .canEscape ; if the random value was less than or equal to the quotient + jr nc, .canEscape ; if the random value was less than or equal to the quotient ; plus 30 times the number of attempts, the player can escape ; can't escape ld a, $1 @@ -1836,7 +1836,7 @@ SendOutMon: ; 3cc91 (f:4c91) ld a, POOF_ANIM call PlayMoveAnimation hlCoord 4, 11 - predef Func_3f073 + predef AnimateSendingOutMon ld a, [wcf91] call PlayCry call PrintEmptyString @@ -1852,8 +1852,8 @@ AnimateRetreatingPlayerMon: ; 3ccfa (f:4cfa) xor a ld [wcd6c], a ld [H_DOWNARROWBLINKCNT1], a - predef Func_79aba - ld c, $4 + predef CopyGrowingMonTiles + ld c, 4 call DelayFrames call .clearScreenArea hlCoord 4, 9 @@ -1862,7 +1862,7 @@ AnimateRetreatingPlayerMon: ; 3ccfa (f:4cfa) ld [wcd6c], a xor a ld [H_DOWNARROWBLINKCNT1], a - predef Func_79aba + predef CopyGrowingMonTiles call Delay3 call .clearScreenArea ld a, $4c @@ -2110,12 +2110,12 @@ DisplayBattleMenu: ; 3ceb3 (f:4eb3) ; the following simulates the keystrokes by drawing menus on screen hlCoord 9, 14 ld [hl], "▶" - ld c, $50 + ld c, 80 call DelayFrames ld [hl], $7f hlCoord 9, 16 ld [hl], "▶" - ld c, $32 + ld c, 50 call DelayFrames ld [hl], $ec ld a, $2 ; select the "ITEM" menu @@ -2490,7 +2490,7 @@ PartyMenuOrRockOrRun: SwitchPlayerMon: ; 3d1ba (f:51ba) callab RetreatMon - ld c, $32 + ld c, 50 call DelayFrames call AnimateRetreatingPlayerMon ld a, [wWhichPokemon] @@ -2815,7 +2815,7 @@ AnyMoveToSelect: ; 3d3f5 (f:53f5) .asm_3d423 ld hl, NoMovesLeftText call PrintText - ld c, $3c + ld c, 60 call DelayFrames xor a ret @@ -2930,8 +2930,8 @@ PrintMenuItem: ; 3d4b6 (f:54b6) ld c, a ld b, $0 ; which item in the menu is the cursor pointing to? (0-3) add hl, bc ; point to the item (move) in memory - ld a, [hl] - ld [wPlayerSelectedMove], a ; update wPlayerSelectedMove even if the move + ld a, [hl] + ld [wPlayerSelectedMove], a ; update wPlayerSelectedMove even if the move ; isn't actually selected (just pointed to by the cursor) ld a, [wPlayerMonNumber] ld [wWhichPokemon], a @@ -2947,7 +2947,7 @@ PrintMenuItem: ; 3d4b6 (f:54b6) ld a, [hl] and $3f ld [wcd6d], a -; print TYPE/<type> and <curPP>/<maxPP> +; print TYPE/<type> and <curPP>/<maxPP> hlCoord 1, 9 ld de, TypeText call PlaceString @@ -2963,7 +2963,7 @@ PrintMenuItem: ; 3d4b6 (f:54b6) ld de, wd11e ld bc, $102 call PrintNumber - call GetCurrentMove + call GetCurrentMove hlCoord 2, 10 predef PrintMoveType .moveDisabled @@ -3174,13 +3174,13 @@ PlayerCanExecuteMove: ; 3d6b0 (f:56b0) ld hl,ResidualEffects1 ld de,1 call IsInArray - jp c,JumpMoveEffect ; ResidualEffects1 moves skip damage calculation and accuracy tests - ; unless executed as part of their exclusive effect functions + jp c,JumpMoveEffect ; ResidualEffects1 moves skip damage calculation and accuracy tests + ; unless executed as part of their exclusive effect functions ld a,[W_PLAYERMOVEEFFECT] ld hl,SpecialEffectsCont ld de,1 call IsInArray - call c,JumpMoveEffect ; execute the effects of SpecialEffectsCont moves (e.g. Wrap, Thrash) but don't skip anything + call c,JumpMoveEffect ; execute the effects of SpecialEffectsCont moves (e.g. Wrap, Thrash) but don't skip anything PlayerCalcMoveDamage: ; 3d6dc (f:56dc) ld a,[W_PLAYERMOVEEFFECT] ld hl,SetDamageEffects @@ -3203,7 +3203,7 @@ handleIfPlayerMoveMissed and a jr z,getPlayerAnimationType ld a,[W_PLAYERMOVEEFFECT] - sub a,EXPLODE_EFFECT + sub a,EXPLODE_EFFECT jr z,playPlayerMoveAnimation ; don't play any animation if the move missed, unless it was EXPLODE_EFFECT jr playerCheckIfFlyOrChargeEffect getPlayerAnimationType @@ -3232,7 +3232,7 @@ playPlayerMoveAnimation call nz,Bankswitch jr MirrorMoveCheck playerCheckIfFlyOrChargeEffect - ld c,$1E + ld c,30 call DelayFrames ld a,[W_PLAYERMOVEEFFECT] cp a,FLY_EFFECT @@ -3298,7 +3298,7 @@ MirrorMoveCheck ld a,[wPlayerNumAttacksLeft] dec a ld [wPlayerNumAttacksLeft],a - jp nz,getPlayerAnimationType ; for multi-hit moves, apply attack until PlayerNumAttacksLeft hits 0 or the enemy faints. + jp nz,getPlayerAnimationType ; for multi-hit moves, apply attack until PlayerNumAttacksLeft hits 0 or the enemy faints. ; damage calculation and accuracy tests only happen for the first hit res AttackingMultipleTimes,[hl] ; clear attacking multiple times status when all attacks are over ld hl,MultiHitText @@ -3509,8 +3509,8 @@ CheckPlayerStatusConditions: ; 3d854 (f:5854) .MonHurtItselfOrFullyParalysed ld hl,W_PLAYERBATTSTATUS1 ld a,[hl] - ; clear bide, thrashing, charging up, and trapping moves such as warp (already cleared for confusion damage) - and $ff ^ ((1 << StoringEnergy) | (1 << ThrashingAbout) | (1 << ChargingUp) | (1 << UsingTrappingMove)) + ; clear bide, thrashing, charging up, and trapping moves such as warp (already cleared for confusion damage) + and $ff ^ ((1 << StoringEnergy) | (1 << ThrashingAbout) | (1 << ChargingUp) | (1 << UsingTrappingMove)) ld [hl],a ld a,[W_PLAYERMOVEEFFECT] cp a,FLY_EFFECT @@ -3588,7 +3588,7 @@ CheckPlayerStatusConditions: ; 3d854 (f:5854) ld hl,wPlayerNumAttacksLeft dec [hl] ; did Thrashing About counter hit 0? ld hl,PlayerCalcMoveDamage ; skip DecrementPP - jp nz,.returnToHL + jp nz,.returnToHL push hl ld hl,W_PLAYERBATTSTATUS1 res ThrashingAbout,[hl] ; no longer thrashing about @@ -3609,7 +3609,7 @@ CheckPlayerStatusConditions: ; 3d854 (f:5854) ld a,[wPlayerNumAttacksLeft] dec a ; did multi-turn move end? ld [wPlayerNumAttacksLeft],a - ld hl,getPlayerAnimationType ; if it didn't, skip damage calculation (deal damage equal to last hit), + ld hl,getPlayerAnimationType ; if it didn't, skip damage calculation (deal damage equal to last hit), ; DecrementPP and MoveHitTest jp nz,.returnToHL jp .returnToHL @@ -3706,7 +3706,7 @@ PrintMoveIsDisabledText: ; 3da88 (f:5a88) ld de, W_ENEMYBATTSTATUS1 .removeChargingUp ld a, [de] - res ChargingUp, a ; end the pokemon's + res ChargingUp, a ; end the pokemon's ld [de], a ld a, [hl] ld [wd11e], a @@ -3766,9 +3766,14 @@ PrintMonName1Text: ; 3daf5 (f:5af5) ld hl, MonName1Text jp PrintText +; this function wastes time calling DetermineExclamationPointTextNum +; and choosing between Used1Text and Used2Text, even though +; those text strings are identical and both continue at PrintInsteadText +; this likely had to do with Japanese grammar that got translated, +; but the functionality didn't get removed MonName1Text: ; 3dafb (f:5afb) TX_FAR _MonName1Text - db $08 ; asm + TX_ASM ld a, [H_WHOSETURN] and a ld a, [W_PLAYERMOVENUM] @@ -3779,7 +3784,7 @@ MonName1Text: ; 3dafb (f:5afb) .asm_3db11 ld [hl], a ld [wd11e], a - call Func_3db85 + call DetermineExclamationPointTextNum ld a, [wMonIsDisobedient] and a ld hl, Used2Text @@ -3793,33 +3798,35 @@ MonName1Text: ; 3dafb (f:5afb) Used1Text: ; 3db2d (f:5b2d) TX_FAR _Used1Text - db $08 ; asm + TX_ASM jr PrintInsteadText Used2Text: ; 3db34 (f:5b34) TX_FAR _Used2Text - db $08 ; asm + TX_ASM + ; fall through PrintInsteadText: ; 3db39 (f:5b39) ld a, [wMonIsDisobedient] and a - jr z, PrintCF4BText + jr z, PrintMoveName ld hl, InsteadText ret InsteadText: ; 3db43 (f:5b43) TX_FAR _InsteadText - db $08 ; asm + TX_ASM + ; fall through -PrintCF4BText: ; 3db48 (f:5b48) - ld hl, CF4BText +PrintMoveName: ; 3db48 (f:5b48) + ld hl, _PrintMoveName ret -CF4BText: ; 3db4c (f:5b4c) +_PrintMoveName: ; 3db4c (f:5b4c) TX_FAR _CF4BText - db $08 ; asm + TX_ASM ld hl, ExclamationPointPointerTable - ld a, [wd11e] + ld a, [wd11e] ; exclamation point num add a push bc ld b, $0 @@ -3858,29 +3865,36 @@ ExclamationPoint5Text: ; 3db80 (f:5b80) TX_FAR _ExclamationPoint5Text db "@" -Func_3db85: ; 3db85 (f:5b85) +; this function does nothing useful +; if the move being used is in set [1-4] from ExclamationPointMoveSets, +; use ExclamationPoint[1-4]Text +; otherwise, use ExclamationPoint5Text +; but all five text strings are identical +; this likely had to do with Japanese grammar that got translated, +; but the functionality didn't get removed +DetermineExclamationPointTextNum: ; 3db85 (f:5b85) push bc - ld a, [wd11e] ; move number + ld a, [wd11e] ; move ID ld c, a ld b, $0 - ld hl, UnknownMovesList_3dba3 -.asm_3db8f + ld hl, ExclamationPointMoveSets +.loop ld a, [hli] cp $ff - jr z, .asm_3db9d + jr z, .done cp c - jr z, .asm_3db9d + jr z, .done and a - jr nz, .asm_3db8f + jr nz, .loop inc b - jr .asm_3db8f -.asm_3db9d + jr .loop +.done ld a, b - ld [wd11e], a + ld [wd11e], a ; exclamation point num pop bc ret -UnknownMovesList_3dba3: ; 3dba3 (f:5ba3) +ExclamationPointMoveSets: ; 3dba3 (f:5ba3) db SWORDS_DANCE, GROWTH db $00 db RECOVER, BIDE, SELFDESTRUCT, AMNESIA @@ -3923,7 +3937,7 @@ PrintMoveFailureText: ; 3dbe2 (f:5be2) ; if you get here, the mon used jump kick or hi jump kick and missed ld hl, W_DAMAGE ; since the move missed, W_DAMAGE will always contain 0 at this point. - ; Thus, recoil damage will always be equal to 1 + ; Thus, recoil damage will always be equal to 1 ; even if it was intended to be potential damage/8. ld a, [hli] ld b, [hl] @@ -3990,7 +4004,7 @@ PrintCriticalOHKOText: ; 3dc5c (f:5c5c) xor a ld [wCriticalHitOrOHKO], a .done - ld c, $14 + ld c, 20 jp DelayFrames CriticalOHKOTextPointers: ; 3dc7a (f:5c7a) @@ -4677,7 +4691,7 @@ CriticalHitTest: ; 3e023 (f:6023) jr z, .calcCriticalHitProbability ld hl, W_ENEMYMOVEPOWER ld de, W_ENEMYBATTSTATUS2 -.calcCriticalHitProbability ; 0x3e04f +.calcCriticalHitProbability ld a, [hld] ; read base power from RAM and a ret z ; do nothing if zero @@ -4776,7 +4790,7 @@ HandleCounterMove: ; 3e093 (f:6093) ld a,[hli] or [hl] ret z ; If we made it here, Counter still misses if the last move used in battle did no damage to its target. - ; W_DAMAGE is shared by both players, so Counter may strike back damage dealt by the Counter user itself + ; W_DAMAGE is shared by both players, so Counter may strike back damage dealt by the Counter user itself ; if the conditions meet, even though 99% of the times damage will come from the target. ; if it did damage, double it ld a,[hl] @@ -5037,9 +5051,9 @@ ApplyAttackToPlayerPokemonDone AttackSubstitute: ; 3e25e (f:625e) ; Unlike the two ApplyAttackToPokemon functions, Attack Substitute is shared by player and enemy. ; Self-confusion damage as well as Hi-Jump Kick and Jump Kick recoil cause a momentary turn swap before being applied. -; If the user has a Substitute up and would take damage because of that, +; If the user has a Substitute up and would take damage because of that, ; damage will be applied to the other player's Substitute. -; Normal recoil such as from Double-Edge isn't affected by this glitch, +; Normal recoil such as from Double-Edge isn't affected by this glitch, ; because this function is never called in that case. ld hl,SubstituteTookDamageText @@ -5064,7 +5078,7 @@ AttackSubstitute: ; 3e25e (f:625e) ld [de],a ret nc .substituteBroke -; If the target's Substitute breaks, W_DAMAGE isn't updated with the amount of HP +; If the target's Substitute breaks, W_DAMAGE isn't updated with the amount of HP ; the Substitute had before being attacked. ld h,b ld l,c @@ -5565,7 +5579,7 @@ CalcHitChance: ; 3e624 (f:6624) ; the second iteration multiplies by the evasion ratio .loop push bc - ld hl, StatModifierRatios ; $76cb ; stat modifier ratios + ld hl, StatModifierRatios ; stat modifier ratios dec b sla b ld c,b @@ -5771,7 +5785,7 @@ playEnemyMoveAnimation: ; 3e7a4 (f:67a4) EnemyCheckIfFlyOrChargeEffect: ; 3e7d1 (f:67d1) call SwapPlayerAndEnemyLevels - ld c, $1e + ld c, 30 call DelayFrames ld a, [W_ENEMYMOVEEFFECT] cp FLY_EFFECT @@ -6023,7 +6037,7 @@ CheckEnemyStatusConditions: ; 3e88f (f:688f) .monHurtItselfOrFullyParalysed ld hl, W_ENEMYBATTSTATUS1 ld a, [hl] - ; clear bide, thrashing about, charging up, and multi-turn moves such as warp + ; clear bide, thrashing about, charging up, and multi-turn moves such as warp and $ff ^ ((1 << StoringEnergy) | (1 << ThrashingAbout) | (1 << ChargingUp) | (1 << UsingTrappingMove)) ld [hl], a ld a, [W_ENEMYMOVEEFFECT] @@ -6119,7 +6133,7 @@ CheckEnemyStatusConditions: ; 3e88f (f:688f) call PrintText ld hl, wEnemyNumAttacksLeft dec [hl] ; did multi-turn move end? - ld hl, GetEnemyAnimationType ; if it didn't, skip damage calculation (deal damage equal to last hit), + ld hl, GetEnemyAnimationType ; if it didn't, skip damage calculation (deal damage equal to last hit), ; DecrementPP and MoveHitTest jp nz, .enemyReturnToHL jp .enemyReturnToHL @@ -6442,7 +6456,7 @@ LoadPlayerBackPic: ; 3ec92 (f:6c92) ld a, $31 ld [$ffe1], a hlCoord 1, 5 - predef_jump Func_3f0c6 + predef_jump CopyUncompressedPicToTilemap ; does nothing since no stats are ever selected (barring glitches) DoubleOrHalveSelectedStats: ; 3ed02 (f:6d02) @@ -6753,8 +6767,8 @@ BattleRandom: push hl push bc push af - -; point to seed 0 so we pick the first number the next time + +; point to seed 0 so we pick the first number the next time xor a ld [wLinkBattleRandomNumberListIndex], a @@ -6763,11 +6777,11 @@ BattleRandom: .loop ld a, [hl] ld c, a -; multiply by 5 +; multiply by 5 add a add a add c -; add 1 +; add 1 inc a ld [hli], a dec b @@ -6782,11 +6796,11 @@ BattleRandom: HandleExplodingAnimation: ; 3eed3 (f:6ed3) ld a, [H_WHOSETURN] and a - ld hl, wEnemyMonType1 ; wcfea + ld hl, wEnemyMonType1 ld de, W_ENEMYBATTSTATUS1 ld a, [W_PLAYERMOVENUM] jr z, .asm_3eeea - ld hl, wBattleMonType1 ; wd019 + ld hl, wBattleMonType1 ld de, W_ENEMYBATTSTATUS1 ld a, [W_ENEMYMOVENUM] .asm_3eeea @@ -6818,14 +6832,15 @@ PlayMoveAnimation: ; 3ef07 (f:6f07) InitBattle: ; 3ef12 (f:6f12) ld a, [W_CUROPPONENT] and a - jr z, asm_3ef23 + jr z, DetermineWildOpponent InitOpponent: ; 3ef18 (f:6f18) ld a, [W_CUROPPONENT] ld [wcf91], a ld [wEnemyMonSpecies2], a - jr asm_3ef3d -asm_3ef23: ; 3ef23 (f:6f23) + jr InitBattleCommon + +DetermineWildOpponent: ; 3ef23 (f:6f23) ld a, [wd732] bit 1, a jr z, .asm_3ef2f @@ -6838,7 +6853,7 @@ asm_3ef23: ; 3ef23 (f:6f23) ret nz callab TryDoWildEncounter ret nz -asm_3ef3d: ; 3ef3d (f:6f3d) +InitBattleCommon: ; 3ef3d (f:6f3d) ld a, [wMapPalOffset] push af ld hl, wd358 @@ -6860,7 +6875,7 @@ asm_3ef3d: ; 3ef3d (f:6f3d) dec a ld [wAICount], a hlCoord 12, 0 - predef Func_3f0c6 + predef CopyUncompressedPicToTilemap ld a, $ff ld [wEnemyMonPartyPos], a ld a, $2 @@ -6914,7 +6929,7 @@ InitWildBattle: ; 3ef8b (f:6f8b) ld [W_TRAINERCLASS], a ld [$ffe1], a hlCoord 12, 0 - predef Func_3f0c6 + predef CopyUncompressedPicToTilemap ; common code that executes after init battle code specific to trainer or wild battles InitBattle_Common: ; 3efeb (f:6feb) @@ -6960,9 +6975,9 @@ InitBattle_Common: ; 3efeb (f:6feb) _LoadTrainerPic: ; 3f04b (f:704b) ; wd033-wd034 contain pointer to pic - ld a, [wTrainerPicPointer] ; wd033 + ld a, [wTrainerPicPointer] ld e, a - ld a, [wTrainerPicPointer + 1] ; wd034 + ld a, [wTrainerPicPointer + 1] ld d, a ; de contains pointer to trainer pic ld a, [wLinkState] and a @@ -6977,13 +6992,14 @@ _LoadTrainerPic: ; 3f04b (f:704b) jp LoadUncompressedSpriteData ; unreferenced -Func_3f069: ; 3f069 (f:7069) +ResetCryModifiers: ; 3f069 (f:7069) xor a ld [wc0f1], a ld [wc0f2], a jp PlaySound -Func_3f073: ; 3f073 (f:7073) +; animtes the mon "growing" out of the pokeball +AnimateSendingOutMon: ; 3f073 (f:7073) ld a, [wPredefRegisters] ld h, a ld a, [wPredefRegisters + 1] @@ -7002,16 +7018,16 @@ Func_3f073: ; 3f073 (f:7073) ld a, $1 ld [wcd6c], a ld bc, $303 - predef Func_79aba - ld c, $4 + predef CopyGrowingMonTiles + ld c, 4 call DelayFrames ld bc, -41 add hl, bc xor a ld [wcd6c], a ld bc, $505 - predef Func_79aba - ld c, $5 + predef CopyGrowingMonTiles + ld c, 5 call DelayFrames ld bc, -41 jr .asm_3f0bf @@ -7021,15 +7037,15 @@ Func_3f073: ; 3f073 (f:7073) add hl, bc ld a, [H_DOWNARROWBLINKCNT1] add $31 - jr asm_3f0d0 + jr CopyUncompressedPicToHL -Func_3f0c6: ; 3f0c6 (f:70c6) +CopyUncompressedPicToTilemap: ; 3f0c6 (f:70c6) ld a, [wPredefRegisters] ld h, a ld a, [wPredefRegisters + 1] ld l, a ld a, [$ffe1] -asm_3f0d0: ; 3f0d0 (f:70d0) +CopyUncompressedPicToHL: ; 3f0d0 (f:70d0) ld bc, $707 ld de, $14 push af @@ -7052,7 +7068,7 @@ asm_3f0d0: ; 3f0d0 (f:70d0) dec b jr nz, .asm_3f0de ret - + .asm_3f0ed push bc ld b, $0 @@ -7342,7 +7358,7 @@ PoisonEffect: ; 3f24f (f:724f) cp POISON_EFFECT ret nz .didntAffect - ld c, $32 + ld c, 50 call DelayFrames jp PrintDidntAffectText @@ -7604,17 +7620,17 @@ StatModifierUpEffect: ; 3f428 (f:7428) add hl, bc pop bc xor a - ld [H_MULTIPLICAND], a + ld [H_MULTIPLICAND], a ld a, [de] ld [H_MULTIPLICAND + 1], a inc de ld a, [de] ld [H_MULTIPLICAND + 2], a ld a, [hli] - ld [H_MULTIPLIER], a + ld [H_MULTIPLIER], a call Multiply ld a, [hl] - ld [H_DIVISOR], a + ld [H_DIVISOR], a ld b, $4 call Divide pop hl @@ -7638,7 +7654,7 @@ UpdateStat: ; 3f4c3 (f:74c3) UpdateStatDone: ; 3f4ca (f:74ca) ld b, c inc b - call Func_3f688 + call PrintStatText ld hl, W_PLAYERBATTSTATUS2 ld de, W_PLAYERMOVENUM ld bc, wccf7 @@ -7694,7 +7710,7 @@ PrintNothingHappenedText: ; 3f522 (f:7522) MonsStatsRoseText: ; 3f528 (f:7528) TX_FAR _MonsStatsRoseText - db $08 ; asm + TX_ASM ld hl, GreatlyRoseText ld a, [H_WHOSETURN] and a @@ -7808,7 +7824,7 @@ StatModifierDownEffect: ; 3f54c (f:754c) jr nz, .recalculateStat ld a, [hl] and a - jp z, Func_3f64d + jp z, CantLowerAnymore_Pop .recalculateStat ; recalculate affected stat ; paralysis and burn penalties, as well as badge boosts are ignored @@ -7822,17 +7838,17 @@ StatModifierDownEffect: ; 3f54c (f:754c) add hl, bc pop bc xor a - ld [H_MULTIPLICAND], a + ld [H_MULTIPLICAND], a ld a, [de] ld [H_MULTIPLICAND + 1], a inc de ld a, [de] ld [H_MULTIPLICAND + 2], a ld a, [hli] - ld [H_MULTIPLIER], a + ld [H_MULTIPLIER], a call Multiply ld a, [hl] - ld [H_DIVISOR], a + ld [H_DIVISOR], a ld b, $4 call Divide pop hl @@ -7856,7 +7872,7 @@ UpdateLoweredStatDone: ; 3f62c (f:762c) ld b, c inc b push de - call Func_3f688 + call PrintStatText pop de ld a, [de] cp $44 @@ -7876,7 +7892,7 @@ UpdateLoweredStatDone: ; 3f62c (f:762c) call QuarterSpeedDueToParalysis jp HalveAttackDueToBurn -Func_3f64d: ; 3f64d (f:764d) +CantLowerAnymore_Pop: ; 3f64d (f:764d) pop de pop hl inc [hl] @@ -7896,7 +7912,7 @@ MoveMissed: ; 3f65a (f:765a) MonsStatsFellText: ; 3f661 (f:7661) TX_FAR _MonsStatsFellText - db $08 ; asm + TX_ASM ld hl, FellText ld a, [H_WHOSETURN] and a @@ -7919,7 +7935,7 @@ FellText: ; 3f683 (f:7683) TX_FAR _FellText db "@" -Func_3f688: ; 3f688 (f:7688) +PrintStatText: ; 3f688 (f:7688) ld hl, StatsTextStrings ld c, $50 .asm_3f68d @@ -8028,7 +8044,7 @@ SwitchAndTeleportEffect: ; 3f739 (f:7739) srl b cp b jr nc, .asm_3f76e - ld c, $32 + ld c, 50 call DelayFrames ld a, [W_PLAYERMOVENUM] cp TELEPORT @@ -8043,7 +8059,7 @@ SwitchAndTeleportEffect: ; 3f739 (f:7739) ld a, [W_PLAYERMOVENUM] jr .asm_3f7e4 .asm_3f77e - ld c, $32 + ld c, 50 call DelayFrames ld hl, IsUnaffectedText ld a, [W_PLAYERMOVENUM] @@ -8070,7 +8086,7 @@ SwitchAndTeleportEffect: ; 3f739 (f:7739) srl b cp b jr nc, .asm_3f7c1 - ld c, $32 + ld c, 50 call DelayFrames ld a, [W_ENEMYMOVENUM] cp TELEPORT @@ -8085,7 +8101,7 @@ SwitchAndTeleportEffect: ; 3f739 (f:7739) ld a, [W_ENEMYMOVENUM] jr .asm_3f7e4 .asm_3f7d1 - ld c, $32 + ld c, 50 call DelayFrames ld hl, IsUnaffectedText ld a, [W_ENEMYMOVENUM] @@ -8095,7 +8111,7 @@ SwitchAndTeleportEffect: ; 3f739 (f:7739) .asm_3f7e4 push af call PlayBattleAnimation - ld c, $14 + ld c, 20 call DelayFrames pop af ld hl, RanFromBattleText @@ -8230,7 +8246,7 @@ ChargeEffect: ; 3f88c (f:788c) ChargeMoveEffectText: ; 3f8c8 (f:78c8) TX_FAR _ChargeMoveEffectText - db $08 ; asm + TX_ASM ld a, [wWhichTrade] cp RAZOR_WIND ld hl, MadeWhirlwindText @@ -8287,8 +8303,8 @@ TrappingEffect: ; 3f917 (f:7917) .trappingEffect bit UsingTrappingMove, [hl] ret nz - call ClearHyperBeam ; since this effect is called before testing whether the move will hit, - ; the target won't need to recharge even if the trapping move missed + call ClearHyperBeam ; since this effect is called before testing whether the move will hit, + ; the target won't need to recharge even if the trapping move missed set UsingTrappingMove, [hl] ; mon is now using a trapping move call BattleRandom ; 3/8 chance for 2 and 3 attacks, and 1/8 chance for 4 and 5 attacks and $3 @@ -8346,7 +8362,7 @@ ConfusionSideEffectSuccess: ; 3f96f (f:796f) set Confused, [hl] ; mon is now confused push af call BattleRandom - and $3 + and $3 inc a inc a ld [bc], a ; confusion status will last 2-5 turns @@ -8363,7 +8379,7 @@ BecameConfusedText: ; 3f9a1 (f:79a1) ConfusionEffectFailed: ; 3f9a6 (f:79a6) cp CONFUSION_SIDE_EFFECT ret z - ld c, $32 + ld c, 50 call DelayFrames jp ConditionalPrintButItFailed @@ -8410,7 +8426,7 @@ RageEffect: ; 3f9df (f:79df) ret MimicEffect: ; 3f9ed (f:79ed) - ld c, $32 + ld c, 50 call DelayFrames call MoveHitTest ld a, [W_MOVEMISSED] @@ -8527,12 +8543,12 @@ DisableEffect: ; 3fa8a (f:7a8a) ld a, [H_WHOSETURN] and a ld hl, wBattleMonPP - jr nz, .enemyTurn + jr nz, .enemyTurn ld a, [wLinkState] cp LINK_STATE_BATTLING pop hl ; wEnemyMonMoves jr nz, .playerTurnNotLinkBattle -; .playerTurnLinkBattle +; .playerTurnLinkBattle push hl ld hl, wEnemyMonPP .enemyTurn @@ -8557,7 +8573,7 @@ DisableEffect: ; 3fa8a (f:7a8a) and $7 inc a ; 1-8 turns disabled inc c ; move 1-4 will be disabled - swap c + swap c add c ; map disabled move to high nibble of W_ENEMYDISABLEDMOVE / W_PLAYERDISABLEDMOVE ld [de], a call PlayCurrentMoveAnimation2 @@ -8568,7 +8584,7 @@ DisableEffect: ; 3fa8a (f:7a8a) inc hl ; wEnemyDisabledMoveNumber .printDisableText ld a, [wd11e] ; move number - ld [hl], a + ld [hl], a call GetMoveName ld hl, MoveWasDisabledText jp PrintText @@ -8659,12 +8675,12 @@ ParalyzedMayNotAttackText: ; 3fb74 (f:7b74) CheckTargetSubstitute: ; 3fb79 (f:7b79) push hl ld hl, W_ENEMYBATTSTATUS2 - ld a, [H_WHOSETURN] + ld a, [H_WHOSETURN] and a jr z, .next1 ld hl, W_PLAYERBATTSTATUS2 .next1 - bit HasSubstituteUp, [hl] + bit HasSubstituteUp, [hl] pop hl ret diff --git a/engine/battle/decrement_pp.asm b/engine/battle/decrement_pp.asm index ecf5040b..7345c5c1 100644 --- a/engine/battle/decrement_pp.asm +++ b/engine/battle/decrement_pp.asm @@ -9,15 +9,15 @@ DecrementPP: ; 68000 (1a:4000) ; W_PLAYERBATTSTATUS2 status flags later and a, (1 << StoringEnergy) | (1 << ThrashingAbout) | (1 << AttackingMultipleTimes) ret nz ; if any of these statuses are true, don't decrement PP - bit UsingRage, [hl] + bit UsingRage, [hl] ret nz ; don't decrement PP either if Pokemon is using Rage ld hl, wBattleMonPP ; PP of first move (in battle) - -; decrement PP in the battle struct - call .DecrementPP - -; decrement PP in the party struct - ld a, [W_PLAYERBATTSTATUS3] + +; decrement PP in the battle struct + call .DecrementPP + +; decrement PP in the party struct + ld a, [W_PLAYERBATTSTATUS3] bit Transformed, a ret nz ; Return if transformed. Pokemon Red stores the "current pokemon's" PP ; separately from the "Pokemon in your party's" PP. This is @@ -31,7 +31,7 @@ DecrementPP: ; 68000 (1a:4000) ld hl, wPartyMon1PP ; PP of first move (in party) ld a, [wPlayerMonNumber] ; which mon in party is active - ld bc, wPartyMon2 - wPartyMon1 + ld bc, wPartyMon2 - wPartyMon1 call AddNTimes ; calculate address of the mon to modify .DecrementPP ld a, [wPlayerMoveListIndex] ; which move (0, 1, 2, 3) did we use? diff --git a/engine/battle/draw_hud_pokeball_gfx.asm b/engine/battle/draw_hud_pokeball_gfx.asm index fce3701c..ba47d8f3 100644 --- a/engine/battle/draw_hud_pokeball_gfx.asm +++ b/engine/battle/draw_hud_pokeball_gfx.asm @@ -1,7 +1,7 @@ DrawAllPokeballs: ; 3a849 (e:6849) call LoadPartyPokeballGfx call SetupOwnPartyPokeballs - ld a, [W_ISINBATTLE] ; W_ISINBATTLE + ld a, [W_ISINBATTLE] dec a ret z ; return if wild pokémon jp SetupEnemyPartyPokeballs @@ -11,7 +11,7 @@ DrawEnemyPokeballs: ; 0x3a857 jp SetupEnemyPartyPokeballs LoadPartyPokeballGfx: ; 3a85d (e:685d) - ld de, PokeballTileGraphics ; $697e + ld de, PokeballTileGraphics ld hl, vSprites + $310 ld bc, (BANK(PokeballTileGraphics) << 8) + $04 jp CopyVideoData @@ -19,10 +19,10 @@ LoadPartyPokeballGfx: ; 3a85d (e:685d) SetupOwnPartyPokeballs: ; 3a869 (e:6869) call PlacePlayerHUDTiles ld hl, wPartyMon1 - ld de, wPartyCount ; wPartyCount + ld de, wPartyCount call SetupPokeballs ld a, $60 - ld hl, W_BASECOORDX ; wd081 + ld hl, W_BASECOORDX ld [hli], a ld [hl], a ld a, $8 @@ -33,9 +33,9 @@ SetupOwnPartyPokeballs: ; 3a869 (e:6869) SetupEnemyPartyPokeballs: ; 3a887 (e:6887) call PlaceEnemyHUDTiles ld hl, wEnemyMons - ld de, wEnemyPartyCount ; wEnemyPartyCount + ld de, wEnemyPartyCount call SetupPokeballs - ld hl, W_BASECOORDX ; wd081 + ld hl, W_BASECOORDX ld a, $48 ld [hli], a ld [hl], $20 @@ -98,31 +98,31 @@ WritePokeballOAMData: ; 3a8e1 (e:68e1) ld de, wBuffer ld c, PARTY_LENGTH .loop - ld a, [W_BASECOORDY] ; wd082 + ld a, [W_BASECOORDY] ld [hli], a - ld a, [W_BASECOORDX] ; wd081 + ld a, [W_BASECOORDX] ld [hli], a ld a, [de] ld [hli], a xor a ld [hli], a - ld a, [W_BASECOORDX] ; wd081 + ld a, [W_BASECOORDX] ld b, a ld a, [wTrainerEngageDistance] add b - ld [W_BASECOORDX], a ; wd081 + ld [W_BASECOORDX], a inc de dec c jr nz, .loop ret PlacePlayerHUDTiles: ; 3a902 (e:6902) - ld hl, PlayerBattleHUDGraphicsTiles ; $6916 + ld hl, PlayerBattleHUDGraphicsTiles ld de, wTrainerFacingDirection ld bc, $3 call CopyData hlCoord 18, 10 - ld de, rIE ; $ffff + ld de, rIE jr PlaceHUDTiles PlayerBattleHUDGraphicsTiles: ; 3a916 (e:6916) @@ -132,7 +132,7 @@ PlayerBattleHUDGraphicsTiles: ; 3a916 (e:6916) db $6F ; lower-left triangle tile of the HUD PlaceEnemyHUDTiles: ; 3a919 (e:6919) - ld hl, EnemyBattleHUDGraphicsTiles ; $692d + ld hl, EnemyBattleHUDGraphicsTiles ld de, wTrainerFacingDirection ld bc, $3 call CopyData @@ -165,10 +165,10 @@ PlaceHUDTiles: ; 3a930 (e:6930) SetupPlayerAndEnemyPokeballs: ; 3a948 (e:6948) call LoadPartyPokeballGfx - ld hl, wPartyMon1Species ; wPartyMon1Species (aliases: wPartyMon1) - ld de, wPartyCount ; wPartyCount + ld hl, wPartyMons + ld de, wPartyCount call SetupPokeballs - ld hl, W_BASECOORDX ; wd081 + ld hl, W_BASECOORDX ld a, $50 ld [hli], a ld [hl], $40 @@ -176,10 +176,10 @@ SetupPlayerAndEnemyPokeballs: ; 3a948 (e:6948) ld [wTrainerEngageDistance], a ld hl, wOAMBuffer call WritePokeballOAMData - ld hl, wEnemyMons ; wEnemyMon1Species - ld de, wEnemyPartyCount ; wEnemyPartyCount + ld hl, wEnemyMons + ld de, wEnemyPartyCount call SetupPokeballs - ld hl, W_BASECOORDX ; wd081 + ld hl, W_BASECOORDX ld a, $50 ld [hli], a ld [hl], $68 diff --git a/engine/battle/end_of_battle.asm b/engine/battle/end_of_battle.asm index f03dd07f..d1452770 100644..100755 --- a/engine/battle/end_of_battle.asm +++ b/engine/battle/end_of_battle.asm @@ -21,7 +21,7 @@ EndOfBattle: ; 137aa (4:77aa) .placeWinOrLoseString hlCoord 6, 8 call PlaceString - ld c, $c8 + ld c, 200 call DelayFrames jr .evolution .notLinkBattle @@ -85,4 +85,4 @@ DrawText: ; 13864 (4:7864) PickUpPayDayMoneyText: ; 1386b (4:786b) TX_FAR _PickUpPayDayMoneyText - db "@"
\ No newline at end of file + db "@" diff --git a/engine/battle/experience.asm b/engine/battle/experience.asm index 9bd67654..4e4d0f3c 100644 --- a/engine/battle/experience.asm +++ b/engine/battle/experience.asm @@ -341,7 +341,7 @@ BoostExp: ; 5549f (15:549f) GainedText: ; 554b2 (15:54b2) TX_FAR _GainedText - db $08 ; asm + TX_ASM ld a, [wBoostExpByExpAll] ld hl, WithExpAllText and a @@ -355,7 +355,7 @@ GainedText: ; 554b2 (15:54b2) WithExpAllText: ; 554cb (15:54cb) TX_FAR _WithExpAllText - db $08 ; asm + TX_ASM ld hl, ExpPointsText ret diff --git a/engine/battle/init_battle_variables.asm b/engine/battle/init_battle_variables.asm index 457cc4e1..edb1f13e 100644 --- a/engine/battle/init_battle_variables.asm +++ b/engine/battle/init_battle_variables.asm @@ -13,7 +13,7 @@ InitBattleVariables: ; 525af (14:65af) ld [wCriticalHitOrOHKO], a ld [wBattleMonSpecies], a ld [wPartyGainExpFlags], a - ld [wPlayerMonNumber], a + ld [wPlayerMonNumber], a ld [wEscapedFromBattle], a ld [wMapPalOffset], a ld hl, wcf1d @@ -27,7 +27,7 @@ InitBattleVariables: ; 525af (14:65af) jr nz, .loop inc a ld [wccd9], a - ld a, [W_CURMAP] + ld a, [W_CURMAP] cp SAFARI_ZONE_EAST jr c, .notSafariBattle cp SAFARI_ZONE_REST_HOUSE_1 diff --git a/engine/battle/moveEffects/conversion_effect.asm b/engine/battle/moveEffects/conversion_effect.asm index 2f05afb3..e4c5b4bd 100644 --- a/engine/battle/moveEffects/conversion_effect.asm +++ b/engine/battle/moveEffects/conversion_effect.asm @@ -13,7 +13,7 @@ ConversionEffect_: ; 139a3 (4:79a3) .conversionEffect bit Invulnerable, a ; is mon immune to typical attacks (dig/fly) jr nz, PrintButItFailedText -; copy target's types to user +; copy target's types to user ld a, [hli] ld [de], a inc de diff --git a/engine/battle/moveEffects/drain_hp_effect.asm b/engine/battle/moveEffects/drain_hp_effect.asm index 517d53d1..be52e76d 100644 --- a/engine/battle/moveEffects/drain_hp_effect.asm +++ b/engine/battle/moveEffects/drain_hp_effect.asm @@ -1,5 +1,5 @@ DrainHPEffect_: ; 783f (1:783f) - ld hl, W_DAMAGE + ld hl, W_DAMAGE ld a, [hl] srl a ; divide damage by 2 ld [hli], a @@ -17,8 +17,8 @@ DrainHPEffect_: ; 783f (1:783f) ld a, [H_WHOSETURN] and a jp z, .addDamageToAttackerHP - ld hl, wEnemyMonHP - ld de, wEnemyMonMaxHP + ld hl, wEnemyMonHP + ld de, wEnemyMonMaxHP .addDamageToAttackerHP ld bc, wHPBarOldHP+1 ; copy current HP to wHPBarOldHP @@ -41,7 +41,7 @@ DrainHPEffect_: ; 783f (1:783f) add b ld [hld], a ld [wHPBarNewHP], a - ld a, [W_DAMAGE] + ld a, [W_DAMAGE] ld b, [hl] adc b ld [hli], a @@ -87,7 +87,7 @@ DrainHPEffect_: ; 783f (1:783f) and a ld a, [W_PLAYERMOVEEFFECT] jr z, .next3 - ld a, [W_ENEMYMOVEEFFECT] + ld a, [W_ENEMYMOVEEFFECT] .next3 cp DREAM_EATER_EFFECT jr nz, .printText diff --git a/engine/battle/moveEffects/focus_energy_effect.asm b/engine/battle/moveEffects/focus_energy_effect.asm index f01e61cc..20a0c07e 100644 --- a/engine/battle/moveEffects/focus_energy_effect.asm +++ b/engine/battle/moveEffects/focus_energy_effect.asm @@ -12,7 +12,7 @@ FocusEnergyEffect_: ; 27f86 (9:7f86) ld hl, GettingPumpedText jp PrintText .alreadyUsing - ld c, $32 + ld c, 50 call DelayFrames ld hl, PrintButItFailedText_ ld b, BANK(PrintButItFailedText_) diff --git a/engine/battle/moveEffects/haze_effect.asm b/engine/battle/moveEffects/haze_effect.asm index 14b5f5dd..5c5443c0 100644 --- a/engine/battle/moveEffects/haze_effect.asm +++ b/engine/battle/moveEffects/haze_effect.asm @@ -1,11 +1,11 @@ HazeEffect_: ; 139da (4:79da) ld a, $7 -; store 7 on every stat mod +; store 7 on every stat mod ld hl, wPlayerMonAttackMod call ResetStatMods ld hl, wEnemyMonAttackMod call ResetStatMods -; copy unmodified stats to battle stats +; copy unmodified stats to battle stats ld hl, wPlayerMonUnmodifiedAttack ld de, wBattleMonAttack call ResetStats @@ -25,7 +25,7 @@ HazeEffect_: ; 139da (4:79da) ld [hl], $0 and SLP | (1 << FRZ) jr z, .cureVolatileStatuses -; prevent the Pokemon from executing a move if it was asleep or frozen +; prevent the Pokemon from executing a move if it was asleep or frozen ld a, $ff ld [de], a @@ -51,7 +51,7 @@ CureVolatileStatuses: ; 13a37 (4:7a37) inc hl ; BATTSTATUS2 ld a, [hl] ; clear UsingXAccuracy, ProtectedByMist, GettingPumped, and Seeded statuses - and $ff ^((1 << UsingXAccuracy) | (1 << ProtectedByMist) | (1 << GettingPumped) | (1 << Seeded)) + and $ff ^((1 << UsingXAccuracy) | (1 << ProtectedByMist) | (1 << GettingPumped) | (1 << Seeded)) ld [hli], a ; BATTSTATUS3 ld a, [hl] and %11110000 | (1 << Transformed) ; clear Bad Poison, Reflect and Light Screen statuses @@ -61,7 +61,7 @@ CureVolatileStatuses: ; 13a37 (4:7a37) ResetStatMods: ; 13a43 (4:7a43) ld b, $8 .loop - ld [hli], a + ld [hli], a dec b jr nz, .loop ret diff --git a/engine/battle/moveEffects/heal_effect.asm b/engine/battle/moveEffects/heal_effect.asm index 862917f7..d9729747 100644 --- a/engine/battle/moveEffects/heal_effect.asm +++ b/engine/battle/moveEffects/heal_effect.asm @@ -76,7 +76,7 @@ HealEffect_: ; 3b9ec (e:79ec) ld a, [de] sbc [hl] jr c, .playAnim -; copy max HP to current HP if an overflow ocurred +; copy max HP to current HP if an overflow ocurred ld a, [hli] ld [de], a ld [wHPBarNewHP+1], a diff --git a/engine/battle/moveEffects/leech_seed_effect.asm b/engine/battle/moveEffects/leech_seed_effect.asm index e29fd7c2..1b0afe4b 100644 --- a/engine/battle/moveEffects/leech_seed_effect.asm +++ b/engine/battle/moveEffects/leech_seed_effect.asm @@ -1,20 +1,20 @@ LeechSeedEffect_: ; 2bea9 (a:7ea9) callab MoveHitTest - ld a, [W_MOVEMISSED] + ld a, [W_MOVEMISSED] and a jr nz, .moveMissed - ld hl, W_ENEMYBATTSTATUS2 - ld de, wEnemyMonType1 - ld a, [H_WHOSETURN] + ld hl, W_ENEMYBATTSTATUS2 + ld de, wEnemyMonType1 + ld a, [H_WHOSETURN] and a jr z, .leechSeedEffect - ld hl, W_PLAYERBATTSTATUS2 - ld de, wBattleMonType1 + ld hl, W_PLAYERBATTSTATUS2 + ld de, wBattleMonType1 .leechSeedEffect ; miss if the target is grass-type or already seeded ld a, [de] cp GRASS - jr z, .moveMissed + jr z, .moveMissed inc de ld a, [de] cp GRASS @@ -23,12 +23,12 @@ LeechSeedEffect_: ; 2bea9 (a:7ea9) jr nz, .moveMissed set Seeded, [hl] callab PlayCurrentMoveAnimation - ld hl, WasSeededText ; $7ef2 + ld hl, WasSeededText jp PrintText .moveMissed - ld c, $32 + ld c, 50 call DelayFrames - ld hl, EvadedAttackText ; $7ef7 + ld hl, EvadedAttackText jp PrintText WasSeededText: ; 2bef2 (a:7ef2) diff --git a/engine/battle/moveEffects/one_hit_ko_effect.asm b/engine/battle/moveEffects/one_hit_ko_effect.asm index cc0eca7b..907db80c 100644 --- a/engine/battle/moveEffects/one_hit_ko_effect.asm +++ b/engine/battle/moveEffects/one_hit_ko_effect.asm @@ -1,5 +1,5 @@ OneHitKOEffect_: ; 33f57 (c:7f57) - ld hl, W_DAMAGE + ld hl, W_DAMAGE xor a ld [hli], a ld [hl], a ; set the damage output to zero @@ -7,7 +7,7 @@ OneHitKOEffect_: ; 33f57 (c:7f57) ld [wCriticalHitOrOHKO], a ld hl, wBattleMonSpeed + 1 ld de, wEnemyMonSpeed + 1 - ld a, [H_WHOSETURN] + ld a, [H_WHOSETURN] and a jr z, .compareSpeed ld hl, wEnemyMonSpeed + 1 @@ -24,7 +24,7 @@ OneHitKOEffect_: ; 33f57 (c:7f57) ld a, [hl] sbc b jr c, .userIsSlower - ld hl, W_DAMAGE + ld hl, W_DAMAGE ld a, $ff ld [hli], a ld [hl], a @@ -34,5 +34,5 @@ OneHitKOEffect_: ; 33f57 (c:7f57) .userIsSlower ; keep damage at 0 and set move missed flag if target's current speed is higher instead ld a, $1 - ld [W_MOVEMISSED], a + ld [W_MOVEMISSED], a ret diff --git a/engine/battle/moveEffects/paralyze_effect.asm b/engine/battle/moveEffects/paralyze_effect.asm index 69acbb01..b88e6479 100644 --- a/engine/battle/moveEffects/paralyze_effect.asm +++ b/engine/battle/moveEffects/paralyze_effect.asm @@ -4,7 +4,7 @@ ParalyzeEffect_: ; 52601 (14:6601) ld a, [H_WHOSETURN] and a jp z, .next - ld hl, wBattleMonStatus + ld hl, wBattleMonStatus ld de, W_ENEMYMOVETYPE .next ld a, [hl] @@ -28,7 +28,7 @@ ParalyzeEffect_: ; 52601 (14:6601) push hl callab MoveHitTest pop hl - ld a, [W_MOVEMISSED] + ld a, [W_MOVEMISSED] and a jr nz, .didntAffect set PAR, [hl] diff --git a/engine/battle/moveEffects/pay_day_effect.asm b/engine/battle/moveEffects/pay_day_effect.asm index fc937d1b..26e69ef5 100644 --- a/engine/battle/moveEffects/pay_day_effect.asm +++ b/engine/battle/moveEffects/pay_day_effect.asm @@ -9,19 +9,19 @@ PayDayEffect_ ; 2feb8 (b:7eb8) ld a, [wEnemyMonLevel] .payDayEffect ; level * 2 - add a + add a ld [H_DIVIDEND + 3], a xor a ld [H_DIVIDEND], a ld [H_DIVIDEND + 1], a ld [H_DIVIDEND + 2], a -; convert to BCD +; convert to BCD ld a, 100 ld [H_DIVISOR], a ld b, $4 call Divide ld a, [H_QUOTIENT + 3] - ld [hli], a + ld [hli], a ld a, [H_REMAINDER] ld [H_DIVIDEND + 3], a ld a, 10 diff --git a/engine/battle/moveEffects/recoil_effect.asm b/engine/battle/moveEffects/recoil_effect.asm index fe516c03..95b54922 100644 --- a/engine/battle/moveEffects/recoil_effect.asm +++ b/engine/battle/moveEffects/recoil_effect.asm @@ -46,7 +46,7 @@ RecoilEffect_: ; 1392c (4:792c) ld [wHPBarNewHP+1], a jr nc, .getHPBarCoords ; if recoil damage is higher than the Pokemon's HP, set its HP to 0 - xor a + xor a ld [hli], a ld [hl], a ld hl, wHPBarNewHP diff --git a/engine/battle/moveEffects/reflect_light_screen_effect.asm b/engine/battle/moveEffects/reflect_light_screen_effect.asm index 7da98699..df34827f 100644 --- a/engine/battle/moveEffects/reflect_light_screen_effect.asm +++ b/engine/battle/moveEffects/reflect_light_screen_effect.asm @@ -27,7 +27,7 @@ ReflectLightScreenEffect_: ; 3bb97 (e:7b97) pop hl jp PrintText .moveFailed - ld c, $32 + ld c, 50 call DelayFrames ld hl, PrintButItFailedText_ jp BankswitchEtoF diff --git a/engine/battle/moveEffects/substitute_effect.asm b/engine/battle/moveEffects/substitute_effect.asm index 8412e281..444c755b 100644 --- a/engine/battle/moveEffects/substitute_effect.asm +++ b/engine/battle/moveEffects/substitute_effect.asm @@ -11,15 +11,15 @@ SubstituteEffect_: ; 17dad (5:7dad) ld de, wEnemySubstituteHP ld bc, W_ENEMYBATTSTATUS2 .notEnemy - ld a, [bc] + ld a, [bc] bit HasSubstituteUp, a ; user already has substitute? - jr nz, .alreadyHasSubstitute + jr nz, .alreadyHasSubstitute ; quarter health to remove from user -; assumes max HP is 1023 or lower +; assumes max HP is 1023 or lower push bc ld a, [hli] ld b, [hl] - srl a + srl a rr b srl a rr b ; max hp / 4 @@ -27,29 +27,29 @@ SubstituteEffect_: ; 17dad (5:7dad) ld de, wBattleMonHP - wBattleMonMaxHP add hl, de ; point hl to current HP low byte pop de - ld a, b + ld a, b ld [de], a ; save copy of HP to subtract in ccd7/ccd8 [how much HP substitute has] ld a, [hld] -; subtract [max hp / 4] to current HP - sub b +; subtract [max hp / 4] to current HP + sub b ld d, a ld a, [hl] - sbc 0 + sbc 0 pop bc jr c, .notEnoughHP ; underflow means user would be left with negative health ; bug: since it only brances on carry, it will possibly leave user with 0 HP .userHasZeroOrMoreHP ldi [hl], a ; save resulting HP after substraction into current HP - ld [hl], d + ld [hl], d ld h, b ld l, c - set HasSubstituteUp, [hl] - ld a, [W_OPTIONS] + set HasSubstituteUp, [hl] + ld a, [W_OPTIONS] bit 7, a ; battle animation is enabled? - ld hl, PlayCurrentMoveAnimation + ld hl, PlayCurrentMoveAnimation ld b, BANK(PlayCurrentMoveAnimation) jr z, .animationEnabled - ld hl, AnimationSubstitute + ld hl, AnimationSubstitute ld b, BANK(AnimationSubstitute) .animationEnabled call Bankswitch ; jump to routine depending on animation setting diff --git a/engine/battle/moveEffects/transform_effect.asm b/engine/battle/moveEffects/transform_effect.asm index 6504bf03..1b992df6 100644 --- a/engine/battle/moveEffects/transform_effect.asm +++ b/engine/battle/moveEffects/transform_effect.asm @@ -24,7 +24,7 @@ TransformEffect_: ; 3bab1 (e:7ab1) ld hl, W_ENEMYBATTSTATUS2 .transformEffect ; animation(s) played are different if target has Substitute up - bit HasSubstituteUp, [hl] + bit HasSubstituteUp, [hl] push af ld hl, Func_79747 ld b, BANK(Func_79747) @@ -49,13 +49,13 @@ TransformEffect_: ; 3bab1 (e:7ab1) pop de pop hl push hl -; transform user into opposing Pokemon +; transform user into opposing Pokemon ; species - ld a, [hl] + ld a, [hl] ld [de], a -; type 1, type 2, catch rate, and moves +; type 1, type 2, catch rate, and moves ld bc, $5 - add hl, bc + add hl, bc inc de inc de inc de @@ -82,7 +82,7 @@ TransformEffect_: ; 3bab1 (e:7ab1) ld a, [hli] ld [de], a inc de -; Attack, Defense, Speed, and Special stats +; Attack, Defense, Speed, and Special stats inc hl inc hl inc hl @@ -91,7 +91,7 @@ TransformEffect_: ; 3bab1 (e:7ab1) inc de ld bc, $8 call CopyData - ld bc, wBattleMonMoves - wBattleMonPP + ld bc, wBattleMonMoves - wBattleMonPP add hl, bc ; ld hl, wBattleMonMoves ld b, NUM_MOVES .copyPPLoop diff --git a/engine/battle/read_trainer_party.asm b/engine/battle/read_trainer_party.asm index 3cdfb5cb..e373ef93 100644..100755 --- a/engine/battle/read_trainer_party.asm +++ b/engine/battle/read_trainer_party.asm @@ -143,7 +143,7 @@ ReadTrainer: ; 39c53 (e:5c53) ld [wEnemyMon6Moves + 2],a .FinishUp ; clear wAmountMoneyWon addresses - xor a + xor a ld de,wAmountMoneyWon ld [de],a inc de @@ -163,4 +163,4 @@ ReadTrainer: ; 39c53 (e:5c53) inc de dec b jr nz,.LastLoop ; repeat W_CURENEMYLVL times - ret
\ No newline at end of file + ret diff --git a/engine/battle/scale_sprites.asm b/engine/battle/scale_sprites.asm index dae4ad42..ed227984 100644 --- a/engine/battle/scale_sprites.asm +++ b/engine/battle/scale_sprites.asm @@ -41,16 +41,16 @@ ScaleFirstThreeSpriteColumnsByTwo: ; 2fe55 (b:7e55) ScaleLastSpriteColumnByTwo: ; 2fe7d (b:7e7d) ld a, 4*8 - 4 ; $1c, 4 tiles minus 4 unused rows - ld [H_SPRITEINTERLACECOUNTER], a ; $ff8b - ld bc, -1 ; $ffff + ld [H_SPRITEINTERLACECOUNTER], a + ld bc, -1 .columnInnerLoop ld a, [de] dec de swap a ; only high nybble contains information call ScalePixelsByTwo - ld a, [H_SPRITEINTERLACECOUNTER] ; $ff8b + ld a, [H_SPRITEINTERLACECOUNTER] dec a - ld [H_SPRITEINTERLACECOUNTER], a ; $ff8b + ld [H_SPRITEINTERLACECOUNTER], a jr nz, .columnInnerLoop dec de ; skip last 4 rows of new column dec de diff --git a/engine/battle/trainer_ai.asm b/engine/battle/trainer_ai.asm index 191cfd5e..59611ef1 100644 --- a/engine/battle/trainer_ai.asm +++ b/engine/battle/trainer_ai.asm @@ -40,7 +40,7 @@ AIEnemyTrainerChooseMoves: ; 39719 (e:5719) and a jr z, .loopFindMinimumEntries push hl - ld hl, AIMoveChoiceModificationFunctionPointers ; $57a3 + ld hl, AIMoveChoiceModificationFunctionPointers dec a add a ld c, a @@ -81,7 +81,7 @@ AIEnemyTrainerChooseMoves: ; 39719 (e:5719) .filterMinimalEntries ; all minimal entries now have value 1. All other slots will be disabled (move set to 0) ld a, [de] and a - jr nz, .moveExisting ; 0x3978a $1 + jr nz, .moveExisting ld [hl], a .moveExisting ld a, [hl] @@ -145,7 +145,7 @@ AIMoveChoiceModification1: ; 397ab (e:57ab) ld [hl], a jr .nextMove -StatusAilmentMoveEffects ; 57e2 +StatusAilmentMoveEffects: ; 57e2 db $01 ; unused sleep effect db SLEEP_EFFECT db POISON_EFFECT @@ -157,7 +157,7 @@ StatusAilmentMoveEffects ; 57e2 ; that fall in-bewteen AIMoveChoiceModification2: ; 397e7 (e:57e7) ld a, [wAILayer2Encouragement] - cp $1 + cp $1 ret nz ld hl, wBuffer - 1 ; temp move selection array (-1 byte offset) ld de, wEnemyMonMoves ; enemy moves @@ -325,8 +325,8 @@ TrainerClassMoveChoiceModifications: ; 3989b (e:589b) db 1,3,0 ; LANCE INCLUDE "engine/battle/trainer_pic_money_pointers.asm" - -INCLUDE "text/trainer_names.asm" + +INCLUDE "text/trainer_names.asm" INCLUDE "engine/battle/bank_e_misc.asm" @@ -337,7 +337,6 @@ INCLUDE "data/trainer_moves.asm" INCLUDE "data/trainer_parties.asm" TrainerAI: ; 3a52e (e:652e) -;XXX called at 34964, 3c342, 3c398 and a ld a,[W_ISINBATTLE] dec a @@ -553,7 +552,7 @@ DecrementAICount: ; 3a695 (e:6695) scf ret -Func_3a69b: ; 3a69b (e:669b) +AIPlayRestoringSFX: ; 3a69b (e:669b) ld a,(SFX_08_3e - SFX_Headers_08) / 3 jp PlaySoundWaitForCurrent @@ -712,7 +711,7 @@ AIBattleWithdrawText: ; 3a781 (e:6781) db "@" AIUseFullHeal: ; 3a786 (e:6786) - call Func_3a69b + call AIPlayRestoringSFX call AICureStatus ld a,FULL_HEAL jp AIPrintItemUse @@ -731,21 +730,21 @@ AICureStatus: ; 3a791 (e:6791) ret AIUseXAccuracy: ; 0x3a7a8 unused - call Func_3a69b + call AIPlayRestoringSFX ld hl,W_ENEMYBATTSTATUS2 set 0,[hl] ld a,X_ACCURACY jp AIPrintItemUse AIUseGuardSpec: ; 3a7b5 (e:67b5) - call Func_3a69b + call AIPlayRestoringSFX ld hl,W_ENEMYBATTSTATUS2 set 1,[hl] ld a,GUARD_SPEC_ jp AIPrintItemUse AIUseDireHit: ; 0x3a7c2 unused - call Func_3a69b + call AIPlayRestoringSFX ld hl,W_ENEMYBATTSTATUS2 set 2,[hl] ld a,DIRE_HIT @@ -808,7 +807,7 @@ AIIncreaseStat: ; 3a808 (e:6808) ld a,[hl] push af push hl - ld a,$AF + ld a,ANIM_AF ld [hli],a ld [hl],b callab StatModifierUpEffect diff --git a/engine/battle/trainer_pic_money_pointers.asm b/engine/battle/trainer_pic_money_pointers.asm index 3d32eb00..3f684db3 100644..100755 --- a/engine/battle/trainer_pic_money_pointers.asm +++ b/engine/battle/trainer_pic_money_pointers.asm @@ -140,4 +140,4 @@ TrainerPicAndMoneyPointers: ; 39914 (e:5914) money 9900 dw LancePic - money 9900
\ No newline at end of file + money 9900 diff --git a/engine/battle/wild_encounters.asm b/engine/battle/wild_encounters.asm index 03119b90..87512583 100644 --- a/engine/battle/wild_encounters.asm +++ b/engine/battle/wild_encounters.asm @@ -23,7 +23,7 @@ TryDoWildEncounter: ; 13870 (4:7870) jr z, .lastRepelStep ld [wRepelRemainingSteps], a .asm_1389e -; determine if wild pokmon can appear in the half-block were standing in +; determine if wild pokemon can appear in the half-block we're standing in ; is the bottom right tile (9,9) of the half-block we're standing in a grass/water tile? hlCoord 9, 9 ld c, [hl] @@ -35,9 +35,9 @@ TryDoWildEncounter: ; 13870 (4:7870) cp c ld a, [W_WATERRATE] jr z, .CanEncounter -; even if not in grass/water, standing anywhere we can encounter pokmon -; so long as the map is indoor and has wild pokmon defined. -; as long as its not Viridian Forest or Safari Zone. +; even if not in grass/water, standing anywhere we can encounter pokemon +; so long as the map is "indoor" and has wild pokemon defined. +; ...as long as it's not Viridian Forest or Safari Zone. ld a, [W_CURMAP] cp REDS_HOUSE_1F ; is this an indoor map? jr c, .CantEncounter2 @@ -61,15 +61,15 @@ TryDoWildEncounter: ; 13870 (4:7870) inc hl jr .determineEncounterSlot .gotEncounterSlot -; determine which wild pokmon (grass or water) can appear in the half-block were standing in +; determine which wild pokemon (grass or water) can appear in the half-block we're standing in ld c, [hl] ld hl, W_GRASSMONS - aCoord 8, 9 - cp $14 ; is the bottom left tile (8,9) of the half-block we're standing in a water tile? + aCoord 8, 9 + cp $14 ; is the bottom left tile (8,9) of the half-block we're standing in a water tile? jr nz, .gotWildEncounterType ; else, it's treated as a grass tile by default ld hl, W_WATERMONS ; since the bottom right tile of a "left shore" half-block is $14 but the bottom left tile is not, -; "left shore" half-blocks (such as the one in the east coast of Cinnabar) load grass encounters. +; "left shore" half-blocks (such as the one in the east coast of Cinnabar) load grass encounters. .gotWildEncounterType ld b, $0 add hl, bc diff --git a/engine/cable_club.asm b/engine/cable_club.asm index 2cfb1734..3cbc0867 100755 --- a/engine/cable_club.asm +++ b/engine/cable_club.asm @@ -2,7 +2,7 @@ ; In the Colosseum, it starts a battle. In the Trade Centre, it displays the trade selection screen. ; Before doing either action, it swaps random numbers, trainer names and party data with the other gameboy. CableClub_DoBattleOrTrade: ; 5317 (1:5317) - ld c, $50 + ld c, 80 call DelayFrames call ClearScreen call UpdateSprites @@ -359,7 +359,7 @@ TradeCenter_SelectMon: .displayEnemyMonStats ld a, $1 ld [wd11b], a - callab Func_39bd5 + callab InitList ld hl, wEnemyMons call TradeCenter_DisplayStats jp .getNewInput @@ -418,7 +418,7 @@ TradeCenter_SelectMon: ; unreachable code ld a, $4 ld [wd11b], a - callab Func_39bd5 + callab InitList call TradeCenter_DisplayStats jp .getNewInput .playerMonMenu_ANotPressed @@ -513,7 +513,7 @@ TradeCenter_SelectMon: ld [wCurrentMenuItem], a ld a, $4 ld [wd11b], a - callab Func_39bd5 + callab InitList call TradeCenter_DisplayStats call LoadScreenTilesFromBuffer1 jp .playerMonMenu diff --git a/engine/evolution.asm b/engine/evolution.asm index 7ae88fdf..76537530 100755 --- a/engine/evolution.asm +++ b/engine/evolution.asm @@ -1,4 +1,4 @@ -Func_7bde9: ; 7bde9 (1e:7de9) +EvolveMon: ; 7bde9 (1e:7de9) push hl push de push bc @@ -13,17 +13,17 @@ Func_7bde9: ; 7bde9 (1e:7de9) ld [wc0ee], a call PlaySound ld a, $1 - ld [H_AUTOBGTRANSFERENABLED], a ; $ffba + ld [H_AUTOBGTRANSFERENABLED], a ld a, (SFX_08_3c - SFX_Headers_08) / 3 call PlaySound call Delay3 xor a - ld [H_AUTOBGTRANSFERENABLED], a ; $ffba + ld [H_AUTOBGTRANSFERENABLED], a ld [hTilesetType], a ld a, [wHPBarMaxHP] ld [wcf1d], a ld c, $0 - call Func_7beb4 + call EvolutionSetWholeScreenPalette ld a, [wHPBarMaxHP + 1] ld [wcf91], a ld [wd0b5], a @@ -37,23 +37,23 @@ Func_7bde9: ; 7bde9 (1e:7de9) ld [wd0b5], a call Func_7beb9 ld a, $1 - ld [H_AUTOBGTRANSFERENABLED], a ; $ffba + ld [H_AUTOBGTRANSFERENABLED], a ld a, [wHPBarMaxHP] call PlayCry call WaitForSoundToFinish ld c, BANK(Music_SafariZone) ld a, MUSIC_SAFARI_ZONE call PlayMusic - ld c, $50 + ld c, 80 call DelayFrames ld c, $1 - call Func_7beb4 + call EvolutionSetWholeScreenPalette ld bc, $110 .asm_7be63 push bc - call asm_7befa + call Func_7befa jr c, .asm_7bea9 - call asm_7bec2 + call Func_7bec2 pop bc inc b dec c @@ -73,7 +73,7 @@ Func_7bde9: ; 7bde9 (1e:7de9) ld a, [wcf1d] call PlayCry ld c, $0 - call Func_7beb4 + call EvolutionSetWholeScreenPalette pop af ld [wd0b5], a pop af @@ -93,7 +93,7 @@ Func_7bde9: ; 7bde9 (1e:7de9) ld a, [wHPBarMaxHP] jr .asm_7be81 -Func_7beb4: ; 7beb4 (1e:7eb4) +EvolutionSetWholeScreenPalette: ; 7beb4 (1e:7eb4) ld b, $b jp GoPAL_SET @@ -101,7 +101,8 @@ Func_7beb9: ; 7beb9 (1e:7eb9) call GetMonHeader hlCoord 7, 2 jp LoadFlippedFrontSpriteByMonIndex -asm_7bec2: ; 7bec2 (1e:7ec2) + +Func_7bec2: ; 7bec2 (1e:7ec2) ld a, $31 ld [wHPBarOldHP], a call Func_7bed6 @@ -109,13 +110,13 @@ asm_7bec2: ; 7bec2 (1e:7ec2) ld [wHPBarOldHP], a call Func_7bed6 dec b - jr nz, asm_7bec2 + jr nz, Func_7bec2 ret Func_7bed6: ; 7bed6 (1e:7ed6) push bc xor a - ld [H_AUTOBGTRANSFERENABLED], a ; $ffba + ld [H_AUTOBGTRANSFERENABLED], a hlCoord 7, 2 ld bc, $707 ld de, $d @@ -132,11 +133,12 @@ Func_7bed6: ; 7bed6 (1e:7ed6) dec b jr nz, .asm_7bee3 ld a, $1 - ld [H_AUTOBGTRANSFERENABLED], a ; $ffba + ld [H_AUTOBGTRANSFERENABLED], a call Delay3 pop bc ret -asm_7befa: ; 7befa (1e:7efa) + +Func_7befa: ; 7befa (1e:7efa) call DelayFrame push bc call JoypadLowSensitivity @@ -146,7 +148,7 @@ asm_7befa: ; 7befa (1e:7efa) jr nz, .asm_7bf0d .asm_7bf08 dec c - jr nz, asm_7befa + jr nz, Func_7befa and a ret .asm_7bf0d diff --git a/engine/evolve_trade.asm b/engine/evolve_trade.asm index ec230677..c7297527 100755 --- a/engine/evolve_trade.asm +++ b/engine/evolve_trade.asm @@ -31,9 +31,9 @@ EvolveTradeMon: ; 17d7d (5:7d7d) ret nz .ok - ld a, [wPartyCount] ; wPartyCount + ld a, [wPartyCount] dec a - ld [wWhichPokemon], a ; wWhichPokemon + ld [wWhichPokemon], a ld a, $1 ld [wccd4], a ld a, LINK_STATE_TRADING diff --git a/engine/evos_moves.asm b/engine/evos_moves.asm index 23bffa8d..bddaffe5 100755 --- a/engine/evos_moves.asm +++ b/engine/evos_moves.asm @@ -117,7 +117,7 @@ Evolution_PartyMonLoop: ; loop over party mons call CopyStringToCF4B ld hl, IsEvolvingText call PrintText - ld c, $32 + ld c, 50 call DelayFrames xor a ld [H_AUTOBGTRANSFERENABLED], a @@ -129,7 +129,7 @@ Evolution_PartyMonLoop: ; loop over party mons ld a, $ff ld [wUpdateSpritesEnabled], a call ClearSprites - callab Func_7bde9 + callab EvolveMon jp c, CancelledEvolution ld hl, EvolvedText call PrintText @@ -149,7 +149,7 @@ Evolution_PartyMonLoop: ; loop over party mons ld a, (SFX_02_3b - SFX_Headers_02) / 3 call PlaySoundWaitForCurrent call WaitForSoundToFinish - ld c, $28 + ld c, 40 call DelayFrames call ClearScreen call RenameEvolvedMon @@ -407,13 +407,13 @@ WriteMonMoves: ; 3afb8 (e:6fb8) and a jp z, .done ; end of list ld b, a - ld a, [W_CURENEMYLVL] ; W_CURENEMYLVL + ld a, [W_CURENEMYLVL] cp b jp c, .done ; mon level < move level (assumption: learnset is sorted by level) ld a, [wHPBarMaxHP] and a jr z, .skipMinLevelCheck - ld a, [wWhichTrade] ; wWhichTrade (min move level) + ld a, [wWhichTrade] ; min move level) cp b jr nc, .nextMove2 ; min level >= move level .skipMinLevelCheck diff --git a/engine/experience.asm b/engine/experience.asm index 68d22843..752536cf 100755 --- a/engine/experience.asm +++ b/engine/experience.asm @@ -38,19 +38,19 @@ CalcExperience: ; 58f6a (16:4f6a) add hl, bc call CalcDSquared ld a, d - ld [H_MULTIPLIER], a ; $ff99 + ld [H_MULTIPLIER], a call Multiply ld a, [hl] and $f0 swap a - ld [H_MULTIPLIER], a ; $ff99 + ld [H_MULTIPLIER], a call Multiply ld a, [hli] and $f - ld [H_DIVISOR], a ; $ff99 + ld [H_DIVISOR], a ld b, $4 call Divide - ld a, [H_MULTIPLICAND] ; $ff96 (aliases: H_NUMTOPRINT) + ld a, [H_MULTIPLICAND] ; (aliases: H_NUMTOPRINT) push af ld a, [H_MULTIPLICAND+1] push af @@ -59,9 +59,9 @@ CalcExperience: ; 58f6a (16:4f6a) call CalcDSquared ld a, [hl] and $7f - ld [H_MULTIPLIER], a ; $ff99 + ld [H_MULTIPLIER], a call Multiply - ld a, [H_MULTIPLICAND] ; $ff96 (aliases: H_NUMTOPRINT) + ld a, [H_MULTIPLICAND] ; (aliases: H_NUMTOPRINT) push af ld a, [H_MULTIPLICAND+1] push af @@ -70,7 +70,7 @@ CalcExperience: ; 58f6a (16:4f6a) ld a, [hli] push af xor a - ld [H_MULTIPLICAND], a ; $ff96 + ld [H_MULTIPLICAND], a ld [H_MULTIPLICAND+1], a ld a, d ld [H_MULTIPLICAND+2], a @@ -85,9 +85,9 @@ CalcExperience: ; 58f6a (16:4f6a) ld a, [H_MULTIPLICAND+1] sbc b ld [H_MULTIPLICAND+1], a - ld a, [H_MULTIPLICAND] ; $ff96 + ld a, [H_MULTIPLICAND] sbc b - ld [H_MULTIPLICAND], a ; $ff96 + ld [H_MULTIPLICAND], a pop af and $80 jr nz, .subtractSquaredTerm ; check sign @@ -135,11 +135,11 @@ CalcExperience: ; 58f6a (16:4f6a) ; calculates d*d CalcDSquared: ; 59010 (16:5010) xor a - ld [H_MULTIPLICAND], a ; $ff96 (aliases: H_NUMTOPRINT) + ld [H_MULTIPLICAND], a ; (aliases: H_NUMTOPRINT) ld [H_MULTIPLICAND+1], a ld a, d ld [H_MULTIPLICAND+2], a - ld [H_MULTIPLIER], a ; $ff99 (aliases: H_DIVISOR, H_REMAINDER, H_POWEROFTEN) + ld [H_MULTIPLIER], a ; (aliases: H_DIVISOR, H_REMAINDER, H_POWEROFTEN) jp Multiply ; each entry has the following scheme: diff --git a/engine/game_corner_slots.asm b/engine/game_corner_slots.asm index 52f61daf..01d42d21 100755 --- a/engine/game_corner_slots.asm +++ b/engine/game_corner_slots.asm @@ -27,13 +27,13 @@ StartSlotMachine: ; 37e2d (d:7e2d) call PromptUserToPlaySlots ret .printOutOfOrder - ld a, $28 + tx_pre_id GameCornerOutOfOrderText jr .printText .printOutToLunch - ld a, $29 + tx_pre_id GameCornerOutToLunchText jr .printText .printSomeonesKeys - ld a, $2a + tx_pre_id GameCornerSomeonesKeysText .printText push af call EnableAutoTextBoxDrawing diff --git a/engine/game_corner_slots2.asm b/engine/game_corner_slots2.asm index 66e51237..850b1f99 100755 --- a/engine/game_corner_slots2.asm +++ b/engine/game_corner_slots2.asm @@ -6,13 +6,13 @@ AbleToPlaySlotsCheck ; 2ff09 (b:7f09) predef IsItemInBag_ ; IsItemInBag_ ld a, b and a - ld b, $33 ; GameCornerCoinCaseText + ld b, (GameCornerCoinCaseText_id - TextPredefs) / 2 + 1 jr z, .printCoinCaseRequired ld hl, wPlayerCoins ld a, [hli] or [hl] jr nz, .done ; able to play - ld b, $32 ; GameCornerNoCoinsText + ld b, (GameCornerNoCoinsText_id - TextPredefs) / 2 + 1 .printCoinCaseRequired call EnableAutoTextBoxDrawing ld a, b diff --git a/engine/gamefreak.asm b/engine/gamefreak.asm index d0f1bbac..32dda60e 100755 --- a/engine/gamefreak.asm +++ b/engine/gamefreak.asm @@ -1,25 +1,25 @@ LoadShootingStarGraphics: ; 70000 (1c:4000) ld a, $f9 - ld [rOBP0], a ; $ff48 + ld [rOBP0], a ld a, $a4 - ld [rOBP1], a ; $ff49 - ld de, AnimationTileset2 + $30 ; $471e ; star tile (top left quadrant) + ld [rOBP1], a + ld de, AnimationTileset2 + $30 ; star tile (top left quadrant) ld hl, vChars1 + $200 ld bc, (BANK(AnimationTileset2) << 8) + $01 call CopyVideoData - ld de, AnimationTileset2 + $130 ; $481e ; star tile (bottom left quadrant) + ld de, AnimationTileset2 + $130 ; star tile (bottom left quadrant) ld hl, vChars1 + $210 ld bc, (BANK(AnimationTileset2) << 8) + $01 call CopyVideoData - ld de, FallingStar ; $4190 + ld de, FallingStar ld hl, vChars1 + $220 ld bc, (BANK(FallingStar) << 8) + $01 call CopyVideoData - ld hl, GameFreakLogoOAMData ; $4140 + ld hl, GameFreakLogoOAMData ld de, wOAMBuffer + $60 ld bc, $40 call CopyData - ld hl, GameFreakShootingStarOAMData ; $4180 + ld hl, GameFreakShootingStarOAMData ld de, wOAMBuffer ld bc, $10 jp CopyData @@ -66,7 +66,7 @@ AnimateShootingStar: ; 70044 (1c:4044) jr nz, .asm_7007b ld b, $3 .asm_70083 - ld hl, rOBP0 ; $ff48 + ld hl, rOBP0 rrc [hl] rrc [hl] ld c, $a @@ -78,15 +78,15 @@ AnimateShootingStar: ; 70044 (1c:4044) ld a, $18 .asm_70098 push af - ld hl, OAMData_700ee ; $40ee + ld hl, OAMData_700ee ld bc, $4 call CopyData pop af dec a jr nz, .asm_70098 xor a - ld [wWhichTrade], a ; wWhichTrade - ld hl, PointerTable_700f2 ; $40f2 + ld [wWhichTrade], a + ld hl, PointerTable_700f2 ld c, $6 .asm_700af ld a, [hli] @@ -110,11 +110,11 @@ AnimateShootingStar: ; 70044 (1c:4044) inc hl dec c jr nz, .asm_700ba - ld a, [wWhichTrade] ; wWhichTrade + ld a, [wWhichTrade] cp $18 jr z, .asm_700d5 add $6 - ld [wWhichTrade], a ; wWhichTrade + ld [wWhichTrade], a .asm_700d5 call Func_7011f push af @@ -174,7 +174,7 @@ Func_7011f: ; 7011f (1c:411f) ld b, $8 .asm_70121 ld hl, wOAMBuffer + $5c - ld a, [wWhichTrade] ; wWhichTrade + ld a, [wWhichTrade] ld de, $fffc ld c, a .asm_7012b @@ -182,9 +182,9 @@ Func_7011f: ; 7011f (1c:411f) add hl, de dec c jr nz, .asm_7012b - ld a, [rOBP1] ; $ff49 + ld a, [rOBP1] xor $a0 - ld [rOBP1], a ; $ff49 + ld [rOBP1], a ld c, $3 call CheckForUserInterruption ret c diff --git a/engine/give_pokemon.asm b/engine/give_pokemon.asm index 64876d22..0d451bf6 100755 --- a/engine/give_pokemon.asm +++ b/engine/give_pokemon.asm @@ -2,14 +2,14 @@ _GivePokemon: ; 4fda5 (13:7da5) call EnableAutoTextBoxDrawing xor a ld [wccd3], a - ld a, [wPartyCount] ; wPartyCount + ld a, [wPartyCount] cp PARTY_LENGTH jr c, .asm_4fe01 - ld a, [W_NUMINBOX] ; wda80 + ld a, [W_NUMINBOX] cp MONS_PER_BOX jr nc, .asm_4fdf9 xor a - ld [W_ENEMYBATTSTATUS3], a ; W_ENEMYBATTSTATUS3 + ld [W_ENEMYBATTSTATUS3], a ld a, [wcf91] ld [wEnemyMonSpecies2], a callab LoadEnemyMonData @@ -56,7 +56,7 @@ SetPokedexOwnedFlag: ; 4fe11 (13:7e11) ld a, [wd11e] dec a ld c, a - ld hl, wPokedexOwned ; wPokedexOwned + ld hl, wPokedexOwned ld b, $1 predef FlagActionPredef pop af diff --git a/engine/hall_of_fame.asm b/engine/hall_of_fame.asm index 30979118..7882a226 100755 --- a/engine/hall_of_fame.asm +++ b/engine/hall_of_fame.asm @@ -11,7 +11,7 @@ AnimateHallOfFame: ; 701a0 (1c:41a0) ld a, $7f call FillMemory call EnableLCD - ld hl, rLCDC ; $ff40 + ld hl, rLCDC set 3, [hl] xor a ld hl, wHallOfFame @@ -24,7 +24,7 @@ AnimateHallOfFame: ; 701a0 (1c:41a0) ld [wd358], a ld [wTrainerScreenY], a inc a - ld [H_AUTOBGTRANSFERENABLED], a ; $ffba + ld [H_AUTOBGTRANSFERENABLED], a ld hl, wd5a2 ld a, [hl] inc a @@ -45,17 +45,17 @@ AnimateHallOfFame: ; 701a0 (1c:41a0) inc c push hl push bc - ld [wWhichTrade], a ; wWhichTrade + ld [wWhichTrade], a ld a, c ld [wTrainerEngageDistance], a - ld hl, wPartyMon1Level ; wPartyMon1Level + ld hl, wPartyMon1Level ld bc, wPartyMon2 - wPartyMon1 call AddNTimes ld a, [hl] ld [wTrainerFacingDirection], a call Func_70278 call Func_702e1 - ld c, $50 + ld c, 80 call DelayFrames hlCoord 2, 13 ld b, $3 @@ -79,15 +79,15 @@ AnimateHallOfFame: ; 701a0 (1c:41a0) ld [hl], $ff call SaveHallOfFameTeams xor a - ld [wWhichTrade], a ; wWhichTrade + ld [wWhichTrade], a inc a ld [wTrainerScreenY], a call Func_70278 - call Func_70377 + call HoFDisplayPlayerStats call Func_70423 xor a ld [hWY], a - ld hl, rLCDC ; $ff40 + ld hl, rLCDC res 3, [hl] ret @@ -100,7 +100,7 @@ Func_70278: ; 70278 (1c:4278) ld [hSCY], a ld a, $c0 ld [hSCX], a - ld a, [wWhichTrade] ; wWhichTrade + ld a, [wWhichTrade] ld [wcf91], a ld [wd0b5], a ld [wBattleMonSpecies2], a @@ -108,7 +108,7 @@ Func_70278: ; 70278 (1c:4278) ld a, [wTrainerScreenY] and a jr z, .asm_7029d - call Func_7033e + call HoFLoadPlayerPics jr .asm_702ab .asm_7029d hlCoord 12, 5 @@ -120,7 +120,7 @@ Func_70278: ; 70278 (1c:4278) ld c, $0 call GoPAL_SET ld a, $e4 - ld [rBGP], a ; $ff47 + ld [rBGP], a ld c, $31 call Func_7036d ld d, $a0 @@ -148,7 +148,7 @@ Func_70278: ; 70278 (1c:4278) Func_702e1: ; 702e1 (1c:42e1) ld a, [wTrainerEngageDistance] - ld hl, wPartyMonNicks ; wPartyMonNicks + ld hl, wPartyMonNicks call GetPartyMonName call Func_702f0 jp Func_70404 @@ -167,11 +167,11 @@ Func_702f0: ; 702f0 (1c:42f0) ld a, [wTrainerFacingDirection] hlCoord 8, 7 call PrintLevelCommon - ld a, [wWhichTrade] ; wWhichTrade + ld a, [wWhichTrade] ld [wd0b5], a hlCoord 3, 9 predef PrintMonType - ld a, [wWhichTrade] ; wWhichTrade + ld a, [wWhichTrade] jp PlayCry HoFMonInfoText: ; 70329 (1c:4329) @@ -179,8 +179,8 @@ HoFMonInfoText: ; 70329 (1c:4329) next "TYPE1/" next "TYPE2/@" -Func_7033e: ; 7033e (1c:433e) - ld de, RedPicFront ; $6ede +HoFLoadPlayerPics: ; 7033e (1c:433e) + ld de, RedPicFront ld a, BANK(RedPicFront) call UncompressSpriteFromDE ld hl, S_SPRITEBUFFER1 @@ -189,7 +189,7 @@ Func_7033e: ; 7033e (1c:433e) call CopyData ld de, vFrontPic call InterlaceMergeSpriteBuffers - ld de, RedPicBack ; $7e0a + ld de, RedPicBack ld a, BANK(RedPicBack) call UncompressSpriteFromDE predef ScaleSpriteByTwo @@ -202,7 +202,7 @@ Func_7036d: ; 7036d (1c:436d) hlCoord 12, 5 predef_jump CopyTileIDsFromList -Func_70377: ; 70377 (1c:4377) +HoFDisplayPlayerStats: ; 70377 (1c:4377) ld hl, wd747 set 3, [hl] predef DisplayDexRating @@ -215,7 +215,7 @@ Func_70377: ; 70377 (1c:4377) ld c, $9 call TextBoxBorder hlCoord 7, 2 - ld de, wPlayerName ; wd158 + ld de, wPlayerName call PlaceString hlCoord 1, 6 ld de, HoFPlayTimeText @@ -233,18 +233,18 @@ Func_70377: ; 70377 (1c:4377) ld de, HoFMoneyText call PlaceString hlCoord 4, 10 - ld de, wPlayerMoney ; wPlayerMoney + ld de, wPlayerMoney ld c, $a3 call PrintBCDNumber ld hl, DexSeenOwnedText - call Func_703e2 + call HoFPrintTextAndDelay ld hl, DexRatingText - call Func_703e2 + call HoFPrintTextAndDelay ld hl, wcc5d -Func_703e2: ; 703e2 (1c:43e2) +HoFPrintTextAndDelay: ; 703e2 (1c:43e2) call PrintText - ld c, $78 + ld c, 120 jp DelayFrames HoFPlayTimeText: ; 703ea (1c:43ea) @@ -266,7 +266,7 @@ Func_70404: ; 70404 (1c:4404) ld bc, HOF_MON ld a, [wTrainerEngageDistance] call AddNTimes - ld a, [wWhichTrade] ; wWhichTrade + ld a, [wWhichTrade] ld [hli], a ld a, [wTrainerFacingDirection] ld [hli], a diff --git a/engine/hidden_object_functions14.asm b/engine/hidden_object_functions14.asm index a162c905..e0ed973d 100755 --- a/engine/hidden_object_functions14.asm +++ b/engine/hidden_object_functions14.asm @@ -11,7 +11,7 @@ TMNotebook: ; 529a4 (14:69a4) db "@" ViridianSchoolNotebook: ; 529aa (14:69aa) - db $08 ; asm + TX_ASM ld hl, ViridianSchoolNotebookText1 call PrintText call TurnPageSchoolNotebook @@ -66,8 +66,7 @@ ViridianSchoolNotebookText4: ; 52a03 (14:6a03) PrintFightingDojoText2: ; 52a08 (14:6a08) call EnableAutoTextBoxDrawing - ld a, $37 - jp PrintPredefTextID + tx_pre_jump FightingDojoText_52a10 FightingDojoText_52a10: ; 52a10 (14:6a10) TX_FAR _FightingDojoText_52a10 @@ -75,8 +74,7 @@ FightingDojoText_52a10: ; 52a10 (14:6a10) PrintFightingDojoText3: ; 52a15 (14:6a15) call EnableAutoTextBoxDrawing - ld a, $38 - jp PrintPredefTextID + tx_pre_jump FightingDojoText_52a1d FightingDojoText_52a1d: ; 52a1d (14:6a1d) TX_FAR _FightingDojoText_52a1d @@ -84,8 +82,7 @@ FightingDojoText_52a1d: ; 52a1d (14:6a1d) PrintFightingDojoText: ; 52a22 (14:6a22) call EnableAutoTextBoxDrawing - ld a, $36 - jp PrintPredefTextID + tx_pre_jump FightingDojoText FightingDojoText: ; 52a2a (14:6a2a) TX_FAR _FightingDojoText @@ -93,11 +90,10 @@ FightingDojoText: ; 52a2a (14:6a2a) PrintIndigoPlateauHQText: ; 52a2f (14:6a2f) ld a, [wSpriteStateData1 + 9] - cp $4 + cp SPRITE_FACING_UP ret nz call EnableAutoTextBoxDrawing - ld a, $27 - jp PrintPredefTextID + tx_pre_jump IndigoPlateauHQText IndigoPlateauHQText: ; 52a3d (14:6a3d) TX_FAR _IndigoPlateauHQText diff --git a/engine/hidden_object_functions17.asm b/engine/hidden_object_functions17.asm index 9dbcbf98..46140927 100755 --- a/engine/hidden_object_functions17.asm +++ b/engine/hidden_object_functions17.asm @@ -1,7 +1,6 @@ PrintRedsNESText: ; 5db79 (17:5b79) call EnableAutoTextBoxDrawing - ld a, $4 ; RedBedroomSNESText - jp PrintPredefTextID + tx_pre_jump RedBedroomSNESText RedBedroomSNESText: ; 5db81 (17:5b81) TX_FAR _RedBedroomSNESText @@ -9,19 +8,17 @@ RedBedroomSNESText: ; 5db81 (17:5b81) OpenRedsPC: ; 5db86 (17:5b86) call EnableAutoTextBoxDrawing - ld a, $3 - jp PrintPredefTextID + tx_pre_jump RedBedroomPCText -RedBedroomPC: ; 5db8e (17:5b8e) +RedBedroomPCText: ; 5db8e (17:5b8e) db $fc ; FuncTX_ItemStoragePC Route15GateLeftBinoculars: ; 5db8f (17:5b8f) ld a, [wSpriteStateData1 + 9] - cp $4 ; i + cp SPRITE_FACING_UP ret nz call EnableAutoTextBoxDrawing - ld a, $a ; text id Route15UpstairsBinocularsText - call PrintPredefTextID + tx_pre Route15UpstairsBinocularsText ld a, ARTICUNO ld [wcf91], a call PlayCry @@ -36,8 +33,7 @@ AerodactylFossil: ; 5dbad (17:5bad) ld [wcf91], a call DisplayMonFrontSpriteInBox call EnableAutoTextBoxDrawing - ld a, $9 - call PrintPredefTextID + tx_pre AerodactylFossilText ret AerodactylFossilText: ; 5dbbe (17:5bbe) @@ -49,8 +45,7 @@ KabutopsFossil: ; 5bdc3 (17:5bc3) ld [wcf91], a call DisplayMonFrontSpriteInBox call EnableAutoTextBoxDrawing - ld a, $b - call PrintPredefTextID + tx_pre KabutopsFossilText ret KabutopsFossilText: ; 5dbd4 (17:5bd4) @@ -61,7 +56,7 @@ DisplayMonFrontSpriteInBox: ; 5dbd9 (17:5bd9) ; Displays a pokemon's front sprite in a pop-up window. ; [wcf91] = pokemon interal id number ld a, $1 - ld [H_AUTOBGTRANSFERENABLED], a ; $ffba + ld [H_AUTOBGTRANSFERENABLED], a call Delay3 xor a ld [hWY], a @@ -78,7 +73,7 @@ DisplayMonFrontSpriteInBox: ; 5dbd9 (17:5bd9) ld a, $80 ld [$ffe1], a hlCoord 10, 11 - predef Func_3f073 + predef AnimateSendingOutMon call WaitForTextScrollButtonPress call LoadScreenTilesFromBuffer1 call Delay3 @@ -95,7 +90,7 @@ PrintBlackboardLinkCableText: ; 5dc1a (17:5c1a) ret LinkCableHelp: ; 5dc29 (17:5c29) - db $08 ; asm + TX_ASM call SaveScreenTilesToBuffer1 ld hl, LinkCableHelpText1 call PrintText @@ -125,10 +120,10 @@ LinkCableHelp: ; 5dc29 (17:5c29) call PrintText call HandleMenuInput bit 1, a - jr nz, .asm_5dc93 ; 0x5dc74 $1d + jr nz, .asm_5dc93 ld a, [wCurrentMenuItem] cp $3 - jr z, .asm_5dc93 ; 0x5dc7b $16 + jr z, .asm_5dc93 ld hl, wd730 res 6, [hl] ld hl, LinkCableInfoTexts @@ -179,7 +174,7 @@ LinkCableInfoText3: ; 5dce8 (17:5ce8) db "@" ViridianSchoolBlackboard: ; 5dced (17:5ced) - db $08 ; asm + TX_ASM call SaveScreenTilesToBuffer1 ld hl, ViridianSchoolBlackboardText1 call PrintText @@ -307,8 +302,7 @@ ViridianBlackboardFrozenText: ; 5ddea (17:5dea) PrintTrashText: ; 5ddef (17:5def) call EnableAutoTextBoxDrawing - ld a, $26 - jp PrintPredefTextID + tx_pre_jump VermilionGymTrashText VermilionGymTrashText: ; 5ddf7 (17:5df7) TX_FAR _VermilionGymTrashText @@ -316,7 +310,7 @@ VermilionGymTrashText: ; 5ddf7 (17:5df7) GymTrashScript: ; 5ddfc (17:5dfc) call EnableAutoTextBoxDrawing - ld a, [wWhichTrade] ; wWhichTrade + ld a, [wWhichTrade] ld [wcd5b], a ; Don't do the trash can puzzle if it's already been done. @@ -324,8 +318,7 @@ GymTrashScript: ; 5ddfc (17:5dfc) bit 0, a jr z, .ok - ld a, $26 ; DisplayTextID $26 = VermilionGymTrashText (nothing in the trash) - jp PrintPredefTextID + tx_pre_jump VermilionGymTrashText .ok bit 1, a @@ -337,7 +330,7 @@ GymTrashScript: ; 5ddfc (17:5dfc) cp b jr z, .openFirstLock - ld a, $26 ; DisplayTextID $26 = VermilionGymTrashText (nothing in the trash) + tx_pre_id VermilionGymTrashText jr .done .openFirstLock @@ -345,7 +338,7 @@ GymTrashScript: ; 5ddfc (17:5dfc) ld hl, wd773 set 1, [hl] - ld hl, GymTrashCans ; $5e7d + ld hl, GymTrashCans ld a, [wcd5b] ; * 5 ld b, a @@ -375,7 +368,7 @@ GymTrashScript: ; 5ddfc (17:5dfc) and $f ld [wd744], a - ld a, $3b ; DisplayTextID $3b = VermilionGymTrashSuccesText1 (first lock opened!) + tx_pre_id VermilionGymTrashSuccesText1 jr .done .trySecondLock @@ -393,7 +386,7 @@ GymTrashScript: ; 5ddfc (17:5dfc) and $e ld [wd743], a - ld a, $3e ; DisplayTextID $3e = VermilionGymTrashFailText (locks reset!) + tx_pre_id VermilionGymTrashFailText jr .done .openSecondLock @@ -403,7 +396,7 @@ GymTrashScript: ; 5ddfc (17:5dfc) ld hl, wd126 set 6, [hl] - ld a, $3d ; DisplayTextID $3d = VermilionGymTrashSuccesText3 (2nd lock opened!) + tx_pre_id VermilionGymTrashSuccesText3 .done jp PrintPredefTextID @@ -428,19 +421,21 @@ GymTrashCans: ; 5de7d (17:5e7d) VermilionGymTrashSuccesText1: ; 5dec8 (17:5ec8) TX_FAR _VermilionGymTrashSuccesText1 - db $08 ; asm + TX_ASM call WaitForSoundToFinish ld a, (SFX_02_49 - SFX_Headers_02) / 3 call PlaySound call WaitForSoundToFinish jp TextScriptEnd +; unused VermilionGymTrashSuccesText2: ; 5dedb (17:5edb) TX_FAR _VermilionGymTrashSuccesText2 db "@" -UnnamedText_5dee0: ; 5dee0 (17:5ee0) - db $08 ; asm +; unused +VermilionGymTrashSuccesPlaySfx: ; 5dee0 (17:5ee0) + TX_ASM call WaitForSoundToFinish ld a, (SFX_02_49 - SFX_Headers_02) / 3 call PlaySound @@ -449,7 +444,7 @@ UnnamedText_5dee0: ; 5dee0 (17:5ee0) VermilionGymTrashSuccesText3: ; 5deef (17:5eef) TX_FAR _VermilionGymTrashSuccesText3 - db $08 ; asm + TX_ASM call WaitForSoundToFinish ld a, (SFX_02_57 - SFX_Headers_02) / 3 call PlaySound @@ -458,7 +453,7 @@ VermilionGymTrashSuccesText3: ; 5deef (17:5eef) VermilionGymTrashFailText: ; 5df02 (17:5f02) TX_FAR _VermilionGymTrashFailText - db $08 ; asm + TX_ASM call WaitForSoundToFinish ld a, (SFX_02_51 - SFX_Headers_02) / 3 call PlaySound diff --git a/engine/hidden_object_functions18.asm b/engine/hidden_object_functions18.asm index 7696626f..e293b0a0 100755 --- a/engine/hidden_object_functions18.asm +++ b/engine/hidden_object_functions18.asm @@ -1,31 +1,31 @@ GymStatues: ; 62419 (18:6419) -; if in a gym and have the corresponding badge, a = $D and jp PrintPredefTextID -; if in a gym and don’t have the corresponding badge, a = $C and jp PrintPredefTextID +; if in a gym and have the corresponding badge, a = GymStatueText2_id and jp PrintPredefTextID +; if in a gym and don’t have the corresponding badge, a = GymStatueText1_id and jp PrintPredefTextID ; else ret call EnableAutoTextBoxDrawing ld a, [wSpriteStateData1 + 9] - cp $4 + cp SPRITE_FACING_UP ret nz ld hl, .BadgeFlags ld a, [W_CURMAP] ld b, a -.asm_62429 +.loop ld a, [hli] cp $ff ret z cp b - jr z, .asm_62433 ; 0x6242e $3 + jr z, .match inc hl - jr .asm_62429 ; 0x62431 $f6 -.asm_62433 + jr .loop +.match ld b, [hl] ld a, [wd72a] and b cp b - ld a, $d - jr z, .asm_6243f ; 0x6243b $2 - ld a, $c -.asm_6243f + tx_pre_id GymStatueText2 + jr z, .haveBadge + tx_pre_id GymStatueText1 +.haveBadge jp PrintPredefTextID .BadgeFlags: ; 62442 (18:6442) @@ -49,41 +49,53 @@ GymStatueText2: ; 62458 (18:6458) PrintBenchGuyText: ; 6245d (18:645d) call EnableAutoTextBoxDrawing - ld hl, PokeCenterMapIDList + ld hl, BenchGuyTextPointers ld a, [W_CURMAP] ld b, a -.asm_62467 +.loop ld a, [hli] cp $ff ret z cp b - jr z, .asm_62472 + jr z, .match inc hl inc hl - jr .asm_62467 -.asm_62472 + jr .loop +.match ld a, [hli] ld b, a ld a, [wSpriteStateData1 + 9] cp b - jr nz, .asm_62467 + jr nz, .loop ; player isn't facing left at the bench guy ld a, [hl] jp PrintPredefTextID -; format: db map id, 08, text id of PredefTextIDPointerTable -PokeCenterMapIDList: ; 6247e (18:647e) - db VIRIDIAN_POKECENTER,$08,$0F - db PEWTER_POKECENTER,$08,$10 - db CERULEAN_POKECENTER,$08,$11 - db LAVENDER_POKECENTER,$08,$12 - db VERMILION_POKECENTER,$08,$13 - db CELADON_POKECENTER,$08,$14 - db CELADON_HOTEL,$08,$15 - db FUCHSIA_POKECENTER,$08,$16 - db CINNABAR_POKECENTER,$08,$17 - db SAFFRON_POKECENTER,$08,$18 - db MT_MOON_POKECENTER,$08,$19 - db ROCK_TUNNEL_POKECENTER,$08,$1A +; format: db map id, player sprite facing direction, text id of PredefTextIDPointerTable +BenchGuyTextPointers: ; 6247e (18:647e) + db VIRIDIAN_POKECENTER, SPRITE_FACING_LEFT + db (ViridianCityPokecenterBenchGuyText_id - TextPredefs) / 2 + 1 + db PEWTER_POKECENTER, SPRITE_FACING_LEFT + db (PewterCityPokecenterBenchGuyText_id - TextPredefs) / 2 + 1 + db CERULEAN_POKECENTER, SPRITE_FACING_LEFT + db (CeruleanCityPokecenterBenchGuyText_id - TextPredefs) / 2 + 1 + db LAVENDER_POKECENTER, SPRITE_FACING_LEFT + db (LavenderCityPokecenterBenchGuyText_id - TextPredefs) / 2 + 1 + db VERMILION_POKECENTER, SPRITE_FACING_LEFT + db (VermilionCityPokecenterBenchGuyText_id - TextPredefs) / 2 + 1 + db CELADON_POKECENTER, SPRITE_FACING_LEFT + db (CeladonCityPokecenterBenchGuyText_id - TextPredefs) / 2 + 1 + db CELADON_HOTEL, SPRITE_FACING_LEFT + db (CeladonCityHotelText_id - TextPredefs) / 2 + 1 + db FUCHSIA_POKECENTER, SPRITE_FACING_LEFT + db (FuchsiaCityPokecenterBenchGuyText_id - TextPredefs) / 2 + 1 + db CINNABAR_POKECENTER, SPRITE_FACING_LEFT + db (CinnabarIslandPokecenterBenchGuyText_id - TextPredefs) / 2 + 1 + db SAFFRON_POKECENTER, SPRITE_FACING_LEFT + db (SaffronCityPokecenterBenchGuyText_id - TextPredefs) / 2 + 1 + db MT_MOON_POKECENTER, SPRITE_FACING_LEFT + db (MtMoonPokecenterBenchGuyText_id - TextPredefs) / 2 + 1 + db ROCK_TUNNEL_POKECENTER,SPRITE_FACING_LEFT + db (RockTunnelPokecenterBenchGuyText_id - TextPredefs) / 2 + 1 db $FF ViridianCityPokecenterBenchGuyText: ; 624a3 (18:64a3) @@ -139,11 +151,11 @@ CinnabarIslandPokecenterBenchGuyText: ; 624df (18:64df) db "@" SaffronCityPokecenterBenchGuyText: ; 624e4 (18:64e4) - db $8 ; asm + TX_ASM ld a, [wd838] bit 7, a ld hl, SaffronCityPokecenterBenchGuyText2 - jr nz, .asm_624f2 ; 0x624ed $3 + jr nz, .asm_624f2 ld hl, SaffronCityPokecenterBenchGuyText1 .asm_624f2 call PrintText @@ -163,13 +175,12 @@ CeladonCityHotelText: ; 62502 (18:6502) ret -TerminatorText_62508: ; 62508 (18:6508) +UnusedPredefText: ; 62508 (18:6508) db "@" PrintBookcaseText: ; 6509 (18:6509) call EnableAutoTextBoxDrawing - ld a, $e ; BookcaseText - jp PrintPredefTextID + tx_pre_jump BookcaseText BookcaseText: ; 62511 (18:6511) TX_FAR _BookcaseText @@ -177,13 +188,12 @@ BookcaseText: ; 62511 (18:6511) OpenPokemonCenterPC: ; 62516 (18:6516) ld a, [wSpriteStateData1 + 9] - cp $4 ; check to see if player is facing up + cp SPRITE_FACING_UP ; check to see if player is facing up ret nz call EnableAutoTextBoxDrawing ld a, $1 ld [wAutoTextBoxDrawingControl], a - ld a, $1f ; PredefText1f - jp PrintPredefTextID + tx_pre_jump PokemonCenterPCText -PredefText1f: ; 62529 (18:6529) +PokemonCenterPCText: ; 62529 (18:6529) db $F9 ; FuncTX_PokemonCenterPC diff --git a/engine/hidden_object_functions3.asm b/engine/hidden_object_functions3.asm index c471c7bb..c40073cb 100755 --- a/engine/hidden_object_functions3.asm +++ b/engine/hidden_object_functions3.asm @@ -40,27 +40,44 @@ PrintBookshelfText: ; fb50 (3:7b50) ; format: db tileset id, bookshelf tile id, text id BookshelfTileIDs: ; fb8b (3:7b8b) - db PLATEAU, $30, $3A - db HOUSE, $3D, $3F - db HOUSE, $1E, $40 - db MANSION, $32, $40 - db REDS_HOUSE_1, $32, $40 - db LAB, $28, $40 - db LOBBY, $16, $41 - db GYM, $1D, $40 - db DOJO, $1D, $40 - db GATE, $22, $40 - db MART, $54, $42 - db MART, $55, $42 - db POKECENTER, $54, $42 - db POKECENTER, $55, $42 - db LOBBY, $50, $42 - db LOBBY, $52, $42 - db SHIP, $36, $40 + db PLATEAU, $30 + db (IndigoPlateauStatues_id - TextPredefs) / 2 + 1 + db HOUSE, $3D + db (TownMapText_id - TextPredefs) / 2 + 1 + db HOUSE, $1E + db (BookOrSculptureText_id - TextPredefs) / 2 + 1 + db MANSION, $32 + db (BookOrSculptureText_id - TextPredefs) / 2 + 1 + db REDS_HOUSE_1, $32 + db (BookOrSculptureText_id - TextPredefs) / 2 + 1 + db LAB, $28 + db (BookOrSculptureText_id - TextPredefs) / 2 + 1 + db LOBBY, $16 + db (ElevatorText_id - TextPredefs) / 2 + 1 + db GYM, $1D + db (BookOrSculptureText_id - TextPredefs) / 2 + 1 + db DOJO, $1D + db (BookOrSculptureText_id - TextPredefs) / 2 + 1 + db GATE, $22 + db (BookOrSculptureText_id - TextPredefs) / 2 + 1 + db MART, $54 + db (PokemonStuffText_id - TextPredefs) / 2 + 1 + db MART, $55 + db (PokemonStuffText_id - TextPredefs) / 2 + 1 + db POKECENTER, $54 + db (PokemonStuffText_id - TextPredefs) / 2 + 1 + db POKECENTER, $55 + db (PokemonStuffText_id - TextPredefs) / 2 + 1 + db LOBBY, $50 + db (PokemonStuffText_id - TextPredefs) / 2 + 1 + db LOBBY, $52 + db (PokemonStuffText_id - TextPredefs) / 2 + 1 + db SHIP, $36 + db (BookOrSculptureText_id - TextPredefs) / 2 + 1 db $FF IndigoPlateauStatues: ; fbbf (3:7bbf) - db $08 ; asm + TX_ASM ld hl, IndigoPlateauStatuesText1 call PrintText ld a, [W_XCOORD] @@ -85,7 +102,7 @@ IndigoPlateauStatuesText3: ; fbe3 (3:7be3) db "@" BookOrSculptureText: ; fbe8 (3:7be8) - db $08 ; asm + TX_ASM ld hl, PokemonBooksText ld a, [W_CURMAPTILESET] cp MANSION ; Celadon Mansion tileset @@ -113,7 +130,7 @@ ElevatorText: ; fc0d (3:7c0d) TownMapText: ; fc12 (3:7c12) TX_FAR _TownMapText db $06 - db $08 ; asm + TX_ASM ld a, $1 ld [wDoNotWaitForButtonPressAfterDisplayingText], a ld hl, wd730 diff --git a/engine/hidden_object_functions7.asm b/engine/hidden_object_functions7.asm index f97190de..f29b0925 100755 --- a/engine/hidden_object_functions7.asm +++ b/engine/hidden_object_functions7.asm @@ -1,7 +1,6 @@ PrintNewBikeText: ; 1e94b (7:694b) call EnableAutoTextBoxDrawing - ld a, $39 - jp PrintPredefTextID + tx_pre_jump NewBicycleText NewBicycleText: ; 1e953 (7:6953) TX_FAR _NewBicycleText @@ -9,8 +8,7 @@ NewBicycleText: ; 1e953 (7:6953) DisplayOakLabLeftPoster: ; 1e958 (7:6958) call EnableAutoTextBoxDrawing - ld a, $05 ; PushStartText - jp PrintPredefTextID + tx_pre_jump PushStartText PushStartText: ; 1e960 (7:6960) TX_FAR _PushStartText @@ -23,10 +21,10 @@ DisplayOakLabRightPoster: ; 1e965 (7:6965) call CountSetBits ld a, [wd11e] cp $2 - ld a, $6 ; SaveOptionText - jr c, .asm_1e97b - ld a, $7 ; StrengthsAndWeaknessesText -.asm_1e97b + tx_pre_id SaveOptionText + jr c, .ownThreeOrMoreMon + tx_pre_id StrengthsAndWeaknessesText +.ownThreeOrMoreMon jp PrintPredefTextID SaveOptionText: ; 1e97e (7:697e) @@ -40,29 +38,29 @@ StrengthsAndWeaknessesText: ; 1e983 (7:6983) SafariZoneCheck: ; 1e988 (7:6988) ld hl, wd790 bit 7, [hl] - jr z, asm_1e9ab - ld a, [W_NUMSAFARIBALLS] ; W_NUMSAFARIBALLS + jr z, SafariZoneGameOver + ld a, [W_NUMSAFARIBALLS] and a - jr z, asm_1e9b0 - jr asm_1e9ab + jr z, SafariZoneGameStillGoing + jr SafariZoneGameOver SafariZoneCheckSteps: ; 1e997 (7:6997) - ld a, [wSafariSteps] ; wd70d + ld a, [wSafariSteps] ld b, a - ld a, [wSafariSteps + 1] ; wd70e + ld a, [wSafariSteps + 1] ld c, a or b - jr z, asm_1e9b0 + jr z, SafariZoneGameStillGoing dec bc ld a, b - ld [wSafariSteps], a ; wd70d + ld [wSafariSteps], a ld a, c - ld [wSafariSteps + 1], a ; wd70e -asm_1e9ab: ; 1e9ab (7:69ab) + ld [wSafariSteps + 1], a +SafariZoneGameOver: ; 1e9ab (7:69ab) xor a ld [wSafariZoneGameOver], a ret -asm_1e9b0: ; 1e9b0 (7:69b0) +SafariZoneGameStillGoing: ; 1e9b0 (7:69b0) call EnableAutoTextBoxDrawing xor a ld [wMusicHeaderPointer], a @@ -76,12 +74,12 @@ asm_1e9b0: ; 1e9b0 (7:69b0) cp $b9 jr nz, .asm_1e9c2 ld a, $d3 - ld [H_DOWNARROWBLINKCNT2], a ; $ff8c + ld [H_DOWNARROWBLINKCNT2], a call DisplayTextID xor a ld [wd528], a ld a, SAFARI_ZONE_ENTRANCE - ld [H_DOWNARROWBLINKCNT1], a ; $ff8b + ld [H_DOWNARROWBLINKCNT1], a ld a, $3 ld [wDestinationWarpID], a ld a, $5 @@ -99,8 +97,8 @@ PrintSafariGameOverText: ; 1e9ed (7:69ed) jp PrintText SafariGameOverText: ; 1e9f7 (7:69f7) - db $08 ; asm - ld a, [W_NUMSAFARIBALLS] ; W_NUMSAFARIBALLS + TX_ASM + ld a, [W_NUMSAFARIBALLS] and a jr z, .asm_1ea04 ld hl, TimesUpText @@ -120,17 +118,16 @@ GameOverText: ; 1ea12 (7:6a12) PrintCinnabarQuiz: ; 1ea17 (7:6a17) ld a, [wSpriteStateData1 + 9] - cp $4 + cp SPRITE_FACING_UP ret nz call EnableAutoTextBoxDrawing - ld a, $31 - jp PrintPredefTextID + tx_pre_jump CinnabarGymQuiz CinnabarGymQuiz: ; 1ea25 (7:6a25) - db $08 ; asm + TX_ASM xor a ld [wda38], a - ld a, [wWhichTrade] ; wWhichTrade + ld a, [wWhichTrade] push af and $f ld [$ffdb], a @@ -200,7 +197,7 @@ CinnabarGymQuiz_1ea92: ; 1ea92 (7:6a92) call YesNoChoice ld a, [$ffdc] ld c, a - ld a, [wCurrentMenuItem] ; wCurrentMenuItem + ld a, [wCurrentMenuItem] cp c jr nz, .asm_1eab8 ld hl, wd126 @@ -267,7 +264,7 @@ CinnabarGymQuiz_1eb0a: ; 1eb0a (7:6b0a) add a ld d, $0 ld e, a - ld hl, CinnabarGymGateCoords ; $6b48 + ld hl, CinnabarGymGateCoords add hl, de ld a, [hli] ld b, [hl] @@ -309,8 +306,7 @@ CinnabarGymGateCoords: ; 1eb48 (7:6b48) PrintMagazinesText: ; 1eb60 (7:6b60) call EnableAutoTextBoxDrawing - ld a, $30 - call PrintPredefTextID + tx_pre MagazinesText ret MagazinesText: ; 1eb69 (7:6b69) @@ -320,7 +316,7 @@ MagazinesText: ; 1eb69 (7:6b69) BillsHousePC: ; 1eb6e (7:6b6e) call EnableAutoTextBoxDrawing ld a, [wSpriteStateData1 + 9] - cp $4 + cp SPRITE_FACING_UP ret nz ld a, [wd7f2] bit 7, a @@ -330,29 +326,27 @@ BillsHousePC: ; 1eb6e (7:6b6e) bit 6, a jr nz, .asm_1eb8b .asm_1eb86 - ld a, $2d - jp PrintPredefTextID + tx_pre_jump BillsHouseMonitorText .asm_1eb8b ld a, $1 ld [wDoNotWaitForButtonPressAfterDisplayingText], a - ld a, $2e - call PrintPredefTextID - ld c, $20 + tx_pre BillsHouseInitiatedText + ld c, 32 call DelayFrames ld a, (SFX_02_3c - SFX_Headers_02) / 3 call PlaySound call WaitForSoundToFinish - ld c, $50 + ld c, 80 call DelayFrames ld a, (SFX_02_48 - SFX_Headers_02) / 3 call PlaySound call WaitForSoundToFinish - ld c, $30 + ld c, 48 call DelayFrames ld a, (SFX_02_3c - SFX_Headers_02) / 3 call PlaySound call WaitForSoundToFinish - ld c, $20 + ld c, 32 call DelayFrames ld a, (SFX_02_3a - SFX_Headers_02) / 3 call PlaySound @@ -364,8 +358,7 @@ BillsHousePC: ; 1eb6e (7:6b6e) .asm_1ebd2 ld a, $1 ld [wDoNotWaitForButtonPressAfterDisplayingText], a - ld a, $2f - call PrintPredefTextID + tx_pre BillsHousePokemonList ret BillsHouseMonitorText: ; 1ebdd (7:6bdd) @@ -375,21 +368,21 @@ BillsHouseMonitorText: ; 1ebdd (7:6bdd) BillsHouseInitiatedText: ; 1ebe2 (7:6be2) TX_FAR _BillsHouseInitiatedText db $06 - db $08 ; asm + TX_ASM ld a, $ff ld [wc0ee], a call PlaySound - ld c, $10 + ld c, 16 call DelayFrames ld a, (SFX_02_49 - SFX_Headers_02) / 3 call PlaySound call WaitForSoundToFinish - ld c, $3c + ld c, 60 call DelayFrames jp TextScriptEnd BillsHousePokemonList: ; 1ec05 (7:6c05) - db $08 ; asm + TX_ASM call SaveScreenTilesToBuffer1 ld hl, BillsHousePokemonListText1 call PrintText @@ -459,11 +452,10 @@ BillsHousePokemonListText2: ; 1ecaa (7:6caa) DisplayOakLabEmailText: ; 1ecaf (7:6caf) ld a, [wSpriteStateData1 + 9] - cp $4 + cp SPRITE_FACING_UP ret nz call EnableAutoTextBoxDrawing - ld a, $8 ; OakLabEmailText - jp PrintPredefTextID + tx_pre_jump OakLabEmailText OakLabEmailText: ; 1ecbd (7:6cbd) TX_FAR _OakLabEmailText diff --git a/engine/hp_bar.asm b/engine/hp_bar.asm index 333b0b90..61209778 100755 --- a/engine/hp_bar.asm +++ b/engine/hp_bar.asm @@ -143,7 +143,7 @@ UpdateHPBar_AnimateHPBar: ; fab1 (3:7ab1) push de ld d, $6 call DrawHPBar - ld c, $2 + ld c, 2 call DelayFrames pop de ld a, [wHPBarDelta] ; +1 or -1 diff --git a/engine/in_game_trades.asm b/engine/in_game_trades.asm index cb03a074..32b55002 100755 --- a/engine/in_game_trades.asm +++ b/engine/in_game_trades.asm @@ -22,7 +22,7 @@ DoInGameTradeDialogue: ; 71ad9 (1c:5ad9) pop af ld l,a ld h,$0 - ld de,InGameTradeTextPointers ; $5d64 + ld de,InGameTradeTextPointers add hl,hl add hl,de ld a,[hli] diff --git a/engine/intro.asm b/engine/intro.asm index 7c0464d3..2043771d 100755 --- a/engine/intro.asm +++ b/engine/intro.asm @@ -106,12 +106,12 @@ PlayIntroScene: ; 4169d (10:569d) call PlaySound xor a ld [wd09f], a - ld de, IntroNidorinoAnimation4 ; $5931 + ld de, IntroNidorinoAnimation4 call AnimateIntroNidorino ; hop ld a, (SFX_1f_60 - SFX_Headers_1f) / 3 call PlaySound - ld de, IntroNidorinoAnimation5 ; $593c + ld de, IntroNidorinoAnimation5 call AnimateIntroNidorino ld c, $14 call CheckForUserInterruption @@ -119,7 +119,7 @@ PlayIntroScene: ; 4169d (10:569d) ld a, $24 ld [wd09f], a - ld de, IntroNidorinoAnimation6 ; $5947 + ld de, IntroNidorinoAnimation6 call AnimateIntroNidorino ld c, $1e call CheckForUserInterruption @@ -130,17 +130,17 @@ PlayIntroScene: ; 4169d (10:569d) call PlaySound ld a, $48 ld [wd09f], a - ld de, IntroNidorinoAnimation7 ; $5950 + ld de, IntroNidorinoAnimation7 jp AnimateIntroNidorino AnimateIntroNidorino: ; 41793 (10:5793) ld a, [de] cp $50 ret z - ld [W_BASECOORDY], a ; wd082 + ld [W_BASECOORDY], a inc de ld a, [de] - ld [W_BASECOORDX], a ; wd081 + ld [W_BASECOORDX], a push de ld c, $24 call Func_417ae @@ -155,10 +155,10 @@ Func_417ae: ; 417ae (10:57ae) ld a, [wd09f] ld d, a .asm_417b5 - ld a, [W_BASECOORDY] ; wd082 + ld a, [W_BASECOORDY] add [hl] ld [hli], a - ld a, [W_BASECOORDX] ; wd081 + ld a, [W_BASECOORDX] add [hl] ld [hli], a ld a, d @@ -174,14 +174,14 @@ Func_417c7: ; 417c7 (10:57c7) ld d, $0 .asm_417cc push bc - ld a, [W_BASECOORDY] ; wd082 + ld a, [W_BASECOORDY] ld e, a .asm_417d1 ld a, e add $8 ld e, a ld [hli], a - ld a, [W_BASECOORDX] ; wd081 + ld a, [W_BASECOORDX] ld [hli], a ld a, d ld [hli], a @@ -190,9 +190,9 @@ Func_417c7: ; 417c7 (10:57c7) inc d dec c jr nz, .asm_417d1 - ld a, [W_BASECOORDX] ; wd081 + ld a, [W_BASECOORDX] add $8 - ld [W_BASECOORDX], a ; wd081 + ld [W_BASECOORDX], a pop bc dec b jr nz, .asm_417cc @@ -236,9 +236,9 @@ Func_4180e: ; 4180e (10:580e) .asm_4181d push de ld a, $2 - ld [W_BASECOORDX], a ; wd081 + ld [W_BASECOORDX], a xor a - ld [W_BASECOORDY], a ; wd082 + ld [W_BASECOORDY], a ld c, $24 call Func_417ae pop de @@ -265,27 +265,27 @@ CopyTileIDsFromList_ZeroBaseTileID: ; 41842 (10:5842) predef_jump CopyTileIDsFromList Func_41849: ; 41849 (10:5849) - predef Func_79869 + predef GetMoveSoundB ld a, b jp PlaySound LoadIntroGraphics: ; 41852 (10:5852) - ld hl, FightIntroBackMon ; $5a99 + ld hl, FightIntroBackMon ld de, vChars2 ld bc, $600 ld a, BANK(FightIntroBackMon) call FarCopyData2 - ld hl, GameFreakIntro ; $5959 + ld hl, GameFreakIntro ld de, vChars2 + $600 ld bc, $140 ld a, BANK(GameFreakIntro) call FarCopyData2 - ld hl, GameFreakIntro ; $5959 + ld hl, GameFreakIntro ld de, vChars1 ld bc, $140 ld a, BANK(GameFreakIntro) call FarCopyData2 - ld hl, FightIntroFrontMon ; $6099 + ld hl, FightIntroFrontMon ld de, vChars0 ld bc, $6c0 ld a, BANK(FightIntroFrontMon) @@ -296,26 +296,26 @@ PlayShootingStar: ; 4188a (10:588a) call GoPAL_SET callba LoadCopyrightAndTextBoxTiles ld a, $e4 - ld [rBGP], a ; $ff47 - ld c, $b4 + ld [rBGP], a + ld c, 180 call DelayFrames call ClearScreen call DisableLCD xor a - ld [W_CUROPPONENT], a ; wd059 + ld [W_CUROPPONENT], a call Func_418e9 call LoadIntroGraphics call EnableLCD - ld hl, rLCDC ; $ff40 + ld hl, rLCDC res 5, [hl] set 3, [hl] - ld c, $40 + ld c, 64 call DelayFrames callba AnimateShootingStar push af pop af jr c, .asm_418d0 - ld c, $28 + ld c, 40 call DelayFrames .asm_418d0 ld a, BANK(Music_IntroBattle) diff --git a/engine/items/itemfinder.asm b/engine/items/itemfinder.asm index d7e5b3ce..96abecd3 100755 --- a/engine/items/itemfinder.asm +++ b/engine/items/itemfinder.asm @@ -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 diff --git a/engine/items/items.asm b/engine/items/items.asm index 21e6e924..ea4b7403 100755 --- a/engine/items/items.asm +++ b/engine/items/items.asm @@ -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 diff --git a/engine/items/tm_prices.asm b/engine/items/tm_prices.asm index 7c5c56fa..4decc82d 100755 --- a/engine/items/tm_prices.asm +++ b/engine/items/tm_prices.asm @@ -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 diff --git a/engine/learn_move.asm b/engine/learn_move.asm index 75056edb..3c7663b2 100755 --- a/engine/learn_move.asm +++ b/engine/learn_move.asm @@ -206,7 +206,7 @@ TryingToLearnText: ; 6fc3 (1:6fc3) OneTwoAndText: ; 6fc8 (1:6fc8) TX_FAR _OneTwoAndText db $a - db $8 + TX_ASM ld a, (SFX_02_58 - SFX_Headers_02) / 3 call PlaySoundWaitForCurrent ld hl, PoofText diff --git a/engine/load_pokedex_tiles.asm b/engine/load_pokedex_tiles.asm index e8205ef8..5c1f1c93 100755 --- a/engine/load_pokedex_tiles.asm +++ b/engine/load_pokedex_tiles.asm @@ -1,11 +1,11 @@ ; Loads tile patterns for tiles used in the pokedex. LoadPokedexTilePatterns: ; 17840 (5:7840) call LoadHpBarAndStatusTilePatterns - ld de,PokedexTileGraphics ; $6488 + ld de,PokedexTileGraphics ld hl,vChars2 + $600 ld bc,(BANK(PokedexTileGraphics) << 8) + $12 call CopyVideoData - ld de,PokeballTileGraphics ; $697e + ld de,PokeballTileGraphics ld hl,vChars2 + $720 ld bc,(BANK(PokeballTileGraphics) << 8) + $01 jp CopyVideoData ; load pokeball tile for marking caught mons diff --git a/engine/menu/bills_pc.asm b/engine/menu/bills_pc.asm index 61e6204e..c9dd41b1 100644 --- a/engine/menu/bills_pc.asm +++ b/engine/menu/bills_pc.asm @@ -357,7 +357,7 @@ BoxNoPCText: ; 21713 (8:5713) Func_2171b:: ; 2171b (8:571b) ld hl, wPartyMon1Moves ld bc, wPartyMon2 - wPartyMon1 - jr .asm_21729 ; 0x21721 $6 + jr .asm_21729 ld hl, wBoxMon1Moves ld bc, wBoxMon2 - wBoxMon1 .asm_21729 @@ -375,7 +375,7 @@ Func_2171b:: ; 2171b (8:571b) pop hl ret c dec b - jr nz, .asm_21731 ; 0x21741 $ee + jr nz, .asm_21731 and a ret @@ -523,8 +523,7 @@ CableClubLeftGameboy:: ; 5824 (8:5825) .asm_2183a ld [wLinkState], a call EnableAutoTextBoxDrawing - ld a, $22 ; JustAMomentText - jp PrintPredefTextID + tx_pre_jump JustAMomentText CableClubRightGameboy:: ; 5845 (8:5845) ld a, [hSerialConnectionStatus] @@ -541,8 +540,7 @@ CableClubRightGameboy:: ; 5845 (8:5845) .asm_2185a ld [wLinkState], a call EnableAutoTextBoxDrawing - ld a, $22 ; JustAMomentText - jp PrintPredefTextID + tx_pre_jump JustAMomentText JustAMomentText:: ; 21865 (8:5865) TX_FAR _JustAMomentText @@ -552,9 +550,8 @@ JustAMomentText:: ; 21865 (8:5865) cp SPRITE_FACING_UP ret nz call EnableAutoTextBoxDrawing - ld a, $23 - jp PrintPredefTextID + tx_pre_jump OpenBillsPCText -PredefText23:: ; 21878 (8:5878) +OpenBillsPCText:: ; 21878 (8:5878) db $FD ; FuncTX_BillsPC diff --git a/engine/menu/diploma.asm b/engine/menu/diploma.asm index 1624ed70..067cd7d2 100755 --- a/engine/menu/diploma.asm +++ b/engine/menu/diploma.asm @@ -7,7 +7,7 @@ DisplayDiploma: ; 566e2 (15:66e2) ld hl, wd730 set 6, [hl] call DisableLCD - ld hl, CircleTile ; $7d88 + ld hl, CircleTile ld de, vChars2 + $700 ld bc, $0010 ld a, BANK(CircleTile) @@ -15,7 +15,7 @@ DisplayDiploma: ; 566e2 (15:66e2) ld hl, wTileMap ld bc, $1012 predef Diploma_TextBoxBorder - ld hl, DiplomaTextPointersAndCoords ; $6784 + ld hl, DiplomaTextPointersAndCoords ld c, $5 .asm_56715 push bc @@ -32,7 +32,7 @@ DisplayDiploma: ; 566e2 (15:66e2) inc hl pop bc dec c - jr nz, .asm_56715 ; 0x56725 $ee + jr nz, .asm_56715 hlCoord 10, 4 ld de, wPlayerName call PlaceString @@ -48,7 +48,7 @@ DisplayDiploma: ; 566e2 (15:66e2) ld [hli], a inc hl dec c - jr nz, .asm_5673e ; 0x56747 $f5 + jr nz, .asm_5673e call EnableLCD callba LoadTrainerInfoTextBoxTiles ld b, $8 @@ -73,7 +73,7 @@ Func_56777: ; 56777 (15:6777) cp $50 ret z dec c - jr .asm_5677d ; 0x56782 $f9 + jr .asm_5677d DiplomaTextPointersAndCoords: ; 56784 (15:6784) dw DiplomaText diff --git a/engine/menu/main_menu.asm b/engine/menu/main_menu.asm index 756c7755..f0628367 100755 --- a/engine/menu/main_menu.asm +++ b/engine/menu/main_menu.asm @@ -52,7 +52,7 @@ MainMenu: ; 5af2 (1:5af2) .next2 ld hl,wd730 res 6,[hl] - call UpdateSprites ; OAM? + call UpdateSprites xor a ld [wCurrentMenuItem],a ld [wLastMenuItem],a @@ -208,7 +208,7 @@ LinkMenu: ; 5c0a (1:5c0a) ld a, b ld [wLinkMenuSelectionSendBuffer], a and $3 - ld [wCurrentMenuItem], a ; wCurrentMenuItem + ld [wCurrentMenuItem], a .doneChoosingMenuSelection ld a, [hSerialConnectionStatus] cp USING_INTERNAL_CLOCK @@ -261,14 +261,14 @@ LinkMenu: ; 5c0a (1:5c0a) ld [wd72d], a ld hl, PleaseWaitText call PrintText - ld c, $32 + ld c, 50 call DelayFrames ld hl, wd732 res 1, [hl] ld a, [W_ANIMATIONID] ld [wDestinationMap], a call SpecialWarpIn - ld c, $14 + ld c, 20 call DelayFrames xor a ld [wMenuJoypadPollCount], a @@ -304,7 +304,7 @@ Func_5d52: ; 5d52 (1:5d52) ld hl, wd732 res 1, [hl] call OakSpeech - ld c, $14 + ld c, 20 call DelayFrames ; enter map after using a special warp or loading the game from the main menu @@ -338,7 +338,7 @@ TradeCenterText: ; 5d97 (1:5d97) ContinueGame: ; 5db5 (1:5db5) xor a - ld [H_AUTOBGTRANSFERENABLED], a ; $ffba + ld [H_AUTOBGTRANSFERENABLED], a hlCoord 4, 7 ld b, $8 ld c, $e @@ -347,7 +347,7 @@ ContinueGame: ; 5db5 (1:5db5) ld de, SaveScreenInfoText call PlaceString hlCoord 12, 9 - ld de, wPlayerName ; wd158 + ld de, wPlayerName call PlaceString hlCoord 17, 11 call Func_5e2f @@ -356,8 +356,8 @@ ContinueGame: ; 5db5 (1:5db5) hlCoord 13, 15 call Func_5e55 ld a, $1 - ld [H_AUTOBGTRANSFERENABLED], a ; $ffba - ld c, $1e + ld [H_AUTOBGTRANSFERENABLED], a + ld c, 30 jp DelayFrames PrintSaveScreenText: ; 5def (1:5def) @@ -383,7 +383,7 @@ PrintSaveScreenText: ; 5def (1:5def) call Func_5e55 ld a, $1 ld [H_AUTOBGTRANSFERENABLED], a - ld c, $1e + ld c, 30 jp DelayFrames Func_5e2f: ; 5e2f (1:5e2f) @@ -398,7 +398,7 @@ Func_5e2f: ; 5e2f (1:5e2f) Func_5e42: ; 5e42 (1:5e42) push hl - ld hl, wPokedexOwned ; wPokedexOwned + ld hl, wPokedexOwned ld b, wPokedexOwnedEnd - wPokedexOwned call CountSetBits pop hl @@ -481,7 +481,7 @@ DisplayOptionMenu: ; 5e8a (1:5e8a) jr nz,.loop .exitMenu ld a,(SFX_02_40 - SFX_Headers_02) / 3 - call PlaySound ; play sound + call PlaySound ret .eraseOldMenuCursor ld [wTopMenuItemX],a diff --git a/engine/menu/naming_screen.asm b/engine/menu/naming_screen.asm index df862d69..bd1c39dd 100755 --- a/engine/menu/naming_screen.asm +++ b/engine/menu/naming_screen.asm @@ -195,7 +195,7 @@ DisplayNamingScreen: ; 6596 (1:6596) .asm_667e pop de - ld de, .asm_65ed ; $65ed + ld de, .asm_65ed push de .asm_6683 ld a, [wHPBarOldHP] @@ -231,10 +231,10 @@ DisplayNamingScreen: ; 6596 (1:6596) call CalcStringLength ld a, [wHPBarNewHP] cp $e5 - ld de, Dakutens ; $6885 + ld de, Dakutens jr z, .asm_66e3 cp $e4 - ld de, Handakutens ; $68d6 + ld de, Handakutens jr z, .asm_66e3 ld a, [wd07d] cp $2 @@ -332,12 +332,12 @@ ED_Tile: ; 6767 (1:6767) PrintAlphabet: ; 676f (1:676f) xor a - ld [H_AUTOBGTRANSFERENABLED], a ; $ffba + ld [H_AUTOBGTRANSFERENABLED], a ld a, [wHPBarOldHP] and a - ld de, LowerCaseAlphabet ; $679e + ld de, LowerCaseAlphabet jr nz, .asm_677e - ld de, UpperCaseAlphabet ; $67d6 + ld de, UpperCaseAlphabet .asm_677e hlCoord 2, 5 ld bc, $509 @@ -357,7 +357,7 @@ PrintAlphabet: ; 676f (1:676f) jr nz, .asm_6784 call PlaceString ld a, $1 - ld [H_AUTOBGTRANSFERENABLED], a ; $ffba + ld [H_AUTOBGTRANSFERENABLED], a jp Delay3 LowerCaseAlphabet: ; 679e (1:679e) diff --git a/engine/menu/oaks_pc.asm b/engine/menu/oaks_pc.asm index 6e7edda2..7ff03c46 100755 --- a/engine/menu/oaks_pc.asm +++ b/engine/menu/oaks_pc.asm @@ -5,7 +5,7 @@ OpenOaksPC: ; 1e915 (7:6915) ld hl, GetDexRatedText call PrintText call YesNoChoice - ld a, [wCurrentMenuItem] ; wCurrentMenuItem + ld a, [wCurrentMenuItem] and a jr nz, .asm_1e932 predef DisplayDexRating diff --git a/engine/menu/party_menu.asm b/engine/menu/party_menu.asm index 242edd40..6b365e2b 100755 --- a/engine/menu/party_menu.asm +++ b/engine/menu/party_menu.asm @@ -21,7 +21,7 @@ DrawPartyMenu_: ; 12cd2 (4:6cd2) xor a ld [H_AUTOBGTRANSFERENABLED],a call ClearScreen - call UpdateSprites ; move sprites + call UpdateSprites callba LoadMonPartySpriteGfxWithLCDDisabled ; load pokemon icon graphics RedrawPartyMenu_: ; 12ce3 (4:6ce3) diff --git a/engine/menu/pc.asm b/engine/menu/pc.asm index 97895ca6..edc8a751 100755 --- a/engine/menu/pc.asm +++ b/engine/menu/pc.asm @@ -1,13 +1,13 @@ ActivatePC: ; 17e2c (5:7e2c) - call SaveScreenTilesToBuffer2 ;XXX: copy background from wTileMap to wTileMapBackup2 + call SaveScreenTilesToBuffer2 ld a, (SFX_02_45 - SFX_Headers_02) / 3 - call PlaySound ;XXX: play sound or stop music + call PlaySound ld hl, TurnedOnPC1Text call PrintText - call WaitForSoundToFinish ;XXX: wait for sound to be done + call WaitForSoundToFinish ld hl, wFlags_0xcd60 set 3, [hl] - call LoadScreenTilesFromBuffer2 ;XXX: restore saved screen + call LoadScreenTilesFromBuffer2 call Delay3 PCMainMenu: ; 17e48 (5:7e48) callba Func_213c8 @@ -52,28 +52,28 @@ PCMainMenu: ; 17e48 (5:7e48) res 5, [hl] set 3, [hl] ld a, (SFX_02_47 - SFX_Headers_02) / 3 - call PlaySound ;XXX: play sound or stop music - call WaitForSoundToFinish ;XXX: wait for sound to be done + call PlaySound + call WaitForSoundToFinish ld hl, AccessedMyPCText call PrintText callba PlayerPC jr ReloadMainMenu OaksPC: ; 17ec0 (5:7ec0) ld a, (SFX_02_47 - SFX_Headers_02) / 3 - call PlaySound ;XXX: play sound or stop music - call WaitForSoundToFinish ;XXX: wait for sound to be done + call PlaySound + call WaitForSoundToFinish callba OpenOaksPC jr ReloadMainMenu PKMNLeague: ; 17ed2 (5:7ed2) ld a, (SFX_02_47 - SFX_Headers_02) / 3 - call PlaySound ;XXX: play sound or stop music - call WaitForSoundToFinish ;XXX: wait for sound to be done + call PlaySound + call WaitForSoundToFinish callba PKMNLeaguePC jr ReloadMainMenu BillsPC: ; 17ee4 (5:7ee4) ld a, (SFX_02_47 - SFX_Headers_02) / 3 - call PlaySound ;XXX: play sound or stop music - call WaitForSoundToFinish ;XXX: wait for sound to be done + call PlaySound + call WaitForSoundToFinish ld a, [wd7f1] ;has to do with having met Bill bit 0, a jr nz, .billsPC ;if you've met bill, use that bill's instead of someone's @@ -88,12 +88,12 @@ ReloadMainMenu: ; 17f06 (5:7f06) xor a ld [wDoNotWaitForButtonPressAfterDisplayingText], a call ReloadMapData - call UpdateSprites ;XXX: moves sprites + call UpdateSprites jp PCMainMenu LogOff: ; 17f13 (5:7f13) ld a, (SFX_02_46 - SFX_Headers_02) / 3 - call PlaySound ;XXX: play sound or stop music - call WaitForSoundToFinish ;XXX: wait for sound to be done + call PlaySound + call WaitForSoundToFinish ld hl, wFlags_0xcd60 res 3, [hl] res 5, [hl] @@ -117,7 +117,7 @@ AccessedMyPCText: ; 17f32 (5:7f32) ; removes one of the specified item ID [$FFdb] from bag (if existent) RemoveItemByID: ; 17f37 (5:7f37) - ld hl, wBagItems ; wd31e + ld hl, wBagItems ld a, [$ffdb] ld b, a xor a @@ -137,6 +137,6 @@ RemoveItemByID: ; 17f37 (5:7f37) ld a, $1 ld [wcf96], a ld a, [$ffdc] - ld [wWhichPokemon], a ; wWhichPokemon - ld hl, wNumBagItems ; wNumBagItems + ld [wWhichPokemon], a + ld hl, wNumBagItems jp RemoveItemFromInventory diff --git a/engine/menu/pokedex.asm b/engine/menu/pokedex.asm index 4351ae4c..e2e53d45 100755 --- a/engine/menu/pokedex.asm +++ b/engine/menu/pokedex.asm @@ -1,7 +1,7 @@ ShowPokedexMenu: ; 40000 (10:4000) call GBPalWhiteOut call ClearScreen - call UpdateSprites ; move sprites + call UpdateSprites ld a,[wListScrollOffset] push af xor a @@ -140,7 +140,7 @@ HandlePokedexSideMenu: ; 4006d (10:406d) .choseCry ld a,[wd11e] call GetCryData ; get cry data - call PlaySound ; play sound + call PlaySound jr .handleMenuInput .choseArea predef LoadTownMap_Nest ; display pokemon areas @@ -573,8 +573,8 @@ HeightWeightText: ; 40448 (10:4448) db "HT ?",$60,"??",$61,$4E,"WT ???lb@" ; XXX does anything point to this? -Unknown_4045D: ; 4045d (10:445d) - db $54,$50 +PokeText: ; 4045d (10:445d) + db "#@" ; horizontal line that divides the pokedex text description from the rest of the data PokedexDataDividerLine: ; 4045f (10:445f) diff --git a/engine/menu/prize_menu.asm b/engine/menu/prize_menu.asm index 0e904200..d12308f8 100755 --- a/engine/menu/prize_menu.asm +++ b/engine/menu/prize_menu.asm @@ -79,7 +79,7 @@ GetPrizeMenuId: ; 5278e (14:678e) inc hl push hl ld hl,W_PRIZE1 - call CopyString ; XXX what does this do + call CopyString pop hl ld a,[hli] ld h,[hl] @@ -152,7 +152,7 @@ PrintPrizePrice: ; 5287a (14:687a) ld b,$01 ld c,$07 call TextBoxBorder - call UpdateSprites ; XXX save OAM? + call UpdateSprites hlCoord 12, 0 ld de,.CoinText call PlaceString diff --git a/engine/menu/start_menu.asm b/engine/menu/start_menu.asm index da17822b..0db0d052 100755 --- a/engine/menu/start_menu.asm +++ b/engine/menu/start_menu.asm @@ -1,7 +1,7 @@ DisplayStartMenu:: ; 2acd (0:2acd) - ld a,$04 ; hardcoded Bank, not sure what's it refers to + ld a,BANK(StartMenu_Pokedex) ld [H_LOADEDROMBANK],a - ld [$2000],a ; ROM bank 4 + ld [MBC1RomBank],a ld a,[wWalkBikeSurfState] ; walking/biking/surfing ld [wWalkBikeSurfStateCopy],a ld a, (SFX_02_3f - SFX_Headers_02) / 3 ; Start menu sound @@ -10,7 +10,7 @@ DisplayStartMenu:: ; 2acd (0:2acd) RedisplayStartMenu:: ; 2adf (0:2adf) callba DrawStartMenu callba PrintSafariZoneSteps ; print Safari Zone info, if in Safari Zone - call UpdateSprites ; move sprites + call UpdateSprites .loop call HandleMenuInput ld b,a diff --git a/engine/menu/start_sub_menus.asm b/engine/menu/start_sub_menus.asm index 589224ab..b84657d5 100755 --- a/engine/menu/start_sub_menus.asm +++ b/engine/menu/start_sub_menus.asm @@ -325,7 +325,7 @@ StartMenu_Item: ; 13302 (4:7302) .exitMenu call LoadScreenTilesFromBuffer2 ; restore saved screen call LoadTextBoxTilePatterns - call UpdateSprites ; move sprites + call UpdateSprites jp RedisplayStartMenu .choseItem ; erase menu cursor (blank each tile in front of an item name) @@ -499,7 +499,7 @@ UsableItems_CloseMenu: ; 13459 (4:7459) StartMenu_TrainerInfo: ; 13460 (4:7460) call GBPalWhiteOut call ClearScreen - call UpdateSprites ; move sprites + call UpdateSprites ld a,[hTilesetType] push af xor a @@ -535,25 +535,25 @@ DrawTrainerInfo: ; 1349a (4:749a) ld de,vChars2 ld bc,$70 * 4 call CopyData - ld hl,TrainerInfoTextBoxTileGraphics ; $7b98 ; trainer info text box tile patterns + ld hl,TrainerInfoTextBoxTileGraphics ; trainer info text box tile patterns ld de,vChars2 + $770 ld bc,$0080 push bc call TrainerInfo_FarCopyData - ld hl,BlankLeaderNames ; $7c28 + ld hl,BlankLeaderNames ld de,vChars2 + $600 ld bc,$0170 call TrainerInfo_FarCopyData pop bc - ld hl,BadgeNumbersTileGraphics ; $7d98 ; badge number tile patterns + ld hl,BadgeNumbersTileGraphics ; badge number tile patterns ld de,vChars1 + $580 call TrainerInfo_FarCopyData - ld hl,GymLeaderFaceAndBadgeTileGraphics ; $6a9e ; gym leader face and badge tile patterns + ld hl,GymLeaderFaceAndBadgeTileGraphics ; gym leader face and badge tile patterns ld de,vChars2 + $200 ld bc,$0400 ld a,$03 call FarCopyData2 - ld hl,TextBoxGraphics ; $6288 + ld hl,TextBoxGraphics ld de,$00d0 add hl,de ; hl = colon tile pattern ld de,vChars1 + $560 @@ -562,7 +562,7 @@ DrawTrainerInfo: ; 1349a (4:749a) push bc call FarCopyData2 pop bc - ld hl,TrainerInfoTextBoxTileGraphics + $80 ; $7c18 ; background tile pattern + ld hl,TrainerInfoTextBoxTileGraphics + $80 ; background tile pattern ld de,vChars1 + $570 call TrainerInfo_FarCopyData call EnableLCD @@ -705,9 +705,9 @@ StartMenu_Option: ; 135f6 (4:75f6) SwitchPartyMon: ; 13613 (4:7613) call SwitchPartyMon_Stats - ld a, [wWhichTrade] ; wWhichTrade + ld a, [wWhichTrade] call SwitchPartyMon_OAM - ld a, [wCurrentMenuItem] ; wCurrentMenuItem + ld a, [wCurrentMenuItem] call SwitchPartyMon_OAM jp RedrawPartyMenu_ @@ -741,7 +741,7 @@ SwitchPartyMon_Stats: ; 13653 (4:7653) ld a, [wMenuItemToSwap] and a jr nz, .asm_13661 - ld a, [wWhichPokemon] ; wWhichPokemon + ld a, [wWhichPokemon] inc a ld [wMenuItemToSwap], a ret @@ -751,8 +751,8 @@ SwitchPartyMon_Stats: ; 13653 (4:7653) ld a, [wMenuItemToSwap] dec a ld b, a - ld a, [wCurrentMenuItem] ; wCurrentMenuItem - ld [wWhichTrade], a ; wWhichTrade + ld a, [wCurrentMenuItem] + ld [wWhichTrade], a cp b jr nz, .asm_1367b xor a @@ -767,7 +767,7 @@ SwitchPartyMon_Stats: ; 13653 (4:7653) ld hl, wPartySpecies ld d, h ld e, l - ld a, [wCurrentMenuItem] ; wCurrentMenuItem + ld a, [wCurrentMenuItem] add l ld l, a jr nc, .asm_1368e @@ -780,14 +780,14 @@ SwitchPartyMon_Stats: ; 13653 (4:7653) inc d .asm_13696 ld a, [hl] - ld [H_DIVIDEND], a ; $ff95 (aliases: H_PRODUCT, H_PASTLEADINGZEROES, H_QUOTIENT) + ld [H_DIVIDEND], a ; (aliases: H_PRODUCT, H_PASTLEADINGZEROES, H_QUOTIENT) ld a, [de] ld [hl], a - ld a, [H_DIVIDEND] ; $ff95 (aliases: H_PRODUCT, H_PASTLEADINGZEROES, H_QUOTIENT) + ld a, [H_DIVIDEND] ; (aliases: H_PRODUCT, H_PASTLEADINGZEROES, H_QUOTIENT) ld [de], a ld hl, wPartyMons ld bc, wPartyMon2 - wPartyMon1 - ld a, [wCurrentMenuItem] ; wCurrentMenuItem + ld a, [wCurrentMenuItem] call AddNTimes push hl ld de, wSwitchPartyMonTempBuffer @@ -805,14 +805,14 @@ SwitchPartyMon_Stats: ; 13653 (4:7653) ld hl, wSwitchPartyMonTempBuffer ld bc, $2c call CopyData - ld hl, wPartyMonOT ; wd273 - ld a, [wCurrentMenuItem] ; wCurrentMenuItem + ld hl, wPartyMonOT + ld a, [wCurrentMenuItem] call SkipFixedLengthTextEntries push hl ld de, wSwitchPartyMonTempBuffer ld bc, $b call CopyData - ld hl, wPartyMonOT ; wd273 + ld hl, wPartyMonOT ld a, [wMenuItemToSwap] call SkipFixedLengthTextEntries pop de @@ -823,14 +823,14 @@ SwitchPartyMon_Stats: ; 13653 (4:7653) ld hl, wSwitchPartyMonTempBuffer ld bc, $b call CopyData - ld hl, wPartyMonNicks ; wPartyMonNicks - ld a, [wCurrentMenuItem] ; wCurrentMenuItem + ld hl, wPartyMonNicks + ld a, [wCurrentMenuItem] call SkipFixedLengthTextEntries push hl ld de, wSwitchPartyMonTempBuffer ld bc, $b call CopyData - ld hl, wPartyMonNicks ; wPartyMonNicks + ld hl, wPartyMonNicks ld a, [wMenuItemToSwap] call SkipFixedLengthTextEntries pop de @@ -842,7 +842,7 @@ SwitchPartyMon_Stats: ; 13653 (4:7653) ld bc, $b call CopyData ld a, [wMenuItemToSwap] - ld [wWhichTrade], a ; wWhichTrade + ld [wWhichTrade], a xor a ld [wMenuItemToSwap], a ld [wd07d], a diff --git a/engine/menu/status_screen.asm b/engine/menu/status_screen.asm index b5254694..c9261804 100755 --- a/engine/menu/status_screen.asm +++ b/engine/menu/status_screen.asm @@ -67,7 +67,7 @@ StatusScreen: ; 12953 (4:6953) call LoadMonData ld a, [wcc49] cp $2 ; 2 means we're in a PC box - jr c, .DontRecalculate ; 0x1295b $14 + jr c, .DontRecalculate ld a, [wLoadedMonBoxLevel] ld [wLoadedMonLevel], a ld [W_CURENEMYLVL], a @@ -82,17 +82,17 @@ StatusScreen: ; 12953 (4:6953) ld [$ff24], a ; Reduce the volume call GBPalWhiteOutWithDelay3 call ClearScreen - call UpdateSprites ; move sprites (?) + call UpdateSprites call LoadHpBarAndStatusTilePatterns - ld de, BattleHudTiles1 ; $6080 ; source + ld de, BattleHudTiles1 ; source ld hl, vChars2 + $6d0 ; dest ld bc, (BANK(BattleHudTiles1) << 8) + $03 ; bank bytes/8 call CopyVideoDataDouble ; ·│ :L and halfarrow line end - ld de, BattleHudTiles2 ; $6098 + ld de, BattleHudTiles2 ld hl, vChars2 + $780 ld bc, (BANK(BattleHudTiles2) << 8) + $01 call CopyVideoDataDouble ; │ - ld de, BattleHudTiles3 ; $60b0 + ld de, BattleHudTiles3 ld hl, vChars2 + $760 ld bc, (BANK(BattleHudTiles3) << 8) + $02 call CopyVideoDataDouble ; ─┘ @@ -127,7 +127,7 @@ StatusScreen: ; 12953 (4:6953) hlCoord 16, 6 ld de, wLoadedMonStatus call PrintStatusCondition - jr nz, .StatusWritten ; 0x129fc $9 + jr nz, .StatusWritten hlCoord 16, 6 ld de, OKText call PlaceString ; "OK" @@ -147,14 +147,14 @@ StatusScreen: ; 12953 (4:6953) call PrintNumber ; Pokémon no. hlCoord 11, 10 predef PrintMonType - ld hl, NamePointers2 ; $6a9d - call .unk_12a7e + ld hl, NamePointers2 + call .asm_12a7e ld d, h ld e, l hlCoord 9, 1 call PlaceString ; Pokémon name - ld hl, OTPointers ; $6a95 - call .unk_12a7e + ld hl, OTPointers + call .asm_12a7e ld d, h ld e, l hlCoord 12, 16 @@ -175,7 +175,7 @@ StatusScreen: ; 12953 (4:6953) pop af ld [hTilesetType], a ret -.unk_12a7e ; 0x12a7e ; I don't know what this does, iterates over pointers? +.asm_12a7e ; I don't know what this does, iterates over pointers? ld a, [wcc49] add a ld c, a @@ -221,20 +221,20 @@ OKText: ; 12ac4 (4:6ac4) db "OK@" ; Draws a line starting from hl high b and wide c -DrawLineBox ; 0x12ac7 +DrawLineBox: ; 0x12ac7 ld de, $0014 ; New line .PrintVerticalLine ld [hl], $78 ; │ add hl, de dec b - jr nz, .PrintVerticalLine ; 0x12ace $fa + jr nz, .PrintVerticalLine ld [hl], $77 ; ┘ dec hl .PrintHorizLine ld [hl], $76 ; ─ dec hl dec c - jr nz, .PrintHorizLine ; 0x12ad7 $fa + jr nz, .PrintHorizLine ld [hl], $6f ; ← (halfarrow ending) ret @@ -244,14 +244,14 @@ PTile: ; 12adc (4:6adc) ; This is a single 1bpp "P" tile PrintStatsBox: ; 12ae4 (4:6ae4) ld a, d and a ; a is 0 from the status screen - jr nz, .DifferentBox ; 0x12ae6 $12 + jr nz, .DifferentBox hlCoord 0, 8 ld b, $8 ld c, $8 call TextBoxBorder ; Draws the box hlCoord 1, 9 ; Start printing stats from here ld bc, $0019 ; Number offset - jr .PrintStats ; 0x12af8 $10 + jr .PrintStats .DifferentBox hlCoord 9, 2 ld b, $8 @@ -328,7 +328,7 @@ StatusScreen2: ; 12b57 (4:6b57) call Func_12ccb ; Print "PP" ld a, b and a - jr z, .InitPP ; 0x12bb3 $6 + jr z, .InitPP ld c, a ld a, "-" call Func_12ccb ; Fill the rest with -- @@ -339,7 +339,7 @@ StatusScreen2: ; 12b57 (4:6b57) .PrintPP ; 12bc3 ld a, [hli] and a - jr z, .PPDone ; 0x12bc5 $4a + jr z, .PPDone push bc push hl push de @@ -382,7 +382,7 @@ StatusScreen2: ; 12b57 (4:6b57) inc b ld a, b cp $4 - jr nz, .PrintPP ; 0x12c0f $b2 + jr nz, .PrintPP .PPDone hlCoord 9, 3 ld de, EXPPointsText @@ -390,7 +390,7 @@ StatusScreen2: ; 12b57 (4:6b57) ld a, [wLoadedMonLevel] ; level push af cp MAX_LEVEL - jr z, .Level100 ; 0x12c20 $4 + jr z, .Level100 inc a ld [wLoadedMonLevel], a ; Increase temporarily if not 100 .Level100 @@ -434,7 +434,7 @@ StatusScreen2: ; 12b57 (4:6b57) .asm_12c86 ; This does some magic with lvl/exp? ld a, [wLoadedMonLevel] ; Load level cp MAX_LEVEL - jr z, .asm_12ca7 ; 0x12c8b $1a ; If 100 + jr z, .asm_12ca7 ; If 100 inc a ld d, a callab CalcExperience diff --git a/engine/menu/vending_machine.asm b/engine/menu/vending_machine.asm index 88cfcf65..d5209440 100755 --- a/engine/menu/vending_machine.asm +++ b/engine/menu/vending_machine.asm @@ -52,9 +52,9 @@ VendingMachineMenu: ; 74ee0 (1d:4ee0) ld c, 1 call GiveItem jr nc, .BagFull - ld b, $3c ; number of times to play the "brrrrr" sound -.playDeliverySound ; 0x74f63 - ld c, $2 + ld b, 60 ; number of times to play the "brrrrr" sound +.playDeliverySound + ld c, 2 call DelayFrames push bc ld a, (SFX_02_53 - SFX_Headers_02) / 3 diff --git a/engine/multiply_divide.asm b/engine/multiply_divide.asm index 4aa5fa26..e55ab430 100755 --- a/engine/multiply_divide.asm +++ b/engine/multiply_divide.asm @@ -2,15 +2,15 @@ _Multiply: ; 37d41 (d:7d41) ld a, $8 ld b, a xor a - ld [H_DIVIDEND], a ; $ff95 (aliases: H_PRODUCT, H_PASTLEADINGZEROES, H_QUOTIENT) + ld [H_DIVIDEND], a ; (aliases: H_PRODUCT, H_PASTLEADINGZEROES, H_QUOTIENT) ld [$ff9b], a - ld [H_SAVEDNUMTOPRINT], a ; $ff9c + ld [H_SAVEDNUMTOPRINT], a ld [$ff9d], a ld [$ff9e], a .asm_37d4f - ld a, [H_REMAINDER] ; $ff99 (aliases: H_DIVISOR, H_MULTIPLIER, H_POWEROFTEN) + ld a, [H_REMAINDER] ; (aliases: H_DIVISOR, H_MULTIPLIER, H_POWEROFTEN) srl a - ld [H_REMAINDER], a ; $ff99 (aliases: H_DIVISOR, H_MULTIPLIER, H_POWEROFTEN) + ld [H_REMAINDER], a ; (aliases: H_DIVISOR, H_MULTIPLIER, H_POWEROFTEN) jr nc, .asm_37d77 ld a, [$ff9e] ld c, a @@ -22,14 +22,14 @@ _Multiply: ; 37d41 (d:7d41) ld a, [$ff97] adc c ld [$ff9d], a - ld a, [H_SAVEDNUMTOPRINT] ; $ff9c + ld a, [H_SAVEDNUMTOPRINT] ld c, a - ld a, [H_NUMTOPRINT] ; $ff96 (aliases: H_MULTIPLICAND) + ld a, [H_NUMTOPRINT] ; (aliases: H_MULTIPLICAND) adc c - ld [H_SAVEDNUMTOPRINT], a ; $ff9c + ld [H_SAVEDNUMTOPRINT], a ld a, [$ff9b] ld c, a - ld a, [H_DIVIDEND] ; $ff95 (aliases: H_PRODUCT, H_PASTLEADINGZEROES, H_QUOTIENT) + ld a, [H_DIVIDEND] ; (aliases: H_PRODUCT, H_PASTLEADINGZEROES, H_QUOTIENT) adc c ld [$ff9b], a .asm_37d77 @@ -41,29 +41,29 @@ _Multiply: ; 37d41 (d:7d41) ld a, [$ff97] rl a ld [$ff97], a - ld a, [H_NUMTOPRINT] ; $ff96 (aliases: H_MULTIPLICAND) + ld a, [H_NUMTOPRINT] ; (aliases: H_MULTIPLICAND) rl a - ld [H_NUMTOPRINT], a ; $ff96 (aliases: H_MULTIPLICAND) - ld a, [H_DIVIDEND] ; $ff95 (aliases: H_PRODUCT, H_PASTLEADINGZEROES, H_QUOTIENT) + ld [H_NUMTOPRINT], a ; (aliases: H_MULTIPLICAND) + ld a, [H_DIVIDEND] ; (aliases: H_PRODUCT, H_PASTLEADINGZEROES, H_QUOTIENT) rl a - ld [H_DIVIDEND], a ; $ff95 (aliases: H_PRODUCT, H_PASTLEADINGZEROES, H_QUOTIENT) + ld [H_DIVIDEND], a ; (aliases: H_PRODUCT, H_PASTLEADINGZEROES, H_QUOTIENT) jr .asm_37d4f .asm_37d94 ld a, [$ff9e] ld [$ff98], a ld a, [$ff9d] ld [$ff97], a - ld a, [H_SAVEDNUMTOPRINT] ; $ff9c - ld [H_NUMTOPRINT], a ; $ff96 (aliases: H_MULTIPLICAND) + ld a, [H_SAVEDNUMTOPRINT] + ld [H_NUMTOPRINT], a ; (aliases: H_MULTIPLICAND) ld a, [$ff9b] - ld [H_DIVIDEND], a ; $ff95 (aliases: H_PRODUCT, H_PASTLEADINGZEROES, H_QUOTIENT) + ld [H_DIVIDEND], a ; (aliases: H_PRODUCT, H_PASTLEADINGZEROES, H_QUOTIENT) ret _Divide: ; 37da5 (d:7da5) xor a ld [$ff9a], a ld [$ff9b], a - ld [H_SAVEDNUMTOPRINT], a ; $ff9c + ld [H_SAVEDNUMTOPRINT], a ld [$ff9d], a ld [$ff9e], a ld a, $9 @@ -71,17 +71,17 @@ _Divide: ; 37da5 (d:7da5) .asm_37db3 ld a, [$ff9a] ld c, a - ld a, [H_NUMTOPRINT] ; $ff96 (aliases: H_MULTIPLICAND) + ld a, [H_NUMTOPRINT] ; (aliases: H_MULTIPLICAND) sub c ld d, a - ld a, [H_REMAINDER] ; $ff99 (aliases: H_DIVISOR, H_MULTIPLIER, H_POWEROFTEN) + ld a, [H_REMAINDER] ; (aliases: H_DIVISOR, H_MULTIPLIER, H_POWEROFTEN) ld c, a - ld a, [H_DIVIDEND] ; $ff95 (aliases: H_PRODUCT, H_PASTLEADINGZEROES, H_QUOTIENT) + ld a, [H_DIVIDEND] ; (aliases: H_PRODUCT, H_PASTLEADINGZEROES, H_QUOTIENT) sbc c jr c, .asm_37dce - ld [H_DIVIDEND], a ; $ff95 (aliases: H_PRODUCT, H_PASTLEADINGZEROES, H_QUOTIENT) + ld [H_DIVIDEND], a ; (aliases: H_PRODUCT, H_PASTLEADINGZEROES, H_QUOTIENT) ld a, d - ld [H_NUMTOPRINT], a ; $ff96 (aliases: H_MULTIPLICAND) + ld [H_NUMTOPRINT], a ; (aliases: H_MULTIPLICAND) ld a, [$ff9e] inc a ld [$ff9e], a @@ -96,9 +96,9 @@ _Divide: ; 37da5 (d:7da5) ld a, [$ff9d] rl a ld [$ff9d], a - ld a, [H_SAVEDNUMTOPRINT] ; $ff9c + ld a, [H_SAVEDNUMTOPRINT] rl a - ld [H_SAVEDNUMTOPRINT], a ; $ff9c + ld [H_SAVEDNUMTOPRINT], a ld a, [$ff9b] rl a ld [$ff9b], a @@ -107,13 +107,13 @@ _Divide: ; 37da5 (d:7da5) ld a, $8 ld e, a ld a, [$ff9a] - ld [H_REMAINDER], a ; $ff99 (aliases: H_DIVISOR, H_MULTIPLIER, H_POWEROFTEN) + ld [H_REMAINDER], a ; (aliases: H_DIVISOR, H_MULTIPLIER, H_POWEROFTEN) xor a ld [$ff9a], a - ld a, [H_NUMTOPRINT] ; $ff96 (aliases: H_MULTIPLICAND) - ld [H_DIVIDEND], a ; $ff95 (aliases: H_PRODUCT, H_PASTLEADINGZEROES, H_QUOTIENT) + ld a, [H_NUMTOPRINT] ; (aliases: H_MULTIPLICAND) + ld [H_DIVIDEND], a ; (aliases: H_PRODUCT, H_PASTLEADINGZEROES, H_QUOTIENT) ld a, [$ff97] - ld [H_NUMTOPRINT], a ; $ff96 (aliases: H_MULTIPLICAND) + ld [H_NUMTOPRINT], a ; (aliases: H_MULTIPLICAND) ld a, [$ff98] ld [$ff97], a .asm_37e04 @@ -122,22 +122,22 @@ _Divide: ; 37da5 (d:7da5) jr nz, .asm_37e0a dec b .asm_37e0a - ld a, [H_REMAINDER] ; $ff99 (aliases: H_DIVISOR, H_MULTIPLIER, H_POWEROFTEN) + ld a, [H_REMAINDER] ; (aliases: H_DIVISOR, H_MULTIPLIER, H_POWEROFTEN) srl a - ld [H_REMAINDER], a ; $ff99 (aliases: H_DIVISOR, H_MULTIPLIER, H_POWEROFTEN) + ld [H_REMAINDER], a ; (aliases: H_DIVISOR, H_MULTIPLIER, H_POWEROFTEN) ld a, [$ff9a] rr a ld [$ff9a], a jr .asm_37db3 .asm_37e18 - ld a, [H_NUMTOPRINT] ; $ff96 (aliases: H_MULTIPLICAND) - ld [H_REMAINDER], a ; $ff99 (aliases: H_DIVISOR, H_MULTIPLIER, H_POWEROFTEN) + ld a, [H_NUMTOPRINT] ; (aliases: H_MULTIPLICAND) + ld [H_REMAINDER], a ; (aliases: H_DIVISOR, H_MULTIPLIER, H_POWEROFTEN) ld a, [$ff9e] ld [$ff98], a ld a, [$ff9d] ld [$ff97], a - ld a, [H_SAVEDNUMTOPRINT] ; $ff9c - ld [H_NUMTOPRINT], a ; $ff96 (aliases: H_MULTIPLICAND) + ld a, [H_SAVEDNUMTOPRINT] + ld [H_NUMTOPRINT], a ; (aliases: H_MULTIPLICAND) ld a, [$ff9b] - ld [H_DIVIDEND], a ; $ff95 (aliases: H_PRODUCT, H_PASTLEADINGZEROES, H_QUOTIENT) + ld [H_DIVIDEND], a ; (aliases: H_PRODUCT, H_PASTLEADINGZEROES, H_QUOTIENT) ret diff --git a/engine/oak_speech.asm b/engine/oak_speech.asm index 0cbdaa3d..72ccc389 100755 --- a/engine/oak_speech.asm +++ b/engine/oak_speech.asm @@ -1,11 +1,11 @@ SetDefaultNames: ; 60ca (1:60ca) ld a, [wd358] push af - ld a, [W_OPTIONS] ; W_OPTIONS + ld a, [W_OPTIONS] push af ld a, [wd732] push af - ld hl, wPlayerName ; wd158 + ld hl, wPlayerName ld bc, $d8a xor a call FillMemory @@ -16,18 +16,18 @@ SetDefaultNames: ; 60ca (1:60ca) pop af ld [wd732], a pop af - ld [W_OPTIONS], a ; W_OPTIONS + ld [W_OPTIONS], a pop af ld [wd358], a ld a, [wd08a] and a call z, Func_5bff ld hl, NintenText - ld de, wPlayerName ; wd158 + ld de, wPlayerName ld bc, $b call CopyData ld hl, SonyText - ld de, W_RIVALNAME ; wd34a + ld de, W_RIVALNAME ld bc, $b jp CopyData @@ -37,7 +37,7 @@ OakSpeech: ; 6115 (1:6115) ld a, BANK(Music_Routes2) ; bank of song ld c,a ld a, MUSIC_ROUTES2 ; song # - call PlayMusic ; plays music + call PlayMusic call ClearScreen call LoadTextBoxTilePatterns call SetDefaultNames @@ -111,10 +111,10 @@ Func_61bc: ; 61bc (1:61bc) call PlaySound pop af ld [H_LOADEDROMBANK],a - ld [$2000],a + ld [MBC1RomBank],a ld c,4 call DelayFrames - ld de,RedSprite ; $4180 + ld de,RedSprite ld hl,vSprites ld bc,(BANK(RedSprite) << 8) | $0C call CopyVideoData @@ -139,8 +139,8 @@ Func_61bc: ; 61bc (1:61bc) call PlaySound ; stop music pop af ld [H_LOADEDROMBANK],a - ld [$2000],a - ld c,$14 + ld [MBC1RomBank],a + ld c,20 call DelayFrames hlCoord 6, 5 ld b,7 @@ -149,7 +149,7 @@ Func_61bc: ; 61bc (1:61bc) call LoadTextBoxTilePatterns ld a,1 ld [wUpdateSpritesEnabled],a - ld c,$32 + ld c,50 call DelayFrames call GBFadeOutToWhite jp ClearScreen @@ -229,4 +229,4 @@ IntroPredef3B: ; 62a4 (1:62a4) .next xor a ld [$FFE1],a - predef_jump Func_3f0c6 + predef_jump CopyUncompressedPicToTilemap diff --git a/engine/oak_speech2.asm b/engine/oak_speech2.asm index 34d98fd7..d8043484 100755 --- a/engine/oak_speech2.asm +++ b/engine/oak_speech2.asm @@ -1,17 +1,17 @@ LoadDefaultNamesPlayer: ; 695d (1:695d) call Func_6a12 - ld de, DefaultNamesPlayer ; $6aa8 + ld de, DefaultNamesPlayer call DisplayIntroNameTextBox - ld a, [wCurrentMenuItem] ; wCurrentMenuItem + ld a, [wCurrentMenuItem] and a jr z, .asm_697a - ld hl, DefaultNamesPlayerList ; $6af2 + ld hl, DefaultNamesPlayerList call Func_6ad6 - ld de, wPlayerName ; wd158 + ld de, wPlayerName call Func_69ec jr .asm_6999 .asm_697a - ld hl, wPlayerName ; wd158 + ld hl, wPlayerName xor a ld [wd07d], a call DisplayNamingScreen @@ -20,7 +20,7 @@ LoadDefaultNamesPlayer: ; 695d (1:695d) jr z, .asm_697a call ClearScreen call Delay3 - ld de, RedPicFront ; $6ede + ld de, RedPicFront ld b, BANK(RedPicFront) call IntroPredef3B .asm_6999 @@ -32,19 +32,19 @@ YourNameIsText: ; 699f (1:699f) db "@" LoadDefaultNamesRival: ; 69a4 (1:69a4) - call Func_6a12 ; 0x69a4 call 0x6a12 + call Func_6a12 ld de, DefaultNamesRival call DisplayIntroNameTextBox - ld a, [wCurrentMenuItem] ; wCurrentMenuItem + ld a, [wCurrentMenuItem] and a jr z, .asm_69c1 ld hl, DefaultNamesRivalList call Func_6ad6 - ld de, W_RIVALNAME ; wd34a + ld de, W_RIVALNAME call Func_69ec jr .asm_69e1 .asm_69c1 - ld hl, W_RIVALNAME ; wd34a + ld hl, W_RIVALNAME ld a, $1 ld [wd07d], a call DisplayNamingScreen @@ -53,7 +53,7 @@ LoadDefaultNamesRival: ; 69a4 (1:69a4) jr z, .asm_69c1 call ClearScreen call Delay3 - ld de, Rival1Pic ; $6049 + ld de, Rival1Pic ld b, $13 call IntroPredef3B .asm_69e1 @@ -69,7 +69,7 @@ Func_69ec: ; 69ec (1:69ec) ld hl, wTileMap ld bc, $c0b call ClearScreenArea - ld c, $a + ld c, 10 call DelayFrames pop de ld hl, wcd6d @@ -91,9 +91,9 @@ asm_6a19: ; 6a19 (1:6a19) push bc ld [$ff8d], a ld a, d - ld [H_DOWNARROWBLINKCNT1], a ; $ff8b + ld [H_DOWNARROWBLINKCNT1], a ld a, e - ld [H_DOWNARROWBLINKCNT2], a ; $ff8c + ld [H_DOWNARROWBLINKCNT2], a ld c, a ld a, [$ff8d] and a @@ -105,7 +105,7 @@ asm_6a19: ; 6a19 (1:6a19) ld e, l .asm_6a2f xor a - ld [H_AUTOBGTRANSFERENABLED], a ; $ffba + ld [H_AUTOBGTRANSFERENABLED], a ld a, [$ff8d] and a jr nz, .asm_6a3c @@ -128,9 +128,9 @@ asm_6a19: ; 6a19 (1:6a19) ld [hl], a .asm_6a4a ld a, $1 - ld [H_AUTOBGTRANSFERENABLED], a ; $ffba + ld [H_AUTOBGTRANSFERENABLED], a call Delay3 - ld a, [H_DOWNARROWBLINKCNT2] ; $ff8c + ld a, [H_DOWNARROWBLINKCNT2] ld c, a ld h, d ld l, e @@ -144,9 +144,9 @@ asm_6a19: ; 6a19 (1:6a19) .asm_6a5f ld d, h ld e, l - ld a, [H_DOWNARROWBLINKCNT1] ; $ff8b + ld a, [H_DOWNARROWBLINKCNT1] dec a - ld [H_DOWNARROWBLINKCNT1], a ; $ff8b + ld [H_DOWNARROWBLINKCNT1], a jr nz, .asm_6a2f pop bc pop de @@ -160,22 +160,22 @@ DisplayIntroNameTextBox: ; 6a6c (1:6a6c) ld c, $9 call TextBoxBorder hlCoord 3, 0 - ld de, .namestring ; $6aa3 + ld de, .namestring call PlaceString pop de hlCoord 2, 2 call PlaceString call UpdateSprites xor a - ld [wCurrentMenuItem], a ; wCurrentMenuItem - ld [wLastMenuItem], a ; wLastMenuItem + ld [wCurrentMenuItem], a + ld [wLastMenuItem], a inc a - ld [wTopMenuItemX], a ; wTopMenuItemX - ld [wMenuWatchedKeys], a ; wMenuWatchedKeys + ld [wTopMenuItemX], a + ld [wMenuWatchedKeys], a inc a - ld [wTopMenuItemY], a ; wTopMenuItemY + ld [wTopMenuItemY], a inc a - ld [wMaxMenuItem], a ; wMaxMenuItem + ld [wMaxMenuItem], a jp HandleMenuInput .namestring ; 6aa3 (1:6aa3) diff --git a/engine/overworld/cable_club_npc.asm b/engine/overworld/cable_club_npc.asm index bdab41a6..86a7ab7d 100755 --- a/engine/overworld/cable_club_npc.asm +++ b/engine/overworld/cable_club_npc.asm @@ -5,7 +5,7 @@ CableClubNPC: ; 71c5 (1:71c5) bit 5, a ; received pokedex? jp nz, .receivedPokedex ; if the player hasn't received the pokedex - ld c, $3c + ld c, 60 call DelayFrames ld hl, CableClubNPCMakingPreparationsText call PrintText @@ -72,24 +72,24 @@ CableClubNPC: ; 71c5 (1:71c5) ld hl, wUnknownSerialCounter ld a, [hli] inc a - jr nz, Func_72a8 ; 0x726b $3b + jr nz, Func_72a8 ld a, [hl] inc a - jr nz, Func_72a8 ; 0x726f $37 + jr nz, Func_72a8 ld b, $a .asm_7273 call DelayFrame call Serial_SendZeroByte dec b - jr nz, .asm_7273 ; 0x727a $f7 + jr nz, .asm_7273 call CloseLinkConnection ld hl, CableClubNPCLinkClosedBecauseOfInactivityText call PrintText - jr Func_7298 ; 0x7285 $11 + jr Func_7298 .failedToEstablishConnection ld hl, CableClubNPCAreaReservedFor2FriendsLinkedByCableText call PrintText - jr Func_7298 ; 0x728d $9 + jr Func_7298 .choseNo call CloseLinkConnection ld hl, CableClubNPCPleaseComeAgainText diff --git a/engine/overworld/card_key.asm b/engine/overworld/card_key.asm index c4df0d51..94c1868c 100755 --- a/engine/overworld/card_key.asm +++ b/engine/overworld/card_key.asm @@ -27,7 +27,7 @@ PrintCardKeyText: ; 52673 (14:6673) jr z, .noCardKey call GetCoordsInFrontOfPlayer push de - ld a, $1 + tx_pre_id CardKeySuccessText ld [H_DOWNARROWBLINKCNT2], a call PrintPredefTextID pop de @@ -54,7 +54,7 @@ PrintCardKeyText: ; 52673 (14:6673) ld a, (SFX_1f_57 - SFX_Headers_1f) / 3 jp PlaySound .noCardKey - ld a, $2 + tx_pre_id CardKeyFailText ld [H_DOWNARROWBLINKCNT2], a jp PrintPredefTextID diff --git a/engine/overworld/cinnabar_lab.asm b/engine/overworld/cinnabar_lab.asm index eefa2176..a23348db 100755 --- a/engine/overworld/cinnabar_lab.asm +++ b/engine/overworld/cinnabar_lab.asm @@ -2,16 +2,16 @@ GiveFossilToCinnabarLab: ; 61006 (18:5006) ld hl, wd730 set 6, [hl] xor a - ld [wCurrentMenuItem], a ; wCurrentMenuItem + ld [wCurrentMenuItem], a ld a, $3 - ld [wMenuWatchedKeys], a ; wMenuWatchedKeys + ld [wMenuWatchedKeys], a ld a, [wcd37] dec a - ld [wMaxMenuItem], a ; wMaxMenuItem + ld [wMaxMenuItem], a ld a, $2 - ld [wTopMenuItemY], a ; wTopMenuItemY + ld [wTopMenuItemY], a ld a, $1 - ld [wTopMenuItemX], a ; wTopMenuItemX + ld [wTopMenuItemX], a ld a, [wcd37] dec a ld bc, $2 @@ -30,7 +30,7 @@ GiveFossilToCinnabarLab: ; 61006 (18:5006) bit 1, a jr nz, .asm_610a7 ld hl, wcc5b - ld a, [wCurrentMenuItem] ; wCurrentMenuItem + ld a, [wCurrentMenuItem] ld d, $0 ld e, a add hl, de @@ -55,7 +55,7 @@ GiveFossilToCinnabarLab: ; 61006 (18:5006) ld hl, LabFossil_610ae call PrintText call YesNoChoice - ld a, [wCurrentMenuItem] ; wCurrentMenuItem + ld a, [wCurrentMenuItem] and a jr nz, .asm_610a7 ld hl, LabFossil_610b3 diff --git a/engine/overworld/cut.asm b/engine/overworld/cut.asm index 7b92bca3..26a65b5b 100755 --- a/engine/overworld/cut.asm +++ b/engine/overworld/cut.asm @@ -1,7 +1,7 @@ UsedCut: ; ef54 (3:6f54) xor a ld [wcd6a], a - ld a, [W_CURMAPTILESET] ; W_CURMAPTILESET + ld a, [W_CURMAPTILESET] and a ; OVERWORLD jr z, .asm_ef6b cp GYM @@ -9,28 +9,28 @@ UsedCut: ; ef54 (3:6f54) ld a, [wTileInFrontOfPlayer] cp $50 ; gym cut tree jr nz, .asm_ef77 - jr asm_ef82 + jr .asm_ef82 .asm_ef6b dec a ld a, [wTileInFrontOfPlayer] cp $3d ; cut tree - jr z, asm_ef82 + jr z, .asm_ef82 cp $52 ; grass - jr z, asm_ef82 + jr z, .asm_ef82 .asm_ef77 - ld hl, NothingToCutText + ld hl, .NothingToCutText jp PrintText -NothingToCutText: ; ef7d (3:6f7d) +.NothingToCutText TX_FAR _NothingToCutText db "@" -asm_ef82: ; ef82 (3:6f82) +.asm_ef82 ld [wcd4d], a ld a, $1 ld [wcd6a], a - ld a, [wWhichPokemon] ; wWhichPokemon - ld hl, wPartyMonNicks ; wPartyMonNicks + ld a, [wWhichPokemon] + ld hl, wPartyMonNicks call GetPartyMonName ld hl, wd730 set 6, [hl] @@ -54,7 +54,7 @@ asm_ef82: ; ef82 (3:6f82) ld a, $ff ld [wUpdateSpritesEnabled], a call AnimateCutTree - ld de, CutTreeBlockSwaps ; $7100 + ld de, CutTreeBlockSwaps call Func_f09f call RedrawMapView callba Func_79e96 @@ -75,15 +75,15 @@ AnimateCutTree: ; eff7 (3:6ff7) xor a ld [wcd50], a ld a, $e4 - ld [rOBP1], a ; $ff49 + ld [rOBP1], a ld a, [wcd4d] cp $52 jr z, .asm_f020 - ld de, Overworld_GFX + $2d0 ; $42d0 ; cuttable tree sprite top row + ld de, Overworld_GFX + $2d0 ; cuttable tree sprite top row ld hl, vChars1 + $7c0 ld bc, (BANK(Overworld_GFX) << 8) + $02 call CopyVideoData - ld de, Overworld_GFX + $3d0 ; $43d0 ; cuttable tree sprite bottom row + ld de, Overworld_GFX + $3d0 ; cuttable tree sprite bottom row ld hl, vChars1 + $7e0 ld bc, (BANK(Overworld_GFX) << 8) + $02 call CopyVideoData @@ -111,7 +111,7 @@ AnimateCutTree: ; eff7 (3:6ff7) ret LoadCutTreeAnimationTilePattern: ; f04c (3:704c) - ld de, AnimationTileset2 + $60 ; $474e ; tile depicting a leaf + ld de, AnimationTileset2 + $60 ; tile depicting a leaf ld bc, (BANK(AnimationTileset2) << 8) + $01 jp CopyVideoData @@ -173,7 +173,7 @@ BoulderDustAnimationOffsets: ; f097 (3:7097) Func_f09f: ; f09f (3:709f) push de - ld a, [W_CURMAPWIDTH] ; wd369 + ld a, [W_CURMAPWIDTH] add $6 ld c, a ld b, $0 @@ -185,27 +185,27 @@ Func_f09f: ; f09f (3:709f) add hl, bc ld a, [wSpriteStateData1 + 9] and a - jr z, .asm_f0c7 - cp $4 - jr z, .asm_f0cf - cp $8 - jr z, .asm_f0d7 - ld a, [W_XBLOCKCOORD] ; wd364 + jr z, .down + cp SPRITE_FACING_UP + jr z, .up + cp SPRITE_FACING_LEFT + jr z, .left + ld a, [W_XBLOCKCOORD] and a jr z, .asm_f0e0 jr .asm_f0ec -.asm_f0c7 - ld a, [W_YBLOCKCOORD] ; wd363 +.down + ld a, [W_YBLOCKCOORD] and a jr z, .asm_f0e0 jr .asm_f0df -.asm_f0cf - ld a, [W_YBLOCKCOORD] ; wd363 +.up + ld a, [W_YBLOCKCOORD] and a jr z, .asm_f0e1 jr .asm_f0e0 -.asm_f0d7 - ld a, [W_XBLOCKCOORD] ; wd364 +.left + ld a, [W_XBLOCKCOORD] and a jr z, .asm_f0e6 jr .asm_f0e0 diff --git a/engine/overworld/cut2.asm b/engine/overworld/cut2.asm index de2b9d55..9cb011b4 100755 --- a/engine/overworld/cut2.asm +++ b/engine/overworld/cut2.asm @@ -15,9 +15,9 @@ Func_79e96: ; 79e96 (1e:5e96) ld [wd08a], a ld c, $2 call AdjustOAMBlockXPos2 - ld a, [rOBP1] ; $ff49 + ld a, [rOBP1] xor $64 - ld [rOBP1], a ; $ff49 + ld [rOBP1], a call DelayFrame pop bc dec c @@ -65,9 +65,9 @@ Func_79eed: ; 79eed (1e:5eed) ld [wd08a], a ld c, $1 call AdjustOAMBlockXPos2 - ld a, [rOBP1] ; $ff49 + ld a, [rOBP1] xor $64 - ld [rOBP1], a ; $ff49 + ld [rOBP1], a call DelayFrame pop bc dec c diff --git a/engine/overworld/doors.asm b/engine/overworld/doors.asm index ac345af9..641c021f 100755 --- a/engine/overworld/doors.asm +++ b/engine/overworld/doors.asm @@ -1,8 +1,8 @@ ; returns whether the player is standing on a door tile in carry IsPlayerStandingOnDoorTile: ; 1a609 (6:6609) push de - ld hl, DoorTileIDPointers ; $662c - ld a, [W_CURMAPTILESET] ; W_CURMAPTILESET + ld hl, DoorTileIDPointers + ld a, [W_CURMAPTILESET] ld de, $3 call IsInArray pop de diff --git a/engine/overworld/elevator.asm b/engine/overworld/elevator.asm index 3a23d410..f5b1d14c 100755 --- a/engine/overworld/elevator.asm +++ b/engine/overworld/elevator.asm @@ -10,7 +10,7 @@ ShakeElevator: ; 7bf15 (1e:7f15) ld d, a ld e, $1 ; number of times to play collision sfx - ld b, $64 + ld b, 100 .asm_7bf30 ld a, e xor $fe @@ -22,7 +22,7 @@ ShakeElevator: ; 7bf15 (1e:7f15) ld a, (SFX_02_5b - SFX_Headers_02) / 3 call PlayMusic pop bc - ld c, $2 + ld c, 2 call DelayFrames dec b jr nz, .asm_7bf30 diff --git a/engine/overworld/emotion_bubbles.asm b/engine/overworld/emotion_bubbles.asm index 7106063b..01b3ae85 100755 --- a/engine/overworld/emotion_bubbles.asm +++ b/engine/overworld/emotion_bubbles.asm @@ -2,7 +2,7 @@ EmotionBubble: ; 17c47 (5:7c47) ld a, [wcd50] ld c, a ld b, $0 - ld hl, EmotionBubblesPointerTable ; $7caf + ld hl, EmotionBubblesPointerTable add hl, bc add hl, bc ld e, [hl] @@ -45,10 +45,10 @@ EmotionBubble: ; 17c47 (5:7c47) ld a, [hl] add $8 ld c, a - ld de, EmotionBubblesOAM ; $7cb5 + ld de, EmotionBubblesOAM xor a call WriteOAMBlock - ld c, $3c + ld c, 60 call DelayFrames pop af ld [wUpdateSpritesEnabled], a diff --git a/engine/overworld/healing_machine.asm b/engine/overworld/healing_machine.asm index 90d306c3..d00bbc05 100755 --- a/engine/overworld/healing_machine.asm +++ b/engine/overworld/healing_machine.asm @@ -1,5 +1,5 @@ AnimateHealingMachine: ; 70433 (1c:4433) - ld de, PokeCenterFlashingMonitorAndHealBall ; $44b7 + ld de, PokeCenterFlashingMonitorAndHealBall ld hl, vChars0 + $7c0 ld bc, (BANK(PokeCenterFlashingMonitorAndHealBall) << 8) + $03 call CopyVideoData @@ -8,12 +8,12 @@ AnimateHealingMachine: ; 70433 (1c:4433) push af ld [hl], $ff push hl - ld a, [rOBP1] ; $ff49 + ld a, [rOBP1] push af ld a, $e0 - ld [rOBP1], a ; $ff49 + ld [rOBP1], a ld hl, wOAMBuffer + $84 - ld de, PokeCenterOAMData ; $44d7 + ld de, PokeCenterOAMData call Func_70503 ld a, $4 ld [wMusicHeaderPointer], a @@ -24,18 +24,18 @@ AnimateHealingMachine: ; 70433 (1c:4433) ld a, [wMusicHeaderPointer] and a jr nz, .asm_70464 - ld a, [wPartyCount] ; wPartyCount + ld a, [wPartyCount] ld b, a .asm_7046e call Func_70503 ld a, (SFX_02_4a - SFX_Headers_02) / 3 call PlaySound - ld c, $1e + ld c, 30 call DelayFrames dec b jr nz, .asm_7046e ld a, [wc0ef] - cp $1f + cp BANK(Music1f_UpdateMusic) ld [wc0f0], a jr nz, .asm_70495 ld a, $ff @@ -53,10 +53,10 @@ AnimateHealingMachine: ; 70433 (1c:4433) ld a, [wc026] cp MUSIC_PKMN_HEALED jr z, .asm_704a2 - ld c, $20 + ld c, 32 call DelayFrames pop af - ld [rOBP1], a ; $ff49 + ld [rOBP1], a pop hl pop af ld [hl], a diff --git a/engine/overworld/hidden_items.asm b/engine/overworld/hidden_items.asm index 17288a17..868f118f 100755 --- a/engine/overworld/hidden_items.asm +++ b/engine/overworld/hidden_items.asm @@ -16,15 +16,13 @@ HiddenItems: ; 76688 (1d:6688) ld a, [wWhichTrade] ; item ID ld [wd11e], a call GetItemName - ld a, $24 - jp PrintPredefTextID + tx_pre_jump FoundHiddenItemText INCLUDE "data/hidden_item_coords.asm" FoundHiddenItemText: ; 7675b (1d:675b) -; XXX where is the pointer to this? TX_FAR _FoundHiddenItemText - db $8 + TX_ASM ld a, [wWhichTrade] ; item ID ld b, a ld c, 1 @@ -36,8 +34,8 @@ FoundHiddenItemText: ; 7675b (1d:675b) ld b, $1 predef FlagActionPredef ld a, (SFX_02_3b - SFX_Headers_02) / 3 - call PlaySoundWaitForCurrent ; play sound - call WaitForSoundToFinish ; wait for sound to finish playing + call PlaySoundWaitForCurrent + call WaitForSoundToFinish jp TextScriptEnd .BagFull call WaitForTextScrollButtonPress ; wait for button press @@ -113,10 +111,10 @@ HiddenCoins: ; 76799 (1d:6799) ld a, [wPlayerCoins + 1] cp $99 jr nz, .RoomInCoinCase - ld a, $2c + tx_pre_id DroppedHiddenCoinsText jr .done .RoomInCoinCase - ld a, $2b + tx_pre_id FoundHiddenCoinsText .done jp PrintPredefTextID @@ -146,10 +144,10 @@ Func_76857: ; 76857 (1d:6857) cp $ff ; end of the list? ret z ; if so, we're done here cp b - jr nz, .asm_76877 ; 0x7686b $a + jr nz, .asm_76877 ld a, [hli] cp d - jr nz, .asm_76878 ; 0x7686f $7 + jr nz, .asm_76878 ld a, [hli] cp e jr nz, .loop diff --git a/engine/overworld/item.asm b/engine/overworld/item.asm index a49fc268..b00405bf 100644 --- a/engine/overworld/item.asm +++ b/engine/overworld/item.asm @@ -1,7 +1,7 @@ PickupItem: call EnableAutoTextBoxDrawing - ld a, [H_DOWNARROWBLINKCNT2] ; $ff8c + ld a, [H_DOWNARROWBLINKCNT2] ld b, a ld hl, W_MISSABLEOBJECTLIST .missableObjectsListLoop @@ -18,7 +18,7 @@ PickupItem: ld [$ffdb], a ld hl, W_MAPSPRITEEXTRADATA - ld a, [H_DOWNARROWBLINKCNT2] ; $ff8c + ld a, [H_DOWNARROWBLINKCNT2] dec a add a ld d, 0 diff --git a/engine/overworld/ledges.asm b/engine/overworld/ledges.asm index b8c19181..3a183c0f 100755 --- a/engine/overworld/ledges.asm +++ b/engine/overworld/ledges.asm @@ -2,7 +2,7 @@ HandleLedges: ; 1a672 (6:6672) ld a, [wd736] bit 6, a ; already jumping down ledge ret nz - ld a, [W_CURMAPTILESET] ; W_CURMAPTILESET + ld a, [W_CURMAPTILESET] and a ; OVERWORLD ret nz predef GetTileAndCoordsInFrontOfPlayer diff --git a/engine/overworld/movement.asm b/engine/overworld/movement.asm index c4482700..dac03f3a 100644 --- a/engine/overworld/movement.asm +++ b/engine/overworld/movement.asm @@ -22,39 +22,39 @@ UpdatePlayerSprite: ; 4e31 (1:4e31) .lowerLeftTileIsMapTile call DetectCollisionBetweenSprites ld h, $c1 - ld a, [wWalkCounter] ; wcfc5 + ld a, [wWalkCounter] and a jr nz, .asm_4e90 ld a, [wd528] bit 2, a - jr z, .asm_4e65 - xor a - jr .asm_4e86 -.asm_4e65 + jr z, .notDown + xor a ; ld a, SPRITE_FACING_DOWN + jr .done +.notDown bit 3, a - jr z, .asm_4e6d - ld a, $4 - jr .asm_4e86 -.asm_4e6d + jr z, .notUp + ld a, SPRITE_FACING_UP + jr .done +.notUp bit 1, a - jr z, .asm_4e75 - ld a, $8 - jr .asm_4e86 -.asm_4e75 + jr z, .notLeft + ld a, SPRITE_FACING_LEFT + jr .done +.notLeft bit 0, a - jr z, .asm_4e7d - ld a, $c - jr .asm_4e86 -.asm_4e7d + jr z, .notRight + ld a, SPRITE_FACING_RIGHT + jr .done +.notRight xor a ld [wSpriteStateData1 + 7], a ld [wSpriteStateData1 + 8], a jr .asm_4eab -.asm_4e86 +.done ld [wSpriteStateData1 + 9], a ld a, [wFontLoaded] bit 0, a - jr nz, .asm_4e7d + jr nz, .notRight .asm_4e90 ld a, [wd736] bit 7, a @@ -108,7 +108,7 @@ Func_4ed1: ; 4ed1 (1:4ed1) swap a dec a add a - ld hl, W_MAPSPRITEDATA ; wd4e4 + ld hl, W_MAPSPRITEDATA add l ld l, a ld a, [hl] ; read movement byte 2 @@ -138,7 +138,7 @@ Func_4ed1: ; 4ed1 (1:4ed1) jp z, UpdateSpriteMovementDelay ; c1x1 == 2 cp $3 jp z, UpdateSpriteInWalkingAnimation ; c1x1 == 3 - ld a, [wWalkCounter] ; wcfc5 + ld a, [wWalkCounter] and a ret nz ; don't do anything yet if player is currently moving (redundant, already tested in CheckSpriteAvailability) call InitializeSpriteScreenPosition @@ -212,7 +212,7 @@ Func_4ed1: ; 4ed1 (1:4ed1) cp $2 jr z, .moveRight ; movement byte 2 = $2 only allows left or right .moveUp - ld de, -2*20 ; $ffd8 + ld de, -2*20 add hl, de ; move tile pointer two rows up ld de, $ff00 ld bc, $804 @@ -440,7 +440,7 @@ InitializeSpriteScreenPosition: ; 50bd (1:50bd) ld a, [H_CURRENTSPRITEOFFSET] add $4 ld l, a - ld a, [W_YCOORD] ; wd361 + ld a, [W_YCOORD] ld b, a ld a, [hl] ; c2x4 (Y position + 4) sub b ; relative to player position @@ -449,7 +449,7 @@ InitializeSpriteScreenPosition: ; 50bd (1:50bd) dec h ld [hli], a ; c1x4 (screen Y position) inc h - ld a, [W_XCOORD] ; wd362 + ld a, [W_XCOORD] ld b, a ld a, [hli] ; c2x6 (X position + 4) sub b ; relative to player position @@ -475,7 +475,7 @@ CheckSpriteAvailability: ; 50dc (1:50dc) add $4 ld l, a ld b, [hl] ; c2x4: Y pos (+4) - ld a, [W_YCOORD] ; wd361 + ld a, [W_YCOORD] cp b jr z, .skipYVisibilityTest jr nc, .spriteInvisible ; above screen region @@ -485,7 +485,7 @@ CheckSpriteAvailability: ; 50dc (1:50dc) .skipYVisibilityTest inc l ld b, [hl] ; c2x5: X pos (+4) - ld a, [W_XCOORD] ; wd362 + ld a, [W_XCOORD] cp b jr z, .skipXVisibilityTest jr nc, .spriteInvisible ; left of screen region @@ -503,7 +503,7 @@ CheckSpriteAvailability: ; 50dc (1:50dc) ld a, [hld] cp d jr nc, .spriteInvisible ; standing on tile with ID >=$60 (bottom right tile) - ld bc, -20 ; $ffec + ld bc, -20 add hl, bc ; go back one row of tiles ld a, [hli] cp d @@ -521,7 +521,7 @@ CheckSpriteAvailability: ; 50dc (1:50dc) jr .done .spriteVisible ld c, a - ld a, [wWalkCounter] ; wcfc5 + ld a, [wWalkCounter] and a jr nz, .done ; if player is currently walking, we're done call UpdateSpriteImage diff --git a/engine/overworld/npc_movement.asm b/engine/overworld/npc_movement.asm index 84e39853..73a3fdfb 100755 --- a/engine/overworld/npc_movement.asm +++ b/engine/overworld/npc_movement.asm @@ -52,7 +52,7 @@ ProfOakMovementScriptPointerTable: ; 1a442 (6:6442) dw Func_1a4f4 Func_1a44c: ; 1a44c (6:644c) - ld a, [W_XCOORD] ; wd362 + ld a, [W_XCOORD] sub $a ld [wcca1], a jr z, .asm_1a475 @@ -63,7 +63,7 @@ Func_1a44c: ; 1a44c (6:644c) call FillMemory ld [hl], $ff ld a, [wSpriteIndex] - ld [H_DOWNARROWBLINKCNT2], a ; $ff8c + ld [H_DOWNARROWBLINKCNT2], a ld de, wNPCMovementDirections2 call MoveSprite ld a, $1 diff --git a/engine/overworld/oaks_aide.asm b/engine/overworld/oaks_aide.asm index 68135287..00f6ea82 100755 --- a/engine/overworld/oaks_aide.asm +++ b/engine/overworld/oaks_aide.asm @@ -1,10 +1,10 @@ -OaksAideScript ; 0x59035 +OaksAideScript: ; 0x59035 ld hl, OaksAideHiText call PrintText call YesNoChoice ld a, [wCurrentMenuItem] and a - jr nz, .asm_59086 ; 0x59042 $42 + jr nz, .asm_59086 ld hl, wPokedexOwned ld b, wPokedexOwnedEnd - wPokedexOwned call CountSetBits @@ -13,8 +13,8 @@ OaksAideScript ; 0x59035 ld b, a ld a, [$ffdb] cp b - jr z, .asm_59059 ; 0x59055 $2 - jr nc, .asm_5907c ; 0x59057 $23 + jr z, .asm_59059 + jr nc, .asm_5907c .asm_59059 ld hl, OaksAideHereYouGoText call PrintText @@ -26,17 +26,17 @@ OaksAideScript ; 0x59035 ld hl, OaksAideGotItemText call PrintText ld a, $1 - jr .asm_5908e ; 0x59071 $1b + jr .asm_5908e .BagFull ld hl, OaksAideNoRoomText call PrintText xor a - jr .asm_5908e ; 0x5907a $12 + jr .asm_5908e .asm_5907c ld hl, OaksAideUhOhText call PrintText ld a, $80 - jr .asm_5908e ; 0x59084 $8 + jr .asm_5908e .asm_59086 ld hl, OaksAideComeBackText call PrintText diff --git a/engine/overworld/player_animations.asm b/engine/overworld/player_animations.asm index 6602cedd..d68e4e57 100755 --- a/engine/overworld/player_animations.asm +++ b/engine/overworld/player_animations.asm @@ -58,7 +58,7 @@ EnterMapAnim: ; 70510 (1c:4510) ld a, 12 ld [hli], a ; wFlyAnimCounter ld [hl], $8 ; wFlyAnimBirdSpriteImageIndex (facing right) - ld de, FlyAnimationEnterScreenCoords ; $4592 + ld de, FlyAnimationEnterScreenCoords call DoFlyAnimation call LoadPlayerSpriteGraphics jr .restoreDefaultMusic @@ -154,7 +154,7 @@ _LeaveMapAnim: ; 705ba (1c:45ba) ld a, $c ld [hli], a ; wFlyAnimCounter ld [hl], $c ; wFlyAnimBirdSpriteImageIndex (facing right) - ld de, FlyAnimationScreenCoords1 ; $464f + ld de, FlyAnimationScreenCoords1 call DoFlyAnimation ld c, 40 call DelayFrames @@ -162,7 +162,7 @@ _LeaveMapAnim: ; 705ba (1c:45ba) ld a, 11 ld [hli], a ; wFlyAnimCounter ld [hl], $8 ; wFlyAnimBirdSpriteImageIndex (facing left) - ld de, FlyAnimationScreenCoords2 ; $4667 + ld de, FlyAnimationScreenCoords2 call DoFlyAnimation call GBFadeOutToWhite jp RestoreFacingDirectionAndYScreenPos @@ -248,11 +248,11 @@ DoFlyAnimation: ; 706ae (1c:46ae) ret LoadBirdSpriteGraphics: ; 706d7 (1c:46d7) - ld de, BirdSprite ; $4d80 + ld de, BirdSprite ld hl, vNPCSprites ld bc, (BANK(BirdSprite) << 8) + $0c call CopyVideoData - ld de, BirdSprite + $c0 ; $4e40 ; moving amination sprite + ld de, BirdSprite + $c0 ; moving amination sprite ld hl, vNPCSprites2 ld bc, (BANK(BirdSprite) << 8) + $0c jp CopyVideoData @@ -379,28 +379,28 @@ IsPlayerStandingOnWarpPadOrHole: ; 70787 (1c:4787) db $FF Func_707b6: ; 707b6 (1c:47b6) - ld c, $a + ld c, 10 call DelayFrames ld hl, wd736 set 6, [hl] - ld de, RedSprite ; $4180 + ld de, RedSprite ld hl, vNPCSprites ld bc, (BANK(RedSprite) << 8) + $0c call CopyVideoData ld a, $4 - ld hl, RedFishingTiles ; $4866 + ld hl, RedFishingTiles call LoadAnimSpriteGfx ld a, [wSpriteStateData1 + 2] ld c, a ld b, $0 - ld hl, FishingRodGfxProperties ; $4856 + ld hl, FishingRodGfxProperties add hl, bc ld de, wOAMBuffer + $9c ld bc, $4 call CopyData - ld c, $64 + ld c, 100 call DelayFrames - ld a, [wWhichTrade] ; wWhichTrade + ld a, [wWhichTrade] and a ld hl, NoNibbleText jr z, .asm_70836 diff --git a/engine/overworld/pokecenter.asm b/engine/overworld/pokecenter.asm index 3c640d8e..5b2e4cbb 100755 --- a/engine/overworld/pokecenter.asm +++ b/engine/overworld/pokecenter.asm @@ -43,7 +43,7 @@ DisplayPokemonCenterDialogue_: ; 6fe6 (1:6fe6) .done ld hl, PokemonCenterFarewellText call PrintText - jp UpdateSprites ; move sprites + jp UpdateSprites PokemonCenterWelcomeText: ; 705d (1:705d) TX_FAR _PokemonCenterWelcomeText diff --git a/engine/overworld/pokemart.asm b/engine/overworld/pokemart.asm index 8325b93f..fa93e1db 100755 --- a/engine/overworld/pokemart.asm +++ b/engine/overworld/pokemart.asm @@ -1,7 +1,7 @@ DisplayPokemartDialogue_: ; 6c20 (1:6c20) ld a,[wListScrollOffset] ld [wd07e],a - call UpdateSprites ; move sprites + call UpdateSprites xor a ld [wcf0a],a ; flag that is set if something is sold or bought .loop @@ -36,7 +36,7 @@ DisplayPokemartDialogue_: ; 6c20 (1:6c20) ld [wcf93],a ld a,$02 ld [wd11b],a - callab Func_39bd5 + callab InitList ld a,[wNumBagItems] and a jp z,.bagEmpty @@ -113,7 +113,7 @@ DisplayPokemartDialogue_: ; 6c20 (1:6c20) ld [wcf93],a ld a,$03 ld [wd11b],a - callab Func_39bd5 + callab InitList ld hl,PokemartBuyingGreetingText call PrintText call SaveScreenTilesToBuffer1 ; save screen @@ -204,7 +204,7 @@ DisplayPokemartDialogue_: ; 6c20 (1:6c20) call PrintText ld a,$01 ld [wUpdateSpritesEnabled],a - call UpdateSprites ; move sprites + call UpdateSprites ld a,[wd07e] ld [wListScrollOffset],a ret diff --git a/engine/overworld/ssanne.asm b/engine/overworld/ssanne.asm index f1a8ecf9..4cac4957 100755 --- a/engine/overworld/ssanne.asm +++ b/engine/overworld/ssanne.asm @@ -84,7 +84,7 @@ LoadSmokeTileFourTimes: ; 79fc0 (1e:5fc0) ret LoadSmokeTile: ; 79fd4 (1e:5fd4) - ld de, SSAnneSmokePuffTile ; $5fdd + ld de, SSAnneSmokePuffTile ld bc, (BANK(SSAnneSmokePuffTile) << 8) + $01 jp CopyVideoData diff --git a/engine/overworld/trainers.asm b/engine/overworld/trainers.asm index 4aaab3ed..2b08997b 100755 --- a/engine/overworld/trainers.asm +++ b/engine/overworld/trainers.asm @@ -77,7 +77,7 @@ _SetSpritePosition2: ; 5685d (15:685d) TrainerWalkUpToPlayer: ; 56881 (15:6881) ld a, [wSpriteIndex] swap a - ld [wTrainerSpriteOffset], a ; wWhichTrade + ld [wTrainerSpriteOffset], a call ReadTrainerScreenPosition ld a, [wTrainerFacingDirection] and a @@ -164,7 +164,7 @@ GetSpriteDataPointer: ; 56903 (15:6903) TrainerEngage: ; 5690f (15:690f) push hl push de - ld a, [wTrainerSpriteOffset] ; wWhichTrade + ld a, [wTrainerSpriteOffset] add $2 ld d, $0 ld e, a @@ -175,7 +175,7 @@ TrainerEngage: ; 5690f (15:690f) jr nz, .spriteOnScreen ; test if sprite is on screen jp .noEngage .spriteOnScreen - ld a, [wTrainerSpriteOffset] ; wWhichTrade + ld a, [wTrainerSpriteOffset] add $9 ld d, $0 ld e, a @@ -218,7 +218,7 @@ TrainerEngage: ; 5690f (15:690f) jp .noEngage .engage call CheckPlayerIsInFrontOfSprite - ld a, [wTrainerSpriteOffset] ; wWhichTrade + ld a, [wTrainerSpriteOffset] and a jr z, .noEngage ld hl, wFlags_0xcd60 @@ -226,14 +226,14 @@ TrainerEngage: ; 5690f (15:690f) call EngageMapTrainer ld a, $ff .noEngage: ; 56988 (15:6988) - ld [wTrainerSpriteOffset], a ; wWhichTrade + ld [wTrainerSpriteOffset], a pop de pop hl ret ; reads trainer's Y position to wTrainerScreenY and X position to wTrainerScreenX ReadTrainerScreenPosition: ; 5698e (15:698e) - ld a, [wTrainerSpriteOffset] ; wWhichTrade + ld a, [wTrainerSpriteOffset] add $4 ld d, $0 ld e, a @@ -241,7 +241,7 @@ ReadTrainerScreenPosition: ; 5698e (15:698e) add hl, de ld a, [hl] ld [wTrainerScreenY], a - ld a, [wTrainerSpriteOffset] ; wWhichTrade + ld a, [wTrainerSpriteOffset] add $6 ld d, $0 ld e, a @@ -291,10 +291,10 @@ CheckSpriteCanSeePlayer: ; 569af (15:69af) ; tests if the player is in front of the sprite (rather than behind it) CheckPlayerIsInFrontOfSprite: ; 569e3 (15:69e3) - ld a, [W_CURMAP] ; W_CURMAP + ld a, [W_CURMAP] cp POWER_PLANT - jp z, .engage ; XXX not sure why bypass this for power plant (maybe to get voltorb fake items to work?) - ld a, [wTrainerSpriteOffset] ; wWhichTrade + jp z, .engage ; bypass this for power plant to get voltorb fake items to work + ld a, [wTrainerSpriteOffset] add $4 ld d, $0 ld e, a @@ -306,7 +306,7 @@ CheckPlayerIsInFrontOfSprite: ; 569e3 (15:69e3) ld a, $c .notOnTopmostTile ld [wTrainerScreenY], a - ld a, [wTrainerSpriteOffset] ; wWhichTrade + ld a, [wTrainerSpriteOffset] add $6 ld d, $0 ld e, a @@ -345,5 +345,5 @@ CheckPlayerIsInFrontOfSprite: ; 569e3 (15:69e3) .noEngage xor a .done - ld [wTrainerSpriteOffset], a ; wWhichTrade + ld [wTrainerSpriteOffset], a ret diff --git a/engine/palettes.asm b/engine/palettes.asm index ed06cf4e..a9160d21 100755 --- a/engine/palettes.asm +++ b/engine/palettes.asm @@ -78,7 +78,7 @@ BuildStatusScreenPalPacket: ; 71e4f (1c:5e4f) push af ld hl, wcf2e ld a, [wcf25] - add $1f + add PAL_GREENBAR ld [hli], a inc hl pop af @@ -280,7 +280,7 @@ DeterminePaletteIDOutOfBattle: ; 71f9d (1c:5f9d) ret SendBlkPacket_PartyMenu: ; 71fb6 (1c:5fb6) - ld hl, BlkPacket_PartyMenu ; $62f4 + ld hl, BlkPacket_PartyMenu ld de, wcf2e ld bc, $30 jp CopyData @@ -501,7 +501,7 @@ Func_7210b: ; 7210b (1c:610b) push de call DisableLCD ld a, $e4 - ld [rBGP], a ; $ff47 + ld [rBGP], a ld de, vChars1 ld a, [wcf2d] and a @@ -527,11 +527,11 @@ Func_7210b: ; 7210b (1c:610b) dec c jr nz, .asm_72132 ld a, $e3 - ld [rLCDC], a ; $ff40 + ld [rLCDC], a pop hl call SendSGBPacket xor a - ld [rBGP], a ; $ff47 + ld [rBGP], a ei ret diff --git a/engine/pokedex_rating.asm b/engine/pokedex_rating.asm index 080025c6..881c9716 100755 --- a/engine/pokedex_rating.asm +++ b/engine/pokedex_rating.asm @@ -33,7 +33,7 @@ DisplayDexRating: ; 44169 (11:4169) call PrintText pop hl call PrintText - callba Func_7d13b + callba PlayPokedexRatingSfx jp WaitForTextScrollButtonPress ; wait for button press .label3 ld de, wcc5b diff --git a/engine/predefs.asm b/engine/predefs.asm index f6ecf018..90065d51 100755 --- a/engine/predefs.asm +++ b/engine/predefs.asm @@ -53,11 +53,11 @@ PredefPointers:: ; 4fe79 (13:7e79) ; these are pointers to ASM routines. ; they appear to be used in overworld map scripts. add_predef DrawPlayerHUDAndHPBar - add_predef Func_3f0c6 - add_predef Func_3f073 + add_predef CopyUncompressedPicToTilemap + add_predef AnimateSendingOutMon add_predef ScaleSpriteByTwo add_predef LoadMonBackPic - add_predef Func_79aba + add_predef CopyGrowingMonTiles add_predef LoadMissableObjects add_predef HealParty add_predef MoveAnimation; 08 play move animation @@ -103,7 +103,7 @@ PredefPointers:: ; 4fe79 (13:7e79) add_predef BattleTransition add_predef CopyTileIDsFromList add_predef PlayIntro - add_predef Func_79869 + add_predef GetMoveSoundB add_predef FlashScreen add_predef GetTileAndCoordsInFrontOfPlayer add_predef StatusScreen diff --git a/engine/predefs12.asm b/engine/predefs12.asm index 90032a14..f318447e 100755 --- a/engine/predefs12.asm +++ b/engine/predefs12.asm @@ -4,7 +4,7 @@ ChangeBGPalColor0_4Frames: ; 480eb (12:40eb) ld a, [rBGP] or b ld [rBGP], a - ld c, $4 + ld c, 4 call DelayFrames ld a, [rBGP] and %11111100 @@ -17,7 +17,7 @@ Func_480ff: ; 480ff (12:40ff) ld [wd0a0], a xor a .asm_48108 - ld [H_NUMTOPRINT], a ; $ff96 (aliases: H_MULTIPLICAND) + ld [H_NUMTOPRINT], a ; (aliases: H_MULTIPLICAND) call Func_48119 call Func_48119 dec b @@ -28,11 +28,11 @@ Func_480ff: ; 480ff (12:40ff) ret Func_48119: ; 48119 (12:4119) - ld a, [H_NUMTOPRINT] ; $ff96 (aliases: H_MULTIPLICAND) + ld a, [H_NUMTOPRINT] ; (aliases: H_MULTIPLICAND) xor b - ld [H_NUMTOPRINT], a ; $ff96 (aliases: H_MULTIPLICAND) - ld [rWY], a ; $ff4a - ld c, $3 + ld [H_NUMTOPRINT], a ; (aliases: H_MULTIPLICAND) + ld [rWY], a + ld c, 3 jp DelayFrames Func_48125: ; 48125 (12:4125) @@ -41,14 +41,14 @@ Func_48125: ; 48125 (12:4125) .asm_48129 ld [$ff97], a call Func_4813f - ld c, $1 + ld c, 1 call DelayFrames call Func_4813f dec b ld a, b jr nz, .asm_48129 ld a, $7 - ld [rWX], a ; $ff4b + ld [rWX], a ret Func_4813f: ; 4813f (12:413f) @@ -60,6 +60,6 @@ Func_4813f: ; 4813f (12:413f) xor a .asm_48149 add $7 - ld [rWX], a ; $ff4b - ld c, $4 + ld [rWX], a + ld c, 4 jp DelayFrames diff --git a/engine/predefs17.asm b/engine/predefs17.asm index 74977ee8..a674b45a 100755 --- a/engine/predefs17.asm +++ b/engine/predefs17.asm @@ -2,8 +2,8 @@ ; so that the full Pokedex information gets displayed in Oak's lab StarterDex: ; 5c0dc (17:40dc) ld a, %01001011 ; set starter flags - ld [wPokedexOwned], a ; wPokedexOwned + ld [wPokedexOwned], a predef ShowPokedexData xor a ; unset starter flags - ld [wPokedexOwned], a ; wPokedexOwned + ld [wPokedexOwned], a ret diff --git a/engine/save.asm b/engine/save.asm index 93b70be4..3cc7539a 100755 --- a/engine/save.asm +++ b/engine/save.asm @@ -18,7 +18,7 @@ LoadSAV: ; 735e8 (1c:75e8) set 6, [hl] ld hl, FileDataDestroyedText call PrintText - ld c, $64 + ld c, 100 call DelayFrames pop hl res 6, [hl] @@ -54,7 +54,7 @@ LoadSAVCheckSum: ; 73623 (1c:7623) .Func_73652 ; 73652 (1c:7652) ld hl, S_SAVEDPLAYERNAME - ld de, wPlayerName ; wd158 + ld de, wPlayerName ld bc, $b call CopyData ld hl, S_SAVEDMAINDATA @@ -110,11 +110,11 @@ LoadSAVCheckSum2: ; 736bd (1c:76bd) cp c jp nz, SAVBadCheckSum ld hl, S_SAVEDPARTYDATA - ld de, wPartyCount ; wPartyCount + ld de, wPartyCount ld bc, wPokedexOwned - wPartyCount call CopyData ld hl, S_SAVEDMAINDATA - ld de, wPokedexOwned ; wPokedexOwned + ld de, wPokedexOwned ld bc, wPokedexSeenEnd - wPokedexOwned call CopyData and a @@ -129,12 +129,12 @@ SAVGoodChecksum: ; 736f8 (1c:76f8) ld [MBC1SRamEnable], a ret -Func_73701: ; 0x73701 +Func_73701: ; 73701 (1c:7701) call LoadSAVCheckSum call LoadSAVCheckSum1 jp LoadSAVCheckSum2 -SaveSAV: ;$770a +SaveSAV: ; 7370a (1c:770a) callba PrintSaveScreenText ld hl,WouldYouLikeToSaveText call SaveSAVConfirm @@ -149,22 +149,22 @@ SaveSAV: ;$770a call SaveSAVConfirm and a ret nz -.save ;$772d - call SaveSAVtoSRAM ;$7848 +.save + call SaveSAVtoSRAM hlCoord 1, 13 ld bc,$0412 call ClearScreenArea ; clear area 4x12 starting at 13,1 hlCoord 1, 14 ld de,NowSavingString call PlaceString - ld c,$78 + ld c,120 call DelayFrames ld hl,GameSavedText call PrintText ld a, (SFX_02_5d - SFX_Headers_02) / 3 ;sound for saved game call PlaySoundWaitForCurrent call WaitForSoundToFinish - ld c,$1e + ld c,30 jp DelayFrames NowSavingString: @@ -292,7 +292,7 @@ SAVCheckSum: ; 73856 (1c:7856) Func_73863: ; 73863 (1c:7863) ld hl, $a000 - ld de, S_SAVEDBOXESCHECKSUM2 ; $ba4d + ld de, S_SAVEDBOXES1CHECKSUM2 ; S_SAVEDBOXES2CHECKSUM2 ld b, $6 .asm_7386b push bc @@ -308,7 +308,7 @@ Func_73863: ; 73863 (1c:7863) ret Func_7387b: ; 7387b (1c:787b) - ld hl, PointerTable_73895 ; $7895 + ld hl, PointerTable_73895 ld a, [wd5a0] and $7f cp $6 @@ -327,12 +327,12 @@ Func_7387b: ; 7387b (1c:787b) ret PointerTable_73895: ; 73895 (1c:7895) - dw S_SAVEDBOX1 - dw S_SAVEDBOX2 - dw S_SAVEDBOX3 - dw S_SAVEDBOX4 - dw S_SAVEDBOX5 - dw S_SAVEDBOX6 + dw S_SAVEDBOX1 ; S_SAVEDBOX7 + dw S_SAVEDBOX2 ; S_SAVEDBOX8 + dw S_SAVEDBOX3 ; S_SAVEDBOX9 + dw S_SAVEDBOX4 ; S_SAVEDBOX10 + dw S_SAVEDBOX5 ; S_SAVEDBOX11 + dw S_SAVEDBOX6 ; S_SAVEDBOX12 ChangeBox:: ; 738a1 (1c:78a1) ld hl, WhenYouChangeBoxText @@ -402,7 +402,7 @@ Func_7390e: ; 7390e (1c:790e) ld hl, $a000 ld bc, $1a4c call SAVCheckSum - ld [S_SAVEDBOXESCHECKSUM], a + ld [S_SAVEDBOXES1CHECKSUM], a ; S_SAVEDBOXES2CHECKSUM call Func_73863 xor a ld [MBC1SRamBankingMode], a @@ -411,21 +411,21 @@ Func_7390e: ; 7390e (1c:790e) Func_7393f: ; 7393f (1c:793f) xor a - ld [H_AUTOBGTRANSFERENABLED], a ; $ffba + ld [H_AUTOBGTRANSFERENABLED], a ld a, $3 - ld [wMenuWatchedKeys], a ; wMenuWatchedKeys + ld [wMenuWatchedKeys], a ld a, $b - ld [wMaxMenuItem], a ; wMaxMenuItem + ld [wMaxMenuItem], a ld a, $1 - ld [wTopMenuItemY], a ; wTopMenuItemY + ld [wTopMenuItemY], a ld a, $c - ld [wTopMenuItemX], a ; wTopMenuItemX + ld [wTopMenuItemX], a xor a ld [wcc37], a ld a, [wd5a0] and $7f - ld [wCurrentMenuItem], a ; wCurrentMenuItem - ld [wLastMenuItem], a ; wLastMenuItem + ld [wCurrentMenuItem], a + ld [wLastMenuItem], a ld hl, wTileMap ld b, $2 ld c, $9 @@ -438,7 +438,7 @@ Func_7393f: ; 7393f (1c:793f) call TextBoxBorder ld hl, hFlags_0xFFF6 set 2, [hl] - ld de, BoxNames ; $79d9 + ld de, BoxNames hlCoord 13, 1 call PlaceString ld hl, hFlags_0xFFF6 @@ -461,7 +461,7 @@ Func_7393f: ; 7393f (1c:793f) call PlaceString call Func_73a84 hlCoord 18, 1 - ld de, wWhichTrade ; wWhichTrade + ld de, wWhichTrade ld bc, $14 ld a, $c .asm_739c2 @@ -477,7 +477,7 @@ Func_7393f: ; 7393f (1c:793f) dec a jr nz, .asm_739c2 ld a, $1 - ld [H_AUTOBGTRANSFERENABLED], a ; $ffba + ld [H_AUTOBGTRANSFERENABLED], a ret ChooseABoxText: ; 739d4 (1c:79d4) @@ -518,22 +518,22 @@ Func_73a29: ; 73a29 (1c:7a29) ret Func_73a4b: ; 73a4b (1c:7a4b) - ld hl, S_SAVEDBOX1 + ld hl, S_SAVEDBOX1 ; S_SAVEDBOX7 call Func_73a7f - ld hl, S_SAVEDBOX2 + ld hl, S_SAVEDBOX2 ; S_SAVEDBOX8 call Func_73a7f - ld hl, S_SAVEDBOX3 + ld hl, S_SAVEDBOX3 ; S_SAVEDBOX9 call Func_73a7f - ld hl, S_SAVEDBOX4 + ld hl, S_SAVEDBOX4 ; S_SAVEDBOX10 call Func_73a7f - ld hl, S_SAVEDBOX5 + ld hl, S_SAVEDBOX5 ; S_SAVEDBOX11 call Func_73a7f - ld hl, S_SAVEDBOX6 + ld hl, S_SAVEDBOX6 ; S_SAVEDBOX12 call Func_73a7f - ld hl, S_SAVEDBOX1 + ld hl, S_SAVEDBOX1 ; S_SAVEDBOX7 ld bc, $6 * (S_SAVEDBOX2 - S_SAVEDBOX1) ; $1a4c call SAVCheckSum - ld [S_SAVEDBOXESCHECKSUM], a + ld [S_SAVEDBOXES1CHECKSUM], a ; S_SAVEDBOXES2CHECKSUM call Func_73863 ret @@ -545,7 +545,7 @@ Func_73a7f: ; 73a7f (1c:7a7f) ret Func_73a84: ; 73a84 (1c:7a84) - ld hl, wWhichTrade ; wWhichTrade + ld hl, wWhichTrade push hl ld a, SRAM_ENABLE ld [MBC1SRamEnable], a @@ -566,29 +566,29 @@ Func_73a84: ; 73a84 (1c:7a84) ld c, a ld b, $0 add hl, bc - ld a, [W_NUMINBOX] ; wda80 + ld a, [W_NUMINBOX] ld [hl], a ret Func_73ab8: ; 73ab8 (1c:7ab8) - ld a, [S_SAVEDBOX1] + ld a, [S_SAVEDBOX1] ; S_SAVEDBOX7 ld [hli], a - ld a, [S_SAVEDBOX2] + ld a, [S_SAVEDBOX2] ; S_SAVEDBOX8 ld [hli], a - ld a, [S_SAVEDBOX3] + ld a, [S_SAVEDBOX3] ; S_SAVEDBOX9 ld [hli], a - ld a, [S_SAVEDBOX4] + ld a, [S_SAVEDBOX4] ; S_SAVEDBOX10 ld [hli], a - ld a, [S_SAVEDBOX5] + ld a, [S_SAVEDBOX5] ; S_SAVEDBOX11 ld [hli], a - ld a, [S_SAVEDBOX6] + ld a, [S_SAVEDBOX6] ; S_SAVEDBOX12 ld [hli], a ret -SAVCheckRandomID: ;$7ad1 +SAVCheckRandomID: ; 73ad1 (1c:7ad1) ;checks if Sav file is the same by checking player's name 1st letter ($a598) ; and the two random numbers generated at game beginning -;(which are stored at wPlayerID) +;(which are stored at wPlayerID)s ld a,$0a ld [$0000],a ld a,$01 @@ -646,7 +646,7 @@ SaveHallOfFameTeams: ; 73b0d (1c:7b0d) LoadHallOfFameTeams: ; 73b3f (1c:7b3f) ld hl, sHallOfFame ld bc, HOF_TEAM - ld a, [wWhichTrade] ; wWhichTrade + ld a, [wWhichTrade] call AddNTimes ld de, wcc5b ld bc, HOF_TEAM diff --git a/engine/slot_machine.asm b/engine/slot_machine.asm index e3e452f3..0b9f8bc9 100755 --- a/engine/slot_machine.asm +++ b/engine/slot_machine.asm @@ -128,7 +128,7 @@ MainSlotMachineLoop: ; 37395 (d:7395) jr nz, .skip2 ld hl, OutOfCoinsSlotMachineText call PrintText - ld c, $3c + ld c, 60 jp DelayFrames .skip2 ld hl, OneMoreGoSlotMachineText @@ -202,13 +202,13 @@ SlotMachine_37480: ; 37480 (d:7480) ret SlotMachine_374ad: ; 374ad (d:74ad) - ld c, $14 + ld c, 20 .loop1 push bc call SlotMachine_37813 call SlotMachine_37823 call SlotMachine_37833 - ld c, $2 + ld c, 2 call DelayFrames pop bc dec c @@ -437,7 +437,7 @@ SlotMachine_37588: ; 37588 (d:7588) ld a, [$ff47] xor $40 ld [$ff47], a - ld c, $5 + ld c, 5 call DelayFrames dec b jr nz, .asm_37638 @@ -456,7 +456,7 @@ SlotMachine_37588: ; 37588 (d:7588) jp .loop SlotsMachineText_37665: ; 37665 (d:7665) - db $08 ; asm + TX_ASM push bc call SlotMachine_37728 ld hl, LinedUpText @@ -674,7 +674,7 @@ SlotMachine_3776b: ; 3776b (d:776b) ld [W_SUBANIMTRANSFORM], a ld a, [wTrainerScreenX] cp $7 - ld c, $8 + ld c, 8 jr nc, .skip2 srl c .skip2 diff --git a/engine/titlescreen.asm b/engine/titlescreen.asm index ed23fbc4..e582d1be 100755 --- a/engine/titlescreen.asm +++ b/engine/titlescreen.asm @@ -5,10 +5,10 @@ CopyFixedLengthText: ; 42b1 (1:42b1) SetDefaultNamesBeforeTitlescreen: ; 42b7 (1:42b7) ld hl, NintenText - ld de, wPlayerName ; wd158 + ld de, wPlayerName call CopyFixedLengthText ld hl, SonyText - ld de, W_RIVALNAME ; wd34a + ld de, W_RIVALNAME call CopyFixedLengthText xor a ld [hWY], a @@ -24,7 +24,7 @@ SetDefaultNamesBeforeTitlescreen: ; 42b7 (1:42b7) LoadTitlescreenGraphics: ; 42dd (1:42dd) call GBPalWhiteOut ld a, $1 - ld [H_AUTOBGTRANSFERENABLED], a ; $ffba + ld [H_AUTOBGTRANSFERENABLED], a xor a ld [hTilesetType], a ld [hSCX], a @@ -35,27 +35,27 @@ LoadTitlescreenGraphics: ; 42dd (1:42dd) call ClearScreen call DisableLCD call LoadFontTilePatterns - ld hl, NintendoCopyrightLogoGraphics ; $60c8 + ld hl, NintendoCopyrightLogoGraphics ld de, vTitleLogo2 + $100 ld bc, $50 ld a, BANK(NintendoCopyrightLogoGraphics) call FarCopyData2 - ld hl, GamefreakLogoGraphics ; $61f8 + ld hl, GamefreakLogoGraphics ld de, vTitleLogo2 + $100 + $50 ld bc, $90 ld a, BANK(GamefreakLogoGraphics) call FarCopyData2 - ld hl, PokemonLogoGraphics ; $5380 + ld hl, PokemonLogoGraphics ld de, vTitleLogo ld bc, $600 ld a, BANK(PokemonLogoGraphics) call FarCopyData2 ; first chunk - ld hl, PokemonLogoGraphics+$600 ; $5980 + ld hl, PokemonLogoGraphics+$600 ld de, vTitleLogo2 ld bc, $100 ld a, BANK(PokemonLogoGraphics) call FarCopyData2 ; second chunk - ld hl, Version_GFX ; $402f + ld hl, Version_GFX IF DEF(_RED) ld de,vChars2 + $600 ld bc,$50 @@ -97,7 +97,7 @@ ENDC ld a, $74 ld [hl], a hlCoord 2, 17 - ld de, .titlescreenTilemap ; $437f + ld de, .titlescreenTilemap ld b, $10 .asm_4377 ld a, [de] @@ -121,7 +121,7 @@ IF DEF(_BLUE) ld a,SQUIRTLE ; which Pokemon to show first on the title screen ENDC - ld [wWhichTrade], a ; wWhichTrade + ld [wWhichTrade], a call Func_4524 ld a, $9b call Func_4533 @@ -135,9 +135,9 @@ ENDC call GoPAL_SET call GBPalNormal ld a, $e4 - ld [rOBP0], a ; $ff48 + ld [rOBP0], a ld bc, $ffaf ; background scroll Y - ld hl, .TitleScreenPokemonLogoYScrolls ; $43db + ld hl, .TitleScreenPokemonLogoYScrolls .asm_43c6 ld a, [hli] and a @@ -176,7 +176,7 @@ ENDC ret .asm_43f4 call LoadScreenTilesFromBuffer1 - ld c, $24 + ld c, 36 call DelayFrames ld a, (SFX_1f_63 - SFX_Headers_1f) / 3 call PlaySound @@ -219,7 +219,7 @@ ENDC call Func_4496 jr .asm_443b .asm_4459 - ld a, [wWhichTrade] ; wWhichTrade + ld a, [wWhichTrade] call PlayCry call WaitForSoundToFinish call GBPalWhiteOutWithDelay3 @@ -227,7 +227,7 @@ ENDC xor a ld [hWY], a inc a - ld [H_AUTOBGTRANSFERENABLED], a ; $ffba + ld [H_AUTOBGTRANSFERENABLED], a call ClearScreen ld a, $98 call Func_4533 @@ -260,7 +260,7 @@ Func_4496: ; 4496 (1:4496) ld hl, TitleMons add hl, bc ld a, [hl] - ld hl, wWhichTrade ; wWhichTrade + ld hl, wWhichTrade ; Can't be the same as before. cp [hl] @@ -289,7 +289,7 @@ Func_44cf: ; 44cf (1:44cf) jr nz, .wait ld a, h - ld [rSCX], a ; $ff43 + ld [rSCX], a .wait2 ld a, [$ff44] ; rLY @@ -298,14 +298,14 @@ Func_44cf: ; 44cf (1:44cf) ret Func_44dd: ; 44dd (1:44dd) - ld hl, PlayerCharacterTitleGraphics ; $66a8 + ld hl, PlayerCharacterTitleGraphics ld de, vSprites ld bc, $230 ld a, BANK(PlayerCharacterTitleGraphics) call FarCopyData2 call ClearSprites xor a - ld [wWhichTrade], a ; wWhichTrade + ld [wWhichTrade], a ld hl, wOAMBuffer ld de, $605a ld b, $7 @@ -319,10 +319,10 @@ Func_44dd: ; 44dd (1:44dd) ld [hli], a add $8 ld e, a - ld a, [wWhichTrade] ; wWhichTrade + ld a, [wWhichTrade] ld [hli], a inc a - ld [wWhichTrade], a ; wWhichTrade + ld [wWhichTrade], a inc hl dec c jr nz, .asm_44fd @@ -358,12 +358,12 @@ LoadCopyrightAndTextBoxTiles: ; 4538 (1:4538) call LoadTextBoxTilePatterns LoadCopyrightTiles: ; 4541 (1:4541) - ld de, NintendoCopyrightLogoGraphics ; $60c8 + ld de, NintendoCopyrightLogoGraphics ld hl, vChars2 + $600 ld bc, (BANK(NintendoCopyrightLogoGraphics) << 8) + $1c call CopyVideoData hlCoord 2, 7 - ld de, CopyrightTextString ; $4556 + ld de, CopyrightTextString jp PlaceString CopyrightTextString: ; 4556 (1:4556) diff --git a/engine/titlescreen2.asm b/engine/titlescreen2.asm index dc1c633a..57e5c3d5 100755 --- a/engine/titlescreen2.asm +++ b/engine/titlescreen2.asm @@ -74,7 +74,7 @@ _TitleScroll: ; 3726a (d:726a) jr nz, .wait ld a, h - ld [rSCX], a ; $ff43 + ld [rSCX], a .wait2 ld a, [$ff44] ; rLY @@ -89,7 +89,7 @@ TitleBallYTable: ; 372a0 (d:72a0) Func_372ac: ; 372ac (d:72ac) ; Animate the TitleBall if a starter just got scrolled out. - ld a, [wWhichTrade] ; wWhichTrade + ld a, [wWhichTrade] cp STARTER1 jr z, .ok cp STARTER2 diff --git a/engine/town_map.asm b/engine/town_map.asm index 5a718519..0dd84226 100755 --- a/engine/town_map.asm +++ b/engine/town_map.asm @@ -7,7 +7,7 @@ DisplayTownMap: ; 70e3e (1c:4e3e) push hl ld a, $1 ld [hJoy7], a - ld a, [W_CURMAP] ; W_CURMAP + ld a, [W_CURMAP] push af ld b, $0 call Func_711c4 @@ -19,11 +19,11 @@ DisplayTownMap: ; 70e3e (1c:4e3e) ld bc, $10 call CopyData ld hl, vSprites + $40 - ld de, TownMapCursor ; $4f40 + ld de, TownMapCursor ld bc, (BANK(TownMapCursor) << 8) + $04 call CopyVideoDataDouble xor a - ld [wWhichTrade], a ; wWhichTrade + ld [wWhichTrade], a pop af jr Func_70e92 @@ -31,8 +31,8 @@ Func_70e7e: ; 70e7e (1c:4e7e) ld hl, wTileMap ld bc, $114 call ClearScreenArea - ld hl, TownMapOrder ; $4f11 - ld a, [wWhichTrade] ; wWhichTrade + ld hl, TownMapOrder + ld a, [wWhichTrade] ld c, a ld b, $0 add hl, bc @@ -86,22 +86,22 @@ Func_70e92: ; 70e92 (1c:4e92) ld [hl], a ret .asm_70ef2 - ld a, [wWhichTrade] ; wWhichTrade + ld a, [wWhichTrade] inc a cp $2f jr nz, .asm_70efb xor a .asm_70efb - ld [wWhichTrade], a ; wWhichTrade + ld [wWhichTrade], a jp Func_70e7e .asm_70f01 - ld a, [wWhichTrade] ; wWhichTrade + ld a, [wWhichTrade] dec a cp $ff jr nz, .asm_70f0b ld a, $2e .asm_70f0b - ld [wWhichTrade], a ; wWhichTrade + ld [wWhichTrade], a jp Func_70e7e INCLUDE "data/town_map_order.asm" @@ -139,11 +139,11 @@ LoadTownMap_Fly: ; 70f90 (1c:4f90) call LoadTownMap call LoadPlayerSpriteGraphics call LoadFontTilePatterns - ld de, BirdSprite ; $4d80 + ld de, BirdSprite ld hl, vSprites + $40 ld bc, (BANK(BirdSprite) << 8) + $0c call CopyVideoData - ld de, TownMapUpArrow ; $5093 + ld de, TownMapUpArrow ld hl, vChars1 + $6d0 ld bc, (BANK(TownMapUpArrow) << 8) + $01 call CopyVideoDataDouble @@ -156,7 +156,7 @@ LoadTownMap_Fly: ; 70f90 (1c:4f90) ld hl, wTileMap ld de, ToText call PlaceString - ld a, [W_CURMAP] ; W_CURMAP + ld a, [W_CURMAP] ld b, $0 call Func_711c4 ld hl, wTrainerEngageDistance @@ -177,7 +177,7 @@ LoadTownMap_Fly: ; 70f90 (1c:4f90) hlCoord 3, 0 ld de, wcd6d call PlaceString - ld c, $f + ld c, 15 call DelayFrames hlCoord 18, 0 ld [hl], $ed @@ -248,7 +248,7 @@ ToText: ; 7106d (1c:506d) db "To@" Func_71070: ; 71070 (1c:5070) - ld hl, wWhichTrade ; wWhichTrade + ld hl, wWhichTrade ld [hl], $ff inc hl ld a, [W_TOWNVISITEDFLAG] @@ -283,18 +283,18 @@ LoadTownMap: ; 7109b (1c:509b) ld c, $12 call TextBoxBorder call DisableLCD - ld hl, WorldMapTileGraphics ; $65a8 + ld hl, WorldMapTileGraphics ld de, vChars2 + $600 ld bc, $100 ld a, BANK(WorldMapTileGraphics) call FarCopyData2 - ld hl, MonNestIcon ; $56be + ld hl, MonNestIcon ld de, vSprites + $40 ld bc, $8 ld a, BANK(MonNestIcon) call FarCopyDataDouble ld hl, wTileMap - ld de, CompressedMap ; $5100 + ld de, CompressedMap .asm_710d3 ld a, [de] and a @@ -401,7 +401,7 @@ Func_711ef: ; 711ef (1c:51ef) call PlaceString jr .asm_7123e .asm_71236 - ld a, [W_CURMAP] ; W_CURMAP + ld a, [W_CURMAP] ld b, $0 call Func_711c4 .asm_7123e @@ -545,7 +545,7 @@ Func_712f1: ; 712f1 (1c:52f1) cp REDS_HOUSE_1F jr c, .asm_71304 ld bc, $4 - ld hl, InternalMapEntries ; $5382 + ld hl, InternalMapEntries .asm_712fb cp [hl] jr c, .asm_71301 @@ -555,7 +555,7 @@ Func_712f1: ; 712f1 (1c:52f1) inc hl jr .asm_7130d .asm_71304 - ld hl, ExternalMapEntries ; $5313 + ld hl, ExternalMapEntries ld c, a ld b, $0 add hl, bc diff --git a/engine/trade.asm b/engine/trade.asm index bb4fa4e1..6309e8d5 100755 --- a/engine/trade.asm +++ b/engine/trade.asm @@ -662,7 +662,7 @@ Trade_AnimMonMoveVertical: ; 41525 (10:5525) .loop call Trade_AddOffsetsToOAMCoords call Trade_AnimCircledMon - ld c, $8 + ld c, 8 call DelayFrames dec d jr nz, .loop |