Commit 356d861c authored by AL's avatar AL

smoother play button transition + skill event system fix

parent e55aafd5
......@@ -45,6 +45,7 @@ void CombatManager::StartBattle(size_t enemyID)
turnAnnouncer.SetAnnouncment(TurnAnnouncer::AnnTurn::SpawningEnemy);
UpdateCombatData();
timers.Stop();
SL::PendDistortion(SL::LightDistortionType::ExtraLongAndDark);
}
void CombatManager::EndBattle()
......@@ -97,6 +98,7 @@ void CombatManager::OnEnemyDeath()
turnAnnouncer.SetAnnouncment(TurnAnnouncer::AnnTurn::EnemyDead);
curTurn = Turn::EnemyDied;
enMan->SetState(EnemyCombat::State::GhoulDead);
playMan->EndTurn();
playMan->UpgradeRandomSkill(); //after each kill one skill is upgraded
AM::Alert(AM::Event::EnemyDied);
AM::Alert(AM::Event::TurnEnd);
......@@ -123,10 +125,10 @@ int CombatManager::ProcessInput(Keyboard::Event in_event) //why does it return
EndBattle();
}
//if (in_event.GetCode() == 'G') //for testing
//{
// SL::PendDistortion(SL::LightDistortionType::YellowSpark);
//}
if (in_event.GetCode() == 'G') //for testing
{
SL::PendDistortion(SL::LightDistortionType::ExtraLongAndDark);
}
if (in_event.GetCode() == 'H') //for testing
{
HudOverlay::BoostOverlay(0.3f);
......@@ -309,7 +311,7 @@ void CombatManager::UpdateCombatState(float dt)
UpdateCombatData();
ActionBox::TurnState boxState = playMan->UpdateTurnState(dt);
bool timerEnd = timers.UpdateTimer(dt);
if (timerEnd || enMan->IsDead()|| boxState== ActionBox::TurnState::Done|| boxState==ActionBox::TurnState::DoneAnimation)
if (timerEnd || boxState== ActionBox::TurnState::Done|| boxState==ActionBox::TurnState::DoneAnimation)
{
timers.Stop();
timers.SetActiveTimer(CombatTimers::ActiveTimer::NoActive);
......
......@@ -28,7 +28,8 @@ void SceneLight::UpdateAndBind(float dt, DXGraphics& gfx, DirectX::XMMATRIX came
{
currentDistortion = pendingDistortion;
currentDistortedTime = 0.0f;
if (currentDistortion == LightDistortionType::GreenWave|| currentDistortion == LightDistortionType::YellowSpark) currentDistortedTime+=0.7f; //reducing lifetime of some effects
if (currentDistortion == LightDistortionType::GreenWave || currentDistortion == LightDistortionType::YellowSpark) currentDistortedTime += 0.7f; //reducing lifetime of some effects
else if (currentDistortion == LightDistortionType::ExtraLongAndDark)currentDistortedTime -= extradarkProlongation; //increacing lifetime
pendingDistortion = LightDistortionType::NoDistortion;
}
if (currentDistortion != LightDistortionType::NoDistortion)
......@@ -53,6 +54,21 @@ void SceneLight::UpdateAndBind(float dt, DXGraphics& gfx, DirectX::XMMATRIX came
auto& bplb = basePosLightBuffer[i].m128_f32;
switch (currentDistortion)
{
case SceneLight::LightDistortionType::NoDistortion:
{
flickerEndPosLightBuffer[i] = {
basePosLightBuffer[i].m128_f32[0], //is not taking part in interpolation
RU.GetFloat(basePosLightBuffer[i].m128_f32[1] - positionFlickerAmount, basePosLightBuffer[i].m128_f32[1] + positionFlickerAmount),
RU.GetFloat(basePosLightBuffer[i].m128_f32[2] - positionFlickerAmount, basePosLightBuffer[i].m128_f32[2] + positionFlickerAmount),
0.0f
};
endIntBuffer[i] = RU.GetFloat(baseIntBuffer[i] - intencityFlickerAmount, baseIntBuffer[i] + intencityFlickerAmount);
float f = RU.GetFloat0to1(); //what color(red-to-yellow) will be target color for this flick
endDifBuffer[i] = _mm_add_ps(_mm_mul_ps(red, _mm_set1_ps(1.0f - f)), _mm_mul_ps(yellow, _mm_set1_ps(f)));
break;
}
case SceneLight::LightDistortionType::DarkeningFlicker:
{
flickerEndPosLightBuffer[i] = {
......@@ -127,8 +143,8 @@ void SceneLight::UpdateAndBind(float dt, DXGraphics& gfx, DirectX::XMMATRIX came
endDifBuffer[i].m128_f32[0] *= yellowBoostMode;
endDifBuffer[i].m128_f32[1] *= yellowBoostMode;
break;
}
case SceneLight::LightDistortionType::NoDistortion:
}
case SceneLight::LightDistortionType::ExtraLongAndDark:
{
flickerEndPosLightBuffer[i] = {
basePosLightBuffer[i].m128_f32[0], //is not taking part in interpolation
......@@ -137,7 +153,7 @@ void SceneLight::UpdateAndBind(float dt, DXGraphics& gfx, DirectX::XMMATRIX came
0.0f
};
endIntBuffer[i] = RU.GetFloat(baseIntBuffer[i] - intencityFlickerAmount, baseIntBuffer[i] + intencityFlickerAmount);
endIntBuffer[i] = RU.GetFloat(baseIntBuffer[i]*extradarkPower - intencityFlickerAmount, baseIntBuffer[i] * extradarkPower + intencityFlickerAmount);
float f = RU.GetFloat0to1(); //what color(red-to-yellow) will be target color for this flick
endDifBuffer[i] = _mm_add_ps(_mm_mul_ps(red, _mm_set1_ps(1.0f - f)), _mm_mul_ps(yellow, _mm_set1_ps(f)));
......
......@@ -17,6 +17,7 @@ public:
ColdEmbrace,
YellowSpark,
GreenWave,
ExtraLongAndDark,
NoDistortion
};
SceneLight(DXGraphics& gfx);
......@@ -93,20 +94,10 @@ private:
static constexpr float coldColortModB = 1.7f;
static constexpr float coldBrightMod = 1.1f;
static constexpr float extradarkProlongation = 2.0f;
static constexpr float extradarkPower = 0.2f;
float currentDistortedTime =0.0f;
LightDistortionType currentDistortion = LightDistortionType::NoDistortion;
static LightDistortionType pendingDistortion;
};
//potential intensityParam variants
//const Vec4 largeDiffuseIntencity { 40.3f,0.0f, 0.0f, 0.0f };
//const Vec4 largeAttenuationConst { 1.6f, 0.0f, 0.0f, 0.0f };
//const Vec4 largeAttenuationLinear { 3.0f, 0.0f, 0.0f, 0.0f };
//const Vec4 largeAttenuationQuadratic{ 10.0, 0.0f, 0.0f, 0.0f };
//
//const Vec4 smallDiffuseIntencity { 25.0f,0.0f, 0.0f, 0.0f };
//const Vec4 smallAttenuationConst { 2.6f, 0.0f, 0.0f, 0.0f };
//const Vec4 smallAttenuationLinear { 15.2f,0.0f, 0.0f, 0.0f };
//const Vec4 smallAttenuationQuadratic{ 28.0f,0.0f, 0.0f, 0.0f };
\ No newline at end of file
};
\ No newline at end of file
......@@ -29,6 +29,7 @@ bool SkillHandler::Update(float dt)
else
{
curTime = 0.0f;
acted = false;
return true;
}
}
......
......@@ -165,7 +165,8 @@ void Cut::Activate()
{
owner->AddEvent(SkillEvent(EventType::Enemy_PhysicalDamage, valLow, valHigh));
AM::Alert(AM::Event::PlayerUsedSwordStrike);
EH::AddEffect3D(EH::Effect::PlayerSwordAttack);
if(upgraded)EH::AddEffect3D(EH::Effect::PlayerSwordAttackUpgraded);
else EH::AddEffect3D(EH::Effect::PlayerSwordAttack);
}
void Cut::Upgrade()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment