components/prboom/p_spec.c
//
// P_ShootSpecialLine - Gun trigger special dispatcher
//
// Called when a thing shoots a special line with bullet, shell, saw, or fist.
//
// jff 02/12/98 all G1 lines were fixed to check the result from the EV_
// function before clearing the special. This avoids losing the function
// of the line, should the sector already be in motion when the line is
// impacted. Change is qualified by demo_compatibility.
//
Gun trigger special dispatcher
Called when a thing shoots a special line with bullet, shell, saw, or fist.

jff 02/12/98 all G1 lines were fixed to check the result from the EV_
function before clearing the special. This avoids losing the function
of the line, should the sector already be in motion when the line is
impacted. Change is qualified by demo_compatibility.
Gun trigger special dispatcher Called when a thing shoots a special line with bullet shell saw or fist . jff 02 / 12 / 98 all G1 lines were fixed to check the result from the EV_ function before clearing the special . This avoids losing the function of the line should the sector already be in motion when the line is impacted . Change is qualified by demo_compatibility .
void P_ShootSpecialLine
( mobj_t*       thing,
  line_t*       line )
{
  if (!demo_compatibility)
  {
    int (*linefunc)(line_t *line)=NULL;
    if ((unsigned)line->special >= GenEnd)
    {
    }
    else if ((unsigned)line->special >= GenFloorBase)
    {
      if (!thing->player)
        if ((line->special & FloorChange) || !(line->special & FloorModel))
          return;   
      if (!line->tag) 
        return;
      linefunc = EV_DoGenFloor;
    }
    else if ((unsigned)line->special >= GenCeilingBase)
    {
      if (!thing->player)
        if ((line->special & CeilingChange) || !(line->special & CeilingModel))
          return;   
      if (!line->tag) 
        return;
      linefunc = EV_DoGenCeiling;
    }
    else if ((unsigned)line->special >= GenDoorBase)
    {
      if (!thing->player)
      {
        if (!(line->special & DoorMonster))
          return;   
        if (line->flags & ML_SECRET) 
          return;
      }
      if (!line->tag) 
        return;
      linefunc = EV_DoGenDoor;
    }
    else if ((unsigned)line->special >= GenLockedBase)
    {
      if (!thing->player)
        return;   
      if (((line->special&TriggerType)==GunOnce) || ((line->special&TriggerType)==GunMany))
      { 
        if (!P_CanUnlockGenDoor(line,thing->player))
          return;
      }
      else
        return;
      if (!line->tag) 
        return;
      linefunc = EV_DoGenLockedDoor;
    }
    else if ((unsigned)line->special >= GenLiftBase)
    {
      if (!thing->player)
        if (!(line->special & LiftMonster))
          return; 
      linefunc = EV_DoGenLift;
    }
    else if ((unsigned)line->special >= GenStairsBase)
    {
      if (!thing->player)
        if (!(line->special & StairMonster))
          return; 
      if (!line->tag) 
        return;
      linefunc = EV_DoGenStairs;
    }
    else if ((unsigned)line->special >= GenCrusherBase)
    {
      if (!thing->player)
        if (!(line->special & StairMonster))
          return; 
      if (!line->tag) 
        return;
      linefunc = EV_DoGenCrusher;
    }
    if (linefunc)
      switch((line->special & TriggerType) >> TriggerTypeShift)
      {
        case GunOnce:
          if (linefunc(line))
            P_ChangeSwitchTexture(line,0);
          return;
        case GunMany:
          if (linefunc(line))
            P_ChangeSwitchTexture(line,1);
          return;
        default:  
          return;
      }
  }
  if (!thing->player)
  {
    int ok = 0;
    switch(line->special)
    {
      case 46:
        ok = 1;
        break;
    }
    if (!ok)
      return;
  }
  if (!P_CheckTag(line))  
    return;
  switch(line->special)
  {
    case 24:
      if (EV_DoFloor(line,raiseFloor) || demo_compatibility)
        P_ChangeSwitchTexture(line,0);
      break;
    case 46:
      EV_DoDoor(line,open);
      P_ChangeSwitchTexture(line,1);
      break;
    case 47:
      if (EV_DoPlat(line,raiseToNearestAndChange,0) || demo_compatibility)
        P_ChangeSwitchTexture(line,0);
      break;
    default:
      if (!demo_compatibility)
        switch (line->special)
        {
          case 197:
            if(thing->player && thing->player->health<=0 && !comp[comp_zombie])
              break;
            P_ChangeSwitchTexture(line,0);
            G_ExitLevel();
            break;
          case 198:
            if(thing->player && thing->player->health<=0 && !comp[comp_zombie])
              break;
            P_ChangeSwitchTexture(line,0);
            G_SecretExitLevel();
            break;
        }
      break;
  }
}
void P_ShootSpecialLine ( mobj_t * thing , line_t * line ) { if ( ! demo_compatibility ) { int ( * linefunc ) ( line_t * line ) = NULL ; if ( ( unsigned ) line -> special >= GenEnd ) { } else if ( ( unsigned ) line -> special >= GenFloorBase ) { if ( ! thing -> player ) if ( ( line -> special & FloorChange ) || ! ( line -> special & FloorModel ) ) return ; if ( ! line -> tag ) return ; linefunc = EV_DoGenFloor ; } else if ( ( unsigned ) line -> special >= GenCeilingBase ) { if ( ! thing -> player ) if ( ( line -> special & CeilingChange ) || ! ( line -> special & CeilingModel ) ) return ; if ( ! line -> tag ) return ; linefunc = EV_DoGenCeiling ; } else if ( ( unsigned ) line -> special >= GenDoorBase ) { if ( ! thing -> player ) { if ( ! ( line -> special & DoorMonster ) ) return ; if ( line -> flags & ML_SECRET ) return ; } if ( ! line -> tag ) return ; linefunc = EV_DoGenDoor ; } else if ( ( unsigned ) line -> special >= GenLockedBase ) { if ( ! thing -> player ) return ; if ( ( ( line -> special & TriggerType ) == GunOnce ) || ( ( line -> special & TriggerType ) == GunMany ) ) { if ( ! P_CanUnlockGenDoor ( line , thing -> player ) ) return ; } else return ; if ( ! line -> tag ) return ; linefunc = EV_DoGenLockedDoor ; } else if ( ( unsigned ) line -> special >= GenLiftBase ) { if ( ! thing -> player ) if ( ! ( line -> special & LiftMonster ) ) return ; linefunc = EV_DoGenLift ; } else if ( ( unsigned ) line -> special >= GenStairsBase ) { if ( ! thing -> player ) if ( ! ( line -> special & StairMonster ) ) return ; if ( ! line -> tag ) return ; linefunc = EV_DoGenStairs ; } else if ( ( unsigned ) line -> special >= GenCrusherBase ) { if ( ! thing -> player ) if ( ! ( line -> special & StairMonster ) ) return ; if ( ! line -> tag ) return ; linefunc = EV_DoGenCrusher ; } if ( linefunc ) switch ( ( line -> special & TriggerType ) >> TriggerTypeShift ) { case GunOnce : if ( linefunc ( line ) ) P_ChangeSwitchTexture ( line , 0 ) ; return ; case GunMany : if ( linefunc ( line ) ) P_ChangeSwitchTexture ( line , 1 ) ; return ; default : return ; } } if ( ! thing -> player ) { int ok = 0 ; switch ( line -> special ) { case 46 : ok = 1 ; break ; } if ( ! ok ) return ; } if ( ! P_CheckTag ( line ) ) return ; switch ( line -> special ) { case 24 : if ( EV_DoFloor ( line , raiseFloor ) || demo_compatibility ) P_ChangeSwitchTexture ( line , 0 ) ; break ; case 46 : EV_DoDoor ( line , open ) ; P_ChangeSwitchTexture ( line , 1 ) ; break ; case 47 : if ( EV_DoPlat ( line , raiseToNearestAndChange , 0 ) || demo_compatibility ) P_ChangeSwitchTexture ( line , 0 ) ; break ; default : if ( ! demo_compatibility ) switch ( line -> special ) { case 197 : if ( thing -> player && thing -> player -> health <= 0 && ! comp [ comp_zombie ] ) break ; P_ChangeSwitchTexture ( line , 0 ) ; G_ExitLevel ( ) ; break ; case 198 : if ( thing -> player && thing -> player -> health <= 0 && ! comp [ comp_zombie ] ) break ; P_ChangeSwitchTexture ( line , 0 ) ; G_SecretExitLevel ( ) ; break ; } break ; } }
P_ShootSpecialLine - Gun trigger special dispatcher
Called when a thing shoots a special line with bullet, shell, saw, or fist.
P_ShootSpecialLine - Gun trigger special dispatcher Called when a thing shoots a special line with bullet shell saw or fist .
//jff 02/04/98 add check here for generalized linedef // pointer to line function is NULL by default, set non-null if // line special is gun triggered generalized linedef type // check each range of generalized linedefs // Out of range for GenFloors // FloorModel is "Allow Monsters" if FloorChange is 0 //jff 2/27/98 all gun generalized types require tag // CeilingModel is "Allow Monsters" if CeilingChange is 0 //jff 2/27/98 all gun generalized types require tag // monsters disallowed from this door // they can't open secret doors either //jff 3/2/98 all gun generalized types require tag // monsters disallowed from unlocking doors //jff 4/1/98 check for being a gun type before reporting door type //jff 2/27/98 all gun generalized types require tag // monsters disallowed // monsters disallowed //jff 2/27/98 all gun generalized types require tag // monsters disallowed //jff 2/27/98 all gun generalized types require tag // if not a gun type, do nothing here // Impacts that other things can activate. // 46 GR Open door on impact weapon is monster activatable //jff 2/27/98 disallow zero tag on some types // 24 G1 raise floor to highest adjacent // 46 GR open door, stay open // 47 G1 raise floor to nearest and change texture and type //jff 1/30/98 added new gun linedefs here // killough 1/31/98: added demo_compatibility check, added inner switch // Exit to next level // killough 10/98: prevent zombies from exiting levels // Exit to secret level // killough 10/98: prevent zombies from exiting levels //jff end addition of new gun linedefs