home *** CD-ROM | disk | FTP | other *** search
- #include "LaserShot.h"
-
- #include "Game.h"
- #include "WeaponEffectsParticleClusters.h"
- #include "Network.h"
-
- LaserShot::LaserShot(int clientId, int weaponId): Shot(clientId, weaponId, 10000){
- this->type = GAME_WEAPON_LASER;
- this->moveSpeed = 45.0f;
- this->inflictedDamage = 8;
-
- this->model = Game::preloadedGameMedia.laserShotModel;
- }
-
- LaserShot::~LaserShot(){
- }
-
- void LaserShot::leaveMuzzle(){
- if( Renderer::info.var.useDynamicLighting ){
- vec3_t col;
- vectorInit3d(0.2f, 0.6f, 0.7f, col);
- Renderer::particleSystem.linkParticleCluster( new DynamicLightParticleCluster(pos, col, 1.0f, 10) );
- }
-
- if( Sound::info.var.enabled && Sound::info.var.playSamples ){
- Sound::playEffect(pos, Game::preloadedGameMedia.laserFireSound, 0);
- }
-
- Shot::leaveMuzzle(); // animation and some other stuff
- }
-
-
- void LaserShot::hitFace(Face* face, vec3_t hp){
- if( Renderer::info.var.useDynamicLighting ){
- vec3_t col;
- vectorInit3d(0.1f, 0.4f, 0.5f, col);
- Renderer::particleSystem.linkParticleCluster( new DynamicLightParticleCluster(hp, col, 4.0f, 100) );
- }
-
- if( Renderer::info.var.renderParticleEffects >= 2 ){
- vec3_t p;
- vectorMA3d(hp, 0.05f, face->normal, p);
- Renderer::particleSystem.linkParticleCluster( new SmallSmokePuffParticleCluster(p) );
- }
-
- if( Renderer::info.var.renderParticleEffects >= 3 ){
- Renderer::particleSystem.linkParticleCluster( new LaserMarkParticleCluster(hp, face) );
- }
-
- if( Sound::info.var.enabled && Sound::info.var.playSamples ){
- Sound::playEffect(hp, Game::preloadedGameMedia.laserImpactSound, 0);
- }
-
- Shot::hitFace(face, hp);
- }
-
- void LaserShot::hitVehicle(Vehicle* vehicle, vec3_t hp){
- if( Renderer::info.var.useDynamicLighting ){
- vec3_t col;
- vectorInit3d(0.1f, 0.4f, 0.5f, col);
- Renderer::particleSystem.linkParticleCluster( new DynamicLightParticleCluster(hp, col, 4.0f, 100) );
- }
-
- if( Renderer::info.var.renderParticleEffects >= 2 ){
- Renderer::particleSystem.linkParticleCluster( new SmallSmokePuffParticleCluster(hp) );
- }
-
- if( Sound::info.var.enabled && Sound::info.var.playSamples ){
- Sound::playEffect(hp, Game::preloadedGameMedia.laserImpactSound, 0);
- }
-
- // push
- vec3_t pushForce;
- vectorScale3d(200.0f , this->dir, pushForce);
- vehicle->physicsInfo.addPushForce(pushForce, 50);
-
- Shot::hitVehicle(vehicle, hp);
- }
-
-
- void LaserShot::render(){
- glPushMatrix();
- float m[] = { left[0], left[1], left[2], 0.0f,
- up[0], up[1], up[2], 0.0f,
- dir[0], dir[1], dir[2], 0.0f,
- pos[0], pos[1], pos[2], 1.0f
- };
- glMultMatrixf(m);
-
- Renderer::renderModel(model);
-
- glPopMatrix();
- }
-
-
-