Exemplo n.º 1
0
void Select_Move (vec3_t delta)
{
	brush_t	*b;

// actually move the selected brushes
	for (b = selected_brushes.next ; b != &selected_brushes ; b=b->next)
		Brush_Move (b, delta);
//	Sys_UpdateWindows (W_ALL);
}
Exemplo n.º 2
0
/*
============
Select_Move
============
*/
void Select_Move( vec3_t delta, bool bSnap )
{
	brush_s*    b;
	
	
	// actually move the selected brushes
	for ( b = selected_brushes.next ; b != &selected_brushes ; b = b->next )
		Brush_Move( b, delta, bSnap );
		
	edVec3_c vMin, vMax;
	Select_GetBounds( vMin, vMax );
	CString strStatus;
	strStatus.Format( "Origin X:: %.1f  Y:: %.1f  Z:: %.1f", vMin[0], vMax[1], vMax[2] );
	g_pParentWnd->SetStatusText( 2, strStatus );
	
	//  Sys_UpdateWindows (W_ALL);
}
Brush	*BrushTemplate_CreateStaircase (const BrushTemplate_Staircase *pTemplate)
{
	int			i;
	geFloat		HalfWidth = (geFloat)(pTemplate->Width/2);
	geFloat		HalfHeight = (geFloat)(pTemplate->Height/2);
	geFloat		HalfLength = (geFloat)(pTemplate->Length/2);
	Brush		*b, *b2;
	BrushList	*MBList	=BrushList_Create();
	FaceList	*fl;
	Face		*f;
	geVec3d		v, FaceVerts[4];


	if( pTemplate->MakeRamp )
	{
		fl	=FaceList_Create(5);

		geVec3d_Set (&(FaceVerts[3]), -HalfWidth, -HalfHeight, HalfLength);
		geVec3d_Set (&(FaceVerts[2]), HalfWidth,  -HalfHeight, HalfLength);
		geVec3d_Set (&(FaceVerts[1]), HalfWidth,	 HalfHeight,  HalfLength);
		geVec3d_Set (&(FaceVerts[0]), -HalfWidth, HalfHeight,  HalfLength);
		f	=Face_Create(4, FaceVerts, 0);
		if(f)
		{
			FaceList_AddFace(fl, f);
		}

		geVec3d_Set (&(FaceVerts[3]), HalfWidth,  -HalfHeight,  HalfLength);
		geVec3d_Set (&(FaceVerts[2]), -HalfWidth, -HalfHeight,  HalfLength);
		geVec3d_Set (&(FaceVerts[1]), -HalfWidth, -HalfHeight,  -HalfLength);
		geVec3d_Set (&(FaceVerts[0]), HalfWidth,  -HalfHeight,  -HalfLength);
		f	=Face_Create(4, FaceVerts, 0);
		if(f)
		{
			FaceList_AddFace(fl, f);
		}

		geVec3d_Set (&(FaceVerts[3]), -HalfWidth, HalfHeight,   HalfLength);
		geVec3d_Set (&(FaceVerts[2]), HalfWidth,  HalfHeight,   HalfLength);
		geVec3d_Set (&(FaceVerts[1]), HalfWidth,  -HalfHeight,  -HalfLength);
		geVec3d_Set (&(FaceVerts[0]), -HalfWidth, -HalfHeight,  -HalfLength);
		f	=Face_Create(4, FaceVerts, 0);
		if(f)
		{
			FaceList_AddFace(fl, f);
		}

		geVec3d_Set (&(FaceVerts[2]), HalfWidth,  HalfHeight,   HalfLength);
		geVec3d_Set (&(FaceVerts[1]), HalfWidth,  -HalfHeight,  HalfLength);
		geVec3d_Set (&(FaceVerts[0]), HalfWidth,  -HalfHeight,  -HalfLength);
		f	=Face_Create(3, FaceVerts, 0);
		if(f)
		{
			FaceList_AddFace(fl, f);
		}

		geVec3d_Set (&(FaceVerts[0]), -HalfWidth, HalfHeight,   HalfLength);
		geVec3d_Set (&(FaceVerts[1]), -HalfWidth, -HalfHeight,  HalfLength);
		geVec3d_Set (&(FaceVerts[2]), -HalfWidth, -HalfHeight,  -HalfLength);
		f	=Face_Create(3, FaceVerts, 0);
		if(f)
		{
			FaceList_AddFace(fl, f);
		}

		b	=Brush_Create(BRUSH_LEAF, fl, NULL);
	}
	else
	{
		float	StairYSize	=(geFloat)pTemplate->Height/(geFloat)pTemplate->NumberOfStairs;
		float	DZ			=(geFloat)pTemplate->Length/(geFloat)pTemplate->NumberOfStairs;
		float	ZSize		=(geFloat)pTemplate->Length;
		BrushTemplate_Box BoxTemplate;

		BoxTemplate.Solid = 0;
		BoxTemplate.TCut = pTemplate->TCut;
		BoxTemplate.Thickness = 0.0f;
		BoxTemplate.XSizeTop = pTemplate->Width;
		BoxTemplate.XSizeBot = pTemplate->Width;
		BoxTemplate.YSize = StairYSize;

		for(i=0;i < pTemplate->NumberOfStairs;i++)
		{
			BoxTemplate.ZSizeTop = ZSize;
			BoxTemplate.ZSizeBot = ZSize;
			BoxTemplate.TSheet	 = GE_FALSE;	// nasty, nasty, nasty
			b2 = BrushTemplate_CreateBox (&BoxTemplate);
			ZSize	-=DZ;
			geVec3d_Set(&v, 0.0f, i*StairYSize, (i*DZ)/2);
			Brush_Move(b2, &v);
			BrushList_Append(MBList, b2);
		}
		b	=Brush_Create(BRUSH_MULTI, NULL, MBList);
	}

	if(b)
	{
		Brush_SetSubtract(b, pTemplate->TCut);
	}

	return	b;
}
Exemplo n.º 4
0
/*
============
Select_Clone

Creates an exact duplicate of the selection in place, then moves
the selected brushes off of their old positions
============
*/
void Select_Clone( void )
{
#if 1
	ASSERT( g_pParentWnd->ActiveXY() );
	g_bScreenUpdates = false;
	g_pParentWnd->ActiveXY()->Copy();
	g_pParentWnd->ActiveXY()->Paste();
	g_pParentWnd->NudgeSelection( 2, g_qeglobals.d_gridsize );
	g_pParentWnd->NudgeSelection( 3, g_qeglobals.d_gridsize );
	g_bScreenUpdates = true;
	Sys_UpdateWindows( W_ALL );
#else
	
	brush_s*        b, *b2, *n, *next, *next2;
	vec3_t      delta;
	entity_s*   e;
	
	g_qeglobals.d_workcount++;
	clearSelection();
	
	delta[0] = g_qeglobals.d_gridsize;
	delta[1] = g_qeglobals.d_gridsize;
	delta[2] = 0;
	
	for ( b = selected_brushes.next ; b != &selected_brushes ; b = next )
	{
		next = b->next;
		// if the brush is a world brush, handle simply
		if ( b->owner == world_entity )
		{
			n = Brush_Clone( b );
			Brush_AddToList( n, &active_brushes );
			Entity_LinkBrush( world_entity, n );
			Brush_Build( n );
			Brush_Move( b, delta );
			continue;
		}
	
		e = Entity_Clone( b->owner );
		// clear the target / targetname
		DeleteKey( e, "target" );
		DeleteKey( e, "targetname" );
	
		// if the brush is a fixed size entity, create a new entity
		if ( b->owner->eclass->fixedsize )
		{
			n = Brush_Clone( b );
			Brush_AddToList( n, &active_brushes );
			Entity_LinkBrush( e, n );
			Brush_Build( n );
			Brush_Move( b, delta );
			continue;
		}
	
		// brush is a complex entity, grab all the other ones now
	
		next = &selected_brushes;
	
		for ( b2 = b ; b2 != &selected_brushes ; b2 = next2 )
		{
			next2 = b2->next;
			if ( b2->owner != b->owner )
			{
				if ( next == &selected_brushes )
					next = b2;
				continue;
			}
	
			// move b2 to the start of selected_brushes,
			// so it won't be hit again
			Brush_RemoveFromList( b2 );
			Brush_AddToList( b2, &selected_brushes );
	
			n = Brush_Clone( b2 );
			Brush_AddToList( n, &active_brushes );
			Entity_LinkBrush( e, n );
			Brush_Build( n );
			Brush_Move( b2, delta, true );
		}
	
	}
	Sys_UpdateWindows( W_ALL );
#endif
}
Exemplo n.º 5
0
/*
============
Select_Clone

Creates an exact duplicate of the selection in place, then moves
the selected brushes off of their old positions
============
*/
void Select_Clone (void)
{
	brush_t		*b, *b2, *n, *next, *next2;
	vec3_t		delta;
	entity_t	*e;

	g_qeglobals.d_workcount++;
	g_qeglobals.d_select_mode = sel_brush;

	delta[0] = g_qeglobals.d_gridsize;
	delta[1] = g_qeglobals.d_gridsize;
	delta[2] = 0;

	for (b=selected_brushes.next ; b != &selected_brushes ; b=next)
	{
		next = b->next;
		// if the brush is a world brush, handle simply
		if (b->owner == world_entity)
		{
			n = Brush_Clone (b);
			Brush_AddToList (n, &active_brushes);
			Entity_LinkBrush (world_entity, n);
			Brush_Build( n );
			Brush_Move (b, delta);
			continue;
		}

		e = Entity_Clone (b->owner);
		// clear the target / targetname
		DeleteKey (e, "target");
		DeleteKey (e, "targetname");

		// if the brush is a fixed size entity, create a new entity
		if (b->owner->eclass->fixedsize)
		{
			n = Brush_Clone (b);
			Brush_AddToList (n, &active_brushes);
			Entity_LinkBrush (e, n);
			Brush_Build( n );
			Brush_Move (b, delta);
			continue;
		}
        
		// brush is a complex entity, grab all the other ones now

		next = &selected_brushes;

		for ( b2 = b ; b2 != &selected_brushes ; b2=next2)
		{
			next2 = b2->next;
			if (b2->owner != b->owner)
			{
				if (next == &selected_brushes)
					next = b2;
				continue;
			}

			// move b2 to the start of selected_brushes,
			// so it won't be hit again
			Brush_RemoveFromList (b2);
			Brush_AddToList (b2, &selected_brushes);
			
			n = Brush_Clone (b2);
			Brush_AddToList (n, &active_brushes);
			Entity_LinkBrush (e, n);
			Brush_Build( n );
			Brush_Move (b2, delta);
		}

	}
	Sys_UpdateWindows (W_ALL);
}