DV / Stat Exp display in stat menu

Imported from Shin Pokered. Required a little bit of refactoring but all in all very straightforward. I changed the WRAM associations to be easier for me to work with should I ever need to.

I am not a 100% fan of the way this works - requiring hold inputs - but I am also not sure how to make it just be something you can easily input...
This commit is contained in:
Llinos Evans 2023-06-11 07:25:45 +01:00
parent c939b46740
commit 98110eddc8
3 changed files with 121 additions and 10 deletions

View file

@ -33,6 +33,7 @@ DrawHP_:
ld a, $6
ld d, a
ld c, a
; shin pokered status screen func
.drawHPBarAndPrintFraction
pop hl
push de
@ -40,7 +41,7 @@ DrawHP_:
push hl
call DrawHPBar
pop hl
ldh a, [hUILayoutFlags]
ld a, [hUILayoutFlags] ; wass hFlags_0xFFF6, translated into modern pokered-ese it's this
bit 0, a
jr z, .printFractionBelowBar
ld bc, $9 ; right of bar
@ -49,6 +50,24 @@ 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
@ -56,6 +75,8 @@ DrawHP_:
ld [hli], a
ld de, wLoadedMonMaxHP
lb bc, 2, 3
.printnum
call PrintNumber
pop hl
pop de
@ -272,6 +293,36 @@ PrintStatsBox:
pop hl
pop bc
add hl, bc
; New Stat Exp / DVs display functionality, from shin pokered.
;joenote - print stat exp if select is held
call Joypad
ld a, [hJoyHeld]
bit 2, a
jr z, .checkstart
dec l ;shift alignment 2 tiles to the left
dec l
ld de, wLoadedMonAttackExp
lb bc, 2, 5
call PrintStat
ld de, wLoadedMonDefenseExp
call PrintStat
ld de, wLoadedMonSpeedExp
call PrintStat
ld de, wLoadedMonSpecialExp
jp PrintNumber
.checkstart ;joenote - print DVs if start is held
bit 3, a
jr z, .doregular
ld de, wDVCalcVar2
lb bc, 1, 2
call PrintStat
ld de, wDVCalcVar2 + 1
call PrintStat
ld de, wDVCalcVar2 + 2
call PrintStat
ld de, wDVCalcVar2 + 3
jp PrintNumber
.doregular
ld de, wLoadedMonAttack
lb bc, 2, 3
call PrintStat
@ -279,7 +330,7 @@ PrintStatsBox:
call PrintStat
ld de, wLoadedMonSpeed
call PrintStat
ld de, wLoadedMonSpecial
ld de, wLoadedMonSpecial
jp PrintNumber
PrintStat:
push hl
@ -480,3 +531,58 @@ StatusScreen_PrintPP:
dec c
jr nz, StatusScreen_PrintPP
ret
; DV parsing from shin pokered
;joenote - parse DV scores
DVParse:
push hl
push bc
ld hl, wDVCalcVar2
ld b, $00
ld a, [wLoadedMonDVs] ;get attack dv
swap a
and $0F
ld [hl], a
inc hl
and $01
sla a
sla a
sla a
or b
ld b, a
ld a, [wLoadedMonDVs] ;get defense dv
and $0F
ld [hl], a
inc hl
and $01
sla a
sla a
or b
ld b, a
ld a, [wLoadedMonDVs + 1] ;get speed dv
swap a
and $0F
ld [hl], a
inc hl
and $01
sla a
or b
ld b, a
ld a, [wLoadedMonDVs + 1] ;get special dv
and $0F
ld [hl], a
inc hl
and $01
or b
ld b, a
ld [hl], b ;load hp dv
pop bc
pop hl
ret