[4.5] Non-textbox based pause

dale_coop

Moderator
Staff member
Have you tried to adapt the Pause code from that topic: http://nesmakers.com/viewtopic.php?f=35&t=2421
 

offparkway

Active member
Also struggling with this in 4.5. I used the pause and dim the screen code that Dale posted, but when I run the game, hitting start does dim the screen but doesn't pause anything.
 

dale_coop

Moderator
Staff member
A quick answer for that... I checked last night, in 4.5, how to adapt the 4.1.5 pause to 4.5
And here what I suggest:


1) Let's say you have your PAUSE gfx like in the 4.1.5 tutorial http://nesmakers.com/viewtopic.php?f=35&t=2421

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)

3) Modify your "Sprite Pre-Draw" or your "Sprite Post-Draw" script...
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:
 

dale_coop

Moderator
Staff member
The module that comes with the 4.5 is different than the 4.1.5 and has issues... difficult to do really better without spending hours on modifications in the engine :p
 

TolerantX

Active member
I got it working fine no bugs over a week ago. You said you weren't going to give help so I wrote the code myself. If you were going to do that why didnt you tell me that in the first place and save me some gray hair? :/
I tried deleting this post because I no longer need the answer. I made a topic in a discord server where it can easily be deleted.
Thank you
 

dale_coop

Moderator
Staff member
TolerantX said:
I got it working fine no bugs over a week ago. You said you weren't going to give help so I wrote the code myself. If you were going to do that why didnt you tell me that in the first place and save me some gray hair? :/
I tried deleting this post because I no longer need the answer. I made a topic in a discord server where it can easily be deleted.
Thank you

I haven't seen any answer or script or tutorial for helping other members about that topic... And I saw offparkway asking for the same thing on the "Non-textbox based pause" topic...
So, I thought I could take a look and help ;)

It would be REALLY easier for everyone if the topics could be on the forum (and not on Discord, because on discord it's very difficult for someone who is in the same situation like you, or offparkway,...) Here, at least, in some days/weeks/months members can find their answer.
 

TolerantX

Active member
When I mentioned that, it was because also when I asked... you gave the response that it was essentially the same as in 4.1.5, which, with very minor changes, was identical. As you, Joe and a few others said "the 4.5 you currently have is a BETA" hence any changes or things I change may not even translate over into the official 4.5 so I feel VERY uncomfortable posting ANY scripts after being informed of this fact by you, Joe, and a few others. I don't want to break anyones game or have a bunch of questions about things while I'm trying to figure it out for myself and that's not counting my aversion to negative (not constructive, but negative) criticism.
I'm sorry if this bothers some. I promise as soon as I know everything works in the official version and my scripts arent buggy messes of hot garbage, I want to contribute completely again. Right now, and as of early July my confidenece in everything I do in NESmaker has been completely gone.
 

PasseGaming

Active member
I tried using this script for my MOD_shooter and it sort of worked. It paused the monsters and ship but the screen kept scrolling along. When unpaused the monsters returned as normal but the player object didn't... probably has something to do with the scrolling. Left the player object behind?
 

TolerantX

Active member
I made a video tutorial for it with details to follow Dale's Instructions...

https://youtu.be/xpKoFcW-KLo
 

ShinJo

New member
Not sure if anyone checks these old threads anymore but I had a question about pausing while speaking with a NPC. The code above works great! However, when I pausing during dialogue - the game actually unpauses and the player can walk around.

Anyone else experience this or know a way to stop it from occuring?
 

SciNEStist

Well-known member
the simple solution most people go with is to prevent pausing/unpausing while there is an active text box up.

HERE you will find some discussion on how to do that
 
Top Bottom