1
This commit is contained in:
commit
5322bdd4bc
@ -409,7 +409,7 @@ void Buff::ProcSprint()
|
||||
#endif
|
||||
}
|
||||
Player* hum = (Player*)caster_.Get();
|
||||
std::set<int>* hited_objects = new std::set<int>;
|
||||
std::map<int, long long>* hited_objects = new std::map<int, long long>;
|
||||
a8::Vec2* pre_pos = new a8::Vec2;
|
||||
*pre_pos = owner->GetPos();
|
||||
owner->room->xtimer.AddRepeatTimerAndAttach
|
||||
@ -424,7 +424,8 @@ void Buff::ProcSprint()
|
||||
Buff* buff = (Buff*)param.sender.GetUserData();
|
||||
if (!buff->meta->param3_int_list.empty()) {
|
||||
a8::Vec2* pre_pos = (a8::Vec2*)param.param2.GetUserData();
|
||||
std::set<int>* hited_objects = (std::set<int>*)param.param1.GetUserData();
|
||||
std::map<int, long long>* hited_objects = (std::map<int, long long>*)
|
||||
param.param1.GetUserData();
|
||||
std::set<Creature*> enemys;
|
||||
a8::Vec2 old_pos = buff->owner->GetPos();
|
||||
|
||||
@ -439,12 +440,17 @@ void Buff::ProcSprint()
|
||||
if (enemy->IsEntityType(ET_Car)) {
|
||||
continue;
|
||||
}
|
||||
if (hited_objects->find(enemy->GetUniId()) == hited_objects->end()) {
|
||||
hited_objects->insert(enemy->GetUniId());
|
||||
for (int buff_id : buff->meta->param3_int_list) {
|
||||
enemy->TryAddBuff(buff->owner, buff_id);
|
||||
auto itr = hited_objects->find(enemy->GetUniId());
|
||||
if (itr != hited_objects->end()) {
|
||||
if ((buff->owner->room->GetFrameNo() - itr->second) * FRAME_RATE_MS <
|
||||
buff->meta->int_param5) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
(*hited_objects)[enemy->GetUniId()] = buff->owner->room->GetFrameNo();
|
||||
for (int buff_id : buff->meta->param3_int_list) {
|
||||
enemy->TryAddBuff(buff->owner, buff_id);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -456,7 +462,8 @@ void Buff::ProcSprint()
|
||||
&xtimer_attacher.timer_list_,
|
||||
[] (const a8::XParams& param)
|
||||
{
|
||||
std::set<int>* hited_objects = (std::set<int>*)param.param1.GetUserData();
|
||||
std::map<int, long long>* hited_objects = (std::map<int, long long>*)
|
||||
param.param1.GetUserData();
|
||||
a8::Vec2* pre_pos = (a8::Vec2*)param.param2.GetUserData();
|
||||
delete pre_pos;
|
||||
delete hited_objects;
|
||||
|
@ -30,6 +30,7 @@ class Car : public Creature
|
||||
virtual void GetAabbBox(AabbCollider& aabb_box) override;
|
||||
virtual void GetHitAabbBox(AabbCollider& aabb_box) override;
|
||||
virtual std::string GetName() override;
|
||||
virtual MetaData::Player* GetHeroMeta() override { return hero_meta_; };
|
||||
|
||||
bool IsDriver(Human* hum) { return driver_ == hum && driver_; }
|
||||
Human* GetPassengerBySeat(int seat);
|
||||
|
@ -551,3 +551,5 @@ const int MAP_BLOCK_START_ID = 1000000000;
|
||||
const int ANDROID_AI_ID_START = 10001;
|
||||
|
||||
const int MAX_SKILL_LV = 15;
|
||||
|
||||
const int DOUBLE_GUN_ANIMATION = 4;
|
||||
|
@ -193,10 +193,13 @@ void InternalShot(Creature* c,
|
||||
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) {
|
||||
++i;
|
||||
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);
|
||||
if (c->GetAttackDir().x > 0.00001f) {
|
||||
if (c->GetAttackDir().x < 0.00001f) {
|
||||
bullet_born_angle = -bullet_born_angle;
|
||||
}
|
||||
bullet_born_offset.Rotate(bullet_born_angle);
|
||||
@ -216,8 +219,34 @@ void InternalShot(Creature* c,
|
||||
bullet_born_angle * A8_PI,
|
||||
glm::vec3(0.0, 1.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) {
|
||||
gun_muzzle_position =
|
||||
gun_muzzle_position +=
|
||||
glm::vec4(
|
||||
std::get<0>(*weapon_meta->gun_muzzle_position.get()),
|
||||
std::get<1>(*weapon_meta->gun_muzzle_position.get()),
|
||||
|
@ -122,6 +122,7 @@ class Creature : public MoveableEntity
|
||||
virtual bool ReceiveExplosionDmg(Explosion* explosion) override;
|
||||
virtual bool IsCreature(Room* room) override { return true;};
|
||||
virtual void OnBattleStart(Room* room) override;
|
||||
virtual MetaData::Player* GetHeroMeta() { return nullptr; };
|
||||
bool HasBuffEffect(int buff_effect_id);
|
||||
Buff* GetBuffByEffectId(int effect_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 std::string GetName() override;
|
||||
virtual void DropItems(Obstacle* obstacle) override;
|
||||
|
||||
virtual MetaData::Player* GetHeroMeta() override { return meta; };
|
||||
virtual float GetSpeed() override;
|
||||
virtual float GetRadius() override;
|
||||
virtual float GetHitRadius() override;
|
||||
|
@ -262,6 +262,7 @@ class Human : public Creature
|
||||
virtual void RemoveObjects(Entity* entity) override;
|
||||
virtual void AddOutObjects(Entity* entity) override;
|
||||
virtual void RemoveOutObjects(Entity* entity) override;
|
||||
virtual MetaData::Player* GetHeroMeta() override { return meta; };
|
||||
bool HasLiveTeammate();
|
||||
bool HasNoDownedTeammate();
|
||||
int GetNearbyTeammateNum(float range);
|
||||
|
@ -489,16 +489,6 @@ namespace MetaData
|
||||
a8::SetBitFlag(special_damage_type, n);
|
||||
}
|
||||
}
|
||||
#ifdef DEBUG
|
||||
{
|
||||
gun_muzzle_position = std::make_shared<std::tuple<float, float, float>>
|
||||
(
|
||||
0.8,
|
||||
3.1,
|
||||
3.0
|
||||
);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void Equip::Init2()
|
||||
|
@ -119,6 +119,22 @@ namespace MetaData
|
||||
bool Match(CondAddBuff_e cond, int val, int val2);
|
||||
};
|
||||
|
||||
struct HeroShotAnimation
|
||||
{
|
||||
int id = 0;
|
||||
|
||||
float r_t = 0;
|
||||
float r_x = 0;
|
||||
float r_y = 0;
|
||||
float r_z = 0;
|
||||
|
||||
float l_t = 0;
|
||||
float l_x = 0;
|
||||
float l_y = 0;
|
||||
float l_z = 0;
|
||||
|
||||
};
|
||||
|
||||
struct Player
|
||||
{
|
||||
const metatable::Player* i = nullptr;
|
||||
@ -129,6 +145,7 @@ namespace MetaData
|
||||
std::vector<std::tuple<int, int>> pre_appear_effect;
|
||||
bool HasDrop() { return !dead_drop.empty();};
|
||||
std::tuple<int, int> pve_score;
|
||||
std::map<int, HeroShotAnimation> shot_animations;
|
||||
|
||||
void Init();
|
||||
int RandDrop();
|
||||
|
@ -557,11 +557,100 @@ public:
|
||||
MetaMgr::Instance()->terminator_meta = MetaMgr::Instance()->GetPlayer(5005);
|
||||
}
|
||||
#endif
|
||||
LoadHeroAndEquipShotData();
|
||||
Check();
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
void LoadHeroAndEquipShotData()
|
||||
{
|
||||
a8::XObject xobj;
|
||||
xobj.ReadFromFile(res_path + "shot_animation.json");
|
||||
{
|
||||
auto hero_list_xobj = xobj.At("hero");
|
||||
std::vector<std::string> keys;
|
||||
hero_list_xobj->GetKeys(keys);
|
||||
for (auto& key : keys) {
|
||||
auto hero_xobj = hero_list_xobj->At(key);
|
||||
int hero_id = a8::XValue(key);
|
||||
std::vector<std::string> keys2;
|
||||
hero_xobj->GetKeys(keys2);
|
||||
|
||||
for (auto& key2 : keys2) {
|
||||
auto anim_xobj = hero_xobj->At(key2);
|
||||
int id = a8::XValue(key2);
|
||||
float r_t = anim_xobj->At("t")->AsXValue().GetDouble();
|
||||
float r_x = anim_xobj->At("r")->At("x")->AsXValue().GetDouble();
|
||||
float r_y = anim_xobj->At("r")->At("y")->AsXValue().GetDouble();
|
||||
float r_z = anim_xobj->At("r")->At("z")->AsXValue().GetDouble();
|
||||
|
||||
float l_t = anim_xobj->At("t")->AsXValue().GetDouble();
|
||||
float l_x = anim_xobj->At("l")->At("x")->AsXValue().GetDouble();
|
||||
float l_y = anim_xobj->At("l")->At("y")->AsXValue().GetDouble();
|
||||
float l_z = anim_xobj->At("l")->At("z")->AsXValue().GetDouble();
|
||||
|
||||
{
|
||||
MetaData::Player* hero_meta = MetaMgr::Instance()->GetPlayer(hero_id);
|
||||
if (hero_meta) {
|
||||
MetaData::HeroShotAnimation anim;
|
||||
anim.id = id;
|
||||
|
||||
anim.r_t = r_t;
|
||||
anim.r_x = r_x;
|
||||
anim.r_y = r_y;
|
||||
anim.r_z = r_z;
|
||||
|
||||
anim.l_t = l_t;
|
||||
anim.l_x = l_x;
|
||||
anim.l_y = l_y;
|
||||
anim.l_z = l_z;
|
||||
|
||||
hero_meta->shot_animations[id] = anim;
|
||||
}
|
||||
}
|
||||
a8::UdpLog::Instance()->Info
|
||||
("shot animation hero_id:%d anim_id:%d r_t:%f r_x:%f r_y:%f r_z:%f l_t:%f l_x:%f l_y:%f l_z:%f",
|
||||
{
|
||||
hero_id,
|
||||
id,
|
||||
r_t,
|
||||
r_x,
|
||||
r_y,
|
||||
r_z,
|
||||
l_t,
|
||||
l_x,
|
||||
l_y,
|
||||
l_z
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
{
|
||||
auto equip_list_xobj = xobj.At("equip");
|
||||
std::vector<std::string> keys;
|
||||
equip_list_xobj->GetKeys(keys);
|
||||
for (auto& key : keys) {
|
||||
auto equip_xobj = equip_list_xobj->At(key);
|
||||
int equip_id = a8::XValue(key);
|
||||
|
||||
float x = equip_xobj->At("x")->AsXValue().GetDouble();
|
||||
float y = equip_xobj->At("y")->AsXValue().GetDouble();
|
||||
float z = equip_xobj->At("z")->AsXValue().GetDouble();
|
||||
|
||||
MetaData::Equip* equip_meta = MetaMgr::Instance()->GetEquip(equip_id);
|
||||
if (equip_meta) {
|
||||
equip_meta->gun_muzzle_position = std::make_shared<std::tuple<float, float, float>>
|
||||
(
|
||||
x,
|
||||
y,
|
||||
z
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Check()
|
||||
{
|
||||
|
||||
|
@ -194,6 +194,8 @@ message Equip
|
||||
|
||||
optional float critical = 70;
|
||||
optional float cri_damage = 71;
|
||||
|
||||
optional int32 shootfire = 73;
|
||||
}
|
||||
|
||||
message EquipUpgrade
|
||||
|
2
third_party/a8engine
vendored
2
third_party/a8engine
vendored
@ -1 +1 @@
|
||||
Subproject commit 9b63b8fee2f459b1bd096c76d4f6aecfc2ba45bd
|
||||
Subproject commit b17543dae9a329dac545a7fe33bbefab0c9f5d4b
|
Loading…
x
Reference in New Issue
Block a user