Working on scripts
This commit is contained in:
1 parent
c086fe1ef0
commit
4044acefb2
35 files changed
+107190
-185
No files matched your search
@@ -270,77 +270,6 @@ namespace ZL
|
||||
}
|
||||
}
|
||||
|
||||
bool Location::startDarklandsTransition()
|
||||
{
|
||||
if (darklandsFlashActive) return false;
|
||||
darklandsFlashActive = true;
|
||||
darklandsFlashFadingIn = true;
|
||||
darklandsFlashAlpha = 0.0f;
|
||||
return true;
|
||||
}
|
||||
|
||||
void Location::updateDarklandsFlash(int64_t deltaMs)
|
||||
{
|
||||
if (!darklandsFlashActive) return;
|
||||
static constexpr float kFadeDurationMs = 500.0f;
|
||||
const float step = static_cast<float>(deltaMs) / kFadeDurationMs;
|
||||
|
||||
if (darklandsFlashFadingIn) {
|
||||
darklandsFlashAlpha = min(darklandsFlashAlpha + step, 1.0f);
|
||||
if (darklandsFlashAlpha >= 1.0f) {
|
||||
isDarklands = !isDarklands;
|
||||
darklandsFlashFadingIn = false;
|
||||
}
|
||||
} else {
|
||||
darklandsFlashAlpha = max(darklandsFlashAlpha - step, 0.0f);
|
||||
if (darklandsFlashAlpha <= 0.0f) {
|
||||
darklandsFlashAlpha = 0.0f;
|
||||
darklandsFlashActive = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Location::drawDarklandsFlash()
|
||||
{
|
||||
if (darklandsFlashAlpha <= 0.001f) return;
|
||||
|
||||
const float W = static_cast<float>(Environment::projectionWidth);
|
||||
const float H = static_cast<float>(Environment::projectionHeight);
|
||||
|
||||
if (darklandsFlashQuadW != W || darklandsFlashQuadH != H) {
|
||||
darklandsFlashQuadW = W;
|
||||
darklandsFlashQuadH = H;
|
||||
VertexDataStruct data;
|
||||
data.PositionData = {
|
||||
{0.f, 0.f, 0.f}, {0.f, H, 0.f}, {W, H, 0.f},
|
||||
{W, H, 0.f}, {W, 0.f, 0.f}, {0.f, 0.f, 0.f}
|
||||
};
|
||||
data.TexCoordData = {
|
||||
{0.f, 0.f}, {0.f, 1.f}, {1.f, 1.f},
|
||||
{1.f, 1.f}, {1.f, 0.f}, {0.f, 0.f}
|
||||
};
|
||||
darklandsFlashQuad.data = std::move(data);
|
||||
darklandsFlashQuad.RefreshVBO();
|
||||
}
|
||||
|
||||
glEnable(GL_BLEND);
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
renderer.shaderManager.PushShader("darklands_flash");
|
||||
renderer.PushProjectionMatrix(0.0f, W, 0.0f, H, -10.0f, 10.0f);
|
||||
renderer.PushMatrix();
|
||||
renderer.LoadIdentity();
|
||||
|
||||
renderer.RenderUniform1f("uAlpha", darklandsFlashAlpha);
|
||||
renderer.DrawVertexRenderStruct(darklandsFlashQuad);
|
||||
|
||||
renderer.PopMatrix();
|
||||
renderer.PopProjectionMatrix();
|
||||
renderer.shaderManager.PopShader();
|
||||
|
||||
glDisable(GL_BLEND);
|
||||
}
|
||||
|
||||
void Location::setupNavigation(const std::vector<std::string>& paths)
|
||||
{
|
||||
navigationMapPaths = paths;
|
||||
@@ -777,7 +706,6 @@ namespace ZL
|
||||
if (npc) npc->drawHealthBar(renderer, currentView, proj);
|
||||
}
|
||||
}
|
||||
drawDarklandsFlash();
|
||||
}
|
||||
|
||||
void Location::drawShadowDepthPass()
|
||||
@@ -977,7 +905,6 @@ namespace ZL
|
||||
if (npc) npc->drawHealthBar(renderer, cameraViewMatrix, proj);
|
||||
}
|
||||
}
|
||||
drawDarklandsFlash();
|
||||
}
|
||||
|
||||
void Location::drawGameDarklands()
|
||||
@@ -1047,7 +974,6 @@ namespace ZL
|
||||
if (npc) npc->drawHealthBar(renderer, currentView, proj);
|
||||
}
|
||||
}
|
||||
drawDarklandsFlash();
|
||||
}
|
||||
|
||||
bool Location::setNavigationAreaAvailable(const std::string& areaName, bool available)
|
||||
@@ -1208,8 +1134,6 @@ namespace ZL
|
||||
|
||||
void Location::update(int64_t delta)
|
||||
{
|
||||
updateDarklandsFlash(delta);
|
||||
|
||||
for (auto& intObj : interactiveObjects) {
|
||||
intObj.update(delta);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user