8 //----------------------------------------------------------------------------
12 //----------------------------------------------------------------------------
14 boolean P_Teleport(mobj_t *thing, fixed_t x, fixed_t y, angle_t angle)
28 aboveFloor = thing->z-thing->floorz;
29 if(!P_TeleportMove(thing, x, y))
35 player = thing->player;
36 if(player->powers[pw_flight] && aboveFloor)
38 thing->z = thing->floorz+aboveFloor;
39 if(thing->z+thing->height > thing->ceilingz)
41 thing->z = thing->ceilingz-thing->height;
43 player->viewz = thing->z+player->viewheight;
47 thing->z = thing->floorz;
48 player->viewz = thing->z+player->viewheight;
52 else if(thing->flags&MF_MISSILE)
54 thing->z = thing->floorz+aboveFloor;
55 if(thing->z+thing->height > thing->ceilingz)
57 thing->z = thing->ceilingz-thing->height;
62 thing->z = thing->floorz;
64 // Spawn teleport fog at source and destination
65 fogDelta = thing->flags&MF_MISSILE ? 0 : TELEFOGHEIGHT;
66 fog = P_SpawnMobj(oldx, oldy, oldz+fogDelta, MT_TFOG);
67 S_StartSound(fog, sfx_telept);
68 an = angle>>ANGLETOFINESHIFT;
69 fog = P_SpawnMobj(x+20*finecosine[an],
70 y+20*finesine[an], thing->z+fogDelta, MT_TFOG);
71 S_StartSound(fog, sfx_telept);
72 if(thing->player && !thing->player->powers[pw_weaponlevel2])
73 { // Freeze player for about .5 sec
74 thing->reactiontime = 18;
77 if(thing->flags2&MF2_FOOTCLIP && P_GetThingFloorType(thing) != FLOOR_SOLID)
79 thing->flags2 |= MF2_FEETARECLIPPED;
81 else if(thing->flags2&MF2_FEETARECLIPPED)
83 thing->flags2 &= ~MF2_FEETARECLIPPED;
85 if(thing->flags&MF_MISSILE)
87 angle >>= ANGLETOFINESHIFT;
88 thing->momx = FixedMul(thing->info->speed, finecosine[angle]);
89 thing->momy = FixedMul(thing->info->speed, finesine[angle]);
93 thing->momx = thing->momy = thing->momz = 0;
98 //----------------------------------------------------------------------------
102 //----------------------------------------------------------------------------
104 boolean EV_Teleport(line_t *line, int side, mobj_t *thing)
112 if(thing->flags2&MF2_NOTELEPORT)
117 { // Don't teleport when crossing back side
121 for(i = 0; i < numsectors; i++)
123 if(sectors[i].tag == tag)
125 thinker = thinkercap.next;
126 for(thinker = thinkercap.next; thinker != &thinkercap;
127 thinker = thinker->next)
129 if(thinker->function != P_MobjThinker)
133 m = (mobj_t *)thinker;
134 if(m->type != MT_TELEPORTMAN )
135 { // Not a teleportman
138 sector = m->subsector->sector;
139 if(sector-sectors != i)
143 return(P_Teleport(thing, m->x, m->y, m->angle));