This commit is contained in:
aozhiwei 2019-04-18 11:29:28 +08:00
parent 7b6ba13dd3
commit e64c2d5767
3 changed files with 18 additions and 9 deletions

View File

@ -103,8 +103,8 @@ void Human::FillMFObjectFull(cs::MFObjectFull* full_data)
int passed_time = (room->frame_no - jump_frameno) * FRAME_RATE_MS; int passed_time = (room->frame_no - jump_frameno) * FRAME_RATE_MS;
cs::MFBodyState* state = p->add_states(); cs::MFBodyState* state = p->add_states();
state->set_state_type(3); state->set_state_type(3);
state->set_left_time(std::max(0, MetaMgr::Instance()->jump_time - passed_time)); state->set_left_time(std::min(0, MetaMgr::Instance()->jump_time * 1000 - passed_time));
state->set_lasting_time(MetaMgr::Instance()->jump_time); state->set_lasting_time(MetaMgr::Instance()->jump_time * 1000);
} }
} }

View File

@ -403,7 +403,8 @@ void Player::UpdateJump()
if (a8::HasBitFlag(status, HS_Fly)) { if (a8::HasBitFlag(status, HS_Fly)) {
DoJump(); DoJump();
room->xtimer.AddDeadLineTimerAndAttach(SERVER_FRAME_RATE * 3, room->xtimer.AddDeadLineTimerAndAttach(SERVER_FRAME_RATE * 3,
a8::XParams(), a8::XParams()
.SetSender(this),
[] (const a8::XParams& param) [] (const a8::XParams& param)
{ {
Human* hum = (Human*)param.sender.GetUserData(); Human* hum = (Human*)param.sender.GetUserData();
@ -793,12 +794,14 @@ void Player::_CMMove(f8::MsgHdr& hdr, const cs::CMMove& msg)
#if 0 #if 0
moving = msg.has_move_dir(); moving = msg.has_move_dir();
#endif #endif
if (msg.has_attack_dir()) { if (!a8::HasBitFlag(status, HS_Fly)) {
attack_dir.FromPB(&msg.attack_dir()); if (msg.has_attack_dir()) {
attack_dir.Normalize(); attack_dir.FromPB(&msg.attack_dir());
} else { attack_dir.Normalize();
if (moving) { } else {
attack_dir = move_dir; if (moving) {
attack_dir = move_dir;
}
} }
} }
if (moving) { if (moving) {
@ -1097,6 +1100,11 @@ void Player::MakeUpdateMsg()
} }
} }
} }
if (room->gas_data.gas_mode == GasJump) {
cs::MFPlane* p = update_msg->mutable_plane();
room->plane.start_point.ToPB(p->mutable_start_point());
room->plane.end_point.ToPB(p->mutable_end_point());
}
if (send_update_msg_times == 0) { if (send_update_msg_times == 0) {
room->FetchBuilding(this); room->FetchBuilding(this);
} }

View File

@ -1054,6 +1054,7 @@ void Room::ShuaPlane()
plane.start_point = Vector2D(100, 100); plane.start_point = Vector2D(100, 100);
plane.end_point = Vector2D(7500, 7500); plane.end_point = Vector2D(7500, 7500);
plane.dir = plane.end_point - plane.start_point; plane.dir = plane.end_point - plane.start_point;
plane.dir.Normalize();
plane.curr_pos = plane.start_point; plane.curr_pos = plane.start_point;
std::vector<Human*> humans; std::vector<Human*> humans;