ddnet/src/game/g_mapitems.hpp

178 lines
2.4 KiB
C++
Raw Normal View History

2008-01-12 17:09:00 +00:00
/* copyright (c) 2007 magnus auvinen, see licence.txt for more info */
#ifndef GAME_MAPITEMS_H
#define GAME_MAPITEMS_H
// layer types
enum
{
LAYERTYPE_INVALID=0,
LAYERTYPE_GAME, // not used
LAYERTYPE_TILES,
LAYERTYPE_QUADS,
MAPITEMTYPE_VERSION=0,
MAPITEMTYPE_INFO,
MAPITEMTYPE_IMAGE,
MAPITEMTYPE_ENVELOPE,
MAPITEMTYPE_GROUP,
MAPITEMTYPE_LAYER,
2008-01-17 23:09:49 +00:00
MAPITEMTYPE_ENVPOINTS,
CURVETYPE_STEP=0,
CURVETYPE_LINEAR,
CURVETYPE_SLOW,
CURVETYPE_FAST,
CURVETYPE_SMOOTH,
NUM_CURVETYPES,
// game layer tiles
2008-01-12 17:09:00 +00:00
ENTITY_NULL=0,
ENTITY_SPAWN,
ENTITY_SPAWN_RED,
ENTITY_SPAWN_BLUE,
ENTITY_FLAGSTAND_RED,
ENTITY_FLAGSTAND_BLUE,
ENTITY_ARMOR_1,
ENTITY_HEALTH_1,
2008-01-12 17:09:00 +00:00
ENTITY_WEAPON_SHOTGUN,
2008-02-02 18:05:16 +00:00
ENTITY_WEAPON_GRENADE,
2008-01-12 17:09:00 +00:00
ENTITY_POWERUP_NINJA,
ENTITY_WEAPON_RIFLE,
2008-01-12 17:09:00 +00:00
NUM_ENTITIES,
TILE_AIR=0,
TILE_SOLID,
TILE_NOHOOK,
TILEFLAG_VFLIP=1,
TILEFLAG_HFLIP=2,
2008-03-29 11:44:03 +00:00
TILEFLAG_OPAQUE=4,
2008-01-12 17:09:00 +00:00
LAYERFLAG_DETAIL=1,
2008-01-12 17:09:00 +00:00
ENTITY_OFFSET=255-16*4,
};
typedef struct
{
int x, y; // 22.10 fixed point
} POINT;
typedef struct
{
int r, g, b, a;
} COLOR;
typedef struct
{
POINT points[5];
COLOR colors[4];
POINT texcoords[4];
int pos_env;
int pos_env_offset;
int color_env;
int color_env_offset;
} QUAD;
typedef struct
{
unsigned char index;
unsigned char flags;
2008-03-12 23:53:39 +00:00
unsigned char skip;
2008-03-29 11:44:03 +00:00
unsigned char reserved;
2008-01-12 17:09:00 +00:00
} TILE;
typedef struct
{
int version;
int width;
int height;
int external;
int image_name;
int image_data;
} MAPITEM_IMAGE;
2008-03-29 11:44:03 +00:00
struct MAPITEM_GROUP_v1
2008-01-12 17:09:00 +00:00
{
int version;
int offset_x;
int offset_y;
int parallax_x;
int parallax_y;
int start_layer;
int num_layers;
2008-03-29 11:44:03 +00:00
} ;
struct MAPITEM_GROUP : public MAPITEM_GROUP_v1
{
enum { CURRENT_VERSION=2 };
int use_clipping;
int clip_x;
int clip_y;
int clip_w;
int clip_h;
} ;
2008-01-12 17:09:00 +00:00
typedef struct
{
int version;
int type;
int flags;
} MAPITEM_LAYER;
typedef struct
{
MAPITEM_LAYER layer;
int version;
int width;
int height;
int flags;
COLOR color;
int color_env;
int color_env_offset;
int image;
int data;
} MAPITEM_LAYER_TILEMAP;
typedef struct
{
MAPITEM_LAYER layer;
int version;
int num_quads;
int data;
int image;
} MAPITEM_LAYER_QUADS;
typedef struct
{
int version;
} MAPITEM_VERSION;
2008-01-17 23:09:49 +00:00
typedef struct
{
int time; // in ms
int curvetype;
int values[4]; // 1-4 depending on envelope (22.10 fixed point)
} ENVPOINT;
typedef struct
{
int version;
int channels;
int start_point;
int num_points;
int name;
} MAPITEM_ENVELOPE;
2008-01-12 17:09:00 +00:00
#endif