1 /* 2 3 Copyright (C) 2015-2018 Night Dive Studios, LLC. 4 5 This program is free software: you can redistribute it and/or modify 6 it under the terms of the GNU General Public License as published by 7 the Free Software Foundation, either version 3 of the License, or 8 (at your option) any later version. 9 10 This program is distributed in the hope that it will be useful, 11 but WITHOUT ANY WARRANTY; without even the implied warranty of 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 GNU General Public License for more details. 14 15 You should have received a copy of the GNU General Public License 16 along with this program. If not, see <http://www.gnu.org/licenses/>. 17 18 */ 19 #ifndef __TRIGGER_H 20 #define __TRIGGER_H 21 22 /* 23 * $Source: r:/prj/cit/src/inc/RCS/trigger.h $ 24 * $Revision: 1.28 $ 25 * $Author: xemu $ 26 * $Date: 1994/11/21 06:19:41 $ 27 * 28 * 29 */ 30 31 // Includes 32 #include "objects.h" 33 34 // Defines 35 #define ENTRY_TRIGGER_TYPE 0 36 #define NULL_TRIGGER_TYPE 1 37 #define FLOOR_TRIGGER_TYPE 2 38 #define PLAYER_DEATH_TRIGGER_TYPE 3 39 #define DEATHWATCH_TRIGGER_TYPE 4 40 #define AREA_ENTRY_TRIGGER_TYPE 5 41 #define AREA_CONTINUOUS_TRIGGER_TYPE 6 42 43 // Typedefs 44 typedef struct { 45 ushort timestamp; 46 ushort type; 47 ObjID target_id; 48 ObjID source_id; 49 } TrapSchedEvent; 50 51 #define HEIGHT_STEP_TIME 3 52 #define HEIGHT_TIME_UNIT 10 53 54 #define NUM_HEIGHT_SEMAPHORS 32 55 #define MAX_HSEM_KEY 63 56 57 typedef struct { 58 ushort timestamp; 59 ushort type; 60 char semaphor; 61 char key; 62 char steps_remaining; 63 char sfx_code; 64 } HeightSchedEvent; 65 66 // sfx_codes -- 67 // 0x1 for no terrain sound 68 69 typedef struct { 70 uchar x; 71 uchar y; 72 union { 73 struct { 74 uchar floor : 1; 75 uchar key : 7; 76 }; 77 uchar floor_key; 78 }; 79 char inuse; 80 } height_semaphor; 81 82 typedef struct _EmailSchedEvent { 83 ushort timestamp; 84 ushort type; 85 short datamunge; 86 short pad; // must be at least as big as a SchedEvent 87 } EmailSchedEvent; 88 89 // Prototypes 90 91 // Somewhere in the city, an object has been destroyed. Was it a 92 // destroy trigger? YOU be the judge. 93 errtype trigger_check_destroyed(ObjID id); 94 95 // Trap/Trigger identified by id might have been set off -- player 96 // just entered it's square. Deal appropriately. 97 errtype location_trigger_activate(ObjID id); 98 99 // Trap/Trigger identified by id should actually go off. 100 // return value is whether or not the trap beneath the trigger 101 // actually went off. use_message is a pointer to a boolean 102 // to set if the trap utilizes the message line. 103 uchar trap_activate(ObjID id, uchar *use_message); 104 105 #define is_trap(id) (objs[(id)].class == CLASS_TRAP) 106 107 // Use these functions to directly access trap-like functions 108 errtype trap_teleport_func(int targ_x, int targ_y, int targ_z, int targlevel); 109 errtype trap_scheduler_func(int p1, int p2, int p3, int p4); 110 errtype trap_lighting_func(uchar floor, int p1, int p2, int p3, int p4); 111 errtype trap_damage_func(int p1, int p2, int p3, int p4); 112 errtype trap_create_obj_func(int p1, int p2, int p3, int p4); 113 errtype trap_questbit_func(int p1, int p2, int p3, int p4); 114 errtype trap_cutscene_func(int p1, int p2, int p3, int p4); 115 errtype trap_terrain_func(int p1, int p2, int p3, int p4); 116 errtype trap_sfx_func(int p1, int p2, int p3, int p4); 117 118 errtype check_deathwatch_triggers(ObjID id, uchar really_dead); 119 errtype check_entrance_triggers(uchar old_x, uchar old_y, uchar new_x, uchar new_y); 120 121 errtype do_multi_stuff(ObjID id); 122 123 // Globals 124 125 extern char *trapname_strings[]; 126 127 #endif // __TRIGGER_H 128