summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/io/logger.cpp11
-rw-r--r--core/variant.h9
-rw-r--r--doc/classes/Generic6DOFJoint3D.xml12
-rw-r--r--modules/gdscript/gdscript.cpp11
-rw-r--r--modules/gdscript/gdscript_functions.cpp3
-rw-r--r--modules/gdscript/gdscript_parser.cpp2
-rw-r--r--modules/mono/utils/string_utils.cpp10
-rw-r--r--platform/linuxbsd/display_server_x11.cpp85
-rw-r--r--platform/linuxbsd/display_server_x11.h4
-rw-r--r--scene/2d/tile_map.cpp7
-rw-r--r--scene/3d/physics_joint_3d.cpp6
-rw-r--r--servers/register_server_types.cpp1
-rw-r--r--thirdparty/README.md1
-rw-r--r--thirdparty/misc/stb_vorbis.c2
14 files changed, 85 insertions, 79 deletions
diff --git a/core/io/logger.cpp b/core/io/logger.cpp
index 48aebeda3d..ad0cc81023 100644
--- a/core/io/logger.cpp
+++ b/core/io/logger.cpp
@@ -34,17 +34,6 @@
#include "core/os/os.h"
#include "core/print_string.h"
-// va_copy was defined in the C99, but not in C++ standards before C++11.
-// When you compile C++ without --std=c++<XX> option, compilers still define
-// va_copy, otherwise you have to use the internal version (__va_copy).
-#if !defined(va_copy)
-#if defined(__GNUC__)
-#define va_copy(d, s) __va_copy((d), (s))
-#else
-#define va_copy(d, s) ((d) = (s))
-#endif
-#endif
-
#if defined(MINGW_ENABLED) || defined(_MSC_VER)
#define sprintf sprintf_s
#endif
diff --git a/core/variant.h b/core/variant.h
index a832f7ccf8..1ae09ad82f 100644
--- a/core/variant.h
+++ b/core/variant.h
@@ -67,13 +67,6 @@ typedef Vector<Vector2> PackedVector2Array;
typedef Vector<Vector3> PackedVector3Array;
typedef Vector<Color> PackedColorArray;
-// Temporary workaround until c++11 alignas()
-#ifdef __GNUC__
-#define GCC_ALIGNED_8 __attribute__((aligned(8)))
-#else
-#define GCC_ALIGNED_8
-#endif
-
class Variant {
public:
// If this changes the table in variant_op must be updated
@@ -211,7 +204,7 @@ private:
PackedArrayRefBase *packed_array;
void *_ptr; //generic pointer
uint8_t _mem[sizeof(ObjData) > (sizeof(real_t) * 4) ? sizeof(ObjData) : (sizeof(real_t) * 4)];
- } _data GCC_ALIGNED_8;
+ } _data alignas(8);
void reference(const Variant &p_variant);
void clear();
diff --git a/doc/classes/Generic6DOFJoint3D.xml b/doc/classes/Generic6DOFJoint3D.xml
index fae567dc58..ae86ab7365 100644
--- a/doc/classes/Generic6DOFJoint3D.xml
+++ b/doc/classes/Generic6DOFJoint3D.xml
@@ -373,6 +373,12 @@
<constant name="PARAM_LINEAR_MOTOR_FORCE_LIMIT" value="6" enum="Param">
The maximum force the linear motor will apply while trying to reach the velocity target.
</constant>
+ <constant name="PARAM_LINEAR_SPRING_STIFFNESS" value="7" enum="Param">
+ </constant>
+ <constant name="PARAM_LINEAR_SPRING_DAMPING" value="8" enum="Param">
+ </constant>
+ <constant name="PARAM_LINEAR_SPRING_EQUILIBRIUM_POINT" value="9" enum="Param">
+ </constant>
<constant name="PARAM_ANGULAR_LOWER_LIMIT" value="10" enum="Param">
The minimum rotation in negative direction to break loose and rotate around the axes.
</constant>
@@ -400,6 +406,12 @@
<constant name="PARAM_ANGULAR_MOTOR_FORCE_LIMIT" value="18" enum="Param">
Maximum acceleration for the motor at the axes.
</constant>
+ <constant name="PARAM_ANGULAR_SPRING_STIFFNESS" value="19" enum="Param">
+ </constant>
+ <constant name="PARAM_ANGULAR_SPRING_DAMPING" value="20" enum="Param">
+ </constant>
+ <constant name="PARAM_ANGULAR_SPRING_EQUILIBRIUM_POINT" value="21" enum="Param">
+ </constant>
<constant name="PARAM_MAX" value="22" enum="Param">
Represents the size of the [enum Param] enum.
</constant>
diff --git a/modules/gdscript/gdscript.cpp b/modules/gdscript/gdscript.cpp
index 0316581604..06ab9e226d 100644
--- a/modules/gdscript/gdscript.cpp
+++ b/modules/gdscript/gdscript.cpp
@@ -103,15 +103,14 @@ GDScriptInstance *GDScript::_create_instance(const Variant **p_args, int p_argco
instance->owner->set_script_instance(instance);
/* STEP 2, INITIALIZE AND CONSTRUCT */
-
{
MutexLock lock(GDScriptLanguage::singleton->lock);
-
instances.insert(instance->owner);
}
-
+ if (p_argcount < 0) {
+ return instance;
+ }
initializer->call(instance, p_args, p_argcount, r_error);
-
if (r_error.error != Callable::CallError::CALL_OK) {
instance->script = Ref<GDScript>();
instance->owner->set_script_instance(nullptr);
@@ -119,10 +118,8 @@ GDScriptInstance *GDScript::_create_instance(const Variant **p_args, int p_argco
MutexLock lock(GDScriptLanguage::singleton->lock);
instances.erase(p_owner);
}
-
- ERR_FAIL_COND_V(r_error.error != Callable::CallError::CALL_OK, nullptr); //error constructing
+ ERR_FAIL_V_MSG(nullptr, "Error constructing a GDScriptInstance.");
}
-
//@TODO make thread safe
return instance;
}
diff --git a/modules/gdscript/gdscript_functions.cpp b/modules/gdscript/gdscript_functions.cpp
index 58161d6f53..0199af642f 100644
--- a/modules/gdscript/gdscript_functions.cpp
+++ b/modules/gdscript/gdscript_functions.cpp
@@ -1197,8 +1197,7 @@ void GDScriptFunctions::call(Function p_func, const Variant **p_args, int p_arg_
return;
}
}
-
- r_ret = gdscr->_new(nullptr, 0, r_error);
+ r_ret = gdscr->_new(nullptr, -1 /*skip initializer*/, r_error);
GDScriptInstance *ins = static_cast<GDScriptInstance *>(static_cast<Object *>(r_ret)->get_script_instance());
Ref<GDScript> gd_ref = ins->get_script();
diff --git a/modules/gdscript/gdscript_parser.cpp b/modules/gdscript/gdscript_parser.cpp
index a37fc579e7..c20d517ff6 100644
--- a/modules/gdscript/gdscript_parser.cpp
+++ b/modules/gdscript/gdscript_parser.cpp
@@ -4033,7 +4033,7 @@ void GDScriptParser::_parse_class(ClassNode *p_class) {
if (!_enter_indent_block(block)) {
- _set_error("Indented block expected.");
+ _set_error(vformat("Indented block expected after declaration of \"%s\" function.", function->name));
return;
}
diff --git a/modules/mono/utils/string_utils.cpp b/modules/mono/utils/string_utils.cpp
index 907811355f..67b264d803 100644
--- a/modules/mono/utils/string_utils.cpp
+++ b/modules/mono/utils/string_utils.cpp
@@ -196,16 +196,6 @@ String str_format(const char *p_format, ...) {
return res;
}
-// va_copy was defined in the C99, but not in C++ standards before C++11.
-// When you compile C++ without --std=c++<XX> option, compilers still define
-// va_copy, otherwise you have to use the internal version (__va_copy).
-#if !defined(va_copy)
-#if defined(__GNUC__)
-#define va_copy(d, s) __va_copy((d), (s))
-#else
-#define va_copy(d, s) ((d) = (s))
-#endif
-#endif
#if defined(MINGW_ENABLED) || defined(_MSC_VER) && _MSC_VER < 1900
#define gd_vsnprintf(m_buffer, m_count, m_format, m_args_copy) vsnprintf_s(m_buffer, m_count, _TRUNCATE, m_format, m_args_copy)
diff --git a/platform/linuxbsd/display_server_x11.cpp b/platform/linuxbsd/display_server_x11.cpp
index e38b0c13d0..b5052667a7 100644
--- a/platform/linuxbsd/display_server_x11.cpp
+++ b/platform/linuxbsd/display_server_x11.cpp
@@ -254,13 +254,16 @@ bool DisplayServerX11::_refresh_device_info() {
bool absolute_mode = false;
int resolution_x = 0;
int resolution_y = 0;
- double range_min_x = 0;
- double range_min_y = 0;
- double range_max_x = 0;
- double range_max_y = 0;
- int pressure_resolution = 0;
- int tilt_resolution_x = 0;
- int tilt_resolution_y = 0;
+ double abs_x_min = 0;
+ double abs_x_max = 0;
+ double abs_y_min = 0;
+ double abs_y_max = 0;
+ double pressure_min = 0;
+ double pressure_max = 0;
+ double tilt_x_min = 0;
+ double tilt_x_max = 0;
+ double tilt_y_min = 0;
+ double tilt_y_max = 0;
for (int j = 0; j < dev->num_classes; j++) {
#ifdef TOUCH_ENABLED
if (dev->classes[j]->type == XITouchClass && ((XITouchClassInfo *)dev->classes[j])->mode == XIDirectTouch) {
@@ -272,23 +275,23 @@ bool DisplayServerX11::_refresh_device_info() {
if (class_info->number == VALUATOR_ABSX && class_info->mode == XIModeAbsolute) {
resolution_x = class_info->resolution;
- range_min_x = class_info->min;
- range_max_x = class_info->max;
+ abs_x_min = class_info->min;
+ abs_y_max = class_info->max;
absolute_mode = true;
} else if (class_info->number == VALUATOR_ABSY && class_info->mode == XIModeAbsolute) {
resolution_y = class_info->resolution;
- range_min_y = class_info->min;
- range_max_y = class_info->max;
+ abs_y_min = class_info->min;
+ abs_y_max = class_info->max;
absolute_mode = true;
} else if (class_info->number == VALUATOR_PRESSURE && class_info->mode == XIModeAbsolute) {
- pressure_resolution = (class_info->max - class_info->min);
- if (pressure_resolution == 0) pressure_resolution = 1;
+ pressure_min = class_info->min;
+ pressure_max = class_info->max;
} else if (class_info->number == VALUATOR_TILTX && class_info->mode == XIModeAbsolute) {
- tilt_resolution_x = (class_info->max - class_info->min);
- if (tilt_resolution_x == 0) tilt_resolution_x = 1;
+ tilt_x_min = class_info->min;
+ tilt_x_max = class_info->max;
} else if (class_info->number == VALUATOR_TILTY && class_info->mode == XIModeAbsolute) {
- tilt_resolution_y = (class_info->max - class_info->min);
- if (tilt_resolution_y == 0) tilt_resolution_y = 1;
+ tilt_x_min = class_info->min;
+ tilt_x_max = class_info->max;
}
}
}
@@ -299,18 +302,19 @@ bool DisplayServerX11::_refresh_device_info() {
if (absolute_mode) {
// If no resolution was reported, use the min/max ranges.
if (resolution_x <= 0) {
- resolution_x = (range_max_x - range_min_x) * abs_resolution_range_mult;
+ resolution_x = (abs_x_max - abs_x_min) * abs_resolution_range_mult;
}
if (resolution_y <= 0) {
- resolution_y = (range_max_y - range_min_y) * abs_resolution_range_mult;
+ resolution_y = (abs_y_max - abs_y_min) * abs_resolution_range_mult;
}
-
xi.absolute_devices[dev->deviceid] = Vector2(abs_resolution_mult / resolution_x, abs_resolution_mult / resolution_y);
print_verbose("XInput: Absolute pointing device: " + String(dev->name));
}
xi.pressure = 0;
- xi.pen_devices[dev->deviceid] = Vector3(pressure_resolution, tilt_resolution_x, tilt_resolution_y);
+ xi.pen_pressure_range[dev->deviceid] = Vector2(pressure_min, pressure_max);
+ xi.pen_tilt_x_range[dev->deviceid] = Vector2(tilt_x_min, tilt_x_max);
+ xi.pen_tilt_y_range[dev->deviceid] = Vector2(tilt_y_min, tilt_y_max);
}
XIFreeDeviceInfo(info);
@@ -2353,6 +2357,9 @@ void DisplayServerX11::process_events() {
// Is the current mouse mode one where it needs to be grabbed.
bool mouse_mode_grab = mouse_mode == MOUSE_MODE_CAPTURED || mouse_mode == MOUSE_MODE_CONFINED;
+ xi.pressure = 0;
+ xi.tilt = Vector2();
+
while (XPending(x11_display) > 0) {
XEvent event;
XNextEvent(x11_display, &event);
@@ -2399,9 +2406,6 @@ void DisplayServerX11::process_events() {
double rel_x = 0.0;
double rel_y = 0.0;
- double pressure = 0.0;
- double tilt_x = 0.0;
- double tilt_y = 0.0;
if (XIMaskIsSet(raw_event->valuators.mask, VALUATOR_ABSX)) {
rel_x = *values;
@@ -2414,24 +2418,39 @@ void DisplayServerX11::process_events() {
}
if (XIMaskIsSet(raw_event->valuators.mask, VALUATOR_PRESSURE)) {
- pressure = *values;
+ Map<int, Vector2>::Element *pen_pressure = xi.pen_pressure_range.find(device_id);
+ if (pen_pressure) {
+ Vector2 pen_pressure_range = pen_pressure->value();
+ if (pen_pressure_range != Vector2())
+ xi.pressure = (*values - pen_pressure_range[0]) /
+ (pen_pressure_range[1] - pen_pressure_range[0]);
+ }
+
values++;
}
if (XIMaskIsSet(raw_event->valuators.mask, VALUATOR_TILTX)) {
- tilt_x = *values;
+ Map<int, Vector2>::Element *pen_tilt_x = xi.pen_tilt_x_range.find(device_id);
+ if (pen_tilt_x) {
+ Vector2 pen_tilt_x_range = pen_tilt_x->value();
+ if (pen_tilt_x_range != Vector2()) {
+ xi.tilt.x = ((*values - pen_tilt_x_range[0]) / (pen_tilt_x_range[1] - pen_tilt_x_range[0])) * 2 - 1;
+ }
+ }
+
values++;
}
if (XIMaskIsSet(raw_event->valuators.mask, VALUATOR_TILTY)) {
- tilt_y = *values;
- }
+ Map<int, Vector2>::Element *pen_tilt_y = xi.pen_tilt_y_range.find(device_id);
+ if (pen_tilt_y) {
+ Vector2 pen_tilt_y_range = pen_tilt_y->value();
+ if (pen_tilt_y_range != Vector2()) {
+ xi.tilt.y = ((*values - pen_tilt_y_range[0]) / (pen_tilt_y_range[1] - pen_tilt_y_range[0])) * 2 - 1;
+ }
+ }
- Map<int, Vector3>::Element *pen_info = xi.pen_devices.find(device_id);
- if (pen_info) {
- Vector3 mult = pen_info->value();
- if (mult.x != 0.0) xi.pressure = pressure / mult.x;
- if ((mult.y != 0.0) && (mult.z != 0.0)) xi.tilt = Vector2(tilt_x / mult.y, tilt_y / mult.z);
+ values++;
}
// https://bugs.freedesktop.org/show_bug.cgi?id=71609
diff --git a/platform/linuxbsd/display_server_x11.h b/platform/linuxbsd/display_server_x11.h
index 8f090d3fad..3dc06745a1 100644
--- a/platform/linuxbsd/display_server_x11.h
+++ b/platform/linuxbsd/display_server_x11.h
@@ -170,7 +170,9 @@ class DisplayServerX11 : public DisplayServer {
int opcode;
Vector<int> touch_devices;
Map<int, Vector2> absolute_devices;
- Map<int, Vector3> pen_devices;
+ Map<int, Vector2> pen_pressure_range;
+ Map<int, Vector2> pen_tilt_x_range;
+ Map<int, Vector2> pen_tilt_y_range;
XIEventMask all_event_mask;
Map<int, Vector2> state;
double pressure;
diff --git a/scene/2d/tile_map.cpp b/scene/2d/tile_map.cpp
index 9628c01718..86e61fe878 100644
--- a/scene/2d/tile_map.cpp
+++ b/scene/2d/tile_map.cpp
@@ -940,13 +940,10 @@ void TileMap::update_bitmask_area(const Vector2 &p_pos) {
void TileMap::update_bitmask_region(const Vector2 &p_start, const Vector2 &p_end) {
if ((p_end.x < p_start.x || p_end.y < p_start.y) || (p_end.x == p_start.x && p_end.y == p_start.y)) {
- int i;
Array a = get_used_cells();
- for (i = 0; i < a.size(); i++) {
- // update_bitmask_area() in order to update cells adjacent to the
- // current cell, since ordering in array may not be reliable
+ for (int i = 0; i < a.size(); i++) {
Vector2 vector = (Vector2)a[i];
- update_bitmask_area(Vector2(vector.x, vector.y));
+ update_cell_bitmask(vector.x, vector.y);
}
return;
}
diff --git a/scene/3d/physics_joint_3d.cpp b/scene/3d/physics_joint_3d.cpp
index 591c17a91e..140d887d9a 100644
--- a/scene/3d/physics_joint_3d.cpp
+++ b/scene/3d/physics_joint_3d.cpp
@@ -807,6 +807,9 @@ void Generic6DOFJoint3D::_bind_methods() {
BIND_ENUM_CONSTANT(PARAM_LINEAR_DAMPING);
BIND_ENUM_CONSTANT(PARAM_LINEAR_MOTOR_TARGET_VELOCITY);
BIND_ENUM_CONSTANT(PARAM_LINEAR_MOTOR_FORCE_LIMIT);
+ BIND_ENUM_CONSTANT(PARAM_LINEAR_SPRING_STIFFNESS);
+ BIND_ENUM_CONSTANT(PARAM_LINEAR_SPRING_DAMPING);
+ BIND_ENUM_CONSTANT(PARAM_LINEAR_SPRING_EQUILIBRIUM_POINT);
BIND_ENUM_CONSTANT(PARAM_ANGULAR_LOWER_LIMIT);
BIND_ENUM_CONSTANT(PARAM_ANGULAR_UPPER_LIMIT);
BIND_ENUM_CONSTANT(PARAM_ANGULAR_LIMIT_SOFTNESS);
@@ -816,6 +819,9 @@ void Generic6DOFJoint3D::_bind_methods() {
BIND_ENUM_CONSTANT(PARAM_ANGULAR_ERP);
BIND_ENUM_CONSTANT(PARAM_ANGULAR_MOTOR_TARGET_VELOCITY);
BIND_ENUM_CONSTANT(PARAM_ANGULAR_MOTOR_FORCE_LIMIT);
+ BIND_ENUM_CONSTANT(PARAM_ANGULAR_SPRING_STIFFNESS);
+ BIND_ENUM_CONSTANT(PARAM_ANGULAR_SPRING_DAMPING);
+ BIND_ENUM_CONSTANT(PARAM_ANGULAR_SPRING_EQUILIBRIUM_POINT);
BIND_ENUM_CONSTANT(PARAM_MAX);
BIND_ENUM_CONSTANT(FLAG_ENABLE_LINEAR_LIMIT);
diff --git a/servers/register_server_types.cpp b/servers/register_server_types.cpp
index 60217002fb..eb92cf55e3 100644
--- a/servers/register_server_types.cpp
+++ b/servers/register_server_types.cpp
@@ -218,6 +218,7 @@ void register_server_singletons() {
Engine::get_singleton()->add_singleton(Engine::Singleton("DisplayServer", DisplayServer::get_singleton()));
Engine::get_singleton()->add_singleton(Engine::Singleton("RenderingServer", RenderingServer::get_singleton()));
+ Engine::get_singleton()->add_singleton(Engine::Singleton("RenderingDevice", RenderingDevice::get_singleton()));
Engine::get_singleton()->add_singleton(Engine::Singleton("AudioServer", AudioServer::get_singleton()));
Engine::get_singleton()->add_singleton(Engine::Singleton("PhysicsServer2D", PhysicsServer2D::get_singleton()));
Engine::get_singleton()->add_singleton(Engine::Singleton("PhysicsServer3D", PhysicsServer3D::get_singleton()));
diff --git a/thirdparty/README.md b/thirdparty/README.md
index 5821ca1424..1a3588e0e0 100644
--- a/thirdparty/README.md
+++ b/thirdparty/README.md
@@ -422,6 +422,7 @@ Collection of single-file libraries used in Godot components.
* Upstream: https://github.com/nothings/stb
* Version: 1.19
* License: Public Domain (Unlicense) or MIT
+ * Modifications: `f->temp_offset += (sz+3)&~3;` changed to `f->temp_offset += (sz+7)&~7;` (needed until fixed upstream)
## nanosvg
diff --git a/thirdparty/misc/stb_vorbis.c b/thirdparty/misc/stb_vorbis.c
index b28944a4d9..b0d79b1724 100644
--- a/thirdparty/misc/stb_vorbis.c
+++ b/thirdparty/misc/stb_vorbis.c
@@ -961,7 +961,7 @@ static void *setup_temp_malloc(vorb *f, int sz)
static void setup_temp_free(vorb *f, void *p, int sz)
{
if (f->alloc.alloc_buffer) {
- f->temp_offset += (sz+3)&~3;
+ f->temp_offset += (sz+7)&~7;
return;
}
free(p);