Hey Deadbear!
I think you're right and the easiest way to fix this bug is to disable player input while the text is drawing. Here are the steps that have helped me solve this issue:
1. We need to (A) determine the place BEFORE the textbox is drawn and (B) the place AFTER the text box (and all of the text inside) is drawn.
A is easy, just go inside the NPC text trigger script or auto tile script and find the line
Code:
DrawBox #BOX_1_ORIGIN_X, #BOX_1_ORIGIN_Y, #BOX_1_WIDTH , #BOX_1_HEIGHT, #TEXT_NPC, screenText
This line starts drawing the textbox.
B took me some time to find but I finally found where the text finishes in the script "doDrawText.asm" at around line 211 just under this piece of code:
Code:
+notDrawingVariableNumber
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+continueRoutine
LDA temp
CMP #$FF
BNE notEndOfText
endOfText:
;;;Right here!
PlaySound #sfx_powerup ;; this soundfx should go off as soon as the text has finished drawing!
I used sound effects to help me step through the code haha
But what if you had text that spawned multiple pages? (For when you add a ">" sign to your text boxes). Well that is finished somewhere else in the "doDrawText.asm" script at around line 293 under this piece of code:
Code:
PLA
TAY
LDA #$00
STA textHandler
JMP endOfText
notEndTrigger:
CMP #_MORE
BNE notMoreText
;;;Right here!
PlaySound #sfx_powerup ;; this soundfx should go off as soon as the text has finished drawing before the ">" place !
2. Using this information, you will need to figure out a way to stop player input between the line "drawBox" and where the text finished drawing in step B.
Here is what I did:
A. I created a new user variable and called it "is_drawing_box" and set it to 0. Then right before the "drawBox" line I set that variable to 1.
B. In the "doDrawText.asm" script at line ~211 I set the "is_drawing_box" back to 0
C. Then in ALL my player input scripts I added this check at the top:
Code:
LDA is_drawing_box ;; Check if box is still drawing
CMP #$00
BEQ +do_player_input ;;no longer drawing so we can do player input again!
JMP skip_player_input ;; is_drawing_box is still a 1 so that must mean the text is still drawing. Better skip player input to avoid freezing the game!
+do_player_input
;; player input stuff
skip_player_input
RTS
This is what worked for me but I'm sure this can be more streamlined!
Please let me know if you have any questions and if any of this helped!