]> git.mxchange.org Git - flightgear.git/commitdiff
Add gear animation effects to replay.
authorcurt <curt>
Tue, 22 Jul 2003 23:46:11 +0000 (23:46 +0000)
committercurt <curt>
Tue, 22 Jul 2003 23:46:11 +0000 (23:46 +0000)
src/Network/native_fdm.cxx
src/Network/net_fdm.hxx
src/Replay/replay.cxx

index 44adfdeecc69c1697cf8f6bb0380345931b0ddbc..281ee8df59bf9c0aac375b21617611ea66f97451 100644 (file)
@@ -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  ... */
index e2321d48954325aed9629c761dcaef0f875fcf14..bec4df81d926971b68e1f5d0e9cc37255ff7653b 100644 (file)
@@ -32,7 +32,7 @@
 
 #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
@@ -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
index 88fc737072fc9300a55d497b22db5c0bb2cf3834..fbe841baab48c4776a31b160b325b6ed911762af 100644 (file)
@@ -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