home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1994 March / Source_Code_CD-ROM_Walnut_Creek_March_1994.iso / compsrcs / games / volume13 / thricken / patch1 < prev    next >
Encoding:
Text File  |  1992-08-02  |  12.5 KB  |  556 lines

  1. Path: uunet!zephyr.ens.tek.com!master!saab!billr
  2. From: billr@saab.CNA.TEK.COM (Bill Randle)
  3. Newsgroups: comp.sources.games
  4. Subject: v13i102:  thricken - a multiscreen collect-the-objects style game, Patch1
  5. Message-ID: <3078@master.CNA.TEK.COM>
  6. Date: 22 Jun 92 15:29:46 GMT
  7. Sender: news@master.CNA.TEK.COM
  8. Lines: 545
  9. Approved: billr@saab.CNA.TEK.COM
  10.  
  11. Submitted-by: James Bonfield <rince@dcs.warwick.ac.uk>
  12. Posting-number: Volume 13, Issue 102
  13. Archive-name: thricken/Patch1
  14. Patch-To: thricken: Volume 13, Issue 101
  15. Environment: curses
  16.  
  17.     [The patch is mainly "cleanup" and minor fixes for compilation on
  18.      more systems.]
  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 Mon Jun 22 08:26:01 1992
  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'\" \(10762 characters\)
  34. sed "s/^X//" >'patches01' <<'END_OF_FILE'
  35. Xdiff -c ./Makefile ../thricken-1.1/Makefile
  36. X*** ./Makefile    Mon Jun 22 02:05:54 1992
  37. X--- ../thricken-1.1/Makefile    Mon Jun 22 01:45:26 1992
  38. X***************
  39. X*** 5,13 ****
  40. X  LIBS = -lcurses -ltermcap
  41. X  
  42. X  # directories
  43. X! BINDIR = /dcs/89/rince/open/bin.$(ARCH)
  44. X! LIBDIR = /dcs/89/rince/open/lib/thricken
  45. X! MANDIR = /dcs/89/rince/open/man
  46. X  
  47. X  OBJ = files.o main.o scores.o screen.o
  48. X  
  49. X--- 5,14 ----
  50. X  LIBS = -lcurses -ltermcap
  51. X  
  52. X  # directories
  53. X! HOME = /dcs/89/rince/open
  54. X! BINDIR = $(HOME)/bin.$(ARCH)
  55. X! LIBDIR = $(HOME)/lib/thricken
  56. X! MANDIR = $(HOME)/man
  57. X  
  58. X  OBJ = files.o main.o scores.o screen.o
  59. X  
  60. X***************
  61. X*** 22,40 ****
  62. X  
  63. X  install:    thricken thricken.6
  64. X      # the game
  65. X!     -mkdir -p $(BINDIR)
  66. X      chmod a+xr $(BINDIR)
  67. X      -cp thricken $(BINDIR)
  68. X      chmod a+x $(BINDIR)/thricken
  69. X  
  70. X      # the data files
  71. X!     -mkdir -p $(LIBDIR)
  72. X      chmod a+xr $(LIBDIR)
  73. X      -cp data/* $(LIBDIR)
  74. X      chmod a+r $(LIBDIR)/*
  75. X  
  76. X      # the man page
  77. X!     -mkdir -p $(MANDIR)/man6
  78. X      chmod a+xr $(MANDIR)/man6
  79. X      -cp thricken.6 $(MANDIR)/man6
  80. X      chmod a+r $(MANDIR)/man6/thricken.6
  81. X--- 23,42 ----
  82. X  
  83. X  install:    thricken thricken.6
  84. X      # the game
  85. X!     -mkdir $(BINDIR)
  86. X      chmod a+xr $(BINDIR)
  87. X      -cp thricken $(BINDIR)
  88. X      chmod a+x $(BINDIR)/thricken
  89. X  
  90. X      # the data files
  91. X!     -mkdir $(LIBDIR)
  92. X      chmod a+xr $(LIBDIR)
  93. X      -cp data/* $(LIBDIR)
  94. X      chmod a+r $(LIBDIR)/*
  95. X  
  96. X      # the man page
  97. X!     -mkdir $(MANDIR)
  98. X!     -mkdir $(MANDIR)/man6
  99. X      chmod a+xr $(MANDIR)/man6
  100. X      -cp thricken.6 $(MANDIR)/man6
  101. X      chmod a+r $(MANDIR)/man6/thricken.6
  102. Xdiff -c ./README ../thricken-1.1/README
  103. X*** ./README    Mon Jun 22 02:05:53 1992
  104. X--- ../thricken-1.1/README    Mon Jun 22 01:21:59 1992
  105. X***************
  106. X*** 1,3 ****
  107. X--- 1,5 ----
  108. X+ Thricken Version 1.1
  109. X+ 
  110. X  This is the game of thricken - written by James 'Rince' Bonfield.
  111. X  You may redistribute and modify any of this source provided that my name is
  112. X  still mentioned in connection with the pieces of code I have written.
  113. XCommon subdirectories: ./data and ../thricken-1.1/data
  114. Xdiff -c ./extern.h ../thricken-1.1/extern.h
  115. X*** ./extern.h    Mon Jun 22 02:06:00 1992
  116. X--- ../thricken-1.1/extern.h    Mon Jun 22 01:09:54 1992
  117. X***************
  118. X*** 1,6 ****
  119. X  extern int load_level(int level);
  120. X  extern void init_display();
  121. X! extern int draw_map(int y,int x);
  122. X  extern void update_wins();
  123. X  extern void draw_stats(char level);
  124. X  extern void draw_you(char y, char x, char c);
  125. X--- 1,6 ----
  126. X  extern int load_level(int level);
  127. X  extern void init_display();
  128. X! extern void draw_map(int y,int x);
  129. X  extern void update_wins();
  130. X  extern void draw_stats(char level);
  131. X  extern void draw_you(char y, char x, char c);
  132. Xdiff -c ./files.c ../thricken-1.1/files.c
  133. X*** ./files.c    Mon Jun 22 02:06:00 1992
  134. X--- ../thricken-1.1/files.c    Mon Jun 22 01:09:54 1992
  135. X***************
  136. X*** 1,3 ****
  137. X--- 1,4 ----
  138. X+ #include <stdlib.h>
  139. X  #include <fcntl.h>
  140. X  #include <string.h>
  141. X  #include <stdio.h>
  142. X***************
  143. X*** 5,14 ****
  144. X  
  145. X  char *readline(FILE *fp);
  146. X  int read_sprites();
  147. X  char *spr_file, *data_file;
  148. X  
  149. X  int load_level(int level) {
  150. X!     int i,j;
  151. X      FILE *fp;
  152. X      char *level_file = strdup("xxlevel");
  153. X      
  154. X--- 6,16 ----
  155. X  
  156. X  char *readline(FILE *fp);
  157. X  int read_sprites();
  158. X+ int read_sprdata();
  159. X  char *spr_file, *data_file;
  160. X  
  161. X  int load_level(int level) {
  162. X!     int i;
  163. X      FILE *fp;
  164. X      char *level_file = strdup("xxlevel");
  165. X      
  166. X***************
  167. X*** 35,42 ****
  168. X      free(author);
  169. X      author = strdup(readline(fp));
  170. X      fclose(fp);
  171. X!     read_sprites();
  172. X!     read_sprdata();
  173. X  }
  174. X  
  175. X  char *readline(FILE *fp) {
  176. X--- 37,48 ----
  177. X      free(author);
  178. X      author = strdup(readline(fp));
  179. X      fclose(fp);
  180. X!     if (read_sprites() != 0)
  181. X!     return -1;
  182. X!     if (read_sprdata() != 0)
  183. X!     return -1;
  184. X! 
  185. X!     return 0;
  186. X  }
  187. X  
  188. X  char *readline(FILE *fp) {
  189. X***************
  190. X*** 45,52 ****
  191. X       * a bit of a kludge.
  192. X       */
  193. X      static char buf[1024];
  194. X-     int i=0;
  195. X-     char c = '\0';
  196. X      
  197. X      if (fgets(buf,1000,fp) == (char *)0)
  198. X      return (char *)-1;
  199. X--- 51,56 ----
  200. X***************
  201. X*** 54,61 ****
  202. X      return buf;
  203. X  }
  204. X  
  205. X! 
  206. X! read_sprites() {
  207. X      FILE *fp;
  208. X      char spr;
  209. X      char *ptr;
  210. X--- 58,64 ----
  211. X      return buf;
  212. X  }
  213. X  
  214. X! int read_sprites() {
  215. X      FILE *fp;
  216. X      char spr;
  217. X      char *ptr;
  218. X***************
  219. X*** 71,79 ****
  220. X          sprite[spr][j][i] = ptr[i];
  221. X      }
  222. X      }
  223. X  }
  224. X  
  225. X! read_sprdata() {
  226. X      FILE *fp;
  227. X      int i;
  228. X      char *ptr;
  229. X--- 74,83 ----
  230. X          sprite[spr][j][i] = ptr[i];
  231. X      }
  232. X      }
  233. X+     return 0;
  234. X  }
  235. X  
  236. X! int read_sprdata() {
  237. X      FILE *fp;
  238. X      int i;
  239. X      char *ptr;
  240. X***************
  241. X*** 108,111 ****
  242. X--- 112,116 ----
  243. X      *(ptr+8)=0;c->dirs = strdup(ptr+4);
  244. X      *(ptr+4)=0;c->coll = strdup(ptr+1);
  245. X      }
  246. X+     return 0;
  247. X  }
  248. Xdiff -c ./main.c ../thricken-1.1/main.c
  249. X*** ./main.c    Mon Jun 22 02:06:01 1992
  250. X--- ../thricken-1.1/main.c    Mon Jun 22 01:44:35 1992
  251. X***************
  252. X*** 1,9 ****
  253. X--- 1,13 ----
  254. X+ #include <stdlib.h>
  255. X+ #include <stdio.h>
  256. X  #include <signal.h>
  257. X  #include <errno.h>
  258. X  #include <curses.h>
  259. X  #include <string.h>
  260. X+ 
  261. X  #include "thricken.h"
  262. X  #include "extern.h"
  263. X+ #include "patchlevel.h"
  264. X  
  265. X  extern int draw_sprite(WINDOW *w, int y,int x,char spr);
  266. X  extern WINDOW *gw,*sw,*lw;
  267. X***************
  268. X*** 10,15 ****
  269. X--- 14,25 ----
  270. X  
  271. X  void init();
  272. X  char query_map(char y, char x);
  273. X+ void play_game(unsigned char startl,int moves);
  274. X+ void move_dir(char dir,char key);
  275. X+ void set_map(char y, char x, char p);
  276. X+ void save_map();
  277. X+ void restore_map();
  278. X+ 
  279. X  char face[] = "<v^>";
  280. X  char keys[] = "hjkl";
  281. X  /* short cut for setting up n1 & n2 */
  282. X***************
  283. X*** 17,24 ****
  284. X  
  285. X  char xs,ys;
  286. X  
  287. X! main(int argc, char **argv) {
  288. X!     char c,level=-1;
  289. X  
  290. X      extern char *optarg;
  291. X  
  292. X--- 27,34 ----
  293. X  
  294. X  char xs,ys;
  295. X  
  296. X! int main(int argc, char **argv) {
  297. X!     int c,level=-1;
  298. X  
  299. X      extern char *optarg;
  300. X  
  301. X***************
  302. X*** 60,68 ****
  303. X      }
  304. X      startlevel = level;
  305. X      play_game(level,moves);
  306. X  }
  307. X  
  308. X! play_game(char startl,int moves) {
  309. X      char c,t1,t2,t3,t4;
  310. X      char dir;
  311. X  
  312. X--- 70,80 ----
  313. X      }
  314. X      startlevel = level;
  315. X      play_game(level,moves);
  316. X+ 
  317. X+     return 0;
  318. X  }
  319. X  
  320. X! void play_game(unsigned char startl,int smoves) {
  321. X      char c,t1,t2,t3,t4;
  322. X      char dir;
  323. X  
  324. X***************
  325. X*** 71,77 ****
  326. X      do {
  327. X      llevel = level;
  328. X      lscore = score;
  329. X!     lmoves = moves;
  330. X      if (load_level(level) == -1) {
  331. X          nocbreak();
  332. X          echo();
  333. X--- 83,89 ----
  334. X      do {
  335. X      llevel = level;
  336. X      lscore = score;
  337. X!     moves = lmoves = smoves;
  338. X      if (load_level(level) == -1) {
  339. X          nocbreak();
  340. X          echo();
  341. X***************
  342. X*** 118,124 ****
  343. X      } while (1);
  344. X  }
  345. X  
  346. X! move_dir(char dir,char key) {
  347. X      char n1,n2,bang;
  348. X      char nx,ny,mx,my;
  349. X      struct coll *c;
  350. X--- 130,136 ----
  351. X      } while (1);
  352. X  }
  353. X  
  354. X! void move_dir(char dir,char key) {
  355. X      char n1,n2,bang;
  356. X      char nx,ny,mx,my;
  357. X      struct coll *c;
  358. X***************
  359. X*** 176,186 ****
  360. X      return map[(y+rows+1)%rows][(x+cols+1)%cols];
  361. X  }
  362. X  
  363. X! set_map(char y, char x, char p) {
  364. X      map[(y+rows+1)%rows][(x+cols+1)%cols]=p;
  365. X  }
  366. X  
  367. X! save_map() {
  368. X      int i;
  369. X  
  370. X      for (i=0; i<100; i++) {
  371. X--- 188,198 ----
  372. X      return map[(y+rows+1)%rows][(x+cols+1)%cols];
  373. X  }
  374. X  
  375. X! void set_map(char y, char x, char p) {
  376. X      map[(y+rows+1)%rows][(x+cols+1)%cols]=p;
  377. X  }
  378. X  
  379. X! void save_map() {
  380. X      int i;
  381. X  
  382. X      for (i=0; i<100; i++) {
  383. X***************
  384. X*** 199,205 ****
  385. X      oldpos.y = y;
  386. X  }
  387. X  
  388. X! restore_map() {
  389. X      int i;
  390. X  
  391. X      for (i=0; i<100; i++) {
  392. X--- 211,217 ----
  393. X      oldpos.y = y;
  394. X  }
  395. X  
  396. X! void restore_map() {
  397. X      int i;
  398. X  
  399. X      for (i=0; i<100; i++) {
  400. X***************
  401. X*** 216,220 ****
  402. X      moves = oldpos.moves;
  403. X      x = oldpos.x;
  404. X      y = oldpos.y;
  405. X- 
  406. X  }
  407. X--- 228,231 ----
  408. XOnly in .: patch1
  409. Xdiff -c ./patchlevel.h ../thricken-1.1/patchlevel.h
  410. X*** ./patchlevel.h    Mon Jun 22 02:06:16 1992
  411. X--- ../thricken-1.1/patchlevel.h    Mon Jun 22 01:46:12 1992
  412. X***************
  413. X*** 0 ****
  414. X--- 1,10 ----
  415. X+ /* Patch 1:
  416. X+  * Fixed a few portability probs (such as use of signed vs unsigned)
  417. X+  * Updated manual page
  418. X+  * Fixed move counter
  419. X+  * Tidied up general coding - more checks for errors and better typed functions
  420. X+  *       James Bonfield
  421. X+  */
  422. X+ 
  423. X+ char ident[] = "@(#)thricken: Version 1, patchlevel 1, May 22, 1992";
  424. X+ #define PATCHLEVEL 1
  425. Xdiff -c ./scores.c ../thricken-1.1/scores.c
  426. X*** ./scores.c    Mon Jun 22 02:06:01 1992
  427. X--- ../thricken-1.1/scores.c    Mon Jun 22 01:09:55 1992
  428. X***************
  429. X*** 35,40 ****
  430. X--- 35,41 ----
  431. X      }
  432. X  
  433. X      p=getpwuid(getuid());
  434. X+     /* should check return of find_level here (-1 = failure) */
  435. X      l = find_level(getuid())->level;
  436. X  
  437. X      /* if we cheated and started on a higher level then stop here */
  438. X***************
  439. X*** 112,118 ****
  440. X      static struct scored ret;
  441. X  
  442. X      if ((fp = open_scores(fp,"r")) == NULL) {
  443. X!     return;
  444. X      }
  445. X      p=getpwuid(uid);
  446. X      do {
  447. X--- 113,119 ----
  448. X      static struct scored ret;
  449. X  
  450. X      if ((fp = open_scores(fp,"r")) == NULL) {
  451. X!     return (struct scored *)-1;
  452. X      }
  453. X      p=getpwuid(uid);
  454. X      do {
  455. Xdiff -c ./screen.c ../thricken-1.1/screen.c
  456. X*** ./screen.c    Mon Jun 22 02:06:01 1992
  457. X--- ../thricken-1.1/screen.c    Mon Jun 22 01:09:55 1992
  458. X***************
  459. X*** 1,3 ****
  460. X--- 1,5 ----
  461. X+ #include <stdio.h>
  462. X+ #include <stdlib.h>
  463. X  #include <signal.h>
  464. X  #include <fcntl.h>
  465. X  #include <curses.h>
  466. X***************
  467. X*** 20,27 ****
  468. X  }
  469. X  
  470. X  void init_display() {
  471. X!     int i,j;
  472. X!     char *ptr,s;
  473. X      FILE *fp;
  474. X      initscr();
  475. X      signal(SIGTSTP,stop);
  476. X--- 22,28 ----
  477. X  }
  478. X  
  479. X  void init_display() {
  480. X!     int i;
  481. X      FILE *fp;
  482. X      initscr();
  483. X      signal(SIGTSTP,stop);
  484. X***************
  485. X*** 57,63 ****
  486. X      exit(1);
  487. X  }
  488. X  
  489. X! draw_sprite(WINDOW *w, int y, int x, char spr) {
  490. X      int i,j;
  491. X  
  492. X      for (j=0; j<SPRHEIGHT; j++)
  493. X--- 58,64 ----
  494. X      exit(1);
  495. X  }
  496. X  
  497. X! void draw_sprite(WINDOW *w, int y, int x, char spr) {
  498. X      int i,j;
  499. X  
  500. X      for (j=0; j<SPRHEIGHT; j++)
  501. X***************
  502. X*** 65,71 ****
  503. X          mvwaddch(w,y+j,x+i,sprite[spr][j][i]);
  504. X  }
  505. X  
  506. X! draw_map(int y, int x) {
  507. X      int i,j;
  508. X  
  509. X      for (i=0; i<SCRWIDTH; i++)
  510. X--- 66,72 ----
  511. X          mvwaddch(w,y+j,x+i,sprite[spr][j][i]);
  512. X  }
  513. X  
  514. X! void draw_map(int y, int x) {
  515. X      int i,j;
  516. X  
  517. X      for (i=0; i<SCRWIDTH; i++)
  518. Xdiff -c ./thricken.6 ../thricken-1.1/thricken.6
  519. X*** ./thricken.6    Mon Jun 22 02:06:02 1992
  520. X--- ../thricken-1.1/thricken.6    Mon Jun 22 01:09:55 1992
  521. X***************
  522. X*** 26,31 ****
  523. X--- 26,48 ----
  524. X  the game into thinking you've completed the first 5 levels by starting on
  525. X  level 5. Level 0 is the first level.
  526. X  .sp
  527. X+ The keys are defined as follows :
  528. X+ .ta 1i 2i
  529. X+ .br
  530. X+     h    left
  531. X+ .br
  532. X+     j    down
  533. X+ .br
  534. X+     k    up
  535. X+ .br
  536. X+     l    right
  537. X+ .br
  538. X+     q    quit
  539. X+ .br
  540. X+     s    save (to memory)
  541. X+ .br
  542. X+     r     restore (from memory)
  543. X+ .sp
  544. X  Should you wish to give the game a different feel when using a different set
  545. X  of sprites and rules you may specify a directory as an argument using the
  546. X  .I -d directory
  547. X
  548. END_OF_FILE
  549. if test 10762 -ne `wc -c <'patches01'`; then
  550.     echo shar: \"'patches01'\" unpacked with wrong size!
  551. fi
  552. # end of 'patches01'
  553. fi
  554. echo shar: End of shell archive.
  555. exit 0
  556.