From 4ec3bcc3eedd63cfae0c8c344b0ba034911be11a Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Thu, 29 Sep 2022 19:51:41 +0800 Subject: [PATCH] 1 --- server/gameserver/creature.cc | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/server/gameserver/creature.cc b/server/gameserver/creature.cc index d91e466e..c6480e7f 100644 --- a/server/gameserver/creature.cc +++ b/server/gameserver/creature.cc @@ -315,6 +315,7 @@ void InternalShot(Creature* c, } } bullet_dir.Rotate(bullet_angle / 180.0f); + int shot_animi_time = (shot_animi ? shot_animi->t : 0); { bool is_player = c->IsPlayer(); bool is_car = c->IsCar(); @@ -335,7 +336,7 @@ void InternalShot(Creature* c, bullet_born_pos = c->GetPos() + bullet_born_offset; if (c->IsPlayer() || c->IsCar()) { #ifdef DEBUG - a8::XPrintf("idx:%d offset:%f,%f angle:%f old_angle:%f angle_xy:%f,%f %f %f gun_muzzle_position:%f,%f,%f pos:%f,%f gun_id:%d\n", + a8::XPrintf("idx:%d offset:%f,%f angle:%f old_angle:%f angle_xy:%f,%f %f %f gun_muzzle_position:%f,%f,%f pos:%f,%f gun_id:%d t:%d\n", { bulletIdx, bullet_born_offset.x, @@ -351,7 +352,8 @@ void InternalShot(Creature* c, gun_muzzle_position.z, bullet_born_pos.x, bullet_born_pos.y, - weapon_meta->i->id() + weapon_meta->i->id(), + shot_animi_time }); #endif } @@ -384,7 +386,11 @@ void InternalShot(Creature* c, a8::XPrintf("bullet trace_target_uniid:%d\n", {bullet_info->trace_target_uniid}); } #endif - int shot_animi_time = (shot_animi ? shot_animi->t : 0); + #if 1 + InternalCreateBullet(*bullet_info); + delete bullet_info; + bullet_info = nullptr; + #else c->room->xtimer.AddDeadLineTimerAndAttach ( shot_animi_time / FRAME_RATE_MS, @@ -402,6 +408,7 @@ void InternalShot(Creature* c, delete bullet_info; } ); + #endif } } {