4D prince guards

Windows and Linux editor of PoP1 (for DOS and SNES) and PoP2 (for DOS).
emrtss
Efendi
Efendi
Posts: 10
Joined: November 8th, 2014, 11:15 pm

4D prince guards

Post by emrtss »

Some guards in Prince of Persia 4D look really weird, this is not due to graphical modifications as it changes with the levels.dat.
I was simply wondering how he had done this, below is a picture of how it looks in apoplexy.
http://i.imgur.com/11opLiN.png
User avatar
Norbert
The Prince of Persia
The Prince of Persia
Posts: 5743
Joined: April 9th, 2009, 10:58 pm

Re: 4D prince guards

Post by Norbert »

That particular guard's color is 254 (0xFE), which is outside the (0-6) range the game is build to work with.

As you can read on page 16 of this document:
"Other codes may generate random colours because the game is reading the palette from trashed memory. This may also cause a game crash."
This is why the guard looks strange in-game:

Image
(mirror)

What you see in the image you posted is how apoplexy displays guards with colors outside the regular 0-6 range.
emrtss
Efendi
Efendi
Posts: 10
Joined: November 8th, 2014, 11:15 pm

Re: 4D prince guards

Post by emrtss »

Thanks for your answer, would it be possible to edit the guard color outside the range of 0-6 in apoplexy? Or would I have to modify my prince.exe for that?
emrtss
Efendi
Efendi
Posts: 10
Joined: November 8th, 2014, 11:15 pm

Re: 4D prince guards

Post by emrtss »

You've got to excuse me for my ignorance, but I have got yet another question for you. In the apoplexy editor itselfl, some tiles are marked with a red exclaimation mark. I've seen one of these being used in the Repetition of time mod, however upon trying those myself all it did was creating graphical errors (distorting the level). Are there any use for these tiles at all?
User avatar
Norbert
The Prince of Persia
The Prince of Persia
Posts: 5743
Joined: April 9th, 2009, 10:58 pm

Re: 4D prince guards

Post by Norbert »

emrtss wrote:Thanks for your answer, would it be possible to edit the guard color outside the range of 0-6 in apoplexy? Or would I have to modify my prince.exe for that?
Currently, apoplexy only allows users to place regular guards of the seven (0-6) color combinations the game itself is build to work with.

If you want the game to generate colors based on trashed memory (like 4D Prince of Persia), then you would have to modify LEVELS.DAT with a hex editor to set a color greater than 6. However, if the document I cited above is correct, then the change could result in a game crash.

Another, better solution would be to modify the regular seven color combinations by editing PRINCE.EXE. As far as I know, CusPop has no options to do this (yet).
User avatar
Norbert
The Prince of Persia
The Prince of Persia
Posts: 5743
Joined: April 9th, 2009, 10:58 pm

Re: 4D prince guards

Post by Norbert »

emrtss wrote:Are there any use for these tiles at all?
The short answer is: no. They are there only to make the tile locations on the 'tiles screen' the same for the dungeon and palace environments. For example, on the tiles screen for dungeon levels, the first tile with an exclamation mark is where the mirror is on the tiles screen for palace levels. This makes it easier for mod authors to remember the tile locations. The longer answer is: some of them actually show stuff without distortion, but the visuals depend on the where the tiles are being used. Also, distortions could make levels quite tricky. ;) Finally, I wouldn't be surprised if it's possible to somehow add, for example, the mirror resource to dungeon levels.
David
The Prince of Persia
The Prince of Persia
Posts: 2846
Joined: December 11th, 2008, 9:48 pm
Location: Hungary

Re: 4D prince guards

Post by David »

Norbert wrote:because the game is reading the palette from trashed memory
The color of the weird guards changes if I start the game with the stdsnd parameter (pcspeaker mode).
Maybe that memory is related to sounds?
Norbert wrote:Another, better solution would be to modify the regular seven color combinations by editing PRINCE.EXE.
They are stored in PRINCE.DAT, PR exports it as "guard palettes.pal".
Norbert wrote:That particular guard's color is 254 (0xFE), which is outside the (0-6) range the game is build to work with.
Actually, the regular guards use 1-7, and the "special" ones (fat, Jaffar) use 0 (but the color is ignored for them).
And that weird guard has color 0xFF. (level 2 room 23)
But I see that Apoplexy subtracts 1 from the color, so that explains the differences.
emrtss wrote:some tiles are marked with a red exclaimation mark. I've seen one of these being used in the Repetition of time mod
Do you mean level 12, room 15?
That level is changed to palace in the mod's PRINCE.EXE.
Norbert wrote:Finally, I wouldn't be surprised if it's possible to somehow add, for example, the mirror resource to dungeon levels.
It's possible:
* In resources.xml, copy the mirror section from the vpalace section to the vdungeon section.
* Export both DAT files.
* Copy the mirror folder from vpalace to vdungeon.
* Reimport vdungeon.
* Place a mirror on a dungeon level. (In Apoplexy, it's on the left side of the broken floor.)

This is the result:
A mirror in the dungeon.
A mirror in the dungeon.
dungeon_mirror.png (3.99 KiB) Viewed 9146 times
If you want to change those images, you should fix the palettes of the BMP files.
(They still have the vpalace palette, but the game will use the vdungeon palette.)
The easiest way to do this is to re-export vdungeon.
User avatar
Norbert
The Prince of Persia
The Prince of Persia
Posts: 5743
Joined: April 9th, 2009, 10:58 pm

Re: 4D prince guards

Post by Norbert »

David wrote:
Norbert wrote:Another, better solution would be to modify the regular seven color combinations by editing PRINCE.EXE.
They are stored in PRINCE.DAT, PR exports it as "guard palettes.pal".
Ah, yes. What a weird location (prince/binary/) for that PAL file.
I was looking at the PAL files in guards/ (that contain just 0's) and unjustly concluded the colors had to be set in PRINCE.EXE.
David wrote:
emrtss wrote:some tiles are marked with a red exclaimation mark. I've seen one of these being used in the Repetition of time mod
Do you mean level 12, room 15?
That level is changed to palace in the mod's PRINCE.EXE.
Yep, that's the location emrtss meant. (See the chat history, 2014-11-08 23:11:58 and further.) emrtss had copied over just the LEVELS.DAT file, and not also the PRINCE.EXE file. If the latter is also added to prince/, then apoplexy (2.6b and newer) will automatically show the correct environment.
User avatar
Emiliano
Wizard Scribe
Wizard Scribe
Posts: 718
Joined: July 31st, 2019, 8:53 pm
Location: Mexico
Contact:

Re: 4D prince guards

Post by Emiliano »

Norbert wrote: November 8th, 2014, 11:46 pm That particular guard's color is 254 (0xFE), which is outside the (0-6) range the game is build to work with.

As you can read on page 16 of this document:
"Other codes may generate random colours because the game is reading the palette from trashed memory. This may also cause a game crash."
This is why the guard looks strange in-game:

Image
(mirror)

What you see in the image you posted is how apoplexy displays guards with colors outside the regular 0-6 range.
But, why In dosbox you see them like this, but in the old computers they look completely green?
I played it in my dad's computer and it looks green
65536
User avatar
Norbert
The Prince of Persia
The Prince of Persia
Posts: 5743
Joined: April 9th, 2009, 10:58 pm

Re: 4D prince guards

Post by Norbert »

Emiliano Fierro wrote: November 7th, 2019, 12:43 amBut, why [...] in the old computers they look completely green?
No idea.
Maybe your dad has a monochrome screen, and other games also look green?
User avatar
Emiliano
Wizard Scribe
Wizard Scribe
Posts: 718
Joined: July 31st, 2019, 8:53 pm
Location: Mexico
Contact:

Re: 4D prince guards

Post by Emiliano »

I don't know :| maybe only that game
The thing is that his computer has included MS-DOS by default
65536
User avatar
Emiliano
Wizard Scribe
Wizard Scribe
Posts: 718
Joined: July 31st, 2019, 8:53 pm
Location: Mexico
Contact:

Re: 4D prince guards

Post by Emiliano »

One day I will show you
When I have time
65536
User avatar
Emiliano
Wizard Scribe
Wizard Scribe
Posts: 718
Joined: July 31st, 2019, 8:53 pm
Location: Mexico
Contact:

Re: 4D prince guards

Post by Emiliano »

I finally can prove it
In my dad's computer they look like this
Attachments
IMG_20191108_080356.jpg
65536
User avatar
Norbert
The Prince of Persia
The Prince of Persia
Posts: 5743
Joined: April 9th, 2009, 10:58 pm

Re: 4D prince guards

Post by Norbert »

Emiliano Fierro wrote: November 8th, 2019, 4:05 pmIn my dad's computer they look like this
Weird. :)
David
The Prince of Persia
The Prince of Persia
Posts: 2846
Joined: December 11th, 2008, 9:48 pm
Location: Hungary

Re: 4D prince guards

Post by David »

Emiliano Fierro wrote: November 7th, 2019, 12:43 am But, why In dosbox you see them like this, but in the old computers they look completely green?
I played it in my dad's computer and it looks green
It depends on the sound mode.
(I've mentioned this here and here, but I didn't post specifics. I'll fix that now.)

Here is what each looks like.
You can use the command line parameter in parentheses to activate that sound mode.

Sound Blaster (sblast):
sblast.png
sblast.png (4.34 KiB) Viewed 7214 times
PC Speaker (stdsnd):
stdsnd.png
stdsnd.png (4.35 KiB) Viewed 7214 times
AdLib (adlib):
adlib.png
adlib.png (4.36 KiB) Viewed 7214 times
Emiliano Fierro wrote: November 8th, 2019, 4:05 pm In my dad's computer they look like this
Does PoP play sounds using the PC Speaker there?
Post Reply