Skip to content

Commit 22c02df

Browse files
committed
Address review comments
1 parent b14305f commit 22c02df

2 files changed

Lines changed: 8 additions & 11 deletions

File tree

Core/GameEngine/Source/Common/Audio/GameAudio.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -282,15 +282,15 @@ void AudioManager::reset()
282282
//-------------------------------------------------------------------------------------------------
283283
void AudioManager::update()
284284
{
285-
Coord3D microphonePos;
286285
Coord3D cameraPivot = TheTacticalView->getPosition();
287286
Real angle = TheTacticalView->getAngle();
288287
Matrix3D rot = Matrix3D::Identity;
289288
rot.Rotate_Z( angle );
290289
Vector3 forward( 0, 1, 0 );
291290
rot.mulVector3( forward );
292291

293-
const Real desiredHeight = m_audioSettings->m_microphoneDesiredHeightAboveTerrain + cameraPivot.z;
292+
const Real desiredHeightRel = m_audioSettings->m_microphoneDesiredHeightAboveTerrain;
293+
const Real desiredHeightAbs = desiredHeightRel + cameraPivot.z;
294294
const Real maxPercentage = m_audioSettings->m_microphoneMaxPercentageBetweenGroundAndCamera;
295295

296296
Coord3D lookTo;
@@ -306,15 +306,15 @@ void AudioManager::update()
306306
groundToCameraVector.sub( &cameraPivot );
307307
Real bestScaleFactor;
308308

309-
if( cameraPos.z <= desiredHeight || groundToCameraVector.z <= 0.0f )
309+
if( cameraPos.z <= desiredHeightAbs || groundToCameraVector.z <= 0.0f )
310310
{
311311
//Use the percentage calculation!
312312
bestScaleFactor = maxPercentage;
313313
}
314314
else
315315
{
316316
//Calculate the stopping position of the groundToCameraVector when we force z to be m_microphoneDesiredHeightAboveTerrain
317-
Real zScale = desiredHeight / groundToCameraVector.z;
317+
Real zScale = desiredHeightRel / groundToCameraVector.z;
318318

319319
//Use the smallest of the two scale calculations
320320
bestScaleFactor = MIN( maxPercentage, zScale );
@@ -324,6 +324,7 @@ void AudioManager::update()
324324
groundToCameraVector.scale( bestScaleFactor );
325325

326326
//Set the microphone to be the ground position adjusted for terrain plus the vector we just calculated.
327+
Coord3D microphonePos;
327328
microphonePos.set( &cameraPivot );
328329
microphonePos.add( &groundToCameraVector );
329330

Core/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -505,7 +505,7 @@ void W3DView::updateCameraAreaConstraints()
505505
/*
506506
Note the following restrictions on camera constraints!
507507
508-
-- they assume that all maps are height 'm_groundLevel' at the edges.
508+
-- they assume that all maps are raised to the common ground level at the edges.
509509
(since you need to add some "buffer" around the edges of your map
510510
anyway, this shouldn't be an issue.)
511511
@@ -1865,9 +1865,7 @@ void W3DView::draw()
18651865
if( TheGlobalData->m_debugCamera )
18661866
{
18671867
UnsignedInt c = 0xaaffffff;
1868-
Coord3D worldPos;
1869-
worldPos.x = getPosition().x;
1870-
worldPos.y = getPosition().y;
1868+
Coord3D worldPos = getPosition();
18711869
worldPos.z = TheTerrainLogic->getGroundHeight(worldPos.x, worldPos.y);
18721870

18731871
Coord3D p1, p2;
@@ -3305,9 +3303,7 @@ void W3DView::moveAlongWaypointPath(Real milliseconds)
33053303
m_freezeTimeForCameraMovement = false;
33063304
View::setAngle(m_mcwpInfo.cameraAngle[m_mcwpInfo.numWaypoints]);
33073305

3308-
Coord3D pos;
3309-
pos.x = m_mcwpInfo.waypoints[m_mcwpInfo.numWaypoints].x;
3310-
pos.y = m_mcwpInfo.waypoints[m_mcwpInfo.numWaypoints].y;
3306+
Coord3D pos = m_mcwpInfo.waypoints[m_mcwpInfo.numWaypoints];
33113307
pos.z = m_mcwpInfo.groundHeight[m_mcwpInfo.numWaypoints];
33123308
setPosition(pos);
33133309
// Note - assuming that the scripter knows what he is doing, we adjust the constraints so that

0 commit comments

Comments
 (0)