1
This commit is contained in:
parent
0fae7e9da2
commit
7e7e3e9b2d
@ -50,7 +50,9 @@ class Car : public Creature
|
|||||||
virtual void SendDebugMsg(const std::string& debug_msg) override;
|
virtual void SendDebugMsg(const std::string& debug_msg) override;
|
||||||
virtual void SetAttackDir(const a8::Vec2& attack_dir) override;
|
virtual void SetAttackDir(const a8::Vec2& attack_dir) override;
|
||||||
virtual void DropItems(Obstacle* obstacle) override;
|
virtual void DropItems(Obstacle* obstacle) override;
|
||||||
|
virtual const a8::Vec2& GetShotDir() { return curr_shot_dir_; };
|
||||||
void OnKillTarget(Creature* target);
|
void OnKillTarget(Creature* target);
|
||||||
|
void SetShotDir(const a8::Vec2& dir) { curr_shot_dir_ = dir; };
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int AllocSeat();
|
int AllocSeat();
|
||||||
@ -69,5 +71,6 @@ class Car : public Creature
|
|||||||
int cur_buff_id_ = 0;
|
int cur_buff_id_ = 0;
|
||||||
int cur_buff_idx_ = -1;
|
int cur_buff_idx_ = -1;
|
||||||
float cur_oil_ = 0;
|
float cur_oil_ = 0;
|
||||||
|
a8::Vec2 curr_shot_dir_;
|
||||||
CircleCollider* self_collider_ = nullptr;
|
CircleCollider* self_collider_ = nullptr;
|
||||||
};
|
};
|
||||||
|
@ -328,7 +328,7 @@ void InternalShot(Creature* c,
|
|||||||
++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));
|
||||||
a8::Vec2 bullet_born_pos = c->GetPos() + c->shoot_offset + bullet_born_offset;
|
a8::Vec2 bullet_born_pos = c->GetPos() + c->shoot_offset + bullet_born_offset;
|
||||||
a8::Vec2 bullet_dir = c->GetAttackDir();
|
a8::Vec2 bullet_dir = c->GetShotDir();
|
||||||
float bullet_angle = std::get<2>(tuple);
|
float bullet_angle = std::get<2>(tuple);
|
||||||
if (weapon_meta->i->bullet_angle() >= 0.10f) {
|
if (weapon_meta->i->bullet_angle() >= 0.10f) {
|
||||||
int angle = (int)weapon_meta->i->bullet_angle() * 1000;
|
int angle = (int)weapon_meta->i->bullet_angle() * 1000;
|
||||||
@ -354,13 +354,6 @@ void InternalShot(Creature* c,
|
|||||||
auto transform = glm::rotate(hero_transform,
|
auto transform = glm::rotate(hero_transform,
|
||||||
bullet_born_angle * A8_PI,
|
bullet_born_angle * A8_PI,
|
||||||
glm::vec3(0.0, 1.0, 0.0));
|
glm::vec3(0.0, 1.0, 0.0));
|
||||||
#if 1
|
|
||||||
if (c->IsCar()) {
|
|
||||||
transform = glm::rotate(hero_transform,
|
|
||||||
0 * A8_PI,
|
|
||||||
glm::vec3(0.0, 1.0, 0.0));
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
glm::vec4 gun_muzzle_position(0.0, 0.0, 0.0, 0.0);
|
glm::vec4 gun_muzzle_position(0.0, 0.0, 0.0, 0.0);
|
||||||
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;
|
||||||
|
@ -28,6 +28,7 @@ class MoveableEntity : public RoomEntity
|
|||||||
virtual void SetMoveDir(const a8::Vec2& move_dir);
|
virtual void SetMoveDir(const a8::Vec2& move_dir);
|
||||||
virtual const a8::Vec2& GetAttackDir() { return attack_dir_; };
|
virtual const a8::Vec2& GetAttackDir() { return attack_dir_; };
|
||||||
virtual void SetAttackDir(const a8::Vec2& attack_dir);
|
virtual void SetAttackDir(const a8::Vec2& attack_dir);
|
||||||
|
virtual const a8::Vec2& GetShotDir() { return attack_dir_; };
|
||||||
int GetChgMoveDirTimes() { return chg_move_dir_times_; }
|
int GetChgMoveDirTimes() { return chg_move_dir_times_; }
|
||||||
int GetChgAttackDirTimes() { return chg_attack_dir_times_; }
|
int GetChgAttackDirTimes() { return chg_attack_dir_times_; }
|
||||||
float GetAttackDirRotate();
|
float GetAttackDirRotate();
|
||||||
|
@ -313,14 +313,16 @@ void Player::UpdateShot()
|
|||||||
GetCar()->shoot_offset = shoot_offset;
|
GetCar()->shoot_offset = shoot_offset;
|
||||||
GetCar()->shot_hole = GetSeat();
|
GetCar()->shot_hole = GetSeat();
|
||||||
GetCar()->shot_passenger = this;
|
GetCar()->shot_passenger = this;
|
||||||
GetCar()->SetAttackDir(GetAttackDir());
|
GetCar()->SetShotDir(GetAttackDir());
|
||||||
GetCar()->Shot(target_dir, shot_ok, fly_distance, 0);
|
GetCar()->Shot(target_dir, shot_ok, fly_distance, 0);
|
||||||
if (!moving && GetCar()->IsDriver(this)) {
|
if (!moving && GetCar()->IsDriver(this)) {
|
||||||
GetCar()->SetMoveDir(GetAttackDir());
|
GetCar()->SetMoveDir(GetAttackDir());
|
||||||
}
|
}
|
||||||
|
#if 0
|
||||||
if (!GetCar()->IsDriver(this)) {
|
if (!GetCar()->IsDriver(this)) {
|
||||||
GetCar()->SetAttackDir(old_car_attack_dir);
|
GetCar()->SetAttackDir(old_car_attack_dir);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
GetCar()->shot_hole = old_car_shot_hole;
|
GetCar()->shot_hole = old_car_shot_hole;
|
||||||
GetCar()->shoot_offset = old_car_shoot_offset;
|
GetCar()->shoot_offset = old_car_shoot_offset;
|
||||||
GetCar()->shot_passenger = old_car_shot_passenger;
|
GetCar()->shot_passenger = old_car_shot_passenger;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user