Config File Format
From DoonLunacy
The format itself is actually a map:
{
item = value;
item = value;
...
}
Every value can be of different format
- map
my_map_item = {
subitem = value;
anothersubitem = anotehervalue;
}
- array
my_array_item = (0, 1, test, "three word string", 35.6);
- string
my_string = this_is_text; my_string2 = "multiple word string has to be enclosed"; my_string3 = 'another version'
NOTES:
- in " enclosed string there cannot be a " (not even escaped (\"), similar for '
- arrays and maps can be nested without limits
- array items can be overriden later in file by myvalue[2] = "updated"; (index has to be either already existent or last existent index + 1)
- map items can be overriden lated in file by mymap.subitem = "new value";
sorry, the specs are not finished, they are evolving as i write the loader for config file...
quad = {
filename = "DUNE:UNITS.SHP"
smallimages = (0,1,2,3,4,-3,-2,-1); // '-' means swap x coords, '|' means swap y coords (use '-|' or '|-' for swapping whole image)
size = (1,1);
dt = DT_D8;
frames = 1;
offset = center; // other possibility is SPoint in pixels (10,5)
placement = {
/- array of directions
|/ array of rows (y)
||/ array of columns (x)
|||/ array of frames (animation)
||||
vvvv
default = ((((0))),(((1))),(((2))),(((3))),(((4))),(((5))),(((6))),(((7)))); // array of single value arrays (single frames)
}
}
refinery = {
filename = "icn://DUNE:ICON.ICN";
subimages = (1,2,3, 4, 7,8,9, 11,12, 14,15,16,17); // 4 additional flag, 11,12 harvester present 14,15, 16,17 two pairs of 'blinks' fro waiting harvester
dt = DT_D1;
// number of frames is calculated for every different placement !!!
// (lowest common denominator of frames for every piece), unfilled frames are filled by repeating from the begining of the sequence
offset = (0,0); // if building is higner (draw on the tile above, then write positive y offset) NOTE: there has to be some fix in renderer !
placement_mode = tiles;
placement = {
default = (
( (1), (2,4), (3)),
( (4), (8), (9))
);
waiting = (
( (1), (2,4), (3,14,16)),
( (4), (8), (9,15,17))
);
full = (
( (1), (2,4), (11)),
( (4), (8), (12))
);
{
}
// example of external graphic
repair_sign {
filename = "png://ADDITIONAL:repair_sign.png"
subimages = ( ((0,0),(16,16)), ((16,0),(16,16)), ((32,0),(16,16)) );
dt = DT_D1;
offset = center
placement_mode = coords;
placement = {
default = (
( (1:(0,0),2:(0,0),3:(0,0)) )
)
};
};
// basic powerplant
powerplant = {
filename = "icn://DUNE:ICON.ICN";
subimages = (1,2,3,4, 5); // 5 additional flag
dt = DT_D1;
offset = (0,0);
placement_mode = tiles;
placement = (
default = (
( (1), (2) ),
( (3), (4,5) ) // see two different images for flapping flag
)
)
};
// better powerplant (using animated colors as in original Dune II)
powerplant = {
filename = "icn://DUNE:ICON.ICN";
subimages = (
1:remap(123,1,25),2:123/1->25,3:123/1->25, // probably will stick with :remap(original,count,target)
1:123/1->26,2:123/1->26,3:123/1->26,
1:123/1->27,2:123/1->27,3:123/1->27,
4, 5); // 5 additional flag (consider 123 that pink color / 1 the number of colors to remap->25 one of the blue shades)
dt = DT_D1;
offset = (0,0);
placement_mode = tiles;
placement = (
default = (
( (1,4,7), (2,5,8) ),
( (3,6,9), (10,11) )
)
)
};
NOTES
- every protocol (icn://, shp://, png://) is responsible for creating array of indexed images (called subimages) (the protocol is given both address of file and subimages value in cfg file
- there will be available a class for working with subimages (for processing color remaps and flipping)
- not sure if flipping should be done with - and |, maybe use of :flip, :flipX, :flipY like :remap would be more consistent

