1 // Emacs style mode select -*- C++ -*-
2 //-----------------------------------------------------------------------------
6 // Copyright (C) 1993-1996 by id Software, Inc.
8 // This source is available for distribution and/or modification
9 // only under the terms of the DOOM Source Code License as
10 // published by id Software. All rights reserved.
12 // The source is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
22 //-----------------------------------------------------------------------------
25 rcsid[] = "$Id: p_telept.c,v 1.3 1997/01/28 22:08:29 b1 Exp $";
64 // don't teleport missiles
65 if (thing->flags & MF_MISSILE)
68 // Don't teleport if hit back of line,
69 // so you can get out of teleporter.
75 for (i = 0; i < numsectors; i++)
77 if (sectors[ i ].tag == tag )
79 for (thinker = thinkercap.next;
80 thinker != &thinkercap;
81 thinker = thinker->next)
84 if (thinker->function != P_MobjThinker)
87 m = (mobj_t *)thinker;
90 if (m->type != MT_TELEPORTMAN )
93 sector = m->subsector->sector;
95 if (sector-sectors != i )
102 if (!P_TeleportMove (thing, m->x, m->y))
106 thing->z = thing->floorz;
108 thing->player->viewz = thing->z+thing->player->viewheight;
110 // spawn teleport fog at source and destination
111 fog = P_SpawnMobj (oldx, oldy, oldz, MT_TFOG);
112 S_StartSound (fog, sfx_telept);
113 an = m->angle >> ANGLETOFINESHIFT;
114 fog = P_SpawnMobj (m->x+20*finecosine[an], m->y+20*finesine[an]
115 , thing->z, MT_TFOG);
117 // emit sound, where?
118 S_StartSound (fog, sfx_telept);
120 // don't move for a bit
122 thing->reactiontime = 18;
124 thing->angle = m->angle;
125 thing->momx = thing->momy = thing->momz = 0;