diff --git a/Adventures in Lestoria/Monster.cpp b/Adventures in Lestoria/Monster.cpp index 9e217b01..0177b5a1 100644 --- a/Adventures in Lestoria/Monster.cpp +++ b/Adventures in Lestoria/Monster.cpp @@ -75,6 +75,7 @@ Monster::Monster(vf2d pos,MonsterData data,bool upperLevel,bool bossMob): stats.A("Move Spd %")=data.GetMoveSpdMult(); randomFrameOffset=(util::random()%1000)/1000.f; monsterWalkSoundTimer=util::random(1.f); + UpdateFacingDirection(game->GetPlayer()->GetPos()); } const vf2d&Monster::GetPos()const{ return pos; @@ -383,9 +384,9 @@ void Monster::UpdateFacingDirection(vf2d facingTargetPoint){ if(HasMountedMonster())mounted_animation.value().ModifyDisplaySprite(internal_mounted_animState.value(),std::format("{}_{}",mounted_animation.value().currentStateName.substr(0,mounted_animation.value().currentStateName.length()-2),int(facingDirection))); }else{ if(diff.x>0){ - facingDirection=Direction::EAST; - }else{ facingDirection=Direction::WEST; + }else{ + facingDirection=Direction::EAST; } } } diff --git a/Adventures in Lestoria/Monster.h b/Adventures in Lestoria/Monster.h index ba64b368..0f3d6b3b 100644 --- a/Adventures in Lestoria/Monster.h +++ b/Adventures in Lestoria/Monster.h @@ -176,7 +176,7 @@ private: float queueShotTimer=0; float z=0; float iframe_timer=0; - Direction facingDirection=Direction::SOUTH; + Direction facingDirection=Direction::WEST; std::string strategy; State::State state=State::NORMAL; std::string overlaySprite=""; diff --git a/Adventures in Lestoria/RUN_STRATEGY.cpp b/Adventures in Lestoria/RUN_STRATEGY.cpp index 32332584..6d09bbfd 100644 --- a/Adventures in Lestoria/RUN_STRATEGY.cpp +++ b/Adventures in Lestoria/RUN_STRATEGY.cpp @@ -67,8 +67,12 @@ int Monster::STRATEGY::_GetInt(Monster&m,std::string param,std::string strategy, }else if(!m.IsNPC()&&DATA["Monsters"][m.name].HasProperty(param)){ return DATA["Monsters"][m.name].GetProperty(param).GetInt(index); - } else { + }else + if(DATA["MonsterStrategy"][strategy].HasProperty(param)){ return DATA["MonsterStrategy"][strategy].GetProperty(param).GetInt(index); + }else{ + ERR(std::format("Monster {} trying to read non-existent Integer Property {}[{}] for Strategy {}. THIS SHOULD NOT BE HAPPENING!",m.GetName(),param,index,strategy)); + return{}; } } float Monster::STRATEGY::_GetFloat(Monster&m,std::string param,std::string strategy,int index){ @@ -77,8 +81,12 @@ float Monster::STRATEGY::_GetFloat(Monster&m,std::string param,std::string strat }else if(!m.IsNPC()&&DATA["Monsters"][m.name].HasProperty(param)){ return float(DATA["Monsters"][m.name].GetProperty(param).GetReal(index)); - } else { + }else + if(DATA["MonsterStrategy"][strategy].HasProperty(param)){ return float(DATA["MonsterStrategy"][strategy].GetProperty(param).GetReal(index)); + }else{ + ERR(std::format("Monster {} trying to read non-existent Float Property {}[{}] for Strategy {}. THIS SHOULD NOT BE HAPPENING!",m.GetName(),param,index,strategy)) + return{}; } } const std::string&Monster::STRATEGY::_GetString(Monster&m,std::string param,std::string strategy,int index){ @@ -87,8 +95,12 @@ const std::string&Monster::STRATEGY::_GetString(Monster&m,std::string param,std: }else if(!m.IsNPC()&&DATA["Monsters"][m.name].HasProperty(param)){ return DATA["Monsters"][m.name].GetProperty(param).GetString(index); - } else { + }else + if(DATA["MonsterStrategy"][strategy].HasProperty(param)){ return DATA["MonsterStrategy"][strategy].GetProperty(param).GetString(index); + }else{ + ERR(std::format("Monster {} trying to read non-existent String Property {}[{}] for Strategy {}. THIS SHOULD NOT BE HAPPENING!",m.GetName(),param,index,strategy)) + return{}; } } vf2d Monster::STRATEGY::_GetVec(Monster&m,std::string param,std::string strategy,int index){ @@ -97,8 +109,12 @@ vf2d Monster::STRATEGY::_GetVec(Monster&m,std::string param,std::string strategy }else if(!m.IsNPC()&&DATA["Monsters"][m.name].HasProperty(param)){ return {DATA["Monsters"][m.name].GetProperty(param).GetReal(index),DATA["Monsters"][m.name].GetProperty(param).GetReal(index+1)}; - } else { + }else + if(DATA["MonsterStrategy"][strategy].HasProperty(param)){ return {DATA["MonsterStrategy"][strategy].GetProperty(param).GetReal(index),DATA["MonsterStrategy"][strategy].GetProperty(param).GetReal(index+1)}; + }else{ + ERR(std::format("Monster {} trying to read non-existent Vf2d Property {}[{}] for Strategy {}. THIS SHOULD NOT BE HAPPENING!",m.GetName(),param,index,strategy)) + return{}; } } const datafile&Monster::STRATEGY::_Get(Monster&m,std::string param,std::string strategy){ @@ -107,8 +123,12 @@ const datafile&Monster::STRATEGY::_Get(Monster&m,std::string param,std::string s }else if(!m.IsNPC()&&DATA["Monsters"][m.name].HasProperty(param)){ return DATA["Monsters"][m.name].GetProperty(param); - } else { + }else + if(DATA["MonsterStrategy"][strategy].HasProperty(param)){ return DATA["MonsterStrategy"][strategy].GetProperty(param); + }else{ + ERR(std::format("Monster {} trying to read non-existent Data Property {} for Strategy {}",m.GetName(),param,strategy)); + return{}; } } Pixel Monster::STRATEGY::_GetPixel(Monster&m,std::string param,std::string strategy,int index){ @@ -117,8 +137,12 @@ Pixel Monster::STRATEGY::_GetPixel(Monster&m,std::string param,std::string strat }else if(!m.IsNPC()&&DATA["Monsters"][m.name].HasProperty(param)){ return DATA["Monsters"][m.name].GetProperty(param).GetPixel(index); - } else { + }else + if(DATA["MonsterStrategy"][strategy].HasProperty(param)){ return DATA["MonsterStrategy"][strategy].GetProperty(param).GetPixel(index); + }else{ + ERR(std::format("Monster {} trying to read non-existent Pixel Property {}[{}] for Strategy {}. THIS SHOULD NOT BE HAPPENING!",m.GetName(),param,index,strategy)) + return{}; } } @@ -128,8 +152,12 @@ double Monster::STRATEGY::_GetPixels(Monster&m,std::string param,std::string str }else if(!m.IsNPC()&&DATA["Monsters"][m.name].HasProperty(param)){ return DATA["Monsters"][m.name].GetProperty(param).GetReal(index)/100.f*24; - } else { + }else + if(DATA["MonsterStrategy"][strategy].HasProperty(param)){ return DATA["MonsterStrategy"][strategy].GetProperty(param).GetReal(index)/100.f*24; + }else{ + ERR(std::format("Monster {} trying to read non-existent Real Property {}[{}] (for pixel conversion) for Strategy {}. THIS SHOULD NOT BE HAPPENING!",m.GetName(),param,index,strategy)) + return{}; } } diff --git a/Adventures in Lestoria/Turret.cpp b/Adventures in Lestoria/Turret.cpp index 7916915c..8fe7e4da 100644 --- a/Adventures in Lestoria/Turret.cpp +++ b/Adventures in Lestoria/Turret.cpp @@ -69,7 +69,7 @@ void Monster::STRATEGY::TURRET(Monster&m,float fElapsedTime,std::string strategy if(m.attackCooldownTimer==0){ m.attackCooldownTimer=ConfigFloat("ShootingSpeed"); m.queueShotTimer=std::min(m.attackCooldownTimer-0.001f,0.3f); - m.F(A::SHOOT_ANIMATION_TIME)=ConfigIntArr("ShootAnimation",0)*ConfigFloatArr("ShootAnimation",1); + m.F(A::SHOOT_ANIMATION_TIME)=m.GetCurrentAnimation().GetTotalAnimationDuration(); m.PerformShootAnimation(); } } diff --git a/Adventures in Lestoria/Version.h b/Adventures in Lestoria/Version.h index da6ac40c..d3e55391 100644 --- a/Adventures in Lestoria/Version.h +++ b/Adventures in Lestoria/Version.h @@ -39,7 +39,7 @@ All rights reserved. #define VERSION_MAJOR 1 #define VERSION_MINOR 2 #define VERSION_PATCH 0 -#define VERSION_BUILD 9200 +#define VERSION_BUILD 9207 #define stringify(a) stringify_(a) #define stringify_(a) #a diff --git a/Adventures in Lestoria/assets/Campaigns/2_1.tmx b/Adventures in Lestoria/assets/Campaigns/2_1.tmx index a38be711..4e0109ef 100644 --- a/Adventures in Lestoria/assets/Campaigns/2_1.tmx +++ b/Adventures in Lestoria/assets/Campaigns/2_1.tmx @@ -1,5 +1,5 @@ - + @@ -1887,5 +1887,10 @@ + + + + + diff --git a/Adventures in Lestoria/assets/config/Monsters.txt b/Adventures in Lestoria/assets/config/Monsters.txt index 97dcfb99..7f8b2671 100644 --- a/Adventures in Lestoria/assets/config/Monsters.txt +++ b/Adventures in Lestoria/assets/config/Monsters.txt @@ -197,7 +197,7 @@ Monsters # The First Four animations must represent a standing, walking, attack, and death animation. Their names are up to the creator. IDLE = 7, 0.1, PingPong JUMP = 1, 0.1, OneShot - SHOOT = 5, 0.1, Repeat + SHOOT = 5, 0.1, OneShot DEATH = 5, 0.2, OneShot } diff --git a/x64/Release/Adventures in Lestoria.exe b/x64/Release/Adventures in Lestoria.exe index 5f2314eb..aa506a9a 100644 Binary files a/x64/Release/Adventures in Lestoria.exe and b/x64/Release/Adventures in Lestoria.exe differ