From aec5200893e09f90cc43b61088b30364800b51c6 Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Fri, 17 Jan 2014 11:11:17 +0100 Subject: Removed internal cEntity::GetRot() usage. --- src/Blocks/BlockChest.h | 10 +++++----- src/Blocks/BlockComparator.h | 2 +- src/Blocks/BlockDoor.h | 2 +- src/Blocks/BlockDropSpenser.h | 2 +- src/Blocks/BlockEnderchest.h | 2 +- src/Blocks/BlockFenceGate.h | 4 ++-- src/Blocks/BlockFurnace.h | 2 +- src/Blocks/BlockPiston.cpp | 2 +- src/Blocks/BlockPumpkin.h | 2 +- src/Blocks/BlockRedstoneRepeater.h | 2 +- src/Blocks/BlockStairs.h | 2 +- src/Entities/Entity.h | 4 ++-- src/Entities/Player.cpp | 4 ++-- src/Entities/ProjectileEntity.cpp | 6 +++--- src/Items/ItemBed.h | 2 +- src/Items/ItemComparator.h | 2 +- src/Items/ItemRedstoneRepeater.h | 2 +- src/Items/ItemSign.h | 2 +- src/Protocol/Protocol125.cpp | 18 +++++++++--------- src/Protocol/Protocol132.cpp | 8 ++++---- src/Protocol/Protocol14x.cpp | 2 +- src/UI/SlotArea.cpp | 2 +- src/WorldStorage/NBTChunkSerializer.cpp | 2 +- 23 files changed, 43 insertions(+), 43 deletions(-) (limited to 'src') diff --git a/src/Blocks/BlockChest.h b/src/Blocks/BlockChest.h index fc82d6575..88f7c4b32 100644 --- a/src/Blocks/BlockChest.h +++ b/src/Blocks/BlockChest.h @@ -42,13 +42,13 @@ public: { return false; } - double rot = a_Player->GetRot().x; + double yaw = a_Player->GetYaw(); if ( (Area.GetRelBlockType(0, 0, 1) == E_BLOCK_CHEST) || (Area.GetRelBlockType(2, 0, 1) == E_BLOCK_CHEST) ) { - a_BlockMeta = ((rot >= -90) && (rot < 90)) ? 2 : 3; + a_BlockMeta = ((yaw >= -90) && (yaw < 90)) ? 2 : 3; return true; } if ( @@ -56,12 +56,12 @@ public: (Area.GetRelBlockType(2, 0, 1) == E_BLOCK_CHEST) ) { - a_BlockMeta = (rot < 0) ? 4 : 5; + a_BlockMeta = (yaw < 0) ? 4 : 5; return true; } // Single chest, get meta from rotation only - a_BlockMeta = RotationToMetaData(rot); + a_BlockMeta = RotationToMetaData(yaw); return true; } @@ -80,7 +80,7 @@ public: return; } - double rot = a_Player->GetRot().x; + double rot = a_Player->GetYaw(); // FIXME: Rename rot to yaw // Choose meta from player rotation, choose only between 2 or 3 NIBBLETYPE NewMeta = ((rot >= -90) && (rot < 90)) ? 2 : 3; if ( diff --git a/src/Blocks/BlockComparator.h b/src/Blocks/BlockComparator.h index a86357260..5a8e54eda 100644 --- a/src/Blocks/BlockComparator.h +++ b/src/Blocks/BlockComparator.h @@ -53,7 +53,7 @@ public: ) override { a_BlockType = m_BlockType; - a_BlockMeta = cBlockRedstoneRepeaterHandler::RepeaterRotationToMetaData(a_Player->GetRot().x); + a_BlockMeta = cBlockRedstoneRepeaterHandler::RepeaterRotationToMetaData(a_Player->GetYaw()); return true; } diff --git a/src/Blocks/BlockDoor.h b/src/Blocks/BlockDoor.h index a4b681a22..1e86446dd 100644 --- a/src/Blocks/BlockDoor.h +++ b/src/Blocks/BlockDoor.h @@ -42,7 +42,7 @@ public: } a_BlockType = m_BlockType; - a_BlockMeta = PlayerYawToMetaData(a_Player->GetRot().x); + a_BlockMeta = PlayerYawToMetaData(a_Player->GetYaw()); return true; } diff --git a/src/Blocks/BlockDropSpenser.h b/src/Blocks/BlockDropSpenser.h index 8df8e5b35..ce9cc0c5d 100644 --- a/src/Blocks/BlockDropSpenser.h +++ b/src/Blocks/BlockDropSpenser.h @@ -31,7 +31,7 @@ public: a_BlockType = m_BlockType; // FIXME: Do not use cPiston class for dispenser placement! - a_BlockMeta = cPiston::RotationPitchToMetaData(a_Player->GetRot().x, a_Player->GetPitch()); + a_BlockMeta = cPiston::RotationPitchToMetaData(a_Player->GetYaw(), a_Player->GetPitch()); return true; } } ; diff --git a/src/Blocks/BlockEnderchest.h b/src/Blocks/BlockEnderchest.h index a115b1ee6..b648248d0 100644 --- a/src/Blocks/BlockEnderchest.h +++ b/src/Blocks/BlockEnderchest.h @@ -30,7 +30,7 @@ public: ) override { a_BlockType = m_BlockType; - a_BlockMeta = RotationToMetaData(a_Player->GetRot().x); + a_BlockMeta = RotationToMetaData(a_Player->GetYaw()); return true; } diff --git a/src/Blocks/BlockFenceGate.h b/src/Blocks/BlockFenceGate.h index e1c02f749..779f12ee1 100644 --- a/src/Blocks/BlockFenceGate.h +++ b/src/Blocks/BlockFenceGate.h @@ -25,7 +25,7 @@ public: ) override { a_BlockType = m_BlockType; - a_BlockMeta = PlayerYawToMetaData(a_Player->GetRot().x); + a_BlockMeta = PlayerYawToMetaData(a_Player->GetYaw()); return true; } @@ -33,7 +33,7 @@ public: virtual void OnUse(cWorld * a_World, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ) override { NIBBLETYPE OldMetaData = a_World->GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ); - NIBBLETYPE NewMetaData = PlayerYawToMetaData(a_Player->GetRot().x); + NIBBLETYPE NewMetaData = PlayerYawToMetaData(a_Player->GetYaw()); OldMetaData ^= 4; // Toggle the gate if ((OldMetaData & 1) == (NewMetaData & 1)) { diff --git a/src/Blocks/BlockFurnace.h b/src/Blocks/BlockFurnace.h index c6e46f27e..693eac331 100644 --- a/src/Blocks/BlockFurnace.h +++ b/src/Blocks/BlockFurnace.h @@ -35,7 +35,7 @@ public: a_BlockType = m_BlockType; // FIXME: Do not use cPiston class for furnace placement! - a_BlockMeta = cPiston::RotationPitchToMetaData(a_Player->GetRot().x, 0); + a_BlockMeta = cPiston::RotationPitchToMetaData(a_Player->GetYaw(), 0); return true; } diff --git a/src/Blocks/BlockPiston.cpp b/src/Blocks/BlockPiston.cpp index 49394b773..88259d96e 100644 --- a/src/Blocks/BlockPiston.cpp +++ b/src/Blocks/BlockPiston.cpp @@ -60,7 +60,7 @@ bool cBlockPistonHandler::GetPlacementBlockTypeMeta( ) { a_BlockType = m_BlockType; - a_BlockMeta = cPiston::RotationPitchToMetaData(a_Player->GetRot().x, a_Player->GetPitch()); + a_BlockMeta = cPiston::RotationPitchToMetaData(a_Player->GetYaw(), a_Player->GetPitch()); return true; } diff --git a/src/Blocks/BlockPumpkin.h b/src/Blocks/BlockPumpkin.h index d25a79b8a..5187f24eb 100644 --- a/src/Blocks/BlockPumpkin.h +++ b/src/Blocks/BlockPumpkin.h @@ -86,7 +86,7 @@ public: ) override { a_BlockType = m_BlockType; - a_BlockMeta = PlayerYawToMetaData(a_Player->GetRot().x); + a_BlockMeta = PlayerYawToMetaData(a_Player->GetYaw()); return true; } diff --git a/src/Blocks/BlockRedstoneRepeater.h b/src/Blocks/BlockRedstoneRepeater.h index 0f082a6e2..713664659 100644 --- a/src/Blocks/BlockRedstoneRepeater.h +++ b/src/Blocks/BlockRedstoneRepeater.h @@ -25,7 +25,7 @@ public: ) override { a_BlockType = m_BlockType; - a_BlockMeta = RepeaterRotationToMetaData(a_Player->GetRot().x); + a_BlockMeta = RepeaterRotationToMetaData(a_Player->GetYaw()); return true; } diff --git a/src/Blocks/BlockStairs.h b/src/Blocks/BlockStairs.h index e29ac6524..e463612f5 100644 --- a/src/Blocks/BlockStairs.h +++ b/src/Blocks/BlockStairs.h @@ -26,7 +26,7 @@ public: ) override { a_BlockType = m_BlockType; - a_BlockMeta = RotationToMetaData(a_Player->GetRot().x); + a_BlockMeta = RotationToMetaData(a_Player->GetYaw()); switch (a_BlockFace) { case BLOCK_FACE_TOP: break; diff --git a/src/Entities/Entity.h b/src/Entities/Entity.h index 34d8b0fed..91463bfd6 100644 --- a/src/Entities/Entity.h +++ b/src/Entities/Entity.h @@ -154,7 +154,7 @@ public: double GetPosX (void) const { return m_Pos.x; } double GetPosY (void) const { return m_Pos.y; } double GetPosZ (void) const { return m_Pos.z; } - const Vector3d & GetRot (void) const { return m_Rot; } + const Vector3d & GetRot (void) const { return m_Rot; } // OBSOLETE, use individual GetYaw(), GetPitch, GetRoll() components double GetYaw (void) const { return m_Rot.x; } double GetPitch (void) const { return m_Rot.y; } double GetRoll (void) const { return m_Rot.z; } @@ -176,7 +176,7 @@ public: void SetPosZ (double a_PosZ); void SetPosition(double a_PosX, double a_PosY, double a_PosZ); void SetPosition(const Vector3d & a_Pos) { SetPosition(a_Pos.x, a_Pos.y, a_Pos.z); } - void SetRot (const Vector3f & a_Rot); + void SetRot (const Vector3f & a_Rot); // OBSOLETE, use individual SetYaw(), SetPitch(), SetRoll() components void SetYaw (double a_Yaw); void SetPitch (double a_Pitch); void SetRoll (double a_Roll); diff --git a/src/Entities/Player.cpp b/src/Entities/Player.cpp index 386dc3a42..c1f2456eb 100644 --- a/src/Entities/Player.cpp +++ b/src/Entities/Player.cpp @@ -1396,7 +1396,7 @@ void cPlayer::TossItem( } } double vX = 0, vY = 0, vZ = 0; - EulerToVector(-GetRot().x, GetPitch(), vZ, vX, vY); + EulerToVector(-GetYaw(), GetPitch(), vZ, vX, vY); vY = -vY * 2 + 1.f; m_World->SpawnItemPickups(Drops, GetPosX(), GetEyeHeight(), GetPosZ(), vX * 3, vY * 3, vZ * 3, true); // 'true' because created by player } @@ -1591,7 +1591,7 @@ bool cPlayer::SaveToDisk() JSON_PlayerPosition.append(Json::Value(GetPosZ())); Json::Value JSON_PlayerRotation; - JSON_PlayerRotation.append(Json::Value(GetRot().x)); + JSON_PlayerRotation.append(Json::Value(GetYaw())); JSON_PlayerRotation.append(Json::Value(GetPitch())); JSON_PlayerRotation.append(Json::Value(GetRoll())); diff --git a/src/Entities/ProjectileEntity.cpp b/src/Entities/ProjectileEntity.cpp index 76365076f..12ce9a303 100644 --- a/src/Entities/ProjectileEntity.cpp +++ b/src/Entities/ProjectileEntity.cpp @@ -358,7 +358,7 @@ void cProjectileEntity::HandlePhysics(float a_Dt, cChunk & a_Chunk) m_UniqueID, GetPosX(), GetPosY(), GetPosZ(), GetSpeedX(), GetSpeedY(), GetSpeedZ(), - GetRot().x, GetPitch() + GetYaw(), GetPitch() ); } @@ -369,7 +369,7 @@ void cProjectileEntity::HandlePhysics(float a_Dt, cChunk & a_Chunk) void cProjectileEntity::SpawnOn(cClientHandle & a_Client) { // Default spawning - use the projectile kind to spawn an object: - a_Client.SendSpawnObject(*this, m_ProjectileKind, 12, ANGLE_TO_PROTO(GetRot().x), ANGLE_TO_PROTO(GetPitch())); + a_Client.SendSpawnObject(*this, m_ProjectileKind, 12, ANGLE_TO_PROTO(GetYaw()), ANGLE_TO_PROTO(GetPitch())); a_Client.SendEntityMetadata(*this); } @@ -406,7 +406,7 @@ cArrowEntity::cArrowEntity(cEntity * a_Creator, double a_X, double a_Y, double a SetPitchFromSpeed(); LOGD("Created arrow %d with speed {%.02f, %.02f, %.02f} and rot {%.02f, %.02f}", m_UniqueID, GetSpeedX(), GetSpeedY(), GetSpeedZ(), - GetRot().x, GetPitch() + GetYaw(), GetPitch() ); } diff --git a/src/Items/ItemBed.h b/src/Items/ItemBed.h index 18eec9421..9b7c8bff8 100644 --- a/src/Items/ItemBed.h +++ b/src/Items/ItemBed.h @@ -37,7 +37,7 @@ public: return false; } - a_BlockMeta = cBlockBedHandler::RotationToMetaData(a_Player->GetRot().x); + a_BlockMeta = cBlockBedHandler::RotationToMetaData(a_Player->GetYaw()); // Check if there is empty space for the foot section: Vector3i Direction = cBlockBedHandler::MetaDataToDirection(a_BlockMeta); diff --git a/src/Items/ItemComparator.h b/src/Items/ItemComparator.h index 57a1eb9ac..3a5d1d200 100644 --- a/src/Items/ItemComparator.h +++ b/src/Items/ItemComparator.h @@ -30,7 +30,7 @@ public: ) override { a_BlockType = E_BLOCK_INACTIVE_COMPARATOR; - a_BlockMeta = cBlockRedstoneRepeaterHandler::RepeaterRotationToMetaData(a_Player->GetRot().x); + a_BlockMeta = cBlockRedstoneRepeaterHandler::RepeaterRotationToMetaData(a_Player->GetYaw()); return true; } } ; diff --git a/src/Items/ItemRedstoneRepeater.h b/src/Items/ItemRedstoneRepeater.h index b927f14d7..e71c8e672 100644 --- a/src/Items/ItemRedstoneRepeater.h +++ b/src/Items/ItemRedstoneRepeater.h @@ -30,7 +30,7 @@ public: ) override { a_BlockType = E_BLOCK_REDSTONE_REPEATER_OFF; - a_BlockMeta = cBlockRedstoneRepeaterHandler::RepeaterRotationToMetaData(a_Player->GetRot().x); + a_BlockMeta = cBlockRedstoneRepeaterHandler::RepeaterRotationToMetaData(a_Player->GetYaw()); return true; } } ; diff --git a/src/Items/ItemSign.h b/src/Items/ItemSign.h index 058fe2c35..8c134ab83 100644 --- a/src/Items/ItemSign.h +++ b/src/Items/ItemSign.h @@ -34,7 +34,7 @@ public: { if (a_BlockFace == BLOCK_FACE_TOP) { - a_BlockMeta = cBlockSignHandler::RotationToMetaData(a_Player->GetRot().x); + a_BlockMeta = cBlockSignHandler::RotationToMetaData(a_Player->GetYaw()); a_BlockType = E_BLOCK_SIGN_POST; } else diff --git a/src/Protocol/Protocol125.cpp b/src/Protocol/Protocol125.cpp index 4865af2b9..323a13992 100644 --- a/src/Protocol/Protocol125.cpp +++ b/src/Protocol/Protocol125.cpp @@ -354,8 +354,8 @@ void cProtocol125::SendEntityLook(const cEntity & a_Entity) cCSLock Lock(m_CSPacket); WriteByte(PACKET_ENT_LOOK); WriteInt (a_Entity.GetUniqueID()); - WriteByte((char)((a_Entity.GetRot().x / 360.f) * 256)); - WriteByte((char)((a_Entity.GetPitch() / 360.f) * 256)); + WriteByte((char)((a_Entity.GetYaw() / 360.f) * 256)); + WriteByte((char)((a_Entity.GetPitch() / 360.f) * 256)); Flush(); } @@ -423,8 +423,8 @@ void cProtocol125::SendEntityRelMoveLook(const cEntity & a_Entity, char a_RelX, WriteByte(a_RelX); WriteByte(a_RelY); WriteByte(a_RelZ); - WriteByte((char)((a_Entity.GetRot().x / 360.f) * 256)); - WriteByte((char)((a_Entity.GetPitch() / 360.f) * 256)); + WriteByte((char)((a_Entity.GetYaw() / 360.f) * 256)); + WriteByte((char)((a_Entity.GetPitch() / 360.f) * 256)); Flush(); } @@ -664,7 +664,7 @@ void cProtocol125::SendPlayerMoveLook(void) WriteDouble(Player->GetStance() + 0.03); // Add a small amount so that the player doesn't start inside a block WriteDouble(Player->GetPosY() + 0.03); // Add a small amount so that the player doesn't start inside a block WriteDouble(Player->GetPosZ()); - WriteFloat ((float)(Player->GetRot().x)); + WriteFloat ((float)(Player->GetYaw())); WriteFloat ((float)(Player->GetPitch())); WriteBool (Player->IsOnGround()); Flush(); @@ -694,8 +694,8 @@ void cProtocol125::SendPlayerSpawn(const cPlayer & a_Player) WriteInt ((int)(a_Player.GetPosX() * 32)); WriteInt ((int)(a_Player.GetPosY() * 32)); WriteInt ((int)(a_Player.GetPosZ() * 32)); - WriteByte ((char)((a_Player.GetRot().x / 360.f) * 256)); - WriteByte ((char)((a_Player.GetRot().y / 360.f) * 256)); + WriteByte ((char)((a_Player.GetYaw() / 360.f) * 256)); + WriteByte ((char)((a_Player.GetPitch() / 360.f) * 256)); WriteShort (HeldItem.IsEmpty() ? 0 : HeldItem.m_ItemType); Flush(); } @@ -864,7 +864,7 @@ void cProtocol125::SendSpawnVehicle(const cEntity & a_Vehicle, char a_VehicleTyp WriteInt ((int)(a_Vehicle.GetPosY() * 32)); WriteInt ((int)(a_Vehicle.GetPosZ() * 32)); WriteByte ((Byte)((a_Vehicle.GetPitch() / 360.f) * 256)); - WriteByte ((Byte)((a_Vehicle.GetRot().x / 360.f) * 256)); + WriteByte ((Byte)((a_Vehicle.GetYaw() / 360.f) * 256)); WriteInt (a_VehicleSubType); if (a_VehicleSubType != 0) { @@ -897,7 +897,7 @@ void cProtocol125::SendTeleportEntity(const cEntity & a_Entity) WriteInt ((int)(floor(a_Entity.GetPosX() * 32))); WriteInt ((int)(floor(a_Entity.GetPosY() * 32))); WriteInt ((int)(floor(a_Entity.GetPosZ() * 32))); - WriteByte ((char)((a_Entity.GetRot().x / 360.f) * 256)); + WriteByte ((char)((a_Entity.GetYaw() / 360.f) * 256)); WriteByte ((char)((a_Entity.GetPitch() / 360.f) * 256)); Flush(); } diff --git a/src/Protocol/Protocol132.cpp b/src/Protocol/Protocol132.cpp index 80910c1c8..29fbb4bba 100644 --- a/src/Protocol/Protocol132.cpp +++ b/src/Protocol/Protocol132.cpp @@ -367,8 +367,8 @@ void cProtocol132::SendPlayerSpawn(const cPlayer & a_Player) WriteInt ((int)(a_Player.GetPosX() * 32)); WriteInt ((int)(a_Player.GetPosY() * 32)); WriteInt ((int)(a_Player.GetPosZ() * 32)); - WriteByte ((char)((a_Player.GetRot().x / 360.f) * 256)); - WriteByte ((char)((a_Player.GetRot().y / 360.f) * 256)); + WriteByte ((char)((a_Player.GetYaw() / 360.f) * 256)); + WriteByte ((char)((a_Player.GetPitch() / 360.f) * 256)); WriteShort (HeldItem.IsEmpty() ? 0 : HeldItem.m_ItemType); // Player metadata: just use a default metadata value, since the client doesn't like starting without any metadata: WriteByte (0); // Index 0, byte (flags) @@ -421,8 +421,8 @@ void cProtocol132::SendSpawnMob(const cMonster & a_Mob) WriteInt (a_Mob.GetUniqueID()); WriteByte (a_Mob.GetMobType()); WriteVectorI((Vector3i)(a_Mob.GetPosition() * 32)); - WriteByte ((Byte)((a_Mob.GetRot().x / 360.f) * 256)); - WriteByte ((Byte)((a_Mob.GetPitch() / 360.f) * 256)); + WriteByte ((Byte)((a_Mob.GetYaw() / 360.f) * 256)); + WriteByte ((Byte)((a_Mob.GetPitch() / 360.f) * 256)); WriteByte ((Byte)((a_Mob.GetHeadYaw() / 360.f) * 256)); WriteShort ((short)(a_Mob.GetSpeedX() * 400)); WriteShort ((short)(a_Mob.GetSpeedY() * 400)); diff --git a/src/Protocol/Protocol14x.cpp b/src/Protocol/Protocol14x.cpp index 9868de464..127ce9d4b 100644 --- a/src/Protocol/Protocol14x.cpp +++ b/src/Protocol/Protocol14x.cpp @@ -250,7 +250,7 @@ void cProtocol146::SendSpawnVehicle(const cEntity & a_Vehicle, char a_VehicleTyp WriteInt ((int)(a_Vehicle.GetPosY() * 32)); WriteInt ((int)(a_Vehicle.GetPosZ() * 32)); WriteByte ((Byte)((a_Vehicle.GetPitch() / 360.f) * 256)); - WriteByte ((Byte)((a_Vehicle.GetRot().x / 360.f) * 256)); + WriteByte ((Byte)((a_Vehicle.GetYaw() / 360.f) * 256)); WriteInt (a_VehicleSubType); if (a_VehicleSubType != 0) { diff --git a/src/UI/SlotArea.cpp b/src/UI/SlotArea.cpp index c8653a1e5..bfcad3d92 100644 --- a/src/UI/SlotArea.cpp +++ b/src/UI/SlotArea.cpp @@ -911,7 +911,7 @@ void cSlotAreaTemporary::TossItems(cPlayer & a_Player, int a_Begin, int a_End) } // for i - itr->second[] double vX = 0, vY = 0, vZ = 0; - EulerToVector(-a_Player.GetRot().x, a_Player.GetPitch(), vZ, vX, vY); + EulerToVector(-a_Player.GetYaw(), a_Player.GetPitch(), vZ, vX, vY); vY = -vY * 2 + 1.f; a_Player.GetWorld()->SpawnItemPickups(Drops, a_Player.GetPosX(), a_Player.GetPosY() + 1.6f, a_Player.GetPosZ(), vX * 3, vY * 3, vZ * 3, true); // 'true' because player created } diff --git a/src/WorldStorage/NBTChunkSerializer.cpp b/src/WorldStorage/NBTChunkSerializer.cpp index f376622e2..e1205f2be 100644 --- a/src/WorldStorage/NBTChunkSerializer.cpp +++ b/src/WorldStorage/NBTChunkSerializer.cpp @@ -257,7 +257,7 @@ void cNBTChunkSerializer::AddBasicEntity(cEntity * a_Entity, const AString & a_C m_Writer.AddDouble("", a_Entity->GetSpeedZ()); m_Writer.EndList(); m_Writer.BeginList("Rotation", TAG_Double); - m_Writer.AddDouble("", a_Entity->GetRot().x); + m_Writer.AddDouble("", a_Entity->GetYaw()); m_Writer.AddDouble("", a_Entity->GetPitch()); m_Writer.EndList(); } -- cgit v1.2.3