Actions

Header Format: Difference between revisions

From Populous Wiki

 
(15 intermediate revisions by 6 users not shown)
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


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


In this example (Hex 0D), [[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.


     00001101
     00011111
     ||||| |
     |||| |
     ||||| |-----[[Hut]]
     |||| |-----[[Hut]]
     |||||
     ||||
     |||||
     ||||
     ||||--------[[Guard Tower]]
     ||||--------[[Guard Tower]]
     |||---------[[Temple]]
     |||---------[[Temple]]
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==
 
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==


==Fog of War and God Mode==
Unused.


Fog of War and God Mode are stored in Byte 98.
==Bytes 0x38 - 0x57 Level Name==


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


    00001101
==Byte 0x58: Number of Players==
          ||----[[Fog of War]]
          |-----[[God Mode]]


==Landscape and Tree Style==
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.


The Landscape Style is 1 byte starting at byte 96 and the Tree Style is 1 byte starting at byte 97.
==Bytes 0x59 - 0x5B Computer Player Index==


===Byte 96===
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).


There are 36 landscape styles. In hex that is from 00 to 24.
==Bytes 0x5C - 0x5F Allies==


===Byte 97===
[[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.


There are 5 tree styles. In hex, they are 00, 03, 04, 05, 06.
Example: Blue is allied with green (byte 0x5C).
    00001001
        ||||----Blue
        |||-----Red
        ||------Yellow
        |-------Green


==Max Tribes==
Example: Red is allied with Yellow (byte 0x5D).
    00000110
        ||||----Blue
        |||-----Red
        ||------Yellow
        |-------Green


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.
==Byte 0x60: Level Type - Color Scheme==


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


01 - Blue
==Byte 0x61: Object Bank - Tree Styles==
02 - Blue & Red
03 - Blue, Red & Yellow
04 - Blue, Red, Yellow & Green


==AI Scripts==
There are 8 tree styles. In hex, they are 0x00 to 0x07.


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 0x62: Level Flags==


==Allies==
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 are kept in 4 bytes staring at byte 92.
    00001011
      |||||----[[Fog of War]]
      ||||-----[[God Mode]]
      |||------Force 640x480
      ||-------Forge World
      |--------No Guest Spells


Blue = 01
==Byte 0x63: Bonus!==
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).
Padding byte.


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


==Markers==
[[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 are the first 256*2 offsets.
==Word 0x266: Camera Start Angle==
Offset 0 being the x coordinate of marker 0, and Offset 1 being the y coordinate of marker 0.


This goes in a pattern until all 256 (0 to 255) markers are used up.
[[Single Player]] only.
The angle to look at when the level starts.

Latest revision as of 18:46, 24 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.