예제 #1
0
void player_t::DestroyPSprites()
{
	DPSprite *pspr = psprites;
	psprites = nullptr;
	while (pspr)
	{
		DPSprite *next = pspr->Next;
		pspr->Next = nullptr;
		pspr->Destroy();
		pspr = next;
	}
}
예제 #2
0
void player_t::TickPSprites()
{
	DPSprite *pspr = psprites;
	while (pspr)
	{
		// Destroy the psprite if it's from a weapon that isn't currently selected by the player
		// or if it's from an inventory item that the player no longer owns. 
		if ((pspr->Caller == nullptr ||
			(pspr->Caller->IsKindOf(RUNTIME_CLASS(AInventory)) && barrier_cast<AInventory *>(pspr->Caller)->Owner != pspr->Owner->mo) ||
			(pspr->Caller->IsKindOf(RUNTIME_CLASS(AWeapon)) && pspr->Caller != pspr->Owner->ReadyWeapon)))
		{
			pspr->Destroy();
		}
		else
		{
			pspr->Tick();
		}

		pspr = pspr->Next;
	}

	if ((health > 0) || (ReadyWeapon != nullptr && !(ReadyWeapon->WeaponFlags & WIF_NODEATHINPUT)))
	{
		if (ReadyWeapon == nullptr)
		{
			if (PendingWeapon != WP_NOCHANGE)
				P_BringUpWeapon(this);
		}
		else
		{
			P_CheckWeaponSwitch(this);
			if (WeaponState & (WF_WEAPONREADY | WF_WEAPONREADYALT))
			{
				P_CheckWeaponFire(this);
			}
			// Check custom buttons
			P_CheckWeaponButtons(this);
		}
	}
}