home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / x / volume21 / xsokoban / part02 < prev    next >
Encoding:
Text File  |  1993-12-18  |  54.1 KB  |  1,823 lines

  1. Newsgroups: comp.sources.x
  2. From: andru@tonic.lcs.mit.edu (Andrew Myers)
  3. Subject: v21i059:  xsokoban - Simple but complex move the stones game, Part02/04
  4. Message-ID: <1993Dec18.230056.19212@sparky.sterling.com>
  5. X-Md4-Signature: 856140b93139659da0b76bac8646f991
  6. Sender: chris@sparky.sterling.com (Chris Olson)
  7. Organization: Sterling Software
  8. Date: Sat, 18 Dec 1993 23:00:56 GMT
  9. Approved: chris@sterling.com
  10.  
  11. Submitted-by: andru@tonic.lcs.mit.edu (Andrew Myers)
  12. Posting-number: Volume 21, Issue 59
  13. Archive-name: xsokoban/part02
  14. Environment: X11, ansi
  15.  
  16. #! /bin/sh
  17. # This is a shell archive.  Remove anything before this line, then feed it
  18. # into a shell via "sh file" or similar.  To overwrite existing files,
  19. # type "sh file -c".
  20. # Contents:  xsokoban-3.0/README xsokoban-3.0/config.h
  21. #   xsokoban-3.0/config_local.h xsokoban-3.0/defaults.h
  22. #   xsokoban-3.0/errors.h xsokoban-3.0/globals.h xsokoban-3.0/help.h
  23. #   xsokoban-3.0/main.c xsokoban-3.0/options.h
  24. #   xsokoban-3.0/resources.c xsokoban-3.0/save.c xsokoban-3.0/screen.c
  25. #   xsokoban-3.0/screens/screen.10 xsokoban-3.0/screens/screen.14
  26. #   xsokoban-3.0/screens/screen.20 xsokoban-3.0/screens/screen.22
  27. #   xsokoban-3.0/screens/screen.24 xsokoban-3.0/screens/screen.25
  28. #   xsokoban-3.0/screens/screen.35 xsokoban-3.0/screens/screen.36
  29. #   xsokoban-3.0/screens/screen.39 xsokoban-3.0/screens/screen.41
  30. #   xsokoban-3.0/screens/screen.50 xsokoban-3.0/screens/screen.85
  31. #   xsokoban-3.0/screens/screen.89 xsokoban-3.0/screens/screen.90
  32. #   xsokoban-3.0/xsokoban.man
  33. # Wrapped by chris@sparky on Sat Dec 18 16:54:30 1993
  34. PATH=/bin:/usr/bin:/usr/ucb:/usr/local/bin:/usr/lbin:$PATH ; export PATH
  35. echo If this archive is complete, you will see the following message:
  36. echo '          "shar: End of archive 2 (of 4)."'
  37. if test -f 'xsokoban-3.0/README' -a "${1}" != "-c" ; then 
  38.   echo shar: Will not clobber existing file \"'xsokoban-3.0/README'\"
  39. else
  40.   echo shar: Extracting \"'xsokoban-3.0/README'\" \(2391 characters\)
  41.   sed "s/^X//" >'xsokoban-3.0/README' <<'END_OF_FILE'
  42. XXSokoban 3.0
  43. X------------
  44. X
  45. XThis is the third release of XSokoban.
  46. X
  47. XThis distribution contains all the files to compile and run the game,
  48. Xthe original 50 sokoban screen files, 40 additional screen files
  49. Xgleaned from various public domain versions of sokoban, and a manual
  50. Xpage that explains how the game works.
  51. X
  52. XInstallation -
  53. X  - Edit the header files config.h and config_local.h to define the
  54. X    appropriate paths and compilation options for your system.
  55. X    These defines should be checked carefully to make sure they are
  56. X    correct.
  57. X
  58. X  - Use 'xmkmf' to produce a Makefile from the Imakefile provided, or
  59. X    else edit 'Makefile' to set the compiler and compiler flags correctly
  60. X    and select the right libraries to compile with.
  61. X
  62. X  - Compile by typing 'make'.  If something goes wrong, and you can track
  63. X    down an error, send me a bug report (including what changes you needed
  64. X    to make, and I will see about fixing it for later distributions).
  65. X
  66. X  - Play the game by typing 'xsokoban'. If it complains about not being
  67. X    able to read the scorefile, create one with 'xsokoban -c'. If this
  68. X    doesn't work, it is probably because you need to create the score
  69. X    directory. See config.h.
  70. X
  71. X  - Set ROOTDIR to the desired location for the xsokoban data files,
  72. X    and rebuild.  Install the game by typing 'make install' or by
  73. X    manually copying the executable. Install the directories screens/,
  74. X    scores/, bitmaps/, and saves/ under ROOTDIR.
  75. X
  76. XNotes -
  77. X  - The screen files need to be publically readable and should not be
  78. X    writable.
  79. X
  80. X  - The score file should be readable/writeable ONLY by the 'superuser' of the
  81. X    program (see config.h).
  82. X
  83. X  - The save files should be readable/writeable ONLY by the 'superuser'.
  84. X
  85. X  - Because of this, the game needs to be run setuid of the person who is
  86. X    'superuser'.
  87. X
  88. XCredits -
  89. X  Unknown Hacker - Original curses(1) implementation.
  90. X  Joseph L. Traub - X windows interface.
  91. X  Kevin Solie - simultaneously developed X implementation (merged in).
  92. X  Mark Linderman, Christos Zoulas - Mouse code (added to Solie's version).
  93. X  Andrew Myers - Improved mouse UI and score ranking
  94. X
  95. XFixes/Bug Reports/Modifications -
  96. X  - If you make any changes to this program, fix any bugs, add any neat
  97. X    features, or whatever, please send mail to "andru@lcs.mit.edu"
  98. X    so that I can add them in to the newest release.
  99. X
  100. X--Andrew Myers
  101. X  (andru@lcs.mit.edu)
  102. END_OF_FILE
  103.   if test 2391 -ne `wc -c <'xsokoban-3.0/README'`; then
  104.     echo shar: \"'xsokoban-3.0/README'\" unpacked with wrong size!
  105.   fi
  106.   # end of 'xsokoban-3.0/README'
  107. fi
  108. if test -f 'xsokoban-3.0/config.h' -a "${1}" != "-c" ; then 
  109.   echo shar: Will not clobber existing file \"'xsokoban-3.0/config.h'\"
  110. else
  111.   echo shar: Extracting \"'xsokoban-3.0/config.h'\" \(2304 characters\)
  112.   sed "s/^X//" >'xsokoban-3.0/config.h' <<'END_OF_FILE'
  113. X/***********************************************************************
  114. X   You may wish to alter the following directory paths.
  115. X
  116. X   Note that the string concatenation performed below requires an
  117. X   ANSI-standard preprocessor. If you don't have one, you'll have to
  118. X   manually edit SCREENPATH, SAVEPATH, etc. to start with ROOTDIR.
  119. X***********************************************************************/
  120. X
  121. X#ifndef ROOTDIR
  122. X#define ROOTDIR "."
  123. X/* I suggest "/usr/local/lib/xsokoban" as a value for this variable
  124. X   in the installed version, but you know best...
  125. X*/
  126. X#endif
  127. X
  128. X/**/
  129. X/* SCREENPATH: the name of the directory where the screen files are held */
  130. X/**/
  131. X#ifndef SCREENPATH
  132. X#define SCREENPATH ROOTDIR "/screens"
  133. X#endif
  134. X
  135. X/**/
  136. X/* SAVEPATH: the name of the path where save files are held */
  137. X/*           Attention: Be sure that there are no other files with */
  138. X/*                      the name <username>.sav                    */
  139. X/**/
  140. X#ifndef SAVEPATH
  141. X#define SAVEPATH ROOTDIR "/saves"
  142. X#endif
  143. X
  144. X/* BITPATH: the full pathname to the bitmap file defaults. */
  145. X#ifndef BITPATH
  146. X#define BITPATH ROOTDIR "/bitmaps/defaults"
  147. X#endif
  148. X
  149. X/**/
  150. X/* LOCKPATH: temporary file which is created to ensure that no users */
  151. X/*           work with the scorefile at the same time                */
  152. X/**/
  153. X#ifndef LOCKFILE
  154. X#define LOCKFILE ROOTDIR "/scores/lock"
  155. X#endif
  156. X
  157. X/**/
  158. X/* SCOREFILE: the full pathname of the score file */
  159. X/**/
  160. X#ifndef SCOREFILE
  161. X#define SCOREFILE ROOTDIR "/scores/scores"
  162. X#endif
  163. X
  164. X/**/
  165. X/* MAXUSERNAME: defines the maximum length of a system's user name */
  166. X/**/
  167. X#define MAXUSERNAME     32
  168. X
  169. X/**/
  170. X/* MAXSCOREENTRIES: defines the maximum number of entries in the scoretable */
  171. X/**/
  172. X#define MAXSCOREENTRIES 10000
  173. X
  174. X/**/
  175. X/* SUPERUSER: defines the name of the game superuser */
  176. X/**/
  177. X#ifndef SUPERUSER
  178. X#define SUPERUSER "chris"
  179. X#endif
  180. X
  181. X/**/
  182. X/* PASSWORD: defines the password necessary for creating a new score file */
  183. X/**/
  184. X#ifndef PASSWORD
  185. X#define PASSWORD "score"
  186. X#endif
  187. X
  188. X/**/
  189. X/* ANYLEVEL: Allow any user to play any level and enter a score for it */
  190. X/**/
  191. X#undef ANYLEVEL
  192. X
  193. X/**/
  194. X/* MAXSOLNRANK: The maximum solution rank for which an entry is retained */
  195. X/* in the score table. */
  196. X/**/
  197. X#define MAXSOLNRANK 5
  198. X
  199. X/**/
  200. X/* STACKDEPTH: Number of previous positions remembered in the move stack */
  201. X/**/
  202. X#define STACKDEPTH 1000
  203. END_OF_FILE
  204.   if test 2304 -ne `wc -c <'xsokoban-3.0/config.h'`; then
  205.     echo shar: \"'xsokoban-3.0/config.h'\" unpacked with wrong size!
  206.   fi
  207.   # end of 'xsokoban-3.0/config.h'
  208. fi
  209. if test -f 'xsokoban-3.0/config_local.h' -a "${1}" != "-c" ; then 
  210.   echo shar: Will not clobber existing file \"'xsokoban-3.0/config_local.h'\"
  211. else
  212.   echo shar: Extracting \"'xsokoban-3.0/config_local.h'\" \(737 characters\)
  213.   sed "s/^X//" >'xsokoban-3.0/config_local.h' <<'END_OF_FILE'
  214. X/*
  215. X    This file contains only definitions required to make compilation
  216. X    occur successfully. These definitions control whether various
  217. X    include files or extern declarations are needed.
  218. X
  219. X    If the answer to any of these questions is yes, the corresponding
  220. X    symbol should be defined.
  221. X*/
  222. X/* Is there a prototype for "getpass"? */
  223. X#define GETPASS_PROTO
  224. X
  225. X/* Are "htons" and "ntohs" defined in <machine/endian.h>? */
  226. X#undef NEED_ENDIAN
  227. X
  228. X/* Is there a prototype for "creat"? */
  229. X#undef CREAT_PROTO
  230. X
  231. X/* Are "htons" and "ntohs" defined in <netinet/in.h>? */
  232. X#undef NEED_NETINET_IN_H
  233. X
  234. X/* Is there a prototype for "fprintf" in <stdio.h>? */
  235. X#define FPRINTF_PROTO
  236. X
  237. X/* Is there a prototype for "fclose" in <stdio.h>? */
  238. X#define FCLOSE_PROTO
  239. END_OF_FILE
  240.   if test 737 -ne `wc -c <'xsokoban-3.0/config_local.h'`; then
  241.     echo shar: \"'xsokoban-3.0/config_local.h'\" unpacked with wrong size!
  242.   fi
  243.   # end of 'xsokoban-3.0/config_local.h'
  244. fi
  245. if test -f 'xsokoban-3.0/defaults.h' -a "${1}" != "-c" ; then 
  246.   echo shar: Will not clobber existing file \"'xsokoban-3.0/defaults.h'\"
  247. else
  248.   echo shar: Extracting \"'xsokoban-3.0/defaults.h'\" \(386 characters\)
  249.   sed "s/^X//" >'xsokoban-3.0/defaults.h' <<'END_OF_FILE'
  250. X#define DEF_FONT "9x15"
  251. X#define DEF_BITH 30
  252. X#define DEF_BITW 30
  253. X#define DEF_CURSOR 102
  254. X
  255. X#define WALLS "fancyWalls"
  256. X#define FONT "fontName"
  257. X#define REVERSE "reverseVideo"
  258. X#define FOREG "foreground"
  259. X#define BACKG "background"
  260. X#define BORDER "borderColor"
  261. X#define CURSOR "pointerColor"
  262. X#define BITDIR "bitmapDir"
  263. X#define BITH "bitmapHeight"
  264. X#define BITW "bitmapWidth"
  265. X#define NUM_WALLS 16
  266. END_OF_FILE
  267.   if test 386 -ne `wc -c <'xsokoban-3.0/defaults.h'`; then
  268.     echo shar: \"'xsokoban-3.0/defaults.h'\" unpacked with wrong size!
  269.   fi
  270.   # end of 'xsokoban-3.0/defaults.h'
  271. fi
  272. if test -f 'xsokoban-3.0/errors.h' -a "${1}" != "-c" ; then 
  273.   echo shar: Will not clobber existing file \"'xsokoban-3.0/errors.h'\"
  274. else
  275.   echo shar: Extracting \"'xsokoban-3.0/errors.h'\" \(2541 characters\)
  276.   sed "s/^X//" >'xsokoban-3.0/errors.h' <<'END_OF_FILE'
  277. X/* textual errormessages corresponding to the #defines in globals.h */
  278. Xchar *errmess[] = {
  279. X    "illegal error number",
  280. X    "cannot open screen file",
  281. X    "more than one player position in screen file",
  282. X    "illegal char in screen file",
  283. X    "no player position in screenfile",
  284. X    "too much rows in screen file",
  285. X    "too much columns in screenfile",
  286. X    "quit the game",
  287. X    "cannot get your username",
  288. X    "cannot open savefile",
  289. X    "error writing to savefile",
  290. X    "cannot stat savefile",
  291. X    "error reading savefile",
  292. X    "cannot restore, your savefile has been altered",
  293. X    "game saved",
  294. X    "too much users in score table",
  295. X    "cannot open score file",
  296. X    "error reading scorefile",
  297. X    "error writing scorefile",
  298. X    "illegal command line syntax",
  299. X    "illegal password",
  300. X    "level number too big in command line",
  301. X    "only superuser is allowed to make a new score table",
  302. X    "cannot find file to restore",
  303. X    "cannot find bitmap file",
  304. X    "cannot open display",
  305. X    "cannot load font",
  306. X    "cannot allocate string memory",
  307. X    "could not load requested color"
  308. X};
  309. X
  310. X/* usage message */
  311. X#define USAGESTR \
  312. X "usage: %s [-{s|c|r|<nn>} -display <disp> -{w|walls} -{f|font} \n\
  313. X                 -{rv|reverse} -{b|bitdir} <path> -{fg|foreground} <color> \n\
  314. X                 -{bg|background} <color> -{bd|border} <color> \n\
  315. X                 -{pr|pointer} <color> -xrm <arg>]\n\n"
  316. X
  317. Xchar *usages[] = {
  318. X  "\t-c                  : create a new score file (superuser only)\n",
  319. X  "\t-r                  : restore a saved game.\n",
  320. X  "\t-s                  : show high score table.\n",
  321. X  "\t-<nn>               : play level <nn> (<nn> must be greater than 0)\n",
  322. X  "\t-display <disp>     : run on display <disp>\n",
  323. X  "\t-w                  :\n",
  324. X  "\t-walls              : use fancy walls\n",
  325. X  "\t-rv                 :\n",
  326. X  "\t-reverse            : reverse the foreground and backgound colors\n",
  327. X  "\t-f <fn>             :\n",
  328. X  "\t-font <fn>          : use font <fn>\n",
  329. X  "\t-b <path>           :\n",
  330. X  "\t-bitdir <path>      : use bitmaps found in directory <path>\n",
  331. X  "\t-fg <color>         :\n",
  332. X  "\t-foregound <color>  : use <color> as foreground color\n",
  333. X  "\t-bg <color>         :\n",
  334. X  "\t-backgound <color>  : use <color> as background color\n",
  335. X  "\t-bd <color>         :\n",
  336. X  "\t-border <color>     : use <color> as border color\n",
  337. X  "\t-pr <color>         :\n",
  338. X  "\t-pointer <color>    : use <color> as the pointer foreground color\n",
  339. X  "\t-xrm <arg>          : specify that <arg> is an X resource.\n",
  340. X  NULL
  341. X};
  342. END_OF_FILE
  343.   if test 2541 -ne `wc -c <'xsokoban-3.0/errors.h'`; then
  344.     echo shar: \"'xsokoban-3.0/errors.h'\" unpacked with wrong size!
  345.   fi
  346.   # end of 'xsokoban-3.0/errors.h'
  347. fi
  348. if test -f 'xsokoban-3.0/globals.h' -a "${1}" != "-c" ; then 
  349.   echo shar: Will not clobber existing file \"'xsokoban-3.0/globals.h'\"
  350. else
  351.   echo shar: Extracting \"'xsokoban-3.0/globals.h'\" \(2098 characters\)
  352.   sed "s/^X//" >'xsokoban-3.0/globals.h' <<'END_OF_FILE'
  353. X#include "config.h"
  354. X/*****************************************************************************\
  355. X *  Stuff in this file shouldn't ever need to be changed.                    *
  356. X\*****************************************************************************/
  357. X
  358. X#ifdef VICE
  359. Xextern int PlayerUID;
  360. X#define getuid() PlayerUID
  361. X#define geteuid() PlayerUID
  362. X#endif
  363. X
  364. X#define BUFSIZE 256
  365. X
  366. X/* internal object representation */
  367. X#define   player    '@'
  368. X#define   playerstore    '+'
  369. X#define   store        '.'
  370. X#define   packet    '$'
  371. X#define   save        '*'
  372. X#define   ground    ' '
  373. X#define   wall        '#'
  374. X
  375. X/* maximum possible size of a board */
  376. X#define MAXROW        20
  377. X#define MAXCOL        20
  378. X
  379. X/* player position for movement */
  380. Xtypedef struct {
  381. X   short x, y;
  382. X} POS;
  383. X
  384. X/* list of possible errors */
  385. X#define E_FOPENSCREEN    1
  386. X#define E_PLAYPOS1    2
  387. X#define E_ILLCHAR    3
  388. X#define E_PLAYPOS2    4
  389. X#define E_TOMUCHROWS    5
  390. X#define E_TOMUCHCOLS    6
  391. X#define E_ENDGAME    7
  392. X#define E_NOUSER    8
  393. X#define E_FOPENSAVE    9
  394. X#define E_WRITESAVE    10
  395. X#define E_STATSAVE    11
  396. X#define E_READSAVE    12
  397. X#define E_ALTERSAVE    13
  398. X#define E_SAVED        14
  399. X#define E_TOMUCHSE    15
  400. X#define E_FOPENSCORE    16
  401. X#define E_READSCORE    17
  402. X#define E_WRITESCORE    18
  403. X#define E_USAGE        19
  404. X#define E_ILLPASSWORD    20
  405. X#define E_LEVELTOOHIGH    21
  406. X#define E_NOSUPER    22
  407. X#define E_NOSAVEFILE    23
  408. X#define E_NOBITMAP    24
  409. X#define E_NODISPLAY    25
  410. X#define E_NOFONT    26
  411. X#define E_NOMEM        27
  412. X#define E_NOCOLOR    28
  413. X
  414. X/* classname for silly X stuff */
  415. X#define CLASSNAME "XSokoban"
  416. X
  417. X/* macros translating game coords to window coords */
  418. X#define cX(x) (bit_width * (((MAXCOL - cols) / 2) + (x)))
  419. X#define cY(x) (bit_height * (((MAXROW - rows) / 2) + (x)))
  420. X
  421. X/* macros translating window coords to game coords */
  422. X#define wX(x) (((x)/bit_width) - ((MAXCOL - cols)/2))
  423. X#define wY(x) (((x)/bit_height) - ((MAXROW - rows)/2))
  424. X
  425. X
  426. X/*** Global state ***/
  427. Xtypedef char Map[MAXROW+1][MAXCOL+1];
  428. X
  429. Xextern Map map;
  430. X
  431. Xextern short rows, cols, level, moves, pushes, savepack, packets;
  432. Xextern unsigned short scorelevel, scoremoves, scorepushes;
  433. Xextern POS ppos;
  434. Xextern Display *dpy;
  435. Xextern unsigned int bit_width, bit_height;
  436. Xextern Atom wm_delete_window, wm_protocols;
  437. END_OF_FILE
  438.   if test 2098 -ne `wc -c <'xsokoban-3.0/globals.h'`; then
  439.     echo shar: \"'xsokoban-3.0/globals.h'\" unpacked with wrong size!
  440.   fi
  441.   # end of 'xsokoban-3.0/globals.h'
  442. fi
  443. if test -f 'xsokoban-3.0/help.h' -a "${1}" != "-c" ; then 
  444.   echo shar: Will not clobber existing file \"'xsokoban-3.0/help.h'\"
  445. else
  446.   echo shar: Extracting \"'xsokoban-3.0/help.h'\" \(1202 characters\)
  447.   sed "s/^X//" >'xsokoban-3.0/help.h' <<'END_OF_FILE'
  448. X/* help pages */
  449. Xtypedef struct helpline {
  450. X   int xpos, ypos, page;
  451. X   char *textline;
  452. X} h_line;
  453. X
  454. Xh_line help_pages[] = {
  455. X  { 0, 35, 0, "Objective:  Push all the objects from their starting positions"},
  456. X  { 12, 50, 0, "into their goal positions.  Be warned that you can"},
  457. X  { 12, 65, 0, "push only one object at a time; watch out for corners!"},
  458. X  { 0, 100, 0, "Movement:"},
  459. X  { 12, 100, 0, "Left mouse button: move player to this point"},
  460. X  { 12, 115, 0, "Middle mouse button: push ball to this point"},
  461. X  { 12, 130, 0, "Right mouse button: undo last action"},
  462. X  { 0, 155, 0, "Or use the arrow keys or hljk, as in vi:"},
  463. X  { 13, 170, 0, "Move/Push     h    l    k   j"},
  464. X  { 13, 185, 0, "Run/Push      H    L    K   J"},
  465. X  { 13, 200, 0, "Run Only     ^H   ^L   ^K  ^J"},
  466. X  { 0, 225, 0, "Commands:"},
  467. X  { 12, 240, 0, "^r: redraw screen             ?: this help message"}, 
  468. X  { 12, 255, 0, " u: undo last action          U: restart this level"},
  469. X  { 12, 270, 0, " s: save game and quit        q: quit game"},
  470. X  { 0, 380, 0, "Bitmaps:"},
  471. X  { 12, 380, 0, "Player:     Goal:      Wall:     Object:"},
  472. X  { 12, 420, 0, "Object on a goal:      Player on a goal:"},
  473. X  {0, 0, 0, NULL}
  474. X};
  475. X
  476. X#define HELP_PAGES 1
  477. END_OF_FILE
  478.   if test 1202 -ne `wc -c <'xsokoban-3.0/help.h'`; then
  479.     echo shar: \"'xsokoban-3.0/help.h'\" unpacked with wrong size!
  480.   fi
  481.   # end of 'xsokoban-3.0/help.h'
  482. fi
  483. if test -f 'xsokoban-3.0/main.c' -a "${1}" != "-c" ; then 
  484.   echo shar: Will not clobber existing file \"'xsokoban-3.0/main.c'\"
  485. else
  486.   echo shar: Extracting \"'xsokoban-3.0/main.c'\" \(8088 characters\)
  487.   sed "s/^X//" >'xsokoban-3.0/main.c' <<'END_OF_FILE'
  488. X#include <stdio.h>
  489. X#include <pwd.h>
  490. X#include <X11/Xlib.h>
  491. X#include <X11/Xresource.h>
  492. X#include <stdlib.h>
  493. X#include <unistd.h>
  494. X#include <string.h>
  495. X
  496. X#include "externs.h"
  497. X#include "globals.h"
  498. X#include "options.h"
  499. X#include "errors.h"
  500. X
  501. X/* useful globals */
  502. XBoolean scoring = _true_;
  503. Xshort level, packets, savepack, moves, pushes, rows, cols;
  504. Xunsigned short scorelevel, scoremoves, scorepushes;
  505. XPOS ppos;
  506. Xchar map[MAXROW + 1][MAXCOL + 1];
  507. Xchar *username = NULL, *progname = NULL, *bitpath = NULL;
  508. Xstatic Boolean optshowscore = _false_, optmakescore = _false_,
  509. X           optrestore = _false_, superuser = _false_;
  510. Xstatic short optlevel = 0, userlevel;
  511. Xstruct passwd *pwd;
  512. XXrmDatabase rdb;
  513. X
  514. Xextern Display *dpy;
  515. Xextern int scr;
  516. Xextern Boolean display_alloc;
  517. X
  518. X/* do all the setup foo, and make sure command line gets parsed. */
  519. Xvoid main(int argc, char **argv)
  520. X{
  521. X  short ret = 0, ret2 = 0;
  522. X
  523. X#ifdef VICE
  524. X  Authenticate();
  525. X#endif
  526. X
  527. X  scorelevel = 0;
  528. X  moves = pushes = packets = savepack = 0;
  529. X
  530. X  /* make the program name be what it is invoked with */
  531. X  progname = strrchr(argv[0], '/');
  532. X  if(progname == NULL)
  533. X    progname = argv[0];
  534. X  else
  535. X    progname++;
  536. X
  537. X  /* find out who is playing us. (pwd will be kept around in case we need to
  538. X   * build the Xresources stuff later.
  539. X   */
  540. X  pwd = getpwuid(getuid());
  541. X  if(pwd == NULL)
  542. X    /* we MUST be being played by somebody, sorry */
  543. X    ret = E_NOUSER;
  544. X  else {
  545. X    /* find out who we are. */
  546. X    username = pwd->pw_name;
  547. X    /* see if we are the superuser */
  548. X    superuser = (strcmp(username, SUPERUSER) == 0) ? _true_ : _false_;
  549. X    /* Parse the command line */
  550. X    ret = CheckCommandLine(&argc, argv);
  551. X    if(ret == 0) {
  552. X      if(optshowscore)
  553. X    ret = OutputScore();
  554. X      else if(optmakescore) {
  555. X    if(superuser) {
  556. X      /* make sure of that, shall we? */
  557. X      ret = GetGamePassword();
  558. X      if(ret == 0)
  559. X        ret = MakeNewScore();
  560. X    } else
  561. X      /* sorry, BAD superuser */
  562. X      ret = E_NOSUPER;
  563. X      } else if(optrestore) {
  564. X    ret = RestoreGame();
  565. X      } else {
  566. X    ret = GetUserLevel(&userlevel);
  567. X    if(ret == 0) {
  568. X        if(optlevel > 0) {
  569. X#ifndef ANYLEVEL
  570. X        if (userlevel < optlevel) {
  571. X            if (superuser) {
  572. X            /* superusers can play any level (but not score),
  573. X             * which is useful for testing out new boards.
  574. X             */
  575. X            level = optlevel;
  576. X            scoring = _false_;
  577. X            } else {
  578. X            ret = E_LEVELTOOHIGH;
  579. X            }
  580. X        } else
  581. X#endif
  582. X          level = optlevel;
  583. X      } else
  584. X        level = userlevel;
  585. X    }
  586. X      }
  587. X    }
  588. X  }
  589. X  if(ret == 0) {
  590. X    /* play till we drop, then nuke the good stuff */
  591. X    ret = GameLoop();
  592. X    DestroyDisplay();
  593. X  }
  594. X  /* always report here since the game returns E_ENDGAME when the user quits.
  595. X   * Sigh.. it would be so much easier to just do it right.
  596. X   */
  597. X  Error(ret);
  598. X  /* see if they score, and do it (again report an error */
  599. X  if((scorelevel > 0) && scoring) {
  600. X    ret2 = Score(_true_);
  601. X    Error(ret2);
  602. X  }
  603. X  /* exit with whatever status we ended with */
  604. X  exit(ret);
  605. X}
  606. X
  607. X/* Oh boy, the fun stuff.. Follow along boys and girls as we parse the command
  608. X * line up into little bitty pieces and merge in all the xdefaults that we
  609. X * need.
  610. X */
  611. Xshort CheckCommandLine(int *argcP, char **argv)
  612. X{
  613. X  XrmDatabase command = NULL, temp = NULL;
  614. X  char *res;
  615. X  char buf[1024];
  616. X  int option;
  617. X
  618. X  /* let's do this the sensible way, Command line first! */
  619. X  /* we will also OPEN the display here, though we won't do anything with it */
  620. X  XrmInitialize();
  621. X
  622. X  /* build an XrmDB from the command line based on the options (options.h) */
  623. X  XrmParseCommand(&command, options, sizeof(options)/sizeof(*options),
  624. X          progname, argcP, argv);
  625. X
  626. X  /* okay, we now have the X command line options parsed, we might as well
  627. X   * make sure we need to go further before we do.  These command line options
  628. X   * are NOT caught by XrmParseCommand(), so we need to do them ourselves.
  629. X   * Remember, they are all exclusive of one another.
  630. X   */
  631. X  for(option = 1; option < *argcP; option++) {
  632. X    if(argv[option][0] == '-') {
  633. X      switch(argv[option][1]) {
  634. X    case 's':
  635. X      if(optshowscore || optmakescore || optrestore || (optlevel > 0))
  636. X        return E_USAGE;
  637. X      optshowscore = _true_;
  638. X      break;
  639. X    case 'c':
  640. X      if(optshowscore || optmakescore || optrestore || (optlevel > 0))
  641. X        return E_USAGE;
  642. X      optmakescore = _true_;
  643. X      break;
  644. X    case 'r':
  645. X      if(optshowscore || optmakescore || optrestore || (optlevel > 0))
  646. X        return E_USAGE;
  647. X      optrestore = _true_;
  648. X      break;
  649. X    default:
  650. X      if(optshowscore || optrestore || optmakescore || (optlevel > 0))
  651. X        return E_USAGE;
  652. X      optlevel = atoi(argv[option]+1);
  653. X      if(optlevel == 0)
  654. X        return E_USAGE;
  655. X      break;
  656. X      }
  657. X    } else
  658. X      /* found an option that didn't begin with a - (oops) */
  659. X      return E_USAGE;
  660. X  }
  661. X
  662. X  if (optshowscore) return 0; /* Don't mess with X any more */
  663. X  /* okay.. NOW, find out what display we are currently attached to. This
  664. X   * allows us to put the display on another machine
  665. X   */
  666. X  res = GetDatabaseResource(command, "display");
  667. X
  668. X  /* open up the display */
  669. X  dpy = XOpenDisplay(res);
  670. X  if(dpy == (Display *)NULL)
  671. X    return E_NODISPLAY;
  672. X  display_alloc = _true_;
  673. X
  674. X  /* okay, we have a display, now we can get the std xdefaults and stuff */
  675. X  res = XResourceManagerString(dpy);
  676. X  if(res != NULL)
  677. X    /* try to get it off the server first (ya gotta love R4) */
  678. X    rdb = XrmGetStringDatabase(res);
  679. X  else {
  680. X    /* can't get it from the server, let's do it the slow way */
  681. X    /* try HOME first in case you have people sharing accounts :) */
  682. X    res = getenv("HOME");
  683. X    if(res != NULL)
  684. X      strcpy(buf, res);
  685. X    else
  686. X      /* no HOME, let's try and make one from the pwd (whee) */
  687. X      strcpy(buf, pwd->pw_dir);
  688. X    strcat(buf, "/.Xdefaults");
  689. X    rdb = XrmGetFileDatabase(buf);
  690. X  }
  691. X
  692. X  /* let's merge in the X environment */
  693. X  res = getenv("XENVIRONMENT");
  694. X  if(res != NULL) {
  695. X    temp = XrmGetFileDatabase(res);
  696. X    XrmMergeDatabases(temp, &rdb);
  697. X  }
  698. X
  699. X  /* now merge in the rest of the X command line options! */
  700. X  XrmMergeDatabases(command, &rdb);
  701. X  return 0;
  702. X}
  703. X
  704. X/* we just sit here and keep playing level after level after level after .. */
  705. Xshort GameLoop(void)
  706. X{
  707. X  short ret = 0;
  708. X
  709. X  /* make sure X is all set up and ready for us */
  710. X  ret = InitX();
  711. X  if(ret != 0)
  712. X    return ret;
  713. X
  714. X  /* get where we are starting from */
  715. X  if(!optrestore)
  716. X    ret = ReadScreen();
  717. X
  718. X  /* until we quit or get an error, just keep on going. */
  719. X  while(ret == 0) {
  720. X    ret = Play();
  721. X    if((scorelevel > 0) && scoring) {
  722. X      int ret2;
  723. X      ret2 = Score(_false_);
  724. X      Error(ret2);
  725. X      scorelevel = 0;
  726. X    }
  727. X    if(ret == 0) {
  728. X      level++;
  729. X      moves = pushes = packets = savepack = 0;
  730. X      ret = ReadScreen();
  731. X    }
  732. X  }
  733. X  return ret;
  734. X}
  735. X
  736. X/* Does this really need a comment :) */
  737. Xshort GetGamePassword(void)
  738. X{
  739. X  return ((strcmp(getpass("Password: "), PASSWORD) == 0) ? 0 : E_ILLPASSWORD);
  740. X}
  741. X
  742. X/* display the correct error message based on the error number given us. 
  743. X * There are 2 special cases, E_ENDGAME (in which case we don't WANT a 
  744. X * silly error message cause it's not really an error, and E_USAGE, in which
  745. X * case we want to give a really nice list of all the legal options.
  746. X */
  747. Xvoid Error(short err)
  748. X{
  749. X  switch(err) {
  750. X    case E_FOPENSCREEN:
  751. X    case E_PLAYPOS1:
  752. X    case E_ILLCHAR:
  753. X    case E_PLAYPOS2:
  754. X    case E_TOMUCHROWS:
  755. X    case E_TOMUCHCOLS:
  756. X    case E_NOUSER:
  757. X    case E_FOPENSAVE:
  758. X    case E_WRITESAVE:
  759. X    case E_STATSAVE:
  760. X    case E_READSAVE:
  761. X    case E_ALTERSAVE:
  762. X    case E_SAVED:
  763. X    case E_TOMUCHSE:
  764. X    case E_FOPENSCORE:
  765. X    case E_READSCORE:
  766. X    case E_WRITESCORE:
  767. X    case E_USAGE:
  768. X    case E_ILLPASSWORD:
  769. X    case E_LEVELTOOHIGH:
  770. X    case E_NOSUPER:
  771. X    case E_NOSAVEFILE:
  772. X    case E_NOBITMAP:
  773. X    case E_NODISPLAY:
  774. X    case E_NOFONT:
  775. X    case E_NOMEM:
  776. X    case E_NOCOLOR:
  777. X      fprintf(stderr, "%s: %s\n", progname, errmess[err]);
  778. X      if(err == E_USAGE)
  779. X        Usage();
  780. X      break;
  781. X    default:
  782. X      if(err != E_ENDGAME)
  783. X    fprintf(stderr, "%s: %s\n", progname, errmess[0]);
  784. X      break;
  785. X  }
  786. X}
  787. X
  788. X/* this simply prints out the usage string nicely. */
  789. Xvoid Usage(void)
  790. X{
  791. X  short i;
  792. X
  793. X  fprintf(stderr, USAGESTR, progname);
  794. X  for (i = 0; usages[i] != NULL; i++)
  795. X    fprintf(stderr, "%s", usages[i]);
  796. X}
  797. END_OF_FILE
  798.   if test 8088 -ne `wc -c <'xsokoban-3.0/main.c'`; then
  799.     echo shar: \"'xsokoban-3.0/main.c'\" unpacked with wrong size!
  800.   fi
  801.   # end of 'xsokoban-3.0/main.c'
  802. fi
  803. if test -f 'xsokoban-3.0/options.h' -a "${1}" != "-c" ; then 
  804.   echo shar: Will not clobber existing file \"'xsokoban-3.0/options.h'\"
  805. else
  806.   echo shar: Extracting \"'xsokoban-3.0/options.h'\" \(1595 characters\)
  807.   sed "s/^X//" >'xsokoban-3.0/options.h' <<'END_OF_FILE'
  808. X/* the list of the options used to build the command line XrmDB.
  809. X * if an option has no seperate arg, and appears on the command line, the 
  810. X * last value in the table is what will be entered into the db.
  811. X */
  812. Xstatic XrmOptionDescRec options[] = {
  813. X  { "-w",          "*fancyWalls",    XrmoptionNoArg,    (caddr_t)  "on" },
  814. X  { "-walls",      "*fancyWalls",    XrmoptionNoArg,    (caddr_t)  "on" },
  815. X  { "-f",          "*fontName",      XrmoptionSepArg,   (caddr_t)     0 },
  816. X  { "-font",       "*fontName",      XrmoptionSepArg,   (caddr_t)     0 },
  817. X  { "-rv",         "*reverseVideo",  XrmoptionNoArg,    (caddr_t)  "on" },
  818. X  { "-reverse",    "*reverseVideo",  XrmoptionNoArg,    (caddr_t)  "on" },
  819. X  { "-fg",         "*foreground",    XrmoptionSepArg,   (caddr_t)     0 },
  820. X  { "-foreground", "*foreground",    XrmoptionSepArg,   (caddr_t)     0 },
  821. X  { "-bg",         "*background",    XrmoptionSepArg,   (caddr_t)     0 },
  822. X  { "-background", "*background",    XrmoptionSepArg,   (caddr_t)     0 },
  823. X  { "-bd",         "*borderColor",   XrmoptionSepArg,   (caddr_t)     0 },
  824. X  { "-border",     "*borderColor",   XrmoptionSepArg,   (caddr_t)     0 },
  825. X  { "-pr",         "*pointerColor",  XrmoptionSepArg,   (caddr_t)     0 },
  826. X  { "-pointer",    "*pointerColor",  XrmoptionSepArg,   (caddr_t)     0 },
  827. X  { "-b",          "*bitmapDir",     XrmoptionSepArg,   (caddr_t)     0 },
  828. X  { "-bitdir",     "*bitmapDir",     XrmoptionSepArg,   (caddr_t)     0 },
  829. X  { "-display",    ".display",         XrmoptionSepArg,    (caddr_t)     0 },
  830. X  { "-xrm",        (char *) 0,       XrmoptionResArg,   (caddr_t)     0 }
  831. X};
  832. END_OF_FILE
  833.   if test 1595 -ne `wc -c <'xsokoban-3.0/options.h'`; then
  834.     echo shar: \"'xsokoban-3.0/options.h'\" unpacked with wrong size!
  835.   fi
  836.   # end of 'xsokoban-3.0/options.h'
  837. fi
  838. if test -f 'xsokoban-3.0/resources.c' -a "${1}" != "-c" ; then 
  839.   echo shar: Will not clobber existing file \"'xsokoban-3.0/resources.c'\"
  840. else
  841.   echo shar: Extracting \"'xsokoban-3.0/resources.c'\" \(1703 characters\)
  842.   sed "s/^X//" >'xsokoban-3.0/resources.c' <<'END_OF_FILE'
  843. X#include <stdio.h>
  844. X
  845. X#include "externs.h"
  846. X#include "globals.h"
  847. X
  848. Xextern char *progname;
  849. Xextern XrmDatabase rdb;
  850. Xextern Display *dpy;
  851. Xextern Colormap cmap;
  852. X
  853. X/* rewritten slightly from the xantfarm code by Jef Poskanzer */
  854. X
  855. X/* get a resource from the specified db.  This helps support the -display
  856. X * code, but could be used to get a resource that should only be specified
  857. X * in a given place (ie either only command line, or only Xresource db)
  858. X */
  859. Xchar *GetDatabaseResource(XrmDatabase db, char *res)
  860. X{
  861. X  char name[500];
  862. X  char class[500];
  863. X  char *type;
  864. X  XrmValue value;
  865. X
  866. X  (void)sprintf(name, "%s.%s", progname, res);
  867. X  (void)sprintf(class, "%s.%s", CLASSNAME, res);
  868. X
  869. X  if(XrmGetResource(db, name, class, &type, &value) == True)
  870. X    if(strcmp(type, "String") == 0)
  871. X      return (char *)value.addr;
  872. X  return (char *)0;
  873. X}
  874. X
  875. X/* just calls the above routine with the general combined db */
  876. Xchar *GetResource(char *res)
  877. X{
  878. X  return GetDatabaseResource(rdb, res);
  879. X}
  880. X
  881. X/* returns the color pixel for the given resource */
  882. XBoolean GetColorResource(char *res, unsigned long *cP)
  883. X{
  884. X  XColor color;
  885. X  char *rval = GetResource(res);
  886. X
  887. X  if(rval == (char *)0)
  888. X    return _false_;
  889. X  if(XParseColor(dpy, cmap, rval, &color) != True)
  890. X    return _false_;
  891. X  if(XAllocColor(dpy, cmap, &color) != True)
  892. X    return _false_;
  893. X  *cP = color.pixel;
  894. X  return _true_;
  895. X}
  896. X
  897. Xchar *boolopts[] = {
  898. X  "true",
  899. X  "True",
  900. X  "on",
  901. X  "On",
  902. X  "yes",
  903. X  "Yes",
  904. X  "1"
  905. X};
  906. X
  907. X/* convert a string to the 'boolean' type (I defined my own, thanks) */
  908. XBoolean StringToBoolean(char *str)
  909. X{
  910. X  int nboolopts = sizeof(boolopts)/sizeof(*boolopts), i;
  911. X
  912. X  for(i = 0; i < nboolopts; i++)
  913. X    if(strcmp(str, boolopts[i]) == 0)
  914. X      return _true_;
  915. X  return _false_;
  916. X}
  917. END_OF_FILE
  918.   if test 1703 -ne `wc -c <'xsokoban-3.0/resources.c'`; then
  919.     echo shar: \"'xsokoban-3.0/resources.c'\" unpacked with wrong size!
  920.   fi
  921.   # end of 'xsokoban-3.0/resources.c'
  922. fi
  923. if test -f 'xsokoban-3.0/save.c' -a "${1}" != "-c" ; then 
  924.   echo shar: Will not clobber existing file \"'xsokoban-3.0/save.c'\"
  925. else
  926.   echo shar: Extracting \"'xsokoban-3.0/save.c'\" \(4135 characters\)
  927.   sed "s/^X//" >'xsokoban-3.0/save.c' <<'END_OF_FILE'
  928. X#include "config_local.h"
  929. X
  930. X#include <stdio.h>
  931. X#include <sys/types.h>
  932. X#include <sys/stat.h>
  933. X#include <signal.h>
  934. X#include <string.h>
  935. X#include <unistd.h>
  936. X
  937. X#ifdef NEED_NETINET_IN_H
  938. X#include <netinet/in.h>
  939. X#endif
  940. X
  941. X#ifdef NEED_ENDIAN
  942. X#include <machine/endian.h>
  943. X#endif
  944. X
  945. X#include "externs.h"
  946. X#include "globals.h"
  947. X
  948. Xextern char *malloc();
  949. Xextern FILE *fopen();
  950. X
  951. Xextern char *username;
  952. Xextern char map[MAXROW + 1][MAXCOL + 1];
  953. Xextern short level, moves, pushes, packets, savepack, rows, cols;
  954. Xextern POS ppos;
  955. X
  956. Xstatic long savedbn;
  957. Xstatic char *sfname;
  958. Xstatic FILE *savefile;
  959. Xstatic struct stat sfstat;
  960. X
  961. X/* save out a game in a standard format.  Uses the ntoh functions and hton
  962. X * functions so that the same save file will work on an MSB or LSB system
  963. X * other than that, it is a standard sokoban score file.
  964. X */
  965. Xshort SaveGame(void)
  966. X{
  967. X  short ret = 0;
  968. X
  969. X  signal(SIGINT, SIG_IGN);
  970. X  sfname = malloc(strlen(SAVEPATH) + strlen(username) + 6);
  971. X  sprintf(sfname, "%s/%s.sav", SAVEPATH, username);
  972. X
  973. X  packets = htons(packets);
  974. X  pushes = htons(pushes);
  975. X  moves = htons(moves);
  976. X  level = htons(level);
  977. X  cols = htons(cols);
  978. X  savepack = htons(savepack);
  979. X  rows = htons(rows);
  980. X  ppos.x = htons(ppos.x);
  981. X  ppos.y = htons(ppos.y);
  982. X
  983. X  if ((savefile = fopen(sfname, "w")) == NULL)
  984. X    ret = E_FOPENSAVE;
  985. X  else {
  986. X    savedbn = fileno(savefile);
  987. X    if (write(savedbn, &(map[0][0]), MAXROW * MAXCOL) != MAXROW * MAXCOL)
  988. X      ret = E_WRITESAVE;
  989. X    else if (write(savedbn, &ppos, sizeof(POS)) != sizeof(POS))
  990. X      ret = E_WRITESAVE;
  991. X    else if (write(savedbn, &level, 2) != 2)
  992. X      ret = E_WRITESAVE;
  993. X    else if (write(savedbn, &moves, 2) != 2)
  994. X      ret = E_WRITESAVE;
  995. X    else if (write(savedbn, &pushes, 2) != 2)
  996. X      ret = E_WRITESAVE;
  997. X    else if (write(savedbn, &packets, 2) != 2)
  998. X      ret = E_WRITESAVE;
  999. X    else if (write(savedbn, &savepack, 2) != 2)
  1000. X      ret = E_WRITESAVE;
  1001. X    else if (write(savedbn, &rows, 2) != 2)
  1002. X      ret = E_WRITESAVE;
  1003. X    else if (write(savedbn, &cols, 2) != 2)
  1004. X      ret = E_WRITESAVE;
  1005. X    else
  1006. X      fclose(savefile);
  1007. X    if (stat(sfname, &sfstat) != 0)
  1008. X      ret = E_STATSAVE;
  1009. X    else if ((savefile = fopen(sfname, "a")) == NULL)
  1010. X      ret = E_FOPENSAVE;
  1011. X    else if (write(savedbn, &sfstat, sizeof(sfstat)) != sizeof(sfstat))
  1012. X      ret = E_WRITESAVE;
  1013. X    fclose(savefile);
  1014. X  }
  1015. X
  1016. X  ppos.x = ntohs(ppos.x);
  1017. X  ppos.y = ntohs(ppos.y);
  1018. X  pushes = ntohs(pushes);
  1019. X  moves = ntohs(moves);
  1020. X  level = ntohs(level);
  1021. X  packets = ntohs(packets);
  1022. X  cols = ntohs(cols);
  1023. X  rows = ntohs(rows);
  1024. X  savepack = ntohs(savepack);
  1025. X
  1026. X  if ((ret == E_WRITESAVE) || (ret == E_STATSAVE))
  1027. X    unlink(sfname);
  1028. X  signal(SIGINT, SIG_DFL);
  1029. X
  1030. X  return ret;
  1031. X}
  1032. X
  1033. X/* loads in a previously saved game */
  1034. Xshort RestoreGame(void)
  1035. X{
  1036. X  short ret = 0;
  1037. X  struct stat oldsfstat;
  1038. X
  1039. X  signal(SIGINT, SIG_IGN);
  1040. X  sfname = malloc(strlen(SAVEPATH) + strlen(username) + 6);
  1041. X  sprintf(sfname, "%s/%s.sav", SAVEPATH, username);
  1042. X
  1043. X  if (stat(sfname, &oldsfstat) < -1)
  1044. X    ret = E_NOSAVEFILE;
  1045. X  else {
  1046. X    if ((savefile = fopen(sfname, "r")) == NULL)
  1047. X      ret = E_FOPENSAVE;
  1048. X    else {
  1049. X      savedbn = fileno(savefile);
  1050. X      if (read(savedbn, &(map[0][0]), MAXROW * MAXCOL) != MAXROW * MAXCOL)
  1051. X    ret = E_READSAVE;
  1052. X      else if (read(savedbn, &ppos, sizeof(POS)) != sizeof(POS))
  1053. X    ret = E_READSAVE;
  1054. X      else if (read(savedbn, &level, 2) != 2)
  1055. X    ret = E_READSAVE;
  1056. X      else if (read(savedbn, &moves, 2) != 2)
  1057. X    ret = E_READSAVE;
  1058. X      else if (read(savedbn, &pushes, 2) != 2)
  1059. X    ret = E_READSAVE;
  1060. X      else if (read(savedbn, &packets, 2) != 2)
  1061. X    ret = E_READSAVE;
  1062. X      else if (read(savedbn, &savepack, 2) != 2)
  1063. X    ret = E_READSAVE;
  1064. X      else if (read(savedbn, &rows, 2) != 2)
  1065. X    ret = E_READSAVE;
  1066. X      else if (read(savedbn, &cols, 2) != 2)
  1067. X    ret = E_READSAVE;
  1068. X      else if (read(savedbn, &sfstat, sizeof(sfstat)) != sizeof(sfstat))
  1069. X    ret = E_READSAVE;
  1070. X    }
  1071. X
  1072. X    ppos.x = ntohs(ppos.x);
  1073. X    ppos.y = ntohs(ppos.y);
  1074. X    level = ntohs(level);
  1075. X    moves = ntohs(moves);
  1076. X    pushes = ntohs(pushes);
  1077. X    packets = ntohs(packets);
  1078. X    savepack = ntohs(savepack);
  1079. X    rows = ntohs(rows);
  1080. X    cols = ntohs(cols);
  1081. X
  1082. X    unlink(sfname);
  1083. X  }
  1084. X  signal(SIGINT, SIG_DFL);
  1085. X  return ret;
  1086. X}
  1087. END_OF_FILE
  1088.   if test 4135 -ne `wc -c <'xsokoban-3.0/save.c'`; then
  1089.     echo shar: \"'xsokoban-3.0/save.c'\" unpacked with wrong size!
  1090.   fi
  1091.   # end of 'xsokoban-3.0/save.c'
  1092. fi
  1093. if test -f 'xsokoban-3.0/screen.c' -a "${1}" != "-c" ; then 
  1094.   echo shar: Will not clobber existing file \"'xsokoban-3.0/screen.c'\"
  1095. else
  1096.   echo shar: Extracting \"'xsokoban-3.0/screen.c'\" \(1616 characters\)
  1097.   sed "s/^X//" >'xsokoban-3.0/screen.c' <<'END_OF_FILE'
  1098. X#include <stdio.h>
  1099. X#include <string.h>
  1100. X
  1101. X#include "externs.h"
  1102. X#include "globals.h"
  1103. X
  1104. Xextern char *malloc();
  1105. Xextern FILE *fopen();
  1106. X
  1107. Xextern short level, packets, savepack, rows, cols;
  1108. Xextern char map[MAXROW + 1][MAXCOL + 1];
  1109. Xextern POS ppos;
  1110. X
  1111. X/* Read in the current screen level, updating "ppos", "map", "savepack",
  1112. X   and "packets" appropriately. Return 0 if success, else an error code. */
  1113. Xshort ReadScreen(void)
  1114. X{
  1115. X  FILE *screen;
  1116. X  char *fnam;
  1117. X  int y, x;
  1118. X  short j, c, ret = 0;
  1119. X
  1120. X  for (y = 0; y < MAXROW; y++)
  1121. X    for (x = 0; x < MAXCOL; x++)
  1122. X      map[y][x] = ground;
  1123. X
  1124. X  fnam = malloc(strlen(SCREENPATH) + 12);
  1125. X  sprintf(fnam, "%s/screen.%d", SCREENPATH, level);
  1126. X
  1127. X  if ((screen = fopen(fnam, "r")) == NULL)
  1128. X    ret = E_FOPENSCREEN;
  1129. X  else {
  1130. X    packets = savepack = rows = j = cols = 0;
  1131. X    ppos.x = -1;
  1132. X    ppos.y = -1;
  1133. X
  1134. X    while ((ret == 0) && ((c = getc(screen)) != EOF)) {
  1135. X      if (c == '\n') {
  1136. X    map[rows++][j] = '\0';
  1137. X    if (rows > MAXROW)
  1138. X      ret = E_TOMUCHROWS;
  1139. X    else {
  1140. X      if (j > cols)
  1141. X        cols = j;
  1142. X      j = 0;
  1143. X    }
  1144. X      } else if ((c == player) || (c == playerstore)) {
  1145. X    if (ppos.x != -1)
  1146. X      ret = E_PLAYPOS1;
  1147. X    else {
  1148. X      ppos.x = rows;
  1149. X      ppos.y = j;
  1150. X      map[rows][j++] = c;
  1151. X      if (j > MAXCOL)
  1152. X        ret = E_TOMUCHCOLS;
  1153. X    }
  1154. X      } else if ((c == save) || (c == packet) ||
  1155. X         (c == wall) || (c == store) ||
  1156. X         (c == ground)) {
  1157. X    if (c == save) {
  1158. X      savepack++;
  1159. X      packets++;
  1160. X    }
  1161. X    if (c == packet)
  1162. X      packets++;
  1163. X    map[rows][j++] = c;
  1164. X    if (j > MAXCOL)
  1165. X      ret = E_TOMUCHCOLS;
  1166. X      } else
  1167. X    ret = E_ILLCHAR;
  1168. X    }
  1169. X    fclose(screen);
  1170. X    if ((ret == 0) && (ppos.x == -1))
  1171. X      ret = E_PLAYPOS2;
  1172. X  }
  1173. X  return (ret);
  1174. X}
  1175. END_OF_FILE
  1176.   if test 1616 -ne `wc -c <'xsokoban-3.0/screen.c'`; then
  1177.     echo shar: \"'xsokoban-3.0/screen.c'\" unpacked with wrong size!
  1178.   fi
  1179.   # end of 'xsokoban-3.0/screen.c'
  1180. fi
  1181. if test -f 'xsokoban-3.0/screens/screen.10' -a "${1}" != "-c" ; then 
  1182.   echo shar: Will not clobber existing file \"'xsokoban-3.0/screens/screen.10'\"
  1183. else
  1184.   echo shar: Extracting \"'xsokoban-3.0/screens/screen.10'\" \(320 characters\)
  1185.   sed "s/^X//" >'xsokoban-3.0/screens/screen.10' <<'END_OF_FILE'
  1186. X ###  #############
  1187. X##@####       #   #
  1188. X# $$   $$  $ $ ...#
  1189. X#  $$$#    $  #...#
  1190. X# $   # $$ $$ #...#
  1191. X###   #  $    #...#
  1192. X#     # $ $ $ #...#
  1193. X#    ###### ###...#
  1194. X## #  #  $ $  #...#
  1195. X#  ## # $$ $ $##..#
  1196. X# ..# #  $      #.#
  1197. X# ..# # $$$ $$$ #.#
  1198. X##### #       # #.#
  1199. X    # ######### #.#
  1200. X    #           #.#
  1201. X    ###############
  1202. END_OF_FILE
  1203.   if test 320 -ne `wc -c <'xsokoban-3.0/screens/screen.10'`; then
  1204.     echo shar: \"'xsokoban-3.0/screens/screen.10'\" unpacked with wrong size!
  1205.   fi
  1206.   # end of 'xsokoban-3.0/screens/screen.10'
  1207. fi
  1208. if test -f 'xsokoban-3.0/screens/screen.14' -a "${1}" != "-c" ; then 
  1209.   echo shar: Will not clobber existing file \"'xsokoban-3.0/screens/screen.14'\"
  1210. else
  1211.   echo shar: Extracting \"'xsokoban-3.0/screens/screen.14'\" \(284 characters\)
  1212.   sed "s/^X//" >'xsokoban-3.0/screens/screen.14' <<'END_OF_FILE'
  1213. X       #######
  1214. X #######     #
  1215. X #     # $@$ #
  1216. X #$$ #   #########
  1217. X # ###......##   #
  1218. X #   $......## # #
  1219. X # ###......     #
  1220. X##   #### ### #$##
  1221. X#  #$   #  $  # #
  1222. X#  $ $$$  # $## #
  1223. X#   $ $ ###$$ # #
  1224. X#####     $   # #
  1225. X    ### ###   # #
  1226. X      #     #   #
  1227. X      ########  #
  1228. X             ####
  1229. END_OF_FILE
  1230.   if test 284 -ne `wc -c <'xsokoban-3.0/screens/screen.14'`; then
  1231.     echo shar: \"'xsokoban-3.0/screens/screen.14'\" unpacked with wrong size!
  1232.   fi
  1233.   # end of 'xsokoban-3.0/screens/screen.14'
  1234. fi
  1235. if test -f 'xsokoban-3.0/screens/screen.20' -a "${1}" != "-c" ; then 
  1236.   echo shar: Will not clobber existing file \"'xsokoban-3.0/screens/screen.20'\"
  1237. else
  1238.   echo shar: Extracting \"'xsokoban-3.0/screens/screen.20'\" \(303 characters\)
  1239.   sed "s/^X//" >'xsokoban-3.0/screens/screen.20' <<'END_OF_FILE'
  1240. X    ##########
  1241. X#####        ####
  1242. X#     #   $  #@ #
  1243. X# #######$####  ###
  1244. X# #    ## #  #$ ..#
  1245. X# # $     #  #  #.#
  1246. X# # $  #     #$ ..#
  1247. X# #  ### ##     #.#
  1248. X# ###  #  #  #$ ..#
  1249. X# #    #  ####  #.#
  1250. X# #$   $  $  #$ ..#
  1251. X#    $ # $ $ #  #.#
  1252. X#### $###    #$ ..#
  1253. X   #    $$ ###....#
  1254. X   #      ## ######
  1255. X   ########
  1256. END_OF_FILE
  1257.   if test 303 -ne `wc -c <'xsokoban-3.0/screens/screen.20'`; then
  1258.     echo shar: \"'xsokoban-3.0/screens/screen.20'\" unpacked with wrong size!
  1259.   fi
  1260.   # end of 'xsokoban-3.0/screens/screen.20'
  1261. fi
  1262. if test -f 'xsokoban-3.0/screens/screen.22' -a "${1}" != "-c" ; then 
  1263.   echo shar: Will not clobber existing file \"'xsokoban-3.0/screens/screen.22'\"
  1264. else
  1265.   echo shar: Extracting \"'xsokoban-3.0/screens/screen.22'\" \(311 characters\)
  1266.   sed "s/^X//" >'xsokoban-3.0/screens/screen.22' <<'END_OF_FILE'
  1267. X######     ####
  1268. X#    #######  #####
  1269. X#   $#  #  $  #   #
  1270. X#  $  $  $ # $ $  #
  1271. X##$ $   # @# $    #
  1272. X#  $ ########### ##
  1273. X# #   #.......# $#
  1274. X# ##  # ......#  #
  1275. X# #   $........$ #
  1276. X# # $ #.... ..#  #
  1277. X#  $ $####$#### $#
  1278. X# $   ### $   $  ##
  1279. X# $     $ $  $    #
  1280. X## ###### $ ##### #
  1281. X#         #       #
  1282. X###################
  1283. END_OF_FILE
  1284.   if test 311 -ne `wc -c <'xsokoban-3.0/screens/screen.22'`; then
  1285.     echo shar: \"'xsokoban-3.0/screens/screen.22'\" unpacked with wrong size!
  1286.   fi
  1287.   # end of 'xsokoban-3.0/screens/screen.22'
  1288. fi
  1289. if test -f 'xsokoban-3.0/screens/screen.24' -a "${1}" != "-c" ; then 
  1290.   echo shar: Will not clobber existing file \"'xsokoban-3.0/screens/screen.24'\"
  1291. else
  1292.   echo shar: Extracting \"'xsokoban-3.0/screens/screen.24'\" \(306 characters\)
  1293.   sed "s/^X//" >'xsokoban-3.0/screens/screen.24' <<'END_OF_FILE'
  1294. X###############
  1295. X#..........  .####
  1296. X#..........$$.#  #
  1297. X###########$ #   ##
  1298. X#      $  $     $ #
  1299. X## ####   #  $ #  #
  1300. X#      #   ##  # ##
  1301. X#  $#  # ##  ### ##
  1302. X# $ #$###    ### ##
  1303. X###  $ #  #  ### ##
  1304. X###    $ ## #  # ##
  1305. X # $  #  $  $ $   #
  1306. X #  $  $#$$$  #   #
  1307. X #  #  $      #####
  1308. X # @##  #  #  #
  1309. X ##############
  1310. END_OF_FILE
  1311.   if test 306 -ne `wc -c <'xsokoban-3.0/screens/screen.24'`; then
  1312.     echo shar: \"'xsokoban-3.0/screens/screen.24'\" unpacked with wrong size!
  1313.   fi
  1314.   # end of 'xsokoban-3.0/screens/screen.24'
  1315. fi
  1316. if test -f 'xsokoban-3.0/screens/screen.25' -a "${1}" != "-c" ; then 
  1317.   echo shar: Will not clobber existing file \"'xsokoban-3.0/screens/screen.25'\"
  1318. else
  1319.   echo shar: Extracting \"'xsokoban-3.0/screens/screen.25'\" \(295 characters\)
  1320.   sed "s/^X//" >'xsokoban-3.0/screens/screen.25' <<'END_OF_FILE'
  1321. X####
  1322. X#  ##############
  1323. X#  #   ..#......#
  1324. X#  # # ##### ...#
  1325. X##$#    ........#
  1326. X#   ##$######  ####
  1327. X# $ #     ######@ #
  1328. X##$ # $   ######  #
  1329. X#  $ #$$$##       #
  1330. X#      #    #$#$###
  1331. X# #### #$$$$$    #
  1332. X# #    $     #   #
  1333. X# #   ##        ###
  1334. X# ######$###### $ #
  1335. X#        #    #   #
  1336. X##########    #####
  1337. END_OF_FILE
  1338.   if test 295 -ne `wc -c <'xsokoban-3.0/screens/screen.25'`; then
  1339.     echo shar: \"'xsokoban-3.0/screens/screen.25'\" unpacked with wrong size!
  1340.   fi
  1341.   # end of 'xsokoban-3.0/screens/screen.25'
  1342. fi
  1343. if test -f 'xsokoban-3.0/screens/screen.35' -a "${1}" != "-c" ; then 
  1344.   echo shar: Will not clobber existing file \"'xsokoban-3.0/screens/screen.35'\"
  1345. else
  1346.   echo shar: Extracting \"'xsokoban-3.0/screens/screen.35'\" \(298 characters\)
  1347.   sed "s/^X//" >'xsokoban-3.0/screens/screen.35' <<'END_OF_FILE'
  1348. X############ ######
  1349. X#   #    # ###....#
  1350. X#   $$#   @  .....#
  1351. X#   # ###   # ....#
  1352. X## ## ###  #  ....#
  1353. X # $ $     # # ####
  1354. X #  $ $##  #      #
  1355. X#### #  #### # ## #
  1356. X#  # #$   ## #    #
  1357. X# $  $  # ## #   ##
  1358. X# # $ $    # #   #
  1359. X#  $ ## ## # #####
  1360. X# $$     $$  #
  1361. X## ## ### $  #
  1362. X #    # #    #
  1363. X ###### ######
  1364. END_OF_FILE
  1365.   if test 298 -ne `wc -c <'xsokoban-3.0/screens/screen.35'`; then
  1366.     echo shar: \"'xsokoban-3.0/screens/screen.35'\" unpacked with wrong size!
  1367.   fi
  1368.   # end of 'xsokoban-3.0/screens/screen.35'
  1369. fi
  1370. if test -f 'xsokoban-3.0/screens/screen.36' -a "${1}" != "-c" ; then 
  1371.   echo shar: Will not clobber existing file \"'xsokoban-3.0/screens/screen.36'\"
  1372. else
  1373.   echo shar: Extracting \"'xsokoban-3.0/screens/screen.36'\" \(289 characters\)
  1374.   sed "s/^X//" >'xsokoban-3.0/screens/screen.36' <<'END_OF_FILE'
  1375. X            #####
  1376. X#####  ######   #
  1377. X#   ####  $ $ $ #
  1378. X# $   ## ## ##  ##
  1379. X#   $ $     $  $ #
  1380. X### $  ## ##     ##
  1381. X  # ##### #####$$ #
  1382. X ##$##### @##     #
  1383. X # $  ###$### $  ##
  1384. X # $  #   ###  ###
  1385. X # $$ $ #   $$ #
  1386. X #     #   ##  #
  1387. X #######.. .###
  1388. X    #.........#
  1389. X    #.........#
  1390. X    ###########
  1391. END_OF_FILE
  1392.   if test 289 -ne `wc -c <'xsokoban-3.0/screens/screen.36'`; then
  1393.     echo shar: \"'xsokoban-3.0/screens/screen.36'\" unpacked with wrong size!
  1394.   fi
  1395.   # end of 'xsokoban-3.0/screens/screen.36'
  1396. fi
  1397. if test -f 'xsokoban-3.0/screens/screen.39' -a "${1}" != "-c" ; then 
  1398.   echo shar: Will not clobber existing file \"'xsokoban-3.0/screens/screen.39'\"
  1399. else
  1400.   echo shar: Extracting \"'xsokoban-3.0/screens/screen.39'\" \(291 characters\)
  1401.   sed "s/^X//" >'xsokoban-3.0/screens/screen.39' <<'END_OF_FILE'
  1402. X             ######
  1403. X #############....#
  1404. X##   ##     ##....#
  1405. X#  $$##  $ @##....#
  1406. X#      $$ $#  ....#
  1407. X#  $ ## $$ # # ...#
  1408. X#  $ ## $  #  ....#
  1409. X## ##### ### ##.###
  1410. X##   $  $ ##   .  #
  1411. X# $###  # ##### ###
  1412. X#   $   #       #
  1413. X#  $ #$ $ $###  #
  1414. X# $$$# $   # ####
  1415. X#    #  $$ #
  1416. X######   ###
  1417. X     #####
  1418. END_OF_FILE
  1419.   if test 291 -ne `wc -c <'xsokoban-3.0/screens/screen.39'`; then
  1420.     echo shar: \"'xsokoban-3.0/screens/screen.39'\" unpacked with wrong size!
  1421.   fi
  1422.   # end of 'xsokoban-3.0/screens/screen.39'
  1423. fi
  1424. if test -f 'xsokoban-3.0/screens/screen.41' -a "${1}" != "-c" ; then 
  1425.   echo shar: Will not clobber existing file \"'xsokoban-3.0/screens/screen.41'\"
  1426. else
  1427.   echo shar: Extracting \"'xsokoban-3.0/screens/screen.41'\" \(286 characters\)
  1428.   sed "s/^X//" >'xsokoban-3.0/screens/screen.41' <<'END_OF_FILE'
  1429. X           #####
  1430. X          ##   ##
  1431. X         ##     #
  1432. X        ##  $$  #
  1433. X       ## $$  $ #
  1434. X       # $    $ #
  1435. X####   #   $$ #####
  1436. X#  ######## ##    #
  1437. X#.            $$$@#
  1438. X#.# ####### ##   ##
  1439. X#.# #######. #$ $##
  1440. X#........... #    #
  1441. X##############  $ #
  1442. X             ##  ##
  1443. X              ####
  1444. END_OF_FILE
  1445.   if test 286 -ne `wc -c <'xsokoban-3.0/screens/screen.41'`; then
  1446.     echo shar: \"'xsokoban-3.0/screens/screen.41'\" unpacked with wrong size!
  1447.   fi
  1448.   # end of 'xsokoban-3.0/screens/screen.41'
  1449. fi
  1450. if test -f 'xsokoban-3.0/screens/screen.50' -a "${1}" != "-c" ; then 
  1451.   echo shar: Will not clobber existing file \"'xsokoban-3.0/screens/screen.50'\"
  1452. else
  1453.   echo shar: Extracting \"'xsokoban-3.0/screens/screen.50'\" \(307 characters\)
  1454.   sed "s/^X//" >'xsokoban-3.0/screens/screen.50' <<'END_OF_FILE'
  1455. X      ############
  1456. X     ##..    #   #
  1457. X    ##..* $    $ #
  1458. X   ##..*.# # # $##
  1459. X   #..*.# # # $  #
  1460. X####...#  #    # #
  1461. X#  ## #          #
  1462. X# @$ $ ###  #   ##
  1463. X# $   $   # #   #
  1464. X###$$   # # # # #
  1465. X  #   $   # # #####
  1466. X  # $# #####      #
  1467. X  #$   #   #    # #
  1468. X  #  ###   ##     #
  1469. X  #  #      #    ##
  1470. X  ####      ######
  1471. END_OF_FILE
  1472.   if test 307 -ne `wc -c <'xsokoban-3.0/screens/screen.50'`; then
  1473.     echo shar: \"'xsokoban-3.0/screens/screen.50'\" unpacked with wrong size!
  1474.   fi
  1475.   # end of 'xsokoban-3.0/screens/screen.50'
  1476. fi
  1477. if test -f 'xsokoban-3.0/screens/screen.85' -a "${1}" != "-c" ; then 
  1478.   echo shar: Will not clobber existing file \"'xsokoban-3.0/screens/screen.85'\"
  1479. else
  1480.   echo shar: Extracting \"'xsokoban-3.0/screens/screen.85'\" \(312 characters\)
  1481.   sed "s/^X//" >'xsokoban-3.0/screens/screen.85' <<'END_OF_FILE'
  1482. X############
  1483. X#      #   ##
  1484. X# $  $   #  ######
  1485. X####  #####      #
  1486. X #..  #     #### #
  1487. X #.####  ####    #
  1488. X #....    #  $ ####
  1489. X # ...#   # $$$#  ##
  1490. X###.#### ##  $@$   #
  1491. X#     ##### $ #    #
  1492. X# #.# $      $###$ #
  1493. X# #.########  #  $ #
  1494. X# #..        ##  $ #
  1495. X# # ####### $ # #  #
  1496. X#   #     #       ##
  1497. X#####     ##########
  1498. END_OF_FILE
  1499.   if test 312 -ne `wc -c <'xsokoban-3.0/screens/screen.85'`; then
  1500.     echo shar: \"'xsokoban-3.0/screens/screen.85'\" unpacked with wrong size!
  1501.   fi
  1502.   # end of 'xsokoban-3.0/screens/screen.85'
  1503. fi
  1504. if test -f 'xsokoban-3.0/screens/screen.89' -a "${1}" != "-c" ; then 
  1505.   echo shar: Will not clobber existing file \"'xsokoban-3.0/screens/screen.89'\"
  1506. else
  1507.   echo shar: Extracting \"'xsokoban-3.0/screens/screen.89'\" \(326 characters\)
  1508.   sed "s/^X//" >'xsokoban-3.0/screens/screen.89' <<'END_OF_FILE'
  1509. X ##################
  1510. X #   $       ...#.##
  1511. X #       ####..... #
  1512. X # #######  #..... #
  1513. X # #    $ $ ##....##
  1514. X # #  $ # # ###...#
  1515. X # # $@$ $  ##### #
  1516. X## #  $  $ $$   $ #
  1517. X#  #$# $#   # $## #
  1518. X# ##    ## ## $ # #
  1519. X# # $# $ $  #     #
  1520. X# #         #######
  1521. X# ########$##   #
  1522. X#        #  $   #
  1523. X########    #####
  1524. X       ###  #
  1525. X         ####
  1526. END_OF_FILE
  1527.   if test 326 -ne `wc -c <'xsokoban-3.0/screens/screen.89'`; then
  1528.     echo shar: \"'xsokoban-3.0/screens/screen.89'\" unpacked with wrong size!
  1529.   fi
  1530.   # end of 'xsokoban-3.0/screens/screen.89'
  1531. fi
  1532. if test -f 'xsokoban-3.0/screens/screen.90' -a "${1}" != "-c" ; then 
  1533.   echo shar: Will not clobber existing file \"'xsokoban-3.0/screens/screen.90'\"
  1534. else
  1535.   echo shar: Extracting \"'xsokoban-3.0/screens/screen.90'\" \(337 characters\)
  1536.   sed "s/^X//" >'xsokoban-3.0/screens/screen.90' <<'END_OF_FILE'
  1537. X####################
  1538. X#..#    #          #
  1539. X#.$  $  #$$  $## $##
  1540. X#.$#  ###  ## ##   #
  1541. X#  # $ #  $$   $   #
  1542. X# ###  # #  #$  ####
  1543. X#  ## # $   #@ #   #
  1544. X# $    $  ##.##  $ #
  1545. X#  # $# $# $     ###
  1546. X#  #  #  #   ###   #
  1547. X#  ######## #      #
  1548. X#           #  #.#.#
  1549. X##$########$#   ...#
  1550. X#    .*  #    ##.#.#
  1551. X# .*...*   $  .....#
  1552. X####################
  1553. X
  1554. END_OF_FILE
  1555.   if test 337 -ne `wc -c <'xsokoban-3.0/screens/screen.90'`; then
  1556.     echo shar: \"'xsokoban-3.0/screens/screen.90'\" unpacked with wrong size!
  1557.   fi
  1558.   # end of 'xsokoban-3.0/screens/screen.90'
  1559. fi
  1560. if test -f 'xsokoban-3.0/xsokoban.man' -a "${1}" != "-c" ; then 
  1561.   echo shar: Will not clobber existing file \"'xsokoban-3.0/xsokoban.man'\"
  1562. else
  1563.   echo shar: Extracting \"'xsokoban-3.0/xsokoban.man'\" \(5471 characters\)
  1564.   sed "s/^X//" >'xsokoban-3.0/xsokoban.man' <<'END_OF_FILE'
  1565. X.TH XSOKOBAN 6 "2 November 1993" "MIT Lab for Computer Science"
  1566. X.SH NAME
  1567. Xxsokoban \- Pushing objects around...
  1568. X.SH SYNOPSIS
  1569. X.B xsokoban 
  1570. X[ 
  1571. X.B \-s
  1572. X.B \-r
  1573. X.B \-c
  1574. X.B \-nn
  1575. X.B \-display
  1576. X<disp>
  1577. X.B {\-w | \-walls}
  1578. X.B {\-rv | \-reverse}
  1579. X.B {\-f | \-font}
  1580. X<fn>
  1581. X.B {\-b | \-bitdir}
  1582. X<path>
  1583. X.B {\-fg | \-foregound}
  1584. X<color>
  1585. X.B {\-bg | \-backgound}
  1586. X<color>
  1587. X.B {\-bd | \-border}
  1588. X<color>
  1589. X.B {\-pr | \-pointer}
  1590. X<color>
  1591. X.B \-xrm
  1592. X<arg> ] 
  1593. X.SH DESCRIPTION
  1594. XThe goal of 
  1595. X.I xsokoban
  1596. Xis to push all the round objects into the score area of each level
  1597. Xusing the mouse or the arrow keys. The arrow keys move the player in
  1598. Xthe corresponding direction, pushing an object if it is in the way and
  1599. Xthere is a clear space on the other side. The mouse buttons each have a
  1600. Xdistinct function.
  1601. X
  1602. XIf the left mouse button is pressed on a clear square, the player will
  1603. Xmove to that location via the optimal path if such a path exists;
  1604. Xotherwise, the game will beep.
  1605. X
  1606. XIf the middle button is pressed on an object that is adjacent to the
  1607. Xplayer, the object will be pushed one step.  If the middle mouse button
  1608. Xis pressed on an empty space, the player will move the closest object
  1609. Xthat is on a straight line with the destination, such that the object
  1610. Xcan be pushed in that direction, and the player is not directly between
  1611. Xthe destination and the object.  Before pushing the object, the player
  1612. Xis moved optimally to start the push.
  1613. X
  1614. XThe right button mouse undoes the last user action, and may be used any
  1615. Xnumber of times.
  1616. X
  1617. X.PP
  1618. XThe rest of the functions are bound to the keyboard:
  1619. X.TP 8
  1620. X.B ?
  1621. XDisplay a help screen.
  1622. X.TP 8
  1623. X.B q
  1624. XQuit the game.
  1625. X.TP 8
  1626. X.B s
  1627. XSave and quit.
  1628. X.TP 8
  1629. X.B u
  1630. XUndo the last action. Same as right mouse button.
  1631. X.TP 8
  1632. X.B U
  1633. XRestart a level.
  1634. X.TP 8
  1635. X.B ^R
  1636. XRedraw the screen.
  1637. X.TP 8
  1638. X.B h,j,k,l
  1639. XAct just like the arrow keys, as in
  1640. X.IR vi (1).
  1641. X.SH OPTIONS
  1642. X.TP 8
  1643. X.B \-s
  1644. XShow the scores
  1645. X.TP 8
  1646. X.B \-c 
  1647. XCreate a new score file (can be ran only by the owner of the game).
  1648. X.TP 8
  1649. X.B \-r
  1650. XRestore a saved game.
  1651. X.TP 8
  1652. X.B \-nn
  1653. XStart at level 
  1654. X.I nn, 
  1655. Xprovided that levels below it are completed. 
  1656. X.TP 8
  1657. X.B \-display <display>
  1658. XRun the game on named display.
  1659. X.TP 8
  1660. X.B {\-w | \-walls}
  1661. XUse fancy walls. (This is the default unless an option bitmap set is used)
  1662. X.TP 8
  1663. X.B {\-rv | \-reverse}
  1664. XUse reverse video.
  1665. X.TP 8
  1666. X.B {\-f | \-font} <fontname>
  1667. XUse the named font instead of the default 9x15 font.
  1668. X.TP 8
  1669. X.B {\-b | \-bitdir} <path>
  1670. XUse the bitmaps found in <path> instead of the defaults.
  1671. X.TP 8
  1672. X.B {\-fg | \-foreground} <color>
  1673. XUse the named color as the foreground color. (default is BlackPixel())
  1674. X.TP 8
  1675. X.B {\-bg | \-background} <color>
  1676. XUse the named color as the background color. (default is WhitePixel())
  1677. X.TP 8
  1678. X.B {\-bd | \-border} <color>
  1679. XUse the named color as the border color. (default is foreground color)
  1680. X.TP 8
  1681. X.B {\-pr | \-pointer} <color>
  1682. XUse the named color as the mouse pointer foreground. (default is foreground)
  1683. X.TP 8
  1684. X.B \-xrm <arg>
  1685. X<arg> is an X Resource specification.
  1686. X.SH AUTHORS
  1687. XUnknown Hacker - Original curses(1) implementation.
  1688. X.br
  1689. XJoseph L. Traub - X windows interface.
  1690. X.br
  1691. XKevin Solie - simultaneously developed X implementation (merged in).
  1692. X.br
  1693. XMark Linderman, Christos Zoulas - Mouse code (added to Solie's version).
  1694. X.br
  1695. XAndrew Myers - Improved mouse UI and score ranking
  1696. X.SH RESOURCES
  1697. X.I Xsokoban
  1698. Xunderstands the following resources.
  1699. X.TP 8
  1700. X.B fancyWalls : boolean
  1701. XUse fancy walls.
  1702. X.TP 8
  1703. X.B fontName : font
  1704. XUse named font.
  1705. X.TP 8
  1706. X.B reverseVideo : boolean
  1707. XReverse foreground and background pixels.
  1708. X.TP 8
  1709. X.B foreground : color
  1710. XUse color as foreground color.
  1711. X.TP 8
  1712. X.B background : color
  1713. XUse color as background color.
  1714. X.TP 8
  1715. X.B borderColor : color
  1716. XUse color as border color.
  1717. X.TP 8
  1718. X.B pointerColor : color
  1719. XUse color as pointer color.
  1720. X.TP 8
  1721. X.B bitmapDir : string
  1722. XLook for bitmaps in path specified by string.
  1723. X.TP 8
  1724. X.SH SPECIAL BITMAPS
  1725. XIn order to define your own bitmaps for
  1726. X.I xsokoban
  1727. Xyou only need to know the names of which files it is looking for.
  1728. XThe standard bitmap files are:
  1729. X.TP 8
  1730. X.B man.xbm
  1731. X-- The player bitmap.
  1732. X.TP 8
  1733. X.B goal.xbm
  1734. X-- The goal area bitmap.
  1735. X.TP 8
  1736. X.B wall.xbm
  1737. X-- The standard wall bitmap.
  1738. X.TP 8
  1739. X.B object.xbm
  1740. X-- The object that gets pushed.
  1741. X.TP 8
  1742. X.B treasure.xbm
  1743. X-- The bitmap for the object when it is on the goal.
  1744. X.TP 8
  1745. X.B saveman.xbm
  1746. X-- The bitmap for the player when it is on the goal.
  1747. X.TP 8
  1748. XTo use the fancy walls option, you need the following additional files.
  1749. X.TP 8
  1750. X.B lonewall.xbm
  1751. X-- a wall with connections on no sides.
  1752. X.TP 8
  1753. X.B southwall.xbm
  1754. X-- a wall with only northern connections
  1755. X.TP 8
  1756. X.B northwall.xbm
  1757. X-- a wall with only southern connections
  1758. X.TP 8
  1759. X.B eastwall.xbm
  1760. X-- a wall with only western connections
  1761. X.TP 8
  1762. X.B westwall.xbm
  1763. X-- a wall with only eastern connections
  1764. X.TP 8
  1765. X.B llcornerwall.xbm
  1766. X-- a wall with northern and eastern connections
  1767. X.TP 8
  1768. X.B ulcornerwall.xbm
  1769. X-- a wall with southern and eastern connections
  1770. X.TP 8
  1771. X.B lrcornerwall.xbm
  1772. X-- a wall with northern and western connections
  1773. X.TP 8
  1774. X.B urcornerwall.xbm
  1775. X-- a wall with southern and western connections
  1776. X.TP 8
  1777. X.B north_twall.xbm
  1778. X-- a wall with connections on all BUT northern side
  1779. X.TP 8
  1780. X.B south_twall.xbm
  1781. X-- a wall with connections on all BUT southern side
  1782. X.TP 8
  1783. X.B east_twall.xbm
  1784. X-- a wall with connections on all BUT eastern side
  1785. X.TP 8
  1786. X.B west_twall.xbm
  1787. X-- a wall with connections on all BUT western side
  1788. X.TP 8
  1789. X.B centerwall.xbm
  1790. X-- A wall will connections on all four sides.
  1791. X.SH BUGS
  1792. XAuto bitmap resizing code doesn't take into account text displays.
  1793. X.br
  1794. XFeedback on user error is poor (only beeps).
  1795. END_OF_FILE
  1796.   if test 5471 -ne `wc -c <'xsokoban-3.0/xsokoban.man'`; then
  1797.     echo shar: \"'xsokoban-3.0/xsokoban.man'\" unpacked with wrong size!
  1798.   fi
  1799.   # end of 'xsokoban-3.0/xsokoban.man'
  1800. fi
  1801. echo shar: End of archive 2 \(of 4\).
  1802. cp /dev/null ark2isdone
  1803. MISSING=""
  1804. for I in 1 2 3 4 ; do
  1805.     if test ! -f ark${I}isdone ; then
  1806.     MISSING="${MISSING} ${I}"
  1807.     fi
  1808. done
  1809. if test "${MISSING}" = "" ; then
  1810.     echo You have unpacked all 4 archives.
  1811.     rm -f ark[1-9]isdone
  1812. else
  1813.     echo You still must unpack the following archives:
  1814.     echo "        " ${MISSING}
  1815. fi
  1816. exit 0
  1817. exit 0 # Just in case...
  1818. -- 
  1819.   // chris@Sterling.COM           | Send comp.sources.x submissions to:
  1820. \X/  Amiga: The only way to fly!  |    sources-x@sterling.com
  1821.        "It's intuitively obvious to the most casual observer..."
  1822.  GCS d++(--) -p+ c++ !l u++ e+ m+(-) s++/++ n h--- f+ g+++ w+ t++ r+ y+
  1823.