Update StatusScreen, add *_STATS_BOX constants (#546)

This commit is contained in:
Narishma-gb 2025-12-01 20:46:28 +01:00 committed by GitHub
parent 917a0ebf4d
commit 8bb03542bd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 51 additions and 52 deletions

View File

@ -90,3 +90,8 @@ DEF FIRST_PARTY_MENU_TEXT_ID EQU const_value
const NAME_PLAYER_SCREEN ; 0
const NAME_RIVAL_SCREEN ; 1
const NAME_MON_SCREEN ; 2
; Stats box layout (see engine/pokemon/status_screen.asm)
const_def
const STATUS_SCREEN_STATS_BOX ; 0
const LEVEL_UP_STATS_BOX ; 1

View File

@ -245,7 +245,7 @@ GainExperience:
xor a ; PLAYER_PARTY_DATA
ld [wMonDataLocation], a
call LoadMonData
ld d, $1
ld d, LEVEL_UP_STATS_BOX
callfar PrintStatsBox
call WaitForTextScrollButtonPress
call LoadScreenTilesFromBuffer1

View File

@ -1400,15 +1400,15 @@ ItemUseMedicine:
xor a ; PLAYER_PARTY_DATA
ld [wMonDataLocation], a
call LoadMonData
ld d, $01
callfar PrintStatsBox ; display new stats text box
call WaitForTextScrollButtonPress ; wait for button press
ld d, LEVEL_UP_STATS_BOX
callfar PrintStatsBox
call WaitForTextScrollButtonPress
xor a ; PLAYER_PARTY_DATA
ld [wMonDataLocation], a
predef LearnMoveFromLevelUp ; learn level up move, if any
predef LearnMoveFromLevelUp
xor a
ld [wForceEvolution], a
callfar TryEvolvingMon ; evolve pokemon, if appropriate
callfar TryEvolvingMon
ld a, $01
ld [wUpdateSpritesEnabled], a
pop af
@ -1433,11 +1433,11 @@ INCLUDE "data/battle/stat_names.asm"
ItemUseBait:
ld hl, ThrewBaitText
call PrintText
ld hl, wEnemyMonActualCatchRate ; catch rate
ld hl, wEnemyMonActualCatchRate
srl [hl] ; halve catch rate
ld a, BAIT_ANIM
ld hl, wSafariBaitFactor ; bait factor
ld de, wSafariEscapeFactor ; escape factor
ld hl, wSafariBaitFactor
ld de, wSafariEscapeFactor
jr BaitRockCommon
; for CASCADEBADGE when used from the
@ -1446,7 +1446,7 @@ ItemUseBait:
ItemUseRock:
ld hl, ThrewRockText
call PrintText
ld hl, wEnemyMonActualCatchRate ; catch rate
ld hl, wEnemyMonActualCatchRate
ld a, [hl]
add a ; double catch rate
jr nc, .noCarry
@ -1454,8 +1454,8 @@ ItemUseRock:
.noCarry
ld [hl], a
ld a, ROCK_ANIM
ld hl, wSafariEscapeFactor ; escape factor
ld de, wSafariBaitFactor ; bait factor
ld hl, wSafariEscapeFactor
ld de, wSafariBaitFactor
BaitRockCommon:
ld [wAnimationID], a

View File

@ -61,8 +61,6 @@ DrawHP_:
pop de
ret
; Predef 0x37
StatusScreen:
call LoadMonData
ld a, [wMonDataLocation]
@ -75,7 +73,7 @@ StatusScreen:
ld hl, wLoadedMonHPExp - 1
ld de, wLoadedMonStats
ld b, $1
call CalcStats ; Recalculate stats
call CalcStats
.DontRecalculate
ld hl, wStatusFlags2
set BIT_NO_AUDIO_FADE_OUT, [hl]
@ -117,8 +115,8 @@ StatusScreen:
lb bc, 8, 6
call DrawLineBox ; Draws the box around types, ID No. and OT
hlcoord 10, 9
ld de, Type1Text
call PlaceString ; "TYPE1/"
ld de, TypesIDNoOTText
call PlaceString
hlcoord 11, 3
predef DrawHP
ld hl, wStatusScreenHPBarColor
@ -137,7 +135,7 @@ StatusScreen:
ld de, StatusText
call PlaceString ; "STATUS/"
hlcoord 14, 2
call PrintLevel ; Pokémon level
call PrintLevel
ld a, [wMonHIndex]
ld [wPokedexNum], a
ld [wCurSpecies], a
@ -164,7 +162,7 @@ StatusScreen:
ld de, wLoadedMonOTID
lb bc, LEADING_ZEROES | 2, 5
call PrintNumber ; ID Number
ld d, $0
ld d, STATUS_SCREEN_STATS_BOX
call PrintStatsBox
call Delay3
call GBPalNormal
@ -204,20 +202,11 @@ NamePointers2:
dw wBoxMonNicks
dw wDayCareMonName
Type1Text:
TypesIDNoOTText:
db "TYPE1/"
next ""
; fallthrough
Type2Text:
db "TYPE2/"
next ""
; fallthrough
IDNoText:
db "<ID>№/"
next ""
; fallthrough
OTText:
db "OT/"
next "TYPE2/"
next "<ID>№/"
next "OT/"
next "@"
StatusText:
@ -248,40 +237,42 @@ PTile: INCBIN "gfx/font/P.1bpp"
PrintStatsBox:
ld a, d
and a ; a is 0 from the status screen
jr nz, .DifferentBox
ASSERT STATUS_SCREEN_STATS_BOX == 0
and a
jr nz, .LevelUpStatsBox ; battle or Rare Candy
hlcoord 0, 8
ld b, 8
ld c, 8
call TextBoxBorder ; Draws the box
hlcoord 1, 9 ; Start printing stats from here
ld bc, $19 ; Number offset
call TextBoxBorder
hlcoord 1, 9
ld bc, SCREEN_WIDTH + 5 ; one row down and 5 columns right
jr .PrintStats
.DifferentBox
.LevelUpStatsBox
hlcoord 9, 2
ld b, 8
ld c, 9
call TextBoxBorder
hlcoord 11, 3
ld bc, $18
ld bc, SCREEN_WIDTH + 4 ; one row down and 4 columns right
.PrintStats
push bc
push hl
ld de, StatsText
ld de, .StatsText
call PlaceString
pop hl
pop bc
add hl, bc
ld de, wLoadedMonAttack
lb bc, 2, 3
call PrintStat
call .PrintStat
ld de, wLoadedMonDefense
call PrintStat
call .PrintStat
ld de, wLoadedMonSpeed
call PrintStat
call .PrintStat
ld de, wLoadedMonSpecial
jp PrintNumber
PrintStat:
.PrintStat:
push hl
call PrintNumber
pop hl
@ -289,7 +280,7 @@ PrintStat:
add hl, de
ret
StatsText:
.StatsText:
db "ATTACK"
next "DEFENSE"
next "SPEED"
@ -323,10 +314,10 @@ StatusScreen2:
call PlaceString ; Print moves
ld a, [wNumMovesMinusOne]
inc a
ld c, a
ld a, $4
ld c, a ; number of known moves
ld a, NUM_MOVES
sub c
ld b, a ; Number of moves ?
ld b, a ; number of blank moves
hlcoord 11, 10
ld de, SCREEN_WIDTH * 2
ld a, '<BOLD_P>'
@ -386,7 +377,7 @@ StatusScreen2:
pop bc
inc b
ld a, b
cp $4
cp NUM_MOVES
jr nz, .PrintPP
.PPDone
hlcoord 9, 3
@ -415,8 +406,11 @@ StatusScreen2:
hlcoord 7, 6
lb bc, 3, 7
call PrintNumber ; exp needed to level up
; unneeded, this clears the diacritic characters in JPN versions
hlcoord 9, 0
call StatusScreen_ClearName
hlcoord 9, 1
call StatusScreen_ClearName
ld a, [wMonHIndex]
@ -468,7 +462,7 @@ StatusScreenExpText:
next "LEVEL UP@"
StatusScreen_ClearName:
ld bc, 10
ld bc, NAME_LENGTH - 1
ld a, ' '
jp FillMemory

View File

@ -188,9 +188,9 @@ InterlaceMergeSpriteBuffers::
or c
jr nz, .swapLoop
.notFlipped
pop hl
pop hl ; hl = output address
ld de, sSpriteBuffer1
ld c, (2 * SPRITEBUFFERSIZE) / TILE_SIZE ; $31, number of 16 byte chunks to be copied
ld c, PIC_SIZE ; tiles
ldh a, [hLoadedROMBank]
ld b, a
jp CopyVideoData