diff --git a/Adventures in Lestoria/AdventuresInLestoria.cpp b/Adventures in Lestoria/AdventuresInLestoria.cpp index a0380315..6595f095 100644 --- a/Adventures in Lestoria/AdventuresInLestoria.cpp +++ b/Adventures in Lestoria/AdventuresInLestoria.cpp @@ -2452,7 +2452,9 @@ void AiL::_PrepareLevel(MapName map,MusicChange changeMusic){ vf2d spawnerRadius=vf2d{spawnData.ObjectData.GetFloat("width"),spawnData.ObjectData.GetFloat("height")}/2; for(XMLTag&monster:spawnData.monsters){ std::string monsterName=monster.GetString("value"); - monster_list.push_back({monsterName,{monster.GetInteger("x")-spawnData.ObjectData.GetFloat("x"),monster.GetInteger("y")-spawnData.ObjectData.GetFloat("y")}}); + const vi2d frameSize{ANIMATION_DATA[std::format("{}_{}",monsterName,MONSTER_DATA[monsterName].GetDefaultIdleAnimation())].GetFrame(0.f).GetSourceRect().size}; + const float monsterSizeMult{MONSTER_DATA[monsterName].GetSizeMult()}; + monster_list.emplace_back(monsterName,vf2d{monster.GetInteger("x")+(frameSize.x*monsterSizeMult/2)-spawnData.ObjectData.GetFloat("x"),monster.GetInteger("y")-(frameSize.y*monsterSizeMult/2)-spawnData.ObjectData.GetFloat("y")}); } const int spawnerId=spawnData.ObjectData.GetInteger("id"); @@ -4044,7 +4046,7 @@ void AiL::RenderFadeout(){ SetMosaicEffect(1U); GameState::_ChangeState(transitionState); }else{ - SetMosaicEffect(util::lerp(1U,mosaicEffectTransition,1-(fadeOutDuration/fadeOutTotalTime))); + SetMosaicEffect(util::lerp(uint8_t(1),mosaicEffectTransition,1-(fadeOutDuration/fadeOutTotalTime))); alpha=uint8_t(util::lerp(0,255,1-(fadeOutDuration/fadeOutTotalTime))); } }else diff --git a/Adventures in Lestoria/Bomb.cpp b/Adventures in Lestoria/Bomb.cpp index 9d18a65e..5ec70919 100644 --- a/Adventures in Lestoria/Bomb.cpp +++ b/Adventures in Lestoria/Bomb.cpp @@ -103,7 +103,7 @@ BulletDestroyState Bomb::MonsterHit(Monster&monster,const uint8_t markStacksBefo void Bomb::Draw(const Pixel blendCol)const{ Bullet::Draw(blendCol); - game->view.DrawPartialRotatedDecal(pos-vf2d{0,GetZ()},bomb_animation.GetFrame(animation).GetSourceImage()->Decal(),rotates?atan2(vel.y,vel.x)-PI/2:0,bomb_animation.GetFrame(animation).GetSourceRect().size/2,bomb_animation.GetFrame(animation).GetSourceRect().pos,bomb_animation.GetFrame(animation).GetSourceRect().size,scale,fadeOutTime==0?col:Pixel{col.r,col.g,col.b,uint8_t(util::lerp(col.a,0,1-((fadeOutTime-GetFadeoutTimer())/fadeOutTime)))}); + game->view.DrawPartialRotatedDecal(pos-vf2d{0,GetZ()},bomb_animation.GetFrame(animation).GetSourceImage()->Decal(),rotates?atan2(vel.y,vel.x)-PI/2:0,bomb_animation.GetFrame(animation).GetSourceRect().size/2,bomb_animation.GetFrame(animation).GetSourceRect().pos,bomb_animation.GetFrame(animation).GetSourceRect().size,scale,fadeOutTime==0?col:Pixel{col.r,col.g,col.b,uint8_t(util::lerp(col.a,uint8_t(0),1-((fadeOutTime-GetFadeoutTimer())/fadeOutTime)))}); } void Bomb::ModifyOutgoingDamageData(HurtDamageInfo&data){} \ No newline at end of file diff --git a/Adventures in Lestoria/FrogTongue.cpp b/Adventures in Lestoria/FrogTongue.cpp index 47d8af69..4f240633 100644 --- a/Adventures in Lestoria/FrogTongue.cpp +++ b/Adventures in Lestoria/FrogTongue.cpp @@ -56,7 +56,7 @@ void FrogTongue::Update(float fElapsedTime){ geom2d::linelineToTarget(pos,targetPos); vf2d drawVec=lineToTarget.vector().norm()*3; - tongueLength=util::lerp(0,lineToTarget.length(),pow(sin((lifetime*PI)/duration),20.f)); + tongueLength=util::lerp(0.f,lineToTarget.length(),pow(sin((lifetime*PI)/duration),20.f)); vf2d tongueEndPos=geom2d::line(pos+drawVec,targetPos).upoint(pow(sin((lifetime*PI)/duration),20.f)); geom2d::linetongueLine(pos+drawVec,tongueEndPos); diff --git a/Adventures in Lestoria/IBullet.cpp b/Adventures in Lestoria/IBullet.cpp index 9972089a..2d84da86 100644 --- a/Adventures in Lestoria/IBullet.cpp +++ b/Adventures in Lestoria/IBullet.cpp @@ -173,8 +173,8 @@ void IBullet::_Draw()const{ Pixel blendCol=col; if(fadeInTime==0&&fadeOutTime==0)blendCol.a=col.a; - else if(fadeOutTime>0)blendCol.a=uint8_t(util::lerp(col.a,0,1-((fadeOutTime-fadeOutTimer)/fadeOutTime))); - else if(fadeInTime>0)blendCol.a=uint8_t(util::lerp(col.a,0,((fadeInTime-fadeInTimer)/fadeInTime))); + else if(fadeOutTime>0)blendCol.a=uint8_t(util::lerp(col.a,uint8_t(0),1-((fadeOutTime-fadeOutTimer)/fadeOutTime))); + else if(fadeInTime>0)blendCol.a=uint8_t(util::lerp(col.a,uint8_t(0),((fadeInTime-fadeInTimer)/fadeInTime))); if(GetZ()>0){ vf2d shadowScale=vf2d{8*scale.x/3.f,1}/std::max(1.f,GetZ()/8); diff --git a/Adventures in Lestoria/Monster.cpp b/Adventures in Lestoria/Monster.cpp index a0dbbb1b..0328459c 100644 --- a/Adventures in Lestoria/Monster.cpp +++ b/Adventures in Lestoria/Monster.cpp @@ -488,10 +488,10 @@ void Monster::Draw()const{ const bool NotOnTitleScreen=GameState::STATE!=GameState::states[States::MAIN_MENU]; uint8_t blendColAlpha=blendCol.a; - if(fadeTimer>0.f)blendColAlpha=uint8_t(util::lerp(0,blendCol.a,fadeTimer)); //Fade timer goes from 1 to 0 seconds. + if(fadeTimer>0.f)blendColAlpha=uint8_t(util::lerp(uint8_t(0),blendCol.a,fadeTimer)); //Fade timer goes from 1 to 0 seconds. else if(NotOnTitleScreen &&(OnUpperLevel()!=game->GetPlayer()->OnUpperLevel()||abs(GetZ()-game->GetPlayer()->GetZ())>1))blendColAlpha=blendCol.a*0.62f; - else if(IsSolid()&&solidFadeTimer>0.f)blendColAlpha=uint8_t(util::lerp(blendCol.a,255-TileGroup::FADE_AMT,solidFadeTimer/TileGroup::FADE_TIME)); + else if(IsSolid()&&solidFadeTimer>0.f)blendColAlpha=uint8_t(util::lerp(blendCol.a,uint8_t(255-TileGroup::FADE_AMT),solidFadeTimer/TileGroup::FADE_TIME)); blendCol.a=blendColAlpha; diff --git a/Adventures in Lestoria/OctopusArm.cpp b/Adventures in Lestoria/OctopusArm.cpp index 4d8aa023..2328b9eb 100644 --- a/Adventures in Lestoria/OctopusArm.cpp +++ b/Adventures in Lestoria/OctopusArm.cpp @@ -116,12 +116,12 @@ void Monster::STRATEGY::OCTOPUS_ARM(Monster&m,float fElapsedTime,std::string str Arc attackArc{GetAttackArc(m)}; m.SetStrategyDrawFunction([&attackArc,&storedArc=m.ANY(A::STORED_ARC),&alphaTimer=m.F(A::ENVIRONMENT_TIMER),attackEffectTime=ConfigFloat("Attack Effect Time")](AiL*game,Monster&monster,const std::string&strategy){ - const float alphaTimer{std::fmod(game->GetRunTime(),2.f)}; - uint8_t alpha{util::lerp(0,255,alphaTimer)}; + const float alphaTimer{float(std::fmod(game->GetRunTime(),2.f))}; + uint8_t alpha{util::lerp(uint8_t(0),uint8_t(255),alphaTimer)}; if(alphaTimer>1.f)alpha=util::lerp(0,255,1-(alphaTimer-1)); attackArc.Draw(game,{0,0,255,uint8_t(alpha)}); if(storedArc.has_value()){ - const uint8_t effectAlpha{util::lerp(0,255,alphaTimer/attackEffectTime)}; + const uint8_t effectAlpha{util::lerp(uint8_t(0),uint8_t(255),alphaTimer/attackEffectTime)}; std::any_cast(storedArc).Draw(game,{255,255,255,effectAlpha}); } }); diff --git a/Adventures in Lestoria/RunTowards.cpp b/Adventures in Lestoria/RunTowards.cpp index a7d2822b..4fce9e41 100644 --- a/Adventures in Lestoria/RunTowards.cpp +++ b/Adventures in Lestoria/RunTowards.cpp @@ -147,9 +147,9 @@ void Monster::STRATEGY::RUN_TOWARDS(Monster&m,float fElapsedTime,std::string str } } if(m.F(A::JUMP_LANDING_TIMER)>=m.F(A::JUMP_ORIGINAL_LANDING_TIMER)/2){ - m.SetZ(util::lerp(0,float(ConfigInt("JumpHeight")),1-jumpLandingTimerRatio)); + m.SetZ(util::lerp(0.f,float(ConfigInt("JumpHeight")),1-jumpLandingTimerRatio)); }else{ - m.SetZ(util::lerp(0,float(ConfigInt("JumpHeight")),jumpLandingTimerRatio*2)); + m.SetZ(util::lerp(0.f,float(ConfigInt("JumpHeight")),jumpLandingTimerRatio*2)); } if(m.F(A::JUMP_LANDING_TIMER)==0){ m.state=State::RECOVERY; diff --git a/Adventures in Lestoria/SlimeKing.cpp b/Adventures in Lestoria/SlimeKing.cpp index c7f3001b..e7f0ab58 100644 --- a/Adventures in Lestoria/SlimeKing.cpp +++ b/Adventures in Lestoria/SlimeKing.cpp @@ -191,9 +191,9 @@ void Monster::STRATEGY::SLIMEKING(Monster&m,float fElapsedTime,std::string strat } } if(m.F(A::JUMP_LANDING_TIMER)>=m.F(A::JUMP_ORIGINAL_LANDING_TIMER)/2){ - m.SetZ(util::lerp(0,float(ConfigInt("JumpHeight")),1-jumpLandingTimerRatio)); + m.SetZ(util::lerp(0.f,float(ConfigInt("JumpHeight")),1-jumpLandingTimerRatio)); }else{ - m.SetZ(util::lerp(0,float(ConfigInt("JumpHeight")),jumpLandingTimerRatio*2)); + m.SetZ(util::lerp(0.f,float(ConfigInt("JumpHeight")),jumpLandingTimerRatio*2)); } if(m.F(A::JUMP_LANDING_TIMER)==0){ m.state=State::RECOVERY; diff --git a/Adventures in Lestoria/State_Death.cpp b/Adventures in Lestoria/State_Death.cpp index cbd6c390..6d7655c1 100644 --- a/Adventures in Lestoria/State_Death.cpp +++ b/Adventures in Lestoria/State_Death.cpp @@ -75,7 +75,7 @@ void State_Death::OnUserUpdate(AiL*game){ } game->view.SetZoom(util::lerp(1.f,2.f,(gameSlowdownPct-1)/10.f),game->view.WorldToScreen(game->GetPlayer()->GetPos())); game->SetWorldColor({uint8_t(util::lerp(255,0,(gameSlowdownPct-1)/10.f)),uint8_t(util::lerp(255,0,(gameSlowdownPct-1)/10.f)),uint8_t(util::lerp(255,0,(gameSlowdownPct-1)/10.f)),255}); - Audio::SetBGMPitch(util::lerp(1.f,0,(gameSlowdownPct-1)/10.f)); + Audio::SetBGMPitch(util::lerp(1.f,0.f,(gameSlowdownPct-1)/10.f)); if(gameSlowdownPct<5.f){ game->SetMosaicEffect(uint8_t(util::lerp(1.f,9.f,(gameSlowdownPct-1)/7.f))); }else{ diff --git a/Adventures in Lestoria/StoneGolem.cpp b/Adventures in Lestoria/StoneGolem.cpp index 2f1cb3c8..afc1e963 100644 --- a/Adventures in Lestoria/StoneGolem.cpp +++ b/Adventures in Lestoria/StoneGolem.cpp @@ -111,7 +111,7 @@ void Monster::STRATEGY::STONE_GOLEM(Monster&m,float fElapsedTime,std::string str std::for_each(m.VEC(A::STAGE_POLYGONS).begin(),m.VEC(A::STAGE_POLYGONS).end(),[&](std::any&data){ StageMaskPolygon&polygon{std::any_cast(data)}; Pixel newCol{PixelLerp(Pixel{uint32_t(m.I(A::SHOCKWAVE_COLOR))},BLACK,sin(geom2d::pi*game->GetRunTime()*2)/2.f+0.5f)}; - newCol.a=util::lerp(Pixel{uint32_t(m.I(A::SHOCKWAVE_COLOR))}.a,0.f,sin(geom2d::pi*game->GetRunTime()*2)/2.f+0.5f); + newCol.a=util::lerp(Pixel{uint32_t(m.I(A::SHOCKWAVE_COLOR))}.a,uint8_t(0),sin(geom2d::pi*game->GetRunTime()*2)/2.f+0.5f); polygon.SetBlendColor(newCol); polygon.Draw(); }); diff --git a/Adventures in Lestoria/TitleScreen.cpp b/Adventures in Lestoria/TitleScreen.cpp index a8d7313d..5f20e9a9 100644 --- a/Adventures in Lestoria/TitleScreen.cpp +++ b/Adventures in Lestoria/TitleScreen.cpp @@ -104,8 +104,8 @@ void TitleScreen::Update(){ double t=pixelMoveTime/(animationTime-2); for(Particle&p:particles){ p.pos=p.originalPos.lerp(p.targetPos,sqrt(t)); - p.rot=util::lerp(p.rot,0,t); - p.scale=util::lerp(p.scale,1,t); + p.rot=util::lerp(p.rot,0.f,t); + p.scale=util::lerp(p.scale,1.f,t); } if(currentAnimationTime==5.0f){ state=WAITING; diff --git a/Adventures in Lestoria/Version.h b/Adventures in Lestoria/Version.h index ecee2baa..96dadab9 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 3 #define VERSION_PATCH 0 -#define VERSION_BUILD 11776 +#define VERSION_BUILD 11794 #define stringify(a) stringify_(a) #define stringify_(a) #a diff --git a/Adventures in Lestoria/VisualNovel.cpp b/Adventures in Lestoria/VisualNovel.cpp index 92de3ca5..14d97075 100644 --- a/Adventures in Lestoria/VisualNovel.cpp +++ b/Adventures in Lestoria/VisualNovel.cpp @@ -321,7 +321,7 @@ void VisualNovel::Draw(const uint8_t backgroundAlpha){ game->DrawDropShadowStringDecal(narratorFont,dialogDisplayPos-vf2d{10,6}+dialogTextSize.offset,activeText,{190,190,220}); } } - float yOffset=util::lerp(dialogDisplaySize.y+12,-8,textScrollTime/maxTextScrollTime); + float yOffset=util::lerp(dialogDisplaySize.y+12,-8.f,textScrollTime/maxTextScrollTime); game->DrawPolygonDecal( Menu::GetPatchPart(1,1).Decal(), {dialogDisplayPos-vf2d{12,-yOffset},dialogDisplayPos+vf2d{-12,dialogDisplaySize.y+12},dialogDisplayPos+dialogDisplaySize+vf2d{12,12},dialogDisplayPos+vf2d{dialogDisplaySize.x+12,yOffset}}, diff --git a/Adventures in Lestoria/assets/Campaigns/1_1_v2.tmx b/Adventures in Lestoria/assets/Campaigns/1_1_v2.tmx index 4a09fedb..ce26e406 100644 --- a/Adventures in Lestoria/assets/Campaigns/1_1_v2.tmx +++ b/Adventures in Lestoria/assets/Campaigns/1_1_v2.tmx @@ -1,5 +1,5 @@ - + @@ -1835,7 +1835,7 @@ - + @@ -1845,7 +1845,7 @@ - + diff --git a/Adventures in Lestoria/assets/Campaigns/Boss_3_B.tmx b/Adventures in Lestoria/assets/Campaigns/Boss_3_B.tmx index 15307354..1a9b68b8 100644 --- a/Adventures in Lestoria/assets/Campaigns/Boss_3_B.tmx +++ b/Adventures in Lestoria/assets/Campaigns/Boss_3_B.tmx @@ -343,42 +343,42 @@ - + - + - + - + - + - + - + - + diff --git a/Adventures in Lestoria/assets/config/Monsters.txt b/Adventures in Lestoria/assets/config/Monsters.txt index 3b49e04b..11d7acb3 100644 --- a/Adventures in Lestoria/assets/config/Monsters.txt +++ b/Adventures in Lestoria/assets/config/Monsters.txt @@ -1729,6 +1729,9 @@ Monsters XP = 0 + # A flag to show an arrow indicator when the boss is off-screen. + ShowBossIndicator = True + Collision Radius = 20 Ignore Collisions = True @@ -1765,13 +1768,14 @@ Monsters Attack = 50 CollisionDmg = 30 + Immovable = True MoveSpd = 0% - Size = 400% + Size = 200% XP = 0 - Collision Radius = 20 + Collision Radius = 24 Ignore Collisions = True diff --git a/Adventures in Lestoria/assets/gamepack.pak b/Adventures in Lestoria/assets/gamepack.pak index ecd984e1..3a6ad6ba 100644 Binary files a/Adventures in Lestoria/assets/gamepack.pak and b/Adventures in Lestoria/assets/gamepack.pak differ diff --git a/Adventures in Lestoria/assets/maps/Monster_Presets.tmx b/Adventures in Lestoria/assets/maps/Monster_Presets.tmx index 617ddeb2..e53fdbc0 100644 --- a/Adventures in Lestoria/assets/maps/Monster_Presets.tmx +++ b/Adventures in Lestoria/assets/maps/Monster_Presets.tmx @@ -37,7 +37,7 @@ - + diff --git a/Adventures in Lestoria/assets/maps/Monsters/Octopus Arm.tx b/Adventures in Lestoria/assets/maps/Monsters/Octopus Arm.tx index 7e92812c..2b837ee1 100644 --- a/Adventures in Lestoria/assets/maps/Monsters/Octopus Arm.tx +++ b/Adventures in Lestoria/assets/maps/Monsters/Octopus Arm.tx @@ -1,5 +1,5 @@ diff --git a/Adventures in Lestoria/util.h b/Adventures in Lestoria/util.h index 34b8f461..e14e7d29 100644 --- a/Adventures in Lestoria/util.h +++ b/Adventures in Lestoria/util.h @@ -58,19 +58,19 @@ namespace olc::util{ const float dirToAngle(const Direction dir); #pragma region Lerp templates + specializations - template - inline auto lerp(const T val1,const U val2,const float t){ - return decltype(val1+val2)(val1*(1-t)+val2*t); + template + inline auto lerp(const T val1,const T val2,const float t){ + return T(val1*(1-t)+val2*t); } template<> - inline auto lerp(const vf2d val1,const vf2d val2,const float t){ + inline auto lerp(const vf2d val1,const vf2d val2,const float t){ return val1.lerp(val2,t); } template<> //NOTE: Also interpolates the alpha!!! - inline auto lerp(const Pixel val1,const Pixel val2,const float t){ + inline auto lerp(const Pixel val1,const Pixel val2,const float t){ Pixel col{PixelLerp(val1,val2,t)}; col.a=lerp(val1.a,val2.a,t); return col; diff --git a/x64/Release/Adventures in Lestoria.exe b/x64/Release/Adventures in Lestoria.exe index 58f61ad9..81ee49ae 100644 Binary files a/x64/Release/Adventures in Lestoria.exe and b/x64/Release/Adventures in Lestoria.exe differ