diff --git a/Crawler/Crawler.cpp b/Crawler/Crawler.cpp index 248bd9c1..4550fda4 100644 --- a/Crawler/Crawler.cpp +++ b/Crawler/Crawler.cpp @@ -973,7 +973,11 @@ void Crawler::RenderWorld(float fElapsedTime){ } } std::string text=std::to_string(dn->damage); - view.DrawStringPropDecal(dn->pos-GetTextSizeProp(text)/2,text,DARK_RED); + if(!dn->friendly){ + view.DrawStringPropDecal(dn->pos-GetTextSizeProp(text)/2,text,DARK_RED); + }else{ + view.DrawShadowStringPropDecal(dn->pos-GetTextSizeProp(text)/2,text,RED,VERY_DARK_GREY); + } } if(DEBUG_PATHFINDING){ diff --git a/Crawler/DamageNumber.cpp b/Crawler/DamageNumber.cpp index 45d6fac0..5052cad0 100644 --- a/Crawler/DamageNumber.cpp +++ b/Crawler/DamageNumber.cpp @@ -6,6 +6,6 @@ DamageNumber::DamageNumber() :damage(0){ } -DamageNumber::DamageNumber(vf2d pos,int damage): - pos(pos),damage(damage){ +DamageNumber::DamageNumber(vf2d pos,int damage,bool friendly): + pos(pos),damage(damage),friendly(friendly){ } \ No newline at end of file diff --git a/Crawler/DamageNumber.h b/Crawler/DamageNumber.h index 22d58619..439d8a53 100644 --- a/Crawler/DamageNumber.h +++ b/Crawler/DamageNumber.h @@ -6,7 +6,8 @@ struct DamageNumber{ int damage; float lifeTime=0; float pauseTime=0; + bool friendly=false; const static float MOVE_UP_TIME; DamageNumber(); - DamageNumber(vf2d pos,int damage); + DamageNumber(vf2d pos,int damage,bool friendly=false); }; \ No newline at end of file diff --git a/Crawler/Monster.cpp b/Crawler/Monster.cpp index e8314e4a..1c86b063 100644 --- a/Crawler/Monster.cpp +++ b/Crawler/Monster.cpp @@ -252,9 +252,8 @@ bool Monster::Hurt(int damage,bool onUpperLevel,float z){ damageNumberPtr.get()->damage+=int(mod_dmg); damageNumberPtr.get()->pauseTime=0.4; } else { - DAMAGENUMBER_LIST.push_back(std::make_shared(pos,int(mod_dmg))); - std::shared_ptrnumb=*(DAMAGENUMBER_LIST.end()-1); - damageNumberPtr=numb; + damageNumberPtr=std::make_shared(pos,int(mod_dmg)); + DAMAGENUMBER_LIST.push_back(damageNumberPtr); } lastHitTimer=0.05; if(!IsAlive()){ diff --git a/Crawler/Player.cpp b/Crawler/Player.cpp index 30b61e6a..250f4d8d 100644 --- a/Crawler/Player.cpp +++ b/Crawler/Player.cpp @@ -516,9 +516,8 @@ bool Player::Hurt(int damage,bool onUpperLevel,float z){ damageNumberPtr.get()->damage+=int(mod_dmg); damageNumberPtr.get()->pauseTime=0.4; } else { - DAMAGENUMBER_LIST.push_back(std::make_shared(pos,int(mod_dmg))); - std::shared_ptrnumb=*(DAMAGENUMBER_LIST.end()-1); - damageNumberPtr=numb; + damageNumberPtr=std::make_shared(pos,int(mod_dmg),true); + DAMAGENUMBER_LIST.push_back(damageNumberPtr); } lastHitTimer=0.05; return true; diff --git a/Crawler/Version.h b/Crawler/Version.h index f3df0b8b..95133f73 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 1504 +#define VERSION_BUILD 1509 #define stringify(a) stringify_(a) #define stringify_(a) #a diff --git a/Crawler/olcPGEX_TransformedView.h b/Crawler/olcPGEX_TransformedView.h index 181f18fc..c7396ae5 100644 --- a/Crawler/olcPGEX_TransformedView.h +++ b/Crawler/olcPGEX_TransformedView.h @@ -182,6 +182,8 @@ namespace olc // Draws a multiline string as a decal, with tiniting and scaling void DrawStringDecal(const olc::vf2d& pos, const std::string& sText, const olc::Pixel col = olc::WHITE, const olc::vf2d& scale = { 1.0f, 1.0f }); void DrawStringPropDecal(const olc::vf2d& pos, const std::string& sText, const olc::Pixel col = olc::WHITE, const olc::vf2d& scale = { 1.0f, 1.0f }); + void DrawShadowStringDecal(const olc::vf2d& pos, const std::string& sText, const Pixel col = olc::WHITE, const Pixel shadowCol = olc::BLACK, const olc::vf2d& scale = { 1.0f, 1.0f },const float shadowSizeFactor=1); + void DrawShadowStringPropDecal(const olc::vf2d& pos, const std::string& sText, const Pixel col = olc::WHITE, const Pixel shadowCol = olc::BLACK, const olc::vf2d& scale = { 1.0f, 1.0f },const float shadowSizeFactor=1); // Draws a single shaded filled rectangle as a decal void FillRectDecal(const olc::vf2d& pos, const olc::vf2d& size, const olc::Pixel col = olc::WHITE); void DrawRectDecal(const olc::vf2d& pos, const olc::vf2d& size, const olc::Pixel col = olc::WHITE); @@ -634,6 +636,14 @@ namespace olc pge->DrawStringPropDecal(WorldToScreen(pos), sText, col, scale * m_vWorldScale * m_vRecipPixel); } + void TransformedView::DrawShadowStringDecal(const olc::vf2d& pos, const std::string& sText, const Pixel col, const Pixel shadowCol, const olc::vf2d& scale,const float shadowSizeFactor){ + pge->DrawShadowStringDecal(WorldToScreen(pos),sText,col,shadowCol,scale,shadowSizeFactor); + } + + void TransformedView::DrawShadowStringPropDecal(const olc::vf2d& pos, const std::string& sText, const Pixel col, const Pixel shadowCol, const olc::vf2d& scale,const float shadowSizeFactor){ + pge->DrawShadowStringPropDecal(WorldToScreen(pos),sText,col,shadowCol,scale,shadowSizeFactor); + } + void TransformedView::FillRectDecal(const olc::vf2d & pos, const olc::vf2d & size, const olc::Pixel col) { pge->FillRectDecal(WorldToScreen(pos), (size * m_vWorldScale).ceil(), col);