Gods Weapon Table Format

From ModdingWiki
Jump to navigation Jump to search

The eleven weapons in Gods are described in PWEAPONS.00n, one file per world (n = 1-4). The files are compressed with PKWARE DCL Compression; each decompresses to exactly 880 bytes. The file is loaded when sublevel A of a world starts.

File format

The file is 11 records of 80 bytes, in this order: knife, time bomb, fireball, flame, lightning bolt, throwing star, spear, axe, hunter, magic axe, mace. The record number is the weapon number used by trigger actions 1 and 10 in the Gods Map Format and by weapon pickups (map object type 192 + weapon).

The first 32 bytes of each record are 16 big-endian words. Bytes from offset 32 onwards are raw bytes and text.

Offset Data type Name Description
0x00 UINT16BE slotClass 0 = the weapon can only be held in the first weapon slot; 1 = it goes in the second or third slot
0x02 UINT16BE drawStyle How the projectile is drawn
0x04 UINT16BE frame Current animation frame (runtime value)
0x06 UINT16BE power Damage, shown as "Power" in the shop
0x08 UINT16BE unknown Affects how many projectiles are fired at once. Ignored, see below.
0x0A UINT16BE maxShots Maximum number of this weapon's projectiles on screen (1 or 3)
0x0C UINT16BE sprite Sprite number of the projectile. Ignored, see below.
0x0E UINT16BE sprite2Select Chooses when the second sprite is used
0x10 UINT16BE unknown
0x12 UINT16BE handlerLeft Low byte: projectile behaviour when fired to the left
0x14 UINT16BE unknown
0x16 UINT16BE handlerRight Low byte: projectile behaviour when fired to the right
0x18 UINT16BE unknown
0x1A UINT16BE mover Low byte: movement type (0-5)
0x1C UINT16BE frameCount Number of animation frames
0x1E UINT16BE sprite2 Second projectile sprite, 0 if none. Ignored, see below.
0x20 char[16] name NUL-terminated weapon name, e.g. fireball
0x30 BYTE[24] unknown Leftover text from the authoring tool
0x48 UINT8 terrain Terrain collision flag, 0x00 or 0xFF
0x49 UINT8 singleHit 0xFF = the projectile disappears after hitting one enemy
0x4A UINT16BE value Price in the shop, shown as "Value"
0x4C BYTE[4] unknown

Text fields may contain leftover characters after the terminating NUL (for example knife\0ng knife), so always stop at the first NUL.

Notes

  • Three fields, 0x08, 0x0C and 0x1E, are loaded from the file and then overwritten with values built into GAME.EXE, so changing them in the file has no effect. This matters because the files for worlds 3 and 4 disagree with the built-in values for several weapons.
  • The built-in projectile sprites are 331, 339, 343, 347, 363, 369, 373, 377, 385, 426 and 437 (all in POBJ2). Only the lightning bolt (366) and the spear (375) have a second sprite.
  • The name at offset 0x20 is used by the shop's "this weapon replaces the ..." warning.

Source code

From re-gods, the open-source HTML5 port:

Credits

This file format was reverse engineered by VorticonCmdr. 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!)