home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 2006 July & August
/
PCWorld_2006-07-08_cd.bin
/
temacd
/
planearcade
/
planearcade.exe
/
Tank3.bmp
/
explo.cpp
< prev
next >
Wrap
C/C++ Source or Header
|
2004-11-10
|
12KB
|
451 lines
#include "main.h"
//------------------------
//Global
//------------------------
EXPLO Explo;
//inicializacia vybuchov
//----------------------------------------------------------
void EXPLO::Initialize()
{
//ak niesu zapnute particle effekty nerenderuj
if (ParticleEffects == 0)
return;
////////////
//PARTICLE//
////////////
//P_Smoke
//---------
P_Smoke.Initialize(1000,1);
P_Smoke.AddFrame(0,"particles/smoke.bmp",GetColor(1.0f,0.0f,0.0f,0.0f));
//P_SmokeBomb
//-----------
P_SmokeBomb.Initialize(500,1);
P_SmokeBomb.AddFrame(0,"particles/bomb.bmp",GetColor(1.0f,0.0f,0.0f,0.0f));
//P_Explosion
//-----------
P_Explosion.Initialize(1000,10);
P_Explosion.AddFrame(0,"particles/ex0001.jpg",GetColor(1.0f,0.0f,0.0f,0.0f));
P_Explosion.AddFrame(1,"particles/ex0002.jpg",GetColor(1.0f,0.0f,0.0f,0.0f));
P_Explosion.AddFrame(2,"particles/ex0003.jpg",GetColor(1.0f,0.0f,0.0f,0.0f));
P_Explosion.AddFrame(3,"particles/ex0004.jpg",GetColor(1.0f,0.0f,0.0f,0.0f));
P_Explosion.AddFrame(4,"particles/ex0005.jpg",GetColor(1.0f,0.0f,0.0f,0.0f));
P_Explosion.AddFrame(5,"particles/ex0006.jpg",GetColor(1.0f,0.0f,0.0f,0.0f));
P_Explosion.AddFrame(6,"particles/ex0007.jpg",GetColor(1.0f,0.0f,0.0f,0.0f));
P_Explosion.AddFrame(7,"particles/ex0008.jpg",GetColor(1.0f,0.0f,0.0f,0.0f));
P_Explosion.AddFrame(8,"particles/ex0009.jpg",GetColor(1.0f,0.0f,0.0f,0.0f));
P_Explosion.AddFrame(9,"particles/ex0010.jpg",GetColor(1.0f,0.0f,0.0f,0.0f));
//P_Hit
//---------
P_Hit.Initialize(500,1);
P_Hit.AddFrame(0,"particles/hit.bmp",GetColor(1.0f,0.0f,0.0f,0.0f));
//P_Bullet
//---------
P_Bullet.Initialize(300,1);
P_Bullet.AddFrame(0,"particles/bullet.bmp",GetColor(1.0f,1.0f,0.0f,1.0f));
//P_Particle
//---------
P_Particle.Initialize(1000,1);
P_Particle.AddFrame(0,"particles/particle.bmp",GetColor(1.0f,1.0f,0.0f,1.0f));
//////////////////
//PARTICLESYSTEM//
//////////////////
//-------------
//S_SmokeGround
//-------------
S_SmokeGround.Initialize(&P_Smoke,1000);
S_SmokeGround.Emitter.Type = EMITTER_POINT;
S_SmokeGround.Direction = Get3D(0.2f,1.0f,0.2f);
S_SmokeGround.Gravity = Get3D(0.0f,0.2f,0.0f);
S_SmokeGround.GravityPower = 0.7f;
S_SmokeGround.SpawnFreqency = 280.0f;
S_SmokeGround.SpawnPower = 5.0f;
S_SmokeGround.DirectionPower = 0.2f;
S_SmokeGround.SRCColor = GetColor(0.0f,1.0f,1.0f,1.0f);
S_SmokeGround.SRCSize = 35.0f;
S_SmokeGround.DSTColor = GetColor(1.0f,0.0f,0.0f,0.0f);
S_SmokeGround.DSTSize = 70.0f;
S_SmokeGround.RotationSpeed = 0.035f;
S_SmokeGround.DirRandFactor = 0.1f;
S_SmokeGround.CycleLeght = 6000.0f;
//-------------
//S_SmokePlane
//-------------
S_SmokePlane.Initialize(&P_Explosion,1000);
S_SmokePlane.Emitter.Type = EMITTER_POINT;
S_SmokePlane.Direction = Get3D(0.0f,0.0f,0.0f);
S_SmokePlane.Gravity = Get3D(0.0f,0.0f,0.0f);
S_SmokePlane.GravityPower = 0.0f;
S_SmokePlane.SpawnFreqency = 70.0f;
S_SmokePlane.SpawnPower = 0.0f;
S_SmokePlane.DirectionPower = 0.2f;
S_SmokePlane.SRCColor = GetColor(1.0f,1.0f,1.0f,1.0f);
S_SmokePlane.SRCSize = 20.0f;
S_SmokePlane.SRCFrame = 4.0f;
S_SmokePlane.DSTColor = GetColor(0.0f,0.0f,0.0f,0.0f);
S_SmokePlane.DSTSize = 80.0f;
S_SmokePlane.DSTFrame = 4.0f;
S_SmokePlane.RotationSpeed = 0.0f;
S_SmokePlane.DirRandFactor = 0.1f;
S_SmokePlane.CycleLeght = 6000.0f;
//-------------
//S_SmokeHit
//-------------
S_SmokeHit.Initialize(&P_Hit,500);
S_SmokeHit.Emitter.Type = EMITTER_POINT;
S_SmokeHit.Direction = Get3D(0.0f,0.0f,0.0f);
S_SmokeHit.Gravity = Get3D(0.0f,0.0f,0.0f);
S_SmokeHit.GravityPower = 0.0f;
S_SmokeHit.SpawnFreqency = 50.0f;
S_SmokeHit.SpawnPower = 0.0f;
S_SmokeHit.DirectionPower = 0.2f;
S_SmokeHit.SRCColor = GetColor(1.0f,1.0f,1.0f,1.0f);
S_SmokeHit.SRCSize = 19.0f;
S_SmokeHit.SRCFrame = 0.0f;
S_SmokeHit.DSTColor = GetColor(0.0f,0.0f,0.0f,0.0f);
S_SmokeHit.DSTSize = 37.0f;
S_SmokeHit.DSTFrame = 0.0f;
S_SmokeHit.RotationSpeed = 0.0f;
S_SmokeHit.DirRandFactor = 0.1f;
S_SmokeHit.CycleLeght = 3000.0f;
//-------------
//S_SmokeBomb
//-------------
S_SmokeBomb.Initialize(&P_SmokeBomb,500);
S_SmokeBomb.Emitter.Type = EMITTER_POINT;
S_SmokeBomb.Direction = Get3D(0.0f,0.0f,0.0f);
S_SmokeBomb.Gravity = Get3D(0.0f,0.0f,0.0f);
S_SmokeBomb.GravityPower = 0.0f;
S_SmokeBomb.SpawnFreqency = 60.0f;
S_SmokeBomb.SpawnPower = 0.0f;
S_SmokeBomb.DirectionPower = 0.01f;
S_SmokeBomb.SRCColor = GetColor(0.5f,1.0f,1.0f,1.0f);
S_SmokeBomb.SRCSize = 5.0f;
S_SmokeBomb.SRCFrame = 0.0f;
S_SmokeBomb.DSTColor = GetColor(0.0f,0.0f,0.0f,0.0f);
S_SmokeBomb.DSTSize = 40.0f;
S_SmokeBomb.DSTFrame = 0.0f;
S_SmokeBomb.RotationSpeed = 0.0f;
S_SmokeBomb.DirRandFactor = 0.1f;
S_SmokeBomb.CycleLeght = 1500.0f;
//-------
//S_Hit
//-------
S_Hit.Initialize(&P_Hit,500);
S_Hit.Emitter.Type = EMITTER_POINT;
S_Hit.Direction = Get3D(0.0f,0.0f,0.0f);
S_Hit.Gravity = Get3D(0.0f,0.0f,0.0f);
S_Hit.GravityPower = 0.0f;
S_Hit.SpawnFreqency = 350.0f;
S_Hit.SpawnPower = 0.0f;
S_Hit.DirectionPower = 0.0f;
S_Hit.SRCColor = GetColor(1.0f,1.0f,1.0f,1.0f);
S_Hit.SRCSize = 10.0f;
S_Hit.DSTColor = GetColor(0.0f,0.0f,0.0f,0.0f);
S_Hit.DSTSize = 10.0f;
S_Hit.RotationSpeed = 0.0f;
S_Hit.DirRandFactor = 0.1f;
S_Hit.CycleLeght = 1000.0f;
//-------
//S_Bullet
//-------
S_Bullet.Initialize(&P_Bullet,300);
S_Bullet.Emitter.Type = EMITTER_POINT;
S_Bullet.Direction = Get3D(0.0f,0.0f,0.0f);
S_Bullet.Gravity = Get3D(0.0f,0.0f,0.0f);
S_Bullet.GravityPower = 0.0f;
S_Bullet.SpawnFreqency = 350.0f;
S_Bullet.SpawnPower = 0.0f;
S_Bullet.DirectionPower = 0.0f;
S_Bullet.SRCColor = GetColor(1.0f,1.0f,1.0f,1.0f);
S_Bullet.SRCSize = 1.6f;
S_Bullet.DSTColor = GetColor(0.0f,0.0f,0.0f,0.0f);
S_Bullet.DSTSize = 1.6f;
S_Bullet.RotationSpeed = 0.02f;
S_Bullet.DirRandFactor = 0.1f;
S_Bullet.CycleLeght = 2000.0f;
//----------
//S_Particle
//----------
S_Particle.Initialize(&P_Particle,1000);
S_Particle.Emitter.Type = EMITTER_POINT;
S_Particle.Direction = Get3D(0.0f,1.0f,0.0f);
S_Particle.Gravity = Get3D(0.0f,-1.0f,0.0f);
S_Particle.GravityPower = 0.1f;
S_Particle.SpawnFreqency = 200.0f;
S_Particle.SpawnPower = 5.5f;
S_Particle.DirectionPower = 0.5f;
S_Particle.SRCColor = GetColor(1.0f,1.0f,1.0f,1.0f);
S_Particle.SRCSize = 4.0f;
S_Particle.SRCFrame = 0.0f;
S_Particle.DSTColor = GetColor(0.0f,0.0f,0.0f,0.0f);
S_Particle.DSTSize = 4.0f;
S_Particle.DSTFrame = 0.0f;
S_Particle.RotationSpeed = 0.1f;
S_Particle.DirRandFactor = 10.0f;
S_Particle.CycleLeght = 1500.0f;
//----------
//S_Explosion
//----------
S_Explosion.Initialize(&P_Explosion,1000);
S_Explosion.Emitter.Type = EMITTER_POINT;
S_Explosion.Direction = Get3D(0.0f,0.0f,0.0f);
S_Explosion.Gravity = Get3D(0.0f,0.0f,0.0f);
S_Explosion.GravityPower = 0.0f;
S_Explosion.SpawnFreqency = 200.0f;
S_Explosion.SpawnPower = 0.0f;
S_Explosion.DirectionPower = 0.0f;
S_Explosion.SRCColor = GetColor(1.0f,1.0f,1.0f,1.0f);
S_Explosion.SRCSize = 40.0f;
S_Explosion.SRCFrame = 0.0f;
S_Explosion.DSTColor = GetColor(0.0f,0.0f,0.0f,0.0f);
S_Explosion.DSTSize = 150.0f;
S_Explosion.DSTFrame = 9.0f;
S_Explosion.RotationSpeed = 0.0f;
S_Explosion.DirRandFactor = 0.1f;
S_Explosion.CycleLeght = 1000.0f;
//--------
//F_Plane
//--------
F_Plane.Initialize("particles/fireball1.ase",
"particles/fireball1.jpg",
GetColor(0.0f,0.0f,0.0f));
F_Plane.SRCScale = Get3D(2.0f,2.0f,2.0f);
F_Plane.DSTScale = Get3D(20.0f,20.0f,20.0f);
//--------
//F_Ball
//--------
F_Ball.Initialize("particles/fireball2.ase",
"particles/fireball2.jpg",
GetColor(0.0f,0.0f,0.0f));
F_Ball.SRCScale = Get3D(2.0f,2.0f,2.0f);
F_Ball.DSTScale = Get3D(9.0f,9.0f,9.0f);
}
//redner vybuchov
//----------------------------------------------------------
void EXPLO::Render()
{
//ak niesu zapnute particle effekty nerenderuj
if (ParticleEffects == 0)
return;
//S_Explosion
//-------------
Engine.SetBlendCustom(D3DBLEND_SRCALPHA,D3DBLEND_ONE);
S_Explosion.ProcessParticles();
S_Explosion.Render();
Engine.SetBlendNone();
//S_SmokeHit
//-------------
Engine.SetBlendTrans();
S_SmokeHit.ProcessParticles();
S_SmokeHit.Render();
Engine.SetBlendNone();
//S_SmokeBomb
//-------------
Engine.SetBlendTrans();
S_SmokeBomb.ProcessParticles();
S_SmokeBomb.Render();
Engine.SetBlendNone();
//S_SmokePlane
//-------------
Engine.SetBlendCustom(D3DBLEND_SRCALPHA,D3DBLEND_ONE);
S_SmokePlane.ProcessParticles();
S_SmokePlane.Render();
Engine.SetBlendNone();
//S_Hit
//-------------
Engine.SetBlendTrans();
S_Hit.ProcessParticles();
S_Hit.Render();
Engine.SetBlendNone();
//S_Bullet
//-------------
Engine.SetBlendTrans();
S_Bullet.ProcessParticles();
S_Bullet.Render();
Engine.SetBlendNone();
//S_Particle
//-------------
Engine.SetBlendTrans();
S_Particle.ProcessParticles();
S_Particle.Render();
Engine.SetBlendNone();
//S_SmokeGround
//-------------
Engine.SetBlendCustom(D3DBLEND_SRCALPHA,D3DBLEND_INVSRCCOLOR);
S_SmokeGround.ProcessParticles();
S_SmokeGround.Render();
Engine.SetBlendNone();
//F_Ball
//--------------
Engine.SetBlendCustom(D3DBLEND_SRCALPHA,D3DBLEND_ONE);
F_Ball.Refresh();
Engine.SetBlendNone();
//F_Plane
//--------------
Engine.SetBlendCustom(D3DBLEND_SRCALPHA,D3DBLEND_ONE);
F_Plane.Refresh();
Engine.SetBlendNone();
}
//vypusti dym na zemy - zo znicenych budov
//-----------------------------------------------------------
void EXPLO::SpawnSmokeGround(VECTOR3D Pos)
{
//ak niesu zapnute particle effekty nerenderuj
if (ParticleEffects == 0)
return;
S_SmokeGround.Emitter.Position = Pos;
S_SmokeGround.SpawnParticlesTime(1);
}
//vypusti dym v lietadle
//-----------------------------------------------------------
void EXPLO::SpawnSmokePlane(VECTOR3D Pos)
{
//ak niesu zapnute particle effekty nerenderuj
if (ParticleEffects == 0)
return;
S_SmokePlane.Emitter.Position = Pos;
S_SmokePlane.SpawnParticlesTime(1);
}
//vypusti dym v lietadle
//-----------------------------------------------------------
void EXPLO::SpawnSmokeHit(VECTOR3D Pos)
{
//ak niesu zapnute particle effekty nerenderuj
if (ParticleEffects == 0)
return;
S_SmokeHit.Emitter.Position = Pos;
S_SmokeHit.SpawnParticlesTime(1);
}
//vypusti dym v bombe
//-----------------------------------------------------------
void EXPLO::SpawnSmokeBomb(VECTOR3D Pos)
{
//ak niesu zapnute particle effekty nerenderuj
if (ParticleEffects == 0)
return;
S_SmokeBomb.Emitter.Position = Pos;
S_SmokeBomb.SpawnParticlesTime(1);
}
//vypusti crepiny z vybuchu
//-----------------------------------------------------------
void EXPLO::SpawnParticle(VECTOR3D Pos)
{
//ak niesu zapnute particle effekty nerenderuj
if (ParticleEffects == 0)
return;
S_Particle.Emitter.Position = Pos;
S_Particle.SpawnParticles(50);
}
//vypusti ohnivu gulu
//-----------------------------------------------------------
void EXPLO::SpawnExplosion(VECTOR3D Pos)
{
//ak niesu zapnute particle effekty nerenderuj
if (ParticleEffects == 0)
return;
S_Explosion.Emitter.Position = Pos;
S_Explosion.SpawnParticles(2);
}
//vypusti zasah
//-----------------------------------------------------------
void EXPLO::SpawnHit(VECTOR3D Pos)
{
//ak niesu zapnute particle effekty nerenderuj
if (ParticleEffects == 0)
return;
S_Hit.Emitter.Position = Pos;
S_Hit.SpawnParticles(1);
}
//vypusti zasah lietadla
//-----------------------------------------------------------
void EXPLO::SpawnBullet(VECTOR3D Pos)
{
//ak niesu zapnute particle effekty nerenderuj
if (ParticleEffects == 0)
return;
S_Bullet.Emitter.Position = Pos;
S_Bullet.SpawnParticles(1);
}