Example #1
0
//
// ACS_funcReplaceTextures
//
static void ACS_funcReplaceTextures(ACS_FUNCARG)
{
   int      oldtex = R_FindWall(ACSVM::GetString(args[0]));
   int      newtex = R_FindWall(ACSVM::GetString(args[1]));
   uint32_t flags  = args[2];

   // If doing anything to lines.
   if((flags & RETEX_NOT_LINE) != RETEX_NOT_LINE)
   {
      for(side_t *side = sides, *end = side + numsides; side != end; ++side)
      {
         if(!(flags & RETEX_NOT_BOTTOM) && side->bottomtexture == oldtex)
            side->bottomtexture = newtex;

         if(!(flags & RETEX_NOT_MID) && side->midtexture == oldtex)
            side->midtexture = newtex;

         if(!(flags & RETEX_NOT_TOP) && side->toptexture == oldtex)
            side->toptexture = newtex;
      }
   }

   // If doing anything to sectors.
   if((flags & RETEX_NOT_SECTOR) != RETEX_NOT_SECTOR)
   {
      for(sector_t *sector = sectors, *end = sector + numsectors; sector != end; ++sector)
      {
         if(!(flags & RETEX_NOT_FLOOR) && sector->floorpic == oldtex)
            sector->floorpic = newtex;

         if(!(flags & RETEX_NOT_CEIL) && sector->ceilingpic == oldtex)
            sector->ceilingpic = newtex;
      }
   }
}
Example #2
0
//
// P_InitSwitchList()
//
// Only called at game initialization in order to list the set of switches
// and buttons known to the engine. This enables their texture to change
// when activated, and in the case of buttons, change back after a timeout.
//
// This routine modified to read its data from a predefined lump or
// PWAD lump called SWITCHES rather than a static table in this module to
// allow wad designers to insert or modify switches.
//
// Lump format is an array of byte packed switchlist_t structures, terminated
// by a structure with episode == -0. The lump can be generated from a
// text source file using SWANTBLS.EXE, distributed with the BOOM utils.
// The standard list of switches and animations is contained in the example
// source text file DEFSWANI.DAT also in the BOOM util distribution.
//
// Rewritten by Lee Killough to remove limit 2/8/98
//
void P_InitSwitchList(void)
{
   int index = 0;
   int episode; 
   switchlist_t *alphSwitchList;         //jff 3/23/98 pointer to switch table
   int lumpnum = -1;

   episode = GameModeInfo->switchEpisode;

   //jff 3/23/98 read the switch table from a predefined lump

   // haleyjd 08/29/09: run down the hash chain for SWITCHES
   WadChainIterator wci(wGlobalDir, "SWITCHES");
   for(wci.begin(); wci.current(); wci.next())
   {
      // look for a lump which is of a possibly good size
      if(wci.testLump() &&
         (*wci)->size % sizeof(switchlist_t) == 0)
      {
         lumpnum = (*wci)->selfindex;
         break;
      }
   }

   if(lumpnum < 0)
      I_Error("P_InitSwitchList: missing SWITCHES lump\n");

   alphSwitchList = (switchlist_t *)(wGlobalDir.cacheLumpNum(lumpnum, PU_STATIC));

   for(int i = 0; ; i++)
   {
      if(index + 1 >= max_numswitches)
      {
         max_numswitches = max_numswitches ? max_numswitches * 2 : 8;
         switchlist = erealloc(int *, switchlist, sizeof(*switchlist) * max_numswitches);
      }
      if(SwapShort(alphSwitchList[i].episode) <= episode) //jff 5/11/98 endianess
      {
         if(!SwapShort(alphSwitchList[i].episode))
            break;
         switchlist[index++] =
            R_FindWall(alphSwitchList[i].name1);
         switchlist[index++] =
            R_FindWall(alphSwitchList[i].name2);
      }
   }
Example #3
0
//
// P_InitLightning(void)
//
// Called from P_SetupLevel
//
void P_InitLightning(void)
{
    if(!LevelInfo.hasLightning)
        LightningFlash = 0;
    else
    {
        LevelSky = skytexture;

        if(LevelInfo.altSkyName)
            LevelTempSky = R_FindWall(LevelInfo.altSkyName);
        else
            LevelTempSky = -1;

        LightningFlash = 0;
        NextLightningFlash = ((M_Random() & 15) + 5) * 35;
    }
}
Example #4
0
//
// P_InitLightning(void)
//
// Called from P_SetupLevel
//
void P_InitLightning()
{  
   if(!LevelInfo.hasLightning)
      LightningFlash = 0;
   else
   {
      skyflat_t *sky1 = R_SkyFlatForIndex(0);

      if(!sky1)
         return;

      LevelSky = sky1->texture;
      
      if(LevelInfo.altSkyName)
         LevelTempSky = R_FindWall(LevelInfo.altSkyName);
      else
         LevelTempSky = -1;
      
      LightningFlash = 0;      
      NextLightningFlash = ((M_Random() & 15) + 5) * 35;
   }
}
Example #5
0
//
// ACS_ChkThingVar
//
bool ACS_ChkThingVar(Mobj *thing, uint32_t var, int32_t val)
{
   if(!thing) return false;

   switch(var)
   {
   case ACS_THINGVAR_Health:       return thing->health == val;
   case ACS_THINGVAR_Speed:        return thing->info->speed == val;
   case ACS_THINGVAR_Damage:       return thing->damage == val;
   case ACS_THINGVAR_Alpha:        return thing->translucency == val;
   case ACS_THINGVAR_RenderStyle:  return false;
   case ACS_THINGVAR_SeeSound:     return false;
   case ACS_THINGVAR_AttackSound:  return false;
   case ACS_THINGVAR_PainSound:    return false;
   case ACS_THINGVAR_DeathSound:   return false;
   case ACS_THINGVAR_ActiveSound:  return false;
   case ACS_THINGVAR_Ambush:       return !!(thing->flags & MF_AMBUSH) == !!val;
   case ACS_THINGVAR_Invulnerable: return !!(thing->flags2 & MF2_INVULNERABLE) == !!val;
   case ACS_THINGVAR_JumpZ:        return false;
   case ACS_THINGVAR_ChaseGoal:    return false;
   case ACS_THINGVAR_Frightened:   return false;
   case ACS_THINGVAR_Friendly:     return !!(thing->flags & MF_FRIEND) == !!val;
   case ACS_THINGVAR_SpawnHealth:  return thing->info->spawnhealth == val;
   case ACS_THINGVAR_Dropped:      return !!(thing->flags & MF_DROPPED) == !!val;
   case ACS_THINGVAR_NoTarget:     return false;
   case ACS_THINGVAR_Species:      return false;
   case ACS_THINGVAR_NameTag:      return false;
   case ACS_THINGVAR_Score:        return false;
   case ACS_THINGVAR_NoTrigger:    return false;
   case ACS_THINGVAR_DamageFactor: return false;
   case ACS_THINGVAR_MasterTID:    return false;
   case ACS_THINGVAR_TargetTID:    return thing->target ? thing->target->tid == val : false;
   case ACS_THINGVAR_TracerTID:    return thing->tracer ? thing->tracer->tid == val : false;
   case ACS_THINGVAR_WaterLevel:   return false;
   case ACS_THINGVAR_ScaleX:       return M_FloatToFixed(thing->xscale) == val;
   case ACS_THINGVAR_ScaleY:       return M_FloatToFixed(thing->yscale) == val;
   case ACS_THINGVAR_Dormant:      return !!(thing->flags2 & MF2_DORMANT) == !!val;
   case ACS_THINGVAR_Mass:         return thing->info->mass == val;
   case ACS_THINGVAR_Accuracy:     return false;
   case ACS_THINGVAR_Stamina:      return false;
   case ACS_THINGVAR_Height:       return thing->height == val;
   case ACS_THINGVAR_Radius:       return thing->radius == val;
   case ACS_THINGVAR_ReactionTime: return thing->reactiontime == val;
   case ACS_THINGVAR_MeleeRange:   return MELEERANGE == val;
   case ACS_THINGVAR_ViewHeight:   return false;
   case ACS_THINGVAR_AttackZOff:   return false;
   case ACS_THINGVAR_StencilColor: return false;
   case ACS_THINGVAR_Friction:     return false;
   case ACS_THINGVAR_DamageMult:   return false;

   case ACS_THINGVAR_Angle:          return thing->angle >> 16 == (uint32_t)val;
   case ACS_THINGVAR_Armor:          return thing->player ? thing->player->armorpoints == val : false;
      // ioanch 20160116: extreme sector (portal aware)
   case ACS_THINGVAR_CeilingTexture: return P_ExtremeSectorAtPoint(thing, true)->ceilingpic == R_FindWall(ACSVM::GetString(val));
   case ACS_THINGVAR_CeilingZ:       return thing->ceilingz == val;
   case ACS_THINGVAR_FloorTexture:   return P_ExtremeSectorAtPoint(thing, false)->floorpic == R_FindWall(ACSVM::GetString(val));
   case ACS_THINGVAR_FloorZ:         return thing->floorz == val;
   case ACS_THINGVAR_Frags:          return thing->player ? thing->player->totalfrags == val : false;
   case ACS_THINGVAR_LightLevel:     return thing->subsector->sector->lightlevel == val;
   case ACS_THINGVAR_MomX:           return thing->momx == val;
   case ACS_THINGVAR_MomY:           return thing->momy == val;
   case ACS_THINGVAR_MomZ:           return thing->momz == val;
   case ACS_THINGVAR_Pitch:          return thing->player ? thing->player->pitch >> 16 == val : false;
   case ACS_THINGVAR_PlayerNumber:   return thing->player ? thing->player - players == val : false;
   case ACS_THINGVAR_SigilPieces:    return false;
   case ACS_THINGVAR_TID:            return thing->tid == val;
   case ACS_THINGVAR_Type:           return thing->type == E_ThingNumForName(ACSVM::GetString(val));
   case ACS_THINGVAR_X:              return thing->x == val;
   case ACS_THINGVAR_Y:              return thing->y == val;
   case ACS_THINGVAR_Z:              return thing->z == val;

   default: return false;
   }
}