HL SDK 2.1

View Setup System

The new Half-Life engine SDK extends the client.dll by allowing mod authors to set up the view origin and orientation for rendering.  Although the SDK code is focused on setting the view up for a first-person shooter, there is support in the SDK for third person camera setup and it is entirely possible to completely custom code the camera to create, for example, an isometric view RPG if such a game is desired.

The code for setting up the view origin is in the client.dll source view.cpp file.  In particular, before rendering each frame, the engine calls into the V_CalcRefDef() function.  This function normally invokes V_CalcNormalRefdef() which is the heart of the view setup.  That function sets up both the current view position, and also sets up the view model ( weapon ).

Among others, the following parameters can be altered:

	View origin offset ( scr_ofsx, scr_ofsy, scr_ofsz )
	Pitch drifting
	Head bobbing
	Screen shaking
	Compensation for viewing along the surface of water
	View roll
	View idle movement
	Punch angle falloff
	Third person camera overrides
	Setting up the player's weapon model
	Smoothing/interpolating the view origin and angles when riding trains/plats
	Support for "viewentity" ( i.e., seeing through the eyes of a specified entity )
	Hiding the view model  ( view->model = NULL )


	
