diff --git a/Crawler/Crawler.cpp b/Crawler/Crawler.cpp index 5e16e755..3a453bde 100644 --- a/Crawler/Crawler.cpp +++ b/Crawler/Crawler.cpp @@ -96,7 +96,7 @@ bool Crawler::OnUserCreate(){ } bool Crawler::OnUserUpdate(float fElapsedTime){ - fElapsedTime=std::min(1/60.f,fElapsedTime); + fElapsedTime=std::clamp(fElapsedTime,0.f,1/60.f); HandleUserInput(fElapsedTime); UpdateEffects(fElapsedTime); player->Update(fElapsedTime); @@ -727,16 +727,16 @@ void Crawler::RenderHud(){ player->GetAbility3(), player->GetAbility4(), }; - std::vectoractiveCooldowns; - std::copy_if(cooldowns.begin(),cooldowns.end(),std::back_inserter(activeCooldowns),[](Ability a){ + std::vectoractiveCooldowns{}; + std::copy_if(cooldowns.begin(),cooldowns.end(),std::back_inserter(activeCooldowns),[](Ability&a){ return a.cooldown>0; }); - std::sort(activeCooldowns.begin(),activeCooldowns.end(),[](Ability&a1,Ability&a2){ + std::sort(activeCooldowns.begin(),activeCooldowns.end(),[&](Ability&a1,Ability&a2){ return a1.cooldown0){ + if(a.cooldown>0.1){ FillRectDecal(vf2d{10,ScreenHeight()-22.f}-vf2d{0,float(offset)},{64,6},BLACK); FillRectDecal(vf2d{11,ScreenHeight()-21.f}-vf2d{0,float(offset)},{62,4},DARK_GREY); GradientFillRectDecal(vf2d{10,ScreenHeight()-22.f}-vf2d{0,float(offset)},{(a.cooldown/a.COOLDOWN_TIME)*64,6},a.barColor1,a.barColor1,a.barColor2,a.barColor2); diff --git a/Crawler/DEFINES.h b/Crawler/DEFINES.h index f39a61a4..1e5d5730 100644 --- a/Crawler/DEFINES.h +++ b/Crawler/DEFINES.h @@ -14,7 +14,8 @@ #define INFINITE 999999 #define SETUP_CLASS(class) \ -class::class(){} \ +class::class() \ + :Player::Player(){} \ class::class(Player*player) \ :Player::Player(player){} \ Class class::GetClass(){return cl;} \ diff --git a/Crawler/Player.cpp b/Crawler/Player.cpp index d41eb9a3..ae65932f 100644 --- a/Crawler/Player.cpp +++ b/Crawler/Player.cpp @@ -265,11 +265,26 @@ void Player::Update(float fElapsedTime){ animation.UpdateState(internal_animState,fElapsedTime); } } - rightClickAbility.cooldown=std::max(0.f,rightClickAbility.cooldown-fElapsedTime); - ability.cooldown=std::max(0.f,ability.cooldown-fElapsedTime); - ability2.cooldown=std::max(0.f,ability2.cooldown-fElapsedTime); - ability3.cooldown=std::max(0.f,ability3.cooldown-fElapsedTime); - ability4.cooldown=std::max(0.f,ability4.cooldown-fElapsedTime); + rightClickAbility.cooldown-=fElapsedTime; + ability.cooldown-=fElapsedTime; + ability2.cooldown-=fElapsedTime; + ability3.cooldown-=fElapsedTime; + ability4.cooldown-=fElapsedTime; + if(rightClickAbility.cooldown<0){ + rightClickAbility.cooldown=0; + } + if(ability.cooldown<0){ + ability.cooldown=0; + } + if(ability2.cooldown<0){ + ability2.cooldown=0; + } + if(ability3.cooldown<0){ + ability3.cooldown=0; + } + if(ability4.cooldown<0){ + ability4.cooldown=0; + } for(Monster&m:MONSTER_LIST){ if(iframe_time==0&&OnUpperLevel()==m.OnUpperLevel()&&geom2d::overlaps(geom2d::circle(pos,12*size/2),geom2d::circle(m.GetPos(),12*m.GetSizeMult()/2))){ if(m.IsAlive()){ diff --git a/Crawler/Ranger.cpp b/Crawler/Ranger.cpp index e2744a3b..52b3a40c 100644 --- a/Crawler/Ranger.cpp +++ b/Crawler/Ranger.cpp @@ -12,11 +12,11 @@ INCLUDE_game std::string Ranger::name="Ranger"; Class Ranger::cl=RANGER; -Ability Ranger::rightClickAbility={"Retreat",7,0,VERY_DARK_BLUE,DARK_BLUE}; -Ability Ranger::ability1={"Rapid Fire",12,35}; -Ability Ranger::ability2={"Charged Shot",15,40}; -Ability Ranger::ability3={"Multishot",25,50}; -Ability Ranger::ability4={"???",0,0}; +Ability Ranger::rightClickAbility=Ability("Retreat",7,0,VERY_DARK_BLUE,DARK_BLUE); +Ability Ranger::ability1=Ability("Rapid Fire",12,35); +Ability Ranger::ability2=Ability("Charged Shot",15,40); +Ability Ranger::ability3=Ability("Multishot",25,50); +Ability Ranger::ability4=Ability("???",0,0); AnimationState Ranger::idle_n=RANGER_IDLE_N; AnimationState Ranger::idle_e=RANGER_IDLE_E; AnimationState Ranger::idle_s=RANGER_IDLE_S; diff --git a/Crawler/Version.h b/Crawler/Version.h index 9a75624e..5bafc01a 100644 --- a/Crawler/Version.h +++ b/Crawler/Version.h @@ -2,7 +2,7 @@ #define VERSION_MAJOR 0 #define VERSION_MINOR 2 #define VERSION_PATCH 0 -#define VERSION_BUILD 803 +#define VERSION_BUILD 810 #define stringify(a) stringify_(a) #define stringify_(a) #a