heading, x_pos, y_pos, and z_pos replaced with m_Position in Mob

This commit is contained in:
Arthur Ice
2014-11-25 20:16:04 -08:00
parent 640aea24bc
commit 53602e3c61
13 changed files with 318 additions and 319 deletions
+51 -51
View File
@@ -157,10 +157,10 @@ Mob::Mob(const char* in_name,
if (runspeed < 0 || runspeed > 20)
runspeed = 1.25f;
heading = in_heading;
x_pos = in_x_pos;
y_pos = in_y_pos;
z_pos = in_z_pos;
m_Position.m_Heading = in_heading;
m_Position.m_X = in_x_pos;
m_Position.m_Y = in_y_pos;
m_Position.m_Z = in_z_pos;
light = in_light;
texture = in_texture;
helmtexture = in_helmtexture;
@@ -373,7 +373,7 @@ Mob::Mob(const char* in_name,
m_targetable = true;
targetring_x = 0.0f;
targetring_y = 0.0f;
targetring_y = 0.0f;
targetring_z = 0.0f;
flymode = FlyMode3;
@@ -882,10 +882,10 @@ void Mob::FillSpawnStruct(NewSpawn_Struct* ns, Mob* ForWho)
strn0cpy(ns->spawn.lastName, lastname, sizeof(ns->spawn.lastName));
}
ns->spawn.heading = FloatToEQ19(heading);
ns->spawn.x = FloatToEQ19(x_pos);//((int32)x_pos)<<3;
ns->spawn.y = FloatToEQ19(y_pos);//((int32)y_pos)<<3;
ns->spawn.z = FloatToEQ19(z_pos);//((int32)z_pos)<<3;
ns->spawn.heading = FloatToEQ19(m_Position.m_Heading);
ns->spawn.x = FloatToEQ19(m_Position.m_X);//((int32)x_pos)<<3;
ns->spawn.y = FloatToEQ19(m_Position.m_Y);//((int32)y_pos)<<3;
ns->spawn.z = FloatToEQ19(m_Position.m_Z);//((int32)z_pos)<<3;
ns->spawn.spawnId = GetID();
ns->spawn.curHp = static_cast<uint8>(GetHPRatio());
ns->spawn.max_hp = 100; //this field needs a better name
@@ -1211,13 +1211,13 @@ void Mob::SendPosUpdate(uint8 iSendToSelf) {
void Mob::MakeSpawnUpdateNoDelta(PlayerPositionUpdateServer_Struct *spu){
memset(spu,0xff,sizeof(PlayerPositionUpdateServer_Struct));
spu->spawn_id = GetID();
spu->x_pos = FloatToEQ19(x_pos);
spu->y_pos = FloatToEQ19(y_pos);
spu->z_pos = FloatToEQ19(z_pos);
spu->x_pos = FloatToEQ19(m_Position.m_X);
spu->y_pos = FloatToEQ19(m_Position.m_Y);
spu->z_pos = FloatToEQ19(m_Position.m_Z);
spu->delta_x = NewFloatToEQ13(0);
spu->delta_y = NewFloatToEQ13(0);
spu->delta_z = NewFloatToEQ13(0);
spu->heading = FloatToEQ19(heading);
spu->heading = FloatToEQ19(m_Position.m_Heading);
spu->animation = 0;
spu->delta_heading = NewFloatToEQ13(0);
spu->padding0002 =0;
@@ -1230,13 +1230,13 @@ void Mob::MakeSpawnUpdateNoDelta(PlayerPositionUpdateServer_Struct *spu){
// this is for SendPosUpdate()
void Mob::MakeSpawnUpdate(PlayerPositionUpdateServer_Struct* spu) {
spu->spawn_id = GetID();
spu->x_pos = FloatToEQ19(x_pos);
spu->y_pos = FloatToEQ19(y_pos);
spu->z_pos = FloatToEQ19(z_pos);
spu->x_pos = FloatToEQ19(m_Position.m_X);
spu->y_pos = FloatToEQ19(m_Position.m_Y);
spu->z_pos = FloatToEQ19(m_Position.m_Z);
spu->delta_x = NewFloatToEQ13(delta_x);
spu->delta_y = NewFloatToEQ13(delta_y);
spu->delta_z = NewFloatToEQ13(delta_z);
spu->heading = FloatToEQ19(heading);
spu->heading = FloatToEQ19(m_Position.m_Heading);
spu->padding0002 =0;
spu->padding0006 =7;
spu->padding0014 =0x7f;
@@ -1361,11 +1361,11 @@ void Mob::GMMove(float x, float y, float z, float heading, bool SendUpdate) {
entity_list.ProcessMove(CastToNPC(), x, y, z);
}
x_pos = x;
y_pos = y;
z_pos = z;
if (heading != 0.01)
this->heading = heading;
m_Position.m_X = x;
m_Position.m_Y = y;
m_Position.m_Z = z;
if (m_Position.m_Heading != 0.01)
this->m_Position.m_Heading = heading;
if(IsNPC())
CastToNPC()->SaveGuardSpot(true);
if(SendUpdate)
@@ -2062,9 +2062,9 @@ bool Mob::CanThisClassBlock(void) const
}
float Mob::Dist(const Mob &other) const {
float xDiff = other.x_pos - x_pos;
float yDiff = other.y_pos - y_pos;
float zDiff = other.z_pos - z_pos;
float xDiff = other.m_Position.m_X - m_Position.m_X;
float yDiff = other.m_Position.m_Y - m_Position.m_Y;
float zDiff = other.m_Position.m_Z - m_Position.m_Z;
return sqrtf( (xDiff * xDiff)
+ (yDiff * yDiff)
@@ -2072,17 +2072,17 @@ float Mob::Dist(const Mob &other) const {
}
float Mob::DistNoZ(const Mob &other) const {
float xDiff = other.x_pos - x_pos;
float yDiff = other.y_pos - y_pos;
float xDiff = other.m_Position.m_X - m_Position.m_X;
float yDiff = other.m_Position.m_Y - m_Position.m_Y;
return sqrtf( (xDiff * xDiff)
+ (yDiff * yDiff) );
}
float Mob::DistNoRoot(const Mob &other) const {
float xDiff = other.x_pos - x_pos;
float yDiff = other.y_pos - y_pos;
float zDiff = other.z_pos - z_pos;
float xDiff = other.m_Position.m_X - m_Position.m_X;
float yDiff = other.m_Position.m_Y - m_Position.m_Y;
float zDiff = other.m_Position.m_Z - m_Position.m_Z;
return ( (xDiff * xDiff)
+ (yDiff * yDiff)
@@ -2090,9 +2090,9 @@ float Mob::DistNoRoot(const Mob &other) const {
}
float Mob::DistNoRoot(float x, float y, float z) const {
float xDiff = x - x_pos;
float yDiff = y - y_pos;
float zDiff = z - z_pos;
float xDiff = x - m_Position.m_X;
float yDiff = y - m_Position.m_Y;
float zDiff = z - m_Position.m_Z;
return ( (xDiff * xDiff)
+ (yDiff * yDiff)
@@ -2100,15 +2100,15 @@ float Mob::DistNoRoot(float x, float y, float z) const {
}
float Mob::DistNoRootNoZ(float x, float y) const {
float xDiff = x - x_pos;
float yDiff = y - y_pos;
float xDiff = x - m_Position.m_X;
float yDiff = y - m_Position.m_Y;
return ( (xDiff * xDiff) + (yDiff * yDiff) );
}
float Mob::DistNoRootNoZ(const Mob &other) const {
float xDiff = other.x_pos - x_pos;
float yDiff = other.y_pos - y_pos;
float xDiff = other.m_Position.m_X - m_Position.m_X;
float yDiff = other.m_Position.m_Y - m_Position.m_Y;
return ( (xDiff * xDiff) + (yDiff * yDiff) );
}
@@ -2253,7 +2253,7 @@ bool Mob::HateSummon() {
entity_list.MessageClose(this, true, 500, MT_Say, "%s says,'You will not evade me, %s!' ", GetCleanName(), target->GetCleanName() );
if (target->IsClient()) {
target->CastToClient()->MovePC(zone->GetZoneID(), zone->GetInstanceID(), x_pos, y_pos, z_pos, target->GetHeading(), 0, SummonPC);
target->CastToClient()->MovePC(zone->GetZoneID(), zone->GetInstanceID(), m_Position.m_X, m_Position.m_Y, m_Position.m_Z, target->GetHeading(), 0, SummonPC);
}
else {
#ifdef BOTS
@@ -2266,7 +2266,7 @@ bool Mob::HateSummon() {
}
#endif //BOTS
target->GMMove(x_pos, y_pos, z_pos, target->GetHeading());
target->GMMove(m_Position.m_X, m_Position.m_Y, m_Position.m_Z, target->GetHeading());
}
return true;
@@ -2614,9 +2614,9 @@ void Mob::Warp( float x, float y, float z )
entity_list.ProcessMove(CastToNPC(), x, y, z);
}
x_pos = x;
y_pos = y;
z_pos = z;
m_Position.m_X = x;
m_Position.m_Y = y;
m_Position.m_Z = z;
Mob* target = GetTarget();
if (target) {
@@ -2829,9 +2829,9 @@ float Mob::FindGroundZ(float new_x, float new_y, float z_offset)
if (zone->zonemap != nullptr)
{
Map::Vertex me;
me.x = new_x;
me.y = new_y;
me.z = z_pos+z_offset;
me.x = m_Position.m_X;
me.y = m_Position.m_Y;
me.z = m_Position.m_Z + z_offset;
Map::Vertex hit;
float best_z = zone->zonemap->FindBestZ(me, &hit);
if (best_z != -999999)
@@ -2849,9 +2849,9 @@ float Mob::GetGroundZ(float new_x, float new_y, float z_offset)
if (zone->zonemap != 0)
{
Map::Vertex me;
me.x = new_x;
me.y = new_y;
me.z = z_pos+z_offset;
me.x = m_Position.m_X;
me.y = m_Position.m_Y;
me.z = m_Position.m_Z+z_offset;
Map::Vertex hit;
float best_z = zone->zonemap->FindBestZ(me, &hit);
if (best_z != -999999)
@@ -3068,7 +3068,7 @@ bool Mob::TrySpellTrigger(Mob *target, uint32 spell_id, int effect)
{
if(!target || !IsValidSpell(spell_id))
return false;
int spell_trig = 0;
// Count all the percentage chances to trigger for all effects
for(int i = 0; i < EFFECT_COUNT; i++)
@@ -5060,7 +5060,7 @@ int32 Mob::GetSpellStat(uint32 spell_id, const char *identifier, uint8 slot)
if (slot < 4){
if (id == "components") { spells[spell_id].components[slot];}
else if (id == "component_counts") {spells[spell_id].component_counts[slot];}
else if (id == "component_counts") {spells[spell_id].component_counts[slot];}
else if (id == "NoexpendReagent") {spells[spell_id].NoexpendReagent[slot];}
}
@@ -5138,7 +5138,7 @@ int32 Mob::GetSpellStat(uint32 spell_id, const char *identifier, uint8 slot)
else if (id == "max_dist") {stat = static_cast<int32>(spells[spell_id].max_dist); }
else if (id == "min_range") {stat = static_cast<int32>(spells[spell_id].min_range); }
else if (id == "DamageShieldType") {stat = spells[spell_id].DamageShieldType; }
return stat;
}