Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions SDK/orangebox_new/include/public/dt_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ typedef enum
DPT_Int=0,
DPT_Float,
DPT_Vector,
DPT_VectorXY, // Only encodes the XY of a vector, ignores Z
DPT_String,
DPT_Array, // An array of the base types (can't be of datatables).
DPT_DataTable,
Expand Down
12 changes: 9 additions & 3 deletions spt/features/ipc-spt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,9 @@ namespace ipc
int i;
float f;
Vector v;
Vector2D v2;

switch (prop->m_RecvType)
switch (utils::GetPropTypeVersionAdjust(prop->m_RecvType))
{
case DPT_Int:
i = *reinterpret_cast<int*>(value);
Expand All @@ -153,9 +154,14 @@ namespace ipc
msg[FormatTempString("%s[1]", prop->GetName())] = v[1];
msg[FormatTempString("%s[2]", prop->GetName())] = v[2];
break;
#ifdef SSDK2007
#ifndef OE
case DPT_VectorXY:
v2 = *reinterpret_cast<Vector2D*>(value);
msg[FormatTempString("%s[0]", prop->GetName())] = v2[0];
msg[FormatTempString("%s[1]", prop->GetName())] = v2[1];
break;
case DPT_String:
msg[prop->GetName()] = *reinterpret_cast<const char**>(value);
msg[prop->GetName()] = reinterpret_cast<const char*>(value);
break;
#endif
default:
Expand Down
20 changes: 17 additions & 3 deletions spt/utils/ent_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,10 @@ namespace utils
{
void* value = reinterpret_cast<void*>(reinterpret_cast<uintptr_t>(ptr) + prop->GetOffset());
Vector v;
Vector2D v2;
int ehandle;

switch (prop->m_RecvType)
switch (GetPropTypeVersionAdjust(prop->m_RecvType))
{
case DPT_Int:
if (strstr(prop->GetName(), "m_h") != NULL)
Expand All @@ -65,9 +66,13 @@ namespace utils
v = *reinterpret_cast<Vector*>(value);
sprintf_s(buffer, size, "(%.3f, %.3f, %.3f)", v.x, v.y, v.z);
break;
#ifdef SSDK2007
#ifndef OE
case DPT_VectorXY:
v2 = *reinterpret_cast<Vector2D*>(value);
sprintf_s(buffer, size, "(%.3f, %.3f)", v2.x, v2.y);
break;
case DPT_String:
sprintf_s(buffer, size, "%s", *reinterpret_cast<const char**>(value));
sprintf_s(buffer, size, "%s", reinterpret_cast<const char*>(value));
break;
#endif
default:
Expand All @@ -84,6 +89,15 @@ namespace utils
props.push_back(propValue(name, BUFFER, prop));
}

SendPropType GetPropTypeVersionAdjust(SendPropType original)
{
#ifdef SSDK2007
if (original >= DPT_VectorXY && utils::GetBuildNumber() < 5135)
return (SendPropType)(original - 1);
#endif
return original;
}

void GetAllProps(RecvTable* table, void* ptr, std::vector<propValue>& props)
{
int numProps = table->m_nProps;
Expand Down
2 changes: 2 additions & 0 deletions spt/utils/ent_utils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ namespace utils
propValue(const char* name, const char* value, RecvProp* prop) : name(name), value(value), prop(prop) {}
};

// may need to adjust for different games since RecvProp::m_RecvType changed between versions
SendPropType GetPropTypeVersionAdjust(SendPropType original);
void GetAllProps(RecvTable* table, void* ptr, std::vector<propValue>& props);
void PrintAllProps(int index);
Vector GetPlayerEyePosition();
Expand Down