## Editor
Class LinearStairBuilder

source: C:\XIII\Editor\Classes\LinearStairBuilder.uc

    Core.Object
       |
       +--Editor.BrushBuilder
          |
          +--Editor.LinearStairBuilder

Direct Known Subclasses:None

class LinearStairBuilder
extends Editor.BrushBuilder

    //=============================================================================
    // LinearStairBuilder: Builds a Linear Staircase.
    //=============================================================================

Variables
`NumSteps,` | `AddToFirstStep`
`name` | `GroupName`

Source Code

    00001	//=============================================================================
    00002	// LinearStairBuilder: Builds a Linear Staircase.
    00003	//=============================================================================
    00004	class LinearStairBuilder
    00005		extends BrushBuilder;
    00006
    00007	var() int StepLength, StepHeight, StepWidth, NumSteps, AddToFirstStep;
    00008	var() name GroupName;
    00009
    00010	event bool Build()
    00011	{
    00012		local int i, LastIdx, CurrentX, CurrentY, CurrentZ, Adjustment;
    00013
    00014		// Check for bad input.
    00015		if( StepLength<=0 || StepHeight<=0 || StepWidth<=0 )
    00016			return BadParameters();
    00017		if( Numsteps<=1 || Numsteps>45 )
    00018			return BadParameters("NumSteps must be greater than 1 and less than 45.");
    00019
    00020		//
    00021		// Build the brush.
    00022		//
    00023		BeginBrush( false, GroupName );
    00024
    00025		CurrentX = 0;
    00026		CurrentY = 0;
    00027		CurrentZ = 0;
    00028
    00029		LastIdx = GetVertexCount();
    00030
    00031		// Bottom poly.
    00032		Vertex3f( 0,						0,			-StepHeight );
    00033		Vertex3f( 0,						StepWidth,	-StepHeight );
    00034		Vertex3f( StepLength * NumSteps,	StepWidth,	-StepHeight );
    00035		Vertex3f( StepLength * NumSteps,	0,			-StepHeight );
    00036		Poly4i(1, 0, 1, 2, 3, 'Base');
    00037		LastIdx += 4;
    00038
    00039		// Back poly.
    00040		Vertex3f( StepLength * NumSteps,	StepWidth,	-StepHeight );
    00041		Vertex3f( StepLength * NumSteps,	StepWidth,	(StepHeight * (NumSteps - 1)) + AddToFirstStep );
    00042		Vertex3f( StepLength * NumSteps,	0,			(StepHeight * (NumSteps - 1)) + AddToFirstStep );
    00043		Vertex3f( StepLength * NumSteps,	0,			-StepHeight );
    00044		Poly4i(1, 4, 5, 6, 7, 'Back');
    00045		LastIdx += 4;
    00046
    00047		// Tops of steps.
    00048		for( i = 0 ; i < Numsteps ; i++ )
    00049		{
    00050			CurrentX = (i * StepLength);
    00051			CurrentZ = (i * StepHeight) + AddToFirstStep;
    00052
    00053			// Top of the step
    00054			Vertex3f( CurrentX,					CurrentY,				CurrentZ );
    00055			Vertex3f( CurrentX,					CurrentY + StepWidth,	CurrentZ );
    00056			Vertex3f( CurrentX + StepLength,	CurrentY + StepWidth,	CurrentZ );
    00057			Vertex3f( CurrentX + StepLength,	CurrentY,				CurrentZ );
    00058
    00059			Poly4i(1,
    00060				LastIdx+(i*4)+3,
    00061				LastIdx+(i*4)+2,
    00062				LastIdx+(i*4)+1,
    00063				LastIdx+(i*4), 'Step');
    00064		}
    00065		LastIdx += (NumSteps*4);
    00066
    00067		// Fronts of steps.
    00068		for( i = 0 ; i < Numsteps ; i++ )
    00069		{
    00070			CurrentX = (i * StepLength);
    00071			CurrentZ = (i * StepHeight) + AddToFirstStep;
    00072			if( i == 0 )
    00073				Adjustment = AddToFirstStep;
    00074			else
    00075				Adjustment = 0;
    00076
    00077			// Top of the step
    00078			Vertex3f( CurrentX,		CurrentY,				CurrentZ );
    00079			Vertex3f( CurrentX,		CurrentY,				CurrentZ - StepHeight - Adjustment );
    00080			Vertex3f( CurrentX,		CurrentY + StepWidth,	CurrentZ - StepHeight - Adjustment );
    00081			Vertex3f( CurrentX,		CurrentY + StepWidth,	CurrentZ );
    00082
    00083			Poly4i(1,
    00084				LastIdx+(i*12)+3,
    00085				LastIdx+(i*12)+2,
    00086				LastIdx+(i*12)+1,
    00087				LastIdx+(i*12), 'Rise');
    00088
    00089			// Sides of the step
    00090			Vertex3f( CurrentX,								CurrentY,		CurrentZ );
    00091			Vertex3f( CurrentX,								CurrentY,		CurrentZ - StepHeight - Adjustment );
    00092			Vertex3f( CurrentX + (StepLength*(Numsteps-i)),	CurrentY,		CurrentZ - StepHeight - Adjustment );
    00093			Vertex3f( CurrentX + (StepLength*(Numsteps-i)),	CurrentY,		CurrentZ );
    00094
    00095			Poly4i(1,
    00096				LastIdx+(i*12)+4,
    00097				LastIdx+(i*12)+5,
    00098				LastIdx+(i*12)+6,
    00099				LastIdx+(i*12)+7, 'Side');
    00100
    00101			Vertex3f( CurrentX,								CurrentY + StepWidth,		CurrentZ );
    00102			Vertex3f( CurrentX,								CurrentY + StepWidth,		CurrentZ - StepHeight - Adjustment );
    00103			Vertex3f( CurrentX + (StepLength*(Numsteps-i)),	CurrentY + StepWidth,		CurrentZ - StepHeight - Adjustment );
    00104			Vertex3f( CurrentX + (StepLength*(Numsteps-i)),	CurrentY + StepWidth,		CurrentZ );
    00105
    00106			Poly4i(1,
    00107				LastIdx+(i*12)+11,
    00108				LastIdx+(i*12)+10,
    00109				LastIdx+(i*12)+9,
    00110				LastIdx+(i*12)+8, 'Side');
    00111		}
    00112
    00113		return EndBrush();
    00114	}
    00115
    00116	defaultproperties
    00117	{
    00118	     StepLength=32
    00119	     StepHeight=16
    00120	     StepWidth=256
    00121	     NumSteps=8
    00122	     GroupName="LinearStair"
    00123	     BitmapFilename="BBLinearStair"
    00124	     ToolTip="Linear Staircase"
    00125	}

End Source Code