diff --git a/core/io/resource_format_binary.cpp b/core/io/resource_format_binary.cpp index 084d8ffcab4..661eba21065 100644 --- a/core/io/resource_format_binary.cpp +++ b/core/io/resource_format_binary.cpp @@ -1814,11 +1814,11 @@ Error ResourceFormatSaverBinaryInstance::save(const String &p_path, const RES &p if (skip_editor && F->get().name.begins_with("__editor")) continue; - if (F->get().usage & PROPERTY_USAGE_STORAGE) { + if ((F->get().usage & PROPERTY_USAGE_STORAGE)) { Property p; p.name_idx = get_string_index(F->get().name); p.value = E->get()->get(F->get().name); - if ((F->get().usage & PROPERTY_USAGE_STORE_IF_NONZERO && p.value.is_zero()) || (F->get().usage & PROPERTY_USAGE_STORE_IF_NONONE && p.value.is_one())) + if (((F->get().usage & PROPERTY_USAGE_STORE_IF_NONZERO) && p.value.is_zero()) || ((F->get().usage & PROPERTY_USAGE_STORE_IF_NONONE) && p.value.is_one())) continue; p.pi = F->get(); diff --git a/core/io/stream_peer.cpp b/core/io/stream_peer.cpp index 10061580031..f4f81f08074 100644 --- a/core/io/stream_peer.cpp +++ b/core/io/stream_peer.cpp @@ -446,6 +446,7 @@ Error StreamPeerBuffer::get_data(uint8_t *p_buffer, int p_bytes) { return OK; } + Error StreamPeerBuffer::get_partial_data(uint8_t *p_buffer, int p_bytes, int &r_received) { if (pointer + p_bytes > data.size()) { @@ -463,6 +464,8 @@ Error StreamPeerBuffer::get_partial_data(uint8_t *p_buffer, int p_bytes, int &r_ pointer += r_received; // FIXME: return what? OK or ERR_* + // return OK for now so we don't maybe return garbage + return OK; } int StreamPeerBuffer::get_available_bytes() const { diff --git a/core/ordered_hash_map.h b/core/ordered_hash_map.h index 3e619d2b2ea..9e95f963e13 100644 --- a/core/ordered_hash_map.h +++ b/core/ordered_hash_map.h @@ -55,8 +55,8 @@ public: friend class OrderedHashMap; typename InternalList::Element *list_element; - typename InternalList::Element *next_element; typename InternalList::Element *prev_element; + typename InternalList::Element *next_element; Element(typename InternalList::Element *p_element) { list_element = p_element; @@ -69,7 +69,7 @@ public: public: _FORCE_INLINE_ Element() - : list_element(NULL), next_element(NULL), prev_element(NULL) { + : list_element(NULL), prev_element(NULL), next_element(NULL) { } Element next() const { @@ -312,4 +312,4 @@ bool operator!=(const typename OrderedHashMap RasterizerStorageGLES3::_get_gl_image_and_format(const Ref &p_ } break; case Image::FORMAT_RGB8: { - r_gl_internal_format = (config.srgb_decode_supported || p_flags & VS::TEXTURE_FLAG_CONVERT_TO_LINEAR) ? GL_SRGB8 : GL_RGB8; + r_gl_internal_format = (config.srgb_decode_supported || (p_flags & VS::TEXTURE_FLAG_CONVERT_TO_LINEAR)) ? GL_SRGB8 : GL_RGB8; r_gl_format = GL_RGB; r_gl_type = GL_UNSIGNED_BYTE; srgb = true; @@ -174,7 +174,7 @@ Ref RasterizerStorageGLES3::_get_gl_image_and_format(const Ref &p_ case Image::FORMAT_RGBA8: { r_gl_format = GL_RGBA; - r_gl_internal_format = (config.srgb_decode_supported || p_flags & VS::TEXTURE_FLAG_CONVERT_TO_LINEAR) ? GL_SRGB8_ALPHA8 : GL_RGBA8; + r_gl_internal_format = (config.srgb_decode_supported || (p_flags & VS::TEXTURE_FLAG_CONVERT_TO_LINEAR)) ? GL_SRGB8_ALPHA8 : GL_RGBA8; r_gl_type = GL_UNSIGNED_BYTE; srgb = true; @@ -254,7 +254,7 @@ Ref RasterizerStorageGLES3::_get_gl_image_and_format(const Ref &p_ if (config.s3tc_supported) { - r_gl_internal_format = (config.srgb_decode_supported || p_flags & VS::TEXTURE_FLAG_CONVERT_TO_LINEAR) ? _EXT_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_NV : _EXT_COMPRESSED_RGBA_S3TC_DXT1_EXT; + r_gl_internal_format = (config.srgb_decode_supported || (p_flags & VS::TEXTURE_FLAG_CONVERT_TO_LINEAR)) ? _EXT_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_NV : _EXT_COMPRESSED_RGBA_S3TC_DXT1_EXT; r_gl_format = GL_RGBA; r_gl_type = GL_UNSIGNED_BYTE; r_compressed = true; @@ -270,7 +270,7 @@ Ref RasterizerStorageGLES3::_get_gl_image_and_format(const Ref &p_ if (config.s3tc_supported) { - r_gl_internal_format = (config.srgb_decode_supported || p_flags & VS::TEXTURE_FLAG_CONVERT_TO_LINEAR) ? _EXT_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_NV : _EXT_COMPRESSED_RGBA_S3TC_DXT3_EXT; + r_gl_internal_format = (config.srgb_decode_supported || (p_flags & VS::TEXTURE_FLAG_CONVERT_TO_LINEAR)) ? _EXT_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_NV : _EXT_COMPRESSED_RGBA_S3TC_DXT3_EXT; r_gl_format = GL_RGBA; r_gl_type = GL_UNSIGNED_BYTE; r_compressed = true; @@ -286,7 +286,7 @@ Ref RasterizerStorageGLES3::_get_gl_image_and_format(const Ref &p_ if (config.s3tc_supported) { - r_gl_internal_format = (config.srgb_decode_supported || p_flags & VS::TEXTURE_FLAG_CONVERT_TO_LINEAR) ? _EXT_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_NV : _EXT_COMPRESSED_RGBA_S3TC_DXT5_EXT; + r_gl_internal_format = (config.srgb_decode_supported || (p_flags & VS::TEXTURE_FLAG_CONVERT_TO_LINEAR)) ? _EXT_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_NV : _EXT_COMPRESSED_RGBA_S3TC_DXT5_EXT; r_gl_format = GL_RGBA; r_gl_type = GL_UNSIGNED_BYTE; r_compressed = true; @@ -331,7 +331,7 @@ Ref RasterizerStorageGLES3::_get_gl_image_and_format(const Ref &p_ if (config.bptc_supported) { - r_gl_internal_format = (config.srgb_decode_supported || p_flags & VS::TEXTURE_FLAG_CONVERT_TO_LINEAR) ? _EXT_COMPRESSED_SRGB_ALPHA_BPTC_UNORM : _EXT_COMPRESSED_RGBA_BPTC_UNORM; + r_gl_internal_format = (config.srgb_decode_supported || (p_flags & VS::TEXTURE_FLAG_CONVERT_TO_LINEAR)) ? _EXT_COMPRESSED_SRGB_ALPHA_BPTC_UNORM : _EXT_COMPRESSED_RGBA_BPTC_UNORM; r_gl_format = GL_RGBA; r_gl_type = GL_UNSIGNED_BYTE; r_compressed = true; @@ -371,7 +371,7 @@ Ref RasterizerStorageGLES3::_get_gl_image_and_format(const Ref &p_ if (config.pvrtc_supported) { - r_gl_internal_format = (config.srgb_decode_supported || p_flags & VS::TEXTURE_FLAG_CONVERT_TO_LINEAR) ? _EXT_COMPRESSED_SRGB_PVRTC_2BPPV1_EXT : _EXT_COMPRESSED_RGB_PVRTC_2BPPV1_IMG; + r_gl_internal_format = (config.srgb_decode_supported || (p_flags & VS::TEXTURE_FLAG_CONVERT_TO_LINEAR)) ? _EXT_COMPRESSED_SRGB_PVRTC_2BPPV1_EXT : _EXT_COMPRESSED_RGB_PVRTC_2BPPV1_IMG; r_gl_format = GL_RGBA; r_gl_type = GL_UNSIGNED_BYTE; r_compressed = true; @@ -386,7 +386,7 @@ Ref RasterizerStorageGLES3::_get_gl_image_and_format(const Ref &p_ if (config.pvrtc_supported) { - r_gl_internal_format = (config.srgb_decode_supported || p_flags & VS::TEXTURE_FLAG_CONVERT_TO_LINEAR) ? _EXT_COMPRESSED_SRGB_ALPHA_PVRTC_2BPPV1_EXT : _EXT_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG; + r_gl_internal_format = (config.srgb_decode_supported || (p_flags & VS::TEXTURE_FLAG_CONVERT_TO_LINEAR)) ? _EXT_COMPRESSED_SRGB_ALPHA_PVRTC_2BPPV1_EXT : _EXT_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG; r_gl_format = GL_RGBA; r_gl_type = GL_UNSIGNED_BYTE; r_compressed = true; @@ -402,7 +402,7 @@ Ref RasterizerStorageGLES3::_get_gl_image_and_format(const Ref &p_ if (config.pvrtc_supported) { - r_gl_internal_format = (config.srgb_decode_supported || p_flags & VS::TEXTURE_FLAG_CONVERT_TO_LINEAR) ? _EXT_COMPRESSED_SRGB_PVRTC_4BPPV1_EXT : _EXT_COMPRESSED_RGB_PVRTC_4BPPV1_IMG; + r_gl_internal_format = (config.srgb_decode_supported || (p_flags & VS::TEXTURE_FLAG_CONVERT_TO_LINEAR)) ? _EXT_COMPRESSED_SRGB_PVRTC_4BPPV1_EXT : _EXT_COMPRESSED_RGB_PVRTC_4BPPV1_IMG; r_gl_format = GL_RGBA; r_gl_type = GL_UNSIGNED_BYTE; r_compressed = true; @@ -418,7 +418,7 @@ Ref RasterizerStorageGLES3::_get_gl_image_and_format(const Ref &p_ if (config.pvrtc_supported) { - r_gl_internal_format = (config.srgb_decode_supported || p_flags & VS::TEXTURE_FLAG_CONVERT_TO_LINEAR) ? _EXT_COMPRESSED_SRGB_ALPHA_PVRTC_4BPPV1_EXT : _EXT_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG; + r_gl_internal_format = (config.srgb_decode_supported || (p_flags & VS::TEXTURE_FLAG_CONVERT_TO_LINEAR)) ? _EXT_COMPRESSED_SRGB_ALPHA_PVRTC_4BPPV1_EXT : _EXT_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG; r_gl_format = GL_RGBA; r_gl_type = GL_UNSIGNED_BYTE; r_compressed = true; @@ -503,7 +503,7 @@ Ref RasterizerStorageGLES3::_get_gl_image_and_format(const Ref &p_ if (config.etc2_supported) { - r_gl_internal_format = (config.srgb_decode_supported || p_flags & VS::TEXTURE_FLAG_CONVERT_TO_LINEAR) ? _EXT_COMPRESSED_SRGB8_ETC2 : _EXT_COMPRESSED_RGB8_ETC2; + r_gl_internal_format = (config.srgb_decode_supported || (p_flags & VS::TEXTURE_FLAG_CONVERT_TO_LINEAR)) ? _EXT_COMPRESSED_SRGB8_ETC2 : _EXT_COMPRESSED_RGB8_ETC2; r_gl_format = GL_RGB; r_gl_type = GL_UNSIGNED_BYTE; r_compressed = true; @@ -518,7 +518,7 @@ Ref RasterizerStorageGLES3::_get_gl_image_and_format(const Ref &p_ if (config.etc2_supported) { - r_gl_internal_format = (config.srgb_decode_supported || p_flags & VS::TEXTURE_FLAG_CONVERT_TO_LINEAR) ? _EXT_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC : _EXT_COMPRESSED_RGBA8_ETC2_EAC; + r_gl_internal_format = (config.srgb_decode_supported || (p_flags & VS::TEXTURE_FLAG_CONVERT_TO_LINEAR)) ? _EXT_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC : _EXT_COMPRESSED_RGBA8_ETC2_EAC; r_gl_format = GL_RGBA; r_gl_type = GL_UNSIGNED_BYTE; r_compressed = true; @@ -533,7 +533,7 @@ Ref RasterizerStorageGLES3::_get_gl_image_and_format(const Ref &p_ if (config.etc2_supported) { - r_gl_internal_format = (config.srgb_decode_supported || p_flags & VS::TEXTURE_FLAG_CONVERT_TO_LINEAR) ? _EXT_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2 : _EXT_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2; + r_gl_internal_format = (config.srgb_decode_supported || (p_flags & VS::TEXTURE_FLAG_CONVERT_TO_LINEAR)) ? _EXT_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2 : _EXT_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2; r_gl_format = GL_RGBA; r_gl_type = GL_UNSIGNED_BYTE; r_compressed = true; @@ -560,7 +560,7 @@ Ref RasterizerStorageGLES3::_get_gl_image_and_format(const Ref &p_ } r_gl_format = GL_RGBA; - r_gl_internal_format = (config.srgb_decode_supported || p_flags & VS::TEXTURE_FLAG_CONVERT_TO_LINEAR) ? GL_SRGB8_ALPHA8 : GL_RGBA8; + r_gl_internal_format = (config.srgb_decode_supported || (p_flags & VS::TEXTURE_FLAG_CONVERT_TO_LINEAR)) ? GL_SRGB8_ALPHA8 : GL_RGBA8; r_gl_type = GL_UNSIGNED_BYTE; r_compressed = false; srgb = true; @@ -686,7 +686,7 @@ void RasterizerStorageGLES3::texture_set_data(RID p_texture, const Ref &p texture->ignore_mipmaps = compressed && !img->has_mipmaps(); - if (texture->flags & VS::TEXTURE_FLAG_MIPMAPS && !texture->ignore_mipmaps) + if ((texture->flags & VS::TEXTURE_FLAG_MIPMAPS) && !texture->ignore_mipmaps) glTexParameteri(texture->target, GL_TEXTURE_MIN_FILTER, config.use_fast_texture_filter ? GL_LINEAR_MIPMAP_NEAREST : GL_LINEAR_MIPMAP_LINEAR); else { if (texture->flags & VS::TEXTURE_FLAG_FILTER) { @@ -717,7 +717,7 @@ void RasterizerStorageGLES3::texture_set_data(RID p_texture, const Ref &p glTexParameteri(texture->target, GL_TEXTURE_MAG_FILTER, GL_NEAREST); // raw Filtering } - if ((texture->flags & VS::TEXTURE_FLAG_REPEAT || texture->flags & VS::TEXTURE_FLAG_MIRRORED_REPEAT) && texture->target != GL_TEXTURE_CUBE_MAP) { + if (((texture->flags & VS::TEXTURE_FLAG_REPEAT) || (texture->flags & VS::TEXTURE_FLAG_MIRRORED_REPEAT)) && texture->target != GL_TEXTURE_CUBE_MAP) { if (texture->flags & VS::TEXTURE_FLAG_MIRRORED_REPEAT) { glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_MIRRORED_REPEAT); @@ -770,7 +770,7 @@ void RasterizerStorageGLES3::texture_set_data(RID p_texture, const Ref &p } } - int mipmaps = (texture->flags & VS::TEXTURE_FLAG_MIPMAPS && img->has_mipmaps()) ? img->get_mipmap_count() + 1 : 1; + int mipmaps = ((texture->flags & VS::TEXTURE_FLAG_MIPMAPS) && img->has_mipmaps()) ? img->get_mipmap_count() + 1 : 1; int w = img->get_width(); int h = img->get_height(); @@ -820,7 +820,7 @@ void RasterizerStorageGLES3::texture_set_data(RID p_texture, const Ref &p texture->stored_cube_sides |= (1 << p_cube_side); - if (texture->flags & VS::TEXTURE_FLAG_MIPMAPS && mipmaps == 1 && !texture->ignore_mipmaps && (!(texture->flags & VS::TEXTURE_FLAG_CUBEMAP) || texture->stored_cube_sides == (1 << 6) - 1)) { + if ((texture->flags & VS::TEXTURE_FLAG_MIPMAPS) && mipmaps == 1 && !texture->ignore_mipmaps && (!(texture->flags & VS::TEXTURE_FLAG_CUBEMAP) || texture->stored_cube_sides == (1 << 6) - 1)) { //generate mipmaps if they were requested and the image does not contain them glGenerateMipmap(texture->target); } else if (mipmaps > 1) { @@ -912,7 +912,7 @@ void RasterizerStorageGLES3::texture_set_flags(RID p_texture, uint32_t p_flags) uint32_t cube = texture->flags & VS::TEXTURE_FLAG_CUBEMAP; texture->flags = p_flags | cube; // can't remove a cube from being a cube - if ((texture->flags & VS::TEXTURE_FLAG_REPEAT || texture->flags & VS::TEXTURE_FLAG_MIRRORED_REPEAT) && texture->target != GL_TEXTURE_CUBE_MAP) { + if (((texture->flags & VS::TEXTURE_FLAG_REPEAT) || (texture->flags & VS::TEXTURE_FLAG_MIRRORED_REPEAT)) && texture->target != GL_TEXTURE_CUBE_MAP) { if (texture->flags & VS::TEXTURE_FLAG_MIRRORED_REPEAT) { glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_MIRRORED_REPEAT); @@ -937,7 +937,7 @@ void RasterizerStorageGLES3::texture_set_flags(RID p_texture, uint32_t p_flags) } } - if (texture->flags & VS::TEXTURE_FLAG_MIPMAPS && !texture->ignore_mipmaps) { + if ((texture->flags & VS::TEXTURE_FLAG_MIPMAPS) && !texture->ignore_mipmaps) { if (!had_mipmaps && texture->mipmaps == 1) { glGenerateMipmap(texture->target); } @@ -3360,7 +3360,7 @@ Rect3 RasterizerStorageGLES3::mesh_get_aabb(RID p_mesh, RID p_skeleton) const { for (int i = 0; i < mesh->surfaces.size(); i++) { Rect3 laabb; - if (mesh->surfaces[i]->format & VS::ARRAY_FORMAT_BONES && mesh->surfaces[i]->skeleton_bone_aabb.size()) { + if ((mesh->surfaces[i]->format & VS::ARRAY_FORMAT_BONES) && mesh->surfaces[i]->skeleton_bone_aabb.size()) { int bs = mesh->surfaces[i]->skeleton_bone_aabb.size(); const Rect3 *skbones = mesh->surfaces[i]->skeleton_bone_aabb.ptr(); @@ -6864,42 +6864,28 @@ int RasterizerStorageGLES3::get_captured_render_info(VS::RenderInfo p_info) { int RasterizerStorageGLES3::get_render_info(VS::RenderInfo p_info) { switch (p_info) { - case VS::INFO_OBJECTS_IN_FRAME: { - + case VS::INFO_OBJECTS_IN_FRAME: return info.render_final.object_count; - } break; - case VS::INFO_VERTICES_IN_FRAME: { - + case VS::INFO_VERTICES_IN_FRAME: return info.render_final.vertices_count; - } break; - case VS::INFO_MATERIAL_CHANGES_IN_FRAME: { + case VS::INFO_MATERIAL_CHANGES_IN_FRAME: return info.render_final.material_switch_count; - } break; - case VS::INFO_SHADER_CHANGES_IN_FRAME: { + case VS::INFO_SHADER_CHANGES_IN_FRAME: return info.render_final.shader_rebind_count; - } break; - case VS::INFO_SURFACE_CHANGES_IN_FRAME: { + case VS::INFO_SURFACE_CHANGES_IN_FRAME: return info.render_final.surface_switch_count; - } break; - case VS::INFO_DRAW_CALLS_IN_FRAME: { + case VS::INFO_DRAW_CALLS_IN_FRAME: return info.render_final.draw_call_count; - } break; - case VS::INFO_USAGE_VIDEO_MEM_TOTAL: { - + case VS::INFO_USAGE_VIDEO_MEM_TOTAL: return 0; //no idea - } break; - case VS::INFO_VIDEO_MEM_USED: { - + case VS::INFO_VIDEO_MEM_USED: return info.vertex_mem + info.texture_mem; - } break; - case VS::INFO_TEXTURE_MEM_USED: { - + case VS::INFO_TEXTURE_MEM_USED: return info.texture_mem; - } break; - case VS::INFO_VERTEX_MEM_USED: { - + case VS::INFO_VERTEX_MEM_USED: return info.vertex_mem; - } break; + default: + return 0; //no idea either } } diff --git a/editor/fileserver/editor_file_server.cpp b/editor/fileserver/editor_file_server.cpp index ba90beee226..fccf7c323ce 100644 --- a/editor/fileserver/editor_file_server.cpp +++ b/editor/fileserver/editor_file_server.cpp @@ -34,7 +34,7 @@ #include "io/marshalls.h" //#define DEBUG_PRINT(m_p) print_line(m_p) -#define DEBUG_TIME(m_what) printf("MS: %s - %lli\n", m_what, OS::get_singleton()->get_ticks_usec()); +#define DEBUG_TIME(m_what) printf("MS: %s - %lu\n", m_what, OS::get_singleton()->get_ticks_usec()); //#define DEBUG_TIME(m_what) diff --git a/editor/import/resource_importer_scene.cpp b/editor/import/resource_importer_scene.cpp index 594728d2e0d..16a10b6dcb1 100644 --- a/editor/import/resource_importer_scene.cpp +++ b/editor/import/resource_importer_scene.cpp @@ -1024,7 +1024,7 @@ Error ResourceImporterScene::import(const String &p_source_file, const String &p String root_type = p_options["nodes/root_type"]; if (scene->get_class() != root_type) { - Node *base_node = base_node = Object::cast_to(ClassDB::instance(root_type)); + Node *base_node = Object::cast_to(ClassDB::instance(root_type)); if (base_node) { diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp index c0a6606ea70..d0bd18aa888 100644 --- a/editor/plugins/canvas_item_editor_plugin.cpp +++ b/editor/plugins/canvas_item_editor_plugin.cpp @@ -1515,7 +1515,7 @@ void CanvasItemEditor::_viewport_gui_input(const Ref &p_event) { } if (drag == DRAG_NONE) { - if ((m->get_button_mask() & BUTTON_MASK_LEFT && tool == TOOL_PAN) || m->get_button_mask() & BUTTON_MASK_MIDDLE || (m->get_button_mask() & BUTTON_MASK_LEFT && Input::get_singleton()->is_key_pressed(KEY_SPACE))) { + if (((m->get_button_mask() & BUTTON_MASK_LEFT) && tool == TOOL_PAN) || (m->get_button_mask() & BUTTON_MASK_MIDDLE) || ((m->get_button_mask() & BUTTON_MASK_LEFT) && Input::get_singleton()->is_key_pressed(KEY_SPACE))) { // Pan the viewport Point2i relative; if (bool(EditorSettings::get_singleton()->get("editors/2d/warped_mouse_panning"))) { diff --git a/editor/plugins/polygon_2d_editor_plugin.cpp b/editor/plugins/polygon_2d_editor_plugin.cpp index f7008298f0a..3917c700f0b 100644 --- a/editor/plugins/polygon_2d_editor_plugin.cpp +++ b/editor/plugins/polygon_2d_editor_plugin.cpp @@ -395,7 +395,7 @@ bool Polygon2DEditor::forward_gui_input(const Ref &p_event) { if (mm.is_valid()) { - if (edited_point != -1 && (wip_active || mm->get_button_mask() & BUTTON_MASK_LEFT)) { + if (edited_point != -1 && (wip_active || (mm->get_button_mask() & BUTTON_MASK_LEFT))) { Vector2 gpoint = mm->get_position(); Vector2 cpoint = canvas_item_editor->get_canvas_transform().affine_inverse().xform(gpoint); @@ -554,7 +554,7 @@ void Polygon2DEditor::_uv_input(const Ref &p_input) { if (mm.is_valid()) { - if (mm->get_button_mask() & BUTTON_MASK_MIDDLE || Input::get_singleton()->is_key_pressed(KEY_SPACE)) { + if ((mm->get_button_mask() & BUTTON_MASK_MIDDLE) || Input::get_singleton()->is_key_pressed(KEY_SPACE)) { Vector2 drag(mm->get_relative().x, mm->get_relative().y); uv_hscroll->set_value(uv_hscroll->get_value() - drag.x); diff --git a/modules/gdscript/gd_editor.cpp b/modules/gdscript/gd_editor.cpp index 70e7da5748e..bc51b840471 100644 --- a/modules/gdscript/gd_editor.cpp +++ b/modules/gdscript/gd_editor.cpp @@ -866,7 +866,7 @@ static bool _guess_expression_type(GDCompletionContext &context, const GDParser: MethodBind *mb = ClassDB::get_method(base_type, getter); if (mb) { PropertyInfo rt = mb->get_return_info(); - if (rt.usage & PROPERTY_USAGE_CLASS_IS_ENUM && t == Variant::INT) { + if ((rt.usage & PROPERTY_USAGE_CLASS_IS_ENUM) && t == Variant::INT) { r_type.enumeration = rt.class_name; } else if (t == Variant::OBJECT) { @@ -1903,11 +1903,11 @@ static void _find_call_arguments(GDCompletionContext &context, const GDParser::N arghint += ", "; else arghint += " "; - if (i == p_argidx || (mi.flags & METHOD_FLAG_VARARG && i > p_argidx)) { + if (i == p_argidx || ((mi.flags & METHOD_FLAG_VARARG) && i > p_argidx)) { arghint += String::chr(0xFFFF); } arghint += _get_visual_datatype(mi.arguments[i]) + " " + mi.arguments[i].name; - if (i == p_argidx || (mi.flags & METHOD_FLAG_VARARG && i > p_argidx)) { + if (i == p_argidx || ((mi.flags & METHOD_FLAG_VARARG) && i > p_argidx)) { arghint += String::chr(0xFFFF); } } diff --git a/scene/2d/line_builder.cpp b/scene/2d/line_builder.cpp index 1235013af4a..53db30e3ce6 100644 --- a/scene/2d/line_builder.cpp +++ b/scene/2d/line_builder.cpp @@ -173,13 +173,15 @@ void LineBuilder::build() { strip_begin(pos_up0, pos_down0, color0, uvx0); - // pos_up0 ------------- pos_up1 -------------------- - // | | - // pos0 - - - - - - - - - pos1 - - - - - - - - - pos2 - // | | - // pos_down0 ------------ pos_down1 ------------------ - // - // i-1 i i+1 + /* + * pos_up0 ------------- pos_up1 -------------------- + * | | + * pos0 - - - - - - - - - pos1 - - - - - - - - - pos2 + * | | + * pos_down0 ------------ pos_down1 ------------------ + * + * i-1 i i+1 + */ // http://labs.hyperandroid.com/tag/opengl-lines // (not the same implementation but visuals help a lot) @@ -206,17 +208,19 @@ void LineBuilder::build() { inner_normal1 = -u1 * hw; } - // --------------------------- - // / - // 0 / 1 - // / / - // --------------------x------ / - // / / (here shown with orientation == DOWN) - // / / - // / / - // / / - // 2 / - // / + /* + * --------------------------- + * / + * 0 / 1 + * / / + * --------------------x------ / + * / / (here shown with orientation == DOWN) + * / / + * / / + * / / + * 2 / + * / + */ // Find inner intersection at the joint Vector2 corner_pos_in, corner_pos_out; @@ -315,13 +319,14 @@ void LineBuilder::build() { // Add joint geometry if (current_joint_mode != LINE_JOINT_SHARP) { - // ________________ cbegin - // / \ - // / \ - // ____________/_ _ _\ cend - // | | - // | | - // | | + /* ________________ cbegin + * / \ + * / \ + * ____________/_ _ _\ cend + * | | + * | | + * | | + */ Vector2 cbegin, cend; if (orientation == UP) { diff --git a/scene/gui/tree.cpp b/scene/gui/tree.cpp index de17416d8e3..d4ebf55f921 100644 --- a/scene/gui/tree.cpp +++ b/scene/gui/tree.cpp @@ -2304,7 +2304,7 @@ void Tree::_gui_input(Ref p_event) { int col, h, section; TreeItem *it = _find_item_at_pos(root, mpos, col, h, section); - if (drop_mode_flags && it != drop_mode_over || section != drop_mode_section) { + if ((drop_mode_flags && it != drop_mode_over) || section != drop_mode_section) { drop_mode_over = it; drop_mode_section = section; update(); diff --git a/scene/resources/curve.cpp b/scene/resources/curve.cpp index 7fbaa1f73c3..e1ad9e4cb0f 100644 --- a/scene/resources/curve.cpp +++ b/scene/resources/curve.cpp @@ -331,18 +331,19 @@ real_t Curve::interpolate_local_nocheck(int index, real_t local_offset) const { const Point a = _points[index]; const Point b = _points[index + 1]; - // Cubic bezier - - // ac-----bc - // / \ - // / \ Here with a.right_tangent > 0 - // / \ and b.left_tangent < 0 - // / \ - // a b - // - // |-d1--|-d2--|-d3--| - // - // d1 == d2 == d3 == d / 3 + /* Cubic bezier + * + * ac-----bc + * / \ + * / \ Here with a.right_tangent > 0 + * / \ and b.left_tangent < 0 + * / \ + * a b + * + * |-d1--|-d2--|-d3--| + * + * d1 == d2 == d3 == d / 3 + */ // Control points are chosen at equal distances real_t d = b.pos.x - a.pos.x; diff --git a/scene/resources/packed_scene.cpp b/scene/resources/packed_scene.cpp index c525ca600a4..5d6f44dfef1 100644 --- a/scene/resources/packed_scene.cpp +++ b/scene/resources/packed_scene.cpp @@ -92,7 +92,7 @@ Node *SceneState::instance(GenEditState p_edit_state) const { NODE_FROM_ID(nparent, n.parent); #ifdef DEBUG_ENABLED - if (!nparent && n.parent & FLAG_ID_IS_PATH) { + if (!nparent && (n.parent & FLAG_ID_IS_PATH)) { WARN_PRINT(String("Parent path '" + String(node_paths[n.parent & FLAG_MASK]) + "' for node '" + String(snames[n.name]) + "' has vanished when instancing: '" + get_path() + "'.").ascii().get_data()); } @@ -489,7 +489,7 @@ Error SceneState::_parse_node(Node *p_owner, Node *p_node, int p_parent_idx, Map // only save what has been changed // only save changed properties in instance - if (E->get().usage & PROPERTY_USAGE_NO_INSTANCE_STATE || E->get().name == "__meta__") { + if ((E->get().usage & PROPERTY_USAGE_NO_INSTANCE_STATE) || E->get().name == "__meta__") { //property has requested that no instance state is saved, sorry //also, meta won't be overridden or saved continue; @@ -1288,7 +1288,7 @@ bool SceneState::is_node_instance_placeholder(int p_idx) const { ERR_FAIL_INDEX_V(p_idx, nodes.size(), false); - return nodes[p_idx].instance >= 0 && nodes[p_idx].instance & FLAG_INSTANCE_IS_PLACEHOLDER; + return nodes[p_idx].instance >= 0 && (nodes[p_idx].instance & FLAG_INSTANCE_IS_PLACEHOLDER); } Ref SceneState::get_node_instance(int p_idx) const { @@ -1313,7 +1313,7 @@ String SceneState::get_node_instance_placeholder(int p_idx) const { ERR_FAIL_INDEX_V(p_idx, nodes.size(), String()); - if (nodes[p_idx].instance >= 0 && nodes[p_idx].instance & FLAG_INSTANCE_IS_PLACEHOLDER) { + if (nodes[p_idx].instance >= 0 && (nodes[p_idx].instance & FLAG_INSTANCE_IS_PLACEHOLDER)) { return variants[nodes[p_idx].instance & FLAG_MASK]; } diff --git a/scene/resources/primitive_meshes.cpp b/scene/resources/primitive_meshes.cpp index 52e080bdc82..ba356d89b1d 100644 --- a/scene/resources/primitive_meshes.cpp +++ b/scene/resources/primitive_meshes.cpp @@ -230,7 +230,6 @@ void CapsuleMesh::_create_mesh_array(Array &p_arr) const { prevrow = 0; for (j = 0; j <= (rings + 1); j++) { v = j; - w; v /= (rings + 1); w = sin(0.5 * Math_PI * v); @@ -309,7 +308,6 @@ void CapsuleMesh::_create_mesh_array(Array &p_arr) const { prevrow = 0; for (j = 0; j <= (rings + 1); j++) { v = j; - w; v /= (rings + 1); v += 1.0; diff --git a/servers/audio_server.cpp b/servers/audio_server.cpp index 3139c6bb7a5..29014a7ced2 100644 --- a/servers/audio_server.cpp +++ b/servers/audio_server.cpp @@ -203,8 +203,9 @@ void AudioServer::_mix_step() { if (!bus_map.has(bus->send)) { bus = buses[0]; //send to master } else { + int prev_index_cache = bus->index_cache; bus = bus_map[bus->send]; - if (bus->index_cache >= bus->index_cache) { //invalid, send to master + if (prev_index_cache >= bus->index_cache) { //invalid, send to master bus = buses[0]; } } diff --git a/servers/physics/broad_phase_basic.cpp b/servers/physics/broad_phase_basic.cpp index 959718a252f..c6565ac2e9b 100644 --- a/servers/physics/broad_phase_basic.cpp +++ b/servers/physics/broad_phase_basic.cpp @@ -30,9 +30,10 @@ #include "broad_phase_basic.h" #include "list.h" #include "print_string.h" + BroadPhaseSW::ID BroadPhaseBasic::create(CollisionObjectSW *p_object, int p_subindex) { - ERR_FAIL_COND_V(p_object == NULL, NULL); + ERR_FAIL_COND_V(p_object == NULL, 0); current++; diff --git a/servers/visual/visual_server_scene.cpp b/servers/visual/visual_server_scene.cpp index 9704a9627bc..48ce9e72888 100644 --- a/servers/visual/visual_server_scene.cpp +++ b/servers/visual/visual_server_scene.cpp @@ -101,7 +101,7 @@ void *VisualServerScene::_instance_pair(void *p_self, OctreeElementID, Instance SWAP(A, B); //lesser always first } - if (B->base_type == VS::INSTANCE_LIGHT && (1 << A->base_type) & VS::INSTANCE_GEOMETRY_MASK) { + if (B->base_type == VS::INSTANCE_LIGHT && ((1 << A->base_type) & VS::INSTANCE_GEOMETRY_MASK)) { InstanceLightData *light = static_cast(B->base_data); InstanceGeometryData *geom = static_cast(A->base_data); @@ -119,7 +119,7 @@ void *VisualServerScene::_instance_pair(void *p_self, OctreeElementID, Instance geom->lighting_dirty = true; return E; //this element should make freeing faster - } else if (B->base_type == VS::INSTANCE_REFLECTION_PROBE && (1 << A->base_type) & VS::INSTANCE_GEOMETRY_MASK) { + } else if (B->base_type == VS::INSTANCE_REFLECTION_PROBE && ((1 << A->base_type) & VS::INSTANCE_GEOMETRY_MASK)) { InstanceReflectionProbeData *reflection_probe = static_cast(B->base_data); InstanceGeometryData *geom = static_cast(A->base_data); @@ -133,7 +133,7 @@ void *VisualServerScene::_instance_pair(void *p_self, OctreeElementID, Instance geom->reflection_dirty = true; return E; //this element should make freeing faster - } else if (B->base_type == VS::INSTANCE_GI_PROBE && (1 << A->base_type) & VS::INSTANCE_GEOMETRY_MASK) { + } else if (B->base_type == VS::INSTANCE_GI_PROBE && ((1 << A->base_type) & VS::INSTANCE_GEOMETRY_MASK)) { InstanceGIProbeData *gi_probe = static_cast(B->base_data); InstanceGeometryData *geom = static_cast(A->base_data); @@ -169,7 +169,7 @@ void VisualServerScene::_instance_unpair(void *p_self, OctreeElementID, Instance SWAP(A, B); //lesser always first } - if (B->base_type == VS::INSTANCE_LIGHT && (1 << A->base_type) & VS::INSTANCE_GEOMETRY_MASK) { + if (B->base_type == VS::INSTANCE_LIGHT && ((1 << A->base_type) & VS::INSTANCE_GEOMETRY_MASK)) { InstanceLightData *light = static_cast(B->base_data); InstanceGeometryData *geom = static_cast(A->base_data); @@ -184,7 +184,7 @@ void VisualServerScene::_instance_unpair(void *p_self, OctreeElementID, Instance } geom->lighting_dirty = true; - } else if (B->base_type == VS::INSTANCE_REFLECTION_PROBE && (1 << A->base_type) & VS::INSTANCE_GEOMETRY_MASK) { + } else if (B->base_type == VS::INSTANCE_REFLECTION_PROBE && ((1 << A->base_type) & VS::INSTANCE_GEOMETRY_MASK)) { InstanceReflectionProbeData *reflection_probe = static_cast(B->base_data); InstanceGeometryData *geom = static_cast(A->base_data); @@ -196,7 +196,7 @@ void VisualServerScene::_instance_unpair(void *p_self, OctreeElementID, Instance geom->reflection_dirty = true; - } else if (B->base_type == VS::INSTANCE_GI_PROBE && (1 << A->base_type) & VS::INSTANCE_GEOMETRY_MASK) { + } else if (B->base_type == VS::INSTANCE_GI_PROBE && ((1 << A->base_type) & VS::INSTANCE_GEOMETRY_MASK)) { InstanceGIProbeData *gi_probe = static_cast(B->base_data); InstanceGeometryData *geom = static_cast(A->base_data); @@ -1420,7 +1420,7 @@ void VisualServerScene::_render_scene(const Transform p_cam_transform, const Cam gi_probe_update_list.add(&gi_probe->update_element); } - } else if ((1 << ins->base_type) & VS::INSTANCE_GEOMETRY_MASK && ins->visible && ins->cast_shadows != VS::SHADOW_CASTING_SETTING_SHADOWS_ONLY) { + } else if (((1 << ins->base_type) & VS::INSTANCE_GEOMETRY_MASK) && ins->visible && ins->cast_shadows != VS::SHADOW_CASTING_SETTING_SHADOWS_ONLY) { keep = true;