diff --git a/source/glest_game/game/game.cpp b/source/glest_game/game/game.cpp index 796b25e4..40bcdd35 100644 --- a/source/glest_game/game/game.cpp +++ b/source/glest_game/game/game.cpp @@ -2171,7 +2171,7 @@ void Game::update() { } if(currentCameraFollowUnit != NULL) { - Vec3f c=currentCameraFollowUnit->getCurrVector(); + Vec3f c=currentCameraFollowUnit->getCurrMidHeightVector(); int rotation=currentCameraFollowUnit->getRotation(); float angle=rotation+180; @@ -4568,7 +4568,7 @@ void Game::startCameraFollowUnit() { if(currentUnit != NULL) { currentCameraFollowUnit = currentUnit; getGameCameraPtr()->setState(GameCamera::sUnit); - getGameCameraPtr()->setPos(currentCameraFollowUnit->getCurrVector()); + getGameCameraPtr()->setPos(currentCameraFollowUnit->getCurrMidHeightVector()); int rotation=currentCameraFollowUnit->getRotation(); getGameCameraPtr()->stop(); diff --git a/source/glest_game/game/script_manager.cpp b/source/glest_game/game/script_manager.cpp index b7cfa11f..558dfe2c 100644 --- a/source/glest_game/game/script_manager.cpp +++ b/source/glest_game/game/script_manager.cpp @@ -1033,7 +1033,7 @@ void ScriptManager::shakeCamera(int shakeIntensity, int shakeDuration, bool came if (cameraDistanceAffected) { Unit *unit = world->findUnitById(unitId); - gameCamera->shake(shakeDuration, shakeIntensity,cameraDistanceAffected, unit->getCurrVector()); + gameCamera->shake(shakeDuration, shakeIntensity,cameraDistanceAffected, unit->getCurrMidHeightVector()); } else { gameCamera->shake(shakeDuration, shakeIntensity,cameraDistanceAffected, Vec3f(0.f,0.f,0.f)); } diff --git a/source/glest_game/graphics/renderer.cpp b/source/glest_game/graphics/renderer.cpp index 555a2fa6..80c55ad2 100644 --- a/source/glest_game/graphics/renderer.cpp +++ b/source/glest_game/graphics/renderer.cpp @@ -1061,11 +1061,11 @@ void Renderer::setupLighting() { Unit *unit = qCache.visibleQuadUnitList[visibleUnitIndex]; if(world->toRenderUnit(unit) && - unit->getCurrVector().dist(gameCamera->getPos()) < maxLightDist && + unit->getCurrMidHeightVector().dist(gameCamera->getPos()) < maxLightDist && unit->getType()->getLight() && unit->isOperative()) { //printf("$$$ Show light for faction: %s # %d / %d for Unit [%d - %s]\n",world->getFaction(i)->getType()->getName().c_str(),lightCount,maxLights,unit->getId(),unit->getFullName().c_str()); - Vec4f pos= Vec4f(unit->getCurrVector()); + Vec4f pos= Vec4f(unit->getCurrMidHeightVector()); pos.y+=4.f; GLenum lightEnum= GL_LIGHT0 + lightCount; @@ -6976,7 +6976,7 @@ void Renderer::selectUsingFrustumSelection(Selection::UnitContainer &units, visibleUnitIndex < (int)qCache.visibleQuadUnitList.size(); ++visibleUnitIndex) { Unit *unit = qCache.visibleQuadUnitList[visibleUnitIndex]; if(unit != NULL && unit->isAlive()) { - Vec3f unitPos = unit->getCurrVector(); + Vec3f unitPos = unit->getCurrMidHeightVector(); bool insideQuad = CubeInFrustum(quadSelectionCacheItem.frustumData, unitPos.x, unitPos.y, unitPos.z, unit->getType()->getRenderSize()); if(insideQuad == true) { @@ -9028,7 +9028,7 @@ VisibleQuadContainerCache & Renderer::getQuadCache( bool updateOnDirtyFrame, bool unitCheckedForRender = false; if(VisibleQuadContainerCache::enableFrustumCalcs == true) { //bool insideQuad = PointInFrustum(quadCache.frustumData, unit->getCurrVector().x, unit->getCurrVector().y, unit->getCurrVector().z ); - bool insideQuad = CubeInFrustum(quadCache.frustumData, unit->getCurrVector().x, unit->getCurrVector().y, unit->getCurrVector().z, unit->getType()->getRenderSize()); + bool insideQuad = CubeInFrustum(quadCache.frustumData, unit->getCurrMidHeightVector().x, unit->getCurrMidHeightVector().y, unit->getCurrMidHeightVector().z, unit->getType()->getRenderSize()); bool renderInMap = world->toRenderUnit(unit); if(insideQuad == false || renderInMap == false) { unit->setVisible(false); diff --git a/source/glest_game/gui/gui.cpp b/source/glest_game/gui/gui.cpp index a3bbb969..e201f498 100644 --- a/source/glest_game/gui/gui.cpp +++ b/source/glest_game/gui/gui.cpp @@ -314,7 +314,7 @@ void Gui::mouseUpLeftGraphics(int x, int y) { if(selection.isCommandable() && random.randRange(0, 1)==0){ SoundRenderer::getInstance().playFx( selection.getFrontUnit()->getType()->getSelectionSound(), - selection.getFrontUnit()->getCurrVector(), + selection.getFrontUnit()->getCurrMidHeightVector(), gameCamera->getPos()); } selectionQuad.disable(); @@ -488,7 +488,7 @@ void Gui::giveDefaultOrders(int x, int y,const Unit *targetUnit, bool paintMouse if(random.randRange(0, 1)==0){ SoundRenderer::getInstance().playFx( selection.getFrontUnit()->getType()->getCommandSound(), - selection.getFrontUnit()->getCurrVector(), + selection.getFrontUnit()->getCurrMidHeightVector(), gameCamera->getPos()); } } @@ -543,7 +543,7 @@ void Gui::giveTwoClickOrders(int x, int y , bool prepared) { if(random.randRange(0, 1) == 0) { SoundRenderer::getInstance().playFx( selection.getFrontUnit()->getType()->getCommandSound(), - selection.getFrontUnit()->getCurrVector(), + selection.getFrontUnit()->getCurrMidHeightVector(), gameCamera->getPos()); } } diff --git a/source/glest_game/gui/selection.cpp b/source/glest_game/gui/selection.cpp index 57a0129e..c44f3483 100644 --- a/source/glest_game/gui/selection.cpp +++ b/source/glest_game/gui/selection.cpp @@ -204,7 +204,7 @@ bool Selection::isMeetable() const{ } Vec3f Selection::getRefPos() const{ - return getFrontUnit()->getCurrVector(); + return getFrontUnit()->getCurrMidHeightVector(); } bool Selection::hasUnit(const Unit* unit) const { diff --git a/source/glest_game/type_instances/unit.cpp b/source/glest_game/type_instances/unit.cpp index 19e96717..6e614e1c 100644 --- a/source/glest_game/type_instances/unit.cpp +++ b/source/glest_game/type_instances/unit.cpp @@ -334,7 +334,7 @@ void UnitAttackBoostEffect::applyLoadedAttackBoostParticles(UnitParticleSystemTy ups->setParticleType(upst); upst->setValues(ups); - ups->setPos(unit->getCurrVector()); + ups->setPos(unit->getCurrMidHeightVector()); ups->setRotation(unit->getRotation()); ups->setUnitModel(unit->getCurrentModelPtr()); if (unit->getFaction()->getTexture()) { @@ -1600,7 +1600,7 @@ bool Unit::checkModelStateInfoForNewHpValue() { return result; } -Vec3f Unit::getCurrVector() const{ +Vec3f Unit::getCurrMidHeightVector() const{ if(type == NULL) { char szBuf[8096]=""; snprintf(szBuf,8096,"In [%s::%s Line: %d] ERROR: type == NULL, Unit = [%s]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,this->toString().c_str()); @@ -2441,7 +2441,7 @@ void Unit::updateAttackBoostProgress(const Game* game) { currentAttackBoostOriginatorEffect.currentAppliedEffect->upst->setValues( currentAttackBoostOriginatorEffect.currentAppliedEffect->ups); currentAttackBoostOriginatorEffect.currentAppliedEffect->ups->setPos( - getCurrVector()); + getCurrMidHeightVector()); currentAttackBoostOriginatorEffect.currentAppliedEffect->ups->setRotation(getRotation()); currentAttackBoostOriginatorEffect.currentAppliedEffect->ups->setUnitModel(getCurrentModelPtr()); @@ -2554,7 +2554,7 @@ void Unit::updateAttackBoostProgress(const Game* game) { currentAttackBoostOriginatorEffect.currentAppliedEffect->upst->setValues( currentAttackBoostOriginatorEffect.currentAppliedEffect->ups); currentAttackBoostOriginatorEffect.currentAppliedEffect->ups->setPos( - getCurrVector()); + getCurrMidHeightVector()); currentAttackBoostOriginatorEffect.currentAppliedEffect->ups->setRotation(getRotation()); currentAttackBoostOriginatorEffect.currentAppliedEffect->ups->setUnitModel(getCurrentModelPtr()); @@ -2730,18 +2730,18 @@ bool Unit::update() { } if (this->fire != NULL) { - this->fire->setPos(getCurrVector()); + this->fire->setPos(getCurrMidHeightVector()); } for(UnitParticleSystems::iterator it= unitParticleSystems.begin(); it != unitParticleSystems.end(); ++it) { if(Renderer::getInstance().validateParticleSystemStillExists((*it),rsGame) == true) { - (*it)->setPos(getCurrVector()); + (*it)->setPos(getCurrMidHeightVector()); (*it)->setRotation(getRotation()); (*it)->setUnitModel(getCurrentModelPtr()); } } for(UnitParticleSystems::iterator it= damageParticleSystems.begin(); it != damageParticleSystems.end(); ++it) { if(Renderer::getInstance().validateParticleSystemStillExists((*it),rsGame) == true) { - (*it)->setPos(getCurrVector()); + (*it)->setPos(getCurrMidHeightVector()); (*it)->setRotation(getRotation()); (*it)->setUnitModel(getCurrentModelPtr()); } @@ -2749,7 +2749,7 @@ bool Unit::update() { for(UnitParticleSystems::iterator it= smokeParticleSystems.begin(); it != smokeParticleSystems.end(); ++it) { if(Renderer::getInstance().validateParticleSystemStillExists((*it),rsGame) == true) { - (*it)->setPos(getCurrVector()); + (*it)->setPos(getCurrMidHeightVector()); (*it)->setRotation(getRotation()); (*it)->setUnitModel(getCurrentModelPtr()); } @@ -2761,7 +2761,7 @@ bool Unit::update() { if(effect != NULL && effect->ups != NULL) { bool particleValid = Renderer::getInstance().validateParticleSystemStillExists(effect->ups,rsGame); if(particleValid == true) { - effect->ups->setPos(getCurrVector()); + effect->ups->setPos(getCurrMidHeightVector()); effect->ups->setRotation(getRotation()); effect->ups->setUnitModel(getCurrentModelPtr()); } @@ -2776,7 +2776,7 @@ bool Unit::update() { if(currentAttackBoostOriginatorEffect.currentAppliedEffect->ups != NULL) { bool particleValid = Renderer::getInstance().validateParticleSystemStillExists(currentAttackBoostOriginatorEffect.currentAppliedEffect->ups,rsGame); if(particleValid == true) { - currentAttackBoostOriginatorEffect.currentAppliedEffect->ups->setPos(getCurrVector()); + currentAttackBoostOriginatorEffect.currentAppliedEffect->ups->setPos(getCurrMidHeightVector()); currentAttackBoostOriginatorEffect.currentAppliedEffect->ups->setRotation(getRotation()); currentAttackBoostOriginatorEffect.currentAppliedEffect->ups->setUnitModel(getCurrentModelPtr()); } @@ -2833,7 +2833,7 @@ void Unit::updateTimedParticles() { ups->setParticleType(pst); pst->setValues(ups); - ups->setPos(getCurrVector()); + ups->setPos(getCurrMidHeightVector()); ups->setRotation(getRotation()); ups->setUnitModel(getCurrentModelPtr()); @@ -2976,7 +2976,7 @@ bool Unit::applyAttackBoost(const AttackBoost *boost, const Unit *source) { effect->ups->setParticleType(effect->upst); effect->upst->setValues(effect->ups); - effect->ups->setPos(getCurrVector()); + effect->ups->setPos(getCurrMidHeightVector()); effect->ups->setRotation(getRotation()); effect->ups->setUnitModel(getCurrentModelPtr()); if(getFaction()->getTexture()) { @@ -4120,7 +4120,7 @@ void Unit::checkCustomizedUnitParticleListTriggers(vector & ups->setParticleType(pst); pst->setValues(ups); - ups->setPos(getCurrVector()); + ups->setPos(getCurrMidHeightVector()); ups->setRotation(getRotation()); ups->setUnitModel(getCurrentModelPtr()); if(getFaction()->getTexture()) { @@ -4237,7 +4237,7 @@ void Unit::checkCustomizedParticleTriggers(bool force) { ups->setParticleType(pst); pst->setValues(ups); - ups->setPos(getCurrVector()); + ups->setPos(getCurrMidHeightVector()); ups->setRotation(getRotation()); ups->setUnitModel(getCurrentModelPtr()); if(getFaction()->getTexture()) { @@ -4268,7 +4268,7 @@ void Unit::startDamageParticles() { ups->setParticleType(pst); pst->setValues(ups); - ups->setPos(getCurrVector()); + ups->setPos(getCurrMidHeightVector()); ups->setRotation(getRotation()); ups->setUnitModel(getCurrentModelPtr()); if(getFaction()->getTexture()) { diff --git a/source/glest_game/type_instances/unit.h b/source/glest_game/type_instances/unit.h index c8742a70..e126675c 100644 --- a/source/glest_game/type_instances/unit.h +++ b/source/glest_game/type_instances/unit.h @@ -637,7 +637,7 @@ public: //render related const Model *getCurrentModel(); Model *getCurrentModelPtr(); - Vec3f getCurrVector() const; + Vec3f getCurrMidHeightVector() const; Vec3f getCurrVectorAsTarget() const; Vec3f getCurrBurnVector() const; Vec3f getCurrVectorFlat() const; diff --git a/source/glest_game/world/unit_updater.cpp b/source/glest_game/world/unit_updater.cpp index 1b9b24a0..d869ec3d 100644 --- a/source/glest_game/world/unit_updater.cpp +++ b/source/glest_game/world/unit_updater.cpp @@ -134,7 +134,7 @@ bool UnitUpdater::updateUnit(Unit *unit) { if(soundStartTime >= unit->getLastAnimProgressAsFloat() && soundStartTime < unit->getAnimProgressAsFloat()) { if(map->getSurfaceCell(Map::toSurfCoords(unit->getPos()))->isVisible(world->getThisTeamIndex()) || (game->getWorld()->showWorldForPlayer(game->getWorld()->getThisTeamIndex()) == true)) { - soundRenderer.playFx((*it)->getSoundContainer()->getRandSound(), unit->getCurrVector(), gameCamera->getPos()); + soundRenderer.playFx((*it)->getSoundContainer()->getRandSound(), unit->getCurrMidHeightVector(), gameCamera->getPos()); } } } @@ -171,7 +171,7 @@ bool UnitUpdater::updateUnit(Unit *unit) { bool cameraAffected=(!cameraViewAffected) || unit->getVisible(); if(visibility && cameraAffected && enabled) { - game->getGameCameraPtr()->shake( currSkill->getShakeDuration(), currSkill->getShakeIntensity(),cameraDistanceAffected,unit->getCurrVector()); + game->getGameCameraPtr()->shake( currSkill->getShakeDuration(), currSkill->getShakeIntensity(),cameraDistanceAffected,unit->getCurrMidHeightVector()); } } } @@ -291,7 +291,7 @@ bool UnitUpdater::updateUnit(Unit *unit) { if(Config::getInstance().getBool("DisableWaterSounds","false") == false) { soundRenderer.playFx( CoreData::getInstance().getWaterSound(), - unit->getCurrVector(), + unit->getCurrMidHeightVector(), gameCamera->getPos() ); @@ -1123,7 +1123,7 @@ void UnitUpdater::updateBuild(Unit *unit, int frameIndex) { (game->getWorld()->showWorldForPlayer(game->getWorld()->getThisTeamIndex()) == true)) { SoundRenderer::getInstance().playFx( bct->getStartSound(), - unit->getCurrVector(), + unit->getCurrMidHeightVector(), gameCamera->getPos()); } @@ -1215,7 +1215,7 @@ void UnitUpdater::updateBuild(Unit *unit, int frameIndex) { (game->getWorld()->showWorldForPlayer(game->getWorld()->getThisTeamIndex()) == true)) { SoundRenderer::getInstance().playFx( bct->getBuiltSound(), - unit->getCurrVector(), + unit->getCurrMidHeightVector(), gameCamera->getPos()); } } @@ -2665,7 +2665,7 @@ void UnitUpdater::startAttackParticleSystem(Unit *unit, float lastAnimProgress, ParticleSystemTypeSplash *pstSplash= ast->getSplashParticleType(); bool hasProjectile = !ast->projectileTypes.empty(); - Vec3f startPos= unit->getCurrVector(); + Vec3f startPos= unit->getCurrMidHeightVector(); Vec3f endPos= unit->getTargetVec(); //make particle system @@ -3311,7 +3311,7 @@ void ParticleDamager::update(ParticleSystem *particleSystem) { projSound= ast->getProjSound(); } if(particleSystem->getVisible() && projSound != NULL) { - SoundRenderer::getInstance().playFx(projSound, attacker->getCurrVector(), gameCamera->getPos()); + SoundRenderer::getInstance().playFx(projSound, attacker->getCurrMidHeightVector(), gameCamera->getPos()); } //check for spawnattack