Actions

Header Format: Difference between revisions

From Populous Wiki

No edit summary
 
(25 intermediate revisions by 7 users not shown)
Line 1: Line 1:
The Header (.hdr) is a [[Populous]] Level File which contains the level's attrubutes.
The Header (.hdr) is a [[Populous]] Level File which contains the level's attributes.


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


These 3 bytes starting at byte 0 contain the spells blue starts off with. If you convert one of these bytes into binary then you can see all the spells it holds and there on or off value.
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===


If you convert 27 from hex to binary then you will get these values. The last two bytes do not contain anything, leave at 1.
In this example (Hex 27), [[Blast]] and [[Swarm]] are available.  
[[Blast]] and [[Swarm]] should be on.


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


===Byte 2===
===Byte 2===


If you convert 54 from hex to binary then you will get these values.
In this example (Hex 54), [[Earthquake]], [[Landbridge]] and [[Erode]] are available.
[[Earthquake]], [[Land Bridge]] and [[Erode]] should be on.


01010100
    01010100
||||||||----[[Firestorm]]
    ||||||||----[[Firestorm]]
|||||||-----[[Ghost Army]]
    |||||||-----[[Ghost Army]]
||||||------[[Erode]]
    ||||||------[[Erode]]
|||||-------[[Swamp]]
    |||||-------[[Swamp]]
||||--------[[Land Bridge]]
    ||||--------[[Landbridge]]
|||---------[[Angel of Death]]
    |||---------[[Angel of Death]]
||----------[[Earthquake]]
    ||----------[[Earthquake]]
|-----------[[Flatten]]
    |-----------[[Flatten]]


===Byte 3===
===Byte 3===


If you convert F4 from hex to binary then you will get these values. The bytes that contain nothing should be left at 1.
In this example (Hex F4), no spells are available. The other bits should be left unchanged.
Nothing should be on.


11110100
    11110100
     | ||----[[Volcano]]
        | ||----[[Volcano]]
     | |-----[[Convert]]
        | |-----[[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 Training Hut|Spy Hut]]
    |-----------[[Warrior Training Hut|Warrior Hut]]
 
===Byte 2===
 
In this example (Hex FF), [[Firewarrior Hut]], [[Boat Hut]] and [[Balloon Hut]] are available.
 
    11111111
     | |   |----[[Firewarrior Training Hut|Firewarrior Hut]]
     | |
    | |
    | |
    | |
    | |---------[[Boat Hut]]
     |
     |
     |-------[[Magical Shield]]
     |-----------[[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==


==Buildings==
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.


Buildings are just like spells. But they are kept in two bytes starting at byte 5.
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===
===Byte 1===


If you convert 0D from hex to binary then you will get these values. The bytes that contain nothing should be left at 1.
In this example (Hex 27), [[Blast]] and [[Swarm]] are not charging at the start of the game.  
[[Hut]] and [[Guard Tower]] should be on.


00001101
    00100111
||||| |
    ||||||||--Leave on
||||| |-----[[Hut]]
    |||||||---Leave on
|||||
    ||||||----[[Blast]]
|||||
    |||||-----[[Lightning]]
||||--------[[Guard Tower]]
    ||||------[[Tornado]]
|||---------[[Temple]]
    |||-------[[Swarm]]
||----------[[Spy Hut]]
    ||--------[[Invisibility]]
|-----------[[Warrior Hut]]
    |---------[[Hypnotise]]


===Byte 2===
===Byte 2===


If you convert FF from hex to binary then you will get these values. The bytes that contain nothing should be left at 1.
In this example (Hex 54), [[Earthquake]], [[Landbridge]] and [[Erode]] are not charging at the start of the game.
[[Firewarrior Hut]], [[Boat Hut]] and [[Balloon Hut]] should be on.
 
    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.


11111111
==Byte 0x58: Number of Players==
| |    |----[[Firewarrior Hut]]
| |
| |
| |
| |
| |---------[[Boat Hut]]
|
|-----------[[Balloon Hut]]


==Spells Not Charging==
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 can play the level 02, 03, or 04.


...
==Bytes 0x59 - 0x5B Computer Player Index==


==Fog of War and God Mode==
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).


This is kept in 1 byte stating at byte 98.
==Bytes 0x5C - 0x5F Allies==


00 - Nothing
[[Single Player]] only.
01 - Fog of War
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.
02 - God Mode
03 - Fog of War and God Mode


==Landscape and Tree Style==
Example: Blue is allied with green (byte 0x5C).
    00001001
        ||||----Blue
        |||-----Red
        ||------Yellow
        |-------Green


The Landscape Style is 1 byte starting at byte 96 and the Tree Style is 1 byte starting at byte 97.
Example: Red is allied with Yellow (byte 0x5D).
    00000110
        ||||----Blue
        |||-----Red
        ||------Yellow
        |-------Green


There are 36 landscape styles. In hex that is from 00 to 24.
==Byte 0x60: Level Type - Color Scheme==


There are 5 tree styles. In hex it goes 00, 03, 04, 05, 06.
There are 36 landscape styles. In hex that is from 0x00 to 0x23.


==Max Tribes==
==Byte 0x61: Object Bank - Tree Styles==


Maximum Tribes sets what tribes should appear on the level. In [[Single Player]] you must set this to the last colour on your level or 03. (Blue, Red, Yellow, Green). In [[Multiplayer]] you set this to how many players the level is. It is 1 byte long and starts at byte 88.
There are 8 tree styles. In hex, they are 0x00 to 0x07.


==AI Scripts==
==Byte 0x62: Level Flags==


AI Scripts are 3 bytes long and starts at byte 88. Each byte is for each colour (Red, Yellow, Green). You must type the script number n hex for it to link to that script. (Cpscr010.dat = 010 = 0A)
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:


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


Allies are kept in 4 bytes staring at byte 89.
==Byte 0x63: Bonus!==


Blue = 01
Padding byte.
Red = 02
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).
==Words 0x64 - 0x262: Markers==
Markers are pairs of X-Y bytes identifying the x/y coordinates of the marker. There are 100 available markers.


==Level Name==
==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.


==Markers==
==Word 0x266: Camera Start Angle==


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

Latest revision as of 09:46, 25 January 2014

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 can play the level 02, 03, or 04.

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 8 tree styles. In hex, they are 0x00 to 0x07.

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 pairs of X-Y bytes identifying the x/y coordinates of the marker. There are 100 available markers.

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.