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