I was hoping that someone could guide me into the right direction here.
I am trying to read the NLP packets from Insim, the packets that give information about where a car is on track. But I am having some difficulties converting the info from the packet to normal numbers.
For example:
Then to get the number of nodes in the path:
Which gives a number never bigger then 256 for any of the tracks, most of the times a lot smaller.
Then during a replay, I try to read the current node at what my car is. Then two things happen:
1. The node at the start finish line is not 0 or 1, but that is normal, according to some posts at the old RSC forum.
2. The node-number resets back to zero more then one times in a lap.
Example:
This means that there is no distinct between turn 3 and somewhere halfway turn 8 and 9.
I think the problem is enclosed in the way I convert the packet into a normal number, but maybe it is an LFS-bug?
I am trying to read the NLP packets from Insim, the packets that give information about where a car is on track. But I am having some difficulties converting the info from the packet to normal numbers.
For example:
struct IS_NLP // Node and Lap Packet
{
char NLP [4];
word NumNodes; // total number of nodes in the path
word FinishLine; // the node number of the finish line
byte NumPlayers; // number of players in race
byte Sp1; // spare
byte Sp2; // spare
byte Sp3; // spare
NodeLap Info [28]; // node and lap of each player
};
Then to get the number of nodes in the path:
numNodes = bitFive & 0xff << 8 | bitFour & 0xff;
Which gives a number never bigger then 256 for any of the tracks, most of the times a lot smaller.
Then during a replay, I try to read the current node at what my car is. Then two things happen:
1. The node at the start finish line is not 0 or 1, but that is normal, according to some posts at the old RSC forum.
2. The node-number resets back to zero more then one times in a lap.
Example:
turn node
1 125
2 160
3 205
4 245
5 12
6 75
7 120
8 176
9 231
10 5
11 75
This means that there is no distinct between turn 3 and somewhere halfway turn 8 and 9.
I think the problem is enclosed in the way I convert the packet into a normal number, but maybe it is an LFS-bug?