Merge branch 'GameLogic' of https://github.com/dean11/Danbias into GameLogic

This commit is contained in:
Linda Andersson 2013-12-20 09:04:30 +01:00
commit ea5fc78817
3 changed files with 95 additions and 11 deletions

View File

@ -107,8 +107,7 @@
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>DANBIAS_SERVER_DLL_EXPORT;WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>
</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>$(SolutionDir)Game\GameLogic\</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
@ -124,8 +123,7 @@
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>DANBIAS_SERVER_DLL_EXPORT;WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>
</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>$(SolutionDir)Game\GameLogic\</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
@ -143,8 +141,7 @@
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>DANBIAS_SERVER_DLL_EXPORT;WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>
</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>$(SolutionDir)Game\GameLogic\</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
@ -164,8 +161,7 @@
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>DANBIAS_SERVER_DLL_EXPORT;WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>
</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>$(SolutionDir)Game\GameLogic\</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>

View File

@ -95,6 +95,7 @@ namespace DanBias
return true;
}
#ifndef ERIK
////private:
bool GameSession::Init(GameSessionDescription& desc)
{
@ -107,6 +108,7 @@ namespace DanBias
this->clients.Push(desc.clients[i]);
}
return true;
}
void GameSession::Frame()
@ -156,9 +158,94 @@ namespace DanBias
}
}
#ifdef ERIK
//VARIABLES GOES HERE
#else
#include "DynamicObject.h"
//#include "CollisionManager.h"
//#include "GameLogicStates.h"
//#include <GameProtocols.h>
/*
using namespace GameLogic;
//VARIABLES GOES HERE
DynamicObject* objectBox;
bool GameSession::Init(GameSessionDescription& desc)
{
if(desc.clients.Size() == 0) return false;
this->box = new PostBox<NetEvent>();
this->owner = desc.owner;
for (unsigned int i = 0; i < desc.clients.Size(); i++)
{
desc.clients[i]->SetPostbox(this->box);
this->clients.Push(desc.clients[i]);
}
CollisionManager::BoxCollision(0,0);
objectBox = new DynamicObject(CollisionManager::BoxCollision, OBJECT_TYPE::OBJECT_TYPE_BOX);
Protocol_CreateObject objectCreation;
objectCreation.object_ID = objectBox->GetID();
objectCreation.path = "crate";
Oyster::Math::Float4x4 worldMat = objectBox->GetRigidBody()->GetOrientation();
for (int i = 0; i < 16; i++)
{
objectCreation.worldMatrix[i] = worldMat[i];
}
for (int i = 0; i < clients.Size(); i++)
{
clients[i]->NetClient_Object()->Send(objectCreation);
}
return true;
}
void GameSession::Frame()
{
}
void GameSession::ParseEvents()
{
if(this->box && !this->box->IsEmpty())
{
NetEvent &e = this->box->Fetch();
if(e.protocol[0].type != Oyster::Network::NetAttributeType_Short) return;
ParseProtocol(e.protocol, *e.reciever);
}
}
void GameSession::ParseProtocol(Oyster::Network::CustomNetProtocol& p, DanBias::ClientObject& c)
{
switch (p[0].value.netShort)
{
case protocol_Gamplay_PlayerNavigation:
{
if(p[1].value.netBool) //bool bForward;
c.Logic_Object()->Move(GameLogic::PLAYER_MOVEMENT_FORWARD);
if(p[2].value.netBool) //bool bBackward;
c.Logic_Object()->Move(GameLogic::PLAYER_MOVEMENT_BACKWARD);
if(p[5].value.netBool) //bool bStrafeRight;
c.Logic_Object()->Move(GameLogic::PLAYER_MOVEMENT_RIGHT);
if(p[6].value.netBool) //bool bStrafeLeft;
c.Logic_Object()->Move(GameLogic::PLAYER_MOVEMENT_LEFT);
}
break;
case protocol_Gamplay_PlayerMouseMovement:
break;
case protocol_Gamplay_PlayerPosition:
break;
case protocol_Gamplay_CreateObject:
break;
case protocol_Gamplay_ObjectPosition:
break;
}
}
*/
#endif

View File

@ -3,8 +3,9 @@
//////////////////////////////////////////////////
#ifndef DYNAMICOBJECT_H
#define DYNAMICOBJECT_H
#include "Object.h"
#include "GameLogicDef.h"
#include "Object.h"
namespace GameLogic
{