Actions

Header Format: Difference between revisions

From Populous Wiki

No edit summary
Line 186: Line 186:
==Byte 0x62: Level Flags==
==Byte 0x62: Level Flags==


[[Single Player]] only.
These properties can be used in the [[Single Player]] mode only.
Fog of War, God Mode, and other flags are set as booleans in this byte:
If the bit is on the property is available. In this example Fog of War, God Mode and Forge World are available:


     00001101
     00001011
       |||||----[[Fog of War]]
       |||||----[[Fog of War]]
       ||||-----[[God Mode]]
       ||||-----[[God Mode]]

Revision as of 07:39, 24 September 2010

The Header (.hdr) is a Populous Level File which contains the level's attributes.

Long 0x00: Spells Available

The first long starting at byte 0 defines which spells are available at the start of the level. Each of the eight bits of the byte represent one spell. If the bit is on the spell is available.

Byte 1

In this example (Hex 27), Blast and Swarm are available.

   00100111
   ||||||||--Leave on
   |||||||---Leave on
   ||||||----Blast
   |||||-----Lightning
   ||||------Tornado
   |||-------Swarm
   ||--------Invisibility
   |---------Hypnotise

Byte 2

In this example (Hex 54), Earthquake, Landbridge and Erode are available.

   01010100
   ||||||||----Firestorm
   |||||||-----Ghost Army
   ||||||------Erode
   |||||-------Swamp
   ||||--------Landbridge
   |||---------Angel of Death
   ||----------Earthquake
   |-----------Flatten

Byte 3

In this example (Hex F4), no spells are available. The other bits should be left unchanged.

   11110100
       | ||----Volcano
       | |-----Convert
       |
       |-------Magical Shield

Long 0x04: Buildings Available

Building availability is handled in the same way as spells, but are kept in the next long

Byte 1

In this example (Hex 1F), Hut and Guard Tower are available. Leave other bits unchanged.

   00011111
   ||||  |
   ||||  |-----Hut
   ||||
   ||||
   ||||--------Guard Tower
   |||---------Temple
   ||----------Spy Hut
   |-----------Warrior Hut

Byte 2

In this example (Hex FF), Firewarrior Hut, Boat Hut and Balloon Hut are available.

   11111111
   | |    |----Firewarrior Hut
   | |
   | |
   | |
   | |
   | |---------Boat Hut
   |
   |-----------Balloon Hut

Long 0x08: Buildings Available - Level

The third long represents the buildings available for the level in the same sense as given from a worship item. These are organized the same way as the buildings available.

Long 0x0C: Buildings Available - Once

The fourth long is the buildings available to build once, the same as one-shots from worship items. These are organized the same way as the buildings available.


Long 0x10: Spells Available - Level / Spells not charging

Spells not charging starts at offset 16. This long represent data for which spells are toggled as charging on the Spells Panel at the start of the game. Any bit set to true will result in the corresponding spell being set to the "not charging" state at the beginning of the game, and any bit set to false will result in the corresponding spell being set to the "charging" state at the beginning of the game. The user can change this state by right-clicking the icon of the spell.

The bits used for each spell are identical to the bits used in the spells section. This long is doubled used with the Spells available for the level in single player.

Byte 1

In this example (Hex 27), Blast and Swarm are not charging at the start of the game.

   00100111
   ||||||||--Leave on
   |||||||---Leave on
   ||||||----Blast
   |||||-----Lightning
   ||||------Tornado
   |||-------Swarm
   ||--------Invisibility
   |---------Hypnotise

Byte 2

In this example (Hex 54), Earthquake, Landbridge and Erode are not charging at the start of the game.

   01010100
   ||||||||----Firestorm
   |||||||-----Ghost Army
   ||||||------Erode
   |||||-------Swamp
   ||||--------Landbridge
   |||---------Angel of Death
   ||----------Earthquake
   |-----------Flatten

Byte 3

In this example (Hex F4), all spells in question are charging at the start of the game. The other bits should be left unchanged.

   11110100
       | ||----Volcano
       | |-----Convert
       |
       |-------Magical Shield


Bytes 0x14 - 0x33: Spells Available - Once

The next 32 bytes represent the spells given once to the player at the start of the game. They are indexed by spell model with each byte containing the number of that spell provided.

Word 0x34: Vehicles Available

These two bytes show the types of vehicles available to the player - if that was used.

Byte 0x36: Training Mana Off

Setting this byte to 1 will disable the training mana at the start of the level.

Byte 0x37: Flags

Unused.

Bytes 0x38 - 0x57 Level Name

The level name is 32 bytes (8 bit signed-characters) long. This is only used for save games titles, not the level name that is shown in level selection or the solar system view, that title is stored in the language file.

Byte 0x58: Number of Players

Number of Players sets the number of tribes that will appear on the level. Colors go in the order (Blue, Red, Yellow, Green). In Single Player this must be set to the last color on the level or 03 for all of them. For example, for a map with only Blue and Yellow on the level, the number must still be set to 02. In Multiplayer this is how many players the level with 00 representing one player.

Bytes 0x59 - 0x5B Computer Player Index

Each byte is the script number for a color (Red, Yellow, Green). Note that while the files are in decimal, that must be converted into hex when stored in the header file (Cpscr010.dat = 010 = 0A).

Bytes 0x5C - 0x5F Allies

Single Player only. There is one byte for each type containing the tribes it is allied with. The first four bits of the byte represent the four tribes, with a set bit meaning that tribe is an ally. A tribe must always ally itself, and the alliance is one way - e.g. Blue could be set to be allied to green, but green must also have the same value in the byte to be allied to blue.

Example: Blue is allied with green (byte 0x5C).
   00001001
       ||||----Blue
       |||-----Red
       ||------Yellow
       |-------Green
Example: Red is allied with Yellow (byte 0x5D).
   00000110
       ||||----Blue
       |||-----Red
       ||------Yellow
       |-------Green

Byte 0x60: Level Type - Color Scheme

There are 36 landscape styles. In hex that is from 0x00 to 0x23.

Byte 0x61: Object Bank - Tree Styles

There are 5 tree styles. In hex, they are 0x00 to 0x05.

Byte 0x62: Level Flags

These properties can be used in the Single Player mode only. If the bit is on the property is available. In this example Fog of War, God Mode and Forge World are available:

   00001011
      |||||----Fog of War
      ||||-----God Mode
      |||------Force 640x480
      ||-------Forge World
      |--------No Guest Spells

Byte 0x63: Bonus!

Padding byte.

Words 0x64 - 0x262: Markers

Markers are the 256*2 offsets, starting at offset 100 (in decimal). Offset 100 being the x coordinate of marker 0, and Offset 101 being the y coordinate of marker 0.

These go in a pattern until all 256 (0 to 255) markers are used up.

Word 0x264: Camera Start Position

Single Player only. The square to look at when the level starts. The bytes are in X, Y format. 0,0 implies start at the shaman.

Word 0x266: Camera Start Angle

Single Player only. The angle to look at when the level starts.