Files
assaultcube-/source/src/world.h
T
driAn e5637db96c no message
git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@774 e016b1c5-ed68-44aa-a2f7-31cac88cffde
2006-12-09 14:57:51 +00:00

66 lines
2.4 KiB
C

enum // block types, order matters!
{
SOLID = 0, // entirely solid cube [only specifies wtex]
CORNER, // half full corner of a wall
FHF, // floor heightfield using neighbour vdelta values
CHF, // idem ceiling
SPACE, // entirely empty cube
SEMISOLID, // generated by mipmapping
MAXTYPE
};
struct sqr
{
uchar type; // one of the above
char floor, ceil; // height, in cubes
uchar wtex, ftex, ctex; // wall/floor/ceil texture ids
uchar r, g, b; // light value at upper left vertex
uchar vdelta; // vertex delta, used for heightfield cubes
char defer; // used in mipmapping, when true this cube is not a perfect mip
char occluded; // true when occluded
uchar utex; // upper wall tex id
uchar tag; // used by triggers
};
enum // hardcoded texture numbers
{
DEFAULT_SKY = 0,
DEFAULT_LIQUID,
DEFAULT_WALL,
DEFAULT_FLOOR,
DEFAULT_CEIL
};
#define MAPVERSION 6 // bump if map format changes, see worldio.cpp
struct header // map file format header
{
char head[4]; // "CUBE"
int version; // any >8bit quantity is a little indian
int headersize; // sizeof(header)
int sfactor; // in bits
int numents;
char maptitle[128];
uchar texlists[3][256];
int waterlevel;
int reserved[15];
};
#define SWS(w,x,y,s) (&(w)[(y)*(s)+(x)])
#define SW(w,x,y) SWS(w,x,y,ssize)
#define S(x,y) SW(world,x,y) // convenient lookup of a lowest mip cube
#define S_SECURE(x, y) ((y)*ssize+(x)<=mipsize ? S(x,y) : NULL) // same as above, but validates coords
#define SMALLEST_FACTOR 6 // determines number of mips there can be
#define DEFAULT_FACTOR 8
#define LARGEST_FACTOR 11 // 10 is already insane
#define SOLID(x) ((x)->type==SOLID)
#define MINBORD 2 // 2 cubes from the edge of the world are always solid
#define OUTBORD(x,y) ((x)<MINBORD || (y)<MINBORD || (x)>=ssize-MINBORD || (y)>=ssize-MINBORD)
struct block { int x, y, xs, ys; };
// vertex array format
struct vertex { float u, v, x, y, z; uchar r, g, b, a; };