home *** CD-ROM | disk | FTP | other *** search
- #include "PlasmagunShot.h"
-
- #include "Game.h"
- #include "WeaponEffectsParticleClusters.h"
- #include "Network.h"
-
- PlasmagunShot::PlasmagunShot(int clientId, int weaponId): Shot(clientId, weaponId, 10000){
- this->type = GAME_WEAPON_PLASMAGUN;
- this->moveSpeed = 30.0f;
- this->inflictedDamage = 6;
-
- shader = Game::preloadedGameMedia.plasmagunShotShader;
- }
-
- PlasmagunShot::~PlasmagunShot(){
- }
-
- void PlasmagunShot::leaveMuzzle(){
- if( Renderer::info.var.useDynamicLighting ){
- vec3_t col;
- vectorInit3d(0.2f, 0.4f, 0.8f, col);
- Renderer::particleSystem.linkParticleCluster( new DynamicLightParticleCluster(pos, col, 1.5f, 20) );
- }
-
- if( Sound::info.var.enabled && Sound::info.var.playSamples ){
- Sound::playEffect(pos, Game::preloadedGameMedia.plasmagunFireSound, 0);
- }
-
- // push
- if( Network::server->clients[clientId] != NULL && Network::server->clients[clientId]->vehicle != NULL ){
- vec3_t pushForce;
- vectorScale3d(-150.0f , this->dir, pushForce);
- Network::server->clients[clientId]->vehicle->physicsInfo.addPushForce(pushForce, 30);
- }
-
- Shot::leaveMuzzle(); // animation and some other stuff
- }
-
-
- void PlasmagunShot::hitFace(Face* face, vec3_t hp){
- vec3_t p;
- vectorMA3d(hp, 0.1f, face->normal, p);
- Renderer::particleSystem.linkParticleCluster( new PlasmagunImpactParticleCluster(this, p) );
-
- if( Renderer::info.var.useDynamicLighting ){
- vec3_t col;
- vectorInit3d(0.2f, 0.4f, 0.8f, col);
- Renderer::particleSystem.linkParticleCluster( new DynamicLightParticleCluster(hp, col, 4.0f, 100) );
- }
-
- if( Renderer::info.var.renderParticleEffects >= 3 ){
- Renderer::particleSystem.linkParticleCluster( new PlasmagunMarkParticleCluster(hp, face) );
- }
-
- if( Sound::info.var.enabled && Sound::info.var.playSamples ){
- Sound::playEffect(hp, Game::preloadedGameMedia.plasmagunImpactSound, 0);
- }
-
- Shot::hitFace(face, hp);
- }
-
- void PlasmagunShot::hitVehicle(Vehicle* vehicle, vec3_t hp){
- Renderer::particleSystem.linkParticleCluster( new PlasmagunImpactParticleCluster(this, hp) );
-
- if( Renderer::info.var.useDynamicLighting ){
- vec3_t col;
- vectorInit3d(0.2f, 0.4f, 0.8f, col);
- Renderer::particleSystem.linkParticleCluster( new DynamicLightParticleCluster(hp, col, 4.0f, 100) );
- }
-
- if( Sound::info.var.enabled && Sound::info.var.playSamples ){
- Sound::playEffect(hp, Game::preloadedGameMedia.plasmagunImpactSound, 0);
- }
-
- // push
- vec3_t pushForce;
- vectorScale3d(200.0f , this->dir, pushForce);
- vehicle->physicsInfo.addPushForce(pushForce, 50);
-
- Shot::hitVehicle(vehicle, hp);
- }
-
- void PlasmagunShot::render(){
- if( Renderer::info.var.useTransparentPolysList ){
- Renderer::addBillboardToTransparentPolys(pos, 0.75f, 0.75f, shader, SDL_GetTicks() - spawntimeMillis);
- }else{
- shader->setup(SDL_GetTicks() - spawntimeMillis);
- Renderer::renderBillboard(pos, 0.75f, 0.75f, shader);
- shader->setdown();
- }
- }
-
-
-