This commit is contained in:
aozhiwei 2024-04-28 11:34:08 +08:00
parent 40ad332a7e
commit 4cfe93e405
2 changed files with 29 additions and 11 deletions

View File

@ -93,8 +93,8 @@ static bool LoadOtherHeroAnimi(const std::string key,
std::shared_ptr<a8::XObject> anim_xobj,
mt::HeroShotAnimation& anim)
{
std::string id_str;
a8::ReplaceString(id_str, key, "other");
std::string id_str = key;
a8::ReplaceString(id_str, "other", "");
int id = a8::XValue(id_str);
std::vector<std::string> keys;
@ -102,7 +102,7 @@ static bool LoadOtherHeroAnimi(const std::string key,
for (auto& tmp_key : keys) {
auto act_xobj = anim_xobj->At(tmp_key);
int act_id = a8::XValue(tmp_key).GetInt();
int h = act_xobj->At("h")->AsXValue().GetInt();
int h = act_xobj->At("h")->AsXValue().GetString() == "l" ? mt::SHOT_HAND_LEFT : mt::SHOT_HAND_RIGHT;
int t = act_xobj->At("t")->AsXValue().GetInt() * 1000;
float x = act_xobj->At("x")->AsXValue().GetDouble();
float y = act_xobj->At("y")->AsXValue().GetDouble();

View File

@ -74,6 +74,19 @@ static void CalcGunMuzzlePosition(Creature* c,
}
if (shot_animi) {
if (shot_animi->is_other) {
if (bulletIdx > 0 && bulletIdx <= shot_animi->other_list.size()) {
gun_muzzle_position +=
glm::vec4(
shot_animi->other_list.at(bulletIdx - 1).x,
shot_animi->other_list.at(bulletIdx - 1).y,
shot_animi->other_list.at(bulletIdx - 1).z,
0
);
} else {
#ifdef MYDEBUG
A8_ABORT();
#endif
}
} else {
if (weapon_meta->double_gun()&&
bulletIdx > (int)(bulletNum / 2)) {
@ -436,7 +449,7 @@ void InternalShot(Creature* c,
bullet_angle *= 1.0f + c->GetAbility()->GetAttr(kHVAT_BulletAngle);
}
GlmHelper::RotateY(bullet_dir, glm::radians(bullet_angle));
int shot_animi_time = (shot_animi ? shot_animi->t : 0);
int shot_animi_time = (shot_animi ? shot_animi->GetShotAnimTime(bulletIdx - 1) : 0);
if (shot_animi_time > 0) {
shot_animi_time = std::max(100, shot_animi_time);
}
@ -470,7 +483,7 @@ void InternalShot(Creature* c,
}
if (c->IsPlayer() || c->IsCar()) {
#ifdef MYDEBUG
a8::XPrintf("idx:%d offset:%f,%f,%f angle:%f old_angle:%f angle_xyz:%f,%f,%f %f %f gun_muzzle_position:%f,%f,%f pos:%f,%f,%f gun_id:%d t:%d fly_distance:%f delay_time:%d\n",
a8::XPrintf("idx:%d offset:%f,%f,%f angle:%f old_angle:%f angle_xyz:%f,%f,%f %f %f gun_muzzle_position:%f,%f,%f pos:%f,%f,%f gun_id:%d t:%d fly_distance:%f delay_time:%d hand:%d\n",
{
bulletIdx,
bullet_born_offset.x,
@ -492,7 +505,8 @@ void InternalShot(Creature* c,
weapon_meta->id(),
shot_animi_time,
fly_distance,
std::get<3>(tuple)
std::get<3>(tuple),
shot_animi && shot_animi->is_other ? shot_animi->GetShotHand(bulletIdx - 1) : -1
});
#endif
}
@ -524,11 +538,15 @@ void InternalShot(Creature* c,
bullet_info.reporter_list = c->CalcReporterList(trace_target_uniid, weapon_meta, bullet_meta);
bullet_info.ignore_original_dmg = c->GetAbility()->GetSwitchTimes(kIgnoreOriginalDmg) > 0;
bullet_info.on_bullet_exit = on_bullet_exit;
if (weapon_meta->double_gun() &&
bulletIdx > (int)(bulletNum / 2)) {
bullet_info.hand = 1;
} else if (weapon_meta->hand() == 1) {
bullet_info.hand = 1;
if (shot_animi && shot_animi->is_other) {
bullet_info.hand = shot_animi->GetShotHand(bulletIdx - 1);
} else {
if (weapon_meta->double_gun() &&
bulletIdx > (int)(bulletNum / 2)) {
bullet_info.hand = 1;
} else if (weapon_meta->hand() == 1) {
bullet_info.hand = 1;
}
}
#ifdef MYDEBUG1
if (bullet_info.trace_target_uniid) {