Renamed WriteAngles to WriteAngle. Made use of WriteAngle and WriteVector
This commit is contained in:
@ -2,6 +2,7 @@
|
||||
#include "svc_bspdecal.h"
|
||||
#include "base/bitfile.h"
|
||||
#include "base/jsonfile.h"
|
||||
#include "demofile/demojson.h"
|
||||
#include "netcontants.h"
|
||||
|
||||
namespace NetHandlers
|
||||
@ -50,11 +51,7 @@ namespace NetHandlers
|
||||
bool SVC_BSPDecal_JsonWrite_Internal(JsonWrite& jsonbuf, const SourceGameContext& context, NetMsg::SVC_BSPDecal* data)
|
||||
{
|
||||
jsonbuf.StartObject("svc_bspdecal");
|
||||
jsonbuf.StartObject("position");
|
||||
jsonbuf.WriteFloat("x", data->position.x);
|
||||
jsonbuf.WriteFloat("y", data->position.y);
|
||||
jsonbuf.WriteFloat("z", data->position.z);
|
||||
jsonbuf.EndObject();
|
||||
DemoJsonWriter::WriteVector(jsonbuf, "position", data->position);
|
||||
jsonbuf.WriteUInt32("decalTextureIndex", data->decalTextureIndex);
|
||||
jsonbuf.WriteUInt32("entIndex", data->entIndex);
|
||||
jsonbuf.WriteUInt32("modelIndex", data->modelIndex);
|
||||
|
@ -2,23 +2,24 @@
|
||||
#include "svc_crosshairangle.h"
|
||||
#include "base/bitfile.h"
|
||||
#include "base/jsonfile.h"
|
||||
#include "demofile/demojson.h"
|
||||
#include <iomanip>
|
||||
|
||||
namespace NetHandlers
|
||||
{
|
||||
bool SVC_CrosshairAngle_BitRead_Internal(BitRead& bitbuf, SourceGameContext& context, NetMsg::SVC_CrosshairAngle* data)
|
||||
{
|
||||
data->x = bitbuf.ReadBitAngle(16);
|
||||
data->y = bitbuf.ReadBitAngle(16);
|
||||
data->z = bitbuf.ReadBitAngle(16);
|
||||
data->angle.x = bitbuf.ReadBitAngle(16);
|
||||
data->angle.y = bitbuf.ReadBitAngle(16);
|
||||
data->angle.z = bitbuf.ReadBitAngle(16);
|
||||
return !bitbuf.IsOverflowed();
|
||||
}
|
||||
|
||||
bool SVC_CrosshairAngle_BitWrite_Internal(BitWrite& bitbuf, const SourceGameContext& context, NetMsg::SVC_CrosshairAngle* data)
|
||||
{
|
||||
bitbuf.WriteBitAngle(data->x, 16);
|
||||
bitbuf.WriteBitAngle(data->y, 16);
|
||||
bitbuf.WriteBitAngle(data->z, 16);
|
||||
bitbuf.WriteBitAngle(data->angle.x, 16);
|
||||
bitbuf.WriteBitAngle(data->angle.y, 16);
|
||||
bitbuf.WriteBitAngle(data->angle.z, 16);
|
||||
return !bitbuf.IsOverflowed();
|
||||
}
|
||||
|
||||
@ -30,11 +31,7 @@ namespace NetHandlers
|
||||
bool SVC_CrosshairAngle_JsonWrite_Internal(JsonWrite& jsonbuf, const SourceGameContext& context, NetMsg::SVC_CrosshairAngle* data)
|
||||
{
|
||||
jsonbuf.StartObject("svc_crosshairangle");
|
||||
jsonbuf.StartObject("angle");
|
||||
jsonbuf.WriteFloat("pitch", data->x);
|
||||
jsonbuf.WriteFloat("yaw", data->y);
|
||||
jsonbuf.WriteFloat("roll", data->z);
|
||||
jsonbuf.EndObject();
|
||||
DemoJsonWriter::WriteAngle(jsonbuf, "angle", data->angle);
|
||||
jsonbuf.EndObject();
|
||||
return true;
|
||||
}
|
||||
@ -44,9 +41,9 @@ namespace NetHandlers
|
||||
const std::streamsize oldPrecision = out.precision();
|
||||
out << "svc_CrosshairAngle:"
|
||||
<< std::setprecision(1) << std::fixed
|
||||
<< " (" << data->x
|
||||
<< " " << data->y
|
||||
<< " " << data->z << ")"
|
||||
<< " (" << data->angle.x
|
||||
<< " " << data->angle.y
|
||||
<< " " << data->angle.z << ")"
|
||||
<< std::setprecision(oldPrecision);
|
||||
out.unsetf(std::ios_base::floatfield);
|
||||
}
|
||||
|
@ -2,14 +2,13 @@
|
||||
#pragma once
|
||||
|
||||
#include "nethandlers.h"
|
||||
#include "sourcesdk/vector.h"
|
||||
|
||||
namespace NetMsg
|
||||
{
|
||||
struct SVC_CrosshairAngle
|
||||
{
|
||||
float x;
|
||||
float y;
|
||||
float z;
|
||||
QAngle angle;
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -2,6 +2,7 @@
|
||||
#include "svc_fixangle.h"
|
||||
#include "base/bitfile.h"
|
||||
#include "base/jsonfile.h"
|
||||
#include "demofile/demojson.h"
|
||||
#include <iomanip>
|
||||
|
||||
namespace NetHandlers
|
||||
@ -9,18 +10,18 @@ namespace NetHandlers
|
||||
bool SVC_FixAngle_BitRead_Internal(BitRead& bitbuf, SourceGameContext& context, NetMsg::SVC_FixAngle* data)
|
||||
{
|
||||
data->relative = bitbuf.ReadOneBit() != 0;
|
||||
data->x = bitbuf.ReadBitAngle(16);
|
||||
data->y = bitbuf.ReadBitAngle(16);
|
||||
data->z = bitbuf.ReadBitAngle(16);
|
||||
data->angle.x = bitbuf.ReadBitAngle(16);
|
||||
data->angle.y = bitbuf.ReadBitAngle(16);
|
||||
data->angle.z = bitbuf.ReadBitAngle(16);
|
||||
return !bitbuf.IsOverflowed();
|
||||
}
|
||||
|
||||
bool SVC_FixAngle_BitWrite_Internal(BitWrite& bitbuf, const SourceGameContext& context, NetMsg::SVC_FixAngle* data)
|
||||
{
|
||||
bitbuf.WriteOneBit(data->relative);
|
||||
bitbuf.WriteBitAngle(data->x, 16);
|
||||
bitbuf.WriteBitAngle(data->y, 16);
|
||||
bitbuf.WriteBitAngle(data->z, 16);
|
||||
bitbuf.WriteBitAngle(data->angle.x, 16);
|
||||
bitbuf.WriteBitAngle(data->angle.y, 16);
|
||||
bitbuf.WriteBitAngle(data->angle.z, 16);
|
||||
return !bitbuf.IsOverflowed();
|
||||
}
|
||||
|
||||
@ -33,11 +34,7 @@ namespace NetHandlers
|
||||
{
|
||||
jsonbuf.StartObject("svc_fixangle");
|
||||
jsonbuf.WriteBool("relative", data->relative);
|
||||
jsonbuf.StartObject("angle");
|
||||
jsonbuf.WriteFloat("pitch", data->x);
|
||||
jsonbuf.WriteFloat("yaw", data->y);
|
||||
jsonbuf.WriteFloat("roll", data->z);
|
||||
jsonbuf.EndObject();
|
||||
DemoJsonWriter::WriteAngle(jsonbuf, "angle", data->angle);
|
||||
jsonbuf.EndObject();
|
||||
return true;
|
||||
}
|
||||
@ -47,9 +44,9 @@ namespace NetHandlers
|
||||
const std::streamsize oldPrecision = out.precision();
|
||||
out << "svc_FixAngle: " << (data->relative ? "relative" : "absolute")
|
||||
<< std::setprecision(1) << std::fixed
|
||||
<< " " << data->x
|
||||
<< " " << data->y
|
||||
<< " " << data->z
|
||||
<< " " << data->angle.x
|
||||
<< " " << data->angle.y
|
||||
<< " " << data->angle.z
|
||||
<< std::setprecision(oldPrecision);
|
||||
out.unsetf(std::ios_base::floatfield);
|
||||
}
|
||||
|
@ -2,15 +2,14 @@
|
||||
#pragma once
|
||||
|
||||
#include "nethandlers.h"
|
||||
#include "sourcesdk/vector.h"
|
||||
|
||||
namespace NetMsg
|
||||
{
|
||||
struct SVC_FixAngle
|
||||
{
|
||||
bool relative;
|
||||
float x;
|
||||
float y;
|
||||
float z;
|
||||
QAngle angle;
|
||||
};
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user