Richard Boegli's CnC_Generals_Zero_Hour Fork WIP
This is documentation of Richard Boegil's Zero Hour Fork
 
Loading...
Searching...
No Matches
wbview.h
Go to the documentation of this file.
1/*
2** Command & Conquer Generals Zero Hour(tm)
3** Copyright 2025 Electronic Arts Inc.
4**
5** This program is free software: you can redistribute it and/or modify
6** it under the terms of the GNU General Public License as published by
7** the Free Software Foundation, either version 3 of the License, or
8** (at your option) any later version.
9**
10** This program is distributed in the hope that it will be useful,
11** but WITHOUT ANY WARRANTY; without even the implied warranty of
12** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13** GNU General Public License for more details.
14**
15** You should have received a copy of the GNU General Public License
16** along with this program. If not, see <http://www.gnu.org/licenses/>.
17*/
18
19#if !defined(AFX_WBVIEW_H__875234A1_8815_11D5_8CE0_00010297BBAC__INCLUDED_)
20#define AFX_WBVIEW_H__875234A1_8815_11D5_8CE0_00010297BBAC__INCLUDED_
21
22#if _MSC_VER > 1000
23#pragma once
24#endif // _MSC_VER > 1000
25
26#include "Lib/BaseType.h"
27#include "Tool.h"
28#include "Common/Debug.h"
29#include "Common/ThingSort.h"
30
32class BuildListInfo;
33// wbview.h : header file
34//
35
41
47
49// WbView view
50
51class WbView : public CView
52{
53protected:
54 WbView(); // protected constructor used by dynamic creation
55 DECLARE_DYNCREATE(WbView)
56
59
60 void mouseDown(TTrackingMode m, CPoint viewPt);
61 void mouseMove(TTrackingMode m, CPoint viewPt);
62 void mouseUp(TTrackingMode m, CPoint viewPt);
63
64
65 void constrainCenterPt();
66
68
70
78
80
82 //Bool m_lockVertical; ///< Reflects the ui button.
84 //Bool m_doLockVertical; ///< True if we are currently locking.
87
88 // Box feedback.
94
95 // Light direction feedback
96 Coord3D m_lightDirection[3]; //direction of all 3 lights
98
100
101 // Attributes
102public:
103
104 void doRectFeedback(Bool doFeedback, RECT &rect) {m_feedbackBox=rect;m_doRectFeedback = doFeedback;};
106 void rulerFeedbackInfo(Coord3D &point1, Coord3D &point2, Real dist);
107
108 void doLightFeedback(Bool doFeedback, Coord3D direction, Int lightIndex) { m_doLightFeedback=doFeedback; if (m_doLightFeedback) m_lightDirection[lightIndex]=direction;}
109
110 virtual Bool viewToDocCoords(CPoint curPt, Coord3D *newPt, Bool constrained=true) { DEBUG_CRASH(("should not call")); newPt->zero(); return false; }
111 virtual Bool docToViewCoords(Coord3D curPt, CPoint* newPt) { DEBUG_CRASH(("should not call")); return false; }
112
113 virtual Bool viewToDocCoordZ(CPoint curPt, Coord3D *newPt, Real Z) { return viewToDocCoords(curPt, newPt, false); }
114
116 virtual void setCenterInView(Real x, Real y) { }
117
119 virtual void updateHeightMapInView(WorldHeightMap *htMap, Bool partial, const IRegion2D &partialRange) { }
120
122 virtual void adjustDocSize() { }
123
125 virtual void scrollInView(Real x, Real y, Bool end) { DEBUG_CRASH(("should not call")); }
126
128 virtual void invalObjectInView(MapObject *pObj) { }
129
131 virtual void invalidateCellInView(int xIndex, int yIndex) { }
132
133 virtual void setDefaultCamera() { }
134 virtual void rotateCamera(Real delta) { }
135 virtual void pitchCamera(Real delta) { }
136
137 virtual Int getPickPixels(void) {return 4;}
139
140public:
141 CWorldBuilderDoc *WbDoc() { return ((CWorldBuilderDoc*)GetDocument()); }
142
143 void snapPoint(Coord3D *thePt) {if (m_snapToGrid || m_lockAngle) {thePt->x = MAP_XY_FACTOR*floor(thePt->x/MAP_XY_FACTOR+0.5); thePt->y = MAP_XY_FACTOR*floor(thePt->y/MAP_XY_FACTOR+0.5);};};
144
145 virtual TPickedStatus picked(MapObject *pObj, Coord3D docPt);
146 virtual MapObject *picked3dObjectInView(CPoint viewPt) {return NULL;};
147 virtual BuildListInfo *pickedBuildObjectInView(CPoint viewPt) {return NULL;};
148
152 void setShowModels(Bool show) {m_showModels = show;}
155
158
159 virtual Bool isDoingPitch( void ) { return false; }
160
161// Operations
162public:
163
164// Overrides
165 // ClassWizard generated virtual function overrides
166 //{{AFX_VIRTUAL(WbView)
167 protected:
168 virtual void OnDraw(CDC* pDC); // overridden to draw this view
169 //}}AFX_VIRTUAL
170
171// Implementation
172protected:
173 virtual ~WbView();
174#ifdef _DEBUG
175 virtual void AssertValid() const;
176 virtual void Dump(CDumpContext& dc) const;
177#endif
178
179 // Generated message map functions
180protected:
181 //{{AFX_MSG(WbView)
182 afx_msg void OnRButtonUp(UINT nFlags, CPoint point);
183 afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
184 afx_msg void OnMouseMove(UINT nFlags, CPoint point);
185 afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
186 afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
187 afx_msg void OnMButtonUp(UINT nFlags, CPoint point);
188 afx_msg void OnMButtonDown(UINT nFlags, CPoint point);
189 afx_msg BOOL OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message);
190 afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
191 afx_msg void OnKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags);
192 afx_msg void OnEditDelete();
193 afx_msg void OnEditCopy();
194 afx_msg void OnUpdateEditCopy(CCmdUI* pCmdUI);
195 afx_msg void OnEditCut();
196 afx_msg void OnUpdateEditCut(CCmdUI* pCmdUI);
197 afx_msg void OnEditPaste();
198 afx_msg void OnUpdateEditPaste(CCmdUI* pCmdUI);
199 afx_msg void OnViewSnaptogrid();
200 afx_msg void OnUpdateViewSnaptogrid(CCmdUI* pCmdUI);
201 afx_msg void OnViewShowObjects();
202 afx_msg void OnUpdateViewShowObjects(CCmdUI* pCmdUI);
203 afx_msg void OnEditSelectdup();
204 afx_msg void OnEditSelectsimilar();
205 afx_msg void OnEditSelectinvalidteam();
206 afx_msg void OnEditReplace();
208 afx_msg void OnLockHorizontal();
209 afx_msg void OnUpdateLockHorizontal(CCmdUI* pCmdUI);
210 afx_msg void OnLockVertical();
211 afx_msg void OnUpdateLockVertical(CCmdUI* pCmdUI);
212 afx_msg void OnEditGloballightoptions();
213 afx_msg void OnViewShowwaypoints();
214 afx_msg void OnUpdateViewShowwaypoints(CCmdUI* pCmdUI);
215 afx_msg void OnViewShowpolygontriggers();
216 afx_msg void OnUpdateViewShowpolygontriggers(CCmdUI* pCmdUI);
217 afx_msg void OnEditPlayerlist();
218 afx_msg void OnEditWorldinfo();
219 afx_msg void OnEditTeamlist();
220 afx_msg void OnUpdateObjectpropertiesReflectsinmirror(CCmdUI* pCmdUI);
221 afx_msg void OnPickStructures();
222 afx_msg void OnUpdatePickStructures(CCmdUI* pCmdUI);
223 afx_msg void OnPickInfantry();
224 afx_msg void OnUpdatePickInfantry(CCmdUI* pCmdUI);
225 afx_msg void OnPickVehicles();
226 afx_msg void OnUpdatePickVehicles(CCmdUI* pCmdUI);
227 afx_msg void OnPickShrubbery();
228 afx_msg void OnUpdatePickShrubbery(CCmdUI* pCmdUI);
229 afx_msg void OnPickManMade();
230 afx_msg void OnUpdatePickManMade(CCmdUI* pCmdUI);
231 afx_msg void OnPickNatural();
232 afx_msg void OnUpdatePickNatural(CCmdUI* pCmdUI);
233 afx_msg void OnPickDebris();
234 afx_msg void OnUpdatePickDebris(CCmdUI* pCmdUI);
235 afx_msg void OnPickAnything();
236 afx_msg void OnUpdatePickAnything(CCmdUI* pCmdUI);
237 afx_msg void OnPickWaypoints();
238 afx_msg void OnUpdatePickWaypoints(CCmdUI* pCmdUI);
239 afx_msg void OnPickRoads();
240 afx_msg void OnUpdatePickRoads(CCmdUI* pCmdUI);
241 afx_msg void OnPickSounds();
242 afx_msg void OnUpdatePickSounds(CCmdUI* pCmdUI);
243 afx_msg void OnShowNames();
244 afx_msg void OnUpdateShowNames(CCmdUI* pCmdUI);
245 afx_msg void OnValidationFixTeams();
246 afx_msg void OnShowTerrain();
247 afx_msg void OnUpdateShowTerrain(CCmdUI* pCmdUI);
248 afx_msg int OnCreate(LPCREATESTRUCT lpcs);
249
250
251 //}}AFX_MSG
252 DECLARE_MESSAGE_MAP()
253};
254
256
257//{{AFX_INSERT_LOCATION}}
258// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
259
260#endif // !defined(AFX_WBVIEW_H__875234A1_8815_11D5_8CE0_00010297BBAC__INCLUDED_)
#define NULL
Definition BaseType.h:92
bool Bool
Definition BaseType.h:132
float Real
Definition BaseType.h:124
#define DEBUG_CRASH(m)
Definition Debug.h:192
unsigned int UINT
Definition bittype.h:63
#define MAP_XY_FACTOR
Definition MapObject.h:60
EditorSortingType
Definition ThingSort.h:37
TTrackingMode
Definition Tool.h:31
#define BOOL
Definition Wnd_File.h:57
Vector3 m_centerPt
Definition wbview.h:58
afx_msg void OnUpdatePickWaypoints(CCmdUI *pCmdUI)
Definition wbview.cpp:897
afx_msg void OnUpdateEditPaste(CCmdUI *pCmdUI)
Definition wbview.cpp:604
afx_msg void OnViewSnaptogrid()
Definition wbview.cpp:610
afx_msg void OnMouseMove(UINT nFlags, CPoint point)
Definition wbview.cpp:349
afx_msg void OnRButtonDown(UINT nFlags, CPoint point)
Definition wbview.cpp:359
afx_msg BOOL OnSetCursor(CWnd *pWnd, UINT nHitTest, UINT message)
Definition wbview.cpp:451
afx_msg int OnCreate(LPCREATESTRUCT lpcs)
Definition wbview.cpp:1079
afx_msg void OnViewShowObjects()
Definition wbview.cpp:587
Bool isPolygonTriggerVisible(void)
Definition wbview.h:149
WbView()
Definition wbview.cpp:51
static Bool m_snapToGrid
Definition wbview.h:69
Bool m_showObjects
Flag whether object icons are drawn in the 2d and 3d view.
Definition wbview.h:71
afx_msg void OnEditPlayerlist()
Definition wbview.cpp:789
void doRulerFeedback(int doRulerFeedback)
Definition wbview.h:105
afx_msg void OnLockHorizontal()
Definition wbview.cpp:729
virtual Int getPickPixels(void)
Definition wbview.h:137
afx_msg void OnEditGloballightoptions()
Definition wbview.cpp:755
CWorldBuilderDoc * WbDoc()
Definition wbview.h:141
afx_msg void OnUpdateViewShowpolygontriggers(CCmdUI *pCmdUI)
Definition wbview.cpp:784
virtual void scrollInView(Real x, Real y, Bool end)
Scrolls the window by this amount.
Definition wbview.h:125
afx_msg void OnPickManMade()
Definition wbview.cpp:852
afx_msg void OnUpdatePickDebris(CCmdUI *pCmdUI)
Definition wbview.cpp:877
Coord3D m_rulerPoints[2]
Definition wbview.h:92
WorldHeightMapEdit * getTrackingHeightMap()
Definition wbview.cpp:419
afx_msg void OnEditCopy()
Definition wbview.cpp:505
afx_msg void OnEditSelectdup()
Definition wbview.cpp:621
Bool m_showWaypoints
Definition wbview.h:75
void setShowGarrisoned(Bool show)
Definition wbview.h:156
void mouseDown(TTrackingMode m, CPoint viewPt)
Definition wbview.cpp:178
afx_msg void OnUpdateObjectpropertiesReflectsinmirror(CCmdUI *pCmdUI)
Definition wbview.cpp:679
virtual void rotateCamera(Real delta)
Definition wbview.h:134
afx_msg void OnUpdateViewShowObjects(CCmdUI *pCmdUI)
Definition wbview.cpp:599
virtual void invalObjectInView(MapObject *pObj)
Invalidates an object. Pass NULL to inval all objects.
Definition wbview.h:128
void constrainCenterPt()
Definition wbview.cpp:434
afx_msg void OnUpdatePickSounds(CCmdUI *pCmdUI)
Definition wbview.cpp:917
afx_msg void OnEditWorldinfo()
Definition wbview.cpp:795
afx_msg void OnViewShowpolygontriggers()
Definition wbview.cpp:778
afx_msg void OnUpdatePickRoads(CCmdUI *pCmdUI)
Definition wbview.cpp:907
virtual MapObject * picked3dObjectInView(CPoint viewPt)
Definition wbview.h:146
afx_msg void OnValidationFixTeams()
Definition wbview.cpp:939
Bool getShowGarrisoned(void)
Definition wbview.h:157
virtual void updateHeightMapInView(WorldHeightMap *htMap, Bool partial, const IRegion2D &partialRange)
Update the height map in the 3d window.
Definition wbview.h:119
Bool m_doLightFeedback
Definition wbview.h:97
afx_msg void OnMButtonUp(UINT nFlags, CPoint point)
Definition wbview.cpp:374
Coord3D m_lightDirection[3]
Definition wbview.h:96
virtual void setDefaultCamera()
Definition wbview.h:133
afx_msg void OnViewShowwaypoints()
Definition wbview.cpp:766
afx_msg void OnLButtonDown(UINT nFlags, CPoint point)
Definition wbview.cpp:369
afx_msg void OnPickDebris()
Definition wbview.cpp:872
virtual void invalidateCellInView(int xIndex, int yIndex)
Invalidates the area of one height map cell in the 2d view.
Definition wbview.h:131
afx_msg void OnUpdatePickShrubbery(CCmdUI *pCmdUI)
Definition wbview.cpp:847
afx_msg void OnMButtonDown(UINT nFlags, CPoint point)
Definition wbview.cpp:379
void setShowModels(Bool show)
Definition wbview.h:152
CPoint m_mouseDownPoint
Definition wbview.h:85
virtual TPickedStatus picked(MapObject *pObj, Coord3D docPt)
Definition wbview.cpp:389
afx_msg void OnUpdateEditCut(CCmdUI *pCmdUI)
Definition wbview.cpp:555
afx_msg void OnUpdatePickVehicles(CCmdUI *pCmdUI)
Definition wbview.cpp:837
Bool m_doLockAngle
True if we are currently locking.
Definition wbview.h:83
afx_msg void OnPickAnything()
Definition wbview.cpp:882
afx_msg void OnEditPaste()
Definition wbview.cpp:560
RECT m_feedbackBox
Definition wbview.h:89
Real m_hysteresis
Definition wbview.h:79
Bool isWaypointVisible(void)
Definition wbview.h:150
Bool m_lockAngle
Reflects the ui button.
Definition wbview.h:81
void mouseMove(TTrackingMode m, CPoint viewPt)
Definition wbview.cpp:197
virtual Bool viewToDocCoords(CPoint curPt, Coord3D *newPt, Bool constrained=true)
Definition wbview.h:110
afx_msg void OnEditSelectsimilar()
Definition wbview.cpp:627
afx_msg void OnShowTerrain()
Definition wbview.cpp:1053
Bool m_showGarrisoned
Definition wbview.h:74
afx_msg void OnUpdateEditCopy(CCmdUI *pCmdUI)
Definition wbview.cpp:544
virtual Bool isDoingPitch(void)
Definition wbview.h:159
void doLightFeedback(Bool doFeedback, Coord3D direction, Int lightIndex)
Definition wbview.h:108
virtual void adjustDocSize()
the doc has changed size; readjust view as necessary.
Definition wbview.h:122
Bool isNamesVisible(void)
Definition wbview.h:151
afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)
Definition wbview.cpp:488
afx_msg void OnUpdatePickAnything(CCmdUI *pCmdUI)
Definition wbview.cpp:887
afx_msg void OnPickRoads()
Definition wbview.cpp:902
afx_msg void OnEditTeamlist()
Definition wbview.cpp:1071
Coord3D m_mouseDownDocPoint
Definition wbview.h:86
afx_msg void OnUpdateLockVertical(CCmdUI *pCmdUI)
Definition wbview.cpp:750
void mouseUp(TTrackingMode m, CPoint viewPt)
Definition wbview.cpp:317
afx_msg void OnUpdatePickManMade(CCmdUI *pCmdUI)
Definition wbview.cpp:857
Bool m_showModels
Flag whether models are drawn in the 2d and 3d view.
Definition wbview.h:72
virtual void setCenterInView(Real x, Real y)
Set the center for display.
Definition wbview.h:116
afx_msg void OnObjectpropertiesReflectsinmirror()
Definition wbview.cpp:708
Bool m_showNames
Flag whether names are drawn in the 2d and 3d view.
Definition wbview.h:73
afx_msg void OnUpdateViewSnaptogrid(CCmdUI *pCmdUI)
Definition wbview.cpp:616
afx_msg void OnEditDelete()
Definition wbview.cpp:471
EditorSortingType m_pickConstraint
Definition wbview.h:99
virtual BuildListInfo * pickedBuildObjectInView(CPoint viewPt)
Definition wbview.h:147
Bool m_doRectFeedback
Definition wbview.h:90
Real m_rulerLength
Definition wbview.h:93
virtual Bool viewToDocCoordZ(CPoint curPt, Coord3D *newPt, Real Z)
Definition wbview.h:113
afx_msg void OnPickNatural()
Definition wbview.cpp:862
TTrackingMode m_trackingMode
Definition wbview.h:57
afx_msg void OnPickVehicles()
Definition wbview.cpp:832
afx_msg void OnPickStructures()
Definition wbview.cpp:812
afx_msg void OnUpdateShowNames(CCmdUI *pCmdUI)
Definition wbview.cpp:934
void doRectFeedback(Bool doFeedback, RECT &rect)
Definition wbview.h:104
afx_msg void OnUpdateLockHorizontal(CCmdUI *pCmdUI)
Definition wbview.cpp:735
Bool m_showPolygonTriggers
Definition wbview.h:76
virtual ~WbView()
Definition wbview.cpp:74
afx_msg void OnPickInfantry()
Definition wbview.cpp:822
afx_msg void OnUpdateShowTerrain(CCmdUI *pCmdUI)
Definition wbview.cpp:1065
afx_msg void OnPickWaypoints()
Definition wbview.cpp:892
virtual EditorSortingType GetPickConstraint(void)
Definition wbview.h:138
afx_msg void OnPickSounds()
Definition wbview.cpp:912
afx_msg void OnKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags)
Definition wbview.cpp:499
Bool getShowTerrain(void)
Definition wbview.h:154
afx_msg void OnEditCut()
Definition wbview.cpp:549
Bool m_showTerrain
Flag whether terrain is rendered or not. (Useful for debugging)
Definition wbview.h:77
afx_msg void OnRButtonUp(UINT nFlags, CPoint point)
Definition wbview.cpp:354
int m_doRulerFeedback
Definition wbview.h:91
afx_msg void OnLButtonUp(UINT nFlags, CPoint point)
Definition wbview.cpp:364
afx_msg void OnShowNames()
Definition wbview.cpp:922
afx_msg void OnUpdateViewShowwaypoints(CCmdUI *pCmdUI)
Definition wbview.cpp:773
afx_msg void OnUpdatePickInfantry(CCmdUI *pCmdUI)
Definition wbview.cpp:827
afx_msg void OnEditReplace()
Definition wbview.cpp:640
Bool getShowModels(void)
Definition wbview.h:153
virtual void OnDraw(CDC *pDC)
Definition wbview.cpp:154
afx_msg void OnEditSelectinvalidteam()
Definition wbview.cpp:633
virtual Bool docToViewCoords(Coord3D curPt, CPoint *newPt)
Definition wbview.h:111
virtual void pitchCamera(Real delta)
Definition wbview.h:135
afx_msg void OnPickShrubbery()
Definition wbview.cpp:842
afx_msg void OnUpdatePickStructures(CCmdUI *pCmdUI)
Definition wbview.cpp:817
void rulerFeedbackInfo(Coord3D &point1, Coord3D &point2, Real dist)
Definition wbview.cpp:1085
afx_msg void OnLockVertical()
Definition wbview.cpp:741
void snapPoint(Coord3D *thePt)
Definition wbview.h:143
afx_msg void OnUpdatePickNatural(CCmdUI *pCmdUI)
Definition wbview.cpp:867
Real x
Definition BaseType.h:333
Real y
Definition BaseType.h:333
void zero(void)
Definition BaseType.h:357
TPickedStatus
Definition wbview.h:36
@ PICK_NONE
Definition wbview.h:37
@ PICK_ARROW
Definition wbview.h:39
@ PICK_CENTER
Definition wbview.h:38
RulerTypeEnum
Definition wbview.h:42
@ RULER_NONE
Definition wbview.h:43
@ RULER_CIRCLE
Definition wbview.h:45
@ RULER_LINE
Definition wbview.h:44