ddnet/src/game/mapitems.h

191 lines
2.7 KiB
C
Raw Normal View History

2010-11-20 10:37:14 +00:00
/* (c) Magnus Auvinen. See licence.txt in the root of the distribution for more information. */
/* If you are missing that file, acquire a complete release at teeworlds.com. */
2010-05-29 07:25:38 +00:00
#ifndef GAME_MAPITEMS_H
#define GAME_MAPITEMS_H
// layer types
enum
{
LAYERTYPE_INVALID=0,
LAYERTYPE_GAME, // not used
LAYERTYPE_TILES,
LAYERTYPE_QUADS,
2010-05-29 07:25:38 +00:00
MAPITEMTYPE_VERSION=0,
MAPITEMTYPE_INFO,
MAPITEMTYPE_IMAGE,
MAPITEMTYPE_ENVELOPE,
MAPITEMTYPE_GROUP,
MAPITEMTYPE_LAYER,
MAPITEMTYPE_ENVPOINTS,
2010-05-29 07:25:38 +00:00
CURVETYPE_STEP=0,
CURVETYPE_LINEAR,
CURVETYPE_SLOW,
CURVETYPE_FAST,
CURVETYPE_SMOOTH,
NUM_CURVETYPES,
2010-05-29 07:25:38 +00:00
// game layer tiles
ENTITY_NULL=0,
ENTITY_SPAWN,
ENTITY_SPAWN_RED,
ENTITY_SPAWN_BLUE,
ENTITY_FLAGSTAND_RED,
ENTITY_FLAGSTAND_BLUE,
ENTITY_ARMOR_1,
ENTITY_HEALTH_1,
ENTITY_WEAPON_SHOTGUN,
ENTITY_WEAPON_GRENADE,
ENTITY_POWERUP_NINJA,
ENTITY_WEAPON_RIFLE,
NUM_ENTITIES,
2010-05-29 07:25:38 +00:00
TILE_AIR=0,
TILE_SOLID,
TILE_DEATH,
TILE_NOHOOK,
2010-05-29 07:25:38 +00:00
TILEFLAG_VFLIP=1,
TILEFLAG_HFLIP=2,
TILEFLAG_OPAQUE=4,
TILEFLAG_ROTATE=8,
2010-05-29 07:25:38 +00:00
LAYERFLAG_DETAIL=1,
2011-07-18 08:31:57 +00:00
TILESLAYERFLAG_GAME=1,
2010-05-29 07:25:38 +00:00
ENTITY_OFFSET=255-16*4,
};
struct CPoint
{
int x, y; // 22.10 fixed point
};
struct CColor
{
int r, g, b, a;
};
struct CQuad
{
CPoint m_aPoints[5];
CColor m_aColors[4];
CPoint m_aTexcoords[4];
2010-05-29 07:25:38 +00:00
int m_PosEnv;
int m_PosEnvOffset;
2010-05-29 07:25:38 +00:00
int m_ColorEnv;
int m_ColorEnvOffset;
};
class CTile
2010-05-29 07:25:38 +00:00
{
2010-07-05 19:04:19 +00:00
public:
2010-05-29 07:25:38 +00:00
unsigned char m_Index;
unsigned char m_Flags;
unsigned char m_Skip;
unsigned char m_Reserved;
};
struct CMapItemImage
{
int m_Version;
int m_Width;
int m_Height;
int m_External;
int m_ImageName;
int m_ImageData;
} ;
struct CMapItemGroup_v1
{
int m_Version;
int m_OffsetX;
int m_OffsetY;
int m_ParallaxX;
int m_ParallaxY;
int m_StartLayer;
int m_NumLayers;
} ;
struct CMapItemGroup : public CMapItemGroup_v1
{
2011-07-12 01:14:46 +00:00
enum { CURRENT_VERSION=3 };
2010-05-29 07:25:38 +00:00
int m_UseClipping;
int m_ClipX;
int m_ClipY;
int m_ClipW;
int m_ClipH;
2011-07-12 01:14:46 +00:00
int m_aName[3];
2010-05-29 07:25:38 +00:00
} ;
struct CMapItemLayer
{
int m_Version;
int m_Type;
int m_Flags;
} ;
struct CMapItemLayerTilemap
{
CMapItemLayer m_Layer;
int m_Version;
2010-05-29 07:25:38 +00:00
int m_Width;
int m_Height;
int m_Flags;
2010-05-29 07:25:38 +00:00
CColor m_Color;
int m_ColorEnv;
int m_ColorEnvOffset;
2010-05-29 07:25:38 +00:00
int m_Image;
int m_Data;
2011-07-12 01:14:46 +00:00
int m_aName[3];
2010-05-29 07:25:38 +00:00
} ;
struct CMapItemLayerQuads
{
CMapItemLayer m_Layer;
int m_Version;
2010-05-29 07:25:38 +00:00
int m_NumQuads;
int m_Data;
int m_Image;
2011-07-12 01:14:46 +00:00
int m_aName[3];
2010-05-29 07:25:38 +00:00
} ;
struct CMapItemVersion
{
int m_Version;
} ;
struct CEnvPoint
{
int m_Time; // in ms
int m_Curvetype;
int m_aValues[4]; // 1-4 depending on envelope (22.10 fixed point)
2010-05-29 07:25:38 +00:00
bool operator<(const CEnvPoint &Other) { return m_Time < Other.m_Time; }
} ;
struct CMapItemEnvelope
{
int m_Version;
int m_Channels;
int m_StartPoint;
int m_NumPoints;
int m_aName[8];
2010-05-29 07:25:38 +00:00
} ;
#endif