• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ P_SetPsprite函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: A_Lower

//
// A_Lower
// Lowers current weapon,
//	and changes weapon at bottom.
//
void A_Lower(player_t* player, pspdef_t* psp)
{
    psp->sy += LOWERSPEED;
    
    // Is already down.
    if(psp->sy < WEAPONBOTTOM )
        return;
    
    // Player is dead.
    if(player->playerstate == PST_DEAD)
    {
        psp->sy = WEAPONBOTTOM;
        
        // don't bring weapon back up
        return;
    }

    //
    // [d64] stop plasma buzz
    //
    if(player->readyweapon == wp_plasma)
    {
        pls_buzzing = false;
        S_StopSound(NULL, sfx_electric);
    }
    
    // The old weapon has been lowered off the screen,
    // so change the weapon and start raising it
    if(!player->health)
    {
        // Player is dead, so keep the weapon off screen.
        P_SetPsprite(player,  ps_weapon, S_000);
        return;
    }
    
    P_SetPsprite(player, ps_flash, S_000);  //villsa
    
    player->readyweapon = player->pendingweapon;
    P_BringUpWeapon(player);
}
开发者ID:alexey-lysiuk,项目名称:doom64ex-osx,代码行数:45,代码来源:p_pspr.c


示例2: P_SetSafeFlash

void P_SetSafeFlash(AWeapon *weapon, player_t *player, FState *flashstate, int index)
{

	PClassActor *cls = weapon->GetClass();
	while (cls != RUNTIME_CLASS(AWeapon))
	{
		if (flashstate >= cls->OwnedStates && flashstate < cls->OwnedStates + cls->NumOwnedStates)
		{
			// The flash state belongs to this class.
			// Now let's check if the actually wanted state does also
			if (flashstate + index < cls->OwnedStates + cls->NumOwnedStates)
			{
				// we're ok so set the state
				P_SetPsprite (player, ps_flash, flashstate + index);
				player->psprites[ps_flash].processPending = true;
				return;
			}
			else
			{
				// oh, no! The state is beyond the end of the state table so use the original flash state.
				P_SetPsprite (player, ps_flash, flashstate);
				player->psprites[ps_flash].processPending = true;
				return;
			}
		}
		// try again with parent class
		cls = static_cast<PClassActor *>(cls->ParentClass);
	}
	// if we get here the state doesn't seem to belong to any class in the inheritance chain
	// This can happen with Dehacked if the flash states are remapped. 
	// The only way to check this would be to go through all Dehacked modifiable actors, convert
	// their states into a single flat array and find the correct one.
	// Rather than that, just check to make sure it belongs to something.
	if (FState::StaticFindStateOwner(flashstate + index) == NULL)
	{ // Invalid state. With no index offset, it should at least be valid.
		index = 0;
	}
	P_SetPsprite (player, ps_flash, flashstate + index);
	player->psprites[ps_flash].processPending = true;
}
开发者ID:FlameNeon,项目名称:gzdoom,代码行数:40,代码来源:a_doomweaps.cpp


示例3: P_DropWeapon

void P_DropWeapon (player_t *player)
{
	if (player == NULL)
	{
		return;
	}
	// Since the weapon is dropping, stop blocking switching.
	player->WeaponState &= ~WF_DISABLESWITCH;
	if (player->ReadyWeapon != NULL)
	{
		P_SetPsprite (player, ps_weapon, player->ReadyWeapon->GetDownState());
	}
}
开发者ID:BadSanta1980,项目名称:gzdoom,代码行数:13,代码来源:p_pspr.cpp


示例4: A_CheckReload

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

  if (!P_CheckAmmo(player) && compatibility_level >= prboom_4_compatibility) {
    /* cph 2002/08/08 - In old Doom, P_CheckAmmo would start the weapon lowering
     * immediately. This was lost in Boom when the weapon switching logic was
     * rewritten. But we must tell Doom that we don't need to complete the
     * reload frames for the weapon here. G_BuildTiccmd will set ->pendingweapon
     * for us later on. */
    P_SetPsprite(player,ps_weapon,weaponinfo[player->readyweapon].downstate);
  }
}
开发者ID:Mistranger,项目名称:prboom-plus,代码行数:13,代码来源:p_pspr.c


示例5: P_DropWeapon

void P_DropWeapon (player_t *player)
{
	if (player == nullptr)
	{
		return;
	}
	// Since the weapon is dropping, stop blocking switching.
	player->WeaponState &= ~WF_DISABLESWITCH;
	if ((player->ReadyWeapon != nullptr) && (player->health > 0 || !(player->ReadyWeapon->WeaponFlags & WIF_NODEATHDESELECT)))
	{
		P_SetPsprite(player, PSP_WEAPON, player->ReadyWeapon->GetDownState());
	}
}
开发者ID:Jayman2000,项目名称:zdoom-pull,代码行数:13,代码来源:p_pspr.cpp


示例6: A_FirePlasma

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

	DecreaseAmmo(player);

	P_SetPsprite (player,
				  ps_flash,
				  (statenum_t)(weaponinfo[player->readyweapon].flashstate+(P_Random (player->mo)&1)));

	if(serverside)
		P_SpawnPlayerMissile (player->mo, MT_PLASMA);
}
开发者ID:JohnnyonFlame,项目名称:odamex,代码行数:16,代码来源:p_pspr.cpp


示例7: P_FireWeapon

OVERLAY static void P_FireWeapon(player_t *player)
{
  statenum_t newstate;

  if (!P_CheckAmmo(player))
    return;

  P_SetMobjState(player->mo, S_PLAY_ATK1);
  newstate = (statenum_t)weaponinfo[player->readyweapon].atkstate;
  P_SetPsprite(player, ps_weapon, newstate);
  P_NoiseAlert(player->mo, player->mo);
  lastshottic = gametic;                       // killough 3/22/98
}
开发者ID:rlsosborne,项目名称:doom,代码行数:13,代码来源:p_pspr.cpp


示例8: A_FAxeCheckAtk

void A_FAxeCheckAtk (AActor *actor)
{
	player_t *player;

	if (NULL == (player = actor->player))
	{
		return;
	}
	if (player->ReadyWeapon->Ammo1->Amount)
	{
		P_SetPsprite (player, ps_weapon, &AFWeapAxe::States[S_FAXEATK_G]);
	}
}
开发者ID:doomtech,项目名称:zdoom-old,代码行数:13,代码来源:a_fighteraxe.cpp


示例9: DEFINE_ACTION_FUNCTION

DEFINE_ACTION_FUNCTION(AActor, A_FAxeCheckAtk)
{
	player_t *player;

	if (NULL == (player = self->player))
	{
		return;
	}
	if (player->ReadyWeapon->Ammo1->Amount)
	{
		P_SetPsprite (player, ps_weapon, player->ReadyWeapon->FindState ("FireGlow"));
	}
}
开发者ID:1Akula1,项目名称:gzdoom,代码行数:13,代码来源:a_fighteraxe.cpp


示例10: A_WeaponReady

//
// A_WeaponReady
// The player can fire the weapon
// or change to another weapon at this time.
// Follows after getting weapon up,
// or after previous attack/fire sequence.
//
void A_WeaponReady(AActor *mo)
{
	statenum_t	newstate;

    player_t *player = mo->player;
    struct pspdef_s *psp = &player->psprites[player->psprnum];

	// get out of attack state
	if (player->mo->state == &states[S_PLAY_ATK1]
		|| player->mo->state == &states[S_PLAY_ATK2] )
	{
		P_SetMobjState (player->mo, S_PLAY);
	}

	if (player->readyweapon == wp_chainsaw
		&& psp->state == &states[S_SAW])
	{
		A_FireSound(player, "weapons/sawidle");
	}

	// check for change
	//	if player is dead, put the weapon away
	if (player->pendingweapon != wp_nochange || player->health <= 0)
	{
		// change weapon
		//	(pending weapon should already be validated)
		newstate = weaponinfo[player->readyweapon].downstate;
		P_SetPsprite (player, ps_weapon, newstate);
		return;
	}

	// check for fire
	//	the missile launcher and bfg do not auto fire
	// [AM] Allow warmup to disallow weapon firing.
	if (player->cmd.ucmd.buttons & BT_ATTACK && warmup.checkfireweapon())
	{
		if ( !player->attackdown
			 || (player->readyweapon != wp_missile
				 && player->readyweapon != wp_bfg) )
		{
			player->attackdown = true;
			P_FireWeapon (player);
			return;
		}
	}
	else
		player->attackdown = false;

	// bob the weapon based on movement speed
	P_BobWeapon(player);
}
开发者ID:JohnnyonFlame,项目名称:odamex,代码行数:58,代码来源:p_pspr.cpp


示例11: A_WeaponReady

//
// A_WeaponReady
// The player can fire the weapon
// or change to another weapon at this time.
// Follows after getting weapon up,
// or after previous attack/fire sequence.
//
void A_WeaponReady(player_t *player, pspdef_t *psp)
{
    // get out of attack state
    if (player->mo->state == &states[S_PLAY_ATK1] || player->mo->state == &states[S_PLAY_ATK2])
        P_SetMobjState(player->mo, S_PLAY);

    if (player->readyweapon == wp_chainsaw && psp->state == &states[S_SAW])
        S_StartSound(player->mo, sfx_sawidl);

    // check for change
    //  if player is dead, put the weapon away
    if (player->pendingweapon != wp_nochange || !player->health)
    {
        // change weapon (pending weapon should already be validated)
        P_SetPsprite(player, ps_weapon, (statenum_t)weaponinfo[player->readyweapon].downstate);
        return;
    }

    // check for fire
    //  the missile launcher and bfg do not auto fire
    if (player->cmd.buttons & BT_ATTACK)
    {
        if (!player->attackdown 
            || (player->readyweapon != wp_missile && player->readyweapon != wp_bfg))
        {
            player->attackdown = true;
            P_FireWeapon(player);
            return;
        }
    }
    else
        player->attackdown = false;

    if (player->mo->momx || player->mo->momy || player->mo->momz)
    {
        // bob the weapon based on movement speed
        int angle = (128 * leveltime) & FINEMASK;
        int bob = player->bob;

        if (bob < FRACUNIT / 2)
            bob = 0;

        psp->sx = FixedMul(bob, finecosine[angle]);
        psp->sy = WEAPONTOP + FixedMul(bob, finesine[angle & FINEANGLES / 2 - 1]);
    }
    else
    {
        psp->sx = 0;
        psp->sy = WEAPONTOP;
    }
}
开发者ID:arneolavhal,项目名称:doomretro,代码行数:58,代码来源:p_pspr.c


示例12: P_PostChickenWeapon

void P_PostChickenWeapon(player_t *player, weapontype_t weapon)
{
	if(weapon == wp_beak)
	{							// Should never happen
		//weapon = wp_staff;
		return;
	}
	player->pendingweapon = wp_nochange;
	player->readyweapon = weapon;
	player->update |= PSF_PENDING_WEAPON | PSF_READY_WEAPON;
	player->psprites[ps_weapon].sy = WEAPONBOTTOM;
	P_SetPsprite(player, ps_weapon, wpnlev1info[weapon].upstate);
	NetSv_PSpriteChange(player - players, wpnlev1info[weapon].upstate);
}
开发者ID:amitahire,项目名称:development,代码行数:14,代码来源:P_pspr.c


示例13: A_Raise

//
// A_Raise
//
void A_Raise(player_t *player, pspdef_t *psp)
{
    psp->sy -= RAISESPEED;

    if (psp->sy > WEAPONTOP)
        return;

    psp->sy = WEAPONTOP;
    startingnewgame = false;

    // The weapon has been raised all the way,
    //  so change to the ready state.
    P_SetPsprite(player, ps_weapon, (statenum_t)weaponinfo[player->readyweapon].readystate);
}
开发者ID:arneolavhal,项目名称:doomretro,代码行数:17,代码来源:p_pspr.c


示例14: A_FirePistol

//
// A_FirePistol
//
void A_FirePistol(player_t* player, pspdef_t* psp)
{
    S_StartSound(player->mo, sfx_pistol);
    
    P_SetMobjState(player->mo, S_007);
    player->ammo[weaponinfo[player->readyweapon].ammo]--;
    
    P_SetPsprite(player,
        ps_flash,
        weaponinfo[player->readyweapon].flashstate);
    
    P_BulletSlope(player->mo);
    P_GunShot(player->mo, !player->refire);
}
开发者ID:alexey-lysiuk,项目名称:doom64ex-osx,代码行数:17,代码来源:p_pspr.c


示例15: DEFINE_ACTION_FUNCTION

DEFINE_ACTION_FUNCTION(AActor, A_BeakRaise)
{
	PARAM_ACTION_PROLOGUE;

	player_t *player;

	if (NULL == (player = self->player))
	{
		return 0;
	}
	player->psprites[ps_weapon].sy = WEAPONTOP;
	P_SetPsprite (player, ps_weapon, player->ReadyWeapon->GetReadyState());
	return 0;
}
开发者ID:FlameNeon,项目名称:gzdoom,代码行数:14,代码来源:a_chicken.cpp


示例16: DEFINE_ACTION_FUNCTION

DEFINE_ACTION_FUNCTION(AInventory, A_Lower)
{
	PARAM_ACTION_PROLOGUE;

	player_t *player = self->player;
	pspdef_t *psp;

	if (NULL == player)
	{
		return 0;
	}
	psp = &player->psprites[ps_weapon];
	if (player->morphTics || player->cheats & CF_INSTANTWEAPSWITCH)
	{
		psp->sy = WEAPONBOTTOM;
	}
	else
	{
		psp->sy += LOWERSPEED;
	}
	if (psp->sy < WEAPONBOTTOM)
	{ // Not lowered all the way yet
		return 0;
	}
	if (player->playerstate == PST_DEAD)
	{ // Player is dead, so don't bring up a pending weapon
		psp->sy = WEAPONBOTTOM;
	
		// Player is dead, so keep the weapon off screen
		P_SetPsprite (player,  ps_weapon, NULL);
		return 0;
	}
	// [RH] Clear the flash state. Only needed for Strife.
	P_SetPsprite (player, ps_flash, NULL);
	P_BringUpWeapon (player);
	return 0;
}
开发者ID:FlameNeon,项目名称:gzdoom,代码行数:37,代码来源:p_pspr.cpp


示例17: A_Raise

//
// A_Raise
//
void A_Raise(player_t* player, pspdef_t* psp)
{
    statenum_t	newstate;
    
    psp->sy -= RAISESPEED;
    if (psp->sy > WEAPONTOP )
        return;
    
    psp->sy = WEAPONTOP;
    
    // The weapon has been raised all the way,
    //	so change to the ready state.
    newstate = weaponinfo[player->readyweapon].readystate;
    P_SetPsprite(player, ps_weapon, newstate);
}
开发者ID:alexey-lysiuk,项目名称:doom64ex-osx,代码行数:18,代码来源:p_pspr.c


示例18: A_WeaponCtrSwitch

//
// A_WeaponCtrSwitch
//
// 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
// args[3] : psprite to affect (weapon or flash)
//
void A_WeaponCtrSwitch(Mobj *mo)
{
   int cnum, startstate, numstates, psprnum;
   int *counter;
   player_t *player;
   pspdef_t *pspr;

   if(!(player = mo->player))
      return;

   pspr = &(player->psprites[player->curpsprite]);

   cnum       = E_ArgAsInt(pspr->state->args, 0, 0);
   startstate = E_ArgAsStateNumNI(pspr->state->args, 1, NULL);
   numstates  = E_ArgAsInt(pspr->state->args, 2, 0) - 1;
   psprnum    = E_ArgAsKwd(pspr->state->args, 3, &psprkwds, 0);

   // validate psprite number
   if(psprnum < 0 || psprnum >= NUMPSPRITES)
      return;

   // get counter
   switch(cnum)
   {
   case 0:
   case 1:
   case 2:
      counter = &(player->weaponctrs[player->readyweapon][cnum]); 
      break;
   default:
      return;
   }

   // 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_SetPsprite(player, psprnum, startstate + *counter);
}
开发者ID:doomtech,项目名称:eternity,代码行数:61,代码来源:a_counters.cpp


示例19: P_FireWeapon

//
// P_FireWeapon.
//
void P_FireWeapon(player_t *player)
{
    statenum_t newstate;

    if (!P_CheckAmmo(player) || (automapactive && !followplayer))
        return;

    P_SetMobjState(player->mo, S_PLAY_ATK1);
    newstate = (statenum_t)weaponinfo[player->readyweapon].atkstate;
    P_SetPsprite(player, ps_weapon, newstate);

    if (player->readyweapon == wp_fist && !linetarget)
        return;

    P_NoiseAlert(player->mo, player->mo);
}
开发者ID:arneolavhal,项目名称:doomretro,代码行数:19,代码来源:p_pspr.c


示例20: P_MovePsprites

OVERLAY void P_MovePsprites(player_t *player)
{
  pspdef_t *psp = player->psprites;
  int i;

  // a null state means not active
  // drop tic count and possibly change state
  // a -1 tic count never changes

  for (i=0; i<NUMPSPRITES; i++, psp++)
    if (psp->state && psp->tics != -1 && !--psp->tics)
      P_SetPsprite(player, i, psp->state->nextstate);

  player->psprites[ps_flash].sx = player->psprites[ps_weapon].sx;
  player->psprites[ps_flash].sy = player->psprites[ps_weapon].sy;
}
开发者ID:rlsosborne,项目名称:doom,代码行数:16,代码来源:p_pspr.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ P_UNLIKELY函数代码示例发布时间:2022-05-30
下一篇:
C++ P_SetMobjState函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap