So what exactly is the data lump? From a data definition point of view it is two things - it is a data structure description file and another file that is the actual data description. The data structure description file is a fixed entity that won't be rewritten by this API. In fact, since our program will need to match the data structure definition file we will format that file like a C/C++ header file so that it can also be compiled into our program if we like. We will support C structures, enumerated lists and macro definitions of constants.
For example:
houseGameStructs.h
typedef struct
{
S32 sign_offsetx;
S32 sign_offsety;
S32 x;
S32 y;
U32 neighbourhood;
U8 *street_addr;
U8 *spr;
}House;
enum
{
EVERGREEN_HEIGHTS,
OAKTOWN_CENTRAL,
LAKE_DRIVE,
};
The actual data file will be parsed after the data description file as that will define what the data is to look like. Every structure will have a default that gets copied into every new instance so that undefined fields are initialized by the previous instance. All defaults are initialized to zero at startup. For example:
houseGameData.txt
//This comment will attach to the House below
default House
sign_offsetx: -13 //this comment will attach to this field
sign_offsety: -13
spr: "RedBrickHouse.png"
neighbourhood: EVERGREEN_HEIGHTS
End House
House
x: 500
y: 300
End House
House
x: 255
y: 475
End House
House
x: 610
y: 505
neighbourhood: OAKTOWN_CENTRAL
End House
Since the red brick house sprite will usually have a for sale sign sprouted at the same place relative to it's hotspot it is handy to setup a default house of that type and then the three house instances that follow will inherit those fields from it so that only their unique data needs to be added.
Part 3, the data lump API, coming soon,
L
No comments have been provided.

Your Name: | |
Your Location: | |
Country (flag): | |
Article Rating: | |
Your Comments: | |
Security check * | |