WALL.H 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282
  1. /*
  2. THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
  3. SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO
  4. END-USERS, AND SUBJECT TO ALL OF THE TERMS AND CONDITIONS HEREIN, GRANTS A
  5. ROYALTY-FREE, PERPETUAL LICENSE TO SUCH END-USERS FOR USE BY SUCH END-USERS
  6. IN USING, DISPLAYING, AND CREATING DERIVATIVE WORKS THEREOF, SO LONG AS
  7. SUCH USE, DISPLAY OR CREATION IS FOR NON-COMMERCIAL, ROYALTY OR REVENUE
  8. FREE PURPOSES. IN NO EVENT SHALL THE END-USER USE THE COMPUTER CODE
  9. CONTAINED HEREIN FOR REVENUE-BEARING PURPOSES. THE END-USER UNDERSTANDS
  10. AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE.
  11. COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
  12. */
  13. /*
  14. * $Source: f:/miner/source/main/rcs/wall.h $
  15. * $Revision: 2.0 $
  16. * $Author: john $
  17. * $Date: 1995/02/27 11:31:36 $
  18. *
  19. * $Log: wall.h $
  20. * Revision 2.0 1995/02/27 11:31:36 john
  21. * New version 2.0, which has no anonymous unions, builds with
  22. * Watcom 10.0, and doesn't require parsing BITMAPS.TBL.
  23. *
  24. * Revision 1.47 1994/11/19 15:20:35 mike
  25. * rip out unused code and data
  26. *
  27. * Revision 1.46 1994/10/25 15:40:12 yuan
  28. * MAX_WALLS pumped up
  29. *
  30. * Revision 1.45 1994/10/23 19:17:07 matt
  31. * Fixed bug with "no key" messages
  32. *
  33. * Revision 1.44 1994/10/18 15:38:03 mike
  34. * Define hidden walls.
  35. *
  36. * Revision 1.43 1994/10/04 13:32:26 adam
  37. * commented out MAX_DOOR_ANIMS
  38. *
  39. * Revision 1.42 1994/10/04 13:31:21 adam
  40. * upped MAX_WALL_ANIMS to 30
  41. *
  42. * Revision 1.41 1994/09/29 00:42:30 matt
  43. * Made hitting a locked door play a sound
  44. *
  45. * Revision 1.40 1994/09/27 15:42:41 mike
  46. * Prototype Wall_names.
  47. *
  48. * Revision 1.39 1994/09/23 22:15:32 matt
  49. * Made doors not close on objects, made doors open again if shot while
  50. * closing, and cleaned up walls/doors a bit.
  51. *
  52. * Revision 1.38 1994/09/22 15:31:33 matt
  53. * Mucked with, and hopefully improved, exploding walls
  54. *
  55. * Revision 1.37 1994/09/21 17:17:05 mike
  56. * Make objects stuck in doors go away when door opens.
  57. *
  58. * Revision 1.36 1994/09/13 21:10:46 matt
  59. * Added wclips that use tmap1 instead of tmap2, saving lots of merging
  60. *
  61. * Revision 1.35 1994/09/13 20:11:08 yuan
  62. * *** empty log message ***
  63. *
  64. * Revision 1.34 1994/09/10 13:31:53 matt
  65. * Made exploding walls a type of blastable walls.
  66. * Cleaned up blastable walls, making them tmap2 bitmaps.
  67. *
  68. * Revision 1.33 1994/08/17 12:55:34 matt
  69. * Added external walls to wall_is_doorway
  70. *
  71. * Revision 1.32 1994/08/15 17:54:35 john
  72. * *** empty log message ***
  73. *
  74. * Revision 1.31 1994/08/15 17:46:56 yuan
  75. * Added external walls, fixed blastable walls.
  76. *
  77. * Revision 1.30 1994/08/05 21:17:21 matt
  78. * Allow two doors to be linked together
  79. *
  80. * Revision 1.29 1994/08/01 10:39:10 matt
  81. * Parenthesized parms to WID() macro
  82. *
  83. * Revision 1.28 1994/07/20 17:35:03 yuan
  84. * Some minor bug fixes and new key gauges...
  85. *
  86. * Revision 1.27 1994/07/19 14:32:03 yuan
  87. * Fixed keys bug... renumbered some constants.
  88. *
  89. * Revision 1.26 1994/07/14 22:38:29 matt
  90. * Added exploding doors
  91. *
  92. * Revision 1.25 1994/07/11 15:08:43 yuan
  93. * Wall anim file names stored in structure.
  94. *
  95. */
  96. #ifndef _WALL_H
  97. #define _WALL_H
  98. #include "inferno.h"
  99. #include "segment.h"
  100. #include "object.h"
  101. //#include "vclip.h"
  102. #define MAX_WALLS 175 // Maximum number of walls
  103. #define MAX_WALL_ANIMS 30 // Maximum different types of doors
  104. #define MAX_DOORS 50 // Maximum number of open doors
  105. // not used -> #define MAX_DOOR_ANIMS 20 // Maximum different types of doors
  106. // Various wall types.
  107. #define WALL_NORMAL 0 // Normal wall
  108. #define WALL_BLASTABLE 1 // Removable (by shooting) wall
  109. #define WALL_DOOR 2 // Door
  110. #define WALL_ILLUSION 3 // Wall that appears to be there, but you can fly thru
  111. #define WALL_OPEN 4 // Just an open side. (Trigger)
  112. #define WALL_CLOSED 5 // Wall. Used for transparent walls.
  113. // Various wall flags.
  114. #define WALL_BLASTED 1 // Blasted out wall.
  115. #define WALL_DOOR_OPENED 2 // Open door.
  116. #define WALL_DOOR_LOCKED 8 // Door is locked.
  117. #define WALL_DOOR_AUTO 16 // Door automatically closes after time.
  118. #define WALL_ILLUSION_OFF 32 // Illusionary wall is shut off.
  119. // Wall states
  120. #define WALL_DOOR_CLOSED 0 // Door is closed
  121. #define WALL_DOOR_OPENING 1 // Door is opening.
  122. #define WALL_DOOR_WAITING 2 // Waiting to close
  123. #define WALL_DOOR_CLOSING 3 // Door is closing
  124. //note: a door is considered opened (i.e., it has WALL_OPENED set) when it
  125. //is more than half way open. Thus, it can have any of OPENING, CLOSING,
  126. //or WAITING bits set when OPENED is set.
  127. #define KEY_NONE 1
  128. #define KEY_BLUE 2
  129. #define KEY_RED 4
  130. #define KEY_GOLD 8
  131. #define WALL_HPS 100*F1_0 // Normal wall's hp
  132. #define WALL_DOOR_INTERVAL 5*F1_0 // How many seconds a door is open
  133. #define DOOR_OPEN_TIME i2f(2) // How long takes to open
  134. #define DOOR_WAIT_TIME i2f(5) // How long before auto door closes
  135. #define MAX_CLIP_FRAMES 20
  136. // WALL_IS_DOORWAY flags.
  137. #define WID_FLY_FLAG 1
  138. #define WID_RENDER_FLAG 2
  139. #define WID_RENDPAST_FLAG 4
  140. #define WID_EXTERNAL_FLAG 8
  141. // WALL_IS_DOORWAY return values F/R/RP
  142. #define WID_WALL 2 // 0/1/0 wall
  143. #define WID_TRANSPARENT_WALL 6 // 0/1/1 transparent wall
  144. #define WID_ILLUSORY_WALL 3 // 1/1/0 illusory wall
  145. #define WID_TRANSILLUSORY_WALL 7 // 1/1/1 transparent illusory wall
  146. #define WID_NO_WALL 5 // 1/0/1 no wall, can fly through
  147. #define WID_EXTERNAL 8 // 0/0/0/1 don't see it, dont fly through it
  148. #define MAX_STUCK_OBJECTS 32
  149. typedef struct stuckobj {
  150. short objnum, wallnum;
  151. int signature;
  152. } stuckobj;
  153. typedef struct wall {
  154. int segnum,sidenum; // Seg & side for this wall
  155. fix hps; // "Hit points" of the wall.
  156. int linked_wall; // number of linked wall
  157. ubyte type; // What kind of special wall.
  158. ubyte flags; // Flags for the wall.
  159. ubyte state; // Opening, closing, etc.
  160. byte trigger; // Which trigger is associated with the wall.
  161. byte clip_num; // Which animation associated with the wall.
  162. ubyte keys; // which keys are required
  163. short pad; // keep longword aligned
  164. } wall;
  165. typedef struct active_door {
  166. int n_parts; // for linked walls
  167. short front_wallnum[2]; // front wall numbers for this door
  168. short back_wallnum[2]; // back wall numbers for this door
  169. fix time; // how long been opening, closing, waiting
  170. } active_door;
  171. //wall clip flags
  172. #define WCF_EXPLODES 1 //door explodes when opening
  173. #define WCF_BLASTABLE 2 //this is a blastable wall
  174. #define WCF_TMAP1 4 //this uses primary tmap, not tmap2
  175. #define WCF_HIDDEN 8 //this uses primary tmap, not tmap2
  176. typedef struct {
  177. fix play_time;
  178. short num_frames;
  179. short frames[MAX_CLIP_FRAMES];
  180. short open_sound;
  181. short close_sound;
  182. short flags;
  183. char filename[13];
  184. char pad;
  185. } wclip;
  186. extern char Wall_names[7][10];
  187. //#define WALL_IS_DOORWAY(seg,side) wall_is_doorway(seg, side)
  188. #define WALL_IS_DOORWAY(seg,side) (((seg)->children[(side)] == -1) ? WID_WALL : ((seg)->children[(side)] == -2) ? WID_EXTERNAL_FLAG : ((seg)->sides[(side)].wall_num == -1) ? WID_NO_WALL : wall_is_doorway((seg), (side)))
  189. extern wall Walls[MAX_WALLS]; // Master walls array
  190. extern int Num_walls; // Number of walls
  191. extern active_door ActiveDoors[MAX_DOORS]; // Master doors array
  192. extern int Num_open_doors; // Number of open doors
  193. extern wclip WallAnims[MAX_WALL_ANIMS];
  194. extern int Num_wall_anims;
  195. extern int walls_bm_num[MAX_WALL_ANIMS];
  196. // Initializes all walls (i.e. no special walls.)
  197. extern void wall_init();
  198. // Automatically checks if a there is a doorway (i.e. can fly through)
  199. extern int wall_is_doorway ( segment *seg, int side );
  200. // Deteriorate appearance of wall. (Changes bitmap (paste-ons))
  201. extern void wall_damage(segment *seg, int side, fix damage);
  202. // Destroys a blastable wall. (So it is an opening afterwards)
  203. extern void wall_destroy(segment *seg, int side);
  204. void wall_illusion_on(segment *seg, int side);
  205. void wall_illusion_off(segment *seg, int side);
  206. // Opens a door, including animation and other processing.
  207. void do_door_open(int door_num);
  208. // Closes a door, including animation and other processing.
  209. void do_door_close(int door_num);
  210. // Opens a door
  211. extern void wall_open_door(segment *seg, int side);
  212. // Closes a door (called after given interval)
  213. extern void wall_close_door(int wall_num);
  214. //return codes for wall_hit_process()
  215. #define WHP_NOT_SPECIAL 0 //wasn't a quote-wall-unquote
  216. #define WHP_NO_KEY 1 //hit door, but didn't have key
  217. #define WHP_BLASTABLE 2 //hit blastable wall
  218. #define WHP_DOOR 3 //a door (which will now be opening)
  219. // Determines what happens when a wall is shot
  220. //obj is the object that hit...either a weapon or the player himself
  221. extern int wall_hit_process(segment *seg, int side, fix damage, int playernum, object *obj );
  222. // Opens/destroys specified door.
  223. extern void wall_toggle(segment *seg, int side);
  224. // Tidy up Walls array for load/save purposes.
  225. extern void reset_walls();
  226. // Called once per frame..
  227. void wall_frame_process();
  228. extern stuckobj Stuck_objects[MAX_STUCK_OBJECTS];
  229. // An object got stuck in a door (like a flare).
  230. // Add global entry.
  231. extern void add_stuck_object(object *objp, int segnum, int sidenum);
  232. extern void remove_obsolete_stuck_objects(void);
  233. //set the tmap_num or tmap_num2 field for a wall/door
  234. extern void wall_set_tmap_num(segment *seg,int side,segment *csegp,int cside,int anim_num,int frame_num);
  235. #endif