Editing guard's voices

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

Editing guard's voices

Post by David »

I got this PM:
Guiguins wrote:October 11th, 2017, 7:58 am Hey,
I am currently working on a mod for PoP on Snes and I am using your tool wich I really like a lot.
There is a request however i would like to ask:
In the hacks setting, you offer the option to choose the voice type of guards. But is it actually possible to make it the other way around so I can choose wich type of voice ( or none at all ) will be used for each ennemy type?
For example if I want to change the Blue guard into a fat one or an amazone I cannot change his/ her voice wich is bugging me since i try to diversify ennemy types etc...

It could be achieved by interverting the way you offer the possibility to choose the voices:
Image

So for example instead of "Female voice" you add "Girl" , and the selection would be: normal, deeper, deeper echo voice or skel, for each ennemy time.
That would be an useful addition and a big help for me and my mod in progress.

Peace.
The problem is that it's not as easy as swapping the two columns.

This is the code in the game that handles guards' voices:

Code: Select all

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

01:CF07: a9 24       LDA #$24 ; sound: amazon is hurt
01:CF09: 80 0a       BRA $cf15

01:CF0B: a9 27       LDA #$27 ; sound: skeleton is hurt
01:CF0D: 80 06       BRA $cf15

01:CF0F: a9 2c       LDA #$2c ; sound: fat/knight is hurt
01:CF11: 80 02       BRA $cf15

01:CF13: a9 2d       LDA #$2d ; sound: Jaffar is hurt
01:CF15: 20 3a c9    JSR $c93a ; play sound effect A ; addsound
01:CF18: 4c 8a 95    JMP $958a ; play char sequence ; animchar
The current editor simply offers a way to edit the numbers after the CMPs.

To be able to do what you want, this should use a table instead of the series of comparisons.
I think I can patch the ROM like that, though...

The question is, how to integrate that to the editor?
I think the best solution would be to automatically patch the ROM to use a table (when I will have that patch), if it's not done yet in the current ROM.
Then scrap the current voice editor and add the "flipped" one that can safely assume that the table is being used.

@everyone, what do you think about this?
David
The Prince of Persia
The Prince of Persia
Posts: 2846
Joined: December 11th, 2008, 9:48 pm
Location: Hungary

Re: Editing guard's voices

Post by David »

David wrote: October 21st, 2017, 10:29 am To be able to do what you want, this should use a table instead of the series of comparisons.
I think I can patch the ROM like that, though...
Here is a hack to do that:
Open the ROM in a hex editor and go to offset xCEE0 (or xD0E0 if the ROM is headered).
First write these bytes: AE 2B 06 BD E9 CE 4C 15 CF
Then these: 15 27 27 27 24 2C 15 15 15 15 15 15 15 2C 2C 15 2D 15

The second part is the table that stores which guard should have which sound.
Its items correspond to the guard types in the editor, excluding the ones marked [BAD]:

Code: Select all

index   guard type  sound
$00 = "dead purple"   $15
$01 = "skel"          $27
$02 = "brown skel"    $27
$03 = "golden skel"   $27
$04 = "amazon"        $24
$05 = "fat"           $2C
$06 = "shadow"        $15
$07 = "green"         $15
$08 = "greenish blue" $15
$09 = "blue"          $15
$0A = "red"           $15
$0B = "purple"        $15
$0C = "blueface"      $15
$0D = "red knight"    $2C
$0E = "blue knight"   $2C
$0F = "monster"       $15
$10 = "Jaffar"        $2D
$11 = "dead"          $15
You can change those bytes however you want.

So, to take your example, if you want to change the voice of the blue guard, that's the middle $15.
If you want to make it sound like a fat guard, then change that $15 to the sound number after the fat guard, that is $2C.
User avatar
NITM-T
Sultan
Sultan
Posts: 182
Joined: July 29th, 2017, 12:10 am

Re: Editing guard's voices

Post by NITM-T »

I'm amateur like I already said, but with this code, is now possible to make 2 or more guards with female voices, too? I mean, that was I understand. Like, the level editor allow us to choose the guard type and which one will have the female or deeper voice, but we have 3 guards with deeper voices, so 3 random guards can have those voices, but girls guards, only one will have a female voice. Then, if I want the Green and Blue guards as girls, besides Girl\Amazon, is possible? 3 guards with female voices like, they are $15 and the Girl is $24, I just need to put $24 to them and they will have female voices?

You see, my The Two Princesses mod supposed to have more girls guards, but only default guard (Girl) has. So, I put more Fat and Knight guards instead and ''removed'' they deeper voices because only 3 would have that kind of voice, but if I could, I would have put all them with deeper voices and a few guards with female voices since we can change them with guard type option.

I did know that Shadow have the same voice like those Normal Guards! For me is like, a bit different or something, heh. I mean, this one could be useful for me on my Shadow's Story mod too becuase I wanted to put the Shadow's voice for the Prince and the guard that is the Prince on my mod should have the Prince's voice, you know? This could be cool.

Anyway, that was I understand here, so I'm sorry if I get all wrong :|
May the Moon light your path.
David
The Prince of Persia
The Prince of Persia
Posts: 2846
Joined: December 11th, 2008, 9:48 pm
Location: Hungary

Re: Editing guard's voices

Post by David »

NITM-T wrote: October 24th, 2017, 4:54 am I'm amateur like I already said, but with this code, is now possible to make 2 or more guards with female voices, too?
Yes.
User avatar
NITM-T
Sultan
Sultan
Posts: 182
Joined: July 29th, 2017, 12:10 am

Re: Editing guard's voices

Post by NITM-T »

Nice!
May the Moon light your path.
salvadorc17
Calif
Calif
Posts: 553
Joined: August 27th, 2011, 2:04 am

Re: Editing guard's voices

Post by salvadorc17 »

So we can use this for female fat guards...
User avatar
NITM-T
Sultan
Sultan
Posts: 182
Joined: July 29th, 2017, 12:10 am

Re: Editing guard's voices

Post by NITM-T »

David wrote: October 29th, 2017, 1:25 pm
NITM-T wrote: October 24th, 2017, 4:54 am I'm amateur like I already said, but with this code, is now possible to make 2 or more guards with female voices, too?
Yes.
David, I was wondering, would be possible for you to do the same with Special Exits? I mean, we only can use them like the original game, but like you did for us to put 2 or more guards with female voices, we will have 2 or more exits down. If is possible with HEX like the guards, could you make, please?

EDIT: I just remembered that we'll need more "falling entry" effect, too. I think those things give more troubles for advance hack stuff, but will be cool if they were possible.
May the Moon light your path.
User avatar
Shauing
Calif
Calif
Posts: 431
Joined: April 5th, 2018, 10:38 pm
Contact:

Re: Editing guard's voices

Post by Shauing »

David wrote: October 23rd, 2017, 11:57 am To be able to do what you want, this should use a table instead of the series of comparisons.
I think I can patch the ROM like that, though...


Here is a hack to do that:
Open the ROM in a hex editor and go to offset xCEE0 (or xD0E0 if the ROM is headered).
First write these bytes: AE 2B 06 BD E9 CE 4C 15 CF
Then these: 15 27 27 27 24 2C 15 15 15 15 15 15 15 2C 2C 15 2D 15
I don't quite get this. Do I have to insert or replace the values? The second part goes in the line below it or in the same line?
David wrote: October 23rd, 2017, 11:57 am
The second part is the table that stores which guard should have which sound.
Its items correspond to the guard types in the editor, excluding the ones marked [BAD]:

Code: Select all

index   guard type  sound
$00 = "dead purple"   $15
$01 = "skel"          $27
$02 = "brown skel"    $27
$03 = "golden skel"   $27
$04 = "amazon"        $24
$05 = "fat"           $2C
$06 = "shadow"        $15
$07 = "green"         $15
$08 = "greenish blue" $15
$09 = "blue"          $15
$0A = "red"           $15
$0B = "purple"        $15
$0C = "blueface"      $15
$0D = "red knight"    $2C
$0E = "blue knight"   $2C
$0F = "monster"       $15
$10 = "Jaffar"        $2D
$11 = "dead"          $15
You can change those bytes however you want.

So, to take your example, if you want to change the voice of the blue guard, that's the middle $15.
If you want to make it sound like a fat guard, then change that $15 to the sound number after the fat guard, that is $2C.
Maybe I am using a different hex editing program. Which one are all of you using?
NEW UPDATE! Prince Of Persia: 30th Anniversary Port v1.1.5. Download it today!: viewtopic.php?p=29053#p29053
NEW UPDATE! Prince Of Persia: The Queen Of Light v2.6. Download it today! viewtopic.php?p=33174#p33174
David
The Prince of Persia
The Prince of Persia
Posts: 2846
Joined: December 11th, 2008, 9:48 pm
Location: Hungary

Re: Editing guard's voices

Post by David »

Shauing wrote: April 26th, 2018, 9:25 am I don't quite get this. Do I have to insert or replace the values? The second part goes in the line below it or in the same line?
You have to replace the values. (Inserting is generally a bad idea with ROMs.)
The second part goes immediately after the first part. "In the same line" if you will.
Shauing wrote: April 26th, 2018, 9:25 am Maybe I am using a different hex editing program. Which one are all of you using?
I usually use Hexplorer or Beye (formerly BIEW), but any hex editor should work.
(What hex editor did you use?)

Note that the table that you quoted (with the names of the guard types) is just for explanation. You won't get to see it in any hex editor.
User avatar
Shauing
Calif
Calif
Posts: 431
Joined: April 5th, 2018, 10:38 pm
Contact:

Re: Editing guard's voices

Post by Shauing »

David wrote: April 28th, 2018, 12:36 pm You have to replace the values. (Inserting is generally a bad idea with ROMs.)
The second part goes immediately after the first part. "In the same line" if you will.
Thank you. I thought the second part was located somewhere; As I didn't find it, I was not sure if I had too add said second part next to or below the first line.
David wrote: April 28th, 2018, 12:36 pm I usually use Hexplorer or Beye (formerly BIEW), but any hex editor should work.
(What hex editor did you use?)

Note that the table that you quoted (with the names of the guard types) is just for explanation. You won't get to see it in any hex editor.
I am using wxHexEditor. I did manage to do the 'guards falling to next room without dying' hack in it.

So, that table is just to know which value is for each voice? If so, if I want everyone but the skeletons and monster to have the amazon voice,
the second line should be written: 15 27 27 27 24 24 24 24 24 24 24 24 24 24 24 15 24 24?
NEW UPDATE! Prince Of Persia: 30th Anniversary Port v1.1.5. Download it today!: viewtopic.php?p=29053#p29053
NEW UPDATE! Prince Of Persia: The Queen Of Light v2.6. Download it today! viewtopic.php?p=33174#p33174
David
The Prince of Persia
The Prince of Persia
Posts: 2846
Joined: December 11th, 2008, 9:48 pm
Location: Hungary

Re: Editing guard's voices

Post by David »

Shauing wrote: April 29th, 2018, 8:09 am So, that table is just to know which value is for each voice? If so, if I want everyone but the skeletons and monster to have the amazon voice,
the second line should be written: 15 27 27 27 24 24 24 24 24 24 24 24 24 24 24 15 24 24?
Yes.
But you forgot to change the dead purple guard's voice. (It's the first number.)
User avatar
Shauing
Calif
Calif
Posts: 431
Joined: April 5th, 2018, 10:38 pm
Contact:

Re: Editing guard's voices

Post by Shauing »

David wrote: April 29th, 2018, 2:55 pm
Shauing wrote: April 29th, 2018, 8:09 am So, that table is just to know which value is for each voice? If so, if I want everyone but the skeletons and monster to have the amazon voice,
the second line should be written: 15 27 27 27 24 24 24 24 24 24 24 24 24 24 24 15 24 24?
Yes.
But you forgot to change the dead purple guard's voice. (It's the first number.)
Oh, that's right.

By the way, what are those ''dead purple'', ''dead'' guards, and the ones classified as [BAD] in the ''select guard type''?
NEW UPDATE! Prince Of Persia: 30th Anniversary Port v1.1.5. Download it today!: viewtopic.php?p=29053#p29053
NEW UPDATE! Prince Of Persia: The Queen Of Light v2.6. Download it today! viewtopic.php?p=33174#p33174
David
The Prince of Persia
The Prince of Persia
Posts: 2846
Joined: December 11th, 2008, 9:48 pm
Location: Hungary

Re: Editing guard's voices

Post by David »

Shauing wrote: April 30th, 2018, 1:58 am By the way, what are those ''dead purple'', ''dead'' guards, and the ones classified as [BAD] in the ''select guard type''?
The two "dead" guards are valid but unused guard types that have 0 HP by default, so they will die immediately when you enter their room.
You can give them more HP in the editor (Guards -> Settings) and use them like the other guard types.
Or you can keep them with 0 HP and place them near a kill potion, as a warning. :) I have actually seen that in a mod once.

The "[BAD]" guards are invalid guard types that will display garbage images and may even hang the game.
User avatar
Shauing
Calif
Calif
Posts: 431
Joined: April 5th, 2018, 10:38 pm
Contact:

Re: Editing guard's voices

Post by Shauing »

David wrote: April 30th, 2018, 10:29 am The two "dead" guards are valid but unused guard types that have 0 HP by default, so they will die immediately when you enter their room.
You can give them more HP in the editor (Guards -> Settings) and use them like the other guard types.
Or you can keep them with 0 HP and place them near a kill potion, as a warning. :) I have actually seen that in a mod once.
Oh, that's an interesting idea. In my mod, I do try to give at least some hint about everything but trying to not give everything away.
David wrote: April 30th, 2018, 10:29 am The "[BAD]" guards are invalid guard types that will display garbage images and may even hang the game.
Oh? Why they are even an option? Do they have any function/purpose at all? (i.e. like some sort of foreground/background element?)
NEW UPDATE! Prince Of Persia: 30th Anniversary Port v1.1.5. Download it today!: viewtopic.php?p=29053#p29053
NEW UPDATE! Prince Of Persia: The Queen Of Light v2.6. Download it today! viewtopic.php?p=33174#p33174
User avatar
Norbert
The Prince of Persia
The Prince of Persia
Posts: 5743
Joined: April 9th, 2009, 10:58 pm

Re: Editing guard's voices

Post by Norbert »

Shauing wrote: April 30th, 2018, 8:26 pmOh? Why they are even an option? Do they have any function/purpose at all? (i.e. like some sort of foreground/background element?)
This is an interesting question. I'm sure David will answer, but I'll guess why. :) In the SNES level format, for reach room, the bottom 7 bits of the type/direction byte specify the guard type. These 7 bits can contain values from from 0 (0000000) to 128 (1111111; 2^7), but most display garbage or hang the game. The first two (0, 1) were probably included in the list to make it start at the actual start (0). The last 5 appear to be picked arbitrarily, but maybe the list continues up to and including 24 (0x18) because that's the max. amount for certain other things (24 rooms and thus 24 guards). Another possibility is that these 'bad' bits are used in the original game, but in unused rooms (that may or may not have actual guards in them).
Post Reply