From: curt Date: Tue, 22 Jul 2003 23:46:11 +0000 (+0000) Subject: Add gear animation effects to replay. X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=c672417725e2804d8a7a6fdfc0aa8da6e40b7a05;p=flightgear.git Add gear animation effects to replay. --- diff --git a/src/Network/native_fdm.cxx b/src/Network/native_fdm.cxx index 44adfdeec..281ee8df5 100644 --- a/src/Network/native_fdm.cxx +++ b/src/Network/native_fdm.cxx @@ -183,6 +183,9 @@ void FGProps2NetFDM( FGNetFDM *net, bool net_byte_order ) { for (i = 0; i < net->num_wheels; ++i ) { SGPropertyNode *node = fgGetNode("/gear/gear", i, true); 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 @@ -246,6 +249,9 @@ void FGProps2NetFDM( FGNetFDM *net, bool net_byte_order ) { for ( i = 0; i < net->num_wheels; ++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); @@ -312,8 +318,12 @@ void FGNetFDM2Props( FGNetFDM *net, bool net_byte_order ) { } net->num_wheels = htonl(net->num_wheels); - // I don't need to convert the Wow flags, since they are one - // byte in size + for ( i = 0; i < net->num_wheels; ++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->cur_time = ntohl(net->cur_time); 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 ) { - SGPropertyNode * node - = fgGetNode("/gear/gear", i, true); + SGPropertyNode * node = fgGetNode("/gear/gear", i, true); 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 ... */ diff --git a/src/Network/net_fdm.hxx b/src/Network/net_fdm.hxx index e2321d489..bec4df81d 100644 --- a/src/Network/net_fdm.hxx +++ b/src/Network/net_fdm.hxx @@ -32,7 +32,7 @@ #include // 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 @@ -105,6 +105,9 @@ public: // Gear status int num_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 time_t cur_time; // current unix time diff --git a/src/Replay/replay.cxx b/src/Replay/replay.cxx index 88fc73707..fbe841baa 100644 --- a/src/Replay/replay.cxx +++ b/src/Replay/replay.cxx @@ -280,8 +280,14 @@ static FGReplayData interpolate( double time, FGReplayData f1, FGReplayData f2 ) // Gear status for ( i = 0; i < fdm1.num_wheels; ++i ) { - result.fdm.wow[i] - = weight( fdm1.wow[i], fdm2.wow[i], ratio ); + result.fdm.wow[i] = 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