chronicleroflegends
Member
I'm trying to implement a feature that has gotten a bit outside of my understanding.
In older text-heavy NES games, when you talked to an NPC a lot of times they wouldn't just say 1 thing. Their dialogue would change.
I wanted to try and replicate that in this way:
You talk to an NPC, and when they get done talking they trigger the screen they are on. If you talk to them again, it uses the text group from the triggered screen instead.
This would give the illusion that their dialogue changes.
Unfortunately, the way nesmaker is set up by default is that triggering a screen does not immediately cause changes. The screen must be reloaded first by walking to a
different screen and walking back. I am trying to slightly change this.
I would like the text group to be reloaded when the screen is triggered, so it can point to the correct text group.
Now for my experimentation:
I discovered this code in checkforupdatescreendata.asm:
Inserting this code at the end of the code for end text trigger screen will immediately change the text group to text group 0.
I discovered that you can manually change the text group with just this code:
So, the code above it determines which text group to load.
Y appears to be constant:
SCREEN_DATA_OFFSET + 22
So the only variable that can affect which group to load is collisionPointer.
This is where I am stuck, I am trying to figure out how to get the correct value into collisionPointer to point it at the triggered version of the screen.
This is what I have so far, but I just get a freeze immediately upon the text finishing:
(This subroutine is stored in the static bank and called after triggering the screen from text)
(Based on earlier code in checkforupdatescreendata.asm)
In older text-heavy NES games, when you talked to an NPC a lot of times they wouldn't just say 1 thing. Their dialogue would change.
I wanted to try and replicate that in this way:
You talk to an NPC, and when they get done talking they trigger the screen they are on. If you talk to them again, it uses the text group from the triggered screen instead.
This would give the illusion that their dialogue changes.
Unfortunately, the way nesmaker is set up by default is that triggering a screen does not immediately cause changes. The screen must be reloaded first by walking to a
different screen and walking back. I am trying to slightly change this.
I would like the text group to be reloaded when the screen is triggered, so it can point to the correct text group.
Now for my experimentation:
I discovered this code in checkforupdatescreendata.asm:
Code:
;; GET TEXT STRINGS FOR THIS NEW SCREEN
LDA #SCREEN_DATA_OFFSET
CLC
ADC #$22
TAY
LDA (collisionPointer),y
STA stringGroupPointer
;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;; Put text into screenText variables
JSR getTextForScreen
Inserting this code at the end of the code for end text trigger screen will immediately change the text group to text group 0.
I discovered that you can manually change the text group with just this code:
Code:
;; replace #$05 with whichever group you want to load
LDA #$05
STA stringGroupPointer
JSR getTextForScreen
So, the code above it determines which text group to load.
Y appears to be constant:
SCREEN_DATA_OFFSET + 22
So the only variable that can affect which group to load is collisionPointer.
This is where I am stuck, I am trying to figure out how to get the correct value into collisionPointer to point it at the triggered version of the screen.
This is what I have so far, but I just get a freeze immediately upon the text finishing:
(This subroutine is stored in the static bank and called after triggering the screen from text)
(Based on earlier code in checkforupdatescreendata.asm)
Code:
userSubr_UpdateScreenText:
;;Force Load a triggered screens new text data
LDA currentBank
STA prevBank
LDY #$16 ;; screen bank
JSR bankswitchY
LDX player1_object
LDY Object_scroll,x
LDA update_screen_details
CMP #$01
;;; if it is zero, it is a special screen.
;;; one is map 1
;;; two is map 2
BNE +
LDA CollisionTables_Map1_Lo,y
STA collisionPointer
LDA CollisionTables_Map1_Hi,y
STA collisionPointer+1
JMP ++
+
LDA CollisionTables_Map2_Lo,y
STA collisionPointer
LDA CollisionTables_Map2_Hi,y
STA collisionPointer+1
++
LDY screenBank
JSR bankswitchY
LDA #SCREEN_DATA_OFFSET
CLC
ADC #$22
TAY
LDA (collisionPointer),y
STA stringGroupPointer
;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;; Put text into screenText variables
JSR getTextForScreen
LDY prevBank
JSR bankswitchY
RTS