Exemple #1
0
void AInventory::BecomeItem ()
{
	if (!(flags & (MF_NOBLOCKMAP|MF_NOSECTOR)))
	{
		UnlinkFromWorld (nullptr);
		flags |= MF_NOBLOCKMAP|MF_NOSECTOR;
		LinkToWorld (nullptr);
	}
	RemoveFromHash ();
	flags &= ~MF_SPECIAL;
	ChangeStatNum(STAT_INVENTORY);
	// stop all sounds this item is playing.
	for(int i = 1;i<=7;i++) S_StopSound(this, i);
	SetState (FindState("Held"));
}
Exemple #2
0
void AInventory::BecomeItem ()
{
	if (!(flags & (MF_NOBLOCKMAP|MF_NOSECTOR)))
	{
		UnlinkFromWorld ();
		if (sector_list)
		{
			P_DelSeclist (sector_list);
			sector_list = NULL;
		}
		flags |= MF_NOBLOCKMAP|MF_NOSECTOR;
		LinkToWorld ();
	}
	RemoveFromHash ();
	flags &= ~MF_SPECIAL;
	SetState (FindState("Held"));
}
Exemple #3
0
bool CTextureRefs::RemoveRef(unsigned fmt, unsigned x, unsigned y, unsigned width, unsigned height)
{
	// Pack texture reference into bitfield
	unsigned texRef = (fmt&7)<<24|(x&0x7E0)<<13|(y&0x7E0)<<7|(width&0x7E0)<<1|(height&0x7E0)>>5;

	// Check if using array or hashset
	if (m_size <= TEXREFS_ARRAY_SIZE)
	{
		for (unsigned i = 0; i < m_size; i++)
		{
			if (texRef == m_array[i])
			{
				for (unsigned j = i + 1; j < m_size; j++)
					m_array[j - 1] = m_array[j];
				m_size--;
				return true;
			}
		}
		return false;
	}
	else 
	{
		// Remove texture reference from hashset
		bool removed = RemoveFromHash(texRef);

		// See if should switch back to array
		if (m_size == TEXREFS_ARRAY_SIZE)
		{
			// Loop through all hash entries and copy texture references into array
			unsigned j = 0;
			for (unsigned i = 0; i < m_hashCapacity; i++)
			{
				for (HashEntry *entry = m_hashEntries[i]; entry; entry = entry->nextEntry)
					m_array[j++] = entry->texRef;
			}
			// Delete all hash entries
			DeleteAllHashEntries();
		}
		return removed;
	}
}
Exemple #4
0
//
// P_RemoveMobj
//
void AActor::Destroy ()
{
	SV_SendDestroyActor(this);

    // Add special to item respawn queue if it is destined to be respawned
	if ((flags & MF_SPECIAL) && !(flags & MF_DROPPED))
	{
		if (type != MT_INV && type != MT_INS && 
            (type < MT_BSOK || type > MT_RDWN))
		{
			itemrespawnque[iquehead] = spawnpoint;
			itemrespawntime[iquehead] = level.time;
			iquehead = (iquehead+1)&(ITEMQUESIZE-1);

			// lose one off the end?
			if (iquehead == iquetail)
				iquetail = (iquetail+1)&(ITEMQUESIZE-1);
		}
	}
	
	// [RH] Unlink from tid chain
	RemoveFromHash ();

	// unlink from sector and block lists
	UnlinkFromWorld ();

	// Delete all nodes on the current sector_list			phares 3/16/98
	if (sector_list)
	{
		P_DelSeclist (sector_list);
		sector_list = NULL;
	}

	// stop any playing sound
    if (clientside)
		S_RelinkSound (this, NULL);

	Super::Destroy ();
}