]> icculus.org git repositories - btb/d2x.git/blob - main/switch.h
fix debian menu
[btb/d2x.git] / main / switch.h
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-1999 PARALLAX SOFTWARE CORPORATION.  ALL RIGHTS RESERVED.
12 */
13
14 #ifndef _SWITCH_H
15 #define _SWITCH_H
16
17 #include "inferno.h"
18 #include "segment.h"
19
20 #define MAX_TRIGGERS                            100
21 #define MAX_WALLS_PER_LINK              10
22
23 // Trigger types
24
25 #define TT_OPEN_DOOR                            0               // Open a door
26 #define TT_CLOSE_DOOR                   1               // Close a door
27 #define TT_MATCEN                                       2               // Activate a matcen
28 #define TT_EXIT                                 3               // End the level
29 #define TT_SECRET_EXIT                  4               // Go to secret level
30 #define TT_ILLUSION_OFF                 5               // Turn an illusion off
31 #define TT_ILLUSION_ON                  6               // Turn an illusion on
32 #define TT_UNLOCK_DOOR                  7               // Unlock a door
33 #define TT_LOCK_DOOR                            8               // Lock a door
34 #define TT_OPEN_WALL                            9               // Makes a wall open
35 #define TT_CLOSE_WALL                   10              //      Makes a wall closed
36 #define TT_ILLUSORY_WALL                11              // Makes a wall illusory
37 #define TT_LIGHT_OFF                            12              // Turn a light off
38 #define TT_LIGHT_ON                             13              // Turn s light on
39 #define NUM_TRIGGER_TYPES               14
40
41 // Trigger flags          
42
43 //could also use flags for one-shots
44
45 #define TF_NO_MESSAGE                   1               // Don't show a message when triggered
46 #define TF_ONE_SHOT                             2               // Only trigger once
47 #define TF_DISABLED                             4               // Set after one-shot fires
48
49
50 //the trigger really should have both a type & a flags, since most of the
51 //flags bits are exclusive of the others.
52 typedef struct trigger {
53         ubyte           type;                   //what this trigger does 
54         ubyte           flags;          //currently unused
55         byte            num_links;      //how many doors, etc. linked to this
56         byte            pad;                    //keep alignment
57         fix             value;
58         fix             time;
59         short   seg[MAX_WALLS_PER_LINK];
60         short           side[MAX_WALLS_PER_LINK];
61         } __pack__ trigger;
62
63 extern trigger Triggers[MAX_TRIGGERS];
64
65 extern int Num_triggers;
66
67 extern void trigger_init();
68 extern void check_trigger(segment *seg, short side, short objnum,int shot);
69 extern int check_trigger_sub(int trigger_num, int player_num,int shot);
70 extern void triggers_frame_process();
71
72 #endif