2014-02-10 14:00:14 +01:00
|
|
|
#ifndef OBJECT_DEFINES_H
|
|
|
|
#define OBJECT_DEFINES_H
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
namespace GameLogic
|
|
|
|
{
|
|
|
|
/************************************
|
|
|
|
Enums
|
|
|
|
*************************************/
|
2014-02-12 14:48:58 +01:00
|
|
|
|
2014-02-10 14:00:14 +01:00
|
|
|
enum ObjectType
|
|
|
|
{
|
|
|
|
ObjectType_LevelMetaData,
|
|
|
|
ObjectType_Static,
|
|
|
|
ObjectType_Dynamic,
|
|
|
|
ObjectType_Light,
|
2014-02-14 15:18:38 +01:00
|
|
|
ObjectType_SpawnPoint,
|
2014-02-10 14:00:14 +01:00
|
|
|
//Etc
|
|
|
|
|
|
|
|
ObjectType_NUM_OF_TYPES,
|
|
|
|
|
|
|
|
ObjectType_Unknown = -1
|
|
|
|
};
|
|
|
|
|
2014-02-12 14:48:58 +01:00
|
|
|
enum ObjectSpecialType
|
2014-02-10 14:00:14 +01:00
|
|
|
{
|
2014-02-12 14:48:58 +01:00
|
|
|
ObjectSpecialType_None,
|
|
|
|
ObjectSpecialType_Sky,
|
|
|
|
ObjectSpecialType_World, //Always the main celestial body
|
|
|
|
ObjectSpecialType_Building,
|
|
|
|
ObjectSpecialType_Stone,
|
2014-02-19 11:00:16 +01:00
|
|
|
ObjectSpecialType_StandardBox,
|
2014-02-12 14:48:58 +01:00
|
|
|
ObjectSpecialType_RedExplosiveBox,
|
|
|
|
ObjectSpecialType_SpikeBox,
|
|
|
|
ObjectSpecialType_Spike,
|
|
|
|
ObjectSpecialType_CrystalFormation,
|
|
|
|
ObjectSpecialType_CrystalShard,
|
|
|
|
ObjectSpecialType_JumpPad,
|
|
|
|
ObjectSpecialType_Portal,
|
|
|
|
ObjectSpecialType_Player,
|
2014-02-19 11:00:16 +01:00
|
|
|
ObjectSpecialType_Generic,
|
2014-02-12 14:48:58 +01:00
|
|
|
|
2014-02-10 14:00:14 +01:00
|
|
|
|
2014-02-12 14:48:58 +01:00
|
|
|
ObjectSpecialType_Count,
|
|
|
|
ObjectSpecialType_Unknown = -1
|
2014-02-10 14:00:14 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
enum CollisionGeometryType
|
|
|
|
{
|
|
|
|
CollisionGeometryType_Box,
|
|
|
|
CollisionGeometryType_Sphere,
|
2014-02-12 14:48:58 +01:00
|
|
|
CollisionGeometryType_Cylinder,
|
2014-02-22 12:58:43 +01:00
|
|
|
CollisionGeometryType_CG_MESH,
|
2014-02-10 14:00:14 +01:00
|
|
|
|
|
|
|
CollisionGeometryType_Count,
|
|
|
|
CollisionGeometryType_Unknown = -1
|
|
|
|
};
|
|
|
|
|
2014-02-12 14:48:58 +01:00
|
|
|
//Only supports Pointlight right now.
|
2014-02-10 14:00:14 +01:00
|
|
|
enum LightType
|
|
|
|
{
|
|
|
|
LightType_PointLight,
|
2014-02-12 14:48:58 +01:00
|
|
|
//LightType_DirectionalLight,
|
|
|
|
//LightType_SpotLight,
|
2014-02-10 14:00:14 +01:00
|
|
|
|
|
|
|
LightType_Count,
|
|
|
|
LightType_Unknown = -1
|
|
|
|
};
|
|
|
|
|
|
|
|
//Should this be moved somewhere else?
|
|
|
|
enum GameMode
|
|
|
|
{
|
|
|
|
GameMode_FreeForAll,
|
|
|
|
GameMode_TeamDeathMatch,
|
|
|
|
//Etc
|
|
|
|
|
|
|
|
GameMode_Count,
|
|
|
|
GameMode_Unknown = -1
|
|
|
|
};
|
|
|
|
|
|
|
|
enum WorldSize
|
|
|
|
{
|
|
|
|
WorldSize_Tiny,
|
|
|
|
WorldSize_Small,
|
|
|
|
WorldSize_Medium,
|
|
|
|
WorldSize_Big,
|
|
|
|
WorldSize_Humongous,
|
|
|
|
|
|
|
|
WorldSize_Count,
|
|
|
|
WorldSize_Unknown = -1
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/************************************
|
|
|
|
Structs
|
|
|
|
*************************************/
|
2014-02-12 14:48:58 +01:00
|
|
|
namespace LevelLoaderInternal
|
2014-02-10 14:00:14 +01:00
|
|
|
{
|
2014-02-12 14:48:58 +01:00
|
|
|
struct FormatVersion
|
2014-02-10 14:00:14 +01:00
|
|
|
{
|
2014-02-12 14:48:58 +01:00
|
|
|
unsigned int formatVersionMajor;
|
|
|
|
unsigned int formatVersionMinor;
|
|
|
|
|
|
|
|
FormatVersion()
|
|
|
|
: formatVersionMajor(0), formatVersionMinor(0)
|
|
|
|
{}
|
2014-02-10 14:00:14 +01:00
|
|
|
|
2014-02-12 14:48:58 +01:00
|
|
|
FormatVersion(unsigned int major, unsigned int minor)
|
|
|
|
: formatVersionMajor(major), formatVersionMinor(minor)
|
|
|
|
{}
|
|
|
|
|
|
|
|
bool operator ==(const FormatVersion& obj)
|
|
|
|
{
|
|
|
|
return (this->formatVersionMajor == obj.formatVersionMajor && this->formatVersionMinor == obj.formatVersionMinor);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool operator !=(const FormatVersion& obj)
|
|
|
|
{
|
|
|
|
return !(*this == obj);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
2014-02-10 14:00:14 +01:00
|
|
|
|
|
|
|
struct ObjectTypeHeader
|
|
|
|
{
|
|
|
|
ObjectType typeID;
|
2014-02-12 14:48:58 +01:00
|
|
|
|
|
|
|
//Unless this is here the object destructor wont be called.
|
|
|
|
virtual ~ObjectTypeHeader(){}
|
2014-02-10 14:00:14 +01:00
|
|
|
};
|
|
|
|
|
2014-02-12 14:48:58 +01:00
|
|
|
namespace LevelLoaderInternal
|
2014-02-10 14:00:14 +01:00
|
|
|
{
|
2014-02-12 14:48:58 +01:00
|
|
|
const FormatVersion boundingVolumeVersion(2, 0);
|
|
|
|
|
|
|
|
struct BoundingVolumeBase
|
|
|
|
{
|
|
|
|
CollisionGeometryType geoType;
|
|
|
|
float position[3];
|
|
|
|
float rotation[4];
|
|
|
|
float frictionCoeffStatic;
|
|
|
|
float frictionCoeffDynamic;
|
|
|
|
float restitutionCoeff;
|
|
|
|
float mass;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct BoundingVolumeBox : public BoundingVolumeBase
|
|
|
|
{
|
|
|
|
float size[3];
|
|
|
|
};
|
|
|
|
|
|
|
|
struct BoundingVolumeSphere : public BoundingVolumeBase
|
|
|
|
{
|
|
|
|
float radius;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct BoundingVolumeCylinder : public BoundingVolumeBase
|
|
|
|
{
|
|
|
|
float length;
|
|
|
|
float radius;
|
|
|
|
};
|
|
|
|
|
2014-02-22 12:58:43 +01:00
|
|
|
struct BoundingVolumeCGMesh : public BoundingVolumeBase
|
|
|
|
{
|
|
|
|
wchar_t filename[128];
|
|
|
|
};
|
|
|
|
|
2014-02-12 14:48:58 +01:00
|
|
|
struct BoundingVolume
|
|
|
|
{
|
|
|
|
CollisionGeometryType geoType;
|
|
|
|
union
|
|
|
|
{
|
|
|
|
LevelLoaderInternal::BoundingVolumeBox box;
|
|
|
|
LevelLoaderInternal::BoundingVolumeSphere sphere;
|
|
|
|
LevelLoaderInternal::BoundingVolumeCylinder cylinder;
|
2014-02-22 12:58:43 +01:00
|
|
|
LevelLoaderInternal::BoundingVolumeCGMesh cgMesh;
|
2014-02-12 14:48:58 +01:00
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|
2014-02-10 14:00:14 +01:00
|
|
|
|
|
|
|
struct LevelMetaData : public ObjectTypeHeader
|
|
|
|
{
|
|
|
|
std::string levelName;
|
|
|
|
unsigned int levelVersion;
|
|
|
|
std::string levelDescription;
|
|
|
|
std::string levelAuthor;
|
|
|
|
unsigned int maxNumberOfPlayer;
|
|
|
|
WorldSize worldSize;
|
|
|
|
std::string overviewPicturePath;
|
|
|
|
std::vector<GameMode> gameModesSupported;
|
2014-02-12 14:48:58 +01:00
|
|
|
|
|
|
|
virtual ~LevelMetaData(){}
|
|
|
|
|
2014-02-10 14:00:14 +01:00
|
|
|
};
|
|
|
|
|
2014-02-12 14:48:58 +01:00
|
|
|
struct ObjectHeader : public ObjectTypeHeader
|
2014-02-10 14:00:14 +01:00
|
|
|
{
|
2014-02-12 14:48:58 +01:00
|
|
|
//Special type id for special objects: portal, jumppad, exploding objects, etc.
|
|
|
|
ObjectSpecialType specialTypeID;
|
2014-02-10 14:00:14 +01:00
|
|
|
//Model,
|
|
|
|
std::string ModelFile;
|
|
|
|
//Position
|
|
|
|
float position[3];
|
2014-02-12 14:48:58 +01:00
|
|
|
//Rotation Quaternion
|
|
|
|
float rotation[4];
|
2014-02-10 14:00:14 +01:00
|
|
|
//Scale
|
|
|
|
float scale[3];
|
2014-02-12 14:48:58 +01:00
|
|
|
|
|
|
|
::GameLogic::LevelLoaderInternal::BoundingVolume boundingVolume;
|
|
|
|
|
|
|
|
virtual ~ObjectHeader(){}
|
2014-02-10 14:00:14 +01:00
|
|
|
};
|
|
|
|
|
2014-02-14 15:18:38 +01:00
|
|
|
//inheritance from the base class because there is no use for ModelFile, Rotation and Scale
|
|
|
|
//so this is a special struct for just spawnpoints
|
|
|
|
struct SpawnPointAttributes : public ObjectTypeHeader
|
|
|
|
{
|
|
|
|
float position[3];
|
|
|
|
};
|
|
|
|
|
2014-02-12 14:48:58 +01:00
|
|
|
/************************************
|
|
|
|
Special objects
|
|
|
|
*************************************/
|
|
|
|
|
|
|
|
struct JumpPadAttributes : public ObjectHeader
|
|
|
|
{
|
|
|
|
float direction[3];
|
|
|
|
float power;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct PortalAttributes : public ObjectHeader
|
|
|
|
{
|
|
|
|
float destination[3];
|
|
|
|
};
|
|
|
|
|
|
|
|
struct WorldAttributes : public ObjectHeader
|
|
|
|
{
|
|
|
|
float worldSize;
|
|
|
|
float atmoSphereSize;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct SkyAttributes : public ObjectHeader
|
|
|
|
{
|
|
|
|
float skySize;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2014-02-10 14:00:14 +01:00
|
|
|
|
2014-02-14 15:18:38 +01:00
|
|
|
|
|
|
|
|
2014-02-10 14:00:14 +01:00
|
|
|
/************************************
|
|
|
|
Lights
|
|
|
|
*************************************/
|
|
|
|
|
|
|
|
struct BasicLight : public ObjectTypeHeader
|
|
|
|
{
|
2014-02-12 14:48:58 +01:00
|
|
|
LightType lightType; //Is not used right now
|
|
|
|
float color[3];
|
|
|
|
float position[3];
|
2014-02-22 12:58:43 +01:00
|
|
|
float radius;
|
2014-02-12 14:48:58 +01:00
|
|
|
float intensity;
|
2014-02-22 12:58:43 +01:00
|
|
|
|
|
|
|
virtual ~BasicLight(){}
|
2014-02-10 14:00:14 +01:00
|
|
|
};
|
2014-02-12 14:48:58 +01:00
|
|
|
/* We only support pointlight right now.
|
2014-02-10 14:00:14 +01:00
|
|
|
struct PointLight : public BasicLight
|
|
|
|
{
|
|
|
|
float position[3];
|
|
|
|
};
|
|
|
|
|
|
|
|
struct DirectionalLight : public BasicLight
|
|
|
|
{
|
|
|
|
float direction[3];
|
|
|
|
};
|
|
|
|
|
|
|
|
struct SpotLight : public BasicLight
|
|
|
|
{
|
|
|
|
float direction[3];
|
|
|
|
float range;
|
|
|
|
float attenuation[3];
|
2014-02-12 14:48:58 +01:00
|
|
|
};*/
|
2014-02-10 14:00:14 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|