diff options
author | andrew <xdotftw@gmail.com> | 2014-02-19 19:57:14 +0100 |
---|---|---|
committer | andrew <xdotftw@gmail.com> | 2014-02-19 19:57:14 +0100 |
commit | 58a708825fa7e79c9dcbe6ad1bbbb2c0c3247edc (patch) | |
tree | 65bfddbbf4d72b2a359496d2710a74c414e4b9be /src/Map.cpp | |
parent | Documented cMap (diff) | |
download | cuberite-58a708825fa7e79c9dcbe6ad1bbbb2c0c3247edc.tar cuberite-58a708825fa7e79c9dcbe6ad1bbbb2c0c3247edc.tar.gz cuberite-58a708825fa7e79c9dcbe6ad1bbbb2c0c3247edc.tar.bz2 cuberite-58a708825fa7e79c9dcbe6ad1bbbb2c0c3247edc.tar.lz cuberite-58a708825fa7e79c9dcbe6ad1bbbb2c0c3247edc.tar.xz cuberite-58a708825fa7e79c9dcbe6ad1bbbb2c0c3247edc.tar.zst cuberite-58a708825fa7e79c9dcbe6ad1bbbb2c0c3247edc.zip |
Diffstat (limited to 'src/Map.cpp')
-rw-r--r-- | src/Map.cpp | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/src/Map.cpp b/src/Map.cpp index 4f8924af2..a194dbd96 100644 --- a/src/Map.cpp +++ b/src/Map.cpp @@ -9,6 +9,7 @@ #include "World.h" #include "Chunk.h" #include "Entities/Player.h" +#include "FastRandom.h" @@ -52,14 +53,14 @@ T Clamp(T a_X, T a_Min, T a_Max) void cMapDecorator::Update(void) { - ASSERT(m_Map != NULL); - unsigned int PixelWidth = m_Map->GetPixelWidth(); - - int InsideWidth = (m_Map->GetWidth() / 2) - 1; - int InsideHeight = (m_Map->GetHeight() / 2) - 1; - if (m_Player != NULL) { + ASSERT(m_Map != NULL); + unsigned int PixelWidth = m_Map->GetPixelWidth(); + + int InsideWidth = (m_Map->GetWidth() / 2) - 1; + int InsideHeight = (m_Map->GetHeight() / 2) - 1; + int PixelX = (m_Player->GetPosX() - m_Map->GetCenterX()) / PixelWidth; int PixelZ = (m_Player->GetPosZ() - m_Map->GetCenterZ()) / PixelWidth; @@ -67,18 +68,22 @@ void cMapDecorator::Update(void) m_PixelX = (2 * PixelX) + 1; m_PixelZ = (2 * PixelZ) + 1; - // 1px border if ((PixelX > -InsideWidth) && (PixelX <= InsideWidth) && (PixelZ > -InsideHeight) && (PixelZ <= InsideHeight)) { double Yaw = m_Player->GetYaw(); - m_Rot = (Yaw * 16) / 360; - if (m_Map->GetDimension() == dimNether) { + cFastRandom Random; + Int64 WorldAge = m_Player->GetWorld()->GetWorldAge(); - // TODO 2014-02-18 xdot: Random rotations + // TODO 2014-02-19 xdot: Refine + m_Rot = Random.NextInt(16, WorldAge); + } + else + { + m_Rot = (Yaw * 16) / 360; } m_Type = E_TYPE_PLAYER; |