2014-01-13 12:44:33 +01:00
|
|
|
/////////////////////////////////////////////////////////////////////
|
|
|
|
// Created by [Erik Persson] [2013]
|
|
|
|
/////////////////////////////////////////////////////////////////////
|
|
|
|
|
2014-01-10 12:33:04 +01:00
|
|
|
#ifndef GAME_H
|
|
|
|
#define GAME_H
|
|
|
|
|
2014-01-20 15:47:52 +01:00
|
|
|
//Includes windows so we need to undef minmax
|
|
|
|
#define NOMINMAX
|
|
|
|
#include <vld.h>
|
|
|
|
|
|
|
|
#include "GameAPI.h"
|
|
|
|
#include "Player.h"
|
|
|
|
#include "Level.h"
|
|
|
|
|
|
|
|
#include <DynamicArray.h>
|
|
|
|
#include <GID.h>
|
|
|
|
#include <PhysicsAPI.h>
|
|
|
|
#include <WinTimer.h>
|
2014-01-13 12:44:33 +01:00
|
|
|
|
2014-01-10 12:33:04 +01:00
|
|
|
namespace GameLogic
|
|
|
|
{
|
2014-01-20 15:47:52 +01:00
|
|
|
class Game :public GameAPI
|
2014-01-10 12:33:04 +01:00
|
|
|
{
|
|
|
|
|
|
|
|
public:
|
2014-01-20 15:47:52 +01:00
|
|
|
class PlayerData :public IPlayerData
|
2014-01-10 12:33:04 +01:00
|
|
|
{
|
2014-01-20 15:47:52 +01:00
|
|
|
public:
|
2014-01-14 10:28:12 +01:00
|
|
|
PlayerData();
|
|
|
|
PlayerData(int playerID,int teamID);
|
2014-01-15 11:03:25 +01:00
|
|
|
~PlayerData();
|
2014-01-20 15:47:52 +01:00
|
|
|
|
|
|
|
void Move(const PLAYER_MOVEMENT &movement) override;
|
2014-01-20 16:02:26 +01:00
|
|
|
void UseWeapon(const WEAPON_FIRE &usage) override;
|
2014-01-20 15:47:52 +01:00
|
|
|
int GetTeamID() const override;
|
|
|
|
PLAYER_STATE GetState() const override;
|
|
|
|
Oyster::Math::Float3 GetPosition() override;
|
|
|
|
Oyster::Math::Float4x4 GetOrientation() override;
|
|
|
|
int GetID() const override;
|
|
|
|
OBJECT_TYPE GetObjectType() const override;
|
2014-02-03 15:52:00 +01:00
|
|
|
void Rotate(const Oyster::Math3D::Float4 lookDir) override;
|
2014-01-21 09:52:48 +01:00
|
|
|
|
2014-01-20 15:47:52 +01:00
|
|
|
Player *player;
|
2014-01-10 12:33:04 +01:00
|
|
|
};
|
|
|
|
|
2014-01-20 15:47:52 +01:00
|
|
|
class LevelData :public ILevelData
|
2014-01-16 12:08:24 +01:00
|
|
|
{
|
2014-01-20 15:47:52 +01:00
|
|
|
public:
|
2014-01-16 12:08:24 +01:00
|
|
|
LevelData();
|
|
|
|
~LevelData();
|
2014-01-20 15:47:52 +01:00
|
|
|
Oyster::Math::Float3 GetPosition() override;
|
|
|
|
Oyster::Math::Float4x4 GetOrientation() override;
|
|
|
|
int GetID() const override;
|
|
|
|
OBJECT_TYPE GetObjectType() const override;
|
2014-02-05 11:46:04 +01:00
|
|
|
int getNrOfDynamicObj()const override;
|
2014-01-30 09:40:58 +01:00
|
|
|
IObjectData* GetObjectAt(int ID) const override;
|
2014-01-20 15:47:52 +01:00
|
|
|
Level *level;
|
2014-01-16 12:08:24 +01:00
|
|
|
};
|
|
|
|
|
2014-01-10 12:33:04 +01:00
|
|
|
public:
|
2014-01-20 15:47:52 +01:00
|
|
|
Game();
|
|
|
|
~Game();
|
|
|
|
|
|
|
|
void GetAllPlayerPositions() const override;
|
|
|
|
PlayerData* CreatePlayer() override;
|
|
|
|
LevelData* CreateLevel() override;
|
|
|
|
void CreateTeam() override;
|
|
|
|
bool NewFrame() override;
|
|
|
|
void SetFPS( int FPS ) override;
|
|
|
|
void SetFrameTimeLength( float seconds ) override;
|
|
|
|
void SetSubscription(GameEvent::ObjectEventFunctionType type, GameEvent::ObjectEventFunction functionPointer) override;
|
|
|
|
bool Initiate() override;
|
|
|
|
|
|
|
|
float GetFrameTime() const;
|
|
|
|
|
|
|
|
static void PhysicsOnMove(const Oyster::Physics::ICustomBody *object);
|
|
|
|
static void PhysicsOnDestroy(::Utility::DynamicMemory::UniquePointer<Oyster::Physics::ICustomBody> proto);
|
|
|
|
|
|
|
|
Utility::DynamicMemory::DynamicArray<PlayerData*> players;
|
|
|
|
LevelData* level;
|
|
|
|
float frameTime;
|
|
|
|
bool initiated;
|
2014-02-04 16:24:37 +01:00
|
|
|
GameEvent::ObjectEventFunction onDisableFnc;
|
2014-01-20 15:47:52 +01:00
|
|
|
GameEvent::ObjectEventFunction onMoveFnc;
|
2014-01-10 12:33:04 +01:00
|
|
|
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|