Skip to content

Commit

Permalink
Merge pull request #167 from Spartan322/update/godot4.2-stable
Browse files Browse the repository at this point in the history
  • Loading branch information
Spartan322 authored Dec 7, 2023
2 parents e01d332 + 2910223 commit a6952ef
Show file tree
Hide file tree
Showing 9 changed files with 19 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on: [push, pull_request]

env:
GODOT_BASE_DOWNLOAD_URL: https://github.com/godotengine/godot
GODOT_VERSION: 4.1.3
GODOT_VERSION: 4.2
GODOT_VERSION_TYPE: stable
OPENVIC_BASE_BRANCH: master

Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Main Repo for the OpenVic Project
For detailed instructions, view the Contributor Quickstart Guide [here](docs/contribution-quickstart-guide.md)

## System Requirements
* [Godot 4.1.3](https://github.com/godotengine/godot/releases/tag/4.1.3-stable)
* [Godot 4.2](https://github.com/godotengine/godot/releases/tag/4.2-stable)
* [scons](https://scons.org/)

See [System Requirements](docs/contribution/system-requirements.md).
Expand All @@ -21,7 +21,7 @@ See [Cloning](docs/contribution/cloning.md).
## [Godot Documentation](https://docs.godotengine.org/en/latest/)

## Build/Run Instructions
1. Install [Godot 4.1.3](https://github.com/godotengine/godot/releases/tag/4.1.3-stable) and [scons](https://scons.org/) for your system.
1. Install [Godot 4.2](https://github.com/godotengine/godot/releases/tag/4.2-stable) and [scons](https://scons.org/) for your system.
2. Run the command `git submodule update --init --recursive` to retrieve all related submodules.
3. Run `scons` in the project root, you should see a libopenvic file in `game/bin/openvic`.
4. Open with Godot 4, click import and navigate to the `game` directory.
Expand Down
10 changes: 5 additions & 5 deletions SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,15 @@ env = SConscript("scripts/SConstruct")

env.PrependENVPath("PATH", os.getenv("PATH"))

OLD_ARGS = ARGUMENTS.copy()
ARGUMENTS["compiledb"] = False
opts = env.SetupOptions()

env.FinalizeOptions()
ARGUMENTS = OLD_ARGS

# Needs Clone, else godot-cpp builds using our modified environment variables. eg: godot-cpp builds on C++20
OLD_ARGS = SCons.Script.ARGUMENTS.copy()
SCons.Script.ARGUMENTS["use_static_cpp"] = env["use_static_cpp"]
SCons.Script.ARGUMENTS["disable_exceptions"] = env["disable_exceptions"]
if ARGUMENTS.get("compiledb", False):
SCons.Script.ARGUMENTS["compiledb"] = True
SCons.Script.ARGUMENTS["compiledb_file"] = 'godot-cpp/compile_commands.json'
godot_env = SConscript("godot-cpp/SConstruct")
SCons.Script.ARGUMENTS = OLD_ARGS

Expand Down Expand Up @@ -91,4 +87,8 @@ if "env" in locals():
# FIXME: This method mixes both cosmetic progress stuff and cache handling...
env.show_progress(env)

# Add compiledb if the option is set
if env.get("compiledb", False):
default_args += ["compiledb"]

Default(*default_args)
5 changes: 4 additions & 1 deletion extension/src/openvic-extension/singletons/GameSingleton.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#include "GameSingleton.hpp"

#include <functional>

#include <godot_cpp/core/class_db.hpp>
#include <godot_cpp/core/error_macros.hpp>
#include <godot_cpp/variant/utility_functions.hpp>
Expand Down Expand Up @@ -553,7 +555,8 @@ Error GameSingleton::load_defines_compatibility_mode(PackedStringArray const& fi
UtilityFunctions::push_error("Failed to hardcoded defines!");
err = FAILED;
}
if (!dataloader.load_localisation_files(LoadLocalisation::add_message)) {
auto add_message = std::bind_front(&LoadLocalisation::add_message, LoadLocalisation::get_singleton());
if (!dataloader.load_localisation_files(add_message)) {
UtilityFunctions::push_error("Failed to load localisation!");
err = FAILED;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,6 @@ Error LoadLocalisation::load_localisation_dir(String const& dir_path) const {
return err;
}
bool LoadLocalisation::add_message(std::string_view key, Dataloader::locale_t locale, std::string_view localisation) {
static Ref<Translation> translations[Dataloader::_LocaleCount] = { nullptr };
Ref<Translation>& translation = translations[locale];
if (translation.is_null()) {
translation = _singleton->_get_translation(Dataloader::locale_names[locale]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ namespace OpenVic {

static inline LoadLocalisation* _singleton = nullptr;

godot::Ref<godot::Translation> translations[Dataloader::_LocaleCount];

godot::Error _load_file(godot::String const& file_path, godot::Ref<godot::Translation> translation) const;
godot::Ref<godot::Translation> _get_translation(godot::String const& locale) const;

Expand All @@ -26,6 +28,6 @@ namespace OpenVic {
godot::Error load_locale_dir(godot::String const& dir_path, godot::String const& locale) const;
godot::Error load_localisation_dir(godot::String const& dir_path) const;

static bool add_message(std::string_view key, Dataloader::locale_t locale, std::string_view localisation);
bool add_message(std::string_view key, Dataloader::locale_t locale, std::string_view localisation);
};
}
3 changes: 2 additions & 1 deletion game/bin/openvic.gdextension
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
[configuration]

entry_symbol = "openvic_library_init"
compatibility_minimum = 4.1
compatibility_minimum = 4.2
reloadable = true

[libraries]

Expand Down
2 changes: 1 addition & 1 deletion game/project.godot
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ config/name="OpenVic"
config/description="A faithful recreation of Victoria 2: Heart of Darkness with a focus on enhancing performance, multiplayer stability, and modability for modern machines."
run/main_scene="res://src/Game/GameStart.tscn"
config/use_custom_user_dir=true
config/features=PackedStringArray("4.1", "Forward Plus")
config/features=PackedStringArray("4.2", "Forward Plus")
boot_splash/bg_color=Color(0, 0, 0, 0)
boot_splash/show_image=false
boot_splash/image="res://splash_assets/splash_image.png"
Expand Down
2 changes: 1 addition & 1 deletion godot-cpp
Submodule godot-cpp updated 39 files
+14 −13 .github/workflows/ci.yml
+3 −4 CMakeLists.txt
+2 −1 README.md
+116 −19 binding_generator.py
+11,495 −2,374 gdextension/extension_api.json
+336 −16 gdextension/gdextension_interface.h
+77 −33 include/godot_cpp/classes/wrapped.hpp
+90 −0 include/godot_cpp/core/binder_common.hpp
+23 −15 include/godot_cpp/core/class_db.hpp
+12 −11 include/godot_cpp/core/memory.hpp
+3 −22 include/godot_cpp/core/object.hpp
+62 −0 include/godot_cpp/core/object_id.hpp
+12 −0 include/godot_cpp/core/property_info.hpp
+34 −9 include/godot_cpp/godot.hpp
+64 −0 include/godot_cpp/variant/callable_custom.hpp
+248 −0 include/godot_cpp/variant/callable_method_pointer.hpp
+15 −1 include/godot_cpp/variant/variant.hpp
+50 −0 src/classes/wrapped.cpp
+14 −10 src/core/class_db.cpp
+6 −5 src/core/memory.cpp
+88 −24 src/godot.cpp
+113 −0 src/variant/callable_custom.cpp
+114 −0 src/variant/callable_method_pointer.cpp
+7 −2 src/variant/char_string.cpp
+16 −0 src/variant/variant.cpp
+1 −1 test/CMakeLists.txt
+11 −0 test/SConstruct
+7 −0 test/generate_xcframework.sh
+0 −0 test/project/bin/libgdexample.macos.template_debug.framework/Resources/Info.plist
+0 −0 test/project/bin/libgdexample.macos.template_release.framework/Resources/Info.plist
+16 −0 test/project/example.gdextension
+72 −0 test/project/main.gd
+2 −1 test/project/project.godot
+186 −0 test/src/example.cpp
+26 −0 test/src/example.h
+3 −5 tools/android.py
+31 −3 tools/godotcpp.py
+1 −1 tools/ios.py
+3 −0 tools/linux.py

0 comments on commit a6952ef

Please sign in to comment.