home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1992 March / Source_Code_CD-ROM_Walnut_Creek_March_1992.iso / usenet / altsrcs / 1 / 1996 / ski.h < prev    next >
C/C++ Source or Header  |  1990-12-28  |  5KB  |  242 lines

  1. /*                                  S K I !
  2. **
  3. **                       Version 6.0 of October 14, 1990
  4. **
  5. **           Copyright 1983-1990 by Mark Stevans for Roy's Games, Inc.
  6. */
  7.  
  8. /*
  9. ** Utility macros.
  10. */
  11.  
  12. #define EOS    '\0'
  13. #define NIL(X)    ((X) NULL)
  14.  
  15. #define PUBLIC
  16. #define PRIVATE        static
  17.  
  18. #define SUCCESS        0
  19. #define FAILURE        -1
  20.  
  21. #define NO_POSITION    -1
  22. #define PROB(X)        (((RANDOM_GENERATE() % 10000) / 100.0) <= (X))
  23. #define ABS(X)        (((X) >= 0) ? (X) : - (X))
  24. #define EXISTS(X)    ((X) >= 0)
  25.  
  26. /*
  27. ** The representations used for each object.
  28. */
  29.  
  30. #define REP_SNOW    '.'
  31. #define REP_TREE    'Y'
  32. #define REP_PLAYER    'I'
  33. #define REP_GROUND    ' '
  34. #define REP_ICE        '#'
  35. #define REP_SNOMAN    'A'
  36. #define REP_ICBM    '*'
  37. #define REP_DEMON    'D'
  38.  
  39. /*
  40. ** "LINE_LEN" defines the length of a screen line.
  41. */
  42.  
  43. #define LINE_LEN                70
  44.  
  45. /*
  46. ** "MIN_SNOMAN_APPEARANCE_DISTANCE" is the minimum distance from the player
  47. ** at which a new Snoman may appear.
  48. */
  49.  
  50. #define MIN_SNOMAN_APPEARANCE_DISTANCE        3
  51.  
  52. /*
  53. ** "LEVEL_MULTIPLIER" is a constant multiplied into the first element of the
  54. ** cellular growth automaton probability array with each passing level.
  55. */
  56.  
  57. #define LEVEL_MULTIPLIER            1.01
  58.  
  59. /*
  60. ** "MAX_HORIZONTAL_PLAYER_SPEED" defines the absolute value of the maximum
  61. ** horizontal player speed.
  62. */
  63.  
  64. #define MAX_HORIZONTAL_PLAYER_SPEED            5
  65.  
  66. /*
  67. ** "PROB_SKIS_MELT_SNOMAN" is the probability that the player's jet-powered
  68. ** skis will melt the Snoman during each turn in which the player is jumping
  69. ** over the Snoman.
  70. */
  71.  
  72. #define PROB_SKIS_MELT_SNOMAN            20.0
  73.  
  74. /*
  75. ** "PROB_SPONTANEOUS_MELT" is the probability that the Snoman melts
  76. ** spontaneously during any given turn.
  77. */
  78.  
  79. #define PROB_SPONTANEOUS_MELT            1.0
  80.  
  81. /*
  82. ** "ICBM_SPEED" is the horizontal speed of an ICBM.
  83. */
  84.  
  85. #define ICBM_SPEED        3
  86.  
  87. /*
  88. ** "ICBM_RANGE" is the horizontal Snoman lethality range of the ICBM.
  89. */
  90.  
  91. #define ICBM_RANGE        2
  92.  
  93. /*
  94. ** "DEMON_RANGE" is the horizontal Snoman lethality range of the demon.
  95. */
  96.  
  97. #define DEMON_RANGE        1
  98.  
  99. /*
  100. ** "ICBM_SPEED" is the maximum horizontal speed of an ICBM.
  101. */
  102.  
  103. #define DEMON_SPEED        1
  104.  
  105. /*
  106. ** "PROB_BAD_SPELL" is the probability that the "Incant Fire Demon" spell will
  107. ** be bad during each incantation.
  108. */
  109.  
  110. #define PROB_BAD_SPELL        10.0
  111.  
  112. /*
  113. ** "PROB_BAD_TELEPORT" is the probability that the teleportation device will
  114. ** fail to safely teleport the player during each application.
  115. */
  116.  
  117. #define PROB_BAD_TELEPORT    10.0
  118.  
  119. /*
  120. ** "PROB_BAD_ICBM" is the probability that a nuclear ICBM will detonate in
  121. ** the player's backpack during each launch.
  122. */
  123.  
  124. #define PROB_BAD_ICBM        30.0
  125.  
  126. /*
  127. ** "PROB_SLIP_ON_ICE" is the probability that the player will slip on the ice
  128. ** and fall down for each turn during which the player is skiiing on ice.
  129. */
  130.  
  131. #define PROB_SLIP_ON_ICE    2.0
  132.  
  133. /*
  134. ** "PROB_FALL_ON_GROUND" is the probability that the player will fall down
  135. ** for each turn during which the player is skiiing on bare ground.
  136. */
  137.  
  138. #define PROB_FALL_ON_GROUND    10.0
  139.  
  140. /*
  141. ** "PROB_HIT_TREE" is the probability that the player will hit a tree in
  142. ** each turn during which the player is skiiing past a tree.
  143. */
  144.  
  145. #define PROB_HIT_TREE        25.0
  146.  
  147. /*
  148. ** "PROB_BAD_LANDING" is the probability that the player will land badly and
  149. ** fall down during a landing from a jump or hop.
  150. */
  151.  
  152. #define PROB_BAD_LANDING    3.0
  153.  
  154. /*
  155. ** "POINTS_PER_JUMP" is the number of points awarded to the player for the
  156. ** successful completion of one jump.  For scoring purposes, a hop is
  157. ** considered to consist of exactly one half-jump.
  158. */
  159.  
  160. #define POINTS_PER_JUMP            20.0
  161.  
  162. /*
  163. ** "POINTS_PER_METER" is the number of points awarded to the player for each
  164. ** meter of horizontal or vertical motion during each turn.
  165. */
  166.  
  167. #define POINTS_PER_METER        1.0
  168.  
  169. /*
  170. ** "POINTS_PER_MELTED_SNOMAN" is the number of points awarded to the player
  171. ** for each Snoman that melts during the course of the game, irregardless of
  172. ** whether the player passively caused the Snoman to melt by luring him from a
  173. ** Snobank, or actively melted the Snoman using his skis, an ICBM, or with
  174. ** the assistance of the Fire Demon.
  175. */
  176.  
  177. #define POINTS_PER_MELTED_SNOMAN    100.0
  178.  
  179. /*
  180. ** "POINTS_PER_INJURY_DEGREE"
  181. */
  182.  
  183. #define POINTS_PER_INJURY_DEGREE    -40.0
  184.  
  185. /*
  186. ** The injury categories.
  187. */
  188.  
  189. #define SLIGHT_INJURY        0
  190. #define MODERATE_INJURY        3
  191. #define SEVERE_INJURY        6
  192.  
  193. /*
  194. ** The randomness of injury degrees.
  195. */
  196.  
  197. #define INJURY_RANDOMNESS    6
  198.  
  199. /*
  200. ** "LEVEL" describes a playing level.
  201. */
  202.  
  203. typedef struct {
  204.     short meters_travelled;
  205.     short jump_count;
  206.     short level_num;
  207.     short num_snomen_melted;
  208.     float num_jumps_attempted;
  209.     short player_pos;
  210.     short snoman_pos;
  211.     short icbm_pos;
  212.     short demon_pos;
  213.     short player_speed;
  214.     char slope[LINE_LEN + 1];
  215. } LEVEL;
  216.  
  217. /*
  218. ** Declarations of common library functions.
  219. */
  220.  
  221. extern long time();
  222.  
  223. /*
  224. ** Random number generator definitions
  225. */
  226.  
  227. #ifdef USE_RAND
  228.  
  229. extern int rand();
  230.  
  231. #define RANDOM_INITIALIZE    srand
  232. #define RANDOM_GENERATE        rand
  233.  
  234. #else
  235.  
  236. extern long random();
  237.  
  238. #define RANDOM_INITIALIZE    srandom
  239. #define RANDOM_GENERATE        random
  240.  
  241. #endif
  242.