Prevent the camera from getting 'stuck' after moving it by right clicking on the map, and increase the height while moving to reduce the 'zoom out'
effect after arriving on the destination. git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@3372 4a71c877-e1ca-e34f-864e-861f7616d084master
parent
e5caf5d2ad
commit
3b332d4379
18
src/warcam.c
18
src/warcam.c
|
@ -291,11 +291,11 @@ static void setUpRadarTarget(SDWORD x, SDWORD y)
|
|||
if ((x < 0) || (y < 0) || (x > (SDWORD)((mapWidth - 1) * TILE_UNITS))
|
||||
|| (y > (SDWORD)((mapHeight - 1) * TILE_UNITS)))
|
||||
{
|
||||
radarTarget.pos.z = 128 * ELEVATION_SCALE;
|
||||
radarTarget.pos.z = 128 * ELEVATION_SCALE + CAMERA_PIVOT_HEIGHT;
|
||||
}
|
||||
else
|
||||
{
|
||||
radarTarget.pos.z = map_Height(x,y);
|
||||
radarTarget.pos.z = map_Height(x,y) + CAMERA_PIVOT_HEIGHT;
|
||||
}
|
||||
radarTarget.direction = calcDirection(player.p.x, player.p.z, x, y);
|
||||
radarTarget.pitch = 0;
|
||||
|
@ -1117,16 +1117,6 @@ static void updateCameraRotationPosition( UBYTE update )
|
|||
}
|
||||
}
|
||||
|
||||
static bool nearEnough(void)
|
||||
{
|
||||
const int xPos = player.p.x + world_coord(mapWidth) / 2;
|
||||
const int yPos = player.p.z + world_coord(mapHeight) / 2;
|
||||
|
||||
return (abs(xPos - trackingCamera.target->pos.x) <= 256
|
||||
&& abs(yPos - trackingCamera.target->pos.y) <= 256);
|
||||
}
|
||||
|
||||
|
||||
/* Returns how far away we are from our goal in a radar track */
|
||||
static UDWORD getPositionMagnitude( void )
|
||||
{
|
||||
|
@ -1297,9 +1287,9 @@ BOOL bFlying;
|
|||
*/
|
||||
if(getRotationMagnitude()<10000)
|
||||
{
|
||||
if(nearEnough() && getPositionMagnitude() < 60)
|
||||
if(getPositionMagnitude() < 60)
|
||||
{
|
||||
camToggleStatus();
|
||||
setWarCamActive(FALSE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue