|
|
|
@ -1365,42 +1365,52 @@ void AiL::RenderWorld(float fElapsedTime){ |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
#define NumberScalesWithDamage true |
|
|
|
|
#define NormalNumber false |
|
|
|
|
|
|
|
|
|
auto DrawDamageNumber=[&](const bool ScaleWithNumber,std::string_view text,std::pair<Pixel,Pixel>colorsEnemy,std::pair<Pixel,Pixel>colorsFriendly,vf2d scaling={1.f,1.f}){ |
|
|
|
|
vf2d textSize=GetTextSizeProp(text)*scaling; |
|
|
|
|
if(!dn->friendly){ |
|
|
|
|
vf2d additionalScaling={1.f,1.f}; |
|
|
|
|
if(ScaleWithNumber)additionalScaling=dn->size; |
|
|
|
|
|
|
|
|
|
textSize*=additionalScaling; |
|
|
|
|
vf2d drawPos=dn->pos-textSize/2.f; |
|
|
|
|
|
|
|
|
|
drawPos.x=std::clamp(drawPos.x,view.GetWorldTL().x,view.GetWorldBR().x-textSize.x); |
|
|
|
|
drawPos.y=std::clamp(drawPos.y,view.GetWorldTL().y,view.GetWorldBR().y-textSize.y); |
|
|
|
|
|
|
|
|
|
view.DrawShadowStringPropDecal(drawPos,text,colorsEnemy.first,colorsEnemy.second,scaling*additionalScaling); |
|
|
|
|
}else{ |
|
|
|
|
vf2d drawPos=dn->pos-textSize/2.f; |
|
|
|
|
drawPos.x=std::clamp(drawPos.x,view.GetWorldTL().x,view.GetWorldBR().x-textSize.x); |
|
|
|
|
drawPos.y=std::clamp(drawPos.y,view.GetWorldTL().y,view.GetWorldBR().y-textSize.y); |
|
|
|
|
|
|
|
|
|
view.DrawShadowStringPropDecal(drawPos,text,colorsFriendly.first,colorsFriendly.second,scaling); |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
switch(dn->type){ |
|
|
|
|
case HEALTH_LOSS:{ |
|
|
|
|
std::string text=std::to_string(dn->damage); |
|
|
|
|
if(!dn->friendly){ |
|
|
|
|
view.DrawStringPropDecal(dn->pos-GetTextSizeProp(text)/2.f*dn->size,text,DARK_RED,dn->size); |
|
|
|
|
}else{ |
|
|
|
|
view.DrawShadowStringPropDecal(dn->pos-GetTextSizeProp(text)/2,text,RED,VERY_DARK_GREY); |
|
|
|
|
} |
|
|
|
|
DrawDamageNumber(NumberScalesWithDamage,text,{DARK_RED,{0,0,0,0}},{RED,VERY_DARK_GREY}); |
|
|
|
|
}break; |
|
|
|
|
case HEALTH_GAIN:{ |
|
|
|
|
std::string text="+"+std::to_string(dn->damage); |
|
|
|
|
if(!dn->friendly){ |
|
|
|
|
view.DrawStringPropDecal(dn->pos-GetTextSizeProp(text)/2,text,DARK_GREEN); |
|
|
|
|
}else{ |
|
|
|
|
view.DrawShadowStringPropDecal(dn->pos-GetTextSizeProp(text)/2,text,GREEN,VERY_DARK_GREY); |
|
|
|
|
} |
|
|
|
|
DrawDamageNumber(NormalNumber,text,{DARK_GREEN,{0,0,0,0}},{GREEN,VERY_DARK_GREY}); |
|
|
|
|
}break; |
|
|
|
|
case MANA_GAIN:{ |
|
|
|
|
std::string text="+"+std::to_string(dn->damage); |
|
|
|
|
if(dn->friendly){ |
|
|
|
|
view.DrawShadowStringPropDecal(dn->pos-GetTextSizeProp(text)/2,text,BLUE,VERY_DARK_GREY); |
|
|
|
|
} |
|
|
|
|
DrawDamageNumber(NormalNumber,text,{BLUE,VERY_DARK_GREY},{BLUE,VERY_DARK_GREY}); |
|
|
|
|
}break; |
|
|
|
|
case INTERRUPT:{ |
|
|
|
|
std::string text="Interrupted!"; |
|
|
|
|
if(dn->friendly){ |
|
|
|
|
view.DrawShadowStringPropDecal(dn->pos-GetTextSizeProp(text)/2,text,BLACK,VERY_DARK_GREY,{0.5,1}); |
|
|
|
|
} |
|
|
|
|
DrawDamageNumber(NormalNumber,text,{BLACK,VERY_DARK_GREY},{BLACK,VERY_DARK_GREY},{0.5f,1}); |
|
|
|
|
}break; |
|
|
|
|
case CRIT:{ |
|
|
|
|
std::string text=std::to_string(dn->damage); |
|
|
|
|
if(!dn->friendly){ |
|
|
|
|
view.DrawShadowStringPropDecal(dn->pos-GetTextSizeProp(text)/2.f*dn->size,text,YELLOW,DARK_YELLOW,dn->size); |
|
|
|
|
}else{ |
|
|
|
|
view.DrawStringPropDecal(dn->pos-GetTextSizeProp(text)/2,text,BLACK); |
|
|
|
|
} |
|
|
|
|
DrawDamageNumber(NumberScalesWithDamage,text,{YELLOW,DARK_YELLOW},{BLACK,{0,0,0,0}}); |
|
|
|
|
}break; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|