Skip to content
42 changes: 42 additions & 0 deletions GeneralsMD/Code/Tools/WorldBuilder/include/BrushTool.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,40 @@ class WorldHeightMapEdit;
/// Height brush tool.
class BrushTool : public Tool
{
public:
enum {
MIN_RAISE_LOWER = 1,
MAX_RAISE_LOWER = 21,
MIN_SMOOTH_RADIUS = 1,
MAX_SMOOTH_RADIUS = 5,
MIN_SMOOTH_RATE = 1,
MAX_SMOOTH_RATE = 10
};

enum EBrushMode {
BRUSH_MODE_RAISE,
BRUSH_MODE_LOWER,
BRUSH_MODE_SET,
BRUSH_MODE_SMOOTH
};

protected:
enum {MIN_DELAY_TIME = 60};

WorldHeightMapEdit *m_htMapEditCopy; ///< ref counted.
WorldHeightMapEdit *m_htMapFeatherCopy; ///< ref counted.
WorldHeightMapEdit *m_htMapRateCopy; ///< ref counted (smooth mode).

static Int m_brushWidth;
static Int m_brushFeather;
static Bool m_brushSquare;
static Int m_brushHeight;
static Int m_raiseLowerAmount;
static Int m_smoothRadius;
static Int m_smoothRate;

EBrushMode m_activeMode;
Int m_lastMoveTime;

public:
BrushTool(void);
Expand All @@ -48,9 +74,19 @@ class BrushTool : public Tool
static Int getWidth(void) {return m_brushWidth;}; ///<Returns width.
static Int getFeather(void) {return m_brushFeather;}; ///<Returns feather.
static Int getHeight(void) {return m_brushHeight;}; ///<Returns height.
static Int getRaiseLowerAmount(void) {return m_raiseLowerAmount;};
static Int getSmoothRadius(void) {return m_smoothRadius;};
static Int getSmoothRate(void) {return m_smoothRate;};
static void setWidth(Int width);
static void setFeather(Int feather);
static void setHeight(Int height);
static void setRaiseLowerAmount(Int amount);
static void setSmoothRadius(Int radius);
static void setSmoothRate(Int rate);
static EBrushMode getModeFromModifiers(Bool shiftDown, Bool ctrlDown);
static EBrushMode getPreviewModeFromKeys();
static const char* getModeDisplayName(EBrushMode mode);
static void getModeHintStrings(char *primaryBuf, Int primaryBufSize, char *secondaryBuf, Int secondaryBufSize);

public:
virtual void mouseDown(TTrackingMode m, CPoint viewPt, WbView* pView, CWorldBuilderDoc *pDoc);
Expand All @@ -60,4 +96,10 @@ class BrushTool : public Tool
virtual void activate(); ///< Become the current tool.
virtual Bool followsTerrain(void) {return false;};

protected:
EBrushMode determineBrushMode() const;
void applySetHeightBrush(const CPoint &ndx, Int brushWidth, CWorldBuilderDoc *pDoc);
void applyRaiseLowerBrush(const CPoint &ndx, Int brushWidth, Bool raising, CWorldBuilderDoc *pDoc);
void applySmoothBrush(const CPoint &ndx, Int brushWidth, CWorldBuilderDoc *pDoc);
void resetSmoothRateBuffer();
};
20 changes: 19 additions & 1 deletion GeneralsMD/Code/Tools/WorldBuilder/include/brushoptions.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,13 @@ class BrushOptions : public COptionsPanel , public PopupSliderOwner
FREQ_BRUSH_TICKS=10,
MIN_FEATHER=0,
FREQ_FEATHER_TICKS=4,
MAX_FEATHER=20};
MAX_FEATHER=20,
MIN_RAISE_LOWER=1,
MAX_RAISE_LOWER=21,
MIN_SMOOTH_RADIUS=1,
MAX_SMOOTH_RADIUS=5,
MIN_SMOOTH_RATE=1,
MAX_SMOOTH_RATE=10};

BrushOptions(CWnd* pParent = NULL); // standard constructor

Expand Down Expand Up @@ -64,6 +70,9 @@ class BrushOptions : public COptionsPanel , public PopupSliderOwner
afx_msg void OnChangeFeatherEdit();
afx_msg void OnChangeSizeEdit();
afx_msg void OnChangeHeightEdit();
afx_msg void OnChangeRaiseLowerEdit();
afx_msg void OnChangeSmoothRadiusEdit();
afx_msg void OnChangeSmoothRateEdit();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()

Expand All @@ -72,16 +81,25 @@ class BrushOptions : public COptionsPanel , public PopupSliderOwner
static Int m_currentWidth; ///< current brush width in the ui.
static Int m_currentFeather; ///< current feather width in the ui.
static Int m_currentHeight;
static Int m_currentRaiseLower;
static Int m_currentSmoothRadius;
static Int m_currentSmoothRate;

Bool m_updating; ///<true if the ui is updating itself.
WBPopupSliderButton m_brushWidthPopup;
WBPopupSliderButton m_brushFeatherPopup;
WBPopupSliderButton m_brushHeightPopup;
WBPopupSliderButton m_raiseLowerPopup;
WBPopupSliderButton m_smoothRadiusPopup;
WBPopupSliderButton m_smoothRatePopup;

public:
static void setWidth(Int width);
static void setFeather(Int feather);
static void setHeight(Int height);
static void setRaiseLowerAmount(Int amount);
static void setSmoothRadius(Int radius);
static void setSmoothRate(Int rate);

public:

Expand Down
5 changes: 4 additions & 1 deletion GeneralsMD/Code/Tools/WorldBuilder/include/wbview.h
Original file line number Diff line number Diff line change
Expand Up @@ -241,10 +241,13 @@ class WbView : public CView
afx_msg void OnShowTerrain();
afx_msg void OnUpdateShowTerrain(CCmdUI* pCmdUI);
afx_msg int OnCreate(LPCREATESTRUCT lpcs);

afx_msg BOOL OnMouseWheel(UINT nFlags, short zDelta, CPoint point);

//}}AFX_MSG
DECLARE_MESSAGE_MAP()

protected:
Bool handleBrushMouseWheel(UINT nFlags, short zDelta);
};

/////////////////////////////////////////////////////////////////////////////
Expand Down
3 changes: 3 additions & 0 deletions GeneralsMD/Code/Tools/WorldBuilder/res/resource.h
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,9 @@
#define IDC_PSEd_Color1 1031
#define IDC_FEATHER_LABEL 1032
#define IDC_WIDTH_LABEL3 1032
#define IDC_RAISELOWER_EDIT 1800
#define IDC_RAISELOWER_POPUP 1801
#define IDC_RAISELOWER_LABEL 1802
#define IDC_TERRAIN_TREEVIEW 1033
#define IDC_SLIDER3 1034
#define IDC_SWAP_TEXTURES 1035
Expand Down
Loading
Loading