修正子弹位置
This commit is contained in:
parent
04616a0111
commit
4959573fa1
@ -30,6 +30,7 @@ class Car : public Creature
|
|||||||
virtual void GetAabbBox(AabbCollider& aabb_box) override;
|
virtual void GetAabbBox(AabbCollider& aabb_box) override;
|
||||||
virtual void GetHitAabbBox(AabbCollider& aabb_box) override;
|
virtual void GetHitAabbBox(AabbCollider& aabb_box) override;
|
||||||
virtual std::string GetName() override;
|
virtual std::string GetName() override;
|
||||||
|
virtual MetaData::Player* GetHeroMeta() override { return hero_meta_; };
|
||||||
|
|
||||||
bool IsDriver(Human* hum) { return driver_ == hum && driver_; }
|
bool IsDriver(Human* hum) { return driver_ == hum && driver_; }
|
||||||
Human* GetPassengerBySeat(int seat);
|
Human* GetPassengerBySeat(int seat);
|
||||||
|
@ -193,10 +193,13 @@ void InternalShot(Creature* c,
|
|||||||
c->room->xtimer.ModifyTimer(buff->remover_timer, weapon_meta->i->cast_time() / FRAME_RATE_MS);
|
c->room->xtimer.ModifyTimer(buff->remover_timer, weapon_meta->i->cast_time() / FRAME_RATE_MS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
int i = 0;
|
||||||
|
int num = weapon_meta->bullet_born_offset.size();
|
||||||
for (auto& tuple : weapon_meta->bullet_born_offset) {
|
for (auto& tuple : weapon_meta->bullet_born_offset) {
|
||||||
|
++i;
|
||||||
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));
|
||||||
float bullet_born_angle = c->GetAttackDir().CalcAngleEx(a8::Vec2::UP);
|
float bullet_born_angle = c->GetAttackDir().CalcAngleEx(a8::Vec2::UP);
|
||||||
if (c->GetAttackDir().x > 0.00001f) {
|
if (c->GetAttackDir().x < 0.00001f) {
|
||||||
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);
|
||||||
@ -216,8 +219,34 @@ void InternalShot(Creature* c,
|
|||||||
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));
|
||||||
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);
|
||||||
|
if (weapon_meta->i->shootfire()) {
|
||||||
|
MetaData::Player* hero_meta = c->GetHeroMeta();
|
||||||
|
if (hero_meta) {
|
||||||
|
auto itr = hero_meta->shot_animations.find(weapon_meta->i->shootfire());
|
||||||
|
if (itr != hero_meta->shot_animations.end()) {
|
||||||
|
if (weapon_meta->i->shootfire() == DOUBLE_GUN_ANIMATION &&
|
||||||
|
i > (int)(num / 2)) {
|
||||||
|
gun_muzzle_position +=
|
||||||
|
glm::vec4(
|
||||||
|
itr->second.l_x,
|
||||||
|
itr->second.l_y,
|
||||||
|
itr->second.l_z,
|
||||||
|
0
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
gun_muzzle_position +=
|
||||||
|
glm::vec4(
|
||||||
|
itr->second.r_x,
|
||||||
|
itr->second.r_y,
|
||||||
|
itr->second.r_z,
|
||||||
|
0
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
if (weapon_meta->gun_muzzle_position) {
|
if (weapon_meta->gun_muzzle_position) {
|
||||||
gun_muzzle_position =
|
gun_muzzle_position +=
|
||||||
glm::vec4(
|
glm::vec4(
|
||||||
std::get<0>(*weapon_meta->gun_muzzle_position.get()),
|
std::get<0>(*weapon_meta->gun_muzzle_position.get()),
|
||||||
std::get<1>(*weapon_meta->gun_muzzle_position.get()),
|
std::get<1>(*weapon_meta->gun_muzzle_position.get()),
|
||||||
|
@ -120,6 +120,7 @@ class Creature : public MoveableEntity
|
|||||||
virtual bool ReceiveExplosionDmg(Explosion* explosion) override;
|
virtual bool ReceiveExplosionDmg(Explosion* explosion) override;
|
||||||
virtual bool IsCreature(Room* room) override { return true;};
|
virtual bool IsCreature(Room* room) override { return true;};
|
||||||
virtual void OnBattleStart(Room* room) override;
|
virtual void OnBattleStart(Room* room) override;
|
||||||
|
virtual MetaData::Player* GetHeroMeta() { return nullptr; };
|
||||||
bool HasBuffEffect(int buff_effect_id);
|
bool HasBuffEffect(int buff_effect_id);
|
||||||
Buff* GetBuffByEffectId(int effect_id);
|
Buff* GetBuffByEffectId(int effect_id);
|
||||||
Buff* GetBuffById(int buff_id);
|
Buff* GetBuffById(int buff_id);
|
||||||
|
@ -32,7 +32,7 @@ public:
|
|||||||
virtual void DecHP(float dec_hp, int killer_id, const std::string& killer_name, int weapon_id) override;
|
virtual void DecHP(float dec_hp, int killer_id, const std::string& killer_name, int weapon_id) override;
|
||||||
virtual std::string GetName() override;
|
virtual std::string GetName() override;
|
||||||
virtual void DropItems(Obstacle* obstacle) override;
|
virtual void DropItems(Obstacle* obstacle) override;
|
||||||
|
virtual MetaData::Player* GetHeroMeta() override { return meta; };
|
||||||
virtual float GetSpeed() override;
|
virtual float GetSpeed() override;
|
||||||
virtual float GetRadius() override;
|
virtual float GetRadius() override;
|
||||||
virtual float GetHitRadius() override;
|
virtual float GetHitRadius() override;
|
||||||
|
@ -262,6 +262,7 @@ class Human : public Creature
|
|||||||
virtual void RemoveObjects(Entity* entity) override;
|
virtual void RemoveObjects(Entity* entity) override;
|
||||||
virtual void AddOutObjects(Entity* entity) override;
|
virtual void AddOutObjects(Entity* entity) override;
|
||||||
virtual void RemoveOutObjects(Entity* entity) override;
|
virtual void RemoveOutObjects(Entity* entity) override;
|
||||||
|
virtual MetaData::Player* GetHeroMeta() override { return meta; };
|
||||||
bool HasLiveTeammate();
|
bool HasLiveTeammate();
|
||||||
bool HasNoDownedTeammate();
|
bool HasNoDownedTeammate();
|
||||||
int GetNearbyTeammateNum(float range);
|
int GetNearbyTeammateNum(float range);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user