summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2014-02-19 11:57:14 -0300
committerJuan Linietsky <reduzio@gmail.com>2014-02-19 11:57:14 -0300
commitd7d65fa2f2b51d03f7bdfcbceedca99188ce979c (patch)
treefecdf1bfa39ba5a4895b4dbf340a3b68098c109a /core
parent8c1731b67995add31361ae526b0e6af76346181e (diff)
-improved physics ccd
-html5 exporter works again -disable repeat on image loader by default -can change shape offset en tileset, texture offset was broken
Diffstat (limited to 'core')
-rw-r--r--core/globals.cpp7
-rw-r--r--core/globals.h3
-rw-r--r--core/io/file_access_compressed.cpp786
-rw-r--r--core/map.h2
-rw-r--r--core/math/math_2d.cpp10
-rw-r--r--core/math/math_2d.h2
-rw-r--r--core/variant_call.cpp4
7 files changed, 420 insertions, 394 deletions
diff --git a/core/globals.cpp b/core/globals.cpp
index 2eb26a7b19..997e2a2d85 100644
--- a/core/globals.cpp
+++ b/core/globals.cpp
@@ -240,6 +240,7 @@ bool Globals::_load_resource_pack(const String& p_pack) {
//if data.pck is found, all directory access will be from here
DirAccess::make_default<DirAccessPack>(DirAccess::ACCESS_RESOURCES);
+ using_datapack=true;
return true;
}
@@ -1327,6 +1328,10 @@ void Globals::set_disable_platform_override(bool p_disable) {
disable_platform_override=p_disable;
}
+bool Globals::is_using_datapack() const {
+
+ return using_datapack;
+}
void Globals::_bind_methods() {
@@ -1439,6 +1444,8 @@ Globals::Globals() {
custom_prop_info["render/mipmap_policy"]=PropertyInfo(Variant::INT,"render/mipmap_policy",PROPERTY_HINT_ENUM,"Allow,Allow For Po2,Disallow");
custom_prop_info["render/thread_model"]=PropertyInfo(Variant::INT,"render/thread_model",PROPERTY_HINT_ENUM,"Single-Unsafe,Single-Safe,Multi-Threaded");
set("display/emulate_touchscreen",false);
+
+ using_datapack=false;
}
diff --git a/core/globals.h b/core/globals.h
index 375c59a25e..08d9f08088 100644
--- a/core/globals.h
+++ b/core/globals.h
@@ -69,6 +69,7 @@ protected:
String resource_path;
HashMap<String,PropertyInfo> custom_prop_info;
bool disable_platform_override;
+ bool using_datapack;
bool _set(const StringName& p_name, const Variant& p_value);
@@ -127,6 +128,8 @@ public:
void register_global_defaults();
+ bool is_using_datapack() const;
+
Globals();
~Globals();
diff --git a/core/io/file_access_compressed.cpp b/core/io/file_access_compressed.cpp
index ec9dce28e2..b90a41df54 100644
--- a/core/io/file_access_compressed.cpp
+++ b/core/io/file_access_compressed.cpp
@@ -26,396 +26,396 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#include "file_access_compressed.h"
-#include "print_string.h"
-void FileAccessCompressed::configure(const String& p_magic, Compression::Mode p_mode, int p_block_size) {
-
- magic=p_magic.ascii().get_data();
- if (magic.length()>4)
- magic=magic.substr(0,4);
- else {
- while(magic.length()<4)
- magic+=" ";
- }
-
- cmode=p_mode;
- block_size=p_block_size;
-
-}
-
-
-#define WRITE_FIT(m_bytes) \
-{\
-if (write_pos+(m_bytes) > write_max) {\
- write_max=write_pos+(m_bytes);\
-}\
-if (write_max > write_buffer_size) {\
- write_buffer_size = nearest_power_of_2( write_max );\
- buffer.resize(write_buffer_size);\
- write_ptr=buffer.ptr();\
-}\
-}
-
-
-Error FileAccessCompressed::open_after_magic(FileAccess *p_base) {
-
-
- f=p_base;
- cmode=(Compression::Mode)f->get_32();
- block_size=f->get_32();
- read_total=f->get_32();
- int bc = (read_total/block_size)+1;
- int acc_ofs=f->get_pos()+bc*4;
- int max_bs=0;
- for(int i=0;i<bc;i++) {
-
- ReadBlock rb;
- rb.offset=acc_ofs;
- rb.csize=f->get_32();
- acc_ofs+=rb.csize;
- max_bs=MAX(max_bs,rb.csize);
- read_blocks.push_back(rb);
-
-
- }
-
- comp_buffer.resize(max_bs);
- buffer.resize(block_size);
- read_ptr=buffer.ptr();
- f->get_buffer(comp_buffer.ptr(),read_blocks[0].csize);
- at_end=false;
- read_eof=false;
- read_block_count=bc;
- read_block_size=read_blocks.size()==1?read_total:block_size;
-
- Compression::decompress(buffer.ptr(),read_block_size,comp_buffer.ptr(),read_blocks[0].csize,cmode);
- read_block=0;
- read_pos=0;
-
- return OK;
-
-}
-
-Error FileAccessCompressed::_open(const String& p_path, int p_mode_flags){
-
- ERR_FAIL_COND_V(p_mode_flags==READ_WRITE,ERR_UNAVAILABLE);
-
- if (f)
- close();
-
-
- Error err;
- f = FileAccess::open(p_path,p_mode_flags,&err);
- if (err!=OK) {
- //not openable
-
- f=NULL;
- return err;
- }
-
- if (p_mode_flags&WRITE) {
-
- buffer.clear();
- writing=true;
- write_pos=0;
- write_buffer_size=256;
- buffer.resize(256);
- write_max=0;
- write_ptr=buffer.ptr();
-
-
-
- //don't store anything else unless it's done saving!
- } else {
-
- char rmagic[5];
- f->get_buffer((uint8_t*)rmagic,4);
- rmagic[4]=0;
- if (magic!=rmagic) {
- memdelete(f);
- f=NULL;
- return ERR_FILE_UNRECOGNIZED;
- }
-
- open_after_magic(f);
-
- }
-
- return OK;
-
-}
-void FileAccessCompressed::close(){
-
- if (!f)
- return;
-
-
- if (writing) {
- //save block table and all compressed blocks
-
- CharString mgc = magic.utf8();
- f->store_buffer((const uint8_t*)mgc.get_data(),mgc.length()); //write header 4
- f->store_32(cmode); //write compression mode 4
- f->store_32(block_size); //write block size 4
- f->store_32(write_max); //max amount of data written 4
- int bc=(write_max/block_size)+1;
-
- for(int i=0;i<bc;i++) {
- f->store_32(0); //compressed sizes, will update later
- }
-
-
- Vector<int> block_sizes;
- for(int i=0;i<bc;i++) {
-
- int bl = i==(bc-1) ? write_max % block_size : block_size;
- uint8_t *bp = &write_ptr[i*block_size];
-
- Vector<uint8_t> cblock;
- cblock.resize(Compression::get_max_compressed_buffer_size(bl,cmode));
- int s = Compression::compress(cblock.ptr(),bp,bl,cmode);
-
- f->store_buffer(cblock.ptr(),s);
- block_sizes.push_back(s);
- }
-
- f->seek(16); //ok write block sizes
- for(int i=0;i<bc;i++)
- f->store_32(block_sizes[i]);
- f->seek_end();
- f->store_buffer((const uint8_t*)mgc.get_data(),mgc.length()); //magic at the end too
-
- buffer.clear();
-
- } else {
-
-
- comp_buffer.clear();
- buffer.clear();
- read_blocks.clear();
- }
-
- memdelete(f);
- f=NULL;
-
-}
-
-bool FileAccessCompressed::is_open() const{
-
- return f!=NULL;
-}
-
-void FileAccessCompressed::seek(size_t p_position){
-
- ERR_FAIL_COND(!f);
- if (writing) {
-
- ERR_FAIL_COND(p_position>write_max);
-
- write_pos=p_position;
-
- } else {
-
- ERR_FAIL_COND(p_position>read_total);
- if (p_position==read_total) {
- at_end=true;
- } else {
-
- int block_idx = p_position/block_size;
- if (block_idx!=read_block) {
-
- read_block=block_idx;
- f->seek(read_blocks[read_block].offset);
- f->get_buffer(comp_buffer.ptr(),read_blocks[read_block].csize);
- Compression::decompress(buffer.ptr(),read_blocks.size()==1?read_total:block_size,comp_buffer.ptr(),read_blocks[read_block].csize,cmode);
- read_block_size=read_block==read_block_count-1?read_total%block_size:block_size;
- }
-
- read_pos=p_position%block_size;
- }
- }
-}
-
-
-void FileAccessCompressed::seek_end(int64_t p_position){
-
- ERR_FAIL_COND(!f);
- if (writing) {
-
- seek(write_max+p_position);
- } else {
-
- seek(read_total+p_position);
-
- }
-
-
-}
-size_t FileAccessCompressed::get_pos() const{
-
- ERR_FAIL_COND_V(!f,0);
- if (writing) {
-
- return write_pos;
- } else {
-
- return read_block*block_size+read_pos;
- }
-
-}
-size_t FileAccessCompressed::get_len() const{
-
- ERR_FAIL_COND_V(!f,0);
- if (writing) {
-
- return write_max;
- } else {
- return read_total;
- }
-}
-
-bool FileAccessCompressed::eof_reached() const{
-
- ERR_FAIL_COND_V(!f,false);
- if (writing) {
- return false;
- } else {
- return read_eof;
- }
-}
-
-uint8_t FileAccessCompressed::get_8() const{
-
- ERR_FAIL_COND_V(writing,0);
- ERR_FAIL_COND_V(!f,0);
-
- if (at_end) {
- read_eof=true;
- return 0;
- }
-
- uint8_t ret = read_ptr[read_pos];
-
- read_pos++;
- if (read_pos>=read_block_size) {
- read_block++;
-
- if (read_block<read_block_count) {
- //read another block of compressed data
- f->get_buffer(comp_buffer.ptr(),read_blocks[read_block].csize);
- Compression::decompress(buffer.ptr(),read_blocks.size()==1?read_total:block_size,comp_buffer.ptr(),read_blocks[read_block].csize,cmode);
- read_block_size=read_block==read_block_count-1?read_total%block_size:block_size;
- read_pos=0;
-
- } else {
- read_block--;
- at_end=true;
- ret =0;
- }
- }
-
- return ret;
-
-}
-int FileAccessCompressed::get_buffer(uint8_t *p_dst, int p_length) const{
-
- ERR_FAIL_COND_V(writing,0);
- ERR_FAIL_COND_V(!f,0);
-
- if (at_end) {
- read_eof=true;
- return 0;
- }
-
-
- for(int i=0;i<p_length;i++) {
-
-
- p_dst[i]=read_ptr[read_pos];
- read_pos++;
- if (read_pos>=read_block_size) {
- read_block++;
-
- if (read_block<read_block_count) {
- //read another block of compressed data
- f->get_buffer(comp_buffer.ptr(),read_blocks[read_block].csize);
- Compression::decompress(buffer.ptr(),read_blocks.size()==1?read_total:block_size,comp_buffer.ptr(),read_blocks[read_block].csize,cmode);
- read_block_size=read_block==read_block_count-1?read_total%block_size:block_size;
- read_pos=0;
-
- } else {
- read_block--;
- at_end=true;
- if (i<p_length-1)
- read_eof=true;
- return i;
-
- }
- }
-
- }
-
- return p_length;
-
-}
-
-Error FileAccessCompressed::get_error() const{
-
- return read_eof?ERR_FILE_EOF:OK;
-}
-
-void FileAccessCompressed::store_8(uint8_t p_dest){
-
- ERR_FAIL_COND(!f);
- ERR_FAIL_COND(!writing);
-
- WRITE_FIT(1);
- write_ptr[write_pos++]=p_dest;
-
-}
-
-bool FileAccessCompressed::file_exists(const String& p_name){
-
- FileAccess *fa = FileAccess::open(p_name,FileAccess::READ);
- if (!fa)
- return false;
- memdelete(fa);
- return true;
-}
-
-uint64_t FileAccessCompressed::_get_modified_time(const String& p_file) {
-
- if (f)
- return f->get_modified_time(p_file);
- else
- return 0;
-}
-
-FileAccessCompressed::FileAccessCompressed() {
-
- f=NULL;
- magic="GCMP";
- block_size=4096;
- cmode=Compression::MODE_FASTLZ;
- writing=false;
- write_ptr=0;
- write_buffer_size=0;
- write_max=0;
- block_size=0;
- read_eof=false;
- at_end=false;
- read_total=0;
- read_ptr=NULL;
- read_block=0;
- read_block_count=0;
- read_block_size=0;
- read_pos=0;
-
-}
-
-FileAccessCompressed::~FileAccessCompressed(){
-
- if (f)
- close();
-
-}
+#include "file_access_compressed.h"
+#include "print_string.h"
+void FileAccessCompressed::configure(const String& p_magic, Compression::Mode p_mode, int p_block_size) {
+
+ magic=p_magic.ascii().get_data();
+ if (magic.length()>4)
+ magic=magic.substr(0,4);
+ else {
+ while(magic.length()<4)
+ magic+=" ";
+ }
+
+ cmode=p_mode;
+ block_size=p_block_size;
+
+}
+
+
+#define WRITE_FIT(m_bytes) \
+{\
+if (write_pos+(m_bytes) > write_max) {\
+ write_max=write_pos+(m_bytes);\
+}\
+if (write_max > write_buffer_size) {\
+ write_buffer_size = nearest_power_of_2( write_max );\
+ buffer.resize(write_buffer_size);\
+ write_ptr=buffer.ptr();\
+}\
+}
+
+
+Error FileAccessCompressed::open_after_magic(FileAccess *p_base) {
+
+
+ f=p_base;
+ cmode=(Compression::Mode)f->get_32();
+ block_size=f->get_32();
+ read_total=f->get_32();
+ int bc = (read_total/block_size)+1;
+ int acc_ofs=f->get_pos()+bc*4;
+ int max_bs=0;
+ for(int i=0;i<bc;i++) {
+
+ ReadBlock rb;
+ rb.offset=acc_ofs;
+ rb.csize=f->get_32();
+ acc_ofs+=rb.csize;
+ max_bs=MAX(max_bs,rb.csize);
+ read_blocks.push_back(rb);
+
+
+ }
+
+ comp_buffer.resize(max_bs);
+ buffer.resize(block_size);
+ read_ptr=buffer.ptr();
+ f->get_buffer(comp_buffer.ptr(),read_blocks[0].csize);
+ at_end=false;
+ read_eof=false;
+ read_block_count=bc;
+ read_block_size=read_blocks.size()==1?read_total:block_size;
+
+ Compression::decompress(buffer.ptr(),read_block_size,comp_buffer.ptr(),read_blocks[0].csize,cmode);
+ read_block=0;
+ read_pos=0;
+
+ return OK;
+
+}
+
+Error FileAccessCompressed::_open(const String& p_path, int p_mode_flags){
+
+ ERR_FAIL_COND_V(p_mode_flags==READ_WRITE,ERR_UNAVAILABLE);
+
+ if (f)
+ close();
+
+
+ Error err;
+ f = FileAccess::open(p_path,p_mode_flags,&err);
+ if (err!=OK) {
+ //not openable
+
+ f=NULL;
+ return err;
+ }
+
+ if (p_mode_flags&WRITE) {
+
+ buffer.clear();
+ writing=true;
+ write_pos=0;
+ write_buffer_size=256;
+ buffer.resize(256);
+ write_max=0;
+ write_ptr=buffer.ptr();
+
+
+
+ //don't store anything else unless it's done saving!
+ } else {
+
+ char rmagic[5];
+ f->get_buffer((uint8_t*)rmagic,4);
+ rmagic[4]=0;
+ if (magic!=rmagic) {
+ memdelete(f);
+ f=NULL;
+ return ERR_FILE_UNRECOGNIZED;
+ }
+
+ open_after_magic(f);
+
+ }
+
+ return OK;
+
+}
+void FileAccessCompressed::close(){
+
+ if (!f)
+ return;
+
+
+ if (writing) {
+ //save block table and all compressed blocks
+
+ CharString mgc = magic.utf8();
+ f->store_buffer((const uint8_t*)mgc.get_data(),mgc.length()); //write header 4
+ f->store_32(cmode); //write compression mode 4
+ f->store_32(block_size); //write block size 4
+ f->store_32(write_max); //max amount of data written 4
+ int bc=(write_max/block_size)+1;
+
+ for(int i=0;i<bc;i++) {
+ f->store_32(0); //compressed sizes, will update later
+ }
+
+
+ Vector<int> block_sizes;
+ for(int i=0;i<bc;i++) {
+
+ int bl = i==(bc-1) ? write_max % block_size : block_size;
+ uint8_t *bp = &write_ptr[i*block_size];
+
+ Vector<uint8_t> cblock;
+ cblock.resize(Compression::get_max_compressed_buffer_size(bl,cmode));
+ int s = Compression::compress(cblock.ptr(),bp,bl,cmode);
+
+ f->store_buffer(cblock.ptr(),s);
+ block_sizes.push_back(s);
+ }
+
+ f->seek(16); //ok write block sizes
+ for(int i=0;i<bc;i++)
+ f->store_32(block_sizes[i]);
+ f->seek_end();
+ f->store_buffer((const uint8_t*)mgc.get_data(),mgc.length()); //magic at the end too
+
+ buffer.clear();
+
+ } else {
+
+
+ comp_buffer.clear();
+ buffer.clear();
+ read_blocks.clear();
+ }
+
+ memdelete(f);
+ f=NULL;
+
+}
+
+bool FileAccessCompressed::is_open() const{
+
+ return f!=NULL;
+}
+
+void FileAccessCompressed::seek(size_t p_position){
+
+ ERR_FAIL_COND(!f);
+ if (writing) {
+
+ ERR_FAIL_COND(p_position>write_max);
+
+ write_pos=p_position;
+
+ } else {
+
+ ERR_FAIL_COND(p_position>read_total);
+ if (p_position==read_total) {
+ at_end=true;
+ } else {
+
+ int block_idx = p_position/block_size;
+ if (block_idx!=read_block) {
+
+ read_block=block_idx;
+ f->seek(read_blocks[read_block].offset);
+ f->get_buffer(comp_buffer.ptr(),read_blocks[read_block].csize);
+ Compression::decompress(buffer.ptr(),read_blocks.size()==1?read_total:block_size,comp_buffer.ptr(),read_blocks[read_block].csize,cmode);
+ read_block_size=read_block==read_block_count-1?read_total%block_size:block_size;
+ }
+
+ read_pos=p_position%block_size;
+ }
+ }
+}
+
+
+void FileAccessCompressed::seek_end(int64_t p_position){
+
+ ERR_FAIL_COND(!f);
+ if (writing) {
+
+ seek(write_max+p_position);
+ } else {
+
+ seek(read_total+p_position);
+
+ }
+
+
+}
+size_t FileAccessCompressed::get_pos() const{
+
+ ERR_FAIL_COND_V(!f,0);
+ if (writing) {
+
+ return write_pos;
+ } else {
+
+ return read_block*block_size+read_pos;
+ }
+
+}
+size_t FileAccessCompressed::get_len() const{
+
+ ERR_FAIL_COND_V(!f,0);
+ if (writing) {
+
+ return write_max;
+ } else {
+ return read_total;
+ }
+}
+
+bool FileAccessCompressed::eof_reached() const{
+
+ ERR_FAIL_COND_V(!f,false);
+ if (writing) {
+ return false;
+ } else {
+ return read_eof;
+ }
+}
+
+uint8_t FileAccessCompressed::get_8() const{
+
+ ERR_FAIL_COND_V(writing,0);
+ ERR_FAIL_COND_V(!f,0);
+
+ if (at_end) {
+ read_eof=true;
+ return 0;
+ }
+
+ uint8_t ret = read_ptr[read_pos];
+
+ read_pos++;
+ if (read_pos>=read_block_size) {
+ read_block++;
+
+ if (read_block<read_block_count) {
+ //read another block of compressed data
+ f->get_buffer(comp_buffer.ptr(),read_blocks[read_block].csize);
+ Compression::decompress(buffer.ptr(),read_blocks.size()==1?read_total:block_size,comp_buffer.ptr(),read_blocks[read_block].csize,cmode);
+ read_block_size=read_block==read_block_count-1?read_total%block_size:block_size;
+ read_pos=0;
+
+ } else {
+ read_block--;
+ at_end=true;
+ ret =0;
+ }
+ }
+
+ return ret;
+
+}
+int FileAccessCompressed::get_buffer(uint8_t *p_dst, int p_length) const{
+
+ ERR_FAIL_COND_V(writing,0);
+ ERR_FAIL_COND_V(!f,0);
+
+ if (at_end) {
+ read_eof=true;
+ return 0;
+ }
+
+
+ for(int i=0;i<p_length;i++) {
+
+
+ p_dst[i]=read_ptr[read_pos];
+ read_pos++;
+ if (read_pos>=read_block_size) {
+ read_block++;
+
+ if (read_block<read_block_count) {
+ //read another block of compressed data
+ f->get_buffer(comp_buffer.ptr(),read_blocks[read_block].csize);
+ Compression::decompress(buffer.ptr(),read_blocks.size()==1?read_total:block_size,comp_buffer.ptr(),read_blocks[read_block].csize,cmode);
+ read_block_size=read_block==read_block_count-1?read_total%block_size:block_size;
+ read_pos=0;
+
+ } else {
+ read_block--;
+ at_end=true;
+ if (i<p_length-1)
+ read_eof=true;
+ return i;
+
+ }
+ }
+
+ }
+
+ return p_length;
+
+}
+
+Error FileAccessCompressed::get_error() const{
+
+ return read_eof?ERR_FILE_EOF:OK;
+}
+
+void FileAccessCompressed::store_8(uint8_t p_dest){
+
+ ERR_FAIL_COND(!f);
+ ERR_FAIL_COND(!writing);
+
+ WRITE_FIT(1);
+ write_ptr[write_pos++]=p_dest;
+
+}
+
+bool FileAccessCompressed::file_exists(const String& p_name){
+
+ FileAccess *fa = FileAccess::open(p_name,FileAccess::READ);
+ if (!fa)
+ return false;
+ memdelete(fa);
+ return true;
+}
+
+uint64_t FileAccessCompressed::_get_modified_time(const String& p_file) {
+
+ if (f)
+ return f->get_modified_time(p_file);
+ else
+ return 0;
+}
+
+FileAccessCompressed::FileAccessCompressed() {
+
+ f=NULL;
+ magic="GCMP";
+ block_size=16384;
+ cmode=Compression::MODE_DEFLATE;
+ writing=false;
+ write_ptr=0;
+ write_buffer_size=0;
+ write_max=0;
+ block_size=0;
+ read_eof=false;
+ at_end=false;
+ read_total=0;
+ read_ptr=NULL;
+ read_block=0;
+ read_block_count=0;
+ read_block_size=0;
+ read_pos=0;
+
+}
+
+FileAccessCompressed::~FileAccessCompressed(){
+
+ if (f)
+ close();
+
+}
diff --git a/core/map.h b/core/map.h
index 959dc58661..05abdc510e 100644
--- a/core/map.h
+++ b/core/map.h
@@ -115,7 +115,7 @@ private:
Element* _nil;
int size_cache;
- _Data() {
+ _FORCE_INLINE_ _Data() {
#ifdef GLOBALNIL_DISABLED
_nil = memnew_allocator( Element, A );
_nil->parent=_nil->left=_nil->right=_nil;
diff --git a/core/math/math_2d.cpp b/core/math/math_2d.cpp
index dbeaea6e75..acaaa327f3 100644
--- a/core/math/math_2d.cpp
+++ b/core/math/math_2d.cpp
@@ -255,6 +255,16 @@ Vector2 Vector2::cubic_interpolate(const Vector2& p_b,const Vector2& p_pre_a, co
}
+Vector2 Vector2::slide(const Vector2& p_vec) const {
+
+ return p_vec - *this * this->dot(p_vec);
+}
+Vector2 Vector2::reflect(const Vector2& p_vec) const {
+
+ return p_vec - *this * this->dot(p_vec) * 2.0;
+
+}
+
bool Rect2::intersects_segment(const Point2& p_from, const Point2& p_to, Point2* r_pos,Point2* r_normal) const {
diff --git a/core/math/math_2d.h b/core/math/math_2d.h
index 212d848bcb..1f45036409 100644
--- a/core/math/math_2d.h
+++ b/core/math/math_2d.h
@@ -105,6 +105,8 @@ struct Vector2 {
Vector2 cubic_interpolate(const Vector2& p_b,const Vector2& p_pre_a, const Vector2& p_post_b,float p_t) const;
Vector2 cubic_interpolate_soft(const Vector2& p_b,const Vector2& p_pre_a, const Vector2& p_post_b,float p_t) const;
+ Vector2 slide(const Vector2& p_vec) const;
+ Vector2 reflect(const Vector2& p_vec) const;
Vector2 operator+(const Vector2& p_v) const;
void operator+=(const Vector2& p_v);
diff --git a/core/variant_call.cpp b/core/variant_call.cpp
index 24c5c6bf95..846b924a42 100644
--- a/core/variant_call.cpp
+++ b/core/variant_call.cpp
@@ -298,6 +298,8 @@ static void _call_##m_type##_##m_method(Variant& r_ret,Variant& p_self,const Var
VCALL_LOCALMEM1R(Vector2,snapped);
VCALL_LOCALMEM0R(Vector2,get_aspect);
VCALL_LOCALMEM1R(Vector2,dot);
+ VCALL_LOCALMEM1R(Vector2,slide);
+ VCALL_LOCALMEM1R(Vector2,reflect);
// VCALL_LOCALMEM1R(Vector2,cross);
VCALL_LOCALMEM0R(Rect2,get_area);
@@ -1192,6 +1194,8 @@ _VariantCall::addfunc(Variant::m_vtype,Variant::m_ret,_SCS(#m_method),VCALL(m_cl
ADDFUNC1(VECTOR2,VECTOR2,Vector2,snapped,VECTOR2,"by",varray());
ADDFUNC0(VECTOR2,REAL,Vector2,get_aspect,varray());
ADDFUNC1(VECTOR2,REAL,Vector2,dot,VECTOR2,"with",varray());
+ ADDFUNC1(VECTOR2,REAL,Vector2,slide,VECTOR2,"vec",varray());
+ ADDFUNC1(VECTOR2,REAL,Vector2,reflect,VECTOR2,"vec",varray());
//ADDFUNC1(VECTOR2,REAL,Vector2,cross,VECTOR2,"with",varray());
ADDFUNC0(RECT2,REAL,Rect2,get_area,varray());