Level editor for the SNES version

A modern Prince of Persia 1 for SNES level editor for Windows.
David
The Prince of Persia
The Prince of Persia
Posts: 2846
Joined: December 11th, 2008, 9:48 pm
Location: Hungary

Re: Level editor for the SNES version

Post by David »

Norbert wrote: What is currently the quickest way to playtest, for example, level 5? I think manually starting ZSNES (or a similar emulator) and entering the password for level 5?
Another solution is to add a cheat that sets location 7E0544 to the number of the level you want to test.
But different emulators might have different formats for cheat files, so this is not easy to do from the editor.
On changing the ROM: I found where the starting level is stored in the ROM: search for A9 00 8D 79 05, replace 00 with the number of the level.
Probably the intro should also be skipped.
Norbert wrote: Can you include a menu option for this? I don't know much about Windows, but if ZSNES (or Snes9x or whatever) is in the $PATH, I guess it could work without including ZSNES in the package? Although zsnesw.exe is not that big (581K) and could be included.
Or maybe there could be an option where users could select what emulator to use. (The location of the exe.)
Norbert wrote: How to quickly reach level 5? Maybe temporarily change some bytes to force the game to start in that level? What about the IPS patch, maybe have the program apply it, or include Floating IPS in the package (it's GPL'ed) and use that? It would be nice if playtesting were easier.
Some emulators can apply IPS patches automatically. (Both ZSNES and Snes9x mentinon it in their docs.)
Therefore it's enough if the editor makes an IPS file.
User avatar
robert
Sultan
Sultan
Posts: 194
Joined: August 27th, 2011, 7:16 pm
Location: Argentina

Re: Level editor for the SNES version

Post by robert »

I've been editing some graphics in level 17 of my next mod, when I had again that warning "Last resource doesn't fit into its place! Do you still want to save?" ... So I went to the forum and took a look to previous posts to see what should I do, when I saw this specific part (which is in page 9 in some reply from David):
David wrote: However, if you re-save the unchanged *levels*, then you'll really have more space, because original levels that are re-saved by the editor are compressed better than the original. (Except Jaffar's level.)
I'm not so sure about what it means. Levels 18 onwards are not touched yet, so if I re-save them, will the rom have more space? Or what should I do? I don't want to screw up :?

(Clarifying, I'm using last version of the editor, and the hacked rom provided by Kaslghnoon)

Another thing:

Is there any way to make one single guard (eg: dead guard) to behave like a normal, brown, or golden skeleton?
Image
This will be my face if you can't win any of my mods
salvadorc17
Calif
Calif
Posts: 553
Joined: August 27th, 2011, 2:04 am

Re: Level editor for the SNES version

Post by salvadorc17 »

Is there any way to make one single guard (eg: dead guard) to behave like a normal, brown, or golden skeleton?
Ey, i was wondering that too, also why not to include some avaliable hacks into the editor like the one for pc version...??
David
The Prince of Persia
The Prince of Persia
Posts: 2846
Joined: December 11th, 2008, 9:48 pm
Location: Hungary

Re: Level editor for the SNES version

Post by David »

robert wrote:I'm not so sure about what it means. Levels 18 onwards are not touched yet, so if I re-save them, will the rom have more space?
You could try that.
(I should really figure out something for this. (*))
robert wrote:Or what should I do? I don't want to screw up :?
You should first make a backup of your edited rom (or export your changed levels) in case something goes wrong.

(*) An option would be to increase the size of the rom, push the sprite/sound tables to later addresses, and alter the addresses in references to them.
Then there would be enough place for the levels.
User avatar
robert
Sultan
Sultan
Posts: 194
Joined: August 27th, 2011, 7:16 pm
Location: Argentina

Re: Level editor for the SNES version

Post by robert »

I've done that (re-saving original levels), and apparently worked for now. Thanks for claryfing that.

What about the skeleton thing?
Image
This will be my face if you can't win any of my mods
David
The Prince of Persia
The Prince of Persia
Posts: 2846
Joined: December 11th, 2008, 9:48 pm
Location: Hungary

Re: Level editor for the SNES version

Post by David »

robert wrote:What about the skeleton thing?
I could change the "dead purple" guard to unkillable.

Code: Select all

01:8A23: c9 01       CMP #$01 ; GuardType skel
01:8A25: f0 04       BEQ $8a2b
01:8A27: c9 02       CMP #$02 ; GuardType brown skel
01:8A29: d0 06       BNE $8a31
01:8A2B: a9 04       LDA #$04 ; CharType skel
01:8A2D: 8d 64 04    STA $0464
01:8A30: 60          RTS
Search: C9 01 F0 04 C9 02 D0 06
Change to: C9 00 B0 04 C9 02 10 06
You also need to set more than zero HP in Guards->Settings.

There is a similar hack here: viewtopic.php?p=14873#p14873
That hack changes all guards.
User avatar
robert
Sultan
Sultan
Posts: 194
Joined: August 27th, 2011, 7:16 pm
Location: Argentina

Re: Level editor for the SNES version

Post by robert »

Worked well! Little potion bottles (lives) don't appear, the skel seems to have unlimited lives, but there's no battle music, and it "groans" as a guard. Is it possible to change these things?
Image
This will be my face if you can't win any of my mods
David
The Prince of Persia
The Prince of Persia
Posts: 2846
Joined: December 11th, 2008, 9:48 pm
Location: Hungary

Re: Level editor for the SNES version

Post by David »

robert wrote:and it "groans" as a guard.
Sound effect when kid hurts a guard:

Code: Select all

guard hurt by sword:
01:CEE0: ad 2b 06    LDA $062b ; guard type
01:CEE3: c9 04       CMP #$04 ; GT amazon
01:CEE5: f0 20       BEQ $cf07
01:CEE7: c9 01       CMP #$01 ; GT skeleton
01:CEE9: f0 20       BEQ $cf0b
01:CEEB: c9 02       CMP #$02 ; GT brown skeleton
01:CEED: f0 1c       BEQ $cf0b
01:CEEF: c9 03       CMP #$03 ; GT golden skeleton
01:CEF1: f0 18       BEQ $cf0b
01:CEF3: c9 05       CMP #$05 ; GT fat
01:CEF5: f0 18       BEQ $cf0f
01:CEF7: c9 0d       CMP #$0d ; GT red knight
01:CEF9: f0 14       BEQ $cf0f
01:CEFB: c9 0e       CMP #$0e ; GT blue knight
01:CEFD: f0 10       BEQ $cf0f
01:CEFF: c9 10       CMP #$10 ; GT Jaffar
01:CF01: f0 10       BEQ $cf13
01:CF03: a9 15       LDA #$15 ; SND kid pokes guard/monster/shadow
01:CF05: 80 0e       BRA $cf15

01:CF07: a9 24       LDA #$24 ; SND kid pokes amazon
01:CF09: 80 0a       BRA $cf15

01:CF0B: a9 27       LDA #$27 ; SND kid pokes skeleton
01:CF0D: 80 06       BRA $cf15

01:CF0F: a9 2c       LDA #$2c ; SND kid pokes fat/knight
01:CF11: 80 02       BRA $cf15

01:CF13: a9 2d       LDA #$2d ; SND kid pokes Jaffar
01:CF15: 20 3a c9    JSR $c93a ; play sound effect A
01:CF18: 4c 8a 95    JMP $958a ; play char sequence
(Note to self: For easier editing, this part could be rewritten to use an array.)

Search: C9 01 F0 20
Replace: C9 02 30 20
robert wrote:but there's no battle music,
I'm not sure what do you mean.
There is battle music while the kid is holding the sword.
Or do you want a boss battle music?
robert wrote: Little potion bottles (lives) don't appear, the skel seems to have unlimited lives,
This was done by the first hack.
Do you want something else instead?
Or do these belong to "Worked well!"?
salvadorc17
Calif
Calif
Posts: 553
Joined: August 27th, 2011, 2:04 am

Re: Level editor for the SNES version

Post by salvadorc17 »

David wrote:
robert wrote:What about the skeleton thing?
I could change the "dead purple" guard to unkillable.

You also need to set more than zero HP in Guards->Settings.
That hack changes all guards.
Yes, will be some good if there is an option to made guards unvencible into the editor, also for some other hacked stuff, like battle music...
User avatar
robert
Sultan
Sultan
Posts: 194
Joined: August 27th, 2011, 7:16 pm
Location: Argentina

Re: Level editor for the SNES version

Post by robert »

David wrote:
robert wrote:and it "groans" as a guard.
Sound effect when kid hurts a guard:

Code: Select all

guard hurt by sword:
01:CEE0: ad 2b 06    LDA $062b ; guard type
01:CEE3: c9 04       CMP #$04 ; GT amazon
01:CEE5: f0 20       BEQ $cf07
01:CEE7: c9 01       CMP #$01 ; GT skeleton
01:CEE9: f0 20       BEQ $cf0b
01:CEEB: c9 02       CMP #$02 ; GT brown skeleton
01:CEED: f0 1c       BEQ $cf0b
01:CEEF: c9 03       CMP #$03 ; GT golden skeleton
01:CEF1: f0 18       BEQ $cf0b
01:CEF3: c9 05       CMP #$05 ; GT fat
01:CEF5: f0 18       BEQ $cf0f
01:CEF7: c9 0d       CMP #$0d ; GT red knight
01:CEF9: f0 14       BEQ $cf0f
01:CEFB: c9 0e       CMP #$0e ; GT blue knight
01:CEFD: f0 10       BEQ $cf0f
01:CEFF: c9 10       CMP #$10 ; GT Jaffar
01:CF01: f0 10       BEQ $cf13
01:CF03: a9 15       LDA #$15 ; SND kid pokes guard/monster/shadow
01:CF05: 80 0e       BRA $cf15

01:CF07: a9 24       LDA #$24 ; SND kid pokes amazon
01:CF09: 80 0a       BRA $cf15

01:CF0B: a9 27       LDA #$27 ; SND kid pokes skeleton
01:CF0D: 80 06       BRA $cf15

01:CF0F: a9 2c       LDA #$2c ; SND kid pokes fat/knight
01:CF11: 80 02       BRA $cf15

01:CF13: a9 2d       LDA #$2d ; SND kid pokes Jaffar
01:CF15: 20 3a c9    JSR $c93a ; play sound effect A
01:CF18: 4c 8a 95    JMP $958a ; play char sequence
(Note to self: For easier editing, this part could be rewritten to use an array.)

Search: C9 01 F0 20
Replace: C9 02 30 20
It worked. The skel now groans as a normal skel.
David wrote:
robert wrote:but there's no battle music,
I'm not sure what do you mean.
There is battle music while the kid is holding the sword.
Or do you want a boss battle music?
I mean that the music doesn't turn into battle music when the prince faces the skel, it keeps the generic level music. If you need, I can send the .rom via PM so you can see it by yourself.
David wrote:
robert wrote: Little potion bottles (lives) don't appear, the skel seems to have unlimited lives,
This was done by the first hack.
Do you want something else instead?
Or do these belong to "Worked well!"?
Oh no no, they belong to "Worked well!". Sorry to confuse you.

Edit: Wait! I've just realised that the hack didn't only modify the "dead purple", also the "purple" guard. He behaves now like a skeleton too. David, I think it should better if I send you the .rom, shouldn't it?
Image
This will be my face if you can't win any of my mods
David
The Prince of Persia
The Prince of Persia
Posts: 2846
Joined: December 11th, 2008, 9:48 pm
Location: Hungary

Re: Level editor for the SNES version

Post by David »

robert wrote: Edit: Wait! I've just realised that the hack didn't only modify the "dead purple", also the "purple" guard. He behaves now like a skeleton too.
Actually, it modifies *all* guards. I messed up the conditional jumps.

Correction:
Search: C9 01 F0 04 C9 02 D0 06
Change to: C9 00 B0 04 C9 02 10 06 WRONG!
Change to: C9 00 90 0A C9 03 B0 06
(You already applied the wrong change, so you have to search for the bytes in the "wrong" line.)
robert wrote: I mean that the music doesn't turn into battle music when the prince faces the skel, it keeps the generic level music. If you need, I can send the .rom via PM so you can see it by yourself.
Right, then send it.
Remember, the battle music starts only when the kid draws his sword.
User avatar
robert
Sultan
Sultan
Posts: 194
Joined: August 27th, 2011, 7:16 pm
Location: Argentina

Re: Level editor for the SNES version

Post by robert »

David wrote: (You already applied the wrong change, so you have to search for the bytes in the "wrong" line.)
Worked.
David wrote:Right, then send it.
Remember, the battle music starts only when the kid draws his sword.
I've just sent you the rom.

There's another thing that I've noticed but this time with the level editor. Now that you might have my rom, you can see it by yourself. I'll try to explain with an example and images:

1. I select a random tile from a random room, I want to edit that tile.
http://postimg.org/image/ag5ivd9pt/

2. Then I place tile A0, no attributes, just a blank tile.
http://postimg.org/image/8n2m71oj5/

3. I select wall attribute and some wall graphic. Now tile A0 is supposed to be a normal wall.
http://postimg.org/image/7akx55r3l/

4. I click the tile that is supposed to be A0, and it's another one (02), with the same attributes.
http://postimg.org/image/slih9f981/

5. I go to see tile A0, and it is blank, like if it has never been edited.
http://postimg.org/image/jst6g8gt5/

6. If I re-do the process, the same happens.

I'm not so sure if it is clear. I don't want to be tiresome, but this didn't happen to me before.
Image
This will be my face if you can't win any of my mods
David
The Prince of Persia
The Prince of Persia
Posts: 2846
Joined: December 11th, 2008, 9:48 pm
Location: Hungary

Re: Level editor for the SNES version

Post by David »

robert wrote: I've just sent you the rom.
Right, I will look into it.
robert wrote: 4. I click the tile that is supposed to be A0, and it's another one (02), with the same attributes.
What you wrote happens if Mode->Automatic is selected.
If you want to edit tile A0 itself, then select Mode->Manual.

By the way, is there any reason why it must be tile A0?
David
The Prince of Persia
The Prince of Persia
Posts: 2846
Joined: December 11th, 2008, 9:48 pm
Location: Hungary

Re: Level editor for the SNES version

Post by David »

robert wrote: I mean that the music doesn't turn into battle music when the prince faces the skel, it keeps the generic level music.
Ah, it seems that the game treats battle music on level 17 specially.
Remember, the original level 17 has the six-armed monster.
It has a special music, which stops only when you kill him.

To enable battle music on level 17: (for non-monster opponents)
search: AD 79 05 C9 10 F0 22
replace: 10 -> CC

To stop battle music on level 17 when the kid puts his sword away:
search: AD 79 05 C9 10 D0 21
replace: 10 -> CC
User avatar
robert
Sultan
Sultan
Posts: 194
Joined: August 27th, 2011, 7:16 pm
Location: Argentina

Re: Level editor for the SNES version

Post by robert »

David wrote:What you wrote happens if Mode->Automatic is selected.
If you want to edit tile A0 itself, then select Mode->Manual.
Oh I see, I guess I missed that those times :oops:
David wrote:By the way, is there any reason why it must be tile A0?
Nop, it was just an example.
David wrote:Ah, it seems that the game treats battle music on level 17 specially.
Remember, the original level 17 has the six-armed monster.
It has a special music, which stops only when you kill him.

To enable battle music on level 17: (for non-monster opponents)
search: AD 79 05 C9 10 F0 22
replace: 10 -> CC

To stop battle music on level 17 when the kid puts his sword away:
search: AD 79 05 C9 10 D0 21
replace: 10 -> CC
Will this affect the monster's battle music too? Or is a hack for any other opponent excluding the monster?
Image
This will be my face if you can't win any of my mods
Post Reply