home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1994 March / Source_Code_CD-ROM_Walnut_Creek_March_1994.iso / compsrcs / x / volume18 / xmris / patch1.03 < prev    next >
Encoding:
Text File  |  1992-07-28  |  50.5 KB  |  1,849 lines

  1. Newsgroups: comp.sources.x
  2. Path: uunet!uunet!elroy.jpl.nasa.gov!sdd.hp.com!mips!msi!dcmartin
  3. From: Nathan Sidwell <nathan@inmos.co.uk>
  4. Subject: v18i074: xmris version 2.00, Patch1, Part03/05
  5. Message-ID: <1992Jul29.181114.15648@msi.com>
  6. Originator: dcmartin@fascet
  7. Sender: dcmartin@msi.com (David C. Martin - Moderator)
  8. Organization: Molecular Simulations, Inc.
  9. References: <csx-18i072-xmris@uunet.UU.NET>
  10. Date: Wed, 29 Jul 1992 18:11:14 GMT
  11. Approved: dcmartin@msi.com
  12. Lines: 1835
  13.  
  14. Submitted-by: Nathan Sidwell <nathan@inmos.co.uk>
  15. Posting-number: Volume 18, Issue 74
  16. Archive-name: xmris/patch1.03
  17. Patch-To: xmris: Volume XXX, Issue XXX
  18.  
  19. #!/bin/sh
  20. # this is part.03 (part 3 of a multipart archive)
  21. # do not concatenate these parts, unpack them in order with /bin/sh
  22. # file patch.v2.00 continued
  23. #
  24. if test ! -r _shar_seq_.tmp; then
  25.     echo 'Please unpack part 1 first!'
  26.     exit 1
  27. fi
  28. (read Scheck
  29.  if test "$Scheck" != 3; then
  30.     echo Please unpack part "$Scheck" next!
  31.     exit 1
  32.  else
  33.     exit 0
  34.  fi
  35. ) < _shar_seq_.tmp || exit 1
  36. if test ! -f _shar_wnt_.tmp; then
  37.     echo 'x - still skipping patch.v2.00'
  38. else
  39. echo 'x - continuing file patch.v2.00'
  40. sed 's/^X//' << 'SHAR_EOF' >> 'patch.v2.00' &&
  41. !     spawn_monster(SPRITE_MRIS + i, 1, 1, CELLS_ACROSS / 2 - 2 + i,
  42. !         2, 0, -(CELL_HEIGHT + GAP_HEIGHT) * 3 - CELL_HEIGHT / 2 * i);
  43. X        }
  44. X    }
  45. X    /*}}}*/
  46. --- 528,544 ----
  47. X    /*{{{  add m r i s*/
  48. X    {
  49. X      unsigned  i;
  50. +     
  51. X      for(i = 4; i--;)
  52. X        {
  53. X      XCopyArea(display.display, sprites[SPRITE_MRIS + 4 + i].mask,
  54. X          display.back, GCN(GC_MASK), 0, 0, CELL_WIDTH, CELL_HEIGHT,
  55. !         PIXELX(CELLS_ACROSS / 2 - 2 + (int)i, 0), PIXELY(2, 0));
  56. X      XCopyArea(display.display, sprites[SPRITE_MRIS + 4 + i].image,
  57. X          display.back, GCN(GC_OR), 0, 0, CELL_WIDTH, CELL_HEIGHT,
  58. !         PIXELX(CELLS_ACROSS / 2 - 2 + (int)i, 0), PIXELY(2, 0));
  59. !     spawn_monster(SPRITE_MRIS + i, 1, 1, CELLS_ACROSS / 2 - 2 + (int)i, 2,
  60. !         0, -(CELL_HEIGHT + GAP_HEIGHT) * 3 - (int)CELL_HEIGHT / 2 * (int)i);
  61. X        }
  62. X    }
  63. X    /*}}}*/
  64. ***************
  65. *** 318,328 ****
  66. X      BOARDCELL(CELLS_ACROSS - 1, DEN_Y)->depths[3] = 0;
  67. X    }
  68. X    /*}}}*/
  69. !   global.state = 5;
  70. X    thrown = 0;
  71. X    while(thrown != 3)
  72. X      {
  73. !       process_xevents(1);
  74. X        if(!monster.list[0].offset.x && !thrown)
  75. X      {
  76. X        thrown = 1;
  77. --- 564,574 ----
  78. X      BOARDCELL(CELLS_ACROSS - 1, DEN_Y)->depths[3] = 0;
  79. X    }
  80. X    /*}}}*/
  81. !   global.state = MODE_GAME_DEMO;
  82. X    thrown = 0;
  83. X    while(thrown != 3)
  84. X      {
  85. !       process_xevents(0);
  86. X        if(!monster.list[0].offset.x && !thrown)
  87. X      {
  88. X        thrown = 1;
  89. ***************
  90. *** 339,363 ****
  91. X      }
  92. X        else if(!player.ball.state && thrown == 1)
  93. X      {
  94. !       spawn_monster(SPRITE_PLAYER + 6, 0, 1, player.lives - 1, CELLS_DOWN,
  95. !           0, -(CELL_HEIGHT + GAP_HEIGHT) * 3);
  96. X        thrown = 2;
  97. X      }
  98. !       if(!move_demo() && thrown == 2)
  99. X      thrown = 3;
  100. X        show_updates();
  101. X        timer_wait();
  102. X      }
  103. X    XCopyArea(display.display, display.copy, display.back, GCN(GC_COPY),
  104. !       PIXELX(player.lives - 1, 0), PIXELY(CELLS_DOWN, 0),
  105. X        CELL_WIDTH, CELL_HEIGHT,
  106. !       PIXELX(player.lives - 1, 0), PIXELY(CELLS_DOWN, 0));
  107. X    player.lives++;
  108. X    return;
  109. X  }
  110. X  /*}}}*/
  111. ! /*{{{  int move_demo()*/
  112. ! static int move_demo FUNCARGVOID
  113. X  /*
  114. X   * moves the monsters used in the demo screens
  115. X   * we take each monster with a non-zero offset, and move it
  116. --- 585,842 ----
  117. X      }
  118. X        else if(!player.ball.state && thrown == 1)
  119. X      {
  120. !       spawn_monster(SPRITE_PLAYER + 6, 0, 1, (int)player.lives - 1, 
  121. !           CELLS_DOWN, 0, -(CELL_HEIGHT + GAP_HEIGHT) * 3);
  122. X        thrown = 2;
  123. X      }
  124. !       if(!move_demo(MONSTER_CYCLES) && thrown == 2)
  125. X      thrown = 3;
  126. X        show_updates();
  127. X        timer_wait();
  128. X      }
  129. X    XCopyArea(display.display, display.copy, display.back, GCN(GC_COPY),
  130. !       PIXELX((int)player.lives - 1, 0), PIXELY(CELLS_DOWN, 0),
  131. X        CELL_WIDTH, CELL_HEIGHT,
  132. !       PIXELX((int)player.lives - 1, 0), PIXELY(CELLS_DOWN, 0));
  133. X    player.lives++;
  134. X    return;
  135. X  }
  136. X  /*}}}*/
  137. ! /*{{{  void file_changed(stream)*/
  138. ! #if HIGH_SCORE_FILE
  139. ! static unsigned file_changed FUNCARGLIST((stream))
  140. ! FILE    *stream FUNCARGTERM
  141. ! {
  142. !   static  time_t last_time = 0;
  143. !   struct stat buffer;
  144. !   unsigned  changed;
  145. !   
  146. !   if(!fstat(fileno(stream), &buffer))
  147. !     {
  148. !       changed = buffer.st_mtime != last_time;
  149. !       last_time = buffer.st_mtime;
  150. !     }
  151. !   else
  152. !     changed = 0;
  153. !   return changed;
  154. ! }
  155. ! #endif /* HIGH_SCORE_FILE */
  156. ! /*}}}*/
  157. ! /*{{{  void get_lock(stream)*/
  158. ! #if HIGH_SCORE_FILE
  159. ! static void get_lock FUNCARGLIST((stream))
  160. ! FILE    *stream FUNCARGTERM
  161. ! {
  162. !   rewind(stream);
  163. !   fflush(stream);
  164. !   while(lock_file(stream))
  165. !     {
  166. !       if(errno == EINTR)
  167. !     continue;
  168. !     }
  169. !   return;
  170. ! }
  171. ! #endif /* HIGH_SCORE_FILE */
  172. ! /*}}}*/
  173. ! /*{{{  void get_unlock(stream)*/
  174. ! #if HIGH_SCORE_FILE
  175. ! static void get_unlock FUNCARGLIST((stream))
  176. ! FILE    *stream FUNCARGTERM
  177. ! {
  178. !   rewind(stream);
  179. !   fflush(stream);
  180. !   unlock_file(stream);
  181. !   return;
  182. ! }
  183. ! #endif /* HIGH_SCORE_FILE */
  184. ! /*}}}*/
  185. ! /*{{{  void high_score(score, screen)*/
  186. ! extern void high_score FUNCARGLIST((score, screen))
  187. ! unsigned  score FUNCARGSEP
  188. ! unsigned  screen FUNCARGTERM
  189. ! {
  190. !   HIGH_SCORE     *sptr;
  191. !   unsigned  count;
  192. !   
  193. !   my_score.score = score;
  194. !   my_score.screen = screen;
  195. !   my_score.stamp = time(NULL);
  196. !   for(sptr = high_scores, count = HIGH_SCORES; count--; sptr++)
  197. !     if(sptr->score < score)
  198. !       {
  199. !     HIGH_SCORE     *dptr;
  200. !     
  201. !     for(dptr = &high_scores[HIGH_SCORES - 1]; dptr != sptr; dptr--)
  202. !       memmove(dptr, dptr - 1, sizeof(HIGH_SCORE));
  203. !     memmove(sptr, &my_score, sizeof(HIGH_SCORE));
  204. ! #if HIGH_SCORE_FILE
  205. !     if(score_file)
  206. !       {
  207. !         FILE    *stream;
  208. !         
  209. !         stream = fopen(score_file, "r+");
  210. !         if(stream)
  211. !           {
  212. !         get_lock(stream);
  213. !         merge_scores(stream);
  214. !         write_scores(stream);
  215. !         get_unlock(stream);
  216. !         fclose(stream);
  217. !           }
  218. !       }
  219. ! #endif
  220. !     break;
  221. !       }
  222. !   return;
  223. ! }
  224. ! /*}}}*/
  225. ! /*{{{  void init_scores()*/
  226. ! extern void init_scores FUNCARGVOID
  227. ! {
  228. !   HIGH_SCORE     *sptr;
  229. !   unsigned  count;
  230. !   
  231. !   my_score.score = 0;
  232. !   for(sptr = high_scores, count = HIGH_SCORES; count--; sptr++)
  233. !     {
  234. !       sptr->score = 0;
  235. !       sptr->screen = 0;
  236. !       sptr->name[0] = 0;
  237. !     }
  238. !   /*{{{  set the name*/
  239. !   {
  240. !     char const *user;
  241. !     
  242. !     user = getenv("USER");
  243. !     if(!user)
  244. !       user = "Unknown";
  245. !     strncpy(my_score.name, user, NAME_LEN);
  246. !     my_score.name[NAME_LEN] = 0;
  247. !   }
  248. !   /*}}}*/
  249. ! #if HIGH_SCORE_FILE
  250. !   if(score_file)
  251. !     {
  252. !       FILE    *stream;
  253. !       
  254. !       stream = fopen(score_file, "r+");
  255. !       if(stream)
  256. !     {
  257. !       get_lock(stream);
  258. !       merge_scores(stream);
  259. !       get_unlock(stream);
  260. !       fclose(stream);
  261. !     }
  262. !       else
  263. !     score_file = NULL;
  264. !     }
  265. ! #endif /* HIGH_SCORE_FILE */
  266. !   return;
  267. ! }
  268. ! /*}}}*/
  269. ! /*{{{  unsigned merge_scores(stream)*/
  270. ! #if HIGH_SCORE_FILE
  271. ! static unsigned merge_scores FUNCARGLIST((stream))
  272. ! FILE      *stream FUNCARGTERM
  273. ! /* 
  274. !  * merges the high score file into the current high score
  275. !  * table. If the score file is corrupted, then we lose the
  276. !  * merged entries. The file must have been locked appropriately.
  277. !  * returns non-zero if the file is unreadable
  278. !  */
  279. ! {
  280. !   char      line[NAME_LEN + 33];
  281. !   unsigned  checksum;
  282. !   unsigned  check;
  283. !   unsigned  merged;
  284. !   char      *ptr;
  285. !   unsigned  failed;
  286. !   
  287. !   clearerr(stream);
  288. !   rewind(stream);
  289. !   if(!fgets(line, sizeof(line), stream))
  290. !     return 1;
  291. !   checksum = strtol(line, &ptr, 10);
  292. !   if(*ptr != '\n')
  293. !     return 1;
  294. !   check = 0;
  295. !   merged = 0;
  296. !   while(fgets(line, sizeof(line), stream) && strcmp(line, "EOF\n"))
  297. !     {
  298. !       HIGH_SCORE  *sptr;
  299. !       unsigned  index;
  300. !       time_t    stamp;
  301. !       unsigned  score;
  302. !       unsigned  screen;
  303. !       unsigned  length;
  304. !       char      *name;
  305. !       
  306. !       stamp = strtol(line, &ptr, 10);
  307. !       ptr++;
  308. !       score = strtol(ptr, &ptr, 10);
  309. !       ptr++;
  310. !       screen = strtol(ptr, &ptr, 10);
  311. !       ptr++;
  312. !       name = ptr;
  313. !       length = strlen(ptr) - 1;
  314. !       if(!score || !screen || ptr[length] != '\n' || length > NAME_LEN)
  315. !     break;
  316. !       name[length] = 0;
  317. !       check += score + screen;
  318. !       for(ptr = name; *ptr; ptr++)
  319. !     check += *ptr;
  320. !       /*{{{  insert into table?*/
  321. !       for(sptr = high_scores, index = 0; index != HIGH_SCORES; index++, sptr++)
  322. !     if(stamp == sptr->stamp && sptr->score == score)
  323. !       break;
  324. !     else if(sptr->score < score)
  325. !       {
  326. !         HIGH_SCORE  *dptr;
  327. !           
  328. !         merged = (merged & ((1 << index) - 1)) | 
  329. !         ((merged & ~((1 << index) - 1)) << 1) | (1 << index);
  330. !         for(dptr = &high_scores[HIGH_SCORES - 1]; dptr != sptr; dptr--)
  331. !           memcpy(dptr, dptr - 1, sizeof(HIGH_SCORE));
  332. !         sptr->stamp = stamp;
  333. !         sptr->score = score;
  334. !         sptr->screen = screen;
  335. !         strcpy(sptr->name, name);
  336. !         break;
  337. !       }
  338. !       /*}}}*/
  339. !     }
  340. !   failed = ferror(stream) || check != checksum;
  341. !   /*{{{  failed?*/
  342. !   if(failed)
  343. !     {
  344. !       HIGH_SCORE  *ptr;
  345. !       HIGH_SCORE  *dest;
  346. !       unsigned  index;
  347. !     
  348. !       for(ptr = high_scores, index = 0; index != HIGH_SCORES; index++, ptr++)
  349. !     if(merged & (1 << index))
  350. !       ptr->score = 0;
  351. !       for(ptr = dest = high_scores, index = HIGH_SCORES; index--; ptr++)
  352. !     if(!ptr->score)
  353. !       /*EMPTY*/;
  354. !     else if(ptr == dest)
  355. !       dest++;
  356. !     else
  357. !       {
  358. !         memcpy(dest, ptr, sizeof(HIGH_SCORE));
  359. !         dest++;
  360. !       }
  361. !       for(;dest != ptr; dest++)
  362. !     dest->score = 0;
  363. !     }
  364. !   /*}}}*/
  365. !   return failed;
  366. ! }
  367. ! #endif /* HIGH_SCORE_FILE */
  368. ! /*}}}*/
  369. ! /*{{{  int move_demo(cycle)*/
  370. ! static int move_demo FUNCARGLIST((cycle))
  371. ! unsigned  cycle FUNCARGTERM
  372. X  /*
  373. X   * moves the monsters used in the demo screens
  374. X   * we take each monster with a non-zero offset, and move it
  375. ***************
  376. *** 381,387 ****
  377. X          /*{{{  left or right*/
  378. X          {
  379. X            int       dir;
  380. !                 
  381. X            moved++;
  382. X            if(mptr->offset.x > 0)
  383. X          {
  384. --- 860,866 ----
  385. X          /*{{{  left or right*/
  386. X          {
  387. X            int       dir;
  388. !                                                         
  389. X            moved++;
  390. X            if(mptr->offset.x > 0)
  391. X          {
  392. ***************
  393. *** 400,406 ****
  394. X            mptr->dir = dir;
  395. X            new_face(mptr);
  396. X          }
  397. !                   
  398. X          }
  399. X          /*}}}*/
  400. X        else if(mptr->offset.y)
  401. --- 879,885 ----
  402. X            mptr->dir = dir;
  403. X            new_face(mptr);
  404. X          }
  405. !                                                           
  406. X          }
  407. X          /*}}}*/
  408. X        else if(mptr->offset.y)
  409. ***************
  410. *** 407,413 ****
  411. X          /*{{{  up or down*/
  412. X          {
  413. X            int       dir;
  414. !                 
  415. X            moved++;
  416. X            if(mptr->offset.y > 0)
  417. X          {
  418. --- 886,892 ----
  419. X          /*{{{  up or down*/
  420. X          {
  421. X            int       dir;
  422. !                                                         
  423. X            moved++;
  424. X            if(mptr->offset.y > 0)
  425. X          {
  426. ***************
  427. *** 426,432 ****
  428. X            mptr->dir = dir;
  429. X            new_face(mptr);
  430. X          }
  431. !                   
  432. X          }
  433. X          /*}}}*/
  434. X        else
  435. --- 905,911 ----
  436. X            mptr->dir = dir;
  437. X            new_face(mptr);
  438. X          }
  439. !                                                           
  440. X          }
  441. X          /*}}}*/
  442. X        else
  443. ***************
  444. *** 435,441 ****
  445. X          {
  446. X            if(!mptr->cycle)
  447. X          {
  448. !           mptr->cycle = MONSTER_CYCLES;
  449. X            mptr->image++;
  450. X            if(mptr->image == MONSTER_IMAGES)
  451. X              mptr->image = 0;
  452. --- 914,920 ----
  453. X          {
  454. X            if(!mptr->cycle)
  455. X          {
  456. !           mptr->cycle = cycle;
  457. X            mptr->image++;
  458. X            if(mptr->image == MONSTER_IMAGES)
  459. X              mptr->image = 0;
  460. ***************
  461. *** 466,475 ****
  462. X        cptr = BOARDCELL(mptr->cell.x, mptr->cell.y);
  463. X        if(mptr->offset.x || mptr->offset.y)
  464. X      move_movable(mptr, cptr);
  465. !       else if(!mptr->cell.y && mptr->cell.x == 4 + i)
  466. X      {
  467. !       if(monster.den == i)
  468. !         monster.den = i + 1;
  469. X      }
  470. X        else
  471. X      {
  472. --- 945,963 ----
  473. X        cptr = BOARDCELL(mptr->cell.x, mptr->cell.y);
  474. X        if(mptr->offset.x || mptr->offset.y)
  475. X      move_movable(mptr, cptr);
  476. !       else if(!mptr->cell.y && mptr->cell.x == monster.den + 4 && 
  477. !       monster.den == ((mptr->type - SPRITE_MRIS) & 3))
  478. X      {
  479. !       SPRITE  *sptr;
  480. !       
  481. !       sptr = &sprites[mptr->type];
  482. !       mptr->type = 5;
  483. !       XCopyArea(display.display, sptr->mask, display.back, GCN(GC_MASK),
  484. !           0, 0, CELL_WIDTH, CELL_HEIGHT,
  485. !           mptr->old_pixel.x, mptr->old_pixel.y);
  486. !       XCopyArea(display.display, sptr->image, display.back, GCN(GC_OR),
  487. !           0, 0, CELL_WIDTH, CELL_HEIGHT,
  488. !           mptr->old_pixel.x, mptr->old_pixel.y);
  489. X      }
  490. X        else
  491. X      {
  492. ***************
  493. *** 480,486 ****
  494. X        temp = valid & (0xF ^ (1 << (mptr->dir ^ 1)));
  495. X        if(temp)
  496. X          valid &= temp | 0xF0;
  497. !       if(monster.den == i && (temp = valid & (valid >> 4)))
  498. X          valid = temp;
  499. X        else
  500. X          valid &= 0xF;
  501. --- 968,975 ----
  502. X        temp = valid & (0xF ^ (1 << (mptr->dir ^ 1)));
  503. X        if(temp)
  504. X          valid &= temp | 0xF0;
  505. !       if(monster.den == ((mptr->type - SPRITE_MRIS) & 3) && 
  506. !           (temp = valid & (valid >> 4)))
  507. X          valid = temp;
  508. X        else
  509. X          valid &= 0xF;
  510. ***************
  511. *** 511,555 ****
  512. X      unsigned  base;
  513. X      unsigned  screens;
  514. X      unsigned  index;
  515. -     TEXT      info;
  516. X      char      text[11];
  517. X      unsigned  length;
  518. !     static int sprites[3] = {SPRITE_CHERRY, SPRITE_NORMAL + 4, SPRITE_PLAYER + 4};
  519. !       
  520. X      screens = player.screen < CELLS_DOWN - 2 ? player.screen : CELLS_DOWN - 2;
  521. X      base = player.screen - screens;
  522. -     text_size("Screen 090", 10, &info);
  523. X      for(index = screens; index--;)
  524. X        {
  525. X      sprintf(text, "Screen %d", base + index + 1);
  526. X      length = strlen(text);
  527. X      XDrawImageString(display.display, display.back, GCN(GC_TEXT),
  528. !         PIXELX(CELLS_ACROSS / 2, -GAP_WIDTH) - info.width,
  529. !         PIXELY(screens - index, (CELL_HEIGHT + GAP_HEIGHT) / 2) +
  530. !         (info.ascent - info.descent) / 2,
  531. !         text, length);
  532. X      if(history.prize & 1 << (screens - 1 - index))
  533. X        spawn_monster(SPRITE_PRIZE_BASE +
  534. X            (base + index) % SPRITE_PRIZES, 0, 0,
  535. !           CELLS_ACROSS / 2 + 2, screens - index,
  536. !           0, index * (2 * CELL_HEIGHT + GAP_HEIGHT) +
  537. X            CELLS_DOWN * GAP_HEIGHT + CELL_HEIGHT / 2 + GAP_HEIGHT +
  538. !           (CELL_HEIGHT + GAP_HEIGHT) * (2 + CELLS_DOWN - screens));
  539. X      spawn_monster(sprites[(history.ending >>
  540. X          (screens - 1 - index) * 2) & 3],
  541. !         0, 0, CELLS_ACROSS / 2, screens - index,
  542. !         0, index * (2 * CELL_HEIGHT + GAP_HEIGHT) +
  543. X          CELLS_DOWN * GAP_HEIGHT + 
  544. !         (CELL_HEIGHT + GAP_HEIGHT) * (2 + CELLS_DOWN - screens));
  545. X        }
  546. X    }
  547. X    /*}}}*/
  548. !   global.state = 8;
  549. X    count = DISPLAY_HOLD;
  550. X    while(count)
  551. X      {
  552. !       process_xevents(1);
  553. !       if(!move_demo())
  554. X      count--;
  555. X        show_updates();
  556. X        timer_wait();
  557. --- 1000,1041 ----
  558. X      unsigned  base;
  559. X      unsigned  screens;
  560. X      unsigned  index;
  561. X      char      text[11];
  562. X      unsigned  length;
  563. !     static unsigned sprites[3] = {SPRITE_CHERRY, SPRITE_NORMAL + 4, SPRITE_PLAYER + 4};
  564. !     
  565. X      screens = player.screen < CELLS_DOWN - 2 ? player.screen : CELLS_DOWN - 2;
  566. X      base = player.screen - screens;
  567. X      for(index = screens; index--;)
  568. X        {
  569. X      sprintf(text, "Screen %d", base + index + 1);
  570. X      length = strlen(text);
  571. X      XDrawImageString(display.display, display.back, GCN(GC_TEXT),
  572. !         PIXELX(CELLS_ACROSS / 2, -GAP_WIDTH) - (int)(font.width * length),
  573. !         PIXELY((int)(screens - index), (CELL_HEIGHT + GAP_HEIGHT) / 2) +
  574. !         font.center, text, (int)length);
  575. X      if(history.prize & 1 << (screens - 1 - index))
  576. X        spawn_monster(SPRITE_PRIZE_BASE +
  577. X            (base + index) % SPRITE_PRIZES, 0, 0,
  578. !           CELLS_ACROSS / 2 + 2, (int)(screens - index),
  579. !           0, (int)index * (2 * CELL_HEIGHT + GAP_HEIGHT) +
  580. X            CELLS_DOWN * GAP_HEIGHT + CELL_HEIGHT / 2 + GAP_HEIGHT +
  581. !           (CELL_HEIGHT + GAP_HEIGHT) * (2 + CELLS_DOWN - (int)screens));
  582. X      spawn_monster(sprites[(history.ending >>
  583. X          (screens - 1 - index) * 2) & 3],
  584. !         0, 0, CELLS_ACROSS / 2, (int)(screens - index),
  585. !         0, (int)index * (2 * CELL_HEIGHT + GAP_HEIGHT) +
  586. X          CELLS_DOWN * GAP_HEIGHT + 
  587. !         (CELL_HEIGHT + GAP_HEIGHT) * (2 + CELLS_DOWN - (int)screens));
  588. X        }
  589. X    }
  590. X    /*}}}*/
  591. !   global.state = MODE_GAME_DEMO;
  592. X    count = DISPLAY_HOLD;
  593. X    while(count)
  594. X      {
  595. !       process_xevents(0);
  596. !       if(!move_demo(MONSTER_CYCLES))
  597. X      count--;
  598. X        show_updates();
  599. X        timer_wait();
  600. ***************
  601. *** 556,559 ****
  602. --- 1042,1085 ----
  603. X      }
  604. X    return;
  605. X  }
  606. + /*}}}*/
  607. + /*{{{  void write_scores(stream)*/
  608. + #if HIGH_SCORE_FILE
  609. + static void write_scores FUNCARGLIST((stream))
  610. + FILE    *stream FUNCARGTERM
  611. + /* 
  612. +  * writes out the high score table to the file.
  613. +  * the file must have been locked appropriately.
  614. +  */
  615. + {
  616. +   unsigned  check;
  617. +   HIGH_SCORE  *sptr;
  618. +   unsigned  index;
  619. +   clearerr(stream);
  620. +   rewind(stream);
  621. +   check = 0;
  622. +   for(sptr = high_scores, index = HIGH_SCORES; index-- && sptr->score; sptr++)
  623. +     {
  624. +       char const *ptr;
  625. +       
  626. +       check += sptr->score + sptr->screen;
  627. +       for(ptr = sptr->name; *ptr; ptr++)
  628. +     check += *ptr;
  629. +     }
  630. +   fprintf(stream, "%d\n", check);
  631. +   for(sptr = high_scores, index = HIGH_SCORES; index-- && sptr->score; sptr++)
  632. +     fprintf(stream, "%ld %d %d %s\n", (long)sptr->stamp, 
  633. +     sptr->score, sptr->screen, sptr->name);
  634. +   if(ferror(stream))
  635. +     {
  636. +       clearerr(stream);
  637. +       rewind(stream);
  638. +     }
  639. +   fputs("EOF\n", stream);
  640. +   fflush(stream);
  641. +   file_changed(stream);
  642. +   return;
  643. + }
  644. + #endif /* HIGH_SCORE_FILE */
  645. X  /*}}}*/
  646. diff -c -r exp.v1.01/draw.c exp.v2.00/draw.c
  647. *** exp.v1.01/draw.c    Fri Jul 24 09:56:07 1992
  648. --- exp.v2.00/draw.c    Fri Jul 24 13:43:13 1992
  649. ***************
  650. *** 1,21 ****
  651. ! /*{{{  (C) 1992 Nathan Sidwell*/
  652. ! /*****************************************************************************
  653. !             X M R I S V1.01
  654. !             ---------------
  655. !             (C) 1992 Nathan Sidwell
  656. ! This program is copyright (C) 1992 Nathan Sidwell. This software and documentation
  657. ! is in the public domain. Permission is granted to distribute and compile
  658. ! verbatim copies of this software for non-commercial, non-profit use,
  659. ! without fee. The software may be modified, provided that both the above copyright
  660. ! notice and this permission notice appear.
  661. ! No guarantee is given as to the robustness or suitability of this
  662. ! software for your computer.
  663. ! Nathan Sidwell  INMOS UK |                 | nathan@inmos.co.uk       DoD#0390
  664. ! *****************************************************************************/
  665. ! /*}}}*/
  666. X  #include "xmris.h"
  667. X  #include "time.h"
  668. X  /*{{{  prototypes*/
  669. --- 1,4 ----
  670. ! /* (C) 1992 Nathan Sidwell */
  671. X  #include "xmris.h"
  672. X  #include "time.h"
  673. X  /*{{{  prototypes*/
  674. ***************
  675. *** 25,32 ****
  676. X  extern void add_background FUNCARGLIST((x, y, width, height))
  677. X  int       x       FUNCARGSEP
  678. X  int       y       FUNCARGSEP
  679. ! int       width   FUNCARGSEP
  680. ! int       height  FUNCARGTERM
  681. X  /*
  682. X   * adds an area to the background update list
  683. X   */
  684. --- 8,15 ----
  685. X  extern void add_background FUNCARGLIST((x, y, width, height))
  686. X  int       x       FUNCARGSEP
  687. X  int       y       FUNCARGSEP
  688. ! unsigned  width   FUNCARGSEP
  689. ! unsigned  height  FUNCARGTERM
  690. X  /*
  691. X   * adds an area to the background update list
  692. X   */
  693. ***************
  694. *** 76,82 ****
  695. X  /*}}}*/
  696. X  /*{{{  void draw_center(index)*/
  697. X  extern void draw_center FUNCARGLIST((index))
  698. ! int   index FUNCARGTERM
  699. X  /*
  700. X   * sets the center sprite and draws it on the background
  701. X   */
  702. --- 59,65 ----
  703. X  /*}}}*/
  704. X  /*{{{  void draw_center(index)*/
  705. X  extern void draw_center FUNCARGLIST((index))
  706. ! unsigned  index FUNCARGTERM
  707. X  /*
  708. X   * sets the center sprite and draws it on the background
  709. X   */
  710. ***************
  711. *** 171,177 ****
  712. X    /*{{{  add the xtra*/
  713. X    {
  714. X      unsigned  i;
  715. !       
  716. X      extra.escape = 0;
  717. X      for(i = 5; i--;)
  718. X        draw_extra_letter(i);
  719. --- 154,160 ----
  720. X    /*{{{  add the xtra*/
  721. X    {
  722. X      unsigned  i;
  723. !     
  724. X      extra.escape = 0;
  725. X      for(i = 5; i--;)
  726. X        draw_extra_letter(i);
  727. ***************
  728. *** 182,199 ****
  729. X    {
  730. X      char      text[10];
  731. X      int       length;
  732. !     int       ascent, descent;
  733. !     int       direction;
  734. !     XCharStruct chars;
  735. !       
  736. X      strcpy(text, "Screen ");
  737. X      length = 7 + itoa(text + 7, player.screen, 0);
  738. -     XQueryTextExtents(display.display, font.font, text, length,
  739. -       &direction, &ascent, &descent, &chars);
  740. X      XDrawImageString(display.display, display.back, GCN(GC_TEXT),
  741. !     BORDER_LEFT + (CELL_WIDTH + GAP_WIDTH) * 8 +
  742. !     CELL_WIDTH / 2 + GAP_WIDTH, (CELL_HEIGHT - ascent - descent) / 2 +
  743. !     ascent + BORDER_TOP - CELL_HEIGHT, text, length);
  744. X    }
  745. X    /*}}}*/
  746. X    add_score(0, 0, 0);
  747. --- 165,176 ----
  748. X    {
  749. X      char      text[10];
  750. X      int       length;
  751. !     
  752. X      strcpy(text, "Screen ");
  753. X      length = 7 + itoa(text + 7, player.screen, 0);
  754. X      XDrawImageString(display.display, display.back, GCN(GC_TEXT),
  755. !     PIXELX(8, 0) + (int)font.width * 2, 
  756. !     PIXELY(-1, CELL_HEIGHT / 2) + font.center, text, length);
  757. X    }
  758. X    /*}}}*/
  759. X    add_score(0, 0, 0);
  760. ***************
  761. *** 202,212 ****
  762. X      {
  763. X        unsigned  lives;
  764. X        SPRITE    *sptr;
  765. !       
  766. X        sptr = &sprites[SPRITE_PLAYER + 6];
  767. X        for(lives = player.lives - 1; lives--;)
  768. X      {
  769. !       unsigned  x, y;
  770. X          
  771. X        x = PIXELX(lives, 0);
  772. X        y = PIXELY(CELLS_DOWN, 0);
  773. --- 179,189 ----
  774. X      {
  775. X        unsigned  lives;
  776. X        SPRITE    *sptr;
  777. !     
  778. X        sptr = &sprites[SPRITE_PLAYER + 6];
  779. X        for(lives = player.lives - 1; lives--;)
  780. X      {
  781. !       int       x, y;
  782. X          
  783. X        x = PIXELX(lives, 0);
  784. X        y = PIXELY(CELLS_DOWN, 0);
  785. ***************
  786. *** 261,267 ****
  787. X      apple.apples = 0;
  788. X      for(i = INITIAL_APPLES; i--;)
  789. X        {
  790. !     unsigned  y, x;
  791. X      unsigned  j;
  792. X      CELL      *cptr;
  793. X      APPLE     *aptr;
  794. --- 238,244 ----
  795. X      apple.apples = 0;
  796. X      for(i = INITIAL_APPLES; i--;)
  797. X        {
  798. !     int       y, x;
  799. X      unsigned  j;
  800. X      CELL      *cptr;
  801. X      APPLE     *aptr;
  802. ***************
  803. *** 304,310 ****
  804. X      else if(cptr->sprite)
  805. X        {
  806. X          SPRITE    *sptr;
  807. !       
  808. X          sptr = &sprites[SPRITE_CHERRY];
  809. X          XCopyArea(display.display, sptr->mask, display.back, GCN(GC_MASK),
  810. X          0, 0, CELL_WIDTH, CELL_HEIGHT, cell.x, cell.y);
  811. --- 281,287 ----
  812. X      else if(cptr->sprite)
  813. X        {
  814. X          SPRITE    *sptr;
  815. !     
  816. X          sptr = &sprites[SPRITE_CHERRY];
  817. X          XCopyArea(display.display, sptr->mask, display.back, GCN(GC_MASK),
  818. X          0, 0, CELL_WIDTH, CELL_HEIGHT, cell.x, cell.y);
  819. ***************
  820. *** 337,343 ****
  821. X        0, 0, WINDOW_WIDTH, WINDOW_HEIGHT, 0, 0);
  822. X    xor_ball();
  823. X    XDrawLine(display.display, display.window, GCN(GC_BALL),
  824. !       WINDOW_WIDTH - global.missed, WINDOW_HEIGHT - 1,
  825. X        WINDOW_WIDTH, WINDOW_HEIGHT - 1);
  826. X    return;
  827. X  }
  828. --- 314,320 ----
  829. X        0, 0, WINDOW_WIDTH, WINDOW_HEIGHT, 0, 0);
  830. X    xor_ball();
  831. X    XDrawLine(display.display, display.window, GCN(GC_BALL),
  832. !       WINDOW_WIDTH - (int)global.missed, WINDOW_HEIGHT - 1,
  833. X        WINDOW_WIDTH, WINDOW_HEIGHT - 1);
  834. X    return;
  835. X  }
  836. ***************
  837. *** 364,374 ****
  838. X    {
  839. X      int       i;
  840. X      MONSTER   *mptr;
  841. !       
  842. X      for(mptr = monster.list, i = monster.monsters; i--; mptr++)
  843. X        {
  844. X      int   new;
  845. !       
  846. X      update.set = 0;
  847. X      if(mptr->type == 5)
  848. X        new = 0;
  849. --- 341,351 ----
  850. X    {
  851. X      int       i;
  852. X      MONSTER   *mptr;
  853. !     
  854. X      for(mptr = monster.list, i = monster.monsters; i--; mptr++)
  855. X        {
  856. X      int   new;
  857. !     
  858. X      update.set = 0;
  859. X      if(mptr->type == 5)
  860. X        new = 0;
  861. ***************
  862. *** 411,417 ****
  863. X        }
  864. X      if(update.set)
  865. X        add_background(update.tl.x, update.tl.y,
  866. !           update.br.x - update.tl.x, update.br.y - update.tl.y);
  867. X        }
  868. X    }
  869. X    /*}}}*/
  870. --- 388,395 ----
  871. X        }
  872. X      if(update.set)
  873. X        add_background(update.tl.x, update.tl.y,
  874. !           (unsigned)(update.br.x - update.tl.x), 
  875. !           (unsigned)(update.br.y - update.tl.y));
  876. X        }
  877. X    }
  878. X    /*}}}*/
  879. ***************
  880. *** 419,429 ****
  881. X    {
  882. X      int       i;
  883. X      APPLE     *aptr;
  884. !       
  885. X      for(aptr = apple.list, i = apple.apples; i--; aptr++)
  886. X        {
  887. X      int   new;
  888. !       
  889. X      update.set = 0;
  890. X      new = aptr->state;
  891. X      if(new != aptr->old_state || aptr->pixel.x != aptr->old_pixel.x ||
  892. --- 397,407 ----
  893. X    {
  894. X      int       i;
  895. X      APPLE     *aptr;
  896. !     
  897. X      for(aptr = apple.list, i = apple.apples; i--; aptr++)
  898. X        {
  899. X      int   new;
  900. !     
  901. X      update.set = 0;
  902. X      new = aptr->state;
  903. X      if(new != aptr->old_state || aptr->pixel.x != aptr->old_pixel.x ||
  904. ***************
  905. *** 431,438 ****
  906. X        {
  907. X          APPLE_SIZE const *asp;
  908. X          int       x, y;
  909. !         int       width, height;
  910. !       
  911. X          asp = &apple_sizes[aptr->old_state];
  912. X          x = aptr->old_pixel.x + asp->offset.x;
  913. X          y = aptr->old_pixel.y + asp->offset.y;
  914. --- 409,416 ----
  915. X        {
  916. X          APPLE_SIZE const *asp;
  917. X          int       x, y;
  918. !         unsigned  width, height;
  919. !     
  920. X          asp = &apple_sizes[aptr->old_state];
  921. X          x = aptr->old_pixel.x + asp->offset.x;
  922. X          y = aptr->old_pixel.y + asp->offset.y;
  923. ***************
  924. *** 457,463 ****
  925. X        {
  926. X          unsigned  j;
  927. X          MONSTER   *mptr;
  928. !       
  929. X          for(mptr = monster.list, j =  monster.monsters; j--; mptr++)
  930. X            if(!mptr->apple)
  931. X          /*EMPTY*/;
  932. --- 435,441 ----
  933. X        {
  934. X          unsigned  j;
  935. X          MONSTER   *mptr;
  936. !     
  937. X          for(mptr = monster.list, j =  monster.monsters; j--; mptr++)
  938. X            if(!mptr->apple)
  939. X          /*EMPTY*/;
  940. ***************
  941. *** 471,477 ****
  942. X        }
  943. X      if(update.set)
  944. X        add_background(update.tl.x, update.tl.y,
  945. !           update.br.x - update.tl.x, update.br.y - update.tl.y);
  946. X        }
  947. X    }
  948. X    /*}}}*/
  949. --- 449,456 ----
  950. X        }
  951. X      if(update.set)
  952. X        add_background(update.tl.x, update.tl.y,
  953. !           (unsigned)(update.br.x - update.tl.x), 
  954. !           (unsigned)(update.br.y - update.tl.y));
  955. X        }
  956. X    }
  957. X    /*}}}*/
  958. ***************
  959. *** 479,492 ****
  960. X    {
  961. X      int       i;
  962. X      APPLE     *aptr;
  963. !       
  964. X      for(aptr = apple.list, i = apple.apples; i--; aptr++)
  965. X        {
  966. X      SPRITE    *sptr;
  967. X      APPLE_SIZE const *asp;
  968. X      int       x, y;
  969. !     int       width, height;
  970. !       
  971. X      asp = &apple_sizes[aptr->old_state];
  972. X      sptr = &sprites[SPRITE_APPLE + aptr->old_state];
  973. X      x = aptr->old_pixel.x + asp->offset.x;
  974. --- 458,471 ----
  975. X    {
  976. X      int       i;
  977. X      APPLE     *aptr;
  978. !     
  979. X      for(aptr = apple.list, i = apple.apples; i--; aptr++)
  980. X        {
  981. X      SPRITE    *sptr;
  982. X      APPLE_SIZE const *asp;
  983. X      int       x, y;
  984. !     unsigned  width, height;
  985. !     
  986. X      asp = &apple_sizes[aptr->old_state];
  987. X      sptr = &sprites[SPRITE_APPLE + aptr->old_state];
  988. X      x = aptr->old_pixel.x + asp->offset.x;
  989. ***************
  990. *** 504,514 ****
  991. X    {
  992. X      int       i;
  993. X      MONSTER   *mptr;
  994. !       
  995. X      for(mptr = &monster.list[monster.monsters - 1], i = monster.monsters; i--; mptr--)
  996. X        {
  997. X      SPRITE    *sptr;
  998. !       
  999. X      sptr = &sprites[mptr->old_sprite];
  1000. X      XCopyArea(display.display, sptr->mask, display.copy, GCN(GC_MASK),
  1001. X          0, 0, CELL_WIDTH, CELL_HEIGHT,
  1002. --- 483,493 ----
  1003. X    {
  1004. X      int       i;
  1005. X      MONSTER   *mptr;
  1006. !     
  1007. X      for(mptr = &monster.list[monster.monsters - 1], i = monster.monsters; i--; mptr--)
  1008. X        {
  1009. X      SPRITE    *sptr;
  1010. !     
  1011. X      sptr = &sprites[mptr->old_sprite];
  1012. X      XCopyArea(display.display, sptr->mask, display.copy, GCN(GC_MASK),
  1013. X          0, 0, CELL_WIDTH, CELL_HEIGHT,
  1014. ***************
  1015. *** 523,529 ****
  1016. X    if(!player.ball.state && player.ball.count < 8)
  1017. X      {
  1018. X        COORD const *hold;
  1019. !       
  1020. X        hold = &ball_hold[player.ball.count * MONSTER_IMAGES + player.ball.image];
  1021. X        if(display.foreground == COLOUR_WEIRD)
  1022. X      XCopyArea(display.display, sprites[SPRITE_BALL].mask,
  1023. --- 502,508 ----
  1024. X    if(!player.ball.state && player.ball.count < 8)
  1025. X      {
  1026. X        COORD const *hold;
  1027. !     
  1028. X        hold = &ball_hold[player.ball.count * MONSTER_IMAGES + player.ball.image];
  1029. X        if(display.foreground == COLOUR_WEIRD)
  1030. X      XCopyArea(display.display, sprites[SPRITE_BALL].mask,
  1031. ***************
  1032. *** 538,544 ****
  1033. X    {
  1034. X      unsigned  i;
  1035. X      SCORE     *sptr;
  1036. !       
  1037. X      for(sptr = update.score.list, i = update.score.scores; i--; sptr++)
  1038. X        {
  1039. X      XCopyArea(display.display, sptr->mask, display.copy, GCN(GC_MASK),
  1040. --- 517,523 ----
  1041. X    {
  1042. X      unsigned  i;
  1043. X      SCORE     *sptr;
  1044. !     
  1045. X      for(sptr = update.score.list, i = update.score.scores; i--; sptr++)
  1046. X        {
  1047. X      XCopyArea(display.display, sptr->mask, display.copy, GCN(GC_MASK),
  1048. ***************
  1049. *** 565,571 ****
  1050. X    {
  1051. X      unsigned  i;
  1052. X      SCORE     *sptr;
  1053. !       
  1054. X      for(sptr = update.score.list, i = update.score.scores; i--; sptr++)
  1055. X        XCopyArea(display.display, display.copy, display.window, GCN(GC_COPY),
  1056. X        sptr->place.x, sptr->place.y, DIGIT_WIDTH * 4, DIGIT_HEIGHT,
  1057. --- 544,550 ----
  1058. X    {
  1059. X      unsigned  i;
  1060. X      SCORE     *sptr;
  1061. !     
  1062. X      for(sptr = update.score.list, i = update.score.scores; i--; sptr++)
  1063. X        XCopyArea(display.display, display.copy, display.window, GCN(GC_COPY),
  1064. X        sptr->place.x, sptr->place.y, DIGIT_WIDTH * 4, DIGIT_HEIGHT,
  1065. ***************
  1066. *** 579,602 ****
  1067. X    return;
  1068. X  }
  1069. X  /*}}}*/
  1070. - /*{{{  void text_size(text, length, tptr)*/
  1071. - extern void text_size FUNCARGLIST((text, length, tptr))
  1072. - char const *text  FUNCARGSEP
  1073. - unsigned  length  FUNCARGSEP
  1074. - TEXT      *tptr   FUNCARGTERM
  1075. - /*
  1076. -  * wraps up the XQueryTextExtents for us
  1077. -  */
  1078. - {
  1079. -   int       direction;
  1080. -   XCharStruct chars;
  1081. -   
  1082. -   XQueryTextExtents(display.display, font.font, text, length,
  1083. -       &direction, &tptr->ascent, &tptr->descent, &chars);
  1084. -   tptr->width = chars.width;
  1085. -   return;
  1086. - }
  1087. - /*}}}*/
  1088. X  /*{{{  void xor_ball()*/
  1089. X  static void xor_ball FUNCARGVOID
  1090. X  /*
  1091. --- 558,563 ----
  1092. ***************
  1093. *** 766,776 ****
  1094. X    {
  1095. X      int       i;
  1096. X      APPLE     *aptr;
  1097. !       
  1098. X      for(aptr = apple.list, i = apple.apples; i--; aptr++)
  1099. X        {
  1100. X      SPRITE    *sptr;
  1101. !       
  1102. X      sptr = &sprites[SPRITE_APPLE];
  1103. X      XCopyArea(display.display, sptr->mask, display.copy, GCN(GC_MASK),
  1104. X          0, 0, CELL_WIDTH, CELL_HEIGHT, aptr->pixel.x, aptr->pixel.y);
  1105. --- 727,737 ----
  1106. X    {
  1107. X      int       i;
  1108. X      APPLE     *aptr;
  1109. !     
  1110. X      for(aptr = apple.list, i = apple.apples; i--; aptr++)
  1111. X        {
  1112. X      SPRITE    *sptr;
  1113. !     
  1114. X      sptr = &sprites[SPRITE_APPLE];
  1115. X      XCopyArea(display.display, sptr->mask, display.copy, GCN(GC_MASK),
  1116. X          0, 0, CELL_WIDTH, CELL_HEIGHT, aptr->pixel.x, aptr->pixel.y);
  1117. ***************
  1118. *** 780,811 ****
  1119. X    }
  1120. X    /*}}}*/
  1121. X    timer_start(ZOOM_RATE);
  1122. !   for(count = 0; count < BOARD_HEIGHT / (2 * ZOOM_Y); count += 1)
  1123. X      {
  1124. X        XCopyArea(display.display, display.copy, display.window, GCN(GC_COPY),
  1125. !       BORDER_LEFT + BOARD_WIDTH / 2 - ZOOM_X - count * ZOOM_X,
  1126. !       BORDER_TOP + BOARD_HEIGHT / 2 - ZOOM_Y- count * ZOOM_Y,
  1127. X        ZOOM_X, count * 2 * ZOOM_Y + 2 * ZOOM_Y,
  1128. !       BORDER_LEFT + BOARD_WIDTH / 2 - ZOOM_X - count * ZOOM_X,
  1129. !       BORDER_TOP + BOARD_HEIGHT / 2 - ZOOM_Y - count * ZOOM_Y);
  1130. X        XCopyArea(display.display, display.copy, display.window, GCN(GC_COPY),
  1131. !       BORDER_LEFT + BOARD_WIDTH / 2 + count * ZOOM_X,
  1132. !       BORDER_TOP + BOARD_HEIGHT / 2 - ZOOM_Y - count * ZOOM_Y,
  1133. X        ZOOM_X, count * 2 * ZOOM_Y + 2 * ZOOM_Y,
  1134. !       BORDER_LEFT + BOARD_WIDTH / 2 + count * ZOOM_X,
  1135. !       BORDER_TOP + BOARD_HEIGHT / 2 - ZOOM_Y - count * ZOOM_Y);
  1136. X        XCopyArea(display.display, display.copy, display.window, GCN(GC_COPY),
  1137. !       BORDER_LEFT + BOARD_WIDTH / 2 - count * ZOOM_X,
  1138. !       BORDER_TOP + BOARD_HEIGHT / 2 - ZOOM_Y - count * ZOOM_Y,
  1139. X        count * 2 * ZOOM_X, ZOOM_Y,
  1140. !       BORDER_LEFT + BOARD_WIDTH / 2 - count * ZOOM_X,
  1141. !       BORDER_TOP + BOARD_HEIGHT / 2 - ZOOM_Y - count * ZOOM_Y);
  1142. X        XCopyArea(display.display, display.copy, display.window, GCN(GC_COPY),
  1143. !       BORDER_LEFT + BOARD_WIDTH / 2 - count * ZOOM_X,
  1144. !       BORDER_TOP + BOARD_HEIGHT / 2 + count * ZOOM_Y,
  1145. X        count * 2 * ZOOM_X, ZOOM_Y,
  1146. !       BORDER_LEFT + BOARD_WIDTH / 2 - count * ZOOM_X,
  1147. !       BORDER_TOP + BOARD_HEIGHT / 2 + count * ZOOM_Y);
  1148. X        XSync(display.display, False);
  1149. X        timer_wait();
  1150. X      }
  1151. --- 741,772 ----
  1152. X    }
  1153. X    /*}}}*/
  1154. X    timer_start(ZOOM_RATE);
  1155. !   for(count = 0; count < BOARD_HEIGHT / (2 * ZOOM_Y); count++)
  1156. X      {
  1157. X        XCopyArea(display.display, display.copy, display.window, GCN(GC_COPY),
  1158. !       BORDER_LEFT + BOARD_WIDTH / 2 - ZOOM_X - (int)(count * ZOOM_X),
  1159. !       BORDER_TOP + BOARD_HEIGHT / 2 - ZOOM_Y- (int)(count * ZOOM_Y),
  1160. X        ZOOM_X, count * 2 * ZOOM_Y + 2 * ZOOM_Y,
  1161. !       BORDER_LEFT + BOARD_WIDTH / 2 - ZOOM_X - (int)(count * ZOOM_X),
  1162. !       BORDER_TOP + BOARD_HEIGHT / 2 - ZOOM_Y - (int)(count * ZOOM_Y));
  1163. X        XCopyArea(display.display, display.copy, display.window, GCN(GC_COPY),
  1164. !       BORDER_LEFT + BOARD_WIDTH / 2 + (int)(count * ZOOM_X),
  1165. !       BORDER_TOP + BOARD_HEIGHT / 2 - ZOOM_Y - (int)(count * ZOOM_Y),
  1166. X        ZOOM_X, count * 2 * ZOOM_Y + 2 * ZOOM_Y,
  1167. !       BORDER_LEFT + BOARD_WIDTH / 2 + (int)(count * ZOOM_X),
  1168. !       BORDER_TOP + BOARD_HEIGHT / 2 - ZOOM_Y - (int)(count * ZOOM_Y));
  1169. X        XCopyArea(display.display, display.copy, display.window, GCN(GC_COPY),
  1170. !       BORDER_LEFT + BOARD_WIDTH / 2 - (int)(count * ZOOM_X),
  1171. !       BORDER_TOP + BOARD_HEIGHT / 2 - ZOOM_Y - (int)(count * ZOOM_Y),
  1172. X        count * 2 * ZOOM_X, ZOOM_Y,
  1173. !       BORDER_LEFT + BOARD_WIDTH / 2 - (int)(count * ZOOM_X),
  1174. !       BORDER_TOP + BOARD_HEIGHT / 2 - ZOOM_Y - (int)(count * ZOOM_Y));
  1175. X        XCopyArea(display.display, display.copy, display.window, GCN(GC_COPY),
  1176. !       BORDER_LEFT + BOARD_WIDTH / 2 - (int)(count * ZOOM_X),
  1177. !       BORDER_TOP + BOARD_HEIGHT / 2 + (int)(count * ZOOM_Y),
  1178. X        count * 2 * ZOOM_X, ZOOM_Y,
  1179. !       BORDER_LEFT + BOARD_WIDTH / 2 - (int)(count * ZOOM_X),
  1180. !       BORDER_TOP + BOARD_HEIGHT / 2 + (int)(count * ZOOM_Y));
  1181. X        XSync(display.display, False);
  1182. X        timer_wait();
  1183. X      }
  1184. diff -c -r exp.v1.01/monster.c exp.v2.00/monster.c
  1185. *** exp.v1.01/monster.c    Fri Jul 24 09:56:08 1992
  1186. --- exp.v2.00/monster.c    Fri Jul 24 13:43:15 1992
  1187. ***************
  1188. *** 1,21 ****
  1189. ! /*{{{  (C) 1992 Nathan Sidwell*/
  1190. ! /*****************************************************************************
  1191. !             X M R I S V1.01
  1192. !             ---------------
  1193. !             (C) 1992 Nathan Sidwell
  1194. ! This program is copyright (C) 1992 Nathan Sidwell. This software and documentation
  1195. ! is in the public domain. Permission is granted to distribute and compile
  1196. ! verbatim copies of this software for non-commercial, non-profit use,
  1197. ! without fee. The software may be modified, provided that both the above copyright
  1198. ! notice and this permission notice appear.
  1199. ! No guarantee is given as to the robustness or suitability of this
  1200. ! software for your computer.
  1201. ! Nathan Sidwell  INMOS UK |                 | nathan@inmos.co.uk       DoD#0390
  1202. ! *****************************************************************************/
  1203. ! /*}}}*/
  1204. X  #include "xmris.h"
  1205. X  /*{{{  prototypes*/
  1206. X  static void extra_dies PROTOARGLIST((void));
  1207. --- 1,4 ----
  1208. ! /* (C) 1992 Nathan Sidwell */
  1209. X  #include "xmris.h"
  1210. X  /*{{{  prototypes*/
  1211. X  static void extra_dies PROTOARGLIST((void));
  1212. ***************
  1213. *** 138,144 ****
  1214. X          {
  1215. X            APPLE     *aptr;
  1216. X            CELL      *cptr;
  1217. !               
  1218. X            if(mptr->type == 2)
  1219. X          extra_dies();
  1220. X            else if(mptr->type == 3)
  1221. --- 121,127 ----
  1222. X          {
  1223. X            APPLE     *aptr;
  1224. X            CELL      *cptr;
  1225. !                           
  1226. X            if(mptr->type == 2)
  1227. X          extra_dies();
  1228. X            else if(mptr->type == 3)
  1229. ***************
  1230. *** 156,165 ****
  1231. X            cptr = BOARDCELL(mptr->cell.x, mptr->cell.y);
  1232. X            aptr = spawn_apple(mptr->cell.x, mptr->cell.y,
  1233. X            mptr->offset.x, mptr->offset.y);
  1234. !           if(mptr->cell.y == CELLS_DOWN - 1)
  1235. !         aptr->state = 2;
  1236. !           else if(mptr->offset.y < cptr->depths[1])
  1237. !         aptr->state = 2;
  1238. X            else if(!mptr->offset.y && cptr[CELL_STRIDE].visit)
  1239. X          {
  1240. X            aptr->state = 1;
  1241. --- 139,150 ----
  1242. X            cptr = BOARDCELL(mptr->cell.x, mptr->cell.y);
  1243. X            aptr = spawn_apple(mptr->cell.x, mptr->cell.y,
  1244. X            mptr->offset.x, mptr->offset.y);
  1245. !           if(mptr->cell.y == CELLS_DOWN - 1 ||
  1246. !           mptr->offset.y < cptr->depths[1])
  1247. !         {
  1248. !           aptr->state = 2;
  1249. !           panic_monsters(aptr->cell.x, aptr->cell.y, cptr);
  1250. !         }
  1251. X            else if(!mptr->offset.y && cptr[CELL_STRIDE].visit)
  1252. X          {
  1253. X            aptr->state = 1;
  1254. ***************
  1255. *** 202,207 ****
  1256. --- 187,193 ----
  1257. X  
  1258. X        cptr = BOARDCELL(mptr->cell.x, mptr->cell.y);
  1259. X        assert((cptr->distance || global.broken) && cptr->visit);
  1260. +       /*{{{  new image?*/
  1261. X        if(!mptr->cycle)
  1262. X          {
  1263. X            mptr->cycle = MONSTER_CYCLES;
  1264. ***************
  1265. *** 209,216 ****
  1266. --- 195,204 ----
  1267. X            if(mptr->image == MONSTER_IMAGES)
  1268. X          mptr->image = 0;
  1269. X          }
  1270. +       /*}}}*/
  1271. X        if((!mptr->count || mptr->type & 2) && !mptr->pause)
  1272. X          mptr->cycle--;
  1273. +       /*{{{  set nearest and farthest*/
  1274. X        if(mptr->type & 2 || global.state != 2)
  1275. X          {
  1276. X            if(nearest > cptr->distance)
  1277. ***************
  1278. *** 218,230 ****
  1279. X            if(farthest < cptr->distance)
  1280. X          farthest = cptr->distance;
  1281. X          }
  1282. X        switch(mptr->type)
  1283. X        {
  1284. X          /*{{{  case 0: case 1: (normal or muncher)*/
  1285. X          case 0: case 1:
  1286. X          {
  1287. !           int     valid;
  1288. !               
  1289. X            valid = valid_directions(mptr, cptr);
  1290. X            if(mptr->count)
  1291. X          mptr->count--;
  1292. --- 206,219 ----
  1293. X            if(farthest < cptr->distance)
  1294. X          farthest = cptr->distance;
  1295. X          }
  1296. +       /*}}}*/
  1297. X        switch(mptr->type)
  1298. X        {
  1299. X          /*{{{  case 0: case 1: (normal or muncher)*/
  1300. X          case 0: case 1:
  1301. X          {
  1302. !           unsigned  valid;
  1303. !                           
  1304. X            valid = valid_directions(mptr, cptr);
  1305. X            if(mptr->count)
  1306. X          mptr->count--;
  1307. ***************
  1308. *** 251,256 ****
  1309. --- 240,246 ----
  1310. X            else if(mptr->count)
  1311. X          valid = 0;
  1312. X            else if(mptr->pause)
  1313. +         /*{{{  test go munch or turn round*/
  1314. X          {
  1315. X            if(!mptr->type)
  1316. X              {
  1317. ***************
  1318. *** 267,275 ****
  1319. --- 257,267 ----
  1320. X            mptr->stop = 0;
  1321. X            mptr->pause = 0;
  1322. X          }
  1323. +         /*}}}*/
  1324. X            else if(global.state == 2)
  1325. X          valid = 0;
  1326. X            else if(!mptr->offset.x && !mptr->offset.y)
  1327. +         /*{{{  intersection stuff*/
  1328. X          {
  1329. X            mptr->fast = 0;
  1330. X            if(!mptr->type && global.state == 3)
  1331. ***************
  1332. *** 276,289 ****
  1333. X              mptr->fast = 1;
  1334. X            if(mptr->gomunch)
  1335. X              {
  1336. X                mptr->gomunch = 0;
  1337. X                mptr->type = 1;
  1338. X                mptr->count = GO_MUNCH_DELAY;
  1339. X              }
  1340. X            else if(mptr->type)
  1341. X              {
  1342. X                int       temp;
  1343. !             
  1344. X                temp = valid & 0xF;
  1345. X                if((temp & -temp) != temp)
  1346. X              {
  1347. --- 268,283 ----
  1348. X              mptr->fast = 1;
  1349. X            if(mptr->gomunch)
  1350. X              {
  1351. +               mptr->panic = 0;
  1352. X                mptr->gomunch = 0;
  1353. X                mptr->type = 1;
  1354. X                mptr->count = GO_MUNCH_DELAY;
  1355. X              }
  1356. X            else if(mptr->type)
  1357. +             /*{{{  stop munching?*/
  1358. X              {
  1359. X                int       temp;
  1360. !                                 
  1361. X                temp = valid & 0xF;
  1362. X                if((temp & -temp) != temp)
  1363. X              {
  1364. ***************
  1365. *** 290,296 ****
  1366. X                APPLE     *aptr;
  1367. X                unsigned  i;
  1368. X                int       x;
  1369. !                       
  1370. X                mptr->type = 0;
  1371. X                mptr->count = STOP_MUNCH_DELAY;
  1372. X                valid = 0;
  1373. --- 284,290 ----
  1374. X                APPLE     *aptr;
  1375. X                unsigned  i;
  1376. X                int       x;
  1377. !                                           
  1378. X                mptr->type = 0;
  1379. X                mptr->count = STOP_MUNCH_DELAY;
  1380. X                valid = 0;
  1381. ***************
  1382. *** 307,316 ****
  1383. --- 301,312 ----
  1384. X                  }
  1385. X              }
  1386. X              }
  1387. +             /*}}}*/
  1388. X            else if(!mptr->type && random() <
  1389. X                GO_MUNCH_PROB * global.difficulty)
  1390. X              mptr->gomunch = 1;
  1391. X          }
  1392. +         /*}}}*/
  1393. X            if(!valid)
  1394. X          /*EMPTY*/;
  1395. X            else if(mptr->type)
  1396. ***************
  1397. *** 320,326 ****
  1398. X              /*{{{  carry on*/
  1399. X              {
  1400. X                CELL      *nptr;
  1401. !                       
  1402. X                nptr = move_muncher(mptr);
  1403. X                if(nptr)
  1404. X              {
  1405. --- 316,322 ----
  1406. X              /*{{{  carry on*/
  1407. X              {
  1408. X                CELL      *nptr;
  1409. !                                               
  1410. X                nptr = move_muncher(mptr);
  1411. X                if(nptr)
  1412. X              {
  1413. ***************
  1414. *** 337,343 ****
  1415. X              /*{{{  pick new direction*/
  1416. X              {
  1417. X                int     temp;
  1418. !                       
  1419. X                temp = ~valid & 0xF;
  1420. X                if(!mptr->cell.y)
  1421. X              temp &= 0xE;
  1422. --- 333,339 ----
  1423. X              /*{{{  pick new direction*/
  1424. X              {
  1425. X                int     temp;
  1426. !                                               
  1427. X                temp = ~valid & 0xF;
  1428. X                if(!mptr->cell.y)
  1429. X              temp &= 0xE;
  1430. ***************
  1431. *** 381,394 ****
  1432. X          /*{{{  pick a direction*/
  1433. X          {
  1434. X            unsigned  temp;
  1435. !                   
  1436. !           if(mptr->cont)
  1437. X              {
  1438. X                valid &= 0xF;
  1439. X                temp = valid & ~(1 << (mptr->dir ^ 1));
  1440. X                if(temp)
  1441. X              valid = temp;
  1442. X              }
  1443. X            else if(valid & 0xF0)
  1444. X              valid = valid & valid >> 4;
  1445. X            valid = choose_direction(valid);
  1446. --- 377,434 ----
  1447. X          /*{{{  pick a direction*/
  1448. X          {
  1449. X            unsigned  temp;
  1450. !           
  1451. !           if(mptr->panic)
  1452. !             /*{{{  panic mode*/
  1453. X              {
  1454. +               temp = valid & ((1 << (mptr->dir ^ 1)) ^ 0xF);
  1455. +               if(mptr->offset.x < GAP_WIDTH * 2 - CELL_WIDTH && 
  1456. +               valid & 0x8)
  1457. +             valid = 0x8;
  1458. +               else if(mptr->offset.x >= CELL_WIDTH - GAP_WIDTH * 2 &&
  1459. +               valid & 0x4)
  1460. +             valid = 0x4;
  1461. +               else if(temp & 0xC)
  1462. +             valid = temp & 0xC;
  1463. +               else if(valid & 0xC)
  1464. +             valid &= 0xC;
  1465. +               else if(valid & 0x2 && 
  1466. +               (mptr->panic > PANIC_UP_COUNT || mptr->dir == 1))
  1467. +             {
  1468. +               valid = 0x2;
  1469. +               mptr->panic = 1;
  1470. +             }
  1471. +               else if(valid & 1)
  1472. +             {
  1473. +               valid = 0x1;
  1474. +               mptr->panic++;
  1475. +             }
  1476. +               else 
  1477. +             valid &= 0xF;
  1478. +             }
  1479. +             /*}}}*/
  1480. +           else if(mptr->cont)
  1481. +             /*{{{  continue mode*/
  1482. +             {
  1483. X                valid &= 0xF;
  1484. X                temp = valid & ~(1 << (mptr->dir ^ 1));
  1485. X                if(temp)
  1486. X              valid = temp;
  1487. X              }
  1488. +             /*}}}*/
  1489. +           else if(player.ball.state == 1)
  1490. +             /*{{{  run away*/
  1491. +             {
  1492. +               temp = (valid ^ (valid >> 4)) & 0xF;
  1493. +               if(temp)
  1494. +             valid = temp;
  1495. +               else
  1496. +             {
  1497. +               valid &= 0xF;
  1498. +               mptr->cont = 1;
  1499. +             }
  1500. +             }
  1501. +             /*}}}*/
  1502. X            else if(valid & 0xF0)
  1503. X              valid = valid & valid >> 4;
  1504. X            valid = choose_direction(valid);
  1505. ***************
  1506. *** 418,426 ****
  1507. X          /*{{{  case 2: case 3: (xtra or drone)*/
  1508. X          case 2: case 3:
  1509. X          {
  1510. !           int     valid;
  1511. !           int     temp;
  1512. !               
  1513. X            /*{{{  giving birth?*/
  1514. X            if(monster.delay && mptr->type == 2 && global.state == 2)
  1515. X          {
  1516. --- 458,465 ----
  1517. X          /*{{{  case 2: case 3: (xtra or drone)*/
  1518. X          case 2: case 3:
  1519. X          {
  1520. !           unsigned  valid;
  1521. !                           
  1522. X            /*{{{  giving birth?*/
  1523. X            if(monster.delay && mptr->type == 2 && global.state == 2)
  1524. X          {
  1525. ***************
  1526. *** 444,465 ****
  1527. X          mptr->fast = 1;
  1528. X            /*{{{  pick a direction*/
  1529. X            {
  1530. !         if(valid & 0xF0 &&
  1531. !             (mptr->type != 2 || player.ball.state ||
  1532. !             (global.state == 2 ? mptr->count == monster.farthest :
  1533. !              mptr->count != monster.nearest)))
  1534. X            {
  1535. !             mptr->cont = 0;
  1536. !             valid >>= 4;
  1537. X            }
  1538. X          else
  1539. X            {
  1540. !             temp = valid & ((valid >> 4) ^ 0xF);
  1541. !             if(temp)
  1542. X                valid = temp;
  1543. X              else
  1544. X                valid &= 0xF;
  1545. X            }
  1546. X          valid = choose_direction(valid);
  1547. X          if(valid != mptr->dir)
  1548. X            {
  1549. --- 483,534 ----
  1550. X          mptr->fast = 1;
  1551. X            /*{{{  pick a direction*/
  1552. X            {
  1553. !         unsigned  temp;
  1554. !             
  1555. !         temp = valid & (~(0x11 << (mptr->dir ^ 1)));
  1556. !         if(mptr->type == 2)
  1557. !           /*{{{  xtra*/
  1558. X            {
  1559. !             if((player.ball.state != 0) != mptr->gomunch)
  1560. !               temp = valid;
  1561. !             if(player.ball.state ||
  1562. !             (global.state == 2 ? mptr->count == monster.farthest :
  1563. !             mptr->count != monster.nearest))
  1564. !               {
  1565. !             if(temp & 0xF0)
  1566. !               valid = temp >> 4;
  1567. !             else if(temp)
  1568. !               valid = temp;
  1569. !             else
  1570. !               valid &= 0xF;
  1571. !               }
  1572. !             else
  1573. !               {
  1574. !             unsigned  suess;
  1575. !             
  1576. !             suess = (temp ^ (temp >> 4)) & 0xF;
  1577. !             if(suess)
  1578. !               valid = suess;
  1579. !             else if(temp & 0xF)
  1580. !               valid = temp & 0xF;
  1581. !             else
  1582. !               valid &= 0xF;
  1583. !               }
  1584. X            }
  1585. +           /*}}}*/
  1586. X          else
  1587. +           /*{{{  drone*/
  1588. X            {
  1589. !             if(temp & 0xF0)
  1590. !               valid = temp >> 4;
  1591. !             else if(temp)
  1592. X                valid = temp;
  1593. +             else if(valid & 0xF0)
  1594. +               valid >>= 4;
  1595. X              else
  1596. X                valid &= 0xF;
  1597. X            }
  1598. +           /*}}}*/
  1599. X          valid = choose_direction(valid);
  1600. X          if(valid != mptr->dir)
  1601. X            {
  1602. ***************
  1603. *** 474,480 ****
  1604. X            APPLE     *aptr;
  1605. X            int       x, y;
  1606. X            int       width, height;
  1607. !                   
  1608. X            x = mptr->pixel.x;
  1609. X            y = mptr->pixel.y;
  1610. X            /*{{{  set offset*/
  1611. --- 543,549 ----
  1612. X            APPLE     *aptr;
  1613. X            int       x, y;
  1614. X            int       width, height;
  1615. !                                           
  1616. X            x = mptr->pixel.x;
  1617. X            y = mptr->pixel.y;
  1618. X            /*{{{  set offset*/
  1619. ***************
  1620. *** 508,513 ****
  1621. --- 577,583 ----
  1622. X              }
  1623. X          }
  1624. X          /*}}}*/
  1625. +         mptr->gomunch = player.ball.state != 0;
  1626. X            }
  1627. X            /*}}}*/
  1628. X            break;
  1629. ***************
  1630. *** 544,552 ****
  1631. X  /*}}}*/
  1632. X  /*{{{  MONSTER *spawn_monster(type, dir, face, cx, cy, ox, oy)*/
  1633. X  extern MONSTER *spawn_monster FUNCARGLIST((type, dir, face, cx, cy, ox, oy))
  1634. ! int       type  FUNCARGSEP  /* type of monster 0-4 */
  1635. ! int       dir   FUNCARGSEP  /* direction 0-3 */
  1636. ! int       face  FUNCARGSEP  /* face 0-5 */
  1637. X  int       cx    FUNCARGSEP  /* cell x */
  1638. X  int       cy    FUNCARGSEP  /* cell y */
  1639. X  int       ox    FUNCARGSEP  /* offset x */
  1640. --- 614,622 ----
  1641. X  /*}}}*/
  1642. X  /*{{{  MONSTER *spawn_monster(type, dir, face, cx, cy, ox, oy)*/
  1643. X  extern MONSTER *spawn_monster FUNCARGLIST((type, dir, face, cx, cy, ox, oy))
  1644. ! unsigned  type  FUNCARGSEP  /* type of monster 0-4 */
  1645. ! unsigned  dir   FUNCARGSEP  /* direction 0-3 */
  1646. ! unsigned  face  FUNCARGSEP  /* face 0-5 */
  1647. X  int       cx    FUNCARGSEP  /* cell x */
  1648. X  int       cy    FUNCARGSEP  /* cell y */
  1649. X  int       ox    FUNCARGSEP  /* offset x */
  1650. ***************
  1651. *** 567,572 ****
  1652. --- 637,643 ----
  1653. X    mptr->apple = NULL;
  1654. X    mptr->push = 0;
  1655. X    mptr->gomunch = mptr->cont = mptr->chew = mptr->pause = mptr->stop = 0;
  1656. +   mptr->panic= 0;
  1657. X    mptr->fast = mptr->pushing = 0;
  1658. X    mptr->count = 0;
  1659. X    mptr->cell.x = cx;
  1660. diff -c -r exp.v1.01/move.c exp.v2.00/move.c
  1661. *** exp.v1.01/move.c    Fri Jul 24 09:56:11 1992
  1662. --- exp.v2.00/move.c    Fri Jul 24 13:43:17 1992
  1663. ***************
  1664. *** 1,24 ****
  1665. ! /*{{{  (C) 1992 Nathan Sidwell*/
  1666. ! /*****************************************************************************
  1667. !             X M R I S V1.01
  1668. !             ---------------
  1669. !             (C) 1992 Nathan Sidwell
  1670. ! This program is copyright (C) 1992 Nathan Sidwell. This software and documentation
  1671. ! is in the public domain. Permission is granted to distribute and compile
  1672. ! verbatim copies of this software for non-commercial, non-profit use,
  1673. ! without fee. The software may be modified, provided that both the above copyright
  1674. ! notice and this permission notice appear.
  1675. ! No guarantee is given as to the robustness or suitability of this
  1676. ! software for your computer.
  1677. ! Nathan Sidwell  INMOS UK |                 | nathan@inmos.co.uk       DoD#0390
  1678. ! *****************************************************************************/
  1679. ! /*}}}*/
  1680. X  #include "xmris.h"
  1681. X  /*{{{  prototypes*/
  1682. ! static void munch_back PROTOARGLIST((int, int, int, int, int, int, SPRITE *));
  1683. X  /*}}}*/
  1684. X  /*{{{  unsigned choose_direction(valid)*/
  1685. X  extern unsigned choose_direction FUNCARGLIST((valid))
  1686. --- 1,7 ----
  1687. ! /* (C) 1992 Nathan Sidwell */
  1688. X  #include "xmris.h"
  1689. X  /*{{{  prototypes*/
  1690. ! static void munch_back PROTOARGLIST((int, int, unsigned, unsigned, int, int, SPRITE *));
  1691. X  /*}}}*/
  1692. X  /*{{{  unsigned choose_direction(valid)*/
  1693. X  extern unsigned choose_direction FUNCARGLIST((valid))
  1694. ***************
  1695. *** 80,86 ****
  1696. X      /*{{{  munch the left half of the edge below*/
  1697. X      {
  1698. X        unsigned  type;
  1699. !             
  1700. X        type = 0;
  1701. X        if(cptr[0].depths[2] < -VEL_X)
  1702. X          type = GAP_HEIGHT;
  1703. --- 63,69 ----
  1704. X      /*{{{  munch the left half of the edge below*/
  1705. X      {
  1706. X        unsigned  type;
  1707. !                         
  1708. X        type = 0;
  1709. X        if(cptr[0].depths[2] < -VEL_X)
  1710. X          type = GAP_HEIGHT;
  1711. ***************
  1712. *** 90,96 ****
  1713. X            (cptr[-1].depths[1] > VEL_Y ||
  1714. X            cptr[CELL_STRIDE-1].depths[0] < -VEL_Y))
  1715. X          type = 4 * GAP_HEIGHT;
  1716. !       munch_back(0, type,
  1717. X            EDGE_WIDTH >> 1, GAP_HEIGHT,
  1718. X            pixel.x + (CELL_WIDTH >> 1) - (EDGE_WIDTH >> 1),
  1719. X            pixel.y + CELL_HEIGHT, sptr);
  1720. --- 73,79 ----
  1721. X            (cptr[-1].depths[1] > VEL_Y ||
  1722. X            cptr[CELL_STRIDE-1].depths[0] < -VEL_Y))
  1723. X          type = 4 * GAP_HEIGHT;
  1724. !       munch_back(0, (int)type,
  1725. X            EDGE_WIDTH >> 1, GAP_HEIGHT,
  1726. X            pixel.x + (CELL_WIDTH >> 1) - (EDGE_WIDTH >> 1),
  1727. X            pixel.y + CELL_HEIGHT, sptr);
  1728. ***************
  1729. *** 107,113 ****
  1730. X      /*{{{  munch the right half of the edge below*/
  1731. X      {
  1732. X        unsigned  type;
  1733. !             
  1734. X        type = 0;
  1735. X        if(cptr[0].depths[3] > VEL_X)
  1736. X          type = GAP_HEIGHT;
  1737. --- 90,96 ----
  1738. X      /*{{{  munch the right half of the edge below*/
  1739. X      {
  1740. X        unsigned  type;
  1741. !                         
  1742. X        type = 0;
  1743. X        if(cptr[0].depths[3] > VEL_X)
  1744. X          type = GAP_HEIGHT;
  1745. ***************
  1746. *** 117,123 ****
  1747. X            (cptr[1].depths[1] > VEL_Y ||
  1748. X            cptr[CELL_STRIDE+1].depths[0] < -VEL_Y))
  1749. X          type = 4 * GAP_HEIGHT;
  1750. !       munch_back(EDGE_WIDTH >> 1, type,
  1751. X            EDGE_WIDTH >> 1, GAP_HEIGHT,
  1752. X            pixel.x + (CELL_WIDTH >> 1),
  1753. X            pixel.y + CELL_HEIGHT, sptr);
  1754. --- 100,106 ----
  1755. X            (cptr[1].depths[1] > VEL_Y ||
  1756. X            cptr[CELL_STRIDE+1].depths[0] < -VEL_Y))
  1757. X          type = 4 * GAP_HEIGHT;
  1758. !       munch_back(EDGE_WIDTH >> 1, (int)type,
  1759. X            EDGE_WIDTH >> 1, GAP_HEIGHT,
  1760. X            pixel.x + (CELL_WIDTH >> 1),
  1761. X            pixel.y + CELL_HEIGHT, sptr);
  1762. ***************
  1763. *** 190,196 ****
  1764. X    /*}}}*/
  1765. X    if(update.set)
  1766. X      add_background(update.tl.x, update.tl.y,
  1767. !     update.br.x - update.tl.x, update.br.y - update.tl.y);
  1768. X    return new;
  1769. X  }
  1770. X  /*}}}*/
  1771. --- 173,180 ----
  1772. X    /*}}}*/
  1773. X    if(update.set)
  1774. X      add_background(update.tl.x, update.tl.y,
  1775. !     (unsigned)(update.br.x - update.tl.x), 
  1776. !     (unsigned)(update.br.y - update.tl.y));
  1777. X    return new;
  1778. X  }
  1779. X  /*}}}*/
  1780. ***************
  1781. *** 262,269 ****
  1782. X        mptr->cell.y += 1;
  1783. X        cptr += CELL_STRIDE;
  1784. X      }
  1785. !       assert(cptr->visit && mptr->cell.y < CELLS_DOWN &&
  1786. !       (!mptr->offset.x || (!mptr->cell.y && mptr->offset.y <= 0)));
  1787. X        break;
  1788. X      /*}}}*/
  1789. X      /*{{{  case 2: (left)*/
  1790. --- 246,253 ----
  1791. X        mptr->cell.y += 1;
  1792. X        cptr += CELL_STRIDE;
  1793. X      }
  1794. !       assert(cptr->visit && mptr->cell.y < CELLS_DOWN);
  1795. !       assert(!mptr->offset.x || (!mptr->cell.y && mptr->offset.y <= 0));
  1796. X        break;
  1797. X      /*}}}*/
  1798. X      /*{{{  case 2: (left)*/
  1799. ***************
  1800. *** 389,395 ****
  1801. X            /*{{{  munch the left half of the edge above*/
  1802. X            {
  1803. X              unsigned  type;
  1804. !                             
  1805. X              type = 0;
  1806. X              if(cptr[0].depths[2] < -VEL_X)
  1807. X                type = 2 * GAP_HEIGHT;
  1808. --- 373,379 ----
  1809. X            /*{{{  munch the left half of the edge above*/
  1810. X            {
  1811. X              unsigned  type;
  1812. !                                                     
  1813. X              type = 0;
  1814. X              if(cptr[0].depths[2] < -VEL_X)
  1815. X                type = 2 * GAP_HEIGHT;
  1816. ***************
  1817. *** 399,405 ****
  1818. X              (cptr[-1].depths[0] < -VEL_Y ||
  1819. X              cptr[-CELL_STRIDE-1].depths[1] > VEL_Y))
  1820. X                type = 4 * GAP_HEIGHT;
  1821. !             munch_back(0, type,
  1822. X              EDGE_WIDTH >> 1, GAP_HEIGHT,
  1823. X              pixel.x + (CELL_WIDTH >> 1) - (EDGE_WIDTH >> 1),
  1824. X              pixel.y - GAP_HEIGHT, sptr);
  1825. --- 383,389 ----
  1826. X              (cptr[-1].depths[0] < -VEL_Y ||
  1827. SHAR_EOF
  1828. true || echo 'restore of patch.v2.00 failed'
  1829. fi
  1830. echo 'End of  part 3'
  1831. echo 'File patch.v2.00 is continued in part 4'
  1832. echo 4 > _shar_seq_.tmp
  1833. exit 0
  1834. -- 
  1835. Senior Systems Scientist        mail: dcmartin@msi.com
  1836. Molecular Simulations, Inc.        uucp: uunet!dcmartin
  1837. 796 North Pastoria Avenue        at&t: 408/522-9236
  1838. Sunnyvale, California 94086        fax: 408/732-0831
  1839.