This commit is contained in:
aozhiwei 2022-12-20 11:48:36 +08:00
parent ca90cab7b8
commit b4e4fd2e8b
2 changed files with 5 additions and 24 deletions

View File

@ -2,6 +2,7 @@
#include <math.h> #include <math.h>
#include <float.h> #include <float.h>
#include <assert.h>
#include <a8/mutable_xobject.h> #include <a8/mutable_xobject.h>
#include <f8/udplog.h> #include <f8/udplog.h>
@ -762,16 +763,12 @@ void Player::_CMMove(f8::MsgHdr& hdr, const cs::CMMove& msg)
moving = false; moving = false;
if (msg.has_move_dir()) { if (msg.has_move_dir()) {
if (std::abs(msg.move_dir().x()) > FLT_EPSILON || if (std::abs(msg.move_dir().x()) > FLT_EPSILON ||
std::abs(msg.move_dir().y()) > FLT_EPSILON std::abs(msg.move_dir().y()) > FLT_EPSILON ||
std::abs(msg.move_dir().z()) > FLT_EPSILON
) { ) {
glm::vec3 old_move_dir; glm::vec3 old_move_dir;
glm::vec3 new_move_dir; glm::vec3 new_move_dir;
TypeConvert::FromPb(new_move_dir, &msg.move_dir()); TypeConvert::FromPb(new_move_dir, &msg.move_dir());
// 666
#if 1
new_move_dir.z = new_move_dir.y;
new_move_dir.y = 0.0f;
#endif
if (!HasBuffEffect(kBET_Vertigo)) { if (!HasBuffEffect(kBET_Vertigo)) {
if (!(HasBuffEffect(kBET_Jump) && follow_target.Get())) { if (!(HasBuffEffect(kBET_Jump) && follow_target.Get())) {
if (GetDisableMoveDirTimes() <= 0) { if (GetDisableMoveDirTimes() <= 0) {
@ -788,10 +785,11 @@ void Player::_CMMove(f8::MsgHdr& hdr, const cs::CMMove& msg)
} }
} }
} }
assert(!isnan(GetMoveDir().x) && !isnan(GetMoveDir().y)); assert(!isnan(GetMoveDir().x) && !isnan(GetMoveDir().y) && !isnan(GetMoveDir().z));
if (msg.has_attack_dir()) { if (msg.has_attack_dir()) {
if (std::isfinite(msg.attack_dir().x()) && if (std::isfinite(msg.attack_dir().x()) &&
std::isfinite(msg.attack_dir().y()) && std::isfinite(msg.attack_dir().y()) &&
std::isfinite(msg.attack_dir().z()) &&
( (
std::abs(msg.attack_dir().x()) > 0.00001f || std::abs(msg.attack_dir().x()) > 0.00001f ||
std::abs(msg.attack_dir().y()) > 0.00001f || std::abs(msg.attack_dir().y()) > 0.00001f ||
@ -818,12 +816,7 @@ void Player::_CMMove(f8::MsgHdr& hdr, const cs::CMMove& msg)
if (can_set) { if (can_set) {
if (GetDisableMoveDirTimes() <= 0 && if (GetDisableMoveDirTimes() <= 0 &&
GetDisableAttackDirTimes() <= 0) { GetDisableAttackDirTimes() <= 0) {
// 666
#if 1
glm::vec3 attack_dir(msg.attack_dir().x(), msg.attack_dir().z(), msg.attack_dir().y());
#else
glm::vec3 attack_dir(msg.attack_dir().x(), msg.attack_dir().y(), msg.attack_dir().z()); glm::vec3 attack_dir(msg.attack_dir().x(), msg.attack_dir().y(), msg.attack_dir().z());
#endif
GlmHelper::Normalize(attack_dir); GlmHelper::Normalize(attack_dir);
SetAttackDir(attack_dir); SetAttackDir(attack_dir);
if (GetCar() && GetCar()->IsDriver(this)) { if (GetCar() && GetCar()->IsDriver(this)) {

View File

@ -9,28 +9,16 @@ namespace TypeConvert
void ToPb(const Position v, cs::MFVec3* pb_obj) void ToPb(const Position v, cs::MFVec3* pb_obj)
{ {
#ifdef SXY
pb_obj->set_x(v.x);
pb_obj->set_y(v.z);
pb_obj->set_z(v.y);
#else
pb_obj->set_x(v.x); pb_obj->set_x(v.x);
pb_obj->set_y(v.y); pb_obj->set_y(v.y);
pb_obj->set_z(v.z); pb_obj->set_z(v.z);
#endif
} }
void ToPb(const glm::vec3& v, cs::MFVec3* pb_obj) void ToPb(const glm::vec3& v, cs::MFVec3* pb_obj)
{ {
#ifdef SXY
pb_obj->set_x(v.x);
pb_obj->set_y(v.z);
pb_obj->set_z(v.y);
#else
pb_obj->set_x(v.x); pb_obj->set_x(v.x);
pb_obj->set_y(v.y); pb_obj->set_y(v.y);
pb_obj->set_z(v.z); pb_obj->set_z(v.z);
#endif
} }
void ToPb(const a8::Vec3& v, cs::MFVec3* pb_obj) void ToPb(const a8::Vec3& v, cs::MFVec3* pb_obj)