[RESOLVED] Hide Draw Sprite (Sprite HUD LR Plateform)

Stachan

New member
Hi everybody!

I just want to hide the Draw Sprites that replaces HUD from a test plateform game when I'm on my Start Screen.

I tried to modify my doDrawSpriteHud_LRPlateformer to compare GS_MainGame and gameState like this :

Code:
    LDA gameState
    CMP #GS_MainGame
    BEQ +
        DrawSpriteHud #16, #16, #$7f, myLives, #$32, myLives, #%00000000      ;; draws life
        DrawSpriteHud #16, #26, #$22, myAmmo, #$22, myAmmo, #%00000000         ;; draws ammo
    +

But it result "Branch out of range" at line 3...
 

kevin81

Well-known member
Hi Stachan,

The size of the two DrawSpriteHud macros is too big for a branch to skip. If you reverse your logic and use a JMP statement, it should work as intended.

Code:
    LDA gameState
    CMP #GS_MainGame
    BNE +DrawHud
        JMP +DoneHudding

+DrawHud:
    DrawSpriteHud #16, #16, #$7f, myLives, #$32, myLives, #%00000000      ;; draws life
    DrawSpriteHud #16, #26, #$22, myAmmo, #$22, myAmmo, #%00000000         ;; draws ammo

+DoneHudding:
 

Stachan

New member
Oh thank you!

I just modified the code by :

Code:
LDA gameState
CMP #GS_MainGame

BNE +DrawIt
    JMP +DoneHudding
+DrawIt:
    DrawSpriteHud #16, #16, #$7f, myLives, #$32, myLives, #%00000000      ;; draws life
    DrawSpriteHud #16, #26, #$22, myAmmo, #$22, myAmmo, #%00000000         ;; draws ammo

+DoneHudding:

and changed the value of the GS_StartScreen to 1.

DrawHud is a macro so I had an error.

FIXED, THANKS DUDE!! (y)
 

tbizzle

Well-known member
Here is the macro "drawHud:

Code:
MACRO DrawHud
    JSR doDrawHud
    ENDM

How come there is no subroutine asm file for "doDrawHud"? I could really use it , lol.
 
Here is the macro "drawHud:

Code:
MACRO DrawHud
    JSR doDrawHud
    ENDM

How come there is no subroutine asm file for "doDrawHud"? I could really use it , lol.
if you look in the LoadAllSubroutines.asm you'll find this:

doDrawHud:
.include SCR_HANDLE_HUD
RTS
this: "doDrawHud" you see here with the ":" is what it's calling
in which where it's setup is in the file with the:
.include SCR_HANDLE_HUD
etc, etc... you'll understand the rest from there
 
Top Bottom