Merge remote-tracking branch 'origin/GameLogic' into Camera-Merge-buffer
Conflicts: Code/Game/DanBiasGame/DanBiasGame_Impl.cpp Code/Game/DanBiasGame/GameClientState/GameState.cpp
This commit is contained in:
commit
14661a86f8
|
@ -21,16 +21,20 @@ namespace DanBias
|
||||||
ButtonEllipse()
|
ButtonEllipse()
|
||||||
: EventButtonGUI(), radius(0)
|
: EventButtonGUI(), radius(0)
|
||||||
{}
|
{}
|
||||||
ButtonEllipse(std::wstring textureName, std::wstring buttonText, Oyster::Math::Float3 textColor, Owner owner, Oyster::Math::Float3 pos, Oyster::Math::Float2 size, ResizeAspectRatio resize = ResizeAspectRatio_Height)
|
ButtonEllipse(std::wstring textureName, std::wstring buttonText, Oyster::Math::Float3 textColor, Owner owner, Oyster::Math::Float3 pos,
|
||||||
|
Oyster::Math::Float2 size, ResizeAspectRatio resize = ResizeAspectRatio_Height)
|
||||||
: EventButtonGUI(textureName, buttonText, textColor, owner, pos, size, resize)
|
: EventButtonGUI(textureName, buttonText, textColor, owner, pos, size, resize)
|
||||||
{}
|
{}
|
||||||
ButtonEllipse(std::wstring textureName, std::wstring buttonText, Oyster::Math::Float3 textColor, EventFunc func, Oyster::Math::Float3 pos, Oyster::Math::Float2 size, ResizeAspectRatio resize = ResizeAspectRatio_Height)
|
ButtonEllipse(std::wstring textureName, std::wstring buttonText, Oyster::Math::Float3 textColor, EventFunc func, Oyster::Math::Float3 pos,
|
||||||
|
Oyster::Math::Float2 size, ResizeAspectRatio resize = ResizeAspectRatio_Height)
|
||||||
: EventButtonGUI(textureName, buttonText, textColor, func, pos, size, resize)
|
: EventButtonGUI(textureName, buttonText, textColor, func, pos, size, resize)
|
||||||
{}
|
{}
|
||||||
ButtonEllipse(std::wstring textureName, std::wstring buttonText, Oyster::Math::Float3 textColor, EventFunc func, Owner owner, Oyster::Math::Float3 pos, Oyster::Math::Float2 size, ResizeAspectRatio resize = ResizeAspectRatio_Height)
|
ButtonEllipse(std::wstring textureName, std::wstring buttonText, Oyster::Math::Float3 textColor, EventFunc func, Owner owner, Oyster::Math::Float3 pos,
|
||||||
|
Oyster::Math::Float2 size, ResizeAspectRatio resize = ResizeAspectRatio_Height)
|
||||||
: EventButtonGUI(textureName, buttonText, textColor, func, owner, pos, size, resize)
|
: EventButtonGUI(textureName, buttonText, textColor, func, owner, pos, size, resize)
|
||||||
{}
|
{}
|
||||||
ButtonEllipse(std::wstring textureName, std::wstring buttonText, Oyster::Math::Float3 textColor, EventFunc func, Owner owner, void* userData, Oyster::Math::Float3 pos, Oyster::Math::Float2 size, ResizeAspectRatio resize = ResizeAspectRatio_Height)
|
ButtonEllipse(std::wstring textureName, std::wstring buttonText, Oyster::Math::Float3 textColor, EventFunc func, Owner owner, void* userData, Oyster::Math::Float3 pos,
|
||||||
|
Oyster::Math::Float2 size, ResizeAspectRatio resize = ResizeAspectRatio_Height)
|
||||||
: EventButtonGUI(textureName, buttonText, textColor, func, owner, userData, pos, size, resize)
|
: EventButtonGUI(textureName, buttonText, textColor, func, owner, userData, pos, size, resize)
|
||||||
{}
|
{}
|
||||||
virtual ~ButtonEllipse()
|
virtual ~ButtonEllipse()
|
||||||
|
|
|
@ -21,16 +21,20 @@ namespace DanBias
|
||||||
ButtonRectangle()
|
ButtonRectangle()
|
||||||
: EventButtonGUI(), width(0), height(0)
|
: EventButtonGUI(), width(0), height(0)
|
||||||
{}
|
{}
|
||||||
ButtonRectangle(std::wstring textureName, std::wstring buttonText, Oyster::Math::Float3 textColor, Owner owner, Oyster::Math::Float3 pos, Oyster::Math::Float2 size, ResizeAspectRatio resize = ResizeAspectRatio_Height)
|
ButtonRectangle(std::wstring textureName, std::wstring buttonText, Oyster::Math::Float3 textColor, Owner owner, Oyster::Math::Float3 pos,
|
||||||
|
Oyster::Math::Float2 size, ResizeAspectRatio resize = ResizeAspectRatio_Height)
|
||||||
: EventButtonGUI(textureName, buttonText, textColor, owner, pos, size, resize)
|
: EventButtonGUI(textureName, buttonText, textColor, owner, pos, size, resize)
|
||||||
{}
|
{}
|
||||||
ButtonRectangle(std::wstring textureName, std::wstring buttonText, Oyster::Math::Float3 textColor, EventFunc func, Oyster::Math::Float3 pos, Oyster::Math::Float2 size, ResizeAspectRatio resize = ResizeAspectRatio_Height)
|
ButtonRectangle(std::wstring textureName, std::wstring buttonText, Oyster::Math::Float3 textColor, EventFunc func, Oyster::Math::Float3 pos,
|
||||||
|
Oyster::Math::Float2 size, ResizeAspectRatio resize = ResizeAspectRatio_Height)
|
||||||
: EventButtonGUI(textureName, buttonText, textColor, func, pos, size, resize)
|
: EventButtonGUI(textureName, buttonText, textColor, func, pos, size, resize)
|
||||||
{}
|
{}
|
||||||
ButtonRectangle(std::wstring textureName, std::wstring buttonText, Oyster::Math::Float3 textColor, EventFunc func, Owner owner, Oyster::Math::Float3 pos, Oyster::Math::Float2 size, ResizeAspectRatio resize = ResizeAspectRatio_Height)
|
ButtonRectangle(std::wstring textureName, std::wstring buttonText, Oyster::Math::Float3 textColor, EventFunc func, Owner owner, Oyster::Math::Float3 pos,
|
||||||
|
Oyster::Math::Float2 size, ResizeAspectRatio resize = ResizeAspectRatio_Height)
|
||||||
: EventButtonGUI(textureName, buttonText, textColor, func, owner, pos, size, resize)
|
: EventButtonGUI(textureName, buttonText, textColor, func, owner, pos, size, resize)
|
||||||
{}
|
{}
|
||||||
ButtonRectangle(std::wstring textureName, std::wstring buttonText, Oyster::Math::Float3 textColor, EventFunc func, Owner owner, void* userData, Oyster::Math::Float3 pos, Oyster::Math::Float2 size, ResizeAspectRatio resize = ResizeAspectRatio_Height)
|
ButtonRectangle(std::wstring textureName, std::wstring buttonText, Oyster::Math::Float3 textColor, EventFunc func, Owner owner, void* userData, Oyster::Math::Float3 pos,
|
||||||
|
Oyster::Math::Float2 size, ResizeAspectRatio resize = ResizeAspectRatio_Height)
|
||||||
: EventButtonGUI(textureName, buttonText, textColor, func, owner, userData, pos, size, resize)
|
: EventButtonGUI(textureName, buttonText, textColor, func, owner, userData, pos, size, resize)
|
||||||
{}
|
{}
|
||||||
virtual ~ButtonRectangle()
|
virtual ~ButtonRectangle()
|
||||||
|
|
|
@ -35,19 +35,22 @@ namespace DanBias
|
||||||
EventButtonGUI()
|
EventButtonGUI()
|
||||||
: EventButton(), pos(0, 0), size(0, 0), texture(NULL), buttonText(""), textColor(0, 0, 0)
|
: EventButton(), pos(0, 0), size(0, 0), texture(NULL), buttonText(""), textColor(0, 0, 0)
|
||||||
{}
|
{}
|
||||||
EventButtonGUI(std::wstring textureName, std::wstring buttonText, Oyster::Math::Float3 textColor, Owner owner, Oyster::Math::Float3 pos, Oyster::Math::Float2 size, ResizeAspectRatio resize = ResizeAspectRatio_Height)
|
EventButtonGUI(std::wstring textureName, std::wstring buttonText, Oyster::Math::Float3 textColor, Owner owner, Oyster::Math::Float3 pos,
|
||||||
|
Oyster::Math::Float2 size, ResizeAspectRatio resize = ResizeAspectRatio_Height)
|
||||||
: EventButton(owner), pos(pos), size(size), texture(NULL), buttonText(buttonText), textColor(textColor)
|
: EventButton(owner), pos(pos), size(size), texture(NULL), buttonText(buttonText), textColor(textColor)
|
||||||
{
|
{
|
||||||
CreateTexture(textureName);
|
CreateTexture(textureName);
|
||||||
if(resize != ResizeAspectRatio_None) ResizeWithAspectRatio(resize);
|
if(resize != ResizeAspectRatio_None) ResizeWithAspectRatio(resize);
|
||||||
}
|
}
|
||||||
EventButtonGUI(std::wstring textureName, std::wstring buttonText, Oyster::Math::Float3 textColor, EventFunc func, Oyster::Math::Float3 pos, Oyster::Math::Float2 size, ResizeAspectRatio resize = ResizeAspectRatio_Height)
|
EventButtonGUI(std::wstring textureName, std::wstring buttonText, Oyster::Math::Float3 textColor, EventFunc func, Oyster::Math::Float3 pos,
|
||||||
|
Oyster::Math::Float2 size, ResizeAspectRatio resize = ResizeAspectRatio_Height)
|
||||||
: EventButton(func), pos(pos), size(size), texture(NULL), buttonText(buttonText), textColor(textColor)
|
: EventButton(func), pos(pos), size(size), texture(NULL), buttonText(buttonText), textColor(textColor)
|
||||||
{
|
{
|
||||||
CreateTexture(textureName);
|
CreateTexture(textureName);
|
||||||
if(resize != ResizeAspectRatio_None) ResizeWithAspectRatio(resize);
|
if(resize != ResizeAspectRatio_None) ResizeWithAspectRatio(resize);
|
||||||
}
|
}
|
||||||
EventButtonGUI(std::wstring textureName, std::wstring buttonText, Oyster::Math::Float3 textColor, EventFunc func, Owner owner, Oyster::Math::Float3 pos, Oyster::Math::Float2 size, ResizeAspectRatio resize = ResizeAspectRatio_Height)
|
EventButtonGUI(std::wstring textureName, std::wstring buttonText, Oyster::Math::Float3 textColor, EventFunc func, Owner owner, Oyster::Math::Float3 pos,
|
||||||
|
Oyster::Math::Float2 size, ResizeAspectRatio resize = ResizeAspectRatio_Height)
|
||||||
: EventButton(func, owner), pos(pos), size(size), texture(NULL), buttonText(buttonText), textColor(textColor)
|
: EventButton(func, owner), pos(pos), size(size), texture(NULL), buttonText(buttonText), textColor(textColor)
|
||||||
{
|
{
|
||||||
CreateTexture(textureName);
|
CreateTexture(textureName);
|
||||||
|
|
|
@ -147,7 +147,7 @@ namespace GameLogic
|
||||||
//Läs in filen.
|
//Läs in filen.
|
||||||
int fileLength = 0;
|
int fileLength = 0;
|
||||||
Loader loader;
|
Loader loader;
|
||||||
char* buf = loader.LoadFile("C:/Users/Sam/Documents/GitHub/Danbias/Bin/Content/worlds/cgf/"+ fileName, fileLength);
|
char* buf = loader.LoadFile("../Content/Worlds/cgf/"+ fileName, fileLength);
|
||||||
|
|
||||||
start = 0;
|
start = 0;
|
||||||
LevelLoaderInternal::FormatVersion version;
|
LevelLoaderInternal::FormatVersion version;
|
||||||
|
|
|
@ -14,10 +14,10 @@ AttatchmentSocket::AttatchmentSocket(void)
|
||||||
|
|
||||||
AttatchmentSocket::~AttatchmentSocket(void)
|
AttatchmentSocket::~AttatchmentSocket(void)
|
||||||
{
|
{
|
||||||
//if(this->attatchment)
|
if(this->attatchment)
|
||||||
//delete this->attatchment;
|
delete this->attatchment;
|
||||||
|
|
||||||
//this->attatchment = 0;
|
this->attatchment = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
IAttatchment* AttatchmentSocket::GetAttatchment()
|
IAttatchment* AttatchmentSocket::GetAttatchment()
|
||||||
|
|
|
@ -8,12 +8,15 @@
|
||||||
#include "CollisionManager.h"
|
#include "CollisionManager.h"
|
||||||
#include "JumpPad.h"
|
#include "JumpPad.h"
|
||||||
#include "Portal.h"
|
#include "Portal.h"
|
||||||
|
#include "CrystalFormation.h"
|
||||||
|
#include "ExplosiveCrate.h"
|
||||||
|
|
||||||
using namespace Oyster;
|
using namespace Oyster;
|
||||||
|
|
||||||
using namespace GameLogic;
|
using namespace GameLogic;
|
||||||
|
|
||||||
void PlayerVObject(Player &player, Object &obj, Oyster::Math::Float kineticEnergyLoss);
|
void PlayerVObject(Player &player, Object &obj, Oyster::Math::Float kineticEnergyLoss);
|
||||||
|
void PlayerVLethalObject(Player &player, Object &obj, Oyster::Math::Float kineticEnergyLoss, Oyster::Math::Float ExtraDamage);
|
||||||
void SendObjectFlying(Oyster::Physics::ICustomBody &obj, Oyster::Math::Float3 force);
|
void SendObjectFlying(Oyster::Physics::ICustomBody &obj, Oyster::Math::Float3 force);
|
||||||
void Teleport(Oyster::Physics::ICustomBody &obj, Oyster::Math::Float3 target);
|
void Teleport(Oyster::Physics::ICustomBody &obj, Oyster::Math::Float3 target);
|
||||||
|
|
||||||
|
@ -26,17 +29,27 @@ using namespace GameLogic;
|
||||||
|
|
||||||
switch (realObj->GetObjectType())
|
switch (realObj->GetObjectType())
|
||||||
{
|
{
|
||||||
case ObjectSpecialType_StandarsBox:
|
case ObjectSpecialType::ObjectSpecialType_Generic:
|
||||||
PlayerVObject(*player,*realObj, kineticEnergyLoss);
|
PlayerVObject(*player,*realObj, kineticEnergyLoss);
|
||||||
//return Physics::ICustomBody::SubscriptMessage_none;
|
//return Physics::ICustomBody::SubscriptMessage_none;
|
||||||
break;
|
break;
|
||||||
case ObjectSpecialType_Player:
|
|
||||||
|
case ObjectSpecialType::ObjectSpecialType_StandardBox:
|
||||||
|
PlayerVObject(*player,*realObj, kineticEnergyLoss);
|
||||||
//return Physics::ICustomBody::SubscriptMessage_none;
|
//return Physics::ICustomBody::SubscriptMessage_none;
|
||||||
break;
|
break;
|
||||||
case ObjectSpecialType_World:
|
case ObjectSpecialType::ObjectSpecialType_Player:
|
||||||
|
//return Physics::ICustomBody::SubscriptMessage_none;
|
||||||
|
break;
|
||||||
|
case ObjectSpecialType::ObjectSpecialType_World:
|
||||||
PlayerVObject(*player,*realObj, kineticEnergyLoss);
|
PlayerVObject(*player,*realObj, kineticEnergyLoss);
|
||||||
//player->playerState = PLAYER_STATE::PLAYER_STATE_WALKING;
|
//player->playerState = PLAYER_STATE::PLAYER_STATE_WALKING;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case ObjectSpecialType::ObjectSpecialType_CrystalFormation:
|
||||||
|
PlayerVLethalObject(*player,*realObj, kineticEnergyLoss,((CrystalFormation*)realObj)->getShreddingDamage());
|
||||||
|
//player->playerState = PLAYER_STATE::PLAYER_STATE_WALKING;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
//return Physics::ICustomBody::SubscriptMessage_none;
|
//return Physics::ICustomBody::SubscriptMessage_none;
|
||||||
|
@ -49,14 +62,13 @@ using namespace GameLogic;
|
||||||
|
|
||||||
switch (realObj->GetObjectType())
|
switch (realObj->GetObjectType())
|
||||||
{
|
{
|
||||||
case ObjectSpecialType_Generic:
|
case ObjectSpecialType::ObjectSpecialType_Generic:
|
||||||
break;
|
break;
|
||||||
case ObjectSpecialType_StandarsBox:
|
case ObjectSpecialType::ObjectSpecialType_StandardBox:
|
||||||
break;
|
|
||||||
case ObjectSpecialType_Player:
|
|
||||||
SendObjectFlying(*obj, jumpPad->pushForce);
|
SendObjectFlying(*obj, jumpPad->pushForce);
|
||||||
break;
|
break;
|
||||||
case ObjectSpecialType_World:
|
case ObjectSpecialType::ObjectSpecialType_Player:
|
||||||
|
SendObjectFlying(*obj, jumpPad->pushForce);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -80,6 +92,43 @@ using namespace GameLogic;
|
||||||
obj.SetPosition(target);
|
obj.SetPosition(target);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ExplosiveCrate::ExplosiveCrateCollision(Oyster::Physics::ICustomBody *rigidBodyCrate, Oyster::Physics::ICustomBody *obj, Oyster::Math::Float kineticEnergyLoss)
|
||||||
|
{
|
||||||
|
int forceThreashHold = 200000; //how much force for the box to explode of the impact
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if(kineticEnergyLoss > forceThreashHold)
|
||||||
|
{
|
||||||
|
ExplosiveCrate* crate = ((ExplosiveCrate*)rigidBodyCrate->GetCustomTag());
|
||||||
|
|
||||||
|
|
||||||
|
Oyster::Math::Float3 pos = rigidBodyCrate->GetState().centerPos;
|
||||||
|
Oyster::Collision3D::Sphere *hitSphere = new Oyster::Collision3D::Sphere(pos,crate->ExplosionRadius);
|
||||||
|
|
||||||
|
Oyster::Physics::API::Instance().ApplyEffect(hitSphere,crate,Explode);
|
||||||
|
|
||||||
|
delete hitSphere;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ExplosiveCrate::Explode(Oyster::Physics::ICustomBody *obj, void* args)
|
||||||
|
{
|
||||||
|
Object *realObj = (Object*)obj->GetCustomTag();
|
||||||
|
ExplosiveCrate* ExplosionSource = ((ExplosiveCrate*)args);
|
||||||
|
|
||||||
|
|
||||||
|
if(realObj->GetObjectType() == ObjectSpecialType::ObjectSpecialType_Player)
|
||||||
|
{
|
||||||
|
Player *hitPlayer = (Player*)realObj;
|
||||||
|
|
||||||
|
hitPlayer->DamageLife(ExplosionSource->shreddingDamage);
|
||||||
|
//do shredding damage
|
||||||
|
}
|
||||||
|
|
||||||
|
realObj->GetRigidBody()->ApplyImpulse(ExplosionSource->pushForce);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
void PlayerVObject(Player &player, Object &obj, Oyster::Math::Float kineticEnergyLoss)
|
void PlayerVObject(Player &player, Object &obj, Oyster::Math::Float kineticEnergyLoss)
|
||||||
{
|
{
|
||||||
|
@ -97,6 +146,20 @@ using namespace GameLogic;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void PlayerVLethalObject(Player &player, Object &obj, Oyster::Math::Float kineticEnergyLoss, Oyster::Math::Float ExtraDamage)
|
||||||
|
{
|
||||||
|
int damageDone = 0;
|
||||||
|
int forceThreashHold = 200000;
|
||||||
|
|
||||||
|
if(kineticEnergyLoss > forceThreashHold) //should only take damage if the force is high enough
|
||||||
|
{
|
||||||
|
damageDone = (int)(kineticEnergyLoss * 0.10f);
|
||||||
|
damageDone += ExtraDamage;
|
||||||
|
//player.DamageLife(damageDone);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Oyster::Physics::ICustomBody::SubscriptMessage Object::DefaultCollisionAfter(Oyster::Physics::ICustomBody *rigidBodyLevel, Oyster::Physics::ICustomBody *obj, Oyster::Math::Float kineticEnergyLoss)
|
Oyster::Physics::ICustomBody::SubscriptMessage Object::DefaultCollisionAfter(Oyster::Physics::ICustomBody *rigidBodyLevel, Oyster::Physics::ICustomBody *obj, Oyster::Math::Float kineticEnergyLoss)
|
||||||
{
|
{
|
||||||
return Physics::ICustomBody::SubscriptMessage_none;
|
return Physics::ICustomBody::SubscriptMessage_none;
|
||||||
|
@ -122,7 +185,7 @@ using namespace GameLogic;
|
||||||
|
|
||||||
Object *realObj = (Object*)obj->GetCustomTag();
|
Object *realObj = (Object*)obj->GetCustomTag();
|
||||||
|
|
||||||
if(realObj->GetObjectType() == ObjectSpecialType_Player || realObj->GetObjectType() == ObjectSpecialType_World)
|
if(realObj->GetObjectType() == ObjectSpecialType::ObjectSpecialType_Player || realObj->GetObjectType() == ObjectSpecialType::ObjectSpecialType_World)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
obj->ApplyImpulse(((forcePushData*)(args))->pushForce);
|
obj->ApplyImpulse(((forcePushData*)(args))->pushForce);
|
||||||
|
@ -145,9 +208,7 @@ using namespace GameLogic;
|
||||||
|
|
||||||
switch(realObj->GetObjectType())
|
switch(realObj->GetObjectType())
|
||||||
{
|
{
|
||||||
case ObjectSpecialType_StandarsBox:
|
case ObjectSpecialType::ObjectSpecialType_StandardBox:
|
||||||
//move obj to limbo in physics to make sure it wont collide with anything
|
|
||||||
// Oyster::Physics::API::Instance().MoveToLimbo(obj);
|
|
||||||
weapon->heldObject = obj; //weapon now holds the object
|
weapon->heldObject = obj; //weapon now holds the object
|
||||||
weapon->hasObject = true;
|
weapon->hasObject = true;
|
||||||
|
|
||||||
|
|
|
@ -8,8 +8,8 @@ CrystalFormation::CrystalFormation(void)
|
||||||
this->shreddingDamage = 0;
|
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)
|
CrystalFormation::CrystalFormation(Oyster::Physics::ICustomBody *rigidBody, int objectID,Oyster::Math::Float shreddingDamage)
|
||||||
:StaticObject(rigidBody, collisionFuncAfter, type)
|
:StaticObject(rigidBody, CrystalFormation::DefaultCollisionAfter, ObjectSpecialType::ObjectSpecialType_CrystalFormation, objectID)
|
||||||
{
|
{
|
||||||
this->shreddingDamage = shreddingDamage;
|
this->shreddingDamage = shreddingDamage;
|
||||||
}
|
}
|
||||||
|
@ -18,3 +18,8 @@ CrystalFormation::CrystalFormation(Oyster::Physics::ICustomBody *rigidBody, void
|
||||||
CrystalFormation::~CrystalFormation(void)
|
CrystalFormation::~CrystalFormation(void)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Oyster::Math::Float CrystalFormation::getShreddingDamage()
|
||||||
|
{
|
||||||
|
return this->shreddingDamage;
|
||||||
|
}
|
||||||
|
|
|
@ -9,11 +9,12 @@ namespace GameLogic
|
||||||
CrystalFormation(void);
|
CrystalFormation(void);
|
||||||
|
|
||||||
CrystalFormation(Oyster::Physics::ICustomBody *rigidBody
|
CrystalFormation(Oyster::Physics::ICustomBody *rigidBody
|
||||||
,void (*collisionFuncAfter)(Oyster::Physics::ICustomBody *proto,Oyster::Physics::ICustomBody *deuter,Oyster::Math::Float kineticEnergyLoss)
|
,int objectID,Oyster::Math::Float shreddingDamage);
|
||||||
,OBJECT_TYPE type, Oyster::Math::Float shreddingDamage);
|
|
||||||
|
|
||||||
~CrystalFormation(void);
|
~CrystalFormation(void);
|
||||||
|
|
||||||
|
Oyster::Math::Float getShreddingDamage();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Oyster::Math::Float shreddingDamage;
|
Oyster::Math::Float shreddingDamage;
|
||||||
};
|
};
|
||||||
|
|
|
@ -9,29 +9,14 @@ DynamicObject::DynamicObject()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
DynamicObject::DynamicObject(ObjectSpecialType type)
|
|
||||||
:Object(type)
|
DynamicObject::DynamicObject(Oyster::Physics::ICustomBody *rigidBody , void (*EventOnCollision)(Oyster::Physics::ICustomBody *proto,Oyster::Physics::ICustomBody *deuter,Oyster::Math::Float kineticEnergyLoss), ObjectSpecialType type, int objectID)
|
||||||
|
:Object(rigidBody, EventOnCollision, type, objectID)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
DynamicObject::DynamicObject(Oyster::Physics::ICustomBody *rigidBody, ObjectSpecialType type)
|
DynamicObject::DynamicObject(Oyster::Physics::ICustomBody *rigidBody , Oyster::Physics::ICustomBody::SubscriptMessage (*EventOnCollision)(Oyster::Physics::ICustomBody *proto,Oyster::Physics::ICustomBody *deuter,Oyster::Math::Float kineticEnergyLoss), ObjectSpecialType type, int objectID)
|
||||||
:Object(rigidBody,type)
|
:Object(rigidBody, EventOnCollision, type, objectID)
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
DynamicObject::DynamicObject( void* collisionFuncAfter, ObjectSpecialType type)
|
|
||||||
:Object(collisionFuncAfter,type)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
DynamicObject::DynamicObject(Oyster::Physics::ICustomBody *rigidBody , void* collisionFuncAfter, ObjectSpecialType type)
|
|
||||||
:Object(rigidBody, collisionFuncAfter, type)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
DynamicObject::DynamicObject(Oyster::Physics::ICustomBody *rigidBody , Oyster::Physics::ICustomBody::SubscriptMessage (*collisionFuncAfter)(Oyster::Physics::ICustomBody *proto,Oyster::Physics::ICustomBody *deuter,Oyster::Math::Float kineticEnergyLoss), ObjectSpecialType type)
|
|
||||||
:Object(rigidBody, collisionFuncAfter, type)
|
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,12 +14,8 @@ namespace GameLogic
|
||||||
|
|
||||||
public:
|
public:
|
||||||
DynamicObject();
|
DynamicObject();
|
||||||
|
DynamicObject(Oyster::Physics::ICustomBody *rigidBody , void (*collisionFuncAfter)(Oyster::Physics::ICustomBody *proto,Oyster::Physics::ICustomBody *deuter,Oyster::Math::Float kineticEnergyLoss), ObjectSpecialType type, int objectID);
|
||||||
DynamicObject(ObjectSpecialType type);
|
DynamicObject(Oyster::Physics::ICustomBody *rigidBody , Oyster::Physics::ICustomBody::SubscriptMessage (*EventOnCollision)(Oyster::Physics::ICustomBody *proto,Oyster::Physics::ICustomBody *deuter,Oyster::Math::Float kineticEnergyLoss), ObjectSpecialType type, int objectID);
|
||||||
DynamicObject(Oyster::Physics::ICustomBody *rigidBody, ObjectSpecialType type);
|
|
||||||
DynamicObject( void* collisionFuncAfter, ObjectSpecialType type);
|
|
||||||
DynamicObject(Oyster::Physics::ICustomBody *rigidBody , void* collisionFuncAfter, ObjectSpecialType type);
|
|
||||||
DynamicObject(Oyster::Physics::ICustomBody *rigidBody , Oyster::Physics::ICustomBody::SubscriptMessage (*collisionFuncAfter)(Oyster::Physics::ICustomBody *proto,Oyster::Physics::ICustomBody *deuter,Oyster::Math::Float kineticEnergyLoss), ObjectSpecialType type);
|
|
||||||
|
|
||||||
|
|
||||||
~DynamicObject(void);
|
~DynamicObject(void);
|
||||||
|
|
|
@ -0,0 +1,29 @@
|
||||||
|
#include "ExplosiveCrate.h"
|
||||||
|
|
||||||
|
using namespace GameLogic;
|
||||||
|
|
||||||
|
ExplosiveCrate::ExplosiveCrate(void)
|
||||||
|
:DynamicObject()
|
||||||
|
{
|
||||||
|
this->shreddingDamage = 0;
|
||||||
|
this->pushForce = 0;
|
||||||
|
this->ExplosionRadius = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
ExplosiveCrate::ExplosiveCrate(Oyster::Physics::ICustomBody *rigidBody,ObjectSpecialType type, int objectID,Oyster::Math::Float shreddingDamage, Oyster::Math::Float3 pushForce, Oyster::Math::Float ExplosionRadius)
|
||||||
|
:DynamicObject(rigidBody,ExplosiveCrate::ExplosiveCrateCollision, type, objectID)
|
||||||
|
{
|
||||||
|
this->shreddingDamage = shreddingDamage;
|
||||||
|
this->pushForce = pushForce;
|
||||||
|
this->ExplosionRadius = ExplosionRadius;
|
||||||
|
}
|
||||||
|
|
||||||
|
ExplosiveCrate::~ExplosiveCrate(void)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,24 @@
|
||||||
|
#ifndef EXPLOSIVECRATE_H
|
||||||
|
#define EXPLOSIVECRATE_H
|
||||||
|
#include "DynamicObject.h"
|
||||||
|
namespace GameLogic
|
||||||
|
{
|
||||||
|
class ExplosiveCrate : public DynamicObject
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
ExplosiveCrate(void);
|
||||||
|
|
||||||
|
ExplosiveCrate(Oyster::Physics::ICustomBody *rigidBody,ObjectSpecialType type,int objectID,Oyster::Math::Float shreddingDamage, Oyster::Math::Float3 pushForce, Oyster::Math::Float ExplosionRadius);
|
||||||
|
|
||||||
|
~ExplosiveCrate(void);
|
||||||
|
|
||||||
|
static void ExplosiveCrateCollision(Oyster::Physics::ICustomBody *rigidBodyCrate, Oyster::Physics::ICustomBody *obj, Oyster::Math::Float kineticEnergyLoss);
|
||||||
|
static void Explode(Oyster::Physics::ICustomBody *obj, void* args);
|
||||||
|
|
||||||
|
private:
|
||||||
|
Oyster::Math::Float shreddingDamage;
|
||||||
|
Oyster::Math::Float3 pushForce;
|
||||||
|
Oyster::Math::Float ExplosionRadius;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
#endif
|
|
@ -82,7 +82,8 @@ Game::LevelData* Game::CreateLevel()
|
||||||
|
|
||||||
this->level = new LevelData();
|
this->level = new LevelData();
|
||||||
//this->level->level->InitiateLevel(1000);
|
//this->level->level->InitiateLevel(1000);
|
||||||
this->level->level->InitiateLevel("C:/Users/Sam/Documents/GitHub/Danbias/Bin/Content/worlds/ccc.bias");
|
this->level->level->InitiateLevel("../Content/Worlds/ccc.bias");
|
||||||
|
|
||||||
|
|
||||||
return this->level;
|
return this->level;
|
||||||
}
|
}
|
||||||
|
|
|
@ -176,7 +176,9 @@
|
||||||
<ClInclude Include="AttatchmentMassDriver.h" />
|
<ClInclude Include="AttatchmentMassDriver.h" />
|
||||||
<ClInclude Include="AttatchmentSocket.h" />
|
<ClInclude Include="AttatchmentSocket.h" />
|
||||||
<ClInclude Include="CollisionManager.h" />
|
<ClInclude Include="CollisionManager.h" />
|
||||||
|
<ClInclude Include="CrystalFormation.h" />
|
||||||
<ClInclude Include="DynamicObject.h" />
|
<ClInclude Include="DynamicObject.h" />
|
||||||
|
<ClInclude Include="ExplosiveCrate.h" />
|
||||||
<ClInclude Include="Game.h" />
|
<ClInclude Include="Game.h" />
|
||||||
<ClInclude Include="GameAPI.h" />
|
<ClInclude Include="GameAPI.h" />
|
||||||
<ClInclude Include="GameLogicDef.h" />
|
<ClInclude Include="GameLogicDef.h" />
|
||||||
|
@ -202,7 +204,9 @@
|
||||||
<ClCompile Include="AttatchmentMassDriver.cpp" />
|
<ClCompile Include="AttatchmentMassDriver.cpp" />
|
||||||
<ClCompile Include="AttatchmentSocket.cpp" />
|
<ClCompile Include="AttatchmentSocket.cpp" />
|
||||||
<ClCompile Include="CollisionManager.cpp" />
|
<ClCompile Include="CollisionManager.cpp" />
|
||||||
|
<ClCompile Include="CrystalFormation.cpp" />
|
||||||
<ClCompile Include="DynamicObject.cpp" />
|
<ClCompile Include="DynamicObject.cpp" />
|
||||||
|
<ClCompile Include="ExplosiveCrate.cpp" />
|
||||||
<ClCompile Include="Game.cpp" />
|
<ClCompile Include="Game.cpp" />
|
||||||
<ClCompile Include="GameModeType.cpp" />
|
<ClCompile Include="GameModeType.cpp" />
|
||||||
<ClCompile Include="Game_LevelData.cpp" />
|
<ClCompile Include="Game_LevelData.cpp" />
|
||||||
|
|
|
@ -43,6 +43,12 @@ namespace GameLogic
|
||||||
Oyster::Math::Float3 pushForce;
|
Oyster::Math::Float3 pushForce;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct ExplosionData
|
||||||
|
{
|
||||||
|
Oyster::Math::Float3 pushForce;
|
||||||
|
Oyster::Math::Float3 ShreddingDamage;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -7,9 +7,9 @@ Game::PlayerData::PlayerData()
|
||||||
{
|
{
|
||||||
//set some stats that are appropriate to a player
|
//set some stats that are appropriate to a player
|
||||||
|
|
||||||
Oyster::Math::Float3 centerPosition = Oyster::Math::Float3(0,400,0);
|
Oyster::Math::Float3 centerPosition = Oyster::Math::Float3(50,130,0);
|
||||||
|
|
||||||
Oyster::Math::Float3 size = Oyster::Math::Float3(0.25f,1.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;
|
||||||
Oyster::Math::Float restitutionCoeff = 0.5;
|
Oyster::Math::Float restitutionCoeff = 0.5;
|
||||||
Oyster::Math::Float frictionCoeff_Static = 0.4;
|
Oyster::Math::Float frictionCoeff_Static = 0.4;
|
||||||
|
@ -20,13 +20,14 @@ Game::PlayerData::PlayerData()
|
||||||
Oyster::Physics::ICustomBody* rigidBody = Oyster::Physics::API::Instance().AddCollisionBox(size, Oyster::Math::Float4(0, 0, 0, 1), centerPosition, mass, 0.5f, 0.8f, 0.6f );
|
Oyster::Physics::ICustomBody* rigidBody = Oyster::Physics::API::Instance().AddCollisionBox(size, Oyster::Math::Float4(0, 0, 0, 1), centerPosition, mass, 0.5f, 0.8f, 0.6f );
|
||||||
rigidBody->SetAngularFactor(0.0f);
|
rigidBody->SetAngularFactor(0.0f);
|
||||||
//create player with this rigid body
|
//create player with this rigid body
|
||||||
this->player = new Player(rigidBody, Player::PlayerCollision, ObjectSpecialType_Player);
|
this->player = new Player(rigidBody, Player::PlayerCollision, ObjectSpecialType_Player,0,0);
|
||||||
|
|
||||||
this->player->GetRigidBody()->SetCustomTag(this);
|
this->player->GetRigidBody()->SetCustomTag(this);
|
||||||
player->EndFrame();
|
player->EndFrame();
|
||||||
}
|
}
|
||||||
Game::PlayerData::PlayerData(int playerID,int teamID)
|
Game::PlayerData::PlayerData(int playerID,int teamID)
|
||||||
{
|
{
|
||||||
|
Oyster::Physics::ICustomBody* rigidBody;
|
||||||
this->player = new Player();
|
this->player = new Player();
|
||||||
}
|
}
|
||||||
Game::PlayerData::~PlayerData()
|
Game::PlayerData::~PlayerData()
|
||||||
|
|
|
@ -8,8 +8,8 @@ JumpPad::JumpPad(void)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
JumpPad::JumpPad(Oyster::Physics::ICustomBody *rigidBody, void (*collisionFuncAfter)(Oyster::Physics::ICustomBody *proto,Oyster::Physics::ICustomBody *deuter,Oyster::Math::Float kineticEnergyLoss), ObjectSpecialType type, Oyster::Math::Float3 pushForce)
|
JumpPad::JumpPad(Oyster::Physics::ICustomBody *rigidBody, ObjectSpecialType type,int objectID ,Oyster::Math::Float3 pushForce)
|
||||||
:StaticObject(rigidBody, collisionFuncAfter, type)
|
:StaticObject(rigidBody, JumpPad::JumpPadActivated, type, objectID)
|
||||||
{
|
{
|
||||||
this->pushForce = pushForce;
|
this->pushForce = pushForce;
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,8 +9,7 @@ namespace GameLogic
|
||||||
JumpPad(void);
|
JumpPad(void);
|
||||||
|
|
||||||
JumpPad(Oyster::Physics::ICustomBody *rigidBody
|
JumpPad(Oyster::Physics::ICustomBody *rigidBody
|
||||||
,void (*collisionFuncAfter)(Oyster::Physics::ICustomBody *proto,Oyster::Physics::ICustomBody *deuter,Oyster::Math::Float kineticEnergyLoss)
|
,ObjectSpecialType type, int objectID,Oyster::Math::Float3 pushForce);
|
||||||
,ObjectSpecialType type, Oyster::Math::Float3 pushForce);
|
|
||||||
|
|
||||||
|
|
||||||
~JumpPad(void);
|
~JumpPad(void);
|
||||||
|
|
|
@ -16,48 +16,190 @@ Level::~Level(void)
|
||||||
delete this->levelObj;
|
delete this->levelObj;
|
||||||
this->levelObj = NULL;
|
this->levelObj = NULL;
|
||||||
}
|
}
|
||||||
void Level::parseObjectType(ObjectTypeHeader* obj)
|
Object* Level::createGameObj(ObjectHeader* obj, ICustomBody* rigidBody)
|
||||||
{
|
{
|
||||||
/*switch (obj->objectTypeID)
|
Object* gameObj =NULL;
|
||||||
|
switch ((ObjectSpecialType)obj->specialTypeID)
|
||||||
{
|
{
|
||||||
case skySphere:
|
case ObjectSpecialType_None:
|
||||||
// save the skysphere to be able to rotate it
|
{
|
||||||
|
gameObj = new StaticObject(rigidBody, Object::DefaultCollisionAfter, (ObjectSpecialType)obj->specialTypeID);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case jumppad:
|
case ObjectSpecialType_Sky:
|
||||||
// save direction
|
{
|
||||||
break;
|
float skySize = ((SkyAttributes*)obj)->skySize;
|
||||||
case portal:
|
gameObj = new StaticObject(rigidBody, Object::DefaultCollisionAfter, (ObjectSpecialType)obj->specialTypeID);
|
||||||
// save portal destination
|
}
|
||||||
break;
|
|
||||||
case world:
|
|
||||||
// add gravitation well here
|
|
||||||
// add outer limit of the world
|
|
||||||
case spawn:
|
|
||||||
// save spawnpoint pos
|
|
||||||
break;
|
break;
|
||||||
|
case ObjectSpecialType_World:
|
||||||
|
{
|
||||||
|
API::Instance().SetGravityPoint(Oyster::Math3D::Float3(0,0,0));
|
||||||
|
API::Instance().SetGravity(200); // could balance gravitation with the world size
|
||||||
|
|
||||||
default:
|
float worldSize = ((WorldAttributes*)obj)->worldSize;
|
||||||
|
float atmosphereSize = ((WorldAttributes*)obj)->atmoSphereSize;
|
||||||
|
gameObj = new StaticObject(rigidBody, Object::DefaultCollisionAfter, (ObjectSpecialType)obj->specialTypeID);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}*/
|
case ObjectSpecialType_Building:
|
||||||
|
{
|
||||||
|
gameObj = new StaticObject(rigidBody, Object::DefaultCollisionAfter, (ObjectSpecialType)obj->specialTypeID);
|
||||||
|
}
|
||||||
|
case ObjectSpecialType_Stone:
|
||||||
|
{
|
||||||
|
gameObj = new DynamicObject(rigidBody, Object::DefaultCollisionAfter, (ObjectSpecialType)obj->specialTypeID);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case ObjectSpecialType_StandarsBox:
|
||||||
|
{
|
||||||
|
gameObj = new DynamicObject(rigidBody, Object::DefaultCollisionAfter, (ObjectSpecialType)obj->specialTypeID);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case ObjectSpecialType_RedExplosiveBox:
|
||||||
|
{
|
||||||
|
int dmg = 50;
|
||||||
|
//gameObj = new ExplosiveBox(rigidBody, ObjectSpecialType_RedExplosiveBox);
|
||||||
|
gameObj = new DynamicObject(rigidBody, Object::DefaultCollisionAfter, (ObjectSpecialType)obj->specialTypeID);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
//case ObjectSpecialType_BlueExplosiveBox:
|
||||||
|
// int dmg = 70;
|
||||||
|
// gameObj = new ExplosiveBox(rigidBody, ObjectSpecialType_BlueExplosiveBox);
|
||||||
|
// break;
|
||||||
|
case ObjectSpecialType_SpikeBox:
|
||||||
|
{
|
||||||
|
gameObj = new DynamicObject(rigidBody, Object::DefaultCollisionAfter, (ObjectSpecialType)obj->specialTypeID);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case ObjectSpecialType_Spike:
|
||||||
|
{
|
||||||
|
gameObj = new DynamicObject(rigidBody, Object::DefaultCollisionAfter, (ObjectSpecialType)obj->specialTypeID);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case ObjectSpecialType_CrystalFormation:
|
||||||
|
{
|
||||||
|
int dmg = 50;
|
||||||
|
//gameObj = new Crystal(rigidBody);
|
||||||
|
gameObj = new StaticObject(rigidBody, Object::DefaultCollisionAfter, (ObjectSpecialType)obj->specialTypeID);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case ObjectSpecialType_CrystalShard:
|
||||||
|
{
|
||||||
|
gameObj = new DynamicObject(rigidBody, Object::DefaultCollisionAfter, (ObjectSpecialType)obj->specialTypeID);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case ObjectSpecialType_JumpPad:
|
||||||
|
{
|
||||||
|
float power = ((JumpPadAttributes*)obj)->power;
|
||||||
|
Oyster::Math::Float3 dir = ((JumpPadAttributes*)obj)->direction;
|
||||||
|
//gameObj = JumpPad(rigidBody, );
|
||||||
|
gameObj = new StaticObject(rigidBody, Object::DefaultCollisionAfter, (ObjectSpecialType)obj->specialTypeID);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case ObjectSpecialType_Portal:
|
||||||
|
{
|
||||||
|
Oyster::Math::Float3 destination = ((PortalAttributes*)obj)->destination;
|
||||||
|
gameObj = new DynamicObject(rigidBody, Object::DefaultCollisionAfter, (ObjectSpecialType)obj->specialTypeID);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case ObjectSpecialType_SpawnPoint:
|
||||||
|
{
|
||||||
|
gameObj = new StaticObject(rigidBody, Object::DefaultCollisionAfter, (ObjectSpecialType)obj->specialTypeID);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case ObjectSpecialType_Player:
|
||||||
|
{
|
||||||
|
gameObj = new DynamicObject(rigidBody, Object::DefaultCollisionAfter, (ObjectSpecialType)obj->specialTypeID);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case ObjectSpecialType_Generic:
|
||||||
|
{
|
||||||
|
gameObj = new StaticObject(rigidBody, Object::DefaultCollisionAfter, (ObjectSpecialType)obj->specialTypeID);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
gameObj = new StaticObject(rigidBody, Object::DefaultCollisionAfter, (ObjectSpecialType)obj->specialTypeID);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return gameObj;
|
||||||
}
|
}
|
||||||
void Level::parsePhysicsObj(LevelLoaderInternal::BoundingVolumeBase* obj)
|
|
||||||
|
ICustomBody* Level::InitRigidBodyCube( const ObjectHeader* obj)
|
||||||
{
|
{
|
||||||
// offset physObj med modelObj
|
ICustomBody* rigidBody = NULL;
|
||||||
|
Oyster::Math::Float3 rigidWorldPos;
|
||||||
|
Oyster::Math::Float4 rigidWorldRotation;
|
||||||
|
float rigidBodyMass;
|
||||||
|
Oyster::Math::Float3 rigidBodySize;
|
||||||
|
|
||||||
|
//offset the rigidPosition from modelspace to worldspace;
|
||||||
|
rigidWorldPos = (Oyster::Math::Float3)obj->position + (Oyster::Math::Float3)obj->boundingVolume.box.position;
|
||||||
|
//scales the position so the collision geomentry is in the right place
|
||||||
|
rigidWorldPos = rigidWorldPos * obj->scale;
|
||||||
|
|
||||||
|
//offset the rigidRotation from modelspace to worldspace;
|
||||||
|
Oyster::Math::Quaternion worldPosQuaternion = Oyster::Math::Quaternion(Oyster::Math::Float3(obj->rotation[0],obj->rotation[1],obj->rotation[2]), obj->rotation[3]);
|
||||||
|
Oyster::Math::Quaternion physicsPosQuaternion = Oyster::Math::Quaternion(Oyster::Math::Float3(obj->boundingVolume.sphere.rotation[0],obj->boundingVolume.sphere.rotation[1],obj->boundingVolume.sphere.rotation[2]), obj->boundingVolume.sphere.rotation[3]);
|
||||||
|
Oyster::Math::Quaternion rigidWorldQuaternion = worldPosQuaternion * physicsPosQuaternion;
|
||||||
|
|
||||||
|
rigidWorldRotation = Oyster::Math::Float4(rigidWorldQuaternion);
|
||||||
|
|
||||||
|
//mass scaled
|
||||||
|
rigidBodyMass = obj->scale[0] * obj->scale[1] * obj->scale[2] * obj->boundingVolume.box.mass;
|
||||||
|
|
||||||
|
//size scaled
|
||||||
|
rigidBodySize = (Oyster::Math::Float3)obj->boundingVolume.box.size * (Oyster::Math::Float3)obj->scale;
|
||||||
|
|
||||||
|
//create the rigid body
|
||||||
|
rigidBody = API::Instance().AddCollisionBox(rigidBodySize , rigidWorldRotation , rigidWorldPos , rigidBodyMass, obj->boundingVolume.box.restitutionCoeff , obj->boundingVolume.box.frictionCoeffStatic , obj->boundingVolume.box.frictionCoeffDynamic);
|
||||||
|
return rigidBody;
|
||||||
|
}
|
||||||
|
ICustomBody* Level::InitRigidBodySphere( const ObjectHeader* obj)
|
||||||
|
{
|
||||||
|
ICustomBody* rigidBody = NULL;
|
||||||
|
Oyster::Math::Float3 rigidWorldPos;
|
||||||
|
Oyster::Math::Float4 rigidWorldRotation;
|
||||||
|
float rigidBodyMass;
|
||||||
|
float rigidBodyRadius;
|
||||||
|
|
||||||
|
//offset the rigidPosition from modelspace to worldspace;
|
||||||
|
rigidWorldPos = (Oyster::Math::Float3)obj->position + (Oyster::Math::Float3)obj->boundingVolume.sphere.position;
|
||||||
|
//scales the position so the collision geomentry is in the right place
|
||||||
|
rigidWorldPos = rigidWorldPos * obj->scale;
|
||||||
|
|
||||||
|
//offset the rigidRotation from modelspace to worldspace;
|
||||||
|
Oyster::Math::Quaternion worldPosQuaternion = Oyster::Math::Quaternion(Oyster::Math::Float3(obj->rotation[0],obj->rotation[1],obj->rotation[2]), obj->rotation[3]);
|
||||||
|
Oyster::Math::Quaternion physicsPosQuaternion = Oyster::Math::Quaternion(Oyster::Math::Float3(obj->boundingVolume.sphere.rotation[0],obj->boundingVolume.sphere.rotation[1],obj->boundingVolume.sphere.rotation[2]), obj->boundingVolume.sphere.rotation[3]);
|
||||||
|
Oyster::Math::Quaternion rigidWorldQuaternion = worldPosQuaternion * physicsPosQuaternion;
|
||||||
|
|
||||||
|
rigidWorldRotation = Oyster::Math::Float4(rigidWorldQuaternion);
|
||||||
|
|
||||||
|
|
||||||
|
//mass scaled
|
||||||
|
rigidBodyMass = obj->scale[0] * obj->scale[1] * obj->scale[2] * obj->boundingVolume.sphere.mass;
|
||||||
|
|
||||||
|
//Radius scaled
|
||||||
|
//rigidBodyRadius = (staticObjData->scale[0] * staticObjData->scale[1] * staticObjData->scale[2] / 3) * staticObjData->boundingVolume.sphere.radius;
|
||||||
|
rigidBodyRadius = (obj->scale[0] * obj->scale[1] * obj->scale[2]) * obj->boundingVolume.sphere.radius;
|
||||||
|
|
||||||
|
//create the rigid body
|
||||||
|
rigidBody = API::Instance().AddCollisionSphere( rigidBodyRadius , rigidWorldRotation , rigidWorldPos , rigidBodyMass, obj->boundingVolume.sphere.restitutionCoeff , obj->boundingVolume.sphere.frictionCoeffStatic , obj->boundingVolume.sphere.frictionCoeffDynamic);
|
||||||
|
return rigidBody;
|
||||||
}
|
}
|
||||||
void Level::InitiateLevel(std::string levelPath)
|
void Level::InitiateLevel(std::string levelPath)
|
||||||
{
|
{
|
||||||
LevelLoader ll;
|
LevelLoader ll;
|
||||||
std::vector<Utility::DynamicMemory::SmartPointer<ObjectTypeHeader>> objects;
|
std::vector<Utility::DynamicMemory::SmartPointer<ObjectTypeHeader>> objects;
|
||||||
objects = ll.LoadLevel(levelPath);
|
objects = ll.LoadLevel(levelPath);
|
||||||
|
|
||||||
|
API::Instance().SetGravityPoint(Oyster::Math3D::Float3(0,0,0));
|
||||||
|
API::Instance().SetGravity(200);
|
||||||
int objCount = objects.size();
|
int objCount = objects.size();
|
||||||
int modelCount = 0;
|
int modelCount = 100;
|
||||||
int staticObjCount = 0;
|
|
||||||
int dynamicObjCount = 0;
|
|
||||||
Oyster::Math::Float3 rigidWorldPos;
|
|
||||||
Oyster::Math::Float4 rigidWorldRotation;
|
|
||||||
float rigidBodyMass;
|
|
||||||
float rigidBodyRadius;
|
|
||||||
Oyster::Math::Float3 rigidBodySize;
|
|
||||||
for (int i = 0; i < objCount; i++)
|
for (int i = 0; i < objCount; i++)
|
||||||
{
|
{
|
||||||
ObjectTypeHeader* obj = objects.at(i);
|
ObjectTypeHeader* obj = objects.at(i);
|
||||||
|
@ -75,69 +217,32 @@ void Level::InitiateLevel(std::string levelPath)
|
||||||
{
|
{
|
||||||
|
|
||||||
ObjectHeader* staticObjData = ((ObjectHeader*)obj);
|
ObjectHeader* staticObjData = ((ObjectHeader*)obj);
|
||||||
//LevelLoaderInternal::BoundingVolumeBase* staticObjPhysicData = ((ObjectHeader*)obj);
|
|
||||||
staticObjData->ModelFile;
|
staticObjData->ModelFile;
|
||||||
|
|
||||||
ICustomBody* rigidBody_Static = NULL;
|
ICustomBody* rigidBody_Static = NULL;
|
||||||
|
|
||||||
|
|
||||||
// collision shape
|
// collision shape
|
||||||
// radius, rotation in world, position in world, mass, restitution, static and dynamic friction
|
|
||||||
if(staticObjData->boundingVolume.geoType == CollisionGeometryType_Sphere)
|
if(staticObjData->boundingVolume.geoType == CollisionGeometryType_Sphere)
|
||||||
{
|
{
|
||||||
//offset the rigidPosition from modelspace to worldspace;
|
rigidBody_Static = InitRigidBodySphere(staticObjData);
|
||||||
rigidWorldPos = (Oyster::Math::Float3)staticObjData->position + (Oyster::Math::Float3)staticObjData->boundingVolume.sphere.position;
|
|
||||||
//scales the position so the collision geomentry is in the right place
|
|
||||||
rigidWorldPos = rigidWorldPos * staticObjData->scale;
|
|
||||||
|
|
||||||
//offset the rigidRotation from modelspace to worldspace;
|
|
||||||
rigidWorldRotation = (Oyster::Math::Float4)staticObjData->rotation + (Oyster::Math::Float4)staticObjData->boundingVolume.sphere.rotation;
|
|
||||||
|
|
||||||
//mass scaled
|
|
||||||
rigidBodyMass = staticObjData->scale[0] * staticObjData->scale[1] * staticObjData->scale[2] * staticObjData->boundingVolume.sphere.mass;
|
|
||||||
|
|
||||||
//Radius scaled
|
|
||||||
rigidBodyRadius = (staticObjData->scale[0] * staticObjData->scale[1] * staticObjData->scale[2] / 3) * staticObjData->boundingVolume.sphere.radius;
|
|
||||||
|
|
||||||
//create the rigid body
|
|
||||||
rigidBody_Static = API::Instance().AddCollisionSphere( rigidBodyRadius , rigidWorldRotation , rigidWorldPos , rigidBodyMass, staticObjData->boundingVolume.sphere.restitutionCoeff , staticObjData->boundingVolume.sphere.frictionCoeffStatic , staticObjData->boundingVolume.sphere.frictionCoeffDynamic);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
else if(staticObjData->boundingVolume.geoType == CollisionGeometryType_Box)
|
else if(staticObjData->boundingVolume.geoType == CollisionGeometryType_Box)
|
||||||
{
|
{
|
||||||
//offset the rigidPosition from modelspace to worldspace;
|
|
||||||
rigidWorldPos = (Oyster::Math::Float3)staticObjData->position + (Oyster::Math::Float3)staticObjData->boundingVolume.box.position;
|
|
||||||
//scales the position so the collision geomentry is in the right place
|
|
||||||
rigidWorldPos = rigidWorldPos * staticObjData->scale;
|
|
||||||
|
|
||||||
//offset the rigidRotation from modelspace to worldspace;
|
rigidBody_Static = InitRigidBodySphere(staticObjData);
|
||||||
rigidWorldRotation = (Oyster::Math::Float4)staticObjData->rotation + (Oyster::Math::Float4)staticObjData->boundingVolume.box.rotation;
|
|
||||||
|
|
||||||
//mass scaled
|
|
||||||
rigidBodyMass = staticObjData->scale[0] * staticObjData->scale[1] * staticObjData->scale[2] * staticObjData->boundingVolume.box.mass;
|
|
||||||
|
|
||||||
//size scaled
|
|
||||||
rigidBodySize = (Oyster::Math::Float3)staticObjData->boundingVolume.box.size * (Oyster::Math::Float3)staticObjData->scale;
|
|
||||||
|
|
||||||
//create the rigid body
|
|
||||||
rigidBody_Static = API::Instance().AddCollisionBox(rigidBodySize , rigidWorldRotation , rigidWorldPos , rigidBodyMass, staticObjData->boundingVolume.box.restitutionCoeff , staticObjData->boundingVolume.box.frictionCoeffStatic , staticObjData->boundingVolume.box.frictionCoeffDynamic);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
else if(staticObjData->boundingVolume.geoType == CollisionGeometryType_Cylinder)
|
else if(staticObjData->boundingVolume.geoType == CollisionGeometryType_Cylinder)
|
||||||
{
|
{
|
||||||
|
//rigidBody_Static = InitRigidBodyCylinder(staticObjData);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// add rigidbody to the logical obj
|
|
||||||
// Object::DefaultCollisionBefore, Object::DefaultCollisionAfter for now, gamelogic will take care of this
|
|
||||||
// set object_type to objID
|
|
||||||
|
|
||||||
if(rigidBody_Static != NULL)
|
if(rigidBody_Static != NULL)
|
||||||
{
|
{
|
||||||
this->staticObjects.Push(new StaticObject(rigidBody_Static, Object::DefaultCollisionAfter, (ObjectSpecialType)staticObjData->specialTypeID));
|
this->staticObjects.Push(new StaticObject(rigidBody_Static, Object::DefaultCollisionAfter, (ObjectSpecialType)staticObjData->specialTypeID, 0));
|
||||||
this->staticObjects[staticObjCount]->objectID = modelCount++;
|
//this->staticObjects[staticObjCount]->objectID = modelCount++;
|
||||||
rigidBody_Static->SetCustomTag(this->staticObjects[staticObjCount]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -150,61 +255,26 @@ void Level::InitiateLevel(std::string levelPath)
|
||||||
ICustomBody* rigidBody_Dynamic = NULL;
|
ICustomBody* rigidBody_Dynamic = NULL;
|
||||||
|
|
||||||
// collision shape
|
// collision shape
|
||||||
// radius, rotation in world, position in world, mass, restitution, static and dynamic friction
|
|
||||||
if(dynamicObjData->boundingVolume.geoType == CollisionGeometryType_Sphere)
|
if(dynamicObjData->boundingVolume.geoType == CollisionGeometryType_Sphere)
|
||||||
{
|
{
|
||||||
//offset the rigidPosition from modelspace to worldspace;
|
rigidBody_Dynamic = InitRigidBodySphere(dynamicObjData);
|
||||||
rigidWorldPos = (Oyster::Math::Float3)dynamicObjData->position + (Oyster::Math::Float3)dynamicObjData->boundingVolume.sphere.position;
|
|
||||||
//scales the position so the collision geomentry is in the right place
|
|
||||||
rigidWorldPos = rigidWorldPos * dynamicObjData->scale;
|
|
||||||
|
|
||||||
//offset the rigidRotation from modelspace to worldspace;
|
|
||||||
rigidWorldRotation = (Oyster::Math::Float4)dynamicObjData->rotation + (Oyster::Math::Float4)dynamicObjData->boundingVolume.sphere.rotation;
|
|
||||||
|
|
||||||
//mass scaled
|
|
||||||
rigidBodyMass = dynamicObjData->scale[0] * dynamicObjData->scale[1] * dynamicObjData->scale[2] * dynamicObjData->boundingVolume.sphere.mass;
|
|
||||||
|
|
||||||
//size scaled
|
|
||||||
rigidBodyRadius = (dynamicObjData->scale[0] * dynamicObjData->scale[1] * dynamicObjData->scale[2] / 3) * dynamicObjData->boundingVolume.sphere.radius;
|
|
||||||
|
|
||||||
//create the rigid body
|
|
||||||
rigidBody_Dynamic = API::Instance().AddCollisionBox(rigidBodyRadius , rigidWorldRotation , rigidWorldPos , rigidBodyMass, dynamicObjData->boundingVolume.sphere.restitutionCoeff , dynamicObjData->boundingVolume.sphere.frictionCoeffStatic , dynamicObjData->boundingVolume.sphere.frictionCoeffDynamic);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
else if(dynamicObjData->boundingVolume.geoType == CollisionGeometryType_Box)
|
else if(dynamicObjData->boundingVolume.geoType == CollisionGeometryType_Box)
|
||||||
{
|
{
|
||||||
//offset the rigidPosition from modelspace to worldspace;
|
rigidBody_Dynamic = InitRigidBodyCube(dynamicObjData);
|
||||||
rigidWorldPos = (Oyster::Math::Float3)dynamicObjData->position + (Oyster::Math::Float3)dynamicObjData->boundingVolume.box.position;
|
|
||||||
//scales the position so the collision geomentry is in the right place
|
|
||||||
rigidWorldPos = rigidWorldPos * dynamicObjData->scale;
|
|
||||||
|
|
||||||
//offset the rigidRotation from modelspace to worldspace;
|
|
||||||
rigidWorldRotation = (Oyster::Math::Float4)dynamicObjData->rotation + (Oyster::Math::Float4)dynamicObjData->boundingVolume.box.rotation;
|
|
||||||
|
|
||||||
//mass scaled
|
|
||||||
rigidBodyMass = dynamicObjData->scale[0] * dynamicObjData->scale[1] * dynamicObjData->scale[2] * dynamicObjData->boundingVolume.box.mass;
|
|
||||||
|
|
||||||
//size scaled
|
|
||||||
rigidBodySize = (Oyster::Math::Float3)dynamicObjData->boundingVolume.box.size * (Oyster::Math::Float3)dynamicObjData->scale;
|
|
||||||
|
|
||||||
//create the rigid body
|
|
||||||
rigidBody_Dynamic = API::Instance().AddCollisionBox(rigidBodySize , rigidWorldRotation , rigidWorldPos , rigidBodyMass, dynamicObjData->boundingVolume.box.restitutionCoeff , dynamicObjData->boundingVolume.box.frictionCoeffStatic , dynamicObjData->boundingVolume.box.frictionCoeffDynamic);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
else if(dynamicObjData->boundingVolume.geoType == CollisionGeometryType_Cylinder)
|
else if(dynamicObjData->boundingVolume.geoType == CollisionGeometryType_Cylinder)
|
||||||
{
|
{
|
||||||
|
//rigidBody_Dynamic = InitRigidBodyCylinder(dynamicObjData);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// add rigidbody to the logical obj
|
|
||||||
// Object::DefaultCollisionBefore, Object::DefaultCollisionAfter for now, gamelogic will take care of this
|
|
||||||
// set object_type to objID
|
|
||||||
if(rigidBody_Dynamic != NULL)
|
if(rigidBody_Dynamic != NULL)
|
||||||
{
|
{
|
||||||
this->dynamicObjects.Push(new DynamicObject(rigidBody_Dynamic , Object::DefaultCollisionAfter, (ObjectSpecialType)dynamicObjData->specialTypeID));
|
|
||||||
this->dynamicObjects[dynamicObjCount]->objectID = modelCount++;
|
this->dynamicObjects.Push(new DynamicObject(rigidBody_Dynamic , Object::DefaultCollisionAfter, (ObjectSpecialType)dynamicObjData->specialTypeID, 0));
|
||||||
rigidBody_Dynamic->SetCustomTag(this->dynamicObjects[dynamicObjCount]);
|
//this->dynamicObjects[dynamicObjCount]->objectID = modelCount++;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -225,9 +295,9 @@ void Level::InitiateLevel(float radius)
|
||||||
// add level sphere
|
// add level sphere
|
||||||
ICustomBody* rigidBody = API::Instance().AddCollisionSphere(599.2f, Oyster::Math::Float4(0, 0, 0, 1), Oyster::Math::Float3(0, 0, 0), 0, 0.5f, 0.8f, 0.6f);
|
ICustomBody* rigidBody = API::Instance().AddCollisionSphere(599.2f, Oyster::Math::Float4(0, 0, 0, 1), Oyster::Math::Float3(0, 0, 0), 0, 0.5f, 0.8f, 0.6f);
|
||||||
|
|
||||||
levelObj = new StaticObject(rigidBody, LevelCollisionAfter, ObjectSpecialType_World);
|
levelObj = new StaticObject(rigidBody, LevelCollisionAfter, ObjectSpecialType_World, idCount++);
|
||||||
|
|
||||||
this->levelObj->objectID = idCount++;
|
//this->levelObj->objectID = idCount++;
|
||||||
rigidBody->SetCustomTag(levelObj);
|
rigidBody->SetCustomTag(levelObj);
|
||||||
|
|
||||||
|
|
||||||
|
@ -239,9 +309,9 @@ void Level::InitiateLevel(float radius)
|
||||||
{
|
{
|
||||||
rigidBody_TestBox = API::Instance().AddCollisionBox(Oyster::Math::Float3(0.5f, 0.5f, 0.5f), Oyster::Math::Float4(0, 0, 0, 1), Oyster::Math::Float3(0, 605 + i*5, 10), 5, 0.5f, 0.8f, 0.6f);
|
rigidBody_TestBox = API::Instance().AddCollisionBox(Oyster::Math::Float3(0.5f, 0.5f, 0.5f), Oyster::Math::Float4(0, 0, 0, 1), Oyster::Math::Float3(0, 605 + i*5, 10), 5, 0.5f, 0.8f, 0.6f);
|
||||||
|
|
||||||
this->dynamicObjects.Push(new DynamicObject(rigidBody_TestBox, Object::DefaultCollisionAfter, ObjectSpecialType_StandarsBox));
|
this->dynamicObjects.Push(new DynamicObject(rigidBody_TestBox, Object::DefaultCollisionAfter, ObjectSpecialType_StandardBox, idCount++));
|
||||||
|
|
||||||
this->dynamicObjects[i]->objectID = idCount++;
|
//this->dynamicObjects[i]->objectID = idCount++;
|
||||||
rigidBody_TestBox->SetCustomTag(this->dynamicObjects[i]);
|
rigidBody_TestBox->SetCustomTag(this->dynamicObjects[i]);
|
||||||
}
|
}
|
||||||
/*offset += nrOfBoxex;
|
/*offset += nrOfBoxex;
|
||||||
|
@ -278,24 +348,24 @@ void Level::InitiateLevel(float radius)
|
||||||
// add crystal
|
// add crystal
|
||||||
ICustomBody* rigidBody_Crystal = API::Instance().AddCollisionBox(Oyster::Math::Float3(0.5f, 0.5f, 0.5f), Oyster::Math::Float4(0, 0, 0, 1), Oyster::Math::Float3(10, 605, 0), 5, 0.5f, 0.8f, 0.6f);
|
ICustomBody* rigidBody_Crystal = API::Instance().AddCollisionBox(Oyster::Math::Float3(0.5f, 0.5f, 0.5f), Oyster::Math::Float4(0, 0, 0, 1), Oyster::Math::Float3(10, 605, 0), 5, 0.5f, 0.8f, 0.6f);
|
||||||
|
|
||||||
this->dynamicObjects.Push(new DynamicObject(rigidBody_Crystal, Object::DefaultCollisionAfter, ObjectSpecialType_StandarsBox));
|
this->dynamicObjects.Push(new DynamicObject(rigidBody_Crystal, Object::DefaultCollisionAfter, ObjectSpecialType_StandardBox, idCount++));
|
||||||
rigidBody_Crystal->SetCustomTag(this->dynamicObjects[nrOfBoxex]);
|
rigidBody_Crystal->SetCustomTag(this->dynamicObjects[nrOfBoxex]);
|
||||||
this->dynamicObjects[nrOfBoxex]->objectID = idCount++;
|
//this->dynamicObjects[nrOfBoxex]->objectID = idCount++;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// add house
|
// add house
|
||||||
ICustomBody* rigidBody_House =API::Instance().AddCollisionBox(Oyster::Math::Float3(20, 20, 20), Oyster::Math::Float4(0, 0, 0, 1), Oyster::Math::Float3(-50, 590, 0), 0, 0.5f, 0.8f, 0.6f);
|
ICustomBody* rigidBody_House =API::Instance().AddCollisionBox(Oyster::Math::Float3(20, 20, 20), Oyster::Math::Float4(0, 0, 0, 1), Oyster::Math::Float3(-50, 590, 0), 0, 0.5f, 0.8f, 0.6f);
|
||||||
this->staticObjects.Push(new StaticObject(rigidBody_House, Object::DefaultCollisionAfter, ObjectSpecialType_Generic));
|
this->staticObjects.Push(new StaticObject(rigidBody_House, Object::DefaultCollisionAfter, ObjectSpecialType_Generic, idCount++));
|
||||||
rigidBody_House->SetCustomTag(this->staticObjects[0]);
|
rigidBody_House->SetCustomTag(this->staticObjects[0]);
|
||||||
this->staticObjects[0]->objectID = idCount++;
|
//this->staticObjects[0]->objectID = idCount++;
|
||||||
|
|
||||||
// add jumppad
|
// add jumppad
|
||||||
ICustomBody* rigidBody_Jumppad = API::Instance().AddCollisionBox(Oyster::Math::Float3(1, 1, 1), Oyster::Math::Float4(0, 0, 0, 1), Oyster::Math::Float3(4, 600.3, 0), 5, 0.5f, 0.8f, 0.6f);
|
ICustomBody* rigidBody_Jumppad = API::Instance().AddCollisionBox(Oyster::Math::Float3(1, 1, 1), Oyster::Math::Float4(0, 0, 0, 1), Oyster::Math::Float3(4, 600.3, 0), 5, 0.5f, 0.8f, 0.6f);
|
||||||
|
|
||||||
this->staticObjects.Push(new JumpPad(rigidBody_Jumppad, JumpPad::JumpPadActivated, ObjectSpecialType_JumpPad, Oyster::Math::Float3(0,2000,0)));
|
this->staticObjects.Push(new JumpPad(rigidBody_Jumppad, ObjectSpecialType_JumpPad,idCount++ ,Oyster::Math::Float3(0,2000,0)));
|
||||||
rigidBody_Jumppad->SetCustomTag(this->staticObjects[1]);
|
rigidBody_Jumppad->SetCustomTag(this->staticObjects[1]);
|
||||||
this->staticObjects[1]->objectID = idCount++;
|
//this->staticObjects[1]->objectID = idCount++;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Level::AddPlayerToTeam(Player *player, int teamID)
|
void Level::AddPlayerToTeam(Player *player, int teamID)
|
||||||
|
|
|
@ -32,9 +32,10 @@ namespace GameLogic
|
||||||
********************************************************/
|
********************************************************/
|
||||||
void InitiateLevel(std::string levelPath);
|
void InitiateLevel(std::string levelPath);
|
||||||
void InitiateLevel(float radius);
|
void InitiateLevel(float radius);
|
||||||
|
Oyster::Physics::ICustomBody* InitRigidBodyCube( const ObjectHeader* obj);
|
||||||
|
Oyster::Physics::ICustomBody* InitRigidBodySphere( const ObjectHeader* obj);
|
||||||
|
|
||||||
void parseObjectType(ObjectTypeHeader* obj);
|
Object* createGameObj(ObjectHeader* obj, Oyster::Physics::ICustomBody* rigidBody);
|
||||||
void parsePhysicsObj(LevelLoaderInternal::BoundingVolumeBase* obj);
|
|
||||||
/********************************************************
|
/********************************************************
|
||||||
* Creates a team in the level
|
* Creates a team in the level
|
||||||
* @param teamSize: The size of the team you want to create
|
* @param teamSize: The size of the team you want to create
|
||||||
|
|
|
@ -75,7 +75,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:
|
||||||
{
|
{
|
||||||
|
|
|
@ -30,7 +30,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,
|
||||||
|
|
|
@ -149,7 +149,7 @@ namespace GameLogic
|
||||||
//Läs in filen.
|
//Läs in filen.
|
||||||
int fileLength = 0;
|
int fileLength = 0;
|
||||||
Loader loader;
|
Loader loader;
|
||||||
char* buf = loader.LoadFile("C:/Users/Sam/Documents/GitHub/Danbias/Bin/Content/worlds/cgf/"+ fileName, fileLength);
|
char* buf = loader.LoadFile("../Content/Worlds/cgf/"+ fileName, fileLength);
|
||||||
|
|
||||||
start = 0;
|
start = 0;
|
||||||
LevelLoaderInternal::FormatVersion version;
|
LevelLoaderInternal::FormatVersion version;
|
||||||
|
|
|
@ -19,55 +19,28 @@ Object::Object()
|
||||||
this->rigidBody = API::Instance().AddCollisionBox(Oyster::Math::Float3(0.0f, 0.0f, 0.0f), Oyster::Math::Float4(0, 0, 0, 1), Oyster::Math::Float3(0, 0, 0), 0, 0.5f, 0.8f, 0.6f);
|
this->rigidBody = API::Instance().AddCollisionBox(Oyster::Math::Float3(0.0f, 0.0f, 0.0f), Oyster::Math::Float4(0, 0, 0, 1), Oyster::Math::Float3(0, 0, 0), 0, 0.5f, 0.8f, 0.6f);
|
||||||
|
|
||||||
this->type = ObjectSpecialType_Unknown;
|
this->type = ObjectSpecialType_Unknown;
|
||||||
this->objectID = GID();
|
this->objectID = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
Object::Object(ObjectSpecialType type)
|
Object::Object(Oyster::Physics::ICustomBody *rigidBody, void (*collisionFuncAfter)(Oyster::Physics::ICustomBody *proto,Oyster::Physics::ICustomBody *deuter,Oyster::Math::Float kineticEnergyLoss), ObjectSpecialType type, int objectID)
|
||||||
{
|
|
||||||
this->rigidBody = API::Instance().AddCollisionBox(Oyster::Math::Float3(0.0f, 0.0f, 0.0f), Oyster::Math::Float4(0, 0, 0, 1), Oyster::Math::Float3(0, 0, 0), 0, 0.5f, 0.8f, 0.6f);
|
|
||||||
this->type = type;
|
|
||||||
this->objectID = GID();
|
|
||||||
}
|
|
||||||
|
|
||||||
Object::Object(Oyster::Physics::ICustomBody *rigidBody, ObjectSpecialType type)
|
|
||||||
{
|
|
||||||
this->rigidBody = rigidBody;
|
|
||||||
this->type = type;
|
|
||||||
this->objectID = GID();
|
|
||||||
}
|
|
||||||
|
|
||||||
Object::Object( void* collisionFuncAfter, ObjectSpecialType type)
|
|
||||||
|
|
||||||
{
|
|
||||||
this->rigidBody = API::Instance().AddCollisionBox(Oyster::Math::Float3(0.0f, 0.0f, 0.0f), Oyster::Math::Float4(0, 0, 0, 1), Oyster::Math::Float3(0, 0, 0), 0, 0.5f, 0.8f, 0.6f);
|
|
||||||
|
|
||||||
this->type = type;
|
|
||||||
this->objectID = GID();
|
|
||||||
}
|
|
||||||
|
|
||||||
Object::Object(Oyster::Physics::ICustomBody *rigidBody, void* collisionFuncAfter, ObjectSpecialType type)
|
|
||||||
{
|
{
|
||||||
this->rigidBody = rigidBody;
|
this->rigidBody = rigidBody;
|
||||||
this->rigidBody->SetSubscription((Oyster::Physics::ICustomBody::EventAction_AfterCollisionResponse)(collisionFuncAfter));
|
this->rigidBody->SetSubscription((Oyster::Physics::ICustomBody::EventAction_AfterCollisionResponse)(collisionFuncAfter));
|
||||||
this->type = type;
|
this->type = type;
|
||||||
this->objectID = GID();
|
this->objectID = objectID;
|
||||||
|
this->rigidBody->SetCustomTag(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Object::Object(Oyster::Physics::ICustomBody *rigidBody , Oyster::Physics::ICustomBody::SubscriptMessage (*collisionFuncAfter)(Oyster::Physics::ICustomBody *proto,Oyster::Physics::ICustomBody *deuter,Oyster::Math::Float kineticEnergyLoss), ObjectSpecialType type)
|
Object::Object(Oyster::Physics::ICustomBody *rigidBody , Oyster::Physics::ICustomBody::SubscriptMessage (*collisionFuncAfter)(Oyster::Physics::ICustomBody *proto,Oyster::Physics::ICustomBody *deuter,Oyster::Math::Float kineticEnergyLoss), ObjectSpecialType type, int objectID)
|
||||||
{
|
{
|
||||||
this->rigidBody = rigidBody;
|
this->rigidBody = rigidBody;
|
||||||
this->rigidBody->SetSubscription((Oyster::Physics::ICustomBody::EventAction_AfterCollisionResponse)(collisionFuncAfter));
|
this->rigidBody->SetSubscription((Oyster::Physics::ICustomBody::EventAction_AfterCollisionResponse)(collisionFuncAfter));
|
||||||
this->type = type;
|
this->type = type;
|
||||||
this->objectID = GID();
|
this->objectID = objectID;
|
||||||
|
this->rigidBody->SetCustomTag(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Object::ApplyLinearImpulse(Oyster::Math::Float3 force)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Object::~Object(void)
|
Object::~Object(void)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
|
@ -18,11 +18,9 @@ namespace GameLogic
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Object();
|
Object();
|
||||||
Object(ObjectSpecialType type);
|
|
||||||
Object(Oyster::Physics::ICustomBody *rigidBody, ObjectSpecialType type);
|
Object(Oyster::Physics::ICustomBody *rigidBody, void (*collisionFuncAfter)(Oyster::Physics::ICustomBody *proto,Oyster::Physics::ICustomBody *deuter,Oyster::Math::Float kineticEnergyLoss), ObjectSpecialType type, int objectID);
|
||||||
Object(void* collisionFuncAfter, ObjectSpecialType type);
|
Object(Oyster::Physics::ICustomBody *rigidBody, Oyster::Physics::ICustomBody::SubscriptMessage (*collisionFuncAfter)(Oyster::Physics::ICustomBody *proto,Oyster::Physics::ICustomBody *deuter,Oyster::Math::Float kineticEnergyLoss), ObjectSpecialType type, int objectID);
|
||||||
Object(Oyster::Physics::ICustomBody *rigidBody, void* collisionFuncAfter, ObjectSpecialType type);
|
|
||||||
Object(Oyster::Physics::ICustomBody *rigidBody, Oyster::Physics::ICustomBody::SubscriptMessage (*collisionFuncAfter)(Oyster::Physics::ICustomBody *proto,Oyster::Physics::ICustomBody *deuter,Oyster::Math::Float kineticEnergyLoss), ObjectSpecialType type);
|
|
||||||
~Object(void);
|
~Object(void);
|
||||||
|
|
||||||
ObjectSpecialType GetObjectType() const override;
|
ObjectSpecialType GetObjectType() const override;
|
||||||
|
@ -38,7 +36,6 @@ namespace GameLogic
|
||||||
|
|
||||||
|
|
||||||
Oyster::Physics::ICustomBody* GetRigidBody();
|
Oyster::Physics::ICustomBody* GetRigidBody();
|
||||||
void ApplyLinearImpulse(Oyster::Math::Float3 force);
|
|
||||||
|
|
||||||
virtual void BeginFrame();
|
virtual void BeginFrame();
|
||||||
virtual void EndFrame();
|
virtual void EndFrame();
|
||||||
|
@ -50,8 +47,7 @@ namespace GameLogic
|
||||||
|
|
||||||
|
|
||||||
public: //TODO: Hax This should be private when level is dynamic
|
public: //TODO: Hax This should be private when level is dynamic
|
||||||
ObjectSpecialType type;
|
|
||||||
int objectID;
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
Oyster::Physics::ICustomBody *rigidBody;
|
Oyster::Physics::ICustomBody *rigidBody;
|
||||||
|
@ -59,6 +55,9 @@ namespace GameLogic
|
||||||
static const Game* gameInstance;
|
static const Game* gameInstance;
|
||||||
Oyster::Math::Float3 currLook;
|
Oyster::Math::Float3 currLook;
|
||||||
Oyster::Math::Float3 newLook;
|
Oyster::Math::Float3 newLook;
|
||||||
|
|
||||||
|
ObjectSpecialType type;
|
||||||
|
int objectID;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,34 +13,9 @@ Player::Player()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
Player::Player(ObjectSpecialType type)
|
|
||||||
:DynamicObject(type)
|
|
||||||
{
|
|
||||||
InitPlayer();
|
|
||||||
}
|
|
||||||
Player::Player(Oyster::Physics::ICustomBody *rigidBody, ObjectSpecialType type)
|
|
||||||
:DynamicObject(rigidBody,type)
|
|
||||||
{
|
|
||||||
InitPlayer();
|
|
||||||
}
|
|
||||||
|
|
||||||
Player::Player( void* collisionFuncAfter, ObjectSpecialType type)
|
Player::Player(Oyster::Physics::ICustomBody *rigidBody, void (*EventOnCollision)(Oyster::Physics::ICustomBody *proto,Oyster::Physics::ICustomBody *deuter,Oyster::Math::Float kineticEnergyLoss), ObjectSpecialType type, int objectID, int teamID)
|
||||||
:DynamicObject(collisionFuncAfter,type)
|
:DynamicObject(rigidBody, EventOnCollision, type, objectID)
|
||||||
{
|
|
||||||
InitPlayer();
|
|
||||||
}
|
|
||||||
Player::Player(Oyster::Physics::ICustomBody *rigidBody, void* collisionFuncAfter, ObjectSpecialType type)
|
|
||||||
:DynamicObject(rigidBody, collisionFuncAfter, type)
|
|
||||||
{
|
|
||||||
InitPlayer();
|
|
||||||
}
|
|
||||||
Player::Player(Oyster::Physics::ICustomBody *rigidBody, Oyster::Physics::ICustomBody::SubscriptMessage (*collisionFuncAfter)(Oyster::Physics::ICustomBody *proto,Oyster::Physics::ICustomBody *deuter,Oyster::Math::Float kineticEnergyLoss), ObjectSpecialType type)
|
|
||||||
:DynamicObject(rigidBody, collisionFuncAfter, type)
|
|
||||||
{
|
|
||||||
InitPlayer();
|
|
||||||
}
|
|
||||||
|
|
||||||
void Player::InitPlayer()
|
|
||||||
{
|
{
|
||||||
weapon = new Weapon(2,this);
|
weapon = new Weapon(2,this);
|
||||||
|
|
||||||
|
@ -55,6 +30,36 @@ void Player::InitPlayer()
|
||||||
key_strafeLeft = 0;
|
key_strafeLeft = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Player::Player(Oyster::Physics::ICustomBody *rigidBody, Oyster::Physics::ICustomBody::SubscriptMessage (*EventOnCollision)(Oyster::Physics::ICustomBody *proto,Oyster::Physics::ICustomBody *deuter,Oyster::Math::Float kineticEnergyLoss), ObjectSpecialType type, int objectID, int teamID)
|
||||||
|
:DynamicObject(rigidBody, EventOnCollision, type, objectID)
|
||||||
|
{
|
||||||
|
this->rigidBody = rigidBody;
|
||||||
|
|
||||||
|
Oyster::Math::Float3 centerPosition = Oyster::Math::Float3(0,400,0);
|
||||||
|
|
||||||
|
Oyster::Math::Float3 size = Oyster::Math::Float3(0.25f,1.0f,0.5f);
|
||||||
|
Oyster::Math::Float mass = 60;
|
||||||
|
Oyster::Math::Float restitutionCoeff = 0.5;
|
||||||
|
Oyster::Math::Float frictionCoeff_Static = 0.4;
|
||||||
|
Oyster::Math::Float frictionCoeff_Dynamic = 0.3;
|
||||||
|
|
||||||
|
|
||||||
|
this->rigidBody = Oyster::Physics::API::Instance().AddCollisionBox(size, Oyster::Math::Float4(0, 0, 0, 1), centerPosition, mass, 0.5f, 0.8f, 0.6f );
|
||||||
|
this->rigidBody->SetAngularFactor(0.0f);
|
||||||
|
|
||||||
|
weapon = new Weapon(2,this);
|
||||||
|
|
||||||
|
this->life = 100;
|
||||||
|
this->teamID = teamID;
|
||||||
|
this->playerState = PLAYER_STATE_IDLE;
|
||||||
|
this->lookDir = Oyster::Math::Float3(0,0,-1);
|
||||||
|
this->moveDir = Oyster::Math::Float3(0,0,0);
|
||||||
|
key_forward = 0;
|
||||||
|
key_backward = 0;
|
||||||
|
key_strafeRight = 0;
|
||||||
|
key_strafeLeft = 0;
|
||||||
|
}
|
||||||
|
|
||||||
Player::~Player(void)
|
Player::~Player(void)
|
||||||
{
|
{
|
||||||
if(weapon)
|
if(weapon)
|
||||||
|
|
|
@ -16,14 +16,11 @@ namespace GameLogic
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Player(void);
|
Player(void);
|
||||||
Player(ObjectSpecialType type);
|
|
||||||
Player(Oyster::Physics::ICustomBody *rigidBody, ObjectSpecialType type);
|
Player(Oyster::Physics::ICustomBody *rigidBody, void (*EventOnCollision)(Oyster::Physics::ICustomBody *proto,Oyster::Physics::ICustomBody *deuter,Oyster::Math::Float kineticEnergyLoss), ObjectSpecialType type, int objectID, int teamID);
|
||||||
Player( void* collisionFuncAfter, ObjectSpecialType type);
|
Player(Oyster::Physics::ICustomBody *rigidBody, Oyster::Physics::ICustomBody::SubscriptMessage (*EventOnCollision)(Oyster::Physics::ICustomBody *proto,Oyster::Physics::ICustomBody *deuter,Oyster::Math::Float kineticEnergyLoss), ObjectSpecialType type, int objectID, int teamID);
|
||||||
Player(Oyster::Physics::ICustomBody *rigidBody, void* collisionFuncAfter, ObjectSpecialType type);
|
|
||||||
Player(Oyster::Physics::ICustomBody *rigidBody, Oyster::Physics::ICustomBody::SubscriptMessage (*collisionFuncAfter)(Oyster::Physics::ICustomBody *proto,Oyster::Physics::ICustomBody *deuter,Oyster::Math::Float kineticEnergyLoss), ObjectSpecialType type);
|
|
||||||
|
|
||||||
~Player(void);
|
~Player(void);
|
||||||
void InitPlayer();
|
|
||||||
|
|
||||||
/********************************************************
|
/********************************************************
|
||||||
* Moves the player based on input
|
* Moves the player based on input
|
||||||
|
@ -81,7 +78,7 @@ namespace GameLogic
|
||||||
void Jump();
|
void Jump();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int life;
|
Oyster::Math::Float life;
|
||||||
int teamID;
|
int teamID;
|
||||||
Weapon *weapon;
|
Weapon *weapon;
|
||||||
PLAYER_STATE playerState;
|
PLAYER_STATE playerState;
|
||||||
|
|
|
@ -9,8 +9,13 @@ Portal::Portal(void)
|
||||||
this->portalExit = Float3(0,0,0);
|
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)
|
<<<<<<< HEAD
|
||||||
|
Portal::Portal(Oyster::Physics::ICustomBody *rigidBody, void (*collisionFuncAfter)(Oyster::Physics::ICustomBody *proto,Oyster::Physics::ICustomBody *deuter,Oyster::Math::Float kineticEnergyLoss), ObjectSpecialType type, Oyster::Math::Float3 portalExit)
|
||||||
:StaticObject(rigidBody, collisionFuncAfter, type)
|
:StaticObject(rigidBody, collisionFuncAfter, type)
|
||||||
|
=======
|
||||||
|
Portal::Portal(Oyster::Physics::ICustomBody *rigidBody, void (*EventOnCollision)(Oyster::Physics::ICustomBody *proto,Oyster::Physics::ICustomBody *deuter,Oyster::Math::Float kineticEnergyLoss), ObjectSpecialType type,int objectID ,Oyster::Math::Float3 portalExit)
|
||||||
|
:StaticObject(rigidBody, EventOnCollision, type, objectID)
|
||||||
|
>>>>>>> GL - fixed constructors to ease creation of objects, also fixed weapon crash on destruction
|
||||||
{
|
{
|
||||||
this->portalExit = portalExit;
|
this->portalExit = portalExit;
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,8 +9,8 @@ namespace GameLogic
|
||||||
Portal(void);
|
Portal(void);
|
||||||
|
|
||||||
Portal(Oyster::Physics::ICustomBody *rigidBody
|
Portal(Oyster::Physics::ICustomBody *rigidBody
|
||||||
,void (*collisionFuncAfter)(Oyster::Physics::ICustomBody *proto,Oyster::Physics::ICustomBody *deuter,Oyster::Math::Float kineticEnergyLoss)
|
,void (*EventOnCollision)(Oyster::Physics::ICustomBody *proto,Oyster::Physics::ICustomBody *deuter,Oyster::Math::Float kineticEnergyLoss)
|
||||||
,OBJECT_TYPE type, Oyster::Math::Float3 portalExit);
|
,ObjectSpecialType type,int objectID ,Oyster::Math::Float3 portalExit);
|
||||||
|
|
||||||
~Portal(void);
|
~Portal(void);
|
||||||
|
|
||||||
|
|
|
@ -10,32 +10,17 @@ StaticObject::StaticObject()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
StaticObject::StaticObject(ObjectSpecialType type)
|
|
||||||
:Object(type)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
StaticObject::StaticObject(Oyster::Physics::ICustomBody *rigidBody , void (*EventOnCollision)(Oyster::Physics::ICustomBody *proto,Oyster::Physics::ICustomBody *deuter,Oyster::Math::Float kineticEnergyLoss), ObjectSpecialType type, int objectID)
|
||||||
StaticObject::StaticObject(Oyster::Physics::ICustomBody *rigidBody, ObjectSpecialType type)
|
:Object(rigidBody, EventOnCollision, type, objectID)
|
||||||
:Object(rigidBody,type)
|
|
||||||
{
|
{
|
||||||
//this->rigidBody->SetGravity(true);
|
//use setMass(when it is made) and set the mass to 0 in order to ensure that the object is static
|
||||||
//this->rigidBody->SetSubscription((Oyster::Physics::ICustomBody::EventAction_BeforeCollisionResponse)(CollisionManager::IgnoreCollision));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
StaticObject::StaticObject( void* collisionFuncAfter, ObjectSpecialType type)
|
StaticObject::StaticObject(Oyster::Physics::ICustomBody *rigidBody , Oyster::Physics::ICustomBody::SubscriptMessage (*EventOnCollision)(Oyster::Physics::ICustomBody *proto,Oyster::Physics::ICustomBody *deuter,Oyster::Math::Float kineticEnergyLoss), ObjectSpecialType type, int objectID)
|
||||||
:Object(collisionFuncAfter,type)
|
:Object(rigidBody, EventOnCollision, type, objectID)
|
||||||
{
|
{
|
||||||
|
//use setMass(when it is made) and set the mass to 0 in order to ensure that the object is static
|
||||||
}
|
|
||||||
StaticObject::StaticObject(Oyster::Physics::ICustomBody *rigidBody , void* collisionFuncAfter, ObjectSpecialType type)
|
|
||||||
:Object(rigidBody, collisionFuncAfter, type)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
StaticObject::StaticObject(Oyster::Physics::ICustomBody *rigidBody , Oyster::Physics::ICustomBody::SubscriptMessage (*collisionFuncAfter)(Oyster::Physics::ICustomBody *proto,Oyster::Physics::ICustomBody *deuter,Oyster::Math::Float kineticEnergyLoss), ObjectSpecialType type)
|
|
||||||
:Object(rigidBody, collisionFuncAfter, type)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
StaticObject::~StaticObject(void)
|
StaticObject::~StaticObject(void)
|
||||||
|
|
|
@ -18,11 +18,8 @@ namespace GameLogic
|
||||||
public:
|
public:
|
||||||
StaticObject();
|
StaticObject();
|
||||||
|
|
||||||
StaticObject(ObjectSpecialType type);
|
StaticObject(Oyster::Physics::ICustomBody *rigidBody , void (*EventOnCollision)(Oyster::Physics::ICustomBody *proto,Oyster::Physics::ICustomBody *deuter,Oyster::Math::Float kineticEnergyLoss), ObjectSpecialType type, int objectID);
|
||||||
StaticObject(Oyster::Physics::ICustomBody *rigidBody, ObjectSpecialType type);
|
StaticObject(Oyster::Physics::ICustomBody *rigidBody , Oyster::Physics::ICustomBody::SubscriptMessage (*EventOnCollision)(Oyster::Physics::ICustomBody *proto,Oyster::Physics::ICustomBody *deuter,Oyster::Math::Float kineticEnergyLoss), ObjectSpecialType type, int objectID);
|
||||||
StaticObject( void* collisionFuncAfter, ObjectSpecialType type);
|
|
||||||
StaticObject(Oyster::Physics::ICustomBody *rigidBody , void* collisionFuncAfter, ObjectSpecialType type);
|
|
||||||
StaticObject(Oyster::Physics::ICustomBody *rigidBody , Oyster::Physics::ICustomBody::SubscriptMessage (*collisionFuncAfter)(Oyster::Physics::ICustomBody *proto,Oyster::Physics::ICustomBody *deuter,Oyster::Math::Float kineticEnergyLoss), ObjectSpecialType type);
|
|
||||||
|
|
||||||
~StaticObject(void);
|
~StaticObject(void);
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,11 @@ Weapon::Weapon()
|
||||||
Weapon::Weapon(int MaxNrOfSockets,Player *owner)
|
Weapon::Weapon(int MaxNrOfSockets,Player *owner)
|
||||||
{
|
{
|
||||||
attatchmentSockets.Resize(MaxNrOfSockets);
|
attatchmentSockets.Resize(MaxNrOfSockets);
|
||||||
attatchmentSockets[0] = new AttatchmentSocket();
|
for(int i = 0; i < MaxNrOfSockets; i++)
|
||||||
|
{
|
||||||
|
attatchmentSockets[i] = new AttatchmentSocket();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
weaponState = WEAPON_STATE_IDLE;
|
weaponState = WEAPON_STATE_IDLE;
|
||||||
currentNrOfAttatchments = 0;
|
currentNrOfAttatchments = 0;
|
||||||
|
@ -37,10 +41,14 @@ Weapon::Weapon(int MaxNrOfSockets,Player *owner)
|
||||||
Weapon::~Weapon(void)
|
Weapon::~Weapon(void)
|
||||||
{
|
{
|
||||||
for (unsigned int i = 0; i < this->attatchmentSockets.Size(); i++)
|
for (unsigned int i = 0; i < this->attatchmentSockets.Size(); i++)
|
||||||
|
{
|
||||||
|
if(this->attatchmentSockets[i])
|
||||||
{
|
{
|
||||||
delete this->attatchmentSockets[i];
|
delete this->attatchmentSockets[i];
|
||||||
this->attatchmentSockets[i] = 0;
|
this->attatchmentSockets[i] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/********************************************************
|
/********************************************************
|
||||||
|
|
|
@ -15,7 +15,7 @@ EventButtonCollection::EventButtonCollection(EventCollectionState state)
|
||||||
|
|
||||||
EventButtonCollection::~EventButtonCollection()
|
EventButtonCollection::~EventButtonCollection()
|
||||||
{
|
{
|
||||||
for(int i = 0; i < EventHandler::Instance().collections.size(); i++)
|
for(int i = 0; i < (int)EventHandler::Instance().collections.size(); i++)
|
||||||
{
|
{
|
||||||
if(EventHandler::Instance().collections.at(i) == this)
|
if(EventHandler::Instance().collections.at(i) == this)
|
||||||
{
|
{
|
||||||
|
|
|
@ -53,7 +53,7 @@ void EventHandler::RenderText()
|
||||||
|
|
||||||
void EventHandler::AddCollection(EventButtonCollection* collection)
|
void EventHandler::AddCollection(EventButtonCollection* collection)
|
||||||
{
|
{
|
||||||
for(int i = 0; i < collections.size(); i++)
|
for(int i = 0; i < (int)collections.size(); i++)
|
||||||
{
|
{
|
||||||
//Do not add the collection if it's already in the list.
|
//Do not add the collection if it's already in the list.
|
||||||
if(collections.at(i) == collection)
|
if(collections.at(i) == collection)
|
||||||
|
@ -64,7 +64,7 @@ void EventHandler::AddCollection(EventButtonCollection* collection)
|
||||||
|
|
||||||
void EventHandler::ReleaseCollection(EventButtonCollection* collection)
|
void EventHandler::ReleaseCollection(EventButtonCollection* collection)
|
||||||
{
|
{
|
||||||
for(int i = 0; i < collections.size(); i++)
|
for(int i = 0; i < (int)collections.size(); i++)
|
||||||
{
|
{
|
||||||
if(collections.at(i) == collection)
|
if(collections.at(i) == collection)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue