Skip to content

Commit

Permalink
feat(onesync): CTrainGameStateDataNode research
Browse files Browse the repository at this point in the history
  • Loading branch information
Ehbw committed Dec 24, 2023
1 parent 030778a commit bab1c17
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -556,9 +556,9 @@ struct CTrainGameStateDataNodeData
bool renderDerailed;

// 2372 {
bool unk198;
bool unk224;
bool unk199;
bool unk198; //unk198
bool highPrecisionBlending; //unk224
bool hasNoThreadId; //unk199
// }

bool forceDoorsOpen;
Expand Down Expand Up @@ -648,6 +648,17 @@ enum ePopType
POPTYPE_TOOL
};

//TODO: Probably should be moved out of fx::sync namespace
struct scrVector
{
float x;
int pad;
float y;
int pad2;
float z;
int pad3;
};

struct SyncTreeBase
{
public:
Expand Down
29 changes: 19 additions & 10 deletions code/components/citizen-server-impl/include/state/SyncTrees_Five.h
Original file line number Diff line number Diff line change
Expand Up @@ -2623,21 +2623,30 @@ struct CTrainGameStateDataNode : GenericSerializeDataNode<CTrainGameStateDataNod
// 0 = Moving, 1 = Slowing down, 2 = Doors opening, 3 = Stopped, 4 = Doors closing, 5 = Before depart
s.Serialize(3, data.trainState);

s.Serialize(data.isEngine);
s.Serialize(data.isEngine);

//2372 inserted a bool between isEngine and isCaboose
if (Is2372())
{
s.Serialize(data.unk198);
}

s.Serialize(data.isCaboose);
s.Serialize(data.unk12);
s.Serialize(data.direction);
s.Serialize(data.unk14);
s.Serialize(data.renderDerailed);

if (Is2372()) // Sequence of bits need to be verified for 2732
{
s.Serialize(data.unk198);
s.Serialize(data.unk224);
s.Serialize(data.unk199);
}

s.Serialize(data.forceDoorsOpen);

if (Is2372())
{
//Always true on randomly spawned trains
s.Serialize(data.hasNoThreadId);

//Modified by 0xEC0C1D4922AF9754
s.Serialize(data.highPrecisionBlending);
}

return true;
}
Expand Down Expand Up @@ -3278,7 +3287,7 @@ struct SyncTree : public SyncTreeBaseImpl<TNode, false>
}
}
}
}
}

virtual CDoorMovementDataNodeData* GetDoorMovement() override
{
Expand Down Expand Up @@ -3525,7 +3534,7 @@ struct SyncTree : public SyncTreeBaseImpl<TNode, false>
auto [hasNode, node] = this->template GetData<CPedMovementGroupDataNode>();

return hasNode ? &node->data : nullptr;
}
}

virtual void CalculatePosition() override
{
Expand Down

0 comments on commit bab1c17

Please sign in to comment.