mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-13 23:01:30 +00:00
Removed existing movement code, started replacing
This commit is contained in:
parent
953bee6c21
commit
c677169edd
@ -281,7 +281,6 @@ void Bot::Sit() {
|
|||||||
if(IsMoving()) {
|
if(IsMoving()) {
|
||||||
moved = false;
|
moved = false;
|
||||||
SetCurrentSpeed(0);
|
SetCurrentSpeed(0);
|
||||||
tar_ndx = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SetAppearance(eaSitting);
|
SetAppearance(eaSitting);
|
||||||
@ -2694,9 +2693,6 @@ void Bot::AI_Process() {
|
|||||||
|
|
||||||
Goal = UpdatePath(Goal.x, Goal.y, Goal.z,
|
Goal = UpdatePath(Goal.x, Goal.y, Goal.z,
|
||||||
GetBotRunspeed(), WaypointChanged, NodeReached);
|
GetBotRunspeed(), WaypointChanged, NodeReached);
|
||||||
|
|
||||||
if (WaypointChanged)
|
|
||||||
tar_ndx = 20;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CalculateNewPosition(Goal.x, Goal.y, Goal.z, GetBotRunspeed());
|
CalculateNewPosition(Goal.x, Goal.y, Goal.z, GetBotRunspeed());
|
||||||
@ -2822,9 +2818,6 @@ void Bot::AI_Process() {
|
|||||||
|
|
||||||
Goal = UpdatePath(Goal.x, Goal.y, Goal.z,
|
Goal = UpdatePath(Goal.x, Goal.y, Goal.z,
|
||||||
speed, WaypointChanged, NodeReached);
|
speed, WaypointChanged, NodeReached);
|
||||||
|
|
||||||
if (WaypointChanged)
|
|
||||||
tar_ndx = 20;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CalculateNewPosition(Goal.x, Goal.y, Goal.z, speed);
|
CalculateNewPosition(Goal.x, Goal.y, Goal.z, speed);
|
||||||
|
|||||||
@ -242,46 +242,46 @@ bool Client::Process() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Build a close range list of NPC's */
|
///* Build a close range list of NPC's */
|
||||||
if (npc_close_scan_timer.Check()) {
|
//if (npc_close_scan_timer.Check()) {
|
||||||
close_mobs.clear();
|
// close_mobs.clear();
|
||||||
|
//
|
||||||
/* Force spawn updates when traveled far */
|
// /* Force spawn updates when traveled far */
|
||||||
bool force_spawn_updates = false;
|
// bool force_spawn_updates = false;
|
||||||
float client_update_range = (RuleI(Range, ClientForceSpawnUpdateRange) * RuleI(Range, ClientForceSpawnUpdateRange));
|
// float client_update_range = (RuleI(Range, ClientForceSpawnUpdateRange) * RuleI(Range, ClientForceSpawnUpdateRange));
|
||||||
if (DistanceSquared(last_major_update_position, m_Position) >= client_update_range) {
|
// if (DistanceSquared(last_major_update_position, m_Position) >= client_update_range) {
|
||||||
last_major_update_position = m_Position;
|
// last_major_update_position = m_Position;
|
||||||
force_spawn_updates = true;
|
// force_spawn_updates = true;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
float scan_range = (RuleI(Range, ClientNPCScan) * RuleI(Range, ClientNPCScan));
|
// float scan_range = (RuleI(Range, ClientNPCScan) * RuleI(Range, ClientNPCScan));
|
||||||
auto &mob_list = entity_list.GetMobList();
|
// auto &mob_list = entity_list.GetMobList();
|
||||||
for (auto itr = mob_list.begin(); itr != mob_list.end(); ++itr) {
|
// for (auto itr = mob_list.begin(); itr != mob_list.end(); ++itr) {
|
||||||
Mob* mob = itr->second;
|
// Mob* mob = itr->second;
|
||||||
|
//
|
||||||
float distance = DistanceSquared(m_Position, mob->GetPosition());
|
// float distance = DistanceSquared(m_Position, mob->GetPosition());
|
||||||
if (mob->IsNPC()) {
|
// if (mob->IsNPC()) {
|
||||||
if (distance <= scan_range) {
|
// if (distance <= scan_range) {
|
||||||
close_mobs.insert(std::pair<Mob *, float>(mob, distance));
|
// close_mobs.insert(std::pair<Mob *, float>(mob, distance));
|
||||||
}
|
// }
|
||||||
else if ((mob->GetAggroRange() * mob->GetAggroRange()) > scan_range) {
|
// else if ((mob->GetAggroRange() * mob->GetAggroRange()) > scan_range) {
|
||||||
close_mobs.insert(std::pair<Mob *, float>(mob, distance));
|
// close_mobs.insert(std::pair<Mob *, float>(mob, distance));
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
if (force_spawn_updates && mob != this) {
|
// if (force_spawn_updates && mob != this) {
|
||||||
|
//
|
||||||
if (mob->is_distance_roamer) {
|
// if (mob->is_distance_roamer) {
|
||||||
mob->SendPositionUpdateToClient(this);
|
// mob->SendPositionUpdateToClient(this);
|
||||||
continue;
|
// continue;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
if (distance <= client_update_range)
|
// if (distance <= client_update_range)
|
||||||
mob->SendPositionUpdateToClient(this);
|
// mob->SendPositionUpdateToClient(this);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
|
|
||||||
bool may_use_attacks = false;
|
bool may_use_attacks = false;
|
||||||
/*
|
/*
|
||||||
|
|||||||
@ -7242,9 +7242,6 @@ void command_pf(Client *c, const Seperator *sep)
|
|||||||
Mob *who = c->GetTarget();
|
Mob *who = c->GetTarget();
|
||||||
c->Message(0, "POS: (%.2f, %.2f, %.2f)", who->GetX(), who->GetY(), who->GetZ());
|
c->Message(0, "POS: (%.2f, %.2f, %.2f)", who->GetX(), who->GetY(), who->GetZ());
|
||||||
c->Message(0, "WP: %s (%d/%d)", to_string(who->GetCurrentWayPoint()).c_str(), who->IsNPC()?who->CastToNPC()->GetMaxWp():-1);
|
c->Message(0, "WP: %s (%d/%d)", to_string(who->GetCurrentWayPoint()).c_str(), who->IsNPC()?who->CastToNPC()->GetMaxWp():-1);
|
||||||
c->Message(0, "TAR: (%.2f, %.2f, %.2f)", who->GetTarX(), who->GetTarY(), who->GetTarZ());
|
|
||||||
c->Message(0, "TARV: (%.2f, %.2f, %.2f)", who->GetTarVX(), who->GetTarVY(), who->GetTarVZ());
|
|
||||||
c->Message(0, "|TV|=%.2f index=%d", who->GetTarVector(), who->GetTarNDX());
|
|
||||||
c->Message(0, "pause=%d RAspeed=%d", who->GetCWPP(), who->GetRunAnimSpeed());
|
c->Message(0, "pause=%d RAspeed=%d", who->GetCWPP(), who->GetRunAnimSpeed());
|
||||||
} else {
|
} else {
|
||||||
c->Message(0, "ERROR: target required");
|
c->Message(0, "ERROR: target required");
|
||||||
|
|||||||
@ -2655,49 +2655,49 @@ void EntityList::RemoveDebuffs(Mob *caster)
|
|||||||
// all updates into one packet.
|
// all updates into one packet.
|
||||||
void EntityList::SendPositionUpdates(Client *client, uint32 cLastUpdate, float update_range, Entity *always_send, bool iSendEvenIfNotChanged)
|
void EntityList::SendPositionUpdates(Client *client, uint32 cLastUpdate, float update_range, Entity *always_send, bool iSendEvenIfNotChanged)
|
||||||
{
|
{
|
||||||
update_range = (update_range * update_range);
|
// update_range = (update_range * update_range);
|
||||||
|
//
|
||||||
EQApplicationPacket *outapp = 0;
|
// EQApplicationPacket *outapp = 0;
|
||||||
PlayerPositionUpdateServer_Struct *ppu = 0;
|
// PlayerPositionUpdateServer_Struct *ppu = 0;
|
||||||
Mob *mob = 0;
|
// Mob *mob = 0;
|
||||||
|
//
|
||||||
auto it = mob_list.begin();
|
// auto it = mob_list.begin();
|
||||||
while (it != mob_list.end()) {
|
// while (it != mob_list.end()) {
|
||||||
|
//
|
||||||
mob = it->second;
|
// mob = it->second;
|
||||||
|
//
|
||||||
if (
|
// if (
|
||||||
mob && !mob->IsCorpse()
|
// mob && !mob->IsCorpse()
|
||||||
&& (it->second != client)
|
// && (it->second != client)
|
||||||
&& (mob->IsClient() || iSendEvenIfNotChanged || (mob->LastChange() >= cLastUpdate))
|
// && (mob->IsClient() || iSendEvenIfNotChanged || (mob->LastChange() >= cLastUpdate))
|
||||||
&& (it->second->ShouldISpawnFor(client))
|
// && (it->second->ShouldISpawnFor(client))
|
||||||
) {
|
// ) {
|
||||||
if (
|
// if (
|
||||||
update_range == 0
|
// update_range == 0
|
||||||
|| (it->second == always_send)
|
// || (it->second == always_send)
|
||||||
|| mob->IsClient()
|
// || mob->IsClient()
|
||||||
|| (DistanceSquared(mob->GetPosition(), client->GetPosition()) <= update_range)
|
// || (DistanceSquared(mob->GetPosition(), client->GetPosition()) <= update_range)
|
||||||
) {
|
// ) {
|
||||||
if (mob && mob->IsClient() && mob->GetID() > 0) {
|
// if (mob && mob->IsClient() && mob->GetID() > 0) {
|
||||||
client->QueuePacket(outapp, false, Client::CLIENT_CONNECTED);
|
// client->QueuePacket(outapp, false, Client::CLIENT_CONNECTED);
|
||||||
|
//
|
||||||
if (outapp == 0) {
|
// if (outapp == 0) {
|
||||||
outapp = new EQApplicationPacket(OP_ClientUpdate, sizeof(PlayerPositionUpdateServer_Struct));
|
// outapp = new EQApplicationPacket(OP_ClientUpdate, sizeof(PlayerPositionUpdateServer_Struct));
|
||||||
ppu = (PlayerPositionUpdateServer_Struct*)outapp->pBuffer;
|
// ppu = (PlayerPositionUpdateServer_Struct*)outapp->pBuffer;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
mob->MakeSpawnUpdate(ppu);
|
// mob->MakeSpawnUpdate(ppu);
|
||||||
|
//
|
||||||
safe_delete(outapp);
|
// safe_delete(outapp);
|
||||||
outapp = 0;
|
// outapp = 0;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
++it;
|
// ++it;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
safe_delete(outapp);
|
// safe_delete(outapp);
|
||||||
}
|
}
|
||||||
|
|
||||||
char *EntityList::MakeNameUnique(char *name)
|
char *EntityList::MakeNameUnique(char *name)
|
||||||
|
|||||||
@ -1490,9 +1490,6 @@ void Merc::AI_Process() {
|
|||||||
NodeReached
|
NodeReached
|
||||||
);
|
);
|
||||||
|
|
||||||
if (WaypointChanged)
|
|
||||||
tar_ndx = 20;
|
|
||||||
|
|
||||||
CalculateNewPosition(Goal.x, Goal.y, Goal.z, GetRunspeed());
|
CalculateNewPosition(Goal.x, Goal.y, Goal.z, GetRunspeed());
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -1784,9 +1781,6 @@ void Merc::AI_Process() {
|
|||||||
glm::vec3 Goal = UpdatePath(follow->GetX(), follow->GetY(), follow->GetZ(),
|
glm::vec3 Goal = UpdatePath(follow->GetX(), follow->GetY(), follow->GetZ(),
|
||||||
speed, WaypointChanged, NodeReached);
|
speed, WaypointChanged, NodeReached);
|
||||||
|
|
||||||
if (WaypointChanged)
|
|
||||||
tar_ndx = 20;
|
|
||||||
|
|
||||||
CalculateNewPosition(Goal.x, Goal.y, Goal.z, speed);
|
CalculateNewPosition(Goal.x, Goal.y, Goal.z, speed);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -1825,7 +1819,6 @@ void Merc::AI_Start(int32 iMoveDelay) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
SendTo(GetX(), GetY(), GetZ());
|
SendTo(GetX(), GetY(), GetZ());
|
||||||
SetChanged();
|
|
||||||
SaveGuardSpot();
|
SaveGuardSpot();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4397,7 +4390,6 @@ void Merc::Sit() {
|
|||||||
// SetHeading(CalculateHeadingToTarget(GetTarget()->GetX(), GetTarget()->GetY()));
|
// SetHeading(CalculateHeadingToTarget(GetTarget()->GetX(), GetTarget()->GetY()));
|
||||||
SendPosition();
|
SendPosition();
|
||||||
SetMoving(false);
|
SetMoving(false);
|
||||||
tar_ndx = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SetAppearance(eaSitting);
|
SetAppearance(eaSitting);
|
||||||
|
|||||||
97
zone/mob.cpp
97
zone/mob.cpp
@ -105,8 +105,6 @@ Mob::Mob(const char* in_name,
|
|||||||
gravity_timer(1000),
|
gravity_timer(1000),
|
||||||
viral_timer(0),
|
viral_timer(0),
|
||||||
m_FearWalkTarget(-999999.0f, -999999.0f, -999999.0f),
|
m_FearWalkTarget(-999999.0f, -999999.0f, -999999.0f),
|
||||||
m_TargetLocation(glm::vec3()),
|
|
||||||
m_TargetV(glm::vec3()),
|
|
||||||
flee_timer(FLEE_CHECK_TIMER),
|
flee_timer(FLEE_CHECK_TIMER),
|
||||||
m_Position(position),
|
m_Position(position),
|
||||||
tmHidden(-1),
|
tmHidden(-1),
|
||||||
@ -119,8 +117,6 @@ Mob::Mob(const char* in_name,
|
|||||||
hate_list_cleanup_timer(6000)
|
hate_list_cleanup_timer(6000)
|
||||||
{
|
{
|
||||||
targeted = 0;
|
targeted = 0;
|
||||||
tar_ndx = 0;
|
|
||||||
tar_vector = 0;
|
|
||||||
currently_fleeing = false;
|
currently_fleeing = false;
|
||||||
|
|
||||||
last_major_update_position = m_Position;
|
last_major_update_position = m_Position;
|
||||||
@ -131,7 +127,6 @@ Mob::Mob(const char* in_name,
|
|||||||
moved = false;
|
moved = false;
|
||||||
m_RewindLocation = glm::vec3();
|
m_RewindLocation = glm::vec3();
|
||||||
|
|
||||||
_egnode = nullptr;
|
|
||||||
name[0] = 0;
|
name[0] = 0;
|
||||||
orig_name[0] = 0;
|
orig_name[0] = 0;
|
||||||
clean_name[0] = 0;
|
clean_name[0] = 0;
|
||||||
@ -348,7 +343,6 @@ Mob::Mob(const char* in_name,
|
|||||||
memset(&aabonuses, 0, sizeof(StatBonuses));
|
memset(&aabonuses, 0, sizeof(StatBonuses));
|
||||||
spellbonuses.AggroRange = -1;
|
spellbonuses.AggroRange = -1;
|
||||||
spellbonuses.AssistRange = -1;
|
spellbonuses.AssistRange = -1;
|
||||||
pLastChange = 0;
|
|
||||||
SetPetID(0);
|
SetPetID(0);
|
||||||
SetOwnerID(0);
|
SetOwnerID(0);
|
||||||
typeofpet = petNone; // default to not a pet
|
typeofpet = petNone; // default to not a pet
|
||||||
@ -1456,57 +1450,59 @@ void Mob::StopMoving(float new_heading) {
|
|||||||
|
|
||||||
/* Used for mobs standing still - this does not send a delta */
|
/* Used for mobs standing still - this does not send a delta */
|
||||||
void Mob::SendPosition() {
|
void Mob::SendPosition() {
|
||||||
auto app = new EQApplicationPacket(OP_ClientUpdate, sizeof(PlayerPositionUpdateServer_Struct));
|
//auto app = new EQApplicationPacket(OP_ClientUpdate, sizeof(PlayerPositionUpdateServer_Struct));
|
||||||
PlayerPositionUpdateServer_Struct* spu = (PlayerPositionUpdateServer_Struct*)app->pBuffer;
|
//PlayerPositionUpdateServer_Struct* spu = (PlayerPositionUpdateServer_Struct*)app->pBuffer;
|
||||||
MakeSpawnUpdateNoDelta(spu);
|
//MakeSpawnUpdateNoDelta(spu);
|
||||||
|
//
|
||||||
/* When an NPC has made a large distance change - we should update all clients to prevent "ghosts" */
|
//entity_list.QueueCloseClients(this, app, true, 200.0f, nullptr, false);
|
||||||
if (DistanceSquared(last_major_update_position, m_Position) >= (100 * 100)) {
|
//
|
||||||
entity_list.QueueClients(this, app, true, true);
|
///* When an NPC has made a large distance change - we should update all clients to prevent "ghosts" */
|
||||||
last_major_update_position = m_Position;
|
//if (DistanceSquared(last_major_update_position, m_Position) >= (100 * 100)) {
|
||||||
is_distance_roamer = true;
|
// entity_list.QueueClients(this, app, true, true);
|
||||||
}
|
// last_major_update_position = m_Position;
|
||||||
else {
|
// is_distance_roamer = true;
|
||||||
entity_list.QueueCloseClients(this, app, true, RuleI(Range, MobPositionUpdates), nullptr, false);
|
//}
|
||||||
}
|
//else {
|
||||||
|
// entity_list.QueueCloseClients(this, app, true, RuleI(Range, MobPositionUpdates), nullptr, false);
|
||||||
safe_delete(app);
|
//}
|
||||||
|
//
|
||||||
|
//safe_delete(app);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Mob::SendPositionUpdateToClient(Client *client) {
|
void Mob::SendPositionUpdateToClient(Client *client) {
|
||||||
auto app = new EQApplicationPacket(OP_ClientUpdate, sizeof(PlayerPositionUpdateServer_Struct));
|
//auto app = new EQApplicationPacket(OP_ClientUpdate, sizeof(PlayerPositionUpdateServer_Struct));
|
||||||
PlayerPositionUpdateServer_Struct* spawn_update = (PlayerPositionUpdateServer_Struct*)app->pBuffer;
|
//PlayerPositionUpdateServer_Struct* spawn_update = (PlayerPositionUpdateServer_Struct*)app->pBuffer;
|
||||||
|
//
|
||||||
if(this->IsMoving())
|
//if(this->IsMoving())
|
||||||
MakeSpawnUpdate(spawn_update);
|
// MakeSpawnUpdate(spawn_update);
|
||||||
else
|
//else
|
||||||
MakeSpawnUpdateNoDelta(spawn_update);
|
// MakeSpawnUpdateNoDelta(spawn_update);
|
||||||
|
//
|
||||||
client->QueuePacket(app, false);
|
//client->QueuePacket(app, false);
|
||||||
|
//
|
||||||
safe_delete(app);
|
//safe_delete(app);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Position updates for mobs on the move */
|
/* Position updates for mobs on the move */
|
||||||
void Mob::SendPositionUpdate(uint8 iSendToSelf) {
|
void Mob::SendPositionUpdate(uint8 iSendToSelf) {
|
||||||
auto app = new EQApplicationPacket(OP_ClientUpdate, sizeof(PlayerPositionUpdateServer_Struct));
|
//auto app = new EQApplicationPacket(OP_ClientUpdate, sizeof(PlayerPositionUpdateServer_Struct));
|
||||||
PlayerPositionUpdateServer_Struct* spu = (PlayerPositionUpdateServer_Struct*)app->pBuffer;
|
//PlayerPositionUpdateServer_Struct* spu = (PlayerPositionUpdateServer_Struct*)app->pBuffer;
|
||||||
MakeSpawnUpdate(spu);
|
//MakeSpawnUpdate(spu);
|
||||||
|
//
|
||||||
if (iSendToSelf == 2) {
|
//if (iSendToSelf == 2) {
|
||||||
if (IsClient()) {
|
// if (IsClient()) {
|
||||||
CastToClient()->FastQueuePacket(&app, false);
|
// CastToClient()->FastQueuePacket(&app, false);
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
else if (DistanceSquared(last_major_update_position, m_Position) >= (100 * 100)) {
|
//else if (DistanceSquared(last_major_update_position, m_Position) >= (100 * 100)) {
|
||||||
entity_list.QueueClients(this, app, true, true);
|
// entity_list.QueueClients(this, app, true, true);
|
||||||
last_major_update_position = m_Position;
|
// last_major_update_position = m_Position;
|
||||||
is_distance_roamer = true;
|
// is_distance_roamer = true;
|
||||||
}
|
//}
|
||||||
else {
|
//else {
|
||||||
entity_list.QueueCloseClients(this, app, (iSendToSelf == 0), RuleI(Range, MobPositionUpdates), nullptr, false);
|
// entity_list.QueueCloseClients(this, app, (iSendToSelf == 0), RuleI(Range, MobPositionUpdates), nullptr, false);
|
||||||
}
|
//}
|
||||||
safe_delete(app);
|
//safe_delete(app);
|
||||||
}
|
}
|
||||||
|
|
||||||
// this is for SendPosition()
|
// this is for SendPosition()
|
||||||
@ -5864,7 +5860,6 @@ void Mob::SetCurrentSpeed(int in){
|
|||||||
if (current_speed != in)
|
if (current_speed != in)
|
||||||
{
|
{
|
||||||
current_speed = in;
|
current_speed = in;
|
||||||
tar_ndx = 20;
|
|
||||||
if (in == 0) {
|
if (in == 0) {
|
||||||
SetRunAnimSpeed(0);
|
SetRunAnimSpeed(0);
|
||||||
SetMoving(false);
|
SetMoving(false);
|
||||||
|
|||||||
24
zone/mob.h
24
zone/mob.h
@ -530,14 +530,6 @@ public:
|
|||||||
inline const float GetHeading() const { return m_Position.w; }
|
inline const float GetHeading() const { return m_Position.w; }
|
||||||
inline const float GetSize() const { return size; }
|
inline const float GetSize() const { return size; }
|
||||||
inline const float GetBaseSize() const { return base_size; }
|
inline const float GetBaseSize() const { return base_size; }
|
||||||
inline const float GetTarX() const { return m_TargetLocation.x; }
|
|
||||||
inline const float GetTarY() const { return m_TargetLocation.y; }
|
|
||||||
inline const float GetTarZ() const { return m_TargetLocation.z; }
|
|
||||||
inline const float GetTarVX() const { return m_TargetV.x; }
|
|
||||||
inline const float GetTarVY() const { return m_TargetV.y; }
|
|
||||||
inline const float GetTarVZ() const { return m_TargetV.z; }
|
|
||||||
inline const float GetTarVector() const { return tar_vector; }
|
|
||||||
inline const uint8 GetTarNDX() const { return tar_ndx; }
|
|
||||||
inline const int8 GetFlyMode() const { return static_cast<const int8>(flymode); }
|
inline const int8 GetFlyMode() const { return static_cast<const int8>(flymode); }
|
||||||
bool IsBoat() const;
|
bool IsBoat() const;
|
||||||
|
|
||||||
@ -567,7 +559,6 @@ public:
|
|||||||
void SetRunning(bool val) { m_is_running = val; }
|
void SetRunning(bool val) { m_is_running = val; }
|
||||||
virtual void GMMove(float x, float y, float z, float heading = 0.01, bool SendUpdate = true);
|
virtual void GMMove(float x, float y, float z, float heading = 0.01, bool SendUpdate = true);
|
||||||
void SetDelta(const glm::vec4& delta);
|
void SetDelta(const glm::vec4& delta);
|
||||||
void SetTargetDestSteps(uint8 target_steps) { tar_ndx = target_steps; }
|
|
||||||
void SendPositionUpdateToClient(Client *client);
|
void SendPositionUpdateToClient(Client *client);
|
||||||
void SendPositionUpdate(uint8 iSendToSelf = 0);
|
void SendPositionUpdate(uint8 iSendToSelf = 0);
|
||||||
void MakeSpawnUpdateNoDelta(PlayerPositionUpdateServer_Struct* spu);
|
void MakeSpawnUpdateNoDelta(PlayerPositionUpdateServer_Struct* spu);
|
||||||
@ -613,8 +604,7 @@ public:
|
|||||||
void SetAssistAggro(bool value) { AssistAggro = value; if (PrimaryAggro) AssistAggro = false; }
|
void SetAssistAggro(bool value) { AssistAggro = value; if (PrimaryAggro) AssistAggro = false; }
|
||||||
bool HateSummon();
|
bool HateSummon();
|
||||||
void FaceTarget(Mob* mob_to_face = 0);
|
void FaceTarget(Mob* mob_to_face = 0);
|
||||||
void SetHeading(float iHeading) { if(m_Position.w != iHeading) { pLastChange = Timer::GetCurrentTime();
|
void SetHeading(float iHeading) { if(m_Position.w != iHeading) { m_Position.w = iHeading; } }
|
||||||
m_Position.w = iHeading; } }
|
|
||||||
void WipeHateList();
|
void WipeHateList();
|
||||||
void AddFeignMemory(Client* attacker);
|
void AddFeignMemory(Client* attacker);
|
||||||
void RemoveFromFeignMemory(Client* attacker);
|
void RemoveFromFeignMemory(Client* attacker);
|
||||||
@ -625,8 +615,6 @@ public:
|
|||||||
bool CheckLosFN(Mob* other);
|
bool CheckLosFN(Mob* other);
|
||||||
bool CheckLosFN(float posX, float posY, float posZ, float mobSize);
|
bool CheckLosFN(float posX, float posY, float posZ, float mobSize);
|
||||||
static bool CheckLosFN(glm::vec3 posWatcher, float sizeWatcher, glm::vec3 posTarget, float sizeTarget);
|
static bool CheckLosFN(glm::vec3 posWatcher, float sizeWatcher, glm::vec3 posTarget, float sizeTarget);
|
||||||
inline void SetChanged() { pLastChange = Timer::GetCurrentTime(); }
|
|
||||||
inline const uint32 LastChange() const { return pLastChange; }
|
|
||||||
inline void SetLastLosState(bool value) { last_los_check = value; }
|
inline void SetLastLosState(bool value) { last_los_check = value; }
|
||||||
inline bool CheckLastLosState() const { return last_los_check; }
|
inline bool CheckLastLosState() const { return last_los_check; }
|
||||||
|
|
||||||
@ -815,7 +803,7 @@ public:
|
|||||||
void SetAppearance(EmuAppearance app, bool iIgnoreSelf = true);
|
void SetAppearance(EmuAppearance app, bool iIgnoreSelf = true);
|
||||||
inline EmuAppearance GetAppearance() const { return _appearance; }
|
inline EmuAppearance GetAppearance() const { return _appearance; }
|
||||||
inline const uint8 GetRunAnimSpeed() const { return pRunAnimSpeed; }
|
inline const uint8 GetRunAnimSpeed() const { return pRunAnimSpeed; }
|
||||||
inline void SetRunAnimSpeed(int8 in) { if (pRunAnimSpeed != in) { pRunAnimSpeed = in; pLastChange = Timer::GetCurrentTime(); } }
|
inline void SetRunAnimSpeed(int8 in) { if (pRunAnimSpeed != in) { pRunAnimSpeed = in; } }
|
||||||
bool IsDestructibleObject() { return destructibleobject; }
|
bool IsDestructibleObject() { return destructibleobject; }
|
||||||
void SetDestructibleObject(bool in) { destructibleobject = in; }
|
void SetDestructibleObject(bool in) { destructibleobject = in; }
|
||||||
|
|
||||||
@ -1274,7 +1262,6 @@ protected:
|
|||||||
int current_speed;
|
int current_speed;
|
||||||
eSpecialAttacks m_specialattacks;
|
eSpecialAttacks m_specialattacks;
|
||||||
|
|
||||||
uint32 pLastChange;
|
|
||||||
bool held;
|
bool held;
|
||||||
bool gheld;
|
bool gheld;
|
||||||
bool nocast;
|
bool nocast;
|
||||||
@ -1521,13 +1508,6 @@ protected:
|
|||||||
bool pet_owner_client; //Flags regular and pets as belonging to a client
|
bool pet_owner_client; //Flags regular and pets as belonging to a client
|
||||||
uint32 pet_targetlock_id;
|
uint32 pet_targetlock_id;
|
||||||
|
|
||||||
EGNode *_egnode; //the EG node we are in
|
|
||||||
glm::vec3 m_TargetLocation;
|
|
||||||
uint8 tar_ndx;
|
|
||||||
float tar_vector;
|
|
||||||
glm::vec3 m_TargetV;
|
|
||||||
float test_vector;
|
|
||||||
|
|
||||||
glm::vec3 m_TargetRing;
|
glm::vec3 m_TargetRing;
|
||||||
|
|
||||||
// we might want to do this differently, we gotta do max NPC buffs ... which is 97
|
// we might want to do this differently, we gotta do max NPC buffs ... which is 97
|
||||||
|
|||||||
@ -515,7 +515,6 @@ void Mob::AI_Start(uint32 iMoveDelay) {
|
|||||||
|
|
||||||
m_Delta = glm::vec4();
|
m_Delta = glm::vec4();
|
||||||
pRunAnimSpeed = 0;
|
pRunAnimSpeed = 0;
|
||||||
pLastChange = Timer::GetCurrentTime();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Client::AI_Start(uint32 iMoveDelay) {
|
void Client::AI_Start(uint32 iMoveDelay) {
|
||||||
@ -551,7 +550,6 @@ void NPC::AI_Start(uint32 iMoveDelay) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
SendTo(GetX(), GetY(), GetZ());
|
SendTo(GetX(), GetY(), GetZ());
|
||||||
SetChanged();
|
|
||||||
SaveGuardSpot();
|
SaveGuardSpot();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -823,9 +821,6 @@ void Client::AI_Process()
|
|||||||
node_reached
|
node_reached
|
||||||
);
|
);
|
||||||
|
|
||||||
if (waypoint_changed)
|
|
||||||
tar_ndx = 20;
|
|
||||||
|
|
||||||
CalculateNewPosition(Goal.x, Goal.y, Goal.z, speed);
|
CalculateNewPosition(Goal.x, Goal.y, Goal.z, speed);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -905,9 +900,6 @@ void Client::AI_Process()
|
|||||||
glm::vec3 Goal = UpdatePath(GetTarget()->GetX(), GetTarget()->GetY(), GetTarget()->GetZ(),
|
glm::vec3 Goal = UpdatePath(GetTarget()->GetX(), GetTarget()->GetY(), GetTarget()->GetZ(),
|
||||||
GetRunspeed(), WaypointChanged, NodeReached);
|
GetRunspeed(), WaypointChanged, NodeReached);
|
||||||
|
|
||||||
if(WaypointChanged)
|
|
||||||
tar_ndx = 20;
|
|
||||||
|
|
||||||
CalculateNewPosition(Goal.x, Goal.y, Goal.z, newspeed);
|
CalculateNewPosition(Goal.x, Goal.y, Goal.z, newspeed);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1039,7 +1031,6 @@ void Mob::ProcessForcedMovement()
|
|||||||
Teleport(m_Position + m_Delta);
|
Teleport(m_Position + m_Delta);
|
||||||
m_Delta = glm::vec4();
|
m_Delta = glm::vec4();
|
||||||
SendPositionUpdate();
|
SendPositionUpdate();
|
||||||
pLastChange = Timer::GetCurrentTime();
|
|
||||||
FixZ(); // so we teleport to the ground locally, we want the client to interpolate falling etc
|
FixZ(); // so we teleport to the ground locally, we want the client to interpolate falling etc
|
||||||
} else if (--ForcedMovement) {
|
} else if (--ForcedMovement) {
|
||||||
if (normal.z < -0.15f) // prevent too much wall climbing. ex. OMM's room in anguish
|
if (normal.z < -0.15f) // prevent too much wall climbing. ex. OMM's room in anguish
|
||||||
@ -1151,9 +1142,6 @@ void Mob::AI_Process() {
|
|||||||
NodeReached
|
NodeReached
|
||||||
);
|
);
|
||||||
|
|
||||||
if (WaypointChanged)
|
|
||||||
tar_ndx = 20;
|
|
||||||
|
|
||||||
CalculateNewPosition(Goal.x, Goal.y, Goal.z, GetFearSpeed());
|
CalculateNewPosition(Goal.x, Goal.y, Goal.z, GetFearSpeed());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1484,9 +1472,6 @@ void Mob::AI_Process() {
|
|||||||
GetRunspeed(), WaypointChanged, NodeReached
|
GetRunspeed(), WaypointChanged, NodeReached
|
||||||
);
|
);
|
||||||
|
|
||||||
if (WaypointChanged)
|
|
||||||
tar_ndx = 20;
|
|
||||||
|
|
||||||
CalculateNewPosition(Goal.x, Goal.y, Goal.z, GetRunspeed());
|
CalculateNewPosition(Goal.x, Goal.y, Goal.z, GetRunspeed());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1877,8 +1862,6 @@ void NPC::AI_DoMovement() {
|
|||||||
WaypointChanged,
|
WaypointChanged,
|
||||||
NodeReached
|
NodeReached
|
||||||
);
|
);
|
||||||
if (WaypointChanged)
|
|
||||||
tar_ndx = 20;
|
|
||||||
|
|
||||||
if (NodeReached)
|
if (NodeReached)
|
||||||
entity_list.OpenDoorsNear(CastToNPC());
|
entity_list.OpenDoorsNear(CastToNPC());
|
||||||
@ -1921,9 +1904,6 @@ void NPC::AI_DoMovement() {
|
|||||||
WaypointChanged,
|
WaypointChanged,
|
||||||
NodeReached
|
NodeReached
|
||||||
);
|
);
|
||||||
if (WaypointChanged) {
|
|
||||||
tar_ndx = 20;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (NodeReached) {
|
if (NodeReached) {
|
||||||
entity_list.OpenDoorsNear(CastToNPC());
|
entity_list.OpenDoorsNear(CastToNPC());
|
||||||
|
|||||||
@ -86,27 +86,27 @@ glm::vec3 Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool &Wa
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!IsRooted()) {
|
if (!IsRooted()) {
|
||||||
bool AtPrevNode = DistanceSquared(From, PathingLastPosition) < 1.0f;
|
//bool AtPrevNode = DistanceSquared(From, PathingLastPosition) < 1.0f;
|
||||||
if (AtPrevNode) {
|
//if (AtPrevNode) {
|
||||||
PathingLoopCount++;
|
// PathingLoopCount++;
|
||||||
auto front = (*Route.begin()).pos;
|
// auto front = (*Route.begin()).pos;
|
||||||
|
//
|
||||||
if (PathingLoopCount > 5) {
|
// if (PathingLoopCount > 5) {
|
||||||
Teleport(front);
|
// Teleport(front);
|
||||||
SendPosition();
|
// SendPosition();
|
||||||
Route.pop_front();
|
// Route.pop_front();
|
||||||
|
//
|
||||||
WaypointChanged = true;
|
// WaypointChanged = true;
|
||||||
NodeReached = true;
|
// NodeReached = true;
|
||||||
PathingLoopCount = 0;
|
// PathingLoopCount = 0;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
return front;
|
// return front;
|
||||||
}
|
//}
|
||||||
else {
|
//else {
|
||||||
PathingLastPosition = From;
|
PathingLastPosition = From;
|
||||||
PathingLoopCount = 0;
|
PathingLoopCount = 0;
|
||||||
}
|
//}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
PathingLastPosition = From;
|
PathingLastPosition = From;
|
||||||
|
|||||||
@ -7275,28 +7275,6 @@ XS(XS_Mob_SetLD) {
|
|||||||
XSRETURN_EMPTY;
|
XSRETURN_EMPTY;
|
||||||
}
|
}
|
||||||
|
|
||||||
XS(XS_Mob_SetTargetDestSteps); /* prototype to pass -Wmissing-prototypes */
|
|
||||||
XS(XS_Mob_SetTargetDestSteps) {
|
|
||||||
dXSARGS;
|
|
||||||
if (items != 2)
|
|
||||||
Perl_croak(aTHX_ "Usage: Mob::SetTargetDestSteps(THIS, uint8 target_steps)");
|
|
||||||
{
|
|
||||||
Mob *THIS;
|
|
||||||
uint8 target_steps = (uint8) SvIV(ST(1));
|
|
||||||
|
|
||||||
if (sv_derived_from(ST(0), "Mob")) {
|
|
||||||
IV tmp = SvIV((SV *) SvRV(ST(0)));
|
|
||||||
THIS = INT2PTR(Mob *, tmp);
|
|
||||||
} else
|
|
||||||
Perl_croak(aTHX_ "THIS is not of type Mob");
|
|
||||||
if (THIS == nullptr)
|
|
||||||
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
|
|
||||||
|
|
||||||
THIS->SetTargetDestSteps(target_steps);
|
|
||||||
}
|
|
||||||
XSRETURN_EMPTY;
|
|
||||||
}
|
|
||||||
|
|
||||||
XS(XS_Mob_SetTargetable); /* prototype to pass -Wmissing-prototypes */
|
XS(XS_Mob_SetTargetable); /* prototype to pass -Wmissing-prototypes */
|
||||||
XS(XS_Mob_SetTargetable) {
|
XS(XS_Mob_SetTargetable) {
|
||||||
dXSARGS;
|
dXSARGS;
|
||||||
@ -8781,7 +8759,6 @@ XS(boot_Mob) {
|
|||||||
newXSproto(strcpy(buf, "SetBodyType"), XS_Mob_SetBodyType, file, "$$;$");
|
newXSproto(strcpy(buf, "SetBodyType"), XS_Mob_SetBodyType, file, "$$;$");
|
||||||
newXSproto(strcpy(buf, "SetDeltas"), XS_Mob_SetDeltas, file, "$$$$$");
|
newXSproto(strcpy(buf, "SetDeltas"), XS_Mob_SetDeltas, file, "$$$$$");
|
||||||
newXSproto(strcpy(buf, "SetLD"), XS_Mob_SetLD, file, "$$");
|
newXSproto(strcpy(buf, "SetLD"), XS_Mob_SetLD, file, "$$");
|
||||||
newXSproto(strcpy(buf, "SetTargetDestSteps"), XS_Mob_SetTargetDestSteps, file, "$$");
|
|
||||||
newXSproto(strcpy(buf, "SetTargetable"), XS_Mob_SetTargetable, file, "$$");
|
newXSproto(strcpy(buf, "SetTargetable"), XS_Mob_SetTargetable, file, "$$");
|
||||||
newXSproto(strcpy(buf, "MakeTempPet"), XS_Mob_MakeTempPet, file, "$$;$$$$");
|
newXSproto(strcpy(buf, "MakeTempPet"), XS_Mob_MakeTempPet, file, "$$;$$$$");
|
||||||
newXSproto(strcpy(buf, "ModSkillDmgTaken"), XS_Mob_ModSkillDmgTaken, file, "$$$");
|
newXSproto(strcpy(buf, "ModSkillDmgTaken"), XS_Mob_ModSkillDmgTaken, file, "$$$");
|
||||||
|
|||||||
@ -35,6 +35,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
extern FastMath g_Math;
|
extern FastMath g_Math;
|
||||||
|
extern uint64_t frame_time;
|
||||||
|
|
||||||
struct wp_distance
|
struct wp_distance
|
||||||
{
|
{
|
||||||
@ -332,8 +333,6 @@ void NPC::CalculateNewWaypoint()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
tar_ndx = 52;
|
|
||||||
|
|
||||||
// Preserve waypoint setting for quest controlled NPCs
|
// Preserve waypoint setting for quest controlled NPCs
|
||||||
if (cur_wp < 0)
|
if (cur_wp < 0)
|
||||||
cur_wp = old_wp;
|
cur_wp = old_wp;
|
||||||
@ -455,64 +454,9 @@ bool Mob::MakeNewPositionAndSendUpdate(float x, float y, float z, float speed, b
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((m_Position.x - x == 0) && (m_Position.y - y == 0)) { //spawn is at target coords
|
SetCurrentSpeed(static_cast<int>(speed));
|
||||||
return false;
|
|
||||||
}
|
|
||||||
else if ((std::abs(m_Position.x - x) < 0.1) && (std::abs(m_Position.y - y) < 0.1)) {
|
|
||||||
if (IsNPC()) {
|
|
||||||
entity_list.ProcessMove(CastToNPC(), x, y, z);
|
|
||||||
}
|
|
||||||
|
|
||||||
m_Position.x = x;
|
|
||||||
m_Position.y = y;
|
|
||||||
m_Position.z = z;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
int compare_steps = 20;
|
|
||||||
if (tar_ndx < compare_steps && m_TargetLocation.x == x && m_TargetLocation.y == y) {
|
|
||||||
|
|
||||||
float new_x = m_Position.x + m_TargetV.x * tar_vector;
|
|
||||||
float new_y = m_Position.y + m_TargetV.y * tar_vector;
|
|
||||||
float new_z = m_Position.z + m_TargetV.z * tar_vector;
|
|
||||||
|
|
||||||
if (IsNPC()) {
|
|
||||||
entity_list.ProcessMove(CastToNPC(), new_x, new_y, new_z);
|
|
||||||
}
|
|
||||||
|
|
||||||
m_Position.x = new_x;
|
|
||||||
m_Position.y = new_y;
|
|
||||||
m_Position.z = new_z;
|
|
||||||
|
|
||||||
if (check_z && fix_z_timer.Check() && (!this->IsEngaged() || flee_mode || currently_fleeing)) {
|
|
||||||
this->FixZ();
|
|
||||||
}
|
|
||||||
|
|
||||||
tar_ndx++;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (tar_ndx > 50) {
|
|
||||||
tar_ndx--;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
tar_ndx = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
m_TargetLocation = glm::vec3(x, y, z);
|
|
||||||
|
|
||||||
float nx = this->m_Position.x;
|
|
||||||
float ny = this->m_Position.y;
|
|
||||||
float nz = this->m_Position.z;
|
|
||||||
// float nh = this->heading;
|
|
||||||
|
|
||||||
m_TargetV.x = x - nx;
|
|
||||||
m_TargetV.y = y - ny;
|
|
||||||
m_TargetV.z = z - nz;
|
|
||||||
SetCurrentSpeed((int8)speed);
|
|
||||||
pRunAnimSpeed = speed;
|
pRunAnimSpeed = speed;
|
||||||
|
|
||||||
#ifdef BOTS
|
#ifdef BOTS
|
||||||
if (IsClient() || IsBot())
|
if (IsClient() || IsBot())
|
||||||
#else
|
#else
|
||||||
@ -522,88 +466,48 @@ bool Mob::MakeNewPositionAndSendUpdate(float x, float y, float z, float speed, b
|
|||||||
animation = speed / 2;
|
animation = speed / 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
// --------------------------------------------------------------------------
|
//Setup Vectors
|
||||||
// 2: get unit vector
|
glm::vec3 tar(x, y, z);
|
||||||
// --------------------------------------------------------------------------
|
glm::vec3 pos(m_Position.x, m_Position.y, m_Position.z);
|
||||||
float mag = sqrtf(m_TargetV.x*m_TargetV.x + m_TargetV.y*m_TargetV.y + m_TargetV.z*m_TargetV.z);
|
double len = glm::distance(pos, tar);
|
||||||
tar_vector = (float)speed / mag;
|
if (len == 0) {
|
||||||
|
return true;
|
||||||
// mob move fix
|
|
||||||
int numsteps = (int)(mag * 13.5f / (float)speed + 0.5f);
|
|
||||||
|
|
||||||
|
|
||||||
// mob move fix
|
|
||||||
|
|
||||||
if (numsteps < 20) {
|
|
||||||
if (numsteps > 1) {
|
|
||||||
tar_vector = 1.0f;
|
|
||||||
m_TargetV.x = m_TargetV.x / (float) numsteps;
|
|
||||||
m_TargetV.y = m_TargetV.y / (float) numsteps;
|
|
||||||
m_TargetV.z = m_TargetV.z / (float) numsteps;
|
|
||||||
|
|
||||||
float new_x = m_Position.x + m_TargetV.x;
|
|
||||||
float new_y = m_Position.y + m_TargetV.y;
|
|
||||||
float new_z = m_Position.z + m_TargetV.z;
|
|
||||||
if (IsNPC()) {
|
|
||||||
entity_list.ProcessMove(CastToNPC(), new_x, new_y, new_z);
|
|
||||||
}
|
|
||||||
|
|
||||||
m_Position.x = new_x;
|
|
||||||
m_Position.y = new_y;
|
|
||||||
m_Position.z = new_z;
|
|
||||||
if (calculate_heading) {
|
|
||||||
m_Position.w = CalculateHeadingToTarget(x, y);
|
|
||||||
}
|
|
||||||
tar_ndx = 20 - numsteps;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if (IsNPC()) {
|
|
||||||
entity_list.ProcessMove(CastToNPC(), x, y, z);
|
|
||||||
}
|
|
||||||
|
|
||||||
m_Position.x = x;
|
|
||||||
m_Position.y = y;
|
|
||||||
m_Position.z = z;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
glm::vec3 dir = tar - pos;
|
||||||
|
glm::vec3 ndir = glm::normalize(dir);
|
||||||
|
if (calculate_heading) {
|
||||||
|
m_Position.w = CalculateHeadingToTarget(x, y);
|
||||||
|
}
|
||||||
|
|
||||||
|
double time_since_last = static_cast<double>(frame_time) / 1000.0;
|
||||||
|
double distance_moved = time_since_last * (speed + 100.0f);
|
||||||
|
|
||||||
|
if (distance_moved > len) {
|
||||||
|
m_Position.x = x;
|
||||||
|
m_Position.y = y;
|
||||||
|
m_Position.z = z;
|
||||||
|
|
||||||
|
if (IsNPC()) {
|
||||||
|
entity_list.ProcessMove(CastToNPC(), x, y, z);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
tar_vector /= 13.5f;
|
glm::vec3 npos = pos + (ndir * static_cast<float>(distance_moved));
|
||||||
float dur = Timer::GetCurrentTime() - pLastChange;
|
m_Position.x = npos.x;
|
||||||
if (dur < 0.0f) {
|
m_Position.y = npos.y;
|
||||||
dur = 0.0f;
|
m_Position.z = npos.z;
|
||||||
}
|
|
||||||
|
|
||||||
if (dur > 100.f) {
|
|
||||||
dur = 100.f;
|
|
||||||
}
|
|
||||||
|
|
||||||
tar_vector *= (dur / 100.0f);
|
|
||||||
|
|
||||||
float new_x = m_Position.x + m_TargetV.x * tar_vector;
|
|
||||||
float new_y = m_Position.y + m_TargetV.y * tar_vector;
|
|
||||||
float new_z = m_Position.z + m_TargetV.z * tar_vector;
|
|
||||||
|
|
||||||
if (IsNPC()) {
|
if (IsNPC()) {
|
||||||
entity_list.ProcessMove(CastToNPC(), new_x, new_y, new_z);
|
entity_list.ProcessMove(CastToNPC(), x, y, z);
|
||||||
}
|
|
||||||
|
|
||||||
m_Position.x = new_x;
|
|
||||||
m_Position.y = new_y;
|
|
||||||
m_Position.z = new_z;
|
|
||||||
if (calculate_heading) {
|
|
||||||
m_Position.w = CalculateHeadingToTarget(x, y);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (check_z && fix_z_timer.Check() && !this->IsEngaged())
|
|
||||||
this->FixZ();
|
|
||||||
|
|
||||||
SetMoving(true);
|
SetMoving(true);
|
||||||
moved = true;
|
m_Delta = glm::vec4(m_Position.x - pos.x, m_Position.y - pos.y, m_Position.z - pos.z, 0.0f);
|
||||||
|
|
||||||
m_Delta = glm::vec4(m_Position.x - nx, m_Position.y - ny, m_Position.z - nz, 0.0f);
|
|
||||||
|
|
||||||
if (IsClient()) {
|
if (IsClient()) {
|
||||||
SendPositionUpdate(1);
|
SendPositionUpdate(1);
|
||||||
CastToClient()->ResetPositionTimer();
|
CastToClient()->ResetPositionTimer();
|
||||||
@ -613,7 +517,6 @@ bool Mob::MakeNewPositionAndSendUpdate(float x, float y, float z, float speed, b
|
|||||||
SetAppearance(eaStanding, false);
|
SetAppearance(eaStanding, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
pLastChange = Timer::GetCurrentTime();
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user