当前位置: 首页>>代码示例>>C++>>正文


C++ P_SetMobjState函数代码示例

本文整理汇总了C++中P_SetMobjState函数的典型用法代码示例。如果您正苦于以下问题:C++ P_SetMobjState函数的具体用法?C++ P_SetMobjState怎么用?C++ P_SetMobjState使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了P_SetMobjState函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: ACS_funcSetThingState

//
// ACS_funcSetThingState
//
static void ACS_funcSetThingState(ACS_FUNCARG)
{
   int32_t     tid       = args[0];
   const char *statename = ACSVM::GetString(args[1]);
   statenum_t  statenum  = E_StateNumForName(statename);
   state_t    *state;
   int32_t     count     = 0;
   Mobj       *mo        = NULL;

   while((mo = P_FindMobjFromTID(tid, mo, thread->trigger)))
   {
      // Look for the named state for that type.
      if((state = E_GetJumpInfo(mo->info, statename)))
      {
         P_SetMobjState(mo, state->index);
         ++count;
      }
      // Otherwise, fall back to the global name.
      else if(statenum >= 0)
      {
         P_SetMobjState(mo, statenum);
         ++count;
      }
   }

   *retn++ = count;
}
开发者ID:Blastfrog,项目名称:eternity,代码行数:30,代码来源:acs_func.cpp

示例2: A_SpidRefire

//
// A_SpidRefire
//
// Spider Mastermind line-of-sight checking.
//
void A_SpidRefire(actionargs_t *actionargs)
{
   Mobj *actor = actionargs->actor;

   // keep firing unless target got out of sight
   A_FaceTarget(actionargs);
   
   // killough 12/98: Stop firing if a friend has gotten in the way
   if(actor->flags & MF_FRIEND && P_HitFriend(actor))
   {
      P_SetMobjState(actor, actor->info->seestate);
      return;
   }
   
   if(P_Random(pr_spidrefire) < 10)
      return;

   // killough 11/98: prevent refiring on friends continuously
   if(!actor->target || actor->target->health <= 0    ||
      actor->flags & actor->target->flags & MF_FRIEND ||
      !P_CheckSight(actor, actor->target))
   {
      P_SetMobjState(actor, actor->info->seestate);
   }
}
开发者ID:twinaphex,项目名称:eternity,代码行数:30,代码来源:a_doom.cpp

示例3: DeactivateThing

static boolean DeactivateThing(mobj_t *mobj)
{
	if(mobj->flags & MF_COUNTKILL)
	{							// Monster
		if(!(mobj->flags2 & MF2_DORMANT))
		{
			mobj->flags2 |= MF2_DORMANT;
			mobj->tics = -1;
			return true;
		}
		return false;
	}
	switch (mobj->type)
	{
	case MT_ZTWINEDTORCH:
	case MT_ZTWINEDTORCH_UNLIT:
		P_SetMobjState(mobj, S_ZTWINEDTORCH_UNLIT);
		break;
	case MT_ZWALLTORCH:
	case MT_ZWALLTORCH_UNLIT:
		P_SetMobjState(mobj, S_ZWALLTORCH_U);
		break;
	case MT_THRUSTFLOOR_UP:
	case MT_THRUSTFLOOR_DOWN:
		if(mobj->args[0] == 1)
		{
			S_StartSound(SFX_THRUSTSPIKE_RAISE, mobj);
			if(mobj->args[1])
				P_SetMobjState(mobj, S_BTHRUSTLOWER);
			else
				P_SetMobjState(mobj, S_THRUSTLOWER);
		}
		break;
	case MT_ZFIREBULL:
	case MT_ZFIREBULL_UNLIT:
		P_SetMobjState(mobj, S_ZFIREBULL_DEATH);
		break;
	case MT_ZCAULDRON:
	case MT_ZCAULDRON_UNLIT:
		P_SetMobjState(mobj, S_ZCAULDRON_U);
		break;
	case MT_FLAME_SMALL:
		P_SetMobjState(mobj, S_FLAME_SDORM1);
		break;
	case MT_FLAME_LARGE:
		P_SetMobjState(mobj, S_FLAME_LDORM1);
		break;
	case MT_BAT_SPAWNER:
		P_SetMobjState(mobj, S_SPAWNBATS_OFF);
		break;
	default:
		return false;
		break;
	}
	return true;
}
开发者ID:amitahire,项目名称:development,代码行数:56,代码来源:P_things.c

示例4: P_SpawnBlood

void P_SpawnBlood (fixed_t x, fixed_t y, fixed_t z, int damage)
{
    mobj_t	*th;

    z += ((P_Random()-P_Random())<<10);
    th = P_SpawnMobj (x,y,z, MT_BLOOD);
    th->momz = FRACUNIT*2;
    th->tics -= P_Random()&1;
    if (th->tics<1)
        th->tics = 1;
    if (damage <= 12 && damage >= 9)
        P_SetMobjState (th,S_BLOOD2);
    else if (damage < 9)
        P_SetMobjState (th,S_BLOOD3);
}
开发者ID:jaguar64,项目名称:samples,代码行数:15,代码来源:p_mobj.c

示例5: Command_CauseCfail_f

// You never thought you needed this, did you? >=D
// Yes, this has the specific purpose of completely screwing you up
// to see if the consistency restoration code can fix you.
// Don't enable this for normal builds...
void Command_CauseCfail_f(void)
{
	if (consoleplayer == serverplayer)
	{
		CONS_Printf("Your reality is everyone's reality. Therefore, you should not use this command.\n");
		return;
	}

	P_UnsetThingPosition(players[consoleplayer].mo);
	P_Random();
	P_Random();
	P_Random();
	players[consoleplayer].mo->x = 0;
	players[consoleplayer].mo->y = 123311; //cfail cansuled kthxbye
	players[consoleplayer].mo->z = 123311;
	players[consoleplayer].score = 1337;
	players[consoleplayer].health = 1337;
	players[consoleplayer].mo->destscale = 25;
	P_SetThingPosition(players[consoleplayer].mo);

	// CTF consistency test
	if (gametype == GT_CTF)
	{
		if (blueflag)
			P_SetMobjState(blueflag, S_DISS);
		if (redflag)
		{
			redflag->x = 423423;
			redflag->y = 666;
			redflag->z = 123311;
		}
	}
}
开发者ID:Pupswoof117,项目名称:SRB2-Public,代码行数:37,代码来源:m_cheat.c

示例6: A_FireShotgun2

void A_FireShotgun2(player_t *player, pspdef_t *psp)
{
  int i;

  CHECK_WEAPON_CODEPOINTER("A_FireShotgun2", player);

  S_StartSound(player->mo, sfx_dshtgn);
  P_SetMobjState(player->mo, S_PLAY_ATK2);
  player->ammo[weaponinfo[player->readyweapon].ammo] -= 2;

  A_FireSomething(player,0);                                      // phares

  P_BulletSlope(player->mo);

  for (i=0; i<20; i++)
    {
      int damage = 5*(P_Random(pr_shotgun)%3+1);
      angle_t angle = player->mo->angle;
      // killough 5/5/98: remove dependence on order of evaluation:
      int t = P_Random(pr_shotgun);
      angle += (t - P_Random(pr_shotgun))<<19;
      t = P_Random(pr_shotgun);
      P_LineAttack(player->mo, angle, MISSILERANGE, bulletslope +
                   ((t - P_Random(pr_shotgun))<<5), damage);
    }
}
开发者ID:Mistranger,项目名称:prboom-plus,代码行数:26,代码来源:p_pspr.c

示例7: A_FireShotgun2

void A_FireShotgun2(player_t* player, pspdef_t* psp)
{
    int 		i;
    angle_t 	angle;
    int 		damage;
    
    S_StartSound(player->mo, sfx_sht2fire);
    P_SetMobjState(player->mo, S_007);
    player->ammo[weaponinfo[player->readyweapon].ammo] -= 2;
    
    P_SetPsprite(player, ps_flash, weaponinfo[player->readyweapon].flashstate);
    P_BulletSlope(player->mo);
    
    player->recoilpitch = RECOILPITCH;
    
    if(player->onground)
        P_Thrust(player, player->mo->angle + ANG180, FRACUNIT);
    
    for(i = 0; i < 20; i++)
    {
        damage = 5 * (P_Random() % 3 + 1);
        angle = player->mo->angle;
        angle += P_RandomShift(ANGLETOFINESHIFT);
        P_LineAttack(player->mo, angle, MISSILERANGE, bulletslope + P_RandomShift(5), damage);
    }
}
开发者ID:alexey-lysiuk,项目名称:doom64ex-osx,代码行数:26,代码来源:p_pspr.c

示例8: P_SpawnBrokenGlass

//
// P_SpawnBrokenGlass
// villsa [STRIFE] new function
//
static void P_SpawnBrokenGlass(line_t* line)
{
    fixed_t x1;
    fixed_t x2;
    fixed_t y1;
    fixed_t y2;
    int i;
    mobj_t* glass;
    angle_t an;

    x1 = (line->v2->x + line->v1->x) / 2;
    y1 = (line->v2->y + line->v1->y) / 2;
    x2 = ((line->frontsector->soundorg.x - x1) / 5) + x1;
    y2 = ((line->frontsector->soundorg.y - y1) / 5) + y1;

    for(i = 0; i < 7; i++)
    {
        glass = P_SpawnMobj(x2, y2, ONFLOORZ, MT_JUNK);
        glass->z += (24*FRACUNIT);
        glass->flags |= (MF_SHADOW|MF_MVIS);

        P_SetMobjState(glass, P_Random() % 3 + S_SHRD_03); // 284

        an = ((P_Random() << 13) / 255);

        glass->angle = (an << ANGLETOFINESHIFT);
        glass->momx = FixedMul(finecosine[an], (P_Random() & 3) << FRACBITS);
        glass->momy = FixedMul(finesine[an],   (P_Random() & 3) << FRACBITS);
        glass->momz = (P_Random() & 7) << FRACBITS;
        glass->tics += (P_Random() + 7) & 7;
    }
}
开发者ID:M-Code,项目名称:chocolate-doom,代码行数:36,代码来源:p_switch.c

示例9: A_FireCGun

void A_FireCGun(player_t* player, pspdef_t* psp)
{
    int ammo = player->ammo[weaponinfo[player->readyweapon].ammo];
    int rand;

    if(!ammo)
        return;
    
    S_StartSound(player->mo, sfx_pistol);
    
    P_SetMobjState (player->mo, S_007);
    player->ammo[weaponinfo[player->readyweapon].ammo]--;
    
    // randomize sx
    rand = (((P_Random() & 1) << 1) - 1);
    psp->sx = (rand * FRACUNIT);

    // randomize sy
    rand = ((((ammo - 1) & 1) << 1) - 1);
    psp->sy = WEAPONTOP - (rand * (2*FRACUNIT));
    
    player->psprites[ps_flash].alpha = 160;

    P_SetPsprite(player, ps_flash,
        weaponinfo[player->readyweapon].flashstate + psp->state - &states[S_756]);
    
    player->recoilpitch = RECOILPITCH;
    
    P_BulletSlope(player->mo);
    P_GunShot(player->mo, !player->refire);
}
开发者ID:alexey-lysiuk,项目名称:doom64ex-osx,代码行数:31,代码来源:p_pspr.c

示例10: A_GunFlash

//
// A_GunFlash
//
void A_GunFlash (AActor *mo)
{
    player_t *player = mo->player;

	P_SetMobjState (player->mo, S_PLAY_ATK2);
	P_SetPsprite (player, ps_flash, weaponinfo[player->readyweapon].flashstate);
}
开发者ID:JohnnyonFlame,项目名称:odamex,代码行数:10,代码来源:p_pspr.cpp

示例11: ST_cheat_massacre

// [crispy] from boom202s/M_CHEAT.C:467-498
static int ST_cheat_massacre()    // jff 2/01/98 kill all monsters
{
  // jff 02/01/98 'em' cheat - kill all monsters
  // partially taken from Chi's .46 port
  //
  // killough 2/7/98: cleaned up code and changed to use dprintf;
  // fixed lost soul bug (LSs left behind when PEs are killed)

  int killcount=0;
  thinker_t *currentthinker=&thinkercap;
  extern void A_PainDie(mobj_t *);

  while ((currentthinker=currentthinker->next)!=&thinkercap)
    if (currentthinker->function.acp1 == (actionf_p1) P_MobjThinker &&
        (((mobj_t *) currentthinker)->flags & MF_COUNTKILL ||
         ((mobj_t *) currentthinker)->type == MT_SKULL))
      { // killough 3/6/98: kill even if PE is dead
        if (((mobj_t *) currentthinker)->health > 0)
          {
            killcount++;
            P_DamageMobj((mobj_t *)currentthinker, NULL, NULL, 10000);
          }
        if (((mobj_t *) currentthinker)->type == MT_PAIN)
          {
            A_PainDie((mobj_t *) currentthinker);    // killough 2/8/98
            P_SetMobjState ((mobj_t *) currentthinker, S_PAIN_DIE6);
          }
      }
  return (killcount);
}
开发者ID:plumsinus,项目名称:crispy-doom,代码行数:31,代码来源:st_stuff.c

示例12: A_CounterSwitch

//
// A_CounterSwitch
//
// This powerful codepointer can branch to one of N states
// depending on the value of the indicated counter, and it
// remains totally safe at all times. If the entire indicated
// frame set is not valid, no actions will be taken.
//
// args[0] : counter # to use
// args[1] : DeHackEd number of first frame in consecutive set
// args[2] : number of frames in consecutive set
//
void A_CounterSwitch(Mobj *mo)
{
   int cnum, startstate, numstates;
   int *counter;

   cnum       = E_ArgAsInt(mo->state->args,        0, 0);
   startstate = E_ArgAsStateNumNI(mo->state->args, 1, mo);
   numstates  = E_ArgAsInt(mo->state->args,        2, 0) - 1;

   // get counter
   if(cnum < 0 || cnum >= NUMMOBJCOUNTERS)
      return; // invalid

   counter = &(mo->counters[cnum]);

   // verify startstate
   if(startstate < 0)
      return;

   // verify last state is < NUMSTATES
   if(startstate + numstates >= NUMSTATES)
      return;

   // verify counter is in range
   if(*counter < 0 || *counter > numstates)
      return;

   // jump!
   P_SetMobjState(mo, startstate + *counter);
}
开发者ID:doomtech,项目名称:eternity,代码行数:42,代码来源:a_counters.cpp

示例13: P_ExplodeMissile

//
// P_ExplodeMissile
//
void P_ExplodeMissile (AActor* mo)
{
	mo->momx = mo->momy = mo->momz = 0;

	P_SetMobjState (mo, mobjinfo[mo->type].deathstate);
	if (mobjinfo[mo->type].deathstate != S_NULL)
	{
		// [RH] If the object is already translucent, don't change it.
		// Otherwise, make it 66% translucent.
		//if (mo->translucency == FRACUNIT)
		//	mo->translucency = TRANSLUC66;

		mo->translucency = FRACUNIT;

		mo->tics -= P_Random(mo)&3;

		if (mo->tics < 1)
			mo->tics = 1;

		mo->flags &= ~MF_MISSILE;

		if (mo->info->deathsound)
			S_Sound (mo, CHAN_VOICE, mo->info->deathsound, 1, ATTN_NORM);

		mo->effects = 0;		// [RH]
	}
}
开发者ID:JohnnyonFlame,项目名称:odamex,代码行数:30,代码来源:p_mobj.cpp

示例14: A_CounterJump

//
// A_CounterJump
//
// Parameterized codepointer for branching based on comparisons
// against a thing's counter values.
//
// args[0] : state number
// args[1] : comparison type
// args[2] : immediate value OR counter number
// args[3] : counter # to use
//
void A_CounterJump(Mobj *mo)
{
   bool branch = false;
   int statenum, checktype, value, cnum;
   int *counter;

   statenum  = E_ArgAsStateNumNI(mo->state->args, 0, mo);
   checktype = E_ArgAsKwd(mo->state->args, 1, &cpckwds, 0);
   value     = E_ArgAsInt(mo->state->args, 2, 0);
   cnum      = E_ArgAsInt(mo->state->args, 3, 0);
   
   // validate state
   if(statenum < 0)
      return;

   if(cnum < 0 || cnum >= NUMMOBJCOUNTERS)
      return; // invalid

   counter = &(mo->counters[cnum]);

   // 08/02/04:
   // support getting check value from a counter
   // if checktype is greater than the last immediate operator,
   // then the comparison value is actually a counter number

   if(checktype >= CPC_NUMIMMEDIATE)
   {
      // turn it into the corresponding immediate operation
      checktype -= CPC_NUMIMMEDIATE;

      if(value < 0 || value >= NUMMOBJCOUNTERS)
         return; // invalid counter number

      value = mo->counters[value];
   }

   switch(checktype)
   {
   case CPC_LESS:
      branch = (*counter < value);  break;
   case CPC_LESSOREQUAL:
      branch = (*counter <= value); break;
   case CPC_GREATER:
      branch = (*counter > value);  break;
   case CPC_GREATEROREQUAL:
      branch = (*counter >= value); break;
   case CPC_EQUAL:
      branch = (*counter == value); break;
   case CPC_NOTEQUAL:
      branch = (*counter != value); break;
   case CPC_BITWISEAND:
      branch = !!(*counter & value);  break;
   default:
      break;
   }

   if(branch)
      P_SetMobjState(mo, statenum);
}
开发者ID:doomtech,项目名称:eternity,代码行数:70,代码来源:a_counters.cpp

示例15: A_GunFlash

void A_GunFlash(player_t *player, pspdef_t *psp)
{
  CHECK_WEAPON_CODEPOINTER("A_GunFlash", player);

  P_SetMobjState(player->mo, S_PLAY_ATK2);

  A_FireSomething(player,0);                                      // phares
}
开发者ID:Mistranger,项目名称:prboom-plus,代码行数:8,代码来源:p_pspr.c


注:本文中的P_SetMobjState函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。