Do a little cleanup towards issue #465

This commit is contained in:
Remy Oukaour
2018-01-09 17:20:47 -05:00
parent ce50d1b2cb
commit a8cf8979d9
10 changed files with 52 additions and 46 deletions

View File

@@ -16,12 +16,12 @@ HiddenPowerDamage: ; fbced
; Attack
ld a, [hl]
swap a
and 8
and %1000
; Defense
ld b, a
ld a, [hli]
and 8
and %1000
srl a
or b
@@ -29,7 +29,7 @@ HiddenPowerDamage: ; fbced
ld b, a
ld a, [hl]
swap a
and 8
and %1000
srl a
srl a
or b
@@ -37,7 +37,7 @@ HiddenPowerDamage: ; fbced
; Special
ld b, a
ld a, [hl]
and 8
and %1000
srl a
srl a
srl a
@@ -52,7 +52,7 @@ HiddenPowerDamage: ; fbced
; Add Special & 3
ld b, a
ld a, [hld]
and 3
and %0011
add b
; Divide by 2 and add 30 + 1
@@ -67,12 +67,12 @@ HiddenPowerDamage: ; fbced
; Def & 3
ld a, [hl]
and 3
and %0011
ld b, a
; + (Atk & 3) << 2
ld a, [hl]
and 3 << 4
and %0011 << 4
swap a
add a
add a

View File

@@ -853,7 +853,7 @@ ShrinkPlayer: ; 610f
ld a, [hROMBank]
push af
ld a, 0 << 7 | 32 ; fade out
ld a, 32 ; fade time
ld [MusicFade], a
ld de, MUSIC_NONE
ld a, e

View File

@@ -2291,7 +2291,7 @@ PokeDoll: ; f48f
inc a
ld [wForcedSwitch], a
ld a, [wBattleResult]
and 3 << 6
and $c0
or $2
ld [wBattleResult], a
jp UseItemText
@@ -2575,7 +2575,7 @@ Mysteryberry: ; f5bf
ld bc, MON_PP - MON_MOVES
add hl, bc
ld a, [hl]
cp 3 << 6 ; have 3 PP Ups already been used?
cp PP_UP_MASK
jr c, .do_ppup
.CantUsePPUpOnSketch:
@@ -2586,7 +2586,7 @@ Mysteryberry: ; f5bf
.do_ppup
ld a, [hl]
add 1 << 6 ; increase PP Up count by 1
add PP_UP_ONE
ld [hl], a
ld a, $1
ld [wd265], a
@@ -2714,7 +2714,7 @@ RestorePP: ; f6e8
ld a, [wd265]
ld b, a
ld a, [hl]
and (1 << 6) - 1
and PP_MASK
cp b
jr nc, .dont_restore
@@ -2732,7 +2732,7 @@ RestorePP: ; f6e8
.restore_some
ld a, [hl]
and (1 << 6) - 1
and PP_MASK
add c
cp b
jr nc, .restore_all
@@ -2740,7 +2740,7 @@ RestorePP: ; f6e8
.restore_all
ld a, [hl]
and 3 << 6
and PP_UP_MASK
or b
ld [hl], a
ret
@@ -3125,7 +3125,7 @@ ApplyPPUp: ; f84c
.use
ld a, [hl]
and 3 << 6
and PP_UP_MASK
ld a, [de] ; wasted cycle
call nz, ComputeMaxPP
@@ -3209,7 +3209,7 @@ RestoreAllPP: ; f8b9
pop bc
pop de
ld a, [de]
and 3 << 6
and PP_UP_MASK
ld b, a
ld a, [wd265]
add b
@@ -3282,7 +3282,7 @@ GetMaxPPOfMove: ; f8ec
.notwild
add hl, bc
ld a, [hl]
and 3 << 6
and PP_UP_MASK
pop bc
or b
@@ -3293,7 +3293,7 @@ GetMaxPPOfMove: ; f8ec
ld a, b ; this gets lost anyway
call ComputeMaxPP
ld a, [hl]
and (1 << 6) - 1
and PP_MASK
ld [wd265], a
pop af

View File

@@ -2422,7 +2422,7 @@ Pokedex_LoadCurrentFootprint: ; 41478 (10:5478)
Pokedex_LoadAnyFootprint: ; 4147b
ld a, [wd265]
dec a
and ($ff ^ $07) ; $f8 ; $1f << 3
and %11111000
srl a
srl a
srl a
@@ -2430,7 +2430,7 @@ Pokedex_LoadAnyFootprint: ; 4147b
ld d, a
ld a, [wd265]
dec a
and 7
and %111
swap a ; * $10
ld l, a
ld h, 0

View File

@@ -898,7 +898,7 @@ Script_musicfadeout:
call GetScriptByte
ld [MusicFadeID + 1], a
call GetScriptByte
and $7f
and $ff ^ (1 << MUSIC_FADE_IN_F)
ld [MusicFade], a
ret

View File

@@ -1157,7 +1157,7 @@ CheckFaintedFrzSlp: ; 4e53f
ld hl, MON_STATUS
add hl, bc
ld a, [hl]
and (1 << FRZ) | SLP
and 1 << FRZ | SLP
jr nz, .fainted_frz_slp
and a
ret

View File

@@ -237,11 +237,11 @@ SuicuneFrameIterator: ; 10eea7
inc [hl]
; Only do this once every eight frames
and (1 << 3) - 1
and %111
ret nz
ld a, c
and 3 << 3
and %11000
sla a
swap a
ld e, a