Merged with GameLogic and fixed merging errors, some minor justifications may be needed later on due to merging errors..

This commit is contained in:
Dennis Andersen 2014-02-09 18:58:14 +01:00
parent 4abfdd70fe
commit 14bf3ede86
3 changed files with 36 additions and 32 deletions

View File

@ -44,6 +44,7 @@ bool GameState::Init(Oyster::Network::NetworkClient* nwClient)
privData->nwClient = nwClient; privData->nwClient = nwClient;
privData->state = LoadGame(); privData->state = LoadGame();
pitch = 0; pitch = 0;
//tELL SERver ready //tELL SERver ready
nwClient->Send(GameLogic::Protocol_General_Status(GameLogic::Protocol_General_Status::States_ready)); nwClient->Send(GameLogic::Protocol_General_Status(GameLogic::Protocol_General_Status::States_ready));
@ -148,7 +149,7 @@ bool GameState::LoadModels(std::wstring mapFile)
privData->object.push_back(obj); privData->object.push_back(obj);
privData->object[privData->object.size() -1 ]->Init(modelData); privData->object[privData->object.size() -1 ]->Init(modelData);
*/
// add jumppad // add jumppad
modelData.world = Oyster::Math3D::Float4x4::identity; modelData.world = Oyster::Math3D::Float4x4::identity;
translate = Oyster::Math3D::TranslationMatrix(Oyster::Math::Float3(4, 300.3, 0)); translate = Oyster::Math3D::TranslationMatrix(Oyster::Math::Float3(4, 300.3, 0));
@ -178,6 +179,7 @@ bool GameState::LoadModels(std::wstring mapFile)
privData->object.push_back(obj); privData->object.push_back(obj);
privData->object[privData->object.size() -1 ]->Init(modelData); privData->object[privData->object.size() -1 ]->Init(modelData);
*/
return true; return true;
} }
bool GameState::InitCamera(Oyster::Math::Float3 startPos) bool GameState::InitCamera(Oyster::Math::Float3 startPos)

View File

@ -105,7 +105,7 @@ GameClientState::ClientState LoginState::Update(float deltaTime, InputClass* Key
DanBias::GameServerAPI::ServerInitiate(desc); DanBias::GameServerAPI::ServerInitiate(desc);
DanBias::GameServerAPI::ServerStart(); DanBias::GameServerAPI::ServerStart();
// my ip // my ip
nwClient->Connect(15151, "127.0.0.1"); nwClient->Connect(15152, "127.0.0.1");
if (!nwClient->IsConnected()) if (!nwClient->IsConnected())
{ {
@ -118,7 +118,7 @@ GameClientState::ClientState LoginState::Update(float deltaTime, InputClass* Key
if( KeyInput->IsKeyPressed(DIK_J)) if( KeyInput->IsKeyPressed(DIK_J))
{ {
// game ip // game ip
nwClient->Connect(15151, "127.0.0.1"); nwClient->Connect(15152, "127.0.0.1");
if (!nwClient->IsConnected()) if (!nwClient->IsConnected())
{ {

View File

@ -23,35 +23,36 @@ void Level::InitiateLevel(std::string levelPath)
} }
void Level::InitiateLevel(float radius) void Level::InitiateLevel(float radius)
{ {
float heading = Utility::Value::Radian(180.0f); //float heading = Utility::Value::Radian(180.0f);
float attitude = Utility::Value::Radian(0.0f); //float attitude = Utility::Value::Radian(0.0f);
float bank = Utility::Value::Radian(0); //float bank = Utility::Value::Radian(0);
//
//double c1 = cos(heading/2);
//double s1 = sin(heading/2);
//double c2 = cos(attitude/2);
//double s2 = sin(attitude/2);
//double c3 = cos(bank/2);
//double s3 = sin(bank/2);
//double c1c2 = c1*c2;
//double s1s2 = s1*s2;
//double w =c1c2*c3 - s1s2*s3;
//double x =c1c2*s3 + s1s2*c3;
//double y =s1*c2*c3 + c1*s2*s3;
//double z =c1*s2*c3 - s1*c2*s3;
//double angle = 2 * acos(w);
//
//double norm = x*x+y*y+z*z;
//if (norm < 0.001) { // when all euler angles are zero angle =0 so
// // we can set axis to anything to avoid divide by zero
// x=1;
// y=z=0;
//} else {
// norm = sqrt(norm);
// x /= norm;
// y /= norm;
// z /= norm;
//}
double c1 = cos(heading/2);
double s1 = sin(heading/2);
double c2 = cos(attitude/2);
double s2 = sin(attitude/2);
double c3 = cos(bank/2);
double s3 = sin(bank/2);
double c1c2 = c1*c2;
double s1s2 = s1*s2;
double w =c1c2*c3 - s1s2*s3;
double x =c1c2*s3 + s1s2*c3;
double y =s1*c2*c3 + c1*s2*s3;
double z =c1*s2*c3 - s1*c2*s3;
double angle = 2 * acos(w);
double norm = x*x+y*y+z*z;
if (norm < 0.001) { // when all euler angles are zero angle =0 so
// we can set axis to anything to avoid divide by zero
x=1;
y=z=0;
} else {
norm = sqrt(norm);
x /= norm;
y /= norm;
z /= norm;
}
int idCount = 100; int idCount = 100;
// add level sphere // add level sphere
@ -162,6 +163,7 @@ void Level::InitiateLevel(float radius)
rigidBody_House->GetState(state); rigidBody_House->GetState(state);
Oyster::Math::Float4x4 world = state.GetOrientation(); Oyster::Math::Float4x4 world = state.GetOrientation();
*/
// add gravitation // add gravitation
API::Gravity gravityWell; API::Gravity gravityWell;