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 ) void GamingUI::OnMouseMoveVelocity ( Input::Struct::SAIPointInt2D coordinate, Input::Mouse* sender )
{ {
//send delta mouse movement //send delta mouse movement

View File

@ -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 { }

View File

@ -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,33 @@ 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( currentEnergy >= 1.0f )
{ {
currentEnergy -= 1.0f; currentEnergy -= 1.0f;
ForcePull(usage,dt); if(!this->hasObject)
// add CD {
((Game*)&Game::Instance())->onActionEventFnc(this->owner, WeaponAction::WeaponAction_SecondaryShoot); 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; break;
case WEAPON_FIRE::WEAPON_USE_UTILLITY_PRESS: case WEAPON_FIRE::WEAPON_USE_UTILLITY_PRESS:
@ -112,11 +132,11 @@ 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 ;
} }
Oyster::Math::Float radius = 4; Oyster::Math::Float radius = 4;