All pastes #453902 Raw Edit

Unnamed

public c v1 · immutable
·published 2007-04-23 09:05 UTC
rendered paste body
/*=================G_InventoryToFloor=================*/void G_InventoryToFloor( edict_t *ent ){	invChain_t	*ic, *next;	edict_t		*floor;	int			i;	int			x, y;	// check for items	if ( ent->i.right.t == NONE && ent->i.left.t == NONE && !ent->i.inv )		return;	// find the floor	floor = G_GetFloorItems( ent );	if ( !floor )	{		floor = G_Spawn();		floor->classname = "item";		floor->type = ET_ITEM;		VectorCopy( ent->pos, floor->pos );		gi.GridPosToVec( floor->pos, floor->origin );		floor->origin[2] -= 24;	} else {		gi.AddEvent( G_VisToPlayerMask( floor->visflags ), EV_ENT_PERISH );		gi.WriteShort( floor->number );		floor->visflags = 0;	}	// drop items in the hands	floor->i.floor = &floor->i;	if ( ent->i.right.t != NONE )	{		Com_FindSpace(&floor->i, ent->i.right.t, gi.csi->idFloor, &x, &y);		Com_AddToInventory( &floor->i, ent->i.right.t, ent->i.right.a, gi.csi->idFloor, x, y );	}	if ( ent->i.left.t != NONE )	{		Com_FindSpace(&floor->i, ent->i.left.t, gi.csi->idFloor, &x, &y);		Com_AddToInventory( &floor->i, ent->i.left.t, ent->i.left.a, gi.csi->idFloor, x, y );	}	// drop the rest	for ( ic = ent->i.inv; ic; ic = next )	{		next = ic->next;		ic->container = gi.csi->idFloor;		Com_FindSpace( &floor->i, ent->i.right.t, gi.csi->idFloor, &ic->x, &ic->y );		if ( ic->x >= 32 || ic->y >= 16 )		{			ent->i.inv = ic;			Com_DestroyInventory( &ent->i );			return;		}		ic->next = floor->i.inv;		floor->i.inv = ic;	}	// destroy link	ent->i.inv = NULL;	// send item info to the clients	for ( i = 0; i < MAX_TEAMS; i++ )		if ( level.num_alive[i] )			G_CheckVis( G_VisToPlayerMask(1<<i), i, floor, true );}