diff --git a/Code/Game/DanBiasGame/GameClientState/GameState.cpp b/Code/Game/DanBiasGame/GameClientState/GameState.cpp index 0102a027..d8547943 100644 --- a/Code/Game/DanBiasGame/GameClientState/GameState.cpp +++ b/Code/Game/DanBiasGame/GameClientState/GameState.cpp @@ -84,7 +84,7 @@ bool GameState::LoadModels(std::wstring mapFile) // open file // read file // init models - int nrOfBoxex = 5; + int nrOfBoxex = 20; privData->modelCount = 3+nrOfBoxex; myId += privData->modelCount; int id = 0; @@ -103,7 +103,7 @@ bool GameState::LoadModels(std::wstring mapFile) // add box model modelData.world = Oyster::Math3D::Float4x4::identity; - modelData.modelPath = L"..\\Content\\Models\\box.dan"; + modelData.modelPath = L"crate_colonists.dan"; for(int i =0; i< nrOfBoxex; i ++) @@ -120,7 +120,7 @@ bool GameState::LoadModels(std::wstring mapFile) // add crystal model modelData.world = Oyster::Math3D::Float4x4::identity; - translate = Oyster::Math3D::TranslationMatrix(Oyster::Math::Float3(10, 305, 0)); + translate = Oyster::Math3D::TranslationMatrix(Oyster::Math::Float3(10, 301, 0)); modelData.world = modelData.world * translate; modelData.visible = true; @@ -133,10 +133,11 @@ bool GameState::LoadModels(std::wstring mapFile) // add house model modelData.world = Oyster::Math3D::Float4x4::identity; - translate = Oyster::Math3D::TranslationMatrix(Oyster::Math::Float3(50, 300, 0)); - //Oyster::Math3D::RotationMatrix_AxisZ() - modelData.world = modelData.world * translate; - modelData.visible = false; + translate = Oyster::Math3D::TranslationMatrix(Oyster::Math::Float3(-50, 290, 0)); + Oyster::Math3D::Float4x4 rot = Oyster::Math3D::RotationMatrix(Oyster::Math::Float3(0 ,Utility::Value::Radian(90.0f), 0)); + + modelData.world = modelData.world * translate * rot; + modelData.visible = true; modelData.modelPath = L"building_corporation.dan"; modelData.id = id++; // load models @@ -144,13 +145,14 @@ bool GameState::LoadModels(std::wstring mapFile) privData->object.push_back(obj); privData->object[privData->object.size() -1 ]->Init(modelData); + // add player model modelData.world = Oyster::Math3D::Float4x4::identity; translate = Oyster::Math3D::TranslationMatrix(Oyster::Math::Float3(0, 320, 0)); modelData.world = modelData.world * translate; modelData.visible = true; - modelData.modelPath = L"char_renderTest.dan"; + modelData.modelPath = L"char_still_sizeref.dan"; modelData.id = id++; // load models obj = new C_Player(); @@ -163,14 +165,41 @@ bool GameState::LoadModels(std::wstring mapFile) modelData.world = modelData.world * translate; modelData.visible = true; - modelData.modelPath = L"char_renderTest.dan"; + modelData.modelPath = L"char_still_sizeref.dan"; modelData.id = id++; // load models obj = new C_Player(); privData->object.push_back(obj); privData->object[privData->object.size() -1 ]->Init(modelData); + // add jumppad + modelData.world = Oyster::Math3D::Float4x4::identity; + translate = Oyster::Math3D::TranslationMatrix(Oyster::Math::Float3(4, 300.3, 0)); + //Oyster::Math3D::RotationMatrix_AxisZ() + modelData.world = modelData.world * translate; + modelData.visible = true; + modelData.modelPath = L"jumppad_round.dan"; + modelData.id = id++; + // load models + obj = new C_Player(); + privData->object.push_back(obj); + privData->object[privData->object.size() -1 ]->Init(modelData); + // add sky sphere + modelData.world = Oyster::Math3D::Float4x4::identity; + translate = Oyster::Math3D::TranslationMatrix(Oyster::Math::Float3(0, 0, 0)); + //Oyster::Math3D::RotationMatrix_AxisZ() + modelData.world = modelData.world * translate; + modelData.world.v[0].x = 800; + modelData.world.v[1].y = 800; + modelData.world.v[2].z = 800; + modelData.visible = true; + modelData.modelPath = L"skysphere.dan"; + modelData.id = id++; + // load models + obj = new C_Player(); + privData->object.push_back(obj); + privData->object[privData->object.size() -1 ]->Init(modelData); return true; } @@ -456,8 +485,8 @@ void GameState::Protocol( ObjPos* pos ) camera->setUp(up); camera->setLook(objForward); - up *= 2; - objForward *= -3; + up *= 1; + objForward *= -2; Oyster::Math::Float3 cameraPos = up + pos + objForward; camera->SetPosition(cameraPos); diff --git a/Code/Game/DanBiasGame/GameClientState/LoginState.cpp b/Code/Game/DanBiasGame/GameClientState/LoginState.cpp index 301ab791..4a244a8b 100644 --- a/Code/Game/DanBiasGame/GameClientState/LoginState.cpp +++ b/Code/Game/DanBiasGame/GameClientState/LoginState.cpp @@ -41,7 +41,7 @@ bool LoginState::Init(Oyster::Network::NetworkClient* nwClient) bool LoginState::LoadModels(std::wstring file) { Oyster::Graphics::Definitions::Pointlight plight; - plight.Pos = Oyster::Math::Float3(0,0,5.4f); + plight.Pos = Oyster::Math::Float3(0,0,5); plight.Color = Oyster::Math::Float3(1,1,1); plight.Radius = 100; plight.Bright = 1; @@ -55,14 +55,22 @@ bool LoginState::LoadModels(std::wstring file) modelData.world = Oyster::Math3D::Float4x4::identity; modelData.visible = true; - modelData.modelPath = L"..\\Content\\Models\\box.dan"; + modelData.modelPath = L"identityPlane.dan"; // load models - Oyster::Math3D::Float4x4 translate = Oyster::Math3D::TranslationMatrix(Oyster::Math::Float3(2,2,2)); + Oyster::Math3D::Float4x4 translate = Oyster::Math3D::TranslationMatrix(Oyster::Math::Float3(2,2,-2)); + Oyster::Math3D::Float4x4 rot = Oyster::Math3D::RotationMatrix(Oyster::Math::Float3(0 ,Utility::Value::Radian(90.0f), 0)); + Oyster::Math3D::Float4x4 scale = Oyster::Math3D::Float4x4::identity; + int scaling = 2; + scale.v[0].x = scaling; + scale.v[1].y = scaling; + scale.v[2].z = scaling; + + modelData.world = translate; //scale * translate * rot; privData->object[0] = new C_DynamicObj(); privData->object[0]->Init(modelData); - translate = Oyster::Math3D::TranslationMatrix(Oyster::Math::Float3(-2,-2,-2)); - modelData.world = modelData.world * translate; + translate = Oyster::Math3D::TranslationMatrix(Oyster::Math::Float3(0,0,-2)); + modelData.world = translate ;//* rot; privData->object[1] = new C_DynamicObj(); privData->object[1]->Init(modelData); @@ -127,7 +135,6 @@ bool LoginState::Render() Oyster::Graphics::API::SetView(privData->view); Oyster::Graphics::API::SetProjection( privData->proj); - Oyster::Graphics::API::NewFrame(); // render objects for (int i = 0; i < privData->modelCount; i++) diff --git a/Code/Game/GameLogic/AttatchmentMassDriver.cpp b/Code/Game/GameLogic/AttatchmentMassDriver.cpp index e0ca6c0f..59be4542 100644 --- a/Code/Game/GameLogic/AttatchmentMassDriver.cpp +++ b/Code/Game/GameLogic/AttatchmentMassDriver.cpp @@ -63,8 +63,10 @@ void AttatchmentMassDriver::Update(float dt) Oyster::Physics::ICustomBody::State state; state = heldObject->GetState(); Oyster::Math::Float3 ownerPos = owner->GetPosition(); - ownerPos.y += 2; - Oyster::Math::Float3 pos = ownerPos + owner->GetLookDir().GetNormalized()*2; + Oyster::Physics::ICustomBody::State ownerState = owner->GetRigidBody()->GetState(); + Oyster::Math::Float3 up = -ownerState.GetGravityNormal(); + up *= -0.3; + Oyster::Math::Float3 pos = ownerPos + up + (owner->GetLookDir().GetNormalized()*5); state.SetCenterPosition(pos); @@ -84,7 +86,7 @@ void AttatchmentMassDriver::ForcePush(const GameLogic::WEAPON_FIRE &usage, float if(hasObject) { Oyster::Physics::API::Instance().ReleaseFromLimbo(heldObject); - pushForce = Oyster::Math::Float4(this->owner->GetLookDir()) * (2000); + pushForce = Oyster::Math::Float4(this->owner->GetLookDir()) * (700); Oyster::Physics::ICustomBody::State state = heldObject->GetState(); state.ApplyLinearImpulse((Oyster::Math::Float3)pushForce); heldObject->SetState(state); @@ -97,10 +99,10 @@ void AttatchmentMassDriver::ForcePush(const GameLogic::WEAPON_FIRE &usage, float Oyster::Math::Float3 look = owner->GetLookDir(); Oyster::Math::Float3 pos = owner->GetPosition(); - pushForce = Oyster::Math::Float4(this->owner->GetLookDir()) * (50000 * dt); + pushForce = Oyster::Math::Float4(this->owner->GetLookDir()) * (20000 * dt); Oyster::Math::Float4x4 aim = Oyster::Math3D::ViewMatrix_LookAtDirection(look, up, pos); - Oyster::Math::Float4x4 hitSpace = Oyster::Math3D::ProjectionMatrix_Perspective(Oyster::Math::pi/8,1,1,5); + Oyster::Math::Float4x4 hitSpace = Oyster::Math3D::ProjectionMatrix_Perspective(Oyster::Math::pi/8,1,1,50); Oyster::Collision3D::Frustrum hitFrustum = Oyster::Collision3D::Frustrum(Oyster::Math3D::ViewProjectionMatrix(aim,hitSpace)); forcePushData args; args.pushForce = pushForce; diff --git a/Code/Game/GameLogic/Game_PlayerData.cpp b/Code/Game/GameLogic/Game_PlayerData.cpp index da441539..61c36dd1 100644 --- a/Code/Game/GameLogic/Game_PlayerData.cpp +++ b/Code/Game/GameLogic/Game_PlayerData.cpp @@ -8,7 +8,7 @@ Game::PlayerData::PlayerData() //set some stats that are appropriate to a player Oyster::Physics::API::SimpleBodyDescription sbDesc; sbDesc.centerPosition = Oyster::Math::Float3(0,308,0); - sbDesc.size = Oyster::Math::Float3(4,7,4); + sbDesc.size = Oyster::Math::Float3(0.5f,2,1); sbDesc.mass = 70; sbDesc.restitutionCoeff = 0.5; sbDesc.frictionCoeff_Static = 0.4; diff --git a/Code/Game/GameLogic/Level.cpp b/Code/Game/GameLogic/Level.cpp index 0a2fd31b..49646e53 100644 --- a/Code/Game/GameLogic/Level.cpp +++ b/Code/Game/GameLogic/Level.cpp @@ -82,15 +82,46 @@ void Level::InitiateLevel(float radius) ICustomBody* rigidBody_TestBox; int nrOfBoxex = 5; + int offset = 0; for(int i =0; i< nrOfBoxex; i ++) { - sbDesc_TestBox.centerPosition = Oyster::Math::Float4(20 ,320,0 + ( i*7),0); + sbDesc_TestBox.centerPosition = Oyster::Math::Float4(-20 +( i*7) ,320,20,0); rigidBody_TestBox = API::Instance().CreateRigidBody(sbDesc_TestBox).Release(); rigidBody_TestBox->SetSubscription(Level::PhysicsOnMoveLevel); this->dynamicObjects.Push(new DynamicObject(rigidBody_TestBox,Object::DefaultCollisionBefore, Object::DefaultCollisionAfter, OBJECT_TYPE::OBJECT_TYPE_BOX)); rigidBody_TestBox->SetCustomTag(this->dynamicObjects[i]); } + offset += nrOfBoxex; + for(int i =0; i< nrOfBoxex; i ++) + { + sbDesc_TestBox.centerPosition = Oyster::Math::Float4(-20,320, -20 +( i*7),0); + rigidBody_TestBox = API::Instance().CreateRigidBody(sbDesc_TestBox).Release(); + rigidBody_TestBox->SetSubscription(Level::PhysicsOnMoveLevel); + + this->dynamicObjects.Push(new DynamicObject(rigidBody_TestBox,Object::DefaultCollisionBefore, Object::DefaultCollisionAfter, OBJECT_TYPE::OBJECT_TYPE_BOX)); + rigidBody_TestBox->SetCustomTag(this->dynamicObjects[i+offset]); + } + offset += nrOfBoxex; + for(int i =0; i< nrOfBoxex; i ++) + { + sbDesc_TestBox.centerPosition = Oyster::Math::Float4(20,320,-20 + ( i*7),0); + rigidBody_TestBox = API::Instance().CreateRigidBody(sbDesc_TestBox).Release(); + rigidBody_TestBox->SetSubscription(Level::PhysicsOnMoveLevel); + + this->dynamicObjects.Push(new DynamicObject(rigidBody_TestBox,Object::DefaultCollisionBefore, Object::DefaultCollisionAfter, OBJECT_TYPE::OBJECT_TYPE_BOX)); + rigidBody_TestBox->SetCustomTag(this->dynamicObjects[i+offset]); + } + offset += nrOfBoxex; + for(int i =0; i< nrOfBoxex; i ++) + { + sbDesc_TestBox.centerPosition = Oyster::Math::Float4(-20 +( i*7) ,320,-20,0); + rigidBody_TestBox = API::Instance().CreateRigidBody(sbDesc_TestBox).Release(); + rigidBody_TestBox->SetSubscription(Level::PhysicsOnMoveLevel); + + this->dynamicObjects.Push(new DynamicObject(rigidBody_TestBox,Object::DefaultCollisionBefore, Object::DefaultCollisionAfter, OBJECT_TYPE::OBJECT_TYPE_BOX)); + rigidBody_TestBox->SetCustomTag(this->dynamicObjects[i+offset]); + } @@ -111,18 +142,21 @@ void Level::InitiateLevel(float radius) // add house API::SimpleBodyDescription sbDesc_House; - sbDesc_House.centerPosition = Oyster::Math::Float4(50, 300, 0, 0); + //sbDesc_House.centerPosition = Oyster::Math::Float4(212, 212, 0, 0); + sbDesc_House.centerPosition = Oyster::Math::Float4(-50, 290, 0, 0); sbDesc_House.ignoreGravity = false; - + sbDesc_House.rotation = Oyster::Math::Float3(0 ,Utility::Value::Radian(90.0f), 0); sbDesc_House.mass = 70; - sbDesc_House.size = Oyster::Math::Float4(2,3,2,0); + sbDesc_House.size = Oyster::Math::Float4(40,40,40,0); ICustomBody* rigidBody_House = API::Instance().CreateRigidBody(sbDesc_House).Release(); rigidBody_House->SetSubscription(Level::PhysicsOnMoveLevel); this->staticObjects.Push(new StaticObject(rigidBody_House,Object::DefaultCollisionBefore, Object::DefaultCollisionAfter, OBJECT_TYPE::OBJECT_TYPE_GENERIC)); rigidBody_House->SetCustomTag(this->staticObjects[0]); - + rigidBody_House->GetState(state); + Oyster::Math::Float4x4 world = state.GetOrientation(); + // add gravitation API::Gravity gravityWell; diff --git a/Code/Game/GameServer/Implementation/GameSession_Gameplay.cpp b/Code/Game/GameServer/Implementation/GameSession_Gameplay.cpp index 367048f7..beced0a4 100644 --- a/Code/Game/GameServer/Implementation/GameSession_Gameplay.cpp +++ b/Code/Game/GameServer/Implementation/GameSession_Gameplay.cpp @@ -188,10 +188,11 @@ namespace DanBias } void GameSession::Gameplay_PlayerShot ( Protocol_PlayerShot& p, DanBias::GameClient* c ) - { - if(p.primaryPressed) c->GetPlayer()->UseWeapon(GameLogic::WEAPON_USE_PRIMARY_PRESS); - if(p.secondaryPressed) c->GetPlayer()->UseWeapon(GameLogic::WEAPON_USE_SECONDARY_PRESS); - if(p.utilityPressed) c->GetPlayer()->UseWeapon(GameLogic::WEAPON_USE_UTILLITY_PRESS); + { + if(p.secondaryPressed) c->GetPlayer()->UseWeapon(GameLogic::WEAPON_USE_SECONDARY_PRESS); + if(p.primaryPressed) c->GetPlayer()->UseWeapon(GameLogic::WEAPON_USE_PRIMARY_PRESS); + + if(p.utilityPressed) c->GetPlayer()->UseWeapon(GameLogic::WEAPON_USE_UTILLITY_PRESS); } void GameSession::Gameplay_PlayerJump ( Protocol_PlayerJump& p, DanBias::GameClient* c ) {