Skeetendo

’Cause all games were better on the GBC

You are not logged in.

#1 2017-07-22 07:00:18

ShockSlayer
Member
Registered: 2017-06-17
Post 9/13

Displaying DVs directly on the stats screen?

Has anyone ever actually done this specifically? I think I've seen at least one discussion about it but I can't seem to find it.

I've currently got the fourth stats page/characteristics code ported from TPP Anniversary Crystal, but I can't make heads or tails of how it works yet, so I'm not sure how to get it to just spit out the raw information into text.

Offline

#2 2017-07-22 19:29:58

ShockSlayer
Member
Registered: 2017-06-17
Post 10/13

Re: Displaying DVs directly on the stats screen?

I had a good friend help me out. It took quite a bit this morning, but the result was worth it. It even calculates the HP value!

r5I0CVz.png

This is just the relevant code; it doesn't have anything other than the DV text. On the plus side, you can drop this into any vanilla project fairly easily, edit the coords and call it on any of the stat screens. (pls leave credits in thank)
My personal taste was to display the numbers vertically, but it could easily be done as just two lines horizontally.

Anyways, it might not be the most optimal or efficient code, but I'm just happy it works.

; by Aurelio Mannara - BitBuilt 2017
; ShockSlayer helped ( °v°)
TN_PrintDVs:
    ; print labels

    hlcoord 15, 9
    ld [Buffer2], a
    ld de, .label_DV ; DV
    call PlaceString
    
    hlcoord 14, 10
    ld [Buffer2], a
    ld de, .label_HP ; hp
    call PlaceString
    
    hlcoord 14, 11
    ld [Buffer2], a
    ld de, .label_ATK ; atk
    call PlaceString
    
    hlcoord 14, 12
    ld [Buffer2], a
    ld de, .label_DEF ; def
    call PlaceString
    
    hlcoord 14, 13
    ld [Buffer2], a
    ld de, .label_SPE ; spe
    call PlaceString
    
    hlcoord 14, 14
    ld [Buffer2], a
    ld de, .label_SPC ; spc
    call PlaceString
    
    ; print 16 bit value of DVs

    ld de, TempMonDVs
    ld a, [de]
    ld b, a
    inc de
    ld a, [de]
    ld c, a
    push bc


    ld de, TempMonDVs
    ld a, 0
    ld [de], a
    inc de
    pop bc
    ld a, b
    push bc
    and $f0
    swap a
    ld [de], a
    hlcoord 18, 11 ; atk disp coords
    lb bc, PRINTNUM_LEADINGZEROS | 2, 2
    ld de, TempMonDVs
    call PrintNum

    ld de, TempMonDVs
    ld a, 0
    ld [de], a
    inc de
    pop bc
    ld a, b
    push bc
    and $f
    ld [de], a
    hlcoord 18, 12 ; def disp coords
    lb bc, PRINTNUM_LEADINGZEROS | 2, 2
    ld de, TempMonDVs
    call PrintNum

    ld de, TempMonDVs
    ld a, 0
    ld [de], a
    inc de
    pop bc
    ld a, c
    push bc
    and $f0
    swap a
    ld [de], a
    hlcoord 18, 13 ; spe disp coords
    lb bc, PRINTNUM_LEADINGZEROS | 2, 2
    ld de, TempMonDVs
    call PrintNum

    ld de, TempMonDVs
    ld a, 0
    ld [de], a
    inc de
    pop bc
    ld a, c
    push bc
    and $f
    ld [de], a
    hlcoord 18, 14 ; spc disp coords
    lb bc, PRINTNUM_LEADINGZEROS | 2, 2
    ld de, TempMonDVs
    call PrintNum

    ld de, TempMonDVs
    ld a, 0
    ld [de], a
    inc de
    pop bc
    bit 4, b
    jr z, .noAttackHP
    set 3, a
.noAttackHP
    bit 0, b
    jr z, .noDefenseHP
    set 2, a
.noDefenseHP
    bit 4, c
    jr z, .noSpeedHP
    set 1, a
.noSpeedHP
    bit 0, c
    jr z, .noSpecialHP
    set 0, a
.noSpecialHP
    push bc
    ld [de], a
    hlcoord 18, 10 ; hp disp coords
    lb bc, PRINTNUM_LEADINGZEROS | 2, 2
    ld de, TempMonDVs
    call PrintNum

    ld de, TempMonDVs
    pop bc
    ld a, b
    ld [de], a
    inc de
    ld a, c
    ld [de], a

.label_DV
    db "DVs:@"
.label_HP
    db "HP@"
.label_ATK
    db "ATK@"
.label_DEF
    db "DEF@"
.label_SPE
    db "SPE@"
.label_SPC
    db "SPC@"
    
    ret

Offline

Board footer

Powered by FluxBB