This commit is contained in:
aozhiwei 2022-12-19 15:14:33 +08:00
parent ce3e4e1a73
commit e710a4eb7b

View File

@ -152,12 +152,8 @@ static void InternalCreateBullet(BulletInfo& bullet_info)
if (bullet_info.recoil_force > 0) { if (bullet_info.recoil_force > 0) {
if (c->GetCurrWeapon()->ammo <= 0) { if (c->GetCurrWeapon()->ammo <= 0) {
c->DoRecoilForce(bullet_info.recoil_force); c->DoRecoilForce(bullet_info.recoil_force);
#if 1 bullet_info.bullet_born_pos.FromVec2(bullet_info.bullet_born_pos.ToVec2() -
bullet_info.bullet_born_pos = bullet_info.bullet_born_pos; (bullet_info.bullet_dir * bullet_info.recoil_force));
#else
bullet_info.bullet_born_pos = bullet_info.bullet_born_pos -
(bullet_info.bullet_dir * bullet_info.recoil_force);
#endif
} }
} }
if (c->IsCar() && c->AsCar()->IsSingle()) { if (c->IsCar() && c->AsCar()->IsSingle()) {
@ -183,12 +179,7 @@ static void InternalCreateBullet(BulletInfo& bullet_info)
bullet_info.bullet_num); bullet_info.bullet_num);
glm::vec4 v = transform * gun_muzzle_position; glm::vec4 v = transform * gun_muzzle_position;
bullet_born_offset = a8::Vec2(v.z *10*1, v.x*10*-1); bullet_born_offset = a8::Vec2(v.z *10*1, v.x*10*-1);
// 999 bullet_info.bullet_born_pos.FromVec2(c->GetPos().ToVec2() + bullet_born_offset);
#if 1
bullet_info.bullet_born_pos = c->GetPos();
#else
bullet_info.bullet_born_pos = c->GetPos() + bullet_born_offset;
#endif
bullet_info.bullet_dir = c->GetShotDir(); bullet_info.bullet_dir = c->GetShotDir();
} }
int bullet_uniid = 0; int bullet_uniid = 0;
@ -300,11 +291,7 @@ static void ProcMissile(Creature* c,
context->old_context_pos = c->context_pos; context->old_context_pos = c->context_pos;
c->context_dir = c->GetAttackDir(); c->context_dir = c->GetAttackDir();
// 999 c->context_pos.FromVec2(c->GetPos().ToVec2() + c->GetAttackDir() * fly_distance);
#if 1
#else
c->context_pos = c->GetPos() + c->GetAttackDir() * fly_distance;
#endif
}; };
handle->post_add_cb = handle->post_add_cb =
[context] (Creature* c, int buff_uniid) [context] (Creature* c, int buff_uniid)
@ -340,12 +327,8 @@ void InternalShot(Creature* c,
bullet_born_angle = -bullet_born_angle; bullet_born_angle = -bullet_born_angle;
} }
bullet_born_offset.Rotate(bullet_born_angle); bullet_born_offset.Rotate(bullet_born_angle);
// 999 Position bullet_born_pos;
#if 1 bullet_born_pos.FromVec2(c->GetPos().ToVec2() + bullet_born_offset);
Position bullet_born_pos = c->GetPos();
#else
a8::Vec2 bullet_born_pos = c->GetPos() + bullet_born_offset;
#endif
if (c->room->OverBorder(bullet_born_pos, 0.0f)) { if (c->room->OverBorder(bullet_born_pos, 0.0f)) {
return; return;
} }
@ -396,11 +379,7 @@ void InternalShot(Creature* c,
for (auto& tuple : weapon_meta->bullet_born_offset) { for (auto& tuple : weapon_meta->bullet_born_offset) {
++bulletIdx; ++bulletIdx;
a8::Vec2 bullet_born_offset = a8::Vec2(std::get<0>(tuple), std::get<1>(tuple)); a8::Vec2 bullet_born_offset = a8::Vec2(std::get<0>(tuple), std::get<1>(tuple));
#if 1 a8::Vec2 bullet_born_pos = c->GetPos().ToVec2() + c->shoot_offset + bullet_born_offset;
Position bullet_born_pos = c->GetPos();
#else
a8::Vec2 bullet_born_pos = c->GetPos() + c->shoot_offset + bullet_born_offset;
#endif
a8::Vec2 bullet_dir = c->GetShotDir(); a8::Vec2 bullet_dir = c->GetShotDir();
float bullet_angle = std::get<2>(tuple); float bullet_angle = std::get<2>(tuple);
if (weapon_meta->pb->bullet_angle() >= 0.10f) { if (weapon_meta->pb->bullet_angle() >= 0.10f) {
@ -431,11 +410,7 @@ void InternalShot(Creature* c,
CalcGunMuzzlePosition(c, weapon_meta, shot_animi, gun_muzzle_position, bulletIdx, bulletNum); CalcGunMuzzlePosition(c, weapon_meta, shot_animi, gun_muzzle_position, bulletIdx, bulletNum);
glm::vec4 v = transform * gun_muzzle_position; glm::vec4 v = transform * gun_muzzle_position;
bullet_born_offset = a8::Vec2(v.z *10*1, v.x*10*-1); bullet_born_offset = a8::Vec2(v.z *10*1, v.x*10*-1);
// 999 bullet_born_pos = c->GetPos().ToVec2() + bullet_born_offset;
#if 1
#else
bullet_born_pos = c->GetPos() + bullet_born_offset;
#endif
if (c->IsPlayer() || c->IsCar()) { if (c->IsPlayer() || c->IsCar()) {
#ifdef DEBUG1 #ifdef DEBUG1
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", 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",
@ -467,7 +442,7 @@ void InternalShot(Creature* c,
bullet_info.weapon_meta = weapon_meta; bullet_info.weapon_meta = weapon_meta;
bullet_info.skill_meta = skill_meta; bullet_info.skill_meta = skill_meta;
bullet_info.bullet_meta = bullet_meta; bullet_info.bullet_meta = bullet_meta;
bullet_info.bullet_born_pos = bullet_born_pos; bullet_info.bullet_born_pos.FromVec2(bullet_born_pos);
bullet_info.bullet_dir = bullet_dir; bullet_info.bullet_dir = bullet_dir;
bullet_info.fly_distance = fly_distance; bullet_info.fly_distance = fly_distance;
bullet_info.delay_time = std::get<3>(tuple); bullet_info.delay_time = std::get<3>(tuple);
@ -501,11 +476,9 @@ void InternalShot(Creature* c,
} }
} }
c->GetTrigger()->Shot(weapon_meta); c->GetTrigger()->Shot(weapon_meta);
#if 0
if (weapon_meta->pb->recoil_force() > 0.000001) { if (weapon_meta->pb->recoil_force() > 0.000001) {
c->DoRecoilForce(weapon_meta->pb->recoil_force()); c->DoRecoilForce(weapon_meta->pb->recoil_force());
} }
#endif
if (c->HasBuffEffect(kBET_Hide)) { if (c->HasBuffEffect(kBET_Hide)) {
c->RemoveBuffByEffectId(kBET_Hide); c->RemoveBuffByEffectId(kBET_Hide);
} }