www.pudn.com > GameEngine_src.rar > CNpc.cpp


// CNpc.cpp: implementation of the CNpc class. 
// 
////////////////////////////////////////////////////////////////////// 
 
#include "CNpc.h" 
#include "CMap.h" 
#include "CSpriteFactory.h" 
 
extern CMap	theMap;	 
extern CSpriteFactory	theSpriteFactory; 
 
////////////////////////////////////////////////////////////////////// 
// 
////////////////////////////////////////////////////////////////////// 
CNpc::CNpc() 
{ 
} 
 
CNpc::~CNpc() 
{ 
 
} 
 
 
////////////////////////////////////////////////////////////////////// 
// 
////////////////////////////////////////////////////////////////////// 
void CNpc::OnClick() 
{ 
	m_CmdPool.SetObj( this ); 
	m_CmdPool.RunCmdAll(); 
} 
 
////////////////////////////////////////////////////////////////////// 
// 
////////////////////////////////////////////////////////////////////// 
bool CNpc::UpdateSprite() 
{ 
	m_cur_pg->UpdateStaticSprite( m_Frame, m_LastTick, m_BasePoint, m_RenderPoint, m_Rect ); 
	return true; 
} 
 
////////////////////////////////////////////////////////////////////// 
// 
////////////////////////////////////////////////////////////////////// 
void CNpc::DrawSprite() 
{ 
#ifdef ALPHA_SHADOW 
	if ( m_cur_shadow_pg != NULL ) 
		m_cur_shadow_pg->DrawShadow( m_Frame, m_BasePoint ); 
#endif 
 
	if ( m_bSelected ) 
	{ 
		m_cur_pg->DrawContour( m_Frame, m_RenderPoint.x, m_RenderPoint.y ); 
 
		POINT render; 
		render.x = m_BasePoint.x; 
		render.y = m_BasePoint.y - m_pClass->MaxHeight; 
		theMap.MapToClient( render ); 
 
		theSpriteFactory.DrawBloodBar( render.x, render.y, m_Life, m_pClass->SpriteInfo.m_MaxLife, m_pClass->NameSurface ); 
		m_bSelected = false; 
	} 
	else 
		m_cur_pg->DrawFrame( m_Frame, m_RenderPoint.x, m_RenderPoint.y ); 
}