示例#1
0
//////////////////////////////////////////////////////////
// TMapDC
// ------
//  draw a LineDef
void TMapDC::DrawMapLineDefLen (int editmode, SHORT ldnum)
{
	assert_ldnum (ldnum);

	// Use interm. vars. to accelarate
	LineDef *pLD = &LineDefs[ldnum];
	SHORT start = pLD->start;
	SHORT end   = pLD->end;

	assert_vnum (start);
	assert_vnum (end);
	Vertex *pVStart = &Vertexes[start];
	Vertex *pVEnd   = &Vertexes[end];
	SHORT x0    = pVStart->x;
	SHORT y0    = pVStart->y;
	SHORT x1    = pVEnd->x;
	SHORT y1    = pVEnd->y;

#ifndef WINDOWS_CLIPPING
	if ( ! IS_VISIBLE_MAP_RECT(x0,y0,x1,y1) )
		return;
#endif

    // Get the LineDef color
    int color = GetLineDefColor(editmode, ldnum);

	// Draw the Length
	DrawLineDefLen (x0, y0, x1, y1, color);
}
示例#2
0
//////////////////////////////////////////////////////////
// TMapDC
// ------
//  Return a LineDef color
int TMapDC::GetLineDefColor (int editmode, SHORT ldnum)
{
	assert_ldnum (ldnum);
	int color = 0;
	SHORT m;
	Sector *pSector;

	// Use interm. vars. to accelarate
	LineDef *pLD = &LineDefs[ldnum];

	// Select pen color
	switch (editmode)
	{
	case OBJ_THINGS:
	case OBJ_LINEDEFS:
	case OBJ_VERTEXES:
		if ((pLD->blak_flags & BF_POS_PASSABLE) && 
		    (pLD->blak_flags & BF_NEG_PASSABLE))
		   color = MAGENTA;
		else color = LIGHTGRAY;
		break;

	case OBJ_SECTORS:
		if ((m = pLD->sidedef1)      < 0 ||
			(m = SideDefs[m].sector) < 0 )
		{
			color = LIGHTRED;
		}
		else
		{
			pSector = &Sectors[m];

			if      (pSector->tag > 0)			color = LIGHTGREEN;
			else if (pSector->special > 0)   	color = LIGHTCYAN;
			else if (pLD->flags & 1)    		color = WHITE;
			else                                color = LIGHTGRAY;

			if ((m = pLD->sidedef2) >= 0)
			{
				m = SideDefs[m].sector;
				if (m < 0)						color = LIGHTRED;
				else
				{
					pSector = &Sectors[m];
					if (pSector->tag > 0)       	color = LIGHTGREEN;
					else if (pSector->special > 0)   color = LIGHTCYAN;
				}
			}
		}
		break;
	}

	return color;
}
示例#3
0
//////////////////////////////////////////////////////////
// TMapDC
// ------
//  draw a LineDef
void TMapDC::DrawMapLineDef (int editmode, SHORT ldnum, BOOL DrawLen)
{
	assert_ldnum (ldnum);

	// Use interm. vars. to accelarate
	LineDef HUGE *pLD = &LineDefs[ldnum];
	SHORT start = pLD->start;
	SHORT end   = pLD->end;

	assert_vnum (start);
	assert_vnum (end);
	Vertex HUGE *pVStart = &Vertexes[start];
	Vertex HUGE *pVEnd   = &Vertexes[end];
	SHORT x0    = pVStart->x;
	SHORT y0    = pVStart->y;
	SHORT x1    = pVEnd->x;
	SHORT y1    = pVEnd->y;

#ifndef WINDOWS_CLIPPING
	if ( ! IS_VISIBLE_MAP_RECT(x0, y0, x1, y1) )
		return;
#endif

	// Set the LineDef color
	int color = GetLineDefColor(editmode, ldnum);
	SetPenColor16(color);

	// Draw the LineDef
	if ( editmode == OBJ_VERTEXES )
		DrawMapVector(x0, y0, x1, y1);
	else
		DrawMapLine(x0, y0, x1, y1);

	// Draw the Length
	if ( DrawLen )
		DrawLineDefLen(x0, y0, x1, y1, color);
}