Skip to content

Commit

Permalink
Merge remote-tracking branch 'refs/remotes/origin/main' into develop
Browse files Browse the repository at this point in the history
# Conflicts:
#	conanfile.py
  • Loading branch information
Hammie committed Apr 9, 2024
2 parents 9f9f169 + e599a1c commit 8f2c250
Show file tree
Hide file tree
Showing 20 changed files with 343 additions and 178 deletions.
48 changes: 24 additions & 24 deletions .github/workflows/release_beta.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,57 +3,57 @@ name: Prepare BETA release
on:
push:
tags:
- "beta[0-9]+"
- "pa*"

jobs:
build-windows:
runs-on: windows-2019
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
configuration: [msvc-debug, msvc-release]
configuration: [debug, release]
enable_steam: [false]
include:
- enable_steam: true
configuration: msvc-release
name: 'build-windows [${{ matrix.configuration }}, steam: ${{ matrix.enable_steam }}]'
# include:
# - enable_steam: true
# configuration: msvc-release
name: 'Windows [${{ matrix.configuration }}, steam: ${{ matrix.enable_steam }}]'
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
submodules: 'recursive'
- uses: ilammy/msvc-dev-cmd@v1
- name: Install Conan
run: pip install conan
- name: Configure with CMakeSettings.json and build
uses: lukka/run-cmake@v3
with:
cmakeListsOrSettingsJson: CMakeSettingsJson
cmakeSettingsJsonPath: '${{ github.workspace }}/CMakeSettings.json'
useVcpkgToolchainFile: false
buildDirectory: '${{ github.workspace }}/build'
configurationRegexFilter: '${{ matrix.configuration }}'
cmakeAppendedArgs: '-DSTORM_ENABLE_STEAM=${{ matrix.enable_steam }} -DSTORM_ENABLE_CRASH_REPORTS=ON'
run: pip install conan==1.62.0
- uses: lukka/get-cmake@latest
- name: Configure CMake w/ Conan
run: |
conan profile new default --detect
conan profile update conf.tools.system.package_manager:mode=install default
conan profile update conf.tools.system.package_manager:sudo=True default
cmake --preset=default
- name: Build
run: cmake --build --preset=${{ matrix.configuration }} -DSTORM_ENABLE_STEAM=${{ matrix.enable_steam }} -DSTORM_ENABLE_CRASH_REPORTS=ON
- name: Upload artifact
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
name: storm-engine.${{ matrix.configuration }}-steam-${{ matrix.enable_steam }}
path: build\${{ matrix.configuration }}\bin
path: build/default/${{ matrix.configuration }}
- name: Archive release
uses: papeloto/action-zip@v1
with:
files: build\${{ matrix.configuration }}\bin
files: build/default/${{ matrix.configuration }}
recursive: true
dest: storm-engine.${{ matrix.configuration }}-steam-${{ matrix.enable_steam }}.zip
- name: Publish release
uses: softprops/action-gh-release@v1
with:
draft: true
draft: contains(github.ref, 'beta')
files: storm-engine.${{ matrix.configuration }}-steam-${{ matrix.enable_steam }}.zip
- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: '12'
node-version: '16'
- name: Upload debug symbols
run: |
npm install @sentry/cli
./node_modules/.bin/sentry-cli --auth-token ${{ secrets.SENTRY_AUTH_TOKEN }} upload-dif -o piratesahoy -p storm-engine -t pe -t pdb "build\${{ matrix.configuration }}\bin"
./node_modules/.bin/sentry-cli --auth-token ${{ secrets.SENTRY_AUTH_TOKEN }} debug-files upload -o piratesahoy -p storm-engine -t pe -t pdb "build/default/${{ matrix.configuration }}"
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ endif()

### Set up third-party dependencies
set(ENV{CONAN_REVISIONS_ENABLED} 1)
conan_add_remote(NAME storm
URL https://storm.jfrog.io/artifactory/api/conan/conan-remote
conan_add_remote(NAME piratesahoy
URL https://gitlab.com/api/v4/projects/54068744/packages/conan
VERIFY_SSL True
)
normalize_booleans(STORM_ENABLE_CRASH_REPORTS STORM_ENABLE_STEAM STORM_USE_CONAN_SDL)
Expand Down
6 changes: 3 additions & 3 deletions conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ class StormEngine(ConanFile):

# dependencies used in deploy binaries
# conan-center
requires = ["zlib/1.2.13", "spdlog/1.9.2", "fast_float/3.4.0", "mimalloc/2.0.3", "sentry-native/0.6.5", "tomlplusplus/3.3.0", "nlohmann_json/3.11.2",
requires = ["zlib/1.2.13", "spdlog/1.13.0", "fast_float/3.4.0", "mimalloc/2.0.3", "sentry-native/0.6.5", "tomlplusplus/3.3.0", "nlohmann_json/3.11.2",
"imgui/1.90-docking",
"cli11/2.3.2",
# storm.jfrog.io
"directx/9.0@storm/prebuilt", "fmod/2.02.05@storm/prebuilt"]
# gitlab.com/piratesahoy
"directx/9.0@piratesahoy+storm-engine/stable", "fmod/2.02.05@piratesahoy+storm-engine/stable"]
# aux dependencies (e.g. for tests)
build_requires = "catch2/2.13.7"

Expand Down
5 changes: 3 additions & 2 deletions src/apps/engine/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include "logging.hpp"
#include "os_window.hpp"
#include "steam_api.hpp"
#include "storm/engine_settings.hpp"
#include "v_sound_service.h"
#include "watermark.hpp"

Expand Down Expand Up @@ -61,7 +62,7 @@ void mimalloc_fun(const char *msg, void *arg)
static std::filesystem::path mimalloc_log_path;
if (mimalloc_log_path.empty())
{
mimalloc_log_path = fs::GetLogsPath() / "mimalloc.log";
mimalloc_log_path =storm::GetEngineSettings().GetEnginePath(storm::EngineSettingsPathType::Logs) / "mimalloc.log";
std::error_code ec;
remove(mimalloc_log_path, ec);
}
Expand Down Expand Up @@ -177,7 +178,7 @@ int main(int argc, char *argv[])
}

// Init stash
create_directories(fs::GetSaveDataPath());
create_directories(storm::GetEngineSettings().GetEnginePath(storm::EngineSettingsPathType::SaveData));

// Init logging
spdlog::set_default_logger(storm::logging::getOrCreateLogger(defaultLoggerName));
Expand Down
201 changes: 105 additions & 96 deletions src/libs/blade/src/blade.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,127 +51,133 @@ BLADE::BLADE_INFO::~BLADE_INFO()
void BLADE::BLADE_INFO::DrawBlade(VDX9RENDER *rs, unsigned int blendValue, MODEL *mdl, NODE *manNode)
{
auto *obj = static_cast<MODEL *>(core.GetEntityPointer(eid));
if (obj != nullptr)
if (obj == nullptr)
{
CMatrix perMtx;
return;
}

auto *bladeNode = obj->GetNode(0);
if ((blendValue & 0xff000000) == 0xff000000)
{
bladeNode->SetTechnique("EnvAmmoShader");
}
else
{
bladeNode->SetTechnique("AnimationBlend");
}
int32_t sti = -1;
auto idBlade = manNode->geo->FindName(locatorName);
auto *bladeNode = obj->GetNode(0);
if (bladeNode == nullptr)
{
return;
}

if ((sti = manNode->geo->FindLabelN(sti + 1, idBlade)) > -1)
{
auto *ani = mdl->GetAnimation();
auto *bones = &ani->GetAnimationMatrix(0);
CMatrix perMtx;
if ((blendValue & 0xff000000) == 0xff000000)
{
bladeNode->SetTechnique("EnvAmmoShader");
}
else
{
bladeNode->SetTechnique("AnimationBlend");
}
int32_t sti = -1;
auto idBlade = manNode->geo->FindName(locatorName);

GEOS::LABEL lb;
manNode->geo->GetLabel(sti, lb);
CMatrix mt;
mt.Vx() = CVECTOR(lb.m[0][0], lb.m[0][1], lb.m[0][2]);
mt.Vy() = CVECTOR(lb.m[1][0], lb.m[1][1], lb.m[1][2]);
mt.Vz() = CVECTOR(lb.m[2][0], lb.m[2][1], lb.m[2][2]);
mt.Pos() = CVECTOR(lb.m[3][0], lb.m[3][1], lb.m[3][2]);
if ((sti = manNode->geo->FindLabelN(sti + 1, idBlade)) > -1)
{
auto *ani = mdl->GetAnimation();
auto *bones = &ani->GetAnimationMatrix(0);

auto mbn = mt * bones[lb.bones[0]];
GEOS::LABEL lb;
manNode->geo->GetLabel(sti, lb);
CMatrix mt;
mt.Vx() = CVECTOR(lb.m[0][0], lb.m[0][1], lb.m[0][2]);
mt.Vy() = CVECTOR(lb.m[1][0], lb.m[1][1], lb.m[1][2]);
mt.Vz() = CVECTOR(lb.m[2][0], lb.m[2][1], lb.m[2][2]);
mt.Pos() = CVECTOR(lb.m[3][0], lb.m[3][1], lb.m[3][2]);

auto mbn = mt * bones[lb.bones[0]];
#ifndef _WIN32 // FIX_LINUX DirectXMath
mbn.Pos().x *= -1.0f;
mbn.Vx().x *= -1.0f;
mbn.Vy().x *= -1.0f;
mbn.Vz().x *= -1.0f;
mbn.Pos().x *= -1.0f;
mbn.Vx().x *= -1.0f;
mbn.Vy().x *= -1.0f;
mbn.Vz().x *= -1.0f;
#endif
CMatrix scl;
scl.Vx().x = -1.0f;
scl.Vy().y = 1.0f;
scl.Vz().z = 1.0f;
mbn.EqMultiply(scl, CMatrix(mbn));
CMatrix scl;
scl.Vx().x = -1.0f;
scl.Vy().y = 1.0f;
scl.Vz().z = 1.0f;
mbn.EqMultiply(scl, CMatrix(mbn));

perMtx = mbn * mdl->mtx;
}
obj->mtx = perMtx;
obj->ProcessStage(Stage::realize, 0);
perMtx = mbn * mdl->mtx;
}
obj->mtx = perMtx;
obj->ProcessStage(Stage::realize, 0);

//--------------------------------------------------------------------------
rs->SetTexture(0, nullptr);
rs->SetTransform(D3DTS_WORLD, CMatrix());
//--------------------------------------------------------------------------
rs->SetTexture(0, nullptr);
rs->SetTransform(D3DTS_WORLD, CMatrix());

// move to the beginning
int32_t first = 0; // end vertex 2 draw
for (int32_t v = WAY_LENGTH - 2; v > -1; v--)
{
vrt[v * 2 + 2] = vrt[v * 2 + 0];
vrt[v * 2 + 3] = vrt[v * 2 + 1];
vrtTime[v + 1] = vrtTime[v + 0];
// move to the beginning
int32_t first = 0; // end vertex 2 draw
for (int32_t v = WAY_LENGTH - 2; v > -1; v--)
{
vrt[v * 2 + 2] = vrt[v * 2 + 0];
vrt[v * 2 + 3] = vrt[v * 2 + 1];
vrtTime[v + 1] = vrtTime[v + 0];

if (vrtTime[v + 1] + lifeTime <= time)
continue;
if (vrtTime[v + 1] + lifeTime <= time)
continue;

first++;
first++;

auto blend = (time - vrtTime[v + 1]) / lifeTime;
auto blend = (time - vrtTime[v + 1]) / lifeTime;

auto fcol0 = static_cast<float>((color[0] >> 24) & 0xFF);
auto fcol1 = static_cast<float>((color[1] >> 24) & 0xFF);
auto a = static_cast<uint32_t>(fcol0 + blend * (fcol1 - fcol0));
auto fcol0 = static_cast<float>((color[0] >> 24) & 0xFF);
auto fcol1 = static_cast<float>((color[1] >> 24) & 0xFF);
auto a = static_cast<uint32_t>(fcol0 + blend * (fcol1 - fcol0));

fcol0 = static_cast<float>((color[0] >> 16) & 0xFF);
fcol1 = static_cast<float>((color[1] >> 16) & 0xFF);
auto r = static_cast<uint32_t>(fcol0 + blend * (fcol1 - fcol0));
fcol0 = static_cast<float>((color[0] >> 16) & 0xFF);
fcol1 = static_cast<float>((color[1] >> 16) & 0xFF);
auto r = static_cast<uint32_t>(fcol0 + blend * (fcol1 - fcol0));

fcol0 = static_cast<float>((color[0] >> 8) & 0xFF);
fcol1 = static_cast<float>((color[1] >> 8) & 0xFF);
auto g = static_cast<uint32_t>(fcol0 + blend * (fcol1 - fcol0));
fcol0 = static_cast<float>((color[0] >> 8) & 0xFF);
fcol1 = static_cast<float>((color[1] >> 8) & 0xFF);
auto g = static_cast<uint32_t>(fcol0 + blend * (fcol1 - fcol0));

fcol0 = static_cast<float>((color[0] >> 0) & 0xFF);
fcol1 = static_cast<float>((color[1] >> 0) & 0xFF);
auto b = static_cast<uint32_t>(fcol0 + blend * (fcol1 - fcol0));
fcol0 = static_cast<float>((color[0] >> 0) & 0xFF);
fcol1 = static_cast<float>((color[1] >> 0) & 0xFF);
auto b = static_cast<uint32_t>(fcol0 + blend * (fcol1 - fcol0));

vrt[v * 2 + 2].diffuse = vrt[v * 2 + 3].diffuse = (a << 24) | (r << 16) | (g << 8) | b;
}
vrt[v * 2 + 2].diffuse = vrt[v * 2 + 3].diffuse = (a << 24) | (r << 16) | (g << 8) | b;
}

// search for start
sti = bladeNode->geo->FindLabelN(0, bladeNode->geo->FindName(bladeStart));
GEOS::LABEL lb;
// search for start
sti = bladeNode->geo->FindLabelN(0, bladeNode->geo->FindName(bladeStart));
GEOS::LABEL lb;
if (sti >= 0)
{
bladeNode->geo->GetLabel(sti, lb);
vrt[0].pos = perMtx * CVECTOR(lb.m[3][0], lb.m[3][1], lb.m[3][2]);
vrt[0].diffuse = color[0];
sti = bladeNode->geo->FindLabelN(0, bladeNode->geo->FindName(bladeEnd));
if (sti >= 0)
{
bladeNode->geo->GetLabel(sti, lb);
vrt[0].pos = perMtx * CVECTOR(lb.m[3][0], lb.m[3][1], lb.m[3][2]);
vrt[0].diffuse = color[0];
sti = bladeNode->geo->FindLabelN(0, bladeNode->geo->FindName(bladeEnd));
if (sti >= 0)
vrt[1].pos = perMtx * CVECTOR(lb.m[3][0], lb.m[3][1], lb.m[3][2]);
vrt[1].diffuse = color[0];
vrtTime[0] = time;

auto bDraw = rs->TechniqueExecuteStart("Blade");
if (bDraw)
{
bladeNode->geo->GetLabel(sti, lb);
vrt[1].pos = perMtx * CVECTOR(lb.m[3][0], lb.m[3][1], lb.m[3][2]);
vrt[1].diffuse = color[0];
vrtTime[0] = time;

auto bDraw = rs->TechniqueExecuteStart("Blade");
if (bDraw)
{
if (first > 0)
rs->DrawPrimitiveUP(D3DPT_TRIANGLESTRIP, FVF, first * 2, &vrt[0], sizeof vrt[0]);
}
while (rs->TechniqueExecuteNext())
{
}
if (first > 0)
rs->DrawPrimitiveUP(D3DPT_TRIANGLESTRIP, FVF, first * 2, &vrt[0], sizeof vrt[0]);
}
else
while (rs->TechniqueExecuteNext())
{
core.Trace("BLADE::Realize -> no find locator \"%s\", model \"%s\"", bladeEnd, bladeNode->GetName());
}
}
else
{
core.Trace("BLADE::Realize -> no find locator \"%s\", model \"%s\"", bladeStart, bladeNode->GetName());
core.Trace(R"(BLADE::Realize -> no find locator "%s", model "%s")", bladeEnd, bladeNode->GetName());
}
}
else
{
core.Trace(R"(BLADE::Realize -> no find locator "%s", model "%s")", bladeStart, bladeNode->GetName());
}
}

bool BLADE::BLADE_INFO::LoadBladeModel(MESSAGE &message)
Expand Down Expand Up @@ -275,13 +281,16 @@ void BLADE::Realize(uint32_t Delta_Time)
if (obj != nullptr)
{
auto *gunNode = obj->GetNode(0);
if ((blendValue & 0xff000000) == 0xff000000)
if (gunNode != nullptr)
{
gunNode->SetTechnique("EnvAmmoShader");
}
else
{
gunNode->SetTechnique("AnimationBlend");
if ((blendValue & 0xff000000) == 0xff000000)
{
gunNode->SetTechnique("EnvAmmoShader");
}
else
{
gunNode->SetTechnique("AnimationBlend");
}
}
sti = -1;
auto idGun = manNode->geo->FindName(gunLocName);
Expand Down
Loading

0 comments on commit 8f2c250

Please sign in to comment.