home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / games / volume6 / sun-tetris2.pch1 < prev    next >
Internet Message Format  |  1989-07-06  |  9KB

  1. Path: uunet!tektronix!tekgen!tekred!tekred.CNA.TEK.COM!games
  2. From: games@tekred.CNA.TEK.COM
  3. Newsgroups: comp.sources.games
  4. Subject: v06i050:  sun-tetris2.pch1 - tetris for SunView in colour, patch1
  5. Message-ID: <3885@tekred.CNA.TEK.COM>
  6. Date: 26 Apr 89 16:54:34 GMT
  7. Sender: billr@tekred.CNA.TEK.COM
  8. Lines: 214
  9. Approved: billr@saab.CNA.TEK.COM
  10.  
  11. Submitted-by: shortley@CompSci.Bristol.AC.UK (Martyn Shortley)
  12. Posting-number: Volume 6, Issue 50
  13. Archive-name: sun-tetris2/Patch1
  14.  
  15.     [This is also from the bugs group. BTW, my criteria for posting
  16.      patches here is 1) were they posted or sent to me by the original
  17.      author, 2) were they sent directly to me and not posted to the bugs
  18.      group.  I prefer to have an "official" patch from the original
  19.      author(s) whenever possible, even if someone else posted a fix
  20.      to the bugs group.  The bugs group is not archived, so I try and
  21.      put important patches here so later users will find the patches
  22.      along with the original source.  -br]
  23.  
  24. Since we posted the source for tetris under Sunview, we have discovered a few
  25. minor bugs.
  26. These are :
  27.     The user could rotate blocks off the edge of the screen.
  28.     The user could rotate blocks off the bottom of the screen.
  29.     Under certain circumstances, the wrong high score is highlighted.
  30.  
  31. Fixes for these are included.
  32. The first fix was included in the original posting - we sent the fix before
  33. the game was posted to comp.sources.games
  34.  
  35. We have also had some feedback asking what a good score is.
  36. Our high score table is included below - If you've done better - mail us.
  37.  
  38. Pos  Name             Score  Rows Lev  Mchine     When
  39.   1) Peter Pan         7984   536  53  happy       Sat Apr  8 16:29:54 1989
  40.   2) wai-lun           7396   499  49  bashful     Wed Apr  5 09:08:17 1989
  41.   3) Atlantis          2761   168  16  happy       Tue Apr  4 17:40:05 1989
  42.   4) carol             1968   114  11  grumpy      Thu Apr  6 17:30:28 1989
  43.   5) Black Hat         1825   103  10  grumpy      Sat Apr  1 16:13:24 1989
  44.   6) huw                768    35   3  sleepy      Thu Apr  6 17:51:55 1989
  45.   7) Pretty poor        640    24   2  snoopy      Thu Apr  6 18:43:09 1989
  46.   8) clive               88     0   0  snoopy      Tue Apr  4 16:56:02 1989
  47.   9)                      0     0   0
  48.  10)                      0     0   0
  49.  
  50.  
  51. Martyn Shortley & Phill Everson
  52.  
  53. Please do not use UUCP unless there is NO other path available.
  54. ----------------------------------------------------------------------------
  55. SNAIL:     Martyn Shortley, 19 Hampton Park, Redland, BRISTOL       |
  56.             BS6 6LG, England, UK                                    |
  57. JANET:     martyn@uk.ac.bristol.compsci.med-image                   |
  58. ARPANET:   martyn%med-image.compsci.bristol.ac.uk@nss.cs.ucl.ac.uk  |
  59. BITNET:    martyn%uk.ac.bristol.compsci.med-image@ukacrl.bitnet     |
  60. ----------------------------------------------------------------------------
  61. OR                                                  |
  62.                                                     |
  63. JANET:     shortley@uk.ac.bris.cs                   |  "A T & T ?
  64. UUCP:      ...mcvax!ukc!csisles!shortley            |  - That name rings a
  65. ARPANET:   shortley%cs.bris.ac.uk@nss.cs.ucl.ac.uk  |    bell"
  66. BITNET:    shortley%uk.ac.bris.cs@ukacrl.bitnet     |
  67. ----------------------------------------------------------------------------
  68.  
  69. #--------------------------------CUT HERE-------------------------------------
  70. #! /bin/sh
  71. #
  72. # This is a shell archive.  Save this into a file, edit it
  73. # and delete all lines above this comment.  Then give this
  74. # file to sh by executing the command "sh file".  The files
  75. # will be extracted into the current directory owned by
  76. # you with default permissions.
  77. #
  78. # The files contained herein are:
  79. #
  80. # -rw-r--r--   1 martyn   devpt       4904 Apr  5 10:12 bugfixes.c
  81. #
  82. echo 'x - bugfixes.c'
  83. if test -f bugfixes.c; then echo 'shar: not overwriting bugfixes.c'; else
  84. sed 's/^X//' << '________This_Is_The_END________' > bugfixes.c
  85. X/*
  86. X * This is the new check_rot routine to stop people rotating blocks
  87. X * off the side or bottom of the screen.
  88. X * It should replace the one in "support.c"
  89. X *
  90. X *  Martyn Shortley  5th April 1989
  91. X *
  92. X */
  93. X
  94. Xcheck_rot(shape_no, xpos, ypos, newrot)
  95. X        int     shape_no, xpos, ypos, newrot;
  96. X{
  97. X        int     i;
  98. X        int     ti;             /* Bit map of i'th row    */
  99. X        int     yi;             /* Y position on i'th row */
  100. X        int     x0, x1, x2, x3;
  101. X
  102. X        x0 = xpos;
  103. X        x1 = xpos + 1;
  104. X        x2 = xpos + 2;
  105. X        x3 = xpos + 3;
  106. X        yi = ypos;
  107. X
  108. X        for (i = 0; i < 4; yi++, i++) {
  109. X                if ((yi) >= 0) {
  110. X                        ti = shape[shape_no].table[i][newrot];
  111. X                        if ((yi >= UHEIGHT) && (ti != 0))
  112. X                                return FALSE;
  113. X                        if (ti & 8)
  114. X                                if ((x0 < 0) || (x0 >= UWIDTH) || (grid[x0][yi] == 1))
  115. X                                        return FALSE;
  116. X                        if (ti & 4)
  117. X                                if ((x1 < 0) || (x1 >= UWIDTH) || (grid[x1][yi] == 1))
  118. X                                        return FALSE;
  119. X                        if (ti & 2)
  120. X                                if ((x2 < 0) || (x2 >= UWIDTH) || (grid[x2][yi] == 1))
  121. X                                        return FALSE;
  122. X                        if (ti & 1)
  123. X                                if ((x3 < 0) || (x3 >= UWIDTH) || (grid[x3][yi] == 1))
  124. X                                        return FALSE;
  125. X                }
  126. X        }
  127. X        return TRUE;
  128. X}
  129. X
  130. X
  131. X/*
  132. X * These are the new scoring routines.
  133. X *
  134. X * Instead of storing the top 10 scores, they store the best score for each
  135. X * person in the top 10.  Designed to stop the high-score table being full
  136. X * of scores by only one person.
  137. X *
  138. X * They should replace the ones in "score.c" if you want to have a high-score
  139. X * table as mentioned above.
  140. X * NB The variable "score_position" is now not used by these routines
  141. X *
  142. X * Martyn Shortley     5th April 1989
  143. X *
  144. X */
  145. X
  146. X
  147. Xupdate_highscore_table()
  148. X{
  149. X    /* This version only allows 1 entry in the HIGH SCORE TABLE per user */
  150. X        int     i, j;
  151. X        long    when;
  152. X        extern char *ctime();
  153. X        extern long time();
  154. X        char    hostname[20];
  155. X        char    buf[BUFSIZ];
  156. X
  157. X        /* re-read high-score table in case someone else on the network is
  158. X         * playing at the same time */
  159. X        read_high_scores();
  160. X
  161. X        /* Check for previous best score */
  162. X        for (i = 0; (i < HIGH_TABLE_SIZE) && (strcmp(name, high_scores[i].name) != 0); i++);
  163. X        if (i < HIGH_TABLE_SIZE) {
  164. X                if (high_scores[i].score >= score)
  165. X                        return;         /* Same/worse score - no update */
  166. X                for (j = i; j > 0; j--) /* Remove previous best */
  167. X                        high_scores[j] = high_scores[j - 1];
  168. X        }
  169. X        /* Next line finds score greater than current one */
  170. X        for (i = 0; ((i < HIGH_TABLE_SIZE) && (score >= high_scores[i].score)); i++);
  171. X        i--;
  172. X        if (i >= 0) {
  173. X                for (j = 0; j < i; j++)
  174. X                        high_scores[j] = high_scores[j + 1];
  175. X                strcpy(high_scores[i].name, name);
  176. X                high_scores[i].score = score;
  177. X                high_scores[i].rows = rows;
  178. X                high_scores[i].level = rows / 10;
  179. X                if (gethostname(hostname, BUFSIZ) == -1)
  180. X                        strcpy(high_scores[i].hostname, "unknown-host");
  181. X                else
  182. X                        strcpy(high_scores[i].hostname, hostname);
  183. X                time(&when);
  184. X                strcpy(buf, ctime(&when));      /* ctime() adds a newline
  185. X                                                 * char */
  186. X                strip_eoln(buf);                /* so remove it */
  187. X                strcpy(high_scores[i].date, buf);
  188. X                write_high_scores();
  189. X        }
  190. X}
  191. X
  192. Xvoid
  193. Xprint_high_scores()
  194. X{
  195. X        int     i;
  196. X        char    buf[BUFSIZ];
  197. X
  198. X        /* re-read high-score table in case someone else on the network is
  199. X         * playing at the same time */
  200. X        read_high_scores();
  201. X
  202. X        for (i = HIGH_TABLE_SIZE - 1; i >= 0; i--) {
  203. X                sprintf(buf, "%3d) %-15s %6d %5d %3d  %-10s  %s\n",
  204. X                        HIGH_TABLE_SIZE - i,
  205. X                        high_scores[i].name,
  206. X                        high_scores[i].score,
  207. X                        high_scores[i].rows,
  208. X                        high_scores[i].level,
  209. X                        high_scores[i].hostname,
  210. X                        high_scores[i].date);
  211. X                panel_set(high_score_item[HIGH_TABLE_SIZE - i], PANEL_LABEL_BOLD, FALSE, PANEL_LABEL_STRING, buf, 0);
  212. X                if (strcmp(name, high_scores[i].name) == 0)
  213. X                        panel_set(high_score_item[HIGH_TABLE_SIZE - i], PANEL_LABEL_BOLD, TRUE, 0);
  214. X        }
  215. X        window_set(score_frame, WIN_SHOW, TRUE, 0);
  216. X}
  217. X
  218. X
  219. ________This_Is_The_END________
  220. if test `wc -l < bugfixes.c` -ne 134; then
  221.     echo 'shar: bugfixes.c was damaged during transit (should have been 134 lines)'
  222. fi
  223. fi        ; : end of overwriting check
  224. exit 0
  225.