Fix HP display issues on DV/Stat Exp viewer

Old bug that jojobear13 fixed in February. Required a few tweaks here and there...
This commit is contained in:
Llinos Evans 2023-09-02 11:07:32 +01:00
parent 138bfd7042
commit 6da8a703ab
2 changed files with 76 additions and 52 deletions

View file

@ -248,13 +248,13 @@ and more!
Known Bugs
====
Comprehensive list can be found on Discord.
- Only portions of spinner tiles animate.
- Occasionally, menu text sets itself to scroll.
- The lone Rocket in Viridian Gym's basement needs to be directly spoken to to be battled.
- Pokedex does not load a full dex properly due to a soft limit of 248.
- The Tradeback Tutor doesn't work properly with Rhydon for reasons likely related to its index number of 1.
- The Vermilion Passes are very unstable (Faraway warps are weird unless you battle, Citrine outright crashes).
- HP DV does not appear to display correctly in the viewer.
- Silph Co.'s warps are mismatched following a restructuring in maps, one on Floor 5 leads to a Glitch City.
- Fake Tears and Nasty Plot don't quite look right when done from the opponent's side.

View file

@ -1,3 +1,8 @@
; wUnusedD726 = wDVCalcVar
; wUnusedD722 = wDVCalcVar2
; hFlags_0xFFF6 = hUILayoutFlags
; hTilesetType = hTilesetAnimations
DrawHP:
; Draws the HP bar in the stats screen
call GetPredefRegisters
@ -33,7 +38,6 @@ DrawHP_:
ld a, $6
ld d, a
ld c, a
; shin pokered status screen func
.drawHPBarAndPrintFraction
pop hl
push de
@ -41,7 +45,7 @@ DrawHP_:
push hl
call DrawHPBar
pop hl
ld a, [hUILayoutFlags] ; wass hFlags_0xFFF6, translated into modern pokered-ese it's this
ld a, [hUILayoutFlags]
bit 0, a
jr z, .printFractionBelowBar
ld bc, $9 ; right of bar
@ -50,24 +54,6 @@ DrawHP_:
ld bc, SCREEN_WIDTH + 1 ; below bar
.printFraction
add hl, bc
;joenote - print stat exp if select is held
;parse dv stats here so they can be grabbed later
call DVParse
call Joypad
ld a, [hJoyHeld]
bit 2, a
jr z, .checkstart
ld de, wLoadedMonHPExp
lb bc, 2, 5
jr .printnum
.checkstart ;print DVs if start is held
bit 3, a
jr z, .doregular
ld de, wDVCalcVar1
lb bc, 1, 2
jr .printnum
.doregular
ld de, wLoadedMonHP
lb bc, 2, 3
call PrintNumber
@ -75,8 +61,6 @@ DrawHP_:
ld [hli], a
ld de, wLoadedMonMaxHP
lb bc, 2, 3
.printnum
call PrintNumber
pop hl
pop de
@ -101,32 +85,32 @@ StatusScreen:
ld hl, wd72c
set 1, [hl]
ld a, $33
ldh [rNR50], a ; Reduce the volume
ld [rNR50], a ; Reduce the volume
call GBPalWhiteOutWithDelay3
call ClearScreen
call UpdateSprites
call LoadHpBarAndStatusTilePatterns
ld de, BattleHudTiles1 ; source
ld hl, vChars2 tile $6d ; dest
lb bc, BANK(BattleHudTiles1), 3
ld hl, vChars2 + $6d0 ; dest
lb bc, BANK(BattleHudTiles1), $03
call CopyVideoDataDouble ; ·│ :L and halfarrow line end
ld de, BattleHudTiles2
ld hl, vChars2 tile $78
lb bc, BANK(BattleHudTiles2), 1
ld hl, vChars2 + $780
lb bc, BANK(BattleHudTiles2), $01
call CopyVideoDataDouble ; │
ld de, BattleHudTiles3
ld hl, vChars2 tile $76
lb bc, BANK(BattleHudTiles3), 2
call CopyVideoDataDouble ; ─
ld hl, vChars2 + $760
lb bc, BANK(BattleHudTiles3), $02
call CopyVideoDataDouble ; ─
;ld de, PTile
;ld hl, vChars2 tile $72
;lb bc, BANK(PTile), 1
;call CopyVideoDataDouble ; bold P (for PP) - no longer needed
ldh a, [hTileAnimations]
;ld hl, vChars2 + $720
;lb bc, BANK(PTile), (PTileEnd - PTile) / $8
;call CopyVideoDataDouble ; P (for PP), inline
ld a, [hTileAnimations]
push af
xor a
ldh [hTileAnimations], a
hlcoord 19, 1
ld [hTileAnimations], a
coord hl, 19, 1
lb bc, 6, 10
call DrawLineBox ; Draws the box around name, HP and status
ld de, -6
@ -134,54 +118,94 @@ StatusScreen:
ld [hl], "<DOT>"
dec hl
ld [hl], "№"
hlcoord 19, 9
coord hl, 19, 9
lb bc, 8, 6
call DrawLineBox ; Draws the box around types, ID No. and OT
hlcoord 10, 9
coord hl, 10, 9
ld de, Type1Text
call PlaceString ; "TYPE1/"
hlcoord 11, 3
coord hl, 11, 3
predef DrawHP
;joenote - print stat exp if select is held
;parse dv stats here so they can be grabbed later
push de
ld bc, SCREEN_WIDTH + 1
add hl, bc
call DVParse
call Joypad
ld a, [hJoyHeld]
and SELECT | START
jr z, .noblank
push hl
ld a, " "
ld [hli], a
ld [hli], a
ld [hli], a
ld [hli], a
ld [hli], a
ld [hli], a
ld [hli], a
pop hl
.noblank
ld a, [hJoyHeld]
bit BIT_SELECT, a
jr z, .checkstart
ld de, wLoadedMonHPExp
lb bc, 2, 5
jr .printnum
.checkstart ;print DVs if start is held
bit BIT_START, a
jr z, .doregular
ld de, wDVCalcVar2
lb bc, 1, 2
.printnum
call PrintNumber
.doregular
pop de
ld hl, wStatusScreenHPBarColor
call GetHealthBarColor
ld b, SET_PAL_STATUS_SCREEN
call RunPaletteCommand
hlcoord 16, 6
coord hl, 16, 6
ld de, wLoadedMonStatus
call PrintStatusCondition
jr nz, .StatusWritten
hlcoord 16, 6
coord hl, 16, 6
ld de, OKText
call PlaceString ; "OK"
.StatusWritten
hlcoord 9, 6
coord hl, 9, 6
ld de, StatusText
call PlaceString ; "STATUS/"
hlcoord 14, 2
coord hl, 14, 2
call PrintLevel ; Pokémon level
ld a, [wMonHIndex]
ld [wd11e], a
ld [wd0b5], a
predef IndexToPokedex
hlcoord 3, 7
coord hl, 3, 7
ld de, wd11e
lb bc, LEADING_ZEROES | 1, 3
call PrintNumber ; Pokémon no.
hlcoord 11, 10
coord hl, 11, 10
predef PrintMonType
ld hl, NamePointers2
call .GetStringPointer
ld d, h
ld e, l
hlcoord 9, 1
coord hl, 9, 1
call PlaceString ; Pokémon name
ld hl, OTPointers
call .GetStringPointer
ld d, h
ld e, l
hlcoord 12, 16
coord hl, 12, 16
call PlaceString ; OT
hlcoord 12, 14
coord hl, 12, 14
ld de, wLoadedMonOTID
lb bc, LEADING_ZEROES | 2, 5
call PrintNumber ; ID Number
@ -189,13 +213,13 @@ StatusScreen:
call PrintStatsBox
call Delay3
call GBPalNormal
hlcoord 1, 0
coord hl, 1, 0
call LoadFlippedFrontSpriteByMonIndex ; draw Pokémon picture
ld a, [wcf91]
call PlayCry ; play Pokémon cry
call WaitForTextScrollButtonPress ; wait for button
pop af
ldh [hTileAnimations], a
ld [hTileAnimations], a
ret
.GetStringPointer