Project X/Weapon file block

From Worms Knowledge Base

Revision as of 22:05, 27 April 2017 by Pac-Man (Talk | contribs) (Identifier of course lol)

Jump to: navigation, search
(Up to Project X)

A weapon block describes of what kind a weapon is, how it reacts, its physical parameters, how much initial ammunition is available and much more. Because of the many different weapon types, different sub-blocks have to be read depending on the type. However, the "header" is always the same, being explained at first, and following the other sub-blocks. If not further explained, data at offsets not listed is empty (0-bytes).

The data types are in C# notation.

Header

Each weapon block has a small header and a checksum (which isn't actually checked, so it can be anything).

Offset Size Type Description Default value Remarks
0 4 int Identification 0x5ABBDD05 (default.pxs), 0x5ABBDD06 (others) Magic bytes identifying the weapon block. default.pxs seems to use a different identifier than those of manually created schemes, so this might also be a version.
4 8 long Checksum Generation unknown, can be anything, not checked by Project X.

General Settings

Following the header are some general settings (configured in the first window of the Project X Weapon Editor). Additional settings follow at the byte at offset 500, and before this are weapon type specific sub-blocks found (so there's space between the first group of settings and the second group, used differently for each weapon type).

Offset Size Type Description Default value Remarks
12 4 int Table Row Row of the weapon table in which the weapon will appear. 0 = Utility row, max. is 12, higher rows cannot be accessed in-game.
16 4 bool Remembered If true, the weapon will be automatically selected for the next shot after the first one.
20 4 bool Usable in cavern Useful to disable airstrikes on cavern maps.
24 4 int Shots The number of shots which can be done before the turn ends.
28 4 bool Shoot ends turn If true, retreat time is started after the weapon has been fired.
32 4 int Retreat time The retreat time in milliseconds after the weapon has been fired (and shoot ends turn is true).
36 4 int "Unknown"
40 4 int Crate Chance The chance that this weapon will appear in crates. This is shared between all weapons, so using a percentage value from 0-100 is a good idea rather than using any value up to 2^16.
44 4 int Count in Crate The additonal ammunition a team will get when collecting a crate with this weapon in it, normally 1.
48 4 bool Unknown Setting This boolean is randomly set by Project X, but the meaning has not yet been discovered.
52 4 int Activation by Sets the activation type this weapon has. The following values are valid:
  • 0x00: None
  • 0x01: Crosshair
  • 0x02: Throw
  • 0x03: Airstrike
  • 0x04: Spacebar
56 4 int Activation flag
  • If the activation type is "Throw", this tells how many weapons are released as herding.
  • If the activation type is "Airstrike", this specifies the subtype (whatever that is).
  • If the activation type is "Space", this specifies the action caused (more information about the parameters of these actions is found below):
    • 0x00: None
    • 0x01: Fire punch
    • 0x02: Baseball bat
    • 0x03: Dragon ball
    • 0x04: Kamikaze
    • 0x05: Suicide bomber
    • 0x06: Ninja rope
    • 0x07: Bungee
    • 0x08: Pneumatic drill
    • 0x09: Prod
    • 0x0A: Teleport
    • 0x0B: Blowtorch
    • 0x0C: Parachute
    • 0x0D: Surrender
    • 0x0E: Skip go
    • 0x0F: Select worm
    • 0x10: Nuclear test
    • 0x11: Girder
    • 0x12: Battle axe
    • 0x13: Utility
    • 0x14: Freeze
    • 0x15: Earthquake
    • 0x16: Scales of justice
    • 0x17: Jet pack
    • 0x18: Armageddon
  • Otherwise, it has no meaning.
60 4 int Weapon Style
  • If the activation type is "None", this int has no meaning.
  • If the activation type is "Crosshair", the following styles are available:
    • 0x00: None
    • 0x01: Flamethrower
    • 0x02: Gun
    • 0x03: Launcher
    • 0x04: Bow
  • If the activation type is "Throw", the following styles are available:
    • 0x00: None
    • 0x01: Mine
    • 0x02: Launcher
    • 0x03: Canister
  • If the activation type is "Airstrike" or "Space", this int does not exist and the offset is already used for other information (s. below).
468 4 bool Custom count If true, the start ammunition overrides the ones defined in the used WSC scheme. This is only required for the first table as the weapons in the second table always use the following count.
472 4 int Count The start ammunition of this weapon.
476 4 int Unknown setting Probably has to do with the appearance.
480 4 int Weapon sprite
484 diff. string Long weapon name None
diff. diff. string Short weapon name None
diff. diff. string Grid IMG hi/bazooka.img The image of the weapon to be displayed in its table cell. hi/... references images in the sprite directory of Worms. Otherwise, a filename in the scheme or any attached library can be used, like "omgwtfbbq.png".
diff. 24 byte[] Unused bytes
diff. 4 bool Custom delay True to override the WSC delay of weapons in the first weapon table. Not required for any additional table.
diff. 4 int Delay The number of turns which have to be completed by each team before this weapon becomes available.
diff. 1 bool Use from library True to use the weapon block as specified in the library with the following name. Renders other settings of this weapon block useless. The following two strings "Library name" and "Library weapon name" do not exist if this bool is false.
diff. diff. string Library name The name of the library from which the weapon block with the following name should be used. This string does not exist if "Use from library" is false.
diff. diff. string Library weapon name The name of the weapon in the library with the name specified above. This string does not exist if "Use from library" is false.
diff. diff. string Aim sprite name even
diff. diff. string Aim sprite name uphill
diff. diff. string Aim sprite name downhill
diff. diff. string Pick sprite name even
diff. diff. string Pick sprite name uphill
diff. diff. string Pick sprite name downhill
diff. diff. string Fire sprite name even
diff. diff. string Fire sprite name uphill
diff. diff. string Fire sprite name downhill
diff. 1 bool Custom aim sprite True to use the custom aim sprite names.
diff. 1 bool Custom pick sprite True to use the custom pick sprite names.
diff. 1 bool Custom fire sprite True to use the custom fire sprite names.
diff. 1 bool Utility True if this weapon appears at the bottom right above the wind indicator if activated.

Weapon Style Blocks

Depending on the Weapon style setting, the following blocks appear in the file.

Flamethrower

This block is not configurable in the Project X editors as its editing window has not been implemented, but loaded correctly in-game.

Offset Size Type Description Default value Remarks
64 4 int Amount of fuel
68 4 int Fire intensity
72 4 int Amount of fire
76 4 int Burn time In millseconds.
80 4 bool Remain on terrain If true, fire stays between turns, as introduced with the Petrol Bomb in WA.

Gun

Offset Size Type Description Default value Remarks
64 4 int Bullet count
68 4 int Reload time
72 4 int Bullet spread
76 4 int Burst
80 4 int Burst spread
84 4 CollisionFlags Collision flags S. below for the enumeration of collision flags.
88 4 int Bias
92 4 int Power
96 4 int Max. damage
100 4 int Damage spread
104 4 int Exp. effect
108 4 int Range 1
112 4 int Range 2
116 4 int Range 3

Launcher

The complex launcher structure is reused not only for the weapon style, but also for the bomb parameters of an airstrike, with the corresponding offsets then. The offsets here are the same as if the weapon style is "Launcher".

Depending on the actions and explosion targets the weapons are subclassed in, child blocks are possible, explained afterwards.

Offset Size Type Description Default value Remarks
64 4 int Sprite size
68 4 int Fixed speed
72 4 bool Run away!
76 4 CollisionFlags Explosion collision flags
80 4 int Explosion bias
84 4 int Explosion push power
88 4 int Explosion damage
92 4 int Explosion damage variation
96 4 int Explosion "Unknown"
100 24 Animation Animation S. below for the animation structure.
124 4 int Variable speed
128 4 int Wind factor
132 4 int Randomness of motion
136 4 int Gravity factor
140 4 int Explosion countdown from In milliseconds.
144 4 int Explosion timer In milliseconds.
148 16 Sound Sound S. below for the sound structure
164 4 bool Explosion on spacebar
168 4 int Explosion action Can be one of the following values, providing information about the following action block:
  • 0x00: None
  • 0x01: Home
  • 0x02: Bounce
  • 0x03: Roam
  • 0x04: Dig
308 4 int Explosion into Offset is at 308, before this byte, the action blocks are placed. Can be one of the following values, providing information about the following explosion target block:
  • 0x00: Nothing
  • 0x01: Clusters
  • 0x02: Fire

Homing action

Offset Size Type Description Default value Remarks
172 4 int Unused This byte is never used by Project X and can be handled as a placeholder.
176 24 Sprite Sprite
200 4 int Homing style Can be one of the following values:
  • 0x00: Don't home
  • 0x01: Like homing missile
  • 0x02: Like pigeon
204 4 int Homing after In milliseconds.
208 4 int Homing duration In milliseconds.

Bounce action

Offset Size Type Description Default value Remarks
172 4 CollisionFlags Bounce off
176 4 int Bounciness
180 4 int Acceleration
184 4 int Bounce sound
188 4 int "Unknown" 1
192 4 int "Unknown" 2
196 4 int Explosion bias
200 4 int Explosion power
204 4 int Explosion damage
208 4 int Randomness of damage
212 4 int Number of bounces

Roam action

Offset Size Type Description Default value Remarks
172 4 CollisionFlags Roam off
176 4 CollisionFlags Exploding on
180 4 int Walk speed
184 4 int "Unknown"
188 4 int Jump angle at edge
192 4 int Jump velocity at edge
196 4 int Jump sound at edge
200 4 int Jump angle
204 4 int Jump velocity
208 4 int Jump sound
212 4 int Terrain offset
216 4 bool Fart
220 4 int Disease power
224 4 int Sprite when farting
228 4 int Sprite when flying
232 4 int Sprite when flying 2
236 4 int Sprite when taking off
240 4 int Sprite during flight

Dig action

Offset Size Type Description Default value Remarks
172 4 int "Unknown" 1
176 4 int "Unknown" 2
180 4 int Digging sound
184 4 int Sprite while jumping
188 4 int Sprite 1
192 4 int Sprite 2
196 4 int Sprite 3

Cluster explosion target

Offset Size Type Description Default value Remarks
172 4 int Number of clustlets
176 4 int Dispersion power
180 4 int Speed
184 4 int Ejection angle
188 4 int Dispersion angle
192 4 CollisionFlags Explosion flags
196 4 int Explosion bias
200 4 int Explosion push power
204 4 int Explosion damage
208 4 int Explosion damage variation
212 4 int Number of used sprites Overrides "Unknown" which can be configured in the Project X editor.
216 24 Sprite Animation
240 4 int Acceleration
244 4 int Wind response
248 4 int Randomness of motion
252 4 int Gravity factor
256 4 int Unused
260 4 int Unused
264 16 Sound Sound
280 4 bool Explode on spacebar
284 4 int Action Can be one of the following values, providing information about the following action block:
  • 0x00: None
  • 0x01: Home
  • 0x02: Bounce
  • 0x03: Roam
  • 0x04: Dig

Fire explosion target

Offset Size Type Description Default value Remarks
172 4 int Fire power
176 4 int Fire spread
180 4 int Fire time
184 4 bool Stay between turns

Bow

Offset Size Type Description Default value Remarks
64 4 int Damage

Mine

The mine structure is also reused for a mine strike. See below for the structure details.

Canister

Not enabled officially, this canister structure was intended to be used for a small dropable weapon which infects nearby worms with green smoke. It should be noted that this kind of weapon lacks object limit because it was not implemented (due to the weapon not being officially present in the game).

Offset Size Type Description Default value Remarks
64 4 int Sprite when inactive
68 4 int Sprite when active
72 4 int Disease points
76 4 int Max. damage

Airstrike

Offset Size Type Description Default value Remarks
60 4 int Plane sprite
64 4 int Bombs count
68 4 int Distance between drops
72 4 int Horizontal speed
76 4 int Sound
80 4 int Airstrike action Can be one of the following values, determining which block follows:
  • 0x00: Mines. A mine structure follows.
  • 0x01: Worm strike. An unreleased, falling-worms-simulating airstrike.
  • 0x02: General. A launcher structure specifying how each dropped bomb behaves follows.

Spacebar

The actions started with the "Spacebar" weapon type are configured with a list of int parameters (except for Armageddon which follows a Launcher structure to describe each falling "meteorit"), which have different meanings for each action. The following table lists the meanings for each spacebar action.

Remember that the spacebar parameters start at offset 60.

Action Parameter 1 Parameter 2 Parameter 3 Parameter 4 Parameter 5 Parameter 6 Parameter 7
None
Fire punch Damage Angle Push power Height of jump
Baseball bat Damage Push power
Dragon ball Firing sound Impact sound Ball sprite Damage Angle Force Flying time
Kamikaze Flying time Explosion damage Fire sound Damage Force of impact Angle of impact
Suicide bomber Disease points Damage
Ninja rope Number of shoots (255 = infinite) Length Angle restriction
Bungee
Pneumatic drill Damage Push power Impact angle Tunelling time
Prod Damage Force Angle
Teleport
Blowtorch Damage Push power Impact angle Tunelling time
Parachute Wind response
Surrender
Skip go
Select worm
Nuclear test Water rise Disease points
Girder
Battle axe Percent taken off
Utility
Freeze
Earthquake
Scales of justice
Jet pack Fuel
Armageddon Bombs - this is a launcher structure instead of an int.

General structures

The following structures are used at several places. The offsets are relative to the start of the block to give a meaningful value.

Sprite

Describes how an animation is... animated.

Offset Size Type Description Default value Remarks
0 4 int Sprite number
4 4 int Animation type Can be one of the following values:
  • 0x00: Horizontal velocity
  • 0x01: Cycle
  • 0x02: Track movement
  • 0x03: Track speed
  • 0x04: Slow cycle
  • 0x05: Faster cycle
  • 0x06: Fast cycle
8 4 int Sprite for trail
12 4 int Amount of trail
16 4 int Trail vanish speed
20 4 int "Unknown"

Sound

Describes a sound.

Offset Size Type Description Default value Remarks
0 2 short Sound
2 2 bool Repeat sound
4 4 bool Use explosion sound
8 4 int Sound before explosion
12 4 int Delay before explosion In milliseconds.

Mine

Describes how a mine behaves.

Offset Size Type Description Default value Remarks
0 4 int Sensitivity
4 4 int Time before on In milliseconds.
8 4 CollisionFlags Sensitive to
12 4 int Fuse time In milliseconds.
16 4 int Explosion bias
20 4 int Blast power
24 4 int Max. damage

Collision flags

These combinable flags set to what kinds of objects weapon collide or mines are sensitive.

Bit index Description
0 None
1 Terrain
2 Worms on terrain
3 Worms using weapon
4 Worms in mid-air
5 Worms on rope/bungee
6 Frozen worms
7 Unused
8 Kamikaze/suicide bomber
9 Gas canisters
10 Mines
11 Crates
12 Donor cards
13 Gravestones
14 Unused
15 Other weapons
16 Longbow arrows
17 Oil drums
18 Unused
19 Unused
20 Unused
21 Unused
22 Skimming
23 Unused
24 Unused
25 Unused
26 Unused
27 Unused
28 Unused
29 Unused
30 Unknown
31 Unused
Personal tools