Broken shit, dont take

This commit is contained in:
dean11 2014-02-26 16:57:32 +01:00
parent 3bfedf920a
commit b289741897
3 changed files with 82 additions and 15 deletions

View File

@ -172,7 +172,54 @@ void GamingUI::ReadKeyInput()
}
}
void GamingUI::OnMousePress ( Input::Enum::SAMI key, Input::Mouse* sender )
{
switch ( key )
{
case ::Input::Enum::SAMI_MouseLeftBtn: // shoot
{
Protocol_PlayerShot playerShot;
playerShot.primaryPressed = true;
playerShot.secondaryPressed = false;
playerShot.utilityPressed = false;
this->sharedData->network->Send( playerShot );
}
break;
case ::Input::Enum::SAMI_MouseRightBtn:
{
Protocol_PlayerShot playerShot;
playerShot.primaryPressed = false;
playerShot.secondaryPressed = true;
playerShot.utilityPressed = false;
this->sharedData->network->Send( playerShot );
}
break;
case ::Input::Enum::SAMI_MouseMiddleBtn:
{
Protocol_PlayerShot playerShot;
playerShot.primaryPressed = false;
playerShot.secondaryPressed = false;
playerShot.utilityPressed = true;
this->sharedData->network->Send( playerShot );
}
break;
}
}
void GamingUI::OnMouseRelease ( Input::Enum::SAMI key, Input::Mouse* sender )
{
switch ( key )
{
case ::Input::Enum::SAMI_MouseRightBtn:
{
Protocol_PlayerShot playerShot;
playerShot.primaryPressed = false;
playerShot.secondaryPressed = false;
playerShot.utilityPressed = false;
this->sharedData->network->Send( playerShot );
}
break;
}
}
void GamingUI::OnMouseMoveVelocity ( Input::Struct::SAIPointInt2D coordinate, Input::Mouse* sender )
{
//send delta mouse movement

View File

@ -28,9 +28,9 @@ namespace DanBias { namespace Client
private: /* Overidden mouse methods */
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 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 OnMouseMoveVelocity ( Input::Struct::SAIPointInt2D coordinate, Input::Mouse* sender ) override;
void OnMouseScroll ( int delta, Input::Mouse* sender ) override { }

View File

@ -44,9 +44,9 @@ void AttatchmentMassDriver::UseAttatchment(const GameLogic::WEAPON_FIRE &usage,
switch (usage)
{
case WEAPON_FIRE::WEAPON_USE_PRIMARY_PRESS:
if(currentEnergy >= 90.0f)
if(currentEnergy >= 9.0f)
{
currentEnergy -= 90.0f;
currentEnergy -= 9.0f;
ForcePush(usage,dt);
// add CD
((Game*)&Game::Instance())->onActionEventFnc(this->owner, WeaponAction::WeaponAction_PrimaryShoot);
@ -57,10 +57,30 @@ void AttatchmentMassDriver::UseAttatchment(const GameLogic::WEAPON_FIRE &usage,
if( currentEnergy >= 1.0f )
{
currentEnergy -= 1.0f;
if(!this->hasObject)
{
ForcePull(usage,dt);
// add CD
((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;
case WEAPON_FIRE::WEAPON_USE_UTILLITY_PRESS:
@ -112,10 +132,10 @@ void AttatchmentMassDriver::ForcePush(const GameLogic::WEAPON_FIRE &usage, float
if(hasObject)
{
pushForce = Oyster::Math::Float4(this->owner->GetLookDir()) * (this->force);
heldObject->ApplyImpulse((Oyster::Math::Float3)pushForce);
((DynamicObject*)(heldObject->GetCustomTag()))->RemoveManipulation();
hasObject = false;
heldObject = NULL;
this->heldObject->ApplyImpulse((Oyster::Math::Float3)pushForce);
((DynamicObject*)(this->heldObject->GetCustomTag()))->RemoveManipulation();
this->hasObject = false;
this->heldObject = NULL;
return ;
}