home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1994 March / Source_Code_CD-ROM_Walnut_Creek_March_1994.iso / compsrcs / games / volume15 / gtetrs3 / patch1 < prev    next >
Encoding:
Internet Message Format  |  1993-01-26  |  27.4 KB

  1. Path: uunet!news.tek.com!master!saab!billr
  2. From: billr@saab.CNA.TEK.COM (Bill Randle)
  3. Newsgroups: comp.sources.games
  4. Subject: v15i046:  gtetris3 -  Generic Tetris for X11, V2.0.1, Patch1
  5. Message-ID: <4212@master.CNA.TEK.COM>
  6. Date: 15 Jan 93 23:29:02 GMT
  7. Sender: news@master.CNA.TEK.COM
  8. Lines: 993
  9. Approved: billr@saab.CNA.TEK.COM
  10. Xref: uunet comp.sources.games:1545
  11.  
  12. Submitted-by: "Qiang Alex Zhao" <azhao@cs.arizona.edu>
  13. Posting-number: Volume 15, Issue 46
  14. Archive-name: gtetris3/Patch1
  15. Patch-To: gtetris3: Volume 15, Issue 44-45
  16. Environment: X11R4/5, Xlib
  17.  
  18.  
  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:  patches01
  28. # Wrapped by billr@saab on Fri Jan 15 15:24:23 1993
  29. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  30. if test -f 'patches01' -a "${1}" != "-c" ; then 
  31.   echo shar: Will not clobber existing file \"'patches01'\"
  32. else
  33. echo shar: Extracting \"'patches01'\" \(25665 characters\)
  34. sed "s/^X//" >'patches01' <<'END_OF_FILE'
  35. Xdiff -c tetris.2.0/README tetris.2.1/README
  36. X*** tetris.2.0/README    Fri Jan 15 13:04:29 1993
  37. X--- tetris.2.1/README    Fri Jan 15 15:59:59 1993
  38. X***************
  39. X*** 1,5
  40. X      GENERIC TETRIS
  41. X!     ==============    Yet Another Tetris Game on X, V2.0.1
  42. X  
  43. X  
  44. X  WHY ANOTHER?
  45. X
  46. X--- 1,5 -----
  47. X      GENERIC TETRIS
  48. X!     ==============    Yet Another Tetris Game on X, V2.1.0
  49. X  
  50. X  
  51. X  WHY ANOTHER?
  52. X***************
  53. X*** 81,86
  54. X  
  55. X      Since the days of V1.8, I have got many responses over the net.
  56. X      Thanks go to people who helped me in improving the program.
  57. X  
  58. X    [Jan 12, 93]  V2.0.1: added arrow keys. Changed error handling method
  59. X          in locking score file, suggested by Hellmut Golde
  60. X
  61. X--- 81,93 -----
  62. X  
  63. X      Since the days of V1.8, I have got many responses over the net.
  64. X      Thanks go to people who helped me in improving the program.
  65. X+ 
  66. X+   [Jan 15, 93]  V2.1.0: Fixed a resource look-up bug found by Kiyotaka
  67. X+         Sakai <ksakai@mtl.t.u-tokyo.ac.jp>. Added "-u" option.
  68. X+         New feature: when a row is deleted, remaining blocks
  69. X+         remains rounded -- suggested by Elwood C. Downey
  70. X+         <ecdowney@hwking.cca.cr.rockwell.com> and Bill Leue
  71. X+         <leue@crd.ge.com>.
  72. X  
  73. X    [Jan 12, 93]  V2.0.1: added arrow keys. Changed error handling method
  74. X          in locking score file, suggested by Hellmut Golde
  75. XCommon subdirectories: tetris.2.0/X11 and tetris.2.1/X11
  76. XCommon subdirectories: tetris.2.0/bitmaps and tetris.2.1/bitmaps
  77. Xdiff -c tetris.2.0/playing.c tetris.2.1/playing.c
  78. X*** tetris.2.0/playing.c    Fri Jan 15 13:04:31 1993
  79. X--- tetris.2.1/playing.c    Fri Jan 15 15:46:35 1993
  80. X***************
  81. X*** 27,32
  82. X  #include    "tetris.h"
  83. X  
  84. X  static Bool     paused = False;
  85. X  
  86. X  static int      speeds[NUM_LEVELS] = {
  87. X      100, 92, 84, 76, 68, 60, 53, 46, 39, 32, 26, 20, 15, 10, 6, 3, 1, 0};
  88. X
  89. X--- 27,33 -----
  90. X  #include    "tetris.h"
  91. X  
  92. X  static Bool     paused = False;
  93. X+ static Bool     firstFall = False;
  94. X  
  95. X  static int      speeds[NUM_LEVELS] = {
  96. X  100, 92, 84, 76, 68, 60, 53, 46, 39, 32, 26, 20, 15, 10, 6, 3, 1, 0};
  97. X***************
  98. X*** 29,35
  99. X  static Bool     paused = False;
  100. X  
  101. X  static int      speeds[NUM_LEVELS] = {
  102. X!     100, 92, 84, 76, 68, 60, 53, 46, 39, 32, 26, 20, 15, 10, 6, 3, 1, 0};
  103. X  static int      thresh[NUM_LEVELS] = {
  104. X      10, 20, 30, 40, 50, 60, 70, 80, 90,
  105. X      100, 110, 120, 130, 140, 150, 160, 170, 180};
  106. X
  107. X--- 30,36 -----
  108. X  static Bool     firstFall = False;
  109. X  
  110. X  static int      speeds[NUM_LEVELS] = {
  111. X! 100, 92, 84, 76, 68, 60, 53, 46, 39, 32, 26, 20, 15, 10, 6, 3, 1, 0};
  112. X  static int      thresh[NUM_LEVELS] = {
  113. X      10, 20, 30, 40, 50, 60, 70, 80, 90,
  114. X  100, 110, 120, 130, 140, 150, 160, 170, 180};
  115. X***************
  116. X*** 32,38
  117. X      100, 92, 84, 76, 68, 60, 53, 46, 39, 32, 26, 20, 15, 10, 6, 3, 1, 0};
  118. X  static int      thresh[NUM_LEVELS] = {
  119. X      10, 20, 30, 40, 50, 60, 70, 80, 90,
  120. X!     100, 110, 120, 130, 140, 150, 160, 170, 180};
  121. X  
  122. X  static struct timeval nextFall, now, delay;
  123. X  static struct timezone tzone = {0, 0};
  124. X
  125. X--- 33,39 -----
  126. X  100, 92, 84, 76, 68, 60, 53, 46, 39, 32, 26, 20, 15, 10, 6, 3, 1, 0};
  127. X  static int      thresh[NUM_LEVELS] = {
  128. X      10, 20, 30, 40, 50, 60, 70, 80, 90,
  129. X! 100, 110, 120, 130, 140, 150, 160, 170, 180};
  130. X  
  131. X  static struct timeval nextFall, now, delay;
  132. X  static struct timezone tzone = {0, 0};
  133. X***************
  134. X*** 43,48
  135. X  playing()
  136. X  {
  137. X      Bool            resetTime = True;
  138. X  
  139. X      score = prefilled * level * 10;
  140. X      while (True) {
  141. X
  142. X--- 44,50 -----
  143. X  playing()
  144. X  {
  145. X      Bool            resetTime = True;
  146. X+     int             conNum = ConnectionNumber(display);
  147. X  
  148. X      score = prefilled * level * 10;
  149. X      while (True) {
  150. X***************
  151. X*** 52,58
  152. X          realTime(&nextFall);
  153. X      } else {
  154. X          int             writefd = 0, exceptfd = 0;
  155. X!         int             readfd = 1 << ConnectionNumber(display);
  156. X  
  157. X          (void) gettimeofday(&now, &tzone);
  158. X          delay.tv_sec = nextFall.tv_sec - now.tv_sec;
  159. X
  160. X--- 54,60 -----
  161. X          realTime(&nextFall);
  162. X      } else {
  163. X          int             writefd = 0, exceptfd = 0;
  164. X!         int             readfd = 1 << conNum;
  165. X  
  166. X          (void) gettimeofday(&now, &tzone);
  167. X          delay.tv_sec = nextFall.tv_sec - now.tv_sec;
  168. X***************
  169. X*** 58,65
  170. X          delay.tv_sec = nextFall.tv_sec - now.tv_sec;
  171. X          delay.tv_usec = nextFall.tv_usec - now.tv_usec;
  172. X          realTime(&delay);
  173. X!         if (delay.tv_sec >= 0) {    /* sleep */
  174. X!         (void) select(sizeof(int) * 8, (fd_set *) &readfd,
  175. X                 (fd_set *) & writefd, (fd_set *) & exceptfd, &delay);
  176. X          }
  177. X      }
  178. X
  179. X--- 60,69 -----
  180. X          delay.tv_sec = nextFall.tv_sec - now.tv_sec;
  181. X          delay.tv_usec = nextFall.tv_usec - now.tv_usec;
  182. X          realTime(&delay);
  183. X!         if ((delay.tv_sec > 0) ||
  184. X!             ((delay.tv_sec == 0) && (delay.tv_usec > 0))) {
  185. X!         /* sleep */
  186. X!         (void) select(conNum + 1, (fd_set *) & readfd,
  187. X                 (fd_set *) & writefd, (fd_set *) & exceptfd, &delay);
  188. X          }
  189. X      }
  190. X***************
  191. X*** 66,72
  192. X      (void) gettimeofday(&now, &tzone);
  193. X      if ((now.tv_sec > nextFall.tv_sec) ||
  194. X          ((now.tv_sec == nextFall.tv_sec) &&
  195. X!         (now.tv_usec > nextFall.tv_usec))) {
  196. X          (void) evGotNewThing(True);
  197. X          resetTime = True;
  198. X      } else {
  199. X
  200. X--- 70,76 -----
  201. X      (void) gettimeofday(&now, &tzone);
  202. X      if ((now.tv_sec > nextFall.tv_sec) ||
  203. X          ((now.tv_sec == nextFall.tv_sec) &&
  204. X!          (now.tv_usec > nextFall.tv_usec))) {
  205. X          (void) evGotNewThing(True);
  206. X          resetTime = True;
  207. X          firstFall = True;
  208. X***************
  209. X*** 69,74
  210. X          (now.tv_usec > nextFall.tv_usec))) {
  211. X          (void) evGotNewThing(True);
  212. X          resetTime = True;
  213. X      } else {
  214. X          resetTime = evGotNewThing(False);
  215. X      }
  216. X
  217. X--- 73,79 -----
  218. X           (now.tv_usec > nextFall.tv_usec))) {
  219. X          (void) evGotNewThing(True);
  220. X          resetTime = True;
  221. X+         firstFall = True;
  222. X      } else {
  223. X          resetTime = evGotNewThing(False);
  224. X      }
  225. X***************
  226. X*** 72,77
  227. X      } else {
  228. X          resetTime = evGotNewThing(False);
  229. X      }
  230. X      }
  231. X      /* never come to here */
  232. X  }
  233. X
  234. X--- 77,84 -----
  235. X      } else {
  236. X          resetTime = evGotNewThing(False);
  237. X      }
  238. X+     if (paused)
  239. X+         resetTime = True;
  240. X      }
  241. X      /* never come to here */
  242. X  }
  243. X***************
  244. X*** 203,210
  245. X          break;
  246. X  
  247. X      case FocusOut:
  248. X!         paused = True;
  249. X!         banner(MSG_PAUSED);
  250. X          break;
  251. X  
  252. X      case Expose:
  253. X
  254. X--- 210,219 -----
  255. X          break;
  256. X  
  257. X      case FocusOut:
  258. X!         if (firstFall) {
  259. X!         paused = True;
  260. X!         banner(MSG_PAUSED);
  261. X!         }
  262. X          break;
  263. X  
  264. X      case Expose:
  265. X***************
  266. X*** 260,266
  267. X      score += (showNext ? 3 : 5) * level * level * lines * lines;
  268. X      rows += lines;
  269. X      if (rows > thresh[level])
  270. X!         level ++;
  271. X      drawStatus();
  272. X      newThing();
  273. X      if (showNext) {
  274. X
  275. X--- 269,275 -----
  276. X      score += (showNext ? 3 : 5) * level * level * lines * lines;
  277. X      rows += lines;
  278. X      if (rows > thresh[level])
  279. X!         level++;
  280. X      drawStatus();
  281. X      newThing();
  282. X      if (showNext) {
  283. X***************
  284. X*** 267,275
  285. X          clearNext();
  286. X          drawNext();
  287. X      }
  288. X!     XSync(display, False);
  289. X!     while (XPending(display))
  290. X!         XNextEvent(display, &ev);
  291. X      if (overlapping())
  292. X          gameOver();
  293. X      drawThing();
  294. X
  295. X--- 276,282 -----
  296. X          clearNext();
  297. X          drawNext();
  298. X      }
  299. X!     XSync(display, True);    /* discard all events */
  300. X      if (overlapping())
  301. X          gameOver();
  302. X      drawThing();
  303. X***************
  304. X*** 277,283
  305. X      } else {
  306. X      tryMove(move);
  307. X      if (rows > thresh[level]) {
  308. X!         level ++;
  309. X          drawStatus();
  310. X      }
  311. X      return False;
  312. X
  313. X--- 284,290 -----
  314. X      } else {
  315. X      tryMove(move);
  316. X      if (rows > thresh[level]) {
  317. X!         level++;
  318. X          drawStatus();
  319. X      }
  320. X      return False;
  321. X***************
  322. X*** 311,317
  323. X      (void) fprintf(stderr, "Cannot write the score-file!\n");
  324. X      return;
  325. X      }
  326. X- 
  327. X      /* lock */
  328. X      (void) strcpy(lockfile, SCOREFILE);
  329. X      (void) strcat(lockfile, ".lock");
  330. X
  331. X--- 318,323 -----
  332. X      (void) fprintf(stderr, "Cannot write the score-file!\n");
  333. X      return;
  334. X      }
  335. X      /* lock */
  336. X      (void) strcpy(lockfile, SCOREFILE);
  337. X      (void) strcat(lockfile, ".lock");
  338. X***************
  339. X*** 316,322
  340. X      (void) strcpy(lockfile, SCOREFILE);
  341. X      (void) strcat(lockfile, ".lock");
  342. X      while (((lfd = open(lockfile, O_CREAT | O_EXCL, 0644)) < 0) &&
  343. X!         errno == EEXIST)
  344. X      sleep(1);
  345. X  
  346. X      if (lfd < 0) {
  347. X
  348. X--- 322,328 -----
  349. X      (void) strcpy(lockfile, SCOREFILE);
  350. X      (void) strcat(lockfile, ".lock");
  351. X      while (((lfd = open(lockfile, O_CREAT | O_EXCL, 0644)) < 0) &&
  352. X!         errno == EEXIST)
  353. X      sleep(1);
  354. X  
  355. X      if (lfd < 0) {
  356. X***************
  357. X*** 324,330
  358. X      (void) fprintf(stderr, "Score not recorded - sorry.\n");
  359. X      return;
  360. X      }
  361. X- 
  362. X      tmp = 0;
  363. X      ptmp = 1;
  364. X      bcopy((char *) &myscore, buff[1], SCORESIZE);
  365. X
  366. X--- 330,335 -----
  367. X      (void) fprintf(stderr, "Score not recorded - sorry.\n");
  368. X      return;
  369. X      }
  370. X      tmp = 0;
  371. X      ptmp = 1;
  372. X      bcopy((char *) &myscore, buff[1], SCORESIZE);
  373. X***************
  374. X*** 330,336
  375. X      bcopy((char *) &myscore, buff[1], SCORESIZE);
  376. X  
  377. X      while (read(fd, buff[tmp], SCORESIZE) == SCORESIZE) {
  378. X!     sscanf(((score_t *)buff[tmp])->score, " %d", &s1);
  379. X      if (!saved && (s1 <= score)) {
  380. X          trickle = True;
  381. X          saved = True;
  382. X
  383. X--- 335,341 -----
  384. X      bcopy((char *) &myscore, buff[1], SCORESIZE);
  385. X  
  386. X      while (read(fd, buff[tmp], SCORESIZE) == SCORESIZE) {
  387. X!     sscanf(((score_t *) buff[tmp])->score, " %d", &s1);
  388. X      if (!saved && (s1 <= score)) {
  389. X          trickle = True;
  390. X          saved = True;
  391. X***************
  392. X*** 337,343
  393. X          mycount++;
  394. X      }
  395. X      if (!strncmp(myscore.myname, ((score_t *) buff[tmp])->myname,
  396. X!         NAMELEN)) {
  397. X          mycount++;
  398. X      }
  399. X      /* Then check if we should trickle the score */
  400. X
  401. X--- 342,348 -----
  402. X          mycount++;
  403. X      }
  404. X      if (!strncmp(myscore.myname, ((score_t *) buff[tmp])->myname,
  405. X!              NAMELEN)) {
  406. X          mycount++;
  407. X      }
  408. X      /* Then check if we should trickle the score */
  409. X***************
  410. X*** 342,348
  411. X      }
  412. X      /* Then check if we should trickle the score */
  413. X      if (trickle) {
  414. X!         lseek(fd, (off_t) -SCORESIZE, SEEK_CUR);
  415. X          write(fd, buff[ptmp], SCORESIZE);
  416. X          ptmp = tmp;
  417. X          tmp = (tmp + 1) % 2;
  418. X
  419. X--- 347,353 -----
  420. X      }
  421. X      /* Then check if we should trickle the score */
  422. X      if (trickle) {
  423. X!         lseek(fd, (off_t) - SCORESIZE, SEEK_CUR);
  424. X          write(fd, buff[ptmp], SCORESIZE);
  425. X          ptmp = tmp;
  426. X          tmp = (tmp + 1) % 2;
  427. X***************
  428. X*** 347,352
  429. X          ptmp = tmp;
  430. X          tmp = (tmp + 1) % 2;
  431. X      }
  432. X      /*
  433. X       * As we trickle, we add up records owned by me. Once we hit max,
  434. X       * we throw it away, and stop trickling.
  435. X
  436. X--- 352,358 -----
  437. X          ptmp = tmp;
  438. X          tmp = (tmp + 1) % 2;
  439. X      }
  440. X+ 
  441. X      /*
  442. X       * As we trickle, we add up records owned by me. Once we hit max, we
  443. X       * throw it away, and stop trickling.
  444. X***************
  445. X*** 348,355
  446. X          tmp = (tmp + 1) % 2;
  447. X      }
  448. X      /*
  449. X!      * As we trickle, we add up records owned by me. Once we hit max,
  450. X!      * we throw it away, and stop trickling.
  451. X       */
  452. X      if ((mycount > MAXSCORES) || ((mycount == MAXSCORES) && !trickle)) {
  453. X          trickle = False;
  454. X
  455. X--- 354,361 -----
  456. X      }
  457. X  
  458. X      /*
  459. X!      * As we trickle, we add up records owned by me. Once we hit max, we
  460. X!      * throw it away, and stop trickling.
  461. X       */
  462. X      if ((mycount > MAXSCORES) || ((mycount == MAXSCORES) && !trickle)) {
  463. X          trickle = False;
  464. X***************
  465. X*** 355,361
  466. X          trickle = False;
  467. X          break;
  468. X      }
  469. X!     }    /* while */
  470. X  
  471. X      if (trickle) {
  472. X      write(fd, buff[ptmp], SCORESIZE);
  473. X
  474. X--- 361,367 -----
  475. X          trickle = False;
  476. X          break;
  477. X      }
  478. X!     }                /* while */
  479. X  
  480. X      if (trickle) {
  481. X      write(fd, buff[ptmp], SCORESIZE);
  482. X***************
  483. X*** 363,369
  484. X      if (!saved && (mycount < MAXSCORES)) {
  485. X      write(fd, (char *) &myscore, SCORESIZE);
  486. X      }
  487. X- 
  488. X      /* unlock */
  489. X      close(lfd);
  490. X      (void) unlink(lockfile);
  491. X
  492. X--- 369,374 -----
  493. X      if (!saved && (mycount < MAXSCORES)) {
  494. X      write(fd, (char *) &myscore, SCORESIZE);
  495. X      }
  496. X      /* unlock */
  497. X      close(lfd);
  498. X      (void) unlink(lockfile);
  499. X***************
  500. X*** 397,403
  501. X  
  502. X      (void) fprintf(stderr, "            GENERIC TETRIS  HALL OF FAME\n\n");
  503. X      (void) fprintf(stderr,
  504. X!     "   # USER            SCORE   L    R  HOST         DATE\n");
  505. X  
  506. X      while (read(fd, (char *) &curs, SCORESIZE) == SCORESIZE) {
  507. X      i++;
  508. X
  509. X--- 402,408 -----
  510. X  
  511. X      (void) fprintf(stderr, "            GENERIC TETRIS  HALL OF FAME\n\n");
  512. X      (void) fprintf(stderr,
  513. X!         "   # USER            SCORE   L    R  HOST         DATE\n");
  514. X  
  515. X      while (read(fd, (char *) &curs, SCORESIZE) == SCORESIZE) {
  516. X      i++;
  517. X***************
  518. X*** 403,410
  519. X      i++;
  520. X      if ((num == 0) || (i <= num))
  521. X          (void) fprintf(stderr, "%4d %-12s%9s %3s %4s  %-12s %-s",
  522. X!         i, curs.myname, curs.score, curs.level, curs.rows,
  523. X!         curs.myhost, curs.mydate);
  524. X      }
  525. X      close(fd);
  526. X      (void) fprintf(stderr, "There are %d scores to date.\n", i);
  527. X
  528. X--- 408,415 -----
  529. X      i++;
  530. X      if ((num == 0) || (i <= num))
  531. X          (void) fprintf(stderr, "%4d %-12s%9s %3s %4s  %-12s %-s",
  532. X!                i, curs.myname, curs.score, curs.level, curs.rows,
  533. X!                curs.myhost, curs.mydate);
  534. X      }
  535. X      close(fd);
  536. X      (void) fprintf(stderr, "There are %d scores to date.\n", i);
  537. Xdiff -c tetris.2.0/tetris.c tetris.2.1/tetris.c
  538. X*** tetris.2.0/tetris.c    Fri Jan 15 13:04:29 1993
  539. X--- tetris.2.1/tetris.c    Fri Jan 15 15:12:51 1993
  540. X***************
  541. X*** 72,78
  542. X  Bool            showNext = False, beep = False;
  543. X  score_t         myscore;
  544. X  
  545. X! static int      opTableEntries = 15;
  546. X  static XrmOptionDescRec opTable[] = {
  547. X      {"-s", ".scoresOnly", XrmoptionIsArg, (caddr_t) NULL},
  548. X      {"-l", "*startLevel", XrmoptionSepArg, (caddr_t) NULL},
  549. X
  550. X--- 72,78 -----
  551. X  Bool            showNext = False, beep = False;
  552. X  score_t         myscore;
  553. X  
  554. X! static int      opTableEntries = 16;
  555. X  static XrmOptionDescRec opTable[] = {
  556. X      {"-s", ".scoresOnly", XrmoptionIsArg, (caddr_t) NULL},
  557. X      {"-l", "*startLevel", XrmoptionSepArg, (caddr_t) NULL},
  558. X***************
  559. X*** 88,93
  560. X      {"-fg", "*foreground", XrmoptionSepArg, (caddr_t) NULL},
  561. X      {"-bigFont", "*bigFont", XrmoptionSepArg, (caddr_t) NULL},
  562. X      {"-tinyFont", "*tinyFont", XrmoptionSepArg, (caddr_t) NULL},
  563. X      {"-xrm", NULL, XrmoptionResArg, (caddr_t) NULL}
  564. X  };
  565. X  static XrmDatabase cmmDB = (XrmDatabase) NULL, rDB = (XrmDatabase) NULL;
  566. X
  567. X--- 88,94 -----
  568. X      {"-fg", "*foreground", XrmoptionSepArg, (caddr_t) NULL},
  569. X      {"-bigFont", "*bigFont", XrmoptionSepArg, (caddr_t) NULL},
  570. X      {"-tinyFont", "*tinyFont", XrmoptionSepArg, (caddr_t) NULL},
  571. X+     {"-u", "*playerName", XrmoptionSepArg, (caddr_t) NULL},
  572. X      {"-xrm", NULL, XrmoptionResArg, (caddr_t) NULL}
  573. X  };
  574. X  static XrmDatabase cmmDB = (XrmDatabase) NULL, rDB = (XrmDatabase) NULL;
  575. X***************
  576. X*** 104,110
  577. X      char           *argv[];
  578. X  {
  579. X      (void) fprintf(stderr,
  580. X!            "                 GENERIC TETRIS V2.0.1\n");
  581. X      (void) fprintf(stderr,
  582. X       "Copyright (C) 1992-93      Q. Alex Zhao, azhao@cs.arizona.edu\n");
  583. X      (void) fprintf(stderr,
  584. X
  585. X--- 105,111 -----
  586. X      char           *argv[];
  587. X  {
  588. X      (void) fprintf(stderr,
  589. X!            "                 GENERIC TETRIS V2.1.0\n");
  590. X      (void) fprintf(stderr,
  591. X       "Copyright (C) 1992-93      Q. Alex Zhao, azhao@cs.arizona.edu\n");
  592. X      (void) fprintf(stderr,
  593. X***************
  594. X*** 136,142
  595. X  
  596. X      myDisplayName[0] = '\0';
  597. X  
  598. X!     XrmParseCommand(&cmmDB, opTable, opTableEntries, argv[0], argc, argv);
  599. X  
  600. X      /* check for any arguments left */
  601. X      if (*argc != 1) {
  602. X
  603. X--- 137,143 -----
  604. X  
  605. X      myDisplayName[0] = '\0';
  606. X  
  607. X!     XrmParseCommand(&cmmDB, opTable, opTableEntries, "tetris", argc, argv);
  608. X  
  609. X      /* check for any arguments left */
  610. X      if (*argc != 1) {
  611. X***************
  612. X*** 151,157
  613. X      /* get display now */
  614. X      if (XrmGetResource(cmmDB, "tetris.display", "Tetris.Display",
  615. X                 str_type, &value) == True)
  616. X!     (void) strncpy(myDisplayName, value.addr, (int) value.size);
  617. X  
  618. X      if (!(display = XOpenDisplay(myDisplayName))) {
  619. X      (void) fprintf(stderr, "%s: Can't open display '%s'\n",
  620. X
  621. X--- 152,159 -----
  622. X      /* get display now */
  623. X      if (XrmGetResource(cmmDB, "tetris.display", "Tetris.Display",
  624. X                 str_type, &value) == True)
  625. X!     (void) strncpy(myDisplayName, value.addr, ZLIM(value.size, 255));
  626. X!     myDisplayName[255] = '\0';
  627. X  
  628. X      if (!(display = XOpenDisplay(myDisplayName))) {
  629. X      (void) fprintf(stderr, "%s: Can't open display '%s'\n",
  630. X***************
  631. X*** 205,211
  632. X      (void) fprintf(stderr,
  633. X      "   [-bigFont <font>] [-tinyFont <font>] [-showNext] [-beep]\n");
  634. X      (void) fprintf(stderr,
  635. X!     "   [-xrm <resource specifications>]\n");
  636. X  
  637. X      exit(1);
  638. X  }
  639. X
  640. X--- 207,213 -----
  641. X      (void) fprintf(stderr,
  642. X      "   [-bigFont <font>] [-tinyFont <font>] [-showNext] [-beep]\n");
  643. X      (void) fprintf(stderr,
  644. X!     "   [-u <name>] [-xrm <resource specifications>]\n");
  645. X  
  646. X      exit(1);
  647. X  }
  648. X***************
  649. X*** 296,302
  650. X  
  651. X      if (XrmGetResource(rDB, "tetris.foreground", "Tetris.Foreground",
  652. X                 str_type, &value) == True) {
  653. X!     (void) strncpy(name, value.addr, (int) value.size);
  654. X      fg = getColor(name);
  655. X      } else
  656. X      fg = BlackPixel(display, screen_num);
  657. X
  658. X--- 298,305 -----
  659. X  
  660. X      if (XrmGetResource(rDB, "tetris.foreground", "Tetris.Foreground",
  661. X                 str_type, &value) == True) {
  662. X!     (void) strncpy(name, value.addr, ZLIM(value.size, 255));
  663. X!     name[254] = '\0';
  664. X      fg = getColor(name);
  665. X      } else
  666. X      fg = BlackPixel(display, screen_num);
  667. X***************
  668. X*** 303,309
  669. X  
  670. X      if (XrmGetResource(rDB, "tetris.background", "Tetris.Background",
  671. X                 str_type, &value) == True) {
  672. X!     (void) strncpy(name, value.addr, (int) value.size);
  673. X      bg = getColor(name);
  674. X      } else
  675. X      bg = WhitePixel(display, screen_num);
  676. X
  677. X--- 306,313 -----
  678. X  
  679. X      if (XrmGetResource(rDB, "tetris.background", "Tetris.Background",
  680. X                 str_type, &value) == True) {
  681. X!     (void) strncpy(name, value.addr, ZLIM(value.size, 255));
  682. X!     name[254] = '\0';
  683. X      bg = getColor(name);
  684. X      } else
  685. X      bg = WhitePixel(display, screen_num);
  686. X***************
  687. X*** 317,323
  688. X  
  689. X      if (XrmGetResource(rDB, "tetris.geometry", "Tetris.Geometry",
  690. X                 str_type, &value) == True) {
  691. X!     (void) strncpy(geoStr, value.addr, (int) value.size);
  692. X      } else {
  693. X      geoStr[0] = '\0';
  694. X      }
  695. X
  696. X--- 321,328 -----
  697. X  
  698. X      if (XrmGetResource(rDB, "tetris.geometry", "Tetris.Geometry",
  699. X                 str_type, &value) == True) {
  700. X!     (void) strncpy(geoStr, value.addr, ZLIM(value.size, 20));
  701. X!     geoStr[19] = '\0';
  702. X      } else {
  703. X      geoStr[0] = '\0';
  704. X      }
  705. X***************
  706. X*** 341,347
  707. X  
  708. X      if (XrmGetResource(rDB, "tetris.iconGeometry", "Tetris.IconGeometry",
  709. X                 str_type, &value) == True) {
  710. X!     (void) strncpy(icongeoStr, value.addr, (int) value.size);
  711. X      } else {
  712. X      icongeoStr[0] = '\0';
  713. X      }
  714. X
  715. X--- 346,353 -----
  716. X  
  717. X      if (XrmGetResource(rDB, "tetris.iconGeometry", "Tetris.IconGeometry",
  718. X                 str_type, &value) == True) {
  719. X!     (void) strncpy(icongeoStr, value.addr, ZLIM(value.size, 20));
  720. X!     icongeoStr[19] = '\0';
  721. X      } else {
  722. X      icongeoStr[0] = '\0';
  723. X      }
  724. X***************
  725. X*** 367,373
  726. X  
  727. X      /*** get fonts ***/
  728. X  
  729. X!     if (XrmGetResource(rDB, "tetris.bigFont", "tetris.BigFont",
  730. X                 str_type, &value) == True) {
  731. X      (void) strncpy(name, value.addr, (int) value.size);
  732. X      } else {
  733. X
  734. X--- 373,379 -----
  735. X  
  736. X      /*** get fonts ***/
  737. X  
  738. X!     if (XrmGetResource(rDB, "tetris.bigFont", "Tetris.BigFont",
  739. X                 str_type, &value) == True) {
  740. X      (void) strncpy(name, value.addr, ZLIM(value.size, 255));
  741. X      name[254] = '\0';
  742. X***************
  743. X*** 369,375
  744. X  
  745. X      if (XrmGetResource(rDB, "tetris.bigFont", "tetris.BigFont",
  746. X                 str_type, &value) == True) {
  747. X!     (void) strncpy(name, value.addr, (int) value.size);
  748. X      } else {
  749. X      (void) strcpy(name, BIGFONT);
  750. X      }
  751. X
  752. X--- 375,382 -----
  753. X  
  754. X      if (XrmGetResource(rDB, "tetris.bigFont", "Tetris.BigFont",
  755. X                 str_type, &value) == True) {
  756. X!     (void) strncpy(name, value.addr, ZLIM(value.size, 255));
  757. X!     name[254] = '\0';
  758. X      } else {
  759. X      (void) strcpy(name, BIGFONT);
  760. X      }
  761. X***************
  762. X*** 377,383
  763. X      (void) fprintf(stderr, "Tetris: can't open font '%s'.\n", name);
  764. X      exit(1);
  765. X      }
  766. X!     if (XrmGetResource(rDB, "tetris.tinyFont", "tetris.TinyFont",
  767. X                 str_type, &value) == True) {
  768. X      (void) strncpy(name, value.addr, (int) value.size);
  769. X      } else {
  770. X
  771. X--- 384,390 -----
  772. X      (void) fprintf(stderr, "Tetris: can't open font '%s'.\n", name);
  773. X      exit(1);
  774. X      }
  775. X!     if (XrmGetResource(rDB, "tetris.tinyFont", "Tetris.TinyFont",
  776. X                 str_type, &value) == True) {
  777. X      (void) strncpy(name, value.addr, ZLIM(value.size, 255));
  778. X      name[254] = '\0';
  779. X***************
  780. X*** 379,385
  781. X      }
  782. X      if (XrmGetResource(rDB, "tetris.tinyFont", "tetris.TinyFont",
  783. X                 str_type, &value) == True) {
  784. X!     (void) strncpy(name, value.addr, (int) value.size);
  785. X      } else {
  786. X      (void) strcpy(name, TINYFONT);
  787. X      }
  788. X
  789. X--- 386,393 -----
  790. X      }
  791. X      if (XrmGetResource(rDB, "tetris.tinyFont", "Tetris.TinyFont",
  792. X                 str_type, &value) == True) {
  793. X!     (void) strncpy(name, value.addr, ZLIM(value.size, 255));
  794. X!     name[254] = '\0';
  795. X      } else {
  796. X      (void) strcpy(name, TINYFONT);
  797. X      }
  798. X***************
  799. X*** 386,391
  800. X      if ((tinyFont = XLoadQueryFont(display, name)) == NULL) {
  801. X      (void) fprintf(stderr, "Tetris: can't open font '%s'.\n", name);
  802. X      exit(1);
  803. X      }
  804. X  
  805. X      /*
  806. X
  807. X--- 394,407 -----
  808. X      if ((tinyFont = XLoadQueryFont(display, name)) == NULL) {
  809. X      (void) fprintf(stderr, "Tetris: can't open font '%s'.\n", name);
  810. X      exit(1);
  811. X+     }
  812. X+ 
  813. X+     /* player name */
  814. X+ 
  815. X+     if (XrmGetResource(rDB, "tetris.playerName", "Tetris.PlayerName",
  816. X+                str_type, &value) == True) {
  817. X+     (void) strncpy(myscore.myname, value.addr, ZLIM(value.size, 20));
  818. X+     myscore.myname[19] = '\0';
  819. X      }
  820. X  
  821. X      /*
  822. Xdiff -c tetris.2.0/tetris.h tetris.2.1/tetris.h
  823. X*** tetris.2.0/tetris.h    Fri Jan 15 13:04:29 1993
  824. X--- tetris.2.1/tetris.h    Fri Jan 15 15:14:58 1993
  825. X***************
  826. X*** 111,116
  827. X  #endif
  828. X  #endif
  829. X  
  830. X  /*** constants ***/
  831. X  
  832. X  #ifndef    SCOREFILE
  833. X
  834. X--- 111,120 -----
  835. X  #endif
  836. X  #endif
  837. X  
  838. X+ /*** macros ***/
  839. X+ 
  840. X+ #define    ZLIM(X, Y)    (((int) X) < (Y) ? ((int) X) : (Y))
  841. X+ 
  842. X  /*** constants ***/
  843. X  
  844. X  #ifndef    SCOREFILE
  845. Xdiff -c tetris.2.0/tetris.man tetris.2.1/tetris.man
  846. X*** tetris.2.0/tetris.man    Fri Jan 15 13:04:29 1993
  847. X--- tetris.2.1/tetris.man    Fri Jan 15 14:09:27 1993
  848. X***************
  849. X*** 1,4
  850. X! .TH TETRIS 6 "11 Jan 1993, V2.0.1" "Univ of Arizona"
  851. X  .SH NAME
  852. X  GENERIC TETRIS \- Yet Another Tetris Game on X
  853. X  .SH SYNOPSIS
  854. X
  855. X--- 1,4 -----
  856. X! .TH TETRIS 6 "15 Jan 1993, V2.1.0" "Univ of Arizona"
  857. X  .SH NAME
  858. X  GENERIC TETRIS \- Yet Another Tetris Game on X
  859. X  .SH SYNOPSIS
  860. X***************
  861. X*** 6,12
  862. X  [-s] [-l <start level>] [-p <prefilled lines>] [-showNext] [-beep]
  863. X  [-display <display>] [-geometry <geometry>] [-iconGeometry <geometry>]
  864. X  [-{background | bg} <color>] [-{foreground | fg} <color>] [-bigFont
  865. X! <font>] [-tinyFont <font>] [-xrm <resource specification>]
  866. X  .SH DESCRIPTION
  867. X  .LP
  868. X  One of the motivations of this tetris program is simplicity. It does
  869. X
  870. X--- 6,12 -----
  871. X  [-s] [-l <start level>] [-p <prefilled lines>] [-showNext] [-beep]
  872. X  [-display <display>] [-geometry <geometry>] [-iconGeometry <geometry>]
  873. X  [-{background | bg} <color>] [-{foreground | fg} <color>] [-bigFont
  874. X! <font>] [-tinyFont <font>] [-u <name>] [-xrm <resource specification>]
  875. X  .SH DESCRIPTION
  876. X  .LP
  877. X  One of the motivations of this tetris program is simplicity. It does
  878. X***************
  879. X*** 40,45
  880. X  .TP 8
  881. X  .B \-s
  882. X  This option lets the program only list all the recorded scores then exit.
  883. X  .TP 8
  884. X  .B \-l \fIlevel\fP
  885. X  This option starts the program at the specified level (resource name
  886. X
  887. X--- 40,48 -----
  888. X  .TP 8
  889. X  .B \-s
  890. X  This option lets the program only list all the recorded scores then exit.
  891. X+ .TP 8
  892. X+ .B \-u \fIname\fP
  893. X+ This option sets alternative player name.
  894. X  .TP 8
  895. X  .B \-l \fIlevel\fP
  896. X  This option starts the program at the specified level (resource name
  897. Xdiff -c tetris.2.0/utils.c tetris.2.1/utils.c
  898. X*** tetris.2.0/utils.c    Fri Jan 15 13:04:30 1993
  899. X--- tetris.2.1/utils.c    Fri Jan 15 15:42:16 1993
  900. X***************
  901. X*** 116,121
  902. X      }
  903. X  };
  904. X  
  905. X  static char    *thingFGs[NUM_THINGS] = {
  906. X      "Magenta", "ForestGreen", "Blue", "Red", "DarkTurquoise", "Black", "Brown"
  907. X  };
  908. X
  909. X--- 116,128 -----
  910. X      }
  911. X  };
  912. X  
  913. X+ static int      checkUp[NUM_BITMAPS] = {
  914. X+     0, 1, 2, 3, 4, 5, 6, 7, 0, 1, 2, 3, 4, 5, 6
  915. X+ };
  916. X+ static int      checkDown[NUM_BITMAPS] = {
  917. X+     0, 1, 0, 1, 4, 5, 4, 5, 8, 9, 8, 9, 12, 13, 12
  918. X+ };
  919. X+ 
  920. X  static char    *thingFGs[NUM_THINGS] = {
  921. X      "Magenta", "ForestGreen", "Blue", "Red", "DarkTurquoise", "Brown", "Black"
  922. X  };
  923. X***************
  924. X*** 117,123
  925. X  };
  926. X  
  927. X  static char    *thingFGs[NUM_THINGS] = {
  928. X!     "Magenta", "ForestGreen", "Blue", "Red", "DarkTurquoise", "Black", "Brown"
  929. X  };
  930. X  
  931. X  static Pixmap   pms[NUM_BITMAPS];
  932. X
  933. X--- 124,130 -----
  934. X  };
  935. X  
  936. X  static char    *thingFGs[NUM_THINGS] = {
  937. X!     "Magenta", "ForestGreen", "Blue", "Red", "DarkTurquoise", "Brown", "Black"
  938. X  };
  939. X  
  940. X  static Pixmap   pms[NUM_BITMAPS];
  941. X***************
  942. X*** 619,625
  943. X          for (i = j; i > 0; i--)
  944. X              lSet[i] = lSet[i-1];
  945. X          lSet[0] = 0;
  946. X!         
  947. X          j++;
  948. X          XFlush(display);
  949. X          }
  950. X
  951. X--- 626,642 -----
  952. X          for (i = j; i > 0; i--)
  953. X              lSet[i] = lSet[i-1];
  954. X          lSet[0] = 0;
  955. X! 
  956. X!         if (j > 0)
  957. X!             for (i = 0; i < COLS; i++) {
  958. X!             int             tmp = field[j][i].pm_num;
  959. X!             if ((tmp >= 0) && (tmp != checkDown[tmp])) {
  960. X!                 field[j][i].pm_num = checkDown[tmp];
  961. X!                 drawBox(blockWin, field[j][i].pm_num,
  962. X!                 field[j][i].cid, i * BOXSIZE, j * BOXSIZE);
  963. X!             }
  964. X!             }
  965. X! 
  966. X          j++;
  967. X  
  968. X          if (j < ROWS)
  969. X***************
  970. X*** 621,626
  971. X          lSet[0] = 0;
  972. X          
  973. X          j++;
  974. X          XFlush(display);
  975. X          }
  976. X      }
  977. X
  978. X--- 638,654 -----
  979. X              }
  980. X  
  981. X          j++;
  982. X+ 
  983. X+         if (j < ROWS)
  984. X+             for (i = 0; i < COLS; i++) {
  985. X+             int             tmp = field[j][i].pm_num;
  986. X+             if ((tmp >= 0) && (tmp != checkUp[tmp])) {
  987. X+                 field[j][i].pm_num = checkUp[tmp];
  988. X+                 drawBox(blockWin, field[j][i].pm_num,
  989. X+                 field[j][i].cid, i * BOXSIZE, j * BOXSIZE);
  990. X+             }
  991. X+             }
  992. X+ 
  993. X          XFlush(display);
  994. X          }
  995. X      }
  996. X
  997. END_OF_FILE
  998. if test 25665 -ne `wc -c <'patches01'`; then
  999.     echo shar: \"'patches01'\" unpacked with wrong size!
  1000. fi
  1001. # end of 'patches01'
  1002. fi
  1003. echo shar: End of shell archive.
  1004. exit 0
  1005.