Each saved game has a MAZE.PTY file which contains all information about the party, such as party members, location, gold, and gems, as well as certain party achievements.
The MAZE.PTY file is found in every saved game CC file and can be found starting at the offsets of 0x3305 for Clouds/World of Xeen (both SAV and WOX files), 0x377D for Darkside, and 0x32FD for Swords. It can also be found in Might and Magic III ".MM3" saves starting at offset 0x2B23.
Unlike MAZE.CHR, which starts with a default "header" reading "Default Characters," MAZE.PTY does not have any such internal identification. This is most likely because it immediately follows the last character slot within MAZE.CHR.
The file should be exactly 812 bytes in Clouds of Xeen save files, and 1528 bytes in Darkside of Xeen files. When combined into World of Xeen, only the Darkside save file is used; the Darkside specific file format contains all Clouds specific data as well as the Darkside and additional content.
|0x00||1 byte||byte||Party Count||Number of party members total (including hirelings)|
|0x01||1 byte||byte||Real Party Count||Number of non-hireling party members|
|0x02||8 bytes||byte array||Party Members||References into the MAZE.CHR file. 0 for no member in that slot. Xeen only uses max 6|
|0x0A||1 byte||enum||Maze Direction||Facing direction of party. 0 = North, 1 = East, 2 = South, 3 = West|
|0x0B||1 byte||byte||Maze X||Party X position on map|
|0x0C||1 byte||byte||Maze Y||Party Y position on map|
|0x0D||1 byte||byte||Maze ID||The map party is currently in|
|0x0E||1 byte||boolean||Sound Flag||Game Configuration: Sound is on or off|
|0x0F||1 byte||boolean||Music Flag||Game Configuration: Music is on or off|
|0x10||1 byte||unk||Unknown||Currently unknown and likely unused|
|0x11||1 byte||byte||Temp Maze||The map party most recently came from|
|0x12||1 byte||boolean||Levitate||Set if the levitate spell is active|
|0x13||1 byte||boolean||Automap||Set if the automap is turned on|
|0x14||1 byte||boolean||Wizard Eye||Set if the Wizard Eye spell is active|
|0x15||1 byte||boolean||Clairvoyance||Set if the clairvoyance spell is active|
|0x16||1 byte||boolean||WalkOnWater||Set if the Walk on Water spell is active|
|0x17||1 byte||byte||Blessed||Set if the Blessed spell is active to the caster's level|
|0x18||1 byte||byte||PowerShield||Set if the Power Shield spell is active to the caster's level|
|0x19||1 byte||byte||HolyBonus||Set if the Holy Bonus spell is active to the caster's level|
|0x1A||1 byte||byte||Heroism||Set if the Heroism spell is active to the caster's level|
|0x1B||1 byte||boolean||Difficulty||Difficulty as selected at start of a new game. 0 = Adventurer, 1 = Warrior|
|0x1C||144 bytes||XeenItem*36||Black Smith Weapons||Probably the weapons currently available at all blacksmiths, maybe|
|0xAC||144 bytes||XeenItem*36||Black Smith Armor||Probably the armor currently available at all blacksmiths, maybe|
|0x13C||144 bytes||XeenItem*36||Black Smith Accessories||Probably the accessories currently available at all blacksmiths, maybe|
|0x1CC||144 bytes||XeenItem*36||Black Smith Misc||Probably the miscelaneous items currently available at all blacksmiths, maybe|
|0x25C||2 bytes||boolean||Clouds End||Set when the party defeats Lord Xeen and sees the Clouds End cutscene. Unknown why it is a short and not a byte|
|0x25E||2 bytes||boolean||Darkside End||Set when the party defeats Alamar and sees the Darkside End cutscene. Unknown why it is a short and not a byte|
|0x260||2 bytes||boolean||World End||Set when the party unites Xeen and sees the World End cutscene. Unknown why it is a short and not a byte|
|0x262||2 bytes||short||Hour?||Not the current hour. Unknown, but has something to do with time.|
|0x264||2 bytes||short||Day||The current day of the year|
|0x266||2 bytes||short||Year||The current year|
|0x268||2 bytes||short||Minutes||The number of minutes since midnight. 60 minutes per hour used to display regular HH:MM time|
|0x26A||2 bytes||short||Food||The amount of food the party has. Each party member requires one piece of food per day/rest|
|0x26C||2 bytes||short||Light||The number of times the Light spell has been cast. May have had additional implementation, but final game only cares if greater than 0|
|0x26E||2 bytes||short||Torch||The number of torches the party is carrying. Discarded feature not fully implemented in final game|
|0x270||2 bytes||short||Fire||Party's magical resistance to fire|
|0x272||2 bytes||short||Electricity||Party's magical resistance to electricity|
|0x274||2 bytes||short||Cold||Party's magical resistance to cold and water|
|0x276||2 bytes||short||Poison||Party's magical resistance to poison|
|0x278||2 bytes||short||Deathcount||Number of times the party has died and had to reload|
|0x27A||2 bytes||short||WinCount||TODO: I forget|
|0x27C||2 bytes||short||LossCount||TODO: I forget|
|0x27E||4 bytes||integer||Gold||Gold currently on hand|
|0x282||4 bytes||integer||Gems||Gems currently on hand|
|0x286||4 bytes||integer||BankGold||Gold currently in the bank|
|0x28A||4 bytes||integer||BankGems||Gems currently in the bank|
|0x28E||4 bytes||integer||Total time||Number of seconds played. Counter is even active while file menu is up|
|0x292||1 byte||boolean||Rested||Party has recently rested|
|0x293||64 bytes||bit field||Game flags||512 bits of flags that can be set and checked by scripts: 256 for Clouds, 256 for Darkside|
|0x2D3||16 bytes||bit field||Autonotes||127 bits of flags to display on the auto-notes page, first bit is unused and should always be false. 73 notes for Clouds, 55 notes for Darkside|
|0x2E3||8 bytes||bit field||Quests||64 bits of flags set when completing certain quests: 30 for Clouds quests, 34-40(confusion) for Darkside|
|0x2EB||85 bytes||byte array||Quest Items||Boolean and in some cases counts of special Quest Items: 35 for Clouds, 50 for Darkside|
|0x340||144 bytes||XeenItem*36||Black Smith Weapons 2||Probably the weapons currently available at all blacksmiths, maybe, but different from before|
|0x3D0||144 bytes||XeenItem*36||Black Smith Armor||Probably the armor currently available at all blacksmiths, maybe, but different from before|
|0x460||144 bytes||XeenItem*36||Black Smith Accessories||Probably the accessories currently available at all blacksmiths, maybe, but different from before|
|0x4F0||144 bytes||XeenItem*36||Black Smith Misc||Probably the miscellaneous items currently available at all blacksmiths, maybe, but different from before|
|0x580||90 bytes||bitfields*30||Character flags||Additional bit flags associated with each character in the MAZE.CHR file. 24 bits per character, 30 characters total|
|0x5DA||30 bytes||unk||Unknown/unused||null values, probably never used|
There exists partial support for hirelings, possibly remnants of MM3 code, or maybe a feature that was dropped due to time constraints. Either way, future reimplementation will like support hirelings again.
There are two sets of items. One is for Clouds, the other is for Darkside. Each side has 4 blacksmiths you can buy from. The items are not ordered sequentially by shop, but are interlaced: that is, the first item in the weapon list found at offset 0x340 belongs to blacksmith 1, the second item in the weapon list (at offset 0x344) belongs to blacksmith 2, etc... The second item found at blacksmith 1 is the 5th item in the list, found at offset 0x350.
The Terra/Xeen engine is coded pretty cleverly when it comes to time:
- Valid values for the current day are between 0 and 99. Any value beyond 99 gets reduced by 100 after 12am and 1 year is added... except 32,767. If you pass midnight on that day, the game adds another day and completely breaks the counter (and the Information display) until you reach 65,536, which then rolls the counter over to 0.
- Valid values for the current year seem to be between 0 and 65,535. Once you hit 65,536, however, the counter rolls back over to 0.
- Valid values for the current minute are between 0 and 1,439. Any values over 1,499 cause the hour display to show 13 or higher (Your value / 60 - 12), but the clock instantly fixes itself the instant the player takes any action by subtracting 1,440 minutes (and adding a day) until it can show a valid time. As always, 65,536 will reset the counter.
I'm pretty sure WinCount/LossCount has something to do with Warzone. This needs confirmation.
There seems to be some confusion with the quest flags. Perhaps there is overlap?
The last 30 bytes are a complete mystery, and probably completely unused.
Do we care about the format of the Clouds specific version of MAZE.PTY? It will be very similar, other than missing the Darkside additional fields. Since the reimplementation is only likely to work with World anyway, it may not be worthwhile finding those differences.