diff --git a/mk/windoze/glest_game.vcxproj b/mk/windoze/glest_game.vcxproj index a27d3aeee..8725d1256 100644 --- a/mk/windoze/glest_game.vcxproj +++ b/mk/windoze/glest_game.vcxproj @@ -269,6 +269,7 @@ + @@ -356,6 +357,7 @@ + diff --git a/source/glest_game/graphics/particle_type.cpp b/source/glest_game/graphics/particle_type.cpp index 110ada9db..2a8a2bfc5 100644 --- a/source/glest_game/graphics/particle_type.cpp +++ b/source/glest_game/graphics/particle_type.cpp @@ -3,9 +3,9 @@ // // Copyright (C) 2010-2010 Titus Tscharntke // -// You can redistribute this code and/or modify it under -// the terms of the GNU General Public License as published -// by the Free Software Foundation; either version 2 of the +// You can redistribute this code and/or modify it under +// the terms of the GNU General Public License as published +// by the Free Software Foundation; either version 2 of the // License, or (at your option) any later version // ============================================================== @@ -160,7 +160,7 @@ void ParticleSystemType::load(const XmlNode *particleSystemNode, const string &d else { texture= NULL; } - + //model if(particleSystemNode->hasChild("model")){ const XmlNode *modelNode= particleSystemNode->getChild("model"); @@ -172,7 +172,7 @@ void ParticleSystemType::load(const XmlNode *particleSystemNode, const string &d string path= modelNode->getAttribute("path")->getRestrictedValue(currentPath); model= renderer->newModel(rsGame,path, false, &loadedFileList, &parentLoader); loadedFileList[path].push_back(make_pair(parentLoader,modelNode->getAttribute("path")->getRestrictedValue())); - + if(modelNode->hasChild("cycles")) { modelCycle = modelNode->getChild("cycles")->getAttribute("value")->getFloatValue(); if(modelCycle < 0.0) @@ -235,7 +235,7 @@ void ParticleSystemType::load(const XmlNode *particleSystemNode, const string &d //speed const XmlNode *energyVarNode= particleSystemNode->getChild("energy-var"); energyVar= energyVarNode->getAttribute("value")->getIntValue(); - + //teamcolorNoEnergy if(particleSystemNode->hasChild("teamcolorNoEnergy")){ const XmlNode *teamcolorNoEnergyNode= particleSystemNode->getChild("teamcolorNoEnergy"); @@ -441,7 +441,7 @@ void ParticleSystemTypeProjectile::load(const XmlNode* particleFileNode, const s particleFileNode->setSuper(particleSystemNode); particleSystemNode= particleFileNode; } - + ParticleSystemType::load(particleSystemNode, dir, renderer, loadedFileList,parentLoader, techtreePath); //trajectory values @@ -535,7 +535,7 @@ void ParticleSystemTypeSplash::load(const XmlNode* particleFileNode, const strin loadedFileList[path].push_back(make_pair(parentLoader,parentLoader)); const XmlNode *particleSystemNode= xmlTree.getRootNode(); - + if(particleFileNode){ // immediate children in the particleFileNode will override the particleSystemNode particleFileNode->setSuper(particleSystemNode); @@ -547,7 +547,7 @@ void ParticleSystemTypeSplash::load(const XmlNode* particleFileNode, const strin //emission rate fade const XmlNode *emissionRateFadeNode= particleSystemNode->getChild("emission-rate-fade"); emissionRateFade= emissionRateFadeNode->getAttribute("value")->getFloatValue(); - + //spread values const XmlNode *verticalSpreadNode= particleSystemNode->getChild("vertical-spread"); verticalSpreadA= verticalSpreadNode->getAttribute("a")->getFloatValue(0.0f, 1.0f); diff --git a/source/glest_game/types/projectile_type.cpp b/source/glest_game/types/projectile_type.cpp new file mode 100644 index 000000000..9d6265c09 --- /dev/null +++ b/source/glest_game/types/projectile_type.cpp @@ -0,0 +1,88 @@ +// ============================================================== +// This file is part of Glest (www.glest.org) +// +// Copyright (C) 2001-2008 Martiño Figueroa +// +// You can redistribute this code and/or modify it under +// the terms of the GNU General Public License as published +// by the Free Software Foundation; either version 2 of the +// License, or (at your option) any later version +// ============================================================== + +#include +#include "logger.h" +#include "lang.h" +#include "renderer.h" +#include "leak_dumper.h" + +using namespace Shared::Util; + +namespace Glest{ namespace Game{ + +ProjectileType::ProjectileType() { + + projectileParticleSystemType=NULL; + attackStartTime=0.0f; + + splash=false; + splashRadius=0; + splashDamageAll=true; + splashParticleSystemType=NULL; + + shake=false; + shakeIntensity=0; + shakeDuration=0; + + shakeVisible=true; + shakeInCameraView=true; + shakeCameraAffected=false; + +} + + +void ProjectileType::load(const XmlNode *projectileNode, const string &dir, const string &techtreepath, std::map > > &loadedFileList, + string parentLoader){ + + string currentPath = dir; + endPathWithSlash(currentPath); + + if(projectileNode->hasAttribute("attack-start-time")){ + attackStartTime =projectileNode->getAttribute("attack-start-time")->getFloatValue(); + } + else + { + attackStartTime=0.0f; + } + if(projectileNode->hasChild("particle")){ + const XmlNode *particleNode= projectileNode->getChild("particle"); + bool particleEnabled= particleNode->getAttribute("value")->getBoolValue(); + if(particleEnabled){ + string path= particleNode->getAttribute("path")->getRestrictedValue(); + ParticleSystemTypeProjectile* projectileParticleSystemType= new ParticleSystemTypeProjectile(); + projectileParticleSystemType->load(particleNode, dir, currentPath + path, + &Renderer::getInstance(), loadedFileList, parentLoader, + techtreepath); + loadedFileList[currentPath + path].push_back(make_pair(parentLoader,particleNode->getAttribute("path")->getRestrictedValue())); + setProjectileParticleSystemType(projectileParticleSystemType); + } + } + + const XmlNode *soundNode= projectileNode->getChild("sound"); + if(soundNode->getAttribute("enabled")->getBoolValue()){ + + hitSounds.resize((int)soundNode->getChildCount()); + for(int i=0; i < (int)soundNode->getChildCount(); ++i){ + const XmlNode *soundFileNode= soundNode->getChild("sound-file", i); + string path= soundFileNode->getAttribute("path")->getRestrictedValue(currentPath, true); + //printf("\n\n\n\n!@#$ ---> parentLoader [%s] path [%s] nodeValue [%s] i = %d",parentLoader.c_str(),path.c_str(),soundFileNode->getAttribute("path")->getRestrictedValue().c_str(),i); + + StaticSound *sound= new StaticSound(); + sound->load(path); + loadedFileList[path].push_back(make_pair(parentLoader,soundFileNode->getAttribute("path")->getRestrictedValue())); + hitSounds[i]= sound; + } + } +} + + +}}//end namespace diff --git a/source/glest_game/types/projectile_type.h b/source/glest_game/types/projectile_type.h new file mode 100644 index 000000000..15c5d31da --- /dev/null +++ b/source/glest_game/types/projectile_type.h @@ -0,0 +1,88 @@ +// ============================================================== +// This file is part of Glest (www.glest.org) +// +// Copyright (C) 2001-2008 Martiño Figueroa +// +// You can redistribute this code and/or modify it under +// the terms of the GNU General Public License as published +// by the Free Software Foundation; either version 2 of the +// License, or (at your option) any later version +// ============================================================== + +#ifndef _GLEST_GAME_PROJEKTILETYPE_H_ +#define _GLEST_GAME_PROJEKTILETYPE_H_ + +#ifdef WIN32 + #include + #include +#endif + +#include "sound.h" +#include "vec.h" +//#include "xml_parser.h" +#include "util.h" +//#include "element_type.h" +#include "factory.h" +#include "sound_container.h" +#include "particle_type.h" +#include "leak_dumper.h" + +using std::vector; +using std::string; + +namespace Glest{ namespace Game{ +// ===================================================== +// class ProjectileType +// ===================================================== + +class ProjectileType { +protected: + ParticleSystemTypeProjectile* projectileParticleSystemType; + SoundContainer hitSounds; + float attackStartTime; + + bool splash; + int splashRadius; + bool splashDamageAll; + ParticleSystemTypeSplash* splashParticleSystemType; + + bool shake; + int shakeIntensity; + int shakeDuration; + + bool shakeVisible; + bool shakeInCameraView; + bool shakeCameraAffected; + +public: + ProjectileType(); + virtual ~ProjectileType(){}; + + + void load(const XmlNode *projectileNode, const string &dir, const string &techtreepath, std::map > > &loadedFileList, + string parentLoader); + + //get/set + inline StaticSound *getHitSound() const {return hitSounds.getRandSound();} + ParticleSystemTypeProjectile* getProjectileParticleSystemType() const { return projectileParticleSystemType;} + float getAttackStartTime() const {return attackStartTime;} + void setAttackStartTime(float value) {attackStartTime=value;} + bool isSplash() const { return splash;} + bool isSplashDamageAll() const { return splashDamageAll;} + ParticleSystemTypeSplash* getSplashParticleSystemType() const { return splashParticleSystemType;} + int getSplashRadius() const { return splashRadius;} + + bool isShake() const{return shake;} + bool isShakeCameraAffected() const{return shakeCameraAffected;} + int getShakeDuration() const{return shakeDuration;} + bool isShakeInCameraView() const{return shakeInCameraView;} + int getShakeIntensity() const{return shakeIntensity;} + bool isShakeVisible() const{return shakeVisible;} + + void setProjectileParticleSystemType(ParticleSystemTypeProjectile *pointer) {projectileParticleSystemType=pointer;} + ParticleSystemTypeProjectile* getProjectileParticleSystemType() {return projectileParticleSystemType;} +}; + +}}//end namespace + +#endif diff --git a/source/glest_game/types/skill_type.cpp b/source/glest_game/types/skill_type.cpp index e939b2434..d7d343fb3 100644 --- a/source/glest_game/types/skill_type.cpp +++ b/source/glest_game/types/skill_type.cpp @@ -19,6 +19,7 @@ #include "renderer.h" #include "particle_type.h" #include "unit_particle_type.h" +#include "projectile_type.h" #include "tech_tree.h" #include "faction_type.h" #include "leak_dumper.h" @@ -821,7 +822,7 @@ AttackSkillType::AttackSkillType() { AttackSkillType::~AttackSkillType() { - deleteValues(projectileParticleSystemTypes.begin(), projectileParticleSystemTypes.end()); + deleteValues(projectileTypes.begin(), projectileTypes.end()); delete splashParticleSystemType; splashParticleSystemType = NULL; @@ -880,59 +881,56 @@ void AttackSkillType::load(const XmlNode *sn, const XmlNode *attackBoostsNode, } } - //projectile - const XmlNode *projectileNode= sn->getChild("projectile"); - projectile= projectileNode->getAttribute("value")->getBoolValue(); - if(projectile){ + if(sn->hasChild("projectiles")){ + const XmlNode *projectilesNode= sn->getChild("projectiles"); + vector projectilesNodeList = projectilesNode->getChildList("projectile"); + for(unsigned int i = 0; i < projectilesNodeList.size(); ++i) { + const XmlNode *projectileNode= projectilesNodeList[i]; + ProjectileType *projectileType=new ProjectileType(); + projectileType->load(projectileNode,dir, tt->getPath(), loadedFileList, parentLoader); - //proj particle - if(projectileNode->hasChild("particle")){ - const XmlNode *particleNode= projectileNode->getChild("particle"); - bool particleEnabled= particleNode->getAttribute("value")->getBoolValue(); - if(particleEnabled){ - string path= particleNode->getAttribute("path")->getRestrictedValue(); - ParticleSystemTypeProjectile* projectileParticleSystemType= new ParticleSystemTypeProjectile(); - projectileParticleSystemType->load(particleNode, dir, currentPath + path, - &Renderer::getInstance(), loadedFileList, parentLoader, - tt->getPath()); - loadedFileList[currentPath + path].push_back(make_pair(parentLoader,particleNode->getAttribute("path")->getRestrictedValue())); - projectileParticleSystemTypes.push_back(projectileParticleSystemType); - } + projectileTypes.push_back(projectileType); + projectile=true; } - - //extra projectiles - if(projectileNode->hasChild("particles")){ - const XmlNode *extraParticlesNode= projectileNode->getChild("particles"); - bool extraParticlesEnabled= extraParticlesNode->getAttribute("value")->getBoolValue(); - if(extraParticlesEnabled){ - for(int i = 0; i < (int)extraParticlesNode->getChildCount(); ++i) { - const XmlNode *extraParticleFileNode= extraParticlesNode->getChild("particle-file", i); - string path= extraParticleFileNode->getAttribute("path")->getRestrictedValue(); - ParticleSystemTypeProjectile* projectileParticleSystemType= new ParticleSystemTypeProjectile(); - projectileParticleSystemType->load(extraParticleFileNode, dir, currentPath + path, - &Renderer::getInstance(), loadedFileList, parentLoader, - tt->getPath()); - loadedFileList[currentPath + path].push_back(make_pair(parentLoader,extraParticleFileNode->getAttribute("path")->getRestrictedValue())); - projectileParticleSystemTypes.push_back(projectileParticleSystemType); + } + else { + //projectile -- backward compatible old behaviour with only one projectile + const XmlNode *projectileNode= sn->getChild("projectile"); + projectile= projectileNode->getAttribute("value")->getBoolValue(); + if(projectile){ + // create new projectile + ProjectileType *projectileType=new ProjectileType(); + projectileTypes.push_back(projectileType); + projectileType->setAttackStartTime(attackStartTime); + //proj particle + if(projectileNode->hasChild("particle")){ + const XmlNode *particleNode= projectileNode->getChild("particle"); + bool particleEnabled= particleNode->getAttribute("value")->getBoolValue(); + if(particleEnabled){ + string path= particleNode->getAttribute("path")->getRestrictedValue(); + ParticleSystemTypeProjectile* projectileParticleSystemType= new ParticleSystemTypeProjectile(); + projectileParticleSystemType->load(particleNode, dir, currentPath + path, + &Renderer::getInstance(), loadedFileList, parentLoader, + tt->getPath()); + loadedFileList[currentPath + path].push_back(make_pair(parentLoader,particleNode->getAttribute("path")->getRestrictedValue())); + projectileType->setProjectileParticleSystemType(projectileParticleSystemType); } } - } + //proj sounds + const XmlNode *soundNode= projectileNode->getChild("sound"); + if(soundNode->getAttribute("enabled")->getBoolValue()){ + projSounds.resize((int)soundNode->getChildCount()); + for(int i=0; i < (int)soundNode->getChildCount(); ++i){ + const XmlNode *soundFileNode= soundNode->getChild("sound-file", i); + string path= soundFileNode->getAttribute("path")->getRestrictedValue(currentPath, true); + //printf("\n\n\n\n!@#$ ---> parentLoader [%s] path [%s] nodeValue [%s] i = %d",parentLoader.c_str(),path.c_str(),soundFileNode->getAttribute("path")->getRestrictedValue().c_str(),i); - //proj sounds - const XmlNode *soundNode= projectileNode->getChild("sound"); - if(soundNode->getAttribute("enabled")->getBoolValue()){ - - projSounds.resize((int)soundNode->getChildCount()); - for(int i=0; i < (int)soundNode->getChildCount(); ++i){ - const XmlNode *soundFileNode= soundNode->getChild("sound-file", i); - string path= soundFileNode->getAttribute("path")->getRestrictedValue(currentPath, true); - //printf("\n\n\n\n!@#$ ---> parentLoader [%s] path [%s] nodeValue [%s] i = %d",parentLoader.c_str(),path.c_str(),soundFileNode->getAttribute("path")->getRestrictedValue().c_str(),i); - - StaticSound *sound= new StaticSound(); - sound->load(path); - loadedFileList[path].push_back(make_pair(parentLoader,soundFileNode->getAttribute("path")->getRestrictedValue())); - projSounds[i]= sound; + StaticSound *sound= new StaticSound(); + sound->load(path); + loadedFileList[path].push_back(make_pair(parentLoader,soundFileNode->getAttribute("path")->getRestrictedValue())); + projSounds[i]= sound; + } } } } diff --git a/source/glest_game/types/skill_type.h b/source/glest_game/types/skill_type.h index e0b79ce76..f65989b3b 100644 --- a/source/glest_game/types/skill_type.h +++ b/source/glest_game/types/skill_type.h @@ -27,6 +27,7 @@ #include "factory.h" #include "sound_container.h" #include "particle.h" +#include "projectile_type.h" #include "upgrade_type.h" #include "leak_dumper.h" @@ -74,7 +75,7 @@ enum SkillClass{ }; typedef list UnitParticleSystemTypes; -typedef list ProjectileParticleSystemTypes; +typedef list ProjectileTypes; // ===================================================== // class SkillType // @@ -173,7 +174,6 @@ protected: public: UnitParticleSystemTypes unitParticleSystemTypes; - ProjectileParticleSystemTypes projectileParticleSystemTypes; public: //varios @@ -260,6 +260,8 @@ public: // =============================== class AttackSkillType: public SkillType{ +public: + ProjectileTypes projectileTypes; private: int attackStrength; int attackVar; @@ -299,7 +301,6 @@ public: //get proj inline bool getProjectile() const {return projectile;} - //inline ParticleSystemTypeProjectile * getProjParticleType() const {return projectileParticleSystemType;} inline StaticSound *getProjSound() const {return projSounds.getRandSound();} //get splash diff --git a/source/glest_game/world/unit_updater.cpp b/source/glest_game/world/unit_updater.cpp index a52aa7574..70e1cd866 100644 --- a/source/glest_game/world/unit_updater.cpp +++ b/source/glest_game/world/unit_updater.cpp @@ -21,6 +21,7 @@ #include "network_manager.h" #include "object.h" #include "particle_type.h" +#include "projectile_type.h" #include "path_finder.h" #include "renderer.h" #include "sound.h" @@ -186,14 +187,24 @@ bool UnitUpdater::updateUnit(Unit *unit) { float attackStartTime = truncateDecimal(ast->getAttackStartTime(),6); float lastAnimProgress = truncateDecimal(unit->getLastAnimProgressAsFloat(),6); float animProgress = truncateDecimal(unit->getAnimProgressAsFloat(),6); - bool startAttackParticleSystemNow = (attackStartTime >= lastAnimProgress && attackStartTime < animProgress); + bool startAttackParticleSystemNow = false; + if(ast->projectileTypes.empty() == true ){ + startAttackParticleSystemNow = (attackStartTime >= lastAnimProgress && attackStartTime < animProgress); + } + else {// start projectile attack + for(ProjectileTypes::const_iterator it= ast->projectileTypes.begin(); it != ast->projectileTypes.end(); ++it) { + attackStartTime= (*it)->getAttackStartTime(); + startAttackParticleSystemNow = (attackStartTime >= lastAnimProgress && attackStartTime < animProgress); + if(startAttackParticleSystemNow==true) break; + } + } char szBuf[8096]=""; snprintf(szBuf,8095,"attackStartTime = %f, lastAnimProgress = %f, animProgress = %f startAttackParticleSystemNow = %d",attackStartTime,lastAnimProgress,animProgress,startAttackParticleSystemNow); unit->setNetworkCRCParticleLogInfo(szBuf); if(startAttackParticleSystemNow == true) { - startAttackParticleSystem(unit); + startAttackParticleSystem(unit,lastAnimProgress,animProgress); } } @@ -2592,18 +2603,18 @@ void UnitUpdater::damage(Unit *attacker, const AttackSkillType* ast, Unit *attac //attacker->computeHp(); } -void UnitUpdater::startAttackParticleSystem(Unit *unit){ +void UnitUpdater::startAttackParticleSystem(Unit *unit, float lastAnimProgress, float animProgress){ Renderer &renderer= Renderer::getInstance(); - ProjectileParticleSystem *psProj = 0; + //const AttackSkillType *ast= dynamic_cast(unit->getCurrSkill()); + const AttackSkillType *ast= static_cast(unit->getCurrSkill()); - const AttackSkillType *ast= dynamic_cast(unit->getCurrSkill()); if(ast == NULL) { throw megaglest_runtime_error("Start attack particle ast == NULL!"); } - bool hasProjectile = false; - ParticleSystemTypeSplash *pstSplash= ast->getSplashParticleType(); + ParticleSystemTypeSplash *pstSplash= ast->getSplashParticleType(); + bool hasProjectile = !ast->projectileTypes.empty(); Vec3f startPos= unit->getCurrVector(); Vec3f endPos= unit->getTargetVec(); @@ -2615,41 +2626,51 @@ void UnitUpdater::startAttackParticleSystem(Unit *unit){ visible = true; } - - for(ProjectileParticleSystemTypes::const_iterator pit= unit->getCurrSkill()->projectileParticleSystemTypes.begin(); pit != unit->getCurrSkill()->projectileParticleSystemTypes.end(); ++pit) { - psProj= (*pit)->create(unit); - psProj->setPath(startPos, endPos); - psProj->setObserver(new ParticleDamager(unit, this, gameCamera)); - psProj->setVisible(visible); - if(unit->getFaction()->getTexture()) { - psProj->setFactionColor(unit->getFaction()->getTexture()->getPixmapConst()->getPixel3f(0,0)); + //for(ProjectileParticleSystemTypes::const_iterator pit= unit->getCurrSkill()->projectileParticleSystemTypes.begin(); pit != unit->getCurrSkill()->projectileParticleSystemTypes.end(); ++pit) { + for(ProjectileTypes::const_iterator pt= ast->projectileTypes.begin(); pt != ast->projectileTypes.end(); ++pt) { + bool startAttackParticleSystemNow = ((*pt)->getAttackStartTime() >= lastAnimProgress && (*pt)->getAttackStartTime() < animProgress); + if(startAttackParticleSystemNow){ + ProjectileParticleSystem *psProj= (*pt)->getProjectileParticleSystemType()->create(unit); + psProj->setPath(startPos, endPos); + psProj->setObserver(new ParticleDamager(unit,(*pt), this, gameCamera)); + psProj->setVisible(visible); + if(unit->getFaction()->getTexture()) { + psProj->setFactionColor(unit->getFaction()->getTexture()->getPixmapConst()->getPixel3f(0,0)); + } + renderer.manageParticleSystem(psProj, rsGame); + unit->addAttackParticleSystem(psProj); + ParticleSystemTypeSplash *splashType=(*pt)->getSplashParticleSystemType(); + if(splashType!=NULL){ + SplashParticleSystem *psSplash= pstSplash->create(unit); + psSplash->setPos(endPos); + psSplash->setVisible(visible); + if(unit->getFaction()->getTexture()) { + psSplash->setFactionColor(unit->getFaction()->getTexture()->getPixmapConst()->getPixel3f(0,0)); + } + renderer.manageParticleSystem(psSplash, rsGame); + unit->addAttackParticleSystem(psSplash); + psProj->link(psSplash); + } } - renderer.manageParticleSystem(psProj, rsGame); - unit->addAttackParticleSystem(psProj); - hasProjectile=true; } // if no projectile, still deal damage.. - if(hasProjectile == true) { + if(hasProjectile == false) { char szBuf[8096]=""; snprintf(szBuf,8095,"Unit hitting [startAttackParticleSystem] no proj"); unit->addNetworkCRCDecHp(szBuf); hit(unit); - } - - //splash - if(pstSplash != NULL) { - SplashParticleSystem *psSplash= pstSplash->create(unit); - psSplash->setPos(endPos); - psSplash->setVisible(visible); - if(unit->getFaction()->getTexture()) { - psSplash->setFactionColor(unit->getFaction()->getTexture()->getPixmapConst()->getPixel3f(0,0)); + //splash + if(pstSplash != NULL) { + SplashParticleSystem *psSplash= pstSplash->create(unit); + psSplash->setPos(endPos); + psSplash->setVisible(visible); + if(unit->getFaction()->getTexture()) { + psSplash->setFactionColor(unit->getFaction()->getTexture()->getPixmapConst()->getPixel3f(0,0)); + } + renderer.manageParticleSystem(psSplash, rsGame); + unit->addAttackParticleSystem(psSplash); } - renderer.manageParticleSystem(psSplash, rsGame); - if(hasProjectile == true){ - psProj->link(psSplash); - } - unit->addAttackParticleSystem(psSplash); } } @@ -3206,9 +3227,10 @@ void UnitUpdater::loadGame(const XmlNode *rootNode) { // class ParticleDamager // ===================================================== -ParticleDamager::ParticleDamager(Unit *attacker, UnitUpdater *unitUpdater, const GameCamera *gameCamera){ +ParticleDamager::ParticleDamager(Unit *attacker,const ProjectileType* projectileType, UnitUpdater *unitUpdater, const GameCamera *gameCamera){ this->gameCamera= gameCamera; this->attackerRef= attacker; + this->projectileType= projectileType; this->ast= static_cast(attacker->getCurrSkill()); this->targetPos= attacker->getTargetPos(); this->targetField= attacker->getTargetField(); diff --git a/source/glest_game/world/unit_updater.h b/source/glest_game/world/unit_updater.h index ca9dd893e..6c98dbeb2 100644 --- a/source/glest_game/world/unit_updater.h +++ b/source/glest_game/world/unit_updater.h @@ -143,7 +143,7 @@ private: void hit(Unit *attacker); void hit(Unit *attacker, const AttackSkillType* ast, const Vec2i &targetPos, Field targetField); void damage(Unit *attacker, const AttackSkillType* ast, Unit *attacked, float distance); - void startAttackParticleSystem(Unit *unit); + void startAttackParticleSystem(Unit *unit, float lastAnimProgress, float animProgress); //misc bool searchForResource(Unit *unit, const HarvestCommandType *hct); @@ -169,13 +169,14 @@ class ParticleDamager: public ParticleObserver { public: UnitReference attackerRef; const AttackSkillType* ast; + const ProjectileType* projectileType; UnitUpdater *unitUpdater; const GameCamera *gameCamera; Vec2i targetPos; Field targetField; public: - ParticleDamager(Unit *attacker, UnitUpdater *unitUpdater, const GameCamera *gameCamera); + ParticleDamager(Unit *attacker, const ProjectileType *projectileType, UnitUpdater *unitUpdater, const GameCamera *gameCamera); virtual void update(ParticleSystem *particleSystem); virtual void saveGame(XmlNode *rootNode);