framedata ok
This commit is contained in:
parent
94a49baddb
commit
92ba3d95b9
@ -117,51 +117,15 @@ void Bullet::ProcBomb()
|
|||||||
case 5:
|
case 5:
|
||||||
{
|
{
|
||||||
//手雷
|
//手雷
|
||||||
::google::protobuf::RepeatedPtrField<::cs::MFExplosion>* explosions = nullptr;
|
|
||||||
{
|
|
||||||
auto itr = room->frame_data.explosions_hash.find(room->frame_no);
|
|
||||||
if (itr == room->frame_data.explosions_hash.end()) {
|
|
||||||
room->frame_data.explosions_hash[room->frame_no] = ::google::protobuf::RepeatedPtrField<::cs::MFExplosion>();
|
|
||||||
itr = room->frame_data.explosions_hash.find(room->frame_no);
|
|
||||||
}
|
|
||||||
explosions = &itr->second;
|
|
||||||
}
|
|
||||||
|
|
||||||
#if 1
|
|
||||||
Vector2D bomb_pos = pos;
|
Vector2D bomb_pos = pos;
|
||||||
#else
|
room->frame_event.AddExplosion(this, meta->i->id(), bomb_pos);
|
||||||
float distance = (pos - born_pos).Norm();
|
|
||||||
Vector2D bomb_pos = born_pos + born_dir * distance;
|
|
||||||
#endif
|
|
||||||
cs::MFExplosion* explosion = explosions->Add();
|
|
||||||
explosion->set_item_id(meta->i->id());
|
|
||||||
bomb_pos.ToPB(explosion->mutable_pos());
|
|
||||||
explosion->set_player_id(player->entity_uniid);
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 6:
|
case 6:
|
||||||
{
|
{
|
||||||
//烟雾弹
|
//烟雾弹
|
||||||
::google::protobuf::RepeatedPtrField<::cs::MFSmoke>* smokes = nullptr;
|
|
||||||
{
|
|
||||||
auto itr = room->frame_data.smokes_hash.find(room->frame_no);
|
|
||||||
if (itr == room->frame_data.smokes_hash.end()) {
|
|
||||||
room->frame_data.smokes_hash[room->frame_no] = ::google::protobuf::RepeatedPtrField<::cs::MFSmoke>();
|
|
||||||
itr = room->frame_data.smokes_hash.find(room->frame_no);
|
|
||||||
}
|
|
||||||
smokes = &itr->second;
|
|
||||||
}
|
|
||||||
|
|
||||||
#if 1
|
|
||||||
Vector2D bomb_pos = pos;
|
Vector2D bomb_pos = pos;
|
||||||
#else
|
room->frame_event.AddSmoke(this, meta->i->id(), bomb_pos);
|
||||||
float distance = (pos - born_pos).Norm();
|
|
||||||
Vector2D bomb_pos = born_pos + born_dir * distance;
|
|
||||||
#endif
|
|
||||||
cs::MFSmoke* smoke = smokes->Add();
|
|
||||||
smoke->set_item_id(meta->i->id());
|
|
||||||
bomb_pos.ToPB(smoke->mutable_pos());
|
|
||||||
smoke->set_player_id(player->entity_uniid);
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,131 @@
|
|||||||
|
#include "precompile.h"
|
||||||
|
|
||||||
|
#include "framedata.h"
|
||||||
|
|
||||||
|
void FrameEvent::AddAirDrop(int appear_time, int box_id, Vector2D box_pos)
|
||||||
|
{
|
||||||
|
#if 0
|
||||||
|
::google::protobuf::RepeatedPtrField<::cs::MFAirDrop>* airdrops = nullptr;
|
||||||
|
{
|
||||||
|
{
|
||||||
|
auto itr = frame_data.airdrops_hash.find(frame_no);
|
||||||
|
if (itr == frame_data.airdrops_hash.end()) {
|
||||||
|
frame_data.airdrops_hash[frame_no] = ::google::protobuf::RepeatedPtrField<::cs::MFAirDrop>();
|
||||||
|
itr = frame_data.airdrops_hash.find(frame_no);
|
||||||
|
}
|
||||||
|
airdrops = &itr->second;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
cs::MFAirDrop* airdrop = airdrops->Add();
|
||||||
|
airdrop->set_appear_time(appear_time);
|
||||||
|
airdrop->set_box_id(box_id);
|
||||||
|
box_pos.ToPB(airdrop->mutable_pos());
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void FrameEvent::AddEmote(Human* hum, int emote_id)
|
||||||
|
{
|
||||||
|
#if 0
|
||||||
|
::google::protobuf::RepeatedPtrField<::cs::MFEmote>* emotes = nullptr;
|
||||||
|
{
|
||||||
|
auto itr = room->frame_data.emotes_hash.find(room->frame_no);
|
||||||
|
if (itr == room->frame_data.emotes_hash.end()) {
|
||||||
|
room->frame_data.emotes_hash[room->frame_no] = ::google::protobuf::RepeatedPtrField<::cs::MFEmote>();
|
||||||
|
itr = room->frame_data.emotes_hash.find(room->frame_no);
|
||||||
|
}
|
||||||
|
emotes = &itr->second;
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
cs::MFEmote* p = emotes->Add();
|
||||||
|
p->set_emote_id(emote_id);
|
||||||
|
p->set_player_id(entity_uniid);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void FrameEvent::AddShot(Human* hum)
|
||||||
|
{
|
||||||
|
#if 0
|
||||||
|
{
|
||||||
|
::google::protobuf::RepeatedPtrField<::cs::MFShot>* shots = nullptr;
|
||||||
|
{
|
||||||
|
{
|
||||||
|
auto itr = room->frame_data.shots_hash.find(room->frame_no);
|
||||||
|
if (itr == room->frame_data.shots_hash.end()) {
|
||||||
|
room->frame_data.shots_hash[room->frame_no] = ::google::protobuf::RepeatedPtrField<::cs::MFShot>();
|
||||||
|
itr = room->frame_data.shots_hash.find(room->frame_no);
|
||||||
|
}
|
||||||
|
shots = &itr->second;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
cs::MFShot* shot = shots->Add();
|
||||||
|
shot->set_player_id(entity_uniid);
|
||||||
|
curr_weapon->ToPB(shot->mutable_weapon());
|
||||||
|
shot->set_offhand(true);
|
||||||
|
shot->set_bullskin(10001);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void FrameEvent::AddBullet()
|
||||||
|
{
|
||||||
|
#if 0
|
||||||
|
::google::protobuf::RepeatedPtrField<::cs::MFBullet>* bullets = nullptr;
|
||||||
|
{
|
||||||
|
{
|
||||||
|
auto itr = room->frame_data.bullets_hash.find(room->frame_no);
|
||||||
|
if (itr == room->frame_data.bullets_hash.end()) {
|
||||||
|
room->frame_data.bullets_hash[room->frame_no] = ::google::protobuf::RepeatedPtrField<::cs::MFBullet>();
|
||||||
|
itr = room->frame_data.bullets_hash.find(room->frame_no);
|
||||||
|
}
|
||||||
|
bullets = &itr->second;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
{
|
||||||
|
cs::MFBullet* bullet = bullets->Add();
|
||||||
|
bullet->set_player_id(entity_uniid);
|
||||||
|
bullet->set_bullet_id(curr_weapon->meta->i->use_bullet());
|
||||||
|
bullet_born_pos.ToPB(bullet->mutable_pos());
|
||||||
|
attack_dir.ToPB(bullet->mutable_dir());
|
||||||
|
bullet->set_bulletskin(10001);
|
||||||
|
bullet->set_gun_id(curr_weapon->meta->i->id());
|
||||||
|
bullet->set_fly_distance(fly_distance);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void FrameEvent::AddExplosion(Bullet* bullet, int item_id, Vector2D bomb_pos)
|
||||||
|
{
|
||||||
|
#if 0
|
||||||
|
Vector2D bomb_pos = pos;
|
||||||
|
room->AddExplosion(Human *hum, meta->i->id(), bomb_pos)
|
||||||
|
cs::MFExplosion* explosion = explosions->Add();
|
||||||
|
explosion->set_item_id(meta->i->id());
|
||||||
|
bomb_pos.ToPB(explosion->mutable_pos());
|
||||||
|
explosion->set_player_id(player->entity_uniid);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void FrameEvent::AddSmoke(Bullet* bullet, int item_id, Vector2D pos)
|
||||||
|
{
|
||||||
|
#if 0
|
||||||
|
::google::protobuf::RepeatedPtrField<::cs::MFSmoke>* smokes = nullptr;
|
||||||
|
{
|
||||||
|
auto itr = room->frame_data.smokes_hash.find(room->frame_no);
|
||||||
|
if (itr == room->frame_data.smokes_hash.end()) {
|
||||||
|
room->frame_data.smokes_hash[room->frame_no] = ::google::protobuf::RepeatedPtrField<::cs::MFSmoke>();
|
||||||
|
itr = room->frame_data.smokes_hash.find(room->frame_no);
|
||||||
|
}
|
||||||
|
smokes = &itr->second;
|
||||||
|
}
|
||||||
|
|
||||||
|
cs::MFSmoke* smoke = smokes->Add();
|
||||||
|
smoke->set_item_id(meta->i->id());
|
||||||
|
bomb_pos.ToPB(smoke->mutable_pos());
|
||||||
|
smoke->set_player_id(player->entity_uniid);
|
||||||
|
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
@ -2,8 +2,19 @@
|
|||||||
|
|
||||||
#include "cs_proto.pb.h"
|
#include "cs_proto.pb.h"
|
||||||
|
|
||||||
struct RoomFrameData
|
class Bullet;
|
||||||
|
class Human;
|
||||||
|
struct FrameEvent
|
||||||
{
|
{
|
||||||
|
public:
|
||||||
|
void AddAirDrop(int appear_time, int box_id, Vector2D box_pos);
|
||||||
|
void AddEmote(Human* hum, int emote_id);
|
||||||
|
void AddShot(Human* hum);
|
||||||
|
void AddBullet();
|
||||||
|
void AddExplosion(Bullet* bullet, int item_id, Vector2D bomb_pos);
|
||||||
|
void AddSmoke(Bullet* bullet, int item_id, Vector2D pos);
|
||||||
|
|
||||||
|
private:
|
||||||
std::map<long long, std::set<unsigned short>> deleted_objects_hash;
|
std::map<long long, std::set<unsigned short>> deleted_objects_hash;
|
||||||
std::map<long long, std::set<unsigned short>> softdeleted_objects_hash;
|
std::map<long long, std::set<unsigned short>> softdeleted_objects_hash;
|
||||||
std::map<long long, ::google::protobuf::RepeatedPtrField<::cs::MFExplosion>> explosions_hash;
|
std::map<long long, ::google::protobuf::RepeatedPtrField<::cs::MFExplosion>> explosions_hash;
|
||||||
@ -13,7 +24,3 @@ struct RoomFrameData
|
|||||||
std::map<long long, ::google::protobuf::RepeatedPtrField<::cs::MFShot>> shots_hash;
|
std::map<long long, ::google::protobuf::RepeatedPtrField<::cs::MFShot>> shots_hash;
|
||||||
std::map<long long, ::google::protobuf::RepeatedPtrField<::cs::MFAirDrop>> airdrops_hash;
|
std::map<long long, ::google::protobuf::RepeatedPtrField<::cs::MFAirDrop>> airdrops_hash;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct HumanFrameData
|
|
||||||
{
|
|
||||||
};
|
|
||||||
|
@ -175,50 +175,12 @@ void Human::Shot(Vector2D& target_dir)
|
|||||||
#if 1
|
#if 1
|
||||||
float fly_distance = 5;
|
float fly_distance = 5;
|
||||||
#endif
|
#endif
|
||||||
{
|
room->frame_event.AddShot(this);
|
||||||
::google::protobuf::RepeatedPtrField<::cs::MFShot>* shots = nullptr;
|
|
||||||
{
|
|
||||||
{
|
|
||||||
auto itr = room->frame_data.shots_hash.find(room->frame_no);
|
|
||||||
if (itr == room->frame_data.shots_hash.end()) {
|
|
||||||
room->frame_data.shots_hash[room->frame_no] = ::google::protobuf::RepeatedPtrField<::cs::MFShot>();
|
|
||||||
itr = room->frame_data.shots_hash.find(room->frame_no);
|
|
||||||
}
|
|
||||||
shots = &itr->second;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
cs::MFShot* shot = shots->Add();
|
|
||||||
shot->set_player_id(entity_uniid);
|
|
||||||
curr_weapon->ToPB(shot->mutable_weapon());
|
|
||||||
shot->set_offhand(true);
|
|
||||||
shot->set_bullskin(10001);
|
|
||||||
}
|
|
||||||
for (auto& tuple : curr_weapon->meta->bullet_born_offset) {
|
for (auto& tuple : curr_weapon->meta->bullet_born_offset) {
|
||||||
Vector2D bullet_born_offset = Vector2D(std::get<0>(tuple), std::get<1>(tuple));
|
Vector2D bullet_born_offset = Vector2D(std::get<0>(tuple), std::get<1>(tuple));
|
||||||
bullet_born_offset.Rotate(attack_dir.CalcAngle(Vector2D::UP));
|
bullet_born_offset.Rotate(attack_dir.CalcAngle(Vector2D::UP));
|
||||||
Vector2D bullet_born_pos = pos + bullet_born_offset;
|
Vector2D bullet_born_pos = pos + bullet_born_offset;
|
||||||
::google::protobuf::RepeatedPtrField<::cs::MFBullet>* bullets = nullptr;
|
room->frame_event.AddBullet();
|
||||||
{
|
|
||||||
{
|
|
||||||
auto itr = room->frame_data.bullets_hash.find(room->frame_no);
|
|
||||||
if (itr == room->frame_data.bullets_hash.end()) {
|
|
||||||
room->frame_data.bullets_hash[room->frame_no] = ::google::protobuf::RepeatedPtrField<::cs::MFBullet>();
|
|
||||||
itr = room->frame_data.bullets_hash.find(room->frame_no);
|
|
||||||
}
|
|
||||||
bullets = &itr->second;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
{
|
|
||||||
cs::MFBullet* bullet = bullets->Add();
|
|
||||||
bullet->set_player_id(entity_uniid);
|
|
||||||
bullet->set_bullet_id(curr_weapon->meta->i->use_bullet());
|
|
||||||
bullet_born_pos.ToPB(bullet->mutable_pos());
|
|
||||||
attack_dir.ToPB(bullet->mutable_dir());
|
|
||||||
bullet->set_bulletskin(10001);
|
|
||||||
bullet->set_gun_id(curr_weapon->meta->i->id());
|
|
||||||
bullet->set_fly_distance(fly_distance);
|
|
||||||
}
|
|
||||||
room->CreateBullet(this, curr_weapon->meta, bullet_born_pos, attack_dir, fly_distance);
|
room->CreateBullet(this, curr_weapon->meta, bullet_born_pos, attack_dir, fly_distance);
|
||||||
}
|
}
|
||||||
--curr_weapon->ammo;
|
--curr_weapon->ammo;
|
||||||
|
@ -71,7 +71,6 @@ class Human : public Entity
|
|||||||
bool need_sync_teammate_data = false;
|
bool need_sync_teammate_data = false;
|
||||||
bool need_sync_active_player = false;
|
bool need_sync_active_player = false;
|
||||||
|
|
||||||
HumanFrameData frame_data;
|
|
||||||
PlayerStats stats;
|
PlayerStats stats;
|
||||||
|
|
||||||
bool send_gameover = false;
|
bool send_gameover = false;
|
||||||
|
@ -381,22 +381,7 @@ void Player::UpdateEmote()
|
|||||||
emote_id = 0;
|
emote_id = 0;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
::google::protobuf::RepeatedPtrField<::cs::MFEmote>* emotes = nullptr;
|
room->frame_event.AddEmote(this, emote_id);
|
||||||
{
|
|
||||||
auto itr = room->frame_data.emotes_hash.find(room->frame_no);
|
|
||||||
if (itr == room->frame_data.emotes_hash.end()) {
|
|
||||||
room->frame_data.emotes_hash[room->frame_no] = ::google::protobuf::RepeatedPtrField<::cs::MFEmote>();
|
|
||||||
itr = room->frame_data.emotes_hash.find(room->frame_no);
|
|
||||||
}
|
|
||||||
emotes = &itr->second;
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
cs::MFEmote* p = emotes->Add();
|
|
||||||
p->set_emote_id(emote_id);
|
|
||||||
p->set_player_id(entity_uniid);
|
|
||||||
}
|
|
||||||
|
|
||||||
emote = false;
|
emote = false;
|
||||||
emote_id = 0;
|
emote_id = 0;
|
||||||
}
|
}
|
||||||
@ -442,25 +427,7 @@ void Player::Shot()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
room->frame_event.AddShot(this);
|
||||||
::google::protobuf::RepeatedPtrField<::cs::MFShot>* shots = nullptr;
|
|
||||||
{
|
|
||||||
{
|
|
||||||
auto itr = room->frame_data.shots_hash.find(room->frame_no);
|
|
||||||
if (itr == room->frame_data.shots_hash.end()) {
|
|
||||||
room->frame_data.shots_hash[room->frame_no] = ::google::protobuf::RepeatedPtrField<::cs::MFShot>();
|
|
||||||
itr = room->frame_data.shots_hash.find(room->frame_no);
|
|
||||||
}
|
|
||||||
shots = &itr->second;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
cs::MFShot* shot = shots->Add();
|
|
||||||
shot->set_player_id(entity_uniid);
|
|
||||||
curr_weapon->ToPB(shot->mutable_weapon());
|
|
||||||
shot->set_offhand(true);
|
|
||||||
shot->set_bullskin(10001);
|
|
||||||
}
|
|
||||||
if (room->gas_data.gas_mode != GasInactive &&
|
if (room->gas_data.gas_mode != GasInactive &&
|
||||||
!a8::HasBitFlag(status, HS_Fly) &&
|
!a8::HasBitFlag(status, HS_Fly) &&
|
||||||
!a8::HasBitFlag(status, HS_Jump)
|
!a8::HasBitFlag(status, HS_Jump)
|
||||||
@ -469,27 +436,7 @@ void Player::Shot()
|
|||||||
Vector2D bullet_born_offset = Vector2D(std::get<0>(tuple), std::get<1>(tuple));
|
Vector2D bullet_born_offset = Vector2D(std::get<0>(tuple), std::get<1>(tuple));
|
||||||
bullet_born_offset.Rotate(attack_dir.CalcAngle(Vector2D::UP));
|
bullet_born_offset.Rotate(attack_dir.CalcAngle(Vector2D::UP));
|
||||||
Vector2D bullet_born_pos = pos + bullet_born_offset;
|
Vector2D bullet_born_pos = pos + bullet_born_offset;
|
||||||
::google::protobuf::RepeatedPtrField<::cs::MFBullet>* bullets = nullptr;
|
room->frame_event.AddBullet();
|
||||||
{
|
|
||||||
{
|
|
||||||
auto itr = room->frame_data.bullets_hash.find(room->frame_no);
|
|
||||||
if (itr == room->frame_data.bullets_hash.end()) {
|
|
||||||
room->frame_data.bullets_hash[room->frame_no] = ::google::protobuf::RepeatedPtrField<::cs::MFBullet>();
|
|
||||||
itr = room->frame_data.bullets_hash.find(room->frame_no);
|
|
||||||
}
|
|
||||||
bullets = &itr->second;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
{
|
|
||||||
cs::MFBullet* bullet = bullets->Add();
|
|
||||||
bullet->set_player_id(entity_uniid);
|
|
||||||
bullet->set_bullet_id(curr_weapon->meta->i->use_bullet());
|
|
||||||
bullet_born_pos.ToPB(bullet->mutable_pos());
|
|
||||||
attack_dir.ToPB(bullet->mutable_dir());
|
|
||||||
bullet->set_bulletskin(10001);
|
|
||||||
bullet->set_gun_id(curr_weapon->meta->i->id());
|
|
||||||
bullet->set_fly_distance(fly_distance);
|
|
||||||
}
|
|
||||||
room->CreateBullet(this, curr_weapon->meta, bullet_born_pos, attack_dir, fly_distance);
|
room->CreateBullet(this, curr_weapon->meta, bullet_born_pos, attack_dir, fly_distance);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1047,6 +994,7 @@ void Player::MakeUpdateMsg()
|
|||||||
update_msg->Clear();
|
update_msg->Clear();
|
||||||
{
|
{
|
||||||
update_msg->set_ack(last_seq_id);
|
update_msg->set_ack(last_seq_id);
|
||||||
|
#if 0
|
||||||
{
|
{
|
||||||
for (auto& pair : room->frame_data.deleted_objects_hash) {
|
for (auto& pair : room->frame_data.deleted_objects_hash) {
|
||||||
if (pair.first <= room->frame_no) {
|
if (pair.first <= room->frame_no) {
|
||||||
@ -1099,6 +1047,7 @@ void Player::MakeUpdateMsg()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
if (team_members) {
|
if (team_members) {
|
||||||
for (auto& itr : *team_members) {
|
for (auto& itr : *team_members) {
|
||||||
if (itr != this) {
|
if (itr != this) {
|
||||||
|
@ -109,6 +109,7 @@ void Room::Update(int delta_time)
|
|||||||
}
|
}
|
||||||
ClearDeletedObjects();
|
ClearDeletedObjects();
|
||||||
ProcAddedObjects();
|
ProcAddedObjects();
|
||||||
|
#if 0
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
std::vector<long long> del_ids;
|
std::vector<long long> del_ids;
|
||||||
@ -199,6 +200,7 @@ void Room::Update(int delta_time)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
++frame_no;
|
++frame_no;
|
||||||
elapsed_time_ -= 50;
|
elapsed_time_ -= 50;
|
||||||
@ -426,6 +428,7 @@ void Room::BuildingBoxBoundCollisionDetection(Entity* sender, std::vector<Entity
|
|||||||
|
|
||||||
void Room::AddDeletedObject(unsigned short obj_uniid, bool soft_delete)
|
void Room::AddDeletedObject(unsigned short obj_uniid, bool soft_delete)
|
||||||
{
|
{
|
||||||
|
#if 0
|
||||||
std::set<unsigned short>* deleted_objects = nullptr;
|
std::set<unsigned short>* deleted_objects = nullptr;
|
||||||
if (soft_delete) {
|
if (soft_delete) {
|
||||||
auto itr = frame_data.softdeleted_objects_hash.find(frame_no);
|
auto itr = frame_data.softdeleted_objects_hash.find(frame_no);
|
||||||
@ -443,6 +446,7 @@ void Room::AddDeletedObject(unsigned short obj_uniid, bool soft_delete)
|
|||||||
deleted_objects = &itr->second;
|
deleted_objects = &itr->second;
|
||||||
}
|
}
|
||||||
deleted_objects->insert(obj_uniid);
|
deleted_objects->insert(obj_uniid);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void Room::FillSMJoinedNotify(Player* self_hum, cs::SMJoinedNotify& msg)
|
void Room::FillSMJoinedNotify(Player* self_hum, cs::SMJoinedNotify& msg)
|
||||||
@ -698,6 +702,7 @@ int Room::NewTeam()
|
|||||||
|
|
||||||
void Room::ClearDeletedObjects()
|
void Room::ClearDeletedObjects()
|
||||||
{
|
{
|
||||||
|
#if 0
|
||||||
for (auto& pair : frame_data.deleted_objects_hash) {
|
for (auto& pair : frame_data.deleted_objects_hash) {
|
||||||
for (auto& obj_uniid : pair.second) {
|
for (auto& obj_uniid : pair.second) {
|
||||||
Entity* entity = GetEntityByUniId(obj_uniid);
|
Entity* entity = GetEntityByUniId(obj_uniid);
|
||||||
@ -731,6 +736,7 @@ void Room::ClearDeletedObjects()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void Room::TouchPlayerList(a8::XParams param,
|
void Room::TouchPlayerList(a8::XParams param,
|
||||||
@ -1103,22 +1109,7 @@ void Room::AirDrop(int appear_time, int box_id)
|
|||||||
});
|
});
|
||||||
#endif
|
#endif
|
||||||
Vector2D box_pos = gas_data.pos_new + dir * (500 + rand() % 300);
|
Vector2D box_pos = gas_data.pos_new + dir * (500 + rand() % 300);
|
||||||
::google::protobuf::RepeatedPtrField<::cs::MFAirDrop>* airdrops = nullptr;
|
frame_event.AddAirDrop(appear_time, box_id, box_pos);
|
||||||
{
|
|
||||||
{
|
|
||||||
auto itr = frame_data.airdrops_hash.find(frame_no);
|
|
||||||
if (itr == frame_data.airdrops_hash.end()) {
|
|
||||||
frame_data.airdrops_hash[frame_no] = ::google::protobuf::RepeatedPtrField<::cs::MFAirDrop>();
|
|
||||||
itr = frame_data.airdrops_hash.find(frame_no);
|
|
||||||
}
|
|
||||||
airdrops = &itr->second;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
cs::MFAirDrop* airdrop = airdrops->Add();
|
|
||||||
airdrop->set_appear_time(appear_time);
|
|
||||||
airdrop->set_box_id(box_id);
|
|
||||||
box_pos.ToPB(airdrop->mutable_pos());
|
|
||||||
|
|
||||||
xtimer.AddDeadLineTimerAndAttach(SERVER_FRAME_RATE * appear_time / 1000.f,
|
xtimer.AddDeadLineTimerAndAttach(SERVER_FRAME_RATE * appear_time / 1000.f,
|
||||||
a8::XParams()
|
a8::XParams()
|
||||||
.SetSender(this)
|
.SetSender(this)
|
||||||
|
@ -29,7 +29,7 @@ class Room
|
|||||||
public:
|
public:
|
||||||
long long room_uuid = 0;
|
long long room_uuid = 0;
|
||||||
MetaData::Map* map_meta = nullptr;
|
MetaData::Map* map_meta = nullptr;
|
||||||
RoomFrameData frame_data;
|
FrameEvent frame_event;
|
||||||
long long frame_no = 0;
|
long long frame_no = 0;
|
||||||
GasData gas_data;
|
GasData gas_data;
|
||||||
bool game_over = false;
|
bool game_over = false;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user