Compare commits

..

10 Commits

Author SHA1 Message Date
7390996c8f
Fork changes 2024-05-26 21:04:49 +03:00
Kae
74dabf2244 fix two tiny issues with changing interface scale 2024-05-25 13:12:50 +10:00
Kae
f3adb0b9d0 Add an interface scale slider 2024-05-25 12:52:07 +10:00
Kae
e31a374212 Fix anchored panes flying into the abyss within miliseconds when you try to drag them 2024-05-25 12:51:27 +10:00
Kae
db42ccae71 fix Assets filesByExtension storing duplicate asset paths
slipped in with the asset load scripts - this caused rare duplication errors when the Databases parse assets by extension and an asset path is indexed with more than one capitalization
#66
2024-05-25 11:12:31 +10:00
Kae
19986b30a1 lmao oops 2024-05-24 12:10:48 +10:00
Kae
ae26440bac fix Songbook interface no longer excluding /songs/ & .abc 2024-05-24 12:00:53 +10:00
Kae
8f8220f517
Update README.md
closes #65
[skip ci]
2024-05-24 09:35:27 +10:00
Kae
0abe47ab6c slightly smarter inventory close behavior with panes that open with the inventory 2024-05-23 12:12:07 +10:00
Kae
f42031dc9e make text anchors in LargeCharPlate configurable
also gave the char previews some animation!
2024-05-23 11:43:15 +10:00
26 changed files with 426 additions and 219 deletions

4
.gitignore vendored
View File

@ -50,4 +50,6 @@ _deps
.history/ .history/
# Built Visual Studio Code Extensions # Built Visual Studio Code Extensions
*.vsix *.vsix
*.tar

View File

@ -100,7 +100,7 @@ Note: Some of these [texts](## "hi :3") are just tooltips rather than links.
<details> <details>
<summary><b>Linux (Ubuntu)</b></summary> <summary><b>Linux (Ubuntu)</b></summary>
* Make sure you're using CMake 3.19 or newer - you may need to [add Kitware's APT repo](https://apt.kitware.com/) to install a newer version. * Make sure you're using CMake 3.23 or newer - you may need to [add Kitware's APT repo](https://apt.kitware.com/) to install a newer version.
* Install dependencies: * Install dependencies:
* `sudo apt-get install pkg-config libxmu-dev libxi-dev libgl-dev libglu1-mesa-dev libsdl2-dev python3-jinja2 ninja-build` * `sudo apt-get install pkg-config libxmu-dev libxi-dev libgl-dev libglu1-mesa-dev libsdl2-dev python3-jinja2 ninja-build`
* Clone [vcpkg](https://github.com/microsoft/vcpkg?tab=readme-ov-file#quick-start-unix) (outside the repo!) and bootstrap it with the linked instructions. * Clone [vcpkg](https://github.com/microsoft/vcpkg?tab=readme-ov-file#quick-start-unix) (outside the repo!) and bootstrap it with the linked instructions.
@ -118,7 +118,7 @@ Note: Some of these [texts](## "hi :3") are just tooltips rather than links.
Starbound in general is built from the ground up, with its own engine written in C++ on top of some basic libraries. Starbound in general is built from the ground up, with its own engine written in C++ on top of some basic libraries.
* CMake is a C++ build scenario generator and your first target. You need at least version 3.19. Where Ubuntu uses APT, Fedora uses DNF as package manager. * CMake is a C++ build scenario generator and your first target. You need at least version 3.23. Where Ubuntu uses APT, Fedora uses DNF as package manager.
1. `sudo dnf upgrade --refresh` to ensure your OS is up-to-date 1. `sudo dnf upgrade --refresh` to ensure your OS is up-to-date
2. `sudo dnf install cmake` 2. `sudo dnf install cmake`

View File

@ -1,11 +1,13 @@
function patch(image) function patch(original)
-- Camera Pan Speed local image = original:process("?crop=0;0;1;1?scalenearest=236;166")
image:copyInto({119, 68}, image:process("?crop=19;68;117;87")) image:copyInto({0, 28}, original)
image:copyInto({0, 0}, original:process("?crop=0;0;236;96"))
local checkbox = image:process("?crop=19;26;117;35") local checkbox = image:process("?crop=19;26;117;35")
-- Anti-Aliasing image:copyInto({119, 26}, checkbox) -- Anti-Aliasing
image:copyInto({119, 26}, checkbox) image:copyInto({19, 15}, checkbox) -- Object Lighting
-- Object Lighting image:copyInto({119, 15}, checkbox) -- Hardware Cursor
image:copyInto({19, 15}, checkbox)
-- Hardware Cursor image:copyInto({119, 68}, image:process("?crop=19;68;117;87")) -- Camera Pan Speed
image:copyInto({119, 15}, checkbox)
return image
end end

Binary file not shown.

After

Width:  |  Height:  |  Size: 740 B

View File

@ -1,5 +1,8 @@
{ {
"paneLayout" : { "paneLayout" : {
"panefeature" : {
"anchor" : "center"
},
"voiceLabel" : { "voiceLabel" : {
"type" : "label", "type" : "label",
"position" : [119, 202], "position" : [119, 202],

View File

@ -17,14 +17,21 @@ end
function patch(config) function patch(config)
local layout = config.paneLayout local layout = config.paneLayout
layout.panefeature.positionLocked = false layout.panefeature.positionLocked = false
layout.panefeature.anchor = "center"
for i = 1, 32 do config.zoomList[i] = i end
-- Create the camera pan speed widgets -- Create the camera pan speed widgets
shift(clone(layout, "zoomLabel", "cameraSpeedLabel"), 100).value = "CAMERA PAN SPEED" shift(clone(layout, "zoomLabel", "cameraSpeedLabel"), 100).value = "CAMERA PAN SPEED"
shift(clone(layout, "zoomSlider", "cameraSpeedSlider"), 100) shift(clone(layout, "zoomSlider", "cameraSpeedSlider"), 100)
shift(clone(layout, "zoomValueLabel", "cameraSpeedValueLabel"), 100) shift(clone(layout, "zoomValueLabel", "cameraSpeedValueLabel"), 100)
-- Populate camera speed list
config.cameraSpeedList = jarray() config.cameraSpeedList = jarray()
for i = 1, 50 do config.cameraSpeedList[i] = i / 10 end for i = 1, 50 do config.cameraSpeedList[i] = i / 10 end
for i = 1, 32 do config.zoomList[i] = i end
-- Create the interface scale widgets
shift(clone(layout, "zoomLabel", "interfaceScaleLabel"), 0, 28).value = "INTERFACE SCALE"
shift(clone(layout, "zoomSlider", "interfaceScaleSlider"), 0, 28)
shift(clone(layout, "zoomValueLabel", "interfaceScaleValueLabel"), 0, 28)
config.interfaceScaleList = {0, 1, 2, 3, 4, 5, 6} -- 0 = AUTO!
-- Create anti-aliasing toggle -- Create anti-aliasing toggle
shift(clone(layout, "multiTextureLabel", "antiAliasingLabel"), 98).value = "SUPER-SAMPLED AA" shift(clone(layout, "multiTextureLabel", "antiAliasingLabel"), 98).value = "SUPER-SAMPLED AA"
shift(clone(layout, "multiTextureCheckbox", "antiAliasingCheckbox"), 99) shift(clone(layout, "multiTextureCheckbox", "antiAliasingCheckbox"), 99)
@ -34,5 +41,10 @@ function patch(config)
-- Create hardware cursor toggle -- Create hardware cursor toggle
shift(clone(layout, "multiTextureLabel", "hardwareCursorLabel"), 98, -11).value = "HARDWARE CURSOR" shift(clone(layout, "multiTextureLabel", "hardwareCursorLabel"), 98, -11).value = "HARDWARE CURSOR"
shift(clone(layout, "multiTextureCheckbox", "hardwareCursorCheckbox"), 99, -11) shift(clone(layout, "multiTextureCheckbox", "hardwareCursorCheckbox"), 99, -11)
shift(layout.title, 0, 28)
shift(layout.resLabel, 0, 28)
shift(layout.resSlider, 0, 28)
shift(layout.resValueLabel, 0, 28)
return config return config
end end

View File

@ -1,27 +1,41 @@
#ifndef JEMALLOC_H_ #ifndef JEMALLOC_H_
#define JEMALLOC_H_ #define JEMALLOC_H_
#pragma GCC system_header
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
/* Defined if __attribute__((...)) syntax is supported. */ /* Defined if __attribute__((...)) syntax is supported. */
#define JEMALLOC_HAVE_ATTR #define JEMALLOC_HAVE_ATTR
/* Defined if alloc_size attribute is supported. */ /* Defined if alloc_size attribute is supported. */
#define JEMALLOC_HAVE_ATTR_ALLOC_SIZE #define JEMALLOC_HAVE_ATTR_ALLOC_SIZE
/* Defined if format_arg(...) attribute is supported. */
#define JEMALLOC_HAVE_ATTR_FORMAT_ARG
/* Defined if format(gnu_printf, ...) attribute is supported. */ /* Defined if format(gnu_printf, ...) attribute is supported. */
#define JEMALLOC_HAVE_ATTR_FORMAT_GNU_PRINTF #define JEMALLOC_HAVE_ATTR_FORMAT_GNU_PRINTF
/* Defined if format(printf, ...) attribute is supported. */ /* Defined if format(printf, ...) attribute is supported. */
#define JEMALLOC_HAVE_ATTR_FORMAT_PRINTF #define JEMALLOC_HAVE_ATTR_FORMAT_PRINTF
/* Defined if fallthrough attribute is supported. */
#define JEMALLOC_HAVE_ATTR_FALLTHROUGH
/* Defined if cold attribute is supported. */
#define JEMALLOC_HAVE_ATTR_COLD
/* Defined if deprecated attribute is supported. */
#define JEMALLOC_HAVE_ATTR_DEPRECATED
/* /*
* Define overrides for non-standard allocator-related functions if they are * Define overrides for non-standard allocator-related functions if they are
* present on the system. * present on the system.
*/ */
#define JEMALLOC_OVERRIDE_MEMALIGN #define JEMALLOC_OVERRIDE_MEMALIGN
#define JEMALLOC_OVERRIDE_VALLOC #define JEMALLOC_OVERRIDE_VALLOC
#define JEMALLOC_OVERRIDE_PVALLOC
/* /*
* At least Linux omits the "const" in: * At least Linux omits the "const" in:
@ -30,14 +44,14 @@ extern "C" {
* *
* Match the operating system's prototype. * Match the operating system's prototype.
*/ */
#define JEMALLOC_USABLE_SIZE_CONST #define JEMALLOC_USABLE_SIZE_CONST
/* /*
* If defined, specify throw() for the public function prototypes when compiling * If defined, specify throw() for the public function prototypes when compiling
* with C++. The only justification for this is to match the prototypes that * with C++. The only justification for this is to match the prototypes that
* glibc defines. * glibc defines.
*/ */
#define JEMALLOC_USE_CXX_THROW #define JEMALLOC_USE_CXX_THROW
#ifdef _MSC_VER #ifdef _MSC_VER
# ifdef _WIN64 # ifdef _WIN64
@ -48,7 +62,7 @@ extern "C" {
#endif #endif
/* sizeof(void *) == 2^LG_SIZEOF_PTR. */ /* sizeof(void *) == 2^LG_SIZEOF_PTR. */
#define LG_SIZEOF_PTR 3 #define LG_SIZEOF_PTR 3
/* /*
* Name mangling for public symbols is controlled by --with-mangling and * Name mangling for public symbols is controlled by --with-mangling and
@ -56,28 +70,33 @@ extern "C" {
* these macro definitions. * these macro definitions.
*/ */
#ifndef JEMALLOC_NO_RENAME #ifndef JEMALLOC_NO_RENAME
# define je_malloc_conf je_malloc_conf
# define je_malloc_message je_malloc_message
# define je_malloc je_malloc
# define je_calloc je_calloc
# define je_posix_memalign je_posix_memalign
# define je_aligned_alloc je_aligned_alloc # define je_aligned_alloc je_aligned_alloc
# define je_realloc je_realloc # define je_calloc je_calloc
# define je_free je_free
# define je_mallocx je_mallocx
# define je_rallocx je_rallocx
# define je_xallocx je_xallocx
# define je_sallocx je_sallocx
# define je_dallocx je_dallocx # define je_dallocx je_dallocx
# define je_sdallocx je_sdallocx # define je_free je_free
# define je_nallocx je_nallocx # define je_free_sized je_free_sized
# define je_free_aligned_sized je_free_aligned_sized
# define je_mallctl je_mallctl # define je_mallctl je_mallctl
# define je_mallctlnametomib je_mallctlnametomib
# define je_mallctlbymib je_mallctlbymib # define je_mallctlbymib je_mallctlbymib
# define je_mallctlnametomib je_mallctlnametomib
# define je_malloc je_malloc
# define je_malloc_conf je_malloc_conf
# define je_malloc_conf_2_conf_harder je_malloc_conf_2_conf_harder
# define je_malloc_message je_malloc_message
# define je_malloc_stats_print je_malloc_stats_print # define je_malloc_stats_print je_malloc_stats_print
# define je_malloc_usable_size je_malloc_usable_size # define je_malloc_usable_size je_malloc_usable_size
# define je_mallocx je_mallocx
# define je_smallocx_f9c0b5f7f8a917661db39289e38ec94d9d198f11 je_smallocx_f9c0b5f7f8a917661db39289e38ec94d9d198f11
# define je_nallocx je_nallocx
# define je_posix_memalign je_posix_memalign
# define je_rallocx je_rallocx
# define je_realloc je_realloc
# define je_sallocx je_sallocx
# define je_sdallocx je_sdallocx
# define je_xallocx je_xallocx
# define je_memalign je_memalign # define je_memalign je_memalign
# define je_valloc je_valloc # define je_valloc je_valloc
# define je_pvalloc je_pvalloc
#endif #endif
#include <stdlib.h> #include <stdlib.h>
@ -86,32 +105,52 @@ extern "C" {
#include <limits.h> #include <limits.h>
#include <strings.h> #include <strings.h>
#define JEMALLOC_VERSION "4.2.1-0-g3de035335255d553bdb344c32ffdb603816195d8" #define JEMALLOC_VERSION "5.3.0-182-gf9c0b5f7f8a917661db39289e38ec94d9d198f11"
#define JEMALLOC_VERSION_MAJOR 4 #define JEMALLOC_VERSION_MAJOR 5
#define JEMALLOC_VERSION_MINOR 2 #define JEMALLOC_VERSION_MINOR 3
#define JEMALLOC_VERSION_BUGFIX 1 #define JEMALLOC_VERSION_BUGFIX 0
#define JEMALLOC_VERSION_NREV 0 #define JEMALLOC_VERSION_NREV 182
#define JEMALLOC_VERSION_GID "3de035335255d553bdb344c32ffdb603816195d8" #define JEMALLOC_VERSION_GID "f9c0b5f7f8a917661db39289e38ec94d9d198f11"
#define JEMALLOC_VERSION_GID_IDENT f9c0b5f7f8a917661db39289e38ec94d9d198f11
# define MALLOCX_LG_ALIGN(la) ((int)(la)) #define MALLOCX_LG_ALIGN(la) ((int)(la))
# if LG_SIZEOF_PTR == 2 #if LG_SIZEOF_PTR == 2
# define MALLOCX_ALIGN(a) ((int)(ffs((int)(a))-1)) # define MALLOCX_ALIGN(a) ((int)(ffs((int)(a))-1))
# else #else
# define MALLOCX_ALIGN(a) \ # define MALLOCX_ALIGN(a) \
((int)(((size_t)(a) < (size_t)INT_MAX) ? ffs((int)(a))-1 : \ ((int)(((size_t)(a) < (size_t)INT_MAX) ? ffs((int)(a))-1 : \
ffs((int)(((size_t)(a))>>32))+31)) ffs((int)(((size_t)(a))>>32))+31))
# endif #endif
# define MALLOCX_ZERO ((int)0x40) #define MALLOCX_ZERO ((int)0x40)
/* /*
* Bias tcache index bits so that 0 encodes "automatic tcache management", and 1 * Bias tcache index bits so that 0 encodes "automatic tcache management", and 1
* encodes MALLOCX_TCACHE_NONE. * encodes MALLOCX_TCACHE_NONE.
*/ */
# define MALLOCX_TCACHE(tc) ((int)(((tc)+2) << 8)) #define MALLOCX_TCACHE(tc) ((int)(((tc)+2) << 8))
# define MALLOCX_TCACHE_NONE MALLOCX_TCACHE(-1) #define MALLOCX_TCACHE_NONE MALLOCX_TCACHE(-1)
/* /*
* Bias arena index bits so that 0 encodes "use an automatically chosen arena". * Bias arena index bits so that 0 encodes "use an automatically chosen arena".
*/ */
# define MALLOCX_ARENA(a) ((((int)(a))+1) << 20) #define MALLOCX_ARENA(a) ((((int)(a))+1) << 20)
/*
* Use as arena index in "arena.<i>.{purge,decay,dss}" and
* "stats.arenas.<i>.*" mallctl interfaces to select all arenas. This
* definition is intentionally specified in raw decimal format to support
* cpp-based string concatenation, e.g.
*
* #define STRINGIFY_HELPER(x) #x
* #define STRINGIFY(x) STRINGIFY_HELPER(x)
*
* mallctl("arena." STRINGIFY(MALLCTL_ARENAS_ALL) ".purge", NULL, NULL, NULL,
* 0);
*/
#define MALLCTL_ARENAS_ALL 4096
/*
* Use as arena index in "stats.arenas.<i>.*" mallctl interfaces to select
* destroyed arenas.
*/
#define MALLCTL_ARENAS_DESTROYED 4097
#if defined(__cplusplus) && defined(JEMALLOC_USE_CXX_THROW) #if defined(__cplusplus) && defined(JEMALLOC_USE_CXX_THROW)
# define JEMALLOC_CXX_THROW throw() # define JEMALLOC_CXX_THROW throw()
@ -119,7 +158,7 @@ extern "C" {
# define JEMALLOC_CXX_THROW # define JEMALLOC_CXX_THROW
#endif #endif
#if _MSC_VER #if defined(_MSC_VER)
# define JEMALLOC_ATTR(s) # define JEMALLOC_ATTR(s)
# define JEMALLOC_ALIGNED(s) __declspec(align(s)) # define JEMALLOC_ALIGNED(s) __declspec(align(s))
# define JEMALLOC_ALLOC_SIZE(s) # define JEMALLOC_ALLOC_SIZE(s)
@ -131,7 +170,9 @@ extern "C" {
# define JEMALLOC_EXPORT __declspec(dllimport) # define JEMALLOC_EXPORT __declspec(dllimport)
# endif # endif
# endif # endif
# define JEMALLOC_FORMAT_ARG(i)
# define JEMALLOC_FORMAT_PRINTF(s, i) # define JEMALLOC_FORMAT_PRINTF(s, i)
# define JEMALLOC_FALLTHROUGH
# define JEMALLOC_NOINLINE __declspec(noinline) # define JEMALLOC_NOINLINE __declspec(noinline)
# ifdef __cplusplus # ifdef __cplusplus
# define JEMALLOC_NOTHROW __declspec(nothrow) # define JEMALLOC_NOTHROW __declspec(nothrow)
@ -145,6 +186,8 @@ extern "C" {
# else # else
# define JEMALLOC_ALLOCATOR # define JEMALLOC_ALLOCATOR
# endif # endif
# define JEMALLOC_COLD
# define JEMALLOC_WARN_ON_USAGE(warning_message)
#elif defined(JEMALLOC_HAVE_ATTR) #elif defined(JEMALLOC_HAVE_ATTR)
# define JEMALLOC_ATTR(s) __attribute__((s)) # define JEMALLOC_ATTR(s) __attribute__((s))
# define JEMALLOC_ALIGNED(s) JEMALLOC_ATTR(aligned(s)) # define JEMALLOC_ALIGNED(s) JEMALLOC_ATTR(aligned(s))
@ -158,6 +201,11 @@ extern "C" {
# ifndef JEMALLOC_EXPORT # ifndef JEMALLOC_EXPORT
# define JEMALLOC_EXPORT JEMALLOC_ATTR(visibility("default")) # define JEMALLOC_EXPORT JEMALLOC_ATTR(visibility("default"))
# endif # endif
# ifdef JEMALLOC_HAVE_ATTR_FORMAT_ARG
# define JEMALLOC_FORMAT_ARG(i) JEMALLOC_ATTR(__format_arg__(3))
# else
# define JEMALLOC_FORMAT_ARG(i)
# endif
# ifdef JEMALLOC_HAVE_ATTR_FORMAT_GNU_PRINTF # ifdef JEMALLOC_HAVE_ATTR_FORMAT_GNU_PRINTF
# define JEMALLOC_FORMAT_PRINTF(s, i) JEMALLOC_ATTR(format(gnu_printf, s, i)) # define JEMALLOC_FORMAT_PRINTF(s, i) JEMALLOC_ATTR(format(gnu_printf, s, i))
# elif defined(JEMALLOC_HAVE_ATTR_FORMAT_PRINTF) # elif defined(JEMALLOC_HAVE_ATTR_FORMAT_PRINTF)
@ -165,11 +213,26 @@ extern "C" {
# else # else
# define JEMALLOC_FORMAT_PRINTF(s, i) # define JEMALLOC_FORMAT_PRINTF(s, i)
# endif # endif
# ifdef JEMALLOC_HAVE_ATTR_FALLTHROUGH
# define JEMALLOC_FALLTHROUGH JEMALLOC_ATTR(fallthrough)
# else
# define JEMALLOC_FALLTHROUGH
# endif
# define JEMALLOC_NOINLINE JEMALLOC_ATTR(noinline) # define JEMALLOC_NOINLINE JEMALLOC_ATTR(noinline)
# define JEMALLOC_NOTHROW JEMALLOC_ATTR(nothrow) # define JEMALLOC_NOTHROW JEMALLOC_ATTR(nothrow)
# define JEMALLOC_SECTION(s) JEMALLOC_ATTR(section(s)) # define JEMALLOC_SECTION(s) JEMALLOC_ATTR(section(s))
# define JEMALLOC_RESTRICT_RETURN # define JEMALLOC_RESTRICT_RETURN
# define JEMALLOC_ALLOCATOR # define JEMALLOC_ALLOCATOR
# ifdef JEMALLOC_HAVE_ATTR_COLD
# define JEMALLOC_COLD JEMALLOC_ATTR(__cold__)
# else
# define JEMALLOC_COLD
# endif
# ifdef JEMALLOC_HAVE_ATTR_DEPRECATED
# define JEMALLOC_WARN_ON_USAGE(warning_message) JEMALLOC_ATTR(deprecated(warning_message))
# else
# define JEMALLOC_WARN_ON_USAGE(warning_message)
# endif
#else #else
# define JEMALLOC_ATTR(s) # define JEMALLOC_ATTR(s)
# define JEMALLOC_ALIGNED(s) # define JEMALLOC_ALIGNED(s)
@ -177,11 +240,20 @@ extern "C" {
# define JEMALLOC_ALLOC_SIZE2(s1, s2) # define JEMALLOC_ALLOC_SIZE2(s1, s2)
# define JEMALLOC_EXPORT # define JEMALLOC_EXPORT
# define JEMALLOC_FORMAT_PRINTF(s, i) # define JEMALLOC_FORMAT_PRINTF(s, i)
# define JEMALLOC_FALLTHROUGH
# define JEMALLOC_NOINLINE # define JEMALLOC_NOINLINE
# define JEMALLOC_NOTHROW # define JEMALLOC_NOTHROW
# define JEMALLOC_SECTION(s) # define JEMALLOC_SECTION(s)
# define JEMALLOC_RESTRICT_RETURN # define JEMALLOC_RESTRICT_RETURN
# define JEMALLOC_ALLOCATOR # define JEMALLOC_ALLOCATOR
# define JEMALLOC_COLD
# define JEMALLOC_WARN_ON_USAGE(warning_message)
#endif
#if (defined(__APPLE__) || defined(__FreeBSD__) || defined(__OpenBSD__) || (defined(__linux__) && !defined(__GLIBC__))) && !defined(JEMALLOC_NO_RENAME)
# define JEMALLOC_SYS_NOTHROW
#else
# define JEMALLOC_SYS_NOTHROW JEMALLOC_NOTHROW
#endif #endif
/* /*
@ -190,26 +262,31 @@ extern "C" {
* JEMALLOC_NO_DEMANGLE is defined (see jemalloc_mangle.h). * JEMALLOC_NO_DEMANGLE is defined (see jemalloc_mangle.h).
*/ */
extern JEMALLOC_EXPORT const char *je_malloc_conf; extern JEMALLOC_EXPORT const char *je_malloc_conf;
extern JEMALLOC_EXPORT const char *je_malloc_conf_2_conf_harder;
extern JEMALLOC_EXPORT void (*je_malloc_message)(void *cbopaque, extern JEMALLOC_EXPORT void (*je_malloc_message)(void *cbopaque,
const char *s); const char *s);
JEMALLOC_EXPORT JEMALLOC_ALLOCATOR JEMALLOC_RESTRICT_RETURN JEMALLOC_EXPORT JEMALLOC_ALLOCATOR JEMALLOC_RESTRICT_RETURN
void JEMALLOC_NOTHROW *je_malloc(size_t size) void JEMALLOC_SYS_NOTHROW *je_malloc(size_t size)
JEMALLOC_CXX_THROW JEMALLOC_ATTR(malloc) JEMALLOC_ALLOC_SIZE(1); JEMALLOC_CXX_THROW JEMALLOC_ATTR(malloc) JEMALLOC_ALLOC_SIZE(1);
JEMALLOC_EXPORT JEMALLOC_ALLOCATOR JEMALLOC_RESTRICT_RETURN JEMALLOC_EXPORT JEMALLOC_ALLOCATOR JEMALLOC_RESTRICT_RETURN
void JEMALLOC_NOTHROW *je_calloc(size_t num, size_t size) void JEMALLOC_SYS_NOTHROW *je_calloc(size_t num, size_t size)
JEMALLOC_CXX_THROW JEMALLOC_ATTR(malloc) JEMALLOC_ALLOC_SIZE2(1, 2); JEMALLOC_CXX_THROW JEMALLOC_ATTR(malloc) JEMALLOC_ALLOC_SIZE2(1, 2);
JEMALLOC_EXPORT int JEMALLOC_NOTHROW je_posix_memalign(void **memptr, JEMALLOC_EXPORT int JEMALLOC_SYS_NOTHROW je_posix_memalign(
size_t alignment, size_t size) JEMALLOC_CXX_THROW JEMALLOC_ATTR(nonnull(1)); void **memptr, size_t alignment, size_t size) JEMALLOC_CXX_THROW
JEMALLOC_ATTR(nonnull(1));
JEMALLOC_EXPORT JEMALLOC_ALLOCATOR JEMALLOC_RESTRICT_RETURN JEMALLOC_EXPORT JEMALLOC_ALLOCATOR JEMALLOC_RESTRICT_RETURN
void JEMALLOC_NOTHROW *je_aligned_alloc(size_t alignment, void JEMALLOC_SYS_NOTHROW *je_aligned_alloc(size_t alignment,
size_t size) JEMALLOC_CXX_THROW JEMALLOC_ATTR(malloc) size_t size) JEMALLOC_CXX_THROW JEMALLOC_ATTR(malloc)
JEMALLOC_ALLOC_SIZE(2); JEMALLOC_ALLOC_SIZE(2);
JEMALLOC_EXPORT JEMALLOC_ALLOCATOR JEMALLOC_RESTRICT_RETURN JEMALLOC_EXPORT JEMALLOC_ALLOCATOR JEMALLOC_RESTRICT_RETURN
void JEMALLOC_NOTHROW *je_realloc(void *ptr, size_t size) void JEMALLOC_SYS_NOTHROW *je_realloc(void *ptr, size_t size)
JEMALLOC_CXX_THROW JEMALLOC_ALLOC_SIZE(2); JEMALLOC_CXX_THROW JEMALLOC_ALLOC_SIZE(2);
JEMALLOC_EXPORT void JEMALLOC_NOTHROW je_free(void *ptr) JEMALLOC_EXPORT void JEMALLOC_SYS_NOTHROW je_free(void *ptr)
JEMALLOC_CXX_THROW; JEMALLOC_CXX_THROW;
JEMALLOC_EXPORT void JEMALLOC_NOTHROW je_free_sized(void *ptr, size_t size);
JEMALLOC_EXPORT void JEMALLOC_NOTHROW je_free_aligned_sized(
void *ptr, size_t alignment, size_t size);
JEMALLOC_EXPORT JEMALLOC_ALLOCATOR JEMALLOC_RESTRICT_RETURN JEMALLOC_EXPORT JEMALLOC_ALLOCATOR JEMALLOC_RESTRICT_RETURN
void JEMALLOC_NOTHROW *je_mallocx(size_t size, int flags) void JEMALLOC_NOTHROW *je_mallocx(size_t size, int flags)
@ -238,76 +315,106 @@ JEMALLOC_EXPORT void JEMALLOC_NOTHROW je_malloc_stats_print(
const char *opts); const char *opts);
JEMALLOC_EXPORT size_t JEMALLOC_NOTHROW je_malloc_usable_size( JEMALLOC_EXPORT size_t JEMALLOC_NOTHROW je_malloc_usable_size(
JEMALLOC_USABLE_SIZE_CONST void *ptr) JEMALLOC_CXX_THROW; JEMALLOC_USABLE_SIZE_CONST void *ptr) JEMALLOC_CXX_THROW;
#ifdef JEMALLOC_HAVE_MALLOC_SIZE
JEMALLOC_EXPORT size_t JEMALLOC_NOTHROW je_malloc_size(
const void *ptr);
#endif
#ifdef JEMALLOC_OVERRIDE_MEMALIGN #ifdef JEMALLOC_OVERRIDE_MEMALIGN
JEMALLOC_EXPORT JEMALLOC_ALLOCATOR JEMALLOC_RESTRICT_RETURN JEMALLOC_EXPORT JEMALLOC_ALLOCATOR JEMALLOC_RESTRICT_RETURN
void JEMALLOC_NOTHROW *je_memalign(size_t alignment, size_t size) void JEMALLOC_SYS_NOTHROW *je_memalign(size_t alignment, size_t size)
JEMALLOC_CXX_THROW JEMALLOC_ATTR(malloc); JEMALLOC_CXX_THROW JEMALLOC_ATTR(malloc);
#endif #endif
#ifdef JEMALLOC_OVERRIDE_VALLOC #ifdef JEMALLOC_OVERRIDE_VALLOC
JEMALLOC_EXPORT JEMALLOC_ALLOCATOR JEMALLOC_RESTRICT_RETURN JEMALLOC_EXPORT JEMALLOC_ALLOCATOR JEMALLOC_RESTRICT_RETURN
void JEMALLOC_NOTHROW *je_valloc(size_t size) JEMALLOC_CXX_THROW void JEMALLOC_SYS_NOTHROW *je_valloc(size_t size) JEMALLOC_CXX_THROW
JEMALLOC_ATTR(malloc); JEMALLOC_ATTR(malloc);
#endif #endif
#ifdef JEMALLOC_OVERRIDE_PVALLOC
JEMALLOC_EXPORT JEMALLOC_ALLOCATOR JEMALLOC_RESTRICT_RETURN
void JEMALLOC_SYS_NOTHROW *je_pvalloc(size_t size) JEMALLOC_CXX_THROW
JEMALLOC_ATTR(malloc);
#endif
typedef struct extent_hooks_s extent_hooks_t;
/* /*
* void * * void *
* chunk_alloc(void *new_addr, size_t size, size_t alignment, bool *zero, * extent_alloc(extent_hooks_t *extent_hooks, void *new_addr, size_t size,
* bool *commit, unsigned arena_ind); * size_t alignment, bool *zero, bool *commit, unsigned arena_ind);
*/ */
typedef void *(chunk_alloc_t)(void *, size_t, size_t, bool *, bool *, unsigned); typedef void *(extent_alloc_t)(extent_hooks_t *, void *, size_t, size_t, bool *,
bool *, unsigned);
/* /*
* bool * bool
* chunk_dalloc(void *chunk, size_t size, bool committed, unsigned arena_ind); * extent_dalloc(extent_hooks_t *extent_hooks, void *addr, size_t size,
*/
typedef bool (chunk_dalloc_t)(void *, size_t, bool, unsigned);
/*
* bool
* chunk_commit(void *chunk, size_t size, size_t offset, size_t length,
* unsigned arena_ind);
*/
typedef bool (chunk_commit_t)(void *, size_t, size_t, size_t, unsigned);
/*
* bool
* chunk_decommit(void *chunk, size_t size, size_t offset, size_t length,
* unsigned arena_ind);
*/
typedef bool (chunk_decommit_t)(void *, size_t, size_t, size_t, unsigned);
/*
* bool
* chunk_purge(void *chunk, size_t size, size_t offset, size_t length,
* unsigned arena_ind);
*/
typedef bool (chunk_purge_t)(void *, size_t, size_t, size_t, unsigned);
/*
* bool
* chunk_split(void *chunk, size_t size, size_t size_a, size_t size_b,
* bool committed, unsigned arena_ind); * bool committed, unsigned arena_ind);
*/ */
typedef bool (chunk_split_t)(void *, size_t, size_t, size_t, bool, unsigned); typedef bool (extent_dalloc_t)(extent_hooks_t *, void *, size_t, bool,
unsigned);
/*
* void
* extent_destroy(extent_hooks_t *extent_hooks, void *addr, size_t size,
* bool committed, unsigned arena_ind);
*/
typedef void (extent_destroy_t)(extent_hooks_t *, void *, size_t, bool,
unsigned);
/* /*
* bool * bool
* chunk_merge(void *chunk_a, size_t size_a, void *chunk_b, size_t size_b, * extent_commit(extent_hooks_t *extent_hooks, void *addr, size_t size,
* bool committed, unsigned arena_ind); * size_t offset, size_t length, unsigned arena_ind);
*/ */
typedef bool (chunk_merge_t)(void *, size_t, void *, size_t, bool, unsigned); typedef bool (extent_commit_t)(extent_hooks_t *, void *, size_t, size_t, size_t,
unsigned);
typedef struct { /*
chunk_alloc_t *alloc; * bool
chunk_dalloc_t *dalloc; * extent_decommit(extent_hooks_t *extent_hooks, void *addr, size_t size,
chunk_commit_t *commit; * size_t offset, size_t length, unsigned arena_ind);
chunk_decommit_t *decommit; */
chunk_purge_t *purge; typedef bool (extent_decommit_t)(extent_hooks_t *, void *, size_t, size_t,
chunk_split_t *split; size_t, unsigned);
chunk_merge_t *merge;
} chunk_hooks_t; /*
* bool
* extent_purge(extent_hooks_t *extent_hooks, void *addr, size_t size,
* size_t offset, size_t length, unsigned arena_ind);
*/
typedef bool (extent_purge_t)(extent_hooks_t *, void *, size_t, size_t, size_t,
unsigned);
/*
* bool
* extent_split(extent_hooks_t *extent_hooks, void *addr, size_t size,
* size_t size_a, size_t size_b, bool committed, unsigned arena_ind);
*/
typedef bool (extent_split_t)(extent_hooks_t *, void *, size_t, size_t, size_t,
bool, unsigned);
/*
* bool
* extent_merge(extent_hooks_t *extent_hooks, void *addr_a, size_t size_a,
* void *addr_b, size_t size_b, bool committed, unsigned arena_ind);
*/
typedef bool (extent_merge_t)(extent_hooks_t *, void *, size_t, void *, size_t,
bool, unsigned);
struct extent_hooks_s {
extent_alloc_t *alloc;
extent_dalloc_t *dalloc;
extent_destroy_t *destroy;
extent_commit_t *commit;
extent_decommit_t *decommit;
extent_purge_t *purge_lazy;
extent_purge_t *purge_forced;
extent_split_t *split;
extent_merge_t *merge;
};
/* /*
* By default application code must explicitly refer to mangled symbol names, * By default application code must explicitly refer to mangled symbol names,
@ -320,28 +427,33 @@ typedef struct {
# ifndef JEMALLOC_NO_DEMANGLE # ifndef JEMALLOC_NO_DEMANGLE
# define JEMALLOC_NO_DEMANGLE # define JEMALLOC_NO_DEMANGLE
# endif # endif
# define malloc_conf je_malloc_conf
# define malloc_message je_malloc_message
# define malloc je_malloc
# define calloc je_calloc
# define posix_memalign je_posix_memalign
# define aligned_alloc je_aligned_alloc # define aligned_alloc je_aligned_alloc
# define realloc je_realloc # define calloc je_calloc
# define free je_free
# define mallocx je_mallocx
# define rallocx je_rallocx
# define xallocx je_xallocx
# define sallocx je_sallocx
# define dallocx je_dallocx # define dallocx je_dallocx
# define sdallocx je_sdallocx # define free je_free
# define nallocx je_nallocx # define free_sized je_free_sized
# define free_aligned_sized je_free_aligned_sized
# define mallctl je_mallctl # define mallctl je_mallctl
# define mallctlnametomib je_mallctlnametomib
# define mallctlbymib je_mallctlbymib # define mallctlbymib je_mallctlbymib
# define mallctlnametomib je_mallctlnametomib
# define malloc je_malloc
# define malloc_conf je_malloc_conf
# define malloc_conf_2_conf_harder je_malloc_conf_2_conf_harder
# define malloc_message je_malloc_message
# define malloc_stats_print je_malloc_stats_print # define malloc_stats_print je_malloc_stats_print
# define malloc_usable_size je_malloc_usable_size # define malloc_usable_size je_malloc_usable_size
# define mallocx je_mallocx
# define smallocx_f9c0b5f7f8a917661db39289e38ec94d9d198f11 je_smallocx_f9c0b5f7f8a917661db39289e38ec94d9d198f11
# define nallocx je_nallocx
# define posix_memalign je_posix_memalign
# define rallocx je_rallocx
# define realloc je_realloc
# define sallocx je_sallocx
# define sdallocx je_sdallocx
# define xallocx je_xallocx
# define memalign je_memalign # define memalign je_memalign
# define valloc je_valloc # define valloc je_valloc
# define pvalloc je_pvalloc
#endif #endif
/* /*
@ -352,28 +464,33 @@ typedef struct {
* and/or --with-jemalloc-prefix. * and/or --with-jemalloc-prefix.
*/ */
#ifndef JEMALLOC_NO_DEMANGLE #ifndef JEMALLOC_NO_DEMANGLE
# undef je_malloc_conf
# undef je_malloc_message
# undef je_malloc
# undef je_calloc
# undef je_posix_memalign
# undef je_aligned_alloc # undef je_aligned_alloc
# undef je_realloc # undef je_calloc
# undef je_free
# undef je_mallocx
# undef je_rallocx
# undef je_xallocx
# undef je_sallocx
# undef je_dallocx # undef je_dallocx
# undef je_sdallocx # undef je_free
# undef je_nallocx # undef je_free_sized
# undef je_free_aligned_sized
# undef je_mallctl # undef je_mallctl
# undef je_mallctlnametomib
# undef je_mallctlbymib # undef je_mallctlbymib
# undef je_mallctlnametomib
# undef je_malloc
# undef je_malloc_conf
# undef je_malloc_conf_2_conf_harder
# undef je_malloc_message
# undef je_malloc_stats_print # undef je_malloc_stats_print
# undef je_malloc_usable_size # undef je_malloc_usable_size
# undef je_mallocx
# undef je_smallocx_f9c0b5f7f8a917661db39289e38ec94d9d198f11
# undef je_nallocx
# undef je_posix_memalign
# undef je_rallocx
# undef je_realloc
# undef je_sallocx
# undef je_sdallocx
# undef je_xallocx
# undef je_memalign # undef je_memalign
# undef je_valloc # undef je_valloc
# undef je_pvalloc
#endif #endif
#ifdef __cplusplus #ifdef __cplusplus

BIN
lib/linux/libcrypto.a vendored

Binary file not shown.

Binary file not shown.

View File

@ -1,15 +1,15 @@
#!/bin/sh -e #!/bin/sh -e
mkdir client_distribution mkdir -p client_distribution
mkdir client_distribution/assets mkdir -p client_distribution/assets
mkdir client_distribution/assets/user mkdir -p client_distribution/assets/user
./dist/asset_packer -c scripts/packing.config assets/opensb client_distribution/assets/opensb.pak ./dist/asset_packer -c scripts/packing.config assets/opensb client_distribution/assets/opensb.pak
mkdir client_distribution/mods mkdir -p client_distribution/mods
touch client_distribution/mods/mods_go_here touch client_distribution/mods/mods_go_here
mkdir client_distribution/linux mkdir -p client_distribution/linux
cp \ cp \
dist/starbound \ dist/starbound \
dist/btree_repacker \ dist/btree_repacker \
@ -23,15 +23,15 @@ cp \
scripts/ci/linux/run-client.sh \ scripts/ci/linux/run-client.sh \
client_distribution/linux/ client_distribution/linux/
mkdir server_distribution mkdir -p server_distribution
mkdir server_distribution/assets mkdir -p server_distribution/assets
mkdir server_distribution/mods mkdir -p server_distribution/mods
touch server_distribution/mods/mods_go_here touch server_distribution/mods/mods_go_here
./dist/asset_packer -c scripts/packing.config -s assets/opensb server_distribution/assets/opensb.pak ./dist/asset_packer -c scripts/packing.config -s assets/opensb server_distribution/assets/opensb.pak
mkdir server_distribution/linux mkdir -p server_distribution/linux
cp \ cp \
dist/starbound_server \ dist/starbound_server \

View File

@ -17,8 +17,8 @@
"VCPKG_OVERLAY_TRIPLETS": "${sourceParentDir}/triplets", "VCPKG_OVERLAY_TRIPLETS": "${sourceParentDir}/triplets",
"CMAKE_VERBOSE_MAKEFILE": true, "CMAKE_VERBOSE_MAKEFILE": true,
"BUILD_TESTING": true, "BUILD_TESTING": true,
"STAR_ENABLE_STEAM_INTEGRATION": true, "STAR_ENABLE_STEAM_INTEGRATION": false,
"STAR_ENABLE_DISCORD_INTEGRATION": true "STAR_ENABLE_DISCORD_INTEGRATION": false
} }
}, },
{ {
@ -135,4 +135,4 @@
"configurePreset": "macos-arm-release" "configurePreset": "macos-arm-release"
} }
] ]
} }

View File

@ -371,7 +371,7 @@ StringList Assets::scan(String const& suffix) const {
StringList Assets::scan(String const& prefix, String const& suffix) const { StringList Assets::scan(String const& prefix, String const& suffix) const {
StringList result; StringList result;
if (suffix.beginsWith(".") && !suffix.substr(1).hasChar('.')) { if (suffix.beginsWith(".") && !suffix.substr(1).hasChar('.')) {
StringSet filesWithExtension = scanExtension(suffix); auto& filesWithExtension = scanExtension(suffix);
for (auto const& file : filesWithExtension) { for (auto const& file : filesWithExtension) {
if (file.beginsWith(prefix, String::CaseInsensitive)) if (file.beginsWith(prefix, String::CaseInsensitive))
result.append(file); result.append(file);
@ -386,11 +386,11 @@ StringList Assets::scan(String const& prefix, String const& suffix) const {
return result; return result;
} }
const StringSet NullStringSet; const CaseInsensitiveStringSet NullExtensionScan;
StringSet const& Assets::scanExtension(String const& extension) const { CaseInsensitiveStringSet const& Assets::scanExtension(String const& extension) const {
auto find = m_filesByExtension.find(extension.beginsWith(".") ? extension.substr(1) : extension); auto find = m_filesByExtension.find(extension.beginsWith(".") ? extension.substr(1) : extension);
return find != m_filesByExtension.end() ? find->second : NullStringSet; return find != m_filesByExtension.end() ? find->second : NullExtensionScan;
} }
Json Assets::json(String const& path) const { Json Assets::json(String const& path) const {
@ -416,7 +416,7 @@ void Assets::queueJsons(StringList const& paths) const {
})); }));
} }
void Assets::queueJsons(StringSet const& paths) const { void Assets::queueJsons(CaseInsensitiveStringSet const& paths) const {
MutexLocker assetsLocker(m_assetsMutex); MutexLocker assetsLocker(m_assetsMutex);
for (String const& path : paths) { for (String const& path : paths) {
auto components = AssetPath::split(path); auto components = AssetPath::split(path);
@ -439,7 +439,7 @@ void Assets::queueImages(StringList const& paths) const {
})); }));
} }
void Assets::queueImages(StringSet const& paths) const { void Assets::queueImages(CaseInsensitiveStringSet const& paths) const {
MutexLocker assetsLocker(m_assetsMutex); MutexLocker assetsLocker(m_assetsMutex);
for (String const& path : paths) { for (String const& path : paths) {
auto components = AssetPath::split(path); auto components = AssetPath::split(path);
@ -482,7 +482,7 @@ void Assets::queueAudios(StringList const& paths) const {
})); }));
} }
void Assets::queueAudios(StringSet const& paths) const { void Assets::queueAudios(CaseInsensitiveStringSet const& paths) const {
MutexLocker assetsLocker(m_assetsMutex); MutexLocker assetsLocker(m_assetsMutex);
for (String const& path : paths) { for (String const& path : paths) {
auto components = AssetPath::split(path); auto components = AssetPath::split(path);

View File

@ -190,7 +190,7 @@ public:
// Scans all assets for files with the given extension, which is specially // Scans all assets for files with the given extension, which is specially
// indexed and much faster than a normal scan. Extension may contain leading // indexed and much faster than a normal scan. Extension may contain leading
// '.' character or it may be omitted. // '.' character or it may be omitted.
StringSet const& scanExtension(String const& extension) const; CaseInsensitiveStringSet const& scanExtension(String const& extension) const;
// Get json asset with an optional sub-path. The sub-path portion of the // Get json asset with an optional sub-path. The sub-path portion of the
// path refers to a key in the top-level object, and may use dot notation // path refers to a key in the top-level object, and may use dot notation
@ -204,7 +204,7 @@ public:
// Load all the given jsons using background processing. // Load all the given jsons using background processing.
void queueJsons(StringList const& paths) const; void queueJsons(StringList const& paths) const;
void queueJsons(StringSet const& paths) const; void queueJsons(CaseInsensitiveStringSet const& paths) const;
// Returns *either* an image asset or a sub-frame. Frame files are JSON // Returns *either* an image asset or a sub-frame. Frame files are JSON
// descriptor files that reference a particular image and label separate // descriptor files that reference a particular image and label separate
@ -216,7 +216,7 @@ public:
ImageConstPtr image(AssetPath const& path) const; ImageConstPtr image(AssetPath const& path) const;
// Load images using background processing // Load images using background processing
void queueImages(StringList const& paths) const; void queueImages(StringList const& paths) const;
void queueImages(StringSet const& paths) const; void queueImages(CaseInsensitiveStringSet const& paths) const;
// Return the given image *if* it is already loaded, otherwise queue it for // Return the given image *if* it is already loaded, otherwise queue it for
// loading. // loading.
ImageConstPtr tryImage(AssetPath const& path) const; ImageConstPtr tryImage(AssetPath const& path) const;
@ -231,7 +231,7 @@ public:
AudioConstPtr audio(String const& path) const; AudioConstPtr audio(String const& path) const;
// Load audios using background processing // Load audios using background processing
void queueAudios(StringList const& paths) const; void queueAudios(StringList const& paths) const;
void queueAudios(StringSet const& paths) const; void queueAudios(CaseInsensitiveStringSet const& paths) const;
// Return the given audio *if* it is already loaded, otherwise queue it for // Return the given audio *if* it is already loaded, otherwise queue it for
// loading. // loading.
AudioConstPtr tryAudio(String const& path) const; AudioConstPtr tryAudio(String const& path) const;
@ -331,7 +331,7 @@ private:
// Maps the source asset name to the source containing it // Maps the source asset name to the source containing it
CaseInsensitiveStringMap<AssetFileDescriptor> m_files; CaseInsensitiveStringMap<AssetFileDescriptor> m_files;
// Maps an extension to the files with that extension // Maps an extension to the files with that extension
CaseInsensitiveStringMap<StringSet> m_filesByExtension; CaseInsensitiveStringMap<CaseInsensitiveStringSet> m_filesByExtension;
ByteArray m_digest; ByteArray m_digest;

View File

@ -63,6 +63,7 @@ Json const AdditionalDefaultConfiguration = Json::parseJson(R"JSON(
"antiAliasing" : false, "antiAliasing" : false,
"zoomLevel" : 3.0, "zoomLevel" : 3.0,
"cameraSpeedFactor" : 1.0, "cameraSpeedFactor" : 1.0,
"interfaceScale" : 0,
"speechBubbles" : true, "speechBubbles" : true,
"title" : { "title" : {
@ -371,7 +372,9 @@ void ClientApplication::render() {
renderer->setMultiSampling(config->get("antiAliasing").optBool().value(false) ? 4 : 0); renderer->setMultiSampling(config->get("antiAliasing").optBool().value(false) ? 4 : 0);
renderer->switchEffectConfig("interface"); renderer->switchEffectConfig("interface");
if (m_guiContext->windowWidth() >= m_crossoverRes[0] && m_guiContext->windowHeight() >= m_crossoverRes[1]) if (auto interfaceScale = config->get("interfaceScale").optUInt().value())
m_guiContext->setInterfaceScale(interfaceScale);
else if (m_guiContext->windowWidth() >= m_crossoverRes[0] && m_guiContext->windowHeight() >= m_crossoverRes[1])
m_guiContext->setInterfaceScale(m_maxInterfaceScale); m_guiContext->setInterfaceScale(m_maxInterfaceScale);
else else
m_guiContext->setInterfaceScale(m_minInterfaceScale); m_guiContext->setInterfaceScale(m_minInterfaceScale);

View File

@ -359,6 +359,8 @@ struct CaseInsensitiveStringCompare {
typedef HashSet<String> StringSet; typedef HashSet<String> StringSet;
typedef HashSet<String, CaseInsensitiveStringHash, CaseInsensitiveStringCompare> CaseInsensitiveStringSet;
template <typename MappedT, typename HashT = hash<String>, typename ComparatorT = std::equal_to<String>> template <typename MappedT, typename HashT = hash<String>, typename ComparatorT = std::equal_to<String>>
using StringMap = HashMap<String, MappedT, HashT, ComparatorT>; using StringMap = HashMap<String, MappedT, HashT, ComparatorT>;

View File

@ -77,7 +77,9 @@ void CharSelectionPane::updateCharacterPlates() {
auto updatePlayerLine = [this](String name, unsigned scrollPosition) { auto updatePlayerLine = [this](String name, unsigned scrollPosition) {
auto charSelector = fetchChild<LargeCharPlateWidget>(name); auto charSelector = fetchChild<LargeCharPlateWidget>(name);
if (auto playerUuid = m_playerStorage->playerUuidAt(scrollPosition)) { if (auto playerUuid = m_playerStorage->playerUuidAt(scrollPosition)) {
charSelector->setPlayer(m_playerStorage->loadPlayer(*playerUuid)); auto player = m_playerStorage->loadPlayer(*playerUuid);
player->humanoid()->setFacingDirection(Direction::Right);
charSelector->setPlayer(player);
charSelector->enableDelete([this, playerUuid](Widget*) { m_deleteCallback(*playerUuid); }); charSelector->enableDelete([this, playerUuid](Widget*) { m_deleteCallback(*playerUuid); });
} else { } else {
charSelector->setPlayer(PlayerPtr()); charSelector->setPlayer(PlayerPtr());

View File

@ -195,7 +195,7 @@ void ChatBubbleManager::addChatActions(List<ChatAction> chatActions, bool silent
// bother me so bad if it weren't so fucking easy to do right. // bother me so bad if it weren't so fucking easy to do right.
// yea I agree // yea I agree
m_guiContext->setTextStyle(m_textStyle); m_guiContext->setTextStyle(m_textStyle, m_zoom);
auto result = m_guiContext->determineTextSize(sayAction.text, m_textTemplate); auto result = m_guiContext->determineTextSize(sayAction.text, m_textTemplate);
float textWidth = result.width() / m_zoom + m_textPadding[0]; float textWidth = result.width() / m_zoom + m_textPadding[0];
float textHeight = result.height() / m_zoom + m_textPadding[1]; float textHeight = result.height() / m_zoom + m_textPadding[1];

View File

@ -28,6 +28,11 @@ GraphicsMenu::GraphicsMenu() {
m_localChanges.set("fullscreenResolution", jsonFromVec2U(res)); m_localChanges.set("fullscreenResolution", jsonFromVec2U(res));
syncGui(); syncGui();
}); });
reader.registerCallback("interfaceScaleSlider", [=](Widget*) {
auto interfaceScaleSlider = fetchChild<SliderBarWidget>("interfaceScaleSlider");
m_localChanges.set("interfaceScale", (uint64_t)m_interfaceScaleList[interfaceScaleSlider->val()]);
syncGui();
});
reader.registerCallback("zoomSlider", [=](Widget*) { reader.registerCallback("zoomSlider", [=](Widget*) {
auto zoomSlider = fetchChild<SliderBarWidget>("zoomSlider"); auto zoomSlider = fetchChild<SliderBarWidget>("zoomSlider");
m_localChanges.set("zoomLevel", m_zoomList[zoomSlider->val()]); m_localChanges.set("zoomLevel", m_zoomList[zoomSlider->val()]);
@ -103,12 +108,14 @@ GraphicsMenu::GraphicsMenu() {
Json paneLayout = assets->json("/interface/windowconfig/graphicsmenu.config:paneLayout"); Json paneLayout = assets->json("/interface/windowconfig/graphicsmenu.config:paneLayout");
m_interfaceScaleList = jsonToIntList(assets->json("/interface/windowconfig/graphicsmenu.config:interfaceScaleList"));
m_resList = jsonToVec2UList(assets->json("/interface/windowconfig/graphicsmenu.config:resolutionList")); m_resList = jsonToVec2UList(assets->json("/interface/windowconfig/graphicsmenu.config:resolutionList"));
m_zoomList = jsonToFloatList(assets->json("/interface/windowconfig/graphicsmenu.config:zoomList")); m_zoomList = jsonToFloatList(assets->json("/interface/windowconfig/graphicsmenu.config:zoomList"));
m_cameraSpeedList = jsonToFloatList(assets->json("/interface/windowconfig/graphicsmenu.config:cameraSpeedList")); m_cameraSpeedList = jsonToFloatList(assets->json("/interface/windowconfig/graphicsmenu.config:cameraSpeedList"));
reader.construct(paneLayout, this); reader.construct(paneLayout, this);
fetchChild<SliderBarWidget>("interfaceScaleSlider")->setRange(0, m_interfaceScaleList.size() - 1, 1);
fetchChild<SliderBarWidget>("resSlider")->setRange(0, m_resList.size() - 1, 1); fetchChild<SliderBarWidget>("resSlider")->setRange(0, m_resList.size() - 1, 1);
fetchChild<SliderBarWidget>("zoomSlider")->setRange(0, m_zoomList.size() - 1, 1); fetchChild<SliderBarWidget>("zoomSlider")->setRange(0, m_zoomList.size() - 1, 1);
fetchChild<SliderBarWidget>("cameraSpeedSlider")->setRange(0, m_cameraSpeedList.size() - 1, 1); fetchChild<SliderBarWidget>("cameraSpeedSlider")->setRange(0, m_cameraSpeedList.size() - 1, 1);
@ -143,6 +150,7 @@ void GraphicsMenu::toggleFullscreen() {
StringList const GraphicsMenu::ConfigKeys = { StringList const GraphicsMenu::ConfigKeys = {
"fullscreenResolution", "fullscreenResolution",
"interfaceScale",
"zoomLevel", "zoomLevel",
"cameraSpeedFactor", "cameraSpeedFactor",
"speechBubbles", "speechBubbles",
@ -180,27 +188,38 @@ void GraphicsMenu::syncGui() {
} }
fetchChild<LabelWidget>("resValueLabel")->setText(strf("{}x{}", res[0], res[1])); fetchChild<LabelWidget>("resValueLabel")->setText(strf("{}x{}", res[0], res[1]));
auto interfaceScaleSlider = fetchChild<SliderBarWidget>("interfaceScaleSlider");
auto interfaceScale = m_localChanges.get("interfaceScale").optUInt().value();
auto interfaceScaleIt = std::lower_bound(m_interfaceScaleList.begin(), m_interfaceScaleList.end(), interfaceScale);
if (interfaceScaleIt != m_interfaceScaleList.end()) {
size_t scaleIndex = interfaceScaleIt - m_interfaceScaleList.begin();
interfaceScaleSlider->setVal(std::min(scaleIndex, m_interfaceScaleList.size() - 1), false);
} else {
interfaceScaleSlider->setVal(m_interfaceScaleList.size() - 1);
}
fetchChild<LabelWidget>("interfaceScaleValueLabel")->setText(interfaceScale ? toString(interfaceScale) : "AUTO");
auto zoomSlider = fetchChild<SliderBarWidget>("zoomSlider"); auto zoomSlider = fetchChild<SliderBarWidget>("zoomSlider");
auto zoomIt = std::lower_bound(m_zoomList.begin(), m_zoomList.end(), m_localChanges.get("zoomLevel").toFloat()); auto zoomLevel = m_localChanges.get("zoomLevel").toFloat();
auto zoomIt = std::lower_bound(m_zoomList.begin(), m_zoomList.end(), zoomLevel);
if (zoomIt != m_zoomList.end()) { if (zoomIt != m_zoomList.end()) {
size_t zoomIndex = zoomIt - m_zoomList.begin(); size_t zoomIndex = zoomIt - m_zoomList.begin();
zoomIndex = std::min(zoomIndex, m_zoomList.size() - 1); zoomSlider->setVal(std::min(zoomIndex, m_zoomList.size() - 1), false);
zoomSlider->setVal(zoomIndex, false);
} else { } else {
zoomSlider->setVal(m_zoomList.size() - 1); zoomSlider->setVal(m_zoomList.size() - 1);
} }
fetchChild<LabelWidget>("zoomValueLabel")->setText(strf("{}x", m_localChanges.get("zoomLevel").toFloat())); fetchChild<LabelWidget>("zoomValueLabel")->setText(strf("{}x", zoomLevel));
auto cameraSpeedSlider = fetchChild<SliderBarWidget>("cameraSpeedSlider"); auto cameraSpeedSlider = fetchChild<SliderBarWidget>("cameraSpeedSlider");
auto speedIt = std::lower_bound(m_cameraSpeedList.begin(), m_cameraSpeedList.end(), m_localChanges.get("cameraSpeedFactor").toFloat()); auto cameraSpeedFactor = m_localChanges.get("cameraSpeedFactor").toFloat();
auto speedIt = std::lower_bound(m_cameraSpeedList.begin(), m_cameraSpeedList.end(), cameraSpeedFactor);
if (speedIt != m_cameraSpeedList.end()) { if (speedIt != m_cameraSpeedList.end()) {
size_t speedIndex = speedIt - m_cameraSpeedList.begin(); size_t speedIndex = speedIt - m_cameraSpeedList.begin();
speedIndex = std::min(speedIndex, m_cameraSpeedList.size() - 1); cameraSpeedSlider->setVal(std::min(speedIndex, m_cameraSpeedList.size() - 1), false);
cameraSpeedSlider->setVal(speedIndex, false);
} else { } else {
cameraSpeedSlider->setVal(m_cameraSpeedList.size() - 1); cameraSpeedSlider->setVal(m_cameraSpeedList.size() - 1);
} }
fetchChild<LabelWidget>("cameraSpeedValueLabel")->setText(strf("{}x", m_localChanges.get("cameraSpeedFactor").toFloat())); fetchChild<LabelWidget>("cameraSpeedValueLabel")->setText(strf("{}x", cameraSpeedFactor));
fetchChild<ButtonWidget>("speechBubbleCheckbox")->setChecked(m_localChanges.get("speechBubbles").toBool()); fetchChild<ButtonWidget>("speechBubbleCheckbox")->setChecked(m_localChanges.get("speechBubbles").toBool());
fetchChild<ButtonWidget>("interactiveHighlightCheckbox")->setChecked(m_localChanges.get("interactiveHighlight").toBool()); fetchChild<ButtonWidget>("interactiveHighlightCheckbox")->setChecked(m_localChanges.get("interactiveHighlight").toBool());

View File

@ -25,6 +25,7 @@ private:
void applyWindowSettings(); void applyWindowSettings();
List<Vec2U> m_resList; List<Vec2U> m_resList;
List<int> m_interfaceScaleList;
List<float> m_zoomList; List<float> m_zoomList;
List<float> m_cameraSpeedList; List<float> m_cameraSpeedList;

View File

@ -220,15 +220,12 @@ void MainInterface::openMerchantWindow(Json const& config, EntityId sourceEntity
} }
bool openWithInventory = config.getBool("openWithInventory", true); bool openWithInventory = config.getBool("openWithInventory", true);
bool closeWithInventory = config.getBool("closeWithInventory", !m_paneManager.registeredPaneIsDisplayed(MainInterfacePanes::Inventory));
m_merchantWindow = make_shared<MerchantPane>(m_client->worldClient(), m_client->mainPlayer(), config, sourceEntityId); m_merchantWindow = make_shared<MerchantPane>(m_client->worldClient(), m_client->mainPlayer(), config, sourceEntityId);
m_paneManager.displayPane(PaneLayer::Window, m_paneManager.displayPane(PaneLayer::Window, m_merchantWindow, [this, closeWithInventory](PanePtr const&) {
m_merchantWindow, if (closeWithInventory)
[this, openWithInventory](PanePtr const&) { m_paneManager.dismissRegisteredPane(MainInterfacePanes::Inventory);
if (auto player = m_client->mainPlayer()) });
player->clearSwap();
if (openWithInventory)
m_paneManager.dismissRegisteredPane(MainInterfacePanes::Inventory);
});
if (openWithInventory) if (openWithInventory)
m_paneManager.displayRegisteredPane(MainInterfacePanes::Inventory); m_paneManager.displayRegisteredPane(MainInterfacePanes::Inventory);
@ -404,13 +401,17 @@ void MainInterface::handleInteractAction(InteractAction interactAction) {
m_containerInteractor->openContainer(containerEntity); m_containerInteractor->openContainer(containerEntity);
bool closeWithInventory = !m_paneManager.registeredPaneIsDisplayed(MainInterfacePanes::Inventory);
m_paneManager.displayRegisteredPane(MainInterfacePanes::Inventory); m_paneManager.displayRegisteredPane(MainInterfacePanes::Inventory);
m_containerPane = make_shared<ContainerPane>(world, m_client->mainPlayer(), m_containerInteractor); m_containerPane = make_shared<ContainerPane>(world, m_client->mainPlayer(), m_containerInteractor);
m_paneManager.displayPane(PaneLayer::Window, m_containerPane, [this](PanePtr const&) { m_paneManager.displayPane(PaneLayer::Window, m_containerPane, [this, closeWithInventory](PanePtr const&) {
if (auto player = m_client->mainPlayer()) if (closeWithInventory)
player->clearSwap(); m_paneManager.dismissRegisteredPane(MainInterfacePanes::Inventory);
m_paneManager.dismissRegisteredPane(MainInterfacePanes::Inventory); else {
m_containerInteractor->closeContainer();
m_containerPane = {};
}
}); });
m_paneManager.bringPaneAdjacent(m_paneManager.registeredPane(MainInterfacePanes::Inventory), m_paneManager.bringPaneAdjacent(m_paneManager.registeredPane(MainInterfacePanes::Inventory),
@ -1580,10 +1581,10 @@ void MainInterface::displayScriptPane(ScriptPanePtr& scriptPane, EntityId source
layer = PaneLayerNames.getLeft(*layerName); layer = PaneLayerNames.getLeft(*layerName);
if (scriptPane->openWithInventory()) { if (scriptPane->openWithInventory()) {
m_paneManager.displayPane(layer, scriptPane, [this](PanePtr const&) { bool closeWithInventory = scriptPane->closeWithInventory();
if (auto player = m_client->mainPlayer()) m_paneManager.displayPane(layer, scriptPane, [this, closeWithInventory](PanePtr const&) {
player->clearSwap(); if (closeWithInventory)
m_paneManager.dismissRegisteredPane(MainInterfacePanes::Inventory); m_paneManager.dismissRegisteredPane(MainInterfacePanes::Inventory);
}); });
m_paneManager.displayRegisteredPane(MainInterfacePanes::Inventory); m_paneManager.displayRegisteredPane(MainInterfacePanes::Inventory);
m_paneManager.bringPaneAdjacent(m_paneManager.registeredPane(MainInterfacePanes::Inventory), m_paneManager.bringPaneAdjacent(m_paneManager.registeredPane(MainInterfacePanes::Inventory),

View File

@ -88,6 +88,10 @@ bool ScriptPane::openWithInventory() const {
return m_config.getBool("openWithInventory", false); return m_config.getBool("openWithInventory", false);
} }
bool ScriptPane::closeWithInventory() const {
return m_config.getBool("closeWithInventory", openWithInventory());
}
EntityId ScriptPane::sourceEntityId() const { EntityId ScriptPane::sourceEntityId() const {
return m_sourceEntityId; return m_sourceEntityId;
} }

View File

@ -20,6 +20,7 @@ public:
PanePtr createTooltip(Vec2I const& screenPosition) override; PanePtr createTooltip(Vec2I const& screenPosition) override;
bool openWithInventory() const; bool openWithInventory() const;
bool closeWithInventory() const;
EntityId sourceEntityId() const; EntityId sourceEntityId() const;

View File

@ -9,6 +9,8 @@
namespace Star { namespace Star {
String const SongPathPrefix = "/songs/";
SongbookInterface::SongbookInterface(PlayerPtr player) { SongbookInterface::SongbookInterface(PlayerPtr player) {
m_player = std::move(player); m_player = std::move(player);
@ -60,9 +62,16 @@ bool SongbookInterface::play() {
void SongbookInterface::refresh(bool reloadFiles) { void SongbookInterface::refresh(bool reloadFiles) {
if (reloadFiles) { if (reloadFiles) {
m_files = Root::singleton().assets()->scanExtension(".abc").values(); m_files = Root::singleton().assets()->scanExtension(".abc").values();
eraseWhere(m_files, [](String& song) {
if (!song.beginsWith(SongPathPrefix, String::CaseInsensitive)) {
Logger::warn("Song '{}' isn't in {}, ignoring", SongPathPrefix.size(), song);
return true;
}
return false;
});
sort(m_files, [](String const& a, String const& b) -> bool { return b.compare(a, String::CaseInsensitive) > 0; }); sort(m_files, [](String const& a, String const& b) -> bool { return b.compare(a, String::CaseInsensitive) > 0; });
} }
auto search = fetchChild<TextBoxWidget>("search")->getText(); auto& search = fetchChild<TextBoxWidget>("search")->getText();
if (m_lastSearch != search || reloadFiles) { if (m_lastSearch != search || reloadFiles) {
m_lastSearch = search; m_lastSearch = search;
auto songList = fetchChild<ListWidget>("songs.list"); auto songList = fetchChild<ListWidget>("songs.list");
@ -72,12 +81,14 @@ void SongbookInterface::refresh(bool reloadFiles) {
auto widget = songList->addItem(); auto widget = songList->addItem();
widget->setData(i); widget->setData(i);
auto songName = widget->fetchChild<LabelWidget>("songName"); auto songName = widget->fetchChild<LabelWidget>("songName");
songName->setText(m_files[i]); String const& song = m_files[i];
songName->setText(song.substr(SongPathPrefix.size(), song.size() - (SongPathPrefix.size() + 4)));
widget->show(); widget->show();
} }
} else { } else {
for (size_t i = 0; i != m_files.size(); ++i) { for (size_t i = 0; i != m_files.size(); ++i) {
StringView song = m_files[i]; StringView song = m_files[i];
song = song.substr(SongPathPrefix.size(), song.size() - (SongPathPrefix.size() + 4));
auto find = song.find(search, 0, String::CaseInsensitive); auto find = song.find(search, 0, String::CaseInsensitive);
if (find != NPos) { if (find != NPos) {
auto widget = songList->addItem(); auto widget = songList->addItem();

View File

@ -12,51 +12,59 @@ LargeCharPlateWidget::LargeCharPlateWidget(WidgetCallbackFunc mainCallback, Play
setSize(ButtonWidget::size()); setSize(ButtonWidget::size());
auto assets = Root::singleton().assets(); auto assets = Root::singleton().assets();
auto charPlateImage = assets->json("/interface.config:largeCharPlate.backingImage").toString(); m_config = assets->json("/interface.config:largeCharPlate");
auto charPlateImage = m_config.getString("backingImage");
setCallback(mainCallback); setCallback(mainCallback);
setImages(charPlateImage); setImages(charPlateImage);
m_playerPlate = charPlateImage; m_playerPlate = charPlateImage;
m_playerPlateHover = assets->json("/interface.config:largeCharPlate.playerHover").toString(); m_playerPlateHover = m_config.getString("playerHover");
m_noPlayerPlate = assets->json("/interface.config:largeCharPlate.noPlayer").toString(); m_noPlayerPlate = m_config.getString("noPlayer");
m_noPlayerPlateHover = assets->json("/interface.config:largeCharPlate.noPlayerHover").toString(); m_noPlayerPlateHover = m_config.getString("noPlayerHover");
m_portraitOffset = jsonToVec2I(assets->json("/interface.config:largeCharPlate.portraitOffset")); m_portraitOffset = jsonToVec2I(m_config.get("portraitOffset"));
m_portraitScale = assets->json("/interface.config:largeCharPlate.portraitScale").toFloat(); m_portraitScale = m_config.getFloat("portraitScale");
String switchText = assets->json("/interface.config:largeCharPlate.switchText").toString(); String switchText = m_config.getString("switchText");
String createText = assets->json("/interface.config:largeCharPlate.createText").toString(); String createText = m_config.getString("createText");
m_portrait = make_shared<PortraitWidget>(); m_portrait = make_shared<PortraitWidget>();
m_portrait->setScale(m_portraitScale); m_portrait->setScale(m_portraitScale);
m_portrait->setPosition(m_portraitOffset); m_portrait->setPosition(m_portraitOffset);
m_portrait->setRenderHumanoid(true);
addChild("portrait", m_portrait); addChild("portrait", m_portrait);
String modeLabelText = assets->json("/interface.config:largeCharPlate.modeText").toString(); String modeLabelText = m_config.getString("modeText");
m_regularTextColor = Color::rgb(jsonToVec3B(assets->json("/interface.config:largeCharPlate.textColor"))); m_regularTextColor = Color::rgb(jsonToVec3B(m_config.get("textColor")));
m_disabledTextColor = Color::rgb(jsonToVec3B(assets->json("/interface.config:largeCharPlate.textColorDisabled"))); m_disabledTextColor = Color::rgb(jsonToVec3B(m_config.get("textColorDisabled")));
m_modeNameOffset = jsonToVec2I(assets->json("/interface.config:largeCharPlate.modeNameOffset")); m_modeNameOffset = jsonToVec2I(m_config.get("modeNameOffset"));
m_modeOffset = jsonToVec2I(assets->json("/interface.config:largeCharPlate.modeOffset")); m_modeOffset = jsonToVec2I(m_config.get("modeOffset"));
m_modeName = make_shared<LabelWidget>(modeLabelText, Color::White, HorizontalAnchor::HMidAnchor); auto modeNameHAnchor = HorizontalAnchorNames.getLeft(m_config.getString("modeNameHAnchor", "mid"));
auto modeNameVAnchor = VerticalAnchorNames .getLeft(m_config.getString("modeNameVAnchor", "bottom"));
m_modeName = make_shared<LabelWidget>(modeLabelText, Color::White, modeNameHAnchor);
addChild("modeName", m_modeName); addChild("modeName", m_modeName);
m_modeName->setPosition(m_modeNameOffset); m_modeName->setPosition(m_modeNameOffset);
m_modeName->setAnchor(HorizontalAnchor::HMidAnchor, VerticalAnchor::BottomAnchor); m_modeName->setAnchor(modeNameHAnchor, modeNameVAnchor);
auto modeHAnchor = HorizontalAnchorNames.getLeft(m_config.getString("modeHAnchor", "left"));
auto modeVAnchor = VerticalAnchorNames .getLeft(m_config.getString("modeVAnchor", "bottom"));
m_mode = make_shared<LabelWidget>(); m_mode = make_shared<LabelWidget>();
addChild("mode", m_mode); addChild("mode", m_mode);
m_mode->setPosition(m_modeOffset); m_mode->setPosition(m_modeOffset);
m_mode->setAnchor(HorizontalAnchor::LeftAnchor, VerticalAnchor::BottomAnchor); m_mode->setAnchor(modeHAnchor, modeVAnchor);
m_createCharText = assets->json("/interface.config:largeCharPlate.noPlayerText").toString(); m_createCharText = m_config.getString("noPlayerText");
m_createCharTextColor = Color::rgb(jsonToVec3B(assets->json("/interface.config:largeCharPlate.noPlayerTextColor"))); m_createCharTextColor = Color::rgb(jsonToVec3B(m_config.get("noPlayerTextColor")));
m_playerNameOffset = jsonToVec2I(assets->json("/interface.config:largeCharPlate.playerNameOffset")); m_playerNameOffset = jsonToVec2I(m_config.get("playerNameOffset"));
auto playerNameHAnchor = HorizontalAnchorNames.getLeft(m_config.getString("playerNameHAnchor", "mid"));
auto playerNameVAnchor = VerticalAnchorNames .getLeft(m_config.getString("playerNameVAnchor", "bottom"));
m_playerName = make_shared<LabelWidget>(); m_playerName = make_shared<LabelWidget>();
m_playerName->setColor(m_createCharTextColor); m_playerName->setColor(m_createCharTextColor);
m_playerName->setPosition(m_playerNameOffset); m_playerName->setPosition(m_playerNameOffset);
m_playerName->setAnchor(HorizontalAnchor::HMidAnchor, VerticalAnchor::BottomAnchor); m_playerName->setAnchor(playerNameHAnchor, playerNameVAnchor);
addChild("player", m_playerName); addChild("player", m_playerName);
} }
@ -121,13 +129,12 @@ void LargeCharPlateWidget::setPlayer(PlayerPtr player) {
void LargeCharPlateWidget::enableDelete(WidgetCallbackFunc const& callback) { void LargeCharPlateWidget::enableDelete(WidgetCallbackFunc const& callback) {
disableDelete(); disableDelete();
auto assets = Root::singleton().assets(); auto trashButton = m_config.get("trashButton");
auto baseImage = trashButton.getString("baseImage");
auto baseImage = assets->json("/interface.config:largeCharPlate.trashButton.baseImage").toString(); auto hoverImage = trashButton.getString("hoverImage");
auto hoverImage = assets->json("/interface.config:largeCharPlate.trashButton.hoverImage").toString(); auto pressedImage = trashButton.getString("pressedImage");
auto pressedImage = assets->json("/interface.config:largeCharPlate.trashButton.pressedImage").toString(); auto disabledImage = trashButton.getString("disabledImage");
auto disabledImage = assets->json("/interface.config:largeCharPlate.trashButton.disabledImage").toString(); auto offset = jsonToVec2I(trashButton.get("offset"));
auto offset = jsonToVec2I(assets->json("/interface.config:largeCharPlate.trashButton.offset"));
m_delete = make_shared<ButtonWidget>(callback, baseImage, hoverImage, pressedImage, disabledImage); m_delete = make_shared<ButtonWidget>(callback, baseImage, hoverImage, pressedImage, disabledImage);
addChild("trashButton", m_delete); addChild("trashButton", m_delete);
@ -157,4 +164,21 @@ bool LargeCharPlateWidget::sendEvent(InputEvent const& event) {
return ButtonWidget::sendEvent(event); return ButtonWidget::sendEvent(event);
} }
void LargeCharPlateWidget::update(float dt) {
ButtonWidget::update(dt);
if (!m_player || !m_config.getBool("animatePortrait", true))
return;
auto humanoid = m_player->humanoid();
if (m_delete->isHovered()) {
humanoid->setEmoteState(HumanoidEmote::Sad);
humanoid->setState(Humanoid::Run);
} else {
humanoid->setEmoteState(HumanoidEmote::Idle);
humanoid->setState(isHovered() ? Humanoid::Walk : Humanoid::Idle);
}
humanoid->animate(dt);
}
} }

View File

@ -23,11 +23,14 @@ public:
virtual bool sendEvent(InputEvent const& event) override; virtual bool sendEvent(InputEvent const& event) override;
void update(float dt) override;
protected: protected:
virtual void renderImpl() override; virtual void renderImpl() override;
private: private:
PlayerPtr m_player; PlayerPtr m_player;
Json m_config;
PortraitWidgetPtr m_portrait; PortraitWidgetPtr m_portrait;
Vec2I m_portraitOffset; Vec2I m_portraitOffset;

View File

@ -223,7 +223,7 @@ void Pane::setDragActive(bool dragActive, Vec2I dragMouseOrigin) {
void Pane::drag(Vec2I mousePosition) { void Pane::drag(Vec2I mousePosition) {
Vec2I delta = mousePosition - m_dragMouseOrigin; Vec2I delta = mousePosition - m_dragMouseOrigin;
setPosition(position() + delta); setPosition(relativePosition() + delta);
m_dragMouseOrigin += delta; m_dragMouseOrigin += delta;
} }