home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / sources / games / 306 next >
Encoding:
Internet Message Format  |  1993-01-22  |  13.8 KB

  1. Path: sparky!uunet!news.tek.com!master!gnarly!billr
  2. From: billr@gnarly.CNA.TEK.COM (Bill Randle)
  3. Newsgroups: comp.sources.games
  4. Subject: v15i055:  gtetris3 -  Generic Tetris for X11, V2.0.1, Patch3
  5. Message-ID: <4240@master.CNA.TEK.COM>
  6. Date: 22 Jan 93 05:03:58 GMT
  7. Sender: news@master.CNA.TEK.COM
  8. Lines: 538
  9. Approved: billr@saab.CNA.TEK.COM
  10.  
  11. Submitted-by: "Qiang Alex Zhao" <azhao@cs.arizona.edu>
  12. Posting-number: Volume 15, Issue 55
  13. Archive-name: gtetris3/Patch3
  14. Patch-To: gtetris3: Volume 15, Issue 44-45
  15. Environment: X11R4/5, Xlib
  16.  
  17.     [This includes both the diffs for V2.1.1 to V2.1.2 and from
  18.      V2.1.2 to V2.1.3 in one patch file.  -br]
  19.  
  20. #! /bin/sh
  21. # This is a shell archive.  Remove anything before this line, then unpack
  22. # it by saving it into a file and typing "sh file".  To overwrite existing
  23. # files, type "sh file -c".  You can also feed this as standard input via
  24. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  25. # will see the following message at the end:
  26. #        "End of shell archive."
  27. # Contents:  patches03
  28. # Wrapped by billr@gnarly on Thu Jan 21 21:01:46 1993
  29. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  30. if test -f 'patches03' -a "${1}" != "-c" ; then 
  31.   echo shar: Will not clobber existing file \"'patches03'\"
  32. else
  33. echo shar: Extracting \"'patches03'\" \(12112 characters\)
  34. sed "s/^X//" >'patches03' <<'END_OF_FILE'
  35. X*** tetris.2.1.old/README    Thu Jan 21 20:57:48 1993
  36. X--- tetris.2.1/README    Thu Jan 21 20:54:36 1993
  37. X***************
  38. X*** 1,5 ****
  39. X      GENERIC TETRIS
  40. X!     ==============    Yet Another Tetris Game on X, V2.1.1
  41. X  
  42. X  
  43. X  WHY ANOTHER?
  44. X--- 1,5 ----
  45. X      GENERIC TETRIS
  46. X!     ==============    Yet Another Tetris Game on X, V2.1.3
  47. X  
  48. X  
  49. X  WHY ANOTHER?
  50. X***************
  51. X*** 9,17 ****
  52. X      Xlib -- no "toolkit" kind of thing. People have tested it on the
  53. X      following platforms:
  54. X  
  55. X      DEC 5000        Ultrix 4.2A    X11R4
  56. X      Iris 4D            IRIX 4.0.1    Motif
  57. X!     Sun4, SPARCstation    SunOS 4.1.1    X11R4, X11R5
  58. X      Sequent S81        DYNIX 3.2.0    X11R5
  59. X  
  60. X      If your's is not in this list, please let me know -- thanks. The
  61. X--- 9,22 ----
  62. X      Xlib -- no "toolkit" kind of thing. People have tested it on the
  63. X      following platforms:
  64. X  
  65. X+     Bull DPX/2        System V    ?
  66. X      DEC 5000        Ultrix 4.2A    X11R4
  67. X+     DEC Alpha AXP        DEC OSF/1 V1.2    ?
  68. X+     HP 700            HP-UX 8.07    X11R5
  69. X      Iris 4D            IRIX 4.0.1    Motif
  70. X!     Sun4, SPARC        SunOS 4.1.x    X11R4, X11R5
  71. X!     Sun SPARC        Solaris 2.1
  72. X!         add to link: -L/usr/ucblib -lucb -lelf -R/usr/ucblib
  73. X      Sequent S81        DYNIX 3.2.0    X11R5
  74. X  
  75. X      If your's is not in this list, please let me know -- thanks. The
  76. X***************
  77. X*** 56,61 ****
  78. X--- 61,71 ----
  79. X      ;o) When the tetris window loses its focus, it also goes to
  80. X      "paused" mode except it doesn't iconify itself.
  81. X  
  82. X+     In previous versions, all number keys on the keypad work. Since I'm
  83. X+     going to let the user fully configure things like key bindings,
  84. X+     I'll only let a few of them work for now, and do not include a key
  85. X+     for "rotate counter-clockwise" (sorry :o).
  86. X+ 
  87. X      Refer to the man page for detailed command line options.
  88. X  
  89. X  
  90. X***************
  91. X*** 76,84 ****
  92. X  HISTORY -- Oh no, not again: I failed my history course!
  93. X  Well ... ACKNOWLEDGEMENTS
  94. X  
  95. X!     Since the days of V1.8, I have got many responses over the net.
  96. X!     Thanks go to people who helped me in improving the program.
  97. X  
  98. X    [Jan 18, 93]  V2.1.1: Fixed a resource look-up bug found by Peter
  99. X          Kabal <kabal@inrs-telecom.uquebec.ca>, and Imakefile
  100. X          problem found by Tong Zhou <tzhou@cse.ogi.edu>.
  101. X--- 86,100 ----
  102. X  HISTORY -- Oh no, not again: I failed my history course!
  103. X  Well ... ACKNOWLEDGEMENTS
  104. X  
  105. X!   [Jan 21, 93]  V2.1.3: Two bugs in finding user environment:
  106. X!         "endpwent()" by Jari Tavi <jpt@rixrax.enet.dec.com>;
  107. X!         "gethostname()" by Johan Vromans <jv@mh.nl>. Added two
  108. X!         more arrow keys.
  109. X  
  110. X+   [Jan 19, 93]  V2.1.2: Improved "paused" mode - so it won't take too
  111. X+         much CPU time - suggested by Philip JENNINGS
  112. X+         <P.Jennings@frcl.bull.fr>.
  113. X+ 
  114. X    [Jan 18, 93]  V2.1.1: Fixed a resource look-up bug found by Peter
  115. X          Kabal <kabal@inrs-telecom.uquebec.ca>, and Imakefile
  116. X          problem found by Tong Zhou <tzhou@cse.ogi.edu>.
  117. X***************
  118. X*** 101,106 ****
  119. X--- 117,125 ----
  120. X          in case some system doesn't have them. Fixed block
  121. X          clearing bug found by Benjamin Kroop
  122. X          <bkroop@sunlab.cit.cornell.edu>.
  123. X+ 
  124. X+     Since the days of V1.8, I have got many responses over the net.
  125. X+     Thanks go to people who helped me in improving the program.
  126. X  
  127. X    [Nov 13, 92]  Black Friday -- V1.8.1: numerious minor changes. Made
  128. X          score listing built in.
  129. X*** tetris.2.1.old/playing.c    Thu Jan 21 20:57:30 1993
  130. X--- tetris.2.1/playing.c    Thu Jan 21 20:54:48 1993
  131. X***************
  132. X*** 77,84 ****
  133. X      } else {
  134. X          resetTime = evGotNewThing(False);
  135. X      }
  136. X-     if (paused)
  137. X-         resetTime = True;
  138. X      }
  139. X      /* never come to here */
  140. X  }
  141. X--- 77,82 ----
  142. X***************
  143. X*** 90,96 ****
  144. X      Bool            falldown;
  145. X  {
  146. X      XEvent          ev;
  147. X!     Bool            gotNew = False;
  148. X      char            buf[4];
  149. X  
  150. X      if (!paused && falldown)
  151. X--- 88,94 ----
  152. X      Bool            falldown;
  153. X  {
  154. X      XEvent          ev;
  155. X!     Bool            gotNew = False, flag;
  156. X      char            buf[4];
  157. X  
  158. X      if (!paused && falldown)
  159. X***************
  160. X*** 98,237 ****
  161. X  
  162. X      while (XPending(display)) {
  163. X      XNextEvent(display, &ev);
  164. X!     switch (ev.type) {
  165. X!     case KeyPress:
  166. X!         if (!XLookupString(&ev.xkey, buf, 4, NULL, NULL))
  167. X!         break;
  168. X  
  169. X!         switch (buf[0]) {
  170. X!         case 'j':
  171. X!         case 's':
  172. X!         if (!paused)
  173. X!             gotNew = moveOne(LEFT) || gotNew;
  174. X!         break;
  175. X  
  176. X!         case 'k':
  177. X!         case 'd':
  178. X!         if (!paused)
  179. X!             gotNew = moveOne(ROTATE) || gotNew;
  180. X!         break;
  181. X  
  182. X!         case 'l':
  183. X!         case 'f':
  184. X!         if (!paused)
  185. X!             gotNew = moveOne(RIGHT) || gotNew;
  186. X!         break;
  187. X  
  188. X!         case ' ':
  189. X!         case '\n':
  190. X!         if (!paused)
  191. X!             gotNew = moveOne(DROP) || gotNew;
  192. X!         break;
  193. X  
  194. X!         case 'q':
  195. X!         case 'Q':
  196. X!         gameOver();
  197. X!         break;
  198. X  
  199. X!         case '+':
  200. X!         case '=':
  201. X!         if (!paused)
  202. X!             if (level < NUM_LEVELS - 1) {
  203. X!             level++;
  204. X!             drawStatus();
  205. X              }
  206. X!         break;
  207. X  
  208. X!         case '-':
  209. X!         case '_':
  210. X!         if (!paused)
  211. X!             if (level > 0) {
  212. X!             level--;
  213. X!             drawStatus();
  214. X              }
  215. X          break;
  216. X  
  217. X!         case 'b':
  218. X!         case 'B':
  219. X!         beep = !beep;
  220. X!         if (beep)
  221. X!             XBell(display, BVOLUME);
  222. X          break;
  223. X  
  224. X!         case 'p':
  225. X!         case 'P':
  226. X!         if (beep)
  227. X!             XBell(display, BVOLUME);
  228. X!         paused = !paused;
  229. X!         if (paused) {
  230. X!             /* "... Hi boss, I'm working hard as usual ..." */
  231. X              banner(MSG_PAUSED);
  232. X-             (void) XIconifyWindow(display, mainWin, screen_num);
  233. X-         } else {
  234. X-             clearNext();
  235. X-             if (showNext)
  236. X-             drawNext();
  237. X          }
  238. X-         XSync(display, False);
  239. X          break;
  240. X  
  241. X!         case '\014':
  242. X!         XClearWindow(display, mainWin);
  243. X!         XClearWindow(display, blockWin);
  244. X!         redrawAll();
  245. X!         if (paused)
  246. X!             banner(MSG_PAUSED);
  247. X!         XSync(display, False);
  248. X          break;
  249. X  
  250. X!         case 'n':
  251. X!         case 'N':
  252. X!         if (!paused) {
  253. X!             showNext = !showNext;
  254. X!             if (showNext) {
  255. X!             drawNext();
  256. X!             } else {
  257. X!             clearNext();
  258. X!             }
  259. X!             XSync(display, False);
  260. X!         }
  261. X          break;
  262. X  
  263. X!         default:
  264. X!         XBell(display, 0);
  265. X!         XSync(display, False);
  266. X          break;
  267. X          }
  268. X! 
  269. X!         break;
  270. X! 
  271. X!     case UnmapNotify:
  272. X!         paused = True;
  273. X!         break;
  274. X! 
  275. X!     case FocusOut:
  276. X!         if (firstFall) {
  277. X!         paused = True;
  278. X!         banner(MSG_PAUSED);
  279. X!         }
  280. X!         break;
  281. X! 
  282. X!     case Expose:
  283. X!         if (ev.xexpose.count == 0) {
  284. X!         redrawAll();
  285. X!         if (paused)
  286. X!             banner(MSG_PAUSED);
  287. X!         }
  288. X!         break;
  289. X! 
  290. X!     case ClientMessage:
  291. X!         if ((Atom) ev.xclient.data.l[0] == delw)
  292. X!         gameOver();
  293. X!         break;
  294. X! 
  295. X!     case DestroyNotify:
  296. X!         exit(0);
  297. X!         break;
  298. X      }
  299. X      }
  300. X  
  301. X--- 96,244 ----
  302. X  
  303. X      while (XPending(display)) {
  304. X      XNextEvent(display, &ev);
  305. X!     flag = True;
  306. X!     while (flag) {
  307. X!         switch (ev.type) {
  308. X!         case KeyPress:
  309. X!         if (!XLookupString(&ev.xkey, buf, 4, NULL, NULL))
  310. X!             break;
  311. X  
  312. X!         switch (buf[0]) {
  313. X!         case 'j':
  314. X!         case 's':
  315. X!             if (!paused)
  316. X!             gotNew = moveOne(LEFT) || gotNew;
  317. X!             break;
  318. X  
  319. X!         case 'k':
  320. X!         case 'd':
  321. X!             if (!paused)
  322. X!             gotNew = moveOne(ROTATE) || gotNew;
  323. X!             break;
  324. X  
  325. X!         case 'l':
  326. X!         case 'f':
  327. X!             if (!paused)
  328. X!             gotNew = moveOne(RIGHT) || gotNew;
  329. X!             break;
  330. X  
  331. X!         case ' ':
  332. X!         case '\n':
  333. X!             if (!paused)
  334. X!             gotNew = moveOne(DROP) || gotNew;
  335. X!             break;
  336. X  
  337. X!         case 'q':
  338. X!         case 'Q':
  339. X!             gameOver();
  340. X!             break;
  341. X  
  342. X!         case '+':
  343. X!         case '=':
  344. X!             if (!paused)
  345. X!             if (level < NUM_LEVELS - 1) {
  346. X!                 level++;
  347. X!                 drawStatus();
  348. X!             }
  349. X!             break;
  350. X! 
  351. X!         case '-':
  352. X!         case '_':
  353. X!             if (!paused)
  354. X!             if (level > 0) {
  355. X!                 level--;
  356. X!                 drawStatus();
  357. X!             }
  358. X!             break;
  359. X! 
  360. X!         case 'b':
  361. X!         case 'B':
  362. X!             beep = !beep;
  363. X!             if (beep)
  364. X!             XBell(display, BVOLUME);
  365. X!             break;
  366. X! 
  367. X!         case 'p':
  368. X!         case 'P':
  369. X!             if (beep)
  370. X!             XBell(display, BVOLUME);
  371. X!             paused = !paused;
  372. X!             if (paused) {
  373. X!             /* "... Hi boss, I'm working hard as usual ..." */
  374. X!             banner(MSG_PAUSED);
  375. X!             (void) XIconifyWindow(display, mainWin, screen_num);
  376. X!             } else {
  377. X!             clearNext();
  378. X!             if (showNext)
  379. X!                 drawNext();
  380. X              }
  381. X!             XSync(display, False);
  382. X!             break;
  383. X  
  384. X!         case '\014':
  385. X!             XClearWindow(display, mainWin);
  386. X!             XClearWindow(display, blockWin);
  387. X!             redrawAll();
  388. X!             if (paused)
  389. X!             banner(MSG_PAUSED);
  390. X!             XSync(display, False);
  391. X!             break;
  392. X! 
  393. X!         case 'n':
  394. X!         case 'N':
  395. X!             if (!paused) {
  396. X!             showNext = !showNext;
  397. X!             if (showNext) {
  398. X!                 drawNext();
  399. X!             } else {
  400. X!                 clearNext();
  401. X!             }
  402. X!             XSync(display, False);
  403. X              }
  404. X+             break;
  405. X+ 
  406. X+         default:
  407. X+             XBell(display, 0);
  408. X+             XSync(display, False);
  409. X+             break;
  410. X+         }
  411. X+ 
  412. X          break;
  413. X  
  414. X!         case UnmapNotify:
  415. X!         paused = True;
  416. X          break;
  417. X  
  418. X!         case FocusOut:
  419. X!         if (firstFall) {
  420. X!             paused = True;
  421. X              banner(MSG_PAUSED);
  422. X          }
  423. X          break;
  424. X  
  425. X!         case Expose:
  426. X!         if (ev.xexpose.count == 0) {
  427. X!             redrawAll();
  428. X!             if (paused)
  429. X!             banner(MSG_PAUSED);
  430. X!         }
  431. X          break;
  432. X  
  433. X!         case ClientMessage:
  434. X!         if ((Atom) ev.xclient.data.l[0] == delw)
  435. X!             gameOver();
  436. X          break;
  437. X  
  438. X!         case DestroyNotify:
  439. X!         exit(0);
  440. X          break;
  441. X          }
  442. X!         if (paused) {
  443. X!         XNextEvent(display, &ev);
  444. X!         flag = True;
  445. X!         gotNew = True;        /* for reseting time */
  446. X!         } else
  447. X!         flag = False;
  448. X      }
  449. X      }
  450. X  
  451. X*** tetris.2.1.old/tetris.c    Thu Jan 21 20:57:48 1993
  452. X--- tetris.2.1/tetris.c    Thu Jan 21 20:54:49 1993
  453. X***************
  454. X*** 105,111 ****
  455. X      char           *argv[];
  456. X  {
  457. X      (void) fprintf(stderr,
  458. X!            "                 GENERIC TETRIS V2.1.1\n");
  459. X      (void) fprintf(stderr,
  460. X       "Copyright (C) 1992-93      Q. Alex Zhao, azhao@cs.arizona.edu\n");
  461. X      (void) fprintf(stderr,
  462. X--- 105,111 ----
  463. X      char           *argv[];
  464. X  {
  465. X      (void) fprintf(stderr,
  466. X!            "                 GENERIC TETRIS V2.1.3\n");
  467. X      (void) fprintf(stderr,
  468. X       "Copyright (C) 1992-93      Q. Alex Zhao, azhao@cs.arizona.edu\n");
  469. X      (void) fprintf(stderr,
  470. X***************
  471. X*** 177,183 ****
  472. X      (void) gethostname(myscore.myhost, NAMELEN);
  473. X      setpwent();
  474. X      pw = getpwuid(getuid());
  475. X-     endpwent();
  476. X      if (pw == NULL) {        /* impossible? */
  477. X      (void) sprintf(myscore.myname, "%d", getuid());
  478. X      myHome[0] = '.';
  479. X--- 177,182 ----
  480. X***************
  481. X*** 187,192 ****
  482. X--- 186,192 ----
  483. X      (void) strncpy(myscore.myname, pw->pw_name, NAMELEN);
  484. X      (void) strncpy(myHome, pw->pw_dir, FILENAMELEN);
  485. X      }
  486. X+     endpwent();
  487. X      myscore.myname[NAMELEN - 1] = '\0';
  488. X      myscore.myhost[NAMELEN - 1] = '\0';
  489. X      myHome[FILENAMELEN - 1] = '\0';
  490. X***************
  491. X*** 251,256 ****
  492. X--- 251,257 ----
  493. X      env = &filenamebuf[0];
  494. X      (void) strcpy(env, myHome);
  495. X      len = strlen(env);
  496. X+     env[len++] = '/';
  497. X      (void) gethostname(env + len, FILENAMELEN - len);
  498. X      }
  499. X      homeDB = XrmGetFileDatabase(env);
  500. X*** tetris.2.1.old/tetris.man    Thu Jan 21 20:57:48 1993
  501. X--- tetris.2.1/tetris.man    Thu Jan 21 20:54:43 1993
  502. X***************
  503. X*** 1,4 ****
  504. X! .TH TETRIS 6 "18 Jan 1993, V2.1.1" "Univ of Arizona"
  505. X  .SH NAME
  506. X  GENERIC TETRIS \- Yet Another Tetris Game on X
  507. X  .SH SYNOPSIS
  508. X--- 1,4 ----
  509. X! .TH TETRIS 6 "19 Jan 1993, V2.1" "Univ of Arizona"
  510. X  .SH NAME
  511. X  GENERIC TETRIS \- Yet Another Tetris Game on X
  512. X  .SH SYNOPSIS
  513. X*** tetris.2.1.old/utils.c    Thu Jan 21 20:57:31 1993
  514. X--- tetris.2.1/utils.c    Thu Jan 21 20:54:49 1993
  515. X***************
  516. X*** 232,237 ****
  517. X--- 232,241 ----
  518. X      (unsigned char *) "j", sizeof(unsigned char));
  519. X      XRebindKeysym(display, XK_Left, NULL, 0,
  520. X      (unsigned char *) "j", sizeof(unsigned char));
  521. X+     XRebindKeysym(display, XK_R8, NULL, 0,
  522. X+     (unsigned char *) "k", sizeof(unsigned char));
  523. X+     XRebindKeysym(display, XK_Up, NULL, 0,
  524. X+     (unsigned char *) "k", sizeof(unsigned char));
  525. X      XRebindKeysym(display, XK_R11, NULL, 0,
  526. X      (unsigned char *) "k", sizeof(unsigned char));
  527. X      XRebindKeysym(display, XK_R12, NULL, 0,
  528. X***************
  529. X*** 238,243 ****
  530. X--- 242,251 ----
  531. X      (unsigned char *) "l", sizeof(unsigned char));
  532. X      XRebindKeysym(display, XK_Right, NULL, 0,
  533. X      (unsigned char *) "l", sizeof(unsigned char));
  534. X+     XRebindKeysym(display, XK_Down, NULL, 0,
  535. X+     (unsigned char *) " ", sizeof(unsigned char));
  536. X+     XRebindKeysym(display, XK_R14, NULL, 0,
  537. X+     (unsigned char *) " ", sizeof(unsigned char));
  538. X  
  539. X      /* create windows */
  540. X      attvm = CWBackPixel | CWEventMask | CWDontPropagate | CWCursor;
  541. END_OF_FILE
  542. if test 12112 -ne `wc -c <'patches03'`; then
  543.     echo shar: \"'patches03'\" unpacked with wrong size!
  544. fi
  545. # end of 'patches03'
  546. fi
  547. echo shar: End of shell archive.
  548. exit 0
  549.