home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / x / volume14 / xpipeman / part03 / xpipeman.h < prev   
Encoding:
C/C++ Source or Header  |  1991-10-10  |  4.5 KB  |  192 lines

  1. /*
  2.  * xpipeman.h  - Xpipeman
  3.  *
  4.  * Send Constructive comments, bug reports, etc. to either
  5.  *
  6.  *          JANET: pavern@uk.ac.man.cs
  7.  *
  8.  *  or      INER : pavern%cs.man.ac.uk@nsfnet-relay.ac.uk
  9.  *
  10.  * All other comments > /dev/null !!
  11.  * 
  12.  * 
  13.  * Copyright 1991 Nigel Paver
  14.  * 
  15.  * Permission to use, copy, modify, distribute, and sell this software and its
  16.  * documentation for any purpose is hereby granted without fee, provided that
  17.  * the above copyright notice appear in all copies and that both that
  18.  * copyright notice and this permission notice appear in supporting
  19.  * documentation, and that the author's name not be used in advertising or
  20.  * publicity pertaining to distribution of the software without specific,
  21.  * written prior permission.  The author makes no representations about the
  22.  * suitability of this software for any purpose.  It is provided "as is"
  23.  * without express or implied warranty.
  24.  * 
  25.  * THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING 
  26.  * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL THE 
  27.  * AUTHOR BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY 
  28.  * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN 
  29.  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 
  30.  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  31.  * 
  32.  */
  33.  
  34. /* 
  35.  * from main.c
  36.  */
  37. extern Display     *display;
  38. extern Window     playfield;
  39. extern Widget     playfield_widget;
  40. extern GC     gc,
  41.         cleargc;
  42. extern Pixel     fg, 
  43.         bg;
  44.  
  45. extern void     update_score();
  46. extern void     update_level();
  47. extern void     update_bonus();
  48. extern void     update_remain();
  49.  
  50. /*
  51.  * from graphics.c
  52.  */
  53.  
  54. /* defines the order of the blocks in the pixmap array */
  55.  
  56. #define NUMBLOCKS 8     /* number of empty blocks */
  57. #define TOTALBLOCKS (ONEWAY+6)   /* including one way blocks */
  58. #define NoBlksDefined BAR+1
  59. #define EMPTY     0
  60. #define ONEWAY NUMBLOCKS
  61. #define HFULL TOTALBLOCKS
  62. #define VFULL (HFULL+1)
  63. #define FILLBLKSTART (VFULL+1)
  64. #define OBSRT   (FILLBLKSTART+50)
  65. #define OBSFIN  (OBSRT+6)
  66. #define SHOWFLOW (OBSFIN +1)
  67. #define START    (SHOWFLOW +4)
  68. #define STARTFULL (START+1)
  69. #define ARROW  (STARTFULL +1)
  70. #define BAR    (ARROW +1)
  71. #define NUM_TMP_CURSOR_PIXMAPS (BAR+5)
  72.  
  73.  
  74. extern XtEventHandler redisplay_level();
  75.  
  76. extern void     init_pixmaps(), 
  77.                 display_allpixmaps(),
  78.         display_level(), 
  79.         free_pixmaps(), 
  80.         show_movement(),
  81.                 redraw_block(),
  82.                 redisplay_sequence();
  83.  
  84.  
  85. #define CELLSIZE 40
  86.  
  87. #define pos_to_coord( _pos_ ) (( _pos_ ) * CELLSIZE + 5)
  88. #define coord_to_pos( _pos_ ) ((( _pos_ ) - 5) / CELLSIZE)
  89.  
  90. /*
  91.  * from actions.c
  92.  */
  93.  
  94.  
  95. extern XtActionProc    do_nothing_action(),
  96.             move_action(),
  97.                         move_here_action(),
  98.                         fast_flow_action(),
  99.                         place_action();
  100.  
  101. extern XtEventHandler     pointer_moved();
  102.  
  103.  
  104. /*
  105.  * from score.c
  106.  */
  107.  
  108. #ifndef SCORE_FILE
  109. #  define SCORE_FILE "/usr/games/lib/xpipescores"
  110. #endif
  111.  
  112. #ifndef MAXSCORES
  113. #  define MAXSCORES 20
  114. #endif
  115.  
  116. extern void     check_score(), 
  117.         create_high_score_popup();
  118.  
  119. extern void    show_scores_callback();
  120.  
  121. extern char *score_filename;
  122.  
  123. /*
  124.  * from game.c
  125.  */
  126.  
  127. #     define     MAXX 15
  128. #      define     MAXY 10
  129.  
  130.  
  131. #define FASTFLOW 100
  132.  
  133. #define LEFT    1
  134. #define RIGHT   2
  135. #define UP      4
  136. #define DOWN    8
  137. #define STILL   16
  138.  
  139. #define for_each    for(x=0;x<MAXX;x++) \
  140.               for(y=0;y<MAXY;y++)
  141.  
  142. /* I know, I KNOW... global variables! */
  143.  
  144. extern XtIntervalId current_callback;
  145.  
  146. extern int     block_x, block_y,
  147.                last_block_x, last_block_y;
  148.  
  149. extern int    pipe_board[MAXX][MAXY];
  150.  
  151. extern int      buttons_disabled; /*stops button events during level change*/
  152.  
  153. extern int     score,
  154.         game_active;
  155.  
  156. #define MIN(a,b) ((a<b)?a:b)
  157. #define MAX(a,b) ((a>b)?a:b)
  158.  
  159. #define INXRANGE( _x_ )  (((_x_) >=0) && ((_x_)<(MAXX-3)))
  160. #define INYRANGE( _y_ )  (((_y_) >=0) && ((_y_)<MAXY))
  161.  
  162. extern void     new_game(), 
  163.         add_score(), 
  164.         new_level(),
  165.                 increment_sequence(),
  166.                 reset_block_origin(),
  167.                 remove_block(),
  168.                 speed_up_flow(),
  169.                 draw_flow(),
  170.                 increment_flow(),
  171.                 block_replace();
  172. extern int      can_go(),
  173.                 can_place(),
  174.                 place_block();
  175. extern int      current_block;
  176.  
  177. /*
  178.    From info.c
  179. */
  180. extern void  show_info(),
  181.              create_info_popup();
  182.  
  183. /*
  184.    From popup.c
  185. */
  186.  
  187. extern void  show_level_over_popup(),
  188.              show_game_over_popup(),
  189.          level_over_popdown(),
  190.          game_over_popdown(),
  191.          create_general_popups();
  192.