SetPlayerZoomByViewRange

Category: Player / View
Since engine version: 1.0 OC

Description

Adjusts the zoom or zoom limit of all viewports of a player.

Syntax

bool SetPlayerZoomByViewRange(int player, int range_x, int range_y, int flags);

Parameters

player:
Player whose zoom or zoom limits are to be adjusted. NO_OWNER for all players.
range_x:
Horizontal range that should be covered by the zoom. Zero to use range_y only. If both range_x and range_y are zero, a default range is assumed for range_x.
range_y:
Vertical range that should be covered by the zoom. Zero to use range_x only. If both range_x and range_y are nonzero, the number that yields the smaller zoom is used.
flags:
Flags controlling function behaviour:
Flag Description
PLRZOOM_Direct The zoom does not scroll slowly towards the new value, but is set directly.
PLRZOOM_NoIncrease The new zoom ranges are only to be set if they are smaller than the current values.
PLRZOOM_NoDecrease The new zoom ranges are only to be set if they are greater than the current values.
PLRZOOM_LimitMin Set the minimum limit for zooming. The player cannot zoom out further than this.
PLRZOOM_LimitMax Set the maximum limit for zooming. The player cannot zoom in further than this.
PLRZOOM_Set Set the current zoom. This flag is implied if neither PLRZOOM_LimitMin nor PLRZOOM_LimitMax is supplied but can be used if current zoom and limits should be set simultanuously.

Example

func InitializePlayer(int plr)
{
  SetPlayerZoomByViewRange(plr, 1000, 0, PLRZOOM_LimitMin);
  SetPlayerZoomByViewRange(plr, 1000, 0, PLRZOOM_LimitMax);
  SetPlayerViewLock(plr, true);
  return true;
}
Code for a scenario script: Players can see exactly 1000 pixels wide around their Clonk and cannot scroll further.
See also: GetPlayerZoomLimits, SetFoW, SetLightRange, SetPlayerViewLock, SetPlayerZoom, SetPlrView
Sven2, 2010-09