rename need_sync_active_player->MarkSyncActivePlayer
This commit is contained in:
parent
6726c3245f
commit
3572bd7326
@ -266,7 +266,7 @@ void Buff::ProcBecome()
|
||||
}
|
||||
}
|
||||
}
|
||||
caster_.Get()->need_sync_active_player = true;
|
||||
caster_.Get()->MarkSyncActivePlayer(__FILE__, __LINE__, __func__);
|
||||
caster_.Get()->SyncAroundPlayers(__FILE__, __LINE__, __func__);
|
||||
}
|
||||
#ifdef DEBUG1
|
||||
@ -300,7 +300,7 @@ void Buff::ProcDriver()
|
||||
}
|
||||
}
|
||||
}
|
||||
caster_.Get()->need_sync_active_player = true;
|
||||
caster_.Get()->MarkSyncActivePlayer(__FILE__, __LINE__, __func__);
|
||||
caster_.Get()->SyncAroundPlayers(__FILE__, __LINE__, __func__);
|
||||
}
|
||||
|
||||
@ -314,7 +314,7 @@ void Buff::ProcPassenger()
|
||||
{
|
||||
hold_curr_weapon_idx_ = caster_.Get()->GetCurrWeapon()->weapon_idx;
|
||||
CalcPassengerShotOffset();
|
||||
caster_.Get()->need_sync_active_player = true;
|
||||
caster_.Get()->MarkSyncActivePlayer(__FILE__, __LINE__, __func__);
|
||||
caster_.Get()->SyncAroundPlayers(__FILE__, __LINE__, __func__);
|
||||
}
|
||||
|
||||
@ -362,7 +362,7 @@ void Buff::RecoverHoldWeapons()
|
||||
}
|
||||
#endif
|
||||
hold_weapons_.clear();
|
||||
caster_.Get()->need_sync_active_player = true;
|
||||
caster_.Get()->MarkSyncActivePlayer(__FILE__, __LINE__, __func__);
|
||||
caster_.Get()->SyncAroundPlayers(__FILE__, __LINE__, __func__);
|
||||
}
|
||||
|
||||
@ -1000,7 +1000,7 @@ void Buff::ProcMachineGun()
|
||||
}
|
||||
}
|
||||
}
|
||||
caster_.Get()->need_sync_active_player = true;
|
||||
caster_.Get()->MarkSyncActivePlayer(__FILE__, __LINE__, __func__);
|
||||
caster_.Get()->UpdateCharImage(__FILE__, __LINE__, __func__);
|
||||
}
|
||||
if (skill_meta && skill_meta->number_meta) {
|
||||
|
@ -250,7 +250,7 @@ void Car::SwitchSeat(Human* passenger, int seat)
|
||||
} else {
|
||||
Buff* buff = passenger->GetBuffByEffectId(kBET_Passenger);
|
||||
buff->CalcPassengerShotOffset();
|
||||
passenger->need_sync_active_player = true;
|
||||
passenger->MarkSyncActivePlayer(__FILE__, __LINE__, __func__);
|
||||
}
|
||||
room->frame_event.AddCarChg(passenger->GetWeakPtrRef());
|
||||
SyncAroundPlayers(__FILE__, __LINE__, __func__);
|
||||
|
@ -297,6 +297,7 @@ enum PropertyType_e
|
||||
kPropShieldHp = 33,
|
||||
|
||||
kPropBeHook = 34,
|
||||
kPropSkillMinor = 35,
|
||||
};
|
||||
|
||||
enum MapObjectType_e
|
||||
|
@ -16,6 +16,8 @@
|
||||
#include "skillhelper.h"
|
||||
#include "shot.h"
|
||||
|
||||
#include "framework/cpp/utils.h"
|
||||
|
||||
static int GetTraceTargetId(Creature* c)
|
||||
{
|
||||
return 0;
|
||||
@ -509,7 +511,7 @@ void Creature::RecalcBuffAttr()
|
||||
GetTrigger()->HpChg();
|
||||
}
|
||||
if (IsHuman()) {
|
||||
need_sync_active_player = true;
|
||||
MarkSyncActivePlayer(__FILE__, __LINE__, __func__);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1404,7 +1406,7 @@ void Creature::ProcBuffEffect(Creature* caster, Buff* buff)
|
||||
if (IsHuman()) {
|
||||
AsHuman()->RecalcVolume();
|
||||
}
|
||||
need_sync_active_player = true;
|
||||
MarkSyncActivePlayer(__FILE__, __LINE__, __func__);
|
||||
}
|
||||
break;
|
||||
case kBET_AddCarBuff:
|
||||
@ -1611,7 +1613,7 @@ void Creature::StartAction(ActionType_e action_type,
|
||||
this->action_duration = action_duration;
|
||||
this->action_item_id = item_id;
|
||||
this->action_target_id = target_id;
|
||||
need_sync_active_player = true;
|
||||
MarkSyncActivePlayer(__FILE__, __LINE__, __func__);
|
||||
if (HasBuffEffect(kBET_Camouflage)) {
|
||||
RemoveBuffByEffectId(kBET_Camouflage);
|
||||
}
|
||||
@ -1642,7 +1644,7 @@ void Creature::ResetAction()
|
||||
action_frameno = 0;
|
||||
action_item_id = 0;
|
||||
action_target_id = 0;
|
||||
need_sync_active_player = true;
|
||||
MarkSyncActivePlayer(__FILE__, __LINE__, __func__);
|
||||
if (reload_delay_timer_) {
|
||||
room->xtimer.DeleteTimer(reload_delay_timer_);
|
||||
reload_delay_timer_ = nullptr;
|
||||
@ -1861,7 +1863,7 @@ void Creature::Shot(a8::Vec2& target_dir, bool& shot_ok, float fly_distance, int
|
||||
auto_switch_weapon = true;
|
||||
}
|
||||
}
|
||||
need_sync_active_player = true;
|
||||
MarkSyncActivePlayer(__FILE__, __LINE__, __func__);
|
||||
SyncAroundPlayers(__FILE__, __LINE__, __func__);
|
||||
}
|
||||
break;
|
||||
@ -1881,7 +1883,7 @@ void Creature::Shot(a8::Vec2& target_dir, bool& shot_ok, float fly_distance, int
|
||||
auto_switch_weapon = true;
|
||||
}
|
||||
}
|
||||
need_sync_active_player = true;
|
||||
MarkSyncActivePlayer(__FILE__, __LINE__, __func__);
|
||||
SyncAroundPlayers(__FILE__, __LINE__, __func__);
|
||||
}
|
||||
break;
|
||||
@ -1901,7 +1903,7 @@ void Creature::Shot(a8::Vec2& target_dir, bool& shot_ok, float fly_distance, int
|
||||
auto_switch_weapon = true;
|
||||
}
|
||||
}
|
||||
need_sync_active_player = true;
|
||||
MarkSyncActivePlayer(__FILE__, __LINE__, __func__);
|
||||
SyncAroundPlayers(__FILE__, __LINE__, __func__);
|
||||
}
|
||||
break;
|
||||
@ -2987,7 +2989,7 @@ void Creature::AutoSwitchWeapon()
|
||||
}
|
||||
}
|
||||
if (switch_ok) {
|
||||
c->need_sync_active_player = true;
|
||||
c->MarkSyncActivePlayer(__FILE__, __LINE__, __func__);
|
||||
c->SyncAroundPlayers(__FILE__, __LINE__, __func__);
|
||||
}
|
||||
c->CheckLoadingBullet();
|
||||
@ -3456,3 +3458,20 @@ bool Creature::IsHpFull()
|
||||
{
|
||||
return std::abs(GetMaxHP() - GetHP()) < 0.0001f;
|
||||
}
|
||||
|
||||
void Creature::MarkSyncActivePlayer(const char* file, int line, const char* func)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
if (!f8::IsTestEnv()) {
|
||||
if (IsPlayer()) {
|
||||
a8::XPrintf("MarkSyncActivePlayer file:%s line:%d func:%s\n",
|
||||
{
|
||||
file,
|
||||
line,
|
||||
func
|
||||
});
|
||||
}
|
||||
}
|
||||
#endif
|
||||
need_sync_active_player_ = true;
|
||||
}
|
||||
|
@ -99,7 +99,6 @@ class Creature : public MoveableEntity
|
||||
|
||||
std::vector<std::tuple<int, int>> talent_list;
|
||||
|
||||
bool need_sync_active_player = false;
|
||||
std::function<void ()> on_loading_bullet;
|
||||
CreatureWeakPtr follow_target;
|
||||
|
||||
@ -290,6 +289,7 @@ class Creature : public MoveableEntity
|
||||
void AddTraceBullet(int bullet_uniid, int target_uniid, int gun_id);
|
||||
void LockAttackDir(int time);
|
||||
void PullTarget(const a8::Vec2& target_pos);
|
||||
void MarkSyncActivePlayer(const char* file, int line, const char* func);
|
||||
|
||||
protected:
|
||||
virtual void OnBuffRemove(Buff& buff);
|
||||
@ -318,6 +318,7 @@ private:
|
||||
|
||||
protected:
|
||||
RaceType_e race_ = kHumanRace;
|
||||
bool need_sync_active_player_ = false;
|
||||
|
||||
ActionType_e action_type = AT_None;
|
||||
int action_duration = 0;
|
||||
|
@ -452,6 +452,35 @@ void FrameEvent::AddPropChg(CreatureWeakPtr& sender, int type, int subtype, floa
|
||||
}
|
||||
}
|
||||
|
||||
void FrameEvent::AddPropChgEx(CreatureWeakPtr& sender, int type, int subtype,
|
||||
float value, float value2, float value3, bool only_self)
|
||||
{
|
||||
if (!sender.Get()) {
|
||||
return;
|
||||
}
|
||||
auto& p = a8::FastAppend(chged_props_);
|
||||
std::get<0>(p) = sender;
|
||||
std::get<1>(p).set_obj_id(sender.Get()->GetUniId());
|
||||
std::get<1>(p).set_property_type(type);
|
||||
std::get<1>(p).set_property_subtype(subtype);
|
||||
std::get<1>(p).set_value(value);
|
||||
std::get<1>(p).set_value2(value2);
|
||||
std::get<1>(p).set_value3(value3);
|
||||
int idx = chged_props_.size() - 1;
|
||||
if (only_self) {
|
||||
if (sender.Get()->IsHuman()) {
|
||||
sender.Get()->AsHuman()->GetFrameData().chged_props_.push_back(idx);
|
||||
}
|
||||
} else {
|
||||
sender.Get()->TraverseAllLayerHumanList
|
||||
(
|
||||
[idx] (Human* hum, bool& stop)
|
||||
{
|
||||
hum->GetFrameData().chged_props_.push_back(idx);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
void FrameEvent::Clear()
|
||||
{
|
||||
if (!explosions_.empty()) {
|
||||
|
@ -48,6 +48,8 @@ public:
|
||||
void AddRevive(CreatureWeakPtr& sender);
|
||||
void AddCarChg(CreatureWeakPtr& sender);
|
||||
void AddPropChg(CreatureWeakPtr& sender, int type, int subtype, float value, bool only_self = false);
|
||||
void AddPropChgEx(CreatureWeakPtr& sender, int type, int subtype,
|
||||
float value, float value2, float value3, bool only_self = false);
|
||||
|
||||
void Clear();
|
||||
private:
|
||||
|
@ -1603,6 +1603,16 @@ void Human::SyncAroundPlayers(const char* file, int line, const char* func)
|
||||
|
||||
void Human::FillMFActivePlayerData(cs::MFActivePlayerData* player_data)
|
||||
{
|
||||
#ifdef DEBUG1
|
||||
a8::XPrintf("FillMFActivePlayerData isPlayer:%d id:%d name:%s need_sync_active_player:%d send_msg_times:%d\n",
|
||||
{
|
||||
IsPlayer() ? 1 : 0,
|
||||
GetUniId(),
|
||||
name,
|
||||
need_sync_active_player ? 1 : 0,
|
||||
send_msg_times
|
||||
});
|
||||
#endif
|
||||
{
|
||||
player_data->set_action_type(action_type);
|
||||
if (action_type != AT_None) {
|
||||
@ -1812,10 +1822,10 @@ void Human::SendUpdateMsg()
|
||||
long long end_tick = a8::XGetTickCount();
|
||||
#endif
|
||||
cs::MFActivePlayerData* active_player_data_pb = nullptr;
|
||||
if (send_msg_times == 0 || need_sync_active_player) {
|
||||
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;
|
||||
need_sync_active_player_ = false;
|
||||
}
|
||||
#ifdef DEBUG
|
||||
end_tick = a8::XGetTickCount();
|
||||
@ -1845,7 +1855,7 @@ void Human::SendUpdateMsg()
|
||||
}
|
||||
++send_msg_times;
|
||||
} else {
|
||||
need_sync_active_player = false;
|
||||
need_sync_active_player_ = false;
|
||||
}
|
||||
#ifdef DEBUG
|
||||
end_tick1 = a8::XGetTickCount();
|
||||
@ -2425,7 +2435,7 @@ void Human::DeadDrop()
|
||||
}
|
||||
}
|
||||
}
|
||||
need_sync_active_player = true;
|
||||
MarkSyncActivePlayer(__FILE__, __LINE__, __func__);
|
||||
}
|
||||
|
||||
void Human::SendBattleReport()
|
||||
@ -2554,7 +2564,7 @@ void Human::ProcNormalItem(AddItemDTO& dto)
|
||||
{
|
||||
AddItem(dto.item_meta->i->id(), 1);
|
||||
dto.handled = true;
|
||||
need_sync_active_player = true;
|
||||
MarkSyncActivePlayer(__FILE__, __LINE__, __func__);
|
||||
}
|
||||
|
||||
void Human::ProcSpoils(AddItemDTO& dto)
|
||||
@ -3145,7 +3155,7 @@ void Human::ProcReloadAction()
|
||||
DecInventory(bullet_meta->i->_inventory_slot(), add_num);
|
||||
}
|
||||
p_weapon->ammo += add_num;
|
||||
need_sync_active_player = true;
|
||||
MarkSyncActivePlayer(__FILE__, __LINE__, __func__);
|
||||
if (p_weapon->meta->i->reloadtype() == 1) {
|
||||
room->xtimer.AddDeadLineTimerAndAttach
|
||||
(1,
|
||||
@ -3226,7 +3236,7 @@ void Human::ProcUseItemAction()
|
||||
AddHp(item_meta->i->heal());
|
||||
}
|
||||
DecInventory(item_meta->i->_inventory_slot(), 1);
|
||||
need_sync_active_player = true;
|
||||
MarkSyncActivePlayer(__FILE__, __LINE__, __func__);
|
||||
GetTrigger()->UseItemAction(action_item_id);
|
||||
}
|
||||
break;
|
||||
@ -3245,7 +3255,7 @@ void Human::ProcUseItemAction()
|
||||
AddHp(item_meta->i->heal());
|
||||
}
|
||||
DecInventory(item_meta->i->_inventory_slot(), 1);
|
||||
need_sync_active_player = true;
|
||||
MarkSyncActivePlayer(__FILE__, __LINE__, __func__);
|
||||
GetTrigger()->UseItemAction(action_item_id);
|
||||
}
|
||||
break;
|
||||
@ -3347,7 +3357,7 @@ void Human::OnBuffRemove(Buff& buff)
|
||||
}
|
||||
}
|
||||
RecalcVolume();
|
||||
need_sync_active_player = true;
|
||||
MarkSyncActivePlayer(__FILE__, __LINE__, __func__);
|
||||
}
|
||||
break;
|
||||
case kBET_CamouflageAddition:
|
||||
@ -3587,7 +3597,7 @@ void Human::GMAddItem(int item_id, int item_num)
|
||||
dto.handled = false;
|
||||
dto.item_meta = item_meta;
|
||||
ProcAddItemDto(dto);
|
||||
need_sync_active_player = true;
|
||||
MarkSyncActivePlayer(__FILE__, __LINE__, __func__);
|
||||
|
||||
SyncAroundPlayers(__FILE__, __LINE__, __func__);
|
||||
}
|
||||
@ -3775,7 +3785,7 @@ void Human::ProcLootBag(AddItemDTO& dto)
|
||||
backpack = dto.item_meta->i->id();
|
||||
RecalcVolume();
|
||||
dto.handled = true;
|
||||
need_sync_active_player = true;
|
||||
MarkSyncActivePlayer(__FILE__, __LINE__, __func__);
|
||||
SyncAroundPlayers(__FILE__, __LINE__, __func__);
|
||||
}
|
||||
|
||||
@ -3805,7 +3815,7 @@ void Human::ProcLootProtection(AddItemDTO& dto)
|
||||
RecalcBaseAttr();
|
||||
}
|
||||
dto.handled = true;
|
||||
need_sync_active_player = true;
|
||||
MarkSyncActivePlayer(__FILE__, __LINE__, __func__);
|
||||
SyncAroundPlayers(__FILE__, __LINE__, __func__);
|
||||
}
|
||||
|
||||
@ -3900,7 +3910,7 @@ void Human::ProcLootSpecItem(AddItemDTO& dto)
|
||||
((Loot*)entity)->count -= add_num;
|
||||
((Loot*)entity)->BroadcastFullState(room);
|
||||
}
|
||||
need_sync_active_player = true;
|
||||
MarkSyncActivePlayer(__FILE__, __LINE__, __func__);
|
||||
if (action_type == AT_None) {
|
||||
AutoLoadingBullet();
|
||||
}
|
||||
@ -3910,7 +3920,7 @@ void Human::ProcLootSpecItem(AddItemDTO& dto)
|
||||
if (action_type == AT_None) {
|
||||
AutoLoadingBullet();
|
||||
}
|
||||
need_sync_active_player = true;
|
||||
MarkSyncActivePlayer(__FILE__, __LINE__, __func__);
|
||||
SyncAroundPlayers(__FILE__, __LINE__, __func__);
|
||||
dto.handled = true;
|
||||
}
|
||||
@ -3951,7 +3961,7 @@ void Human::ProcLootWeapon(AddItemDTO& dto)
|
||||
weapons[0].meta = dto.item_meta;
|
||||
weapons[0].Recalc();
|
||||
}
|
||||
need_sync_active_player = true;
|
||||
MarkSyncActivePlayer(__FILE__, __LINE__, __func__);
|
||||
SyncAroundPlayers(__FILE__, __LINE__, __func__);
|
||||
} else {
|
||||
if (FreezeOperate()) {
|
||||
@ -3976,7 +3986,7 @@ void Human::ProcLootWeapon(AddItemDTO& dto)
|
||||
if (switch_gun) {
|
||||
SetCurrWeapon(weapon);
|
||||
}
|
||||
need_sync_active_player = true;
|
||||
MarkSyncActivePlayer(__FILE__, __LINE__, __func__);
|
||||
SyncAroundPlayers(__FILE__, __LINE__, __func__);
|
||||
}
|
||||
dto.handled = true;
|
||||
@ -4200,7 +4210,7 @@ void Human::DropWeapon(int weapon_idx)
|
||||
}
|
||||
}
|
||||
}
|
||||
need_sync_active_player = true;
|
||||
MarkSyncActivePlayer(__FILE__, __LINE__, __func__);
|
||||
SyncAroundPlayers(__FILE__, __LINE__, __func__);
|
||||
}
|
||||
}
|
||||
|
@ -94,7 +94,7 @@ void Player::Initialize()
|
||||
}
|
||||
}
|
||||
#endif
|
||||
need_sync_active_player = true;
|
||||
MarkSyncActivePlayer(__FILE__, __LINE__, __func__);
|
||||
}
|
||||
}
|
||||
|
||||
@ -375,7 +375,7 @@ void Player::UpdateSelectWeapon()
|
||||
if (weapon->weapon_id != 0) {
|
||||
SetCurrWeapon(weapon);
|
||||
ResetAction();
|
||||
need_sync_active_player = true;
|
||||
MarkSyncActivePlayer(__FILE__, __LINE__, __func__);
|
||||
SyncAroundPlayers(__FILE__, __LINE__, __func__);
|
||||
if (old_weapon != weapon) {
|
||||
AutoLoadingBullet();
|
||||
@ -456,7 +456,7 @@ void Player::UpdateUseItemId()
|
||||
ProcUseItem(use_item_id);
|
||||
use_item_id = 0;
|
||||
has_use_item_id = false;
|
||||
need_sync_active_player = true;
|
||||
MarkSyncActivePlayer(__FILE__, __LINE__, __func__);
|
||||
}
|
||||
|
||||
void Player::UpdateSpectate()
|
||||
@ -714,7 +714,7 @@ void Player::_CMReconnect(f8::MsgHdr& hdr, const cs::CMReconnect& msg)
|
||||
}
|
||||
);
|
||||
last_sync_gas_frameno = 0;
|
||||
need_sync_active_player = true;
|
||||
MarkSyncActivePlayer(__FILE__, __LINE__, __func__);
|
||||
cs::SMReconnect respmsg;
|
||||
respmsg.set_errcode(0);
|
||||
respmsg.set_errmsg(TEXT("battle_server_reconnect_ok", "战斗重连成功"));
|
||||
@ -1082,7 +1082,7 @@ void Player::UpdateUseScope()
|
||||
if (IS_1XSCOPE + use_scope_idx >= IS_1XSCOPE && IS_1XSCOPE + use_scope_idx <= IS_15XSCOPE) {
|
||||
if (GetInventory(IS_1XSCOPE + use_scope_idx) > 0) {
|
||||
curr_scope_idx = use_scope_idx;
|
||||
need_sync_active_player = true;
|
||||
MarkSyncActivePlayer(__FILE__, __LINE__, __func__);
|
||||
}
|
||||
}
|
||||
use_scope = false;
|
||||
|
@ -202,7 +202,7 @@ void Skill::AddMinorMode(
|
||||
skill->minor_mode_timer_ = nullptr;
|
||||
}
|
||||
);
|
||||
owner->need_sync_active_player = true;
|
||||
owner->MarkSyncActivePlayer(__FILE__, __LINE__, __func__);
|
||||
}
|
||||
|
||||
void Skill::DoMinorMode()
|
||||
@ -213,7 +213,7 @@ void Skill::DoMinorMode()
|
||||
minor_cd_time_ = 0;
|
||||
minor_cb_ = nullptr;
|
||||
ResetSkillCd();
|
||||
owner->need_sync_active_player = true;
|
||||
owner->MarkSyncActivePlayer(__FILE__, __LINE__, __func__);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -50,7 +50,7 @@ package cs;
|
||||
//常量
|
||||
enum Constant_e
|
||||
{
|
||||
ProtoVersion = 2022032201; //系统版本
|
||||
ProtoVersion = 2022111601; //系统版本
|
||||
}
|
||||
|
||||
//心跳
|
||||
@ -161,6 +161,11 @@ message MFVec2
|
||||
property_type: 34 被谁抓了(猫的钩子技能)
|
||||
property_subtype:
|
||||
valule: 谁抓的你
|
||||
property_type: 35 更新主动技能副模式信息
|
||||
property_subtype: 副状态类型
|
||||
valule: 副状态cd时间(剩余时间)
|
||||
value2: 副状态cd时间(总时间)
|
||||
value3: 技能id
|
||||
*/
|
||||
message MFPropertyChg
|
||||
{
|
||||
@ -168,6 +173,8 @@ message MFPropertyChg
|
||||
optional int32 property_type = 2; //属性类型
|
||||
optional int32 property_subtype = 3; //属性子类型
|
||||
optional float value = 4; //属性值
|
||||
optional float value2 = 5; //属性值2
|
||||
optional float value3 = 6; //属性值3
|
||||
}
|
||||
|
||||
//碰撞体
|
||||
|
Loading…
x
Reference in New Issue
Block a user