summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
Diffstat (limited to 'modules')
-rw-r--r--modules/SCsub16
-rw-r--r--modules/chibi/SCsub9
-rw-r--r--modules/chibi/cp_config.h52
-rw-r--r--modules/chibi/cp_envelope.cpp369
-rw-r--r--modules/chibi/cp_envelope.h129
-rw-r--r--modules/chibi/cp_file_access_wrapper.h96
-rw-r--r--modules/chibi/cp_instrument.cpp344
-rw-r--r--modules/chibi/cp_instrument.h219
-rw-r--r--modules/chibi/cp_loader.h64
-rw-r--r--modules/chibi/cp_loader_it.cpp216
-rw-r--r--modules/chibi/cp_loader_it.h125
-rw-r--r--modules/chibi/cp_loader_it_info.cpp268
-rw-r--r--modules/chibi/cp_loader_it_instruments.cpp224
-rw-r--r--modules/chibi/cp_loader_it_patterns.cpp166
-rw-r--r--modules/chibi/cp_loader_it_samples.cpp620
-rw-r--r--modules/chibi/cp_loader_mod.cpp482
-rw-r--r--modules/chibi/cp_loader_mod.h52
-rw-r--r--modules/chibi/cp_loader_s3m.cpp413
-rw-r--r--modules/chibi/cp_loader_s3m.h111
-rw-r--r--modules/chibi/cp_loader_xm.cpp752
-rw-r--r--modules/chibi/cp_loader_xm.h89
-rw-r--r--modules/chibi/cp_mixer.h115
-rw-r--r--modules/chibi/cp_note.h102
-rw-r--r--modules/chibi/cp_order.h43
-rw-r--r--modules/chibi/cp_pattern.cpp574
-rw-r--r--modules/chibi/cp_pattern.h94
-rw-r--r--modules/chibi/cp_player_data.cpp151
-rw-r--r--modules/chibi/cp_player_data.h582
-rw-r--r--modules/chibi/cp_player_data_control.cpp324
-rw-r--r--modules/chibi/cp_player_data_effects.cpp1232
-rw-r--r--modules/chibi/cp_player_data_envelopes.cpp89
-rw-r--r--modules/chibi/cp_player_data_events.cpp679
-rw-r--r--modules/chibi/cp_player_data_filter.cpp89
-rw-r--r--modules/chibi/cp_player_data_nna.cpp144
-rw-r--r--modules/chibi/cp_player_data_notes.cpp345
-rw-r--r--modules/chibi/cp_player_data_utils.cpp138
-rw-r--r--modules/chibi/cp_sample.cpp203
-rw-r--r--modules/chibi/cp_sample.h112
-rw-r--r--modules/chibi/cp_sample_defs.h97
-rw-r--r--modules/chibi/cp_sample_manager.cpp78
-rw-r--r--modules/chibi/cp_sample_manager.h99
-rw-r--r--modules/chibi/cp_song.cpp957
-rw-r--r--modules/chibi/cp_song.h261
-rw-r--r--modules/chibi/cp_tables.cpp254
-rw-r--r--modules/chibi/cp_tables.h67
-rw-r--r--modules/chibi/event_stream_chibi.cpp872
-rw-r--r--modules/chibi/event_stream_chibi.h314
-rw-r--r--modules/chibi/register_types.cpp41
-rw-r--r--modules/chibi/register_types.h30
-rw-r--r--modules/cscript/config.py7
-rw-r--r--modules/cscript/godot_c.h14
-rw-r--r--modules/cscript/register_types.cpp2
-rw-r--r--modules/cscript/register_types.h2
-rw-r--r--modules/dds/config.py5
-rw-r--r--modules/dds/register_types.cpp2
-rw-r--r--modules/dds/register_types.h2
-rw-r--r--modules/dds/texture_loader_dds.cpp51
-rw-r--r--modules/dds/texture_loader_dds.h2
-rw-r--r--modules/enet/SCsub32
-rw-r--r--modules/enet/config.py5
-rw-r--r--modules/enet/networked_multiplayer_enet.cpp31
-rw-r--r--modules/enet/networked_multiplayer_enet.h4
-rw-r--r--modules/enet/register_types.cpp4
-rw-r--r--modules/enet/register_types.h2
-rw-r--r--modules/etc1/SCsub4
-rw-r--r--modules/etc1/config.py5
-rw-r--r--modules/etc1/image_etc.cpp40
-rw-r--r--modules/etc1/image_etc.h2
-rw-r--r--modules/etc1/register_types.cpp2
-rw-r--r--modules/etc1/register_types.h2
-rw-r--r--modules/etc1/texture_loader_pkm.cpp10
-rw-r--r--modules/freetype/SCsub118
-rw-r--r--modules/freetype/config.py5
-rw-r--r--modules/freetype/register_types.cpp2
-rw-r--r--modules/freetype/register_types.h2
-rw-r--r--modules/freetype/uwpdef.h (renamed from modules/freetype/winrtdef.h)4
-rw-r--r--modules/gdscript/config.py7
-rw-r--r--modules/gdscript/gd_compiler.cpp207
-rw-r--r--modules/gdscript/gd_compiler.h6
-rw-r--r--modules/gdscript/gd_editor.cpp211
-rw-r--r--modules/gdscript/gd_function.cpp167
-rw-r--r--modules/gdscript/gd_function.h4
-rw-r--r--modules/gdscript/gd_functions.cpp213
-rw-r--r--modules/gdscript/gd_functions.h6
-rw-r--r--modules/gdscript/gd_parser.cpp845
-rw-r--r--modules/gdscript/gd_parser.h56
-rw-r--r--modules/gdscript/gd_script.cpp95
-rw-r--r--modules/gdscript/gd_script.h12
-rw-r--r--modules/gdscript/gd_tokenizer.cpp54
-rw-r--r--modules/gdscript/gd_tokenizer.h5
-rw-r--r--modules/gdscript/register_types.cpp12
-rw-r--r--modules/gdscript/register_types.h2
-rw-r--r--modules/gridmap/config.py8
-rw-r--r--modules/gridmap/grid_map.cpp153
-rw-r--r--modules/gridmap/grid_map.h8
-rw-r--r--modules/gridmap/grid_map_editor_plugin.cpp99
-rw-r--r--modules/gridmap/grid_map_editor_plugin.h6
-rw-r--r--modules/gridmap/register_types.cpp6
-rw-r--r--modules/gridmap/register_types.h2
-rw-r--r--modules/ik/SCsub7
-rw-r--r--modules/ik/config.py11
-rw-r--r--modules/ik/ik.cpp326
-rw-r--r--modules/ik/ik.h74
-rw-r--r--modules/ik/register_types.cpp47
-rw-r--r--modules/ik/register_types.h30
-rw-r--r--modules/jpg/SCsub4
-rw-r--r--modules/jpg/config.py5
-rw-r--r--modules/jpg/image_loader_jpegd.cpp18
-rw-r--r--modules/jpg/image_loader_jpegd.h2
-rw-r--r--modules/jpg/register_types.cpp2
-rw-r--r--modules/jpg/register_types.h2
-rw-r--r--modules/mpc/SCsub28
-rw-r--r--modules/mpc/audio_stream_mpc.cpp414
-rw-r--r--modules/mpc/audio_stream_mpc.h146
-rw-r--r--modules/mpc/config.py6
-rw-r--r--modules/ogg/SCsub18
-rw-r--r--modules/ogg/config.py6
-rw-r--r--modules/ogg/register_types.cpp2
-rw-r--r--modules/ogg/register_types.h2
-rw-r--r--modules/openssl/SCsub1328
-rw-r--r--modules/openssl/config.py5
-rw-r--r--modules/openssl/register_types.cpp4
-rw-r--r--modules/openssl/register_types.h2
-rw-r--r--modules/openssl/stream_peer_openssl.cpp36
-rw-r--r--modules/openssl/stream_peer_openssl.h10
-rw-r--r--modules/opus/SCsub395
-rw-r--r--modules/opus/audio_stream_opus.cpp4
-rw-r--r--modules/opus/audio_stream_opus.h8
-rw-r--r--modules/opus/config.py6
-rw-r--r--modules/opus/register_types.cpp4
-rw-r--r--modules/opus/register_types.h2
-rw-r--r--modules/pbm/bitmap_loader_pbm.cpp24
-rw-r--r--modules/pbm/bitmap_loader_pbm.h2
-rw-r--r--modules/pbm/config.py5
-rw-r--r--modules/pbm/register_types.cpp2
-rw-r--r--modules/pbm/register_types.h2
-rw-r--r--modules/pvr/SCsub12
-rw-r--r--modules/pvr/config.py5
-rw-r--r--modules/pvr/register_types.cpp2
-rw-r--r--modules/pvr/register_types.h2
-rw-r--r--modules/pvr/texture_loader_pvr.cpp140
-rw-r--r--modules/pvr/texture_loader_pvr.h2
-rw-r--r--modules/regex/config.py3
-rw-r--r--modules/regex/regex.cpp47
-rw-r--r--modules/regex/regex.h6
-rw-r--r--modules/regex/register_types.cpp8
-rw-r--r--modules/regex/register_types.h2
-rw-r--r--modules/register_module_types.h2
-rw-r--r--modules/squish/SCsub32
-rw-r--r--modules/squish/config.py13
-rw-r--r--modules/squish/image_compress_squish.cpp30
-rw-r--r--modules/squish/image_compress_squish.h2
-rw-r--r--modules/squish/register_types.cpp2
-rw-r--r--modules/squish/register_types.h2
-rw-r--r--modules/stb_vorbis/SCsub10
-rw-r--r--modules/stb_vorbis/audio_stream_ogg_vorbis.cpp236
-rw-r--r--modules/stb_vorbis/audio_stream_ogg_vorbis.h84
-rw-r--r--modules/stb_vorbis/config.py (renamed from modules/chibi/config.py)5
-rw-r--r--modules/stb_vorbis/register_types.cpp (renamed from modules/mpc/register_types.cpp)19
-rw-r--r--modules/stb_vorbis/register_types.h (renamed from modules/mpc/register_types.h)6
-rw-r--r--modules/theora/SCsub128
-rw-r--r--modules/theora/config.py6
-rw-r--r--modules/theora/register_types.cpp4
-rw-r--r--modules/theora/register_types.h2
-rw-r--r--modules/theora/video_stream_theora.cpp35
-rw-r--r--modules/theora/video_stream_theora.h8
-rw-r--r--modules/theora/yuv2rgb.h3
-rw-r--r--modules/visual_script/config.py7
-rw-r--r--modules/visual_script/register_types.cpp106
-rw-r--r--modules/visual_script/register_types.h2
-rw-r--r--modules/visual_script/visual_script.cpp142
-rw-r--r--modules/visual_script/visual_script.h12
-rw-r--r--modules/visual_script/visual_script_builtin_funcs.cpp118
-rw-r--r--modules/visual_script/visual_script_builtin_funcs.h3
-rw-r--r--modules/visual_script/visual_script_editor.cpp194
-rw-r--r--modules/visual_script/visual_script_editor.h6
-rw-r--r--modules/visual_script/visual_script_expression.h2
-rw-r--r--modules/visual_script/visual_script_flow_control.cpp70
-rw-r--r--modules/visual_script/visual_script_flow_control.h16
-rw-r--r--modules/visual_script/visual_script_func_nodes.cpp174
-rw-r--r--modules/visual_script/visual_script_func_nodes.h8
-rw-r--r--modules/visual_script/visual_script_nodes.cpp173
-rw-r--r--modules/visual_script/visual_script_nodes.h52
-rw-r--r--modules/visual_script/visual_script_yield_nodes.cpp32
-rw-r--r--modules/visual_script/visual_script_yield_nodes.h4
-rw-r--r--modules/vorbis/SCsub70
-rw-r--r--modules/vorbis/audio_stream_ogg_vorbis.cpp8
-rw-r--r--modules/vorbis/audio_stream_ogg_vorbis.h6
-rw-r--r--modules/vorbis/config.py6
-rw-r--r--modules/vorbis/register_types.cpp4
-rw-r--r--modules/vorbis/register_types.h2
-rw-r--r--modules/webm/SCsub28
-rw-r--r--modules/webm/config.py6
-rw-r--r--modules/webm/libvpx/SCsub599
-rw-r--r--modules/webm/libvpx/yasm_osx_fat.py36
-rw-r--r--modules/webm/register_types.cpp4
-rw-r--r--modules/webm/register_types.h2
-rw-r--r--modules/webm/video_stream_webm.cpp12
-rw-r--r--modules/webm/video_stream_webm.h8
-rw-r--r--modules/webp/SCsub218
-rw-r--r--modules/webp/config.py5
-rw-r--r--modules/webp/image_loader_webp.cpp54
-rw-r--r--modules/webp/image_loader_webp.h2
-rw-r--r--modules/webp/register_types.cpp2
-rw-r--r--modules/webp/register_types.h2
205 files changed, 4631 insertions, 16858 deletions
diff --git a/modules/SCsub b/modules/SCsub
index 4084248086..4b9c08cf78 100644
--- a/modules/SCsub
+++ b/modules/SCsub
@@ -6,18 +6,18 @@ env_modules = env.Clone()
Export('env_modules')
-env.modules_sources=[
- "register_module_types.cpp",
+env.modules_sources = [
+ "register_module_types.cpp",
]
-#env.add_source_files(env.modules_sources,"*.cpp")
+# env.add_source_files(env.modules_sources,"*.cpp")
Export('env')
for x in env.module_list:
- if (x in env.disabled_modules):
- continue
- env_modules.Append(CPPFLAGS=["-DMODULE_"+x.upper()+"_ENABLED"])
- SConscript(x+"/SCsub")
+ if (x in env.disabled_modules):
+ continue
+ env_modules.Append(CPPFLAGS=["-DMODULE_" + x.upper() + "_ENABLED"])
+ SConscript(x + "/SCsub")
-lib = env_modules.Library("modules",env.modules_sources)
+lib = env_modules.Library("modules", env.modules_sources)
env.Prepend(LIBS=[lib])
diff --git a/modules/chibi/SCsub b/modules/chibi/SCsub
deleted file mode 100644
index dffd966753..0000000000
--- a/modules/chibi/SCsub
+++ /dev/null
@@ -1,9 +0,0 @@
-#!/usr/bin/env python
-
-Import('env')
-Import('env_modules')
-
-env_chibi = env_modules.Clone()
-
-# Godot source files
-env_chibi.add_source_files(env.modules_sources, "*.cpp")
diff --git a/modules/chibi/cp_config.h b/modules/chibi/cp_config.h
deleted file mode 100644
index 2ad704ace7..0000000000
--- a/modules/chibi/cp_config.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/*************************************************************************/
-/* cp_config.h */
-/*************************************************************************/
-/* This file is part of: */
-/* GODOT ENGINE */
-/* http://www.godotengine.org */
-/*************************************************************************/
-/* Copyright (c) 2007-2016 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 CP_CONFIG_H
-#define CP_CONFIG_H
-
-
-#include "typedefs.h"
-#include "error_macros.h"
-#include "math_funcs.h"
-#include "os/memory.h"
-#include "os/copymem.h"
-
-#define CP_PRINTERR(m_err) ERR_PRINT(m_err)
-#define CP_ERR_COND(m_cond) ERR_FAIL_COND(m_cond)
-#define CP_ERR_COND_V(m_cond,m_ret) ERR_FAIL_COND_V(m_cond,m_ret)
-#define CP_FAIL_INDEX(m_index,m_size) ERR_FAIL_INDEX(m_index,m_size)
-#define CP_FAIL_INDEX_V(m_index,m_size,m_ret) ERR_FAIL_INDEX_V(m_index,m_size,m_ret)
-#define cp_intabs(m_val) ABS(m_val)
-
-#define CP_ALLOC(m_mem) memalloc(m_mem)
-#define CP_REALLOC(m_mem,m_size) memrealloc(m_mem,m_size)
-#define CP_FREE(m_mem) memfree(m_mem)
-
-#define cp_memzero(m_mem,m_size) zeromem(m_mem,m_size)
-
-#endif // CP_CONFIG_H
diff --git a/modules/chibi/cp_envelope.cpp b/modules/chibi/cp_envelope.cpp
deleted file mode 100644
index 9892b6d4b0..0000000000
--- a/modules/chibi/cp_envelope.cpp
+++ /dev/null
@@ -1,369 +0,0 @@
-/*************************************************************************/
-/* cp_envelope.cpp */
-/*************************************************************************/
-/* This file is part of: */
-/* GODOT ENGINE */
-/* http://www.godotengine.org */
-/*************************************************************************/
-/* Copyright (c) 2007-2016 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 "cp_envelope.h"
-
-
-CPEnvelope::CPEnvelope() {
-
-
- reset();
-}
-
-void CPEnvelope::reset() {
-
-
-
- on=false;
- carry=false;
- loop_on=false;
- loop_begin_node=0;
- loop_end_node=0;
- sustain_loop_on=false;
- sustain_loop_begin_node=0;
- sustain_loop_end_node=0;
- node_count=0;
-
-}
-
-int CPEnvelope::get_height_at_pos(int pos) {
-
- if (node_count && pos>node[node_count-1].tick_offset)
- return node[node_count-1].value;
-
- int begin_x,begin_y;
- int end_x,end_y,xdif;
- int count=0;
- int limit=-1;
-
- if (node_count<2) return NO_POINT;
-
- while ((count<node_count) && (limit==-1)) {
-
- if (node[count].tick_offset>=pos) limit=count;
- count++;
- }
-
- if (pos==0) return node[0].value;
-
- if (limit==-1) return NO_POINT;
-
- begin_x=node[limit-1].tick_offset;
- end_x=node[limit].tick_offset;
- begin_y=node[limit-1].value;
- end_y=node[limit].value;
-
- xdif=end_x-begin_x;
- return begin_y+((pos-begin_x)*(end_y-begin_y))/(xdif?xdif:1);
-}
-
-/*
-int CPEnvelope::get_fx_height_at_pos(int pos) {
-
- if (node_count && pos>node[node_count-1].tick_offset)
- return node[node_count-1].value<<FX_HEIGHT_BITS;
-
- int begin_x,begin_y;
- int end_x,end_y,xdif;
- int count=0;
- int limit=-1;
-
- if (node_count<2) return NO_POINT;
-
- while ((count<node_count) && (limit==-1)) {
-
- if (node[count].tick_offset>=pos) limit=count;
- count++;
- }
-
- if (pos==0) return node[0].value<<FX_HEIGHT_BITS;
-
- if (limit==-1) return NO_POINT;
-
- begin_x=node[limit-1].tick_offset;
- end_x=node[limit].tick_offset;
- begin_y=node[limit-1].value;
- end_y=node[limit].value;
-
- xdif=end_x-begin_x;
- return (begin_y<<FX_HEIGHT_BITS)+((pos-begin_x)*(end_y-begin_y)*(int)(1<<FX_HEIGHT_BITS))/(xdif?xdif:1);
-}
-*/
-
-float CPEnvelope::get_interp_height_at_pos(float pos) {
-
- if (node_count && pos>node[node_count-1].tick_offset)
- return node[node_count-1].value;
-
- int begin_x,begin_y;
- int end_x,end_y,xdif;
- int count=0;
- int limit=-1;
-
- if (node_count<2) return NO_POINT;
-
- while ((count<node_count) && (limit==-1)) {
-
- if (node[count].tick_offset>=pos) limit=count;
- count++;
- }
-
- if (pos==0) return node[0].value;
-
- if (limit==-1) return NO_POINT;
-
- begin_x=node[limit-1].tick_offset;
- end_x=node[limit].tick_offset;
- begin_y=node[limit-1].value;
- end_y=node[limit].value;
-
- xdif=end_x-begin_x;
- return begin_y+((pos-begin_x)*(end_y-begin_y))/(xdif?xdif:1);
-}
-
-void CPEnvelope::set_position(int p_node,int p_x,int p_y) {
-
- if (p_node>=node_count) return;
-
-
-
- if (p_node==0) {
-
- p_x=0;
-
- } else if (p_x<=node[p_node-1].tick_offset) {
-
- p_x=node[p_node-1].tick_offset+1;
-
- } else if ((p_node<(node_count-1)) && (p_x>=node[p_node+1].tick_offset)) {
-
- p_x=node[p_node+1].tick_offset-1;
- }
-
- if (p_x>=9999) p_x=9999;
-
- if (p_y>max_value) p_y=max_value;
- if (p_y<min_value) p_y=min_value;
-
-
- node[p_node].tick_offset=p_x;
- node[p_node].value=p_y;
-
-
-
-}
-
-int CPEnvelope::add_position(int p_x,int p_y,bool p_move_loops) {
-
- if (node_count==MAX_POINTS) return -1;
-
-
- int i,new_node;
-
- // if this is assigning an existing node, let's quit.
- for (i=0;i<node_count;i++) if (p_x==node[i].tick_offset) return -1;
-
-
- i=0;
- while ((i<node_count) && (p_x>=node[i].tick_offset)) i++;
-
- new_node=i;
- node_count++;
-
- if (p_move_loops) {
- if (loop_begin_node>=new_node) loop_begin_node++;
- if (loop_end_node>=new_node) loop_end_node++;
- if (sustain_loop_begin_node>=new_node) sustain_loop_begin_node++;
- if (sustain_loop_end_node>=new_node) sustain_loop_end_node++;
- }
- for (i=node_count-1;i>new_node;i--) node[i]=node[i-1];
-
-
-
- set_position(new_node,p_x,p_y);
-
-
-
- return new_node;
-
-}
-
-void CPEnvelope::set_loop_begin(int pos) {
-
- if ((pos<0) || (pos>=node_count)) return;
-
-
-
- loop_begin_node=pos;
-
- if (loop_end_node<loop_begin_node) loop_end_node=loop_begin_node;
-
-
-
-}
-
-void CPEnvelope::set_loop_end(int pos) {
-
- if ((pos<0) || (pos>=node_count)) return;
-
-
-
- loop_end_node=pos;
-
- if (loop_end_node<loop_begin_node) loop_begin_node=loop_end_node;
-
-
-
-
-}
-
-
-void CPEnvelope::set_sustain_loop_begin(int pos) {
-
- if ((pos<0) || (pos>=node_count)) return;
-
-
-
- sustain_loop_begin_node=pos;
-
- if (sustain_loop_end_node<sustain_loop_begin_node) sustain_loop_end_node=sustain_loop_begin_node;
-
-
-
-}
-
-void CPEnvelope::set_sustain_loop_end(int pos) {
-
- if ((pos<0) || (pos>=node_count)) return;
-
-
-
- sustain_loop_end_node=pos;
-
- if (sustain_loop_end_node<sustain_loop_begin_node) sustain_loop_begin_node=sustain_loop_end_node;
-
-
-
-}
-
-void CPEnvelope::set_loop_enabled(bool p_enabled) {
-
- loop_on=p_enabled;
-}
-bool CPEnvelope::is_loop_enabled() {
-
- return loop_on;
-}
-
-
-void CPEnvelope::set_sustain_loop_enabled(bool p_enabled) {
-
- sustain_loop_on=p_enabled;
-}
-bool CPEnvelope::is_sustain_loop_enabled() {
-
- return sustain_loop_on;
-}
-
-void CPEnvelope::del_position(int p_node) {
-
- if ((node_count<3) || (p_node<=0) || (p_node>=node_count)) return;
-
-
-
- int i;
-
- if (loop_begin_node>=p_node) loop_begin_node--;
- if (loop_end_node>=p_node) loop_end_node--;
- if (sustain_loop_begin_node>=p_node) sustain_loop_begin_node--;
- if (sustain_loop_end_node>=p_node) sustain_loop_end_node--;
-
- for (i=p_node;i<node_count-1;i++) node[i]=node[i+1];
-
- node_count--;
-
-
-
-}
-
-uint8_t CPEnvelope::get_loop_begin() {
-
-
- return loop_begin_node;
-}
-uint8_t CPEnvelope::get_loop_end() {
-
- return loop_end_node;
-}
-
-uint8_t CPEnvelope::get_sustain_loop_begin() {
-
-
- return sustain_loop_begin_node;
-}
-uint8_t CPEnvelope::get_sustain_loop_end() {
-
- return sustain_loop_end_node;
-}
-
-
-
-void CPEnvelope::set_enabled(bool p_enabled) {
-
- on=p_enabled;
-}
-
-bool CPEnvelope::is_enabled() {
-
- return on;
-}
-
-void CPEnvelope::set_carry_enabled(bool p_enabled) {
-
- carry=p_enabled;
-}
-bool CPEnvelope::is_carry_enabled() {
-
- return carry;
-}
-
-uint8_t CPEnvelope::get_node_count() {
-
- return node_count;
-}
-
-const CPEnvelope::Point& CPEnvelope::get_node(int p_idx) {
-
- if (p_idx<0 || p_idx>=node_count)
- return node[node_count-1];
-
- return node[p_idx];
-
-}
-
-
diff --git a/modules/chibi/cp_envelope.h b/modules/chibi/cp_envelope.h
deleted file mode 100644
index d1ada53f7d..0000000000
--- a/modules/chibi/cp_envelope.h
+++ /dev/null
@@ -1,129 +0,0 @@
-/*************************************************************************/
-/* cp_envelope.h */
-/*************************************************************************/
-/* This file is part of: */
-/* GODOT ENGINE */
-/* http://www.godotengine.org */
-/*************************************************************************/
-/* Copyright (c) 2007-2016 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 CP_ENVELOPE_H
-#define CP_ENVELOPE_H
-
-#include "cp_config.h"
-
-/**envelope?
- *@author Juan Linietsky
- */
-
-/******************************
- envelope.h
- ----------
-
-Proovides an envelope, and basic functions
-for it that can be used for both player
-and interface
-********************************/
-
-
-class CPEnvelope {
- enum {
-
- MAX_POINTS=25
- };
-
- struct Point {
-
- uint16_t tick_offset;
- int16_t value;
- };
-
- Point node[MAX_POINTS];
-
- int8_t node_count;
-
- bool on;
- bool carry;
-
- bool loop_on;
-
- uint8_t loop_begin_node;
- uint8_t loop_end_node;
-
- bool sustain_loop_on;
- uint8_t sustain_loop_begin_node;
- uint8_t sustain_loop_end_node;
-
-
- int8_t max_value;
- int8_t min_value;
-
-
-public:
- enum {
-
- NO_POINT=-5000,
- };
-
- void set_max(int8_t p_max) { max_value=p_max; }
- int8_t get_max() { return max_value; }
- void set_min(int8_t p_min) { min_value=p_min; }
- int8_t get_min() { return min_value; }
-
- uint8_t get_node_count();
- const Point& get_node(int p_idx);
-
- void set_position(int p_node,int p_x,int p_y);
- int add_position(int p_x,int p_y,bool p_move_loops=true);
- void del_position(int p_node);
-
- void set_loop_enabled(bool p_enabled);
- bool is_loop_enabled();
- void set_loop_begin(int pos);
- void set_loop_end(int pos);
- uint8_t get_loop_begin();
- uint8_t get_loop_end();
-
- void set_sustain_loop_enabled(bool p_enabled);
- bool is_sustain_loop_enabled();
- void set_sustain_loop_begin(int pos);
- void set_sustain_loop_end(int pos);
- uint8_t get_sustain_loop_begin();
- uint8_t get_sustain_loop_end();
-
- void set_enabled(bool p_enabled);
- bool is_enabled();
-
- void set_carry_enabled(bool p_enabled);
- bool is_carry_enabled();
-
- void reset();
- int get_height_at_pos(int pos);
- float get_interp_height_at_pos(float pos);
-
-
- CPEnvelope();
-
-};
-
-#endif
diff --git a/modules/chibi/cp_file_access_wrapper.h b/modules/chibi/cp_file_access_wrapper.h
deleted file mode 100644
index 5b361c0ea8..0000000000
--- a/modules/chibi/cp_file_access_wrapper.h
+++ /dev/null
@@ -1,96 +0,0 @@
-/*************************************************************************/
-/* cp_file_access_wrapper.h */
-/*************************************************************************/
-/* This file is part of: */
-/* GODOT ENGINE */
-/* http://www.godotengine.org */
-/*************************************************************************/
-/* Copyright (c) 2007-2016 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 CP_FILE_ACCESS_WRAPPER_H
-#define CP_FILE_ACCESS_WRAPPER_H
-
-#include "cp_config.h"
-
-class CPFileAccessWrapper {
-public:
-
- enum ModeFlags {
-
- READ=1,
- WRITE=2,
- READ_WRITE=3,
- };
-
- enum Error {
-
- OK,
- ERROR_FILE_NOT_FOUND,
- ERROR_FILE_BAD_DRIVE,
- ERROR_FILE_BAD_PATH,
- ERROR_FILE_NO_PERMISSION,
- ERROR_ALREADY_IN_USE,
- ERROR_INVALID_PARAMETERS,
- ERROR_OPENING_FILE,
- ERROR_READING_FILE,
- ERROR_WRITING_FILE
- };
-
- virtual Error open(const char *p_filename, int p_mode_flags)=0;
- virtual void close()=0;
-
- virtual void seek(uint32_t p_position)=0;
- virtual void seek_end()=0;
- virtual uint32_t get_pos()=0;
-
- virtual bool eof_reached()=0;
-
- virtual uint8_t get_byte()=0;
- virtual void get_byte_array(uint8_t *p_dest,int p_elements)=0;
- virtual void get_word_array(uint16_t *p_dest,int p_elements)=0;
-
- virtual uint16_t get_word()=0;
- virtual uint32_t get_dword()=0;
-
- // use this for files WRITTEN in _big_ endian machines (ie, amiga/mac)
- // It's not about the current CPU type but file formats.
- // this flags get reset to false (little endian) on each open
- virtual void set_endian_conversion(bool p_swap)=0;
- virtual bool is_open()=0;
-
- virtual Error get_error()=0;
-
- virtual void store_byte(uint8_t p_dest)=0;
- virtual void store_byte_array(const uint8_t *p_dest,int p_elements)=0;
-
- virtual void store_word(uint16_t p_dest)=0;
- virtual void store_dword(uint32_t p_dest)=0;
-
-
-
- virtual ~CPFileAccessWrapper(){}
-
-};
-
-
-
-#endif
diff --git a/modules/chibi/cp_instrument.cpp b/modules/chibi/cp_instrument.cpp
deleted file mode 100644
index 7a732e33a4..0000000000
--- a/modules/chibi/cp_instrument.cpp
+++ /dev/null
@@ -1,344 +0,0 @@
-/*************************************************************************/
-/* cp_instrument.cpp */
-/*************************************************************************/
-/* This file is part of: */
-/* GODOT ENGINE */
-/* http://www.godotengine.org */
-/*************************************************************************/
-/* Copyright (c) 2007-2016 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 "cp_instrument.h"
-#include "cp_song.h"
-#include "cp_note.h"
-
-
-
-const char *CPInstrument::get_name() {
-
- return name;
-
-}
-void CPInstrument::set_name(const char *p_name) {
-
-
- if (p_name==NULL) {
- name[0]=0;
- return;
- }
-
-
- bool done=false;
- for (int i=0;i<MAX_NAME_LEN;i++) {
-
-
- name[i]=done?0:p_name[i];
- if (!done && p_name[i]==0)
- done=true;
- }
-
- name[MAX_NAME_LEN-1]=0; /* just in case */
-
-
-}
-
-void CPInstrument::set_sample_number(uint8_t p_note,uint8_t p_sample_id) {
-
- CP_ERR_COND(p_note>=CPNote::NOTES);
- CP_ERR_COND(p_sample_id>CPSong::MAX_SAMPLES && p_sample_id!=CPNote::EMPTY);
- data.sample_number[p_note]=p_sample_id;
-
-
-}
-uint8_t CPInstrument::get_sample_number(uint8_t p_note) {
-
- CP_ERR_COND_V(p_note>=CPNote::NOTES,0);
- return data.sample_number[p_note];
-}
-
-void CPInstrument::set_note_number(uint8_t p_note,uint8_t p_note_id) {
-
- CP_ERR_COND(p_note>=CPNote::NOTES);
- CP_ERR_COND(p_note_id>=CPNote::NOTES && p_note_id!=CPNote::EMPTY);
- data.note_number[p_note]=p_note_id;
-
-}
-uint8_t CPInstrument::get_note_number(uint8_t p_note) {
-
- CP_ERR_COND_V(p_note>=CPNote::NOTES,0);
- return data.note_number[p_note];
-
-}
-
-void CPInstrument::set_NNA_type(NNA_Type p_NNA_type) {
-
- data.NNA_type=p_NNA_type;
-}
-CPInstrument::NNA_Type CPInstrument::get_NNA_type() {
-
- return data.NNA_type;
-}
-
-void CPInstrument::set_DC_type(DC_Type p_DC_type) {
-
- data.DC_type=p_DC_type;
-}
-CPInstrument::DC_Type CPInstrument::get_DC_type() {
-
- return data.DC_type;
-
-}
-
-void CPInstrument::set_DC_action(DC_Action p_DC_action) {
-
- data.DC_action=p_DC_action;
-}
-CPInstrument::DC_Action CPInstrument::get_DC_action() {
-
- return data.DC_action;
-}
-
-/* Volume */
-
-void CPInstrument::set_volume_global_amount(uint8_t p_amount) {
-
- CP_ERR_COND(p_amount>MAX_VOLUME);
- data.volume.global_amount=p_amount;
-
-}
-uint8_t CPInstrument::get_volume_global_amount() {
-
- return data.volume.global_amount;
-}
-
-void CPInstrument::set_volume_fadeout(uint16_t p_amount) {
- CP_ERR_COND(p_amount>MAX_FADEOUT);
- data.volume.fadeout=p_amount;
-}
-uint16_t CPInstrument::get_volume_fadeout() {
-
- return data.volume.fadeout;
-}
-void CPInstrument::set_volume_random_variation(uint8_t p_amount) {
-
- CP_ERR_COND(p_amount>MAX_VOLUME_RANDOM);
- data.volume.random_variation=p_amount;
-}
-uint8_t CPInstrument::get_volume_random_variation() {
-
- return data.volume.random_variation;
-}
-
-/* Panning */
-
-void CPInstrument::set_pan_default_amount(uint8_t p_amount) {
-
- CP_ERR_COND(p_amount>MAX_PAN);
- data.pan.default_amount=p_amount;
-}
-uint8_t CPInstrument::get_pan_default_amount() {
-
- return data.pan.default_amount;
-}
-
-void CPInstrument::set_pan_default_enabled(bool p_enabled) {
-
- data.pan.use_default=p_enabled;
-}
-bool CPInstrument::is_pan_default_enabled() {
-
- return data.pan.use_default;
-
-}
-
-void CPInstrument::set_pan_pitch_separation(int8_t p_amount) {
-
- CP_ERR_COND(p_amount<-32);
- CP_ERR_COND(p_amount>32);
- data.pan.pitch_separation=p_amount;
-}
-int8_t CPInstrument::get_pan_pitch_separation() {
-
- return data.pan.pitch_separation;
-}
-
-void CPInstrument::set_pan_pitch_center(uint8_t p_amount) {
-
- CP_ERR_COND(p_amount>=CPNote::NOTES);
- data.pan.pitch_center=p_amount;
-}
-uint8_t CPInstrument::get_pan_pitch_center() {
-
- return data.pan.pitch_center;
-}
-
-void CPInstrument::set_pan_random_variation(uint8_t p_amount) {
-
- CP_ERR_COND(p_amount>MAX_PAN_RANDOM);
- data.pan.random_variation=p_amount;
-}
-uint8_t CPInstrument::get_pan_random_variation() {
-
- return data.pan.random_variation;
-}
-
-/* Pitch / Filter */
-
-void CPInstrument::set_pitch_use_as_filter(bool p_enabled) {
-
- data.pitch.use_as_filter=p_enabled;
-}
-bool CPInstrument::is_pitch_use_as_filter() {
-
- return data.pitch.use_as_filter;
-}
-
-void CPInstrument::set_filter_use_default_cutoff(bool p_enabled) {
-
- data.pitch.use_default_cutoff=p_enabled;
-
-}
-bool CPInstrument::filter_use_default_cutoff() {
-
- return data.pitch.use_default_cutoff;
-}
-
-void CPInstrument::set_filter_default_cutoff(uint8_t p_amount) {
-
- CP_ERR_COND(p_amount>MAX_FILTER_CUTOFF);
- data.pitch.default_cutoff=p_amount;
-}
-uint8_t CPInstrument::get_filter_default_cutoff() {
-
- return data.pitch.default_cutoff;
-}
-
-void CPInstrument::set_filter_use_default_resonance(bool p_enabled) {
-
- data.pitch.use_default_resonance=p_enabled;
-}
-bool CPInstrument::filter_use_default_resonance() {
-
- return data.pitch.use_default_resonance;
-}
-
-void CPInstrument::set_filter_default_resonance(uint8_t p_amount) {
-
- CP_ERR_COND(p_amount>MAX_FILTER_RESONANCE);
- data.pitch.default_resonance=p_amount;
-
-}
-uint8_t CPInstrument::get_filter_default_resonance() {
-
- return data.pitch.default_resonance;
-}
-
-/* Envelopes */
-
-
-CPEnvelope* CPInstrument::get_volume_envelope() {
-
- return &data.volume.envelope;
-}
-CPEnvelope* CPInstrument::get_pan_envelope() {
-
- return &data.pan.envelope;
-}
-CPEnvelope* CPInstrument::get_pitch_filter_envelope() {
-
- return &data.pitch.envelope;
-
-
-}
-
-
-void CPInstrument::reset() {
-
- name[0]=0;
-
- data.NNA_type=NNA_NOTE_CUT;
- data.DC_action=DCA_NOTE_CUT;
- data.DC_type=DCT_DISABLED;
-
- for (int i=0;i<CPNote::NOTES;i++) {
-
- data.sample_number[i]=CPNote::EMPTY;
- data.note_number[i]=i;
- }
-
- data.volume.envelope.reset();
- data.volume.envelope.set_max(64);
- data.volume.envelope.set_min(0);
- data.volume.envelope.add_position(0,64,false);
- data.volume.envelope.add_position(30,64,false);
-
- data.volume.global_amount=MAX_VOLUME;
- data.volume.fadeout=0;
- data.volume.random_variation=0;
-
- data.pan.envelope.reset();
- data.pan.envelope.set_max(32);
- data.pan.envelope.set_min(-32);
- data.pan.envelope.add_position(0,0,false);
- data.pan.envelope.add_position(30,0,false);
-
- data.pan.default_amount=32;
- data.pan.pitch_center=48;
- data.pan.pitch_separation=0;
- data.pan.use_default=false;
- data.pan.random_variation=0;
-
-
- data.pitch.envelope.reset();
- data.pitch.envelope.set_max(32);
- data.pitch.envelope.set_min(-32);
- data.pitch.envelope.add_position(0,0,false);
- data.pitch.envelope.add_position(30,0,false);
- data.pitch.use_as_filter=false;
- data.pitch.use_default_cutoff=false;
- data.pitch.use_default_resonance=false;
- data.pitch.default_cutoff=0;
- data.pitch.default_resonance=0;
-
-}
-
-bool CPInstrument::is_empty() {
-
- bool has_sample=false;
-
- for (int i=0;i<CPNote::NOTES;i++) {
-
- if (data.sample_number[i]!=CPNote::EMPTY) {
-
- has_sample=true;
- break;
- }
- }
-
- return !has_sample;
-}
-
-CPInstrument::CPInstrument() {
-
- reset();
-
-}
-
diff --git a/modules/chibi/cp_instrument.h b/modules/chibi/cp_instrument.h
deleted file mode 100644
index d8eb8333ee..0000000000
--- a/modules/chibi/cp_instrument.h
+++ /dev/null
@@ -1,219 +0,0 @@
-/*************************************************************************/
-/* cp_instrument.h */
-/*************************************************************************/
-/* This file is part of: */
-/* GODOT ENGINE */
-/* http://www.godotengine.org */
-/*************************************************************************/
-/* Copyright (c) 2007-2016 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 CP_INSTRUMENT_H
-#define CP_INSTRUMENT_H
-
-
-#include "cp_config.h"
-#include "cp_note.h"
-#include "cp_envelope.h"
-
-class CPInstrument {
-public:
-
-
- enum NNA_Type {
-
- NNA_NOTE_CUT,
- NNA_NOTE_CONTINUE,
- NNA_NOTE_OFF,
- NNA_NOTE_FADE
- };
-
- enum DC_Type {
-
- DCT_DISABLED,
- DCT_NOTE,
- DCT_SAMPLE,
- DCT_INSTRUMENT
- };
-
- enum DC_Action
- {
-
- DCA_NOTE_CUT,
- DCA_NOTE_OFF,
- DCA_NOTE_FADE,
- };
-
- enum EnvelopeType {
- VOLUME_ENVELOPE,
- PAN_ENVELOPE,
- PITCH_ENVELOPE
- };
-
-
- enum {
- MAX_NAME_LEN=26,
- MAX_ENVELOPE_NODES=25,
- ENVELOPE_FRAC_BITS=8,
- MAX_VOLUME=128,
- MAX_FADEOUT=256,
- MAX_PAN=128,
- MAX_VOLUME_RANDOM=100,
- MAX_PAN_RANDOM=64, //what did this guy have inside his head?
-
- MAX_FILTER_CUTOFF=127,
- MAX_FILTER_RESONANCE=127
-
- };
-
-
- struct Data {
-
-
- uint8_t sample_number[CPNote::NOTES];
- uint8_t note_number[CPNote::NOTES];
-
- NNA_Type NNA_type;
- DC_Type DC_type;
- DC_Action DC_action;
-
- struct Volume {
-
- CPEnvelope envelope;
- uint8_t global_amount;
- uint16_t fadeout;
- uint8_t random_variation;
-
- } volume;
-
- struct Pan {
-
- CPEnvelope envelope;
- bool use_default;
- uint8_t default_amount;
- int8_t pitch_separation;
- uint8_t pitch_center;
- uint8_t random_variation;
-
- } pan;
-
- struct Pitch {
-
- CPEnvelope envelope;
- bool use_as_filter;
- bool use_default_cutoff;
- uint8_t default_cutoff;
- bool use_default_resonance;
- uint8_t default_resonance;
- } pitch;
-
- };
-
-private:
-
-
-
- Data data;
- char name[MAX_NAME_LEN];
-
-public:
-
- /* CPInstrument General */
-
- const char *get_name();
- void set_name(const char *p_name);
-
- void set_sample_number(uint8_t p_note,uint8_t p_sample_id);
- uint8_t get_sample_number(uint8_t p_note);
-
- void set_note_number(uint8_t p_note,uint8_t p_note_id);
- uint8_t get_note_number(uint8_t p_note);
-
- void set_NNA_type(NNA_Type p_NNA_type);
- NNA_Type get_NNA_type();
-
- void set_DC_type(DC_Type p_DC_type);
- DC_Type get_DC_type();
-
- void set_DC_action(DC_Action p_DC_action);
- DC_Action get_DC_action();
-
- /* Volume */
-
- void set_volume_global_amount(uint8_t p_amount);
- uint8_t get_volume_global_amount();
-
- void set_volume_fadeout(uint16_t p_amount);
- uint16_t get_volume_fadeout();
-
- void set_volume_random_variation(uint8_t p_amount);
- uint8_t get_volume_random_variation();
-
- /* Panning */
-
- void set_pan_default_amount(uint8_t p_amount);
- uint8_t get_pan_default_amount();
-
- void set_pan_default_enabled(bool p_enabled);
- bool is_pan_default_enabled();
-
- void set_pan_pitch_separation(int8_t p_amount);
- int8_t get_pan_pitch_separation();
-
- void set_pan_pitch_center(uint8_t p_amount);
- uint8_t get_pan_pitch_center();
-
- void set_pan_random_variation(uint8_t p_amount);
- uint8_t get_pan_random_variation();
-
- /* Pitch / Filter */
-
- void set_pitch_use_as_filter(bool p_enabled);
- bool is_pitch_use_as_filter();
-
- void set_filter_use_default_cutoff(bool p_enabled);
- bool filter_use_default_cutoff();
-
- void set_filter_default_cutoff(uint8_t p_amount);
- uint8_t get_filter_default_cutoff();
-
- void set_filter_use_default_resonance(bool p_enabled);
- bool filter_use_default_resonance();
-
- void set_filter_default_resonance(uint8_t p_amount);
- uint8_t get_filter_default_resonance();
-
- CPEnvelope* get_volume_envelope();
- CPEnvelope* get_pan_envelope();
- CPEnvelope* get_pitch_filter_envelope();
-
- bool is_empty();
-
- void reset();
- CPInstrument();
-
-};
-
-
-
-#endif
-
-
diff --git a/modules/chibi/cp_loader.h b/modules/chibi/cp_loader.h
deleted file mode 100644
index 9d1074d1b8..0000000000
--- a/modules/chibi/cp_loader.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/*************************************************************************/
-/* cp_loader.h */
-/*************************************************************************/
-/* This file is part of: */
-/* GODOT ENGINE */
-/* http://www.godotengine.org */
-/*************************************************************************/
-/* Copyright (c) 2007-2016 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 CP_LOADER_H
-#define CP_LOADER_H
-
-
-#include "cp_song.h"
-#include "cp_file_access_wrapper.h"
-/**
- @author Juan Linietsky <reduzio@gmail.com>
-*/
-class CPLoader {
-
-public:
-
- enum Error {
- FILE_OK,
- FILE_UNRECOGNIZED,
- FILE_CANNOT_OPEN,
- FILE_CORRUPTED,
- FILE_OUT_OF_MEMORY,
- };
-
-
- virtual bool can_load_song()=0;
- virtual bool can_load_sample()=0;
- virtual bool can_load_instrument()=0;
-
- virtual Error load_song(const char *p_file,CPSong *p_song,bool p_sampleset)=0;
- virtual Error load_sample(const char *p_file,CPSample *p_sample)=0;
- virtual Error load_instrument(const char *p_file,CPSong *p_song,int p_instr_idx)=0;
-
-
- virtual ~CPLoader() {}
-
-};
-
-#endif
diff --git a/modules/chibi/cp_loader_it.cpp b/modules/chibi/cp_loader_it.cpp
deleted file mode 100644
index 20a3960a23..0000000000
--- a/modules/chibi/cp_loader_it.cpp
+++ /dev/null
@@ -1,216 +0,0 @@
-/*************************************************************************/
-/* cp_loader_it.cpp */
-/*************************************************************************/
-/* This file is part of: */
-/* GODOT ENGINE */
-/* http://www.godotengine.org */
-/*************************************************************************/
-/* Copyright (c) 2007-2016 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 "cp_loader_it.h"
-
-bool CPLoader_IT::can_load_song() { return true; }
-bool CPLoader_IT::can_load_sample() { return true; }
-bool CPLoader_IT::can_load_instrument() { return true; }
-
-CPLoader::Error CPLoader_IT::load_song(const char *p_file,CPSong *p_song, bool p_sampleset) {
-
-
- song=p_song;
-
- if (file->open( p_file, CPFileAccessWrapper::READ )!=CPFileAccessWrapper::OK)
- return CPLoader::FILE_CANNOT_OPEN;
-
-
- Error err;
-
- char aux_identifier[4];
- file->get_byte_array((uint8_t*)aux_identifier,4);
-
- if ( aux_identifier[0]!='I' ||
- aux_identifier[1]!='M' ||
- aux_identifier[2]!='P' ||
- aux_identifier[3]!='M') {
-
-
- CP_PRINTERR("IT CPLoader CPSong: Failed Identifier");
- return FILE_UNRECOGNIZED;
- }
-
-
- if (p_sampleset) {
-
- song->reset(false,true,true,false);
-
- if ((err=load_header(true))) {
- file->close();
- return err;
- }
-
- if ((err=load_samples())) {
- file->close();
- return err;
- }
-
- if ((err=load_instruments())) {
- file->close();
- return err;
- }
-
- return FILE_OK;
- }
-
- song->reset();
-
- if ((err=load_header(false))) {
- file->close();
- return err;
- }
-
- if ((err=load_orders())) {
- file->close();
- return err;
- }
-
- if ((err=load_patterns())) {
- file->close();
- return err;
- }
-
- if ((err=load_samples())) {
- file->close();
- return err;
- }
-
- if ((err=load_effects())) {
- file->close();
- return err;
- }
-
- if ((err=load_instruments())) {
- file->close();
- return err;
- }
-
- if ((err=load_message())) {
- file->close();
- return err;
- }
-
- file->close();
- return FILE_OK;
-
-}
-
-
-
-
-CPLoader::Error CPLoader_IT::load_sample(const char *p_file,CPSample *p_sample) {
-
- if (file->open( p_file, CPFileAccessWrapper::READ )!=CPFileAccessWrapper::OK)
- return CPLoader::FILE_CANNOT_OPEN;
-
- p_sample->reset();
- CPLoader::Error res=load_sample(p_sample);
-
- file->close();
-
- return res;
-}
-CPLoader::Error CPLoader_IT::load_instrument(const char *p_file,CPSong *p_song,int p_instr_idx) {
-
- CP_FAIL_INDEX_V(p_instr_idx,CPSong::MAX_INSTRUMENTS,CPLoader::FILE_CANNOT_OPEN);
-
- if (file->open( p_file, CPFileAccessWrapper::READ )!=CPFileAccessWrapper::OK)
- return CPLoader::FILE_CANNOT_OPEN;
-
-
- p_song->get_instrument( p_instr_idx )->reset();
-
-
- int samples=0;
- CPLoader::Error res=load_instrument( p_song->get_instrument( p_instr_idx ), &samples );
-
- if (res) {
- file->close();
- return res;
- }
-
-
- char exchange[CPSong::MAX_SAMPLES];
- for (int i=0;i<CPSong::MAX_SAMPLES;i++)
- exchange[i]=0;
-
- for (int i=0;i<samples;i++) {
-
- file->seek( 554+i*80 ); //i think this should work?! seems to.. but i'm not sure
-
- /* find free sample */
-
- int free_idx=-1;
- for (int s=0;s<CPSong::MAX_SAMPLES;s++) {
-
- if (p_song->get_sample( s )->get_sample_data().is_null()) {
- free_idx=s;
- break;
- }
- }
- if (free_idx==-1)
- break; //can't seem to be able to load more samples
-
- exchange[i]=free_idx;
- res=load_sample( p_song->get_sample( free_idx ) );
-
- if (res) {
-
- file->close();
- return res;
- }
- }
-
- for (int i=0;i<CPNote::NOTES;i++) {
-
- int smp=song->get_instrument(p_instr_idx)->get_sample_number(i);
-
- if (smp>=CPSong::MAX_SAMPLES)
- continue;
-
- if (smp<0)
- continue;
-
- smp=exchange[smp];
-
- song->get_instrument(p_instr_idx)->set_sample_number(i,smp);
-
- }
-
- file->close();
-
- return res;
-
-}
-
-CPLoader_IT::CPLoader_IT(CPFileAccessWrapper *p_file) {
-
- file=p_file;
-
-}
diff --git a/modules/chibi/cp_loader_it.h b/modules/chibi/cp_loader_it.h
deleted file mode 100644
index 38a1cdd9c4..0000000000
--- a/modules/chibi/cp_loader_it.h
+++ /dev/null
@@ -1,125 +0,0 @@
-/*************************************************************************/
-/* cp_loader_it.h */
-/*************************************************************************/
-/* This file is part of: */
-/* GODOT ENGINE */
-/* http://www.godotengine.org */
-/*************************************************************************/
-/* Copyright (c) 2007-2016 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 CP_LOADER_IT_H
-#define CP_LOADER_IT_H
-
-#include "cp_loader.h"
-/**
- *@author Juan Linietsky
- */
-
-/******************************
- loader_it.h
- ----------
-Impulse Tracker Module CPLoader!
-It lacks support for old
-instrument files methinks...
-and some other things like
-midi.
-********************************/
-
-class AuxSampleData; //used for internal crap
-
-class CPLoader_IT : public CPLoader {
-
-
-
- CPFileAccessWrapper *file;
- CPSong *song;
-
- struct IT_Header {
- uint8_t blank01[2];
- uint16_t ordnum;
- uint16_t insnum;
- uint16_t smpnum;
- uint16_t patnum;
- uint16_t cwt; /* Created with tracker (y.xx = 0x0yxx) */
- uint16_t cmwt; /* Compatible with tracker ver > than val. */
- uint16_t flags;
- uint16_t special; /* bit 0 set = song message attached */
- uint16_t msglength;
- uint32_t msgoffset;
- bool is_chibi;
- };
-
- /* Variables to store temp data */
- IT_Header header;
-
- /* CPSong Info Methods */
- Error load_header(bool p_dont_set);
- Error load_orders();
- Error load_message();
-
- /* CPPattern Methods */
- Error load_patterns();
-
- /* CPSample Methods */
-
- Error load_samples();
- Error load_sample(CPSample *p_sample);
- CPSample_ID load_sample_data(AuxSampleData& p_sample_data);
-
- // CPSample decompression
-
- uint32_t read_n_bits_from_IT_compressed_block(uint8_t p_bits_to_read);
- bool read_IT_compressed_block (bool p_16bits);
- void free_IT_compressed_block ();
- bool load_sample_8bits_IT_compressed(void *p_dest_buffer,int p_buffsize);
- bool load_sample_16bits_IT_compressed(void *p_dest_buffer,int p_buffsize);
- uint32_t *source_buffer; /* source buffer */
- uint32_t *source_position; /* actual reading position */
- uint8_t source_remaining_bits; /* bits remaining in read dword */
- uint8_t* pat_data;
-
- /* CPInstruments Methods */
- Error load_effects();
- Error load_instruments();
- Error load_instrument(CPInstrument *p_instrument,int *p_samples=0);
- void load_envelope(CPEnvelope *p_envelope,bool*p_has_filter_flag=0);
-
-
-public:
-
-
- bool can_load_song();
- bool can_load_sample();
- bool can_load_instrument();
-
- Error load_song(const char *p_file,CPSong *p_song, bool p_sampleset=false);
- Error load_sample(const char *p_file,CPSample *p_sample);
- Error load_instrument(const char *p_file,CPSong *p_song,int p_instr_idx);
-
- CPLoader_IT(CPFileAccessWrapper *p_file);
-
-};
-
-
-
-#endif
diff --git a/modules/chibi/cp_loader_it_info.cpp b/modules/chibi/cp_loader_it_info.cpp
deleted file mode 100644
index 0360f7f9a4..0000000000
--- a/modules/chibi/cp_loader_it_info.cpp
+++ /dev/null
@@ -1,268 +0,0 @@
-/*************************************************************************/
-/* cp_loader_it_info.cpp */
-/*************************************************************************/
-/* This file is part of: */
-/* GODOT ENGINE */
-/* http://www.godotengine.org */
-/*************************************************************************/
-/* Copyright (c) 2007-2016 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 "cp_loader_it.h"
-
-
-
-CPLoader::Error CPLoader_IT::load_header(bool p_dont_set) {
-
-
- char aux_songname[26];
-
- file->get_byte_array((uint8_t*)aux_songname,26);
- if (!p_dont_set)
- song->set_name( aux_songname );
-
- uint8_t aux_hlmin=file->get_byte();
- uint8_t aux_hlmaj=file->get_byte();
-
- if (aux_hlmin==0) aux_hlmin=4;
- if (aux_hlmaj==0) aux_hlmaj=16;
-
- if (!p_dont_set) {
- song->set_row_highlight_minor( aux_hlmin );
- song->set_row_highlight_major( aux_hlmaj );
- }
-
- header.ordnum=file->get_word();
- header.insnum=file->get_word();
- header.smpnum=file->get_word();
- header.patnum=file->get_word();
-
- header.cwt=file->get_word(); /* Created with tracker (y.xx = 0x0yxx) */
- header.cmwt=file->get_word(); /* Compatible with tracker ver > than val. */
- header.flags=file->get_word();
-
- if (!p_dont_set) {
- song->set_stereo( header.flags & 1 );
- song->set_linear_slides( header.flags & 8 );
- song->set_old_effects( header.flags & 16 );
- song->set_compatible_gxx( header.flags & 32 );
- song->set_instruments( header.flags & 4 );
- }
-
-
- header.special=file->get_word();
- if (!p_dont_set) {
-
- song->set_global_volume( file->get_byte() );
- song->set_mixing_volume( file->get_byte() );
- song->set_speed( file->get_byte() );
- song->set_tempo( file->get_byte() );
- song->set_stereo_separation( file->get_byte() );
-
- } else {
-
- file->get_byte(); // skip
- file->get_byte(); // skip
- file->get_byte(); // skip
- file->get_byte(); // skip
- file->get_byte(); // skip
- }
- file->get_byte(); // ZERO Byte
- header.msglength=file->get_word();
- header.msgoffset=file->get_dword();
- char chibi[4];
- file->get_byte_array((uint8_t*)chibi,4);
- header.is_chibi=(chibi[0]=='C' && chibi[1]=='H' && chibi[2]=='B' && chibi[3]=='I');
-
- for (int i=0;i<64;i++) {
-
- uint8_t panbyte=file->get_byte();
-
- uint8_t pan_dst=(panbyte<65) ? panbyte : 32;
- bool surround_dst=(panbyte==100);
- bool mute_dst=(panbyte>=128);
-
- if (!p_dont_set) {
- song->set_channel_pan( i, pan_dst );
- song->set_channel_surround( i, surround_dst );
- song->set_channel_mute( i, mute_dst );
- }
- }
- for (int i=0;i<64;i++) {
- unsigned char cv = file->get_byte();
- if (!p_dont_set)
- song->set_channel_volume( i, cv );
- }
-
- CP_ERR_COND_V( file->eof_reached(),FILE_CORRUPTED );
- CP_ERR_COND_V( file->get_error(),FILE_CORRUPTED );
-
- return FILE_OK;
-}
-
-CPLoader::Error CPLoader_IT::load_effects() {
-
- if (!header.is_chibi)
- return FILE_OK; //no effects, regular IT file
-
- /* GOTO End of IT header */
- file->seek(0xC0+header.ordnum+header.insnum*4+header.smpnum*4+header.patnum*4);
-
-
- if (file->get_byte()>0) //not made with this version, ignore extended info
- return FILE_OK;
-
- /* Chibitracker Extended info */
-
- switch(file->get_byte()) {
-
- case CPSong::REVERB_MODE_ROOM: {
-
- song->set_reverb_mode( CPSong::REVERB_MODE_ROOM );
- } break;
- case CPSong::REVERB_MODE_STUDIO_SMALL: {
-
- song->set_reverb_mode( CPSong::REVERB_MODE_STUDIO_SMALL );
-
- } break;
- case CPSong::REVERB_MODE_STUDIO_MEDIUM: {
-
- song->set_reverb_mode( CPSong::REVERB_MODE_STUDIO_MEDIUM );
-
- } break;
- case CPSong::REVERB_MODE_STUDIO_LARGE: {
-
- song->set_reverb_mode( CPSong::REVERB_MODE_STUDIO_LARGE );
-
- } break;
- case CPSong::REVERB_MODE_HALL: {
-
- song->set_reverb_mode( CPSong::REVERB_MODE_HALL );
-
- } break;
- case CPSong::REVERB_MODE_SPACE_ECHO: {
-
- song->set_reverb_mode( CPSong::REVERB_MODE_SPACE_ECHO );
-
- } break;
-
- case CPSong::REVERB_MODE_ECHO: {
-
- song->set_reverb_mode( CPSong::REVERB_MODE_ECHO );
-
- } break;
- case CPSong::REVERB_MODE_DELAY: {
-
- song->set_reverb_mode( CPSong::REVERB_MODE_DELAY );
-
- } break;
- case CPSong::REVERB_MODE_HALF_ECHO: {
-
- song->set_reverb_mode( CPSong::REVERB_MODE_HALF_ECHO );
-
- } break;
-
- }
-
- //chorus
- song->set_chorus_speed_hz10( file->get_byte() );
- song->set_chorus_delay_ms( file->get_byte() );
- song->set_chorus_depth_ms10( file->get_byte() );
- song->set_chorus_separation_ms( file->get_byte() );
-
- for (int i=0;i<CPPattern::WIDTH;i++) {
- song->set_channel_reverb(i,file->get_byte());
- }
- for (int i=0;i<CPPattern::WIDTH;i++) {
- song->set_channel_chorus(i,file->get_byte());
- }
-
- return FILE_OK;
-
-}
-
-CPLoader::Error CPLoader_IT::load_message() {
-
-
- if (!(header.special & 1)) {
-
- return FILE_OK;
- }
-
-
- file->seek(header.msgoffset);
-
- //(void*)tmpmsg=malloc(header.msglength+1);
-
- char message[8000];
-
-
- char *tmpmsg = message;
-
- file->get_byte_array((uint8_t*)tmpmsg,header.msglength);
- tmpmsg[header.msglength]=0;
-
- for (int i=0;i<header.msglength;i++) if (tmpmsg[i]=='\r') tmpmsg[i]='\n';
-
- song->set_message(tmpmsg);
-
- return FILE_OK;
-}
-
-CPLoader::Error CPLoader_IT::load_orders() {
-
- file->seek(0xC0);
-
-
- for (int i=0;i<header.ordnum;i++) {
-
- uint8_t aux_order=file->get_byte();
- CPOrder order=CP_ORDER_NONE;
-
-
- if (i>=CPSong::MAX_ORDERS)
- continue;
- if (aux_order==254) {
-
- order=CP_ORDER_BREAK;
-
- } else if (aux_order<200) {
-
- order=aux_order;
- //nothing!
-
- }
- song->set_order(i,order);
-
- }
-
- if (file->eof_reached() || file->get_error()) {
-
-
- return FILE_CORRUPTED;
-
- }
-
- return FILE_OK;
-}
-
-
-
diff --git a/modules/chibi/cp_loader_it_instruments.cpp b/modules/chibi/cp_loader_it_instruments.cpp
deleted file mode 100644
index ccb24bd81c..0000000000
--- a/modules/chibi/cp_loader_it_instruments.cpp
+++ /dev/null
@@ -1,224 +0,0 @@
-/*************************************************************************/
-/* cp_loader_it_instruments.cpp */
-/*************************************************************************/
-/* This file is part of: */
-/* GODOT ENGINE */
-/* http://www.godotengine.org */
-/*************************************************************************/
-/* Copyright (c) 2007-2016 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 "cp_loader_it.h"
-
-enum EnvFlags {
- ENV_ON=1,
- ENV_LOOP=2,
- ENV_SUSLOOP=4,
- ENV_CARRY=8,
- ENV_FILTER=128
-};
-
-void CPLoader_IT::load_envelope(CPEnvelope *p_envelope,bool*p_has_filter_flag) {
-
- uint8_t flags=file->get_byte();
- uint8_t points=file->get_byte();
- uint8_t begin=file->get_byte();
- uint8_t end=file->get_byte();
- uint8_t susbegin=file->get_byte();
- uint8_t susend=file->get_byte();
-
- p_envelope->reset();
-
- for (int i=0;i<25;i++) {
-
- uint8_t height=file->get_byte();
- int8_t &signed_height=(int8_t&)height;
- uint16_t tick=file->get_word();
-
- if (i>=points)
- continue;
- p_envelope->add_position( tick, signed_height );
-
- }
-
- p_envelope->set_enabled( flags & ENV_ON );
- p_envelope->set_carry_enabled( flags & ENV_CARRY);
-
- p_envelope->set_loop_enabled( flags & ENV_LOOP );
- p_envelope->set_loop_begin( begin );
- p_envelope->set_loop_end( end );
-
- p_envelope->set_sustain_loop_enabled( flags & ENV_SUSLOOP );
- p_envelope->set_sustain_loop_begin( susbegin );
- p_envelope->set_sustain_loop_end( susend );
-
- if (p_has_filter_flag)
- *p_has_filter_flag=flags&ENV_FILTER;
-
- file->get_byte(); //zerobyte
-
- //fill with stuff if the envelope hass less than 2 points
- while(p_envelope->get_node_count()<2) {
-
- p_envelope->add_position( 30*p_envelope->get_node_count(), p_envelope->get_min()==0 ? 64 : 0, false );
- }
-}
-
-
-CPLoader::Error CPLoader_IT::load_instrument(CPInstrument *p_instrument,int *p_samples) {
-
-
-
- char aux_header[4];
-
- file->get_byte_array((uint8_t*)aux_header,4);
-
-
- if ( aux_header[0]!='I' ||
- aux_header[1]!='M' ||
- aux_header[2]!='P' ||
- aux_header[3]!='I') {
- CP_PRINTERR("IT CPLoader CPInstrument: Failed Identifier");
-
- return FILE_UNRECOGNIZED;
- }
-
-
-
- // Ignore deprecated 8.3 filename field
- for (int i=0;i<12;i++) file->get_byte();
-
- //Ignore zerobyte
- file->get_byte(); /* (byte) CPInstrument type (always 0) */
-
- switch( file->get_byte() ) { /* New CPNote Action [0,1,2,3] */
- case 0: p_instrument->set_NNA_type( CPInstrument::NNA_NOTE_CUT ) ; break;
- case 1: p_instrument->set_NNA_type( CPInstrument::NNA_NOTE_CONTINUE ) ; break;
- case 2: p_instrument->set_NNA_type( CPInstrument::NNA_NOTE_OFF ) ; break;
- case 3: p_instrument->set_NNA_type( CPInstrument::NNA_NOTE_FADE ) ; break;
- };
- switch( file->get_byte() ) { // Duplicate Check Type
- case 0: p_instrument->set_DC_type( CPInstrument::DCT_DISABLED ); break ;
- case 1: p_instrument->set_DC_type( CPInstrument::DCT_NOTE ); break ;
- case 2: p_instrument->set_DC_type( CPInstrument::DCT_SAMPLE ); break ;
- case 3: p_instrument->set_DC_type( CPInstrument::DCT_INSTRUMENT ); break ;
- }
- switch( file->get_byte() ) { //Duplicate Check Action
- case 0: p_instrument->set_DC_action( CPInstrument::DCA_NOTE_CUT ); break ;
- case 1: p_instrument->set_DC_action( CPInstrument::DCA_NOTE_OFF ); break ;
- case 2: p_instrument->set_DC_action( CPInstrument::DCA_NOTE_FADE ); break ;
- }
-
- int fade = file->get_word();
- //intf("AFADE: %i\n",fade);
- if (fade>CPInstrument::MAX_FADEOUT) //needs to be clipped because of horrible modplug doings
- fade=CPInstrument::MAX_FADEOUT;
-
- p_instrument->set_volume_fadeout( fade );
- p_instrument->set_pan_pitch_separation( file->get_byte() );
- p_instrument->set_pan_pitch_center( file->get_byte() );
- p_instrument->set_volume_global_amount( file->get_byte() );
- uint8_t pan=file->get_byte();
- p_instrument->set_pan_default_amount(pan&0x7F);
- p_instrument->set_pan_default_enabled( !(pan&0x80) );
- p_instrument->set_volume_random_variation( file->get_byte() );
- p_instrument->set_pan_random_variation( file->get_byte() );
-
-
-
- file->get_word(); //empty (version)
- uint8_t samples=file->get_byte();
- if (p_samples)
- *p_samples=samples;
- file->get_byte(); //empty
- char aux_name[26];
- file->get_byte_array((uint8_t*)aux_name,26);
- p_instrument->set_name(aux_name);
-
- uint8_t cutoff=file->get_byte();
-
- p_instrument->set_filter_default_cutoff(cutoff&0x7F);
- p_instrument->set_filter_use_default_cutoff(cutoff&0x80);
-
- uint8_t resonance=file->get_byte();
-
- p_instrument->set_filter_default_resonance(resonance&0x7F);
- p_instrument->set_filter_use_default_resonance(resonance&0x80);
-
- file->get_dword(); //MIDI, IGNORED!
-
- /* CPNote -> CPSample table */
- for (uint8_t i=0;i<CPNote::NOTES;i++) {
-
-
- uint8_t note=file->get_byte();
- if (note>=CPNote::NOTES)
- note=0;
- p_instrument->set_note_number(i,note);
-
- uint8_t samp=file->get_byte();
- if (samp==0 || samp>99)
- samp=CPNote::EMPTY;
- else
- samp--;
-
-
- p_instrument->set_sample_number(i,samp);
-
-
- }
-
-
- load_envelope( p_instrument->get_volume_envelope() );
- load_envelope( p_instrument->get_pan_envelope() );
- bool use_as_filter;
- load_envelope( p_instrument->get_pitch_filter_envelope(), &use_as_filter );
- p_instrument->set_pitch_use_as_filter( use_as_filter );
-
- return FILE_OK;
-
-}
-
-
-CPLoader::Error CPLoader_IT::load_instruments() {
-
-
- for (int i=0;i<header.insnum;i++) {
-
-
- file->seek(0xC0+header.ordnum+i*4);
- uint32_t final_location=file->get_dword();
- file->seek( final_location );
-
- Error err=load_instrument( song->get_instrument( i ) );
- if (err)
- return err;
-
- }
-
- return FILE_OK;
-
- if (file->eof_reached() || file->get_error())
- return FILE_CORRUPTED;
-}
-
-
diff --git a/modules/chibi/cp_loader_it_patterns.cpp b/modules/chibi/cp_loader_it_patterns.cpp
deleted file mode 100644
index d951a91620..0000000000
--- a/modules/chibi/cp_loader_it_patterns.cpp
+++ /dev/null
@@ -1,166 +0,0 @@
-/*************************************************************************/
-/* cp_loader_it_patterns.cpp */
-/*************************************************************************/
-/* This file is part of: */
-/* GODOT ENGINE */
-/* http://www.godotengine.org */
-/*************************************************************************/
-/* Copyright (c) 2007-2016 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 "cp_loader_it.h"
-
-
-CPLoader::Error CPLoader_IT::load_patterns() {
-
-
- for (int i=0;i<header.patnum;i++) {
-
- if (i>=CPSong::MAX_PATTERNS)
- break;
-
- /* Position where pattern offsets are stored */
- file->seek(0xC0+header.ordnum+header.insnum*4+header.smpnum*4+i*4);
- uint32_t pattern_offset=file->get_dword();
-
- if (pattern_offset==0) {
-
- continue;
- }
-
- uint16_t pat_size;
- uint16_t pat_length;
-
- int row=0,flag,channel,j;
- uint8_t aux_byte;
- uint32_t reserved;
- uint8_t chan_mask[64]; //mask cache for each
- CPNote last_value[64]; //last value of each
-
- for (j=0;j<64;j++) {
-
- chan_mask[j]=0;
- last_value[j].clear();
- }
-
- file->seek(pattern_offset);
-
- pat_size=file->get_word();
- pat_length=file->get_word();
- reserved=file->get_dword();
-
- song->get_pattern(i)->set_length( pat_length );
-
- do {
-
- aux_byte=file->get_byte();
- flag=aux_byte;
-
- if ( flag==0 ) {
-
- row++;
- } else {
-
- channel=(flag-1) & 63;
-
- if ( flag & 128 ) {
-
- aux_byte=file->get_byte();
- chan_mask[channel]=aux_byte;
- }
-
- CPNote note; //note used for reading
-
- if ( chan_mask[channel]&1 ) { // read note
-
- aux_byte=file->get_byte();
-
- if ( aux_byte<120 )
- note.note=aux_byte;
- else if ( aux_byte==255 )
- note.note=CPNote::OFF;
- else if ( aux_byte==254 )
- note.note=CPNote::CUT;
-
- last_value[channel].note=note.note;
- }
-
-
- if ( chan_mask[channel]&2 ) {
-
- aux_byte=file->get_byte();
- if ( aux_byte<100 )
- note.instrument=aux_byte-1;
-
- last_value[channel].instrument=note.instrument;
- }
- if ( chan_mask[channel]&4 ) {
-
- aux_byte=file->get_byte();
- if ( aux_byte<213 )
- note.volume=aux_byte;
-
- last_value[channel].volume=note.volume;
- }
- if ( chan_mask[channel]&8 ) {
-
- aux_byte=file->get_byte();
- if ( aux_byte>0 )
- note.command=aux_byte-1;
-
-
- last_value[channel].command=note.command;
-
- note.parameter=file->get_byte();
-
- last_value[channel].parameter=note.parameter;
- }
-
- if ( chan_mask[channel]&16 ) {
-
- note.note=last_value[channel].note;
- }
-
- if ( chan_mask[channel]&32 ) {
-
- note.instrument=last_value[channel].instrument;
- }
- if ( chan_mask[channel]&64 ) {
-
- note.volume=last_value[channel].volume;
- }
- if ( chan_mask[channel]&128 ) {
-
- note.command=last_value[channel].command;
- note.parameter=last_value[channel].parameter;
- }
-
- song->get_pattern(i)->set_note(channel,row,note);
- }
-
-
- } while(row<pat_length);
-
- }
-
- return FILE_OK;
-}
-
diff --git a/modules/chibi/cp_loader_it_samples.cpp b/modules/chibi/cp_loader_it_samples.cpp
deleted file mode 100644
index ced7252a6c..0000000000
--- a/modules/chibi/cp_loader_it_samples.cpp
+++ /dev/null
@@ -1,620 +0,0 @@
-/*************************************************************************/
-/* cp_loader_it_samples.cpp */
-/*************************************************************************/
-/* This file is part of: */
-/* GODOT ENGINE */
-/* http://www.godotengine.org */
-/*************************************************************************/
-/* Copyright (c) 2007-2016 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 "cp_loader_it.h"
-#include "cp_sample.h"
-
-struct AuxSampleData {
-
-
- uint32_t fileofs;
- uint32_t c5spd;
- uint32_t length;
- uint32_t loop_begin;
- uint32_t loop_end;
- bool loop_enabled;
- bool pingpong_enabled;
- bool is16bit;
- bool stereo;
- bool exists;
- bool compressed;
-
-};
-
-
-enum IT_Sample_Flags {
-
- IT_SAMPLE_EXISTS=1,
- IT_SAMPLE_16BITS=2,
- IT_SAMPLE_STEREO=4,
- IT_SAMPLE_COMPRESSED=8,
- IT_SAMPLE_LOOPED=16,
- IT_SAMPLE_SUSTAIN_LOOPED=32,
- IT_SAMPLE_LOOP_IS_PINGPONG=64,
- IT_SAMPLE_SUSTAIN_LOOP_IS_PINGPONG=128
-};
-
-
-CPLoader::Error CPLoader_IT::load_sample(CPSample *p_sample) {
-
-
- AuxSampleData aux_sample_data;
-
- char aux_header[4];
-
- file->get_byte_array((uint8_t*)aux_header,4);
-
- if ( aux_header[0]!='I' ||
- aux_header[1]!='M' ||
- aux_header[2]!='P' ||
- aux_header[3]!='S') {
-
- //CP_PRINTERR("IT CPLoader CPSample: Failed Identifier");
- return FILE_UNRECOGNIZED;
- }
-
-
- // Ignore deprecated 8.3 filename
- for (int i=0;i<12;i++) file->get_byte();
-
- file->get_byte(); //ignore zerobyte
-
- p_sample->set_global_volume( file->get_byte() );
-
- /* SAMPLE FLAGS */
- uint8_t flags=file->get_byte();
- aux_sample_data.loop_enabled=flags&IT_SAMPLE_LOOPED;
- aux_sample_data.pingpong_enabled=flags&IT_SAMPLE_LOOP_IS_PINGPONG;
- aux_sample_data.is16bit=flags&IT_SAMPLE_16BITS;
- aux_sample_data.exists=flags&IT_SAMPLE_EXISTS;
- aux_sample_data.stereo=flags&IT_SAMPLE_STEREO;
- aux_sample_data.compressed=flags&IT_SAMPLE_COMPRESSED;
-
- p_sample->set_default_volume(file->get_byte());
- /* SAMPLE NAME */
- char aux_name[26];
- file->get_byte_array((uint8_t*)aux_name,26);
- p_sample->set_name(aux_name);
-
- // ??
- uint8_t convert_flag=file->get_byte();
- // PAN
- uint8_t pan=file->get_byte();
- p_sample->set_pan( pan&0x7F );
- p_sample->set_pan_enabled( pan & 0x80 );
-
- aux_sample_data.length=file->get_dword();
-
-
- aux_sample_data.loop_begin= file->get_dword();
- aux_sample_data.loop_end= file->get_dword();
- aux_sample_data.c5spd=file->get_dword();
- /*p_sample->data.set_sustain_loop_begin=*/file->get_dword();
- /*p_sample->data.sustain_loop_end=*/file->get_dword();
- aux_sample_data.fileofs=file->get_dword();
- p_sample->set_vibrato_speed( file->get_byte() );
- p_sample->set_vibrato_depth( file->get_byte() );
- p_sample->set_vibrato_rate( file->get_byte() );
- switch( file->get_byte() ) {
- /* Vibrato Wave: 0=sine, 1=rampdown, 2=square, 3=random */
- case 0: p_sample->set_vibrato_type( CPSample::VIBRATO_SINE ); break;
- case 1: p_sample->set_vibrato_type( CPSample::VIBRATO_SAW ); break;
- case 2: p_sample->set_vibrato_type( CPSample::VIBRATO_SQUARE ); break;
- case 3: p_sample->set_vibrato_type( CPSample::VIBRATO_RANDOM ); break;
- default: p_sample->set_vibrato_type( CPSample::VIBRATO_SINE ); break;
- }
-
- //printf("Name %s - Flags: fileofs :%i - c5spd %i - len %i 16b %i - data?: %i\n",p_sample->get_name(),aux_sample_data.fileofs,aux_sample_data.c5spd, aux_sample_data.length, aux_sample_data.is16bit,aux_sample_data.exists);
- CPSample_ID samp_id;
-
- if (aux_sample_data.exists) {
- samp_id=load_sample_data(aux_sample_data);
- CPSampleManager::get_singleton()->set_c5_freq(samp_id,aux_sample_data.c5spd);
- CPSampleManager::get_singleton()->set_loop_begin( samp_id,aux_sample_data.loop_begin );
- CPSampleManager::get_singleton()->set_loop_end( samp_id,aux_sample_data.loop_end );
- CPSample_Loop_Type loop_type=aux_sample_data.loop_enabled?( aux_sample_data.pingpong_enabled? CP_LOOP_BIDI: CP_LOOP_FORWARD):CP_LOOP_NONE;
- CPSampleManager::get_singleton()->set_loop_end( samp_id,aux_sample_data.loop_end );
- CPSampleManager::get_singleton()->set_loop_type( samp_id, loop_type);
-
- }
-
- //printf("Loaded id is null?: %i\n",samp_id.is_null());
- p_sample->set_sample_data(samp_id);
- if (!samp_id.is_null()) {
-
- // printf("Loaded ID: stereo: %i len %i 16bit %i\n",CPSampleManager::get_singleton()->is_stereo(samp_id), CPSampleManager::get_singleton()->get_size( samp_id), CPSampleManager::get_singleton()->is_16bits( samp_id) );
- }
-
- CP_ERR_COND_V( file->eof_reached(),FILE_CORRUPTED );
- CP_ERR_COND_V( file->get_error(),FILE_CORRUPTED );
-
- return FILE_OK;
-
-}
-
-CPSample_ID CPLoader_IT::load_sample_data(AuxSampleData& p_sample_data) {
-
-
- int aux_sample_properties = (p_sample_data.is16bit?IT_SAMPLE_16BITS:0)|(p_sample_data.compressed?IT_SAMPLE_COMPRESSED:0)|(p_sample_data.stereo?IT_SAMPLE_STEREO:0);
-
- file->seek(p_sample_data.fileofs);
-
- CPSampleManager *sm=CPSampleManager::get_singleton();
-
- CPSample_ID id;
-
- switch (aux_sample_properties) {
-
- case (0): // 8 bits, mono
- case (IT_SAMPLE_16BITS): // 16 bits mono
- case (IT_SAMPLE_STEREO): // 8 bits stereo
- case (IT_SAMPLE_16BITS|IT_SAMPLE_STEREO): { // 16 bits mono
-
- id=sm->create(p_sample_data.is16bit,p_sample_data.stereo,p_sample_data.length);
- if (id.is_null())
- break;
-
- sm->lock_data(id);
-
- int16_t *ptr16 = (int16_t*)sm->get_data(id);
- int8_t *ptr8=(int8_t*)ptr16;
-
- int chans=p_sample_data.stereo?2:1;
-
- if (p_sample_data.is16bit) {
-
- for (int c=0;c<chans;c++) {
-
- for (int i=0;i<p_sample_data.length;i++) {
-
- ptr16[i*chans+c]=file->get_word();
- }
- }
- } else {
-
- for (int c=0;c<chans;c++) {
-
- for (int i=0;i<p_sample_data.length;i++) {
-
- ptr8[i*chans+c]=file->get_byte();
- }
- }
-
- }
-
- sm->unlock_data(id);
-
- } break;
- case (IT_SAMPLE_COMPRESSED): { // 8 bits compressed
-
-
- id=sm->create(false,false,p_sample_data.length);
- if (id.is_null())
- break;
- sm->lock_data(id);
-
- if ( load_sample_8bits_IT_compressed((void*)sm->get_data( id),p_sample_data.length) ) {
-
- sm->unlock_data(id);
- sm->destroy(id);
-
- break;
- }
-
- sm->unlock_data(id);
-
-
- } break;
- case (IT_SAMPLE_16BITS|IT_SAMPLE_COMPRESSED): { // 16 bits compressed
-
-
- id=sm->create(true,false,p_sample_data.length);
- if (id.is_null())
- break;
- sm->lock_data(id);
-
- if ( load_sample_16bits_IT_compressed((void*)sm->get_data(id),p_sample_data.length) ) {
-
- sm->unlock_data(id);
- sm->destroy(id);
- break;
- }
-
- sm->unlock_data(id);
-
- } break;
- default: {
-
- // I dont know how to handle stereo compressed, does that exist?
- } break;
-
- }
-
-
- return id;
-}
-
-
-CPLoader::Error CPLoader_IT::load_samples() {
-
- for (int i=0;i<header.smpnum;i++) {
-
- //seek to sample
- file->seek(0xC0+header.ordnum+header.insnum*4+i*4);
-
- uint32_t final_location=file->get_dword();
- file->seek( final_location );
-
-
- Error err=load_sample(song->get_sample(i));
- CP_ERR_COND_V(err,err);
-
- }
-
- if (file->eof_reached() || file->get_error())
- return FILE_CORRUPTED;
-
- return FILE_OK;
-}
-/* * NOTICE * NOTICE * NOTICE * NOTICE * NOTICE * NOTICE * NOTICE * NOTICE * NOTICE * NOTICE * NOTICE
-
- -The following sample decompression code is based on xmp's code.(http://xmp.helllabs.org) which is based in openCP code.
-
-* NOTICE * NOTICE * NOTICE * NOTICE * NOTICE * NOTICE * NOTICE * NOTICE * NOTICE * NOTICE * NOTICE */
-
-uint32_t CPLoader_IT::read_n_bits_from_IT_compressed_block (uint8_t p_bits_to_read) {
-
- uint32_t aux_return_value;
- uint32_t val;
-
- uint8_t *buffer=(uint8_t*)source_position;
- if ( p_bits_to_read <= source_remaining_bits ) {
-
- val=buffer[3];
- val<<=8;
- val|=buffer[2];
- val<<=8;
- val|=buffer[1];
- val<<=8;
- val|=buffer[0];
-
- aux_return_value = val & ((1 << p_bits_to_read) - 1);
- val >>= p_bits_to_read;
- source_remaining_bits -= p_bits_to_read;
-
- buffer[3]=val>>24;
- buffer[2]=(val>>16)&0xFF;
- buffer[1]=(val>>8)&0xFF;
- buffer[0]=(val)&0xFF;
-
- } else {
- aux_return_value=buffer[3];
- aux_return_value<<=8;
- aux_return_value|=buffer[2];
- aux_return_value<<=8;
- aux_return_value|=buffer[1];
- aux_return_value<<=8;
- aux_return_value|=buffer[0];
-
- uint32_t nbits = p_bits_to_read - source_remaining_bits;
- source_position++;
-
- buffer+=4;
- val=buffer[3];
- val<<=8;
- val|=buffer[2];
- val<<=8;
- val|=buffer[1];
- val<<=8;
- val|=buffer[0];
- aux_return_value |= ((val & ((1 << nbits) - 1)) << source_remaining_bits);
- val >>= nbits;
- source_remaining_bits = 32 - nbits;
- buffer[3]=val>>24;
- buffer[2]=(val>>16)&0xFF;
- buffer[1]=(val>>8)&0xFF;
- buffer[0]=(val)&0xFF;
-
- }
-
- return aux_return_value;
-}
-
-bool CPLoader_IT::read_IT_compressed_block (bool p_16bits) {
-
- uint16_t size;
-
- size=file->get_word();
-
- if (file->eof_reached() || file->get_error()) return true;
-
- pat_data = (uint8_t*)CP_ALLOC( 4* ((size >> 2) + 2) );
- if (!pat_data)
- return true;
-
-
- source_buffer=(uint32_t*)pat_data;
- file->get_byte_array((uint8_t*)source_buffer,size);
-
- if (file->eof_reached() || file->get_error()) {
-
- free_IT_compressed_block();
- return true;
- }
-
- source_position = source_buffer;
- source_remaining_bits = 32;
-
- return false;
-}
-
-void CPLoader_IT::free_IT_compressed_block () {
-
-
- if (pat_data) {
- CP_FREE(pat_data);
- pat_data=NULL;
- }
-
-}
-
-bool CPLoader_IT::load_sample_8bits_IT_compressed(void *p_dest_buffer,int p_buffsize) {
-
- int8_t *dest_buffer; /* destination buffer which will be returned */
- uint16_t block_length; /* length of compressed data block in samples */
- uint16_t block_position; /* position in block */
- uint8_t bit_width; /* actual "bit width" */
- uint16_t aux_value; /* value read from file to be processed */
- int8_t d1, d2; /* integrator buffers (d2 for it2.15) */
- int8_t *dest_position; /* position in output buffer */
- int8_t v; /* sample value */
- bool it215; // is this an it215 module?
-
- dest_buffer = (int8_t *) p_dest_buffer;
-
- if (dest_buffer==NULL)
- return true;
-
- for (int i=0;i<p_buffsize;i++)
- dest_buffer[i]=0;
-
-
- dest_position = dest_buffer;
-
- it215=(header.cmwt==0x215);
-
- /* now unpack data till the dest buffer is full */
-
- while (p_buffsize) {
- /* read a new block of compressed data and reset variables */
- if ( read_IT_compressed_block(false) ) {
- CP_PRINTERR("Out of memory decompressing IT CPSample");
- return true;
- }
-
-
- block_length = (p_buffsize < 0x8000) ? p_buffsize : 0x8000;
-
- block_position = 0;
-
- bit_width = 9; /* start with width of 9 bits */
-
- d1 = d2 = 0; /* reset integrator buffers */
-
- /* now uncompress the data block */
- while ( block_position < block_length ) {
-
- aux_value = read_n_bits_from_IT_compressed_block(bit_width); /* read bits */
-
- if ( bit_width < 7 ) { /* method 1 (1-6 bits) */
-
- if ( aux_value == (1 << (bit_width - 1)) ) { /* check for "100..." */
-
- aux_value = read_n_bits_from_IT_compressed_block(3) + 1; /* yes -> read new width; */
- bit_width = (aux_value < bit_width) ? aux_value : aux_value + 1;
- /* and expand it */
- continue; /* ... next value */
- }
-
- } else if ( bit_width < 9 ) { /* method 2 (7-8 bits) */
-
- uint8_t border = (0xFF >> (9 - bit_width)) - 4;
- /* lower border for width chg */
-
- if ( aux_value > border && aux_value <= (border + 8) ) {
-
- aux_value -= border; /* convert width to 1-8 */
- bit_width = (aux_value < bit_width) ? aux_value : aux_value + 1;
- /* and expand it */
- continue; /* ... next value */
- }
-
-
- } else if ( bit_width == 9 ) { /* method 3 (9 bits) */
-
- if ( aux_value & 0x100 ) { /* bit 8 set? */
-
- bit_width = (aux_value + 1) & 0xff; /* new width... */
- continue; /* ... and next value */
- }
-
- } else { /* illegal width, abort */
-
-
- free_IT_compressed_block();
- CP_PRINTERR("CPSample has illegal BitWidth ");
- return true;
- }
-
- /* now expand value to signed byte */
- if ( bit_width < 8 ) {
-
- uint8_t tmp_shift = 8 - bit_width;
-
- v=(aux_value << tmp_shift);
- v>>=tmp_shift;
-
- } else v = (int8_t) aux_value;
-
- /* integrate upon the sample values */
- d1 += v;
- d2 += d1;
-
- /* ... and store it into the buffer */
- *(dest_position++) = it215 ? d2 : d1;
- block_position++;
-
- }
-
- /* now subtract block lenght from total length and go on */
- free_IT_compressed_block();
- p_buffsize -= block_length;
- }
-
-
- return false;
-}
-
-bool CPLoader_IT::load_sample_16bits_IT_compressed(void *p_dest_buffer,int p_buffsize) {
-
- int16_t *dest_buffer; /* destination buffer which will be returned */
- uint16_t block_length; /* length of compressed data block in samples */
- uint16_t block_position; /* position in block */
- uint8_t bit_width; /* actual "bit width" */
- uint32_t aux_value; /* value read from file to be processed */
- int16_t d1, d2; /* integrator buffers (d2 for it2.15) */
- int16_t *dest_position; /* position in output buffer */
- int16_t v; /* sample value */
-
- bool it215; // is this an it215 module?
-
- dest_buffer = (int16_t *) p_dest_buffer;
-
- if (dest_buffer==NULL)
- return true;
-
- for (int i=0;i<p_buffsize;i++)
- dest_buffer[i]=0;
-
- dest_position = dest_buffer;
-
- it215=(header.cmwt==0x215);
-
-
- while (p_buffsize) {
- /* read a new block of compressed data and reset variables */
- if ( read_IT_compressed_block(true) ) {
-
- return true;
- }
-
-
- block_length = (p_buffsize < 0x4000) ? p_buffsize : 0x4000;
-
- block_position = 0;
-
- bit_width = 17; /* start with width of 9 bits */
-
- d1 = d2 = 0; /* reset integrator buffers */
-
- while ( block_position < block_length ) {
-
- aux_value = read_n_bits_from_IT_compressed_block(bit_width); /* read bits */
-
- if ( bit_width < 7 ) { /* method 1 (1-6 bits) */
-
- if ( (signed)aux_value == (1 << (bit_width - 1)) ) { /* check for "100..." */
-
- aux_value = read_n_bits_from_IT_compressed_block(4) + 1; /* yes -> read new width; */
- bit_width = (aux_value < bit_width) ? aux_value : aux_value + 1;
- /* and expand it */
- continue; /* ... next value */
- }
-
- } else if ( bit_width < 17 ) {
-
- uint16_t border = (0xFFFF >> (17 - bit_width)) - 8;
-
- if ( (int)aux_value > (int)border && (int)aux_value <= ((int)border + 16) ) {
-
- aux_value -= border; /* convert width to 1-8 */
- bit_width = (aux_value < bit_width) ? aux_value : aux_value + 1;
- /* and expand it */
- continue; /* ... next value */
- }
-
-
- } else if ( bit_width == 17 ) {
-
- if ( aux_value & 0x10000 ) { /* bit 8 set? */
-
- bit_width = (aux_value + 1) & 0xff; /* new width... */
- continue; /* ... and next value */
- }
-
- } else { /* illegal width, abort */
-
- CP_PRINTERR("CPSample has illegal BitWidth ");
-
- free_IT_compressed_block();
-
- return true;
- }
-
- /* now expand value to signed byte */
- if ( bit_width < 16 ) {
-
- uint8_t tmp_shift = 16 - bit_width;
-
- v=(aux_value << tmp_shift);
- v>>=tmp_shift;
-
- } else v = (int16_t) aux_value;
-
- /* integrate upon the sample values */
- d1 += v;
- d2 += d1;
-
- /* ... and store it into the buffer */
- *(dest_position++) = it215 ? d2 : d1;
- block_position++;
-
- }
-
- /* now subtract block lenght from total length and go on */
- free_IT_compressed_block();
- p_buffsize -= block_length;
- }
-
-
- return false;
-
-}
-
-
-
diff --git a/modules/chibi/cp_loader_mod.cpp b/modules/chibi/cp_loader_mod.cpp
deleted file mode 100644
index f867b77914..0000000000
--- a/modules/chibi/cp_loader_mod.cpp
+++ /dev/null
@@ -1,482 +0,0 @@
-/*************************************************************************/
-/* cp_loader_mod.cpp */
-/*************************************************************************/
-/* This file is part of: */
-/* GODOT ENGINE */
-/* http://www.godotengine.org */
-/*************************************************************************/
-/* Copyright (c) 2007-2016 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 "cp_loader_mod.h"
-
-
-static bool tag_equal_to(const char *p_tag, const char *p_string) {
-
- return( p_tag[0]==p_string[0] &&
- p_tag[1]==p_string[1] &&
- p_tag[2]==p_string[2] &&
- p_tag[3]==p_string[3]);
-}
-/* ProTracker period table */
-uint16_t period_table[6*12] = {
- 1712,1616,1524,1440,1356,1280,1208,1140,1076,1016,960,907,
- 856,808,762,720,678,640,604,570,538,508,480,453,
- 428,404,381,360,339,320,302,285,269,254,240,226,
- 214,202,190,180,170,160,151,143,135,127,120,113,
- 107,101,95,90,85,80,75,71,67,63,60,56,
- 53,50,47,45,42,40,37,35,33,31,30,28
-};
-
-
-CPLoader::Error CPLoader_MOD::load_song(const char *p_file,CPSong *p_song,bool p_sampleset) {
-
- if (file->open(p_file,CPFileAccessWrapper::READ)) {
- //printf("Can't open file! %s\n",p_file);
- return FILE_CANNOT_OPEN;
- };
-
- /* FIRST OF ALL, one needs to read the .mod file format tag */
- file->seek( 1080 ); //located at 1080
-
- char format_tag[4];
-
- file->get_byte_array( (uint8_t*)format_tag, 4 );
-
- int channels=-1;
-
- /** THE PAIN!! - COMPARE TAGS */
-
- /* Classic 4-chan */
- if (tag_equal_to(format_tag,"M.K.") )
- channels=4;
- if (tag_equal_to(format_tag,"FLT4") )
- channels=4;
- if (tag_equal_to(format_tag,"M!K!") )
- channels=4;
-
- /* 8 Channel MODS */
-
- if (tag_equal_to(format_tag,"FLT8") )
- channels=2;
-
- if (tag_equal_to(format_tag,"CD81") )
- channels=2;
-
- /* Custom channel MODS */
-
- for (int i=1;i<=32;i++) {
-
- if (i<10) { // up to 9 channels mods
-
- /* Old Take Tracker */
- char old_take_tracker[4]={'T','D','Z',char('0'+i)};
-
- if (tag_equal_to(format_tag,old_take_tracker)) {
-
- channels=i;
- break;
- }
-
- /* Contemplates many XCHN Formats */
- char xchn[4]={char('0'+i),'C','H','N'};
-
- if (tag_equal_to(format_tag,xchn)) {
-
- channels=i;
- break;
- }
- }
-
- /* Fast Tracker */
- char fast_tracker[4]={char('0'+(i/10)),char('0'+(i%10)),'C','H'};
-
- if (tag_equal_to(format_tag,fast_tracker)) {
-
- channels=i;
- break;
- }
-
- }
-
-
- if (channels==-1) {
-
- file->close();
- return FILE_UNRECOGNIZED;
- }
-
-
-
- /** Load CPSong INFO */
-
- file->seek( 0 ); //go to begining of file
-
- file->set_endian_conversion( true );
- p_song->reset();
- p_song->set_instruments( false );
-
- char name[21];
-
- file->get_byte_array( (uint8_t*)name,20);
- name[20]=0;
-
- p_song->set_name(name);
- p_song->set_old_effects( true );
- p_song->set_linear_slides( false );
- p_song->set_compatible_gxx( true );
-
-
-
- CPSampleManager *sm=CPSampleManager::get_singleton();
-
- int instruments=31;
-
- for (int i=0;i<instruments;i++) {
-
- char sample_name[23];
- file->get_byte_array( (uint8_t*)sample_name,22);
- sample_name[22]=0;
-
- uint32_t sample_len=file->get_word();
- sample_len<<=1;
-
- uint8_t fine_nibble=file->get_byte()&0xF;
-
-
- //(int8_t)(fine_nibble & 7) - (int8_t)(fine_nibble & 8); //yesso's genius trick
- // boo, I can't use it :( but i leave it here because of how cool it is
- uint8_t linear_volume=file->get_byte(); //0 .. ?
-
- uint32_t loop_begin=file->get_word(); //0 .. ?
- loop_begin<<=1;
- uint32_t loop_end=file->get_word(); //0 .. ?
- loop_end<<=1;
-
- if (sample_len>0) {
-
- CPSample_ID sid=sm->create( false, false, sample_len );
-
- if (sid.is_null()) {
-
- file->close();
- return FILE_OUT_OF_MEMORY;
- }
-
- if (loop_end>2) {
- sm->set_loop_begin( sid, loop_begin );
- sm->set_loop_end( sid, loop_end+loop_begin );
- sm->set_loop_type( sid,CP_LOOP_FORWARD );
- }
- static const uint16_t fine_to_freq[16]={
- 8363,8413,8463,8529,8581,8651,8723,8757,
- 7895,7941,7985,8046,8107,8169,8232,8280
- };
-
- sm->set_c5_freq( sid, fine_to_freq[fine_nibble] );
- p_song->get_sample(i)->set_sample_data(sid);
- }
-
- p_song->get_sample(i)->set_name(sample_name);
- p_song->get_sample(i)->set_default_volume( linear_volume );
-
-
-
- }
-
- /* pan for MODs */
- for (int i=0;i<channels;i++)
- p_song->set_channel_pan( i, (((i&3)==1) || ((i&3)==2)) ? 0: 64);
-
-
- uint8_t order_count=file->get_byte();
-// uint8_t loop_to=file->get_byte();
-
-
- int pattern_count=0;
-
- for (int i=0;i<128;i++) {
-
- uint8_t order=file->get_byte();
-
-
- if (i<order_count) {
- p_song->set_order(i,order);
-
- /* Determine the amount of patterns */
- if ((order+1)>pattern_count)
- pattern_count=order+1;
- } else
- p_song->set_order( i, CP_ORDER_NONE );
- }
-
- if (instruments==31)
- file->get_dword(); // identiefier, now skip it
-
- for (int i=0;i<pattern_count;i++) {
-
- for(int line=0;line<64;line++) {
-
- for(int column=0;column<channels;column++) {
-
- uint32_t note_w=file->get_dword();
-
- CPNote note;
-
- note.instrument=(note_w>>12)&0xF;
- note.instrument|=(note_w>>24)&0xF0;
-
- if (note.instrument==0)
- note.instrument=CPNote::EMPTY;
- else
- note.instrument--;
-
- note.parameter=note_w&0xFF;
-
- int cmd=(note_w>>8)&0xF;
-
- uint32_t period=(note_w>>16)&0xFFF;
-
- if (period>0 && period<0xFFF) {
-
- //period>>=2;
- //period<<=1;
- for (int n=0; n<6*12; n++) {
-
- if (period >= period_table[n]) {
-
- if ((period!=period_table[n]) && (n))
- {
- uint32_t p1 = period_table[n-1];
- uint32_t p2 = period_table[n];
- if (p1 - period < (period - p2)) {
-
- note.note=n+36;
- break;
- }
- }
- note.note=n+1+36;
- break;
- }
- }
- if (note.note==CPNote::EMPTY)
- note.note=6*12+36;
-
- note.note--;
- }
-
-
- switch(cmd) {
-
- case 0x0: {
-
- if (note.parameter>0)
- note.command='J'-'A';
- } break;
- case 0x1: {
- note.command='F'-'A';
- } break;
- case 0x2: {
-
- note.command='E'-'A';
- } break;
- case 0x3: {
-
- note.command='G'-'A';
- } break;
- case 0x4: {
-
- note.command='H'-'A';
- } break;
- case 0x5: {
- note.command='L'-'A';
- } break;
- case 0x6: {
-
- note.command='K'-'A';
- } break;
- case 0x7: {
- note.command='R'-'A';
- } break;
- case 0x8: {
-
- note.command='X'-'A';
- } break;
- case 0x9: {
-
- note.command='O'-'A';
-
- } break;
- case 0xA: {
-
- note.command='D'-'A';
-
- } break;
- case 0xB: {
-
- note.command='B'-'A';
-
- } break;
- case 0xC: {
-
- note.volume=note.parameter;
- if (note.volume>64)
- note.volume=64;
- note.parameter=0;
-
- } break;
- case 0xD: {
-
- note.command='C'-'A';
- note.parameter=(note.parameter>>4)*10 + (note.parameter&0xF);
-
- } break;
- case 0xE: { //SPECIAL EFFECT!
-
- note.command='S'-'A';
-
- switch(note.parameter>>4) {
-
- case 0x1: {
-
- note.command='F'-'A';
- note.parameter=0xF0|(note.parameter&0xF);
- } break;
- case 0x2: {
-
- note.command='E'-'A';
- note.parameter=0xF0|(note.parameter&0xF);
- } break;
- case 0x4: {
-
- note.command='S'-'A';
- note.parameter=0x30|(note.parameter&0x3);
-
- } break;
- case 0x6: {
-
- note.command='S'-'A';
- note.parameter=0xB0|(note.parameter&0xF);
-
- } break;
- case 0x7: {
- note.command='S'-'A';
- note.parameter=0x40|(note.parameter&0x3);
-
- } break;
- case 0x8: {
-
- note.command='S'-'A'; // wow, it's the same!
-
- } break;
- case 0x9: {
- note.command='Q'-'A';
- note.parameter=(note.parameter&0xF);
-
- } break;
- case 0xA: {
-
- note.command='D'-'A';
- note.parameter=0xF|((note.parameter&0xF)<<4);
-
- } break;
- case 0xB: {
- note.command='D'-'A';
- note.parameter=0xF0|(note.parameter&0xF);
-
- } break;
- case 0xC:
- case 0xD: {
-
- note.command='S'-'A'; //wow, they are the same!
-
- } break;
- case 0xE: {
- note.command='S'-'A';
- note.parameter=0x60|(note.parameter&0xF);
-
- } break;
-
- default: {
-
- note.command=CPNote::EMPTY;
- note.parameter=0;
- } break;
-
- }
- } break;
- case 0xF: {
-
- if (note.parameter<32)
- note.command='A'-'A';
- else
- note.command='T'-'A';
-
- } break;
- }
-
- p_song->get_pattern(i)->set_note( column,line, note );
- }
- }
- }
-
-
-
- for (int i=0;i<instruments;i++) {
-
- CPSample_ID sid=p_song->get_sample(i)->get_sample_data();
- if (sid.is_null()) {
- continue; //empty sample, not stored?
- }
- sm->lock_data(sid);
- uint8_t *dataptr = (uint8_t*)sm->get_data(sid);
-
- int len=sm->get_size(sid);
- for (int s=0;s<len;s++) {
-
- uint8_t d=file->get_byte();
- //d-=128; //convert to signed
- int8_t*ds=(int8_t*)&d;
- dataptr[s]=*ds;
-
- }
- sm->unlock_data(sid);
- }
-
- file->close();
-
- return FILE_OK;
-
-
-}
-
-
-CPLoader_MOD::CPLoader_MOD(CPFileAccessWrapper *p_file) {
-
- file=p_file;
-}
-
-
-CPLoader_MOD::~CPLoader_MOD()
-{
-}
-
-
diff --git a/modules/chibi/cp_loader_mod.h b/modules/chibi/cp_loader_mod.h
deleted file mode 100644
index 636f4f00f2..0000000000
--- a/modules/chibi/cp_loader_mod.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/*************************************************************************/
-/* cp_loader_mod.h */
-/*************************************************************************/
-/* This file is part of: */
-/* GODOT ENGINE */
-/* http://www.godotengine.org */
-/*************************************************************************/
-/* Copyright (c) 2007-2016 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 CP_LOADER_MOD_H
-#define CP_LOADER_MOD_H
-#include "cp_loader.h"
-/**
- @author Juan Linietsky <reduz@gmail.com>
-*/
-class CPLoader_MOD : public CPLoader {
-
- CPFileAccessWrapper *file;
-public:
-
- bool can_load_song() { return true; }
- bool can_load_sample() { return false; }
- bool can_load_instrument() { return false; }
-
- Error load_song(const char *p_file,CPSong *p_song,bool p_sampleset);
- Error load_sample(const char *p_file,CPSample *p_sample) { return FILE_UNRECOGNIZED; }
- Error load_instrument(const char *p_file,CPSong *p_song,int p_instr_idx) { return FILE_UNRECOGNIZED; }
-
- CPLoader_MOD(CPFileAccessWrapper *p_file);
- ~CPLoader_MOD();
-};
-
-#endif
diff --git a/modules/chibi/cp_loader_s3m.cpp b/modules/chibi/cp_loader_s3m.cpp
deleted file mode 100644
index 0fc15c1e2f..0000000000
--- a/modules/chibi/cp_loader_s3m.cpp
+++ /dev/null
@@ -1,413 +0,0 @@
-/*************************************************************************/
-/* cp_loader_s3m.cpp */
-/*************************************************************************/
-/* This file is part of: */
-/* GODOT ENGINE */
-/* http://www.godotengine.org */
-/*************************************************************************/
-/* Copyright (c) 2007-2016 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 "cp_loader_s3m.h"
-
-#define BITBOOL(m_exp) ((m_exp)?1:0)
-
-
-CPLoader::Error CPLoader_S3M::load_header() {
-
- int i;
-
-
- file->get_byte_array((uint8_t*)header.songname,28);
- header.t1a=file->get_byte();
- header.type=file->get_byte();
- file->get_byte_array((uint8_t*)header.unused1,2);
- header.ordnum=file->get_word();
- header.insnum=file->get_word();
- header.patnum=file->get_word();
- header.flags=file->get_word();
- header.tracker=file->get_word();
- header.fileformat=file->get_word();
- file->get_byte_array((uint8_t*)header.scrm,4);
- header.scrm[4]=0;
-
- if (header.scrm[0]!='S' || header.scrm[1]!='C' || header.scrm[2]!='R' || header.scrm[3]!='M')
- return FILE_UNRECOGNIZED;
-
- header.mastervol=file->get_byte();
- header.initspeed=file->get_byte();
- header.inittempo=file->get_byte();
- header.mastermult=file->get_byte();
- header.ultraclick=file->get_byte();
- header.pantable=file->get_byte();
- file->get_byte_array((uint8_t*)header.unused2,8);
- header.special=file->get_word();
- file->get_byte_array((uint8_t*)header.channels,32);
-
- file->get_byte_array((uint8_t*)header.orderlist,header.ordnum);
-
- header.scrm[4]=0;
- if (header.scrm[0]!='S' || header.scrm[1]!='C' || header.scrm[2]!='R' || header.scrm[3]!='M') //again?
- return FILE_UNRECOGNIZED;
- //sample parapointers
- for (i=0;i<header.insnum;i++) {
-
- int parapointer;
- parapointer=file->get_word();
- parapointer=(parapointer*16);
- sample_parapointers[i]=parapointer;
- }
- //pattern
- for (i=0;i<header.patnum;i++) {
-
- int parapointer;
- parapointer=file->get_word();
- parapointer=(parapointer*16);
- pattern_parapointers[i]=parapointer;
- }
-
- if (header.pantable==252) {
-
- file->get_byte_array((uint8_t*)header.pannings,32);
- }
-
- return FILE_OK;
-
-
-}
-
-
-void CPLoader_S3M::set_header() {
-
-
-
-
- song->set_name( header.songname );
-// song->variables.filename=
-
- song->set_row_highlight_minor( 4 );
- song->set_row_highlight_major( 16 );
- song->set_mixing_volume( header.mastervol );
- song->set_linear_slides( false );
- song->set_old_effects( !(header.flags&64) );
- song->set_compatible_gxx( true );
-
- song->set_global_volume( header.mastermult );
- song->set_speed( header.initspeed );
- song->set_tempo( header.inittempo );
-
- //[TODO] Set Panning Positions.. ?
-
- for (int i=0;i<header.ordnum;i++) song->set_order(i,header.orderlist[i]);
-
-}
-
-CPLoader::Error CPLoader_S3M::load_sample(CPSample *p_sample) {
-
-
-
- int type=file->get_byte();
-
- char filename[13];
- file->get_byte_array((uint8_t*)filename,12);
- filename[12]=0;
-
-
- uint32_t samplepos=(uint32_t)file->get_byte() << 16;
- samplepos|=file->get_word();
- samplepos*=16;
-// printf("sample at %i\n",samplepos);
- /**/
- int sample_size=file->get_dword();
-
-
- int loop_begin=file->get_dword();
- int loop_end=file->get_dword();
-
- int def_volume=file->get_byte();;
- int dsk=file->get_byte();
- int pack=file->get_byte();
-
- int flags=file->get_byte();
- int c2speed=file->get_dword();
-
- file->get_dword(); //useless crap
- file->get_dword();
- file->get_dword();
-
-
- char name[29];
- file->get_byte_array((uint8_t*)name,28);
- name[28]=0;
-
- p_sample->set_default_volume(def_volume);
- p_sample->set_name(name);
-
- char scrs[5];
- file->get_byte_array((uint8_t*)scrs,4);
- scrs[4]=0;
-
-
-
- bool data_is_16bits=flags&4;
- bool data_is_stereo=flags&2;
-
- if (type==0) {
- //empty sample
- return FILE_OK;
- }
-
-
- if ((type!=1) || scrs[0]!='S' || scrs[1]!='C' || scrs[2]!='R' || scrs[3]!='S' ) {
-// printf("type: %i, %c%c%c%c\n",type,scrs[0],scrs[1],scrs[2],scrs[3]);
- CP_PRINTERR("Not an S3M CPSample!");
- return FILE_CORRUPTED;
- }
-
- //p_sample->data.set_c5_freq(p_sample->c2spd<<1);
-
- file->seek(samplepos);
-
- int real_sample_size=sample_size<<BITBOOL(data_is_16bits);
- real_sample_size<<=BITBOOL(data_is_stereo);
-
- CPSampleManager *sm=CPSampleManager::get_singleton();
-
- CPSample_ID id =sm->create( data_is_16bits, data_is_stereo, sample_size );
-
- if (id.is_null())
- return FILE_OUT_OF_MEMORY;
-
- sm->lock_data(id);
- void *dataptr = sm->get_data(id);
-
- int chans = (data_is_stereo?2:1);
- for (int c=0;c<chans;c++) {
- for (int i=0;i<sample_size;i++) {
-
- if (data_is_16bits) {
-
- uint16_t s=file->get_word();
- s-=32768; //toggle sign
-
- int16_t *v=(int16_t*)&s;
- ((int16_t*)dataptr)[i*chans+c]=*v;
- } else {
-
-
- int8_t *v;
- uint8_t s=file->get_byte();
- s-=128; //toggle sign
- v=(int8_t*)&s;
- ((int8_t*)dataptr)[i*chans+c]=*v;
-
- }
-
- }
-
- }
-
- sm->unlock_data(id);
-
-
- sm->set_loop_begin( id, loop_begin );
- sm->set_loop_end( id, loop_end );
- sm->set_loop_type( id, (flags&1) ? CP_LOOP_FORWARD : CP_LOOP_NONE );
- sm->set_c5_freq( id, c2speed << 1 );
- p_sample->set_sample_data(id);
-
- /* Scream tracker previous to 3.10 seems to be buggy, as in, wont save what is after the sample loop, including the loop end point. Because of this I must fix it by habd */
- if (flags&1) {
-
- for (int c=0;c<(data_is_stereo?2:1);c++) {
- sm->set_data( id, loop_end, sm->get_data( id, loop_begin,c ),c );
-
- }
- }
-
-
- return FILE_OK;
-
-}
-
-
-CPLoader::Error CPLoader_S3M::load_pattern(CPPattern *p_pattern) {
-
- int row=0,flag,ch;
- CPNote n;
- int length,accum=0;
-
- length=file->get_word();
- p_pattern->set_length(64);
-
- /* clear pattern data */
- while((row<64) && (accum<=length) ) {
- flag=file->get_byte();
- accum++;
-
- n.clear();
- if(flag) {
- // ch=remap[flag&31];
-// ch=remap[flag&31];
-// if(ch!=-1)
-// n=s3mbuf[(64U*ch)+row];
-// else
-// n=&dummy;
-
- ch=flag&31;
-
- if(flag&32) {
- n.note=file->get_byte();
- if (n.note==255) {
-
- n.note=CPNote::EMPTY;
- } else if (n.note==254) {
-
- n.note=CPNote::CUT;
- } else {
-
- n.note=((n.note>>4)*12)+(n.note&0xF);
- }
-
- n.instrument=file->get_byte()-1;
- accum+=2;
-
- }
- if(flag&64) {
- n.volume=file->get_byte();
- if (n.volume>64) n.volume=64;
- accum++;
-
- }
- if(flag&128) {
- n.command=file->get_byte()-1;
- n.parameter=file->get_byte();
- accum+=2;
- }
-
- p_pattern->set_note(ch,row,n);
- } else row++;
- }
- return FILE_OK;
-
-
-}
-
-CPLoader::Error CPLoader_S3M::load_sample(const char *p_file,CPSample *p_sample) {
-
- return FILE_UNRECOGNIZED;
-}
-CPLoader::Error CPLoader_S3M::load_instrument(const char *p_file,CPSong *p_song,int p_instr_idx) {
-
- return FILE_UNRECOGNIZED;
-
-}
-
-
-CPLoader::Error CPLoader_S3M::load_samples() {
-
- int i;
-
- for(i=0;i<header.insnum;i++) {
-
- file->seek(sample_parapointers[i]);
- load_sample(song->get_sample(i));
- sample_count++;
- }
-
- return FILE_OK;
-}
-
-CPLoader::Error CPLoader_S3M::load_patterns() {
-
- int i;
-
- Error err;
- for(i=0;i<header.patnum;i++) {
-
- file->seek(pattern_parapointers[i]);
-
- err=load_pattern(song->get_pattern(i) );
- CP_ERR_COND_V(err,err);
-
-
- pattern_count++;
- }
- return FILE_OK;
-
-}
-
-CPLoader::Error CPLoader_S3M::load_song(const char *p_file,CPSong *p_song,bool p_sampleset) {
-
- song=p_song;
-
- if (file->open(p_file,CPFileAccessWrapper::READ)) {
- //printf("Can't open file! %s\n",p_file);
- return FILE_CANNOT_OPEN;
- };
-
- sample_count=0;
- pattern_count=0;
-
- //printf("LOADING HEADER\n");
- CPLoader::Error err;
- if ((err=load_header())) {
- file->close();
- CP_ERR_COND_V(err,err);
-
- }
-
- song->reset(); //file type recognized, reset song!
-
- set_header();
-
- //printf("LOADING SAMPLES\n");
-
- if ((err=load_samples())) {
- file->close();
-
- CP_ERR_COND_V(err,err);
- }
-
- //printf("LOADING PATTERNS\n");
-
- if ((err=load_patterns())) {
-
- file->close();
- return err;
- }
-
- file->close();
-
- return FILE_OK;
-}
-
-
-
-CPLoader_S3M::CPLoader_S3M(CPFileAccessWrapper *p_file){
-
- file=p_file;
-
-}
-CPLoader_S3M::~CPLoader_S3M(){
-}
-
diff --git a/modules/chibi/cp_loader_s3m.h b/modules/chibi/cp_loader_s3m.h
deleted file mode 100644
index 175e5e80fe..0000000000
--- a/modules/chibi/cp_loader_s3m.h
+++ /dev/null
@@ -1,111 +0,0 @@
-/*************************************************************************/
-/* cp_loader_s3m.h */
-/*************************************************************************/
-/* This file is part of: */
-/* GODOT ENGINE */
-/* http://www.godotengine.org */
-/*************************************************************************/
-/* Copyright (c) 2007-2016 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 CP_LOADER_S3M_H
-#define CP_LOADER_S3M_H
-
-#include "cp_loader.h"
-
-/**
- *@author Juan Linietsky
- */
-/******************************
- loader_s3m.h
- ----------
-Scream Tracker Module CPLoader!
-It lacks support for
-individual sample loading
-and reorganizing the columns.
-********************************/
-
-
-
-
-class CPLoader_S3M : public CPLoader {
-
- struct S3M_Header {
- char songname[28];
- uint8_t t1a;
- uint8_t type;
- uint8_t unused1[2];
- uint16_t ordnum;
- uint16_t insnum;
- uint16_t patnum;
- uint16_t flags;
- uint16_t tracker;
- uint16_t fileformat;
- char scrm[5];
- uint8_t mastervol;
- uint8_t initspeed;
- uint8_t inittempo;
- uint8_t mastermult;
- uint8_t ultraclick;
- uint8_t pantable;
- uint8_t unused2[8];
- uint16_t special;
- uint8_t channels[32];
- uint8_t pannings[32];
- uint8_t orderlist[300];
- };
-
-
- int sample_parapointers[CPSong::MAX_SAMPLES];
- int pattern_parapointers[CPSong::MAX_PATTERNS];
-
- Error load_header();
- void set_header();
- Error load_sample(CPSample *p_sample);
- Error load_pattern(CPPattern *p_pattern);
- Error load_patterns();
-
- Error load_samples();
-
- S3M_Header header;
- int sample_count;
- int pattern_count;
-
- CPFileAccessWrapper *file;
- CPSong *song;
-public:
-
- bool can_load_song() { return true; }
- bool can_load_sample() { return false; }
- bool can_load_instrument() { return false; }
-
- Error load_song(const char *p_file,CPSong *p_song,bool p_sampleset);
- Error load_sample(const char *p_file,CPSample *p_sample);
- Error load_instrument(const char *p_file,CPSong *p_song,int p_instr_idx);
-
- CPLoader_S3M(CPFileAccessWrapper *p_file);
- ~CPLoader_S3M();
-};
-
-
-
-#endif
diff --git a/modules/chibi/cp_loader_xm.cpp b/modules/chibi/cp_loader_xm.cpp
deleted file mode 100644
index bff8615a32..0000000000
--- a/modules/chibi/cp_loader_xm.cpp
+++ /dev/null
@@ -1,752 +0,0 @@
-/*************************************************************************/
-/* cp_loader_xm.cpp */
-/*************************************************************************/
-/* This file is part of: */
-/* GODOT ENGINE */
-/* http://www.godotengine.org */
-/*************************************************************************/
-/* Copyright (c) 2007-2016 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 "cp_loader_xm.h"
-#include "cp_tables.h"
-
-#define ABORT_LOAD { file->close(); return FILE_CORRUPTED; }
-
-
-
-
-CPLoader::Error CPLoader_XM::load_song(const char *p_file,CPSong *p_song,bool p_sampleset) {
-
- song=p_song;
-
- if (file->open(p_file,CPFileAccessWrapper::READ)) {
-
- return FILE_CANNOT_OPEN;
- };
-
-
- /**************************************
- LOAD HEADER
- ***************************************/
-
- file->get_byte_array(header.idtext,17);
- header.idtext[17]=0;
-
- file->get_byte_array(header.songname,20);
-
-
-
- header.songname[20]=0;
- header.hex1a=file->get_byte();
- if (header.hex1a!=0x1A) { //XM "magic" byte.. this sucks :)
-
- file->close();
- return FILE_UNRECOGNIZED;
-
- }
-
-
- //magic byte sucks, but can't do much about it..
-
- song->reset(); //must reset the song
-
- song->set_name( (const char*)header.songname );
-
- file->get_byte_array(header.trackername,20);
- header.trackername[20]=0;
-
-
- header.version=file->get_word();
-
- header.headersize=file->get_dword();
-
- header.songlength=file->get_word();
-
- header.restart_pos=file->get_word();
-
- header.channels_used=file->get_word();
-
- header.patterns_used=file->get_word();
-
- header.instruments_used=file->get_word();
-
- song->set_linear_slides( file->get_word() );
-
- song->set_speed( file->get_word() );
-
- song->set_tempo( file->get_word() );
- song->set_instruments( true );
-
- file->get_byte_array(header.orderlist,256);
-
- for (int i=0;i<header.songlength;i++) {
-
- if (i>199)
- break;
- song->set_order(i,header.orderlist[i]);
- }
-
- /**************************************
- LOAD PATTERNS
- ***************************************/
-
- for (int i=0;i<header.patterns_used;i++) {
-
- uint32_t aux,rows;
-
- aux=file->get_dword(); //length
- aux=file->get_byte(); //packing type
- rows=aux=file->get_word(); //rows!
-
- song->get_pattern(i)->set_length( aux );
-
- aux=file->get_word(); //packed size
- if (aux==0)
- continue;
- //unpaaack!
- for(int j=0;j<(int)rows;j++)
- for(int k=0;k<header.channels_used;k++) {
-
- CPNote aux_note;
- uint8_t aux_byte;
- //uint8_t field;
- aux_byte=file->get_byte(); //packing type
- if (!(aux_byte&0x80)) {
-
- aux_note.note=aux_byte;
- aux_byte=0xFE; //if bit 7 not set, read all of them except the note
- }
-
- if (aux_byte&1) aux_note.note=file->get_byte();
- if (aux_byte&2) aux_note.instrument=file->get_byte();
- if (aux_byte&4) aux_note.volume=file->get_byte();
- if (aux_byte&8) aux_note.command=file->get_byte();
- if (aux_byte&16) aux_note.parameter=file->get_byte();
-
- if (aux_note.note!=CPNote::EMPTY) {
-
- if (aux_note.note==97) aux_note.note=CPNote::OFF;
- else {
- aux_note.note+=11; //octave minus one (XM C-0 is 1, not zero )
- }
- }
- if (aux_note.instrument!=CPNote::EMPTY) {
-
- if ((aux_note.instrument>0) && (aux_note.instrument<100))
- aux_note.instrument--;
- else
- aux_note.instrument=CPNote::EMPTY;
- }
- if (aux_note.volume!=CPNote::EMPTY) {
-
- if (aux_note.volume<0x10) {}
- else if (aux_note.volume<0x50) {
-
- aux_note.volume-=0x10;
-
- } else if (aux_note.volume<0x60) {
- //
- aux_note.volume=CPNote::EMPTY;
-
- } else if (aux_note.volume<0x70) {
- //60 -- volume slide down
- aux_note.volume-=0x60;
- if (aux_note.volume>9) aux_note.volume=9;
- aux_note.volume+=95;
-
- } else if (aux_note.volume<0x80) {
- //70 -- volume slide up
- aux_note.volume-=0x70;
- if (aux_note.volume>9) aux_note.volume=9;
- aux_note.volume+=85;
-
-
- } else if (aux_note.volume<0x90) {
- //80 -- fine volume slide down
- aux_note.volume-=0x80;
- if (aux_note.volume>9) aux_note.volume=9;
- aux_note.volume+=75;
-
-
- } else if (aux_note.volume<0xA0) {
- //9 -- fine volume slide up
-
- aux_note.volume-=0x90;
- if (aux_note.volume>9) aux_note.volume=9;
-
- aux_note.volume+=65;
-
-
-
- } else if (aux_note.volume<0xB0) {
- //A -- set vibrato speed
- aux_note.volume=CPNote::EMPTY;
-
- } else if (aux_note.volume<0xC0) {
- //B -- vibrato
- aux_note.volume-=0xB0;
- if (aux_note.volume>9) aux_note.volume=9;
- aux_note.volume+=203;
-
-
- } else if (aux_note.volume<0xD0) {
- //C -- set panning
- int aux=aux_note.volume-=0xC0;
- aux=aux*65/0xF;
- aux_note.volume=128+aux;
-
- } else if (aux_note.volume<0xE0) {
- aux_note.volume=CPNote::EMPTY;
-
-
- } else if (aux_note.volume<0xF0) {
- aux_note.volume=CPNote::EMPTY;
-
-
- } else {
- //F -- tone porta
- aux_note.volume-=0xF0;
- aux_note.volume*=9;
- aux_note.volume/=0xF;
- aux_note.volume+=193;
- }
- }
- if (aux_note.command!=CPNote::EMPTY) {
-
- switch(aux_note.command) {
-
- case 0x0:
- aux_note.command='J'-'A';
- break;
- case 0x1:
- aux_note.command='F'-'A';
- break;
- case 0x2:
- aux_note.command='E'-'A';
- break;
- case 0x3:
- aux_note.command='G'-'A';
- break;
- case 0x4:
- aux_note.command='H'-'A';
- break;
- case 0x5:
- aux_note.command='L'-'A';
- break;
- case 0x6:
- aux_note.command='K'-'A';
- break;
- case 0x7:
- aux_note.command='R'-'A';
- break;
- case 0x8:
- aux_note.command='X'-'A';
- break;
- case 0x9:
- aux_note.command='O'-'A';
- break;
- case 0xa:
- aux_note.command='D'-'A';
- break;
- case 0xb:
- aux_note.command='B'-'A';
- break;
- case 0xc:
- //printf("XM Import: Warning! effect C (set volume) not implemented!\n");
- break;
- case 0xd:
- aux_note.command='C'-'A';
- break;
-
- case 0xe: /* Extended effects */
-
- aux_note.command='S'-'A';
- switch(aux_note.parameter>>4) {
- case 0x1: /* XM fine porta up */
- if (!(aux_note.parameter&0xF)) { aux_note.command=CPNote::EMPTY; aux_note.parameter=0; break; }
- aux_note.command='F'-'A';
- aux_note.parameter=0xF0|(aux_note.parameter&0xF);
- break;
- case 0x2: /* XM fine porta down */
- if (!(aux_note.parameter&0xF)) { aux_note.command=CPNote::EMPTY; aux_note.parameter=0; break; }
- aux_note.command='E'-'A';
- aux_note.parameter=0xF0|(aux_note.parameter&0xF);
- break;
- case 0xa: /* XM fine volume up */
- if (!(aux_note.parameter&0xF)) { aux_note.command=CPNote::EMPTY; aux_note.parameter=0; break; }
- aux_note.command='D'-'A';
- aux_note.parameter=0x0F|((aux_note.parameter&0xF)<<4);
-
- break;
- case 0xb: /* XM fine volume down */
- if (!(aux_note.parameter&0xF)) { aux_note.command=CPNote::EMPTY; aux_note.parameter=0; break; }
- aux_note.command='D'-'A';
- aux_note.parameter=0xF0|(aux_note.parameter&0xF);
-
- break;
- case 0x9: /* XM fine volume down */
- if (!(aux_note.parameter&0xF)) { aux_note.command=CPNote::EMPTY; aux_note.parameter=0; break; }
- aux_note.command='Q'-'A';
- aux_note.parameter=0x00|(aux_note.parameter&0xF);
- break;
-
- case 0xc: //notecut
-
- aux_note.parameter=0xC0|(aux_note.parameter&0xF);
- break;
-
- case 0xd: //notedelay
-
- aux_note.parameter=0xD0|(aux_note.parameter&0xF);
- break;
-
- case 0xe: //patterndelay
-
- aux_note.parameter=0xE0|(aux_note.parameter&0xF);
- break;
- }
-
- break;
- case 0xf:
- if (aux_note.parameter<32) {
- aux_note.command='A'-'A';
- } else {
- aux_note.command='T'-'A';
- }
- break;
- case 'G'-55:
- aux_note.command='V'-'A';
- break;
- case 'H'-55:
- aux_note.command='W'-'A';
- break;
- case 'K'-55:
- if (aux_note.note!=CPNote::EMPTY) break;
- aux_note.note=CPNote::OFF;
- break;
- case 'P'-55:
- aux_note.command='P'-'A';
- break;
- case 'R'-55:
- aux_note.command='Q'-'A';
- break;
- case 'T'-55:
- aux_note.command='I'-'A';
- break;
- default: {
-
- aux_note.command=CPNote::EMPTY;
- }
- }
-
-
- }
-
- song->get_pattern( i)->set_note( k,j,aux_note );
- }
- }
-
- /**************************************
- LOAD INSTRUMENTS!
- ***************************************/
-
- for (int i=0;i<header.instruments_used;i++) {
-
-
- uint32_t aux;
- int sampnum;
-
- CPInstrument &instrument=*song->get_instrument(i);
- uint32_t cpos=file->get_pos();
- //printf("pos is %i\n",cpos);
-
-
-
-/* +4 */ uint32_t hsize=file->get_dword(); //header length
-
- char instrname[23];
- instrname[22]=0;
-
- file->get_byte_array((uint8_t*)instrname,22);
-//XM_LOAD_DEBUG printf("name is %s\n",instrname);
-
-/* +27 */ aux=file->get_byte(); //byte that must be ignored
-//XM_LOAD_DEBUG printf("header size is %i\n",hsize);
-
-/* +29 */ sampnum=file->get_word();
-
-//XM_LOAD_DEBUG printf("samples %i\n",sampnum);
-
-
- instrument.set_name( instrname );
-// printf("Header Len: %i, CPInstrument %i, %i samples , name: s,\n",hsize,i,sampnum,instrname);
-
- if (sampnum==0) {
- //aux=file->get_dword(); //Why is this for? -- for nothing, skipped
- if (hsize) {
-
- file->seek( cpos+hsize ); //skip header if size has been specified
- }
- continue;
- }
-
-/* +33 */ file->get_dword();
-
- if (Error result=load_instrument_internal(&instrument,false,cpos,hsize,sampnum)) {
-
- CP_PRINTERR("Error loading instrument");
- file->close();
- return result;
- }
-
- }
-//
- file->close();
- return FILE_OK;
-}
-
-CPLoader::Error CPLoader_XM::load_instrument_internal(CPInstrument *p_instr,bool p_xi,int p_cpos, int p_hsize, int p_sampnum) {
-
- int sampnum;
- uint32_t aux;
- uint8_t notenumb[96];
- uint16_t panenv[24],volenv[24];
- int volpoints,panpoints;
- int vol_loop_begin,vol_loop_end,vol_sustain_loop;
- int pan_loop_begin,pan_loop_end,pan_sustain_loop;
- char instrname[23];
- int sample_index[16]={-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1}; //-1 means no index!
-
- instrname[22]=0;
-
-
-/* +129 */ file->get_byte_array((uint8_t*)notenumb,96);
- for (int j=0;j<24;j++) {
- volenv[j]=file->get_word();
- }
- for (int j=0;j<24;j++) {
- panenv[j]=file->get_word();
- }
-
-/* +177 */
-/* +225 */
-/* +226 */ volpoints=file->get_byte();
-/* +227 */ panpoints=file->get_byte();
-/* +230 */ vol_sustain_loop=file->get_byte();
-/* +228 */ vol_loop_begin=file->get_byte();
-/* +229 */ vol_loop_end=file->get_byte();
-
-//XM_LOAD_DEBUG printf("1- volpoints: %i, panpoints: %i, susloop: %i, loop begin: %i, loop end %i\n",volpoints,panpoints,vol_sustain_loop,vol_loop_begin,vol_loop_end);
- pan_sustain_loop=file->get_byte();
-/* +231 */ pan_loop_begin=file->get_byte();
-/* +232 */ pan_loop_end=file->get_byte();
-
-
-
-/* +234 */ aux=file->get_byte();
- p_instr->get_volume_envelope()->reset();
- p_instr->get_volume_envelope()->set_enabled(aux&1);
- p_instr->get_volume_envelope()->set_sustain_loop_enabled((aux&2)?true:false);
- p_instr->get_volume_envelope()->set_loop_enabled((aux&4)?true:false);
-/* +235 */ aux=file->get_byte();
- p_instr->get_pan_envelope()->reset();
- p_instr->get_pan_envelope()->set_enabled(aux&1);
- p_instr->get_pan_envelope()->set_sustain_loop_enabled((aux&2)?true:false);
- p_instr->get_pan_envelope()->set_loop_enabled((aux&4)?true:false);
-
-/* +239 */ aux=file->get_dword(); // sadly, cant use those
-/* +241 */ p_instr->set_volume_fadeout( file->get_word() >> 4 );
-/* +243 */ aux=file->get_word(); // reserved!
-
-
-
- for (int j=0;j<volpoints;j++) {
- int ofs=volenv[j*2];
- int val=volenv[j*2+1];
- p_instr->get_volume_envelope()->add_position(ofs,val);
-
- }
-
- //make sure minimum is 2
- while (p_instr->get_volume_envelope()->get_node_count()<2) {
-
- p_instr->get_volume_envelope()->add_position( p_instr->get_volume_envelope()->get_node_count()*20,64 );
- }
-
- for (int j=0;j<panpoints;j++) {
- int ofs=panenv[j*2];
- int val=panenv[j*2+1];
- p_instr->get_pan_envelope()->add_position(ofs,val-32);
- }
-
- //make sure minimum is 2
- while (p_instr->get_pan_envelope()->get_node_count()<2) {
-
- p_instr->get_pan_envelope()->add_position( p_instr->get_pan_envelope()->get_node_count()*20,0 );
- }
-
-
- p_instr->get_volume_envelope()->set_loop_begin(vol_loop_begin);
- p_instr->get_volume_envelope()->set_loop_end(vol_loop_end);
- p_instr->get_volume_envelope()->set_sustain_loop_end(vol_sustain_loop);
- p_instr->get_volume_envelope()->set_sustain_loop_begin(vol_sustain_loop);
- p_instr->get_pan_envelope()->set_loop_begin(pan_loop_begin);
- p_instr->get_pan_envelope()->set_loop_end(pan_loop_end);
- p_instr->get_pan_envelope()->set_sustain_loop_end(pan_sustain_loop);
- p_instr->get_pan_envelope()->set_sustain_loop_begin(pan_sustain_loop);
-
-
- if (!p_xi) {
-
- if ((file->get_pos()-p_cpos)<p_hsize) {
-
- uint8_t junkbuster[500];
-
- //printf("extra junk XM instrument in header! hsize is %i, extra junk: %i\n",p_hsize,(file->get_pos()-p_cpos));
- //printf("extra: %i\n",p_hsize-(file->get_pos()-p_cpos));
- file->get_byte_array((uint8_t*)junkbuster,p_hsize-(file->get_pos()-p_cpos));
- }
-
- sampnum=p_sampnum;
- } else {
-
- uint8_t junkbuster[500];
- file->get_byte_array((uint8_t*)junkbuster,20); //14 bytes?
-
- sampnum=file->get_word();
-
- }
-
-
- CPSampleManager *sm=CPSampleManager::get_singleton();
-
- /*SAMPLE!!*/
-
- for (int j=0;j<sampnum;j++) {
-
- if (j>16) ABORT_LOAD;
-
-
- int s_idx=-1;
- for (int s=0;s<CPSong::MAX_SAMPLES;s++) {
-
- if (song->get_sample(s)->get_sample_data().is_null()) {
- //empty sample!
- s_idx=s;
- break;
- }
- }
-
- if (s_idx==-1) ABORT_LOAD;
- //printf("free sample: %i\n",s_idx);
-
-
- CPSample& sample=*song->get_sample(s_idx);
-
- int sample_size=file->get_dword();
- int tmp_loop_begin=file->get_dword();
-
- int tmp_loop_end=file->get_dword();
-
- sample.set_default_volume(file->get_byte());
-
- uint8_t ftb=file->get_byte();
- int8_t *fts=(int8_t*)&ftb;
- int finetune=*fts;
- uint32_t flags=file->get_byte();
-
- if (flags&16) { // is 16 bits.. at flag 16.. fun :)
-
- tmp_loop_end/=2;
- tmp_loop_begin/=2;
- sample_size/=2;
- }
-
-
- CPSample_ID sample_data=sm->create( flags&16, false, sample_size );
-
- sample.set_sample_data(sample_data);
- sm->set_loop_begin(sample_data,tmp_loop_begin);
- sm->set_loop_end(sample_data,tmp_loop_end+tmp_loop_begin);
-
- sm->set_loop_type( sample_data, (flags&3)?( (flags&2) ? CP_LOOP_BIDI : CP_LOOP_FORWARD ):CP_LOOP_NONE );
-
-
-
- sample.set_pan_enabled(true);
- sample.set_pan(file->get_byte()*64/255);
- uint8_t noteb=file->get_byte();
- int8_t *notes=(int8_t*)&noteb;
- int note_offset=*notes;
- note_offset+=48;
- //note_offset+=60;
-
-
-
- //int linear_period=10*12*16*4 - (note_offset)*16*4 - finetune/2;
- //int freq=(int)(8363*pow(2.0,(double)(6*12*16*4 - linear_period) / (double)(12*16*4)));
-
- //sm->set_c5_freq( sample_data, freq);
- sm->set_c5_freq( sample_data, CPTables::get_linear_frequency(CPTables::get_linear_period(note_offset<<1,finetune)) );
- //printf("NOTE %i,fine %i\n",note_offset,finetune);
-
- char auxb;
- auxb=file->get_byte(); //reserved?
- file->get_byte_array((uint8_t*)instrname,22);
- sample.set_name(instrname);
-
- sample_index[j]=s_idx;
- }
-
- /*SAMPLE __DATA__!!*/
-
- for (int j=0;j<sampnum;j++) {
-
- if (sample_index[j]==-1) continue;
-
- CPSample *sample=song->get_sample(sample_index[j]);
- CPSample_ID sid=sample->get_sample_data();
-
- sm->lock_data(sid);
-
- void*dataptr=sm->get_data(sid);
-
- if (sm->is_16bits( sid)) {
-
- int16_t old=0;
-
-
- for (int k=0;k<sm->get_size(sid);k++) {
-
- int16_t newsample;
- int16_t sampleval=file->get_word();
- newsample=sampleval+old;
- old=newsample;
-
- ((int16_t*)dataptr)[k]=newsample;
- //sm->set_data( sid, k, newsample );
- }
- } else {
-
- int8_t old=0;
-
-
- for (int k=0;k<sm->get_size(sid);k++) {
-
- int8_t newsample;
- int8_t sampleval=file->get_byte();
- newsample=sampleval+old;
- old=newsample;
-
- ((int8_t*)dataptr)[k]=newsample;
-
- //sm->set_data( sid, k, (int16_t)newsample << 8 );
-
- }
- }
-
- sm->unlock_data(sid);
-
- }
-
- for (int j=0;j<96;j++) {
-
- int val=notenumb[j];
- if ((val<0) || (val>15)) continue;
- else val=sample_index[val];
- if (val==-1) continue;
- p_instr->set_sample_number( 12+j,val );
- }
-
-
- return FILE_OK;
-}
-
-
-
-CPLoader::Error CPLoader_XM::load_sample(const char *p_file,CPSample *p_sample) {
-
- return FILE_UNRECOGNIZED;
-}
-
-
-/* Compute CPInstrument Info */
-CPLoader::Error CPLoader_XM::load_instrument(const char *p_file,CPSong *p_song,int p_instr_idx) {
-
- if ( file->open(p_file,CPFileAccessWrapper::READ) ) return FILE_CANNOT_OPEN;
- //int i;
- song=p_song;
- CPInstrument& instr=*p_song->get_instrument( p_instr_idx );
- int aux;
-
-
- char buffer[500];
- file->get_byte_array((uint8_t*)buffer,0x15);
- buffer[8]=0;
- if ( buffer[0]!='E' ||
- buffer[1]!='x' ||
- buffer[2]!='t' ||
- buffer[3]!='e' ||
- buffer[4]!='n' ||
- buffer[5]!='d' ||
- buffer[6]!='e' ||
- buffer[7]!='d') {
- file->close();
- return FILE_UNRECOGNIZED;
- }
-
- file->get_byte_array((uint8_t*)buffer,0x16);
- buffer[0x16]=0;
- instr.set_name(buffer);
- aux=file->get_byte(); //says ignore ti
- /*if(aux!=0x1a) { I'm not sure. this is supposed to be ignored...
-
- file->close();
- return FILE_UNRECOGNIZED;
- } */
-
- file->get_byte_array((uint8_t*)buffer,0x14); //somethingaboutthename
- aux=file->get_word(); //version or blahblah
-
- if (load_instrument_internal(&instr,true,0,0)) {
-
- file->close();
- return FILE_CORRUPTED;
- }
-
- file->close(); //ook, we got it..
-
-
- return FILE_OK;
-
-}
-
-
-
-CPLoader_XM::CPLoader_XM(CPFileAccessWrapper *p_file){
-
- file=p_file;
-}
-CPLoader_XM::~CPLoader_XM(){
-}
-
diff --git a/modules/chibi/cp_loader_xm.h b/modules/chibi/cp_loader_xm.h
deleted file mode 100644
index 9ae480cc8f..0000000000
--- a/modules/chibi/cp_loader_xm.h
+++ /dev/null
@@ -1,89 +0,0 @@
-/*************************************************************************/
-/* cp_loader_xm.h */
-/*************************************************************************/
-/* This file is part of: */
-/* GODOT ENGINE */
-/* http://www.godotengine.org */
-/*************************************************************************/
-/* Copyright (c) 2007-2016 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 CP_LOADER_XM_H
-#define CP_LOADER_XM_H
-
-#include "cp_loader.h"
-
-
-/**
- *@author red
- */
-
-
-
-
-class CPLoader_XM : public CPLoader {
-
-
- struct XM_Header {
-
- uint8_t idtext[18];
- uint8_t songname[21];
- uint8_t hex1a; // ?
- uint8_t trackername[21];
- uint16_t version;
- uint32_t headersize; //from here
-
- uint16_t songlength; //pattern ordertable
- uint16_t restart_pos;
- uint16_t channels_used;
- uint16_t patterns_used;
- uint16_t instruments_used;
- uint16_t use_linear_freq;
- uint16_t tempo;
- uint16_t speed;
- uint8_t orderlist[256];
-
- } header;
-
- CPFileAccessWrapper *file;
-
- Error load_instrument_internal(CPInstrument *pint,bool p_xi,int p_cpos, int p_hsize, int p_sampnumb=-1);
- CPSong *song;
-
-public:
-
- bool can_load_song() { return true; }
- bool can_load_sample() { return false; }
- bool can_load_instrument() { return true; }
-
- Error load_song(const char *p_file,CPSong *p_song,bool p_sampleset);
- Error load_sample(const char *p_file,CPSample *p_sample);
- Error load_instrument(const char *p_file,CPSong *p_song,int p_instr_idx);
-
-
- CPLoader_XM(CPFileAccessWrapper *p_file);
- ~CPLoader_XM();
-};
-
-
-
-#endif
diff --git a/modules/chibi/cp_mixer.h b/modules/chibi/cp_mixer.h
deleted file mode 100644
index 7ad22ac146..0000000000
--- a/modules/chibi/cp_mixer.h
+++ /dev/null
@@ -1,115 +0,0 @@
-/*************************************************************************/
-/* cp_mixer.h */
-/*************************************************************************/
-/* This file is part of: */
-/* GODOT ENGINE */
-/* http://www.godotengine.org */
-/*************************************************************************/
-/* Copyright (c) 2007-2016 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 CP_MIXER_H
-#define CP_MIXER_H
-
-#include "cp_sample_defs.h"
-
-/**Abstract base class representing a mixer
- *@author Juan Linietsky
- */
-
-
-/******************************
- mixer.h
- ----------
-
-Abstract base class for the mixer.
-This is what the player uses to setup
-voices and stuff.. this way
-it can be abstracted to hardware
-devices or other stuff..
-********************************/
-
-class CPSample_ID; /* need this */
-
-class CPMixer {
-public:
-
- enum {
-
- FREQUENCY_BITS=8
-
- };
-
- enum ReverbMode {
- REVERB_MODE_ROOM,
- REVERB_MODE_STUDIO_SMALL,
- REVERB_MODE_STUDIO_MEDIUM,
- REVERB_MODE_STUDIO_LARGE,
- REVERB_MODE_HALL,
- REVERB_MODE_SPACE_ECHO,
- REVERB_MODE_ECHO,
- REVERB_MODE_DELAY,
- REVERB_MODE_HALF_ECHO
- };
-
- /* Callback */
-
- virtual void set_callback_interval(int p_interval_us)=0; //in usecs, for tracker it's 2500000/tempo
- virtual void set_callback(void (*p_callback)(void*),void *p_userdata)=0;
-
- /* Voice Control */
-
- virtual void setup_voice(int p_voice_index,CPSample_ID p_sample_id,int32_t p_start_index) =0;
- virtual void stop_voice(int p_voice_index) =0;
- virtual void set_voice_frequency(int p_voice_index,int32_t p_freq) =0; //in freq*FREQUENCY_BITS
- virtual void set_voice_panning(int p_voice_index,int p_pan) =0;
- virtual void set_voice_volume(int p_voice_index,int p_vol) =0;
- virtual void set_voice_filter(int p_filter,bool p_enabled,uint8_t p_cutoff, uint8_t p_resonance )=0;
- virtual void set_voice_reverb_send(int p_voice_index,int p_reverb)=0;
- virtual void set_voice_chorus_send(int p_voice_index,int p_chorus)=0; /* 0 - 255 */
-
- virtual void set_reverb_mode(ReverbMode p_mode)=0;
- virtual void set_chorus_params(unsigned int p_delay_ms,unsigned int p_separation_ms,unsigned int p_depth_ms10,unsigned int p_speed_hz10)=0;
-
-
- /* Info retrieving */
-
- virtual int32_t get_voice_sample_pos_index(int p_voice_index) =0;
- virtual int get_voice_panning(int p_voice_index) =0;
- virtual int get_voice_volume(int p_voice_index) =0;
- virtual CPSample_ID get_voice_sample_id(int p_voice_index) =0;
- virtual bool is_voice_active(int p_voice_index) =0;
- virtual int get_active_voice_count()=0;
- virtual int get_total_voice_count()=0;
-
-
- virtual uint32_t get_mix_frequency()=0; //if mixer is not software, return 0
-
- /* Methods below only work with software mixers, meant for software-based sound drivers, hardware mixers ignore them */
- virtual int32_t process(int32_t p_frames)=0; /* Call this to process N frames, returns how much it was processed */
- virtual int32_t *get_mixdown_buffer_ptr()=0; /* retrieve what was mixed */
- virtual void set_mix_frequency(int32_t p_mix_frequency)=0;
-
- virtual ~CPMixer() {}
-};
-
-#endif
diff --git a/modules/chibi/cp_note.h b/modules/chibi/cp_note.h
deleted file mode 100644
index 5cfa3f11ec..0000000000
--- a/modules/chibi/cp_note.h
+++ /dev/null
@@ -1,102 +0,0 @@
-/*************************************************************************/
-/* cp_note.h */
-/*************************************************************************/
-/* This file is part of: */
-/* GODOT ENGINE */
-/* http://www.godotengine.org */
-/*************************************************************************/
-/* Copyright (c) 2007-2016 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 CP_NOTE_H
-#define CP_NOTE_H
-
-#include "cp_config.h"
-
-struct CPNote {
-
- enum {
-
- NOTES=120,
- OFF=254,
- CUT=253,
- EMPTY=255,
- SCRIPT=252,
- };
-
-
- uint8_t note;
- uint8_t instrument;
- uint8_t volume;
- uint8_t command;
- uint8_t parameter;
- unsigned int script_source_sign;
- bool cloned;
-
- void clear() {
-
- note=EMPTY;
- instrument=EMPTY;
- volume=EMPTY;
- command=EMPTY;
- parameter=0;
- script_source_sign='\0';
- cloned=false;
- }
-
- void raise() {
-
- if (note<(NOTES-1))
- note++;
- else if (note==SCRIPT && parameter<0xFF)
- parameter++;
- }
-
- void lower() {
-
- if ((note>0) && (note<NOTES))
- note--;
- else if (note==SCRIPT && parameter>0)
- parameter--;
-
- }
-
- bool operator== (const CPNote &rvalue) {
-
- return (
- (note==rvalue.note) &&
- (instrument==rvalue.instrument) &&
- (volume==rvalue.volume) &&
- (command==rvalue.command) &&
- (parameter==rvalue.parameter)
- );
- }
-
- bool is_empty() const { return (note==EMPTY && instrument==EMPTY && volume==EMPTY && command==EMPTY && parameter==0 && !cloned); }
- CPNote() {
-
- clear();
- }
-};
-
-
-#endif
-
diff --git a/modules/chibi/cp_order.h b/modules/chibi/cp_order.h
deleted file mode 100644
index 03ecc00bba..0000000000
--- a/modules/chibi/cp_order.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/*************************************************************************/
-/* cp_order.h */
-/*************************************************************************/
-/* This file is part of: */
-/* GODOT ENGINE */
-/* http://www.godotengine.org */
-/*************************************************************************/
-/* Copyright (c) 2007-2016 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 CP_ORDER_H
-#define CP_ORDER_H
-
-
-#include "cp_config.h"
-
-enum CPOrderType {
- CP_ORDER_NONE=255,
- CP_ORDER_BREAK=254
-};
-
-typedef uint8_t CPOrder;
-
-#endif
-
diff --git a/modules/chibi/cp_pattern.cpp b/modules/chibi/cp_pattern.cpp
deleted file mode 100644
index 83e165bf87..0000000000
--- a/modules/chibi/cp_pattern.cpp
+++ /dev/null
@@ -1,574 +0,0 @@
-/*************************************************************************/
-/* cp_pattern.cpp */
-/*************************************************************************/
-/* This file is part of: */
-/* GODOT ENGINE */
-/* http://www.godotengine.org */
-/*************************************************************************/
-/* Copyright (c) 2007-2016 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 "cp_pattern.h"
-
-void CPPattern::clear() {
-
- if (event_count>0) {
-
-
- CP_FREE(events);
- events=NULL;
- event_count=0;
- }
-
- length=DEFAULT_LEN;
-
-}
-
-
-bool CPPattern::resize_event_list_to(uint32_t p_events) {
-
-
- //Module is slow in some cpus, so this should be fast enough
- uint32_t new_size=((p_events-1)&(~((1<<RESIZE_EVERY_BITS)-1)))+(1<<RESIZE_EVERY_BITS);
-
- CP_ERR_COND_V(new_size<p_events,true); //bugARM_INFO
-
- if (event_count==0 && new_size==0)
- return false; //nothing to do
-
- if (event_count==0) {
-
- events=(Event*)CP_ALLOC( new_size*sizeof(Event) );
-
- } else if (new_size==0) {
-
- CP_FREE(events);
- events=NULL;
- } else {
-
- CP_ERR_COND_V(events==NULL,true);
- events=(Event*)CP_REALLOC(events, new_size*sizeof(Event));
-
- }
-
- event_count=p_events;
-
- return false;
-}
-
-
-int32_t CPPattern::get_event_pos(uint16_t p_target_pos) {
-
-
- if (event_count==0)
- return -1;
-
- int low = 0;
- int high = event_count -1;
- int middle;
-
- while( low <= high )
- {
- middle = ( low + high ) / 2;
-
- if( p_target_pos == events[middle].pos ) { //match
- break;
- } else if( p_target_pos < events[middle].pos )
- high = middle - 1; //search low end of array
- else
- low = middle + 1; //search high end of array
- }
-
- /* adapt so we are behind 2 */
-
- if (events[middle].pos<p_target_pos)
- middle++;
- return middle;
-
- /* Linear search for now */
-
- /*
- int32_t pos_idx=0;
-
- for (;pos_idx<event_count;pos_idx++) {
-
- if (event_list[pos_idx].pos>=p_target_pos)
- break;
-
- } */
-
- //return pos_idx;
-}
-
-bool CPPattern::erase_event_at_pos(uint16_t p_pos) {
-
- if (event_count==0)
- return false;
-
-
-
- Event *event_list=events;
-
- int32_t pos_idx = get_event_pos(p_pos);
- if (pos_idx==-1) {
- CP_ERR_COND_V(pos_idx==-1,true);
- }
-
- if (pos_idx==event_count || event_list[pos_idx].pos!=p_pos) {
- /* Nothing to Erase */
- return false;
- }
-
- for (int32_t i=pos_idx;i<(event_count-1);i++) {
-
- event_list[i]=event_list[i+1];
- }
-
-
- resize_event_list_to(event_count-1);
-
- return false;
-}
-
-bool CPPattern::set_note(uint8_t p_column, uint16_t p_row,const CPNote& p_note) {
-
- CP_ERR_COND_V(p_column>=WIDTH,true);
- CP_ERR_COND_V(p_row>=length,true);
-
- int32_t new_pos;
- uint16_t target_pos=p_row*WIDTH+p_column;
-
-
-
- if (p_note.is_empty()) {
- bool res=erase_event_at_pos(target_pos);
-
- return res;;
- }
-
- Event *event_list=0;
-
- if (event_count==0) {
- /* If no events, create the first */
-
- if (resize_event_list_to(1)) {
-
- CP_PRINTERR("Can't resize event list to 1");
- return true;
- }
-
- event_list=events;
- if (event_list==0) {
-
-
- CP_PRINTERR("Can't get event list");
- return true;
- }
-
- new_pos=0;
-
- } else {
- /* Prepare to add */
-
- event_list=events;
- if (event_list==0) {
-
-
- CP_PRINTERR("Can't get event list");
- return true;
- }
-
- int32_t pos_idx = get_event_pos(target_pos);
-
- if (pos_idx==-1) {
-
-
- CP_PRINTERR("Can't find add position");
- return true;
- }
-
-
- if (pos_idx==event_count || event_list[pos_idx].pos!=target_pos) {
- /* If the note being modified didnt exist, then we add it */
-
- //resize, and return if out of mem
- if (resize_event_list_to( event_count+1)) {
-
-
- CP_PRINTERR("Can't resize event list");
- return true;
- }
- event_list=events;
- if (event_list==0) {
-
-
- CP_PRINTERR("Can't get event list");
- return true;
- }
-
- //make room for new pos, this wont do a thing if pos_idx was ==event_count
- for(int32_t i=(event_count-1);i>pos_idx;i--) {
- event_list[i]=event_list[i-1];
-
- }
-
- } /* Else it means that position is taken, so we just modify it! */
-
-
- new_pos=pos_idx;
- }
-
- event_list[new_pos].pos=target_pos;
- event_list[new_pos].note=p_note.note;
- event_list[new_pos].instrument=p_note.instrument;
- event_list[new_pos].volume=p_note.volume;
- event_list[new_pos].command=p_note.command;
- event_list[new_pos].parameter=p_note.parameter;
- event_list[new_pos].script_source_sign=p_note.script_source_sign;
- event_list[new_pos].cloned=p_note.cloned;
-
-
-
-
- return false;
-
-}
-CPNote CPPattern::get_note(uint8_t p_column,uint16_t p_row) {
-
- if (p_column==CPNote::EMPTY) return CPNote();
-
- CP_ERR_COND_V(p_column>=WIDTH,CPNote());
- CP_ERR_COND_V(p_row>=length,CPNote());
-
- if (event_count==0)
- return CPNote();
-
-
- Event *event_list=events;
-
- CP_ERR_COND_V(event_list==0,CPNote());
-
- uint16_t target_pos=p_row*WIDTH+p_column;
- int32_t pos_idx = get_event_pos(target_pos);
- if (pos_idx==-1) {
-
- CP_PRINTERR("Can't find event pos");
- return CPNote();
- }
-
- if (pos_idx>=event_count || event_list[pos_idx].pos!=target_pos) {
- /* no note found */
-
- return CPNote();
- }
-
- CPNote n;
- n.note=event_list[pos_idx].note;
- n.instrument=event_list[pos_idx].instrument;
- n.volume=event_list[pos_idx].volume;
- n.command=event_list[pos_idx].command;
- n.parameter=event_list[pos_idx].parameter;
- n.script_source_sign=event_list[pos_idx].script_source_sign;
- n.cloned=event_list[pos_idx].cloned;
-
-
- return n;
-
-}
-
-CPNote CPPattern::get_transformed_script_note(uint8_t p_column,uint16_t p_row ) {
-
- CPNote n = get_note( p_column, p_row );
-
- // get source channel and note
-
- int channel = get_scripted_note_target_channel( p_column, p_row );
- CPNote src_n = get_note( channel, 0 );
-
- if ( src_n.note == CPNote::SCRIPT ) return CPNote();
-
- script_transform_note( src_n, n );
-
- return src_n;
-
-}
-
-int CPPattern::get_scripted_note_target_channel(uint8_t p_column, uint16_t p_row) {
-
- CPNote n = get_note( p_column, p_row );
-
- if ( n.note != CPNote::SCRIPT ) return CPNote::EMPTY;
-
- int channel = n.instrument;
-
- if ( n.script_source_sign == '\0' ) {
-
- if ( channel < 0 || channel >= CPPattern::WIDTH ) return CPNote::EMPTY;
-
- } else {
-
- channel = p_column + ( ( n.script_source_sign=='+') ? 1 : -1 ) * (channel+1);
- if ( channel < 0 || channel >= CPPattern::WIDTH ) return CPNote::EMPTY;
-
- }
-
- return channel;
-}
-
-void CPPattern::scripted_clone(uint8_t p_column, uint16_t p_row) {
-
- int channel = get_scripted_note_target_channel( p_column, p_row );
- int src_row = 1;
- CPNote script_n = get_note( p_column, p_row );
-
- for ( int row = p_row+1; row < length; ++row ) {
-
- CPNote src_n = get_note( channel, src_row );
- CPNote target_n = get_note( p_column, row );
-
- if ( target_n.note != CPNote::SCRIPT ) {
- if ( src_n.note == CPNote::SCRIPT ) {
- src_n = CPNote();
- channel = CPNote::EMPTY;
- }
-
- script_transform_note( src_n, script_n );
-
- src_n.cloned = true;
- set_note( p_column, row, src_n );
-
- } else {
-
- return;
-
- }
-
- src_row++;
- }
-
-}
-
-void CPPattern::scripted_clone_remove(uint8_t p_column, uint16_t p_row) {
-
- if ( get_note( p_column, p_row ).cloned )
- set_note( p_column, p_row, CPNote() );
-
- for ( int row = p_row+1; row < length; ++row ) {
-
- CPNote target_n = get_note( p_column, row );
-
- if ( target_n.note != CPNote::SCRIPT ) {
-
- set_note( p_column, row, CPNote() );
-
- } else {
-
- return;
-
- }
-
- }
-
-}
-
-void CPPattern::script_transform_note(CPNote& n, const CPNote& p_note) {
-
- // set instrument
-
- if ( n.note < CPNote::NOTES && p_note.volume != CPNote::EMPTY ) {
-
- n.instrument = p_note.volume;
-
- }
-
- // transpose
-
- if ( n.note < CPNote::NOTES && p_note.command != CPNote::EMPTY ) {
-
- int transpose = ( p_note.parameter & 0xF ) + ( p_note.parameter / 0x10 ) * 12;
-
- if ( p_note.command == '^' ) {
-
- if ( n.note >= CPNote::NOTES-transpose )
- n.note = CPNote::NOTES-1;
- else
- n.note += transpose;
-
- } else if ( p_note.command == 'v' ) {
-
- if ( n.note <= transpose )
- n.note = 0;
- else
- n.note -= transpose;
-
- }
- }
-
-}
-
-bool CPPattern::update_scripted_clones_sourcing_channel( int channel ) {
-
- bool updated = false;
-
- for ( int x = 0; x < WIDTH; ++x ) {
-
- for (int y = 0; y < length; ++y ) {
-
- if ( channel == get_scripted_note_target_channel( x, y ) ) {
-
- scripted_clone( x, y );
- updated = true;
- }
-
- }
-
- }
-
- return updated;
-}
-
-void CPPattern::set_length(uint16_t p_rows) {
-
-
-
- if (event_count==0) {
-
- if (p_rows>=MIN_ROWS)
- length=p_rows;
-
-
- return;
-
- }
-
- if (p_rows<MIN_ROWS) {
-
- return;
- }
-
- if (p_rows<length) {
-
- Event* event_list=events;
- if (event_list==0) {
-
- CP_PRINTERR("get_event_list() Failed");
- return;
- }
-
-
- uint16_t target_pos=p_rows*WIDTH;
- int32_t pos_idx = get_event_pos(target_pos);
-
-
- if (pos_idx==-1) {
-
- CP_ERR_COND(pos_idx==-1);
- }
-
- if (resize_event_list_to(pos_idx)) {
-
- CP_PRINTERR("resize_event_list_to(pos_idx) Failed");
- return;
- }
-
- }
-
- length=p_rows;
-
-
-}
-#if 0
-void CPPattern::copy_to(CPPattern *p_pattern) const {
-
-
-
-
- p_pattern->clear();
- p_pattern->length=length;
-
-
- if (!event_count)
- return;
-
-
-
- int bufsiz=MemPool_Wrapper::get_singleton()->get_mem_size( mem_handle );
- MemPool_Handle aux_mem_handle=MemPool_Wrapper::get_singleton()->alloc_mem( bufsiz );
-
- if (aux_mem_handle.is_null()) {
-
- CP_PRINTERR("own handle is null");
-
- return;
- }
-
-
- if (MemPool_Wrapper::get_singleton()->lock_mem(aux_mem_handle)) {
- CP_PRINTERR("Unable to lock aux new handle");
-
- return;
-
- }
-
- if (MemPool_Wrapper::get_singleton()->lock_mem(mem_handle)) {
-
- CP_PRINTERR("Unable to lock own handle");
-
- return;
- }
-
- uint8_t* srcuint8_tt8_t*)MemPool_Wrapper::get_singleton()->get_mem(mem_handle);
- uint8_t* dstuint8_tt8_t*)MemPool_Wrapper::get_singleton()->get_mem(aux_mem_handle);
-
- for (int i=0;i<bufsiz;i++)
- dst[i]=src[i];
-
- MemPool_Wrapper::get_singleton()->unlock_mem(mem_handle);
- MemPool_Wrapper::get_singleton()->unlock_mem(aux_mem_handle);
-
- p_pattern->mem_handle=aux_mem_handle;
- p_pattern->event_count=event_count;
-
-
-}
-#endif
-uint16_t CPPattern::get_length() {
-
-
- return length;
-}
-CPPattern::CPPattern() {
-
-
- length=DEFAULT_LEN;
- event_count=0;
- clear();
-
-}
-bool CPPattern::is_empty() {
-
- return events==NULL;
-}
-
-CPPattern::~CPPattern() {
-
- clear();
-}
diff --git a/modules/chibi/cp_pattern.h b/modules/chibi/cp_pattern.h
deleted file mode 100644
index 4065caa5e5..0000000000
--- a/modules/chibi/cp_pattern.h
+++ /dev/null
@@ -1,94 +0,0 @@
-/*************************************************************************/
-/* cp_pattern.h */
-/*************************************************************************/
-/* This file is part of: */
-/* GODOT ENGINE */
-/* http://www.godotengine.org */
-/*************************************************************************/
-/* Copyright (c) 2007-2016 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 CP_PATTERN_H
-#define CP_PATTERN_H
-
-#include "cp_note.h"
-
-class CPPattern {
-public:
-
-
- enum {
- WIDTH=64,
- DEFAULT_LEN=64,
- RESIZE_EVERY_BITS=4,
- MIN_ROWS=1, //otherwise clipboard wont work
- MAX_LEN=256
-
- };
-
-private:
- struct Event {
-
- uint16_t pos; //column*WIDTH+row
- uint8_t note;
- uint8_t instrument;
- uint8_t volume;
- uint8_t command;
- uint8_t parameter;
- unsigned int script_source_sign;
- bool cloned;
- };
-
- uint16_t length;
- uint32_t event_count;
- Event* events;
-
- int32_t get_event_pos(uint16_t p_target_pos);
- bool erase_event_at_pos(uint16_t p_pos);
-
- bool resize_event_list_to(uint32_t p_events);
-
- void operator=(const CPPattern& p_pattern); //no operator=
-public:
-
- bool is_empty();
- void clear();
-
- bool set_note(uint8_t p_column, uint16_t p_row,const CPNote& p_note); //true if no more memory
- CPNote get_note(uint8_t p_column,uint16_t p_row);
-
- CPNote get_transformed_script_note(uint8_t p_column, uint16_t p_row);
- int get_scripted_note_target_channel(uint8_t p_column, uint16_t p_row);
- void scripted_clone(uint8_t p_column, uint16_t p_row);
- void scripted_clone_remove(uint8_t p_column, uint16_t p_row);
- void script_transform_note(CPNote& n, const CPNote& p_note);
- bool update_scripted_clones_sourcing_channel(int channel);
-
- //void copy_to(CPPattern *p_pattern) const;
- void set_length(uint16_t p_rows);
- uint16_t get_length();
- CPPattern();
- ~CPPattern();
-
-
-};
-
-#endif
diff --git a/modules/chibi/cp_player_data.cpp b/modules/chibi/cp_player_data.cpp
deleted file mode 100644
index 3f3e9a5202..0000000000
--- a/modules/chibi/cp_player_data.cpp
+++ /dev/null
@@ -1,151 +0,0 @@
-/*************************************************************************/
-/* cp_player_data.cpp */
-/*************************************************************************/
-/* This file is part of: */
-/* GODOT ENGINE */
-/* http://www.godotengine.org */
-/*************************************************************************/
-/* Copyright (c) 2007-2016 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 "cp_player_data.h"
-#include <stdio.h>
-
-
-CPPlayer::CPPlayer(CPMixer *p_mixer,CPSong *p_song){
-
- song=p_song;
- mixer=p_mixer;
- control.max_voices=p_mixer->get_total_voice_count()-1; //leave one for the sample
- control.force_no_nna=false;
- control.external_vibrato=false;
- control.filters=true;
- control.random_seed=128364; //anything
- control.play_mode=0;
- set_virtual_channels(p_mixer->get_total_voice_count());
- mixer->set_callback( &CPPlayer::callback_function, this );
-
- reset();
-}
-CPPlayer::~CPPlayer(){
-}
-
-void CPPlayer::set_virtual_channels(int p_amount) {
-
- if (p_amount<1) return;
- if (p_amount>mixer->get_total_voice_count())
- return;
-
- control.max_voices=p_amount;
-
-}
-
-
-void CPPlayer::callback_function(void *p_userdata) {
-
- CPPlayer*pd=(CPPlayer*)p_userdata;
- pd->process_tick();
-
-}
-
-void CPPlayer::process_tick() {
-
- handle_tick();
- mixer->set_callback_interval( 2500000/control.tempo );
- song_usecs+=2500000/control.tempo;
-}
-
-void CPPlayer::reset() {
-
- if ( mixer==NULL ) return ;
- if ( song==NULL ) return ;
-
- int i;
-
- for (i=0;i<control.max_voices;i++) {
-
- voice[i].reset();
- mixer->stop_voice(i);
- }
-
- for (i=0;i<CPPattern::WIDTH;i++) {
-
- control.channel[i].reset();
- control.channel[i].channel_volume=song->get_channel_volume(i);
- control.channel[i].channel_panning=((int)song->get_channel_pan( i)*PAN_RIGHT/64);
- if (song->is_channel_surround(i))
- control.channel[i].channel_panning=PAN_SURROUND;
- control.channel[i].mute=song->is_channel_mute( i );
- control.channel[i].chorus_send=song->get_channel_chorus(i)*0xFF/64;
- control.channel[i].reverb_send=song->get_channel_reverb(i)*0xFF/64;
- }
-
-
- control.speed=song->get_speed();
- control.tempo=song->get_tempo();
- control.global_volume=song->get_global_volume();
-
- control.position.current_pattern=0;
- control.position.current_row=0;
- control.position.current_order=0;
- control.position.force_next_order=-1;
- control.ticks_counter=control.speed;
- control.position.forbid_jump=false;
-
- song_usecs=0;
-
-}
-
-int64_t CPPlayer::get_channel_last_note_time_usec(int p_channel) const {
-
- CP_FAIL_INDEX_V(p_channel,64,-1);
- return control.channel[p_channel].last_event_usecs;
-
-}
-
-void CPPlayer::set_channel_global_volume(int p_channel,int p_volume) {
-
- CP_FAIL_INDEX(p_channel,64);
- control.channel[p_channel].channel_global_volume=CLAMP(p_volume,0,255);
-
-}
-
-int CPPlayer::get_channel_global_volume(int p_channel) const{
-
- CP_FAIL_INDEX_V(p_channel,64,-1);
- return control.channel[p_channel].channel_global_volume;
-
-}
-
-bool CPPlayer::reached_end_of_song() {
-
- return control.reached_end;
-
-}
-void CPPlayer::set_force_external_vibratos(bool p_force) {
-
- control.external_vibrato=p_force;
-}
-void CPPlayer::set_force_no_nna(bool p_force) {
-
- control.force_no_nna=p_force;
-}
diff --git a/modules/chibi/cp_player_data.h b/modules/chibi/cp_player_data.h
deleted file mode 100644
index 282592b8f4..0000000000
--- a/modules/chibi/cp_player_data.h
+++ /dev/null
@@ -1,582 +0,0 @@
-/*************************************************************************/
-/* cp_player_data.h */
-/*************************************************************************/
-/* This file is part of: */
-/* GODOT ENGINE */
-/* http://www.godotengine.org */
-/*************************************************************************/
-/* Copyright (c) 2007-2016 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 CP_PLAYER_DATA_H
-#define CP_PLAYER_DATA_H
-
-#include "cp_config.h"
-#include "cp_song.h"
-#include "cp_mixer.h"
-#include "cp_tables.h"
-
-/**CPPlayer Data
- *@author Juan Linietsky
- */
-
-/******************************
- player_data.h
- ------------------------
-
-The player and its data.
-I hope you dont get sick reading this
-********************************/
-
-//Default pan values
-
-
-class CPPlayer {
-
- enum {
- PAN_SURROUND=512,
- PAN_RIGHT=255,
- PAN_LEFT=0,
- PAN_CENTER=128
- };
-
-
- CPSong *song;
-
- CPMixer *mixer;
-
- struct Filter_Control {
-
- int32_t it_reso;
- int32_t it_cutoff;
- int32_t envelope_cutoff;
- int32_t final_cutoff;
-
- void process();
- void set_filter_parameters(int *p_cutoff,uint8_t *p_reso);
-
- };
-
- //tells you if a channel is doing
- //noteoff/notekill/notefade/etc
- enum {
-
- END_NOTE_NOTHING=0,
- END_NOTE_OFF=1,
- END_NOTE_FADE=2,
- END_NOTE_KILL=4
- };
-
- //Tells you what should a channel restart
- enum {
-
- KICK_NOTHING,
- KICK_NOTE,
- KICK_NOTEOFF,
- KICK_ENVELOPE
- };
-
- enum {
-
- MAX_VOICES=256
- };
-
- struct Channel_Control;
-
- struct Voice_Control {
-
- struct Envelope_Control {
-
- int pos_index;
- int status;
- int value;
- bool sustain_looping;
- bool looping;
- bool terminated;
- bool active;
- bool kill;
-
- };
-
- Filter_Control filter;
- uint16_t reverb_send;
- uint16_t chorus_send;
-
- CPInstrument* instrument_ptr;
- CPSample* sample_ptr;
-
-// Sample_Data *sample_data;
-
- int32_t period;
-
- int32_t sample_start_index; /* The starting byte index in the sample */
-
- bool has_master_channel;
- int master_channel_index;
- int instruement_index;
-
- int instrument_index;
- int sample_index;
- int8_t NNA_type;
-
- int note_end_flags;
-
- uint8_t sample; /* which instrument number */
-
- int16_t output_volume; /* output volume (vol + sampcol + instvol) */
- int8_t channel_volume; /* channel's "global" volume */
- uint16_t fadeout_volume; /* fading volume rate */
- int32_t total_volume; /* total volume of channel (before global mixings) */
- uint8_t kick; /* if true = sample has to be restarted */
-
- uint8_t note; /* the audible note (as heard, direct rep of period) */
-
- int16_t panning; /* panning position */
-
- uint8_t nna; /* New note action type + master/slave flags */
- uint8_t volflg; /* volume envelope settings */
- uint8_t panflg; /* panning envelope settings */
- uint8_t pitflg; /* pitch envelope settings */
- uint8_t keyoff; /* if true = fade out and stuff */
- int16_t handle; /* which sample-handle */
- int32_t start; /* The start byte index in the sample */
-
- /* Below here is info NOT in MP_CONTROL!! */
- //ENVPR venv;
- //ENVPR penv;
- //ENVPR cenv;
-
- Envelope_Control volume_envelope_ctrl;
- Envelope_Control panning_envelope_ctrl;
- Envelope_Control pitch_envelope_ctrl;
-
- uint16_t auto_vibrato_pos; /* autovibrato pos */
- uint16_t auto_vibrato_sweep_pos; /* autovibrato sweep pos */
-
- int16_t masterchn;
- uint16_t masterperiod;
-
- Channel_Control* master_channel; /* index of "master" effects channel */
-
- void start_envelope(CPEnvelope *p_envelope,Envelope_Control *p_envelope_ctrl,Envelope_Control *p_from_env);
- bool process_envelope(CPEnvelope *p_envelope,Envelope_Control *p_envelope_ctrl);
-
- uint16_t display_volume;
-
- Voice_Control() {
-
- reset();
- }
-
- void reset();
- void update_info_from_master_channel();
-
-
- };
-
-
- struct Channel_Control {
-
- /* NOTE info */
- uint8_t note; /* the audible note as heard, direct rep of period */
- uint8_t real_note; /* the note that indexes the audible */
- int32_t sample_start_index; /* The starting byte index in the sample */
- uint8_t old_note;
-
- uint8_t kick;
-
- Filter_Control filter;
- uint16_t reverb_send;
- uint16_t chorus_send;
-
-
- int note_end_flags;
-
- /* INSTRUMENT INFO */
-
- CPInstrument* instrument_ptr;
- CPSample* sample_ptr;
-
- uint8_t instrument_index;
- uint8_t sample_index;
- bool new_instrument;
-
- /* SAMPLE SPECIFIC INFO */
- int32_t base_speed; /* what finetune to use */
-
- /* INSTRUMENT SPECIFIC INFO */
-
- int8_t NNA_type;
- int8_t duplicate_check_type;
- int8_t duplicate_check_action;
-
- bool volume_envelope_on;
- bool panning_envelope_on;
- bool pitch_envelope_on;
-
- bool has_own_period;
-
- bool row_has_note;
-
- /* VOLUME COLUMN */
-
- int16_t volume; /* amiga volume (0 t/m 64) to play the sample at */
- int16_t aux_volume;
- bool has_own_volume;
- bool mute;
- int16_t random_volume_variation; /* 0-100 - 100 has no effect */
-
- /* VOLUME/PAN/PITCH MODIFIERS */
-
- int8_t default_volume; // CHANNEL default volume (0-64)
- int16_t channel_volume; // CHANNEL current volume //chanvol - current!
- int16_t output_volume; /* output volume (vol + sampcol + instvol) //volume */
- int16_t channel_global_volume;
-
- uint16_t fadeout_volume; /* fading volume rate */
-
- int32_t period; /* period to play the sample at */
-
- /* PAN */
-
- int16_t panning; /* panning position */
- int16_t channel_panning;
- int8_t sliding;
-
- uint16_t aux_period; /* temporary period */
-
-
-
- /* TIMING */
- uint8_t note_delay; /* (used for note delay) */
-
- /* Slave Voice Control */
-
- Voice_Control *slave_voice; /* Audio Slave of current effects control channel */
-
- struct Carry {
-
- Voice_Control::Envelope_Control vol;
- Voice_Control::Envelope_Control pan;
- Voice_Control::Envelope_Control pitch;
- bool maybe;
-
- } carry;
-
-
-
- uint8_t slave_voice_index; /* Audio Slave of current effects control channel */
-
- uint8_t* row; /* row currently playing on this channel */
-
- /* effect memory variables */
-
- uint8_t current_command;
- uint8_t current_parameter;
- uint8_t current_volume_command;
- uint8_t current_volume_parameter;
- uint8_t volcol_volume_slide;
-
- /* CPSample Offset */
-
- int32_t lo_offset;
- int32_t hi_offset;
-
- /* Panbrello waveform */
- uint8_t panbrello_type; /* current panbrello waveform */
- uint8_t panbrello_position; /* current panbrello position */
- int8_t panbrello_speed; /* "" speed */
- uint8_t panbrello_depth; /* "" depth */
- uint8_t panbrello_info;
- /* Arpegio */
-
- uint8_t arpegio_info;
- /* CPPattern Loop */
-
- int pattern_loop_position;
- int8_t pattern_loop_count;
-
- /* Vibrato */
- bool doing_vibrato;
- int8_t vibrato_position; /* current vibrato position */
- uint8_t vibrato_speed; /* "" speed */
- uint8_t vibrato_depth; /* "" depth */
- uint8_t vibrato_type;
- /* Tremor */
- int8_t tremor_position;
- uint8_t tremor_speed; /* s3m tremor ontime/offtime */
- uint8_t tremor_depth;
- uint8_t tremor_info;
-
- /* Tremolo */
- int8_t tremolo_position;
- uint8_t tremolo_speed; /* s3m tremor ontime/offtime */
- uint8_t tremolo_depth;
- uint8_t tremolo_info;
- uint8_t tremolo_type;
-
- /* Retrig */
- int8_t retrig_counter; /* retrig value (0 means don't retrig) */
- uint8_t retrig_speed; /* last used retrig speed */
- uint8_t retrig_volslide; /* last used retrig slide */
-
- /* CPSample Offset */
- int32_t sample_offset_hi; /* last used high order of sample offset */
- uint16_t sample_offset; /* last used low order of sample-offset (effect 9) */
- uint16_t sample_offset_fine; /* fine sample offset memory */
-
- /* Portamento */
- uint16_t slide_to_period; /* period to slide to (with effect 3 or 5) */
- uint8_t portamento_speed;
-
- /* Volume Slide */
-
- uint8_t volume_slide_info;
-
- /* Channel Volume Slide */
-
- uint8_t channel_volume_slide_info;
-
- /* Global Volume Slide */
-
- uint8_t global_volume_slide_info;
-
- /* Channel Pan Slide */
-
- uint8_t channel_pan_slide_info;
-
- /* Pitch Slide */
-
- uint8_t pitch_slide_info;
- /* Tempo Slide */
-
- uint8_t tempo_slide_info;
-
- /* S effects memory */
-
- uint8_t current_S_effect;
- uint8_t current_S_data;
-
- /* Volume column memory */
-
- uint8_t volume_column_effect_mem;
- uint8_t volume_column_data_mem;
-
- int64_t last_event_usecs;
- bool reserved;
-
- void reset();
-
- Channel_Control() { channel_global_volume=255; last_event_usecs=-1; }
- };
-
- struct Control_Variables { // control variables (dynamic version) of initial variables
-
- bool reached_end;
-
- char play_mode;
- bool filters;
- int global_volume;
- int speed;
- int tempo;
-
- int ticks_counter;
-
- int pattern_delay_1;
- int pattern_delay_2;
-
- Channel_Control channel[CPPattern::WIDTH];
-
- int max_voices;
-
- int voices_used; /* reference value */
-
- bool force_no_nna;
- bool external_vibrato;
-
- struct Position {
-
- int current_order;
- int current_pattern;
- int current_row;
- int force_next_order;
- bool forbid_jump;
- };
-
- int32_t random_seed;
-
- Position position;
- Position previous_position;
-
- };
-
-
- Voice_Control voice[MAX_VOICES];
-
- Control_Variables control;
-
- /* VOICE SETUP */
-
- void setup_voices();
-
- /* MIXER SETUP */
- void handle_tick();
- void update_mixer();
-
- /* NOTE / INSTRUMENT PROCESSING */
-
- void process_new_note(int p_track,uint8_t p_note);
- bool process_new_instrument(int p_track,uint8_t p_instrument);
- bool process_note_and_instrument(int p_track,int p_note,int p_instrument);
-
- /* EFFECT PROCESSING */
- void do_effect_S(int p_track);
- void do_panbrello(int p_track);
- void do_global_volume_slide(int p_track);
- void do_tremolo(int p_track);
- void do_retrig(int p_track);
- void do_pan_slide(int p_track);
- void do_channel_volume_slide(int p_track);
- void do_volume_slide(int p_track,int inf);
- void do_pitch_slide_down(int p_track,uint8_t inf);
- void do_pitch_slide_up(int p_track,uint8_t inf);
- void do_tremor(int p_track);
- void do_vibrato(int p_track,bool fine);
- void do_pitch_slide_to_note(int p_track);
- void run_effects(int p_track);
- void run_volume_column_effects(int p_track);
- void pre_process_effects();
- void do_arpegio(int p_track);
- uint64_t song_usecs;
- /* NNA */
-
- void process_NNAs();
-
-
- /* MISC UTILS */
-
-
- int find_empty_voice();
- void process_volume_column(int p_track,uint8_t p_volume);
- void process_note(int p_track,CPNote p_note);
-
- /* CPTables */
- static uint8_t auto_vibrato_table[128];
- static uint8_t vibrato_table[32];
- static int8_t panbrello_table[256];
-
- static void callback_function(void *p_userdata);
-
-public:
- //Play modes
-
- enum {
-
- PLAY_NOTHING =0,
- PLAY_PATTERN =1,
- PLAY_SONG =2
- };
-
-
- int32_t get_frequency(int32_t period);
- int32_t get_period(uint16_t note,int32_t p_c5freq);
-
-
- int get_current_tempo() { return control.tempo; };
- int get_current_speed() { return control.speed; };
-
- int get_voices_used() { return control.voices_used;};
- int get_voice_envelope_pos(int p_voice,CPEnvelope *p_envelope);
- int get_voice_amount_limit() { return control.max_voices; };
- void set_voice_amount_limit(int p_limit);
- void set_reserved_voices(int p_amount);
- int get_reserved_voices_amount();
-
- bool is_voice_active(int p_voice);
- int get_channel_voice(int p_channel);
- const char* get_voice_sample_name(int p_voice);
- const char* get_voice_instrument_name(int p_voice);
- CPEnvelope* get_voice_envelope(int p_voice,CPInstrument::EnvelopeType p_env_type);
- int get_voice_envelope_pos(int p_voice,CPInstrument::EnvelopeType p_env_type);
- int get_voice_volume(int p_voice);
-
- int get_voice_sample_index(int p_voice);
-
- void set_virtual_channels(int p_amount);
- int get_virtual_channels() { return control.max_voices; };
-
-
- /* Play Info/Position */
- bool is_playing() { return (control.play_mode>0); };
- int get_play_mode() {return (control.play_mode);};
- int get_current_order() { return control.position.current_order; };
- int get_current_row() { return control.position.current_row; };
- int get_current_pattern() { return control.position.current_pattern; };
-
- void goto_next_order();
- void goto_previous_order();
-
- void process_tick();
-
-
- CPMixer* get_mixer_ptr() {
-
- return mixer;
- }
-
-
- void reset();
-
-
-
- /* External player control - editor - */
-
- void play_start_pattern(int p_pattern);
- void play_start_song();
- void play_start_song_from_order(int p_order);
- void play_start_song_from_order_and_row(int p_order,int p_row);
- void play_start(int p_pattern, int p_order, int p_row,bool p_lock=true);
-
- void play_stop();
- void play_note(int p_channel,CPNote note,bool p_reserve=false);
-
- bool reached_end_of_song();
-
- void set_force_no_nna(bool p_force);
- void set_force_external_vibratos(bool p_force);
-
- void set_filters_enabled(bool p_enable);
- bool are_filters_enabled() { return control.filters; }
-
- void set_channel_global_volume(int p_channel,int p_volume); //0-255
- int get_channel_global_volume(int p_channel) const;
-
- int64_t get_channel_last_note_time_usec(int p_channel) const;
-
- CPSong *get_song() { return song; };
-
-
- CPPlayer(CPMixer *p_mixer,CPSong *p_song);
- ~CPPlayer();
-};
-
-#endif
diff --git a/modules/chibi/cp_player_data_control.cpp b/modules/chibi/cp_player_data_control.cpp
deleted file mode 100644
index d9aaed904f..0000000000
--- a/modules/chibi/cp_player_data_control.cpp
+++ /dev/null
@@ -1,324 +0,0 @@
-/*************************************************************************/
-/* cp_player_data_control.cpp */
-/*************************************************************************/
-/* This file is part of: */
-/* GODOT ENGINE */
-/* http://www.godotengine.org */
-/*************************************************************************/
-/* Copyright (c) 2007-2016 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 "cp_player_data.h"
-
-void CPPlayer::play_start_pattern(int p_pattern) {
-
- play_start(p_pattern,-1,-1);
-}
-
-void CPPlayer::play_start_song() {
-
- play_start(-1,-1,-1);
-}
-
-void CPPlayer::play_start_song_from_order(int p_order) {
-
- play_start(-1,p_order,-1);
-}
-
-void CPPlayer::play_start_song_from_order_and_row(int p_order,int p_row) {
-
- play_start(-1,p_order,p_row);
-}
-
-void CPPlayer::play_start(int p_pattern, int p_order, int p_row,bool p_lock) {
-
-
- if (control.play_mode!=PLAY_NOTHING) play_stop();
-
-
- reset();
-
- if (p_pattern!=-1) {
-
- control.play_mode=PLAY_PATTERN;
- control.position.current_pattern=p_pattern;
- control.position.current_row=(p_row!=-1)?p_row:0;
-
- } else {
-
- control.position.current_order=get_song_next_order_idx(song,(p_order==-1)?p_order:p_order-1);
- if (control.position.current_order!=-1) {
-
- control.play_mode=PLAY_SONG;
- control.position.current_pattern=song->get_order(control.position.current_order);
- control.position.current_row=(p_row!=-1)?p_row:0;
- }
- }
-
-
- control.reached_end=(control.play_mode==PLAY_NOTHING);
-
-
-}
-
-void CPPlayer::play_stop() {
-
- int i;
-
-
- control.play_mode=PLAY_NOTHING;
-
- for (i=0;i<control.max_voices;i++) {
-
- voice[i].reset();
- mixer->stop_voice(i);
- }
-
- for (i=0;i<CPPattern::WIDTH;i++) {
-
- control.channel[i].reset();
- }
-
- reset();
-
-}
-
-void CPPlayer::play_note(int p_channel,CPNote note,bool p_reserve) {
-
-
-
- if (control.play_mode==PLAY_NOTHING) {
-
- control.ticks_counter=0;
- }
-
- /*control.channel[p_channel].reset();
- control.channel[p_channel].channel_volume=song->get_channel_volume(p_channel);
- control.channel[p_channel].channel_panning=((int)song->get_channel_pan( p_channel)*255/64);*/
- if (p_reserve) {
- control.channel[p_channel].mute=false;
- control.channel[p_channel].reserved=true;
- } else {
-
- control.channel[p_channel].reserved=false;
-
- }
- process_note(p_channel,note);
-
-
-
-}
-
-
-int CPPlayer::get_voice_volume(int p_voice) {
-
- return voice[p_voice].display_volume;
-}
-
-
-int CPPlayer::get_voice_envelope_pos(int p_voice,CPEnvelope *p_envelope) {
-
- int i,tmp_index=-1;
-
- i=p_voice;
-
-
-
-
- if ((song->has_instruments()) && (voice[i].instrument_ptr!=NULL) && (voice[i].fadeout_volume>0)) {
-
- if ((p_envelope==voice[i].instrument_ptr->get_volume_envelope()) && (voice[i].instrument_ptr->get_volume_envelope()->is_enabled())) {
-
- tmp_index=voice[i].volume_envelope_ctrl.pos_index;
- }
-
- if ((p_envelope==voice[i].instrument_ptr->get_pan_envelope()) && (voice[i].instrument_ptr->get_pan_envelope()->is_enabled())) {
-
- tmp_index=voice[i].panning_envelope_ctrl.pos_index;
- }
-
- if ((p_envelope==voice[i].instrument_ptr->get_pitch_filter_envelope()) && (voice[i].instrument_ptr->get_pitch_filter_envelope()->is_enabled())) {
-
-
- tmp_index=voice[i].pitch_envelope_ctrl.pos_index;
- }
-
- }
-
-
-
- return tmp_index;
-}
-
-void CPPlayer::goto_next_order() {
-
-
- if (control.play_mode!=PLAY_SONG) return;
-
-
-
- control.position.current_row=0;
-
-
- control.position.current_order=get_song_next_order_idx(song, control.position.current_order);
-
-
-
- if (control.position.current_order==-1) {
-
- reset();
- }
-
- control.position.current_pattern=song->get_order(control.position.current_order);
-
-
-}
-void CPPlayer::goto_previous_order() {
-
- if (control.play_mode!=PLAY_SONG) return;
-
-
- int next_order,current_order;
-
- control.position.current_row=0;
-
- current_order=control.position.current_order;
-
- next_order=get_song_next_order_idx(song, current_order);
-
- while ((next_order!=control.position.current_order) && (next_order!=-1)) {
-
- current_order=next_order;
- next_order=get_song_next_order_idx(song, current_order);
- }
-
- if (next_order==-1) {
-
- reset();
- } else {
-
- control.position.current_order=current_order;
- control.position.current_pattern=song->get_order(control.position.current_order);
-
- }
-
-
-
-}
-
-int CPPlayer::get_channel_voice(int p_channel) {
-
- if (control.channel[p_channel].slave_voice==NULL) return -1;
- else return control.channel[p_channel].slave_voice_index;
-}
-
-const char* CPPlayer::get_voice_sample_name(int p_voice) {
-
- const char *name = NULL;
-
-
-
- if (!voice[p_voice].sample_ptr) name=voice[p_voice].sample_ptr->get_name();
-
-
-
- return name;
-
-}
-
-
-bool CPPlayer::is_voice_active(int p_voice) {
-
- return !( ((voice[p_voice].kick==KICK_NOTHING)||(voice[p_voice].kick==KICK_ENVELOPE))&&!mixer->is_voice_active(p_voice) );
-
-}
-
-
-
-int CPPlayer::get_voice_envelope_pos(int p_voice,CPInstrument::EnvelopeType p_env_type) {
-
- if (!is_voice_active(p_voice))
- return -1;
-
- Voice_Control::Envelope_Control *env=0;
-
- switch (p_env_type) {
-
- case CPInstrument::VOLUME_ENVELOPE: env=&voice[p_voice].volume_envelope_ctrl; break;
- case CPInstrument::PAN_ENVELOPE: env=&voice[p_voice].panning_envelope_ctrl; break;
- case CPInstrument::PITCH_ENVELOPE: env=&voice[p_voice].pitch_envelope_ctrl; break;
-
- }
-
- if (!env)
- return -1;
-
- if (!env->active || env->terminated)
- return -1;
-
- return env->pos_index;
-}
-
-
-CPEnvelope* CPPlayer::get_voice_envelope(int p_voice,CPInstrument::EnvelopeType p_env_type) {
-
- CPInstrument *ins=voice[p_voice].instrument_ptr;
-
- if (!ins)
- return 0;
-
- switch( p_env_type ) {
-
-
- case CPInstrument::VOLUME_ENVELOPE: return ins->get_volume_envelope();
- case CPInstrument::PAN_ENVELOPE: return ins->get_pan_envelope();
- case CPInstrument::PITCH_ENVELOPE: return ins->get_pitch_filter_envelope();
- };
-
- return 0;
-
-}
-
-const char * CPPlayer::get_voice_instrument_name(int p_voice) {
-
-
-
- const char *name = NULL;
-
-
-
- if (voice[p_voice].instrument_ptr!=NULL) name=voice[p_voice].instrument_ptr->get_name();
-
-
-
- return name;
-
-}
-void CPPlayer::set_filters_enabled(bool p_enable){
-
- control.filters=p_enable;
-}
-
-int CPPlayer::get_voice_sample_index(int p_voice) {
-
- return voice[p_voice].sample_index;
-}
diff --git a/modules/chibi/cp_player_data_effects.cpp b/modules/chibi/cp_player_data_effects.cpp
deleted file mode 100644
index 3a52a3b91b..0000000000
--- a/modules/chibi/cp_player_data_effects.cpp
+++ /dev/null
@@ -1,1232 +0,0 @@
-/*************************************************************************/
-/* cp_player_data_effects.cpp */
-/*************************************************************************/
-/* This file is part of: */
-/* GODOT ENGINE */
-/* http://www.godotengine.org */
-/*************************************************************************/
-/* Copyright (c) 2007-2016 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 "cp_player_data.h"
-
-
-
-/**********************
- complex effects
-***********************/
-#define RANDOM_MAX 2147483647
-
-static inline int32_t cp_random_generate(int32_t *seed) {
- int32_t k;
- int32_t s = (int32_t)(*seed);
- if (s == 0)
- s = 0x12345987;
- k = s / 127773;
- s = 16807 * (s - k * 127773) - 2836 * k;
- if (s < 0)
- s += 2147483647;
- (*seed) = (int32_t)s;
- return (int32_t)(s & RANDOM_MAX);
-}
-
-
-
-void CPPlayer::do_vibrato(int p_track,bool fine) {
-
- uint8_t q;
- uint16_t temp=0;
-
- if ((control.ticks_counter==0) && control.channel[p_track].row_has_note) control.channel[p_track].vibrato_position=0;
-
- q=(control.channel[p_track].vibrato_position>>2)&0x1f;
-
- switch (control.channel[p_track].vibrato_type) {
- case 0: /* sine */
- temp=vibrato_table[q];
- break;
- case 1: /* square wave */
- temp=255;
- break;
- case 2: /* ramp down */
- q<<=3;
- if (control.channel[p_track].vibrato_position<0) q=255-q;
- temp=q;
- break;
- case 3: /* random */
- temp=cp_random_generate(&control.random_seed) %256;//getrandom(256);
- break;
- }
-
- temp*=control.channel[p_track].vibrato_depth;
-
- if (song->has_old_effects()) {
-
- temp>>=7;
- } else {
-
- temp>>=8;
- }
-
- if (!fine) temp<<=2;
-
- if (control.channel[p_track].vibrato_position>=0) {
-
- control.channel[p_track].period=control.channel[p_track].aux_period+temp;
- } else {
-
- control.channel[p_track].period=control.channel[p_track].aux_period-temp;
- }
-
- if (!song->has_old_effects() || control.ticks_counter) control.channel[p_track].vibrato_position+=control.channel[p_track].vibrato_speed;
-}
-
-
-void CPPlayer::do_pitch_slide_down(int p_track,uint8_t inf) {
-
- uint8_t hi,lo;
-
- if (inf) control.channel[p_track].pitch_slide_info=inf;
- else inf=control.channel[p_track].pitch_slide_info;
-
- hi=inf>>4;
- lo=inf&0xf;
-
- if (hi==0xf) {
-
- if (!control.ticks_counter) control.channel[p_track].aux_period+=(uint16_t)lo<<2;
- } else if (hi==0xe) {
-
- if (!control.ticks_counter) control.channel[p_track].aux_period+=lo;
- } else {
-
- if (control.ticks_counter) control.channel[p_track].aux_period+=(uint16_t)inf<<2;
- }
-}
-
-void CPPlayer::do_pitch_slide_up(int p_track,uint8_t inf) {
-
- uint8_t hi,lo;
-
- if (inf) control.channel[p_track].pitch_slide_info=inf;
- else inf=control.channel[p_track].pitch_slide_info;
-
- hi=inf>>4;
- lo=inf&0xf;
-
- if (hi==0xf) {
-
- if (!control.ticks_counter) control.channel[p_track].aux_period-=(uint16_t)lo<<2;
- } else if (hi==0xe) {
-
- if (!control.ticks_counter) control.channel[p_track].aux_period-=lo;
- } else {
-
- if (control.ticks_counter) control.channel[p_track].aux_period-=(uint16_t)inf<<2;
- }
-}
-
-void CPPlayer::do_pitch_slide_to_note(int p_track) {
-
- if (control.ticks_counter) {
- int dist;
-
- /* We have to slide a->period towards a->wantedperiod, compute the
- difference between those two values */
- dist=control.channel[p_track].period-control.channel[p_track].slide_to_period;
-
- /* if they are equal or if portamentospeed is too big... */
- if ((!dist)||((control.channel[p_track].portamento_speed<<2)>cp_intabs(dist))) {
- /* ... make tmpperiod equal tperiod */
- control.channel[p_track].aux_period=control.channel[p_track].period=control.channel[p_track].slide_to_period;
- } else {
-
- if (dist>0) {
-
- control.channel[p_track].aux_period-=control.channel[p_track].portamento_speed<<2;
- control.channel[p_track].period-=control.channel[p_track].portamento_speed<<2; /* dist>0 slide up */
- } else {
- control.channel[p_track].aux_period+=control.channel[p_track].portamento_speed<<2;
- control.channel[p_track].period+=control.channel[p_track].portamento_speed<<2; /* dist<0 slide down */
- }
- }
-
- } else {
-
- control.channel[p_track].aux_period=control.channel[p_track].period;
- }
-}
-
-void CPPlayer::do_tremor(int p_track) {
-
- uint8_t on,off,inf;
-
- inf=control.channel[p_track].current_parameter;
-
- if (inf) {
- control.channel[p_track].tremor_info=inf;
- } else {
- inf= control.channel[p_track].tremor_info;
- if (!inf) return;
- }
-
- //if (!control.ticks_counter) return;
-
- on=(inf>>4);
- off=(inf&0xf);
-
- control.channel[p_track].tremor_position%=(on+off);
- control.channel[p_track].volume=(control.channel[p_track].tremor_position<on)?control.channel[p_track].aux_volume:0;
- control.channel[p_track].tremor_position++;
-}
-
-void CPPlayer::do_pan_slide(int p_track) {
-
- uint8_t lo,hi,inf;
- int16_t pan;
-
- inf=control.channel[p_track].current_parameter;
-
- if (inf) control.channel[p_track].channel_pan_slide_info=inf;
- else inf=control.channel[p_track].channel_pan_slide_info;
-
- lo=inf&0xf;
- hi=inf>>4;
-
- pan=(control.channel[p_track].panning==PAN_SURROUND)?PAN_CENTER:control.channel[p_track].panning;
-
- if (!hi)
- pan+=lo<<2;
- else
- if (!lo) {
- pan-=hi<<2;
- } else
- if (hi==0xf) {
- if (!control.ticks_counter) pan+=lo<<2;
- } else
- if (lo==0xf) {
- if (!control.ticks_counter) pan-=hi<<2;
- }
- //this sets both chan & voice paning
- control.channel[p_track].panning=(pan<PAN_LEFT)?PAN_LEFT:(pan>PAN_RIGHT?PAN_RIGHT:pan);
- control.channel[p_track].channel_panning=control.channel[p_track].panning;
-}
-
-void CPPlayer::do_volume_slide(int p_track,int inf) {
-
- uint8_t hi,lo;
-
- lo=inf&0xf;
- hi=inf>>4;
-
- if (!lo) {
-
- if ((control.ticks_counter)) control.channel[p_track].aux_volume+=hi;
-
- } else if (!hi) {
-
- if ((control.ticks_counter)) control.channel[p_track].aux_volume-=lo;
-
- } else if (lo==0xf) {
-
- if (!control.ticks_counter) control.channel[p_track].aux_volume+=(hi?hi:0xf);
- } else if (hi==0xf) {
-
- if (!control.ticks_counter) control.channel[p_track].aux_volume-=(lo?lo:0xf);
- } else return;
-
- if (control.channel[p_track].aux_volume<0) {
-
- control.channel[p_track].aux_volume=0;
- } else if (control.channel[p_track].aux_volume>64) {
-
- control.channel[p_track].aux_volume=64;
- }
-}
-
-void CPPlayer::do_channel_volume_slide(int p_track) {
-
- uint8_t lo, hi,inf;
-
- inf=control.channel[p_track].current_parameter;
-
- if (inf) control.channel[p_track].channel_volume_slide_info=inf;
- inf=control.channel[p_track].channel_volume_slide_info;
-
- lo=inf&0xf;
- hi=inf>>4;
-
- if (!hi)
- control.channel[p_track].channel_volume-=lo;
- else
- if (!lo) {
- control.channel[p_track].channel_volume+=hi;
- } else
- if (hi==0xf) {
- if (!control.ticks_counter) control.channel[p_track].channel_volume-=lo;
- } else
- if (lo==0xf) {
- if (!control.ticks_counter) control.channel[p_track].channel_volume+=hi;
- }
-
- if (control.channel[p_track].channel_volume<0) control.channel[p_track].channel_volume=0;
- if (control.channel[p_track].channel_volume>64) control.channel[p_track].channel_volume=64;
-}
-
-void CPPlayer::do_tremolo(int p_track) {
-
- uint8_t q;
- int16_t temp=0;
-
- if ((control.ticks_counter==0) && control.channel[p_track].row_has_note) control.channel[p_track].tremolo_position=0;
-
- q=(control.channel[p_track].tremolo_position>>2)&0x1f;
-
- switch (control.channel[p_track].tremolo_type) {
- case 0: /* sine */
- temp=vibrato_table[q];
- break;
- case 1: /* ramp down */
- q<<=3;
- if (control.channel[p_track].tremolo_position<0) q=255-q;
- temp=q;
- break;
- case 2: /* square wave */
- temp=255;
- break;
- case 3: /* random */
- temp=cp_random_generate(&control.random_seed) % 256;//getrandom(256);
- break;
- }
-
- temp*=control.channel[p_track].tremolo_depth;
- temp>>=7;
-
-
-
- if (control.channel[p_track].tremolo_position>=0) {
-
-
- control.channel[p_track].volume=control.channel[p_track].aux_volume+temp;
- if (control.channel[p_track].volume>64) control.channel[p_track].volume=64;
- } else {
-
- control.channel[p_track].volume=control.channel[p_track].aux_volume-temp;
- if (control.channel[p_track].volume<0) control.channel[p_track].volume=0;
- }
-
- /*if (control.ticks_counter)*/ control.channel[p_track].tremolo_position+=control.channel[p_track].tremolo_speed;
-
-}
-
-void CPPlayer::do_arpegio(int p_track) {
-
- uint8_t note,dat;
- //note=control.channel[p_track].note;
- note=0;
-
- if (control.channel[p_track].current_parameter) {
-
- control.channel[p_track].arpegio_info=control.channel[p_track].current_parameter;
- }
-
- dat=control.channel[p_track].arpegio_info;
-
- if (dat) {
-
- switch (control.ticks_counter%3) {
-
- case 1: {
-
- note+=(dat>>4);
-
- } break;
- case 2: {
-
- note+=(dat&0xf);
- } break;
- }
-
- if (song->has_linear_slides()) {
-
- control.channel[p_track].period=control.channel[p_track].aux_period-cp_intabs(get_period((uint16_t)46,0)-get_period((uint16_t)44,0))*note;
- } else if (control.channel[p_track].sample_ptr) {
-
- control.channel[p_track].period=get_period( (((uint16_t)control.channel[p_track].note)+note)<<1,CPSampleManager::get_singleton()->get_c5_freq( (control.channel[p_track].sample_ptr->get_sample_data())));
- }
-
- control.channel[p_track].has_own_period=true;
- }
-
-
-}
-
-
-void CPPlayer::do_retrig(int p_track) {
-
- uint8_t inf;
-
- inf=control.channel[p_track].current_parameter;
-
- if (inf) {
-
- control.channel[p_track].retrig_volslide=inf>>4;
- control.channel[p_track].retrig_speed=inf&0xf;
- }
-
- /* only retrigger if low nibble > 0 */
- if ( control.channel[p_track].retrig_speed>0) {
-
- if ( !control.channel[p_track].retrig_counter ) {
- /* when retrig counter reaches 0, reset counter and restart the
- sample */
- if (control.channel[p_track].kick!=KICK_NOTE) control.channel[p_track].kick=KICK_NOTEOFF;
- control.channel[p_track].retrig_counter=control.channel[p_track].retrig_speed;
-
-
- if ((control.ticks_counter)/*||(pf->flags&UF_S3MSLIDES)*/) {
- switch (control.channel[p_track].retrig_volslide) {
- case 1:
- case 2:
- case 3:
- case 4:
- case 5:
- control.channel[p_track].aux_volume-=(1<<(control.channel[p_track].retrig_volslide-1));
- break;
- case 6:
- control.channel[p_track].aux_volume=(2*control.channel[p_track].aux_volume)/3;
- break;
- case 7:
- control.channel[p_track].aux_volume>>=1;
- break;
- case 9:
- case 0xa:
- case 0xb:
- case 0xc:
- case 0xd:
- control.channel[p_track].aux_volume+=(1<<(control.channel[p_track].retrig_volslide-9));
- break;
- case 0xe:
- control.channel[p_track].aux_volume=(3*control.channel[p_track].aux_volume)>>1;
- break;
- case 0xf:
- control.channel[p_track].aux_volume=control.channel[p_track].aux_volume<<1;
- break;
- }
- if (control.channel[p_track].aux_volume<0) control.channel[p_track].aux_volume=0;
- else if (control.channel[p_track].aux_volume>64) control.channel[p_track].aux_volume=64;
- }
- }
- control.channel[p_track].retrig_counter--; /* countdown */
- }
-}
-
-void CPPlayer::do_global_volume_slide(int p_track) {
-
- uint8_t lo,hi,inf;
-
- inf=control.channel[p_track].current_parameter;
-
- if (inf) control.channel[p_track].global_volume_slide_info=inf;
- inf=control.channel[p_track].global_volume_slide_info;
-
- lo=inf&0xf;
- hi=inf>>4;
-
- if (!lo) {
- if (control.ticks_counter) control.global_volume+=hi;
- } else
- if (!hi) {
- if (control.ticks_counter) control.global_volume-=lo;
- } else
- if (lo==0xf) {
- if (!control.ticks_counter) control.global_volume+=hi;
- } else
- if (hi==0xf) {
- if (!control.ticks_counter) control.global_volume-=lo;
- }
-
- if (control.global_volume<0) control.global_volume=0;
- if (control.global_volume>128) control.global_volume=128;
-}
-
-void CPPlayer::do_panbrello(int p_track) {
-
- uint8_t q;
- int32_t temp=0;
-
- q=control.channel[p_track].panbrello_position;
-
- switch (control.channel[p_track].panbrello_type) {
- case 0: {/* sine */
- temp=panbrello_table[q];
- } break;
- case 1: {/* square wave */
- temp=(q<0x80)?64:0;
- } break;
- case 2: {/* ramp down */
- q<<=3;
- temp=q;
- } break;
- case 3: {/* random */
- if (control.channel[p_track].panbrello_position>=control.channel[p_track].panbrello_speed) {
- control.channel[p_track].panbrello_position=0;
- temp=cp_random_generate(&control.random_seed)%256;//getrandom(256);
- }
- } break;
- }
-
-
-
- temp=temp*(int)control.channel[p_track].panbrello_depth/0xF;
- temp<<=1;
- if (control.channel[p_track].channel_panning!=PAN_SURROUND)
- temp+=control.channel[p_track].channel_panning;
-
- control.channel[p_track].panning=(temp<PAN_LEFT)?PAN_LEFT:(temp>PAN_RIGHT?PAN_RIGHT:temp);
- control.channel[p_track].panbrello_position+=control.channel[p_track].panbrello_speed;
-}
-
-/******************
- S effect
-*******************/
-
-
-void CPPlayer::do_effect_S(int p_track) {
-
- uint8_t inf,c,dat;
-
- dat=control.channel[p_track].current_parameter;
-
- inf=dat&0xf;
- c=dat>>4;
-
- if (!dat) {
- c=control.channel[p_track].current_S_effect;
- inf=control.channel[p_track].current_S_data;
- } else {
- control.channel[p_track].current_S_effect=c;
- control.channel[p_track].current_S_data=inf;
- }
-
- switch (c) {
- case 1: {/* S1x set glissando voice */
- // this is unsupported in IT!
-
- control.channel[p_track].chorus_send=inf*0xFF/0xF;
-
- }break;
- case 2: /* S2x set finetune */
- //Also not supported!
- break;
- case 3: /* S3x set vibrato waveform */
- if (inf<4) control.channel[p_track].vibrato_type=inf;
- break;
- case 4: /* S4x set tremolo waveform */
- if (inf<4) control.channel[p_track].tremolo_type=inf;
- break;
- case 5: /* S5x panbrello */
- if (inf<4) control.channel[p_track].panbrello_type=inf;
- break;
- case 6: {/* S6x delay x number of frames (patdly) */
-
- if (control.ticks_counter) break;
- if (!control.pattern_delay_2) control.pattern_delay_1=inf+1; /* only once, when vbtick=0 */
-
- } break;
- case 7: /* S7x instrument / NNA commands */
-
- if (!song->has_instruments())
- break;
- switch(inf) {
-
- case 0x3: {
-
- control.channel[p_track].NNA_type=CPInstrument::NNA_NOTE_CUT;
- } break;
- case 0x4: {
-
- control.channel[p_track].NNA_type=CPInstrument::NNA_NOTE_CONTINUE;
- } break;
- case 0x5: {
-
- control.channel[p_track].NNA_type=CPInstrument::NNA_NOTE_OFF;
- } break;
- case 0x6: {
-
- control.channel[p_track].NNA_type=CPInstrument::NNA_NOTE_FADE;
- } break;
- case 0x7: {
-
- if (control.channel[p_track].slave_voice)
- control.channel[p_track].slave_voice->volume_envelope_ctrl.active=false;
- } break;
- case 0x8: {
-
- if (control.channel[p_track].slave_voice)
- control.channel[p_track].slave_voice->volume_envelope_ctrl.active=true;
-
- } break;
- case 0x9: {
-
- if (control.channel[p_track].slave_voice)
- control.channel[p_track].slave_voice->panning_envelope_ctrl.active=false;
-
- } break;
- case 0xA: {
-
- if (control.channel[p_track].slave_voice)
- control.channel[p_track].slave_voice->panning_envelope_ctrl.active=true;
-
- } break;
- case 0xB: {
- if (control.channel[p_track].slave_voice)
- control.channel[p_track].slave_voice->pitch_envelope_ctrl.active=false;
-
- } break;
- case 0xC: {
-
- if (control.channel[p_track].slave_voice)
- control.channel[p_track].slave_voice->pitch_envelope_ctrl.active=true;
-
- } break;
-
- } break;
-
- break;
- case 8: {/* S8x set panning position */
-
-// if (pf->panflag) {
- if (inf<=8) inf<<=4;
- else inf*=17;
- control.channel[p_track].panning=control.channel[p_track].channel_panning=inf;
-// }
- } break;
-
- case 9: { /* S9x set surround sound */
- //if (pf->panflag)
- control.channel[p_track].panning=control.channel[p_track].channel_panning=PAN_SURROUND;
- } break;
- case 0xA:{ /* SAy set high order sample offset yxx00h */
-
- if (control.channel[p_track].current_parameter) control.channel[p_track].hi_offset=(int32_t)inf<<16;
- control.channel[p_track].sample_start_index=control.channel[p_track].hi_offset|control.channel[p_track].lo_offset;
- } break;
- case 0xB: { /* SBx pattern loop */
- if (control.ticks_counter) break;
-
- if (inf) { /* set reppos or repcnt ? */
- /* set repcnt, so check if repcnt already is set, which means we
- are already looping */
- if (control.channel[p_track].pattern_loop_count>0)
- control.channel[p_track].pattern_loop_count--; /* already looping, decrease counter */
- else {
- control.channel[p_track].pattern_loop_count=inf; /* not yet looping, so set repcnt */
- }
-
- if (control.channel[p_track].pattern_loop_count>0) { /* jump to reppos if repcnt>0 */
-
- control.position=control.previous_position; // This will also anulate any Cxx or break..
-
- control.position.current_row=control.channel[p_track].pattern_loop_position;
- control.position.forbid_jump=true;
- }
-
- } else {
-
-
- control.channel[p_track].pattern_loop_position=control.position.current_row-1;
- }
-
- } break;
- case 0xC: { /* SCx notecut */
-
- if (control.ticks_counter>=inf) {
-
- control.channel[p_track].aux_volume=0;
- control.channel[p_track].note_end_flags|=END_NOTE_OFF;
- control.channel[p_track].note_end_flags|=END_NOTE_KILL;
- }
- } break;
- case 0xD: {/* SDx notedelay */
-
- if (!control.ticks_counter) {
-
- control.channel[p_track].note_delay=inf;
-
- } else if (control.channel[p_track].note_delay) {
-
- control.channel[p_track].note_delay--;
- }
-
- } break;
- case 0xF: {/* SEx patterndelay */
-
- if (control.ticks_counter) break;
- if (!control.pattern_delay_2) control.pattern_delay_1=inf+1; /* only once, when vbtick=0 */
-
- } break;
- }
-}
-
-
-
-
-
-
-
-
-/*********************
- volume effects
-**********************/
-
-void CPPlayer::run_volume_column_effects(int p_track) {
-
- uint8_t param=control.channel[p_track].current_volume_parameter;
-
-
- switch ('A'+control.channel[p_track].current_volume_command) {
-
- case 'A': {
-
- if (param>0) control.channel[p_track].volcol_volume_slide=param;
- else param=control.channel[p_track].volcol_volume_slide;
-
- do_volume_slide(p_track,param*0x10+0xF);
-
- } break;
- case 'B': {
-
- if (param>0) control.channel[p_track].volcol_volume_slide=param;
- else param=control.channel[p_track].volcol_volume_slide;
-
- do_volume_slide(p_track,0xF0+param);
-
- } break;
- case 'C': {
-
- if (param>0) control.channel[p_track].volcol_volume_slide=param;
- else param=control.channel[p_track].volcol_volume_slide;
-
- do_volume_slide(p_track,param*0x10);
- } break;
- case 'D': {
-
- if (param>0) control.channel[p_track].volcol_volume_slide=param;
- else param=control.channel[p_track].volcol_volume_slide;
- do_volume_slide(p_track,param);
-
- } break;
- case 'E': {
-
- do_pitch_slide_down(p_track,param<<2);
- } break;
- case 'F': {
-
- do_pitch_slide_up(p_track,param<<2);
- } break;
- case 'G': {
-
- const uint8_t slide_table[]={0,1,4,8,16,32,64,96,128,255};
- if (param) {
-
- control.channel[p_track].portamento_speed=slide_table[param];
- }
-
- if (control.channel[p_track].period && (control.channel[p_track].old_note<=120)) {
-
- if ( (!control.ticks_counter) && (control.channel[p_track].new_instrument) ){
-
- //control.channel[p_track].kick=KICK_NOTE;
- //control.channel[p_track].sample_start_index=0; // < am i stupid?
- } else {
-
- control.channel[p_track].kick=(control.channel[p_track].kick==KICK_NOTE)?KICK_ENVELOPE:KICK_NOTHING;
- do_pitch_slide_to_note(p_track);
- control.channel[p_track].has_own_period=true;
- }
-
- }
- } break;
- case 'H': {
-
-
- if (!control.ticks_counter) {
- if (param&0x0f) control.channel[p_track].vibrato_depth=param;
- }
- control.channel[p_track].doing_vibrato=true;
- if (control.external_vibrato) break;
- if (control.channel[p_track].period) {
-
- do_vibrato(p_track,false);
- control.channel[p_track].has_own_period=true;
- }
-
- } break;
- }
-}
-/*********************
- table
-**********************/
-
-
-void CPPlayer::run_effects(int p_track) {
-
- switch ('A'+control.channel[p_track].current_command) {
-
- case 'A': {
-
- if ((control.ticks_counter>0) || (control.pattern_delay_2>0)) break;
-
- int new_speed;
-
- new_speed=control.channel[p_track].current_parameter % 128;
-
- if (new_speed>0) {
- control.speed=new_speed;
- control.ticks_counter=0;
- }
- } break;
- case 'B': {
-
- int next_order;
-
- if (control.ticks_counter || control.position.forbid_jump) break;
-
- control.position.current_row=0;
-
- if (control.play_mode==PLAY_PATTERN) break;
-
- next_order=get_song_next_order_idx(song, (int)control.channel[p_track].current_parameter-1);
-
- if (next_order!=-1) {
- // Do we have a "next order?"
- control.position.current_pattern=song->get_order(next_order);
- control.position.force_next_order=next_order;
-
- } else {
- // no, probably the user deleted the orderlist.
- control.play_mode=PLAY_NOTHING;
- reset();
- }
- } break;
- case 'C': {
-
- int next_order;
-
- if (control.ticks_counter || control.position.forbid_jump) break;
-
- control.position.current_row=control.channel[p_track].current_parameter;
-
- if (control.play_mode==PLAY_PATTERN) {
-
- if (control.position.current_row>=song->get_pattern(control.position.current_pattern)->get_length()) {
-
- control.position.current_row=0;
- }
-
- break;
- }
-
- next_order=get_song_next_order_idx(song, (int)control.position.current_order);
-
- if (next_order!=-1) {
- // Do we have a "next order?"
- control.position.current_pattern=song->get_order(next_order);
-
- if (control.position.current_row>=song->get_pattern(song->get_order(next_order))->get_length()) {
-
- control.position.current_row=0;
- }
-
- control.position.force_next_order=next_order;
-
- } else {
- // no, probably the user deleted the orderlist.
- control.play_mode=PLAY_NOTHING;
- reset();
- }
-
- } break;
- case 'D': {
-
- uint8_t inf ;
- //explicitslides=1;
- inf=control.channel[p_track].current_parameter;
-
- if (inf) control.channel[p_track].volume_slide_info=inf;
- else inf=control.channel[p_track].volume_slide_info;
-
- do_volume_slide(p_track,inf);
-
- } break;
- case 'E': {
-
- uint8_t inf;
-
- inf=control.channel[p_track].current_parameter;
- do_pitch_slide_down(p_track,inf);
-
- } break;
- case 'F': {
-
- uint8_t inf;
-
- inf=control.channel[p_track].current_parameter;
- do_pitch_slide_up(p_track,inf);
-
- } break;
- case 'G': {
-
- if (control.channel[p_track].current_parameter) {
-
- control.channel[p_track].portamento_speed=control.channel[p_track].current_parameter;
- }
-
- if (control.channel[p_track].period && (control.channel[p_track].old_note<=120)) {
-
- if ( (!control.ticks_counter) && (control.channel[p_track].new_instrument) ){
-
-
- control.channel[p_track].kick=KICK_NOTE;
- control.channel[p_track].sample_start_index=0;
-
- } else {
-
- control.channel[p_track].kick=(control.channel[p_track].kick==KICK_NOTE)?KICK_ENVELOPE:KICK_NOTHING;
- }
-
- do_pitch_slide_to_note(p_track);
- control.channel[p_track].has_own_period=true;
- }
-
- } break;
- case 'H': {
-
- uint8_t dat;
-
- control.channel[p_track].doing_vibrato=true;
-
- dat=control.channel[p_track].current_parameter;
-
- if (!control.ticks_counter) {
- if (dat&0x0f) control.channel[p_track].vibrato_depth=dat&0xf;
- if (dat&0xf0) control.channel[p_track].vibrato_speed=(dat&0xf0)>>2;
- }
-
- if (control.external_vibrato) break;
-
- if (control.channel[p_track].period) {
-
- do_vibrato(p_track,false);
- control.channel[p_track].has_own_period=true;
- }
-
- } break;
- case 'I': {
-
- do_tremor(p_track);
- control.channel[p_track].has_own_volume=true;
- } break;
- case 'J': {
-
- do_arpegio(p_track);
- } break;
- case 'K': {
-
- uint8_t inf ;
- //explicitslides=1;
- inf=control.channel[p_track].current_parameter;
-
- control.channel[p_track].doing_vibrato=true;
-
-
- if (inf) control.channel[p_track].volume_slide_info=inf;
- else inf=control.channel[p_track].volume_slide_info;
-
- do_volume_slide(p_track,inf);
-
- if (control.external_vibrato) break;
-
- if (control.channel[p_track].period) {
-
- do_vibrato(p_track,false);
- control.channel[p_track].has_own_period=true;
- }
-
- } break;
- case 'L': {
- uint8_t inf ;
- //explicitslides=1;
- inf=control.channel[p_track].current_parameter;
-
- if (inf) control.channel[p_track].volume_slide_info=inf;
- else inf=control.channel[p_track].volume_slide_info;
-
- do_volume_slide(p_track,inf);
-
- if (control.channel[p_track].period && (control.channel[p_track].old_note<=120)) {
- if ( (!control.ticks_counter) && (control.channel[p_track].new_instrument) ){
-
- control.channel[p_track].kick=KICK_NOTE;
- control.channel[p_track].sample_start_index=0;
-
- } else {
-
- control.channel[p_track].kick=(control.channel[p_track].kick==KICK_NOTE)?KICK_ENVELOPE:KICK_NOTHING;
- }
-
- do_pitch_slide_to_note(p_track);
- control.channel[p_track].has_own_period=true;
- }
- } break;
- case 'M': {
- control.channel[p_track].channel_volume=control.channel[p_track].current_parameter;
- if (control.channel[p_track].channel_volume>64) control.channel[p_track].channel_volume=64;
- else if (control.channel[p_track].channel_volume<0) control.channel[p_track].channel_volume=0;
- } break;
- case 'N': {
-
- do_channel_volume_slide(p_track);
- }
- case 'O': {
-
- if (!control.ticks_counter) {
-
- if (control.channel[p_track].current_parameter) control.channel[p_track].lo_offset=(uint16_t)control.channel[p_track].current_parameter<<8;
- control.channel[p_track].sample_start_index=control.channel[p_track].hi_offset|control.channel[p_track].lo_offset;
-
- //if ((control.channel[p_track].sample_ptr!=NULL)&&(control.channel[p_track].sample_start_index>control.channel[p_track].sample_ptr->data.size)) {
- //TODO, O effect
- //a->start=a->s->flags&(SF_LOOP|SF_BIDI)?a->s->loopstart:a->s->length;
- //}
- }
- } break;
- case 'P': {
-
- do_pan_slide(p_track);
- } break;
- case 'Q': {
- do_retrig(p_track);
-
- } break;
- case 'R': {
-
-
- uint8_t dat;
-
- if (control.channel[p_track].current_parameter) {
-
- control.channel[p_track].tremolo_info=control.channel[p_track].current_parameter;
- }
-
- dat=control.channel[p_track].tremolo_info;
-
- if (!control.ticks_counter && dat) {
-
- if (dat&0x0f) control.channel[p_track].tremolo_depth=dat&0xf;
- if (dat&0xf0) control.channel[p_track].tremolo_speed=(dat&0xf0)>>2;
- }
-
- do_tremolo(p_track);
- control.channel[p_track].has_own_volume=true;
-
- } break;
- case 'S': {
-
- do_effect_S(p_track);
- } break;
- case 'T': {
- uint8_t dat;
- int16_t temp=control.tempo;
-
- if (control.pattern_delay_2) return;
-
- if (control.channel[p_track].current_parameter) {
-
- control.channel[p_track].tempo_slide_info=control.channel[p_track].current_parameter;
- }
-
- dat=control.channel[p_track].tempo_slide_info;
-
- if (dat>=0x20) {
-
- if (control.ticks_counter) break;
- control.tempo=dat;
- } else {
-
- if (!control.ticks_counter) break;
-
- if (dat&0x10) {
-
- temp+=(dat&0x0f);
- } else {
-
- temp-=dat;
- }
- control.tempo=(temp>255)?255:(temp<0x20?0x20:temp);
- }
-
- } break;
- case 'U': {
-
- uint8_t dat;
-
- dat=control.channel[p_track].current_parameter;
- control.channel[p_track].doing_vibrato=true;
- if (!control.ticks_counter) {
- if (dat&0x0f) control.channel[p_track].vibrato_depth=dat&0xf;
- if (dat&0xf0) control.channel[p_track].vibrato_speed=(dat&0xf0)>>2;
- }
-
- if (control.external_vibrato) break;
-
- if (control.channel[p_track].period) {
-
- do_vibrato(p_track,true);
- control.channel[p_track].has_own_period=true;
- }
- } break;
- case 'V': {
-
- control.global_volume=control.channel[p_track].current_parameter;
- if (control.global_volume>128) control.global_volume=128;
- } break;
- case 'W': {
- do_global_volume_slide(p_track);
- } break;
- case 'X': {
- //sets both channel and current
- control.channel[p_track].channel_panning=control.channel[p_track].current_parameter;
- control.channel[p_track].panning=control.channel[p_track].current_parameter;
- } break;
- case 'Y': {
-
- uint8_t dat;
-
- if (control.channel[p_track].current_parameter) {
-
- control.channel[p_track].panbrello_info=control.channel[p_track].current_parameter;
- }
-
- dat=control.channel[p_track].panbrello_info;
-
- if (!control.ticks_counter) {
-
- if (dat&0x0f) control.channel[p_track].panbrello_depth=(dat&0xf);
- if (dat&0xf0) control.channel[p_track].panbrello_speed=(dat&0xf0)>>4;
- }
-
- //if (pf->panflag)
- if (control.channel[p_track].panning!=PAN_SURROUND)do_panbrello(p_track);
-
- } break;
- case 'Z': {
- //I DO! cuttoff!
- uint16_t dat=control.channel[p_track].current_parameter;
-
- if (dat<0x80) {
-
- control.channel[p_track].filter.it_cutoff=dat*2;
- if (control.channel[p_track].filter.it_cutoff>0x80)
- control.channel[p_track].filter.it_cutoff++;
- } else if (dat<0x90) {
-
- control.channel[p_track].filter.it_reso=(dat-0x80)*0x10;
- } else {
-
- control.channel[p_track].reverb_send=(dat-0x90)*255/0x6F;
- }
-
- } break;
-
- }
-
-}
-
-void CPPlayer::pre_process_effects() {
-
-// MP_VOICE *aout;
- int i;
-
- for (i=0;i<CPPattern::WIDTH;i++) {
-
- //a=&pf->control[mp_channel];
-
- // if ((aout=a->slave)) {
- // a->fadevol=aout->fadevol;
- // a->period=aout->period;
- // if (a->kick==KICK_KEYOFF) a->keyoff=aout->keyoff;
- //}
-
- //if (!a->row) continue;
- //UniSetRow(a->row);
- control.channel[i].has_own_period=false;
- control.channel[i].has_own_volume=false;
- control.channel[i].doing_vibrato=false;
- //explicitslides=0;
- //pt_playeffects();
- if (control.ticks_counter<control.speed) {
-
- run_effects(i);
- run_volume_column_effects(i);
- }
-
- /* continue volume slide if necessary for XM and IT */
- //if (pf->flags&UF_BGSLIDES) {
- // if (!explicitslides && a->sliding)
- // DoS3MVolSlide(0);
- // else if (a->tmpvolume) a->sliding=explicitslides;
- //}
-
- if (!control.channel[i].has_own_period) control.channel[i].period=control.channel[i].aux_period;
- if (!control.channel[i].has_own_volume) control.channel[i].volume=control.channel[i].aux_volume;
-
- if ((control.channel[i].sample_ptr!=NULL) && !(song->has_instruments() && (control.channel[i].instrument_ptr==NULL))) {
-
- if (song->has_instruments()) {
-
- control.channel[i].output_volume=
- (control.channel[i].volume*control.channel[i].sample_ptr->get_global_volume()*control.channel[i].instrument_ptr->get_volume_global_amount())/2048;
- control.channel[i].output_volume=control.channel[i].output_volume*control.channel[i].random_volume_variation/100;
-
- } else {
-
- control.channel[i].output_volume=
- (control.channel[i].volume*control.channel[i].sample_ptr->get_global_volume())>>4;
-
- }
-
- if (control.channel[i].output_volume>256) {
-
- control.channel[i].output_volume=256;
-
- } else if (control.channel[i].output_volume<0) {
-
- control.channel[i].output_volume=0;
- }
-
-
- }
- }
-
-}
diff --git a/modules/chibi/cp_player_data_envelopes.cpp b/modules/chibi/cp_player_data_envelopes.cpp
deleted file mode 100644
index 96af42d19f..0000000000
--- a/modules/chibi/cp_player_data_envelopes.cpp
+++ /dev/null
@@ -1,89 +0,0 @@
-/*************************************************************************/
-/* cp_player_data_envelopes.cpp */
-/*************************************************************************/
-/* This file is part of: */
-/* GODOT ENGINE */
-/* http://www.godotengine.org */
-/*************************************************************************/
-/* Copyright (c) 2007-2016 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 "cp_player_data.h"
-
-
-void CPPlayer::Voice_Control::start_envelope(CPEnvelope *p_envelope,Envelope_Control *p_envelope_ctrl,Envelope_Control *p_from_env) {
-
-
- if (p_from_env && p_envelope->is_carry_enabled() && !p_from_env->terminated) {
-
-
- *p_envelope_ctrl=*p_from_env;
- } else {
- p_envelope_ctrl->pos_index=0;
- p_envelope_ctrl->status=1;
- p_envelope_ctrl->sustain_looping=p_envelope->is_sustain_loop_enabled();
- p_envelope_ctrl->looping=p_envelope->is_loop_enabled();
- p_envelope_ctrl->terminated=false;
- p_envelope_ctrl->kill=false;
- p_envelope_ctrl->value=p_envelope->get_height_at_pos(p_envelope_ctrl->pos_index);
- }
-}
-
-bool CPPlayer::Voice_Control::process_envelope(CPEnvelope *p_envelope,Envelope_Control *p_envelope_ctrl) {
-
- if (!p_envelope_ctrl->active)
- return false;
-
- if (note_end_flags&END_NOTE_OFF) p_envelope_ctrl->sustain_looping=false;
-
- p_envelope_ctrl->value=p_envelope->get_height_at_pos(p_envelope_ctrl->pos_index);
- if (p_envelope_ctrl->value==CPEnvelope::NO_POINT)
- return false;
-
-
- p_envelope_ctrl->pos_index++;
-
- if (p_envelope_ctrl->sustain_looping) {
-
- if (p_envelope_ctrl->pos_index>p_envelope->get_node(p_envelope->get_sustain_loop_end()).tick_offset) {
-
- p_envelope_ctrl->pos_index=p_envelope->get_node(p_envelope->get_sustain_loop_begin()).tick_offset;
- }
-
- } else if (p_envelope_ctrl->looping) {
-
- if (p_envelope_ctrl->pos_index>p_envelope->get_node(p_envelope->get_loop_end()).tick_offset) {
-
- p_envelope_ctrl->pos_index=p_envelope->get_node(p_envelope->get_loop_begin()).tick_offset;
- }
-
- }
-
- if (p_envelope_ctrl->pos_index>p_envelope->get_node(p_envelope->get_node_count()-1).tick_offset) {
-
- p_envelope_ctrl->terminated=true;
- p_envelope_ctrl->pos_index=p_envelope->get_node(p_envelope->get_node_count()-1).tick_offset;
- if (p_envelope->get_node(p_envelope->get_node_count()-1).value==0) p_envelope_ctrl->kill=true;
- }
-
- return true;
-}
diff --git a/modules/chibi/cp_player_data_events.cpp b/modules/chibi/cp_player_data_events.cpp
deleted file mode 100644
index fb5090461b..0000000000
--- a/modules/chibi/cp_player_data_events.cpp
+++ /dev/null
@@ -1,679 +0,0 @@
-/*************************************************************************/
-/* cp_player_data_events.cpp */
-/*************************************************************************/
-/* This file is part of: */
-/* GODOT ENGINE */
-/* http://www.godotengine.org */
-/*************************************************************************/
-/* Copyright (c) 2007-2016 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 "cp_player_data.h"
-#include "cp_sample_manager.h"
-#include "stdio.h"
-/*
- setup_voices():
-
-This will go throught all the REAL channels, if it finds a channel
-that needs to be restarted or assigned a new VIRTUAL channel, then it
-will just find one and do it.
-
-*/
-
-
-#define C5FREQ 261.6255653006
-static const int32_t C5FREQ_MIXER = ((int32_t)(C5FREQ*(float)(1<<CPMixer::FREQUENCY_BITS)));
-
-
-void CPPlayer::setup_voices() {
-
- int i,voice_index;
-
-
-
-
- for (i=0;i<CPPattern::WIDTH;i++) {
-
- voice_index=-1;
-
- if (control.channel[i].note_delay) continue;
-
-
- // check if we need a new empty voice
- if (control.channel[i].kick==KICK_NOTE) {
-
- /* if no channel was cut above, find an empty or quiet channel
- here */
- if ( song->has_instruments() && !control.force_no_nna) {
-
- if (control.channel[i].slave_voice==NULL) { // no slave??
-
- int newchn;
- if ((newchn=find_empty_voice())!=-1) {
-
- control.channel[i].slave_voice_index=newchn;
- control.channel[i].slave_voice=&voice[newchn];
- }
- }
-
- } else {
- if (i<control.max_voices) {
-
- control.channel[i].slave_voice_index=i;
- control.channel[i].slave_voice=&voice[i];
- } else {
- //This is a _DIRTY_ hack, but i cant think a better way.
- control.channel[i].slave_voice_index=control.max_voices-1;
- control.channel[i].slave_voice=&voice[control.max_voices-1];
- }
-
- }
-
-
- /* assign parts of MP_VOICE only done for a KICK_NOTE */
- if ( ( control.channel[i].slave_voice!=NULL ) ) {
-
- voice_index=control.channel[i].slave_voice_index;
- Voice_Control &v=voice[voice_index];
-
- if (v.has_master_channel && (v.master_channel!=NULL) ) {
- // If this voice already has a master channel, make sure to remove the reference to it.
- v.master_channel->slave_voice=NULL;
-
- }
- //notify the voice that the current channel is the master
- v.master_channel=&control.channel[i];
- //set the voice as slave of the current channel
- control.channel[i].slave_voice=&v;
- //master channel index of the voice
- v.master_channel_index=i;
- v.has_master_channel=true;
- }
-
- } else {
- // nope..
- // so if we DO have a slave voice then use it.
- if ( control.channel[i].slave_voice!=NULL ) {
-
- voice_index=control.channel[i].slave_voice_index;
- }
- }
- //assuming this channel has a slave voice..
- if (voice_index>=0) {
-
- // IMPROVE: Code a method for this:
- voice[voice_index].update_info_from_master_channel();
- }
-
- control.channel[i].kick=KICK_NOTHING;
- }
-}
-void CPPlayer::Voice_Control::reset() {
-
- cp_memzero(this,sizeof(*this));
-
- instrument_ptr=NULL;
- sample_ptr=NULL;
- has_master_channel=false;
- instrument_index=-1;
- reverb_send=0;
- chorus_send=0;
- filter.it_cutoff=255;
- filter.it_reso=0;
- display_volume=0;
-
-
-}
-
-void CPPlayer::Channel_Control::reset() {
-
- int prev_gv =channel_global_volume;
- cp_memzero(this,sizeof(*this));
-
- slave_voice=NULL;
- slave_voice_index=255;
-
- mute=false;
- old_note=255;
- real_note=255;
- instrument_index=255;
- filter.it_cutoff=255;
- filter.it_reso=0;
- reverb_send=0;
- chorus_send=0;
- reserved=false;
- carry.maybe=false;
- last_event_usecs=-1;
- channel_global_volume=prev_gv;
-}
-
-void CPPlayer::Voice_Control::update_info_from_master_channel() {
-
- instrument_ptr=master_channel->instrument_ptr;
- sample_ptr=master_channel->sample_ptr;
-
- instrument_index=master_channel->instrument_index;
- sample_index=master_channel->sample_index;
-
- note=master_channel->note;
- output_volume=master_channel->output_volume;
-
- channel_volume=master_channel->channel_volume;
-
- panning=master_channel->panning;
-
- kick=master_channel->kick;
- note_end_flags=master_channel->note_end_flags;
- period=master_channel->period;
-
- volume_envelope_ctrl.active=master_channel->volume_envelope_on;
- panning_envelope_ctrl.active=master_channel->panning_envelope_on;
- pitch_envelope_ctrl.active=master_channel->pitch_envelope_on;
-
-
- NNA_type=master_channel->NNA_type;
- reverb_send=master_channel->reverb_send;
- chorus_send=master_channel->chorus_send;
-
-// last_note_type=master_channel->last_note_type;
-
- sample_start_index=master_channel->sample_start_index;
- filter=master_channel->filter;
-
-}
-
-
-void CPPlayer::update_mixer() {
-
- int tmp_mixer_period;
- int32_t tmp_vibrato_value,tmp_vibrato_depth,tmp_volenv_value;
- uint64_t tmpvol; // 64bits should be the only way to avoid getting notes raped out
- int i;
-
-
- control.voices_used=0;
-
- for (i=0;i<control.max_voices;i++) {
-
-
- int filter_env=-1;
- Voice_Control &v=voice[i];
-
- if ( !((v.kick==KICK_NOTE)||(v.kick==KICK_NOTEOFF)) && !is_voice_active(i))
- continue;
-
- //if voice doesnt have a sample set or size is 0.. forget it
- if ( v.sample_ptr==NULL) continue;
-
-
- //TODO set limits somewhere else
-
- if (v.period<40) {
-
- v.period=40;
-
- } else if (v.period>50000) {
-
- v.period=50000;
- }
-
-
- if ((v.kick==KICK_NOTE)||(v.kick==KICK_NOTEOFF)) {
-
- int real_start_index;
-
- if (v.sample_start_index==-1) {
-
- real_start_index=0;
-
- } else {
-
- real_start_index=v.sample_start_index;
- }
-
- mixer->setup_voice(i,v.sample_ptr->get_sample_data(),real_start_index);
- v.fadeout_volume=1024; //IT Docs it is 1024 internally
- v.auto_vibrato_sweep_pos=0;
-
-
-
- }
-
-
- /* Start Envelopes */
- if ( song->has_instruments() && ((v.kick==KICK_NOTE)||(v.kick==KICK_ENVELOPE))) {
-
-// Voice_Control *carry=0;
-
-
- if (v.has_master_channel && v.master_channel->carry.maybe) {
-
- v.start_envelope(v.instrument_ptr->get_volume_envelope(),&v.volume_envelope_ctrl,&v.master_channel->carry.vol);
- v.start_envelope(v.instrument_ptr->get_pan_envelope(),&v.panning_envelope_ctrl,&v.master_channel->carry.pan);
- v.start_envelope(v.instrument_ptr->get_pitch_filter_envelope(),&v.pitch_envelope_ctrl,&v.master_channel->carry.pitch);
-
- } else {
-
- v.start_envelope(v.instrument_ptr->get_volume_envelope(),&v.volume_envelope_ctrl,NULL);
- v.start_envelope(v.instrument_ptr->get_pan_envelope(),&v.panning_envelope_ctrl,NULL);
- v.start_envelope(v.instrument_ptr->get_pitch_filter_envelope(),&v.pitch_envelope_ctrl,NULL);
-
- }
-
-
- }
-
- v.kick=KICK_NOTHING;
-
- if (song->has_instruments()) {
-
- if (!v.process_envelope(v.instrument_ptr->get_volume_envelope(),&v.volume_envelope_ctrl))
- v.volume_envelope_ctrl.value=64;
-
- if (!v.process_envelope(v.instrument_ptr->get_pan_envelope(),&v.panning_envelope_ctrl))
- v.panning_envelope_ctrl.value=0;
-
- if (!v.process_envelope(v.instrument_ptr->get_pitch_filter_envelope(),&v.pitch_envelope_ctrl))
- v.pitch_envelope_ctrl.value=0;
-
-
- if (v.volume_envelope_ctrl.terminated) {
-
- if (v.volume_envelope_ctrl.kill) {
-
- v.fadeout_volume=0;
- } else {
-
- v.note_end_flags|=END_NOTE_FADE;
- }
- }
-
- }
-
- if (song->has_instruments()) {
-
- tmp_volenv_value=v.volume_envelope_ctrl.value;
- } else {
-
- tmp_volenv_value=64;
-
- }
-
- /*printf("fadeout %i\n",(int)v.fadeout_volume);
- printf("channel %i\n",(int)v.channel_volume);
- printf("output %i\n",(int)v.output_volume);
- printf("env %i\n",(int)tmp_volenv_value);
- printf("cgb %i\n",(int)v.master_channel->channel_global_volume);
-*/
-
-
- tmpvol=(uint64_t)v.fadeout_volume; /* max 1024 - 10 bits */
- tmpvol*=(uint64_t)v.channel_volume; /* * max 64 - 6 bits */
- tmpvol*=(uint64_t)v.output_volume; /* * max 256 - 8 bits */
- tmpvol*=(uint64_t)tmp_volenv_value; /* max 64 - 6 bits*/
- tmpvol*=(uint64_t)v.master_channel->channel_global_volume;
- v.display_volume=tmpvol>>22; //volume used for display purposes , 0 -- 256
-
- tmpvol*=(uint64_t)song->get_mixing_volume(); /* max 128 - 7 bits */
- tmpvol*=(uint64_t)control.global_volume; /* max 128 - 7 bits*/
- /* total 10+6+8+6+7+7=44 bits */
-
- tmpvol>>=43; /* Move back to 8 bits range , 44-19+8=43*/
-
- if (tmpvol>CP_VOL_MAX)
- tmpvol=CP_VOL_MAX;
-
- //printf("volume check - fade %i, channel %i, output %i, env %i, mix %i, global %i -- final %i\n",v.fadeout_volume, v.channel_volume,v.output_volume,tmp_volenv_value, song->get_mixing_volume(),control.global_volume,tmpvol);
-
- v.total_volume=tmpvol;
-
-
- if ((v.master_channel!=NULL) && song->is_channel_mute( v.master_channel_index ) && !v.master_channel->reserved) {
-
- mixer->set_voice_volume(i,0);
- } else {
- mixer->set_voice_volume(i,tmpvol);
- if (v.fadeout_volume>0) control.voices_used++;
- }
-
-
- if (!song->is_stereo()) {
-
- mixer->set_voice_panning(i,PAN_CENTER);
-
- } else if (v.panning==PAN_SURROUND) {
-
- mixer->set_voice_panning(i,PAN_SURROUND);
- } else if (song->has_instruments()) {
-
- int newpan,real_modifier;
-
-
- real_modifier=(v.panning_envelope_ctrl.value*(PAN_CENTER-cp_intabs(v.panning-PAN_CENTER)))/32;
-
- newpan=v.panning+real_modifier;
-
- newpan=(newpan<PAN_LEFT)?PAN_LEFT:(newpan>PAN_RIGHT)?PAN_RIGHT:newpan;
- //printf("panenv val: %i, finalpan val %i\n",v.panning_envelope_ctrl.value,newpan);
-
- mixer->set_voice_panning(i,newpan);
- } else {
- mixer->set_voice_panning(i,v.panning);
- }
-
-
-
- /* VIBRATO */
-
- if ( (v.period>0) && (v.sample_ptr->get_vibrato_depth()>0) ) {
-
- switch (v.sample_ptr->get_vibrato_type()) {
- case CPSample::VIBRATO_SINE:
- tmp_vibrato_value=auto_vibrato_table[v.auto_vibrato_pos&127];
- if (v.auto_vibrato_pos & 0x80) tmp_vibrato_value=-tmp_vibrato_value;
- break;
- case CPSample::VIBRATO_SQUARE:
- tmp_vibrato_value=64;
- if (v.auto_vibrato_pos & 0x80) tmp_vibrato_value=-tmp_vibrato_value;
- break;
- case CPSample::VIBRATO_SAW:
- tmp_vibrato_value=63-(((v.auto_vibrato_pos+128)&255)>>1);
- break;
- default:
- tmp_vibrato_value=(((v.auto_vibrato_pos+128)&255)>>1)-64;
- break;
- }
- } else {
-
- tmp_vibrato_value=0;
- }
-
- if ((v.auto_vibrato_sweep_pos>>8)<v.sample_ptr->get_vibrato_depth()) {
-
- v.auto_vibrato_sweep_pos+=v.sample_ptr->get_vibrato_speed(); //FIXME - speed? i think so
- tmp_vibrato_depth=v.auto_vibrato_sweep_pos;
-
- } else {
-
- tmp_vibrato_depth=v.sample_ptr->get_vibrato_depth()<<8;
- }
-
- tmp_vibrato_value=(tmp_vibrato_value*tmp_vibrato_depth)>>16;
- if (song->has_linear_slides())
- tmp_vibrato_value>>=1;
- v.period-=tmp_vibrato_value;
-
-
- /* update vibrato position */
- v.auto_vibrato_pos=(v.auto_vibrato_pos+v.sample_ptr->get_vibrato_rate())&0xff;
-
-
- /* process pitch envelope */
- tmp_mixer_period=v.period;
-
- if (v.pitch_envelope_ctrl.active) {
-
- long aux_pitch_diff;
- int pe_value=v.pitch_envelope_ctrl.value;
-
- if (!v.instrument_ptr->is_pitch_use_as_filter()) {
-
-
- if (((uint16_t)v.note<<1)+pe_value<=0)
- pe_value=-(v.note<<1);
-
- int smp_c5=CPSampleManager::get_singleton()->get_c5_freq( v.sample_ptr->get_sample_data());
-
- int base=get_period(((uint16_t)v.note<<1),smp_c5);
- int env=get_period(((uint16_t)v.note<<1)+pe_value,smp_c5);
- /*
- int env_next=(pe_value<0)?get_period(((uint16_t)(v.note-1)<<1)+pe_value,smp_c5):get_period(((uint16_t)(v.note+1)<<1)+pe_value,smp_c5);
-
- env=env+(abs(v.pitch_envelope_ctrl.value)&((1<<CPEnvelope::FX_HEIGHT_BITS)-1))*(env_next-env)/(1<<CPEnvelope::FX_HEIGHT_BITS);
-
- printf("env %i\n",env);
- */
- aux_pitch_diff=env-base;
-
-
- if ( ((int)tmp_mixer_period-aux_pitch_diff)<0 ) aux_pitch_diff=0;
-
- tmp_mixer_period+=aux_pitch_diff;
-
- } else {
-
- filter_env=pe_value+32; //max 64
-// printf("pitch envelope at %i",filter_env);
-
- }
- }
-
- if (v.fadeout_volume==0 || (v.note_end_flags & END_NOTE_KILL)) { /* check for a dead note (fadevol=0) */
-
- mixer->stop_voice(i);
-
- } else {
-
-
- int32_t freq=get_frequency(tmp_mixer_period);
- int32_t tracker_c5=get_frequency(get_period(60<<1,CPSampleManager::get_singleton()->get_c5_freq( v.sample_ptr->get_sample_data())));
-
- freq=(int32_t)((uint64_t)freq*(uint64_t)C5FREQ_MIXER/(uint64_t)tracker_c5); //numbers may become very high
- mixer->set_voice_frequency(i,freq);
-
- /* if keyfade, start substracting fadeoutspeed from fadevol: */
- if ((song->has_instruments())&&(v.note_end_flags & END_NOTE_FADE)) {
-
- if (v.fadeout_volume>=(v.instrument_ptr->get_volume_fadeout())) {
-
- v.fadeout_volume-=(v.instrument_ptr->get_volume_fadeout());
- } else {
-
- v.fadeout_volume=0;
- }
- }
-
- /*FILTARSSSSSSSS*/
-
-
-
- v.filter.envelope_cutoff=filter_env;
- v.filter.process();
-
- if ((v.filter.final_cutoff<0xFF) && (control.filters)) {
-
- //int final_cutoff;
- //uint8_t final_reso;
-
- //v.filter.set_filter_parameters( &final_cutoff, &final_reso );
-
- mixer->set_voice_filter(i,true,v.filter.final_cutoff,v.filter.it_reso);
- } else {
-
-
- mixer->set_voice_filter(i,false,0,0);
- }
-
- /* RAIVERV */
-
- mixer->set_voice_reverb_send(i,v.reverb_send);
-
- /* CHAURUZ */
-
- mixer->set_voice_chorus_send(i,v.chorus_send);
-
- }
- }
-
-
- switch(song->get_reverb_mode()) {
-
- case CPSong::REVERB_MODE_ROOM: {
-
- mixer->set_reverb_mode( CPMixer::REVERB_MODE_ROOM );
- } break;
- case CPSong::REVERB_MODE_STUDIO_SMALL: {
-
- mixer->set_reverb_mode( CPMixer::REVERB_MODE_STUDIO_SMALL );
-
- } break;
- case CPSong::REVERB_MODE_STUDIO_MEDIUM: {
-
- mixer->set_reverb_mode( CPMixer::REVERB_MODE_STUDIO_MEDIUM );
-
- } break;
- case CPSong::REVERB_MODE_STUDIO_LARGE: {
-
- mixer->set_reverb_mode( CPMixer::REVERB_MODE_STUDIO_LARGE );
-
- } break;
- case CPSong::REVERB_MODE_HALL: {
-
- mixer->set_reverb_mode( CPMixer::REVERB_MODE_HALL );
-
- } break;
- case CPSong::REVERB_MODE_SPACE_ECHO: {
-
- mixer->set_reverb_mode( CPMixer::REVERB_MODE_SPACE_ECHO );
-
- } break;
- case CPSong::REVERB_MODE_ECHO: {
-
- mixer->set_reverb_mode( CPMixer::REVERB_MODE_ECHO );
-
- } break;
- case CPSong::REVERB_MODE_DELAY: {
-
- mixer->set_reverb_mode( CPMixer::REVERB_MODE_DELAY );
-
- } break;
- case CPSong::REVERB_MODE_HALF_ECHO: {
-
- mixer->set_reverb_mode( CPMixer::REVERB_MODE_HALF_ECHO );
-
- } break;
-
- }
-
- mixer->set_chorus_params(song->get_chorus_delay_ms(),song->get_chorus_separation_ms(),song->get_chorus_depth_ms10(),song->get_chorus_speed_hz10() );
-
-
-}
-
-
-
-
-
-
-
-
-void CPPlayer::handle_tick() {
-
- int i;
-
-
- if ( mixer==NULL ) return;
- if ( song==NULL ) return;
-
-
- /* update time counter (sngtime is in milliseconds (in fact 2^-10)) */
-
- if (control.ticks_counter>=control.speed) { // time to process... ***THE ROW***!
-
- /* process pattern-delay. pf->patdly2 is the counter and pf->patdly is
- the command memory. */
-
-// if (control.pattern_delay_1) {
-
-// control.pattern_delay_2=control.pattern_delay_1;
-// control.pattern_delay_1=0;
-// }
-// if (control.pattern_delay_2) {
-// patterndelay active
-// if (--control.pattern_delay_2)
-// so turn back pf->patpos by 1
-// if (pf->patpos) pf->patpos--;
-// }
-
- if (control.play_mode!=PLAY_NOTHING) {
-
- control.ticks_counter=0;
-
-
- if (control.position.force_next_order>=0) {
-
- control.position.current_order=control.position.force_next_order;
- }
-
- control.position.force_next_order=-1;
-
- control.previous_position=control.position; // for those special cases...
- control.position.forbid_jump=false;
-
- for (i=0;i<CPPattern::WIDTH;i++) {
-
- process_note(i,song->get_pattern(control.position.current_pattern)->get_note(i,control.position.current_row));
- }
-
- control.position.current_row++;
-
- if ( control.position.current_row>=song->get_pattern(control.position.current_pattern)->get_length() ) {
-
- if (control.play_mode==PLAY_SONG) {
-
- int next_order;
-
- next_order=get_song_next_order_idx(song,control.position.current_order);
-
- if (next_order!=-1) {
- // Do we have a "next order?"
- control.position.current_pattern=song->get_order(next_order);
- if (next_order<=control.position.current_order)
- control.reached_end=true;
- control.position.current_order=next_order;
-
- } else {
- // no, probably the user deleted the orderlist.
- control.play_mode=PLAY_NOTHING;
- reset();
- control.reached_end=true;
- }
- }
- control.position.current_row=0;
- }
-
- }
-
-
- }
-
-
-
- pre_process_effects();
- process_NNAs();
- setup_voices();
-
- /* now set up the actual hardware channel playback information */
- update_mixer();
-
- control.ticks_counter++;
-}
diff --git a/modules/chibi/cp_player_data_filter.cpp b/modules/chibi/cp_player_data_filter.cpp
deleted file mode 100644
index 30db807eed..0000000000
--- a/modules/chibi/cp_player_data_filter.cpp
+++ /dev/null
@@ -1,89 +0,0 @@
-/*************************************************************************/
-/* cp_player_data_filter.cpp */
-/*************************************************************************/
-/* This file is part of: */
-/* GODOT ENGINE */
-/* http://www.godotengine.org */
-/*************************************************************************/
-/* Copyright (c) 2007-2016 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 "cp_player_data.h"
-
-static float filter_cutoff[256] = {
- 130, 132, 134, 136, 138, 140, 142, 144,
- 146, 148, 151, 153, 155, 157, 160, 162,
- 164, 167, 169, 172, 174, 177, 179, 182,
- 184, 187, 190, 193, 195, 198, 201, 204,
- 207, 210, 213, 216, 220, 223, 226, 229,
- 233, 236, 239, 243, 246, 250, 254, 257,
- 261, 265, 269, 273, 277, 281, 285, 289,
- 293, 297, 302, 306, 311, 315, 320, 324,
- 329, 334, 339, 344, 349, 354, 359, 364,
- 369, 375, 380, 386, 391, 397, 403, 409,
- 415, 421, 427, 433, 440, 446, 452, 459,
- 466, 472, 479, 486, 493, 501, 508, 515,
- 523, 530, 538, 546, 554, 562, 570, 578,
- 587, 595, 604, 613, 622, 631, 640, 649,
- 659, 668, 678, 688, 698, 708, 718, 729,
- 739, 750, 761, 772, 783, 795, 806, 818,
- 830, 842, 854, 867, 880, 892, 905, 918,
- 932, 945, 959, 973, 987, 1002, 1016, 1031,
- 1046, 1061, 1077, 1092, 1108, 1124, 1141, 1157,
- 1174, 1191, 1209, 1226, 1244, 1262, 1280, 1299,
- 1318, 1337, 1357, 1376, 1396, 1417, 1437, 1458,
- 1479, 1501, 1523, 1545, 1567, 1590, 1613, 1637,
- 1661, 1685, 1709, 1734, 1760, 1785, 1811, 1837,
- 1864, 1891, 1919, 1947, 1975, 2004, 2033, 2062,
- 2093, 2123, 2154, 2185, 2217, 2249, 2282, 2315,
- 2349, 2383, 2418, 2453, 2489, 2525, 2561, 2599,
- 2637, 2675, 2714, 2753, 2793, 2834, 2875, 2917,
- 2959, 3003, 3046, 3091, 3135, 3181, 3227, 3274,
- 3322, 3370, 3419, 3469, 3520, 3571, 3623, 3675,
- 3729, 3783, 3838, 3894, 3951, 4008, 4066, 4125,
- 4186, 4246, 4308, 4371, 4434, 4499, 4564, 4631,
- 4698, 4766, 4836, 4906, 4978, 5050, 5123, 5198
-};
-
-
-void CPPlayer::Filter_Control::process() {
-
-
- final_cutoff=it_cutoff;
- if (envelope_cutoff>=0) {
-
- envelope_cutoff=envelope_cutoff*255/64;
- final_cutoff=final_cutoff*envelope_cutoff/255;
- if (final_cutoff>=0xFF) final_cutoff=0xFE;
-
- }
-
-}
-
-void CPPlayer::Filter_Control::set_filter_parameters(int *p_cutoff,uint8_t *p_reso) {
-
-
-
- *p_cutoff=filter_cutoff[final_cutoff];
- *p_reso=it_reso;
-}
diff --git a/modules/chibi/cp_player_data_nna.cpp b/modules/chibi/cp_player_data_nna.cpp
deleted file mode 100644
index 844f043694..0000000000
--- a/modules/chibi/cp_player_data_nna.cpp
+++ /dev/null
@@ -1,144 +0,0 @@
-/*************************************************************************/
-/* cp_player_data_nna.cpp */
-/*************************************************************************/
-/* This file is part of: */
-/* GODOT ENGINE */
-/* http://www.godotengine.org */
-/*************************************************************************/
-/* Copyright (c) 2007-2016 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 "cp_player_data.h"
-
-void CPPlayer::process_NNAs() {
-
- int i;
-
- if (!song->has_instruments()) return;
-
- for (i=0;i<CPPattern::WIDTH;i++) {
-
- Channel_Control *aux_chn_ctrl = &control.channel[i];
-
- if (aux_chn_ctrl->kick==KICK_NOTE) {
-
- bool k=false;
-
- if (aux_chn_ctrl->slave_voice!=NULL) {
-
- Voice_Control *aux_voc_ctrl;
-
- aux_voc_ctrl=aux_chn_ctrl->slave_voice;
-
- if (aux_chn_ctrl->instrument_index==aux_chn_ctrl->slave_voice->instrument_index) { //maybe carry
-
- aux_chn_ctrl->carry.pan=aux_chn_ctrl->slave_voice->panning_envelope_ctrl;
- aux_chn_ctrl->carry.vol=aux_chn_ctrl->slave_voice->volume_envelope_ctrl;
- aux_chn_ctrl->carry.pitch=aux_chn_ctrl->slave_voice->pitch_envelope_ctrl;
- aux_chn_ctrl->carry.maybe=true;
- } else
- aux_chn_ctrl->carry.maybe=false;
-
- if (aux_voc_ctrl->NNA_type != CPInstrument::NNA_NOTE_CUT) {
- /* Make sure the old MP_VOICE channel knows it has no
- master now ! */
-
-
-
- aux_chn_ctrl->slave_voice=NULL;
- /* assume the channel is taken by NNA */
- aux_voc_ctrl->has_master_channel=false;
-
- switch (aux_voc_ctrl->NNA_type) {
- case CPInstrument::NNA_NOTE_CONTINUE: {
-
- } break;
- case CPInstrument::NNA_NOTE_OFF: {
-
-
- aux_voc_ctrl->note_end_flags|=END_NOTE_OFF;
-
- if (!aux_voc_ctrl->volume_envelope_ctrl.active || aux_voc_ctrl->instrument_ptr->get_volume_envelope()->is_loop_enabled()) {
- aux_voc_ctrl->note_end_flags|=END_NOTE_FADE;
- }
- } break;
- case CPInstrument::NNA_NOTE_FADE: {
-
- aux_voc_ctrl->note_end_flags|=END_NOTE_FADE;
- } break;
- }
- }
- }
-
- if (aux_chn_ctrl->duplicate_check_type!=CPInstrument::DCT_DISABLED) {
- int i;
-
- for (i=0;i<control.max_voices;i++) {
- if (!mixer->is_voice_active(i)||
- (voice[i].master_channel!=aux_chn_ctrl) ||
- (aux_chn_ctrl->instrument_index!=voice[i].instrument_index))
- continue;
-
- Voice_Control *aux_voc_ctrl;
-
- aux_voc_ctrl=&voice[i];
-
- k=false;
- switch (aux_chn_ctrl->duplicate_check_type) {
- case CPInstrument::DCT_NOTE:
- if (aux_chn_ctrl->note==aux_voc_ctrl->note)
- k=true;
- break;
- case CPInstrument::DCT_SAMPLE:
- if (aux_chn_ctrl->sample_ptr==aux_voc_ctrl->sample_ptr)
- k=true;
- break;
- case CPInstrument::DCT_INSTRUMENT:
- k=true;
- break;
- }
- if (k) {
- switch (aux_chn_ctrl->duplicate_check_action) {
- case CPInstrument::DCA_NOTE_CUT: {
- aux_voc_ctrl->fadeout_volume=0;
- } break;
- case CPInstrument::DCA_NOTE_OFF: {
-
- aux_voc_ctrl->note_end_flags|=END_NOTE_OFF;
-
- if (!aux_voc_ctrl->volume_envelope_ctrl.active || aux_chn_ctrl->instrument_ptr->get_volume_envelope()->is_loop_enabled()) {
-
- aux_voc_ctrl->note_end_flags|=END_NOTE_FADE;
- }
-
- } break;
- case CPInstrument::DCA_NOTE_FADE: {
- aux_voc_ctrl->note_end_flags|=END_NOTE_FADE;
- } break;
- }
- }
- }
-
- }
- } /* if (aux_chn_ctrl->kick==KICK_NOTE) */
- }
-}
diff --git a/modules/chibi/cp_player_data_notes.cpp b/modules/chibi/cp_player_data_notes.cpp
deleted file mode 100644
index 621be019e1..0000000000
--- a/modules/chibi/cp_player_data_notes.cpp
+++ /dev/null
@@ -1,345 +0,0 @@
-/*************************************************************************/
-/* cp_player_data_notes.cpp */
-/*************************************************************************/
-/* This file is part of: */
-/* GODOT ENGINE */
-/* http://www.godotengine.org */
-/*************************************************************************/
-/* Copyright (c) 2007-2016 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 "cp_player_data.h"
-#include "cp_sample_manager.h"
-
-#define RANDOM_MAX 2147483647
-
-static inline int32_t cp_random_generate(int32_t *seed) {
- int32_t k;
- int32_t s = (int32_t)(*seed);
- if (s == 0)
- s = 0x12345987;
- k = s / 127773;
- s = 16807 * (s - k * 127773) - 2836 * k;
- if (s < 0)
- s += 2147483647;
- (*seed) = (int32_t)s;
- return (int32_t)(s & RANDOM_MAX);
-}
-
-
-void CPPlayer::process_new_note(int p_track,uint8_t p_note) { // if there's really a new note....
-
- if (control.channel[p_track].real_note!=255) {
- control.channel[p_track].old_note=control.channel[p_track].real_note;
-
- }
-
- control.channel[p_track].real_note=p_note;
-
- control.channel[p_track].kick=KICK_NOTE;
-
- control.channel[p_track].sample_start_index=-1;
- control.channel[p_track].sliding=0;
- control.channel[p_track].row_has_note=true;
- control.channel[p_track].last_event_usecs=song_usecs;
-
- if (control.channel[p_track].panbrello_type) control.channel[p_track].panbrello_position=0;
-}
-
-bool CPPlayer::process_new_instrument(int p_track,uint8_t p_instrument) {
-
-// bool different_instrument=false;
- ERR_FAIL_INDEX_V(p_instrument,CPSong::MAX_INSTRUMENTS,false);
-
- if ( song->has_instruments() ) {
-
-
- control.channel[p_track].instrument_ptr=song->get_instrument(p_instrument);
- } else {
-
- control.channel[p_track].instrument_ptr=NULL;
- }
-
- control.channel[p_track].retrig_counter=0;
- control.channel[p_track].tremor_position=0;
- control.channel[p_track].sample_offset_fine=0;
- int old_instr_index=control.channel[p_track].instrument_index;
- control.channel[p_track].instrument_index=p_instrument;
-
- return (old_instr_index!=p_instrument);
-
-
-}
-
-
- // returns if it was able to process
-bool CPPlayer::process_note_and_instrument(int p_track,int p_note,int p_instrument) {
-
- bool aux_result;
- aux_result=false;
- CPSample *aux_sample=0; // current sample
- int dest_sample_index;
- bool new_instrument=false;
-
- control.channel[p_track].row_has_note=false; // wise man says.. "we dont have a note... until we really know we have a note".
- control.channel[p_track].new_instrument=false;
-
- if ( (p_note<0) && (p_instrument<0) ) return aux_result; // nothing to do here
- if ( (p_note==255) && (p_instrument==255) ) return aux_result;
-
- if ( (p_note>=0) && (p_note<120) ) {
-
- process_new_note(p_track,p_note);
-
- } else if (p_note==CPNote::CUT) {
-
- control.channel[p_track].aux_volume=0;
- control.channel[p_track].note_end_flags|=END_NOTE_OFF;
- control.channel[p_track].note_end_flags|=END_NOTE_KILL;
- return aux_result;
-
- } else if ((p_note==CPNote::OFF) && (song->has_instruments())) {
-
- if (control.channel[p_track].instrument_ptr!=NULL) {
-
- control.channel[p_track].note_end_flags|=END_NOTE_OFF;
-
- if (!control.channel[p_track].instrument_ptr->get_volume_envelope()->is_enabled() || control.channel[p_track].instrument_ptr->get_volume_envelope()->is_loop_enabled()) {
-
- control.channel[p_track].note_end_flags|=END_NOTE_FADE;
- }
- }
-
- return aux_result;
- } else return aux_result; // invalid note!
-
-
- if ( (p_instrument>=0) && (p_instrument<CPSong::MAX_INSTRUMENTS)) {
- new_instrument=process_new_instrument(p_track,p_instrument);
-
- if ( song->has_instruments() ) {
- // If we're in instrument mode...
- if ( control.channel[p_track].instrument_ptr->get_sample_number(control.channel[p_track].real_note) >= CPSong::MAX_SAMPLES) {
-
- control.channel[p_track].kick=KICK_NOTHING;
- return aux_result;
-
- } else {
- dest_sample_index=control.channel[p_track].instrument_ptr->get_sample_number(control.channel[p_track].real_note);
- control.channel[p_track].note=control.channel[p_track].instrument_ptr->get_note_number(control.channel[p_track].real_note);
- }
-
- } else {
- // If we're in sample mode...
- dest_sample_index=control.channel[p_track].instrument_index;
- control.channel[p_track].note=control.channel[p_track].real_note;
- }
-
- control.channel[p_track].sample_index=dest_sample_index;
- aux_sample=song->get_sample(dest_sample_index);
-
- if (!CPSampleManager::get_singleton()->check( aux_sample->get_sample_data() )) {
- /* INVALID SAMPLE */
- control.channel[p_track].kick=KICK_NOTHING;
- return aux_result;
-
- }
-
- aux_sample=song->get_sample(dest_sample_index);
- } else {
-
-
- if (!control.channel[p_track].sample_ptr)
- return aux_result;
-
- if (song->has_instruments()) {
-
- if (!control.channel[p_track].instrument_ptr)
- return aux_result;
-
- control.channel[p_track].note=control.channel[p_track].instrument_ptr->get_note_number(control.channel[p_track].real_note);
-
- } else {
-
- control.channel[p_track].note=control.channel[p_track].real_note;
-
- }
-
- aux_sample=control.channel[p_track].sample_ptr;
-
- }
-
-
-
- if (p_instrument>=CPSong::MAX_INSTRUMENTS && control.channel[p_track].sample_ptr!=aux_sample) {
-
- control.channel[p_track].new_instrument=(control.channel[p_track].period>0);
- }
-
- control.channel[p_track].sample_ptr=aux_sample;
-
- /* channel or instrument determined panning ? */
-
- control.channel[p_track].panning=control.channel[p_track].channel_panning;
-
- /* set filter,if any ? */
-
-
- if (aux_sample->is_pan_enabled()) {
-
- control.channel[p_track].panning=(int)aux_sample->get_pan()*255/64;
-
- } else if ( song->has_instruments() && (control.channel[p_track].instrument_ptr->is_pan_default_enabled()) ) {
-
- control.channel[p_track].panning=(int)control.channel[p_track].instrument_ptr->get_pan_default_amount()*255/64;
- }
-
-
- if (song->has_instruments()) {
-
-
- /* Pitch-Pan Separation */
- if ((control.channel[p_track].instrument_ptr->get_pan_pitch_separation()!=0) && (control.channel[p_track].channel_panning!=PAN_SURROUND)){
-
- control.channel[p_track].panning+=((control.channel[p_track].real_note-control.channel[p_track].instrument_ptr->get_pan_pitch_center())*control.channel[p_track].instrument_ptr->get_pan_pitch_separation())/8;
-
- if (control.channel[p_track].panning<PAN_LEFT) control.channel[p_track].panning=PAN_LEFT;
- if (control.channel[p_track].panning>PAN_RIGHT) control.channel[p_track].panning=PAN_RIGHT;
- }
-
- /* Random Volume Variation */
- if (control.channel[p_track].instrument_ptr->get_volume_random_variation()>0) {
-
- control.channel[p_track].random_volume_variation=100-(cp_random_generate(&control.random_seed) % control.channel[p_track].instrument_ptr->get_volume_random_variation());
-
- } else {
-
- control.channel[p_track].random_volume_variation=100;
- }
-
-
- /* Random Pan Variation */
- if ((control.channel[p_track].instrument_ptr->get_pan_random_variation()>0) && (control.channel[p_track].panning!=PAN_SURROUND)){
-
- int aux_pan_modifier;
-
- aux_pan_modifier=(cp_random_generate(&control.random_seed) % (control.channel[p_track].instrument_ptr->get_pan_random_variation() << 2));
- if ((cp_random_generate(&control.random_seed) % 2)==1) aux_pan_modifier=0-aux_pan_modifier; /* it's 5am, let me sleep :) */
-
- control.channel[p_track].panning+=aux_pan_modifier;
-
- if (control.channel[p_track].panning<PAN_LEFT) control.channel[p_track].panning=PAN_LEFT;
- if (control.channel[p_track].panning>PAN_RIGHT) control.channel[p_track].panning=PAN_RIGHT;
-
-
- }
-
- /*filter*/
-
- if (control.channel[p_track].instrument_ptr->filter_use_default_cutoff()) {
-
- control.channel[p_track].filter.it_cutoff=control.channel[p_track].instrument_ptr->get_filter_default_cutoff()*2;
-
- }
-
- if (control.channel[p_track].instrument_ptr->filter_use_default_resonance()) {
-
- control.channel[p_track].filter.it_reso=control.channel[p_track].instrument_ptr->get_filter_default_resonance()*2;
-
- }
-
- /*envelopes*/
-
-
- control.channel[p_track].volume_envelope_on=control.channel[p_track].instrument_ptr->get_volume_envelope()->is_enabled();
- control.channel[p_track].panning_envelope_on=control.channel[p_track].instrument_ptr->get_pan_envelope()->is_enabled();
- control.channel[p_track].pitch_envelope_on=control.channel[p_track].instrument_ptr->get_pitch_filter_envelope()->is_enabled();
- control.channel[p_track].NNA_type=control.channel[p_track].instrument_ptr->get_NNA_type();
- control.channel[p_track].duplicate_check_type=control.channel[p_track].instrument_ptr->get_DC_type();
- control.channel[p_track].duplicate_check_action=control.channel[p_track].instrument_ptr->get_DC_action();
-
-
- } else {
-
- control.channel[p_track].NNA_type=CPInstrument::NNA_NOTE_CUT;
- control.channel[p_track].duplicate_check_type=CPInstrument::DCT_DISABLED;
- control.channel[p_track].duplicate_check_action=CPInstrument::DCA_NOTE_CUT;
- }
-
-
- if (p_instrument<CPSong::MAX_INSTRUMENTS) { // instrument change
-
- control.channel[p_track].volume=control.channel[p_track].aux_volume=aux_sample->get_default_volume();
-
- }
-
-
- control.channel[p_track].slide_to_period=control.channel[p_track].aux_period=get_period((uint16_t)(control.channel[p_track].note)<<1,CPSampleManager::get_singleton()->get_c5_freq( (aux_sample->get_sample_data())));
-
- control.channel[p_track].note_end_flags=END_NOTE_NOTHING; /* clears flags */
-
- return true;
-}
-
-void CPPlayer::process_volume_column(int p_track,uint8_t p_volume) {
-
- control.channel[p_track].current_volume_command=CPNote::EMPTY;
- control.channel[p_track].current_volume_parameter=CPNote::EMPTY;
-
- if (p_volume<65) { // VOLUME
-
- control.channel[p_track].aux_volume=p_volume;
- } else if (p_volume<125) { // Volume Command
-
-
- control.channel[p_track].current_volume_command=(p_volume-65) / 10;
- control.channel[p_track].current_volume_parameter=(p_volume-65) % 10;
- } else if (p_volume<193) { // PAN
-
- control.channel[p_track].channel_panning=(p_volume-128)*PAN_RIGHT/64;
- control.channel[p_track].panning=control.channel[p_track].channel_panning;
-
- } else if (p_volume<213) { //More volume Commands
-
- control.channel[p_track].current_volume_command=((p_volume-193) / 10)+6;
- control.channel[p_track].current_volume_parameter=(p_volume-193) % 10;
- }
-}
-
-
-void CPPlayer::process_note(int p_track,CPNote p_note) {
-
- if ( p_note.note!=CPNote::SCRIPT ) {
-
- process_note_and_instrument(p_track,p_note.note,p_note.instrument);
- process_volume_column(p_track,p_note.volume);
- control.channel[p_track].current_command=p_note.command;
- control.channel[p_track].current_parameter=p_note.parameter;
-
- } else {
-
- CPNote n = song->get_pattern( control.position.current_pattern )->get_transformed_script_note( p_track, control.position.current_row );
- process_note( p_track, n );
-
- song->get_pattern( control.position.current_pattern )->scripted_clone( p_track, control.position.current_row );
- }
-}
diff --git a/modules/chibi/cp_player_data_utils.cpp b/modules/chibi/cp_player_data_utils.cpp
deleted file mode 100644
index 170a849863..0000000000
--- a/modules/chibi/cp_player_data_utils.cpp
+++ /dev/null
@@ -1,138 +0,0 @@
-/*************************************************************************/
-/* cp_player_data_utils.cpp */
-/*************************************************************************/
-/* This file is part of: */
-/* GODOT ENGINE */
-/* http://www.godotengine.org */
-/*************************************************************************/
-/* Copyright (c) 2007-2016 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 "cp_player_data.h"
-uint8_t CPPlayer::vibrato_table[32]={
- 0, 24, 49, 74, 97,120,141,161,180,197,212,224,235,244,250,253,
- 255,253,250,244,235,224,212,197,180,161,141,120, 97, 74, 49, 24
-};
-
-uint8_t CPPlayer::auto_vibrato_table[128]={
- 0, 1, 3, 4, 6, 7, 9,10,12,14,15,17,18,20,21,23,
- 24,25,27,28,30,31,32,34,35,36,38,39,40,41,42,44,
- 45,46,47,48,49,50,51,52,53,54,54,55,56,57,57,58,
- 59,59,60,60,61,61,62,62,62,63,63,63,63,63,63,63,
- 64,63,63,63,63,63,63,63,62,62,62,61,61,60,60,59,
- 59,58,57,57,56,55,54,54,53,52,51,50,49,48,47,46,
- 45,44,42,41,40,39,38,36,35,34,32,31,30,28,27,25,
- 24,23,21,20,18,17,15,14,12,10, 9, 7, 6, 4, 3, 1
-};
-
-
-int8_t CPPlayer::panbrello_table[256]={
- 0, 2, 3, 5, 6, 8, 9, 11, 12, 14, 16, 17, 19, 20, 22, 23,
- 24, 26, 27, 29, 30, 32, 33, 34, 36, 37, 38, 39, 41, 42, 43, 44,
- 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 56, 57, 58, 59,
- 59, 60, 60, 61, 61, 62, 62, 62, 63, 63, 63, 64, 64, 64, 64, 64,
- 64, 64, 64, 64, 64, 64, 63, 63, 63, 62, 62, 62, 61, 61, 60, 60,
- 59, 59, 58, 57, 56, 56, 55, 54, 53, 52, 51, 50, 49, 48, 47, 46,
- 45, 44, 43, 42, 41, 39, 38, 37, 36, 34, 33, 32, 30, 29, 27, 26,
- 24, 23, 22, 20, 19, 17, 16, 14, 12, 11, 9, 8, 6, 5, 3, 2,
- 0,- 2,- 3,- 5,- 6,- 8,- 9,-11,-12,-14,-16,-17,-19,-20,-22,-23,
- -24,-26,-27,-29,-30,-32,-33,-34,-36,-37,-38,-39,-41,-42,-43,-44,
- -45,-46,-47,-48,-49,-50,-51,-52,-53,-54,-55,-56,-56,-57,-58,-59,
- -59,-60,-60,-61,-61,-62,-62,-62,-63,-63,-63,-64,-64,-64,-64,-64,
- -64,-64,-64,-64,-64,-64,-63,-63,-63,-62,-62,-62,-61,-61,-60,-60,
- -59,-59,-58,-57,-56,-56,-55,-54,-53,-52,-51,-50,-49,-48,-47,-46,
- -45,-44,-43,-42,-41,-39,-38,-37,-36,-34,-33,-32,-30,-29,-27,-26,
- -24,-23,-22,-20,-19,-17,-16,-14,-12,-11,- 9,- 8,- 6,- 5,- 3,- 2
-};
-
-
-
-
-
-
-int32_t CPPlayer::get_period(uint16_t p_note,int32_t p_c5speed) {
-
- if (song->has_linear_slides()) {
-
- return CPTables::get_linear_period(p_note,0);
- } else {
-
-
- return CPTables::get_log_period(p_note>>1,p_c5speed >>1);
- }
-}
-
-
-int32_t CPPlayer::get_frequency(int32_t period) {
-
- if (song->has_linear_slides()) {
-
- return CPTables::get_linear_frequency(period);
- } else {
-
- return CPTables::get_old_frequency(period);
- }
-}
-
-int CPPlayer::find_empty_voice() {
-
- int i;
- int min_priority,min_priority_chan=0,priority;
-
- for (i=0;i<control.max_voices;i++) {
-
- if ( ((voice[i].kick==KICK_NOTHING)||(voice[i].kick==KICK_ENVELOPE))&&!mixer->is_voice_active(i) ) {
-
- return i;
-
- }
- }
-
- // todo more
-
- for (i=0;i<control.max_voices;i++) {
- /* allow us to take over a nonexisting sample */
-// if ((voice[i].s==NULL)
-// return k;
-
- if ((voice[i].kick==KICK_NOTHING)||(voice[i].kick==KICK_ENVELOPE)) {
-
- priority=voice[i].total_volume<<((CPSampleManager::get_singleton()->get_loop_type( voice[i].sample_ptr->get_sample_data())!=CP_LOOP_NONE)?1:0);
-
- if ((voice[i].has_master_channel)&&(&voice[i]==voice[i].master_channel->slave_voice)) {
-
- priority<<=2;
-
- }
-
- if ((i==0) || (priority<min_priority)) {
- min_priority=priority;
- min_priority_chan=i;
- }
- }
- }
-
- if (min_priority>8000*7) return -1; /* what the fuck is this? */
-
- return min_priority_chan;
-}
-
diff --git a/modules/chibi/cp_sample.cpp b/modules/chibi/cp_sample.cpp
deleted file mode 100644
index 55c2c910a5..0000000000
--- a/modules/chibi/cp_sample.cpp
+++ /dev/null
@@ -1,203 +0,0 @@
-/*************************************************************************/
-/* cp_sample.cpp */
-/*************************************************************************/
-/* This file is part of: */
-/* GODOT ENGINE */
-/* http://www.godotengine.org */
-/*************************************************************************/
-/* Copyright (c) 2007-2016 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 "cp_sample.h"
-
-const char * CPSample::get_name() const {
-
- return name;
-}
-void CPSample::set_name(const char *p_name) {
-
- if (p_name==NULL) {
- name[0]=0;
- return;
- }
-
-
- bool done=false;
- for (int i=0;i<NAME_MAX_LEN;i++) {
-
-
- name[i]=done?0:p_name[i];
- if (!done && p_name[i]==0)
- done=true;
- }
-
- name[NAME_MAX_LEN-1]=0; /* just in case */
-
-}
-
-void CPSample::set_default_volume(uint8_t p_vol) {
-
- default_volume=p_vol;
-}
-uint8_t CPSample::get_default_volume() const{
-
- return default_volume;
-}
-
-void CPSample::set_global_volume(uint8_t p_vol) {
-
- global_volume=p_vol;
-}
-uint8_t CPSample::get_global_volume() const{
-
- return global_volume;
-}
-
-void CPSample::set_pan_enabled(bool p_vol) {
-
- pan_enabled=p_vol;
-}
-bool CPSample::is_pan_enabled() const{
-
- return pan_enabled;
-}
-
-void CPSample::set_pan(uint8_t p_pan) {
-
- pan=p_pan;
-
-}
-uint8_t CPSample::get_pan() const{
-
- return pan;
-}
-
-
-void CPSample::set_vibrato_type(VibratoType p_vibrato_type) {
-
- vibrato_type=p_vibrato_type;
-}
-CPSample::VibratoType CPSample::get_vibrato_type() const{
-
- return vibrato_type;
-}
-
-void CPSample::set_vibrato_speed(uint8_t p_vibrato_speed) {
-
- vibrato_speed=p_vibrato_speed;
-}
-uint8_t CPSample::get_vibrato_speed() const {
-
- return vibrato_speed;
-}
-
-void CPSample::set_vibrato_depth(uint8_t p_vibrato_depth) {
-
- vibrato_depth=p_vibrato_depth;
-}
-uint8_t CPSample::get_vibrato_depth() const{
-
- return vibrato_depth;
-}
-
-void CPSample::set_vibrato_rate(uint8_t p_vibrato_rate) {
-
- vibrato_rate=p_vibrato_rate;
-}
-uint8_t CPSample::get_vibrato_rate() const{
-
- return vibrato_rate;
-}
-
-void CPSample::set_sample_data(CPSample_ID p_ID) {
-
- id=p_ID;
-}
-CPSample_ID CPSample::get_sample_data() const{
-
- return id;
-}
-
-void CPSample::operator=(const CPSample &p_sample) {
-
- copy_from(p_sample);
-}
-void CPSample::copy_from(const CPSample &p_sample) {
-
- reset();
- set_name(p_sample.get_name());
-
- default_volume=p_sample.default_volume;
- global_volume=p_sample.global_volume;
-
- pan_enabled=p_sample.pan_enabled;
- pan=p_sample.pan;
-
- vibrato_type=p_sample.vibrato_type;
- vibrato_speed=p_sample.vibrato_speed;
- vibrato_depth=p_sample.vibrato_depth;
- vibrato_rate=p_sample.vibrato_rate;
-
- if (CPSampleManager::get_singleton() && !p_sample.id.is_null())
- CPSampleManager::get_singleton()->copy_to( p_sample.id, id );
-}
-
-
-
-
-
-void CPSample::reset() {
-
-
- name[0]=0;
-
- default_volume=64;
- global_volume=64;
-
- pan_enabled=false;
- pan=32;
-
- vibrato_type=VIBRATO_SINE;
- vibrato_speed=0;
- vibrato_depth=0;
- vibrato_rate=0;
-
- if (!id.is_null() && CPSampleManager::get_singleton())
- CPSampleManager::get_singleton()->destroy( id );
-
- id=CPSample_ID();
-
-}
-
-CPSample::CPSample(const CPSample&p_from) {
-
- reset();
- copy_from(p_from);
-}
-CPSample::CPSample() {
-
- reset();
-}
-
-CPSample::~CPSample() {
-
- reset();
-}
diff --git a/modules/chibi/cp_sample.h b/modules/chibi/cp_sample.h
deleted file mode 100644
index 4b3d218106..0000000000
--- a/modules/chibi/cp_sample.h
+++ /dev/null
@@ -1,112 +0,0 @@
-/*************************************************************************/
-/* cp_sample.h */
-/*************************************************************************/
-/* This file is part of: */
-/* GODOT ENGINE */
-/* http://www.godotengine.org */
-/*************************************************************************/
-/* Copyright (c) 2007-2016 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 CPSAMPLE_H
-#define CPSAMPLE_H
-
-
-#include "cp_config.h"
-#include "cp_sample_manager.h"
-class CPSample {
-
-public:
- enum VibratoType {
- VIBRATO_SINE,
- VIBRATO_SAW,
- VIBRATO_SQUARE,
- VIBRATO_RANDOM
-
- };
-
-private:
-
- enum { NAME_MAX_LEN=26 };
-
- char name[NAME_MAX_LEN];
-
- uint8_t default_volume; /* 0.. 64 */
- uint8_t global_volume; /* 0.. 64 */
-
- bool pan_enabled;
- uint8_t pan; /* 0.. 64 */
-
- VibratoType vibrato_type;
- uint8_t vibrato_speed; /* 0.. 64 */
- uint8_t vibrato_depth; /* 0.. 64 */
- uint8_t vibrato_rate; /* 0.. 64 */
-
- CPSample_ID id;
-
- void copy_from(const CPSample &p_sample);
-public:
-
-
- void operator=(const CPSample &p_sample);
-
- const char * get_name() const;
- void set_name(const char *p_name);
-
- void set_default_volume(uint8_t p_vol);
- uint8_t get_default_volume() const;
-
- void set_global_volume(uint8_t p_vol);
- uint8_t get_global_volume() const;
-
- void set_pan_enabled(bool p_vol);
- bool is_pan_enabled() const;
-
- void set_pan(uint8_t p_pan);
- uint8_t get_pan() const;
-
- void set_vibrato_type(VibratoType p_vibrato_type);
- VibratoType get_vibrato_type() const;
-
- void set_vibrato_speed(uint8_t p_vibrato_speed) ;
- uint8_t get_vibrato_speed() const;
-
- void set_vibrato_depth(uint8_t p_vibrato_depth);
- uint8_t get_vibrato_depth() const;
-
- void set_vibrato_rate(uint8_t p_vibrato_rate);
- uint8_t get_vibrato_rate() const;
-
- void set_sample_data(CPSample_ID);
- CPSample_ID get_sample_data() const;
-
- void reset();
-
- CPSample(const CPSample&p_from);
- CPSample();
- ~CPSample();
-
-};
-
-
-
-
-#endif
diff --git a/modules/chibi/cp_sample_defs.h b/modules/chibi/cp_sample_defs.h
deleted file mode 100644
index 169963c98e..0000000000
--- a/modules/chibi/cp_sample_defs.h
+++ /dev/null
@@ -1,97 +0,0 @@
-/*************************************************************************/
-/* cp_sample_defs.h */
-/*************************************************************************/
-/* This file is part of: */
-/* GODOT ENGINE */
-/* http://www.godotengine.org */
-/*************************************************************************/
-/* Copyright (c) 2007-2016 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 CP_SAMPLE_DEFS_H
-#define CP_SAMPLE_DEFS_H
-
-#include "cp_config.h"
-
-enum CPSample_Loop_Type {
-
- CP_LOOP_NONE,
- CP_LOOP_FORWARD,
- CP_LOOP_BIDI
-};
-
-//#define INVALID_SAMPLE_ID -1
-
-#define CP_MIXING_FRAC_BITS_MACRO 13
-#define CP_MIXING_FRAC_BITS_TEXT "13"
-// 1<<9 - 1
-#define CP_MIXING_FRAC_BITS_MASK_TEXT "8191"
-
-enum CPMixConstants {
- CP_MIXING_FRAC_BITS=CP_MIXING_FRAC_BITS_MACRO,
- CP_MIXING_FRAC_LENGTH=(1<<CP_MIXING_FRAC_BITS),
- CP_MIXING_FRAC_MASK=CP_MIXING_FRAC_LENGTH-1,
- CP_MIXING_VOL_FRAC_BITS=8,
- CP_MIXING_FREQ_FRAC_BITS=8
-};
-
-enum CPFilterConstants {
- CP_FILTER_SHIFT=16,
- CP_FILTER_LENGTH=(1<<CP_FILTER_SHIFT)
-};
-
-
-enum CPInterpolationType {
- CP_INTERPOLATION_RAW,
- CP_INTERPOLATION_LINEAR,
- CP_INTERPOLATION_CUBIC
-};
-
-enum CPPanConstants {
-
- CP_PAN_BITS=8, // 0 .. 256
- CP_PAN_LEFT=0,
- CP_PAN_RIGHT=((1<<CP_PAN_BITS)-1), // 255
- CP_PAN_CENTER=CP_PAN_RIGHT/2, // 128
- CP_PAN_SURROUND=512
-};
-
-enum CPMixerVolConstants {
- CP_VOL_MAX=512,
- CP_VOL_RAMP_BITS=9,
- CP_VOL_SHIFT=2
-
-
-};
-
-enum CPStereoCannels {
- CP_CHAN_LEFT,
- CP_CHAN_RIGHT
-};
-
-#define CP_FIRST_SAMPLE_DECLICK_THRESHOLD 1000
-#define CP_FIRST_SAMPLE_RAMP_LEN 32
-
-typedef signed char CPFrame8;
-typedef signed short CPFrame16;
-
-
-#endif
diff --git a/modules/chibi/cp_sample_manager.cpp b/modules/chibi/cp_sample_manager.cpp
deleted file mode 100644
index 5c2988e3f9..0000000000
--- a/modules/chibi/cp_sample_manager.cpp
+++ /dev/null
@@ -1,78 +0,0 @@
-/*************************************************************************/
-/* cp_sample_manager.cpp */
-/*************************************************************************/
-/* This file is part of: */
-/* GODOT ENGINE */
-/* http://www.godotengine.org */
-/*************************************************************************/
-/* Copyright (c) 2007-2016 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 "cp_sample_manager.h"
-
-
-CPSampleManager * CPSampleManager::singleton=NULL;
-
-
-void CPSampleManager::copy_to(CPSample_ID p_from,CPSample_ID &p_to) {
-
- ERR_FAIL_COND(!check( p_from ));
-
-
- if (p_to.is_null()) {
-
- p_to=create( is_16bits( p_from), is_stereo( p_from), get_size(p_from));
- } else {
-
- recreate( p_to, is_16bits( p_from), is_stereo( p_from), get_size(p_from));
-
- }
-
- int len=get_size( p_from );
- int ch=is_stereo( p_from ) ? 2 : 1;
-
- for (int c=0;c<ch;c++) {
-
- for (int i=0;i<len;i++) {
-
- int16_t s=get_data( p_from, i, c );
- set_data( p_to, i, s, c );
- }
- }
-
- set_loop_type( p_to, get_loop_type( p_from ) );
- set_loop_begin( p_to, get_loop_begin( p_from ) );
- set_loop_end( p_to, get_loop_end( p_from ) );
- set_c5_freq( p_to, get_c5_freq( p_from ) );
-
-
-
-}
-
-CPSampleManager::CPSampleManager() {
-
- singleton=this;
-}
-
-CPSampleManager *CPSampleManager::get_singleton() {
-
- return singleton;
-}
diff --git a/modules/chibi/cp_sample_manager.h b/modules/chibi/cp_sample_manager.h
deleted file mode 100644
index 74bcafc0cf..0000000000
--- a/modules/chibi/cp_sample_manager.h
+++ /dev/null
@@ -1,99 +0,0 @@
-/*************************************************************************/
-/* cp_sample_manager.h */
-/*************************************************************************/
-/* This file is part of: */
-/* GODOT ENGINE */
-/* http://www.godotengine.org */
-/*************************************************************************/
-/* Copyright (c) 2007-2016 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 CP_SAMPLE_MANAGER_H
-#define CP_SAMPLE_MANAGER_H
-
-#include "cp_config.h"
-#include "cp_sample_defs.h"
-
-
-
-/**
-@author Juan Linietsky
-*/
-
-
-/* abstract base CPSample_ID class */
-
-struct CPSample_ID {
-
- void *_private;
-
- bool operator==(const CPSample_ID&p_other) const { return _private==p_other._private; }
- bool operator!=(const CPSample_ID&p_other) const { return _private!=p_other._private; }
- bool is_null() const { return _private==0; }
- CPSample_ID(void *p_private=0) { _private=p_private; };
-};
-
-
-class CPSampleManager {
-
- static CPSampleManager * singleton;
-
-public:
-
- /* get the singleton instance */
- static CPSampleManager *get_singleton();
-
- virtual void copy_to(CPSample_ID p_from,CPSample_ID &p_to); ///< if p_to is null, it gets created
-
- virtual CPSample_ID create(bool p_16bits,bool p_stereo,int32_t p_len)=0;
- virtual void recreate(CPSample_ID p_id,bool p_16bits,bool p_stereo,int32_t p_len)=0;
- virtual void destroy(CPSample_ID p_id)=0;
- virtual bool check(CPSample_ID p_id)=0; // return false if invalid
-
- virtual void set_c5_freq(CPSample_ID p_id,int32_t p_freq)=0;
- virtual void set_loop_begin(CPSample_ID p_id,int32_t p_begin)=0;
- virtual void set_loop_end(CPSample_ID p_id,int32_t p_end)=0;
- virtual void set_loop_type(CPSample_ID p_id,CPSample_Loop_Type p_type)=0;
- virtual void set_chunk(CPSample_ID p_id,int32_t p_index,void *p_data,int p_data_len)=0;
-
-
- virtual int32_t get_loop_begin(CPSample_ID p_id)=0;
- virtual int32_t get_loop_end(CPSample_ID p_id)=0;
- virtual CPSample_Loop_Type get_loop_type(CPSample_ID p_id)=0;
- virtual int32_t get_c5_freq(CPSample_ID p_id)=0;
- virtual int32_t get_size(CPSample_ID p_id)=0;
- virtual bool is_16bits(CPSample_ID p_id)=0;
- virtual bool is_stereo(CPSample_ID p_id)=0;
- virtual bool lock_data(CPSample_ID p_id)=0;
- virtual void *get_data(CPSample_ID p_id)=0; /* WARNING: Not all sample managers
-may be able to implement this, it depends on the mixer in use! */
- virtual int16_t get_data(CPSample_ID p_id, int p_sample, int p_channel=0)=0; /// Does not need locking
- virtual void set_data(CPSample_ID p_id, int p_sample, int16_t p_data,int p_channel=0)=0; /// Does not need locking
- virtual void unlock_data(CPSample_ID p_id)=0;
-
- virtual void get_chunk(CPSample_ID p_id,int32_t p_index,void *p_data,int p_data_len)=0;
-
- CPSampleManager();
- virtual ~CPSampleManager(){}
-
-};
-
-#endif
diff --git a/modules/chibi/cp_song.cpp b/modules/chibi/cp_song.cpp
deleted file mode 100644
index 4aa1a4228d..0000000000
--- a/modules/chibi/cp_song.cpp
+++ /dev/null
@@ -1,957 +0,0 @@
-/*************************************************************************/
-/* cp_song.cpp */
-/*************************************************************************/
-/* This file is part of: */
-/* GODOT ENGINE */
-/* http://www.godotengine.org */
-/*************************************************************************/
-/* Copyright (c) 2007-2016 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 "cp_song.h"
-
-void CPSong::set_name(const char *p_name) {
-
- if (p_name==NULL) {
- variables.name[0]=0;
- return;
- }
-
-
- bool done=false;
- for (int i=0;i<MAX_SONG_NAME;i++) {
-
-
- variables.name[i]=done?0:p_name[i];
- if (!done && p_name[i]==0)
- done=true;
- }
-
- variables.name[MAX_SONG_NAME-1]=0; /* just in case */
-}
-
-const char * CPSong::get_name() {
-
- return variables.name;
-
-}
-
-void CPSong::set_message(const char *p_message) {
-
- if (p_message==NULL) {
- variables.message[0]=0;
- return;
- }
-
- bool done=false;
- for (int i=0;i<MAX_MESSAGE_LEN;i++) {
-
-
- variables.message[i]=done?0:p_message[i];
- if (!done && p_message[i]==0)
- done=true;
- }
-
- variables.message[MAX_MESSAGE_LEN-1]=0; /* just in case */
-}
-
-const char * CPSong::get_message() {
-
- return variables.message;
-
-}
-
-void CPSong::set_row_highlight_minor(int p_hl_minor) {
-
- variables.row_highlight_minor=p_hl_minor;
-}
-int CPSong::get_row_highlight_minor() {
-
- return variables.row_highlight_minor;
-}
-
-void CPSong::set_row_highlight_major(int p_hl_major) {
-
- variables.row_highlight_major=p_hl_major;
-
-
-} /* 0 .. 256 */
-int CPSong::get_row_highlight_major() {
-
- return variables.row_highlight_major;
-
-
-} /* 0 .. 256 */
-
-void CPSong::set_mixing_volume(int p_mix_volume) {
-
-
- variables.mixing_volume=p_mix_volume;
-} /* 0 .. 128 */
-int CPSong::get_mixing_volume() {
-
- return variables.mixing_volume;
-
-} /* 0 .. 128 */
-
-void CPSong::set_global_volume(int p_global_volume) {
-
-
- initial_variables.global_volume=p_global_volume;
-
-} /* 0 .. 128 */
-int CPSong::get_global_volume() {
-
- return initial_variables.global_volume;
-
-} /* 0 .. 128 */
-
-void CPSong::set_stereo_separation(int p_separation) {
-
- variables.stereo_separation=p_separation;
-
-} /* 0 .. 128 */
-int CPSong::get_stereo_separation() {
-
- return variables.stereo_separation;
-} /* 0 .. 128 */
-
-void CPSong::set_stereo(bool p_stereo) {
-
- variables.use_stereo=p_stereo;
-
-}
-bool CPSong::is_stereo() {
-
- return variables.use_stereo;
-}
-
-void CPSong::set_instruments(bool p_instruments) {
-
- variables.use_instruments=p_instruments;
-
-
-}
-bool CPSong::has_instruments() {
-
-
- return variables.use_instruments;
-
-}
-
-void CPSong::set_linear_slides(bool p_linear_slides) {
-
- variables.use_linear_slides=p_linear_slides;
-
-
-}
-bool CPSong::has_linear_slides() {
-
- return variables.use_linear_slides;
-
-
-}
-
-void CPSong::set_old_effects(bool p_old_effects) {
-
- variables.old_effects=p_old_effects;
-
-
-}
-bool CPSong::has_old_effects() {
-
- return variables.old_effects;
-}
-
-void CPSong::set_compatible_gxx(bool p_compatible_gxx) {
-
-
- variables.compatible_gxx=p_compatible_gxx;
-}
-bool CPSong::has_compatible_gxx() {
-
- return variables.compatible_gxx;
-
-}
-
-void CPSong::set_speed(int p_speed) {
-
- CP_ERR_COND(p_speed<MIN_SPEED);
- CP_ERR_COND(p_speed>MAX_SPEED);
-
- initial_variables.speed=p_speed;
-
-} /* 1 .. 255 */
-int CPSong::get_speed() {
-
- return initial_variables.speed;
-
-} /* 1 .. 255 */
-
-void CPSong::set_tempo(int p_tempo) {
-
- CP_ERR_COND( p_tempo<MIN_TEMPO );
- CP_ERR_COND( p_tempo>MAX_TEMPO );
-
- initial_variables.tempo=p_tempo;
-
-} /* MIN_TEMPO .. MAX_TEMPO */
-int CPSong::get_tempo() {
-
- return initial_variables.tempo;
-
-
-} /* MIN_TEMPO .. MAX_TEMPO */
-
-void CPSong::set_channel_pan(int p_channel,int p_pan) {
-
- CP_FAIL_INDEX(p_channel,CPPattern::WIDTH);
- CP_FAIL_INDEX(p_pan,CHANNEL_MAX_PAN+1);
-
- initial_variables.channel[p_channel].pan=p_pan;
-
-} /* 0 .. CHANNEL_MAX_PAN */
-int CPSong::get_channel_pan(int p_channel) {
-
- CP_FAIL_INDEX_V(p_channel,CPPattern::WIDTH,-1);
-
- return initial_variables.channel[p_channel].pan;
-}
-
-void CPSong::set_channel_volume(int p_channel,int p_volume) {
-
- CP_FAIL_INDEX(p_channel,CPPattern::WIDTH);
- CP_FAIL_INDEX(p_volume,CHANNEL_MAX_VOLUME+1);
-
-
- initial_variables.channel[p_channel].volume=p_volume;
-
-
-} /* 0 .. CHANNEL_MAX_VOLUME */
-
-
-int CPSong::get_channel_volume(int p_channel) {
-
- CP_FAIL_INDEX_V(p_channel,CPPattern::WIDTH,-1);
-
- return initial_variables.channel[p_channel].volume;
-
-}
-
-void CPSong::set_channel_chorus(int p_channel,int p_chorus) {
-
- CP_FAIL_INDEX(p_channel,CPPattern::WIDTH);
- CP_FAIL_INDEX(p_chorus,CHANNEL_MAX_CHORUS+1);
-
-
- initial_variables.channel[p_channel].chorus=p_chorus;
-
-
-} /* 0 .. CHANNEL_MAX_CHORUS */
-
-
-int CPSong::get_channel_chorus(int p_channel) {
-
- CP_FAIL_INDEX_V(p_channel,CPPattern::WIDTH,-1);
-
- return initial_variables.channel[p_channel].chorus;
-
-}
-
-void CPSong::set_channel_reverb(int p_channel,int p_reverb) {
-
- CP_FAIL_INDEX(p_channel,CPPattern::WIDTH);
- CP_FAIL_INDEX(p_reverb,CHANNEL_MAX_REVERB+1);
-
-
- initial_variables.channel[p_channel].reverb=p_reverb;
-
-
-} /* 0 .. CHANNEL_MAX_CHORUS */
-
-
-int CPSong::get_channel_reverb(int p_channel) {
-
- CP_FAIL_INDEX_V(p_channel,CPPattern::WIDTH,-1);
-
- return initial_variables.channel[p_channel].reverb;
-
-}
-
-void CPSong::set_channel_surround(int p_channel,bool p_surround) {
-
- CP_FAIL_INDEX(p_channel,CPPattern::WIDTH);
- initial_variables.channel[p_channel].surround=p_surround;
-
-}
-bool CPSong::is_channel_surround(int p_channel) {
-
- CP_FAIL_INDEX_V(p_channel,CPPattern::WIDTH,false);
-
- return initial_variables.channel[p_channel].surround;
-
-
-}
-
-void CPSong::set_channel_mute(int p_channel,bool p_mute) {
-
- CP_FAIL_INDEX(p_channel,CPPattern::WIDTH);
-
- initial_variables.channel[p_channel].mute=p_mute;
-
-}
-bool CPSong::is_channel_mute(int p_channel) {
-
- CP_FAIL_INDEX_V(p_channel,CPPattern::WIDTH,false);
-
- return initial_variables.channel[p_channel].mute;
-
-}
-
-/* arrays of stuff */
-
-CPPattern* CPSong::get_pattern(int p_pattern) {
-
- CP_FAIL_INDEX_V(p_pattern,MAX_PATTERNS, NULL);
-
- return &pattern[p_pattern];
-
-}
-CPSample* CPSong::get_sample(int p_sample) {
-
- CP_FAIL_INDEX_V(p_sample,MAX_SAMPLES,NULL);
-
- return &sample[p_sample];
-
-
-}
-CPInstrument* CPSong::get_instrument(int p_instrument) {
-
-
- CP_FAIL_INDEX_V(p_instrument,MAX_INSTRUMENTS,NULL);
-
- return &instrument[p_instrument];
-
-}
-
-int CPSong::get_order(int p_order) {
-
- CP_FAIL_INDEX_V(p_order,MAX_ORDERS,CP_ORDER_NONE);
-
-
- return order[p_order];
-
-}
-void CPSong::set_order(int p_order,int p_pattern) {
-
- CP_FAIL_INDEX(p_order,MAX_ORDERS);
-
- order[p_order]=p_pattern;
-
-}
-
-
-void CPSong::clear_instrument_with_samples(int p_instrument) {
-
- CPInstrument *ins = get_instrument( p_instrument );
- if (!ins)
- return;
-
- for (int i=0;i<CPNote::NOTES;i++) {
-
- CPSample *s=get_sample( ins->get_sample_number( i ) );
-
- if (!s)
- continue;
-
- if (s->get_sample_data().is_null())
- continue;
-
- s->reset();
- }
- ins->reset();
-}
-
-void CPSong::make_instrument_from_sample(int p_sample) {
-
- if (!has_instruments())
- return;
- CP_ERR_COND(!get_sample( p_sample ));
-
- for (int i=0;i<MAX_INSTRUMENTS;i++) {
-
-
- CPInstrument *ins=get_instrument(i);
-
- bool empty_slot=true;
- for (int n=0;n<CPNote::NOTES;n++) {
-
- if (ins->get_sample_number(n)<MAX_SAMPLES) {
-
- empty_slot=false;
- break;
- }
- }
-
- if (!empty_slot)
- continue;
-
- for (int n=0;n<CPNote::NOTES;n++) {
-
- ins->set_sample_number(n,p_sample);
- ins->set_note_number(n,n);
- }
-
- ins->set_name( get_sample( p_sample )->get_name() );
- break;
- }
-
-}
-
-void CPSong::make_instruments_from_samples() {
-
- for (int i=0;i<MAX_SAMPLES;i++) {
-
- CPInstrument *ins=get_instrument( i );
-
- if (!ins)
- continue;
-
- ins->reset();
-
- CPSample *s=get_sample( i );
-
- if (!s)
- continue;
-
- ins->set_name( s->get_name() );
-
- if (s->get_sample_data().is_null())
- continue;
-
-
-
-
- for(int j=0;j<CPNote::NOTES;j++)
- ins->set_sample_number( j, i );
-
-
-
- }
-}
-
-void CPSong::reset(bool p_clear_patterns,bool p_clear_samples,bool p_clear_instruments,bool p_clear_variables) {
-
- if (p_clear_variables) {
- variables.name[0]=0;
- variables.message[0]=0;
- variables.row_highlight_major=16;
- variables.row_highlight_minor=4;
- variables.mixing_volume=48;
- variables.old_effects=false;
- if (p_clear_instruments) //should not be cleared, if not clearing instruments!!
- variables.use_instruments=false;
- variables.stereo_separation=128;
- variables.use_linear_slides=true;
- variables.use_stereo=true;
-
- initial_variables.global_volume=128;
- initial_variables.speed=6;
- initial_variables.tempo=125;
-
- for (int i=0;i<CPPattern::WIDTH;i++) {
-
- initial_variables.channel[i].pan=32;
- initial_variables.channel[i].volume=CHANNEL_MAX_VOLUME;
- initial_variables.channel[i].mute=false;
- initial_variables.channel[i].surround=false;
- initial_variables.channel[i].chorus=0;
- initial_variables.channel[i].reverb=0;
-
- }
-
- effects.chorus.delay_ms=6;
- effects.chorus.separation_ms=3;
- effects.chorus.depth_ms10=6,
- effects.chorus.speed_hz10=5;
- effects.reverb_mode=REVERB_MODE_ROOM;
- }
-
- if (p_clear_samples) {
- for (int i=0;i<MAX_SAMPLES;i++)
- get_sample(i)->reset();
- }
-
- if (p_clear_instruments) {
- for (int i=0;i<MAX_INSTRUMENTS;i++)
- get_instrument(i)->reset();
- }
-
- if (p_clear_patterns) {
- for (int i=0;i<MAX_PATTERNS;i++)
- get_pattern(i)->clear();
-
- for (int i=0;i<MAX_ORDERS;i++)
- set_order( i, CP_ORDER_NONE );
- }
-
-
-}
-
-
-CPSong::ReverbMode CPSong::get_reverb_mode() {
-
- return effects.reverb_mode;
-}
-void CPSong::set_reverb_mode(ReverbMode p_mode) {
-
- effects.reverb_mode=p_mode;
-}
-
-void CPSong::set_chorus_delay_ms(int p_amount) {
-
- effects.chorus.delay_ms=p_amount;
-}
-void CPSong::set_chorus_separation_ms(int p_amount) {
-
- effects.chorus.separation_ms=p_amount;
-
-}
-void CPSong::set_chorus_depth_ms10(int p_amount) {
-
- effects.chorus.depth_ms10=p_amount;
-
-}
-void CPSong::set_chorus_speed_hz10(int p_amount) {
-
- effects.chorus.speed_hz10=p_amount;
-
-}
-
-int CPSong::get_chorus_delay_ms() {
-
- return effects.chorus.delay_ms;
-
-}
-int CPSong::get_chorus_separation_ms() {
-
- return effects.chorus.separation_ms;
-}
-int CPSong::get_chorus_depth_ms10() {
-
- return effects.chorus.depth_ms10;
-
-}
-int CPSong::get_chorus_speed_hz10() {
-
- return effects.chorus.speed_hz10;
-
-}
-
-void CPSong::cleanup_unused_patterns() {
-
- for (int i=0;i<MAX_PATTERNS;i++) {
-
- bool used=false;
- if (get_pattern(i)->is_empty())
- continue;
-
- for (int j=0;j<MAX_ORDERS;j++) {
-
- if (get_order(j)==i) {
- used=true;
-
- }
- }
-
- if (!used)
- get_pattern(i)->clear();
- }
-
-}
-void CPSong::cleanup_unused_instruments(){
-
- if (!has_instruments())
- return;
-
- bool instr_found[MAX_INSTRUMENTS];
- for (int i=0;i<MAX_INSTRUMENTS;i++)
- instr_found[i]=false;
-
- for (int i=0;i<MAX_PATTERNS;i++) {
-
- if (get_pattern(i)->is_empty())
- continue;
-
- for (int row=0;row<get_pattern(i)->get_length();row++) {
-
-
- for (int col=0;col<CPPattern::WIDTH;col++) {
-
- CPNote n;
- n=get_pattern(i)->get_note( col,row );
-
- if (n.instrument<MAX_INSTRUMENTS)
- instr_found[n.instrument]=true;
-
- }
-
- }
-
- }
-
- for (int i=0;i<MAX_INSTRUMENTS;i++)
- if (!instr_found[i])
- get_instrument(i)->reset();
-
-
-}
-void CPSong::cleanup_unused_samples(){
-
- if (!has_instruments())
- return;
-
- bool sample_found[MAX_SAMPLES];
- for (int i=0;i<MAX_INSTRUMENTS;i++)
- sample_found[i]=false;
-
- for (int i=0;i<MAX_PATTERNS;i++) {
-
- if (get_pattern(i)->is_empty())
- continue;
-
-
- for (int row=0;row<get_pattern(i)->get_length();row++) {
-
-
- for (int col=0;col<CPPattern::WIDTH;col++) {
-
- CPNote n;
- n=get_pattern(i)->get_note( col,row );
-
- if (n.instrument>=MAX_SAMPLES)
- continue;
-
- if (has_instruments()) {
-
- for (int nt=0;nt<CPNote::NOTES;nt++) {
-
- int smp=get_instrument(n.instrument)->get_sample_number(nt);
- if (smp<MAX_SAMPLES)
- sample_found[smp]=true;
- }
-
- } else {
- if (n.instrument<MAX_SAMPLES)
- sample_found[n.instrument]=true;
- }
-
- }
-
- }
-
- }
-
- for (int i=0;i<MAX_SAMPLES;i++)
- if (!sample_found[i])
- get_sample(i)->reset();
-
-}
-void CPSong::cleanup_unused_orders(){
-
- bool finito=false;
- for (int j=0;j<MAX_ORDERS;j++) {
-
-
- if (get_order(j)==CP_ORDER_NONE)
- finito=true;
- if (finito)
- set_order(j,CP_ORDER_NONE);
-
- }
-
-}
-
-void CPSong::clear_all_default_pan() {
-
- for (int i=0;i<MAX_INSTRUMENTS;i++)
- get_instrument(i)->set_pan_default_enabled( false ); //die!
-
- for (int i=0;i<MAX_SAMPLES;i++)
- get_sample(i)->set_pan_enabled( false ); //die!
-
-}
-
-
-void CPSong::clear_all_default_vol(){
-
- for (int i=0;i<MAX_SAMPLES;i++)
- get_sample(i)->set_default_volume( 64 ); //die!
- for (int i=0;i<MAX_INSTRUMENTS;i++)
- get_instrument(i)->set_volume_global_amount( CPInstrument::MAX_VOLUME );
-
-}
-
-
-int CPSong::get_order_in_use_count() {
-
-
- int order_count = 0;
-
- for (int i=(MAX_ORDERS-1);i>=0;i--) {
-
-
- if (get_order(i)!=CP_ORDER_NONE) {
- order_count=i+1;
- break;
- }
- }
-
- return order_count;
-}
-int CPSong::get_pattern_in_use_count() {
-
-
- int pattern_count=0;
-
- for (int i=(CPSong::MAX_PATTERNS-1);i>=0;i--) {
-
-
- if (!get_pattern(i)->is_empty()) {
- pattern_count=i+1;
- break;
- }
- }
-
- return pattern_count;
-}
-
-int CPSong::get_instrument_in_use_count() {
-
- int instrument_count=0;
-
- for (int i=(CPSong::MAX_INSTRUMENTS-1);i>=0;i--) {
-
- CPInstrument *ins = get_instrument(i);
- bool in_use=false;
-
- for (int s = 0 ; s < CPNote::NOTES ; s++ ) {
-
- int smp_idx = ins->get_sample_number(s);
- if (smp_idx<0 || smp_idx>=CPSong::MAX_SAMPLES)
- continue;
-
- if (!get_sample(smp_idx)->get_sample_data().is_null()) {
- in_use=true;
- break;
- }
-
- }
-
- if (in_use) {
- instrument_count=i+1;
- break;
- }
- }
-
- return instrument_count;
-}
-#include <stdio.h>
-int CPSong::get_channels_in_use() {
-
- int max=0;
-
- for (int p=0;p<CPSong::MAX_PATTERNS;p++) {
-
- CPPattern *pat = get_pattern(p);
- if (pat->is_empty())
- continue;
-
-
- for (int c=(CPPattern::WIDTH-1);c>=0;c--) {
-
- if (c<max)
- break;
-
- bool has_note=false;
- for (int r=0;r<pat->get_length();r++) {
-
- CPNote n = pat->get_note( c, r );
- if (!n.is_empty()) {
- has_note=true;
- break;
- }
- }
-
- if (has_note) {
-
- max=c+1;
- }
- }
- }
-
- return max;
-}
-
-
-void CPSong::separate_in_one_sample_instruments(int p_instrument) {
-
- CP_ERR_COND( !variables.use_instruments );
- CP_FAIL_INDEX( p_instrument, MAX_INSTRUMENTS );
-
- int remapped_count=0;
-
- signed char remap[MAX_SAMPLES];
-
- for (int i=0;i<MAX_SAMPLES;i++) {
-
- remap[i]=-1;
- }
-
- /* Find remaps */
- CPInstrument *ins=get_instrument(p_instrument);
- for (int i=0;i<CPNote::NOTES;i++) {
-
- int sn = ins->get_sample_number(i);
-
- // check for unusable sample
- if (sn<0 || sn>=MAX_SAMPLES || get_sample(sn)->get_sample_data().is_null())
- continue;
- printf("sample %i\n",sn);
- if ( remap[sn] !=-1 ) {
- printf("already mapped to %i\n",remap[sn]);
- continue;
- }
-
- printf("isn't remapped\n");
-
- // find remap
-
- for (int j=0;j<MAX_INSTRUMENTS;j++) {
-
- if (!get_instrument(j)->is_empty())
- continue;
-
- printf("map to %i\n",j);
-
- //copy
- *get_instrument(j)=*ins;
-
- // assign samples
- for (int k=0;k<CPNote::NOTES;k++) {
-
- get_instrument(j)->set_note_number(k,k);
- get_instrument(j)->set_sample_number(k,sn);
- }
- remap[sn]=j;
- remapped_count++;
- break;
- }
-
- CP_ERR_COND(remap[sn]==-1); // no more free instruments
- }
-
- printf("remapped %i\n",remapped_count);
-
- if (remapped_count<2) {
- //undo if only one is remapped
- for (int i=0;i<MAX_SAMPLES;i++) {
-
- if (remap[i]!=-1) {
-
- get_instrument(remap[i])->reset();
- }
- }
- return;
- }
-
- /* remap all song */
-
- for (int p=0;p<CPSong::MAX_PATTERNS;p++) {
-
- CPPattern *pat = get_pattern(p);
- if (pat->is_empty())
- continue;
-
-
- for (int c=0;c<CPPattern::WIDTH;c++) {
-
- for (int r=0;r<pat->get_length();r++) {
-
- CPNote n = pat->get_note(c,r);
- if (n.note<CPNote::NOTES && n.instrument==p_instrument) {
-
- int sn = ins->get_sample_number(n.note);
- if (remap[sn]==-1)
- pat->set_note(c,r,CPNote());
- else {
-
- n.instrument=remap[sn];
- pat->set_note(c,r,n);
- }
- }
- }
- }
- }
-
- ins->reset();
-
-}
-
-
-CPSong::CPSong() {
-
- reset();
-}
-CPSong::~CPSong() {
-
-}
-
-
-
-
-int get_song_next_order_idx(CPSong *p_song, int p_order_idx) {
-
- int baseorder,order_counter;
-
- order_counter=-1;
-
- baseorder=p_order_idx;
-
- do {
-
- baseorder++;
- if ( baseorder>(CPSong::MAX_ORDERS-1) ) baseorder=0;
- order_counter++;
-
- } while ( (p_song->get_order(baseorder)>=(CPSong::MAX_PATTERNS) ) && (order_counter<CPSong::MAX_ORDERS) );
-
-
- if (order_counter==CPSong::MAX_ORDERS) {
-
- return -1;
-
- } else {
-
- return baseorder;
- }
-
-}
diff --git a/modules/chibi/cp_song.h b/modules/chibi/cp_song.h
deleted file mode 100644
index da5d106a63..0000000000
--- a/modules/chibi/cp_song.h
+++ /dev/null
@@ -1,261 +0,0 @@
-/*************************************************************************/
-/* cp_song.h */
-/*************************************************************************/
-/* This file is part of: */
-/* GODOT ENGINE */
-/* http://www.godotengine.org */
-/*************************************************************************/
-/* Copyright (c) 2007-2016 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 CPSONG_H
-#define CPSONG_H
-
-
-/**CPSong Class
- *@author Juan Linietsky
- */
-
-#include "cp_order.h"
-#include "cp_pattern.h"
-#include "cp_sample.h"
-#include "cp_instrument.h"
-
-class CPSong {
-public:
- enum {
- MAX_SONG_NAME=26,
- MAX_ORDERS=200,
- MAX_PATTERNS=200,
- MAX_SAMPLES=99,
- MAX_INSTRUMENTS=99,
-
- CHANNEL_MAX_PAN=64,
- CHANNEL_MAX_VOLUME=64,
- CHANNEL_MAX_CHORUS=64,
- CHANNEL_MAX_REVERB=64,
-
- MIN_TEMPO=31,
- MAX_TEMPO=255,
- MIN_SPEED=1,
- MAX_SPEED=255,
- MAX_MESSAGE_LEN=8000,
-
-
-
- };
-
- enum ReverbMode {
- REVERB_MODE_ROOM,
- REVERB_MODE_STUDIO_SMALL,
- REVERB_MODE_STUDIO_MEDIUM,
- REVERB_MODE_STUDIO_LARGE,
- REVERB_MODE_HALL,
- REVERB_MODE_SPACE_ECHO,
- REVERB_MODE_ECHO,
- REVERB_MODE_DELAY,
- REVERB_MODE_HALF_ECHO
- };
-
-private:
- CPOrder order[MAX_ORDERS];
- CPPattern pattern[MAX_PATTERNS];
- CPSample sample[MAX_SAMPLES];
- CPInstrument instrument[MAX_INSTRUMENTS];
-
-
-
- struct Song_Variables { // variables that wont change in playback
-
- char name[MAX_SONG_NAME];
- char message[MAX_MESSAGE_LEN];
- /* string message; */
-
- int row_highlight_minor;
- int row_highlight_major;
-
- int mixing_volume;
- int stereo_separation;
-
- bool use_stereo;
- bool use_instruments;
- bool use_linear_slides;
-
- bool old_effects;
- bool compatible_gxx;
-
- } variables;
-
- struct Initial_Variables { // Initial values used for playback
-
- struct Channel_State {
-
- int pan,volume; // 0-- CHANNEL_MAX_PAN, CHANNEL_MAX_VOLUME
- bool surround;
- bool mute;
- int chorus; //0 - 64
- int reverb; //0 - 64
- };
-
- int global_volume;
- int speed;
- int tempo;
-
- Channel_State channel[CPPattern::WIDTH];
- } initial_variables;
-
- struct Effects {
-
- ReverbMode reverb_mode;
-
- struct Chorus {
-
- int delay_ms;
- int separation_ms;
- int depth_ms10;
- int speed_hz10;
- } chorus;
-
- } effects;
-
-public:
-
- /* Properties */
-
- const char *get_name();
- void set_name(const char *p_name);
-
- const char *get_message();
- void set_message(const char *p_message);
-
- void set_row_highlight_minor(int p_hl_minor); /* 0 .. 256 */
- int get_row_highlight_minor(); /* 0 .. 256 */
-
- void set_row_highlight_major(int p_hl_major); /* 0 .. 256 */
- int get_row_highlight_major(); /* 0 .. 256 */
-
- void set_mixing_volume(int p_mix_volume); /* 0 .. 128 */
- int get_mixing_volume(); /* 0 .. 128 */
-
- void set_global_volume(int p_global_volume); /* 0 .. 128 */
- int get_global_volume(); /* 0 .. 128 */
-
- void set_stereo_separation(int p_separation); /* 0 .. 128 */
- int get_stereo_separation(); /* 0 .. 128 */
-
- void set_stereo(bool p_stereo);
- bool is_stereo();
-
- void set_instruments(bool p_instruments);
- bool has_instruments();
-
- void set_linear_slides(bool p_linear_slides);
- bool has_linear_slides();
-
- void set_old_effects(bool p_old_effects);
- bool has_old_effects();
-
- void set_compatible_gxx(bool p_compatible_gxx);
- bool has_compatible_gxx();
-
- void set_speed(int p_speed); /* 1 .. 255 */
- int get_speed(); /* 1 .. 255 */
-
- void set_tempo(int p_tempo); /* 31 .. 255 */
- int get_tempo(); /* 31 .. 255 */
-
- void set_channel_pan(int p_channel,int p_pan); /* 0 .. 64 */
- int get_channel_pan(int p_channel);
-
- void set_channel_volume(int p_channel,int p_volume); /* 0 .. 64 */
- int get_channel_volume(int p_channel);
-
- void set_channel_surround(int p_channel,bool p_surround);
- bool is_channel_surround(int p_channel);
-
- void set_channel_mute(int p_channel,bool p_mute);
- bool is_channel_mute(int p_channel);
-
- void set_channel_chorus(int p_channel,int p_chorus); /* 0 .. 64 */
- int get_channel_chorus(int p_channel);
-
- void set_channel_reverb(int p_channel,int p_reverb); /* 0 .. 64 */
- int get_channel_reverb(int p_channel);
-
- /* arrays of stuff */
-
- CPPattern* get_pattern(int p_pattern);
- CPSample* get_sample(int p_sample);
- CPInstrument* get_instrument(int p_instrument);
-
- int get_order(int p_position);
- void set_order(int p_position,int p_order);
-
-
- /* Effects */
-
- ReverbMode get_reverb_mode();
- void set_reverb_mode(ReverbMode p_mode);
-
- void set_chorus_delay_ms(int p_amount);
- void set_chorus_separation_ms(int p_amount);
- void set_chorus_depth_ms10(int p_amount);
- void set_chorus_speed_hz10(int p_amount);
-
- int get_chorus_delay_ms();
- int get_chorus_separation_ms();
- int get_chorus_depth_ms10();
- int get_chorus_speed_hz10();
-
- /* utils */
-
- void reset(bool p_clear_patterns=true,bool p_clear_samples=true,bool p_clear_instruments=true,bool p_clear_variables=true);
-
- void cleanup_unused_patterns();
- void cleanup_unused_instruments();
- void cleanup_unused_samples();
- void cleanup_unused_orders();
- void clear_all_default_pan();
- void clear_all_default_vol();
-
- void clear_instrument_with_samples(int p_instrument);
-
- void make_instruments_from_samples();
- void make_instrument_from_sample(int p_sample);
-
- void separate_in_one_sample_instruments(int p_instrument);
-
- int get_order_in_use_count();
- int get_pattern_in_use_count();
- int get_instrument_in_use_count();
- int get_channels_in_use();
-
- CPSong();
- ~CPSong();
-
-};
-
-
-/* Some helper for something used a lot */
-
-int get_song_next_order_idx(CPSong *p_song, int p_order_idx);
-
-#endif
diff --git a/modules/chibi/cp_tables.cpp b/modules/chibi/cp_tables.cpp
deleted file mode 100644
index 8c62150f31..0000000000
--- a/modules/chibi/cp_tables.cpp
+++ /dev/null
@@ -1,254 +0,0 @@
-/*************************************************************************/
-/* cp_tables.cpp */
-/*************************************************************************/
-/* This file is part of: */
-/* GODOT ENGINE */
-/* http://www.godotengine.org */
-/*************************************************************************/
-/* Copyright (c) 2007-2016 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 "cp_tables.h"
-
-int32_t CPTables::linear_period_to_freq_tab[768]={
-
- 535232,534749,534266,533784,533303,532822,532341,531861,
- 531381,530902,530423,529944,529466,528988,528511,528034,
- 527558,527082,526607,526131,525657,525183,524709,524236,
- 523763,523290,522818,522346,521875,521404,520934,520464,
- 519994,519525,519057,518588,518121,517653,517186,516720,
- 516253,515788,515322,514858,514393,513929,513465,513002,
- 512539,512077,511615,511154,510692,510232,509771,509312,
- 508852,508393,507934,507476,507018,506561,506104,505647,
- 505191,504735,504280,503825,503371,502917,502463,502010,
- 501557,501104,500652,500201,499749,499298,498848,498398,
- 497948,497499,497050,496602,496154,495706,495259,494812,
- 494366,493920,493474,493029,492585,492140,491696,491253,
- 490809,490367,489924,489482,489041,488600,488159,487718,
- 487278,486839,486400,485961,485522,485084,484647,484210,
- 483773,483336,482900,482465,482029,481595,481160,480726,
- 480292,479859,479426,478994,478562,478130,477699,477268,
- 476837,476407,475977,475548,475119,474690,474262,473834,
- 473407,472979,472553,472126,471701,471275,470850,470425,
- 470001,469577,469153,468730,468307,467884,467462,467041,
- 466619,466198,465778,465358,464938,464518,464099,463681,
- 463262,462844,462427,462010,461593,461177,460760,460345,
- 459930,459515,459100,458686,458272,457859,457446,457033,
- 456621,456209,455797,455386,454975,454565,454155,453745,
- 453336,452927,452518,452110,451702,451294,450887,450481,
- 450074,449668,449262,448857,448452,448048,447644,447240,
- 446836,446433,446030,445628,445226,444824,444423,444022,
- 443622,443221,442821,442422,442023,441624,441226,440828,
- 440430,440033,439636,439239,438843,438447,438051,437656,
- 437261,436867,436473,436079,435686,435293,434900,434508,
- 434116,433724,433333,432942,432551,432161,431771,431382,
- 430992,430604,430215,429827,429439,429052,428665,428278,
- 427892,427506,427120,426735,426350,425965,425581,425197,
- 424813,424430,424047,423665,423283,422901,422519,422138,
- 421757,421377,420997,420617,420237,419858,419479,419101,
- 418723,418345,417968,417591,417214,416838,416462,416086,
- 415711,415336,414961,414586,414212,413839,413465,413092,
- 412720,412347,411975,411604,411232,410862,410491,410121,
- 409751,409381,409012,408643,408274,407906,407538,407170,
- 406803,406436,406069,405703,405337,404971,404606,404241,
- 403876,403512,403148,402784,402421,402058,401695,401333,
- 400970,400609,400247,399886,399525,399165,398805,398445,
- 398086,397727,397368,397009,396651,396293,395936,395579,
- 395222,394865,394509,394153,393798,393442,393087,392733,
- 392378,392024,391671,391317,390964,390612,390259,389907,
- 389556,389204,388853,388502,388152,387802,387452,387102,
- 386753,386404,386056,385707,385359,385012,384664,384317,
- 383971,383624,383278,382932,382587,382242,381897,381552,
- 381208,380864,380521,380177,379834,379492,379149,378807,
- 378466,378124,377783,377442,377102,376762,376422,376082,
- 375743,375404,375065,374727,374389,374051,373714,373377,
- 373040,372703,372367,372031,371695,371360,371025,370690,
- 370356,370022,369688,369355,369021,368688,368356,368023,
- 367691,367360,367028,366697,366366,366036,365706,365376,
- 365046,364717,364388,364059,363731,363403,363075,362747,
- 362420,362093,361766,361440,361114,360788,360463,360137,
- 359813,359488,359164,358840,358516,358193,357869,357547,
- 357224,356902,356580,356258,355937,355616,355295,354974,
- 354654,354334,354014,353695,353376,353057,352739,352420,
- 352103,351785,351468,351150,350834,350517,350201,349885,
- 349569,349254,348939,348624,348310,347995,347682,347368,
- 347055,346741,346429,346116,345804,345492,345180,344869,
- 344558,344247,343936,343626,343316,343006,342697,342388,
- 342079,341770,341462,341154,340846,340539,340231,339924,
- 339618,339311,339005,338700,338394,338089,337784,337479,
- 337175,336870,336566,336263,335959,335656,335354,335051,
- 334749,334447,334145,333844,333542,333242,332941,332641,
- 332341,332041,331741,331442,331143,330844,330546,330247,
- 329950,329652,329355,329057,328761,328464,328168,327872,
- 327576,327280,326985,326690,326395,326101,325807,325513,
- 325219,324926,324633,324340,324047,323755,323463,323171,
- 322879,322588,322297,322006,321716,321426,321136,320846,
- 320557,320267,319978,319690,319401,319113,318825,318538,
- 318250,317963,317676,317390,317103,316817,316532,316246,
- 315961,315676,315391,315106,314822,314538,314254,313971,
- 313688,313405,313122,312839,312557,312275,311994,311712,
- 311431,311150,310869,310589,310309,310029,309749,309470,
- 309190,308911,308633,308354,308076,307798,307521,307243,
- 306966,306689,306412,306136,305860,305584,305308,305033,
- 304758,304483,304208,303934,303659,303385,303112,302838,
- 302565,302292,302019,301747,301475,301203,300931,300660,
- 300388,300117,299847,299576,299306,299036,298766,298497,
- 298227,297958,297689,297421,297153,296884,296617,296349,
- 296082,295815,295548,295281,295015,294749,294483,294217,
- 293952,293686,293421,293157,292892,292628,292364,292100,
- 291837,291574,291311,291048,290785,290523,290261,289999,
- 289737,289476,289215,288954,288693,288433,288173,287913,
- 287653,287393,287134,286875,286616,286358,286099,285841,
- 285583,285326,285068,284811,284554,284298,284041,283785,
- 283529,283273,283017,282762,282507,282252,281998,281743,
- 281489,281235,280981,280728,280475,280222,279969,279716,
- 279464,279212,278960,278708,278457,278206,277955,277704,
- 277453,277203,276953,276703,276453,276204,275955,275706,
- 275457,275209,274960,274712,274465,274217,273970,273722,
- 273476,273229,272982,272736,272490,272244,271999,271753,
- 271508,271263,271018,270774,270530,270286,270042,269798,
- 269555,269312,269069,268826,268583,268341,268099,267857
-};
-
-uint16_t CPTables::old_period_table[OCTAVE*2]={
-
- 0x6b00, 0x6800, 0x6500, 0x6220, 0x5f50, 0x5c80,
- 0x5a00, 0x5740, 0x54d0, 0x5260, 0x5010, 0x4dc0,
- 0x4b90, 0x4960, 0x4750, 0x4540, 0x4350, 0x4160,
- 0x3f90, 0x3dc0, 0x3c10, 0x3a40, 0x38b0, 0x3700
-};
-
-#define LOGFAC 2*16
-
-uint16_t CPTables::log_table[104]= {
- LOGFAC*907,LOGFAC*900,LOGFAC*894,LOGFAC*887,
- LOGFAC*881,LOGFAC*875,LOGFAC*868,LOGFAC*862,
- LOGFAC*856,LOGFAC*850,LOGFAC*844,LOGFAC*838,
- LOGFAC*832,LOGFAC*826,LOGFAC*820,LOGFAC*814,
- LOGFAC*808,LOGFAC*802,LOGFAC*796,LOGFAC*791,
- LOGFAC*785,LOGFAC*779,LOGFAC*774,LOGFAC*768,
- LOGFAC*762,LOGFAC*757,LOGFAC*752,LOGFAC*746,
- LOGFAC*741,LOGFAC*736,LOGFAC*730,LOGFAC*725,
- LOGFAC*720,LOGFAC*715,LOGFAC*709,LOGFAC*704,
- LOGFAC*699,LOGFAC*694,LOGFAC*689,LOGFAC*684,
- LOGFAC*678,LOGFAC*675,LOGFAC*670,LOGFAC*665,
- LOGFAC*660,LOGFAC*655,LOGFAC*651,LOGFAC*646,
- LOGFAC*640,LOGFAC*636,LOGFAC*632,LOGFAC*628,
- LOGFAC*623,LOGFAC*619,LOGFAC*614,LOGFAC*610,
- LOGFAC*604,LOGFAC*601,LOGFAC*597,LOGFAC*592,
- LOGFAC*588,LOGFAC*584,LOGFAC*580,LOGFAC*575,
- LOGFAC*570,LOGFAC*567,LOGFAC*563,LOGFAC*559,
- LOGFAC*555,LOGFAC*551,LOGFAC*547,LOGFAC*543,
- LOGFAC*538,LOGFAC*535,LOGFAC*532,LOGFAC*528,
- LOGFAC*524,LOGFAC*520,LOGFAC*516,LOGFAC*513,
- LOGFAC*508,LOGFAC*505,LOGFAC*502,LOGFAC*498,
- LOGFAC*494,LOGFAC*491,LOGFAC*487,LOGFAC*484,
- LOGFAC*480,LOGFAC*477,LOGFAC*474,LOGFAC*470,
- LOGFAC*467,LOGFAC*463,LOGFAC*460,LOGFAC*457,
- LOGFAC*453,LOGFAC*450,LOGFAC*447,LOGFAC*443,
- LOGFAC*440,LOGFAC*437,LOGFAC*434,LOGFAC*431
-};
-
-
-
-int32_t CPTables::get_linear_period(uint16_t note,int32_t fine) {
-
- int32_t t;
-
- t=(24L*OCTAVE-(int32_t)note)*32L-(fine>>1);
- return t;
-}
-
-static int s3m_period_table[12]={1712,1616,1524,1440,1356,1280,1208,1140,1076,1016,960,907};
-
-
-int32_t CPTables::get_log_period(uint16_t note,int32_t p_c5freq) {
-
- return (8363L * 16 * s3m_period_table[note%12] >> (note/12)) / p_c5freq;
-
-}
-
-/*
-int32_t CPTables::get_log_period(uint16_t note,int32_t p_c5freq)
-{
- uint16_t n,o;
- uint16_t p1,p2;
- int32_t i;
-
- n=note%(2*OCTAVE);
- o=note/(2*OCTAVE);
- i=(n<<2); // n*8 + fine/16
-
- if (i<0)
- i=0;
-
- if (i>102)
- i=102;
-
-
- p1=log_table[i];
- p2=log_table[i+1];
-
-
- return (Interpolate(fine>>4,0,15,p1,p2)>>o);
-
-} */
-
-int32_t CPTables::get_old_period(uint16_t note,int32_t speed) {
-
- uint16_t n,o,res;
-
-// if (!speed) {
-
- // return 4242; /* <- prevent divide overflow */
- // }
-
- n=note%(2*OCTAVE);
- o=note/(2*OCTAVE);
-
- res=((8363L*(int32_t)old_period_table[n])>>o)/((old_period_table[17]>>1)+(speed<<2)); /*/(128-speed)*/;
-
- return res;
-}
-
-int32_t CPTables::get_linear_frequency(int32_t period) {
-
- int32_t shift_value=(((int32_t)period/768)-2);
- if (shift_value>0) {
-
- return linear_period_to_freq_tab[period%768]>>shift_value;
- } else {
- shift_value=0-shift_value;
- return linear_period_to_freq_tab[period%768]<<shift_value;
- }
-}
-
-int32_t CPTables::get_old_frequency(int32_t period) {
-
- return (8363L*1712L)/(period?period:1);
-
-}
-
-CPTables::CPTables(){
-}
-CPTables::~CPTables(){
-}
diff --git a/modules/chibi/cp_tables.h b/modules/chibi/cp_tables.h
deleted file mode 100644
index ac7ee562b7..0000000000
--- a/modules/chibi/cp_tables.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/*************************************************************************/
-/* cp_tables.h */
-/*************************************************************************/
-/* This file is part of: */
-/* GODOT ENGINE */
-/* http://www.godotengine.org */
-/*************************************************************************/
-/* Copyright (c) 2007-2016 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 CPTABLES_H
-#define CPTABLES_H
-
-#include "cp_config.h"
-
-/**conversion CPTables/functions
- *@author Juan Linietsky
- */
-
-/******************************
- CPTables.h
- --------
-
-CPTables methods for miscelaneous
-conversion utilities
-********************************/
-
-class CPTables {
-public:
-
- enum { OCTAVE=12 };
-
- static uint16_t old_period_table[OCTAVE*2];
- static uint16_t log_table[104];
- static int32_t linear_period_to_freq_tab[768];
-
- static int32_t get_old_period(uint16_t note,int32_t speed);
- static int32_t get_amiga_period(uint16_t note,int32_t fine);
- static int32_t get_linear_period(uint16_t note,int32_t fine);
- static int32_t get_linear_frequency(int32_t period);
- static int32_t get_old_frequency(int32_t period);
- static int32_t get_log_period(uint16_t note,int32_t p_c5freq);
-
- CPTables();
- ~CPTables();
-};
-
-#endif
diff --git a/modules/chibi/event_stream_chibi.cpp b/modules/chibi/event_stream_chibi.cpp
deleted file mode 100644
index b88f4ee70e..0000000000
--- a/modules/chibi/event_stream_chibi.cpp
+++ /dev/null
@@ -1,872 +0,0 @@
-/*************************************************************************/
-/* event_stream_chibi.cpp */
-/*************************************************************************/
-/* This file is part of: */
-/* GODOT ENGINE */
-/* http://www.godotengine.org */
-/*************************************************************************/
-/* Copyright (c) 2007-2016 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 "event_stream_chibi.h"
-#include "cp_loader_it.h"
-#include "cp_loader_xm.h"
-#include "cp_loader_s3m.h"
-#include "cp_loader_mod.h"
-
-static CPSampleManagerImpl *sample_manager;
-static ResourceFormatLoaderChibi *resource_loader;
-
-CPSample_ID CPSampleManagerImpl::create(bool p_16bits,bool p_stereo,int32_t p_len) {
-
- AudioServer::SampleFormat sf=p_16bits?AudioServer::SAMPLE_FORMAT_PCM16:AudioServer::SAMPLE_FORMAT_PCM8;
-
- SampleData *sd = memnew( SampleData );
- sd->rid = AudioServer::get_singleton()->sample_create(sf,p_stereo,p_len);
- sd->stereo=p_stereo;
- sd->len=p_len;
- sd->is16=p_16bits;
- sd->mixfreq=44100;
- sd->loop_begin=0;
- sd->loop_end=0;
- sd->loop_type=CP_LOOP_NONE;
- sd->locks=0;
-#ifdef DEBUG_ENABLED
- valid.insert(sd);
-#endif
- CPSample_ID sid;
- sid._private=sd;
- return sid;
-}
-
-void CPSampleManagerImpl::recreate(CPSample_ID p_id,bool p_16bits,bool p_stereo,int32_t p_len){
-
- AudioServer::SampleFormat sf=p_16bits?AudioServer::SAMPLE_FORMAT_PCM16:AudioServer::SAMPLE_FORMAT_PCM8;
- SampleData *sd=_getsd(p_id);
-#ifdef DEBUG_ENABLED
- ERR_FAIL_COND(!valid.has(sd));
-#endif
- AudioServer::get_singleton()->free(sd->rid);
- sd->rid = AudioServer::get_singleton()->sample_create(sf,p_stereo,p_len);
- sd->stereo=p_stereo;
- sd->len=p_len;
- sd->is16=p_16bits;
- sd->mixfreq=44100;
- sd->loop_begin=0;
- sd->loop_end=0;
- sd->loop_type=CP_LOOP_NONE;
-}
-void CPSampleManagerImpl::destroy(CPSample_ID p_id){
-
- SampleData *sd=_getsd(p_id);
-#ifdef DEBUG_ENABLED
- ERR_FAIL_COND(!valid.has(sd));
- valid.erase(sd);
-#endif
- AudioServer::get_singleton()->free(sd->rid);
-
- memdelete(sd);
-}
-bool CPSampleManagerImpl::check(CPSample_ID p_id){
-
- SampleData *sd=_getsd(p_id);
-#ifdef DEBUG_ENABLED
- return valid.has(sd);
-#else
- return _getsd(p_id)!=NULL;
-#endif
-}
-
-void CPSampleManagerImpl::set_c5_freq(CPSample_ID p_id,int32_t p_freq){
-
- SampleData *sd=_getsd(p_id);
-#ifdef DEBUG_ENABLED
- ERR_FAIL_COND(!valid.has(sd));
-#endif
- sd->mixfreq=p_freq;
- AudioServer::get_singleton()->sample_set_mix_rate(sd->rid,p_freq);
-
-}
-void CPSampleManagerImpl::set_loop_begin(CPSample_ID p_id,int32_t p_begin){
-
- SampleData *sd=_getsd(p_id);
-#ifdef DEBUG_ENABLED
- ERR_FAIL_COND(!valid.has(sd));
-#endif
- sd->loop_begin=p_begin;
- AudioServer::get_singleton()->sample_set_loop_begin(sd->rid,p_begin);
-
-}
-void CPSampleManagerImpl::set_loop_end(CPSample_ID p_id,int32_t p_end){
-
- SampleData *sd=_getsd(p_id);
-#ifdef DEBUG_ENABLED
- ERR_FAIL_COND(!valid.has(sd));
-#endif
- sd->loop_end=p_end;
- AudioServer::get_singleton()->sample_set_loop_end(sd->rid,p_end);
-
-}
-void CPSampleManagerImpl::set_loop_type(CPSample_ID p_id,CPSample_Loop_Type p_type){
-
- SampleData *sd=_getsd(p_id);
-#ifdef DEBUG_ENABLED
- ERR_FAIL_COND(!valid.has(sd));
-#endif
-
- sd->loop_type=p_type;
- AudioServer::get_singleton()->sample_set_loop_format(sd->rid,AudioServer::SampleLoopFormat(p_type));
-
-
-}
-void CPSampleManagerImpl::set_chunk(CPSample_ID p_id,int32_t p_index,void *p_data,int p_data_len){
-
- SampleData *sd=_getsd(p_id);
-#ifdef DEBUG_ENABLED
- ERR_FAIL_COND(!valid.has(sd));
-#endif
-
- ERR_FAIL();
-}
-
-
-int32_t CPSampleManagerImpl::get_loop_begin(CPSample_ID p_id){
-
- SampleData *sd=_getsd(p_id);
-#ifdef DEBUG_ENABLED
- ERR_FAIL_COND_V(!valid.has(sd),0);
-#endif
-
- return sd->loop_begin;
-
-}
-int32_t CPSampleManagerImpl::get_loop_end(CPSample_ID p_id){
-
- SampleData *sd=_getsd(p_id);
-#ifdef DEBUG_ENABLED
- ERR_FAIL_COND_V(!valid.has(sd),0);
-#endif
-
- return sd->loop_end;
-}
-CPSample_Loop_Type CPSampleManagerImpl::get_loop_type(CPSample_ID p_id){
-
- SampleData *sd=_getsd(p_id);
-#ifdef DEBUG_ENABLED
- ERR_FAIL_COND_V(!valid.has(sd),CP_LOOP_NONE);
-#endif
-
- return sd->loop_type;
-}
-int32_t CPSampleManagerImpl::get_c5_freq(CPSample_ID p_id){
-
- SampleData *sd=_getsd(p_id);
-#ifdef DEBUG_ENABLED
- ERR_FAIL_COND_V(!valid.has(sd),0);
-#endif
-
- return sd->mixfreq;
-}
-int32_t CPSampleManagerImpl::get_size(CPSample_ID p_id){
-
- SampleData *sd=_getsd(p_id);
-#ifdef DEBUG_ENABLED
- ERR_FAIL_COND_V(!valid.has(sd),0);
-#endif
-
- return sd->len;
-
-}
-bool CPSampleManagerImpl::is_16bits(CPSample_ID p_id){
-
- SampleData *sd=_getsd(p_id);
-#ifdef DEBUG_ENABLED
- ERR_FAIL_COND_V(!valid.has(sd),false);
-#endif
-
- return sd->is16;
-
-}
-bool CPSampleManagerImpl::is_stereo(CPSample_ID p_id){
-
- SampleData *sd=_getsd(p_id);
-#ifdef DEBUG_ENABLED
- ERR_FAIL_COND_V(!valid.has(sd),false);
-#endif
- return sd->stereo;
-
-
-}
-bool CPSampleManagerImpl::lock_data(CPSample_ID p_id){
-
- SampleData *sd=_getsd(p_id);
-#ifdef DEBUG_ENABLED
- ERR_FAIL_COND_V(!valid.has(sd),0);
-#endif
-
- sd->locks++;
- if (sd->locks==1) {
- sd->lock=AudioServer::get_singleton()->sample_get_data(sd->rid);
- sd->w=sd->lock.write();
- }
-
- return true;
-}
-void *CPSampleManagerImpl::get_data(CPSample_ID p_id){
-
- SampleData *sd=_getsd(p_id);
-#ifdef DEBUG_ENABLED
- ERR_FAIL_COND_V(!valid.has(sd),0);
-#endif
-
- ERR_FAIL_COND_V(sd->locks==0,0);
- return sd->w.ptr();
-}
-
-int16_t CPSampleManagerImpl::get_data(CPSample_ID p_id, int p_sample, int p_channel){
-
- SampleData *sd=_getsd(p_id);
-#ifdef DEBUG_ENABLED
- ERR_FAIL_COND_V(!valid.has(sd),0);
-#endif
-
- ERR_FAIL_V(0);
- lock_data(p_id);
-
- int sofs = sd->stereo ? 2:1;
- uint16_t v=0;
- if (sd->is16) {
- int16_t *p=(int16_t*)sd->w.ptr();
- v=p[p_sample*sofs+p_channel];
- } else {
- int8_t *p=(int8_t*)sd->w.ptr();
- v=p[p_sample*sofs+p_channel];
- }
-
- unlock_data(p_id);
-
- return v;
-}
-void CPSampleManagerImpl::set_data(CPSample_ID p_id, int p_sample, int16_t p_data,int p_channel){
-
- SampleData *sd=_getsd(p_id);
-#ifdef DEBUG_ENABLED
- ERR_FAIL_COND(!valid.has(sd));
-#endif
-
- ERR_FAIL();
- lock_data(p_id);
-
- int sofs = sd->stereo ? 2:1;
- if (sd->is16) {
- int16_t *p=(int16_t*)sd->w.ptr();
- p[p_sample*sofs+p_channel]=p_data;
- } else {
- int8_t *p=(int8_t*)sd->w.ptr();
- p[p_sample*sofs+p_channel]=p_data;
- }
-
- unlock_data(p_id);
-
-}
-void CPSampleManagerImpl::unlock_data(CPSample_ID p_id){
-
- SampleData *sd=_getsd(p_id);
-#ifdef DEBUG_ENABLED
- ERR_FAIL_COND(!valid.has(sd));
-#endif
-
- ERR_FAIL_COND(sd->locks==0);
-
- sd->locks--;
- if (sd->locks==0) {
- sd->w=DVector<uint8_t>::Write();
- AudioServer::get_singleton()->sample_set_data(sd->rid,sd->lock);
- sd->lock=DVector<uint8_t>();
- }
-}
-
-void CPSampleManagerImpl::get_chunk(CPSample_ID p_id,int32_t p_index,void *p_data,int p_data_len) {
-
- SampleData *sd=_getsd(p_id);
-#ifdef DEBUG_ENABLED
- ERR_FAIL_COND(!valid.has(sd));
-#endif
-
- ERR_FAIL();
-}
-
-
-/** MIXER **/
-
-void CPMixerImpl::set_callback_interval(int p_interval_us) {
-
- callback_interval=p_interval_us;
-}
-
-void CPMixerImpl::set_callback(void (*p_callback)(void*),void *p_userdata) {
-
- callback=p_callback;
- userdata=p_userdata;
-}
-
-void CPMixerImpl::setup_voice(int p_voice_index,CPSample_ID p_sample_id,int32_t p_start_index) {
-
- Voice &v=voices[p_voice_index];
- if (v.channel!=AudioMixer::INVALID_CHANNEL) {
- mixer->channel_free(v.channel);
- }
- v.channel=mixer->channel_alloc(sample_manager->get_rid(p_sample_id));
- v.freq_mult = sample_manager->get_c5_freq(p_sample_id)/261.6255653006;
- v.sample = p_sample_id;
-}
-
-void CPMixerImpl::stop_voice(int p_voice_index) {
-
- Voice &v=voices[p_voice_index];
- if (v.channel==AudioMixer::INVALID_CHANNEL)
- return;
-
- mixer->channel_free(v.channel);
- v.channel=AudioMixer::INVALID_CHANNEL;
-
-}
-
-void CPMixerImpl::set_voice_frequency(int p_voice_index,int32_t p_freq) {
-
- Voice &v=voices[p_voice_index];
- ERR_FAIL_COND(v.channel==AudioMixer::INVALID_CHANNEL);
- float f = p_freq / 256.0;
- f*=pitch_scale;
- mixer->channel_set_mix_rate(v.channel,f * v.freq_mult );
-}
-
-void CPMixerImpl::set_voice_panning(int p_voice_index,int p_pan) {
-
- Voice &v=voices[p_voice_index];
- ERR_FAIL_COND(v.channel==AudioMixer::INVALID_CHANNEL);
- if (p_pan==CP_PAN_SURROUND)
- p_pan=CP_PAN_CENTER;
- float p = p_pan / 256.0;
- mixer->channel_set_pan(v.channel,p);
-
-}
-
-void CPMixerImpl::set_voice_volume(int p_voice_index,int p_vol) {
-
-
- Voice &v=voices[p_voice_index];
- ERR_FAIL_COND(v.channel==AudioMixer::INVALID_CHANNEL);
- float vol = p_vol/512.0;
- vol*=voice_scale;
- mixer->channel_set_volume(v.channel,vol);
- mixer->channel_set_reverb(v.channel,reverb_type,vol*v.reverb);
-}
-
-void CPMixerImpl::set_voice_filter(int p_voice_index,bool p_enabled,uint8_t p_cutoff, uint8_t p_resonance ){
-
- Voice &v=voices[p_voice_index];
- ERR_FAIL_COND(v.channel==AudioMixer::INVALID_CHANNEL);
-
-}
-
-void CPMixerImpl::set_voice_reverb_send(int p_voice_index,int p_reverb){
-
- Voice &v=voices[p_voice_index];
- ERR_FAIL_COND(v.channel==AudioMixer::INVALID_CHANNEL);
- v.reverb=p_reverb/255.0;
- //mixer->channel_set_reverb(v.channel,reverb_type,p_reverb/255.0);
-
-}
-
-void CPMixerImpl::set_voice_chorus_send(int p_voice_index,int p_chorus){
-
- Voice &v=voices[p_voice_index];
- ERR_FAIL_COND(v.channel==AudioMixer::INVALID_CHANNEL);
- mixer->channel_set_chorus(v.channel,p_chorus/255.0);
-
-}
-
-
-void CPMixerImpl::set_reverb_mode(ReverbMode p_mode){
-
-// Voice &v=voices[p_voice_index];
-// ERR_FAIL_COND(v.channel==AudioMixer::INVALID_CHANNEL);
- switch(p_mode) {
- case CPMixer::REVERB_MODE_STUDIO_SMALL: reverb_type=AudioMixer::REVERB_SMALL; break;
- case CPMixer::REVERB_MODE_STUDIO_MEDIUM: reverb_type=AudioMixer::REVERB_MEDIUM; break;
- case CPMixer::REVERB_MODE_STUDIO_LARGE: reverb_type=AudioMixer::REVERB_LARGE; break;
- case CPMixer::REVERB_MODE_HALL: reverb_type=AudioMixer::REVERB_HALL; break;
- default: reverb_type=AudioMixer::REVERB_SMALL; break;
- }
-
-}
-
-void CPMixerImpl::set_chorus_params(unsigned int p_delay_ms,unsigned int p_separation_ms,unsigned int p_depth_ms10,unsigned int p_speed_hz10){
-
-// Voice &v=voices[p_voice_index];
-// ERR_FAIL_COND(v.channel==AudioMixer::INVALID_CHANNEL);
-
-}
-
-
-
-/* Info retrieving */
-
-int32_t CPMixerImpl::get_voice_sample_pos_index(int p_voice_index) {
-
- Voice &v=voices[p_voice_index];
- ERR_FAIL_COND_V(v.channel==AudioMixer::INVALID_CHANNEL,0);
- return 0;
-
-}
-
-int CPMixerImpl::get_voice_panning(int p_voice_index) {
-
- Voice &v=voices[p_voice_index];
- ERR_FAIL_COND_V(!is_voice_active(p_voice_index),0);
- return mixer->channel_get_pan(v.channel)*CP_PAN_RIGHT;
-
-}
-
-int CPMixerImpl::get_voice_volume(int p_voice_index) {
-
- Voice &v=voices[p_voice_index];
- ERR_FAIL_COND_V(!is_voice_active(p_voice_index),0);
- return mixer->channel_get_volume(v.channel);
-
-
-}
-
-CPSample_ID CPMixerImpl::get_voice_sample_id(int p_voice_index) {
-
- Voice &v=voices[p_voice_index];
- ERR_FAIL_COND_V(v.channel==AudioMixer::INVALID_CHANNEL,CPSample_ID());
- return v.sample;
-
-
-}
-
-bool CPMixerImpl::is_voice_active(int p_voice_index){
-
- Voice &v=voices[p_voice_index];
- if (v.channel==AudioMixer::INVALID_CHANNEL)
- return false;
- if (!mixer->channel_is_valid(v.channel))
- v.channel=AudioMixer::INVALID_CHANNEL;
-
- return v.channel!=AudioMixer::INVALID_CHANNEL;
-}
-
-void CPMixerImpl::process_usecs(int p_usec,float p_volume,float p_pitch_scale,float p_tempo_scale) {
-
- ERR_FAIL_COND(callback_interval==0);
- //update this somewhere
- pitch_scale=p_pitch_scale;
- tempo_scale=p_tempo_scale;
- voice_scale = AudioServer::get_singleton()->get_event_voice_global_volume_scale()*p_volume;
- while(p_usec) {
-
- if (p_usec>=callback_timeout) {
-
- p_usec-=callback_timeout;
- callback_timeout=0;
- if (callback) {
- callback(userdata);
- }
- callback_timeout=callback_interval*(1.0/p_tempo_scale);
-
- } else {
-
- callback_timeout-=p_usec;
- p_usec=0;
- }
- }
-}
-
-
-CPMixerImpl::CPMixerImpl(AudioMixer *p_mixer) {
-
- callback_interval=1;
- callback_timeout=0;
- userdata=0;
- callback=0;
- tempo_scale=1.0;
- pitch_scale=1.0;
- mixer=p_mixer;
- voice_scale = AudioServer::get_singleton()->get_event_voice_global_volume_scale();
- reverb_type = AudioMixer::REVERB_SMALL;
-
-}
-
-/** FILE ACCESS WRAPPER **/
-
-
-CPFileAccessWrapperImpl::Error CPFileAccessWrapperImpl::open(const char *p_filename, int p_mode_flags) {
-
- ERR_FAIL_COND_V(p_mode_flags&WRITE,ERROR_WRITING_FILE);
- close();
- f = FileAccess::open(String::utf8(p_filename),p_mode_flags);
- if (!f)
- return ERROR_FILE_NOT_FOUND;
- return OK;
-}
-
-void CPFileAccessWrapperImpl::close(){
-
- if (f)
- memdelete(f);
- f=NULL;
-
-
-}
-
-void CPFileAccessWrapperImpl::seek(uint32_t p_position){
-
- f->seek(p_position);
-}
-void CPFileAccessWrapperImpl::seek_end(){
-
- f->seek_end();
-}
-uint32_t CPFileAccessWrapperImpl::get_pos(){
-
- return f->get_pos();
-}
-
-bool CPFileAccessWrapperImpl::eof_reached(){
-
- return f->eof_reached();
-}
-
-uint8_t CPFileAccessWrapperImpl::get_byte(){
-
- return f->get_8();
-}
-void CPFileAccessWrapperImpl::get_byte_array(uint8_t *p_dest,int p_elements){
-
- f->get_buffer(p_dest,p_elements);
-}
-void CPFileAccessWrapperImpl::get_word_array(uint16_t *p_dest,int p_elements){
-
- for(int i=0;i<p_elements;i++) {
- p_dest[i]=f->get_16();
- }
-
-}
-
-uint16_t CPFileAccessWrapperImpl::get_word(){
-
- return f->get_16();
-}
-uint32_t CPFileAccessWrapperImpl::get_dword(){
-
- return f->get_32();
-}
-
-void CPFileAccessWrapperImpl::set_endian_conversion(bool p_swap){
-
- f->set_endian_swap(p_swap);
-}
-bool CPFileAccessWrapperImpl::is_open(){
-
- return f!=NULL;
-}
-
-CPFileAccessWrapperImpl::Error CPFileAccessWrapperImpl::get_error(){
-
- return (f->get_error()!=::OK)?ERROR_READING_FILE:OK;
-}
-
-void CPFileAccessWrapperImpl::store_byte(uint8_t p_dest){
-
-}
-void CPFileAccessWrapperImpl::store_byte_array(const uint8_t *p_dest,int p_elements){
-
-}
-
-void CPFileAccessWrapperImpl::store_word(uint16_t p_dest){
-
-}
-void CPFileAccessWrapperImpl::store_dword(uint32_t p_dest){
-
-}
-
-////////////////////////////////////////////////
-
-
-Error EventStreamPlaybackChibi::_play() {
-
- last_order=0;
- loops=0;
- player->play_start_song();
- total_usec=0;
-
- return OK;
-}
-
-bool EventStreamPlaybackChibi::_update(AudioMixer* p_mixer, uint64_t p_usec){
-
- total_usec+=p_usec;
- mixer.process_usecs(p_usec,volume,pitch_scale,tempo_scale);
- int order=player->get_current_order();
- if (order<last_order) {
- if (!loop) {
- stop();
- } else {
- loops++;
- }
- }
- last_order=order;
- return false;
-}
-void EventStreamPlaybackChibi::_stop(){
-
- player->play_stop();
-}
-
-void EventStreamPlaybackChibi::set_paused(bool p_paused){
-
-}
-bool EventStreamPlaybackChibi::is_paused() const{
-
- return false;
-}
-void EventStreamPlaybackChibi::set_loop(bool p_loop){
-
- loop=p_loop;
-
-}
-bool EventStreamPlaybackChibi::is_loop_enabled() const{
-
- return loop;
-}
-
-int EventStreamPlaybackChibi::get_loop_count() const{
-
- //return player->is
- return loops;
-}
-
-float EventStreamPlaybackChibi::get_pos() const{
-
- return double(total_usec)/1000000.0;
-}
-void EventStreamPlaybackChibi::seek_pos(float p_time){
-
- WARN_PRINT("seek_pos unimplemented.");
-}
-
-void EventStreamPlaybackChibi::set_volume(float p_volume) {
-
- volume=p_volume;
-}
-
-float EventStreamPlaybackChibi::get_volume() const{
-
- return volume;
-}
-
-void EventStreamPlaybackChibi::set_pitch_scale(float p_pitch_scale) {
-
- pitch_scale=p_pitch_scale;
-}
-
-float EventStreamPlaybackChibi::get_pitch_scale() const{
-
- return pitch_scale;
-}
-
-void EventStreamPlaybackChibi::set_tempo_scale(float p_tempo_scale) {
-
- tempo_scale=p_tempo_scale;
-}
-
-float EventStreamPlaybackChibi::get_tempo_scale() const{
-
- return tempo_scale;
-}
-
-
-void EventStreamPlaybackChibi::set_channel_volume(int p_channel,float p_volume) {
-
-
- if (p_channel>=64)
- return;
- player->set_channel_global_volume(p_channel,p_volume*256);
-}
-
-
-
-float EventStreamPlaybackChibi::get_channel_volume(int p_channel) const{
-
- return player->get_channel_global_volume(p_channel)/256.0;
-
-}
-
-float EventStreamPlaybackChibi::get_last_note_time(int p_channel) const {
-
-
- double v = (player->get_channel_last_note_time_usec(p_channel))/1000000.0;
- if (v<0)
- v=-1;
- return v;
-}
-
-EventStreamPlaybackChibi::EventStreamPlaybackChibi(Ref<EventStreamChibi> p_stream) : mixer(_get_mixer()) {
-
- stream=p_stream;
- player = memnew( CPPlayer(&mixer,&p_stream->song) );
- loop=false;
- last_order=0;
- loops=0;
- volume=1.0;
- pitch_scale=1.0;
- tempo_scale=1.0;
-}
-EventStreamPlaybackChibi::~EventStreamPlaybackChibi(){
-
- player->play_stop();
- memdelete(player);
-}
-
-////////////////////////////////////////////////////
-
-Ref<EventStreamPlayback> EventStreamChibi::instance_playback() {
-
- return Ref<EventStreamPlayback>( memnew(EventStreamPlaybackChibi(Ref<EventStreamChibi>(this))) );
-}
-
-String EventStreamChibi::get_stream_name() const{
-
- return song.get_name();
-
-}
-
-
-
-float EventStreamChibi::get_length() const{
-
- return 1;
-}
-
-
-EventStreamChibi::EventStreamChibi() {
-
-
-}
-
-
-
-//////////////////////////////////////////////////////////////////
-
-
-
-
-RES ResourceFormatLoaderChibi::load(const String &p_path, const String& p_original_path, Error *r_error) {
-
- if (r_error)
- *r_error=ERR_FILE_CANT_OPEN;
- String el = p_path.extension().to_lower();
-
- CPFileAccessWrapperImpl f;
-
- if (el=="it") {
-
- Ref<EventStreamChibi> esc( memnew( EventStreamChibi ) );
- CPLoader_IT loader(&f);
- CPLoader::Error err = loader.load_song(p_path.utf8().get_data(),&esc->song,false);
- ERR_FAIL_COND_V(err!=CPLoader::FILE_OK,RES());
- if (r_error)
- *r_error=OK;
-
- return esc;
-
- } else if (el=="xm") {
-
- Ref<EventStreamChibi> esc( memnew( EventStreamChibi ) );
- CPLoader_XM loader(&f);
- CPLoader::Error err=loader.load_song(p_path.utf8().get_data(),&esc->song,false);
- ERR_FAIL_COND_V(err!=CPLoader::FILE_OK,RES());
- if (r_error)
- *r_error=OK;
- return esc;
-
- } else if (el=="s3m") {
-
- Ref<EventStreamChibi> esc( memnew( EventStreamChibi ) );
- CPLoader_S3M loader(&f);
- CPLoader::Error err=loader.load_song(p_path.utf8().get_data(),&esc->song,false);
- ERR_FAIL_COND_V(err!=CPLoader::FILE_OK,RES());
- if (r_error)
- *r_error=OK;
-
- return esc;
-
- } else if (el=="mod") {
-
- Ref<EventStreamChibi> esc( memnew( EventStreamChibi ) );
- CPLoader_MOD loader(&f);
- CPLoader::Error err=loader.load_song(p_path.utf8().get_data(),&esc->song,false);
- ERR_FAIL_COND_V(err!=CPLoader::FILE_OK,RES());
- if (r_error)
- *r_error=OK;
- return esc;
- }
-
- return RES();
-
-}
-
-void ResourceFormatLoaderChibi::get_recognized_extensions(List<String> *p_extensions) const {
-
- p_extensions->push_back("it");
- p_extensions->push_back("xm");
- p_extensions->push_back("s3m");
- p_extensions->push_back("mod");
-}
-bool ResourceFormatLoaderChibi::handles_type(const String& p_type) const {
-
- return (p_type=="EventStreamChibi" || p_type=="EventStream");
-}
-
-String ResourceFormatLoaderChibi::get_resource_type(const String &p_path) const {
- String el = p_path.extension().to_lower();
- if (el=="it" || el=="s3m" || el=="xm" || el=="mod")
- return "EventStreamChibi";
- return "";
-}
-
-/////////////////////////////////////////////////////////////////
-void initialize_chibi() {
-
- sample_manager = memnew( CPSampleManagerImpl );
- resource_loader = memnew( ResourceFormatLoaderChibi );
- ObjectTypeDB::register_type<EventStreamChibi>();
- ResourceLoader::add_resource_format_loader( resource_loader );
-}
-
-void finalize_chibi() {
-
- memdelete( sample_manager );
- memdelete( resource_loader );
-}
-
diff --git a/modules/chibi/event_stream_chibi.h b/modules/chibi/event_stream_chibi.h
deleted file mode 100644
index cc7b0ace86..0000000000
--- a/modules/chibi/event_stream_chibi.h
+++ /dev/null
@@ -1,314 +0,0 @@
-/*************************************************************************/
-/* event_stream_chibi.h */
-/*************************************************************************/
-/* This file is part of: */
-/* GODOT ENGINE */
-/* http://www.godotengine.org */
-/*************************************************************************/
-/* Copyright (c) 2007-2016 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 EVENT_STREAM_CHIBI_H
-#define EVENT_STREAM_CHIBI_H
-
-#include "scene/resources/event_stream.h"
-#include "cp_sample_manager.h"
-#include "cp_mixer.h"
-#include "cp_song.h"
-#include "cp_file_access_wrapper.h"
-#include "cp_player_data.h"
-#include "resource.h"
-#include "servers/audio_server.h"
-#include "os/file_access.h"
-#include "io/resource_loader.h"
-
-/** SAMPLE MANAGER **/
-
-class CPSampleManagerImpl : public CPSampleManager {
-
- struct SampleData {
-
- RID rid;
- bool stereo;
- bool is16;
- int len;
- int mixfreq;
- int loop_begin;
- int loop_end;
- int locks;
- DVector<uint8_t> lock;
- DVector<uint8_t>::Write w;
- CPSample_Loop_Type loop_type;
- };
-
-
- _FORCE_INLINE_ SampleData* _getsd(CPSample_ID p_id) {
-
- return ((SampleData*)p_id._private);
- }
- Set<SampleData*> valid;
-
-public:
-
- _FORCE_INLINE_ RID get_rid(CPSample_ID p_id) { return _getsd(p_id)->rid; }
- virtual CPSample_ID create(bool p_16bits,bool p_stereo,int32_t p_len);
- virtual void recreate(CPSample_ID p_id,bool p_16bits,bool p_stereo,int32_t p_len);
- virtual void destroy(CPSample_ID p_id);
- virtual bool check(CPSample_ID p_id); // return false if invalid
-
- virtual void set_c5_freq(CPSample_ID p_id,int32_t p_freq);
- virtual void set_loop_begin(CPSample_ID p_id,int32_t p_begin);
- virtual void set_loop_end(CPSample_ID p_id,int32_t p_end);
- virtual void set_loop_type(CPSample_ID p_id,CPSample_Loop_Type p_type);
- virtual void set_chunk(CPSample_ID p_id,int32_t p_index,void *p_data,int p_data_len);
-
-
- virtual int32_t get_loop_begin(CPSample_ID p_id);
- virtual int32_t get_loop_end(CPSample_ID p_id);
- virtual CPSample_Loop_Type get_loop_type(CPSample_ID p_id);
- virtual int32_t get_c5_freq(CPSample_ID p_id);
- virtual int32_t get_size(CPSample_ID p_id);
- virtual bool is_16bits(CPSample_ID p_id);
- virtual bool is_stereo(CPSample_ID p_id);
- virtual bool lock_data(CPSample_ID p_id);
- virtual void *get_data(CPSample_ID p_id); /* WARNING: Not all sample managers
-may be able to implement this, it depends on the mixer in use! */
- virtual int16_t get_data(CPSample_ID p_id, int p_sample, int p_channel=0); /// Does not need locking
- virtual void set_data(CPSample_ID p_id, int p_sample, int16_t p_data,int p_channel=0); /// Does not need locking
- virtual void unlock_data(CPSample_ID p_id);
-
- virtual void get_chunk(CPSample_ID p_id,int32_t p_index,void *p_data,int p_data_len);
-
-};
-
-
-/** MIXER **/
-
-class CPMixerImpl : public CPMixer {
-
- enum {
- MAX_VOICES=64
- };
-
- struct Voice {
-
- AudioMixer::ChannelID channel;
- CPSample_ID sample;
- float freq_mult;
- float reverb;
- Voice() { reverb=0.0; }
- };
-
- Voice voices[MAX_VOICES];
-
-
- int callback_interval;
- int callback_timeout;
- void (*callback)(void*);
- void *userdata;
- float voice_scale;
- float tempo_scale;
- float pitch_scale;
- AudioMixer::ReverbRoomType reverb_type;
- AudioMixer *mixer;
-public:
-
- void process_usecs(int p_usec,float p_volume,float p_pitch_scale,float p_tempo_scale);
-
- /* Callback */
-
- virtual void set_callback_interval(int p_interval_us); //in usecs, for tracker it's 2500000/tempo
- virtual void set_callback(void (*p_callback)(void*),void *p_userdata);
-
- /* Voice Control */
-
- virtual void setup_voice(int p_voice_index,CPSample_ID p_sample_id,int32_t p_start_index) ;
- virtual void stop_voice(int p_voice_index) ;
- virtual void set_voice_frequency(int p_voice_index,int32_t p_freq) ; //in freq*FREQUENCY_BITS
- virtual void set_voice_panning(int p_voice_index,int p_pan) ;
- virtual void set_voice_volume(int p_voice_index,int p_vol) ;
- virtual void set_voice_filter(int p_filter,bool p_enabled,uint8_t p_cutoff, uint8_t p_resonance );
- virtual void set_voice_reverb_send(int p_voice_index,int p_reverb);
- virtual void set_voice_chorus_send(int p_voice_index,int p_chorus); /* 0 - 255 */
-
- virtual void set_reverb_mode(ReverbMode p_mode);
- virtual void set_chorus_params(unsigned int p_delay_ms,unsigned int p_separation_ms,unsigned int p_depth_ms10,unsigned int p_speed_hz10);
-
-
- /* Info retrieving */
-
- virtual int32_t get_voice_sample_pos_index(int p_voice_index) ;
- virtual int get_voice_panning(int p_voice_index) ;
- virtual int get_voice_volume(int p_voice_index) ;
- virtual CPSample_ID get_voice_sample_id(int p_voice_index) ;
- virtual bool is_voice_active(int p_voice_index);
- virtual int get_active_voice_count() { return 0; }
- virtual int get_total_voice_count() { return MAX_VOICES; }
-
-
- virtual uint32_t get_mix_frequency() { return 0; }
-
- /* Methods below only work with software mixers, meant for software-based sound drivers, hardware mixers ignore them */
- virtual int32_t process(int32_t p_frames) { return 0; }
- virtual int32_t *get_mixdown_buffer_ptr() { return NULL; }
- virtual void set_mix_frequency(int32_t p_mix_frequency) {};
-
- CPMixerImpl(AudioMixer *p_mixer=NULL);
- virtual ~CPMixerImpl() {}
-};
-
-/** FILE ACCESS **/
-
-class CPFileAccessWrapperImpl : public CPFileAccessWrapper {
-
- FileAccess *f;
-public:
-
-
- virtual Error open(const char *p_filename, int p_mode_flags);
- virtual void close();
-
- virtual void seek(uint32_t p_position);
- virtual void seek_end();
- virtual uint32_t get_pos();
-
- virtual bool eof_reached();
-
- virtual uint8_t get_byte();
- virtual void get_byte_array(uint8_t *p_dest,int p_elements);
- virtual void get_word_array(uint16_t *p_dest,int p_elements);
-
- virtual uint16_t get_word();
- virtual uint32_t get_dword();
-
- virtual void set_endian_conversion(bool p_swap);
- virtual bool is_open();
-
- virtual Error get_error();
-
- virtual void store_byte(uint8_t p_dest);
- virtual void store_byte_array(const uint8_t *p_dest,int p_elements);
-
- virtual void store_word(uint16_t p_dest);
- virtual void store_dword(uint32_t p_dest);
-
- CPFileAccessWrapperImpl() { f=NULL; }
- virtual ~CPFileAccessWrapperImpl(){ if (f) memdelete(f); }
-
-};
-
-
-
-/////////////////////
-
-class EventStreamChibi;
-
-class EventStreamPlaybackChibi : public EventStreamPlayback {
-
- OBJ_TYPE(EventStreamPlaybackChibi,EventStreamPlayback);
-
- CPMixerImpl mixer;
- uint64_t total_usec;
- Ref<EventStreamChibi> stream;
- mutable CPPlayer *player;
- bool loop;
- int last_order;
- int loops;
- virtual Error _play();
- virtual bool _update(AudioMixer* p_mixer, uint64_t p_usec);
- virtual void _stop();
- float volume;
- float tempo_scale;
- float pitch_scale;
-
-
-public:
-
-
- virtual void set_paused(bool p_paused);
- virtual bool is_paused() const;
-
- virtual void set_loop(bool p_loop);
- virtual bool is_loop_enabled() const;
-
- virtual int get_loop_count() const;
-
- virtual float get_pos() const;
- virtual void seek_pos(float p_time);
-
- virtual void set_volume(float p_vol);
- virtual float get_volume() const;
-
- virtual void set_pitch_scale(float p_pitch_scale);
- virtual float get_pitch_scale() const;
-
- virtual void set_tempo_scale(float p_tempo_scale);
- virtual float get_tempo_scale() const;
-
- virtual void set_channel_volume(int p_channel,float p_volume);
- virtual float get_channel_volume(int p_channel) const;
-
- virtual float get_last_note_time(int p_channel) const;
-
- EventStreamPlaybackChibi(Ref<EventStreamChibi> p_stream=Ref<EventStreamChibi>());
- ~EventStreamPlaybackChibi();
-};
-
-
-class EventStreamChibi : public EventStream {
-
- OBJ_TYPE(EventStreamChibi,EventStream);
-
-friend class ResourceFormatLoaderChibi;
-friend class EventStreamPlaybackChibi;
- //I think i didn't know what const was when i wrote this more than a decade ago
- //so it goes mutable :(
- mutable CPSong song;
-
-
-public:
-
- virtual Ref<EventStreamPlayback> instance_playback();
-
- virtual String get_stream_name() const;
-
- virtual float get_length() const;
-
- virtual int get_channel_count() const { return 64; } //tracker limit
-
- EventStreamChibi();
-};
-
-
-class ResourceFormatLoaderChibi : public ResourceFormatLoader {
-
-public:
- virtual RES load(const String &p_path,const String& p_original_path="",Error *r_error=NULL);
- virtual void get_recognized_extensions(List<String> *p_extensions) const;
- virtual bool handles_type(const String& p_type) const;
- virtual String get_resource_type(const String &p_path) const;
-
-};
-
-void initialize_chibi();
-void finalize_chibi();
-
-#endif // EVENT_STREAM_CHIBI_H
diff --git a/modules/chibi/register_types.cpp b/modules/chibi/register_types.cpp
deleted file mode 100644
index b2ba16fa03..0000000000
--- a/modules/chibi/register_types.cpp
+++ /dev/null
@@ -1,41 +0,0 @@
-/*************************************************************************/
-/* register_types.cpp */
-/*************************************************************************/
-/* This file is part of: */
-/* GODOT ENGINE */
-/* http://www.godotengine.org */
-/*************************************************************************/
-/* Copyright (c) 2007-2016 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 "register_types.h"
-
-#include "event_stream_chibi.h"
-
-void register_chibi_types() {
-
- initialize_chibi();
-}
-
-void unregister_chibi_types() {
-
- finalize_chibi();
-}
diff --git a/modules/chibi/register_types.h b/modules/chibi/register_types.h
deleted file mode 100644
index 159823b85d..0000000000
--- a/modules/chibi/register_types.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/*************************************************************************/
-/* register_types.h */
-/*************************************************************************/
-/* This file is part of: */
-/* GODOT ENGINE */
-/* http://www.godotengine.org */
-/*************************************************************************/
-/* Copyright (c) 2007-2016 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. */
-/*************************************************************************/
-void register_chibi_types();
-void unregister_chibi_types();
diff --git a/modules/cscript/config.py b/modules/cscript/config.py
index ea7e83378a..5698a37295 100644
--- a/modules/cscript/config.py
+++ b/modules/cscript/config.py
@@ -1,11 +1,8 @@
def can_build(platform):
- return True
+ return True
def configure(env):
- pass
-
-
-
+ pass
diff --git a/modules/cscript/godot_c.h b/modules/cscript/godot_c.h
index b0465d8524..3bf86d1aeb 100644
--- a/modules/cscript/godot_c.h
+++ b/modules/cscript/godot_c.h
@@ -123,8 +123,8 @@ void GDAPI godot_array_free(godot_array p_array);
#define INPUT_EVENT_TYPE_KEY 1
#define INPUT_EVENT_TYPE_MOUSE_MOTION 2
#define INPUT_EVENT_TYPE_MOUSE_BUTTON 3
-#define INPUT_EVENT_TYPE_JOYSTICK_MOTION 4
-#define INPUT_EVENT_TYPE_JOYSTICK_BUTTON 5
+#define INPUT_EVENT_TYPE_JOYPAD_MOTION 4
+#define INPUT_EVENT_TYPE_JOYPAD_BUTTON 5
#define INPUT_EVENT_TYPE_SCREEN_TOUCH 6
#define INPUT_EVENT_TYPE_SCREEN_DRAG 7
#define INPUT_EVENT_TYPE_ACTION 8
@@ -166,12 +166,12 @@ int GDAPI godot_input_event_mouse_motion_get_relative_y(godot_input_event p_even
int GDAPI godot_input_event_mouse_motion_get_speed_x(godot_input_event p_event);
int GDAPI godot_input_event_mouse_motion_get_speed_y(godot_input_event p_event);
-int GDAPI godot_input_event_joystick_motion_get_axis(godot_input_event p_event);
-float GDAPI godot_input_event_joystick_motion_get_axis_value(godot_input_event p_event);
+int GDAPI godot_input_event_joypad_motion_get_axis(godot_input_event p_event);
+float GDAPI godot_input_event_joypad_motion_get_axis_value(godot_input_event p_event);
-int GDAPI godot_input_event_joystick_button_get_button_index(godot_input_event p_event);
-godot_bool GDAPI godot_input_event_joystick_button_is_pressed(godot_input_event p_event);
-float GDAPI godot_input_event_joystick_button_get_pressure(godot_input_event p_event);
+int GDAPI godot_input_event_joypad_button_get_button_index(godot_input_event p_event);
+godot_bool GDAPI godot_input_event_joypad_button_is_pressed(godot_input_event p_event);
+float GDAPI godot_input_event_joypad_button_get_pressure(godot_input_event p_event);
int GDAPI godot_input_event_screen_touch_get_index(godot_input_event p_event);
diff --git a/modules/cscript/register_types.cpp b/modules/cscript/register_types.cpp
index 267e5245ed..d2101bbd49 100644
--- a/modules/cscript/register_types.cpp
+++ b/modules/cscript/register_types.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* 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 */
diff --git a/modules/cscript/register_types.h b/modules/cscript/register_types.h
index a0f41eee5d..6614ee3a19 100644
--- a/modules/cscript/register_types.h
+++ b/modules/cscript/register_types.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* 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 */
diff --git a/modules/dds/config.py b/modules/dds/config.py
index 368e97e152..fb920482f5 100644
--- a/modules/dds/config.py
+++ b/modules/dds/config.py
@@ -1,6 +1,7 @@
def can_build(platform):
- return True
+ return True
+
def configure(env):
- pass
+ pass
diff --git a/modules/dds/register_types.cpp b/modules/dds/register_types.cpp
index 0d28e2bbef..917305f543 100644
--- a/modules/dds/register_types.cpp
+++ b/modules/dds/register_types.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* 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 */
diff --git a/modules/dds/register_types.h b/modules/dds/register_types.h
index f9ecfb8ef9..69f47006e2 100644
--- a/modules/dds/register_types.h
+++ b/modules/dds/register_types.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* 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 */
diff --git a/modules/dds/texture_loader_dds.cpp b/modules/dds/texture_loader_dds.cpp
index 0cc84f02f7..5295183c35 100644
--- a/modules/dds/texture_loader_dds.cpp
+++ b/modules/dds/texture_loader_dds.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* 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 */
@@ -74,21 +74,20 @@ struct DDSFormatInfo {
static const DDSFormatInfo dds_format_info[DDS_MAX]={
- {"DXT1",true,false,4,8,Image::FORMAT_BC1},
- {"DXT3",true,false,4,16,Image::FORMAT_BC2},
- {"DXT5",true,false,4,16,Image::FORMAT_BC3},
- {"ATI1",true,false,4,8,Image::FORMAT_BC4},
- {"ATI2",true,false,4,16,Image::FORMAT_BC5},
- {"BGRA8",false,false,1,4,Image::FORMAT_RGBA},
- {"BGR8",false,false,1,3,Image::FORMAT_RGB},
- {"RGBA8",false,false,1,4,Image::FORMAT_RGBA},
- {"RGB8",false,false,1,3,Image::FORMAT_RGB},
- {"BGR5A1",false,false,1,2,Image::FORMAT_RGBA},
- {"BGR565",false,false,1,2,Image::FORMAT_RGB},
- {"BGR10A2",false,false,1,4,Image::FORMAT_RGBA},
- {"INDEXED",false,true,1,1,Image::FORMAT_INDEXED},
- {"GRAYSCALE",false,false,1,1,Image::FORMAT_GRAYSCALE},
- {"GRAYSCALE_ALPHA",false,false,1,2,Image::FORMAT_GRAYSCALE_ALPHA}
+ {"DXT1",true,false,4,8,Image::FORMAT_DXT1},
+ {"DXT3",true,false,4,16,Image::FORMAT_DXT3},
+ {"DXT5",true,false,4,16,Image::FORMAT_DXT5},
+ {"ATI1",true,false,4,8,Image::FORMAT_ATI1},
+ {"ATI2",true,false,4,16,Image::FORMAT_ATI2},
+ {"BGRA8",false,false,1,4,Image::FORMAT_RGBA8},
+ {"BGR8",false,false,1,3,Image::FORMAT_RGB8},
+ {"RGBA8",false,false,1,4,Image::FORMAT_RGBA8},
+ {"RGB8",false,false,1,3,Image::FORMAT_RGB8},
+ {"BGR5A1",false,false,1,2,Image::FORMAT_RGBA8},
+ {"BGR565",false,false,1,2,Image::FORMAT_RGB8},
+ {"BGR10A2",false,false,1,4,Image::FORMAT_RGBA8},
+ {"GRAYSCALE",false,false,1,1,Image::FORMAT_L8},
+ {"GRAYSCALE_ALPHA",false,false,1,2,Image::FORMAT_LA8}
};
@@ -222,9 +221,9 @@ RES ResourceFormatDDS::load(const String &p_path, const String& p_original_path,
if (!(flags&DDSD_MIPMAPCOUNT))
mipmaps=1;
-// print_line("found format: "+String(dds_format_info[dds_format].name));
+ //print_line("found format: "+String(dds_format_info[dds_format].name));
- DVector<uint8_t> src_data;
+ PoolVector<uint8_t> src_data;
const DDSFormatInfo &info=dds_format_info[dds_format];
uint32_t w = width;
@@ -248,9 +247,9 @@ RES ResourceFormatDDS::load(const String &p_path, const String& p_original_path,
}
src_data.resize(size);
- DVector<uint8_t>::Write wb = src_data.write();
+ PoolVector<uint8_t>::Write wb = src_data.write();
f->get_buffer(wb.ptr(),size);
- wb=DVector<uint8_t>::Write();
+ wb=PoolVector<uint8_t>::Write();
} else if (info.palette) {
@@ -282,7 +281,7 @@ RES ResourceFormatDDS::load(const String &p_path, const String& p_original_path,
}
src_data.resize(size + 256*colsize );
- DVector<uint8_t>::Write wb = src_data.write();
+ PoolVector<uint8_t>::Write wb = src_data.write();
f->get_buffer(wb.ptr(),size);
for(int i=0;i<256;i++) {
@@ -297,7 +296,7 @@ RES ResourceFormatDDS::load(const String &p_path, const String& p_original_path,
}
- wb=DVector<uint8_t>::Write();
+ wb=PoolVector<uint8_t>::Write();
} else {
//uncompressed generic...
@@ -317,7 +316,7 @@ RES ResourceFormatDDS::load(const String &p_path, const String& p_original_path,
size=size*2;
src_data.resize(size);
- DVector<uint8_t>::Write wb = src_data.write();
+ PoolVector<uint8_t>::Write wb = src_data.write();
f->get_buffer(wb.ptr(),size);
@@ -450,7 +449,7 @@ RES ResourceFormatDDS::load(const String &p_path, const String& p_original_path,
}
- wb=DVector<uint8_t>::Write();
+ wb=PoolVector<uint8_t>::Write();
}
@@ -474,12 +473,12 @@ void ResourceFormatDDS::get_recognized_extensions(List<String> *p_extensions) co
bool ResourceFormatDDS::handles_type(const String& p_type) const {
- return ObjectTypeDB::is_type(p_type,"Texture");
+ return ClassDB::is_parent_class(p_type,"Texture");
}
String ResourceFormatDDS::get_resource_type(const String &p_path) const {
- if (p_path.extension().to_lower()=="dds")
+ if (p_path.get_extension().to_lower()=="dds")
return "ImageTexture";
return "";
}
diff --git a/modules/dds/texture_loader_dds.h b/modules/dds/texture_loader_dds.h
index 371eb1858c..d09af680c7 100644
--- a/modules/dds/texture_loader_dds.h
+++ b/modules/dds/texture_loader_dds.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* 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 */
diff --git a/modules/enet/SCsub b/modules/enet/SCsub
index 5175803f44..fb22d1cff0 100644
--- a/modules/enet/SCsub
+++ b/modules/enet/SCsub
@@ -7,22 +7,22 @@ Import('env_modules')
env_enet = env_modules.Clone()
-if (env["enet"] != "system"): # builtin
- thirdparty_dir = "#thirdparty/enet/"
- thirdparty_sources = [
- "callbacks.c",
- "compress.c",
- "host.c",
- "list.c",
- "packet.c",
- "peer.c",
- "protocol.c",
- "unix.c",
- "win32.c",
- ]
- thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
+if (env['builtin_enet'] != 'no'):
+ thirdparty_dir = "#thirdparty/enet/"
+ thirdparty_sources = [
+ "callbacks.c",
+ "compress.c",
+ "host.c",
+ "list.c",
+ "packet.c",
+ "peer.c",
+ "protocol.c",
+ "unix.c",
+ "win32.c",
+ ]
+ thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
- env_enet.add_source_files(env.modules_sources, thirdparty_sources)
- env_enet.Append(CPPPATH = [thirdparty_dir])
+ env_enet.add_source_files(env.modules_sources, thirdparty_sources)
+ env_enet.Append(CPPPATH=[thirdparty_dir])
env_enet.add_source_files(env.modules_sources, "*.cpp")
diff --git a/modules/enet/config.py b/modules/enet/config.py
index 368e97e152..fb920482f5 100644
--- a/modules/enet/config.py
+++ b/modules/enet/config.py
@@ -1,6 +1,7 @@
def can_build(platform):
- return True
+ return True
+
def configure(env):
- pass
+ pass
diff --git a/modules/enet/networked_multiplayer_enet.cpp b/modules/enet/networked_multiplayer_enet.cpp
index a82283591d..d10634e9ea 100644
--- a/modules/enet/networked_multiplayer_enet.cpp
+++ b/modules/enet/networked_multiplayer_enet.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* 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 */
@@ -77,7 +77,7 @@ Error NetworkedMultiplayerENet::create_server(int p_port, int p_max_clients, int
Error NetworkedMultiplayerENet::create_client(const IP_Address& p_ip, int p_port, int p_in_bandwidth, int p_out_bandwidth){
ERR_FAIL_COND_V(active,ERR_ALREADY_IN_USE);
- ERR_FAIL_COND_V(p_ip.type != IP_Address::TYPE_IPV4, ERR_INVALID_PARAMETER);
+ ERR_FAIL_COND_V(!p_ip.is_ipv4(), ERR_INVALID_PARAMETER);
host = enet_host_create (NULL /* create a client host */,
1 /* only allow 1 outgoing connection */,
@@ -91,7 +91,7 @@ Error NetworkedMultiplayerENet::create_client(const IP_Address& p_ip, int p_port
_setup_compressor();
ENetAddress address;
- address.host=p_ip.field32[0];
+ address.host=*((uint32_t *)p_ip.get_ipv4());
address.port=p_port;
//enet_address_set_host (& address, "localhost");
@@ -150,8 +150,7 @@ void NetworkedMultiplayerENet::poll(){
}
IP_Address ip;
- ip.type = IP_Address::TYPE_IPV4;
- ip.field32[0]=event.peer -> address.host;
+ ip.set_ipv4((uint8_t *)&(event.peer -> address.host));
int *new_id = memnew( int );
*new_id = event.data;
@@ -507,8 +506,10 @@ uint32_t NetworkedMultiplayerENet::_gen_unique_id() const {
(uint32_t)OS::get_singleton()->get_unix_time(), hash );
hash = hash_djb2_one_32(
(uint32_t)OS::get_singleton()->get_data_dir().hash64(), hash );
- //hash = hash_djb2_one_32(
- // (uint32_t)OS::get_singleton()->get_unique_ID().hash64(), hash );
+ /*
+ hash = hash_djb2_one_32(
+ (uint32_t)OS::get_singleton()->get_unique_ID().hash64(), hash );
+ */
hash = hash_djb2_one_32(
(uint32_t)((uint64_t)this), hash ); //rely on aslr heap
hash = hash_djb2_one_32(
@@ -644,12 +645,12 @@ void NetworkedMultiplayerENet::enet_compressor_destroy(void * context){
void NetworkedMultiplayerENet::_bind_methods() {
- ObjectTypeDB::bind_method(_MD("create_server","port","max_clients","in_bandwidth","out_bandwidth"),&NetworkedMultiplayerENet::create_server,DEFVAL(32),DEFVAL(0),DEFVAL(0));
- ObjectTypeDB::bind_method(_MD("create_client","ip","port","in_bandwidth","out_bandwidth"),&NetworkedMultiplayerENet::create_client,DEFVAL(0),DEFVAL(0));
- ObjectTypeDB::bind_method(_MD("close_connection"),&NetworkedMultiplayerENet::close_connection);
- ObjectTypeDB::bind_method(_MD("set_compression_mode","mode"),&NetworkedMultiplayerENet::set_compression_mode);
- ObjectTypeDB::bind_method(_MD("get_compression_mode"),&NetworkedMultiplayerENet::get_compression_mode);
- ObjectTypeDB::bind_method(_MD("set_bind_ip", "ip"),&NetworkedMultiplayerENet::set_bind_ip);
+ ClassDB::bind_method(_MD("create_server","port","max_clients","in_bandwidth","out_bandwidth"),&NetworkedMultiplayerENet::create_server,DEFVAL(32),DEFVAL(0),DEFVAL(0));
+ ClassDB::bind_method(_MD("create_client","ip","port","in_bandwidth","out_bandwidth"),&NetworkedMultiplayerENet::create_client,DEFVAL(0),DEFVAL(0));
+ ClassDB::bind_method(_MD("close_connection"),&NetworkedMultiplayerENet::close_connection);
+ ClassDB::bind_method(_MD("set_compression_mode","mode"),&NetworkedMultiplayerENet::set_compression_mode);
+ ClassDB::bind_method(_MD("get_compression_mode"),&NetworkedMultiplayerENet::get_compression_mode);
+ ClassDB::bind_method(_MD("set_bind_ip", "ip"),&NetworkedMultiplayerENet::set_bind_ip);
BIND_CONSTANT( COMPRESS_NONE );
BIND_CONSTANT( COMPRESS_RANGE_CODER );
@@ -685,6 +686,6 @@ NetworkedMultiplayerENet::~NetworkedMultiplayerENet(){
// sets IP for ENet to bind when using create_server
// if no IP is set, then ENet bind to ENET_HOST_ANY
void NetworkedMultiplayerENet::set_bind_ip(const IP_Address& p_ip){
- ERR_FAIL_COND(p_ip.type != IP_Address::TYPE_IPV4);
- bind_ip=p_ip.field32[0];
+ ERR_FAIL_COND(!p_ip.is_ipv4());
+ bind_ip=*(uint32_t *)p_ip.get_ipv4();
}
diff --git a/modules/enet/networked_multiplayer_enet.h b/modules/enet/networked_multiplayer_enet.h
index 3db318c96a..dcf8c2429b 100644
--- a/modules/enet/networked_multiplayer_enet.h
+++ b/modules/enet/networked_multiplayer_enet.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* 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 */
@@ -35,7 +35,7 @@
class NetworkedMultiplayerENet : public NetworkedMultiplayerPeer {
- OBJ_TYPE(NetworkedMultiplayerENet,NetworkedMultiplayerPeer)
+ GDCLASS(NetworkedMultiplayerENet,NetworkedMultiplayerPeer)
public:
enum CompressionMode {
COMPRESS_NONE,
diff --git a/modules/enet/register_types.cpp b/modules/enet/register_types.cpp
index 630b76ced8..2b4dd35d33 100644
--- a/modules/enet/register_types.cpp
+++ b/modules/enet/register_types.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* 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 */
@@ -40,7 +40,7 @@ void register_enet_types() {
enet_ok=true;
}
- ObjectTypeDB::register_type<NetworkedMultiplayerENet>();
+ ClassDB::register_class<NetworkedMultiplayerENet>();
}
void unregister_enet_types() {
diff --git a/modules/enet/register_types.h b/modules/enet/register_types.h
index 50f34dc67f..14cb1ba868 100644
--- a/modules/enet/register_types.h
+++ b/modules/enet/register_types.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* 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 */
diff --git a/modules/etc1/SCsub b/modules/etc1/SCsub
index ea035fcde3..0c5dc66d2e 100644
--- a/modules/etc1/SCsub
+++ b/modules/etc1/SCsub
@@ -9,12 +9,12 @@ env_etc1 = env_modules.Clone()
# Not unbundled so far since not widespread as shared library
thirdparty_dir = "#thirdparty/rg-etc1/"
thirdparty_sources = [
- "rg_etc1.cpp",
+ "rg_etc1.cpp",
]
thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
env_etc1.add_source_files(env.modules_sources, thirdparty_sources)
-env_etc1.Append(CPPPATH = [thirdparty_dir])
+env_etc1.Append(CPPPATH=[thirdparty_dir])
# Godot source files
env_etc1.add_source_files(env.modules_sources, "*.cpp")
diff --git a/modules/etc1/config.py b/modules/etc1/config.py
index 368e97e152..fb920482f5 100644
--- a/modules/etc1/config.py
+++ b/modules/etc1/config.py
@@ -1,6 +1,7 @@
def can_build(platform):
- return True
+ return True
+
def configure(env):
- pass
+ pass
diff --git a/modules/etc1/image_etc.cpp b/modules/etc1/image_etc.cpp
index cf2384240b..36ff1b86df 100644
--- a/modules/etc1/image_etc.cpp
+++ b/modules/etc1/image_etc.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* 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 */
@@ -37,19 +37,19 @@ static void _decompress_etc(Image *p_img) {
int imgw = p_img->get_width();
int imgh = p_img->get_height();
- DVector<uint8_t> src=p_img->get_data();
- DVector<uint8_t> dst;
+ PoolVector<uint8_t> src=p_img->get_data();
+ PoolVector<uint8_t> dst;
- DVector<uint8_t>::Read r = src.read();
+ PoolVector<uint8_t>::Read r = src.read();
- int mmc=p_img->get_mipmaps();
+ int mmc=p_img->get_mipmap_count();
for(int i=0;i<=mmc;i++) {
dst.resize(dst.size()+imgw*imgh*3);
const uint8_t *srcbr=&r[p_img->get_mipmap_offset(i)];
- DVector<uint8_t>::Write w = dst.write();
+ PoolVector<uint8_t>::Write w = dst.write();
uint8_t *wptr = &w[dst.size()-imgw*imgh*3];
@@ -91,11 +91,11 @@ static void _decompress_etc(Image *p_img) {
}
- r=DVector<uint8_t>::Read();
+ r=PoolVector<uint8_t>::Read();
//print_line("Re Creating ETC into regular image: w "+itos(p_img->get_width())+" h "+itos(p_img->get_height())+" mm "+itos(p_img->get_mipmaps()));
- *p_img=Image(p_img->get_width(),p_img->get_height(),p_img->get_mipmaps(),Image::FORMAT_RGB,dst);
- if (p_img->get_mipmaps())
- p_img->generate_mipmaps(-1,true);
+ *p_img=Image(p_img->get_width(),p_img->get_height(),p_img->has_mipmaps(),Image::FORMAT_RGB8,dst);
+ if (p_img->has_mipmaps())
+ p_img->generate_mipmaps(true);
}
@@ -108,18 +108,18 @@ static void _compress_etc(Image *p_img) {
ERR_FAIL_COND( nearest_power_of_2(imgw)!=imgw || nearest_power_of_2(imgh)!=imgh );
- if (img.get_format()!=Image::FORMAT_RGB)
- img.convert(Image::FORMAT_RGB);
+ if (img.get_format()!=Image::FORMAT_RGB8)
+ img.convert(Image::FORMAT_RGB8);
- int mmc=img.get_mipmaps();
+ int mmc=img.get_mipmap_count();
if (mmc==0)
img.generate_mipmaps(); // force mipmaps, so it works on most hardware
- DVector<uint8_t> res_data;
- DVector<uint8_t> dst_data;
- DVector<uint8_t>::Read r = img.get_data().read();
+ PoolVector<uint8_t> res_data;
+ PoolVector<uint8_t> dst_data;
+ PoolVector<uint8_t>::Read r = img.get_data().read();
int mc=0;
@@ -134,17 +134,17 @@ static void _compress_etc(Image *p_img) {
const uint8_t *src = &r[img.get_mipmap_offset(i)];
int mmsize = MAX(bw,1)*MAX(bh,1)*8;
dst_data.resize(dst_data.size()+mmsize);
- DVector<uint8_t>::Write w=dst_data.write();
+ PoolVector<uint8_t>::Write w=dst_data.write();
uint8_t *dst = &w[dst_data.size()-mmsize];
-// print_line("bh: "+itos(bh)+" bw: "+itos(bw));
+ //print_line("bh: "+itos(bh)+" bw: "+itos(bw));
for(int y=0;y<bh;y++) {
for(int x=0;x<bw;x++) {
-// print_line("x: "+itos(x)+" y: "+itos(y));
+ //print_line("x: "+itos(x)+" y: "+itos(y));
uint8_t block[4*4*4];
zeromem(block,4*4*4);
@@ -186,7 +186,7 @@ static void _compress_etc(Image *p_img) {
}
- *p_img=Image(p_img->get_width(),p_img->get_height(),mc-1,Image::FORMAT_ETC,dst_data);
+ *p_img=Image(p_img->get_width(),p_img->get_height(),(mc-1)?true:false,Image::FORMAT_ETC,dst_data);
}
diff --git a/modules/etc1/image_etc.h b/modules/etc1/image_etc.h
index edcff39bfd..6ab10126f8 100644
--- a/modules/etc1/image_etc.h
+++ b/modules/etc1/image_etc.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* 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 */
diff --git a/modules/etc1/register_types.cpp b/modules/etc1/register_types.cpp
index e9eba6c864..d02ef83478 100644
--- a/modules/etc1/register_types.cpp
+++ b/modules/etc1/register_types.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* 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 */
diff --git a/modules/etc1/register_types.h b/modules/etc1/register_types.h
index bc26699d54..fe92496cea 100644
--- a/modules/etc1/register_types.h
+++ b/modules/etc1/register_types.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* 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 */
diff --git a/modules/etc1/texture_loader_pkm.cpp b/modules/etc1/texture_loader_pkm.cpp
index 275afc1fd6..e720e1fb4c 100644
--- a/modules/etc1/texture_loader_pkm.cpp
+++ b/modules/etc1/texture_loader_pkm.cpp
@@ -43,13 +43,13 @@ RES ResourceFormatPKM::load(const String &p_path, const String& p_original_path,
h.origWidth = f->get_16();
h.origHeight = f->get_16();
- DVector<uint8_t> src_data;
+ PoolVector<uint8_t> src_data;
uint32_t size = h.texWidth * h.texHeight / 2;
src_data.resize(size);
- DVector<uint8_t>::Write wb = src_data.write();
+ PoolVector<uint8_t>::Write wb = src_data.write();
f->get_buffer(wb.ptr(),size);
- wb=DVector<uint8_t>::Write();
+ wb=PoolVector<uint8_t>::Write();
int mipmaps = h.format;
int width = h.origWidth;
@@ -73,12 +73,12 @@ void ResourceFormatPKM::get_recognized_extensions(List<String> *p_extensions) co
bool ResourceFormatPKM::handles_type(const String& p_type) const {
- return ObjectTypeDB::is_type(p_type,"Texture");
+ return ClassDB::is_parent_class(p_type,"Texture");
}
String ResourceFormatPKM::get_resource_type(const String &p_path) const {
- if (p_path.extension().to_lower()=="pkm")
+ if (p_path.get_extension().to_lower()=="pkm")
return "ImageTexture";
return "";
}
diff --git a/modules/freetype/SCsub b/modules/freetype/SCsub
index 1f759dee9a..e4dd1c36a0 100644
--- a/modules/freetype/SCsub
+++ b/modules/freetype/SCsub
@@ -5,66 +5,66 @@ Import('env')
# Not building in a separate env as core needs it
# Thirdparty source files
-if (env["freetype"] != "system"): # builtin
- thirdparty_dir = "#thirdparty/freetype/"
- thirdparty_sources = [
- "src/autofit/autofit.c",
- "src/base/ftapi.c",
- "src/base/ftbase.c",
- "src/base/ftbbox.c",
- "src/base/ftbdf.c",
- "src/base/ftbitmap.c",
- "src/base/ftcid.c",
- "src/base/ftdebug.c",
- "src/base/ftfntfmt.c",
- "src/base/ftfstype.c",
- "src/base/ftgasp.c",
- "src/base/ftglyph.c",
- "src/base/ftgxval.c",
- "src/base/ftinit.c",
- "src/base/ftlcdfil.c",
- "src/base/ftmm.c",
- "src/base/ftotval.c",
- "src/base/ftpatent.c",
- "src/base/ftpfr.c",
- "src/base/ftpic.c",
- "src/base/ftstroke.c",
- "src/base/ftsynth.c",
- "src/base/ftsystem.c",
- "src/base/fttype1.c",
- "src/base/ftwinfnt.c",
- "src/bdf/bdf.c",
- "src/cache/ftcache.c",
- "src/cff/cff.c",
- "src/cid/type1cid.c",
- "src/gxvalid/gxvalid.c",
- "src/otvalid/otvalid.c",
- "src/pcf/pcf.c",
- "src/pfr/pfr.c",
- "src/psaux/psaux.c",
- "src/pshinter/pshinter.c",
- "src/psnames/psnames.c",
- "src/raster/raster.c",
- "src/sfnt/sfnt.c",
- "src/smooth/smooth.c",
- "src/truetype/truetype.c",
- "src/type1/type1.c",
- "src/type42/type42.c",
- "src/winfonts/winfnt.c",
- ]
- thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
+if (env['builtin_freetype'] != 'no'):
+ thirdparty_dir = "#thirdparty/freetype/"
+ thirdparty_sources = [
+ "src/autofit/autofit.c",
+ "src/base/ftapi.c",
+ "src/base/ftbase.c",
+ "src/base/ftbbox.c",
+ "src/base/ftbdf.c",
+ "src/base/ftbitmap.c",
+ "src/base/ftcid.c",
+ "src/base/ftdebug.c",
+ "src/base/ftfntfmt.c",
+ "src/base/ftfstype.c",
+ "src/base/ftgasp.c",
+ "src/base/ftglyph.c",
+ "src/base/ftgxval.c",
+ "src/base/ftinit.c",
+ "src/base/ftlcdfil.c",
+ "src/base/ftmm.c",
+ "src/base/ftotval.c",
+ "src/base/ftpatent.c",
+ "src/base/ftpfr.c",
+ "src/base/ftpic.c",
+ "src/base/ftstroke.c",
+ "src/base/ftsynth.c",
+ "src/base/ftsystem.c",
+ "src/base/fttype1.c",
+ "src/base/ftwinfnt.c",
+ "src/bdf/bdf.c",
+ "src/cache/ftcache.c",
+ "src/cff/cff.c",
+ "src/cid/type1cid.c",
+ "src/gxvalid/gxvalid.c",
+ "src/otvalid/otvalid.c",
+ "src/pcf/pcf.c",
+ "src/pfr/pfr.c",
+ "src/psaux/psaux.c",
+ "src/pshinter/pshinter.c",
+ "src/psnames/psnames.c",
+ "src/raster/raster.c",
+ "src/sfnt/sfnt.c",
+ "src/smooth/smooth.c",
+ "src/truetype/truetype.c",
+ "src/type1/type1.c",
+ "src/type42/type42.c",
+ "src/winfonts/winfnt.c",
+ ]
+ thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
- # Include header for WinRT to fix build issues
- if "platform" in env and env["platform"] == "winrt":
- env.Append(CCFLAGS = ['/FI', '"modules/freetype/winrtdef.h"'])
+ # Include header for UWP to fix build issues
+ if "platform" in env and env["platform"] == "uwp":
+ env.Append(CCFLAGS=['/FI', '"modules/freetype/uwpdef.h"'])
- env.Append(CPPPATH = [thirdparty_dir, thirdparty_dir + "/include"])
+ env.Append(CPPPATH=[thirdparty_dir, thirdparty_dir + "/include"])
- # also requires libpng headers
- if (env["libpng"] != "system"): # builtin
- env.Append(CPPPATH = ["#thirdparty/libpng"])
+ # also requires libpng headers
+ if (env['builtin_libpng'] != 'no'):
+ env.Append(CPPPATH=["#thirdparty/libpng"])
- """ FIXME: Remove this commented code if Windows can handle the monolithic lib
+ """ FIXME: Remove this commented code if Windows can handle the monolithic lib
# fix for Windows' shell miserably failing on long lines, split in two libraries
half1 = []
half2 = []
@@ -80,11 +80,11 @@ if (env["freetype"] != "system"): # builtin
env.Append(LIBS = [lib])
"""
- lib = env.Library("freetype_builtin", thirdparty_sources)
- env.Append(LIBS = [lib])
+ lib = env.Library("freetype_builtin", thirdparty_sources)
+ env.Append(LIBS=[lib])
# Godot source files
env.add_source_files(env.modules_sources, "*.cpp")
-env.Append(CCFLAGS = ['-DFREETYPE_ENABLED'])
+env.Append(CCFLAGS=['-DFREETYPE_ENABLED'])
Export('env')
diff --git a/modules/freetype/config.py b/modules/freetype/config.py
index 368e97e152..fb920482f5 100644
--- a/modules/freetype/config.py
+++ b/modules/freetype/config.py
@@ -1,6 +1,7 @@
def can_build(platform):
- return True
+ return True
+
def configure(env):
- pass
+ pass
diff --git a/modules/freetype/register_types.cpp b/modules/freetype/register_types.cpp
index 2b9f47f54c..2579a925d4 100644
--- a/modules/freetype/register_types.cpp
+++ b/modules/freetype/register_types.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* 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 */
diff --git a/modules/freetype/register_types.h b/modules/freetype/register_types.h
index 326cd2e6ea..2837898123 100644
--- a/modules/freetype/register_types.h
+++ b/modules/freetype/register_types.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* 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 */
diff --git a/modules/freetype/winrtdef.h b/modules/freetype/uwpdef.h
index 69c6baf532..b4aabb1929 100644
--- a/modules/freetype/winrtdef.h
+++ b/modules/freetype/uwpdef.h
@@ -1,11 +1,11 @@
/*************************************************************************/
-/* winrtdef.h */
+/* uwpdef.h */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* 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 */
diff --git a/modules/gdscript/config.py b/modules/gdscript/config.py
index ea7e83378a..5698a37295 100644
--- a/modules/gdscript/config.py
+++ b/modules/gdscript/config.py
@@ -1,11 +1,8 @@
def can_build(platform):
- return True
+ return True
def configure(env):
- pass
-
-
-
+ pass
diff --git a/modules/gdscript/gd_compiler.cpp b/modules/gdscript/gd_compiler.cpp
index b75b13551e..398c2cf82a 100644
--- a/modules/gdscript/gd_compiler.cpp
+++ b/modules/gdscript/gd_compiler.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* 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 */
@@ -29,6 +29,31 @@
#include "gd_compiler.h"
#include "gd_script.h"
+bool GDCompiler::_is_class_member_property(CodeGen & codegen, const StringName & p_name) {
+
+ if (!codegen.function_node || codegen.function_node->_static)
+ return false;
+
+ return _is_class_member_property(codegen.script,p_name);
+}
+
+bool GDCompiler::_is_class_member_property(GDScript *owner, const StringName & p_name) {
+
+
+ GDScript *scr = owner;
+ GDNativeClass *nc=NULL;
+ while(scr) {
+
+ if (scr->native.is_valid())
+ nc=scr->native.ptr();
+ scr=scr->_base;
+ }
+
+ ERR_FAIL_COND_V(!nc,false);
+
+ return ClassDB::has_property(nc->get_name(),p_name);
+}
+
void GDCompiler::_set_error(const String& p_error,const GDParser::Node *p_node) {
@@ -164,6 +189,17 @@ int GDCompiler::_parse_expression(CodeGen& codegen,const GDParser::Node *p_expre
StringName identifier = in->name;
+
+ if (_is_class_member_property(codegen,identifier)) {
+ //get property
+ codegen.opcodes.push_back(GDFunction::OPCODE_GET_MEMBER); // perform operator
+ codegen.opcodes.push_back(codegen.get_name_map_pos(identifier)); // argument 2 (unary only takes one parameter)
+ int dst_addr=(p_stack_level)|(GDFunction::ADDR_TYPE_STACK<<GDFunction::ADDR_BITS);
+ codegen.opcodes.push_back(dst_addr); // append the stack level as destination address of the opcode
+ codegen.alloc_stack(p_stack_level);
+ return dst_addr;
+ }
+
// TRY STACK!
if (!p_initializer && codegen.stack_identifiers.has(identifier)) {
@@ -208,7 +244,7 @@ int GDCompiler::_parse_expression(CodeGen& codegen,const GDParser::Node *p_expre
if (nc) {
bool success=false;
- int constant = ObjectTypeDB::get_integer_constant(nc->get_name(),identifier,&success);
+ int constant = ClassDB::get_integer_constant(nc->get_name(),identifier,&success);
if (success) {
Variant key=constant;
int idx;
@@ -776,6 +812,8 @@ int GDCompiler::_parse_expression(CodeGen& codegen,const GDParser::Node *p_expre
/* Find chain of sets */
+ StringName assign_property;
+
List<GDParser::OperatorNode*> chain;
{
@@ -784,8 +822,20 @@ int GDCompiler::_parse_expression(CodeGen& codegen,const GDParser::Node *p_expre
while(true) {
chain.push_back(n);
- if (n->arguments[0]->type!=GDParser::Node::TYPE_OPERATOR)
+ if (n->arguments[0]->type!=GDParser::Node::TYPE_OPERATOR) {
+
+ //check for a built-in property
+ if (n->arguments[0]->type==GDParser::Node::TYPE_IDENTIFIER) {
+
+ GDParser::IdentifierNode *identifier = static_cast<GDParser::IdentifierNode*>(n->arguments[0]);
+ if (_is_class_member_property(codegen,identifier->name)) {
+ assign_property = identifier->name;
+
+ }
+
+ }
break;
+ }
n = static_cast<GDParser::OperatorNode*>(n->arguments[0]);
if (n->op!=GDParser::OperatorNode::OP_INDEX && n->op!=GDParser::OperatorNode::OP_INDEX_NAMED)
break;
@@ -810,6 +860,17 @@ int GDCompiler::_parse_expression(CodeGen& codegen,const GDParser::Node *p_expre
Vector<int> setchain;
+
+ if (assign_property!=StringName()) {
+
+ // recover and assign at the end, this allows stuff like
+ // position.x+=2.0
+ // in Node2D
+ setchain.push_back(prev_pos);
+ setchain.push_back(codegen.get_name_map_pos(assign_property));
+ setchain.push_back(GDFunction::OPCODE_SET_MEMBER);
+ }
+
for(List<GDParser::OperatorNode*>::Element *E=chain.back();E;E=E->prev()) {
@@ -840,7 +901,7 @@ int GDCompiler::_parse_expression(CodeGen& codegen,const GDParser::Node *p_expre
}
- if (key_idx<0)
+ if (key_idx<0) //error
return key_idx;
codegen.opcodes.push_back(named ? GDFunction::OPCODE_GET_NAMED : GDFunction::OPCODE_GET);
@@ -852,7 +913,10 @@ int GDCompiler::_parse_expression(CodeGen& codegen,const GDParser::Node *p_expre
codegen.opcodes.push_back(dst_pos);
+
//add in reverse order, since it will be reverted
+
+
setchain.push_back(dst_pos);
setchain.push_back(key_idx);
setchain.push_back(prev_pos);
@@ -881,7 +945,7 @@ int GDCompiler::_parse_expression(CodeGen& codegen,const GDParser::Node *p_expre
}
- if (set_index<0)
+ if (set_index<0) //error
return set_index;
if (set_index&GDFunction::ADDR_TYPE_STACK<<GDFunction::ADDR_BITS) {
@@ -891,7 +955,7 @@ int GDCompiler::_parse_expression(CodeGen& codegen,const GDParser::Node *p_expre
int set_value = _parse_assign_right_expression(codegen,on,slevel+1);
- if (set_value<0)
+ if (set_value<0) //error
return set_value;
codegen.opcodes.push_back(named?GDFunction::OPCODE_SET_NAMED:GDFunction::OPCODE_SET);
@@ -899,20 +963,36 @@ int GDCompiler::_parse_expression(CodeGen& codegen,const GDParser::Node *p_expre
codegen.opcodes.push_back(set_index);
codegen.opcodes.push_back(set_value);
- for(int i=0;i<setchain.size();i+=4) {
+ for(int i=0;i<setchain.size();i++) {
- codegen.opcodes.push_back(setchain[i+0]);
- codegen.opcodes.push_back(setchain[i+1]);
- codegen.opcodes.push_back(setchain[i+2]);
- codegen.opcodes.push_back(setchain[i+3]);
+ codegen.opcodes.push_back(setchain[i]);
}
return retval;
+ } else if (on->arguments[0]->type==GDParser::Node::TYPE_IDENTIFIER && _is_class_member_property(codegen,static_cast<GDParser::IdentifierNode*>(on->arguments[0])->name)) {
+ //assignment to member property
+
+ int slevel = p_stack_level;
+
+ int src_address = _parse_assign_right_expression(codegen,on,slevel);
+ if (src_address<0)
+ return -1;
+
+ StringName name = static_cast<GDParser::IdentifierNode*>(on->arguments[0])->name;
+
+ codegen.opcodes.push_back(GDFunction::OPCODE_SET_MEMBER);
+ codegen.opcodes.push_back(codegen.get_name_map_pos(name));
+ codegen.opcodes.push_back(src_address);
+
+ return GDFunction::ADDR_TYPE_NIL<<GDFunction::ADDR_BITS;
} else {
- //ASSIGNMENT MODE!!
+
+
+
+ //REGULAR ASSIGNMENT MODE!!
int slevel = p_stack_level;
@@ -1019,7 +1099,72 @@ Error GDCompiler::_parse_block(CodeGen& codegen,const GDParser::BlockNode *p_blo
switch(cf->cf_type) {
-
+ case GDParser::ControlFlowNode::CF_MATCH: {
+ GDParser::MatchNode *match = cf->match;
+
+ GDParser::IdentifierNode *id = memnew(GDParser::IdentifierNode);
+ id->name = "#match_value";
+
+ // var #match_value
+ // copied because there is no _parse_statement :(
+ codegen.add_stack_identifier(id->name, p_stack_level++);
+ codegen.alloc_stack(p_stack_level);
+ new_identifiers++;
+
+ GDParser::OperatorNode *op = memnew(GDParser::OperatorNode);
+ op->op=GDParser::OperatorNode::OP_ASSIGN;
+ op->arguments.push_back(id);
+ op->arguments.push_back(match->val_to_match);
+
+ int ret = _parse_expression(codegen, op, p_stack_level);
+ if (ret < 0) {
+ return ERR_PARSE_ERROR;
+ }
+
+ // break address
+ codegen.opcodes.push_back(GDFunction::OPCODE_JUMP);
+ codegen.opcodes.push_back(codegen.opcodes.size() + 3);
+ int break_addr = codegen.opcodes.size();
+ codegen.opcodes.push_back(GDFunction::OPCODE_JUMP);
+ codegen.opcodes.push_back(0); // break addr
+
+ for (int j = 0; j < match->compiled_pattern_branches.size(); j++) {
+ GDParser::MatchNode::CompiledPatternBranch branch = match->compiled_pattern_branches[j];
+
+ // jump over continue
+ // jump unconditionally
+ // continue address
+ // compile the condition
+ int ret = _parse_expression(codegen, branch.compiled_pattern, p_stack_level);
+ if (ret < 0) {
+ return ERR_PARSE_ERROR;
+ }
+
+ codegen.opcodes.push_back(GDFunction::OPCODE_JUMP_IF);
+ codegen.opcodes.push_back(ret);
+ codegen.opcodes.push_back(codegen.opcodes.size() + 3);
+ int continue_addr = codegen.opcodes.size();
+ codegen.opcodes.push_back(GDFunction::OPCODE_JUMP);
+ codegen.opcodes.push_back(0);
+
+
+
+ Error err = _parse_block(codegen, branch.body, p_stack_level, p_break_addr, continue_addr);
+ if (err) {
+ return ERR_PARSE_ERROR;
+ }
+
+ codegen.opcodes.push_back(GDFunction::OPCODE_JUMP);
+ codegen.opcodes.push_back(break_addr);
+
+ codegen.opcodes[continue_addr + 1] = codegen.opcodes.size();
+ }
+
+ codegen.opcodes[break_addr + 1] = codegen.opcodes.size();
+
+
+ } break;
+
case GDParser::ControlFlowNode::CF_IF: {
#ifdef DEBUG_ENABLED
@@ -1211,6 +1356,11 @@ Error GDCompiler::_parse_block(CodeGen& codegen,const GDParser::BlockNode *p_blo
const GDParser::LocalVarNode *lv = static_cast<const GDParser::LocalVarNode*>(s);
+ if (_is_class_member_property(codegen,lv->name)) {
+ _set_error("Name for local variable '"+String(lv->name)+"' can't shadow class property of the same name.",lv);
+ return ERR_ALREADY_EXISTS;
+ }
+
codegen.add_stack_identifier(lv->name,p_stack_level++);
codegen.alloc_stack(p_stack_level);
new_identifiers++;
@@ -1249,6 +1399,10 @@ Error GDCompiler::_parse_function(GDScript *p_script,const GDParser::ClassNode *
if (p_func) {
for(int i=0;i<p_func->arguments.size();i++) {
+ if (_is_class_member_property(p_script,p_func->arguments[i])) {
+ _set_error("Name for argument '"+String(p_func->arguments[i])+"' can't shadow class property of the same name.",p_func);
+ return ERR_ALREADY_EXISTS;
+ }
codegen.add_stack_identifier(p_func->arguments[i],i);
#ifdef TOOLS_ENABLED
argnames.push_back(p_func->arguments[i]);
@@ -1331,9 +1485,10 @@ Error GDCompiler::_parse_function(GDScript *p_script,const GDParser::ClassNode *
GDFunction *gdfunc=NULL;
- //if (String(p_func->name)=="") { //initializer func
- // gdfunc = &p_script->initializer;
-
+ /*
+ if (String(p_func->name)=="") { //initializer func
+ gdfunc = &p_script->initializer;
+ */
//} else { //regular func
p_script->member_functions[func_name]=memnew(GDFunction);
gdfunc = p_script->member_functions[func_name];
@@ -1421,7 +1576,7 @@ Error GDCompiler::_parse_function(GDScript *p_script,const GDParser::ClassNode *
//funciton and class
if (p_class->name) {
- signature+="::"+String(p_class->name)+"."+String(func_name);;
+ signature+="::"+String(p_class->name)+"."+String(func_name);
} else {
signature+="::"+String(func_name);
}
@@ -1640,9 +1795,14 @@ Error GDCompiler::_parse_class(GDScript *p_script, GDScript *p_owner, const GDPa
}
+ }else {
+ // without extends, implicitly extend Reference
+ int native_idx = GDScriptLanguage::get_singleton()->get_global_map()["Reference"];
+ native = GDScriptLanguage::get_singleton()->get_global_array()[native_idx];
+ ERR_FAIL_COND_V(native.is_null(), ERR_BUG);
+ p_script->native=native;
}
-
//print_line("Script: "+p_script->get_path()+" indices: "+itos(p_script->member_indices.size()));
@@ -1653,6 +1813,10 @@ Error GDCompiler::_parse_class(GDScript *p_script, GDScript *p_owner, const GDPa
_set_error("Member '"+name+"' already exists (in current or parent class)",p_class);
return ERR_ALREADY_EXISTS;
}
+ if (_is_class_member_property(p_script,name)) {
+ _set_error("Member '"+name+"' already exists as a class property.",p_class);
+ return ERR_ALREADY_EXISTS;
+ }
if (p_class->variables[i]._export.type!=Variant::NIL) {
@@ -1691,6 +1855,11 @@ Error GDCompiler::_parse_class(GDScript *p_script, GDScript *p_owner, const GDPa
StringName name = p_class->constant_expressions[i].identifier;
ERR_CONTINUE( p_class->constant_expressions[i].expression->type!=GDParser::Node::TYPE_CONSTANT );
+ if (_is_class_member_property(p_script,name)) {
+ _set_error("Member '"+name+"' already exists as a class property.",p_class);
+ return ERR_ALREADY_EXISTS;
+ }
+
GDParser::ConstantNode *constant = static_cast<GDParser::ConstantNode*>(p_class->constant_expressions[i].expression);
p_script->constants.insert(name,constant->value);
@@ -1723,7 +1892,7 @@ Error GDCompiler::_parse_class(GDScript *p_script, GDScript *p_owner, const GDPa
}
if (native.is_valid()) {
- if (ObjectTypeDB::has_signal(native->get_name(),name)) {
+ if (ClassDB::has_signal(native->get_name(),name)) {
_set_error("Signal '"+name+"' redefined (original in native class '"+String(native->get_name())+"')",p_class);
return ERR_ALREADY_EXISTS;
}
diff --git a/modules/gdscript/gd_compiler.h b/modules/gdscript/gd_compiler.h
index 7cf575e3d6..dd211a852c 100644
--- a/modules/gdscript/gd_compiler.h
+++ b/modules/gdscript/gd_compiler.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* 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 */
@@ -37,6 +37,7 @@ class GDCompiler {
const GDParser *parser;
struct CodeGen {
+
GDScript *script;
const GDParser::ClassNode *class_node;
const GDParser::FunctionNode *function_node;
@@ -134,6 +135,9 @@ class GDCompiler {
Ref<GDScript> _parse_class(GDParser::ClassNode *p_class);
#endif
+ bool _is_class_member_property(CodeGen & codegen, const StringName & p_name);
+ bool _is_class_member_property(GDScript *owner, const StringName & p_name);
+
void _set_error(const String& p_error,const GDParser::Node *p_node);
bool _create_unary_operator(CodeGen& codegen,const GDParser::OperatorNode *on,Variant::Operator op, int p_stack_level);
diff --git a/modules/gdscript/gd_editor.cpp b/modules/gdscript/gd_editor.cpp
index c3e59836a2..114a25feeb 100644
--- a/modules/gdscript/gd_editor.cpp
+++ b/modules/gdscript/gd_editor.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* 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 */
@@ -325,7 +325,7 @@ void GDScriptLanguage::get_public_constants(List<Pair<String,Variant> > *p_const
p_constants->push_back(pi);
}
-String GDScriptLanguage::make_function(const String& p_class,const String& p_name,const StringArray& p_args) const {
+String GDScriptLanguage::make_function(const String& p_class,const String& p_name,const PoolStringArray& p_args) const {
String s="func "+p_name+"(";
if (p_args.size()) {
@@ -364,11 +364,13 @@ static GDCompletionIdentifier _get_type_from_variant(const Variant& p_variant) {
if (p_variant.get_type()==Variant::OBJECT) {
Object *obj = p_variant;
if (obj) {
- //if (obj->cast_to<GDNativeClass>()) {
- // t.obj_type=obj->cast_to<GDNativeClass>()->get_name();
- // t.value=Variant();
- //} else {
- t.obj_type=obj->get_type();
+ /*
+ if (obj->cast_to<GDNativeClass>()) {
+ t.obj_type=obj->cast_to<GDNativeClass>()->get_name();
+ t.value=Variant();
+ } else {
+ */
+ t.obj_type=obj->get_class();
//}
}
}
@@ -614,10 +616,10 @@ static bool _guess_expression_type(GDCompletionContext& context,const GDParser::
}
}
- if (ObjectTypeDB::has_method(base.obj_type,id)) {
+ if (ClassDB::has_method(base.obj_type,id)) {
#ifdef TOOLS_ENABLED
- MethodBind *mb = ObjectTypeDB::get_method(base.obj_type,id);
+ MethodBind *mb = ClassDB::get_method(base.obj_type,id);
PropertyInfo pi = mb->get_argument_info(-1);
//try calling the function if constant and all args are constant, should not crash..
@@ -643,14 +645,14 @@ static bool _guess_expression_type(GDCompletionContext& context,const GDParser::
}
}
- if (all_valid && String(id)=="get_node" && ObjectTypeDB::is_type(base.obj_type,"Node") && args.size()) {
+ if (all_valid && String(id)=="get_node" && ClassDB::is_parent_class(base.obj_type,"Node") && args.size()) {
String arg1=args[0];
if (arg1.begins_with("/root/")) {
String which = arg1.get_slice("/",2);
if (which!="") {
List<PropertyInfo> props;
- Globals::get_singleton()->get_property_list(&props);
+ GlobalConfig::get_singleton()->get_property_list(&props);
//print_line("find singleton");
for(List<PropertyInfo>::Element *E=props.front();E;E=E->next()) {
@@ -662,7 +664,7 @@ static bool _guess_expression_type(GDCompletionContext& context,const GDParser::
String name = s.get_slice("/",1);
//print_line("name: "+name+", which: "+which);
if (name==which) {
- String script = Globals::get_singleton()->get(s);
+ String script = GlobalConfig::get_singleton()->get(s);
if (!script.begins_with("res://")) {
script="res://"+script;
@@ -671,7 +673,7 @@ static bool _guess_expression_type(GDCompletionContext& context,const GDParser::
if (!script.ends_with(".gd")) {
//not a script, try find the script anyway,
//may have some success
- script=script.basename()+".gd";
+ script=script.get_basename()+".gd";
}
if (FileAccess::exists(script)) {
@@ -940,6 +942,15 @@ static bool _guess_expression_type(GDCompletionContext& context,const GDParser::
static bool _guess_identifier_type_in_block(GDCompletionContext& context,int p_line,const StringName& p_identifier,GDCompletionIdentifier &r_type) {
+ GDCompletionIdentifier gdi = _get_native_class(context);
+ if (gdi.obj_type!=StringName()) {
+ bool valid;
+ Variant::Type t = ClassDB::get_property_type(gdi.obj_type,p_identifier,&valid);
+ if (t!=Variant::NIL && valid) {
+ r_type.type=t;
+ return true;
+ }
+ }
const GDParser::Node *last_assign=NULL;
int last_assign_line=-1;
@@ -1068,7 +1079,7 @@ static bool _guess_identifier_type(GDCompletionContext& context,int p_line,const
//this kinda sucks but meh
List<MethodInfo> vmethods;
- ObjectTypeDB::get_virtual_methods(id.obj_type,&vmethods);
+ ClassDB::get_virtual_methods(id.obj_type,&vmethods);
for (List<MethodInfo>::Element *E=vmethods.front();E;E=E->next()) {
@@ -1142,7 +1153,7 @@ static bool _guess_identifier_type(GDCompletionContext& context,int p_line,const
//autoloads as singletons
List<PropertyInfo> props;
- Globals::get_singleton()->get_property_list(&props);
+ GlobalConfig::get_singleton()->get_property_list(&props);
for(List<PropertyInfo>::Element *E=props.front();E;E=E->next()) {
@@ -1152,14 +1163,14 @@ static bool _guess_identifier_type(GDCompletionContext& context,int p_line,const
String name = s.get_slice("/",1);
if (name==String(p_identifier)) {
- String path = Globals::get_singleton()->get(s);
+ String path = GlobalConfig::get_singleton()->get(s);
if (path.begins_with("*")) {
String script =path.substr(1,path.length());
if (!script.ends_with(".gd")) {
//not a script, try find the script anyway,
//may have some success
- script=script.basename()+".gd";
+ script=script.get_basename()+".gd";
}
if (FileAccess::exists(script)) {
@@ -1298,26 +1309,43 @@ static void _find_identifiers_in_class(GDCompletionContext& context,bool p_stati
base=script->get_native();
} else if (nc.is_valid()) {
+ StringName type = nc->get_name();
+
if (!p_only_functions) {
- StringName type = nc->get_name();
+
List<String> constants;
- ObjectTypeDB::get_integer_constant_list(type,&constants);
+ ClassDB::get_integer_constant_list(type,&constants);
for(List<String>::Element *E=constants.front();E;E=E->next()) {
result.insert(E->get());
}
- List<MethodInfo> methods;
- ObjectTypeDB::get_method_list(type,&methods);
- for(List<MethodInfo>::Element *E=methods.front();E;E=E->next()) {
- if (E->get().name.begins_with("_"))
+ List<PropertyInfo> pinfo;
+
+ ClassDB::get_property_list(type,&pinfo);
+
+ for (List<PropertyInfo>::Element *E=pinfo.front();E;E=E->next()) {
+ if (E->get().usage&(PROPERTY_USAGE_GROUP|PROPERTY_USAGE_CATEGORY))
continue;
- if (E->get().arguments.size())
- result.insert(E->get().name+"(");
- else
- result.insert(E->get().name+"()");
+ if (E->get().name.find("/")!=-1)
+ continue;
+ result.insert(E->get().name);
}
+
}
+ List<MethodInfo> methods;
+ ClassDB::get_method_list(type,&methods);
+ for(List<MethodInfo>::Element *E=methods.front();E;E=E->next()) {
+ if (E->get().name.begins_with("_"))
+ continue;
+ if (E->get().arguments.size())
+ result.insert(E->get().name+"(");
+ else
+ result.insert(E->get().name+"()");
+ }
+
+
+
break;
} else
break;
@@ -1367,7 +1395,7 @@ static void _find_identifiers(GDCompletionContext& context,int p_line,bool p_onl
}
static const char*_type_names[Variant::VARIANT_MAX]={
- "null","bool","int","float","String","Vector2","Rect2","Vector3","Matrix32","Plane","Quat","AABB","Matrix3","Transform",
+ "null","bool","int","float","String","Vector2","Rect2","Vector3","Transform2D","Plane","Quat","AABB","Basis","Transform",
"Color","Image","NodePath","RID","Object","InputEvent","Dictionary","Array","RawArray","IntArray","FloatArray","StringArray",
"Vector2Array","Vector3Array","ColorArray"};
@@ -1377,7 +1405,7 @@ static void _find_identifiers(GDCompletionContext& context,int p_line,bool p_onl
//autoload singletons
List<PropertyInfo> props;
- Globals::get_singleton()->get_property_list(&props);
+ GlobalConfig::get_singleton()->get_property_list(&props);
for(List<PropertyInfo>::Element *E=props.front();E;E=E->next()) {
@@ -1385,7 +1413,7 @@ static void _find_identifiers(GDCompletionContext& context,int p_line,bool p_onl
if (!s.begins_with("autoload/"))
continue;
String name = s.get_slice("/",1);
- String path = Globals::get_singleton()->get(s);
+ String path = GlobalConfig::get_singleton()->get(s);
if (path.begins_with("*")) {
result.insert(name);
}
@@ -1470,7 +1498,7 @@ static void _find_type_arguments(GDCompletionContext& context,const GDParser::No
if (id.type==Variant::INPUT_EVENT && String(p_method)=="is_action" && p_argidx==0) {
List<PropertyInfo> pinfo;
- Globals::get_singleton()->get_property_list(&pinfo);
+ GlobalConfig::get_singleton()->get_property_list(&pinfo);
for(List<PropertyInfo>::Element *E=pinfo.front();E;E=E->next()) {
const PropertyInfo &pi=E->get();
@@ -1486,7 +1514,7 @@ static void _find_type_arguments(GDCompletionContext& context,const GDParser::No
} else if (id.type==Variant::OBJECT && id.obj_type!=StringName()) {
- MethodBind *m = ObjectTypeDB::get_method(id.obj_type,p_method);
+ MethodBind *m = ClassDB::get_method(id.obj_type,p_method);
if (!m) {
//not in static method, see script
@@ -1699,7 +1727,7 @@ static void _find_type_arguments(GDCompletionContext& context,const GDParser::No
if (p_argidx==0) {
List<MethodInfo> sigs;
- ObjectTypeDB::get_signal_list(id.obj_type,&sigs);
+ ClassDB::get_signal_list(id.obj_type,&sigs);
if (id.script.is_valid()) {
id.script->get_script_signal_list(&sigs);
@@ -1735,17 +1763,17 @@ static void _find_type_arguments(GDCompletionContext& context,const GDParser::No
}*/
} else {
- if (p_argidx==0 && (String(p_method)=="get_node" || String(p_method)=="has_node") && ObjectTypeDB::is_type(id.obj_type,"Node")) {
+ if (p_argidx==0 && (String(p_method)=="get_node" || String(p_method)=="has_node") && ClassDB::is_parent_class(id.obj_type,"Node")) {
List<PropertyInfo> props;
- Globals::get_singleton()->get_property_list(&props);
+ GlobalConfig::get_singleton()->get_property_list(&props);
for(List<PropertyInfo>::Element *E=props.front();E;E=E->next()) {
String s = E->get().name;
if (!s.begins_with("autoload/"))
continue;
- // print_line("found "+s);
+ //print_line("found "+s);
String name = s.get_slice("/",1);
result.insert("\"/root/"+name+"\"");
}
@@ -1970,12 +1998,12 @@ static void _find_call_arguments(GDCompletionContext& context,const GDParser::No
//guess type..
/*
List<MethodInfo> methods;
- ObjectTypeDB::get_method_list(type,&methods);
+ ClassDB::get_method_list(type,&methods);
for(List<MethodInfo>::Element *E=methods.front();E;E=E->next()) {
- //if (E->get().arguments.size())
- // result.insert(E->get().name+"(");
- //else
- // result.insert(E->get().name+"()");
+ if (E->get().arguments.size())
+ result.insert(E->get().name+"(");
+ else
+ result.insert(E->get().name+"()");
}*/
}
break;
@@ -2063,13 +2091,13 @@ static void _find_call_arguments(GDCompletionContext& context,const GDParser::No
StringName type = nc->get_name();
List<String> constants;
- ObjectTypeDB::get_integer_constant_list(type,&constants);
+ ClassDB::get_integer_constant_list(type,&constants);
for(List<String>::Element *E=constants.front();E;E=E->next()) {
result.insert(E->get());
}
List<MethodInfo> methods;
- ObjectTypeDB::get_method_list(type,&methods);
+ ClassDB::get_method_list(type,&methods);
for(List<MethodInfo>::Element *E=methods.front();E;E=E->next()) {
if (E->get().arguments.size())
result.insert(E->get().name+"(");
@@ -2129,6 +2157,27 @@ Error GDScriptLanguage::complete_code(const String& p_code, const String& p_base
case GDParser::COMPLETION_PARENT_FUNCTION: {
} break;
+ case GDParser::COMPLETION_GET_NODE: {
+
+ if (p_owner) {
+ List<String> opts;
+ p_owner->get_argument_options("get_node",0,&opts);
+
+ for (List<String>::Element *E=opts.front();E;E=E->next()) {
+
+ String opt = E->get().strip_edges();
+ if (opt.begins_with("\"") && opt.ends_with("\"")) {
+ String idopt=opt.substr(1,opt.length()-2);
+ if (idopt.replace("/","_").is_valid_identifier()) {
+ options.insert(idopt);
+ } else {
+ options.insert(opt);
+ }
+ }
+ }
+
+ }
+ } break;
case GDParser::COMPLETION_METHOD:
isfunction=true;
case GDParser::COMPLETION_INDEX: {
@@ -2149,10 +2198,21 @@ Error GDScriptLanguage::complete_code(const String& p_code, const String& p_base
if (gdn.is_valid()) {
StringName cn = gdn->get_name();
List<String> cnames;
- ObjectTypeDB::get_integer_constant_list(cn,&cnames);
+ ClassDB::get_integer_constant_list(cn,&cnames);
for (List<String>::Element *E=cnames.front();E;E=E->next()) {
options.insert(E->get());
}
+
+ List<PropertyInfo> pinfo;
+ ClassDB::get_property_list(cn,&pinfo);
+
+ for (List<PropertyInfo>::Element *E=pinfo.front();E;E=E->next()) {
+ if (E->get().usage&(PROPERTY_USAGE_GROUP|PROPERTY_USAGE_CATEGORY))
+ continue;
+ if (E->get().name.find("/")!=-1)
+ continue;
+ options.insert(E->get().name);
+ }
}
} else if (t.type==Variant::OBJECT && t.obj_type!=StringName()) {
@@ -2288,10 +2348,23 @@ Error GDScriptLanguage::complete_code(const String& p_code, const String& p_base
if (!isfunction) {
- ObjectTypeDB::get_integer_constant_list(t.obj_type,r_options);
+ ClassDB::get_integer_constant_list(t.obj_type,r_options);
+
+ List<PropertyInfo> pinfo;
+ ClassDB::get_property_list(t.obj_type,&pinfo);
+
+ for (List<PropertyInfo>::Element *E=pinfo.front();E;E=E->next()) {
+ if (E->get().usage&(PROPERTY_USAGE_GROUP|PROPERTY_USAGE_CATEGORY))
+ continue;
+ if (E->get().name.find("/")!=-1)
+ continue;
+ r_options->push_back(E->get().name);
+ }
}
+
+
List<MethodInfo> mi;
- ObjectTypeDB::get_method_list(t.obj_type,&mi);
+ ClassDB::get_method_list(t.obj_type,&mi);
for (List<MethodInfo>::Element *E=mi.front();E;E=E->next()) {
if (E->get().name.begins_with("_"))
@@ -2320,8 +2393,8 @@ Error GDScriptLanguage::complete_code(const String& p_code, const String& p_base
"# Key",
"# MouseMotion",
"# MouseButton",
- "# JoystickMotion",
- "# JoystickButton",
+ "# JoypadMotion",
+ "# JoypadButton",
"# ScreenTouch",
"# ScreenDrag",
"# Action"
@@ -2397,7 +2470,7 @@ Error GDScriptLanguage::complete_code(const String& p_code, const String& p_base
if (cid.obj_type!=StringName()) {
List<MethodInfo> vm;
- ObjectTypeDB::get_virtual_methods(cid.obj_type,&vm);
+ ClassDB::get_virtual_methods(cid.obj_type,&vm);
for(List<MethodInfo>::Element *E=vm.front();E;E=E->next()) {
MethodInfo &mi=E->get();
@@ -2433,7 +2506,7 @@ Error GDScriptLanguage::complete_code(const String& p_code, const String& p_base
if (t.type==Variant::OBJECT && t.obj_type!=StringName()) {
List<MethodInfo> sigs;
- ObjectTypeDB::get_signal_list(t.obj_type,&sigs);
+ ClassDB::get_signal_list(t.obj_type,&sigs);
for (List<MethodInfo>::Element *E=sigs.front();E;E=E->next()) {
options.insert("\""+E->get().name+"\"");
}
@@ -2531,7 +2604,7 @@ Error GDScriptLanguage::lookup_code(const String& p_code, const String& p_symbol
//before parsing, try the usual stuff
- if (ObjectTypeDB::type_exists(p_symbol)) {
+ if (ClassDB::class_exists(p_symbol)) {
r_result.type=ScriptLanguage::LookupResult::RESULT_CLASS;
r_result.class_name=p_symbol;
return OK;
@@ -2612,7 +2685,7 @@ Error GDScriptLanguage::lookup_code(const String& p_code, const String& p_symbol
GDCompletionIdentifier identifier = _get_native_class(context);
print_line("identifier: "+String(identifier.obj_type));
- if (ObjectTypeDB::has_method(identifier.obj_type,p_symbol)) {
+ if (ClassDB::has_method(identifier.obj_type,p_symbol)) {
r_result.type=ScriptLanguage::LookupResult::RESULT_CLASS_METHOD;
r_result.class_name=identifier.obj_type;
@@ -2653,7 +2726,7 @@ Error GDScriptLanguage::lookup_code(const String& p_code, const String& p_symbol
GDCompletionIdentifier identifier = _get_native_class(context);
- if (ObjectTypeDB::has_method(identifier.obj_type,p_symbol)) {
+ if (ClassDB::has_method(identifier.obj_type,p_symbol)) {
r_result.type=ScriptLanguage::LookupResult::RESULT_CLASS_METHOD;
r_result.class_name=identifier.obj_type;
@@ -2663,6 +2736,19 @@ Error GDScriptLanguage::lookup_code(const String& p_code, const String& p_symbol
} else {
+ GDCompletionIdentifier gdi = _get_native_class(context);
+ if (gdi.obj_type!=StringName()) {
+ bool valid;
+ Variant::Type t = ClassDB::get_property_type(gdi.obj_type,p_symbol,&valid);
+ if (t!=Variant::NIL && valid) {
+ r_result.type=ScriptLanguage::LookupResult::RESULT_CLASS_PROPERTY;
+ r_result.class_name=gdi.obj_type;
+ r_result.class_member=p_symbol;
+ return OK;
+
+ }
+ }
+
const GDParser::BlockNode *block=context.block;
//search in blocks going up (local var?)
while(block) {
@@ -2731,7 +2817,7 @@ Error GDScriptLanguage::lookup_code(const String& p_code, const String& p_symbol
//guess in autoloads as singletons
List<PropertyInfo> props;
- Globals::get_singleton()->get_property_list(&props);
+ GlobalConfig::get_singleton()->get_property_list(&props);
for(List<PropertyInfo>::Element *E=props.front();E;E=E->next()) {
@@ -2741,14 +2827,14 @@ Error GDScriptLanguage::lookup_code(const String& p_code, const String& p_symbol
String name = s.get_slice("/",1);
if (name==String(p_symbol)) {
- String path = Globals::get_singleton()->get(s);
+ String path = GlobalConfig::get_singleton()->get(s);
if (path.begins_with("*")) {
String script =path.substr(1,path.length());
if (!script.ends_with(".gd")) {
//not a script, try find the script anyway,
//may have some success
- script=script.basename()+".gd";
+ script=script.get_basename()+".gd";
}
if (FileAccess::exists(script)) {
@@ -2777,7 +2863,7 @@ Error GDScriptLanguage::lookup_code(const String& p_code, const String& p_symbol
} else {
r_result.type=ScriptLanguage::LookupResult::RESULT_CLASS;
- r_result.class_name=obj->get_type();
+ r_result.class_name=obj->get_class();
}
return OK;
}
@@ -2828,7 +2914,7 @@ Error GDScriptLanguage::lookup_code(const String& p_code, const String& p_symbol
Ref<GDNativeClass> gdn = t.value;
if (gdn.is_valid()) {
r_result.type=ScriptLanguage::LookupResult::RESULT_CLASS_CONSTANT;
- r_result.class_name=gdn->get_name();;
+ r_result.class_name=gdn->get_name();
r_result.class_member=p_symbol;
return OK;
@@ -2858,7 +2944,7 @@ Error GDScriptLanguage::lookup_code(const String& p_code, const String& p_symbol
}
}
- if (ObjectTypeDB::has_method(t.obj_type,p_symbol)) {
+ if (ClassDB::has_method(t.obj_type,p_symbol)) {
r_result.type=ScriptLanguage::LookupResult::RESULT_CLASS_METHOD;
r_result.class_name=t.obj_type;
@@ -2868,7 +2954,7 @@ Error GDScriptLanguage::lookup_code(const String& p_code, const String& p_symbol
}
bool success;
- ObjectTypeDB::get_integer_constant(t.obj_type,p_symbol,&success);
+ ClassDB::get_integer_constant(t.obj_type,p_symbol,&success);
if (success) {
r_result.type=ScriptLanguage::LookupResult::RESULT_CLASS_CONSTANT;
r_result.class_name=t.obj_type;
@@ -2876,7 +2962,8 @@ Error GDScriptLanguage::lookup_code(const String& p_code, const String& p_symbol
return OK;
}
- ObjectTypeDB::get_property_type(t.obj_type,p_symbol,&success);
+
+ ClassDB::get_property_type(t.obj_type,p_symbol,&success);
if (success) {
r_result.type=ScriptLanguage::LookupResult::RESULT_CLASS_PROPERTY;
@@ -2936,7 +3023,7 @@ Error GDScriptLanguage::lookup_code(const String& p_code, const String& p_symbol
if (cid.obj_type!=StringName()) {
List<MethodInfo> vm;
- ObjectTypeDB::get_virtual_methods(cid.obj_type,&vm);
+ ClassDB::get_virtual_methods(cid.obj_type,&vm);
for(List<MethodInfo>::Element *E=vm.front();E;E=E->next()) {
if (p_symbol==E->get().name) {
diff --git a/modules/gdscript/gd_function.cpp b/modules/gdscript/gd_function.cpp
index 094e21bb4f..51e2c1e2be 100644
--- a/modules/gdscript/gd_function.cpp
+++ b/modules/gdscript/gd_function.cpp
@@ -119,9 +119,9 @@ static String _get_var_type(const Variant* p_type) {
#ifdef DEBUG_ENABLED
if (ObjectDB::instance_validate(bobj)) {
if (bobj->get_script_instance())
- basestr= bobj->get_type()+" ("+bobj->get_script_instance()->get_script()->get_path().get_file()+")";
+ basestr= bobj->get_class()+" ("+bobj->get_script_instance()->get_script()->get_path().get_file()+")";
else
- basestr = bobj->get_type();
+ basestr = bobj->get_class();
} else {
basestr="previously freed instance";
}
@@ -331,8 +331,8 @@ Variant GDFunction::call(GDInstance *p_instance, const Variant **p_args, int p_a
#endif
ip+=5;
-
- } continue;
+ continue;
+ }
case OPCODE_EXTENDS_TEST: {
CHECK_SPACE(4);
@@ -395,17 +395,17 @@ Variant GDFunction::call(GDInstance *p_instance, const Variant **p_args, int p_a
if (!nc) {
- err_text="Right operand of 'extends' is not a class (type: '"+obj_B->get_type()+"').";
+ err_text="Right operand of 'extends' is not a class (type: '"+obj_B->get_class()+"').";
break;
}
- extends_ok=ObjectTypeDB::is_type(obj_A->get_type_name(),nc->get_name());
+ extends_ok=ClassDB::is_parent_class(obj_A->get_class_name(),nc->get_name());
}
*dst=extends_ok;
ip+=4;
-
- } continue;
+ continue;
+ }
case OPCODE_SET: {
CHECK_SPACE(3);
@@ -429,7 +429,8 @@ Variant GDFunction::call(GDInstance *p_instance, const Variant **p_args, int p_a
}
ip+=4;
- } continue;
+ continue;
+ }
case OPCODE_GET: {
CHECK_SPACE(3);
@@ -460,7 +461,8 @@ Variant GDFunction::call(GDInstance *p_instance, const Variant **p_args, int p_a
*dst=ret;
#endif
ip+=4;
- } continue;
+ continue;
+ }
case OPCODE_SET_NAMED: {
CHECK_SPACE(3);
@@ -483,11 +485,12 @@ Variant GDFunction::call(GDInstance *p_instance, const Variant **p_args, int p_a
}
ip+=4;
- } continue;
+ continue;
+ }
case OPCODE_GET_NAMED: {
- CHECK_SPACE(3);
+ CHECK_SPACE(4);
GET_VARIANT_PTR(src,1);
GET_VARIANT_PTR(dst,3);
@@ -518,7 +521,49 @@ Variant GDFunction::call(GDInstance *p_instance, const Variant **p_args, int p_a
*dst=ret;
#endif
ip+=4;
- } continue;
+ continue;
+ }
+ case OPCODE_SET_MEMBER: {
+
+ CHECK_SPACE(3);
+ int indexname = _code_ptr[ip+1];
+ ERR_BREAK(indexname<0 || indexname>=_global_names_count);
+ const StringName *index = &_global_names_ptr[indexname];
+ GET_VARIANT_PTR(src,2);
+
+ bool valid;
+ bool ok = ClassDB::set_property(p_instance->owner,*index,*src,&valid);
+#ifdef DEBUG_ENABLED
+ if (!ok) {
+ err_text="Internal error setting property: "+String(*index);
+ break;
+ } else if (!valid) {
+ err_text="Error setting property '"+String(*index)+"' with value of type "+Variant::get_type_name(src->get_type())+".";
+ break;
+
+ }
+#endif
+ ip+=3;
+ continue;
+ }
+ case OPCODE_GET_MEMBER: {
+
+ CHECK_SPACE(3);
+ int indexname = _code_ptr[ip+1];
+ ERR_BREAK(indexname<0 || indexname>=_global_names_count);
+ const StringName *index = &_global_names_ptr[indexname];
+ GET_VARIANT_PTR(dst,2);
+ bool ok = ClassDB::get_property(p_instance->owner,*index,*dst);
+
+#ifdef DEBUG_ENABLED
+ if (!ok) {
+ err_text="Internal error getting property: "+String(*index);
+ break;
+ }
+#endif
+ ip+=3;
+ continue;
+ }
case OPCODE_ASSIGN: {
CHECK_SPACE(3);
@@ -528,8 +573,8 @@ Variant GDFunction::call(GDInstance *p_instance, const Variant **p_args, int p_a
*dst = *src;
ip+=3;
-
- } continue;
+ continue;
+ }
case OPCODE_ASSIGN_TRUE: {
CHECK_SPACE(2);
@@ -538,7 +583,8 @@ Variant GDFunction::call(GDInstance *p_instance, const Variant **p_args, int p_a
*dst = true;
ip+=2;
- } continue;
+ continue;
+ }
case OPCODE_ASSIGN_FALSE: {
CHECK_SPACE(2);
@@ -547,7 +593,8 @@ Variant GDFunction::call(GDInstance *p_instance, const Variant **p_args, int p_a
*dst = false;
ip+=2;
- } continue;
+ continue;
+ }
case OPCODE_CONSTRUCT: {
CHECK_SPACE(2);
@@ -572,12 +619,13 @@ Variant GDFunction::call(GDInstance *p_instance, const Variant **p_args, int p_a
ip+=4+argc;
//construct a basic type
- } continue;
+ continue;
+ }
case OPCODE_CONSTRUCT_ARRAY: {
CHECK_SPACE(1);
int argc=_code_ptr[ip+1];
- Array array(true); //arrays are always shared
+ Array array; //arrays are always shared
array.resize(argc);
CHECK_SPACE(argc+2);
@@ -592,13 +640,13 @@ Variant GDFunction::call(GDInstance *p_instance, const Variant **p_args, int p_a
*dst=array;
ip+=3+argc;
-
- } continue;
+ continue;
+ }
case OPCODE_CONSTRUCT_DICTIONARY: {
CHECK_SPACE(1);
int argc=_code_ptr[ip+1];
- Dictionary dict(true); //arrays are always shared
+ Dictionary dict; //arrays are always shared
CHECK_SPACE(argc*2+2);
@@ -615,8 +663,8 @@ Variant GDFunction::call(GDInstance *p_instance, const Variant **p_args, int p_a
*dst=dict;
ip+=3+argc*2;
-
- } continue;
+ continue;
+ }
case OPCODE_CALL_RETURN:
case OPCODE_CALL: {
@@ -697,8 +745,8 @@ Variant GDFunction::call(GDInstance *p_instance, const Variant **p_args, int p_a
//_call_func(NULL,base,*methodname,ip,argc,p_instance,stack);
ip+=argc+1;
-
- } continue;
+ continue;
+ }
case OPCODE_CALL_BUILT_IN: {
CHECK_SPACE(4);
@@ -735,12 +783,12 @@ Variant GDFunction::call(GDInstance *p_instance, const Variant **p_args, int p_a
break;
}
ip+=argc+1;
-
- } continue;
+ continue;
+ }
case OPCODE_CALL_SELF: {
-
- } break;
+ break;
+ }
case OPCODE_CALL_SELF_BASE: {
CHECK_SPACE(2);
@@ -788,7 +836,7 @@ Variant GDFunction::call(GDInstance *p_instance, const Variant **p_args, int p_a
if (*methodname!=GDScriptLanguage::get_singleton()->strings._init) {
- MethodBind *mb = ObjectTypeDB::get_method(gds->native->get_name(),*methodname);
+ MethodBind *mb = ClassDB::get_method(gds->native->get_name(),*methodname);
if (!mb) {
err.error=Variant::CallError::CALL_ERROR_INVALID_METHOD;
} else {
@@ -817,8 +865,8 @@ Variant GDFunction::call(GDInstance *p_instance, const Variant **p_args, int p_a
}
ip+=4+argc;
-
- } continue;
+ continue;
+ }
case OPCODE_YIELD:
case OPCODE_YIELD_SIGNAL: {
@@ -898,8 +946,8 @@ Variant GDFunction::call(GDInstance *p_instance, const Variant **p_args, int p_a
}
exit_ok=true;
-
- } break;
+ break;
+ }
case OPCODE_YIELD_RESUME: {
CHECK_SPACE(2);
@@ -910,8 +958,8 @@ Variant GDFunction::call(GDInstance *p_instance, const Variant **p_args, int p_a
GET_VARIANT_PTR(result,1);
*result=p_state->result;
ip+=2;
-
- } continue;
+ continue;
+ }
case OPCODE_JUMP: {
CHECK_SPACE(2);
@@ -919,8 +967,8 @@ Variant GDFunction::call(GDInstance *p_instance, const Variant **p_args, int p_a
ERR_BREAK(to<0 || to>_code_size);
ip=to;
-
- } continue;
+ continue;
+ }
case OPCODE_JUMP_IF: {
CHECK_SPACE(3);
@@ -943,7 +991,8 @@ Variant GDFunction::call(GDInstance *p_instance, const Variant **p_args, int p_a
continue;
}
ip+=3;
- } continue;
+ continue;
+ }
case OPCODE_JUMP_IF_NOT: {
CHECK_SPACE(3);
@@ -966,21 +1015,22 @@ Variant GDFunction::call(GDInstance *p_instance, const Variant **p_args, int p_a
continue;
}
ip+=3;
- } continue;
+ continue;
+ }
case OPCODE_JUMP_TO_DEF_ARGUMENT: {
CHECK_SPACE(2);
ip=_default_arg_ptr[defarg];
-
- } continue;
+ continue;
+ }
case OPCODE_RETURN: {
CHECK_SPACE(2);
GET_VARIANT_PTR(r,1);
retvalue=*r;
exit_ok=true;
-
- } break;
+ break;
+ }
case OPCODE_ITERATE_BEGIN: {
CHECK_SPACE(8); //space for this an regular iterate
@@ -1010,8 +1060,8 @@ Variant GDFunction::call(GDInstance *p_instance, const Variant **p_args, int p_a
ip+=5; //skip regular iterate which is always next
-
- } continue;
+ continue;
+ }
case OPCODE_ITERATE: {
CHECK_SPACE(4);
@@ -1039,7 +1089,8 @@ Variant GDFunction::call(GDInstance *p_instance, const Variant **p_args, int p_a
}
ip+=5; //loop again
- } continue;
+ continue;
+ }
case OPCODE_ASSERT: {
CHECK_SPACE(2);
GET_VARIANT_PTR(test,1);
@@ -1065,7 +1116,8 @@ Variant GDFunction::call(GDInstance *p_instance, const Variant **p_args, int p_a
#endif
ip+=2;
- } continue;
+ continue;
+ }
case OPCODE_BREAKPOINT: {
#ifdef DEBUG_ENABLED
if (ScriptDebugger::get_singleton()) {
@@ -1073,7 +1125,8 @@ Variant GDFunction::call(GDInstance *p_instance, const Variant **p_args, int p_a
}
#endif
ip+=1;
- } continue;
+ continue;
+ }
case OPCODE_LINE: {
CHECK_SPACE(2);
@@ -1102,17 +1155,19 @@ Variant GDFunction::call(GDInstance *p_instance, const Variant **p_args, int p_a
ScriptDebugger::get_singleton()->line_poll();
}
- } continue;
+ continue;
+ }
case OPCODE_END: {
exit_ok=true;
break;
- } break;
+ }
default: {
err_text="Illegal opcode "+itos(_code_ptr[ip])+" at address "+itos(ip);
- } break;
+ break;
+ }
}
@@ -1435,9 +1490,9 @@ Variant GDFunctionState::resume(const Variant& p_arg) {
void GDFunctionState::_bind_methods() {
- ObjectTypeDB::bind_method(_MD("resume:Variant","arg"),&GDFunctionState::resume,DEFVAL(Variant()));
- ObjectTypeDB::bind_method(_MD("is_valid"),&GDFunctionState::is_valid);
- ObjectTypeDB::bind_vararg_method(METHOD_FLAGS_DEFAULT,"_signal_callback",&GDFunctionState::_signal_callback,MethodInfo("_signal_callback"));
+ ClassDB::bind_method(_MD("resume:Variant","arg"),&GDFunctionState::resume,DEFVAL(Variant()));
+ ClassDB::bind_method(_MD("is_valid"),&GDFunctionState::is_valid);
+ ClassDB::bind_vararg_method(METHOD_FLAGS_DEFAULT,"_signal_callback",&GDFunctionState::_signal_callback,MethodInfo("_signal_callback"));
}
diff --git a/modules/gdscript/gd_function.h b/modules/gdscript/gd_function.h
index f1c5b13ca1..e5262e8ad7 100644
--- a/modules/gdscript/gd_function.h
+++ b/modules/gdscript/gd_function.h
@@ -23,6 +23,8 @@ public:
OPCODE_GET,
OPCODE_SET_NAMED,
OPCODE_GET_NAMED,
+ OPCODE_SET_MEMBER,
+ OPCODE_GET_MEMBER,
OPCODE_ASSIGN,
OPCODE_ASSIGN_TRUE,
OPCODE_ASSIGN_FALSE,
@@ -204,7 +206,7 @@ public:
class GDFunctionState : public Reference {
- OBJ_TYPE(GDFunctionState,Reference);
+ GDCLASS(GDFunctionState,Reference);
friend class GDFunction;
GDFunction *function;
GDFunction::CallState state;
diff --git a/modules/gdscript/gd_functions.cpp b/modules/gdscript/gd_functions.cpp
index d3f7dcd35f..d0fc241734 100644
--- a/modules/gdscript/gd_functions.cpp
+++ b/modules/gdscript/gd_functions.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* 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 */
@@ -28,13 +28,14 @@
/*************************************************************************/
#include "gd_functions.h"
#include "math_funcs.h"
-#include "object_type_db.h"
+#include "class_db.h"
#include "reference.h"
#include "gd_script.h"
#include "func_ref.h"
#include "os/os.h"
#include "variant_parser.h"
#include "io/marshalls.h"
+#include "io/json.h"
const char *GDFunctions::get_func_name(Function p_func) {
@@ -103,8 +104,12 @@ const char *GDFunctions::get_func_name(Function p_func) {
"load",
"inst2dict",
"dict2inst",
+ "validate_json",
+ "parse_json",
+ "to_json",
"hash",
"Color8",
+ "ColorN",
"print_stack",
"instance_from_id",
};
@@ -154,85 +159,85 @@ void GDFunctions::call(Function p_func,const Variant **p_args,int p_arg_count,Va
case MATH_SIN: {
VALIDATE_ARG_COUNT(1);
VALIDATE_ARG_NUM(0);
- r_ret=Math::sin(*p_args[0]);
+ r_ret=Math::sin((double)*p_args[0]);
} break;
case MATH_COS: {
VALIDATE_ARG_COUNT(1);
VALIDATE_ARG_NUM(0);
- r_ret=Math::cos(*p_args[0]);
+ r_ret=Math::cos((double)*p_args[0]);
} break;
case MATH_TAN: {
VALIDATE_ARG_COUNT(1);
VALIDATE_ARG_NUM(0);
- r_ret=Math::tan(*p_args[0]);
+ r_ret=Math::tan((double)*p_args[0]);
} break;
case MATH_SINH: {
VALIDATE_ARG_COUNT(1);
VALIDATE_ARG_NUM(0);
- r_ret=Math::sinh(*p_args[0]);
+ r_ret=Math::sinh((double)*p_args[0]);
} break;
case MATH_COSH: {
VALIDATE_ARG_COUNT(1);
VALIDATE_ARG_NUM(0);
- r_ret=Math::cosh(*p_args[0]);
+ r_ret=Math::cosh((double)*p_args[0]);
} break;
case MATH_TANH: {
VALIDATE_ARG_COUNT(1);
VALIDATE_ARG_NUM(0);
- r_ret=Math::tanh(*p_args[0]);
+ r_ret=Math::tanh((double)*p_args[0]);
} break;
case MATH_ASIN: {
VALIDATE_ARG_COUNT(1);
VALIDATE_ARG_NUM(0);
- r_ret=Math::asin(*p_args[0]);
+ r_ret=Math::asin((double)*p_args[0]);
} break;
case MATH_ACOS: {
VALIDATE_ARG_COUNT(1);
VALIDATE_ARG_NUM(0);
- r_ret=Math::acos(*p_args[0]);
+ r_ret=Math::acos((double)*p_args[0]);
} break;
case MATH_ATAN: {
VALIDATE_ARG_COUNT(1);
VALIDATE_ARG_NUM(0);
- r_ret=Math::atan(*p_args[0]);
+ r_ret=Math::atan((double)*p_args[0]);
} break;
case MATH_ATAN2: {
VALIDATE_ARG_COUNT(2);
VALIDATE_ARG_NUM(0);
VALIDATE_ARG_NUM(1);
- r_ret=Math::atan2(*p_args[0],*p_args[1]);
+ r_ret=Math::atan2((double)*p_args[0],(double)*p_args[1]);
} break;
case MATH_SQRT: {
VALIDATE_ARG_COUNT(1);
VALIDATE_ARG_NUM(0);
- r_ret=Math::sqrt(*p_args[0]);
+ r_ret=Math::sqrt((double)*p_args[0]);
} break;
case MATH_FMOD: {
VALIDATE_ARG_COUNT(2);
VALIDATE_ARG_NUM(0);
VALIDATE_ARG_NUM(1);
- r_ret=Math::fmod(*p_args[0],*p_args[1]);
+ r_ret=Math::fmod((double)*p_args[0],(double)*p_args[1]);
} break;
case MATH_FPOSMOD: {
VALIDATE_ARG_COUNT(2);
VALIDATE_ARG_NUM(0);
VALIDATE_ARG_NUM(1);
- r_ret=Math::fposmod(*p_args[0],*p_args[1]);
+ r_ret=Math::fposmod((double)*p_args[0],(double)*p_args[1]);
} break;
case MATH_FLOOR: {
VALIDATE_ARG_COUNT(1);
VALIDATE_ARG_NUM(0);
- r_ret=Math::floor(*p_args[0]);
+ r_ret=Math::floor((double)*p_args[0]);
} break;
case MATH_CEIL: {
VALIDATE_ARG_COUNT(1);
VALIDATE_ARG_NUM(0);
- r_ret=Math::ceil(*p_args[0]);
+ r_ret=Math::ceil((double)*p_args[0]);
} break;
case MATH_ROUND: {
VALIDATE_ARG_COUNT(1);
VALIDATE_ARG_NUM(0);
- r_ret=Math::round(*p_args[0]);
+ r_ret=Math::round((double)*p_args[0]);
} break;
case MATH_ABS: {
VALIDATE_ARG_COUNT(1);
@@ -242,7 +247,7 @@ void GDFunctions::call(Function p_func,const Variant **p_args,int p_arg_count,Va
r_ret=ABS(i);
} else if (p_args[0]->get_type()==Variant::REAL) {
- real_t r = *p_args[0];
+ double r = *p_args[0];
r_ret=Math::abs(r);
} else {
@@ -274,58 +279,58 @@ void GDFunctions::call(Function p_func,const Variant **p_args,int p_arg_count,Va
VALIDATE_ARG_COUNT(2);
VALIDATE_ARG_NUM(0);
VALIDATE_ARG_NUM(1);
- r_ret=Math::pow(*p_args[0],*p_args[1]);
+ r_ret=Math::pow((double)*p_args[0],(double)*p_args[1]);
} break;
case MATH_LOG: {
VALIDATE_ARG_COUNT(1);
VALIDATE_ARG_NUM(0);
- r_ret=Math::log(*p_args[0]);
+ r_ret=Math::log((double)*p_args[0]);
} break;
case MATH_EXP: {
VALIDATE_ARG_COUNT(1);
VALIDATE_ARG_NUM(0);
- r_ret=Math::exp(*p_args[0]);
+ r_ret=Math::exp((double)*p_args[0]);
} break;
case MATH_ISNAN: {
VALIDATE_ARG_COUNT(1);
VALIDATE_ARG_NUM(0);
- r_ret=Math::is_nan(*p_args[0]);
+ r_ret=Math::is_nan((double)*p_args[0]);
} break;
case MATH_ISINF: {
VALIDATE_ARG_COUNT(1);
VALIDATE_ARG_NUM(0);
- r_ret=Math::is_inf(*p_args[0]);
+ r_ret=Math::is_inf((double)*p_args[0]);
} break;
case MATH_EASE: {
VALIDATE_ARG_COUNT(2);
VALIDATE_ARG_NUM(0);
VALIDATE_ARG_NUM(1);
- r_ret=Math::ease(*p_args[0],*p_args[1]);
+ r_ret=Math::ease((double)*p_args[0],(double)*p_args[1]);
} break;
case MATH_DECIMALS: {
VALIDATE_ARG_COUNT(1);
VALIDATE_ARG_NUM(0);
- r_ret=Math::step_decimals(*p_args[0]);
+ r_ret=Math::step_decimals((double)*p_args[0]);
} break;
case MATH_STEPIFY: {
VALIDATE_ARG_COUNT(2);
VALIDATE_ARG_NUM(0);
VALIDATE_ARG_NUM(1);
- r_ret=Math::stepify(*p_args[0],*p_args[1]);
+ r_ret=Math::stepify((double)*p_args[0],(double)*p_args[1]);
} break;
case MATH_LERP: {
VALIDATE_ARG_COUNT(3);
VALIDATE_ARG_NUM(0);
VALIDATE_ARG_NUM(1);
VALIDATE_ARG_NUM(2);
- r_ret=Math::lerp(*p_args[0],*p_args[1],*p_args[2]);
+ r_ret=Math::lerp((double)*p_args[0],(double)*p_args[1],(double)*p_args[2]);
} break;
case MATH_DECTIME: {
VALIDATE_ARG_COUNT(3);
VALIDATE_ARG_NUM(0);
VALIDATE_ARG_NUM(1);
VALIDATE_ARG_NUM(2);
- r_ret=Math::dectime(*p_args[0],*p_args[1],*p_args[2]);
+ r_ret=Math::dectime((double)*p_args[0],(double)*p_args[1],(double)*p_args[2]);
} break;
case MATH_RANDOMIZE: {
Math::randomize();
@@ -341,19 +346,19 @@ void GDFunctions::call(Function p_func,const Variant **p_args,int p_arg_count,Va
VALIDATE_ARG_COUNT(2);
VALIDATE_ARG_NUM(0);
VALIDATE_ARG_NUM(1);
- r_ret=Math::random(*p_args[0],*p_args[1]);
+ r_ret=Math::random((double)*p_args[0],(double)*p_args[1]);
} break;
case MATH_SEED: {
VALIDATE_ARG_COUNT(1);
VALIDATE_ARG_NUM(0);
- uint32_t seed=*p_args[0];
+ uint64_t seed=*p_args[0];
Math::seed(seed);
r_ret=Variant();
} break;
case MATH_RANDSEED: {
VALIDATE_ARG_COUNT(1);
VALIDATE_ARG_NUM(0);
- uint32_t seed=*p_args[0];
+ uint64_t seed=*p_args[0];
int ret = Math::rand_from_seed(&seed);
Array reta;
reta.push_back(ret);
@@ -364,22 +369,22 @@ void GDFunctions::call(Function p_func,const Variant **p_args,int p_arg_count,Va
case MATH_DEG2RAD: {
VALIDATE_ARG_COUNT(1);
VALIDATE_ARG_NUM(0);
- r_ret=Math::deg2rad(*p_args[0]);
+ r_ret=Math::deg2rad((double)*p_args[0]);
} break;
case MATH_RAD2DEG: {
VALIDATE_ARG_COUNT(1);
VALIDATE_ARG_NUM(0);
- r_ret=Math::rad2deg(*p_args[0]);
+ r_ret=Math::rad2deg((double)*p_args[0]);
} break;
case MATH_LINEAR2DB: {
VALIDATE_ARG_COUNT(1);
VALIDATE_ARG_NUM(0);
- r_ret=Math::linear2db(*p_args[0]);
+ r_ret=Math::linear2db((double)*p_args[0]);
} break;
case MATH_DB2LINEAR: {
VALIDATE_ARG_COUNT(1);
VALIDATE_ARG_NUM(0);
- r_ret=Math::db2linear(*p_args[0]);
+ r_ret=Math::db2linear((double)*p_args[0]);
} break;
case LOGIC_MAX: {
VALIDATE_ARG_COUNT(2);
@@ -536,7 +541,7 @@ void GDFunctions::call(Function p_func,const Variant **p_args,int p_arg_count,Va
case TYPE_EXISTS: {
VALIDATE_ARG_COUNT(1);
- r_ret = ObjectTypeDB::type_exists(*p_args[0]);
+ r_ret = ClassDB::class_exists(*p_args[0]);
} break;
case TEXT_CHAR: {
@@ -550,7 +555,7 @@ void GDFunctions::call(Function p_func,const Variant **p_args,int p_arg_count,Va
String str;
for(int i=0;i<p_arg_count;i++) {
- String os = p_args[i]->operator String();;
+ String os = p_args[i]->operator String();
if (i==0)
str=os;
@@ -668,7 +673,7 @@ void GDFunctions::call(Function p_func,const Variant **p_args,int p_arg_count,Va
case VAR_TO_BYTES: {
VALIDATE_ARG_COUNT(1);
- ByteArray barr;
+ PoolByteArray barr;
int len;
Error err = encode_variant(*p_args[0],NULL,len);
if (err) {
@@ -681,7 +686,7 @@ void GDFunctions::call(Function p_func,const Variant **p_args,int p_arg_count,Va
barr.resize(len);
{
- ByteArray::Write w = barr.write();
+ PoolByteArray::Write w = barr.write();
encode_variant(*p_args[0],w.ptr(),len);
}
@@ -689,24 +694,24 @@ void GDFunctions::call(Function p_func,const Variant **p_args,int p_arg_count,Va
} break;
case BYTES_TO_VAR: {
VALIDATE_ARG_COUNT(1);
- if (p_args[0]->get_type()!=Variant::RAW_ARRAY) {
+ if (p_args[0]->get_type()!=Variant::POOL_BYTE_ARRAY) {
r_error.error=Variant::CallError::CALL_ERROR_INVALID_ARGUMENT;
r_error.argument=0;
- r_error.expected=Variant::RAW_ARRAY;
+ r_error.expected=Variant::POOL_BYTE_ARRAY;
r_ret=Variant();
return;
}
- ByteArray varr=*p_args[0];
+ PoolByteArray varr=*p_args[0];
Variant ret;
{
- ByteArray::Read r=varr.read();
+ PoolByteArray::Read r=varr.read();
Error err = decode_variant(ret,r.ptr(),varr.size(),NULL);
if (err!=OK) {
r_ret=RTR("Not enough bytes for decoding bytes, or invalid format.");
r_error.error=Variant::CallError::CALL_ERROR_INVALID_ARGUMENT;
r_error.argument=0;
- r_error.expected=Variant::RAW_ARRAY;
+ r_error.expected=Variant::POOL_BYTE_ARRAY;
return;
}
@@ -730,7 +735,7 @@ void GDFunctions::call(Function p_func,const Variant **p_args,int p_arg_count,Va
VALIDATE_ARG_NUM(0);
int count=*p_args[0];
- Array arr(true);
+ Array arr;
if (count<=0) {
r_ret=arr;
return;
@@ -756,7 +761,7 @@ void GDFunctions::call(Function p_func,const Variant **p_args,int p_arg_count,Va
int from=*p_args[0];
int to=*p_args[1];
- Array arr(true);
+ Array arr;
if (from>=to) {
r_ret=arr;
return;
@@ -787,7 +792,7 @@ void GDFunctions::call(Function p_func,const Variant **p_args,int p_arg_count,Va
return;
}
- Array arr(true);
+ Array arr;
if (from>=to && incr>0) {
r_ret=arr;
return;
@@ -846,6 +851,7 @@ void GDFunctions::call(Function p_func,const Variant **p_args,int p_arg_count,Va
if (p_args[0]->get_type()!=Variant::STRING) {
r_error.error=Variant::CallError::CALL_ERROR_INVALID_ARGUMENT;
r_error.argument=0;
+ r_error.expected=Variant::STRING;
r_ret=Variant();
} else {
r_ret=ResourceLoader::load(*p_args[0]);
@@ -915,7 +921,7 @@ void GDFunctions::call(Function p_func,const Variant **p_args,int p_arg_count,Va
NodePath cp(sname,Vector<StringName>(),false);
- Dictionary d(true);
+ Dictionary d;
d["@subpath"]=cp;
d["@path"]=p->path;
@@ -1024,6 +1030,57 @@ void GDFunctions::call(Function p_func,const Variant **p_args,int p_arg_count,Va
}
} break;
+ case VALIDATE_JSON: {
+
+ VALIDATE_ARG_COUNT(1);
+
+ if (p_args[0]->get_type()!=Variant::STRING) {
+ r_error.error=Variant::CallError::CALL_ERROR_INVALID_ARGUMENT;
+ r_error.argument=0;
+ r_error.expected=Variant::STRING;
+ r_ret=Variant();
+ return;
+ }
+
+ String errs;
+ int errl;
+
+ Error err = JSON::parse(*p_args[0],r_ret,errs,errl);
+
+ if (err!=OK) {
+ r_ret=itos(errl)+":"+errs;
+ } else {
+ r_ret="";
+ }
+
+ } break;
+ case PARSE_JSON: {
+
+ VALIDATE_ARG_COUNT(1);
+
+ if (p_args[0]->get_type()!=Variant::STRING) {
+ r_error.error=Variant::CallError::CALL_ERROR_INVALID_ARGUMENT;
+ r_error.argument=0;
+ r_error.expected=Variant::STRING;
+ r_ret=Variant();
+ return;
+ }
+
+ String errs;
+ int errl;
+
+ Error err = JSON::parse(*p_args[0],r_ret,errs,errl);
+
+ if (err!=OK) {
+ r_ret=Variant();
+ }
+
+ } break;
+ case TO_JSON: {
+ VALIDATE_ARG_COUNT(1);
+
+ r_ret = JSON::print(*p_args[0]);
+ } break;
case HASH: {
VALIDATE_ARG_COUNT(1);
@@ -1061,6 +1118,36 @@ void GDFunctions::call(Function p_func,const Variant **p_args,int p_arg_count,Va
r_ret=color;
} break;
+ case COLORN: {
+
+ if (p_arg_count<1) {
+ r_error.error=Variant::CallError::CALL_ERROR_TOO_FEW_ARGUMENTS;
+ r_error.argument=1;
+ r_ret=Variant();
+ return;
+ }
+
+ if (p_arg_count>2) {
+ r_error.error=Variant::CallError::CALL_ERROR_TOO_MANY_ARGUMENTS;
+ r_error.argument=2;
+ r_ret=Variant();
+ return;
+ }
+
+ if (p_args[0]->get_type()!=Variant::STRING) {
+ r_error.error=Variant::CallError::CALL_ERROR_INVALID_ARGUMENT;
+ r_error.argument=0;
+ r_ret=Variant();
+ } else {
+ Color color = Color::named(*p_args[0]);
+ if (p_arg_count==2) {
+ VALIDATE_ARG_NUM(1);
+ color.a=*p_args[1];
+ }
+ r_ret=color;
+ }
+
+ } break;
case PRINT_STACK: {
@@ -1475,13 +1562,13 @@ MethodInfo GDFunctions::get_info(Function p_func) {
} break;
case VAR_TO_BYTES: {
MethodInfo mi("var2bytes",PropertyInfo(Variant::NIL,"var"));
- mi.return_val.type=Variant::RAW_ARRAY;
+ mi.return_val.type=Variant::POOL_BYTE_ARRAY;
return mi;
} break;
case BYTES_TO_VAR: {
- MethodInfo mi("bytes2var:Variant",PropertyInfo(Variant::RAW_ARRAY,"bytes"));
+ MethodInfo mi("bytes2var:Variant",PropertyInfo(Variant::POOL_BYTE_ARRAY,"bytes"));
mi.return_val.type=Variant::NIL;
return mi;
} break;
@@ -1510,6 +1597,24 @@ MethodInfo GDFunctions::get_info(Function p_func) {
mi.return_val.type=Variant::OBJECT;
return mi;
} break;
+ case VALIDATE_JSON: {
+
+ MethodInfo mi("validate_json:Variant",PropertyInfo(Variant::STRING,"json"));
+ mi.return_val.type=Variant::STRING;
+ return mi;
+ } break;
+ case PARSE_JSON: {
+
+ MethodInfo mi("parse_json:Variant",PropertyInfo(Variant::STRING,"json"));
+ mi.return_val.type=Variant::NIL;
+ return mi;
+ } break;
+ case TO_JSON: {
+
+ MethodInfo mi("to_json",PropertyInfo(Variant::NIL,"var:Variant"));
+ mi.return_val.type=Variant::STRING;
+ return mi;
+ } break;
case HASH: {
MethodInfo mi("hash",PropertyInfo(Variant::NIL,"var:Variant"));
@@ -1522,6 +1627,12 @@ MethodInfo GDFunctions::get_info(Function p_func) {
mi.return_val.type=Variant::COLOR;
return mi;
} break;
+ case COLORN: {
+
+ MethodInfo mi("ColorN",PropertyInfo(Variant::STRING,"name"),PropertyInfo(Variant::REAL,"alpha"));
+ mi.return_val.type=Variant::COLOR;
+ return mi;
+ } break;
case PRINT_STACK: {
MethodInfo mi("print_stack");
diff --git a/modules/gdscript/gd_functions.h b/modules/gdscript/gd_functions.h
index f444bb3b5b..6e30b4dbb5 100644
--- a/modules/gdscript/gd_functions.h
+++ b/modules/gdscript/gd_functions.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* 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 */
@@ -97,8 +97,12 @@ public:
RESOURCE_LOAD,
INST2DICT,
DICT2INST,
+ VALIDATE_JSON,
+ PARSE_JSON,
+ TO_JSON,
HASH,
COLOR8,
+ COLORN,
PRINT_STACK,
INSTANCE_FROM_ID,
FUNC_MAX
diff --git a/modules/gdscript/gd_parser.cpp b/modules/gdscript/gd_parser.cpp
index 434f918355..34c39c8024 100644
--- a/modules/gdscript/gd_parser.cpp
+++ b/modules/gdscript/gd_parser.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* 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 */
@@ -225,8 +225,8 @@ bool GDParser::_get_completable_identifier(CompletionType p_type,StringName& ide
GDParser::Node* GDParser::_parse_expression(Node *p_parent,bool p_static,bool p_allow_assign,bool p_parsing_constant) {
-// Vector<Node*> expressions;
-// Vector<OperatorNode::Operator> operators;
+ //Vector<Node*> expressions;
+ //Vector<OperatorNode::Operator> operators;
Vector<Expression> expression;
@@ -265,6 +265,98 @@ GDParser::Node* GDParser::_parse_expression(Node *p_parent,bool p_static,bool p_
tokenizer->advance();
expr=subexpr;
+ } else if (tokenizer->get_token()==GDTokenizer::TK_DOLLAR) {
+ tokenizer->advance();
+
+ String path;
+
+ bool need_identifier=true;
+ bool done=false;
+
+ while(!done) {
+
+ switch(tokenizer->get_token()) {
+ case GDTokenizer::TK_CURSOR: {
+ completion_cursor=StringName();
+ completion_type=COMPLETION_GET_NODE;
+ completion_class=current_class;
+ completion_function=current_function;
+ completion_line=tokenizer->get_token_line();
+ completion_cursor=path;
+ completion_argument=0;
+ completion_block=current_block;
+ completion_found=true;
+ tokenizer->advance();
+ } break;
+ case GDTokenizer::TK_CONSTANT: {
+
+ if (!need_identifier) {
+ done=true;
+ break;
+ }
+
+ if (tokenizer->get_token_constant().get_type()!=Variant::STRING) {
+ _set_error("Expected string constant or identifier after '$' or '/'.");
+ return NULL;
+ }
+
+ path+=String(tokenizer->get_token_constant());
+ tokenizer->advance();
+ need_identifier=false;
+
+ } break;
+ case GDTokenizer::TK_IDENTIFIER: {
+ if (!need_identifier) {
+ done=true;
+ break;
+ }
+
+ path+=String(tokenizer->get_token_identifier());
+ tokenizer->advance();
+ need_identifier=false;
+
+ } break;
+ case GDTokenizer::TK_OP_DIV: {
+
+ if (need_identifier) {
+ done=true;
+ break;
+ }
+
+ path+="/";
+ tokenizer->advance();
+ need_identifier=true;
+
+ } break;
+ default: {
+ done=true;
+ break;
+ }
+ }
+ }
+
+ if (path=="") {
+ _set_error("Path expected after $.");
+ return NULL;
+
+ }
+
+ OperatorNode *op = alloc_node<OperatorNode>();
+ op->op=OperatorNode::OP_CALL;
+
+ op->arguments.push_back(alloc_node<SelfNode>());
+
+ IdentifierNode *funcname = alloc_node<IdentifierNode>();
+ funcname->name="get_node";
+
+ op->arguments.push_back(funcname);
+
+ ConstantNode *nodepath = alloc_node<ConstantNode>();
+ nodepath->value = NodePath(StringName(path));
+ op->arguments.push_back(nodepath);
+
+ expr=op;
+
} else if (tokenizer->get_token()==GDTokenizer::TK_CURSOR) {
tokenizer->advance();
continue; //no point in cursor in the middle of expression
@@ -540,17 +632,18 @@ GDParser::Node* GDParser::_parse_expression(Node *p_parent,bool p_static,bool p_
expr = id;
}
- } else if (/*tokenizer->get_token()==GDTokenizer::TK_OP_ADD ||*/ tokenizer->get_token()==GDTokenizer::TK_OP_SUB || tokenizer->get_token()==GDTokenizer::TK_OP_NOT || tokenizer->get_token()==GDTokenizer::TK_OP_BIT_INVERT) {
+ } else if (tokenizer->get_token()==GDTokenizer::TK_OP_ADD || tokenizer->get_token()==GDTokenizer::TK_OP_SUB || tokenizer->get_token()==GDTokenizer::TK_OP_NOT || tokenizer->get_token()==GDTokenizer::TK_OP_BIT_INVERT) {
- //single prefix operators like !expr -expr ++expr --expr
+ //single prefix operators like !expr +expr -expr ++expr --expr
alloc_node<OperatorNode>();
Expression e;
e.is_op=true;
switch(tokenizer->get_token()) {
+ case GDTokenizer::TK_OP_ADD: e.op=OperatorNode::OP_POS; break;
case GDTokenizer::TK_OP_SUB: e.op=OperatorNode::OP_NEG; break;
case GDTokenizer::TK_OP_NOT: e.op=OperatorNode::OP_NOT; break;
- case GDTokenizer::TK_OP_BIT_INVERT: e.op=OperatorNode::OP_BIT_INVERT;; break;
+ case GDTokenizer::TK_OP_BIT_INVERT: e.op=OperatorNode::OP_BIT_INVERT; break;
default: {}
}
@@ -631,6 +724,7 @@ GDParser::Node* GDParser::_parse_expression(Node *p_parent,bool p_static,bool p_
};
Node *key=NULL;
+ Set<Variant> keys;
DictExpect expecting=DICT_EXPECT_KEY;
@@ -726,6 +820,16 @@ GDParser::Node* GDParser::_parse_expression(Node *p_parent,bool p_static,bool p_
return NULL;
expecting=DICT_EXPECT_COMMA;
+ if (key->type == GDParser::Node::TYPE_CONSTANT) {
+ Variant const& keyName = static_cast<const GDParser::ConstantNode*>(key)->value;
+
+ if (keys.has(keyName)) {
+ _set_error("Duplicate key found in Dictionary literal");
+ return NULL;
+ }
+ keys.insert(keyName);
+ }
+
DictionaryNode::Pair pair;
pair.key=key;
pair.value=value;
@@ -939,8 +1043,8 @@ GDParser::Node* GDParser::_parse_expression(Node *p_parent,bool p_static,bool p_
case GDTokenizer::TK_OP_ASSIGN_MUL: _VALIDATE_ASSIGN op=OperatorNode::OP_ASSIGN_MUL ; break;
case GDTokenizer::TK_OP_ASSIGN_DIV: _VALIDATE_ASSIGN op=OperatorNode::OP_ASSIGN_DIV ; break;
case GDTokenizer::TK_OP_ASSIGN_MOD: _VALIDATE_ASSIGN op=OperatorNode::OP_ASSIGN_MOD ; break;
- case GDTokenizer::TK_OP_ASSIGN_SHIFT_LEFT: _VALIDATE_ASSIGN op=OperatorNode::OP_ASSIGN_SHIFT_LEFT; ; break;
- case GDTokenizer::TK_OP_ASSIGN_SHIFT_RIGHT: _VALIDATE_ASSIGN op=OperatorNode::OP_ASSIGN_SHIFT_RIGHT; ; break;
+ case GDTokenizer::TK_OP_ASSIGN_SHIFT_LEFT: _VALIDATE_ASSIGN op=OperatorNode::OP_ASSIGN_SHIFT_LEFT; break;
+ case GDTokenizer::TK_OP_ASSIGN_SHIFT_RIGHT: _VALIDATE_ASSIGN op=OperatorNode::OP_ASSIGN_SHIFT_RIGHT; break;
case GDTokenizer::TK_OP_ASSIGN_BIT_AND: _VALIDATE_ASSIGN op=OperatorNode::OP_ASSIGN_BIT_AND ; break;
case GDTokenizer::TK_OP_ASSIGN_BIT_OR: _VALIDATE_ASSIGN op=OperatorNode::OP_ASSIGN_BIT_OR ; break;
case GDTokenizer::TK_OP_ASSIGN_BIT_XOR: _VALIDATE_ASSIGN op=OperatorNode::OP_ASSIGN_BIT_XOR ; break;
@@ -995,6 +1099,7 @@ GDParser::Node* GDParser::_parse_expression(Node *p_parent,bool p_static,bool p_
case OperatorNode::OP_BIT_INVERT: priority=0; unary=true; break;
case OperatorNode::OP_NEG: priority=1; unary=true; break;
+ case OperatorNode::OP_POS: priority=1; unary=true; break;
case OperatorNode::OP_MUL: priority=2; break;
case OperatorNode::OP_DIV: priority=2; break;
@@ -1223,7 +1328,7 @@ GDParser::Node* GDParser::_reduce_expression(Node *p_node,bool p_to_const) {
//reduce constant array expression
ConstantNode *cn = alloc_node<ConstantNode>();
- Array arr(!p_to_const);
+ Array arr;
//print_line("mk array "+itos(!p_to_const));
arr.resize(an->elements.size());
for(int i=0;i<an->elements.size();i++) {
@@ -1258,7 +1363,7 @@ GDParser::Node* GDParser::_reduce_expression(Node *p_node,bool p_to_const) {
//reduce constant array expression
ConstantNode *cn = alloc_node<ConstantNode>();
- Dictionary dict(!p_to_const);
+ Dictionary dict;
for(int i=0;i<dn->elements.size();i++) {
ConstantNode *key_c = static_cast<ConstantNode*>(dn->elements[i].key);
ConstantNode *value_c = static_cast<ConstantNode*>(dn->elements[i].value);
@@ -1476,6 +1581,15 @@ GDParser::Node* GDParser::_reduce_expression(Node *p_node,bool p_to_const) {
return op;
}
+ if (op->arguments[0]->type==Node::TYPE_OPERATOR) {
+ OperatorNode *on = static_cast<OperatorNode*>(op->arguments[0]);
+ if (on->op != OperatorNode::OP_INDEX && on->op != OperatorNode::OP_INDEX_NAMED) {
+ _set_error("Can't assign to an expression",tokenizer->get_token_line()-1);
+ error_line=op->line;
+ return op;
+ }
+ }
+
} break;
default: { break; }
}
@@ -1512,6 +1626,7 @@ GDParser::Node* GDParser::_reduce_expression(Node *p_node,bool p_to_const) {
//unary operators
case OperatorNode::OP_NEG: { _REDUCE_UNARY(Variant::OP_NEGATE); } break;
+ case OperatorNode::OP_POS: { _REDUCE_UNARY(Variant::OP_POSITIVE); } break;
case OperatorNode::OP_NOT: { _REDUCE_UNARY(Variant::OP_NOT); } break;
case OperatorNode::OP_BIT_INVERT: { _REDUCE_UNARY(Variant::OP_BIT_NEGATE); } break;
//binary operators (in precedence order)
@@ -1575,6 +1690,541 @@ bool GDParser::_recover_from_completion() {
return true;
}
+GDParser::PatternNode *GDParser::_parse_pattern(bool p_static)
+{
+
+ PatternNode *pattern = alloc_node<PatternNode>();
+
+ GDTokenizer::Token token = tokenizer->get_token();
+ if (error_set)
+ return NULL;
+
+ if (token == GDTokenizer::TK_EOF) {
+ return NULL;
+ }
+
+ switch (token) {
+ // array
+ case GDTokenizer::TK_BRACKET_OPEN: {
+ tokenizer->advance();
+ pattern->pt_type = GDParser::PatternNode::PT_ARRAY;
+ while (true) {
+
+ if (tokenizer->get_token() == GDTokenizer::TK_BRACKET_CLOSE) {
+ tokenizer->advance();
+ break;
+ }
+
+ if (tokenizer->get_token() == GDTokenizer::TK_PERIOD && tokenizer->get_token(1) == GDTokenizer::TK_PERIOD) {
+ // match everything
+ tokenizer->advance(2);
+ PatternNode *sub_pattern = alloc_node<PatternNode>();
+ sub_pattern->pt_type = GDParser::PatternNode::PT_IGNORE_REST;
+ pattern->array.push_back(sub_pattern);
+ if (tokenizer->get_token() == GDTokenizer::TK_COMMA && tokenizer->get_token(1) == GDTokenizer::TK_BRACKET_CLOSE) {
+ tokenizer->advance(2);
+ break;
+ } else if (tokenizer->get_token() == GDTokenizer::TK_BRACKET_CLOSE) {
+ tokenizer->advance(1);
+ break;
+ } else {
+ _set_error("'..' pattern only allowed at the end of an array pattern");
+ return NULL;
+ }
+ }
+
+ PatternNode *sub_pattern = _parse_pattern(p_static);
+ if (!sub_pattern) {
+ return NULL;
+ }
+
+ pattern->array.push_back(sub_pattern);
+
+ if (tokenizer->get_token() == GDTokenizer::TK_COMMA) {
+ tokenizer->advance();
+ continue;
+ } else if (tokenizer->get_token() == GDTokenizer::TK_BRACKET_CLOSE) {
+ tokenizer->advance();
+ break;
+ } else {
+ _set_error("Not a valid pattern");
+ return NULL;
+ }
+ }
+ } break;
+ // bind
+ case GDTokenizer::TK_PR_VAR: {
+ tokenizer->advance();
+ pattern->pt_type = GDParser::PatternNode::PT_BIND;
+ pattern->bind = tokenizer->get_token_identifier();
+ tokenizer->advance();
+ } break;
+ // dictionary
+ case GDTokenizer::TK_CURLY_BRACKET_OPEN: {
+ tokenizer->advance();
+ pattern->pt_type = GDParser::PatternNode::PT_DICTIONARY;
+ while (true) {
+
+ if (tokenizer->get_token() == GDTokenizer::TK_CURLY_BRACKET_CLOSE) {
+ tokenizer->advance();
+ break;
+ }
+
+ if (tokenizer->get_token() == GDTokenizer::TK_PERIOD && tokenizer->get_token(1) == GDTokenizer::TK_PERIOD) {
+ // match everything
+ tokenizer->advance(2);
+ PatternNode *sub_pattern = alloc_node<PatternNode>();
+ sub_pattern->pt_type = PatternNode::PT_IGNORE_REST;
+ pattern->array.push_back(sub_pattern);
+ if (tokenizer->get_token() == GDTokenizer::TK_COMMA && tokenizer->get_token(1) == GDTokenizer::TK_CURLY_BRACKET_CLOSE) {
+ tokenizer->advance(2);
+ break;
+ } else if (tokenizer->get_token() == GDTokenizer::TK_CURLY_BRACKET_CLOSE) {
+ tokenizer->advance(1);
+ break;
+ } else {
+ _set_error("'..' pattern only allowed at the end of an dictionary pattern");
+ return NULL;
+ }
+ }
+
+ Node *key = _parse_and_reduce_expression(pattern, p_static);
+ if (!key) {
+ _set_error("Not a valid key in pattern");
+ return NULL;
+ }
+
+ if (key->type != GDParser::Node::TYPE_CONSTANT) {
+ _set_error("Not a constant expression as key");
+ return NULL;
+ }
+
+ if (tokenizer->get_token() == GDTokenizer::TK_COLON) {
+ tokenizer->advance();
+
+ PatternNode *value = _parse_pattern(p_static);
+ if (!value) {
+ _set_error("Expected pattern in dictionary value");
+ return NULL;
+ }
+
+ pattern->dictionary.insert(static_cast<ConstantNode*>(key), value);
+ } else {
+ pattern->dictionary.insert(static_cast<ConstantNode*>(key), NULL);
+ }
+
+
+ if (tokenizer->get_token() == GDTokenizer::TK_COMMA) {
+ tokenizer->advance();
+ continue;
+ } else if (tokenizer->get_token() == GDTokenizer::TK_CURLY_BRACKET_CLOSE) {
+ tokenizer->advance();
+ break;
+ } else {
+ _set_error("Not a valid pattern");
+ return NULL;
+ }
+ }
+ } break;
+ case GDTokenizer::TK_WILDCARD: {
+ tokenizer->advance();
+ pattern->pt_type = PatternNode::PT_WILDCARD;
+ } break;
+ // all the constants like strings and numbers
+ default: {
+ Node *value = _parse_and_reduce_expression(pattern, p_static);
+ if (error_set) {
+ return NULL;
+ }
+
+ if (value->type != Node::TYPE_IDENTIFIER && value->type != Node::TYPE_CONSTANT) {
+ _set_error("Only constant expressions or variables allowed in a pattern");
+ return NULL;
+ }
+
+ pattern->pt_type = PatternNode::PT_CONSTANT;
+ pattern->constant = value;
+ } break;
+ }
+
+ return pattern;
+}
+
+void GDParser::_parse_pattern_block(BlockNode *p_block, Vector<PatternBranchNode*> &p_branches, bool p_static)
+{
+ int indent_level = tab_level.back()->get();
+
+ while (true) {
+
+ while (tokenizer->get_token() == GDTokenizer::TK_NEWLINE && _parse_newline());
+
+ // GDTokenizer::Token token = tokenizer->get_token();
+ if (error_set)
+ return;
+
+ if (indent_level > tab_level.back()->get()) {
+ return; // go back a level
+ }
+
+ if (pending_newline!=-1) {
+ pending_newline=-1;
+ }
+
+ PatternBranchNode *branch = alloc_node<PatternBranchNode>();
+
+ branch->patterns.push_back(_parse_pattern(p_static));
+ if (!branch->patterns[0]) {
+ return;
+ }
+
+ while (tokenizer->get_token() == GDTokenizer::TK_COMMA) {
+ tokenizer->advance();
+ branch->patterns.push_back(_parse_pattern(p_static));
+ if (!branch->patterns[branch->patterns.size() - 1]) {
+ return;
+ }
+ }
+
+ if(!_enter_indent_block()) {
+ _set_error("Expected block in pattern branch");
+ return;
+ }
+
+ branch->body = alloc_node<BlockNode>();
+ branch->body->parent_block = p_block;
+ p_block->sub_blocks.push_back(branch->body);
+ current_block = branch->body;
+
+ _parse_block(branch->body, p_static);
+
+ current_block = p_block;
+
+ p_branches.push_back(branch);
+ }
+}
+
+
+void GDParser::_generate_pattern(PatternNode *p_pattern, Node *p_node_to_match, Node *&p_resulting_node, Map<StringName, Node*> &p_bindings)
+{
+ switch (p_pattern->pt_type) {
+ case PatternNode::PT_CONSTANT: {
+
+ // typecheck
+ BuiltInFunctionNode *typeof_node = alloc_node<BuiltInFunctionNode>();
+ typeof_node->function = GDFunctions::TYPE_OF;
+
+ OperatorNode *typeof_match_value = alloc_node<OperatorNode>();
+ typeof_match_value->op = OperatorNode::OP_CALL;
+ typeof_match_value->arguments.push_back(typeof_node);
+ typeof_match_value->arguments.push_back(p_node_to_match);
+
+ OperatorNode *typeof_pattern_value = alloc_node<OperatorNode>();
+ typeof_pattern_value->op = OperatorNode::OP_CALL;
+ typeof_pattern_value->arguments.push_back(typeof_node);
+ typeof_pattern_value->arguments.push_back(p_pattern->constant);
+
+ OperatorNode *type_comp = alloc_node<OperatorNode>();
+ type_comp->op = OperatorNode::OP_EQUAL;
+ type_comp->arguments.push_back(typeof_match_value);
+ type_comp->arguments.push_back(typeof_pattern_value);
+
+
+ // comare the actual values
+ OperatorNode *value_comp = alloc_node<OperatorNode>();
+ value_comp->op = OperatorNode::OP_EQUAL;
+ value_comp->arguments.push_back(p_pattern->constant);
+ value_comp->arguments.push_back(p_node_to_match);
+
+
+ OperatorNode *comparison = alloc_node<OperatorNode>();
+ comparison->op = OperatorNode::OP_AND;
+ comparison->arguments.push_back(type_comp);
+ comparison->arguments.push_back(value_comp);
+
+ p_resulting_node = comparison;
+
+ } break;
+ case PatternNode::PT_BIND: {
+ p_bindings[p_pattern->bind] = p_node_to_match;
+
+ // a bind always matches
+ ConstantNode *true_value = alloc_node<ConstantNode>();
+ true_value->value = Variant(true);
+ p_resulting_node = true_value;
+ } break;
+ case PatternNode::PT_ARRAY: {
+
+ bool open_ended = false;
+
+ if (p_pattern->array.size() > 0) {
+ if (p_pattern->array[p_pattern->array.size() - 1]->pt_type == PatternNode::PT_IGNORE_REST) {
+ open_ended = true;
+ }
+ }
+
+ // typeof(value_to_match) == TYPE_ARRAY && value_to_match.size() >= length
+ // typeof(value_to_match) == TYPE_ARRAY && value_to_match.size() == length
+
+ {
+ // typecheck
+ BuiltInFunctionNode *typeof_node = alloc_node<BuiltInFunctionNode>();
+ typeof_node->function = GDFunctions::TYPE_OF;
+
+ OperatorNode *typeof_match_value = alloc_node<OperatorNode>();
+ typeof_match_value->op = OperatorNode::OP_CALL;
+ typeof_match_value->arguments.push_back(typeof_node);
+ typeof_match_value->arguments.push_back(p_node_to_match);
+
+ IdentifierNode *typeof_array = alloc_node<IdentifierNode>();
+ typeof_array->name = "TYPE_ARRAY";
+
+ OperatorNode *type_comp = alloc_node<OperatorNode>();
+ type_comp->op = OperatorNode::OP_EQUAL;
+ type_comp->arguments.push_back(typeof_match_value);
+ type_comp->arguments.push_back(typeof_array);
+
+
+ // size
+ ConstantNode *length = alloc_node<ConstantNode>();
+ length->value = Variant(open_ended ? p_pattern->array.size() - 1 : p_pattern->array.size());
+
+ OperatorNode *call = alloc_node<OperatorNode>();
+ call->op = OperatorNode::OP_CALL;
+ call->arguments.push_back(p_node_to_match);
+
+ IdentifierNode *size = alloc_node<IdentifierNode>();
+ size->name = "size";
+ call->arguments.push_back(size);
+
+ OperatorNode *length_comparison = alloc_node<OperatorNode>();
+ length_comparison->op = open_ended ? OperatorNode::OP_GREATER_EQUAL : OperatorNode::OP_EQUAL;
+ length_comparison->arguments.push_back(call);
+ length_comparison->arguments.push_back(length);
+
+ OperatorNode *type_and_length_comparison = alloc_node<OperatorNode>();
+ type_and_length_comparison->op = OperatorNode::OP_AND;
+ type_and_length_comparison->arguments.push_back(type_comp);
+ type_and_length_comparison->arguments.push_back(length_comparison);
+
+ p_resulting_node = type_and_length_comparison;
+ }
+
+
+
+ for (int i = 0; i < p_pattern->array.size(); i++) {
+ PatternNode *pattern = p_pattern->array[i];
+
+ Node *condition = NULL;
+
+ ConstantNode *index = alloc_node<ConstantNode>();
+ index->value = Variant(i);
+
+ OperatorNode *indexed_value = alloc_node<OperatorNode>();
+ indexed_value->op = OperatorNode::OP_INDEX;
+ indexed_value->arguments.push_back(p_node_to_match);
+ indexed_value->arguments.push_back(index);
+
+ _generate_pattern(pattern, indexed_value, condition, p_bindings);
+
+ // concatenate all the patterns with &&
+ OperatorNode *and_node = alloc_node<OperatorNode>();
+ and_node->op = OperatorNode::OP_AND;
+ and_node->arguments.push_back(p_resulting_node);
+ and_node->arguments.push_back(condition);
+
+ p_resulting_node = and_node;
+ }
+
+
+ } break;
+ case PatternNode::PT_DICTIONARY: {
+
+ bool open_ended = false;
+
+ if (p_pattern->array.size() > 0) {
+ open_ended = true;
+ }
+
+ // typeof(value_to_match) == TYPE_DICTIONARY && value_to_match.size() >= length
+ // typeof(value_to_match) == TYPE_DICTIONARY && value_to_match.size() == length
+
+
+ {
+ // typecheck
+ BuiltInFunctionNode *typeof_node = alloc_node<BuiltInFunctionNode>();
+ typeof_node->function = GDFunctions::TYPE_OF;
+
+ OperatorNode *typeof_match_value = alloc_node<OperatorNode>();
+ typeof_match_value->op = OperatorNode::OP_CALL;
+ typeof_match_value->arguments.push_back(typeof_node);
+ typeof_match_value->arguments.push_back(p_node_to_match);
+
+ IdentifierNode *typeof_dictionary = alloc_node<IdentifierNode>();
+ typeof_dictionary->name = "TYPE_DICTIONARY";
+
+ OperatorNode *type_comp = alloc_node<OperatorNode>();
+ type_comp->op = OperatorNode::OP_EQUAL;
+ type_comp->arguments.push_back(typeof_match_value);
+ type_comp->arguments.push_back(typeof_dictionary);
+
+ // size
+ ConstantNode *length = alloc_node<ConstantNode>();
+ length->value = Variant(open_ended ? p_pattern->dictionary.size() - 1 : p_pattern->dictionary.size());
+
+ OperatorNode *call = alloc_node<OperatorNode>();
+ call->op = OperatorNode::OP_CALL;
+ call->arguments.push_back(p_node_to_match);
+
+ IdentifierNode *size = alloc_node<IdentifierNode>();
+ size->name = "size";
+ call->arguments.push_back(size);
+
+ OperatorNode *length_comparison = alloc_node<OperatorNode>();
+ length_comparison->op = open_ended ? OperatorNode::OP_GREATER_EQUAL : OperatorNode::OP_EQUAL;
+ length_comparison->arguments.push_back(call);
+ length_comparison->arguments.push_back(length);
+
+ OperatorNode *type_and_length_comparison = alloc_node<OperatorNode>();
+ type_and_length_comparison->op = OperatorNode::OP_AND;
+ type_and_length_comparison->arguments.push_back(type_comp);
+ type_and_length_comparison->arguments.push_back(length_comparison);
+
+ p_resulting_node = type_and_length_comparison;
+ }
+
+
+
+ for (Map<ConstantNode*, PatternNode*>::Element *e = p_pattern->dictionary.front(); e; e = e->next()) {
+
+ Node *condition = NULL;
+
+ // chech for has, then for pattern
+
+ IdentifierNode *has = alloc_node<IdentifierNode>();
+ has->name = "has";
+
+ OperatorNode *has_call = alloc_node<OperatorNode>();
+ has_call->op = OperatorNode::OP_CALL;
+ has_call->arguments.push_back(p_node_to_match);
+ has_call->arguments.push_back(has);
+ has_call->arguments.push_back(e->key());
+
+
+ if (e->value()) {
+
+ OperatorNode *indexed_value = alloc_node<OperatorNode>();
+ indexed_value->op = OperatorNode::OP_INDEX;
+ indexed_value->arguments.push_back(p_node_to_match);
+ indexed_value->arguments.push_back(e->key());
+
+ _generate_pattern(e->value(), indexed_value, condition, p_bindings);
+
+ OperatorNode *has_and_pattern = alloc_node<OperatorNode>();
+ has_and_pattern->op = OperatorNode::OP_AND;
+ has_and_pattern->arguments.push_back(has_call);
+ has_and_pattern->arguments.push_back(condition);
+
+ condition = has_and_pattern;
+
+ } else {
+ condition = has_call;
+ }
+
+
+
+ // concatenate all the patterns with &&
+ OperatorNode *and_node = alloc_node<OperatorNode>();
+ and_node->op = OperatorNode::OP_AND;
+ and_node->arguments.push_back(p_resulting_node);
+ and_node->arguments.push_back(condition);
+
+ p_resulting_node = and_node;
+ }
+
+ } break;
+ case PatternNode::PT_IGNORE_REST:
+ case PatternNode::PT_WILDCARD: {
+ // simply generate a `true`
+ ConstantNode *true_value = alloc_node<ConstantNode>();
+ true_value->value = Variant(true);
+ p_resulting_node = true_value;
+ } break;
+ default: {
+
+ } break;
+ }
+}
+
+void GDParser::_transform_match_statment(BlockNode *p_block, MatchNode *p_match_statement)
+{
+ IdentifierNode *id = alloc_node<IdentifierNode>();
+ id->name = "#match_value";
+
+ for (int i = 0; i < p_match_statement->branches.size(); i++) {
+
+ PatternBranchNode *branch = p_match_statement->branches[i];
+
+ MatchNode::CompiledPatternBranch compiled_branch;
+ compiled_branch.compiled_pattern = NULL;
+
+ Map<StringName, Node*> binding;
+
+ for (int j = 0; j < branch->patterns.size(); j++) {
+ PatternNode *pattern = branch->patterns[j];
+
+ Map<StringName, Node*> bindings;
+ Node *resulting_node;
+ _generate_pattern(pattern, id, resulting_node, bindings);
+
+ if (!binding.empty() && !bindings.empty()) {
+ _set_error("Multipatterns can't contain bindings");
+ return;
+ } else {
+ binding = bindings;
+ }
+
+ if (compiled_branch.compiled_pattern) {
+ OperatorNode *or_node = alloc_node<OperatorNode>();
+ or_node->op = OperatorNode::OP_OR;
+ or_node->arguments.push_back(compiled_branch.compiled_pattern);
+ or_node->arguments.push_back(resulting_node);
+
+ compiled_branch.compiled_pattern = or_node;
+ } else {
+ // single pattern | first one
+ compiled_branch.compiled_pattern = resulting_node;
+ }
+
+ }
+
+
+ // prepare the body ...hehe
+ for (Map<StringName, Node*>::Element *e = binding.front(); e; e = e->next()) {
+ LocalVarNode *local_var = alloc_node<LocalVarNode>();
+ local_var->name = e->key();
+ local_var->assign = e->value();
+
+
+ IdentifierNode *id = alloc_node<IdentifierNode>();
+ id->name = local_var->name;
+
+ OperatorNode *op = alloc_node<OperatorNode>();
+ op->op=OperatorNode::OP_ASSIGN;
+ op->arguments.push_back(id);
+ op->arguments.push_back(local_var->assign);
+
+ branch->body->statements.push_front(op);
+ branch->body->statements.push_front(local_var);
+ }
+
+ compiled_branch.body = branch->body;
+
+
+ p_match_statement->compiled_pattern_branches.push_back(compiled_branch);
+ }
+
+}
+
void GDParser::_parse_block(BlockNode *p_block,bool p_static) {
int indent_level = tab_level.back()->get();
@@ -1658,6 +2308,24 @@ void GDParser::_parse_block(BlockNode *p_block,bool p_static) {
}
StringName n = tokenizer->get_token_identifier();
tokenizer->advance();
+ if (current_function){
+ for (int i=0;i<current_function->arguments.size();i++){
+ if (n == current_function->arguments[i]){
+ _set_error("Variable '"+String(n)+"' already defined in the scope (at line: "+itos(current_function->line)+").");
+ return;
+ }
+ }
+ }
+ BlockNode *check_block = p_block;
+ while (check_block){
+ for (int i=0;i<check_block->variables.size();i++){
+ if (n == check_block->variables[i]){
+ _set_error("Variable '"+String(n)+"' already defined in the scope (at line: "+itos(check_block->variable_lines[i])+").");
+ return;
+ }
+ }
+ check_block = check_block->parent_block;
+ }
p_block->variables.push_back(n); //line?
p_block->variable_lines.push_back(tokenizer->get_token_line());
@@ -1900,6 +2568,64 @@ void GDParser::_parse_block(BlockNode *p_block,bool p_static) {
return;
}
+ if (container->type==Node::TYPE_OPERATOR) {
+
+ OperatorNode* op = static_cast<OperatorNode*>(container);
+ if (op->op==OperatorNode::OP_CALL && op->arguments[0]->type==Node::TYPE_BUILT_IN_FUNCTION && static_cast<BuiltInFunctionNode*>(op->arguments[0])->function==GDFunctions::GEN_RANGE) {
+ //iterating a range, so see if range() can be optimized without allocating memory, by replacing it by vectors (which can work as iterable too!)
+
+ Vector<Node*> args;
+ Vector<double> constants;
+
+ bool constant=true;
+
+ for(int i=1;i<op->arguments.size();i++) {
+ args.push_back(op->arguments[i]);
+ if (constant && op->arguments[i]->type==Node::TYPE_CONSTANT) {
+ ConstantNode *c = static_cast<ConstantNode*>(op->arguments[i]);
+ if (c->value.get_type()==Variant::REAL || c->value.get_type()==Variant::INT) {
+ constants.push_back(c->value);
+ } else {
+ constant=false;
+ }
+ }
+ }
+
+ if (args.size()>0 || args.size()<4) {
+
+ if (constant) {
+
+ ConstantNode *cn = alloc_node<ConstantNode>();
+ switch(args.size()) {
+ case 1: cn->value=constants[0]; break;
+ case 2: cn->value=Vector2(constants[0],constants[1]); break;
+ case 3: cn->value=Vector3(constants[0],constants[1],constants[2]); break;
+ }
+ container=cn;
+ } else {
+ OperatorNode *on = alloc_node<OperatorNode>();
+ on->op=OperatorNode::OP_CALL;
+
+ TypeNode *tn = alloc_node<TypeNode>();
+ on->arguments.push_back(tn);
+
+ switch(args.size()) {
+ case 1: tn->vtype=Variant::REAL; break;
+ case 2: tn->vtype=Variant::VECTOR2; break;
+ case 3: tn->vtype=Variant::VECTOR3; break;
+ }
+
+ for(int i=0;i<args.size();i++) {
+ on->arguments.push_back(args[i]);
+ }
+
+ container=on;
+ }
+ }
+ }
+
+ }
+
ControlFlowNode *cf_for = alloc_node<ControlFlowNode>();
cf_for->cf_type=ControlFlowNode::CF_FOR;
@@ -1917,7 +2643,14 @@ void GDParser::_parse_block(BlockNode *p_block,bool p_static) {
}
current_block=cf_for->body;
+
+ // this is for checking variable for redefining
+ // inside this _parse_block
+ cf_for->body->variables.push_back(id->name);
+ cf_for->body->variable_lines.push_back(id->line);
_parse_block(cf_for->body,p_static);
+ cf_for->body->variables.remove(0);
+ cf_for->body->variable_lines.remove(0);
current_block=p_block;
if (error_set)
@@ -1979,6 +2712,46 @@ void GDParser::_parse_block(BlockNode *p_block,bool p_static) {
} break;
+ case GDTokenizer::TK_CF_MATCH: {
+
+ tokenizer->advance();
+
+ MatchNode *match_node = alloc_node<MatchNode>();
+
+ Node *val_to_match = _parse_and_reduce_expression(p_block, p_static);
+
+ if (!val_to_match) {
+ if (_recover_from_completion()) {
+ break;
+ }
+ return;
+ }
+
+ match_node->val_to_match = val_to_match;
+
+ if (!_enter_indent_block()) {
+ _set_error("Expected indented pattern matching block after 'match'");
+ return;
+ }
+
+ BlockNode *compiled_branches = alloc_node<BlockNode>();
+ compiled_branches->parent_block = p_block;
+ compiled_branches->parent_class = p_block->parent_class;
+
+ p_block->sub_blocks.push_back(compiled_branches);
+
+ _parse_pattern_block(compiled_branches, match_node->branches, p_static);
+
+ _transform_match_statment(compiled_branches, match_node);
+
+ ControlFlowNode *match_cf_node = alloc_node<ControlFlowNode>();
+ match_cf_node->cf_type = ControlFlowNode::CF_MATCH;
+ match_cf_node->match = match_node;
+
+ p_block->statements.push_back(match_cf_node);
+
+ _end_statement();
+ } break;
case GDTokenizer::TK_PR_ASSERT: {
tokenizer->advance();
@@ -2554,17 +3327,41 @@ void GDParser::_parse_class(ClassNode *p_class) {
current_export.type=type;
current_export.usage|=PROPERTY_USAGE_SCRIPT_VARIABLE;
tokenizer->advance();
+
+ String hint_prefix ="";
+
+ if(type == Variant::ARRAY && tokenizer->get_token()==GDTokenizer::TK_COMMA) {
+ tokenizer->advance();
+
+ while(tokenizer->get_token()==GDTokenizer::TK_BUILT_IN_TYPE) {
+ type = tokenizer->get_token_type();
+
+ tokenizer->advance();
+
+ if(type == Variant::ARRAY) {
+ hint_prefix += itos(Variant::ARRAY)+":";
+ if (tokenizer->get_token()==GDTokenizer::TK_COMMA) {
+ tokenizer->advance();
+ }
+ } else {
+ hint_prefix += itos(type);
+ break;
+ }
+ }
+ }
+
if (tokenizer->get_token()==GDTokenizer::TK_COMMA) {
// hint expected next!
tokenizer->advance();
- switch(current_export.type) {
+
+ switch(type) {
case Variant::INT: {
if (tokenizer->get_token()==GDTokenizer::TK_IDENTIFIER && tokenizer->get_token_identifier()=="FLAGS") {
- current_export.hint=PROPERTY_HINT_ALL_FLAGS;
+ //current_export.hint=PROPERTY_HINT_ALL_FLAGS;
tokenizer->advance();
if (tokenizer->get_token()==GDTokenizer::TK_PARENTHESIS_CLOSE) {
@@ -2913,13 +3710,20 @@ void GDParser::_parse_class(ClassNode *p_class) {
return;
} break;
}
-
+
+ }
+ if(current_export.type == Variant::ARRAY && !hint_prefix.empty()) {
+ if(current_export.hint) {
+ hint_prefix += "/"+itos(current_export.hint);
+ }
+ current_export.hint_string=hint_prefix+":"+current_export.hint_string;
+ current_export.hint=PROPERTY_HINT_NONE;
}
} else if (tokenizer->get_token()==GDTokenizer::TK_IDENTIFIER) {
String identifier = tokenizer->get_token_identifier();
- if (!ObjectTypeDB::is_type(identifier,"Resource")) {
+ if (!ClassDB::is_parent_class(identifier,"Resource")) {
current_export=PropertyInfo();
_set_error("Export hint not a type or resource.");
@@ -3137,7 +3941,7 @@ void GDParser::_parse_class(ClassNode *p_class) {
return;
}
member._export.hint=PROPERTY_HINT_RESOURCE_TYPE;
- member._export.hint_string=res->get_type();
+ member._export.hint_string=res->get_class();
}
}
}
@@ -3375,7 +4179,16 @@ void GDParser::_parse_class(ClassNode *p_class) {
} break;
-
+
+ case GDTokenizer::TK_CONSTANT: {
+ if(tokenizer->get_token_constant().get_type() == Variant::STRING) {
+ tokenizer->advance();
+ // Ignore
+ } else {
+ _set_error(String()+"Unexpected constant of type: "+Variant::get_type_name(tokenizer->get_token_constant().get_type()));
+ return;
+ }
+ } break;
default: {
diff --git a/modules/gdscript/gd_parser.h b/modules/gdscript/gd_parser.h
index 75653e0916..7968bf85df 100644
--- a/modules/gdscript/gd_parser.h
+++ b/modules/gdscript/gd_parser.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* 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 */
@@ -209,6 +209,7 @@ public:
OP_INDEX_NAMED,
//unary operators
OP_NEG,
+ OP_POS,
OP_NOT,
OP_BIT_INVERT,
OP_PREINC,
@@ -257,6 +258,44 @@ public:
Vector<Node*> arguments;
OperatorNode() { type=TYPE_OPERATOR; }
};
+
+
+ struct PatternNode : public Node {
+
+ enum PatternType {
+ PT_CONSTANT,
+ PT_BIND,
+ PT_DICTIONARY,
+ PT_ARRAY,
+ PT_IGNORE_REST,
+ PT_WILDCARD
+ };
+
+ PatternType pt_type;
+
+ Node *constant;
+ StringName bind;
+ Map<ConstantNode*, PatternNode*> dictionary;
+ Vector<PatternNode*> array;
+
+ };
+
+ struct PatternBranchNode : public Node {
+ Vector<PatternNode*> patterns;
+ BlockNode *body;
+ };
+
+ struct MatchNode : public Node {
+ Node *val_to_match;
+ Vector<PatternBranchNode*> branches;
+
+ struct CompiledPatternBranch {
+ Node *compiled_pattern;
+ BlockNode *body;
+ };
+
+ Vector<CompiledPatternBranch> compiled_pattern_branches;
+ };
struct ControlFlowNode : public Node {
enum CFType {
@@ -266,13 +305,16 @@ public:
CF_SWITCH,
CF_BREAK,
CF_CONTINUE,
- CF_RETURN
+ CF_RETURN,
+ CF_MATCH
};
CFType cf_type;
Vector<Node*> arguments;
BlockNode *body;
BlockNode *body_else;
+
+ MatchNode *match;
ControlFlowNode *_else; //used for if
ControlFlowNode() { type=TYPE_CONTROL_FLOW; cf_type=CF_IF; body=NULL; body_else=NULL;}
@@ -375,6 +417,7 @@ public:
enum CompletionType {
COMPLETION_NONE,
COMPLETION_BUILT_IN_TYPE_CONSTANT,
+ COMPLETION_GET_NODE,
COMPLETION_FUNCTION,
COMPLETION_IDENTIFIER,
COMPLETION_PARENT_FUNCTION,
@@ -450,6 +493,15 @@ private:
Node* _reduce_expression(Node *p_node,bool p_to_const=false);
Node* _parse_and_reduce_expression(Node *p_parent,bool p_static,bool p_reduce_const=false,bool p_allow_assign=false);
+
+
+
+ PatternNode *_parse_pattern(bool p_static);
+ void _parse_pattern_block(BlockNode *p_block, Vector<PatternBranchNode*> &p_branches, bool p_static);
+ void _transform_match_statment(BlockNode *p_block, MatchNode *p_match_statement);
+ void _generate_pattern(PatternNode *p_pattern, Node *p_node_to_match, Node *&p_resulting_node, Map<StringName, Node*> &p_bindings);
+
+
void _parse_block(BlockNode *p_block,bool p_static);
void _parse_extends(ClassNode *p_class);
void _parse_class(ClassNode *p_class);
diff --git a/modules/gdscript/gd_script.cpp b/modules/gdscript/gd_script.cpp
index 0ea10950df..89df7e962a 100644
--- a/modules/gdscript/gd_script.cpp
+++ b/modules/gdscript/gd_script.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* 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 */
@@ -50,7 +50,7 @@ GDNativeClass::GDNativeClass(const StringName& p_name) {
bool GDNativeClass::_get(const StringName& p_name,Variant &r_ret) const {
bool ok;
- int v = ObjectTypeDB::get_integer_constant(name, p_name, &ok);
+ int v = ClassDB::get_integer_constant(name, p_name, &ok);
if (ok) {
r_ret=v;
@@ -63,7 +63,7 @@ bool GDNativeClass::_get(const StringName& p_name,Variant &r_ret) const {
void GDNativeClass::_bind_methods() {
- ObjectTypeDB::bind_method(_MD("new"),&GDNativeClass::_new);
+ ClassDB::bind_method(_MD("new"),&GDNativeClass::_new);
}
@@ -86,7 +86,7 @@ Variant GDNativeClass::_new() {
Object *GDNativeClass::instance() {
- return ObjectTypeDB::instance(name);
+ return ClassDB::instance(name);
}
@@ -111,14 +111,29 @@ GDInstance* GDScript::_create_instance(const Variant** p_args,int p_argcount,Obj
/* STEP 2, INITIALIZE AND CONSRTUCT */
+#ifndef NO_THREADS
+ GDScriptLanguage::singleton->lock->lock();
+#endif
+
instances.insert(instance->owner);
+#ifndef NO_THREADS
+ GDScriptLanguage::singleton->lock->unlock();
+#endif
+
initializer->call(instance,p_args,p_argcount,r_error);
if (r_error.error!=Variant::CallError::CALL_OK) {
instance->script=Ref<GDScript>();
instance->owner->set_script_instance(NULL);
+#ifndef NO_THREADS
+ GDScriptLanguage::singleton->lock->lock();
+#endif
instances.erase(p_owner);
+#ifndef NO_THREADS
+ GDScriptLanguage::singleton->lock->unlock();
+#endif
+
ERR_FAIL_COND_V(r_error.error!=Variant::CallError::CALL_OK, NULL); //error constructing
}
@@ -145,6 +160,8 @@ Variant GDScript::_new(const Variant** p_args,int p_argcount,Variant::CallError&
_baseptr=_baseptr->_base;
}
+ ERR_FAIL_COND_V(_baseptr->native.is_null(), Variant());
+
if (_baseptr->native.ptr()) {
owner=_baseptr->native->instance();
} else {
@@ -341,9 +358,11 @@ bool GDScript::get_property_default_value(const StringName& p_property, Variant
#ifdef TOOLS_ENABLED
- //for (const Map<StringName,Variant>::Element *I=member_default_values.front();I;I=I->next()) {
- // print_line("\t"+String(String(I->key())+":"+String(I->get())));
- //}
+ /*
+ for (const Map<StringName,Variant>::Element *I=member_default_values.front();I;I=I->next()) {
+ print_line("\t"+String(String(I->key())+":"+String(I->get())));
+ }
+ */
const Map<StringName,Variant>::Element *E=member_default_values_cache.find(p_property);
if (E) {
r_value=E->get();
@@ -388,12 +407,12 @@ ScriptInstance* GDScript::instance_create(Object *p_this) {
top=top->_base;
if (top->native.is_valid()) {
- if (!ObjectTypeDB::is_type(p_this->get_type_name(),top->native->get_name())) {
+ if (!ClassDB::is_parent_class(p_this->get_class_name(),top->native->get_name())) {
if (ScriptDebugger::get_singleton()) {
- GDScriptLanguage::get_singleton()->debug_break_parse(get_path(),0,"Script inherits from native type '"+String(top->native->get_name())+"', so it can't be instanced in object of type: '"+p_this->get_type()+"'");
+ GDScriptLanguage::get_singleton()->debug_break_parse(get_path(),0,"Script inherits from native type '"+String(top->native->get_name())+"', so it can't be instanced in object of type: '"+p_this->get_class()+"'");
}
- ERR_EXPLAIN("Script inherits from native type '"+String(top->native->get_name())+"', so it can't be instanced in object of type: '"+p_this->get_type()+"'");
+ ERR_EXPLAIN("Script inherits from native type '"+String(top->native->get_name())+"', so it can't be instanced in object of type: '"+p_this->get_class()+"'");
ERR_FAIL_V(NULL);
}
@@ -405,7 +424,16 @@ ScriptInstance* GDScript::instance_create(Object *p_this) {
}
bool GDScript::instance_has(const Object *p_this) const {
- return instances.has((Object*)p_this);
+#ifndef NO_THREADS
+ GDScriptLanguage::singleton->lock->lock();
+#endif
+ bool hasit = instances.has((Object*)p_this);
+
+#ifndef NO_THREADS
+ GDScriptLanguage::singleton->lock->unlock();
+#endif
+
+ return hasit;
}
bool GDScript::has_source_code() const {
@@ -513,7 +541,7 @@ bool GDScript::_update_exports() {
}
}
- members_cache.clear();;
+ members_cache.clear();
member_default_values_cache.clear();
for(int i=0;i<c->variables.size();i++) {
@@ -596,8 +624,16 @@ void GDScript::_set_subclass_path(Ref<GDScript>& p_sc,const String& p_path) {
Error GDScript::reload(bool p_keep_state) {
+#ifndef NO_THREADS
+ GDScriptLanguage::singleton->lock->lock();
+#endif
+ bool has_instances = instances.size();
+
+#ifndef NO_THREADS
+ GDScriptLanguage::singleton->lock->unlock();
+#endif
- ERR_FAIL_COND_V(!p_keep_state && instances.size(),ERR_ALREADY_IN_USE);
+ ERR_FAIL_COND_V(!p_keep_state && has_instances,ERR_ALREADY_IN_USE);
String basedir=path;
@@ -751,9 +787,9 @@ void GDScript::_get_property_list(List<PropertyInfo> *p_properties) const {
void GDScript::_bind_methods() {
- ObjectTypeDB::bind_vararg_method(METHOD_FLAGS_DEFAULT,"new",&GDScript::_new,MethodInfo(Variant::OBJECT,"new"));
+ ClassDB::bind_vararg_method(METHOD_FLAGS_DEFAULT,"new",&GDScript::_new,MethodInfo(Variant::OBJECT,"new"));
- ObjectTypeDB::bind_method(_MD("get_as_byte_code"),&GDScript::get_as_byte_code);
+ ClassDB::bind_method(_MD("get_as_byte_code"),&GDScript::get_as_byte_code);
}
@@ -830,7 +866,7 @@ Error GDScript::load_byte_code(const String& p_path) {
Error GDScript::load_source_code(const String& p_path) {
- DVector<uint8_t> sourcef;
+ PoolVector<uint8_t> sourcef;
Error err;
FileAccess *f=FileAccess::open(p_path,FileAccess::READ,&err);
if (err) {
@@ -840,7 +876,7 @@ Error GDScript::load_source_code(const String& p_path) {
int len = f->get_len();
sourcef.resize(len+1);
- DVector<uint8_t>::Write w = sourcef.write();
+ PoolVector<uint8_t>::Write w = sourcef.write();
int r = f->get_buffer(w.ptr(),len);
f->close();
memdelete(f);
@@ -1423,7 +1459,15 @@ GDInstance::GDInstance() {
GDInstance::~GDInstance() {
if (script.is_valid() && owner) {
- script->instances.erase(owner);
+#ifndef NO_THREADS
+ GDScriptLanguage::singleton->lock->lock();
+#endif
+
+ script->instances.erase(owner);
+#ifndef NO_THREADS
+ GDScriptLanguage::singleton->lock->unlock();
+#endif
+
}
}
@@ -1477,7 +1521,7 @@ void GDScriptLanguage::init() {
//populate native classes
List<StringName> class_list;
- ObjectTypeDB::get_type_list(&class_list);
+ ClassDB::get_class_list(&class_list);
for(List<StringName>::Element *E=class_list.front();E;E=E->next()) {
StringName n = E->get();
@@ -1493,9 +1537,9 @@ void GDScriptLanguage::init() {
//populate singletons
- List<Globals::Singleton> singletons;
- Globals::get_singleton()->get_singletons(&singletons);
- for(List<Globals::Singleton>::Element *E=singletons.front();E;E=E->next()) {
+ List<GlobalConfig::Singleton> singletons;
+ GlobalConfig::get_singleton()->get_singletons(&singletons);
+ for(List<GlobalConfig::Singleton>::Element *E=singletons.front();E;E=E->next()) {
_add_global(E->get().name,E->get().ptr);
}
@@ -1820,7 +1864,7 @@ void GDScriptLanguage::reload_tool_script(const Ref<Script>& p_script,bool p_sof
void GDScriptLanguage::frame() {
- // print_line("calls: "+itos(calls));
+ //print_line("calls: "+itos(calls));
calls=0;
#ifdef DEBUG_ENABLED
@@ -1894,6 +1938,7 @@ void GDScriptLanguage::get_reserved_words(List<String> *p_words) const {
"for",
"pass",
"return",
+ "match",
"while",
"remote",
"sync",
@@ -1940,7 +1985,7 @@ GDScriptLanguage::GDScriptLanguage() {
script_frame_time=0;
_debug_call_stack_pos=0;
- int dmcs=GLOBAL_DEF("debug/script_max_call_stack",1024);
+ int dmcs=GLOBAL_DEF("debug/script/max_call_stack",1024);
if (ScriptDebugger::get_singleton()) {
//debugging enabled!
@@ -2026,7 +2071,7 @@ bool ResourceFormatLoaderGDScript::handles_type(const String& p_type) const {
String ResourceFormatLoaderGDScript::get_resource_type(const String &p_path) const {
- String el = p_path.extension().to_lower();
+ String el = p_path.get_extension().to_lower();
if (el=="gd" || el=="gdc" || el=="gde")
return "GDScript";
return "";
diff --git a/modules/gdscript/gd_script.h b/modules/gdscript/gd_script.h
index 051e80634f..4d3baa5bc0 100644
--- a/modules/gdscript/gd_script.h
+++ b/modules/gdscript/gd_script.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* 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 */
@@ -35,7 +35,7 @@
#include "gd_function.h"
class GDNativeClass : public Reference {
- OBJ_TYPE(GDNativeClass,Reference);
+ GDCLASS(GDNativeClass,Reference);
StringName name;
protected:
@@ -55,7 +55,7 @@ public:
class GDScript : public Script {
- OBJ_TYPE(GDScript,Script);
+ GDCLASS(GDScript,Script);
bool tool;
bool valid;
@@ -139,7 +139,7 @@ protected:
void _get_property_list(List<PropertyInfo> *p_properties) const;
Variant call(const StringName& p_method,const Variant** p_args,int p_argcount,Variant::CallError &r_error);
-// void call_multilevel(const StringName& p_method,const Variant** p_args,int p_argcount);
+ //void call_multilevel(const StringName& p_method,const Variant** p_args,int p_argcount);
static void _bind_methods();
public:
@@ -294,11 +294,13 @@ class GDScriptLanguage : public ScriptLanguage {
void _add_global(const StringName& p_name,const Variant& p_value);
+friend class GDInstance;
Mutex *lock;
+
friend class GDScript;
SelfList<GDScript>::List script_list;
@@ -406,7 +408,7 @@ public:
virtual Script *create_script() const;
virtual bool has_named_classes() const;
virtual int find_function(const String& p_function,const String& p_code) const;
- virtual String make_function(const String& p_class,const String& p_name,const StringArray& p_args) const;
+ virtual String make_function(const String& p_class,const String& p_name,const PoolStringArray& p_args) const;
virtual Error complete_code(const String& p_code, const String& p_base_path, Object*p_owner,List<String>* r_options,String& r_call_hint);
#ifdef TOOLS_ENABLED
virtual Error lookup_code(const String& p_code, const String& p_symbol, const String& p_base_path, Object*p_owner, LookupResult& r_result);
diff --git a/modules/gdscript/gd_tokenizer.cpp b/modules/gdscript/gd_tokenizer.cpp
index 39c4530d96..5be2a2beae 100644
--- a/modules/gdscript/gd_tokenizer.cpp
+++ b/modules/gdscript/gd_tokenizer.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* 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 */
@@ -85,6 +85,7 @@ const char* GDTokenizer::token_names[TK_MAX]={
"continue",
"pass",
"return",
+"match",
"func",
"class",
"extends",
@@ -118,6 +119,7 @@ const char* GDTokenizer::token_names[TK_MAX]={
"':'",
"'\\n'",
"PI",
+"_",
"Error",
"EOF",
"Cursor"};
@@ -460,6 +462,9 @@ void GDTokenizerText::_advance() {
case ':':
_make_token(TK_COLON); //for methods maybe but now useless.
break;
+ case '$':
+ _make_token(TK_DOLLAR); //for the get_node() shortener
+ break;
case '^': {
if (GETCHAR(1)=='=') {
_make_token(TK_OP_ASSIGN_BIT_XOR);
@@ -510,9 +515,11 @@ void GDTokenizerText::_advance() {
if (GETCHAR(1)=='=') {
_make_token(TK_OP_ASSIGN_ADD);
INCPOS(1);
- //} else if (GETCHAR(1)=='+') {
- // _make_token(TK_OP_PLUS_PLUS);
- // INCPOS(1);
+ /*
+ } else if (GETCHAR(1)=='+') {
+ _make_token(TK_OP_PLUS_PLUS);
+ INCPOS(1);
+ */
} else {
_make_token(TK_OP_ADD);
}
@@ -523,9 +530,11 @@ void GDTokenizerText::_advance() {
if (GETCHAR(1)=='=') {
_make_token(TK_OP_ASSIGN_SUB);
INCPOS(1);
- //} else if (GETCHAR(1)=='-') {
- // _make_token(TK_OP_MINUS_MINUS);
- // INCPOS(1);
+ /*
+ } else if (GETCHAR(1)=='-') {
+ _make_token(TK_OP_MINUS_MINUS);
+ INCPOS(1);
+ */
} else {
_make_token(TK_OP_SUB);
}
@@ -728,14 +737,14 @@ void GDTokenizerText::_advance() {
INCPOS(str.length());
if (hexa_found) {
- int val = str.hex_to_int();
+ int64_t val = str.hex_to_int64();
_make_constant(val);
} else if (period_found || exponent_found) {
- real_t val = str.to_double();
+ double val = str.to_double();
//print_line("*%*%*%*% to convert: "+str+" result: "+rtos(val));
_make_constant(val);
} else {
- int val = str.to_int();
+ int64_t val = str.to_int64();
_make_constant(val);
}
@@ -785,13 +794,12 @@ void GDTokenizerText::_advance() {
{Variant::STRING,"String"},
{Variant::VECTOR2,"Vector2"},
{Variant::RECT2,"Rect2"},
- {Variant::MATRIX32,"Matrix32"},
+ {Variant::TRANSFORM2D,"Transform2D"},
{Variant::VECTOR3,"Vector3"},
- {Variant::_AABB,"AABB"},
- {Variant::_AABB,"Rect3"},
+ {Variant::RECT3,"Rect3"},
{Variant::PLANE,"Plane"},
{Variant::QUAT,"Quat"},
- {Variant::MATRIX3,"Matrix3"},
+ {Variant::BASIS,"Basis"},
{Variant::TRANSFORM,"Transform"},
{Variant::COLOR,"Color"},
{Variant::IMAGE,"Image"},
@@ -801,13 +809,13 @@ void GDTokenizerText::_advance() {
{Variant::NODE_PATH,"NodePath"},
{Variant::DICTIONARY,"Dictionary"},
{Variant::ARRAY,"Array"},
- {Variant::RAW_ARRAY,"RawArray"},
- {Variant::INT_ARRAY,"IntArray"},
- {Variant::REAL_ARRAY,"FloatArray"},
- {Variant::STRING_ARRAY,"StringArray"},
- {Variant::VECTOR2_ARRAY,"Vector2Array"},
- {Variant::VECTOR3_ARRAY,"Vector3Array"},
- {Variant::COLOR_ARRAY,"ColorArray"},
+ {Variant::POOL_BYTE_ARRAY,"PoolByteArray"},
+ {Variant::POOL_INT_ARRAY,"PoolIntArray"},
+ {Variant::POOL_REAL_ARRAY,"PoolFloatArray"},
+ {Variant::POOL_STRING_ARRAY,"PoolStringArray"},
+ {Variant::POOL_VECTOR2_ARRAY,"PoolVector2Array"},
+ {Variant::POOL_VECTOR3_ARRAY,"PoolVector3Array"},
+ {Variant::POOL_COLOR_ARRAY,"PoolColorArray"},
{Variant::VARIANT_MAX,NULL},
};
@@ -888,9 +896,11 @@ void GDTokenizerText::_advance() {
{TK_CF_BREAK,"break"},
{TK_CF_CONTINUE,"continue"},
{TK_CF_RETURN,"return"},
+ {TK_CF_MATCH, "match"},
{TK_CF_PASS,"pass"},
{TK_SELF,"self"},
{TK_CONST_PI,"PI"},
+ {TK_WILDCARD,"_"},
{TK_ERROR,NULL}
};
@@ -1057,7 +1067,7 @@ void GDTokenizerText::advance(int p_amount) {
//////////////////////////////////////////////////////////////////////////////////////////////////////
-#define BYTECODE_VERSION 11
+#define BYTECODE_VERSION 12
Error GDTokenizerBuffer::set_code_buffer(const Vector<uint8_t> & p_buffer) {
diff --git a/modules/gdscript/gd_tokenizer.h b/modules/gdscript/gd_tokenizer.h
index b91229ab1e..5d955ff1ae 100644
--- a/modules/gdscript/gd_tokenizer.h
+++ b/modules/gdscript/gd_tokenizer.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* 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 */
@@ -92,6 +92,7 @@ public:
TK_CF_CONTINUE,
TK_CF_PASS,
TK_CF_RETURN,
+ TK_CF_MATCH,
TK_PR_FUNCTION,
TK_PR_CLASS,
TK_PR_EXTENDS,
@@ -123,8 +124,10 @@ public:
TK_PERIOD,
TK_QUESTION_MARK,
TK_COLON,
+ TK_DOLLAR,
TK_NEWLINE,
TK_CONST_PI,
+ TK_WILDCARD,
TK_ERROR,
TK_EOF,
TK_CURSOR, //used for code completion
diff --git a/modules/gdscript/register_types.cpp b/modules/gdscript/register_types.cpp
index 95b18cae4d..051d1d85cd 100644
--- a/modules/gdscript/register_types.cpp
+++ b/modules/gdscript/register_types.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* 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 */
@@ -48,7 +48,7 @@ ResourceFormatSaverGDScript *resource_saver_gd=NULL;
class EditorExportGDScript : public EditorExportPlugin {
- OBJ_TYPE(EditorExportGDScript,EditorExportPlugin);
+ GDCLASS(EditorExportGDScript,EditorExportPlugin);
public:
@@ -100,7 +100,7 @@ public:
if (err==OK) {
fae->store_buffer(file.ptr(),file.size());
- p_path=p_path.basename()+".gde";
+ p_path=p_path.get_basename()+".gde";
}
memdelete(fae);
@@ -111,7 +111,7 @@ public:
} else {
- p_path=p_path.basename()+".gdc";
+ p_path=p_path.get_basename()+".gdc";
return file;
}
}
@@ -138,8 +138,8 @@ static void register_editor_plugin() {
void register_gdscript_types() {
- ObjectTypeDB::register_type<GDScript>();
- ObjectTypeDB::register_virtual_type<GDFunctionState>();
+ ClassDB::register_class<GDScript>();
+ ClassDB::register_virtual_class<GDFunctionState>();
script_language_gd=memnew( GDScriptLanguage );
//script_language_gd->init();
diff --git a/modules/gdscript/register_types.h b/modules/gdscript/register_types.h
index aed11cd1d4..5778dfcadc 100644
--- a/modules/gdscript/register_types.h
+++ b/modules/gdscript/register_types.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* 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 */
diff --git a/modules/gridmap/config.py b/modules/gridmap/config.py
index ea7e83378a..1ab13c4aeb 100644
--- a/modules/gridmap/config.py
+++ b/modules/gridmap/config.py
@@ -1,11 +1,9 @@
def can_build(platform):
- return True
+ # FIXME: Disabled temporary for gles3 implementation
+ return False
def configure(env):
- pass
-
-
-
+ pass
diff --git a/modules/gridmap/grid_map.cpp b/modules/gridmap/grid_map.cpp
index 6e73244b57..2dd7e951ab 100644
--- a/modules/gridmap/grid_map.cpp
+++ b/modules/gridmap/grid_map.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* 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 */
@@ -61,11 +61,11 @@ bool GridMap::_set(const StringName& p_name, const Variant& p_value) {
} else if (name=="theme/bake") {
set_bake(p_value);
/* } else if (name=="cells") {
- DVector<int> cells = p_value;
+ PoolVector<int> cells = p_value;
int amount=cells.size();
- DVector<int>::Read r = cells.read();
+ PoolVector<int>::Read r = cells.read();
ERR_FAIL_COND_V(amount&1,false); // not even
- cell_map.clear();;
+ cell_map.clear();
for(int i=0;i<amount/3;i++) {
@@ -86,11 +86,11 @@ bool GridMap::_set(const StringName& p_name, const Variant& p_value) {
baked=d["baked"];
if (d.has("cells")) {
- DVector<int> cells = d["cells"];
+ PoolVector<int> cells = d["cells"];
int amount=cells.size();
- DVector<int>::Read r = cells.read();
+ PoolVector<int>::Read r = cells.read();
ERR_FAIL_COND_V(amount%3,false); // not even
- cell_map.clear();;
+ cell_map.clear();
for(int i=0;i<amount/3;i++) {
IndexKey ik;
@@ -123,7 +123,7 @@ bool GridMap::_set(const StringName& p_name, const Variant& p_value) {
Octant &g = *octant_map[ok];
g.baked=b;
- g.bake_instance=VS::get_singleton()->instance_create();;
+ g.bake_instance=VS::get_singleton()->instance_create();
VS::get_singleton()->instance_set_base(g.bake_instance,g.baked->get_rid());
VS::get_singleton()->instance_geometry_set_baked_light(g.bake_instance,baked_light_instance?baked_light_instance->get_baked_light_instance():RID());
}
@@ -183,10 +183,10 @@ bool GridMap::_get(const StringName& p_name,Variant &r_ret) const {
Dictionary d;
- DVector<int> cells;
+ PoolVector<int> cells;
cells.resize(cell_map.size()*3);
{
- DVector<int>::Write w = cells.write();
+ PoolVector<int>::Write w = cells.write();
int i=0;
for (Map<IndexKey,Cell>::Element *E=cell_map.front();E;E=E->next(),i++) {
@@ -252,7 +252,7 @@ void GridMap::_get_property_list( List<PropertyInfo> *p_list) const {
for(const Map<int,Area*>::Element *E=area_map.front();E;E=E->next()) {
String base="areas/"+itos(E->key())+"/";
- p_list->push_back( PropertyInfo( Variant::_AABB, base+"bounds", PROPERTY_HINT_NONE,"",PROPERTY_USAGE_STORAGE) );
+ p_list->push_back( PropertyInfo( Variant::RECT3, base+"bounds", PROPERTY_HINT_NONE,"",PROPERTY_USAGE_STORAGE) );
p_list->push_back( PropertyInfo( Variant::STRING, base+"name", PROPERTY_HINT_NONE,"",PROPERTY_USAGE_STORAGE) );
p_list->push_back( PropertyInfo( Variant::REAL, base+"disable_distance", PROPERTY_HINT_NONE,"",PROPERTY_USAGE_STORAGE) );
p_list->push_back( PropertyInfo( Variant::COLOR, base+"disable_color", PROPERTY_HINT_NONE,"",PROPERTY_USAGE_STORAGE) );
@@ -665,7 +665,7 @@ void GridMap::_octant_update(const OctantKey &p_key) {
VS::get_singleton()->mesh_clear(g.collision_debug);
}
- DVector<Vector3> col_debug;
+ PoolVector<Vector3> col_debug;
/*
* foreach item in this octant,
@@ -678,8 +678,8 @@ void GridMap::_octant_update(const OctantKey &p_key) {
ii.multimesh->set_instance_count(ii.cells.size());
- AABB aabb;
- AABB mesh_aabb = ii.mesh.is_null()?AABB():ii.mesh->get_aabb();
+ Rect3 aabb;
+ Rect3 mesh_aabb = ii.mesh.is_null()?Rect3():ii.mesh->get_aabb();
Vector3 ofs(cell_size*0.5*int(center_x),cell_size*0.5*int(center_y),cell_size*0.5*int(center_z));
@@ -731,7 +731,7 @@ void GridMap::_octant_update(const OctantKey &p_key) {
ii.shape->add_vertices_to_array(col_debug,xform);
}
- // print_line("PHIS x: "+xform);
+ //print_line("PHIS x: "+xform);
}
// add the item's navmesh at given xform to GridMap's Navigation ancestor
@@ -796,7 +796,7 @@ void GridMap::_octant_exit_world(const OctantKey &p_key) {
for(Map<int,Octant::ItemInstances>::Element *E=g.items.front();E;E=E->next()) {
VS::get_singleton()->instance_set_scenario(E->get().multimesh_instance,RID());
- // VS::get_singleton()->instance_set_transform(E->get().multimesh_instance,get_global_transform());
+ //VS::get_singleton()->instance_set_transform(E->get().multimesh_instance,get_global_transform());
VS::get_singleton()->instance_set_room(E->get().multimesh_instance,RID());
}
@@ -863,15 +863,15 @@ void GridMap::_octant_bake(const OctantKey &p_key, const Ref<TriangleMesh>& p_tm
if (ii.mesh->surface_get_primitive_type(i)!=Mesh::PRIMITIVE_TRIANGLES)
continue;
Array a = ii.mesh->surface_get_arrays(i);
- DVector<Vector3> av=a[VS::ARRAY_VERTEX];
+ PoolVector<Vector3> av=a[VS::ARRAY_VERTEX];
int avs = av.size();
- DVector<Vector3>::Read vr = av.read();
+ PoolVector<Vector3>::Read vr = av.read();
- DVector<int> ai=a[VS::ARRAY_INDEX];
+ PoolVector<int> ai=a[VS::ARRAY_INDEX];
int ais=ai.size();
if (ais) {
- DVector<int>::Read ir=ai.read();
+ PoolVector<int>::Read ir=ai.read();
for(int j=0;j<ais;j++) {
p_prebake->push_back(xform.xform(vr[ir[j]]));
@@ -908,7 +908,7 @@ void GridMap::_octant_bake(const OctantKey &p_key, const Ref<TriangleMesh>& p_tm
if (V)
V=V->next();
else
- V=st->get_vertex_array().front();;
+ V=st->get_vertex_array().front();
int lc = p_lights.size();
const BakeLight* bl = p_lights.ptr();
float ofs = cell_size*0.02;
@@ -920,7 +920,7 @@ void GridMap::_octant_bake(const OctantKey &p_key, const Ref<TriangleMesh>& p_tm
Vector3 vertex = v.vertex + octant_ofs;
//print_line("V GET: "+vertex);
- Vector3 normal = tm->get_area_normal( AABB( Vector3(-ofs,-ofs,-ofs)+vertex,Vector3(ofs,ofs,ofs)*2.0));
+ Vector3 normal = tm->get_area_normal( Rect3( Vector3(-ofs,-ofs,-ofs)+vertex,Vector3(ofs,ofs,ofs)*2.0));
if (normal==Vector3()) {
print_line("couldn't find for vertex: "+vertex);
}
@@ -960,9 +960,9 @@ void GridMap::_octant_bake(const OctantKey &p_key, const Ref<TriangleMesh>& p_tm
st->add_to_format(VS::ARRAY_FORMAT_COLOR);
if (m.is_valid()) {
- Ref<FixedMaterial> fm = m;
+ Ref<FixedSpatialMaterial> fm = m;
if (fm.is_valid())
- fm->set_fixed_flag(FixedMaterial::FLAG_USE_COLOR_ARRAY,true);
+ fm->set_fixed_flag(FixedSpatialMaterial::FLAG_USE_COLOR_ARRAY,true);
}
}
}
@@ -1001,8 +1001,8 @@ void GridMap::_notification(int p_what) {
_update_area_instances();
for(Map<OctantKey,Octant*>::Element *E=octant_map.front();E;E=E->next()) {
-// IndexKey ik;
-// ik.key = E->key().indexkey;
+ //IndexKey ik;
+ //ik.key = E->key().indexkey;
_octant_enter_world(E->key());
_octant_update(E->key());
}
@@ -1185,60 +1185,60 @@ void GridMap::_update_dirty_map_callback() {
void GridMap::_bind_methods() {
- ObjectTypeDB::bind_method(_MD("set_theme","theme:MeshLibrary"),&GridMap::set_theme);
- ObjectTypeDB::bind_method(_MD("get_theme:MeshLibrary"),&GridMap::get_theme);
+ ClassDB::bind_method(_MD("set_theme","theme:MeshLibrary"),&GridMap::set_theme);
+ ClassDB::bind_method(_MD("get_theme:MeshLibrary"),&GridMap::get_theme);
- ObjectTypeDB::bind_method(_MD("set_bake","enable"),&GridMap::set_bake);
- ObjectTypeDB::bind_method(_MD("is_baking_enabled"),&GridMap::is_baking_enabled);
+ ClassDB::bind_method(_MD("set_bake","enable"),&GridMap::set_bake);
+ ClassDB::bind_method(_MD("is_baking_enabled"),&GridMap::is_baking_enabled);
- ObjectTypeDB::bind_method(_MD("set_cell_size","size"),&GridMap::set_cell_size);
- ObjectTypeDB::bind_method(_MD("get_cell_size"),&GridMap::get_cell_size);
+ ClassDB::bind_method(_MD("set_cell_size","size"),&GridMap::set_cell_size);
+ ClassDB::bind_method(_MD("get_cell_size"),&GridMap::get_cell_size);
- ObjectTypeDB::bind_method(_MD("set_octant_size","size"),&GridMap::set_octant_size);
- ObjectTypeDB::bind_method(_MD("get_octant_size"),&GridMap::get_octant_size);
+ ClassDB::bind_method(_MD("set_octant_size","size"),&GridMap::set_octant_size);
+ ClassDB::bind_method(_MD("get_octant_size"),&GridMap::get_octant_size);
- ObjectTypeDB::bind_method(_MD("set_cell_item","x","y","z","item","orientation"),&GridMap::set_cell_item,DEFVAL(0));
- ObjectTypeDB::bind_method(_MD("get_cell_item","x","y","z"),&GridMap::get_cell_item);
- ObjectTypeDB::bind_method(_MD("get_cell_item_orientation","x","y","z"),&GridMap::get_cell_item_orientation);
+ ClassDB::bind_method(_MD("set_cell_item","x","y","z","item","orientation"),&GridMap::set_cell_item,DEFVAL(0));
+ ClassDB::bind_method(_MD("get_cell_item","x","y","z"),&GridMap::get_cell_item);
+ ClassDB::bind_method(_MD("get_cell_item_orientation","x","y","z"),&GridMap::get_cell_item_orientation);
-// ObjectTypeDB::bind_method(_MD("_recreate_octants"),&GridMap::_recreate_octants);
- ObjectTypeDB::bind_method(_MD("_update_dirty_map_callback"),&GridMap::_update_dirty_map_callback);
- ObjectTypeDB::bind_method(_MD("resource_changed","resource"),&GridMap::resource_changed);
+ //ClassDB::bind_method(_MD("_recreate_octants"),&GridMap::_recreate_octants);
+ ClassDB::bind_method(_MD("_update_dirty_map_callback"),&GridMap::_update_dirty_map_callback);
+ ClassDB::bind_method(_MD("resource_changed","resource"),&GridMap::resource_changed);
- ObjectTypeDB::bind_method(_MD("set_center_x","enable"),&GridMap::set_center_x);
- ObjectTypeDB::bind_method(_MD("get_center_x"),&GridMap::get_center_x);
- ObjectTypeDB::bind_method(_MD("set_center_y","enable"),&GridMap::set_center_y);
- ObjectTypeDB::bind_method(_MD("get_center_y"),&GridMap::get_center_y);
- ObjectTypeDB::bind_method(_MD("set_center_z","enable"),&GridMap::set_center_z);
- ObjectTypeDB::bind_method(_MD("get_center_z"),&GridMap::get_center_z);
+ ClassDB::bind_method(_MD("set_center_x","enable"),&GridMap::set_center_x);
+ ClassDB::bind_method(_MD("get_center_x"),&GridMap::get_center_x);
+ ClassDB::bind_method(_MD("set_center_y","enable"),&GridMap::set_center_y);
+ ClassDB::bind_method(_MD("get_center_y"),&GridMap::get_center_y);
+ ClassDB::bind_method(_MD("set_center_z","enable"),&GridMap::set_center_z);
+ ClassDB::bind_method(_MD("get_center_z"),&GridMap::get_center_z);
- ObjectTypeDB::bind_method(_MD("set_clip","enabled","clipabove","floor","axis"),&GridMap::set_clip,DEFVAL(true),DEFVAL(0),DEFVAL(Vector3::AXIS_X));
+ ClassDB::bind_method(_MD("set_clip","enabled","clipabove","floor","axis"),&GridMap::set_clip,DEFVAL(true),DEFVAL(0),DEFVAL(Vector3::AXIS_X));
- ObjectTypeDB::bind_method(_MD("create_area","id","area"),&GridMap::create_area);
- ObjectTypeDB::bind_method(_MD("area_get_bounds","area","bounds"),&GridMap::area_get_bounds);
- ObjectTypeDB::bind_method(_MD("area_set_exterior_portal","area","enable"),&GridMap::area_set_exterior_portal);
- ObjectTypeDB::bind_method(_MD("area_set_name","area","name"),&GridMap::area_set_name);
- ObjectTypeDB::bind_method(_MD("area_get_name","area"),&GridMap::area_get_name);
- ObjectTypeDB::bind_method(_MD("area_is_exterior_portal","area"),&GridMap::area_is_exterior_portal);
- ObjectTypeDB::bind_method(_MD("area_set_portal_disable_distance","area","distance"),&GridMap::area_set_portal_disable_distance);
- ObjectTypeDB::bind_method(_MD("area_get_portal_disable_distance","area"),&GridMap::area_get_portal_disable_distance);
- ObjectTypeDB::bind_method(_MD("area_set_portal_disable_color","area","color"),&GridMap::area_set_portal_disable_color);
- ObjectTypeDB::bind_method(_MD("area_get_portal_disable_color","area"),&GridMap::area_get_portal_disable_color);
- ObjectTypeDB::bind_method(_MD("erase_area","area"),&GridMap::erase_area);
- ObjectTypeDB::bind_method(_MD("get_unused_area_id","area"),&GridMap::get_unused_area_id);
- ObjectTypeDB::bind_method(_MD("bake_geometry"),&GridMap::bake_geometry);
+ ClassDB::bind_method(_MD("create_area","id","area"),&GridMap::create_area);
+ ClassDB::bind_method(_MD("area_get_bounds","area","bounds"),&GridMap::area_get_bounds);
+ ClassDB::bind_method(_MD("area_set_exterior_portal","area","enable"),&GridMap::area_set_exterior_portal);
+ ClassDB::bind_method(_MD("area_set_name","area","name"),&GridMap::area_set_name);
+ ClassDB::bind_method(_MD("area_get_name","area"),&GridMap::area_get_name);
+ ClassDB::bind_method(_MD("area_is_exterior_portal","area"),&GridMap::area_is_exterior_portal);
+ ClassDB::bind_method(_MD("area_set_portal_disable_distance","area","distance"),&GridMap::area_set_portal_disable_distance);
+ ClassDB::bind_method(_MD("area_get_portal_disable_distance","area"),&GridMap::area_get_portal_disable_distance);
+ ClassDB::bind_method(_MD("area_set_portal_disable_color","area","color"),&GridMap::area_set_portal_disable_color);
+ ClassDB::bind_method(_MD("area_get_portal_disable_color","area"),&GridMap::area_get_portal_disable_color);
+ ClassDB::bind_method(_MD("erase_area","area"),&GridMap::erase_area);
+ ClassDB::bind_method(_MD("get_unused_area_id","area"),&GridMap::get_unused_area_id);
+ ClassDB::bind_method(_MD("bake_geometry"),&GridMap::bake_geometry);
- ObjectTypeDB::bind_method(_MD("_baked_light_changed"),&GridMap::_baked_light_changed);
- ObjectTypeDB::bind_method(_MD("set_use_baked_light","use"),&GridMap::set_use_baked_light);
- ObjectTypeDB::bind_method(_MD("is_using_baked_light","use"),&GridMap::is_using_baked_light);
+ ClassDB::bind_method(_MD("_baked_light_changed"),&GridMap::_baked_light_changed);
+ ClassDB::bind_method(_MD("set_use_baked_light","use"),&GridMap::set_use_baked_light);
+ ClassDB::bind_method(_MD("is_using_baked_light","use"),&GridMap::is_using_baked_light);
- ObjectTypeDB::bind_method(_MD("_get_baked_light_meshes"),&GridMap::_get_baked_light_meshes);
+ ClassDB::bind_method(_MD("_get_baked_light_meshes"),&GridMap::_get_baked_light_meshes);
- ObjectTypeDB::set_method_flags("GridMap","bake_geometry",METHOD_FLAGS_DEFAULT|METHOD_FLAG_EDITOR);
+ ClassDB::set_method_flags("GridMap","bake_geometry",METHOD_FLAGS_DEFAULT|METHOD_FLAG_EDITOR);
- ObjectTypeDB::bind_method(_MD("clear"),&GridMap::clear);
+ ClassDB::bind_method(_MD("clear"),&GridMap::clear);
BIND_CONSTANT( INVALID_CELL_ITEM );
@@ -1435,7 +1435,7 @@ void GridMap::_update_area_instances() {
}
-Error GridMap::create_area(int p_id,const AABB& p_bounds) {
+Error GridMap::create_area(int p_id,const Rect3& p_bounds) {
ERR_FAIL_COND_V(area_map.has(p_id),ERR_ALREADY_EXISTS);
ERR_EXPLAIN("ID 0 is taken as global area, start from 1");
@@ -1484,12 +1484,12 @@ Error GridMap::create_area(int p_id,const AABB& p_bounds) {
return OK;
}
-AABB GridMap::area_get_bounds(int p_area) const {
+Rect3 GridMap::area_get_bounds(int p_area) const {
- ERR_FAIL_COND_V(!area_map.has(p_area),AABB());
+ ERR_FAIL_COND_V(!area_map.has(p_area),Rect3());
const Area *a = area_map[p_area];
- AABB aabb;
+ Rect3 aabb;
aabb.pos=Vector3(a->from.x,a->from.y,a->from.z);
aabb.size=Vector3(a->to.x,a->to.y,a->to.z)-aabb.pos;
@@ -1667,7 +1667,7 @@ void GridMap::bake_geometry() {
}
- DVector<Vector3> vv;
+ PoolVector<Vector3> vv;
vv.fill_with(vertices);
//print_line("TOTAL VERTICES: "+itos(vv.size()));
tmesh = Ref<TriangleMesh>( memnew( TriangleMesh ));
@@ -1706,10 +1706,12 @@ void GridMap::bake_geometry() {
void GridMap::_baked_light_changed() {
-// if (!baked_light_instance)
-// VS::get_singleton()->instance_geometry_set_baked_light(get_instance(),RID());
-// else
-// VS::get_singleton()->instance_geometry_set_baked_light(get_instance(),baked_light_instance->get_baked_light_instance());
+ /*
+ if (!baked_light_instance)
+ VS::get_singleton()->instance_geometry_set_baked_light(get_instance(),RID());
+ else
+ VS::get_singleton()->instance_geometry_set_baked_light(get_instance(),baked_light_instance->get_baked_light_instance());
+ */
for(Map<OctantKey,Octant*>::Element *E=octant_map.front();E;E=E->next()) {
for(Map<int,Octant::ItemInstances>::Element *F=E->get()->items.front();F;F=F->next()) {
@@ -1831,6 +1833,7 @@ GridMap::GridMap() {
use_baked_light=false;
navigation = NULL;
+ set_notify_transform(true);
}
diff --git a/modules/gridmap/grid_map.h b/modules/gridmap/grid_map.h
index 0116ea094f..04d140cdc6 100644
--- a/modules/gridmap/grid_map.h
+++ b/modules/gridmap/grid_map.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* 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 */
@@ -44,7 +44,7 @@ class BakedLightInstance;
class GridMap : public Spatial {
- OBJ_TYPE( GridMap, Spatial );
+ GDCLASS( GridMap, Spatial );
enum {
MAP_DIRTY_TRANSFORMS=1,
@@ -268,8 +268,8 @@ public:
void set_clip(bool p_enabled, bool p_clip_above=true, int p_floor=0, Vector3::Axis p_axis=Vector3::AXIS_X);
- Error create_area(int p_id,const AABB& p_area);
- AABB area_get_bounds(int p_area) const;
+ Error create_area(int p_id,const Rect3& p_area);
+ Rect3 area_get_bounds(int p_area) const;
void area_set_exterior_portal(int p_area,bool p_enable);
void area_set_name(int p_area,const String& p_name);
String area_get_name(int p_area) const;
diff --git a/modules/gridmap/grid_map_editor_plugin.cpp b/modules/gridmap/grid_map_editor_plugin.cpp
index 9bdad6713d..0d57ffa394 100644
--- a/modules/gridmap/grid_map_editor_plugin.cpp
+++ b/modules/gridmap/grid_map_editor_plugin.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* 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 */
@@ -99,70 +99,70 @@ void GridMapEditor::_menu_option(int p_option) {
} break;
case MENU_OPTION_CURSOR_ROTATE_Y: {
- Matrix3 r;
+ Basis r;
if (input_action==INPUT_DUPLICATE) {
r.set_orthogonal_index(selection.duplicate_rot);
- r.rotate(Vector3(0,1,0),Math_PI/2.0);
+ r.rotate(Vector3(0,1,0),-Math_PI/2.0);
selection.duplicate_rot=r.get_orthogonal_index();
_update_duplicate_indicator();
break;
}
r.set_orthogonal_index(cursor_rot);
- r.rotate(Vector3(0,1,0),Math_PI/2.0);
+ r.rotate(Vector3(0,1,0),-Math_PI/2.0);
cursor_rot=r.get_orthogonal_index();
_update_cursor_transform();
} break;
case MENU_OPTION_CURSOR_ROTATE_X: {
- Matrix3 r;
+ Basis r;
if (input_action==INPUT_DUPLICATE) {
r.set_orthogonal_index(selection.duplicate_rot);
- r.rotate(Vector3(1,0,0),Math_PI/2.0);
+ r.rotate(Vector3(1,0,0),-Math_PI/2.0);
selection.duplicate_rot=r.get_orthogonal_index();
_update_duplicate_indicator();
break;
}
r.set_orthogonal_index(cursor_rot);
- r.rotate(Vector3(1,0,0),Math_PI/2.0);
+ r.rotate(Vector3(1,0,0),-Math_PI/2.0);
cursor_rot=r.get_orthogonal_index();
_update_cursor_transform();
} break;
case MENU_OPTION_CURSOR_ROTATE_Z: {
- Matrix3 r;
+ Basis r;
if (input_action==INPUT_DUPLICATE) {
r.set_orthogonal_index(selection.duplicate_rot);
- r.rotate(Vector3(0,0,1),Math_PI/2.0);
+ r.rotate(Vector3(0,0,1),-Math_PI/2.0);
selection.duplicate_rot=r.get_orthogonal_index();
_update_duplicate_indicator();
break;
}
r.set_orthogonal_index(cursor_rot);
- r.rotate(Vector3(0,0,1),Math_PI/2.0);
+ r.rotate(Vector3(0,0,1),-Math_PI/2.0);
cursor_rot=r.get_orthogonal_index();
_update_cursor_transform();
} break;
case MENU_OPTION_CURSOR_BACK_ROTATE_Y: {
- Matrix3 r;
+ Basis r;
r.set_orthogonal_index(cursor_rot);
- r.rotate(Vector3(0,1,0),-Math_PI/2.0);
+ r.rotate(Vector3(0,1,0),Math_PI/2.0);
cursor_rot=r.get_orthogonal_index();
_update_cursor_transform();
} break;
case MENU_OPTION_CURSOR_BACK_ROTATE_X: {
- Matrix3 r;
+ Basis r;
r.set_orthogonal_index(cursor_rot);
- r.rotate(Vector3(1,0,0),-Math_PI/2.0);
+ r.rotate(Vector3(1,0,0),Math_PI/2.0);
cursor_rot=r.get_orthogonal_index();
_update_cursor_transform();
} break;
case MENU_OPTION_CURSOR_BACK_ROTATE_Z: {
- Matrix3 r;
+ Basis r;
r.set_orthogonal_index(cursor_rot);
- r.rotate(Vector3(0,0,1),-Math_PI/2.0);
+ r.rotate(Vector3(0,0,1),Math_PI/2.0);
cursor_rot=r.get_orthogonal_index();
_update_cursor_transform();
} break;
@@ -191,7 +191,7 @@ void GridMapEditor::_menu_option(int p_option) {
if (!selection.active)
break;
int area = node->get_unused_area_id();
- Error err = node->create_area(area,AABB(selection.begin,selection.end-selection.begin+Vector3(1,1,1)));
+ Error err = node->create_area(area,Rect3(selection.begin,selection.end-selection.begin+Vector3(1,1,1)));
if (err!=OK) {
@@ -318,7 +318,7 @@ bool GridMapEditor::do_input_action(Camera* p_camera,const Point2& p_point,bool
p.d=edit_floor[edit_axis]*node->get_cell_size();
Vector3 inters;
- if (!p.intersects_segment(from, from + normal * settings_pick_distance->get_val(), &inters))
+ if (!p.intersects_segment(from, from + normal * settings_pick_distance->get_value(), &inters))
return false;
@@ -358,7 +358,7 @@ bool GridMapEditor::do_input_action(Camera* p_camera,const Point2& p_point,bool
}
last_mouseover=Vector3(cell[0],cell[1],cell[2]);
- VS::get_singleton()->instance_set_transform(grid_instance[edit_axis],Transform(Matrix3(),grid_ofs));
+ VS::get_singleton()->instance_set_transform(grid_instance[edit_axis],Transform(Basis(),grid_ofs));
if (cursor_instance.is_valid()) {
@@ -459,7 +459,7 @@ void GridMapEditor::_update_duplicate_indicator() {
Transform xf;
xf.scale(Vector3(1,1,1)*(Vector3(1,1,1)+(selection.end-selection.begin))*node->get_cell_size());
xf.origin=(selection.begin+(selection.current-selection.click))*node->get_cell_size();
- Matrix3 rot;
+ Basis rot;
rot.set_orthogonal_index(selection.duplicate_rot);
xf.basis = rot * xf.basis;
@@ -481,7 +481,7 @@ void GridMapEditor::_duplicate_paste() {
List< __Item > items;
- Matrix3 rot;
+ Basis rot;
rot.set_orthogonal_index(selection.duplicate_rot);
for(int i=selection.begin.x;i<=selection.end.x;i++) {
@@ -498,7 +498,7 @@ void GridMapEditor::_duplicate_paste() {
Vector3 rel=Vector3(i,j,k)-selection.begin;
rel = rot.xform(rel);
- Matrix3 orm;
+ Basis orm;
orm.set_orthogonal_index(orientation);
orm = rot * orm;
@@ -548,12 +548,12 @@ bool GridMapEditor::forward_spatial_input_event(Camera* p_camera,const InputEven
if (p_event.mouse_button.button_index==BUTTON_WHEEL_UP && (p_event.mouse_button.mod.command || p_event.mouse_button.mod.shift)) {
if (p_event.mouse_button.pressed)
- floor->set_val( floor->get_val() +1);
+ floor->set_value( floor->get_value() +1);
return true; //eaten
} else if (p_event.mouse_button.button_index==BUTTON_WHEEL_DOWN && (p_event.mouse_button.mod.command || p_event.mouse_button.mod.shift)) {
if (p_event.mouse_button.pressed)
- floor->set_val( floor->get_val() -1);
+ floor->set_value( floor->get_value() -1);
return true;
}
@@ -664,7 +664,7 @@ bool GridMapEditor::forward_spatial_input_event(Camera* p_camera,const InputEven
for(List<int>::Element *E=areas.front();E;E=E->next()) {
int area = E->get();
- AABB aabb = node->area_get_bounds(area);
+ Rect3 aabb = node->area_get_bounds(area);
aabb.pos*=node->get_cell_size();
aabb.size*=node->get_cell_size();
@@ -731,7 +731,7 @@ void GridMapEditor::update_pallete() {
theme_pallete->set_icon_mode(ItemList::ICON_MODE_LEFT);
}
- float min_size = EDITOR_DEF("grid_map/preview_size",64);
+ float min_size = EDITOR_DEF("editors/grid_map/preview_size",64);
theme_pallete->set_fixed_icon_size(Size2(min_size, min_size));
theme_pallete->set_fixed_column_width(min_size*3/2);
theme_pallete->set_max_text_lines(2);
@@ -903,7 +903,7 @@ void GridMapEditor::edit(GridMap *p_gridmap) {
Vector3 axis;
axis[i]=1;
Vector3 axis_n1;
- axis_n1[(i+1)%3]=cell_size[(i+1)%3];;
+ axis_n1[(i+1)%3]=cell_size[(i+1)%3];
Vector3 axis_n2;
axis_n2[(i+2)%3]=cell_size[(i+2)%3];
@@ -972,7 +972,7 @@ void GridMapEditor::update_grid() {
grid_ofs[edit_axis]=edit_floor[edit_axis]*node->get_cell_size();
edit_grid_xform.origin=grid_ofs;
- edit_grid_xform.basis=Matrix3();
+ edit_grid_xform.basis=Basis();
for(int i=0;i<3;i++) {
@@ -981,7 +981,7 @@ void GridMapEditor::update_grid() {
}
updating=true;
- floor->set_val(edit_floor[edit_axis]);
+ floor->set_value(edit_floor[edit_axis]);
updating=false;
}
@@ -1126,7 +1126,7 @@ void GridMapEditor::_update_areas_display() {
RID mesh = VisualServer::get_singleton()->mesh_create();
- DVector<Plane> planes;
+ PoolVector<Plane> planes;
for(int i=0;i<3;i++) {
Vector3 axis;
@@ -1142,7 +1142,7 @@ void GridMapEditor::_update_areas_display() {
ad.mesh=mesh;
ad.instance = VisualServer::get_singleton()->instance_create2(mesh,node->get_world()->get_scenario());
Transform xform;
- AABB aabb = node->area_get_bounds(area);
+ Rect3 aabb = node->area_get_bounds(area);
xform.origin=aabb.pos * node->get_cell_size();
xform.basis.scale(aabb.size * node->get_cell_size());
VisualServer::get_singleton()->instance_set_transform(ad.instance,global_xf * xform);
@@ -1181,15 +1181,15 @@ void GridMapEditor::_floor_changed(float p_value) {
void GridMapEditor::_bind_methods() {
- ObjectTypeDB::bind_method("_menu_option",&GridMapEditor::_menu_option);
- ObjectTypeDB::bind_method("_configure",&GridMapEditor::_configure);
- ObjectTypeDB::bind_method("_item_selected_cbk",&GridMapEditor::_item_selected_cbk);
- ObjectTypeDB::bind_method("_edit_mode_changed",&GridMapEditor::_edit_mode_changed);
- ObjectTypeDB::bind_method("_area_renamed",&GridMapEditor::_area_renamed);
- ObjectTypeDB::bind_method("_area_selected",&GridMapEditor::_area_selected);
- ObjectTypeDB::bind_method("_floor_changed",&GridMapEditor::_floor_changed);
+ ClassDB::bind_method("_menu_option",&GridMapEditor::_menu_option);
+ ClassDB::bind_method("_configure",&GridMapEditor::_configure);
+ ClassDB::bind_method("_item_selected_cbk",&GridMapEditor::_item_selected_cbk);
+ ClassDB::bind_method("_edit_mode_changed",&GridMapEditor::_edit_mode_changed);
+ ClassDB::bind_method("_area_renamed",&GridMapEditor::_area_renamed);
+ ClassDB::bind_method("_area_selected",&GridMapEditor::_area_selected);
+ ClassDB::bind_method("_floor_changed",&GridMapEditor::_floor_changed);
- ObjectTypeDB::bind_method(_MD("_set_display_mode","mode"), &GridMapEditor::_set_display_mode);
+ ClassDB::bind_method(_MD("_set_display_mode","mode"), &GridMapEditor::_set_display_mode);
}
@@ -1201,7 +1201,7 @@ GridMapEditor::GridMapEditor(EditorNode *p_editor) {
editor=p_editor;
undo_redo=p_editor->get_undo_redo();
- int mw = EDITOR_DEF("grid_map/palette_min_width",230);
+ int mw = EDITOR_DEF("editors/grid_map/palette_min_width",230);
Control *ec = memnew( Control);
ec->set_custom_minimum_size(Size2(mw,0));
add_child(ec);
@@ -1257,17 +1257,16 @@ GridMapEditor::GridMapEditor(EditorNode *p_editor) {
settings_vbc = memnew(VBoxContainer);
settings_vbc->set_custom_minimum_size(Size2(200, 0));
settings_dialog->add_child(settings_vbc);
- settings_dialog->set_child_rect(settings_vbc);
settings_pick_distance = memnew(SpinBox);
settings_pick_distance->set_max(10000.0f);
settings_pick_distance->set_min(500.0f);
settings_pick_distance->set_step(1.0f);
- settings_pick_distance->set_val(EDITOR_DEF("grid_map/pick_distance", 5000.0));
+ settings_pick_distance->set_value(EDITOR_DEF("editors/grid_map/pick_distance", 5000.0));
settings_vbc->add_margin_child("Pick Distance:", settings_pick_distance);
clip_mode=CLIP_DISABLED;
- options->get_popup()->connect("item_pressed", this,"_menu_option");
+ options->get_popup()->connect("id_pressed", this,"_menu_option");
HBoxContainer *hb = memnew( HBoxContainer );
add_child(hb);
@@ -1275,8 +1274,8 @@ GridMapEditor::GridMapEditor(EditorNode *p_editor) {
edit_mode = memnew(OptionButton);
edit_mode->set_area_as_parent_rect();
- edit_mode->set_anchor_and_margin(MARGIN_BOTTOM,ANCHOR_BEGIN,24);;
- edit_mode->set_anchor_and_margin(MARGIN_RIGHT,ANCHOR_END,14);;
+ edit_mode->set_anchor_and_margin(MARGIN_BOTTOM,ANCHOR_BEGIN,24);
+ edit_mode->set_anchor_and_margin(MARGIN_RIGHT,ANCHOR_END,14);
edit_mode->add_item("Tiles");
edit_mode->add_item("Areas");
hb->add_child(edit_mode);
@@ -1296,6 +1295,8 @@ GridMapEditor::GridMapEditor(EditorNode *p_editor) {
hb->add_child(mode_list);
mode_list->connect("pressed", this, "_set_display_mode", varray(DISPLAY_LIST));
+ EDITOR_DEF("editors/grid_map/preview_size",64)
+
display_mode = DISPLAY_THUMBNAIL;
selected_area=-1;
@@ -1341,8 +1342,8 @@ GridMapEditor::GridMapEditor(EditorNode *p_editor) {
//selection mesh create
- DVector<Vector3> lines;
- DVector<Vector3> triangles;
+ PoolVector<Vector3> lines;
+ PoolVector<Vector3> triangles;
for (int i=0;i<6;i++) {
@@ -1376,7 +1377,7 @@ GridMapEditor::GridMapEditor(EditorNode *p_editor) {
for(int i=0;i<12;i++) {
- AABB base(Vector3(0,0,0),Vector3(1,1,1));
+ Rect3 base(Vector3(0,0,0),Vector3(1,1,1));
Vector3 a,b;
base.get_edge(i,a,b);
lines.push_back(a);
@@ -1480,7 +1481,7 @@ void GridMapEditorPlugin::edit(Object *p_object) {
bool GridMapEditorPlugin::handles(Object *p_object) const {
- return p_object->is_type("GridMap");
+ return p_object->is_class("GridMap");
}
void GridMapEditorPlugin::make_visible(bool p_visible) {
diff --git a/modules/gridmap/grid_map_editor_plugin.h b/modules/gridmap/grid_map_editor_plugin.h
index 535c51bcbf..2c0ff99dc6 100644
--- a/modules/gridmap/grid_map_editor_plugin.h
+++ b/modules/gridmap/grid_map_editor_plugin.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* 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 */
@@ -40,7 +40,7 @@
class SpatialEditorPlugin;
class GridMapEditor : public VBoxContainer {
- OBJ_TYPE(GridMapEditor, VBoxContainer );
+ GDCLASS(GridMapEditor, VBoxContainer );
enum {
@@ -238,7 +238,7 @@ public:
class GridMapEditorPlugin : public EditorPlugin {
- OBJ_TYPE( GridMapEditorPlugin, EditorPlugin );
+ GDCLASS( GridMapEditorPlugin, EditorPlugin );
GridMapEditor *gridmap_editor;
EditorNode *editor;
diff --git a/modules/gridmap/register_types.cpp b/modules/gridmap/register_types.cpp
index 9dcc04b22a..9cd70a0f9b 100644
--- a/modules/gridmap/register_types.cpp
+++ b/modules/gridmap/register_types.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* 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 */
@@ -28,7 +28,7 @@
/*************************************************************************/
#include "register_types.h"
#ifndef _3D_DISABLED
-#include "object_type_db.h"
+#include "class_db.h"
#include "grid_map.h"
#include "grid_map_editor_plugin.h"
#endif
@@ -36,7 +36,7 @@
void register_gridmap_types() {
#ifndef _3D_DISABLED
- ObjectTypeDB::register_type<GridMap>();
+ ClassDB::register_class<GridMap>();
#ifdef TOOLS_ENABLED
EditorPlugins::add_by_type<GridMapEditorPlugin>();
#endif
diff --git a/modules/gridmap/register_types.h b/modules/gridmap/register_types.h
index 7b5c10f9e5..cc7c13961a 100644
--- a/modules/gridmap/register_types.h
+++ b/modules/gridmap/register_types.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* 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 */
diff --git a/modules/ik/SCsub b/modules/ik/SCsub
deleted file mode 100644
index 0882406761..0000000000
--- a/modules/ik/SCsub
+++ /dev/null
@@ -1,7 +0,0 @@
-#!/usr/bin/env python
-
-Import('env')
-
-env.add_source_files(env.modules_sources, "*.cpp")
-
-Export('env')
diff --git a/modules/ik/config.py b/modules/ik/config.py
deleted file mode 100644
index f9bd7da08d..0000000000
--- a/modules/ik/config.py
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-def can_build(platform):
- return True
-
-
-def configure(env):
- pass
-
-
-
diff --git a/modules/ik/ik.cpp b/modules/ik/ik.cpp
deleted file mode 100644
index 35b3ba7e83..0000000000
--- a/modules/ik/ik.cpp
+++ /dev/null
@@ -1,326 +0,0 @@
-/*************************************************************************/
-/* ik.cpp */
-/* Copyright (c) 2016 Sergey Lapin <slapinid@gmail.com> */
-/*************************************************************************/
-/* This file is part of: */
-/* GODOT ENGINE */
-/* http://www.godotengine.org */
-/*************************************************************************/
-/* Copyright (c) 2007-2016 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 "ik.h"
-
-bool InverseKinematics::_get(const StringName& p_name,Variant &r_ret) const
-{
-
- if (String(p_name)=="ik_bone") {
-
- r_ret=get_bone_name();
- return true;
- }
-
- return false;
-}
-
-bool InverseKinematics::_set(const StringName& p_name, const Variant& p_value)
-{
-
- if (String(p_name)=="ik_bone") {
-
- set_bone_name(p_value);
- changed = true;
- return true;
- }
-
- return false;
-}
-
-void InverseKinematics::_get_property_list( List<PropertyInfo>* p_list ) const
-{
-
- Skeleton *parent=NULL;
- if(get_parent())
- parent=get_parent()->cast_to<Skeleton>();
-
- if (parent) {
-
- String names;
- for(int i=0;i<parent->get_bone_count();i++) {
- if(i>0)
- names+=",";
- names+=parent->get_bone_name(i);
- }
-
- p_list->push_back(PropertyInfo(Variant::STRING,"ik_bone",PROPERTY_HINT_ENUM,names));
- } else {
-
- p_list->push_back(PropertyInfo(Variant::STRING,"ik_bone"));
-
- }
-
-}
-
-void InverseKinematics::_check_bind()
-{
-
- if (get_parent() && get_parent()->cast_to<Skeleton>()) {
- Skeleton *sk = get_parent()->cast_to<Skeleton>();
- int idx = sk->find_bone(ik_bone);
- if (idx!=-1) {
- ik_bone_no = idx;
- bound=true;
- }
- skel = sk;
- }
-}
-
-void InverseKinematics::_check_unbind()
-{
-
- if (bound) {
-
- if (get_parent() && get_parent()->cast_to<Skeleton>()) {
- Skeleton *sk = get_parent()->cast_to<Skeleton>();
- int idx = sk->find_bone(ik_bone);
- if (idx!=-1)
- ik_bone_no = idx;
- else
- ik_bone_no = 0;
- skel = sk;
-
- }
- bound=false;
- }
-}
-
-
-void InverseKinematics::set_bone_name(const String& p_name)
-{
-
- if (is_inside_tree())
- _check_unbind();
-
- ik_bone=p_name;
-
- if (is_inside_tree())
- _check_bind();
- changed = true;
-}
-
-String InverseKinematics::get_bone_name() const
-{
-
- return ik_bone;
-}
-
-void InverseKinematics::set_iterations(int itn)
-{
-
- if (is_inside_tree())
- _check_unbind();
-
- iterations=itn;
-
- if (is_inside_tree())
- _check_bind();
- changed = true;
-}
-
-int InverseKinematics::get_iterations() const
-{
-
- return iterations;
-}
-
-void InverseKinematics::set_chain_size(int cs)
-{
- if (is_inside_tree())
- _check_unbind();
-
- chain_size=cs;
- chain.clear();
- if (bound)
- update_parameters();
-
- if (is_inside_tree())
- _check_bind();
- changed = true;
-}
-
-int InverseKinematics::get_chain_size() const
-{
-
- return chain_size;
-}
-
-void InverseKinematics::set_precision(float p)
-{
-
- if (is_inside_tree())
- _check_unbind();
-
- precision=p;
-
- if (is_inside_tree())
- _check_bind();
- changed = true;
-}
-
-float InverseKinematics::get_precision() const
-{
-
- return precision;
-}
-
-void InverseKinematics::set_speed(float p)
-{
-
- if (is_inside_tree())
- _check_unbind();
-
- speed=p;
-
- if (is_inside_tree())
- _check_bind();
- changed = true;
-}
-
-float InverseKinematics::get_speed() const
-{
-
- return speed;
-}
-
-void InverseKinematics::update_parameters()
-{
- tail_bone = -1;
- for (int i = 0; i < skel->get_bone_count(); i++)
- if (skel->get_bone_parent(i) == ik_bone_no)
- tail_bone = i;
- int cur_bone = ik_bone_no;
- int its = chain_size;
- while (its > 0 && cur_bone >= 0) {
- chain.push_back(cur_bone);
- cur_bone = skel->get_bone_parent(cur_bone);
- its--;
- }
-}
-
-void InverseKinematics::_notification(int p_what)
-{
-
- switch(p_what) {
-
- case NOTIFICATION_ENTER_TREE: {
-
- _check_bind();
- if (bound) {
- update_parameters();
- changed = false;
- set_process(true);
- }
- } break;
- case NOTIFICATION_PROCESS: {
-
- Spatial *sksp = skel->cast_to<Spatial>();
- if (!bound)
- break;
- if (!sksp)
- break;
- if (changed) {
- update_parameters();
- changed = false;
- }
- Vector3 to = get_translation();
- for (int hump = 0; hump < iterations; hump++) {
- int depth = 0;
- float olderr = 1000.0;
- float psign = 1.0;
- bool reached = false;
-
- for (List<int>::Element *b = chain.front(); b; b = b->next()) {
- int cur_bone = b->get();
- Vector3 d = skel->get_bone_global_pose(tail_bone).origin;
- Vector3 rg = to;
- float err = d.distance_squared_to(rg);
- if (err < precision) {
- if (!reached && err < precision)
- reached = true;
- break;
- } else
- if (reached)
- reached = false;
- if (err > olderr)
- psign = -psign;
- Transform mod = skel->get_bone_global_pose(cur_bone);
- Quat q1 = Quat(mod.basis).normalized();
- Transform mod2 = mod.looking_at(to, Vector3(0.0, 1.0, 0.0));
- Quat q2 = Quat(mod2.basis).normalized();
- if (psign < 0.0)
- q2 = q2.inverse();
- Quat q = q1.slerp(q2, speed / (1.0 + 500.0 * depth)).normalized();
- Transform fin = Transform(q);
- fin.origin = mod.origin;
- skel->set_bone_global_pose(cur_bone, fin);
- depth++;
- }
- if (reached)
- break;
-
- }
-
- } break;
- case NOTIFICATION_EXIT_TREE: {
- set_process(false);
-
- _check_unbind();
- } break;
- }
-}
-void InverseKinematics::_bind_methods() {
- ObjectTypeDB::bind_method(_MD("set_bone_name","ik_bone"),&InverseKinematics::set_bone_name);
- ObjectTypeDB::bind_method(_MD("get_bone_name"),&InverseKinematics::get_bone_name);
- ObjectTypeDB::bind_method(_MD("set_iterations","iterations"),&InverseKinematics::set_iterations);
- ObjectTypeDB::bind_method(_MD("get_iterations"),&InverseKinematics::get_iterations);
- ObjectTypeDB::bind_method(_MD("set_chain_size","chain_size"),&InverseKinematics::set_chain_size);
- ObjectTypeDB::bind_method(_MD("get_chain_size"),&InverseKinematics::get_chain_size);
- ObjectTypeDB::bind_method(_MD("set_precision","precision"),&InverseKinematics::set_precision);
- ObjectTypeDB::bind_method(_MD("get_precision"),&InverseKinematics::get_precision);
- ObjectTypeDB::bind_method(_MD("set_speed","speed"),&InverseKinematics::set_speed);
- ObjectTypeDB::bind_method(_MD("get_speed"),&InverseKinematics::get_speed);
- ADD_PROPERTY(PropertyInfo(Variant::INT, "iterations"), _SCS("set_iterations"), _SCS("get_iterations"));
- ADD_PROPERTY(PropertyInfo(Variant::INT, "chain_size"), _SCS("set_chain_size"), _SCS("get_chain_size"));
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "precision"), _SCS("set_precision"), _SCS("get_precision"));
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "speed"), _SCS("set_speed"), _SCS("get_speed"));
-}
-
-InverseKinematics::InverseKinematics()
-{
- bound=false;
- chain_size = 2;
- iterations = 100;
- precision = 0.001;
- speed = 0.2;
-
-}
-
diff --git a/modules/ik/ik.h b/modules/ik/ik.h
deleted file mode 100644
index b57d69b026..0000000000
--- a/modules/ik/ik.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/*************************************************************************/
-/* ik.h */
-/* Copyright (c) 2016 Sergey Lapin <slapinid@gmail.com> */
-/*************************************************************************/
-/* This file is part of: */
-/* GODOT ENGINE */
-/* http://www.godotengine.org */
-/*************************************************************************/
-/* Copyright (c) 2007-2016 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 IK_H
-#define IK_H
-
-#include "scene/3d/skeleton.h"
-class InverseKinematics : public Spatial {
- OBJ_TYPE(InverseKinematics, Spatial);
- bool bound;
- String ik_bone;
- int ik_bone_no;
- int tail_bone;
- int chain_size;
- Skeleton *skel;
- List<int> chain;
- void _check_bind();
- void _check_unbind();
- int iterations;
- float precision;
- float speed;
- bool changed;
-
-protected:
- bool _set(const StringName& p_name, const Variant& p_value);
- bool _get(const StringName& p_name,Variant &r_ret) const;
- void _get_property_list( List<PropertyInfo> *p_list) const;
-
- void _notification(int p_what);
- static void _bind_methods();
- void update_parameters();
-public:
- Skeleton *get_skeleton();
- void set_bone_name(const String& p_name);
- String get_bone_name() const;
- void set_iterations(int itn);
- int get_iterations() const;
- void set_chain_size(int cs);
- int get_chain_size() const;
- void set_precision(float p);
- float get_precision() const;
- void set_speed(float p);
- float get_speed() const;
- InverseKinematics();
-};
-
-#endif
-
diff --git a/modules/ik/register_types.cpp b/modules/ik/register_types.cpp
deleted file mode 100644
index e7df7f55b2..0000000000
--- a/modules/ik/register_types.cpp
+++ /dev/null
@@ -1,47 +0,0 @@
-/*************************************************************************/
-/* register_types.cpp */
-/*************************************************************************/
-/* This file is part of: */
-/* GODOT ENGINE */
-/* http://www.godotengine.org */
-/*************************************************************************/
-/* Copyright (c) 2007-2016 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 "register_types.h"
-#ifndef _3D_DISABLED
-#include "object_type_db.h"
-#include "ik.h"
-#endif
-
-void register_ik_types() {
-
-#ifndef _3D_DISABLED
- ObjectTypeDB::register_type<InverseKinematics>();
-#endif
-}
-
-
-
-void unregister_ik_types() {
-
-
-}
diff --git a/modules/ik/register_types.h b/modules/ik/register_types.h
deleted file mode 100644
index 828917ade7..0000000000
--- a/modules/ik/register_types.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/*************************************************************************/
-/* register_types.h */
-/*************************************************************************/
-/* This file is part of: */
-/* GODOT ENGINE */
-/* http://www.godotengine.org */
-/*************************************************************************/
-/* Copyright (c) 2007-2016 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. */
-/*************************************************************************/
-void register_ik_types();
-void unregister_ik_types();
diff --git a/modules/jpg/SCsub b/modules/jpg/SCsub
index 28fb81895d..e72dc6a1ca 100644
--- a/modules/jpg/SCsub
+++ b/modules/jpg/SCsub
@@ -9,12 +9,12 @@ env_jpg = env_modules.Clone()
# Not unbundled for now as they are not commonly available as shared library
thirdparty_dir = "#thirdparty/jpeg-compressor/"
thirdparty_sources = [
- "jpgd.cpp",
+ "jpgd.cpp",
]
thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
env_jpg.add_source_files(env.modules_sources, thirdparty_sources)
-env_jpg.Append(CPPPATH = [thirdparty_dir])
+env_jpg.Append(CPPPATH=[thirdparty_dir])
# Godot's own source files
env_jpg.add_source_files(env.modules_sources, "*.cpp")
diff --git a/modules/jpg/config.py b/modules/jpg/config.py
index 368e97e152..fb920482f5 100644
--- a/modules/jpg/config.py
+++ b/modules/jpg/config.py
@@ -1,6 +1,7 @@
def can_build(platform):
- return True
+ return True
+
def configure(env):
- pass
+ pass
diff --git a/modules/jpg/image_loader_jpegd.cpp b/modules/jpg/image_loader_jpegd.cpp
index 03c3b19fc0..1152d42e1b 100644
--- a/modules/jpg/image_loader_jpegd.cpp
+++ b/modules/jpg/image_loader_jpegd.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* 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 */
@@ -56,11 +56,11 @@ Error jpeg_load_image_from_buffer(Image *p_image,const uint8_t* p_buffer, int p_
const int dst_bpl = image_width * comps;
- DVector<uint8_t> data;
+ PoolVector<uint8_t> data;
data.resize(dst_bpl * image_height);
- DVector<uint8_t>::Write dw = data.write();
+ PoolVector<uint8_t>::Write dw = data.write();
jpgd::uint8 *pImage_data = (jpgd::uint8*)dw.ptr();
@@ -84,11 +84,11 @@ Error jpeg_load_image_from_buffer(Image *p_image,const uint8_t* p_buffer, int p_
Image::Format fmt;
if (comps==1)
- fmt=Image::FORMAT_GRAYSCALE;
+ fmt=Image::FORMAT_L8;
else
- fmt=Image::FORMAT_RGBA;
+ fmt=Image::FORMAT_RGBA8;
- dw = DVector<uint8_t>::Write();
+ dw = PoolVector<uint8_t>::Write();
p_image->create(image_width,image_height,0,fmt,data);
return OK;
@@ -99,12 +99,12 @@ Error jpeg_load_image_from_buffer(Image *p_image,const uint8_t* p_buffer, int p_
Error ImageLoaderJPG::load_image(Image *p_image,FileAccess *f) {
- DVector<uint8_t> src_image;
+ PoolVector<uint8_t> src_image;
int src_image_len = f->get_len();
ERR_FAIL_COND_V(src_image_len == 0, ERR_FILE_CORRUPT);
src_image.resize(src_image_len);
- DVector<uint8_t>::Write w = src_image.write();
+ PoolVector<uint8_t>::Write w = src_image.write();
f->get_buffer(&w[0],src_image_len);
@@ -113,7 +113,7 @@ Error ImageLoaderJPG::load_image(Image *p_image,FileAccess *f) {
Error err = jpeg_load_image_from_buffer(p_image,w.ptr(),src_image_len);
- w = DVector<uint8_t>::Write();
+ w = PoolVector<uint8_t>::Write();
return err;
diff --git a/modules/jpg/image_loader_jpegd.h b/modules/jpg/image_loader_jpegd.h
index 2c52309ab1..aeb219aa5d 100644
--- a/modules/jpg/image_loader_jpegd.h
+++ b/modules/jpg/image_loader_jpegd.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* 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 */
diff --git a/modules/jpg/register_types.cpp b/modules/jpg/register_types.cpp
index a648423cdf..bcd467f5fc 100644
--- a/modules/jpg/register_types.cpp
+++ b/modules/jpg/register_types.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* 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 */
diff --git a/modules/jpg/register_types.h b/modules/jpg/register_types.h
index 0e06c4ff81..62132bf461 100644
--- a/modules/jpg/register_types.h
+++ b/modules/jpg/register_types.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* 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 */
diff --git a/modules/mpc/SCsub b/modules/mpc/SCsub
deleted file mode 100644
index 09f0c05daa..0000000000
--- a/modules/mpc/SCsub
+++ /dev/null
@@ -1,28 +0,0 @@
-#!/usr/bin/env python
-
-Import('env')
-Import('env_modules')
-
-env_mpc = env_modules.Clone()
-
-# Thirdparty source files
-if (env["libmpcdec"] != "system"): # builtin
- thirdparty_dir = "#thirdparty/libmpcdec/"
- thirdparty_sources = [
- "huffman.c",
- "mpc_bits_reader.c",
- "mpc_decoder.c",
- "mpc_demux.c",
- "mpc_reader.c",
- "requant.c",
- "streaminfo.c",
- "synth_filter.c",
- ]
-
- thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
-
- env_mpc.add_source_files(env.modules_sources, thirdparty_sources)
- env_mpc.Append(CPPPATH = [thirdparty_dir])
-
-# Godot source files
-env_mpc.add_source_files(env.modules_sources, "*.cpp")
diff --git a/modules/mpc/audio_stream_mpc.cpp b/modules/mpc/audio_stream_mpc.cpp
deleted file mode 100644
index 9713eb3c77..0000000000
--- a/modules/mpc/audio_stream_mpc.cpp
+++ /dev/null
@@ -1,414 +0,0 @@
-/*************************************************************************/
-/* audio_stream_mpc.cpp */
-/*************************************************************************/
-/* This file is part of: */
-/* GODOT ENGINE */
-/* http://www.godotengine.org */
-/*************************************************************************/
-/* Copyright (c) 2007-2016 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 "audio_stream_mpc.h"
-
-
-Error AudioStreamPlaybackMPC::_open_file() {
-
- if (f) {
- memdelete(f);
- f=NULL;
- }
- Error err;
- //printf("mpc open file %ls\n", file.c_str());
- f=FileAccess::open(file,FileAccess::READ,&err);
-
- if (err) {
- f=NULL;
- ERR_FAIL_V(err);
- return err;
- }
-
- //printf("file size is %i\n", f->get_len());
- //f->seek_end(0);
- streamlen=f->get_len();
- //f->seek(0);
- if (streamlen<=0) {
- memdelete(f);
- f=NULL;
- ERR_FAIL_V(ERR_INVALID_DATA);
- }
-
- data_ofs=0;
- if (preload) {
-
- data.resize(streamlen);
- DVector<uint8_t>::Write w = data.write();
- f->get_buffer(&w[0],streamlen);
- memdelete(f);
- f=NULL;
-
- }
-
- return OK;
-}
-
-void AudioStreamPlaybackMPC::_close_file() {
-
- if (f) {
- memdelete(f);
- f=NULL;
- }
- data.resize(0);
- streamlen=0;
- data_ofs=0;
-}
-
-int AudioStreamPlaybackMPC::_read_file(void *p_dst,int p_bytes) {
-
- if (f)
- return f->get_buffer((uint8_t*)p_dst,p_bytes);
-
- DVector<uint8_t>::Read r = data.read();
- if (p_bytes+data_ofs > streamlen) {
- p_bytes=streamlen-data_ofs;
- }
-
- copymem(p_dst,&r[data_ofs],p_bytes);
- //print_line("read file: "+itos(p_bytes));
- data_ofs+=p_bytes;
- return p_bytes;
-}
-
-bool AudioStreamPlaybackMPC::_seek_file(int p_pos){
-
- if (p_pos<0 || p_pos>streamlen)
- return false;
-
- if (f) {
- f->seek(p_pos);
- return true;
- }
-
- //print_line("read file to: "+itos(p_pos));
- data_ofs=p_pos;
- return true;
-
-}
-int AudioStreamPlaybackMPC::_tell_file() const{
-
- if (f)
- return f->get_pos();
-
- //print_line("tell file, get: "+itos(data_ofs));
- return data_ofs;
-
-}
-
-int AudioStreamPlaybackMPC::_sizeof_file() const{
-
- //print_line("sizeof file, get: "+itos(streamlen));
- return streamlen;
-}
-
-bool AudioStreamPlaybackMPC::_canseek_file() const{
-
- //print_line("canseek file, get true");
- return true;
-}
-
-/////////////////////
-
-mpc_int32_t AudioStreamPlaybackMPC::_mpc_read(mpc_reader *p_reader,void *p_dst, mpc_int32_t p_bytes) {
-
- AudioStreamPlaybackMPC *smpc=(AudioStreamPlaybackMPC *)p_reader->data;
- return smpc->_read_file(p_dst,p_bytes);
-}
-
-mpc_bool_t AudioStreamPlaybackMPC::_mpc_seek(mpc_reader *p_reader,mpc_int32_t p_offset) {
-
- AudioStreamPlaybackMPC *smpc=(AudioStreamPlaybackMPC *)p_reader->data;
- return smpc->_seek_file(p_offset);
-
-}
-mpc_int32_t AudioStreamPlaybackMPC::_mpc_tell(mpc_reader *p_reader) {
-
- AudioStreamPlaybackMPC *smpc=(AudioStreamPlaybackMPC *)p_reader->data;
- return smpc->_tell_file();
-
-}
-mpc_int32_t AudioStreamPlaybackMPC::_mpc_get_size(mpc_reader *p_reader) {
-
- AudioStreamPlaybackMPC *smpc=(AudioStreamPlaybackMPC *)p_reader->data;
- return smpc->_sizeof_file();
-
-
-}
-mpc_bool_t AudioStreamPlaybackMPC::_mpc_canseek(mpc_reader *p_reader) {
-
- AudioStreamPlaybackMPC *smpc=(AudioStreamPlaybackMPC *)p_reader->data;
- return smpc->_canseek_file();
-}
-
-
-
-
-int AudioStreamPlaybackMPC::mix(int16_t* p_bufer,int p_frames) {
-
- if (!active || paused)
- return 0;
-
- int todo=p_frames;
-
- while(todo>MPC_DECODER_BUFFER_LENGTH/si.channels) {
-
- mpc_frame_info frame;
-
- frame.buffer=sample_buffer;
-
- mpc_status err = mpc_demux_decode(demux, &frame);
- if (frame.bits!=-1) {
-
- int16_t *dst_buff = p_bufer;
-
-#ifdef MPC_FIXED_POINT
-
- for( int i = 0; i < frame.samples * si.channels; i++) {
- int tmp = sample_buffer[i] >> MPC_FIXED_POINT_FRACTPART;
- if (tmp > ((1 << 15) - 1)) tmp = ((1 << 15) - 1);
- if (tmp < -(1 << 15)) tmp = -(1 << 15);
- dst_buff[i] = tmp;
- }
-#else
- for( int i = 0; i < frame.samples * si.channels; i++) {
-
- int tmp = Math::fast_ftoi(sample_buffer[i]*32767.0);
- if (tmp > ((1 << 15) - 1)) tmp = ((1 << 15) - 1);
- if (tmp < -(1 << 15)) tmp = -(1 << 15);
- dst_buff[i] = tmp;
-
- }
-
-#endif
-
- int frames = frame.samples;
- p_bufer+=si.channels*frames;
- todo-=frames;
- } else {
-
- if (err != MPC_STATUS_OK) {
-
- stop();
- ERR_PRINT("Error decoding MPC");
- break;
- } else {
-
- //finished
- if (!loop) {
- stop();
- break;
- } else {
-
-
- loops++;
- mpc_demux_exit(demux);
- _seek_file(0);
- demux = mpc_demux_init(&reader);
- //do loop somehow
-
- }
- }
- }
- }
-
- return p_frames-todo;
-}
-
-Error AudioStreamPlaybackMPC::_reload() {
-
- ERR_FAIL_COND_V(demux!=NULL, ERR_FILE_ALREADY_IN_USE);
-
- Error err = _open_file();
- ERR_FAIL_COND_V(err!=OK,ERR_CANT_OPEN);
-
- demux = mpc_demux_init(&reader);
- ERR_FAIL_COND_V(!demux,ERR_CANT_CREATE);
- mpc_demux_get_info(demux, &si);
-
- return OK;
-}
-
-void AudioStreamPlaybackMPC::set_file(const String& p_file) {
-
- file=p_file;
-
- Error err = _open_file();
- ERR_FAIL_COND(err!=OK);
- demux = mpc_demux_init(&reader);
- ERR_FAIL_COND(!demux);
- mpc_demux_get_info(demux, &si);
- stream_min_size=MPC_DECODER_BUFFER_LENGTH*2/si.channels;
- stream_rate=si.sample_freq;
- stream_channels=si.channels;
-
- mpc_demux_exit(demux);
- demux=NULL;
- _close_file();
-
-}
-
-
-String AudioStreamPlaybackMPC::get_file() const {
-
- return file;
-}
-
-
-void AudioStreamPlaybackMPC::play(float p_offset) {
-
-
- if (active)
- stop();
- active=false;
-
- Error err = _open_file();
- ERR_FAIL_COND(err!=OK);
- if (_reload()!=OK)
- return;
- active=true;
- loops=0;
-
-}
-
-void AudioStreamPlaybackMPC::stop() {
-
-
- if (!active)
- return;
- if (demux) {
- mpc_demux_exit(demux);
- demux=NULL;
- }
- _close_file();
- active=false;
-
-}
-bool AudioStreamPlaybackMPC::is_playing() const {
-
- return active;
-}
-
-
-void AudioStreamPlaybackMPC::set_loop(bool p_enable) {
-
- loop=p_enable;
-}
-bool AudioStreamPlaybackMPC::has_loop() const {
-
- return loop;
-}
-
-float AudioStreamPlaybackMPC::get_length() const {
-
- return 0;
-}
-
-String AudioStreamPlaybackMPC::get_stream_name() const {
-
- return "";
-}
-
-int AudioStreamPlaybackMPC::get_loop_count() const {
-
- return 0;
-}
-
-float AudioStreamPlaybackMPC::get_pos() const {
-
- return 0;
-}
-void AudioStreamPlaybackMPC::seek_pos(float p_time) {
-
-
-}
-
-
-void AudioStreamPlaybackMPC::_bind_methods() {
-
- ObjectTypeDB::bind_method(_MD("set_file","name"),&AudioStreamPlaybackMPC::set_file);
- ObjectTypeDB::bind_method(_MD("get_file"),&AudioStreamPlaybackMPC::get_file);
-
- ADD_PROPERTYNZ( PropertyInfo(Variant::STRING,"file",PROPERTY_HINT_FILE,"mpc"), _SCS("set_file"), _SCS("get_file"));
-
-}
-
-AudioStreamPlaybackMPC::AudioStreamPlaybackMPC() {
-
- preload=false;
- f=NULL;
- streamlen=0;
- data_ofs=0;
- active=false;
- paused=false;
- loop=false;
- demux=NULL;
- reader.data=this;
- reader.read=_mpc_read;
- reader.seek=_mpc_seek;
- reader.tell=_mpc_tell;
- reader.get_size=_mpc_get_size;
- reader.canseek=_mpc_canseek;
- loops=0;
-
-}
-
-AudioStreamPlaybackMPC::~AudioStreamPlaybackMPC() {
-
- stop();
-
- if (f)
- memdelete(f);
-}
-
-
-
-RES ResourceFormatLoaderAudioStreamMPC::load(const String &p_path, const String& p_original_path, Error *r_error) {
- if (r_error)
- *r_error=OK; //streamed so it will always work..
- AudioStreamMPC *mpc_stream = memnew(AudioStreamMPC);
- mpc_stream->set_file(p_path);
- return Ref<AudioStreamMPC>(mpc_stream);
-}
-
-void ResourceFormatLoaderAudioStreamMPC::get_recognized_extensions(List<String> *p_extensions) const {
-
- p_extensions->push_back("mpc");
-}
-bool ResourceFormatLoaderAudioStreamMPC::handles_type(const String& p_type) const {
-
- return (p_type=="AudioStream") || (p_type=="AudioStreamMPC");
-}
-
-String ResourceFormatLoaderAudioStreamMPC::get_resource_type(const String &p_path) const {
-
- if (p_path.extension().to_lower()=="mpc")
- return "AudioStreamMPC";
- return "";
-}
-
diff --git a/modules/mpc/audio_stream_mpc.h b/modules/mpc/audio_stream_mpc.h
deleted file mode 100644
index c982bdc358..0000000000
--- a/modules/mpc/audio_stream_mpc.h
+++ /dev/null
@@ -1,146 +0,0 @@
-/*************************************************************************/
-/* audio_stream_mpc.h */
-/*************************************************************************/
-/* This file is part of: */
-/* GODOT ENGINE */
-/* http://www.godotengine.org */
-/*************************************************************************/
-/* Copyright (c) 2007-2016 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 AUDIO_STREAM_MPC_H
-#define AUDIO_STREAM_MPC_H
-
-#include "io/resource_loader.h"
-#include "os/file_access.h"
-#include "os/thread_safe.h"
-#include "scene/resources/audio_stream.h"
-
-#include <mpc/mpcdec.h>
-
-class AudioStreamPlaybackMPC : public AudioStreamPlayback {
-
- OBJ_TYPE( AudioStreamPlaybackMPC, AudioStreamPlayback );
-
- bool preload;
- FileAccess *f;
- String file;
- DVector<uint8_t> data;
- int data_ofs;
- int streamlen;
-
-
- bool active;
- bool paused;
- bool loop;
- int loops;
-
- // mpc
- mpc_reader reader;
- mpc_demux* demux;
- mpc_streaminfo si;
- MPC_SAMPLE_FORMAT sample_buffer[MPC_DECODER_BUFFER_LENGTH];
-
- static mpc_int32_t _mpc_read(mpc_reader *p_reader,void *p_dst, mpc_int32_t p_bytes);
- static mpc_bool_t _mpc_seek(mpc_reader *p_reader,mpc_int32_t p_offset);
- static mpc_int32_t _mpc_tell(mpc_reader *p_reader);
- static mpc_int32_t _mpc_get_size(mpc_reader *p_reader);
- static mpc_bool_t _mpc_canseek(mpc_reader *p_reader);
-
- int stream_min_size;
- int stream_rate;
- int stream_channels;
-
-protected:
- Error _open_file();
- void _close_file();
- int _read_file(void *p_dst,int p_bytes);
- bool _seek_file(int p_pos);
- int _tell_file() const;
- int _sizeof_file() const;
- bool _canseek_file() const;
-
-
- Error _reload();
- static void _bind_methods();
-
-public:
-
- void set_file(const String& p_file);
- String get_file() const;
-
- virtual void play(float p_offset=0);
- virtual void stop();
- virtual bool is_playing() const;
-
-
- virtual void set_loop(bool p_enable);
- virtual bool has_loop() const;
-
- virtual float get_length() const;
-
- virtual String get_stream_name() const;
-
- virtual int get_loop_count() const;
-
- virtual float get_pos() const;
- virtual void seek_pos(float p_time);
-
- virtual int get_channels() const { return stream_channels; }
- virtual int get_mix_rate() const { return stream_rate; }
-
- virtual int get_minimum_buffer_size() const { return stream_min_size; }
- virtual int mix(int16_t* p_bufer,int p_frames);
-
- virtual void set_loop_restart_time(float p_time) { }
-
- AudioStreamPlaybackMPC();
- ~AudioStreamPlaybackMPC();
-};
-
-class AudioStreamMPC : public AudioStream {
-
- OBJ_TYPE( AudioStreamMPC, AudioStream );
-
- String file;
-public:
-
- Ref<AudioStreamPlayback> instance_playback() {
- Ref<AudioStreamPlaybackMPC> pb = memnew( AudioStreamPlaybackMPC );
- pb->set_file(file);
- return pb;
- }
-
- void set_file(const String& p_file) { file=p_file; }
-
-
-};
-
-class ResourceFormatLoaderAudioStreamMPC : public ResourceFormatLoader {
-public:
- virtual RES load(const String &p_path,const String& p_original_path="",Error *r_error=NULL);
- virtual void get_recognized_extensions(List<String> *p_extensions) const;
- virtual bool handles_type(const String& p_type) const;
- virtual String get_resource_type(const String &p_path) const;
-
-};
-
-#endif // AUDIO_STREAM_MPC_H
diff --git a/modules/mpc/config.py b/modules/mpc/config.py
deleted file mode 100644
index 368e97e152..0000000000
--- a/modules/mpc/config.py
+++ /dev/null
@@ -1,6 +0,0 @@
-
-def can_build(platform):
- return True
-
-def configure(env):
- pass
diff --git a/modules/ogg/SCsub b/modules/ogg/SCsub
index 2e1fe2e0c0..5eabaf6f2b 100644
--- a/modules/ogg/SCsub
+++ b/modules/ogg/SCsub
@@ -6,16 +6,16 @@ Import('env_modules')
env_ogg = env_modules.Clone()
# Thirdparty source files
-if (env["libogg"] != "system"): # builtin
- thirdparty_dir = "#thirdparty/libogg/"
- thirdparty_sources = [
- "bitwise.c",
- "framing.c",
- ]
- thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
+if (env['builtin_libogg'] != 'no'):
+ thirdparty_dir = "#thirdparty/libogg/"
+ thirdparty_sources = [
+ "bitwise.c",
+ "framing.c",
+ ]
+ thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
- env_ogg.add_source_files(env.modules_sources, thirdparty_sources)
- env_ogg.Append(CPPPATH = [thirdparty_dir])
+ env_ogg.add_source_files(env.modules_sources, thirdparty_sources)
+ env_ogg.Append(CPPPATH=[thirdparty_dir])
# Godot source files
env_ogg.add_source_files(env.modules_sources, "*.cpp")
diff --git a/modules/ogg/config.py b/modules/ogg/config.py
index 368e97e152..ef5daca05c 100644
--- a/modules/ogg/config.py
+++ b/modules/ogg/config.py
@@ -1,6 +1,8 @@
def can_build(platform):
- return True
+# return True
+ return False
+
def configure(env):
- pass
+ pass
diff --git a/modules/ogg/register_types.cpp b/modules/ogg/register_types.cpp
index 823ca510ca..ed796ec092 100644
--- a/modules/ogg/register_types.cpp
+++ b/modules/ogg/register_types.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* 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 */
diff --git a/modules/ogg/register_types.h b/modules/ogg/register_types.h
index b5268a1df4..cc67b4d2f0 100644
--- a/modules/ogg/register_types.h
+++ b/modules/ogg/register_types.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* 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 */
diff --git a/modules/openssl/SCsub b/modules/openssl/SCsub
index 2327cf483c..0e811ce8c9 100644
--- a/modules/openssl/SCsub
+++ b/modules/openssl/SCsub
@@ -6,682 +6,682 @@ Import('env_modules')
env_openssl = env_modules.Clone()
# Thirdparty source files
-if (env["openssl"] != "system"): # builtin
- thirdparty_dir = "#thirdparty/openssl/"
+if (env['builtin_openssl'] != 'no'):
+ thirdparty_dir = "#thirdparty/openssl/"
- thirdparty_sources = [
- "ssl/t1_lib.c",
- "ssl/t1_ext.c",
- "ssl/s3_srvr.c",
- "ssl/t1_enc.c",
- "ssl/t1_meth.c",
- "ssl/s23_clnt.c",
- "ssl/ssl_asn1.c",
- "ssl/tls_srp.c",
- "ssl/kssl.c",
- "ssl/d1_both.c",
- "ssl/t1_clnt.c",
- "ssl/bio_ssl.c",
- "ssl/d1_srtp.c",
- "ssl/t1_reneg.c",
- "ssl/ssl_cert.c",
- "ssl/s3_lib.c",
- "ssl/d1_srvr.c",
- "ssl/s23_meth.c",
- "ssl/ssl_stat.c",
- "ssl/ssl_err.c",
- "ssl/ssl_algs.c",
- "ssl/s3_cbc.c",
- "ssl/d1_clnt.c",
- "ssl/s3_pkt.c",
- "ssl/d1_meth.c",
- "ssl/s3_both.c",
- "ssl/s2_enc.c",
- "ssl/s3_meth.c",
- "ssl/s3_enc.c",
- "ssl/s23_pkt.c",
- "ssl/s2_pkt.c",
- "ssl/d1_pkt.c",
- "ssl/ssl_rsa.c",
- "ssl/s23_srvr.c",
- "ssl/s2_meth.c",
- "ssl/s3_clnt.c",
- "ssl/s23_lib.c",
- "ssl/t1_srvr.c",
- "ssl/ssl_lib.c",
- "ssl/ssl_txt.c",
- "ssl/s2_srvr.c",
- "ssl/ssl_sess.c",
- "ssl/s2_clnt.c",
- "ssl/d1_lib.c",
- "ssl/s2_lib.c",
- "ssl/ssl_err2.c",
- "ssl/ssl_ciph.c",
- "crypto/dsa/dsa_lib.c",
- "crypto/dsa/dsa_pmeth.c",
- "crypto/dsa/dsa_ossl.c",
- "crypto/dsa/dsa_gen.c",
- "crypto/dsa/dsa_asn1.c",
- "crypto/dsa/dsa_prn.c",
- "crypto/dsa/dsa_sign.c",
- "crypto/dsa/dsa_key.c",
- "crypto/dsa/dsa_vrf.c",
- "crypto/dsa/dsa_err.c",
- "crypto/dsa/dsa_ameth.c",
- "crypto/dsa/dsa_depr.c",
- "crypto/x509/x509_lu.c",
- "crypto/x509/x509cset.c",
- "crypto/x509/x509_set.c",
- "crypto/x509/x509_d2.c",
- "crypto/x509/x509_txt.c",
- "crypto/x509/x509rset.c",
- "crypto/x509/by_dir.c",
- "crypto/x509/x509_vpm.c",
- "crypto/x509/x509_vfy.c",
- "crypto/x509/x509_trs.c",
- "crypto/x509/by_file.c",
- "crypto/x509/x509_obj.c",
- "crypto/x509/x509spki.c",
- "crypto/x509/x509_v3.c",
- "crypto/x509/x509_req.c",
- "crypto/x509/x509_att.c",
- "crypto/x509/x_all.c",
- "crypto/x509/x509_ext.c",
- "crypto/x509/x509type.c",
- "crypto/x509/x509_def.c",
- "crypto/x509/x509_err.c",
- "crypto/x509/x509name.c",
- "crypto/x509/x509_r2x.c",
- "crypto/x509/x509_cmp.c",
- "crypto/asn1/x_pkey.c",
- "crypto/asn1/a_gentm.c",
- "crypto/asn1/x_sig.c",
- "crypto/asn1/t_req.c",
- "crypto/asn1/t_pkey.c",
- "crypto/asn1/p8_pkey.c",
- "crypto/asn1/a_i2d_fp.c",
- "crypto/asn1/x_val.c",
- "crypto/asn1/f_string.c",
- "crypto/asn1/p5_pbe.c",
- "crypto/asn1/bio_ndef.c",
- "crypto/asn1/a_bool.c",
- "crypto/asn1/asn1_gen.c",
- "crypto/asn1/x_algor.c",
- "crypto/asn1/bio_asn1.c",
- "crypto/asn1/asn_mime.c",
- "crypto/asn1/t_x509.c",
- "crypto/asn1/a_strex.c",
- "crypto/asn1/x_nx509.c",
- "crypto/asn1/asn1_err.c",
- "crypto/asn1/x_crl.c",
- "crypto/asn1/a_print.c",
- "crypto/asn1/a_type.c",
- "crypto/asn1/tasn_new.c",
- "crypto/asn1/n_pkey.c",
- "crypto/asn1/x_bignum.c",
- "crypto/asn1/asn_pack.c",
- "crypto/asn1/evp_asn1.c",
- "crypto/asn1/t_bitst.c",
- "crypto/asn1/x_req.c",
- "crypto/asn1/a_time.c",
- "crypto/asn1/x_name.c",
- "crypto/asn1/x_pubkey.c",
- "crypto/asn1/tasn_typ.c",
- "crypto/asn1/asn_moid.c",
- "crypto/asn1/a_utctm.c",
- "crypto/asn1/asn1_lib.c",
- "crypto/asn1/x_x509a.c",
- "crypto/asn1/a_set.c",
- "crypto/asn1/t_crl.c",
- "crypto/asn1/p5_pbev2.c",
- "crypto/asn1/tasn_enc.c",
- "crypto/asn1/a_mbstr.c",
- "crypto/asn1/tasn_dec.c",
- "crypto/asn1/x_x509.c",
- "crypto/asn1/a_octet.c",
- "crypto/asn1/x_long.c",
- "crypto/asn1/a_bytes.c",
- "crypto/asn1/t_x509a.c",
- "crypto/asn1/a_enum.c",
- "crypto/asn1/a_int.c",
- "crypto/asn1/tasn_prn.c",
- "crypto/asn1/i2d_pr.c",
- "crypto/asn1/a_utf8.c",
- "crypto/asn1/t_spki.c",
- "crypto/asn1/a_digest.c",
- "crypto/asn1/a_dup.c",
- "crypto/asn1/i2d_pu.c",
- "crypto/asn1/a_verify.c",
- "crypto/asn1/f_enum.c",
- "crypto/asn1/a_sign.c",
- "crypto/asn1/d2i_pr.c",
- "crypto/asn1/asn1_par.c",
- "crypto/asn1/x_spki.c",
- "crypto/asn1/a_d2i_fp.c",
- "crypto/asn1/f_int.c",
- "crypto/asn1/x_exten.c",
- "crypto/asn1/tasn_utl.c",
- "crypto/asn1/nsseq.c",
- "crypto/asn1/a_bitstr.c",
- "crypto/asn1/x_info.c",
- "crypto/asn1/a_strnid.c",
- "crypto/asn1/a_object.c",
- "crypto/asn1/tasn_fre.c",
- "crypto/asn1/d2i_pu.c",
- "crypto/asn1/ameth_lib.c",
- "crypto/asn1/x_attrib.c",
- "crypto/evp/m_sha.c",
- "crypto/evp/e_camellia.c",
- "crypto/evp/e_aes.c",
- "crypto/evp/bio_b64.c",
- "crypto/evp/m_sigver.c",
- "crypto/evp/m_wp.c",
- "crypto/evp/m_sha1.c",
- "crypto/evp/p_seal.c",
- "crypto/evp/c_alld.c",
- "crypto/evp/p5_crpt.c",
- "crypto/evp/e_rc4.c",
- "crypto/evp/m_ecdsa.c",
- "crypto/evp/bio_enc.c",
- "crypto/evp/e_des3.c",
- "crypto/evp/m_null.c",
- "crypto/evp/bio_ok.c",
- "crypto/evp/pmeth_gn.c",
- "crypto/evp/e_rc5.c",
- "crypto/evp/e_rc2.c",
- "crypto/evp/p_dec.c",
- "crypto/evp/p_verify.c",
- "crypto/evp/e_rc4_hmac_md5.c",
- "crypto/evp/pmeth_lib.c",
- "crypto/evp/m_ripemd.c",
- "crypto/evp/m_md5.c",
- "crypto/evp/e_bf.c",
- "crypto/evp/p_enc.c",
- "crypto/evp/m_dss.c",
- "crypto/evp/bio_md.c",
- "crypto/evp/evp_pbe.c",
- "crypto/evp/e_seed.c",
- "crypto/evp/e_cast.c",
- "crypto/evp/p_open.c",
- "crypto/evp/p5_crpt2.c",
- "crypto/evp/m_dss1.c",
- "crypto/evp/names.c",
- "crypto/evp/evp_acnf.c",
- "crypto/evp/e_des.c",
- "crypto/evp/evp_cnf.c",
- "crypto/evp/evp_lib.c",
- "crypto/evp/digest.c",
- "crypto/evp/evp_err.c",
- "crypto/evp/evp_enc.c",
- "crypto/evp/e_old.c",
- "crypto/evp/c_all.c",
- "crypto/evp/m_md2.c",
- "crypto/evp/e_xcbc_d.c",
- "crypto/evp/pmeth_fn.c",
- "crypto/evp/p_lib.c",
- "crypto/evp/evp_key.c",
- "crypto/evp/encode.c",
- "crypto/evp/e_aes_cbc_hmac_sha1.c",
- "crypto/evp/e_aes_cbc_hmac_sha256.c",
- "crypto/evp/m_mdc2.c",
- "crypto/evp/e_null.c",
- "crypto/evp/p_sign.c",
- "crypto/evp/e_idea.c",
- "crypto/evp/c_allc.c",
- "crypto/evp/evp_pkey.c",
- "crypto/evp/m_md4.c",
- "crypto/ex_data.c",
- "crypto/pkcs12/p12_p8e.c",
- "crypto/pkcs12/p12_crt.c",
- "crypto/pkcs12/p12_utl.c",
- "crypto/pkcs12/p12_attr.c",
- "crypto/pkcs12/p12_npas.c",
- "crypto/pkcs12/p12_decr.c",
- "crypto/pkcs12/p12_init.c",
- "crypto/pkcs12/p12_kiss.c",
- "crypto/pkcs12/p12_add.c",
- "crypto/pkcs12/p12_p8d.c",
- "crypto/pkcs12/p12_mutl.c",
- "crypto/pkcs12/p12_crpt.c",
- "crypto/pkcs12/pk12err.c",
- "crypto/pkcs12/p12_asn.c",
- "crypto/pkcs12/p12_key.c",
- "crypto/ecdh/ech_key.c",
- "crypto/ecdh/ech_ossl.c",
- "crypto/ecdh/ech_lib.c",
- "crypto/ecdh/ech_err.c",
- "crypto/ecdh/ech_kdf.c",
- "crypto/o_str.c",
- "crypto/conf/conf_api.c",
- "crypto/conf/conf_err.c",
- "crypto/conf/conf_def.c",
- "crypto/conf/conf_lib.c",
- "crypto/conf/conf_mall.c",
- "crypto/conf/conf_sap.c",
- "crypto/conf/conf_mod.c",
- "crypto/ebcdic.c",
- "crypto/ecdsa/ecs_lib.c",
- "crypto/ecdsa/ecs_asn1.c",
- "crypto/ecdsa/ecs_ossl.c",
- "crypto/ecdsa/ecs_vrf.c",
- "crypto/ecdsa/ecs_sign.c",
- "crypto/ecdsa/ecs_err.c",
- "crypto/dso/dso_win32.c",
- "crypto/dso/dso_lib.c",
- "crypto/dso/dso_dlfcn.c",
- "crypto/dso/dso_dl.c",
- "crypto/dso/dso_beos.c",
- "crypto/dso/dso_null.c",
- "crypto/dso/dso_vms.c",
- "crypto/dso/dso_err.c",
- "crypto/dso/dso_openssl.c",
- "crypto/cryptlib.c",
- "crypto/md5/md5_one.c",
- "crypto/md5/md5_dgst.c",
- "crypto/pkcs7/pkcs7err.c",
- "crypto/pkcs7/pk7_smime.c",
- "crypto/pkcs7/bio_pk7.c",
- "crypto/pkcs7/pk7_mime.c",
- "crypto/pkcs7/pk7_lib.c",
- "crypto/pkcs7/pk7_asn1.c",
- "crypto/pkcs7/pk7_doit.c",
- "crypto/pkcs7/pk7_attr.c",
- "crypto/md4/md4_one.c",
- "crypto/md4/md4_dgst.c",
- "crypto/o_dir.c",
- "crypto/buffer/buf_err.c",
- "crypto/buffer/buf_str.c",
- "crypto/buffer/buffer.c",
- "crypto/cms/cms_lib.c",
- "crypto/cms/cms_io.c",
- "crypto/cms/cms_err.c",
- "crypto/cms/cms_dd.c",
- "crypto/cms/cms_smime.c",
- "crypto/cms/cms_att.c",
- "crypto/cms/cms_pwri.c",
- "crypto/cms/cms_cd.c",
- "crypto/cms/cms_sd.c",
- "crypto/cms/cms_asn1.c",
- "crypto/cms/cms_env.c",
- "crypto/cms/cms_enc.c",
- "crypto/cms/cms_ess.c",
- "crypto/cms/cms_kari.c",
- "crypto/mem_dbg.c",
- "crypto/uid.c",
- "crypto/stack/stack.c",
- "crypto/ec/ec_ameth.c",
- "crypto/ec/ec_err.c",
- "crypto/ec/ec_lib.c",
- "crypto/ec/ec_curve.c",
- "crypto/ec/ec_oct.c",
- "crypto/ec/ec_asn1.c",
- "crypto/ec/ecp_oct.c",
- "crypto/ec/ec_print.c",
- "crypto/ec/ec2_smpl.c",
- "crypto/ec/ecp_nistp224.c",
- "crypto/ec/ec2_oct.c",
- "crypto/ec/eck_prn.c",
- "crypto/ec/ec_key.c",
- "crypto/ec/ecp_nist.c",
- "crypto/ec/ec_check.c",
- "crypto/ec/ecp_smpl.c",
- "crypto/ec/ec2_mult.c",
- "crypto/ec/ecp_mont.c",
- "crypto/ec/ecp_nistp521.c",
- "crypto/ec/ec_mult.c",
- "crypto/ec/ecp_nistputil.c",
- "crypto/ec/ec_pmeth.c",
- "crypto/ec/ec_cvt.c",
- "crypto/ec/ecp_nistp256.c",
- "crypto/krb5/krb5_asn.c",
- "crypto/hmac/hmac.c",
- "crypto/hmac/hm_ameth.c",
- "crypto/hmac/hm_pmeth.c",
- "crypto/comp/c_rle.c",
- "crypto/comp/c_zlib.c",
- "crypto/comp/comp_lib.c",
- "crypto/comp/comp_err.c",
- "crypto/des/fcrypt.c",
- "crypto/des/str2key.c",
- "crypto/des/cbc_cksm.c",
- "crypto/des/des_enc.c",
- "crypto/des/ofb_enc.c",
- "crypto/des/read2pwd.c",
- "crypto/des/ecb3_enc.c",
- "crypto/des/rand_key.c",
- "crypto/des/cfb64ede.c",
- "crypto/des/rpc_enc.c",
- "crypto/des/ofb64ede.c",
- "crypto/des/qud_cksm.c",
- "crypto/des/enc_writ.c",
- "crypto/des/set_key.c",
- "crypto/des/xcbc_enc.c",
- "crypto/des/fcrypt_b.c",
- "crypto/des/ede_cbcm_enc.c",
- "crypto/des/des_old2.c",
- "crypto/des/cfb_enc.c",
- "crypto/des/ecb_enc.c",
- "crypto/des/enc_read.c",
- "crypto/des/des_old.c",
- "crypto/des/ofb64enc.c",
- "crypto/des/pcbc_enc.c",
- "crypto/des/cbc_enc.c",
- "crypto/des/cfb64enc.c",
- "crypto/lhash/lh_stats.c",
- "crypto/lhash/lhash.c",
- "crypto/x509v3/v3_genn.c",
- "crypto/x509v3/pcy_cache.c",
- "crypto/x509v3/v3_sxnet.c",
- "crypto/x509v3/v3_scts.c",
- "crypto/x509v3/v3err.c",
- "crypto/x509v3/v3_conf.c",
- "crypto/x509v3/v3_utl.c",
- "crypto/x509v3/v3_akeya.c",
- "crypto/x509v3/v3_lib.c",
- "crypto/x509v3/pcy_lib.c",
- "crypto/x509v3/v3_cpols.c",
- "crypto/x509v3/v3_ia5.c",
- "crypto/x509v3/v3_bitst.c",
- "crypto/x509v3/v3_skey.c",
- "crypto/x509v3/v3_info.c",
- "crypto/x509v3/v3_asid.c",
- "crypto/x509v3/pcy_tree.c",
- "crypto/x509v3/v3_pcons.c",
- "crypto/x509v3/v3_bcons.c",
- "crypto/x509v3/v3_pku.c",
- "crypto/x509v3/v3_ocsp.c",
- "crypto/x509v3/pcy_map.c",
- "crypto/x509v3/v3_ncons.c",
- "crypto/x509v3/v3_purp.c",
- "crypto/x509v3/v3_enum.c",
- "crypto/x509v3/v3_pmaps.c",
- "crypto/x509v3/pcy_node.c",
- "crypto/x509v3/v3_pcia.c",
- "crypto/x509v3/v3_crld.c",
- "crypto/x509v3/v3_pci.c",
- "crypto/x509v3/v3_akey.c",
- "crypto/x509v3/v3_addr.c",
- "crypto/x509v3/v3_int.c",
- "crypto/x509v3/v3_alt.c",
- "crypto/x509v3/v3_extku.c",
- "crypto/x509v3/v3_prn.c",
- "crypto/x509v3/pcy_data.c",
- "crypto/aes/aes_ofb.c",
- "crypto/aes/aes_ctr.c",
- "crypto/aes/aes_ecb.c",
- "crypto/aes/aes_cfb.c",
- "crypto/aes/aes_wrap.c",
- "crypto/aes/aes_ige.c",
- "crypto/aes/aes_misc.c",
- "crypto/pqueue/pqueue.c",
- "crypto/sha/sha_one.c",
- "crypto/sha/sha_dgst.c",
- "crypto/sha/sha512.c",
- "crypto/sha/sha1_one.c",
- "crypto/sha/sha1dgst.c",
- "crypto/sha/sha256.c",
- "crypto/whrlpool/wp_dgst.c",
- "crypto/objects/obj_xref.c",
- "crypto/objects/o_names.c",
- "crypto/objects/obj_err.c",
- "crypto/objects/obj_dat.c",
- "crypto/objects/obj_lib.c",
- "crypto/mem.c",
- "crypto/fips_ers.c",
- "crypto/o_fips.c",
- "crypto/engine/eng_rdrand.c",
- "crypto/engine/eng_err.c",
- "crypto/engine/tb_ecdsa.c",
- "crypto/engine/tb_rsa.c",
- "crypto/engine/tb_cipher.c",
- "crypto/engine/tb_dsa.c",
- "crypto/engine/eng_lib.c",
- "crypto/engine/tb_asnmth.c",
- "crypto/engine/tb_ecdh.c",
- "crypto/engine/tb_dh.c",
- "crypto/engine/tb_store.c",
- "crypto/engine/eng_init.c",
- "crypto/engine/eng_cnf.c",
- "crypto/engine/eng_all.c",
- "crypto/engine/tb_digest.c",
- "crypto/engine/tb_pkmeth.c",
- "crypto/engine/eng_table.c",
- "crypto/engine/eng_ctrl.c",
- "crypto/engine/eng_list.c",
- "crypto/engine/eng_cryptodev.c",
- "crypto/engine/eng_pkey.c",
- "crypto/engine/tb_rand.c",
- "crypto/engine/eng_openssl.c",
- "crypto/engine/eng_fat.c",
- "crypto/engine/eng_dyn.c",
- "crypto/ts/ts_rsp_verify.c",
- "crypto/ts/ts_req_print.c",
- "crypto/ts/ts_verify_ctx.c",
- "crypto/ts/ts_req_utils.c",
- "crypto/ts/ts_err.c",
- "crypto/ts/ts_rsp_print.c",
- "crypto/ts/ts_rsp_utils.c",
- "crypto/ts/ts_lib.c",
- "crypto/ts/ts_conf.c",
- "crypto/ts/ts_asn1.c",
- "crypto/ts/ts_rsp_sign.c",
- "crypto/ocsp/ocsp_ext.c",
- "crypto/ocsp/ocsp_cl.c",
- "crypto/ocsp/ocsp_ht.c",
- "crypto/ocsp/ocsp_lib.c",
- "crypto/ocsp/ocsp_srv.c",
- "crypto/ocsp/ocsp_vfy.c",
- "crypto/ocsp/ocsp_err.c",
- "crypto/ocsp/ocsp_prn.c",
- "crypto/ocsp/ocsp_asn.c",
- "crypto/bf/bf_cfb64.c",
- "crypto/bf/bf_ecb.c",
- "crypto/bf/bf_enc.c",
- "crypto/bf/bf_skey.c",
- "crypto/bf/bf_ofb64.c",
- "crypto/idea/i_skey.c",
- "crypto/idea/i_ofb64.c",
- "crypto/idea/i_cbc.c",
- "crypto/idea/i_ecb.c",
- "crypto/idea/i_cfb64.c",
- "crypto/cmac/cm_ameth.c",
- "crypto/cmac/cmac.c",
- "crypto/cmac/cm_pmeth.c",
- "crypto/dh/dh_lib.c",
- "crypto/dh/dh_key.c",
- "crypto/dh/dh_asn1.c",
- "crypto/dh/dh_depr.c",
- "crypto/dh/dh_pmeth.c",
- "crypto/dh/dh_prn.c",
- "crypto/dh/dh_gen.c",
- "crypto/dh/dh_ameth.c",
- "crypto/dh/dh_check.c",
- "crypto/dh/dh_err.c",
- "crypto/dh/dh_kdf.c",
- "crypto/dh/dh_rfc5114.c",
- "crypto/modes/ccm128.c",
- "crypto/modes/ofb128.c",
- "crypto/modes/cts128.c",
- "crypto/modes/ctr128.c",
- "crypto/modes/gcm128.c",
- "crypto/modes/cbc128.c",
- "crypto/modes/cfb128.c",
- "crypto/modes/xts128.c",
- "crypto/modes/wrap128.c",
- "crypto/camellia/cmll_cfb.c",
- "crypto/camellia/cmll_ecb.c",
- "crypto/camellia/cmll_utl.c",
- "crypto/camellia/cmll_misc.c",
- "crypto/camellia/cmll_ofb.c",
- "crypto/camellia/cmll_ctr.c",
- "crypto/seed/seed_ecb.c",
- "crypto/seed/seed_cbc.c",
- "crypto/seed/seed.c",
- "crypto/seed/seed_ofb.c",
- "crypto/seed/seed_cfb.c",
- "crypto/txt_db/txt_db.c",
- "crypto/cpt_err.c",
- "crypto/pem/pem_pk8.c",
- "crypto/pem/pem_lib.c",
- "crypto/pem/pem_sign.c",
- "crypto/pem/pem_all.c",
- "crypto/pem/pem_info.c",
- "crypto/pem/pem_pkey.c",
- "crypto/pem/pem_seal.c",
- "crypto/pem/pem_err.c",
- "crypto/pem/pem_xaux.c",
- "crypto/pem/pvkfmt.c",
- "crypto/pem/pem_x509.c",
- "crypto/pem/pem_oth.c",
- "crypto/rand/rand_lib.c",
- "crypto/rand/randfile.c",
- "crypto/rand/rand_os2.c",
- "crypto/rand/rand_unix.c",
- "crypto/rand/rand_nw.c",
- "crypto/rand/md_rand.c",
- "crypto/rand/rand_err.c",
- "crypto/rand/rand_win.c",
- "crypto/rand/rand_egd.c",
- "crypto/cversion.c",
- "crypto/cast/c_ecb.c",
- "crypto/cast/c_skey.c",
- "crypto/cast/c_ofb64.c",
- "crypto/cast/c_enc.c",
- "crypto/cast/c_cfb64.c",
- "crypto/o_time.c",
- "crypto/mdc2/mdc2dgst.c",
- "crypto/mdc2/mdc2_one.c",
- "crypto/rc4/rc4_utl.c",
- "crypto/ui/ui_compat.c",
- "crypto/ui/ui_util.c",
- "crypto/ui/ui_lib.c",
- "crypto/ui/ui_err.c",
- "crypto/ui/ui_openssl.c",
- "crypto/bio/bf_buff.c",
- "crypto/bio/bss_null.c",
- "crypto/bio/bss_acpt.c",
- "crypto/bio/bss_conn.c",
- "crypto/bio/bss_fd.c",
- "crypto/bio/bf_null.c",
- "crypto/bio/bio_err.c",
- "crypto/bio/bss_sock.c",
- "crypto/bio/bss_mem.c",
- "crypto/bio/b_dump.c",
- "crypto/bio/b_print.c",
- "crypto/bio/b_sock.c",
- "crypto/bio/bss_dgram.c",
- "crypto/bio/bf_nbio.c",
- "crypto/bio/bio_lib.c",
- "crypto/bio/bss_file.c",
- "crypto/bio/bss_bio.c",
- "crypto/bio/bss_log.c",
- "crypto/bio/bio_cb.c",
- "crypto/o_init.c",
- "crypto/rc2/rc2_skey.c",
- "crypto/rc2/rc2_cbc.c",
- "crypto/rc2/rc2cfb64.c",
- "crypto/rc2/rc2_ecb.c",
- "crypto/rc2/rc2ofb64.c",
- "crypto/bn/bn_x931p.c",
- "crypto/bn/bn_blind.c",
- "crypto/bn/bn_gf2m.c",
- "crypto/bn/bn_const.c",
- "crypto/bn/bn_sqr.c",
- "crypto/bn/bn_nist.c",
- "crypto/bn/bn_rand.c",
- "crypto/bn/bn_err.c",
- "crypto/bn/bn_div.c",
- "crypto/bn/bn_kron.c",
- "crypto/bn/bn_ctx.c",
- "crypto/bn/bn_shift.c",
- "crypto/bn/bn_mod.c",
- "crypto/bn/bn_exp2.c",
- "crypto/bn/bn_word.c",
- "crypto/bn/bn_add.c",
- "crypto/bn/bn_exp.c",
- "crypto/bn/bn_mont.c",
- "crypto/bn/bn_print.c",
- "crypto/bn/bn_mul.c",
- "crypto/bn/bn_prime.c",
- "crypto/bn/bn_depr.c",
- "crypto/bn/bn_gcd.c",
- "crypto/bn/bn_mpi.c",
- "crypto/bn/bn_sqrt.c",
- "crypto/bn/bn_recp.c",
- "crypto/bn/bn_lib.c",
- "crypto/ripemd/rmd_dgst.c",
- "crypto/ripemd/rmd_one.c",
- "crypto/rsa/rsa_x931.c",
- "crypto/rsa/rsa_depr.c",
- "crypto/rsa/rsa_saos.c",
- "crypto/rsa/rsa_crpt.c",
- "crypto/rsa/rsa_pss.c",
- "crypto/rsa/rsa_oaep.c",
- "crypto/rsa/rsa_null.c",
- "crypto/rsa/rsa_gen.c",
- "crypto/rsa/rsa_prn.c",
- "crypto/rsa/rsa_pmeth.c",
- "crypto/rsa/rsa_asn1.c",
- "crypto/rsa/rsa_ssl.c",
- "crypto/rsa/rsa_ameth.c",
- "crypto/rsa/rsa_pk1.c",
- "crypto/rsa/rsa_err.c",
- "crypto/rsa/rsa_lib.c",
- "crypto/rsa/rsa_none.c",
- "crypto/rsa/rsa_chk.c",
- "crypto/rsa/rsa_eay.c",
- "crypto/rsa/rsa_sign.c",
- "crypto/srp/srp_lib.c",
- "crypto/srp/srp_vfy.c",
- "crypto/err/err.c",
- "crypto/err/err_prn.c",
- "crypto/err/err_all.c",
- "crypto/mem_clr.c",
- "crypto/rc4/rc4_skey.c",
- "crypto/rc4/rc4_enc.c",
- "crypto/camellia/camellia.c",
- "crypto/camellia/cmll_cbc.c",
- #"crypto/aes/aes_x86core.c",
- "crypto/aes/aes_core.c",
- "crypto/aes/aes_cbc.c",
- "crypto/whrlpool/wp_block.c",
- "crypto/bn/bn_asm.c",
- ]
+ thirdparty_sources = [
+ "ssl/t1_lib.c",
+ "ssl/t1_ext.c",
+ "ssl/s3_srvr.c",
+ "ssl/t1_enc.c",
+ "ssl/t1_meth.c",
+ "ssl/s23_clnt.c",
+ "ssl/ssl_asn1.c",
+ "ssl/tls_srp.c",
+ "ssl/kssl.c",
+ "ssl/d1_both.c",
+ "ssl/t1_clnt.c",
+ "ssl/bio_ssl.c",
+ "ssl/d1_srtp.c",
+ "ssl/t1_reneg.c",
+ "ssl/ssl_cert.c",
+ "ssl/s3_lib.c",
+ "ssl/d1_srvr.c",
+ "ssl/s23_meth.c",
+ "ssl/ssl_stat.c",
+ "ssl/ssl_err.c",
+ "ssl/ssl_algs.c",
+ "ssl/s3_cbc.c",
+ "ssl/d1_clnt.c",
+ "ssl/s3_pkt.c",
+ "ssl/d1_meth.c",
+ "ssl/s3_both.c",
+ "ssl/s2_enc.c",
+ "ssl/s3_meth.c",
+ "ssl/s3_enc.c",
+ "ssl/s23_pkt.c",
+ "ssl/s2_pkt.c",
+ "ssl/d1_pkt.c",
+ "ssl/ssl_rsa.c",
+ "ssl/s23_srvr.c",
+ "ssl/s2_meth.c",
+ "ssl/s3_clnt.c",
+ "ssl/s23_lib.c",
+ "ssl/t1_srvr.c",
+ "ssl/ssl_lib.c",
+ "ssl/ssl_txt.c",
+ "ssl/s2_srvr.c",
+ "ssl/ssl_sess.c",
+ "ssl/s2_clnt.c",
+ "ssl/d1_lib.c",
+ "ssl/s2_lib.c",
+ "ssl/ssl_err2.c",
+ "ssl/ssl_ciph.c",
+ "crypto/dsa/dsa_lib.c",
+ "crypto/dsa/dsa_pmeth.c",
+ "crypto/dsa/dsa_ossl.c",
+ "crypto/dsa/dsa_gen.c",
+ "crypto/dsa/dsa_asn1.c",
+ "crypto/dsa/dsa_prn.c",
+ "crypto/dsa/dsa_sign.c",
+ "crypto/dsa/dsa_key.c",
+ "crypto/dsa/dsa_vrf.c",
+ "crypto/dsa/dsa_err.c",
+ "crypto/dsa/dsa_ameth.c",
+ "crypto/dsa/dsa_depr.c",
+ "crypto/x509/x509_lu.c",
+ "crypto/x509/x509cset.c",
+ "crypto/x509/x509_set.c",
+ "crypto/x509/x509_d2.c",
+ "crypto/x509/x509_txt.c",
+ "crypto/x509/x509rset.c",
+ "crypto/x509/by_dir.c",
+ "crypto/x509/x509_vpm.c",
+ "crypto/x509/x509_vfy.c",
+ "crypto/x509/x509_trs.c",
+ "crypto/x509/by_file.c",
+ "crypto/x509/x509_obj.c",
+ "crypto/x509/x509spki.c",
+ "crypto/x509/x509_v3.c",
+ "crypto/x509/x509_req.c",
+ "crypto/x509/x509_att.c",
+ "crypto/x509/x_all.c",
+ "crypto/x509/x509_ext.c",
+ "crypto/x509/x509type.c",
+ "crypto/x509/x509_def.c",
+ "crypto/x509/x509_err.c",
+ "crypto/x509/x509name.c",
+ "crypto/x509/x509_r2x.c",
+ "crypto/x509/x509_cmp.c",
+ "crypto/asn1/x_pkey.c",
+ "crypto/asn1/a_gentm.c",
+ "crypto/asn1/x_sig.c",
+ "crypto/asn1/t_req.c",
+ "crypto/asn1/t_pkey.c",
+ "crypto/asn1/p8_pkey.c",
+ "crypto/asn1/a_i2d_fp.c",
+ "crypto/asn1/x_val.c",
+ "crypto/asn1/f_string.c",
+ "crypto/asn1/p5_pbe.c",
+ "crypto/asn1/bio_ndef.c",
+ "crypto/asn1/a_bool.c",
+ "crypto/asn1/asn1_gen.c",
+ "crypto/asn1/x_algor.c",
+ "crypto/asn1/bio_asn1.c",
+ "crypto/asn1/asn_mime.c",
+ "crypto/asn1/t_x509.c",
+ "crypto/asn1/a_strex.c",
+ "crypto/asn1/x_nx509.c",
+ "crypto/asn1/asn1_err.c",
+ "crypto/asn1/x_crl.c",
+ "crypto/asn1/a_print.c",
+ "crypto/asn1/a_type.c",
+ "crypto/asn1/tasn_new.c",
+ "crypto/asn1/n_pkey.c",
+ "crypto/asn1/x_bignum.c",
+ "crypto/asn1/asn_pack.c",
+ "crypto/asn1/evp_asn1.c",
+ "crypto/asn1/t_bitst.c",
+ "crypto/asn1/x_req.c",
+ "crypto/asn1/a_time.c",
+ "crypto/asn1/x_name.c",
+ "crypto/asn1/x_pubkey.c",
+ "crypto/asn1/tasn_typ.c",
+ "crypto/asn1/asn_moid.c",
+ "crypto/asn1/a_utctm.c",
+ "crypto/asn1/asn1_lib.c",
+ "crypto/asn1/x_x509a.c",
+ "crypto/asn1/a_set.c",
+ "crypto/asn1/t_crl.c",
+ "crypto/asn1/p5_pbev2.c",
+ "crypto/asn1/tasn_enc.c",
+ "crypto/asn1/a_mbstr.c",
+ "crypto/asn1/tasn_dec.c",
+ "crypto/asn1/x_x509.c",
+ "crypto/asn1/a_octet.c",
+ "crypto/asn1/x_long.c",
+ "crypto/asn1/a_bytes.c",
+ "crypto/asn1/t_x509a.c",
+ "crypto/asn1/a_enum.c",
+ "crypto/asn1/a_int.c",
+ "crypto/asn1/tasn_prn.c",
+ "crypto/asn1/i2d_pr.c",
+ "crypto/asn1/a_utf8.c",
+ "crypto/asn1/t_spki.c",
+ "crypto/asn1/a_digest.c",
+ "crypto/asn1/a_dup.c",
+ "crypto/asn1/i2d_pu.c",
+ "crypto/asn1/a_verify.c",
+ "crypto/asn1/f_enum.c",
+ "crypto/asn1/a_sign.c",
+ "crypto/asn1/d2i_pr.c",
+ "crypto/asn1/asn1_par.c",
+ "crypto/asn1/x_spki.c",
+ "crypto/asn1/a_d2i_fp.c",
+ "crypto/asn1/f_int.c",
+ "crypto/asn1/x_exten.c",
+ "crypto/asn1/tasn_utl.c",
+ "crypto/asn1/nsseq.c",
+ "crypto/asn1/a_bitstr.c",
+ "crypto/asn1/x_info.c",
+ "crypto/asn1/a_strnid.c",
+ "crypto/asn1/a_object.c",
+ "crypto/asn1/tasn_fre.c",
+ "crypto/asn1/d2i_pu.c",
+ "crypto/asn1/ameth_lib.c",
+ "crypto/asn1/x_attrib.c",
+ "crypto/evp/m_sha.c",
+ "crypto/evp/e_camellia.c",
+ "crypto/evp/e_aes.c",
+ "crypto/evp/bio_b64.c",
+ "crypto/evp/m_sigver.c",
+ "crypto/evp/m_wp.c",
+ "crypto/evp/m_sha1.c",
+ "crypto/evp/p_seal.c",
+ "crypto/evp/c_alld.c",
+ "crypto/evp/p5_crpt.c",
+ "crypto/evp/e_rc4.c",
+ "crypto/evp/m_ecdsa.c",
+ "crypto/evp/bio_enc.c",
+ "crypto/evp/e_des3.c",
+ "crypto/evp/m_null.c",
+ "crypto/evp/bio_ok.c",
+ "crypto/evp/pmeth_gn.c",
+ "crypto/evp/e_rc5.c",
+ "crypto/evp/e_rc2.c",
+ "crypto/evp/p_dec.c",
+ "crypto/evp/p_verify.c",
+ "crypto/evp/e_rc4_hmac_md5.c",
+ "crypto/evp/pmeth_lib.c",
+ "crypto/evp/m_ripemd.c",
+ "crypto/evp/m_md5.c",
+ "crypto/evp/e_bf.c",
+ "crypto/evp/p_enc.c",
+ "crypto/evp/m_dss.c",
+ "crypto/evp/bio_md.c",
+ "crypto/evp/evp_pbe.c",
+ "crypto/evp/e_seed.c",
+ "crypto/evp/e_cast.c",
+ "crypto/evp/p_open.c",
+ "crypto/evp/p5_crpt2.c",
+ "crypto/evp/m_dss1.c",
+ "crypto/evp/names.c",
+ "crypto/evp/evp_acnf.c",
+ "crypto/evp/e_des.c",
+ "crypto/evp/evp_cnf.c",
+ "crypto/evp/evp_lib.c",
+ "crypto/evp/digest.c",
+ "crypto/evp/evp_err.c",
+ "crypto/evp/evp_enc.c",
+ "crypto/evp/e_old.c",
+ "crypto/evp/c_all.c",
+ "crypto/evp/m_md2.c",
+ "crypto/evp/e_xcbc_d.c",
+ "crypto/evp/pmeth_fn.c",
+ "crypto/evp/p_lib.c",
+ "crypto/evp/evp_key.c",
+ "crypto/evp/encode.c",
+ "crypto/evp/e_aes_cbc_hmac_sha1.c",
+ "crypto/evp/e_aes_cbc_hmac_sha256.c",
+ "crypto/evp/m_mdc2.c",
+ "crypto/evp/e_null.c",
+ "crypto/evp/p_sign.c",
+ "crypto/evp/e_idea.c",
+ "crypto/evp/c_allc.c",
+ "crypto/evp/evp_pkey.c",
+ "crypto/evp/m_md4.c",
+ "crypto/ex_data.c",
+ "crypto/pkcs12/p12_p8e.c",
+ "crypto/pkcs12/p12_crt.c",
+ "crypto/pkcs12/p12_utl.c",
+ "crypto/pkcs12/p12_attr.c",
+ "crypto/pkcs12/p12_npas.c",
+ "crypto/pkcs12/p12_decr.c",
+ "crypto/pkcs12/p12_init.c",
+ "crypto/pkcs12/p12_kiss.c",
+ "crypto/pkcs12/p12_add.c",
+ "crypto/pkcs12/p12_p8d.c",
+ "crypto/pkcs12/p12_mutl.c",
+ "crypto/pkcs12/p12_crpt.c",
+ "crypto/pkcs12/pk12err.c",
+ "crypto/pkcs12/p12_asn.c",
+ "crypto/pkcs12/p12_key.c",
+ "crypto/ecdh/ech_key.c",
+ "crypto/ecdh/ech_ossl.c",
+ "crypto/ecdh/ech_lib.c",
+ "crypto/ecdh/ech_err.c",
+ "crypto/ecdh/ech_kdf.c",
+ "crypto/o_str.c",
+ "crypto/conf/conf_api.c",
+ "crypto/conf/conf_err.c",
+ "crypto/conf/conf_def.c",
+ "crypto/conf/conf_lib.c",
+ "crypto/conf/conf_mall.c",
+ "crypto/conf/conf_sap.c",
+ "crypto/conf/conf_mod.c",
+ "crypto/ebcdic.c",
+ "crypto/ecdsa/ecs_lib.c",
+ "crypto/ecdsa/ecs_asn1.c",
+ "crypto/ecdsa/ecs_ossl.c",
+ "crypto/ecdsa/ecs_vrf.c",
+ "crypto/ecdsa/ecs_sign.c",
+ "crypto/ecdsa/ecs_err.c",
+ "crypto/dso/dso_win32.c",
+ "crypto/dso/dso_lib.c",
+ "crypto/dso/dso_dlfcn.c",
+ "crypto/dso/dso_dl.c",
+ "crypto/dso/dso_beos.c",
+ "crypto/dso/dso_null.c",
+ "crypto/dso/dso_vms.c",
+ "crypto/dso/dso_err.c",
+ "crypto/dso/dso_openssl.c",
+ "crypto/cryptlib.c",
+ "crypto/md5/md5_one.c",
+ "crypto/md5/md5_dgst.c",
+ "crypto/pkcs7/pkcs7err.c",
+ "crypto/pkcs7/pk7_smime.c",
+ "crypto/pkcs7/bio_pk7.c",
+ "crypto/pkcs7/pk7_mime.c",
+ "crypto/pkcs7/pk7_lib.c",
+ "crypto/pkcs7/pk7_asn1.c",
+ "crypto/pkcs7/pk7_doit.c",
+ "crypto/pkcs7/pk7_attr.c",
+ "crypto/md4/md4_one.c",
+ "crypto/md4/md4_dgst.c",
+ "crypto/o_dir.c",
+ "crypto/buffer/buf_err.c",
+ "crypto/buffer/buf_str.c",
+ "crypto/buffer/buffer.c",
+ "crypto/cms/cms_lib.c",
+ "crypto/cms/cms_io.c",
+ "crypto/cms/cms_err.c",
+ "crypto/cms/cms_dd.c",
+ "crypto/cms/cms_smime.c",
+ "crypto/cms/cms_att.c",
+ "crypto/cms/cms_pwri.c",
+ "crypto/cms/cms_cd.c",
+ "crypto/cms/cms_sd.c",
+ "crypto/cms/cms_asn1.c",
+ "crypto/cms/cms_env.c",
+ "crypto/cms/cms_enc.c",
+ "crypto/cms/cms_ess.c",
+ "crypto/cms/cms_kari.c",
+ "crypto/mem_dbg.c",
+ "crypto/uid.c",
+ "crypto/stack/stack.c",
+ "crypto/ec/ec_ameth.c",
+ "crypto/ec/ec_err.c",
+ "crypto/ec/ec_lib.c",
+ "crypto/ec/ec_curve.c",
+ "crypto/ec/ec_oct.c",
+ "crypto/ec/ec_asn1.c",
+ "crypto/ec/ecp_oct.c",
+ "crypto/ec/ec_print.c",
+ "crypto/ec/ec2_smpl.c",
+ "crypto/ec/ecp_nistp224.c",
+ "crypto/ec/ec2_oct.c",
+ "crypto/ec/eck_prn.c",
+ "crypto/ec/ec_key.c",
+ "crypto/ec/ecp_nist.c",
+ "crypto/ec/ec_check.c",
+ "crypto/ec/ecp_smpl.c",
+ "crypto/ec/ec2_mult.c",
+ "crypto/ec/ecp_mont.c",
+ "crypto/ec/ecp_nistp521.c",
+ "crypto/ec/ec_mult.c",
+ "crypto/ec/ecp_nistputil.c",
+ "crypto/ec/ec_pmeth.c",
+ "crypto/ec/ec_cvt.c",
+ "crypto/ec/ecp_nistp256.c",
+ "crypto/krb5/krb5_asn.c",
+ "crypto/hmac/hmac.c",
+ "crypto/hmac/hm_ameth.c",
+ "crypto/hmac/hm_pmeth.c",
+ "crypto/comp/c_rle.c",
+ "crypto/comp/c_zlib.c",
+ "crypto/comp/comp_lib.c",
+ "crypto/comp/comp_err.c",
+ "crypto/des/fcrypt.c",
+ "crypto/des/str2key.c",
+ "crypto/des/cbc_cksm.c",
+ "crypto/des/des_enc.c",
+ "crypto/des/ofb_enc.c",
+ "crypto/des/read2pwd.c",
+ "crypto/des/ecb3_enc.c",
+ "crypto/des/rand_key.c",
+ "crypto/des/cfb64ede.c",
+ "crypto/des/rpc_enc.c",
+ "crypto/des/ofb64ede.c",
+ "crypto/des/qud_cksm.c",
+ "crypto/des/enc_writ.c",
+ "crypto/des/set_key.c",
+ "crypto/des/xcbc_enc.c",
+ "crypto/des/fcrypt_b.c",
+ "crypto/des/ede_cbcm_enc.c",
+ "crypto/des/des_old2.c",
+ "crypto/des/cfb_enc.c",
+ "crypto/des/ecb_enc.c",
+ "crypto/des/enc_read.c",
+ "crypto/des/des_old.c",
+ "crypto/des/ofb64enc.c",
+ "crypto/des/pcbc_enc.c",
+ "crypto/des/cbc_enc.c",
+ "crypto/des/cfb64enc.c",
+ "crypto/lhash/lh_stats.c",
+ "crypto/lhash/lhash.c",
+ "crypto/x509v3/v3_genn.c",
+ "crypto/x509v3/pcy_cache.c",
+ "crypto/x509v3/v3_sxnet.c",
+ "crypto/x509v3/v3_scts.c",
+ "crypto/x509v3/v3err.c",
+ "crypto/x509v3/v3_conf.c",
+ "crypto/x509v3/v3_utl.c",
+ "crypto/x509v3/v3_akeya.c",
+ "crypto/x509v3/v3_lib.c",
+ "crypto/x509v3/pcy_lib.c",
+ "crypto/x509v3/v3_cpols.c",
+ "crypto/x509v3/v3_ia5.c",
+ "crypto/x509v3/v3_bitst.c",
+ "crypto/x509v3/v3_skey.c",
+ "crypto/x509v3/v3_info.c",
+ "crypto/x509v3/v3_asid.c",
+ "crypto/x509v3/pcy_tree.c",
+ "crypto/x509v3/v3_pcons.c",
+ "crypto/x509v3/v3_bcons.c",
+ "crypto/x509v3/v3_pku.c",
+ "crypto/x509v3/v3_ocsp.c",
+ "crypto/x509v3/pcy_map.c",
+ "crypto/x509v3/v3_ncons.c",
+ "crypto/x509v3/v3_purp.c",
+ "crypto/x509v3/v3_enum.c",
+ "crypto/x509v3/v3_pmaps.c",
+ "crypto/x509v3/pcy_node.c",
+ "crypto/x509v3/v3_pcia.c",
+ "crypto/x509v3/v3_crld.c",
+ "crypto/x509v3/v3_pci.c",
+ "crypto/x509v3/v3_akey.c",
+ "crypto/x509v3/v3_addr.c",
+ "crypto/x509v3/v3_int.c",
+ "crypto/x509v3/v3_alt.c",
+ "crypto/x509v3/v3_extku.c",
+ "crypto/x509v3/v3_prn.c",
+ "crypto/x509v3/pcy_data.c",
+ "crypto/aes/aes_ofb.c",
+ "crypto/aes/aes_ctr.c",
+ "crypto/aes/aes_ecb.c",
+ "crypto/aes/aes_cfb.c",
+ "crypto/aes/aes_wrap.c",
+ "crypto/aes/aes_ige.c",
+ "crypto/aes/aes_misc.c",
+ "crypto/pqueue/pqueue.c",
+ "crypto/sha/sha_one.c",
+ "crypto/sha/sha_dgst.c",
+ "crypto/sha/sha512.c",
+ "crypto/sha/sha1_one.c",
+ "crypto/sha/sha1dgst.c",
+ "crypto/sha/sha256.c",
+ "crypto/whrlpool/wp_dgst.c",
+ "crypto/objects/obj_xref.c",
+ "crypto/objects/o_names.c",
+ "crypto/objects/obj_err.c",
+ "crypto/objects/obj_dat.c",
+ "crypto/objects/obj_lib.c",
+ "crypto/mem.c",
+ "crypto/fips_ers.c",
+ "crypto/o_fips.c",
+ "crypto/engine/eng_rdrand.c",
+ "crypto/engine/eng_err.c",
+ "crypto/engine/tb_ecdsa.c",
+ "crypto/engine/tb_rsa.c",
+ "crypto/engine/tb_cipher.c",
+ "crypto/engine/tb_dsa.c",
+ "crypto/engine/eng_lib.c",
+ "crypto/engine/tb_asnmth.c",
+ "crypto/engine/tb_ecdh.c",
+ "crypto/engine/tb_dh.c",
+ "crypto/engine/tb_store.c",
+ "crypto/engine/eng_init.c",
+ "crypto/engine/eng_cnf.c",
+ "crypto/engine/eng_all.c",
+ "crypto/engine/tb_digest.c",
+ "crypto/engine/tb_pkmeth.c",
+ "crypto/engine/eng_table.c",
+ "crypto/engine/eng_ctrl.c",
+ "crypto/engine/eng_list.c",
+ "crypto/engine/eng_cryptodev.c",
+ "crypto/engine/eng_pkey.c",
+ "crypto/engine/tb_rand.c",
+ "crypto/engine/eng_openssl.c",
+ "crypto/engine/eng_fat.c",
+ "crypto/engine/eng_dyn.c",
+ "crypto/ts/ts_rsp_verify.c",
+ "crypto/ts/ts_req_print.c",
+ "crypto/ts/ts_verify_ctx.c",
+ "crypto/ts/ts_req_utils.c",
+ "crypto/ts/ts_err.c",
+ "crypto/ts/ts_rsp_print.c",
+ "crypto/ts/ts_rsp_utils.c",
+ "crypto/ts/ts_lib.c",
+ "crypto/ts/ts_conf.c",
+ "crypto/ts/ts_asn1.c",
+ "crypto/ts/ts_rsp_sign.c",
+ "crypto/ocsp/ocsp_ext.c",
+ "crypto/ocsp/ocsp_cl.c",
+ "crypto/ocsp/ocsp_ht.c",
+ "crypto/ocsp/ocsp_lib.c",
+ "crypto/ocsp/ocsp_srv.c",
+ "crypto/ocsp/ocsp_vfy.c",
+ "crypto/ocsp/ocsp_err.c",
+ "crypto/ocsp/ocsp_prn.c",
+ "crypto/ocsp/ocsp_asn.c",
+ "crypto/bf/bf_cfb64.c",
+ "crypto/bf/bf_ecb.c",
+ "crypto/bf/bf_enc.c",
+ "crypto/bf/bf_skey.c",
+ "crypto/bf/bf_ofb64.c",
+ "crypto/idea/i_skey.c",
+ "crypto/idea/i_ofb64.c",
+ "crypto/idea/i_cbc.c",
+ "crypto/idea/i_ecb.c",
+ "crypto/idea/i_cfb64.c",
+ "crypto/cmac/cm_ameth.c",
+ "crypto/cmac/cmac.c",
+ "crypto/cmac/cm_pmeth.c",
+ "crypto/dh/dh_lib.c",
+ "crypto/dh/dh_key.c",
+ "crypto/dh/dh_asn1.c",
+ "crypto/dh/dh_depr.c",
+ "crypto/dh/dh_pmeth.c",
+ "crypto/dh/dh_prn.c",
+ "crypto/dh/dh_gen.c",
+ "crypto/dh/dh_ameth.c",
+ "crypto/dh/dh_check.c",
+ "crypto/dh/dh_err.c",
+ "crypto/dh/dh_kdf.c",
+ "crypto/dh/dh_rfc5114.c",
+ "crypto/modes/ccm128.c",
+ "crypto/modes/ofb128.c",
+ "crypto/modes/cts128.c",
+ "crypto/modes/ctr128.c",
+ "crypto/modes/gcm128.c",
+ "crypto/modes/cbc128.c",
+ "crypto/modes/cfb128.c",
+ "crypto/modes/xts128.c",
+ "crypto/modes/wrap128.c",
+ "crypto/camellia/cmll_cfb.c",
+ "crypto/camellia/cmll_ecb.c",
+ "crypto/camellia/cmll_utl.c",
+ "crypto/camellia/cmll_misc.c",
+ "crypto/camellia/cmll_ofb.c",
+ "crypto/camellia/cmll_ctr.c",
+ "crypto/seed/seed_ecb.c",
+ "crypto/seed/seed_cbc.c",
+ "crypto/seed/seed.c",
+ "crypto/seed/seed_ofb.c",
+ "crypto/seed/seed_cfb.c",
+ "crypto/txt_db/txt_db.c",
+ "crypto/cpt_err.c",
+ "crypto/pem/pem_pk8.c",
+ "crypto/pem/pem_lib.c",
+ "crypto/pem/pem_sign.c",
+ "crypto/pem/pem_all.c",
+ "crypto/pem/pem_info.c",
+ "crypto/pem/pem_pkey.c",
+ "crypto/pem/pem_seal.c",
+ "crypto/pem/pem_err.c",
+ "crypto/pem/pem_xaux.c",
+ "crypto/pem/pvkfmt.c",
+ "crypto/pem/pem_x509.c",
+ "crypto/pem/pem_oth.c",
+ "crypto/rand/rand_lib.c",
+ "crypto/rand/randfile.c",
+ "crypto/rand/rand_os2.c",
+ "crypto/rand/rand_unix.c",
+ "crypto/rand/rand_nw.c",
+ "crypto/rand/md_rand.c",
+ "crypto/rand/rand_err.c",
+ "crypto/rand/rand_win.c",
+ "crypto/rand/rand_egd.c",
+ "crypto/cversion.c",
+ "crypto/cast/c_ecb.c",
+ "crypto/cast/c_skey.c",
+ "crypto/cast/c_ofb64.c",
+ "crypto/cast/c_enc.c",
+ "crypto/cast/c_cfb64.c",
+ "crypto/o_time.c",
+ "crypto/mdc2/mdc2dgst.c",
+ "crypto/mdc2/mdc2_one.c",
+ "crypto/rc4/rc4_utl.c",
+ "crypto/ui/ui_compat.c",
+ "crypto/ui/ui_util.c",
+ "crypto/ui/ui_lib.c",
+ "crypto/ui/ui_err.c",
+ "crypto/ui/ui_openssl.c",
+ "crypto/bio/bf_buff.c",
+ "crypto/bio/bss_null.c",
+ "crypto/bio/bss_acpt.c",
+ "crypto/bio/bss_conn.c",
+ "crypto/bio/bss_fd.c",
+ "crypto/bio/bf_null.c",
+ "crypto/bio/bio_err.c",
+ "crypto/bio/bss_sock.c",
+ "crypto/bio/bss_mem.c",
+ "crypto/bio/b_dump.c",
+ "crypto/bio/b_print.c",
+ "crypto/bio/b_sock.c",
+ "crypto/bio/bss_dgram.c",
+ "crypto/bio/bf_nbio.c",
+ "crypto/bio/bio_lib.c",
+ "crypto/bio/bss_file.c",
+ "crypto/bio/bss_bio.c",
+ "crypto/bio/bss_log.c",
+ "crypto/bio/bio_cb.c",
+ "crypto/o_init.c",
+ "crypto/rc2/rc2_skey.c",
+ "crypto/rc2/rc2_cbc.c",
+ "crypto/rc2/rc2cfb64.c",
+ "crypto/rc2/rc2_ecb.c",
+ "crypto/rc2/rc2ofb64.c",
+ "crypto/bn/bn_x931p.c",
+ "crypto/bn/bn_blind.c",
+ "crypto/bn/bn_gf2m.c",
+ "crypto/bn/bn_const.c",
+ "crypto/bn/bn_sqr.c",
+ "crypto/bn/bn_nist.c",
+ "crypto/bn/bn_rand.c",
+ "crypto/bn/bn_err.c",
+ "crypto/bn/bn_div.c",
+ "crypto/bn/bn_kron.c",
+ "crypto/bn/bn_ctx.c",
+ "crypto/bn/bn_shift.c",
+ "crypto/bn/bn_mod.c",
+ "crypto/bn/bn_exp2.c",
+ "crypto/bn/bn_word.c",
+ "crypto/bn/bn_add.c",
+ "crypto/bn/bn_exp.c",
+ "crypto/bn/bn_mont.c",
+ "crypto/bn/bn_print.c",
+ "crypto/bn/bn_mul.c",
+ "crypto/bn/bn_prime.c",
+ "crypto/bn/bn_depr.c",
+ "crypto/bn/bn_gcd.c",
+ "crypto/bn/bn_mpi.c",
+ "crypto/bn/bn_sqrt.c",
+ "crypto/bn/bn_recp.c",
+ "crypto/bn/bn_lib.c",
+ "crypto/ripemd/rmd_dgst.c",
+ "crypto/ripemd/rmd_one.c",
+ "crypto/rsa/rsa_x931.c",
+ "crypto/rsa/rsa_depr.c",
+ "crypto/rsa/rsa_saos.c",
+ "crypto/rsa/rsa_crpt.c",
+ "crypto/rsa/rsa_pss.c",
+ "crypto/rsa/rsa_oaep.c",
+ "crypto/rsa/rsa_null.c",
+ "crypto/rsa/rsa_gen.c",
+ "crypto/rsa/rsa_prn.c",
+ "crypto/rsa/rsa_pmeth.c",
+ "crypto/rsa/rsa_asn1.c",
+ "crypto/rsa/rsa_ssl.c",
+ "crypto/rsa/rsa_ameth.c",
+ "crypto/rsa/rsa_pk1.c",
+ "crypto/rsa/rsa_err.c",
+ "crypto/rsa/rsa_lib.c",
+ "crypto/rsa/rsa_none.c",
+ "crypto/rsa/rsa_chk.c",
+ "crypto/rsa/rsa_eay.c",
+ "crypto/rsa/rsa_sign.c",
+ "crypto/srp/srp_lib.c",
+ "crypto/srp/srp_vfy.c",
+ "crypto/err/err.c",
+ "crypto/err/err_prn.c",
+ "crypto/err/err_all.c",
+ "crypto/mem_clr.c",
+ "crypto/rc4/rc4_skey.c",
+ "crypto/rc4/rc4_enc.c",
+ "crypto/camellia/camellia.c",
+ "crypto/camellia/cmll_cbc.c",
+ #"crypto/aes/aes_x86core.c",
+ "crypto/aes/aes_core.c",
+ "crypto/aes/aes_cbc.c",
+ "crypto/whrlpool/wp_block.c",
+ "crypto/bn/bn_asm.c",
+ ]
- if "platform" in env and env["platform"] == "winrt":
- thirdparty_sources += ['winrt.cpp']
+ if "platform" in env and env["platform"] == "uwp":
+ thirdparty_sources += ['uwp.cpp']
- thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
+ thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
- env_openssl.add_source_files(env.modules_sources, thirdparty_sources)
+ env_openssl.add_source_files(env.modules_sources, thirdparty_sources)
- # FIXME: Clone the environment to make a env_openssl and not pollute the modules env
- thirdparty_include_paths = [
- "",
- "crypto",
- "crypto/asn1",
- "crypto/evp",
- "crypto/modes",
- "openssl",
- ]
- env_openssl.Append(CPPPATH = [thirdparty_dir + "/" + dir for dir in thirdparty_include_paths])
+ # FIXME: Clone the environment to make a env_openssl and not pollute the modules env
+ thirdparty_include_paths = [
+ "",
+ "crypto",
+ "crypto/asn1",
+ "crypto/evp",
+ "crypto/modes",
+ "openssl",
+ ]
+ env_openssl.Append(CPPPATH=[thirdparty_dir + "/" + dir for dir in thirdparty_include_paths])
- env_openssl.Append(CPPFLAGS = ["-DOPENSSL_NO_ASM", "-DOPENSSL_THREADS", "-DL_ENDIAN"])
+ env_openssl.Append(CPPFLAGS=["-DOPENSSL_NO_ASM", "-DOPENSSL_THREADS", "-DL_ENDIAN"])
- # Workaround for compilation error with GCC/Clang when -Werror is too greedy (GH-4517)
- import os
- import methods
- if not (os.name=="nt" and os.getenv("VCINSTALLDIR")): # not Windows and not MSVC
- env_openssl.Append(CFLAGS = ["-Wno-error=implicit-function-declaration"])
+ # Workaround for compilation error with GCC/Clang when -Werror is too greedy (GH-4517)
+ import os
+ import methods
+ if not (os.name == "nt" and os.getenv("VCINSTALLDIR")): # not Windows and not MSVC
+ env_openssl.Append(CFLAGS=["-Wno-error=implicit-function-declaration"])
# Module sources
env_openssl.add_source_files(env.modules_sources, "*.cpp")
env_openssl.add_source_files(env.modules_sources, "*.c")
-# platform/winrt need to know openssl is available, pass to main env
-if "platform" in env and env["platform"] == "winrt":
- env.Append(CPPPATH = [thirdparty_dir])
- env.Append(CPPFLAGS = ['-DOPENSSL_ENABLED']);
+# platform/uwp need to know openssl is available, pass to main env
+if "platform" in env and env["platform"] == "uwp":
+ env.Append(CPPPATH=[thirdparty_dir])
+ env.Append(CPPFLAGS=['-DOPENSSL_ENABLED'])
Export('env')
diff --git a/modules/openssl/config.py b/modules/openssl/config.py
index 368e97e152..fb920482f5 100644
--- a/modules/openssl/config.py
+++ b/modules/openssl/config.py
@@ -1,6 +1,7 @@
def can_build(platform):
- return True
+ return True
+
def configure(env):
- pass
+ pass
diff --git a/modules/openssl/register_types.cpp b/modules/openssl/register_types.cpp
index 4aba9f530e..6cc9fa3669 100644
--- a/modules/openssl/register_types.cpp
+++ b/modules/openssl/register_types.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* 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 */
@@ -32,7 +32,7 @@
void register_openssl_types() {
- ObjectTypeDB::register_type<StreamPeerOpenSSL>();
+ ClassDB::register_class<StreamPeerOpenSSL>();
StreamPeerOpenSSL::initialize_ssl();
}
diff --git a/modules/openssl/register_types.h b/modules/openssl/register_types.h
index 2db140cc80..3bcee59bfd 100644
--- a/modules/openssl/register_types.h
+++ b/modules/openssl/register_types.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* 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 */
diff --git a/modules/openssl/stream_peer_openssl.cpp b/modules/openssl/stream_peer_openssl.cpp
index b9bec4ca0b..43a1f610d8 100644
--- a/modules/openssl/stream_peer_openssl.cpp
+++ b/modules/openssl/stream_peer_openssl.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* 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 */
@@ -35,8 +35,8 @@
bool StreamPeerOpenSSL::_match_host_name(const char *name, const char *hostname) {
return Tool_Curl_cert_hostcheck(name,hostname)==CURL_HOST_MATCH;
-// print_line("MATCH: "+String(name)+" vs "+String(hostname));
-// return true;
+ //print_line("MATCH: "+String(name)+" vs "+String(hostname));
+ //return true;
}
Error StreamPeerOpenSSL::_match_common_name(const char *hostname, const X509 *server_cert) {
@@ -293,10 +293,10 @@ BIO_METHOD StreamPeerOpenSSL::_bio_method = {
_bio_destroy
};
-Error StreamPeerOpenSSL::connect(Ref<StreamPeer> p_base, bool p_validate_certs, const String& p_for_hostname) {
+Error StreamPeerOpenSSL::connect_to_stream(Ref<StreamPeer> p_base, bool p_validate_certs, const String& p_for_hostname) {
if (connected)
- disconnect();
+ disconnect_from_stream();
hostname=p_for_hostname;
@@ -415,7 +415,7 @@ Error StreamPeerOpenSSL::connect(Ref<StreamPeer> p_base, bool p_validate_certs,
return OK;
}
-Error StreamPeerOpenSSL::accept(Ref<StreamPeer> p_base) {
+Error StreamPeerOpenSSL::accept_stream(Ref<StreamPeer> p_base) {
return ERR_UNAVAILABLE;
@@ -451,7 +451,7 @@ Error StreamPeerOpenSSL::put_data(const uint8_t* p_data,int p_bytes) {
int ret = SSL_write(ssl,p_data,p_bytes);
if (ret<=0) {
_print_error(ret);
- disconnect();
+ disconnect_from_stream();
return ERR_CONNECTION_ERROR;
}
p_data+=ret;
@@ -486,7 +486,7 @@ Error StreamPeerOpenSSL::get_data(uint8_t* p_buffer, int p_bytes){
int ret = SSL_read(ssl,p_buffer,p_bytes);
if (ret<=0) {
_print_error(ret);
- disconnect();
+ disconnect_from_stream();
return ERR_CONNECTION_ERROR;
}
p_buffer+=ret;
@@ -529,7 +529,7 @@ StreamPeerOpenSSL::StreamPeerOpenSSL() {
flags=0;
}
-void StreamPeerOpenSSL::disconnect() {
+void StreamPeerOpenSSL::disconnect_from_stream() {
if (!connected)
return;
@@ -552,7 +552,7 @@ StreamPeerOpenSSL::Status StreamPeerOpenSSL::get_status() const {
StreamPeerOpenSSL::~StreamPeerOpenSSL() {
- disconnect();
+ disconnect_from_stream();
}
StreamPeerSSL* StreamPeerOpenSSL::_create_func() {
@@ -564,9 +564,9 @@ StreamPeerSSL* StreamPeerOpenSSL::_create_func() {
Vector<X509*> StreamPeerOpenSSL::certs;
-void StreamPeerOpenSSL::_load_certs(const ByteArray& p_array) {
+void StreamPeerOpenSSL::_load_certs(const PoolByteArray& p_array) {
- ByteArray::Read r = p_array.read();
+ PoolByteArray::Read r = p_array.read();
BIO* mem = BIO_new(BIO_s_mem());
BIO_puts(mem,(const char*)r.ptr());
while(true) {
@@ -590,19 +590,19 @@ void StreamPeerOpenSSL::initialize_ssl() {
SSL_load_error_strings(); // Load SSL error strings
ERR_load_BIO_strings(); // Load BIO error strings
OpenSSL_add_all_algorithms(); // Load all available encryption algorithms
- String certs_path =GLOBAL_DEF("ssl/certificates","");
- Globals::get_singleton()->set_custom_property_info("ssl/certificates",PropertyInfo(Variant::STRING,"ssl/certificates",PROPERTY_HINT_FILE,"*.crt"));
+ String certs_path =GLOBAL_DEF("network/ssl/certificates","");
+ GlobalConfig::get_singleton()->set_custom_property_info("network/ssl/certificates",PropertyInfo(Variant::STRING,"network/ssl/certificates",PROPERTY_HINT_FILE,"*.crt"));
if (certs_path!="") {
FileAccess *f=FileAccess::open(certs_path,FileAccess::READ);
if (f) {
- ByteArray arr;
+ PoolByteArray arr;
int flen = f->get_len();
arr.resize(flen+1);
{
- ByteArray::Write w = arr.write();
+ PoolByteArray::Write w = arr.write();
f->get_buffer(w.ptr(),flen);
w[flen]=0; //end f string
}
@@ -613,8 +613,8 @@ void StreamPeerOpenSSL::initialize_ssl() {
print_line("Loaded certs from '"+certs_path+"': "+itos(certs.size()));
}
}
- String config_path =GLOBAL_DEF("ssl/config","");
- Globals::get_singleton()->set_custom_property_info("ssl/config",PropertyInfo(Variant::STRING,"ssl/config",PROPERTY_HINT_FILE,"*.cnf"));
+ String config_path =GLOBAL_DEF("network/ssl/config","");
+ GlobalConfig::get_singleton()->set_custom_property_info("network/ssl/config",PropertyInfo(Variant::STRING,"network/ssl/config",PROPERTY_HINT_FILE,"*.cnf"));
if (config_path!="") {
Vector<uint8_t> data = FileAccess::get_file_as_array(config_path);
diff --git a/modules/openssl/stream_peer_openssl.h b/modules/openssl/stream_peer_openssl.h
index 853ede2036..3d6875698c 100644
--- a/modules/openssl/stream_peer_openssl.h
+++ b/modules/openssl/stream_peer_openssl.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* 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 */
@@ -79,17 +79,17 @@ private:
static Vector<X509*> certs;
- static void _load_certs(const ByteArray& p_array);
+ static void _load_certs(const PoolByteArray& p_array);
protected:
static void _bind_methods();
public:
- virtual Error accept(Ref<StreamPeer> p_base);
- virtual Error connect(Ref<StreamPeer> p_base,bool p_validate_certs=false,const String& p_for_hostname=String());
+ virtual Error accept_stream(Ref<StreamPeer> p_base);
+ virtual Error connect_to_stream(Ref<StreamPeer> p_base,bool p_validate_certs=false,const String& p_for_hostname=String());
virtual Status get_status() const;
- virtual void disconnect();
+ virtual void disconnect_from_stream();
virtual Error put_data(const uint8_t* p_data,int p_bytes);
virtual Error put_partial_data(const uint8_t* p_data,int p_bytes, int &r_sent);
diff --git a/modules/opus/SCsub b/modules/opus/SCsub
index 603f5a48c4..4d3053c7ec 100644
--- a/modules/opus/SCsub
+++ b/modules/opus/SCsub
@@ -6,210 +6,211 @@ Import('env_modules')
env_opus = env_modules.Clone()
# Thirdparty source files
-if (env["opus"] != "system"): # builtin
- thirdparty_dir = "#thirdparty/opus/"
+if (env['builtin_opus'] != 'no'):
+ thirdparty_dir = "#thirdparty/opus/"
- thirdparty_sources = [
- "silk/tables_other.c",
- "silk/sum_sqr_shift.c",
- "silk/PLC.c",
- "silk/dec_API.c",
- "silk/decode_pulses.c",
- "silk/inner_prod_aligned.c",
- "silk/init_encoder.c",
- "silk/interpolate.c",
- "silk/stereo_encode_pred.c",
- "silk/decode_frame.c",
- "silk/NLSF_del_dec_quant.c",
- "silk/VAD.c",
- "silk/resampler_private_AR2.c",
- "silk/NLSF_unpack.c",
- "silk/resampler_down2.c",
- "silk/sort.c",
- "silk/resampler_private_IIR_FIR.c",
- "silk/resampler_down2_3.c",
- "silk/resampler_private_up2_HQ.c",
- "silk/tables_gain.c",
- "silk/stereo_find_predictor.c",
- "silk/stereo_quant_pred.c",
- "silk/NLSF_stabilize.c",
- "silk/ana_filt_bank_1.c",
- "silk/check_control_input.c",
- "silk/bwexpander.c",
- "silk/A2NLSF.c",
- "silk/LPC_inv_pred_gain.c",
- "silk/log2lin.c",
- "silk/process_NLSFs.c",
- "silk/sigm_Q15.c",
- "silk/VQ_WMat_EC.c",
- "silk/quant_LTP_gains.c",
- "silk/resampler_private_down_FIR.c",
- "silk/NLSF_decode.c",
- "silk/control_codec.c",
- "silk/NLSF_VQ_weights_laroia.c",
- "silk/decode_pitch.c",
- "silk/stereo_decode_pred.c",
- "silk/tables_pulses_per_block.c",
- "silk/init_decoder.c",
- "silk/table_LSF_cos.c",
- "silk/decode_core.c",
- "silk/code_signs.c",
- "silk/enc_API.c",
- "silk/tables_LTP.c",
- "silk/pitch_est_tables.c",
- "silk/biquad_alt.c",
- "silk/encode_indices.c",
- "silk/tables_NLSF_CB_WB.c",
- "silk/debug.c",
- "silk/decode_parameters.c",
- "silk/tables_pitch_lag.c",
- "silk/NLSF2A.c",
- "silk/resampler.c",
- "silk/decode_indices.c",
- "silk/NLSF_VQ.c",
- "silk/bwexpander_32.c",
- "silk/tables_NLSF_CB_NB_MB.c",
- "silk/encode_pulses.c",
- "silk/NSQ_del_dec.c",
- "silk/control_SNR.c",
- "silk/shell_coder.c",
- "silk/NLSF_encode.c",
- "silk/stereo_MS_to_LR.c",
- "silk/stereo_LR_to_MS.c",
- "silk/HP_variable_cutoff.c",
- "silk/LPC_analysis_filter.c",
- "silk/CNG.c",
- "silk/decoder_set_fs.c",
- "silk/resampler_rom.c",
- "silk/control_audio_bandwidth.c",
- "silk/lin2log.c",
- "silk/LP_variable_cutoff.c",
- "silk/NSQ.c",
- "silk/gain_quant.c",
- "celt/laplace.c",
- "celt/vq.c",
- "celt/quant_bands.c",
- "celt/kiss_fft.c",
- "celt/entcode.c",
- "celt/entenc.c",
- "celt/celt_lpc.c",
- "celt/pitch.c",
- "celt/rate.c",
- "celt/mathops.c",
- #"celt/arm/armcpu.c",
- #"celt/arm/celt_neon_intr.c",
- #"celt/arm/celt_ne10_mdct.c",
- #"celt/arm/celt_ne10_fft.c",
- #"celt/arm/arm_celt_map.c",
- "celt/celt_encoder.c",
- "celt/celt.c",
- "celt/bands.c",
- "celt/cwrs.c",
- "celt/entdec.c",
- "celt/celt_decoder.c",
- "celt/mdct.c",
- "celt/modes.c",
- "repacketizer.c",
- "mlp_data.c",
- "opus_multistream.c",
- "opusfile.c",
- "opus_encoder.c",
- "analysis.c",
- "mlp.c",
- "info.c",
- "stream.c",
- "opus_decoder.c",
- "internal.c",
- "wincerts.c",
- "opus.c",
- "opus_multistream_encoder.c",
- "http.c",
- "opus_multistream_decoder.c"
- ]
+ thirdparty_sources = [
+ "silk/tables_other.c",
+ "silk/sum_sqr_shift.c",
+ "silk/PLC.c",
+ "silk/dec_API.c",
+ "silk/decode_pulses.c",
+ "silk/inner_prod_aligned.c",
+ "silk/init_encoder.c",
+ "silk/interpolate.c",
+ "silk/stereo_encode_pred.c",
+ "silk/decode_frame.c",
+ "silk/NLSF_del_dec_quant.c",
+ "silk/VAD.c",
+ "silk/resampler_private_AR2.c",
+ "silk/NLSF_unpack.c",
+ "silk/resampler_down2.c",
+ "silk/sort.c",
+ "silk/resampler_private_IIR_FIR.c",
+ "silk/resampler_down2_3.c",
+ "silk/resampler_private_up2_HQ.c",
+ "silk/tables_gain.c",
+ "silk/stereo_find_predictor.c",
+ "silk/stereo_quant_pred.c",
+ "silk/NLSF_stabilize.c",
+ "silk/ana_filt_bank_1.c",
+ "silk/check_control_input.c",
+ "silk/bwexpander.c",
+ "silk/A2NLSF.c",
+ "silk/LPC_inv_pred_gain.c",
+ "silk/log2lin.c",
+ "silk/process_NLSFs.c",
+ "silk/sigm_Q15.c",
+ "silk/VQ_WMat_EC.c",
+ "silk/quant_LTP_gains.c",
+ "silk/resampler_private_down_FIR.c",
+ "silk/NLSF_decode.c",
+ "silk/control_codec.c",
+ "silk/NLSF_VQ_weights_laroia.c",
+ "silk/decode_pitch.c",
+ "silk/stereo_decode_pred.c",
+ "silk/tables_pulses_per_block.c",
+ "silk/init_decoder.c",
+ "silk/table_LSF_cos.c",
+ "silk/decode_core.c",
+ "silk/code_signs.c",
+ "silk/enc_API.c",
+ "silk/tables_LTP.c",
+ "silk/pitch_est_tables.c",
+ "silk/biquad_alt.c",
+ "silk/encode_indices.c",
+ "silk/tables_NLSF_CB_WB.c",
+ "silk/debug.c",
+ "silk/decode_parameters.c",
+ "silk/tables_pitch_lag.c",
+ "silk/NLSF2A.c",
+ "silk/resampler.c",
+ "silk/decode_indices.c",
+ "silk/NLSF_VQ.c",
+ "silk/bwexpander_32.c",
+ "silk/tables_NLSF_CB_NB_MB.c",
+ "silk/encode_pulses.c",
+ "silk/NSQ_del_dec.c",
+ "silk/control_SNR.c",
+ "silk/shell_coder.c",
+ "silk/NLSF_encode.c",
+ "silk/stereo_MS_to_LR.c",
+ "silk/stereo_LR_to_MS.c",
+ "silk/HP_variable_cutoff.c",
+ "silk/LPC_analysis_filter.c",
+ "silk/CNG.c",
+ "silk/decoder_set_fs.c",
+ "silk/resampler_rom.c",
+ "silk/control_audio_bandwidth.c",
+ "silk/lin2log.c",
+ "silk/LP_variable_cutoff.c",
+ "silk/NSQ.c",
+ "silk/gain_quant.c",
+ "celt/laplace.c",
+ "celt/vq.c",
+ "celt/quant_bands.c",
+ "celt/kiss_fft.c",
+ "celt/entcode.c",
+ "celt/entenc.c",
+ "celt/celt_lpc.c",
+ "celt/pitch.c",
+ "celt/rate.c",
+ "celt/mathops.c",
+ #"celt/arm/armcpu.c",
+ #"celt/arm/celt_neon_intr.c",
+ #"celt/arm/celt_ne10_mdct.c",
+ #"celt/arm/celt_ne10_fft.c",
+ #"celt/arm/arm_celt_map.c",
+ "celt/celt_encoder.c",
+ "celt/celt.c",
+ "celt/bands.c",
+ "celt/cwrs.c",
+ "celt/entdec.c",
+ "celt/celt_decoder.c",
+ "celt/mdct.c",
+ "celt/modes.c",
+ "repacketizer.c",
+ "mlp_data.c",
+ "opus_multistream.c",
+ "opusfile.c",
+ "opus_encoder.c",
+ "analysis.c",
+ "mlp.c",
+ "info.c",
+ "stream.c",
+ "opus_decoder.c",
+ "internal.c",
+ "wincerts.c",
+ "opus.c",
+ "opus_multistream_encoder.c",
+ "http.c",
+ "opus_multistream_decoder.c"
+ ]
- opus_sources_silk = []
+ opus_sources_silk = []
- if("opus_fixed_point" in env and env.opus_fixed_point=="yes"):
- env_opus.Append(CFLAGS = ["-DFIXED_POINT"])
- opus_sources_silk = [
- "silk/fixed/schur64_FIX.c",
- "silk/fixed/residual_energy16_FIX.c",
- "silk/fixed/encode_frame_FIX.c",
- "silk/fixed/regularize_correlations_FIX.c",
- "silk/fixed/apply_sine_window_FIX.c",
- "silk/fixed/solve_LS_FIX.c",
- "silk/fixed/schur_FIX.c",
- "silk/fixed/pitch_analysis_core_FIX.c",
- "silk/fixed/noise_shape_analysis_FIX.c",
- "silk/fixed/find_LTP_FIX.c",
- "silk/fixed/vector_ops_FIX.c",
- "silk/fixed/autocorr_FIX.c",
- "silk/fixed/warped_autocorrelation_FIX.c",
- "silk/fixed/find_pitch_lags_FIX.c",
- "silk/fixed/k2a_Q16_FIX.c",
- "silk/fixed/LTP_scale_ctrl_FIX.c",
- "silk/fixed/corrMatrix_FIX.c",
- "silk/fixed/prefilter_FIX.c",
- "silk/fixed/find_LPC_FIX.c",
- "silk/fixed/residual_energy_FIX.c",
- "silk/fixed/process_gains_FIX.c",
- "silk/fixed/LTP_analysis_filter_FIX.c",
- "silk/fixed/k2a_FIX.c",
- "silk/fixed/burg_modified_FIX.c",
- "silk/fixed/find_pred_coefs_FIX.c"
- ]
- else:
- opus_sources_silk = [
- "silk/float/LTP_scale_ctrl_FLP.c",
- "silk/float/regularize_correlations_FLP.c",
- "silk/float/corrMatrix_FLP.c",
- "silk/float/LPC_analysis_filter_FLP.c",
- "silk/float/levinsondurbin_FLP.c",
- "silk/float/schur_FLP.c",
- "silk/float/scale_vector_FLP.c",
- "silk/float/apply_sine_window_FLP.c",
- "silk/float/pitch_analysis_core_FLP.c",
- "silk/float/wrappers_FLP.c",
- "silk/float/bwexpander_FLP.c",
- "silk/float/warped_autocorrelation_FLP.c",
- "silk/float/solve_LS_FLP.c",
- "silk/float/find_LPC_FLP.c",
- "silk/float/autocorrelation_FLP.c",
- "silk/float/find_pred_coefs_FLP.c",
- "silk/float/find_pitch_lags_FLP.c",
- "silk/float/burg_modified_FLP.c",
- "silk/float/find_LTP_FLP.c",
- "silk/float/energy_FLP.c",
- "silk/float/sort_FLP.c",
- "silk/float/LPC_inv_pred_gain_FLP.c",
- "silk/float/k2a_FLP.c",
- "silk/float/noise_shape_analysis_FLP.c",
- "silk/float/inner_product_FLP.c",
- "silk/float/process_gains_FLP.c",
- "silk/float/encode_frame_FLP.c",
- "silk/float/scale_copy_vector_FLP.c",
- "silk/float/residual_energy_FLP.c",
- "silk/float/LTP_analysis_filter_FLP.c",
- "silk/float/prefilter_FLP.c"
- ]
+ if("opus_fixed_point" in env and env.opus_fixed_point == "yes"):
+ env_opus.Append(CFLAGS=["-DFIXED_POINT"])
+ opus_sources_silk = [
+ "silk/fixed/schur64_FIX.c",
+ "silk/fixed/residual_energy16_FIX.c",
+ "silk/fixed/encode_frame_FIX.c",
+ "silk/fixed/regularize_correlations_FIX.c",
+ "silk/fixed/apply_sine_window_FIX.c",
+ "silk/fixed/solve_LS_FIX.c",
+ "silk/fixed/schur_FIX.c",
+ "silk/fixed/pitch_analysis_core_FIX.c",
+ "silk/fixed/noise_shape_analysis_FIX.c",
+ "silk/fixed/find_LTP_FIX.c",
+ "silk/fixed/vector_ops_FIX.c",
+ "silk/fixed/autocorr_FIX.c",
+ "silk/fixed/warped_autocorrelation_FIX.c",
+ "silk/fixed/find_pitch_lags_FIX.c",
+ "silk/fixed/k2a_Q16_FIX.c",
+ "silk/fixed/LTP_scale_ctrl_FIX.c",
+ "silk/fixed/corrMatrix_FIX.c",
+ "silk/fixed/prefilter_FIX.c",
+ "silk/fixed/find_LPC_FIX.c",
+ "silk/fixed/residual_energy_FIX.c",
+ "silk/fixed/process_gains_FIX.c",
+ "silk/fixed/LTP_analysis_filter_FIX.c",
+ "silk/fixed/k2a_FIX.c",
+ "silk/fixed/burg_modified_FIX.c",
+ "silk/fixed/find_pred_coefs_FIX.c"
+ ]
+ else:
+ opus_sources_silk = [
+ "silk/float/LTP_scale_ctrl_FLP.c",
+ "silk/float/regularize_correlations_FLP.c",
+ "silk/float/corrMatrix_FLP.c",
+ "silk/float/LPC_analysis_filter_FLP.c",
+ "silk/float/levinsondurbin_FLP.c",
+ "silk/float/schur_FLP.c",
+ "silk/float/scale_vector_FLP.c",
+ "silk/float/apply_sine_window_FLP.c",
+ "silk/float/pitch_analysis_core_FLP.c",
+ "silk/float/wrappers_FLP.c",
+ "silk/float/bwexpander_FLP.c",
+ "silk/float/warped_autocorrelation_FLP.c",
+ "silk/float/solve_LS_FLP.c",
+ "silk/float/find_LPC_FLP.c",
+ "silk/float/autocorrelation_FLP.c",
+ "silk/float/find_pred_coefs_FLP.c",
+ "silk/float/find_pitch_lags_FLP.c",
+ "silk/float/burg_modified_FLP.c",
+ "silk/float/find_LTP_FLP.c",
+ "silk/float/energy_FLP.c",
+ "silk/float/sort_FLP.c",
+ "silk/float/LPC_inv_pred_gain_FLP.c",
+ "silk/float/k2a_FLP.c",
+ "silk/float/noise_shape_analysis_FLP.c",
+ "silk/float/inner_product_FLP.c",
+ "silk/float/process_gains_FLP.c",
+ "silk/float/encode_frame_FLP.c",
+ "silk/float/scale_copy_vector_FLP.c",
+ "silk/float/residual_energy_FLP.c",
+ "silk/float/LTP_analysis_filter_FLP.c",
+ "silk/float/prefilter_FLP.c"
+ ]
- thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources + opus_sources_silk]
+ thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources + opus_sources_silk]
- env_opus.add_source_files(env.modules_sources, thirdparty_sources)
- env_opus.Append(CFLAGS=["-DHAVE_CONFIG_H"])
+ env_opus.add_source_files(env.modules_sources, thirdparty_sources)
+ env_opus.Append(CFLAGS=["-DHAVE_CONFIG_H"])
- thirdparty_include_paths = [
- "",
- "celt",
- "silk",
- "silk/fixed",
- "silk/float",
- ]
- env_opus.Append(CPPPATH = [thirdparty_dir + "/" + dir for dir in thirdparty_include_paths])
+ thirdparty_include_paths = [
+ "",
+ "celt",
+ "opus",
+ "silk",
+ "silk/fixed",
+ "silk/float",
+ ]
+ env_opus.Append(CPPPATH=[thirdparty_dir + "/" + dir for dir in thirdparty_include_paths])
- # also requires libogg
- if (env["libogg"] != "system"): # builtin
- env_opus.Append(CPPPATH = ["#thirdparty/libogg"])
+ # also requires libogg
+ if (env['builtin_libogg'] != 'no'):
+ env_opus.Append(CPPPATH=["#thirdparty/libogg"])
# Module files
env_opus.add_source_files(env.modules_sources, "*.cpp")
diff --git a/modules/opus/audio_stream_opus.cpp b/modules/opus/audio_stream_opus.cpp
index ab53fee0c9..4a6b2e224c 100644
--- a/modules/opus/audio_stream_opus.cpp
+++ b/modules/opus/audio_stream_opus.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* */
/* Author: George Marques <george@gmarqu.es> */
/* */
@@ -366,7 +366,7 @@ void ResourceFormatLoaderAudioStreamOpus::get_recognized_extensions(List<String>
}
String ResourceFormatLoaderAudioStreamOpus::get_resource_type(const String &p_path) const {
- if (p_path.extension().to_lower()=="opus")
+ if (p_path.get_extension().to_lower()=="opus")
return "AudioStreamOpus";
return "";
}
diff --git a/modules/opus/audio_stream_opus.h b/modules/opus/audio_stream_opus.h
index 4da66fe167..5093456ccd 100644
--- a/modules/opus/audio_stream_opus.h
+++ b/modules/opus/audio_stream_opus.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* */
/* Author: George Marques <george@gmarqu.es> */
/* */
@@ -36,11 +36,11 @@
#include "os/file_access.h"
#include "scene/resources/audio_stream.h"
-#include <opusfile.h>
+#include <opus/opusfile.h>
class AudioStreamPlaybackOpus : public AudioStreamPlayback {
- OBJ_TYPE(AudioStreamPlaybackOpus,AudioStreamPlayback)
+ GDCLASS(AudioStreamPlaybackOpus,AudioStreamPlayback)
enum {
MIN_MIX=1024
@@ -115,7 +115,7 @@ public:
class AudioStreamOpus: public AudioStream {
- OBJ_TYPE(AudioStreamOpus,AudioStream)
+ GDCLASS(AudioStreamOpus,AudioStream)
String file;
public:
diff --git a/modules/opus/config.py b/modules/opus/config.py
index 368e97e152..ef5daca05c 100644
--- a/modules/opus/config.py
+++ b/modules/opus/config.py
@@ -1,6 +1,8 @@
def can_build(platform):
- return True
+# return True
+ return False
+
def configure(env):
- pass
+ pass
diff --git a/modules/opus/register_types.cpp b/modules/opus/register_types.cpp
index a4d71a52c7..a177bc9463 100644
--- a/modules/opus/register_types.cpp
+++ b/modules/opus/register_types.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* 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 */
@@ -36,7 +36,7 @@ void register_opus_types() {
opus_stream_loader = memnew( ResourceFormatLoaderAudioStreamOpus );
ResourceLoader::add_resource_format_loader(opus_stream_loader);
- ObjectTypeDB::register_type<AudioStreamOpus>();
+ ClassDB::register_class<AudioStreamOpus>();
}
void unregister_opus_types() {
diff --git a/modules/opus/register_types.h b/modules/opus/register_types.h
index f4386c373a..09181b4f03 100644
--- a/modules/opus/register_types.h
+++ b/modules/opus/register_types.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* 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 */
diff --git a/modules/pbm/bitmap_loader_pbm.cpp b/modules/pbm/bitmap_loader_pbm.cpp
index 1d08b10824..ab0805a6b0 100644
--- a/modules/pbm/bitmap_loader_pbm.cpp
+++ b/modules/pbm/bitmap_loader_pbm.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* 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 */
@@ -31,11 +31,11 @@
#include "scene/resources/bit_mask.h"
-static bool _get_token(FileAccessRef& f,uint8_t &saved,DVector<uint8_t>& r_token,bool p_binary=false,bool p_single_chunk=false) {
+static bool _get_token(FileAccessRef& f,uint8_t &saved,PoolVector<uint8_t>& r_token,bool p_binary=false,bool p_single_chunk=false) {
int token_max = r_token.size();
- DVector<uint8_t>::Write w;
+ PoolVector<uint8_t>::Write w;
if (token_max)
w=r_token.write();
int ofs=0;
@@ -53,7 +53,7 @@ static bool _get_token(FileAccessRef& f,uint8_t &saved,DVector<uint8_t>& r_token
}
if (f->eof_reached()) {
if (ofs) {
- w=DVector<uint8_t>::Write();
+ w=PoolVector<uint8_t>::Write();
r_token.resize(ofs);
return true;
} else {
@@ -81,7 +81,7 @@ static bool _get_token(FileAccessRef& f,uint8_t &saved,DVector<uint8_t>& r_token
if (ofs && !p_single_chunk) {
- w=DVector<uint8_t>::Write();
+ w=PoolVector<uint8_t>::Write();
r_token.resize(ofs);
saved=b;
@@ -98,7 +98,7 @@ static bool _get_token(FileAccessRef& f,uint8_t &saved,DVector<uint8_t>& r_token
resized=true;
}
if (resized) {
- w=DVector<uint8_t>::Write();
+ w=PoolVector<uint8_t>::Write();
r_token.resize(token_max);
w=r_token.write();
}
@@ -109,10 +109,10 @@ static bool _get_token(FileAccessRef& f,uint8_t &saved,DVector<uint8_t>& r_token
return false;
}
-static int _get_number_from_token(DVector<uint8_t>& r_token) {
+static int _get_number_from_token(PoolVector<uint8_t>& r_token) {
int len = r_token.size();
- DVector<uint8_t>::Read r = r_token.read();
+ PoolVector<uint8_t>::Read r = r_token.read();
return String::to_int((const char*)r.ptr(),len);
}
@@ -133,7 +133,7 @@ RES ResourceFormatPBM::load(const String &p_path,const String& p_original_path,E
if (!f)
_RETURN(ERR_CANT_OPEN);
- DVector<uint8_t> token;
+ PoolVector<uint8_t> token;
if (!_get_token(f,saved,token)) {
_RETURN(ERR_PARSE_ERROR);
@@ -186,7 +186,7 @@ RES ResourceFormatPBM::load(const String &p_path,const String& p_original_path,E
_RETURN(ERR_FILE_CORRUPT);
}
- DVector<uint8_t>::Read r=token.read();
+ PoolVector<uint8_t>::Read r=token.read();
for(int i=0;i<height;i++) {
for(int j=0;j<width;j++) {
@@ -210,7 +210,7 @@ RES ResourceFormatPBM::load(const String &p_path,const String& p_original_path,E
_RETURN(ERR_FILE_CORRUPT);
}
- DVector<uint8_t>::Read r=token.read();
+ PoolVector<uint8_t>::Read r=token.read();
int bitwidth = width;
if (bitwidth % 8)
bitwidth+=8-(bitwidth%8);
@@ -244,7 +244,7 @@ bool ResourceFormatPBM::handles_type(const String& p_type) const {
}
String ResourceFormatPBM::get_resource_type(const String &p_path) const {
- if (p_path.extension().to_lower()=="pbm")
+ if (p_path.get_extension().to_lower()=="pbm")
return "BitMap";
return "";
}
diff --git a/modules/pbm/bitmap_loader_pbm.h b/modules/pbm/bitmap_loader_pbm.h
index 4f7144b3e0..b60b38fcca 100644
--- a/modules/pbm/bitmap_loader_pbm.h
+++ b/modules/pbm/bitmap_loader_pbm.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* 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 */
diff --git a/modules/pbm/config.py b/modules/pbm/config.py
index 368e97e152..fb920482f5 100644
--- a/modules/pbm/config.py
+++ b/modules/pbm/config.py
@@ -1,6 +1,7 @@
def can_build(platform):
- return True
+ return True
+
def configure(env):
- pass
+ pass
diff --git a/modules/pbm/register_types.cpp b/modules/pbm/register_types.cpp
index 181083773a..0dd39ce1e4 100644
--- a/modules/pbm/register_types.cpp
+++ b/modules/pbm/register_types.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* 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 */
diff --git a/modules/pbm/register_types.h b/modules/pbm/register_types.h
index 20c8133c2c..c9a125083d 100644
--- a/modules/pbm/register_types.h
+++ b/modules/pbm/register_types.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* 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 */
diff --git a/modules/pvr/SCsub b/modules/pvr/SCsub
index 4ead52f82f..ddca7a794e 100644
--- a/modules/pvr/SCsub
+++ b/modules/pvr/SCsub
@@ -9,16 +9,16 @@ env_pvr = env_modules.Clone()
# Not unbundled so far since not widespread as shared library
thirdparty_dir = "#thirdparty/pvrtccompressor/"
thirdparty_sources = [
- "BitScale.cpp",
- "MortonTable.cpp",
- "PvrTcDecoder.cpp",
- "PvrTcEncoder.cpp",
- "PvrTcPacket.cpp",
+ "BitScale.cpp",
+ "MortonTable.cpp",
+ "PvrTcDecoder.cpp",
+ "PvrTcEncoder.cpp",
+ "PvrTcPacket.cpp",
]
thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
env_pvr.add_source_files(env.modules_sources, thirdparty_sources)
-env_pvr.Append(CPPPATH = [thirdparty_dir])
+env_pvr.Append(CPPPATH=[thirdparty_dir])
# Godot source files
env_pvr.add_source_files(env.modules_sources, "*.cpp")
diff --git a/modules/pvr/config.py b/modules/pvr/config.py
index 368e97e152..fb920482f5 100644
--- a/modules/pvr/config.py
+++ b/modules/pvr/config.py
@@ -1,6 +1,7 @@
def can_build(platform):
- return True
+ return True
+
def configure(env):
- pass
+ pass
diff --git a/modules/pvr/register_types.cpp b/modules/pvr/register_types.cpp
index e5e18fb3d1..2464e78984 100644
--- a/modules/pvr/register_types.cpp
+++ b/modules/pvr/register_types.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* 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 */
diff --git a/modules/pvr/register_types.h b/modules/pvr/register_types.h
index d600f54d51..ac2ab748df 100644
--- a/modules/pvr/register_types.h
+++ b/modules/pvr/register_types.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* 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 */
diff --git a/modules/pvr/texture_loader_pvr.cpp b/modules/pvr/texture_loader_pvr.cpp
index 3ab3240512..9805675f2c 100644
--- a/modules/pvr/texture_loader_pvr.cpp
+++ b/modules/pvr/texture_loader_pvr.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* 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 */
@@ -99,13 +99,13 @@ RES ResourceFormatPVR::load(const String &p_path,const String& p_original_path,E
print_line("surfcount: "+itos(surfcount));
*/
- DVector<uint8_t> data;
+ PoolVector<uint8_t> data;
data.resize(surfsize);
ERR_FAIL_COND_V(data.size()==0,RES());
- DVector<uint8_t>::Write w = data.write();
+ PoolVector<uint8_t>::Write w = data.write();
f->get_buffer(&w[0],surfsize);
err = f->get_error();
ERR_FAIL_COND_V(err!=OK,RES());
@@ -116,33 +116,33 @@ RES ResourceFormatPVR::load(const String &p_path,const String& p_original_path,E
switch(flags&0xFF) {
case 0x18:
- case 0xC: format=(flags&PVR_HAS_ALPHA)?Image::FORMAT_PVRTC2_ALPHA:Image::FORMAT_PVRTC2; break;
+ case 0xC: format=(flags&PVR_HAS_ALPHA)?Image::FORMAT_PVRTC2A:Image::FORMAT_PVRTC2; break;
case 0x19:
- case 0xD: format=(flags&PVR_HAS_ALPHA)?Image::FORMAT_PVRTC4_ALPHA:Image::FORMAT_PVRTC4; break;
+ case 0xD: format=(flags&PVR_HAS_ALPHA)?Image::FORMAT_PVRTC4A:Image::FORMAT_PVRTC4; break;
case 0x16:
- format=Image::FORMAT_GRAYSCALE; break;
+ format=Image::FORMAT_L8; break;
case 0x17:
- format=Image::FORMAT_GRAYSCALE_ALPHA; break;
+ format=Image::FORMAT_LA8; break;
case 0x20:
case 0x80:
case 0x81:
- format=Image::FORMAT_BC1; break;
+ format=Image::FORMAT_DXT1; break;
case 0x21:
case 0x22:
case 0x82:
case 0x83:
- format=Image::FORMAT_BC2; break;
+ format=Image::FORMAT_DXT3; break;
case 0x23:
case 0x24:
case 0x84:
case 0x85:
- format=Image::FORMAT_BC3; break;
+ format=Image::FORMAT_DXT5; break;
case 0x4:
case 0x15:
- format=Image::FORMAT_RGB; break;
+ format=Image::FORMAT_RGB8; break;
case 0x5:
case 0x12:
- format=Image::FORMAT_RGBA; break;
+ format=Image::FORMAT_RGBA8; break;
case 0x36:
format=Image::FORMAT_ETC; break;
default:
@@ -151,7 +151,7 @@ RES ResourceFormatPVR::load(const String &p_path,const String& p_original_path,E
}
- w = DVector<uint8_t>::Write();
+ w = PoolVector<uint8_t>::Write();
int tex_flags=Texture::FLAG_FILTER|Texture::FLAG_REPEAT;
@@ -180,12 +180,12 @@ void ResourceFormatPVR::get_recognized_extensions(List<String> *p_extensions) co
}
bool ResourceFormatPVR::handles_type(const String& p_type) const {
- return ObjectTypeDB::is_type(p_type,"Texture");
+ return ClassDB::is_parent_class(p_type,"Texture");
}
String ResourceFormatPVR::get_resource_type(const String &p_path) const {
- if (p_path.extension().to_lower()=="pvr")
+ if (p_path.get_extension().to_lower()=="pvr")
return "Texture";
return "";
}
@@ -198,24 +198,24 @@ static void _compress_pvrtc4(Image * p_img) {
bool make_mipmaps=false;
if (img.get_width()%8 || img.get_height()%8) {
- make_mipmaps=img.get_mipmaps()>0;
+ make_mipmaps=img.has_mipmaps();
img.resize(img.get_width()+(8-(img.get_width()%8)),img.get_height()+(8-(img.get_height()%8)));
}
- img.convert(Image::FORMAT_RGBA);
- if (img.get_mipmaps()==0 && make_mipmaps)
+ img.convert(Image::FORMAT_RGBA8);
+ if (!img.has_mipmaps() && make_mipmaps)
img.generate_mipmaps();
bool use_alpha=img.detect_alpha();
Image new_img;
- new_img.create(img.get_width(),img.get_height(),true,use_alpha?Image::FORMAT_PVRTC4_ALPHA:Image::FORMAT_PVRTC4);
- DVector<uint8_t> data=new_img.get_data();
+ new_img.create(img.get_width(),img.get_height(),true,use_alpha?Image::FORMAT_PVRTC4A:Image::FORMAT_PVRTC4);
+ PoolVector<uint8_t> data=new_img.get_data();
{
- DVector<uint8_t>::Write wr=data.write();
- DVector<uint8_t>::Read r=img.get_data().read();
+ PoolVector<uint8_t>::Write wr=data.write();
+ PoolVector<uint8_t>::Read r=img.get_data().read();
- for(int i=0;i<=new_img.get_mipmaps();i++) {
+ for(int i=0;i<=new_img.get_mipmap_count();i++) {
int ofs,size,w,h;
img.get_mipmap_offset_size_and_dimensions(i,ofs,size,w,h);
@@ -234,7 +234,7 @@ static void _compress_pvrtc4(Image * p_img) {
}
- *p_img = Image(new_img.get_width(),new_img.get_height(),new_img.get_mipmaps(),new_img.get_format(),data);
+ *p_img = Image(new_img.get_width(),new_img.get_height(),new_img.has_mipmaps(),new_img.get_format(),data);
}
@@ -464,16 +464,19 @@ static void get_modulation_value(int x, int y, const int p_2bit, const int p_mod
if(((x^y)&1)==0)
mod_val = rep_vals0[p_modulation[y][x]];
else if(p_modulation_modes[y][x] == 1) {
- mod_val = (rep_vals0[p_modulation[y-1][x]] +
- rep_vals0[p_modulation[y+1][x]] +
- rep_vals0[p_modulation[y][x-1]] +
- rep_vals0[p_modulation[y][x+1]] + 2) / 4;
+ mod_val = (
+ rep_vals0[p_modulation[y-1][x]] +
+ rep_vals0[p_modulation[y+1][x]] +
+ rep_vals0[p_modulation[y][x-1]] +
+ rep_vals0[p_modulation[y][x+1]] + 2) / 4;
} else if(p_modulation_modes[y][x] == 2) {
- mod_val = (rep_vals0[p_modulation[y][x-1]] +
- rep_vals0[p_modulation[y][x+1]] + 1) / 2;
+ mod_val = (
+ rep_vals0[p_modulation[y][x-1]] +
+ rep_vals0[p_modulation[y][x+1]] + 1) / 2;
} else {
- mod_val = (rep_vals0[p_modulation[y-1][x]] +
- rep_vals0[p_modulation[y+1][x]] + 1) / 2;
+ mod_val = (
+ rep_vals0[p_modulation[y-1][x]] +
+ rep_vals0[p_modulation[y+1][x]] + 1) / 2;
}
} else {
mod_val = rep_vals1[p_modulation[y][x]];
@@ -615,11 +618,12 @@ static void decompress_pvrtc(PVRTCBlock *p_comp_img, const int p_2bit, const int
for(j = 0; j < 2; j++) {
unpack_5554(p_blocks[i][j], colors5554[i][j].Reps);
- unpack_modulations(p_blocks[i][j],
- p_2bit,
- p_modulation,
- p_modulation_modes,
- p_x, p_y);
+ unpack_modulations(
+ p_blocks[i][j],
+ p_2bit,
+ p_modulation,
+ p_modulation_modes,
+ p_x, p_y);
p_x += x_block_size;
}
@@ -632,19 +636,21 @@ static void decompress_pvrtc(PVRTCBlock *p_comp_img, const int p_2bit, const int
}
- interpolate_colors(colors5554[0][0].Reps[0],
- colors5554[0][1].Reps[0],
- colors5554[1][0].Reps[0],
- colors5554[1][1].Reps[0],
- p_2bit, x, y,
- ASig);
+ interpolate_colors(
+ colors5554[0][0].Reps[0],
+ colors5554[0][1].Reps[0],
+ colors5554[1][0].Reps[0],
+ colors5554[1][1].Reps[0],
+ p_2bit, x, y,
+ ASig);
- interpolate_colors(colors5554[0][0].Reps[1],
- colors5554[0][1].Reps[1],
- colors5554[1][0].Reps[1],
- colors5554[1][1].Reps[1],
- p_2bit, x, y,
- BSig);
+ interpolate_colors(
+ colors5554[0][0].Reps[1],
+ colors5554[0][1].Reps[1],
+ colors5554[1][0].Reps[1],
+ colors5554[1][1].Reps[1],
+ p_2bit, x, y,
+ BSig);
get_modulation_value(x,y, p_2bit, (const int (*)[16])p_modulation, (const int (*)[16])p_modulation_modes,
&Mod, &DoPT);
@@ -669,33 +675,37 @@ static void decompress_pvrtc(PVRTCBlock *p_comp_img, const int p_2bit, const int
static void _pvrtc_decompress(Image* p_img) {
-// static void decompress_pvrtc(const void *p_comp_img, const int p_2bit, const int p_width, const int p_height, unsigned char* p_dst) {
-// decompress_pvrtc((PVRTCBlock*)p_comp_img,p_2bit,p_width,p_height,1,p_dst);
-// }
+ /*
+ static void decompress_pvrtc(const void *p_comp_img, const int p_2bit, const int p_width, const int p_height, unsigned char* p_dst) {
+ decompress_pvrtc((PVRTCBlock*)p_comp_img,p_2bit,p_width,p_height,1,p_dst);
+ }
+ */
- ERR_FAIL_COND( p_img->get_format()!=Image::FORMAT_PVRTC2 && p_img->get_format()!=Image::FORMAT_PVRTC2_ALPHA && p_img->get_format()!=Image::FORMAT_PVRTC4 && p_img->get_format()!=Image::FORMAT_PVRTC4_ALPHA);
+ ERR_FAIL_COND( p_img->get_format()!=Image::FORMAT_PVRTC2 && p_img->get_format()!=Image::FORMAT_PVRTC2A && p_img->get_format()!=Image::FORMAT_PVRTC4 && p_img->get_format()!=Image::FORMAT_PVRTC4A);
- bool _2bit = (p_img->get_format()==Image::FORMAT_PVRTC2 || p_img->get_format()==Image::FORMAT_PVRTC2_ALPHA );
+ bool _2bit = (p_img->get_format()==Image::FORMAT_PVRTC2 || p_img->get_format()==Image::FORMAT_PVRTC2A );
- DVector<uint8_t> data = p_img->get_data();
- DVector<uint8_t>::Read r = data.read();
+ PoolVector<uint8_t> data = p_img->get_data();
+ PoolVector<uint8_t>::Read r = data.read();
- DVector<uint8_t> newdata;
+ PoolVector<uint8_t> newdata;
newdata.resize( p_img->get_width() * p_img->get_height() * 4);
- DVector<uint8_t>::Write w=newdata.write();
+ PoolVector<uint8_t>::Write w=newdata.write();
decompress_pvrtc((PVRTCBlock*)r.ptr(),_2bit,p_img->get_width(),p_img->get_height(),0,(unsigned char*)w.ptr());
- //for(int i=0;i<newdata.size();i++) {
- // print_line(itos(w[i]));
- //}
+ /*
+ for(int i=0;i<newdata.size();i++) {
+ print_line(itos(w[i]));
+ }
+ */
- w=DVector<uint8_t>::Write();
- r=DVector<uint8_t>::Read();
+ w=PoolVector<uint8_t>::Write();
+ r=PoolVector<uint8_t>::Read();
- bool make_mipmaps=p_img->get_mipmaps()>0;
- Image newimg(p_img->get_width(),p_img->get_height(),0,Image::FORMAT_RGBA,newdata);
+ bool make_mipmaps=p_img->has_mipmaps();
+ Image newimg(p_img->get_width(),p_img->get_height(),false,Image::FORMAT_RGBA8,newdata);
if (make_mipmaps)
newimg.generate_mipmaps();
*p_img=newimg;
diff --git a/modules/pvr/texture_loader_pvr.h b/modules/pvr/texture_loader_pvr.h
index 5efb3b2507..bad48b4569 100644
--- a/modules/pvr/texture_loader_pvr.h
+++ b/modules/pvr/texture_loader_pvr.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* 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 */
diff --git a/modules/regex/config.py b/modules/regex/config.py
index 667b5d8ba6..5347cfd243 100644
--- a/modules/regex/config.py
+++ b/modules/regex/config.py
@@ -1,8 +1,9 @@
#!/usr/bin/env python
+
def can_build(platform):
return True
+
def configure(env):
pass
-
diff --git a/modules/regex/regex.cpp b/modules/regex/regex.cpp
index a0f4b4934c..e67040b5a3 100644
--- a/modules/regex/regex.cpp
+++ b/modules/regex/regex.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* 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 */
@@ -97,6 +97,9 @@ struct RegExNode {
memdelete(next);
}
+ // For avoiding RTTI
+ virtual bool is_look_behind() { return false; }
+
virtual int test(RegExSearch& s, int pos) const {
return next ? next->test(s, pos) : -1;
@@ -750,6 +753,8 @@ struct RegExNodeLookBehind : public RegExNodeGroup {
reset_pos = true;
}
+ virtual bool is_look_behind() { return true; }
+
virtual int test(RegExSearch& s, int pos) const {
if (pos < length)
@@ -1089,7 +1094,7 @@ Error RegEx::compile(const String& p_pattern) {
REGEX_COMPILE_FAIL("backreference not found");
for (int i = 0; i < stack.size(); ++i)
- if (dynamic_cast<RegExNodeLookBehind*>(stack[i]))
+ if (stack[i]->is_look_behind())
REGEX_COMPILE_FAIL("backreferences inside lookbehind not supported");
for (int i = 0; i < group_names.size(); ++i) {
@@ -1112,7 +1117,7 @@ Error RegEx::compile(const String& p_pattern) {
c = d;
for (int i = 0; i < stack.size(); ++i)
- if (dynamic_cast<RegExNodeLookBehind*>(stack[i]))
+ if (stack[i]->is_look_behind())
REGEX_COMPILE_FAIL("backreferences inside lookbehind not supported");
int ref = -1;
@@ -1238,7 +1243,7 @@ Error RegEx::compile(const String& p_pattern) {
break;
case '|':
for (int i = 0; i < stack.size(); ++i)
- if (dynamic_cast<RegExNodeLookBehind*>(stack[i]))
+ if (stack[i]->is_look_behind())
REGEX_COMPILE_FAIL("alternations inside lookbehind not supported");
stack[0]->add_childset();
break;
@@ -1312,7 +1317,7 @@ Error RegEx::compile(const String& p_pattern) {
if (min_val != max_val)
for (int i = 0; i < stack.size(); ++i)
- if (dynamic_cast<RegExNodeLookBehind*>(stack[i]))
+ if (stack[i]->is_look_behind())
REGEX_COMPILE_FAIL("variable length quantifiers inside lookbehind not supported");
RegExNodeQuantifier* quant = memnew(RegExNodeQuantifier(min_val, max_val));
@@ -1476,26 +1481,26 @@ RegEx::~RegEx() {
void RegExMatch::_bind_methods() {
- ObjectTypeDB::bind_method(_MD("expand","template"),&RegExMatch::expand);
- ObjectTypeDB::bind_method(_MD("get_group_count"),&RegExMatch::get_group_count);
- ObjectTypeDB::bind_method(_MD("get_group_array"),&RegExMatch::get_group_array);
- ObjectTypeDB::bind_method(_MD("get_names"),&RegExMatch::get_names);
- ObjectTypeDB::bind_method(_MD("get_name_dict"),&RegExMatch::get_name_dict);
- ObjectTypeDB::bind_method(_MD("get_string","name"),&RegExMatch::get_string, DEFVAL(0));
- ObjectTypeDB::bind_method(_MD("get_start","name"),&RegExMatch::get_start, DEFVAL(0));
- ObjectTypeDB::bind_method(_MD("get_end","name"),&RegExMatch::get_end, DEFVAL(0));
+ ClassDB::bind_method(_MD("expand","template"),&RegExMatch::expand);
+ ClassDB::bind_method(_MD("get_group_count"),&RegExMatch::get_group_count);
+ ClassDB::bind_method(_MD("get_group_array"),&RegExMatch::get_group_array);
+ ClassDB::bind_method(_MD("get_names"),&RegExMatch::get_names);
+ ClassDB::bind_method(_MD("get_name_dict"),&RegExMatch::get_name_dict);
+ ClassDB::bind_method(_MD("get_string","name"),&RegExMatch::get_string, DEFVAL(0));
+ ClassDB::bind_method(_MD("get_start","name"),&RegExMatch::get_start, DEFVAL(0));
+ ClassDB::bind_method(_MD("get_end","name"),&RegExMatch::get_end, DEFVAL(0));
}
void RegEx::_bind_methods() {
- ObjectTypeDB::bind_method(_MD("clear"),&RegEx::clear);
- ObjectTypeDB::bind_method(_MD("compile","pattern"),&RegEx::compile);
- ObjectTypeDB::bind_method(_MD("search","text","start","end"),&RegEx::search, DEFVAL(0), DEFVAL(-1));
- ObjectTypeDB::bind_method(_MD("sub","text","replacement","all","start","end"),&RegEx::sub, DEFVAL(false), DEFVAL(0), DEFVAL(-1));
- ObjectTypeDB::bind_method(_MD("is_valid"),&RegEx::is_valid);
- ObjectTypeDB::bind_method(_MD("get_pattern"),&RegEx::get_pattern);
- ObjectTypeDB::bind_method(_MD("get_group_count"),&RegEx::get_group_count);
- ObjectTypeDB::bind_method(_MD("get_names"),&RegEx::get_names);
+ ClassDB::bind_method(_MD("clear"),&RegEx::clear);
+ ClassDB::bind_method(_MD("compile","pattern"),&RegEx::compile);
+ ClassDB::bind_method(_MD("search","text","start","end"),&RegEx::search, DEFVAL(0), DEFVAL(-1));
+ ClassDB::bind_method(_MD("sub","text","replacement","all","start","end"),&RegEx::sub, DEFVAL(false), DEFVAL(0), DEFVAL(-1));
+ ClassDB::bind_method(_MD("is_valid"),&RegEx::is_valid);
+ ClassDB::bind_method(_MD("get_pattern"),&RegEx::get_pattern);
+ ClassDB::bind_method(_MD("get_group_count"),&RegEx::get_group_count);
+ ClassDB::bind_method(_MD("get_names"),&RegEx::get_names);
ADD_PROPERTY(PropertyInfo(Variant::STRING, "pattern"), _SCS("compile"), _SCS("get_pattern"));
}
diff --git a/modules/regex/regex.h b/modules/regex/regex.h
index 803aa72b3f..193d818da3 100644
--- a/modules/regex/regex.h
+++ b/modules/regex/regex.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* 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 */
@@ -40,7 +40,7 @@ class RegExNode;
class RegExMatch : public Reference {
- OBJ_TYPE(RegExMatch, Reference);
+ GDCLASS(RegExMatch, Reference);
struct Group {
Variant name;
@@ -80,7 +80,7 @@ public:
class RegEx : public Resource {
- OBJ_TYPE(RegEx, Resource);
+ GDCLASS(RegEx, Resource);
RegExNode* root;
Vector<Variant> group_names;
diff --git a/modules/regex/register_types.cpp b/modules/regex/register_types.cpp
index 050cf3efff..c62a04d80f 100644
--- a/modules/regex/register_types.cpp
+++ b/modules/regex/register_types.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* 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 */
@@ -28,13 +28,13 @@
/*************************************************************************/
#include "register_types.h"
-#include "object_type_db.h"
+#include "class_db.h"
#include "regex.h"
void register_regex_types() {
- ObjectTypeDB::register_type<RegExMatch>();
- ObjectTypeDB::register_type<RegEx>();
+ ClassDB::register_class<RegExMatch>();
+ ClassDB::register_class<RegEx>();
}
void unregister_regex_types() {
diff --git a/modules/regex/register_types.h b/modules/regex/register_types.h
index df3b508e14..5d676b6daa 100644
--- a/modules/regex/register_types.h
+++ b/modules/regex/register_types.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* 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 */
diff --git a/modules/register_module_types.h b/modules/register_module_types.h
index 683ce7c6b8..7d9a130ea1 100644
--- a/modules/register_module_types.h
+++ b/modules/register_module_types.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* 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 */
diff --git a/modules/squish/SCsub b/modules/squish/SCsub
index 3fdc587652..cca7c038f1 100644
--- a/modules/squish/SCsub
+++ b/modules/squish/SCsub
@@ -6,24 +6,24 @@ Import('env_modules')
env_squish = env_modules.Clone()
# Thirdparty source files
-if (env["squish"] != "system"): # builtin
- thirdparty_dir = "#thirdparty/squish/"
- thirdparty_sources = [
- "alpha.cpp",
- "clusterfit.cpp",
- "colourblock.cpp",
- "colourfit.cpp",
- "colourset.cpp",
- "maths.cpp",
- "rangefit.cpp",
- "singlecolourfit.cpp",
- "squish.cpp",
- ]
+if (env['builtin_squish'] != 'no'):
+ thirdparty_dir = "#thirdparty/squish/"
+ thirdparty_sources = [
+ "alpha.cpp",
+ "clusterfit.cpp",
+ "colourblock.cpp",
+ "colourfit.cpp",
+ "colourset.cpp",
+ "maths.cpp",
+ "rangefit.cpp",
+ "singlecolourfit.cpp",
+ "squish.cpp",
+ ]
- thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
+ thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
- env_squish.add_source_files(env.modules_sources, thirdparty_sources)
- env_squish.Append(CPPPATH = [thirdparty_dir])
+ env_squish.add_source_files(env.modules_sources, thirdparty_sources)
+ env_squish.Append(CPPPATH=[thirdparty_dir])
# Godot source files
env_squish.add_source_files(env.modules_sources, "*.cpp")
diff --git a/modules/squish/config.py b/modules/squish/config.py
index d28d9c702e..cc8f098010 100644
--- a/modules/squish/config.py
+++ b/modules/squish/config.py
@@ -1,10 +1,11 @@
def can_build(platform):
- return True
+ return True
+
def configure(env):
- # Tools only, disabled for non-tools
- # TODO: Find a cleaner way to achieve that
- if (env["tools"] == "no"):
- env["module_squish_enabled"] = "no"
- env.disabled_modules.append("squish")
+ # Tools only, disabled for non-tools
+ # TODO: Find a cleaner way to achieve that
+ if (env["tools"] == "no"):
+ env["module_squish_enabled"] = "no"
+ env.disabled_modules.append("squish")
diff --git a/modules/squish/image_compress_squish.cpp b/modules/squish/image_compress_squish.cpp
index ac7c935ceb..a48c1f3485 100644
--- a/modules/squish/image_compress_squish.cpp
+++ b/modules/squish/image_compress_squish.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* 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 */
@@ -37,7 +37,7 @@ void image_compress_squish(Image *p_image) {
int w=p_image->get_width();
int h=p_image->get_height();
- if (p_image->get_mipmaps() == 0) {
+ if (!p_image->has_mipmaps() ) {
ERR_FAIL_COND( !w || w % 4 != 0);
ERR_FAIL_COND( !h || h % 4 != 0);
} else {
@@ -45,33 +45,33 @@ void image_compress_squish(Image *p_image) {
ERR_FAIL_COND( !h || h !=nearest_power_of_2(h) );
};
- if (p_image->get_format()>=Image::FORMAT_BC1)
+ if (p_image->get_format()>=Image::FORMAT_DXT1)
return; //do not compress, already compressed
int shift=0;
int squish_comp=squish::kColourRangeFit;
Image::Format target_format;
- if (p_image->get_format()==Image::FORMAT_GRAYSCALE_ALPHA) {
+ if (p_image->get_format()==Image::FORMAT_LA8) {
//compressed normalmap
- target_format = Image::FORMAT_BC3; squish_comp|=squish::kDxt5;;
+ target_format = Image::FORMAT_DXT5; squish_comp|=squish::kDxt5;
} else if (p_image->detect_alpha()!=Image::ALPHA_NONE) {
- target_format = Image::FORMAT_BC2; squish_comp|=squish::kDxt3;;
+ target_format = Image::FORMAT_DXT3; squish_comp|=squish::kDxt3;
} else {
- target_format = Image::FORMAT_BC1; shift=1; squish_comp|=squish::kDxt1;;
+ target_format = Image::FORMAT_DXT1; shift=1; squish_comp|=squish::kDxt1;
}
- p_image->convert(Image::FORMAT_RGBA); //always expects rgba
+ p_image->convert(Image::FORMAT_RGBA8); //always expects rgba
- int mm_count = p_image->get_mipmaps();
+ int mm_count = p_image->get_mipmap_count();
- DVector<uint8_t> data;
+ PoolVector<uint8_t> data;
int target_size = Image::get_image_data_size(w,h,target_format,mm_count);
data.resize(target_size);
- DVector<uint8_t>::Read rb = p_image->get_data().read();
- DVector<uint8_t>::Write wb = data.write();
+ PoolVector<uint8_t>::Read rb = p_image->get_data().read();
+ PoolVector<uint8_t>::Write wb = data.write();
int dst_ofs=0;
@@ -84,9 +84,9 @@ void image_compress_squish(Image *p_image) {
h>>=1;
}
- rb = DVector<uint8_t>::Read();
- wb = DVector<uint8_t>::Write();
+ rb = PoolVector<uint8_t>::Read();
+ wb = PoolVector<uint8_t>::Write();
- p_image->create(p_image->get_width(),p_image->get_height(),p_image->get_mipmaps(),target_format,data);
+ p_image->create(p_image->get_width(),p_image->get_height(),p_image->has_mipmaps(),target_format,data);
}
diff --git a/modules/squish/image_compress_squish.h b/modules/squish/image_compress_squish.h
index 19dd900674..198889402a 100644
--- a/modules/squish/image_compress_squish.h
+++ b/modules/squish/image_compress_squish.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* 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 */
diff --git a/modules/squish/register_types.cpp b/modules/squish/register_types.cpp
index 9e9621eb64..995711c758 100644
--- a/modules/squish/register_types.cpp
+++ b/modules/squish/register_types.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* 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 */
diff --git a/modules/squish/register_types.h b/modules/squish/register_types.h
index bbde6a44bf..0db4301997 100644
--- a/modules/squish/register_types.h
+++ b/modules/squish/register_types.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* 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 */
diff --git a/modules/stb_vorbis/SCsub b/modules/stb_vorbis/SCsub
new file mode 100644
index 0000000000..897d05961c
--- /dev/null
+++ b/modules/stb_vorbis/SCsub
@@ -0,0 +1,10 @@
+#!/usr/bin/env python
+
+Import('env')
+Import('env_modules')
+
+# Thirdparty source files
+
+env_stb_vorbis = env_modules.Clone()
+
+env_stb_vorbis.add_source_files(env.modules_sources, "*.cpp")
diff --git a/modules/stb_vorbis/audio_stream_ogg_vorbis.cpp b/modules/stb_vorbis/audio_stream_ogg_vorbis.cpp
new file mode 100644
index 0000000000..31bf5ac292
--- /dev/null
+++ b/modules/stb_vorbis/audio_stream_ogg_vorbis.cpp
@@ -0,0 +1,236 @@
+
+#include "audio_stream_ogg_vorbis.h"
+#include "thirdparty/stb_vorbis/stb_vorbis.c"
+#include "os/file_access.h"
+
+
+void AudioStreamPlaybackOGGVorbis::_mix_internal(AudioFrame* p_buffer,int p_frames) {
+
+ ERR_FAIL_COND(!active);
+
+ int todo=p_frames;
+
+ while(todo) {
+
+ int mixed = stb_vorbis_get_samples_float_interleaved(ogg_stream,2,(float*)p_buffer,todo*2);
+ todo-=mixed;
+
+ if (todo) {
+ //end of file!
+ if (false) {
+ //loop
+ seek_pos(0);
+ loops++;
+ } else {
+ for(int i=mixed;i<p_frames;i++) {
+ p_buffer[i]=AudioFrame(0,0);
+ }
+ active=false;
+ }
+ }
+ }
+
+
+}
+
+float AudioStreamPlaybackOGGVorbis::get_stream_sampling_rate() {
+
+ return vorbis_stream->sample_rate;
+}
+
+
+void AudioStreamPlaybackOGGVorbis::start(float p_from_pos) {
+
+ seek_pos(p_from_pos);
+ active=true;
+ loops=0;
+ _begin_resample();
+
+
+}
+
+void AudioStreamPlaybackOGGVorbis::stop() {
+
+ active=false;
+}
+bool AudioStreamPlaybackOGGVorbis::is_playing() const {
+
+ return active;
+}
+
+int AudioStreamPlaybackOGGVorbis::get_loop_count() const {
+
+ return loops;
+}
+
+float AudioStreamPlaybackOGGVorbis::get_pos() const {
+
+ return float(frames_mixed)/vorbis_stream->sample_rate;
+}
+void AudioStreamPlaybackOGGVorbis::seek_pos(float p_time) {
+
+ if (!active)
+ return;
+
+ stb_vorbis_seek(ogg_stream, uint32_t(p_time*vorbis_stream->sample_rate));
+}
+
+float AudioStreamPlaybackOGGVorbis::get_length() const {
+
+ return vorbis_stream->length;
+}
+
+AudioStreamPlaybackOGGVorbis::~AudioStreamPlaybackOGGVorbis() {
+ if (ogg_alloc.alloc_buffer) {
+ AudioServer::get_singleton()->audio_data_free(ogg_alloc.alloc_buffer);
+ stb_vorbis_close(ogg_stream);
+ }
+}
+
+Ref<AudioStreamPlayback> AudioStreamOGGVorbis::instance_playback() {
+
+
+
+ Ref<AudioStreamPlaybackOGGVorbis> ovs;
+ printf("instance at %p, data %p\n",this,data);
+
+ ERR_FAIL_COND_V(data==NULL,ovs);
+
+ ovs.instance();
+ ovs->vorbis_stream=Ref<AudioStreamOGGVorbis>(this);
+ ovs->ogg_alloc.alloc_buffer=(char*)AudioServer::get_singleton()->audio_data_alloc(decode_mem_size);
+ ovs->ogg_alloc.alloc_buffer_length_in_bytes=decode_mem_size;
+ ovs->frames_mixed=0;
+ ovs->active=false;
+ ovs->loops=0;
+ int error ;
+ ovs->ogg_stream = stb_vorbis_open_memory( (const unsigned char*)data, data_len, &error, &ovs->ogg_alloc );
+ if (!ovs->ogg_stream) {
+
+ AudioServer::get_singleton()->audio_data_free(ovs->ogg_alloc.alloc_buffer);
+ ovs->ogg_alloc.alloc_buffer=NULL;
+ ERR_FAIL_COND_V(!ovs->ogg_stream,Ref<AudioStreamPlaybackOGGVorbis>());
+ }
+
+ return ovs;
+}
+
+String AudioStreamOGGVorbis::get_stream_name() const {
+
+ return "";//return stream_name;
+}
+
+Error AudioStreamOGGVorbis::setup(const uint8_t *p_data,uint32_t p_data_len) {
+
+
+#define MAX_TEST_MEM (1<<20)
+
+ uint32_t alloc_try=1024;
+ PoolVector<char> alloc_mem;
+ PoolVector<char>::Write w;
+ stb_vorbis * ogg_stream=NULL;
+ stb_vorbis_alloc ogg_alloc;
+
+ while(alloc_try<MAX_TEST_MEM) {
+
+ alloc_mem.resize(alloc_try);
+ w = alloc_mem.write();
+
+ ogg_alloc.alloc_buffer=w.ptr();
+ ogg_alloc.alloc_buffer_length_in_bytes=alloc_try;
+
+ int error;
+ ogg_stream = stb_vorbis_open_memory( (const unsigned char*)p_data, p_data_len, &error, &ogg_alloc );
+
+ if (!ogg_stream && error==VORBIS_outofmem) {
+ w = PoolVector<char>::Write();
+ alloc_try*=2;
+ } else {
+ break;
+ }
+ }
+ ERR_FAIL_COND_V(alloc_try==MAX_TEST_MEM,ERR_OUT_OF_MEMORY);
+ ERR_FAIL_COND_V(ogg_stream==NULL,ERR_FILE_CORRUPT);
+
+ stb_vorbis_info info = stb_vorbis_get_info(ogg_stream);
+
+ channels = info.channels;
+ sample_rate = info.sample_rate;
+ decode_mem_size = alloc_try;
+ //does this work? (it's less mem..)
+ //decode_mem_size = ogg_alloc.alloc_buffer_length_in_bytes + info.setup_memory_required + info.temp_memory_required + info.max_frame_size;
+
+ //print_line("succeded "+itos(ogg_alloc.alloc_buffer_length_in_bytes)+" setup "+itos(info.setup_memory_required)+" setup temp "+itos(info.setup_temp_memory_required)+" temp "+itos(info.temp_memory_required)+" maxframe"+itos(info.max_frame_size));
+
+ length=stb_vorbis_stream_length_in_seconds(ogg_stream);
+ stb_vorbis_close(ogg_stream);
+
+ data = AudioServer::get_singleton()->audio_data_alloc(p_data_len,p_data);
+ data_len=p_data_len;
+
+ printf("create at %p, data %p\n",this,data);
+ return OK;
+}
+
+AudioStreamOGGVorbis::AudioStreamOGGVorbis() {
+
+
+ data=NULL;
+ length=0;
+ sample_rate=1;
+ channels=1;
+ decode_mem_size=0;
+}
+
+
+
+
+RES ResourceFormatLoaderAudioStreamOGGVorbis::load(const String &p_path, const String& p_original_path, Error *r_error) {
+ if (r_error)
+ *r_error=OK;
+
+ FileAccess *f = FileAccess::open(p_path,FileAccess::READ);
+ if (!f) {
+ *r_error=ERR_CANT_OPEN;
+ ERR_FAIL_COND_V(!f,RES());
+ }
+
+ size_t len = f->get_len();
+
+ PoolVector<uint8_t> data;
+ data.resize(len);
+ PoolVector<uint8_t>::Write w = data.write();
+
+ f->get_buffer(w.ptr(),len);
+
+ memdelete(f);
+
+ Ref<AudioStreamOGGVorbis> ogg_stream;
+ ogg_stream.instance();
+
+ Error err = ogg_stream->setup(w.ptr(),len);
+
+ if (err!=OK) {
+ *r_error=err;
+ ogg_stream.unref();
+ ERR_FAIL_V(RES());
+ }
+
+ return ogg_stream;
+}
+
+void ResourceFormatLoaderAudioStreamOGGVorbis::get_recognized_extensions(List<String> *p_extensions) const {
+
+ p_extensions->push_back("ogg");
+}
+String ResourceFormatLoaderAudioStreamOGGVorbis::get_resource_type(const String &p_path) const {
+
+ if (p_path.get_extension().to_lower()=="ogg")
+ return "AudioStreamOGGVorbis";
+ return "";
+}
+
+bool ResourceFormatLoaderAudioStreamOGGVorbis::handles_type(const String& p_type) const {
+ return (p_type=="AudioStream" || p_type=="AudioStreamOGG" || p_type=="AudioStreamOGGVorbis");
+}
+
diff --git a/modules/stb_vorbis/audio_stream_ogg_vorbis.h b/modules/stb_vorbis/audio_stream_ogg_vorbis.h
new file mode 100644
index 0000000000..4555423f85
--- /dev/null
+++ b/modules/stb_vorbis/audio_stream_ogg_vorbis.h
@@ -0,0 +1,84 @@
+#ifndef AUDIO_STREAM_STB_VORBIS_H
+#define AUDIO_STREAM_STB_VORBIS_H
+
+#include "servers/audio/audio_stream.h"
+#include "io/resource_loader.h"
+
+#define STB_VORBIS_HEADER_ONLY
+#include "thirdparty/stb_vorbis/stb_vorbis.c"
+#undef STB_VORBIS_HEADER_ONLY
+
+
+class AudioStreamOGGVorbis;
+
+class AudioStreamPlaybackOGGVorbis : public AudioStreamPlaybackResampled {
+
+ GDCLASS( AudioStreamPlaybackOGGVorbis, AudioStreamPlaybackResampled )
+
+ stb_vorbis * ogg_stream;
+ stb_vorbis_alloc ogg_alloc;
+ uint32_t frames_mixed;
+ bool active;
+ int loops;
+
+friend class AudioStreamOGGVorbis;
+
+ Ref<AudioStreamOGGVorbis> vorbis_stream;
+protected:
+
+ virtual void _mix_internal(AudioFrame* p_buffer, int p_frames);
+ virtual float get_stream_sampling_rate();
+
+public:
+ virtual void start(float p_from_pos=0.0);
+ virtual void stop();
+ virtual bool is_playing() const;
+
+ virtual int get_loop_count() const; //times it looped
+
+ virtual float get_pos() const;
+ virtual void seek_pos(float p_time);
+
+ virtual float get_length() const; //if supported, otherwise return 0
+
+ AudioStreamPlaybackOGGVorbis() { }
+ ~AudioStreamPlaybackOGGVorbis();
+};
+
+class AudioStreamOGGVorbis : public AudioStream {
+
+ GDCLASS( AudioStreamOGGVorbis, AudioStream )
+ OBJ_SAVE_TYPE( AudioStream ) //children are all saved as AudioStream, so they can be exchanged
+
+friend class AudioStreamPlaybackOGGVorbis;
+
+ void *data;
+ uint32_t data_len;
+
+ int decode_mem_size;
+ float sample_rate;
+ int channels;
+ float length;
+
+public:
+
+
+ virtual Ref<AudioStreamPlayback> instance_playback();
+ virtual String get_stream_name() const;
+
+ Error setup(const uint8_t *p_data, uint32_t p_data_len);
+
+ AudioStreamOGGVorbis();
+};
+
+class ResourceFormatLoaderAudioStreamOGGVorbis : public ResourceFormatLoader {
+public:
+ virtual RES load(const String &p_path,const String& p_original_path="",Error *r_error=NULL);
+ virtual void get_recognized_extensions(List<String> *p_extensions) const;
+ virtual bool handles_type(const String& p_type) const;
+ virtual String get_resource_type(const String &p_path) const;
+};
+
+
+
+#endif
diff --git a/modules/chibi/config.py b/modules/stb_vorbis/config.py
index 368e97e152..fb920482f5 100644
--- a/modules/chibi/config.py
+++ b/modules/stb_vorbis/config.py
@@ -1,6 +1,7 @@
def can_build(platform):
- return True
+ return True
+
def configure(env):
- pass
+ pass
diff --git a/modules/mpc/register_types.cpp b/modules/stb_vorbis/register_types.cpp
index f6a1f59dca..143ad6f47e 100644
--- a/modules/mpc/register_types.cpp
+++ b/modules/stb_vorbis/register_types.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* 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 */
@@ -27,19 +27,18 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "register_types.h"
+#include "audio_stream_ogg_vorbis.h"
-#include "audio_stream_mpc.h"
+static ResourceFormatLoaderAudioStreamOGGVorbis *vorbis_stream_loader = NULL;
-static ResourceFormatLoaderAudioStreamMPC* mpc_stream_loader = NULL;
+void register_stb_vorbis_types() {
-void register_mpc_types() {
-
- mpc_stream_loader=memnew( ResourceFormatLoaderAudioStreamMPC );
- ResourceLoader::add_resource_format_loader(mpc_stream_loader);
- ObjectTypeDB::register_type<AudioStreamMPC>();
+ vorbis_stream_loader = memnew( ResourceFormatLoaderAudioStreamOGGVorbis );
+ ResourceLoader::add_resource_format_loader(vorbis_stream_loader);
+ ClassDB::register_class<AudioStreamOGGVorbis>();
}
-void unregister_mpc_types() {
+void unregister_stb_vorbis_types() {
- memdelete( mpc_stream_loader );
+ memdelete( vorbis_stream_loader );
}
diff --git a/modules/mpc/register_types.h b/modules/stb_vorbis/register_types.h
index 3d0661ed62..2824aa9f0c 100644
--- a/modules/mpc/register_types.h
+++ b/modules/stb_vorbis/register_types.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* 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 */
@@ -26,5 +26,5 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-void register_mpc_types();
-void unregister_mpc_types();
+void register_stb_vorbis_types();
+void unregister_stb_vorbis_types();
diff --git a/modules/theora/SCsub b/modules/theora/SCsub
index 22c618fe8b..2de4d29640 100644
--- a/modules/theora/SCsub
+++ b/modules/theora/SCsub
@@ -6,78 +6,78 @@ Import('env_modules')
env_theora = env_modules.Clone()
# Thirdparty source files
-if (env["libtheora"] != "system"): # builtin
- thirdparty_dir = "#thirdparty/libtheora/"
- thirdparty_sources = [
- #"analyze.c",
- #"apiwrapper.c",
- "bitpack.c",
- "cpu.c",
- #"decapiwrapper.c",
- "decinfo.c",
- "decode.c",
- "dequant.c",
- #"encapiwrapper.c",
- #"encfrag.c",
- #"encinfo.c",
- #"encode.c",
- #"encoder_disabled.c",
- #"enquant.c",
- #"fdct.c",
- "fragment.c",
- "huffdec.c",
- #"huffenc.c",
- "idct.c",
- "info.c",
- "internal.c",
- #"mathops.c",
- #"mcenc.c",
- "quant.c",
- #"rate.c",
- "state.c",
- #"tokenize.c",
- ]
+if (env['builtin_libtheora'] != 'no'):
+ thirdparty_dir = "#thirdparty/libtheora/"
+ thirdparty_sources = [
+ #"analyze.c",
+ #"apiwrapper.c",
+ "bitpack.c",
+ "cpu.c",
+ #"decapiwrapper.c",
+ "decinfo.c",
+ "decode.c",
+ "dequant.c",
+ #"encapiwrapper.c",
+ #"encfrag.c",
+ #"encinfo.c",
+ #"encode.c",
+ #"encoder_disabled.c",
+ #"enquant.c",
+ #"fdct.c",
+ "fragment.c",
+ "huffdec.c",
+ #"huffenc.c",
+ "idct.c",
+ "info.c",
+ "internal.c",
+ #"mathops.c",
+ #"mcenc.c",
+ "quant.c",
+ #"rate.c",
+ "state.c",
+ #"tokenize.c",
+ ]
- thirdparty_sources_x86 = [
- #"x86/mmxencfrag.c",
- #"x86/mmxfdct.c",
- "x86/mmxfrag.c",
- "x86/mmxidct.c",
- "x86/mmxstate.c",
- #"x86/sse2fdct.c",
- #"x86/x86enc.c",
- "x86/x86state.c",
- ]
+ thirdparty_sources_x86 = [
+ #"x86/mmxencfrag.c",
+ #"x86/mmxfdct.c",
+ "x86/mmxfrag.c",
+ "x86/mmxidct.c",
+ "x86/mmxstate.c",
+ #"x86/sse2fdct.c",
+ #"x86/x86enc.c",
+ "x86/x86state.c",
+ ]
- thirdparty_sources_x86_vc = [
- #"x86_vc/mmxencfrag.c",
- #"x86_vc/mmxfdct.c",
- "x86_vc/mmxfrag.c",
- "x86_vc/mmxidct.c",
- "x86_vc/mmxstate.c",
- #"x86_vc/x86enc.c",
- "x86_vc/x86state.c",
- ]
+ thirdparty_sources_x86_vc = [
+ #"x86_vc/mmxencfrag.c",
+ #"x86_vc/mmxfdct.c",
+ "x86_vc/mmxfrag.c",
+ "x86_vc/mmxidct.c",
+ "x86_vc/mmxstate.c",
+ #"x86_vc/x86enc.c",
+ "x86_vc/x86state.c",
+ ]
- if (env["x86_libtheora_opt_gcc"]):
- thirdparty_sources += thirdparty_sources_x86
+ if (env["x86_libtheora_opt_gcc"]):
+ thirdparty_sources += thirdparty_sources_x86
- if (env["x86_libtheora_opt_vc"]):
- thirdparty_sources += thirdparty_sources_x86_vc
+ if (env["x86_libtheora_opt_vc"]):
+ thirdparty_sources += thirdparty_sources_x86_vc
- if (env["x86_libtheora_opt_gcc"] or env["x86_libtheora_opt_vc"]):
- env_theora.Append(CCFLAGS = ["-DOC_X86_ASM"])
+ if (env["x86_libtheora_opt_gcc"] or env["x86_libtheora_opt_vc"]):
+ env_theora.Append(CCFLAGS=["-DOC_X86_ASM"])
- thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
+ thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
- env_theora.add_source_files(env.modules_sources, thirdparty_sources)
- env_theora.Append(CPPPATH = [thirdparty_dir])
+ env_theora.add_source_files(env.modules_sources, thirdparty_sources)
+ env_theora.Append(CPPPATH=[thirdparty_dir])
- # also requires libogg and libvorbis
- if (env["libogg"] != "system"): # builtin
- env_theora.Append(CPPPATH = ["#thirdparty/libogg"])
- if (env["libvorbis"] != "system"): # builtin
- env_theora.Append(CPPPATH = ["#thirdparty/libvorbis"])
+ # also requires libogg and libvorbis
+ if (env['builtin_libogg'] != 'no'):
+ env_theora.Append(CPPPATH=["#thirdparty/libogg"])
+ if (env['builtin_libvorbis'] != 'no'):
+ env_theora.Append(CPPPATH=["#thirdparty/libvorbis"])
# Godot source files
env_theora.add_source_files(env.modules_sources, "*.cpp")
diff --git a/modules/theora/config.py b/modules/theora/config.py
index 368e97e152..8eefe81288 100644
--- a/modules/theora/config.py
+++ b/modules/theora/config.py
@@ -1,6 +1,8 @@
def can_build(platform):
- return True
+# return True
+ return False
+
def configure(env):
- pass
+ pass
diff --git a/modules/theora/register_types.cpp b/modules/theora/register_types.cpp
index 282b59b0ec..58f63465c9 100644
--- a/modules/theora/register_types.cpp
+++ b/modules/theora/register_types.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* 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 */
@@ -36,7 +36,7 @@ void register_theora_types() {
theora_stream_loader = memnew( ResourceFormatLoaderVideoStreamTheora );
ResourceLoader::add_resource_format_loader(theora_stream_loader);
- ObjectTypeDB::register_type<VideoStreamTheora>();
+ ClassDB::register_class<VideoStreamTheora>();
}
void unregister_theora_types() {
diff --git a/modules/theora/register_types.h b/modules/theora/register_types.h
index 18bdbf0c4c..582aa785c7 100644
--- a/modules/theora/register_types.h
+++ b/modules/theora/register_types.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* 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 */
diff --git a/modules/theora/video_stream_theora.cpp b/modules/theora/video_stream_theora.cpp
index 3ddfee3a1d..9d2dfc7f56 100644
--- a/modules/theora/video_stream_theora.cpp
+++ b/modules/theora/video_stream_theora.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* 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 */
@@ -81,6 +81,9 @@ void VideoStreamPlaybackTheora::video_write(void){
th_ycbcr_buffer yuv;
th_decode_ycbcr_out(td,yuv);
+ // FIXME: The way stuff is commented out with `//*/` closing comments
+ // sounds very fishy...
+
/*
int y_offset, uv_offset;
y_offset=(ti.pic_x&~1)+yuv[0].stride*(ti.pic_y&~1);
@@ -88,7 +91,7 @@ void VideoStreamPlaybackTheora::video_write(void){
{
int pixels = size.x * size.y;
frame_data.resize(pixels * 4);
- DVector<uint8_t>::Write w = frame_data.write();
+ PoolVector<uint8_t>::Write w = frame_data.write();
char* dst = (char*)w.ptr();
int p = 0;
for (int i=0; i<size.y; i++) {
@@ -103,16 +106,16 @@ void VideoStreamPlaybackTheora::video_write(void){
dst[p++] = 255;
};
}
- format = Image::FORMAT_RGBA;
+ format = Image::FORMAT_RGBA8;
}
- // */
+ //*/
//*
int pitch = 4;
frame_data.resize(size.x * size.y * pitch);
{
- DVector<uint8_t>::Write w = frame_data.write();
+ PoolVector<uint8_t>::Write w = frame_data.write();
char* dst = (char*)w.ptr();
//uv_offset=(ti.pic_x/2)+(yuv[1].stride)*(ti.pic_y/2);
@@ -130,10 +133,10 @@ void VideoStreamPlaybackTheora::video_write(void){
yuv420_2_rgb8888((uint8_t*)dst, (uint8_t*)yuv[0].data, (uint8_t*)yuv[2].data, (uint8_t*)yuv[1].data, size.x, size.y, yuv[0].stride, yuv[1].stride, size.x<<2, 0);
};
- format = Image::FORMAT_RGBA;
+ format = Image::FORMAT_RGBA8;
}
- Image img(size.x,size.y,0,Image::FORMAT_RGBA,frame_data); //zero copy image creation
+ Image img(size.x,size.y,0,Image::FORMAT_RGBA8,frame_data); //zero copy image creation
texture->set_data(img); //zero copy send to visual server
@@ -143,7 +146,7 @@ void VideoStreamPlaybackTheora::video_write(void){
int pitch = 3;
frame_data.resize(size.x * size.y * pitch);
- DVector<uint8_t>::Write w = frame_data.write();
+ PoolVector<uint8_t>::Write w = frame_data.write();
char* dst = (char*)w.ptr();
for(int i=0;i<size.y;i++) {
@@ -174,7 +177,7 @@ void VideoStreamPlaybackTheora::video_write(void){
int pitch = 4;
frame_data.resize(size.x * size.y * pitch);
- DVector<uint8_t>::Write w = frame_data.write();
+ PoolVector<uint8_t>::Write w = frame_data.write();
char* dst = (char*)w.ptr();
uv_offset=(ti.pic_x/2)+(yuv[1].stride)*(ti.pic_y / div);
@@ -202,13 +205,13 @@ void VideoStreamPlaybackTheora::video_write(void){
}
}
- format = Image::FORMAT_RGBA;
+ format = Image::FORMAT_RGBA8;
} else {
int pitch = 2;
frame_data.resize(size.x * size.y * pitch);
- DVector<uint8_t>::Write w = frame_data.write();
+ PoolVector<uint8_t>::Write w = frame_data.write();
char* dst = (char*)w.ptr();
uv_offset=(ti.pic_x/2)+(yuv[1].stride)*(ti.pic_y / div);
@@ -228,7 +231,7 @@ void VideoStreamPlaybackTheora::video_write(void){
format = Image::FORMAT_YUV_422;
};
};
- // */
+ //*/
frames_pending = 1;
}
@@ -470,7 +473,7 @@ void VideoStreamPlaybackTheora::set_file(const String& p_file) {
size.x = w;
size.y = h;
- texture->create(w,h,Image::FORMAT_RGBA,Texture::FLAG_FILTER|Texture::FLAG_VIDEO_SURFACE);
+ texture->create(w,h,Image::FORMAT_RGBA8,Texture::FLAG_FILTER|Texture::FLAG_VIDEO_SURFACE);
}else{
/* tear down the partial theora setup */
@@ -598,7 +601,7 @@ void VideoStreamPlaybackTheora::update(float p_delta) {
if (vd.granulepos>=0) {
- // print_line("wrote: "+itos(audio_frames_wrote)+" gpos: "+itos(vd.granulepos));
+ //print_line("wrote: "+itos(audio_frames_wrote)+" gpos: "+itos(vd.granulepos));
}
//print_line("mix audio!");
@@ -747,7 +750,7 @@ void VideoStreamPlaybackTheora::play() {
}
playing = true;
- delay_compensation=Globals::get_singleton()->get("audio/video_delay_compensation_ms");
+ delay_compensation=GlobalConfig::get_singleton()->get("audio/video_delay_compensation_ms");
delay_compensation/=1000.0;
@@ -933,7 +936,7 @@ bool ResourceFormatLoaderVideoStreamTheora::handles_type(const String& p_type) c
String ResourceFormatLoaderVideoStreamTheora::get_resource_type(const String &p_path) const {
- String exl=p_path.extension().to_lower();
+ String exl=p_path.get_extension().to_lower();
if (exl=="ogm" || exl=="ogv")
return "VideoStreamTheora";
return "";
diff --git a/modules/theora/video_stream_theora.h b/modules/theora/video_stream_theora.h
index 04a5c56ee5..0e1f5fa864 100644
--- a/modules/theora/video_stream_theora.h
+++ b/modules/theora/video_stream_theora.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* 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 */
@@ -43,7 +43,7 @@
class VideoStreamPlaybackTheora : public VideoStreamPlayback {
- OBJ_TYPE(VideoStreamPlaybackTheora, VideoStreamPlayback);
+ GDCLASS(VideoStreamPlaybackTheora, VideoStreamPlayback);
enum {
MAX_FRAMES = 4,
@@ -51,7 +51,7 @@ class VideoStreamPlaybackTheora : public VideoStreamPlayback {
//Image frames[MAX_FRAMES];
Image::Format format;
- DVector<uint8_t> frame_data;
+ PoolVector<uint8_t> frame_data;
int frames_pending;
FileAccess* file;
String file_name;
@@ -165,7 +165,7 @@ public:
class VideoStreamTheora : public VideoStream {
- OBJ_TYPE(VideoStreamTheora,VideoStream);
+ GDCLASS(VideoStreamTheora,VideoStream);
String file;
int audio_track;
diff --git a/modules/theora/yuv2rgb.h b/modules/theora/yuv2rgb.h
index 431b47e651..3b81607a65 100644
--- a/modules/theora/yuv2rgb.h
+++ b/modules/theora/yuv2rgb.h
@@ -3,8 +3,7 @@
#include "typedefs.h"
-static const uint32_t tables[256*3] =
-{
+static const uint32_t tables[256*3] = {
/* y_table */
0x7FFFFFEDU,
0x7FFFFFEFU,
diff --git a/modules/visual_script/config.py b/modules/visual_script/config.py
index ea7e83378a..5698a37295 100644
--- a/modules/visual_script/config.py
+++ b/modules/visual_script/config.py
@@ -1,11 +1,8 @@
def can_build(platform):
- return True
+ return True
def configure(env):
- pass
-
-
-
+ pass
diff --git a/modules/visual_script/register_types.cpp b/modules/visual_script/register_types.cpp
index ad54149b51..5fe87a4956 100644
--- a/modules/visual_script/register_types.cpp
+++ b/modules/visual_script/register_types.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* 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 */
@@ -48,58 +48,58 @@ void register_visual_script_types() {
//script_language_gd->init();
ScriptServer::register_language(visual_script_language);
- ObjectTypeDB::register_type<VisualScript>();
- ObjectTypeDB::register_virtual_type<VisualScriptNode>();
- ObjectTypeDB::register_virtual_type<VisualScriptFunctionState>();
- ObjectTypeDB::register_type<VisualScriptFunction>();
- ObjectTypeDB::register_type<VisualScriptOperator>();
- ObjectTypeDB::register_type<VisualScriptVariableSet>();
- ObjectTypeDB::register_type<VisualScriptVariableGet>();
- ObjectTypeDB::register_type<VisualScriptConstant>();
- ObjectTypeDB::register_type<VisualScriptIndexGet>();
- ObjectTypeDB::register_type<VisualScriptIndexSet>();
- ObjectTypeDB::register_type<VisualScriptGlobalConstant>();
- ObjectTypeDB::register_type<VisualScriptClassConstant>();
- ObjectTypeDB::register_type<VisualScriptMathConstant>();
- ObjectTypeDB::register_type<VisualScriptBasicTypeConstant>();
- ObjectTypeDB::register_type<VisualScriptEngineSingleton>();
- ObjectTypeDB::register_type<VisualScriptSceneNode>();
- ObjectTypeDB::register_type<VisualScriptSceneTree>();
- ObjectTypeDB::register_type<VisualScriptResourcePath>();
- ObjectTypeDB::register_type<VisualScriptSelf>();
- ObjectTypeDB::register_type<VisualScriptCustomNode>();
- ObjectTypeDB::register_type<VisualScriptSubCall>();
- ObjectTypeDB::register_type<VisualScriptComment>();
- ObjectTypeDB::register_type<VisualScriptConstructor>();
- ObjectTypeDB::register_type<VisualScriptLocalVar>();
- ObjectTypeDB::register_type<VisualScriptLocalVarSet>();
- ObjectTypeDB::register_type<VisualScriptInputAction>();
- ObjectTypeDB::register_type<VisualScriptDeconstruct>();
- ObjectTypeDB::register_type<VisualScriptPreload>();
- ObjectTypeDB::register_type<VisualScriptTypeCast>();
-
-
- ObjectTypeDB::register_type<VisualScriptFunctionCall>();
- ObjectTypeDB::register_type<VisualScriptPropertySet>();
- ObjectTypeDB::register_type<VisualScriptPropertyGet>();
-// ObjectTypeDB::register_type<VisualScriptScriptCall>();
- ObjectTypeDB::register_type<VisualScriptEmitSignal>();
-
- ObjectTypeDB::register_type<VisualScriptReturn>();
- ObjectTypeDB::register_type<VisualScriptCondition>();
- ObjectTypeDB::register_type<VisualScriptWhile>();
- ObjectTypeDB::register_type<VisualScriptIterator>();
- ObjectTypeDB::register_type<VisualScriptSequence>();
- ObjectTypeDB::register_type<VisualScriptInputFilter>();
- ObjectTypeDB::register_type<VisualScriptSwitch >();
-
- ObjectTypeDB::register_type<VisualScriptYield>();
- ObjectTypeDB::register_type<VisualScriptYieldSignal>();
-
- ObjectTypeDB::register_type<VisualScriptBuiltinFunc>();
-
-
- ObjectTypeDB::register_type<VisualScriptExpression>();
+ ClassDB::register_class<VisualScript>();
+ ClassDB::register_virtual_class<VisualScriptNode>();
+ ClassDB::register_virtual_class<VisualScriptFunctionState>();
+ ClassDB::register_class<VisualScriptFunction>();
+ ClassDB::register_class<VisualScriptOperator>();
+ ClassDB::register_class<VisualScriptVariableSet>();
+ ClassDB::register_class<VisualScriptVariableGet>();
+ ClassDB::register_class<VisualScriptConstant>();
+ ClassDB::register_class<VisualScriptIndexGet>();
+ ClassDB::register_class<VisualScriptIndexSet>();
+ ClassDB::register_class<VisualScriptGlobalConstant>();
+ ClassDB::register_class<VisualScriptClassConstant>();
+ ClassDB::register_class<VisualScriptMathConstant>();
+ ClassDB::register_class<VisualScriptBasicTypeConstant>();
+ ClassDB::register_class<VisualScriptEngineSingleton>();
+ ClassDB::register_class<VisualScriptSceneNode>();
+ ClassDB::register_class<VisualScriptSceneTree>();
+ ClassDB::register_class<VisualScriptResourcePath>();
+ ClassDB::register_class<VisualScriptSelf>();
+ ClassDB::register_class<VisualScriptCustomNode>();
+ ClassDB::register_class<VisualScriptSubCall>();
+ ClassDB::register_class<VisualScriptComment>();
+ ClassDB::register_class<VisualScriptConstructor>();
+ ClassDB::register_class<VisualScriptLocalVar>();
+ ClassDB::register_class<VisualScriptLocalVarSet>();
+ ClassDB::register_class<VisualScriptInputAction>();
+ ClassDB::register_class<VisualScriptDeconstruct>();
+ ClassDB::register_class<VisualScriptPreload>();
+ ClassDB::register_class<VisualScriptTypeCast>();
+
+
+ ClassDB::register_class<VisualScriptFunctionCall>();
+ ClassDB::register_class<VisualScriptPropertySet>();
+ ClassDB::register_class<VisualScriptPropertyGet>();
+ //ClassDB::register_type<VisualScriptScriptCall>();
+ ClassDB::register_class<VisualScriptEmitSignal>();
+
+ ClassDB::register_class<VisualScriptReturn>();
+ ClassDB::register_class<VisualScriptCondition>();
+ ClassDB::register_class<VisualScriptWhile>();
+ ClassDB::register_class<VisualScriptIterator>();
+ ClassDB::register_class<VisualScriptSequence>();
+ ClassDB::register_class<VisualScriptInputFilter>();
+ ClassDB::register_class<VisualScriptSwitch >();
+
+ ClassDB::register_class<VisualScriptYield>();
+ ClassDB::register_class<VisualScriptYieldSignal>();
+
+ ClassDB::register_class<VisualScriptBuiltinFunc>();
+
+
+ ClassDB::register_class<VisualScriptExpression>();
register_visual_script_nodes();
register_visual_script_func_nodes();
diff --git a/modules/visual_script/register_types.h b/modules/visual_script/register_types.h
index 0a5805eb0b..f6904420bd 100644
--- a/modules/visual_script/register_types.h
+++ b/modules/visual_script/register_types.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* 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 */
diff --git a/modules/visual_script/visual_script.cpp b/modules/visual_script/visual_script.cpp
index bd042c8989..e1e180432a 100644
--- a/modules/visual_script/visual_script.cpp
+++ b/modules/visual_script/visual_script.cpp
@@ -104,11 +104,11 @@ Array VisualScriptNode::_get_default_input_values() const {
void VisualScriptNode::_bind_methods() {
- ObjectTypeDB::bind_method(_MD("get_visual_script:VisualScript"),&VisualScriptNode::get_visual_script);
- ObjectTypeDB::bind_method(_MD("set_default_input_value","port_idx","value:Variant"),&VisualScriptNode::set_default_input_value);
- ObjectTypeDB::bind_method(_MD("get_default_input_value:Variant","port_idx"),&VisualScriptNode::get_default_input_value);
- ObjectTypeDB::bind_method(_MD("_set_default_input_values","values"),&VisualScriptNode::_set_default_input_values);
- ObjectTypeDB::bind_method(_MD("_get_default_input_values"),&VisualScriptNode::_get_default_input_values);
+ ClassDB::bind_method(_MD("get_visual_script:VisualScript"),&VisualScriptNode::get_visual_script);
+ ClassDB::bind_method(_MD("set_default_input_value","port_idx","value:Variant"),&VisualScriptNode::set_default_input_value);
+ ClassDB::bind_method(_MD("get_default_input_value:Variant","port_idx"),&VisualScriptNode::get_default_input_value);
+ ClassDB::bind_method(_MD("_set_default_input_values","values"),&VisualScriptNode::_set_default_input_values);
+ ClassDB::bind_method(_MD("_get_default_input_values"),&VisualScriptNode::_get_default_input_values);
ADD_PROPERTY(PropertyInfo(Variant::ARRAY,"_default_input_values",PROPERTY_HINT_NONE,"",PROPERTY_USAGE_NOEDITOR),_SCS("_set_default_input_values"),_SCS("_get_default_input_values"));
ADD_SIGNAL(MethodInfo("ports_changed"));
@@ -122,7 +122,7 @@ VisualScriptNode::TypeGuess VisualScriptNode::guess_output_type(TypeGuess* p_inp
tg.type=pinfo.type;
if (pinfo.hint==PROPERTY_HINT_RESOURCE_TYPE) {
- tg.obj_type=pinfo.hint_string;
+ tg.GDCLASS=pinfo.hint_string;
}
return tg;
@@ -1317,63 +1317,63 @@ void VisualScript::_bind_methods() {
- ObjectTypeDB::bind_method(_MD("_node_ports_changed"),&VisualScript::_node_ports_changed);
-
- ObjectTypeDB::bind_method(_MD("add_function","name"),&VisualScript::add_function);
- ObjectTypeDB::bind_method(_MD("has_function","name"),&VisualScript::has_function);
- ObjectTypeDB::bind_method(_MD("remove_function","name"),&VisualScript::remove_function);
- ObjectTypeDB::bind_method(_MD("rename_function","name","new_name"),&VisualScript::rename_function);
- ObjectTypeDB::bind_method(_MD("set_function_scroll","ofs"),&VisualScript::set_function_scroll);
- ObjectTypeDB::bind_method(_MD("get_function_scroll"),&VisualScript::get_function_scroll);
-
- ObjectTypeDB::bind_method(_MD("add_node","func","id","node","pos"),&VisualScript::add_node,DEFVAL(Point2()));
- ObjectTypeDB::bind_method(_MD("remove_node","func","id"),&VisualScript::remove_node);
- ObjectTypeDB::bind_method(_MD("get_function_node_id","name"),&VisualScript::get_function_node_id);
-
- ObjectTypeDB::bind_method(_MD("get_node","func","id"),&VisualScript::get_node);
- ObjectTypeDB::bind_method(_MD("has_node","func","id"),&VisualScript::has_node);
- ObjectTypeDB::bind_method(_MD("set_node_pos","func","id","pos"),&VisualScript::set_node_pos);
- ObjectTypeDB::bind_method(_MD("get_node_pos","func","id"),&VisualScript::get_node_pos);
-
- ObjectTypeDB::bind_method(_MD("sequence_connect","func","from_node","from_output","to_node"),&VisualScript::sequence_connect);
- ObjectTypeDB::bind_method(_MD("sequence_disconnect","func","from_node","from_output","to_node"),&VisualScript::sequence_disconnect);
- ObjectTypeDB::bind_method(_MD("has_sequence_connection","func","from_node","from_output","to_node"),&VisualScript::has_sequence_connection);
-
- ObjectTypeDB::bind_method(_MD("data_connect","func","from_node","from_port","to_node","to_port"),&VisualScript::data_connect);
- ObjectTypeDB::bind_method(_MD("data_disconnect","func","from_node","from_port","to_node","to_port"),&VisualScript::data_disconnect);
- ObjectTypeDB::bind_method(_MD("has_data_connection","func","from_node","from_port","to_node","to_port"),&VisualScript::has_data_connection);
-
- ObjectTypeDB::bind_method(_MD("add_variable","name","default_value","export"),&VisualScript::add_variable,DEFVAL(Variant()),DEFVAL(false));
- ObjectTypeDB::bind_method(_MD("has_variable","name"),&VisualScript::has_variable);
- ObjectTypeDB::bind_method(_MD("remove_variable","name"),&VisualScript::remove_variable);
- ObjectTypeDB::bind_method(_MD("set_variable_default_value","name","value"),&VisualScript::set_variable_default_value);
- ObjectTypeDB::bind_method(_MD("get_variable_default_value","name"),&VisualScript::get_variable_default_value);
- ObjectTypeDB::bind_method(_MD("set_variable_info","name","value"),&VisualScript::_set_variable_info);
- ObjectTypeDB::bind_method(_MD("get_variable_info","name"),&VisualScript::_get_variable_info);
- ObjectTypeDB::bind_method(_MD("set_variable_export","name","enable"),&VisualScript::set_variable_export);
- ObjectTypeDB::bind_method(_MD("get_variable_export","name"),&VisualScript::get_variable_export);
- ObjectTypeDB::bind_method(_MD("rename_variable","name","new_name"),&VisualScript::rename_variable);
-
- ObjectTypeDB::bind_method(_MD("add_custom_signal","name"),&VisualScript::add_custom_signal);
- ObjectTypeDB::bind_method(_MD("has_custom_signal","name"),&VisualScript::has_custom_signal);
- ObjectTypeDB::bind_method(_MD("custom_signal_add_argument","name","type","argname","index"),&VisualScript::custom_signal_add_argument,DEFVAL(-1));
- ObjectTypeDB::bind_method(_MD("custom_signal_set_argument_type","name","argidx","type"),&VisualScript::custom_signal_set_argument_type);
- ObjectTypeDB::bind_method(_MD("custom_signal_get_argument_type","name","argidx"),&VisualScript::custom_signal_get_argument_type);
- ObjectTypeDB::bind_method(_MD("custom_signal_set_argument_name","name","argidx","argname"),&VisualScript::custom_signal_set_argument_name);
- ObjectTypeDB::bind_method(_MD("custom_signal_get_argument_name","name","argidx"),&VisualScript::custom_signal_get_argument_name);
- ObjectTypeDB::bind_method(_MD("custom_signal_remove_argument","argidx"),&VisualScript::custom_signal_remove_argument);
- ObjectTypeDB::bind_method(_MD("custom_signal_get_argument_count","name"),&VisualScript::custom_signal_get_argument_count);
- ObjectTypeDB::bind_method(_MD("custom_signal_swap_argument","name","argidx","withidx"),&VisualScript::custom_signal_swap_argument);
- ObjectTypeDB::bind_method(_MD("remove_custom_signal","name"),&VisualScript::remove_custom_signal);
- ObjectTypeDB::bind_method(_MD("rename_custom_signal","name","new_name"),&VisualScript::rename_custom_signal);
-
- //ObjectTypeDB::bind_method(_MD("set_variable_info","name","info"),&VScript::set_variable_info);
- //ObjectTypeDB::bind_method(_MD("get_variable_info","name"),&VScript::set_variable_info);
-
- ObjectTypeDB::bind_method(_MD("set_instance_base_type","type"),&VisualScript::set_instance_base_type);
-
- ObjectTypeDB::bind_method(_MD("_set_data","data"),&VisualScript::_set_data);
- ObjectTypeDB::bind_method(_MD("_get_data"),&VisualScript::_get_data);
+ ClassDB::bind_method(_MD("_node_ports_changed"),&VisualScript::_node_ports_changed);
+
+ ClassDB::bind_method(_MD("add_function","name"),&VisualScript::add_function);
+ ClassDB::bind_method(_MD("has_function","name"),&VisualScript::has_function);
+ ClassDB::bind_method(_MD("remove_function","name"),&VisualScript::remove_function);
+ ClassDB::bind_method(_MD("rename_function","name","new_name"),&VisualScript::rename_function);
+ ClassDB::bind_method(_MD("set_function_scroll","ofs"),&VisualScript::set_function_scroll);
+ ClassDB::bind_method(_MD("get_function_scroll"),&VisualScript::get_function_scroll);
+
+ ClassDB::bind_method(_MD("add_node","func","id","node","pos"),&VisualScript::add_node,DEFVAL(Point2()));
+ ClassDB::bind_method(_MD("remove_node","func","id"),&VisualScript::remove_node);
+ ClassDB::bind_method(_MD("get_function_node_id","name"),&VisualScript::get_function_node_id);
+
+ ClassDB::bind_method(_MD("get_node","func","id"),&VisualScript::get_node);
+ ClassDB::bind_method(_MD("has_node","func","id"),&VisualScript::has_node);
+ ClassDB::bind_method(_MD("set_node_pos","func","id","pos"),&VisualScript::set_node_pos);
+ ClassDB::bind_method(_MD("get_node_pos","func","id"),&VisualScript::get_node_pos);
+
+ ClassDB::bind_method(_MD("sequence_connect","func","from_node","from_output","to_node"),&VisualScript::sequence_connect);
+ ClassDB::bind_method(_MD("sequence_disconnect","func","from_node","from_output","to_node"),&VisualScript::sequence_disconnect);
+ ClassDB::bind_method(_MD("has_sequence_connection","func","from_node","from_output","to_node"),&VisualScript::has_sequence_connection);
+
+ ClassDB::bind_method(_MD("data_connect","func","from_node","from_port","to_node","to_port"),&VisualScript::data_connect);
+ ClassDB::bind_method(_MD("data_disconnect","func","from_node","from_port","to_node","to_port"),&VisualScript::data_disconnect);
+ ClassDB::bind_method(_MD("has_data_connection","func","from_node","from_port","to_node","to_port"),&VisualScript::has_data_connection);
+
+ ClassDB::bind_method(_MD("add_variable","name","default_value","export"),&VisualScript::add_variable,DEFVAL(Variant()),DEFVAL(false));
+ ClassDB::bind_method(_MD("has_variable","name"),&VisualScript::has_variable);
+ ClassDB::bind_method(_MD("remove_variable","name"),&VisualScript::remove_variable);
+ ClassDB::bind_method(_MD("set_variable_default_value","name","value"),&VisualScript::set_variable_default_value);
+ ClassDB::bind_method(_MD("get_variable_default_value","name"),&VisualScript::get_variable_default_value);
+ ClassDB::bind_method(_MD("set_variable_info","name","value"),&VisualScript::_set_variable_info);
+ ClassDB::bind_method(_MD("get_variable_info","name"),&VisualScript::_get_variable_info);
+ ClassDB::bind_method(_MD("set_variable_export","name","enable"),&VisualScript::set_variable_export);
+ ClassDB::bind_method(_MD("get_variable_export","name"),&VisualScript::get_variable_export);
+ ClassDB::bind_method(_MD("rename_variable","name","new_name"),&VisualScript::rename_variable);
+
+ ClassDB::bind_method(_MD("add_custom_signal","name"),&VisualScript::add_custom_signal);
+ ClassDB::bind_method(_MD("has_custom_signal","name"),&VisualScript::has_custom_signal);
+ ClassDB::bind_method(_MD("custom_signal_add_argument","name","type","argname","index"),&VisualScript::custom_signal_add_argument,DEFVAL(-1));
+ ClassDB::bind_method(_MD("custom_signal_set_argument_type","name","argidx","type"),&VisualScript::custom_signal_set_argument_type);
+ ClassDB::bind_method(_MD("custom_signal_get_argument_type","name","argidx"),&VisualScript::custom_signal_get_argument_type);
+ ClassDB::bind_method(_MD("custom_signal_set_argument_name","name","argidx","argname"),&VisualScript::custom_signal_set_argument_name);
+ ClassDB::bind_method(_MD("custom_signal_get_argument_name","name","argidx"),&VisualScript::custom_signal_get_argument_name);
+ ClassDB::bind_method(_MD("custom_signal_remove_argument","argidx"),&VisualScript::custom_signal_remove_argument);
+ ClassDB::bind_method(_MD("custom_signal_get_argument_count","name"),&VisualScript::custom_signal_get_argument_count);
+ ClassDB::bind_method(_MD("custom_signal_swap_argument","name","argidx","withidx"),&VisualScript::custom_signal_swap_argument);
+ ClassDB::bind_method(_MD("remove_custom_signal","name"),&VisualScript::remove_custom_signal);
+ ClassDB::bind_method(_MD("rename_custom_signal","name","new_name"),&VisualScript::rename_custom_signal);
+
+ //ClassDB::bind_method(_MD("set_variable_info","name","info"),&VScript::set_variable_info);
+ //ClassDB::bind_method(_MD("get_variable_info","name"),&VScript::set_variable_info);
+
+ ClassDB::bind_method(_MD("set_instance_base_type","type"),&VisualScript::set_instance_base_type);
+
+ ClassDB::bind_method(_MD("_set_data","data"),&VisualScript::_set_data);
+ ClassDB::bind_method(_MD("_get_data"),&VisualScript::_get_data);
ADD_PROPERTY(PropertyInfo(Variant::DICTIONARY,"data",PROPERTY_HINT_NONE,"",PROPERTY_USAGE_NOEDITOR),_SCS("_set_data"),_SCS("_get_data"));
@@ -1573,7 +1573,7 @@ Variant VisualScriptInstance::_call_internal(const StringName& p_method, void* p
p_pass++; //increment pass
current_node_id=node->get_id();
- VSDEBUG("==========AT NODE: "+itos(current_node_id)+" base: "+node->get_base_node()->get_type());
+ VSDEBUG("==========AT NODE: "+itos(current_node_id)+" base: "+node->get_base_node()->get_class_name());
VSDEBUG("AT STACK POS: "+itos(flow_stack_pos));
@@ -2436,10 +2436,10 @@ Variant VisualScriptFunctionState::resume(Array p_args) {
void VisualScriptFunctionState::_bind_methods() {
- ObjectTypeDB::bind_method(_MD("connect_to_signal","obj","signals","args"),&VisualScriptFunctionState::connect_to_signal);
- ObjectTypeDB::bind_method(_MD("resume:Array","args"),&VisualScriptFunctionState::resume,DEFVAL(Variant()));
- ObjectTypeDB::bind_method(_MD("is_valid"),&VisualScriptFunctionState::is_valid);
- ObjectTypeDB::bind_vararg_method(METHOD_FLAGS_DEFAULT,"_signal_callback",&VisualScriptFunctionState::_signal_callback,MethodInfo("_signal_callback"));
+ ClassDB::bind_method(_MD("connect_to_signal","obj","signals","args"),&VisualScriptFunctionState::connect_to_signal);
+ ClassDB::bind_method(_MD("resume:Array","args"),&VisualScriptFunctionState::resume,DEFVAL(Variant()));
+ ClassDB::bind_method(_MD("is_valid"),&VisualScriptFunctionState::is_valid);
+ ClassDB::bind_vararg_method(METHOD_FLAGS_DEFAULT,"_signal_callback",&VisualScriptFunctionState::_signal_callback,MethodInfo("_signal_callback"));
}
VisualScriptFunctionState::VisualScriptFunctionState() {
@@ -2525,7 +2525,7 @@ int VisualScriptLanguage::find_function(const String& p_function,const String& p
return -1;
}
-String VisualScriptLanguage::make_function(const String& p_class,const String& p_name,const StringArray& p_args) const {
+String VisualScriptLanguage::make_function(const String& p_class,const String& p_name,const PoolStringArray& p_args) const {
return String();
}
@@ -2631,7 +2631,7 @@ void VisualScriptLanguage::debug_get_stack_level_locals(int p_level,List<String>
const StringName *f = _call_stack[l].function;
ERR_FAIL_COND(!_call_stack[l].instance->functions.has(*f));
-// VisualScriptInstance::Function *func = &_call_stack[l].instance->functions[*f];
+ //VisualScriptInstance::Function *func = &_call_stack[l].instance->functions[*f];
VisualScriptNodeInstance *node =_call_stack[l].instance->instances[*_call_stack[l].current_id];
ERR_FAIL_COND(!node);
@@ -2815,7 +2815,7 @@ VisualScriptLanguage::VisualScriptLanguage() {
_debug_parse_err_node=-1;
_debug_parse_err_file="";
_debug_call_stack_pos=0;
- int dmcs=GLOBAL_DEF("debug/script_max_call_stack",1024);
+ int dmcs=GLOBAL_DEF("debug/script/max_call_stack",1024);
if (ScriptDebugger::get_singleton()) {
//debugging enabled!
_debug_max_call_stack = dmcs;
diff --git a/modules/visual_script/visual_script.h b/modules/visual_script/visual_script.h
index 63b018b0c2..acd1c3a670 100644
--- a/modules/visual_script/visual_script.h
+++ b/modules/visual_script/visual_script.h
@@ -9,7 +9,7 @@ class VisualScriptNodeInstance;
class VisualScript;
class VisualScriptNode : public Resource {
- OBJ_TYPE(VisualScriptNode,Resource)
+ GDCLASS(VisualScriptNode,Resource)
friend class VisualScript;
@@ -24,8 +24,6 @@ friend class VisualScript;
void validate_input_default_values();
protected:
- virtual bool _use_builtin_script() const { return false; }
-
void _notification(int p_what);
void ports_changed_notify();
static void _bind_methods();
@@ -64,7 +62,7 @@ public:
Variant::Type type;
InputEvent::Type ev_type;
- StringName obj_type;
+ StringName GDCLASS;
Ref<Script> script;
TypeGuess() { type=Variant::NIL; ev_type=InputEvent::NONE; }
@@ -143,7 +141,7 @@ public:
class VisualScript : public Script {
- OBJ_TYPE( VisualScript, Script )
+ GDCLASS( VisualScript, Script )
RES_BASE_EXTENSION("vs");
@@ -437,7 +435,7 @@ public:
class VisualScriptFunctionState : public Reference {
- OBJ_TYPE(VisualScriptFunctionState,Reference);
+ GDCLASS(VisualScriptFunctionState,Reference);
friend class VisualScriptInstance;
ObjectID instance_id;
@@ -562,7 +560,7 @@ public:
virtual Script *create_script() const;
virtual bool has_named_classes() const;
virtual int find_function(const String& p_function,const String& p_code) const;
- virtual String make_function(const String& p_class,const String& p_name,const StringArray& p_args) const;
+ virtual String make_function(const String& p_class,const String& p_name,const PoolStringArray& p_args) const;
virtual void auto_indent_code(String& p_code,int p_from_line,int p_to_line) const;
virtual void add_global_constant(const StringName& p_variable,const Variant& p_value);
diff --git a/modules/visual_script/visual_script_builtin_funcs.cpp b/modules/visual_script/visual_script_builtin_funcs.cpp
index 2bfb6bc9ea..a0f23a511f 100644
--- a/modules/visual_script/visual_script_builtin_funcs.cpp
+++ b/modules/visual_script/visual_script_builtin_funcs.cpp
@@ -1,6 +1,6 @@
#include "visual_script_builtin_funcs.h"
#include "math_funcs.h"
-#include "object_type_db.h"
+#include "class_db.h"
#include "reference.h"
#include "func_ref.h"
#include "os/os.h"
@@ -64,6 +64,7 @@ const char* VisualScriptBuiltinFunc::func_name[VisualScriptBuiltinFunc::FUNC_MAX
"str2var",
"var2bytes",
"bytes2var",
+ "color_named",
};
VisualScriptBuiltinFunc::BuiltinFunc VisualScriptBuiltinFunc::find_function(const String& p_string) {
@@ -164,6 +165,7 @@ int VisualScriptBuiltinFunc::get_func_argument_count(BuiltinFunc p_func) {
case LOGIC_MIN:
case FUNC_FUNCREF:
case TYPE_CONVERT:
+ case COLORN:
return 2;
case MATH_LERP:
case MATH_DECTIME:
@@ -368,13 +370,11 @@ PropertyInfo VisualScriptBuiltinFunc::get_input_value_port_info(int p_idx) const
return PropertyInfo(Variant::INT,"ascii");
-
} break;
case TEXT_STR: {
return PropertyInfo(Variant::NIL,"value");
-
} break;
case TEXT_PRINT: {
@@ -404,7 +404,15 @@ PropertyInfo VisualScriptBuiltinFunc::get_input_value_port_info(int p_idx) const
} break;
case BYTES_TO_VAR: {
- return PropertyInfo(Variant::RAW_ARRAY,"bytes");
+ return PropertyInfo(Variant::POOL_BYTE_ARRAY,"bytes");
+ } break;
+ case COLORN: {
+
+ if (p_idx==0)
+ return PropertyInfo(Variant::STRING,"name");
+ else
+ return PropertyInfo(Variant::REAL,"alpha");
+
} break;
case FUNC_MAX:{}
}
@@ -548,13 +556,16 @@ PropertyInfo VisualScriptBuiltinFunc::get_output_value_port_info(int p_idx) cons
} break;
case VAR_TO_BYTES: {
- t=Variant::RAW_ARRAY;
+ t=Variant::POOL_BYTE_ARRAY;
} break;
case BYTES_TO_VAR: {
} break;
+ case COLORN: {
+ t=Variant::COLOR;
+ } break;
case FUNC_MAX:{}
}
@@ -599,85 +610,85 @@ void VisualScriptBuiltinFunc::exec_func(BuiltinFunc p_func,const Variant** p_inp
case VisualScriptBuiltinFunc::MATH_SIN: {
VALIDATE_ARG_NUM(0);
- *r_return=Math::sin(*p_inputs[0]);
+ *r_return=Math::sin((double)*p_inputs[0]);
} break;
case VisualScriptBuiltinFunc::MATH_COS: {
VALIDATE_ARG_NUM(0);
- *r_return=Math::cos(*p_inputs[0]);
+ *r_return=Math::cos((double)*p_inputs[0]);
} break;
case VisualScriptBuiltinFunc::MATH_TAN: {
VALIDATE_ARG_NUM(0);
- *r_return=Math::tan(*p_inputs[0]);
+ *r_return=Math::tan((double)*p_inputs[0]);
} break;
case VisualScriptBuiltinFunc::MATH_SINH: {
VALIDATE_ARG_NUM(0);
- *r_return=Math::sinh(*p_inputs[0]);
+ *r_return=Math::sinh((double)*p_inputs[0]);
} break;
case VisualScriptBuiltinFunc::MATH_COSH: {
VALIDATE_ARG_NUM(0);
- *r_return=Math::cosh(*p_inputs[0]);
+ *r_return=Math::cosh((double)*p_inputs[0]);
} break;
case VisualScriptBuiltinFunc::MATH_TANH: {
VALIDATE_ARG_NUM(0);
- *r_return=Math::tanh(*p_inputs[0]);
+ *r_return=Math::tanh((double)*p_inputs[0]);
} break;
case VisualScriptBuiltinFunc::MATH_ASIN: {
VALIDATE_ARG_NUM(0);
- *r_return=Math::asin(*p_inputs[0]);
+ *r_return=Math::asin((double)*p_inputs[0]);
} break;
case VisualScriptBuiltinFunc::MATH_ACOS: {
VALIDATE_ARG_NUM(0);
- *r_return=Math::acos(*p_inputs[0]);
+ *r_return=Math::acos((double)*p_inputs[0]);
} break;
case VisualScriptBuiltinFunc::MATH_ATAN: {
VALIDATE_ARG_NUM(0);
- *r_return=Math::atan(*p_inputs[0]);
+ *r_return=Math::atan((double)*p_inputs[0]);
} break;
case VisualScriptBuiltinFunc::MATH_ATAN2: {
VALIDATE_ARG_NUM(0);
VALIDATE_ARG_NUM(1);
- *r_return=Math::atan2(*p_inputs[0],*p_inputs[1]);
+ *r_return=Math::atan2((double)*p_inputs[0],(double)*p_inputs[1]);
} break;
case VisualScriptBuiltinFunc::MATH_SQRT: {
VALIDATE_ARG_NUM(0);
- *r_return=Math::sqrt(*p_inputs[0]);
+ *r_return=Math::sqrt((double)*p_inputs[0]);
} break;
case VisualScriptBuiltinFunc::MATH_FMOD: {
VALIDATE_ARG_NUM(0);
VALIDATE_ARG_NUM(1);
- *r_return=Math::fmod(*p_inputs[0],*p_inputs[1]);
+ *r_return=Math::fmod((double)*p_inputs[0],(double)*p_inputs[1]);
} break;
case VisualScriptBuiltinFunc::MATH_FPOSMOD: {
VALIDATE_ARG_NUM(0);
VALIDATE_ARG_NUM(1);
- *r_return=Math::fposmod(*p_inputs[0],*p_inputs[1]);
+ *r_return=Math::fposmod((double)*p_inputs[0],(double)*p_inputs[1]);
} break;
case VisualScriptBuiltinFunc::MATH_FLOOR: {
VALIDATE_ARG_NUM(0);
- *r_return=Math::floor(*p_inputs[0]);
+ *r_return=Math::floor((double)*p_inputs[0]);
} break;
case VisualScriptBuiltinFunc::MATH_CEIL: {
VALIDATE_ARG_NUM(0);
- *r_return=Math::ceil(*p_inputs[0]);
+ *r_return=Math::ceil((double)*p_inputs[0]);
} break;
case VisualScriptBuiltinFunc::MATH_ROUND: {
VALIDATE_ARG_NUM(0);
- *r_return=Math::round(*p_inputs[0]);
+ *r_return=Math::round((double)*p_inputs[0]);
} break;
case VisualScriptBuiltinFunc::MATH_ABS: {
@@ -719,58 +730,58 @@ void VisualScriptBuiltinFunc::exec_func(BuiltinFunc p_func,const Variant** p_inp
VALIDATE_ARG_NUM(0);
VALIDATE_ARG_NUM(1);
- *r_return=Math::pow(*p_inputs[0],*p_inputs[1]);
+ *r_return=Math::pow((double)*p_inputs[0],(double)*p_inputs[1]);
} break;
case VisualScriptBuiltinFunc::MATH_LOG: {
VALIDATE_ARG_NUM(0);
- *r_return=Math::log(*p_inputs[0]);
+ *r_return=Math::log((double)*p_inputs[0]);
} break;
case VisualScriptBuiltinFunc::MATH_EXP: {
VALIDATE_ARG_NUM(0);
- *r_return=Math::exp(*p_inputs[0]);
+ *r_return=Math::exp((double)*p_inputs[0]);
} break;
case VisualScriptBuiltinFunc::MATH_ISNAN: {
VALIDATE_ARG_NUM(0);
- *r_return=Math::is_nan(*p_inputs[0]);
+ *r_return=Math::is_nan((double)*p_inputs[0]);
} break;
case VisualScriptBuiltinFunc::MATH_ISINF: {
VALIDATE_ARG_NUM(0);
- *r_return=Math::is_inf(*p_inputs[0]);
+ *r_return=Math::is_inf((double)*p_inputs[0]);
} break;
case VisualScriptBuiltinFunc::MATH_EASE: {
VALIDATE_ARG_NUM(0);
VALIDATE_ARG_NUM(1);
- *r_return=Math::ease(*p_inputs[0],*p_inputs[1]);
+ *r_return=Math::ease((double)*p_inputs[0],(double)*p_inputs[1]);
} break;
case VisualScriptBuiltinFunc::MATH_DECIMALS: {
VALIDATE_ARG_NUM(0);
- *r_return=Math::step_decimals(*p_inputs[0]);
+ *r_return=Math::step_decimals((double)*p_inputs[0]);
} break;
case VisualScriptBuiltinFunc::MATH_STEPIFY: {
VALIDATE_ARG_NUM(0);
VALIDATE_ARG_NUM(1);
- *r_return=Math::stepify(*p_inputs[0],*p_inputs[1]);
+ *r_return=Math::stepify((double)*p_inputs[0],(double)*p_inputs[1]);
} break;
case VisualScriptBuiltinFunc::MATH_LERP: {
VALIDATE_ARG_NUM(0);
VALIDATE_ARG_NUM(1);
VALIDATE_ARG_NUM(2);
- *r_return=Math::lerp(*p_inputs[0],*p_inputs[1],*p_inputs[2]);
+ *r_return=Math::lerp((double)*p_inputs[0],(double)*p_inputs[1],(double)*p_inputs[2]);
} break;
case VisualScriptBuiltinFunc::MATH_DECTIME: {
VALIDATE_ARG_NUM(0);
VALIDATE_ARG_NUM(1);
VALIDATE_ARG_NUM(2);
- *r_return=Math::dectime(*p_inputs[0],*p_inputs[1],*p_inputs[2]);
+ *r_return=Math::dectime((double)*p_inputs[0],(double)*p_inputs[1],(double)*p_inputs[2]);
} break;
case VisualScriptBuiltinFunc::MATH_RANDOMIZE: {
Math::randomize();
@@ -786,19 +797,19 @@ void VisualScriptBuiltinFunc::exec_func(BuiltinFunc p_func,const Variant** p_inp
VALIDATE_ARG_NUM(0);
VALIDATE_ARG_NUM(1);
- *r_return=Math::random(*p_inputs[0],*p_inputs[1]);
+ *r_return=Math::random((double)*p_inputs[0],(double)*p_inputs[1]);
} break;
case VisualScriptBuiltinFunc::MATH_SEED: {
VALIDATE_ARG_NUM(0);
- uint32_t seed=*p_inputs[0];
+ uint64_t seed=*p_inputs[0];
Math::seed(seed);
} break;
case VisualScriptBuiltinFunc::MATH_RANDSEED: {
VALIDATE_ARG_NUM(0);
- uint32_t seed=*p_inputs[0];
+ uint64_t seed=*p_inputs[0];
int ret = Math::rand_from_seed(&seed);
Array reta;
reta.push_back(ret);
@@ -809,22 +820,22 @@ void VisualScriptBuiltinFunc::exec_func(BuiltinFunc p_func,const Variant** p_inp
case VisualScriptBuiltinFunc::MATH_DEG2RAD: {
VALIDATE_ARG_NUM(0);
- *r_return=Math::deg2rad(*p_inputs[0]);
+ *r_return=Math::deg2rad((double)*p_inputs[0]);
} break;
case VisualScriptBuiltinFunc::MATH_RAD2DEG: {
VALIDATE_ARG_NUM(0);
- *r_return=Math::rad2deg(*p_inputs[0]);
+ *r_return=Math::rad2deg((double)*p_inputs[0]);
} break;
case VisualScriptBuiltinFunc::MATH_LINEAR2DB: {
VALIDATE_ARG_NUM(0);
- *r_return=Math::linear2db(*p_inputs[0]);
+ *r_return=Math::linear2db((double)*p_inputs[0]);
} break;
case VisualScriptBuiltinFunc::MATH_DB2LINEAR: {
VALIDATE_ARG_NUM(0);
- *r_return=Math::db2linear(*p_inputs[0]);
+ *r_return=Math::db2linear((double)*p_inputs[0]);
} break;
case VisualScriptBuiltinFunc::LOGIC_MAX: {
@@ -981,7 +992,7 @@ void VisualScriptBuiltinFunc::exec_func(BuiltinFunc p_func,const Variant** p_inp
case VisualScriptBuiltinFunc::TYPE_EXISTS: {
- *r_return = ObjectTypeDB::type_exists(*p_inputs[0]);
+ *r_return = ClassDB::class_exists(*p_inputs[0]);
} break;
case VisualScriptBuiltinFunc::TEXT_CHAR: {
@@ -1058,7 +1069,7 @@ void VisualScriptBuiltinFunc::exec_func(BuiltinFunc p_func,const Variant** p_inp
case VisualScriptBuiltinFunc::VAR_TO_BYTES: {
- ByteArray barr;
+ PoolByteArray barr;
int len;
Error err = encode_variant(*p_inputs[0],NULL,len);
if (err) {
@@ -1071,7 +1082,7 @@ void VisualScriptBuiltinFunc::exec_func(BuiltinFunc p_func,const Variant** p_inp
barr.resize(len);
{
- ByteArray::Write w = barr.write();
+ PoolByteArray::Write w = barr.write();
encode_variant(*p_inputs[0],w.ptr(),len);
}
@@ -1079,24 +1090,24 @@ void VisualScriptBuiltinFunc::exec_func(BuiltinFunc p_func,const Variant** p_inp
} break;
case VisualScriptBuiltinFunc::BYTES_TO_VAR: {
- if (p_inputs[0]->get_type()!=Variant::RAW_ARRAY) {
+ if (p_inputs[0]->get_type()!=Variant::POOL_BYTE_ARRAY) {
r_error.error=Variant::CallError::CALL_ERROR_INVALID_ARGUMENT;
r_error.argument=0;
- r_error.expected=Variant::RAW_ARRAY;
+ r_error.expected=Variant::POOL_BYTE_ARRAY;
return;
}
- ByteArray varr=*p_inputs[0];
+ PoolByteArray varr=*p_inputs[0];
Variant ret;
{
- ByteArray::Read r=varr.read();
+ PoolByteArray::Read r=varr.read();
Error err = decode_variant(ret,r.ptr(),varr.size(),NULL);
if (err!=OK) {
r_error_str=RTR("Not enough bytes for decoding bytes, or invalid format.");
r_error.error=Variant::CallError::CALL_ERROR_INVALID_ARGUMENT;
r_error.argument=0;
- r_error.expected=Variant::RAW_ARRAY;
+ r_error.expected=Variant::POOL_BYTE_ARRAY;
return;
}
@@ -1105,6 +1116,16 @@ void VisualScriptBuiltinFunc::exec_func(BuiltinFunc p_func,const Variant** p_inp
*r_return=ret;
} break;
+ case VisualScriptBuiltinFunc::COLORN: {
+
+ VALIDATE_ARG_NUM(1);
+
+ Color color = Color::named(*p_inputs[0]);
+ color.a=*p_inputs[1];
+
+ *r_return=String(color);
+
+ } break;
default: {}
}
@@ -1145,8 +1166,8 @@ VisualScriptNodeInstance* VisualScriptBuiltinFunc::instance(VisualScriptInstance
void VisualScriptBuiltinFunc::_bind_methods() {
- ObjectTypeDB::bind_method(_MD("set_func","which"),&VisualScriptBuiltinFunc::set_func);
- ObjectTypeDB::bind_method(_MD("get_func"),&VisualScriptBuiltinFunc::get_func);
+ ClassDB::bind_method(_MD("set_func","which"),&VisualScriptBuiltinFunc::set_func);
+ ClassDB::bind_method(_MD("get_func"),&VisualScriptBuiltinFunc::get_func);
String cc;
@@ -1238,5 +1259,6 @@ void register_visual_script_builtin_func_node() {
VisualScriptLanguage::singleton->add_register_func("functions/built_in/str2var",create_builtin_func_node<VisualScriptBuiltinFunc::STR_TO_VAR>);
VisualScriptLanguage::singleton->add_register_func("functions/built_in/var2bytes",create_builtin_func_node<VisualScriptBuiltinFunc::VAR_TO_BYTES>);
VisualScriptLanguage::singleton->add_register_func("functions/built_in/bytes2var",create_builtin_func_node<VisualScriptBuiltinFunc::BYTES_TO_VAR>);
+ VisualScriptLanguage::singleton->add_register_func("functions/built_in/color_named",create_builtin_func_node<VisualScriptBuiltinFunc::COLORN>);
}
diff --git a/modules/visual_script/visual_script_builtin_funcs.h b/modules/visual_script/visual_script_builtin_funcs.h
index 8b0d70c1ea..a285517c7e 100644
--- a/modules/visual_script/visual_script_builtin_funcs.h
+++ b/modules/visual_script/visual_script_builtin_funcs.h
@@ -6,7 +6,7 @@
class VisualScriptBuiltinFunc : public VisualScriptNode {
- OBJ_TYPE(VisualScriptBuiltinFunc,VisualScriptNode)
+ GDCLASS(VisualScriptBuiltinFunc,VisualScriptNode)
public:
enum BuiltinFunc {
@@ -66,6 +66,7 @@ public:
STR_TO_VAR,
VAR_TO_BYTES,
BYTES_TO_VAR,
+ COLORN,
FUNC_MAX
};
diff --git a/modules/visual_script/visual_script_editor.cpp b/modules/visual_script/visual_script_editor.cpp
index 02d3c453c4..eadc9a8892 100644
--- a/modules/visual_script/visual_script_editor.cpp
+++ b/modules/visual_script/visual_script_editor.cpp
@@ -11,7 +11,7 @@
#ifdef TOOLS_ENABLED
class VisualScriptEditorSignalEdit : public Object {
- OBJ_TYPE(VisualScriptEditorSignalEdit,Object)
+ GDCLASS(VisualScriptEditorSignalEdit,Object)
StringName sig;
public:
@@ -22,7 +22,7 @@ public:
protected:
static void _bind_methods() {
- ObjectTypeDB::bind_method("_sig_changed",&VisualScriptEditorSignalEdit::_sig_changed);
+ ClassDB::bind_method("_sig_changed",&VisualScriptEditorSignalEdit::_sig_changed);
}
void _sig_changed() {
@@ -160,7 +160,7 @@ public:
class VisualScriptEditorVariableEdit : public Object {
- OBJ_TYPE(VisualScriptEditorVariableEdit,Object)
+ GDCLASS(VisualScriptEditorVariableEdit,Object)
StringName var;
public:
@@ -171,8 +171,8 @@ public:
protected:
static void _bind_methods() {
- ObjectTypeDB::bind_method("_var_changed",&VisualScriptEditorVariableEdit::_var_changed);
- ObjectTypeDB::bind_method("_var_value_changed",&VisualScriptEditorVariableEdit::_var_value_changed);
+ ClassDB::bind_method("_var_changed",&VisualScriptEditorVariableEdit::_var_changed);
+ ClassDB::bind_method("_var_value_changed",&VisualScriptEditorVariableEdit::_var_value_changed);
}
void _var_changed() {
@@ -326,11 +326,11 @@ static Color _color_from_type(Variant::Type p_type) {
case Variant::VECTOR2: color = Color::html("bd91f1"); break;
case Variant::RECT2: color = Color::html("f191a5"); break;
case Variant::VECTOR3: color = Color::html("d67dee"); break;
- case Variant::MATRIX32: color = Color::html("c4ec69"); break;
+ case Variant::TRANSFORM2D: color = Color::html("c4ec69"); break;
case Variant::PLANE: color = Color::html("f77070"); break;
case Variant::QUAT: color = Color::html("ec69a3"); break;
- case Variant::_AABB: color = Color::html("ee7991"); break;
- case Variant::MATRIX3: color = Color::html("e3ec69"); break;
+ case Variant::RECT3: color = Color::html("ee7991"); break;
+ case Variant::BASIS: color = Color::html("e3ec69"); break;
case Variant::TRANSFORM: color = Color::html("f6a86e"); break;
case Variant::COLOR: color = Color::html("9dff70"); break;
@@ -342,13 +342,13 @@ static Color _color_from_type(Variant::Type p_type) {
case Variant::DICTIONARY: color = Color::html("77edb1"); break;
case Variant::ARRAY: color = Color::html("e0e0e0"); break;
- case Variant::RAW_ARRAY: color = Color::html("aaf4c8"); break;
- case Variant::INT_ARRAY: color = Color::html("afdcf5"); break;
- case Variant::REAL_ARRAY: color = Color::html("97e7f8"); break;
- case Variant::STRING_ARRAY: color = Color::html("9dc4f2"); break;
- case Variant::VECTOR2_ARRAY: color = Color::html("d1b3f5"); break;
- case Variant::VECTOR3_ARRAY: color = Color::html("df9bf2"); break;
- case Variant::COLOR_ARRAY: color = Color::html("e9ff97"); break;
+ case Variant::POOL_BYTE_ARRAY: color = Color::html("aaf4c8"); break;
+ case Variant::POOL_INT_ARRAY: color = Color::html("afdcf5"); break;
+ case Variant::POOL_REAL_ARRAY: color = Color::html("97e7f8"); break;
+ case Variant::POOL_STRING_ARRAY: color = Color::html("9dc4f2"); break;
+ case Variant::POOL_VECTOR2_ARRAY: color = Color::html("d1b3f5"); break;
+ case Variant::POOL_VECTOR3_ARRAY: color = Color::html("df9bf2"); break;
+ case Variant::POOL_COLOR_ARRAY: color = Color::html("e9ff97"); break;
default:
color.set_hsv(p_type/float(Variant::VARIANT_MAX),0.7,0.7);
@@ -438,11 +438,11 @@ void VisualScriptEditor::_update_graph(int p_only_id) {
Control::get_icon("MiniVector2","EditorIcons"),
Control::get_icon("MiniRect2","EditorIcons"),
Control::get_icon("MiniVector3","EditorIcons"),
- Control::get_icon("MiniMatrix32","EditorIcons"),
+ Control::get_icon("MiniTransform2D","EditorIcons"),
Control::get_icon("MiniPlane","EditorIcons"),
Control::get_icon("MiniQuat","EditorIcons"),
Control::get_icon("MiniAabb","EditorIcons"),
- Control::get_icon("MiniMatrix3","EditorIcons"),
+ Control::get_icon("MiniBasis","EditorIcons"),
Control::get_icon("MiniTransform","EditorIcons"),
Control::get_icon("MiniColor","EditorIcons"),
Control::get_icon("MiniImage","EditorIcons"),
@@ -485,8 +485,8 @@ void VisualScriptEditor::_update_graph(int p_only_id) {
gnode->set_overlay(GraphNode::OVERLAY_BREAKPOINT);
}
- if (EditorSettings::get_singleton()->has("visual_script_editor/color_"+node->get_category())) {
- gnode->set_modulate(EditorSettings::get_singleton()->get("visual_script_editor/color_"+node->get_category()));
+ if (EditorSettings::get_singleton()->has("editors/visual_script/color_"+node->get_category())) {
+ gnode->set_modulate(EditorSettings::get_singleton()->get("editors/visual_script/color_"+node->get_category()));
}
@@ -590,9 +590,9 @@ void VisualScriptEditor::_update_graph(int p_only_id) {
t=type_icons[left_type];
}
if (t.is_valid()) {
- TextureFrame *tf = memnew(TextureFrame);
+ TextureRect *tf = memnew(TextureRect);
tf->set_texture(t);
- tf->set_stretch_mode(TextureFrame::STRETCH_KEEP_CENTERED);
+ tf->set_stretch_mode(TextureRect::STRETCH_KEEP_CENTERED);
hbc->add_child(tf);
}
@@ -657,9 +657,9 @@ void VisualScriptEditor::_update_graph(int p_only_id) {
t=type_icons[right_type];
}
if (t.is_valid()) {
- TextureFrame *tf = memnew(TextureFrame);
+ TextureRect *tf = memnew(TextureRect);
tf->set_texture(t);
- tf->set_stretch_mode(TextureFrame::STRETCH_KEEP_CENTERED);
+ tf->set_stretch_mode(TextureRect::STRETCH_KEEP_CENTERED);
hbc->add_child(tf);
}
@@ -822,7 +822,7 @@ void VisualScriptEditor::_member_selected() {
selected=ti->get_metadata(0);
-// print_line("selected: "+String(selected));
+ //print_line("selected: "+String(selected));
if (ti->get_parent()==members->get_root()->get_children()) {
@@ -990,7 +990,7 @@ void VisualScriptEditor::_member_button(Object *p_item, int p_column, int p_butt
virtuals_in_menu.clear();
List<MethodInfo> mi;
- ObjectTypeDB::get_method_list(script->get_instance_base_type(),&mi);
+ ClassDB::get_method_list(script->get_instance_base_type(),&mi);
for (List<MethodInfo>::Element *E=mi.front();E;E=E->next()) {
MethodInfo mi=E->get();
if (mi.flags&METHOD_FLAG_VIRTUAL) {
@@ -1136,9 +1136,11 @@ void VisualScriptEditor::_member_button(Object *p_item, int p_column, int p_butt
undo_redo->add_undo_method(script.ptr(),"data_connect",name,E->get().from_node,E->get().from_port,E->get().to_node,E->get().to_port);
}
- //for(int i=0;i<script->function_get_argument_count(name);i++) {
- //// undo_redo->add_undo_method(script.ptr(),"function_add_argument",name,script->function_get_argument_name(name,i),script->function_get_argument_type(name,i));
- //}
+ /*
+ for(int i=0;i<script->function_get_argument_count(name);i++) {
+ undo_redo->add_undo_method(script.ptr(),"function_add_argument",name,script->function_get_argument_name(name,i),script->function_get_argument_type(name,i));
+ }
+ */
undo_redo->add_do_method(this,"_update_members");
undo_redo->add_undo_method(this,"_update_members");
undo_redo->add_do_method(this,"_update_graph");
@@ -1776,7 +1778,7 @@ void VisualScriptEditor::drop_data_fw(const Point2& p_point,const Variant& p_dat
if (node) {
graph->set_selected(node);
_node_selected(node);
- }
+ }
}
if (d.has("type") && String(d["type"])=="resource") {
@@ -1916,8 +1918,8 @@ void VisualScriptEditor::drop_data_fw(const Point2& p_point,const Variant& p_dat
Ref<VisualScriptFunctionCall> call;
call.instance();
call->set_call_mode(VisualScriptFunctionCall::CALL_MODE_NODE_PATH);
- call->set_base_path(sn->get_path_to(node));;
- call->set_base_type(node->get_type());
+ call->set_base_path(sn->get_path_to(node));
+ call->set_base_type(node->get_class());
n=call;
method_select->select_method_from_instance(node);
@@ -1986,7 +1988,7 @@ void VisualScriptEditor::drop_data_fw(const Point2& p_point,const Variant& p_dat
Ref<VisualScriptPropertySet> pset;
pset.instance();
pset->set_call_mode(VisualScriptPropertySet::CALL_MODE_INSTANCE);
- pset->set_base_type(obj->get_type());
+ pset->set_base_type(obj->get_class());
/*if (use_value) {
pset->set_use_builtin_value(true);
pset->set_builtin_value(d["value"]);
@@ -1997,7 +1999,7 @@ void VisualScriptEditor::drop_data_fw(const Point2& p_point,const Variant& p_dat
Ref<VisualScriptPropertyGet> pget;
pget.instance();
pget->set_call_mode(VisualScriptPropertyGet::CALL_MODE_INSTANCE);
- pget->set_base_type(obj->get_type());
+ pget->set_base_type(obj->get_class());
vnode=pget;
@@ -2171,7 +2173,7 @@ String VisualScriptEditor::get_name(){
} else if (script->get_name()!="")
name=script->get_name();
else
- name=script->get_type()+"("+itos(script->get_instance_ID())+")";
+ name=script->get_class()+"("+itos(script->get_instance_ID())+")";
return name;
@@ -2321,7 +2323,7 @@ bool VisualScriptEditor::goto_method(const String& p_method){
return true;
}
-void VisualScriptEditor::add_callback(const String& p_function,StringArray p_args){
+void VisualScriptEditor::add_callback(const String& p_function,PoolStringArray p_args){
if (script->has_function(p_function)) {
edited_func=p_function;
@@ -2704,7 +2706,7 @@ VisualScriptNode::TypeGuess VisualScriptEditor::_guess_output_type(int p_node,i
if (obj) {
g.type=Variant::OBJECT;
- g.obj_type=obj->get_type();
+ g.GDCLASS=obj->get_class();
g.script=obj->get_script();
}
}
@@ -2745,8 +2747,8 @@ void VisualScriptEditor::_port_action_menu(int p_option) {
if (tg.type==Variant::OBJECT) {
n->set_call_mode(VisualScriptFunctionCall::CALL_MODE_INSTANCE);
- if (tg.obj_type!=StringName()) {
- n->set_base_type(tg.obj_type);
+ if (tg.GDCLASS!=StringName()) {
+ n->set_base_type(tg.GDCLASS);
} else {
n->set_base_type("Object");
}
@@ -2780,8 +2782,8 @@ void VisualScriptEditor::_port_action_menu(int p_option) {
if (tg.type==Variant::OBJECT) {
n->set_call_mode(VisualScriptPropertySet::CALL_MODE_INSTANCE);
- if (tg.obj_type!=StringName()) {
- n->set_base_type(tg.obj_type);
+ if (tg.GDCLASS!=StringName()) {
+ n->set_base_type(tg.GDCLASS);
} else {
n->set_base_type("Object");
}
@@ -2811,8 +2813,8 @@ void VisualScriptEditor::_port_action_menu(int p_option) {
if (tg.type==Variant::OBJECT) {
n->set_call_mode(VisualScriptPropertyGet::CALL_MODE_INSTANCE);
- if (tg.obj_type!=StringName()) {
- n->set_base_type(tg.obj_type);
+ if (tg.GDCLASS!=StringName()) {
+ n->set_base_type(tg.GDCLASS);
} else {
n->set_base_type("Object");
}
@@ -3082,7 +3084,7 @@ void VisualScriptEditor::_menu_option(int p_what) {
//popup disappearing grabs focus to owner, so use call deferred
node_filter->call_deferred("grab_focus");
node_filter->call_deferred("select_all");
- } break;
+ } break;
case EDIT_COPY_NODES:
case EDIT_CUT_NODES: {
@@ -3232,55 +3234,55 @@ void VisualScriptEditor::_menu_option(int p_what) {
void VisualScriptEditor::_bind_methods() {
- ObjectTypeDB::bind_method("_member_button",&VisualScriptEditor::_member_button);
- ObjectTypeDB::bind_method("_member_edited",&VisualScriptEditor::_member_edited);
- ObjectTypeDB::bind_method("_member_selected",&VisualScriptEditor::_member_selected);
- ObjectTypeDB::bind_method("_update_members",&VisualScriptEditor::_update_members);
- ObjectTypeDB::bind_method("_change_base_type",&VisualScriptEditor::_change_base_type);
- ObjectTypeDB::bind_method("_change_base_type_callback",&VisualScriptEditor::_change_base_type_callback);
- ObjectTypeDB::bind_method("_override_pressed",&VisualScriptEditor::_override_pressed);
- ObjectTypeDB::bind_method("_node_selected",&VisualScriptEditor::_node_selected);
- ObjectTypeDB::bind_method("_node_moved",&VisualScriptEditor::_node_moved);
- ObjectTypeDB::bind_method("_move_node",&VisualScriptEditor::_move_node);
- ObjectTypeDB::bind_method("_begin_node_move",&VisualScriptEditor::_begin_node_move);
- ObjectTypeDB::bind_method("_end_node_move",&VisualScriptEditor::_end_node_move);
- ObjectTypeDB::bind_method("_remove_node",&VisualScriptEditor::_remove_node);
- ObjectTypeDB::bind_method("_update_graph",&VisualScriptEditor::_update_graph,DEFVAL(-1));
- ObjectTypeDB::bind_method("_node_ports_changed",&VisualScriptEditor::_node_ports_changed);
- ObjectTypeDB::bind_method("_available_node_doubleclicked",&VisualScriptEditor::_available_node_doubleclicked);
- ObjectTypeDB::bind_method("_default_value_edited",&VisualScriptEditor::_default_value_edited);
- ObjectTypeDB::bind_method("_default_value_changed",&VisualScriptEditor::_default_value_changed);
- ObjectTypeDB::bind_method("_menu_option",&VisualScriptEditor::_menu_option);
- ObjectTypeDB::bind_method("_graph_ofs_changed",&VisualScriptEditor::_graph_ofs_changed);
- ObjectTypeDB::bind_method("_center_on_node",&VisualScriptEditor::_center_on_node);
- ObjectTypeDB::bind_method("_comment_node_resized",&VisualScriptEditor::_comment_node_resized);
- ObjectTypeDB::bind_method("_button_resource_previewed",&VisualScriptEditor::_button_resource_previewed);
- ObjectTypeDB::bind_method("_port_action_menu",&VisualScriptEditor::_port_action_menu);
- ObjectTypeDB::bind_method("_selected_connect_node_method_or_setget",&VisualScriptEditor::_selected_connect_node_method_or_setget);
- ObjectTypeDB::bind_method("_expression_text_changed",&VisualScriptEditor::_expression_text_changed);
+ ClassDB::bind_method("_member_button",&VisualScriptEditor::_member_button);
+ ClassDB::bind_method("_member_edited",&VisualScriptEditor::_member_edited);
+ ClassDB::bind_method("_member_selected",&VisualScriptEditor::_member_selected);
+ ClassDB::bind_method("_update_members",&VisualScriptEditor::_update_members);
+ ClassDB::bind_method("_change_base_type",&VisualScriptEditor::_change_base_type);
+ ClassDB::bind_method("_change_base_type_callback",&VisualScriptEditor::_change_base_type_callback);
+ ClassDB::bind_method("_override_pressed",&VisualScriptEditor::_override_pressed);
+ ClassDB::bind_method("_node_selected",&VisualScriptEditor::_node_selected);
+ ClassDB::bind_method("_node_moved",&VisualScriptEditor::_node_moved);
+ ClassDB::bind_method("_move_node",&VisualScriptEditor::_move_node);
+ ClassDB::bind_method("_begin_node_move",&VisualScriptEditor::_begin_node_move);
+ ClassDB::bind_method("_end_node_move",&VisualScriptEditor::_end_node_move);
+ ClassDB::bind_method("_remove_node",&VisualScriptEditor::_remove_node);
+ ClassDB::bind_method("_update_graph",&VisualScriptEditor::_update_graph,DEFVAL(-1));
+ ClassDB::bind_method("_node_ports_changed",&VisualScriptEditor::_node_ports_changed);
+ ClassDB::bind_method("_available_node_doubleclicked",&VisualScriptEditor::_available_node_doubleclicked);
+ ClassDB::bind_method("_default_value_edited",&VisualScriptEditor::_default_value_edited);
+ ClassDB::bind_method("_default_value_changed",&VisualScriptEditor::_default_value_changed);
+ ClassDB::bind_method("_menu_option",&VisualScriptEditor::_menu_option);
+ ClassDB::bind_method("_graph_ofs_changed",&VisualScriptEditor::_graph_ofs_changed);
+ ClassDB::bind_method("_center_on_node",&VisualScriptEditor::_center_on_node);
+ ClassDB::bind_method("_comment_node_resized",&VisualScriptEditor::_comment_node_resized);
+ ClassDB::bind_method("_button_resource_previewed",&VisualScriptEditor::_button_resource_previewed);
+ ClassDB::bind_method("_port_action_menu",&VisualScriptEditor::_port_action_menu);
+ ClassDB::bind_method("_selected_connect_node_method_or_setget",&VisualScriptEditor::_selected_connect_node_method_or_setget);
+ ClassDB::bind_method("_expression_text_changed",&VisualScriptEditor::_expression_text_changed);
- ObjectTypeDB::bind_method("get_drag_data_fw",&VisualScriptEditor::get_drag_data_fw);
- ObjectTypeDB::bind_method("can_drop_data_fw",&VisualScriptEditor::can_drop_data_fw);
- ObjectTypeDB::bind_method("drop_data_fw",&VisualScriptEditor::drop_data_fw);
+ ClassDB::bind_method("get_drag_data_fw",&VisualScriptEditor::get_drag_data_fw);
+ ClassDB::bind_method("can_drop_data_fw",&VisualScriptEditor::can_drop_data_fw);
+ ClassDB::bind_method("drop_data_fw",&VisualScriptEditor::drop_data_fw);
- ObjectTypeDB::bind_method("_input",&VisualScriptEditor::_input);
- ObjectTypeDB::bind_method("_on_nodes_delete",&VisualScriptEditor::_on_nodes_delete);
- ObjectTypeDB::bind_method("_on_nodes_duplicate",&VisualScriptEditor::_on_nodes_duplicate);
+ ClassDB::bind_method("_input",&VisualScriptEditor::_input);
+ ClassDB::bind_method("_on_nodes_delete",&VisualScriptEditor::_on_nodes_delete);
+ ClassDB::bind_method("_on_nodes_duplicate",&VisualScriptEditor::_on_nodes_duplicate);
- ObjectTypeDB::bind_method("_hide_timer",&VisualScriptEditor::_hide_timer);
+ ClassDB::bind_method("_hide_timer",&VisualScriptEditor::_hide_timer);
- ObjectTypeDB::bind_method("_graph_connected",&VisualScriptEditor::_graph_connected);
- ObjectTypeDB::bind_method("_graph_disconnected",&VisualScriptEditor::_graph_disconnected);
- ObjectTypeDB::bind_method("_graph_connect_to_empty",&VisualScriptEditor::_graph_connect_to_empty);
+ ClassDB::bind_method("_graph_connected",&VisualScriptEditor::_graph_connected);
+ ClassDB::bind_method("_graph_disconnected",&VisualScriptEditor::_graph_disconnected);
+ ClassDB::bind_method("_graph_connect_to_empty",&VisualScriptEditor::_graph_connect_to_empty);
- ObjectTypeDB::bind_method("_update_graph_connections",&VisualScriptEditor::_update_graph_connections);
- ObjectTypeDB::bind_method("_node_filter_changed",&VisualScriptEditor::_node_filter_changed);
+ ClassDB::bind_method("_update_graph_connections",&VisualScriptEditor::_update_graph_connections);
+ ClassDB::bind_method("_node_filter_changed",&VisualScriptEditor::_node_filter_changed);
- ObjectTypeDB::bind_method("_selected_method",&VisualScriptEditor::_selected_method);
- ObjectTypeDB::bind_method("_draw_color_over_button",&VisualScriptEditor::_draw_color_over_button);
+ ClassDB::bind_method("_selected_method",&VisualScriptEditor::_selected_method);
+ ClassDB::bind_method("_draw_color_over_button",&VisualScriptEditor::_draw_color_over_button);
@@ -3306,7 +3308,7 @@ VisualScriptEditor::VisualScriptEditor() {
edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("visual_script_editor/cut_nodes"), EDIT_CUT_NODES);
edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("visual_script_editor/paste_nodes"), EDIT_PASTE_NODES);
- edit_menu->get_popup()->connect("item_pressed",this,"_menu_option");
+ edit_menu->get_popup()->connect("id_pressed",this,"_menu_option");
main_hsplit = memnew( HSplitContainer );
add_child(main_hsplit);
@@ -3346,8 +3348,8 @@ VisualScriptEditor::VisualScriptEditor() {
node_filter->connect("text_changed",this,"_node_filter_changed");
hbc_nodes->add_child(node_filter);
node_filter->set_h_size_flags(SIZE_EXPAND_FILL);
- node_filter_icon = memnew( TextureFrame );
- node_filter_icon->set_stretch_mode(TextureFrame::STRETCH_KEEP_CENTERED);
+ node_filter_icon = memnew( TextureRect );
+ node_filter_icon->set_stretch_mode(TextureRect::STRETCH_KEEP_CENTERED);
hbc_nodes->add_child(node_filter_icon);
vbc_nodes->add_child(hbc_nodes);
@@ -3422,7 +3424,7 @@ VisualScriptEditor::VisualScriptEditor() {
edit_signal_edit = memnew( PropertyEditor );
edit_signal_edit->hide_top_label();
edit_signal_dialog->add_child(edit_signal_edit);
- edit_signal_dialog->set_child_rect(edit_signal_edit);
+
edit_signal_edit->edit(signal_editor);
edit_variable_dialog = memnew( AcceptDialog );
@@ -3434,7 +3436,7 @@ VisualScriptEditor::VisualScriptEditor() {
edit_variable_edit = memnew( PropertyEditor );
edit_variable_edit->hide_top_label();
edit_variable_dialog->add_child(edit_variable_edit);
- edit_variable_dialog->set_child_rect(edit_variable_edit);
+
edit_variable_edit->edit(variable_editor);
select_base_type=memnew(CreateDialog);
@@ -3446,7 +3448,7 @@ VisualScriptEditor::VisualScriptEditor() {
undo_redo = EditorNode::get_singleton()->get_undo_redo();
new_function_menu = memnew( PopupMenu );
- new_function_menu->connect("item_pressed",this,"_override_pressed");
+ new_function_menu->connect("id_pressed",this,"_override_pressed");
add_child(new_function_menu);
updating_members=false;
@@ -3468,7 +3470,7 @@ VisualScriptEditor::VisualScriptEditor() {
port_action_popup = memnew( PopupMenu );
add_child(port_action_popup);
- port_action_popup->connect("item_pressed",this,"_port_action_menu");
+ port_action_popup->connect("id_pressed",this,"_port_action_menu");
}
@@ -3500,12 +3502,12 @@ void VisualScriptEditor::free_clipboard() {
static void register_editor_callback() {
ScriptEditor::register_create_script_editor_function(create_editor);
- EditorSettings::get_singleton()->set("visual_script_editor/color_functions",Color(1,0.9,0.9));
- EditorSettings::get_singleton()->set("visual_script_editor/color_data",Color(0.9,1.0,0.9));
- EditorSettings::get_singleton()->set("visual_script_editor/color_operators",Color(0.9,0.9,1.0));
- EditorSettings::get_singleton()->set("visual_script_editor/color_flow_control",Color(1.0,1.0,0.8));
- EditorSettings::get_singleton()->set("visual_script_editor/color_custom",Color(0.8,1.0,1.0));
- EditorSettings::get_singleton()->set("visual_script_editor/color_constants",Color(1.0,0.8,1.0));
+ EditorSettings::get_singleton()->set("editors/visual_script/color_functions",Color(1,0.9,0.9));
+ EditorSettings::get_singleton()->set("editors/visual_script/color_data",Color(0.9,1.0,0.9));
+ EditorSettings::get_singleton()->set("editors/visual_script/color_operators",Color(0.9,0.9,1.0));
+ EditorSettings::get_singleton()->set("editors/visual_script/color_flow_control",Color(1.0,1.0,0.8));
+ EditorSettings::get_singleton()->set("editors/visual_script/color_custom",Color(0.8,1.0,1.0));
+ EditorSettings::get_singleton()->set("editors/visual_script/color_constants",Color(1.0,0.8,1.0));
ED_SHORTCUT("visual_script_editor/delete_selected", TTR("Delete Selected"));
diff --git a/modules/visual_script/visual_script_editor.h b/modules/visual_script/visual_script_editor.h
index 483ae1644c..1dc62b3e69 100644
--- a/modules/visual_script/visual_script_editor.h
+++ b/modules/visual_script/visual_script_editor.h
@@ -15,7 +15,7 @@ class VisualScriptEditorVariableEdit;
class VisualScriptEditor : public ScriptEditorBase {
- OBJ_TYPE(VisualScriptEditor,ScriptEditorBase)
+ GDCLASS(VisualScriptEditor,ScriptEditorBase)
enum {
TYPE_SEQUENCE=1000,
@@ -58,7 +58,7 @@ class VisualScriptEditor : public ScriptEditorBase {
GraphEdit *graph;
LineEdit *node_filter;
- TextureFrame *node_filter_icon;
+ TextureRect *node_filter_icon;
VisualScriptEditorSignalEdit *signal_editor;
@@ -225,7 +225,7 @@ public:
virtual void reload(bool p_soft);
virtual void get_breakpoints(List<int> *p_breakpoints);
virtual bool goto_method(const String& p_method);
- virtual void add_callback(const String& p_function,StringArray p_args);
+ virtual void add_callback(const String& p_function,PoolStringArray p_args);
virtual void update_settings();
virtual void set_debugger_active(bool p_active);
virtual void set_tooltip_request_func(String p_method,Object* p_obj);
diff --git a/modules/visual_script/visual_script_expression.h b/modules/visual_script/visual_script_expression.h
index 4edae133c7..a67656a4b1 100644
--- a/modules/visual_script/visual_script_expression.h
+++ b/modules/visual_script/visual_script_expression.h
@@ -6,7 +6,7 @@
class VisualScriptExpression : public VisualScriptNode {
- OBJ_TYPE(VisualScriptExpression,VisualScriptNode)
+ GDCLASS(VisualScriptExpression,VisualScriptNode)
friend class VisualScriptNodeInstanceExpression;
struct Input {
diff --git a/modules/visual_script/visual_script_flow_control.cpp b/modules/visual_script/visual_script_flow_control.cpp
index 97338da187..0e526f8a42 100644
--- a/modules/visual_script/visual_script_flow_control.cpp
+++ b/modules/visual_script/visual_script_flow_control.cpp
@@ -81,10 +81,10 @@ bool VisualScriptReturn::is_return_value_enabled() const {
void VisualScriptReturn::_bind_methods() {
- ObjectTypeDB::bind_method(_MD("set_return_type","type"),&VisualScriptReturn::set_return_type);
- ObjectTypeDB::bind_method(_MD("get_return_type"),&VisualScriptReturn::get_return_type);
- ObjectTypeDB::bind_method(_MD("set_enable_return_value","enable"),&VisualScriptReturn::set_enable_return_value);
- ObjectTypeDB::bind_method(_MD("is_return_value_enabled"),&VisualScriptReturn::is_return_value_enabled);
+ ClassDB::bind_method(_MD("set_return_type","type"),&VisualScriptReturn::set_return_type);
+ ClassDB::bind_method(_MD("get_return_type"),&VisualScriptReturn::get_return_type);
+ ClassDB::bind_method(_MD("set_enable_return_value","enable"),&VisualScriptReturn::set_enable_return_value);
+ ClassDB::bind_method(_MD("is_return_value_enabled"),&VisualScriptReturn::is_return_value_enabled);
String argt="Any";
for(int i=1;i<Variant::VARIANT_MAX;i++) {
@@ -544,8 +544,8 @@ int VisualScriptSequence::get_steps() const {
void VisualScriptSequence::_bind_methods() {
- ObjectTypeDB::bind_method(_MD("set_steps","steps"),&VisualScriptSequence::set_steps);
- ObjectTypeDB::bind_method(_MD("get_steps"),&VisualScriptSequence::get_steps);
+ ClassDB::bind_method(_MD("set_steps","steps"),&VisualScriptSequence::set_steps);
+ ClassDB::bind_method(_MD("get_steps"),&VisualScriptSequence::get_steps);
ADD_PROPERTY(PropertyInfo(Variant::INT,"steps",PROPERTY_HINT_RANGE,"1,64,1"),_SCS("set_steps"),_SCS("get_steps"));
@@ -871,9 +871,9 @@ String VisualScriptInputFilter::get_output_sequence_port_text(int p_port) const
} break;
- case InputEvent::JOYSTICK_MOTION: {
+ case InputEvent::JOYPAD_MOTION: {
- InputEventJoystickMotion jm = filters[p_port].joy_motion;
+ InputEventJoypadMotion jm = filters[p_port].joy_motion;
text="JoyMotion Axis "+itos(jm.axis>>1);
if (jm.axis&1)
@@ -882,8 +882,8 @@ String VisualScriptInputFilter::get_output_sequence_port_text(int p_port) const
text+=" < "+rtos(-jm.axis_value);
} break;
- case InputEvent::JOYSTICK_BUTTON: {
- InputEventJoystickButton jb = filters[p_port].joy_button;
+ case InputEvent::JOYPAD_BUTTON: {
+ InputEventJoypadButton jb = filters[p_port].joy_button;
text="JoyButton "+itos(jb.button_index);
if (jb.pressed)
@@ -908,7 +908,7 @@ String VisualScriptInputFilter::get_output_sequence_port_text(int p_port) const
List<PropertyInfo> pinfo;
- Globals::get_singleton()->get_property_list(&pinfo);
+ GlobalConfig::get_singleton()->get_property_list(&pinfo);
int index=1;
text="No Action";
@@ -985,13 +985,13 @@ bool VisualScriptInputFilter::_set(const StringName& p_name, const Variant& p_va
if (what=="type") {
filters[idx]=InputEvent();
filters[idx].type=InputEvent::Type(int(p_value));
- if (filters[idx].type==InputEvent::JOYSTICK_MOTION) {
+ if (filters[idx].type==InputEvent::JOYPAD_MOTION) {
filters[idx].joy_motion.axis_value=0.5; //for treshold
} else if (filters[idx].type==InputEvent::KEY) {
filters[idx].key.pressed=true; //put these as true to make it more user friendly
} else if (filters[idx].type==InputEvent::MOUSE_BUTTON) {
filters[idx].mouse_button.pressed=true;
- } else if (filters[idx].type==InputEvent::JOYSTICK_BUTTON) {
+ } else if (filters[idx].type==InputEvent::JOYPAD_BUTTON) {
filters[idx].joy_button.pressed=true;
} else if (filters[idx].type==InputEvent::SCREEN_TOUCH) {
filters[idx].screen_touch.pressed=true;
@@ -1108,7 +1108,7 @@ bool VisualScriptInputFilter::_set(const StringName& p_name, const Variant& p_va
return true;
} break;
- case InputEvent::JOYSTICK_MOTION: {
+ case InputEvent::JOYPAD_MOTION: {
if (what=="axis") {
filters[idx].joy_motion.axis=int(p_value)<<1|filters[idx].joy_motion.axis;
@@ -1124,7 +1124,7 @@ bool VisualScriptInputFilter::_set(const StringName& p_name, const Variant& p_va
} break;
- case InputEvent::JOYSTICK_BUTTON: {
+ case InputEvent::JOYPAD_BUTTON: {
if (what=="button_index") {
filters[idx].joy_button.button_index=p_value;
@@ -1164,7 +1164,7 @@ bool VisualScriptInputFilter::_set(const StringName& p_name, const Variant& p_va
if (what=="action_name") {
List<PropertyInfo> pinfo;
- Globals::get_singleton()->get_property_list(&pinfo);
+ GlobalConfig::get_singleton()->get_property_list(&pinfo);
int index=1;
for(List<PropertyInfo>::Element *E=pinfo.front();E;E=E->next()) {
@@ -1326,7 +1326,7 @@ bool VisualScriptInputFilter::_get(const StringName& p_name,Variant &r_ret) cons
return true;
} break;
- case InputEvent::JOYSTICK_MOTION: {
+ case InputEvent::JOYPAD_MOTION: {
if (what=="axis_index") {
r_ret=filters[idx].joy_motion.axis>>1;
@@ -1341,7 +1341,7 @@ bool VisualScriptInputFilter::_get(const StringName& p_name,Variant &r_ret) cons
} break;
- case InputEvent::JOYSTICK_BUTTON: {
+ case InputEvent::JOYPAD_BUTTON: {
if (what=="button_index") {
r_ret=filters[idx].joy_button.button_index;
@@ -1378,7 +1378,7 @@ bool VisualScriptInputFilter::_get(const StringName& p_name,Variant &r_ret) cons
if (what=="action_name") {
List<PropertyInfo> pinfo;
- Globals::get_singleton()->get_property_list(&pinfo);
+ GlobalConfig::get_singleton()->get_property_list(&pinfo);
int index=1;
for(List<PropertyInfo>::Element *E=pinfo.front();E;E=E->next()) {
@@ -1417,8 +1417,8 @@ static const char* event_type_names[InputEvent::TYPE_MAX]={
"Key",
"MouseMotion",
"MouseButton",
- "JoystickMotion",
- "JoystickButton",
+ "JoypadMotion",
+ "JoypadButton",
"ScreenTouch",
"ScreenDrag",
"Action"
@@ -1489,13 +1489,13 @@ void VisualScriptInputFilter::_get_property_list( List<PropertyInfo> *p_list) co
p_list->push_back(PropertyInfo(Variant::BOOL,base+"mod_meta"));
} break;
- case InputEvent::JOYSTICK_MOTION: {
+ case InputEvent::JOYPAD_MOTION: {
p_list->push_back(PropertyInfo(Variant::INT,base+"axis_index"));
p_list->push_back(PropertyInfo(Variant::INT,base+"mode",PROPERTY_HINT_ENUM,"Min,Max"));
p_list->push_back(PropertyInfo(Variant::REAL,base+"treshold",PROPERTY_HINT_RANGE,"0,1,0.01"));
} break;
- case InputEvent::JOYSTICK_BUTTON: {
+ case InputEvent::JOYPAD_BUTTON: {
p_list->push_back(PropertyInfo(Variant::INT,base+"button_index"));
p_list->push_back(PropertyInfo(Variant::BOOL,base+"pressed"));
@@ -1517,7 +1517,7 @@ void VisualScriptInputFilter::_get_property_list( List<PropertyInfo> *p_list) co
actions="None";
List<PropertyInfo> pinfo;
- Globals::get_singleton()->get_property_list(&pinfo);
+ GlobalConfig::get_singleton()->get_property_list(&pinfo);
Vector<String> al;
for(List<PropertyInfo>::Element *E=pinfo.front();E;E=E->next()) {
@@ -1632,10 +1632,10 @@ public:
} break;
- case InputEvent::JOYSTICK_MOTION: {
+ case InputEvent::JOYPAD_MOTION: {
- InputEventJoystickMotion jm = ie.joy_motion;
- InputEventJoystickMotion jm2 = event.joy_motion;
+ InputEventJoypadMotion jm = ie.joy_motion;
+ InputEventJoypadMotion jm2 = event.joy_motion;
int axis = jm.axis>>1;
@@ -1656,9 +1656,9 @@ public:
} break;
- case InputEvent::JOYSTICK_BUTTON: {
- InputEventJoystickButton jb = ie.joy_button;
- InputEventJoystickButton jb2 = event.joy_button;
+ case InputEvent::JOYPAD_BUTTON: {
+ InputEventJoypadButton jb = ie.joy_button;
+ InputEventJoypadButton jb2 = event.joy_button;
if ( jb.button_index==jb2.button_index &&
jb.pressed == jb2.pressed
@@ -1869,7 +1869,7 @@ public:
return 1; //not found sorry
}
- if (ObjectTypeDB::is_type(obj->get_type_name(),base_type)) {
+ if (ClassDB::is_parent_class(obj->get_class_name(),base_type)) {
*p_outputs[0]=*p_inputs[0]; //copy
return 0;
} else
@@ -1893,11 +1893,11 @@ VisualScriptNodeInstance* VisualScriptTypeCast::instance(VisualScriptInstance* p
void VisualScriptTypeCast::_bind_methods() {
- ObjectTypeDB::bind_method(_MD("set_base_type","type"),&VisualScriptTypeCast::set_base_type);
- ObjectTypeDB::bind_method(_MD("get_base_type"),&VisualScriptTypeCast::get_base_type);
+ ClassDB::bind_method(_MD("set_base_type","type"),&VisualScriptTypeCast::set_base_type);
+ ClassDB::bind_method(_MD("get_base_type"),&VisualScriptTypeCast::get_base_type);
- ObjectTypeDB::bind_method(_MD("set_base_script","path"),&VisualScriptTypeCast::set_base_script);
- ObjectTypeDB::bind_method(_MD("get_base_script"),&VisualScriptTypeCast::get_base_script);
+ ClassDB::bind_method(_MD("set_base_script","path"),&VisualScriptTypeCast::set_base_script);
+ ClassDB::bind_method(_MD("get_base_script"),&VisualScriptTypeCast::get_base_script);
List<String> script_extensions;
diff --git a/modules/visual_script/visual_script_flow_control.h b/modules/visual_script/visual_script_flow_control.h
index e0da84a534..26e981cb1e 100644
--- a/modules/visual_script/visual_script_flow_control.h
+++ b/modules/visual_script/visual_script_flow_control.h
@@ -5,7 +5,7 @@
class VisualScriptReturn : public VisualScriptNode {
- OBJ_TYPE(VisualScriptReturn,VisualScriptNode)
+ GDCLASS(VisualScriptReturn,VisualScriptNode)
Variant::Type type;
@@ -48,7 +48,7 @@ public:
class VisualScriptCondition : public VisualScriptNode {
- OBJ_TYPE(VisualScriptCondition,VisualScriptNode)
+ GDCLASS(VisualScriptCondition,VisualScriptNode)
@@ -84,7 +84,7 @@ public:
class VisualScriptWhile : public VisualScriptNode {
- OBJ_TYPE(VisualScriptWhile,VisualScriptNode)
+ GDCLASS(VisualScriptWhile,VisualScriptNode)
@@ -121,7 +121,7 @@ public:
class VisualScriptIterator : public VisualScriptNode {
- OBJ_TYPE(VisualScriptIterator,VisualScriptNode)
+ GDCLASS(VisualScriptIterator,VisualScriptNode)
@@ -158,7 +158,7 @@ public:
class VisualScriptSequence : public VisualScriptNode {
- OBJ_TYPE(VisualScriptSequence,VisualScriptNode)
+ GDCLASS(VisualScriptSequence,VisualScriptNode)
int steps;
@@ -199,7 +199,7 @@ public:
class VisualScriptSwitch : public VisualScriptNode {
- OBJ_TYPE(VisualScriptSwitch,VisualScriptNode)
+ GDCLASS(VisualScriptSwitch,VisualScriptNode)
struct Case {
Variant::Type type;
@@ -248,7 +248,7 @@ public:
class VisualScriptInputFilter : public VisualScriptNode {
- OBJ_TYPE(VisualScriptInputFilter,VisualScriptNode)
+ GDCLASS(VisualScriptInputFilter,VisualScriptNode)
Vector<InputEvent> filters;
@@ -290,7 +290,7 @@ public:
class VisualScriptTypeCast : public VisualScriptNode {
- OBJ_TYPE(VisualScriptTypeCast,VisualScriptNode)
+ GDCLASS(VisualScriptTypeCast,VisualScriptNode)
StringName base_type;
diff --git a/modules/visual_script/visual_script_func_nodes.cpp b/modules/visual_script/visual_script_func_nodes.cpp
index 5a21cb40e9..a8d78b9298 100644
--- a/modules/visual_script/visual_script_func_nodes.cpp
+++ b/modules/visual_script/visual_script_func_nodes.cpp
@@ -92,7 +92,7 @@ StringName VisualScriptFunctionCall::_get_base_type() const {
else if (call_mode==CALL_MODE_NODE_PATH && get_visual_script().is_valid()) {
Node *path = _get_base_node();
if (path)
- return path->get_type();
+ return path->get_class();
}
@@ -110,7 +110,7 @@ int VisualScriptFunctionCall::get_input_value_port_count() const{
} else {
- MethodBind *mb = ObjectTypeDB::get_method(_get_base_type(),function);
+ MethodBind *mb = ClassDB::get_method(_get_base_type(),function);
if (mb) {
return mb->get_argument_count() + (call_mode==CALL_MODE_INSTANCE?1:0) + (rpc_call_mode>=RPC_RELIABLE_TO_ID?1:0) - use_default_args;
}
@@ -129,7 +129,7 @@ int VisualScriptFunctionCall::get_output_value_port_count() const{
} else {
int ret;
- MethodBind *mb = ObjectTypeDB::get_method(_get_base_type(),function);
+ MethodBind *mb = ClassDB::get_method(_get_base_type(),function);
if (mb) {
ret = mb->has_return() ? 1 : 0;
} else
@@ -182,7 +182,7 @@ PropertyInfo VisualScriptFunctionCall::get_input_value_port_info(int p_idx) cons
} else {
- MethodBind *mb = ObjectTypeDB::get_method(_get_base_type(),function);
+ MethodBind *mb = ClassDB::get_method(_get_base_type(),function);
if (mb) {
return mb->get_argument_info(p_idx);
}
@@ -220,7 +220,7 @@ PropertyInfo VisualScriptFunctionCall::get_output_value_port_info(int p_idx) con
PropertyInfo ret;
- /*MethodBind *mb = ObjectTypeDB::get_method(_get_base_type(),function);
+ /*MethodBind *mb = ClassDB::get_method(_get_base_type(),function);
if (mb) {
ret = mb->get_argument_info(-1);
@@ -332,9 +332,9 @@ void VisualScriptFunctionCall::set_singleton(const StringName& p_path) {
return;
singleton=p_path;
- Object *obj = Globals::get_singleton()->get_singleton_object(singleton);
+ Object *obj = GlobalConfig::get_singleton()->get_singleton_object(singleton);
if (obj) {
- base_type=obj->get_type();
+ base_type=obj->get_class();
}
_change_notify();
@@ -356,7 +356,7 @@ void VisualScriptFunctionCall::_update_method_cache() {
Node* node=_get_base_node();
if (node) {
- type=node->get_type();
+ type=node->get_class();
base_type=type; //cache, too
script = node->get_script();
}
@@ -370,9 +370,9 @@ void VisualScriptFunctionCall::_update_method_cache() {
} else if (call_mode==CALL_MODE_SINGLETON) {
- Object *obj = Globals::get_singleton()->get_singleton_object(singleton);
+ Object *obj = GlobalConfig::get_singleton()->get_singleton_object(singleton);
if (obj) {
- type=obj->get_type();
+ type=obj->get_class();
script=obj->get_script();
}
@@ -396,8 +396,8 @@ void VisualScriptFunctionCall::_update_method_cache() {
}
-// print_line("BASE: "+String(type)+" FUNC: "+String(function));
- MethodBind *mb = ObjectTypeDB::get_method(type,function);
+ //print_line("BASE: "+String(type)+" FUNC: "+String(function));
+ MethodBind *mb = ClassDB::get_method(type,function);
if (mb) {
use_default_args=mb->get_default_argument_count();
method_cache = MethodInfo();
@@ -567,11 +567,11 @@ void VisualScriptFunctionCall::_validate_property(PropertyInfo& property) const
if (call_mode!=CALL_MODE_SINGLETON) {
property.usage=0;
} else {
- List<Globals::Singleton> names;
- Globals::get_singleton()->get_singletons(&names);
+ List<GlobalConfig::Singleton> names;
+ GlobalConfig::get_singleton()->get_singletons(&names);
property.hint=PROPERTY_HINT_ENUM;
String sl;
- for (List<Globals::Singleton>::Element *E=names.front();E;E=E->next()) {
+ for (List<GlobalConfig::Singleton>::Element *E=names.front();E;E=E->next()) {
if (sl!=String())
sl+=",";
sl+=E->get().name;
@@ -607,7 +607,7 @@ void VisualScriptFunctionCall::_validate_property(PropertyInfo& property) const
property.hint_string=itos(get_visual_script()->get_instance_ID());
} else if (call_mode==CALL_MODE_SINGLETON) {
- Object *obj = Globals::get_singleton()->get_singleton_object(singleton);
+ Object *obj = GlobalConfig::get_singleton()->get_singleton_object(singleton);
if (obj) {
property.hint=PROPERTY_HINT_METHOD_OF_INSTANCE;
property.hint_string=itos(obj->get_instance_ID());
@@ -661,7 +661,7 @@ void VisualScriptFunctionCall::_validate_property(PropertyInfo& property) const
mc = Variant::get_method_default_arguments(basic_type,function).size();
} else {
- MethodBind *mb = ObjectTypeDB::get_method(_get_base_type(),function);
+ MethodBind *mb = ClassDB::get_method(_get_base_type(),function);
if (mb) {
mc=mb->get_default_argument_count();
@@ -687,38 +687,38 @@ void VisualScriptFunctionCall::_validate_property(PropertyInfo& property) const
void VisualScriptFunctionCall::_bind_methods() {
- ObjectTypeDB::bind_method(_MD("set_base_type","base_type"),&VisualScriptFunctionCall::set_base_type);
- ObjectTypeDB::bind_method(_MD("get_base_type"),&VisualScriptFunctionCall::get_base_type);
+ ClassDB::bind_method(_MD("set_base_type","base_type"),&VisualScriptFunctionCall::set_base_type);
+ ClassDB::bind_method(_MD("get_base_type"),&VisualScriptFunctionCall::get_base_type);
- ObjectTypeDB::bind_method(_MD("set_base_script","base_script"),&VisualScriptFunctionCall::set_base_script);
- ObjectTypeDB::bind_method(_MD("get_base_script"),&VisualScriptFunctionCall::get_base_script);
+ ClassDB::bind_method(_MD("set_base_script","base_script"),&VisualScriptFunctionCall::set_base_script);
+ ClassDB::bind_method(_MD("get_base_script"),&VisualScriptFunctionCall::get_base_script);
- ObjectTypeDB::bind_method(_MD("set_basic_type","basic_type"),&VisualScriptFunctionCall::set_basic_type);
- ObjectTypeDB::bind_method(_MD("get_basic_type"),&VisualScriptFunctionCall::get_basic_type);
+ ClassDB::bind_method(_MD("set_basic_type","basic_type"),&VisualScriptFunctionCall::set_basic_type);
+ ClassDB::bind_method(_MD("get_basic_type"),&VisualScriptFunctionCall::get_basic_type);
- ObjectTypeDB::bind_method(_MD("set_singleton","singleton"),&VisualScriptFunctionCall::set_singleton);
- ObjectTypeDB::bind_method(_MD("get_singleton"),&VisualScriptFunctionCall::get_singleton);
+ ClassDB::bind_method(_MD("set_singleton","singleton"),&VisualScriptFunctionCall::set_singleton);
+ ClassDB::bind_method(_MD("get_singleton"),&VisualScriptFunctionCall::get_singleton);
- ObjectTypeDB::bind_method(_MD("set_function","function"),&VisualScriptFunctionCall::set_function);
- ObjectTypeDB::bind_method(_MD("get_function"),&VisualScriptFunctionCall::get_function);
+ ClassDB::bind_method(_MD("set_function","function"),&VisualScriptFunctionCall::set_function);
+ ClassDB::bind_method(_MD("get_function"),&VisualScriptFunctionCall::get_function);
- ObjectTypeDB::bind_method(_MD("set_call_mode","mode"),&VisualScriptFunctionCall::set_call_mode);
- ObjectTypeDB::bind_method(_MD("get_call_mode"),&VisualScriptFunctionCall::get_call_mode);
+ ClassDB::bind_method(_MD("set_call_mode","mode"),&VisualScriptFunctionCall::set_call_mode);
+ ClassDB::bind_method(_MD("get_call_mode"),&VisualScriptFunctionCall::get_call_mode);
- ObjectTypeDB::bind_method(_MD("set_base_path","base_path"),&VisualScriptFunctionCall::set_base_path);
- ObjectTypeDB::bind_method(_MD("get_base_path"),&VisualScriptFunctionCall::get_base_path);
+ ClassDB::bind_method(_MD("set_base_path","base_path"),&VisualScriptFunctionCall::set_base_path);
+ ClassDB::bind_method(_MD("get_base_path"),&VisualScriptFunctionCall::get_base_path);
- ObjectTypeDB::bind_method(_MD("set_use_default_args","amount"),&VisualScriptFunctionCall::set_use_default_args);
- ObjectTypeDB::bind_method(_MD("get_use_default_args"),&VisualScriptFunctionCall::get_use_default_args);
+ ClassDB::bind_method(_MD("set_use_default_args","amount"),&VisualScriptFunctionCall::set_use_default_args);
+ ClassDB::bind_method(_MD("get_use_default_args"),&VisualScriptFunctionCall::get_use_default_args);
- ObjectTypeDB::bind_method(_MD("_set_argument_cache","argument_cache"),&VisualScriptFunctionCall::_set_argument_cache);
- ObjectTypeDB::bind_method(_MD("_get_argument_cache"),&VisualScriptFunctionCall::_get_argument_cache);
+ ClassDB::bind_method(_MD("_set_argument_cache","argument_cache"),&VisualScriptFunctionCall::_set_argument_cache);
+ ClassDB::bind_method(_MD("_get_argument_cache"),&VisualScriptFunctionCall::_get_argument_cache);
- ObjectTypeDB::bind_method(_MD("set_rpc_call_mode","mode"),&VisualScriptFunctionCall::set_rpc_call_mode);
- ObjectTypeDB::bind_method(_MD("get_rpc_call_mode"),&VisualScriptFunctionCall::get_rpc_call_mode);
+ ClassDB::bind_method(_MD("set_rpc_call_mode","mode"),&VisualScriptFunctionCall::set_rpc_call_mode);
+ ClassDB::bind_method(_MD("get_rpc_call_mode"),&VisualScriptFunctionCall::get_rpc_call_mode);
- ObjectTypeDB::bind_method(_MD("set_validate","enable"),&VisualScriptFunctionCall::set_validate);
- ObjectTypeDB::bind_method(_MD("get_validate"),&VisualScriptFunctionCall::get_validate);
+ ClassDB::bind_method(_MD("set_validate","enable"),&VisualScriptFunctionCall::set_validate);
+ ClassDB::bind_method(_MD("get_validate"),&VisualScriptFunctionCall::get_validate);
String bt;
for(int i=0;i<Variant::VARIANT_MAX;i++) {
@@ -881,7 +881,7 @@ public:
} break;
case VisualScriptFunctionCall::CALL_MODE_SINGLETON: {
- Object *object=Globals::get_singleton()->get_singleton_object(singleton);
+ Object *object=GlobalConfig::get_singleton()->get_singleton_object(singleton);
if (!object) {
r_error.error=Variant::CallError::CALL_ERROR_INVALID_METHOD;
r_error_str="Invalid singleton name: '"+String(singleton)+"'";
@@ -971,8 +971,8 @@ static const char* event_type_names[InputEvent::TYPE_MAX]={
"Key",
"MouseMotion",
"MouseButton",
- "JoystickMotion",
- "JoystickButton",
+ "JoypadMotion",
+ "JoypadButton",
"ScreenTouch",
"ScreenDrag",
"Action"
@@ -1034,7 +1034,7 @@ StringName VisualScriptPropertySet::_get_base_type() const {
else if (call_mode==CALL_MODE_NODE_PATH && get_visual_script().is_valid()) {
Node *path = _get_base_node();
if (path)
- return path->get_type();
+ return path->get_class();
}
@@ -1122,7 +1122,7 @@ void VisualScriptPropertySet::_update_base_type() {
Node* node=_get_base_node();
if (node) {
- base_type=node->get_type();
+ base_type=node->get_class();
}
} else if (call_mode==CALL_MODE_SELF) {
@@ -1247,7 +1247,7 @@ void VisualScriptPropertySet::_update_cache() {
node=_get_base_node();
if (node) {
- type=node->get_type();
+ type=node->get_class();
base_type=type; //cache, too
script = node->get_script();
}
@@ -1284,7 +1284,7 @@ void VisualScriptPropertySet::_update_cache() {
node->get_property_list(&pinfo);
} else {
- ObjectTypeDB::get_property_list(type,&pinfo);
+ ClassDB::get_property_list(type,&pinfo);
}
if (script.is_valid()) {
@@ -1453,29 +1453,29 @@ void VisualScriptPropertySet::_validate_property(PropertyInfo& property) const {
void VisualScriptPropertySet::_bind_methods() {
- ObjectTypeDB::bind_method(_MD("set_base_type","base_type"),&VisualScriptPropertySet::set_base_type);
- ObjectTypeDB::bind_method(_MD("get_base_type"),&VisualScriptPropertySet::get_base_type);
+ ClassDB::bind_method(_MD("set_base_type","base_type"),&VisualScriptPropertySet::set_base_type);
+ ClassDB::bind_method(_MD("get_base_type"),&VisualScriptPropertySet::get_base_type);
- ObjectTypeDB::bind_method(_MD("set_base_script","base_script"),&VisualScriptPropertySet::set_base_script);
- ObjectTypeDB::bind_method(_MD("get_base_script"),&VisualScriptPropertySet::get_base_script);
+ ClassDB::bind_method(_MD("set_base_script","base_script"),&VisualScriptPropertySet::set_base_script);
+ ClassDB::bind_method(_MD("get_base_script"),&VisualScriptPropertySet::get_base_script);
- ObjectTypeDB::bind_method(_MD("set_basic_type","basic_type"),&VisualScriptPropertySet::set_basic_type);
- ObjectTypeDB::bind_method(_MD("get_basic_type"),&VisualScriptPropertySet::get_basic_type);
+ ClassDB::bind_method(_MD("set_basic_type","basic_type"),&VisualScriptPropertySet::set_basic_type);
+ ClassDB::bind_method(_MD("get_basic_type"),&VisualScriptPropertySet::get_basic_type);
- ObjectTypeDB::bind_method(_MD("_set_type_cache","type_cache"),&VisualScriptPropertySet::_set_type_cache);
- ObjectTypeDB::bind_method(_MD("_get_type_cache"),&VisualScriptPropertySet::_get_type_cache);
+ ClassDB::bind_method(_MD("_set_type_cache","type_cache"),&VisualScriptPropertySet::_set_type_cache);
+ ClassDB::bind_method(_MD("_get_type_cache"),&VisualScriptPropertySet::_get_type_cache);
- ObjectTypeDB::bind_method(_MD("set_event_type","event_type"),&VisualScriptPropertySet::set_event_type);
- ObjectTypeDB::bind_method(_MD("get_event_type"),&VisualScriptPropertySet::get_event_type);
+ ClassDB::bind_method(_MD("set_event_type","event_type"),&VisualScriptPropertySet::set_event_type);
+ ClassDB::bind_method(_MD("get_event_type"),&VisualScriptPropertySet::get_event_type);
- ObjectTypeDB::bind_method(_MD("set_property","property"),&VisualScriptPropertySet::set_property);
- ObjectTypeDB::bind_method(_MD("get_property"),&VisualScriptPropertySet::get_property);
+ ClassDB::bind_method(_MD("set_property","property"),&VisualScriptPropertySet::set_property);
+ ClassDB::bind_method(_MD("get_property"),&VisualScriptPropertySet::get_property);
- ObjectTypeDB::bind_method(_MD("set_call_mode","mode"),&VisualScriptPropertySet::set_call_mode);
- ObjectTypeDB::bind_method(_MD("get_call_mode"),&VisualScriptPropertySet::get_call_mode);
+ ClassDB::bind_method(_MD("set_call_mode","mode"),&VisualScriptPropertySet::set_call_mode);
+ ClassDB::bind_method(_MD("get_call_mode"),&VisualScriptPropertySet::get_call_mode);
- ObjectTypeDB::bind_method(_MD("set_base_path","base_path"),&VisualScriptPropertySet::set_base_path);
- ObjectTypeDB::bind_method(_MD("get_base_path"),&VisualScriptPropertySet::get_base_path);
+ ClassDB::bind_method(_MD("set_base_path","base_path"),&VisualScriptPropertySet::set_base_path);
+ ClassDB::bind_method(_MD("get_base_path"),&VisualScriptPropertySet::get_base_path);
@@ -1554,7 +1554,7 @@ public:
if (!valid) {
r_error.error=Variant::CallError::CALL_ERROR_INVALID_METHOD;
- r_error_str="Invalid set value '"+String(*p_inputs[0])+"' on property '"+String(property)+"' of type "+object->get_type();
+ r_error_str="Invalid set value '"+String(*p_inputs[0])+"' on property '"+String(property)+"' of type "+object->get_class();
}
} break;
case VisualScriptPropertySet::CALL_MODE_NODE_PATH: {
@@ -1579,7 +1579,7 @@ public:
if (!valid) {
r_error.error=Variant::CallError::CALL_ERROR_INVALID_METHOD;
- r_error_str="Invalid set value '"+String(*p_inputs[0])+"' on property '"+String(property)+"' of type "+another->get_type();
+ r_error_str="Invalid set value '"+String(*p_inputs[0])+"' on property '"+String(property)+"' of type "+another->get_class();
}
} break;
@@ -1669,7 +1669,7 @@ void VisualScriptPropertyGet::_update_base_type() {
Node* node=_get_base_node();
if (node) {
- base_type=node->get_type();
+ base_type=node->get_class();
}
} else if (call_mode==CALL_MODE_SELF) {
@@ -1724,7 +1724,7 @@ StringName VisualScriptPropertyGet::_get_base_type() const {
else if (call_mode==CALL_MODE_NODE_PATH && get_visual_script().is_valid()) {
Node *path = _get_base_node();
if (path)
- return path->get_type();
+ return path->get_class();
}
@@ -1868,7 +1868,7 @@ void VisualScriptPropertyGet::_update_cache() {
node=_get_base_node();
if (node) {
- type=node->get_type();
+ type=node->get_class();
base_type=type; //cache, too
script = node->get_script();
}
@@ -1903,7 +1903,7 @@ void VisualScriptPropertyGet::_update_cache() {
Variant::Type type_ret;
- type_ret=ObjectTypeDB::get_property_type(base_type,property,&valid);
+ type_ret=ClassDB::get_property_type(base_type,property,&valid);
if (valid) {
type_cache=type_ret;
@@ -2117,30 +2117,30 @@ void VisualScriptPropertyGet::_validate_property(PropertyInfo& property) const {
void VisualScriptPropertyGet::_bind_methods() {
- ObjectTypeDB::bind_method(_MD("set_base_type","base_type"),&VisualScriptPropertyGet::set_base_type);
- ObjectTypeDB::bind_method(_MD("get_base_type"),&VisualScriptPropertyGet::get_base_type);
+ ClassDB::bind_method(_MD("set_base_type","base_type"),&VisualScriptPropertyGet::set_base_type);
+ ClassDB::bind_method(_MD("get_base_type"),&VisualScriptPropertyGet::get_base_type);
- ObjectTypeDB::bind_method(_MD("set_base_script","base_script"),&VisualScriptPropertyGet::set_base_script);
- ObjectTypeDB::bind_method(_MD("get_base_script"),&VisualScriptPropertyGet::get_base_script);
+ ClassDB::bind_method(_MD("set_base_script","base_script"),&VisualScriptPropertyGet::set_base_script);
+ ClassDB::bind_method(_MD("get_base_script"),&VisualScriptPropertyGet::get_base_script);
- ObjectTypeDB::bind_method(_MD("set_basic_type","basic_type"),&VisualScriptPropertyGet::set_basic_type);
- ObjectTypeDB::bind_method(_MD("get_basic_type"),&VisualScriptPropertyGet::get_basic_type);
+ ClassDB::bind_method(_MD("set_basic_type","basic_type"),&VisualScriptPropertyGet::set_basic_type);
+ ClassDB::bind_method(_MD("get_basic_type"),&VisualScriptPropertyGet::get_basic_type);
- ObjectTypeDB::bind_method(_MD("_set_type_cache","type_cache"),&VisualScriptPropertyGet::_set_type_cache);
- ObjectTypeDB::bind_method(_MD("_get_type_cache"),&VisualScriptPropertyGet::_get_type_cache);
+ ClassDB::bind_method(_MD("_set_type_cache","type_cache"),&VisualScriptPropertyGet::_set_type_cache);
+ ClassDB::bind_method(_MD("_get_type_cache"),&VisualScriptPropertyGet::_get_type_cache);
- ObjectTypeDB::bind_method(_MD("set_event_type","event_type"),&VisualScriptPropertyGet::set_event_type);
- ObjectTypeDB::bind_method(_MD("get_event_type"),&VisualScriptPropertyGet::get_event_type);
+ ClassDB::bind_method(_MD("set_event_type","event_type"),&VisualScriptPropertyGet::set_event_type);
+ ClassDB::bind_method(_MD("get_event_type"),&VisualScriptPropertyGet::get_event_type);
- ObjectTypeDB::bind_method(_MD("set_property","property"),&VisualScriptPropertyGet::set_property);
- ObjectTypeDB::bind_method(_MD("get_property"),&VisualScriptPropertyGet::get_property);
+ ClassDB::bind_method(_MD("set_property","property"),&VisualScriptPropertyGet::set_property);
+ ClassDB::bind_method(_MD("get_property"),&VisualScriptPropertyGet::get_property);
- ObjectTypeDB::bind_method(_MD("set_call_mode","mode"),&VisualScriptPropertyGet::set_call_mode);
- ObjectTypeDB::bind_method(_MD("get_call_mode"),&VisualScriptPropertyGet::get_call_mode);
+ ClassDB::bind_method(_MD("set_call_mode","mode"),&VisualScriptPropertyGet::set_call_mode);
+ ClassDB::bind_method(_MD("get_call_mode"),&VisualScriptPropertyGet::get_call_mode);
- ObjectTypeDB::bind_method(_MD("set_base_path","base_path"),&VisualScriptPropertyGet::set_base_path);
- ObjectTypeDB::bind_method(_MD("get_base_path"),&VisualScriptPropertyGet::get_base_path);
+ ClassDB::bind_method(_MD("set_base_path","base_path"),&VisualScriptPropertyGet::set_base_path);
+ ClassDB::bind_method(_MD("get_base_path"),&VisualScriptPropertyGet::get_base_path);
String bt;
for(int i=0;i<Variant::VARIANT_MAX;i++) {
@@ -2420,8 +2420,8 @@ void VisualScriptEmitSignal::_validate_property(PropertyInfo& property) const {
void VisualScriptEmitSignal::_bind_methods() {
- ObjectTypeDB::bind_method(_MD("set_signal","name"),&VisualScriptEmitSignal::set_signal);
- ObjectTypeDB::bind_method(_MD("get_signal"),&VisualScriptEmitSignal::get_signal);
+ ClassDB::bind_method(_MD("set_signal","name"),&VisualScriptEmitSignal::set_signal);
+ ClassDB::bind_method(_MD("get_signal"),&VisualScriptEmitSignal::get_signal);
ADD_PROPERTY(PropertyInfo(Variant::STRING,"signal/signal"),_SCS("set_signal"),_SCS("get_signal"));
@@ -2508,7 +2508,7 @@ void register_visual_script_func_nodes() {
VisualScriptLanguage::singleton->add_register_func("functions/get",create_node_generic<VisualScriptPropertyGet>);
//VisualScriptLanguage::singleton->add_register_func("functions/call_script/call_self",create_script_call_node<VisualScriptScriptCall::CALL_MODE_SELF>);
-// VisualScriptLanguage::singleton->add_register_func("functions/call_script/call_node",create_script_call_node<VisualScriptScriptCall::CALL_MODE_NODE_PATH>);
+ //VisualScriptLanguage::singleton->add_register_func("functions/call_script/call_node",create_script_call_node<VisualScriptScriptCall::CALL_MODE_NODE_PATH>);
VisualScriptLanguage::singleton->add_register_func("functions/emit_signal",create_node_generic<VisualScriptEmitSignal>);
diff --git a/modules/visual_script/visual_script_func_nodes.h b/modules/visual_script/visual_script_func_nodes.h
index 43ef276cf4..7d33549e21 100644
--- a/modules/visual_script/visual_script_func_nodes.h
+++ b/modules/visual_script/visual_script_func_nodes.h
@@ -6,7 +6,7 @@
class VisualScriptFunctionCall : public VisualScriptNode {
- OBJ_TYPE(VisualScriptFunctionCall,VisualScriptNode)
+ GDCLASS(VisualScriptFunctionCall,VisualScriptNode)
public:
enum CallMode {
CALL_MODE_SELF,
@@ -117,7 +117,7 @@ VARIANT_ENUM_CAST(VisualScriptFunctionCall::RPCCallMode );
class VisualScriptPropertySet : public VisualScriptNode {
- OBJ_TYPE(VisualScriptPropertySet,VisualScriptNode)
+ GDCLASS(VisualScriptPropertySet,VisualScriptNode)
public:
enum CallMode {
CALL_MODE_SELF,
@@ -208,7 +208,7 @@ VARIANT_ENUM_CAST(VisualScriptPropertySet::CallMode );
class VisualScriptPropertyGet : public VisualScriptNode {
- OBJ_TYPE(VisualScriptPropertyGet,VisualScriptNode)
+ GDCLASS(VisualScriptPropertyGet,VisualScriptNode)
public:
enum CallMode {
CALL_MODE_SELF,
@@ -299,7 +299,7 @@ VARIANT_ENUM_CAST(VisualScriptPropertyGet::CallMode );
class VisualScriptEmitSignal : public VisualScriptNode {
- OBJ_TYPE(VisualScriptEmitSignal,VisualScriptNode)
+ GDCLASS(VisualScriptEmitSignal,VisualScriptNode)
private:
diff --git a/modules/visual_script/visual_script_nodes.cpp b/modules/visual_script/visual_script_nodes.cpp
index 7ada292b13..ce33b2e5ae 100644
--- a/modules/visual_script/visual_script_nodes.cpp
+++ b/modules/visual_script/visual_script_nodes.cpp
@@ -334,7 +334,7 @@ bool VisualScriptOperator::has_input_sequence_port() const{
int VisualScriptOperator::get_input_value_port_count() const{
- return (op==Variant::OP_BIT_NEGATE || op==Variant::OP_NOT || op==Variant::OP_NEGATE) ? 1 : 2;
+ return (op==Variant::OP_BIT_NEGATE || op==Variant::OP_NOT || op==Variant::OP_NEGATE || op==Variant::OP_POSITIVE) ? 1 : 2;
}
int VisualScriptOperator::get_output_value_port_count() const{
@@ -361,6 +361,7 @@ PropertyInfo VisualScriptOperator::get_input_value_port_info(int p_idx) const{
{Variant::NIL,Variant::NIL}, //OP_MULTIPLY,
{Variant::NIL,Variant::NIL}, //OP_DIVIDE,
{Variant::NIL,Variant::NIL}, //OP_NEGATE,
+ {Variant::NIL,Variant::NIL}, //OP_POSITIVE,
{Variant::INT,Variant::INT}, //OP_MODULE,
{Variant::STRING,Variant::STRING}, //OP_STRING_CONCAT,
//bitwise
@@ -403,6 +404,7 @@ PropertyInfo VisualScriptOperator::get_output_value_port_info(int p_idx) const{
Variant::NIL, //OP_MULTIPLY,
Variant::NIL, //OP_DIVIDE,
Variant::NIL, //OP_NEGATE,
+ Variant::NIL, //OP_POSITIVE,
Variant::INT, //OP_MODULE,
Variant::STRING, //OP_STRING_CONCAT,
//bitwise
@@ -444,6 +446,7 @@ static const char* op_names[]={
"Multiply", //OP_MULTIPLY,
"Divide", //OP_DIVIDE,
"Negate", //OP_NEGATE,
+ "Positive", //OP_POSITIVE,
"Remainder", //OP_MODULE,
"Concat", //OP_STRING_CONCAT,
//bitwise
@@ -485,6 +488,7 @@ String VisualScriptOperator::get_text() const {
L"A x B", //OP_MULTIPLY,
L"A \u00F7 B", //OP_DIVIDE,
L"\u00AC A", //OP_NEGATE,
+ L"+ A", //OP_POSITIVE,
L"A mod B", //OP_MODULE,
L"A .. B", //OP_STRING_CONCAT,
//bitwise
@@ -535,11 +539,11 @@ Variant::Type VisualScriptOperator::get_typed() const {
void VisualScriptOperator::_bind_methods() {
- ObjectTypeDB::bind_method(_MD("set_operator","op"),&VisualScriptOperator::set_operator);
- ObjectTypeDB::bind_method(_MD("get_operator"),&VisualScriptOperator::get_operator);
+ ClassDB::bind_method(_MD("set_operator","op"),&VisualScriptOperator::set_operator);
+ ClassDB::bind_method(_MD("get_operator"),&VisualScriptOperator::get_operator);
- ObjectTypeDB::bind_method(_MD("set_typed","type"),&VisualScriptOperator::set_typed);
- ObjectTypeDB::bind_method(_MD("get_typed"),&VisualScriptOperator::get_typed);
+ ClassDB::bind_method(_MD("set_typed","type"),&VisualScriptOperator::set_typed);
+ ClassDB::bind_method(_MD("get_typed"),&VisualScriptOperator::get_typed);
String types;
for(int i=0;i<Variant::OP_MAX;i++) {
@@ -713,8 +717,8 @@ void VisualScriptVariableGet::_validate_property(PropertyInfo& property) const {
void VisualScriptVariableGet::_bind_methods() {
- ObjectTypeDB::bind_method(_MD("set_variable","name"),&VisualScriptVariableGet::set_variable);
- ObjectTypeDB::bind_method(_MD("get_variable"),&VisualScriptVariableGet::get_variable);
+ ClassDB::bind_method(_MD("set_variable","name"),&VisualScriptVariableGet::set_variable);
+ ClassDB::bind_method(_MD("get_variable"),&VisualScriptVariableGet::get_variable);
ADD_PROPERTY(PropertyInfo(Variant::STRING,"variable/name"),_SCS("set_variable"),_SCS("get_variable"));
@@ -849,8 +853,8 @@ void VisualScriptVariableSet::_validate_property(PropertyInfo& property) const {
void VisualScriptVariableSet::_bind_methods() {
- ObjectTypeDB::bind_method(_MD("set_variable","name"),&VisualScriptVariableSet::set_variable);
- ObjectTypeDB::bind_method(_MD("get_variable"),&VisualScriptVariableSet::get_variable);
+ ClassDB::bind_method(_MD("set_variable","name"),&VisualScriptVariableSet::set_variable);
+ ClassDB::bind_method(_MD("get_variable"),&VisualScriptVariableSet::get_variable);
ADD_PROPERTY(PropertyInfo(Variant::STRING,"variable/name"),_SCS("set_variable"),_SCS("get_variable"));
@@ -991,11 +995,11 @@ void VisualScriptConstant::_validate_property(PropertyInfo& property) const {
void VisualScriptConstant::_bind_methods() {
- ObjectTypeDB::bind_method(_MD("set_constant_type","type"),&VisualScriptConstant::set_constant_type);
- ObjectTypeDB::bind_method(_MD("get_constant_type"),&VisualScriptConstant::get_constant_type);
+ ClassDB::bind_method(_MD("set_constant_type","type"),&VisualScriptConstant::set_constant_type);
+ ClassDB::bind_method(_MD("get_constant_type"),&VisualScriptConstant::get_constant_type);
- ObjectTypeDB::bind_method(_MD("set_constant_value","value"),&VisualScriptConstant::set_constant_value);
- ObjectTypeDB::bind_method(_MD("get_constant_value"),&VisualScriptConstant::get_constant_value);
+ ClassDB::bind_method(_MD("set_constant_value","value"),&VisualScriptConstant::set_constant_value);
+ ClassDB::bind_method(_MD("get_constant_value"),&VisualScriptConstant::get_constant_value);
String argt="Null";
for(int i=1;i<Variant::VARIANT_MAX;i++) {
@@ -1074,7 +1078,7 @@ PropertyInfo VisualScriptPreload::get_output_value_port_info(int p_idx) const{
PropertyInfo pinfo=PropertyInfo(Variant::OBJECT,"res");
if (preload.is_valid()) {
pinfo.hint=PROPERTY_HINT_RESOURCE_TYPE;
- pinfo.hint_string=preload->get_type();
+ pinfo.hint_string=preload->get_class();
}
return pinfo;
@@ -1094,7 +1098,7 @@ String VisualScriptPreload::get_text() const {
} else if (preload->get_name()!=String()) {
return preload->get_name();
} else {
- return preload->get_type();
+ return preload->get_class();
}
} else {
return "<empty>";
@@ -1119,8 +1123,8 @@ Ref<Resource> VisualScriptPreload::get_preload() const{
void VisualScriptPreload::_bind_methods() {
- ObjectTypeDB::bind_method(_MD("set_preload","resource"),&VisualScriptPreload::set_preload);
- ObjectTypeDB::bind_method(_MD("get_preload"),&VisualScriptPreload::get_preload);
+ ClassDB::bind_method(_MD("set_preload","resource"),&VisualScriptPreload::set_preload);
+ ClassDB::bind_method(_MD("get_preload"),&VisualScriptPreload::get_preload);
ADD_PROPERTY(PropertyInfo(Variant::OBJECT,"resource",PROPERTY_HINT_RESOURCE_TYPE,"Resource"),_SCS("set_preload"),_SCS("get_preload"));
@@ -1421,8 +1425,8 @@ VisualScriptNodeInstance* VisualScriptGlobalConstant::instance(VisualScriptInsta
void VisualScriptGlobalConstant::_bind_methods() {
- ObjectTypeDB::bind_method(_MD("set_global_constant","index"),&VisualScriptGlobalConstant::set_global_constant);
- ObjectTypeDB::bind_method(_MD("get_global_constant"),&VisualScriptGlobalConstant::get_global_constant);
+ ClassDB::bind_method(_MD("set_global_constant","index"),&VisualScriptGlobalConstant::set_global_constant);
+ ClassDB::bind_method(_MD("get_global_constant"),&VisualScriptGlobalConstant::get_global_constant);
String cc;
@@ -1536,7 +1540,7 @@ public:
VisualScriptNodeInstance* VisualScriptClassConstant::instance(VisualScriptInstance* p_instance) {
VisualScriptNodeInstanceClassConstant * instance = memnew(VisualScriptNodeInstanceClassConstant );
- instance->value=ObjectTypeDB::get_integer_constant(base_type,name,&instance->valid);
+ instance->value=ClassDB::get_integer_constant(base_type,name,&instance->valid);
return instance;
}
@@ -1545,7 +1549,7 @@ void VisualScriptClassConstant::_validate_property(PropertyInfo& property) const
if (property.name=="constant") {
List<String> constants;
- ObjectTypeDB::get_integer_constant_list(base_type,&constants,true);
+ ClassDB::get_integer_constant_list(base_type,&constants,true);
property.hint_string="";
for(List<String>::Element *E=constants.front();E;E=E->next()) {
@@ -1559,11 +1563,11 @@ void VisualScriptClassConstant::_validate_property(PropertyInfo& property) const
void VisualScriptClassConstant::_bind_methods() {
- ObjectTypeDB::bind_method(_MD("set_class_constant","name"),&VisualScriptClassConstant::set_class_constant);
- ObjectTypeDB::bind_method(_MD("get_class_constant"),&VisualScriptClassConstant::get_class_constant);
+ ClassDB::bind_method(_MD("set_class_constant","name"),&VisualScriptClassConstant::set_class_constant);
+ ClassDB::bind_method(_MD("get_class_constant"),&VisualScriptClassConstant::get_class_constant);
- ObjectTypeDB::bind_method(_MD("set_base_type","name"),&VisualScriptClassConstant::set_base_type);
- ObjectTypeDB::bind_method(_MD("get_base_type"),&VisualScriptClassConstant::get_base_type);
+ ClassDB::bind_method(_MD("set_base_type","name"),&VisualScriptClassConstant::set_base_type);
+ ClassDB::bind_method(_MD("get_base_type"),&VisualScriptClassConstant::get_base_type);
ADD_PROPERTY(PropertyInfo(Variant::STRING,"base_type",PROPERTY_HINT_TYPE_STRING,"Object"),_SCS("set_base_type"),_SCS("get_base_type"));
ADD_PROPERTY(PropertyInfo(Variant::STRING,"constant",PROPERTY_HINT_ENUM,""),_SCS("set_class_constant"),_SCS("get_class_constant"));
@@ -1699,11 +1703,11 @@ void VisualScriptBasicTypeConstant::_validate_property(PropertyInfo& property) c
void VisualScriptBasicTypeConstant::_bind_methods() {
- ObjectTypeDB::bind_method(_MD("set_basic_type","name"),&VisualScriptBasicTypeConstant::set_basic_type);
- ObjectTypeDB::bind_method(_MD("get_basic_type"),&VisualScriptBasicTypeConstant::get_basic_type);
+ ClassDB::bind_method(_MD("set_basic_type","name"),&VisualScriptBasicTypeConstant::set_basic_type);
+ ClassDB::bind_method(_MD("get_basic_type"),&VisualScriptBasicTypeConstant::get_basic_type);
- ObjectTypeDB::bind_method(_MD("set_basic_type_constant","name"),&VisualScriptBasicTypeConstant::set_basic_type_constant);
- ObjectTypeDB::bind_method(_MD("get_basic_type_constant"),&VisualScriptBasicTypeConstant::get_basic_type_constant);
+ ClassDB::bind_method(_MD("set_basic_type_constant","name"),&VisualScriptBasicTypeConstant::set_basic_type_constant);
+ ClassDB::bind_method(_MD("get_basic_type_constant"),&VisualScriptBasicTypeConstant::get_basic_type_constant);
String argt="Null";
@@ -1827,8 +1831,8 @@ VisualScriptNodeInstance* VisualScriptMathConstant::instance(VisualScriptInstanc
void VisualScriptMathConstant::_bind_methods() {
- ObjectTypeDB::bind_method(_MD("set_math_constant","which"),&VisualScriptMathConstant::set_math_constant);
- ObjectTypeDB::bind_method(_MD("get_math_constant"),&VisualScriptMathConstant::get_math_constant);
+ ClassDB::bind_method(_MD("set_math_constant","which"),&VisualScriptMathConstant::set_math_constant);
+ ClassDB::bind_method(_MD("get_math_constant"),&VisualScriptMathConstant::get_math_constant);
String cc;
@@ -1929,17 +1933,17 @@ public:
VisualScriptNodeInstance* VisualScriptEngineSingleton::instance(VisualScriptInstance* p_instance) {
VisualScriptNodeInstanceEngineSingleton * instance = memnew(VisualScriptNodeInstanceEngineSingleton );
- instance->singleton=Globals::get_singleton()->get_singleton_object(singleton);
+ instance->singleton=GlobalConfig::get_singleton()->get_singleton_object(singleton);
return instance;
}
VisualScriptEngineSingleton::TypeGuess VisualScriptEngineSingleton::guess_output_type(TypeGuess* p_inputs, int p_output) const {
- Object *obj=Globals::get_singleton()->get_singleton_object(singleton);
+ Object *obj=GlobalConfig::get_singleton()->get_singleton_object(singleton);
TypeGuess tg;
tg.type=Variant::OBJECT;
if (obj) {
- tg.obj_type=obj->get_type();
+ tg.GDCLASS=obj->get_class();
tg.script=obj->get_script();
}
@@ -1949,16 +1953,16 @@ VisualScriptEngineSingleton::TypeGuess VisualScriptEngineSingleton::guess_output
void VisualScriptEngineSingleton::_bind_methods() {
- ObjectTypeDB::bind_method(_MD("set_singleton","name"),&VisualScriptEngineSingleton::set_singleton);
- ObjectTypeDB::bind_method(_MD("get_singleton"),&VisualScriptEngineSingleton::get_singleton);
+ ClassDB::bind_method(_MD("set_singleton","name"),&VisualScriptEngineSingleton::set_singleton);
+ ClassDB::bind_method(_MD("get_singleton"),&VisualScriptEngineSingleton::get_singleton);
String cc;
- List<Globals::Singleton> singletons;
+ List<GlobalConfig::Singleton> singletons;
- Globals::get_singleton()->get_singletons(&singletons);
+ GlobalConfig::get_singleton()->get_singletons(&singletons);
- for (List<Globals::Singleton>::Element *E=singletons.front();E;E=E->next()) {
+ for (List<GlobalConfig::Singleton>::Element *E=singletons.front();E;E=E->next()) {
if (E->get().name=="VS" || E->get().name=="PS" || E->get().name=="PS2D" || E->get().name=="AS" || E->get().name=="TS" || E->get().name=="SS" || E->get().name=="SS2D")
continue; //skip these, too simple named
@@ -2113,7 +2117,7 @@ VisualScriptSceneNode::TypeGuess VisualScriptSceneNode::guess_output_type(TypeGu
VisualScriptSceneNode::TypeGuess tg;
tg.type=Variant::OBJECT;
- tg.obj_type="Node";
+ tg.GDCLASS="Node";
#ifdef TOOLS_ENABLED
Ref<Script> script = get_visual_script();
@@ -2142,7 +2146,7 @@ VisualScriptSceneNode::TypeGuess VisualScriptSceneNode::guess_output_type(TypeGu
Node* another = script_node->get_node(path);
if (another) {
- tg.obj_type=another->get_type();
+ tg.GDCLASS=another->get_class();
tg.script=another->get_script();
}
#endif
@@ -2186,8 +2190,8 @@ void VisualScriptSceneNode::_validate_property(PropertyInfo& property) const {
void VisualScriptSceneNode::_bind_methods() {
- ObjectTypeDB::bind_method(_MD("set_node_path","path"),&VisualScriptSceneNode::set_node_path);
- ObjectTypeDB::bind_method(_MD("get_node_path"),&VisualScriptSceneNode::get_node_path);
+ ClassDB::bind_method(_MD("set_node_path","path"),&VisualScriptSceneNode::set_node_path);
+ ClassDB::bind_method(_MD("get_node_path"),&VisualScriptSceneNode::get_node_path);
ADD_PROPERTY(PropertyInfo(Variant::NODE_PATH,"node_path",PROPERTY_HINT_NODE_PATH_TO_EDITED_NODE),_SCS("set_node_path"),_SCS("get_node_path"));
}
@@ -2292,7 +2296,7 @@ VisualScriptSceneTree::TypeGuess VisualScriptSceneTree::guess_output_type(TypeGu
TypeGuess tg;
tg.type=Variant::OBJECT;
- tg.obj_type="SceneTree";
+ tg.GDCLASS="SceneTree";
return tg;
}
@@ -2397,8 +2401,8 @@ VisualScriptNodeInstance* VisualScriptResourcePath::instance(VisualScriptInstanc
void VisualScriptResourcePath::_bind_methods() {
- ObjectTypeDB::bind_method(_MD("set_resource_path","path"),&VisualScriptResourcePath::set_resource_path);
- ObjectTypeDB::bind_method(_MD("get_resource_path"),&VisualScriptResourcePath::get_resource_path);
+ ClassDB::bind_method(_MD("set_resource_path","path"),&VisualScriptResourcePath::set_resource_path);
+ ClassDB::bind_method(_MD("get_resource_path"),&VisualScriptResourcePath::get_resource_path);
ADD_PROPERTY(PropertyInfo(Variant::STRING,"path",PROPERTY_HINT_FILE),_SCS("set_resource_path"),_SCS("get_resource_path"));
}
@@ -2490,13 +2494,13 @@ VisualScriptSelf::TypeGuess VisualScriptSelf::guess_output_type(TypeGuess* p_inp
VisualScriptSceneNode::TypeGuess tg;
tg.type=Variant::OBJECT;
- tg.obj_type="Object";
+ tg.GDCLASS="Object";
Ref<Script> script = get_visual_script();
if (!script.is_valid())
return tg;
- tg.obj_type=script->get_instance_base_type();
+ tg.GDCLASS=script->get_instance_base_type();
tg.script=script;
return tg;
@@ -2627,9 +2631,9 @@ public:
return 0;
}
#endif
- Array in_values(true);
- Array out_values(true);
- Array work_mem(true);
+ Array in_values;
+ Array out_values;
+ Array work_mem;
in_values.resize(in_count);
@@ -2813,7 +2817,7 @@ String VisualScriptSubCall::get_text() const {
return script->get_name();
if (script->get_path().is_resource_file())
return script->get_path().get_file();
- return script->get_type();
+ return script->get_class();
}
return "";
}
@@ -2997,14 +3001,14 @@ VisualScriptNodeInstance* VisualScriptComment::instance(VisualScriptInstance* p_
void VisualScriptComment::_bind_methods() {
- ObjectTypeDB::bind_method(_MD("set_title","title"),&VisualScriptComment::set_title);
- ObjectTypeDB::bind_method(_MD("get_title"),&VisualScriptComment::get_title);
+ ClassDB::bind_method(_MD("set_title","title"),&VisualScriptComment::set_title);
+ ClassDB::bind_method(_MD("get_title"),&VisualScriptComment::get_title);
- ObjectTypeDB::bind_method(_MD("set_description","description"),&VisualScriptComment::set_description);
- ObjectTypeDB::bind_method(_MD("get_description"),&VisualScriptComment::get_description);
+ ClassDB::bind_method(_MD("set_description","description"),&VisualScriptComment::set_description);
+ ClassDB::bind_method(_MD("get_description"),&VisualScriptComment::get_description);
- ObjectTypeDB::bind_method(_MD("set_size","size"),&VisualScriptComment::set_size);
- ObjectTypeDB::bind_method(_MD("get_size"),&VisualScriptComment::get_size);
+ ClassDB::bind_method(_MD("set_size","size"),&VisualScriptComment::set_size);
+ ClassDB::bind_method(_MD("get_size"),&VisualScriptComment::get_size);
ADD_PROPERTY( PropertyInfo(Variant::STRING,"title"),_SCS("set_title"),_SCS("get_title"));
ADD_PROPERTY( PropertyInfo(Variant::STRING,"description",PROPERTY_HINT_MULTILINE_TEXT),_SCS("set_description"),_SCS("get_description"));
@@ -3136,11 +3140,11 @@ VisualScriptNodeInstance* VisualScriptConstructor::instance(VisualScriptInstance
void VisualScriptConstructor::_bind_methods() {
- ObjectTypeDB::bind_method(_MD("set_constructor_type","type"),&VisualScriptConstructor::set_constructor_type);
- ObjectTypeDB::bind_method(_MD("get_constructor_type"),&VisualScriptConstructor::get_constructor_type);
+ ClassDB::bind_method(_MD("set_constructor_type","type"),&VisualScriptConstructor::set_constructor_type);
+ ClassDB::bind_method(_MD("get_constructor_type"),&VisualScriptConstructor::get_constructor_type);
- ObjectTypeDB::bind_method(_MD("set_constructor","constructor"),&VisualScriptConstructor::set_constructor);
- ObjectTypeDB::bind_method(_MD("get_constructor"),&VisualScriptConstructor::get_constructor);
+ ClassDB::bind_method(_MD("set_constructor","constructor"),&VisualScriptConstructor::set_constructor);
+ ClassDB::bind_method(_MD("get_constructor"),&VisualScriptConstructor::get_constructor);
ADD_PROPERTY( PropertyInfo(Variant::INT,"type",PROPERTY_HINT_NONE,"",PROPERTY_USAGE_NOEDITOR),_SCS("set_constructor_type"),_SCS("get_constructor_type"));
ADD_PROPERTY( PropertyInfo(Variant::DICTIONARY,"constructor",PROPERTY_HINT_NONE,"",PROPERTY_USAGE_NOEDITOR),_SCS("set_constructor"),_SCS("get_constructor"));
@@ -3279,11 +3283,11 @@ VisualScriptNodeInstance* VisualScriptLocalVar::instance(VisualScriptInstance* p
void VisualScriptLocalVar::_bind_methods() {
- ObjectTypeDB::bind_method(_MD("set_var_name","name"),&VisualScriptLocalVar::set_var_name);
- ObjectTypeDB::bind_method(_MD("get_var_name"),&VisualScriptLocalVar::get_var_name);
+ ClassDB::bind_method(_MD("set_var_name","name"),&VisualScriptLocalVar::set_var_name);
+ ClassDB::bind_method(_MD("get_var_name"),&VisualScriptLocalVar::get_var_name);
- ObjectTypeDB::bind_method(_MD("set_var_type","type"),&VisualScriptLocalVar::set_var_type);
- ObjectTypeDB::bind_method(_MD("get_var_type"),&VisualScriptLocalVar::get_var_type);
+ ClassDB::bind_method(_MD("set_var_type","type"),&VisualScriptLocalVar::set_var_type);
+ ClassDB::bind_method(_MD("get_var_type"),&VisualScriptLocalVar::get_var_type);
String argt="Any";
for(int i=1;i<Variant::VARIANT_MAX;i++) {
@@ -3416,11 +3420,11 @@ VisualScriptNodeInstance* VisualScriptLocalVarSet::instance(VisualScriptInstance
void VisualScriptLocalVarSet::_bind_methods() {
- ObjectTypeDB::bind_method(_MD("set_var_name","name"),&VisualScriptLocalVarSet::set_var_name);
- ObjectTypeDB::bind_method(_MD("get_var_name"),&VisualScriptLocalVarSet::get_var_name);
+ ClassDB::bind_method(_MD("set_var_name","name"),&VisualScriptLocalVarSet::set_var_name);
+ ClassDB::bind_method(_MD("get_var_name"),&VisualScriptLocalVarSet::get_var_name);
- ObjectTypeDB::bind_method(_MD("set_var_type","type"),&VisualScriptLocalVarSet::set_var_type);
- ObjectTypeDB::bind_method(_MD("get_var_type"),&VisualScriptLocalVarSet::get_var_type);
+ ClassDB::bind_method(_MD("set_var_type","type"),&VisualScriptLocalVarSet::set_var_type);
+ ClassDB::bind_method(_MD("get_var_type"),&VisualScriptLocalVarSet::get_var_type);
String argt="Any";
for(int i=1;i<Variant::VARIANT_MAX;i++) {
@@ -3596,7 +3600,7 @@ void VisualScriptInputAction::_validate_property(PropertyInfo& property) const {
String actions;
List<PropertyInfo> pinfo;
- Globals::get_singleton()->get_property_list(&pinfo);
+ GlobalConfig::get_singleton()->get_property_list(&pinfo);
Vector<String> al;
for(List<PropertyInfo>::Element *E=pinfo.front();E;E=E->next()) {
@@ -3611,7 +3615,7 @@ void VisualScriptInputAction::_validate_property(PropertyInfo& property) const {
al.push_back(name);
}
- al.sort();;
+ al.sort();
for(int i=0;i<al.size();i++) {
if (actions!=String())
@@ -3626,11 +3630,11 @@ void VisualScriptInputAction::_validate_property(PropertyInfo& property) const {
void VisualScriptInputAction::_bind_methods() {
- ObjectTypeDB::bind_method(_MD("set_action_name","name"),&VisualScriptInputAction::set_action_name);
- ObjectTypeDB::bind_method(_MD("get_action_name"),&VisualScriptInputAction::get_action_name);
+ ClassDB::bind_method(_MD("set_action_name","name"),&VisualScriptInputAction::set_action_name);
+ ClassDB::bind_method(_MD("get_action_name"),&VisualScriptInputAction::get_action_name);
- ObjectTypeDB::bind_method(_MD("set_action_mode","mode"),&VisualScriptInputAction::set_action_mode);
- ObjectTypeDB::bind_method(_MD("get_action_mode"),&VisualScriptInputAction::get_action_mode);
+ ClassDB::bind_method(_MD("set_action_mode","mode"),&VisualScriptInputAction::set_action_mode);
+ ClassDB::bind_method(_MD("get_action_mode"),&VisualScriptInputAction::get_action_mode);
ADD_PROPERTY( PropertyInfo(Variant::STRING,"action"),_SCS("set_action_name"),_SCS("get_action_name"));
ADD_PROPERTY( PropertyInfo(Variant::INT,"mode",PROPERTY_HINT_ENUM,"Pressed,Released,JustPressed,JustReleased"),_SCS("set_action_mode"),_SCS("get_action_mode"));
@@ -3701,7 +3705,7 @@ String VisualScriptDeconstruct::get_category() const {
void VisualScriptDeconstruct::_update_elements() {
- elements.clear();;
+ elements.clear();
Variant v;
if (type==Variant::INPUT_EVENT) {
InputEvent ie;
@@ -3830,21 +3834,21 @@ void VisualScriptDeconstruct::_validate_property(PropertyInfo& property) const {
void VisualScriptDeconstruct::_bind_methods() {
- ObjectTypeDB::bind_method(_MD("set_deconstruct_type","type"),&VisualScriptDeconstruct::set_deconstruct_type);
- ObjectTypeDB::bind_method(_MD("get_deconstruct_type"),&VisualScriptDeconstruct::get_deconstruct_type);
+ ClassDB::bind_method(_MD("set_deconstruct_type","type"),&VisualScriptDeconstruct::set_deconstruct_type);
+ ClassDB::bind_method(_MD("get_deconstruct_type"),&VisualScriptDeconstruct::get_deconstruct_type);
- ObjectTypeDB::bind_method(_MD("set_deconstruct_input_type","input_type"),&VisualScriptDeconstruct::set_deconstruct_input_type);
- ObjectTypeDB::bind_method(_MD("get_deconstruct_input_type"),&VisualScriptDeconstruct::get_deconstruct_input_type);
+ ClassDB::bind_method(_MD("set_deconstruct_input_type","input_type"),&VisualScriptDeconstruct::set_deconstruct_input_type);
+ ClassDB::bind_method(_MD("get_deconstruct_input_type"),&VisualScriptDeconstruct::get_deconstruct_input_type);
- ObjectTypeDB::bind_method(_MD("_set_elem_cache","_cache"),&VisualScriptDeconstruct::_set_elem_cache);
- ObjectTypeDB::bind_method(_MD("_get_elem_cache"),&VisualScriptDeconstruct::_get_elem_cache);
+ ClassDB::bind_method(_MD("_set_elem_cache","_cache"),&VisualScriptDeconstruct::_set_elem_cache);
+ ClassDB::bind_method(_MD("_get_elem_cache"),&VisualScriptDeconstruct::_get_elem_cache);
String argt="Any";
for(int i=1;i<Variant::VARIANT_MAX;i++) {
argt+=","+Variant::get_type_name(Variant::Type(i));
}
- String iet="None,Key,MouseMotion,MouseButton,JoystickMotion,JoystickButton,ScreenTouch,ScreenDrag,Action";
+ String iet="None,Key,MouseMotion,MouseButton,JoypadMotion,JoypadButton,ScreenTouch,ScreenDrag,Action";
ADD_PROPERTY( PropertyInfo(Variant::INT,"type",PROPERTY_HINT_ENUM,argt),_SCS("set_deconstruct_type"),_SCS("get_deconstruct_type"));
ADD_PROPERTY( PropertyInfo(Variant::INT,"input_type",PROPERTY_HINT_ENUM,iet),_SCS("set_deconstruct_input_type"),_SCS("get_deconstruct_input_type"));
@@ -3900,6 +3904,7 @@ void register_visual_script_nodes() {
VisualScriptLanguage::singleton->add_register_func("operators/math/multiply",create_op_node<Variant::OP_MULTIPLY>);
VisualScriptLanguage::singleton->add_register_func("operators/math/divide",create_op_node<Variant::OP_DIVIDE>);
VisualScriptLanguage::singleton->add_register_func("operators/math/negate",create_op_node<Variant::OP_NEGATE>);
+ VisualScriptLanguage::singleton->add_register_func("operators/math/positive",create_op_node<Variant::OP_POSITIVE>);
VisualScriptLanguage::singleton->add_register_func("operators/math/remainder",create_op_node<Variant::OP_MODULE>);
VisualScriptLanguage::singleton->add_register_func("operators/math/string_concat",create_op_node<Variant::OP_STRING_CONCAT>);
//bitwise
diff --git a/modules/visual_script/visual_script_nodes.h b/modules/visual_script/visual_script_nodes.h
index 94eeadca57..7a06fbf5e8 100644
--- a/modules/visual_script/visual_script_nodes.h
+++ b/modules/visual_script/visual_script_nodes.h
@@ -5,7 +5,7 @@
class VisualScriptFunction : public VisualScriptNode {
- OBJ_TYPE(VisualScriptFunction,VisualScriptNode)
+ GDCLASS(VisualScriptFunction,VisualScriptNode)
struct Argument {
@@ -72,7 +72,7 @@ public:
class VisualScriptOperator : public VisualScriptNode {
- OBJ_TYPE(VisualScriptOperator,VisualScriptNode)
+ GDCLASS(VisualScriptOperator,VisualScriptNode)
Variant::Type typed;
@@ -114,7 +114,7 @@ public:
class VisualScriptVariableGet : public VisualScriptNode {
- OBJ_TYPE(VisualScriptVariableGet,VisualScriptNode)
+ GDCLASS(VisualScriptVariableGet,VisualScriptNode)
StringName variable;
@@ -153,7 +153,7 @@ public:
class VisualScriptVariableSet : public VisualScriptNode {
- OBJ_TYPE(VisualScriptVariableSet,VisualScriptNode)
+ GDCLASS(VisualScriptVariableSet,VisualScriptNode)
StringName variable;
@@ -192,7 +192,7 @@ public:
class VisualScriptConstant : public VisualScriptNode {
- OBJ_TYPE(VisualScriptConstant,VisualScriptNode)
+ GDCLASS(VisualScriptConstant,VisualScriptNode)
Variant::Type type;
@@ -236,7 +236,7 @@ public:
class VisualScriptPreload : public VisualScriptNode {
- OBJ_TYPE(VisualScriptPreload,VisualScriptNode)
+ GDCLASS(VisualScriptPreload,VisualScriptNode)
Ref<Resource> preload;
@@ -274,7 +274,7 @@ public:
class VisualScriptIndexGet : public VisualScriptNode {
- OBJ_TYPE(VisualScriptIndexGet,VisualScriptNode)
+ GDCLASS(VisualScriptIndexGet,VisualScriptNode)
public:
@@ -305,7 +305,7 @@ public:
class VisualScriptIndexSet : public VisualScriptNode {
- OBJ_TYPE(VisualScriptIndexSet,VisualScriptNode)
+ GDCLASS(VisualScriptIndexSet,VisualScriptNode)
public:
@@ -337,7 +337,7 @@ public:
class VisualScriptGlobalConstant : public VisualScriptNode {
- OBJ_TYPE(VisualScriptGlobalConstant,VisualScriptNode)
+ GDCLASS(VisualScriptGlobalConstant,VisualScriptNode)
int index;
@@ -373,7 +373,7 @@ public:
class VisualScriptClassConstant : public VisualScriptNode {
- OBJ_TYPE(VisualScriptClassConstant,VisualScriptNode)
+ GDCLASS(VisualScriptClassConstant,VisualScriptNode)
StringName base_type;
StringName name;
@@ -414,7 +414,7 @@ public:
class VisualScriptBasicTypeConstant : public VisualScriptNode {
- OBJ_TYPE(VisualScriptBasicTypeConstant,VisualScriptNode)
+ GDCLASS(VisualScriptBasicTypeConstant,VisualScriptNode)
Variant::Type type;
StringName name;
@@ -457,7 +457,7 @@ public:
class VisualScriptMathConstant : public VisualScriptNode {
- OBJ_TYPE(VisualScriptMathConstant,VisualScriptNode)
+ GDCLASS(VisualScriptMathConstant,VisualScriptNode)
public:
enum MathConstant {
@@ -508,7 +508,7 @@ VARIANT_ENUM_CAST( VisualScriptMathConstant::MathConstant )
class VisualScriptEngineSingleton : public VisualScriptNode {
- OBJ_TYPE(VisualScriptEngineSingleton,VisualScriptNode)
+ GDCLASS(VisualScriptEngineSingleton,VisualScriptNode)
String singleton;
@@ -549,7 +549,7 @@ public:
class VisualScriptSceneNode : public VisualScriptNode {
- OBJ_TYPE(VisualScriptSceneNode,VisualScriptNode)
+ GDCLASS(VisualScriptSceneNode,VisualScriptNode)
NodePath path;
protected:
@@ -590,7 +590,7 @@ public:
class VisualScriptSceneTree : public VisualScriptNode {
- OBJ_TYPE(VisualScriptSceneTree,VisualScriptNode)
+ GDCLASS(VisualScriptSceneTree,VisualScriptNode)
protected:
@@ -627,7 +627,7 @@ public:
class VisualScriptResourcePath : public VisualScriptNode {
- OBJ_TYPE(VisualScriptResourcePath,VisualScriptNode)
+ GDCLASS(VisualScriptResourcePath,VisualScriptNode)
String path;
protected:
@@ -664,7 +664,7 @@ public:
class VisualScriptSelf : public VisualScriptNode {
- OBJ_TYPE(VisualScriptSelf,VisualScriptNode)
+ GDCLASS(VisualScriptSelf,VisualScriptNode)
protected:
@@ -701,13 +701,11 @@ public:
class VisualScriptCustomNode: public VisualScriptNode {
- OBJ_TYPE(VisualScriptCustomNode,VisualScriptNode)
+ GDCLASS(VisualScriptCustomNode,VisualScriptNode)
protected:
- virtual bool _use_builtin_script() const { return true; }
-
static void _bind_methods();
public:
@@ -752,7 +750,7 @@ public:
class VisualScriptSubCall: public VisualScriptNode {
- OBJ_TYPE(VisualScriptSubCall,VisualScriptNode)
+ GDCLASS(VisualScriptSubCall,VisualScriptNode)
protected:
@@ -785,7 +783,7 @@ public:
class VisualScriptComment: public VisualScriptNode {
- OBJ_TYPE(VisualScriptComment,VisualScriptNode)
+ GDCLASS(VisualScriptComment,VisualScriptNode)
String title;
@@ -829,7 +827,7 @@ public:
class VisualScriptConstructor: public VisualScriptNode {
- OBJ_TYPE(VisualScriptConstructor,VisualScriptNode)
+ GDCLASS(VisualScriptConstructor,VisualScriptNode)
Variant::Type type;
@@ -874,7 +872,7 @@ public:
class VisualScriptLocalVar: public VisualScriptNode {
- OBJ_TYPE(VisualScriptLocalVar,VisualScriptNode)
+ GDCLASS(VisualScriptLocalVar,VisualScriptNode)
StringName name;
Variant::Type type;
@@ -914,7 +912,7 @@ public:
class VisualScriptLocalVarSet: public VisualScriptNode {
- OBJ_TYPE(VisualScriptLocalVarSet,VisualScriptNode)
+ GDCLASS(VisualScriptLocalVarSet,VisualScriptNode)
StringName name;
Variant::Type type;
@@ -956,7 +954,7 @@ public:
class VisualScriptInputAction: public VisualScriptNode {
- OBJ_TYPE(VisualScriptInputAction,VisualScriptNode)
+ GDCLASS(VisualScriptInputAction,VisualScriptNode)
public:
enum Mode {
MODE_PRESSED,
@@ -1007,7 +1005,7 @@ VARIANT_ENUM_CAST( VisualScriptInputAction::Mode )
class VisualScriptDeconstruct: public VisualScriptNode {
- OBJ_TYPE(VisualScriptDeconstruct,VisualScriptNode)
+ GDCLASS(VisualScriptDeconstruct,VisualScriptNode)
struct Element {
diff --git a/modules/visual_script/visual_script_yield_nodes.cpp b/modules/visual_script/visual_script_yield_nodes.cpp
index 221c46b6fd..8b251e667c 100644
--- a/modules/visual_script/visual_script_yield_nodes.cpp
+++ b/modules/visual_script/visual_script_yield_nodes.cpp
@@ -157,11 +157,11 @@ void VisualScriptYield::_validate_property(PropertyInfo& property) const {
void VisualScriptYield::_bind_methods() {
- ObjectTypeDB::bind_method(_MD("set_yield_mode","mode"),&VisualScriptYield::set_yield_mode);
- ObjectTypeDB::bind_method(_MD("get_yield_mode"),&VisualScriptYield::get_yield_mode);
+ ClassDB::bind_method(_MD("set_yield_mode","mode"),&VisualScriptYield::set_yield_mode);
+ ClassDB::bind_method(_MD("get_yield_mode"),&VisualScriptYield::get_yield_mode);
- ObjectTypeDB::bind_method(_MD("set_wait_time","sec"),&VisualScriptYield::set_wait_time);
- ObjectTypeDB::bind_method(_MD("get_wait_time"),&VisualScriptYield::get_wait_time);
+ ClassDB::bind_method(_MD("set_wait_time","sec"),&VisualScriptYield::set_wait_time);
+ ClassDB::bind_method(_MD("get_wait_time"),&VisualScriptYield::get_wait_time);
ADD_PROPERTY(PropertyInfo(Variant::INT,"mode",PROPERTY_HINT_ENUM,"Frame,FixedFrame,Time",PROPERTY_USAGE_NOEDITOR),_SCS("set_yield_mode"),_SCS("get_yield_mode"));
ADD_PROPERTY(PropertyInfo(Variant::REAL,"wait_time"),_SCS("set_wait_time"),_SCS("get_wait_time"));
@@ -270,7 +270,7 @@ StringName VisualScriptYieldSignal::_get_base_type() const {
else if (call_mode==CALL_MODE_NODE_PATH && get_visual_script().is_valid()) {
Node *path = _get_base_node();
if (path)
- return path->get_type();
+ return path->get_class();
}
@@ -290,7 +290,7 @@ int VisualScriptYieldSignal::get_output_value_port_count() const{
MethodInfo sr;
- if (!ObjectTypeDB::get_signal(_get_base_type(),signal,&sr))
+ if (!ClassDB::get_signal(_get_base_type(),signal,&sr))
return 0;
return sr.arguments.size();
@@ -315,7 +315,7 @@ PropertyInfo VisualScriptYieldSignal::get_output_value_port_info(int p_idx) cons
MethodInfo sr;
- if (!ObjectTypeDB::get_signal(_get_base_type(),signal,&sr))
+ if (!ClassDB::get_signal(_get_base_type(),signal,&sr))
return PropertyInfo(); //no signal
ERR_FAIL_INDEX_V(p_idx,sr.arguments.size(),PropertyInfo());
return sr.arguments[p_idx];
@@ -440,7 +440,7 @@ void VisualScriptYieldSignal::_validate_property(PropertyInfo& property) const {
List<MethodInfo> methods;
- ObjectTypeDB::get_signal_list(_get_base_type(),&methods);
+ ClassDB::get_signal_list(_get_base_type(),&methods);
List<String> mstring;
for (List<MethodInfo>::Element *E=methods.front();E;E=E->next()) {
@@ -468,17 +468,17 @@ void VisualScriptYieldSignal::_validate_property(PropertyInfo& property) const {
void VisualScriptYieldSignal::_bind_methods() {
- ObjectTypeDB::bind_method(_MD("set_base_type","base_type"),&VisualScriptYieldSignal::set_base_type);
- ObjectTypeDB::bind_method(_MD("get_base_type"),&VisualScriptYieldSignal::get_base_type);
+ ClassDB::bind_method(_MD("set_base_type","base_type"),&VisualScriptYieldSignal::set_base_type);
+ ClassDB::bind_method(_MD("get_base_type"),&VisualScriptYieldSignal::get_base_type);
- ObjectTypeDB::bind_method(_MD("set_signal","signal"),&VisualScriptYieldSignal::set_signal);
- ObjectTypeDB::bind_method(_MD("get_signal"),&VisualScriptYieldSignal::get_signal);
+ ClassDB::bind_method(_MD("set_signal","signal"),&VisualScriptYieldSignal::set_signal);
+ ClassDB::bind_method(_MD("get_signal"),&VisualScriptYieldSignal::get_signal);
- ObjectTypeDB::bind_method(_MD("set_call_mode","mode"),&VisualScriptYieldSignal::set_call_mode);
- ObjectTypeDB::bind_method(_MD("get_call_mode"),&VisualScriptYieldSignal::get_call_mode);
+ ClassDB::bind_method(_MD("set_call_mode","mode"),&VisualScriptYieldSignal::set_call_mode);
+ ClassDB::bind_method(_MD("get_call_mode"),&VisualScriptYieldSignal::get_call_mode);
- ObjectTypeDB::bind_method(_MD("set_base_path","base_path"),&VisualScriptYieldSignal::set_base_path);
- ObjectTypeDB::bind_method(_MD("get_base_path"),&VisualScriptYieldSignal::get_base_path);
+ ClassDB::bind_method(_MD("set_base_path","base_path"),&VisualScriptYieldSignal::set_base_path);
+ ClassDB::bind_method(_MD("get_base_path"),&VisualScriptYieldSignal::get_base_path);
diff --git a/modules/visual_script/visual_script_yield_nodes.h b/modules/visual_script/visual_script_yield_nodes.h
index ae7f8c15c1..210d6ec995 100644
--- a/modules/visual_script/visual_script_yield_nodes.h
+++ b/modules/visual_script/visual_script_yield_nodes.h
@@ -5,7 +5,7 @@
class VisualScriptYield : public VisualScriptNode {
- OBJ_TYPE(VisualScriptYield,VisualScriptNode)
+ GDCLASS(VisualScriptYield,VisualScriptNode)
public:
enum YieldMode {
@@ -60,7 +60,7 @@ VARIANT_ENUM_CAST( VisualScriptYield::YieldMode )
class VisualScriptYieldSignal : public VisualScriptNode {
- OBJ_TYPE(VisualScriptYieldSignal,VisualScriptNode)
+ GDCLASS(VisualScriptYieldSignal,VisualScriptNode)
public:
enum CallMode {
CALL_MODE_SELF,
diff --git a/modules/vorbis/SCsub b/modules/vorbis/SCsub
index 3220cb454c..d3e4f7e15a 100644
--- a/modules/vorbis/SCsub
+++ b/modules/vorbis/SCsub
@@ -6,44 +6,44 @@ Import('env_modules')
env_vorbis = env_modules.Clone()
# Thirdparty source files
-if (env["libvorbis"] != "system"): # builtin
- thirdparty_dir = "#thirdparty/libvorbis/"
- thirdparty_sources = [
- #"analysis.c",
- #"barkmel.c",
- "bitrate.c",
- "block.c",
- "codebook.c",
- "envelope.c",
- "floor0.c",
- "floor1.c",
- "info.c",
- "lookup.c",
- "lpc.c",
- "lsp.c",
- "mapping0.c",
- "mdct.c",
- "psy.c",
- #"psytune.c",
- "registry.c",
- "res0.c",
- "sharedbook.c",
- "smallft.c",
- "synthesis.c",
- #"tone.c",
- #"vorbisenc.c",
- "vorbisfile.c",
- "window.c",
- ]
+if (env['builtin_libvorbis'] != 'no'):
+ thirdparty_dir = "#thirdparty/libvorbis/"
+ thirdparty_sources = [
+ #"analysis.c",
+ #"barkmel.c",
+ "bitrate.c",
+ "block.c",
+ "codebook.c",
+ "envelope.c",
+ "floor0.c",
+ "floor1.c",
+ "info.c",
+ "lookup.c",
+ "lpc.c",
+ "lsp.c",
+ "mapping0.c",
+ "mdct.c",
+ "psy.c",
+ #"psytune.c",
+ "registry.c",
+ "res0.c",
+ "sharedbook.c",
+ "smallft.c",
+ "synthesis.c",
+ #"tone.c",
+ #"vorbisenc.c",
+ "vorbisfile.c",
+ "window.c",
+ ]
- thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
+ thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
- env_vorbis.add_source_files(env.modules_sources, thirdparty_sources)
- env_vorbis.Append(CPPPATH = [thirdparty_dir])
+ env_vorbis.add_source_files(env.modules_sources, thirdparty_sources)
+ env_vorbis.Append(CPPPATH=[thirdparty_dir])
- # also requires libogg
- if (env["libogg"] != "system"): # builtin
- env_vorbis.Append(CPPPATH = ["#thirdparty/libogg"])
+ # also requires libogg
+ if (env['builtin_libogg'] != 'no'):
+ env_vorbis.Append(CPPPATH=["#thirdparty/libogg"])
# Godot source files
env_vorbis.add_source_files(env.modules_sources, "*.cpp")
diff --git a/modules/vorbis/audio_stream_ogg_vorbis.cpp b/modules/vorbis/audio_stream_ogg_vorbis.cpp
index 4ce7940a01..98920954a4 100644
--- a/modules/vorbis/audio_stream_ogg_vorbis.cpp
+++ b/modules/vorbis/audio_stream_ogg_vorbis.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* 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 */
@@ -78,7 +78,7 @@ int AudioStreamPlaybackOGGVorbis::_ov_seek_func(void *_f,ogg_int64_t offs, int w
}
int AudioStreamPlaybackOGGVorbis::_ov_close_func(void *_f) {
-// printf("close %p\n",_f);
+ //printf("close %p\n",_f);
if (!_f)
return 0;
FileAccess *fa=(FileAccess*)_f;
@@ -141,7 +141,7 @@ int AudioStreamPlaybackOGGVorbis::mix(int16_t* p_bufer,int p_frames) {
int errv = ov_open_callbacks(f,&vf,NULL,0,_ov_callbacks);
if (errv!=0) {
playing=false;
- break;; // :(
+ break; // :(
}
if (loop_restart_time) {
@@ -419,7 +419,7 @@ void ResourceFormatLoaderAudioStreamOGGVorbis::get_recognized_extensions(List<St
}
String ResourceFormatLoaderAudioStreamOGGVorbis::get_resource_type(const String &p_path) const {
- if (p_path.extension().to_lower()=="ogg")
+ if (p_path.get_extension().to_lower()=="ogg")
return "AudioStreamOGGVorbis";
return "";
}
diff --git a/modules/vorbis/audio_stream_ogg_vorbis.h b/modules/vorbis/audio_stream_ogg_vorbis.h
index 8d8d7392b5..bc2bfa2ae6 100644
--- a/modules/vorbis/audio_stream_ogg_vorbis.h
+++ b/modules/vorbis/audio_stream_ogg_vorbis.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* 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 */
@@ -38,7 +38,7 @@
class AudioStreamPlaybackOGGVorbis : public AudioStreamPlayback {
- OBJ_TYPE(AudioStreamPlaybackOGGVorbis,AudioStreamPlayback);
+ GDCLASS(AudioStreamPlaybackOGGVorbis,AudioStreamPlayback);
enum {
MIN_MIX=1024
@@ -115,7 +115,7 @@ public:
class AudioStreamOGGVorbis : public AudioStream {
- OBJ_TYPE(AudioStreamOGGVorbis,AudioStream);
+ GDCLASS(AudioStreamOGGVorbis,AudioStream);
String file;
public:
diff --git a/modules/vorbis/config.py b/modules/vorbis/config.py
index 368e97e152..ef5daca05c 100644
--- a/modules/vorbis/config.py
+++ b/modules/vorbis/config.py
@@ -1,6 +1,8 @@
def can_build(platform):
- return True
+# return True
+ return False
+
def configure(env):
- pass
+ pass
diff --git a/modules/vorbis/register_types.cpp b/modules/vorbis/register_types.cpp
index ae63b5af3c..de929d9350 100644
--- a/modules/vorbis/register_types.cpp
+++ b/modules/vorbis/register_types.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* 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 */
@@ -36,7 +36,7 @@ void register_vorbis_types() {
vorbis_stream_loader = memnew( ResourceFormatLoaderAudioStreamOGGVorbis );
ResourceLoader::add_resource_format_loader(vorbis_stream_loader);
- ObjectTypeDB::register_type<AudioStreamOGGVorbis>();
+ ClassDB::register_class<AudioStreamOGGVorbis>();
}
void unregister_vorbis_types() {
diff --git a/modules/vorbis/register_types.h b/modules/vorbis/register_types.h
index 6baaed7ce8..b2adb55acd 100644
--- a/modules/vorbis/register_types.h
+++ b/modules/vorbis/register_types.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* 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 */
diff --git a/modules/webm/SCsub b/modules/webm/SCsub
index fbd936a2c3..889f5e83aa 100644
--- a/modules/webm/SCsub
+++ b/modules/webm/SCsub
@@ -8,27 +8,27 @@ env_webm = env_modules.Clone()
# Thirdparty source files
thirdparty_libsimplewebm_dir = "#thirdparty/libsimplewebm/"
thirdparty_libsimplewebm_sources = [
- "libwebm/mkvparser/mkvparser.cc",
- "OpusVorbisDecoder.cpp",
- "VPXDecoder.cpp",
- "WebMDemuxer.cpp",
+ "libwebm/mkvparser/mkvparser.cc",
+ "OpusVorbisDecoder.cpp",
+ "VPXDecoder.cpp",
+ "WebMDemuxer.cpp",
]
thirdparty_libsimplewebm_sources = [thirdparty_libsimplewebm_dir + file for file in thirdparty_libsimplewebm_sources]
env_webm.add_source_files(env.modules_sources, thirdparty_libsimplewebm_sources)
-env_webm.Append(CPPPATH = [thirdparty_libsimplewebm_dir, thirdparty_libsimplewebm_dir + "libwebm/"])
+env_webm.Append(CPPPATH=[thirdparty_libsimplewebm_dir, thirdparty_libsimplewebm_dir + "libwebm/"])
# also requires libogg, libvorbis and libopus
-if (env["libogg"] != "system"): # builtin
- env_webm.Append(CPPPATH = ["#thirdparty/libogg"])
-if (env["libvorbis"] != "system"): # builtin
- env_webm.Append(CPPPATH = ["#thirdparty/libvorbis"])
-if (env["opus"] != "system"): # builtin
- env_webm.Append(CPPPATH = ["#thirdparty"])
+if (env['builtin_libogg'] != 'no'):
+ env_webm.Append(CPPPATH=["#thirdparty/libogg"])
+if (env['builtin_libvorbis'] != 'no'):
+ env_webm.Append(CPPPATH=["#thirdparty/libvorbis"])
+if (env['builtin_opus'] != 'no'):
+ env_webm.Append(CPPPATH=["#thirdparty/opus"])
-if (env["libvpx"] != "system"): # builtin
- Export('env_webm')
- SConscript("libvpx/SCsub")
+if (env['builtin_libvpx'] != 'no'):
+ Export('env_webm')
+ SConscript("libvpx/SCsub")
# Godot source files
env_webm.add_source_files(env.modules_sources, "*.cpp")
diff --git a/modules/webm/config.py b/modules/webm/config.py
index 368e97e152..ef5daca05c 100644
--- a/modules/webm/config.py
+++ b/modules/webm/config.py
@@ -1,6 +1,8 @@
def can_build(platform):
- return True
+# return True
+ return False
+
def configure(env):
- pass
+ pass
diff --git a/modules/webm/libvpx/SCsub b/modules/webm/libvpx/SCsub
index 706db97206..241d6e30cd 100644
--- a/modules/webm/libvpx/SCsub
+++ b/modules/webm/libvpx/SCsub
@@ -3,231 +3,231 @@
libvpx_dir = "#thirdparty/libvpx/"
libvpx_sources = [
- "vp8/vp8_dx_iface.c",
-
- "vp8/common/generic/systemdependent.c",
-
- "vp8/common/alloccommon.c",
- "vp8/common/blockd.c",
- "vp8/common/copy_c.c",
- "vp8/common/debugmodes.c",
- "vp8/common/dequantize.c",
- "vp8/common/entropy.c",
- "vp8/common/entropymode.c",
- "vp8/common/entropymv.c",
- "vp8/common/extend.c",
- "vp8/common/filter.c",
- "vp8/common/findnearmv.c",
- "vp8/common/idct_blk.c",
- "vp8/common/idctllm.c",
- "vp8/common/loopfilter_filters.c",
- "vp8/common/mbpitch.c",
- "vp8/common/modecont.c",
- "vp8/common/quant_common.c",
- "vp8/common/reconinter.c",
- "vp8/common/reconintra.c",
- "vp8/common/reconintra4x4.c",
- "vp8/common/rtcd.c",
- "vp8/common/setupintrarecon.c",
- "vp8/common/swapyv12buffer.c",
- "vp8/common/treecoder.c",
- "vp8/common/vp8_loopfilter.c",
-
- "vp8/decoder/dboolhuff.c",
- "vp8/decoder/decodeframe.c",
- "vp8/decoder/decodemv.c",
- "vp8/decoder/detokenize.c",
- "vp8/decoder/onyxd_if.c",
- "vp8/decoder/threading.c",
-
-
- "vp9/vp9_dx_iface.c",
-
- "vp9/common/vp9_alloccommon.c",
- "vp9/common/vp9_blockd.c",
- "vp9/common/vp9_common_data.c",
- "vp9/common/vp9_debugmodes.c",
- "vp9/common/vp9_entropy.c",
- "vp9/common/vp9_entropymode.c",
- "vp9/common/vp9_entropymv.c",
- "vp9/common/vp9_filter.c",
- "vp9/common/vp9_frame_buffers.c",
- "vp9/common/vp9_idct.c",
- "vp9/common/vp9_loopfilter.c",
- "vp9/common/vp9_mvref_common.c",
- "vp9/common/vp9_pred_common.c",
- "vp9/common/vp9_quant_common.c",
- "vp9/common/vp9_reconinter.c",
- "vp9/common/vp9_reconintra.c",
- "vp9/common/vp9_rtcd.c",
- "vp9/common/vp9_scale.c",
- "vp9/common/vp9_scan.c",
- "vp9/common/vp9_seg_common.c",
- "vp9/common/vp9_thread_common.c",
- "vp9/common/vp9_tile_common.c",
-
- "vp9/decoder/vp9_decodeframe.c",
- "vp9/decoder/vp9_decodemv.c",
- "vp9/decoder/vp9_decoder.c",
- "vp9/decoder/vp9_detokenize.c",
- "vp9/decoder/vp9_dsubexp.c",
- "vp9/decoder/vp9_dthread.c",
-
-
- "vpx/src/vpx_codec.c",
- "vpx/src/vpx_decoder.c",
- "vpx/src/vpx_image.c",
- "vpx/src/vpx_psnr.c",
-
-
- "vpx_dsp/bitreader.c",
- "vpx_dsp/bitreader_buffer.c",
- "vpx_dsp/intrapred.c",
- "vpx_dsp/inv_txfm.c",
- "vpx_dsp/loopfilter.c",
- "vpx_dsp/prob.c",
- "vpx_dsp/vpx_convolve.c",
- "vpx_dsp/vpx_dsp_rtcd.c",
-
-
- "vpx_mem/vpx_mem.c",
-
-
- "vpx_scale/vpx_scale_rtcd.c",
-
- "vpx_scale/generic/yv12config.c",
- "vpx_scale/generic/yv12extend.c",
-
-
- "vpx_util/vpx_thread.c"
+ "vp8/vp8_dx_iface.c",
+
+ "vp8/common/generic/systemdependent.c",
+
+ "vp8/common/alloccommon.c",
+ "vp8/common/blockd.c",
+ "vp8/common/copy_c.c",
+ "vp8/common/debugmodes.c",
+ "vp8/common/dequantize.c",
+ "vp8/common/entropy.c",
+ "vp8/common/entropymode.c",
+ "vp8/common/entropymv.c",
+ "vp8/common/extend.c",
+ "vp8/common/filter.c",
+ "vp8/common/findnearmv.c",
+ "vp8/common/idct_blk.c",
+ "vp8/common/idctllm.c",
+ "vp8/common/loopfilter_filters.c",
+ "vp8/common/mbpitch.c",
+ "vp8/common/modecont.c",
+ "vp8/common/quant_common.c",
+ "vp8/common/reconinter.c",
+ "vp8/common/reconintra.c",
+ "vp8/common/reconintra4x4.c",
+ "vp8/common/rtcd.c",
+ "vp8/common/setupintrarecon.c",
+ "vp8/common/swapyv12buffer.c",
+ "vp8/common/treecoder.c",
+ "vp8/common/vp8_loopfilter.c",
+
+ "vp8/decoder/dboolhuff.c",
+ "vp8/decoder/decodeframe.c",
+ "vp8/decoder/decodemv.c",
+ "vp8/decoder/detokenize.c",
+ "vp8/decoder/onyxd_if.c",
+ "vp8/decoder/threading.c",
+
+
+ "vp9/vp9_dx_iface.c",
+
+ "vp9/common/vp9_alloccommon.c",
+ "vp9/common/vp9_blockd.c",
+ "vp9/common/vp9_common_data.c",
+ "vp9/common/vp9_debugmodes.c",
+ "vp9/common/vp9_entropy.c",
+ "vp9/common/vp9_entropymode.c",
+ "vp9/common/vp9_entropymv.c",
+ "vp9/common/vp9_filter.c",
+ "vp9/common/vp9_frame_buffers.c",
+ "vp9/common/vp9_idct.c",
+ "vp9/common/vp9_loopfilter.c",
+ "vp9/common/vp9_mvref_common.c",
+ "vp9/common/vp9_pred_common.c",
+ "vp9/common/vp9_quant_common.c",
+ "vp9/common/vp9_reconinter.c",
+ "vp9/common/vp9_reconintra.c",
+ "vp9/common/vp9_rtcd.c",
+ "vp9/common/vp9_scale.c",
+ "vp9/common/vp9_scan.c",
+ "vp9/common/vp9_seg_common.c",
+ "vp9/common/vp9_thread_common.c",
+ "vp9/common/vp9_tile_common.c",
+
+ "vp9/decoder/vp9_decodeframe.c",
+ "vp9/decoder/vp9_decodemv.c",
+ "vp9/decoder/vp9_decoder.c",
+ "vp9/decoder/vp9_detokenize.c",
+ "vp9/decoder/vp9_dsubexp.c",
+ "vp9/decoder/vp9_dthread.c",
+
+
+ "vpx/src/vpx_codec.c",
+ "vpx/src/vpx_decoder.c",
+ "vpx/src/vpx_image.c",
+ "vpx/src/vpx_psnr.c",
+
+
+ "vpx_dsp/bitreader.c",
+ "vpx_dsp/bitreader_buffer.c",
+ "vpx_dsp/intrapred.c",
+ "vpx_dsp/inv_txfm.c",
+ "vpx_dsp/loopfilter.c",
+ "vpx_dsp/prob.c",
+ "vpx_dsp/vpx_convolve.c",
+ "vpx_dsp/vpx_dsp_rtcd.c",
+
+
+ "vpx_mem/vpx_mem.c",
+
+
+ "vpx_scale/vpx_scale_rtcd.c",
+
+ "vpx_scale/generic/yv12config.c",
+ "vpx_scale/generic/yv12extend.c",
+
+
+ "vpx_util/vpx_thread.c"
]
libvpx_sources_intrin_x86 = [
- "vp8/common/x86/filter_x86.c",
- "vp8/common/x86/loopfilter_x86.c",
- "vp8/common/x86/vp8_asm_stubs.c",
+ "vp8/common/x86/filter_x86.c",
+ "vp8/common/x86/loopfilter_x86.c",
+ "vp8/common/x86/vp8_asm_stubs.c",
- "vpx_dsp/x86/vpx_asm_stubs.c"
+ "vpx_dsp/x86/vpx_asm_stubs.c"
]
libvpx_sources_intrin_x86_mmx = [
- "vp8/common/x86/idct_blk_mmx.c",
+ "vp8/common/x86/idct_blk_mmx.c",
]
libvpx_sources_intrin_x86_sse2 = [
- "vp8/common/x86/idct_blk_sse2.c",
+ "vp8/common/x86/idct_blk_sse2.c",
- "vp9/common/x86/vp9_idct_intrin_sse2.c",
+ "vp9/common/x86/vp9_idct_intrin_sse2.c",
- "vpx_dsp/x86/inv_txfm_sse2.c",
- "vpx_dsp/x86/loopfilter_sse2.c",
+ "vpx_dsp/x86/inv_txfm_sse2.c",
+ "vpx_dsp/x86/loopfilter_sse2.c",
]
libvpx_sources_intrin_x86_ssse3 = [
- "vpx_dsp/x86/vpx_subpixel_8t_intrin_ssse3.c"
+ "vpx_dsp/x86/vpx_subpixel_8t_intrin_ssse3.c"
]
libvpx_sources_intrin_x86_avx2 = [
- "vpx_dsp/x86/loopfilter_avx2.c",
- "vpx_dsp/x86/vpx_subpixel_8t_intrin_avx2.c"
+ "vpx_dsp/x86/loopfilter_avx2.c",
+ "vpx_dsp/x86/vpx_subpixel_8t_intrin_avx2.c"
]
libvpx_sources_x86asm = [
- "vp8/common/x86/copy_sse2.asm",
- "vp8/common/x86/copy_sse3.asm",
- "vp8/common/x86/dequantize_mmx.asm",
- "vp8/common/x86/idctllm_mmx.asm",
- "vp8/common/x86/idctllm_sse2.asm",
- "vp8/common/x86/iwalsh_mmx.asm",
- "vp8/common/x86/iwalsh_sse2.asm",
- "vp8/common/x86/loopfilter_sse2.asm",
- "vp8/common/x86/recon_mmx.asm",
- "vp8/common/x86/recon_sse2.asm",
- "vp8/common/x86/subpixel_mmx.asm",
- "vp8/common/x86/subpixel_sse2.asm",
- "vp8/common/x86/subpixel_ssse3.asm",
- "vp8/common/x86/vp8_loopfilter_mmx.asm",
-
-
- "vpx_dsp/x86/intrapred_sse2.asm",
- "vpx_dsp/x86/intrapred_ssse3.asm",
- "vpx_dsp/x86/inv_wht_sse2.asm",
- "vpx_dsp/x86/vpx_convolve_copy_sse2.asm",
- "vpx_dsp/x86/vpx_subpixel_8t_sse2.asm",
- "vpx_dsp/x86/vpx_subpixel_8t_ssse3.asm",
- "vpx_dsp/x86/vpx_subpixel_bilinear_sse2.asm",
- "vpx_dsp/x86/vpx_subpixel_bilinear_ssse3.asm",
-
-
- "vpx_ports/emms.asm"
+ "vp8/common/x86/copy_sse2.asm",
+ "vp8/common/x86/copy_sse3.asm",
+ "vp8/common/x86/dequantize_mmx.asm",
+ "vp8/common/x86/idctllm_mmx.asm",
+ "vp8/common/x86/idctllm_sse2.asm",
+ "vp8/common/x86/iwalsh_mmx.asm",
+ "vp8/common/x86/iwalsh_sse2.asm",
+ "vp8/common/x86/loopfilter_sse2.asm",
+ "vp8/common/x86/recon_mmx.asm",
+ "vp8/common/x86/recon_sse2.asm",
+ "vp8/common/x86/subpixel_mmx.asm",
+ "vp8/common/x86/subpixel_sse2.asm",
+ "vp8/common/x86/subpixel_ssse3.asm",
+ "vp8/common/x86/vp8_loopfilter_mmx.asm",
+
+
+ "vpx_dsp/x86/intrapred_sse2.asm",
+ "vpx_dsp/x86/intrapred_ssse3.asm",
+ "vpx_dsp/x86/inv_wht_sse2.asm",
+ "vpx_dsp/x86/vpx_convolve_copy_sse2.asm",
+ "vpx_dsp/x86/vpx_subpixel_8t_sse2.asm",
+ "vpx_dsp/x86/vpx_subpixel_8t_ssse3.asm",
+ "vpx_dsp/x86/vpx_subpixel_bilinear_sse2.asm",
+ "vpx_dsp/x86/vpx_subpixel_bilinear_ssse3.asm",
+
+
+ "vpx_ports/emms.asm"
]
libvpx_sources_x86_64asm = [
- "vp8/common/x86/loopfilter_block_sse2_x86_64.asm",
+ "vp8/common/x86/loopfilter_block_sse2_x86_64.asm",
- "vpx_dsp/x86/inv_txfm_ssse3_x86_64.asm"
+ "vpx_dsp/x86/inv_txfm_ssse3_x86_64.asm"
]
libvpx_sources_arm = [
- "vpx_ports/arm_cpudetect.c",
+ "vpx_ports/arm_cpudetect.c",
- "vp8/common/arm/loopfilter_arm.c",
+ "vp8/common/arm/loopfilter_arm.c",
]
libvpx_sources_arm_neon = [
- "vp8/common/arm/neon/bilinearpredict_neon.c",
- "vp8/common/arm/neon/copymem_neon.c",
- "vp8/common/arm/neon/dc_only_idct_add_neon.c",
- "vp8/common/arm/neon/dequant_idct_neon.c",
- "vp8/common/arm/neon/dequantizeb_neon.c",
- "vp8/common/arm/neon/idct_blk_neon.c",
- "vp8/common/arm/neon/idct_dequant_0_2x_neon.c",
- "vp8/common/arm/neon/idct_dequant_full_2x_neon.c",
- "vp8/common/arm/neon/iwalsh_neon.c",
- "vp8/common/arm/neon/loopfiltersimplehorizontaledge_neon.c",
- "vp8/common/arm/neon/loopfiltersimpleverticaledge_neon.c",
- "vp8/common/arm/neon/mbloopfilter_neon.c",
- "vp8/common/arm/neon/shortidct4x4llm_neon.c",
- "vp8/common/arm/neon/sixtappredict_neon.c",
- "vp8/common/arm/neon/vp8_loopfilter_neon.c",
-
-
- "vp9/common/arm/neon/vp9_iht4x4_add_neon.c",
- "vp9/common/arm/neon/vp9_iht8x8_add_neon.c",
-
-
- "vpx_dsp/arm/idct16x16_1_add_neon.c",
- "vpx_dsp/arm/idct16x16_add_neon.c",
- "vpx_dsp/arm/idct16x16_neon.c",
- "vpx_dsp/arm/idct32x32_1_add_neon.c",
- "vpx_dsp/arm/idct32x32_add_neon.c",
- "vpx_dsp/arm/idct4x4_1_add_neon.c",
- "vpx_dsp/arm/idct4x4_add_neon.c",
- "vpx_dsp/arm/idct8x8_1_add_neon.c",
- "vpx_dsp/arm/idct8x8_add_neon.c",
- "vpx_dsp/arm/intrapred_neon.c",
- "vpx_dsp/arm/loopfilter_16_neon.c",
- "vpx_dsp/arm/loopfilter_4_neon.c",
- "vpx_dsp/arm/loopfilter_8_neon.c",
- "vpx_dsp/arm/loopfilter_neon.c",
- "vpx_dsp/arm/vpx_convolve8_avg_neon.c",
- "vpx_dsp/arm/vpx_convolve8_neon.c",
- "vpx_dsp/arm/vpx_convolve_avg_neon.c",
- "vpx_dsp/arm/vpx_convolve_copy_neon.c",
- "vpx_dsp/arm/vpx_convolve_neon.c"
+ "vp8/common/arm/neon/bilinearpredict_neon.c",
+ "vp8/common/arm/neon/copymem_neon.c",
+ "vp8/common/arm/neon/dc_only_idct_add_neon.c",
+ "vp8/common/arm/neon/dequant_idct_neon.c",
+ "vp8/common/arm/neon/dequantizeb_neon.c",
+ "vp8/common/arm/neon/idct_blk_neon.c",
+ "vp8/common/arm/neon/idct_dequant_0_2x_neon.c",
+ "vp8/common/arm/neon/idct_dequant_full_2x_neon.c",
+ "vp8/common/arm/neon/iwalsh_neon.c",
+ "vp8/common/arm/neon/loopfiltersimplehorizontaledge_neon.c",
+ "vp8/common/arm/neon/loopfiltersimpleverticaledge_neon.c",
+ "vp8/common/arm/neon/mbloopfilter_neon.c",
+ "vp8/common/arm/neon/shortidct4x4llm_neon.c",
+ "vp8/common/arm/neon/sixtappredict_neon.c",
+ "vp8/common/arm/neon/vp8_loopfilter_neon.c",
+
+
+ "vp9/common/arm/neon/vp9_iht4x4_add_neon.c",
+ "vp9/common/arm/neon/vp9_iht8x8_add_neon.c",
+
+
+ "vpx_dsp/arm/idct16x16_1_add_neon.c",
+ "vpx_dsp/arm/idct16x16_add_neon.c",
+ "vpx_dsp/arm/idct16x16_neon.c",
+ "vpx_dsp/arm/idct32x32_1_add_neon.c",
+ "vpx_dsp/arm/idct32x32_add_neon.c",
+ "vpx_dsp/arm/idct4x4_1_add_neon.c",
+ "vpx_dsp/arm/idct4x4_add_neon.c",
+ "vpx_dsp/arm/idct8x8_1_add_neon.c",
+ "vpx_dsp/arm/idct8x8_add_neon.c",
+ "vpx_dsp/arm/intrapred_neon.c",
+ "vpx_dsp/arm/loopfilter_16_neon.c",
+ "vpx_dsp/arm/loopfilter_4_neon.c",
+ "vpx_dsp/arm/loopfilter_8_neon.c",
+ "vpx_dsp/arm/loopfilter_neon.c",
+ "vpx_dsp/arm/vpx_convolve8_avg_neon.c",
+ "vpx_dsp/arm/vpx_convolve8_neon.c",
+ "vpx_dsp/arm/vpx_convolve_avg_neon.c",
+ "vpx_dsp/arm/vpx_convolve_copy_neon.c",
+ "vpx_dsp/arm/vpx_convolve_neon.c"
]
libvpx_sources_arm_neon_gas = [
- "vpx_dsp/arm/gas/intrapred_neon_asm.s",
- "vpx_dsp/arm/gas/loopfilter_mb_neon.s",
- "vpx_dsp/arm/gas/save_reg_neon.s"
+ "vpx_dsp/arm/gas/intrapred_neon_asm.s",
+ "vpx_dsp/arm/gas/loopfilter_mb_neon.s",
+ "vpx_dsp/arm/gas/save_reg_neon.s"
]
libvpx_sources_arm_neon_armasm_ms = [
- "vpx_dsp/arm/armasm_ms/intrapred_neon_asm.asm",
- "vpx_dsp/arm/armasm_ms/loopfilter_mb_neon.asm",
- "vpx_dsp/arm/armasm_ms/save_reg_neon.asm"
+ "vpx_dsp/arm/armasm_ms/intrapred_neon_asm.asm",
+ "vpx_dsp/arm/armasm_ms/loopfilter_mb_neon.asm",
+ "vpx_dsp/arm/armasm_ms/save_reg_neon.asm"
]
libvpx_sources_arm_neon_gas_apple = [
- "vpx_dsp/arm/gas_apple/intrapred_neon_asm.s",
- "vpx_dsp/arm/gas_apple/loopfilter_mb_neon.s",
- "vpx_dsp/arm/gas_apple/save_reg_neon.s"
+ "vpx_dsp/arm/gas_apple/intrapred_neon_asm.s",
+ "vpx_dsp/arm/gas_apple/loopfilter_mb_neon.s",
+ "vpx_dsp/arm/gas_apple/save_reg_neon.s"
]
libvpx_sources = [libvpx_dir + file for file in libvpx_sources]
@@ -248,143 +248,146 @@ libvpx_sources_arm_neon_gas_apple = [libvpx_dir + file for file in libvpx_source
Import('env')
Import('env_webm')
-env_webm.Append(CPPPATH = [libvpx_dir])
+env_webm.Append(CPPPATH=[libvpx_dir])
env_libvpx = env.Clone()
-env_libvpx.Append(CPPPATH = [libvpx_dir])
+env_libvpx.Append(CPPPATH=[libvpx_dir])
cpu_bits = env["bits"]
osx_fat = (env["platform"] == 'osx' and cpu_bits == 'fat')
webm_cpu_x86 = False
webm_cpu_arm = False
-if env["platform"] == 'winrt':
- if 'arm' in env["PROGSUFFIX"]:
- webm_cpu_arm = True
- else:
- webm_cpu_x86 = True
+if env["platform"] == 'uwp':
+ if 'arm' in env["PROGSUFFIX"]:
+ webm_cpu_arm = True
+ else:
+ webm_cpu_x86 = True
else:
- is_android_x86 = (env["platform"] == 'android' and env["android_arch"] == 'x86')
- if is_android_x86:
- cpu_bits = '32'
- if osx_fat:
- webm_cpu_x86 = True
- else:
- webm_cpu_x86 = (cpu_bits == '32' or cpu_bits == '64') and (env["platform"] == 'windows' or env["platform"] == 'x11' or env["platform"] == 'osx' or env["platform"] == 'haiku' or is_android_x86)
- webm_cpu_arm = env["platform"] == 'iphone' or env["platform"] == 'bb10' or (env["platform"] == 'android' and env["android_arch"] != 'x86')
+ import platform
+ is_x11_or_server_arm = ((env["platform"] == 'x11' or env["platform"] == 'server') and platform.machine().startswith('arm'))
+ is_ios_x86 = (env["platform"] == 'iphone' and env["ios_sim"] == "yes")
+ is_android_x86 = (env["platform"] == 'android' and env["android_arch"] == 'x86')
+ if is_android_x86:
+ cpu_bits = '32'
+ if osx_fat:
+ webm_cpu_x86 = True
+ else:
+ webm_cpu_x86 = not is_x11_or_server_arm and (cpu_bits == '32' or cpu_bits == '64') and (env["platform"] == 'windows' or env["platform"] == 'x11' or env["platform"] == 'osx' or env["platform"] == 'haiku' or is_android_x86 or is_ios_x86)
+ webm_cpu_arm = is_x11_or_server_arm or (not is_ios_x86 and env["platform"] == 'iphone') or env["platform"] == 'bb10' or (not is_android_x86 and env["platform"] == 'android')
if webm_cpu_x86:
- import subprocess
- import os
-
- yasm_paths = [
- "yasm",
- "../../../yasm",
- ]
-
- yasm_found = False
-
- devnull = open(os.devnull)
- for yasm_path in yasm_paths:
- try:
- yasm_found = True
- subprocess.Popen([yasm_path, "--version"], stdout=devnull, stderr=devnull).communicate()
- except:
- yasm_found = False
- if yasm_found:
- break
-
- if not yasm_found:
- webm_cpu_x86 = False
- print "YASM is necessary for WebM SIMD optimizations."
+ import subprocess
+ import os
+
+ yasm_paths = [
+ "yasm",
+ "../../../yasm",
+ ]
+
+ yasm_found = False
+
+ devnull = open(os.devnull)
+ for yasm_path in yasm_paths:
+ try:
+ yasm_found = True
+ subprocess.Popen([yasm_path, "--version"], stdout=devnull, stderr=devnull).communicate()
+ except:
+ yasm_found = False
+ if yasm_found:
+ break
+
+ if not yasm_found:
+ webm_cpu_x86 = False
+ print "YASM is necessary for WebM SIMD optimizations."
webm_simd_optimizations = False
if webm_cpu_x86:
- if osx_fat:
- #'osx' platform only: run python script which will compile using 'yasm' command and then merge 32-bit and 64-bit using 'lipo' command
- env_libvpx["AS"] = 'python modules/webm/libvpx/yasm_osx_fat.py'
- env_libvpx["ASFLAGS"] = '-I' + libvpx_dir[1:]
- env_libvpx["ASCOM"] = '$AS $ASFLAGS $TARGET $SOURCES'
- else:
- if env["platform"] == 'windows' or env["platform"] == 'winrt':
- env_libvpx["ASFORMAT"] = 'win'
- elif env["platform"] == 'osx':
- env_libvpx["ASFORMAT"] = 'macho'
- else:
- env_libvpx["ASFORMAT"] = 'elf'
- env_libvpx["ASFORMAT"] += cpu_bits
-
- env_libvpx["AS"] = 'yasm'
- env_libvpx["ASFLAGS"] = '-I' + libvpx_dir[1:] + ' -f $ASFORMAT -D $ASCPU'
- env_libvpx["ASCOM"] = '$AS $ASFLAGS -o $TARGET $SOURCES'
-
- if cpu_bits == '32':
- env_libvpx["ASCPU"] = 'X86_32'
- elif cpu_bits == '64':
- env_libvpx["ASCPU"] = 'X86_64'
-
- env_libvpx.Append(CCFLAGS=['-DWEBM_X86ASM'])
-
- webm_simd_optimizations = True
+ if osx_fat:
+ #'osx' platform only: run python script which will compile using 'yasm' command and then merge 32-bit and 64-bit using 'lipo' command
+ env_libvpx["AS"] = 'python modules/webm/libvpx/yasm_osx_fat.py'
+ env_libvpx["ASFLAGS"] = '-I' + libvpx_dir[1:]
+ env_libvpx["ASCOM"] = '$AS $ASFLAGS $TARGET $SOURCES'
+ else:
+ if env["platform"] == 'windows' or env["platform"] == 'uwp':
+ env_libvpx["ASFORMAT"] = 'win'
+ elif env["platform"] == 'osx' or env["platform"] == "iphone":
+ env_libvpx["ASFORMAT"] = 'macho'
+ else:
+ env_libvpx["ASFORMAT"] = 'elf'
+ env_libvpx["ASFORMAT"] += cpu_bits
+
+ env_libvpx["AS"] = 'yasm'
+ env_libvpx["ASFLAGS"] = '-I' + libvpx_dir[1:] + ' -f $ASFORMAT -D $ASCPU'
+ env_libvpx["ASCOM"] = '$AS $ASFLAGS -o $TARGET $SOURCES'
+
+ if cpu_bits == '32':
+ env_libvpx["ASCPU"] = 'X86_32'
+ elif cpu_bits == '64':
+ env_libvpx["ASCPU"] = 'X86_64'
+
+ env_libvpx.Append(CCFLAGS=['-DWEBM_X86ASM'])
+
+ webm_simd_optimizations = True
if webm_cpu_arm:
- if env["platform"] == 'iphone':
- env_libvpx["ASFLAGS"] = '-arch armv7'
- elif env["platform"] == 'android':
- env_libvpx["ASFLAGS"] = '-mfpu=neon'
- elif env["platform"] == 'winrt':
- env_libvpx["AS"] = 'armasm'
- env_libvpx["ASFLAGS"] = ''
- env_libvpx["ASCOM"] = '$AS $ASFLAGS -o $TARGET $SOURCES'
+ if env["platform"] == 'iphone':
+ env_libvpx["ASFLAGS"] = '-arch armv7'
+ elif env["platform"] == 'android' or env["platform"] == 'x11' or env["platform"] == 'server':
+ env_libvpx["ASFLAGS"] = '-mfpu=neon'
+ elif env["platform"] == 'uwp':
+ env_libvpx["AS"] = 'armasm'
+ env_libvpx["ASFLAGS"] = ''
+ env_libvpx["ASCOM"] = '$AS $ASFLAGS -o $TARGET $SOURCES'
- env_libvpx.Append(CCFLAGS=['-DWEBM_ARMASM'])
+ env_libvpx.Append(CCFLAGS=['-DWEBM_ARMASM'])
- webm_simd_optimizations = True
+ webm_simd_optimizations = True
if webm_simd_optimizations == False:
- print "WebM SIMD optimizations are disabled. Check if your CPU architecture, CPU bits or platform are supported!"
+ print "WebM SIMD optimizations are disabled. Check if your CPU architecture, CPU bits or platform are supported!"
env_libvpx.add_source_files(env.modules_sources, libvpx_sources)
if webm_cpu_x86:
- is_clang_or_gcc = ('gcc' in env["CC"]) or ('clang' in env["CC"])
+ is_clang_or_gcc = ('gcc' in env["CC"]) or ('clang' in env["CC"])
- env_libvpx_mmx = env_libvpx.Clone()
- if cpu_bits == '32' and is_clang_or_gcc:
- env_libvpx_mmx.Append(CCFLAGS=['-mmmx'])
- env_libvpx_mmx.add_source_files(env.modules_sources, libvpx_sources_intrin_x86_mmx)
+ env_libvpx_mmx = env_libvpx.Clone()
+ if cpu_bits == '32' and is_clang_or_gcc:
+ env_libvpx_mmx.Append(CCFLAGS=['-mmmx'])
+ env_libvpx_mmx.add_source_files(env.modules_sources, libvpx_sources_intrin_x86_mmx)
- env_libvpx_sse2 = env_libvpx.Clone()
- if cpu_bits == '32' and is_clang_or_gcc:
- env_libvpx_sse2.Append(CCFLAGS=['-msse2'])
- env_libvpx_sse2.add_source_files(env.modules_sources, libvpx_sources_intrin_x86_sse2)
+ env_libvpx_sse2 = env_libvpx.Clone()
+ if cpu_bits == '32' and is_clang_or_gcc:
+ env_libvpx_sse2.Append(CCFLAGS=['-msse2'])
+ env_libvpx_sse2.add_source_files(env.modules_sources, libvpx_sources_intrin_x86_sse2)
- env_libvpx_ssse3 = env_libvpx.Clone()
- if is_clang_or_gcc:
- env_libvpx_ssse3.Append(CCFLAGS=['-mssse3'])
- env_libvpx_ssse3.add_source_files(env.modules_sources, libvpx_sources_intrin_x86_ssse3)
+ env_libvpx_ssse3 = env_libvpx.Clone()
+ if is_clang_or_gcc:
+ env_libvpx_ssse3.Append(CCFLAGS=['-mssse3'])
+ env_libvpx_ssse3.add_source_files(env.modules_sources, libvpx_sources_intrin_x86_ssse3)
- env_libvpx_avx2 = env_libvpx.Clone()
- if is_clang_or_gcc:
- env_libvpx_avx2.Append(CCFLAGS=['-mavx2'])
- env_libvpx_avx2.add_source_files(env.modules_sources, libvpx_sources_intrin_x86_avx2)
+ env_libvpx_avx2 = env_libvpx.Clone()
+ if is_clang_or_gcc:
+ env_libvpx_avx2.Append(CCFLAGS=['-mavx2'])
+ env_libvpx_avx2.add_source_files(env.modules_sources, libvpx_sources_intrin_x86_avx2)
- env_libvpx.add_source_files(env.modules_sources, libvpx_sources_intrin_x86)
+ env_libvpx.add_source_files(env.modules_sources, libvpx_sources_intrin_x86)
- env_libvpx.add_source_files(env.modules_sources, libvpx_sources_x86asm)
- if cpu_bits == '64' or osx_fat:
- env_libvpx.add_source_files(env.modules_sources, libvpx_sources_x86_64asm)
+ env_libvpx.add_source_files(env.modules_sources, libvpx_sources_x86asm)
+ if cpu_bits == '64' or osx_fat:
+ env_libvpx.add_source_files(env.modules_sources, libvpx_sources_x86_64asm)
elif webm_cpu_arm:
- env_libvpx.add_source_files(env.modules_sources, libvpx_sources_arm)
-
- env_libvpx_neon = env_libvpx.Clone()
- if env["platform"] == 'android' and env["android_arch"] == 'armv6':
- env_libvpx_neon.Append(CCFLAGS=['-mfpu=neon'])
- env_libvpx_neon.add_source_files(env.modules_sources, libvpx_sources_arm_neon)
-
- if env["platform"] == 'winrt':
- env_libvpx.add_source_files(env.modules_sources, libvpx_sources_arm_neon_armasm_ms)
- elif env["platform"] == 'iphone':
- env_libvpx.add_source_files(env.modules_sources, libvpx_sources_arm_neon_gas_apple)
- else:
- env_libvpx.add_source_files(env.modules_sources, libvpx_sources_arm_neon_gas)
+ env_libvpx.add_source_files(env.modules_sources, libvpx_sources_arm)
+
+ env_libvpx_neon = env_libvpx.Clone()
+ if env["platform"] == 'android' and env["android_arch"] == 'armv6':
+ env_libvpx_neon.Append(CCFLAGS=['-mfpu=neon'])
+ env_libvpx_neon.add_source_files(env.modules_sources, libvpx_sources_arm_neon)
+
+ if env["platform"] == 'uwp':
+ env_libvpx.add_source_files(env.modules_sources, libvpx_sources_arm_neon_armasm_ms)
+ elif env["platform"] == 'iphone':
+ env_libvpx.add_source_files(env.modules_sources, libvpx_sources_arm_neon_gas_apple)
+ else:
+ env_libvpx.add_source_files(env.modules_sources, libvpx_sources_arm_neon_gas)
diff --git a/modules/webm/libvpx/yasm_osx_fat.py b/modules/webm/libvpx/yasm_osx_fat.py
index bcee50b389..0065e2766c 100644
--- a/modules/webm/libvpx/yasm_osx_fat.py
+++ b/modules/webm/libvpx/yasm_osx_fat.py
@@ -3,9 +3,9 @@
import sys
import os
-includes = sys.argv[1]
+includes = sys.argv[1]
output_file = sys.argv[2]
-input_file = sys.argv[3]
+input_file = sys.argv[3]
can_remove = {}
@@ -14,25 +14,25 @@ lipo_command = ''
exit_code = 1
for arch in ['32', '64']:
- if arch == '32' and input_file.endswith('x86_64.asm'):
- can_remove[arch] = False
- else:
- command = 'yasm ' + includes + ' -f macho' + arch + ' -D X86_' + arch + ' -o ' + output_file + '.' + arch + ' ' + input_file
- print(command)
- if os.system(command) == 0:
- lipo_command += output_file + '.' + arch + ' '
- can_remove[arch] = True
- else:
- can_remove[arch] = False
+ if arch == '32' and input_file.endswith('x86_64.asm'):
+ can_remove[arch] = False
+ else:
+ command = 'yasm ' + includes + ' -f macho' + arch + ' -D X86_' + arch + ' -o ' + output_file + '.' + arch + ' ' + input_file
+ print(command)
+ if os.system(command) == 0:
+ lipo_command += output_file + '.' + arch + ' '
+ can_remove[arch] = True
+ else:
+ can_remove[arch] = False
if lipo_command != '':
- lipo_command = 'lipo -create ' + lipo_command + '-output ' + output_file
- print(lipo_command)
- if os.system(lipo_command) == 0:
- exit_code = 0
+ lipo_command = 'lipo -create ' + lipo_command + '-output ' + output_file
+ print(lipo_command)
+ if os.system(lipo_command) == 0:
+ exit_code = 0
for arch in ['32', '64']:
- if can_remove[arch]:
- os.remove(output_file + '.' + arch)
+ if can_remove[arch]:
+ os.remove(output_file + '.' + arch)
sys.exit(exit_code)
diff --git a/modules/webm/register_types.cpp b/modules/webm/register_types.cpp
index 07031caad1..e50eb337ae 100644
--- a/modules/webm/register_types.cpp
+++ b/modules/webm/register_types.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* 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 */
@@ -36,7 +36,7 @@ void register_webm_types() {
webm_stream_loader = memnew(ResourceFormatLoaderVideoStreamWebm);
ResourceLoader::add_resource_format_loader(webm_stream_loader);
- ObjectTypeDB::register_type<VideoStreamWebm>();
+ ClassDB::register_class<VideoStreamWebm>();
}
void unregister_webm_types() {
diff --git a/modules/webm/register_types.h b/modules/webm/register_types.h
index 62f08646a4..3df0d7bbaa 100644
--- a/modules/webm/register_types.h
+++ b/modules/webm/register_types.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* 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 */
diff --git a/modules/webm/video_stream_webm.cpp b/modules/webm/video_stream_webm.cpp
index dc2266804d..bdd97f1df7 100644
--- a/modules/webm/video_stream_webm.cpp
+++ b/modules/webm/video_stream_webm.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* 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 */
@@ -127,7 +127,7 @@ bool VideoStreamPlaybackWebm::open_file(const String &p_file) {
}
frame_data.resize((webm->getWidth() * webm->getHeight()) << 2);
- texture->create(webm->getWidth(), webm->getHeight(), Image::FORMAT_RGBA, Texture::FLAG_FILTER | Texture::FLAG_VIDEO_SURFACE);
+ texture->create(webm->getWidth(), webm->getHeight(), Image::FORMAT_RGBA8, Texture::FLAG_FILTER | Texture::FLAG_VIDEO_SURFACE);
return true;
}
@@ -167,7 +167,7 @@ void VideoStreamPlaybackWebm::play() {
stop();
- delay_compensation = Globals::get_singleton()->get("audio/video_delay_compensation_ms");
+ delay_compensation = GlobalConfig::get_singleton()->get("audio/video_delay_compensation_ms");
delay_compensation /= 1000.0;
playing = true;
@@ -293,7 +293,7 @@ void VideoStreamPlaybackWebm::update(float p_delta) {
if (err == VPXDecoder::NO_ERROR && image.w == webm->getWidth() && image.h == webm->getHeight()) {
- DVector<uint8_t>::Write w = frame_data.write();
+ PoolVector<uint8_t>::Write w = frame_data.write();
bool converted = false;
if (image.chromaShiftW == 1 && image.chromaShiftH == 1) {
@@ -318,7 +318,7 @@ void VideoStreamPlaybackWebm::update(float p_delta) {
}
if (converted)
- texture->set_data(Image(image.w, image.h, 0, Image::FORMAT_RGBA, frame_data)); //Zero copy send to visual server
+ texture->set_data(Image(image.w, image.h, 0, Image::FORMAT_RGBA8, frame_data)); //Zero copy send to visual server
}
break;
@@ -415,7 +415,7 @@ bool ResourceFormatLoaderVideoStreamWebm::handles_type(const String &p_type) con
String ResourceFormatLoaderVideoStreamWebm::get_resource_type(const String &p_path) const {
- const String exl = p_path.extension().to_lower();
+ const String exl = p_path.get_extension().to_lower();
if (exl == "webm")
return "VideoStreamWebm";
return "";
diff --git a/modules/webm/video_stream_webm.h b/modules/webm/video_stream_webm.h
index d1e02d0663..cb4ef53f6d 100644
--- a/modules/webm/video_stream_webm.h
+++ b/modules/webm/video_stream_webm.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* 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 */
@@ -36,7 +36,7 @@ class OpusVorbisDecoder;
class VideoStreamPlaybackWebm : public VideoStreamPlayback {
- OBJ_TYPE(VideoStreamPlaybackWebm, VideoStreamPlayback)
+ GDCLASS(VideoStreamPlaybackWebm, VideoStreamPlayback)
String file_name;
int audio_track;
@@ -56,7 +56,7 @@ class VideoStreamPlaybackWebm : public VideoStreamPlayback {
double delay_compensation;
double time, video_frame_delay, video_pos;
- DVector<uint8_t> frame_data;
+ PoolVector<uint8_t> frame_data;
Ref<ImageTexture> texture;
int16_t *pcm;
@@ -102,7 +102,7 @@ private:
class VideoStreamWebm : public VideoStream {
- OBJ_TYPE(VideoStreamWebm, VideoStream)
+ GDCLASS(VideoStreamWebm, VideoStream)
String file;
int audio_track;
diff --git a/modules/webp/SCsub b/modules/webp/SCsub
index 38585a1ff2..92f34c4da1 100644
--- a/modules/webp/SCsub
+++ b/modules/webp/SCsub
@@ -6,116 +6,116 @@ Import('env_modules')
env_webp = env_modules.Clone()
# Thirdparty source files
-if (env["libwebp"] != "system"): # builtin
- thirdparty_dir = "#thirdparty/libwebp/"
- thirdparty_sources = [
- "enc/webpenc.c",
- "enc/near_lossless.c",
- "enc/frame.c",
- "enc/alpha.c",
- "enc/picture_csp.c",
- "enc/vp8l.c",
- "enc/picture_psnr.c",
- "enc/delta_palettization.c",
- "enc/syntax.c",
- "enc/backward_references.c",
- "enc/token.c",
- "enc/analysis.c",
- "enc/iterator.c",
- "enc/picture_tools.c",
- "enc/picture_rescale.c",
- "enc/config.c",
- "enc/tree.c",
- "enc/cost.c",
- "enc/picture.c",
- "enc/quant.c",
- "enc/filter.c",
- "enc/histogram.c",
- "utils/rescaler.c",
- "utils/filters.c",
- "utils/quant_levels_dec.c",
- "utils/huffman.c",
- "utils/thread.c",
- "utils/quant_levels.c",
- "utils/bit_writer.c",
- "utils/bit_reader.c",
- "utils/random.c",
- "utils/utils.c",
- "utils/huffman_encode.c",
- "utils/color_cache.c",
- "mux/muxinternal.c",
- "mux/muxread.c",
- "mux/anim_encode.c",
- "mux/muxedit.c",
- "dec/webp.c",
- "dec/frame.c",
- "dec/alpha.c",
- "dec/vp8l.c",
- "dec/io.c",
- "dec/vp8.c",
- "dec/idec.c",
- "dec/tree.c",
- "dec/buffer.c",
- "dec/quant.c",
- "demux/demux.c",
- "demux/anim_decode.c",
- "dsp/yuv.c",
- "dsp/filters_sse2.c",
- "dsp/dec_sse41.c",
- "dsp/rescaler.c",
- "dsp/lossless_sse2.c",
- "dsp/alpha_processing_sse41.c",
- "dsp/alpha_processing_sse2.c",
- "dsp/filters.c",
- "dsp/upsampling_mips_dsp_r2.c",
- "dsp/dec_neon.c",
- "dsp/enc_neon.c",
- "dsp/lossless_enc_mips32.c",
- "dsp/lossless_enc_sse2.c",
- "dsp/upsampling.c",
- "dsp/lossless_enc_neon.c",
- "dsp/alpha_processing.c",
- "dsp/cost_sse2.c",
- "dsp/dec_mips32.c",
- "dsp/enc_avx2.c",
- "dsp/rescaler_mips32.c",
- "dsp/enc.c",
- "dsp/lossless_enc_sse41.c",
- "dsp/cost_mips32.c",
- "dsp/lossless_mips_dsp_r2.c",
- "dsp/filters_mips_dsp_r2.c",
- "dsp/upsampling_neon.c",
- "dsp/alpha_processing_mips_dsp_r2.c",
- "dsp/enc_mips_dsp_r2.c",
- "dsp/lossless.c",
- "dsp/yuv_mips_dsp_r2.c",
- "dsp/cost_mips_dsp_r2.c",
- "dsp/argb.c",
- "dsp/dec_sse2.c",
- "dsp/rescaler_sse2.c",
- "dsp/enc_sse41.c",
- "dsp/argb_mips_dsp_r2.c",
- "dsp/lossless_enc_mips_dsp_r2.c",
- "dsp/dec_clip_tables.c",
- "dsp/yuv_mips32.c",
- "dsp/cpu.c",
- "dsp/dec.c",
- "dsp/argb_sse2.c",
- "dsp/lossless_neon.c",
- "dsp/lossless_enc.c",
- "dsp/enc_mips32.c",
- "dsp/cost.c",
- "dsp/rescaler_mips_dsp_r2.c",
- "dsp/dec_mips_dsp_r2.c",
- "dsp/rescaler_neon.c",
- "dsp/yuv_sse2.c",
- "dsp/enc_sse2.c",
- "dsp/upsampling_sse2.c",
- ]
- thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
+if (env['builtin_libwebp'] != 'no'):
+ thirdparty_dir = "#thirdparty/libwebp/"
+ thirdparty_sources = [
+ "enc/webpenc.c",
+ "enc/near_lossless.c",
+ "enc/frame.c",
+ "enc/alpha.c",
+ "enc/picture_csp.c",
+ "enc/vp8l.c",
+ "enc/picture_psnr.c",
+ "enc/delta_palettization.c",
+ "enc/syntax.c",
+ "enc/backward_references.c",
+ "enc/token.c",
+ "enc/analysis.c",
+ "enc/iterator.c",
+ "enc/picture_tools.c",
+ "enc/picture_rescale.c",
+ "enc/config.c",
+ "enc/tree.c",
+ "enc/cost.c",
+ "enc/picture.c",
+ "enc/quant.c",
+ "enc/filter.c",
+ "enc/histogram.c",
+ "utils/rescaler.c",
+ "utils/filters.c",
+ "utils/quant_levels_dec.c",
+ "utils/huffman.c",
+ "utils/thread.c",
+ "utils/quant_levels.c",
+ "utils/bit_writer.c",
+ "utils/bit_reader.c",
+ "utils/random.c",
+ "utils/utils.c",
+ "utils/huffman_encode.c",
+ "utils/color_cache.c",
+ "mux/muxinternal.c",
+ "mux/muxread.c",
+ "mux/anim_encode.c",
+ "mux/muxedit.c",
+ "dec/webp.c",
+ "dec/frame.c",
+ "dec/alpha.c",
+ "dec/vp8l.c",
+ "dec/io.c",
+ "dec/vp8.c",
+ "dec/idec.c",
+ "dec/tree.c",
+ "dec/buffer.c",
+ "dec/quant.c",
+ "demux/demux.c",
+ "demux/anim_decode.c",
+ "dsp/yuv.c",
+ "dsp/filters_sse2.c",
+ "dsp/dec_sse41.c",
+ "dsp/rescaler.c",
+ "dsp/lossless_sse2.c",
+ "dsp/alpha_processing_sse41.c",
+ "dsp/alpha_processing_sse2.c",
+ "dsp/filters.c",
+ "dsp/upsampling_mips_dsp_r2.c",
+ "dsp/dec_neon.c",
+ "dsp/enc_neon.c",
+ "dsp/lossless_enc_mips32.c",
+ "dsp/lossless_enc_sse2.c",
+ "dsp/upsampling.c",
+ "dsp/lossless_enc_neon.c",
+ "dsp/alpha_processing.c",
+ "dsp/cost_sse2.c",
+ "dsp/dec_mips32.c",
+ "dsp/enc_avx2.c",
+ "dsp/rescaler_mips32.c",
+ "dsp/enc.c",
+ "dsp/lossless_enc_sse41.c",
+ "dsp/cost_mips32.c",
+ "dsp/lossless_mips_dsp_r2.c",
+ "dsp/filters_mips_dsp_r2.c",
+ "dsp/upsampling_neon.c",
+ "dsp/alpha_processing_mips_dsp_r2.c",
+ "dsp/enc_mips_dsp_r2.c",
+ "dsp/lossless.c",
+ "dsp/yuv_mips_dsp_r2.c",
+ "dsp/cost_mips_dsp_r2.c",
+ "dsp/argb.c",
+ "dsp/dec_sse2.c",
+ "dsp/rescaler_sse2.c",
+ "dsp/enc_sse41.c",
+ "dsp/argb_mips_dsp_r2.c",
+ "dsp/lossless_enc_mips_dsp_r2.c",
+ "dsp/dec_clip_tables.c",
+ "dsp/yuv_mips32.c",
+ "dsp/cpu.c",
+ "dsp/dec.c",
+ "dsp/argb_sse2.c",
+ "dsp/lossless_neon.c",
+ "dsp/lossless_enc.c",
+ "dsp/enc_mips32.c",
+ "dsp/cost.c",
+ "dsp/rescaler_mips_dsp_r2.c",
+ "dsp/dec_mips_dsp_r2.c",
+ "dsp/rescaler_neon.c",
+ "dsp/yuv_sse2.c",
+ "dsp/enc_sse2.c",
+ "dsp/upsampling_sse2.c",
+ ]
+ thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
- env_webp.add_source_files(env.modules_sources, thirdparty_sources)
- env_webp.Append(CPPPATH = [thirdparty_dir])
+ env_webp.add_source_files(env.modules_sources, thirdparty_sources)
+ env_webp.Append(CPPPATH=[thirdparty_dir])
# Godot source files
env_webp.add_source_files(env.modules_sources, "*.cpp")
diff --git a/modules/webp/config.py b/modules/webp/config.py
index 368e97e152..fb920482f5 100644
--- a/modules/webp/config.py
+++ b/modules/webp/config.py
@@ -1,6 +1,7 @@
def can_build(platform):
- return True
+ return True
+
def configure(env):
- pass
+ pass
diff --git a/modules/webp/image_loader_webp.cpp b/modules/webp/image_loader_webp.cpp
index 0fe2db3261..3508c6a663 100644
--- a/modules/webp/image_loader_webp.cpp
+++ b/modules/webp/image_loader_webp.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* 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 */
@@ -36,48 +36,48 @@
#include <webp/decode.h>
#include <webp/encode.h>
-static DVector<uint8_t> _webp_lossy_pack(const Image& p_image,float p_quality) {
+static PoolVector<uint8_t> _webp_lossy_pack(const Image& p_image,float p_quality) {
- ERR_FAIL_COND_V(p_image.empty(),DVector<uint8_t>());
+ ERR_FAIL_COND_V(p_image.empty(),PoolVector<uint8_t>());
Image img=p_image;
if (img.detect_alpha())
- img.convert(Image::FORMAT_RGBA);
+ img.convert(Image::FORMAT_RGBA8);
else
- img.convert(Image::FORMAT_RGB);
+ img.convert(Image::FORMAT_RGB8);
Size2 s(img.get_width(),img.get_height());
- DVector<uint8_t> data = img.get_data();
- DVector<uint8_t>::Read r = data.read();
+ PoolVector<uint8_t> data = img.get_data();
+ PoolVector<uint8_t>::Read r = data.read();
uint8_t *dst_buff=NULL;
size_t dst_size=0;
- if (img.get_format()==Image::FORMAT_RGB) {
+ if (img.get_format()==Image::FORMAT_RGB8) {
dst_size = WebPEncodeRGB(r.ptr(),s.width,s.height,3*s.width,CLAMP(p_quality*100.0,0,100.0),&dst_buff);
} else {
dst_size = WebPEncodeRGBA(r.ptr(),s.width,s.height,4*s.width,CLAMP(p_quality*100.0,0,100.0),&dst_buff);
}
- ERR_FAIL_COND_V(dst_size==0,DVector<uint8_t>());
- DVector<uint8_t> dst;
+ ERR_FAIL_COND_V(dst_size==0,PoolVector<uint8_t>());
+ PoolVector<uint8_t> dst;
dst.resize(4+dst_size);
- DVector<uint8_t>::Write w = dst.write();
+ PoolVector<uint8_t>::Write w = dst.write();
w[0]='W';
w[1]='E';
w[2]='B';
w[3]='P';
copymem(&w[4],dst_buff,dst_size);
free(dst_buff);
- w=DVector<uint8_t>::Write();
+ w=PoolVector<uint8_t>::Write();
return dst;
}
-static Image _webp_lossy_unpack(const DVector<uint8_t>& p_buffer) {
+static Image _webp_lossy_unpack(const PoolVector<uint8_t>& p_buffer) {
int size = p_buffer.size()-4;
ERR_FAIL_COND_V(size<=0,Image());
- DVector<uint8_t>::Read r = p_buffer.read();
+ PoolVector<uint8_t>::Read r = p_buffer.read();
ERR_FAIL_COND_V(r[0]!='W' || r[1]!='E' || r[2]!='B' || r[3]!='P',Image());
WebPBitstreamFeatures features;
@@ -90,11 +90,11 @@ static Image _webp_lossy_unpack(const DVector<uint8_t>& p_buffer) {
//print_line("height: "+itos(features.height));
//print_line("alpha: "+itos(features.has_alpha));
- DVector<uint8_t> dst_image;
+ PoolVector<uint8_t> dst_image;
int datasize = features.width*features.height*(features.has_alpha?4:3);
dst_image.resize(datasize);
- DVector<uint8_t>::Write dst_w = dst_image.write();
+ PoolVector<uint8_t>::Write dst_w = dst_image.write();
bool errdec=false;
if (features.has_alpha) {
@@ -107,9 +107,9 @@ static Image _webp_lossy_unpack(const DVector<uint8_t>& p_buffer) {
//ERR_EXPLAIN("Error decoding webp! - "+p_file);
ERR_FAIL_COND_V(errdec,Image());
- dst_w = DVector<uint8_t>::Write();
+ dst_w = PoolVector<uint8_t>::Write();
- return Image(features.width,features.height,0,features.has_alpha?Image::FORMAT_RGBA:Image::FORMAT_RGB,dst_image);
+ return Image(features.width,features.height,0,features.has_alpha?Image::FORMAT_RGBA8:Image::FORMAT_RGB8,dst_image);
}
@@ -118,12 +118,12 @@ Error ImageLoaderWEBP::load_image(Image *p_image,FileAccess *f) {
uint32_t size = f->get_len();
- DVector<uint8_t> src_image;
+ PoolVector<uint8_t> src_image;
src_image.resize(size);
WebPBitstreamFeatures features;
- DVector<uint8_t>::Write src_w = src_image.write();
+ PoolVector<uint8_t>::Write src_w = src_image.write();
f->get_buffer(src_w.ptr(),size);
ERR_FAIL_COND_V(f->eof_reached(), ERR_FILE_EOF);
@@ -137,14 +137,14 @@ Error ImageLoaderWEBP::load_image(Image *p_image,FileAccess *f) {
print_line("height: "+itos(features.height));
print_line("alpha: "+itos(features.has_alpha));
- src_w = DVector<uint8_t>::Write();
+ src_w = PoolVector<uint8_t>::Write();
- DVector<uint8_t> dst_image;
+ PoolVector<uint8_t> dst_image;
int datasize = features.width*features.height*(features.has_alpha?4:3);
dst_image.resize(datasize);
- DVector<uint8_t>::Read src_r = src_image.read();
- DVector<uint8_t>::Write dst_w = dst_image.write();
+ PoolVector<uint8_t>::Read src_r = src_image.read();
+ PoolVector<uint8_t>::Write dst_w = dst_image.write();
bool errdec=false;
@@ -158,10 +158,10 @@ Error ImageLoaderWEBP::load_image(Image *p_image,FileAccess *f) {
//ERR_EXPLAIN("Error decoding webp! - "+p_file);
ERR_FAIL_COND_V(errdec,ERR_FILE_CORRUPT);
- src_r = DVector<uint8_t>::Read();
- dst_w = DVector<uint8_t>::Write();
+ src_r = PoolVector<uint8_t>::Read();
+ dst_w = PoolVector<uint8_t>::Write();
- *p_image = Image(features.width,features.height,0,features.has_alpha?Image::FORMAT_RGBA:Image::FORMAT_RGB,dst_image);
+ *p_image = Image(features.width,features.height,0,features.has_alpha?Image::FORMAT_RGBA8:Image::FORMAT_RGB8,dst_image);
return OK;
diff --git a/modules/webp/image_loader_webp.h b/modules/webp/image_loader_webp.h
index 24f79708db..eb1b32ac95 100644
--- a/modules/webp/image_loader_webp.h
+++ b/modules/webp/image_loader_webp.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* 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 */
diff --git a/modules/webp/register_types.cpp b/modules/webp/register_types.cpp
index 039876bbb9..7a4e35dc4c 100644
--- a/modules/webp/register_types.cpp
+++ b/modules/webp/register_types.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* 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 */
diff --git a/modules/webp/register_types.h b/modules/webp/register_types.h
index a200188e47..ce1f29937b 100644
--- a/modules/webp/register_types.h
+++ b/modules/webp/register_types.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* 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 */