1
This commit is contained in:
commit
20b99871f3
@ -71,6 +71,8 @@ class Human : public Creature
|
||||
std::shared_ptr<cs::MFThrow> throw_bomb;
|
||||
std::map<int, std::shared_ptr<cs::MFThrow>> pending_throw_bomb;
|
||||
std::shared_ptr<glm::vec3> sand_table_target_pos;
|
||||
std::shared_ptr<glm::vec3> shot_target_pos;
|
||||
std::shared_ptr<glm::vec3> shot_client_pos;
|
||||
|
||||
std::string name;
|
||||
std::string avatar_url;
|
||||
|
@ -3,6 +3,9 @@
|
||||
#include <math.h>
|
||||
#include <float.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include <cmath>
|
||||
|
||||
#include <a8/mutable_xobject.h>
|
||||
|
||||
#include <f8/udplog.h>
|
||||
@ -621,7 +624,20 @@ void Player::Shot()
|
||||
target_dir = attack_dir;
|
||||
}
|
||||
}
|
||||
Creature::Shot(target_dir, shot_ok, fly_distance, target_uniid);
|
||||
if (shot_target_pos && shot_client_pos) {
|
||||
glm::vec3 old_attack_dir = GetAttackDir();
|
||||
if (std::fabs(shot_client_pos->x - GetPos().GetX()) < 60.0f &&
|
||||
std::fabs(shot_client_pos->y - GetPos().GetY()) < 5.0f &&
|
||||
std::fabs(shot_client_pos->y - GetPos().GetZ()) < 60.0f) {
|
||||
glm::vec3 new_attack_dir = *shot_target_pos - GetPos().ToGlmVec3();
|
||||
GlmHelper::Normalize(new_attack_dir);
|
||||
SetAttackDir(new_attack_dir);
|
||||
}
|
||||
Creature::Shot(target_dir, shot_ok, fly_distance, target_uniid);
|
||||
SetAttackDir(old_attack_dir);
|
||||
} else {
|
||||
Creature::Shot(target_dir, shot_ok, fly_distance, target_uniid);
|
||||
}
|
||||
}
|
||||
|
||||
void Player::ProcInteraction()
|
||||
@ -1130,6 +1146,20 @@ void Player::_CMMove(f8::MsgHdr& hdr, const cs::CMMove& msg)
|
||||
GetMovement()->CalcTargetPos(distance);
|
||||
}
|
||||
}
|
||||
if (msg.has_shot_target_pos() &&
|
||||
msg.has_shot_client_pos()) {
|
||||
if (!shot_target_pos) {
|
||||
shot_target_pos = std::make_shared<glm::vec3>(0.0f, 0.0f, 0.0f);
|
||||
}
|
||||
if (!shot_client_pos) {
|
||||
shot_client_pos = std::make_shared<glm::vec3>(0.0f, 0.0f, 0.0f);
|
||||
}
|
||||
TypeConvert::FromPb(*shot_target_pos, &msg.shot_target_pos());
|
||||
TypeConvert::FromPb(*shot_client_pos, &msg.shot_client_pos());
|
||||
} else {
|
||||
shot_target_pos = nullptr;
|
||||
shot_client_pos = nullptr;
|
||||
}
|
||||
last_cmmove_frameno = room->GetFrameNo();
|
||||
trace_target_uniid = msg.trace_target_uniid();
|
||||
#ifdef DEBUG1
|
||||
|
Loading…
x
Reference in New Issue
Block a user