components/prboom/p_spec.c
//
// P_PlayerInSpecialSector()
//
// Called every tick frame
//  that the player origin is in a special sector
//
// Changed to ignore sector types the engine does not recognize
//
P_PlayerInSpecialSector()
Called every tick frame
that the player origin is in a special sector

Changed to ignore sector types the engine does not recognize
P_PlayerInSpecialSector () Called every tick frame that the player origin is in a special sector Changed to ignore sector types the engine does not recognize
void P_PlayerInSpecialSector (player_t* player)
{
  sector_t*   sector;
  sector = player->mo->subsector->sector;
  if (player->mo->z != sector->floorheight)
    return;
  if (sector->special<32) 
  {
    switch (sector->special)
      {
      case 5:
        if (!player->powers[pw_ironfeet])
          if (!(leveltime&0x1f))
            P_DamageMobj (player->mo, NULL, NULL, 10);
        break;
      case 7:
        if (!player->powers[pw_ironfeet])
          if (!(leveltime&0x1f))
            P_DamageMobj (player->mo, NULL, NULL, 5);
        break;
      case 16:
      case 4:
        if (!player->powers[pw_ironfeet]
            || (P_Random(pr_slimehurt)<5) ) 
        {
          if (!(leveltime&0x1f))
            P_DamageMobj (player->mo, NULL, NULL, 20);
        }
        break;
      case 9:
        player->secretcount++;
        sector->special = 0;
        break;
      case 11:
        if (comp[comp_god]) 
          player->cheats &= ~CF_GODMODE; 
        if (!(leveltime&0x1f))
          P_DamageMobj (player->mo, NULL, NULL, 20);
        if (player->health <= 10)
          G_ExitLevel();
        break;
      default:
        break;
      };
  }
  else 
  {
    switch ((sector->special&DAMAGE_MASK)>>DAMAGE_SHIFT)
    {
      case 0: 
        break;
      case 1: 
        if (!player->powers[pw_ironfeet])
          if (!(leveltime&0x1f))
            P_DamageMobj (player->mo, NULL, NULL, 5);
        break;
      case 2: 
        if (!player->powers[pw_ironfeet])
          if (!(leveltime&0x1f))
            P_DamageMobj (player->mo, NULL, NULL, 10);
        break;
      case 3: 
        if (!player->powers[pw_ironfeet]
            || (P_Random(pr_slimehurt)<5))  
        {
          if (!(leveltime&0x1f))
            P_DamageMobj (player->mo, NULL, NULL, 20);
        }
        break;
    }
    if (sector->special&SECRET_MASK)
    {
      player->secretcount++;
      sector->special &= ~SECRET_MASK;
      if (sector->special<32) 
        sector->special=0;    
    }
     If FRICTION_MASK or PUSH_MASK is set, we don't care at this
     point, since the code to deal with those situations is
     handled by Thinkers.
  }
}
void P_PlayerInSpecialSector ( player_t * player ) { sector_t * sector ; sector = player -> mo -> subsector -> sector ; if ( player -> mo -> z != sector -> floorheight ) return ; if ( sector -> special < 32 ) { switch ( sector -> special ) { case 5 : if ( ! player -> powers [ pw_ironfeet ] ) if ( ! ( leveltime & 0x1f ) ) P_DamageMobj ( player -> mo , NULL , NULL , 10 ) ; break ; case 7 : if ( ! player -> powers [ pw_ironfeet ] ) if ( ! ( leveltime & 0x1f ) ) P_DamageMobj ( player -> mo , NULL , NULL , 5 ) ; break ; case 16 : case 4 : if ( ! player -> powers [ pw_ironfeet ] || ( P_Random ( pr_slimehurt ) < 5 ) ) { if ( ! ( leveltime & 0x1f ) ) P_DamageMobj ( player -> mo , NULL , NULL , 20 ) ; } break ; case 9 : player -> secretcount ++ ; sector -> special = 0 ; break ; case 11 : if ( comp [ comp_god ] ) player -> cheats &= ~ CF_GODMODE ; if ( ! ( leveltime & 0x1f ) ) P_DamageMobj ( player -> mo , NULL , NULL , 20 ) ; if ( player -> health <= 10 ) G_ExitLevel ( ) ; break ; default : break ; } ; } else { switch ( ( sector -> special & DAMAGE_MASK ) >> DAMAGE_SHIFT ) { case 0 : break ; case 1 : if ( ! player -> powers [ pw_ironfeet ] ) if ( ! ( leveltime & 0x1f ) ) P_DamageMobj ( player -> mo , NULL , NULL , 5 ) ; break ; case 2 : if ( ! player -> powers [ pw_ironfeet ] ) if ( ! ( leveltime & 0x1f ) ) P_DamageMobj ( player -> mo , NULL , NULL , 10 ) ; break ; case 3 : if ( ! player -> powers [ pw_ironfeet ] || ( P_Random ( pr_slimehurt ) < 5 ) ) { if ( ! ( leveltime & 0x1f ) ) P_DamageMobj ( player -> mo , NULL , NULL , 20 ) ; } break ; } if ( sector -> special & SECRET_MASK ) { player -> secretcount ++ ; sector -> special &= ~ SECRET_MASK ; if ( sector -> special < 32 ) sector -> special = 0 ; } } }
P_PlayerInSpecialSector()
Called every tick frame
that the player origin is in a special sector
P_PlayerInSpecialSector () Called every tick frame that the player origin is in a special sector
// Falling, not all the way down yet? // Sector specials don't apply in mid-air // Has hit ground. //jff add if to handle old vs generalized types // regular sector specials // 5/10 unit damage per 31 ticks // 2/5 unit damage per 31 ticks // 10/20 unit damage per 31 ticks // 10/20 unit damage plus blinking light (light already spawned) // even with suit, take damage // Tally player in secret sector, clear secret special // Exit on health < 11, take 10/20 damage per 31 ticks /* killough 2/21/98: add compatibility switch */ // on godmode cheat clearing // does not affect invulnerability //jff 1/24/98 Don't exit as DOOM2 did, just ignore //jff 3/14/98 handle extended sector types for secrets and damage // no damage // 2/5 damage per 31 ticks // 5/10 damage per 31 ticks // 10/20 damage per 31 ticks // take damage even with suit // if all extended bits clear, // sector is not special anymore // phares 3/19/98: // // If FRICTION_MASK or PUSH_MASK is set, we don't care at this // point, since the code to deal with those situations is // handled by Thinkers.