This commit is contained in:
aozhiwei 2024-04-26 17:18:05 +08:00
parent 4c713803eb
commit 40ad332a7e
4 changed files with 101 additions and 67 deletions

View File

@ -107,6 +107,9 @@ static bool LoadOtherHeroAnimi(const std::string key,
float x = act_xobj->At("x")->AsXValue().GetDouble();
float y = act_xobj->At("y")->AsXValue().GetDouble();
float z = act_xobj->At("z")->AsXValue().GetDouble();
if (!(h == mt::SHOT_HAND_RIGHT || h == mt::SHOT_HAND_LEFT)) {
A8_ABORT();
}
mt::HeroShotAnimationOther o;
o.hand = h;
o.t = t;
@ -429,4 +432,27 @@ namespace mt
}
}
}
int HeroShotAnimation::GetShotAnimTime(int bullet_idx) const
{
if (!is_other) {
return t;
}
if (bullet_idx >= 0 && bullet_idx < other_list.size()) {
return other_list.at(bullet_idx).t;
}
return 0;
}
int HeroShotAnimation::GetShotHand(int bullet_idx) const
{
if (!is_other) {
return SHOT_HAND_RIGHT;
}
if (bullet_idx >= 0 && bullet_idx < other_list.size()) {
return other_list.at(bullet_idx).hand;
}
return SHOT_HAND_RIGHT;
}
}

View File

@ -47,6 +47,8 @@ namespace mt
float p5_z = 0;
std::vector<HeroShotAnimationOther> other_list;
int GetShotAnimTime(int bullet_idx) const;
int GetShotHand(int bullet_idx) const;
};
DECLARE_ID_TABLE(Hero, mtb::Hero,

View File

@ -2200,7 +2200,10 @@ void Human::PushJoinRoomMsg()
notifymsg.set_error_code(0);
notifymsg.set_server_info(JsonDataMgr::Instance()->server_info);
room->FillSMJoinedNotify(this, notifymsg);
#ifdef MYDEBUG
#else
notifymsg.set_pre_client_shot(mt::Param::s().pre_client_shot);
#endif
GGListener::Instance()->SendToClient(socket_handle, 0, notifymsg);
}
{

View File

@ -73,20 +73,60 @@ static void CalcGunMuzzlePosition(Creature* c,
int i = 0;
}
if (shot_animi) {
if (weapon_meta->double_gun()&&
bulletIdx > (int)(bulletNum / 2)) {
gun_muzzle_position +=
glm::vec4(
shot_animi->l_x,
shot_animi->l_y,
shot_animi->l_z,
0
);
if (shot_animi->is_other) {
} else {
if (c->IsCar() && !weapon_meta->double_gun()) {
switch (c->shot_hole) {
case 1:
{
if (weapon_meta->double_gun()&&
bulletIdx > (int)(bulletNum / 2)) {
gun_muzzle_position +=
glm::vec4(
shot_animi->l_x,
shot_animi->l_y,
shot_animi->l_z,
0
);
} else {
if (c->IsCar() && !weapon_meta->double_gun()) {
switch (c->shot_hole) {
case 1:
{
gun_muzzle_position +=
glm::vec4(
shot_animi->p3_x,
shot_animi->p3_y,
shot_animi->p3_z,
0
);
}
break;
case 2:
{
gun_muzzle_position +=
glm::vec4(
shot_animi->p4_x,
shot_animi->p4_y,
shot_animi->p4_z,
0
);
}
break;
case 3:
{
gun_muzzle_position +=
glm::vec4(
shot_animi->p5_x,
shot_animi->p5_y,
shot_animi->p5_z,
0
);
}
break;
default:
{
}
break;
}
} else {
if (c->GetHeroMeta()->id() == 60100) {
gun_muzzle_position +=
glm::vec4(
shot_animi->p3_x,
@ -94,61 +134,24 @@ static void CalcGunMuzzlePosition(Creature* c,
shot_animi->p3_z,
0
);
}
break;
case 2:
{
gun_muzzle_position +=
glm::vec4(
shot_animi->p4_x,
shot_animi->p4_y,
shot_animi->p4_z,
0
);
}
break;
case 3:
{
gun_muzzle_position +=
glm::vec4(
shot_animi->p5_x,
shot_animi->p5_y,
shot_animi->p5_z,
0
);
}
break;
default:
{
}
break;
}
} else {
if (c->GetHeroMeta()->id() == 60100) {
gun_muzzle_position +=
glm::vec4(
shot_animi->p3_x,
shot_animi->p3_y,
shot_animi->p3_z,
0
);
} else {
if (weapon_meta->hand() == 1) {
gun_muzzle_position +=
glm::vec4(
shot_animi->l_x,
shot_animi->l_y,
shot_animi->l_z,
0
);
} else {
gun_muzzle_position +=
glm::vec4(
shot_animi->r_x,
shot_animi->r_y,
shot_animi->r_z,
0
);
if (weapon_meta->hand() == 1) {
gun_muzzle_position +=
glm::vec4(
shot_animi->l_x,
shot_animi->l_y,
shot_animi->l_z,
0
);
} else {
gun_muzzle_position +=
glm::vec4(
shot_animi->r_x,
shot_animi->r_y,
shot_animi->r_z,
0
);
}
}
}
}