1
This commit is contained in:
parent
6780aa53d5
commit
9038d84c3d
@ -1730,18 +1730,36 @@ void Human::RemoveObserver(Human* observer)
|
||||
void Human::SendUpdateMsg()
|
||||
{
|
||||
if (!follow_target_ && !a8::HasBitFlag(status, HS_Disable) && IsPlayer()) {
|
||||
#ifdef DEBUG
|
||||
long long begin_tick = a8::XGetTickCount();
|
||||
long long end_tick = a8::XGetTickCount();
|
||||
#endif
|
||||
cs::MFActivePlayerData* active_player_data_pb = nullptr;
|
||||
if (send_msg_times == 0 || need_sync_active_player) {
|
||||
active_player_data_pb = new cs::MFActivePlayerData();
|
||||
FillMFActivePlayerData(active_player_data_pb);
|
||||
need_sync_active_player = false;
|
||||
}
|
||||
#ifdef DEBUG
|
||||
end_tick = a8::XGetTickCount();
|
||||
if (a8::XGetTickCount() - begin_tick > 1000) {
|
||||
abort();
|
||||
}
|
||||
begin_tick = a8::XGetTickCount();
|
||||
#endif
|
||||
|
||||
cs::SMUpdate* msg = room->frame_maker.MakeUpdateMsg(this);
|
||||
if (send_msg_times == 0 || last_sync_gas_frameno < room->GetGasData().gas_start_frameno) {
|
||||
last_sync_gas_frameno = room->GetGasData().gas_start_frameno;
|
||||
FillMFGasData(msg->mutable_gas_data());
|
||||
}
|
||||
#ifdef DEBUG
|
||||
end_tick = a8::XGetTickCount();
|
||||
if (a8::XGetTickCount() - begin_tick > 1000) {
|
||||
abort();
|
||||
}
|
||||
begin_tick = a8::XGetTickCount();
|
||||
#endif
|
||||
NotifyObservers(msg, active_player_data_pb);
|
||||
delete msg;
|
||||
|
||||
@ -2231,7 +2249,7 @@ void Human::ClearFrameData()
|
||||
Human* hum = (Human*)entity;
|
||||
hum->RemovePartObjects(this);
|
||||
}
|
||||
#ifdef DEBUG
|
||||
#ifdef DEBUG1
|
||||
room->CheckPartObjects();
|
||||
#endif
|
||||
}
|
||||
@ -2250,7 +2268,7 @@ void Human::ClearFrameData()
|
||||
hum->RemovePartObjects(this);
|
||||
}
|
||||
}
|
||||
#ifdef DEBUG
|
||||
#ifdef DEBUG1
|
||||
room->CheckPartObjects();
|
||||
#endif
|
||||
}
|
||||
|
@ -58,7 +58,6 @@ void Player::InternalUpdate(int delta_time)
|
||||
if (HasBuffEffect(kBET_Fly)) {
|
||||
SetPos(room->plane.curr_pos);
|
||||
room->grid_service->MoveHuman(this);
|
||||
return;
|
||||
}
|
||||
if (HasSpecMove()) {
|
||||
_UpdateSpecMove();
|
||||
|
@ -126,15 +126,39 @@ void Room::Update(int delta_time)
|
||||
|
||||
elapsed_time_ += delta_time;
|
||||
while (elapsed_time_ >= 50) {
|
||||
#ifdef DEBUG
|
||||
long long begin_tick = a8::XGetTickCount();
|
||||
long long end_tick = a8::XGetTickCount();
|
||||
#endif
|
||||
if (GetFrameNo() % 2 == 0) {
|
||||
UpdateGas();
|
||||
}
|
||||
#ifdef DEBUG
|
||||
end_tick = a8::XGetTickCount();
|
||||
if (a8::XGetTickCount() - begin_tick > 1000) {
|
||||
abort();
|
||||
}
|
||||
begin_tick = a8::XGetTickCount();
|
||||
#endif
|
||||
for (auto& pair : moveable_hash_) {
|
||||
pair.second->Update(50);
|
||||
}
|
||||
#ifdef DEBUG
|
||||
end_tick = a8::XGetTickCount();
|
||||
if (a8::XGetTickCount() - begin_tick > 1000) {
|
||||
abort();
|
||||
}
|
||||
begin_tick = a8::XGetTickCount();
|
||||
#endif
|
||||
if (GetFrameNo() % 2 == 0) {
|
||||
SyncFrameData();
|
||||
}
|
||||
#ifdef DEBUG
|
||||
end_tick = a8::XGetTickCount();
|
||||
if (a8::XGetTickCount() - begin_tick > 1000) {
|
||||
abort();
|
||||
}
|
||||
#endif
|
||||
++frameno_;
|
||||
elapsed_time_ -= 50;
|
||||
}
|
||||
@ -1046,6 +1070,7 @@ void Room::UpdateGas()
|
||||
void Room::UpdateGasInactive()
|
||||
{
|
||||
if (GetFrameNo() - gas_data_.gas_start_frameno >= GetGasInactiveTime() * SERVER_FRAME_RATE) {
|
||||
long long begin_tick = a8::XGetTickCount();
|
||||
gas_data_.gas_mode = GasJump;
|
||||
gas_data_.gas_start_frameno = GetFrameNo();
|
||||
if (human_hash_.size() < GetRoomMaxPlayerNum()) {
|
||||
@ -1088,6 +1113,10 @@ void Room::UpdateGasInactive()
|
||||
}
|
||||
},
|
||||
&xtimer_attacher_.timer_list_);
|
||||
#if 1
|
||||
a8::XPrintf("max_run_delay:%d %d\n", {PerfMonitor::Instance()->max_run_delay_time,
|
||||
a8::XGetTickCount() - begin_tick});
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@ -3209,9 +3238,27 @@ bool Room::CanAddToScene(Human* hum)
|
||||
|
||||
void Room::SyncFrameData()
|
||||
{
|
||||
#ifdef DEBUG
|
||||
long long begin_tick = a8::XGetTickCount();
|
||||
long long end_tick = a8::XGetTickCount();
|
||||
#endif
|
||||
for (auto& pair : human_hash_) {
|
||||
pair.second->SendUpdateMsg();
|
||||
#ifdef DEBUG
|
||||
end_tick = a8::XGetTickCount();
|
||||
if (a8::XGetTickCount() - begin_tick > 100) {
|
||||
abort();
|
||||
}
|
||||
begin_tick = a8::XGetTickCount();
|
||||
#endif
|
||||
}
|
||||
#ifdef DEBUG
|
||||
end_tick = a8::XGetTickCount();
|
||||
if (a8::XGetTickCount() - begin_tick > 1000) {
|
||||
abort();
|
||||
}
|
||||
begin_tick = a8::XGetTickCount();
|
||||
#endif
|
||||
frame_event.Clear();
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user