diff --git a/Bin/Content/Shaders/DebugVertex.cso b/Bin/Content/Shaders/DebugVertex.cso
new file mode 100644
index 00000000..4e8292c6
Binary files /dev/null and b/Bin/Content/Shaders/DebugVertex.cso differ
diff --git a/Bin/Content/Shaders/TextureDebug.cso b/Bin/Content/Shaders/TextureDebug.cso
new file mode 100644
index 00000000..23c9aa23
Binary files /dev/null and b/Bin/Content/Shaders/TextureDebug.cso differ
diff --git a/Code/DanBias.sln b/Code/DanBias.sln
index 315bd416..894caec6 100644
--- a/Code/DanBias.sln
+++ b/Code/DanBias.sln
@@ -196,6 +196,7 @@ Global
{2A1BC987-AF42-4500-802D-89CD32FC1309}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32
{2A1BC987-AF42-4500-802D-89CD32FC1309}.Debug|Mixed Platforms.Build.0 = Debug|Win32
{2A1BC987-AF42-4500-802D-89CD32FC1309}.Debug|Win32.ActiveCfg = Debug|Win32
+ {2A1BC987-AF42-4500-802D-89CD32FC1309}.Debug|Win32.Build.0 = Debug|Win32
{2A1BC987-AF42-4500-802D-89CD32FC1309}.Debug|x64.ActiveCfg = Debug|x64
{2A1BC987-AF42-4500-802D-89CD32FC1309}.Debug|x64.Build.0 = Debug|x64
{2A1BC987-AF42-4500-802D-89CD32FC1309}.Release|Mixed Platforms.ActiveCfg = Release|Win32
diff --git a/Code/Game/DanBiasGame/DanBiasGame.vcxproj b/Code/Game/DanBiasGame/DanBiasGame.vcxproj
index 1784ca35..76a7554e 100644
--- a/Code/Game/DanBiasGame/DanBiasGame.vcxproj
+++ b/Code/Game/DanBiasGame/DanBiasGame.vcxproj
@@ -72,7 +72,7 @@
$(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\
$(ProjectName)_$(PlatformShortName)D
$(SolutionDir)..\External\Lib\Input;$(SolutionDir)..\Bin\DLL;$(LibraryPath)
- $(SolutionDir)..\External\Include\;$(IncludePath)
+ $(SolutionDir)Network/NetworkAPI;$(IncludePath)
true
@@ -106,7 +106,7 @@
Disabled
DANBIAS_CLIENT;DANBIAS_GAME_DLL_EXPORT;WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)
true
- $(SolutionDir)OysterMath;$(SolutionDir)Input;$(SolutionDir)OysterGraphics;$(SolutionDir)Misc;$(SolutionDir)OysterMath;%(AdditionalIncludeDirectories)
+ $(SolutionDir)Game/GameProtocols;$(SolutionDir)OysterMath;$(SolutionDir)Input;$(SolutionDir)OysterGraphics;$(SolutionDir)Misc;%(AdditionalIncludeDirectories)
Windows
@@ -123,12 +123,12 @@
Disabled
DANBIAS_CLIENT;DANBIAS_GAME_DLL_EXPORT;WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)
true
- $(SolutionDir)OysterMath;$(SolutionDir)Input;$(SolutionDir)OysterGraphics;$(SolutionDir)Misc;$(SolutionDir)OysterMath;%(AdditionalIncludeDirectories)
+ $(SolutionDir)GameProtocols;$(SolutionDir)OysterMath;$(SolutionDir)Input;$(SolutionDir)OysterGraphics;$(SolutionDir)Misc;$(SolutionDir)OysterMath;%(AdditionalIncludeDirectories)
Windows
true
- OysterGraphics_$(PlatformShortName)D.lib;Input_$(PlatformShortName)D.lib;%(AdditionalDependencies)
+ GameProtocols_$(PlatformShortName)D.lib;OysterGraphics_$(PlatformShortName)D.lib;Input_$(PlatformShortName)D.lib;%(AdditionalDependencies)
OysterGraphics_$(PlatformShortName)D.dll;%(DelayLoadDLLs)
@@ -142,14 +142,14 @@
true
DANBIAS_CLIENT;DANBIAS_GAME_DLL_EXPORT;WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)
true
- $(SolutionDir)OysterMath;$(SolutionDir)Input;$(SolutionDir)OysterGraphics;$(SolutionDir)Misc;$(SolutionDir)OysterMath;%(AdditionalIncludeDirectories)
+ $(SolutionDir)GameProtocols;$(SolutionDir)OysterMath;$(SolutionDir)Input;$(SolutionDir)OysterGraphics;$(SolutionDir)Misc;$(SolutionDir)OysterMath;%(AdditionalIncludeDirectories)
Windows
true
true
true
- OysterGraphics_$(PlatformShortName).lib;Input_$(PlatformShortName).lib;%(AdditionalDependencies)
+ GameProtocols_$(PlatformShortName).lib;OysterGraphics_$(PlatformShortName).lib;Input_$(PlatformShortName).lib;%(AdditionalDependencies)
OysterGraphics_x86.dll;%(DelayLoadDLLs)
@@ -163,14 +163,14 @@
true
DANBIAS_CLIENT;DANBIAS_GAME_DLL_EXPORT;WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)
true
- $(SolutionDir)OysterMath;$(SolutionDir)Input;$(SolutionDir)OysterGraphics;$(SolutionDir)Misc;$(SolutionDir)OysterMath;%(AdditionalIncludeDirectories)
+ $(SolutionDir)GameProtocols;$(SolutionDir)OysterMath;$(SolutionDir)Input;$(SolutionDir)OysterGraphics;$(SolutionDir)Misc;$(SolutionDir)OysterMath;%(AdditionalIncludeDirectories)
Windows
true
true
true
- OysterGraphics_$(PlatformShortName).lib;Input_$(PlatformShortName).lib;%(AdditionalDependencies)
+ GameProtocols_$(PlatformShortName).lib;OysterGraphics_$(PlatformShortName).lib;Input_$(PlatformShortName).lib;%(AdditionalDependencies)
OysterGraphics_x86.dll;%(DelayLoadDLLs)
@@ -181,6 +181,9 @@
{2ec4dded-8f75-4c86-a10b-e1e8eb29f3ee}
+
+ {460d625f-2ac9-4559-b809-0ba89ceaedf4}
+
{0ec83e64-230e-48ef-b08c-6ac9651b4f82}
diff --git a/Code/Game/DanBiasGame/DanBiasGame_Impl.cpp b/Code/Game/DanBiasGame/DanBiasGame_Impl.cpp
index 535256f9..e38b8cc9 100644
--- a/Code/Game/DanBiasGame/DanBiasGame_Impl.cpp
+++ b/Code/Game/DanBiasGame/DanBiasGame_Impl.cpp
@@ -5,6 +5,10 @@
#include "GameClientState/GameClientState.h"
#include "GameClientState\GameState.h"
#include "GameClientState\LobbyState.h"
+#include "PlayerProtocols.h"
+#include "NetworkClient.h"
+
+#include "L_inputClass.h"
#include "vld.h"
namespace DanBias
@@ -12,11 +16,40 @@ namespace DanBias
__int64 DanBiasGame::cntsPerSec = 0;
__int64 DanBiasGame::prevTimeStamp = 0;
float DanBiasGame::secsPerCnt = 0;
- InputClass* DanBiasGame::inputObj = NULL;
HINSTANCE DanBiasGame::g_hInst = NULL;
HWND DanBiasGame::g_hWnd = NULL;
#pragma region Game Data
+
+
+ struct MyRecieverObject // :public PontusRecieverObject
+ {
+ Oyster::Network::NetworkClient nwClient;
+
+ static void ProtocolRecieved(Network::CustomNetProtocol* p)
+ {
+ int pType = ((*p)[0]).value.netInt;
+ switch (pType)
+ {
+ case protocol_PlayerNavigation:
+
+ break;
+ case protocol_PlayerPosition:
+ //int x = ((*p)[1]).value.netInt;
+ //int y = ((*p)[2]).value.netInt;
+ //int z = ((*p)[3]).value.netInt;
+ break;
+
+
+ case protocol_ObjectPosition:
+ // DanBiasGame::protocolRecived();
+ break;
+
+ default:
+ break;
+ }
+ }
+ };
class DanBiasGamePrivateData
{
@@ -32,12 +65,22 @@ namespace DanBias
public:
Client::GameClientState* gameClientState;
+ InputClass* inputObj;
+ GameLogic::Protocol_PlayerMovement player_move;
+ //Oyster::Network::NetworkClient nwClient;
+ MyRecieverObject r;
+
// gameClient;
} data;
#pragma endregion
- DanBiasGamePrivateData* DanBiasGame::m_data = new DanBiasGamePrivateData();
+
+ DanBiasGamePrivateData* DanBiasGame::m_data = new DanBiasGamePrivateData();
+ void DanBiasGame::protocolRecived()
+ {
+ //m_data->gameClientState.setPos()
+ }
//--------------------------------------------------------------------------------------
// Interface API functions
//--------------------------------------------------------------------------------------
@@ -163,8 +206,8 @@ namespace DanBias
//-------------------------------------------------------------------------------------
HRESULT DanBiasGame::InitInput()
{
- inputObj = new InputClass;
- if(!inputObj->Initialize(g_hInst, g_hWnd, 1024, 768))
+ m_data->inputObj = new InputClass;
+ if(!m_data->inputObj->Initialize(g_hInst, g_hWnd, 1024, 768))
{
MessageBox(0, L"Could not initialize the input object.", L"Error", MB_OK);
return E_FAIL;
@@ -174,10 +217,10 @@ namespace DanBias
HRESULT DanBiasGame::Update(float deltaTime)
{
- inputObj->Update();
+ m_data->inputObj->Update();
DanBias::Client::GameClientState::ClientState state = DanBias::Client::GameClientState::ClientState_Same;
- state = m_data->gameClientState->Update(deltaTime, inputObj);
+ state = m_data->gameClientState->Update(deltaTime, m_data->inputObj);
if(state != Client::GameClientState::ClientState_Same)
{
@@ -206,7 +249,7 @@ namespace DanBias
HRESULT DanBiasGame::Render(float deltaTime)
{
int isPressed = 0;
- if(inputObj->IsKeyPressed(DIK_A))
+ if(m_data->inputObj->IsKeyPressed(DIK_A))
{
isPressed = 1;
}
@@ -224,8 +267,9 @@ namespace DanBias
{
m_data->gameClientState->Release();
delete m_data->gameClientState;
+ delete m_data->inputObj;
delete m_data;
- delete inputObj;
+
Oyster::Graphics::API::Clean();
return S_OK;
diff --git a/Code/Game/DanBiasGame/GameClientState/GameState.cpp b/Code/Game/DanBiasGame/GameClientState/GameState.cpp
index fb81e23a..a95b6798 100644
--- a/Code/Game/DanBiasGame/GameClientState/GameState.cpp
+++ b/Code/Game/DanBiasGame/GameClientState/GameState.cpp
@@ -12,6 +12,7 @@ struct GameState::myData
Oyster::Math3D::Float4x4 proj;
C_Object* object[3];
int modelCount;
+ //Oyster::Network::NetworkClient* nwClient;
gameStateState state;
}privData;
@@ -86,6 +87,8 @@ GameClientState::ClientState GameState::Update(float deltaTime, InputClass* KeyI
case gameStateState_playing:
// read server data
// update objects
+ // Client.send(obj);
+
if(KeyInput->IsKeyPressed(DIK_L))
privData->state = GameState::gameStateState_end;
break;
diff --git a/Code/Game/DanBiasGame/Include/DanBiasGame.h b/Code/Game/DanBiasGame/Include/DanBiasGame.h
index 519eda13..756460d4 100644
--- a/Code/Game/DanBiasGame/Include/DanBiasGame.h
+++ b/Code/Game/DanBiasGame/Include/DanBiasGame.h
@@ -52,11 +52,13 @@ namespace DanBias
static HRESULT Update(float deltaTime);
static HRESULT Render(float deltaTime);
static HRESULT CleanUp();
+
+ static void protocolRecived();
private:
static __int64 cntsPerSec;
static __int64 prevTimeStamp;
static float secsPerCnt;
- static InputClass* inputObj;
+
static HINSTANCE g_hInst;
static HWND g_hWnd;
static DanBiasGamePrivateData* m_data;
diff --git a/Code/Game/GameLogic/AttatchmentMassDriver.cpp b/Code/Game/GameLogic/AttatchmentMassDriver.cpp
index 18324149..b7687acb 100644
--- a/Code/Game/GameLogic/AttatchmentMassDriver.cpp
+++ b/Code/Game/GameLogic/AttatchmentMassDriver.cpp
@@ -1,4 +1,5 @@
#include "AttatchmentMassDriver.h"
+#include "PhysicsAPI.h"
using namespace GameLogic;
@@ -19,11 +20,20 @@ struct AttatchmentMassDriver::PrivateData
AttatchmentMassDriver::AttatchmentMassDriver(void)
{
+ myData = new PrivateData();
+ this->owner = 0;
+}
+
+AttatchmentMassDriver::AttatchmentMassDriver(Player &owner)
+{
+ myData = new PrivateData();
+ this->owner = &owner;
}
AttatchmentMassDriver::~AttatchmentMassDriver(void)
{
+ delete myData;
}
/********************************************************
@@ -31,15 +41,33 @@ AttatchmentMassDriver::~AttatchmentMassDriver(void)
********************************************************/
void AttatchmentMassDriver::UseAttatchment(const GameLogic::WEAPON_FIRE &fireInput)
{
- ForcePush(fireInput);
-}
-
-/********************************************************
-* This is a specific functionallity of the weapon
-********************************************************/
-void AttatchmentMassDriver::ForcePush(const GameLogic::WEAPON_FIRE &fireInput)
-{
+ //switch case to determin what functionallity to use in the attatchment
+ switch (fireInput)
+ {
+ case WEAPON_FIRE::WEAPON_USE_PRIMARY_PRESS:
+ ForcePush(fireInput);
+ break;
+ case WEAPON_FIRE::WEAPON_USE_SECONDARY_PRESS:
+ ForcePull(fireInput);
+ break;
+ }
}
+/********************************************************
+* Pushes objects in a cone in front of the weapon when fired
+********************************************************/
+void AttatchmentMassDriver::ForcePush(const GameLogic::WEAPON_FIRE &fireInput)
+{
+ //create coneRigidBody that will then collide with object and push them in the aimed direction
+}
+
+/********************************************************
+* Pulls the player in the direction he is looking, used for fast movement(kinda like a jetpack)
+********************************************************/
+void AttatchmentMassDriver::ForcePull(const WEAPON_FIRE &fireInput)
+{
+ Oyster::Physics::API::Instance().ApplyForceAt(owner->GetRigidBody(), owner->GetRigidBody()->GetCenter(), owner->GetLookDir() * 100);
+}
+
diff --git a/Code/Game/GameLogic/AttatchmentMassDriver.h b/Code/Game/GameLogic/AttatchmentMassDriver.h
index bc95c327..879938fe 100644
--- a/Code/Game/GameLogic/AttatchmentMassDriver.h
+++ b/Code/Game/GameLogic/AttatchmentMassDriver.h
@@ -8,6 +8,7 @@ namespace GameLogic
{
public:
AttatchmentMassDriver(void);
+ AttatchmentMassDriver(Player &owner);
~AttatchmentMassDriver(void);
@@ -15,6 +16,7 @@ namespace GameLogic
private:
void ForcePush(const WEAPON_FIRE &fireInput);
+ void ForcePull(const WEAPON_FIRE &fireInput);
private:
struct PrivateData;
diff --git a/Code/Game/GameLogic/AttatchmentSocket.cpp b/Code/Game/GameLogic/AttatchmentSocket.cpp
index 86e0850b..288a1a4e 100644
--- a/Code/Game/GameLogic/AttatchmentSocket.cpp
+++ b/Code/Game/GameLogic/AttatchmentSocket.cpp
@@ -14,7 +14,7 @@ struct AttatchmentSocket::PrivateData
}
- IAttatchment *Attatchment;
+ IAttatchment *attatchment;
}myData;
@@ -30,5 +30,23 @@ AttatchmentSocket::~AttatchmentSocket(void)
IAttatchment* AttatchmentSocket::GetAttatchment()
{
- return myData->Attatchment;
+ return myData->attatchment;
+}
+
+void AttatchmentSocket::SetAttatchment(IAttatchment *attatchment)
+{
+ if (myData->attatchment)
+ {
+ delete myData->attatchment;
+ }
+
+ myData->attatchment = attatchment;
+}
+
+void AttatchmentSocket::RemoveAttatchment()
+{
+ if (myData->attatchment)
+ {
+ delete myData->attatchment;
+ }
}
diff --git a/Code/Game/GameLogic/AttatchmentSocket.h b/Code/Game/GameLogic/AttatchmentSocket.h
index 1067e339..f9be588b 100644
--- a/Code/Game/GameLogic/AttatchmentSocket.h
+++ b/Code/Game/GameLogic/AttatchmentSocket.h
@@ -11,6 +11,8 @@ namespace GameLogic
~AttatchmentSocket(void);
IAttatchment* GetAttatchment();
+ void SetAttatchment(IAttatchment *attatchment);
+ void RemoveAttatchment();
private:
struct PrivateData;
diff --git a/Code/Game/GameLogic/CollisionManager.cpp b/Code/Game/GameLogic/CollisionManager.cpp
index 52eaa4f3..3d1af2a1 100644
--- a/Code/Game/GameLogic/CollisionManager.cpp
+++ b/Code/Game/GameLogic/CollisionManager.cpp
@@ -1,4 +1,8 @@
#include "CollisionManager.h"
+#include "PhysicsAPI.h"
+#include "Object.h"
+#include "DynamicObject.h"
+#include "Player.h"
using namespace Oyster;
@@ -8,42 +12,44 @@ namespace GameLogic
namespace CollisionManager
{
+ void PlayerVBox(Player &player, DynamicObject &box);
+
+
Physics::ICustomBody::SubscriptMessage PlayerCollision(const Oyster::Physics::ICustomBody *rigidBodyPlayer, const Oyster::Physics::ICustomBody *obj)
{
- Player *player = ((Player*)GameLogic::RefManager::getInstance()->GetMap(*rigidBodyPlayer));
- Object *realObj = GameLogic::RefManager::getInstance()->GetMap(*obj);
+ Player *player = ((Player*)(rigidBodyPlayer->gameObjectRef));
+ Object *realObj = (Object*)obj->gameObjectRef;
switch (realObj->GetType())
{
- case Object::OBJECT_TYPE_BOX:
+ case OBJECT_TYPE_BOX:
PlayerVBox(*player,(*(DynamicObject*) realObj));
break;
- case Object::OBJECT_TYPE_PLAYER:
+ case OBJECT_TYPE_PLAYER:
break;
}
- //spela ljud? ta skada? etc etc
return Physics::ICustomBody::SubscriptMessage_none;
}
void PlayerVBox(Player &player, DynamicObject &box)
{
- //spela ljud? ta skada? etc etc
+ player.DamageLife(20);
}
Physics::ICustomBody::SubscriptMessage BoxCollision(const Oyster::Physics::ICustomBody *rigidBodyBox, const Oyster::Physics::ICustomBody *obj)
{
- DynamicObject *box = ((DynamicObject*)GameLogic::RefManager::getInstance()->GetMap(*rigidBodyBox));
- Object *realObj = GameLogic::RefManager::getInstance()->GetMap(*obj);
+ DynamicObject *box = (DynamicObject*)rigidBodyBox->gameObjectRef;
+ Object *realObj = (Object*)obj->gameObjectRef;
switch (realObj->GetType())
{
- case Object::OBJECT_TYPE_BOX:
+ case OBJECT_TYPE_BOX:
break;
- case Object::OBJECT_TYPE_PLAYER:
- PlayerVBox(*(Player*)realObj,*box);
+ case OBJECT_TYPE_PLAYER:
+ //PlayerVBox(*(Player*)realObj,*box);
break;
}
diff --git a/Code/Game/GameLogic/CollisionManager.h b/Code/Game/GameLogic/CollisionManager.h
index f88404cc..d19ce8e3 100644
--- a/Code/Game/GameLogic/CollisionManager.h
+++ b/Code/Game/GameLogic/CollisionManager.h
@@ -3,9 +3,6 @@
#include "Object.h"
#include "PhysicsAPI.h"
-#include "RefManager.h"
-#include "DynamicObject.h"
-#include "Player.h"
namespace GameLogic
{
@@ -18,8 +15,8 @@ namespace GameLogic
Oyster::Physics::ICustomBody::SubscriptMessage BoxCollision(const Oyster::Physics::ICustomBody *rigidBodyBox, const Oyster::Physics::ICustomBody *obj);
//these are the specific collision case functions
- void PlayerVBox(Player &player, DynamicObject &box);
- void BoxVBox(DynamicObject &box1, DynamicObject &box2);
+ //void PlayerVBox(Player &player, DynamicObject &box);
+ //void BoxVBox(DynamicObject &box1, DynamicObject &box2);
};
diff --git a/Code/Game/GameLogic/DynamicObject.cpp b/Code/Game/GameLogic/DynamicObject.cpp
index 8786255c..a8ea1ab4 100644
--- a/Code/Game/GameLogic/DynamicObject.cpp
+++ b/Code/Game/GameLogic/DynamicObject.cpp
@@ -1,29 +1,23 @@
#include "DynamicObject.h"
+#include "CollisionManager.h"
using namespace GameLogic;
-struct DynamicObject::PrivateData
-{
- PrivateData()
- {
-
- }
-
- ~PrivateData()
- {
-
- }
-
-}myData;
-
DynamicObject::DynamicObject()
+ :Object()
{
- myData = new PrivateData();
+
+}
+
+DynamicObject::DynamicObject(void* collisionFunc, OBJECT_TYPE type)
+ :Object(collisionFunc, type)
+{
+
}
DynamicObject::~DynamicObject(void)
{
- delete myData;
+
}
\ No newline at end of file
diff --git a/Code/Game/GameLogic/DynamicObject.h b/Code/Game/GameLogic/DynamicObject.h
index ecf1e905..70bb8c11 100644
--- a/Code/Game/GameLogic/DynamicObject.h
+++ b/Code/Game/GameLogic/DynamicObject.h
@@ -1,27 +1,24 @@
//////////////////////////////////////////////////
//Created by Erik and Linda of the GameLogic team
//////////////////////////////////////////////////
-
-
#ifndef DYNAMICOBJECT_H
#define DYNAMICOBJECT_H
+#include "Object.h"
namespace GameLogic
{
- class DynamicObject
+ class DynamicObject : public Object
{
public:
DynamicObject();
+ DynamicObject(void* collisionFunc, OBJECT_TYPE type);
~DynamicObject(void);
- void Update();
-
private:
- struct PrivateData;
- PrivateData *myData;
+
};
}
diff --git a/Code/Game/GameLogic/GameLogic.vcxproj b/Code/Game/GameLogic/GameLogic.vcxproj
index 03430feb..13491d28 100644
--- a/Code/Game/GameLogic/GameLogic.vcxproj
+++ b/Code/Game/GameLogic/GameLogic.vcxproj
@@ -176,7 +176,6 @@
-
@@ -191,7 +190,6 @@
-
diff --git a/Code/Game/GameLogic/GameLogicStates.h b/Code/Game/GameLogic/GameLogicStates.h
index 3c2b9997..3e72647e 100644
--- a/Code/Game/GameLogic/GameLogicStates.h
+++ b/Code/Game/GameLogic/GameLogicStates.h
@@ -36,6 +36,13 @@ namespace GameLogic
WEAPON_STATE_IDLE = 1,
WEAPON_STATE_RELOADING = 2,
};
-}
+
+ enum OBJECT_TYPE
+ {
+ OBJECT_TYPE_PLAYER = 0,
+ OBJECT_TYPE_BOX = 1,
+ OBJECT_TYPE_UNKNOWN = 2,
+ };
+};
#endif
\ No newline at end of file
diff --git a/Code/Game/GameLogic/IAttatchment.cpp b/Code/Game/GameLogic/IAttatchment.cpp
index c1e2a997..4b0b1961 100644
--- a/Code/Game/GameLogic/IAttatchment.cpp
+++ b/Code/Game/GameLogic/IAttatchment.cpp
@@ -3,22 +3,6 @@
using namespace GameLogic;
-struct IAttatchment::PrivateData
-{
- PrivateData()
- {
-
- }
-
- ~PrivateData()
- {
-
- }
-
-
-
-}myData;
-
IAttatchment::IAttatchment(void)
{
}
diff --git a/Code/Game/GameLogic/IAttatchment.h b/Code/Game/GameLogic/IAttatchment.h
index c134026f..0b6cb061 100644
--- a/Code/Game/GameLogic/IAttatchment.h
+++ b/Code/Game/GameLogic/IAttatchment.h
@@ -1,6 +1,7 @@
#ifndef IATTATCHMENT_H
#define IATTATCHMENT_H
#include "GameLogicStates.h"
+#include "Player.h"
namespace GameLogic
{
@@ -16,9 +17,10 @@ namespace GameLogic
virtual void UseAttatchment(const WEAPON_FIRE &fireInput) = 0;
- private:
- struct PrivateData;
- PrivateData *myData;
+ private:
+
+ protected:
+ Player *owner;
};
}
diff --git a/Code/Game/GameLogic/Level.cpp b/Code/Game/GameLogic/Level.cpp
index c83056c6..38865f63 100644
--- a/Code/Game/GameLogic/Level.cpp
+++ b/Code/Game/GameLogic/Level.cpp
@@ -9,14 +9,10 @@ struct Level::PrivateData
{
PrivateData()
{
- gameMode = new GameMode();
+
}
~PrivateData()
{
- if (gameMode)
- {
- delete gameMode;
- }
}
@@ -40,3 +36,5 @@ Level::~Level(void)
{
delete myData;
}
+
+
diff --git a/Code/Game/GameLogic/Level.h b/Code/Game/GameLogic/Level.h
index 217a60e4..9c7adb1a 100644
--- a/Code/Game/GameLogic/Level.h
+++ b/Code/Game/GameLogic/Level.h
@@ -14,6 +14,8 @@ namespace GameLogic
Level(void);
~Level(void);
+ void CreateBox();
+
private:
struct PrivateData;
PrivateData *myData;
diff --git a/Code/Game/GameLogic/Object.cpp b/Code/Game/GameLogic/Object.cpp
index 67385874..dcd32bf1 100644
--- a/Code/Game/GameLogic/Object.cpp
+++ b/Code/Game/GameLogic/Object.cpp
@@ -1,48 +1,55 @@
#include "Object.h"
#include "OysterMath.h"
-#include "DllInterfaces\GFXAPI.h"
#include "CollisionManager.h"
using namespace GameLogic;
using namespace Oyster::Math;
-using namespace Oyster::Graphics::Model;
-
-using namespace Utility::DynamicMemory;
using namespace Oyster::Physics;
-Object::Object(std::wstring objFile)
-{
-
- //model = new Model();
- model = Oyster::Graphics::API::CreateModel(objFile);
-
+Object::Object()
+{
API::SimpleBodyDescription sbDesc;
//sbDesc.centerPosition =
//poi
ICustomBody* temp = rigidBody = API::Instance().CreateRigidBody(sbDesc).Release();
- GameLogic::RefManager::getInstance()->AddMapping(*rigidBody, *this);
+ rigidBody->gameObjectRef = this;
+ this->type = OBJECT_TYPE_UNKNOWN;
+
+}
+
+Object::Object(void* collisionFunc, OBJECT_TYPE type)
+{
+ API::SimpleBodyDescription sbDesc;
+ //sbDesc.centerPosition =
+
+ //poi
+ ICustomBody* temp = rigidBody = API::Instance().CreateRigidBody(sbDesc).Release();
+
+ rigidBody->SetSubscription((Oyster::Physics::ICustomBody::EventAction_Collision)(collisionFunc));
+
+ rigidBody->gameObjectRef = this;
+
+ this->type = type;
}
Object::~Object(void)
{
- Oyster::Graphics::API::DeleteModel(model);
}
-void Object::Render()
-{
- this->rigidBody->GetOrientation(model->WorldMatrix);
- Oyster::Graphics::API::RenderScene(model, 1);
-}
-
-Object::OBJECT_TYPE Object::GetType()
+OBJECT_TYPE Object::GetType()
{
return this->type;
}
+
+Oyster::Physics::ICustomBody* Object::GetRigidBody()
+{
+ return this->rigidBody;
+}
diff --git a/Code/Game/GameLogic/Object.h b/Code/Game/GameLogic/Object.h
index 1c1c2830..c79c5de1 100644
--- a/Code/Game/GameLogic/Object.h
+++ b/Code/Game/GameLogic/Object.h
@@ -7,11 +7,7 @@
#define OBJECT_H
#include "PhysicsAPI.h"
-#include "DllInterfaces/GFXAPI.h"
-
-#include "Model/Model.h"
-#include "Utilities.h"
-
+#include "GameLogicStates.h"
namespace GameLogic
@@ -19,29 +15,18 @@ namespace GameLogic
class Object
{
public:
-
- enum OBJECT_TYPE
- {
- OBJECT_TYPE_PLAYER,
- OBJECT_TYPE_BOX,
- };
- Object(std::wstring objFile );
- virtual ~Object(void);
-
- void Render();
+ Object();
+ Object(void* collisionFunc, OBJECT_TYPE type);
+ ~Object(void);
OBJECT_TYPE GetType();
+ Oyster::Physics::ICustomBody* GetRigidBody();
+
private:
OBJECT_TYPE type;
-
protected:
- //either a model pointer or an ID to an arraypos filled with models that are to be rendered
- //rigidBody
-
Oyster::Physics::ICustomBody *rigidBody;
- Oyster::Graphics::Model::Model *model;
-
};
}
diff --git a/Code/Game/GameLogic/Player.cpp b/Code/Game/GameLogic/Player.cpp
index 9bc9d752..bae54e9a 100644
--- a/Code/Game/GameLogic/Player.cpp
+++ b/Code/Game/GameLogic/Player.cpp
@@ -15,8 +15,7 @@ struct Player::PrivateData
life = 100;
playerState = PLAYER_STATE_IDLE;
- rigidBody->SetSubscription(CollisionManager::PlayerCollision);
-
+ lookDir = Oyster::Math::Float3(1,0,0);
}
~PrivateData()
@@ -30,16 +29,16 @@ struct Player::PrivateData
int life;
Weapon *weapon;
PLAYER_STATE playerState;
-
- ICustomBody *rigidBody;
+ Oyster::Math::Float3 lookDir;
}myData;
Player::Player()
+ :Object(CollisionManager::PlayerCollision, OBJECT_TYPE_PLAYER)
{
myData = new PrivateData();
-
}
+
Player::~Player(void)
{
delete myData;
@@ -61,12 +60,16 @@ void Player::Update()
********************************************************/
void Player::Move(const PLAYER_MOVEMENT &movement)
{
+ Oyster::Math::Float3 currentVelocity = rigidBody->GetRigidLinearVelocity();
+
switch(movement)
{
case PLAYER_MOVEMENT_FORWARD:
+ API::Instance().ApplyForceAt(rigidBody,rigidBody->GetCenter(),myData->lookDir * 100);
break;
case PLAYER_MOVEMENT_BACKWARD:
+ API::Instance().ApplyForceAt(rigidBody,rigidBody->GetCenter(),-myData->lookDir * 100);
break;
case PLAYER_MOVEMENT_LEFT:
@@ -83,9 +86,9 @@ void Player::Move(const PLAYER_MOVEMENT &movement)
/********************************************************
* Uses the players weapon based on user input
********************************************************/
-void Player::Shoot(const WEAPON_FIRE &fireInput)
+void Player::UseWeapon(const WEAPON_FIRE &fireInput)
{
- myData->weapon->UseWeapon(fireInput);
+ myData->weapon->Use(fireInput);
}
/********************************************************
@@ -94,7 +97,7 @@ void Player::Shoot(const WEAPON_FIRE &fireInput)
********************************************************/
void Player::Jump()
{
-
+ API::Instance().ApplyForceAt(rigidBody,rigidBody->GetCenter(),-Oyster::Math::Float3(0,1,0) * 100);
}
bool Player::IsWalking()
@@ -112,7 +115,12 @@ bool Player::IsIdle()
Oyster::Math::Float3 Player::GetPos()
{
- return myData->rigidBody->GetCenter();
+ return rigidBody->GetCenter();
+}
+
+Oyster::Math::Float3 Player::GetLookDir()
+{
+ return myData->lookDir;
}
/********************************************************
@@ -123,3 +131,9 @@ void Player::Respawn()
{
}
+
+
+void Player::DamageLife(int damage)
+{
+ myData->life -= damage;
+}
\ No newline at end of file
diff --git a/Code/Game/GameLogic/Player.h b/Code/Game/GameLogic/Player.h
index 20fc8de6..7cf7187b 100644
--- a/Code/Game/GameLogic/Player.h
+++ b/Code/Game/GameLogic/Player.h
@@ -5,10 +5,11 @@
#define PLAYER_H
#include "GameLogicStates.h"
#include "OysterMath.h"
+#include "Object.h"
namespace GameLogic
{
- class Player
+ class Player : public Object
{
public:
@@ -17,7 +18,7 @@ namespace GameLogic
void Update();
void Move(const PLAYER_MOVEMENT &movement);
- void Shoot(const WEAPON_FIRE &fireInput);
+ void UseWeapon(const WEAPON_FIRE &fireInput);
void Jump();
bool IsWalking();
@@ -25,8 +26,12 @@ namespace GameLogic
bool IsIdle();
Oyster::Math::Float3 GetPos();
+ Oyster::Math::Float3 GetLookDir();
+
void Respawn();
+ void DamageLife(int damage);
+
private:
struct PrivateData;
PrivateData *myData;
diff --git a/Code/Game/GameLogic/RefManager.h b/Code/Game/GameLogic/RefManager.h
index a184e220..fa4080c9 100644
--- a/Code/Game/GameLogic/RefManager.h
+++ b/Code/Game/GameLogic/RefManager.h
@@ -8,7 +8,6 @@
#include