This commit is contained in:
aozhiwei 2022-09-29 19:51:41 +08:00
parent df86d6410b
commit 4ec3bcc3ee

View File

@ -315,6 +315,7 @@ void InternalShot(Creature* c,
} }
} }
bullet_dir.Rotate(bullet_angle / 180.0f); bullet_dir.Rotate(bullet_angle / 180.0f);
int shot_animi_time = (shot_animi ? shot_animi->t : 0);
{ {
bool is_player = c->IsPlayer(); bool is_player = c->IsPlayer();
bool is_car = c->IsCar(); bool is_car = c->IsCar();
@ -335,7 +336,7 @@ void InternalShot(Creature* c,
bullet_born_pos = c->GetPos() + bullet_born_offset; bullet_born_pos = c->GetPos() + bullet_born_offset;
if (c->IsPlayer() || c->IsCar()) { if (c->IsPlayer() || c->IsCar()) {
#ifdef DEBUG #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, bulletIdx,
bullet_born_offset.x, bullet_born_offset.x,
@ -351,7 +352,8 @@ void InternalShot(Creature* c,
gun_muzzle_position.z, gun_muzzle_position.z,
bullet_born_pos.x, bullet_born_pos.x,
bullet_born_pos.y, bullet_born_pos.y,
weapon_meta->i->id() weapon_meta->i->id(),
shot_animi_time
}); });
#endif #endif
} }
@ -384,7 +386,11 @@ void InternalShot(Creature* c,
a8::XPrintf("bullet trace_target_uniid:%d\n", {bullet_info->trace_target_uniid}); a8::XPrintf("bullet trace_target_uniid:%d\n", {bullet_info->trace_target_uniid});
} }
#endif #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 c->room->xtimer.AddDeadLineTimerAndAttach
( (
shot_animi_time / FRAME_RATE_MS, shot_animi_time / FRAME_RATE_MS,
@ -402,6 +408,7 @@ void InternalShot(Creature* c,
delete bullet_info; delete bullet_info;
} }
); );
#endif
} }
} }
{ {