Fix bug with monsters not facing the player on spawn and incorrectly adjusting their directions initially with the previous facing direction not matching their starting facing direction. Fixed Issue #54 . Mounted animations can be specified for the encounter spawn labels so that their combined sprites display properly now. Release Build 9220.

This commit is contained in:
2024-05-04 18:19:47 -05:00
parent cb35d2c1fa
commit f5bfc0d34d
7 changed files with 69 additions and 25 deletions
+19
View File
@@ -160,6 +160,12 @@ void MonsterData::InitializeMonsterData(){
DATA["Monsters"][MonsterName]["CollisionDmg"].GetInt()
);
if(DATA["Monsters"][MonsterName].HasProperty("Mounted Animation"))monster.mountedAnimName=DATA["Monsters"][MonsterName]["Mounted Animation"].GetString();
if(DATA["Monsters"][MonsterName].HasProperty("Mounted Animation Offset")){
if(DATA["Monsters"][MonsterName]["Mounted Animation Offset"].GetValueCount()==2)monster.mountedAnimationOffset={DATA["Monsters"][MonsterName]["Mounted Animation Offset"].GetReal(0),DATA["Monsters"][MonsterName]["Mounted Animation Offset"].GetReal(1)};
else ERR(std::format("WARNING! Monster {} containing a mounted animation offset has {} for reading in a vector, when vectors are supposed to only have two values! Please check the \"Mounted Animation Offset\" configuration value for {}",MonsterName,DATA["Monsters"][MonsterName]["Mounted Animation Offset"].GetValueCount(),MonsterName));
}
if(hasFourWaySpriteSheet)monster.SetUsesFourWaySprites();
for(size_t animationRow=0;const std::string&animationName:animations){
@@ -380,3 +386,16 @@ const std::string MonsterData::GetDefaultShootAnimation()const{
const std::string MonsterData::GetDefaultDeathAnimation()const{
return GetDeathAnimation(Direction::SOUTH);
}
const bool MonsterData::HasMountedAnimation()const{
return mountedAnimName.has_value();
}
const std::optional<const std::string>MonsterData::GetMountedAnimation()const{
if(!HasMountedAnimation())ERR("WARNING! Trying to get a mounted animation for a monster that doesn't have a mounted animation to begin with!");
return mountedAnimName.value();
}
const vf2d&MonsterData::GetMountedAnimationOffset()const{
if(!HasMountedAnimation())ERR("WARNING! Trying to get a mounted animation offset for a monster that doesn't have a mounted animation to begin with!");
return mountedAnimationOffset;
}