Greetings from Italy

New on the forum? Introduce yourself here and be welcomed!
Post Reply
Doktor Headshot
Scholar Scribe
Scholar Scribe
Posts: 4
Joined: May 10th, 2016, 10:49 pm

Greetings from Italy

Post by Doktor Headshot »

Hello everyone,
I am Doktor Headshot and, as the most of people here (I guess), I was basically born with original DOS Prince of Persia which the first videogame I ever played in the early '90s. I recently had a nostalgic feeling about POP so I downloaded that wonderful Total Pack tool together with all mods and started playing them one by one in order. Some days ago, I finished "4D_Prince" and then I moved to "The Great Escape"...

You know, seeing lot of mods and playing them make you think it is easy to make one and make you want to make one... Indeed, I've just made a full translation of POP1 into my native Italian language (ready to be shared on POPOT and POPUW) and... Who knows? In the future, I might want to make my first mod once I get all the basics of Apoplexy (thank Norbert for this wonderful tool) and of POP hex-editing which now are very limited. I'd like to take this hot chance, to ask two quick questions related to hex-editing:
  • 1) Background music. I am thinking about music played in level 1 when Prince get "dumped" in the dungeon. It is possible to access that command via hex-editor and assign it to every level start? Next step would be replacing original midi file with new one via PR and then we would have background music...

    2) Guard skills. I read document supplied in POPOT website about guard type but I don't know where I can edit those value in order to create guards with customized skills. Where can I edit each value (strikingprob, blockingstrikeprob, goingintorange, etc.) for every single guard in every level?
Many thanks for reading and replying!
User avatar
Norbert
The Prince of Persia
The Prince of Persia
Posts: 5743
Joined: April 9th, 2009, 10:58 pm

Re: Greetings from Italy

Post by Norbert »

Hi Doktor Headshot, welcome.
Doktor Headshot wrote:1) Background music.
Someone who is familiar with the PoP1 disassembly, like David, probably won't have much difficulty finding the offset to change the level check into something different.
Doktor Headshot wrote:2) Guard skills. I read document supplied in POPOT website about guard type but I don't know where I can edit those value in order to create guards with customized skills. Where can I edit each value (strikingprob, blockingstrikeprob, goingintorange, etc.) for every single guard in every level?
I can give you information about this. You can edit these values only per guard type - also called skill, and there are 12 guard types total. Their decimal values can be found in the PDF document you're referring to, and also at the beginning of SDLPoP's seg002.c file. These values are stored inside the PRINCE.EXE file, as word units (= two bytes). This means that, if you convert, for example, all "strikeprob"/"Striking Prob." values to hexadecimal words, you get a series of bytes that you can search for inside PRINCE.EXE. For this example, that series of bytes is "3D 00 64 00 3D 00 3D 00 3D 00 28 00 64 00 DC 00 00 00 30 00 20 00 30 00". In (at least) the unpacked 1.0 version of PoP1, these bytes start at offset 0x1D3C2. With this knowledge you can hex edit PRINCE.EXE (instructions here) and change the properties of the 12 different guards.
User avatar
doppelganger
Vizier
Vizier
Posts: 119
Joined: April 24th, 2015, 9:04 am
Location: India

Re: Greetings from Italy

Post by doppelganger »

Welcome, Doctor!
Doppelgänger
Hmm.. These mortals know about me.. :evil:

Download 'Hell of A Palace' now from Popot!
David
The Prince of Persia
The Prince of Persia
Posts: 2846
Joined: December 11th, 2008, 9:48 pm
Location: Hungary

Re: Greetings from Italy

Post by David »

Doktor Headshot wrote:Background music. I am thinking about music played in level 1 when Prince get "dumped" in the dungeon. It is possible to access that command via hex-editor and assign it to every level start?
Maybe, but currently it starts only when the prince crouches for the first time.
Doktor Headshot wrote:Next step would be replacing original midi file with new one via PR and then we would have background music...
But then the sound effects would either interrupt the music, or they would not play at all, depending on the sounds' priorities.
(Think of the slow-fall music.)

Unless we change play_next_sound() to start the background music everytime a sound effect ends.
Hmm... Maybe this alone is enough and we don't need to hack the level 1 crouch music?

Here is my first attempt:

Code: Select all

seg000:134B C7 06 62 40 FF FF                    mov     next_sound, 0FFFFh
seg000:1351 5E                                   pop     si
seg000:1352 CB                                   retf
Search: C7 06 62 40 FF FF 5E CB
Change: FF FF -> 19 00 (Or the ID of whatever sound you want to use.)

But this will disable all sound effects, as I mentioned above.

Maybe it would be easier to change SDLPoP...
Doktor Headshot
Scholar Scribe
Scholar Scribe
Posts: 4
Joined: May 10th, 2016, 10:49 pm

Re: Greetings from Italy

Post by Doktor Headshot »

Norbert wrote:Hi Doktor Headshot, welcome.
doppelganger wrote:Welcome, Doctor!
Nice to meet you all, guys!
Norbert wrote: I can give you information about this. You can edit these values only per guard type - also called skill, and there are 12 guard types total. Their decimal values can be found in the PDF document you're referring to, and also at the beginning of SDLPoP's seg002.c file. These values are stored inside the PRINCE.EXE file, as word units (= two bytes). This means that, if you convert, for example, all "strikeprob"/"Striking Prob." values to hexadecimal words, you get a series of bytes that you can search for inside PRINCE.EXE. For this example, that series of bytes is "3D 00 64 00 3D 00 3D 00 3D 00 28 00 64 00 DC 00 00 00 30 00 20 00 30 00". In (at least) the unpacked 1.0 version of PoP1, these bytes start at offset 0x1D3C2. With this knowledge you can hex edit PRINCE.EXE (instructions here) and change the properties of the 12 different guards.
Thank you, you explained like a charm and I exactly got what I asked for. Let me return a pdf containing a table chart with all guard skills expressed both in decimal value and in hexadecimal words ready to be searched and edited in "PRINCE.EXE" (basically is a simplified version of your document with pre-made series of bytes ready to be copy/pasted in the hex-editor for customization). Hopefully it can be of some use for modders.
David wrote:Maybe, but currently it starts only when the prince crouches for the first time.
David wrote:Unless we change play_next_sound() to start the background music everytime a sound effect ends.
Hello David, thanks for your reply. I experimented a bit before I got your reply by " PR'ing " a custom type-0 midi file in place of "presentation.mid" and here what I got: midi exactly started playing after the Prince landed and Prince was forced to stay crouched until midi ended (then, Prince stood up and I moved him again). The same happened when I applied your trick with many different IDs after I " PR'ed " original "presentation.mid" back. General game behaviour was: force-crouched Prince, ID-specified tune played before "presentation.mid", "presentation.mid" played, Prince stood up. However, game behaved in a slight different way with slowfall music (ID 27): force-crouched Prince, no playing of "presentation.mid", double loop of slowfall music and Prince stood up on third loop. All sound were disabled as you predicted but I was able to finish Level 1. On Level 2 start, door closing sound looped endlessly. On a side note: when Prince died by spikes, there was no "Press a Button to Continue" nor chance to reboot level in that way (I had to use CTRL + A).

All in all, bgm implementation doesn't seem that "painless" as I thought at first: there are some compromises the player should take in account like force-crouched prince, music loop wait and disabled sfx. On the other hand, slowfall music might be the way to bring bgm in Prince 1 by allowing it to be played right after big level door closing sound on any level start. That's would be a bait for hard-cored developers which are willing to explore bgm implementation.
Attachments
Guard type.pdf
Guard type reference chart with all guard skills expressed both in decimal value and in hexadecimal words ready to be searched and edited in "PRINCE.EXE".
(56.73 KiB) Downloaded 87 times
User avatar
Norbert
The Prince of Persia
The Prince of Persia
Posts: 5743
Joined: April 9th, 2009, 10:58 pm

Re: Greetings from Italy

Post by Norbert »

Doktor Headshot wrote:Let me return a pdf containing a table chart with all guard skills expressed both in decimal value and in hexadecimal words ready to be searched [...]
The next step might be to search the offsets of those strings in the unpacked and - if present - packed executables that CusPop uses.
http://www.popot.org/other_useful_tools ... p_exes.zip
For example "bin.p0" is the packed ("p") version 1.0 ("0") of PRINCE.EXE.
These offsets can then be used in the XML file that CusPop uses. The most recent XML version is:
http://www.popot.org/other_useful_tools ... cehack.xml
Then the latest version of CusPop itself could be modified, and eventually the web-based CusPop (here, here) could also include options to edit all these guard properties.
User avatar
oitofelix
Wise Scribe
Wise Scribe
Posts: 227
Joined: February 17th, 2016, 1:59 pm
Location: Brazil
Contact:

Re: Greetings from Italy

Post by oitofelix »

Hello Doktor!
Doktor Headshot wrote:
  • 1) Background music.
This will be very easy to accomplish as soon as MININIM gets Guile scripting support.
Doktor Headshot wrote: 2) Guard skills.[/list]
MININIM allows you to fine-tune the skills for each particular guard in any given level. This feature is available from its in-game editor, implemented in the VCS version.
Bruno Félix Rezende Ribeiro (oitofelix)
MININIM author
Post Reply