TextBoxes [4.5.9]

kastar

New member
Hi all,

Looking for clarification on two major items if anyone's solved either/both of them:
- What are the definitive, if any, variables and flags to check to know whether a textbox is on the screen currently? From what I can tell it's spread across a few variables: textQueued, updateScreenData, and gameStatusByte as well as some more localized variables used in doDrawText that seems to be transient.
- All variables needed to fully reset textbox state. The EraseBox macro seems to be leaving some residual states that last until I draw and complete a second textbox.

Appreciate any help!
 

SciNEStist

Well-known member
I cant check right now, so you will have to test this, but I believe with 4.5.X it sets "textHandler" to 1 when drawing, then back to 0 when done.
so testing it would go something like this:

Code:
LDA textHandler
BNE +isDrawingText
    ;put what you want to happen if text is onscreen here
+isDrawingText
    ; put stuff you want to happen if text is onscreen here
 

dale_coop

Moderator
Staff member
I usually set all those variables back to 0:
Code:
        LDA #$00
        STA gameStatusByte 
        STA textHandler
        STA textQueued
        STA counter
        STA updateScreenData
        STA queueFlags
        STA scrollOffsetCounter
...after I close a textbox (or warp after a textbox, ... or load a new screen).
 

kastar

New member
Clearing those vars working in terms of fully clearing textbox state Dale. Thanks as always. Still doing testing on detecting textbox states across the whole lifecycle.
 

kastar

New member
Nevermind, confirmed the state check isn't fully accurate. I'll post an answer once I get this fully figured out.
 

kastar

New member
A rough input script for others to check if a textbox is currently open:

Code:
LDA gameStatusByte
BEQ +
    RTS
+:
LDA textHandler
BEQ +
    RTS
+:
LDA textQueued
BEQ +
    RTS
+:
LDA updateScreenData
BEQ +
    RTS
+:
LDA queueFlags
BEQ +
    RTS
+:
LDA scrollOffsetCounter
BEQ +
    RTS
+:

The "counter" variable contains residual state in the base 4.5.9 engine so it gives out false positives.

Thanks all!
 

TakuikaNinja

Active member
A better approach would be to OR the values together and check the result. If any bits are set, the zero flag will be clear.
Code:
LDA gameStatusByte
ORA textHandler
ORA textQueued
ORA updateScreenData
ORA queueFlags
ORA scrollOffsetCounter
BEQ +
    RTS ; bits set in result, so leave
+:
 
Top Bottom