News:

Don't forget to visit the main site! There's lots of helpful docs, patches, and more!

Main Menu

[SM] New PLM

Started by gunnargumpert, March 24, 2010, 05:16:21 PM

Previous topic - Next topic

gunnargumpert

if i want to copy an old door and give it just less shots to open, how to find the location?


[spoiler]http://www.metroidconstruction.com/docs/person701SMILEadd.txt[/spoiler] explains, you can add PLM's, but how to find the data and the item description in the ROM? i need to know, where it's located, if i want to copy it - of course. (i cant copy a letter, if i can't find it :lol:)

justawhitelie

Just right click the PLM and then select the only option, Type. then just go to value or whatever and type the new value, for this case it is the missile door. the original is 5. so if you want to make it more difficult to open then just change the value to A which will make it require 10 missiles instead of 5, want to make it easier just make it 3, 2, er 1. Ya get the idea. Oh and just in case you dont know the values... They're in Hex so instead of 1 2 3 4 5 6 7 8 9 10 11... its 1 2 3 4 5 6 7 8 9 A B C D E F 10 11... Viola  :grin:

personitis

See, what I didn't explain and also soon hope to organize, is that the guide explains how to create pointers for those things. Now if you wanted to change how many shots a door would have in comparison to other like doors here's what you'll need to do (without ASM):

-Find the bank for PLMs
-Use SMILE to find the PLM you're looking for and where the next PLM starts
-In a hex editor, go to the PLM bank and find your PLM. Copy everything from there to just before the start of the next PLM you found. Once copied, scroll all the way down until you see a load of 'FF'. Here, paste your copied text, note the hex of the PLM, then enter SMILE's folders and adjust as needed.

With that (which should work), you'll be able to change the number of hits while keeping it different from the rest. Only problem is that the door will use the same palette as the other but that shouldn't be a problem. Hope that was clear enough. =\

gunnargumpert

i thought that, but how is it working (the value)

item 8F40 = $8f:8f40 ?

well, smile will make a hex adress of $8f:8f40 on the bottom of the Pointer window

but is it right?

justawhitelie

You're talking about doors right? If all you want to do is change how many missles or super missles are required to open a PLM door, then just right click the appropriate PLM door, select type then change the value. Dont mess with the item definition or the music. The original value should be like 5, in this case just change it to 6. See? Im just trying to explain it simply.  :O_o:

personitis

justawhitelie: I think he's trying to make a second door so that one opens with (for example) 5 hits while the other opens after 10.

gunnargumpert

yeah person701 is right, i want a seperate door


well, could you please explain, how the pointers of PLM are working? i need to know where it´s pointing to.

That´s all possible
-there might be the ID of the item as the address
-Bank 8F + Item ID
-the 2 pointers, standing in the PLM editor, if item is selected
-ore a pointer, that points to an other address
-all of that but reversed

well, what is correct?

Well for example: [spoiler][/spoiler]

Smiley

24014. It's usually (always) the right address you can see at the top of that window. At least it was so when i changed the amount of hits a red door needs with a hex editor.
Oh, and, where the heck did you pull bank $AF there?  :razz:

justawhitelie

oh in that case, then yes. you'll need a hex editor to edit the values. soz  :O_o:

personitis

Hmm well, I can't help you currently Gunnar. =\ I'm going to sleep early tonight, got a tournament tommorrow, and sunday I have a group of people coming over so we can finish a project. After that I have to study for midterms Monday and then take the exams Tuesday and Wendsday...

I can help on Thursday though. ^^; Unless someone else wishes to volunteer. <,< >,>

JAM

gunnargumpert
It's not the bank $AF. See, all data in SNES ROMs is stored in banks. Each bank is $8000 bytes. First bank is $80. So, what bank should it be for the address between $20000 and $27FFF?

Every PLM has a header and body. If you open your ROM at $84:C85A you'll see this: [B1 C7] [14 C0]. So, this is a header linking to 2 addresses.

First one is pre-drawing instructions (often leads to RTS). In most cases you'll need the second one (24014).

Doors are the special case. There are 3 addresses used. 2nd is a code for opening door, 3rd is a code for closing door (when you entering the room).
The code for closing door is located before the code for opening door. So, you'll need to copy data not from 24014. Look at the 3rd address for this door. It's something like 23F??.



To create new PLM you'll need to create header. If you'll copy code from 24014 to 27014, then the header should be: [B1 C7] [14 F0] [?? ??]. The header can be written anywhere in free space in bank $84

There is also such thing as internal pointers. If you just copy all data from 24014 to 27014, it will still use old code. For the code located between 23F?? to 240?? look at bytes BF and C0 carefully. When you see something like 28 C0 (just example), then it's most like the internal pointer.



By the way, will there be power bomb doors in your game? If not, you can just overwrite power bomb door.


There is a patch named "Metroid 1 doors and PLMs" by me. It contains 2 new doors, 1 missile PLM (4th one in total) and invisible Save Station PLM. I think it's a good example to learn from.

gunnargumpert

#11
i overwrote the powerbomb door sucsesfully!  :yay:

but it´s using the same color as the missile door  :cry:
what values are saying "use this palette ore this palette!"   :sad:
plese help

JAM

Quote from: gunnargumpert on March 27, 2010, 09:47:18 AM
but it´s using the same color as the missile door  :cry:
what values are saying "use this palette ore this palette!"   :sad:
plese help
Search for bytes looking like this: 04 00 57 A9 04 00 51 A9

Aqua: Time (in frames) for every state of door opening/closing
Yellow: Pointers to graphics and type of blocks. 57 A9 leads to 22957 (for example)

Start from 3rd address in header.

You may use pointers for yellow door, as they are unused by now. Open clean ROM and replace all pointers of your door by pointers of original yellow door. And color of yellow door tiles can be changed easily in SMILE.

justawhitelie

 :O_o: Sweet. I can use this too. lol I'm happy this topic was started.

JAM

Actually, there can be a lot of different doors. For example, red door (10 missiles), purple door (25 missiles), orange door (3 power bombs) etc. And all of this with original doors untouched.

Color of doors can be changed with palette blend patch. Pink and red doors may use the same tiles, but in some rooms pink doors will turn into red doors (visually) and in these rooms the real red doors can be set.

personitis

So question: would it be possible to create new doors using scenery gfx? Or would you still need to point to the CRE?

Smiley

Yes, it's possible. It's not any different than if you use CRE.
It's easy, too.
Read this. :wink:

gunnargumpert

Quote from: JAM on March 28, 2010, 07:04:06 PM
Actually, there can be a lot of different doors. For example, red door (10 missiles), purple door (25 missiles), orange door (3 power bombs) etc. And all of this with original doors untouched.

Color of doors can be changed with palette blend patch. Pink and red doors may use the same tiles, but in some rooms pink doors will turn into red doors (visually) and in these rooms the real red doors can be set.


sounds good! but how to do that? and can you use the copyed door (should be blue for example) and the original door (red) i the same room?

personitis

Quote from: SMILEuser96 on March 30, 2010, 07:50:43 AM
Yes, it's possible. It's not any different than if you use CRE.
It's easy, too.
Read this. :wink:
I meant more of what gunnars going for: doors with different "hits to open" than don't come from the CRE.

gunnargumpert

#19
i've got a good feeling, editing doors, but only the standard animation and the closing animation is working properly, the opening animation is from the standart red door, why JAM?


shit, i tryed so many things, but it´s not working.

JAM

Quote from: gunnargumpert on March 31, 2010, 12:19:27 PM
sounds good! but how to do that?
1. Copy code from old door to free space.
2. Change internal pointers.
3. Create new PLM header (leading to new door).
4. Create new GFX file for SMILE. If you about to copy yellow door facing left, then open "SMILE/files/PLM/" folder and copy C85A.gif. Give him the same number as address of new PLM header. If it 27000, then GFX file should be F000.gif
5. Create text file F000.txt when you can note yourself about a new door properties.
6. Reuse old 16*16 tiles or create new ones.

If this isn't enough, then I'll write step-by-step instructions with examples. It'll be a guide then.



Quote from: gunnargumpert on March 31, 2010, 12:19:27 PM
and can you use the copyed door (should be blue for example) and the original door (red) i the same room?
Palette blend patch can change custom color of tiles in any room. If you change colors 1, 2 and 3 in third row (used by pink door) to the red colors, then all your pink doors will turn into red doors (but still will act like a pink doors until you change them). Any other color will not be touched in this case.

Example: blue, red, yellow, green and grey door can be in the same room.
Or: blue, pink, yellow, green and grey door can be in the same room.

Red door and pink door in one room -- impossible


Yellow door can be changed to a purple door. Then:
blue, red, purple, green and grey door can be in the same room.
Or: blue, pink, purple, green and grey door can be in the same room.
Or: blue, red, yellow, green and grey door can be in the same room.
Or: blue, pink, yellow, green and grey door can be in the same room.

Red door and pink door in one room -- impossible

Purple door and orange door in one room -- impossible




But all of this is true if no new 16*16 tiles will be used. With creating new 16*16 tiles in SCENERY, you are limited only by unused colors in this room. And that's what person701 asked.

Quote from: person701 on March 31, 2010, 02:12:25 PM
te]
I meant more of what gunnars going for: doors with different "hits to open" than don't come from the CRE.
Let's look at yellow door facing left.
PLM header is C85A.

Open $84:C85A in hex. There are these bytes: [B1 C7] [14 C0] [FD BF]

Start from third one. It's a code for closing door.

Goto $84: BFFD ($23FFD).
02 00 77 A6 02 00 8B A7 19 8C 08 02 00 7F A7 02 00 73 A7 01 00 67 A7

Aqua: duration of each state (in frames)
Yellow: pointers
White: another instructions

So, first 4 bytes are means "graw the graphics located at $A677 for 2 frames".

Let's go to $84:A677:
04 80 82 00 A2 00 A2 08 82 08 00 00

Legend.
Green: quantity of blocks (wide). 04 80 is 4 vertival blocks.
White: end
Red: tile number to display
Blue: block type (0 is air, 1 is slope etc. Order is the same as in SMILE when changing the type of block)]
Purple: complex.

2 high bits are used for flipping.
4:   horizontal flip
8:   vertical flip
C:   horizontal & vertical flip

2 low bits are used for tile number to display
000:   first 16*16 tile used by CRE
0FF:   last 16*16 tile used by CRE
100:   first 16*16 tile used by SCENERY
3FF:   last 16*16 tile used by SCENERY


So, new door should have new pointers leading to new tiles in SCENERY. As I mentioned, you are limited only by unused palette colors. New 16*16 door tile should use colors #4-7 (starting from 0) in any palette row to using 8*8 tiles of grey door, or color #1-3 in any palette row to using 8*8 tiles of any other door.


Quote from: gunnargumpert on April 01, 2010, 11:33:54 AM
i've got a good feeling, editing doors, but only the standard animation and the closing animation is working properly, the opening animation is from the standart red door, why JAM?
When copying one door to the place of another, then you need to rewite all bytes from 3rd door PLM pointer to these bytes: BC 86. In your case, for yellow door facing left, from 23FFD to 2405F. Code for the next door will start from 24060

personitis

Wow, who knew 4 tiles could be so complex. =) Again, thanks Jam.

gunnargumpert

#22
Quote from: JAM on April 01, 2010, 12:22:35 PM

Palette blend patch can change custom color of tiles in any room. If you change colors 1, 2 and 3 in third row (used by pink door) to the red colors, then all your pink doors will turn into red doors (but still will act like a pink doors until you change them). Any other color will not be touched in this case.
How to use the Palette blend effect?

Quote from: JAM on April 01, 2010, 12:22:35 PM
Open $84:C85A in hex. There are these bytes: [B1 C7] [14 C0] [FD BF]

Start from third one. It's a code for closing door.


what means the 1st and the 2nd byte?


every door has the same 1st byte! is that the physicspointer of the door?



-and what bank is used for this? $84 (the same) ore another bank?
-can you add new animations? (for example) solid wall with value 3F has an animation like the spikeblocks?

Smiley

Quote from: gunnargumpert on April 03, 2010, 08:56:34 AM
Quote from: JAM on April 01, 2010, 12:22:35 PM

Palette blend patch can change custom color of tiles in any room. If you change colors 1, 2 and 3 in third row (used by pink door) to the red colors, then all your pink doors will turn into red doors (but still will act like a pink doors until you change them). Any other color will not be touched in this case.
How to use the Palette blend effect
You seriously must learn to read... read the whole post, apply the IPS patch, do what the post says and you're done.

gunnargumpert

thanks!


it was good to start this topic!