- // ensure we have something selected
- if( g_FuncTable.m_pfnSelectedBrushCount() != 1 )
- {
- MessageBox(NULL, "Invalid number of brushes selected, chose 1 only", "Error", MB_OK);
- return;
- }
-
- // tell Radiant we want to access the selected brushes
- g_FuncTable.m_pfnAllocateSelectedBrushHandles();
-
- // get handle to size definition brush
- brush_t *brush = (brush_t*)g_FuncTable.m_pfnGetSelectedBrushHandle(0);
- // cant release until we delete the brush, if we do...
-
-
- // ask user for type, size, etc....
- if(stairDlg.DoModal() == IDOK)
- {
-
- // calc brush size
- vec3_t size;
- _VectorSubtract(vMax, vMin, size);
-
-
- if(((int)size[2] % stairDlg.m_nStairHeight) != 0)
- {
- // stairs must fit evenly into brush
- MessageBox(NULL, "Invalid stair height\nHeight of block must be divisable by stair height", "Error", MB_OK);
- }
- else
- {
-
- // Remove Size Brush
- g_FuncTable.m_pfnDeleteBrushHandle(brush);
-
-
- // Get Step Count, Direction of Stairs, Stair Style
- int numSteps = (int)size[2] / stairDlg.m_nStairHeight;
- int direction = stairDlg.m_StairDir;
- int style = stairDlg.m_StairStyle;
-
- if(stairDlg.m_StairStyle == STYLE_CORNER)
- {
- BuildCornerStairs(vMin, vMax, numSteps, "textures/common/caulk", (LPCTSTR)stairDlg.m_riserTexture);
- }
- else
- {
- // Get Step Dimensions
- float stairHeight = (float)stairDlg.m_nStairHeight;
- float stairWidth;
- if((direction == MOVE_EAST) || (direction == MOVE_WEST))
- stairWidth = (size[0])/numSteps;
- else
- stairWidth = (size[1])/numSteps;
-
-
- // Build Base For Stair (bob's style)
- if(style == STYLE_BOB)
- Build_Wedge(direction, vMin, vMax, TRUE);
-
-
- // Set First Step Starting Position
- vMax[2] = vMin[2] + stairHeight;
- SetInitialStairPos(direction, vMin, vMax, stairWidth);
-
-
- // Build The Steps
- for(int i = 0; i < numSteps; i++)
- {
- if(style == STYLE_BOB)
- Build_StairStep_Wedge(direction, vMin, vMax, "textures/common/caulk", (LPCTSTR)stairDlg.m_riserTexture, stairDlg.m_bDetail);
- else if(style == STYLE_ORIGINAL)
- Build_StairStep(vMin, vMax, "textures/common/caulk", (LPCTSTR)stairDlg.m_riserTexture, direction);
-
- // get step into next position
- MoveBlock(direction, vMin, vMax, stairWidth);
- vMax[2] += stairHeight;
- if(style == STYLE_BOB)
- vMin[2] += stairHeight; // wedge bottom must be raised
- }
- }
- }
- }
-
- g_FuncTable.m_pfnReleaseSelectedBrushHandles();
+ // ensure we have something selected
+ if (g_FuncTable.m_pfnSelectedBrushCount() != 1) {
+ MessageBox(NULL, "Invalid number of brushes selected, chose 1 only", "Error", MB_OK);
+ return;
+ }
+
+ // tell Radiant we want to access the selected brushes
+ g_FuncTable.m_pfnAllocateSelectedBrushHandles();
+
+ // get handle to size definition brush
+ brush_t *brush = (brush_t *) g_FuncTable.m_pfnGetSelectedBrushHandle(0);
+ // cant release until we delete the brush, if we do...
+
+
+ // ask user for type, size, etc....
+ if (stairDlg.DoModal() == IDOK) {
+
+ // calc brush size
+ vec3_t size;
+ _VectorSubtract(vMax, vMin, size);
+
+
+ if (((int) size[2] % stairDlg.m_nStairHeight) != 0) {
+ // stairs must fit evenly into brush
+ MessageBox(NULL, "Invalid stair height\nHeight of block must be divisable by stair height", "Error", MB_OK);
+ } else {
+
+ // Remove Size Brush
+ g_FuncTable.m_pfnDeleteBrushHandle(brush);
+
+
+ // Get Step Count, Direction of Stairs, Stair Style
+ int numSteps = (int) size[2] / stairDlg.m_nStairHeight;
+ int direction = stairDlg.m_StairDir;
+ int style = stairDlg.m_StairStyle;
+
+ if (stairDlg.m_StairStyle == STYLE_CORNER) {
+ BuildCornerStairs(vMin, vMax, numSteps, "textures/common/caulk", (LPCTSTR) stairDlg.m_riserTexture);
+ } else {
+ // Get Step Dimensions
+ float stairHeight = (float) stairDlg.m_nStairHeight;
+ float stairWidth;
+ if ((direction == MOVE_EAST) || (direction == MOVE_WEST)) {
+ stairWidth = (size[0]) / numSteps;
+ } else {
+ stairWidth = (size[1]) / numSteps;
+ }
+
+
+ // Build Base For Stair (bob's style)
+ if (style == STYLE_BOB) {
+ Build_Wedge(direction, vMin, vMax, TRUE);
+ }
+
+
+ // Set First Step Starting Position
+ vMax[2] = vMin[2] + stairHeight;
+ SetInitialStairPos(direction, vMin, vMax, stairWidth);
+
+
+ // Build The Steps
+ for (int i = 0; i < numSteps; i++) {
+ if (style == STYLE_BOB) {
+ Build_StairStep_Wedge(direction, vMin, vMax, "textures/common/caulk",
+ (LPCTSTR) stairDlg.m_riserTexture, stairDlg.m_bDetail);
+ } else if (style == STYLE_ORIGINAL) {
+ Build_StairStep(vMin, vMax, "textures/common/caulk", (LPCTSTR) stairDlg.m_riserTexture,
+ direction);
+ }
+
+ // get step into next position
+ MoveBlock(direction, vMin, vMax, stairWidth);
+ vMax[2] += stairHeight;
+ if (style == STYLE_BOB) {
+ vMin[2] += stairHeight; // wedge bottom must be raised
+ }
+ }
+ }
+ }
+ }
+
+ g_FuncTable.m_pfnReleaseSelectedBrushHandles();