|
|
|
@@ -467,35 +467,35 @@ namespace demo_utils
|
|
|
|
|
write_network_data_(output, network_data);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void write_predicted_player_data_(auto& output, const game::ClientArchiveData& cad,
|
|
|
|
|
const game::vec3_t& viewangles, std::uint8_t cad_index, predicted_data_id id)
|
|
|
|
|
void write_predicted_player_data_(auto& output, const game::mp::playerState_t& ps,
|
|
|
|
|
std::uint8_t cad_index, predicted_data_id id)
|
|
|
|
|
{
|
|
|
|
|
write_id_and_size(output, 50, demo_data_id::predicted_data);
|
|
|
|
|
output.write(reinterpret_cast<const char*>(&id), 1);
|
|
|
|
|
output.write(reinterpret_cast<const char*>(&cad_index), 1);
|
|
|
|
|
|
|
|
|
|
output.write(reinterpret_cast<const char*>(&cad.serverTime), 4);
|
|
|
|
|
output.write(reinterpret_cast<const char*>(&cad.origin[0]), 12);
|
|
|
|
|
output.write(reinterpret_cast<const char*>(&cad.velocity[0]), 12);
|
|
|
|
|
output.write(reinterpret_cast<const char*>(&cad.bobCycle), 4);
|
|
|
|
|
output.write(reinterpret_cast<const char*>(&cad.movementDir), 4);
|
|
|
|
|
output.write(reinterpret_cast<const char*>(&viewangles[0]), 12);
|
|
|
|
|
output.write(reinterpret_cast<const char*>(&ps.commandTime), 4);
|
|
|
|
|
output.write(reinterpret_cast<const char*>(&ps.origin[0]), 12);
|
|
|
|
|
output.write(reinterpret_cast<const char*>(&ps.velocity[0]), 12);
|
|
|
|
|
output.write(reinterpret_cast<const char*>(&ps.bobCycle), 4);
|
|
|
|
|
output.write(reinterpret_cast<const char*>(&ps.movementDir), 4);
|
|
|
|
|
output.write(reinterpret_cast<const char*>(&ps.viewangles[0]), 12);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void write_predicted_player_data(buffer_t& output, const game::ClientArchiveData& cad,
|
|
|
|
|
const game::vec3_t& viewangles, std::uint8_t cad_index, predicted_data_id id)
|
|
|
|
|
void write_predicted_player_data(buffer_t& output, const game::mp::playerState_t& ps,
|
|
|
|
|
std::uint8_t cad_index, predicted_data_id id)
|
|
|
|
|
{
|
|
|
|
|
write_predicted_player_data_(output, cad, viewangles, cad_index, id);
|
|
|
|
|
write_predicted_player_data_(output, ps, cad_index, id);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void write_predicted_player_data(std::ofstream& output, const game::ClientArchiveData& cad,
|
|
|
|
|
const game::vec3_t& viewangles, std::uint8_t cad_index, predicted_data_id id)
|
|
|
|
|
void write_predicted_player_data(std::ofstream& output, const game::mp::playerState_t& ps,
|
|
|
|
|
std::uint8_t cad_index, predicted_data_id id)
|
|
|
|
|
{
|
|
|
|
|
write_predicted_player_data_(output, cad, viewangles, cad_index, id);
|
|
|
|
|
write_predicted_player_data_(output, ps, cad_index, id);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void write_predicted_vehicle_data_(auto& output, const game::ClientArchiveData& cad,
|
|
|
|
|
const game::vec3_t& viewangles, std::uint8_t cad_index, predicted_data_id id)
|
|
|
|
|
void write_predicted_vehicle_data_(auto& output, const game::mp::playerState_t& ps,
|
|
|
|
|
std::uint8_t cad_index, predicted_data_id id)
|
|
|
|
|
{
|
|
|
|
|
const auto size = (id != predicted_data_id::vehicle_gryphon) ? 58 : 82;
|
|
|
|
|
|
|
|
|
@@ -503,10 +503,10 @@ namespace demo_utils
|
|
|
|
|
output.write(reinterpret_cast<const char*>(&id), 1);
|
|
|
|
|
output.write(reinterpret_cast<const char*>(&cad_index), 1);
|
|
|
|
|
|
|
|
|
|
const auto& vehicle = cad.playerVehStateClientArchive;
|
|
|
|
|
output.write(reinterpret_cast<const char*>(&cad.serverTime), 4);
|
|
|
|
|
output.write(reinterpret_cast<const char*>(&cad.origin[0]), 12);
|
|
|
|
|
output.write(reinterpret_cast<const char*>(&viewangles[0]), 12);
|
|
|
|
|
const auto& vehicle = ps.vehicleState;
|
|
|
|
|
output.write(reinterpret_cast<const char*>(&ps.commandTime), 4);
|
|
|
|
|
output.write(reinterpret_cast<const char*>(&ps.origin[0]), 12);
|
|
|
|
|
output.write(reinterpret_cast<const char*>(&ps.viewangles[0]), 12);
|
|
|
|
|
output.write(reinterpret_cast<const char*>(&vehicle.flags), 4);
|
|
|
|
|
output.write(reinterpret_cast<const char*>(&vehicle.origin[0]), 12);
|
|
|
|
|
output.write(reinterpret_cast<const char*>(&vehicle.angles[0]), 12);
|
|
|
|
@@ -520,16 +520,16 @@ namespace demo_utils
|
|
|
|
|
assert(!vehicle.splineId);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void write_predicted_vehicle_data(buffer_t& output, const game::ClientArchiveData& cad,
|
|
|
|
|
const game::vec3_t& viewangles, std::uint8_t cad_index, predicted_data_id id)
|
|
|
|
|
void write_predicted_vehicle_data(buffer_t& output, const game::mp::playerState_t& ps,
|
|
|
|
|
std::uint8_t cad_index, predicted_data_id id)
|
|
|
|
|
{
|
|
|
|
|
write_predicted_vehicle_data_(output, cad, viewangles, cad_index, id);
|
|
|
|
|
write_predicted_vehicle_data_(output, ps, cad_index, id);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void write_predicted_vehicle_data(std::ofstream& output, const game::ClientArchiveData& cad,
|
|
|
|
|
const game::vec3_t& viewangles, std::uint8_t cad_index, predicted_data_id id)
|
|
|
|
|
void write_predicted_vehicle_data(std::ofstream& output, const game::mp::playerState_t& ps,
|
|
|
|
|
std::uint8_t cad_index, predicted_data_id id)
|
|
|
|
|
{
|
|
|
|
|
write_predicted_vehicle_data_(output, cad, viewangles, cad_index, id);
|
|
|
|
|
write_predicted_vehicle_data_(output, ps, cad_index, id);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void write_helo_pilot_turret_fire_(auto& output, std::uint8_t fire_count)
|
|
|
|
@@ -675,23 +675,23 @@ namespace demo_utils
|
|
|
|
|
|
|
|
|
|
void write_predicted_data_(auto& output)
|
|
|
|
|
{
|
|
|
|
|
const auto& ps = game::mp::cg->ps;
|
|
|
|
|
const auto& viewangles = game::mp::cg->refdefViewAngles;
|
|
|
|
|
const auto cad_index = static_cast<std::uint8_t>(game::mp::cl->clientArchiveIndex - 1);
|
|
|
|
|
const auto cad_array = std::span(game::mp::cl->clientArchive);
|
|
|
|
|
auto& cl = *game::mp::cl;
|
|
|
|
|
auto& ps = cl.snap.ps;
|
|
|
|
|
const auto& cg = *game::mp::cg;
|
|
|
|
|
|
|
|
|
|
if (const auto& cad = cad_array[cad_index]; cad.serverTime)
|
|
|
|
|
ps.viewangles[0] = cg.refdefViewAngles[0];
|
|
|
|
|
ps.viewangles[1] = cg.refdefViewAngles[1];
|
|
|
|
|
ps.viewangles[2] = cg.refdefViewAngles[2];
|
|
|
|
|
|
|
|
|
|
const auto vehicle_in_use = (ps.vehicleState.entity && ps.vehicleState.entity != 2047);
|
|
|
|
|
if (!vehicle_in_use)
|
|
|
|
|
{
|
|
|
|
|
const auto vehicle_in_use = (ps.vehicleState.entity && ps.vehicleState.entity != 2047);
|
|
|
|
|
if (!vehicle_in_use)
|
|
|
|
|
{
|
|
|
|
|
write_predicted_player_data(output, cad, viewangles, cad_index, predicted_data_id::player);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
const auto data_type = get_predicted_vehicle_type(ps);
|
|
|
|
|
write_predicted_vehicle_data(output, cad, viewangles, cad_index, data_type);
|
|
|
|
|
}
|
|
|
|
|
write_predicted_player_data(output, ps, static_cast<std::uint8_t>(cl.clientArchiveIndex), predicted_data_id::player);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
const auto data_type = get_predicted_vehicle_type(ps);
|
|
|
|
|
write_predicted_vehicle_data(output, ps, static_cast<std::uint8_t>(cl.clientArchiveIndex), data_type);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -842,77 +842,12 @@ namespace demo_utils
|
|
|
|
|
|
|
|
|
|
namespace serialization_server
|
|
|
|
|
{
|
|
|
|
|
void sv_write_predicted_player_data_(auto& output, const game::mp::playerState_t& ps,
|
|
|
|
|
std::uint8_t cad_index, predicted_data_id id)
|
|
|
|
|
{
|
|
|
|
|
write_id_and_size(output, 50, demo_data_id::predicted_data);
|
|
|
|
|
output.write(reinterpret_cast<const char*>(&id), 1);
|
|
|
|
|
output.write(reinterpret_cast<const char*>(&cad_index), 1);
|
|
|
|
|
|
|
|
|
|
output.write(reinterpret_cast<const char*>(&ps.commandTime), 4);
|
|
|
|
|
output.write(reinterpret_cast<const char*>(&ps.origin[0]), 12);
|
|
|
|
|
output.write(reinterpret_cast<const char*>(&ps.velocity[0]), 12);
|
|
|
|
|
output.write(reinterpret_cast<const char*>(&ps.bobCycle), 4);
|
|
|
|
|
output.write(reinterpret_cast<const char*>(&ps.movementDir), 4);
|
|
|
|
|
output.write(reinterpret_cast<const char*>(&ps.viewangles[0]), 12);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void sv_write_predicted_player_data(buffer_t& output, const game::mp::playerState_t& ps,
|
|
|
|
|
std::uint8_t cad_index, predicted_data_id id)
|
|
|
|
|
{
|
|
|
|
|
sv_write_predicted_player_data_(output, ps, cad_index, id);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void sv_write_predicted_player_data(std::ofstream& output, const game::mp::playerState_t& ps,
|
|
|
|
|
std::uint8_t cad_index, predicted_data_id id)
|
|
|
|
|
{
|
|
|
|
|
sv_write_predicted_player_data_(output, ps, cad_index, id);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void sv_write_predicted_vehicle_data_(auto& output, const game::mp::playerState_t& ps,
|
|
|
|
|
std::uint8_t cad_index, predicted_data_id id)
|
|
|
|
|
{
|
|
|
|
|
const auto size = (id != predicted_data_id::vehicle_gryphon) ? 58 : 82;
|
|
|
|
|
|
|
|
|
|
write_id_and_size(output, size, demo_data_id::predicted_data);
|
|
|
|
|
output.write(reinterpret_cast<const char*>(&id), 1);
|
|
|
|
|
output.write(reinterpret_cast<const char*>(&cad_index), 1);
|
|
|
|
|
|
|
|
|
|
const auto& vehicle = ps.vehicleState;
|
|
|
|
|
output.write(reinterpret_cast<const char*>(&ps.commandTime), 4);
|
|
|
|
|
output.write(reinterpret_cast<const char*>(&ps.origin[0]), 12);
|
|
|
|
|
output.write(reinterpret_cast<const char*>(&ps.viewangles[0]), 12);
|
|
|
|
|
output.write(reinterpret_cast<const char*>(&vehicle.flags), 4);
|
|
|
|
|
output.write(reinterpret_cast<const char*>(&vehicle.origin[0]), 12);
|
|
|
|
|
output.write(reinterpret_cast<const char*>(&vehicle.angles[0]), 12);
|
|
|
|
|
|
|
|
|
|
if (id == predicted_data_id::vehicle_gryphon)
|
|
|
|
|
{
|
|
|
|
|
output.write(reinterpret_cast<const char*>(&vehicle.velocity[0]), 12);
|
|
|
|
|
output.write(reinterpret_cast<const char*>(&vehicle.angVelocity[0]), 12);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
assert(!vehicle.splineId);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void sv_write_predicted_vehicle_data(buffer_t& output, const game::mp::playerState_t& ps,
|
|
|
|
|
std::uint8_t cad_index, predicted_data_id id)
|
|
|
|
|
{
|
|
|
|
|
sv_write_predicted_vehicle_data_(output, ps, cad_index, id);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void sv_write_predicted_vehicle_data(std::ofstream& output, const game::mp::playerState_t& ps,
|
|
|
|
|
std::uint8_t cad_index, predicted_data_id id)
|
|
|
|
|
{
|
|
|
|
|
sv_write_predicted_vehicle_data_(output, ps, cad_index, id);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void sv_write_predicted_data_(auto& output, const game::mp::playerState_t& ps, std::size_t send_msg_count)
|
|
|
|
|
{
|
|
|
|
|
const auto vehicle_in_use = (ps.vehicleState.entity && ps.vehicleState.entity != 2047);
|
|
|
|
|
if (!vehicle_in_use)
|
|
|
|
|
{
|
|
|
|
|
sv_write_predicted_player_data(output, ps, static_cast<std::uint8_t>(send_msg_count), predicted_data_id::player);
|
|
|
|
|
write_predicted_player_data(output, ps, static_cast<std::uint8_t>(send_msg_count), predicted_data_id::player);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
@@ -926,7 +861,7 @@ namespace demo_utils
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
sv_write_predicted_vehicle_data(output, ps, static_cast<std::uint8_t>(send_msg_count), data_type);
|
|
|
|
|
write_predicted_vehicle_data(output, ps, static_cast<std::uint8_t>(send_msg_count), data_type);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|