The format of the POP2 save file

About PR usage and development, and about the POP format.
Post Reply
David
The Prince of Persia
The Prince of Persia
Posts: 2850
Joined: December 11th, 2008, 9:48 pm
Location: Hungary

The format of the POP2 save file

Post by David »

I haven't seen this anywhere, and some people were asking for it, so here is the format in C language:

Code: Select all

struct TPop2SaveFile {
   short unknown; // must be between 0 and 10
   char names[25][10];
   struct TSaves {
      short checkpoint; // 0=beginning of level
      char uk02;
      char uk03;
      short time_minutes; // +1
      short time_ticks;
      char level; // 0x00=title, 0x01-0x0E=level 1-14, 0x0F-0xFE=quit with error, 0xFF=freeze
      char hitpoints; // 0x00=no move, 0x01-0x7F=1-127 hp, 0x80-0xFF=1 hp, but not shown
      char direction; // 0x00=right, 0xFF=left, other=left, and can't turn right
                      // unused if checkpoint==0
      char startpoint; // 0x02=alternative (level 7 only)
      char sword; // 0x01=long, 0x02=short, 0xFF=none, other=prince long, guard none
                  // unused if checkpoint==0
      char uk0D;
      char uk0E;
      short upside_down; // remaining time?
      char time_started; // 0x00-0x7F=yes, 0x80-0xFF=no
      char uk12;
      char uk13;
      char uk14;
      char uk15;
      char uk16;
      // the following are unused if checkpoint==0
      char fg[960]; // foreground data, same format as in prince.dat
      char bg[3840]; // background data, same format as in prince.dat
      char sg[3712]; // static guard data, same format as in prince.dat
      char dg[1088]; // dynamic guard data, same format as in prince.dat
   } saves[10];
};
EDIT: added startpoint
Last edited by David on January 21st, 2010, 2:21 pm, edited 1 time in total.
BlackChar
Sheikh
Sheikh
Posts: 24
Joined: November 18th, 2008, 3:26 am
Location: Prague, Czech Republic
Contact:

Re: The format of the POP2 save file

Post by BlackChar »

POP1 file format specification wrote: Remaining ticks
Seconds are stored in ticks, a tick is 1/12 seconds. To get the time in
seconds you have to divide the integer "Remaining ticks" by 12.
This should go for POP2 too. There used to be a link to this document on the old princed page, but it's gone. But I can try to dig through the internetz and post some stuff back, if you need to :)
poirot
Developer
Developer
Posts: 394
Joined: March 24th, 2003, 8:52 pm
Location: Australia
Contact:

Re: The format of the POP2 save file

Post by poirot »

once again, thank you david!
Post Reply