修复c4问题-ok
This commit is contained in:
parent
8bf5a2e025
commit
68119fdc01
@ -60,12 +60,7 @@ void InternalShot(Creature* c,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
bullet_dir.Rotate(bullet_angle / 180.0f);
|
bullet_dir.Rotate(bullet_angle / 180.0f);
|
||||||
c->room->frame_event.AddBullet(c->GetWeakPtrRef(),
|
int bullet_uniid = 0;
|
||||||
weapon_meta,
|
|
||||||
weapon_lv,
|
|
||||||
bullet_born_pos,
|
|
||||||
bullet_dir,
|
|
||||||
fly_distance);
|
|
||||||
if (c->room->BattleStarted() ||
|
if (c->room->BattleStarted() ||
|
||||||
(c->room->GetGasData().gas_mode == GasJump &&
|
(c->room->GetGasData().gas_mode == GasJump &&
|
||||||
!c->HasBuffEffect(kBET_Jump))) {
|
!c->HasBuffEffect(kBET_Jump))) {
|
||||||
@ -79,6 +74,16 @@ void InternalShot(Creature* c,
|
|||||||
fly_distance,
|
fly_distance,
|
||||||
is_tank_skin);
|
is_tank_skin);
|
||||||
}
|
}
|
||||||
|
if (bullet_uniid == 0) {
|
||||||
|
bullet_uniid = c->room->AllocUniid();
|
||||||
|
}
|
||||||
|
c->room->frame_event.AddBullet(bullet_uniid,
|
||||||
|
c->GetWeakPtrRef(),
|
||||||
|
weapon_meta,
|
||||||
|
weapon_lv,
|
||||||
|
bullet_born_pos,
|
||||||
|
bullet_dir,
|
||||||
|
fly_distance);
|
||||||
}
|
}
|
||||||
c->GetTrigger()->Shot(weapon_meta);
|
c->GetTrigger()->Shot(weapon_meta);
|
||||||
if (weapon_meta->i->recoil_force() > 0.000001) {
|
if (weapon_meta->i->recoil_force() > 0.000001) {
|
||||||
|
@ -75,7 +75,8 @@ void FrameEvent::AddShot(CreatureWeakPtr& sender)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void FrameEvent::AddBullet(CreatureWeakPtr& sender,
|
void FrameEvent::AddBullet(int bullet_uniid,
|
||||||
|
CreatureWeakPtr& sender,
|
||||||
MetaData::Equip* weapon_meta,
|
MetaData::Equip* weapon_meta,
|
||||||
int weapon_lv,
|
int weapon_lv,
|
||||||
a8::Vec2 born_pos,
|
a8::Vec2 born_pos,
|
||||||
@ -88,6 +89,7 @@ void FrameEvent::AddBullet(CreatureWeakPtr& sender,
|
|||||||
auto& p = std::get<1>(tuple);
|
auto& p = std::get<1>(tuple);
|
||||||
|
|
||||||
p.set_player_id(sender.Get()->GetUniId());
|
p.set_player_id(sender.Get()->GetUniId());
|
||||||
|
p.set_bullet_uniid(bullet_uniid);
|
||||||
p.set_bullet_id(weapon_meta->i->use_bullet());
|
p.set_bullet_id(weapon_meta->i->use_bullet());
|
||||||
TypeConvert::ToPb(born_pos, p.mutable_pos());
|
TypeConvert::ToPb(born_pos, p.mutable_pos());
|
||||||
TypeConvert::ToPb(dir, p.mutable_dir());
|
TypeConvert::ToPb(dir, p.mutable_dir());
|
||||||
@ -109,6 +111,20 @@ void FrameEvent::AddBullet(CreatureWeakPtr& sender,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void FrameEvent::RemoveBullet(Bullet* bullet)
|
||||||
|
{
|
||||||
|
if (bullet->sender.Get()) {
|
||||||
|
del_bullets_.push_back(bullet->GetUniId());
|
||||||
|
int bullet_idx = del_bullets_.size() - 1;
|
||||||
|
bullet->sender.Get()->TraverseAllLayerHumanList
|
||||||
|
(
|
||||||
|
[bullet_idx] (Human* hum, bool& stop)
|
||||||
|
{
|
||||||
|
hum->del_bullets_.push_back(bullet_idx);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void FrameEvent::AddExplosion(Bullet* bullet, int item_id, a8::Vec2 bomb_pos)
|
void FrameEvent::AddExplosion(Bullet* bullet, int item_id, a8::Vec2 bomb_pos)
|
||||||
{
|
{
|
||||||
AddExplosionEx(bullet->sender, item_id, bomb_pos, 0);
|
AddExplosionEx(bullet->sender, item_id, bomb_pos, 0);
|
||||||
@ -484,4 +500,7 @@ void FrameEvent::Clear()
|
|||||||
if (!chged_props_.empty()) {
|
if (!chged_props_.empty()) {
|
||||||
chged_props_.clear();
|
chged_props_.clear();
|
||||||
}
|
}
|
||||||
|
if (!del_bullets_.empty()) {
|
||||||
|
del_bullets_.clear();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -17,12 +17,14 @@ public:
|
|||||||
void AddAirRaid(int appear_time, const a8::Vec2& raid_pos, float raid_rad);
|
void AddAirRaid(int appear_time, const a8::Vec2& raid_pos, float raid_rad);
|
||||||
void AddEmote(CreatureWeakPtr& sender, int emote_id);
|
void AddEmote(CreatureWeakPtr& sender, int emote_id);
|
||||||
void AddShot(CreatureWeakPtr& sender);
|
void AddShot(CreatureWeakPtr& sender);
|
||||||
void AddBullet(CreatureWeakPtr& sender,
|
void AddBullet(int bullet_uniid,
|
||||||
|
CreatureWeakPtr& sender,
|
||||||
MetaData::Equip* weapon_meta,
|
MetaData::Equip* weapon_meta,
|
||||||
int weapon_lv,
|
int weapon_lv,
|
||||||
a8::Vec2 born_pos,
|
a8::Vec2 born_pos,
|
||||||
a8::Vec2 dir,
|
a8::Vec2 dir,
|
||||||
float fly_distance);
|
float fly_distance);
|
||||||
|
void RemoveBullet(Bullet* bullet);
|
||||||
void AddExplosion(Bullet* bullet, int item_id, a8::Vec2 bomb_pos);
|
void AddExplosion(Bullet* bullet, int item_id, a8::Vec2 bomb_pos);
|
||||||
void AddSmoke(Bullet* bullet, int item_id, a8::Vec2 pos);
|
void AddSmoke(Bullet* bullet, int item_id, a8::Vec2 pos);
|
||||||
void AddPlaySkill(CreatureWeakPtr& sender, int skill_id);
|
void AddPlaySkill(CreatureWeakPtr& sender, int skill_id);
|
||||||
@ -62,6 +64,7 @@ private:
|
|||||||
std::vector<CreatureWeakPtr> chged_cars_;
|
std::vector<CreatureWeakPtr> chged_cars_;
|
||||||
std::vector<std::tuple<int, int, int>> dead_alive_objs_;
|
std::vector<std::tuple<int, int, int>> dead_alive_objs_;
|
||||||
std::vector<std::tuple<CreatureWeakPtr, ::cs::MFPropertyChg>> chged_props_;
|
std::vector<std::tuple<CreatureWeakPtr, ::cs::MFPropertyChg>> chged_props_;
|
||||||
|
std::vector<int> del_bullets_;
|
||||||
|
|
||||||
friend class FrameMaker;
|
friend class FrameMaker;
|
||||||
};
|
};
|
||||||
|
@ -114,6 +114,12 @@ cs::SMUpdate* FrameMaker::MakeUpdateMsg(Human* hum)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
for (size_t idx : hum->del_bullets_) {
|
||||||
|
if (idx < room->frame_event.del_bullets_.size()) {
|
||||||
|
int bullet_uniid = room->frame_event.del_bullets_[idx];
|
||||||
|
msg->add_del_objids(bullet_uniid);
|
||||||
|
}
|
||||||
|
}
|
||||||
for (size_t idx : hum->explosions_) {
|
for (size_t idx : hum->explosions_) {
|
||||||
if (idx < room->frame_event.explosions_.size()) {
|
if (idx < room->frame_event.explosions_.size()) {
|
||||||
auto& tuple = room->frame_event.explosions_[idx];
|
auto& tuple = room->frame_event.explosions_[idx];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user