aboutsummaryrefslogtreecommitdiff
path: root/src/game/GameObject.cpp
diff options
context:
space:
mode:
authorXTZGZoReX <none@none>2009-03-20 15:17:58 +0100
committerXTZGZoReX <none@none>2009-03-20 15:17:58 +0100
commitd1adac0d11847c893b2df0778b81dbbbb79b20ee (patch)
treebef465fd25746ed1e276ede2238f155b1a347a4a /src/game/GameObject.cpp
parent3c713189fb6ac6666e6d8e7faa2e1fec6b425725 (diff)
parent4d7ee8208e0e1762ca70d1cee253e51d3c517551 (diff)
* Merge.
--HG-- branch : trunk
Diffstat (limited to 'src/game/GameObject.cpp')
-rw-r--r--src/game/GameObject.cpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/game/GameObject.cpp b/src/game/GameObject.cpp
index 00e60395ce4..f17533f04cb 100644
--- a/src/game/GameObject.cpp
+++ b/src/game/GameObject.cpp
@@ -1406,20 +1406,21 @@ const char* GameObject::GetNameForLocaleIdx(int32 loc_idx) const
void GameObject::UpdateRotationFields(float rotation2 /*=0.0f*/, float rotation3 /*=0.0f*/)
{
- SetFloatValue(GAMEOBJECT_FACING, GetOrientation());
+ static double const atan_pow = atan(pow(2.0f, -20.0f));
- int64 rotation = 0;
+ SetFloatValue(GAMEOBJECT_FACING, GetOrientation());
double f_rot1 = sin(GetOrientation() / 2.0f);
- int64 i_rot1 = int64(f_rot1 / atan(pow(2.0f, -20.0f)));
- rotation |= (i_rot1 << 43 >> 43) & 0x00000000001FFFFF;
+ double f_rot2 = cos(GetOrientation() / 2.0f);
+ int64 i_rot1 = int64(f_rot1 / atan_pow *(f_rot2 >= 0 ? 1.0f : -1.0f));
+ int64 rotation = (i_rot1 << 43 >> 43) & 0x00000000001FFFFF;
SetUInt64Value(GAMEOBJECT_ROTATION, rotation);
if(rotation2==0.0f && rotation3==0.0f)
{
- rotation2 = sin(GetOrientation()/2);
- rotation3 = cos(GetOrientation()/2);
+ rotation2 = f_rot1;
+ rotation3 = f_rot2;
}
SetFloatValue(GAMEOBJECT_PARENTROTATION+2, rotation2);