add out_objids
This commit is contained in:
parent
c989b2573f
commit
68d2d372d0
@ -30,6 +30,9 @@ cs::SMUpdate* FrameMaker::MakeUpdateMsg(const Human* hum)
|
|||||||
for (auto& itr : hum->del_objects) {
|
for (auto& itr : hum->del_objects) {
|
||||||
msg->add_del_objids(itr);
|
msg->add_del_objids(itr);
|
||||||
}
|
}
|
||||||
|
for (auto& itr : hum->out_objects) {
|
||||||
|
msg->add_out_objids(itr);
|
||||||
|
}
|
||||||
for (int idx : hum->shots_) {
|
for (int idx : hum->shots_) {
|
||||||
if (idx < room->frame_event.shots_.size()) {
|
if (idx < room->frame_event.shots_.size()) {
|
||||||
auto& tuple = room->frame_event.shots_[idx];
|
auto& tuple = room->frame_event.shots_[idx];
|
||||||
|
@ -553,6 +553,11 @@ void Human::RemoveObjects(Entity* entity)
|
|||||||
del_objects.insert(entity->entity_uniid);
|
del_objects.insert(entity->entity_uniid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Human::OutObjects(Entity* entity)
|
||||||
|
{
|
||||||
|
out_objects.insert(entity->entity_uniid);
|
||||||
|
}
|
||||||
|
|
||||||
bool Human::HasLiveTeammate()
|
bool Human::HasLiveTeammate()
|
||||||
{
|
{
|
||||||
if (team_members) {
|
if (team_members) {
|
||||||
@ -846,6 +851,7 @@ void Human::RefreshView()
|
|||||||
switch (entity->entity_type) {
|
switch (entity->entity_type) {
|
||||||
case ET_Building:
|
case ET_Building:
|
||||||
case ET_Obstacle:
|
case ET_Obstacle:
|
||||||
|
case ET_Hero:
|
||||||
{
|
{
|
||||||
AddToNewObjects(entity);
|
AddToNewObjects(entity);
|
||||||
}
|
}
|
||||||
@ -878,6 +884,7 @@ void Human::OnGridListChange(std::set<GridCell*>& old_grid_list,
|
|||||||
switch (entity->entity_type) {
|
switch (entity->entity_type) {
|
||||||
case ET_Building:
|
case ET_Building:
|
||||||
case ET_Obstacle:
|
case ET_Obstacle:
|
||||||
|
case ET_Hero:
|
||||||
{
|
{
|
||||||
AddToNewObjects(entity);
|
AddToNewObjects(entity);
|
||||||
}
|
}
|
||||||
@ -892,21 +899,18 @@ void Human::OnGridListChange(std::set<GridCell*>& old_grid_list,
|
|||||||
}
|
}
|
||||||
for (GridCell* cell : dec_grid_list) {
|
for (GridCell* cell : dec_grid_list) {
|
||||||
for (Human* entity : cell->human_list) {
|
for (Human* entity : cell->human_list) {
|
||||||
#if 0
|
|
||||||
if (!room->grid_service.HumanInGridList(entity, grid_list)) {
|
if (!room->grid_service.HumanInGridList(entity, grid_list)) {
|
||||||
RemoveObjects(entity);
|
OutObjects(entity);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
for (Entity* entity : cell->entity_list) {
|
for (Entity* entity : cell->entity_list) {
|
||||||
if (!room->grid_service.EntityInGridList(entity, grid_list)) {
|
if (!room->grid_service.EntityInGridList(entity, grid_list)) {
|
||||||
switch (entity->entity_type) {
|
switch (entity->entity_type) {
|
||||||
case ET_Building:
|
case ET_Building:
|
||||||
case ET_Obstacle:
|
case ET_Obstacle:
|
||||||
|
case ET_Hero:
|
||||||
{
|
{
|
||||||
#if 0
|
OutObjects(entity);
|
||||||
RemoveObjects(entity);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -1310,6 +1314,15 @@ void Human::ClearFrameData()
|
|||||||
}
|
}
|
||||||
del_objects.clear();
|
del_objects.clear();
|
||||||
}
|
}
|
||||||
|
if (!out_objects.empty()) {
|
||||||
|
for (auto& itr : out_objects) {
|
||||||
|
Entity* entity = room->GetEntityByUniId(itr);
|
||||||
|
if (entity) {
|
||||||
|
part_objects.erase(entity);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
del_objects.clear();
|
||||||
|
}
|
||||||
if (!shots_.empty()) {
|
if (!shots_.empty()) {
|
||||||
shots_.clear();
|
shots_.clear();
|
||||||
}
|
}
|
||||||
|
@ -135,6 +135,7 @@ class Human : public Entity
|
|||||||
void AddToNewObjects(Entity* entity);
|
void AddToNewObjects(Entity* entity);
|
||||||
void AddToPartObjects(Entity* entity);
|
void AddToPartObjects(Entity* entity);
|
||||||
void RemoveObjects(Entity* entity);
|
void RemoveObjects(Entity* entity);
|
||||||
|
void OutObjects(Entity* entity);
|
||||||
bool HasLiveTeammate();
|
bool HasLiveTeammate();
|
||||||
void Land();
|
void Land();
|
||||||
void DoJump();
|
void DoJump();
|
||||||
@ -188,6 +189,7 @@ protected:
|
|||||||
std::set<Entity*> new_objects;
|
std::set<Entity*> new_objects;
|
||||||
std::set<Entity*> part_objects;
|
std::set<Entity*> part_objects;
|
||||||
std::set<int> del_objects;
|
std::set<int> del_objects;
|
||||||
|
std::set<int> out_objects;
|
||||||
std::vector<int> shots_;
|
std::vector<int> shots_;
|
||||||
std::vector<int> emotes_;
|
std::vector<int> emotes_;
|
||||||
std::vector<int> bullets_;
|
std::vector<int> bullets_;
|
||||||
|
@ -678,7 +678,8 @@ message SMPlayerInfo
|
|||||||
//帧事件
|
//帧事件
|
||||||
message SMUpdate
|
message SMUpdate
|
||||||
{
|
{
|
||||||
repeated int32 del_objids = 2; //对象-待删除(移出视野)
|
repeated int32 out_objids = 1; //对象-移出视野
|
||||||
|
repeated int32 del_objids = 2; //对象-待删除
|
||||||
repeated MFObjectFull full_objects = 3; //对象-全量(出现在视野)
|
repeated MFObjectFull full_objects = 3; //对象-全量(出现在视野)
|
||||||
repeated MFObjectPart part_objects = 4; //对象-部分(用于插值更新)
|
repeated MFObjectPart part_objects = 4; //对象-部分(用于插值更新)
|
||||||
optional int32 active_player_id = 5; //当前活跃玩家id(如果玩家死亡后是观战对象的id)
|
optional int32 active_player_id = 5; //当前活跃玩家id(如果玩家死亡后是观战对象的id)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user