Making sprite cutscenes (4.5.6)

Bucket Mouse

Active member
Currently trying (again) to make all sprites on screen freeze in place (instead of disappear) every time a text box appears. If I can't do this, I can't make sprite cutscenes. It stands to reason you need to see your actors!

I've found the point where it happens: at the beginning of doDrawBox.asm. The script checks for the box flag trigger and if it's found, it triggers the sprite shut-off switch:


Code:
checkQueueFlags:
    LDA queueFlags
    AND #%10000000
    BEQ skipSettingUpBox

    LDA gameStatusByte
    ORA #%00000001 ;;; this will skip object handling.
    STA gameStatusByte


doHandleObjects starts out looking for that flag and it terminates the entire script with an RTS if it's found:


Code:
doHandleObjects:
    LDA gameStatusByte
    AND #%00000001 ;;; this will skip object handling.
    BEQ dontSkipObjectHandling
        RTS
dontSkipObjectHandling:


The next step would be to replace it with something that freezes the sprites, but I have no idea what that is. There is a "StopMoving" macro, so I tried that:


Code:
    LDX player1_object
    STX temp ;; assumes the object that we want is in x.
    StopMoving temp, #$FF
    
    LDX Monster1ID
    STX temp ;; assumes the object that we want is in x.
    StopMoving temp, #$FF
    
    LDX Monster2ID
    STX temp ;; assumes the object that we want is in x.
    StopMoving temp, #$FF
    
    LDX Monster3ID
    STX temp ;; assumes the object that we want is in x.
    StopMoving temp, #$FF
    
    LDX Monster4ID
    STX temp ;; assumes the object that we want is in x.
    StopMoving temp, #$FF

Nope, nothing happens. What am I missing? What other ways are there to stop all the sprites onscreen?
 

Bucket Mouse

Active member
Found the solution! It was within doHandleObjects itself...there's a loop routine that checks every byte of a sprite's object status. I repurposed it to forcibly alter the status of all sprites during the text routine.

So you make a variable called spritePause, and then you comment out the gameStatusByte routine at the beginning of doHandleObjects, and then add the following, like so:

Code:
doHandleObjects:

;	LDA gameStatusByte
;	AND #%00000001 ;;; this will skip object handling.
;	BEQ dontSkipObjectHandling
;		RTS

;;;; THE ABOVE HAS BEEN COMMENTED OUT TO ADD A SCRIPT FOR PAUSING VISIBLE SPRITES DURING TEXT
	LDA #$01
	CMP spritePause
	BNE dontSkipObjectHandling
	
	LDX #$00
	shutoffloop:
	LDA Object_status,x
	AND #%11010011
	STA Object_status,x
	INX
	CPX #TOTAL_MAX_OBJECTS
	BEQ dontSkipObjectHandling
	JMP shutoffloop
	
	;;;; END OF ADDED MATERIAL

Now open doDrawBox, and put this at the top:

Code:
doDrawBox:
	LDA #$01
	STA spritePause

Then scroll to the middle and locate the part that has the "COMPLETELY DONE WITH BOX" comment. Below STA queueFlags, add this:

Code:
	;;;;;;;;;; ADDED MATERIAL FOR TEXT BOX SPRITE PAUSING
						
	LDA #$00
	STA spritePause
	
	LDX #$00
	shutoffloop2:
	LDA Object_status,x
	ORA #%00101100
	STA Object_status,x
	INX
	CPX #TOTAL_MAX_OBJECTS
	BEQ doneWithThat
	JMP shutoffloop2
	doneWithThat:
	
	;;;;;;;;;;; END OF TEXT BOX SPRITE PAUSE MATERIAL

Now your sprites won't disappear during text boxes AND they'll stop moving, including your player sprite. Their animations will still be active, though. Anybody got a solution for that one?

There's also the fact that sometimes you actually WILL want the sprites to disappear, like say when you open an inventory window in the middle of the screen. In this case you could attach the spritePause variable to a screen flag instead, and only use it when you want to.
 

AllDarnDavey

Active member
Their animations will still be active, though. Anybody got a solution for that one?

I would think you would need to find where animation speed is set, and add a gamStatusByte byte check to it as well. Then have it set animation speed to zero if that byte is turned on. I don't have a project currently in a state to do any testing on this myself. But I think maybe look for ObjectAnimationSpeedTable probably somewhere in one of the doDrawSprites.asm subroutine.
 

Bucket Mouse

Active member
mouse spirit said:
Very cool. Glad you figured it out. Can you just say stop animation or animation speed 0 if text is up?
The first thing I tried worked (for once)....you add this to the top of doUpdateSpriteTimer to stop animations:


Code:
		LDA #$01
	CMP spritePause
	BNE +
	JMP animationTimerNotFinished
	+
 
Top Bottom