Commit 61d1c526 authored by AL's avatar AL

added ghoul eye + minor refactoring

parent d52bcafb
......@@ -6,6 +6,8 @@
#include "Ghoul.h"
#include "AchievementManager.h"
#define DDDR damageDigitsDrawingRange
CombatManager::CombatManager()
{
SPI::Play(Sounds::Ambient_Dungeon,1.0f,0.2f);
......@@ -109,10 +111,19 @@ int CombatManager::ProcessInput(Keyboard::Event in_event) //why does it return
}
//if (in_event.GetCode() == 'T'&&in_event.IsPress()) //for testing
//{
// TD::DrawStringAscending(L"DFSDSD", { 0.0f,0.0f },Colors::Magenta);
//}
if (in_event.GetCode() == 'T' && in_event.IsPress()) //for testing
{
combatData.enemySpeed -= 0.5f;
}
if (in_event.GetCode() == 'Y' && in_event.IsPress()) //for testing
{
combatData.enemySpeed += 0.5f;
}
if (curTurn != Turn::NotInCombat)
{
if (curTurn == Turn::Player)
......@@ -372,6 +383,20 @@ void CombatManager::ChoseUpgrade()
rewardMenuIsActive = false;
}
void CombatManager::DrawDamage(bool missed, size_t dmg, bool crited, bool bleed) const
{
if (missed)
{
TD::DrawStringTimed(L"MISS!", Vec2(RU.GetFloat(-DDDR, DDDR), RU.GetFloat(-DDDR, DDDR)), Colors::White, 0.1f);
}
else
{
if (crited)TD::DrawStringTimed(L"CRIT!", Vec2(RU.GetFloat(-DDDR, DDDR), RU.GetFloat(-DDDR, DDDR)), Colors::Red, 0.1f);
if (bleed) TD::DrawStringTimed(L"BLEED!", Vec2(RU.GetFloat(-DDDR, DDDR), RU.GetFloat(-DDDR, DDDR)), Colors::Red, 0.1f);
TD::DrawStringTimed(std::to_wstring(dmg), Vec2(RU.GetFloat(-DDDR, DDDR), RU.GetFloat(-DDDR, DDDR)), Colors::Yellow, 0.1f);
}
}
void CombatManager::UpdateCombatData()
{
combatData.playerHP = playMan->GetHP();
......@@ -410,21 +435,23 @@ void CombatManager::HandleEvents()
void CombatManager::HandleEvent(SkillEvent ev)
{
float fRoll;
size_t sDmg;
size_t sDmg = 0u;
bool attacked = false, crit = false, miss = false, bleed = false;
switch (ev.eventType)
{
case EventType::Player_PhysicalDamage: //player related events
//player related events
case EventType::Player_PhysicalDamage:
attacked = true;
fRoll = RU.GetFloat0to1();
if (fRoll < (enMan->GetCurAcc() * (1 - playMan->GetDodge())))
{
sDmg = RU.GetUInt((size_t)ev.valLow, (size_t)ev.valHigh);
playMan->SufferPhysicalDamage(sDmg);//hit
TD::DrawStringTimed(std::to_wstring(sDmg), Vec2(RU.GetFloat(-0.5, 0.5), RU.GetFloat(-0.5, 0.5)), Colors::Yellow, 0.1);
sDmg = RU.GetUInt((size_t)ev.valLow, (size_t)ev.valHigh);//hit
playMan->SufferPhysicalDamage(sDmg);
}
else
{
SPI::Play(Sounds::MissBigDamage); //miss
TD::DrawStringTimed(L"MISS!", Vec2(RU.GetFloat(-0.5, 0.5), RU.GetFloat(-0.5, 0.5)), Colors::White, 0.1);
SPI::Play(Sounds::MissBigDamage); //miss
miss = true;
}
break;
case EventType::Player_AddDodge:
......@@ -440,6 +467,7 @@ void CombatManager::HandleEvent(SkillEvent ev)
playMan->Heal((size_t)ev.valHigh);
break;
case EventType::Player_PhysicalAttackedWithBleed:
attacked = true;
fRoll = RU.GetFloat0to1();
if (fRoll < (enMan->GetCurAcc() * (1 - playMan->GetDodge())))
{
......@@ -448,19 +476,17 @@ void CombatManager::HandleEvent(SkillEvent ev)
{
playMan->AddBleed(OneBleedStackEmount);
playMan->SufferPhysicalDamage(sDmg); // bleed got through block
TD::DrawStringTimed(L"BLEED!", Vec2(RU.GetFloat(-0.5, 0.5), RU.GetFloat(-0.5, 0.5)), Colors::Red, 0.1);
TD::DrawStringTimed(std::to_wstring(sDmg), Vec2(RU.GetFloat(-0.5, 0.5), RU.GetFloat(-0.5, 0.5)), Colors::Yellow, 0.1);
bleed = true;
}
else
{
playMan->SufferPhysicalDamage(sDmg); // bleed blocked
TD::DrawStringTimed(std::to_wstring(sDmg), Vec2(RU.GetFloat(-0.5, 0.5), RU.GetFloat(-0.5, 0.5)), Colors::Yellow, 0.1);
}
}
else
{
SPI::Play(Sounds::MissBigDamage); //miss
TD::DrawStringTimed(L"MISS!", Vec2(RU.GetFloat(-0.5, 0.5), RU.GetFloat(-0.5, 0.5)), Colors::White, 0.1);
SPI::Play(Sounds::MissBigDamage); //miss
miss = true;
}
break;
case EventType::Player_CureBleed:
......@@ -470,15 +496,16 @@ void CombatManager::HandleEvent(SkillEvent ev)
playMan->AddSpeed(ev.valHigh);
break;
case EventType::Enemy_PhysicalDamage: //enemy related events
//enemy related events
case EventType::Enemy_PhysicalDamage:
attacked = true;
fRoll = RU.GetFloat0to1();
enMan->SetState(EnemyCombat::State::GhoulCovering);
if (fRoll < playMan->GetCritMod())
{
sDmg = 2u * RU.GetUInt((size_t)ev.valLow, (size_t)ev.valHigh);
enMan->SufferPhysicalDamage(sDmg); //crit
TD::DrawStringTimed(L"CRIT!", Vec2(RU.GetFloat(-0.5, 0.5), RU.GetFloat(-0.5, 0.5)), Colors::Red, 0.1);
TD::DrawStringTimed(std::to_wstring(sDmg), Vec2(RU.GetFloat(-0.5, 0.5), RU.GetFloat(-0.5, 0.5)), Colors::Yellow, 0.1);
sDmg = 2u * RU.GetUInt((size_t)ev.valLow, (size_t)ev.valHigh); //crit
enMan->SufferPhysicalDamage(sDmg);
crit = true;
AM::Alert(AM::Event::PlayerCrited);
SPI::Play(Sounds::CritWave, 0.5f, 1.4f);
}
......@@ -486,7 +513,6 @@ void CombatManager::HandleEvent(SkillEvent ev)
{
sDmg = RU.GetUInt((size_t)ev.valLow, (size_t)ev.valHigh);
enMan->SufferPhysicalDamage(sDmg);
TD::DrawStringTimed(std::to_wstring(sDmg), Vec2(RU.GetFloat(-0.5, 0.5), RU.GetFloat(-0.5, 0.5)), Colors::Yellow, 0.1);
}
break;
case EventType::Enemy_DecreaceAcc:
......@@ -499,6 +525,7 @@ void CombatManager::HandleEvent(SkillEvent ev)
enMan->Heal((size_t)ev.valHigh);
break;
case EventType::Enemy_PhysicalAttackedWithBleed:
attacked = true;
fRoll = RU.GetFloat0to1();
if (fRoll < playMan->GetCritMod())
{
......@@ -507,36 +534,32 @@ void CombatManager::HandleEvent(SkillEvent ev)
if (enMan->GetBlock() < sDmg)
{
enMan->AddBleed(OneBleedStackEmount);
enMan->SufferPhysicalDamage(sDmg); // bleed got through block
TD::DrawStringTimed(L"CRIT!", Vec2(RU.GetFloat(-0.5f, 0.5f), RU.GetFloat(-0.5f, 0.5f)), Colors::Red, 0.1f);
TD::DrawStringTimed(L"BLEED!", Vec2(RU.GetFloat(-0.5f, 0.5f), RU.GetFloat(-0.5f, 0.5f)), Colors::Red, 0.1f);
TD::DrawStringTimed(std::to_wstring(sDmg), Vec2(RU.GetFloat(-0.5f, 0.5f), RU.GetFloat(-0.5f, 0.5f)), Colors::Yellow, 0.1f);
enMan->SufferPhysicalDamage(sDmg); //bleed got through block
crit = true;
bleed = true;
AM::Alert(AM::Event::PlayerCrited);
SPI::Play(Sounds::CritWave, 0.6f, 1.5f);
}
else
{
enMan->SufferPhysicalDamage(sDmg); // bleed blocked
TD::DrawStringTimed(L"CRIT!", Vec2(RU.GetFloat(-0.5f, 0.5f), RU.GetFloat(-0.5f, 0.5f)), Colors::Red, 0.1f);
TD::DrawStringTimed(std::to_wstring(sDmg), Vec2(RU.GetFloat(-0.5f, 0.5f), RU.GetFloat(-0.5f, 0.5f)), Colors::Yellow, 0.1f);
enMan->SufferPhysicalDamage(sDmg); //bleed blocked
crit = true;
AM::Alert(AM::Event::PlayerCrited);
SPI::Play(Sounds::CritWave, 0.6f, 1.5f);
}
}
else
{
sDmg = RU.GetUInt((size_t)ev.valLow, (size_t)ev.valHigh); //hit
sDmg = RU.GetUInt((size_t)ev.valLow, (size_t)ev.valHigh); //hit
if (enMan->GetBlock() < sDmg)
{
enMan->AddBleed(OneBleedStackEmount);
enMan->SufferPhysicalDamage(sDmg); // bleed got through block
TD::DrawStringTimed(std::to_wstring(sDmg), Vec2(RU.GetFloat(-0.5f, 0.5f), RU.GetFloat(-0.5f, 0.5f)), Colors::Yellow, 0.1f);
TD::DrawStringTimed(L"BLEED!", Vec2(RU.GetFloat(-0.5f, 0.5f), RU.GetFloat(-0.5f, 0.5f)), Colors::Red, 0.1f);
enMan->SufferPhysicalDamage(sDmg); //bleed got through block
bleed = true;
}
else
{
enMan->SufferPhysicalDamage(sDmg); // bleed blocked
TD::DrawStringTimed(std::to_wstring(sDmg), Vec2(RU.GetFloat(-0.5f, 0.5f), RU.GetFloat(-0.5f, 0.5f)), Colors::Yellow, 0.1f);
enMan->SufferPhysicalDamage(sDmg); //bleed blocked
}
}
break;
......@@ -554,6 +577,8 @@ void CombatManager::HandleEvent(SkillEvent ev)
assert(false && "stray combat event detected! check switch statement");
break;
}
if (attacked)
DrawDamage(miss, sDmg, crit, bleed);
}
bool CombatManager::GetRewardMenuActiveness() const
......
......@@ -95,6 +95,8 @@ private:
killcount++;
if (killcount >= 5u)AM::Alert(AM::Event::PlayerKilled5Enemies);
}
void DrawDamage(bool missed = false, size_t dmg = 0u, bool crited = false, bool bleed = false) const;
void UpdateCombatData();
void HandleEvents();
void HandleEvent(SkillEvent ev);
......@@ -124,4 +126,6 @@ private:
static constexpr float critBuffEmount = 0.05f; //from reward menu
static constexpr float dodgeBuffEmount = 0.05f;
static constexpr float damageDigitsDrawingRange = 0.5f;
};
\ No newline at end of file
......@@ -154,71 +154,36 @@ DirectX::XMMATRIX HudElement::GetTransformXM() const noexcept
assert(posData->size() && "no positions bound for this object - can't draw");
currentObjectBeingDrawn++;
if (currentObjectBeingDrawn == posData->size())currentObjectBeingDrawn = 0;
DirectX::XMFLOAT4X4 store{ (*posData)[currentObjectBeingDrawn].pos.x,(*posData)[currentObjectBeingDrawn].pos.y,
(*posData)[currentObjectBeingDrawn].rot.x,0.0f,
0.0f, 0.0f, 0.0f, 0.0f,
0.0f, 0.0f, 0.0f, 0.0f,
0.0f, 0.0f, 0.0f, 0.0f };
if (!parentData.empty())
if (parentData.count(applyParentingToAllObjects))
{
auto at = parentData.at(applyParentingToAllObjects);
DirectX::XMMATRIX parentTransform = at.first->GetTransformXMSpecific(at.second);
DirectX::XMFLOAT4X4 parentDec;
DirectX::XMStoreFloat4x4(&parentDec, parentTransform);
store._11 *= parentDec._13;//scaling position offset
store._12 *= parentDec._13;//scaling position offset
store._11 += parentDec._11;//translating
store._12 += parentDec._12;//translating
store._13 *= parentDec._13;//scaling scale
} else if (parentData.count(currentObjectBeingDrawn))
{
auto at = parentData.at(currentObjectBeingDrawn);
DirectX::XMMATRIX parentTransform = at.first->GetTransformXMSpecific(at.second);
DirectX::XMFLOAT4X4 parentDec;
DirectX::XMStoreFloat4x4(&parentDec,parentTransform);
store._11 *= parentDec._13;//scaling position offset
store._12 *= parentDec._13;//scaling position offset
store._11 += parentDec._11;//translating
store._12 += parentDec._12;//translating
store._13 *= parentDec._13;//scaling scale
}
DirectX::XMMATRIX encoded = DirectX::XMLoadFloat4x4(&store);
return std::move(encoded);
return GetTransformXMSpecific(currentObjectBeingDrawn);
}
DirectX::XMMATRIX HudElement::GetTransformXMSpecific(size_t ind) const noexcept
{
DirectX::XMFLOAT4X4 store{ (*posData)[ind].pos.x,(*posData)[ind].pos.y,
(*posData)[ind].rot.x,0.0f,
0.0f, 0.0f, 0.0f, 0.0f,
0.0f, 0.0f, 0.0f, 0.0f,
0.0f, 0.0f, 0.0f, 0.0f };
(*posData)[ind].rot.x,0.0f,
0.0f, 0.0f, 0.0f, 0.0f,
0.0f, 0.0f, 0.0f, 0.0f,
0.0f, 0.0f, 0.0f, 0.0f };
if (!parentData.empty())
{
std::pair<const HudElement*, size_t> parDat;
if (parentData.count(applyParentingToAllObjects))
{
auto at = parentData.at(applyParentingToAllObjects);
DirectX::XMMATRIX parentTransform = at.first->GetTransformXMSpecific(at.second);
DirectX::XMFLOAT4X4 parentDec;
DirectX::XMStoreFloat4x4(&parentDec, parentTransform);
store._11 *= parentDec._13;//scaling position offset
store._12 *= parentDec._13;//scaling position offset
store._11 += parentDec._11;//translating
store._12 += parentDec._12;//translating
store._13 *= parentDec._13;//scaling scale
parDat = parentData.at(applyParentingToAllObjects);
}
else if (parentData.count(currentObjectBeingDrawn))
{
auto at = parentData.at(currentObjectBeingDrawn);
DirectX::XMMATRIX parentTransform = at.first->GetTransformXMSpecific(at.second);
DirectX::XMFLOAT4X4 parentDec;
DirectX::XMStoreFloat4x4(&parentDec, parentTransform);
store._11 *= parentDec._13;//scaling position offset
store._12 *= parentDec._13;//scaling position offset
store._11 += parentDec._11;//translating
store._12 += parentDec._12;//translating
store._13 *= parentDec._13;//scaling scale
parDat = parentData.at(currentObjectBeingDrawn);
}
DirectX::XMMATRIX parentTransform = parDat.first->GetTransformXMSpecific(parDat.second);
DirectX::XMFLOAT4X4 parentDec;
DirectX::XMStoreFloat4x4(&parentDec, parentTransform);
store._11 *= parentDec._13;//scaling position offset
store._12 *= parentDec._13;//scaling position offset
store._11 += parentDec._11;//translating
store._12 += parentDec._12;//translating
store._13 *= parentDec._13;//scaling scale
}
DirectX::XMMATRIX encoded = DirectX::XMLoadFloat4x4(&store);
return std::move(encoded);
}
......
......@@ -18,9 +18,6 @@ namespace dx = DirectX;
Game::Game():
wnd(L"Rifted Times"),
ll(wnd.DXGfx(),fc,cm),
td(wnd.DXGfx(),fc),
hud(menu,fc, wnd.DXGfx(),cm.GetPlayerManager().GetActionBox(),cm),
......
......@@ -92,21 +92,27 @@ void FillingBar::UpdateFillness(float fill, DXGraphics& gfx)
//enemy stuff
EnemyArmorBar::EnemyArmorBar(DXGraphics& gfx):FillingBar(gfx, L"Media//Sprites//EnemyBarArmorFull.png", L"Media//Sprites//EnemyBarArmorEmpty.png"){}
EnemyBar::EnemyArmorBar::EnemyArmorBar(DXGraphics& gfx):FillingBar(gfx, L"Media//Sprites//EnemyBarArmorFull.png", L"Media//Sprites//EnemyBarArmorEmpty.png"){}
EnemyHPBar::EnemyHPBar(DXGraphics& gfx):FillingBar(gfx, L"Media//Sprites//EnemyBarHPFull.png", L"Media//Sprites//EnemyBarHPEmty.png") {}
EnemyBar::EnemyHPBar::EnemyHPBar(DXGraphics& gfx):FillingBar(gfx, L"Media//Sprites//EnemyBarHPFull.png", L"Media//Sprites//EnemyBarHPEmty.png") {}
EnemyBarHolder::EnemyBarHolder(DXGraphics& gfx):HudElement(L"Media//Sprites//EnemyBarHolder.png",gfx){}
EnemyBar::EnemyBarHolder::EnemyBarHolder(DXGraphics& gfx):HudElement(L"Media//Sprites//EnemyBarHolder.png",gfx){}
EnemyBar::EnemyBar(DXGraphics& gfx):arm(gfx),hp(gfx),holder(gfx),cover(gfx)
EnemyBar::EnemyBar(DXGraphics& gfx):
arm(gfx),
hp(gfx),
holder(gfx),
cover(gfx),
eye(gfx)
{
arm.AddParent(&holder);
hp.AddParent(&holder);
cover.AddParent(&holder);
arm.AddDrawingPosition({ 0.067f,-0.265f,0.86f });
hp.AddDrawingPosition({ 0.10f,-0.11f,0.892f });
arm. AddParent(&holder);
hp. AddParent(&holder);
cover. AddParent(&holder);
eye. AddParent(&holder);
arm.AddDrawingPosition({ 0.067f,-0.265f,0.86f });
hp. AddDrawingPosition({ 0.10f, -0.11f, 0.892f });
holder.BindPositionData(&holderPosition);
cover.BindPositionData(&coverPosition);
cover. BindPositionData(&coverPosition);
holderPosition.emplace_back( -0.69f,0.785f,0.315f );
coverPosition.emplace_back(-0.77f, -0.12f, 0.29f);
}
......@@ -117,15 +123,17 @@ void EnemyBar::Submit(FrameCommander& fc) const
arm.SmartSubmit(fc);
hp.SmartSubmit(fc);
cover.SmartSubmit(fc);
eye.SmartSubmit(fc);
}
void EnemyBar::UpdateFillness(float hpFill, float armFill, DXGraphics& gfx)
void EnemyBar::UpdateFillness(float hpFill, float armFill, DXGraphics& gfx, float additionalData)
{
arm.UpdateFillness(armFill, gfx);
hp.UpdateFillness(hpFill, gfx);
eye.UpdateScale(additionalData);
}
EnemyBarCover::EnemyBarCover(DXGraphics& gfx) :HudElement(L"Media//Sprites//EnemyBarCover.png", gfx) {}
EnemyBar::EnemyBarCover::EnemyBarCover(DXGraphics& gfx) :HudElement(L"Media//Sprites//EnemyBarCover.png", gfx) {}
//player stuff
......@@ -135,7 +143,11 @@ PlayerHPBar::PlayerHPBar(DXGraphics& gfx) : FillingBar(gfx, L"Media//Sprites//Pl
PlayerBarHolder::PlayerBarHolder(DXGraphics& gfx) : HudElement(L"Media//Sprites//PlayerBarHolder.png", gfx) {}
PlayerBar::PlayerBar(DXGraphics& gfx) : arm(gfx), hp(gfx), holder(gfx), cover(gfx)
PlayerBar::PlayerBar(DXGraphics& gfx) :
arm(gfx),
hp(gfx),
holder(gfx),
cover(gfx)
{
arm.AddParent(&holder);
hp.AddParent(&holder);
......@@ -156,10 +168,21 @@ void PlayerBar::Submit(FrameCommander& fc) const
cover.SmartSubmit(fc);
}
void PlayerBar::UpdateFillness(float hpFill, float armFill, DXGraphics& gfx)
void PlayerBar::UpdateFillness(float hpFill, float armFill, DXGraphics& gfx, float additionalData)
{
arm.UpdateFillness(armFill, gfx);
hp.UpdateFillness(hpFill, gfx);
}
PlayerBarCover::PlayerBarCover(DXGraphics& gfx) :HudElement(L"Media//Sprites//PlayerBarCover.png", gfx) {}
EnemyBar::EnemyEye::EnemyEye(DXGraphics& gfx):HudElement(L"Media//Sprites//EnemyBarEye.png",gfx)
{
posData.emplace_back(-0.375f, 0.415f, 0.0f);
BindPositionData(&posData);
}
void EnemyBar::EnemyEye::UpdateScale(float scale)
{
posData[0].rot.x = scale-0.5f;
}
......@@ -32,46 +32,54 @@ protected:
public:
virtual ~EntityBar() = default;
virtual void Submit(FrameCommander& fc) const = 0;
virtual void UpdateFillness(float hpFill, float armFill, DXGraphics& gfx) = 0;
virtual void UpdateFillness(float hpFill, float armFill, DXGraphics& gfx, float additionalData = 0.0f) = 0;
};
class EnemyArmorBar : public FillingBar
class EnemyBar : public EntityBar
{
public:
EnemyArmorBar(DXGraphics& gfx);
};
class EnemyArmorBar : public FillingBar
{
friend class EnemyBar;
EnemyArmorBar(DXGraphics& gfx);
};
class EnemyHPBar : public FillingBar
{
public:
EnemyHPBar(DXGraphics& gfx);
};
class EnemyHPBar : public FillingBar
{
friend class EnemyBar;
EnemyHPBar(DXGraphics& gfx);
};
class EnemyBarHolder : public HudElement
{
public:
EnemyBarHolder(DXGraphics& gfx);
};
class EnemyBarHolder : public HudElement
{
friend class EnemyBar;
EnemyBarHolder(DXGraphics& gfx);
};
class EnemyBarCover : public HudElement
{
public:
EnemyBarCover(DXGraphics& gfx);
};
class EnemyBarCover : public HudElement
{
friend class EnemyBar;
EnemyBarCover(DXGraphics& gfx);
};
class EnemyBar : public EntityBar
{
class EnemyEye : public HudElement
{
public:
EnemyEye(DXGraphics& gfx);
void UpdateScale(float scale);
private:
std::vector<PositionData> posData;
};
public:
EnemyBar(DXGraphics& gfx);
void Submit(FrameCommander& fc) const override;
void UpdateFillness(float hpFill,float armFill, DXGraphics& gfx) override; // hp/maxHP ie
void UpdateFillness(float hpFill,float armFill, DXGraphics& gfx, float enemySpeed = 0.0f) override; // hp/maxHP ie
private:
EnemyArmorBar arm;
EnemyHPBar hp;
EnemyBarHolder holder;
EnemyBarCover cover;
EnemyEye eye;
};
......@@ -106,7 +114,7 @@ class PlayerBar : public EntityBar
public:
PlayerBar(DXGraphics& gfx);
void Submit(FrameCommander& fc) const override;
void UpdateFillness(float hpFill, float armFill, DXGraphics& gfx) override; // hp/maxHP ie
void UpdateFillness(float hpFill, float armFill, DXGraphics& gfx, float additionalData = 0.0f) override; // hp/maxHP ie
private:
PlayerArmorBar arm;
PlayerHPBar hp;
......
......@@ -5,13 +5,13 @@ StatusBar::StatusBar(const CombatData& cd, DXGraphics& gfx, PositionData pos, St
{
bar = std::make_unique<PlayerBar>(gfx);
healthOffset = Vec2{ -0.65f,-0.87f };
blockOffset = Vec2{ -0.59f,-0.823f };
blockOffset = Vec2 { -0.59f,-0.823f};
}
else
{
bar = std::make_unique<EnemyBar>(gfx);
healthOffset = Vec2{ -0.68f,0.77f };
blockOffset = Vec2{ -0.67f,0.725f };
healthOffset = Vec2{ -0.68f,0.748f };
blockOffset = Vec2 { -0.67f,0.705f };
}
}
......@@ -23,7 +23,7 @@ void StatusBar::UpdateStatus(DXGraphics& gfx)
}
else
{
bar->UpdateFillness((float)cd.enemyHP / (float)cd.enemyMaxHP, (float)cd.enemyBlock / (float)cd.enemyMaxHP, gfx);
bar->UpdateFillness((float)cd.enemyHP / (float)cd.enemyMaxHP, (float)cd.enemyBlock / (float)cd.enemyMaxHP, gfx,cd.enemySpeed);
}
}
......@@ -39,18 +39,21 @@ void PlayerStatusBar::SmartSubmit(FrameCommander& fc) const
bar->Submit(fc);
critIcon.SmartSubmit(fc);
dodgeIcon.SmartSubmit(fc);
TD::DrawString(std::to_wstring(cd.playerHP) + L"/" + std::to_wstring(cd.playerMaxHP), healthOffset, Colors::White, 0.02f);
if(cd.playerBlock!=0u) TD::DrawString(std::to_wstring(cd.playerBlock), blockOffset, Colors::White, 0.02f);
//text drawing
TD::DrawString(std::to_wstring(cd.playerHP) + L"/" + std::to_wstring(cd.playerMaxHP), healthOffset, Colors::White, textSize);
if(cd.playerBlock!=0u)
TD::DrawString(std::to_wstring(cd.playerBlock), blockOffset, Colors::White, textSize);
//handling ascending text
if (previousCD.playerBlock > cd.playerBlock)
TD::DrawStringAscending(std::to_wstring((int)cd.playerBlock - (int)previousCD.playerBlock), blockOffset, Colors::LightBlue, 0.02f);
else if(previousCD.playerBlock < cd.playerBlock)
TD::DrawStringAscending(L"+" + std::to_wstring(cd.playerBlock - previousCD.playerBlock), blockOffset, Colors::LightBlue, 0.02f);
if (previousCD.playerBlock > cd.playerBlock)
TD::DrawStringAscending( std::to_wstring((int)cd.playerBlock - (int)previousCD.playerBlock), blockOffset, Colors::LightBlue, textSize);
else if(previousCD.playerBlock < cd.playerBlock)
TD::DrawStringAscending(L"+" + std::to_wstring( cd.playerBlock - previousCD.playerBlock), blockOffset, Colors::LightBlue, textSize);
if (previousCD.playerHP > cd.playerHP)
TD::DrawStringAscending(std::to_wstring((int)cd.playerHP - (int)previousCD.playerHP), healthOffset, Colors::Red, 0.02f);
else if (previousCD.playerHP < cd.playerHP)
TD::DrawStringAscending(L"+" + std::to_wstring(cd.playerHP - previousCD.playerHP), healthOffset, Colors::Green, 0.02f);
if (previousCD.playerHP > cd.playerHP)
TD::DrawStringAscending( std::to_wstring((int)cd.playerHP - (int)previousCD.playerHP), healthOffset, Colors::Red, textSize);
else if (previousCD.playerHP < cd.playerHP)
TD::DrawStringAscending(L"+" + std::to_wstring(cd.playerHP - previousCD.playerHP), healthOffset, Colors::Green, textSize);
previousCD.playerHP = cd.playerHP;
previousCD.playerMaxHP = cd.playerMaxHP;
......@@ -68,19 +71,21 @@ void EnemyStatusBar::SmartSubmit(FrameCommander& fc) const
}
accIcon.SmartSubmit(fc);
bar->Submit(fc);
TD::DrawString(std::to_wstring(cd.enemyHP) + L"/" + std::to_wstring(cd.enemyMaxHP), healthOffset, Colors::White, 0.02f);
if (cd.enemyBlock != 0u) TD::DrawString(std::to_wstring(cd.enemyBlock), blockOffset, Colors::White, 0.02f);
//text drawing
TD::DrawString(std::to_wstring(cd.enemyHP) + L"/" + std::to_wstring(cd.enemyMaxHP), healthOffset, Colors::White, textSize);
if (cd.enemyBlock != 0u)
TD::DrawString(std::to_wstring(cd.enemyBlock), blockOffset, Colors::White, textSize);
//handling ascending text
if (previousCD.enemyBlock > cd.enemyBlock)
TD::DrawStringAscending(std::to_wstring((int)cd.enemyBlock - (int)previousCD.enemyBlock), blockOffset, Colors::LightBlue, 0.02f, 1.0f, -0.3f);
TD::DrawStringAscending( std::to_wstring((int)cd.enemyBlock - (int)previousCD.enemyBlock), blockOffset, Colors::LightBlue, textSize, 1.0f, -textSpeed);
else if (previousCD.enemyBlock < cd.enemyBlock)
TD::DrawStringAscending(L"+"+std::to_wstring(cd.enemyBlock - previousCD.enemyBlock), blockOffset, Colors::LightBlue, 0.02f, 1.0f, -0.3f);
TD::DrawStringAscending(L"+" + std::to_wstring(cd.enemyBlock - previousCD.enemyBlock), blockOffset, Colors::LightBlue, textSize, 1.0f, -textSpeed);
if (previousCD.enemyHP > cd.enemyHP)
TD::DrawStringAscending(std::to_wstring((int)cd.enemyHP - (int)previousCD.enemyHP), healthOffset, Colors::Red, 0.02f, 1.0f, -0.3f);
TD::DrawStringAscending( std::to_wstring((int)cd.enemyHP - (int)previousCD.enemyHP), healthOffset, Colors::Red, textSize, 1.0f, -textSpeed);
else if (previousCD.enemyHP < cd.enemyHP)
TD::DrawStringAscending(L"+" + std::to_wstring(cd.enemyHP - previousCD.enemyHP), healthOffset, Colors::Green, 0.02f, 1.0f, -0.3f);
TD::DrawStringAscending(L"+" + std::to_wstring(cd.enemyHP - previousCD.enemyHP), healthOffset, Colors::Green, textSize, 1.0f, -textSpeed);
previousCD.enemyHP = cd.enemyHP;
previousCD.enemyMaxHP = cd.enemyMaxHP;
......
......@@ -10,7 +10,7 @@ public:
virtual void UpdateStatus(DXGraphics& gfx);
void SmartSubmit(FrameCommander& fc)const override = 0;
void SmartSubmit(FrameCommander& fc)const override = 0;
protected:
std::unique_ptr<EntityBar> bar;
const CombatData& cd;
......@@ -18,6 +18,8 @@ protected:
StatusOwner owner;
Vec2 blockOffset;
Vec2 healthOffset;
static constexpr float textSpeed = 0.15f;
static constexpr float textSize = 0.02f;
};
class PlayerStatusBar : public StatusBar
......@@ -26,7 +28,7 @@ public:
PlayerStatusBar(const CombatData& cd, DXGraphics& gfx) :
StatusBar(cd, gfx, PositionData(-0.6f, -0.8f, 0.35f),StatusOwner::Player),
bleedIcon(gfx, StatusOwner::Player),
critIcon(gfx, StatusOwner::Player),
critIcon( gfx, StatusOwner::Player),
dodgeIcon(gfx, StatusOwner::Player)
{};
void SmartSubmit(FrameCommander& fc)const override;
......@@ -40,7 +42,7 @@ class EnemyStatusBar : public StatusBar
public:
EnemyStatusBar(const CombatData& cd, DXGraphics& gfx) :
StatusBar(cd, gfx, PositionData(-0.6f, 0.8f, 0.35f), StatusOwner::Enemy),
accIcon(gfx, StatusOwner::Enemy),
accIcon (gfx, StatusOwner::Enemy),
bleedIcon(gfx, StatusOwner::Enemy)
{};
void SmartSubmit(FrameCommander& fc)const override;
......
......@@ -5,9 +5,9 @@ WASDPanel::WASDPanel(DXGraphics& gfx):
HudElement(L"Media\\Sprites\\WASDPanel.png", gfx)
{
for (size_t i = 0; i < 4u; i++)panelPositions.emplace_back();
panelPositions[0].emplace_back(-0.004f, 0.58f, 0.53f);
panelPositions[1].emplace_back(-0.642f, -0.532f, 0.53f);
panelPositions[2].emplace_back(-0.01f, -0.532f, 0.53f);
panelPositions[0].emplace_back(-0.004f, 0.58f, 0.53f);
panelPositions[1].emplace_back(-0.642f, -0.532f, 0.53f);
panelPositions[2].emplace_back(-0.01f, -0.532f, 0.53f);
panelPositions[3].emplace_back(0.637f, -0.532f, 0.53f);
BindPositionData(&myPosData);
}
......@@ -118,19 +118,19 @@ ABox::ABox(DXGraphics& gfx, const ActionBox& actBox) :
skillIconInfo(actBox.GetPickedSkillsInfo()),
skillMicroiconPositionReferences(L"Media\\Sprites\\blank.png", gfx)
{
skills.emplace(std::make_pair(Skill0::Cut, std::make_unique<HudElement>(L"Media//Sprites//SkillSheet.png", gfx, 1, 7, 1)));
skills.emplace(std::make_pair(Skill0::Deflect, std::make_unique<HudElement>(L"Media//Sprites//SkillSheet.png", gfx, 2, 7, 1)));
skills.emplace(std::make_pair(Skill0::SandStorm, std::make_unique<HudElement>(L"Media//Sprites//SkillSheet.png", gfx, 3, 7, 1)));
skills.emplace(std::make_pair(Skill0::SharpenTheBlade, std::make_unique<HudElement>(L"Media//Sprites//SkillSheet.png", gfx, 4, 7, 1)));
skills.emplace(std::make_pair(Skill0::SandsOfTime, std::make_unique<HudElement>(L"Media//Sprites//SkillSheet.png", gfx, 5, 7, 1)));
skills.emplace(std::make_pair(Skill0::DustThrow, std::make_unique<HudElement>(L"Media//Sprites//SkillSheet.png", gfx, 6, 7, 1)));
skills.emplace(std::make_pair(Skill0::CutBlocked, std::make_unique<HudElement>(L"Media//Sprites//SkillSheetBlocked.png", gfx, 1, 7, 1)));
skills.emplace(std::make_pair(Skill0::DeflectBlocked, std::make_unique<HudElement>(L"Media//Sprites//SkillSheetBlocked.png", gfx, 2, 7, 1)));
skills.emplace(std::make_pair(Skill0::SandStormBlocked, std::make_unique<HudElement>(L"Media//Sprites//SkillSheetBlocked.png", gfx, 3, 7, 1)));
skills.emplace(std::make_pair(Skill0::SharpenTheBladeBlocked, std::make_unique<HudElement>(L"Media//Sprites//SkillSheetBlocked.png", gfx, 4, 7, 1)));
skills.emplace(std::make_pair(Skill0::SandsOfTimeBlocked, std::make_unique<HudElement>(L"Media//Sprites//SkillSheetBlocked.png", gfx, 5, 7, 1)));
skills.emplace(std::make_pair(Skill0::DustThrowBlocked, std::make_unique<HudElement>(L"Media//Sprites//SkillSheetBlocked.png", gfx, 6, 7, 1)));
skills.emplace(std::make_pair(Skill0::Cut, std::make_unique<HudElement>(L"Media//Sprites//SkillSheet.png", gfx, 1, 7, 1)));
skills.emplace(std::make_pair(Skill0::Deflect, std::make_unique<HudElement>(L"Media//Sprites//SkillSheet.png", gfx, 2, 7, 1)));
skills.emplace(std::make_pair(Skill0::SandStorm, std::make_unique<HudElement>(L"Media//Sprites//SkillSheet.png", gfx, 3, 7, 1)));
skills.emplace(std::make_pair(Skill0::SharpenTheBlade, std::make_unique<HudElement>(L"Media//Sprites//SkillSheet.png", gfx, 4,