Unlimited Warps -- One Screen

mouse spirit

Well-known member
No just a warp. And then i click warp to underworld and i choose a screen.

Actually i made it so it warps when i press up so it is customized. But warping works fine like that so far.
 

mouse spirit

Well-known member
Maybe its this load from map 1?

Code:
LDA gamepad
   AND #%00010000
   CMP #%00010000
 BEQ++
 RTS
 ++
;;;WARP TO SCREEN
;; the screen to warp to is set in screen info
			CPX player1_object
			BNE skipWarp
			LDA #%11000000
				;7 = active
				;6 = 8 or 16 px tiles
			ORA #GS_MainGame
			ORA #%01000000
			STA update_screen
			LDA #%00000001
			STA update_screen_details ;; load from map 1
			LDA warpToScreen
			STA newScreen
			STA currentScreen
			LSR
			LSR
			LSR
			LSR
			LSR
			STA screenBank
			LDA #$02
			STA screen_transition_type
	LDA #$01
	STA tile_solidity
	LDA #$00
	STA gameHandler
skipWarp:
	LDA #$01
	;STA tile_solidity
LDA #$00
STA textaction
 


; cpx player1_object
; BNE dontDoWarp_tile
; LDA warpMap
; sta currentMap
; clc
; ADC #$01
; STA temp
; GoToScreen warpToScreen, temp

; dontDoWarp_tile
 

Bucket Mouse

Active member
Right off the bat you've used AND and CMP at the same time. The CMP part isn't necessary because the AND takes care of that function in this case. That alone won't fix the issue though.

It also looks like you're using a completely different and untested warping script; the traditional script is at the bottom but it's greyed out. I'm familiar with how the default warp code works, but not yours.
Is there any particular reason why you have to use your own warping script?

The GoToScreen macro isn't even part of it. That's likely your biggest issue. That macro does the dirty work!
 

mouse spirit

Well-known member
I tried and it gave me an unknow label error for Gotoscreen, so commented that out and it doesnt warp.No error though. Plays fine. Might be why i used it or why it was there in the first place because i didnt write it thats fersure.
Thank you i removed the and in my original script.
As i said also,this script works great for warping, im mainly wondering why it doesnt warp to underworld and or why it doesnt work with the underworld warp out flag.
But yeah maybe it has to do with me not using that macro,but it doesnt work when i use it so far..

I see that macro has 3 arguments now.
Do you think theres a line or two i can simply add to my code? To check which map or underworld map?


Ok got the gotoscreencode working but when i place arguments it gets wonky. I believe it goes temp2,temp3,temp1 and that sometimes works right..
When i did temp,temp1,temp2 it was close but no underwold. What should the arguments read?
 

Bucket Mouse

Active member
Maybe. Here's the full script for GoToScreen in 4.1:

Code:
MACRO GoToScreen arg0, arg1, arg2
	; arg 0 = screen to warp to.
	; arg 1 = map
	; arg 2 = transition type

	LDA arg0
	STA temp2
	LDA arg1
	STA temp3
	LDA arg2
	STA temp1
	JSR HandleGoToScreen
	

	
	
	ENDM

Note that all this does is transfer the values to temp numbers and then jumps to a subroutine called HandleGoToScreen. I really had to dig to find it, because it doesn't get labeled as such until it's compiled:

Code:
0FC34                           HandleGoToScreen:

		LDA temp2
			STA Object_scroll,x
			STA currentNametable
			STA newScreen
			STA currentScreen ;currentScreen
			STA xScroll_hi
			STA nt_hold
			LDA Object_scroll,x
			AND #%00000001
			STA showingNametable
			LDA newX
			STA Object_x_hi,x
			STA xHold_hi
			

	LDA temp1
	STA screen_transition_type
		
	LDA temp3
	;LDA warpMap
	STA update_screen_details
	
	;LDA #$01
	;STA tile_solidity		
	LDA #$00
	STA gameHandler
		LDA #%11000000
				;7 = active
				;6 = 8 or 16 px tiles
			ORA #GS_MainGame
			ORA #%01000000
			STA update_screen
	LDA #$00
	STA xScroll
doneWithWarpToScreen:

This is pretty close to what you have as your custom script, which means it really isn't necessary to repeat all this when GoToScreen takes up less space.

The middle argument from GoToScreen defines whether the warp is going to the overworld or the underworld. I believe #$01 is the overworld and #$02 is the underworld. Or it could be #$00 and #$01; try them both.
Anyway, it is stored into temp3 at GoToScreen, and then temp3 is stored into update_screen_details here. temp3 is what you need to watch.
 

mouse spirit

Well-known member
So i did get it to work by forcing #$02 in the middle argument but not using temp3. This is progress.Thanks bucket.
 

mouse spirit

Well-known member
Actually there is only one piece of the puzzle left. My positions are now offset in the new screen after i warp. Im trying different things for the last argument.
 

mouse spirit

Well-known member
Alright,drumroll. ... .. . ......... do
GoToScreen warpToScreen, temp, #$02.
Pretty close to what was there. Not sure about all the details. So far this is workin in every regard. Thanks, from one mouse to another.
 

vanderblade

Active member
The evolution of this solution is difficult to track on this thread.

Has a solution without bugs been decided upon? If so, what are the steps?

I'm using 4.1.5 and would like to use two warps on a screen.
 

SpaceSandwich

New member
Um, I didn't change anything yet but I assumed the template wouldn't give any error, What's wrong with the functions? do I have to change the arguments? I tried replacing "screen2warp2" in case it wasn't giving a valid argument but it still happens.

1636729868812.png
 
Last edited:

SpaceSandwich

New member
Wait I think it's because it should be "WarpToScreen #$01, screen2warp2, #$01" instead of "GoToScreen screen2warp2, #$01, #$02", at least in the current version of NESmaker, but upon rewritting that, a ton of new errors popped up, and they're the ones where they try to write or read variables, why is that?

1636730506031.png
 

dale_coop

Moderator
Staff member
Make sure to have the "warpXH", "warpYH", "warpXV", "warpYV" and "screen2warp2" variables are declared (added in your Project Settings > User Variables, for example).
 
Top Bottom