Add gear animation effects to replay.
This commit is contained in:
parent
b8ac00f0a6
commit
c672417725
3 changed files with 28 additions and 7 deletions
|
@ -183,6 +183,9 @@ void FGProps2NetFDM( FGNetFDM *net, bool net_byte_order ) {
|
||||||
for (i = 0; i < net->num_wheels; ++i ) {
|
for (i = 0; i < net->num_wheels; ++i ) {
|
||||||
SGPropertyNode *node = fgGetNode("/gear/gear", i, true);
|
SGPropertyNode *node = fgGetNode("/gear/gear", i, true);
|
||||||
net->wow[i] = node->getDoubleValue("wow");
|
net->wow[i] = node->getDoubleValue("wow");
|
||||||
|
net->gear_pos[i] = node->getDoubleValue("position-norm");
|
||||||
|
net->gear_steer[i] = node->getDoubleValue("steering-norm");
|
||||||
|
net->gear_compression[i] = node->getDoubleValue("compression-norm");
|
||||||
}
|
}
|
||||||
|
|
||||||
// the following really aren't used in this context
|
// the following really aren't used in this context
|
||||||
|
@ -246,6 +249,9 @@ void FGProps2NetFDM( FGNetFDM *net, bool net_byte_order ) {
|
||||||
|
|
||||||
for ( i = 0; i < net->num_wheels; ++i ) {
|
for ( i = 0; i < net->num_wheels; ++i ) {
|
||||||
net->wow[i] = htonl(net->wow[i]);
|
net->wow[i] = htonl(net->wow[i]);
|
||||||
|
net->gear_pos[i] = htonl(net->gear_pos[i]);
|
||||||
|
net->gear_steer[i] = htonl(net->gear_steer[i]);
|
||||||
|
net->gear_compression[i] = htonl(net->gear_compression[i]);
|
||||||
}
|
}
|
||||||
net->num_wheels = htonl(net->num_wheels);
|
net->num_wheels = htonl(net->num_wheels);
|
||||||
|
|
||||||
|
@ -312,8 +318,12 @@ void FGNetFDM2Props( FGNetFDM *net, bool net_byte_order ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
net->num_wheels = htonl(net->num_wheels);
|
net->num_wheels = htonl(net->num_wheels);
|
||||||
// I don't need to convert the Wow flags, since they are one
|
for ( i = 0; i < net->num_wheels; ++i ) {
|
||||||
// byte in size
|
net->wow[i] = htonl(net->wow[i]);
|
||||||
|
net->gear_pos[i] = htonl(net->gear_pos[i]);
|
||||||
|
net->gear_steer[i] = htonl(net->gear_steer[i]);
|
||||||
|
net->gear_compression[i] = htonl(net->gear_compression[i]);
|
||||||
|
}
|
||||||
|
|
||||||
net->cur_time = ntohl(net->cur_time);
|
net->cur_time = ntohl(net->cur_time);
|
||||||
net->warp = ntohl(net->warp);
|
net->warp = ntohl(net->warp);
|
||||||
|
@ -389,9 +399,11 @@ void FGNetFDM2Props( FGNetFDM *net, bool net_byte_order ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < net->num_wheels; ++i ) {
|
for (i = 0; i < net->num_wheels; ++i ) {
|
||||||
SGPropertyNode * node
|
SGPropertyNode * node = fgGetNode("/gear/gear", i, true);
|
||||||
= fgGetNode("/gear/gear", i, true);
|
|
||||||
node->setDoubleValue("wow", net->wow[i] );
|
node->setDoubleValue("wow", net->wow[i] );
|
||||||
|
node->setDoubleValue("position-norm", net->gear_pos[i] );
|
||||||
|
node->setDoubleValue("steering-norm", net->gear_steer[i] );
|
||||||
|
node->setDoubleValue("compression-norm", net->gear_compression[i] );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* these are ignored for now ... */
|
/* these are ignored for now ... */
|
||||||
|
|
|
@ -32,7 +32,7 @@
|
||||||
|
|
||||||
#include <time.h> // time_t
|
#include <time.h> // time_t
|
||||||
|
|
||||||
const int FG_NET_FDM_VERSION = 12;
|
const int FG_NET_FDM_VERSION = 13;
|
||||||
|
|
||||||
|
|
||||||
// Define a structure containing the top level flight dynamics model
|
// Define a structure containing the top level flight dynamics model
|
||||||
|
@ -105,6 +105,9 @@ public:
|
||||||
// Gear status
|
// Gear status
|
||||||
int num_wheels;
|
int num_wheels;
|
||||||
bool wow[FG_MAX_WHEELS];
|
bool wow[FG_MAX_WHEELS];
|
||||||
|
float gear_pos[FG_MAX_WHEELS];
|
||||||
|
float gear_steer[FG_MAX_WHEELS];
|
||||||
|
float gear_compression[FG_MAX_WHEELS];
|
||||||
|
|
||||||
// Environment
|
// Environment
|
||||||
time_t cur_time; // current unix time
|
time_t cur_time; // current unix time
|
||||||
|
|
|
@ -280,8 +280,14 @@ static FGReplayData interpolate( double time, FGReplayData f1, FGReplayData f2 )
|
||||||
|
|
||||||
// Gear status
|
// Gear status
|
||||||
for ( i = 0; i < fdm1.num_wheels; ++i ) {
|
for ( i = 0; i < fdm1.num_wheels; ++i ) {
|
||||||
result.fdm.wow[i]
|
result.fdm.wow[i] = weight( fdm1.wow[i], fdm2.wow[i], ratio );
|
||||||
= weight( fdm1.wow[i], fdm2.wow[i], ratio );
|
result.fdm.gear_pos[i]
|
||||||
|
= weight( fdm1.gear_pos[i], fdm2.gear_pos[i], ratio );
|
||||||
|
result.fdm.gear_steer[i]
|
||||||
|
= weight( fdm1.gear_steer[i], fdm2.gear_steer[i], ratio );
|
||||||
|
result.fdm.gear_compression[i]
|
||||||
|
= weight( fdm1.gear_compression[i], fdm2.gear_compression[i],
|
||||||
|
ratio );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Environment
|
// Environment
|
||||||
|
|
Loading…
Add table
Reference in a new issue