summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/command_queue_mt.h4
-rw-r--r--core/error_list.h2
-rw-r--r--core/global_config.cpp2
-rw-r--r--core/global_constants.cpp2
-rw-r--r--core/hash_map.h2
-rw-r--r--core/image.h2
-rw-r--r--core/io/config_file.cpp9
-rw-r--r--core/io/marshalls.h2
-rw-r--r--core/io/packet_peer_udp.cpp7
-rw-r--r--core/io/packet_peer_udp.h4
-rw-r--r--core/io/xml_parser.cpp2
-rw-r--r--core/list.h6
-rw-r--r--core/math/face3.cpp2
-rw-r--r--core/math/geometry.cpp4
-rw-r--r--core/math/geometry.h2
-rw-r--r--core/math/matrix3.cpp4
-rw-r--r--core/math/plane.cpp2
-rw-r--r--core/math/rect3.h2
-rw-r--r--core/math/vector3.h5
-rw-r--r--core/object.h2
-rw-r--r--core/os/input.h1
-rw-r--r--core/pool_allocator.cpp2
-rw-r--r--core/script_debugger_remote.cpp2
23 files changed, 48 insertions, 24 deletions
diff --git a/core/command_queue_mt.h b/core/command_queue_mt.h
index 3a859c809c..d8c05ab782 100644
--- a/core/command_queue_mt.h
+++ b/core/command_queue_mt.h
@@ -550,12 +550,12 @@ class CommandQueueMT {
if ((COMMAND_MEM_SIZE - write_ptr) < alloc_size + 4) {
// no room at the end, wrap down;
- if (read_ptr == 0) // dont want write_ptr to become read_ptr
+ if (read_ptr == 0) // don't want write_ptr to become read_ptr
return NULL;
// if this happens, it's a bug
ERR_FAIL_COND_V((COMMAND_MEM_SIZE - write_ptr) < sizeof(uint32_t), NULL);
- // zero means, wrap to begining
+ // zero means, wrap to beginning
uint32_t *p = (uint32_t *)&command_mem[write_ptr];
*p = 0;
diff --git a/core/error_list.h b/core/error_list.h
index 72b8425444..7e4249886b 100644
--- a/core/error_list.h
+++ b/core/error_list.h
@@ -40,7 +40,7 @@ enum Error {
OK,
FAILED, ///< Generic fail error
ERR_UNAVAILABLE, ///< What is requested is unsupported/unavailable
- ERR_UNCONFIGURED, ///< The object being used hasnt been properly set up yet
+ ERR_UNCONFIGURED, ///< The object being used hasn't been properly set up yet
ERR_UNAUTHORIZED, ///< Missing credentials for requested resource
ERR_PARAMETER_RANGE_ERROR, ///< Parameter given out of range (5)
ERR_OUT_OF_MEMORY, ///< Out of memory
diff --git a/core/global_config.cpp b/core/global_config.cpp
index 6aded6fbb7..9ee49180f1 100644
--- a/core/global_config.cpp
+++ b/core/global_config.cpp
@@ -282,7 +282,7 @@ Error GlobalConfig::setup(const String &p_path, const String &p_main_pack) {
//Try to use the filesystem for files, according to OS. (only Android -when reading from pck- and iOS use this)
if (OS::get_singleton()->get_resource_dir() != "") {
- //OS will call Globals->get_resource_path which will be empty if not overriden!
+ //OS will call Globals->get_resource_path which will be empty if not overridden!
//if the OS would rather use somewhere else, then it will not be empty.
resource_path = OS::get_singleton()->get_resource_dir().replace("\\", "/");
diff --git a/core/global_constants.cpp b/core/global_constants.cpp
index c7f353ac44..9d1ae3aed9 100644
--- a/core/global_constants.cpp
+++ b/core/global_constants.cpp
@@ -414,7 +414,7 @@ static _GlobalConstant _global_constants[] = {
BIND_GLOBAL_CONSTANT(OK),
BIND_GLOBAL_CONSTANT(FAILED), ///< Generic fail error
BIND_GLOBAL_CONSTANT(ERR_UNAVAILABLE), ///< What is requested is unsupported/unavailable
- BIND_GLOBAL_CONSTANT(ERR_UNCONFIGURED), ///< The object being used hasnt been properly set up yet
+ BIND_GLOBAL_CONSTANT(ERR_UNCONFIGURED), ///< The object being used hasn't been properly set up yet
BIND_GLOBAL_CONSTANT(ERR_UNAUTHORIZED), ///< Missing credentials for requested resource
BIND_GLOBAL_CONSTANT(ERR_PARAMETER_RANGE_ERROR), ///< Parameter given out of range
BIND_GLOBAL_CONSTANT(ERR_OUT_OF_MEMORY), ///< Out of memory
diff --git a/core/hash_map.h b/core/hash_map.h
index 645e34e923..86646b825c 100644
--- a/core/hash_map.h
+++ b/core/hash_map.h
@@ -413,7 +413,7 @@ public:
}
/**
- * Erase an item, return true if erasing was succesful
+ * Erase an item, return true if erasing was successful
*/
bool erase(const TKey &p_key) {
diff --git a/core/image.h b/core/image.h
index 310351e547..300ac11e04 100644
--- a/core/image.h
+++ b/core/image.h
@@ -171,7 +171,7 @@ public:
void get_mipmap_offset_size_and_dimensions(int p_mipmap, int &r_ofs, int &r_size, int &w, int &h) const; //get where the mipmap begins in data
/**
- * Resize the image, using the prefered interpolation method.
+ * Resize the image, using the preferred interpolation method.
* Indexed-Color images always use INTERPOLATE_NEAREST.
*/
diff --git a/core/io/config_file.cpp b/core/io/config_file.cpp
index 052a83168d..6560302083 100644
--- a/core/io/config_file.cpp
+++ b/core/io/config_file.cpp
@@ -82,8 +82,13 @@ void ConfigFile::set_value(const String &p_section, const String &p_key, const V
}
Variant ConfigFile::get_value(const String &p_section, const String &p_key, Variant p_default) const {
- ERR_FAIL_COND_V(!values.has(p_section), p_default);
- ERR_FAIL_COND_V(!values[p_section].has(p_key), p_default);
+ if (!values.has(p_section) || !values[p_section].has(p_key)) {
+ if (p_default.get_type() == Variant::NIL) {
+ ERR_EXPLAIN("Couldn't find the given section/key and no default was given");
+ ERR_FAIL_V(p_default);
+ }
+ return p_default;
+ }
return values[p_section][p_key];
}
diff --git a/core/io/marshalls.h b/core/io/marshalls.h
index 939ed9cea9..b322410929 100644
--- a/core/io/marshalls.h
+++ b/core/io/marshalls.h
@@ -34,7 +34,7 @@
#include "variant.h"
/**
- * Miscelaneous helpers for marshalling data types, and encoding
+ * Miscellaneous helpers for marshalling data types, and encoding
* in an endian independent way
*/
diff --git a/core/io/packet_peer_udp.cpp b/core/io/packet_peer_udp.cpp
index 46accf420a..3bc116f1b6 100644
--- a/core/io/packet_peer_udp.cpp
+++ b/core/io/packet_peer_udp.cpp
@@ -31,6 +31,11 @@
PacketPeerUDP *(*PacketPeerUDP::_create)() = NULL;
+void PacketPeerUDP::set_blocking_mode(bool p_enable) {
+
+ blocking = p_enable;
+}
+
String PacketPeerUDP::_get_packet_ip() const {
return get_packet_address();
@@ -78,4 +83,6 @@ PacketPeerUDP *PacketPeerUDP::create() {
}
PacketPeerUDP::PacketPeerUDP() {
+
+ blocking = true;
}
diff --git a/core/io/packet_peer_udp.h b/core/io/packet_peer_udp.h
index c316faad4b..c486f443fb 100644
--- a/core/io/packet_peer_udp.h
+++ b/core/io/packet_peer_udp.h
@@ -36,6 +36,8 @@ class PacketPeerUDP : public PacketPeer {
GDCLASS(PacketPeerUDP, PacketPeer);
protected:
+ bool blocking;
+
static PacketPeerUDP *(*_create)();
static void _bind_methods();
@@ -44,6 +46,8 @@ protected:
Error _set_dest_address(const String &p_address, int p_port);
public:
+ void set_blocking_mode(bool p_enable);
+
virtual Error listen(int p_port, IP_Address p_bind_address = IP_Address("*"), int p_recv_buffer_size = 65536) = 0;
virtual void close() = 0;
virtual Error wait() = 0;
diff --git a/core/io/xml_parser.cpp b/core/io/xml_parser.cpp
index e3b669409a..c5929617c9 100644
--- a/core/io/xml_parser.cpp
+++ b/core/io/xml_parser.cpp
@@ -39,7 +39,7 @@ static bool _equalsn(const CharType *str1, const CharType *str2, int len) {
return false;
// if one (or both) of the strings was smaller then they
- // are only equal if they have the same lenght
+ // are only equal if they have the same length
return (i == len) || (str1[i] == 0 && str2[i] == 0);
}
diff --git a/core/list.h b/core/list.h
index 6924580380..b6f2df867f 100644
--- a/core/list.h
+++ b/core/list.h
@@ -179,7 +179,7 @@ private:
public:
/**
- * return an const iterator to the begining of the list.
+ * return an const iterator to the beginning of the list.
*/
_FORCE_INLINE_ const Element *front() const {
@@ -187,7 +187,7 @@ public:
};
/**
- * return an iterator to the begining of the list.
+ * return an iterator to the beginning of the list.
*/
_FORCE_INLINE_ Element *front() {
return _data ? _data->first : 0;
@@ -251,7 +251,7 @@ public:
}
/**
- * store a new element at the begining of the list
+ * store a new element at the beginning of the list
*/
Element *push_front(const T &value) {
diff --git a/core/math/face3.cpp b/core/math/face3.cpp
index d9d99b0384..6a15feefe1 100644
--- a/core/math/face3.cpp
+++ b/core/math/face3.cpp
@@ -136,7 +136,7 @@ Face3::Side Face3::get_side_of(const Face3 &p_face, ClockDirection p_clock_dir)
const Vector3 &v = p_face.vertex[i];
- if (plane.has_point(v)) //coplanar, dont bother
+ if (plane.has_point(v)) //coplanar, don't bother
continue;
if (plane.is_point_over(v))
diff --git a/core/math/geometry.cpp b/core/math/geometry.cpp
index ec4d352a8f..97579e41ef 100644
--- a/core/math/geometry.cpp
+++ b/core/math/geometry.cpp
@@ -990,7 +990,7 @@ void Geometry::make_atlas(const Vector<Size2i> &p_rects, Vector<Point2i> &r_resu
//super simple, almost brute force scanline stacking fitter
//it's pretty basic for now, but it tries to make sure that the aspect ratio of the
- //resulting atlas is somehow square. This is necesary because video cards have limits
+ //resulting atlas is somehow square. This is necessary because video cards have limits
//on texture size (usually 2048 or 4096), so the more square a texture, the more chances
//it will work in every hardware.
// for example, it will prioritize a 1024x1024 atlas (works everywhere) instead of a
@@ -1057,7 +1057,7 @@ void Geometry::make_atlas(const Vector<Size2i> &p_rects, Vector<Point2i> &r_resu
if (end_w > max_w)
max_w = end_w;
- if (ofs == 0 || end_h > limit_h) //while h limit not reched, keep stacking
+ if (ofs == 0 || end_h > limit_h) //while h limit not reached, keep stacking
ofs += wrects[j].s.width;
}
diff --git a/core/math/geometry.h b/core/math/geometry.h
index 93ab0be2e0..26f977e6eb 100644
--- a/core/math/geometry.h
+++ b/core/math/geometry.h
@@ -108,7 +108,7 @@ public:
//do the function 'd' as defined by pb. I think is is dot product of some sort
#define d_of(m, n, o, p) ((m.x - n.x) * (o.x - p.x) + (m.y - n.y) * (o.y - p.y) + (m.z - n.z) * (o.z - p.z))
- //caluclate the parpametric position on the 2 curves, mua and mub
+ //calculate the parametric position on the 2 curves, mua and mub
real_t mua = ( d_of(p1,q1,q2,q1) * d_of(q2,q1,p2,p1) - d_of(p1,q1,p2,p1) * d_of(q2,q1,q2,q1) ) / ( d_of(p2,p1,p2,p1) * d_of(q2,q1,q2,q1) - d_of(q2,q1,p2,p1) * d_of(q2,q1,p2,p1) );
real_t mub = ( d_of(p1,q1,q2,q1) + mua * d_of(q2,q1,p2,p1) ) / d_of(q2,q1,q2,q1);
diff --git a/core/math/matrix3.cpp b/core/math/matrix3.cpp
index 5f73d91ef3..b31df2fadb 100644
--- a/core/math/matrix3.cpp
+++ b/core/math/matrix3.cpp
@@ -229,7 +229,7 @@ Vector3 Basis::get_scale() const {
// FIXME: We eventually need a proper polar decomposition.
// As a cheap workaround until then, to ensure that R is a proper rotation matrix with determinant +1
// (such that it can be represented by a Quat or Euler angles), we absorb the sign flip into the scaling matrix.
- // As such, it works in conjuction with get_rotation().
+ // As such, it works in conjunction with get_rotation().
real_t det_sign = determinant() > 0 ? 1 : -1;
return det_sign * Vector3(
Vector3(elements[0][0], elements[1][0], elements[2][0]).length(),
@@ -575,6 +575,8 @@ Basis::Basis(const Quat &p_quat) {
Basis::Basis(const Vector3 &p_axis, real_t p_phi) {
// Rotation matrix from axis and angle, see https://en.wikipedia.org/wiki/Rotation_matrix#Rotation_matrix_from_axis_and_angle
+ ERR_FAIL_COND(p_axis.is_normalized() == false);
+
Vector3 axis_sq(p_axis.x * p_axis.x, p_axis.y * p_axis.y, p_axis.z * p_axis.z);
real_t cosine = Math::cos(p_phi);
diff --git a/core/math/plane.cpp b/core/math/plane.cpp
index 29e7f2e75c..bef5c3ab06 100644
--- a/core/math/plane.cpp
+++ b/core/math/plane.cpp
@@ -116,7 +116,7 @@ bool Plane::intersects_ray(Vector3 p_from, Vector3 p_dir, Vector3 *p_intersectio
real_t dist = (normal.dot(p_from) - d) / den;
//printf("dist is %i\n",dist);
- if (dist > CMP_EPSILON) { //this is a ray, before the emiting pos (p_from) doesnt exist
+ if (dist > CMP_EPSILON) { //this is a ray, before the emitting pos (p_from) doesn't exist
return false;
}
diff --git a/core/math/rect3.h b/core/math/rect3.h
index 26198537c2..0b11cd7b52 100644
--- a/core/math/rect3.h
+++ b/core/math/rect3.h
@@ -95,7 +95,7 @@ public:
Rect3 expand(const Vector3 &p_vector) const;
_FORCE_INLINE_ void project_range_in_plane(const Plane &p_plane, real_t &r_min, real_t &r_max) const;
- _FORCE_INLINE_ void expand_to(const Vector3 &p_vector); /** expand to contain a point if necesary */
+ _FORCE_INLINE_ void expand_to(const Vector3 &p_vector); /** expand to contain a point if necessary */
operator String() const;
diff --git a/core/math/vector3.h b/core/math/vector3.h
index fc02e66c33..097d6b9480 100644
--- a/core/math/vector3.h
+++ b/core/math/vector3.h
@@ -75,6 +75,7 @@ struct Vector3 {
_FORCE_INLINE_ void normalize();
_FORCE_INLINE_ Vector3 normalized() const;
+ _FORCE_INLINE_ bool is_normalized() const;
_FORCE_INLINE_ Vector3 inverse() const;
_FORCE_INLINE_ void zero();
@@ -385,6 +386,10 @@ Vector3 Vector3::normalized() const {
return v;
}
+bool Vector3::is_normalized() const {
+ return Math::isequal_approx(length(), (real_t)1.0);
+}
+
Vector3 Vector3::inverse() const {
return Vector3(1.0 / x, 1.0 / y, 1.0 / z);
diff --git a/core/object.h b/core/object.h
index a5836b74ff..f4a622f5f7 100644
--- a/core/object.h
+++ b/core/object.h
@@ -53,7 +53,7 @@ enum PropertyHint {
PROPERTY_HINT_RANGE, ///< hint_text = "min,max,step,slider; //slider is optional"
PROPERTY_HINT_EXP_RANGE, ///< hint_text = "min,max,step", exponential edit
PROPERTY_HINT_ENUM, ///< hint_text= "val1,val2,val3,etc"
- PROPERTY_HINT_EXP_EASING, /// exponential easing funciton (Math::ease)
+ PROPERTY_HINT_EXP_EASING, /// exponential easing function (Math::ease)
PROPERTY_HINT_LENGTH, ///< hint_text= "length" (as integer)
PROPERTY_HINT_SPRITE_FRAME,
PROPERTY_HINT_KEY_ACCEL, ///< hint_text= "length" (as integer)
diff --git a/core/os/input.h b/core/os/input.h
index 2f6359632e..3c33c46eba 100644
--- a/core/os/input.h
+++ b/core/os/input.h
@@ -81,6 +81,7 @@ public:
virtual int get_mouse_button_mask() const = 0;
virtual void warp_mouse_pos(const Vector2 &p_to) = 0;
+ virtual Point2i warp_mouse_motion(const InputEventMouseMotion &p_motion, const Rect2 &p_rect) = 0;
virtual Vector3 get_gravity() const = 0;
virtual Vector3 get_accelerometer() const = 0;
diff --git a/core/pool_allocator.cpp b/core/pool_allocator.cpp
index 68de05a765..df55a5f615 100644
--- a/core/pool_allocator.cpp
+++ b/core/pool_allocator.cpp
@@ -231,7 +231,7 @@ PoolAllocator::ID PoolAllocator::alloc(int p_size) {
Entry &entry = entry_array[entry_indices[new_entry_indices_pos]];
entry.len = p_size;
- entry.pos = (new_entry_indices_pos == 0) ? 0 : entry_end(entry_array[entry_indices[new_entry_indices_pos - 1]]); //alloc either at begining or end of previous
+ entry.pos = (new_entry_indices_pos == 0) ? 0 : entry_end(entry_array[entry_indices[new_entry_indices_pos - 1]]); //alloc either at beginning or end of previous
entry.lock = 0;
entry.check = (check_count++) & CHECK_MASK;
free_mem -= size_to_alloc;
diff --git a/core/script_debugger_remote.cpp b/core/script_debugger_remote.cpp
index bb7ed22c28..35e7f03f0e 100644
--- a/core/script_debugger_remote.cpp
+++ b/core/script_debugger_remote.cpp
@@ -369,7 +369,7 @@ void ScriptDebuggerRemote::_get_output() {
void ScriptDebuggerRemote::line_poll() {
//the purpose of this is just processing events every now and then when the script might get too busy
- //otherwise bugs like infinite loops cant be catched
+ //otherwise bugs like infinite loops can't be caught
if (poll_every % 2048 == 0)
_poll_events();
poll_every++;