summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/array.cpp1
-rw-r--r--core/bind/core_bind.cpp36
-rw-r--r--core/class_db.cpp (renamed from core/object_type_db.cpp)5
-rw-r--r--core/class_db.h (renamed from core/object_type_db.h)9
-rw-r--r--core/color.cpp1
-rw-r--r--core/color_names.inc2
-rw-r--r--core/command_queue_mt.cpp1
-rw-r--r--core/command_queue_mt.h34
-rw-r--r--core/compressed_translation.cpp1
-rw-r--r--core/dictionary.cpp1
-rw-r--r--core/engine.cpp1
-rw-r--r--core/error_macros.cpp1
-rw-r--r--core/global_constants.cpp1
-rw-r--r--core/globals.cpp3
-rw-r--r--core/image.cpp10
-rw-r--r--core/input_map.cpp7
-rw-r--r--core/io/aes256.cpp6
-rw-r--r--core/io/base64.c8
-rw-r--r--core/io/base64.h8
-rw-r--r--core/io/compression.cpp2
-rw-r--r--core/io/networked_multiplayer_peer.cpp28
-rw-r--r--core/io/networked_multiplayer_peer.h28
-rw-r--r--core/io/pck_packer.cpp2
-rw-r--r--core/map.h2
-rw-r--r--core/math/a_star.cpp2
-rw-r--r--core/math/audio_frame.cpp2
-rw-r--r--core/math/audio_frame.h28
-rw-r--r--core/math/bsp_tree.h2
-rw-r--r--core/math/camera_matrix.cpp45
-rw-r--r--core/math/face3.h2
-rw-r--r--core/math/geometry.h2
-rw-r--r--core/math/math_funcs.cpp25
-rw-r--r--core/math/math_funcs.h7
-rw-r--r--core/math/octree.h2
-rw-r--r--core/math/pcg.cpp15
-rw-r--r--core/math/pcg.h14
-rw-r--r--core/math/quick_hull.h2
-rw-r--r--core/math/rect3.cpp (renamed from core/math/aabb.cpp)4
-rw-r--r--core/math/rect3.h (renamed from core/math/aabb.h)2
-rw-r--r--core/math/transform.h2
-rw-r--r--core/math/triangle_mesh.cpp45
-rw-r--r--core/message_queue.cpp2
-rw-r--r--core/object.cpp3
-rw-r--r--core/object.h2
-rw-r--r--core/os/input_event.cpp3
-rw-r--r--core/os/keyboard.cpp7
-rw-r--r--core/os/mutex.cpp2
-rw-r--r--core/packed_data_container.cpp2
-rw-r--r--core/path_db.cpp4
-rw-r--r--core/path_remap.cpp2
-rw-r--r--core/pool_allocator.cpp3
-rw-r--r--core/print_string.cpp2
-rw-r--r--core/profile_clock.cpp3
-rw-r--r--core/profile_clock.h7
-rw-r--r--core/ref_ptr.cpp1
-rw-r--r--core/reference.cpp1
-rw-r--r--core/reference.h2
-rw-r--r--core/register_core_types.cpp2
-rw-r--r--core/resource.cpp10
-rw-r--r--core/resource.h2
-rw-r--r--core/script_debugger_local.cpp3
-rw-r--r--core/script_debugger_remote.cpp2
-rw-r--r--core/set.h2
-rw-r--r--core/string_db.cpp2
-rw-r--r--core/translation.cpp1
-rw-r--r--core/typedefs.h74
-rw-r--r--core/undo_redo.cpp1
-rw-r--r--core/ustring.cpp14
-rw-r--r--core/variant.cpp3
-rw-r--r--core/variant.h2
-rw-r--r--core/variant_call.cpp41
-rw-r--r--core/variant_construct_string.cpp2
-rw-r--r--core/variant_op.cpp2
-rw-r--r--core/variant_parser.cpp18
74 files changed, 398 insertions, 228 deletions
diff --git a/core/array.cpp b/core/array.cpp
index b9c8f543da..16598a044d 100644
--- a/core/array.cpp
+++ b/core/array.cpp
@@ -27,6 +27,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "array.h"
+
#include "vector.h"
#include "hashfuncs.h"
#include "variant.h"
diff --git a/core/bind/core_bind.cpp b/core/bind/core_bind.cpp
index 657f527a51..d4f61b7ffc 100644
--- a/core/bind/core_bind.cpp
+++ b/core/bind/core_bind.cpp
@@ -592,28 +592,20 @@ uint64_t _OS::get_unix_time_from_datetime(Dictionary datetime) const {
static const unsigned int SECONDS_PER_MINUTE = 60;
static const unsigned int MINUTES_PER_HOUR = 60;
static const unsigned int HOURS_PER_DAY = 24;
- static const unsigned int SECONDS_PER_HOUR = MINUTES_PER_HOUR *
- SECONDS_PER_MINUTE;
+ static const unsigned int SECONDS_PER_HOUR = MINUTES_PER_HOUR * SECONDS_PER_MINUTE;
static const unsigned int SECONDS_PER_DAY = SECONDS_PER_HOUR * HOURS_PER_DAY;
// Get all time values from the dictionary, set to zero if it doesn't exist.
// Risk incorrect calculation over throwing errors
- unsigned int second = ((datetime.has(SECOND_KEY))?
- static_cast<unsigned int>(datetime[SECOND_KEY]): 0);
- unsigned int minute = ((datetime.has(MINUTE_KEY))?
- static_cast<unsigned int>(datetime[MINUTE_KEY]): 0);
- unsigned int hour = ((datetime.has(HOUR_KEY))?
- static_cast<unsigned int>(datetime[HOUR_KEY]): 0);
- unsigned int day = ((datetime.has(DAY_KEY))?
- static_cast<unsigned int>(datetime[DAY_KEY]): 0);
- unsigned int month = ((datetime.has(MONTH_KEY))?
- static_cast<unsigned int>(datetime[MONTH_KEY]) -1: 0);
- unsigned int year = ((datetime.has(YEAR_KEY))?
- static_cast<unsigned int>(datetime[YEAR_KEY]):0);
+ unsigned int second = ((datetime.has(SECOND_KEY)) ? static_cast<unsigned int>(datetime[SECOND_KEY]): 0);
+ unsigned int minute = ((datetime.has(MINUTE_KEY)) ? static_cast<unsigned int>(datetime[MINUTE_KEY]): 0);
+ unsigned int hour = ((datetime.has(HOUR_KEY)) ? static_cast<unsigned int>(datetime[HOUR_KEY]): 0);
+ unsigned int day = ((datetime.has(DAY_KEY)) ? static_cast<unsigned int>(datetime[DAY_KEY]): 0);
+ unsigned int month = ((datetime.has(MONTH_KEY)) ? static_cast<unsigned int>(datetime[MONTH_KEY]) -1: 0);
+ unsigned int year = ((datetime.has(YEAR_KEY)) ? static_cast<unsigned int>(datetime[YEAR_KEY]):0);
/// How many days come before each month (0-12)
- static const unsigned short int DAYS_PAST_THIS_YEAR_TABLE[2][13] =
- {
+ static const unsigned short int DAYS_PAST_THIS_YEAR_TABLE[2][13] = {
/* Normal years. */
{ 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365 },
/* Leap years. */
@@ -633,19 +625,16 @@ uint64_t _OS::get_unix_time_from_datetime(Dictionary datetime) const {
ERR_FAIL_COND_V( month+1 > 12, 0);
// Do this check after month is tested as valid
- ERR_EXPLAIN("Invalid day value of: " + itos(day) + " which is larger "
- "than "+ itos(MONTH_DAYS_TABLE[LEAPYEAR(year)][month]));
+ ERR_EXPLAIN("Invalid day value of: " + itos(day) + " which is larger than "+ itos(MONTH_DAYS_TABLE[LEAPYEAR(year)][month]));
ERR_FAIL_COND_V( day > MONTH_DAYS_TABLE[LEAPYEAR(year)][month], 0);
// Calculate all the seconds from months past in this year
- uint64_t SECONDS_FROM_MONTHS_PAST_THIS_YEAR =
- DAYS_PAST_THIS_YEAR_TABLE[LEAPYEAR(year)][month] * SECONDS_PER_DAY;
+ uint64_t SECONDS_FROM_MONTHS_PAST_THIS_YEAR = DAYS_PAST_THIS_YEAR_TABLE[LEAPYEAR(year)][month] * SECONDS_PER_DAY;
uint64_t SECONDS_FROM_YEARS_PAST = 0;
for(unsigned int iyear = EPOCH_YR; iyear < year; iyear++) {
- SECONDS_FROM_YEARS_PAST += YEARSIZE(iyear) *
- SECONDS_PER_DAY;
+ SECONDS_FROM_YEARS_PAST += YEARSIZE(iyear) * SECONDS_PER_DAY;
}
uint64_t epoch =
@@ -676,8 +665,7 @@ Dictionary _OS::get_datetime_from_unix_time( uint64_t unix_time_val) const {
// Just fail if unix time is negative (when interpreted as an int).
// This means the user passed in a negative value by accident
- ERR_EXPLAIN("unix_time_val was really huge!"+ itos(unix_time_val) +
- " You probably passed in a negative value!");
+ ERR_EXPLAIN("unix_time_val was really huge!"+ itos(unix_time_val) + " You probably passed in a negative value!");
ERR_FAIL_COND_V( (int64_t)unix_time_val < 0, Dictionary());
OS::Date date;
diff --git a/core/object_type_db.cpp b/core/class_db.cpp
index 24b9c26e71..bb3368c128 100644
--- a/core/object_type_db.cpp
+++ b/core/class_db.cpp
@@ -1,5 +1,5 @@
/*************************************************************************/
-/* object_type_db.cpp */
+/* class_db.cpp */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
@@ -26,7 +26,8 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#include "object_type_db.h"
+#include "class_db.h"
+
#include "os/mutex.h"
#ifdef NO_THREADS
diff --git a/core/object_type_db.h b/core/class_db.h
index f745e3d5fd..a09a42423b 100644
--- a/core/object_type_db.h
+++ b/core/class_db.h
@@ -1,5 +1,5 @@
/*************************************************************************/
-/* object_type_db.h */
+/* class_db.h */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
@@ -26,12 +26,13 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#ifndef OBJECT_TYPE_DB_H
-#define OBJECT_TYPE_DB_H
+#ifndef CLASS_DB_H
+#define CLASS_DB_H
#include "object.h"
#include "method_bind.h"
#include "print_string.h"
+
/**
@author Juan Linietsky <reduzio@gmail.com>
*/
@@ -537,4 +538,4 @@ public:
-#endif
+#endif // CLASS_DB_H
diff --git a/core/color.cpp b/core/color.cpp
index 89accbb6d2..80a98da252 100644
--- a/core/color.cpp
+++ b/core/color.cpp
@@ -27,6 +27,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "color.h"
+
#include "math_funcs.h"
#include "print_string.h"
#include "map.h"
diff --git a/core/color_names.inc b/core/color_names.inc
index 7b674bb289..b05684acc6 100644
--- a/core/color_names.inc
+++ b/core/color_names.inc
@@ -1,4 +1,6 @@
// Names from https://en.wikipedia.org/wiki/List_of_colors (through https://raw.githubusercontent.com/SuperUserNameMan/color_to_name/616a7cddafefda91478b7bc26167de97fb5badb1/godot_version.gd), slightly edited and normalized
+#include "map.h"
+
static Map<String, Color> _named_colors;
static void _populate_named_colors() {
if(!_named_colors.empty()) return;
diff --git a/core/command_queue_mt.cpp b/core/command_queue_mt.cpp
index 9b1c052eb9..6d50ed8d9a 100644
--- a/core/command_queue_mt.cpp
+++ b/core/command_queue_mt.cpp
@@ -27,6 +27,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "command_queue_mt.h"
+
#include "os/os.h"
void CommandQueueMT::lock() {
diff --git a/core/command_queue_mt.h b/core/command_queue_mt.h
index 779bbe1b58..3975df7658 100644
--- a/core/command_queue_mt.h
+++ b/core/command_queue_mt.h
@@ -179,7 +179,7 @@ class CommandQueueMT {
R* ret;
SyncSemaphore *sync;
- virtual void call() { *ret = (instance->*method)(); sync->sem->post(); sync->in_use=false; ; }
+ virtual void call() { *ret = (instance->*method)(); sync->sem->post(); sync->in_use=false; }
};
template<class T,class M,class P1,class R>
@@ -204,7 +204,7 @@ class CommandQueueMT {
R* ret;
SyncSemaphore *sync;
- virtual void call() { *ret = (instance->*method)(p1,p2); sync->sem->post(); sync->in_use=false; ; }
+ virtual void call() { *ret = (instance->*method)(p1,p2); sync->sem->post(); sync->in_use=false; }
};
template<class T,class M,class P1,class P2,class P3,class R>
@@ -218,7 +218,7 @@ class CommandQueueMT {
R* ret;
SyncSemaphore *sync;
- virtual void call() { *ret = (instance->*method)(p1,p2,p3); sync->sem->post(); sync->in_use=false; ; }
+ virtual void call() { *ret = (instance->*method)(p1,p2,p3); sync->sem->post(); sync->in_use=false; }
};
template<class T,class M,class P1,class P2,class P3,class P4,class R>
@@ -233,7 +233,7 @@ class CommandQueueMT {
R* ret;
SyncSemaphore *sync;
- virtual void call() { *ret = (instance->*method)(p1,p2,p3,p4); sync->sem->post(); sync->in_use=false; ; }
+ virtual void call() { *ret = (instance->*method)(p1,p2,p3,p4); sync->sem->post(); sync->in_use=false; }
};
template<class T,class M,class P1,class P2,class P3,class P4,class P5,class R>
@@ -249,7 +249,7 @@ class CommandQueueMT {
R* ret;
SyncSemaphore *sync;
- virtual void call() { *ret = (instance->*method)(p1,p2,p3,p4,p5); sync->sem->post(); sync->in_use=false; ; }
+ virtual void call() { *ret = (instance->*method)(p1,p2,p3,p4,p5); sync->sem->post(); sync->in_use=false; }
};
template<class T,class M,class P1,class P2,class P3,class P4,class P5,class P6,class R>
@@ -266,7 +266,7 @@ class CommandQueueMT {
R* ret;
SyncSemaphore *sync;
- virtual void call() { *ret = (instance->*method)(p1,p2,p3,p4,p5,p6); sync->sem->post(); sync->in_use=false; ; }
+ virtual void call() { *ret = (instance->*method)(p1,p2,p3,p4,p5,p6); sync->sem->post(); sync->in_use=false; }
};
template<class T,class M,class P1,class P2,class P3,class P4,class P5,class P6,class P7,class R>
@@ -284,7 +284,7 @@ class CommandQueueMT {
R* ret;
SyncSemaphore *sync;
- virtual void call() { *ret = (instance->*method)(p1,p2,p3,p4,p5,p6,p7); sync->sem->post(); sync->in_use=false; ; }
+ virtual void call() { *ret = (instance->*method)(p1,p2,p3,p4,p5,p6,p7); sync->sem->post(); sync->in_use=false; }
};
template<class T,class M,class P1,class P2,class P3,class P4,class P5,class P6,class P7,class P8,class R>
@@ -303,7 +303,7 @@ class CommandQueueMT {
R* ret;
SyncSemaphore *sync;
- virtual void call() { *ret = (instance->*method)(p1,p2,p3,p4,p5,p6,p7,p8); sync->sem->post(); sync->in_use=false; ; }
+ virtual void call() { *ret = (instance->*method)(p1,p2,p3,p4,p5,p6,p7,p8); sync->sem->post(); sync->in_use=false; }
};
/** commands that don't return but sync */
@@ -318,7 +318,7 @@ class CommandQueueMT {
SyncSemaphore *sync;
- virtual void call() { (instance->*method)(); sync->sem->post(); sync->in_use=false; ; }
+ virtual void call() { (instance->*method)(); sync->sem->post(); sync->in_use=false; }
};
template<class T,class M,class P1>
@@ -330,7 +330,7 @@ class CommandQueueMT {
SyncSemaphore *sync;
- virtual void call() { (instance->*method)(p1); sync->sem->post(); sync->in_use=false; ; }
+ virtual void call() { (instance->*method)(p1); sync->sem->post(); sync->in_use=false; }
};
template<class T,class M,class P1,class P2>
@@ -343,7 +343,7 @@ class CommandQueueMT {
SyncSemaphore *sync;
- virtual void call() { (instance->*method)(p1,p2); sync->sem->post(); sync->in_use=false; ; }
+ virtual void call() { (instance->*method)(p1,p2); sync->sem->post(); sync->in_use=false; }
};
template<class T,class M,class P1,class P2,class P3>
@@ -357,7 +357,7 @@ class CommandQueueMT {
SyncSemaphore *sync;
- virtual void call() { (instance->*method)(p1,p2,p3); sync->sem->post(); sync->in_use=false; ; }
+ virtual void call() { (instance->*method)(p1,p2,p3); sync->sem->post(); sync->in_use=false; }
};
template<class T,class M,class P1,class P2,class P3,class P4>
@@ -372,7 +372,7 @@ class CommandQueueMT {
SyncSemaphore *sync;
- virtual void call() { (instance->*method)(p1,p2,p3,p4); sync->sem->post(); sync->in_use=false; ; }
+ virtual void call() { (instance->*method)(p1,p2,p3,p4); sync->sem->post(); sync->in_use=false; }
};
template<class T,class M,class P1,class P2,class P3,class P4,class P5>
@@ -388,7 +388,7 @@ class CommandQueueMT {
SyncSemaphore *sync;
- virtual void call() { (instance->*method)(p1,p2,p3,p4,p5); sync->sem->post(); sync->in_use=false; ; }
+ virtual void call() { (instance->*method)(p1,p2,p3,p4,p5); sync->sem->post(); sync->in_use=false; }
};
template<class T,class M,class P1,class P2,class P3,class P4,class P5,class P6>
@@ -405,7 +405,7 @@ class CommandQueueMT {
SyncSemaphore *sync;
- virtual void call() { (instance->*method)(p1,p2,p3,p4,p5,p6); sync->sem->post(); sync->in_use=false; ; }
+ virtual void call() { (instance->*method)(p1,p2,p3,p4,p5,p6); sync->sem->post(); sync->in_use=false; }
};
template<class T,class M,class P1,class P2,class P3,class P4,class P5,class P6,class P7>
@@ -423,7 +423,7 @@ class CommandQueueMT {
SyncSemaphore *sync;
- virtual void call() { (instance->*method)(p1,p2,p3,p4,p5,p6,p7); sync->sem->post(); sync->in_use=false; ; }
+ virtual void call() { (instance->*method)(p1,p2,p3,p4,p5,p6,p7); sync->sem->post(); sync->in_use=false; }
};
template<class T,class M,class P1,class P2,class P3,class P4,class P5,class P6,class P7,class P8>
@@ -442,7 +442,7 @@ class CommandQueueMT {
SyncSemaphore *sync;
- virtual void call() { (instance->*method)(p1,p2,p3,p4,p5,p6,p7,p8); sync->sem->post(); sync->in_use=false; ; }
+ virtual void call() { (instance->*method)(p1,p2,p3,p4,p5,p6,p7,p8); sync->sem->post(); sync->in_use=false; }
};
/***** BASE *******/
diff --git a/core/compressed_translation.cpp b/core/compressed_translation.cpp
index 1e3a51fede..d39db5044b 100644
--- a/core/compressed_translation.cpp
+++ b/core/compressed_translation.cpp
@@ -27,6 +27,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "compressed_translation.h"
+
#include "pair.h"
#include <string.h>
diff --git a/core/dictionary.cpp b/core/dictionary.cpp
index 3b4d3b65d0..1176b9be3b 100644
--- a/core/dictionary.cpp
+++ b/core/dictionary.cpp
@@ -27,6 +27,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "dictionary.h"
+
#include "safe_refcount.h"
#include "variant.h"
diff --git a/core/engine.cpp b/core/engine.cpp
index eb6d8a3478..b017e77275 100644
--- a/core/engine.cpp
+++ b/core/engine.cpp
@@ -27,6 +27,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "engine.h"
+
#include "version.h"
void Engine::set_iterations_per_second(int p_ips) {
diff --git a/core/error_macros.cpp b/core/error_macros.cpp
index 53a361fa3a..e963f6122b 100644
--- a/core/error_macros.cpp
+++ b/core/error_macros.cpp
@@ -27,6 +27,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "error_macros.h"
+
#include "os/os.h"
diff --git a/core/global_constants.cpp b/core/global_constants.cpp
index 936facdd23..be619d9ee3 100644
--- a/core/global_constants.cpp
+++ b/core/global_constants.cpp
@@ -27,6 +27,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "global_constants.h"
+
#include "variant.h"
#include "os/keyboard.h"
#include "object.h"
diff --git a/core/globals.cpp b/core/globals.cpp
index 96daf55276..af3ec403d5 100644
--- a/core/globals.cpp
+++ b/core/globals.cpp
@@ -27,9 +27,9 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "globals.h"
+
#include "os/dir_access.h"
#include "os/file_access.h"
-
#include "os/keyboard.h"
#include "io/marshalls.h"
#include "bind/core_bind.h"
@@ -37,6 +37,7 @@
#include "io/file_access_pack.h"
#include "io/file_access_network.h"
#include "variant_parser.h"
+
GlobalConfig *GlobalConfig::singleton=NULL;
GlobalConfig *GlobalConfig::get_singleton() {
diff --git a/core/image.cpp b/core/image.cpp
index d769e6a0b3..ed505b0f77 100644
--- a/core/image.cpp
+++ b/core/image.cpp
@@ -27,11 +27,13 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "image.h"
+
#include "hash_map.h"
#include "core/io/image_loader.h"
#include "core/os/copymem.h"
#include "hq2x.h"
#include "print_string.h"
+
#include <stdio.h>
@@ -762,7 +764,7 @@ void Image::flip_y() {
bool gm=mipmaps;
if (gm)
- clear_mipmaps();;
+ clear_mipmaps();
@@ -789,7 +791,7 @@ void Image::flip_y() {
if (gm)
- generate_mipmaps();;
+ generate_mipmaps();
}
@@ -802,7 +804,7 @@ void Image::flip_x() {
bool gm=mipmaps;
if (gm)
- clear_mipmaps();;
+ clear_mipmaps();
{
@@ -827,7 +829,7 @@ void Image::flip_x() {
}
if (gm)
- generate_mipmaps();;
+ generate_mipmaps();
}
diff --git a/core/input_map.cpp b/core/input_map.cpp
index bcae630c76..8473bce806 100644
--- a/core/input_map.cpp
+++ b/core/input_map.cpp
@@ -27,6 +27,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "input_map.h"
+
#include "globals.h"
#include "os/keyboard.h"
@@ -198,7 +199,7 @@ Array InputMap::_get_action_list(const StringName& p_action) {
if (al) {
for(const List<InputEvent>::Element *E=al->front();E;E=E->next()) {
- ret.push_back(E->get());;
+ ret.push_back(E->get());
}
}
@@ -238,7 +239,7 @@ const Map<StringName, InputMap::Action>& InputMap::get_action_map() const {
void InputMap::load_from_globals() {
- input_map.clear();;
+ input_map.clear();
List<PropertyInfo> pinfo;
GlobalConfig::get_singleton()->get_property_list(&pinfo);
@@ -253,7 +254,7 @@ void InputMap::load_from_globals() {
add_action(name);
- Array va = GlobalConfig::get_singleton()->get(pi.name);;
+ Array va = GlobalConfig::get_singleton()->get(pi.name);
for(int i=0;i<va.size();i++) {
diff --git a/core/io/aes256.cpp b/core/io/aes256.cpp
index cfdac0214d..dc271928b4 100644
--- a/core/io/aes256.cpp
+++ b/core/io/aes256.cpp
@@ -44,8 +44,7 @@ static uint8_t rj_sbox_inv(uint8_t);
#ifdef BACK_TO_TABLES
-static const uint8_t sbox[256] =
-{
+static const uint8_t sbox[256] = {
0x63, 0x7c, 0x77, 0x7b, 0xf2, 0x6b, 0x6f, 0xc5,
0x30, 0x01, 0x67, 0x2b, 0xfe, 0xd7, 0xab, 0x76,
0xca, 0x82, 0xc9, 0x7d, 0xfa, 0x59, 0x47, 0xf0,
@@ -79,8 +78,7 @@ static const uint8_t sbox[256] =
0x8c, 0xa1, 0x89, 0x0d, 0xbf, 0xe6, 0x42, 0x68,
0x41, 0x99, 0x2d, 0x0f, 0xb0, 0x54, 0xbb, 0x16
};
-static const uint8_t sboxinv[256] =
-{
+static const uint8_t sboxinv[256] = {
0x52, 0x09, 0x6a, 0xd5, 0x30, 0x36, 0xa5, 0x38,
0xbf, 0x40, 0xa3, 0x9e, 0x81, 0xf3, 0xd7, 0xfb,
0x7c, 0xe3, 0x39, 0x82, 0x9b, 0x2f, 0xff, 0x87,
diff --git a/core/io/base64.c b/core/io/base64.c
index 0c799e9f07..0929ae5db5 100644
--- a/core/io/base64.c
+++ b/core/io/base64.c
@@ -1,3 +1,11 @@
+/*
+ * File: base64.c
+ * Description: Simple BASE64 conversion methods
+ * Author: Ari Edelkind
+ * License: Public Domain
+ * Website: http://episec.com/people/edelkind/c.html
+ */
+
#include <string.h>
char b64string[] =
diff --git a/core/io/base64.h b/core/io/base64.h
index b70b387983..456ef1811b 100644
--- a/core/io/base64.h
+++ b/core/io/base64.h
@@ -1,3 +1,11 @@
+/*
+ * File: base64.h
+ * Description: Simple BASE64 conversion methods
+ * Author: Ari Edelkind
+ * License: Public Domain
+ * Website: http://episec.com/people/edelkind/c.html
+ */
+
#ifndef BASE64_H
#define BASE64_H
diff --git a/core/io/compression.cpp b/core/io/compression.cpp
index 0d3b494106..6fda7d52f3 100644
--- a/core/io/compression.cpp
+++ b/core/io/compression.cpp
@@ -59,7 +59,7 @@ int Compression::compress(uint8_t *p_dst, const uint8_t *p_src, int p_src_size,M
return -1;
strm.avail_in=p_src_size;
- int aout = deflateBound(&strm,p_src_size);;
+ int aout = deflateBound(&strm,p_src_size);
/*if (aout>p_src_size) {
deflateEnd(&strm);
return -1;
diff --git a/core/io/networked_multiplayer_peer.cpp b/core/io/networked_multiplayer_peer.cpp
index 6133401a8c..2981307af6 100644
--- a/core/io/networked_multiplayer_peer.cpp
+++ b/core/io/networked_multiplayer_peer.cpp
@@ -1,3 +1,31 @@
+/*************************************************************************/
+/* networked_multiplayer_peer.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* http://www.godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
#include "networked_multiplayer_peer.h"
diff --git a/core/io/networked_multiplayer_peer.h b/core/io/networked_multiplayer_peer.h
index a59d9367d1..5d859a2f25 100644
--- a/core/io/networked_multiplayer_peer.h
+++ b/core/io/networked_multiplayer_peer.h
@@ -1,3 +1,31 @@
+/*************************************************************************/
+/* networked_multiplayer_peer.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* http://www.godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
#ifndef NETWORKED_MULTIPLAYER_PEER_H
#define NETWORKED_MULTIPLAYER_PEER_H
diff --git a/core/io/pck_packer.cpp b/core/io/pck_packer.cpp
index a9f357a7c8..fb5875e4cc 100644
--- a/core/io/pck_packer.cpp
+++ b/core/io/pck_packer.cpp
@@ -1,5 +1,5 @@
/*************************************************************************/
-/* pkc_packer.cpp */
+/* pck_packer.cpp */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
diff --git a/core/map.h b/core/map.h
index 9448389169..d1a4c209ad 100644
--- a/core/map.h
+++ b/core/map.h
@@ -428,7 +428,7 @@ private:
Element *aux=node->parent->left;
if (aux->color==RED) {
_set_color(aux,BLACK);
- _set_color(node->parent,RED);;
+ _set_color(node->parent,RED);
_rotate_right(node->parent);
aux=node->parent->left;
}
diff --git a/core/math/a_star.cpp b/core/math/a_star.cpp
index 0d6997183f..2c45009a60 100644
--- a/core/math/a_star.cpp
+++ b/core/math/a_star.cpp
@@ -1,5 +1,5 @@
/*************************************************************************/
-/* a_star.cpp */
+/* a_star.cpp */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
diff --git a/core/math/audio_frame.cpp b/core/math/audio_frame.cpp
new file mode 100644
index 0000000000..566ba23992
--- /dev/null
+++ b/core/math/audio_frame.cpp
@@ -0,0 +1,2 @@
+#include "audio_frame.h"
+
diff --git a/core/math/audio_frame.h b/core/math/audio_frame.h
new file mode 100644
index 0000000000..dbababf762
--- /dev/null
+++ b/core/math/audio_frame.h
@@ -0,0 +1,28 @@
+#ifndef AUDIOFRAME_H
+#define AUDIOFRAME_H
+
+#include "typedefs.h"
+
+struct AudioFrame {
+
+ float l,r;
+
+ _ALWAYS_INLINE_ const float& operator[](int idx) const { return idx==0?l:r; }
+ _ALWAYS_INLINE_ float& operator[](int idx) { return idx==0?l:r; }
+
+ _ALWAYS_INLINE_ AudioFrame operator+(const AudioFrame& p_frame) const { return AudioFrame(l+p_frame.l,r+p_frame.r); }
+ _ALWAYS_INLINE_ AudioFrame operator-(const AudioFrame& p_frame) const { return AudioFrame(l-p_frame.l,r-p_frame.r); }
+ _ALWAYS_INLINE_ AudioFrame operator*(const AudioFrame& p_frame) const { return AudioFrame(l*p_frame.l,r*p_frame.r); }
+ _ALWAYS_INLINE_ AudioFrame operator/(const AudioFrame& p_frame) const { return AudioFrame(l/p_frame.l,r/p_frame.r); }
+
+ _ALWAYS_INLINE_ void operator+=(const AudioFrame& p_frame) { l+=p_frame.l; r+=p_frame.r; }
+ _ALWAYS_INLINE_ void operator-=(const AudioFrame& p_frame) { l-=p_frame.l; r-=p_frame.r; }
+ _ALWAYS_INLINE_ void operator*=(const AudioFrame& p_frame) { l*=p_frame.l; r*=p_frame.r; }
+ _ALWAYS_INLINE_ void operator/=(const AudioFrame& p_frame) { l/=p_frame.l; r/=p_frame.r; }
+
+ _ALWAYS_INLINE_ AudioFrame(float p_l, float p_r) {l=p_l; r=p_r;}
+ _ALWAYS_INLINE_ AudioFrame(const AudioFrame& p_frame) {l=p_frame.l; r=p_frame.r;}
+
+};
+
+#endif
diff --git a/core/math/bsp_tree.h b/core/math/bsp_tree.h
index e01df96555..a64fffcb78 100644
--- a/core/math/bsp_tree.h
+++ b/core/math/bsp_tree.h
@@ -30,7 +30,7 @@
#define BSP_TREE_H
#include "plane.h"
-#include "aabb.h"
+#include "rect3.h"
#include "face3.h"
#include "vector.h"
#include "dvector.h"
diff --git a/core/math/camera_matrix.cpp b/core/math/camera_matrix.cpp
index c44ff4682a..7669356f5e 100644
--- a/core/math/camera_matrix.cpp
+++ b/core/math/camera_matrix.cpp
@@ -143,10 +143,22 @@ void CameraMatrix::set_frustum(float p_left, float p_right, float p_bottom, floa
float c = - ( p_far + p_near ) / ( p_far - p_near );
float d = - 2 * p_far * p_near / ( p_far - p_near );
- te[0] = x; te[4] = 0; te[8] = a; te[12] = 0;
- te[1] = 0; te[5] = y; te[9] = b; te[13] = 0;
- te[2] = 0; te[6] = 0; te[10] = c; te[14] = d;
- te[3] = 0; te[7] = 0; te[11] = - 1; te[15] = 0;
+ te[0] = x;
+ te[1] = 0;
+ te[2] = 0;
+ te[3] = 0;
+ te[4] = 0;
+ te[5] = y;
+ te[6] = 0;
+ te[7] = 0;
+ te[8] = a;
+ te[9] = b;
+ te[10] = c;
+ te[11] = -1;
+ te[12] = 0;
+ te[13] = 0;
+ te[14] = d;
+ te[15] = 0;
#endif
@@ -186,18 +198,21 @@ void CameraMatrix::get_viewport_size(float& r_width, float& r_height) const {
Plane near_plane=Plane(matrix[ 3] + matrix[ 2],
matrix[ 7] + matrix[ 6],
matrix[11] + matrix[10],
- -matrix[15] - matrix[14]).normalized();
+ -matrix[15] - matrix[14]);
+ near_plane.normalize();
///////--- Right Plane ---///////
Plane right_plane=Plane(matrix[ 3] - matrix[ 0],
matrix[ 7] - matrix[ 4],
matrix[11] - matrix[ 8],
- - matrix[15] + matrix[12]).normalized();
+ - matrix[15] + matrix[12]);
+ right_plane.normalize();
Plane top_plane=Plane(matrix[ 3] - matrix[ 1],
matrix[ 7] - matrix[ 5],
matrix[11] - matrix[ 9],
- -matrix[15] + matrix[13]).normalized();
+ -matrix[15] + matrix[13]);
+ top_plane.normalize();
Vector3 res;
near_plane.intersect_3(right_plane,top_plane,&res);
@@ -214,26 +229,29 @@ bool CameraMatrix::get_endpoints(const Transform& p_transform, Vector3 *p_8point
Plane near_plane=Plane(matrix[ 3] + matrix[ 2],
matrix[ 7] + matrix[ 6],
matrix[11] + matrix[10],
- -matrix[15] - matrix[14]).normalized();
+ -matrix[15] - matrix[14]);
+ near_plane.normalize();
///////--- Far Plane ---///////
Plane far_plane=Plane(matrix[ 2] - matrix[ 3],
matrix[ 6] - matrix[ 7],
matrix[10] - matrix[11],
- matrix[15] - matrix[14]).normalized();
-
+ matrix[15] - matrix[14]);
+ far_plane.normalize();
///////--- Right Plane ---///////
Plane right_plane=Plane(matrix[ 0] - matrix[ 3],
matrix[ 4] - matrix[ 7],
matrix[8] - matrix[ 11],
- - matrix[15] + matrix[12]).normalized();
+ - matrix[15] + matrix[12]);
+ right_plane.normalize();
///////--- Top Plane ---///////
Plane top_plane=Plane(matrix[ 1] - matrix[ 3],
matrix[ 5] - matrix[ 7],
matrix[9] - matrix[ 11],
- -matrix[15] + matrix[13]).normalized();
+ -matrix[15] + matrix[13]);
+ top_plane.normalize();
Vector3 near_endpoint;
Vector3 far_endpoint;
@@ -549,7 +567,8 @@ float CameraMatrix::get_fov() const {
Plane right_plane=Plane(matrix[ 3] - matrix[ 0],
matrix[ 7] - matrix[ 4],
matrix[11] - matrix[ 8],
- - matrix[15] + matrix[12]).normalized();
+ - matrix[15] + matrix[12]);
+ right_plane.normalize();
return Math::rad2deg(Math::acos(Math::abs(right_plane.normal.x)))*2.0;
}
diff --git a/core/math/face3.h b/core/math/face3.h
index f08eb227b1..e957f64320 100644
--- a/core/math/face3.h
+++ b/core/math/face3.h
@@ -31,7 +31,7 @@
#include "vector3.h"
#include "plane.h"
-#include "aabb.h"
+#include "rect3.h"
#include "transform.h"
class Face3 {
diff --git a/core/math/geometry.h b/core/math/geometry.h
index d5b3a3068c..25f5e11fcf 100644
--- a/core/math/geometry.h
+++ b/core/math/geometry.h
@@ -297,7 +297,7 @@ public:
if (inters_d<0 || inters_d>rel_l)
return false;
- Vector3 result=p_from+normal*inters_d;;
+ Vector3 result=p_from+normal*inters_d;
if (r_res)
*r_res=result;
diff --git a/core/math/math_funcs.cpp b/core/math/math_funcs.cpp
index 8353aa0ebe..ef8c1ec539 100644
--- a/core/math/math_funcs.cpp
+++ b/core/math/math_funcs.cpp
@@ -31,8 +31,9 @@
#include "core/os/os.h"
#include "float.h"
-uint32_t Math::default_seed=1;
+#include "pcg.h"
+pcg32_random_t Math::default_pcg = {1, PCG_DEFAULT_INC_64};
#define PHI 0x9e3779b9
@@ -40,28 +41,26 @@ uint32_t Math::default_seed=1;
static uint32_t Q[4096];
#endif
-uint32_t Math::rand_from_seed(uint32_t *seed) {
- // Xorshift31 PRNG
- if ( *seed == 0 ) *seed = Math::RANDOM_MAX;
- (*seed) ^= (*seed) << 13;
- (*seed) ^= (*seed) >> 17;
- (*seed) ^= (*seed) << 5;
- return (*seed) & Math::RANDOM_MAX;
+// TODO: we should eventually expose pcg.inc too
+uint32_t Math::rand_from_seed(uint64_t *seed) {
+ pcg32_random_t pcg = {*seed, PCG_DEFAULT_INC_64};
+ uint32_t r = pcg32_random_r(&pcg);
+ *seed = pcg.state;
+ return r;
}
-void Math::seed(uint32_t x) {
- default_seed=x;
+void Math::seed(uint64_t x) {
+ default_pcg.state=x;
}
void Math::randomize() {
OS::Time time = OS::get_singleton()->get_time();
- seed(OS::get_singleton()->get_ticks_usec()*(time.hour+1)*(time.min+1)*(time.sec+1)*rand()); /* *OS::get_singleton()->get_time().sec); // windows doesn't have get_time(), returns always 0 */
+ seed(OS::get_singleton()->get_ticks_usec()*(time.hour+1)*(time.min+1)*(time.sec+1)*rand()); // TODO: can be simplified.
}
uint32_t Math::rand() {
-
- return rand_from_seed(&default_seed);
+ return pcg32_random_r(&default_pcg);
}
double Math::randf() {
diff --git a/core/math/math_funcs.h b/core/math/math_funcs.h
index 8ce59224ff..e81646b1ca 100644
--- a/core/math/math_funcs.h
+++ b/core/math/math_funcs.h
@@ -31,6 +31,7 @@
#include "typedefs.h"
#include "math_defs.h"
+#include "pcg.h"
#ifndef NO_MATH_H
#include <math.h>
@@ -41,8 +42,8 @@
class Math {
+ static pcg32_random_t default_pcg;
- static uint32_t default_seed;
public:
Math() {} // useless to instance
@@ -150,12 +151,12 @@ public:
}
- static uint32_t rand_from_seed(uint32_t *seed);
+ static uint32_t rand_from_seed(uint64_t *seed);
static double ease(double p_x, double p_c);
static int step_decimals(double p_step);
static double stepify(double p_value,double p_step);
- static void seed(uint32_t x=0);
+ static void seed(uint64_t x=0);
static void randomize();
static uint32_t larger_prime(uint32_t p_val);
static double dectime(double p_value,double p_amount, double p_step);
diff --git a/core/math/octree.h b/core/math/octree.h
index 483ba1d510..3630922d10 100644
--- a/core/math/octree.h
+++ b/core/math/octree.h
@@ -30,7 +30,7 @@
#define OCTREE_H
#include "vector3.h"
-#include "aabb.h"
+#include "rect3.h"
#include "list.h"
#include "variant.h"
#include "map.h"
diff --git a/core/math/pcg.cpp b/core/math/pcg.cpp
new file mode 100644
index 0000000000..eac3b36d36
--- /dev/null
+++ b/core/math/pcg.cpp
@@ -0,0 +1,15 @@
+// *Really* minimal PCG32 code / (c) 2014 M.E. O'Neill / pcg-random.org
+// Licensed under Apache License 2.0 (NO WARRANTY, etc. see website)
+
+#include "pcg.h"
+
+uint32_t pcg32_random_r(pcg32_random_t* rng)
+{
+ uint64_t oldstate = rng->state;
+ // Advance internal state
+ rng->state = oldstate * 6364136223846793005ULL + (rng->inc|1);
+ // Calculate output function (XSH RR), uses old state for max ILP
+ uint32_t xorshifted = ((oldstate >> 18u) ^ oldstate) >> 27u;
+ uint32_t rot = oldstate >> 59u;
+ return (xorshifted >> rot) | (xorshifted << ((-rot) & 31));
+}
diff --git a/core/math/pcg.h b/core/math/pcg.h
new file mode 100644
index 0000000000..81f4c9770e
--- /dev/null
+++ b/core/math/pcg.h
@@ -0,0 +1,14 @@
+// *Really* minimal PCG32 code / (c) 2014 M.E. O'Neill / pcg-random.org
+// Licensed under Apache License 2.0 (NO WARRANTY, etc. see website)
+
+#ifndef RANDOM_H
+#define RANDOM_H
+
+#include "typedefs.h"
+
+#define PCG_DEFAULT_INC_64 1442695040888963407ULL
+
+typedef struct { uint64_t state; uint64_t inc; } pcg32_random_t;
+uint32_t pcg32_random_r(pcg32_random_t* rng);
+
+#endif // RANDOM_H
diff --git a/core/math/quick_hull.h b/core/math/quick_hull.h
index 04d25fef18..7bd23d31f2 100644
--- a/core/math/quick_hull.h
+++ b/core/math/quick_hull.h
@@ -29,7 +29,7 @@
#ifndef QUICK_HULL_H
#define QUICK_HULL_H
-#include "aabb.h"
+#include "rect3.h"
#include "set.h"
#include "list.h"
#include "geometry.h"
diff --git a/core/math/aabb.cpp b/core/math/rect3.cpp
index 3518eea7ac..e0b0646505 100644
--- a/core/math/aabb.cpp
+++ b/core/math/rect3.cpp
@@ -1,5 +1,5 @@
/*************************************************************************/
-/* aabb.cpp */
+/* rect3.cpp */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
@@ -26,7 +26,7 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#include "aabb.h"
+#include "rect3.h"
#include "print_string.h"
diff --git a/core/math/aabb.h b/core/math/rect3.h
index 2816d1f012..80c67200f4 100644
--- a/core/math/aabb.h
+++ b/core/math/rect3.h
@@ -1,5 +1,5 @@
/*************************************************************************/
-/* aabb.h */
+/* rect3.h */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
diff --git a/core/math/transform.h b/core/math/transform.h
index d65e87cc6a..45d7b2a12c 100644
--- a/core/math/transform.h
+++ b/core/math/transform.h
@@ -31,7 +31,7 @@
#include "matrix3.h"
#include "plane.h"
-#include "aabb.h"
+#include "rect3.h"
/**
@author Juan Linietsky <reduzio@gmail.com>
*/
diff --git a/core/math/triangle_mesh.cpp b/core/math/triangle_mesh.cpp
index 74c4656771..86f8bf29e7 100644
--- a/core/math/triangle_mesh.cpp
+++ b/core/math/triangle_mesh.cpp
@@ -236,21 +236,22 @@ Vector3 TriangleMesh::get_area_normal(const Rect3& p_aabb) const {
stack[level]=(VISIT_LEFT_BIT<<VISITED_BIT_SHIFT)|node;
}
}
-
- } continue;
+ continue;
+ }
case VISIT_LEFT_BIT: {
stack[level]=(VISIT_RIGHT_BIT<<VISITED_BIT_SHIFT)|node;
stack[level+1]=b.left|TEST_AABB_BIT;
level++;
-
- } continue;
+ continue;
+ }
case VISIT_RIGHT_BIT: {
stack[level]=(VISIT_DONE_BIT<<VISITED_BIT_SHIFT)|node;
stack[level+1]=b.right|TEST_AABB_BIT;
level++;
- } continue;
+ continue;
+ }
case VISIT_DONE_BIT: {
if (level==0) {
@@ -258,8 +259,8 @@ Vector3 TriangleMesh::get_area_normal(const Rect3& p_aabb) const {
break;
} else
level--;
-
- } continue;
+ continue;
+ }
}
@@ -357,21 +358,22 @@ bool TriangleMesh::intersect_segment(const Vector3& p_begin,const Vector3& p_end
stack[level]=(VISIT_LEFT_BIT<<VISITED_BIT_SHIFT)|node;
}
}
-
- } continue;
+ continue;
+ }
case VISIT_LEFT_BIT: {
stack[level]=(VISIT_RIGHT_BIT<<VISITED_BIT_SHIFT)|node;
stack[level+1]=b.left|TEST_AABB_BIT;
level++;
-
- } continue;
+ continue;
+ }
case VISIT_RIGHT_BIT: {
stack[level]=(VISIT_DONE_BIT<<VISITED_BIT_SHIFT)|node;
stack[level+1]=b.right|TEST_AABB_BIT;
level++;
- } continue;
+ continue;
+ }
case VISIT_DONE_BIT: {
if (level==0) {
@@ -379,8 +381,8 @@ bool TriangleMesh::intersect_segment(const Vector3& p_begin,const Vector3& p_end
break;
} else
level--;
-
- } continue;
+ continue;
+ }
}
@@ -478,21 +480,22 @@ bool TriangleMesh::intersect_ray(const Vector3& p_begin,const Vector3& p_dir,Vec
stack[level]=(VISIT_LEFT_BIT<<VISITED_BIT_SHIFT)|node;
}
}
-
- } continue;
+ continue;
+ }
case VISIT_LEFT_BIT: {
stack[level]=(VISIT_RIGHT_BIT<<VISITED_BIT_SHIFT)|node;
stack[level+1]=b.left|TEST_AABB_BIT;
level++;
-
- } continue;
+ continue;
+ }
case VISIT_RIGHT_BIT: {
stack[level]=(VISIT_DONE_BIT<<VISITED_BIT_SHIFT)|node;
stack[level+1]=b.right|TEST_AABB_BIT;
level++;
- } continue;
+ continue;
+ }
case VISIT_DONE_BIT: {
if (level==0) {
@@ -500,8 +503,8 @@ bool TriangleMesh::intersect_ray(const Vector3& p_begin,const Vector3& p_dir,Vec
break;
} else
level--;
-
- } continue;
+ continue;
+ }
}
diff --git a/core/message_queue.cpp b/core/message_queue.cpp
index fe46e1671c..668d321e05 100644
--- a/core/message_queue.cpp
+++ b/core/message_queue.cpp
@@ -27,8 +27,10 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "message_queue.h"
+
#include "globals.h"
#include "script_language.h"
+
MessageQueue *MessageQueue::singleton=NULL;
MessageQueue *MessageQueue::get_singleton() {
diff --git a/core/object.cpp b/core/object.cpp
index 8af088122e..26308dc64f 100644
--- a/core/object.cpp
+++ b/core/object.cpp
@@ -27,8 +27,9 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "object.h"
+
#include "print_string.h"
-#include "object_type_db.h"
+#include "class_db.h"
#include "script_language.h"
#include "message_queue.h"
#include "core_string_names.h"
diff --git a/core/object.h b/core/object.h
index 6ce579ea99..b9a800afc4 100644
--- a/core/object.h
+++ b/core/object.h
@@ -721,6 +721,6 @@ public:
};
//needed by macros
-#include "object_type_db.h"
+#include "class_db.h"
#endif
diff --git a/core/os/input_event.cpp b/core/os/input_event.cpp
index 3cc595208f..4ef99558ad 100644
--- a/core/os/input_event.cpp
+++ b/core/os/input_event.cpp
@@ -39,6 +39,8 @@ bool InputEvent::operator==(const InputEvent &p_event) const {
}
switch(type) {
+ /** Current clang-format style doesn't play well with the aligned return values of that switch. */
+ /* clang-format off */
case NONE:
return true;
case KEY:
@@ -80,6 +82,7 @@ bool InputEvent::operator==(const InputEvent &p_event) const {
case ACTION:
return action.action == p_event.action.action
&& action.pressed == p_event.action.pressed;
+ /* clang-format on */
default:
ERR_PRINT("No logic to compare InputEvents of this type, this shouldn't happen.");
}
diff --git a/core/os/keyboard.cpp b/core/os/keyboard.cpp
index 309348ea31..40fa86d09f 100644
--- a/core/os/keyboard.cpp
+++ b/core/os/keyboard.cpp
@@ -36,6 +36,7 @@ struct _KeyCodeText {
static const _KeyCodeText _keycodes[]={
+ /* clang-format off */
{KEY_ESCAPE ,"Escape"},
{KEY_TAB ,"Tab"},
{KEY_BACKTAB ,"BackTab"},
@@ -281,7 +282,8 @@ static const _KeyCodeText _keycodes[]={
{KEY_DIVISION ,"Division"},
{KEY_YDIAERESIS ,"Ydiaeresis"},
- {0 ,0}
+ {0 ,0}
+ /* clang-format on */
};
bool keycode_has_unicode(uint32_t p_keycode) {
@@ -299,7 +301,8 @@ bool keycode_has_unicode(uint32_t p_keycode) {
case KEY_MEDIAPREVIOUS: case KEY_MEDIANEXT: case KEY_MEDIARECORD: case KEY_HOMEPAGE: case KEY_FAVORITES: case KEY_SEARCH: case KEY_STANDBY:
case KEY_OPENURL: case KEY_LAUNCHMAIL: case KEY_LAUNCHMEDIA: case KEY_LAUNCH0: case KEY_LAUNCH1: case KEY_LAUNCH2: case KEY_LAUNCH3: case KEY_LAUNCH4:
case KEY_LAUNCH5: case KEY_LAUNCH6: case KEY_LAUNCH7: case KEY_LAUNCH8: case KEY_LAUNCH9: case KEY_LAUNCHA: case KEY_LAUNCHB: case KEY_LAUNCHC: case KEY_LAUNCHD:
- case KEY_LAUNCHE: case KEY_LAUNCHF: return false;
+ case KEY_LAUNCHE: case KEY_LAUNCHF:
+ return false;
}
return true;
diff --git a/core/os/mutex.cpp b/core/os/mutex.cpp
index f5f7f757c3..acdcb492d9 100644
--- a/core/os/mutex.cpp
+++ b/core/os/mutex.cpp
@@ -47,7 +47,7 @@ Mutex::~Mutex() {
}
-Mutex *_global_mutex=NULL;;
+Mutex *_global_mutex=NULL;
void _global_lock() {
diff --git a/core/packed_data_container.cpp b/core/packed_data_container.cpp
index 5f3b877822..d3bb03ab5e 100644
--- a/core/packed_data_container.cpp
+++ b/core/packed_data_container.cpp
@@ -27,11 +27,11 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "packed_data_container.h"
+
#include "io/marshalls.h"
#include "core_string_names.h"
-
Variant PackedDataContainer::getvar(const Variant& p_key, bool *r_valid) const {
bool err=false;
diff --git a/core/path_db.cpp b/core/path_db.cpp
index 25f62ed951..679372898c 100644
--- a/core/path_db.cpp
+++ b/core/path_db.cpp
@@ -27,8 +27,8 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "path_db.h"
-#include "print_string.h"
+#include "print_string.h"
uint32_t NodePath::hash() const {
@@ -334,7 +334,7 @@ NodePath::NodePath(const String& p_path) {
StringName property;
Vector<StringName> subpath;
- int absolute=(path[0]=='/')?1:0;;
+ int absolute=(path[0]=='/')?1:0;
bool last_is_slash=true;
int slices=0;
int subpath_pos=path.find(":");
diff --git a/core/path_remap.cpp b/core/path_remap.cpp
index 646c1c497b..ed77fd8840 100644
--- a/core/path_remap.cpp
+++ b/core/path_remap.cpp
@@ -27,9 +27,11 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "path_remap.h"
+
#include "globals.h"
#include "os/os.h"
#include "translation.h"
+
PathRemap* PathRemap::singleton=NULL;
PathRemap* PathRemap::get_singleton() {
diff --git a/core/pool_allocator.cpp b/core/pool_allocator.cpp
index e425218060..b1417dd107 100644
--- a/core/pool_allocator.cpp
+++ b/core/pool_allocator.cpp
@@ -27,12 +27,15 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "pool_allocator.h"
+
#include "error_macros.h"
#include "core/os/os.h"
#include "os/memory.h"
#include "os/copymem.h"
#include "print_string.h"
+
#include <assert.h>
+
#define COMPACT_CHUNK( m_entry , m_to_pos ) \
do { \
void *_dst=&((unsigned char*)pool)[m_to_pos]; \
diff --git a/core/print_string.cpp b/core/print_string.cpp
index 3faed62bb4..36316af619 100644
--- a/core/print_string.cpp
+++ b/core/print_string.cpp
@@ -27,7 +27,9 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "print_string.h"
+
#include "os/os.h"
+
#include <stdio.h>
static PrintHandlerList *print_handler_list=NULL;
diff --git a/core/profile_clock.cpp b/core/profile_clock.cpp
deleted file mode 100644
index 0806275463..0000000000
--- a/core/profile_clock.cpp
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "profile_clock.h"
-
-
diff --git a/core/profile_clock.h b/core/profile_clock.h
deleted file mode 100644
index e254580249..0000000000
--- a/core/profile_clock.h
+++ /dev/null
@@ -1,7 +0,0 @@
-#ifndef PROFILE_CLOCK_H
-#define PROFILE_CLOCK_H
-
-
-
-
-#endif // PROFILE_CLOCK_H
diff --git a/core/ref_ptr.cpp b/core/ref_ptr.cpp
index e781bae496..29ffe974d2 100644
--- a/core/ref_ptr.cpp
+++ b/core/ref_ptr.cpp
@@ -27,6 +27,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "ref_ptr.h"
+
#include "reference.h"
#include "resource.h"
diff --git a/core/reference.cpp b/core/reference.cpp
index 69e053cc1a..d21caf0839 100644
--- a/core/reference.cpp
+++ b/core/reference.cpp
@@ -27,6 +27,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "reference.h"
+
#include "script_language.h"
diff --git a/core/reference.h b/core/reference.h
index ce196801bb..e130b4c2b4 100644
--- a/core/reference.h
+++ b/core/reference.h
@@ -32,7 +32,7 @@
#include "object.h"
#include "safe_refcount.h"
#include "ref_ptr.h"
-#include "object_type_db.h"
+#include "class_db.h"
/**
@author Juan Linietsky <reduzio@gmail.com>
diff --git a/core/register_core_types.cpp b/core/register_core_types.cpp
index 85fa5d27c0..242d36042d 100644
--- a/core/register_core_types.cpp
+++ b/core/register_core_types.cpp
@@ -36,7 +36,7 @@
#include "math/a_star.h"
#include "math/triangle_mesh.h"
#include "globals.h"
-#include "object_type_db.h"
+#include "class_db.h"
#include "geometry.h"
#include "bind/core_bind.h"
#include "core_string_names.h"
diff --git a/core/resource.cpp b/core/resource.cpp
index 3369e4a5a2..4b09a506ff 100644
--- a/core/resource.cpp
+++ b/core/resource.cpp
@@ -27,12 +27,14 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "resource.h"
+
#include "core_string_names.h"
-#include <stdio.h>
#include "os/file_access.h"
#include "io/resource_loader.h"
#include "script_language.h"
+#include <stdio.h>
+
void ResourceImportMetadata::set_editor(const String& p_editor) {
editor=p_editor;
@@ -198,7 +200,7 @@ void Resource::set_path(const String& p_path, bool p_take_over) {
if (path_cache!="") {
ResourceCache::lock->write_lock();
- ResourceCache::resources[path_cache]=this;;
+ ResourceCache::resources[path_cache]=this;
ResourceCache::lock->write_unlock();
}
@@ -532,9 +534,9 @@ void ResourceCache::reload_externals() {
bool ResourceCache::has(const String& p_path) {
- lock->read_lock();;
+ lock->read_lock();
bool b = resources.has(p_path);
- lock->read_unlock();;
+ lock->read_unlock();
return b;
diff --git a/core/resource.h b/core/resource.h
index 284c59e1a8..2b071c8e1c 100644
--- a/core/resource.h
+++ b/core/resource.h
@@ -33,7 +33,7 @@
#include "safe_refcount.h"
#include "ref_ptr.h"
#include "reference.h"
-#include "object_type_db.h"
+#include "class_db.h"
/**
@author Juan Linietsky <reduzio@gmail.com>
diff --git a/core/script_debugger_local.cpp b/core/script_debugger_local.cpp
index a8d77668f5..22aceac4c5 100644
--- a/core/script_debugger_local.cpp
+++ b/core/script_debugger_local.cpp
@@ -27,6 +27,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "script_debugger_local.h"
+
#include "os/os.h"
void ScriptDebuggerLocal::debug(ScriptLanguage *p_script,bool p_can_continue) {
@@ -286,7 +287,7 @@ void ScriptDebuggerLocal::profiling_end() {
for(int i=0;i<ofs;i++) {
print_line(itos(i)+":"+pinfo[i].signature);
- float tt=USEC_TO_SEC(pinfo[i].total_time);;
+ float tt=USEC_TO_SEC(pinfo[i].total_time);
float st=USEC_TO_SEC(pinfo[i].self_time);
print_line("\ttotal_ms: "+rtos(tt)+"\tself_ms: "+rtos(st)+"total%: "+itos(tt*100/total_time)+"\tself%: "+itos(st*100/total_time)+"\tcalls: "+itos(pinfo[i].call_count));
}
diff --git a/core/script_debugger_remote.cpp b/core/script_debugger_remote.cpp
index bb0109467e..62d14c4e5a 100644
--- a/core/script_debugger_remote.cpp
+++ b/core/script_debugger_remote.cpp
@@ -27,10 +27,12 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "script_debugger_remote.h"
+
#include "os/os.h"
#include "io/ip.h"
#include "globals.h"
#include "os/input.h"
+
void ScriptDebuggerRemote::_send_video_memory() {
List<ResourceUsage> usage;
diff --git a/core/set.h b/core/set.h
index 13c2b3a4f6..a921fc661f 100644
--- a/core/set.h
+++ b/core/set.h
@@ -416,7 +416,7 @@ private:
Element *aux=node->parent->left;
if (aux->color==RED) {
_set_color(aux,BLACK);
- _set_color(node->parent,RED);;
+ _set_color(node->parent,RED);
_rotate_right(node->parent);
aux=node->parent->left;
}
diff --git a/core/string_db.cpp b/core/string_db.cpp
index be35a44ed1..004b07b9e5 100644
--- a/core/string_db.cpp
+++ b/core/string_db.cpp
@@ -27,8 +27,10 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "string_db.h"
+
#include "print_string.h"
#include "os/os.h"
+
StaticCString StaticCString::create(const char *p_ptr) {
StaticCString scs; scs.ptr=p_ptr; return scs;
}
diff --git a/core/translation.cpp b/core/translation.cpp
index 5215e5f6d1..d5ec61b8d6 100644
--- a/core/translation.cpp
+++ b/core/translation.cpp
@@ -27,6 +27,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "translation.h"
+
#include "globals.h"
#include "io/resource_loader.h"
#include "os/os.h"
diff --git a/core/typedefs.h b/core/typedefs.h
index 176c77570d..c630887924 100644
--- a/core/typedefs.h
+++ b/core/typedefs.h
@@ -40,41 +40,39 @@
#define _STR(m_x) #m_x
#define _MKSTR(m_x) _STR(m_x)
#endif
-// have to include version.h for this to work, include it in the .cpp not the .h
+
+/**
+ * Version macros - it is necessary to include "version.h" for those to work.
+ * Include it in the .cpp file, not the header.
+ */
#ifdef VERSION_PATCH
-#define VERSION_MKSTRING _MKSTR(VERSION_MAJOR)"." _MKSTR(VERSION_MINOR)"." _MKSTR(VERSION_PATCH)"." _MKSTR(VERSION_STATUS)"." _MKSTR(VERSION_REVISION)
+#define VERSION_MKSTRING "" _MKSTR(VERSION_MAJOR) "." _MKSTR(VERSION_MINOR) "." _MKSTR(VERSION_PATCH) "." _MKSTR(VERSION_STATUS) "." _MKSTR(VERSION_REVISION)
#else
-#define VERSION_MKSTRING _MKSTR(VERSION_MAJOR)"." _MKSTR(VERSION_MINOR)"." _MKSTR(VERSION_STATUS)"." _MKSTR(VERSION_REVISION)
+#define VERSION_MKSTRING "" _MKSTR(VERSION_MAJOR) "." _MKSTR(VERSION_MINOR) "." _MKSTR(VERSION_STATUS) "." _MKSTR(VERSION_REVISION)
#endif // VERSION_PATCH
-#define VERSION_FULL_NAME _MKSTR(VERSION_NAME)" v" VERSION_MKSTRING
+#define VERSION_FULL_NAME "" _MKSTR(VERSION_NAME) " v" VERSION_MKSTRING
#ifndef _ALWAYS_INLINE_
#if defined(__GNUC__) && (__GNUC__ >= 4 )
-# define _ALWAYS_INLINE_ __attribute__((always_inline)) inline
+#define _ALWAYS_INLINE_ __attribute__((always_inline)) inline
#elif defined(__llvm__)
-# define _ALWAYS_INLINE_ __attribute__((always_inline)) inline
+#define _ALWAYS_INLINE_ __attribute__((always_inline)) inline
#elif defined(_MSC_VER)
-# define _ALWAYS_INLINE_ __forceinline
+#define _ALWAYS_INLINE_ __forceinline
#else
-# define _ALWAYS_INLINE_ inline
+#define _ALWAYS_INLINE_ inline
#endif
#endif
#ifndef _FORCE_INLINE_
-
#ifdef DEBUG_ENABLED
-
#define _FORCE_INLINE_ inline
-
#else
-
#define _FORCE_INLINE_ _ALWAYS_INLINE_
-
#endif
-
#endif
@@ -97,16 +95,16 @@ T *_nullptr() { T*t=NULL; return t; }
*/
#ifdef _WIN32
-# undef min // override standard definition
-# undef max // override standard definition
-# undef ERROR // override (really stupid) wingdi.h standard definition
-# undef DELETE // override (another really stupid) winnt.h standard definition
-# undef MessageBox // override winuser.h standard definition
-# undef MIN // override standard definition
-# undef MAX // override standard definition
-# undef CLAMP // override standard definition
-# undef Error
-# undef OK
+#undef min // override standard definition
+#undef max // override standard definition
+#undef ERROR // override (really stupid) wingdi.h standard definition
+#undef DELETE // override (another really stupid) winnt.h standard definition
+#undef MessageBox // override winuser.h standard definition
+#undef MIN // override standard definition
+#undef MAX // override standard definition
+#undef CLAMP // override standard definition
+#undef Error
+#undef OK
#endif
#include "error_macros.h"
@@ -150,30 +148,30 @@ inline void __swap_tmpl(T &x, T &y ) {
#endif //swap
-#define HEX2CHR( m_hex ) ( (m_hex>='0' && m_hex<='9')?(m_hex-'0'):\
- ((m_hex>='A' && m_hex<='F')?(10+m_hex-'A'):\
- ((m_hex>='a' && m_hex<='f')?(10+m_hex-'a'):0)))
+/* clang-format off */
+#define HEX2CHR(m_hex) \
+ ((m_hex >= '0' && m_hex <= '9') ? (m_hex - '0') : \
+ ((m_hex >= 'A' && m_hex <= 'F') ? (10 + m_hex - 'A') : \
+ ((m_hex >= 'a' && m_hex <= 'f') ? (10 + m_hex - 'a') : 0)))
+/* clang-format on */
// Macro to check whether we are compiled by clang
// and we have a specific builtin
#if defined(__llvm__) && defined(__has_builtin)
- #define _llvm_has_builtin(x) __has_builtin(x)
+#define _llvm_has_builtin(x) __has_builtin(x)
#else
- #define _llvm_has_builtin(x) 0
+#define _llvm_has_builtin(x) 0
#endif
#if (defined(__GNUC__) && (__GNUC__ >= 5)) || _llvm_has_builtin(__builtin_mul_overflow)
-# define _mul_overflow __builtin_mul_overflow
+#define _mul_overflow __builtin_mul_overflow
#endif
#if (defined(__GNUC__) && (__GNUC__ >= 5)) || _llvm_has_builtin(__builtin_add_overflow)
-# define _add_overflow __builtin_add_overflow
+#define _add_overflow __builtin_add_overflow
#endif
-
-
-
/** Function to find the nearest (bigger) power of 2 to an integer */
static _FORCE_INLINE_ unsigned int nearest_power_of_2(unsigned int x) {
@@ -276,14 +274,11 @@ struct _GlobalLock {
};
#define GLOBAL_LOCK_FUNCTION _GlobalLock _global_lock_;
-#ifdef NO_SAFE_CAST
+#ifdef NO_SAFE_CAST
#define SAFE_CAST static_cast
-
#else
-
#define SAFE_CAST dynamic_cast
-
#endif
#define MT_SAFE
@@ -291,7 +286,4 @@ struct _GlobalLock {
#define __STRX(m_index) #m_index
#define __STR(m_index) __STRX(m_index)
-
-
#endif /* typedefs.h */
-
diff --git a/core/undo_redo.cpp b/core/undo_redo.cpp
index acb262d400..1a0ccc4a7e 100644
--- a/core/undo_redo.cpp
+++ b/core/undo_redo.cpp
@@ -27,6 +27,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "undo_redo.h"
+
#include "os/os.h"
void UndoRedo::_discard_redo() {
diff --git a/core/ustring.cpp b/core/ustring.cpp
index 66608379be..71934b2955 100644
--- a/core/ustring.cpp
+++ b/core/ustring.cpp
@@ -26,8 +26,8 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#include <wchar.h>
#include "ustring.h"
+
#include "os/memory.h"
#include "print_string.h"
#include "math_funcs.h"
@@ -36,10 +36,8 @@
#include "ucaps.h"
#include "color.h"
#include "variant.h"
-#define MAX_DIGITS 6
-#define UPPERCASE(m_c) (((m_c)>='a' && (m_c)<='z')?((m_c)-('a'-'A')):(m_c))
-#define LOWERCASE(m_c) (((m_c)>='A' && (m_c)<='Z')?((m_c)+('a'-'A')):(m_c))
+#include <wchar.h>
#ifndef NO_USE_STDLIB
#include <stdlib.h>
@@ -50,6 +48,10 @@
#define snprintf _snprintf
#endif
+#define MAX_DIGITS 6
+#define UPPERCASE(m_c) (((m_c)>='a' && (m_c)<='z')?((m_c)-('a'-'A')):(m_c))
+#define LOWERCASE(m_c) (((m_c)>='A' && (m_c)<='Z')?((m_c)+('a'-'A')):(m_c))
+
/** STRING **/
const char *CharString::get_data() const {
@@ -1255,7 +1257,7 @@ _FORCE_INLINE static int parse_utf8_char(const char *p_utf8,unsigned int *p_ucs4
unichar=*p_utf8;
else {
- unichar=(0xFF >> (len +1)) & *p_utf8;;
+ unichar=(0xFF >> (len +1)) & *p_utf8;
for (int i=1;i<len;i++) {
@@ -1404,7 +1406,7 @@ bool String::parse_utf8(const char* p_utf8,int p_len) {
unichar=*p_utf8;
else {
- unichar=(0xFF >> (len +1)) & *p_utf8;;
+ unichar=(0xFF >> (len +1)) & *p_utf8;
for (int i=1;i<len;i++) {
diff --git a/core/variant.cpp b/core/variant.cpp
index 5a670a2786..103c8f6746 100644
--- a/core/variant.cpp
+++ b/core/variant.cpp
@@ -27,6 +27,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "variant.h"
+
#include "resource.h"
#include "print_string.h"
#include "scene/main/node.h"
@@ -1764,7 +1765,7 @@ Variant::operator Transform() const {
if (type==TRANSFORM2D) {
return *_data._transform2d;
} else if (type==TRANSFORM) {
- const Transform& t = *_data._transform;;
+ const Transform& t = *_data._transform;
Transform2D m;
m.elements[0][0]=t.basis.elements[0][0];
m.elements[0][1]=t.basis.elements[1][0];
diff --git a/core/variant.h b/core/variant.h
index 9d29fd64c3..5936325c1b 100644
--- a/core/variant.h
+++ b/core/variant.h
@@ -33,7 +33,7 @@
@author Juan Linietsky <reduzio@gmail.com>
*/
-#include "aabb.h"
+#include "rect3.h"
#include "ustring.h"
#include "vector3.h"
#include "plane.h"
diff --git a/core/variant_call.cpp b/core/variant_call.cpp
index 51ad115d46..022faede1e 100644
--- a/core/variant_call.cpp
+++ b/core/variant_call.cpp
@@ -27,6 +27,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "variant.h"
+
#include "object.h"
#include "os/os.h"
#include "core_string_names.h"
@@ -1052,32 +1053,32 @@ Variant Variant::construct(const Variant::Type p_type, const Variant** p_args, i
// math types
- case VECTOR2: return Vector2(); // 5
+ case VECTOR2: return Vector2(); // 5
case RECT2: return Rect2();
case VECTOR3: return Vector3();
case TRANSFORM2D: return Transform2D();
case PLANE: return Plane();
case QUAT: return Quat();
- case RECT3: return Rect3(); //sorry naming convention fail :( not like it's used often // 10
+ case RECT3: return Rect3(); // 10
case BASIS: return Basis();
case TRANSFORM: return Transform();
// misc types
case COLOR: return Color();
- case IMAGE: return Image();;
- case NODE_PATH: return NodePath();; // 15
- case _RID: return RID();;
+ case IMAGE: return Image();
+ case NODE_PATH: return NodePath(); // 15
+ case _RID: return RID();
case OBJECT: return (Object*)NULL;
- case INPUT_EVENT: return InputEvent();;
- case DICTIONARY: return Dictionary();;
- case ARRAY: return Array();; // 20
- case POOL_BYTE_ARRAY: return PoolByteArray();;
- case POOL_INT_ARRAY: return PoolIntArray();;
- case POOL_REAL_ARRAY: return PoolRealArray();;
- case POOL_STRING_ARRAY: return PoolStringArray();;
- case POOL_VECTOR2_ARRAY: return PoolVector2Array();; // 25
- case POOL_VECTOR3_ARRAY: return PoolVector3Array();; // 25
- case POOL_COLOR_ARRAY: return PoolColorArray();;
+ case INPUT_EVENT: return InputEvent();
+ case DICTIONARY: return Dictionary();
+ case ARRAY: return Array(); // 20
+ case POOL_BYTE_ARRAY: return PoolByteArray();
+ case POOL_INT_ARRAY: return PoolIntArray();
+ case POOL_REAL_ARRAY: return PoolRealArray();
+ case POOL_STRING_ARRAY: return PoolStringArray();
+ case POOL_VECTOR2_ARRAY: return PoolVector2Array(); // 25
+ case POOL_VECTOR3_ARRAY: return PoolVector3Array();
+ case POOL_COLOR_ARRAY: return PoolColorArray();
default: return Variant();
}
@@ -1126,27 +1127,27 @@ Variant Variant::construct(const Variant::Type p_type, const Variant** p_args, i
case VECTOR3: return (Vector3(*p_args[0]));
case PLANE: return (Plane(*p_args[0]));
case QUAT: return (Quat(*p_args[0]));
- case RECT3: return (Rect3(*p_args[0])); //sorry naming convention fail :( not like it's used often // 10
+ case RECT3: return (Rect3(*p_args[0])); // 10
case BASIS: return (Basis(p_args[0]->operator Basis()));
case TRANSFORM: return (Transform(p_args[0]->operator Transform()));
// misc types
case COLOR: return p_args[0]->type == Variant::STRING ? Color::html(*p_args[0]) : Color::hex(*p_args[0]);
case IMAGE: return (Image(*p_args[0]));
- case NODE_PATH: return (NodePath(p_args[0]->operator NodePath())); // 15
+ case NODE_PATH: return (NodePath(p_args[0]->operator NodePath())); // 15
case _RID: return (RID(*p_args[0]));
case OBJECT: return ((Object*)(p_args[0]->operator Object *()));
case INPUT_EVENT: return (InputEvent(*p_args[0]));
case DICTIONARY: return p_args[0]->operator Dictionary();
- case ARRAY: return p_args[0]->operator Array();
+ case ARRAY: return p_args[0]->operator Array(); // 20
// arrays
case POOL_BYTE_ARRAY: return (PoolByteArray(*p_args[0]));
case POOL_INT_ARRAY: return (PoolIntArray(*p_args[0]));
case POOL_REAL_ARRAY: return (PoolRealArray(*p_args[0]));
case POOL_STRING_ARRAY: return (PoolStringArray(*p_args[0]));
- case POOL_VECTOR2_ARRAY: return (PoolVector2Array(*p_args[0])); // 25
- case POOL_VECTOR3_ARRAY: return (PoolVector3Array(*p_args[0])); // 25
+ case POOL_VECTOR2_ARRAY: return (PoolVector2Array(*p_args[0])); // 25
+ case POOL_VECTOR3_ARRAY: return (PoolVector3Array(*p_args[0]));
case POOL_COLOR_ARRAY: return (PoolColorArray(*p_args[0]));
default: return Variant();
}
diff --git a/core/variant_construct_string.cpp b/core/variant_construct_string.cpp
index 8db756aa79..56aa9891fb 100644
--- a/core/variant_construct_string.cpp
+++ b/core/variant_construct_string.cpp
@@ -169,7 +169,7 @@ Error VariantConstruct::_get_token(const CharType *p_str, int &idx, int p_len, T
case 'r': res=13; break;
case '\"': res='\"'; break;
case '\\': res='\\'; break;
- case '/': res='/'; break; //wtf
+ case '/': res='/'; break;
case 'u': {
//hexnumbarh - oct is deprecated
diff --git a/core/variant_op.cpp b/core/variant_op.cpp
index 50f0b96715..6ed8a3dd85 100644
--- a/core/variant_op.cpp
+++ b/core/variant_op.cpp
@@ -27,9 +27,11 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "variant.h"
+
#include "object.h"
#include "script_language.h"
#include "core_string_names.h"
+
Variant::operator bool() const {
bool b;
diff --git a/core/variant_parser.cpp b/core/variant_parser.cpp
index ca748b7fd3..a833a275df 100644
--- a/core/variant_parser.cpp
+++ b/core/variant_parser.cpp
@@ -27,11 +27,11 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "variant_parser.h"
+
#include "io/resource_loader.h"
#include "os/keyboard.h"
-
CharType VariantParser::StreamFile::get_char() {
return f->get_8();
@@ -1989,7 +1989,7 @@ Error VariantWriter::write(const Variant& p_variant, StoreStringFunc p_store_str
PoolVector<uint8_t> data = img.get_data();
int len = data.size();
PoolVector<uint8_t>::Read r = data.read();
- const uint8_t *ptr=r.ptr();;
+ const uint8_t *ptr=r.ptr();
for (int i=0;i<len;i++) {
if (i>0)
@@ -2133,7 +2133,7 @@ Error VariantWriter::write(const Variant& p_variant, StoreStringFunc p_store_str
PoolVector<uint8_t> data = p_variant;
int len = data.size();
PoolVector<uint8_t>::Read r = data.read();
- const uint8_t *ptr=r.ptr();;
+ const uint8_t *ptr=r.ptr();
for (int i=0;i<len;i++) {
if (i>0)
@@ -2152,7 +2152,7 @@ Error VariantWriter::write(const Variant& p_variant, StoreStringFunc p_store_str
PoolVector<int> data = p_variant;
int len = data.size();
PoolVector<int>::Read r = data.read();
- const int *ptr=r.ptr();;
+ const int *ptr=r.ptr();
for (int i=0;i<len;i++) {
@@ -2172,7 +2172,7 @@ Error VariantWriter::write(const Variant& p_variant, StoreStringFunc p_store_str
PoolVector<real_t> data = p_variant;
int len = data.size();
PoolVector<real_t>::Read r = data.read();
- const real_t *ptr=r.ptr();;
+ const real_t *ptr=r.ptr();
for (int i=0;i<len;i++) {
@@ -2190,7 +2190,7 @@ Error VariantWriter::write(const Variant& p_variant, StoreStringFunc p_store_str
PoolVector<String> data = p_variant;
int len = data.size();
PoolVector<String>::Read r = data.read();
- const String *ptr=r.ptr();;
+ const String *ptr=r.ptr();
String s;
//write_string("\n");
@@ -2213,7 +2213,7 @@ Error VariantWriter::write(const Variant& p_variant, StoreStringFunc p_store_str
PoolVector<Vector2> data = p_variant;
int len = data.size();
PoolVector<Vector2>::Read r = data.read();
- const Vector2 *ptr=r.ptr();;
+ const Vector2 *ptr=r.ptr();
for (int i=0;i<len;i++) {
@@ -2231,7 +2231,7 @@ Error VariantWriter::write(const Variant& p_variant, StoreStringFunc p_store_str
PoolVector<Vector3> data = p_variant;
int len = data.size();
PoolVector<Vector3>::Read r = data.read();
- const Vector3 *ptr=r.ptr();;
+ const Vector3 *ptr=r.ptr();
for (int i=0;i<len;i++) {
@@ -2250,7 +2250,7 @@ Error VariantWriter::write(const Variant& p_variant, StoreStringFunc p_store_str
PoolVector<Color> data = p_variant;
int len = data.size();
PoolVector<Color>::Read r = data.read();
- const Color *ptr=r.ptr();;
+ const Color *ptr=r.ptr();
for (int i=0;i<len;i++) {