diff options
Diffstat (limited to 'core')
58 files changed, 737 insertions, 479 deletions
diff --git a/core/bind/core_bind.cpp b/core/bind/core_bind.cpp index 8f1c1779b..657f527a5 100644 --- a/core/bind/core_bind.cpp +++ b/core/bind/core_bind.cpp @@ -340,24 +340,6 @@ Array _OS::get_fullscreen_mode_list(int p_screen) const { return vmarr; } -void _OS::set_iterations_per_second(int p_ips) { - - OS::get_singleton()->set_iterations_per_second(p_ips); -} -int _OS::get_iterations_per_second() const { - - return OS::get_singleton()->get_iterations_per_second(); - -} - -void _OS::set_target_fps(int p_fps) { - OS::get_singleton()->set_target_fps(p_fps); -} - -float _OS::get_target_fps() const { - return OS::get_singleton()->get_target_fps(); -} - void _OS::set_low_processor_usage_mode(bool p_enabled) { OS::get_singleton()->set_low_processor_usage_mode(p_enabled); @@ -449,22 +431,10 @@ String _OS::get_latin_keyboard_variant() const { String _OS::get_model_name() const { - return OS::get_singleton()->get_model_name(); + return OS::get_singleton()->get_model_name(); } -MainLoop *_OS::get_main_loop() const { - return OS::get_singleton()->get_main_loop(); -} - -void _OS::set_time_scale(float p_scale) { - OS::get_singleton()->set_time_scale(p_scale); -} - -float _OS::get_time_scale() { - - return OS::get_singleton()->get_time_scale(); -} bool _OS::is_ok_left_and_cancel_right() const { @@ -804,10 +774,6 @@ bool _OS::can_draw() const { return OS::get_singleton()->can_draw(); } -int _OS::get_frames_drawn() { - - return OS::get_singleton()->get_frames_drawn(); -} int _OS::get_processor_count() const { @@ -936,11 +902,6 @@ String _OS::get_data_dir() const { return OS::get_singleton()->get_data_dir(); }; -float _OS::get_frames_per_second() const { - - return OS::get_singleton()->get_frames_per_second(); -} - Error _OS::native_video_play(String p_path, float p_volume, String p_audio_track, String p_subtitle_track) { return OS::get_singleton()->native_video_play(p_path, p_volume, p_audio_track, p_subtitle_track); @@ -1005,10 +966,7 @@ String _OS::get_system_dir(SystemDir p_dir) const { return OS::get_singleton()->get_system_dir(OS::SystemDir(p_dir)); } -String _OS::get_custom_level() const { - return OS::get_singleton()->get_custom_level(); -} String _OS::get_scancode_string(uint32_t p_code) const { @@ -1028,11 +986,6 @@ void _OS::alert(const String& p_alert,const String& p_title) { OS::get_singleton()->alert(p_alert,p_title); } -Dictionary _OS::get_engine_version() const { - - return OS::get_singleton()->get_engine_version(); -} - _OS *_OS::singleton=NULL; void _OS::_bind_methods() { @@ -1043,11 +996,12 @@ void _OS::_bind_methods() { ClassDB::bind_method(_MD("set_clipboard","clipboard"),&_OS::set_clipboard); ClassDB::bind_method(_MD("get_clipboard"),&_OS::get_clipboard); - ClassDB::bind_method(_MD("set_video_mode","size","fullscreen","resizable","screen"),&_OS::set_video_mode,DEFVAL(0)); - ClassDB::bind_method(_MD("get_video_mode_size","screen"),&_OS::get_video_mode,DEFVAL(0)); - ClassDB::bind_method(_MD("is_video_mode_fullscreen","screen"),&_OS::is_video_mode_fullscreen,DEFVAL(0)); - ClassDB::bind_method(_MD("is_video_mode_resizable","screen"),&_OS::is_video_mode_resizable,DEFVAL(0)); - ClassDB::bind_method(_MD("get_fullscreen_mode_list","screen"),&_OS::get_fullscreen_mode_list,DEFVAL(0)); + //will not delete for now, just unexpose + //ClassDB::bind_method(_MD("set_video_mode","size","fullscreen","resizable","screen"),&_OS::set_video_mode,DEFVAL(0)); + //ClassDB::bind_method(_MD("get_video_mode_size","screen"),&_OS::get_video_mode,DEFVAL(0)); + //ClassDB::bind_method(_MD("is_video_mode_fullscreen","screen"),&_OS::is_video_mode_fullscreen,DEFVAL(0)); + //ClassDB::bind_method(_MD("is_video_mode_resizable","screen"),&_OS::is_video_mode_resizable,DEFVAL(0)); + //ClassDB::bind_method(_MD("get_fullscreen_mode_list","screen"),&_OS::get_fullscreen_mode_list,DEFVAL(0)); ClassDB::bind_method(_MD("get_screen_count"),&_OS::get_screen_count); @@ -1079,13 +1033,6 @@ void _OS::_bind_methods() { ClassDB::bind_method(_MD("set_keep_screen_on","enabled"),&_OS::set_keep_screen_on); ClassDB::bind_method(_MD("is_keep_screen_on"),&_OS::is_keep_screen_on); - ClassDB::bind_method(_MD("set_iterations_per_second","iterations_per_second"),&_OS::set_iterations_per_second); - ClassDB::bind_method(_MD("get_iterations_per_second"),&_OS::get_iterations_per_second); - ClassDB::bind_method(_MD("set_target_fps","target_fps"),&_OS::set_target_fps); - ClassDB::bind_method(_MD("get_target_fps"),&_OS::get_target_fps); - - ClassDB::bind_method(_MD("set_time_scale","time_scale"),&_OS::set_time_scale); - ClassDB::bind_method(_MD("get_time_scale"),&_OS::get_time_scale); ClassDB::bind_method(_MD("has_touchscreen_ui_hint"),&_OS::has_touchscreen_ui_hint); @@ -1107,7 +1054,6 @@ void _OS::_bind_methods() { ClassDB::bind_method(_MD("get_name"),&_OS::get_name); ClassDB::bind_method(_MD("get_cmdline_args"),&_OS::get_cmdline_args); - ClassDB::bind_method(_MD("get_main_loop"),&_OS::get_main_loop); ClassDB::bind_method(_MD("get_datetime","utc"),&_OS::get_datetime,DEFVAL(false)); ClassDB::bind_method(_MD("get_date","utc"),&_OS::get_date,DEFVAL(false)); @@ -1133,10 +1079,8 @@ void _OS::_bind_methods() { ClassDB::bind_method(_MD("get_latin_keyboard_variant"),&_OS::get_latin_keyboard_variant); ClassDB::bind_method(_MD("get_model_name"),&_OS::get_model_name); - ClassDB::bind_method(_MD("get_custom_level"),&_OS::get_custom_level); ClassDB::bind_method(_MD("can_draw"),&_OS::can_draw); - ClassDB::bind_method(_MD("get_frames_drawn"),&_OS::get_frames_drawn); ClassDB::bind_method(_MD("is_stdout_verbose"),&_OS::is_stdout_verbose); ClassDB::bind_method(_MD("can_use_threads"),&_OS::can_use_threads); @@ -1163,7 +1107,6 @@ void _OS::_bind_methods() { ClassDB::bind_method(_MD("is_ok_left_and_cancel_right"),&_OS::is_ok_left_and_cancel_right); - ClassDB::bind_method(_MD("get_frames_per_second"),&_OS::get_frames_per_second); ClassDB::bind_method(_MD("print_all_textures_by_size"),&_OS::print_all_textures_by_size); ClassDB::bind_method(_MD("print_resources_by_type","types"),&_OS::print_resources_by_type); @@ -1187,8 +1130,6 @@ void _OS::_bind_methods() { ClassDB::bind_method(_MD("set_use_vsync","enable"),&_OS::set_use_vsync); ClassDB::bind_method(_MD("is_vsync_enabled"),&_OS::is_vsync_enabled); - ClassDB::bind_method(_MD("get_engine_version"),&_OS::get_engine_version); - BIND_CONSTANT( DAY_SUNDAY ); BIND_CONSTANT( DAY_MONDAY ); BIND_CONSTANT( DAY_TUESDAY ); @@ -1890,9 +1831,9 @@ Error _Directory::open(const String& p_path) { return OK; } -bool _Directory::list_dir_begin() { +Error _Directory::list_dir_begin() { - ERR_FAIL_COND_V(!d,false); + ERR_FAIL_COND_V(!d,ERR_UNCONFIGURED); return d->list_dir_begin(); } @@ -1923,6 +1864,10 @@ String _Directory::get_drive(int p_drive){ ERR_FAIL_COND_V(!d,""); return d->get_drive(p_drive); } +int _Directory::get_current_drive() { + ERR_FAIL_COND_V(!d,0); + return d->get_current_drive(); +} Error _Directory::change_dir(String p_dir){ @@ -2031,13 +1976,14 @@ void _Directory::_bind_methods() { ClassDB::bind_method(_MD("list_dir_end"),&_Directory::list_dir_end); ClassDB::bind_method(_MD("get_drive_count"),&_Directory::get_drive_count); ClassDB::bind_method(_MD("get_drive","idx"),&_Directory::get_drive); + ClassDB::bind_method(_MD("get_current_drive"),&_Directory::get_current_drive); ClassDB::bind_method(_MD("change_dir:Error","todir"),&_Directory::change_dir); ClassDB::bind_method(_MD("get_current_dir"),&_Directory::get_current_dir); ClassDB::bind_method(_MD("make_dir:Error","path"),&_Directory::make_dir); ClassDB::bind_method(_MD("make_dir_recursive:Error","path"),&_Directory::make_dir_recursive); ClassDB::bind_method(_MD("file_exists","path"),&_Directory::file_exists); ClassDB::bind_method(_MD("dir_exists","path"),&_Directory::dir_exists); -// ClassDB::bind_method(_MD("get_modified_time","file"),&_Directory::get_modified_time); + //ClassDB::bind_method(_MD("get_modified_time","file"),&_Directory::get_modified_time); ClassDB::bind_method(_MD("get_space_left"),&_Directory::get_space_left); ClassDB::bind_method(_MD("copy:Error","from","to"),&_Directory::copy); ClassDB::bind_method(_MD("rename:Error","from","to"),&_Directory::rename); @@ -2567,22 +2513,22 @@ void _ClassDB::_bind_methods() { ClassDB::bind_method(_MD("can_instance","class"),&_ClassDB::can_instance); ClassDB::bind_method(_MD("instance","class"),&_ClassDB::instance); - ClassDB::bind_method(_MD("has_signal","class","signal"),&_ClassDB::has_signal); - ClassDB::bind_method(_MD("get_signal","class","signal"),&_ClassDB::get_signal); - ClassDB::bind_method(_MD("get_signal_list","class","no_inheritance"),&_ClassDB::get_signal_list,DEFVAL(false)); + ClassDB::bind_method(_MD("class_has_signal","class","signal"),&_ClassDB::has_signal); + ClassDB::bind_method(_MD("class_get_signal","class","signal"),&_ClassDB::get_signal); + ClassDB::bind_method(_MD("class_get_signal_list","class","no_inheritance"),&_ClassDB::get_signal_list,DEFVAL(false)); - ClassDB::bind_method(_MD("get_property_list","class","no_inheritance"),&_ClassDB::get_property_list,DEFVAL(false)); + ClassDB::bind_method(_MD("class_get_property_list","class","no_inheritance"),&_ClassDB::get_property_list,DEFVAL(false)); - ClassDB::bind_method(_MD("has_method","class","method","no_inheritance"),&_ClassDB::has_method,DEFVAL(false)); + ClassDB::bind_method(_MD("class_has_method","class","method","no_inheritance"),&_ClassDB::has_method,DEFVAL(false)); - ClassDB::bind_method(_MD("get_method_list","class","no_inheritance"),&_ClassDB::get_method_list,DEFVAL(false)); + ClassDB::bind_method(_MD("class_get_method_list","class","no_inheritance"),&_ClassDB::get_method_list,DEFVAL(false)); - ClassDB::bind_method(_MD("get_integer_constant_list","class","no_inheritance"),&_ClassDB::get_integer_constant_list,DEFVAL(false)); + ClassDB::bind_method(_MD("class_get_integer_constant_list","class","no_inheritance"),&_ClassDB::get_integer_constant_list,DEFVAL(false)); - ClassDB::bind_method(_MD("has_integer_constant","class","name"),&_ClassDB::has_integer_constant); - ClassDB::bind_method(_MD("get_integer_constant","class","name"),&_ClassDB::get_integer_constant); + ClassDB::bind_method(_MD("class_has_integer_constant","class","name"),&_ClassDB::has_integer_constant); + ClassDB::bind_method(_MD("class_get_integer_constant","class","name"),&_ClassDB::get_integer_constant); - ClassDB::bind_method(_MD("get_category","class"),&_ClassDB::get_category); + ClassDB::bind_method(_MD("class_get_category","class"),&_ClassDB::get_category); ClassDB::bind_method(_MD("is_class_enabled","class"),&_ClassDB::is_class_enabled); @@ -2596,3 +2542,88 @@ _ClassDB::~_ClassDB(){ } +/////////////////////////////// + + +void _Engine::set_iterations_per_second(int p_ips) { + + Engine::get_singleton()->set_iterations_per_second(p_ips); +} +int _Engine::get_iterations_per_second() const { + + return Engine::get_singleton()->get_iterations_per_second(); + +} + +void _Engine::set_target_fps(int p_fps) { + Engine::get_singleton()->set_target_fps(p_fps); +} + +float _Engine::get_target_fps() const { + return Engine::get_singleton()->get_target_fps(); +} + + + +float _Engine::get_frames_per_second() const { + + return Engine::get_singleton()->get_frames_per_second(); +} + +String _Engine::get_custom_level() const { + + return Engine::get_singleton()->get_custom_level(); +} + +void _Engine::set_time_scale(float p_scale) { + Engine::get_singleton()->set_time_scale(p_scale); +} + +float _Engine::get_time_scale() { + + return Engine::get_singleton()->get_time_scale(); +} + +int _Engine::get_frames_drawn() { + + return Engine::get_singleton()->get_frames_drawn(); +} + +MainLoop *_Engine::get_main_loop() const { + + //needs to remain in OS, since it's actually OS that interacts with it, but it's better exposed here + return OS::get_singleton()->get_main_loop(); +} + +Dictionary _Engine::get_version_info() const { + + return Engine::get_singleton()->get_version_info(); +} + + +void _Engine::_bind_methods() { + + ClassDB::bind_method(_MD("set_iterations_per_second","iterations_per_second"),&_Engine::set_iterations_per_second); + ClassDB::bind_method(_MD("get_iterations_per_second"),&_Engine::get_iterations_per_second); + ClassDB::bind_method(_MD("set_target_fps","target_fps"),&_Engine::set_target_fps); + ClassDB::bind_method(_MD("get_target_fps"),&_Engine::get_target_fps); + + ClassDB::bind_method(_MD("set_time_scale","time_scale"),&_Engine::set_time_scale); + ClassDB::bind_method(_MD("get_time_scale"),&_Engine::get_time_scale); + + ClassDB::bind_method(_MD("get_custom_level"),&_Engine::get_custom_level); + + ClassDB::bind_method(_MD("get_frames_drawn"),&_Engine::get_frames_drawn); + ClassDB::bind_method(_MD("get_frames_per_second"),&_Engine::get_frames_per_second); + + ClassDB::bind_method(_MD("get_main_loop:MainLoop"),&_Engine::get_main_loop); + + ClassDB::bind_method(_MD("get_version_info"),&_Engine::get_version_info); + +} + +_Engine *_Engine::singleton = NULL; + +_Engine::_Engine() { + singleton=this; +} diff --git a/core/bind/core_bind.h b/core/bind/core_bind.h index d491483d8..f10714720 100644 --- a/core/bind/core_bind.h +++ b/core/bind/core_bind.h @@ -169,12 +169,6 @@ public: void native_video_unpause(); void native_video_stop(); - void set_iterations_per_second(int p_ips); - int get_iterations_per_second() const; - - void set_target_fps(int p_fps); - float get_target_fps() const; - void set_low_processor_usage_mode(bool p_enabled); bool is_in_low_processor_usage_mode() const; @@ -196,11 +190,7 @@ public: String get_latin_keyboard_variant() const; String get_model_name() const; - MainLoop *get_main_loop() const; - String get_custom_level() const; - - float get_frames_per_second() const; void dump_memory_to_file(const String& p_file); void dump_resources_to_file(const String& p_file); @@ -271,8 +261,6 @@ public: bool can_draw() const; - int get_frames_drawn(); - bool is_stdout_verbose() const; int get_processor_count() const; @@ -313,8 +301,6 @@ public: void set_keep_screen_on(bool p_enabled); bool is_keep_screen_on() const; - void set_time_scale(float p_scale); - float get_time_scale(); bool is_ok_left_and_cancel_right() const; @@ -323,8 +309,6 @@ public: void set_use_vsync(bool p_enable); bool is_vsync_enabled() const; - Dictionary get_engine_version() const; - static _OS *get_singleton() { return singleton; } _OS(); @@ -472,7 +456,7 @@ public: Error open(const String& p_path); - bool list_dir_begin(); ///< This starts dir listing + Error list_dir_begin(); ///< This starts dir listing String get_next(); bool current_is_dir() const; @@ -480,6 +464,7 @@ public: int get_drive_count(); String get_drive(int p_drive); + int get_current_drive(); Error change_dir(String p_dir); ///< can be relative or absolute, return false on success String get_current_dir(); ///< return current dir location @@ -632,4 +617,39 @@ public: ~_ClassDB(); }; + +class _Engine : public Object { + GDCLASS(_Engine,Object); + +protected: + + static void _bind_methods(); + static _Engine *singleton; + +public: + + static _Engine* get_singleton() { return singleton; } + void set_iterations_per_second(int p_ips); + int get_iterations_per_second() const; + + void set_target_fps(int p_fps); + float get_target_fps() const; + + float get_frames_per_second() const; + + int get_frames_drawn(); + + void set_time_scale(float p_scale); + float get_time_scale(); + + String get_custom_level() const; + + MainLoop *get_main_loop() const; + + Dictionary get_version_info() const; + + _Engine(); +}; + + #endif // CORE_BIND_H diff --git a/core/compressed_translation.cpp b/core/compressed_translation.cpp index 71f810422..1e3a51fed 100644 --- a/core/compressed_translation.cpp +++ b/core/compressed_translation.cpp @@ -467,7 +467,7 @@ StringName PHashTranslation::get_message(const StringName& p_src_text) const { //print_line("Hash: "+itos(p)); if (p==0xFFFFFFFF) { -// print_line("GETMSG: Nothing!"); + //print_line("GETMSG: Nothing!"); return StringName(); //nothing } @@ -489,7 +489,7 @@ StringName PHashTranslation::get_message(const StringName& p_src_text) const { //print_line("bucket pos: "+itos(idx)); if (idx==-1) { -// print_line("GETMSG: Not in Bucket!"); + //print_line("GETMSG: Not in Bucket!"); return StringName(); } @@ -497,8 +497,8 @@ StringName PHashTranslation::get_message(const StringName& p_src_text) const { String rstr; rstr.parse_utf8(&sptr[ bucket.elem[idx].str_offset ], bucket.elem[idx].uncomp_size ); -// print_line("Uncompressed, size: "+itos(bucket.elem[idx].comp_size)); -// print_line("Return: "+rstr); + //print_line("Uncompressed, size: "+itos(bucket.elem[idx].comp_size)); + //print_line("Return: "+rstr); return rstr; } else { @@ -508,8 +508,8 @@ StringName PHashTranslation::get_message(const StringName& p_src_text) const { smaz_decompress(&sptr[ bucket.elem[idx].str_offset ], bucket.elem[idx].comp_size,uncomp.ptr(),bucket.elem[idx].uncomp_size ); String rstr; rstr.parse_utf8(uncomp.get_data()); -// print_line("Compressed, size: "+itos(bucket.elem[idx].comp_size)); -// print_line("Return: "+rstr); + //print_line("Compressed, size: "+itos(bucket.elem[idx].comp_size)); + //print_line("Return: "+rstr); return rstr; } diff --git a/core/engine.cpp b/core/engine.cpp new file mode 100644 index 000000000..eb6d8a347 --- /dev/null +++ b/core/engine.cpp @@ -0,0 +1,118 @@ +/*************************************************************************/ +/* engine.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 "engine.h" +#include "version.h" + +void Engine::set_iterations_per_second(int p_ips) { + + ips=p_ips; +} +int Engine::get_iterations_per_second() const { + + return ips; +} + +void Engine::set_target_fps(int p_fps) { + _target_fps=p_fps>0? p_fps : 0; +} + +float Engine::get_target_fps() const { + return _target_fps; +} + +uint64_t Engine::get_frames_drawn() { + + return frames_drawn; +} + +void Engine::set_frame_delay(uint32_t p_msec) { + + _frame_delay=p_msec; +} + +uint32_t Engine::get_frame_delay() const { + + return _frame_delay; +} + +void Engine::set_time_scale(float p_scale) { + + _time_scale=p_scale; +} + +float Engine::get_time_scale() const { + + return _time_scale; +} + +Dictionary Engine::get_version_info() const { + + Dictionary dict; + dict["major"] = VERSION_MAJOR; + dict["minor"] = VERSION_MINOR; + #ifdef VERSION_PATCH + dict["patch"] = VERSION_PATCH; + #else + dict["patch"] = 0; + #endif + dict["status"] = _MKSTR(VERSION_STATUS); + dict["revision"] = _MKSTR(VERSION_REVISION); + dict["year"] = VERSION_YEAR; + + String stringver = String(dict["major"]) + "." + String(dict["minor"]); + if ((int)dict["patch"] != 0) + stringver += "." + String(dict["patch"]); + stringver += "-" + String(dict["status"]) + " (" + String(dict["revision"]) + ")"; + dict["string"] = stringver; + + return dict; +} + + +Engine *Engine::singleton=NULL; + +Engine *Engine::get_singleton() { + return singleton; +} + +Engine::Engine() +{ + + singleton=this; + frames_drawn=0; + ips=60; + _frame_delay=0; + _fps=1; + _target_fps=0; + _time_scale=1.0; + _pixel_snap=false; + _fixed_frames=0; + _idle_frames=0; + _in_fixed=false; +} diff --git a/core/engine.h b/core/engine.h new file mode 100644 index 000000000..9af4219a6 --- /dev/null +++ b/core/engine.h @@ -0,0 +1,88 @@ +/*************************************************************************/ +/* engine.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 ENGINE_H +#define ENGINE_H + +#include "ustring.h" +#include "list.h" +#include "vector.h" +#include "os/main_loop.h" + +class Engine { + +friend class Main; + + String _custom_level; + uint64_t frames_drawn; + uint32_t _frame_delay; + + int ips; + float _fps; + int _target_fps; + float _time_scale; + bool _pixel_snap; + uint64_t _fixed_frames; + uint64_t _idle_frames; + bool _in_fixed; + + static Engine *singleton; +public: + + static Engine *get_singleton(); + + virtual void set_iterations_per_second(int p_ips); + virtual int get_iterations_per_second() const; + + virtual void set_target_fps(int p_fps); + virtual float get_target_fps() const; + + virtual float get_frames_per_second() const { return _fps; } + + String get_custom_level() const { return _custom_level; } + + uint64_t get_frames_drawn(); + + uint64_t get_fixed_frames() const { return _fixed_frames; } + uint64_t get_idle_frames() const { return _idle_frames; } + bool is_in_fixed_frame() const { return _in_fixed; } + + void set_time_scale(float p_scale); + float get_time_scale() const; + + void set_frame_delay(uint32_t p_msec); + uint32_t get_frame_delay() const; + + _FORCE_INLINE_ bool get_use_pixel_snap() const { return _pixel_snap; } + + Dictionary get_version_info() const; + + Engine(); +}; + +#endif // ENGINE_H diff --git a/core/globals.cpp b/core/globals.cpp index 28fabac30..a4c24a6cc 100644 --- a/core/globals.cpp +++ b/core/globals.cpp @@ -329,7 +329,7 @@ Error GlobalConfig::setup(const String& p_path,const String & p_main_pack) { String candidate = d->get_current_dir(); String current_dir = d->get_current_dir(); - String exec_name = OS::get_singleton()->get_executable_path().get_file().basename(); + String exec_name = OS::get_singleton()->get_executable_path().get_file().get_basename(); bool found = false; bool first_time=true; @@ -1011,7 +1011,7 @@ GlobalConfig::GlobalConfig() { GLOBAL_DEF("input/ui_page_down",va); input_presets.push_back("input/ui_page_down"); -// GLOBAL_DEF("display/handheld/orientation", "landscape"); + //GLOBAL_DEF("display/handheld/orientation", "landscape"); custom_prop_info["display/handheld/orientation"]=PropertyInfo(Variant::STRING,"display/handheld/orientation",PROPERTY_HINT_ENUM,"landscape,portrait,reverse_landscape,reverse_portrait,sensor_landscape,sensor_portrait,sensor"); diff --git a/core/hash_map.h b/core/hash_map.h index fba12b55e..0d5520693 100644 --- a/core/hash_map.h +++ b/core/hash_map.h @@ -61,7 +61,7 @@ public: static _FORCE_INLINE_ uint32_t hash(const uint8_t p_int) { return p_int; } static _FORCE_INLINE_ uint32_t hash(const int8_t p_int) { return (uint32_t)p_int; } static _FORCE_INLINE_ uint32_t hash(const wchar_t p_wchar) { return (uint32_t)p_wchar; } -// static _FORCE_INLINE_ uint32_t hash(const void* p_ptr) { return uint32_t(uint64_t(p_ptr))*(0x9e3779b1L); } + //static _FORCE_INLINE_ uint32_t hash(const void* p_ptr) { return uint32_t(uint64_t(p_ptr))*(0x9e3779b1L); } }; /** diff --git a/core/image.cpp b/core/image.cpp index 174c840c2..d769e6a0b 100644 --- a/core/image.cpp +++ b/core/image.cpp @@ -363,7 +363,7 @@ void Image::convert( Format p_new_format ){ Image new_img(width,height,0,p_new_format); -// int len=data.size(); + //int len=data.size(); PoolVector<uint8_t>::Read r = data.read(); PoolVector<uint8_t>::Write w = new_img.data.write(); @@ -414,7 +414,7 @@ void Image::convert( Format p_new_format ){ bool gen_mipmaps=mipmaps; -// mipmaps=false; + //mipmaps=false; *this=new_img; @@ -1240,7 +1240,7 @@ void Image::create( const char ** p_xpm ) { uint8_t col_r; uint8_t col_g; uint8_t col_b; -// uint8_t col_a=255; + //uint8_t col_a=255; for (int i=0;i<6;i++) { diff --git a/core/input_map.cpp b/core/input_map.cpp index 0379131dd..bcae630c7 100644 --- a/core/input_map.cpp +++ b/core/input_map.cpp @@ -324,7 +324,7 @@ void InputMap::load_default() { key.key.scancode=KEY_PAGEDOWN; action_add_event("ui_page_down",key); -// set("display/handheld/orientation", "landscape"); + //set("display/handheld/orientation", "landscape"); } diff --git a/core/io/file_access_buffered_fa.h b/core/io/file_access_buffered_fa.h index 884d40a26..000c2b45f 100644 --- a/core/io/file_access_buffered_fa.h +++ b/core/io/file_access_buffered_fa.h @@ -127,10 +127,11 @@ public: set_error(OK); }; -// static void make_default() { - - //FileAccess::create_func = FileAccessBufferedFA<T>::create; -// }; + /* + static void make_default() { + FileAccess::create_func = FileAccessBufferedFA<T>::create; + }; + */ virtual uint64_t _get_modified_time(const String& p_file) { diff --git a/core/io/file_access_memory.cpp b/core/io/file_access_memory.cpp index a9dbf56c1..32eb00322 100644 --- a/core/io/file_access_memory.cpp +++ b/core/io/file_access_memory.cpp @@ -68,7 +68,7 @@ FileAccess* FileAccessMemory::create() { bool FileAccessMemory::file_exists(const String& p_name) { String name = fix_path(p_name); -// name = DirAccess::normalize_path(name); + //name = DirAccess::normalize_path(name); return files && (files->find(name) != NULL); } @@ -87,7 +87,7 @@ Error FileAccessMemory::_open(const String& p_path, int p_mode_flags) { ERR_FAIL_COND_V(!files, ERR_FILE_NOT_FOUND); String name = fix_path(p_path); -// name = DirAccess::normalize_path(name); + //name = DirAccess::normalize_path(name); Map<String, Vector<uint8_t> >::Element* E = files->find(name); ERR_FAIL_COND_V(!E, ERR_FILE_NOT_FOUND); diff --git a/core/io/file_access_network.cpp b/core/io/file_access_network.cpp index 19076b57b..7bf750f6e 100644 --- a/core/io/file_access_network.cpp +++ b/core/io/file_access_network.cpp @@ -206,7 +206,7 @@ Error FileAccessNetworkClient::connect(const String& p_host,int p_port,const Str } DEBUG_PRINT("IP: "+String(ip)+" port "+itos(p_port)); - Error err = client->connect(ip,p_port); + Error err = client->connect_to_host(ip,p_port); ERR_FAIL_COND_V(err,err); while(client->get_status()==StreamPeerTCP::STATUS_CONNECTING) { //DEBUG_PRINT("trying to connect...."); @@ -325,7 +325,7 @@ Error FileAccessNetwork::_open(const String& p_path, int p_mode_flags) { last_page=-1; last_page_buff=NULL; -// buffers.clear(); + //buffers.clear(); nc->unlock_mutex(); DEBUG_PRINT("OPEN POST"); DEBUG_TIME("open_post"); @@ -437,7 +437,7 @@ int FileAccessNetwork::get_buffer(uint8_t *p_dst, int p_length) const{ p_length=total_size-pos; } -// FileAccessNetworkClient *nc = FileAccessNetworkClient::singleton; + //FileAccessNetworkClient *nc = FileAccessNetworkClient::singleton; uint8_t *buff=last_page_buff; diff --git a/core/io/file_access_pack.cpp b/core/io/file_access_pack.cpp index 7e3a6d1fa..d63539a7a 100644 --- a/core/io/file_access_pack.cpp +++ b/core/io/file_access_pack.cpp @@ -340,7 +340,7 @@ FileAccessPack::~FileAccessPack() { ////////////////////////////////////////////////////////////////////////////////// -bool DirAccessPack::list_dir_begin() { +Error DirAccessPack::list_dir_begin() { list_dirs.clear(); @@ -356,7 +356,7 @@ bool DirAccessPack::list_dir_begin() { list_files.push_back(E->get()); } - return true; + return OK; } String DirAccessPack::get_next(){ diff --git a/core/io/file_access_pack.h b/core/io/file_access_pack.h index 83340a662..0a1320e57 100644 --- a/core/io/file_access_pack.h +++ b/core/io/file_access_pack.h @@ -209,7 +209,7 @@ class DirAccessPack : public DirAccess { public: - virtual bool list_dir_begin(); + virtual Error list_dir_begin(); virtual String get_next(); virtual bool current_is_dir() const; virtual bool current_is_hidden() const; diff --git a/core/io/file_access_zip.cpp b/core/io/file_access_zip.cpp index c4439f259..87f07cb7b 100644 --- a/core/io/file_access_zip.cpp +++ b/core/io/file_access_zip.cpp @@ -165,7 +165,7 @@ unzFile ZipArchive::get_file_handle(String p_file) const { bool ZipArchive::try_open_pack(const String& p_name) { //printf("opening zip pack %ls, %i, %i\n", p_name.c_str(), p_name.extension().nocasecmp_to("zip"), p_name.extension().nocasecmp_to("pcz")); - if (p_name.extension().nocasecmp_to("zip") != 0 && p_name.extension().nocasecmp_to("pcz") != 0) + if (p_name.get_extension().nocasecmp_to("zip") != 0 && p_name.get_extension().nocasecmp_to("pcz") != 0) return false; zlib_filefunc_def io; diff --git a/core/io/http_client.cpp b/core/io/http_client.cpp index 5e57f55f8..63c8abbba 100644 --- a/core/io/http_client.cpp +++ b/core/io/http_client.cpp @@ -33,7 +33,7 @@ void HTTPClient::set_ip_type(IP::Type p_type) { ip_type = p_type; } -Error HTTPClient::connect(const String &p_host, int p_port, bool p_ssl,bool p_verify_host){ +Error HTTPClient::connect_to_host(const String &p_host, int p_port, bool p_ssl,bool p_verify_host){ close(); tcp_connection->set_ip_type(ip_type); @@ -57,7 +57,7 @@ Error HTTPClient::connect(const String &p_host, int p_port, bool p_ssl,bool p_ve if (conn_host.is_valid_ip_address()) { //is ip - Error err = tcp_connection->connect(IP_Address(conn_host),p_port); + Error err = tcp_connection->connect_to_host(IP_Address(conn_host),p_port); if (err) { status=STATUS_CANT_CONNECT; return err; @@ -232,7 +232,7 @@ Error HTTPClient::get_response_headers(List<String> *r_response) { void HTTPClient::close(){ if (tcp_connection->get_status()!=StreamPeerTCP::STATUS_NONE) - tcp_connection->disconnect(); + tcp_connection->disconnect_from_host(); connection.unref(); status=STATUS_DISCONNECTED; @@ -267,7 +267,7 @@ Error HTTPClient::poll(){ case IP::RESOLVER_STATUS_DONE: { IP_Address host = IP::get_singleton()->get_resolve_item_address(resolving); - Error err = tcp_connection->connect(host,conn_port); + Error err = tcp_connection->connect_to_host(host,conn_port); IP::get_singleton()->erase_resolve_item(resolving); resolving=IP::RESOLVER_INVALID_ID; if (err) { @@ -300,7 +300,7 @@ Error HTTPClient::poll(){ case StreamPeerTCP::STATUS_CONNECTED: { if (ssl) { Ref<StreamPeerSSL> ssl = StreamPeerSSL::create(); - Error err = ssl->connect(tcp_connection,true,ssl_verify_host?conn_host:String()); + Error err = ssl->connect_to_stream(tcp_connection,true,ssl_verify_host?conn_host:String()); if (err!=OK) { close(); status=STATUS_SSL_HANDSHAKE_ERROR; @@ -640,7 +640,7 @@ Error HTTPClient::_get_http_data(uint8_t* p_buffer, int p_bytes,int &r_received) void HTTPClient::_bind_methods() { ClassDB::bind_method(_MD("set_ip_type","ip_type"),&HTTPClient::set_ip_type); - ClassDB::bind_method(_MD("connect:Error","host","port","use_ssl","verify_host"),&HTTPClient::connect,DEFVAL(false),DEFVAL(true)); + ClassDB::bind_method(_MD("connect_to_host:Error","host","port","use_ssl","verify_host"),&HTTPClient::connect_to_host,DEFVAL(false),DEFVAL(true)); ClassDB::bind_method(_MD("set_connection","connection:StreamPeer"),&HTTPClient::set_connection); ClassDB::bind_method(_MD("get_connection:StreamPeer"),&HTTPClient::get_connection); ClassDB::bind_method(_MD("request_raw","method","url","headers","body"),&HTTPClient::request_raw); diff --git a/core/io/http_client.h b/core/io/http_client.h index c6f96db1d..496d22530 100644 --- a/core/io/http_client.h +++ b/core/io/http_client.h @@ -167,7 +167,7 @@ public: void set_ip_type(IP::Type p_type); //Error connect_and_get(const String& p_url,bool p_verify_host=true); //connects to a full url and perform request - Error connect(const String &p_host,int p_port,bool p_ssl=false,bool p_verify_host=true); + Error connect_to_host(const String &p_host,int p_port,bool p_ssl=false,bool p_verify_host=true); void set_connection(const Ref<StreamPeer>& p_connection); Ref<StreamPeer> get_connection() const; diff --git a/core/io/image_loader.cpp b/core/io/image_loader.cpp index d4d10e212..2b01e865f 100644 --- a/core/io/image_loader.cpp +++ b/core/io/image_loader.cpp @@ -36,7 +36,7 @@ bool ImageFormatLoader::recognize(const String& p_extension) const { get_recognized_extensions(&extensions); for (List<String>::Element *E=extensions.front();E;E=E->next()) { - if (E->get().nocasecmp_to(p_extension.extension())==0) + if (E->get().nocasecmp_to(p_extension.get_extension())==0) return true; } @@ -56,7 +56,7 @@ Error ImageLoader::load_image(String p_file,Image *p_image, FileAccess *p_custom } } - String extension = p_file.extension(); + String extension = p_file.get_extension(); for (int i=0;i<loader_count;i++) { diff --git a/core/io/packet_peer_udp.cpp b/core/io/packet_peer_udp.cpp index 91d1fc5f9..9fec807bf 100644 --- a/core/io/packet_peer_udp.cpp +++ b/core/io/packet_peer_udp.cpp @@ -36,7 +36,7 @@ String PacketPeerUDP::_get_packet_ip() const { return get_packet_address(); } -Error PacketPeerUDP::_set_send_address(const String& p_address, int p_port) { +Error PacketPeerUDP::_set_dest_address(const String& p_address, int p_port) { IP_Address ip; if (p_address.is_valid_ip_address()) { @@ -47,7 +47,7 @@ Error PacketPeerUDP::_set_send_address(const String& p_address, int p_port) { return ERR_CANT_RESOLVE; } - set_send_address(ip,p_port); + set_dest_address(ip,p_port); return OK; } @@ -66,7 +66,7 @@ void PacketPeerUDP::_bind_methods() { ClassDB::bind_method(_MD("get_packet_ip"),&PacketPeerUDP::_get_packet_ip); //ClassDB::bind_method(_MD("get_packet_address"),&PacketPeerUDP::_get_packet_address); ClassDB::bind_method(_MD("get_packet_port"),&PacketPeerUDP::get_packet_port); - ClassDB::bind_method(_MD("set_send_address","host","port"),&PacketPeerUDP::_set_send_address); + ClassDB::bind_method(_MD("set_dest_address","host","port"),&PacketPeerUDP::_set_dest_address); } diff --git a/core/io/packet_peer_udp.h b/core/io/packet_peer_udp.h index 17a2817f3..17952b4ac 100644 --- a/core/io/packet_peer_udp.h +++ b/core/io/packet_peer_udp.h @@ -45,7 +45,7 @@ protected: String _get_packet_ip() const; - virtual Error _set_send_address(const String& p_address,int p_port); + virtual Error _set_dest_address(const String& p_address,int p_port); public: @@ -56,7 +56,7 @@ public: virtual bool is_listening() const=0; virtual IP_Address get_packet_address() const=0; virtual int get_packet_port() const=0; - virtual void set_send_address(const IP_Address& p_address,int p_port)=0; + virtual void set_dest_address(const IP_Address& p_address,int p_port)=0; static Ref<PacketPeerUDP> create_ref(); diff --git a/core/io/resource_format_binary.cpp b/core/io/resource_format_binary.cpp index c093b087b..4af350343 100644 --- a/core/io/resource_format_binary.cpp +++ b/core/io/resource_format_binary.cpp @@ -1059,7 +1059,7 @@ Ref<ResourceInteractiveLoader> ResourceFormatLoaderBinary::load_interactive(cons Ref<ResourceInteractiveLoaderBinary> ria = memnew( ResourceInteractiveLoaderBinary ); ria->local_path=GlobalConfig::get_singleton()->localize_path(p_path); ria->res_path=ria->local_path; -// ria->set_local_path( Globals::get_singleton()->localize_path(p_path) ); + //ria->set_local_path( Globals::get_singleton()->localize_path(p_path) ); ria->open(f); @@ -1114,7 +1114,7 @@ Error ResourceFormatLoaderBinary::load_import_metadata(const String &p_path, Ref Ref<ResourceInteractiveLoaderBinary> ria = memnew( ResourceInteractiveLoaderBinary ); ria->local_path=GlobalConfig::get_singleton()->localize_path(p_path); ria->res_path=ria->local_path; -// ria->set_local_path( Globals::get_singleton()->localize_path(p_path) ); + //ria->set_local_path( Globals::get_singleton()->localize_path(p_path) ); ria->recognize(f); if(ria->error!=OK) return ERR_FILE_UNRECOGNIZED; @@ -1159,14 +1159,14 @@ void ResourceFormatLoaderBinary::get_dependencies(const String& p_path,List<Stri Ref<ResourceInteractiveLoaderBinary> ria = memnew( ResourceInteractiveLoaderBinary ); ria->local_path=GlobalConfig::get_singleton()->localize_path(p_path); ria->res_path=ria->local_path; -// ria->set_local_path( Globals::get_singleton()->localize_path(p_path) ); + //ria->set_local_path( Globals::get_singleton()->localize_path(p_path) ); ria->get_dependencies(f,p_dependencies,p_add_types); } Error ResourceFormatLoaderBinary::rename_dependencies(const String &p_path,const Map<String,String>& p_map) { -// Error error=OK; + //Error error=OK; FileAccess *f=FileAccess::open(p_path,FileAccess::READ); @@ -1250,7 +1250,7 @@ Error ResourceFormatLoaderBinary::rename_dependencies(const String &p_path,const ria->local_path=GlobalConfig::get_singleton()->localize_path(p_path); ria->res_path=ria->local_path; ria->remaps=p_map; - // ria->set_local_path( Globals::get_singleton()->localize_path(p_path) ); + //ria->set_local_path( Globals::get_singleton()->localize_path(p_path) ); ria->open(f); err = ria->poll(); @@ -1384,7 +1384,7 @@ String ResourceFormatLoaderBinary::get_resource_type(const String &p_path) const Ref<ResourceInteractiveLoaderBinary> ria = memnew( ResourceInteractiveLoaderBinary ); ria->local_path=GlobalConfig::get_singleton()->localize_path(p_path); ria->res_path=ria->local_path; -// ria->set_local_path( Globals::get_singleton()->localize_path(p_path) ); + //ria->set_local_path( Globals::get_singleton()->localize_path(p_path) ); String r = ria->recognize(f); return r; @@ -1708,8 +1708,10 @@ void ResourceFormatSaverBinaryInstance::write_variant(const Variant& p_property, for(List<Variant>::Element *E=keys.front();E;E=E->next()) { - //if (!_check_type(dict[E->get()])) - // continue; + /* + if (!_check_type(dict[E->get()])) + continue; + */ write_variant(E->get()); write_variant(d[E->get()]); @@ -2150,7 +2152,7 @@ Error ResourceFormatSaverBinaryInstance::save(const String &p_path,const RES& p_ } Vector<uint64_t> ofs_table; -// int saved_idx=0; + //int saved_idx=0; //now actually save the resources for(List<ResourceData>::Element *E=resources.front();E;E=E->next()) { diff --git a/core/io/resource_loader.cpp b/core/io/resource_loader.cpp index cc3c8ce00..354efaa83 100644 --- a/core/io/resource_loader.cpp +++ b/core/io/resource_loader.cpp @@ -55,7 +55,7 @@ bool ResourceFormatLoader::recognize(const String& p_extension) const { get_recognized_extensions(&extensions); for (List<String>::Element *E=extensions.front();E;E=E->next()) { - if (E->get().nocasecmp_to(p_extension.extension())==0) + if (E->get().nocasecmp_to(p_extension.get_extension())==0) return true; } @@ -182,7 +182,7 @@ RES ResourceLoader::load(const String &p_path, const String& p_type_hint, bool p if (OS::get_singleton()->is_stdout_verbose()) print_line("load resource: "+remapped_path); - String extension=remapped_path.extension(); + String extension=remapped_path.get_extension(); bool found=false; for (int i=0;i<loader_count;i++) { @@ -230,7 +230,7 @@ Ref<ResourceImportMetadata> ResourceLoader::load_import_metadata(const String &p else local_path = GlobalConfig::get_singleton()->localize_path(p_path); - String extension=p_path.extension(); + String extension=p_path.get_extension(); Ref<ResourceImportMetadata> ret; for (int i=0;i<loader_count;i++) { @@ -331,7 +331,7 @@ Ref<ResourceInteractiveLoader> ResourceLoader::load_interactive(const String &p_ String remapped_path = PathRemap::get_singleton()->get_remap(local_path); - String extension=remapped_path.extension(); + String extension=remapped_path.get_extension(); bool found=false; for (int i=0;i<loader_count;i++) { @@ -385,14 +385,16 @@ void ResourceLoader::get_dependencies(const String& p_path, List<String> *p_depe String remapped_path = PathRemap::get_singleton()->get_remap(local_path); - String extension=remapped_path.extension(); + String extension=remapped_path.get_extension(); for (int i=0;i<loader_count;i++) { if (!loader[i]->recognize(extension)) continue; - //if (p_type_hint!="" && !loader[i]->handles_type(p_type_hint)) - // continue; + /* + if (p_type_hint!="" && !loader[i]->handles_type(p_type_hint)) + continue; + */ loader[i]->get_dependencies(remapped_path,p_dependencies,p_add_types); @@ -410,14 +412,16 @@ Error ResourceLoader::rename_dependencies(const String &p_path,const Map<String, String remapped_path = PathRemap::get_singleton()->get_remap(local_path); - String extension=remapped_path.extension(); + String extension=remapped_path.get_extension(); for (int i=0;i<loader_count;i++) { if (!loader[i]->recognize(extension)) continue; - //if (p_type_hint!="" && !loader[i]->handles_type(p_type_hint)) - // continue; + /* + if (p_type_hint!="" && !loader[i]->handles_type(p_type_hint)) + continue; + */ return loader[i]->rename_dependencies(p_path,p_map); @@ -449,7 +453,7 @@ String ResourceLoader::get_resource_type(const String &p_path) { local_path = GlobalConfig::get_singleton()->localize_path(p_path); String remapped_path = PathRemap::get_singleton()->get_remap(local_path); - String extension=remapped_path.extension(); + String extension=remapped_path.get_extension(); for (int i=0;i<loader_count;i++) { diff --git a/core/io/resource_saver.cpp b/core/io/resource_saver.cpp index 9081adaa8..222d3e6bc 100644 --- a/core/io/resource_saver.cpp +++ b/core/io/resource_saver.cpp @@ -40,7 +40,7 @@ ResourceSavedCallback ResourceSaver::save_callback=0; Error ResourceSaver::save(const String &p_path,const RES& p_resource,uint32_t p_flags) { - String extension=p_path.extension(); + String extension=p_path.get_extension(); Error err=ERR_FILE_UNRECOGNIZED; for (int i=0;i<saver_count;i++) { @@ -54,7 +54,7 @@ Error ResourceSaver::save(const String &p_path,const RES& p_resource,uint32_t p_ for (List<String>::Element *E=extensions.front();E;E=E->next()) { - if (E->get().nocasecmp_to(extension.extension())==0) + if (E->get().nocasecmp_to(extension.get_extension())==0) recognized=true; } diff --git a/core/io/stream_peer_ssl.cpp b/core/io/stream_peer_ssl.cpp index aab42a298..fc535e94b 100644 --- a/core/io/stream_peer_ssl.cpp +++ b/core/io/stream_peer_ssl.cpp @@ -57,10 +57,10 @@ bool StreamPeerSSL::is_available() { void StreamPeerSSL::_bind_methods() { - ClassDB::bind_method(_MD("accept:Error","stream:StreamPeer"),&StreamPeerSSL::accept); - ClassDB::bind_method(_MD("connect:Error","stream:StreamPeer","validate_certs","for_hostname"),&StreamPeerSSL::connect,DEFVAL(false),DEFVAL(String())); + ClassDB::bind_method(_MD("accept_stream:Error","stream:StreamPeer"),&StreamPeerSSL::accept_stream); + ClassDB::bind_method(_MD("connect_to_stream:Error","stream:StreamPeer","validate_certs","for_hostname"),&StreamPeerSSL::connect_to_stream,DEFVAL(false),DEFVAL(String())); ClassDB::bind_method(_MD("get_status"),&StreamPeerSSL::get_status); - ClassDB::bind_method(_MD("disconnect"),&StreamPeerSSL::disconnect); + ClassDB::bind_method(_MD("disconnect_from_stream"),&StreamPeerSSL::disconnect_from_stream); BIND_CONSTANT( STATUS_DISCONNECTED ); BIND_CONSTANT( STATUS_CONNECTED ); BIND_CONSTANT( STATUS_ERROR_NO_CERTIFICATE ); diff --git a/core/io/stream_peer_ssl.h b/core/io/stream_peer_ssl.h index 8675433a3..9aafac874 100644 --- a/core/io/stream_peer_ssl.h +++ b/core/io/stream_peer_ssl.h @@ -57,11 +57,11 @@ public: STATUS_ERROR_HOSTNAME_MISMATCH }; - virtual Error accept(Ref<StreamPeer> p_base)=0; - virtual Error connect(Ref<StreamPeer> p_base,bool p_validate_certs=false,const String& p_for_hostname=String())=0; + virtual Error accept_stream(Ref<StreamPeer> p_base)=0; + virtual Error connect_to_stream(Ref<StreamPeer> p_base,bool p_validate_certs=false,const String& p_for_hostname=String())=0; virtual Status get_status() const=0; - virtual void disconnect()=0; + virtual void disconnect_from_stream()=0; static StreamPeerSSL* create(); diff --git a/core/io/stream_peer_tcp.cpp b/core/io/stream_peer_tcp.cpp index 2218057cf..0a59c3299 100644 --- a/core/io/stream_peer_tcp.cpp +++ b/core/io/stream_peer_tcp.cpp @@ -41,24 +41,24 @@ Error StreamPeerTCP::_connect(const String& p_address,int p_port) { return ERR_CANT_RESOLVE; } - connect(ip,p_port); + connect_to_host(ip,p_port); return OK; } void StreamPeerTCP::set_ip_type(IP::Type p_type) { - disconnect(); + disconnect_from_host(); ip_type = p_type; } void StreamPeerTCP::_bind_methods() { ClassDB::bind_method(_MD("set_ip_type","ip_type"),&StreamPeerTCP::set_ip_type); - ClassDB::bind_method(_MD("connect","host","port"),&StreamPeerTCP::_connect); - ClassDB::bind_method(_MD("is_connected"),&StreamPeerTCP::is_connected); + ClassDB::bind_method(_MD("connect_to_host","host","port"),&StreamPeerTCP::_connect); + ClassDB::bind_method(_MD("is_connected_to_host"),&StreamPeerTCP::is_connected_to_host); ClassDB::bind_method(_MD("get_status"),&StreamPeerTCP::get_status); ClassDB::bind_method(_MD("get_connected_host"),&StreamPeerTCP::get_connected_host); ClassDB::bind_method(_MD("get_connected_port"),&StreamPeerTCP::get_connected_port); - ClassDB::bind_method(_MD("disconnect"),&StreamPeerTCP::disconnect); + ClassDB::bind_method(_MD("disconnect_from_host"),&StreamPeerTCP::disconnect_from_host); BIND_CONSTANT( STATUS_NONE ); BIND_CONSTANT( STATUS_CONNECTING ); diff --git a/core/io/stream_peer_tcp.h b/core/io/stream_peer_tcp.h index 8f6dfaf3f..2b25f3173 100644 --- a/core/io/stream_peer_tcp.h +++ b/core/io/stream_peer_tcp.h @@ -60,13 +60,13 @@ protected: public: virtual void set_ip_type(IP::Type p_type); - virtual Error connect(const IP_Address& p_host, uint16_t p_port)=0; + virtual Error connect_to_host(const IP_Address& p_host, uint16_t p_port)=0; //read/write from streampeer - virtual bool is_connected() const=0; + virtual bool is_connected_to_host() const=0; virtual Status get_status() const=0; - virtual void disconnect()=0; + virtual void disconnect_from_host()=0; virtual IP_Address get_connected_host() const=0; virtual uint16_t get_connected_port() const=0; virtual void set_nodelay(bool p_enabled)=0; diff --git a/core/io/translation_loader_po.cpp b/core/io/translation_loader_po.cpp index 8c4c1c818..bee38e037 100644 --- a/core/io/translation_loader_po.cpp +++ b/core/io/translation_loader_po.cpp @@ -204,7 +204,7 @@ bool TranslationLoaderPO::handles_type(const String& p_type) const{ String TranslationLoaderPO::get_resource_type(const String &p_path) const { - if (p_path.extension().to_lower()=="po") + if (p_path.get_extension().to_lower()=="po") return "Translation"; return ""; } diff --git a/core/io/zip.c b/core/io/zip.c index 44c79195d..27a3d3cdc 100644 --- a/core/io/zip.c +++ b/core/io/zip.c @@ -855,7 +855,7 @@ extern zipFile ZEXPORT zipOpen3 (const void *pathname, int append, zipcharpc* gl ziinit.z_filefunc.zseek32_file = NULL; ziinit.z_filefunc.ztell32_file = NULL; if (pzlib_filefunc64_32_def==NULL) { -// fill_fopen64_filefunc(&ziinit.z_filefunc.zfile_func64); + //fill_fopen64_filefunc(&ziinit.z_filefunc.zfile_func64); } else ziinit.z_filefunc = *pzlib_filefunc64_32_def; diff --git a/core/map.h b/core/map.h index af35fec33..944838916 100644 --- a/core/map.h +++ b/core/map.h @@ -149,7 +149,7 @@ private: #ifdef GLOBALNIL_DISABLED memdelete_allocator<Element,A>(_nil); #endif -// memdelete_allocator<Element,A>(_root); + //memdelete_allocator<Element,A>(_root); } }; diff --git a/core/math/bsp_tree.cpp b/core/math/bsp_tree.cpp index b888b6b56..e2526f513 100644 --- a/core/math/bsp_tree.cpp +++ b/core/math/bsp_tree.cpp @@ -390,8 +390,10 @@ static int _bsp_create_node(const Face3 *p_faces,const Vector<int>& p_indices,Ve const Face3& f=p_faces[ indices[i] ]; - //if (f.get_plane().is_almost_like(divisor_plane)) - // continue; + /* + if (f.get_plane().is_almost_like(divisor_plane)) + continue; + */ int over_count=0; int under_count=0; @@ -546,7 +548,7 @@ BSP_Tree::BSP_Tree(const Variant& p_variant) { error_radius = d["error"]; aabb = d["aabb"]; -// int node_count = src_nodes.size(); + //int node_count = src_nodes.size(); nodes.resize(src_nodes.size()/3); PoolVector<int>::Read r = src_nodes.read(); diff --git a/core/math/geometry.h b/core/math/geometry.h index 9800e5513..d5b3a3068 100644 --- a/core/math/geometry.h +++ b/core/math/geometry.h @@ -750,9 +750,7 @@ public: return Vector<Vector3>(); //empty } -// long count = 0; long previous = polygon.size() - 1; - Vector<Vector3> clipped; for (int index = 0; index < polygon.size(); index++) { diff --git a/core/math/math_2d.h b/core/math/math_2d.h index 7896299c2..a24c4266e 100644 --- a/core/math/math_2d.h +++ b/core/math/math_2d.h @@ -154,7 +154,7 @@ struct Vector2 { Vector2 floor() const; Vector2 snapped(const Vector2& p_by) const; - real_t get_aspect() const { return width/height; } + real_t aspect() const { return width/height; } operator String() const { return String::num(x)+", "+String::num(y); } diff --git a/core/math/math_funcs.cpp b/core/math/math_funcs.cpp index db1c52ccb..8353aa0eb 100644 --- a/core/math/math_funcs.cpp +++ b/core/math/math_funcs.cpp @@ -29,7 +29,7 @@ #include "math_funcs.h" #include "core/os/os.h" -#include <math.h> + #include "float.h" uint32_t Math::default_seed=1; @@ -69,48 +69,6 @@ double Math::randf() { return (double)rand() / (double)Math::RANDOM_MAX; } -double Math::sin(double p_x) { - - return ::sin(p_x); - -} - -double Math::cos(double p_x) { - - return ::cos(p_x); - -} - -double Math::tan(double p_x) { - - return ::tan(p_x); - -} -double Math::sinh(double p_x) { - - return ::sinh(p_x); -} - -double Math::cosh(double p_x) { - - return ::cosh(p_x); -} - -double Math::tanh(double p_x) { - - return ::tanh(p_x); -} - - -double Math::deg2rad(double p_y) { - - return p_y*Math_PI/180.0; -} - -double Math::rad2deg(double p_y) { - - return p_y*180.0/Math_PI; -} double Math::round(double p_val) { @@ -122,22 +80,6 @@ double Math::round(double p_val) { } } -double Math::asin(double p_x) { - - return ::asin(p_x); - -} - -double Math::acos(double p_x) { - - return ::acos(p_x); -} - -double Math::atan(double p_x) { - - return ::atan(p_x); -} - double Math::dectime(double p_value,double p_amount, double p_step) { float sgn = p_value < 0 ? -1.0 : 1.0; @@ -148,42 +90,6 @@ double Math::dectime(double p_value,double p_amount, double p_step) { return val*sgn; } -double Math::atan2(double p_y, double p_x) { - - return ::atan2(p_y,p_x); - -} -double Math::sqrt(double p_x) { - - return ::sqrt(p_x); -} - -double Math::fmod(double p_x,double p_y) { - - return ::fmod(p_x,p_y); -} - -double Math::fposmod(double p_x,double p_y) { - - if (p_x>=0) { - - return Math::fmod(p_x,p_y); - - } else { - - return p_y-Math::fmod(-p_x,p_y); - } - -} -double Math::floor(double p_x) { - - return ::floor(p_x); -} - -double Math::ceil(double p_x) { - - return ::ceil(p_x); -} int Math::step_decimals(double p_step) { @@ -244,20 +150,7 @@ double Math::stepify(double p_value,double p_step) { return p_value; } -bool Math::is_nan(double p_val) { - - return (p_val!=p_val); -} - -bool Math::is_inf(double p_val) { - -#ifdef _MSC_VER - return !_finite(p_val); -#else - return isinf(p_val); -#endif -} uint32_t Math::larger_prime(uint32_t p_val) { diff --git a/core/math/math_funcs.h b/core/math/math_funcs.h index 24081528f..8ce59224f 100644 --- a/core/math/math_funcs.h +++ b/core/math/math_funcs.h @@ -33,38 +33,125 @@ #include "math_defs.h" #ifndef NO_MATH_H -#include "math.h" +#include <math.h> #endif +#define Math_PI 3.14159265358979323846 +#define Math_SQRT12 0.7071067811865475244008443621048490 + class Math { static uint32_t default_seed; public: - Math() {}; // useless to instance + Math() {} // useless to instance enum { RANDOM_MAX=2147483647L }; - static double sin(double p_x); - static double cos(double p_x); - static double tan(double p_x); - static double sinh(double p_x); - static double cosh(double p_x); - static double tanh(double p_x); - static double asin(double p_x); - static double acos(double p_x); - static double atan(double p_x); - static double atan2(double p_y, double p_x); - static double deg2rad(double p_y); - static double rad2deg(double p_y); - static double sqrt(double p_x); - static double fmod(double p_x,double p_y); - static double fposmod(double p_x,double p_y); + + static _ALWAYS_INLINE_ double sin(double p_x) { + + return ::sin(p_x); + + } + + static _ALWAYS_INLINE_ double cos(double p_x) { + + return ::cos(p_x); + + } + + static _ALWAYS_INLINE_ double tan(double p_x) { + + return ::tan(p_x); + + } + static _ALWAYS_INLINE_ double sinh(double p_x) { + + return ::sinh(p_x); + } + + static _ALWAYS_INLINE_ double cosh(double p_x) { + + return ::cosh(p_x); + } + + static _ALWAYS_INLINE_ double tanh(double p_x) { + + return ::tanh(p_x); + } + + + static _ALWAYS_INLINE_ double asin(double p_x) { + + return ::asin(p_x); + + } + + static _ALWAYS_INLINE_ double acos(double p_x) { + + return ::acos(p_x); + } + + static _ALWAYS_INLINE_ double atan(double p_x) { + + return ::atan(p_x); + } + + static _ALWAYS_INLINE_ double atan2(double p_y, double p_x) { + + return ::atan2(p_y,p_x); + + } + + static _ALWAYS_INLINE_ double deg2rad(double p_y) { + + return p_y*Math_PI/180.0; + } + + static _ALWAYS_INLINE_ double rad2deg(double p_y) { + + return p_y*180.0/Math_PI; + } + + + static _ALWAYS_INLINE_ double sqrt(double p_x) { + + return ::sqrt(p_x); + } + + static _ALWAYS_INLINE_ double fmod(double p_x,double p_y) { + + return ::fmod(p_x,p_y); + } + + static _ALWAYS_INLINE_ double fposmod(double p_x,double p_y) { + + if (p_x>=0) { + + return fmod(p_x,p_y); + + } else { + + return p_y-fmod(-p_x,p_y); + } + + } + static _ALWAYS_INLINE_ double floor(double p_x) { + + return ::floor(p_x); + } + + static _ALWAYS_INLINE_ double ceil(double p_x) { + + return ::ceil(p_x); + } + + static uint32_t rand_from_seed(uint32_t *seed); - static double floor(double p_x); - static double ceil(double p_x); + 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); @@ -84,10 +171,20 @@ public: return Math::exp( p_db * 0.11512925464970228420089957273422 ); } - static bool is_nan(double p_val); - static bool is_inf(double p_val); + static _ALWAYS_INLINE_ bool is_nan(double p_val) { + + return (p_val!=p_val); + } + static _ALWAYS_INLINE_ bool is_inf(double p_val) { + #ifdef _MSC_VER + return !_finite(p_val); + #else + return isinf(p_val); + #endif + + } static uint32_t rand(); static double randf(); @@ -289,7 +386,5 @@ public: }; -#define Math_PI 3.14159265358979323846 -#define Math_SQRT12 0.7071067811865475244008443621048490 #endif // MATH_FUNCS_H diff --git a/core/math/octree.h b/core/math/octree.h index 1a41413a7..483ba1d51 100644 --- a/core/math/octree.h +++ b/core/math/octree.h @@ -130,8 +130,10 @@ private: ~Octant() { - //for (int i=0;i<8;i++) - // memdelete_notnull(children[i]); + /* + for (int i=0;i<8;i++) + memdelete_notnull(children[i]); + */ } }; @@ -250,8 +252,10 @@ private: E->get().eA=p_A->pair_list.push_back(&E->get()); E->get().eB=p_B->pair_list.push_back(&E->get()); -// if (pair_callback) -// pair_callback(pair_callback_userdata,p_A->userdata,p_B->userdata); + /* + if (pair_callback) + pair_callback(pair_callback_userdata,p_A->userdata,p_B->userdata); + */ } else { E->get().refcount++; @@ -970,8 +974,10 @@ void Octree<T,use_pairs,AL>::move(OctreeElementID p_id, const Rect3& p_aabb) { Octant *o=E->get().octant; typename List<typename Element::OctantOwner,AL>::Element *N=E->next(); -// if (!use_pairs) -// o->elements.erase( E->get().E ); + /* + if (!use_pairs) + o->elements.erase( E->get().E ); + */ if (use_pairs && e.pairable) o->pairable_elements.erase( E->get().E ); diff --git a/core/math/quick_hull.cpp b/core/math/quick_hull.cpp index ab81a068d..756e48d0b 100644 --- a/core/math/quick_hull.cpp +++ b/core/math/quick_hull.cpp @@ -483,7 +483,7 @@ Error QuickHull::build(const Vector<Vector3>& p_points, Geometry::MeshData &r_me //fill mesh r_mesh.faces.clear(); r_mesh.faces.resize(ret_faces.size()); -// print_line("FACECOUNT: "+itos(r_mesh.faces.size())); + //print_line("FACECOUNT: "+itos(r_mesh.faces.size())); int idx=0; for (List<Geometry::MeshData::Face>::Element *E=ret_faces.front();E;E=E->next()) { diff --git a/core/math/triangle_mesh.cpp b/core/math/triangle_mesh.cpp index fc5f55066..74c465677 100644 --- a/core/math/triangle_mesh.cpp +++ b/core/math/triangle_mesh.cpp @@ -320,7 +320,7 @@ bool TriangleMesh::intersect_segment(const Vector3& p_begin,const Vector3& p_end bool valid = b.aabb.intersects_segment(p_begin,p_end); -// bool valid = b.aabb.intersects(ray_aabb); + //bool valid = b.aabb.intersects(ray_aabb); if (!valid) { diff --git a/core/math/triangulator.cpp b/core/math/triangulator.cpp index 8f82d7682..75b2b064c 100644 --- a/core/math/triangulator.cpp +++ b/core/math/triangulator.cpp @@ -1128,7 +1128,7 @@ int TriangulatorPartition::MonotonePartition(List<TriangulatorPoly> *inpolys, Li //this makes deleting existing edges much faster Set<ScanLineEdge>::Element **edgeTreeIterators,*edgeIter; edgeTreeIterators = new Set<ScanLineEdge>::Element*[maxnumvertices]; -// Pair<Set<ScanLineEdge>::Element*,bool> edgeTreeRet; + //Pair<Set<ScanLineEdge>::Element*,bool> edgeTreeRet; for(i = 0; i<numvertices; i++) edgeTreeIterators[i] = NULL; //for each vertex diff --git a/core/method_bind.cpp b/core/method_bind.cpp index f323f3bc2..3465edff6 100644 --- a/core/method_bind.cpp +++ b/core/method_bind.cpp @@ -26,7 +26,10 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ +// object.h needs to be the first include *before* method_bind.h +// FIXME: Find out why and fix potential cyclical dependencies. #include "object.h" + #include "method_bind.h" diff --git a/core/object.cpp b/core/object.cpp index 3bb917bd3..8af088122 100644 --- a/core/object.cpp +++ b/core/object.cpp @@ -369,8 +369,10 @@ void Object::set(const String& p_name, const Variant& p_value) { _setv(p_name,p_value); - //if (!_use_builtin_script()) -// return; + /* + if (!_use_builtin_script()) + return; + */ bool success; ClassDB::set_property(this,p_name,p_value,success); @@ -410,8 +412,10 @@ void Object::set(const StringName& p_name, const Variant& p_value, bool *r_valid //try built-in setgetter { if (ClassDB::set_property(this,p_name,p_value,r_valid)) { - //if (r_valid) - // *r_valid=true; + /* + if (r_valid) + *r_valid=true; + */ return; } } @@ -1689,12 +1693,12 @@ void Object::_bind_methods() { //todo reimplement this per language so all 5 arguments can be called -// ClassDB::bind_method(_MD("call","method","arg1","arg2","arg3","arg4"),&Object::_call_bind,DEFVAL(Variant()),DEFVAL(Variant()),DEFVAL(Variant()),DEFVAL(Variant())); -// ClassDB::bind_method(_MD("call_deferred","method","arg1","arg2","arg3","arg4"),&Object::_call_deferred_bind,DEFVAL(Variant()),DEFVAL(Variant()),DEFVAL(Variant()),DEFVAL(Variant())); + //ClassDB::bind_method(_MD("call","method","arg1","arg2","arg3","arg4"),&Object::_call_bind,DEFVAL(Variant()),DEFVAL(Variant()),DEFVAL(Variant()),DEFVAL(Variant())); + //ClassDB::bind_method(_MD("call_deferred","method","arg1","arg2","arg3","arg4"),&Object::_call_deferred_bind,DEFVAL(Variant()),DEFVAL(Variant()),DEFVAL(Variant()),DEFVAL(Variant())); ClassDB::bind_method(_MD("add_user_signal","signal","arguments"),&Object::_add_user_signal,DEFVAL(Array())); ClassDB::bind_method(_MD("has_user_signal","signal"),&Object::_has_user_signal); -// ClassDB::bind_method(_MD("emit_signal","signal","arguments"),&Object::_emit_signal,DEFVAL(Array())); + //ClassDB::bind_method(_MD("emit_signal","signal","arguments"),&Object::_emit_signal,DEFVAL(Array())); { diff --git a/core/object.h b/core/object.h index a54693eab..6ce579ea9 100644 --- a/core/object.h +++ b/core/object.h @@ -579,8 +579,8 @@ public: } /* IAPI */ -// void set(const String& p_name, const Variant& p_value); -// Variant get(const String& p_name) const; + //void set(const String& p_name, const Variant& p_value); + //Variant get(const String& p_name) const; void set(const StringName& p_name, const Variant& p_value, bool *r_valid=NULL); Variant get(const StringName& p_name, bool *r_valid=NULL) const; diff --git a/core/object_type_db.cpp b/core/object_type_db.cpp index f3bb37421..24b9c26e7 100644 --- a/core/object_type_db.cpp +++ b/core/object_type_db.cpp @@ -897,7 +897,7 @@ bool ClassDB::set_property(Object* p_object,const StringName& p_property, const if (psg->index>=0) { Variant index=psg->index; const Variant* arg[2]={&index,&p_value}; -// p_object->call(psg->setter,arg,2,ce); + //p_object->call(psg->setter,arg,2,ce); if (psg->_setptr) { psg->_setptr->call(p_object,arg,2,ce); } else { @@ -1111,6 +1111,15 @@ MethodBind* ClassDB::bind_methodfi(uint32_t p_flags, MethodBind *p_bind , const String instance_type=p_bind->get_instance_class(); +#ifdef DEBUG_ENABLED + + if (has_method(instance_type,mdname)) { + ERR_EXPLAIN("Class "+String(instance_type)+" already has a method "+String(mdname)); + ERR_FAIL_V(NULL); + } +#endif + + ClassInfo *type=classes.getptr(instance_type); if (!type) { ERR_PRINTS("Couldn't bind method '"+mdname+"' for instance: "+instance_type); diff --git a/core/os/dir_access.h b/core/os/dir_access.h index f824b5f31..7c173fc78 100644 --- a/core/os/dir_access.h +++ b/core/os/dir_access.h @@ -72,7 +72,7 @@ protected: public: - virtual bool list_dir_begin()=0; ///< This starts dir listing + virtual Error list_dir_begin()=0; ///< This starts dir listing virtual String get_next(bool* p_is_dir); // compatibility virtual String get_next()=0; virtual bool current_is_dir() const=0; diff --git a/core/os/input.cpp b/core/os/input.cpp index 2ae5834bd..e53aa82b1 100644 --- a/core/os/input.cpp +++ b/core/os/input.cpp @@ -75,7 +75,7 @@ void Input::_bind_methods() { ClassDB::bind_method(_MD("get_magnetometer"),&Input::get_magnetometer); ClassDB::bind_method(_MD("get_gyroscope"),&Input::get_gyroscope); //ClassDB::bind_method(_MD("get_mouse_pos"),&Input::get_mouse_pos); - this is not the function you want - ClassDB::bind_method(_MD("get_mouse_speed"),&Input::get_mouse_speed); + ClassDB::bind_method(_MD("get_last_mouse_speed"),&Input::get_last_mouse_speed); ClassDB::bind_method(_MD("get_mouse_button_mask"),&Input::get_mouse_button_mask); ClassDB::bind_method(_MD("set_mouse_mode","mode"),&Input::set_mouse_mode); ClassDB::bind_method(_MD("get_mouse_mode"),&Input::get_mouse_mode); diff --git a/core/os/input.h b/core/os/input.h index b12ad9b55..82c7a80d3 100644 --- a/core/os/input.h +++ b/core/os/input.h @@ -77,7 +77,7 @@ public: virtual void stop_joy_vibration(int p_device)=0; virtual Point2 get_mouse_pos() const=0; - virtual Point2 get_mouse_speed() const=0; + virtual Point2 get_last_mouse_speed() const=0; virtual int get_mouse_button_mask() const=0; virtual void warp_mouse_pos(const Vector2& p_to)=0; diff --git a/core/os/memory.h b/core/os/memory.h index 0e6dea48d..49424037f 100644 --- a/core/os/memory.h +++ b/core/os/memory.h @@ -97,8 +97,8 @@ _ALWAYS_INLINE_ T *_post_initialize(T *p_obj) { #define memnew(m_class) _post_initialize(new("") m_class) _ALWAYS_INLINE_ void * operator new(size_t p_size,void *p_pointer,size_t check, const char *p_description) { -// void *failptr=0; -// ERR_FAIL_COND_V( check < p_size , failptr); /** bug, or strange compiler, most likely */ + //void *failptr=0; + //ERR_FAIL_COND_V( check < p_size , failptr); /** bug, or strange compiler, most likely */ return p_pointer; } diff --git a/core/os/os.cpp b/core/os/os.cpp index 677bf63e6..3a8e15a69 100644 --- a/core/os/os.cpp +++ b/core/os/os.cpp @@ -27,13 +27,13 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ #include "os.h" -#include "os/file_access.h" -#include <stdarg.h> + #include "dir_access.h" #include "globals.h" #include "input.h" -// For get_engine_version, could be removed if it's moved to a new Engine singleton -#include "version.h" +#include "os/file_access.h" + +#include <stdarg.h> OS* OS::singleton=NULL; @@ -98,23 +98,6 @@ void OS::printerr(const char* p_format, ...) { }; -void OS::set_iterations_per_second(int p_ips) { - - ips=p_ips; -} -int OS::get_iterations_per_second() const { - - return ips; -} - -void OS::set_target_fps(int p_fps) { - _target_fps=p_fps>0? p_fps : 0; -} - -float OS::get_target_fps() const { - return _target_fps; -} - void OS::set_keep_screen_on(bool p_enabled) { _keep_screen_on=p_enabled; } @@ -152,10 +135,6 @@ int OS::get_process_ID() const { return -1; }; -uint64_t OS::get_frames_drawn() { - - return frames_drawn; -} bool OS::is_stdout_verbose() const { @@ -187,7 +166,7 @@ const char *OS::get_last_error() const { void OS::dump_memory_to_file(const char* p_file) { -// Memory::dump_static_mem_to_file(p_file); + //Memory::dump_static_mem_to_file(p_file); } static FileAccess *_OSPRF=NULL; @@ -261,15 +240,7 @@ void OS::clear_last_error() { memfree(last_error); last_error=NULL; } -void OS::set_frame_delay(uint32_t p_msec) { - _frame_delay=p_msec; -} - -uint32_t OS::get_frame_delay() const { - - return _frame_delay; -} void OS::set_no_window_mode(bool p_enable) { @@ -513,20 +484,13 @@ OS::MouseMode OS::get_mouse_mode() const{ return MOUSE_MODE_VISIBLE; } -void OS::set_time_scale(float p_scale) { - - _time_scale=p_scale; -} OS::LatinKeyboardVariant OS::get_latin_keyboard_variant() const { return LATIN_KEYBOARD_QWERTY; } -float OS::get_time_scale() const { - return _time_scale; -} bool OS::is_joy_known(int p_device) { return true; @@ -548,49 +512,21 @@ bool OS::is_vsync_enabled() const{ return true; } -Dictionary OS::get_engine_version() const { - - Dictionary dict; - dict["major"] = _MKSTR(VERSION_MAJOR); - dict["minor"] = _MKSTR(VERSION_MINOR); -#ifdef VERSION_PATCH - dict["patch"] = _MKSTR(VERSION_PATCH); -#else - dict["patch"] = ""; -#endif - dict["status"] = _MKSTR(VERSION_STATUS); - dict["revision"] = _MKSTR(VERSION_REVISION); - - String stringver = String(dict["major"]) + "." + String(dict["minor"]); - if (dict["patch"] != "") - stringver += "." + String(dict["patch"]); - stringver += "-" + String(dict["status"]) + " (" + String(dict["revision"]) + ")"; - dict["string"] = stringver; - - return dict; -} OS::OS() { last_error=NULL; - frames_drawn=0; singleton=this; - ips=60; _keep_screen_on=true; // set default value to true, because this had been true before godot 2.0. low_processor_usage_mode=false; _verbose_stdout=false; - _frame_delay=0; _no_window=false; _exit_code=0; _orientation=SCREEN_LANDSCAPE; - _fps=1; - _target_fps=0; + _render_thread_mode=RENDER_THREAD_SAFE; - _time_scale=1.0; - _pixel_snap=false; + + _allow_hidpi=true; - _fixed_frames=0; - _idle_frames=0; - _in_fixed=false; Math::seed(1234567); } diff --git a/core/os/os.h b/core/os/os.h index 5ea3216f2..ea03481a9 100644 --- a/core/os/os.h +++ b/core/os/os.h @@ -32,6 +32,7 @@ #include "ustring.h" #include "list.h" #include "vector.h" +#include "engine.h" #include "os/main_loop.h" #include <stdarg.h> @@ -43,28 +44,17 @@ class OS { static OS* singleton; String _execpath; - String _custom_level; List<String> _cmdline; - int ips; bool _keep_screen_on; bool low_processor_usage_mode; bool _verbose_stdout; String _local_clipboard; - uint64_t frames_drawn; - uint32_t _frame_delay; uint64_t _msec_splash; bool _no_window; int _exit_code; int _orientation; - float _fps; - int _target_fps; - float _time_scale; - bool _pixel_snap; bool _allow_hidpi; - uint64_t _fixed_frames; - uint64_t _idle_frames; - bool _in_fixed; char *last_error; @@ -185,15 +175,6 @@ public: virtual bool get_borderless_window() { return 0; } - - virtual void set_iterations_per_second(int p_ips); - virtual int get_iterations_per_second() const; - - virtual void set_target_fps(int p_fps); - virtual float get_target_fps() const; - - virtual float get_frames_per_second() const { return _fps; } - virtual void set_keep_screen_on(bool p_enabled); virtual bool is_keep_screen_on() const; virtual void set_low_processor_usage_mode(bool p_enabled); @@ -217,7 +198,6 @@ public: virtual MainLoop *get_main_loop() const=0; - String get_custom_level() const { return _custom_level; } virtual void yield(); @@ -280,17 +260,9 @@ public: uint32_t get_ticks_msec() const; uint64_t get_splash_tick_msec() const; - void set_frame_delay(uint32_t p_msec); - uint32_t get_frame_delay() const; virtual bool can_draw() const = 0; - uint64_t get_frames_drawn(); - - uint64_t get_fixed_frames() const { return _fixed_frames; } - uint64_t get_idle_frames() const { return _idle_frames; } - bool is_in_fixed_frame() const { return _in_fixed; } - bool is_stdout_verbose() const; enum CursorShape { @@ -416,10 +388,6 @@ public: virtual LatinKeyboardVariant get_latin_keyboard_variant() const; - void set_time_scale(float p_scale); - float get_time_scale() const; - - _FORCE_INLINE_ bool get_use_pixel_snap() const { return _pixel_snap; } virtual bool is_joy_known(int p_device); virtual String get_joy_guid(int p_device)const; @@ -434,8 +402,6 @@ public: virtual void set_use_vsync(bool p_enable); virtual bool is_vsync_enabled() const; - Dictionary get_engine_version() const; - bool is_hidpi_allowed() const { return _allow_hidpi; } OS(); virtual ~OS(); diff --git a/core/path_remap.cpp b/core/path_remap.cpp index fd5b38fa7..42383e212 100644 --- a/core/path_remap.cpp +++ b/core/path_remap.cpp @@ -142,7 +142,7 @@ void PathRemap::load_remaps() { // platform remaps second, so override remaps = GlobalConfig::get_singleton()->get("remap/"+OS::get_singleton()->get_name()); -// remaps = Globals::get_singleton()->get("remap/PSP"); + //remaps = Globals::get_singleton()->get("remap/PSP"); { int rlen = remaps.size(); @@ -152,7 +152,7 @@ void PathRemap::load_remaps() { String from = r[i*2+0]; String to = r[i*2+1]; -// print_line("add remap: "+from+" -> "+to); + //print_line("add remap: "+from+" -> "+to); add_remap(from,to); } } diff --git a/core/register_core_types.cpp b/core/register_core_types.cpp index fe88d1d13..85fa5d27c 100644 --- a/core/register_core_types.cpp +++ b/core/register_core_types.cpp @@ -62,6 +62,7 @@ static ResourceFormatLoaderBinary *resource_loader_binary=NULL; static _ResourceLoader *_resource_loader=NULL; static _ResourceSaver *_resource_saver=NULL; static _OS *_os=NULL; +static _Engine *_engine=NULL; static _ClassDB *_classdb=NULL; static _Marshalls *_marshalls = NULL; static TranslationLoaderPO *resource_format_po=NULL; @@ -122,7 +123,7 @@ void register_core_types() { ClassDB::register_virtual_class<PacketPeer>(); ClassDB::register_class<PacketPeerStream>(); ClassDB::register_class<MainLoop>(); -// ClassDB::register_type<OptimizedSaver>(); + //ClassDB::register_type<OptimizedSaver>(); ClassDB::register_class<Translation>(); ClassDB::register_class<PHashTranslation>(); ClassDB::register_class<UndoRedo>(); @@ -156,6 +157,7 @@ void register_core_types() { _resource_loader=memnew(_ResourceLoader); _resource_saver=memnew(_ResourceSaver); _os=memnew(_OS); + _engine=memnew(_Engine); _classdb=memnew(_ClassDB); _marshalls = memnew(_Marshalls); @@ -179,6 +181,7 @@ void register_core_singletons() { GlobalConfig::get_singleton()->add_singleton( GlobalConfig::Singleton("ResourceSaver",_ResourceSaver::get_singleton()) ); GlobalConfig::get_singleton()->add_singleton( GlobalConfig::Singleton("PathRemap",PathRemap::get_singleton() ) ); GlobalConfig::get_singleton()->add_singleton( GlobalConfig::Singleton("OS",_OS::get_singleton() ) ); + GlobalConfig::get_singleton()->add_singleton( GlobalConfig::Singleton("Engine",_Engine::get_singleton() ) ); GlobalConfig::get_singleton()->add_singleton( GlobalConfig::Singleton("ClassDB",_classdb ) ); GlobalConfig::get_singleton()->add_singleton( GlobalConfig::Singleton("Marshalls",_Marshalls::get_singleton() ) ); GlobalConfig::get_singleton()->add_singleton( GlobalConfig::Singleton("TranslationServer",TranslationServer::get_singleton() ) ); @@ -196,6 +199,7 @@ void unregister_core_types() { memdelete( _resource_loader ); memdelete( _resource_saver ); memdelete( _os); + memdelete( _engine ); memdelete( _classdb ); memdelete( _marshalls ); diff --git a/core/resource.cpp b/core/resource.cpp index db4d2ec0d..3369e4a5a 100644 --- a/core/resource.cpp +++ b/core/resource.cpp @@ -522,11 +522,12 @@ void ResourceCache::clear() { void ResourceCache::reload_externals() { - //const String *K=NULL; - //while ((K=resources.next(K))) { -// resources[*K]->reload_external_data(); -// } - + /* + const String *K=NULL; + while ((K=resources.next(K))) { + resources[*K]->reload_external_data(); + } + */ } bool ResourceCache::has(const String& p_path) { diff --git a/core/script_debugger_remote.cpp b/core/script_debugger_remote.cpp index 62fcd5247..bb0109467 100644 --- a/core/script_debugger_remote.cpp +++ b/core/script_debugger_remote.cpp @@ -66,7 +66,7 @@ Error ScriptDebuggerRemote::connect_to_host(const String& p_host,uint16_t p_port int port = p_port; int tries = 3; - tcp_client->connect(ip, port); + tcp_client->connect_to_host(ip, port); while (tries--) { @@ -129,7 +129,7 @@ void ScriptDebuggerRemote::debug(ScriptLanguage *p_script,bool p_can_continue) { //or when execution is paused from editor - if (!tcp_client->is_connected()) { + if (!tcp_client->is_connected_to_host()) { ERR_EXPLAIN("Script Debugger failed to connect, but being used anyway."); ERR_FAIL(); } @@ -446,7 +446,7 @@ void ScriptDebuggerRemote::_err_handler(void* ud,const char* p_func,const char*p sdr->mutex->lock(); - if (!sdr->locking && sdr->tcp_client->is_connected()) { + if (!sdr->locking && sdr->tcp_client->is_connected_to_host()) { sdr->errors.push_back(oe); } @@ -778,7 +778,7 @@ void ScriptDebuggerRemote::_send_profiling_data(bool p_for_frame) { } - packet_peer_stream->put_var(OS::get_singleton()->get_frames_drawn()); //total frame time + packet_peer_stream->put_var(Engine::get_singleton()->get_frames_drawn()); //total frame time packet_peer_stream->put_var(frame_time); //total frame time packet_peer_stream->put_var(idle_time); //idle frame time packet_peer_stream->put_var(fixed_time); //fixed frame time @@ -887,7 +887,7 @@ void ScriptDebuggerRemote::idle_poll() { void ScriptDebuggerRemote::send_message(const String& p_message, const Array &p_args) { mutex->lock(); - if (!locking && tcp_client->is_connected()) { + if (!locking && tcp_client->is_connected_to_host()) { Message msg; msg.message=p_message; @@ -928,7 +928,7 @@ void ScriptDebuggerRemote::_print_handler(void *p_this,const String& p_string) { } sdr->mutex->lock(); - if (!sdr->locking && sdr->tcp_client->is_connected()) { + if (!sdr->locking && sdr->tcp_client->is_connected_to_host()) { sdr->output_strings.push_back(s); } diff --git a/core/set.h b/core/set.h index 9da288767..13c2b3a4f 100644 --- a/core/set.h +++ b/core/set.h @@ -141,7 +141,7 @@ private: #ifdef GLOBALNIL_DISABLED memdelete_allocator<Element,A>(_nil); #endif -// memdelete_allocator<Element,A>(_root); + //memdelete_allocator<Element,A>(_root); } }; @@ -307,7 +307,7 @@ private: new_node->right=_data._nil; new_node->left=_data._nil; new_node->value=p_value; -// new_node->data=_data; + //new_node->data=_data; if (new_parent==_data._root || less(p_value,new_parent->value)) { new_parent->left=new_node; diff --git a/core/ustring.cpp b/core/ustring.cpp index 27bb8eac7..66608379b 100644 --- a/core/ustring.cpp +++ b/core/ustring.cpp @@ -560,7 +560,7 @@ String String::get_slice(String p_splitter, int p_slice) const { int pos=0; int prev_pos=0; -// int slices=1; + //int slices=1; if (p_slice<0) return ""; if (find(p_splitter)==-1) @@ -574,7 +574,7 @@ String String::get_slice(String p_splitter, int p_slice) const { pos=length(); //reached end int from=prev_pos; - // int to=pos; + //int to=pos; if (p_slice==i) { @@ -1420,7 +1420,7 @@ bool String::parse_utf8(const char* p_utf8,int p_len) { } } -// printf("char %i, len %i\n",unichar,len); + //printf("char %i, len %i\n",unichar,len); if (sizeof(wchar_t)==2 && unichar>0xFFFF) { unichar=' '; //too long for windows @@ -2951,6 +2951,78 @@ bool String::matchn(const String& p_wildcard) const { } +String String::format(const Variant& values,String placeholder) const { + + String new_string = String( this->ptr() ); + + if( values.get_type() == Variant::ARRAY ) { + Array values_arr = values; + + for(int i=0;i<values_arr.size();i++) { + String i_as_str = String::num_int64( i ); + + if( values_arr[i].get_type() == Variant::ARRAY ) {//Array in Array structure [["name","RobotGuy"],[0,"godot"],["strength",9000.91]] + Array value_arr = values_arr[i]; + + if( value_arr.size()==2 ) { + Variant v_key = value_arr[0]; + String key; + + key = v_key.get_construct_string(); + if( key.left(1)=="\"" && key.right(key.length()-1)=="\"" ) { + key = key.substr(1,key.length()-2); + } + + Variant v_val = value_arr[1]; + String val; + val = v_val.get_construct_string(); + + if( val.left(1)=="\"" && val.right(val.length()-1)=="\"" ) { + val = val.substr(1,val.length()-2); + } + + new_string = new_string.replacen( placeholder.replace("_", key ), val ); + }else { + ERR_PRINT(String("STRING.format Inner Array size != 2 ").ascii().get_data()); + } + } else {//Array structure ["RobotGuy","Logis","rookie"] + Variant v_val = values_arr[i]; + String val; + val = v_val.get_construct_string(); + + if( val.left(1)=="\"" && val.right(val.length()-1)=="\"" ) { + val = val.substr(1,val.length()-2); + } + + new_string = new_string.replacen( placeholder.replace("_", i_as_str ), val ); + } + } + }else if( values.get_type() == Variant::DICTIONARY ) { + Dictionary d = values; + List<Variant> keys; + d.get_key_list(&keys); + + for (List<Variant>::Element *E=keys.front();E;E=E->next()) { + String key = E->get().get_construct_string(); + String val = d[E->get()].get_construct_string(); + + if( key.left(1)=="\"" && key.right(key.length()-1)=="\"" ) { + key = key.substr(1,key.length()-2); + } + + if( val.left(1)=="\"" && val.right(val.length()-1)=="\"" ) { + val = val.substr(1,val.length()-2); + } + + new_string = new_string.replacen( placeholder.replace("_", key ), val ); + } + }else{ + ERR_PRINT(String("Invalid type: use Array or Dictionary.").ascii().get_data()); + } + + return new_string; +} + String String::replace(String p_key,String p_with) const { String new_string; @@ -3812,7 +3884,7 @@ String String::get_file() const { return substr(sep+1,length()); } -String String::extension() const { +String String::get_extension() const { int pos = find_last("."); if (pos<0) @@ -3822,8 +3894,9 @@ String String::extension() const { } String String::plus_file(const String& p_file) const { - - if (length()>0 && operator [](length()-1)=='/') + if (empty()) + return p_file; + if (operator [](length()-1)=='/' || p_file.operator [](0)=='/') return *this+p_file; else return *this+"/"+p_file; @@ -3891,7 +3964,7 @@ String String::percent_decode() const { return String::utf8(pe.ptr()); } -String String::basename() const { +String String::get_basename() const { int pos = find_last("."); if (pos<0) @@ -4211,4 +4284,3 @@ String RTR(const String& p_text) { return p_text; } - diff --git a/core/ustring.h b/core/ustring.h index 9a145143d..426762a9e 100644 --- a/core/ustring.h +++ b/core/ustring.h @@ -125,6 +125,7 @@ public: bool is_subsequence_ofi(const String& p_string) const; Vector<String> bigrams() const; float similarity(const String& p_string) const; + String format(const Variant& values,String placeholder="{_}") const; String replace_first(String p_key,String p_with) const; String replace(String p_key,String p_with) const; String replacen(String p_key,String p_with) const; @@ -176,8 +177,8 @@ public: String right(int p_pos) const; String strip_edges(bool left = true, bool right = true) const; String strip_escapes() const; - String extension() const; - String basename() const; + String get_extension() const; + String get_basename() const; String plus_file(const String& p_file) const; CharType ord_at(int p_idx) const; diff --git a/core/variant_call.cpp b/core/variant_call.cpp index 0c8b40539..51ad115d4 100644 --- a/core/variant_call.cpp +++ b/core/variant_call.cpp @@ -146,7 +146,7 @@ struct _VariantCall { Arg(Variant::Type p_type,const StringName &p_name) { name=p_name; type=p_type; } }; -// void addfunc(Variant::Type p_type, const StringName& p_name,VariantFunc p_func); + //void addfunc(Variant::Type p_type, const StringName& p_name,VariantFunc p_func); static void make_func_return_variant(Variant::Type p_type,const StringName& p_name) { @@ -261,6 +261,7 @@ static void _call_##m_type##_##m_method(Variant& r_ret,Variant& p_self,const Var VCALL_LOCALMEM1R(String,is_subsequence_ofi); VCALL_LOCALMEM0R(String,bigrams); VCALL_LOCALMEM1R(String,similarity); + VCALL_LOCALMEM2R(String,format); VCALL_LOCALMEM2R(String,replace); VCALL_LOCALMEM2R(String,replacen); VCALL_LOCALMEM2R(String,insert); @@ -272,8 +273,8 @@ static void _call_##m_type##_##m_method(Variant& r_ret,Variant& p_self,const Var VCALL_LOCALMEM1R(String,left); VCALL_LOCALMEM1R(String,right); VCALL_LOCALMEM2R(String,strip_edges); - VCALL_LOCALMEM0R(String,extension); - VCALL_LOCALMEM0R(String,basename); + VCALL_LOCALMEM0R(String,get_extension); + VCALL_LOCALMEM0R(String,get_basename); VCALL_LOCALMEM1R(String,plus_file); VCALL_LOCALMEM1R(String,ord_at); VCALL_LOCALMEM2(String,erase); @@ -349,12 +350,12 @@ static void _call_##m_type##_##m_method(Variant& r_ret,Variant& p_self,const Var VCALL_LOCALMEM0R(Vector2,tangent); VCALL_LOCALMEM0R(Vector2,floor); VCALL_LOCALMEM1R(Vector2,snapped); - VCALL_LOCALMEM0R(Vector2,get_aspect); + VCALL_LOCALMEM0R(Vector2,aspect); VCALL_LOCALMEM1R(Vector2,dot); VCALL_LOCALMEM1R(Vector2,slide); VCALL_LOCALMEM1R(Vector2,reflect); VCALL_LOCALMEM0R(Vector2,angle); -// VCALL_LOCALMEM1R(Vector2,cross); + //VCALL_LOCALMEM1R(Vector2,cross); VCALL_LOCALMEM0R(Vector2,abs); VCALL_LOCALMEM1R(Vector2,clamped); @@ -1392,6 +1393,7 @@ _VariantCall::addfunc(Variant::m_vtype,Variant::m_ret,_SCS(#m_method),VCALL(m_cl ADDFUNC0(STRING,POOL_STRING_ARRAY,String,bigrams,varray()); ADDFUNC1(STRING,REAL,String,similarity,STRING,"text",varray()); + ADDFUNC2(STRING,STRING,String,format,NIL,"values",STRING,"placeholder",varray("{_}")); ADDFUNC2(STRING,STRING,String,replace,STRING,"what",STRING,"forwhat",varray()); ADDFUNC2(STRING,STRING,String,replacen,STRING,"what",STRING,"forwhat",varray()); ADDFUNC2(STRING,STRING,String,insert,INT,"pos",STRING,"what",varray()); @@ -1405,8 +1407,8 @@ _VariantCall::addfunc(Variant::m_vtype,Variant::m_ret,_SCS(#m_method),VCALL(m_cl ADDFUNC1(STRING,STRING,String,left,INT,"pos",varray()); ADDFUNC1(STRING,STRING,String,right,INT,"pos",varray()); ADDFUNC2(STRING,STRING,String,strip_edges,BOOL,"left",BOOL,"right",varray(true,true)); - ADDFUNC0(STRING,STRING,String,extension,varray()); - ADDFUNC0(STRING,STRING,String,basename,varray()); + ADDFUNC0(STRING,STRING,String,get_extension,varray()); + ADDFUNC0(STRING,STRING,String,get_basename,varray()); ADDFUNC1(STRING,STRING,String,plus_file,STRING,"file",varray()); ADDFUNC1(STRING,INT,String,ord_at,INT,"at",varray()); ADDFUNC2(STRING,NIL,String,erase,INT,"pos",INT,"chars", varray()); @@ -1457,7 +1459,7 @@ _VariantCall::addfunc(Variant::m_vtype,Variant::m_ret,_SCS(#m_method),VCALL(m_cl ADDFUNC0(VECTOR2,VECTOR2,Vector2,tangent,varray()); ADDFUNC0(VECTOR2,VECTOR2,Vector2,floor,varray()); ADDFUNC1(VECTOR2,VECTOR2,Vector2,snapped,VECTOR2,"by",varray()); - ADDFUNC0(VECTOR2,REAL,Vector2,get_aspect,varray()); + ADDFUNC0(VECTOR2,REAL,Vector2,aspect,varray()); ADDFUNC1(VECTOR2,REAL,Vector2,dot,VECTOR2,"with",varray()); ADDFUNC1(VECTOR2,VECTOR2,Vector2,slide,VECTOR2,"vec",varray()); ADDFUNC1(VECTOR2,VECTOR2,Vector2,reflect,VECTOR2,"vec",varray()); diff --git a/core/variant_parser.cpp b/core/variant_parser.cpp index 402c8d41d..ca748b7fd 100644 --- a/core/variant_parser.cpp +++ b/core/variant_parser.cpp @@ -2094,8 +2094,10 @@ Error VariantWriter::write(const Variant& p_variant, StoreStringFunc p_store_str p_store_string_func(p_store_string_ud,"{ "); for(List<Variant>::Element *E=keys.front();E;E=E->next()) { - //if (!_check_type(dict[E->get()])) - // continue; + /* + if (!_check_type(dict[E->get()])) + continue; + */ write(E->get(),p_store_string_func,p_store_string_ud,p_encode_res_func,p_encode_res_ud); p_store_string_func(p_store_string_ud,":"); write(dict[E->get()],p_store_string_func,p_store_string_ud,p_encode_res_func,p_encode_res_ud); |
