Editing guard's voices

A modern Prince of Persia 1 for SNES level editor for Windows.

Moderator: English Moderator Team

Post Reply
David
The Prince of Persia
The Prince of Persia
Posts: 1506
Joined: December 11th, 2008, 9:48 pm
Location: Hungary

Editing guard's voices

Post by David » October 21st, 2017, 10:29 am

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: 1506
Joined: December 11th, 2008, 9:48 pm
Location: Hungary

Re: Editing guard's voices

Post by David » October 23rd, 2017, 11:57 am

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
Beylerbey
Beylerbey
Posts: 58
Joined: July 29th, 2017, 12:10 am

Re: Editing guard's voices

Post by NITM-T » 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? 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 and together, we will open the way at Grand Clock.

David
The Prince of Persia
The Prince of Persia
Posts: 1506
Joined: December 11th, 2008, 9:48 pm
Location: Hungary

Re: Editing guard's voices

Post by David » 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.

User avatar
NITM-T
Beylerbey
Beylerbey
Posts: 58
Joined: July 29th, 2017, 12:10 am

Re: Editing guard's voices

Post by NITM-T » October 30th, 2017, 3:11 am

Nice!
May the Moon light your path and together, we will open the way at Grand Clock.

Post Reply