Пример #1
0
Weapon::Weapon(int _resourceID, float _xPos, float _yPos, std::string _weapon, Object* _reloadVisual) :
	Object(_resourceID, _xPos, _yPos, false)
{
	mCounter      = .0f;
	parseWeapon(_weapon);
	mActive       = true; /* NOTE: do i need this? */
	mOwner	      = NULL;
	mReloadCount  = .0f;
	mReloadVisual = _reloadVisual;
	mReload		  = false;
	mLastClip	  = 0;
}
Пример #2
0
// initWeaponConfig
// load weapon info
void CGameConfig::initWeaponConfig()
{
	const char *lpFilename = "data/config/weaponConfig.xml";

	IrrlichtDevice	*device = getIView()->getDevice();
	io::IFileSystem *fs = device->getFileSystem();
	
	io::IXMLReader *xmlRead = fs->createXMLReader( lpFilename );

	if ( xmlRead == NULL )
	{
		xmlRead = fs->createXMLReader( getIView()->getPath(lpFilename) );
		if ( xmlRead == NULL )
			return;
	}

	while ( xmlRead->read() )
	{
		switch (xmlRead->getNodeType())
		{		
		case io::EXN_ELEMENT:
			{
				const wchar_t* nodeName = xmlRead->getNodeName();
				if ( std::wstring(nodeName) == L"weapon" )
					parseWeapon(xmlRead);
			}
		case io::EXN_ELEMENT_END:
			{
			}
			break;
		case io::EXN_TEXT:
			{
			}
			break;
		}
	}
	xmlRead->drop();
}