Actions

Header Format: Difference between revisions

From Populous Wiki

(rewrote to include all bytes in order.)
Line 1: Line 1:
The Header (.hdr) is a [[Populous]] Level File which contains the level's attributes.
The Header (.hdr) is a [[Populous]] Level File which contains the level's attributes.


==Spells==
==Long 0x00: Spells Available==


The three bytes 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.
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===
===Byte 1===
Line 43: Line 43:
         |-------[[Magical Shield]]
         |-------[[Magical Shield]]


==Buildings==
==Long 0x04: Buildings Available==


Building availability is handled in the same way as spells, but are kept in two bytes starting at byte 5.
Building availability is handled in the same way as spells, but are kept in the next long starting at byte 5.


===Byte 5===
===Byte 1===


In this example (Hex 1F), [[Hut]] and [[Guard Tower]] are available. Leave other bits unchanged.
In this example (Hex 1F), [[Hut]] and [[Guard Tower]] are available. Leave other bits unchanged.
Line 61: Line 61:
     |-----------[[Warrior Training Hut|Warrior Hut]]
     |-----------[[Warrior Training Hut|Warrior Hut]]


===Byte 6===
===Byte 2===


In this example (Hex FF), [[Firewarrior Hut]], [[Boat Hut]] and [[Balloon Hut]] are available.
In this example (Hex FF), [[Firewarrior Hut]], [[Boat Hut]] and [[Balloon Hut]] are available.
Line 75: Line 75:
     |-----------[[Balloon Hut]]
     |-----------[[Balloon Hut]]


==Spells Not Charging==
==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==


Spells not charging starts at offset 16 and contains 3 byres of data. These three bytes 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 gameThe user can change this state by right-clicking the icon of the spell.
The fourth long is the buildings available to build once, the same as one-shots from worship itemsThese are organized the same way as the buildings available.


The bits used for each spell are identical to the bits used in the spells section.


===Byte 16===
==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.  
In this example (Hex 27), [[Blast]] and [[Swarm]] are not charging at the start of the game.  
Line 95: Line 104:
     |---------[[Hypnotise]]
     |---------[[Hypnotise]]


===Byte 17===
===Byte 2===


In this example (Hex 54), [[Earthquake]], [[Landbridge]] and [[Erode]] are not charging at the start of the game.
In this example (Hex 54), [[Earthquake]], [[Landbridge]] and [[Erode]] are not charging at the start of the game.
Line 109: Line 118:
     |-----------[[Flatten]]
     |-----------[[Flatten]]


===Byte 18===
===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.
In this example (Hex F4), all spells in question are charging at the start of the game. The other bits should be left unchanged.
Line 119: Line 128:
         |-------[[Magical Shield]]
         |-------[[Magical Shield]]


==Fog of War and God Mode==


Fog of War and God Mode are stored in Byte 98.
==Bytes 0x14 - 0x33: Spells Available - Once==


===Byte 98===
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.


    00001101
==Word 0x34: Vehicles Available==
          ||----[[Fog of War]]
 
          |-----[[God Mode]]
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.


==Landscape and Tree Style==
==Bytes 0x38 - 0x57 Level Name==


The Landscape Style is 1 byte starting at byte 96 and the Tree Style is 1 byte starting at byte 97.
The level name is 32 bytes (8 bit signed-characters) long.


===Byte 96===
==Byte 0x58: Number of Players==


There are 36 landscape styles. In hex that is from 00 to 24.
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.


===Byte 97===
==Bytes 0x59 - 0x5B Computer Player Index==


There are 5 tree styles. In hex, they are 00, 03, 04, 05, 06.
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).


==Max Tribes==
==Bytes 0x5C - 0x5F Allies==


Maximum Tribes sets the number of enemy tribes that will appear on the level. In [[Single Player]] you must set this to the last colour on your level or 03 for all of them. Colours go in the order (Blue, Red, Yellow, Green). If you wanted to have only Blue and Yellow on a level, then the number must still be set to 02. In [[Multiplayer]] you just set this to how many players the level has minus one as you cannot omit colours. It is 1 byte long and starts at byte 88.
[[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 boolean true 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.


===Byte 89===
Example: Blue is allied with green.
    00001001
        ||||----Blue
        |||-----Red
        ||------Yellow
        |-------Green


01 - Blue
==Byte 0x60: Level Type - Color Scheme==
02 - Blue & Red
03 - Blue, Red & Yellow
04 - Blue, Red, Yellow & Green


==AI Scripts==
There are 36 landscape styles. In hex that is from 0x00 to 0x24.


AI Scripts are 3 bytes long and starts at byte 89. Each byte is for each colour (Red, Yellow, Green). You must type the script number in hex for it to link to that script. (Cpscr010.dat = 010 = 0A)
==Byte 0x61: Object Bank - Tree Styles==


==Allies==
There are 5 tree styles. In hex, they are 0x00 to 0x06.


Allies are kept in 4 bytes staring at byte 92.
==Byte 0x62: Level Flags==


Blue = 01
[[Single Player]] only.
Red = 02
Fog of War, God Mode, and other flags are set as booleans in this byte:
Yellow = 04
Green = 08


An ally equals the two colours together. To make yellow and blue allies you would add Blue(01) and Yellow(04) together which makes 05. Then put 05 for yellow and blue (05 02 05 08).
    00001101
      |||||----[[Fog of War]]
      ||||-----[[God Mode]]
      |||------Force 640x480
      ||-------Forge World
      |--------No Guest Spells


==Level Name==
==Byte 0x63: Bonus!==


The level name starts at offset 55 (37 in hex) and is 32 bytes (8 bit signed-characters) long.
Padding byte.


==Markers==
==Words 0x64 - 0x262: Markers==


Markers are the 256*2 offsets, starting at offset 100 (in decimal).
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.
Offset 100 being the x coordinate of marker 0, and Offset 101 being the y coordinate of marker 0.


This goes in a pattern until all 256 (0 to 255) markers are used up.
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.

Revision as of 05:41, 19 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 starting at byte 5.

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.

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 boolean true 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.
   00001001
       ||||----Blue
       |||-----Red
       ||------Yellow
       |-------Green

Byte 0x60: Level Type - Color Scheme

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

Byte 0x61: Object Bank - Tree Styles

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

Byte 0x62: Level Flags

Single Player only. Fog of War, God Mode, and other flags are set as booleans in this byte:

   00001101
      |||||----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.