*Update gameobject visual and command. By Vladimir.

--HG--
branch : trunk
This commit is contained in:
megamage committed 2009-03-19 15:16:02 -06:00
1 parent bf7cfe6964
commit 64ce6533a9
7 files changed
+543 -482

No files matched your search

+7 -6
View File
@@ -1406,20 +1406,21 @@ const char* GameObject::GetNameForLocaleIdx(int32 loc_idx) const
void GameObject::UpdateRotationFields(float rotation2 /*=0.0f*/, float rotation3 /*=0.0f*/)
{
static double const atan_pow = atan(pow(2.0f, -20.0f));
SetFloatValue(GAMEOBJECT_FACING, GetOrientation());
int64 rotation = 0;
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);