Duke Nukem II Misc Files

From ModdingWiki
Jump to navigation Jump to search
Duke Nukem II Misc Files
Format typeSaved game and Configuration
StoringSound, Scores, Keys, Game speed
Save locationsReturned to level start
Elements savedLevel, Difficulty, Score, Ammo, Health, Weapon, Hints displayed
Games

NUKEM2.-GT

Stores game settings (controls, sound options etc...)

 0 | UINT16LE | iUpKey    (scan code)
 2 | UINT16LE | iDownKey  (scan code)
 4 | UINT16LE | iLeftKey  (scan code)
 6 | UINT16LE | iRightKey (scan code)
 8 | UINT16LE | iJumpKey  (scan code)
10 | UINT16LE | iFireKey  (scan code)
12 | UINT16LE | iDifficulty (always 1, not used by the game)
14 | UINT16LE | iSound_SoundBlaster (0..1)
16 | UINT16LE | iSound_AdLib        (0..1)
18 | UINT16LE | iSound_PCSpeaker    (0..1)
20 | UINT16LE | iMusic              (0..1)
22 | UINT16LE | iJoystickCalibrated (0..1)
24 | UINT16LE | iJoystickCalibrationData1
26 | UINT16LE | iJoystickCalibrationData2
28 | UINT16LE | iJoystickCalibrationData3
30 | UINT16LE | iJoystickCalibrationData4
32 | UINT16LE | iJoystickFireButtonIndex (0..1)
34 | UINT16LE | iGameSpeed (1..7)

Key bindings are stored as IBM PC keyboard scan codes.

iJoystickCalibrated is set to one after going through the Joystick calibration process in the menu. The game will read jostyick input in addition to key presses from then on.

iJoystickFireButtonIndex determines if button 1 or button 2 on the joystick serves as the fire button (with the other button used for jumping).

The joystick calibration data is needed by the game to correctly interpret joystick motion. This is closely tied to the way joysticks functioned on DOS PCs, see PC analogue joystick interface for more information.

NUKEM2.-NM

Stores names of the saved games. Contains 8 strings with a fixed length of 18 chars each (padded with nulls, but not null-terminated).

NUKEM2.-S?

Stores savegames (? ranges from 1 to 8, plus B, T, and Z for temporary saves, more on that below).

 0 | UINT16LE | iWeapon  (0..3) - 0=N, 1=L, 2=R, 3=F
 2 | UINT16LE | iHealth  (always 9, except in temporary respawn beacon savegame)
 4 | UINT16LE | iAmmo    (1..32, 1..64 for flame thrower)
 6 | UINT16LE | iDifficulty (1..3)
 8 | UINT16LE | iEpisode (0..3)
10 | UINT16LE | iLevel   (0..7)
12 | UINT16LE | iRespawnBeaconActivated (0..1 - always 0 except in temporary respawn beacon savegame)
14 | UINT16LE | iBackdropAddressOffset (always 0 except in temporary respawn beacon savegame)
16 | BYTE[30] | bHintsDisplayed (0..1)
46 | UINT32LE | iScore (ignored if iRespawnBeaconActivated == 1)

Temporary savegame files

The game uses this savegame format for some internal purposes in addition to regular savegames.

When starting a level, the game creates a .-ST file to capture the player's score, ammo etc. at the beginning of the level. When the player dies (before having reached a respawn beacon), the file is used to restore these values.

When the player reaches a respawn beacon, a .-SZ file is created. The file is used to restore weapon and ammo when the player dies and respawns at the beacon. The score value is ignored in that case. If the health value is 1, it is set to 2 instead. In this case, the iBackdropAddressOffset is needed for levels with a backdrop switch, to restore the correct backdrop when respawning.

.-SB files are created as part of creating regular savegames. When you create a savegame via the menu, the score, weapon, ammo etc. values from the beginning of the level are stored, regardless of what the values currently are. The game loads the .-ST file in order to restore the values from the beginning of the level, and then creates the requested savegame based on that. Since loading the temp file overwrites the actual current values, the game first creates a .-SB file with the current state, and then reloads it after the regular savegame has been written.

NUKEM2.-V?

Stores High Scores for each episode (? ranges from 1 to 4).

Contains 10 entries of the following structure:

CHAR[15] | cName (NOT null-terminated!)
UINT32LE | iScore

Credits

This file format was reverse engineered by K1n9_Duk3, with some additions by lethal guitar. If you find this information helpful in a project you're working on, please give credit where credit is due. (A link back to this wiki would be nice too!)