Merge conflict
This commit is contained in:
commit
87dc036cc5
|
@ -78,7 +78,7 @@ namespace DanBias
|
||||||
//if(! data.window->CreateWin(WindowShell::WINDOW_INIT_DESC(L"Window", cPOINT(1600, 900), cPOINT())))
|
//if(! data.window->CreateWin(WindowShell::WINDOW_INIT_DESC(L"Window", cPOINT(1600, 900), cPOINT())))
|
||||||
|
|
||||||
WindowShell::WINDOW_INIT_DESC winDesc;
|
WindowShell::WINDOW_INIT_DESC winDesc;
|
||||||
winDesc.windowSize.x = 1080;
|
winDesc.windowSize.x = 1280;
|
||||||
winDesc.windowSize.y = 720;
|
winDesc.windowSize.y = 720;
|
||||||
winDesc.windowProcCallback = WindowCallBack;
|
winDesc.windowProcCallback = WindowCallBack;
|
||||||
|
|
||||||
|
@ -153,7 +153,7 @@ namespace DanBias
|
||||||
Oyster::Graphics::API::Option p;
|
Oyster::Graphics::API::Option p;
|
||||||
p.modelPath = L"..\\Content\\Models\\";
|
p.modelPath = L"..\\Content\\Models\\";
|
||||||
p.texturePath = L"..\\Content\\Textures\\";
|
p.texturePath = L"..\\Content\\Textures\\";
|
||||||
p.Resolution = Oyster::Math::Float2( 1080.0f, 720.0f );
|
p.Resolution = Oyster::Math::Float2( 1280.0f, 720.0f );
|
||||||
//! @todo fix proper amb value
|
//! @todo fix proper amb value
|
||||||
p.AmbientValue = 1.3f;
|
p.AmbientValue = 1.3f;
|
||||||
|
|
||||||
|
|
|
@ -121,50 +121,50 @@ void GamingUI::ReadKeyInput()
|
||||||
this->key_Jump = false;
|
this->key_Jump = false;
|
||||||
|
|
||||||
// shoot
|
// shoot
|
||||||
if( this->sharedData->mouseDevice->IsBtnDown(::Input::Enum::SAMI_MouseLeftBtn) )
|
//if( this->sharedData->mouseDevice->IsBtnDown(::Input::Enum::SAMI_MouseLeftBtn) )
|
||||||
{
|
//{
|
||||||
if( !this->key_Shoot )
|
// if( !this->key_Shoot )
|
||||||
{
|
// {
|
||||||
Protocol_PlayerShot playerShot;
|
// Protocol_PlayerShot playerShot;
|
||||||
playerShot.primaryPressed = true;
|
// playerShot.primaryPressed = true;
|
||||||
playerShot.secondaryPressed = false;
|
// playerShot.secondaryPressed = false;
|
||||||
playerShot.utilityPressed = false;
|
// playerShot.utilityPressed = false;
|
||||||
this->sharedData->network->Send( playerShot );
|
// this->sharedData->network->Send( playerShot );
|
||||||
this->key_Shoot = true;
|
// this->key_Shoot = true;
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
else
|
//else
|
||||||
this->key_Shoot = false;
|
// this->key_Shoot = false;
|
||||||
|
//
|
||||||
if( this->sharedData->mouseDevice->IsBtnDown(::Input::Enum::SAMI_MouseRightBtn) )
|
//if( this->sharedData->mouseDevice->IsBtnDown(::Input::Enum::SAMI_MouseRightBtn) )
|
||||||
{
|
//{
|
||||||
if( !this->key_Shoot )
|
// if( !this->key_Shoot )
|
||||||
{
|
// {
|
||||||
Protocol_PlayerShot playerShot;
|
// Protocol_PlayerShot playerShot;
|
||||||
playerShot.primaryPressed = false;
|
// playerShot.primaryPressed = false;
|
||||||
playerShot.secondaryPressed = true;
|
// playerShot.secondaryPressed = true;
|
||||||
playerShot.utilityPressed = false;
|
// playerShot.utilityPressed = false;
|
||||||
this->sharedData->network->Send( playerShot );
|
// this->sharedData->network->Send( playerShot );
|
||||||
this->key_Shoot = true;
|
// this->key_Shoot = true;
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
else
|
//else
|
||||||
this->key_Shoot = false;
|
// this->key_Shoot = false;
|
||||||
|
//
|
||||||
if( this->sharedData->mouseDevice->IsBtnDown(::Input::Enum::SAMI_MouseMiddleBtn) )
|
//if( this->sharedData->mouseDevice->IsBtnDown(::Input::Enum::SAMI_MouseMiddleBtn) )
|
||||||
{
|
//{
|
||||||
if( !this->key_Shoot )
|
// if( !this->key_Shoot )
|
||||||
{
|
// {
|
||||||
Protocol_PlayerShot playerShot;
|
// Protocol_PlayerShot playerShot;
|
||||||
playerShot.primaryPressed = false;
|
// playerShot.primaryPressed = false;
|
||||||
playerShot.secondaryPressed = false;
|
// playerShot.secondaryPressed = false;
|
||||||
playerShot.utilityPressed = true;
|
// playerShot.utilityPressed = true;
|
||||||
this->sharedData->network->Send( playerShot );
|
// this->sharedData->network->Send( playerShot );
|
||||||
this->key_Shoot = true;
|
// this->key_Shoot = true;
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
else
|
//else
|
||||||
this->key_Shoot = false;
|
// this->key_Shoot = false;
|
||||||
|
|
||||||
if( this->sharedData->keyboardDevice->IsKeyDown(::Input::Enum::SAKI_Escape) )
|
if( this->sharedData->keyboardDevice->IsKeyDown(::Input::Enum::SAKI_Escape) )
|
||||||
{
|
{
|
||||||
|
@ -176,7 +176,36 @@ void GamingUI::ReadKeyInput()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GamingUI::OnMousePress ( Input::Enum::SAMI key, Input::Mouse* sender )
|
||||||
|
{
|
||||||
|
switch ( key )
|
||||||
|
{
|
||||||
|
case ::Input::Enum::SAMI_MouseLeftBtn: // shoot
|
||||||
|
this->sharedData->network->Send( Protocol_PlayerShot(Protocol_PlayerShot::ShootValue_PrimaryPress) );
|
||||||
|
break;
|
||||||
|
case ::Input::Enum::SAMI_MouseRightBtn:
|
||||||
|
this->sharedData->network->Send( Protocol_PlayerShot(Protocol_PlayerShot::ShootValue_SecondaryPress) );
|
||||||
|
break;
|
||||||
|
case ::Input::Enum::SAMI_MouseMiddleBtn:
|
||||||
|
this->sharedData->network->Send( Protocol_PlayerShot(Protocol_PlayerShot::ShootValue_UtilityPress) );
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
void GamingUI::OnMouseRelease ( Input::Enum::SAMI key, Input::Mouse* sender )
|
||||||
|
{
|
||||||
|
switch ( key )
|
||||||
|
{
|
||||||
|
case ::Input::Enum::SAMI_MouseLeftBtn: // shoot
|
||||||
|
this->sharedData->network->Send( Protocol_PlayerShot(Protocol_PlayerShot::ShootValue_PrimaryRelease) );
|
||||||
|
break;
|
||||||
|
case ::Input::Enum::SAMI_MouseRightBtn:
|
||||||
|
this->sharedData->network->Send( Protocol_PlayerShot(Protocol_PlayerShot::ShootValue_SecondaryRelease) );
|
||||||
|
break;
|
||||||
|
case ::Input::Enum::SAMI_MouseMiddleBtn:
|
||||||
|
this->sharedData->network->Send( Protocol_PlayerShot(Protocol_PlayerShot::ShootValue_UtilityRelease) );
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
void GamingUI::OnMouseMoveVelocity ( Input::Struct::SAIPointInt2D coordinate, Input::Mouse* sender )
|
void GamingUI::OnMouseMoveVelocity ( Input::Struct::SAIPointInt2D coordinate, Input::Mouse* sender )
|
||||||
{
|
{
|
||||||
//send delta mouse movement
|
//send delta mouse movement
|
||||||
|
|
|
@ -28,9 +28,9 @@ namespace DanBias { namespace Client
|
||||||
|
|
||||||
private: /* Overidden mouse methods */
|
private: /* Overidden mouse methods */
|
||||||
void OnMouse ( const Input::Struct::MouseEventData& eventData ) override { }
|
void OnMouse ( const Input::Struct::MouseEventData& eventData ) override { }
|
||||||
void OnMousePress ( Input::Enum::SAMI key, Input::Mouse* sender ) override { }
|
void OnMousePress ( Input::Enum::SAMI key, Input::Mouse* sender ) override;
|
||||||
void OnMouseDown ( Input::Enum::SAMI key, Input::Mouse* sender ) override { }
|
void OnMouseDown ( Input::Enum::SAMI key, Input::Mouse* sender ) override { }
|
||||||
void OnMouseRelease ( Input::Enum::SAMI key, Input::Mouse* sender ) override { }
|
void OnMouseRelease ( Input::Enum::SAMI key, Input::Mouse* sender ) override;
|
||||||
void OnMouseMovePixelPos ( Input::Struct::SAIPointInt2D coordinate, Input::Mouse* sender ) override { }
|
void OnMouseMovePixelPos ( Input::Struct::SAIPointInt2D coordinate, Input::Mouse* sender ) override { }
|
||||||
void OnMouseMoveVelocity ( Input::Struct::SAIPointInt2D coordinate, Input::Mouse* sender ) override;
|
void OnMouseMoveVelocity ( Input::Struct::SAIPointInt2D coordinate, Input::Mouse* sender ) override;
|
||||||
void OnMouseScroll ( int delta, Input::Mouse* sender ) override { }
|
void OnMouseScroll ( int delta, Input::Mouse* sender ) override { }
|
||||||
|
|
|
@ -44,9 +44,9 @@ void AttatchmentMassDriver::UseAttatchment(const GameLogic::WEAPON_FIRE &usage,
|
||||||
switch (usage)
|
switch (usage)
|
||||||
{
|
{
|
||||||
case WEAPON_FIRE::WEAPON_USE_PRIMARY_PRESS:
|
case WEAPON_FIRE::WEAPON_USE_PRIMARY_PRESS:
|
||||||
if(currentEnergy >= 90.0f)
|
if(currentEnergy >= 9.0f)
|
||||||
{
|
{
|
||||||
currentEnergy -= 90.0f;
|
currentEnergy -= 9.0f;
|
||||||
ForcePush(usage,dt);
|
ForcePush(usage,dt);
|
||||||
// add CD
|
// add CD
|
||||||
((Game*)&Game::Instance())->onActionEventFnc(this->owner, WeaponAction::WeaponAction_PrimaryShoot);
|
((Game*)&Game::Instance())->onActionEventFnc(this->owner, WeaponAction::WeaponAction_PrimaryShoot);
|
||||||
|
@ -54,13 +54,39 @@ void AttatchmentMassDriver::UseAttatchment(const GameLogic::WEAPON_FIRE &usage,
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WEAPON_FIRE::WEAPON_USE_SECONDARY_PRESS:
|
case WEAPON_FIRE::WEAPON_USE_SECONDARY_PRESS:
|
||||||
if(currentEnergy >= 1.0f)
|
if(this->hasObject)
|
||||||
|
{
|
||||||
|
((DynamicObject*)(this->heldObject->GetCustomTag()))->RemoveManipulation();
|
||||||
|
this->hasObject = false;
|
||||||
|
this->heldObject = NULL;
|
||||||
|
}
|
||||||
|
else if( currentEnergy >= 1.0f )
|
||||||
{
|
{
|
||||||
currentEnergy -= 1.0f;
|
currentEnergy -= 1.0f;
|
||||||
|
if(!this->hasObject)
|
||||||
|
{
|
||||||
ForcePull(usage,dt);
|
ForcePull(usage,dt);
|
||||||
// add CD
|
// add CD
|
||||||
((Game*)&Game::Instance())->onActionEventFnc(this->owner, WeaponAction::WeaponAction_SecondaryShoot);
|
((Game*)&Game::Instance())->onActionEventFnc(this->owner, WeaponAction::WeaponAction_SecondaryShoot);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else //Energy drained, release object
|
||||||
|
{
|
||||||
|
((DynamicObject*)(this->heldObject->GetCustomTag()))->RemoveManipulation();
|
||||||
|
this->hasObject = false;
|
||||||
|
this->heldObject = NULL;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case WEAPON_USE_SECONDARY_RELEASE:
|
||||||
|
{
|
||||||
|
if (this->hasObject) //Dummy check
|
||||||
|
{
|
||||||
|
//((DynamicObject*)(this->heldObject->GetCustomTag()))->RemoveManipulation();
|
||||||
|
//this->hasObject = false;
|
||||||
|
//this->heldObject = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WEAPON_FIRE::WEAPON_USE_UTILLITY_PRESS:
|
case WEAPON_FIRE::WEAPON_USE_UTILLITY_PRESS:
|
||||||
|
@ -79,6 +105,7 @@ void AttatchmentMassDriver::UseAttatchment(const GameLogic::WEAPON_FIRE &usage,
|
||||||
void AttatchmentMassDriver::Update(float dt)
|
void AttatchmentMassDriver::Update(float dt)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
//update position of heldObject if there is an object being held
|
//update position of heldObject if there is an object being held
|
||||||
if(hasObject)
|
if(hasObject)
|
||||||
{
|
{
|
||||||
|
@ -90,12 +117,26 @@ void AttatchmentMassDriver::Update(float dt)
|
||||||
heldObject->SetPosition(pos);
|
heldObject->SetPosition(pos);
|
||||||
heldObject->SetLinearVelocity(Oyster::Math::Float3::null);
|
heldObject->SetLinearVelocity(Oyster::Math::Float3::null);
|
||||||
|
|
||||||
|
if(currentEnergy < maxEnergy)
|
||||||
|
{
|
||||||
currentEnergy += rechargeRate * 0.5f; //rechargeRate is halfed if you are holding an object
|
currentEnergy += rechargeRate * 0.5f; //rechargeRate is halfed if you are holding an object
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
if(currentEnergy < maxEnergy)
|
||||||
{
|
{
|
||||||
currentEnergy += rechargeRate;
|
currentEnergy += rechargeRate;
|
||||||
|
|
||||||
|
if(currentEnergy == maxEnergy)
|
||||||
|
{
|
||||||
|
int trap = 0;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(currentEnergy > maxEnergy) currentEnergy = maxEnergy;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -112,10 +153,10 @@ void AttatchmentMassDriver::ForcePush(const GameLogic::WEAPON_FIRE &usage, float
|
||||||
if(hasObject)
|
if(hasObject)
|
||||||
{
|
{
|
||||||
pushForce = Oyster::Math::Float4(this->owner->GetLookDir()) * (this->force);
|
pushForce = Oyster::Math::Float4(this->owner->GetLookDir()) * (this->force);
|
||||||
heldObject->ApplyImpulse((Oyster::Math::Float3)pushForce);
|
this->heldObject->ApplyImpulse((Oyster::Math::Float3)pushForce);
|
||||||
((DynamicObject*)(heldObject->GetCustomTag()))->RemoveManipulation();
|
((DynamicObject*)(this->heldObject->GetCustomTag()))->RemoveManipulation();
|
||||||
hasObject = false;
|
this->hasObject = false;
|
||||||
heldObject = NULL;
|
this->heldObject = NULL;
|
||||||
return ;
|
return ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -165,22 +206,27 @@ void AttatchmentMassDriver::ForcePull(const WEAPON_FIRE &usage, float dt)
|
||||||
|
|
||||||
Oyster::Math::Float4 pullForce = Oyster::Math::Float4(this->owner->GetLookDir()) * (this->force * 0.2);
|
Oyster::Math::Float4 pullForce = Oyster::Math::Float4(this->owner->GetLookDir()) * (this->force * 0.2);
|
||||||
|
|
||||||
Oyster::Collision3D::Cone *hitCone = new Oyster::Collision3D::Cone(lenght,pos,(Oyster::Math::Float4)owner->GetRigidBody()->GetState().quaternion,radius);
|
Oyster::Collision3D::Cone hitCone(lenght,pos,(Oyster::Math::Float4)owner->GetRigidBody()->GetState().quaternion,radius);
|
||||||
forcePushData args;
|
forcePushData args;
|
||||||
args.pushForce = -pullForce;
|
args.pushForce = -pullForce;
|
||||||
args.p = this->owner;
|
args.p = this->owner;
|
||||||
|
|
||||||
Oyster::Physics::API::Instance().ApplyEffect(hitCone,&args,ForcePushAction);
|
Oyster::Physics::API::Instance().ApplyEffect(&hitCone,&args,ForcePushAction);
|
||||||
|
|
||||||
if(hitCone) delete hitCone;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void AttatchmentMassDriver::PickUpObject(const WEAPON_FIRE &usage, float dt)
|
void AttatchmentMassDriver::PickUpObject(const WEAPON_FIRE &usage, float dt)
|
||||||
{
|
{
|
||||||
|
//DEBUG:
|
||||||
|
MessageBeep(MB_ICONINFORMATION);
|
||||||
Oyster::Math::Float3 pos = owner->GetPosition() + owner->GetLookDir().GetNormalized() * 2;
|
Oyster::Math::Float3 pos = owner->GetPosition() + owner->GetLookDir().GetNormalized() * 2;
|
||||||
Oyster::Collision3D::Sphere *hitSphere = new Oyster::Collision3D::Sphere(pos,10);
|
|
||||||
|
|
||||||
Oyster::Physics::API::Instance().ApplyEffect(hitSphere,this,AttemptPickUp);
|
//Do ray test first!
|
||||||
|
//Oyster::Collision3D::Ray r(pos, owner->GetLookDir());
|
||||||
|
//Oyster::Physics::API::Instance().ApplyEffect(&r, this, AttemptPickUp);
|
||||||
|
|
||||||
if(hitSphere) delete hitSphere;
|
if(this->hasObject) return;
|
||||||
|
|
||||||
|
Oyster::Collision3D::Sphere hitSphere = Oyster::Collision3D::Sphere(pos , 1);
|
||||||
|
Oyster::Physics::API::Instance().ApplyEffect(&hitSphere,this,AttemptPickUp);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -167,9 +167,6 @@ using namespace GameLogic;
|
||||||
{
|
{
|
||||||
Player *hitPlayer = (Player*)realObj;
|
Player *hitPlayer = (Player*)realObj;
|
||||||
hitPlayer->DamageLife(ExplosionSource->extraDamageOnCollision);
|
hitPlayer->DamageLife(ExplosionSource->extraDamageOnCollision);
|
||||||
//hitPlayer->GetRigidBody()->ApplyImpulse(force);
|
|
||||||
|
|
||||||
//hitPlayer->DamageLife(ExplosionSource->getExtraDamageOnCollision());
|
|
||||||
realObj->GetRigidBody()->ApplyImpulse(force * 5);
|
realObj->GetRigidBody()->ApplyImpulse(force * 5);
|
||||||
//do shredding damage
|
//do shredding damage
|
||||||
}
|
}
|
||||||
|
@ -192,11 +189,11 @@ using namespace GameLogic;
|
||||||
Oyster::Math::Float angularFactor = deltaPos.GetNormalized().Dot( (objPrevVel - playerPrevVel).GetNormalized());
|
Oyster::Math::Float angularFactor = deltaPos.GetNormalized().Dot( (objPrevVel - playerPrevVel).GetNormalized());
|
||||||
|
|
||||||
Oyster::Math::Float impactPower = deltaSpeed * angularFactor;
|
Oyster::Math::Float impactPower = deltaSpeed * angularFactor;
|
||||||
Oyster::Math::Float damageFactor = 0.01f;
|
Oyster::Math::Float damageFactor = 0.1f;
|
||||||
|
|
||||||
|
|
||||||
int damageDone = 0;
|
Oyster::Math::Float damageDone = 0.0f;
|
||||||
int forceThreashHold = 30; //FIX: balance this
|
Oyster::Math::Float forceThreashHold = 30.0f; //FIX: balance this
|
||||||
|
|
||||||
if(impactPower > forceThreashHold) //should only take damage if the force is high enough
|
if(impactPower > forceThreashHold) //should only take damage if the force is high enough
|
||||||
{
|
{
|
||||||
|
@ -326,6 +323,7 @@ using namespace GameLogic;
|
||||||
void AttatchmentMassDriver::AttemptPickUp(Oyster::Physics::ICustomBody *obj, void* args)
|
void AttatchmentMassDriver::AttemptPickUp(Oyster::Physics::ICustomBody *obj, void* args)
|
||||||
{
|
{
|
||||||
if(obj->GetState().mass == 0) return;
|
if(obj->GetState().mass == 0) return;
|
||||||
|
if(!args) return;
|
||||||
|
|
||||||
AttatchmentMassDriver *weapon = ((AttatchmentMassDriver*)args);
|
AttatchmentMassDriver *weapon = ((AttatchmentMassDriver*)args);
|
||||||
|
|
||||||
|
@ -339,7 +337,6 @@ using namespace GameLogic;
|
||||||
//check so that it is an object that you can pickup
|
//check so that it is an object that you can pickup
|
||||||
|
|
||||||
DynamicObject *dynamicObj = dynamic_cast<DynamicObject*>(realObj);
|
DynamicObject *dynamicObj = dynamic_cast<DynamicObject*>(realObj);
|
||||||
|
|
||||||
if(!dynamicObj) return;
|
if(!dynamicObj) return;
|
||||||
|
|
||||||
if(dynamicObj->getManipulatingPlayer() != NULL)
|
if(dynamicObj->getManipulatingPlayer() != NULL)
|
||||||
|
|
|
@ -68,8 +68,8 @@ Object* Level::CreateGameObj(ObjectHeader* obj, ICustomBody* rigidBody)
|
||||||
break;
|
break;
|
||||||
case ObjectSpecialType_RedExplosiveBox:
|
case ObjectSpecialType_RedExplosiveBox:
|
||||||
{
|
{
|
||||||
Oyster::Math::Float dmg = 120;
|
Oyster::Math::Float dmg = 50;
|
||||||
Oyster::Math::Float force = 500;
|
Oyster::Math::Float force = 800;
|
||||||
Oyster::Math::Float radie = 3;
|
Oyster::Math::Float radie = 3;
|
||||||
gameObj = new ExplosiveCrate(rigidBody, (ObjectSpecialType)obj->specialTypeID, objIDCounter, dmg, force, radie);
|
gameObj = new ExplosiveCrate(rigidBody, (ObjectSpecialType)obj->specialTypeID, objIDCounter, dmg, force, radie);
|
||||||
}
|
}
|
||||||
|
@ -90,8 +90,7 @@ Object* Level::CreateGameObj(ObjectHeader* obj, ICustomBody* rigidBody)
|
||||||
break;
|
break;
|
||||||
case ObjectSpecialType_CrystalFormation:
|
case ObjectSpecialType_CrystalFormation:
|
||||||
{
|
{
|
||||||
int dmg = 50;
|
int dmg = 30;
|
||||||
//gameObj = new Crystal(rigidBody);
|
|
||||||
gameObj = new StaticObject(rigidBody, Object::DefaultOnCollision, (ObjectSpecialType)obj->specialTypeID, objIDCounter);
|
gameObj = new StaticObject(rigidBody, Object::DefaultOnCollision, (ObjectSpecialType)obj->specialTypeID, objIDCounter);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -102,7 +101,7 @@ Object* Level::CreateGameObj(ObjectHeader* obj, ICustomBody* rigidBody)
|
||||||
break;
|
break;
|
||||||
case ObjectSpecialType_JumpPad:
|
case ObjectSpecialType_JumpPad:
|
||||||
{
|
{
|
||||||
float power = 500; //((JumpPadAttributes*)obj)->power;
|
float power = ((JumpPadAttributes*)obj)->power;
|
||||||
Oyster::Math::Float3 dir = ((JumpPadAttributes*)obj)->direction;
|
Oyster::Math::Float3 dir = ((JumpPadAttributes*)obj)->direction;
|
||||||
Oyster::Math::Float3 pushForce = dir * power;
|
Oyster::Math::Float3 pushForce = dir * power;
|
||||||
gameObj = new JumpPad(rigidBody, (ObjectSpecialType)obj->specialTypeID, objIDCounter , pushForce);
|
gameObj = new JumpPad(rigidBody, (ObjectSpecialType)obj->specialTypeID, objIDCounter , pushForce);
|
||||||
|
|
|
@ -157,37 +157,59 @@ namespace GameLogic
|
||||||
|
|
||||||
struct Protocol_PlayerShot :public Oyster::Network::CustomProtocolObject
|
struct Protocol_PlayerShot :public Oyster::Network::CustomProtocolObject
|
||||||
{
|
{
|
||||||
bool primaryPressed;
|
enum ShootValue
|
||||||
bool secondaryPressed;
|
{
|
||||||
bool utilityPressed;
|
ShootValue_PrimaryPress,
|
||||||
|
ShootValue_PrimaryRelease,
|
||||||
|
ShootValue_SecondaryPress,
|
||||||
|
ShootValue_SecondaryRelease,
|
||||||
|
ShootValue_UtilityPress,
|
||||||
|
ShootValue_UtilityRelease,
|
||||||
|
} value;
|
||||||
|
//bool primaryPressed;
|
||||||
|
//bool secondaryPressed;
|
||||||
|
//bool utilityPressed;
|
||||||
|
|
||||||
Protocol_PlayerShot()
|
Protocol_PlayerShot()
|
||||||
{
|
{
|
||||||
this->protocol[0].value = protocol_Gameplay_PlayerShot;
|
this->protocol[0].value = protocol_Gameplay_PlayerShot;
|
||||||
this->protocol[0].type = Oyster::Network::NetAttributeType_Short;
|
this->protocol[0].type = Oyster::Network::NetAttributeType_Short;
|
||||||
|
|
||||||
this->protocol[1].type = Oyster::Network::NetAttributeType_Bool;
|
this->protocol[1].type = Oyster::Network::NetAttributeType_Char;
|
||||||
this->protocol[2].type = Oyster::Network::NetAttributeType_Bool;
|
|
||||||
this->protocol[3].type = Oyster::Network::NetAttributeType_Bool;
|
//this->protocol[1].type = Oyster::Network::NetAttributeType_Bool;
|
||||||
|
//this->protocol[2].type = Oyster::Network::NetAttributeType_Bool;
|
||||||
|
//this->protocol[3].type = Oyster::Network::NetAttributeType_Bool;
|
||||||
|
}
|
||||||
|
Protocol_PlayerShot(ShootValue val)
|
||||||
|
{
|
||||||
|
this->protocol[0].value = protocol_Gameplay_PlayerShot;
|
||||||
|
this->protocol[0].type = Oyster::Network::NetAttributeType_Short;
|
||||||
|
|
||||||
|
this->protocol[1].type = Oyster::Network::NetAttributeType_Char;
|
||||||
|
this->value = val;
|
||||||
}
|
}
|
||||||
Protocol_PlayerShot(Oyster::Network::CustomNetProtocol& p)
|
Protocol_PlayerShot(Oyster::Network::CustomNetProtocol& p)
|
||||||
{
|
{
|
||||||
primaryPressed = p[1].value.netBool;
|
value = (ShootValue)p[1].value.netChar;
|
||||||
secondaryPressed = p[2].value.netBool;
|
//primaryPressed = p[1].value.netBool;
|
||||||
utilityPressed = p[3].value.netBool;
|
//secondaryPressed = p[2].value.netBool;
|
||||||
|
//utilityPressed = p[3].value.netBool;
|
||||||
}
|
}
|
||||||
const Protocol_PlayerShot& operator=(Oyster::Network::CustomNetProtocol& val)
|
const Protocol_PlayerShot& operator=(Oyster::Network::CustomNetProtocol& val)
|
||||||
{
|
{
|
||||||
primaryPressed = val[1].value.netBool;
|
value = (ShootValue)val[1].value.netChar;
|
||||||
secondaryPressed = val[2].value.netBool;
|
//primaryPressed = val[1].value.netBool;
|
||||||
utilityPressed = val[3].value.netBool;
|
//secondaryPressed = val[2].value.netBool;
|
||||||
|
//utilityPressed = val[3].value.netBool;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
Oyster::Network::CustomNetProtocol GetProtocol() override
|
Oyster::Network::CustomNetProtocol GetProtocol() override
|
||||||
{
|
{
|
||||||
this->protocol[1].value = primaryPressed;
|
this->protocol[1].value = value;
|
||||||
this->protocol[2].value = secondaryPressed;
|
//this->protocol[1].value = primaryPressed;
|
||||||
this->protocol[3].value = utilityPressed;
|
//this->protocol[2].value = secondaryPressed;
|
||||||
|
//this->protocol[3].value = utilityPressed;
|
||||||
return protocol;
|
return protocol;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -257,9 +257,21 @@ using namespace DanBias;
|
||||||
}
|
}
|
||||||
void GameSession::Gameplay_PlayerShot ( Protocol_PlayerShot& p, DanBias::GameClient* c )
|
void GameSession::Gameplay_PlayerShot ( Protocol_PlayerShot& p, DanBias::GameClient* c )
|
||||||
{
|
{
|
||||||
if(p.secondaryPressed) c->GetPlayer()->UseWeapon(GameLogic::WEAPON_USE_SECONDARY_PRESS);
|
switch (p.value)
|
||||||
if(p.primaryPressed) c->GetPlayer()->UseWeapon(GameLogic::WEAPON_USE_PRIMARY_PRESS);
|
{
|
||||||
if(p.utilityPressed) c->GetPlayer()->UseWeapon(GameLogic::WEAPON_USE_UTILLITY_PRESS);
|
case Protocol_PlayerShot::ShootValue_PrimaryPress: c->GetPlayer()->UseWeapon(GameLogic::WEAPON_USE_PRIMARY_PRESS);
|
||||||
|
break;
|
||||||
|
case Protocol_PlayerShot::ShootValue_PrimaryRelease: c->GetPlayer()->UseWeapon(GameLogic::WEAPON_USE_PRIMARY_RELEASE);
|
||||||
|
break;
|
||||||
|
case Protocol_PlayerShot::ShootValue_SecondaryPress: c->GetPlayer()->UseWeapon(GameLogic::WEAPON_USE_SECONDARY_PRESS);
|
||||||
|
break;
|
||||||
|
case Protocol_PlayerShot::ShootValue_SecondaryRelease: c->GetPlayer()->UseWeapon(GameLogic::WEAPON_USE_SECONDARY_RELEASE);
|
||||||
|
break;
|
||||||
|
case Protocol_PlayerShot::ShootValue_UtilityPress: c->GetPlayer()->UseWeapon(GameLogic::WEAPON_USE_UTILLITY_PRESS);
|
||||||
|
break;
|
||||||
|
case Protocol_PlayerShot::ShootValue_UtilityRelease: c->GetPlayer()->UseWeapon(GameLogic::WEAPON_USE_UTILLITY_RELEASE);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
void GameSession::Gameplay_ObjectPickup ( Protocol_ObjectPickup& p, DanBias::GameClient* c )
|
void GameSession::Gameplay_ObjectPickup ( Protocol_ObjectPickup& p, DanBias::GameClient* c )
|
||||||
{
|
{
|
||||||
|
|
|
@ -200,12 +200,12 @@ void Win32Mouse::ProccessMouseData (RAWMOUSE mouse)
|
||||||
|
|
||||||
if(btn == SAMI_Unknown) return;
|
if(btn == SAMI_Unknown) return;
|
||||||
|
|
||||||
this->buttons[btn].isDown = !isUp;
|
|
||||||
this->buttons[btn].makeCode = makeCode;
|
this->buttons[btn].makeCode = makeCode;
|
||||||
|
|
||||||
//The btn is released.
|
//The btn is released.
|
||||||
if(isUp)
|
if(isUp)
|
||||||
{
|
{
|
||||||
|
this->buttons[btn].isDown = false;
|
||||||
InternalOnBtnRelease(btn);
|
InternalOnBtnRelease(btn);
|
||||||
|
|
||||||
GetNormalizedPosition( mouseEventData.normalizedPos );
|
GetNormalizedPosition( mouseEventData.normalizedPos );
|
||||||
|
@ -222,6 +222,7 @@ void Win32Mouse::ProccessMouseData (RAWMOUSE mouse)
|
||||||
//The btn is down since last frame
|
//The btn is down since last frame
|
||||||
if(this->buttons[btn].isDown)
|
if(this->buttons[btn].isDown)
|
||||||
{
|
{
|
||||||
|
this->buttons[btn].isDown = true;
|
||||||
InternalOnBtnDown(btn);
|
InternalOnBtnDown(btn);
|
||||||
|
|
||||||
GetNormalizedPosition( mouseEventData.normalizedPos );
|
GetNormalizedPosition( mouseEventData.normalizedPos );
|
||||||
|
@ -234,6 +235,7 @@ void Win32Mouse::ProccessMouseData (RAWMOUSE mouse)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
this->buttons[btn].isDown = true;
|
||||||
InternalOnBtnPress(btn);
|
InternalOnBtnPress(btn);
|
||||||
|
|
||||||
GetNormalizedPosition( mouseEventData.normalizedPos );
|
GetNormalizedPosition( mouseEventData.normalizedPos );
|
||||||
|
|
Loading…
Reference in New Issue