Banner
Views: 240,504,550
Time: 2013-06-19 01:26:54 AM
7 users online: Akireyano, dggonzalz, DPBOX, Everest, pakkie, Pokeymeister80, Pyro X - Guests: 21 - Bots: 26Users: 23,082 (1,328 active)
Latest: JuanK Paniagua
Tip: Add decorations to the overworld. Don't leave large empty grass or sea regions.
Layer 3 - Inconsistent Priority Issues *Issue Resolved*
Forum Index - SMW Hacking - General SMW Hacking Help - ASM & Related Topics - Layer 3 - Inconsistent Priority Issues *Issue Resolved*
Pages: « 1 »
I have been figuring out how to use Layer 3 in my latest project recently, and no matter what method I use to insert layer 3, I come up with the same issue. An issue I swear nobody on here ever mentions. I've asked around for a bit, and some users have offered some suggestions, but none seem to work or be of use.

Here is what's going on.

The layer 3 itself works great. The graphics and behavior are spot on, but there is one, tiny, little bastard of a conflict I can't wrap my head around:

The priority screws up in very specific situations. Item emerging from a question block, Mario entering/exiting a pipe, and the castle flame generator just stays behind layer 2 all together. Frustrating.

I've been told to try applying HDMA.asm, but while that had fixed a few issues, it always seems to create new ones for me.

Now, I have tried two different methods, and both times I get this issue. First I tried using the Layer 3 Customizer, and the second time I used Autostim.

I used different behavior codes each time. I used this behavior for the Layer 3 Customizer by imamelia:
Code
L3InitXX_InitSMWL3Clouds:

LDA #$17			;
STA $212C			; put all three layers on the main screen
STZ $212D			; and none of them on the subscreen
LDA #$04			;
TRB $40				; disable Layer 3 from being affected by CGADSUB

L3MainXX_SMWL3Clouds:

REP #$20				;
LDA $1E				; Layer 2 X position
LSR					; divided by 2
STA $22				; equals the X position for Layer 3
LDA $20				; Layer 2 Y position
CLC					;
ADC #$0050			; plus 50
STA $24				; equals the Y position for Layer 3
SEP #$20				;
RTL					;



And used this behavior for Autostim in LevelASM for both level and init:
Code
LDA #$17
	STA $212C
	REP #$20	;Make A 16 bits wide
	LDA $1462		;Load the layer 1 x position
	LSR		;Divide by 2.  The more times you use LSR the slower the background will 

scroll horizontally.
	LSR		;If you use ASL (multiply by 2) instead the background will scroll 

faster than the foreground.
	STA $22		;Store to the layer 3 x position

	LDA $1464		;Load the layer 1 y position
	LSR		;Same as above, but vertically.
	LSR
	SEC		;These two lines are for shifting your background vertically.
	SBC #$0D20	;If you're using a background that loops you probably won't have to use 

this.
	STA $24		;Store to the layer 3 y position
	SEP #$20	;Make A 8 bits wide
	LDA #$17
	STA $212C


Sorry for the wall, but this problem needs to be fixed. Thanks for any help.
Last edited on 2012-02-21 04:46:30 PM by Yoshi Master.
Not sure about the mushroom, but if I remember correctly the older version of Iceman's patch took care of it, while the newer one actually caused more problems than it fixed.

Code
05431	$00:D231	5 bytes	Graphics	Change (A9 02 8D F9 13) to EA EA EA EA EA to remove Mario's priority when he's going down a pipe.

There, change that to fix the pipe issue, but make sure you add priority to them.

Mod edit: Fixed table stretch.
Last edited on 2012-01-28 10:40:19 AM by Alcaro.
Almost all the HDMA "fixes" cause problems. The only patches worth applying IMO are the ones that change STAs to TSBs for $0D9F, and the one that (properly) prevents showing gradients during black screens.


For this particular problem, there is no perfect fix. It's easy enough to make custom blocks that cause the spawned powerups have a different priority, though said custom ? blocks would still need to be given priority themselves. I personally never cared enough to fix the pipes, but it can be done a per-level basis if so inclined (do a hijack instead of replacin with EAs). That way, the compromises you have to make only affect the needed levels, instead of everything.
Originally posted by Lynnes
Not sure about the mushroom, but if I remember correctly the older version of Iceman's patch took care of it, while the newer one actually caused more problems than it fixed.

Code
05431	$00:D231	5 bytes	Graphics	Change (A9 02 8D F9 13) to EA EA EA EA EA to remove Mario's priority when he's going down a pipe.

There, change that to fix the pipe issue, but make sure you add priority to them.

Mod edit: Fixed table stretch.

Thank you Lynnes, that worked out the pipe issue.

Now just for the Blocks. I think I can do something different for the Castle Flames.

Originally posted by Kaijyuu
Almost all the HDMA "fixes" cause problems. The only patches worth applying IMO are the ones that change STAs to TSBs for $0D9F, and the one that (properly) prevents showing gradients during black screens.

That is a little issue I have, gradients on black screens. What is this patch called?

Originally posted by Kaijyuu
For this particular problem, there is no perfect fix. It's easy enough to make custom blocks that cause the spawned powerups have a different priority, though said custom ? blocks would still need to be given priority themselves.

Custom blocks would be an acceptable solution, that is, if I knew how to code blocks. I'm more of the the, graphics, levels, patches kind of hacker.
Quote
That is a little issue I have, gradients on black screens. What is this patch called?

It's included with the normal HDMA "fixes." I wrote my own, lemme see if I can find it in my minor edits patch....



Oh dear, looks like it's part of my NMI hack, not standalone. Here's the code, though; if you can stick it somewhere that's run literally every frame (and not just during levels), then it'd work.

Code
	LDA $0100		; game mode
	CMP #$11		; check if black screen (mario start where applicable)
	BNE NMI_GAMEMODE
	LDA #$78		; reset HDMA channels
	TRB $0D9F
NMI_GAMEMODE:


Alternatively you could hijack game mode 11 and turn off HDMA then.
Last edited on 2012-01-29 02:48:10 AM by Kaijyuu.
Thank you for posting that Kaijyuu. I have been tinkering with HDMA.asm, and I think that may be my solution to the black screen issue, as well as my other problems. That is, if I can fix this new problem. If this new problem goes unresolved, however, I will definitely make use of your code.

The issue with HDMA.asm, is that powerups have very odd attributes that alter sprite priority. As the feather swings back and forth mid-air, once it reaches the right side of its swing every sprite is now behind layer 2 and 3, when it comes back around every sprite regains its proper priority. If I grab it when sprites have priority, priority remains. If I grab it when priority is behind layer 2 and 3, it remains behind the layers.

What the hell is going on here?
Late bump, sorry.

I'm going to check the powerups as soon as possible. Also, are you using version 4.0.1 of my hdma.asm? (Available in my files).

Any other errors aside from the powerup one? Let me know.
Last edited on 2012-02-19 10:57:04 AM by Ice Man.
Yes, I am using HDMA.asm 4.0.1.

Here are all of the issues I have found:
- Feather Powerup causes issues when spawned. No longer flips GFX on X axis, and causes strange layer inconsistencies in levels with or without HDMA and/or Layer 3. The P-Balloon also does this.

- Having more than two Powerups on screen causes layer inconsistencies. Mostly the Mushroom and Star.
Edit: The Mushroom and star actually cause layer inconsistencies on their own. Unlike the feather and p-balloon, they only cause these layer issues to themselves.

- When entering a pipe with Yoshi, Mario keeps priority over layer 2 and 3, while Yoshi does not. This actually happens with objects Mario carries too, such as shells, throw blocks, and P-Switches.


I also assume that when powerups appear over bricks and when Mario appears over pipes, that is something that can't be fixed? It's not a big deal since you can just add priority to those things, but it's a shame we have to. Small price though, for such an awesome patch.

Anyway, thanks for checking it out Ice Man. I could make you a video of these issues if you'd like, if you have trouble replicating the issues.
Last edited on 2012-02-19 10:52:55 PM by Yoshi Master.
A video or a patch of the game would be awesome, so I can have a deeper look to see what's happening and how to solve it.
Issue solved via PM. Thank you Ice Man!
Pages: « 1 »
Forum Index - SMW Hacking - General SMW Hacking Help - ASM & Related Topics - Layer 3 - Inconsistent Priority Issues *Issue Resolved*

The purpose of this site is not to distribute copyrighted material, but to honor one of our favourite games.

Copyright © 2005 - 2013 - SMW Central
Legal Information - Link To Us


Total queries: 29

Menu