1 #ifndef _bh_binsw_h_
2 #define _bh_binsw_h_ 1
3 
4 #include "3dc.h"
5 #include "track.h"
6 
7 #ifdef __cplusplus
8 
9 	extern "C" {
10 
11 #endif
12 
13 
14 extern void* BinarySwitchBehaveInit(void* bhdata, STRATEGYBLOCK* sbptr);
15 extern void BinarySwitchBehaveFun(STRATEGYBLOCK* sbptr);
16 
17 extern int BinarySwitchGetSynchData(STRATEGYBLOCK* sbptr);
18 extern void BinarySwitchSetSynchData(STRATEGYBLOCK* sbptr,int status);
19 
20 /******************** BinarySwitch ***********************/
21 
22 // enum to decxribe how the switch works
23 // action is always dependent on the SB block of the target
24 
25 typedef enum binary_switch_mode
26 {
27 	I_bswitch_timer,
28 	I_bswitch_wait,
29 	I_bswitch_toggle,
30 	I_bswitch_moving,
31 	I_bswitch_time_delay,
32 	I_bswitch_time_delay_autoexec,//timer starts as soon as game starts
33 
34 } BSWITCH_MODE;
35 
36 typedef enum binary_switch_req_states
37 {
38 	I_no_request,
39 	I_request_on,
40 	I_request_off,
41 }BINARY_SWITCH_REQUEST_STATE;
42 
43 typedef enum bswitch_display_types
44 {
45 	binswitch_no_display,
46 	binswitch_animate_me,
47 	binswitch_move_me,
48 	binswitch_animate_and_move_me,
49 } BSWITCH_DISPLAY_TYPES;
50 
51 typedef enum bs_move_dir
52 {
53 	bs_start_to_end,
54 	bs_end_to_start,
55 } BS_MOVE_DIR;
56 
57 // require three states for rest fso we can ignore
58 
59 
60 #define SwitchFlag_UseTriggerVolume 0x00000001 //switch triggered by walking into trigger volume
61 
62 typedef struct binary_switch
63 {
64 	AVP_BEHAVIOUR_TYPE bhvr_type;
65 	BINARY_SWITCH_REQUEST_STATE request;
66 	BOOL state;
67 	BSWITCH_MODE bs_mode;
68 
69 	int num_targets;
70 	SBNAMEBLOCK * target_names;
71 	int * request_messages;
72 
73 	STRATEGYBLOCK ** bs_targets;
74 
75 
76 	int time_for_reset;	// constant
77 	int timer;
78 
79 	// stuff for showing how the switch displays its state
80 
81 	BSWITCH_DISPLAY_TYPES bs_dtype;
82 
83 	TXACTRLBLK *bs_tac; // animations
84 
85 
86 	TRACK_CONTROLLER* bs_track;
87 	// or positions
88 
89 
90 	BSWITCH_MODE mode_store;
91 
92 	BOOL new_state;
93 	int new_request;
94 
95 	int security_clerance; // what the plyer has to be to use this switch
96 
97 	int switch_flags;
98 	VECTORCH trigger_volume_min;//for switches that can be set off by walking
99 	VECTORCH trigger_volume_max;//into a given area
100 
101   int soundHandle;
102 
103 	BOOL triggered_last;
104 
105 	unsigned int switch_off_message_same:1;
106 	unsigned int switch_off_message_none:1;
107 
108 	int TimeUntilNetSynchAllowed;
109 
110 
111 }BINARY_SWITCH_BEHAV_BLOCK;
112 
113 typedef struct bin_switch_tools_template
114 {
115 	VECTORCH position;
116 	EULER orientation;
117 
118 	int mode;
119 	int time_for_reset;
120 	int security_clearance;
121 
122 	int num_targets;
123 	SBNAMEBLOCK * target_names;
124 	int* request_messages;
125 
126 	int shape_num;
127 
128 	char nameID[SB_NAME_LENGTH];
129 
130 	TRACK_CONTROLLER* track;
131 
132 	int switch_flags;
133 	VECTORCH trigger_volume_min;//for switches that can be set off by walking
134 	VECTORCH trigger_volume_max;//into a given area
135 
136 	unsigned int starts_on:1;
137 	unsigned int switch_off_message_same:1;
138 	unsigned int switch_off_message_none:1;
139 
140 
141 } BIN_SWITCH_TOOLS_TEMPLATE;
142 
143 
144 
145 #ifdef __cplusplus
146 
147 	};
148 
149 #endif
150 
151 
152 #endif
153