MCPcopy Create free account
hub / github.com/DescentDevelopers/Descent3 / AddTrigger

Function AddTrigger

Descent3/trigger.cpp:294–326  ·  view source on GitHub ↗

Create a new trigger Parameters: roomnum,facenum - where the trigger is flags - flags for this trigger activator - activator mask script - handle for the script for this trigger Returns: trigger number of new trigger, or -1 if error

Source from the content-addressed store, hash-verified

292// script - handle for the script for this trigger
293// Returns: trigger number of new trigger, or -1 if error
294int AddTrigger(char *name, int roomnum, int facenum, int activator, const char *script) {
295 room *rp = &Rooms[roomnum];
296 face *fp = &rp->faces[facenum];
297 trigger *tp;
298
299 if (Num_triggers >= MAX_TRIGGERS)
300 return -1;
301
302 if (strlen(name) > TRIG_NAME_LEN) {
303 Int3();
304 return -1;
305 }
306
307 tp = &Triggers[Num_triggers];
308
309 strcpy(tp->name, name);
310 tp->roomnum = roomnum;
311 tp->facenum = facenum;
312 tp->activator = activator;
313 tp->flags = 0;
314
315 // Flag the face
316 fp->flags |= FF_HAS_TRIGGER;
317
318 // Update count
319 Num_triggers++;
320
321 // Update flag
322 World_changed = 1;
323
324 // Everything ok
325 return Num_triggers - 1;
326}
327
328// Remove a trigger
329// Paramters: trig_num - the trigger to delete

Callers 4

AttachGroupFunction · 0.85
OnTrigAddToCurfaceMethod · 0.85
OnTrigAddToCurportalMethod · 0.85
OnTrigAddFloatingMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected