Non-textbox based pause

mouse spirit

Well-known member
Sorry that may not be right.Its in this topic. You have to put a code in all input scripts that says if paused dont work. That code at the end of that link i gave you.put it in front of all code on your input scripts.
 

offparkway

Active member
This is talking about displaying the word "Pause" it looks like. Or are you showing the bottom section about the player hovering? My player, NPCs, and enemies all operate as normal. The only change when I hit Start is the screen dims.
 

mouse spirit

Well-known member
I see.sounds it you maybe didnt follow all of the steps. Maybe try fresh as i see you may have missed some steps.be sure to read every post on this topic.everyones mistakes and answers as when first posted. Sometimes stuff doesnt work rifht so be sure to re go over these 7 pages.
 

offparkway

Active member
will do. I just copied Dale's code, which looked complete to me. It seemed to work for others, so I figured that was all I needed. Thanks!

EDIT: it doesn't look like anyone else has the same issue. My screen dims just fine when I press start, but nothing pauses. The monsters still attack me, and I can attack them. My code is the same, so who knows!

I'm on 4.5... maybe the code is different?
 

dale_coop

Moderator
Staff member
Yeah 4.5 is REALLY different then the 4.1.5
A lot of advanced scripts will not work with it, you will have to modify, adapt it...
I haven’t checked yet for the pause script. But we will figure it out 👍
 

dale_coop

Moderator
Staff 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:
 

offparkway

Active member
...so my pause screen works great! The issue I'm running into is pausing while a text box is on the screen. Sometimes I mistakenly hit START to try to close the text box (instead of A), and it freezes the text box permanently on the screen.

Is there a way to disable the pause feature when a text box is up on screen? Or does anyone know a better workaround?
 

mouse spirit

Well-known member
here is my pause script in 4.1.5

Code:
;;;;right below here is the part you want to look at
 LDA textboxHandler  ;; check if the text is already displayed
	AND #%11000000 
	BEQ +
	RTS
	+
	
	;;;what that means is that if text box showing, cant pause....almost
	;;;;truly it wont let you pause while text is being drawn,but closer to what you and i need
	
	
	
	;; from here, the normal script...:   
    
    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

It wont let you pause while text is being drawn,but still lets you pause after text is drawn
Not perfect but closer to what you aaaand i need as i forgot i did not complete this task either ....yet!
 

offparkway

Active member
Hey excellent! I'm getting a compile error on ""LDA textboxHandler"... I'm assuming it's called something else in 4.5? Trying to figure out what it's called now, if that's the issue.
 

mouse spirit

Well-known member
It would probly be in text handle script, whatever its called in your project settings, unless theres not one.
 

offparkway

Active member
ok it's just "textHandler" now. Game compiles, but the added script doesn't seem to affect anything. As the text is writing on the screen, I can still pause. And then the text box is permanently on the screen until I reset or leave the screen. Weird.

What I really need is for that text box to go away when I unpause.
 

dale_coop

Moderator
Staff member
Check that topic... it's the PAUSE for the 4.5:
http://nesmakers.com/viewtopic.php?p=26812#p26812
 

offparkway

Active member
That's the script I'm using for my Pause .asm in 4.5. The issue is: if you pause during NPC text, the NPC text gets sort of "baked" onto the screen permanently. The game still functions, but I'm fighting monsters on top of NPC text, lol.
 

Jonny

Well-known member
I'm using metrovania module and I've got this working on my project pretty well.
However, I do have an issue and wondered if anyone might know of a fix...

So...

Game pauses/resumes fine when I press START alone (dimmed screen, player movement disabled)
If LEFT or RIGHT are being held as START is pressed the screen dims but the player doesn't stop.

I know its unlikely that a player would do this but it feels kinda clunky as I have it now.

Was thinking along the lines of checking the controller inputs in the Pause.asm code and NOT pausing if anything else was being pressed at the same time. I've already tried various things with the input scripts but nothing worked.

Would what I'm suggesting work potentially? Can anyone steer me in the right direction with the code?

My logic may be wrong but I was thinking something like, Load the inputs currently being pressed, Compare them with no inputs, Jump the main part of the pause script if they dont match. Please forgive my incompetence with ASM, im trying to learn.

Any ideas?
 
Last edited:

CutterCross

Active member
I'm using metrovania module and I've got this working on my project pretty well.
However, I do have an issue and wondered if anyone might know of a fix...

So...

Game pauses/resumes fine when I press START alone (dimmed screen, player movement disabled)
If LEFT or RIGHT are being held as START is pressed the screen dims but the player doesn't stop.

I know its unlikely that a player would do this but it feels kinda clunky as I have it now.

Was thinking along the lines of checking the controller inputs in the Pause.asm code and NOT pausing if anything else was being pressed at the same time. I've already tried various things with the input scripts but nothing worked.

Would what I'm suggesting work potentially? Can anyone steer me in the right direction with the code?

My logic may be wrong but I was thinking something like, Load the inputs currently being pressed, Compare them with no inputs, Jump the main part of the pause script if they dont match. Please forgive my incompetence with ASM, im trying to learn.

Any ideas?
If you're using 4.5.6 just use this: https://www.nesmakers.com/index.php?threads/4-5-6-non-textbox-pause-script.6339/

It instead just toggles the gameStatusByte to skip all object handling so a situation like that will never occur.
 

Hippokittie

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?
 
Top Bottom