2014-01-24 09:00:59 +01:00
|
|
|
#ifndef OBJECT_DEFINES_H
|
|
|
|
#define OBJECT_DEFINES_H
|
|
|
|
|
2014-01-28 11:27:29 +01:00
|
|
|
#include <string>
|
|
|
|
#include <vector>
|
|
|
|
|
2014-01-24 09:00:59 +01:00
|
|
|
namespace GameLogic
|
|
|
|
{
|
2014-01-28 11:27:29 +01:00
|
|
|
/************************************
|
|
|
|
Enums
|
|
|
|
*************************************/
|
2014-02-07 14:12:54 +01:00
|
|
|
|
2014-01-24 09:00:59 +01:00
|
|
|
enum ObjectType
|
|
|
|
{
|
2014-01-28 11:27:29 +01:00
|
|
|
ObjectType_LevelMetaData,
|
2014-01-24 09:00:59 +01:00
|
|
|
ObjectType_Static,
|
|
|
|
ObjectType_Dynamic,
|
2014-02-03 14:50:15 +01:00
|
|
|
ObjectType_Light,
|
2014-01-28 11:27:29 +01:00
|
|
|
//Etc
|
2014-01-24 09:00:59 +01:00
|
|
|
|
|
|
|
ObjectType_NUM_OF_TYPES,
|
|
|
|
|
2014-02-03 14:50:15 +01:00
|
|
|
ObjectType_Unknown = -1
|
2014-01-24 09:00:59 +01:00
|
|
|
};
|
|
|
|
|
2014-02-07 14:12:54 +01:00
|
|
|
enum ObjectSpecialType
|
|
|
|
{
|
2014-02-07 15:20:34 +01:00
|
|
|
ObjectSpecialType_World, //Always the main celestial body
|
2014-02-07 14:12:54 +01:00
|
|
|
ObjectSpecialType_Building,
|
|
|
|
ObjectSpecialType_Damaging,
|
|
|
|
ObjectSpecialType_Explosive,
|
|
|
|
ObjectSpecialType_JumpPad,
|
|
|
|
ObjectSpecialType_BoostPad,
|
|
|
|
ObjectSpecialType_Portal,
|
|
|
|
ObjectSpecialType_SpawnPoint,
|
|
|
|
|
|
|
|
ObjectSpecialType_Count,
|
|
|
|
ObjectSpecialType_Unknown = -1
|
|
|
|
};
|
|
|
|
|
2014-01-28 11:27:29 +01:00
|
|
|
enum UsePhysics
|
|
|
|
{
|
|
|
|
UsePhysics_UseFullPhysics,
|
|
|
|
UsePhysics_IgnoreGravity,
|
|
|
|
UsePhysics_IgnorePhysics,
|
2014-02-04 11:36:10 +01:00
|
|
|
UsePhysics_IgnoreCollision,
|
2014-01-28 11:27:29 +01:00
|
|
|
|
|
|
|
UsePhysics_Count,
|
2014-02-03 14:50:15 +01:00
|
|
|
UsePhysics_Unknown = -1
|
|
|
|
};
|
|
|
|
|
2014-02-05 15:46:45 +01:00
|
|
|
enum CollisionGeometryType
|
|
|
|
{
|
|
|
|
CollisionGeometryType_Box,
|
|
|
|
CollisionGeometryType_Sphere,
|
2014-02-07 15:20:34 +01:00
|
|
|
CollisionGeometryType_Cylinder,
|
2014-02-05 15:46:45 +01:00
|
|
|
|
|
|
|
CollisionGeometryType_Count,
|
|
|
|
CollisionGeometryType_Unknown = -1
|
|
|
|
};
|
|
|
|
|
2014-02-07 14:12:54 +01:00
|
|
|
//Only supports Pointlight right now.
|
2014-02-03 14:50:15 +01:00
|
|
|
enum LightType
|
|
|
|
{
|
|
|
|
LightType_PointLight,
|
2014-02-07 14:12:54 +01:00
|
|
|
//LightType_DirectionalLight,
|
|
|
|
//LightType_SpotLight,
|
2014-02-03 14:50:15 +01:00
|
|
|
|
|
|
|
LightType_Count,
|
|
|
|
LightType_Unknown = -1
|
2014-01-28 11:27:29 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
//Should this be moved somewhere else?
|
|
|
|
enum GameMode
|
|
|
|
{
|
|
|
|
GameMode_FreeForAll,
|
|
|
|
GameMode_TeamDeathMatch,
|
|
|
|
//Etc
|
|
|
|
|
|
|
|
GameMode_Count,
|
2014-02-03 14:50:15 +01:00
|
|
|
GameMode_Unknown = -1
|
2014-01-28 11:27:29 +01:00
|
|
|
};
|
|
|
|
|
2014-02-05 15:46:45 +01:00
|
|
|
enum WorldSize
|
|
|
|
{
|
|
|
|
WorldSize_Tiny,
|
|
|
|
WorldSize_Small,
|
|
|
|
WorldSize_Medium,
|
|
|
|
WorldSize_Big,
|
|
|
|
WorldSize_Humongous,
|
|
|
|
|
|
|
|
WorldSize_Count,
|
|
|
|
WorldSize_Unknown = -1
|
|
|
|
};
|
|
|
|
|
2014-01-28 11:27:29 +01:00
|
|
|
|
|
|
|
/************************************
|
|
|
|
Structs
|
|
|
|
*************************************/
|
2014-02-07 14:12:54 +01:00
|
|
|
namespace LevelLoaderInternal
|
2014-01-28 11:27:29 +01:00
|
|
|
{
|
2014-02-07 14:12:54 +01:00
|
|
|
struct FormatVersion
|
2014-01-28 11:27:29 +01:00
|
|
|
{
|
2014-02-07 14:12:54 +01:00
|
|
|
unsigned int formatVersionMajor;
|
|
|
|
unsigned int formatVersionMinor;
|
|
|
|
|
|
|
|
FormatVersion()
|
|
|
|
: formatVersionMajor(0), formatVersionMinor(0)
|
|
|
|
{}
|
|
|
|
|
|
|
|
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-01-28 11:27:29 +01:00
|
|
|
|
2014-01-24 09:00:59 +01:00
|
|
|
struct ObjectTypeHeader
|
|
|
|
{
|
|
|
|
ObjectType typeID;
|
2014-02-07 14:44:25 +01:00
|
|
|
|
|
|
|
//Unless this is here the object destructor wont be called.
|
|
|
|
virtual ~ObjectTypeHeader(){}
|
2014-01-28 11:27:29 +01:00
|
|
|
};
|
2014-01-24 09:00:59 +01:00
|
|
|
|
2014-02-07 14:12:54 +01:00
|
|
|
namespace LevelLoaderInternal
|
2014-01-28 11:27:29 +01:00
|
|
|
{
|
2014-02-07 14:12:54 +01:00
|
|
|
const FormatVersion boundingVolumeVersion(1, 0);
|
|
|
|
|
|
|
|
struct BoundingVolumeBase
|
|
|
|
{
|
|
|
|
float position[3];
|
|
|
|
};
|
|
|
|
|
|
|
|
struct BoundingVolumeBox : public BoundingVolumeBase
|
|
|
|
{
|
|
|
|
float size[3];
|
|
|
|
float angularAxis[3];
|
|
|
|
float angle;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct BoundingVolumeSphere : public BoundingVolumeBase
|
|
|
|
{
|
|
|
|
float radius;
|
|
|
|
};
|
|
|
|
|
2014-02-07 15:20:34 +01:00
|
|
|
struct BoundingVolumeCylinder : public BoundingVolumeBase
|
|
|
|
{
|
|
|
|
float length;
|
|
|
|
float angularAxis[3];
|
|
|
|
float angle;
|
|
|
|
float radius;
|
|
|
|
};
|
|
|
|
|
2014-02-07 14:12:54 +01:00
|
|
|
struct BoundingVolume
|
|
|
|
{
|
|
|
|
CollisionGeometryType geoType;
|
|
|
|
union
|
|
|
|
{
|
|
|
|
LevelLoaderInternal::BoundingVolumeBox box;
|
|
|
|
LevelLoaderInternal::BoundingVolumeSphere sphere;
|
2014-02-07 15:20:34 +01:00
|
|
|
LevelLoaderInternal::BoundingVolumeCylinder cylinder;
|
2014-02-07 14:12:54 +01:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
struct PhysicsObject
|
|
|
|
{
|
|
|
|
UsePhysics usePhysics;
|
|
|
|
float mass;
|
|
|
|
float inertiaMagnitude[3];
|
|
|
|
float inertiaRotation[3];
|
|
|
|
float frictionCoeffStatic;
|
|
|
|
float frictionCoeffDynamic;
|
|
|
|
float restitutionCoeff;
|
|
|
|
BoundingVolume boundingVolume;
|
|
|
|
};
|
|
|
|
}
|
2014-01-28 11:27:29 +01:00
|
|
|
|
2014-02-05 15:46:45 +01:00
|
|
|
struct LevelMetaData : public ObjectTypeHeader
|
2014-01-28 11:27:29 +01:00
|
|
|
{
|
|
|
|
std::string levelName;
|
2014-02-05 15:46:45 +01:00
|
|
|
unsigned int levelVersion;
|
2014-01-28 11:27:29 +01:00
|
|
|
std::string levelDescription;
|
|
|
|
std::string levelAuthor;
|
2014-02-05 15:46:45 +01:00
|
|
|
unsigned int maxNumberOfPlayer;
|
|
|
|
WorldSize worldSize;
|
2014-02-04 11:36:10 +01:00
|
|
|
std::string overviewPicturePath;
|
2014-01-28 11:27:29 +01:00
|
|
|
std::vector<GameMode> gameModesSupported;
|
2014-02-07 14:44:25 +01:00
|
|
|
|
|
|
|
virtual ~LevelMetaData(){}
|
|
|
|
|
2014-01-24 09:00:59 +01:00
|
|
|
};
|
|
|
|
|
2014-02-07 14:12:54 +01:00
|
|
|
struct ObjectHeader : public ObjectTypeHeader, public LevelLoaderInternal::PhysicsObject
|
2014-01-24 09:00:59 +01:00
|
|
|
{
|
2014-02-07 14:12:54 +01:00
|
|
|
//Special type id for special objects: portal, jumppad, exploding objects, etc.
|
|
|
|
ObjectSpecialType specialTypeID;
|
2014-01-24 09:00:59 +01:00
|
|
|
//Model,
|
2014-02-04 11:36:10 +01:00
|
|
|
std::string ModelFile;
|
2014-01-24 09:00:59 +01:00
|
|
|
//Position
|
|
|
|
float position[3];
|
|
|
|
//Rotation
|
|
|
|
float rotation[3];
|
2014-02-05 15:46:45 +01:00
|
|
|
float angle;
|
2014-01-24 09:00:59 +01:00
|
|
|
//Scale
|
|
|
|
float scale[3];
|
2014-02-07 14:44:25 +01:00
|
|
|
|
|
|
|
virtual ~ObjectHeader(){}
|
2014-01-24 09:00:59 +01:00
|
|
|
};
|
2014-02-03 14:50:15 +01:00
|
|
|
|
2014-02-07 14:12:54 +01:00
|
|
|
/************************************
|
|
|
|
Special objects
|
|
|
|
*************************************/
|
|
|
|
|
|
|
|
struct JumpPadAttributes : public ObjectHeader
|
|
|
|
{
|
|
|
|
float direction[3];
|
|
|
|
float power;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct PortalAttributes : public ObjectHeader
|
|
|
|
{
|
|
|
|
float destination[3];
|
|
|
|
};
|
|
|
|
|
|
|
|
struct SpawnPointAttributes : public ObjectHeader
|
|
|
|
{
|
|
|
|
float spawnPosition[3];
|
|
|
|
};
|
2014-02-03 14:50:15 +01:00
|
|
|
|
|
|
|
/************************************
|
|
|
|
Lights
|
|
|
|
*************************************/
|
|
|
|
|
|
|
|
struct BasicLight : public ObjectTypeHeader
|
|
|
|
{
|
2014-02-07 14:12:54 +01:00
|
|
|
LightType lightType; //Is not used right now
|
|
|
|
float color[3];
|
|
|
|
float position[3];
|
|
|
|
float raduis;
|
|
|
|
float intensity;
|
2014-02-03 14:50:15 +01:00
|
|
|
};
|
2014-02-07 14:12:54 +01:00
|
|
|
/* We only support pointlight right now.
|
2014-02-03 14:50:15 +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-07 14:12:54 +01:00
|
|
|
};*/
|
2014-01-24 09:00:59 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|