summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/io/zip_io.cpp137
-rw-r--r--core/io/zip_io.h112
-rw-r--r--core/script_debugger_remote.cpp30
-rw-r--r--editor/editor_fonts.cpp27
-rw-r--r--editor/editor_node.cpp1
-rw-r--r--editor/editor_themes.cpp6
-rw-r--r--editor/import/editor_import_collada.cpp114
-rw-r--r--editor/plugins/shader_editor_plugin.cpp1
-rw-r--r--editor/pvrtc_compress.cpp6
-rw-r--r--modules/etc/image_etc.cpp11
-rw-r--r--modules/gdscript/editor/gdscript_highlighter.cpp4
-rw-r--r--modules/gdscript/gdscript_editor.cpp6
-rw-r--r--modules/stb_vorbis/SCsub8
-rw-r--r--modules/stb_vorbis/audio_stream_ogg_vorbis.cpp5
-rw-r--r--modules/stb_vorbis/audio_stream_ogg_vorbis.h7
-rw-r--r--scene/2d/cpu_particles_2d.cpp4
-rw-r--r--scene/3d/cpu_particles.cpp4
-rw-r--r--scene/gui/link_button.cpp1
-rw-r--r--scene/gui/texture_button.cpp1
-rw-r--r--scene/resources/default_theme/default_theme.cpp42
-rw-r--r--thirdparty/misc/stb_vorbis.h2
21 files changed, 165 insertions, 364 deletions
diff --git a/core/io/zip_io.cpp b/core/io/zip_io.cpp
new file mode 100644
index 0000000000..b7f841b66f
--- /dev/null
+++ b/core/io/zip_io.cpp
@@ -0,0 +1,137 @@
+/*************************************************************************/
+/* zip_io.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* 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 "zip_io.h"
+
+#include "core/os/copymem.h"
+
+void *zipio_open(void *data, const char *p_fname, int mode) {
+
+ FileAccess *&f = *(FileAccess **)data;
+
+ String fname;
+ fname.parse_utf8(p_fname);
+
+ if (mode & ZLIB_FILEFUNC_MODE_WRITE) {
+ f = FileAccess::open(fname, FileAccess::WRITE);
+ } else {
+
+ f = FileAccess::open(fname, FileAccess::READ);
+ }
+
+ if (!f)
+ return NULL;
+
+ return data;
+}
+
+uLong zipio_read(void *data, void *fdata, void *buf, uLong size) {
+
+ FileAccess *f = *(FileAccess **)data;
+ return f->get_buffer((uint8_t *)buf, size);
+}
+
+uLong zipio_write(voidpf opaque, voidpf stream, const void *buf, uLong size) {
+
+ FileAccess *f = *(FileAccess **)opaque;
+ f->store_buffer((uint8_t *)buf, size);
+ return size;
+}
+
+long zipio_tell(voidpf opaque, voidpf stream) {
+
+ FileAccess *f = *(FileAccess **)opaque;
+ return f->get_position();
+}
+
+long zipio_seek(voidpf opaque, voidpf stream, uLong offset, int origin) {
+
+ FileAccess *f = *(FileAccess **)opaque;
+
+ int pos = offset;
+ switch (origin) {
+
+ case ZLIB_FILEFUNC_SEEK_CUR:
+ pos = f->get_position() + offset;
+ break;
+ case ZLIB_FILEFUNC_SEEK_END:
+ pos = f->get_len() + offset;
+ break;
+ default:
+ break;
+ };
+
+ f->seek(pos);
+ return 0;
+}
+
+int zipio_close(voidpf opaque, voidpf stream) {
+
+ FileAccess *&f = *(FileAccess **)opaque;
+ if (f) {
+ f->close();
+ f = NULL;
+ }
+ return 0;
+}
+
+int zipio_testerror(voidpf opaque, voidpf stream) {
+
+ FileAccess *f = *(FileAccess **)opaque;
+ return (f && f->get_error() != OK) ? 1 : 0;
+}
+
+voidpf zipio_alloc(voidpf opaque, uInt items, uInt size) {
+
+ voidpf ptr = memalloc(items * size);
+ zeromem(ptr, items * size);
+ return ptr;
+}
+
+void zipio_free(voidpf opaque, voidpf address) {
+
+ memfree(address);
+}
+
+zlib_filefunc_def zipio_create_io_from_file(FileAccess **p_file) {
+
+ zlib_filefunc_def io;
+ io.opaque = p_file;
+ io.zopen_file = zipio_open;
+ io.zread_file = zipio_read;
+ io.zwrite_file = zipio_write;
+ io.ztell_file = zipio_tell;
+ io.zseek_file = zipio_seek;
+ io.zclose_file = zipio_close;
+ io.zerror_file = zipio_testerror;
+ io.alloc_mem = zipio_alloc;
+ io.free_mem = zipio_free;
+ return io;
+}
diff --git a/core/io/zip_io.h b/core/io/zip_io.h
index c3314a8990..bba7d67332 100644
--- a/core/io/zip_io.h
+++ b/core/io/zip_io.h
@@ -31,114 +31,28 @@
#ifndef ZIP_IO_H
#define ZIP_IO_H
-#include "core/os/copymem.h"
#include "core/os/file_access.h"
+// Not direclty used in this header, but assumed available in downstream users
+// like platform/*/export/export.cpp. Could be fixed, but probably better to have
+// thirdparty includes in as little headers as possible.
#include "thirdparty/minizip/unzip.h"
#include "thirdparty/minizip/zip.h"
-static void *zipio_open(void *data, const char *p_fname, int mode) {
+void *zipio_open(void *data, const char *p_fname, int mode);
+uLong zipio_read(void *data, void *fdata, void *buf, uLong size);
+uLong zipio_write(voidpf opaque, voidpf stream, const void *buf, uLong size);
- FileAccess *&f = *(FileAccess **)data;
+long zipio_tell(voidpf opaque, voidpf stream);
+long zipio_seek(voidpf opaque, voidpf stream, uLong offset, int origin);
- String fname;
- fname.parse_utf8(p_fname);
+int zipio_close(voidpf opaque, voidpf stream);
- if (mode & ZLIB_FILEFUNC_MODE_WRITE) {
- f = FileAccess::open(fname, FileAccess::WRITE);
- } else {
+int zipio_testerror(voidpf opaque, voidpf stream);
- f = FileAccess::open(fname, FileAccess::READ);
- }
+voidpf zipio_alloc(voidpf opaque, uInt items, uInt size);
+void zipio_free(voidpf opaque, voidpf address);
- if (!f)
- return NULL;
-
- return data;
-};
-
-static uLong zipio_read(void *data, void *fdata, void *buf, uLong size) {
-
- FileAccess *f = *(FileAccess **)data;
- return f->get_buffer((uint8_t *)buf, size);
-};
-
-static uLong zipio_write(voidpf opaque, voidpf stream, const void *buf, uLong size) {
-
- FileAccess *f = *(FileAccess **)opaque;
- f->store_buffer((uint8_t *)buf, size);
- return size;
-};
-
-static long zipio_tell(voidpf opaque, voidpf stream) {
-
- FileAccess *f = *(FileAccess **)opaque;
- return f->get_position();
-};
-
-static long zipio_seek(voidpf opaque, voidpf stream, uLong offset, int origin) {
-
- FileAccess *f = *(FileAccess **)opaque;
-
- int pos = offset;
- switch (origin) {
-
- case ZLIB_FILEFUNC_SEEK_CUR:
- pos = f->get_position() + offset;
- break;
- case ZLIB_FILEFUNC_SEEK_END:
- pos = f->get_len() + offset;
- break;
- default:
- break;
- };
-
- f->seek(pos);
- return 0;
-};
-
-static int zipio_close(voidpf opaque, voidpf stream) {
-
- FileAccess *&f = *(FileAccess **)opaque;
- if (f) {
- f->close();
- f = NULL;
- }
- return 0;
-};
-
-static int zipio_testerror(voidpf opaque, voidpf stream) {
-
- FileAccess *f = *(FileAccess **)opaque;
- return (f && f->get_error() != OK) ? 1 : 0;
-};
-
-static voidpf zipio_alloc(voidpf opaque, uInt items, uInt size) {
-
- voidpf ptr = memalloc(items * size);
- zeromem(ptr, items * size);
- return ptr;
-}
-
-static void zipio_free(voidpf opaque, voidpf address) {
-
- memfree(address);
-}
-
-static zlib_filefunc_def zipio_create_io_from_file(FileAccess **p_file) {
-
- zlib_filefunc_def io;
- io.opaque = p_file;
- io.zopen_file = zipio_open;
- io.zread_file = zipio_read;
- io.zwrite_file = zipio_write;
- io.ztell_file = zipio_tell;
- io.zseek_file = zipio_seek;
- io.zclose_file = zipio_close;
- io.zerror_file = zipio_testerror;
- io.alloc_mem = zipio_alloc;
- io.free_mem = zipio_free;
- return io;
-}
+zlib_filefunc_def zipio_create_io_from_file(FileAccess **p_file);
#endif // ZIP_IO_H
diff --git a/core/script_debugger_remote.cpp b/core/script_debugger_remote.cpp
index 00a86d11bd..388e3b77a3 100644
--- a/core/script_debugger_remote.cpp
+++ b/core/script_debugger_remote.cpp
@@ -98,36 +98,6 @@ Error ScriptDebuggerRemote::connect_to_host(const String &p_host, uint16_t p_por
return OK;
}
-static int _ScriptDebuggerRemote_found_id = 0;
-static Object *_ScriptDebuggerRemote_find = NULL;
-static void _ScriptDebuggerRemote_debug_func(Object *p_obj) {
-
- if (_ScriptDebuggerRemote_find == p_obj) {
- _ScriptDebuggerRemote_found_id = p_obj->get_instance_id();
- }
-}
-
-static ObjectID safe_get_instance_id(const Variant &p_v) {
-
- Object *o = p_v;
- if (o == NULL)
- return 0;
- else {
-
- REF r = p_v;
- if (r.is_valid()) {
-
- return r->get_instance_id();
- } else {
-
- _ScriptDebuggerRemote_found_id = 0;
- _ScriptDebuggerRemote_find = NULL;
- ObjectDB::debug_objects(_ScriptDebuggerRemote_debug_func);
- return _ScriptDebuggerRemote_found_id;
- }
- }
-}
-
void ScriptDebuggerRemote::_put_variable(const String &p_name, const Variant &p_variable) {
packet_peer_stream->put_var(p_name);
diff --git a/editor/editor_fonts.cpp b/editor/editor_fonts.cpp
index ea99c882e4..8b1818b595 100644
--- a/editor/editor_fonts.cpp
+++ b/editor/editor_fonts.cpp
@@ -37,33 +37,6 @@
#include "scene/resources/default_theme/default_theme.h"
#include "scene/resources/dynamic_font.h"
-static Ref<BitmapFont> make_font(int p_height, int p_ascent, int p_valign, int p_charcount, const int *p_chars, const Ref<Texture> &p_texture) {
-
- Ref<BitmapFont> font(memnew(BitmapFont));
- font->add_texture(p_texture);
-
- for (int i = 0; i < p_charcount; i++) {
-
- const int *c = &p_chars[i * 8];
-
- int chr = c[0];
- Rect2 frect;
- frect.position.x = c[1];
- frect.position.y = c[2];
- frect.size.x = c[3];
- frect.size.y = c[4];
- Point2 align(c[5], c[6] + p_valign);
- int advance = c[7];
-
- font->add_char(chr, 0, frect, align, advance);
- }
-
- font->set_height(p_height);
- font->set_ascent(p_ascent);
-
- return font;
-}
-
#define MAKE_FALLBACKS(m_name) \
m_name->add_fallback(FontArabic); \
m_name->add_fallback(FontHebrew); \
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp
index 330173a8c3..c9871bf27d 100644
--- a/editor/editor_node.cpp
+++ b/editor/editor_node.cpp
@@ -36,7 +36,6 @@
#include "core/io/resource_loader.h"
#include "core/io/resource_saver.h"
#include "core/io/stream_peer_ssl.h"
-#include "core/io/zip_io.h"
#include "core/message_queue.h"
#include "core/os/file_access.h"
#include "core/os/input.h"
diff --git a/editor/editor_themes.cpp b/editor/editor_themes.cpp
index 8575d7be96..39d2f685b6 100644
--- a/editor/editor_themes.cpp
+++ b/editor/editor_themes.cpp
@@ -81,12 +81,6 @@ static Ref<StyleBoxLine> make_line_stylebox(Color p_color, int p_thickness = 1,
return style;
}
-static Ref<StyleBoxFlat> change_border_color(Ref<StyleBoxFlat> p_style, Color p_color) {
- Ref<StyleBoxFlat> style = p_style->duplicate();
- style->set_border_color_all(p_color);
- return style;
-}
-
Ref<ImageTexture> editor_generate_icon(int p_index, bool p_convert_color, float p_scale = EDSCALE, bool p_force_filter = false) {
Ref<ImageTexture> icon = memnew(ImageTexture);
diff --git a/editor/import/editor_import_collada.cpp b/editor/import/editor_import_collada.cpp
index 31c1886d32..60ca66e464 100644
--- a/editor/import/editor_import_collada.cpp
+++ b/editor/import/editor_import_collada.cpp
@@ -490,120 +490,6 @@ Error ColladaImport::_create_material(const String &p_target) {
return OK;
}
-static void _generate_normals(const PoolVector<int> &p_indices, const PoolVector<Vector3> &p_vertices, PoolVector<Vector3> &r_normals) {
-
- r_normals.resize(p_vertices.size());
- PoolVector<Vector3>::Write narrayw = r_normals.write();
-
- int iacount = p_indices.size() / 3;
- PoolVector<int>::Read index_arrayr = p_indices.read();
- PoolVector<Vector3>::Read vertex_arrayr = p_vertices.read();
-
- for (int idx = 0; idx < iacount; idx++) {
-
- Vector3 v[3] = {
- vertex_arrayr[index_arrayr[idx * 3 + 0]],
- vertex_arrayr[index_arrayr[idx * 3 + 1]],
- vertex_arrayr[index_arrayr[idx * 3 + 2]]
- };
-
- Vector3 normal = Plane(v[0], v[1], v[2]).normal;
-
- narrayw[index_arrayr[idx * 3 + 0]] += normal;
- narrayw[index_arrayr[idx * 3 + 1]] += normal;
- narrayw[index_arrayr[idx * 3 + 2]] += normal;
- }
-
- int vlen = p_vertices.size();
-
- for (int idx = 0; idx < vlen; idx++) {
- narrayw[idx].normalize();
- }
-}
-
-static void _generate_tangents_and_binormals(const PoolVector<int> &p_indices, const PoolVector<Vector3> &p_vertices, const PoolVector<Vector3> &p_uvs, const PoolVector<Vector3> &p_normals, PoolVector<real_t> &r_tangents) {
-
- int vlen = p_vertices.size();
-
- Vector<Vector3> tangents;
- tangents.resize(vlen);
- Vector<Vector3> binormals;
- binormals.resize(vlen);
-
- int iacount = p_indices.size() / 3;
-
- PoolVector<int>::Read index_arrayr = p_indices.read();
- PoolVector<Vector3>::Read vertex_arrayr = p_vertices.read();
- PoolVector<Vector3>::Read narrayr = p_normals.read();
- PoolVector<Vector3>::Read uvarrayr = p_uvs.read();
-
- for (int idx = 0; idx < iacount; idx++) {
-
- Vector3 v1 = vertex_arrayr[index_arrayr[idx * 3 + 0]];
- Vector3 v2 = vertex_arrayr[index_arrayr[idx * 3 + 1]];
- Vector3 v3 = vertex_arrayr[index_arrayr[idx * 3 + 2]];
-
- Vector3 w1 = uvarrayr[index_arrayr[idx * 3 + 0]];
- Vector3 w2 = uvarrayr[index_arrayr[idx * 3 + 1]];
- Vector3 w3 = uvarrayr[index_arrayr[idx * 3 + 2]];
-
- real_t x1 = v2.x - v1.x;
- real_t x2 = v3.x - v1.x;
- real_t y1 = v2.y - v1.y;
- real_t y2 = v3.y - v1.y;
- real_t z1 = v2.z - v1.z;
- real_t z2 = v3.z - v1.z;
-
- real_t s1 = w2.x - w1.x;
- real_t s2 = w3.x - w1.x;
- real_t t1 = w2.y - w1.y;
- real_t t2 = w3.y - w1.y;
-
- real_t r = (s1 * t2 - s2 * t1);
-
- Vector3 tangent;
- Vector3 binormal;
-
- if (r == 0) {
-
- binormal = Vector3();
- tangent = Vector3();
- } else {
- tangent = Vector3((t2 * x1 - t1 * x2) * r, (t2 * y1 - t1 * y2) * r,
- (t2 * z1 - t1 * z2) * r)
- .normalized();
- binormal = Vector3((s1 * x2 - s2 * x1) * r, (s1 * y2 - s2 * y1) * r,
- (s1 * z2 - s2 * z1) * r)
- .normalized();
- }
-
- tangents.write[index_arrayr[idx * 3 + 0]] += tangent;
- binormals.write[index_arrayr[idx * 3 + 0]] += binormal;
- tangents.write[index_arrayr[idx * 3 + 1]] += tangent;
- binormals.write[index_arrayr[idx * 3 + 1]] += binormal;
- tangents.write[index_arrayr[idx * 3 + 2]] += tangent;
- binormals.write[index_arrayr[idx * 3 + 2]] += binormal;
- }
-
- r_tangents.resize(vlen * 4);
- PoolVector<real_t>::Write tarrayw = r_tangents.write();
-
- for (int idx = 0; idx < vlen; idx++) {
- Vector3 tangent = tangents[idx];
- Vector3 bingen = narrayr[idx].cross(tangent);
- float dir;
- if (bingen.dot(binormals[idx]) < 0)
- dir = -1.0;
- else
- dir = +1.0;
-
- tarrayw[idx * 4 + 0] = tangent.x;
- tarrayw[idx * 4 + 1] = tangent.y;
- tarrayw[idx * 4 + 2] = tangent.z;
- tarrayw[idx * 4 + 3] = dir;
- }
-}
-
Error ColladaImport::_create_mesh_surfaces(bool p_optimize, Ref<ArrayMesh> &p_mesh, const Map<String, Collada::NodeGeometry::Material> &p_material_map, const Collada::MeshData &meshdata, const Transform &p_local_xform, const Vector<int> &bone_remap, const Collada::SkinControllerData *p_skin_controller, const Collada::MorphControllerData *p_morph_data, Vector<Ref<ArrayMesh> > p_morph_meshes, bool p_use_compression, bool p_use_mesh_material) {
bool local_xform_mirror = p_local_xform.basis.determinant() < 0;
diff --git a/editor/plugins/shader_editor_plugin.cpp b/editor/plugins/shader_editor_plugin.cpp
index 775fca308e..17f93b55a1 100644
--- a/editor/plugins/shader_editor_plugin.cpp
+++ b/editor/plugins/shader_editor_plugin.cpp
@@ -448,7 +448,6 @@ void ShaderEditor::_text_edit_gui_input(const Ref<InputEvent> &ev) {
int col, row;
TextEdit *tx = shader_editor->get_text_edit();
tx->_get_mouse_pos(mb->get_global_position() - tx->get_global_position(), row, col);
- Vector2 mpos = mb->get_global_position() - tx->get_global_position();
tx->set_right_click_moves_caret(EditorSettings::get_singleton()->get("text_editor/cursor/right_click_moves_caret"));
if (tx->is_right_click_moving_caret()) {
diff --git a/editor/pvrtc_compress.cpp b/editor/pvrtc_compress.cpp
index b1c847570c..30e78aa32b 100644
--- a/editor/pvrtc_compress.cpp
+++ b/editor/pvrtc_compress.cpp
@@ -115,11 +115,6 @@ static void _compress_pvrtc4(Image *p_image) {
_compress_image(Image::COMPRESS_PVRTC4, p_image);
}
-static void _compress_etc(Image *p_image) {
-
- _compress_image(Image::COMPRESS_ETC, p_image);
-}
-
void _pvrtc_register_compressors() {
_base_image_compress_pvrtc2_func = Image::_image_compress_pvrtc2_func;
@@ -127,5 +122,4 @@ void _pvrtc_register_compressors() {
Image::_image_compress_pvrtc2_func = _compress_pvrtc2;
Image::_image_compress_pvrtc4_func = _compress_pvrtc4;
- //Image::_image_compress_etc_func=_compress_etc; //use the built in one for ETC
}
diff --git a/modules/etc/image_etc.cpp b/modules/etc/image_etc.cpp
index 57f5b68c61..fbbc765bf2 100644
--- a/modules/etc/image_etc.cpp
+++ b/modules/etc/image_etc.cpp
@@ -88,14 +88,6 @@ static Etc::Image::Format _image_format_to_etc2comp_format(Image::Format format)
}
}
-static void _decompress_etc1(Image *p_img) {
- // not implemented, to be removed
-}
-
-static void _decompress_etc2(Image *p_img) {
- // not implemented, to be removed
-}
-
static void _compress_etc(Image *p_img, float p_lossy_quality, bool force_etc1_format, Image::CompressSource p_source) {
Image::Format img_format = p_img->get_format();
Image::DetectChannels detected_channels = p_img->get_detected_channels();
@@ -245,8 +237,5 @@ static void _compress_etc2(Image *p_img, float p_lossy_quality, Image::CompressS
void _register_etc_compress_func() {
Image::_image_compress_etc1_func = _compress_etc1;
- //Image::_image_decompress_etc1 = _decompress_etc1;
-
Image::_image_compress_etc2_func = _compress_etc2;
- //Image::_image_decompress_etc2 = _decompress_etc2;
}
diff --git a/modules/gdscript/editor/gdscript_highlighter.cpp b/modules/gdscript/editor/gdscript_highlighter.cpp
index a1163b5d8d..c199667270 100644
--- a/modules/gdscript/editor/gdscript_highlighter.cpp
+++ b/modules/gdscript/editor/gdscript_highlighter.cpp
@@ -43,10 +43,6 @@ static bool _is_text_char(CharType c) {
return (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || (c >= '0' && c <= '9') || c == '_';
}
-static bool _is_whitespace(CharType c) {
- return c == '\t' || c == ' ';
-}
-
static bool _is_char(CharType c) {
return (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || c == '_';
diff --git a/modules/gdscript/gdscript_editor.cpp b/modules/gdscript/gdscript_editor.cpp
index 55bc3d2359..ddd9e6b01c 100644
--- a/modules/gdscript/gdscript_editor.cpp
+++ b/modules/gdscript/gdscript_editor.cpp
@@ -51,12 +51,6 @@ void GDScriptLanguage::get_string_delimiters(List<String> *p_delimiters) const {
p_delimiters->push_back("\"\"\" \"\"\"");
}
Ref<Script> GDScriptLanguage::get_template(const String &p_class_name, const String &p_base_class_name) const {
-#ifdef TOOLS_ENABLED
- bool th = EDITOR_DEF("text_editor/completion/add_type_hints", false);
-#else
- bool th = false;
-#endif
-
String _template = "extends %BASE%\n"
"\n"
"# Declare member variables here. Examples:\n"
diff --git a/modules/stb_vorbis/SCsub b/modules/stb_vorbis/SCsub
index 897d05961c..d14939a3b1 100644
--- a/modules/stb_vorbis/SCsub
+++ b/modules/stb_vorbis/SCsub
@@ -3,8 +3,14 @@
Import('env')
Import('env_modules')
+env_stb_vorbis = env_modules.Clone()
+
# Thirdparty source files
+thirdparty_sources = ["#thirdparty/misc/stb_vorbis.c"]
-env_stb_vorbis = env_modules.Clone()
+env_thirdparty = env_stb_vorbis.Clone()
+env_thirdparty.disable_warnings()
+env_thirdparty.add_source_files(env.modules_sources, thirdparty_sources)
+# Godot's own source files
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
index 57b6b5343e..5dbe0b4b00 100644
--- a/modules/stb_vorbis/audio_stream_ogg_vorbis.cpp
+++ b/modules/stb_vorbis/audio_stream_ogg_vorbis.cpp
@@ -32,11 +32,6 @@
#include "core/os/file_access.h"
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
-#include "thirdparty/misc/stb_vorbis.c"
-#pragma GCC diagnostic pop
-
void AudioStreamPlaybackOGGVorbis::_mix_internal(AudioFrame *p_buffer, int p_frames) {
ERR_FAIL_COND(!active);
diff --git a/modules/stb_vorbis/audio_stream_ogg_vorbis.h b/modules/stb_vorbis/audio_stream_ogg_vorbis.h
index 71a957a6af..8b42111847 100644
--- a/modules/stb_vorbis/audio_stream_ogg_vorbis.h
+++ b/modules/stb_vorbis/audio_stream_ogg_vorbis.h
@@ -34,12 +34,7 @@
#include "core/io/resource_loader.h"
#include "servers/audio/audio_stream.h"
-#define STB_VORBIS_HEADER_ONLY
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
-#include "thirdparty/misc/stb_vorbis.c"
-#pragma GCC diagnostic pop
-#undef STB_VORBIS_HEADER_ONLY
+#include "thirdparty/misc/stb_vorbis.h"
class AudioStreamOGGVorbis;
diff --git a/scene/2d/cpu_particles_2d.cpp b/scene/2d/cpu_particles_2d.cpp
index a8e0f0d07f..d29c6b37d5 100644
--- a/scene/2d/cpu_particles_2d.cpp
+++ b/scene/2d/cpu_particles_2d.cpp
@@ -507,10 +507,6 @@ static float rand_from_seed(uint32_t &seed) {
return float(seed % uint32_t(65536)) / 65535.0;
}
-static float rand_from_seed_m1_p1(uint32_t &seed) {
- return rand_from_seed(seed) * 2.0 - 1.0;
-}
-
void CPUParticles2D::_particles_process(float p_delta) {
p_delta *= speed_scale;
diff --git a/scene/3d/cpu_particles.cpp b/scene/3d/cpu_particles.cpp
index 712f0ba78b..ec51c31674 100644
--- a/scene/3d/cpu_particles.cpp
+++ b/scene/3d/cpu_particles.cpp
@@ -471,10 +471,6 @@ static float rand_from_seed(uint32_t &seed) {
return float(seed % uint32_t(65536)) / 65535.0;
}
-static float rand_from_seed_m1_p1(uint32_t &seed) {
- return rand_from_seed(seed) * 2.0 - 1.0;
-}
-
void CPUParticles::_particles_process(float p_delta) {
p_delta *= speed_scale;
diff --git a/scene/gui/link_button.cpp b/scene/gui/link_button.cpp
index 8560efdde5..d38a067fef 100644
--- a/scene/gui/link_button.cpp
+++ b/scene/gui/link_button.cpp
@@ -91,6 +91,7 @@ void LinkButton::_notification(int p_what) {
do_underline = underline_mode != UNDERLINE_MODE_NEVER;
} break;
+ case DRAW_HOVER_PRESSED: break; // Not used in this class
case DRAW_DISABLED: {
color = get_color("font_color_disabled");
diff --git a/scene/gui/texture_button.cpp b/scene/gui/texture_button.cpp
index a6a57b010f..413f9dbbe6 100644
--- a/scene/gui/texture_button.cpp
+++ b/scene/gui/texture_button.cpp
@@ -150,6 +150,7 @@ void TextureButton::_notification(int p_what) {
} else
texdraw = hover;
} break;
+ case DRAW_HOVER_PRESSED: break; // Not used in this class
case DRAW_DISABLED: {
if (disabled.is_null()) {
diff --git a/scene/resources/default_theme/default_theme.cpp b/scene/resources/default_theme/default_theme.cpp
index 0dc2ef105b..4de47b2cb0 100644
--- a/scene/resources/default_theme/default_theme.cpp
+++ b/scene/resources/default_theme/default_theme.cpp
@@ -120,41 +120,7 @@ static Ref<Texture> make_icon(T p_src) {
return texture;
}
-static Ref<Shader> make_shader(const char *vertex_code, const char *fragment_code, const char *lighting_code) {
- Ref<Shader> shader = (memnew(Shader()));
- //shader->set_code(vertex_code, fragment_code, lighting_code);
-
- return shader;
-}
-
-static Ref<BitmapFont> make_font(int p_height, int p_ascent, int p_valign, int p_charcount, const int *p_chars, const Ref<Texture> &p_texture) {
-
- Ref<BitmapFont> font(memnew(BitmapFont));
- font->add_texture(p_texture);
-
- for (int i = 0; i < p_charcount; i++) {
-
- const int *c = &p_chars[i * 8];
-
- int chr = c[0];
- Rect2 frect;
- frect.position.x = c[1];
- frect.position.y = c[2];
- frect.size.x = c[3];
- frect.size.y = c[4];
- Point2 align(c[5], c[6] + p_valign);
- int advance = c[7];
-
- font->add_char(chr, 0, frect, align, advance);
- }
-
- font->set_height(p_height);
- font->set_ascent(p_ascent);
-
- return font;
-}
-
-static Ref<BitmapFont> make_font2(int p_height, int p_ascent, int p_charcount, const int *p_char_rects, int p_kerning_count, const int *p_kernings, int p_w, int p_h, const unsigned char *p_img) {
+static Ref<BitmapFont> make_font(int p_height, int p_ascent, int p_charcount, const int *p_char_rects, int p_kerning_count, const int *p_kernings, int p_w, int p_h, const unsigned char *p_img) {
Ref<BitmapFont> font(memnew(BitmapFont));
@@ -209,8 +175,6 @@ void fill_default_theme(Ref<Theme> &theme, const Ref<Font> &default_font, const
tex_cache = memnew(TexCacheMap);
- //Ref<BitmapFont> default_font = make_font(_bi_font_normal_height,_bi_font_normal_ascent,_bi_font_normal_valign,_bi_font_normal_charcount,_bi_font_normal_characters,make_icon(font_normal_png));
-
// Font Colors
Color control_font_color = Color::html("e0e0e0");
@@ -913,9 +877,9 @@ void make_default_theme(bool p_hidpi, Ref<Font> p_font) {
if (p_font.is_valid()) {
default_font = p_font;
} else if (p_hidpi) {
- default_font = make_font2(_hidpi_font_height, _hidpi_font_ascent, _hidpi_font_charcount, &_hidpi_font_charrects[0][0], _hidpi_font_kerning_pair_count, &_hidpi_font_kerning_pairs[0][0], _hidpi_font_img_width, _hidpi_font_img_height, _hidpi_font_img_data);
+ default_font = make_font(_hidpi_font_height, _hidpi_font_ascent, _hidpi_font_charcount, &_hidpi_font_charrects[0][0], _hidpi_font_kerning_pair_count, &_hidpi_font_kerning_pairs[0][0], _hidpi_font_img_width, _hidpi_font_img_height, _hidpi_font_img_data);
} else {
- default_font = make_font2(_lodpi_font_height, _lodpi_font_ascent, _lodpi_font_charcount, &_lodpi_font_charrects[0][0], _lodpi_font_kerning_pair_count, &_lodpi_font_kerning_pairs[0][0], _lodpi_font_img_width, _lodpi_font_img_height, _lodpi_font_img_data);
+ default_font = make_font(_lodpi_font_height, _lodpi_font_ascent, _lodpi_font_charcount, &_lodpi_font_charrects[0][0], _lodpi_font_kerning_pair_count, &_lodpi_font_kerning_pairs[0][0], _lodpi_font_img_width, _lodpi_font_img_height, _lodpi_font_img_data);
}
Ref<Font> large_font = default_font;
fill_default_theme(t, default_font, large_font, default_icon, default_style, p_hidpi ? 2.0 : 1.0);
diff --git a/thirdparty/misc/stb_vorbis.h b/thirdparty/misc/stb_vorbis.h
new file mode 100644
index 0000000000..357efcd5fc
--- /dev/null
+++ b/thirdparty/misc/stb_vorbis.h
@@ -0,0 +1,2 @@
+#define STB_VORBIS_HEADER_ONLY
+#include "stb_vorbis.c"