Non-textbox based pause

dale_coop

Moderator
Staff member
You could add a check at the beginning of the Pause.asm input script, something like:
Code:
  LDA ScreenType
  CMP #22  ;; checking screen type "22" (use here your cutscenes screen-type value)
  BNE +    ;; if not we can continue the pause script
    RTS    ;; if it is 22, we stop the script here
  +
 

SciNEStist

Well-known member
A bit late to the party, with some last minute testing. I found that when I pause in a "cutscene" screen with auto text, it will cause the next screen (or level) to start having sprite corruption. Is there a way to assign the pause to only work on specific screen types?

if you are using version 4.1.5 This is probably related to the issue of pausing whenever there is any text box on screen. if you do, the graphics go all scrambled on the next screen.

to prevent this bug entirely, you need to check if there is a text box on the screen and not trigger the pause at all if there is.

Add this part to the beginning of you pause.asm script, and you should be fine.

Code:
    LDA textboxHandler
    AND #%00010000  ;; the 4th bit indicates if a text box is on or not
    BEQ +
    RTS
    +


Mouse Spirit touched upon the idea here , but I find that checking the 4th bit instead was giving more favorable results.
 
Great ideas...
Here 's a "Pause.asm" script (using Bucket Mouse's paused sfx & Kasumi's darkened screen suggestions):

Code:
    LDA isPaused
    BNE unpausegame
    LDA gameHandler
    ORA #%00100000 ;; objects bit
    STA gameHandler
    LDA #$01
    STA isPaused
    ;; we play the pause sfx:
    PlaySound #SND_PAUSE   
    ;; we make the screen dark:
    LDA soft2001
    ORA #%11100000
    STA soft2001
   
    JMP thePauseEnd
unpausegame:
    LDA gameHandler
    AND #%11011111 ;; objects bit
    STA gameHandler
    LDA #$00
    STA isPaused
    ;; we play the unpause sfx:
    PlaySound #SND_UNPAUSE
    ;; we make the screen back normal:
    LDA soft2001
    AND #%00011111
    STA soft2001
thePauseEnd:
    RTS

Requires that you add 2 new sounds named "SND_PAUSE" & "SND_UNPAUSE" in the "Sounds > SFX" window.
Dale, I can't add the script. Just add it to the input and that's it?
 

SciNEStist

Well-known member
the full instructions for 4.5.x are here earlier in the thread:

 

warpedpipe

New member
Just in case someone would like to adapt that tutorial for the 4.5,...
And here what I suggest:


1) Let's say you have your PAUSE gfx like in the 4.1.5 tutorial:
2020-07-20-14-37-47-NES-MAKER-4-5-2-Version-0x175-Tutorial-Project-MST.png


And you have your "isPaused" variable (in "Project Settings > User Variables") by default set to "0".


2) Now, the "pause.asm" script should be:
Code:
LDA isPaused
BNE +unpausegame

    LDA gameStatusByte
    ORA #%00000001 ;;; this will skip object handling.
    STA gameStatusByte
    LDA #$01
    STA isPaused
   
    ;; we play the pause sfx:
    PlaySound #SND_PAUSE   
   
    ;; we make the screen dark:
    LDA soft2001
    ORA #%11100000
    STA soft2001
    JMP +thePauseEnd
+unpausegame:
    LDA gameStatusByte
    AND #%11111110
    STA gameStatusByte
    LDA #$00
    STA isPaused
   
    ;; we play the unpause sfx:
    PlaySound #SND_UNPAUSE
   
    ;; we make the screen back normal:
    LDA soft2001
    AND #%00011111
    STA soft2001
+thePauseEnd:

And make sure you assigned it to the "release" button (I had issues with the "press", not really sure why):

2020-07-20-15-38-11-NES-MAKER-4-5-2-Version-0x175-Tutorial-Project-MST.png



3) Modify your "Sprite Pre-Draw" or your "Sprite Post-Draw" script:
2020-07-20-14-39-58-Project-Settings.png


Add this code, the end:

Code:
;; IF Main Game and Paused... then draw P A U S E
LDA gameState
CMP #$00
BEQ +
JMP +isNotPaused
+
LDA isPaused
BNE +
JMP +isNotPaused
+
    ;DrawSpriteHud #$08, #$08, #$11, #$10, #$10, myVar, #$00
        ; arg0 = starting position in pixels, x
        ; arg1 = starting position in pixels, y
        ; arg2 = sprite to draw, CONTAINER
        ; arg3 = MAX   
        ; arg4 = sprite to draw, FILLED
        ; arg5 = variable.
        ; arg6 = attribute

    ;; LETTRE "P":
    LDA #$70
    STA tempA
    DrawSpriteHud #$6C, #$78, tempA, #$01, tempA, #$01, #$00
    ;; LETTRE "A":
    LDA #$71
    STA tempA
    DrawSpriteHud #$76, #$78, tempA, #$01, tempA, #$01, #$00
    ;; LETTRE "U":
    LDA #$72
    STA tempA
    DrawSpriteHud #$80, #$78, tempA, #$01, tempA, #$01, #$00
    ;; LETTRE "S":
    LDA #$73
    STA tempA
    DrawSpriteHud #$8A, #$78, tempA, #$01, tempA, #$01, #$00
    ;; LETTRE "E":
    LDA #$74
    STA tempA
    DrawSpriteHud #$94, #$78, tempA, #$01, tempA, #$01, #$00
   
+isNotPaused:

2 Questions related to the pause screen:

#1 In metroidvania 4.5.9, I'm having an issue where the first Main Game screen is automatically paused.
My input editor has 2 scripts for Start button. Press S: A warp script set to take the player from the Start Screen to the Main Screen. Release S: The pause.asm is set on Start Screen. Is there anyway to delay the start release check by a few seconds or another way to fix this so it wont carry over from the Start screen input?

#2 How would I select the PAUSE text sprites if they are located in a different portion of the image?

Example:
1708446412045.png
 

mouse spirit

Well-known member
2 Questions related to the pause screen:

#1 In metroidvania 4.5.9, I'm having an issue where the first Main Game screen is automatically paused.
My input editor has 2 scripts for Start button. Press S: A warp script set to take the player from the Start Screen to the Main Screen. Release S: The pause.asm is set on Start Screen. Is there anyway to delay the start release check by a few seconds or another way to fix this so it wont carry over from the Start screen input?

#2 How would I select the PAUSE text sprites if they are located in a different portion of the image?

Example:
View attachment 7928
For the pause on the start screen, in your pause button script, add a check for if you are currently on start screen, before the pause code happens. i personally dont know the screen number for the start screen sorry.... But, load room number, compare to start screen number, if it matches, skip pause script.Else,do pause.

like this example shown above
Code:
LDA ScreenType
  CMP #22  ;; checking screen type "22" (use here your cutscenes screen-type value)
  BNE +    ;; if not we can continue the pause script
    RTS    ;; if it is 22, we stop the script here
  +


To use different spots on that grid for the pause sprites, you would enter different values in the script for the pause script where its calling up the sprites . Each of those little squares have a correlating number/letter value. Someone will be able to give more specifics, but this is how you would do those things, atleast one way.
 

dale_coop

Moderator
Staff member
#1 In metroidvania 4.5.9, I'm having an issue where the first Main Game screen is automatically paused.
My input editor has 2 scripts for Start button. Press S: A warp script set to take the player from the Start Screen to the Main Screen. Release S: The pause.asm is set on Start Screen. Is there anyway to delay the start release check by a few seconds or another way to fix this so it wont carry over from the Start screen input?

#2 How would I select the PAUSE text sprites if they are located in a different portion of the image?
#1 I see several ways you could fix your issue
A) Simple fix: you could assign your Pause script to the PRESS button instead of the RELEASE, I think it would fix your issue.
B) Or, else, you could use a cooldownButtonTimer for that press start input.
For that, creates a user variable "cooldownButtonTimer" (value 0), in your Press Start input script, adds:
Code:
    LDA #$02  ;; setting the coodown (any small value)
    STA cooldownButtonTimer
Then, in the Project Settings > Script Settings, edit your Handle Game Timer script (if yours is blank.asm, create a new HandleGameTimer.asm script and assign it in the Project Settings) and add that code for example at the beginning:
Code:
    LDA cooldownButtonTimer
    BEQ +continue
        DEC cooldownButtonTimer  ;; decreasing the cooldonw timer
    +continue:
And finally at the very beginning of your Pause.asm input script adds:
Code:
LDA cooldownButtonTimer
BEQ +continue
    ;; if the cooldown timer is not finished, don't execute that script
    RTS
+continue:

#2 The PAUSE text is drawn in your PreDraw script, you might see 5 lines of SpriteDrawing, (one for each letter) :
Code:
    LDA #$70
    STA tempA
    DrawSpriteHud #$6C, #$78, tempA, #$01, tempA, #$01, #$00
In that code, you see the "#$70" value, it's for drawing the "P". To be more precise, it's for drawing the sprite that has the ID $70 in your GameObjectTileset.BMP
Because all the sprites have a number (ID), here's:
1708446412045.png
The "P" coordinate (ID) is #$70
if you want to use the sprite at row: 4 colum: B, you will write "#$4B" for the the sprite draw of the letter P.
 

warpedpipe

New member
@mouse spirit @dale_coop Thank you both for the help. For right now I took the easy route and switched the Start button to work on "press" instead of "release". But I will review the cool down timer option. Also, the visual graph was very helpful in selecting the correct sprites. Its all working now!

game_006.png
 
Top Bottom