-
Notifications
You must be signed in to change notification settings - Fork 78
[CMAKE][GEN][ZH] Make all builds compatible with retail #985
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -195,10 +195,10 @@ void Thing::setPosition( const Coord3D *pos ) | |
} | ||
|
||
//============================================================================= | ||
void Thing::setOrientation( Real angle ) | ||
// | ||
// TheSuperHackers @bugfix Aliendroid1 05/May/2025 Fix mismatching due to floating point innacuracies | ||
void Thing::setOrientation(Real angle) | ||
{ | ||
//USE_PERF_TIMER(ThingMatrixStuff) | ||
Coord3D u, x, y, z, pos; | ||
|
||
// setOrientation always forces us straight up in the Z axis, | ||
// or aligned with the terrain if we have the magic flag set. | ||
|
@@ -208,40 +208,26 @@ void Thing::setOrientation( Real angle ) | |
Coord3D oldPos = m_cachedPos; | ||
Matrix3D oldMtx = m_transform; | ||
|
||
pos.x = m_transform.Get_X_Translation(); | ||
pos.y = m_transform.Get_Y_Translation(); | ||
pos.z = m_transform.Get_Z_Translation(); | ||
if( m_template->isKindOf( KINDOF_STICK_TO_TERRAIN_SLOPE) ) | ||
m_cachedAngle = normalizeAngle(angle); | ||
Coord3D pos = { m_transform[0][3], m_transform[1][3] ,m_transform[2][3] }; | ||
m_cachedPos = pos; | ||
|
||
if (m_template->isKindOf(KINDOF_STICK_TO_TERRAIN_SLOPE)) | ||
{ | ||
Matrix3D mtx; | ||
const Bool stickToGround = true; // yes, set the "z" pos | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. removing bool is just change for change sake, that said matrix removal is useful as it avoids unnecessary codegen |
||
TheTerrainLogic->alignOnTerrain(angle, pos, stickToGround, m_transform ); | ||
TheTerrainLogic->alignOnTerrain(angle, m_cachedPos, true, m_transform); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. if down the alignOnTerrain call chain it uses m_cachedPos or m_cachedAngle it will cause a mismatch since you moved the assignment There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The values are not mutated. Also the section under the if block is never actually run because the functionality was never implemented. |
||
} | ||
else | ||
{ | ||
z.x = 0.0f; | ||
z.y = 0.0f; | ||
z.z = 1.0f; | ||
|
||
u.x = Cos(angle); | ||
u.y = Sin(angle); | ||
u.z = 0.0f; | ||
|
||
y.crossProduct( &z, &u, &y ); | ||
x.crossProduct( &y, &z, &x ); | ||
|
||
m_transform.Set( x.x, y.x, z.x, pos.x, | ||
x.y, y.y, z.y, pos.y, | ||
x.z, y.z, z.z, pos.z ); | ||
Real a = Sin(angle); | ||
Real b = Cos(angle); | ||
m_transform[0][0] = b; m_transform[0][1] = -a; m_transform[0][2] = 0; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why? |
||
m_transform[1][0] = a; m_transform[1][1] = b; m_transform[1][2] = 0; | ||
m_transform[2][0] = 0; m_transform[2][1] = 0; m_transform[2][2] = 1; | ||
} | ||
|
||
//DEBUG_ASSERTCRASH(-PI <= angle && angle <= PI, ("Please pass only normalized (-PI..PI) angles to setOrientation (%f).\n", angle)); | ||
m_cachedAngle = normalizeAngle(angle); | ||
m_cachedPos = pos; | ||
m_cacheFlags &= ~VALID_DIRVECTOR; // but don't clear the altitude flags. | ||
|
||
reactToTransformChange(&oldMtx, &oldPos, oldAngle); | ||
DEBUG_ASSERTCRASH(!(_isnan(getPosition()->x) || _isnan(getPosition()->y) || _isnan(getPosition()->z)), ("Drawable/Object position NAN! '%s'\n", m_template->getName().str() )); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why remove this |
||
} | ||
|
||
//============================================================================= | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Vector3 vec = Get_Translation(); could had been used