GL - forgot to commit files
This commit is contained in:
parent
c1757eef21
commit
fa16f71a26
|
@ -33,6 +33,7 @@ private:
|
||||||
|
|
||||||
int myId;
|
int myId;
|
||||||
float pitch;
|
float pitch;
|
||||||
|
float timer;
|
||||||
struct myData;
|
struct myData;
|
||||||
myData* privData;
|
myData* privData;
|
||||||
Utility::DynamicMemory::DynamicArray<Utility::DynamicMemory::SmartPointer<C_StaticObj>> staticObjects;
|
Utility::DynamicMemory::DynamicArray<Utility::DynamicMemory::SmartPointer<C_StaticObj>> staticObjects;
|
||||||
|
|
|
@ -38,6 +38,7 @@ using namespace GameLogic;
|
||||||
break;
|
break;
|
||||||
case OBJECT_TYPE::OBJECT_TYPE_WORLD:
|
case OBJECT_TYPE::OBJECT_TYPE_WORLD:
|
||||||
PlayerVObject(*player,*realObj, kineticEnergyLoss);
|
PlayerVObject(*player,*realObj, kineticEnergyLoss);
|
||||||
|
player->playerState = PLAYER_STATE::PLAYER_STATE_WALKING;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@ using namespace GameLogic;
|
||||||
Game::PlayerData::PlayerData()
|
Game::PlayerData::PlayerData()
|
||||||
{
|
{
|
||||||
//set some stats that are appropriate to a player
|
//set some stats that are appropriate to a player
|
||||||
Oyster::Math::Float3 centerPosition = Oyster::Math::Float3(0,628,-25);
|
Oyster::Math::Float3 centerPosition = Oyster::Math::Float3(0,603,0);
|
||||||
Oyster::Math::Float3 size = Oyster::Math::Float3(0.25f,1.0f,0.5f);
|
Oyster::Math::Float3 size = Oyster::Math::Float3(0.25f,1.0f,0.5f);
|
||||||
Oyster::Math::Float mass = 60;
|
Oyster::Math::Float mass = 60;
|
||||||
Oyster::Math::Float restitutionCoeff = 0.5;
|
Oyster::Math::Float restitutionCoeff = 0.5;
|
||||||
|
|
|
@ -113,7 +113,7 @@ void Level::InitiateLevel(std::string levelPath)
|
||||||
void Level::InitiateLevel(float radius)
|
void Level::InitiateLevel(float radius)
|
||||||
{
|
{
|
||||||
API::Instance().SetGravityPoint(Oyster::Math3D::Float3(0,0,0));
|
API::Instance().SetGravityPoint(Oyster::Math3D::Float3(0,0,0));
|
||||||
API::Instance().SetGravity(100);
|
API::Instance().SetGravity(200);
|
||||||
int idCount = 100;
|
int idCount = 100;
|
||||||
// add level sphere
|
// add level sphere
|
||||||
ICustomBody* rigidBody = API::Instance().AddCollisionSphere(599.2f, Oyster::Math::Float4(0, 0, 0, 1), Oyster::Math::Float3(0, 0, 0), 0, 0.5f, 0.8f, 0.6f);
|
ICustomBody* rigidBody = API::Instance().AddCollisionSphere(599.2f, Oyster::Math::Float4(0, 0, 0, 1), Oyster::Math::Float3(0, 0, 0), 0, 0.5f, 0.8f, 0.6f);
|
||||||
|
|
|
@ -45,7 +45,8 @@ void Player::InitPlayer()
|
||||||
this->life = 100;
|
this->life = 100;
|
||||||
this->teamID = -1;
|
this->teamID = -1;
|
||||||
this->playerState = PLAYER_STATE_IDLE;
|
this->playerState = PLAYER_STATE_IDLE;
|
||||||
lookDir = Oyster::Math::Float4(0,0,-1,0);
|
this->lookDir = Oyster::Math::Float3(0,0,-1);
|
||||||
|
this->moveDir = Oyster::Math::Float3(0,0,0);
|
||||||
}
|
}
|
||||||
|
|
||||||
Player::~Player(void)
|
Player::~Player(void)
|
||||||
|
@ -61,8 +62,6 @@ void Player::BeginFrame()
|
||||||
{
|
{
|
||||||
//weapon->Update(0.002f);
|
//weapon->Update(0.002f);
|
||||||
Object::BeginFrame();
|
Object::BeginFrame();
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Player::EndFrame()
|
void Player::EndFrame()
|
||||||
|
@ -99,27 +98,37 @@ void Player::Move(const PLAYER_MOVEMENT &movement)
|
||||||
|
|
||||||
void Player::MoveForward()
|
void Player::MoveForward()
|
||||||
{
|
{
|
||||||
Oyster::Math::Float3 forward = this->rigidBody->GetState().GetOrientation().v[2];
|
Oyster::Math::Float3 forward = this->rigidBody->GetState().GetOrientation().v[2].GetNormalized();
|
||||||
rigidBody->SetLinearVelocity( MOVE_FORCE * forward.GetNormalized() );
|
moveDir = forward;
|
||||||
|
moveDir.Normalize();
|
||||||
|
rigidBody->SetLinearVelocity( MOVE_FORCE * moveDir );
|
||||||
}
|
}
|
||||||
void Player::MoveBackwards()
|
void Player::MoveBackwards()
|
||||||
{
|
{
|
||||||
Oyster::Math::Float3 forward = this->rigidBody->GetState().GetOrientation().v[2];
|
Oyster::Math::Float3 forward = this->rigidBody->GetState().GetOrientation().v[2].GetNormalized();
|
||||||
rigidBody->SetLinearVelocity( MOVE_FORCE * -forward.GetNormalized() );
|
moveDir = -forward;
|
||||||
|
moveDir.Normalize();
|
||||||
|
rigidBody->SetLinearVelocity( MOVE_FORCE * moveDir );
|
||||||
}
|
}
|
||||||
void Player::MoveRight()
|
void Player::MoveRight()
|
||||||
{
|
{
|
||||||
//Do cross product with forward vector and negative gravity vector
|
//Do cross product with forward vector and negative gravity vector
|
||||||
Oyster::Math::Float3 forward = this->rigidBody->GetState().GetOrientation().v[2];
|
Oyster::Math::Float3 forward = this->rigidBody->GetState().GetOrientation().v[2].GetNormalized();
|
||||||
Oyster::Math::Float3 r = (-this->rigidBody->GetState().centerPos.Normalize()).Cross(forward);
|
Oyster::Math::Float3 up = this->rigidBody->GetState().centerPos.Normalize();
|
||||||
rigidBody->SetLinearVelocity(r * MOVE_FORCE);
|
Oyster::Math::Float3 r = (up).Cross(forward).Normalize();
|
||||||
|
moveDir = -r;
|
||||||
|
moveDir.Normalize();
|
||||||
|
rigidBody->SetLinearVelocity( MOVE_FORCE * moveDir );
|
||||||
}
|
}
|
||||||
void Player::MoveLeft()
|
void Player::MoveLeft()
|
||||||
{
|
{
|
||||||
//Do cross product with forward vector and negative gravity vector
|
//Do cross product with forward vector and negative gravity vector
|
||||||
Oyster::Math::Float3 forward = this->rigidBody->GetState().GetOrientation().v[2];
|
Oyster::Math::Float3 forward = this->rigidBody->GetState().GetOrientation().v[2].GetNormalized();
|
||||||
Oyster::Math::Float3 r = (-this->rigidBody->GetState().centerPos.Normalize()).Cross(forward);
|
Oyster::Math::Float3 up = this->rigidBody->GetState().centerPos.Normalize();
|
||||||
rigidBody->SetLinearVelocity(-r * MOVE_FORCE);
|
Oyster::Math::Float3 r = (up).Cross(forward).Normalize();
|
||||||
|
moveDir = r;
|
||||||
|
moveDir.Normalize();
|
||||||
|
rigidBody->SetLinearVelocity( MOVE_FORCE * moveDir );
|
||||||
}
|
}
|
||||||
|
|
||||||
void Player::UseWeapon(const WEAPON_FIRE &usage)
|
void Player::UseWeapon(const WEAPON_FIRE &usage)
|
||||||
|
@ -137,27 +146,19 @@ void Player::Respawn(Oyster::Math::Float3 spawnPoint)
|
||||||
|
|
||||||
void Player::Rotate(const Oyster::Math3D::Float4 lookDir)
|
void Player::Rotate(const Oyster::Math3D::Float4 lookDir)
|
||||||
{
|
{
|
||||||
// right
|
// this is the camera right vector
|
||||||
Oyster::Math::Float dx = lookDir.w;
|
|
||||||
if(dx > 0.0f)
|
|
||||||
{
|
|
||||||
int i =0 ;
|
|
||||||
}
|
|
||||||
|
|
||||||
this->lookDir = lookDir.xyz;
|
this->lookDir = lookDir.xyz;
|
||||||
this->dx = lookDir.w;
|
|
||||||
|
|
||||||
|
|
||||||
Oyster::Math::Float3 up = this->rigidBody->GetState().GetOrientation().v[1];
|
Oyster::Math::Float3 up = this->rigidBody->GetState().GetOrientation().v[1];
|
||||||
this->rigidBody->SetUpAndRight(up, lookDir.xyz);
|
this->rigidBody->SetUpAndRight(up, lookDir.xyz);
|
||||||
this->rigidBody->SetUpAndRight(this->rigidBody->GetState().centerPos.GetNormalized(), this->rigidBody->GetState().GetOrientation().v[0].xyz.GetNormalized());
|
this->rigidBody->SetUpAndRight(this->rigidBody->GetState().centerPos.GetNormalized(), this->rigidBody->GetState().GetOrientation().v[0].xyz.GetNormalized());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Player::Jump()
|
void Player::Jump()
|
||||||
{
|
{
|
||||||
Oyster::Math::Float3 up = this->rigidBody->GetState().GetOrientation().v[1].GetNormalized();
|
Oyster::Math::Float3 up = this->rigidBody->GetState().GetOrientation().v[1].GetNormalized();
|
||||||
this->rigidBody->ApplyImpulse(up *2000);
|
this->rigidBody->ApplyImpulse(up *1500);
|
||||||
|
this->playerState == PLAYER_STATE::PLAYER_STATE_JUMPING;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Player::IsWalking()
|
bool Player::IsWalking()
|
||||||
|
|
|
@ -85,8 +85,8 @@ namespace GameLogic
|
||||||
int teamID;
|
int teamID;
|
||||||
Weapon *weapon;
|
Weapon *weapon;
|
||||||
PLAYER_STATE playerState;
|
PLAYER_STATE playerState;
|
||||||
Oyster::Math::Float3 lookDir; //Duplicate in Object.h?
|
Oyster::Math::Float3 moveDir;
|
||||||
Oyster::Math::Float dx; //dx of what?
|
Oyster::Math::Float3 lookDir;
|
||||||
|
|
||||||
bool hasTakenDamage;
|
bool hasTakenDamage;
|
||||||
float invincibleCooldown;
|
float invincibleCooldown;
|
||||||
|
|
|
@ -292,7 +292,7 @@ namespace GameLogic
|
||||||
{
|
{
|
||||||
short object_ID;
|
short object_ID;
|
||||||
float position[3];
|
float position[3];
|
||||||
float rotation[3];
|
float rotation[4];
|
||||||
|
|
||||||
Protocol_ObjectPositionRotation()
|
Protocol_ObjectPositionRotation()
|
||||||
{
|
{
|
||||||
|
@ -307,10 +307,11 @@ namespace GameLogic
|
||||||
this->protocol[5].type = Oyster::Network::NetAttributeType_Float;
|
this->protocol[5].type = Oyster::Network::NetAttributeType_Float;
|
||||||
this->protocol[6].type = Oyster::Network::NetAttributeType_Float;
|
this->protocol[6].type = Oyster::Network::NetAttributeType_Float;
|
||||||
this->protocol[7].type = Oyster::Network::NetAttributeType_Float;
|
this->protocol[7].type = Oyster::Network::NetAttributeType_Float;
|
||||||
|
this->protocol[8].type = Oyster::Network::NetAttributeType_Float;
|
||||||
|
|
||||||
this->object_ID = 0;
|
this->object_ID = 0;
|
||||||
memset(&this->position[0], 0, sizeof(float) * 3);
|
memset(&this->position[0], 0, sizeof(float) * 3);
|
||||||
memset(&this->rotation[0], 0, sizeof(float) * 3);
|
memset(&this->rotation[0], 0, sizeof(float) * 4);
|
||||||
}
|
}
|
||||||
Protocol_ObjectPositionRotation(Oyster::Network::CustomNetProtocol& p)
|
Protocol_ObjectPositionRotation(Oyster::Network::CustomNetProtocol& p)
|
||||||
{
|
{
|
||||||
|
@ -323,6 +324,7 @@ namespace GameLogic
|
||||||
this->rotation[0] = p[5].value.netFloat;
|
this->rotation[0] = p[5].value.netFloat;
|
||||||
this->rotation[1] = p[6].value.netFloat;
|
this->rotation[1] = p[6].value.netFloat;
|
||||||
this->rotation[2] = p[7].value.netFloat;
|
this->rotation[2] = p[7].value.netFloat;
|
||||||
|
this->rotation[3] = p[8].value.netFloat;
|
||||||
}
|
}
|
||||||
Protocol_ObjectPositionRotation(float p[3], float r[3], int id)
|
Protocol_ObjectPositionRotation(float p[3], float r[3], int id)
|
||||||
{
|
{
|
||||||
|
@ -337,10 +339,11 @@ namespace GameLogic
|
||||||
this->protocol[5].type = Oyster::Network::NetAttributeType_Float;
|
this->protocol[5].type = Oyster::Network::NetAttributeType_Float;
|
||||||
this->protocol[6].type = Oyster::Network::NetAttributeType_Float;
|
this->protocol[6].type = Oyster::Network::NetAttributeType_Float;
|
||||||
this->protocol[7].type = Oyster::Network::NetAttributeType_Float;
|
this->protocol[7].type = Oyster::Network::NetAttributeType_Float;
|
||||||
|
this->protocol[8].type = Oyster::Network::NetAttributeType_Float;
|
||||||
|
|
||||||
object_ID = id;
|
object_ID = id;
|
||||||
memcpy(&this->position[0], &p[0], sizeof(float) * 3);
|
memcpy(&this->position[0], &p[0], sizeof(float) * 3);
|
||||||
memcpy(&this->rotation[0], &r[0], sizeof(float) * 3);
|
memcpy(&this->rotation[0], &r[0], sizeof(float) * 4);
|
||||||
}
|
}
|
||||||
Oyster::Network::CustomNetProtocol GetProtocol() override
|
Oyster::Network::CustomNetProtocol GetProtocol() override
|
||||||
{
|
{
|
||||||
|
@ -351,6 +354,7 @@ namespace GameLogic
|
||||||
this->protocol[5].value = this->rotation[0];
|
this->protocol[5].value = this->rotation[0];
|
||||||
this->protocol[6].value = this->rotation[1];
|
this->protocol[6].value = this->rotation[1];
|
||||||
this->protocol[7].value = this->rotation[2];
|
this->protocol[7].value = this->rotation[2];
|
||||||
|
this->protocol[8].value = this->rotation[3];
|
||||||
return protocol;
|
return protocol;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue