home *** CD-ROM | disk | FTP | other *** search
- Path: uunet!snorkelwacker!usc!wuarchive!cs.utexas.edu!sun-barr!newstop!sun!mipsdal.mips.com
- From: riley@mipsdal.mips.com (Riley Rainey)
- Newsgroups: comp.sources.x
- Subject: v10i002: acm, X aerial combat simulation 1.0 Patch1, Part01/01
- Message-ID: <143894@sun.Eng.Sun.COM>
- Date: 18 Oct 90 18:35:50 GMT
- References: <csx-10i002:acm@uunet.UU.NET>
- Sender: news@sun.Eng.Sun.COM
- Lines: 601
- Approved: argv@sun.com
-
- Submitted-by: riley@mipsdal.mips.com (Riley Rainey)
- Posting-number: Volume 10, Issue 2
- Archive-name: acm/patch1
- Patch-To: acm: Volume 9, Issue 69-73 (10/7/90)
-
- This patch file fixes a a couple of bugs uncovered in acm since its 1.0 release.
- Check the README file for details on these changes. The man page, acm.1,
- has been updated, as well.
-
- To apply these patches, save this article as a file, edit out everything
- before and after the "---> CUT HERE <---" messages and then:
-
- $ cd fsim
- $ patch <this_files_pathname
-
- Note that there is a CUT HERE message at the beginning and at the end of this
- patch file.
-
- No changes were made to the V library. You might want to manually
- change the line in V/test/app.c that reads "#define VIEW3" to "#define
- VIEW1" -- it makes for a bit more interesting test case.
-
- ----> CUT HERE <----
- diff -c ../x/fsim/README ./README
- *** ../x/fsim/README Thu Oct 4 10:34:16 1990
- --- ./README Fri Oct 12 10:28:30 1990
- ***************
- *** 1,5 ****
- ! acm Flight Simulator version 1.0
-
- This software is divided into two major parts: the 3-D graphics routines
- and the flight simulator itself. The 3-D stuff is contained in the V
- directory. V/lib holds the library itself along with imake and make files.
- --- 1,30 ----
- ! acm Flight Simulator version 1.0 patchlevel 1
-
- + What's different with patchlevel 1:
- +
- + A couple of bugs have been fixed. acm now refuses to run on monochrome
- + workstations.
- +
- + If someone could send me patchfiles for the changes required to run on a pure
- + System V system, I'd be in their debt. RISC/OS has a System V ilk, but
- + I don't really have the spare time to change it myself.
- +
- + The documentation has been updated, too. See the acm.1 man page.
- +
- +
- + OUTSTANDING BUGS
- +
- + A couple of people have reported problems with having acm get the keyboard
- + focus when using the Open Look window manager. I don't have access to a Sun
- + system, so I can't toy with it. acm works with uwm; you may want to fall back
- + to that until the problem is isolated.
- +
- + There is another Sun problem that involves core dumps in doViews.c. It is
- + unclear where this is coming from. A compiler bug perhaps?
- +
- +
- + GENERAL NOTES
- +
- This software is divided into two major parts: the 3-D graphics routines
- and the flight simulator itself. The 3-D stuff is contained in the V
- directory. V/lib holds the library itself along with imake and make files.
- ***************
- *** 51,55 ****
- notion of limited aircraft damage. It may in the future.
-
-
- Riley Rainey
- ! October 1, 1990
- --- 76,91 ----
- notion of limited aircraft damage. It may in the future.
-
-
- +
- + CREDITS
- +
- + In the original release, I overlooked several important credits. The
- + input routine at the heart of the acm server is based on code from xtrek
- + that was written by Dan A. Dickey, he has provided some valuable help in
- + improving the robustness of this code. The 3-D routines were written by
- + me, but are based closely on two valuable articles from the March and
- + April 1981 issues of Byte Magazine titled "Three-Dimensional Computer
- + Graphics" by Franklin C. Crow.
- +
- Riley Rainey
- ! October 12, 1990
- diff -c ../x/fsim/acm.1 ./acm.1
- *** ../x/fsim/acm.1 Thu Oct 4 10:34:14 1990
- --- ./acm.1 Wed Oct 10 14:29:02 1990
- ***************
- *** 215,220 ****
- --- 215,227 ----
- W -- Retract
-
-
- + Weapon Controls
- +
- + .LP
- + Mouse Button 2 -- Fire the selected weapon
- + .LP
- + Mouse Button 3 -- Select another weapon
- +
-
- Other Controls
-
- diff -c ../x/fsim/acm.c ./acm.c
- *** ../x/fsim/acm.c Thu Oct 4 10:34:11 1990
- --- ./acm.c Wed Oct 10 16:23:07 1990
- ***************
- *** 74,79 ****
- --- 74,85 ----
- strcat (myhost, display);
- display = myhost;
- }
- + else if (strcmp (display, "unix:0.0") == 0 ||
- + strcmp (display, "unix:0") == 0) {
- + gethostname (myhost, sizeof(myhost));
- + strcat (myhost, ":0.0");
- + display = myhost;
- + }
-
- if ((sin.sin_addr.s_addr = inet_addr (host)) != -1) {
- sin.sin_family = AF_INET;
- diff -c ../x/fsim/aim9m.c ./aim9m.c
- *** ../x/fsim/aim9m.c Thu Oct 4 10:34:25 1990
- --- ./aim9m.c Fri Oct 12 15:45:23 1990
- ***************
- *** 19,24 ****
- --- 19,25 ----
- int getIRTarget();
- extern int fireMissile ();
- extern void createMissileEyeSpace();
- + extern FILE * acm_fopen ();
-
- weaponDesc aim9mDesc = {
- WK_AIM9M,
- ***************
- *** 66,76 ****
- sprintf (s, "%d AIM-9M", count);
- strcpy (c->leftHUD[1], s);
-
- - a1 = w->maxThrust / (w->emptyWeight + w->maxFuel) * a;
- v = mag (c->Cg);
- ! a1 -= c->rho * c->cinfo->CDOrigin * v * v;
-
- ! if (c->curRadarTarget >= 0 && a1 != 0.0) {
-
- d = c->targetDistance;
- r = c->targetClosure;
- --- 67,77 ----
- sprintf (s, "%d AIM-9M", count);
- strcpy (c->leftHUD[1], s);
-
- v = mag (c->Cg);
- ! a1 = (w->maxThrust - 0.5 * c->rho * w->CDOrigin * v * v)
- ! / (w->emptyWeight + w->maxFuel) * a;
-
- ! if (c->curRadarTarget >= 0 && a1 >= 0.0) {
-
- d = c->targetDistance;
- r = c->targetClosure;
- ***************
- *** 212,218 ****
- c->gearD1 = 0.0;
- c->gearD2 = 0.0;
-
- ! f = fopen ("aim-9", "r");
- c->object = VReadObject(f);
- fclose (f);
-
- --- 213,219 ----
- c->gearD1 = 0.0;
- c->gearD2 = 0.0;
-
- ! f = acm_fopen ("aim-9", "r");
- c->object = VReadObject(f);
- fclose (f);
-
- diff -c ../x/fsim/doRadar.c ./doRadar.c
- *** ../x/fsim/doRadar.c Thu Oct 4 10:34:11 1990
- --- ./doRadar.c Wed Oct 10 13:49:02 1990
- ***************
- *** 39,44 ****
- --- 39,46 ----
- }
- else
- sprintf (s, "%d", n);
- +
- + return s;
- }
-
- int doRadar (c, u)
- diff -c ../x/fsim/init.c ./init.c
- *** ../x/fsim/init.c Thu Oct 4 10:34:06 1990
- --- ./init.c Thu Oct 11 18:06:55 1990
- ***************
- *** 13,18 ****
- --- 13,33 ----
-
- extern craftType *newCraft();
-
- + FILE *acm_fopen (name, access)
- + char *name, *access; {
- +
- + FILE *f;
- + char libname[256];
- +
- + if ((f = fopen (name, access)) == (FILE *) NULL) {
- + strcpy (libname, ACM_LIBRARY);
- + strcat (libname, name);
- + return fopen (libname, access);
- + }
- +
- + return f;
- + }
- +
- int init () {
-
- FILE *f;
- ***************
- *** 43,49 ****
- * Read in the runway and place it.
- */
-
- ! f = fopen ("rwy", "r");
- stbl[1].type = CT_SURFACE;
- stbl[1].cinfo = newCraft();
- stbl[1].cinfo->object = VReadObject(f);
- --- 58,64 ----
- * Read in the runway and place it.
- */
-
- ! f = acm_fopen ("rwy", "r");
- stbl[1].type = CT_SURFACE;
- stbl[1].cinfo = newCraft();
- stbl[1].cinfo->object = VReadObject(f);
- ***************
- *** 53,59 ****
- stbl[1].Sg.z = 0.0;
- stbl[1].curHeading = stbl[1].curPitch = stbl[1].curRoll = 0.0;
-
- ! f = fopen ("rwy2", "r");
- stbl[0].type = CT_SURFACE;
- stbl[0].cinfo = newCraft();
- stbl[0].cinfo->object = VReadObject(f);
- --- 68,74 ----
- stbl[1].Sg.z = 0.0;
- stbl[1].curHeading = stbl[1].curPitch = stbl[1].curRoll = 0.0;
-
- ! f = acm_fopen ("rwy2", "r");
- stbl[0].type = CT_SURFACE;
- stbl[0].cinfo = newCraft();
- stbl[0].cinfo->object = VReadObject(f);
- ***************
- *** 64,70 ****
- stbl[0].curHeading = 300.0 * 3.14159 / 180.0;
- stbl[0].curPitch = stbl[0].curRoll = 0.0;
-
- ! f = fopen ("tower", "r");
- stbl[2].type = CT_SURFACE;
- stbl[2].cinfo = newCraft();
- stbl[2].cinfo->object = VReadObject(f);
- --- 79,85 ----
- stbl[0].curHeading = 300.0 * 3.14159 / 180.0;
- stbl[0].curPitch = stbl[0].curRoll = 0.0;
-
- ! f = acm_fopen ("tower", "r");
- stbl[2].type = CT_SURFACE;
- stbl[2].cinfo = newCraft();
- stbl[2].cinfo->object = VReadObject(f);
- ***************
- *** 74,80 ****
- stbl[2].Sg.z = 0.0;
- stbl[2].curHeading = stbl[2].curPitch = stbl[2].curRoll = 0.0;
-
- ! f = fopen ("mtn", "r");
- stbl[3].type = CT_SURFACE;
- stbl[3].cinfo = newCraft();
- stbl[3].cinfo->object = VReadObject(f);
- --- 89,95 ----
- stbl[2].Sg.z = 0.0;
- stbl[2].curHeading = stbl[2].curPitch = stbl[2].curRoll = 0.0;
-
- ! f = acm_fopen ("mtn", "r");
- stbl[3].type = CT_SURFACE;
- stbl[3].cinfo = newCraft();
- stbl[3].cinfo->object = VReadObject(f);
- ***************
- *** 121,127 ****
- * colors associated with the aircraft.
- */
-
- ! f = fopen ("mig23", "r");
- o2 = VReadObject (f);
- fclose (f);
-
- --- 136,142 ----
- * colors associated with the aircraft.
- */
-
- ! f = acm_fopen ("mig23", "r");
- o2 = VReadObject (f);
- fclose (f);
-
- diff -c ../x/fsim/m61a1.c ./m61a1.c
- *** ../x/fsim/m61a1.c Thu Oct 4 10:34:16 1990
- --- ./m61a1.c Thu Oct 11 10:24:06 1990
- ***************
- *** 27,32 ****
- --- 27,33 ----
- int press_m61a1();
- int release_m61a1();
- extern craftType * lookupCraft();
- + extern FILE * acm_fopen();
-
- weaponDesc m61a1Desc = {
- WK_M61A1,
- ***************
- *** 278,284 ****
-
- c->placeProc = placeCannon;
-
- ! f = fopen ("bullet", "r");
- c->object = VReadObject(f);
- fclose (f);
-
- --- 279,285 ----
-
- c->placeProc = placeCannon;
-
- ! f = acm_fopen ("bullet", "r");
- c->object = VReadObject(f);
- fclose (f);
-
- diff -c ../x/fsim/makefile ./makefile
- *** ../x/fsim/makefile Thu Oct 4 10:34:06 1990
- --- ./makefile Fri Oct 12 09:35:22 1990
- ***************
- *** 2,9 ****
- # Makefile for acm; Riley Rainey, 1990
- #
- LDFLAGS = -L../V/lib
- - CFLAGS = -g -I../V/lib -systype bsd43
-
- OBFILES = server.o \
- pm.o \
- flaps.o \
- --- 2,17 ----
- # Makefile for acm; Riley Rainey, 1990
- #
- LDFLAGS = -L../V/lib
-
- + # cflags for mips RISC/os
- + CFLAGS = -O -I../V/lib -systype bsd43
- +
- + # cflags for most other systems
- + #CFLAGS = -O -I../V/lib
- +
- + # dec 5000 series systems should add -Ddec to CFLAGS
- + # System V systems should add -DSYSV to CFLAGS
- +
- OBFILES = server.o \
- pm.o \
- flaps.o \
- ***************
- *** 43,49 ****
- tar cv acm acms f16 mig23 aim-9 rwy rwy2 tower mtn bullet
-
- V2tgif: V2tgif.c
- ! cc -O2 -L../V/lib -I../V/lib -o V2tgif V2tgif.c -lV -lX11 -lbsd -lm
-
- mkdepend: makefile
- mkdepend -c "cc $(CFLAGS)" -e "/include/d" makefile *.c
- --- 51,57 ----
- tar cv acm acms f16 mig23 aim-9 rwy rwy2 tower mtn bullet
-
- V2tgif: V2tgif.c
- ! cc -O -L../V/lib -I../V/lib -o V2tgif V2tgif.c -lV -lX11 -lbsd -lm
-
- mkdepend: makefile
- mkdepend -c "cc $(CFLAGS)" -e "/include/d" makefile *.c
- diff -c ../x/fsim/manifest.h ./manifest.h
- *** ../x/fsim/manifest.h Thu Oct 4 10:34:14 1990
- --- ./manifest.h Thu Oct 11 18:21:43 1990
- ***************
- *** 32,34 ****
- --- 32,50 ----
- */
-
- /* #define LINEAR_CONTROL_RESPONSE */
- +
- + /*
- + * Define a library directory to contain the acm files
- + */
- +
- + #define ACM_LIBRARY "/usr/games/lib/acm/"
- +
- + /*
- + * a signal handler function type
- + */
- +
- + #ifdef SYSV
- + #define acm_sig_t void /* System V returns void */
- + #else
- + #define acm_sig_t int /* BSD does int's */
- + #endif
- diff -c ../x/fsim/newPlane.c ./newPlane.c
- *** ../x/fsim/newPlane.c Thu Oct 4 10:34:07 1990
- --- ./newPlane.c Thu Oct 11 10:32:33 1990
- ***************
- *** 15,20 ****
- --- 15,22 ----
-
- static craftType ctype[MAXCRAFTTYPES];
-
- + extern FILE * acm_fopen ();
- +
- #ifndef SYSV
- extern char * malloc();
-
- ***************
- *** 154,160 ****
- c->maxNWS = 100.0 * 6076.0 / 3600.0;
- c->gearD1 = 13.5;
- c->gearD2 = -2.5;
- ! f = fopen ("f16", "r");
- c->object = VReadObject(f);
- fclose (f);
-
- --- 156,162 ----
- c->maxNWS = 100.0 * 6076.0 / 3600.0;
- c->gearD1 = 13.5;
- c->gearD2 = -2.5;
- ! f = acm_fopen ("f16", "r");
- c->object = VReadObject(f);
- fclose (f);
-
- ***************
- *** 264,270 ****
- c->maxNWS = 100.0 * 6076.0 / 3600.0;
- c->gearD1 = 13.5;
- c->gearD2 = -2.5;
- ! f = fopen ("mig23", "r");
- c->object = VReadObject(f);
- fclose (f);
-
- --- 266,272 ----
- c->maxNWS = 100.0 * 6076.0 / 3600.0;
- c->gearD1 = 13.5;
- c->gearD2 = -2.5;
- ! f = acm_fopen ("mig23", "r");
- c->object = VReadObject(f);
- fclose (f);
-
- diff -c ../x/fsim/newPlayer.c ./newPlayer.c
- *** ../x/fsim/newPlayer.c Thu Oct 4 10:34:15 1990
- --- ./newPlayer.c Fri Oct 12 10:37:08 1990
- ***************
- *** 14,20 ****
- --- 14,24 ----
- #include <X11/Xutil.h>
-
- #define BORDER 1
- + #ifdef dec
- + #define FONT "courier_18"
- + #else
- #define FONT "*courier-bold-r-normal--17*"
- + #endif
- #define ARG_FONT "font"
- #define ARG_RADAR_FONT "radarFont"
- #define ARG_BORDER_COLOR "borderColor"
- ***************
- *** 200,205 ****
- --- 204,222 ----
- }
- screen = DefaultScreen (u->dpy);
- mono = (DisplayPlanes (u->dpy, screen) == 1) ? 1 : 0;
- +
- + /*
- + * A hack until we support monochrome
- + */
- +
- + if (mono) {
- + free ((char *) u);
- + ptbl[player].type = CT_FREE;
- + sprintf (err, "%s: I do not run on monochrome displays; sorry.\n",
- + ACM);
- + write (s, err, strlen(err));
- + return -1;
- + }
-
- if ((fontName = XGetDefault(u->dpy, ACM, ARG_FONT)) == NULL) {
- fontName = FONT;
- diff -c ../x/fsim/pm.c ./pm.c
- *** ../x/fsim/pm.c Thu Oct 4 10:34:04 1990
- --- ./pm.c Fri Oct 12 10:31:10 1990
- ***************
- *** 259,265 ****
- * approximates this effect.
- */
-
- ! c->curThrust = calcThrust(c);
- calcCoefficients (c, &CLift, &CDrag);
-
- if (debug)
- --- 259,269 ----
- * approximates this effect.
- */
-
- ! if (c->fuel <= 0.0)
- ! c->curThrust = 0.0;
- ! else
- ! c->curThrust = calcThrust(c);
- !
- calcCoefficients (c, &CLift, &CDrag);
-
- if (debug)
- diff -c ../x/fsim/server.c ./server.c
- *** ../x/fsim/server.c Thu Oct 4 10:34:18 1990
- --- ./server.c Fri Oct 12 09:37:43 1990
- ***************
- *** 21,26 ****
- --- 21,28 ----
- #include <netdb.h>
- #include <setjmp.h>
-
- + static char rscid[] = "$Revision: acm by Riley Rainey; Revision 1.0 patchlevel 1$";
- +
- extern struct servent *getservent();
- int sdebug = 1;
- int listen_socket;
- ***************
- *** 132,138 ****
-
- int peerdied = 0;
-
- ! deadpeer () {
- fprintf (stderr, "SIGPIPE\n");
- peerdied = 1;
- }
- --- 134,140 ----
-
- int peerdied = 0;
-
- ! acm_sig_t deadpeer () {
- fprintf (stderr, "SIGPIPE\n");
- peerdied = 1;
- }
- ***************
- *** 140,146 ****
- struct sigvec alrm, pipe;
- int doUpdate = 0;
-
- ! myalarm () {
- doUpdate++;
- sigvec (SIGALRM, &alrm, (struct sigvec *) 0);
- }
- --- 142,148 ----
- struct sigvec alrm, pipe;
- int doUpdate = 0;
-
- ! acm_sig_t myalarm () {
- doUpdate++;
- sigvec (SIGALRM, &alrm, (struct sigvec *) 0);
- }
- ***************
- *** 208,214 ****
- bp = buf;
- }
- }
- ! if (news > 0) {
- if ((n = read (news, bp, 1)) > 0) {
- if (*bp == '\n') {
- *bp = '\0';
- --- 210,216 ----
- bp = buf;
- }
- }
- ! if (news > 0 && FD_ISSET (news, &fdset)) {
- if ((n = read (news, bp, 1)) > 0) {
- if (*bp == '\n') {
- *bp = '\0';
- diff -c /dev/null ./patchlevel.h
- *** /dev/null Sun Oct 14 21:00:03 1990
- --- ./patchlevel.h Sun Oct 14 21:34:51 1990
- ***************
- *** 0 ****
- --- 1 ----
- + #define PATCHLEVEL 1
- ----> CUT HERE <----
- --
- Riley Rainey Internet: riley@mips.com
- MIPS Computer Systems Phone: +1 214 770-7979
- Dallas, Texas
-
- dan
- ----------------------------------------------------
- O'Reilly && Associates argv@sun.com / argv@ora.com
- Opinions expressed reflect those of the author only.
-