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


C++ P_SetPsprite函数代码示例

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


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


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