示例#1
0
/*
   ===========
   Map_RegionTallBrush
   ===========
 */
void Map_RegionTallBrush( void ){
	brush_t *b;

	if ( !QE_SingleBrush() ) {
		return;
	}

	b = selected_brushes.next;

	Map_RegionOff();

	VectorCopy( b->mins, region_mins );
	VectorCopy( b->maxs, region_maxs );
	region_mins[2] = g_MinWorldCoord + 64;
	region_maxs[2] = g_MaxWorldCoord - 64;

	Undo_Start( "delete" );
	Undo_AddBrushList( &selected_brushes );
	Undo_AddEntity( b->owner );
	Select_Delete();
	Undo_EndBrushList( &selected_brushes );
	Undo_End();

	Map_ApplyRegion();
}
示例#2
0
void Select_Inside (void)
{
	brush_t	*b, *next;
	int		i;
	vec3_t	mins, maxs;

	if (!QE_SingleBrush ())
		return;

	g_qeglobals.d_select_mode = sel_brush;

	Math_VectorCopy (selected_brushes.next->mins, mins);
	Math_VectorCopy (selected_brushes.next->maxs, maxs);

	Select_Delete ();

	for (b=active_brushes.next ; b != &active_brushes ; b=next)
	{
		next = b->next;
		for (i=0 ; i<3 ; i++)
			if (b->maxs[i] > maxs[i] || b->mins[i] < mins[i])
				break;
		if (i == 3)
		{
			Brush_RemoveFromList (b);
			Brush_AddToList (b, &selected_brushes);
		}
	}
	Sys_UpdateWindows (W_ALL);
}
示例#3
0
void Select_Inside( void )
{
	brush_s*    b, *next;
	int     i;
	edVec3_c    mins, maxs;
	
	if ( !QE_SingleBrush() )
		return;
		
	clearSelection();
	
	mins = selected_brushes.next->getMins();
	maxs = selected_brushes.next->getMaxs();
	Select_Delete();
	
	for ( b = active_brushes.next ; b != &active_brushes ; b = next )
	{
		next = b->next;
		
		if ( FilterBrush( b ) )
			continue;
			
		for ( i = 0 ; i < 3 ; i++ )
			if ( b->getMaxs()[i] > maxs[i] || b->getMins()[i] < mins[i] )
				break;
		if ( i == 3 )
		{
			Brush_RemoveFromList( b );
			Brush_AddToList( b, &selected_brushes );
		}
	}
	Sys_UpdateWindows( W_ALL );
}
示例#4
0
void Select_Touching (void)
{
	brush_t	*b, *next;
	int		i;
	vec3_t	mins, maxs;

	if (!QE_SingleBrush ())
		return;

	g_qeglobals.d_select_mode = sel_brush;

	VectorCopy (selected_brushes.next->mins, mins);
	VectorCopy (selected_brushes.next->maxs, maxs);

	for (b=active_brushes.next ; b != &active_brushes ; b=next)
	{
		next = b->next;

	 	if (FilterBrush (b))
	 		continue;

		for (i=0 ; i<3 ; i++)
			if (b->mins[i] > maxs[i]+1 || b->maxs[i] < mins[i]-1)
				break;

		if (i == 3)
		{
			Brush_RemoveFromList (b);
			Brush_AddToList (b, &selected_brushes);
		}
	}
	Sys_UpdateWindows (W_ALL);
}
示例#5
0
/*
 =======================================================================================================================
 =======================================================================================================================
 */
void SetupVertexSelection(void) {
	face_t	*f;
	brush_t *b;

	g_qeglobals.d_numpoints = 0;
	g_qeglobals.d_numedges = 0;

#ifdef NEWEDGESEL
	for (b = selected_brushes.next; b != &selected_brushes; b = b->next) {
		for (f = b->brush_faces; f; f = f->next) {
			MakeFace(b, f);
		}
	}

#else
	if (!QE_SingleBrush()) {
		return;
	}

	b = selected_brushes.next;
	for (f = b->brush_faces; f; f = f->next) {
		MakeFace(b, f);
	}
#endif
}
示例#6
0
void Terrain_BrushToMesh( void ) {
	brush_t			*b;
	terrainMesh_t	*p;

	if ( !QE_SingleBrush() ) {
		return;
	}

	b = selected_brushes.next;

	if ( g_qeglobals.d_terrainWidth	< 1 ) {
		g_qeglobals.d_terrainWidth = 1;
	}

	if ( g_qeglobals.d_terrainHeight < 1 ) {
		g_qeglobals.d_terrainHeight = 1;
	}

	p = MakeNewTerrain( g_qeglobals.d_terrainWidth + 1, g_qeglobals.d_terrainHeight + 1, b->brush_faces->d_texture );
	p->scale_x = ( b->maxs[ 0 ] - b->mins[ 0 ] ) / float( p->width - 1 );
	p->scale_y = ( b->maxs[ 1 ] - b->mins[ 1 ] ) / float( p->height - 1 );

	VectorCopy( b->mins, p->origin );

	b = AddBrushForTerrain( p );
	Select_Delete();
	Select_Brush( b );
}
示例#7
0
entity_t *SingleLightSelected() {
	if ( QE_SingleBrush( true, true ) ) {
		brush_t *b = selected_brushes.next;
		if ( ( b->owner->eclass->nShowFlags & ECLASS_LIGHT ) && !b->entityModel ) {
			return b->owner;
		}
	}
	return NULL;
}
/*
 =======================================================================================================================
    Map_RegionBrush
 =======================================================================================================================
 */
void Map_RegionBrush( void ) {
	brush_t *b;
	if( !QE_SingleBrush() ) {
		return;
	}
	b = selected_brushes.next;
	Map_RegionOff();
	VectorCopy( b->mins, region_mins );
	VectorCopy( b->maxs, region_maxs );
	Select_Delete();
	Map_ApplyRegion();
}
/*
 =======================================================================================================================
    Map_RegionTallBrush
 =======================================================================================================================
 */
void Map_RegionTallBrush( void ) {
	brush_t *b;
	if( !QE_SingleBrush() ) {
		return;
	}
	b = selected_brushes.next;
	Map_RegionOff();
	VectorCopy( b->mins, region_mins );
	VectorCopy( b->maxs, region_maxs );
	region_mins[2] = MIN_WORLD_COORD;
	region_maxs[2] = MAX_WORLD_COORD;
	Select_Delete();
	Map_ApplyRegion();
}
示例#10
0
void Select_PartialTall( void )
{
	brush_s*    b, *next;
	//int       i;
	edVec3_c    mins, maxs;
	
	if ( !QE_SingleBrush() )
		return;
		
	clearSelection();
	
	mins = selected_brushes.next->getMins();
	maxs = selected_brushes.next->getMaxs();
	Select_Delete();
	
	int nDim1 = ( g_pParentWnd->ActiveXY()->GetViewType() == YZ ) ? 1 : 0;
	int nDim2 = ( g_pParentWnd->ActiveXY()->GetViewType() == XY ) ? 1 : 2;
	
	for ( b = active_brushes.next ; b != &active_brushes ; b = next )
	{
		next = b->next;
		
		if ( ( b->getMins()[nDim1] > maxs[nDim1] || b->getMaxs()[nDim1] < mins[nDim1] )
				|| ( b->getMins()[nDim2] > maxs[nDim2] || b->getMaxs()[nDim2] < mins[nDim2] ) )
			continue;
			
		if ( FilterBrush( b ) )
			continue;
			
		Brush_RemoveFromList( b );
		Brush_AddToList( b, &selected_brushes );
		
		
#if 0
		// old stuff
		for ( i = 0 ; i < 2 ; i++ )
			if ( b->mins[i] > maxs[i] || b->maxs[i] < mins[i] )
				break;
		if ( i == 2 )
		{
			Brush_RemoveFromList( b );
			Brush_AddToList( b, &selected_brushes );
		}
#endif
	}
	Sys_UpdateWindows( W_ALL );
}
示例#11
0
void Select_CompleteTall (void)
{
	brush_t	*b, *next;
	//int		i;
	vec3_t	mins, maxs;

	if (!QE_SingleBrush ())
		return;

	g_qeglobals.d_select_mode = sel_brush;

	VectorCopy (selected_brushes.next->mins, mins);
	VectorCopy (selected_brushes.next->maxs, maxs);
	Select_Delete ();

  int nDim1 = (g_pParentWnd->ActiveXY()->GetViewType() == YZ) ? 1 : 0;
  int nDim2 = (g_pParentWnd->ActiveXY()->GetViewType() == XY) ? 1 : 2;

	for (b=active_brushes.next ; b != &active_brushes ; b=next)
	{
		next = b->next;

    if ( (b->maxs[nDim1] > maxs[nDim1] || b->mins[nDim1] < mins[nDim1]) 
      || (b->maxs[nDim2] > maxs[nDim2] || b->mins[nDim2] < mins[nDim2]) )
      continue;

	 	if (FilterBrush (b))
	 		continue;

		Brush_RemoveFromList (b);
		Brush_AddToList (b, &selected_brushes);
#if 0
    // old stuff
    for (i=0 ; i<2 ; i++)
			if (b->maxs[i] > maxs[i] || b->mins[i] < mins[i])
				break;
		if (i == 2)
		{
			Brush_RemoveFromList (b);
			Brush_AddToList (b, &selected_brushes);
		}
#endif
	}
	Sys_UpdateWindows (W_ALL);
}
void CPlugInManager::Dispatch(int n, const char * p)
{
  for (int i = 0; i < m_PlugIns.GetSize(); i++)
  {
    CPlugIn *plug = reinterpret_cast<CPlugIn*>(m_PlugIns.GetAt(i));
    if (plug->ownsCommandID(n))
    {
      vec3_t vMin, vMax;
    	if (selected_brushes.next == &selected_brushes)
      {
        vMin[0] = vMin[1] = vMin[2] = 0;
        VectorCopy(vMin, vMax);
      }
      else
      {
        Select_GetBounds (vMin, vMax);
      }
      plug->dispatchCommand(p, vMin, vMax, QE_SingleBrush(true));	// PGM -- added quiet
      break;
    }
  }
}
示例#13
0
/*
===============
Curve_Invert
===============
*/
void Curve_Invert (void) {
	brush_t		*b;
	face_t		*f;
	qboolean	curve, negative;

	if (!QE_SingleBrush())
		return;

	b = selected_brushes.next;

	curve = false;
	negative = false;
	for (f = b->brush_faces ; f ; f = f->next) {
		if (f->texdef.contents & CONTENTS_NEGATIVE_CURVE) {
			negative = true;
		}
		if (f->texdef.flags & SURF_CURVE) {
			curve = true;
		}
	}
	if (!curve) {
		return;
	}

	negative ^= 1;
	for (f = b->brush_faces ; f ; f = f->next) {
		if (negative) {
			f->texdef.contents |= CONTENTS_NEGATIVE_CURVE;
		} else {
			f->texdef.contents &= ~CONTENTS_NEGATIVE_CURVE;
		}
	}

	Curve_BuildPoints (b);
	Sys_UpdateWindows (W_ALL);
}
示例#14
0
/*	Makes the current brushhave the given number of 2d sides
*/
void Brush_MakeSided(int sides)
{
	int			i;
	vec3_t		mins, maxs;
	brush_t		*b;
	texdef_t	*texdef;
	face_t		*f;
	vec3_t		mid;
	float		width,sv,cv;

	if(sides < 3)
	{
		Sys_Status ("Bad sides number", 0);
		return;
	}
	else if(!QE_SingleBrush())
	{
		Sys_Status ("Must have a single brush selected", 0 );
		return;
	}

	b = selected_brushes.next;
	Math_VectorCopy(b->mins,mins);
	Math_VectorCopy(b->maxs,maxs);
	texdef = &g_qeglobals.d_texturewin.texdef;

	Brush_Free (b);

	// find center of brush
	width = 8;
	for (i=0 ; i<2 ; i++)
	{
		mid[i] = (maxs[i] + mins[i])*0.5;
		if (maxs[i] - mins[i] > width)
			width = maxs[i] - mins[i];
	}
	width /= 2;

	b = qmalloc (sizeof(brush_t));

	// create top face
	f = Face_Alloc();
	f->texdef = *texdef;
	f->next = b->brush_faces;
	b->brush_faces = f;

	f->planepts[2][0] = mins[0];f->planepts[2][1] = mins[1];f->planepts[2][2] = maxs[2];
	f->planepts[1][0] = maxs[0];f->planepts[1][1] = mins[1];f->planepts[1][2] = maxs[2];
	f->planepts[0][0] = maxs[0];f->planepts[0][1] = maxs[1];f->planepts[0][2] = maxs[2];

	// create bottom face
	f = Face_Alloc();
	f->texdef	= *texdef;
	f->next		= b->brush_faces;

	b->brush_faces = f;

	f->planepts[0][0] = mins[0];f->planepts[0][1] = mins[1];f->planepts[0][2] = mins[2];
	f->planepts[1][0] = maxs[0];f->planepts[1][1] = mins[1];f->planepts[1][2] = mins[2];
	f->planepts[2][0] = maxs[0];f->planepts[2][1] = maxs[1];f->planepts[2][2] = mins[2];

	for (i=0 ; i<sides ; i++)
	{
		f = Face_Alloc();
		f->texdef = *texdef;
		f->next = b->brush_faces;
		b->brush_faces = f;

		sv = sin (i*3.14159265*2/sides);
		cv = cos (i*3.14159265*2/sides);

		f->planepts[0][0] = floor(mid[0]+width*cv+0.5);
		f->planepts[0][1] = floor(mid[1]+width*sv+0.5);
		f->planepts[0][2] = mins[2];

		f->planepts[1][0] = f->planepts[0][0];
		f->planepts[1][1] = f->planepts[0][1];
		f->planepts[1][2] = maxs[2];

		f->planepts[2][0] = floor(f->planepts[0][0] - width*sv + 0.5);
		f->planepts[2][1] = floor(f->planepts[0][1] + width*cv + 0.5);
		f->planepts[2][2] = maxs[2];

	}

	Brush_AddToList (b, &selected_brushes);

	Entity_LinkBrush (world_entity, b);

	Brush_Build( b );

	Sys_UpdateWindows (W_ALL);
}
示例#15
0
/*
===================
Curve_MakeCurvedBrush
===================
*/
void Curve_MakeCurvedBrush (qboolean negative, qboolean top, qboolean bottom, 
					qboolean s1, qboolean s2, qboolean s3, qboolean s4) {
	brush_t		*b;
	curveBlock_t	*cb;
	cubeFace_t		*cf;
	int			i;
	float		best;
	int			bestFace;
	int			opposite;
	face_t		*f;

	if (!QE_SingleBrush())
		return;

	b = selected_brushes.next;
	cb = BrushToCurveBlock(b);
	if (!cb) {
		return;
	}

	// set as detail and clear all curve flags
	for (f = b->brush_faces ; f ; f = f->next ) {
		f->texdef.flags &= ~SURF_KEEP;
		f->texdef.contents |= CONTENTS_DETAIL;
		if (negative) {
			f->texdef.contents |= CONTENTS_NEGATIVE_CURVE;
		} else {
			f->texdef.contents &= ~CONTENTS_NEGATIVE_CURVE;
		}
	}

	// find the top face
	best = MIN_WORLD_COORD;
	bestFace = 0;

	for (i = 0 ; i < 6 ; i++) {
		if (cb->faces[i].brushFace->plane.normal[2] > best) {
			best = cb->faces[i].brushFace->plane.normal[2];
			bestFace = i;
		}
	}

	cf = &cb->faces[bestFace];
	if (top) {
		cf->brushFace->texdef.flags |= SURF_CURVE;
	}
	if (bottom) {
		opposite = OppositeFace(cb, bestFace);
		cb->faces[opposite].brushFace->texdef.flags |= SURF_CURVE;
	}
	if (s1) {
		cb->faces[cf->neighbors[0]].brushFace->texdef.flags |= SURF_CURVE;
	}
	if (s2) {
		cb->faces[cf->neighbors[1]].brushFace->texdef.flags |= SURF_CURVE;
	}
	if (s3) {
		cb->faces[cf->neighbors[2]].brushFace->texdef.flags |= SURF_CURVE;
	}
	if (s4) {
		cb->faces[cf->neighbors[3]].brushFace->texdef.flags |= SURF_CURVE;
	}

	Curve_BuildPoints (b);
	Sys_UpdateWindows (W_ALL);

}
示例#16
0
void CSurfaceDlg::SetTexMods()
{
	char	sz[128];
	texdef_t *pt;
	brushprimit_texdef_t	*bpt;
	// local copy if a width=2 height=2 qtetxture_t is needed
	brushprimit_texdef_t	local_bp;
	int		i;

	if (!g_surfwin)
		return;

	m_bPatchMode = false;

	if (OnlyPatchesSelected())
	{
		pt = &g_qeglobals.d_texturewin.texdef;
		if (QE_SingleBrush())
    {
			//strcpy(g_patch_texdef.name, Patch_GetTextureName());
			g_patch_texdef.SetName(Patch_GetTextureName());
    }
		else
    {
			//strcpy(g_patch_texdef.name, pt->name);
			g_patch_texdef.SetName(pt->name);
    }
		g_patch_texdef.contents = pt->contents;
		g_patch_texdef.flags = pt->flags;
		g_patch_texdef.value = pt->value;
		pt = &g_patch_texdef;
		m_bPatchMode = true;
	}
	else
	{
		if (g_bNewFace && g_ptrSelectedFaces.GetSize() > 0)
		{
      face_t *selFace = reinterpret_cast<face_t*>(g_ptrSelectedFaces.GetAt(0));
			pt = &selFace->texdef;
			if (g_qeglobals.m_bBrushPrimitMode)
			{
				// compute a texture matrix related to the default matrix width=2 height=2
				ConvertTexMatWithQTexture( &selFace->brushprimit_texdef, selFace->d_texture, &local_bp, NULL );
				bpt = &local_bp;
			}
		}
		else
		{
			pt = &g_qeglobals.d_texturewin.texdef;
			if (g_qeglobals.m_bBrushPrimitMode)
			{
				bpt = &g_qeglobals.d_texturewin.brushprimit_texdef;
			}
		}
		// brush primitive mode : compute fake shift scale rot representation
		if (g_qeglobals.m_bBrushPrimitMode)
			TexMatToFakeTexCoords( bpt->coords, m_shift, &m_rotate, m_scale );
	}

	SendMessage (WM_SETREDRAW, 0, 0);

	::SetWindowText(GetDlgItem(IDC_TEXTURE)->GetSafeHwnd(), pt->name);

	if (m_bPatchMode)
		sprintf(sz, "%4.6f", pt->shift[0]);
	else
		if (g_qeglobals.m_bBrushPrimitMode)
			sprintf(sz, "%d", (int)m_shift[0]);
		else
			sprintf(sz, "%d", (int)pt->shift[0]);
	::SetWindowText(GetDlgItem(IDC_HSHIFT)->GetSafeHwnd(), sz);

	if (m_bPatchMode)
		sprintf(sz, "%4.6f", pt->shift[1]);
	else
		if (g_qeglobals.m_bBrushPrimitMode)
			sprintf(sz, "%d", (int)m_shift[1]);
		else
			sprintf(sz, "%d", (int)pt->shift[1]);
	::SetWindowText(GetDlgItem(IDC_VSHIFT)->GetSafeHwnd(), sz);

	sprintf(sz, m_bPatchMode ? "%4.6f" : "%4.6f", g_qeglobals.m_bBrushPrimitMode ? m_scale[0] : pt->scale[0]);
	::SetWindowText(GetDlgItem(IDC_HSCALE)->GetSafeHwnd(), sz);

	sprintf(sz, m_bPatchMode ? "%4.6f" : "%4.6f", g_qeglobals.m_bBrushPrimitMode ? m_scale[1] : pt->scale[1]);
	::SetWindowText(GetDlgItem(IDC_VSCALE)->GetSafeHwnd(), sz);

	//++timo compute BProtate as int ..
	sprintf(sz, "%d", g_qeglobals.m_bBrushPrimitMode ? (int)m_rotate : (int)pt->rotate);
	::SetWindowText(GetDlgItem(IDC_ROTATE)->GetSafeHwnd(), sz);

	sprintf(sz, "%d", (int)pt->value);
	::SetWindowText(GetDlgItem(IDC_VALUE)->GetSafeHwnd(), sz);

	for (i=0 ; i<32 ; i++)
		::SendMessage(GetDlgItem(g_checkboxes[i])->GetSafeHwnd(), BM_SETCHECK, !!(pt->flags&(1<<i)), 0 );
	for (i=0 ; i<32 ; i++)
		::SendMessage(GetDlgItem(g_checkboxes[32+i])->GetSafeHwnd(), BM_SETCHECK, !!(pt->contents&(1<<i)), 0 );

	SendMessage (WM_SETREDRAW, 1, 0);
	InvalidateRect (NULL, true);
}