|
|
1.1 ! root 1: #include "doomdef.h" ! 2: #include "p_local.h" ! 3: ! 4: ! 5: /* ! 6: ============== ! 7: = ! 8: = P_Telefrag ! 9: = ! 10: = Kill all monsters around the given spot ! 11: = ! 12: ============== ! 13: */ ! 14: ! 15: void P_Telefrag (mobj_t *thing, fixed_t x, fixed_t y) ! 16: { ! 17: int delta; ! 18: int size; ! 19: mobj_t *m; ! 20: ! 21: for (m=mobjhead.next ; m != &mobjhead ; m=m->next) ! 22: { ! 23: if (!(m->flags & MF_SHOOTABLE) ) ! 24: continue; /* not shootable */ ! 25: size = m->radius + thing->radius + 4*FRACUNIT; ! 26: delta = m->x - x; ! 27: if (delta < - size || delta > size) ! 28: continue; ! 29: delta = m->y - y; ! 30: if (delta < -size || delta > size) ! 31: continue; ! 32: P_DamageMobj (m, thing, thing, 10000); ! 33: m->flags &= ~(MF_SOLID|MF_SHOOTABLE); ! 34: } ! 35: } ! 36: ! 37: ! 38: /*================================================================== */ ! 39: /* */ ! 40: /* TELEPORTATION */ ! 41: /* */ ! 42: /*================================================================== */ ! 43: int EV_Teleport( line_t *line,mobj_t *thing ) ! 44: { ! 45: int i; ! 46: int tag; ! 47: boolean flag; ! 48: mobj_t *m,*fog; ! 49: unsigned an; ! 50: sector_t *sector; ! 51: fixed_t oldx, oldy, oldz; ! 52: int side; ! 53: ! 54: side = !P_PointOnLineSide (thing->x, thing->y, line); ! 55: ! 56: if (thing->flags & MF_MISSILE) ! 57: return 0; /* don't teleport missiles */ ! 58: ! 59: if (side == 1) /* don't teleport if hit back of line, */ ! 60: return 0; /* so you can get out of teleporter */ ! 61: ! 62: tag = line->tag; ! 63: for (i = 0; i < numsectors; i++) ! 64: if (sectors[ i ].tag == tag ) ! 65: { ! 66: for (m=mobjhead.next ; m != &mobjhead ; m=m->next) ! 67: { ! 68: if (m->type != MT_TELEPORTMAN ) ! 69: continue; /* not a teleportman */ ! 70: sector = m->subsector->sector; ! 71: if (sector-sectors != i ) ! 72: continue; /* wrong sector */ ! 73: ! 74: oldx = thing->x; ! 75: oldy = thing->y; ! 76: oldz = thing->z; ! 77: thing->flags |= MF_TELEPORT; ! 78: P_Telefrag (thing, m->x, m->y); ! 79: flag = P_TryMove (thing, m->x, m->y); ! 80: thing->flags &= ~MF_TELEPORT; ! 81: if (!flag) ! 82: return 0; /* move is blocked */ ! 83: thing->z = thing->floorz; ! 84: /* spawn teleport fog at source and destination */ ! 85: fog = P_SpawnMobj (oldx, oldy, oldz, MT_TFOG); ! 86: S_StartSound (fog, sfx_telept); ! 87: an = m->angle >> ANGLETOFINESHIFT; ! 88: fog = P_SpawnMobj (m->x+20*finecosine[an], m->y+20*finesine[an] ! 89: , thing->z, MT_TFOG); ! 90: S_StartSound (fog, sfx_telept); ! 91: if (thing->player) ! 92: thing->reactiontime = 18; /* don't move for a bit */ ! 93: thing->angle = m->angle; ! 94: thing->momx = thing->momy = thing->momz = 0; ! 95: return 1; ! 96: } ! 97: } ! 98: return 0; ! 99: } ! 100:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.