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

This commit is contained in:
dean11 2014-02-19 13:10:17 +01:00
commit be73d95568
40 changed files with 665 additions and 1144 deletions

View File

@ -45,6 +45,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "GameClient", "Game\GameClie
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Utilities", "Misc\Utilities\Utilities.vcxproj", "{2EC4DDED-8F75-4C86-A10B-E1E8EB29F3EE}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Utilities", "Misc\Utilities\Utilities.vcxproj", "{2EC4DDED-8F75-4C86-A10B-E1E8EB29F3EE}"
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "LevelLoader", "Game\LevelLoader\LevelLoader.vcxproj", "{6391E709-D9FA-4FEF-A3B9-4343DB5A0C63}"
EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU Debug|Any CPU = Debug|Any CPU
@ -679,6 +681,40 @@ Global
{2EC4DDED-8F75-4C86-A10B-E1E8EB29F3EE}.RelWithDebInfo|x64.Build.0 = Release|x64 {2EC4DDED-8F75-4C86-A10B-E1E8EB29F3EE}.RelWithDebInfo|x64.Build.0 = Release|x64
{2EC4DDED-8F75-4C86-A10B-E1E8EB29F3EE}.RelWithDebInfo|x86.ActiveCfg = Release|Win32 {2EC4DDED-8F75-4C86-A10B-E1E8EB29F3EE}.RelWithDebInfo|x86.ActiveCfg = Release|Win32
{2EC4DDED-8F75-4C86-A10B-E1E8EB29F3EE}.RelWithDebInfo|x86.Build.0 = Release|Win32 {2EC4DDED-8F75-4C86-A10B-E1E8EB29F3EE}.RelWithDebInfo|x86.Build.0 = Release|Win32
{6391E709-D9FA-4FEF-A3B9-4343DB5A0C63}.Debug|Any CPU.ActiveCfg = Debug|Win32
{6391E709-D9FA-4FEF-A3B9-4343DB5A0C63}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32
{6391E709-D9FA-4FEF-A3B9-4343DB5A0C63}.Debug|Mixed Platforms.Build.0 = Debug|Win32
{6391E709-D9FA-4FEF-A3B9-4343DB5A0C63}.Debug|Win32.ActiveCfg = Debug|Win32
{6391E709-D9FA-4FEF-A3B9-4343DB5A0C63}.Debug|Win32.Build.0 = Debug|Win32
{6391E709-D9FA-4FEF-A3B9-4343DB5A0C63}.Debug|x64.ActiveCfg = Debug|x64
{6391E709-D9FA-4FEF-A3B9-4343DB5A0C63}.Debug|x64.Build.0 = Debug|x64
{6391E709-D9FA-4FEF-A3B9-4343DB5A0C63}.Debug|x86.ActiveCfg = Debug|Win32
{6391E709-D9FA-4FEF-A3B9-4343DB5A0C63}.Debug|x86.Build.0 = Debug|Win32
{6391E709-D9FA-4FEF-A3B9-4343DB5A0C63}.MinSizeRel|Any CPU.ActiveCfg = Release|Win32
{6391E709-D9FA-4FEF-A3B9-4343DB5A0C63}.MinSizeRel|Mixed Platforms.ActiveCfg = Release|Win32
{6391E709-D9FA-4FEF-A3B9-4343DB5A0C63}.MinSizeRel|Mixed Platforms.Build.0 = Release|Win32
{6391E709-D9FA-4FEF-A3B9-4343DB5A0C63}.MinSizeRel|Win32.ActiveCfg = Release|Win32
{6391E709-D9FA-4FEF-A3B9-4343DB5A0C63}.MinSizeRel|Win32.Build.0 = Release|Win32
{6391E709-D9FA-4FEF-A3B9-4343DB5A0C63}.MinSizeRel|x64.ActiveCfg = Release|Win32
{6391E709-D9FA-4FEF-A3B9-4343DB5A0C63}.MinSizeRel|x86.ActiveCfg = Release|Win32
{6391E709-D9FA-4FEF-A3B9-4343DB5A0C63}.MinSizeRel|x86.Build.0 = Release|Win32
{6391E709-D9FA-4FEF-A3B9-4343DB5A0C63}.Release|Any CPU.ActiveCfg = Release|Win32
{6391E709-D9FA-4FEF-A3B9-4343DB5A0C63}.Release|Mixed Platforms.ActiveCfg = Release|Win32
{6391E709-D9FA-4FEF-A3B9-4343DB5A0C63}.Release|Mixed Platforms.Build.0 = Release|Win32
{6391E709-D9FA-4FEF-A3B9-4343DB5A0C63}.Release|Win32.ActiveCfg = Release|Win32
{6391E709-D9FA-4FEF-A3B9-4343DB5A0C63}.Release|Win32.Build.0 = Release|Win32
{6391E709-D9FA-4FEF-A3B9-4343DB5A0C63}.Release|x64.ActiveCfg = Release|x64
{6391E709-D9FA-4FEF-A3B9-4343DB5A0C63}.Release|x64.Build.0 = Release|x64
{6391E709-D9FA-4FEF-A3B9-4343DB5A0C63}.Release|x86.ActiveCfg = Release|Win32
{6391E709-D9FA-4FEF-A3B9-4343DB5A0C63}.Release|x86.Build.0 = Release|Win32
{6391E709-D9FA-4FEF-A3B9-4343DB5A0C63}.RelWithDebInfo|Any CPU.ActiveCfg = Release|Win32
{6391E709-D9FA-4FEF-A3B9-4343DB5A0C63}.RelWithDebInfo|Mixed Platforms.ActiveCfg = Release|Win32
{6391E709-D9FA-4FEF-A3B9-4343DB5A0C63}.RelWithDebInfo|Mixed Platforms.Build.0 = Release|Win32
{6391E709-D9FA-4FEF-A3B9-4343DB5A0C63}.RelWithDebInfo|Win32.ActiveCfg = Release|Win32
{6391E709-D9FA-4FEF-A3B9-4343DB5A0C63}.RelWithDebInfo|Win32.Build.0 = Release|Win32
{6391E709-D9FA-4FEF-A3B9-4343DB5A0C63}.RelWithDebInfo|x64.ActiveCfg = Release|Win32
{6391E709-D9FA-4FEF-A3B9-4343DB5A0C63}.RelWithDebInfo|x86.ActiveCfg = Release|Win32
{6391E709-D9FA-4FEF-A3B9-4343DB5A0C63}.RelWithDebInfo|x86.Build.0 = Release|Win32
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE
@ -692,6 +728,7 @@ Global
{C83A6FAD-E71F-4B1E-9D63-E93E61DDC012} = {20720CA7-795C-45AD-A302-9383A6DD503A} {C83A6FAD-E71F-4B1E-9D63-E93E61DDC012} = {20720CA7-795C-45AD-A302-9383A6DD503A}
{8690FDDF-C5B7-4C42-A337-BD5243F29B85} = {20720CA7-795C-45AD-A302-9383A6DD503A} {8690FDDF-C5B7-4C42-A337-BD5243F29B85} = {20720CA7-795C-45AD-A302-9383A6DD503A}
{2A1BC987-AF42-4500-802D-89CD32FC1309} = {20720CA7-795C-45AD-A302-9383A6DD503A} {2A1BC987-AF42-4500-802D-89CD32FC1309} = {20720CA7-795C-45AD-A302-9383A6DD503A}
{6391E709-D9FA-4FEF-A3B9-4343DB5A0C63} = {20720CA7-795C-45AD-A302-9383A6DD503A}
{C4C76A8D-44C5-4452-9F61-39C7E01CBDB4} = {F156EEBC-0195-4020-8700-4433208DE12B} {C4C76A8D-44C5-4452-9F61-39C7E01CBDB4} = {F156EEBC-0195-4020-8700-4433208DE12B}
{3EA5F14D-2A71-4588-A69D-87C4571C580F} = {F156EEBC-0195-4020-8700-4433208DE12B} {3EA5F14D-2A71-4588-A69D-87C4571C580F} = {F156EEBC-0195-4020-8700-4433208DE12B}
{7E3990D2-3D94-465C-B58D-64A74B3ECF9B} = {1322B12B-5E37-448A-AAAF-F637460DCB23} {7E3990D2-3D94-465C-B58D-64A74B3ECF9B} = {1322B12B-5E37-448A-AAAF-F637460DCB23}

View File

@ -106,7 +106,7 @@
<Optimization>Disabled</Optimization> <Optimization>Disabled</Optimization>
<PreprocessorDefinitions>DANBIAS_GAME_DLL_EXPORT;WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>DANBIAS_GAME_DLL_EXPORT;WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck> <SDLCheck>true</SDLCheck>
<AdditionalIncludeDirectories>$(SolutionDir)Misc\OysterMath;$(SolutionDir)Misc\Input;$(SolutionDir)OysterGraphics;$(SolutionDir)Misc\Utilities;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>$(SolutionDir)Misc\OysterMath;$(SolutionDir)Misc\Input;$(SolutionDir)OysterGraphics;$(SolutionDir)Misc\Utilities;$(SolutionDir)Game\LevelLoader</AdditionalIncludeDirectories>
</ClCompile> </ClCompile>
<Link> <Link>
<SubSystem>Windows</SubSystem> <SubSystem>Windows</SubSystem>
@ -123,7 +123,7 @@
<Optimization>Disabled</Optimization> <Optimization>Disabled</Optimization>
<PreprocessorDefinitions>DANBIAS_GAME_DLL_EXPORT;WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>DANBIAS_GAME_DLL_EXPORT;WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck> <SDLCheck>true</SDLCheck>
<AdditionalIncludeDirectories>$(SolutionDir)Misc\OysterMath;$(SolutionDir)Misc\Input;$(SolutionDir)OysterGraphics;$(SolutionDir)Misc\Utilities;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>$(SolutionDir)Misc\OysterMath;$(SolutionDir)Misc\Input;$(SolutionDir)OysterGraphics;$(SolutionDir)Misc\Utilities;$(SolutionDir)Game\LevelLoader</AdditionalIncludeDirectories>
</ClCompile> </ClCompile>
<Link> <Link>
<SubSystem>Windows</SubSystem> <SubSystem>Windows</SubSystem>
@ -142,7 +142,7 @@
<IntrinsicFunctions>true</IntrinsicFunctions> <IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>DANBIAS_GAME_DLL_EXPORT;WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>DANBIAS_GAME_DLL_EXPORT;WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck> <SDLCheck>true</SDLCheck>
<AdditionalIncludeDirectories>$(SolutionDir)Misc\OysterMath;$(SolutionDir)Misc\Input;$(SolutionDir)OysterGraphics;$(SolutionDir)Misc\Utilities;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>$(SolutionDir)Misc\OysterMath;$(SolutionDir)Misc\Input;$(SolutionDir)OysterGraphics;$(SolutionDir)Misc\Utilities;$(SolutionDir)Game\LevelLoader</AdditionalIncludeDirectories>
</ClCompile> </ClCompile>
<Link> <Link>
<SubSystem>Windows</SubSystem> <SubSystem>Windows</SubSystem>
@ -163,7 +163,7 @@
<IntrinsicFunctions>true</IntrinsicFunctions> <IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>DANBIAS_GAME_DLL_EXPORT;WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>DANBIAS_GAME_DLL_EXPORT;WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck> <SDLCheck>true</SDLCheck>
<AdditionalIncludeDirectories>$(SolutionDir)Misc\OysterMath;$(SolutionDir)Misc\Input;$(SolutionDir)OysterGraphics;$(SolutionDir)Misc\Utilities;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>$(SolutionDir)Misc\OysterMath;$(SolutionDir)Misc\Input;$(SolutionDir)OysterGraphics;$(SolutionDir)Misc\Utilities;$(SolutionDir)Game\LevelLoader</AdditionalIncludeDirectories>
</ClCompile> </ClCompile>
<Link> <Link>
<SubSystem>Windows</SubSystem> <SubSystem>Windows</SubSystem>
@ -196,6 +196,9 @@
<ProjectReference Include="..\GameServer\GameServer.vcxproj"> <ProjectReference Include="..\GameServer\GameServer.vcxproj">
<Project>{143bd516-20a1-4890-a3e4-f8bfd02220e7}</Project> <Project>{143bd516-20a1-4890-a3e4-f8bfd02220e7}</Project>
</ProjectReference> </ProjectReference>
<ProjectReference Include="..\LevelLoader\LevelLoader.vcxproj">
<Project>{6391e709-d9fa-4fef-a3b9-4343db5a0c63}</Project>
</ProjectReference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="DanBiasGame_Impl.cpp" /> <ClCompile Include="DanBiasGame_Impl.cpp" />
@ -204,6 +207,7 @@
<ClCompile Include="GameClientState\Camera_BasicV2.cpp" /> <ClCompile Include="GameClientState\Camera_BasicV2.cpp" />
<ClCompile Include="GameClientState\Camera_FPS.cpp" /> <ClCompile Include="GameClientState\Camera_FPS.cpp" />
<ClCompile Include="GameClientState\Camera_FPSV2.cpp" /> <ClCompile Include="GameClientState\Camera_FPSV2.cpp" />
<ClCompile Include="GameClientState\C_Light.cpp" />
<ClCompile Include="GameClientState\C_obj\C_DynamicObj.cpp" /> <ClCompile Include="GameClientState\C_obj\C_DynamicObj.cpp" />
<ClCompile Include="GameClientState\C_obj\C_Player.cpp" /> <ClCompile Include="GameClientState\C_obj\C_Player.cpp" />
<ClCompile Include="GameClientState\C_obj\C_StaticObj.cpp" /> <ClCompile Include="GameClientState\C_obj\C_StaticObj.cpp" />
@ -212,10 +216,6 @@
<ClCompile Include="GameClientState\GameClientState.cpp" /> <ClCompile Include="GameClientState\GameClientState.cpp" />
<ClCompile Include="GameClientState\GameState.cpp" /> <ClCompile Include="GameClientState\GameState.cpp" />
<ClCompile Include="GameClientState\LanMenuState.cpp" /> <ClCompile Include="GameClientState\LanMenuState.cpp" />
<ClCompile Include="GameClientState\LevelLoader\LevelLoader.cpp" />
<ClCompile Include="GameClientState\LevelLoader\LevelParser.cpp" />
<ClCompile Include="GameClientState\LevelLoader\Loader.cpp" />
<ClCompile Include="GameClientState\LevelLoader\ParseFunctions.cpp" />
<ClCompile Include="GameClientState\LobbyAdminState.cpp" /> <ClCompile Include="GameClientState\LobbyAdminState.cpp" />
<ClCompile Include="GameClientState\LobbyState.cpp" /> <ClCompile Include="GameClientState\LobbyState.cpp" />
<ClCompile Include="GameClientState\C_Object.cpp" /> <ClCompile Include="GameClientState\C_Object.cpp" />
@ -231,6 +231,7 @@
<ClInclude Include="GameClientState\Camera_BasicV2.h" /> <ClInclude Include="GameClientState\Camera_BasicV2.h" />
<ClInclude Include="GameClientState\Camera_FPS.h" /> <ClInclude Include="GameClientState\Camera_FPS.h" />
<ClInclude Include="GameClientState\Camera_FPSV2.h" /> <ClInclude Include="GameClientState\Camera_FPSV2.h" />
<ClInclude Include="GameClientState\C_Light.h" />
<ClInclude Include="GameClientState\C_obj\C_DynamicObj.h" /> <ClInclude Include="GameClientState\C_obj\C_DynamicObj.h" />
<ClInclude Include="GameClientState\C_obj\C_Player.h" /> <ClInclude Include="GameClientState\C_obj\C_Player.h" />
<ClInclude Include="GameClientState\C_obj\C_StaticObj.h" /> <ClInclude Include="GameClientState\C_obj\C_StaticObj.h" />
@ -238,11 +239,6 @@
<ClInclude Include="GameClientState\GameClientState.h" /> <ClInclude Include="GameClientState\GameClientState.h" />
<ClInclude Include="GameClientState\GameState.h" /> <ClInclude Include="GameClientState\GameState.h" />
<ClInclude Include="GameClientState\LanMenuState.h" /> <ClInclude Include="GameClientState\LanMenuState.h" />
<ClInclude Include="GameClientState\LevelLoader\LevelLoader.h" />
<ClInclude Include="GameClientState\LevelLoader\LevelParser.h" />
<ClInclude Include="GameClientState\LevelLoader\Loader.h" />
<ClInclude Include="GameClientState\LevelLoader\ObjectDefines.h" />
<ClInclude Include="GameClientState\LevelLoader\ParseFunctions.h" />
<ClInclude Include="GameClientState\LobbyAdminState.h" /> <ClInclude Include="GameClientState\LobbyAdminState.h" />
<ClInclude Include="GameClientState\MainState.h" /> <ClInclude Include="GameClientState\MainState.h" />
<ClInclude Include="GameClientState\NetLoadState.h" /> <ClInclude Include="GameClientState\NetLoadState.h" />

View File

@ -0,0 +1,37 @@
#include "C_Light.h"
using namespace DanBias::Client;
C_Light::C_Light( Oyster::Graphics::Definitions::Pointlight pointLightDesc, int id )
{
this->pointLightDesc = pointLightDesc;
this->id = id;
}
C_Light::~C_Light()
{
}
Oyster::Graphics::Definitions::Pointlight C_Light::getLightDesc() const
{
return this->pointLightDesc;
}
void C_Light::setLightDesc( Oyster::Graphics::Definitions::Pointlight pointLightDesc )
{
this->pointLightDesc = pointLightDesc;
}
Oyster::Math::Float3 C_Light::getPos() const
{
return this->pointLightDesc.Pos;
}
void C_Light::setPos( Oyster::Math::Float3 newPos)
{
this->pointLightDesc.Pos = newPos;
}
int C_Light::GetId() const
{
return this->id;
}
void C_Light::Render()
{
// will be changed to new API
Oyster::Graphics::API::AddLight(pointLightDesc);
}

View File

@ -0,0 +1,29 @@
#ifndef DANBIAS_CLIENT_CLIGHT_H
#define DANBIAS_CLIENT_CLIGHT_H
#include "DllInterfaces/GFXAPI.h"
namespace DanBias
{
namespace Client
{
class C_Light
{
private:
Oyster::Graphics::Definitions::Pointlight pointLightDesc;
int id;
public:
C_Light( Oyster::Graphics::Definitions::Pointlight pointLightDesc, int id );
virtual ~C_Light();
Oyster::Graphics::Definitions::Pointlight getLightDesc() const;
void setLightDesc( Oyster::Graphics::Definitions::Pointlight pointLightDesc );
Oyster::Math::Float3 getPos() const;
void setPos( Oyster::Math::Float3 newPos);
void Render();
int GetId() const;
};
}
}
#endif

View File

@ -9,6 +9,10 @@ C_Object::C_Object()
id = 0; id = 0;
model = NULL; model = NULL;
// RB DEBUG
type = RB_Type_None;
// !RB DEBUG
} }
C_Object::~C_Object() C_Object::~C_Object()
{ {
@ -31,32 +35,27 @@ void C_Object::updateWorld()
{ {
Oyster::Math3D::Float4x4 translation = Oyster::Math3D::TranslationMatrix(this->position); Oyster::Math3D::Float4x4 translation = Oyster::Math3D::TranslationMatrix(this->position);
Oyster::Math3D::Float4x4 rot = Oyster::Math3D::RotationMatrix(this->rotation); Oyster::Math3D::Float4x4 rot = Oyster::Math3D::RotationMatrix(this->rotation);
//Oyster::Math3D::Float4x4 scale = Oyster::Math3D::; Oyster::Math3D::Float4x4 scale = Oyster::Math3D::ScalingMatrix(this->scale);
Oyster::Math3D::Float4x4 scale = Oyster::Math3D::Matrix::identity;
scale.v[0].x = this->scale[0];
scale.v[1].y = this->scale[1];
scale.v[2].z = this->scale[2];
world = translation * rot * scale; world = translation * rot * scale;
model->WorldMatrix = world; model->WorldMatrix = world;
} }
void C_Object::setWorld(Oyster::Math::Float4x4 world)
{
model->WorldMatrix = world;
}
Oyster::Math::Float4x4 C_Object::getWorld() const Oyster::Math::Float4x4 C_Object::getWorld() const
{ {
Oyster::Math3D::Float4x4 translation = Oyster::Math3D::TranslationMatrix(this->position);
Oyster::Math3D::Float4x4 rot = Oyster::Math3D::RotationMatrix(this->rotation);
Oyster::Math3D::Float4x4 scale = Oyster::Math3D::ScalingMatrix(this->scale);
Oyster::Math3D::Float4x4 world = translation * rot * scale;
return world; return world;
} }
void C_Object::setPos(Oyster::Math::Float3 newPos) void C_Object::setPos(Oyster::Math::Float3 newPos)
{ {
this->position = newPos; this->position = newPos;
updateWorld();
} }
void C_Object::addPos(Oyster::Math::Float3 deltaPos) void C_Object::addPos(Oyster::Math::Float3 deltaPos)
{ {
this->position += deltaPos; this->position += deltaPos;
updateWorld();
} }
Oyster::Math::Float3 C_Object::getPos() const Oyster::Math::Float3 C_Object::getPos() const
{ {
@ -65,12 +64,6 @@ Oyster::Math::Float3 C_Object::getPos() const
void C_Object::setRot(Oyster::Math::Quaternion newRot) void C_Object::setRot(Oyster::Math::Quaternion newRot)
{ {
this->rotation = newRot; this->rotation = newRot;
updateWorld();
}
void C_Object::addRot(Oyster::Math::Quaternion deltaRot)
{
this->rotation += deltaRot;
updateWorld();
} }
Oyster::Math::Quaternion C_Object::getRotation() const Oyster::Math::Quaternion C_Object::getRotation() const
{ {
@ -79,12 +72,10 @@ Oyster::Math::Quaternion C_Object::getRotation() const
void C_Object::setScale(Oyster::Math::Float3 newScale) void C_Object::setScale(Oyster::Math::Float3 newScale)
{ {
this->scale = newScale; this->scale = newScale;
updateWorld();
} }
void C_Object::addScale(Oyster::Math::Float3 deltaScale) void C_Object::addScale(Oyster::Math::Float3 deltaScale)
{ {
this->scale += deltaScale; this->scale += deltaScale;
updateWorld();
} }
Oyster::Math::Float3 C_Object::getScale() const Oyster::Math::Float3 C_Object::getScale() const
{ {
@ -105,4 +96,56 @@ void C_Object::Release()
Oyster::Graphics::API::DeleteModel(model); Oyster::Graphics::API::DeleteModel(model);
this->model = nullptr; this->model = nullptr;
} }
} }
////////////////////////////////////////////////
// RB DEBUG
////////////////////////////////////////////////
bool C_Object::InitRB(RBInitData RBInit)
{
RBposition = RBInit.position;
RBrotation = RBInit.rotation;
RBscale = RBInit.scale;
type = RBInit.type;
return true;
}
Oyster::Math::Float4x4 C_Object::getRBWorld() const
{
Oyster::Math3D::Float4x4 translation = Oyster::Math3D::TranslationMatrix(this->RBposition);
Oyster::Math3D::Float4x4 rot = Oyster::Math3D::RotationMatrix(this->RBrotation);
Oyster::Math3D::Float4x4 scale = Oyster::Math3D::ScalingMatrix(this->RBscale);
Oyster::Math3D::Float4x4 world = translation * rot * scale;
return world;
}
void C_Object::setRBPos(Oyster::Math::Float3 newPos)
{
this->RBposition = newPos;
}
Oyster::Math::Float3 C_Object::getRBPos() const
{
return this->RBposition;
}
void C_Object::setRBRot(Oyster::Math::Quaternion newRot)
{
this->RBrotation = newRot;
}
Oyster::Math::Quaternion C_Object::getRBRotation() const
{
return this->RBrotation;
}
void C_Object::setRBScale(Oyster::Math::Float3 newScale)
{
this->RBscale = newScale;
}
Oyster::Math::Float3 C_Object::getRBScale() const
{
return this->RBscale;
}
RB_Type C_Object::getBRtype()const
{
return this->type;
}
// !RB DEBUG

View File

@ -5,6 +5,21 @@ namespace DanBias
{ {
namespace Client namespace Client
{ {
// RB DEBUG
enum RB_Type
{
RB_Type_Cube,
RB_Type_Sphere,
RB_Type_None,
};
struct RBInitData
{
Oyster::Math::Float3 position;
Oyster::Math::Quaternion rotation;
Oyster::Math::Float3 scale;
RB_Type type;
};
// !RB DEBUG
struct ModelInitData struct ModelInitData
{ {
@ -23,28 +38,46 @@ namespace DanBias
Oyster::Math::Float3 position; Oyster::Math::Float3 position;
Oyster::Math::Quaternion rotation; Oyster::Math::Quaternion rotation;
Oyster::Math::Float3 scale; Oyster::Math::Float3 scale;
// RB DEBUG
Oyster::Math::Float3 RBposition;
Oyster::Math::Quaternion RBrotation;
Oyster::Math::Float3 RBscale;
RB_Type type;
// !RB DEBUG
int id; int id;
void updateWorld();
protected: protected:
Oyster::Graphics::Model::Model *model; Oyster::Graphics::Model::Model *model;
public: public:
C_Object(); C_Object();
virtual ~C_Object(); virtual ~C_Object();
virtual bool Init(ModelInitData modelInit); virtual bool Init(ModelInitData modelInit);
void updateWorld();
void setWorld(Oyster::Math::Float4x4 world); //void setWorld(Oyster::Math::Float4x4 world);
Oyster::Math::Float4x4 getWorld() const; Oyster::Math::Float4x4 getWorld() const;
void setPos(Oyster::Math::Float3 newPos); void setPos(Oyster::Math::Float3 newPos);
Oyster::Math::Float3 getPos() const; Oyster::Math::Float3 getPos() const;
void addPos(Oyster::Math::Float3 deltaPos); void addPos(Oyster::Math::Float3 deltaPos);
void setRot(Oyster::Math::Quaternion newRot); void setRot(Oyster::Math::Quaternion newRot);
Oyster::Math::Quaternion getRotation() const; Oyster::Math::Quaternion getRotation() const;
void addRot(Oyster::Math::Quaternion deltaRot);
void setScale(Oyster::Math::Float3 newScale); void setScale(Oyster::Math::Float3 newScale);
void addScale(Oyster::Math::Float3 deltaScale); void addScale(Oyster::Math::Float3 deltaScale);
Oyster::Math::Float3 getScale() const; Oyster::Math::Float3 getScale() const;
// RB DEBUG
bool InitRB(RBInitData modelInit);
Oyster::Math::Float4x4 getRBWorld() const;
void setRBPos(Oyster::Math::Float3 newPos);
Oyster::Math::Float3 getRBPos() const;
void setRBRot(Oyster::Math::Quaternion newRot);
Oyster::Math::Quaternion getRBRotation() const;
void setRBScale(Oyster::Math::Float3 newScale);
Oyster::Math::Float3 getRBScale() const;
RB_Type getBRtype()const;
// !RB DEBUG
virtual void Render(); virtual void Render();
virtual void Release(); virtual void Release();
virtual int GetId() const; virtual int GetId() const;

View File

@ -4,7 +4,7 @@
#include "NetworkClient.h" #include "NetworkClient.h"
#include "Camera_FPSV2.h" #include "Camera_FPSV2.h"
#include <GameServerAPI.h> #include <GameServerAPI.h>
#include "C_Light.h"
#include "C_obj/C_Player.h" #include "C_obj/C_Player.h"
#include "C_obj/C_DynamicObj.h" #include "C_obj/C_DynamicObj.h"
#include "C_obj/C_StaticObj.h" #include "C_obj/C_StaticObj.h"
@ -28,6 +28,7 @@ struct GameState::MyData
::std::map<int, ::Utility::DynamicMemory::UniquePointer<::DanBias::Client::C_StaticObj>> *staticObjects; ::std::map<int, ::Utility::DynamicMemory::UniquePointer<::DanBias::Client::C_StaticObj>> *staticObjects;
::std::map<int, ::Utility::DynamicMemory::UniquePointer<::DanBias::Client::C_DynamicObj>> *dynamicObjects; ::std::map<int, ::Utility::DynamicMemory::UniquePointer<::DanBias::Client::C_DynamicObj>> *dynamicObjects;
::std::map<int, ::Utility::DynamicMemory::UniquePointer<::DanBias::Client::C_Light>> *lights;
bool key_forward; bool key_forward;
bool key_backward; bool key_backward;
@ -36,7 +37,11 @@ struct GameState::MyData
bool key_Shoot; bool key_Shoot;
bool key_Jump; bool key_Jump;
// DEGUG KEYS
bool key_Reload_Shaders; bool key_Reload_Shaders;
bool key_Wireframe_Toggle;
bool renderWhireframe;
// !DEGUG KEYS
C_Player player; C_Player player;
Camera_FPSV2 camera; Camera_FPSV2 camera;
@ -78,15 +83,28 @@ bool GameState::Init( SharedStateContent &shared )
this->privData->input = shared.input; this->privData->input = shared.input;
this->privData->staticObjects = &shared.staticObjects; this->privData->staticObjects = &shared.staticObjects;
this->privData->dynamicObjects = &shared.dynamicObjects; this->privData->dynamicObjects = &shared.dynamicObjects;
this->privData->lights = &shared.lights;
Graphics::API::Option gfxOp = Graphics::API::GetOption(); Graphics::API::Option gfxOp = Graphics::API::GetOption();
Float aspectRatio = gfxOp.Resolution.x / gfxOp.Resolution.y; Float aspectRatio = gfxOp.Resolution.x / gfxOp.Resolution.y;
this->privData->camera.SetPerspectiveProjection( Radian(90.0f), aspectRatio, 0.1f, 1000.0f ); this->privData->camera.SetPerspectiveProjection( Utility::Value::Radian(90.0f), aspectRatio, 0.1f, 1000.0f );
Graphics::API::SetProjection( this->privData->camera.GetProjectionMatrix() ); Graphics::API::SetProjection( this->privData->camera.GetProjectionMatrix() );
//tell server ready //tell server ready
this->privData->nwClient->Send( Protocol_General_Status(Protocol_General_Status::States_ready) ); this->privData->nwClient->Send( Protocol_General_Status(Protocol_General_Status::States_ready) );
// DEGUG KEYS
this->privData->key_Reload_Shaders = false;
this->privData->key_Wireframe_Toggle = false;
this->privData->renderWhireframe = false;
// !DEGUG KEYS
auto light = this->privData->lights->begin();
for( ; light != this->privData->lights->end(); ++light )
{
light->second->Render();
}
return true; return true;
} }
@ -100,10 +118,20 @@ void GameState::InitiatePlayer( int id, const std::string &modelName, const floa
StringToWstring( modelName, modelData.modelPath ); StringToWstring( modelName, modelData.modelPath );
modelData.id = id; modelData.id = id;
// RB DEBUG
RBInitData RBData;
RBData.position = position;
RBData.rotation = ArrayToQuaternion( rotation );
RBData.scale = Float3( 1 );
// !RB DEBUG
if( isMyPlayer ) if( isMyPlayer )
{ {
if( this->privData->player.Init(modelData) ) if( this->privData->player.Init(modelData) )
{ {
// RB DEBUG
this->privData->player.InitRB( RBData );
// !RB DEBUG
this->privData->myId = id; this->privData->myId = id;
this->privData->camera.SetPosition( this->privData->player.getPos() ); this->privData->camera.SetPosition( this->privData->player.getPos() );
Float3 offset = Float3( 0.0f ); Float3 offset = Float3( 0.0f );
@ -117,6 +145,10 @@ void GameState::InitiatePlayer( int id, const std::string &modelName, const floa
C_DynamicObj *p = new C_DynamicObj(); C_DynamicObj *p = new C_DynamicObj();
if( p->Init(modelData) ) if( p->Init(modelData) )
{ {
// RB DEBUG
this->privData->player.InitRB( RBData );
// !RB DEBUG
(*this->privData->dynamicObjects)[id] = p; (*this->privData->dynamicObjects)[id] = p;
} }
} }
@ -150,6 +182,52 @@ bool GameState::Render()
dynamicObject->second->Render(); dynamicObject->second->Render();
} }
/*auto light = this->privData->lights->begin();
for( ; light != this->privData->lights->end(); ++light )
{
light->second->Render();
}*/
// RB DEBUG render wire frame
if(this->privData->renderWhireframe)
{
Oyster::Graphics::API::StartRenderWireFrame();
Oyster::Math3D::Float4x4 translation = Oyster::Math3D::TranslationMatrix(Float3( 0,132, 20));
Oyster::Math3D::Float4x4 scale = Oyster::Math3D::ScalingMatrix(Float3( 0.5f, 0.5f, 0.5f));
Oyster::Math3D::Float4x4 world = translation * scale;
Oyster::Graphics::API::RenderDebugCube( world );
Oyster::Graphics::API::RenderDebugCube(this->privData->player.getRBWorld());
staticObject = this->privData->staticObjects->begin();
for( ; staticObject != this->privData->staticObjects->end(); ++staticObject )
{
if( staticObject->second->getBRtype() == RB_Type_Cube)
{
Oyster::Graphics::API::RenderDebugCube( staticObject->second->getRBWorld());
}
if( staticObject->second->getBRtype() == RB_Type_Sphere)
{
Oyster::Graphics::API::RenderDebugSphere( staticObject->second->getRBWorld());
}
}
dynamicObject = this->privData->dynamicObjects->begin();
for( ; dynamicObject != this->privData->dynamicObjects->end(); ++dynamicObject )
{
if( dynamicObject->second->getBRtype() == RB_Type_Cube)
{
Oyster::Graphics::API::RenderDebugCube( dynamicObject->second->getRBWorld());
}
if( dynamicObject->second->getBRtype() == RB_Type_Sphere)
{
Oyster::Graphics::API::RenderDebugSphere( dynamicObject->second->getRBWorld());
}
}
}
// !RB DEBUG
Oyster::Graphics::API::EndFrame(); Oyster::Graphics::API::EndFrame();
return true; return true;
} }
@ -170,8 +248,15 @@ bool GameState::Release()
dynamicObject->second = nullptr; dynamicObject->second = nullptr;
} }
auto light = this->privData->lights->begin();
for( ; light != this->privData->lights->end(); ++light )
{
light->second->Render();
}
this->privData->staticObjects->clear(); this->privData->staticObjects->clear();
this->privData->dynamicObjects->clear(); this->privData->dynamicObjects->clear();
this->privData->lights->clear();
privData = NULL; privData = NULL;
} }
@ -229,21 +314,6 @@ void GameState::ReadKeyInput()
else else
this->privData->key_strafeRight = false; this->privData->key_strafeRight = false;
if( this->privData->input->IsKeyPressed(DIK_R) )
{
if( !this->privData->key_Reload_Shaders )
{
//this->privData->nwClient->Send( Protocol_PlayerMovementRight() );
#ifdef _DEBUG
Graphics::API::ReloadShaders();
#endif
this->privData->key_Reload_Shaders = true;
}
}
else
this->privData->key_Reload_Shaders = false;
//send delta mouse movement //send delta mouse movement
{ {
this->privData->camera.YawRight( this->privData->input->GetYaw() * 0.017f ); this->privData->camera.YawRight( this->privData->input->GetYaw() * 0.017f );
@ -309,6 +379,35 @@ void GameState::ReadKeyInput()
else else
this->privData->key_Jump = false; this->privData->key_Jump = false;
// DEGUG KEYS
// Reload shaders
if( this->privData->input->IsKeyPressed(DIK_R) )
{
if( !this->privData->key_Reload_Shaders )
{
#ifdef _DEBUG
Graphics::API::ReloadShaders();
#endif
this->privData->key_Reload_Shaders = true;
}
}
else
this->privData->key_Reload_Shaders = false;
// toggle wire frame render
if( this->privData->input->IsKeyPressed(DIK_T) )
{
if( !this->privData->key_Wireframe_Toggle )
{
this->privData->renderWhireframe = !this->privData->renderWhireframe;
this->privData->key_Wireframe_Toggle = true;
}
}
else
this->privData->key_Wireframe_Toggle = false;
// !DEGUG KEYS
// TODO: implement sub-menu // TODO: implement sub-menu
} }
@ -342,12 +441,18 @@ const GameClientState::NetEvent & GameState::DataRecieved( const GameClientState
this->privData->camera.SetPosition( decoded.position ); this->privData->camera.SetPosition( decoded.position );
(*this->privData->dynamicObjects)[decoded.object_ID]->setPos( decoded.position ); (*this->privData->dynamicObjects)[decoded.object_ID]->setPos( decoded.position );
// RB DEBUG
(*this->privData->dynamicObjects)[decoded.object_ID]->setRBPos ( decoded.position );
// !RB DEBUG
} }
return GameClientState::event_processed; return GameClientState::event_processed;
case protocol_Gameplay_ObjectScale: case protocol_Gameplay_ObjectScale:
{ {
Protocol_ObjectScale decoded(data); Protocol_ObjectScale decoded(data);
(*this->privData->dynamicObjects)[decoded.object_ID]->setScale( decoded.scale ); (*this->privData->dynamicObjects)[decoded.object_ID]->setScale( decoded.scale );
// RB DEBUG
(*this->privData->dynamicObjects)[decoded.object_ID]->setRBScale ( decoded.scale );
// !RB DEBUG
} }
return GameClientState::event_processed; return GameClientState::event_processed;
case protocol_Gameplay_ObjectRotation: case protocol_Gameplay_ObjectRotation:
@ -360,6 +465,9 @@ const GameClientState::NetEvent & GameState::DataRecieved( const GameClientState
this->privData->camera.SetRotation( rotation ); this->privData->camera.SetRotation( rotation );
(*this->privData->dynamicObjects)[decoded.object_ID]->setRot( rotation ); (*this->privData->dynamicObjects)[decoded.object_ID]->setRot( rotation );
// RB DEBUG
(*this->privData->dynamicObjects)[decoded.object_ID]->setRBRot ( rotation );
// !RB DEBUG
} }
return GameClientState::event_processed; return GameClientState::event_processed;
case protocol_Gameplay_ObjectPositionRotation: case protocol_Gameplay_ObjectPositionRotation:
@ -371,17 +479,22 @@ const GameClientState::NetEvent & GameState::DataRecieved( const GameClientState
// if is this player. Remember to change camera // if is this player. Remember to change camera
if( this->privData->myId == decoded.object_ID ) if( this->privData->myId == decoded.object_ID )
{ {
this->privData->camera.SetPosition( position ); //this->privData->camera.SetPosition( position );
//this->privData->camera.SetRotation( rotation ); //this->privData->camera.SetRotation( rotation );
this->privData->player.setPos( position ); this->privData->player.setPos( position );
//this->privData->player.setRot( rotation ); //this->privData->player.setRot( rotation );
} }
C_DynamicObj *object = (*this->privData->dynamicObjects)[decoded.object_ID]; C_DynamicObj *object = (*this->privData->dynamicObjects)[decoded.object_ID];
if( object ) if( object )
{ {
object->setPos( position ); object->setPos( position );
object->setRot( rotation ); object->setRot( rotation );
// RB DEBUG
object->setRBPos ( position );
object->setRBRot ( rotation );
// !RB DEBUG
} }
} }
return GameClientState::event_processed; return GameClientState::event_processed;
@ -406,7 +519,7 @@ const GameClientState::NetEvent & GameState::DataRecieved( const GameClientState
ModelInitData modelData; ModelInitData modelData;
{ {
modelData.position = Float3( decoded.position ); modelData.position = Float3( decoded.position );
modelData.rotation = Quaternion( Float3(decoded.rotationQ), decoded.rotationQ[3] ); modelData.rotation = Quaternion( Float3(decoded.position), decoded.rotationQ[3] );
modelData.scale = Float3( decoded.scale ); modelData.scale = Float3( decoded.scale );
modelData.visible = true; modelData.visible = true;
modelData.id = decoded.object_ID; modelData.id = decoded.object_ID;
@ -414,6 +527,15 @@ const GameClientState::NetEvent & GameState::DataRecieved( const GameClientState
::Utility::String::StringToWstring( decoded.name, modelData.modelPath ); ::Utility::String::StringToWstring( decoded.name, modelData.modelPath );
} }
object->Init(modelData); object->Init(modelData);
// RB DEBUG
// Is just using the model position since the rigid body data should never be sent to the client
RBInitData RBData;
RBData.position = decoded.position;
RBData.rotation = ArrayToQuaternion( decoded.position );
RBData.scale = Float3( decoded.scale );
this->privData->player.InitRB( RBData );
// !RB DEBUG
(*this->privData->dynamicObjects)[decoded.object_ID] = object; (*this->privData->dynamicObjects)[decoded.object_ID] = object;

View File

@ -126,6 +126,9 @@ void LanMenuState::ChangeState( ClientState next )
// attempt to connect to lobby // attempt to connect to lobby
if( !this->privData->nwClient->Connect(this->privData->connectPort, (*this->privData->connectIP)[0]) ) if( !this->privData->nwClient->Connect(this->privData->connectPort, (*this->privData->connectIP)[0]) )
return; return;
//this->privData->nwClient->Disconnect();
//if( !this->privData->nwClient->Reconnect() )
//return;
break; break;
default: break; default: break;
} }

View File

@ -2,10 +2,11 @@
#include "NetworkClient.h" #include "NetworkClient.h"
#include "OysterMath.h" #include "OysterMath.h"
#include "Protocols.h" #include "Protocols.h"
#include "LevelLoader\LevelLoader.h" #include "LevelLoader.h"
#include "Utilities.h" #include "Utilities.h"
#include "C_obj\C_StaticObj.h" #include "C_obj\C_StaticObj.h"
#include "C_obj\C_DynamicObj.h" #include "C_obj\C_DynamicObj.h"
#include "C_Light.h"
using namespace ::DanBias::Client; using namespace ::DanBias::Client;
using namespace ::Oyster; using namespace ::Oyster;
@ -23,6 +24,7 @@ struct NetLoadState::MyData
Graphics::API::Texture background; Graphics::API::Texture background;
::std::map<int, ::Utility::DynamicMemory::UniquePointer<::DanBias::Client::C_StaticObj>> *staticObjects; ::std::map<int, ::Utility::DynamicMemory::UniquePointer<::DanBias::Client::C_StaticObj>> *staticObjects;
::std::map<int, ::Utility::DynamicMemory::UniquePointer<::DanBias::Client::C_DynamicObj>> *dynamicObjects; ::std::map<int, ::Utility::DynamicMemory::UniquePointer<::DanBias::Client::C_DynamicObj>> *dynamicObjects;
::std::map<int, ::Utility::DynamicMemory::UniquePointer<::DanBias::Client::C_Light>> *lights;
bool loading; bool loading;
}; };
@ -49,6 +51,7 @@ bool NetLoadState::Init( SharedStateContent &shared )
this->privData->background = Graphics::API::CreateTexture( L"grass_md.png" ); this->privData->background = Graphics::API::CreateTexture( L"grass_md.png" );
this->privData->dynamicObjects = &shared.dynamicObjects; this->privData->dynamicObjects = &shared.dynamicObjects;
this->privData->staticObjects = &shared.staticObjects; this->privData->staticObjects = &shared.staticObjects;
this->privData->lights = &shared.lights;
this->privData->loading = false; this->privData->loading = false;
@ -141,17 +144,31 @@ void NetLoadState::LoadGame( const ::std::string &fileName )
desc.scale = oh->scale; desc.scale = oh->scale;
desc.visible = true; desc.visible = true;
// HACK: untill the world is right in lvl format
if( oh->specialTypeID == ObjectSpecialType_World)
{
desc.position = Float3(0,0,0);
desc.rotation = Quaternion::identity;
desc.scale = Float3(300,300,300);
}
C_StaticObj *staticObject = new C_StaticObj(); C_StaticObj *staticObject = new C_StaticObj();
if( staticObject->Init( desc ) ) if( staticObject->Init( desc ) )
{ {
// RB DEBUG
RBInitData RBData;
if(oh->boundingVolume.geoType == CollisionGeometryType_Box)
{
RBData.position = (Float3)oh->position + (Float3)oh->boundingVolume.box.position;
RBData.rotation = ArrayToQuaternion( oh->rotation ); // Only model rotation
RBData.scale = (Float3)oh->scale * (Float3)oh->boundingVolume.box.size;
RBData.type = RB_Type_Cube;
staticObject->InitRB( RBData );
}
if(oh->boundingVolume.geoType == CollisionGeometryType_Sphere)
{
RBData.position = (Float3)oh->position + (Float3)oh->boundingVolume.sphere.position;
RBData.rotation = ArrayToQuaternion( oh->rotation ); // Only model rotation
RBData.scale = (Float3)oh->scale * oh->boundingVolume.sphere.radius;
RBData.type = RB_Type_Sphere;
staticObject->InitRB( RBData );
}
// !RB DEBUG
(*this->privData->staticObjects)[objectID] = staticObject; (*this->privData->staticObjects)[objectID] = staticObject;
} }
else else
@ -175,6 +192,27 @@ void NetLoadState::LoadGame( const ::std::string &fileName )
C_DynamicObj *dynamicObject = new C_DynamicObj(); C_DynamicObj *dynamicObject = new C_DynamicObj();
if( dynamicObject->Init( desc ) ) if( dynamicObject->Init( desc ) )
{ {
// RB DEBUG
RBInitData RBData;
if(oh->boundingVolume.geoType == CollisionGeometryType_Box)
{
RBData.position = (Float3)oh->position + (Float3)oh->boundingVolume.box.position;
RBData.rotation = ArrayToQuaternion( oh->rotation ); // Only model rotation
RBData.scale = (Float3)oh->scale * (Float3)oh->boundingVolume.box.size;
RBData.type = RB_Type_Cube;
dynamicObject->InitRB( RBData );
}
if(oh->boundingVolume.geoType == CollisionGeometryType_Sphere)
{
RBData.position = (Float3)oh->position + (Float3)oh->boundingVolume.sphere.position;
RBData.rotation = ArrayToQuaternion( oh->rotation ); // Only model rotation
RBData.scale = (Float3)oh->scale * oh->boundingVolume.sphere.radius;
RBData.type = RB_Type_Sphere;
dynamicObject->InitRB( RBData );
}
// !RB DEBUG
(*this->privData->dynamicObjects)[objectID] = dynamicObject; (*this->privData->dynamicObjects)[objectID] = dynamicObject;
} }
else else
@ -185,7 +223,17 @@ void NetLoadState::LoadGame( const ::std::string &fileName )
break; break;
case ObjectType::ObjectType_Light: case ObjectType::ObjectType_Light:
{ {
/* TODO: implement light into the leveformat */ BasicLight *light = (BasicLight*)oth;
Graphics::Definitions::Pointlight pointLight;
pointLight.Color = light->color;
pointLight.Pos = light->position;
pointLight.Bright = light->intensity;
pointLight.Radius = light->raduis;
C_Light *newLight = new C_Light( pointLight, objectID );
(*this->privData->lights)[objectID] = newLight;
} }
break; break;
default: break; default: break;

View File

@ -13,6 +13,7 @@
#include "C_Object.h" #include "C_Object.h"
#include "C_obj\C_StaticObj.h" #include "C_obj\C_StaticObj.h"
#include "C_obj\C_DynamicObj.h" #include "C_obj\C_DynamicObj.h"
#include "C_Light.h"
#include "NetworkClient.h" #include "NetworkClient.h"
#include "L_inputClass.h" #include "L_inputClass.h"
@ -23,6 +24,7 @@ namespace DanBias { namespace Client
public: public:
::std::map<int, ::Utility::DynamicMemory::UniquePointer<::DanBias::Client::C_StaticObj>> staticObjects; ::std::map<int, ::Utility::DynamicMemory::UniquePointer<::DanBias::Client::C_StaticObj>> staticObjects;
::std::map<int, ::Utility::DynamicMemory::UniquePointer<::DanBias::Client::C_DynamicObj>> dynamicObjects; ::std::map<int, ::Utility::DynamicMemory::UniquePointer<::DanBias::Client::C_DynamicObj>> dynamicObjects;
::std::map<int, ::Utility::DynamicMemory::UniquePointer<::DanBias::Client::C_Light>> lights;
::Oyster::Network::NetworkClient *network; ::Oyster::Network::NetworkClient *network;
InputClass* input; InputClass* input;
}; };

View File

@ -12,7 +12,7 @@
#include "GameLogicDef.h" #include "GameLogicDef.h"
#include "GameLogicStates.h" #include "GameLogicStates.h"
#include <OysterMath.h> #include <OysterMath.h>
#include "LevelLoader\ObjectDefines.h" #include "..\LevelLoader\ObjectDefines.h"
#include "DynamicArray.h" #include "DynamicArray.h"

View File

@ -99,7 +99,7 @@
<WarningLevel>Level3</WarningLevel> <WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization> <Optimization>Disabled</Optimization>
<SDLCheck>true</SDLCheck> <SDLCheck>true</SDLCheck>
<AdditionalIncludeDirectories>$(SolutionDir)Misc\Utilities;$(SolutionDir)Misc\OysterMath;$(SolutionDir)Physics\OysterPhysics3D;$(SolutionDir)Physics\GamePhysics;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>$(SolutionDir)Misc\Utilities;$(SolutionDir)Misc\OysterMath;$(SolutionDir)Physics\OysterPhysics3D;$(SolutionDir)Physics\GamePhysics;$(SolutionDir)Game\LevelLoader</AdditionalIncludeDirectories>
<PreprocessorDefinitions>DANBIAS_GAMELOGIC_DLL_EXPORT;_WINDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>DANBIAS_GAMELOGIC_DLL_EXPORT;_WINDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile> </ClCompile>
<Link> <Link>
@ -113,7 +113,7 @@
<WarningLevel>Level3</WarningLevel> <WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization> <Optimization>Disabled</Optimization>
<SDLCheck>true</SDLCheck> <SDLCheck>true</SDLCheck>
<AdditionalIncludeDirectories>$(SolutionDir)Misc\Utilities;$(SolutionDir)Misc\OysterMath;$(SolutionDir)Physics\OysterPhysics3D;$(SolutionDir)Physics\GamePhysics;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>$(SolutionDir)Misc\Utilities;$(SolutionDir)Misc\OysterMath;$(SolutionDir)Physics\OysterPhysics3D;$(SolutionDir)Physics\GamePhysics;$(SolutionDir)Game\LevelLoader</AdditionalIncludeDirectories>
<PreprocessorDefinitions>DANBIAS_GAMELOGIC_DLL_EXPORT;_WINDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>DANBIAS_GAMELOGIC_DLL_EXPORT;_WINDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile> </ClCompile>
<Link> <Link>
@ -129,7 +129,7 @@
<FunctionLevelLinking>true</FunctionLevelLinking> <FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions> <IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck> <SDLCheck>true</SDLCheck>
<AdditionalIncludeDirectories>$(SolutionDir)Misc\Utilities;$(SolutionDir)Misc\OysterMath;$(SolutionDir)Physics\OysterPhysics3D;$(SolutionDir)Physics\GamePhysics;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>$(SolutionDir)Misc\Utilities;$(SolutionDir)Misc\OysterMath;$(SolutionDir)Physics\OysterPhysics3D;$(SolutionDir)Physics\GamePhysics;$(SolutionDir)Game\LevelLoader</AdditionalIncludeDirectories>
<PreprocessorDefinitions>DANBIAS_GAMELOGIC_DLL_EXPORT;_WINDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>DANBIAS_GAMELOGIC_DLL_EXPORT;_WINDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile> </ClCompile>
<Link> <Link>
@ -147,7 +147,7 @@
<FunctionLevelLinking>true</FunctionLevelLinking> <FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions> <IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck> <SDLCheck>true</SDLCheck>
<AdditionalIncludeDirectories>$(SolutionDir)Misc\Utilities;$(SolutionDir)Misc\OysterMath;$(SolutionDir)Physics\OysterPhysics3D;$(SolutionDir)Physics\GamePhysics;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>$(SolutionDir)Misc\Utilities;$(SolutionDir)Misc\OysterMath;$(SolutionDir)Physics\OysterPhysics3D;$(SolutionDir)Physics\GamePhysics;$(SolutionDir)Game\LevelLoader</AdditionalIncludeDirectories>
<PreprocessorDefinitions>DANBIAS_GAMELOGIC_DLL_EXPORT;_WINDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>DANBIAS_GAMELOGIC_DLL_EXPORT;_WINDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile> </ClCompile>
<Link> <Link>
@ -172,12 +172,7 @@
<ClInclude Include="IAttatchment.h" /> <ClInclude Include="IAttatchment.h" />
<ClInclude Include="JumpPad.h" /> <ClInclude Include="JumpPad.h" />
<ClInclude Include="Level.h" /> <ClInclude Include="Level.h" />
<ClInclude Include="LevelLoader\LevelLoader.h" />
<ClInclude Include="LevelLoader\Loader.h" />
<ClInclude Include="Object.h" /> <ClInclude Include="Object.h" />
<ClInclude Include="LevelLoader\ObjectDefines.h" />
<ClInclude Include="LevelLoader\LevelParser.h" />
<ClInclude Include="LevelLoader\ParseFunctions.h" />
<ClInclude Include="Player.h" /> <ClInclude Include="Player.h" />
<ClInclude Include="Portal.h" /> <ClInclude Include="Portal.h" />
<ClInclude Include="StaticObject.h" /> <ClInclude Include="StaticObject.h" />
@ -198,11 +193,7 @@
<ClCompile Include="IAttatchment.cpp" /> <ClCompile Include="IAttatchment.cpp" />
<ClCompile Include="JumpPad.cpp" /> <ClCompile Include="JumpPad.cpp" />
<ClCompile Include="Level.cpp" /> <ClCompile Include="Level.cpp" />
<ClCompile Include="LevelLoader\LevelLoader.cpp" />
<ClCompile Include="LevelLoader\Loader.cpp" />
<ClCompile Include="LevelLoader\LevelParser.cpp" />
<ClCompile Include="Object.cpp" /> <ClCompile Include="Object.cpp" />
<ClCompile Include="LevelLoader\ParseFunctions.cpp" />
<ClCompile Include="Player.cpp" /> <ClCompile Include="Player.cpp" />
<ClCompile Include="Portal.cpp" /> <ClCompile Include="Portal.cpp" />
<ClCompile Include="StaticObject.cpp" /> <ClCompile Include="StaticObject.cpp" />
@ -223,6 +214,9 @@
<ProjectReference Include="..\..\Physics\OysterPhysics3D\OysterPhysics3D.vcxproj"> <ProjectReference Include="..\..\Physics\OysterPhysics3D\OysterPhysics3D.vcxproj">
<Project>{3ea5f14d-2a71-4588-a69d-87c4571c580f}</Project> <Project>{3ea5f14d-2a71-4588-a69d-87c4571c580f}</Project>
</ProjectReference> </ProjectReference>
<ProjectReference Include="..\LevelLoader\LevelLoader.vcxproj">
<Project>{6391e709-d9fa-4fef-a3b9-4343db5a0c63}</Project>
</ProjectReference>
</ItemGroup> </ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets"> <ImportGroup Label="ExtensionTargets">

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup> <PropertyGroup>
<ShowAllFiles>false</ShowAllFiles> <ShowAllFiles>true</ShowAllFiles>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LocalDebuggerWorkingDirectory>$(OutDir)</LocalDebuggerWorkingDirectory> <LocalDebuggerWorkingDirectory>$(OutDir)</LocalDebuggerWorkingDirectory>

View File

@ -24,7 +24,7 @@ Game::PlayerData::PlayerData()
} }
Game::PlayerData::PlayerData(int playerID,int teamID) Game::PlayerData::PlayerData(int playerID,int teamID)
{ {
Oyster::Math::Float3 centerPosition = Oyster::Math::Float3(50,130,0); Oyster::Math::Float3 centerPosition = Oyster::Math::Float3(-50,180,0);
Oyster::Math::Float3 size = Oyster::Math::Float3(0.25f,2.0f,0.5f); Oyster::Math::Float3 size = Oyster::Math::Float3(0.25f,2.0f,0.5f);
Oyster::Math::Float mass = 60; Oyster::Math::Float mass = 60;

View File

@ -4,6 +4,10 @@
#include "JumpPad.h" #include "JumpPad.h"
#include "ExplosiveCrate.h" #include "ExplosiveCrate.h"
#include "Portal.h" #include "Portal.h"
//Conversion from wstring to string
#include <codecvt>
using namespace GameLogic; using namespace GameLogic;
using namespace Utility::DynamicMemory; using namespace Utility::DynamicMemory;
using namespace Oyster::Physics; using namespace Oyster::Physics;
@ -200,9 +204,16 @@ ICustomBody* Level::InitRigidBodySphere( const ObjectHeader* obj)
bool Level::InitiateLevel(std::wstring levelPath) bool Level::InitiateLevel(std::wstring levelPath)
{ {
LevelLoader ll; LevelLoader ll;
ll.SetFolderPath(L"..\\Content\\Worlds\\"); ll.SetFolderPath("..\\Content\\Worlds\\");
std::vector<Utility::DynamicMemory::SmartPointer<ObjectTypeHeader>> objects; std::vector<Utility::DynamicMemory::SmartPointer<ObjectTypeHeader>> objects;
objects = ll.LoadLevel(levelPath);
//Convert from wstring to string
typedef std::codecvt_utf8<wchar_t> convert_typeX;
std::wstring_convert<convert_typeX, wchar_t> converterX;
std::string convertedLevelPath = converterX.to_bytes(levelPath);
objects = ll.LoadLevel(convertedLevelPath);
if(objects.size() == 0) if(objects.size() == 0)
return false; return false;
@ -231,34 +242,8 @@ bool Level::InitiateLevel(std::wstring levelPath)
ICustomBody* rigidBody_Static = NULL; ICustomBody* rigidBody_Static = NULL;
// HACK: untill the world is right in lvl format
if((ObjectSpecialType)staticObjData->specialTypeID == ObjectSpecialType_World)
{
Oyster::Math::Float3 rigidWorldPos;
Oyster::Math::Float4 rigidWorldRotation;
float rigidBodyMass;
float rigidBodyRadius;
//offset the rigidPosition from modelspace to worldspace;
rigidWorldPos = Oyster::Math::Float3(0,0,0);
//scales the position so the collision geomentry is in the right place
//offset the rigidRotation from modelspace to worldspace;
rigidWorldRotation = Oyster::Math::Float4(0,0,0,1);
//mass scaled
rigidBodyMass = 0;
//Radius scaled
rigidBodyRadius = 150;
//create the rigid body
rigidBody_Static = API::Instance().AddCollisionSphere( rigidBodyRadius , rigidWorldRotation , rigidWorldPos , rigidBodyMass, 1,1,1);
}
// collision shape // collision shape
else if(staticObjData->boundingVolume.geoType == CollisionGeometryType_Sphere) if(staticObjData->boundingVolume.geoType == CollisionGeometryType_Sphere)
{ {
rigidBody_Static = InitRigidBodySphere(staticObjData); rigidBody_Static = InitRigidBodySphere(staticObjData);
} }

View File

@ -14,7 +14,7 @@
#include "PhysicsAPI.h" #include "PhysicsAPI.h"
#include "TeamManager.h" #include "TeamManager.h"
#include "DynamicArray.h" #include "DynamicArray.h"
#include "LevelLoader/LevelLoader.h" #include "LevelLoader.h"
namespace GameLogic namespace GameLogic
{ {

View File

@ -1,52 +0,0 @@
//////////////////////////////////
// Created by Sam Svensson 2013 //
//////////////////////////////////
#include "LevelLoader.h"
#include "LevelParser.h"
using namespace GameLogic;
using namespace GameLogic::LevelFileLoader;
struct LevelLoader::PrivData
{
LevelParser parser;
std::wstring folderPath;
};
LevelLoader::LevelLoader()
: pData(new PrivData)
{
//standard path
pData->folderPath = L"";
}
LevelLoader::LevelLoader(std::wstring folderPath)
: pData(new PrivData)
{
pData->folderPath = folderPath;
}
LevelLoader::~LevelLoader()
{
}
std::vector<Utility::DynamicMemory::SmartPointer<ObjectTypeHeader>> LevelLoader::LoadLevel(std::wstring fileName)
{
return pData->parser.Parse(pData->folderPath + fileName);
}
LevelMetaData LevelLoader::LoadLevelHeader(std::wstring fileName)
{
return pData->parser.ParseHeader(pData->folderPath + fileName);
}
std::wstring LevelLoader::GetFolderPath()
{
return this->pData->folderPath;
}
void LevelLoader::SetFolderPath(std::wstring folderPath)
{
this->pData->folderPath = folderPath;
}

View File

@ -1,56 +0,0 @@
//////////////////////////////////
// Created by Sam Svensson 2013 //
//////////////////////////////////
#ifndef LEVELLOADER_H
#define LEVELLOADER_H
#include <string>
#include <vector>
#include "Utilities.h"
#include "ObjectDefines.h"
namespace GameLogic
{
class LevelLoader
{
public:
LevelLoader();
/***********************************************************
* Lets you set the standard folderpath for the levels
********************************************************/
LevelLoader(std::wstring folderPath);
~LevelLoader();
/********************************************************
* Loads the level and objects from file.
* @param fileName: Path/name to the level-file that you want to load.
* @return: Returns all structs with objects and information about the level.
********************************************************/
std::vector<Utility::DynamicMemory::SmartPointer<ObjectTypeHeader>> LoadLevel(std::wstring fileName);
/********************************************************
* Just for fast access for the meta information about the level.
* @param fileName: Path to the level-file that you want to load.
* @return: Returns the meta information about the level.
********************************************************/
LevelMetaData LoadLevelHeader(std::wstring fileName); //.
/***********************************************************
* @return: Returns the current standard folder path
********************************************************/
std::wstring GetFolderPath();
/***********************************************************
* Sets the standard folder path
********************************************************/
void SetFolderPath(std::wstring folderPath);
private:
struct PrivData;
Utility::DynamicMemory::SmartPointer<PrivData> pData;
};
}
#endif

View File

@ -1,320 +0,0 @@
/////////////////////////////////////
// Created by Pontus Fransson 2013 //
/////////////////////////////////////
#include "LevelParser.h"
#include "Loader.h"
#include "ParseFunctions.h"
using namespace GameLogic;
using namespace ::LevelFileLoader;
using namespace Utility::DynamicMemory;
LevelParser::LevelParser()
{
formatVersion.formatVersionMajor = 3;
formatVersion.formatVersionMinor = 0;
}
LevelParser::~LevelParser()
{
}
std::vector<SmartPointer<ObjectTypeHeader>> LevelParser::Parse(std::wstring filename)
{
int bufferSize = 0;
int counter = 0;
bool loadCgf;
std::vector<SmartPointer<ObjectTypeHeader>> objects;
//Read entire level file.
Loader loader;
char* buffer = (char*)loader.LoadFile(filename.c_str(), bufferSize);
// Check if file was loaded, else return empty vector
if(!buffer)
{
return std::vector<SmartPointer<ObjectTypeHeader>>();
}
//Read format version
LevelLoaderInternal::FormatVersion levelFormatVersion;
ParseObject(&buffer[counter], &levelFormatVersion, sizeof(levelFormatVersion));
counter += sizeof(levelFormatVersion);
if(this->formatVersion != levelFormatVersion)
{
//Returns an empty vector, because it will most likely fail to read the level format.
return objects;
}
while(counter < bufferSize)
{
loadCgf = true;
//Get typeID
ObjectType typeID;
ParseObject(&buffer[counter], &typeID, sizeof(typeID));
switch((int)typeID)
{
case ObjectType_LevelMetaData:
{
SmartPointer<ObjectTypeHeader> header = new LevelMetaData;
ParseLevelMetaData(&buffer[counter], *(LevelMetaData*)header.Get(), counter);
objects.push_back(header);
break;
}
case ObjectType_SpawnPoint:
{
loadCgf = false;
ObjectHeader* header = new ObjectHeader;
ParseObject(&buffer[counter], *header, counter, loadCgf);
SpawnPointAttributes* spawn = new SpawnPointAttributes;
spawn->typeID = header->typeID;
for(int i = 0; i < 3; i++)
{
spawn->position[i] = header->position[i];
}
delete header;
//objects.push_back(header);
objects.push_back(spawn);
break;
}
//This is by design, static and dynamic is using the same converter. Do not add anything inbetween them.
//Unless they are changed to not be the same.
case ObjectType_Static: case ObjectType_Dynamic:
{
//Get specialType.
ObjectSpecialType specialType;
ParseObject(&buffer[counter+4], &specialType, sizeof(typeID));
switch(specialType)
{
//there is no difference when parsing these specialTypes.
case ObjectSpecialType_CrystalShard:
case ObjectSpecialType_CrystalFormation:
case ObjectSpecialType_Spike:
case ObjectSpecialType_SpikeBox:
case ObjectSpecialType_RedExplosiveBox:
case ObjectSpecialType_StandardBox:
case ObjectSpecialType_Stone:
case ObjectSpecialType_Building:
{
ObjectHeader* header = new ObjectHeader;
ParseObject(&buffer[counter], *header, counter, loadCgf);
objects.push_back(header);
break;
}
case ObjectSpecialType_JumpPad:
{
JumpPadAttributes* header = new JumpPadAttributes;
ParseObject(&buffer[counter], *header, counter, loadCgf);
//Read the spec
ParseObject(&buffer[counter], header->direction, 16);
counter += 16;
objects.push_back(header);
break;
}
case ObjectSpecialType_Portal:
{
PortalAttributes* header = new PortalAttributes;
ParseObject(&buffer[counter], *header, counter, loadCgf);
ParseObject(&buffer[counter], header->destination, 12);
counter += 12;
objects.push_back(header);
break;
}
case ObjectSpecialType_World:
{
WorldAttributes* header = new WorldAttributes;
ParseObject(&buffer[counter], *header, counter, loadCgf);
ParseObject(&buffer[counter], &header->worldSize, 8);
counter += 8;
objects.push_back(header);
break;
}
case ObjectSpecialType_Sky:
{
loadCgf = false;
SkyAttributes* header = new SkyAttributes;
ParseObject(&buffer[counter], *header, counter, loadCgf);
ParseObject(&buffer[counter], &header->skySize, 4);
counter += 4;
objects.push_back(header);
break;
}
default:
//Couldn't find specialType
break;
}
break;
}
case ObjectType_Light:
{
LightType lightType;
//Get Light type
ParseObject(&buffer[counter+4], &lightType, sizeof(lightType));
//We only support PointLight for now.
BasicLight* header = new BasicLight;
ParseObject(&buffer[counter], header, sizeof(*header));
counter += sizeof(*header);
objects.push_back(header);
/*switch(lightType)
{
case LightType_PointLight:
{
PointLight* header = new PointLight;
ParseObject(&buffer[counter], header, sizeof(*header));
counter += sizeof(*header);
objects.push_back(header);
break;
}
case LightType_DirectionalLight:
{
DirectionalLight* header = new DirectionalLight;
ParseObject(&buffer[counter], header, sizeof(*header));
counter += sizeof(*header);
objects.push_back(header);
break;
}
case LightType_SpotLight:
{
SpotLight* header = new SpotLight;
ParseObject(&buffer[counter], header, sizeof(*header));
counter += sizeof(*header);
objects.push_back(header);
break;
}
default:
//Undefined LightType.
break;
}
break;*/
}
default:
//Couldn't find typeID. FAIL!!!!!!
break;
}
}
return objects;
}
//för meta information om leveln.
LevelMetaData LevelParser::ParseHeader(std::wstring filename)
{
int bufferSize = 0;
int counter = 0;
LevelMetaData levelHeader;
levelHeader.typeID = ObjectType::ObjectType_Unknown;
//Read entire level file.
Loader loader;
char* buffer = (char*)loader.LoadFile(filename.c_str(), bufferSize);
//Read format version
LevelLoaderInternal::FormatVersion levelFormatVersion;
ParseObject(&buffer[counter], &levelFormatVersion, sizeof(formatVersion));
counter += sizeof(levelFormatVersion);
if(this->formatVersion != levelFormatVersion)
{
//Do something if it's not the same version
//Returns an empty levelHeader with ObjectType_Unknown.
//Because it will not be able to read another version of the level format.
return levelHeader;
}
//Find the header in the returned string.
while(counter < bufferSize)
{
ObjectType typeID;
ParseObject(&buffer[counter], &typeID, sizeof(typeID));
switch(typeID)
{
case ObjectType_LevelMetaData:
ParseLevelMetaData(&buffer[counter], levelHeader, counter);
return levelHeader;
break;
//This is by design, static and dynamic is using the same converter. Do not add anything inbetween them.
case ObjectType_Static: case ObjectType_Dynamic:
{
ObjectHeader header;
ParseObject(&buffer[counter], &header, counter);
switch(header.specialTypeID)
{
case ObjectSpecialType_JumpPad:
counter += sizeof(16);
break;
case ObjectSpecialType_Portal:
counter += sizeof(12);
break;
default:
break;
}
break;
}
case ObjectType_Light:
{
LightType lightType;
ParseObject(&buffer[counter+4], &lightType, sizeof(lightType));
//We only support pointlight for now.
counter += sizeof(BasicLight);
/*
switch(lightType)
{
case LightType_PointLight:
{
counter += sizeof(PointLight);
break;
}
case LightType_DirectionalLight:
{
counter += sizeof(DirectionalLight);
break;
}
case LightType_SpotLight:
{
counter += sizeof(SpotLight);
break;
}
default:
//Undefined LightType.
break;
}*/
}
default:
//Couldn't find typeID. FAIL!!!!!!
break;
}
}
return levelHeader;
}

View File

@ -1,31 +0,0 @@
#ifndef LEVEL_PARSER_H
#define LEVEL_PARSER_H
#include <string>
#include <vector>
#include "ObjectDefines.h"
#include "Utilities.h"
namespace GameLogic
{
namespace LevelFileLoader
{
class LevelParser
{
public:
LevelParser();
~LevelParser();
//
std::vector<Utility::DynamicMemory::SmartPointer<ObjectTypeHeader>> Parse(std::wstring filename);
//
LevelMetaData ParseHeader(std::wstring filename);
private:
LevelLoaderInternal::FormatVersion formatVersion;
};
}
}
#endif

View File

@ -1,22 +0,0 @@
//////////////////////////////////
// Created by Sam Svensson 2013 //
//////////////////////////////////
#include "Loader.h"
#include <fstream>
using namespace GameLogic::LevelFileLoader;
using namespace Oyster::Resource;
using namespace std;
char* Loader::LoadFile(std::wstring fileName, int &size)
{
//convert from string to wstring
//std::wstring temp(fileName.begin(), fileName.end());
//convert from wstring to wchar then loads the file
char* buffer = (char*)OysterResource::LoadResource(fileName.c_str(), Oyster::Resource::ResourceType::ResourceType_Byte_Raw, -1 , false);
size = OysterResource::GetResourceSize(buffer);
return buffer;
}

View File

@ -1,28 +0,0 @@
//////////////////////////////////
// Created by Sam Svensson 2013 //
//////////////////////////////////
#ifndef LOADER_H
#define LOADER_H
#include "Resource\OysterResource.h"
#include <string>
namespace GameLogic
{
namespace LevelFileLoader
{
class Loader
{
public:
Loader (){};
~Loader(){};
char* LoadFile(std::wstring fileName, int &size);
//TODO:
//Add functionality to load physicsObjects (hitboxes)
};
}
}
#endif;

View File

@ -1,290 +0,0 @@
#ifndef OBJECT_DEFINES_H
#define OBJECT_DEFINES_H
#include <string>
#include <vector>
namespace GameLogic
{
/************************************
Enums
*************************************/
enum ObjectType
{
ObjectType_LevelMetaData,
ObjectType_Static,
ObjectType_Dynamic,
ObjectType_Light,
ObjectType_SpawnPoint,
//Etc
ObjectType_NUM_OF_TYPES,
ObjectType_Unknown = -1
};
enum ObjectSpecialType
{
ObjectSpecialType_None,
ObjectSpecialType_Sky,
ObjectSpecialType_World, //Always the main celestial body
ObjectSpecialType_Building,
ObjectSpecialType_Stone,
ObjectSpecialType_StandardBox,
ObjectSpecialType_RedExplosiveBox,
ObjectSpecialType_SpikeBox,
ObjectSpecialType_Spike,
ObjectSpecialType_CrystalFormation,
ObjectSpecialType_CrystalShard,
ObjectSpecialType_JumpPad,
ObjectSpecialType_Portal,
ObjectSpecialType_Player,
ObjectSpecialType_Generic,
ObjectSpecialType_Count,
ObjectSpecialType_Unknown = -1
};
enum CollisionGeometryType
{
CollisionGeometryType_Box,
CollisionGeometryType_Sphere,
CollisionGeometryType_Cylinder,
CollisionGeometryType_TriangleMesh,
CollisionGeometryType_Count,
CollisionGeometryType_Unknown = -1
};
//Only supports Pointlight right now.
enum LightType
{
LightType_PointLight,
//LightType_DirectionalLight,
//LightType_SpotLight,
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
*************************************/
namespace LevelLoaderInternal
{
struct FormatVersion
{
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);
}
};
}
struct ObjectTypeHeader
{
ObjectType typeID;
//Unless this is here the object destructor wont be called.
virtual ~ObjectTypeHeader(){}
};
namespace LevelLoaderInternal
{
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;
};
struct BoundingVolumeTriangleMesh : public BoundingVolumeBase
{
//Null terminated
wchar_t* filename;
};
struct BoundingVolume
{
CollisionGeometryType geoType;
union
{
LevelLoaderInternal::BoundingVolumeBox box;
LevelLoaderInternal::BoundingVolumeSphere sphere;
LevelLoaderInternal::BoundingVolumeCylinder cylinder;
LevelLoaderInternal::BoundingVolumeTriangleMesh triangleMesh;
};
virtual ~BoundingVolume()
{
if(geoType == CollisionGeometryType_TriangleMesh)
{
delete[] triangleMesh.filename;
}
}
};
}
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;
virtual ~LevelMetaData(){}
};
struct ObjectHeader : public ObjectTypeHeader
{
//Special type id for special objects: portal, jumppad, exploding objects, etc.
ObjectSpecialType specialTypeID;
//Model,
std::string ModelFile;
//Position
float position[3];
//Rotation Quaternion
float rotation[4];
//Scale
float scale[3];
::GameLogic::LevelLoaderInternal::BoundingVolume boundingVolume;
virtual ~ObjectHeader(){}
};
struct SpawnPointAttributes : public ObjectTypeHeader
{
ObjectSpecialType specialTypeID;
float position[3];
};
/************************************
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;
};
/************************************
Lights
*************************************/
struct BasicLight : public ObjectTypeHeader
{
LightType lightType; //Is not used right now
float color[3];
float position[3];
float raduis;
float intensity;
};
/* We only support pointlight right now.
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];
};*/
}
#endif

View File

@ -1,195 +0,0 @@
//////////////////////////////////
// Created by Sam Svensson 2013 //
//////////////////////////////////
#include "ParseFunctions.h"
#include "Packing/Packing.h"
#include "Loader.h"
#include "Utilities.h"
#include <string>
using namespace Oyster::Packing;
using namespace GameLogic::LevelFileLoader;
using namespace GameLogic;
using namespace std;
namespace GameLogic
{
namespace LevelFileLoader
{
//can parse any struct if the struct doesnt contain strings or char[]
void ParseObject(char* buffer, void *header, int size)
{
memcpy(header, buffer, size);
}
void ParseObject(char* buffer, ObjectHeader& header, int& size, bool loadCgf)
{
char tempName[128];
unsigned int tempSize = 0;
int start = 0;
memcpy(&header.typeID, &buffer[start], 4);
start += 4;
memcpy(&header.specialTypeID, &buffer[start], 4);
start += 4;
memcpy(&tempSize, &buffer[start], 4);
start += 4;
memcpy(&tempName, &buffer[start], tempSize);
header.ModelFile.assign(&tempName[0], &tempName[tempSize]);
start += tempSize;
//The reset of the object struct
//3 float[3], 1 float
memcpy(&header.position, &buffer[start], 40);
start += 40;
//if loadCgf : Read path for bounding volume
if(loadCgf)
{
ParseBoundingVolume(&buffer[start], header.boundingVolume, start);
}
//else make sure the counter counts the name so we can jump over the string in the buffer.
else
{
memcpy(&tempSize, &buffer[start], 4);
start += 4;
memcpy(&tempName, &buffer[start], tempSize);
string fileName;
fileName.assign(&tempName[0], &tempName[tempSize]);
start += tempSize;
}
size += start;
}
void ParseLevelMetaData(char* buffer, LevelMetaData &header, int &size)
{
int start = 0;
unsigned int tempSize;
char tempName[128];
memcpy(&header.typeID, &buffer[start], 4);
start += 4;
memcpy(&tempSize , &buffer[start], 4);
start += 4;
memcpy(&tempName, &buffer[start], tempSize);
header.levelName.assign(&tempName[0], &tempName[tempSize]);
start += tempSize;
memcpy(&header.levelVersion, &buffer[start], 4);
start += 4;
memcpy(&tempSize, &buffer[start], 4);
start +=4;
memcpy(&tempName, &buffer[start], tempSize);
header.levelDescription.assign(&tempName[0], &tempName[tempSize]);
start += tempSize;
memcpy(&tempSize, &buffer[start], 4);
start += 4;
memcpy(&tempName, &buffer[start], tempSize);
header.levelAuthor.assign(&tempName[0], &tempName[tempSize]);
start += tempSize;
memcpy(&header.maxNumberOfPlayer, &buffer[start], 4);
start += 4;
memcpy(&header.worldSize, &buffer[start], 4);
start += 4;
memcpy(&tempSize, &buffer[start], 4);
start += 4;
memcpy(&tempName, &buffer[start], tempSize);
header.overviewPicturePath.assign(&tempName[0], &tempName[tempSize]);
start += tempSize;
memcpy(&tempSize, &buffer[start], 4);
start += 4;
int temp;
for(int i = 0; i < (int)tempSize; i++)
{
memcpy(&temp, &buffer[start], 4);
start += 4;
header.gameModesSupported.push_back((GameMode)temp);
}
size += start;
}
void ParseBoundingVolume(char* buffer, LevelLoaderInternal::BoundingVolume& volume, int &size)
{
int start = 0;
int tempSize = 0;
char tempName[128];
memcpy(&tempSize, &buffer[start], 4);
start += 4;
memcpy(&tempName, &buffer[start], tempSize);
string fileName;
fileName.assign(&tempName[0], &tempName[tempSize]);
start += tempSize;
size += start;
//Läs in filen.
int fileLength = 0;
Loader loader;
char* buf = loader.LoadFile(L"../Content/Worlds/cgf/" + Utility::String::StringToWstring(fileName, wstring()), fileLength);
start = 0;
LevelLoaderInternal::FormatVersion version;
memcpy(&version, &buf[0], sizeof(version));
start += 8;
memcpy(&volume.geoType, &buf[start], sizeof(volume.geoType));
switch(volume.geoType)
{
case CollisionGeometryType_Box:
memcpy(&volume.box, &buf[start], sizeof(volume.box));
start += sizeof(volume.box);
break;
case CollisionGeometryType_Sphere:
memcpy(&volume.sphere, &buf[start], sizeof(volume.sphere));
start += sizeof(volume.sphere);
break;
case CollisionGeometryType_Cylinder:
memcpy(&volume.cylinder, &buf[start], sizeof(volume.cylinder));
start += sizeof(volume.cylinder);
break;
case CollisionGeometryType_TriangleMesh:
//Get string size
memcpy(&tempSize, &buf[start], sizeof(tempSize));
start += sizeof(tempSize);
//Get actual string
volume.triangleMesh.filename = new wchar_t[tempSize+1];
memcpy(volume.triangleMesh.filename, &buf[start], tempSize);
volume.triangleMesh.filename[tempSize] = '\0';
break;
default:
break;
}
}
}
}

View File

@ -1,28 +0,0 @@
//////////////////////////////////
// Created by Sam Svensson 2013 //
//////////////////////////////////
#ifndef PARSERFUNCTIONS_H
#define PARSERFUNCTIONS_H
#include "ObjectDefines.h"
namespace GameLogic
{
namespace LevelFileLoader
{
/*
These functions will copy data from where the buffer pointer points.
header is the destination where the data will be copied.
size is either the size of the data to be copied (if it is NOT sent by reference).
Or the current index that is being used to parse the entire file (if it is sent by reference) this means you have to increase size with the appropiate size after you have copied.
*/
void ParseObject(char* buffer, void *header, int size);
void ParseObject(char* buffer, ObjectHeader& header, int& size , bool loadCgf);
void ParseLevelMetaData(char* buffer, LevelMetaData &header, int &size);
void ParseBoundingVolume(char* buffer, LevelLoaderInternal::BoundingVolume& volume, int &size);
}
}
#endif

View File

@ -48,5 +48,5 @@ std::string LevelLoader::GetFolderPath()
void LevelLoader::SetFolderPath(std::string folderPath) void LevelLoader::SetFolderPath(std::string folderPath)
{ {
this->pData->folderPath = folderPath;
} }

View File

@ -0,0 +1,165 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{6391E709-D9FA-4FEF-A3B9-4343DB5A0C63}</ProjectGuid>
<RootNamespace>LevelLoader</RootNamespace>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v110</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v110</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v110</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v110</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<OutDir>$(SolutionDir)..\External\Lib\$(ProjectName)\</OutDir>
<TargetName>$(ProjectName)_$(PlatformShortName)D</TargetName>
<IntDir>$(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<OutDir>$(SolutionDir)..\External\Lib\$(ProjectName)\</OutDir>
<TargetName>$(ProjectName)_$(PlatformShortName)</TargetName>
<IntDir>$(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<OutDir>$(SolutionDir)..\External\Lib\$(ProjectName)\</OutDir>
<TargetName>$(ProjectName)_$(PlatformShortName)D</TargetName>
<IntDir>$(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<OutDir>$(SolutionDir)..\External\Lib\$(ProjectName)\</OutDir>
<TargetName>$(ProjectName)_$(PlatformShortName)</TargetName>
<IntDir>$(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\</IntDir>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<SDLCheck>true</SDLCheck>
<AdditionalIncludeDirectories>$(SolutionDir)Misc\Utilities;</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<SDLCheck>true</SDLCheck>
<AdditionalIncludeDirectories>$(SolutionDir)Misc\Utilities;</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<AdditionalIncludeDirectories>$(SolutionDir)Misc\Utilities;</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
<Lib>
<AdditionalDependencies>
</AdditionalDependencies>
</Lib>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<AdditionalIncludeDirectories>$(SolutionDir)Misc\Utilities;</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="LevelLoader.cpp" />
<ClCompile Include="LevelParser.cpp" />
<ClCompile Include="Loader.cpp" />
<ClCompile Include="ParseFunctions.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="LevelLoader.h" />
<ClInclude Include="LevelParser.h" />
<ClInclude Include="Loader.h" />
<ClInclude Include="ObjectDefines.h" />
<ClInclude Include="ParseFunctions.h" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Misc\Utilities\Utilities.vcxproj">
<Project>{2ec4dded-8f75-4c86-a10b-e1e8eb29f3ee}</Project>
</ProjectReference>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ShowAllFiles>true</ShowAllFiles>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LocalDebuggerWorkingDirectory>$(OutDir)</LocalDebuggerWorkingDirectory>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LocalDebuggerWorkingDirectory>$(OutDir)</LocalDebuggerWorkingDirectory>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LocalDebuggerWorkingDirectory>$(OutDir)</LocalDebuggerWorkingDirectory>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LocalDebuggerWorkingDirectory>$(OutDir)</LocalDebuggerWorkingDirectory>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
</PropertyGroup>
</Project>

View File

@ -98,7 +98,7 @@ std::vector<SmartPointer<ObjectTypeHeader>> LevelParser::Parse(std::string filen
case ObjectSpecialType_Spike: case ObjectSpecialType_Spike:
case ObjectSpecialType_SpikeBox: case ObjectSpecialType_SpikeBox:
case ObjectSpecialType_RedExplosiveBox: case ObjectSpecialType_RedExplosiveBox:
case ObjectSpecialType_StandarsBox: case ObjectSpecialType_StandardBox:
case ObjectSpecialType_Stone: case ObjectSpecialType_Stone:
case ObjectSpecialType_Building: case ObjectSpecialType_Building:
{ {

View File

@ -31,7 +31,7 @@ namespace GameLogic
ObjectSpecialType_World, //Always the main celestial body ObjectSpecialType_World, //Always the main celestial body
ObjectSpecialType_Building, ObjectSpecialType_Building,
ObjectSpecialType_Stone, ObjectSpecialType_Stone,
ObjectSpecialType_StandarsBox, ObjectSpecialType_StandardBox,
ObjectSpecialType_RedExplosiveBox, ObjectSpecialType_RedExplosiveBox,
ObjectSpecialType_SpikeBox, ObjectSpecialType_SpikeBox,
ObjectSpecialType_Spike, ObjectSpecialType_Spike,
@ -40,6 +40,7 @@ namespace GameLogic
ObjectSpecialType_JumpPad, ObjectSpecialType_JumpPad,
ObjectSpecialType_Portal, ObjectSpecialType_Portal,
ObjectSpecialType_Player, ObjectSpecialType_Player,
ObjectSpecialType_Generic,
ObjectSpecialType_Count, ObjectSpecialType_Count,

View File

@ -117,7 +117,7 @@ namespace GameLogic
int temp; int temp;
for(int i = 0; i < tempSize; i++) for(int i = 0; i < (int)tempSize; i++)
{ {
memcpy(&temp, &buffer[start], 4); memcpy(&temp, &buffer[start], 4);
start += 4; start += 4;

View File

@ -319,7 +319,23 @@ bool NetworkClient::Connect(unsigned short port, std::wstring serverIP)
bool NetworkClient::Reconnect() bool NetworkClient::Reconnect()
{ {
return this->privateData->connection.Reconnect(); if(this->IsConnected())
return false;
//if(this->privateData)
//return false;
if(!this->privateData) this->privateData = new PrivateData();
int result = this->privateData->connection.Reconnect();
if(result != 0)
{
return false;
}
this->privateData->owner = 0;
this->privateData->parent = this;
this->privateData->thread.Start();
return true;
} }
void NetworkClient::Disconnect() void NetworkClient::Disconnect()

View File

@ -24,6 +24,8 @@ namespace Oyster
Model::Model* sphere; Model::Model* sphere;
ID3D11RasterizerState* wire; ID3D11RasterizerState* wire;
ID3D11ShaderResourceView* debugSRV;
#endif #endif
} }
@ -50,8 +52,15 @@ namespace Oyster
Render::Preparations::Basic::SetViewPort(); Render::Preparations::Basic::SetViewPort();
#ifdef _DEBUG #ifdef _DEBUG
//fix load model //fix load model
cube = CreateModel(L"debug_cube.dan");
sphere = CreateModel(L"debug_sphere.dan"); debugSRV = (ID3D11ShaderResourceView*)API::CreateTexture(L"color_white.png");
debugSRV = (ID3D11ShaderResourceView*)API::CreateTexture(L"color_white.png");
cube = CreateModel(L"generic_cube.dan");
cube->Tint = Math::Float3(0.0f,0.0f,1.0f);
sphere = CreateModel(L"generic_sphere.dan");
sphere->Tint = Math::Float3(1.0f,0.5f,182/255.0f);
D3D11_RASTERIZER_DESC desc; D3D11_RASTERIZER_DESC desc;
desc.CullMode = D3D11_CULL_BACK; desc.CullMode = D3D11_CULL_BACK;
@ -196,6 +205,7 @@ namespace Oyster
void API::StartRenderWireFrame() void API::StartRenderWireFrame()
{ {
Core::deviceContext->OMSetRenderTargets(Render::Resources::Gather::Pass.RTV.size(),&Render::Resources::Gather::Pass.RTV[0],NULL);
Core::deviceContext->RSSetState(wire); Core::deviceContext->RSSetState(wire);
Core::deviceContext->OMSetRenderTargets(Render::Resources::Gather::Pass.RTV.size(),&Render::Resources::Gather::Pass.RTV[0],NULL); Core::deviceContext->OMSetRenderTargets(Render::Resources::Gather::Pass.RTV.size(),&Render::Resources::Gather::Pass.RTV[0],NULL);
} }

View File

@ -700,7 +700,7 @@ static HRESULT CreateTextureFromWIC( _In_ ID3D11Device* d3dDevice,
return hr; return hr;
} }
//todo check calc //todo check calc
int TexSize = twidth * theight * bpp; int TexSize = twidth * theight * (int)bpp;
Oyster::Graphics::Core::UsedMem += TexSize; Oyster::Graphics::Core::UsedMem += TexSize;
if ( autogen ) if ( autogen )

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup> <PropertyGroup>
<ShowAllFiles>false</ShowAllFiles> <ShowAllFiles>true</ShowAllFiles>
</PropertyGroup> </PropertyGroup>
</Project> </Project>