fixed hram aliases and named wram var

This commit is contained in:
YamaArashi 2015-07-23 20:48:35 -07:00
parent 04a6c306dc
commit 323895af6d
11 changed files with 104 additions and 84 deletions

View file

@ -104,10 +104,10 @@ PrintSendOutMonMessage: ; 58e59 (16:4e59)
ld [H_MULTIPLICAND], a
ld hl, wEnemyMonHP
ld a, [hli]
ld [wcce3], a
ld [wLastSwitchInEnemyMonHP], a
ld [H_MULTIPLICAND + 1], a
ld a, [hl]
ld [wcce4], a
ld [wLastSwitchInEnemyMonHP + 1], a
ld [H_MULTIPLICAND + 2], a
ld a, 25
ld [H_MULTIPLIER], a
@ -120,7 +120,7 @@ PrintSendOutMonMessage: ; 58e59 (16:4e59)
srl a
rr b
ld a, b
ld b, $4
ld b, 4
ld [H_DIVISOR], a ; enemy mon max HP divided by 4
call Divide
ld a, [H_QUOTIENT + 3] ; a = (enemy mon current HP * 25) / (enemy max HP / 4); this approximates the current percentage of max HP
@ -174,19 +174,19 @@ PlayerMon2Text: ; 58ed7 (16:4ed7)
push de
push bc
ld hl, wEnemyMonHP + 1
ld de, wcce4
ld de, wLastSwitchInEnemyMonHP + 1
ld b, [hl]
dec hl
ld a, [de]
sub b
ld [$ff98], a
ld [H_MULTIPLICAND + 2], a
dec de
ld b, [hl]
ld a, [de]
sbc b
ld [$ff97], a
ld a, $19
ld [H_POWEROFTEN], a
ld [H_MULTIPLICAND + 1], a
ld a, 25
ld [H_MULTIPLIER], a
call Multiply
ld hl, wEnemyMonMaxHP
ld a, [hli]
@ -196,22 +196,27 @@ PlayerMon2Text: ; 58ed7 (16:4ed7)
srl a
rr b
ld a, b
ld b, $4
ld [H_POWEROFTEN], a
ld b, 4
ld [H_DIVISOR], a
call Divide
pop bc
pop de
ld a, [$ff98]
ld hl, EnoughText
ld a, [H_QUOTIENT + 3] ; a = ((LastSwitchInEnemyMonHP - CurrentEnemyMonHP) / 25) / (EnemyMonMaxHP / 4)
; Assuming that the enemy mon hasn't gained HP since the last switch in,
; a approximates the percentage that the enemy mon's total HP has decreased
; since the last switch in.
; If the enemy mon has gained HP, then a is garbage due to wrap-around and
; can fall in any of the ranges below.
ld hl, EnoughText ; HP stayed the same
and a
ret z
ld hl, ComeBackText
cp $1e
ld hl, ComeBackText ; HP went down 1% - 29%
cp 30
ret c
ld hl, OKExclamationText
cp $46
ld hl, OKExclamationText ; HP went down 30% - 69%
cp 70
ret c
ld hl, GoodText
ld hl, GoodText ; HP went down 70% or more
ret
EnoughText: ; 58f25 (16:4f25)

View file

@ -175,7 +175,7 @@ SlidePlayerAndEnemySilhouettesOnScreen: ; 3c04c (f:404c)
ld a, $1
ld [H_AUTOBGTRANSFERENABLED], a
ld a, $31
ld [$ffe1], a
ld [hStartTileID], a
coord hl, 1, 5
predef CopyUncompressedPicToTilemap
xor a
@ -1429,9 +1429,9 @@ EnemySendOutFirstMon: ; 3c92a (f:492a)
call LoadEnemyMonData
ld hl,wEnemyMonHP
ld a,[hli]
ld [wcce3],a
ld [wLastSwitchInEnemyMonHP],a
ld a,[hl]
ld [wcce4],a
ld [wLastSwitchInEnemyMonHP + 1],a
ld a,1
ld [wCurrentMenuItem],a
ld a,[wd11d]
@ -1497,8 +1497,8 @@ EnemySendOutFirstMon: ; 3c92a (f:492a)
call GetMonHeader
ld de,vFrontPic
call LoadMonFrontSprite
ld a,$CF
ld [$FFE1],a
ld a,-$31
ld [hStartTileID],a
coord hl, 15, 6
predef AnimateSendingOutMon
ld a,[wEnemyMonSpecies2]
@ -1802,7 +1802,7 @@ SendOutMon: ; 3cc91 (f:4c91)
call DrawPlayerHUDAndHPBar
predef LoadMonBackPic
xor a
ld [$ffe1], a
ld [hStartTileID], a
ld hl, wBattleAndStartSavedMenuItem
ld [hli], a
ld [hl], a
@ -1839,23 +1839,23 @@ SendOutMon: ; 3cc91 (f:4c91)
; show 2 stages of the player mon getting smaller before disappearing
AnimateRetreatingPlayerMon: ; 3ccfa (f:4cfa)
coord hl, 1, 5
ld bc, $707
lb bc, 7, 7
call ClearScreenArea
coord hl, 3, 7
ld bc, $505
lb bc, 5, 5
xor a
ld [wDownscaledMonSize], a
ld [H_DOWNARROWBLINKCNT1], a
ld [hBaseTileID], a
predef CopyDownscaledMonTiles
ld c, 4
call DelayFrames
call .clearScreenArea
coord hl, 4, 9
ld bc, $303
ld a, $1
lb bc, 3, 3
ld a, 1
ld [wDownscaledMonSize], a
xor a
ld [H_DOWNARROWBLINKCNT1], a
ld [hBaseTileID], a
predef CopyDownscaledMonTiles
call Delay3
call .clearScreenArea
@ -1863,7 +1863,7 @@ AnimateRetreatingPlayerMon: ; 3ccfa (f:4cfa)
Coorda 5, 11
.clearScreenArea
coord hl, 1, 5
ld bc, $707
lb bc, 7, 7
jp ClearScreenArea
; reads player's current mon's HP into wBattleMonHP
@ -6449,7 +6449,7 @@ LoadPlayerBackPic: ; 3ec92 (f:6c92)
xor a
ld [$0], a
ld a, $31
ld [$ffe1], a
ld [hStartTileID], a
coord hl, 1, 5
predef_jump CopyUncompressedPicToTilemap
@ -6862,7 +6862,7 @@ InitBattleCommon: ; 3ef3d (f:6f3d)
call _LoadTrainerPic
xor a
ld [wEnemyMonSpecies2], a
ld [$ffe1], a
ld [hStartTileID], a
dec a
ld [wAICount], a
coord hl, 12, 0
@ -6918,7 +6918,7 @@ InitWildBattle: ; 3ef8b (f:6f8b)
.spriteLoaded
xor a
ld [W_TRAINERCLASS], a
ld [$ffe1], a
ld [hStartTileID], a
coord hl, 12, 0
predef CopyUncompressedPicToTilemap
@ -6995,38 +6995,38 @@ AnimateSendingOutMon: ; 3f073 (f:7073)
ld h, a
ld a, [wPredefRegisters + 1]
ld l, a
ld a, [$ffe1]
ld [H_DOWNARROWBLINKCNT1], a
ld a, [hStartTileID]
ld [hBaseTileID], a
ld b, $4c
ld a, [W_ISINBATTLE]
and a
jr z, .asm_3f0bc
jr z, .notInBattle
add b
ld [hl], a
call Delay3
ld bc, -41
ld bc, -(SCREEN_WIDTH * 2 + 1)
add hl, bc
ld a, $1
ld a, 1
ld [wDownscaledMonSize], a
ld bc, $303
lb bc, 3, 3
predef CopyDownscaledMonTiles
ld c, 4
call DelayFrames
ld bc, -41
ld bc, -(SCREEN_WIDTH * 2 + 1)
add hl, bc
xor a
ld [wDownscaledMonSize], a
ld bc, $505
lb bc, 5, 5
predef CopyDownscaledMonTiles
ld c, 5
call DelayFrames
ld bc, -41
jr .asm_3f0bf
.asm_3f0bc
ld bc, -123
.asm_3f0bf
ld bc, -(SCREEN_WIDTH * 2 + 1)
jr .next
.notInBattle
ld bc, -(SCREEN_WIDTH * 6 + 3)
.next
add hl, bc
ld a, [H_DOWNARROWBLINKCNT1]
ld a, [hBaseTileID]
add $31
jr CopyUncompressedPicToHL
@ -7035,52 +7035,52 @@ CopyUncompressedPicToTilemap: ; 3f0c6 (f:70c6)
ld h, a
ld a, [wPredefRegisters + 1]
ld l, a
ld a, [$ffe1]
ld a, [hStartTileID]
CopyUncompressedPicToHL: ; 3f0d0 (f:70d0)
ld bc, $707
lb bc, 7, 7
ld de, SCREEN_WIDTH
push af
ld a, [W_SPRITEFLIPPED]
and a
jr nz, .asm_3f0ed
jr nz, .flipped
pop af
.asm_3f0de
.loop
push bc
push hl
.asm_3f0e0
.innerLoop
ld [hl], a
add hl, de
inc a
dec c
jr nz, .asm_3f0e0
jr nz, .innerLoop
pop hl
inc hl
pop bc
dec b
jr nz, .asm_3f0de
jr nz, .loop
ret
.asm_3f0ed
.flipped
push bc
ld b, $0
ld b, 0
dec c
add hl, bc
pop bc
pop af
.asm_3f0f4
.flippedLoop
push bc
push hl
.asm_3f0f6
.flippedInnerLoop
ld [hl], a
add hl, de
inc a
dec c
jr nz, .asm_3f0f6
jr nz, .flippedInnerLoop
pop hl
dec hl
pop bc
dec b
jr nz, .asm_3f0f4
jr nz, .flippedLoop
ret
LoadMonBackPic: ; 3f103 (f:7103)

View file

@ -18,11 +18,11 @@ TryDoWildEncounter: ; 13870 (4:7870)
jr z, .CantEncounter
ld a, [wRepelRemainingSteps]
and a
jr z, .asm_1389e
jr z, .next
dec a
jr z, .lastRepelStep
ld [wRepelRemainingSteps], a
.asm_1389e
.next
; 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?
coord hl, 9, 9
@ -71,7 +71,7 @@ TryDoWildEncounter: ; 13870 (4:7870)
; 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.
.gotWildEncounterType
ld b, $0
ld b, 0
add hl, bc
ld a, [hli]
ld [W_CURENEMYLVL], a
@ -89,8 +89,8 @@ TryDoWildEncounter: ; 13870 (4:7870)
jr .willEncounter
.lastRepelStep
ld [wRepelRemainingSteps], a
ld a, 210
ld [H_DOWNARROWBLINKCNT2], a
ld a, TEXT_REPEL_WORE_OFF
ld [hSpriteIndexOrTextID], a
call EnableAutoTextBoxDrawing
call DisplayTextID
.CantEncounter2