This commit is contained in:
aozhiwei 2021-09-14 11:58:46 +08:00
parent ee3a937644
commit 98db807a91
3 changed files with 29 additions and 31 deletions

View File

@ -42,7 +42,7 @@ void FrameEvent::AddEmote(CreatureWeakPtr& sender, int emote_id)
( (
[emote_idx] (Human* hum, bool& stop) [emote_idx] (Human* hum, bool& stop)
{ {
hum->framedata_.emotes_.push_back(emote_idx); hum->GetFrameData().emotes_.push_back(emote_idx);
}); });
} }
} }
@ -70,7 +70,7 @@ void FrameEvent::AddShot(CreatureWeakPtr& sender)
( (
[shot_idx] (Human* hum, bool& stop) [shot_idx] (Human* hum, bool& stop)
{ {
hum->framedata_.shots_.push_back(shot_idx); hum->GetFrameData().shots_.push_back(shot_idx);
}); });
} }
} }
@ -111,7 +111,7 @@ void FrameEvent::AddBullet(int bullet_uniid,
abort(); abort();
} }
#endif #endif
hum->framedata_.bullets_.push_back(bullet_idx); hum->GetFrameData().bullets_.push_back(bullet_idx);
}); });
} }
} }
@ -136,7 +136,7 @@ void FrameEvent::RemoveBullet(a8::Vec2 pos, int bullet_uniid)
grid_list, grid_list,
[bullet_idx] (Human* hum, bool& stop) [bullet_idx] (Human* hum, bool& stop)
{ {
hum->framedata_.del_bullets_.push_back(bullet_idx); hum->GetFrameData().del_bullets_.push_back(bullet_idx);
}); });
} }
} }
@ -184,7 +184,7 @@ void FrameEvent::AddExplosionEx(CreatureWeakPtr& sender, int item_id, a8::Vec2 b
grid_list, grid_list,
[explosion_idx] (Human* hum, bool& stop) [explosion_idx] (Human* hum, bool& stop)
{ {
hum->framedata_.explosions_.push_back(explosion_idx); hum->GetFrameData().explosions_.push_back(explosion_idx);
}); });
} }
} }
@ -194,13 +194,13 @@ void FrameEvent::AddBulletNumChg(CreatureWeakPtr& sender)
chged_bullet_nums_.push_back(sender); chged_bullet_nums_.push_back(sender);
int idx = chged_bullet_nums_.size() - 1; int idx = chged_bullet_nums_.size() - 1;
if (sender.Get()->IsHuman()) { if (sender.Get()->IsHuman()) {
sender.Get()->AsHuman()->framedata_.chged_bullet_nums_.push_back(idx); sender.Get()->AsHuman()->GetFrameData().chged_bullet_nums_.push_back(idx);
} else { } else {
sender.Get()->TraverseAllLayerHumanList sender.Get()->TraverseAllLayerHumanList
( (
[idx] (Human* hum, bool& stop) [idx] (Human* hum, bool& stop)
{ {
hum->framedata_.chged_bullet_nums_.push_back(idx); hum->GetFrameData().chged_bullet_nums_.push_back(idx);
}); });
} }
} }
@ -226,7 +226,7 @@ void FrameEvent::AddSmoke(Bullet* bullet, int item_id, a8::Vec2 pos, float time_
( (
[idx] (Human* hum, bool& stop) [idx] (Human* hum, bool& stop)
{ {
hum->framedata_.smokes_.push_back(idx); hum->GetFrameData().smokes_.push_back(idx);
}); });
} }
} }
@ -249,7 +249,7 @@ void FrameEvent::AddPlaySkill(CreatureWeakPtr& sender, int skill_id)
( (
[idx] (Human* hum, bool& stop) [idx] (Human* hum, bool& stop)
{ {
hum->framedata_.play_skills_.push_back(idx); hum->GetFrameData().play_skills_.push_back(idx);
}); });
} }
} }
@ -262,7 +262,7 @@ void FrameEvent::AddHpChg(CreatureWeakPtr& sender)
( (
[idx] (Human* hum, bool& stop) [idx] (Human* hum, bool& stop)
{ {
hum->framedata_.chged_hps_.push_back(idx); hum->GetFrameData().chged_hps_.push_back(idx);
}); });
} }
@ -278,13 +278,13 @@ void FrameEvent::AddWeaponAmmoChg(CreatureWeakPtr& sender)
); );
int idx = chged_weapon_ammo_.size() - 1; int idx = chged_weapon_ammo_.size() - 1;
if (sender.Get()->IsHuman()) { if (sender.Get()->IsHuman()) {
sender.Get()->AsHuman()->framedata_.chged_weapon_ammo_.push_back(idx); sender.Get()->AsHuman()->GetFrameData().chged_weapon_ammo_.push_back(idx);
} else { } else {
sender.Get()->TraverseAllLayerHumanList sender.Get()->TraverseAllLayerHumanList
( (
[idx] (Human* hum, bool& stop) [idx] (Human* hum, bool& stop)
{ {
hum->framedata_.chged_weapon_ammo_.push_back(idx); hum->GetFrameData().chged_weapon_ammo_.push_back(idx);
}); });
} }
} }
@ -305,7 +305,7 @@ void FrameEvent::AddBuff(CreatureWeakPtr& sender, Buff* buff)
( (
[idx] (Human* hum, bool& stop) [idx] (Human* hum, bool& stop)
{ {
hum->framedata_.chged_buffs_.push_back(idx); hum->GetFrameData().chged_buffs_.push_back(idx);
}); });
} }
} }
@ -325,7 +325,7 @@ void FrameEvent::RemoveBuff(CreatureWeakPtr& sender, int buff_id)
( (
[idx] (Human* hum, bool& stop) [idx] (Human* hum, bool& stop)
{ {
hum->framedata_.chged_buffs_.push_back(idx); hum->GetFrameData().chged_buffs_.push_back(idx);
}); });
} }
} }
@ -335,7 +335,7 @@ void FrameEvent::AddSkillCdChg(CreatureWeakPtr sender, int skill_id, int left_ti
if (sender.Get() && sender.Get()->IsHuman()) { if (sender.Get() && sender.Get()->IsHuman()) {
chged_skillcds_.push_back(std::make_tuple(sender, skill_id, left_time)); chged_skillcds_.push_back(std::make_tuple(sender, skill_id, left_time));
int idx = chged_skillcds_.size() - 1; int idx = chged_skillcds_.size() - 1;
((Human*)sender.Get())->framedata_.chged_skillcds_.push_back(idx); ((Human*)sender.Get())->GetFrameData().chged_skillcds_.push_back(idx);
} }
} }
@ -344,7 +344,7 @@ void FrameEvent::AddSkillCurrTimesChg(CreatureWeakPtr sender, int skill_id, int
if (sender.Get() && sender.Get()->IsHuman()) { if (sender.Get() && sender.Get()->IsHuman()) {
chged_skill_curr_times_.push_back(std::make_tuple(sender, skill_id, curr_times)); chged_skill_curr_times_.push_back(std::make_tuple(sender, skill_id, curr_times));
int idx = chged_skill_curr_times_.size() - 1; int idx = chged_skill_curr_times_.size() - 1;
((Human*)sender.Get())->framedata_.chged_skill_curr_times_.push_back(idx); ((Human*)sender.Get())->GetFrameData().chged_skill_curr_times_.push_back(idx);
} }
} }
@ -353,7 +353,7 @@ void FrameEvent::AddItemChg(CreatureWeakPtr& sender, int item_id, int item_num)
if (sender.Get()->IsHuman()) { if (sender.Get()->IsHuman()) {
chged_items_.push_back(std::make_tuple(sender, item_id, item_num)); chged_items_.push_back(std::make_tuple(sender, item_id, item_num));
int idx = chged_items_.size() - 1; int idx = chged_items_.size() - 1;
((Human*)sender.Get())->framedata_.chged_items_.push_back(idx); ((Human*)sender.Get())->GetFrameData().chged_items_.push_back(idx);
} }
} }
@ -375,7 +375,7 @@ void FrameEvent::AddDead(CreatureWeakPtr& sender, int revive_time)
( (
[dead_idx] (Human* hum, bool& stop) [dead_idx] (Human* hum, bool& stop)
{ {
hum->framedata_.dead_alive_objs_.push_back(dead_idx); hum->GetFrameData().dead_alive_objs_.push_back(dead_idx);
}); });
} }
} }
@ -399,7 +399,7 @@ void FrameEvent::AddRevive(CreatureWeakPtr& sender)
( (
[revive_idx] (Human* hum, bool& stop) [revive_idx] (Human* hum, bool& stop)
{ {
hum->framedata_.dead_alive_objs_.push_back(revive_idx); hum->GetFrameData().dead_alive_objs_.push_back(revive_idx);
}); });
} }
} }
@ -413,7 +413,7 @@ void FrameEvent::AddCarChg(CreatureWeakPtr& sender)
( (
[idx] (Human* hum, bool& stop) [idx] (Human* hum, bool& stop)
{ {
hum->framedata_.chged_cars_.push_back(idx); hum->GetFrameData().chged_cars_.push_back(idx);
}); });
} }
@ -431,14 +431,14 @@ void FrameEvent::AddPropChg(CreatureWeakPtr& sender, int type, int subtype, floa
int idx = chged_props_.size() - 1; int idx = chged_props_.size() - 1;
if (only_self) { if (only_self) {
if (sender.Get()->IsHuman()) { if (sender.Get()->IsHuman()) {
sender.Get()->AsHuman()->framedata_.chged_props_.push_back(idx); sender.Get()->AsHuman()->GetFrameData().chged_props_.push_back(idx);
} }
} else { } else {
sender.Get()->TraverseAllLayerHumanList sender.Get()->TraverseAllLayerHumanList
( (
[idx] (Human* hum, bool& stop) [idx] (Human* hum, bool& stop)
{ {
hum->framedata_.chged_props_.push_back(idx); hum->GetFrameData().chged_props_.push_back(idx);
}); });
} }
} }

View File

@ -12,9 +12,9 @@
void FrameMaker::Debug_FullObject(Human* hum) void FrameMaker::Debug_FullObject(Human* hum)
{ {
if (!hum->framedata_.new_objects.empty()) { if (!hum->GetFrameData().new_objects.empty()) {
a8::MutableXObject* out_data = a8::MutableXObject::NewArray(); a8::MutableXObject* out_data = a8::MutableXObject::NewArray();
for (auto& pair : hum->framedata_.new_objects) { for (auto& pair : hum->GetFrameData().new_objects) {
a8::MutableXObject* xobj = a8::MutableXObject::NewObject(); a8::MutableXObject* xobj = a8::MutableXObject::NewObject();
xobj->SetVal("uniid", pair.first); xobj->SetVal("uniid", pair.first);
if (pair.second.Get()) { if (pair.second.Get()) {
@ -42,9 +42,9 @@ void FrameMaker::Debug_FullObject(Human* hum)
void FrameMaker::Debug_OutObject(Human* hum) void FrameMaker::Debug_OutObject(Human* hum)
{ {
if (!hum->framedata_.out_objects.empty()) { if (!hum->GetFrameData().out_objects.empty()) {
a8::MutableXObject* out_data = a8::MutableXObject::NewArray(); a8::MutableXObject* out_data = a8::MutableXObject::NewArray();
for (auto& itr : hum->framedata_.out_objects) { for (auto& itr : hum->GetFrameData().out_objects) {
int uniid = itr; int uniid = itr;
a8::MutableXObject* xobj = a8::MutableXObject::NewObject(); a8::MutableXObject* xobj = a8::MutableXObject::NewObject();
xobj->SetVal("uniid", uniid); xobj->SetVal("uniid", uniid);
@ -68,7 +68,7 @@ void FrameMaker::Debug_OutObject(Human* hum)
cs::SMUpdate* FrameMaker::MakeUpdateMsg(Human* hum) cs::SMUpdate* FrameMaker::MakeUpdateMsg(Human* hum)
{ {
FrameData* framedata = &hum->framedata_; FrameData* framedata = &hum->GetFrameData();
cs::SMUpdate* msg = new cs::SMUpdate; cs::SMUpdate* msg = new cs::SMUpdate;
Room* room = hum->room; Room* room = hum->room;
{ {

View File

@ -255,13 +255,14 @@ class Human : public Creature
int GetSeat() { return seat_; } int GetSeat() { return seat_; }
void SetSeat(int seat) { seat_ = seat; } void SetSeat(int seat) { seat_ = seat; }
void DeadDrop(); void DeadDrop();
virtual std::string GetName() override { return name;}; virtual std::string GetName() override { return name; };
void UpdateViewObjects(); void UpdateViewObjects();
void GMAddItem(int item_id, int item_num); void GMAddItem(int item_id, int item_num);
void ProcUseItem(int item_id); void ProcUseItem(int item_id);
void StartRefreshViewTimer(); void StartRefreshViewTimer();
void DoFollow(int target_id); void DoFollow(int target_id);
void OnWatcherDie(Human* watcher); void OnWatcherDie(Human* watcher);
FrameData& GetFrameData() { return framedata_; };
protected: protected:
void _InternalUpdateMove(float speed); void _InternalUpdateMove(float speed);
@ -348,7 +349,4 @@ private:
long long jump_frameno_ = 0; long long jump_frameno_ = 0;
float old_sync_speed = 0; float old_sync_speed = 0;
friend class FrameMaker;
friend class FrameEvent;
}; };