Language…
14 users online:  Anorakun,  Blaagon, Connnnair, Danik2343, DasFueller, deported, DerKorkin, ergazoobi, Hans,  idol, PJHacker, Rapha2k, Rykon-V73, SuperRomhackingNoob37 - Guests: 77 - Bots: 293
Users: 66,008 (2,163 active)
Latest user: chiefrunningwolf2001

Layer 3, piranha plant, Lakitu, priority, sprite disassembly, etc.

Hi,
This is a multilayered post with a couple of questions. Using FluxBaserom, I am determined on using scrolling layer 3 clouds in one of my level, even though it will have piranha plants and pipe dwelling lakitus. But, as you probably know, when adding the layer 3 clouds and changing level mode to OE, some sprites go behind the cloud and disappear, namely piranha plants. Coincidentally, the pipe dwelling lakitus in my level now appear behind the background!

I searched and found this post that recommends using a custom sprite. The post also talks about using Xkas and modifying values but I feel the explanation assumes you know other stuff and I'm fairly new to all of this and when I read the entire thread the OP seemed to have tried everything unsuccessfully.

And then I searched for a "custom sprite for dummies" tutorial and didn't really find anything but this post named Sprite Insertion with PIXI. I tried following the steps but when I load PIXI I always get the message "Enter a ROM file name, or drag and drop the ROM here:" and when I drag and drop my ROM on it I get this message "Could not open list file "../FluxBaserom2/FluxBaserom2/list.txt" for reading".

I also had found a post that suggested changing the priority of the clouds in the 8x8 Overworld Tile Selector. Alas, the priority is always set to "Priority --" and whatever I do with the priority setting it just won't stick i.e. I change it and it doesn't apply, I can't "save it". If I click on another tile and get back to the tile I changed it still is set to "Priority --".

So the main question (on top of all the other questions!) is : is there a way to make piranha plants show properly in a level with mode OE that has layer 3? If yes : what is it?

More over, I assumed the pipe dwelling lakitu situation could be fixed using a custom sprite, but I'm back to the starting point of not finding a step by step guide on what you actually have to do once you have the ASM + CFG file. Have I not looked hard enough for it? Does it exist? And more importantly, once I'm able to integrate the custom sprites in my hack, what settings will I have to apply to make them function properly?

I don't know if this matters, but the level I tried doin that in is 11E.

Thanks.


So, depending on the visual effect you're specifically looking for here, this may or may not be posssible. And to get to how to work around it, you need to first understand how layers on the SNES actually work.

Though SMW supports Layer 1/2/3 and sprites, the SNES only actually reduces those down to two layers, called the "main screen" and "sub screen". It then combines those two through a process called color math, which is what is responsible for the transparency effects you see in level mode 0E. With color math, you can make whatever you stick on the main screen transparent against whatever you stick on the subscreen. So if you want those clouds to be transparent against all the other layers, you need to have just the clouds on one of those two, and everything else on the other.

Which comes to the issue with the Piranha Plants. Take a look at this diagram:

This shows how the different layer and sprite priorities get ordered when combined onto the main and sub screens. Normally in SMW, sprites use priority 2, so they appear in front of Layer 1/2 tiles with no priority. With the Piranha Plant, it swaps down to priority 1, which puts it behind Layer 1/2 regardless of the tile's priority; you can't just move it down a single step so that it stays in front of Layer 2 still. SMW normally gets around this by having Layer 2 on the subscreen, so that it stays behind everything no matter what. But since you need Layer 2 to be on the same screen as Layer 1 for the transparency effect, that's no longer an option.

If it works for you, the easiest workaround for this is do a combination of two things:
  1. Create a copy of the pipe tiles with priority enabled, then place the Piranha Plant on those. In the Map16 editor, there's a "Priority" dropdown you can change on the left side that will allow you to do this.
  2. Add the Piranha Plant disassembly with PIXI. Open up the disassembly in a text editor and find these lines:
    Code
    TileProperties:			; tile properties for the graphics routine
    db $5A,$58,$5A,$58,$DA,$D8,$DA,$D8	; stem palette D, head palette C, Y-flip depending on direction,
    				; alway GFX page 1 and priority setting 1
    Change those to this:
    Code
    TileProperties:			; tile properties for the graphics routine
    db $6A,$68,$6A,$68,$EA,$E8,$EA,$E8	; stem palette D, head palette C, Y-flip depending on direction,
    				; alway GFX page 1 and priority setting 2
    This will set the plant to use priority 2 instead of 1. Reinsert that to your hack, and replace the Piranha Plant in the level with the custom sprite version.

What this will do is keep the Piranha Plant in front of Layer 2 (which does not have priority), but keep it behind the pipe tiles (which now do have priority). This does mean that all other sprites, including Mario, will also go behind the pipe tiles, but hopefully that should be okay enough for whatever you need to do.

Professional frame-by-frame time wizard. YouTube - Twitter - SMW Glitch List - SMW Randomizer
Thank you so much for the extensive answer and the diagram. Very appreciated. I tried the suggested workaround. 1st step was fairly easy but I'm getting very confused with the 2nd step. As I'm working with the FluxBaserom, there is already a pixi and custom sprites structure embedded in the hack folders. Nonetheless, I downloaded the Piranha Plants disassembly you suggested and I think I managed to make something out of it because I got to the "All sprites applied successfully!" message from Pixi. Anyways, I added it in the pixi_list file at #10 then tried inserting it in the level but when I insert #10 it's a pipe... and I can't find the code lines you're referring to in the piranha_venus_all.asm file. I'll keep reading Pixi's manual and trying to figure out the whole process in the meantime.


The pipe is probably because you tried manually inserting the sprite while still in object mode #lm{l1}, since object 10 is a horizontal pipe. Make sure you're in sprite editing mode first #lm{sp}.

Originally posted by saucebrune
and I can't find the code lines you're referring to in the piranha_venus_all.asm file. I'll keep reading Pixi's manual and trying to figure out the whole process in the meantime.

I was referring to specifically the disassembly file also included in that download (it's in an additional ZIP file in there). Though, looking at the full custom sprite you tried, actually I think you don't have to do any work because of a trick it makes use of. You should be able to just use that custom sprite in the level without doing any additional work to make it go behind the pipe, so you can actually entirely ignore my original post in this particular case, hah.


For explanation's sake, the trick in question is that it actually draws an extra sprite tile that serves as a "cover" tile using priority 0 (so all the way at the bottom of the layer stack, as seen in that diagram from before). As the SNES goes through the list of sprite tiles it should draw to the screen, they get rendered in the order you write them. For any particular pixel of the screen, only the priority of the sprite tile at the "top" actually determines where that pixel will go in the layer stack. So by sticking this priority 0 tile later in the list of sprite tiles, any overlapping tiles of the sprite get set back down to priority 0 and end up masked out.

Professional frame-by-frame time wizard. YouTube - Twitter - SMW Glitch List - SMW Randomizer
Thanks a lot for the reply Thomas, very appreciated. I'm in the process of transferring my levels to a new baserom that has less stuff in it so it should be easier for me to untangle all those files as I'm a beginner. I'll get back after!
I made a custom pipe Lakitu sprite that uses the same trick, because I also needed to use it in a level with color math at one point. See if this works for you. Set the extension byte to 0A.

----------------

I'm working on a hack! Check it out here. Progress: 64/95 levels.
Thanks for the input imamelia. Although, when trying to insert that sprite I get the error message : error: (E5094): Macro 'FacePlayer' wasn't found. [%FacePlayer()].

From what I understand (not a lot) I need the FacePlayer routine file?
Thomas! Thank you so much. It worked.

I was wondering which of these would allow me to change the stem palette because it seems to be using the palette D and i'd want to use palette C :
Code
TileProperties:			; tile properties for the graphics routine
db $6A,$68,$6A,$68,$EA,$E8,$EA,$E8	; stem palette D, head palette C, Y-flip depending on direction,
				; alway GFX page 1 and priority setting 2


I tried changing the values of pretty much all of those 8 ones and I can't seem to find how to change it.


These are YXPPCCCT values, so if you want to change a palette of a particular tile, start by converting the value to binary. The bits corresponding to the "CCC" then dictate the palette, from 8-F.

So e.g. the value 6A translates to:
Code
     yxppccct
6A = 01101010
         101 = 5 (+ 8 = palette D)

For palette C, change those bits to 100 instead (i.e. 68). Similarly, change EA to E8.

Professional frame-by-frame time wizard. YouTube - Twitter - SMW Glitch List - SMW Randomizer
Originally posted by saucebrune
Thanks for the input imamelia. Although, when trying to insert that sprite I get the error message : error: (E5094): Macro 'FacePlayer' wasn't found. [%FacePlayer()].

From what I understand (not a lot) I need the FacePlayer routine file?

Huh, I thought that routine was included with PIXI. Well, here you go.

----------------

I'm working on a hack! Check it out here. Progress: 64/95 levels.
Thomas, everything worked! Thank you so much.

Imamelia, when you say change the extension byte to 0A, what exactly do you mean? The extension byte listed on the sprite right now are "14 08 10 D8". When reading the ASM what I understand is I have a lakitu that will spawn sprite 14, in a state of 08, with X speed of 10, and Y speed of D8.

But I've been digging in the file to see if there was something related to priority and I can't seem to find anything.
Anybody interested in that. Drkrdnk found a solution.
He modified kevin's pipe lakitu code (that you can get here : https://www.smwcentral.net/?p=section&a=details&id=26416)
Changed line 242 in the asm from EOR #$50 to EOR #$60
Voilà.