CutterCross
Active member
I've seen a few people asking for an adaptation of the non-textbox based pause script Mugi / Dale developed for 4.1 and couldn't figure out how to port it themselves, so I went ahead and did that.
This is my quick recreation of the non-textbox pause script for 4.5.6, with PlaySound macros commented out for you to uncomment and use your own SFX labels / indices when you're ready to use them. Just assign it to the button you want to pause with under the game state you want it acting under:
Then, you'll want to open up your doHandleObjects.asm file and replace the first RTS at the end of the doHandleObjects label (line 5) to JMP JustDrawObject (assuming you still want all objects to draw when paused):
And of course, you can go into your Sprite PreDraw script and add in DrawSprite macros to write "PAUSED" or whatever indicator you want, and then add a conditional check for gameStatusByte to control when those sprites draw. You'll also want to put in similar conditional checks for gameStatusByte in any file that involves input or automated actions. So something like...
Seeing as how gameHandler seems to have some free bits that don't control anything, I have no idea why Joe decided to make an extra byte to control 1 thing, but you could probably set things up so you can just use a free bit in gameHandler to do this and get rid of gameStatusByte entirely.
This is my quick recreation of the non-textbox pause script for 4.5.6, with PlaySound macros commented out for you to uncomment and use your own SFX labels / indices when you're ready to use them. Just assign it to the button you want to pause with under the game state you want it acting under:
Code:
LDA gameStatusByte
AND #%00000001
BNE unpausegame
INC gameStatusByte
;; OPTIONAL: Play pause sfx:
;PlaySound #SND_PAUSE
;; OPTIONAL: Make the screen dark - set all 3 emphasis bits of $2001 to 1
LDA soft2001
ORA #%11100000
STA soft2001
RTS
unpausegame:
LDA gameStatusByte
AND #%11111110
STA gameStatusByte
;; OPTIONAL: Play unpause sfx:
;PlaySound #SND_UNPAUSE
;; OPTIONAL: Make the screen normal - set all 3 emphasis bits of $2001 to 0
LDA soft2001
AND #%00011111
STA soft2001
RTS
Then, you'll want to open up your doHandleObjects.asm file and replace the first RTS at the end of the doHandleObjects label (line 5) to JMP JustDrawObject (assuming you still want all objects to draw when paused):
Code:
doHandleObjects:
LDA gameStatusByte
AND #%00000001 ;;; this will skip object handling.
BEQ dontSkipObjectHandling
JMP JustDrawObject
And of course, you can go into your Sprite PreDraw script and add in DrawSprite macros to write "PAUSED" or whatever indicator you want, and then add a conditional check for gameStatusByte to control when those sprites draw. You'll also want to put in similar conditional checks for gameStatusByte in any file that involves input or automated actions. So something like...
Code:
LDA gameStatusByte
AND #%00000001 ;;;; when this bit is 1, the game is in a paused state.
BNE skipRoutine
;;;; your routine here
skipRoutine:
Seeing as how gameHandler seems to have some free bits that don't control anything, I have no idea why Joe decided to make an extra byte to control 1 thing, but you could probably set things up so you can just use a free bit in gameHandler to do this and get rid of gameStatusByte entirely.