Skip to content

Instantly share code, notes, and snippets.

@iamgreaser
Created November 9, 2011 21:08
Show Gist options
  • Save iamgreaser/1353035 to your computer and use it in GitHub Desktop.
Save iamgreaser/1353035 to your computer and use it in GitHub Desktop.
idea for an extended Ace of Spades map header
// An idea for an extended map header for Ace of Spades.
struct aos_maphead
{
char magic[8];
// "AoS~MAP\x1A"
// it's been carefully picked to obviously not be headerless
uint32_t fmt_version;
// work out your own version scheme
// I suggest just using "1" to start with
// and incrementing it when the format changes
uint32_t min_version;
// this is the minimum format version required to support this map
uint32_t eheader_size;
// size of extended header
// start of "extended header"
uint32_t tag_count;
// number of tags used in header
struct aos_tag taglist[tag_count];
// various tags that can be applied
// end of "extended header"
};
struct aos_map_tag
{
char magic[4]; // "magic number"
uint32_t size; // size of data[]
char data[size]; // corresponds to struct aos_map_tag_* data
};
struct aos_map_tag_dims
{
// MAGIC: "DIMS"
uint16_t width, height;
// DEFAULT: 512, 512
// some maximum must be given...
// 512x512 would be a good maximum
// it's already huge enough as it is
};
struct aos_map_tag_fog
{
// MAGIC: "FOG "
int32_t default_fog;
// in 0x00RRGGBB format
};
struct aos_map_tag_name
{
// MAGIC: "Name"
asciiz s_map_name;
// name of map
};
struct aos_map_tag_author
{
// MAGIC: "Auth"
asciiz s_map_author;
// who made this damn thing
};
struct aos_map_tag_comment
{
// MAGIC: "Comt"
asciiz s_map_comment;
// any comments this map needs
};
// you don't need to implement these just yet.
struct aos_map_tag_spawn
{
// MAGIC: "SPWN"
uint32_t type;
// type of thing to spawn
// e.g. 0 = player, 1 = tent, 2 = intel
uint32_t team;
// team this thing is for
// e.g. 0 = none, 1 = blue, 2 = green
uint32_t id;
// if a specific index is needed, use this
// e.g. tents for TC
uint16_t x1,y1,x2,y2;
// range to spawn thing:
// x1 <= x < x2
// y1 <= y < y2
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment