Adding new frames to .dat files

About PR usage and development, and about the POP format.

Moderator: English Moderator Team

Post Reply
User avatar
doppelganger
Vizier
Vizier
Posts: 115
Joined: April 24th, 2015, 9:04 am
Location: India

Adding new frames to .dat files

Post by doppelganger » April 25th, 2015, 5:52 am

Hello, is there a way to add death frames to skel.dat and shadow.dat (res779.bmp to res784.bmp)?
Even after adding these lines to the resources.xml, It doesn't work:

Code: Select all

 <folder index="pop1" name="binary" file="skel.dat" path="skel" palette="750">
  <item value="750" path="res750.pal" type="palette-pop1-4bits">Unknown Resource number 750</item>
  <item value="751" path="hit points.bmp" type="image">Unknown Resource number 751</item>
  <item value="752" path="res752.bin" type="binary">Unknown Resource number 752</item>
  <item value="753" path="res753.bmp" type="image">Unknown Resource number 753</item>
  <item value="754" path="res754.bmp" type="image">Unknown Resource number 754</item>
  <item value="755" path="res755.bmp" type="image">Unknown Resource number 755</item>
  <item value="756" path="res756.bmp" type="image">Unknown Resource number 756</item>
  <item value="757" path="res757.bmp" type="image">Unknown Resource number 757</item>
  <item value="758" path="res758.bmp" type="image">Unknown Resource number 758</item>
  <item value="759" path="res759.bmp" type="image">Unknown Resource number 759</item>
  <item value="760" path="res760.bmp" type="image">Unknown Resource number 760</item>
  <item value="761" path="res761.bmp" type="image">Unknown Resource number 761</item>
  <item value="762" path="res762.bmp" type="image">Unknown Resource number 762</item>
  <item value="763" path="res763.bmp" type="image">Unknown Resource number 763</item>
  <item value="764" path="res764.bmp" type="image">Unknown Resource number 764</item>
  <item value="765" path="res765.bmp" type="image">Unknown Resource number 765</item>
  <item value="766" path="res766.bmp" type="image">Unknown Resource number 766</item>
  <item value="767" path="res767.bmp" type="image">Unknown Resource number 767</item>
  <item value="768" path="res768.bmp" type="image">Unknown Resource number 768</item>
  <item value="769" path="res769.bmp" type="image">Unknown Resource number 769</item>
  <item value="770" path="res770.bmp" type="image">Unknown Resource number 770</item>
  <item value="771" path="res771.bmp" type="image">Unknown Resource number 771</item>
  <item value="772" path="res772.bmp" type="image">Unknown Resource number 772</item>
  <item value="773" path="res773.bmp" type="image">Unknown Resource number 773</item>
  <item value="774" path="res774.bmp" type="image">Unknown Resource number 774</item>
  <item value="775" path="res775.bmp" type="image">Unknown Resource number 775</item>
  <item value="776" path="res776.bin" type="binary">Unknown Resource number 776</item>
  <item value="777" path="spiked.bmp" type="image">Unknown Resource number 777</item>
  <item value="778" path="chopped.bmp" type="image">Unknown Resource number 778</item>
  <item value="779" path="res779.bmp" type="image">Unknown Resource number 779</item>
  <item value="780" path="res780.bmp" type="image">Unknown Resource number 780</item>
  <item value="781" path="res781.bmp" type="image">Unknown Resource number 781</item>
  <item value="782" path="res782.bmp" type="image">Unknown Resource number 782</item>
  <item value="783" path="res783.bmp" type="image">Unknown Resource number 783</item>
  <item value="784" path="res784.bmp" type="image">Unknown Resource number 784</item>
 </folder>

Code: Select all

 <folder index="pop1" name="binary" file="shadow.dat" path="shadow" palette="750">
  <item value="750" path="res750.pal" type="palette-pop1-4bits">Unknown Resource number 750</item>
  <item value="751" path="hit points.bmp" type="image">Unknown Resource number 751</item>
  <item value="752" path="splash.bmp" type="image">Unknown Resource number 752</item>
  <item value="753" path="res753.bmp" type="image">Unknown Resource number 753</item>
  <item value="754" path="res754.bmp" type="image">Unknown Resource number 754</item>
  <item value="755" path="res755.bmp" type="image">Unknown Resource number 755</item>
  <item value="756" path="res756.bmp" type="image">Unknown Resource number 756</item>
  <item value="757" path="res757.bmp" type="image">Unknown Resource number 757</item>
  <item value="758" path="res758.bmp" type="image">Unknown Resource number 758</item>
  <item value="759" path="res759.bmp" type="image">Unknown Resource number 759</item>
  <item value="760" path="res760.bmp" type="image">Unknown Resource number 760</item>
  <item value="761" path="res761.bmp" type="image">Unknown Resource number 761</item>
  <item value="762" path="res762.bmp" type="image">Unknown Resource number 762</item>
  <item value="763" path="res763.bmp" type="image">Unknown Resource number 763</item>
  <item value="764" path="res764.bmp" type="image">Unknown Resource number 764</item>
  <item value="765" path="res765.bmp" type="image">Unknown Resource number 765</item>
  <item value="766" path="res766.bmp" type="image">Unknown Resource number 766</item>
  <item value="767" path="res767.bmp" type="image">Unknown Resource number 767</item>
  <item value="768" path="res768.bmp" type="image">Unknown Resource number 768</item>
  <item value="769" path="res769.bmp" type="image">Unknown Resource number 769</item>
  <item value="770" path="res770.bmp" type="image">Unknown Resource number 770</item>
  <item value="771" path="res771.bmp" type="image">Unknown Resource number 771</item>
  <item value="772" path="res772.bmp" type="image">Unknown Resource number 772</item>
  <item value="773" path="res773.bmp" type="image">Unknown Resource number 773</item>
  <item value="774" path="res774.bmp" type="image">Unknown Resource number 774</item>
  <item value="775" path="res775.bmp" type="image">Unknown Resource number 775</item>
  <item value="776" path="res776.bmp" type="image">Unknown Resource number 776</item>
  <item value="777" path="spiked.bmp" type="image">Unknown Resource number 777</item>
  <item value="778" path="chopped.bmp" type="image">Unknown Resource number 778</item>
  <item value="779" path="res779.bmp" type="image">Unknown Resource number 779</item>
  <item value="780" path="res780.bmp" type="image">Unknown Resource number 780</item>
  <item value="781" path="res781.bmp" type="image">Unknown Resource number 781</item>
  <item value="782" path="res782.bmp" type="image">Unknown Resource number 782</item>
  <item value="783" path="res783.bmp" type="image">Unknown Resource number 783</item>
  <item value="784" path="res784.bmp" type="image">Unknown Resource number 784</item>
 </folder>
The game still crashes as if there are no frames for death animation, although the chopped and spiked frames for the shadow work.
Does this require prince.exe hex editing?
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: 1496
Joined: December 11th, 2008, 9:48 pm
Location: Hungary

Re: Adding new frames to .dat files

Post by David » April 25th, 2015, 3:14 pm

I figured out what happens:
The first byte of the palette (res750.pal.more) tells how many images are loaded.
In SKEL.DAT it's 0x1C, in SHADOW.DAT it's 0x20.
In FAT.DAT, GUARD1.DAT, GUARD2.DAT, VIZIER.DAT it's 0x22.
If you want to use the death frames, set that byte to 0x22.

User avatar
doppelganger
Vizier
Vizier
Posts: 115
Joined: April 24th, 2015, 9:04 am
Location: India

Re: Adding new frames to .dat files

Post by doppelganger » April 27th, 2015, 5:33 am

David wrote:The first byte of the palette (res750.pal.more) tells how many images are loaded.
Great!

Edit: But I ran into a problem:

When a loose tile fell on the prince's head, I lost control of him until he was hit by the shadow. (See the video below).

prince_003.zip

Help?
Doppelgänger
Hmm.. These mortals know about me.. :evil:

Download 'Hell of A Palace' now from Popot!

User avatar
Norbert
The Prince of Persia
The Prince of Persia
Posts: 3139
Joined: April 9th, 2009, 10:58 pm
Contact:

Re: Adding new frames to .dat files

Post by Norbert » April 27th, 2015, 11:17 am

doppelganger wrote:(See the video below).
This is the video that doppelgänger attached to his post:


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

Re: Adding new frames to .dat files

Post by David » April 27th, 2015, 6:35 pm

(I saw this once, when I was testing something about loose floors.)
This happens because the loose floor hits the kid while he is holding the sword.
The game is not prepared for this: It "thinks" that the kid is still holding the sword, but the kid is in the regular standing state.
(Remember, this can't happen on the original levels.)

I found a way to fix this, you need to hex-edit prince.exe.
Around this place: (fell_on_your_head)

Code: Select all

seg007:1641 83 7E FE 6D                          cmp     [bp+frame], 109 ; crouching
seg007:1645 74 1E                                jz      return
seg007:1647 9A 66 0B CB 06                       call    get_tile_behind_char
seg007:164C 0A C0                                or      al, al
seg007:164E 75 0C                                jnz     loc_9BAC
seg007:1650 B8 FE FF                             mov     ax, -2
seg007:1653 50                                   push    ax              ; delta_x
seg007:1654 9A 13 02 CB 06                       call    char_dx_forward
seg007:1659 A2 23 3D                             mov     char_x, al
seg007:165C                      loc_9BAC:
seg007:165C B8 34 00                             mov     ax, 52          ; loose floor fell on Kid
seg007:165F 50                                   push    ax              ; seq_index
seg007:1660 9A 0A 00 DE 05                       call    seqtbl_offset_char
seg007:1665                      return:
I need to insert C6 06 2E 3D 00 (mov char_sword, 0) somewhere, but it's hard to free up enough bytes for that.

Search for: 0A C0 75 0C B8 FE FF 50
Replace with: C6 06 2E 3D 00 6A 00 90

The original code pushes the kid back 2 pixels if the tile behind the kid is empty.
This hack removes that. I don't think this would affect gameplay.

User avatar
doppelganger
Vizier
Vizier
Posts: 115
Joined: April 24th, 2015, 9:04 am
Location: India

Re: Adding new frames to .dat files

Post by doppelganger » May 4th, 2015, 3:44 pm

It would be great to add this fix to CusPop.
Doppelgänger
Hmm.. These mortals know about me.. :evil:

Download 'Hell of A Palace' now from Popot!

Post Reply