]> git.mxchange.org Git - flightgear.git/blob - Cockpit/cockpit.c
Incorporated HUD changes and struct/typedef changes from Charlie Hotchkiss
[flightgear.git] / Cockpit / cockpit.c
1 /**************************************************************************
2  * cockpit.c -- routines to draw a cockpit (initial draft)
3  *
4  * Written by Michele America, started September 1997.
5  *
6  * Copyright (C) 1997  Michele F. America  - nomimarketing@mail.telepac.pt
7  *
8  * This program is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU General Public License as
10  * published by the Free Software Foundation; either version 2 of the
11  * License, or (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful, but
14  * WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16  * General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, write to the Free Software
20  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21  *
22  * $Id$
23  * (Log is kept at end of this file)
24  **************************************************************************/
25
26
27 #include <GL/glut.h>
28
29 #include <stdlib.h>
30 #include <Cockpit/cockpit.h>
31
32 #include <Include/fg_constants.h>
33
34 #include <Aircraft/aircraft.h>
35 #include <Scenery/scenery.h>
36 #include <Math/mat3.h>
37 #include <Math/polar.h>
38 #include <Time/fg_timer.h>
39 #include <Math/fg_random.h>
40 #include <Weather/weather.h>
41
42 #include <Main/fg_debug.h>
43
44 // This is a structure that contains all data related to
45 // cockpit/panel/hud system
46
47 static fgCOCKPIT *aircraft_cockpit;
48
49 fgCOCKPIT *fgCockpitInit( fgAIRCRAFT *cur_aircraft )
50 {
51         fgCOCKPIT *cockpit;
52         Hptr hud;
53
54         fgPrintf( FG_COCKPIT, FG_INFO, "Initializing cockpit subsystem\n");
55
56         cockpit = (fgCOCKPIT *)calloc(sizeof(fgCOCKPIT),1);
57         if( cockpit == NULL )
58                 return( NULL );
59
60         cockpit->code = 1;      /* It will be aircraft dependent */
61         cockpit->status = 0;
62
63         // If aircraft has HUD
64         hud = fgHUDInit( cur_aircraft );  // Color no longer in parameter list
65         if( hud == NULL )
66                 return( NULL );
67
68         cockpit->hud = hud;
69
70         aircraft_cockpit = cockpit;
71
72         fgPrintf( FG_COCKPIT, FG_INFO,
73                   "  Code %d  Status %d\n", 
74                   cockpit->hud->code, cockpit->hud->status );
75
76         return( cockpit );
77 }
78
79 fgCOCKPIT *fgCockpitAddHUD( fgCOCKPIT *cockpit, HUD *hud )
80 {
81         cockpit->hud = hud;
82         return(cockpit);
83 }
84
85 void fgCockpitUpdate( void )
86 {
87
88         fgPrintf( FG_COCKPIT, FG_INFO,
89                   "Cockpit: code %d   status %d\n", 
90                   aircraft_cockpit->code, aircraft_cockpit->status );
91         if( aircraft_cockpit->hud != NULL )                     // That is, if the aircraft has a HUD,
92                 fgUpdateHUD( aircraft_cockpit->hud );   // then draw it.
93                 
94 }
95
96
97 /* $Log$
98 /* Revision 1.10  1998/02/07 15:29:33  curt
99 /* Incorporated HUD changes and struct/typedef changes from Charlie Hotchkiss
100 /* <chotchkiss@namg.us.anritsu.com>
101 /*
102  * Revision 1.9  1998/02/03 23:20:14  curt
103  * Lots of little tweaks to fix various consistency problems discovered by
104  * Solaris' CC.  Fixed a bug in fg_debug.c with how the fgPrintf() wrapper
105  * passed arguments along to the real printf().  Also incorporated HUD changes
106  * by Michele America.
107  *
108  * Revision 1.8  1998/01/31 00:43:03  curt
109  * Added MetroWorks patches from Carmen Volpe.
110  *
111  * Revision 1.7  1998/01/27 00:47:51  curt
112  * Incorporated Paul Bleisch's <bleisch@chromatic.com> new debug message
113  * system and commandline/config file processing code.
114  *
115  * Revision 1.6  1998/01/19 19:27:01  curt
116  * Merged in make system changes from Bob Kuehne <rpk@sgi.com>
117  * This should simplify things tremendously.
118  *
119  * Revision 1.5  1998/01/19 18:40:19  curt
120  * Tons of little changes to clean up the code and to remove fatal errors
121  * when building with the c++ compiler.
122  *
123  * Revision 1.4  1997/12/30 20:47:34  curt
124  * Integrated new event manager with subsystem initializations.
125  *
126  * Revision 1.3  1997/12/15 23:54:33  curt
127  * Add xgl wrappers for debugging.
128  * Generate terrain normals on the fly.
129  *
130  * Revision 1.2  1997/12/10 22:37:38  curt
131  * Prepended "fg" on the name of all global structures that didn't have it yet.
132  * i.e. "struct WEATHER {}" became "struct fgWEATHER {}"
133  *
134  * Revision 1.1  1997/08/29 18:03:20  curt
135  * Initial revision.
136  *
137  */