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-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
23 #define MAX_WALLS 254 // Maximum number of walls
24 #define MAX_WALL_ANIMS 60 // Maximum different types of doors
25 #define MAX_DOORS 90 // Maximum number of open doors
27 // Various wall types.
28 #define WALL_NORMAL 0 // Normal wall
29 #define WALL_BLASTABLE 1 // Removable (by shooting) wall
30 #define WALL_DOOR 2 // Door
31 #define WALL_ILLUSION 3 // Wall that appears to be there, but you can fly thru
32 #define WALL_OPEN 4 // Just an open side. (Trigger)
33 #define WALL_CLOSED 5 // Wall. Used for transparent walls.
34 #define WALL_OVERLAY 6 // Goes over an actual solid side. For triggers
35 #define WALL_CLOAKED 7 // Can see it, and see through it
37 // Various wall flags.
38 #define WALL_BLASTED 1 // Blasted out wall.
39 #define WALL_DOOR_OPENED 2 // Open door.
40 #define WALL_DOOR_LOCKED 8 // Door is locked.
41 #define WALL_DOOR_AUTO 16 // Door automatically closes after time.
42 #define WALL_ILLUSION_OFF 32 // Illusionary wall is shut off.
43 #define WALL_WALL_SWITCH 64 // This wall is openable by a wall switch.
44 #define WALL_BUDDY_PROOF 128 // Buddy assumes he cannot get through this wall.
47 #define WALL_DOOR_CLOSED 0 // Door is closed
48 #define WALL_DOOR_OPENING 1 // Door is opening.
49 #define WALL_DOOR_WAITING 2 // Waiting to close
50 #define WALL_DOOR_CLOSING 3 // Door is closing
51 #define WALL_DOOR_OPEN 4 // Door is open, and staying open
52 #define WALL_DOOR_CLOAKING 5 // Wall is going from closed -> open
53 #define WALL_DOOR_DECLOAKING 6 // Wall is going from open -> closed
55 //note: a door is considered opened (i.e., it has WALL_OPENED set) when it
56 //is more than half way open. Thus, it can have any of OPENING, CLOSING,
57 //or WAITING bits set when OPENED is set.
64 #define WALL_HPS 100*F1_0 // Normal wall's hp
65 #define WALL_DOOR_INTERVAL 5*F1_0 // How many seconds a door is open
67 #define DOOR_OPEN_TIME i2f(2) // How long takes to open
68 #define DOOR_WAIT_TIME i2f(5) // How long before auto door closes
70 #define MAX_CLIP_FRAMES 50
72 // WALL_IS_DOORWAY flags.
73 #define WID_FLY_FLAG 1
74 #define WID_RENDER_FLAG 2
75 #define WID_RENDPAST_FLAG 4
76 #define WID_EXTERNAL_FLAG 8
77 #define WID_CLOAKED_FLAG 16
79 //@@// WALL_IS_DOORWAY return values F/R/RP
80 //@@#define WID_WALL 2 // 0/1/0 wall
81 //@@#define WID_TRANSPARENT_WALL 6 // 0/1/1 transparent wall
82 //@@#define WID_ILLUSORY_WALL 3 // 1/1/0 illusory wall
83 //@@#define WID_TRANSILLUSORY_WALL 7 // 1/1/1 transparent illusory wall
84 //@@#define WID_NO_WALL 5 // 1/0/1 no wall, can fly through
85 //@@#define WID_EXTERNAL 8 // 0/0/0/1 don't see it, dont fly through it
87 #define MAX_STUCK_OBJECTS 32
89 typedef struct stuckobj {
90 short objnum, wallnum;
95 int segnum,sidenum; // Seg & side for this wall
96 fix hps; // "Hit points" of the wall.
97 int linked_wall; // number of linked wall
98 ubyte type; // What kind of special wall.
99 ubyte flags; // Flags for the wall.
100 ubyte state; // Opening, closing, etc.
101 byte trigger; // Which trigger is associated with the wall.
102 byte clip_num; // Which animation associated with the wall.
103 ubyte keys; // which keys are required
104 byte controlling_trigger; // which trigger causes something to happen here. Not like "trigger" above, which is the trigger on this wall.
105 // Note: This gets stuffed at load time in gamemine.c. Don't try to use it in the editor. You will be sorry!
106 byte cloak_value; // if this wall is cloaked, the fade value
109 typedef struct active_door {
110 int n_parts; // for linked walls
111 short front_wallnum[2]; // front wall numbers for this door
112 short back_wallnum[2]; // back wall numbers for this door
113 fix time; // how long been opening, closing, waiting
114 } __pack__ active_door;
116 typedef struct cloaking_wall {
117 short front_wallnum; // front wall numbers for this door
118 short back_wallnum; // back wall numbers for this door
119 fix front_ls[4]; // front wall saved light values
120 fix back_ls[4]; // back wall saved light values
121 fix time; // how long been cloaking or decloaking
122 } __pack__ cloaking_wall;
125 #define WCF_EXPLODES 1 //door explodes when opening
126 #define WCF_BLASTABLE 2 //this is a blastable wall
127 #define WCF_TMAP1 4 //this uses primary tmap, not tmap2
128 #define WCF_HIDDEN 8 //this uses primary tmap, not tmap2
133 short frames[MAX_CLIP_FRAMES];
141 extern char Wall_names[7][10];
143 //#define WALL_IS_DOORWAY(seg,side) wall_is_doorway(seg, side)
145 #define WALL_IS_DOORWAY(seg,side) (((seg)->children[(side)] == -1) ? WID_RENDER_FLAG : ((seg)->children[(side)] == -2) ? WID_EXTERNAL_FLAG : ((seg)->sides[(side)].wall_num == -1) ? (WID_FLY_FLAG|WID_RENDPAST_FLAG) : wall_is_doorway((seg), (side)))
147 extern wall Walls[MAX_WALLS]; // Master walls array
148 extern int Num_walls; // Number of walls
150 extern active_door ActiveDoors[MAX_DOORS]; // Master doors array
151 extern int Num_open_doors; // Number of open doors
153 extern cloaking_wall CloakingWalls[];
154 extern int Num_cloaking_walls;
156 extern wclip WallAnims[MAX_WALL_ANIMS];
157 extern int Num_wall_anims;
159 extern int walls_bm_num[MAX_WALL_ANIMS];
161 // Initializes all walls (i.e. no special walls.)
162 extern void wall_init();
164 // Automatically checks if a there is a doorway (i.e. can fly through)
165 extern int wall_is_doorway ( segment *seg, int side );
167 // Deteriorate appearance of wall. (Changes bitmap (paste-ons))
168 extern void wall_damage(segment *seg, int side, fix damage);
170 // Destroys a blastable wall. (So it is an opening afterwards)
171 extern void wall_destroy(segment *seg, int side);
173 void wall_illusion_on(segment *seg, int side);
175 void wall_illusion_off(segment *seg, int side);
177 // Opens a door, including animation and other processing.
178 void do_door_open(int door_num);
180 // Closes a door, including animation and other processing.
181 void do_door_close(int door_num);
184 extern void wall_open_door(segment *seg, int side);
187 extern void wall_close_door(segment *seg, int side);
189 //return codes for wall_hit_process()
190 #define WHP_NOT_SPECIAL 0 //wasn't a quote-wall-unquote
191 #define WHP_NO_KEY 1 //hit door, but didn't have key
192 #define WHP_BLASTABLE 2 //hit blastable wall
193 #define WHP_DOOR 3 //a door (which will now be opening)
195 // Determines what happens when a wall is shot
196 //obj is the object that hit...either a weapon or the player himself
197 extern int wall_hit_process(segment *seg, int side, fix damage, int playernum, object *obj );
199 // Opens/destroys specified door.
200 extern void wall_toggle(segment *seg, int side);
202 // Tidy up Walls array for load/save purposes.
203 extern void reset_walls();
205 // Called once per frame..
206 void wall_frame_process();
208 extern stuckobj Stuck_objects[MAX_STUCK_OBJECTS];
210 // An object got stuck in a door (like a flare).
212 extern void add_stuck_object(object *objp, int segnum, int sidenum);
213 extern void remove_obsolete_stuck_objects(void);
215 //set the tmap_num or tmap_num2 field for a wall/door
216 extern void wall_set_tmap_num(segment *seg,int side,segment *csegp,int cside,int anim_num,int frame_num);
218 // Remove any flares from a wall
219 void kill_stuck_objects(int wallnum);
221 //start wall open <-> closed transitions
222 void start_wall_cloak(segment *seg, int side);
223 void start_wall_decloak(segment *seg, int side);