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 Known Bugs
==== ====
Comprehensive list can be found on Discord.
- Only portions of spinner tiles animate. - Only portions of spinner tiles animate.
- Occasionally, menu text sets itself to scroll. - Occasionally, menu text sets itself to scroll.
- The lone Rocket in Viridian Gym's basement needs to be directly spoken to to be battled. - 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. - 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 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). - 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. - 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. - 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: DrawHP:
; Draws the HP bar in the stats screen ; Draws the HP bar in the stats screen
call GetPredefRegisters call GetPredefRegisters
@ -33,7 +38,6 @@ DrawHP_:
ld a, $6 ld a, $6
ld d, a ld d, a
ld c, a ld c, a
; shin pokered status screen func
.drawHPBarAndPrintFraction .drawHPBarAndPrintFraction
pop hl pop hl
push de push de
@ -41,7 +45,7 @@ DrawHP_:
push hl push hl
call DrawHPBar call DrawHPBar
pop hl pop hl
ld a, [hUILayoutFlags] ; wass hFlags_0xFFF6, translated into modern pokered-ese it's this ld a, [hUILayoutFlags]
bit 0, a bit 0, a
jr z, .printFractionBelowBar jr z, .printFractionBelowBar
ld bc, $9 ; right of bar ld bc, $9 ; right of bar
@ -50,24 +54,6 @@ DrawHP_:
ld bc, SCREEN_WIDTH + 1 ; below bar ld bc, SCREEN_WIDTH + 1 ; below bar
.printFraction .printFraction
add hl, bc 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 ld de, wLoadedMonHP
lb bc, 2, 3 lb bc, 2, 3
call PrintNumber call PrintNumber
@ -75,8 +61,6 @@ DrawHP_:
ld [hli], a ld [hli], a
ld de, wLoadedMonMaxHP ld de, wLoadedMonMaxHP
lb bc, 2, 3 lb bc, 2, 3
.printnum
call PrintNumber call PrintNumber
pop hl pop hl
pop de pop de
@ -101,32 +85,32 @@ StatusScreen:
ld hl, wd72c ld hl, wd72c
set 1, [hl] set 1, [hl]
ld a, $33 ld a, $33
ldh [rNR50], a ; Reduce the volume ld [rNR50], a ; Reduce the volume
call GBPalWhiteOutWithDelay3 call GBPalWhiteOutWithDelay3
call ClearScreen call ClearScreen
call UpdateSprites call UpdateSprites
call LoadHpBarAndStatusTilePatterns call LoadHpBarAndStatusTilePatterns
ld de, BattleHudTiles1 ; source ld de, BattleHudTiles1 ; source
ld hl, vChars2 tile $6d ; dest ld hl, vChars2 + $6d0 ; dest
lb bc, BANK(BattleHudTiles1), 3 lb bc, BANK(BattleHudTiles1), $03
call CopyVideoDataDouble ; ·│ :L and halfarrow line end call CopyVideoDataDouble ; ·│ :L and halfarrow line end
ld de, BattleHudTiles2 ld de, BattleHudTiles2
ld hl, vChars2 tile $78 ld hl, vChars2 + $780
lb bc, BANK(BattleHudTiles2), 1 lb bc, BANK(BattleHudTiles2), $01
call CopyVideoDataDouble ; │ call CopyVideoDataDouble ; │
ld de, BattleHudTiles3 ld de, BattleHudTiles3
ld hl, vChars2 tile $76 ld hl, vChars2 + $760
lb bc, BANK(BattleHudTiles3), 2 lb bc, BANK(BattleHudTiles3), $02
call CopyVideoDataDouble ; ─┘ call CopyVideoDataDouble ; ─┘
;ld de, PTile ;ld de, PTile
;ld hl, vChars2 tile $72 ;ld hl, vChars2 + $720
;lb bc, BANK(PTile), 1 ;lb bc, BANK(PTile), (PTileEnd - PTile) / $8
;call CopyVideoDataDouble ; bold P (for PP) - no longer needed ;call CopyVideoDataDouble ; P (for PP), inline
ldh a, [hTileAnimations] ld a, [hTileAnimations]
push af push af
xor a xor a
ldh [hTileAnimations], a ld [hTileAnimations], a
hlcoord 19, 1 coord hl, 19, 1
lb bc, 6, 10 lb bc, 6, 10
call DrawLineBox ; Draws the box around name, HP and status call DrawLineBox ; Draws the box around name, HP and status
ld de, -6 ld de, -6
@ -134,54 +118,94 @@ StatusScreen:
ld [hl], "<DOT>" ld [hl], "<DOT>"
dec hl dec hl
ld [hl], "№" ld [hl], "№"
hlcoord 19, 9 coord hl, 19, 9
lb bc, 8, 6 lb bc, 8, 6
call DrawLineBox ; Draws the box around types, ID No. and OT call DrawLineBox ; Draws the box around types, ID No. and OT
hlcoord 10, 9 coord hl, 10, 9
ld de, Type1Text ld de, Type1Text
call PlaceString ; "TYPE1/" call PlaceString ; "TYPE1/"
hlcoord 11, 3 coord hl, 11, 3
predef DrawHP 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 ld hl, wStatusScreenHPBarColor
call GetHealthBarColor call GetHealthBarColor
ld b, SET_PAL_STATUS_SCREEN ld b, SET_PAL_STATUS_SCREEN
call RunPaletteCommand call RunPaletteCommand
hlcoord 16, 6 coord hl, 16, 6
ld de, wLoadedMonStatus ld de, wLoadedMonStatus
call PrintStatusCondition call PrintStatusCondition
jr nz, .StatusWritten jr nz, .StatusWritten
hlcoord 16, 6 coord hl, 16, 6
ld de, OKText ld de, OKText
call PlaceString ; "OK" call PlaceString ; "OK"
.StatusWritten .StatusWritten
hlcoord 9, 6 coord hl, 9, 6
ld de, StatusText ld de, StatusText
call PlaceString ; "STATUS/" call PlaceString ; "STATUS/"
hlcoord 14, 2 coord hl, 14, 2
call PrintLevel ; Pokémon level call PrintLevel ; Pokémon level
ld a, [wMonHIndex] ld a, [wMonHIndex]
ld [wd11e], a ld [wd11e], a
ld [wd0b5], a ld [wd0b5], a
predef IndexToPokedex predef IndexToPokedex
hlcoord 3, 7 coord hl, 3, 7
ld de, wd11e ld de, wd11e
lb bc, LEADING_ZEROES | 1, 3 lb bc, LEADING_ZEROES | 1, 3
call PrintNumber ; Pokémon no. call PrintNumber ; Pokémon no.
hlcoord 11, 10 coord hl, 11, 10
predef PrintMonType predef PrintMonType
ld hl, NamePointers2 ld hl, NamePointers2
call .GetStringPointer call .GetStringPointer
ld d, h ld d, h
ld e, l ld e, l
hlcoord 9, 1 coord hl, 9, 1
call PlaceString ; Pokémon name call PlaceString ; Pokémon name
ld hl, OTPointers ld hl, OTPointers
call .GetStringPointer call .GetStringPointer
ld d, h ld d, h
ld e, l ld e, l
hlcoord 12, 16 coord hl, 12, 16
call PlaceString ; OT call PlaceString ; OT
hlcoord 12, 14 coord hl, 12, 14
ld de, wLoadedMonOTID ld de, wLoadedMonOTID
lb bc, LEADING_ZEROES | 2, 5 lb bc, LEADING_ZEROES | 2, 5
call PrintNumber ; ID Number call PrintNumber ; ID Number
@ -189,13 +213,13 @@ StatusScreen:
call PrintStatsBox call PrintStatsBox
call Delay3 call Delay3
call GBPalNormal call GBPalNormal
hlcoord 1, 0 coord hl, 1, 0
call LoadFlippedFrontSpriteByMonIndex ; draw Pokémon picture call LoadFlippedFrontSpriteByMonIndex ; draw Pokémon picture
ld a, [wcf91] ld a, [wcf91]
call PlayCry ; play Pokémon cry call PlayCry ; play Pokémon cry
call WaitForTextScrollButtonPress ; wait for button call WaitForTextScrollButtonPress ; wait for button
pop af pop af
ldh [hTileAnimations], a ld [hTileAnimations], a
ret ret
.GetStringPointer .GetStringPointer