Pass player orientation matrix to multi_send_fire
The caller has the player object, and can provide the orientation matrix from it. Use that instead of letting multi_send_fire recompute the object in order to get the matrix.
This commit is contained in:
parent
c03b772ce7
commit
2536b6c1bc
|
@ -389,7 +389,7 @@ int multi_maybe_disable_friendly_fire(const object_base *attacker);
|
|||
|
||||
namespace dsx {
|
||||
|
||||
void multi_send_fire(int laser_gun, laser_level, int laser_flags, objnum_t laser_track, imobjptridx_t is_bomb_objnum);
|
||||
void multi_send_fire(const vms_matrix &orient, int laser_gun, laser_level, int laser_flags, objnum_t laser_track, imobjptridx_t is_bomb_objnum);
|
||||
void multi_send_destroy_controlcen(objnum_t objnum, playernum_t player);
|
||||
void multi_send_position(object &objnum);
|
||||
void multi_send_kill(vmobjptridx_t objnum);
|
||||
|
|
|
@ -1520,7 +1520,7 @@ void Flare_create(const vmobjptridx_t obj)
|
|||
}
|
||||
|
||||
if (Game_mode & GM_MULTI)
|
||||
multi_send_fire(FLARE_ADJUST, laser_level::_1 /* unused */, 0, object_none, object_none);
|
||||
multi_send_fire(plrobj.orient, FLARE_ADJUST, laser_level::_1 /* unused */, 0, object_none, object_none);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -2091,7 +2091,7 @@ int do_laser_firing(vmobjptridx_t objp, const primary_weapon_index_t weapon_num,
|
|||
// Set values to be recognized during comunication phase, if we are the
|
||||
// one shooting
|
||||
if ((Game_mode & GM_MULTI) && objp == get_local_player().objnum)
|
||||
multi_send_fire(weapon_num, level, flags, Network_laser_track, object_none);
|
||||
multi_send_fire(objp->orient, weapon_num, level, flags, Network_laser_track, object_none);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -2395,7 +2395,7 @@ void do_missile_firing(const secondary_weapon_index_t weapon, const vmobjptridx_
|
|||
if (Game_mode & GM_MULTI)
|
||||
{
|
||||
const object &obj = *objnum;
|
||||
multi_send_fire(weapon+MISSILE_ADJUST, laser_level::_1 /* unused */, gun_flag, obj.ctype.laser_info.track_goal, weapon_index_is_player_bomb(weapon) ? objnum : object_none);
|
||||
multi_send_fire(plrobj.orient, weapon + MISSILE_ADJUST, laser_level::_1 /* unused */, gun_flag, obj.ctype.laser_info.track_goal, weapon_index_is_player_bomb(weapon) ? objnum : object_none);
|
||||
}
|
||||
|
||||
// don't autoselect if dropping prox and prox not current weapon
|
||||
|
|
|
@ -2479,10 +2479,8 @@ void multi_process_bigdata(const d_level_shared_robot_info_state &LevelSharedRob
|
|||
// players of something we did.
|
||||
//
|
||||
|
||||
void multi_send_fire(int laser_gun, const laser_level level, int laser_flags, objnum_t laser_track, const imobjptridx_t is_bomb_objnum)
|
||||
void multi_send_fire(const vms_matrix &orient, int laser_gun, const laser_level level, int laser_flags, objnum_t laser_track, const imobjptridx_t is_bomb_objnum)
|
||||
{
|
||||
auto &Objects = LevelUniqueObjectState.Objects;
|
||||
auto &vmobjptr = Objects.vmptr;
|
||||
static fix64 last_fireup_time = 0;
|
||||
|
||||
// provoke positional update if possible (20 times per second max. matches vulcan, the fastest firing weapon)
|
||||
|
@ -2509,10 +2507,9 @@ void multi_send_fire(int laser_gun, const laser_level level, int laser_flags, ob
|
|||
multibuf.multifire[3] = static_cast<uint8_t>(level);
|
||||
multibuf.multifire[4] = static_cast<char>(laser_flags);
|
||||
|
||||
const auto &ownship = get_local_plrobj();
|
||||
PUT_INTEL_INT(&multibuf.multifire[5], ownship.orient.fvec.x);
|
||||
PUT_INTEL_INT(&multibuf.multifire[9], ownship.orient.fvec.y);
|
||||
PUT_INTEL_INT(&multibuf.multifire[13], ownship.orient.fvec.z);
|
||||
PUT_INTEL_INT(&multibuf.multifire[5], orient.fvec.x);
|
||||
PUT_INTEL_INT(&multibuf.multifire[9], orient.fvec.y);
|
||||
PUT_INTEL_INT(&multibuf.multifire[13], orient.fvec.z);
|
||||
|
||||
/*
|
||||
* If we fire a bomb, it's persistent. Let others know of it's objnum so host can track it's behaviour over clients (host-authority functions, D2 chaff ability).
|
||||
|
|
Loading…
Reference in a new issue