This commit is contained in:
aozhiwei 2023-01-04 15:17:38 +08:00
parent cfdcf44d53
commit b831901f37
5 changed files with 15 additions and 49 deletions

View File

@ -28,12 +28,10 @@ Android::Android():Human()
Android::~Android() Android::~Android()
{ {
#if 0
if (agent_) { if (agent_) {
f8::BtMgr::Instance()->BtDestory(agent_); f8::BtMgr::Instance()->BtDestory(agent_);
agent_ = nullptr; agent_ = nullptr;
} }
#endif
#if 0 #if 0
--PerfMonitor::Instance()->entity_num[ET_Android]; --PerfMonitor::Instance()->entity_num[ET_Android];
#endif #endif
@ -96,7 +94,6 @@ void Android::InternalUpdate(int delta_time)
} }
if (GetMovement()->GetPathSize() > 0) { if (GetMovement()->GetPathSize() > 0) {
Global::Instance()->verify_set_pos = 1; Global::Instance()->verify_set_pos = 1;
Position old_pos = GetPos();
UpdateMove(); UpdateMove();
#ifdef DEBUG1 #ifdef DEBUG1
a8::XPrintf("updatemove old_pos:%f,%f new_pos:%f,%f\n", a8::XPrintf("updatemove old_pos:%f,%f new_pos:%f,%f\n",
@ -109,9 +106,7 @@ void Android::InternalUpdate(int delta_time)
#endif #endif
Global::Instance()->verify_set_pos = 0; Global::Instance()->verify_set_pos = 0;
} }
#if 0
agent_->Exec(); agent_->Exec();
#endif
} }
void Android::GiveEquip() void Android::GiveEquip()

View File

@ -118,39 +118,6 @@ static void SavePerfLog()
bool App::Init(int argc, char* argv[]) bool App::Init(int argc, char* argv[])
{ {
#if 0
{
std::string data = "${master.name} [aa ]${image.id:1000} bb${}cc";
std::string pattern = R"(\$\{.*?\})";
std::regex re(pattern, std::regex_constants::ECMAScript);
std::cmatch m;
bool matched = true;
const char* last_pos = data.c_str();
const char* end_pos = data.c_str() + data.length();
while (last_pos < end_pos) {
matched = std::regex_search(last_pos, m, re);
if (matched) {
if (m.position() > 0) {
a8::XPrintf("raw_str:%s\n",
{std::string(last_pos, m.position())});
}
a8::XPrintf("str:%s pos:%d len:%d\n",
{m.str(),
m.position(),
m.length()});
last_pos += m.position() + m.length();
} else {
a8::XPrintf("raw_str2:%s\n",
{std::string(last_pos, end_pos - last_pos)});
last_pos = end_pos;
}
}
exit(1);
}
#endif
signal(SIGPIPE, SIG_IGN); signal(SIGPIPE, SIG_IGN);
this->argc = argc; this->argc = argc;
this->argv = argv; this->argv = argv;

View File

@ -14,15 +14,16 @@ void JumpBuff::Activate()
void JumpBuff::Deactivate() void JumpBuff::Deactivate()
{ {
//跳伞结束 //跳伞结束
CreatureWeakPtr c = owner->GetWeakPtrRef();
owner->room->xtimer.SetTimeoutEx owner->room->xtimer.SetTimeoutEx
(1, (1,
[this] (int event, const a8::Args* args) [c] (int event, const a8::Args* args) mutable
{ {
if (a8::TIMER_EXEC_EVENT == event) { if (a8::TIMER_EXEC_EVENT == event) {
if (owner->IsHuman()) { if (c.Get()) {
owner->AsHuman()->OnLand(); c.Get()->OnLand();
} }
} }
}, },
&xtimer_attacher); &owner->xtimer_attacher);
} }

View File

@ -43,7 +43,7 @@ bool Movement::UpdatePosition()
curr_point.curr_pos.AddGlmVec3(curr_point.dir * owner_->GetSpeed()); curr_point.curr_pos.AddGlmVec3(curr_point.dir * owner_->GetSpeed());
owner_->SetPos(curr_point.curr_pos); owner_->SetPos(curr_point.curr_pos);
if (owner_->room->map_instance->GetPosHeight(owner_->GetPos(), h)) { if (owner_->room->map_instance->GetPosHeight(owner_->GetPos(), h)) {
#ifdef DEBUG #ifdef DEBUG1
a8::XPrintf("pos:%f,%f,%f h2:%f\n", a8::XPrintf("pos:%f,%f,%f h2:%f\n",
{ {
owner_->GetPos().x, owner_->GetPos().x,
@ -64,6 +64,7 @@ bool Movement::UpdatePosition()
owner_->SetPos(curr_point.tar_pos); owner_->SetPos(curr_point.tar_pos);
float h = 0.0f; float h = 0.0f;
if (owner_->room->map_instance->GetPosHeight(owner_->GetPos(), h)) { if (owner_->room->map_instance->GetPosHeight(owner_->GetPos(), h)) {
#if 0
a8::XPrintf("pos:%f,%f,%f h3:%f\n", a8::XPrintf("pos:%f,%f,%f h3:%f\n",
{ {
owner_->GetPos().x, owner_->GetPos().x,
@ -71,6 +72,7 @@ bool Movement::UpdatePosition()
owner_->GetPos().z, owner_->GetPos().z,
h h
}); });
#endif
auto new_pos = owner_->GetPos(); auto new_pos = owner_->GetPos();
new_pos.y = h; new_pos.y = h;
owner_->SetPos(new_pos); owner_->SetPos(new_pos);

View File

@ -224,7 +224,7 @@ void Player::InternalUpdate(int delta_time)
void Player::UpdateMoving() void Player::UpdateMoving()
{ {
#ifdef DEBUG #ifdef DEBUG1
a8::XPrintf("UpdateMoving\n", {}); a8::XPrintf("UpdateMoving\n", {});
#endif #endif
if (action_type == AT_Relive) { if (action_type == AT_Relive) {
@ -760,7 +760,7 @@ void Player::_CMMove(f8::MsgHdr& hdr, const cs::CMMove& msg)
last_cmmove_frameno_ = room->GetFrameNo(); last_cmmove_frameno_ = room->GetFrameNo();
moving = false; moving = false;
if (msg.has_move_dir()) { if (msg.has_move_dir()) {
#ifdef DEBUG #ifdef DEBUG1
a8::XPrintf("move_dir %f,%f,%f\n", a8::XPrintf("move_dir %f,%f,%f\n",
{ {
msg.move_dir().x(), msg.move_dir().x(),
@ -775,11 +775,11 @@ void Player::_CMMove(f8::MsgHdr& hdr, const cs::CMMove& msg)
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());
#ifdef DEBUG #ifdef DEBUG1
a8::XPrintf("has_move_dir0\n", {}); a8::XPrintf("has_move_dir0\n", {});
#endif #endif
if (!HasBuffEffect(kBET_Vertigo)) { if (!HasBuffEffect(kBET_Vertigo)) {
#ifdef DEBUG #ifdef DEBUG1
a8::XPrintf("has_move_dir1\n", {}); a8::XPrintf("has_move_dir1\n", {});
#endif #endif
if (!(HasBuffEffect(kBET_Jump) && follow_target.Get())) { if (!(HasBuffEffect(kBET_Jump) && follow_target.Get())) {
@ -793,7 +793,7 @@ void Player::_CMMove(f8::MsgHdr& hdr, const cs::CMMove& msg)
} }
moving = true; moving = true;
} }
#ifdef DEBUG #ifdef DEBUG1
a8::XPrintf("has_move_dir2\n", {}); a8::XPrintf("has_move_dir2\n", {});
#endif #endif
} }
@ -955,7 +955,8 @@ void Player::_CMMove(f8::MsgHdr& hdr, const cs::CMMove& msg)
use_skill_id = msg.skill_id(); use_skill_id = msg.skill_id();
skill_target_id = msg.skill_target_id(); skill_target_id = msg.skill_target_id();
if (std::abs(msg.skill_dir().x()) > FLT_EPSILON || if (std::abs(msg.skill_dir().x()) > FLT_EPSILON ||
std::abs(msg.skill_dir().y()) > FLT_EPSILON std::abs(msg.skill_dir().y()) > FLT_EPSILON ||
std::abs(msg.skill_dir().z()) > FLT_EPSILON
) { ) {
TypeConvert::FromPb(skill_dir, &msg.skill_dir()); TypeConvert::FromPb(skill_dir, &msg.skill_dir());
GlmHelper::Normalize(skill_dir); GlmHelper::Normalize(skill_dir);