]> git.mxchange.org Git - flightgear.git/blobdiff - LaRCsim/ls_interface.c
Incorporated HUD changes and struct/typedef changes from Charlie Hotchkiss
[flightgear.git] / LaRCsim / ls_interface.c
index 9ff1dd431c65e6ae1b0ccd60ed8cbd06812fd0a2..8a8dd993b17757cddbcda1f14ca44c99c97ea4a3 100644 (file)
@@ -223,7 +223,7 @@ $Original log: LaRCsim.c,v $
 --------------------------------------------------------------------------*/
 
 #include <sys/types.h>
-#include <sys/stat.h>
+/* #include <sys/stat.h> */
 #include <stdlib.h>
 #include <stdio.h>
 #include <math.h>
@@ -235,7 +235,13 @@ $Original log: LaRCsim.c,v $
 #include "ls_sim_control.h"
 #include "ls_cockpit.h"
 #include "ls_interface.h"
-#include "../flight.h"
+#include "ls_step.h"
+#include "ls_accel.h"
+#include "ls_aux.h"
+#include "ls_model.h"
+#include "ls_init.h"
+#include <Flight/flight.h>
+#include <Aircraft/aircraft.h>
 
 /* global variable declarations */
 
@@ -270,8 +276,7 @@ static char  matname[MAX_FILE_NAME_LENGTH]  = "run.m";
 
 
 
-void ls_stamp()
-{
+void ls_stamp( void ) {
     char rcsid[] = "$Id$";
     char revid[] = "$Revision$";
     char dateid[] = "$Date$";
@@ -290,13 +295,13 @@ void ls_stamp()
     sprintf(sim_control_.date_string, "%06d\0", date);
     sprintf(sim_control_.time_stamp, "%02d:%02d:%02d\0", 
        nowtime->tm_hour, nowtime->tm_min, nowtime->tm_sec);
+#ifdef COMPILE_THIS_CODE_THIS_USELESS_CODE
     cuserid( sim_control_.userid );    /* set up user id */
-
+#endif /* COMPILE_THIS_CODE_THIS_USELESS_CODE */
     return;
 }
 
-void ls_setdefopts()
-{
+void ls_setdefopts( void ) {
     /* set default values for most options */
 
     sim_control_.debug = 0;            /* change to non-zero if in dbx! */
@@ -305,7 +310,6 @@ void ls_setdefopts()
     sim_control_.write_mat = 0;                /* write matrix-x/matlab script */
     sim_control_.write_tab = 0;                /* write tab delim. history file */
     sim_control_.write_asc1 = 0;       /* write GetData file */
-    sim_control_.sim_type = GLmouse;   /* hook up to mouse */
     sim_control_.save_spacing = DEFAULT_SAVE_SPACING;  
                                        /* interpolation on recording */
     sim_control_.write_spacing = DEFAULT_WRITE_SPACING;        
@@ -313,8 +317,8 @@ void ls_setdefopts()
     sim_control_.end_time = DEFAULT_END_TIME;
     sim_control_.model_hz = DEFAULT_MODEL_HZ;
     sim_control_.term_update_hz = DEFAULT_TERM_UPDATE_HZ;
-    sim_control_.time_slices = DEFAULT_END_TIME * DEFAULT_MODEL_HZ / 
-       DEFAULT_SAVE_SPACING;
+    sim_control_.time_slices = (long int)(DEFAULT_END_TIME * DEFAULT_MODEL_HZ / 
+       DEFAULT_SAVE_SPACING);
     sim_control_.paused = 0;
 
     speedup = 1.0;
@@ -326,6 +330,8 @@ void ls_setdefopts()
 #define OPT_OK 0
 #define OPT_ERR 1
 
+#ifdef COMPILE_THIS_CODE_THIS_USELESS_CODE
+
 extern char *optarg;
 extern int optind;
 
@@ -475,14 +481,10 @@ int ls_checkopts(argc, argv)      /* check and set options flags */
         
     return OPT_OK;
   }
+#endif /* COMPILE_THIS_CODE_THIS_USELESS_CODE */
 
 
-void ls_loop( dt, initialize )
-
-SCALAR dt;
-int initialize;
-
-{
+void ls_loop( SCALAR dt, int initialize ) {
     /* printf ("  In ls_loop()\n"); */
     ls_step( dt, initialize );
     /* if (sim_control_.sim_type == cockpit ) ls_ACES();  */
@@ -493,15 +495,24 @@ int initialize;
 
 
 
-int ls_cockpit() {
+int ls_cockpit( void ) {
+    fgCONTROLS *c;
+
     sim_control_.paused = 0;
 
-    Throttle_pct = 0.95;
+    c = current_aircraft.controls;
+
+    Lat_control = FG_Aileron;
+    Long_control = FG_Elevator;
+    Long_trim = FG_Elev_Trim;
+    Rudder_pedal = FG_Rudder;
+    Throttle_pct = FG_Throttle[0];
 
     /* printf("Mach = %.2f  ", Mach_number);
     printf("%.4f,%.4f,%.2f  ", Latitude, Longitude, Altitude);
     printf("%.2f,%.2f,%.2f\n", Phi, Theta, Psi); */
 
+    return( 0 );
 }
 
 
@@ -550,8 +561,8 @@ int fgLaRCsimUpdate(int multiloop) {
 }
 
 
-/* Convert from the FG flight_params struct to the LaRCsim generic_ struct */
-int fgFlight_2_LaRCsim (struct flight_params *f) {
+/* Convert from the fgFLIGHT struct to the LaRCsim generic_ struct */
+int fgFlight_2_LaRCsim (fgFLIGHT *f) {
     Mass =      FG_Mass;
     I_xx =      FG_I_xx;
     I_yy =      FG_I_yy;
@@ -721,11 +732,13 @@ int fgFlight_2_LaRCsim (struct flight_params *f) {
     X_pilot_rwy =       FG_X_pilot_rwy;
     Y_pilot_rwy =       FG_Y_pilot_rwy;
     H_pilot_rwy =       FG_H_pilot_rwy;
+
+    return( 0 );
 }
 
 
-/* Convert from the LaRCsim generic_ struct to the FG flight_params struct */
-int fgLaRCsim_2_Flight (struct flight_params *f) {
+/* Convert from the LaRCsim generic_ struct to the fgFLIGHT struct */
+int fgLaRCsim_2_Flight (fgFLIGHT *f) {
     FG_Mass =   Mass;
     FG_I_xx =   I_xx;
     FG_I_yy =   I_yy;
@@ -895,11 +908,56 @@ int fgLaRCsim_2_Flight (struct flight_params *f) {
     FG_X_pilot_rwy =    X_pilot_rwy;
     FG_Y_pilot_rwy =    Y_pilot_rwy;
     FG_H_pilot_rwy =    H_pilot_rwy;
+
+    return ( 0 );
 }
 
 /* Flight Gear Modification Log
  *
  * $Log$
+ * Revision 1.16  1998/02/07 15:29:38  curt
+ * Incorporated HUD changes and struct/typedef changes from Charlie Hotchkiss
+ * <chotchkiss@namg.us.anritsu.com>
+ *
+ * Revision 1.15  1998/01/22 22:03:47  curt
+ * Removed #include <sys/stat.h>
+ *
+ * Revision 1.14  1998/01/19 19:27:04  curt
+ * Merged in make system changes from Bob Kuehne <rpk@sgi.com>
+ * This should simplify things tremendously.
+ *
+ * Revision 1.13  1998/01/19 18:40:26  curt
+ * Tons of little changes to clean up the code and to remove fatal errors
+ * when building with the c++ compiler.
+ *
+ * Revision 1.12  1998/01/06 01:20:16  curt
+ * Tweaks to help building with MSVC++
+ *
+ * Revision 1.11  1998/01/05 22:19:26  curt
+ * #ifdef'd out some unused code that was problematic for MSVC++ to compile.
+ *
+ * Revision 1.10  1997/12/10 22:37:43  curt
+ * Prepended "fg" on the name of all global structures that didn't have it yet.
+ * i.e. "struct WEATHER {}" became "struct fgWEATHER {}"
+ *
+ * Revision 1.9  1997/08/27 03:30:08  curt
+ * Changed naming scheme of basic shared structures.
+ *
+ * Revision 1.8  1997/06/21 17:12:50  curt
+ * Capitalized subdirectory names.
+ *
+ * Revision 1.7  1997/05/31 19:16:28  curt
+ * Elevator trim added.
+ *
+ * Revision 1.6  1997/05/31 04:13:53  curt
+ * WE CAN NOW FLY!!!
+ *
+ * Continuing work on the LaRCsim flight model integration.
+ * Added some MSFS-like keyboard input handling.
+ *
+ * Revision 1.5  1997/05/30 23:26:25  curt
+ * Added elevator/aileron controls.
+ *
  * Revision 1.4  1997/05/30 19:30:15  curt
  * The LaRCsim flight model is starting to look like it is working.
  *