54 #define PLAT_LOW_TRIGGER 1
57 #define STATE_BOTTOM 1
61 #define DOOR_START_OPEN 1
62 #define DOOR_REVERSE 2
63 #define DOOR_CRUSHER 4
64 #define DOOR_NOMONSTER 8
65 #define DOOR_TOGGLE 32
66 #define DOOR_X_AXIS 64
67 #define DOOR_Y_AXIS 128
76 VectorClear(ent->velocity);
77 ent->moveinfo.endfunc(ent);
82 if (ent->moveinfo.remaining_distance == 0) {
87 VectorScale(ent->moveinfo.dir, ent->moveinfo.remaining_distance /
FRAMETIME, ent->velocity);
97 if ((ent->moveinfo.speed *
FRAMETIME) >= ent->moveinfo.remaining_distance) {
101 VectorScale(ent->moveinfo.dir, ent->moveinfo.speed, ent->velocity);
102 frames = floor((ent->moveinfo.remaining_distance / ent->moveinfo.speed) /
FRAMETIME);
103 ent->moveinfo.remaining_distance -= frames * ent->moveinfo.speed *
FRAMETIME;
110 void Move_Calc(edict_t *ent, vec3_t dest,
void(*func)(edict_t*))
112 VectorClear(ent->velocity);
113 VectorSubtract(dest, ent->s.origin, ent->moveinfo.dir);
115 ent->moveinfo.endfunc = func;
117 if (ent->moveinfo.speed == ent->moveinfo.accel && ent->moveinfo.speed == ent->moveinfo.decel) {
126 ent->moveinfo.current_speed = 0;
139 VectorClear(ent->avelocity);
140 ent->moveinfo.endfunc(ent);
147 if (ent->moveinfo.state ==
STATE_UP)
148 VectorSubtract(ent->moveinfo.end_angles, ent->s.angles, move);
150 VectorSubtract(ent->moveinfo.start_angles, ent->s.angles, move);
157 VectorScale(move, 1.0 /
FRAMETIME, ent->avelocity);
171 if (ent->moveinfo.state ==
STATE_UP)
172 VectorSubtract(ent->moveinfo.end_angles, ent->s.angles, destdelta);
174 VectorSubtract(ent->moveinfo.start_angles, ent->s.angles, destdelta);
177 len = VectorLength(destdelta);
180 traveltime = len / ent->moveinfo.speed;
190 VectorScale(destdelta, 1.0 / traveltime, ent->avelocity);
199 VectorClear(ent->avelocity);
200 ent->moveinfo.endfunc = func;
218 #define AccelerationDistance(target, rate) (target * ((target / rate) + 1) / 2)
271 distance = p1_distance + p2_distance;
300 p1_speed = (old_speed + moveinfo->
move_speed) / 2.0;
301 p2_distance = moveinfo->
move_speed * (1.0 - (p1_distance / p1_speed));
302 distance = p1_distance + p2_distance;
303 moveinfo->
current_speed = (p1_speed * (p1_distance / distance)) + (moveinfo->
move_speed * (p2_distance / distance));
314 ent->moveinfo.remaining_distance -= ent->moveinfo.current_speed;
316 if (ent->moveinfo.current_speed == 0)
322 if (ent->moveinfo.remaining_distance <= ent->moveinfo.current_speed) {
327 VectorScale(ent->moveinfo.dir, ent->moveinfo.current_speed * 10, ent->velocity);
338 if (ent->moveinfo.sound_end)
339 gi.sound(ent, CHAN_NO_PHS_ADD + CHAN_VOICE, ent->moveinfo.sound_end, 1, ATTN_STATIC, 0);
351 if (ent->moveinfo.sound_end)
352 gi.sound(ent, CHAN_NO_PHS_ADD + CHAN_VOICE, ent->moveinfo.sound_end, 1, ATTN_STATIC, 0);
361 if (ent->moveinfo.sound_start)
362 gi.sound(ent, CHAN_NO_PHS_ADD + CHAN_VOICE, ent->moveinfo.sound_start, 1, ATTN_STATIC, 0);
363 ent->s.sound = ent->moveinfo.sound_middle;
372 if (ent->moveinfo.sound_start)
373 gi.sound(ent, CHAN_NO_PHS_ADD + CHAN_VOICE, ent->moveinfo.sound_start, 1, ATTN_STATIC, 0);
374 ent->s.sound = ent->moveinfo.sound_middle;
382 if (!(
other->svflags & SVF_MONSTER) && (!
other->client)) {
393 if (self->moveinfo.state ==
STATE_UP)
413 if (
other->health <= 0)
419 else if (ent->moveinfo.state ==
STATE_TOP)
434 trigger->solid = SOLID_TRIGGER;
435 trigger->enemy = ent;
437 tmin[0] = ent->mins[0] + 25;
438 tmin[1] = ent->mins[1] + 25;
439 tmin[2] = ent->mins[2];
441 tmax[0] = ent->maxs[0] - 25;
442 tmax[1] = ent->maxs[1] - 25;
443 tmax[2] = ent->maxs[2] + 8;
445 tmin[2] = tmax[2] - (ent->pos1[2] - ent->pos2[2] +
st.
lip);
448 tmax[2] = tmin[2] + 8;
450 if (tmax[0] - tmin[0] <= 0) {
451 tmin[0] = (ent->mins[0] + ent->maxs[0]) * 0.5;
452 tmax[0] = tmin[0] + 1;
454 if (tmax[1] - tmin[1] <= 0) {
455 tmin[1] = (ent->mins[1] + ent->maxs[1]) * 0.5;
456 tmax[1] = tmin[1] + 1;
459 VectorCopy(tmin, trigger->mins);
460 VectorCopy(tmax, trigger->maxs);
462 gi.linkentity(trigger);
485 VectorClear(ent->s.angles);
486 ent->solid = SOLID_BSP;
489 gi.setmodel(ent, ent->model);
515 VectorCopy(ent->s.origin, ent->pos1);
516 VectorCopy(ent->s.origin, ent->pos2);
520 ent->pos2[2] -= (ent->maxs[2] - ent->mins[2]) -
st.
lip;
526 if (ent->targetname) {
529 VectorCopy(ent->pos2, ent->s.origin);
534 ent->moveinfo.speed = ent->speed;
535 ent->moveinfo.accel = ent->accel;
536 ent->moveinfo.decel = ent->decel;
537 ent->moveinfo.wait = ent->wait;
538 VectorCopy(ent->pos1, ent->moveinfo.start_origin);
539 VectorCopy(ent->s.angles, ent->moveinfo.start_angles);
540 VectorCopy(ent->pos2, ent->moveinfo.end_origin);
541 VectorCopy(ent->s.angles, ent->moveinfo.end_angles);
543 ent->moveinfo.sound_start =
gi.soundindex(
"plats/pt1_strt.wav");
544 ent->moveinfo.sound_middle =
gi.soundindex(
"plats/pt1_mid.wav");
545 ent->moveinfo.sound_end =
gi.soundindex(
"plats/pt1_end.wav");
569 if (self->avelocity[0] || self->avelocity[1] || self->avelocity[2])
575 if (!VectorCompare(self->avelocity,
vec3_origin)) {
577 VectorClear(self->avelocity);
580 self->s.sound =
self->moveinfo.sound_middle;
581 VectorScale(self->movedir, self->speed, self->avelocity);
582 if (self->spawnflags & 16)
589 ent->solid = SOLID_BSP;
590 if (ent->spawnflags & 32)
596 VectorClear(ent->movedir);
597 if (ent->spawnflags & 4)
598 ent->movedir[2] = 1.0;
599 else if (ent->spawnflags & 8)
600 ent->movedir[0] = 1.0;
602 ent->movedir[1] = 1.0;
605 if (ent->spawnflags & 2)
606 VectorNegate(ent->movedir, ent->movedir);
619 if (ent->spawnflags & 1)
620 ent->use(ent, NULL, NULL);
622 if (ent->spawnflags & 64)
623 ent->s.effects |= EF_ANIM_ALL;
624 if (ent->spawnflags & 128)
625 ent->s.effects |= EF_ANIM_ALLFAST;
627 gi.setmodel(ent, ent->model);
659 self->s.effects &= ~EF_ANIM23;
660 self->s.effects |= EF_ANIM01;
678 self->s.effects &= ~EF_ANIM01;
679 self->s.effects |= EF_ANIM23;
683 if (self->moveinfo.wait >= 0) {
684 self->nextthink =
level.
time +
self->moveinfo.wait;
695 if (self->moveinfo.sound_start && !(self->flags &
FL_TEAMSLAVE))
696 gi.sound(
self, CHAN_NO_PHS_ADD + CHAN_VOICE, self->moveinfo.sound_start, 1, ATTN_STATIC, 0);
702 self->activator = activator;
711 if (
other->health <= 0)
714 self->activator =
other;
718 void button_killed(edict_t *
self, edict_t *inflictor, edict_t *attacker,
int damage, vec3_t point)
720 self->activator = attacker;
721 self->health =
self->max_health;
733 ent->solid = SOLID_BSP;
734 gi.setmodel(ent, ent->model);
736 if (ent->sounds != 1)
737 ent->moveinfo.sound_start =
gi.soundindex(
"switches/butn2.wav");
742 ent->accel = ent->speed;
744 ent->decel = ent->speed;
751 VectorCopy(ent->s.origin, ent->pos1);
752 abs_movedir[0] = fabs(ent->movedir[0]);
753 abs_movedir[1] = fabs(ent->movedir[1]);
754 abs_movedir[2] = fabs(ent->movedir[2]);
755 dist = abs_movedir[0] * ent->size[0] + abs_movedir[1] * ent->size[1] + abs_movedir[2] * ent->size[2] -
st.
lip;
756 VectorMA(ent->pos1, dist, ent->movedir, ent->pos2);
759 ent->s.effects |= EF_ANIM01;
762 ent->max_health = ent->health;
765 }
else if (! ent->targetname)
770 ent->moveinfo.speed = ent->speed;
771 ent->moveinfo.accel = ent->accel;
772 ent->moveinfo.decel = ent->decel;
773 ent->moveinfo.wait = ent->wait;
774 VectorCopy(ent->pos1, ent->moveinfo.start_origin);
775 VectorCopy(ent->s.angles, ent->moveinfo.start_angles);
776 VectorCopy(ent->pos2, ent->moveinfo.end_origin);
777 VectorCopy(ent->s.angles, ent->moveinfo.end_angles);
820 while ((t =
G_Find(t,
FOFS(targetname), self->target))) {
821 if (Q_stricmp(t->classname,
"func_areaportal") == 0) {
822 gi.SetAreaPortalState(t->style, open);
832 if (self->moveinfo.sound_end)
833 gi.sound(
self, CHAN_NO_PHS_ADD + CHAN_VOICE, self->moveinfo.sound_end, 1, ATTN_STATIC, 0);
839 if (self->moveinfo.wait >= 0) {
841 self->nextthink =
level.
time +
self->moveinfo.wait;
848 if (self->moveinfo.sound_end)
849 gi.sound(
self, CHAN_NO_PHS_ADD + CHAN_VOICE, self->moveinfo.sound_end, 1, ATTN_STATIC, 0);
859 if (self->moveinfo.sound_start)
860 gi.sound(
self, CHAN_NO_PHS_ADD + CHAN_VOICE, self->moveinfo.sound_start, 1, ATTN_STATIC, 0);
861 self->s.sound =
self->moveinfo.sound_middle;
863 if (self->max_health) {
865 self->health =
self->max_health;
869 if (strcmp(self->classname,
"func_door") == 0)
871 else if (strcmp(self->classname,
"func_door_rotating") == 0)
877 if (self->moveinfo.state ==
STATE_UP)
882 if (self->moveinfo.wait >= 0)
883 self->nextthink =
level.
time +
self->moveinfo.wait;
888 if (self->moveinfo.sound_start)
889 gi.sound(
self, CHAN_NO_PHS_ADD + CHAN_VOICE, self->moveinfo.sound_start, 1, ATTN_STATIC, 0);
890 self->s.sound =
self->moveinfo.sound_middle;
893 if (strcmp(self->classname,
"func_door") == 0)
895 else if (strcmp(self->classname,
"func_door_rotating") == 0)
912 for (ent =
self ; ent ; ent = ent->teamchain) {
922 for (ent =
self ; ent ; ent = ent->teamchain) {
931 if (
other->health <= 0)
934 if (!(
other->svflags & SVF_MONSTER) && (!
other->client))
940 if (
level.
time < self->touch_debounce_time)
942 self->touch_debounce_time =
level.
time + 1.0;
960 min = fabs(self->moveinfo.distance);
961 for (ent = self->teamchain; ent; ent = ent->teamchain) {
962 dist = fabs(ent->moveinfo.distance);
967 time = min /
self->moveinfo.speed;
970 for (ent =
self; ent; ent = ent->teamchain) {
971 newspeed = fabs(ent->moveinfo.distance) / time;
972 ratio = newspeed / ent->moveinfo.speed;
973 if (ent->moveinfo.accel == ent->moveinfo.speed)
974 ent->moveinfo.accel = newspeed;
976 ent->moveinfo.accel *= ratio;
977 if (ent->moveinfo.decel == ent->moveinfo.speed)
978 ent->moveinfo.decel = newspeed;
980 ent->moveinfo.decel *= ratio;
981 ent->moveinfo.speed = newspeed;
993 VectorCopy(ent->absmin, mins);
994 VectorCopy(ent->absmax, maxs);
1008 VectorCopy(mins,
other->mins);
1009 VectorCopy(maxs,
other->maxs);
1011 other->solid = SOLID_TRIGGER;
1026 if (!(
other->svflags & SVF_MONSTER) && (!
other->client)) {
1043 if (self->moveinfo.wait >= 0) {
1045 for (ent = self->teammaster ; ent ; ent = ent->teamchain)
1048 for (ent = self->teammaster ; ent ; ent = ent->teamchain)
1054 void door_killed(edict_t *
self, edict_t *inflictor, edict_t *attacker,
int damage, vec3_t point)
1058 for (ent = self->teammaster ; ent ; ent = ent->teamchain) {
1059 ent->health = ent->max_health;
1062 door_use(self->teammaster, attacker, attacker);
1070 if (
level.
time < self->touch_debounce_time)
1072 self->touch_debounce_time =
level.
time + 5.0;
1074 gi.centerprintf(
other,
"%s", self->message);
1075 gi.sound(
other, CHAN_AUTO,
gi.soundindex(
"misc/talk1.wav"), 1, ATTN_NORM, 0);
1082 if (ent->sounds != 1) {
1083 ent->moveinfo.sound_start =
gi.soundindex(
"doors/dr1_strt.wav");
1084 ent->moveinfo.sound_middle =
gi.soundindex(
"doors/dr1_mid.wav");
1085 ent->moveinfo.sound_end =
gi.soundindex(
"doors/dr1_end.wav");
1090 ent->solid = SOLID_BSP;
1091 gi.setmodel(ent, ent->model);
1102 ent->accel = ent->speed;
1104 ent->decel = ent->speed;
1114 VectorCopy(ent->s.origin, ent->pos1);
1115 abs_movedir[0] = fabs(ent->movedir[0]);
1116 abs_movedir[1] = fabs(ent->movedir[1]);
1117 abs_movedir[2] = fabs(ent->movedir[2]);
1118 ent->moveinfo.distance = abs_movedir[0] * ent->size[0] + abs_movedir[1] * ent->size[1] + abs_movedir[2] * ent->size[2] -
st.
lip;
1119 VectorMA(ent->pos1, ent->moveinfo.distance, ent->movedir, ent->pos2);
1123 VectorCopy(ent->pos2, ent->s.origin);
1124 VectorCopy(ent->pos1, ent->pos2);
1125 VectorCopy(ent->s.origin, ent->pos1);
1133 ent->max_health = ent->health;
1134 }
else if (ent->targetname && ent->message) {
1135 gi.soundindex(
"misc/talk.wav");
1139 ent->moveinfo.speed = ent->speed;
1140 ent->moveinfo.accel = ent->accel;
1141 ent->moveinfo.decel = ent->decel;
1142 ent->moveinfo.wait = ent->wait;
1143 VectorCopy(ent->pos1, ent->moveinfo.start_origin);
1144 VectorCopy(ent->s.angles, ent->moveinfo.start_angles);
1145 VectorCopy(ent->pos2, ent->moveinfo.end_origin);
1146 VectorCopy(ent->s.angles, ent->moveinfo.end_angles);
1148 if (ent->spawnflags & 16)
1149 ent->s.effects |= EF_ANIM_ALL;
1150 if (ent->spawnflags & 64)
1151 ent->s.effects |= EF_ANIM_ALLFAST;
1155 ent->teammaster = ent;
1160 if (ent->health || ent->targetname)
1198 VectorClear(ent->s.angles);
1201 VectorClear(ent->movedir);
1203 ent->movedir[2] = 1.0;
1205 ent->movedir[0] = 1.0;
1207 ent->movedir[1] = 1.0;
1211 VectorNegate(ent->movedir, ent->movedir);
1214 gi.dprintf(
"%s at %s with no distance set\n", ent->classname,
vtos(ent->s.origin));
1218 VectorCopy(ent->s.angles, ent->pos1);
1219 VectorMA(ent->s.angles,
st.
distance, ent->movedir, ent->pos2);
1223 ent->solid = SOLID_BSP;
1224 gi.setmodel(ent, ent->model);
1232 ent->accel = ent->speed;
1234 ent->decel = ent->speed;
1241 if (ent->sounds != 1) {
1242 ent->moveinfo.sound_start =
gi.soundindex(
"doors/dr1_strt.wav");
1243 ent->moveinfo.sound_middle =
gi.soundindex(
"doors/dr1_mid.wav");
1244 ent->moveinfo.sound_end =
gi.soundindex(
"doors/dr1_end.wav");
1249 VectorCopy(ent->pos2, ent->s.angles);
1250 VectorCopy(ent->pos1, ent->pos2);
1251 VectorCopy(ent->s.angles, ent->pos1);
1252 VectorNegate(ent->movedir, ent->movedir);
1258 ent->max_health = ent->health;
1261 if (ent->targetname && ent->message) {
1262 gi.soundindex(
"misc/talk.wav");
1267 ent->moveinfo.speed = ent->speed;
1268 ent->moveinfo.accel = ent->accel;
1269 ent->moveinfo.decel = ent->decel;
1270 ent->moveinfo.wait = ent->wait;
1271 VectorCopy(ent->s.origin, ent->moveinfo.start_origin);
1272 VectorCopy(ent->pos1, ent->moveinfo.start_angles);
1273 VectorCopy(ent->s.origin, ent->moveinfo.end_origin);
1274 VectorCopy(ent->pos2, ent->moveinfo.end_angles);
1276 if (ent->spawnflags & 16)
1277 ent->s.effects |= EF_ANIM_ALL;
1281 ent->teammaster = ent;
1286 if (ent->health || ent->targetname)
1314 self->solid = SOLID_BSP;
1315 gi.setmodel(
self, self->model);
1317 switch (self->sounds) {
1322 self->moveinfo.sound_start =
gi.soundindex(
"world/mov_watr.wav");
1323 self->moveinfo.sound_end =
gi.soundindex(
"world/stp_watr.wav");
1327 self->moveinfo.sound_start =
gi.soundindex(
"world/mov_watr.wav");
1328 self->moveinfo.sound_end =
gi.soundindex(
"world/stp_watr.wav");
1333 VectorCopy(self->s.origin, self->pos1);
1334 abs_movedir[0] = fabs(self->movedir[0]);
1335 abs_movedir[1] = fabs(self->movedir[1]);
1336 abs_movedir[2] = fabs(self->movedir[2]);
1337 self->moveinfo.distance = abs_movedir[0] *
self->size[0] + abs_movedir[1] *
self->size[1] + abs_movedir[2] *
self->size[2] -
st.
lip;
1338 VectorMA(self->pos1, self->moveinfo.distance, self->movedir, self->pos2);
1342 VectorCopy(self->pos2, self->s.origin);
1343 VectorCopy(self->pos1, self->pos2);
1344 VectorCopy(self->s.origin, self->pos1);
1347 VectorCopy(self->pos1, self->moveinfo.start_origin);
1348 VectorCopy(self->s.angles, self->moveinfo.start_angles);
1349 VectorCopy(self->pos2, self->moveinfo.end_origin);
1350 VectorCopy(self->s.angles, self->moveinfo.end_angles);
1356 self->moveinfo.accel =
self->moveinfo.decel =
self->moveinfo.speed =
self->speed;
1360 self->moveinfo.wait =
self->wait;
1364 if (self->wait == -1)
1367 self->classname =
"func_door";
1369 gi.linkentity(
self);
1373 #define TRAIN_START_ON 1
1374 #define TRAIN_TOGGLE 2
1375 #define TRAIN_BLOCK_STOPS 4
1391 if (!(
other->svflags & SVF_MONSTER) && (!
other->client)) {
1400 if (
level.
time < self->touch_debounce_time)
1405 self->touch_debounce_time =
level.
time + 0.5;
1411 if (self->target_ent->pathtarget) {
1415 ent =
self->target_ent;
1416 savetarget = ent->target;
1417 ent->target = ent->pathtarget;
1419 ent->target = savetarget;
1426 if (self->moveinfo.wait) {
1427 if (self->moveinfo.wait > 0) {
1428 self->nextthink =
level.
time +
self->moveinfo.wait;
1433 VectorClear(self->velocity);
1434 self->nextthink = 0;
1438 if (self->moveinfo.sound_end)
1439 gi.sound(
self, CHAN_NO_PHS_ADD + CHAN_VOICE, self->moveinfo.sound_end, 1, ATTN_STATIC, 0);
1456 if (!self->target) {
1463 gi.dprintf(
"train_next: bad target %s\n", self->target);
1467 self->target = ent->target;
1470 if (ent->spawnflags & 1) {
1472 gi.dprintf(
"connected teleport path_corners, see %s at %s\n", ent->classname,
vtos(ent->s.origin));
1476 VectorSubtract(ent->s.origin, self->mins, self->s.origin);
1477 VectorCopy(self->s.origin, self->s.old_origin);
1478 self->s.event = EV_OTHER_TELEPORT;
1479 gi.linkentity(
self);
1483 self->moveinfo.wait = ent->wait;
1484 self->target_ent = ent;
1487 if (self->moveinfo.sound_start)
1488 gi.sound(
self, CHAN_NO_PHS_ADD + CHAN_VOICE, self->moveinfo.sound_start, 1, ATTN_STATIC, 0);
1489 self->s.sound =
self->moveinfo.sound_middle;
1492 VectorSubtract(ent->s.origin, self->mins, dest);
1494 VectorCopy(self->s.origin, self->moveinfo.start_origin);
1495 VectorCopy(dest, self->moveinfo.end_origin);
1505 ent =
self->target_ent;
1507 VectorSubtract(ent->s.origin, self->mins, dest);
1509 VectorCopy(self->s.origin, self->moveinfo.start_origin);
1510 VectorCopy(dest, self->moveinfo.end_origin);
1519 if (!self->target) {
1520 gi.dprintf(
"train_find: no target\n");
1525 gi.dprintf(
"train_find: target %s not found\n", self->target);
1528 self->target = ent->target;
1530 VectorSubtract(ent->s.origin, self->mins, self->s.origin);
1531 gi.linkentity(
self);
1534 if (!self->targetname)
1540 self->activator =
self;
1546 self->activator = activator;
1552 VectorClear(self->velocity);
1553 self->nextthink = 0;
1555 if (self->target_ent)
1566 VectorClear(self->s.angles);
1574 self->solid = SOLID_BSP;
1575 gi.setmodel(
self, self->model);
1578 self->moveinfo.sound_middle =
gi.soundindex(
st.
noise);
1583 self->moveinfo.speed =
self->speed;
1584 self->moveinfo.accel =
self->moveinfo.decel =
self->moveinfo.speed;
1588 gi.linkentity(
self);
1596 gi.dprintf(
"func_train without a target at %s\n",
vtos(self->absmin));
1607 if (self->movetarget->nextthink) {
1612 if (!
other->pathtarget) {
1613 gi.dprintf(
"elevator used with no pathtarget\n");
1619 gi.dprintf(
"elevator used with bad pathtarget: %s\n",
other->pathtarget);
1623 self->movetarget->target_ent = target;
1629 if (!self->target) {
1630 gi.dprintf(
"trigger_elevator has no target\n");
1634 if (!self->movetarget) {
1635 gi.dprintf(
"trigger_elevator unable to find target %s\n", self->target);
1638 if (strcmp(self->movetarget->classname,
"func_train") != 0) {
1639 gi.dprintf(
"trigger_elevator target %s is not a train\n", self->target);
1644 self->svflags = SVF_NOCLIENT;
1677 self->activator = activator;
1680 if (self->nextthink) {
1681 self->nextthink = 0;
1687 self->nextthink =
level.
time +
self->delay;
1700 if (self->random >= self->wait) {
1702 gi.dprintf(
"func_timer at %s has random >= wait\n",
vtos(self->s.origin));
1705 if (self->spawnflags & 1) {
1707 self->activator =
self;
1710 self->svflags = SVF_NOCLIENT;
1722 if (self->spawnflags & 1) {
1724 self->spawnflags &= ~1;
1726 self->speed =
self->count;
1727 self->spawnflags |= 1;
1730 if (!(self->spawnflags & 2))
1739 if (!(self->spawnflags & 1)) {
1740 self->count =
self->speed;
1746 gi.setmodel(
self, self->model);
1747 self->solid = SOLID_BSP;
1748 gi.linkentity(
self);
1765 #define SECRET_ALWAYS_SHOOT 1
1766 #define SECRET_1ST_LEFT 2
1767 #define SECRET_1ST_DOWN 4
1800 if (self->wait == -1)
1802 self->nextthink =
level.
time +
self->wait;
1833 if (!(
other->svflags & SVF_MONSTER) && (!
other->client)) {
1842 if (
level.
time < self->touch_debounce_time)
1844 self->touch_debounce_time =
level.
time + 0.5;
1849 void door_secret_die(edict_t *
self, edict_t *inflictor, edict_t *attacker,
int damage, vec3_t point)
1862 ent->moveinfo.sound_start =
gi.soundindex(
"doors/dr1_strt.wav");
1863 ent->moveinfo.sound_middle =
gi.soundindex(
"doors/dr1_mid.wav");
1864 ent->moveinfo.sound_end =
gi.soundindex(
"doors/dr1_end.wav");
1867 ent->solid = SOLID_BSP;
1868 gi.setmodel(ent, ent->model);
1885 ent->moveinfo.accel =
1886 ent->moveinfo.decel =
1887 ent->moveinfo.speed = 50;
1891 VectorClear(ent->s.angles);
1894 width = fabs(DotProduct(
up, ent->size));
1897 length = fabs(DotProduct(
forward, ent->size));
1899 VectorMA(ent->s.origin, -1 *
width,
up, ent->pos1);
1901 VectorMA(ent->s.origin, side *
width,
right, ent->pos1);
1902 VectorMA(ent->pos1, length,
forward, ent->pos2);
1907 ent->max_health = ent->health;
1908 }
else if (ent->targetname && ent->message) {
1909 gi.soundindex(
"misc/talk.wav");
1913 ent->classname =
"func_door";
1929 gi.setmodel(ent, ent->model);
1931 ent->svflags = SVF_NOCLIENT;