Duke Nukem II Actor Info
The tile arrangement for the Duke Nukem II actors (game characters) is stored in ACTRINFO.MNI in the main NUKEM2.CMP group file. This file describes how to arrange the bare 8×8 tiles found in the corresponding tileset, so that they form a frame belonging to an actor animation.
|UINT16LE iNumActors||Number of actors described in the file|
|UINT16LE iOffset[iNumActors]||Array of UINT16 offsets to the actor info structure (double these values to turn them into byte offsets)|
Following this structure the first actor data should begin. The actor data runs end-to-end, and iOffset should only be required when jumping to a particular actor's offset.
Note that iNumActors is technically the UINT16-offset of the first structure, however if it is treated as such it becomes difficult to find the number of actors described by the file.
|UINT16LE iNumFrames||Number of frames this actor has|
|INT16LE iDrawIndex||Seems to define when the actor will be drawn to the screen|
|ACTOR_FRAME frameInfo[iNumFrames]||Structure holding information about the frame|
The iDrawIndex value ranges from -1 to 3 or 4. actors with a lower index will be drawn first, the actors with highest index last. This has not been verified yet but is the best guess on what this value does.
ACTOR_FRAME is defined as:
|INT16LE iHotspotX||X-coord of hotspot (in tiles, can be negative)|
|INT16LE iHotspotY||Y-coord of hotspot (in tiles, can be negative)|
|UINT16LE iHeight||Frame height (in tiles)|
|UINT16LE iWidth||Frame width (in tiles)|
|UINT32LE iDataOffset||Offset into ACTORS.MNI where the tile data starts|
|UINT16LE iSomething||Often a negative number, like -130 [0xff7e] for one 4-tile high actor|
|UINT16LE iSomething2||Often a large number, perhaps a file offset, like 30,219 [0x760b] for the 4-tile high actor|
The hotspot is the location in the image which should appear at the offset given in the map layer. In other words, take the actor location, subtract iHotspotX number of tiles from the X-coordinate, subtract iHotspotY number of tiles from the Y-coordinate, and the actor will appear at the correct location.
Maybe the iSomethings are actually bytes, and they have something to do with offsetting the image from the actor's location on the map? Or maybe there's frame timing information for an animated actor? Or it could be a difficulty flag controlling which difficulty levels the actors are visible on?
ACTORS.MNI contains some bytes that are not used by any actor frame. These bytes are found at the end of every 64KB block (exactly 65536 bytes) of data. In the original file, no sprite frame is split across these 64KB blocks. The image data is written to the end of the block to fill it up, then the new block is started, containing the entire image data of the sprite's frame.
However, Duke Nukem II seems to be able to handle the image data correctly, even if it is split across two of these blocks. This might have just been a limitation in the original tool that was used to create the ACTORS.MNI file.