This commit is contained in:
aozhiwei 2022-10-10 14:22:39 +08:00
parent f168e1128c
commit f5dd02c341
5 changed files with 18 additions and 6 deletions

View File

@ -50,9 +50,11 @@ void Bullet::Initialize()
void Bullet::Update(int delta_time)
{
if (!trace_target_id) {
MapServiceUpdate();
++updated_times_;
if (shot_animi_time <= (room->GetFrameNo() - create_frameno_) * FRAME_RATE_MS) {
if (!trace_target_id) {
MapServiceUpdate();
++updated_times_;
}
}
}

View File

@ -36,6 +36,7 @@ class Bullet : public MoveableEntity
int strengthen_wall = 0;
int hand = 0;
std::weak_ptr<a8::XTimerPtr> keep_shot_animi_timer_ptr;
float shot_animi_time = 0.0f;
virtual ~Bullet() override;
virtual void Initialize() override;

View File

@ -43,6 +43,7 @@ struct BulletInfo
float track_change_time = 0;
int is_through = 0;
int hand = 0;
float shot_animi_time = 0;
std::weak_ptr<a8::XTimerPtr> keep_shot_animi_timer_ptr;
};
@ -94,7 +95,8 @@ static void InternalCreateBullet(BulletInfo& bullet_info)
bullet_info.weapon_uniid,
bullet_info.trace_target_uniid,
bullet_info.hand,
bullet_info.keep_shot_animi_timer_ptr);
bullet_info.keep_shot_animi_timer_ptr,
bullet_info.shot_animi_time);
#ifdef DEBUG1
if (bullet_info.c.Get()->IsPlayer()) {
bullet_info.c.Get()->SendDebugMsg(a8::Format("CreateBullet id:%d",
@ -325,6 +327,9 @@ void InternalShot(Creature* c,
}
bullet_dir.Rotate(bullet_angle / 180.0f);
int shot_animi_time = (shot_animi ? shot_animi->t : 0);
if (shot_animi_time > 0) {
shot_animi_time = std::max(100, shot_animi_time);
}
{
bool is_player = c->IsPlayer();
bool is_car = c->IsCar();
@ -382,6 +387,7 @@ void InternalShot(Creature* c,
bullet_info->invincible_buff_uniid = invincible_buff_uniid;
bullet_info->trace_target_uniid = trace_target_uniid;
bullet_info->keep_shot_animi_timer_ptr = keep_shot_animi_timer_ptr;
bullet_info->shot_animi_time = shot_animi_time;
if (skill_meta &&
(skill_meta->GetMagicId() == MAGIC_AXXF ||
skill_meta->GetMagicId() == MAGIC_HJHX)) {

View File

@ -599,7 +599,8 @@ int Room::CreateBullet(Creature* sender,
long long weapon_uniid,
int trace_target_id,
int hand,
std::weak_ptr<a8::XTimerPtr> keep_shot_animi_timer_ptr)
std::weak_ptr<a8::XTimerPtr> keep_shot_animi_timer_ptr,
float shot_animi_time)
{
int bullet_uniid = 0;
if (grid_service->CanAdd(pos.x, pos.y)) {
@ -621,6 +622,7 @@ int Room::CreateBullet(Creature* sender,
bullet->trace_target_id = trace_target_id;
bullet->hand = hand;
bullet->keep_shot_animi_timer_ptr = keep_shot_animi_timer_ptr;
bullet->shot_animi_time = shot_animi_time;
bullet->Initialize();
AddObjectLater(bullet);
bullet_uniid = bullet->GetUniId();

View File

@ -173,7 +173,8 @@ public:
long long weapon_uniid,
int trace_target_id,
int hand,
std::weak_ptr<a8::XTimerPtr> keep_shot_animi_timer_ptr);
std::weak_ptr<a8::XTimerPtr> keep_shot_animi_timer_ptr,
float shot_animi_time);
Car* CreateCar(Human* driver,
int car_uniid,
MetaData::Equip* meta,