home *** CD-ROM | disk | FTP | other *** search
Text File | 1991-12-27 | 51.1 KB | 1,752 lines |
- Newsgroups: comp.sources.misc
- From: tcamp@hercules.acpub.duke.edu (Ted Campbell)
- Subject: v27i021: sfs - Space Flight Simulator, Part21/21
- Message-ID: <1991Dec24.192043.21341@sparky.imd.sterling.com>
- X-Md4-Signature: 015902acfffc307fa654290260b4b496
- Date: Tue, 24 Dec 1991 19:20:43 GMT
- Approved: kent@sparky.imd.sterling.com
-
- Submitted-by: tcamp@hercules.acpub.duke.edu (Ted Campbell)
- Posting-number: Volume 27, Issue 21
- Archive-name: sfs/part21
- Environment: IBMPC && EGA/VGA, UNIX-PC && MGR, UNIX && X11
-
- #!/bin/sh
- # do not concatenate these parts, unpack them in order with /bin/sh
- # file sfs/sfs/sfsx.c continued
- #
- if test ! -r _shar_seq_.tmp; then
- echo 'Please unpack part 1 first!'
- exit 1
- fi
- (read Scheck
- if test "$Scheck" != 21; then
- echo Please unpack part "$Scheck" next!
- exit 1
- else
- exit 0
- fi
- ) < _shar_seq_.tmp || exit 1
- if test ! -f _shar_wnt_.tmp; then
- echo 'x - still skipping sfs/sfs/sfsx.c'
- else
- echo 'x - continuing file sfs/sfs/sfsx.c'
- sed 's/^X//' << 'SHAR_EOF' >> 'sfs/sfs/sfsx.c' &&
- X int display;
- X int n;
- X double lat, lon;
- X double radius, distance;
- X long int orbit_n;
- X struct sfs_orbit **sorbit_array;
- X {
- X
- X sprintf( sfsx_tbuf, "sfsx_test() display %d, n %d, orbit_n %ld",
- X display, n, orbit_n );
- X bw_debug( sfsx_tbuf );
- X sprintf( sfsx_tbuf, "sfsx_test() lat %.1lf lon %.1lf, rad %.1lf dis %.1lf",
- X lat, lon,
- X radius, distance );
- X bw_debug( sfsx_tbuf );
- X sprintf( sfsx_tbuf, "sfsx_test() focal radius %.1lf",
- X sorbit_array[ 0 ]->aorbit->focus->radius );
- X bw_debug( sfsx_tbuf );
- X }
- #endif
- X
- /****************************************************************
- X
- X sfsx_update() Update Simulation Display
- X
- ****************************************************************/
- X
- sfsx_update( n_orbits,
- X sorbit_array, x_displays, n_displays, newtime,
- X zoom, d_zoom, d_upper, d_lower )
- X int n_orbits;
- X struct sfs_orbit **sorbit_array;
- X struct sfs_display **x_displays;
- X int n_displays;
- X long newtime;
- X int zoom, d_zoom, d_upper, d_lower;
- X {
- X static int redraw = TRUE; /* redraw Ground Track? */
- X static int old_zoom = 0xff;
- X static int old_zd = 0xff;
- X static int old_ud = 0xff;
- X static int old_ld = 0xff;
- X
- #ifdef OLD_DEBUG
- X sprintf( sfsx_tbuf, "sfsx_update() display %d, n %d, orbit_n %ld",
- X display, n, orbit_n );
- X bw_debug( sfsx_tbuf );
- X sprintf( sfsx_tbuf, "sfsx_update() lat %.1lf lon %.1lf, rad %.1lf dis %.1lf",
- X lat, lon,
- X radius, distance );
- X bw_debug( sfsx_tbuf );
- X sprintf( sfsx_tbuf, "sfsx_update() focal radius %.1lf",
- X sorbit_array[ 0 ]->aorbit->focus->radius );
- X bw_debug( sfsx_tbuf );
- X return TRUE;
- #endif
- X
- #ifdef OLD_DEBUG
- X if ( distance == 0.0 )
- X {
- X sprintf( sfsx_tbuf, "[pr: sfsx_update() received distance = %.2lf",
- X distance );
- X bw_error( sfsx_tbuf );
- X return;
- X }
- X if ( radius == 0.0 )
- X {
- X sprintf( sfsx_tbuf, "[pr: sfsx_update() received radius = %.2lf",
- X radius );
- X bw_error( sfsx_tbuf );
- X return;
- X }
- #endif
- X
- #ifdef OLD_DEBUG
- X bw_message( "DEBUG: update control panel..." );
- #endif
- X
- X /*** Update timing panel */
- X
- X cp_sti();
- X
- X /*** Call the appropriate display routine */
- X
- X if ( zoom == TRUE )
- X {
- X if ( ( zoom != old_zoom ) || ( d_zoom != old_zd )) /* Redraw the screen(s)? */
- X {
- X cp_lwin( &z_window, " " );
- X old_zoom = zoom;
- X old_zd = d_zoom;
- X e_wind = z_window;
- X redraw = TRUE;
- X }
- X sfsx_draw( z_window, sorbit_array, x_displays, d_zoom, n_orbits,
- X newtime, redraw );
- X redraw = FALSE;
- X }
- X else
- X {
- X if ( zoom != old_zoom ) /* Redraw the screen(s)? */
- X {
- X ui_fbox( fo_window->u_x1, fo_window->u_y1,
- X fo_window->u_x2, fo_window->u_y2, BLACK, SOLID );
- X cp_twin( &t_window, " " );
- X old_ud = d_upper;
- X cp_bwin( &b_window, " " );
- X old_ld = d_lower;
- X old_zoom = zoom;
- X e_wind = t_window;
- X redraw = TRUE;
- X }
- X else if ( d_upper != old_ud )
- X {
- X cp_twin( &t_window, " " );
- X old_ud = d_upper;
- X redraw = TRUE;
- X }
- X else if ( d_lower != old_ld )
- X {
- X cp_bwin( &b_window, " " );
- X old_ld = d_lower;
- X redraw = TRUE;
- X }
- X sfsx_draw( t_window, sorbit_array, x_displays, d_upper, n_orbits,
- X newtime, redraw );
- X sfsx_draw( b_window, sorbit_array, x_displays, d_lower, n_orbits,
- X newtime, redraw );
- X redraw = FALSE;
- X }
- X }
- X
- /****************************************************************
- X
- X sfsx_draw() draw display in a single window
- X
- ****************************************************************/
- X
- sfsx_draw( uiwind, sorbit_array, x_displays, display, n_orbits, newtime, redraw )
- X struct uiwindow *uiwind;
- X struct sfs_orbit **sorbit_array;
- X struct sfs_display **x_displays;
- X int display, n_orbits;
- X long newtime;
- X int redraw;
- X {
- X int orbit;
- X
- X orbit = x_displays[ display ]->orbit;
- X
- X switch( x_displays[ display ]->type )
- X {
- X case SFSD_VISUAL:
- X vi_draw( uiwind, sorbit_array[ orbit ]->aorbit->focus,
- X x_displays[ display ]->elements,
- X &(sorbit_array[ orbit ]->g_start),
- X &(sorbit_array[ orbit ]->g_end),
- X &(sorbit_array[ orbit ]->s_start),
- X &(sorbit_array[ orbit ]->s_end),
- X &(sorbit_array[ orbit ]->o_start),
- X &(sorbit_array[ orbit ]->o_end),
- X sorbit_array[ orbit ]->aorbit->focus->radius,
- X (double) sorbit_array[ orbit ]->ssp_r,
- X sorbit_array, orbit );
- X break;
- X case SFSD_GROUND:
- #ifdef OLD_DEBUG
- X sprintf( sfsx_tbuf, "sfsx_draw() received redraw %d", redraw );
- X bw_debug( sfsx_tbuf );
- #endif
- X gt_draw( x_displays[ display ], uiwind,
- X sorbit_array[ orbit ]->aorbit->focus,
- X x_displays[ display ]->elements, redraw,
- X &(sorbit_array[ orbit ]->s_start),
- X &(sorbit_array[ orbit ]->s_end),
- X sorbit_array, n_orbits );
- X break;
- X case SFSD_PERSP:
- X pe_draw( uiwind, sorbit_array[ orbit ]->aorbit->focus,
- X sorbit_array, n_orbits,
- X &(sorbit_array[ orbit ]->o_start),
- X &(sorbit_array[ orbit ]->o_end), newtime,
- X x_displays[ display ]->elements );
- X break;
- X default:
- #ifdef DEBUG
- X sprintf( sfsx_tbuf, "sfsx_draw() received display %d", display );
- X bw_error( sfsx_tbuf );
- #endif
- X return BW_ERROR;
- X break;
- X }
- X }
- X
- /****************************************************************
- X
- X sfsx_sigint() Interrupt signal handler
- X
- ****************************************************************/
- X
- sfsx_sigint()
- X {
- X sfs_exit();
- X exit( 0 );
- X }
- X
- /****************************************************************
- X
- X sfsx_curel() Return current elements to poll
- X
- ****************************************************************/
- X
- int *
- sfsx_curel()
- X {
- X if ( x_zoom == TRUE )
- X {
- X return &( x_displays[ d_zoom ]->elements );
- X }
- X else
- X {
- X return &( x_displays[ d_upper ]->elements );
- X }
- X }
- X
- /****************************************************************
- X
- X ui_poll() Null poll for ui compatibility
- X
- ****************************************************************/
- X
- ui_poll()
- X {
- X ;
- X }
- X
- SHAR_EOF
- echo 'File sfs/sfs/sfsx.c is complete' &&
- chmod 0644 sfs/sfs/sfsx.c ||
- echo 'restore of sfs/sfs/sfsx.c failed'
- Wc_c="`wc -c < 'sfs/sfs/sfsx.c'`"
- test 26740 -eq "$Wc_c" ||
- echo 'sfs/sfs/sfsx.c: original size 26740, current size' "$Wc_c"
- rm -f _shar_wnt_.tmp
- fi
- # ============= sfs/sfs/sfsx.h ==============
- if test -f 'sfs/sfs/sfsx.h' -a X"$1" != X"-c"; then
- echo 'x - skipping sfs/sfs/sfsx.h (File already exists)'
- rm -f _shar_wnt_.tmp
- else
- > _shar_wnt_.tmp
- echo 'x - extracting sfs/sfs/sfsx.h (Text)'
- sed 's/^X//' << 'SHAR_EOF' > 'sfs/sfs/sfsx.h' &&
- /***************************************************************
- X
- X sfsx.h General header file for
- X Space Flight Simulator,
- X Simulation Module
- X
- X Copyright (c) 1991, Ted A. Campbell
- X
- X Bywater Software
- X P. O. Box 4023
- X Duke Station
- X Durham, NC 27706
- X
- X email: tcamp@hercules.acpub.duke.edu
- X
- X Copyright and Permissions Information:
- X
- X All U.S. and international copyrights are claimed by the
- X author. The author grants permission to use this code
- X and software based on it under the following conditions:
- X (a) in general, the code and software based upon it may be
- X used by individuals and by non-profit organizations; (b) it
- X may also be utilized by governmental agencies in any country,
- X with the exception of military agencies; (c) the code and/or
- X software based upon it may not be sold for a profit without
- X an explicit and specific permission from the author, except
- X that a minimal fee may be charged for media on which it is
- X copied, and for copying and handling; (d) the code must be
- X distributed in the form in which it has been released by the
- X author; and (e) the code and software based upon it may not
- X be used for illegal activities.
- X
- ***************************************************************/
- X
- /*** Include Files */
- X
- #include "bw.h" /* header for generic Bywater handlers */
- #include "as.h" /* header for astronomy routines */
- #include "gr.h" /* header for graphics routines */
- #include "dr.h" /* header for directory routines */
- #include "ui.h" /* header for user interface routines */
- #include "sfs.h" /* header for sfs specific information */
- X
- /*** Program-specific definitions */
- X
- #ifndef SFSX
- #define SFSX
- #endif
- X
- #define sfsx_ X /* This will allow us to use longer names */
- X
- #define EL_EPOCH 315532800 /* Epoch for calculating elapsed
- X time, = 1980/01/01 00:00:00 */
- #define FT_POINTS 64 /* Points in forward track buffer */
- #define GT_POINTS 512 /* Size of ground track buffer */
- #define PE_POINTS 64 /* Size of Perspective buffer */
- #define EM_TITLES 6 /* Titles in Escape Menu */
- X
- /***************************************************************
- X
- X language-specific definitions
- X
- X English is taken as a default, and if SFSXNAME
- X has not been defined, the English definitions will be
- X utilized. To translate into other languages, we suggest
- X that the following section be copied, a language name
- X defined as one, and then each of the definitions rendered
- X into the language. Example:
- X
- X ;#define LATIN 1
- X ;
- X ;
- X ;#if LATIN
- X ;#define SFSXNAME " Pars in Astronautica Simulanda "
- X ;......etc.
- X ;#endif
- X
- X SFSXNAME will then be defined, and the English language
- X tags will not be called.
- X
- ***************************************************************/
- X
- #ifndef SFSXNAME
- #define SFSXNAME " Simulation Module "
- #define SFSX_TITLE "SFS ver. %s, Orbital Simulation"
- #define SFSX_PROG "Program: "
- #define SFSX_TIME "Timing: "
- #define SFSX_SYS "System: "
- #define ESCTITLE " Escape Options "
- #define EXITTITLE " Exit to Main SFS Menu"
- #define ABORTTITLE " Leave SFS Completely"
- #define ZOOMTITLE " Set and Activate Zoom Window"
- #define UPPERTITLE " Set and Activate Upper Window"
- #define LOWERTITLE " Set and Activate Lower Window"
- #define SYSTITLE " Set System Parameters"
- #define VISSIM " Visual Simulation Display "
- #define GTRACK " Ground Track Display "
- #define DPERSP " Distant Perspective Display "
- #define ERR_GRINIT "Failed to intialize graphics system\n"
- #define MEMERR_ESC "Cannot allocate memory for ESCAPE Menu "
- #define SFSX_PRERR "Error in interpretation of program file <%s>"
- #define SFSX_INIT "Please Wait: Initializing"
- #define SFSX_HELP "Press ESC or Click Here for Menu"
- #define CALCSD "Calculating surface data points for orbit %d"
- #define CALCGR "Calculating grid data points for orbit %d"
- #define CALCORB "Calculating orb data points for orbit %d"
- #define SFSX_WAIT "Waiting for time lapse"
- #define ERR_CHAIN "Failed to open chain file.\n"
- #define SFSX_MM "Escape Menu: Select a Menu Item"
- #define SFSX_MET "MET"
- #define SFSX_DAYS "day(s)"
- #define ERR_PROMPT "ERROR: %s; Do you want to continue? "
- #define ERRP_NO "N - ABORT"
- #define ERRP_YES "Y - Continue"
- #define ERR_MATH "Mathematics error, %s"
- #define SSP_TITLE "Set System Parameters"
- #define MEMERR_SSP "Cannot allocate memory for System Parameters Menu "
- #define SSP_TF " Time Factor [%ld x real time]"
- #define SSP_UI " Screen Update Interval [%ld seconds]"
- #define SSP_TPL " Trig Precision Level [%d]"
- #define SSP_EXIT " Return to Program"
- #endif
- X
- /*** Declaration of external data and routines */
- X
- extern long sfsx_getmet();
- X
- extern struct spj_pt spd_start, spd_end; /* surface data pointers */
- extern struct spj_pt gr_start, gr_end; /* grid data pointers */
- extern struct spj_pt pd_start, pd_end; /* point data pointers */
- extern struct spj_pt or_start, or_end; /* orb data pointers */
- X
- extern struct as_focus sfsx_focus; /* orbital focus structure */
- extern char sfsx_gridfile[ 32 ]; /* grid spd file */
- extern long sfsx_epoch; /* Orbital epoch in seconds since begining */
- extern int sfsx_display; /* Screen: 0 = visual simulation in top */
- X /* 1 = distant perspective in top */
- X /* 2 = zoom (full) visual */
- X
- extern struct sfs_orbit *sfsx_orbits[ ORBITS ];
- X /* Structures for orbital data */
- extern char sfsx_tbuf[ 256 ];
- X
- extern char fdfile[ 45 ];
- extern int cell_width, char_width, cell_height, char_height;
- extern int al_hor, al_vert;
- extern long sfsx_dp;
- extern long or_aa, or_ap;
- X
- extern int gt_color; /* Color for ground track plot */
- X
- extern char pr_name[ 128 ];
- X
- extern struct uiwindow *main_window; /* structure for main window */
- extern struct uiwindow *po_window; /* structure for focus panel */
- extern struct uiwindow *ti_window; /* structure for relation window */
- extern struct uiwindow *sy_window; /* structure for timing window */
- extern struct uiwindow *cp_window; /* structure for control panel box */
- extern struct uiwindow *fo_window; /* structure for focus window */
- extern struct uiwindow *z_window; /* structure for zoom window */
- extern struct uiwindow *t_window; /* top window */
- extern struct uiwindow *b_window; /* bottom window */
- X
- extern int help_y1; /* line for help display */
- extern int help_y2; /* top of help display */
- extern int help_x1; /* column for help display */
- extern int help_x2; /* max col for help display */
- X
- SHAR_EOF
- chmod 0644 sfs/sfs/sfsx.h ||
- echo 'restore of sfs/sfs/sfsx.h failed'
- Wc_c="`wc -c < 'sfs/sfs/sfsx.h'`"
- test 7157 -eq "$Wc_c" ||
- echo 'sfs/sfs/sfsx.h: original size 7157, current size' "$Wc_c"
- rm -f _shar_wnt_.tmp
- fi
- # ============= sfs/sfs/sfsx.mak ==============
- if test -f 'sfs/sfs/sfsx.mak' -a X"$1" != X"-c"; then
- echo 'x - skipping sfs/sfs/sfsx.mak (File already exists)'
- rm -f _shar_wnt_.tmp
- else
- > _shar_wnt_.tmp
- echo 'x - extracting sfs/sfs/sfsx.mak (Text)'
- sed 's/^X//' << 'SHAR_EOF' > 'sfs/sfs/sfsx.mak' &&
- PROJ =SFSX
- DEBUG =0
- CC =qcl
- CFLAGS_G = /AL /W1 /Ze /DDEBUG /I..\..\include
- CFLAGS_D = /Zi /Zr /Gi$(PROJ).mdt /Od
- CFLAGS_R = /O /Ot /DNDEBUG
- CFLAGS =$(CFLAGS_G) $(CFLAGS_R)
- LFLAGS_G = /CP:0xffff /NOI /NOE /SE:0x80 /ST:0x1000
- LFLAGS_D = /CO /M /INCR
- LFLAGS_R =
- LFLAGS =$(LFLAGS_G) $(LFLAGS_R)
- RUNFLAGS =
- OBJS_EXT = ..\..\lib\dr_ibmpc.obj ..\..\lib\gr_ibmpc.obj ..\..\lib\kb_ibmpc.obj ..\..\lib\ui_boxes.obj ..\..\lib\ui_pbm.obj \
- X ..\..\lib\ui_dial.obj ..\..\lib\ui_gets.obj ..\..\lib\ui_init.obj ..\..\lib\ui_list.obj ..\..\lib\ui_text.obj
- LIBS_EXT =
- X
- all: $(PROJ).exe
- X
- sfsx_cp.obj: sfsx_cp.c
- X
- sfsx_sp.obj: sfsx_sp.c
- X
- sfsx_var.obj: sfsx_var.c
- X
- as_orbit.obj: ..\as\as_orbit.c
- X
- as_vpt.obj: ..\as\as_vpt.c
- X
- as_spj.obj: ..\as\as_spj.c
- X
- sfsx.obj: sfsx.c
- X
- as_focus.obj: ..\as\as_focus.c
- X
- sfs_ft.obj: sfs_ft.c
- X
- sfs_gt.obj: sfs_gt.c
- X
- sfs_pe.obj: sfs_pe.c
- X
- sfs_pr.obj: sfs_pr.c
- X
- sfs_vi.obj: sfs_vi.c
- X
- sfs_di.obj: sfs_di.c
- X
- $(PROJ).exe: sfsx_cp.obj sfsx_sp.obj sfsx_var.obj as_orbit.obj as_vpt.obj as_spj.obj \
- X sfsx.obj as_focus.obj sfs_ft.obj sfs_gt.obj sfs_pe.obj sfs_pr.obj sfs_vi.obj sfs_di.obj $(OBJS_EXT)
- X echo >NUL @<<$(PROJ).crf
- sfsx_cp.obj +
- sfsx_sp.obj +
- sfsx_var.obj +
- as_orbit.obj +
- as_vpt.obj +
- as_spj.obj +
- sfsx.obj +
- as_focus.obj +
- sfs_ft.obj +
- sfs_gt.obj +
- sfs_pe.obj +
- sfs_pr.obj +
- sfs_vi.obj +
- sfs_di.obj +
- $(OBJS_EXT)
- $(PROJ).exe
- X
- $(LIBS_EXT);
- <<
- X link $(LFLAGS) @$(PROJ).crf
- X
- run: $(PROJ).exe
- X $(PROJ) $(RUNFLAGS)
- X
- SHAR_EOF
- chmod 0644 sfs/sfs/sfsx.mak ||
- echo 'restore of sfs/sfs/sfsx.mak failed'
- Wc_c="`wc -c < 'sfs/sfs/sfsx.mak'`"
- test 1444 -eq "$Wc_c" ||
- echo 'sfs/sfs/sfsx.mak: original size 1444, current size' "$Wc_c"
- rm -f _shar_wnt_.tmp
- fi
- # ============= sfs/sfs/sfsx_cp.c ==============
- if test -f 'sfs/sfs/sfsx_cp.c' -a X"$1" != X"-c"; then
- echo 'x - skipping sfs/sfs/sfsx_cp.c (File already exists)'
- rm -f _shar_wnt_.tmp
- else
- > _shar_wnt_.tmp
- echo 'x - extracting sfs/sfs/sfsx_cp.c (Text)'
- sed 's/^X//' << 'SHAR_EOF' > 'sfs/sfs/sfsx_cp.c' &&
- /****************************************************************
- X
- X sfsx_cp.c Screen Setup and
- X Control Panel Routines for SFS,
- X Simulation Module
- X
- X Copyright (c) 1991, Ted A. Campbell
- X
- X Bywater Software
- X P. O. Box 4023
- X Duke Station
- X Durham, NC 27706
- X
- X email: tcamp@hercules.acpub.duke.edu
- X
- X Copyright and Permissions Information:
- X
- X All U.S. and international copyrights are claimed by the
- X author. The author grants permission to use this code
- X and software based on it under the following conditions:
- X (a) in general, the code and software based upon it may be
- X used by individuals and by non-profit organizations; (b) it
- X may also be utilized by governmental agencies in any country,
- X with the exception of military agencies; (c) the code and/or
- X software based upon it may not be sold for a profit without
- X an explicit and specific permission from the author, except
- X that a minimal fee may be charged for media on which it is
- X copied, and for copying and handling; (d) the code must be
- X distributed in the form in which it has been released by the
- X author; and (e) the code and software based upon it may not
- X be used for illegal activities.
- X
- ****************************************************************/
- X
- #define SIDE_SPACE (gr_strlen("S")) /* spacing for side of boxes */
- /* #define SMALL_DEBUG */
- #define MAXYSIZE 375
- X
- #include "stdio.h"
- #include "math.h"
- X
- #ifdef __STDC__
- #include "stdlib.h"
- #include "malloc.h"
- #else
- extern char *malloc();
- #define time_t long
- #define size_t int
- #endif
- X
- #include "time.h"
- #include "sfsx.h"
- X
- struct tm *tp;
- X
- sfsx_screen()
- X {
- X
- #ifdef OLD_DEBUG
- X fprintf( stderr, "sfsx_screen(): enter function\n" );
- #endif
- X
- X /* Clear the screen */
- X
- X gr_cls( GR_PRIMARY );
- X
- X /* Draw the main screen */
- X
- X cp_ms();
- X
- X /* Draw control panel boxes */
- X
- X cp_boxes();
- X
- X }
- X
- cp_prog( progfile )
- X char *progfile;
- X {
- X sprintf( sfsx_tbuf, "%s: %s", progfile, pr_name );
- X
- X ui_text( po_window->u_x1 + SIDE_SPACE,
- X po_window->u_y1,
- X po_window->u_x2,
- X po_window->u_y2,
- X 256,
- X cl_mback, cl_mfore, sfsx_tbuf );
- X }
- X
- cp_sti()
- X {
- X static char clock_buf[ 36 ];
- X static char env_buf[ 48 ];
- X static time_t ticks;
- X register int c;
- X
- X ticks = (time_t) ( sfsx_epoch + sfsx_getmet());
- X tp = gmtime( &ticks );
- X
- #ifdef DEBUG
- X if ( tp == NULL )
- X {
- X bw_error( "[pr:] cp_sti(): tp returns NULL" );
- X return BW_ERROR;
- X }
- #endif
- X
- X sprintf( clock_buf, "UTC: %02d:%02d:%02d",
- X tp->tm_hour, tp->tm_min, tp->tm_sec );
- X ui_str( ti_window->u_x1 + SIDE_SPACE,
- X ti_window->u_y2 - ui_grwind->fysize,
- X ti_window->u_x2,
- X cl_mback, cl_mfore, clock_buf );
- X tp = localtime( &ticks );
- X if ( getenv( "TZ" ) == NULL )
- X {
- X strcpy( env_buf, "LOC" );
- X }
- X else
- X {
- X strcpy( env_buf, getenv( "TZ" ) );
- X }
- X if ( tp->tm_isdst == 0 )
- X {
- X env_buf[ 3 ] = 0;
- X }
- X else
- X {
- X for ( c = 0; c < 4; ++c )
- X {
- X env_buf[ c ] = env_buf[ c + 4 ];
- X }
- X }
- X sprintf( clock_buf, ": %02d:%02d:%02d",
- X tp->tm_hour, tp->tm_min, tp->tm_sec );
- X strcat( env_buf, clock_buf );
- X ui_str( ti_window->u_x1 + SIDE_SPACE,
- X ti_window->u_y2 - ( 2 * ui_grwind->fysize ),
- X ti_window->u_x2,
- X cl_mback, cl_mfore, env_buf );
- X sprintf( clock_buf, "%s: %ld %s", SFSX_MET,
- X sfsx_getmet() / (long) 86400, SFSX_DAYS );
- X ui_str( ti_window->u_x1 + SIDE_SPACE,
- X ti_window->u_y2 - ( 3 * ui_grwind->fysize ),
- X ti_window->u_x2,
- X cl_mback, cl_mfore, clock_buf );
- X ticks = sfsx_getmet() + EL_EPOCH;
- X if ( ( tp = gmtime( &ticks )) == NULL )
- X {
- X sprintf( clock_buf, " " );
- X }
- X else
- X {
- X sprintf( clock_buf, "%s: %02d:%02d:%02d ", SFSX_MET,
- X tp->tm_hour, tp->tm_min, tp->tm_sec );
- X }
- X ui_str( ti_window->u_x1 + SIDE_SPACE,
- X ti_window->u_y2 - ( 4 * ui_grwind->fysize ),
- X ti_window->u_x2,
- X cl_mback, cl_mfore, clock_buf );
- X }
- X
- /* Main SFS Screen */
- X
- cp_ms()
- X {
- X
- X /* Draw the window itself */
- X
- X sprintf( sfsx_tbuf, SFSX_TITLE, VERSION );
- X main_window = ui_window( 0, 0, ui_grwind->xmax, ui_grwind->ymax,
- X TRUE, cl_marker, cl_mfore, sfsx_tbuf,
- X FALSE, cl_mback, FALSE, BLACK, cl_mback, GRID, BUT_CLOSE );
- X
- #ifdef OLD_DEBUG
- X kb_rx();
- #endif
- X
- X /* Draw two lines demarcating help area */
- X
- X gr_line( GR_PRIMARY, ui_grwind->xmax / 2, main_window->tbar_y1,
- X ui_grwind->xmax / 2, main_window->y2, cl_mfore, SOLID );
- X gr_line( GR_PRIMARY, ( ui_grwind->xmax / 2 ) + 2,
- X main_window->tbar_y1,
- X ( ui_grwind->xmax / 2 ) + 2,
- X main_window->y2, cl_mfore, SOLID );
- X
- X /* Record the help area */
- X
- X
- X help_y1 = main_window->tbar_y1;
- X help_y2 = main_window->y2 + ( ( ui_grwind->fysize ) * 0.3 );
- X help_x1 = ( main_window->x2 / 2 ) + 5;
- X help_x2 = main_window->tbar_x2;
- X
- X }
- X
- /* SFS Help Display */
- X
- sfsx_help( mes )
- X char *mes;
- X {
- X ui_fbox( help_x1, main_window->tbar_y1,
- X main_window->tbar_x2, main_window->tbar_y2,
- X cl_marker, SOLID );
- X
- X ui_str( help_x1, help_y1, help_x2,
- X cl_marker, BLACK, mes );
- X
- X }
- X
- /* Set up Control Panel Windows */
- X
- cp_boxes()
- X {
- X int x1, x2, y1, y2, height, cp_side, decrement;
- X cp_side = ( ui_grwind->xmax / 9 ) * 2;
- X
- X /* blank the box area */
- X
- X cp_window = ui_window( main_window->u_x1, main_window->u_y1,
- X cp_side, main_window->u_y2,
- X FALSE, cl_mback, cl_mfore, "",
- X FALSE, cl_mback, FALSE, BLACK, BLACK, SOLID, FALSE );
- X
- X fo_window = ui_window( cp_side, main_window->u_y1,
- X main_window->u_x2, main_window->u_y2,
- X FALSE, cl_mback, cl_mfore, "",
- X TRUE, cl_mback, FALSE, BLACK, cl_mback, GRID, FALSE );
- X
- X ui_fbox( fo_window->u_x1, fo_window->u_y1, fo_window->u_x2,
- X fo_window->u_y2, WHITE, GRID );
- X
- X decrement = ( ( cp_window->u_y2 - cp_window->u_y1 ) / 3 ) - 8;
- X
- X y2 = cp_window->u_y2 - 2;
- X y1 = cp_window->u_y2 - decrement;
- X x1 = cp_window->u_x1 + 2;
- X x2 = cp_window->u_x2 - 2;
- X
- X po_window = ui_window( x1, y1, x2, y2, TRUE, cl_marker, BLACK,
- X SFSX_PROG, FALSE, cl_mback, FALSE, BLACK, cl_mback, SOLID, FALSE );
- X
- X y2 = y1 - 2;
- X y1 = y2 - decrement;
- X
- X ti_window = ui_window( x1, y1, x2, y2, TRUE, cl_marker, BLACK,
- X SFSX_TIME, FALSE, BLACK, FALSE, BLACK, WHITE, SOLID, FALSE );
- X
- X y2 = y1 - 2;
- X y1 = cp_window->u_y1 + 2;
- X
- X sy_window = ui_window( x1, y1, x2, y2, TRUE, cl_marker, BLACK,
- X SFSX_SYS, FALSE, BLACK, FALSE, BLACK, WHITE, SOLID, FALSE );
- X
- X }
- X
- /****************************************************************
- X
- X cp_lwin() Draw large focus window
- X
- ****************************************************************/
- X
- cp_lwin( uiwind, title )
- X struct uiwindow **uiwind;
- X char *title;
- X {
- X
- X if ( *uiwind == NULL )
- X {
- X *uiwind = ui_window( fo_window->u_x1, fo_window->u_y1,
- X fo_window->u_x2, fo_window->u_y2, TRUE, cl_marker, FALSE,
- X title, FALSE, BLACK, FALSE, BLACK, BLACK, SOLID, FALSE );
- X }
- X else
- X {
- X ui_rewindow( *uiwind, title );
- X }
- X
- X }
- X
- /****************************************************************
- X
- X cp_twin() Draw small top focus window
- X
- ****************************************************************/
- X
- cp_twin( uiwind, title )
- X struct uiwindow **uiwind;
- X char *title;
- X {
- X int midx, midy;
- X
- X if ( *uiwind == NULL )
- X {
- X
- X midx = fo_window->u_x1 + ( ( fo_window->u_x2 - fo_window->u_x1 ) / 2 );
- X midy = fo_window->u_y1 + ( ( fo_window->u_y2 - fo_window->u_y1 ) / 2 );
- X
- X *uiwind = ui_window(
- X fo_window->u_x1 + 1,
- X midy + 1,
- X fo_window->u_x2 - 1,
- X fo_window->u_y2 - 1,
- X TRUE, cl_marker, BLACK,
- X title, TRUE, WHITE, FALSE, BLACK, BLACK, SOLID, FALSE );
- X
- X }
- X else
- X {
- X ui_rewindow( *uiwind, title );
- X }
- X
- X }
- X
- /****************************************************************
- X
- X cp_bwin() Draw small bottom focus window
- X
- ****************************************************************/
- X
- cp_bwin( uiwind, title )
- X struct uiwindow **uiwind;
- X char *title;
- X {
- X int midx, midy;
- X
- X if ( *uiwind == NULL )
- X {
- X
- X midx = fo_window->u_x1 + ( ( fo_window->u_x2 - fo_window->u_x1 ) / 2 );
- X midy = fo_window->u_y1 + ( ( fo_window->u_y2 - fo_window->u_y1 ) / 2 );
- X
- X *uiwind = ui_window(
- X fo_window->u_x1 + 1,
- X fo_window->u_y1 + 1,
- X fo_window->u_x2 - 1,
- X midy - 1,
- X TRUE, cl_marker, FALSE,
- X title, TRUE, WHITE, FALSE, BLACK, BLACK, SOLID, FALSE );
- X }
- X else
- X {
- X ui_rewindow( *uiwind, title );
- X }
- X }
- X
- sfsx_font( size )
- X int size;
- X {
- X static int oldsize = 159;
- X int rq_height, calcy;
- X
- X if ( size == oldsize )
- X {
- X return;
- X }
- X
- X if ( ui_grwind->ymax > MAXYSIZE )
- X {
- X calcy = MAXYSIZE;
- X }
- X else
- X {
- X calcy = ui_grwind->ymax;
- X }
- X
- X switch( size )
- X {
- X case 1:
- X rq_height = calcy / 25;
- X break;
- X case 2:
- X rq_height = calcy / 15;
- X break;
- X default:
- X rq_height = calcy / 30;
- X break;
- X }
- X
- X gr_font( GR_PRIMARY, F_DEFAULT, rq_height );
- X }
- X
- bw_message( mes )
- X char *mes;
- X {
- X ui_fbox( sy_window->u_x1, sy_window->u_y1, sy_window->u_x2,
- X sy_window->u_y2,
- X cl_mback, SOLID );
- X ui_text( sy_window->u_x1 + SIDE_SPACE, sy_window->u_y1,
- X sy_window->u_x2, sy_window->u_y2,
- X 5, cl_mback, cl_mfore, mes );
- X }
- X
- err_init()
- X {
- X static size_t x_size;
- X static int x1, x2, y1, y2, height, length, midx, midy, c;
- X
- #ifdef OLD_DEBUG
- X fprintf( stderr, "err_init(): enter function\n" );
- #endif
- X
- X midx = main_window->u_x1 + ( ( main_window->u_x2 - main_window->u_x1 ) / 2 );
- X midy = main_window->u_y1 + ( ( main_window->u_y2 - main_window->u_y1 ) / 2 );
- X
- #ifdef OLD_DEBUG
- X fprintf( stderr, "err_init(): calculate length\n" );
- #endif
- X
- X length = main_window->u_x2 / 2;
- X x1 = midx - length / 2;
- X x2 = midx + length / 2;
- X height = main_window->u_y2 / 2;
- X y1 = midy - height / 2;
- X y2 = midy + height / 2;
- X
- #ifdef OLD_DEBUG
- X fprintf( stderr, "err_init(): call imsize\n" );
- #endif
- X
- X }
- X
- bw_error( mes )
- X char *mes;
- X {
- X static char buffer[ BW_EBUFSIZE ];
- X static int x1 = 0, x2, y1, y2, height, length, midx, midy, c;
- X static struct uiwindow *err_window; /* structure for error window */
- X static int err_mem;
- X
- X if ( err_mem == NULL )
- X {
- X fprintf( stderr, "ERROR: %s\n", mes );
- X kb_rx();
- X return 0;
- X }
- X
- X if ( x1 == 0 )
- X {
- X
- X midx = main_window->u_x1 + ( ( main_window->u_x2 - main_window->u_x1 ) / 2 );
- X midy = main_window->u_y1 + ( ( main_window->u_y2 - main_window->u_y1 ) / 2 );
- X
- X length = main_window->u_x2 / 2;
- X x1 = midx - length / 2;
- X x2 = midx + length / 2;
- X height = main_window->u_y2 / 2;
- X y1 = midy - height / 2;
- X y2 = midy + height / 2;
- X
- X }
- X
- X ui_push(); /* save ui screen */
- X ui_setscreen( GR_PRIMARY );
- X gr_imsave( GR_PRIMARY, TRUE, x1, y1, x2, y2, &err_mem );
- X buffer[ 0 ] = 0;
- X sprintf( buffer, ERR_PROMPT, mes );
- X c = ui_yn( x1, y1, x2, y2, cl_mback, cl_mfore, cl_marker, TRUE,
- X buffer, ERRP_NO, ERRP_YES, &err_window );
- X gr_imsave( GR_PRIMARY, FALSE, x1, y1, x2, y2, &err_mem );
- X gr_imfree( err_mem );
- X
- X if ( c == FALSE )
- X {
- X sfs_exit();
- X exit( 1 );
- X }
- X sfsx_help( SFSX_HELP );
- X ui_pop();
- X }
- X
- #ifdef DEBUG
- bw_debug( mes )
- X char *mes;
- X {
- X static char buffer[ 256 ];
- X static int x_mem;
- X static size_t x_size;
- X static int x1 = 0, x2, y1, y2, height, length, midx, midy, c;
- X static struct uiwindow *d_window; /* structure for debug window */
- X
- #ifdef SMALL_DEBUG
- X sprintf( buffer, "DEBUG: %s ", mes );
- X gr_text( GR_PRIMARY, 5, 5, buffer, BLACK, WHITE );
- X ui_wait();
- #else
- X if ( x1 == 0 )
- X {
- X
- X midx = main_window->u_x1 + ( ( main_window->u_x2 - main_window->u_x1 ) / 2 );
- X midy = main_window->u_y1 + ( ( main_window->u_y2 - main_window->u_y1 ) / 2 );
- X
- X length = main_window->u_x2 / 2;
- X x1 = midx - length / 2;
- X x2 = midx + length / 2;
- X height = main_window->u_y2 / 2;
- X y1 = midy - height / 2;
- X y2 = midy + height / 2;
- X
- X }
- X
- X ui_push(); /* save ui screen */
- X ui_setscreen( GR_PRIMARY );
- X gr_imsave( GR_PRIMARY, TRUE, x1, y1, x2, y2, &x_mem );
- X buffer[ 0 ] = 0;
- X sprintf( buffer, "DEBUG: %s", mes );
- X c = ui_alarm( x1, y1, x2, y2, cl_mback, cl_mfore, cl_marker, TRUE,
- X buffer, " OK ", &d_window );
- X gr_imsave( GR_PRIMARY, FALSE, x1, y1, x2, y2, &x_mem );
- X gr_imfree( x_mem );
- X
- X ui_pop();
- X
- #endif
- X }
- #endif
- X
- ui_error( m )
- X char *m;
- X {
- X bw_error( m );
- X }
- X
- matherr( xstruct )
- X struct exception *xstruct;
- X {
- X sprintf( bw_ebuf, ERR_MATH, xstruct->name );
- X bw_error( bw_ebuf );
- X }
- X
- X
- SHAR_EOF
- chmod 0644 sfs/sfs/sfsx_cp.c ||
- echo 'restore of sfs/sfs/sfsx_cp.c failed'
- Wc_c="`wc -c < 'sfs/sfs/sfsx_cp.c'`"
- test 12780 -eq "$Wc_c" ||
- echo 'sfs/sfs/sfsx_cp.c: original size 12780, current size' "$Wc_c"
- rm -f _shar_wnt_.tmp
- fi
- # ============= sfs/sfs/sfsx_n.mak ==============
- if test -f 'sfs/sfs/sfsx_n.mak' -a X"$1" != X"-c"; then
- echo 'x - skipping sfs/sfs/sfsx_n.mak (File already exists)'
- rm -f _shar_wnt_.tmp
- else
- > _shar_wnt_.tmp
- echo 'x - extracting sfs/sfs/sfsx_n.mak (Text)'
- sed 's/^X//' << 'SHAR_EOF' > 'sfs/sfs/sfsx_n.mak' &&
- PROJ =SFSX
- DEBUG =0
- CC =qcl
- CFLAGS_G = /AL /W1 /Ze /DDEBUG /I..\..\include
- CFLAGS_D = /Zi /Zr /Gi$(PROJ).mdt /Od
- CFLAGS_R = /O /Ot /DNDEBUG
- CFLAGS =$(CFLAGS_G) $(CFLAGS_R)
- LFLAGS_G = /CP:0xffff /NOI /NOE /SE:0x80 /ST:0x1000
- LFLAGS_D = /CO /M /INCR
- LFLAGS_R =
- LFLAGS =$(LFLAGS_G) $(LFLAGS_R)
- RUNFLAGS =
- OBJS_A = ..\..\lib\dr_ibmpc.obj ..\..\lib\gr_ibmpc.obj \
- X ..\..\lib\kb_ibmpc.obj ..\..\lib\ui_boxes.obj
- OBJS_B = ..\..\lib\ui_dial.obj ..\..\lib\ui_gets.obj \
- X ..\..\lib\ui_init.obj
- OBJS_C = ..\..\lib\ui_list.obj ..\..\lib\ui_text.obj ..\..\lib\ui_pbm.obj
- LIBS_EXT =
- X
- all: $(PROJ).exe
- X
- sfsx_cp.obj: sfsx_cp.c
- X
- sfsx_sp.obj: sfsx_sp.c
- X
- sfsx_var.obj: sfsx_var.c
- X
- sfsx.obj: sfsx.c
- X
- as_orbit.obj:
- X $(CC) $(CFLAGS) -c ..\as\as_orbit.c
- X
- as_vpt.obj:
- X $(CC) $(CFLAGS) -c ..\as\as_vpt.c
- X
- as_spj.obj:
- X $(CC) $(CFLAGS) -c ..\as\as_spj.c
- X
- as_focus.obj:
- X $(CC) $(CFLAGS) -c ..\as\as_focus.c
- X
- sfs_ft.obj: sfs_ft.c
- X
- sfs_gt.obj: sfs_gt.c
- X
- sfs_pe.obj: sfs_pe.c
- X
- sfs_pr.obj: sfs_pr.c
- X
- sfs_vi.obj: sfs_vi.c
- X
- sfs_di.obj: sfs_di.c
- X
- $(PROJ).exe: sfsx_cp.obj sfsx_sp.obj sfsx_var.obj as_orbit.obj \
- X as_vpt.obj as_spj.obj \
- X sfsx.obj as_focus.obj sfs_ft.obj sfs_gt.obj sfs_pe.obj \
- X sfs_pr.obj sfs_vi.obj sfs_di.obj \
- X $(OBJS_A) \
- X $(OBJS_B) \
- X $(OBJS_C)
- X echo >NUL @<<$(PROJ).crf
- sfsx_cp.obj +
- sfsx_sp.obj +
- sfsx_var.obj +
- as_orbit.obj +
- as_vpt.obj +
- as_spj.obj +
- sfsx.obj +
- as_focus.obj +
- sfs_ft.obj +
- sfs_gt.obj +
- sfs_pe.obj +
- sfs_pr.obj +
- sfs_vi.obj +
- sfs_di.obj +
- $(OBJS_A) +
- $(OBJS_B) +
- $(OBJS_C)
- $(PROJ).exe
- X
- $(LIBS_EXT);
- <<
- X link $(LFLAGS) @$(PROJ).crf
- X
- run: $(PROJ).exe
- X $(PROJ) $(RUNFLAGS)
- X
- SHAR_EOF
- chmod 0644 sfs/sfs/sfsx_n.mak ||
- echo 'restore of sfs/sfs/sfsx_n.mak failed'
- Wc_c="`wc -c < 'sfs/sfs/sfsx_n.mak'`"
- test 1726 -eq "$Wc_c" ||
- echo 'sfs/sfs/sfsx_n.mak: original size 1726, current size' "$Wc_c"
- rm -f _shar_wnt_.tmp
- fi
- # ============= sfs/sfs/sfsx_sp.c ==============
- if test -f 'sfs/sfs/sfsx_sp.c' -a X"$1" != X"-c"; then
- echo 'x - skipping sfs/sfs/sfsx_sp.c (File already exists)'
- rm -f _shar_wnt_.tmp
- else
- > _shar_wnt_.tmp
- echo 'x - extracting sfs/sfs/sfsx_sp.c (Text)'
- sed 's/^X//' << 'SHAR_EOF' > 'sfs/sfs/sfsx_sp.c' &&
- /****************************************************************
- X
- X sfsx_sp.c Set Orbital Parameters Routines
- X for Space Flight Simulator,
- X Simulation Module
- X
- X Copyright (c) 1991, Ted A. Campbell
- X
- X Bywater Software
- X P. O. Box 4023
- X Duke Station
- X Durham, NC 27706
- X
- X email: tcamp@hercules.acpub.duke.edu
- X
- X Copyright and Permissions Information:
- X
- X All U.S. and international copyrights are claimed by the
- X author. The author grants permission to use this code
- X and software based on it under the following conditions:
- X (a) in general, the code and software based upon it may be
- X used by individuals and by non-profit organizations; (b) it
- X may also be utilized by governmental agencies in any country,
- X with the exception of military agencies; (c) the code and/or
- X software based upon it may not be sold for a profit without
- X an explicit and specific permission from the author, except
- X that a minimal fee may be charged for media on which it is
- X copied, and for copying and handling; (d) the code must be
- X distributed in the form in which it has been released by the
- X author; and (e) the code and software based upon it may not
- X be used for illegal activities.
- X
- ****************************************************************/
- X
- #include "stdio.h"
- #include "sfsx.h"
- X
- #ifdef __STDC__
- #include "malloc.h"
- #include "stdlib.h"
- #else
- extern char * malloc();
- #define size_t int
- #endif
- X
- #define SYS_TITLES 4
- X
- extern int fo_xcenter, fo_ycenter;
- extern long get_long();
- static char *sys_titles[ SYS_TITLES ];
- static char set_buffer[ 128 ];
- static struct menu_box ssp_box;
- X
- fw_grid()
- X {
- X ui_fbox( fo_window->u_x1, fo_window->u_y1,
- X fo_window->u_x2, fo_window->u_y2, BLACK, SOLID );
- X ui_fbox( fo_window->u_x1, fo_window->u_y1,
- X fo_window->u_x2, fo_window->u_y2, WHITE, GRID );
- X }
- X
- /****************************************************************
- X
- X ssp() Set System Parameters
- X
- ****************************************************************/
- X
- ssp()
- X {
- X register int c, y;
- X static int sysp_init = FALSE;
- X static int x_x1 = 0, x_y1 = 0, x_x2 = 0, x_y2 = 0;
- X int test, item;
- X static int x_ebuf;
- X
- X if ( x_x1 == 0 )
- X {
- X x_x1 = (int) fo_xcenter - ( ui_grwind->xmax / 4 );
- X x_y1 = (int) fo_ycenter - ( ui_grwind->fysize * 6 );
- X x_x2 = (int) fo_xcenter + ( ui_grwind->xmax / 4 );
- X x_y2 = (int) fo_ycenter + ( ui_grwind->fysize * 5 );
- X }
- X
- X if ( sysp_init == FALSE )
- X {
- X for ( c = 0; c < SYS_TITLES; ++c )
- X {
- X if ( ( sys_titles[ c ] = malloc( 64 ) ) == NULL )
- X {
- X bw_error( MEMERR_SSP );
- X return;
- X }
- X }
- X sysp_init = TRUE;
- X }
- X
- X gr_imsave( GR_PRIMARY, TRUE, x_x1, x_y1, x_x2, x_y2, &x_ebuf );
- X
- X y = TRUE;
- X while( y == TRUE )
- X {
- X
- X /* set up titles for menu */
- X
- X sprintf( sys_titles[ 0 ], SSP_TF,
- X (long) sfs_tfactor );
- X sprintf( sys_titles[ 1 ], SSP_UI,
- X (long) sfs_inc );
- X sprintf( sys_titles[ 2 ], SSP_TPL,
- X vpt_level );
- X sprintf( sys_titles[ 3 ], SSP_EXIT );
- X
- X item = ui_list( MENU_SLIDERS, x_x1, x_y1, x_x2, x_y2,
- X SSP_TITLE, SYS_TITLES,
- X sys_titles, cl_mfore, cl_mback, cl_marker,
- X &ssp_box );
- X
- X /* Process the argument */
- X
- X switch( item )
- X {
- X case 0:
- X sfs_tfactor = get_long( TF_TITLE,
- X TF_LEGEND,
- X TF_PROMPT,
- X (long) sfs_tfactor,
- X (long) 1, (long) 0 );
- X ssp_box.is_drawn = FALSE;
- X break;
- X case 1:
- X sfs_inc = get_long( UI_TITLE,
- X UI_LEGEND,
- X UI_PROMPT,
- X (long) sfs_inc,
- X (long) 1, (long) 0 );
- X ssp_box.is_drawn = FALSE;
- X break;
- X case 2:
- X vpt_level = get_int( TPL_TITLE,
- X TPL_LEGEND,
- X TPL_PROMPT,
- X vpt_level, 1, 2 );
- X ssp_box.is_drawn = FALSE;
- X break;
- X case TK_EXIT:
- X case 3:
- X y = FALSE;
- X break;
- X }
- X }
- X
- X gr_imsave( GR_PRIMARY, FALSE, x_x1, x_y1, x_x2, x_y2, &x_ebuf );
- X gr_imfree( x_ebuf );
- X
- X }
- X
- /****************************************************************
- X
- X sdi() Set Display
- X
- ****************************************************************/
- X
- sdi( d_titles, n_titles, title )
- X char **d_titles;
- X int n_titles;
- X char *title;
- X {
- X register int c, y;
- X static struct menu_box sdi_box;
- X int test, item;
- X static int x_x1 = 0, x_y1 = 0, x_x2 = 0, x_y2 = 0;
- X static int x_ebuf;
- X
- X if ( x_x1 == 0 )
- X {
- X x_x1 = (int) fo_xcenter - ( ui_grwind->xmax / 4 );
- X x_y1 = (int) fo_ycenter - ( ui_grwind->fysize * 7 );
- X x_x2 = (int) fo_xcenter + ( ui_grwind->xmax / 4 );
- X x_y2 = (int) fo_ycenter + ( ui_grwind->fysize * 5 );
- X }
- X
- X gr_imsave( GR_PRIMARY, TRUE, x_x1, x_y1, x_x2, x_y2, &x_ebuf );
- X
- X sdi_box.is_drawn = FALSE;
- X item = ui_list( MENU_SLIDERS, x_x1, x_y1, x_x2, x_y2,
- X title, n_titles,
- X d_titles, cl_mfore, cl_mback, cl_marker,
- X &sdi_box );
- X
- X gr_imsave( GR_PRIMARY, FALSE, x_x1, x_y1, x_x2, x_y2, &x_ebuf );
- X gr_imfree( x_ebuf );
- X
- X return item;
- X
- X }
- X
- get_int( title, text, prompt, oldvalue, minimum, maximum )
- X char *title, *text, *prompt;
- X int oldvalue, minimum, maximum;
- X {
- X char *_text;
- X int y;
- X static int n;
- X
- X _text = text;
- X y = 1;
- X while( y == 1 )
- X {
- X ui_dial( ssp_box.window->x1, ssp_box.window->y1, ssp_box.window->x2, ssp_box.window->y2, cl_mback, cl_mfore,
- X cl_marker, 1, title,
- X _text, prompt, set_buffer, &ssp_box.window );
- X if ( set_buffer[ 0 ] == 0 )
- X {
- X return oldvalue;
- X }
- X
- X sscanf( set_buffer, "%d", &n );
- X y = 0;
- X if ( n < minimum )
- X {
- X sprintf( sfsx_tbuf, "%s %ld; %s.", MINERR, minimum - 1, PTA );
- X _text = sfsx_tbuf;
- X y = 1;
- X }
- X if ( ( maximum != 0 ) && ( n > maximum ))
- X {
- X y = 1;
- X sprintf( sfsx_tbuf, "%s %ld; %s.", MAXERR, maximum + 1, PTA );
- X _text = sfsx_tbuf;
- X }
- X }
- X
- X return n;
- X }
- X
- long
- get_long( title, text, prompt, oldvalue, minimum, maximum )
- X char *title, *text, *prompt;
- X long oldvalue, minimum, maximum;
- X {
- X char *_text;
- X int y;
- X static long n;
- X
- X _text = text;
- X y = 1;
- X while( y == 1 )
- X {
- X ui_dial( ssp_box.window->x1, ssp_box.window->y1, ssp_box.window->x2, ssp_box.window->y2, cl_mback, cl_mfore,
- X cl_marker, 1, title,
- X _text, prompt, set_buffer, &ssp_box.window );
- X
- X if ( set_buffer[ 0 ] == 0 )
- X {
- X return oldvalue;
- X }
- X
- X sscanf( set_buffer, "%ld", &n );
- X y = 0;
- X if ( n < minimum )
- X {
- X sprintf( sfsx_tbuf, "%s %ld; %s.", MINERR, minimum - 1, PTA );
- X _text = sfsx_tbuf;
- X y = 1;
- X }
- X if ( ( maximum != 0 ) && ( n > maximum ))
- X {
- X y = 1;
- X sprintf( sfsx_tbuf, "%s %ld; %s.", MAXERR, maximum + 1, PTA );
- X _text = sfsx_tbuf;
- X }
- X }
- X
- X return n;
- X }
- X
- SHAR_EOF
- chmod 0644 sfs/sfs/sfsx_sp.c ||
- echo 'restore of sfs/sfs/sfsx_sp.c failed'
- Wc_c="`wc -c < 'sfs/sfs/sfsx_sp.c'`"
- test 6678 -eq "$Wc_c" ||
- echo 'sfs/sfs/sfsx_sp.c: original size 6678, current size' "$Wc_c"
- rm -f _shar_wnt_.tmp
- fi
- # ============= sfs/sfs/sfsx_var.c ==============
- if test -f 'sfs/sfs/sfsx_var.c' -a X"$1" != X"-c"; then
- echo 'x - skipping sfs/sfs/sfsx_var.c (File already exists)'
- rm -f _shar_wnt_.tmp
- else
- > _shar_wnt_.tmp
- echo 'x - extracting sfs/sfs/sfsx_var.c (Text)'
- sed 's/^X//' << 'SHAR_EOF' > 'sfs/sfs/sfsx_var.c' &&
- /****************************************************************
- X
- X sfsx_var.c Global Variables
- X for Space Flight Simulator,
- X Simulation Module
- X
- X Copyright (c) 1991, Ted A. Campbell
- X
- X Bywater Software
- X P. O. Box 4023
- X Duke Station
- X Durham, NC 27706
- X
- X email: tcamp@hercules.acpub.duke.edu
- X
- X Copyright and Permissions Information:
- X
- X All U.S. and international copyrights are claimed by the
- X author. The author grants permission to use this code
- X and software based on it under the following conditions:
- X (a) in general, the code and software based upon it may be
- X used by individuals and by non-profit organizations; (b) it
- X may also be utilized by governmental agencies in any country,
- X with the exception of military agencies; (c) the code and/or
- X software based upon it may not be sold for a profit without
- X an explicit and specific permission from the author, except
- X that a minimal fee may be charged for media on which it is
- X copied, and for copying and handling; (d) the code must be
- X distributed in the form in which it has been released by the
- X author; and (e) the code and software based upon it may not
- X be used for illegal activities.
- X
- ****************************************************************/
- X
- #include "sfsx.h"
- X
- long sfs_insertion; /* Moment of orbital insertion */
- long sfsx_epoch; /* Orbital epoch in seconds since beginning */
- long sfs_tfactor; /* time factor */
- int sfs_display = 0; /* Screen: 0 = visual simulation at top */
- X /* 1 = distant perspective at top */
- X /* 2 = zoom (full) visual */
- X
- struct sfs_orbit *sfsx_orbits[ ORBITS ];
- X /* Structures for orbital data */
- char sfsx_tbuf[ 256 ]; /* a scratch buffer */
- X
- char bw_ebuf[ BW_EBUFSIZE ];
- X
- int al_hor, al_vert;
- long sfsx_dp;
- long sfs_inc;
- X
- struct spj_pt spd_start, spd_end; /* surface data pointers */
- struct spj_pt gr_start, gr_end; /* grid data pointers */
- struct spj_pt pd_start, pd_end; /* point data pointers */
- struct spj_pt or_start, or_end; /* orb data pointers */
- X
- struct as_focus sfsx_focus; /* orbital focus structure */
- char sfsx_gridfile[ 32 ]; /* grid spd file */
- X
- int cp_height, cp_space, cp_center;
- X
- char sp_tbuf[ 64 ];
- X
- int gt_color; /* Color for ground track plot */
- X
- char pd_name[ 128 ];
- char pd_file[ 32 ];
- X
- char pr_name[ 128 ];
- int sfsx_display = 0; /* Screen: 0 = visual simulation in top */
- X /* 1 = distant perspective in top */
- X /* 2 = zoom (full) visual */
- X
- X
- struct uiwindow *main_window; /* structure for main window */
- struct uiwindow *po_window; /* structure for focus panel */
- struct uiwindow *ti_window; /* structure for relation window */
- struct uiwindow *sy_window; /* structure for timing window */
- struct uiwindow *cp_window; /* structure for control panel box */
- struct uiwindow *fo_window; /* structure for focus window */
- struct uiwindow *z_window; /* structure for zoom window */
- struct uiwindow *t_window; /* top window */
- struct uiwindow *b_window; /* bottom window */
- X
- int help_y1; /* line for help display */
- int help_y2; /* top of help display */
- int help_x1; /* column for help display */
- int help_x2; /* max col for help display */
- X
- /* Colors */
- X
- int cl_mback; /* Main background color */
- int cl_mfore; /* Main foreground color */
- int cl_marker; /* Color for prompt markers */
- int cl_grid; /* Color for planetary grid */
- int cl_surface; /* Color for planetary surface */
- int cl_orbits[ 6 ]; /* Colors for different orbits */
- X
- X
- SHAR_EOF
- chmod 0644 sfs/sfs/sfsx_var.c ||
- echo 'restore of sfs/sfs/sfsx_var.c failed'
- Wc_c="`wc -c < 'sfs/sfs/sfsx_var.c'`"
- test 3875 -eq "$Wc_c" ||
- echo 'sfs/sfs/sfsx_var.c: original size 3875, current size' "$Wc_c"
- rm -f _shar_wnt_.tmp
- fi
- # ============= smallfont/read.me ==============
- if test ! -d 'smallfont'; then
- echo 'x - creating directory smallfont'
- mkdir 'smallfont'
- fi
- if test -f 'smallfont/read.me' -a X"$1" != X"-c"; then
- echo 'x - skipping smallfont/read.me (File already exists)'
- rm -f _shar_wnt_.tmp
- else
- > _shar_wnt_.tmp
- echo 'x - extracting smallfont/read.me (Binary)'
- sed 's/^X//' << 'SHAR_EOF' > _shar_tmp_.tmp &&
- begin 600 smallfont/read.me
- M1G)O;2!D=6ME86,A96-S=F%X+G5N8V5C<RYE9'4A;6-N8R%R=71G97)S(6-S
- M+G5T97AA<RYE9'4A>6%L92%C<RYY86QE+F5D=2%Y87)V:6XM;F]R;6%N(%-U
- M;B!-87(@,3@@,34Z,S<Z,C<@15-4(#$Y.3`*07)T:6-L92`R.34S(&]F(&-O
- M;7`N<WES+F%T=#H*4&%T:#H@;G5M96XA9'5K96%C(65C<W9A>"YU;F-E8W,N
- M961U(6UC;F,A<G5T9V5R<R%C<RYU=&5X87,N961U(7EA;&4A8W,N>6%L92YE
- M9'4A>6%R=FEN+6YO<FUA;@H^1G)O;3H@>6%R=FEN+6YO<FUA;D!#4RY986QE
- M+D5$52`H;F]R;6%N('EA<G9I;BD*3F5W<V=R;W5P<SH@8V]M<"YS>7,N871T
- M"E-U8FIE8W0Z(%1H92`S-G@Q,#(@9F]N="`H56YI>"!00RD*365S<V%G92U)
- M1#H@/#$X-S<Y0&-S+GEA;&4N961U/@I$871E.B`Q,B!-87(@.3`@,#(Z-38Z
- M,#@@1TU4"E-E;F1E<CH@;F5W<T!C<RYY86QE+F5D=0I/<F=A;FEZ871I;VXZ
- M(%EA;&4@56YI=F5R<VET>2!#;VUP=71E<B!38VEE;F-E($1E<'0L($YE=R!(
- M879E;B!#5"`@,#8U,C`M,C$U.`I,:6YE<SH@,38U.`H*5&AI<R!I<R!T:&4@
- M,S9X,3`R("@X(&)I=',@:&EG:"!B>2`W(&)I=',@=VED92D@9F]N="!T:&%T
- M('=A<R!P;W-T960@82!W:&EL90IA9V\N("!)(&AA=F4@;6%D92!S979E<F%L
- M(&-H86YG97,@=&\@:70N("!)(&UU8V@@<')E9F5R('1H:7,@9F]N="!T;R!E
- M:71H97(*=&AE(#(X>#$R,"!O<B!T:&4@,S9X,30T(&9O;G1S+"!W:&EC:"!P
- M96]P;&4@:&%V92!A9'9O8V%T960@=7-I;F<N("!(;W=E=F5R+`IS;VUE('!E
- M;W!L92!H879E(&EN9&EC871E9"!T:&%T('1H:7,@9F]N="!I<R!T;V\@<VUA
- M;&P@9F]R('1H96TN"@I&;W(@=&AO<V4@=6YA<75A:6YT960@=VET:"!F;VYT
- M<R!O;B!T:&4@56YI>"!00RP@=&AE(')E;&5V86YT(&-O;6UA;F1S(&%R90IC
- M9F]N="@Q*2!A;F0@<V5T9B@Q*2]S9F]N="@Q*2X@($]N92!C86X@;6%K92!A
- M(&9O;G0@=&AE(&1E9F%U;'0@<WES=&5M(&9O;G0*8GD@<'5T=&EN9R!T:&4@
- M;&EN90H*"7-F;VYT("US(#QF;VYT9FEL93X@,`H*:6X@+V5T8R\N9F]N=&QO
- M860N"@I4:&4@8V]M;6%N9"`B<V5T9B!F;VYT9FEL92`P(B!R97!L86-E<R!T
- M:&4@9&5F875L="!F;VYT+"!I;B!T:&4@8W5R<F5N=`IW:6YD;W<N("!(;W=E
- M=F5R+"!I9B!A('-M86QL97(@9F]N="!I<R!L;V%D960L('5N9&5R(&-E<G1A
- M:6X@8V]N9&ET:6]N<R!T:&4*8W5R<V]R('-I>F4@=VEL;"!N;W0@8F4@=7!D
- M871E9"X@(%1H92!F;VQL;W=I;F<@<V5Q=65N8V4@;V8@8V]M;6%N9',@:&%S
- M(&)E96X*9F]U;F0@=&\@=V]R:RX@($ET('=A<R!H:70@=7!O;B!B>2!A8V-I
- M9&5N="P@86YD($D@:&%V92!N;R!I9&5A('=H>2!I="!W;W)K<RX*"G-E=&8@
- M-SL@<V5T9B`\9F]N=&9I;&4^(#<[('-E=&8@,#L@<V5T9B`\9F]N=&9I;&4^
- %(#`*"@IT
- `
- end
- SHAR_EOF
- echo 'uudecoding file smallfont/read.me' &&
- uudecode < _shar_tmp_.tmp && rm -f _shar_tmp_.tmp &&
- chmod 0644 smallfont/read.me ||
- echo 'restore of smallfont/read.me failed'
- Wc_c="`wc -c < 'smallfont/read.me'`"
- test 1400 -eq "$Wc_c" ||
- echo 'smallfont/read.me: original size 1400, current size' "$Wc_c"
- rm -f _shar_wnt_.tmp
- fi
- # ============= smallfont/smallfont ==============
- if test -f 'smallfont/smallfont' -a X"$1" != X"-c"; then
- echo 'x - skipping smallfont/smallfont (File already exists)'
- rm -f _shar_wnt_.tmp
- else
- > _shar_wnt_.tmp
- echo 'x - extracting smallfont/smallfont (Binary)'
- sed 's/^X//' << 'SHAR_EOF' > _shar_tmp_.tmp &&
- begin 600 smallfont/smallfont
- M```!C@`'"`<````````````````````````````````%"`'Y!P`"^@4(`?D'
- M``,"!0@!^0<``PH%"`'Y!P`#$@4(`?D'``,:!0@!^0<``R(%"`'Y!P`#*@4(
- M`?D'``,R!0@!^0<``SH%"`'Y!P`#0@4(`?D'``-*!0@!^0<``U(%"`'Y!P`#
- M6@4(`?D'``-B!0@!^0<``VH%"`'Y!P`#<@4(`?D'``-Z!0@!^0<``X(%"`'Y
- M!P`#B@4(`?D'``.2!0@!^0<``YH%"`'Y!P`#H@4(`?D'``.J!0@!^0<``[(%
- M"`'Y!P`#N@4(`?D'``/"!0@!^0<``\H%"`'Y!P`#T@4(`?D'``/:!0@!^0<`
- M`^(%"`'Y!P`#Z@4(`?D'``/R!0@!^0<``_H%"`'Y!P`$`@4(`?D'``0*!0@!
- M^0<`!!(%"`'Y!P`$&@4(`?D'``0B!0@!^0<`!"H%"`'Y!P`$,@4(`?D'``0Z
- M!0@!^0<`!$(%"`'Y!P`$2@4(`?D'``12!0@!^0<`!%H%"`'Y!P`$8@4(`?D'
- M``1J!0@!^0<`!'(%"`'Y!P`$>@4(`?D'``2"!0@!^0<`!(H%"`'Y!P`$D@4(
- M`?D'``2:!0@!^0<`!*(%"`'Y!P`$J@4(`?D'``2R!0@!^0<`!+H%"`'Y!P`$
- MP@4(`?D'``3*!0@!^0<`!-(%"`'Y!P`$V@4(`?D'``3B!0@!^0<`!.H%"`'Y
- M!P`$\@4(`?D'``3Z!0@!^0<`!0(%"`'Y!P`%"@4(`?D'``42!0@!^0<`!1H%
- M"`'Y!P`%(@4(`?D'``4J!0@!^0<`!3(%"`'Y!P`%.@4(`?D'``5"!0@!^0<`
- M!4H%"`'Y!P`%4@4(`?D'``5:!0@!^0<`!6(%"`'Y!P`%:@4(`?D'``5R!0@!
- M^0<`!7H%"`'Y!P`%@@4(`?D'``6*!0@!^0<`!9(%"`'Y!P`%F@4(`?D'``6B
- M!0@!^0<`!:H%"`'Y!P`%L@4(`?D'``6Z!0@!^0<`!<(%"`'Y!P`%R@4(`?D'
- M``72!0@!^0<`!=H%"`'Y!P`%X@4(`?D'``7J!0@!^0<`!?(`````````````
- M``````````0`!``$``0`!`````0````*``H`"@``````````````"@`*`!\`
- M"@`?``H`"@````0`'@`%``X`%``/``0````3`!,`"``$``(`&0`9`````@`%
- M``4``@`5``D`%@````8`!``"```````````````$``(``0`!``$``@`$````
- M!``(`!``$``0``@`!```````!``5``X`#@`5``0```````0`!``?``0`!```
- M``````````````````8`!``"`````````!\`````````````````````````
- M!``$````$``0``@`!``"``$``0````X`$0`9`!4`$P`1``X````$``8`!0`$
- M``0`!``?````#@`1`!``#@`!``$`'P```!\`$``(``P`$``1``X````(``P`
- M"@`)`!\`"``(````'P`!``$`#P`0`!$`#@````X`$0`!``\`$0`1``X````?
- M`!``"``$``0`!``$````#@`1`!$`#@`1`!$`#@````X`$0`1`!X`$``1``X`
- M``````0`!```````!``$```````$``0```````0`!``"``@`!``"``$``@`$
- M``@`````````'P```!\``````````@`$``@`$``(``0``@````X`$0`0``P`
- M!`````0````.`!$`%0`=``T``0`>````!``*`!$`$0`?`!$`$0````\`$0`1
- M``\`$0`1``\````.`!$``0`!``$`$0`.````#P`1`!$`$0`1`!$`#P```!\`
- M`0`!``\``0`!`!\````?``$``0`/``$``0`!````#@`1``$``0`9`!$`'@``
- M`!$`$0`1`!\`$0`1`!$````.``0`!``$``0`!``.````&``0`!``$``0`!$`
- M#@```!$`"0`%``,`!0`)`!$````!``$``0`!``$``0`?````$0`;`!4`%0`5
- M`!$`$0```!$`$0`3`!4`&0`1`!$````.`!$`$0`1`!$`$0`.````#P`1`!$`
- M#P`!``$``0````X`$0`1`!$`%0`)`!8````/`!$`$0`/``4`"0`1````#@`1
- M``$`#@`0`!$`#@```!\`%0`$``0`!``$``0````1`!$`$0`1`!$`$0`.````
- M$0`1`!$`"@`*``0`!````!$`$0`1`!4`%0`5``H````1`!$`"@`$``H`$0`1
- M````$0`1`!$`"@`$``0`!````!\`$``(``0``@`!`!\````/``$``0`!``$`
- M`0`/`````0`!``(`!``(`!``$````!X`$``0`!``$``0`!X````$``H`$0``
- M````````````````````````````'P````0`!``(````````````````````
- M%@`9`!$`&0`6`````0`!``T`$P`1`!,`#0`````````.``$``0`!``X````0
- M`!``%@`9`!$`&0`6``````````X`$0`?``$`'@````@`%``$``X`!``$``0`
- M````````%@`9`!$`%@`0``X``0`!``T`$P`1`!$`$0````0````&``0`!``$
- M``X````(````#``(``@`"``)``8``0`!`!$`"0`'``D`$0````8`!``$``0`
- M!``$``X`````````"P`5`!4`%0`1``````````T`$P`1`!$`$0`````````.
- M`!$`$0`1``X`````````#0`3`!,`#0`!``$``````!8`&0`1`!8`$``0````
- M```-`!,``0`!``$`````````'@`!``X`$``/````!``$``X`!``$`!0`"```
- M```````1`!$`$0`9`!8`````````$0`1``H`"@`$`````````!$`%0`5`!4`
- M"@`````````1``H`!``*`!$`````````$0`1`!D`%@`0``X``````!\`"``$
- M``(`'P````@`!``$``,`!``$``@````$``0`!``$``0`!``$``0``@`$``0`
- I&``$``0``@`````````"`!4`"``````````?`!\`'P`?`!\`'P`?`!\$
- `
- end
- SHAR_EOF
- echo 'uudecoding file smallfont/smallfont' &&
- uudecode < _shar_tmp_.tmp && rm -f _shar_tmp_.tmp &&
- chmod 0644 smallfont/smallfont ||
- echo 'restore of smallfont/smallfont failed'
- Wc_c="`wc -c < 'smallfont/smallfont'`"
- test 2336 -eq "$Wc_c" ||
- echo 'smallfont/smallfont: original size 2336, current size' "$Wc_c"
- rm -f _shar_wnt_.tmp
- fi
- rm -f _shar_seq_.tmp
- echo You have unpacked the last part
- exit 0
- exit 0 # Just in case...
- --
- Kent Landfield INTERNET: kent@sparky.IMD.Sterling.COM
- Sterling Software, IMD UUCP: uunet!sparky!kent
- Phone: (402) 291-8300 FAX: (402) 291-4362
- Please send comp.sources.misc-related mail to kent@uunet.uu.net.
-