diff --git a/ADVect/ADVect.cpp b/ADVect/ADVect.cpp index 6f79a90..9682cb8 100644 --- a/ADVect/ADVect.cpp +++ b/ADVect/ADVect.cpp @@ -127,7 +127,7 @@ namespace { void check() { anim.check(); } void change(const NVL::Environment::MarkupString& n, u16 speed) { current = n; - anim.kickoff(speed * n.length(), [n](NVL::Number x) { return static_cast(x * n.length()); }); + anim.kickoff(speed * n.length(), [this](NVL::Number x) { return static_cast(x * this->current.length()); }); } void draw() { if (anim.done) diff --git a/ADVect/Graphics.cpp b/ADVect/Graphics.cpp index 8e2b4c6..21cf682 100644 --- a/ADVect/Graphics.cpp +++ b/ADVect/Graphics.cpp @@ -253,14 +253,14 @@ namespace ADVect::Graphics { ImageTexture* GetImageTextureFromFile(const std::string& file) { if (imgs.find(file) == imgs.end()) { - ImageTexture img; if (auto i = get_image_texture(file)) { - img = *i; - imgs[file] = std::move(img); + imgs[file] = std::move(*i); return &imgs[file]; } + else return nullptr; } - return nullptr; + else + return &imgs[file]; } void DrawTextureStencilAlpha(const bgfx::TextureHandle& tex, i32 pos_x, i32 pos_y, u32 w, u32 h) { diff --git a/ADVect/runtime/SDL2.dll b/ADVect/runtime/SDL2.dll new file mode 100644 index 0000000..7f2b9fd Binary files /dev/null and b/ADVect/runtime/SDL2.dll differ diff --git a/ADVect/runtime/SourceHanSans-Bold.ttc b/ADVect/runtime/SourceHanSans-Bold.ttc new file mode 100644 index 0000000..de01d17 Binary files /dev/null and b/ADVect/runtime/SourceHanSans-Bold.ttc differ diff --git a/ADVect/runtime/SourceHanSans-Regular.ttc b/ADVect/runtime/SourceHanSans-Regular.ttc new file mode 100644 index 0000000..80e4ee2 Binary files /dev/null and b/ADVect/runtime/SourceHanSans-Regular.ttc differ diff --git a/ADVect/runtime/SourceHanSerif-Heavy.ttc b/ADVect/runtime/SourceHanSerif-Heavy.ttc new file mode 100644 index 0000000..976c1fc Binary files /dev/null and b/ADVect/runtime/SourceHanSerif-Heavy.ttc differ diff --git a/ADVect/runtime/SourceHanSerif-Regular.ttc b/ADVect/runtime/SourceHanSerif-Regular.ttc new file mode 100644 index 0000000..d37e3ce Binary files /dev/null and b/ADVect/runtime/SourceHanSerif-Regular.ttc differ diff --git a/ADVect/runtime/grad.png b/ADVect/runtime/grad.png new file mode 100644 index 0000000..c3b034f Binary files /dev/null and b/ADVect/runtime/grad.png differ diff --git a/ADVect/runtime/image.png b/ADVect/runtime/image.png new file mode 100644 index 0000000..86aa2c7 Binary files /dev/null and b/ADVect/runtime/image.png differ diff --git a/ADVect/runtime/image2.jpg b/ADVect/runtime/image2.jpg new file mode 100644 index 0000000..c99637b Binary files /dev/null and b/ADVect/runtime/image2.jpg differ diff --git a/ADVect/runtime/image3.png b/ADVect/runtime/image3.png new file mode 100644 index 0000000..27727d2 Binary files /dev/null and b/ADVect/runtime/image3.png differ diff --git a/ADVect/runtime/mmaker.png b/ADVect/runtime/mmaker.png new file mode 100644 index 0000000..19a74fe Binary files /dev/null and b/ADVect/runtime/mmaker.png differ diff --git a/ADVect/runtime/shaders/dx11/AlphaStencil.frag.bin b/ADVect/runtime/shaders/dx11/AlphaStencil.frag.bin new file mode 100644 index 0000000..2c66aba Binary files /dev/null and b/ADVect/runtime/shaders/dx11/AlphaStencil.frag.bin differ diff --git a/ADVect/runtime/shaders/dx11/AlphaStencil.vert.bin b/ADVect/runtime/shaders/dx11/AlphaStencil.vert.bin new file mode 100644 index 0000000..5335beb Binary files /dev/null and b/ADVect/runtime/shaders/dx11/AlphaStencil.vert.bin differ diff --git a/ADVect/runtime/shaders/dx11/ImageAlpha.frag.bin b/ADVect/runtime/shaders/dx11/ImageAlpha.frag.bin new file mode 100644 index 0000000..97d91ad Binary files /dev/null and b/ADVect/runtime/shaders/dx11/ImageAlpha.frag.bin differ diff --git a/ADVect/runtime/shaders/dx11/ImageAlpha.vert.bin b/ADVect/runtime/shaders/dx11/ImageAlpha.vert.bin new file mode 100644 index 0000000..5335beb Binary files /dev/null and b/ADVect/runtime/shaders/dx11/ImageAlpha.vert.bin differ diff --git a/ADVect/runtime/shaders/dx11/swizzle_aaaa.frag.bin b/ADVect/runtime/shaders/dx11/swizzle_aaaa.frag.bin new file mode 100644 index 0000000..2c66aba Binary files /dev/null and b/ADVect/runtime/shaders/dx11/swizzle_aaaa.frag.bin differ diff --git a/ADVect/runtime/shaders/dx11/swizzle_aaaa.vert.bin b/ADVect/runtime/shaders/dx11/swizzle_aaaa.vert.bin new file mode 100644 index 0000000..5335beb Binary files /dev/null and b/ADVect/runtime/shaders/dx11/swizzle_aaaa.vert.bin differ diff --git a/ADVect/runtime/shaders/dx11/test.frag.bin b/ADVect/runtime/shaders/dx11/test.frag.bin new file mode 100644 index 0000000..43cb44f Binary files /dev/null and b/ADVect/runtime/shaders/dx11/test.frag.bin differ diff --git a/ADVect/runtime/shaders/dx11/test.vert.bin b/ADVect/runtime/shaders/dx11/test.vert.bin new file mode 100644 index 0000000..5335beb Binary files /dev/null and b/ADVect/runtime/shaders/dx11/test.vert.bin differ diff --git a/ADVect/runtime/shaders/glsl/AlphaStencil.frag.bin b/ADVect/runtime/shaders/glsl/AlphaStencil.frag.bin new file mode 100644 index 0000000..f8deba0 Binary files /dev/null and b/ADVect/runtime/shaders/glsl/AlphaStencil.frag.bin differ diff --git a/ADVect/runtime/shaders/glsl/AlphaStencil.vert.bin b/ADVect/runtime/shaders/glsl/AlphaStencil.vert.bin new file mode 100644 index 0000000..609ed0d Binary files /dev/null and b/ADVect/runtime/shaders/glsl/AlphaStencil.vert.bin differ diff --git a/ADVect/runtime/shaders/glsl/ImageAlpha.frag.bin b/ADVect/runtime/shaders/glsl/ImageAlpha.frag.bin new file mode 100644 index 0000000..eb0b4a4 Binary files /dev/null and b/ADVect/runtime/shaders/glsl/ImageAlpha.frag.bin differ diff --git a/ADVect/runtime/shaders/glsl/ImageAlpha.vert.bin b/ADVect/runtime/shaders/glsl/ImageAlpha.vert.bin new file mode 100644 index 0000000..609ed0d Binary files /dev/null and b/ADVect/runtime/shaders/glsl/ImageAlpha.vert.bin differ diff --git a/ADVect/runtime/shaders/glsl/swizzle_aaaa.frag.bin b/ADVect/runtime/shaders/glsl/swizzle_aaaa.frag.bin new file mode 100644 index 0000000..f8deba0 Binary files /dev/null and b/ADVect/runtime/shaders/glsl/swizzle_aaaa.frag.bin differ diff --git a/ADVect/runtime/shaders/glsl/swizzle_aaaa.vert.bin b/ADVect/runtime/shaders/glsl/swizzle_aaaa.vert.bin new file mode 100644 index 0000000..609ed0d Binary files /dev/null and b/ADVect/runtime/shaders/glsl/swizzle_aaaa.vert.bin differ diff --git a/ADVect/runtime/shaders/glsl/test.frag.bin b/ADVect/runtime/shaders/glsl/test.frag.bin new file mode 100644 index 0000000..566fb14 Binary files /dev/null and b/ADVect/runtime/shaders/glsl/test.frag.bin differ diff --git a/ADVect/runtime/shaders/glsl/test.vert.bin b/ADVect/runtime/shaders/glsl/test.vert.bin new file mode 100644 index 0000000..609ed0d Binary files /dev/null and b/ADVect/runtime/shaders/glsl/test.vert.bin differ diff --git a/ADVect/runtime/shaders/spirv/AlphaStencil.frag.bin b/ADVect/runtime/shaders/spirv/AlphaStencil.frag.bin new file mode 100644 index 0000000..8024bbb Binary files /dev/null and b/ADVect/runtime/shaders/spirv/AlphaStencil.frag.bin differ diff --git a/ADVect/runtime/shaders/spirv/AlphaStencil.vert.bin b/ADVect/runtime/shaders/spirv/AlphaStencil.vert.bin new file mode 100644 index 0000000..2e64c84 Binary files /dev/null and b/ADVect/runtime/shaders/spirv/AlphaStencil.vert.bin differ diff --git a/ADVect/runtime/shaders/spirv/ImageAlpha.frag.bin b/ADVect/runtime/shaders/spirv/ImageAlpha.frag.bin new file mode 100644 index 0000000..25937c0 Binary files /dev/null and b/ADVect/runtime/shaders/spirv/ImageAlpha.frag.bin differ diff --git a/ADVect/runtime/shaders/spirv/ImageAlpha.vert.bin b/ADVect/runtime/shaders/spirv/ImageAlpha.vert.bin new file mode 100644 index 0000000..2e64c84 Binary files /dev/null and b/ADVect/runtime/shaders/spirv/ImageAlpha.vert.bin differ diff --git a/ADVect/runtime/shaders/spirv/swizzle_aaaa.frag.bin b/ADVect/runtime/shaders/spirv/swizzle_aaaa.frag.bin new file mode 100644 index 0000000..8024bbb Binary files /dev/null and b/ADVect/runtime/shaders/spirv/swizzle_aaaa.frag.bin differ diff --git a/ADVect/runtime/shaders/spirv/swizzle_aaaa.vert.bin b/ADVect/runtime/shaders/spirv/swizzle_aaaa.vert.bin new file mode 100644 index 0000000..2e64c84 Binary files /dev/null and b/ADVect/runtime/shaders/spirv/swizzle_aaaa.vert.bin differ diff --git a/ADVect/runtime/shaders/spirv/test.frag.bin b/ADVect/runtime/shaders/spirv/test.frag.bin new file mode 100644 index 0000000..15d106d Binary files /dev/null and b/ADVect/runtime/shaders/spirv/test.frag.bin differ diff --git a/ADVect/runtime/shaders/spirv/test.vert.bin b/ADVect/runtime/shaders/spirv/test.vert.bin new file mode 100644 index 0000000..2e64c84 Binary files /dev/null and b/ADVect/runtime/shaders/spirv/test.vert.bin differ diff --git a/ADVect/runtime/terrio.png b/ADVect/runtime/terrio.png new file mode 100644 index 0000000..ab04a9d Binary files /dev/null and b/ADVect/runtime/terrio.png differ diff --git a/CMakeSettings.json b/CMakeSettings.json index aa44a2f..7162924 100644 --- a/CMakeSettings.json +++ b/CMakeSettings.json @@ -4,7 +4,7 @@ "name": "x64-Debug", "generator": "Ninja", "configurationType": "Debug", - "inheritEnvironments": [ "msvc_x64" ], + "inheritEnvironments": [ "clang_cl_x64" ], "buildRoot": "${projectDir}\\out\\build\\${name}", "installRoot": "${projectDir}\\out\\install\\${name}", "cmakeCommandArgs": "", diff --git a/NVL/Environment.cpp b/NVL/Environment.cpp index 4eac86f..022520a 100644 --- a/NVL/Environment.cpp +++ b/NVL/Environment.cpp @@ -113,11 +113,15 @@ namespace NVL::Environment { return ms; } - size_t MarkupString::length() const { - size_t r = 0; - for (const auto& s : segments) - r += s.str.length(); - return r; + size_t MarkupString::length() const { // you do realize this memoization fails if we change the var + if (mem_length == -1) { + size_t r = 0; + for (const auto& s : segments) + r += s.str.length(); + return r; + } + else + return mem_length; } MarkupString MarkupString::substr(size_t i) const { diff --git a/NVL/Environment.h b/NVL/Environment.h index e693f1f..ee8598d 100644 --- a/NVL/Environment.h +++ b/NVL/Environment.h @@ -44,6 +44,9 @@ namespace NVL::Environment { std::vector>> efs; }; struct MarkupString { + private: + mutable i32 mem_length = -1; + public: std::vector segments{}; size_t length() const; MarkupString substr(size_t idx) const; diff --git a/NVL/dialogue.nvl b/NVL/dialogue.nvl index 77e5cdf..d4eb611 100644 --- a/NVL/dialogue.nvl +++ b/NVL/dialogue.nvl @@ -1,57 +1,19 @@ BEGIN Scene1 +Show BG "image3.png" Show BGDialogue "grad.png" <<- *!Show Avatar "mmaker.png" [MMaker] -*!Show BG "googleplex/1.png" -Park your car in a place that allows you to walk on the sidewalk. -*!Show BG "googleplex/2.jpg" -Wait until everyone is asleep. -*!Show BG "googleplex/3.jpg" -Sneak into the building and head towards the front door. -*!Show BG "googleplex/4.png" -Go through the security gate and walk around the perimeter of the grounds. -*!Show BG "googleplex/5.jpg" -Enter the building using the main entrance. -*!Show BG "googleplex/6.jpg" -Walk to the elevator and take it up to the sixth floor. -*!Show BG "googleplex/7.png" -Enter the stairwell leading to the roof and climb all the way to the top. -*!Show BG "googleplex/8.jpg" -Break open the skylight and enter the room containing the Google logo. -*!Show BG "googleplex/9.jpg" -Find the main server room. -*!Show BG "googleplex/10.jpg" -Kill the power to the server room. -*!Show BG "googleplex/11.jpg" -Search the room for a computer with a USB port. -*!Show BG "googleplex/12.jpg" -Plug the USB cable into the computer. -*!Show BG "googleplex/13.jpg" -Start typing in the password for the administrator account. -*!Show BG "googleplex/14.png" -After the login screen comes up, type in the password "G00gle." -*!Show BG "googleplex/15.png" -When the system reboots, you will see a prompt asking you to install a new program. -Type "Y" and press ENTER. -*!Show BG "googleplex/16.jpg" -The Google search engine will come up. Type in "www.yahoo.com" and hit ENTER. -*!Show BG "googleplex/17.png" -A window will appear saying "You have successfully installed Google Chrome." Click OK. -*!Show BG "googleplex/18.jpg" -A new browser will open. Log in to your Yahoo mail account. -*!Show BG "image3.png" -Go to your inbox and click on the link to download the latest version of Google Chrome. -*!Show BG "googleplex/20.jpg" + Install the update. *! Show BG "image2.jpg" Commencing JS hypnosis... -*! Show BG "image.png" +*! Show BG "image3.png" *!Show Avatar "terrio.png" [Terrio]