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))
105 thing->z = thing->floorz; //fixme: not needed?
107 thing->player->viewz = thing->z+thing->player->viewheight;
109 // spawn teleport fog at source and destination
110 fog = P_SpawnMobj (oldx, oldy, oldz, MT_TFOG);
111 S_StartSound (fog, sfx_telept);
112 an = m->angle >> ANGLETOFINESHIFT;
113 fog = P_SpawnMobj (m->x+20*finecosine[an], m->y+20*finesine[an]
114 , thing->z, MT_TFOG);
116 // emit sound, where?
117 S_StartSound (fog, sfx_telept);
119 // don't move for a bit
121 thing->reactiontime = 18;
123 thing->angle = m->angle;
124 thing->momx = thing->momy = thing->momz = 0;