⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 fireeffect.cpp

📁 国外网游源码....除工具源码缺少之外,其余程序都全...至于,什么游戏,因为国内还没有,所以找不到测试
💻 CPP
字号:
// FireEffect.cpp: implementation of the CFireEffect class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "FireEffect.h"

#include "AnimFrame.h"
#include "EffectModel.h"
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

CFireEffect::CFireEffect()
{
	m_pAnimFlash = NULL;
	m_pModelFlash = NULL;
	m_pSprFlash = NULL;
}

CFireEffect::~CFireEffect()
{
	SAFE_DELETE(m_pAnimFlash);
	SAFE_DELETE(m_pModelFlash);
	SAFE_DELETE(m_pSprFlash);
}

void CFireEffect::Create()
{
	m_pModelFlash = new CEffectModel;
	//m_pModelFlash->LoadFile(".\\data\\Game\\Effect\\AK74_Flash.MC1");
	m_pModelFlash->LoadFile(".\\data\\Game\\Effect\\AK74_Flash.MC1");
	m_pAnimFlash = new CAnimSequence;
//	m_pAnimFlash->AddFrame(".\\data\\Game\\Effect\\bullet1.jpg", 0.15f);
//	m_pAnimFlash->AddFrame(".\\data\\Game\\Effect\\bullet2.jpg", 0.15f);
//	m_pAnimFlash->AddFrame(".\\data\\Game\\Effect\\bullet3.jpg", 0.15f);
	
	m_pAnimFlash->AddFrame(".\\data\\Game\\Effect\\扁包醚04.TGA", 0.25f);
	m_pAnimFlash->AddFrame(".\\data\\Game\\Effect\\扁包醚04.TGA", 0.25f);
	m_pAnimFlash->AddFrame(".\\data\\Game\\Effect\\扁包醚04.TGA", 0.25f);
	
//	m_pAnimFlash->AddFrame(".\\data\\Game\\Effect\\扼捞敲阂采01.bmp", 0.25f);
//	m_pAnimFlash->AddFrame(".\\data\\Game\\Effect\\扼捞敲阂采02.bmp", 0.25f);
//	m_pAnimFlash->AddFrame(".\\data\\Game\\Effect\\扼捞敲阂采03.bmp", 0.25f);
//	m_pAnimFlash->SetLoop(4);
	m_pSprFlash = new CSpriteMesh;
	m_pSprFlash->SetAnim( m_pAnimFlash );
	m_pSprFlash->SetModel( m_pModelFlash );
	m_pSprFlash->SetSize(2.0f);
}

HRESULT CFireEffect::Invalidate()
{
	m_pModelFlash->ReleaseVertexIndex();
	return S_OK;
}

HRESULT CFireEffect::Restore()
{
	m_pModelFlash->CreateVertexIndexBuffer();
	return S_OK;
}

//void CFireEffect::SetEmitter( D3DVECTOR vPos, D3DXVECTOR3 vNomal, int nMaterial )
void CFireEffect::SetEmitter( CEffect * pEffect, D3DXVECTOR3 vPos, D3DXVECTOR3 vNomal, int nMaterial )
{
	// 傲 荤款靛绰 咯扁辑 持磊.. 弊霸 唱阑淀 窍促..
	if(g_pSound->IsPlaySound( 1 ))
	{
		g_pSound->StopSound(1);
	}
	g_pSound->PlaySound(1, FALSE);
}

void CFireEffect::Update( float fElapsedTime )
{
	//m_pSprBullet->SetSize(RandomNumber(1.0f, 3.0f));
//	RandomNumber(1.0f, 3.0f)
//	m_pSprBullet->();
//	if (m_pTimer->GetTime() > m_fTime )
//	{
//		m_pTimer->Stop();
//		m_pSprBullet->Timer().Stop();
//	}
}

void CFireEffect::Render( CMCGTimer * pTimer, D3DXMATRIX &matWorld )
{
//	g_pApp->GetD3dDevice()->SetRenderState( D3DRS_ALPHABLENDENABLE,  TRUE);
//	g_pApp->GetD3dDevice()->SetRenderState( D3DRS_SRCBLEND,  D3DBLEND_SRCALPHA );
//	g_pApp->GetD3dDevice()->SetRenderState( D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA );
//	g_pApp->GetD3dDevice()->SetRenderState( D3DRS_SRCBLEND,  D3DBLEND_ONE );
//	g_pApp->GetD3dDevice()->SetRenderState( D3DRS_DESTBLEND, D3DBLEND_ONE );

//	g_pApp->GetD3dDevice()->SetTextureStageState(0, D3DTSS_COLORARG1, D3DTA_TEXTURE);
//	g_pApp->GetD3dDevice()->SetTextureStageState(0, D3DTSS_COLOROP, D3DTOP_SELECTARG1);

//	g_pApp->GetD3dDevice()->SetTextureStageState(0, D3DTSS_ALPHAOP, D3DTOP_MODULATE );
//	g_pApp->GetD3dDevice()->SetTextureStageState(0, D3DTSS_ALPHAARG1, D3DTA_TFACTOR );
//	g_pApp->GetD3dDevice()->SetTextureStageState(0, D3DTSS_ALPHAARG2, D3DTA_TEXTURE );

//	g_pApp->GetD3dDevice()->SetTextureStageState(0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE);
//	g_pApp->GetD3dDevice()->SetTextureStageState(0, D3DTSS_ALPHAARG2, D3DTA_DIFFUSE);
//	g_pApp->GetD3dDevice()->SetTextureStageState(0, D3DTSS_ALPHAOP, D3DTOP_SELECTARG1);
//	
//	g_pApp->GetD3dDevice()->SetTextureStageState(0, D3DTSS_COLORARG1, D3DTA_TEXTURE);
//	g_pApp->GetD3dDevice()->SetTextureStageState(0, D3DTSS_COLOROP, D3DTOP_SELECTARG1);

	g_pApp->GetD3dDevice()->SetRenderState( D3DRS_ALPHATESTENABLE, TRUE );
	g_pApp->GetD3dDevice()->SetRenderState( D3DRS_ALPHAREF, 0x1 );		// 舅颇 抛胶飘 扁霖 侨伎..
	g_pApp->GetD3dDevice()->SetRenderState( D3DRS_ALPHAFUNC, D3DCMP_GREATER );

//	g_pApp->GetD3dDevice()->SetRenderState( D3DRS_ZENABLE, FALSE );
//	g_pApp->GetD3dDevice()->SetRenderState( D3DRS_ZWRITEENABLE, FALSE );
//	g_pApp->GetD3dDevice()->SetRenderState( D3DRS_CULLMODE, D3DCULL_NONE );

	g_pApp->GetD3dDevice()->SetRenderState(D3DRS_ZENABLE, D3DZB_TRUE);
	g_pApp->GetD3dDevice()->SetRenderState( D3DRS_ZWRITEENABLE, TRUE );
	g_pApp->GetD3dDevice()->SetRenderState( D3DRS_CULLMODE, D3DCULL_NONE );
	//g_pApp->GetD3dDevice()->SetRenderState(D3DRS_CULLMODE, D3DCULL_CW);

	m_pSprFlash->SetTimer( pTimer );
	m_pSprFlash->Render(matWorld);

	g_pApp->GetD3dDevice()->SetRenderState(D3DRS_CULLMODE, D3DCULL_CW);

//	g_pApp->GetD3dDevice()->SetRenderState(D3DRS_ZENABLE, D3DZB_TRUE);
//	g_pApp->GetD3dDevice()->SetRenderState( D3DRS_ZWRITEENABLE, TRUE );
//	g_pApp->GetD3dDevice()->SetRenderState(D3DRS_ALPHABLENDENABLE, FALSE);

	g_pApp->GetD3dDevice()->SetRenderState( D3DRS_ALPHATESTENABLE, FALSE );
	g_pApp->GetD3dDevice()->SetRenderState( D3DRS_ALPHABLENDENABLE, FALSE );
//	g_pApp->GetD3dDevice()->SetRenderState( D3DRS_ZENABLE, TRUE );		
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -