mirror of
https://github.com/glest/glest-source.git
synced 2025-08-11 10:54:01 +02:00
- corrected multiple model processing based on hp
- fixed cmake scripts (thanks Andrew Clarke) - fixed streflop files to ignore softfloats if not used during build
This commit is contained in:
@@ -137,10 +137,9 @@ IF(BUILD_MEGAGLEST_CONFIGURATOR)
|
||||
|
||||
TARGET_LINK_LIBRARIES(${TARGET_NAME} ${EXTERNAL_LIBS})
|
||||
#MESSAGE(STATUS "EXTERNAL_LIBS = [${EXTERNAL_LIBS}]")
|
||||
ENDIF()
|
||||
|
||||
# Requires an install prefix for the items below to work
|
||||
IF(NOT CMAKE_INSTALL_PREFIX STREQUAL "")
|
||||
# Requires an install prefix for the items below to work
|
||||
IF(NOT CMAKE_INSTALL_PREFIX STREQUAL "")
|
||||
# Installation of the program
|
||||
INSTALL(TARGETS
|
||||
${TARGET_NAME}
|
||||
@@ -159,4 +158,5 @@ IF(NOT CMAKE_INSTALL_PREFIX STREQUAL "")
|
||||
# "${PROJECT_SOURCE_DIR}/mk/linux/glest.ico"
|
||||
# DESTINATION ${MEGAGLEST_ICON_INSTALL_PATH})
|
||||
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
@@ -165,10 +165,9 @@ IF(BUILD_MEGAGLEST_MODEL_VIEWER)
|
||||
DEPENDS ${TARGET_NAME})
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
# Requires an install prefix for the items below to work
|
||||
IF(NOT CMAKE_INSTALL_PREFIX STREQUAL "")
|
||||
# Requires an install prefix for the items below to work
|
||||
IF(NOT CMAKE_INSTALL_PREFIX STREQUAL "")
|
||||
# Installation of the program
|
||||
INSTALL(TARGETS
|
||||
${TARGET_NAME}
|
||||
@@ -205,4 +204,5 @@ IF(NOT CMAKE_INSTALL_PREFIX STREQUAL "")
|
||||
# "${PROJECT_SOURCE_DIR}/data/glest_game/g3dviewer.ico"
|
||||
# DESTINATION ${MEGAGLEST_ICON_INSTALL_PATH})
|
||||
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
@@ -234,10 +234,9 @@ IF(BUILD_MEGAGLEST)
|
||||
DEPENDS ${TARGET_NAME})
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
# Requires an install prefix for the items below to work
|
||||
IF(NOT CMAKE_INSTALL_PREFIX STREQUAL "")
|
||||
# Requires an install prefix for the items below to work
|
||||
IF(NOT CMAKE_INSTALL_PREFIX STREQUAL "")
|
||||
#IF(NOT WIN32)
|
||||
#set_target_properties(megaglest.bin PROPERTIES OUTPUT_NAME "megaglest")
|
||||
# rename the binary for installation
|
||||
@@ -301,4 +300,5 @@ IF(NOT CMAKE_INSTALL_PREFIX STREQUAL "")
|
||||
"${PROJECT_SOURCE_DIR}/g3dviewer.ico"
|
||||
DESTINATION ${MEGAGLEST_ICON_INSTALL_PATH})
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
@@ -1112,6 +1112,9 @@ Model *Unit::getCurrentModelPtr() {
|
||||
Model *result = currSkill->getAnimation(animProgress,this,&lastModelIndexForCurrSkillType, &animationRandomCycleCount);
|
||||
if(currentModelIndexForCurrSkillType != lastModelIndexForCurrSkillType) {
|
||||
animationRandomCycleCount++;
|
||||
if(currSkill != NULL && animationRandomCycleCount >= currSkill->getAnimationCount()) {
|
||||
animationRandomCycleCount = 0;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -1127,7 +1130,35 @@ const Model *Unit::getCurrentModel() {
|
||||
const Model *result = currSkill->getAnimation(animProgress,this,&lastModelIndexForCurrSkillType, &animationRandomCycleCount);
|
||||
if(currentModelIndexForCurrSkillType != lastModelIndexForCurrSkillType) {
|
||||
animationRandomCycleCount++;
|
||||
if(currSkill != NULL && animationRandomCycleCount >= currSkill->getAnimationCount()) {
|
||||
animationRandomCycleCount = 0;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
bool Unit::checkModelStateInfoForNewHpValue() {
|
||||
bool result = false;
|
||||
if(currSkill != NULL && currSkill->getAnimationCount() > 1) {
|
||||
if(lastModelIndexForCurrSkillType >= 0) {
|
||||
const AnimationAttributes attributes = currSkill->getAnimationAttribute(lastModelIndexForCurrSkillType);
|
||||
if(attributes.fromHp != 0 || attributes.toHp != 0) {
|
||||
//printf("Check for RESET model state for [%d - %s] HP = %d [%d to %d]\n",this->id,this->getType()->getName().c_str(),this->getHp(),attributes.fromHp,attributes.toHp);
|
||||
//if(this->getHp() >= attributes.fromHp && this->getHp() <= attributes.toHp) {
|
||||
if(this->getHp() < attributes.fromHp || this->getHp() > attributes.toHp) {
|
||||
//printf("RESET model state for [%d - %s] HP = %d [%d to %d]\n",this->id,this->getType()->getName().c_str(),this->getHp(),attributes.fromHp,attributes.toHp);
|
||||
|
||||
lastModelIndexForCurrSkillType = -1;
|
||||
animationRandomCycleCount = 0;
|
||||
bool result = true;
|
||||
}
|
||||
}
|
||||
else {
|
||||
//printf("Check for RESET #2 model state for [%d - %s] HP = %d [%d to %d] for skill [%s]\n",this->id,this->getType()->getName().c_str(),this->getHp(),attributes.fromHp,attributes.toHp,currSkill->getName().c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -2075,6 +2106,8 @@ bool Unit::applyAttackBoost(const AttackBoost *boost, const Unit *source) {
|
||||
//printf("AFTER Apply Hp Regen max = %d, prev = %d, hp = %d\n",totalUpgrade.getMaxHpRegeneration(),prevMaxHpRegen,hp);
|
||||
}
|
||||
|
||||
checkModelStateInfoForNewHpValue();
|
||||
|
||||
if(originalHp < hp) {
|
||||
this->setLastAttackerUnitId(source->getId());
|
||||
}
|
||||
@@ -2106,6 +2139,7 @@ bool Unit::applyAttackBoost(const AttackBoost *boost, const Unit *source) {
|
||||
alive= false;
|
||||
hp=0;
|
||||
addItemToVault(&this->hp,this->hp);
|
||||
checkModelStateInfoForNewHpValue();
|
||||
|
||||
stopDamageParticles(true);
|
||||
|
||||
@@ -2183,6 +2217,8 @@ void Unit::deapplyAttackBoost(const AttackBoost *boost, const Unit *source) {
|
||||
hp=0;
|
||||
addItemToVault(&this->hp,this->hp);
|
||||
|
||||
checkModelStateInfoForNewHpValue();
|
||||
|
||||
stopDamageParticles(true);
|
||||
|
||||
this->setLastAttackerUnitId(source->getId());
|
||||
@@ -2204,6 +2240,8 @@ void Unit::deapplyAttackBoost(const AttackBoost *boost, const Unit *source) {
|
||||
}
|
||||
}
|
||||
|
||||
checkModelStateInfoForNewHpValue();
|
||||
|
||||
//printf("DE-APPLYING ATTACK BOOST BEFORE END to unit [%s - %d] from unit [%s - %d]\n",this->getType()->getName().c_str(),this->getId(),source->getType()->getName().c_str(),source->getId());
|
||||
|
||||
for(unsigned int i = 0; i < currentAttackBoostEffects.size(); ++i) {
|
||||
@@ -2241,6 +2279,7 @@ void Unit::tick() {
|
||||
}
|
||||
addItemToVault(&this->hp,this->hp);
|
||||
|
||||
checkModelStateInfoForNewHpValue();
|
||||
//if(this->getType()->getName() == "spearman") printf("tick hp#2 [type->getTotalMaxHpRegeneration(&totalUpgrade)] = %d type->getTotalMaxHp(&totalUpgrade) [%d] newhp = %d\n",type->getTotalMaxHpRegeneration(&totalUpgrade),type->getTotalMaxHp(&totalUpgrade),hp);
|
||||
}
|
||||
// If we have negative regeneration then check if the unit should die
|
||||
@@ -2272,6 +2311,8 @@ void Unit::tick() {
|
||||
hp = type->getTotalMaxHp(&totalUpgrade);
|
||||
}
|
||||
addItemToVault(&this->hp,this->hp);
|
||||
|
||||
checkModelStateInfoForNewHpValue();
|
||||
//if(this->getType()->getName() == "spearman") printf("tick hp#1 [type->getHpRegeneration()] = %d type->getTotalMaxHp(&totalUpgrade) [%d] newhp = %d\n",type->getHpRegeneration(),type->getTotalMaxHp(&totalUpgrade),hp);
|
||||
}
|
||||
}
|
||||
@@ -2407,6 +2448,8 @@ bool Unit::repair(){
|
||||
}
|
||||
addItemToVault(&this->hp,this->hp);
|
||||
|
||||
checkModelStateInfoForNewHpValue();
|
||||
|
||||
//stop DamageParticles
|
||||
stopDamageParticles(false);
|
||||
|
||||
@@ -2423,6 +2466,8 @@ bool Unit::decHp(int i) {
|
||||
hp -= i;
|
||||
addItemToVault(&this->hp,this->hp);
|
||||
|
||||
checkModelStateInfoForNewHpValue();
|
||||
|
||||
if(type == NULL) {
|
||||
char szBuf[4096]="";
|
||||
sprintf(szBuf,"In [%s::%s Line: %d] ERROR: type == NULL, Unit = [%s]\n",__FILE__,__FUNCTION__,__LINE__,this->toString().c_str());
|
||||
@@ -2438,6 +2483,8 @@ bool Unit::decHp(int i) {
|
||||
hp=0;
|
||||
addItemToVault(&this->hp,this->hp);
|
||||
|
||||
checkModelStateInfoForNewHpValue();
|
||||
|
||||
stopDamageParticles(true);
|
||||
return true;
|
||||
}
|
||||
@@ -2574,6 +2621,8 @@ void Unit::applyUpgrade(const UpgradeType *upgradeType){
|
||||
hp += upgradeType->getMaxHp();
|
||||
hp = max(0,hp);
|
||||
addItemToVault(&this->hp,this->hp);
|
||||
|
||||
checkModelStateInfoForNewHpValue();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2596,6 +2645,8 @@ void Unit::incKills(int team) {
|
||||
checkItemInVault(&this->hp,this->hp);
|
||||
hp += totalUpgrade.getMaxHp() - maxHp;
|
||||
addItemToVault(&this->hp,this->hp);
|
||||
|
||||
checkModelStateInfoForNewHpValue();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2626,6 +2677,8 @@ bool Unit::morph(const MorphCommandType *mct){
|
||||
hp += morphUnitType->getMaxHp() - type->getMaxHp();
|
||||
addItemToVault(&this->hp,this->hp);
|
||||
|
||||
checkModelStateInfoForNewHpValue();
|
||||
|
||||
type= morphUnitType;
|
||||
level= NULL;
|
||||
currField=morphUnitField;
|
||||
|
@@ -658,6 +658,7 @@ private:
|
||||
|
||||
int getFrameCount() const;
|
||||
void checkCustomizedParticleTriggers(bool force);
|
||||
bool checkModelStateInfoForNewHpValue();
|
||||
};
|
||||
|
||||
}}// end namespace
|
||||
|
@@ -486,11 +486,16 @@ bool SkillType::CanCycleNextRandomAnimation(const int *animationRandomCycleCount
|
||||
return result;
|
||||
}
|
||||
|
||||
const AnimationAttributes SkillType::getAnimationAttribute(int index) const {
|
||||
return animationAttributes[index];
|
||||
}
|
||||
|
||||
Model *SkillType::getAnimation(float animProgress, const Unit *unit,
|
||||
int *lastAnimationIndex, int *animationRandomCycleCount) const {
|
||||
int modelIndex = 0;
|
||||
//printf("Count [%d] animProgress = [%f] for skill [%s] animationRandomCycleCount = %d\n",animations.size(),animProgress,name.c_str(),*animationRandomCycleCount);
|
||||
if(animations.size() > 1) {
|
||||
//printf("animProgress = [%f] for skill [%s]\n",animProgress,name.c_str());
|
||||
//printf("animProgress = [%f] for skill [%s] animationRandomCycleCount = %d\n",animProgress,name.c_str(),*animationRandomCycleCount);
|
||||
|
||||
if(lastAnimationIndex) {
|
||||
modelIndex = *lastAnimationIndex;
|
||||
@@ -546,6 +551,9 @@ Model *SkillType::getAnimation(float animProgress, const Unit *unit,
|
||||
}
|
||||
}
|
||||
if(lastAnimationIndex) {
|
||||
if(*lastAnimationIndex != modelIndex) {
|
||||
//printf("Switching model from [%s] to [%s]\n",(*lastAnimationIndex >= 0 ? animations[*lastAnimationIndex]->getFileName().c_str() : "none"),animations[modelIndex]->getFileName().c_str());
|
||||
}
|
||||
*lastAnimationIndex = modelIndex;
|
||||
}
|
||||
|
||||
|
@@ -159,6 +159,9 @@ public:
|
||||
|
||||
static void resetNextAttackBoostId() { nextAttackBoostId=0; }
|
||||
|
||||
const AnimationAttributes getAnimationAttribute(int index) const;
|
||||
int getAnimationCount() const { return animations.size(); }
|
||||
|
||||
//get
|
||||
const string &getName() const {return name;}
|
||||
SkillClass getClass() const {return skillClass;}
|
||||
|
@@ -159,10 +159,10 @@ IF(BUILD_MEGAGLEST_MAP_EDITOR)
|
||||
DEPENDS ${TARGET_NAME})
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
# Requires an install prefix for the items below to work
|
||||
IF(NOT CMAKE_INSTALL_PREFIX STREQUAL "")
|
||||
|
||||
# Requires an install prefix for the items below to work
|
||||
IF(NOT CMAKE_INSTALL_PREFIX STREQUAL "")
|
||||
# Installation of the program
|
||||
INSTALL(TARGETS
|
||||
${TARGET_NAME}
|
||||
@@ -183,7 +183,7 @@ IF(NOT CMAKE_INSTALL_PREFIX STREQUAL "")
|
||||
DESTINATION ${MEGAGLEST_DATA_INSTALL_PATH})
|
||||
|
||||
# Installation of the program desktop file
|
||||
NSTALL(FILES
|
||||
INSTALL(FILES
|
||||
"${PROJECT_SOURCE_DIR}/megaglest_editor.desktop"
|
||||
DESTINATION ${MEGAGLEST_DESKTOP_INSTALL_PATH})
|
||||
|
||||
@@ -198,4 +198,5 @@ IF(NOT CMAKE_INSTALL_PREFIX STREQUAL "")
|
||||
# "${PROJECT_SOURCE_DIR}/data/glest_game/editor.ico"
|
||||
# DESTINATION ${MEGAGLEST_ICON_INSTALL_PATH})
|
||||
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
@@ -4,6 +4,7 @@ CHANGES:
|
||||
Inserted this file is a namespace
|
||||
Nicolas Brodu, 2006
|
||||
=============================================================================*/
|
||||
#ifdef STREFLOP_SOFT
|
||||
|
||||
namespace streflop {
|
||||
namespace SoftFloat {
|
||||
@@ -730,3 +731,4 @@ INLINE flag ne128( bits64 a0, bits64 a1, bits64 b0, bits64 b1 )
|
||||
// Close namespaces
|
||||
}
|
||||
}
|
||||
#endif
|
@@ -12,6 +12,8 @@ CHANGES:
|
||||
|
||||
Nicolas Brodu, 2006
|
||||
=============================================================================*/
|
||||
#ifdef STREFLOP_SOFT
|
||||
|
||||
#include <unistd.h>
|
||||
#include <signal.h>
|
||||
#include "../streflop.h"
|
||||
@@ -515,3 +517,4 @@ static float128 propagateFloat128NaN( float128 a, float128 b )
|
||||
// NB060506: close namespaces
|
||||
}
|
||||
}
|
||||
#endif
|
@@ -9,6 +9,8 @@ CHANGES:
|
||||
pack the fields of floatx80, just in case (should be useless)
|
||||
Nicolas Brodu, 2006
|
||||
=============================================================================*/
|
||||
#ifdef STREFLOP_SOFT
|
||||
|
||||
#ifndef SOFTFLOAT_H
|
||||
#define SOFTFLOAT_H
|
||||
|
||||
@@ -334,3 +336,4 @@ char float128_is_signaling_nan( float128 );
|
||||
#endif
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user