From bd6b531418f951970e6fcd45d79cd170f306170e Mon Sep 17 00:00:00 2001 From: Erik Persson Date: Thu, 13 Feb 2014 09:58:14 +0100 Subject: [PATCH] GL - added Portal and started on crystalformation --- Code/DanBias.sln | 31 +++++++++---------- Code/Game/GameLogic/AttatchmentMassDriver.cpp | 19 ++++-------- Code/Game/GameLogic/CollisionManager.cpp | 16 ++++++++++ Code/Game/GameLogic/CrystalFormation.cpp | 20 ++++++++++++ Code/Game/GameLogic/CrystalFormation.h | 21 +++++++++++++ Code/Game/GameLogic/GameLogic.vcxproj | 2 ++ Code/Game/GameLogic/Portal.cpp | 22 +++++++++++++ Code/Game/GameLogic/Portal.h | 23 ++++++++++++++ 8 files changed, 125 insertions(+), 29 deletions(-) create mode 100644 Code/Game/GameLogic/CrystalFormation.cpp create mode 100644 Code/Game/GameLogic/CrystalFormation.h create mode 100644 Code/Game/GameLogic/Portal.cpp create mode 100644 Code/Game/GameLogic/Portal.h diff --git a/Code/DanBias.sln b/Code/DanBias.sln index f2bf5f98..4d512dff 100644 --- a/Code/DanBias.sln +++ b/Code/DanBias.sln @@ -68,8 +68,8 @@ Global {0EC83E64-230E-48EF-B08C-6AC9651B4F82}.Debug|Win32.ActiveCfg = Debug|Win32 {0EC83E64-230E-48EF-B08C-6AC9651B4F82}.Debug|Win32.Build.0 = Debug|Win32 {0EC83E64-230E-48EF-B08C-6AC9651B4F82}.Debug|Win32.Deploy.0 = Debug|Win32 - {0EC83E64-230E-48EF-B08C-6AC9651B4F82}.Debug|x64.ActiveCfg = Release|x64 - {0EC83E64-230E-48EF-B08C-6AC9651B4F82}.Debug|x64.Build.0 = Release|x64 + {0EC83E64-230E-48EF-B08C-6AC9651B4F82}.Debug|x64.ActiveCfg = Debug|x64 + {0EC83E64-230E-48EF-B08C-6AC9651B4F82}.Debug|x64.Build.0 = Debug|x64 {0EC83E64-230E-48EF-B08C-6AC9651B4F82}.MinSizeRel|Mixed Platforms.ActiveCfg = Release|Win32 {0EC83E64-230E-48EF-B08C-6AC9651B4F82}.MinSizeRel|Mixed Platforms.Build.0 = Release|Win32 {0EC83E64-230E-48EF-B08C-6AC9651B4F82}.MinSizeRel|Win32.ActiveCfg = Release|Win32 @@ -93,8 +93,8 @@ Global {F10CBC03-9809-4CBA-95D8-327C287B18EE}.Debug|Win32.ActiveCfg = Debug|Win32 {F10CBC03-9809-4CBA-95D8-327C287B18EE}.Debug|Win32.Build.0 = Debug|Win32 {F10CBC03-9809-4CBA-95D8-327C287B18EE}.Debug|Win32.Deploy.0 = Debug|Win32 - {F10CBC03-9809-4CBA-95D8-327C287B18EE}.Debug|x64.ActiveCfg = Release|x64 - {F10CBC03-9809-4CBA-95D8-327C287B18EE}.Debug|x64.Build.0 = Release|x64 + {F10CBC03-9809-4CBA-95D8-327C287B18EE}.Debug|x64.ActiveCfg = Debug|x64 + {F10CBC03-9809-4CBA-95D8-327C287B18EE}.Debug|x64.Build.0 = Debug|x64 {F10CBC03-9809-4CBA-95D8-327C287B18EE}.MinSizeRel|Mixed Platforms.ActiveCfg = Release|Win32 {F10CBC03-9809-4CBA-95D8-327C287B18EE}.MinSizeRel|Mixed Platforms.Build.0 = Release|Win32 {F10CBC03-9809-4CBA-95D8-327C287B18EE}.MinSizeRel|Win32.ActiveCfg = Release|Win32 @@ -113,13 +113,13 @@ Global {F10CBC03-9809-4CBA-95D8-327C287B18EE}.RelWithDebInfo|Win32.Build.0 = Release|Win32 {F10CBC03-9809-4CBA-95D8-327C287B18EE}.RelWithDebInfo|x64.ActiveCfg = Release|x64 {F10CBC03-9809-4CBA-95D8-327C287B18EE}.RelWithDebInfo|x64.Build.0 = Release|x64 - {2EC4DDED-8F75-4C86-A10B-E1E8EB29F3EE}.Debug|Mixed Platforms.ActiveCfg = Release|x64 - {2EC4DDED-8F75-4C86-A10B-E1E8EB29F3EE}.Debug|Mixed Platforms.Build.0 = Release|x64 + {2EC4DDED-8F75-4C86-A10B-E1E8EB29F3EE}.Debug|Mixed Platforms.ActiveCfg = Debug|x64 + {2EC4DDED-8F75-4C86-A10B-E1E8EB29F3EE}.Debug|Mixed Platforms.Build.0 = Debug|x64 {2EC4DDED-8F75-4C86-A10B-E1E8EB29F3EE}.Debug|Win32.ActiveCfg = Debug|Win32 {2EC4DDED-8F75-4C86-A10B-E1E8EB29F3EE}.Debug|Win32.Build.0 = Debug|Win32 {2EC4DDED-8F75-4C86-A10B-E1E8EB29F3EE}.Debug|Win32.Deploy.0 = Debug|Win32 - {2EC4DDED-8F75-4C86-A10B-E1E8EB29F3EE}.Debug|x64.ActiveCfg = Release|x64 - {2EC4DDED-8F75-4C86-A10B-E1E8EB29F3EE}.Debug|x64.Build.0 = Release|x64 + {2EC4DDED-8F75-4C86-A10B-E1E8EB29F3EE}.Debug|x64.ActiveCfg = Debug|x64 + {2EC4DDED-8F75-4C86-A10B-E1E8EB29F3EE}.Debug|x64.Build.0 = Debug|x64 {2EC4DDED-8F75-4C86-A10B-E1E8EB29F3EE}.MinSizeRel|Mixed Platforms.ActiveCfg = Release|Win32 {2EC4DDED-8F75-4C86-A10B-E1E8EB29F3EE}.MinSizeRel|Mixed Platforms.Build.0 = Release|Win32 {2EC4DDED-8F75-4C86-A10B-E1E8EB29F3EE}.MinSizeRel|Win32.ActiveCfg = Release|Win32 @@ -174,8 +174,8 @@ Global {6A066806-F43F-4B31-A4E3-57179674F460}.RelWithDebInfo|Mixed Platforms.ActiveCfg = Release|Win32 {6A066806-F43F-4B31-A4E3-57179674F460}.RelWithDebInfo|Win32.ActiveCfg = Release|Win32 {6A066806-F43F-4B31-A4E3-57179674F460}.RelWithDebInfo|x64.ActiveCfg = Release|x64 - {C5AA09D0-6594-4CD3-BD92-1D380C7B3B50}.Debug|Mixed Platforms.ActiveCfg = Release|x64 - {C5AA09D0-6594-4CD3-BD92-1D380C7B3B50}.Debug|Mixed Platforms.Build.0 = Release|x64 + {C5AA09D0-6594-4CD3-BD92-1D380C7B3B50}.Debug|Mixed Platforms.ActiveCfg = Debug|x64 + {C5AA09D0-6594-4CD3-BD92-1D380C7B3B50}.Debug|Mixed Platforms.Build.0 = Debug|x64 {C5AA09D0-6594-4CD3-BD92-1D380C7B3B50}.Debug|Win32.ActiveCfg = Debug|Win32 {C5AA09D0-6594-4CD3-BD92-1D380C7B3B50}.Debug|Win32.Build.0 = Debug|Win32 {C5AA09D0-6594-4CD3-BD92-1D380C7B3B50}.Debug|x64.ActiveCfg = Release|x64 @@ -196,20 +196,19 @@ Global {1B3BEA4C-CF75-438A-9693-60FB8444BBF3}.Debug|Mixed Platforms.Build.0 = Release|Win32 {1B3BEA4C-CF75-438A-9693-60FB8444BBF3}.Debug|Win32.ActiveCfg = Debug|Win32 {1B3BEA4C-CF75-438A-9693-60FB8444BBF3}.Debug|Win32.Build.0 = Debug|Win32 - {1B3BEA4C-CF75-438A-9693-60FB8444BBF3}.Debug|x64.ActiveCfg = Release|Win32 - {1B3BEA4C-CF75-438A-9693-60FB8444BBF3}.Debug|x64.Build.0 = Release|Win32 + {1B3BEA4C-CF75-438A-9693-60FB8444BBF3}.Debug|x64.ActiveCfg = Debug|x64 + {1B3BEA4C-CF75-438A-9693-60FB8444BBF3}.Debug|x64.Build.0 = Debug|x64 {1B3BEA4C-CF75-438A-9693-60FB8444BBF3}.MinSizeRel|Mixed Platforms.ActiveCfg = Debug|Win32 {1B3BEA4C-CF75-438A-9693-60FB8444BBF3}.MinSizeRel|Win32.ActiveCfg = Debug|Win32 {1B3BEA4C-CF75-438A-9693-60FB8444BBF3}.MinSizeRel|x64.ActiveCfg = Debug|Win32 {1B3BEA4C-CF75-438A-9693-60FB8444BBF3}.Release|Mixed Platforms.ActiveCfg = Release|Win32 {1B3BEA4C-CF75-438A-9693-60FB8444BBF3}.Release|Mixed Platforms.Build.0 = Release|Win32 {1B3BEA4C-CF75-438A-9693-60FB8444BBF3}.Release|Win32.ActiveCfg = Release|Win32 - {1B3BEA4C-CF75-438A-9693-60FB8444BBF3}.Release|Win32.Build.0 = Release|Win32 - {1B3BEA4C-CF75-438A-9693-60FB8444BBF3}.Release|x64.ActiveCfg = Release|Win32 - {1B3BEA4C-CF75-438A-9693-60FB8444BBF3}.Release|x64.Build.0 = Release|Win32 + {1B3BEA4C-CF75-438A-9693-60FB8444BBF3}.Release|x64.ActiveCfg = Release|x64 + {1B3BEA4C-CF75-438A-9693-60FB8444BBF3}.Release|x64.Build.0 = Release|x64 {1B3BEA4C-CF75-438A-9693-60FB8444BBF3}.RelWithDebInfo|Mixed Platforms.ActiveCfg = Release|Win32 {1B3BEA4C-CF75-438A-9693-60FB8444BBF3}.RelWithDebInfo|Win32.ActiveCfg = Release|Win32 - {1B3BEA4C-CF75-438A-9693-60FB8444BBF3}.RelWithDebInfo|x64.ActiveCfg = Release|Win32 + {1B3BEA4C-CF75-438A-9693-60FB8444BBF3}.RelWithDebInfo|x64.ActiveCfg = Release|x64 {666FEA52-975F-41CD-B224-B19AF3C0ABBA}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32 {666FEA52-975F-41CD-B224-B19AF3C0ABBA}.Debug|Mixed Platforms.Build.0 = Debug|Win32 {666FEA52-975F-41CD-B224-B19AF3C0ABBA}.Debug|Win32.ActiveCfg = Debug|Win32 diff --git a/Code/Game/GameLogic/AttatchmentMassDriver.cpp b/Code/Game/GameLogic/AttatchmentMassDriver.cpp index 1e5d0640..86560164 100644 --- a/Code/Game/GameLogic/AttatchmentMassDriver.cpp +++ b/Code/Game/GameLogic/AttatchmentMassDriver.cpp @@ -38,18 +38,14 @@ void AttatchmentMassDriver::UseAttatchment(const GameLogic::WEAPON_FIRE &usage, case WEAPON_FIRE::WEAPON_USE_PRIMARY_PRESS: ForcePush(usage,dt); break; + case WEAPON_FIRE::WEAPON_USE_SECONDARY_PRESS: - - if(hasObject) - { - //ForcePush(usage,dt);//WARNING THIS IS A CRAP TEST TO MAKE SURE YOU CAN SHOOT BOXES - break; - } ForcePull(usage,dt); - break; + break; + case WEAPON_FIRE::WEAPON_USE_UTILLITY_PRESS: ForceZip(usage,dt); - break; + break; } } @@ -117,12 +113,9 @@ void AttatchmentMassDriver::ForcePush(const GameLogic::WEAPON_FIRE &usage, float ********************************************************/ void AttatchmentMassDriver::ForceZip(const WEAPON_FIRE &usage, float dt) { - Oyster::Physics::Struct::CustomBodyState state = this->owner->GetRigidBody()->GetState(); + Oyster::Math::Float3 force = Oyster::Math::Float4(this->owner->GetLookDir()) * (1000); - //do something with state - //state.ApplyLinearImpulse(Oyster::Math::Float3(this->owner->GetLookDir()) * (500 * dt)); - - this->owner->GetRigidBody()->SetState(state); + this->owner->GetRigidBody()->ApplyImpulse(force); } diff --git a/Code/Game/GameLogic/CollisionManager.cpp b/Code/Game/GameLogic/CollisionManager.cpp index 9aef6b6c..857c135c 100644 --- a/Code/Game/GameLogic/CollisionManager.cpp +++ b/Code/Game/GameLogic/CollisionManager.cpp @@ -7,6 +7,7 @@ #include "Game.h" #include "CollisionManager.h" #include "JumpPad.h" +#include "Portal.h" using namespace Oyster; @@ -14,6 +15,7 @@ using namespace GameLogic; void PlayerVObject(Player &player, Object &obj, Oyster::Math::Float kineticEnergyLoss); void SendObjectFlying(Oyster::Physics::ICustomBody &obj, Oyster::Math::Float3 force); + void Teleport(Oyster::Physics::ICustomBody &obj, Oyster::Math::Float3 target); //Physics::ICustomBody::SubscriptMessage void Player::PlayerCollision(Oyster::Physics::ICustomBody *rigidBodyPlayer, Oyster::Physics::ICustomBody *obj, Oyster::Math::Float kineticEnergyLoss) @@ -63,6 +65,20 @@ using namespace GameLogic; { obj.ApplyImpulse(force); } + + void Portal::PortalActivated(Oyster::Physics::ICustomBody *rigidBodyPortal, Oyster::Physics::ICustomBody *obj, Oyster::Math::Float kineticEnergyLoss) + { + Portal *portal = (Portal*)(rigidBodyPortal->GetCustomTag()); + + if(obj->GetState().mass == 0) return; + + Teleport(*obj,portal->portalExit); + } + + void Teleport(Oyster::Physics::ICustomBody &obj, Oyster::Math::Float3 target) + { + obj.SetPosition(target); + } void PlayerVObject(Player &player, Object &obj, Oyster::Math::Float kineticEnergyLoss) diff --git a/Code/Game/GameLogic/CrystalFormation.cpp b/Code/Game/GameLogic/CrystalFormation.cpp new file mode 100644 index 00000000..00709660 --- /dev/null +++ b/Code/Game/GameLogic/CrystalFormation.cpp @@ -0,0 +1,20 @@ +#include "CrystalFormation.h" + +using namespace GameLogic; + +CrystalFormation::CrystalFormation(void) + :StaticObject() +{ + this->shreddingDamage = 0; +} + +CrystalFormation::CrystalFormation(Oyster::Physics::ICustomBody *rigidBody, void (*collisionFuncAfter)(Oyster::Physics::ICustomBody *proto,Oyster::Physics::ICustomBody *deuter,Oyster::Math::Float kineticEnergyLoss), OBJECT_TYPE type, Oyster::Math::Float shreddingDamage) + :StaticObject(rigidBody, collisionFuncAfter, type) +{ + this->shreddingDamage = shreddingDamage; +} + + +CrystalFormation::~CrystalFormation(void) +{ +} diff --git a/Code/Game/GameLogic/CrystalFormation.h b/Code/Game/GameLogic/CrystalFormation.h new file mode 100644 index 00000000..693460fe --- /dev/null +++ b/Code/Game/GameLogic/CrystalFormation.h @@ -0,0 +1,21 @@ +#ifndef CRYSTALFORMATION_H +#define CRYSTALFORMATION_H +#include "StaticObject.h" +namespace GameLogic +{ + class CrystalFormation : public StaticObject + { + public: + CrystalFormation(void); + + CrystalFormation(Oyster::Physics::ICustomBody *rigidBody + ,void (*collisionFuncAfter)(Oyster::Physics::ICustomBody *proto,Oyster::Physics::ICustomBody *deuter,Oyster::Math::Float kineticEnergyLoss) + ,OBJECT_TYPE type, Oyster::Math::Float shreddingDamage); + + ~CrystalFormation(void); + + private: + Oyster::Math::Float shreddingDamage; + }; +} +#endif \ No newline at end of file diff --git a/Code/Game/GameLogic/GameLogic.vcxproj b/Code/Game/GameLogic/GameLogic.vcxproj index 7ae78fac..b19ffef0 100644 --- a/Code/Game/GameLogic/GameLogic.vcxproj +++ b/Code/Game/GameLogic/GameLogic.vcxproj @@ -192,6 +192,7 @@ + @@ -215,6 +216,7 @@ + diff --git a/Code/Game/GameLogic/Portal.cpp b/Code/Game/GameLogic/Portal.cpp new file mode 100644 index 00000000..ac44d529 --- /dev/null +++ b/Code/Game/GameLogic/Portal.cpp @@ -0,0 +1,22 @@ +#include "Portal.h" + +using namespace GameLogic; +using namespace Oyster::Math; + +Portal::Portal(void) + :StaticObject() +{ + this->portalExit = Float3(0,0,0); +} + +Portal::Portal(Oyster::Physics::ICustomBody *rigidBody, void (*collisionFuncAfter)(Oyster::Physics::ICustomBody *proto,Oyster::Physics::ICustomBody *deuter,Oyster::Math::Float kineticEnergyLoss), OBJECT_TYPE type, Oyster::Math::Float3 portalExit) + :StaticObject(rigidBody, collisionFuncAfter, type) +{ + this->portalExit = portalExit; +} + +Portal::~Portal(void) +{ + +} + diff --git a/Code/Game/GameLogic/Portal.h b/Code/Game/GameLogic/Portal.h new file mode 100644 index 00000000..5b31c8b5 --- /dev/null +++ b/Code/Game/GameLogic/Portal.h @@ -0,0 +1,23 @@ +#ifndef PORTAL_H +#define PORTAL_H +#include "StaticObject.h" +namespace GameLogic +{ + class Portal : public StaticObject + { + public: + Portal(void); + + Portal(Oyster::Physics::ICustomBody *rigidBody + ,void (*collisionFuncAfter)(Oyster::Physics::ICustomBody *proto,Oyster::Physics::ICustomBody *deuter,Oyster::Math::Float kineticEnergyLoss) + ,OBJECT_TYPE type, Oyster::Math::Float3 portalExit); + + ~Portal(void); + + static void PortalActivated(Oyster::Physics::ICustomBody *rigidBodyPortal, Oyster::Physics::ICustomBody *obj, Oyster::Math::Float kineticEnergyLoss); + + private: + Oyster::Math::Float3 portalExit; + }; +} +#endif \ No newline at end of file