Esempio n. 1
0
void P_MobjRemove(mobj_t *mo, dd_bool noRespawn)
{
#if !defined(__JDOOM__) && !defined(__JDOOM64__)
    DENG_UNUSED(noRespawn);
#endif

    if(mo->ddFlags & DDMF_REMOTE)
        goto justDoIt;

#if __JDOOM__ || __JDOOM64__
    if(!noRespawn)
    {
        if(
# if __JDOOM__
            // Only respawn items in deathmatch 2 and optionally in coop.
           !(COMMON_GAMESESSION->rules().deathmatch != 2 &&
             (!cfg.coopRespawnItems || !IS_NETGAME || COMMON_GAMESESSION->rules().deathmatch)) &&
# endif /*#elif __JDOOM64__
           (spot->flags & MTF_RESPAWN) &&
# endif*/
           (mo->flags & MF_SPECIAL) && !(mo->flags & MF_DROPPED)
# if __JDOOM__ || __JDOOM64__
           && (mo->type != MT_INV) && (mo->type != MT_INS)
# endif
           )
        {
            P_DeferSpawnMobj3fv(RESPAWNTICS, mobjtype_t(mo->type),
                                mo->spawnSpot.origin, mo->spawnSpot.angle,
                                mo->spawnSpot.flags, P_SpawnTelefog, NULL);
        }
    }
#endif

#if __JHEXEN__
    if((mo->flags & MF_COUNTKILL) && (mo->flags & MF_CORPSE))
    {
        P_RemoveCorpseInQueue(mo);
    }

    P_MobjRemoveFromTIDList(mo);
#endif

justDoIt:
    Mobj_Destroy(mo);
}
Esempio n. 2
0
void FastMonster_OnChange()
{
  static bool fast=false;
  static const struct {
    mobjtype_t type;
    float speed[2];
  } MonsterMissileInfo[] =
    {
      // doom
      { MT_BRUISERSHOT, {15, 20}},
      { MT_HEADSHOT,    {10, 20}},
      { MT_TROOPSHOT,   {10, 20}},
        
      // heretic
      { MT_IMPBALL,     {10, 20}},
      { MT_MUMMYFX1,    { 9, 18}},
      { MT_KNIGHTAXE,   { 9, 18}},
      { MT_REDAXE,      { 9, 18}},
      { MT_BEASTBALL,   {12, 20}},
      { MT_WIZFX1,      {18, 24}},
      { MT_SNAKEPRO_A,  {14, 20}},
      { MT_SNAKEPRO_B,  {14, 20}},
      { MT_HEADFX1,     {13, 20}},
      { MT_HEADFX3,     {10, 18}},
      { MT_MNTRFX1,     {20, 26}},
      { MT_MNTRFX2,     {14, 20}},
      { MT_SRCRFX1,     {20, 28}},
      { MT_SOR2FX1,     {20, 28}},
      
      { mobjtype_t(-1), {-1, -1} } // Terminator
    };

  int i;
  if (cv_fastmonsters.value && !fast)
    {
      for (i=S_SARG_RUN1 ; i<=S_SARG_PAIN2 ; i++)
	states[i].tics >>= 1;
      fast=true;
    }
  else if(!cv_fastmonsters.value && fast)
Esempio n. 3
0
// copy values from mobjinfo_t
ActorInfo::ActorInfo(const mobjinfo_t& m, int gm)
{
  mobjtype = mobjtype_t(&m - mobjinfo);

  if (m.classname)
    strncpy(classname, m.classname, CLASSNAME_LEN);
  else
    sprintf(classname, "class_%d", mobjtype);
  classname[CLASSNAME_LEN] = '\0';

  game = gm;
  obituary = string("%s got killed by an instance of ") + classname;
  spawn_always = false;

  doomednum = m.doomednum;
  spawnhealth = m.spawnhealth;
  reactiontime = m.reactiontime;
  painchance = m.painchance;
  speed = m.speed;
  radius = m.radius;
  height = m.height;
  mass = m.mass;
  damage = m.damage;

  flags = m.flags;
  flags2 = m.flags2;

  seesound    = m.seesound;
  attacksound = m.attacksound;
  painsound   = m.painsound;
  deathsound  = m.deathsound;
  activesound = m.activesound;

  spawnstate   = m.spawnstate;
  seestate     = m.seestate;
  meleestate   = m.meleestate;
  missilestate = m.missilestate;
  painstate    = m.painstate;
  deathstate   = m.deathstate;
  xdeathstate  = m.xdeathstate;
  crashstate   = m.crashstate;
  raisestate   = m.raisestate;

  touchf = m.touchf;

  // create labels
  for (int i=0; i<9; i++)
    {
      if ((&spawnstate)[i]) // HACK, works if struct is packed...
	{
	  statelabel_t temp;
	  strncpy(temp.label, StandardLabels[i], SL_LEN);

	  temp.dyn_states = false; // until states table is got rid of
	  temp.label_states = (&spawnstate)[i]; // HACK
	  temp.num_states = 10; // TODO guesstimate

	  temp.jumplabel[0] = '\0';
	  temp.jumplabelnum = -1;
	  temp.jumpoffset = 0;

	  labels.push_back(temp);
	}
    }
}
Esempio n. 4
0
int DActor::Marshal(LArchive &a)
{ 
  // NOTE is it really worth the effort to do this delta-coding?

  enum dactor_diff_e
  {
    MD_SPAWNPOINT = 0x000001,
    MD_TYPE       = 0x000002,
    MD_XY         = 0x000004,
    MD_Z          = 0x000008,
    MD_MOM        = 0x000010,
    MD_MASS       = 0x000020,
    MD_RADIUS     = 0x000040,
    MD_HEIGHT     = 0x000080,
    MD_HEALTH     = 0x000100,

    MD_FLAGS      = 0x000200,
    MD_FLAGS2     = 0x000400,
    MD_EFLAGS     = 0x000800,

    MD_TID        = 0x001000,
    MD_SPECIAL    = 0x002000,
    MD_RTIME      = 0x004000,
    MD_FLOORCLIP  = 0x008000,
    MD_TEAM       = 0x010000,

    MD_STATE      = 0x020000,
    MD_TICS       = 0x040000,
    MD_MOVEDIR    = 0x080000,
    MD_MOVECOUNT  = 0x100000,
    MD_THRESHOLD  = 0x200000,
    MD_LASTLOOK   = 0x400000,
    MD_SPECIAL1   = 0x800000,
    MD_SPECIAL2  = 0x1000000,
    MD_SPECIAL3  = 0x2000000,

    MD_TARGET    = 0x4000000,
    MD_OWNER     = 0x8000000,
  };

  int temp;
  short stemp;
  int i;

  unsigned diff;

  if (a.IsStoring())
    {
      // find the differences
      if (spawnpoint)
	{
	  diff = MD_SPAWNPOINT;
    
	  if ((pos.x != spawnpoint->x) || (pos.y != spawnpoint->y) ||
	      (yaw != unsigned(ANG45 * (spawnpoint->angle/45))) || pitch)
	    diff |= MD_XY;

	  if (type != spawnpoint->ai->GetMobjType())
	    diff |= MD_TYPE;
	}
      else
	{
	  // not a map spawned thing so make it from scratch
	  diff = MD_XY | MD_TYPE;
	}

      // not the default but the most probable
      if (pos.z != floorz)             diff |= MD_Z;
      if (vel != vec_t<fixed_t>(0,0,0)) diff |= MD_MOM;

      if (mass   != info->mass)        diff |= MD_MASS;
      if (radius != info->radius)      diff |= MD_RADIUS;
      if (height != info->height)      diff |= MD_HEIGHT;

      if (health != info->spawnhealth) diff |= MD_HEALTH;
      if (flags  != info->flags)       diff |= MD_FLAGS;
      if (flags2 != info->flags2)      diff |= MD_FLAGS2;
      if (eflags)                      diff |= MD_EFLAGS;

      if (tid)       diff |= MD_TID;
      if (special)   diff |= MD_SPECIAL;
      if (reactiontime != info->reactiontime) diff |= MD_RTIME;
      if (floorclip != 0) diff |= MD_FLOORCLIP;
      if (team) diff |= MD_TEAM;

      if (state != info->spawnstate)   diff |= MD_STATE;
      if (tics  != state->tics)        diff |= MD_TICS;

      if (movedir)        diff |= MD_MOVEDIR;
      if (movecount)      diff |= MD_MOVECOUNT;
      if (threshold)      diff |= MD_THRESHOLD;
      if (lastlook != -1) diff |= MD_LASTLOOK;
      if (special1)  diff |= MD_SPECIAL1;
      if (special2)  diff |= MD_SPECIAL2;
      if (special3)  diff |= MD_SPECIAL3;

      if (owner)   diff |= MD_OWNER;
      if (target)  diff |= MD_TARGET;

      a << diff; // store the bit field

      if (diff & MD_SPAWNPOINT)
	{
	  stemp = spawnpoint - mp->mapthings;
	  a << stemp;
	}

      if (diff & MD_TYPE) a << (stemp = type);

      if (diff & MD_XY)   a << pos.x << pos.y << yaw << pitch;
      if (diff & MD_Z)    a << pos.z;
      if (diff & MD_MOM)  a << vel;

      if (diff & MD_MASS)   a << mass;
      if (diff & MD_RADIUS) a << radius;
      if (diff & MD_HEIGHT) a << height;
      if (diff & MD_HEALTH) a << health;

      if (diff & MD_FLAGS)  a << flags;
      if (diff & MD_FLAGS2) a << flags2;
      if (diff & MD_EFLAGS) a << eflags;

      if (diff & MD_TID)    a << tid;
      if (diff & MD_SPECIAL)
	{
	  a << special;
	  for (i=0; i<5; i++)
	    a << args[i];
	}
      if (diff & MD_RTIME)     a << reactiontime;
      if (diff & MD_FLOORCLIP) a << floorclip;
      if (diff & MD_TEAM)      a << team;

      if (diff & MD_STATE)
	{
	  temp = state - states;
	  a << temp;
	}
      if (diff & MD_TICS)      a << tics;

      if (diff & MD_MOVEDIR)   a << movedir;
      if (diff & MD_MOVECOUNT) a << movecount;
      if (diff & MD_THRESHOLD) a << threshold;
      if (diff & MD_LASTLOOK)  a << lastlook;

      if (diff & MD_SPECIAL1)  a << special1;
      if (diff & MD_SPECIAL2)  a << special2;
      if (diff & MD_SPECIAL3)  a << special3;

      if (diff & MD_OWNER)  Thinker::Serialize(owner, a);
      if (diff & MD_TARGET) Thinker::Serialize(target, a);
    }
  else
    {
      // retrieving
      a << diff;

      if (diff & MD_SPAWNPOINT)
	{
	  a << stemp;
	  spawnpoint = mp->mapthings + stemp;
	  spawnpoint->mobj = this;
	}

      if (diff & MD_TYPE)
	{
	  a << stemp;
	  type = mobjtype_t(stemp);
	}
      else
	type = spawnpoint->ai->GetMobjType();

      info = aid[type];
      {
	// use info for init, correct later
	mass         = info->mass;
	radius       = info->radius;
	height       = info->height;
	health       = info->spawnhealth;
	flags        = info->flags;
	flags2       = info->flags2;
	reactiontime = info->reactiontime;
	state        = info->spawnstate;
      }

      if (diff & MD_XY)
	a << pos.x << pos.y << yaw << pitch;
      else
	{
	  pos.x = spawnpoint->x;
	  pos.y = spawnpoint->y;
	  yaw = ANG45 * (spawnpoint->angle/45);
	  pitch = 0;
	}

      if (diff & MD_Z)      a << pos.z;
      if (diff & MD_MOM)    a << vel; // else zero (by constructor)

      if (diff & MD_MASS)   a << mass;
      if (diff & MD_RADIUS) a << radius;
      if (diff & MD_HEIGHT) a << height;
      if (diff & MD_HEALTH) a << health;

      if (diff & MD_FLAGS)  a << flags;
      if (diff & MD_FLAGS2) a << flags2;
      if (diff & MD_EFLAGS) a << eflags;

      if (diff & MD_TID)      a << tid;
      if (diff & MD_SPECIAL)
	{
	  a << special;
	  for (i=0; i<5; i++)
	    a << args[i];
	}
      if (diff & MD_RTIME)     a << reactiontime;
      if (diff & MD_FLOORCLIP) a << floorclip;
      if (diff & MD_TEAM)      a << team;

      if (diff & MD_STATE)
	{
	  a << temp;
	  state = &states[temp];
	}
      if (diff & MD_TICS)
	a << tics;
      else
	tics = state->tics;

      if (diff & MD_MOVEDIR)   a << movedir;
      if (diff & MD_MOVECOUNT) a << movecount;
      if (diff & MD_THRESHOLD) a << threshold;
      if (diff & MD_LASTLOOK)  a << lastlook;

      if (diff & MD_SPECIAL1)  a << special1;
      if (diff & MD_SPECIAL2)  a << special2;
      if (diff & MD_SPECIAL3)  a << special3;

      if (diff & MD_OWNER)  owner  = reinterpret_cast<Actor*>(Thinker::Unserialize(a));
      if (diff & MD_TARGET) target = reinterpret_cast<Actor*>(Thinker::Unserialize(a));

      // set sprev, snext, bprev, bnext, subsector
      if (mp)
	{
	  floorz = ceilingz = 0; // TEST
	  SetPosition();
	}

      if (!(diff & MD_Z))
	pos.z = floorz;

      if (!info->modelname.empty())
	pres = new modelpres_t(info->modelname.c_str());
      else
	pres = new spritepres_t(info, 0);
  
      pres->SetFrame(state);
    }

  return 0;
}