Esempio n. 1
0
 void khLuaScript::playSound()
 {
   // play sound
   bool bSound(false);
   bSound = L->getBool("SoundPlay",bSound);
   if(bSound)
   {
     string SName("");
     SName = L->getString("SoundName",SName);
     float SSpd(1.0f);
     SSpd = L->getFloat("SoundSpd",SSpd);
     float SVol(1.0f);
     SVol = L->getFloat("SoundVol",SVol);
     SOUNDENGINE.playSound(SName,SSpd,SVol);
   }
 }
Esempio n. 2
0
dword GManager::TextureRelease( SFullName FileName_ )
{
    SString str = (const char*)*FileName_.Name;
    str = str.LowerCase();
    FileName_.Name = SName( (const char*)str );

    dword dwIndex = FindTextureFileName( FileName_ );
    if( dwIndex>0 )
    {
        return m_Texture.ReleaseObjectByIdx( dwIndex );
    }
    else
    {
        return 0;
    }

}
Esempio n. 3
0
DTexture* GManager::TextureAcquire( SFullName Filename, bool bAddRef, bool bMipGenerate )
{
    if( Filename.Name==NONE ) {
        return NULL;
    }
    SString str = (const char*)*Filename.Name;
    str = str.LowerCase();
    Filename.Name = SName( (const char*)str );

    DTexture *pTexture;
    dword dwIndex=0;
    if( (dwIndex=FindTextureFileName( Filename ))==0 )
    {   // neo creation
        DFile *pFile = DStdFileCreate();
        if( !pFile->Open( Filename ))
        {
            DLogWriteSystem( "XBaseResourceAcquire::TEXTURE can't found [%s] file", (lpctstr)(*Filename) );

            pFile->Close();
            DStdFileRelease( pFile );

            return NULL;
        }
        pTexture = CreateTexture( &dwIndex );
        m_Texture.SetObjectName( dwIndex, Filename );
        if( !pTexture->Load( pFile, bMipGenerate ) )
        {
            DLogWriteSystem( "XBaseResourceAcquire::TEXTURE can't load [%s] file", (lpctstr)(*Filename) );

            pFile->Close();
            DStdFileRelease( pFile );

            return NULL;
        }
        pFile->Close();
        DStdFileRelease( pFile );
    }
    else
    {   // just get pointer and return
        pTexture = GetTexture( dwIndex );
        if( bAddRef ) AddTextureRef( dwIndex );
    }

    return pTexture;
}
Esempio n. 4
0
static void SingleCommand (enum singleCommand command, int scheduled)
{
  if (!scheduled)
    bprintf(info, "Commands: Single command: %d (%s)\n", command,
        SName(command));

  /* Update CommandData structure with new info */

  switch (command) {
    case az_el_disable:
      CommandData.az_el.new_cmd = 1;
      CommandData.az_el.mode = AzElDisable;
      break;
    case xyzzy:
      break;
    default:
      bputs(warning, "Commands: ***Invalid Single Word Command***\n");
      return; /* invalid command - no write or update */
  }

  WritePrevStatus();
}
Esempio n. 5
0
HGRPOBJ DGraphicStore::AcquireSMD( SString strFilename, int Preset )
{
	strFilename = strFilename.LowerCase();

	HGRPOBJ Handle;
	HGRPOBJ Null; 

	bool bCloneWhenItFound;
	DPOOLMODE Mode;
	bool bEasyToUpdate;
	switch( Preset )
	{
		case SkinningMesh:
			Mode = DPOOL_DEFAULT;
			bEasyToUpdate = true;
			bCloneWhenItFound = true;
			break;
		case StaticMesh:
		default:
			Mode = DPOOL_DEFAULT;
			bEasyToUpdate = false;
			bCloneWhenItFound = false;
			break;
	}

	// Finding
	MeshIterator iMeshAdd = m_Case.find( SFullName("offline", DCutPath(strFilename)) );
	if( !iMeshAdd.valid() )
	{// not found, create new one
		iMeshAdd = m_Case.addEmpty();

		Handle.pObject = iMeshAdd.ptr();
		Handle.ID = iMeshAdd.index();
		m_Case.setName( iMeshAdd.index(), SFullName("offline", DCutPath(strFilename)) );
		if( !Handle.IsValid() )
		{
			DLogWriteSystem( "DGraphicStore(%s) has fatal error on creation.", (lpctstr)strFilename );
			return Handle;
		}
	}
	else
	{// already exist
		Handle.pObject = iMeshAdd.ptr();
		Handle.ID = iMeshAdd.index();

		if( bCloneWhenItFound )
		{
			return CloneSMD( Handle );
		}
		else
		{// increase reference count
			m_Case.addEmpty( iMeshAdd.index() ); // this func. just add ref if object already exists in the index.
			return Handle;
		}
	}

	if( Handle.pObject==NULL ) { return Null; }
#ifdef _DEBUG
	Handle.pObject->m_strDebugRscName = strFilename;// 디버그를 위한 객체이름
#endif
	Handle.pObject->Name = SName((const char*)strFilename);

	// Load from file
	DFile File;
	if( !File.Open( (const char*)strFilename ) )
	{// cannot open a file!
		DLogWriteSystem( "DGraphicStore::AcquireSMD(%s) couldn't open file!", (const char*)strFilename );
		m_Case.remove( Handle.ID );
		return Null;
	}

	DProgressiveMesh *pMesh = Handle.pObject;
	////////////////////////////////////////////
	// Convert
	// Old SMD -> Latest SMD
	//
	// : Test File Type to convert
	////////////////////////////////////////////
	char aTestBuffer[4];
	File.Read( aTestBuffer, 4*sizeof(char) );
	if( appStrncmp( aTestBuffer, "SSKF", 4 )!=0 )
	{
		File.SeekToBegin();
		// Read mesh
		GMeshGrp meshOther;
		if( !meshOther.Load( &File, false ) )
		{ 
			File.Close();
			return Null;
		}

		// Cut Texture Name's Path string
		GMaterial *pMaterial = meshOther.GetMaterial();
		DWORD nNumMaterials = meshOther.GetNumMaterials();
		for( DWORD i=0; i<nNumMaterials; i++ )
		{
			SString strTemp = pMaterial[i].GetTexture();
			pMaterial[i].SetTexture( DCutPath(strTemp) );
		}

		// Convert it!
		pMesh->ImportOtherMesh( meshOther );
	}
	// End of Converting
	else
	{
		File.SeekToBegin();
		DArchive *Ar = CreateFileReader( File.GetFile() );
		
		pMesh->Serialize( *Ar );
		// release buffer
		SAFE_DELETE( Ar );
	}
	// End of Loading
	

	pMesh->BuildVertexBuffer();

	pMesh->Textures.Empty();
	For( int i = 0; i < pMesh->Materials.Num(); ++i )
	{		
		SString strTexName;
		strTexName = DGetParentDir(strFilename,2);
		strTexName += "png\\";
		strTexName += (const char*)*pMesh->Materials[i].DiffuseTex;
		DTexture *pTex = DGlobalMng()->TextureAcquire( strTexName, true, true );
		if( pTex==NULL )
		{
			strTexName = DGetPathOnly(strFilename);
			strTexName += (const char*)*pMesh->Materials[i].DiffuseTex;
			pTex = DGlobalMng()->TextureAcquire( strTexName, true, true );
		}
		pMesh->Textures.AddItem( pTex );
	}
	
	
	File.Close();

	return Handle;
}
Esempio n. 6
0
void CPictureFrame::Render()
{		
	TakeFrame();
	
	Scud::DXDevice* pDevice = Scud::g_pDevice;
	
	D3DVIEWPORT9 viewFrame;
	pDevice->GetViewport(&viewFrame);	

	if(m_pParent)
	{
		D3DXMATRIX matView, matProj;
		if(m_dwType==FRAME_HEAD)
		{
			SVector vctPos = m_pParent->GetBonePos(SName("Bip01 Head"));
			float ftYaw = m_pParent->GetLocation()->Rotation.Yaw/(float)65536*2*PI;
			D3DXMATRIX matRotation;
			D3DXMatrixRotationY(&matRotation, ftYaw);
			D3DXVECTOR4 vctDir(0.0f, 0.0f, -1.0f, 0.0f);

			D3DXVec4Transform(&vctDir, &vctDir, &matRotation);
			vctDir = vctDir*0.7f;
			
			vctPos = vctPos + SVector(0.0f, 0.1f, 0.0f);
			D3DXMatrixLookAtLH(&matView, 
				&D3DXVECTOR3(vctPos.X+vctDir.x,vctPos.Y+vctDir.y,vctPos.Z+vctDir.z),
				&D3DXVECTOR3(vctPos.X,vctPos.Y,vctPos.Z), &D3DXVECTOR3(0.0f,1.0f,0.0f));
		//	float fProjX = 1.0f / 9.0f * viewFrame.Width / m_nWidth;
		//	float fProjY = 1.0f / 9.0f * 0.75f * (float)m_nHeight / (float)m_nWidth * viewFrame.Height / m_nHeight;
			
			float fProjX = 1.0f / 9.0f * viewFrame.Width / m_nWidth;
			float fProjY = 1.0f / 9.0f * (float)m_nHeight / (float)m_nWidth * viewFrame.Height / m_nHeight;

		//	D3DXMatrixPerspectiveLH(&matProj, fProjX, fProjY, 1.0f, 10.0f);
			D3DXMatrixPerspectiveFovLH(&matProj, PI/6.0f, (float)viewFrame.Width/viewFrame.Height, 0.1f, 1.0f);
			
			Scud::DXDevice* pDevice = Scud::g_pDevice;
			pDevice->SetTransform(D3DTS_VIEW, &matView);
			pDevice->SetTransform(D3DTS_PROJECTION, &matProj);
			
			m_pParent->DrawMeshCartoon(GetAlpha());
			m_pParent->DrawMeshSilhouette(GetAlpha());
		}
		else if(m_dwType==FRAME_BODY)
		{
			SVector vctPos = m_pParent->GetLocation()->Location;//m_pParent->GetBonePos(SName("Bip01"));
			float ftYaw = m_pParent->GetLocation()->Rotation.Yaw/(float)65536*2*PI;
			D3DXMATRIX matRotation;
			D3DXMatrixRotationY(&matRotation, ftYaw - 0.5f);
			D3DXVECTOR4 vctDir(0.0f, 0.0f, -1.0f, 1.0f);
			D3DXVec4Transform(&vctDir, &vctDir, &matRotation);
			vctDir = vctDir*4.5f;
			
			D3DXMatrixLookAtLH(&matView, 
				&D3DXVECTOR3(vctPos.X+vctDir.x,vctPos.Y+vctDir.y+2.0f,vctPos.Z+vctDir.z),
				&D3DXVECTOR3(vctPos.X,vctPos.Y + 1.0f,vctPos.Z), &D3DXVECTOR3(0.0f,1.0f,0.0f));

			D3DXMatrixPerspectiveFovLH(&matProj, PI/6.0f, (float)viewFrame.Width/viewFrame.Height, 1.0f, 20.0f);
			
			Scud::DXDevice* pDevice = Scud::g_pDevice;
			pDevice->SetTransform(D3DTS_VIEW, &matView);
			pDevice->SetTransform(D3DTS_PROJECTION, &matProj);
			
			m_pParent->DrawMeshCartoon(GetAlpha());
			m_pParent->DrawMeshSilhouette(GetAlpha());
		}
		else if(m_dwType==FRAME_BODY2)
		{
			SVector vctPos = m_pParent->GetLocation()->Location;//m_pParent->GetBonePos(SName("Bip01"));
			float ftYaw = m_pParent->GetLocation()->Rotation.Yaw/(float)65536*2*PI;
			D3DXMATRIX matRotation;
			D3DXMatrixRotationY(&matRotation, ftYaw);
			D3DXVECTOR4 vctDir(0.0f, 0.0f, -1.0f, 1.0f);
			D3DXVec4Transform(&vctDir, &vctDir, &matRotation);
			vctDir = vctDir*4.5f;
			// 2006.3.13 doo 이곳
			if( m_bFar )
			{
				D3DXMatrixLookAtLH(&matView, 
					&D3DXVECTOR3(vctPos.X+vctDir.x,vctPos.Y+vctDir.y+2.0f,vctPos.Z+vctDir.z-1),
				&D3DXVECTOR3(vctPos.X,vctPos.Y + 1.0f,vctPos.Z), &D3DXVECTOR3(0.0f,1.0f,0.0f));
			}
			else
			{
				D3DXMatrixLookAtLH(&matView, 
					&D3DXVECTOR3(vctPos.X+vctDir.x,vctPos.Y+vctDir.y+2.0f,vctPos.Z+vctDir.z),
				&D3DXVECTOR3(vctPos.X,vctPos.Y + 1.0f,vctPos.Z), &D3DXVECTOR3(0.0f,1.0f,0.0f));
			}
			
			D3DXMatrixPerspectiveFovLH(&matProj, PI/6.0f, (float)viewFrame.Width/viewFrame.Height, 1.0f, 20.0f);
			
			Scud::DXDevice* pDevice = Scud::g_pDevice;
			pDevice->SetTransform(D3DTS_VIEW, &matView);
			pDevice->SetTransform(D3DTS_PROJECTION, &matProj);
			
			m_pParent->DrawMeshCartoon(GetAlpha());
			m_pParent->DrawMeshSilhouette(GetAlpha());
		}
		else if(m_dwType==FRAME_SKILL)
		{
			Scud::DXDevice* pDevice = Scud::g_pDevice;			
			D3DXMatrixPerspectiveFovLH(&matProj, PI/3.0f, (float)viewFrame.Width/viewFrame.Height, 0.1f, 30.0f);
			pDevice->SetTransform(D3DTS_PROJECTION, &matProj);
			
			m_pParent->DrawMeshCartoon(GetAlpha());
			m_pParent->DrawMeshSilhouette(GetAlpha());
			if(m_pBall)
			{
				m_pBall->DrawMeshCartoon();
			//	m_pBall->DrawMeshSilhouette(GetAlpha()/4.0f);
			}
			if(m_pRim)
			{
				m_pRim->DrawMeshLight();
			//	m_pRim->DrawMeshCartoon();
			//	m_pRim->DrawMeshSilhouette(GetAlpha()/4.0f);
			}
		}
	}

	ReleaseFrame();
}
Esempio n. 7
0
const char* CommandName(int is_multi, int command)
{
  return (is_multi) ? MName(command) : SName(command);
}
Esempio n. 8
0
void CLogicBall::Initial( CGSystem* pGSystem, CLogicLayer_Game* pLogicLayer_Game )
{
	m_pGSystem         = pGSystem;
	m_pLogicLayer_Game = pLogicLayer_Game;
	m_nameCustomName = SName("Ball");
}