diff --git a/.gitlab/ci/jobs/debian-stable-amd64-makefile.yml b/.gitlab/ci/jobs/debian-stable-amd64-makefile.yml
index a6aebfac34bf1ad1e99380b167f16f56a5686f12..3255a3a69b14f4c464f1644d9d007169b5c88ec5 100644
--- a/.gitlab/ci/jobs/debian-stable-amd64-makefile.yml
+++ b/.gitlab/ci/jobs/debian-stable-amd64-makefile.yml
@@ -1,6 +1,10 @@
 Debian stable:amd64 Makefile:
   extends: .srb2ci
 
+  when: manual
+
+  allow_failure: true
+
   stage: build
 
   artifacts:
diff --git a/.gitlab/ci/jobs/debian-stable-clang-amd64.yml b/.gitlab/ci/jobs/debian-stable-clang-amd64.yml
index c40998e17af3157856f92fbb0121c409655900bc..870e96bc7a72c88b6fd0058abc33cfc44a6fe9bd 100644
--- a/.gitlab/ci/jobs/debian-stable-clang-amd64.yml
+++ b/.gitlab/ci/jobs/debian-stable-clang-amd64.yml
@@ -16,10 +16,9 @@ Debian stable Clang:
 
   variables:
     CC: clang
-    CXX: clang
+    CXX: clang++
     WFLAGS: -Wno-cast-align -Wno-implicit-const-int-float-conversion -Werror
     CFLAGS: -Wno-cast-align -Wno-implicit-const-int-float-conversion -Werror
-    LDFLAGS: -Wl,-fuse-ld=gold
 
   script:
     - - |
diff --git a/.gitlab/ci/jobs/debian-testing-clang-amd64.yml b/.gitlab/ci/jobs/debian-testing-clang-amd64.yml
index dc790b397f2187b47a75c05bcf3e5973d5a175e1..e53d0e727172b5848e88b89e6bfe991b2fd2f1a5 100644
--- a/.gitlab/ci/jobs/debian-testing-clang-amd64.yml
+++ b/.gitlab/ci/jobs/debian-testing-clang-amd64.yml
@@ -16,7 +16,7 @@ Debian testing Clang:
 
   variables:
     CC: clang
-    CXX: clang
+    CXX: clang++
     WFLAGS: -Wno-cast-align -Wno-implicit-const-int-float-conversion -Werror -Wno-deprecated-non-prototype -Wno-single-bit-bitfield-constant-conversion
     CFLAGS: -Wno-cast-align -Wno-implicit-const-int-float-conversion -Werror -Wno-deprecated-non-prototype -Wno-single-bit-bitfield-constant-conversion
     LDFLAGS: -Wl,-fuse-ld=gold
diff --git a/.gitlab/ci/jobs/windows-x64.yml b/.gitlab/ci/jobs/windows-x64.yml
index ca7f4ae08b58218771ca6de5c377930532507136..73791e82a202d91f1b0bc4c28e764bb0a846941a 100644
--- a/.gitlab/ci/jobs/windows-x64.yml
+++ b/.gitlab/ci/jobs/windows-x64.yml
@@ -7,6 +7,30 @@ Windows x64:
 
   allow_failure: true
 
+  cache:
+    - key: ccache-$CI_JOB_NAME_SLUG-$CI_COMMIT_REF_SLUG
+      fallback_keys:
+        - ccache-$CI_JOB_NAME_SLUG-$CI_DEFAULT_BRANCH
+        - ccache-$CI_JOB_NAME_SLUG-master
+      paths:
+        - build/ccache
+        - build/ccache_statslog
+
+    - key: apt-$CI_JOB_IMAGE
+      paths:
+        - build/apt-cache
+      unprotect: true
+
+    - key: vcpkg-root
+      paths:
+        - build/vcpkg-root
+      unprotect: true
+
+    - key: vcpkg-binary-cache-x64-mingw-static
+      paths:
+        - build/vcpkg-binary-cache
+      unprotect: true
+
   artifacts:
     paths:
       - "build.cmake/bin/"
@@ -20,6 +44,27 @@ Windows x64:
     CXX: /usr/lib/ccache/x86_64-w64-mingw32-g++
 
   script:
+    - |
+        # vcpkg
+        echo -e "\e[0Ksection_start:`date +%s`:vcpkg-root[collapsed=true]\r\e[0KUpdating vcpkg"
+
+        if [ -d "build/vcpkg-root" ]; then
+          pushd build/vcpkg-root
+          git fetch https://github.com/Microsoft/vcpkg master
+          git reset --hard FETCH_HEAD
+          popd
+        else
+          mkdir -p build
+          git clone https://github.com/Microsoft/vcpkg build/vcpkg-root
+        fi
+
+        export VCPKG_ROOT=$(pwd)/build/vcpkg-root
+        export VCPKG_BINARY_SOURCES="clear;files,/opt/vcpkg.bsources,read;files,$(pwd)/build/vcpkg-binary-cache,readwrite"
+
+        mkdir -p "build/vcpkg-binary-cache"
+
+        echo -e "\e[0Ksection_end:`date +%s`:vcpkg-root\r\e[0K"
+
     - - |
           # apt_toolchain
           echo -e "\e[0Ksection_start:`date +%s`:apt_toolchain[collapsed=true]\r\e[0KInstalling toolchain packages"
@@ -39,7 +84,7 @@ Windows x64:
     - - |
           # cmake
           echo -e "\e[0Ksection_start:`date +%s`:cmake[collapsed=false]\r\e[0KBuilding Makefiles"
-      - cmake -B build.cmake -DSRB2_USE_CCACHE=NO -DSRB2_CONFIG_ERRORMODE=ON -DCMAKE_TOOLCHAIN_FILE=$VCPKG_ROOT/scripts/buildsystems/vcpkg.cmake -DVCPKG_TARGET_TRIPLET=x64-mingw-static -DVCPKG_CHAINLOAD_TOOLCHAIN_FILE=$VCPKG_ROOT/scripts/toolchains/mingw.cmake
+      - cmake -B build.cmake -DSRB2_USE_CCACHE=NO -DSRB2_CONFIG_ERRORMODE=ON -DCMAKE_TOOLCHAIN_FILE=$VCPKG_ROOT/scripts/buildsystems/vcpkg.cmake -DVCPKG_TARGET_TRIPLET=x64-mingw-static -DVCPKG_CHAINLOAD_TOOLCHAIN_FILE=$VCPKG_ROOT/scripts/toolchains/mingw.cmake -G "Unix Makefiles"
       - |
           # cmake
           echo -e "\e[0Ksection_end:`date +%s`:cmake\r\e[0K"
@@ -51,3 +96,33 @@ Windows x64:
       - |
           # make
           echo -e "\e[0Ksection_end:`date +%s`:make\r\e[0K"
+
+  after_script:
+    - - |
+           # apt_clean
+           echo -e "\e[0Ksection_start:`date +%s`:apt_clean[collapsed=true]\r\e[0KCleaning of unneeded APT packages"
+      - apt-get autoclean
+      - |
+          # apt_clean
+          echo -e "\e[0Ksection_end:`date +%s`:apt_clean\r\e[0K"
+
+    - - |
+          # vcpkg_clean
+          echo -e "\e[0Ksection_start:`date +%s`:vcpkg_clean[collapsed=true]\r\e[0KCleaning vcpkg-root"
+
+          if [ -d "build/vcpkg-root" ]; then
+            pushd "build/vcpkg-root"
+            git clean -f
+            popd
+          fi
+
+          echo -e "\e[0Ksection_end:`date +%s`:vcpkg_clean\r\e[0K"
+
+    - - |
+          # ccache_stats
+          echo -e "\e[0Ksection_start:`date +%s`:ccache_stats[collapsed=true]\r\e[0Kccache statistics:"
+      - ccache --show-stats
+      - ccache --show-log-stats || true
+      - |
+          # ccahe_stats
+          echo -e "\e[0Ksection_end:`date +%s`:ccache_stats\r\e[0K"
diff --git a/.gitlab/ci/jobs/windows-x86-makefile.yml b/.gitlab/ci/jobs/windows-x86-makefile.yml
index 213342cda81e119827937a79df8b1f74242d7ef2..f90fdbd513dacca723005766296aa41859d83a50 100644
--- a/.gitlab/ci/jobs/windows-x86-makefile.yml
+++ b/.gitlab/ci/jobs/windows-x86-makefile.yml
@@ -3,7 +3,9 @@ Windows x86 Makefile:
 
   stage: build
 
-  when: on_success
+  when: manual
+
+  allow_failure: true
 
   artifacts:
     paths:
diff --git a/.gitlab/ci/jobs/windows-x86.yml b/.gitlab/ci/jobs/windows-x86.yml
index c8293eb7d860fff2d66716fc38927b11b4d74b7b..9a33364b2830df79055838037563a2711fd51d04 100644
--- a/.gitlab/ci/jobs/windows-x86.yml
+++ b/.gitlab/ci/jobs/windows-x86.yml
@@ -3,10 +3,6 @@ Windows x86:
 
   stage: build
 
-  when: manual
-
-  allow_failure: true
-
   cache:
     - key: ccache-$CI_JOB_NAME_SLUG-$CI_COMMIT_REF_SLUG
       fallback_keys:
@@ -33,8 +29,8 @@ Windows x86:
 
   artifacts:
     paths:
-      - "build/ninja-x86_mingw_static_vcpkg-debug/bin/"
-      - "build/ninja-x86_mingw_static_vcpkg-debug/src/config.h"
+      - "build.cmake/bin/"
+      - "build.cmake/src/config.h"
     expose_as: "Win32"
     name: "$CI_PROJECT_PATH_SLUG-$CI_COMMIT_REF_SLUG-$CI_COMMIT_SHORT_SHA-Win32"
 
@@ -59,7 +55,7 @@ Windows x86:
         fi
 
         export VCPKG_ROOT=$(pwd)/build/vcpkg-root
-        export VCPKG_BINARY_SOURCES="clear;files,$(pwd)/build/vcpkg-binary-cache,readwrite"
+        export VCPKG_BINARY_SOURCES="clear;files,/opt/vcpkg.bsources,read;files,$(pwd)/build/vcpkg-binary-cache,readwrite"
 
         mkdir -p "build/vcpkg-binary-cache"
 
@@ -84,7 +80,7 @@ Windows x86:
     - - |
           # cmake
           echo -e "\e[0Ksection_start:`date +%s`:cmake[collapsed=false]\r\e[0KBuilding Makefiles"
-      - cmake -B build.cmake --preset ninja-x86_mingw_static_vcpkg-debug -DSRB2_USE_CCACHE=NO -DSRB2_CONFIG_ERRORMODE=ON
+      - cmake -B build.cmake -DSRB2_USE_CCACHE=NO -DSRB2_CONFIG_ERRORMODE=ON -DCMAKE_TOOLCHAIN_FILE=$VCPKG_ROOT/scripts/buildsystems/vcpkg.cmake -DVCPKG_TARGET_TRIPLET=x86-mingw-static -DVCPKG_CHAINLOAD_TOOLCHAIN_FILE=$VCPKG_ROOT/scripts/toolchains/mingw.cmake -G "Unix Makefiles"
       - |
           # cmake
           echo -e "\e[0Ksection_end:`date +%s`:cmake\r\e[0K"
@@ -92,7 +88,7 @@ Windows x86:
     - - |
           # make
           echo -e "\e[0Ksection_start:`date +%s`:make[collapsed=false]\r\e[0KCompiling SRB2"
-      - cmake -build build.cmake --parallel 1 --verbose --preset ninja-x86_mingw_static_vcpkg-debug
+      - cmake --build build.cmake --parallel 1 --verbose
       - |
           # make
           echo -e "\e[0Ksection_end:`date +%s`:make\r\e[0K"
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index e763859b0c3c039f1703af4f74460813460ee248..48310f2575472f2c216d93421173f22890fb3810 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -463,8 +463,13 @@ else()
 endif()
 
 if(TARGET miniupnpc::miniupnpc)
-	target_compile_definitions(SRB2SDL2 PRIVATE -DHAVE_MINIUPNPC)
-	target_link_libraries(SRB2SDL2 PRIVATE miniupnpc::miniupnpc)
+	if("${VCPKG_TARGET_TRIPLET}" MATCHES "-mingw-static$")
+		target_compile_definitions(SRB2SDL2 PRIVATE -DHAVE_MINIUPNPC -DMINIUPNP_STATICLIB)
+		target_link_libraries(SRB2SDL2 PRIVATE miniupnpc::miniupnpc -liphlpapi)
+	else()
+		target_compile_definitions(SRB2SDL2 PRIVATE -DHAVE_MINIUPNPC)
+		target_link_libraries(SRB2SDL2 PRIVATE miniupnpc::miniupnpc)
+	endif()
 	message(STATUS "miniupnpc Found")
 else()
 	message(STATUS "No miniupnpc Found")
diff --git a/src/Makefile.d/versions.mk b/src/Makefile.d/versions.mk
index 7dee2b657a06fefcc41d4a57cc5ab38edcdd3569..6afcb13f231a59b38a2d4e881638287b611c7285 100644
--- a/src/Makefile.d/versions.mk
+++ b/src/Makefile.d/versions.mk
@@ -35,7 +35,7 @@ ifndef GCC295
  WFLAGS+=-Wendif-labels
 endif
 ifdef GCC41
- WFLAGS+=-Wshadow
+ WFLAGS+=-Wno-shadow
 endif
 #WFLAGS+=-Wlarger-than-%len%
  WFLAGS+=-Wpointer-arith
@@ -61,7 +61,7 @@ endif
 ifdef GCC45
  WFLAGS+=-Wlogical-op
 endif
- WFLAGS+=-Waggregate-return
+ WFLAGS+=-Wno-aggregate-return
 ifdef HAIKU
 ifdef GCC41
  #WFLAGS+=-Wno-attributes
@@ -125,6 +125,8 @@ ifdef GCC44
 endif
 ifdef GCC46
  WFLAGS+=-Wno-error=suggest-attribute=noreturn
+ WFLAGS+=-Wno-error=maybe-uninitialized
+ WFLAGS+=-Wno-error=inline
 endif
 ifdef GCC54
  WFLAGS+=-Wno-logical-op -Wno-error=logical-op
diff --git a/src/acs/acsvm.hpp b/src/acs/acsvm.hpp
index 849dca0aa852b58c3f18c74b5ac279a013757dc5..5974189d8f05afb6e7c3a035f56f49b5a2e826a4 100644
--- a/src/acs/acsvm.hpp
+++ b/src/acs/acsvm.hpp
@@ -16,35 +16,35 @@
 #ifndef __SRB2_ACSVM_HPP__
 #define __SRB2_ACSVM_HPP__
 
-#include <ACSVM/Action.hpp>
-#include <ACSVM/Array.hpp>
-#include <ACSVM/BinaryIO.hpp>
-#include <ACSVM/CallFunc.hpp>
-#include <ACSVM/Code.hpp>
-#include <ACSVM/CodeData.hpp>
-#include <ACSVM/CodeList.hpp>
-#include <ACSVM/Environment.hpp>
-#include <ACSVM/Error.hpp>
-#include <ACSVM/Function.hpp>
-#include <ACSVM/HashMap.hpp>
-#include <ACSVM/HashMapFixed.hpp>
-#include <ACSVM/ID.hpp>
-#include <ACSVM/Init.hpp>
-#include <ACSVM/Jump.hpp>
-#include <ACSVM/List.hpp>
-#include <ACSVM/Module.hpp>
-#include <ACSVM/PrintBuf.hpp>
-#include <ACSVM/Scope.hpp>
-#include <ACSVM/Script.hpp>
-#include <ACSVM/Serial.hpp>
-#include <ACSVM/Stack.hpp>
-#include <ACSVM/Store.hpp>
-#include <ACSVM/String.hpp>
-#include <ACSVM/Thread.hpp>
-#include <ACSVM/Tracer.hpp>
-#include <ACSVM/Types.hpp>
-#include <ACSVM/Vector.hpp>
+#include "vm/ACSVM/Action.hpp"
+#include "vm/ACSVM/Array.hpp"
+#include "vm/ACSVM/BinaryIO.hpp"
+#include "vm/ACSVM/CallFunc.hpp"
+#include "vm/ACSVM/Code.hpp"
+#include "vm/ACSVM/CodeData.hpp"
+#include "vm/ACSVM/CodeList.hpp"
+#include "vm/ACSVM/Environment.hpp"
+#include "vm/ACSVM/Error.hpp"
+#include "vm/ACSVM/Function.hpp"
+#include "vm/ACSVM/HashMap.hpp"
+#include "vm/ACSVM/HashMapFixed.hpp"
+#include "vm/ACSVM/ID.hpp"
+#include "vm/ACSVM/Init.hpp"
+#include "vm/ACSVM/Jump.hpp"
+#include "vm/ACSVM/List.hpp"
+#include "vm/ACSVM/Module.hpp"
+#include "vm/ACSVM/PrintBuf.hpp"
+#include "vm/ACSVM/Scope.hpp"
+#include "vm/ACSVM/Script.hpp"
+#include "vm/ACSVM/Serial.hpp"
+#include "vm/ACSVM/Stack.hpp"
+#include "vm/ACSVM/Store.hpp"
+#include "vm/ACSVM/String.hpp"
+#include "vm/ACSVM/Thread.hpp"
+#include "vm/ACSVM/Tracer.hpp"
+#include "vm/ACSVM/Types.hpp"
+#include "vm/ACSVM/Vector.hpp"
 
-#include <Util/Floats.hpp>
+#include "vm/Util/Floats.hpp"
 
 #endif //__SRB2_ACSVM_HPP__
diff --git a/src/acs/call-funcs.cpp b/src/acs/call-funcs.cpp
index 17e7dc08570ddb19d3138dbcccf4b55887d52e00..07ccbe31a415f106c9c80a97fc47a137569e51f0 100644
--- a/src/acs/call-funcs.cpp
+++ b/src/acs/call-funcs.cpp
@@ -626,7 +626,7 @@ bool CallFunc_Random(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word
 		no tid means search thru all thinkers.
 --------------------------------------------------*/
 static mobjtype_t filter_for_mobjtype = MT_NULL; // annoying but I don't wanna mess with other code
-bool ACS_ThingTypeFilter(mobj_t *mo)
+static bool ACS_ThingTypeFilter(mobj_t *mo)
 {
 	return (ACS_CountThing(mo, filter_for_mobjtype));
 }
@@ -1590,7 +1590,7 @@ bool CallFunc_strcasecmp(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::
 
 		Returns the number of enemies in the tagged sectors.
 --------------------------------------------------*/
-bool ACS_EnemyFilter(mobj_t *mo)
+static bool ACS_EnemyFilter(mobj_t *mo)
 {
 	return ((mo->flags & (MF_ENEMY|MF_BOSS)) && mo->health > 0);
 }
@@ -1618,7 +1618,7 @@ bool CallFunc_CountEnemies(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM
 
 		Returns the number of pushables in the tagged sectors.
 --------------------------------------------------*/
-bool ACS_PushableFilter(mobj_t *mo)
+static bool ACS_PushableFilter(mobj_t *mo)
 {
 	return ((mo->flags & MF_PUSHABLE)
 		|| ((mo->info->flags & MF_PUSHABLE) && mo->fuse));
diff --git a/src/acs/environment.cpp b/src/acs/environment.cpp
index a0e920f4cbf85daf1543866b34e36a028739d5f3..785587a6e94b4720a5993008933b8a78f0882afc 100644
--- a/src/acs/environment.cpp
+++ b/src/acs/environment.cpp
@@ -471,13 +471,13 @@ void Environment::printKill(ACSVM::Thread *thread, ACSVM::Word type, ACSVM::Word
 	}
 	else if (killType == ACSVM::KillType::OutOfBounds)
 	{
-		CONS_Alert(CONS_ERROR, "ACSVM ERROR: Jumped to out of bounds location %lu in script %s\n",
-			(thread->codePtr - thread->module->codeV.data() - 1), scriptName.c_str());
+		CONS_Alert(CONS_ERROR, "ACSVM ERROR: Jumped to out of bounds location %s in script %s\n",
+			sizeu1((thread->codePtr - thread->module->codeV.data() - 1)), scriptName.c_str());
 	}
 	else
 	{
-		CONS_Alert(CONS_ERROR, "ACSVM ERROR: Kill %u:%d at %lu in script %s\n",
-			type, data, (thread->codePtr - thread->module->codeV.data() - 1), scriptName.c_str());
+		CONS_Alert(CONS_ERROR, "ACSVM ERROR: Kill %u:%d at %s in script %s\n",
+			type, data, sizeu1((thread->codePtr - thread->module->codeV.data() - 1)), scriptName.c_str());
 	}
 
 	CONS_Printf("Script terminated.\n");
diff --git a/src/sdl/CMakeLists.txt b/src/sdl/CMakeLists.txt
index 8950846ee4f43cf794bd6d2505bbf039e6c71d2f..114775786eb1145ca13b73f09066e5f5267921a4 100644
--- a/src/sdl/CMakeLists.txt
+++ b/src/sdl/CMakeLists.txt
@@ -139,6 +139,7 @@ target_compile_options(SRB2SDL2 PRIVATE
         -Wno-unused-function
         -Wno-unused-but-set-variable
         -Wno-unused-private-field
+        -Wno-error=inline
     >
 
     # C++, MSVC