question about source code

omlette

Newbie
Joined
Jul 6, 2003
Messages
345
Reaction score
0
Since the full SDK is released, there's tons of source code that comes with it. My question is, just how much is this? Obviously not everything is there, or hacks and the like would be much easier to make, but there seems to be just about any kind of file I can imagine. Physics, ladder climbing routines, compile tool sources, etc. So, what is and what is not in this huge batch of source? Because seeing stuff like this

Code:
//-----------------------------------------------------------------------------
// Purpose: takes a screenshot of the save game
//-----------------------------------------------------------------------------
void CViewRender::WriteSaveGameScreenshot( const char *pFilename )
{
	materials->MatrixMode( MATERIAL_PROJECTION );
	materials->PushMatrix();
	
	materials->MatrixMode( MATERIAL_VIEW );
	materials->PushMatrix();

	g_bRenderingScreenshot = true;
	
	// Save off the viewport...
	int x, y, w, h;
	materials->GetViewport( x, y, w, h );

	ITexture *pSaveRenderTarget = materials->GetRenderTarget();
	materials->SetRenderTarget( NULL );
	
	// set the viewport to be low-res for the screenshot
	int vidWidth = SAVEGAME_SCREENSHOT_WIDTH, vidHeight = SAVEGAME_SCREENSHOT_HEIGHT;
	materials->Viewport( 0, 0, vidWidth, vidHeight );

	// render out to the backbuffer
	CViewSetup viewSetup = m_View;
	viewSetup.x = 0;
	viewSetup.y = 0;
	viewSetup.width = vidWidth;
	viewSetup.height = vidHeight;
	viewSetup.fov = ScaleFOVByWidthRatio( m_View.fov, ( (float)vidWidth / (float)vidHeight ) / ( 4.0f / 3.0f ) );
	viewSetup.m_bRenderToSubrectOfLargerScreen = true;

	// draw out the scene
	ViewDrawScene( true, viewSetup, VIEW_MAIN );

	{
		// get the data from the backbuffer and save to disk
		// bitmap bits
		unsigned char *pImage = ( unsigned char * )malloc( vidWidth * 3 * vidHeight );

		// Get Bits from the material system
		materials->ReadPixels( 0, 0, vidWidth, vidHeight, pImage, IMAGE_FORMAT_RGB888 );

		if( !TGAWriter::Write( pImage, pFilename, vidWidth, vidHeight, IMAGE_FORMAT_RGB888,
			IMAGE_FORMAT_RGB888 ) )
		{
			Error( "Couldn't write bitmap data snapshot.\n" );
		}
		
		free( pImage );
	}

	// restore our previous state
	materials->SetRenderTarget( pSaveRenderTarget );
	materials->Viewport( x, y, w, h );
	
	materials->MatrixMode( MATERIAL_PROJECTION );
	materials->PopMatrix();
	
	materials->MatrixMode( MATERIAL_VIEW );
	materials->PopMatrix();

	g_bRenderingScreenshot = false;
}

... Just makes HL2 seem so, well, open source.

Sorry if the answer is obvious, but I can't think of much that isn't included.
 
Back
Top