From DoomWiki.org

< User:Unmaker
Revision as of 21:56, 20 January 2014 by Unmaker (talk | contribs) (moar useless crap)

Header

40 bytes in size.

Offset Length Name Description
0x00 24 savename Savegame description string, padded with zeroes if less than 24 bytes.
0x18 16 version Game version string, in format "version %i". This writes the internal engine version, e.g. 109 for 1.9, or 110 for LinuxDoom. If savegame version differs from that of the engine, the loading is aborted, though no error message is displayed.

General level parameters

10 bytes in size.

Offset Length Name Description
0x28 1 gameskill 1-5
0x29 1 gameepisode 1-4
0x2a 1 gamemap 1-32
0x2b 1x4 playeringame[] boolean byte flag for each connected player.
0x2f 3 leveltime Number of tics since the level was started. (least significant byte last, first is unused, so max stored time must be 0xFFFFFF?)

Players block

Each player block is 280 bytes in size, padded to 4 bytes. First block is always present; the rest are saved only if corresponding player is currently in game. When loading player data, Doom does not actually check for connected network nodes, simply placing and setting up map things according to the saved game's contents. (TODO: what actually happens after loading?)

The following is the binary contents of the player_t structure for the first player. Following player blocks, if any, are offset by 0x118 each.

Offset Length Name Description
0x32 4 mo pointer to the player's mobj thinker?
0x36 4 playerstate alive/dead/respawning
0x3e 4 cmd ticcmd_t (player input?)
0x42 4 viewz  ?
0x46 4 viewheight  ?
0x4a 4 deltaviewheight  ?
0x4e 4 bob gun bobbing?
0x52 4 health
0x56 4 armorpoints
0x5a 4 armortype 1 for green, 2 for blue
0x5e 4 powers[] remaining time of the invulnerability powerup (tics)
0x62 4 true if the berserk powerup is active (also used for the red haze countdown?)
0x66 4 remaining time of the partial invisibility powerup (tics)
0x6a 4 remaining time of the radiation suit powerup (tics)
0x6e 4 true if the player has the computer map powerup
0x72 4 remaining time of the light amplification visor powerup (tics)
0x76 4 cards[] blue keycard
0x7a 4 yellow keycard
0x7e 4 red keycard
0x82 4 blue skull
0x86 4 yellow skull
0x8a 4 red skull
0x8e 4 backpack player has the backpack
0x8e 4x4 frags[] frags for each player (for everyone, not the current one, seems redundant?)
0xa2 4 readyweapon weapon currently equipped
0xa6 4 pendingweapon pending weapon (10 if not changing anything at the moment?)
0xaa 4x9 weaponowned[] weapons owned (1-9)
0xce 4x4 ammo[] ammo counts (1-4)
0xde 4x4 maxammo[] max ammo capacities (redundant, since there's the backpack flag?)
0xee 4 attackdown attack button held down
0xf2 4 usedown use button held down
0xf6 4 cheats bitmask for cheats currently active
0xfa 4 refire the player has been firing for some time (diminished accuracy)
0xfe 4 killcount number of monsters killed
0x102 4 itemcount number of items found
0x106 4 secretcount number of secrets discovered
0x10a 4 message pointer to the last displayed message?
0x10e 4 damagecount PLAYPAL index for damage?
0x112 4 bonuscount PLAYPAL index for powerup pickup?
0x116 4 attacker pointer to last attacker mobj?
0x11a 4 extralight gun flash to illuminate surroundings?
0x11e 4 fixedcolormap powerup COLORMAP
0x122 4 colormap used to remap the colors of the player's sprite?
0x132 16x2 psprites[] sets up the player weapon sprite?
0x146 4 didsecret true if the player has visited the secret level

Sectors block

This (and subsequent) blocks may greatly vary in size according to the map data and current playsim state, thus their offsets must be calculated. This also makes manual hacking of these virtually impossible.

Each entry is 14 bytes in size, number of entries is the length of the SECTORS lump divided by the size of the mapsector_t structure (26 bytes).

Offset (relative) Length Name Description
0x00 2 floorheight (in units)
0x02 2 ceilingheight (in units)
0x04 2 floorpic flat index (not lump name)
0x06 2 ceilingpic
0x08 2 lightlevel
0x0a 2 special
0x0c 2 tag

Lines block

An entry's size is 16 bytes for one-sided lines, and 26 bytes for two-sided ones.

The number of entries is the length of the LINEDEFS lump divided by the size of the maplinedef_t structure (14 bytes).

Offset (relative) Length Name Description
0x00 2 flags
0x02 2 special
0x04 2 tag
Note: the sidedef order is right, then left. A side's data is not stored if the line does not have a valid one defined.
0x06 2 textureoffset horizontal offset (in units)
0x08 2 rowoffset vertical offset (in units)
0x0a 2 toptexture index
0x0c 2 bottomtexture index
0x0e 2 midtexture index
0x10 2 textureoffset horizontal offset (in units)
0x12 2 rowoffset vertical offset (in units)
0x14 2 toptexture index
0x16 2 bottomtexture index
0x18 2 midtexture index

Mobjs block

Each entry is 161 bytes, padded to 4.

TODO: explain how it is being figured out what mobjs to save?

Offset (relative) Length Name Description
0x00 1 thinkerclass 1 to continue reading, 0 to terminate the block
0x01 4x3 thinker links to the double-linked list of thinkers
0x1d 4 x position
0x11 4 y
0x15 4 z
0x19 4 snext links in sector
0x1d 4 sprev
0x21 4 angle orientation
0x25 4 sprite sprite index
0x29 4 frame frame index (also stores fullbright)
0x2d 4 bnext links to the BLOCKMAP iterator
0x31 4 subsector
0x35 4 floorz the closest interval over all contacted sectors (used for flying monsters?)
0x39 4 ceilingz
0x3d 4 radius
0x41 4 height
0x45 4 momx
0x49 4 momy
0x4d 4 momz
0x51 4 validcount  ?
0x55 4 type MT_* type
0x59 4 info default values from mobjinfo[]?
0x5d 4 tics state tic counter
0x61 4 state
0x65 4 flags
0x69 4 health
0x6d 4 movedir 0-7 direction index
0x71 4 movecount when 0, select a new dir
0x75 4 target pointer to the current enemy (owner for projectiles). Why is this zeroed out upon loading??
0x79 4 reactiontime delay before next attack
0x7d 4 threshold changetarget threshold
0x81 4 player pointer to the player_t for player mobjs (NULL for monsters)?
0x85 4 lastlook player number last looked for
0x89 4x5 spawnpoint contents of the mapthing_t struct for nightmare respawn
0x9d 4 tracer thing being chased/attacked for tracers

Specials block

TODO

Ceilings

Offset (relative) Length Name Description
0x00 1 specials tc_ceiling

Doors

Offset (relative) Length Name Description
0x00 1 specials tc_door

Floors

Offset (relative) Length Name Description
0x00 1 specials tc_floor

Plats

Offset (relative) Length Name Description
0x00 1 specials tc_plat

Light flashes

Offset (relative) Length Name Description
0x00 1 specials tc_flash

Light strobes

Offset (relative) Length Name Description
0x00 1 specials tc_strobe

Light glows

Offset (relative) Length Name Description
0x00 1 specials tc_glow

Block terminator

tc_endspecials (0x07?)

Consistency Marker

The last byte of the savegame must be 0x1d, or else the game bombs out with an error message.

References

some outdated info