home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / x / volume10 / acm / patch1 next >
Encoding:
Text File  |  1990-10-18  |  14.9 KB  |  613 lines

  1. Path: uunet!snorkelwacker!usc!wuarchive!cs.utexas.edu!sun-barr!newstop!sun!mipsdal.mips.com
  2. From: riley@mipsdal.mips.com (Riley Rainey)
  3. Newsgroups: comp.sources.x
  4. Subject: v10i002: acm, X aerial combat simulation 1.0 Patch1, Part01/01
  5. Message-ID: <143894@sun.Eng.Sun.COM>
  6. Date: 18 Oct 90 18:35:50 GMT
  7. References: <csx-10i002:acm@uunet.UU.NET>
  8. Sender: news@sun.Eng.Sun.COM
  9. Lines: 601
  10. Approved: argv@sun.com
  11.  
  12. Submitted-by: riley@mipsdal.mips.com (Riley Rainey)
  13. Posting-number: Volume 10, Issue 2
  14. Archive-name: acm/patch1
  15. Patch-To: acm: Volume 9, Issue 69-73 (10/7/90)
  16.  
  17. This patch file fixes a a couple of bugs uncovered in acm since its 1.0 release.
  18. Check the README file for details on these changes.  The man page, acm.1,
  19. has been updated, as well.
  20.  
  21. To apply these patches, save this article as a file, edit out everything
  22. before and after the "---> CUT HERE <---" messages and then:
  23.  
  24.     $ cd fsim
  25.     $ patch <this_files_pathname
  26.  
  27. Note that there is a CUT HERE message at the beginning and at the end of this
  28. patch file.
  29.  
  30. No changes were made to the V library.  You might want to manually
  31. change the line in V/test/app.c that reads "#define VIEW3" to "#define
  32. VIEW1" -- it makes for a bit more interesting test case.
  33.  
  34. ---->  CUT HERE  <----
  35. diff -c ../x/fsim/README ./README
  36. *** ../x/fsim/README    Thu Oct  4 10:34:16 1990
  37. --- ./README    Fri Oct 12 10:28:30 1990
  38. ***************
  39. *** 1,5 ****
  40. ! acm Flight Simulator version 1.0
  41.   
  42.   This software is divided into two major parts: the 3-D graphics routines
  43.   and the flight simulator itself.  The 3-D stuff is contained in the V
  44.   directory.  V/lib holds the library itself along with imake and make files.
  45. --- 1,30 ----
  46. ! acm Flight Simulator version 1.0 patchlevel 1
  47.   
  48. + What's different with patchlevel 1:
  49. + A couple of bugs have been fixed.  acm now refuses to run on monochrome
  50. + workstations.
  51. + If someone could send me patchfiles for the changes required to run on a pure
  52. + System V system, I'd be in their debt.  RISC/OS has a System V ilk, but
  53. + I don't really have the spare time to change it myself.
  54. + The documentation has been updated, too.  See the acm.1 man page.
  55. + OUTSTANDING BUGS
  56. + A couple of people have reported problems with having acm get the keyboard
  57. + focus when using the Open Look window manager.  I don't have access to a Sun
  58. + system, so I can't toy with it.  acm works with uwm; you may want to fall back
  59. + to that until the problem is isolated.
  60. + There is another Sun problem that involves core dumps in doViews.c.  It is
  61. + unclear where this is coming from.  A compiler bug perhaps?
  62. + GENERAL NOTES
  63.   This software is divided into two major parts: the 3-D graphics routines
  64.   and the flight simulator itself.  The 3-D stuff is contained in the V
  65.   directory.  V/lib holds the library itself along with imake and make files.
  66. ***************
  67. *** 51,55 ****
  68.         notion of limited aircraft damage.  It may in the future.
  69.   
  70.   
  71.   Riley Rainey
  72. ! October 1, 1990
  73. --- 76,91 ----
  74.         notion of limited aircraft damage.  It may in the future.
  75.   
  76.   
  77. + CREDITS
  78. + In the original release, I overlooked several important credits.  The
  79. + input routine at the heart of the acm server is based on code from xtrek
  80. + that was written by Dan A. Dickey, he has provided some valuable help in
  81. + improving the robustness of this code.  The 3-D routines were written by
  82. + me, but are based closely on two valuable articles from the March and
  83. + April 1981 issues of Byte Magazine titled "Three-Dimensional Computer
  84. + Graphics" by Franklin C. Crow.
  85.   Riley Rainey
  86. ! October 12, 1990
  87. diff -c ../x/fsim/acm.1 ./acm.1
  88. *** ../x/fsim/acm.1    Thu Oct  4 10:34:14 1990
  89. --- ./acm.1    Wed Oct 10 14:29:02 1990
  90. ***************
  91. *** 215,220 ****
  92. --- 215,227 ----
  93.   W -- Retract
  94.   
  95.   
  96. + Weapon Controls
  97. + .LP
  98. + Mouse Button 2 -- Fire the selected weapon
  99. + .LP
  100. + Mouse Button 3 -- Select another weapon
  101.   
  102.   Other Controls
  103.   
  104. diff -c ../x/fsim/acm.c ./acm.c
  105. *** ../x/fsim/acm.c    Thu Oct  4 10:34:11 1990
  106. --- ./acm.c    Wed Oct 10 16:23:07 1990
  107. ***************
  108. *** 74,79 ****
  109. --- 74,85 ----
  110.           strcat (myhost, display);
  111.           display = myhost;
  112.       }
  113. +     else if (strcmp (display, "unix:0.0") == 0 ||
  114. +         strcmp (display, "unix:0") == 0) {
  115. +         gethostname (myhost, sizeof(myhost));
  116. +         strcat (myhost, ":0.0");
  117. +         display = myhost;
  118. +     }
  119.   
  120.       if ((sin.sin_addr.s_addr = inet_addr (host)) != -1) {
  121.           sin.sin_family = AF_INET;
  122. diff -c ../x/fsim/aim9m.c ./aim9m.c
  123. *** ../x/fsim/aim9m.c    Thu Oct  4 10:34:25 1990
  124. --- ./aim9m.c    Fri Oct 12 15:45:23 1990
  125. ***************
  126. *** 19,24 ****
  127. --- 19,25 ----
  128.   int getIRTarget();
  129.   extern int fireMissile ();
  130.   extern void createMissileEyeSpace();
  131. + extern FILE * acm_fopen ();
  132.   
  133.   weaponDesc aim9mDesc = {
  134.       WK_AIM9M,
  135. ***************
  136. *** 66,76 ****
  137.       sprintf (s, "%d AIM-9M", count);
  138.       strcpy (c->leftHUD[1], s);
  139.   
  140. -     a1 = w->maxThrust / (w->emptyWeight + w->maxFuel) * a;
  141.       v = mag (c->Cg);
  142. !     a1 -= c->rho * c->cinfo->CDOrigin * v * v;
  143.   
  144. !     if (c->curRadarTarget >= 0 && a1 != 0.0) {
  145.   
  146.       d = c->targetDistance;
  147.       r = c->targetClosure;
  148. --- 67,77 ----
  149.       sprintf (s, "%d AIM-9M", count);
  150.       strcpy (c->leftHUD[1], s);
  151.   
  152.       v = mag (c->Cg);
  153. !     a1 = (w->maxThrust - 0.5 * c->rho * w->CDOrigin * v * v)
  154. !         / (w->emptyWeight + w->maxFuel) * a;
  155.   
  156. !     if (c->curRadarTarget >= 0 && a1 >= 0.0) {
  157.   
  158.       d = c->targetDistance;
  159.       r = c->targetClosure;
  160. ***************
  161. *** 212,218 ****
  162.       c->gearD1 = 0.0;
  163.       c->gearD2 = 0.0;
  164.   
  165. !     f = fopen ("aim-9", "r");
  166.       c->object = VReadObject(f);
  167.       fclose (f);
  168.   
  169. --- 213,219 ----
  170.       c->gearD1 = 0.0;
  171.       c->gearD2 = 0.0;
  172.   
  173. !     f = acm_fopen ("aim-9", "r");
  174.       c->object = VReadObject(f);
  175.       fclose (f);
  176.   
  177. diff -c ../x/fsim/doRadar.c ./doRadar.c
  178. *** ../x/fsim/doRadar.c    Thu Oct  4 10:34:11 1990
  179. --- ./doRadar.c    Wed Oct 10 13:49:02 1990
  180. ***************
  181. *** 39,44 ****
  182. --- 39,46 ----
  183.       }
  184.       else 
  185.           sprintf (s, "%d", n);
  186. +     return s;
  187.   }
  188.   
  189.   int doRadar (c, u)
  190. diff -c ../x/fsim/init.c ./init.c
  191. *** ../x/fsim/init.c    Thu Oct  4 10:34:06 1990
  192. --- ./init.c    Thu Oct 11 18:06:55 1990
  193. ***************
  194. *** 13,18 ****
  195. --- 13,33 ----
  196.   
  197.   extern craftType *newCraft();
  198.   
  199. + FILE *acm_fopen (name, access)
  200. + char *name, *access; {
  201. +     FILE    *f;
  202. +     char    libname[256];
  203. +     if ((f = fopen (name, access)) == (FILE *) NULL) {
  204. +         strcpy (libname, ACM_LIBRARY);
  205. +         strcat (libname, name);
  206. +         return fopen (libname, access);
  207. +     }
  208. +     return f;
  209. + }
  210.   int init () {
  211.   
  212.       FILE    *f;
  213. ***************
  214. *** 43,49 ****
  215.    * Read in the runway and place it.
  216.    */
  217.   
  218. !     f = fopen ("rwy", "r");
  219.       stbl[1].type = CT_SURFACE;
  220.       stbl[1].cinfo = newCraft();
  221.       stbl[1].cinfo->object = VReadObject(f);
  222. --- 58,64 ----
  223.    * Read in the runway and place it.
  224.    */
  225.   
  226. !     f = acm_fopen ("rwy", "r");
  227.       stbl[1].type = CT_SURFACE;
  228.       stbl[1].cinfo = newCraft();
  229.       stbl[1].cinfo->object = VReadObject(f);
  230. ***************
  231. *** 53,59 ****
  232.       stbl[1].Sg.z = 0.0;
  233.       stbl[1].curHeading = stbl[1].curPitch = stbl[1].curRoll = 0.0;
  234.   
  235. !     f = fopen ("rwy2", "r");
  236.       stbl[0].type = CT_SURFACE;
  237.       stbl[0].cinfo = newCraft();
  238.       stbl[0].cinfo->object = VReadObject(f);
  239. --- 68,74 ----
  240.       stbl[1].Sg.z = 0.0;
  241.       stbl[1].curHeading = stbl[1].curPitch = stbl[1].curRoll = 0.0;
  242.   
  243. !     f = acm_fopen ("rwy2", "r");
  244.       stbl[0].type = CT_SURFACE;
  245.       stbl[0].cinfo = newCraft();
  246.       stbl[0].cinfo->object = VReadObject(f);
  247. ***************
  248. *** 64,70 ****
  249.       stbl[0].curHeading = 300.0 * 3.14159 / 180.0;
  250.       stbl[0].curPitch = stbl[0].curRoll = 0.0;
  251.   
  252. !     f = fopen ("tower", "r");
  253.       stbl[2].type = CT_SURFACE;
  254.       stbl[2].cinfo = newCraft();
  255.       stbl[2].cinfo->object = VReadObject(f);
  256. --- 79,85 ----
  257.       stbl[0].curHeading = 300.0 * 3.14159 / 180.0;
  258.       stbl[0].curPitch = stbl[0].curRoll = 0.0;
  259.   
  260. !     f = acm_fopen ("tower", "r");
  261.       stbl[2].type = CT_SURFACE;
  262.       stbl[2].cinfo = newCraft();
  263.       stbl[2].cinfo->object = VReadObject(f);
  264. ***************
  265. *** 74,80 ****
  266.       stbl[2].Sg.z = 0.0;
  267.       stbl[2].curHeading = stbl[2].curPitch = stbl[2].curRoll = 0.0;
  268.   
  269. !     f = fopen ("mtn", "r");
  270.       stbl[3].type = CT_SURFACE;
  271.       stbl[3].cinfo = newCraft();
  272.       stbl[3].cinfo->object = VReadObject(f);
  273. --- 89,95 ----
  274.       stbl[2].Sg.z = 0.0;
  275.       stbl[2].curHeading = stbl[2].curPitch = stbl[2].curRoll = 0.0;
  276.   
  277. !     f = acm_fopen ("mtn", "r");
  278.       stbl[3].type = CT_SURFACE;
  279.       stbl[3].cinfo = newCraft();
  280.       stbl[3].cinfo->object = VReadObject(f);
  281. ***************
  282. *** 121,127 ****
  283.    *  colors associated with the aircraft.
  284.    */
  285.   
  286. !     f = fopen ("mig23", "r");
  287.       o2 = VReadObject (f);
  288.       fclose (f);
  289.   
  290. --- 136,142 ----
  291.    *  colors associated with the aircraft.
  292.    */
  293.   
  294. !     f = acm_fopen ("mig23", "r");
  295.       o2 = VReadObject (f);
  296.       fclose (f);
  297.   
  298. diff -c ../x/fsim/m61a1.c ./m61a1.c
  299. *** ../x/fsim/m61a1.c    Thu Oct  4 10:34:16 1990
  300. --- ./m61a1.c    Thu Oct 11 10:24:06 1990
  301. ***************
  302. *** 27,32 ****
  303. --- 27,33 ----
  304.   int press_m61a1();
  305.   int release_m61a1();
  306.   extern craftType * lookupCraft();
  307. + extern FILE * acm_fopen();
  308.   
  309.   weaponDesc m61a1Desc = {
  310.       WK_M61A1,
  311. ***************
  312. *** 278,284 ****
  313.   
  314.       c->placeProc = placeCannon;
  315.   
  316. !     f = fopen ("bullet", "r");
  317.       c->object = VReadObject(f);
  318.       fclose (f);
  319.   
  320. --- 279,285 ----
  321.   
  322.       c->placeProc = placeCannon;
  323.   
  324. !     f = acm_fopen ("bullet", "r");
  325.       c->object = VReadObject(f);
  326.       fclose (f);
  327.   
  328. diff -c ../x/fsim/makefile ./makefile
  329. *** ../x/fsim/makefile    Thu Oct  4 10:34:06 1990
  330. --- ./makefile    Fri Oct 12 09:35:22 1990
  331. ***************
  332. *** 2,9 ****
  333.   # Makefile for acm;  Riley Rainey, 1990
  334.   #
  335.   LDFLAGS = -L../V/lib
  336. - CFLAGS = -g -I../V/lib -systype bsd43
  337.   
  338.   OBFILES = server.o \
  339.         pm.o \
  340.         flaps.o \
  341. --- 2,17 ----
  342.   # Makefile for acm;  Riley Rainey, 1990
  343.   #
  344.   LDFLAGS = -L../V/lib
  345.   
  346. + # cflags for mips RISC/os
  347. + CFLAGS = -O -I../V/lib -systype bsd43
  348. + # cflags for most other systems
  349. + #CFLAGS = -O -I../V/lib
  350. + # dec 5000 series systems should add -Ddec to CFLAGS
  351. + # System V systems should add -DSYSV to CFLAGS
  352.   OBFILES = server.o \
  353.         pm.o \
  354.         flaps.o \
  355. ***************
  356. *** 43,49 ****
  357.       tar cv acm acms f16 mig23 aim-9 rwy rwy2 tower mtn bullet
  358.   
  359.   V2tgif:    V2tgif.c
  360. !     cc -O2 -L../V/lib -I../V/lib -o V2tgif V2tgif.c -lV -lX11 -lbsd -lm
  361.   
  362.   mkdepend: makefile
  363.       mkdepend -c "cc $(CFLAGS)" -e "/include/d" makefile *.c
  364. --- 51,57 ----
  365.       tar cv acm acms f16 mig23 aim-9 rwy rwy2 tower mtn bullet
  366.   
  367.   V2tgif:    V2tgif.c
  368. !     cc -O -L../V/lib -I../V/lib -o V2tgif V2tgif.c -lV -lX11 -lbsd -lm
  369.   
  370.   mkdepend: makefile
  371.       mkdepend -c "cc $(CFLAGS)" -e "/include/d" makefile *.c
  372. diff -c ../x/fsim/manifest.h ./manifest.h
  373. *** ../x/fsim/manifest.h    Thu Oct  4 10:34:14 1990
  374. --- ./manifest.h    Thu Oct 11 18:21:43 1990
  375. ***************
  376. *** 32,34 ****
  377. --- 32,50 ----
  378.    */
  379.   
  380.   /* #define LINEAR_CONTROL_RESPONSE */
  381. + /*
  382. +  *  Define a library directory to contain the acm files
  383. +  */
  384. + #define ACM_LIBRARY        "/usr/games/lib/acm/"
  385. + /*
  386. +  *  a signal handler function type
  387. +  */
  388. + #ifdef SYSV
  389. + #define acm_sig_t    void    /* System V returns void */
  390. + #else
  391. + #define acm_sig_t    int    /* BSD does int's */
  392. + #endif
  393. diff -c ../x/fsim/newPlane.c ./newPlane.c
  394. *** ../x/fsim/newPlane.c    Thu Oct  4 10:34:07 1990
  395. --- ./newPlane.c    Thu Oct 11 10:32:33 1990
  396. ***************
  397. *** 15,20 ****
  398. --- 15,22 ----
  399.   
  400.   static craftType ctype[MAXCRAFTTYPES];
  401.   
  402. + extern FILE * acm_fopen ();
  403.   #ifndef SYSV
  404.   extern char * malloc();
  405.   
  406. ***************
  407. *** 154,160 ****
  408.       c->maxNWS = 100.0 * 6076.0 / 3600.0;
  409.       c->gearD1 = 13.5;
  410.       c->gearD2 = -2.5;
  411. !     f = fopen ("f16", "r");
  412.       c->object = VReadObject(f);
  413.       fclose (f);
  414.   
  415. --- 156,162 ----
  416.       c->maxNWS = 100.0 * 6076.0 / 3600.0;
  417.       c->gearD1 = 13.5;
  418.       c->gearD2 = -2.5;
  419. !     f = acm_fopen ("f16", "r");
  420.       c->object = VReadObject(f);
  421.       fclose (f);
  422.   
  423. ***************
  424. *** 264,270 ****
  425.       c->maxNWS = 100.0 * 6076.0 / 3600.0;
  426.       c->gearD1 = 13.5;
  427.       c->gearD2 = -2.5;
  428. !     f = fopen ("mig23", "r");
  429.       c->object = VReadObject(f);
  430.       fclose (f);
  431.       
  432. --- 266,272 ----
  433.       c->maxNWS = 100.0 * 6076.0 / 3600.0;
  434.       c->gearD1 = 13.5;
  435.       c->gearD2 = -2.5;
  436. !     f = acm_fopen ("mig23", "r");
  437.       c->object = VReadObject(f);
  438.       fclose (f);
  439.       
  440. diff -c ../x/fsim/newPlayer.c ./newPlayer.c
  441. *** ../x/fsim/newPlayer.c    Thu Oct  4 10:34:15 1990
  442. --- ./newPlayer.c    Fri Oct 12 10:37:08 1990
  443. ***************
  444. *** 14,20 ****
  445. --- 14,24 ----
  446.   #include <X11/Xutil.h>
  447.   
  448.   #define BORDER    1
  449. + #ifdef dec
  450. + #define FONT            "courier_18"
  451. + #else
  452.   #define FONT            "*courier-bold-r-normal--17*"
  453. + #endif
  454.   #define    ARG_FONT        "font"
  455.   #define ARG_RADAR_FONT        "radarFont"
  456.   #define    ARG_BORDER_COLOR    "borderColor"
  457. ***************
  458. *** 200,205 ****
  459. --- 204,222 ----
  460.       }
  461.       screen = DefaultScreen (u->dpy);
  462.       mono = (DisplayPlanes (u->dpy, screen) == 1) ? 1 : 0;
  463. + /*
  464. +  *  A hack until we support monochrome 
  465. +  */
  466. +     if (mono) {
  467. +     free ((char *) u);
  468. +     ptbl[player].type = CT_FREE;
  469. +     sprintf (err, "%s: I do not run on monochrome displays; sorry.\n",
  470. +         ACM);
  471. +     write (s, err, strlen(err));
  472. +     return -1;
  473. +     }
  474.   
  475.       if ((fontName = XGetDefault(u->dpy, ACM, ARG_FONT)) == NULL) {
  476.       fontName = FONT;
  477. diff -c ../x/fsim/pm.c ./pm.c
  478. *** ../x/fsim/pm.c    Thu Oct  4 10:34:04 1990
  479. --- ./pm.c    Fri Oct 12 10:31:10 1990
  480. ***************
  481. *** 259,265 ****
  482.    *  approximates this effect.
  483.    */
  484.   
  485. !     c->curThrust = calcThrust(c);
  486.       calcCoefficients (c, &CLift, &CDrag);
  487.   
  488.       if (debug)
  489. --- 259,269 ----
  490.    *  approximates this effect.
  491.    */
  492.   
  493. !     if (c->fuel <= 0.0)
  494. !         c->curThrust = 0.0;
  495. !     else
  496. !         c->curThrust = calcThrust(c);
  497.       calcCoefficients (c, &CLift, &CDrag);
  498.   
  499.       if (debug)
  500. diff -c ../x/fsim/server.c ./server.c
  501. *** ../x/fsim/server.c    Thu Oct  4 10:34:18 1990
  502. --- ./server.c    Fri Oct 12 09:37:43 1990
  503. ***************
  504. *** 21,26 ****
  505. --- 21,28 ----
  506.   #include <netdb.h>
  507.   #include <setjmp.h>
  508.   
  509. + static char rscid[] = "$Revision: acm by Riley Rainey; Revision 1.0 patchlevel 1$";
  510.   extern struct servent *getservent();
  511.   int sdebug = 1;
  512.   int listen_socket;
  513. ***************
  514. *** 132,138 ****
  515.   
  516.   int peerdied = 0;
  517.   
  518. ! deadpeer () {
  519.       fprintf (stderr, "SIGPIPE\n");
  520.       peerdied = 1;
  521.   }
  522. --- 134,140 ----
  523.   
  524.   int peerdied = 0;
  525.   
  526. ! acm_sig_t deadpeer () {
  527.       fprintf (stderr, "SIGPIPE\n");
  528.       peerdied = 1;
  529.   }
  530. ***************
  531. *** 140,146 ****
  532.   struct    sigvec    alrm, pipe;
  533.   int doUpdate = 0;
  534.   
  535. ! myalarm () {
  536.       doUpdate++;
  537.       sigvec (SIGALRM, &alrm, (struct sigvec *) 0);
  538.   }
  539. --- 142,148 ----
  540.   struct    sigvec    alrm, pipe;
  541.   int doUpdate = 0;
  542.   
  543. ! acm_sig_t myalarm () {
  544.       doUpdate++;
  545.       sigvec (SIGALRM, &alrm, (struct sigvec *) 0);
  546.   }
  547. ***************
  548. *** 208,214 ****
  549.                       bp = buf;
  550.                   }
  551.               }
  552. !             if (news > 0) {
  553.                   if ((n = read (news, bp, 1)) > 0) {
  554.                       if (*bp == '\n') {
  555.                           *bp = '\0';
  556. --- 210,216 ----
  557.                       bp = buf;
  558.                   }
  559.               }
  560. !             if (news > 0 && FD_ISSET (news, &fdset)) {
  561.                   if ((n = read (news, bp, 1)) > 0) {
  562.                       if (*bp == '\n') {
  563.                           *bp = '\0';
  564. diff -c /dev/null ./patchlevel.h
  565. *** /dev/null    Sun Oct 14 21:00:03 1990
  566. --- ./patchlevel.h    Sun Oct 14 21:34:51 1990
  567. ***************
  568. *** 0 ****
  569. --- 1 ----
  570. + #define PATCHLEVEL    1
  571. ---->  CUT HERE  <----
  572. -- 
  573. Riley Rainey            Internet: riley@mips.com
  574. MIPS Computer Systems        Phone:    +1 214 770-7979
  575. Dallas, Texas
  576.  
  577. dan
  578. ----------------------------------------------------
  579. O'Reilly && Associates   argv@sun.com / argv@ora.com
  580. Opinions expressed reflect those of the author only.
  581.