Skip to content

Commit 0dd8f83

Browse files
committed
- Stability fixes
- More merge fixes
1 parent 880377f commit 0dd8f83

9 files changed

Lines changed: 665 additions & 477 deletions

File tree

Core/GameEngine/Include/Common/GameDefines.h

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -41,18 +41,6 @@
4141
#endif
4242
#endif
4343

44-
// This is here to easily toggle between the retail compatible with fixed pathfinding fallback and pure fixed pathfinding mode
45-
#if RETAIL_COMPATIBLE_CRC
46-
47-
#if defined(GENERALS_ONLINE)
48-
#define RETAIL_COMPATIBLE_PATHFINDING (0)
49-
#else
50-
#define RETAIL_COMPATIBLE_PATHFINDING (1)
51-
#endif
52-
#else
53-
#define RETAIL_COMPATIBLE_PATHFINDING (0)
54-
#endif
55-
5644
// This is here to easily toggle between the retail compatible pathfinding memory allocation and the new static allocated data mode
5745
#ifndef RETAIL_COMPATIBLE_PATHFINDING_ALLOCATION
5846
#if defined(GENERALS_ONLINE)

Core/GameEngine/Include/GameClient/View.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,8 @@ class View : public Snapshot
131131
virtual void forceRedraw() = 0;
132132

133133
virtual void lookAt(const Coord3D* o); ///< Center the view on the given coordinate
134-
virtual void initHeightForMap() {}; ///< Init the camera height for the map at the current position.
134+
virtual void initHeightForMap() {}; ///< Init the camera height for the map at the current position.
135+
virtual void resetPivotToGround() {}; ///< Set the camera pivot to the terrain height at the current position.
135136
virtual void scrollBy(const Coord2D* delta); ///< Shift the view by the given delta
136137

137138
virtual void moveCameraTo(const Coord3D* o, Int frames, Int shutter, Bool orient, Real easeIn = 0.0f, Real easeOut = 0.0f) { lookAt(o); }
@@ -208,6 +209,7 @@ class View : public Snapshot
208209
Bool userSetZoomToDefault() { return doUserAction(&View::setZoomToDefault); }
209210
Bool userSetFieldOfView(Real angle) { return doUserAction(&View::setFieldOfView, angle); }
210211
Bool userLookAt(const Coord3D* o) { return doUserAction(&View::lookAt, o); }
212+
Bool userResetPivotToGround() { return doUserAction(&View::resetPivotToGround); }
211213
Bool userScrollBy(const Coord2D* delta) { return doUserAction(&View::scrollBy, delta); }
212214
Bool userSetLocation(const ViewLocation* location) { return doUserAction(&View::setLocation, location); }
213215
Bool userSetCameraLock(ObjectID id) { return doUserAction(&View::setCameraLock, id); }
@@ -375,7 +377,7 @@ class ViewLocation
375377
m_pos.z = z;
376378
m_angle = angle;
377379
m_pitch = pitch;
378-
m_zoom = zoom;
380+
m_zoom = std::clamp(zoom, 0.f, 1.f);
379381
m_valid = true;
380382
}
381383
};

Core/GameEngine/Source/GameClient/View.cpp

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
UnsignedInt View::m_idNext = 1;
3838

3939
// the tactical view singleton
40-
View *TheTacticalView = nullptr;
40+
View* TheTacticalView = nullptr;
4141

4242

4343
View::View()
@@ -118,7 +118,7 @@ void View::reset()
118118
/**
119119
* Prepend this view to the given list, return the new list.
120120
*/
121-
View *View::prependViewToList( View *list )
121+
View* View::prependViewToList(View* list)
122122
{
123123
m_next = list;
124124
return this;
@@ -132,7 +132,7 @@ void View::zoom(Real height)
132132
/**
133133
* Center the view on the given coordinate.
134134
*/
135-
void View::lookAt( const Coord3D *o )
135+
void View::lookAt(const Coord3D* o)
136136
{
137137

138138
/// @todo this needs to be changed to be 3D, this is still old 2D stuff
@@ -145,7 +145,7 @@ void View::lookAt( const Coord3D *o )
145145
/**
146146
* Shift the view by the given delta.
147147
*/
148-
void View::scrollBy( const Coord2D *delta )
148+
void View::scrollBy(const Coord2D* delta)
149149
{
150150
// update view's world position
151151
m_pos.x += delta->x;
@@ -155,17 +155,17 @@ void View::scrollBy( const Coord2D *delta )
155155
/**
156156
* Rotate the view around the vertical axis to the given angle.
157157
*/
158-
void View::setAngle( Real radians )
158+
void View::setAngle(Real radians)
159159
{
160160
m_angle = WWMath::Normalize_Angle(radians);
161161
}
162162

163163
/**
164164
* Rotate the view around the horizontal (X) axis to the given angle.
165165
*/
166-
void View::setPitch( Real radians )
166+
void View::setPitch(Real radians)
167167
{
168-
constexpr Real limit = PI/5.0f;
168+
constexpr Real limit = PI / 5.0f;
169169
m_pitch = clamp(-limit, radians, limit);
170170
}
171171

@@ -188,7 +188,7 @@ void View::setPitchToDefault()
188188
void View::setHeightAboveGround(Real z)
189189
{
190190
// if our zoom is limited, we will stay within a predefined distance from the terrain
191-
if( m_zoomLimited )
191+
if (m_zoomLimited)
192192
{
193193
m_heightAboveGround = clamp(m_minHeightAboveGround, z, m_maxHeightAboveGround);
194194
}
@@ -201,21 +201,21 @@ void View::setHeightAboveGround(Real z)
201201
/**
202202
* write the view's current location in to the view location object
203203
*/
204-
void View::getLocation( ViewLocation *location )
204+
void View::getLocation(ViewLocation* location)
205205
{
206206

207-
const Coord3D *pos = getPosition();
208-
location->init( pos->x, pos->y, pos->z, getAngle(), getPitch(), getZoom() );
207+
const Coord3D* pos = getPosition();
208+
location->init(pos->x, pos->y, pos->z, getAngle(), getPitch(), getZoom());
209209

210210
}
211211

212212

213213
/**
214214
* set the view's current location from to the view location object
215215
*/
216-
void View::setLocation( const ViewLocation *location )
216+
void View::setLocation(const ViewLocation* location)
217217
{
218-
if ( location->m_valid )
218+
if (location->m_valid)
219219
{
220220
setPosition(&location->m_pos);
221221
setAngle(location->m_angle);
@@ -234,13 +234,13 @@ Bool View::isUserControlLocked() const
234234
//-------------------------------------------------------------------------------------------------
235235
/** project the 4 corners of this view into the world and return each point as a parameter,
236236
the world points are at the requested Z */
237-
//-------------------------------------------------------------------------------------------------
238-
void View::getScreenCornerWorldPointsAtZ( Coord3D *topLeft, Coord3D *topRight,
239-
Coord3D *bottomRight, Coord3D *bottomLeft,
240-
Real z )
237+
//-------------------------------------------------------------------------------------------------
238+
void View::getScreenCornerWorldPointsAtZ(Coord3D* topLeft, Coord3D* topRight,
239+
Coord3D* bottomRight, Coord3D* bottomLeft,
240+
Real z)
241241
{
242242
// sanity
243-
if( topLeft == nullptr || topRight == nullptr || bottomRight == nullptr || bottomLeft == nullptr)
243+
if (topLeft == nullptr || topRight == nullptr || bottomRight == nullptr || bottomLeft == nullptr)
244244
return;
245245

246246
ICoord2D screenTopLeft;
@@ -252,7 +252,7 @@ void View::getScreenCornerWorldPointsAtZ( Coord3D *topLeft, Coord3D *topRight,
252252
const Int viewHeight = getHeight();
253253

254254
// setup the screen coords for the 4 corners of the viewable display
255-
getOrigin( &origin.x, &origin.y );
255+
getOrigin(&origin.x, &origin.y);
256256

257257
screenTopLeft.x = origin.x;
258258
screenTopLeft.y = origin.y;
@@ -264,34 +264,34 @@ void View::getScreenCornerWorldPointsAtZ( Coord3D *topLeft, Coord3D *topRight,
264264
screenBottomLeft.y = origin.y + viewHeight;
265265

266266
// project
267-
screenToWorldAtZ( &screenTopLeft, topLeft, z );
268-
screenToWorldAtZ( &screenTopRight, topRight, z );
269-
screenToWorldAtZ( &screenBottomRight, bottomRight, z );
270-
screenToWorldAtZ( &screenBottomLeft, bottomLeft, z );
267+
screenToWorldAtZ(&screenTopLeft, topLeft, z);
268+
screenToWorldAtZ(&screenTopRight, topRight, z);
269+
screenToWorldAtZ(&screenBottomRight, bottomRight, z);
270+
screenToWorldAtZ(&screenBottomLeft, bottomLeft, z);
271271
}
272272

273273
// ------------------------------------------------------------------------------------------------
274274
/** Xfer method for a view */
275275
// ------------------------------------------------------------------------------------------------
276-
void View::xfer( Xfer *xfer )
276+
void View::xfer(Xfer* xfer)
277277
{
278278

279279
// version
280280
XferVersion currentVersion = 1;
281281
XferVersion version = currentVersion;
282-
xfer->xferVersion( &version, currentVersion );
282+
xfer->xferVersion(&version, currentVersion);
283283

284284
// camera angle
285285
Real angle = getAngle();
286-
xfer->xferReal( &angle );
287-
setAngle( angle );
286+
xfer->xferReal(&angle);
287+
setAngle(angle);
288288

289289
// view position
290290
Coord3D viewPos;
291-
getPosition( &viewPos );
292-
xfer->xferReal( &viewPos.x );
293-
xfer->xferReal( &viewPos.y );
294-
xfer->xferReal( &viewPos.z );
295-
lookAt( &viewPos );
291+
getPosition(&viewPos);
292+
xfer->xferReal(&viewPos.x);
293+
xfer->xferReal(&viewPos.y);
294+
xfer->xferReal(&viewPos.z);
295+
lookAt(&viewPos);
296296

297297
}

0 commit comments

Comments
 (0)