Importing sword

About PR usage and development, and about the POP format.
Post Reply
Shwartz99
Scholar Scribe
Scholar Scribe
Posts: 1
Joined: August 21st, 2017, 6:40 pm

Importing sword

Post by Shwartz99 »

Hi everyone,

I'm having trouble importing the sword files in prince.dat using PR. When I try, it skips over them and says there is an error. Both the images under "fighting" and "in the floor" folders aren't importing. Additionally, it seems that "level color variations.pal" isn't working either, but I'm not sure where that file is, or what it's used for.

Here's the batch file I was running made by Norbert; I added a pause at the end to capture the full report:

Code: Select all

PR.bat v0.1 (2013-08-05)
Enter the path to the PR executable and XML:
C:\apoplexy-3.0-RC2-win32\apoplexy-3.0-RC2\pr\
C:\apoplexy-3.0-RC2-win32\apoplexy-3.0-RC2\pr\\pr.exe
Where is Prince of Persia (the .DAT files):
C:\apoplexy-3.0-RC2-win32\apoplexy-3.0-RC2\pr\prince
Do you want to [E]xport or [I]mport? i
Directory to import from:
C:\apoplexy-3.0-RC2-win32\apoplexy-3.0-RC2\pr\resourcesold
Princed resources (PR) v1.3.1
(c) Copyright 2003-2012 Princed Development Team
http://www.princed.org

Importing 'C:\apoplexy-3.0-RC2-win32\apoplexy-3.0-RC2\pr\pr
ince\CDUNGEON.DAT' from 'C:\apoplexy-3.0-RC2-win32\apoplexy
-3.0-RC2\pr\resourcesold'
Result: Success (0)
Importing 'C:\apoplexy-3.0-RC2-win32\apoplexy-3.0-RC2\pr\pr
ince\CPALACE.DAT' from 'C:\apoplexy-3.0-RC2-win32\apoplexy-
3.0-RC2\pr\resourcesold'
Result: Success (0)
Importing 'C:\apoplexy-3.0-RC2-win32\apoplexy-3.0-RC2\pr\pr
ince\DIGISND1.DAT' from 'C:\apoplexy-3.0-RC2-win32\apoplexy
-3.0-RC2\pr\resourcesold'
Result: Success (0)
Importing 'C:\apoplexy-3.0-RC2-win32\apoplexy-3.0-RC2\pr\pr
ince\DIGISND2.DAT' from 'C:\apoplexy-3.0-RC2-win32\apoplexy
-3.0-RC2\pr\resourcesold'
Result: Success (0)
Importing 'C:\apoplexy-3.0-RC2-win32\apoplexy-3.0-RC2\pr\pr
ince\DIGISND3.DAT' from 'C:\apoplexy-3.0-RC2-win32\apoplexy
-3.0-RC2\pr\resourcesold'
Result: Success (0)
Importing 'C:\apoplexy-3.0-RC2-win32\apoplexy-3.0-RC2\pr\pr
ince\EDUNGEON.DAT' from 'C:\apoplexy-3.0-RC2-win32\apoplexy
-3.0-RC2\pr\resourcesold'
Result: Success (0)
Importing 'C:\apoplexy-3.0-RC2-win32\apoplexy-3.0-RC2\pr\pr
ince\EPALACE.DAT' from 'C:\apoplexy-3.0-RC2-win32\apoplexy-
3.0-RC2\pr\resourcesold'
Result: Success (0)
Importing 'C:\apoplexy-3.0-RC2-win32\apoplexy-3.0-RC2\pr\pr
ince\FAT.DAT' from 'C:\apoplexy-3.0-RC2-win32\apoplexy-3.0-
RC2\pr\resourcesold'
Result: Success (0)
Importing 'C:\apoplexy-3.0-RC2-win32\apoplexy-3.0-RC2\pr\pr
ince\GUARD.DAT' from 'C:\apoplexy-3.0-RC2-win32\apoplexy-3.
0-RC2\pr\resourcesold'
Result: Success (0)
Importing 'C:\apoplexy-3.0-RC2-win32\apoplexy-3.0-RC2\pr\pr
ince\GUARD1.DAT' from 'C:\apoplexy-3.0-RC2-win32\apoplexy-3
.0-RC2\pr\resourcesold'
Result: Success (0)
Importing 'C:\apoplexy-3.0-RC2-win32\apoplexy-3.0-RC2\pr\pr
ince\GUARD2.DAT' from 'C:\apoplexy-3.0-RC2-win32\apoplexy-3
.0-RC2\pr\resourcesold'
Result: Success (0)
Importing 'C:\apoplexy-3.0-RC2-win32\apoplexy-3.0-RC2\pr\pr
ince\IBM_SND1.DAT' from 'C:\apoplexy-3.0-RC2-win32\apoplexy
-3.0-RC2\pr\resourcesold'
Result: Success (0)
Importing 'C:\apoplexy-3.0-RC2-win32\apoplexy-3.0-RC2\pr\pr
ince\IBM_SND2.DAT' from 'C:\apoplexy-3.0-RC2-win32\apoplexy
-3.0-RC2\pr\resourcesold'
Result: Success (0)
Importing 'C:\apoplexy-3.0-RC2-win32\apoplexy-3.0-RC2\pr\pr
ince\KID.DAT' from 'C:\apoplexy-3.0-RC2-win32\apoplexy-3.0-
RC2\pr\resourcesold'
Result: Success (0)
Importing 'C:\apoplexy-3.0-RC2-win32\apoplexy-3.0-RC2\pr\pr
ince\LEVELS.DAT' from 'C:\apoplexy-3.0-RC2-win32\apoplexy-3
.0-RC2\pr\resourcesold'
Result: Success (0)
Importing 'C:\apoplexy-3.0-RC2-win32\apoplexy-3.0-RC2\pr\pr
ince\MIDISND1.DAT' from 'C:\apoplexy-3.0-RC2-win32\apoplexy
-3.0-RC2\pr\resourcesold'
Result: Success (0)
Importing 'C:\apoplexy-3.0-RC2-win32\apoplexy-3.0-RC2\pr\pr
ince\MIDISND2.DAT' from 'C:\apoplexy-3.0-RC2-win32\apoplexy
-3.0-RC2\pr\resourcesold'
Result: Success (0)
Importing 'C:\apoplexy-3.0-RC2-win32\apoplexy-3.0-RC2\pr\pr
ince\PRINCE.DAT' from 'C:\apoplexy-3.0-RC2-win32\apoplexy-3
.0-RC2\pr\resourcesold'
'level color variations.pal' has errors, skipped
'normal.bmp' has errors, skipped
'bright.bmp' has errors, skipped
'sword01.bmp' has errors, skipped
'sword02.bmp' has errors, skipped
'sword03.bmp' has errors, skipped
'sword04.bmp' has errors, skipped
'sword05.bmp' has errors, skipped
'sword06.bmp' has errors, skipped
'sword07.bmp' has errors, skipped
'sword08.bmp' has errors, skipped
'sword09.bmp' has errors, skipped
'sword10.bmp' has errors, skipped
'sword11.bmp' has errors, skipped
'sword12.bmp' has errors, skipped
'sword13.bmp' has errors, skipped
'sword14.bmp' has errors, skipped
'sword15.bmp' has errors, skipped
'sword16.bmp' has errors, skipped
'sword17.bmp' has errors, skipped
'sword18.bmp' has errors, skipped
'sword19.bmp' has errors, skipped
'sword20.bmp' has errors, skipped
'sword21.bmp' has errors, skipped
'sword22.bmp' has errors, skipped
'sword23.bmp' has errors, skipped
'sword24.bmp' has errors, skipped
'sword25.bmp' has errors, skipped
'sword26.bmp' has errors, skipped
'sword27.bmp' has errors, skipped
'sword28.bmp' has errors, skipped
'sword29.bmp' has errors, skipped
'sword30.bmp' has errors, skipped
'sword31.bmp' has errors, skipped
'sword32.bmp' has errors, skipped
'sword33.bmp' has errors, skipped
'sword34.bmp' has errors, skipped
Result: Success (0)
Importing 'C:\apoplexy-3.0-RC2-win32\apoplexy-3.0-RC2\pr\pr
ince\PV.DAT' from 'C:\apoplexy-3.0-RC2-win32\apoplexy-3.0-R
C2\pr\resourcesold'
Result: Success (0)
Importing 'C:\apoplexy-3.0-RC2-win32\apoplexy-3.0-RC2\pr\pr
ince\SHADOW.DAT' from 'C:\apoplexy-3.0-RC2-win32\apoplexy-3
.0-RC2\pr\resourcesold'
Result: Success (0)
Importing 'C:\apoplexy-3.0-RC2-win32\apoplexy-3.0-RC2\pr\pr
ince\SKEL.DAT' from 'C:\apoplexy-3.0-RC2-win32\apoplexy-3.0
-RC2\pr\resourcesold'
Result: Success (0)
Importing 'C:\apoplexy-3.0-RC2-win32\apoplexy-3.0-RC2\pr\pr
ince\TITLE.DAT' from 'C:\apoplexy-3.0-RC2-win32\apoplexy-3.
0-RC2\pr\resourcesold'
Result: Success (0)
Importing 'C:\apoplexy-3.0-RC2-win32\apoplexy-3.0-RC2\pr\pr
ince\VDUNGEON.DAT' from 'C:\apoplexy-3.0-RC2-win32\apoplexy
-3.0-RC2\pr\resourcesold'
Result: Success (0)
Importing 'C:\apoplexy-3.0-RC2-win32\apoplexy-3.0-RC2\pr\pr
ince\VIZIER.DAT' from 'C:\apoplexy-3.0-RC2-win32\apoplexy-3
.0-RC2\pr\resourcesold'
Result: Success (0)
Importing 'C:\apoplexy-3.0-RC2-win32\apoplexy-3.0-RC2\pr\pr
ince\VPALACE.DAT' from 'C:\apoplexy-3.0-RC2-win32\apoplexy-
3.0-RC2\pr\resourcesold'
Result: Success (0)

Done.
Press any key to continue . . .
I edited the images and the .pal to include two extra colors, which will be the colors of the swords. I also edited the images for kid.dat using the same colors and adding them to the .pal for the kid, and those have no problem, which is why I'm confused as to why the sword files for prince.dat isn't working.

Here are my files: https://drive.google.com/drive/folders/ ... sp=sharing

Thank you in advance for any help.
User avatar
Norbert
The Prince of Persia
The Prince of Persia
Posts: 5743
Joined: April 9th, 2009, 10:58 pm

Re: Importing sword

Post by Norbert »

Your edited BMP files are in the RGB format. They should be indexed, with just 16 colors. Open the initial (original) images with GIMP and then check Windows->Dockable Dialogs->Colormap to see the default colors. The easiest solution is to modify images with only the colors from the Colormap. Adding colors is impossible. Modifying colors is possible, but then you need to understand what is explained in this document. According to resources.xml the palette for, for example, sword01.bmp is 700, which is sword.pal, which you'd then have to modify, etc. An alternative is to start using SDLPoP or MININIM, because their images are in the RGB format.
David
The Prince of Persia
The Prince of Persia
Posts: 2846
Joined: December 11th, 2008, 9:48 pm
Location: Hungary

Re: Importing sword

Post by David »

Norbert wrote:Your edited BMP files are in the RGB format. They should be indexed, with just 16 colors.
PR should really show a better error message instead of just "has errors"...

There are multiple problems with PR's error messages:
* Sometimes it just displays a generic or *misleading* error. For example, format errors can cause "File not found" or "File reading permission denied".
* Errors are returned with error codes instead of strings. This means that a new error condition needs a new code.
* Sometimes there is a long chain of "ok=ok&&..." statements, with an "if(!ok)" at the end. It's not possible to figure out afterwards *which* step caused ok to be false.

Anyway, here is my attempt at better error messages: https://github.com/NagyD/PR/commit/8c37 ... 945c2bfe74
Shwartz99 wrote:Additionally, it seems that "level color variations.pal" isn't working either, but I'm not sure where that file is, or what it's used for.
It is used in PoP v1.3 and v1.4 for the alternate level colors. For example, level 3 is green in those versions.
If you are using DAT files from PoP v1.0 then that file does not exist, but it should not be a problem.
User avatar
Norbert
The Prince of Persia
The Prince of Persia
Posts: 5743
Joined: April 9th, 2009, 10:58 pm

Re: Importing sword

Post by Norbert »

David wrote:Anyway, here is my attempt at better error messages: https://github.com/NagyD/PR/commit/8c37 ... 945c2bfe74
That is very useful!

On a related note, and testing with this last version, when I export and then import the default PoP1 1.0 I get several errors.
With exporting I only get a list of "can't load necessary palette, index=pop1, value=0, error=-23" for GUARD.DAT.
With importing I get several errors:
Spoiler: show
Importing '/home/norbert/test/PoP1//FAT.DAT' from '/home/norbert/test/resources'
'res776.bmp' has errors, skipped
Result: BMP has wrong bit-depth (-31)
'chopped.bmp' has errors, skipped
Result: BMP has wrong bit-depth (-31)


Importing '/home/norbert/test/PoP1//GUARD.DAT' from '/home/norbert/test/resources'
'res776.bmp' has errors, skipped
Result: BMP has wrong bit-depth (-31)


Importing '/home/norbert/test/PoP1//PRINCE.DAT' from '/home/norbert/test/resources'
'res65535.bin' has errors, skipped
Result: File not found (-6)
'level color variations.pal' has errors, skipped
Result: File reading permission denied (-8)


Importing '/home/norbert/test/PoP1//SHADOW.DAT' from '/home/norbert/test/resources'
'res768.bmp' has errors, skipped
Result: BMP has wrong bit-depth (-31)
'spiked.bmp' has errors, skipped
Result: BMP has wrong bit-depth (-31)
'chopped.bmp' has errors, skipped
Result: BMP has wrong bit-depth (-31)
'res779.bmp' has errors, skipped
Result: BMP has wrong bit-depth (-31)
'res780.bmp' has errors, skipped
Result: BMP has wrong bit-depth (-31)
'res781.bmp' has errors, skipped
Result: BMP has wrong bit-depth (-31)
'res782.bmp' has errors, skipped
Result: BMP has wrong bit-depth (-31)


Importing '/home/norbert/test/PoP1//SKEL.DAT' from '/home/norbert/test/resources'
'hit points.bmp' has errors, skipped
Result: BMP has wrong bit-depth (-31)
'splash.bmp' has errors, skipped
Result: BMP has wrong bit-depth (-31)
'res776.bmp' has errors, skipped
Result: BMP has wrong bit-depth (-31)


Importing '/home/norbert/test/PoP1//VIZIER.DAT' from '/home/norbert/test/resources'
'res776.bmp' has errors, skipped
Result: BMP has wrong bit-depth (-31)
David
The Prince of Persia
The Prince of Persia
Posts: 2846
Joined: December 11th, 2008, 9:48 pm
Location: Hungary

Re: Importing sword

Post by David »

Norbert wrote: With exporting I only get a list of "can't load necessary palette, index=pop1, value=0, error=-23" for GUARD.DAT.
GUARD.DAT doesn't contain any palette, so I had to assign a nonexistent palette to its images in resources.xml.
Maybe this error should be hidden if value=0?

It's possible to use the guard palettes from PRINCE.DAT, though.
But then one has to copy it into GUARD.DAT, because PR currently does not support using palettes from one file with an image from another file.
Here is how to do that:
1. You need to edit resources.xml this way:

Code: Select all

 <folder index="pop1" name="binary" file="guard.dat" path="guards" palette="10" type="image">
  <item value="10" path="guard palettes.pal" type="palette-pop2-320cols"/>
2. Export both PRINCE.DAT and GUARD.DAT.
3. Copy guard palettes.pal from prince/binary/ to guards/.
4. Import GUARD.DAT and export it again.
The images should have the correct palette now, with the first guard color.
paletteoffset="16" should use the second guard color, but it does not work.
(Currently paletteoffset is supported only for 256-color images.)

Norbert wrote: With importing I get several errors:

Importing '/home/norbert/test/PoP1//FAT.DAT' from '/home/norbert/test/resources'
'res776.bmp' has errors, skipped
Result: BMP has wrong bit-depth (-31)
'chopped.bmp' has errors, skipped
Result: BMP has wrong bit-depth (-31)
These (and the other bit-depth errors) appear because PR importing expects images to be 16-color, but these are 2-color (empty) images.
This can be changed in resources.xml: with colors="2" (2-color) or type="image-full" (PoP2 256-color images).

Or maybe I should make PR accept both 16-color and 2-color images when colors are not specified in resources.xml?

Norbert wrote: Importing '/home/norbert/test/PoP1//PRINCE.DAT' from '/home/norbert/test/resources'
'res65535.bin' has errors, skipped
Result: File not found (-6)
'level color variations.pal' has errors, skipped
Result: File reading permission denied (-8)
These resources exist only in PoP v1.3 and v1.4.
level color variations.pal is self-explanatory, res65535.bin is sent to the MT-32 on startup.
User avatar
Norbert
The Prince of Persia
The Prince of Persia
Posts: 5743
Joined: April 9th, 2009, 10:58 pm

Re: Importing sword

Post by Norbert »

David wrote:Or maybe I should make PR accept both 16-color and 2-color images when colors are not specified in resources.xml?
I think maybe whatever is the easiest to do, that takes the least amount of time?
To 'just' to get rid of the errors, I mean. Not spend much time on it, to have more time for fun hobbies. ;)
Post Reply