⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 p_spec.c

📁 The source code of Doom legacy for windows
💻 C
📖 第 1 页 / 共 5 页
字号:
      if      (        !(player->cards & it_bluecard) &&        (!skulliscard || !(player->cards & it_blueskull))      )      {        player->message = skulliscard? PD_BLUEK : PD_BLUEC;#ifdef HW3SOUND        S_StartScreamSound(player->mo, sfx_oof);#else        S_StartSound(player->mo,sfx_oof);#endif        return false;      }      break;    case YCard:      if      (        !(player->cards & it_yellowcard) &&        (!skulliscard || !(player->cards & it_yellowskull))      )      {        player->message = skulliscard? PD_YELLOWK : PD_YELLOWC;#ifdef HW3SOUND        S_StartScreamSound(player->mo, sfx_oof);#else        S_StartSound(player->mo,sfx_oof);#endif        return false;      }      break;    case RSkull:      if      (        !(player->cards & it_redskull) &&        (!skulliscard || !(player->cards & it_redcard))      )      {        player->message = skulliscard? PD_REDK : PD_REDS;#ifdef HW3SOUND        S_StartScreamSound(player->mo, sfx_oof);#else        S_StartSound(player->mo,sfx_oof);#endif        return false;      }      break;    case BSkull:      if      (        !(player->cards & it_blueskull) &&        (!skulliscard || !(player->cards & it_bluecard))      )      {        player->message = skulliscard? PD_BLUEK : PD_BLUES;#ifdef HW3SOUND        S_StartScreamSound(player->mo, sfx_oof);#else        S_StartSound(player->mo,sfx_oof);#endif        return false;      }      break;    case YSkull:      if      (        !(player->cards & it_yellowskull) &&        (!skulliscard || !(player->cards & it_yellowcard))      )      {        player->message = skulliscard? PD_YELLOWK : PD_YELLOWS;#ifdef HW3SOUND        S_StartScreamSound(player->mo, sfx_oof);#else        S_StartSound(player->mo,sfx_oof);#endif        return false;      }      break;    case AllKeys:      if      (        !skulliscard &&        (          !(player->cards & it_redcard) ||          !(player->cards & it_redskull) ||          !(player->cards & it_bluecard) ||          !(player->cards & it_blueskull) ||          !(player->cards & it_yellowcard) ||          !(player->cards & it_yellowskull)        )      )      {        player->message = PD_ALL6;#ifdef HW3SOUND        S_StartScreamSound(player->mo, sfx_oof);#else        S_StartSound(player->mo,sfx_oof);#endif        return false;      }      if      (        skulliscard &&        (          (!(player->cards & it_redcard) &&            !(player->cards & it_redskull)) ||          (!(player->cards & it_bluecard) &&            !(player->cards & it_blueskull)) ||          (!(player->cards & it_yellowcard) &&            !(player->cards & it_yellowskull))        )      )      {        player->message = PD_ALL3;#ifdef HW3SOUND        S_StartScreamSound(player->mo, sfx_oof);#else        S_StartSound(player->mo,sfx_oof);#endif        return false;      }      break;  }  return true;}//// P_SectorActive()//// Passed a linedef special class (floor, ceiling, lighting) and a sector// returns whether the sector is already busy with a linedef special of the// same class. If old demo compatibility true, all linedef special classes// are the same.////int P_SectorActive(special_e t,sector_t *sec){  if (!boomsupport)    return sec->floordata || sec->ceilingdata || sec->lightingdata;  else    switch (t)    {      case floor_special:        return (int)sec->floordata;      case ceiling_special:        return (int)sec->ceilingdata;      case lighting_special:        return (int)sec->lightingdata;    }  return 1;}//SoM: 3/7/2000//// P_CheckTag()//// Passed a line, returns true if the tag is non-zero or the line special// allows no tag without harm. If compatibility, all linedef specials are// allowed to have zero tag.//// Note: Only line specials activated by walkover, pushing, or shooting are//       checked by this routine.////int P_CheckTag(line_t *line){  if (!boomsupport)    return 1;  if (line->tag)    return 1;  switch(line->special)  {    case 1:                 // Manual door specials    case 26:    case 27:    case 28:    case 31:    case 32:    case 33:    case 34:    case 117:    case 118:    case 139:               // Lighting specials    case 170:    case 79:    case 35:    case 138:    case 171:    case 81:    case 13:    case 192:    case 169:    case 80:    case 12:    case 194:    case 173:    case 157:    case 104:    case 193:    case 172:    case 156:    case 17:    case 195:               // Thing teleporters    case 174:    case 97:    case 39:    case 126:    case 125:    case 210:    case 209:    case 208:    case 207:    case 11:                // Exits    case 52:    case 197:    case 51:    case 124:    case 198:    case 48:                // Scrolling walls    case 85:    // FraggleScript types!    case 272:   // WR    case 273:    case 274:   // W1    case 275:    case 276:   // SR    case 277:   // S1    case 278:   // GR    case 279:   // G1      return 1;   // zero tag allowed    case 105: if( gamemode == heretic )                  return 1;    default:      break;  }  return 0;       // zero tag not allowed}//SoM: 3/7/2000: Is/WasSecret.//// P_IsSecret()//// Passed a sector, returns if the sector secret type is still active, i.e.// secret type is set and the secret has not yet been obtained.//boolean P_IsSecret(sector_t *sec){  return (sec->special==9 || (sec->special&SECRET_MASK));}//// P_WasSecret()//// Passed a sector, returns if the sector secret type is was active, i.e.// secret type was set and the secret has been obtained already.//boolean P_WasSecret(sector_t *sec){  return (sec->oldspecial==9 || (sec->oldspecial&SECRET_MASK));}//// EVENTS// Events are operations triggered by using, crossing,// or shooting special lines, or by timed thinkers.////// P_CrossSpecialLine - TRIGGER// Called every time a thing origin is about//  to cross a line with a non 0 special.//voidP_CrossSpecialLine( int           linenum,  int           side,  mobj_t*       thing ){    line_t*     line;    line = &lines[linenum];    P_ActivateCrossedLine(line, side, thing);}voidP_ActivateCrossedLine( line_t*       line,  int           side,  mobj_t*       thing){    int         ok;    int         forceuse; //SoM: 4/26/2000: ALLTRIGGER should allow monsters to use generalized types too!    forceuse = line->flags & ML_ALLTRIGGER && thing->type != MT_BLOOD;    //  Triggers that other things can activate    if (!thing->player && gamemode != heretic)    {        // Things that should NOT trigger specials...        switch(thing->type)        {          case MT_ROCKET:          case MT_PLASMA:          case MT_BFG:          case MT_TROOPSHOT:          case MT_HEADSHOT:          case MT_BRUISERSHOT:            return;            break;          default: break;        }    }    //SoM: 3/7/2000: Check for generalized line types/    if (boomsupport)    {      // pointer to line function is NULL by default, set non-null if      // line special is walkover generalized linedef type      int (*linefunc)(line_t *line)=NULL;        // check each range of generalized linedefs      if ((unsigned)line->special >= GenFloorBase)      {        if (!thing->player)          if (((line->special & FloorChange) || !(line->special & FloorModel)) && !forceuse)            return;     // FloorModel is "Allow Monsters" if FloorChange is 0        if (!line->tag)          return;        linefunc = EV_DoGenFloor;      }      else if ((unsigned)line->special >= GenCeilingBase)      {        if (!thing->player)          if (((line->special & CeilingChange) || !(line->special & CeilingModel)) && !forceuse)            return;     // CeilingModel is "Allow Monsters" if CeilingChange is 0        if (!line->tag)          return;        linefunc = EV_DoGenCeiling;      }      else if ((unsigned)line->special >= GenDoorBase)      {        if (!thing->player)        {          if (!(line->special & DoorMonster) && !forceuse)            return;                    // monsters disallowed from this door          if (line->flags & ML_SECRET) // they can't open secret doors either            return;        }        if (!line->tag)          return;        linefunc = EV_DoGenDoor;      }      else if ((unsigned)line->special >= GenLockedBase)      {        if (!thing->player)          return;                     // monsters disallowed from unlocking doors        if (((line->special&TriggerType)==WalkOnce) || ((line->special&TriggerType)==WalkMany))        {          if (!P_CanUnlockGenDoor(line,thing->player))            return;        }        else          return;        linefunc = EV_DoGenLockedDoor;      }      else if ((unsigned)line->special >= GenLiftBase)      {        if (!thing->player)          if (!(line->special & LiftMonster) && !forceuse)            return; // monsters disallowed        if (!line->tag)          return;        linefunc = EV_DoGenLift;      }      else if ((unsigned)line->special >= GenStairsBase)      {        if (!thing->player)          if (!(line->special & StairMonster) && !forceuse)            return; // monsters disallowed        if (!line->tag)          return;        linefunc = EV_DoGenStairs;      }      else if ((unsigned)line->special >= GenCrusherBase)      {        if (!thing->player)          if (!(line->special & StairMonster) && !forceuse)            return; // monsters disallowed        if (!line->tag)          return;        linefunc = EV_DoGenCrusher;      }        if (linefunc) // if it was a valid generalized type        switch((line->special & TriggerType) >> TriggerTypeShift)        {          case WalkOnce:            if (linefunc(line))              line->special = 0;    // clear special if a walk once type            return;          case WalkMany:            linefunc(line);            return;          default:                  // if not a walk type, do nothing here            return;        }      }      if(!thing->player)      {        ok = 0;        if( gamemode == heretic && (line->special == 4 || line->special==39 || line->special == 97) )            ok = 1;        else        switch(line->special)        {          case 39:      // TELEPORT TRIGGER          case 97:      // TELEPORT RETRIGGER          case 125:     // TELEPORT MONSTERONLY TRIGGER          case 126:     // TELEPORT MONSTERONLY RETRIGGER          case 4:       // RAISE DOOR          case 10:      // PLAT DOWN-WAIT-UP-STAY TRIGGER          case 88:      // PLAT DOWN-WAIT-UP-STAY RETRIGGER            ok = 1;            break;           // SoM: 3/4/2000: Add boom compatibility for extra monster usable          // linedef types.          case 208:     //SoM: Silent thing teleporters          case 207:          case 243:     //Silent line to line teleporter          case 244:     //Same as above but trigger once.          case 262:     //Same as 243 but reversed          case 263:     //Same as 244 but reversed          case 264:     //Monster only, silent, trigger once, reversed          case 265:     //Same as 264 but repeatable          case 266:     //Monster only, silent, trigger once          case 267:     //Same as 266 bot repeatable          case 268:     //Monster only, silent, trigger once, set pos to thing          case 269:     //Monster only, silent, repeatable, set pos to thing            if(boomsupport)              ok = 1;            break;        }        //SoM: Anything can trigger this line!        if(line->flags & ML_ALLTRIGGER)          ok = 1;        if (!ok)            return;    }    if (!P_CheckTag(line) && boomsupport)      return;    // Note: could use some const's here.    switch (line->special)    {        // TRIGGERS.        // All from here to RETRIGGERS.      case 2:        // Open Door        if(EV_DoDoor(line,dooropen,VDOORSPEED) || !boomsupport)          line->special = 0;        break;      case 3:        // Close Door        if(EV_DoDoor(line,doorclose,VDOORSPEED) || !boomsupport)          line->special = 0;        break;      case 4:        // Raise Door        if(EV_DoDoor(line,normalDoor,VDOORSPEED) || !boomsupport)          line->special = 0;        break;      case 5:        // Raise Floor        if(EV_DoFloor(line,raiseFloor) || !boomsupport)          line->special = 0;        break;      case 6:        // Fast Ceiling Crush & Raise        if(EV_DoCeiling(line,fastCrushAndRaise) || !boomsupport)          line->special = 0;        break;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -