|
|
|
@ -114,7 +114,7 @@ bool Crawler::OnUserCreate(){ |
|
|
|
|
LoadLevel(LEVEL_NAMES["starting_map"_S]); |
|
|
|
|
InitializeClasses(); |
|
|
|
|
ChangePlayerClass(WARRIOR); |
|
|
|
|
Warrior::ability4=Ranger::ability1; //Class ability swapping demonstration.
|
|
|
|
|
//Warrior::ability4=Ranger::ability1; //Class ability swapping demonstration.
|
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -998,33 +998,34 @@ void Crawler::RenderHud(){ |
|
|
|
|
return newName; |
|
|
|
|
}; |
|
|
|
|
std::vector<Ability>cooldowns{ |
|
|
|
|
player->GetRightClickAbility(), |
|
|
|
|
player->GetAbility1(), |
|
|
|
|
player->GetAbility2(), |
|
|
|
|
player->GetAbility3(), |
|
|
|
|
player->GetAbility4(), |
|
|
|
|
}; |
|
|
|
|
std::vector<Ability>activeCooldowns{}; |
|
|
|
|
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){ |
|
|
|
|
return a1.cooldown<a2.cooldown; |
|
|
|
|
}); |
|
|
|
|
int offset=6*activeCooldowns.size(); |
|
|
|
|
for(Ability&a:activeCooldowns){ |
|
|
|
|
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); |
|
|
|
|
DrawRotatedShadowStringPropDecal(vf2d{8,ScreenHeight()-20.f}+vf2d{1,1}-vf2d{0,float(offset)},capitalize(a.name),-PI/64,{0,0},WHITE,BLACK,{0.4,0.4},0.5); |
|
|
|
|
std::stringstream cooldownTimeDisplay;
|
|
|
|
|
cooldownTimeDisplay<<std::fixed<<std::setprecision(1)<<a.cooldown; |
|
|
|
|
DrawShadowStringPropDecal(vf2d{74,ScreenHeight()-22.f+1}-vf2d{float(GetTextSizeProp(cooldownTimeDisplay.str()).x*0.5),float(offset)},cooldownTimeDisplay.str(),WHITE,BLACK,{0.5,0.5}); |
|
|
|
|
|
|
|
|
|
const auto DrawCooldown=[&](vf2d pos,Ability&a){ |
|
|
|
|
if(a.name!="???"){ |
|
|
|
|
if(a.cooldown>0.1){ |
|
|
|
|
DrawPie(pos+vf2d{12,12},12,360-(a.cooldown/a.COOLDOWN_TIME)*360,PixelLerp(a.barColor1,a.barColor2,(a.cooldown/a.COOLDOWN_TIME))); |
|
|
|
|
std::stringstream cooldownTimeDisplay;
|
|
|
|
|
cooldownTimeDisplay<<std::fixed<<std::setprecision(1)<<a.cooldown; |
|
|
|
|
DrawShadowStringPropDecal(pos+vf2d{12,12}-vf2d{float(GetTextSizeProp(cooldownTimeDisplay.str()).x*0.5),float(GetTextSizeProp(cooldownTimeDisplay.str()).y*1)}/2,cooldownTimeDisplay.str(),WHITE,BLACK,{0.5,1}); |
|
|
|
|
} |
|
|
|
|
DrawDecal(pos,GFX["skill_overlay_icon.png"].Decal()); |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
vf2d iconPos={8.f,float(ScreenHeight()-32)}; |
|
|
|
|
for(Ability&a:cooldowns){ |
|
|
|
|
if(a.name!="???"){ |
|
|
|
|
DrawCooldown(iconPos,a); |
|
|
|
|
iconPos+={32,0}; |
|
|
|
|
} |
|
|
|
|
offset-=6; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
DrawCooldown({float(ScreenWidth()-32),float(ScreenHeight()-32)},player->GetRightClickAbility()); |
|
|
|
|
|
|
|
|
|
if(GetPlayer()->GetCastInfo().castTimer>0){ |
|
|
|
|
FillRectDecal(vf2d{ScreenWidth()/2-92.f,ScreenHeight()-90.f},{184,20},BLACK); |
|
|
|
|
FillRectDecal(vf2d{ScreenWidth()/2-90.f,ScreenHeight()-88.f},{180,16},DARK_GREY); |
|
|
|
@ -1058,9 +1059,6 @@ void Crawler::RenderHud(){ |
|
|
|
|
DrawShadowStringDecal({0,128},player->GetPos().str()); |
|
|
|
|
DrawShadowStringDecal({0,136},"Spd: "+std::to_string(player->GetMoveSpdMult())); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DrawPie({120,120},20,90,BLUE); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void Crawler::AddEffect(std::unique_ptr<Effect>foreground,std::unique_ptr<Effect> background){ |
|
|
|
@ -1542,5 +1540,5 @@ void Crawler::SpawnMonster(vf2d pos,MonsterData*data,bool upperLevel){ |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void Crawler::DrawPie(vf2d center,float radius,float degreesCut,Pixel col){ |
|
|
|
|
DrawPolygonDecal(nullptr,circleCooldownPoints,circleCooldownPoints,int(degreesCut/4),center,radius,col); |
|
|
|
|
DrawPolygonDecal(nullptr,circleCooldownPoints,circleCooldownPoints,std::max(1,int(degreesCut/4)),center,radius,col); |
|
|
|
|
} |