修复子弹越界问题
This commit is contained in:
parent
657ff53618
commit
d08fc79ffa
@ -161,6 +161,14 @@ void Human::Shot(Vector2D& target_dir)
|
|||||||
#if 1
|
#if 1
|
||||||
float fly_distance = 5;
|
float fly_distance = 5;
|
||||||
#endif
|
#endif
|
||||||
|
for (auto& tuple : curr_weapon->meta->bullet_born_offset) {
|
||||||
|
Vector2D bullet_born_offset = Vector2D(std::get<0>(tuple), std::get<1>(tuple));
|
||||||
|
bullet_born_offset.Rotate(attack_dir.CalcAngle(Vector2D::UP));
|
||||||
|
Vector2D bullet_born_pos = pos + bullet_born_offset;
|
||||||
|
if (room->OverBorder(bullet_born_pos, 0)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
room->frame_event.AddShot(this);
|
room->frame_event.AddShot(this);
|
||||||
for (auto& tuple : curr_weapon->meta->bullet_born_offset) {
|
for (auto& tuple : curr_weapon->meta->bullet_born_offset) {
|
||||||
Vector2D bullet_born_offset = Vector2D(std::get<0>(tuple), std::get<1>(tuple));
|
Vector2D bullet_born_offset = Vector2D(std::get<0>(tuple), std::get<1>(tuple));
|
||||||
|
@ -438,11 +438,19 @@ void Player::Shot()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
room->frame_event.AddShot(this);
|
|
||||||
if (room->gas_data.gas_mode != GasInactive &&
|
if (room->gas_data.gas_mode != GasInactive &&
|
||||||
!a8::HasBitFlag(status, HS_Fly) &&
|
!a8::HasBitFlag(status, HS_Fly) &&
|
||||||
!a8::HasBitFlag(status, HS_Jump)
|
!a8::HasBitFlag(status, HS_Jump)
|
||||||
) {
|
) {
|
||||||
|
for (auto& tuple : curr_weapon->meta->bullet_born_offset) {
|
||||||
|
Vector2D bullet_born_offset = Vector2D(std::get<0>(tuple), std::get<1>(tuple));
|
||||||
|
bullet_born_offset.Rotate(attack_dir.CalcAngle(Vector2D::UP));
|
||||||
|
Vector2D bullet_born_pos = pos + bullet_born_offset;
|
||||||
|
if (room->OverBorder(bullet_born_pos, 0)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
room->frame_event.AddShot(this);
|
||||||
for (auto& tuple : curr_weapon->meta->bullet_born_offset) {
|
for (auto& tuple : curr_weapon->meta->bullet_born_offset) {
|
||||||
Vector2D bullet_born_offset = Vector2D(std::get<0>(tuple), std::get<1>(tuple));
|
Vector2D bullet_born_offset = Vector2D(std::get<0>(tuple), std::get<1>(tuple));
|
||||||
bullet_born_offset.Rotate(attack_dir.CalcAngle(Vector2D::UP));
|
bullet_born_offset.Rotate(attack_dir.CalcAngle(Vector2D::UP));
|
||||||
@ -456,6 +464,8 @@ void Player::Shot()
|
|||||||
room->frame_event.AddBullet(this, bullet_born_pos, bullet_dir, fly_distance);
|
room->frame_event.AddBullet(this, bullet_born_pos, bullet_dir, fly_distance);
|
||||||
room->CreateBullet(this, curr_weapon->meta, bullet_born_pos, bullet_dir, fly_distance);
|
room->CreateBullet(this, curr_weapon->meta, bullet_born_pos, bullet_dir, fly_distance);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
if (curr_weapon->weapon_idx != 0) {
|
if (curr_weapon->weapon_idx != 0) {
|
||||||
--curr_weapon->ammo;
|
--curr_weapon->ammo;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user