From dc9c34f0c65db98fcffb7f250ade0c5f4a025308 Mon Sep 17 00:00:00 2001 From: Thaddeus Crews Date: Sat, 26 Apr 2025 10:05:07 -0500 Subject: [PATCH] SCons: Add enum conversion warning --- SConstruct | 2 +- core/input/input.h | 4 +-- .../import/dynamic_font_import_settings.cpp | 2 +- .../import/resource_importer_dynamic_font.cpp | 2 +- editor/plugins/canvas_item_editor_plugin.cpp | 6 ++-- editor/plugins/node_3d_editor_plugin.h | 12 ++++---- modules/gdscript/gdscript_tokenizer_buffer.h | 8 ++--- .../gridmap/editor/grid_map_editor_plugin.h | 4 +-- platform/macos/display_server_macos.mm | 6 ++-- platform/windows/joypad_windows.cpp | 8 ++--- scene/gui/control.cpp | 30 +++++++++---------- scene/resources/3d/primitive_meshes.cpp | 24 +++++++-------- scene/resources/mesh.cpp | 18 +++++------ servers/audio/effects/audio_effect_chorus.h | 18 +++++------ 14 files changed, 67 insertions(+), 77 deletions(-) diff --git a/SConstruct b/SConstruct index 8e3e06c52f..a6a81aadf6 100644 --- a/SConstruct +++ b/SConstruct @@ -877,7 +877,7 @@ if env.msvc and not methods.using_clang(env): # MSVC env.AppendUnique(LINKFLAGS=["/WX"]) else: # GCC, Clang - common_warnings = [] + common_warnings = ["-Wenum-conversion"] if methods.using_gcc(env): common_warnings += ["-Wshadow", "-Wno-misleading-indentation"] diff --git a/core/input/input.h b/core/input/input.h index 8d3b7ae3b9..e7abf746dd 100644 --- a/core/input/input.h +++ b/core/input/input.h @@ -78,9 +78,7 @@ public: CURSOR_MAX }; - enum { - JOYPADS_MAX = 16, - }; + static constexpr int32_t JOYPADS_MAX = 16; typedef void (*EventDispatchFunc)(const Ref &p_event); diff --git a/editor/import/dynamic_font_import_settings.cpp b/editor/import/dynamic_font_import_settings.cpp index 3cba6e2c62..c7a60c2621 100644 --- a/editor/import/dynamic_font_import_settings.cpp +++ b/editor/import/dynamic_font_import_settings.cpp @@ -1117,7 +1117,7 @@ void DynamicFontImportSettingsDialog::open_settings(const String &p_path) { for (int i = 0; i < contours.size(); i++) { for (int j = prev_start; j <= contours[i]; j++) { int next_point = (j < contours[i]) ? (j + 1) : prev_start; - if ((points[j].z != TextServer::CONTOUR_CURVE_TAG_ON) || (!Math::is_equal_approx(points[j].x, points[next_point].x) && !Math::is_equal_approx(points[j].y, points[next_point].y))) { + if ((points[j].z != (real_t)TextServer::CONTOUR_CURVE_TAG_ON) || (!Math::is_equal_approx(points[j].x, points[next_point].x) && !Math::is_equal_approx(points[j].y, points[next_point].y))) { is_pixel = false; break; } diff --git a/editor/import/resource_importer_dynamic_font.cpp b/editor/import/resource_importer_dynamic_font.cpp index 71ff908505..49c9b1fed9 100644 --- a/editor/import/resource_importer_dynamic_font.cpp +++ b/editor/import/resource_importer_dynamic_font.cpp @@ -191,7 +191,7 @@ Error ResourceImporterDynamicFont::import(ResourceUID::ID p_source_id, const Str for (int i = 0; i < contours.size(); i++) { for (int j = prev_start; j <= contours[i]; j++) { int next_point = (j < contours[i]) ? (j + 1) : prev_start; - if ((points[j].z != TextServer::CONTOUR_CURVE_TAG_ON) || (!Math::is_equal_approx(points[j].x, points[next_point].x) && !Math::is_equal_approx(points[j].y, points[next_point].y))) { + if ((points[j].z != (real_t)TextServer::CONTOUR_CURVE_TAG_ON) || (!Math::is_equal_approx(points[j].x, points[next_point].x) && !Math::is_equal_approx(points[j].y, points[next_point].y))) { is_pixel = false; break; } diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp index cd333949ca..c9b8725a60 100644 --- a/editor/plugins/canvas_item_editor_plugin.cpp +++ b/editor/plugins/canvas_item_editor_plugin.cpp @@ -3439,7 +3439,7 @@ void CanvasItemEditor::_draw_control_helpers(Control *control) { Vector2 line_starts[4]; Vector2 line_ends[4]; for (int i = 0; i < 4; i++) { - real_t anchor_val = (i >= 2) ? ANCHOR_END - anchors_values[i] : anchors_values[i]; + real_t anchor_val = (i >= 2) ? (real_t)ANCHOR_END - anchors_values[i] : anchors_values[i]; line_starts[i] = corners_pos[i].lerp(corners_pos[(i + 1) % 4], anchor_val); line_ends[i] = corners_pos[(i + 3) % 4].lerp(corners_pos[(i + 2) % 4], anchor_val); bool anchor_snapped = anchors_values[i] == 0.0 || anchors_values[i] == 0.5 || anchors_values[i] == 1.0; @@ -3457,11 +3457,11 @@ void CanvasItemEditor::_draw_control_helpers(Control *control) { _draw_percentage_at_position(percent_val, (anchors_pos[dragged_anchor] + anchors_pos[(dragged_anchor + 3) % 4]) / 2, (Side)(dragged_anchor)); percent_val = anchors_values[(dragged_anchor + 1) % 4]; - percent_val = ((dragged_anchor + 1) % 4 >= 2) ? ANCHOR_END - percent_val : percent_val; + percent_val = ((dragged_anchor + 1) % 4 >= 2) ? (real_t)ANCHOR_END - percent_val : percent_val; _draw_percentage_at_position(percent_val, (line_starts[dragged_anchor] + anchors_pos[dragged_anchor]) / 2, (Side)(dragged_anchor)); percent_val = anchors_values[dragged_anchor]; - percent_val = (dragged_anchor >= 2) ? ANCHOR_END - percent_val : percent_val; + percent_val = (dragged_anchor >= 2) ? (real_t)ANCHOR_END - percent_val : percent_val; _draw_percentage_at_position(percent_val, (line_ends[(dragged_anchor + 1) % 4] + anchors_pos[dragged_anchor]) / 2, (Side)((dragged_anchor + 1) % 4)); } diff --git a/editor/plugins/node_3d_editor_plugin.h b/editor/plugins/node_3d_editor_plugin.h index 92aaf700d5..dc193eda8b 100644 --- a/editor/plugins/node_3d_editor_plugin.h +++ b/editor/plugins/node_3d_editor_plugin.h @@ -181,14 +181,12 @@ class Node3DEditorViewport : public Control { }; public: - enum { - GIZMO_BASE_LAYER = 27, - GIZMO_EDIT_LAYER = 26, - GIZMO_GRID_LAYER = 25, - MISC_TOOL_LAYER = 24, + static constexpr int32_t GIZMO_BASE_LAYER = 27; + static constexpr int32_t GIZMO_EDIT_LAYER = 26; + static constexpr int32_t GIZMO_GRID_LAYER = 25; + static constexpr int32_t MISC_TOOL_LAYER = 24; - FRAME_TIME_HISTORY = 20, - }; + static constexpr int32_t FRAME_TIME_HISTORY = 20; enum NavigationScheme { NAVIGATION_GODOT = 0, diff --git a/modules/gdscript/gdscript_tokenizer_buffer.h b/modules/gdscript/gdscript_tokenizer_buffer.h index 4507cd604b..163dbe6fe8 100644 --- a/modules/gdscript/gdscript_tokenizer_buffer.h +++ b/modules/gdscript/gdscript_tokenizer_buffer.h @@ -39,11 +39,9 @@ public: COMPRESS_ZSTD, }; - enum { - TOKEN_BYTE_MASK = 0x80, - TOKEN_BITS = 8, - TOKEN_MASK = (1 << (TOKEN_BITS - 1)) - 1, - }; + static constexpr uint32_t TOKEN_BYTE_MASK = 0x80; + static constexpr uint32_t TOKEN_BITS = 8; + static constexpr uint32_t TOKEN_MASK = (1 << (TOKEN_BITS - 1)) - 1; Vector identifiers; Vector constants; diff --git a/modules/gridmap/editor/grid_map_editor_plugin.h b/modules/gridmap/editor/grid_map_editor_plugin.h index 5323b10ca6..71407132e2 100644 --- a/modules/gridmap/editor/grid_map_editor_plugin.h +++ b/modules/gridmap/editor/grid_map_editor_plugin.h @@ -48,9 +48,7 @@ class BaseButton; class GridMapEditor : public VBoxContainer { GDCLASS(GridMapEditor, VBoxContainer); - enum { - GRID_CURSOR_SIZE = 50 - }; + static constexpr int32_t GRID_CURSOR_SIZE = 50; enum InputAction { INPUT_NONE, diff --git a/platform/macos/display_server_macos.mm b/platform/macos/display_server_macos.mm index 3ec84872e6..515290ff99 100644 --- a/platform/macos/display_server_macos.mm +++ b/platform/macos/display_server_macos.mm @@ -1829,7 +1829,7 @@ Color DisplayServerMacOS::screen_get_pixel(const Point2i &p_position) const { CGColorSpaceRef color_space = CGColorSpaceCreateDeviceRGB(); if (color_space) { uint8_t img_data[4]; - CGContextRef context = CGBitmapContextCreate(img_data, 1, 1, 8, 4, color_space, kCGImageAlphaPremultipliedLast | kCGBitmapByteOrder32Big); + CGContextRef context = CGBitmapContextCreate(img_data, 1, 1, 8, 4, color_space, (uint32_t)kCGImageAlphaPremultipliedLast | kCGBitmapByteOrder32Big); if (context) { CGContextDrawImage(context, CGRectMake(0, 0, 1, 1), image); color = Color(img_data[0] / 255.0f, img_data[1] / 255.0f, img_data[2] / 255.0f, img_data[3] / 255.0f); @@ -1878,7 +1878,7 @@ Ref DisplayServerMacOS::screen_get_image(int p_screen) const { Vector img_data; img_data.resize(height * width * 4); - CGContextRef context = CGBitmapContextCreate(img_data.ptrw(), width, height, 8, 4 * width, color_space, kCGImageAlphaPremultipliedLast | kCGBitmapByteOrder32Big); + CGContextRef context = CGBitmapContextCreate(img_data.ptrw(), width, height, 8, 4 * width, color_space, (uint32_t)kCGImageAlphaPremultipliedLast | kCGBitmapByteOrder32Big); if (context) { CGContextDrawImage(context, CGRectMake(0, 0, width, height), image); img = Image::create_from_data(width, height, false, Image::FORMAT_RGBA8, img_data); @@ -1926,7 +1926,7 @@ Ref DisplayServerMacOS::screen_get_image_rect(const Rect2i &p_rect) const Vector img_data; img_data.resize_zeroed(height * width * 4); - CGContextRef context = CGBitmapContextCreate(img_data.ptrw(), width, height, 8, 4 * width, color_space, kCGImageAlphaPremultipliedLast | kCGBitmapByteOrder32Big); + CGContextRef context = CGBitmapContextCreate(img_data.ptrw(), width, height, 8, 4 * width, color_space, (uint32_t)kCGImageAlphaPremultipliedLast | kCGBitmapByteOrder32Big); if (context) { CGContextDrawImage(context, CGRectMake(0, 0, width, height), image); img = Image::create_from_data(width, height, false, Image::FORMAT_RGBA8, img_data); diff --git a/platform/windows/joypad_windows.cpp b/platform/windows/joypad_windows.cpp index 6138619189..5628c61699 100644 --- a/platform/windows/joypad_windows.cpp +++ b/platform/windows/joypad_windows.cpp @@ -525,17 +525,17 @@ float JoypadWindows::axis_correct(int p_val, bool p_xinput, bool p_trigger, bool return p_trigger ? -1.0f : 0.0f; } if (!p_xinput) { - return (float)p_val / MAX_JOY_AXIS; + return p_val / (float)MAX_JOY_AXIS; } if (p_trigger) { // Convert to a value between -1.0f and 1.0f. - return 2.0f * p_val / MAX_TRIGGER - 1.0f; + return 2.0f * p_val / (float)MAX_TRIGGER - 1.0f; } float value; if (p_val < 0) { - value = (float)p_val / MAX_JOY_AXIS; + value = p_val / (float)MAX_JOY_AXIS; } else { - value = (float)p_val / (MAX_JOY_AXIS - 1); + value = p_val / (float)(MAX_JOY_AXIS - 1); } if (p_negate) { value = -value; diff --git a/scene/gui/control.cpp b/scene/gui/control.cpp index ff52236c0b..7e95e875b3 100644 --- a/scene/gui/control.cpp +++ b/scene/gui/control.cpp @@ -1030,56 +1030,56 @@ int Control::_get_anchors_layout_preset() const { float top = get_anchor(SIDE_TOP); float bottom = get_anchor(SIDE_BOTTOM); - if (left == ANCHOR_BEGIN && right == ANCHOR_BEGIN && top == ANCHOR_BEGIN && bottom == ANCHOR_BEGIN) { + if (left == (float)ANCHOR_BEGIN && right == (float)ANCHOR_BEGIN && top == (float)ANCHOR_BEGIN && bottom == (float)ANCHOR_BEGIN) { return (int)LayoutPreset::PRESET_TOP_LEFT; } - if (left == ANCHOR_END && right == ANCHOR_END && top == ANCHOR_BEGIN && bottom == ANCHOR_BEGIN) { + if (left == (float)ANCHOR_END && right == (float)ANCHOR_END && top == (float)ANCHOR_BEGIN && bottom == (float)ANCHOR_BEGIN) { return (int)LayoutPreset::PRESET_TOP_RIGHT; } - if (left == ANCHOR_BEGIN && right == ANCHOR_BEGIN && top == ANCHOR_END && bottom == ANCHOR_END) { + if (left == (float)ANCHOR_BEGIN && right == (float)ANCHOR_BEGIN && top == (float)ANCHOR_END && bottom == (float)ANCHOR_END) { return (int)LayoutPreset::PRESET_BOTTOM_LEFT; } - if (left == ANCHOR_END && right == ANCHOR_END && top == ANCHOR_END && bottom == ANCHOR_END) { + if (left == (float)ANCHOR_END && right == (float)ANCHOR_END && top == (float)ANCHOR_END && bottom == (float)ANCHOR_END) { return (int)LayoutPreset::PRESET_BOTTOM_RIGHT; } - if (left == ANCHOR_BEGIN && right == ANCHOR_BEGIN && top == 0.5 && bottom == 0.5) { + if (left == (float)ANCHOR_BEGIN && right == (float)ANCHOR_BEGIN && top == 0.5 && bottom == 0.5) { return (int)LayoutPreset::PRESET_CENTER_LEFT; } - if (left == ANCHOR_END && right == ANCHOR_END && top == 0.5 && bottom == 0.5) { + if (left == (float)ANCHOR_END && right == (float)ANCHOR_END && top == 0.5 && bottom == 0.5) { return (int)LayoutPreset::PRESET_CENTER_RIGHT; } - if (left == 0.5 && right == 0.5 && top == ANCHOR_BEGIN && bottom == ANCHOR_BEGIN) { + if (left == 0.5 && right == 0.5 && top == (float)ANCHOR_BEGIN && bottom == (float)ANCHOR_BEGIN) { return (int)LayoutPreset::PRESET_CENTER_TOP; } - if (left == 0.5 && right == 0.5 && top == ANCHOR_END && bottom == ANCHOR_END) { + if (left == 0.5 && right == 0.5 && top == (float)ANCHOR_END && bottom == (float)ANCHOR_END) { return (int)LayoutPreset::PRESET_CENTER_BOTTOM; } if (left == 0.5 && right == 0.5 && top == 0.5 && bottom == 0.5) { return (int)LayoutPreset::PRESET_CENTER; } - if (left == ANCHOR_BEGIN && right == ANCHOR_BEGIN && top == ANCHOR_BEGIN && bottom == ANCHOR_END) { + if (left == (float)ANCHOR_BEGIN && right == (float)ANCHOR_BEGIN && top == (float)ANCHOR_BEGIN && bottom == (float)ANCHOR_END) { return (int)LayoutPreset::PRESET_LEFT_WIDE; } - if (left == ANCHOR_END && right == ANCHOR_END && top == ANCHOR_BEGIN && bottom == ANCHOR_END) { + if (left == (float)ANCHOR_END && right == (float)ANCHOR_END && top == (float)ANCHOR_BEGIN && bottom == (float)ANCHOR_END) { return (int)LayoutPreset::PRESET_RIGHT_WIDE; } - if (left == ANCHOR_BEGIN && right == ANCHOR_END && top == ANCHOR_BEGIN && bottom == ANCHOR_BEGIN) { + if (left == (float)ANCHOR_BEGIN && right == (float)ANCHOR_END && top == (float)ANCHOR_BEGIN && bottom == (float)ANCHOR_BEGIN) { return (int)LayoutPreset::PRESET_TOP_WIDE; } - if (left == ANCHOR_BEGIN && right == ANCHOR_END && top == ANCHOR_END && bottom == ANCHOR_END) { + if (left == (float)ANCHOR_BEGIN && right == (float)ANCHOR_END && top == (float)ANCHOR_END && bottom == (float)ANCHOR_END) { return (int)LayoutPreset::PRESET_BOTTOM_WIDE; } - if (left == 0.5 && right == 0.5 && top == ANCHOR_BEGIN && bottom == ANCHOR_END) { + if (left == 0.5 && right == 0.5 && top == (float)ANCHOR_BEGIN && bottom == (float)ANCHOR_END) { return (int)LayoutPreset::PRESET_VCENTER_WIDE; } - if (left == ANCHOR_BEGIN && right == ANCHOR_END && top == 0.5 && bottom == 0.5) { + if (left == (float)ANCHOR_BEGIN && right == (float)ANCHOR_END && top == 0.5 && bottom == 0.5) { return (int)LayoutPreset::PRESET_HCENTER_WIDE; } - if (left == ANCHOR_BEGIN && right == ANCHOR_END && top == ANCHOR_BEGIN && bottom == ANCHOR_END) { + if (left == (float)ANCHOR_BEGIN && right == (float)ANCHOR_END && top == (float)ANCHOR_BEGIN && bottom == (float)ANCHOR_END) { return (int)LayoutPreset::PRESET_FULL_RECT; } diff --git a/scene/resources/3d/primitive_meshes.cpp b/scene/resources/3d/primitive_meshes.cpp index 2747968b6f..d835f6bbbc 100644 --- a/scene/resources/3d/primitive_meshes.cpp +++ b/scene/resources/3d/primitive_meshes.cpp @@ -3078,11 +3078,11 @@ void TextMesh::_generate_glyph_mesh_data(const GlyphMeshKey &p_key, const Glyph Vector polygon; for (int32_t j = start; j <= end; j++) { - if (points[j].z == TextServer::CONTOUR_CURVE_TAG_ON) { + if (points[j].z == (real_t)TextServer::CONTOUR_CURVE_TAG_ON) { // Point on the curve. Vector2 p = Vector2(points[j].x, points[j].y) * pixel_size; polygon.push_back(ContourPoint(p, true)); - } else if (points[j].z == TextServer::CONTOUR_CURVE_TAG_OFF_CONIC) { + } else if (points[j].z == (real_t)TextServer::CONTOUR_CURVE_TAG_OFF_CONIC) { // Conic Bezier arc. int32_t next = (j == end) ? start : (j + 1); int32_t prev = (j == start) ? end : (j - 1); @@ -3091,16 +3091,16 @@ void TextMesh::_generate_glyph_mesh_data(const GlyphMeshKey &p_key, const Glyph Vector2 p2; // For successive conic OFF points add a virtual ON point in the middle. - if (points[prev].z == TextServer::CONTOUR_CURVE_TAG_OFF_CONIC) { + if (points[prev].z == (real_t)TextServer::CONTOUR_CURVE_TAG_OFF_CONIC) { p0 = (Vector2(points[prev].x, points[prev].y) + Vector2(points[j].x, points[j].y)) / 2.0; - } else if (points[prev].z == TextServer::CONTOUR_CURVE_TAG_ON) { + } else if (points[prev].z == (real_t)TextServer::CONTOUR_CURVE_TAG_ON) { p0 = Vector2(points[prev].x, points[prev].y); } else { ERR_FAIL_MSG(vformat("Invalid conic arc point sequence at %d:%d", i, j)); } - if (points[next].z == TextServer::CONTOUR_CURVE_TAG_OFF_CONIC) { + if (points[next].z == (real_t)TextServer::CONTOUR_CURVE_TAG_OFF_CONIC) { p2 = (Vector2(points[j].x, points[j].y) + Vector2(points[next].x, points[next].y)) / 2.0; - } else if (points[next].z == TextServer::CONTOUR_CURVE_TAG_ON) { + } else if (points[next].z == (real_t)TextServer::CONTOUR_CURVE_TAG_ON) { p2 = Vector2(points[next].x, points[next].y); } else { ERR_FAIL_MSG(vformat("Invalid conic arc point sequence at %d:%d", i, j)); @@ -3118,7 +3118,7 @@ void TextMesh::_generate_glyph_mesh_data(const GlyphMeshKey &p_key, const Glyph polygon.push_back(ContourPoint(p, false)); t += step; } - } else if (points[j].z == TextServer::CONTOUR_CURVE_TAG_OFF_CUBIC) { + } else if (points[j].z == (real_t)TextServer::CONTOUR_CURVE_TAG_OFF_CUBIC) { // Cubic Bezier arc. int32_t cur = j; int32_t next1 = (j == end) ? start : (j + 1); @@ -3126,7 +3126,7 @@ void TextMesh::_generate_glyph_mesh_data(const GlyphMeshKey &p_key, const Glyph int32_t prev = (j == start) ? end : (j - 1); // There must be exactly two OFF points and two ON points for each cubic arc. - if (points[prev].z != TextServer::CONTOUR_CURVE_TAG_ON) { + if (points[prev].z != (real_t)TextServer::CONTOUR_CURVE_TAG_ON) { cur = (cur == 0) ? end : cur - 1; next1 = (next1 == 0) ? end : next1 - 1; next2 = (next2 == 0) ? end : next2 - 1; @@ -3134,10 +3134,10 @@ void TextMesh::_generate_glyph_mesh_data(const GlyphMeshKey &p_key, const Glyph } else { j++; } - ERR_FAIL_COND_MSG(points[prev].z != TextServer::CONTOUR_CURVE_TAG_ON, vformat("Invalid cubic arc point sequence at %d:%d", i, prev)); - ERR_FAIL_COND_MSG(points[cur].z != TextServer::CONTOUR_CURVE_TAG_OFF_CUBIC, vformat("Invalid cubic arc point sequence at %d:%d", i, cur)); - ERR_FAIL_COND_MSG(points[next1].z != TextServer::CONTOUR_CURVE_TAG_OFF_CUBIC, vformat("Invalid cubic arc point sequence at %d:%d", i, next1)); - ERR_FAIL_COND_MSG(points[next2].z != TextServer::CONTOUR_CURVE_TAG_ON, vformat("Invalid cubic arc point sequence at %d:%d", i, next2)); + ERR_FAIL_COND_MSG(points[prev].z != (real_t)TextServer::CONTOUR_CURVE_TAG_ON, vformat("Invalid cubic arc point sequence at %d:%d", i, prev)); + ERR_FAIL_COND_MSG(points[cur].z != (real_t)TextServer::CONTOUR_CURVE_TAG_OFF_CUBIC, vformat("Invalid cubic arc point sequence at %d:%d", i, cur)); + ERR_FAIL_COND_MSG(points[next1].z != (real_t)TextServer::CONTOUR_CURVE_TAG_OFF_CUBIC, vformat("Invalid cubic arc point sequence at %d:%d", i, next1)); + ERR_FAIL_COND_MSG(points[next2].z != (real_t)TextServer::CONTOUR_CURVE_TAG_ON, vformat("Invalid cubic arc point sequence at %d:%d", i, next2)); Vector2 p0 = Vector2(points[prev].x, points[prev].y); Vector2 p1 = Vector2(points[cur].x, points[cur].y); diff --git a/scene/resources/mesh.cpp b/scene/resources/mesh.cpp index 57d1a5c7c5..a02ac81c87 100644 --- a/scene/resources/mesh.cpp +++ b/scene/resources/mesh.cpp @@ -978,15 +978,15 @@ enum OldArrayFormat { OLD_ARRAY_FORMAT_INDEX = 1 << OLD_ARRAY_INDEX, OLD_ARRAY_COMPRESS_BASE = (OLD_ARRAY_INDEX + 1), - OLD_ARRAY_COMPRESS_VERTEX = 1 << (OLD_ARRAY_VERTEX + OLD_ARRAY_COMPRESS_BASE), // mandatory - OLD_ARRAY_COMPRESS_NORMAL = 1 << (OLD_ARRAY_NORMAL + OLD_ARRAY_COMPRESS_BASE), - OLD_ARRAY_COMPRESS_TANGENT = 1 << (OLD_ARRAY_TANGENT + OLD_ARRAY_COMPRESS_BASE), - OLD_ARRAY_COMPRESS_COLOR = 1 << (OLD_ARRAY_COLOR + OLD_ARRAY_COMPRESS_BASE), - OLD_ARRAY_COMPRESS_TEX_UV = 1 << (OLD_ARRAY_TEX_UV + OLD_ARRAY_COMPRESS_BASE), - OLD_ARRAY_COMPRESS_TEX_UV2 = 1 << (OLD_ARRAY_TEX_UV2 + OLD_ARRAY_COMPRESS_BASE), - OLD_ARRAY_COMPRESS_BONES = 1 << (OLD_ARRAY_BONES + OLD_ARRAY_COMPRESS_BASE), - OLD_ARRAY_COMPRESS_WEIGHTS = 1 << (OLD_ARRAY_WEIGHTS + OLD_ARRAY_COMPRESS_BASE), - OLD_ARRAY_COMPRESS_INDEX = 1 << (OLD_ARRAY_INDEX + OLD_ARRAY_COMPRESS_BASE), + OLD_ARRAY_COMPRESS_VERTEX = 1 << (OLD_ARRAY_VERTEX + (int32_t)OLD_ARRAY_COMPRESS_BASE), // mandatory + OLD_ARRAY_COMPRESS_NORMAL = 1 << (OLD_ARRAY_NORMAL + (int32_t)OLD_ARRAY_COMPRESS_BASE), + OLD_ARRAY_COMPRESS_TANGENT = 1 << (OLD_ARRAY_TANGENT + (int32_t)OLD_ARRAY_COMPRESS_BASE), + OLD_ARRAY_COMPRESS_COLOR = 1 << (OLD_ARRAY_COLOR + (int32_t)OLD_ARRAY_COMPRESS_BASE), + OLD_ARRAY_COMPRESS_TEX_UV = 1 << (OLD_ARRAY_TEX_UV + (int32_t)OLD_ARRAY_COMPRESS_BASE), + OLD_ARRAY_COMPRESS_TEX_UV2 = 1 << (OLD_ARRAY_TEX_UV2 + (int32_t)OLD_ARRAY_COMPRESS_BASE), + OLD_ARRAY_COMPRESS_BONES = 1 << (OLD_ARRAY_BONES + (int32_t)OLD_ARRAY_COMPRESS_BASE), + OLD_ARRAY_COMPRESS_WEIGHTS = 1 << (OLD_ARRAY_WEIGHTS + (int32_t)OLD_ARRAY_COMPRESS_BASE), + OLD_ARRAY_COMPRESS_INDEX = 1 << (OLD_ARRAY_INDEX + (int32_t)OLD_ARRAY_COMPRESS_BASE), OLD_ARRAY_FLAG_USE_2D_VERTICES = OLD_ARRAY_COMPRESS_INDEX << 1, OLD_ARRAY_FLAG_USE_16_BIT_BONES = OLD_ARRAY_COMPRESS_INDEX << 2, diff --git a/servers/audio/effects/audio_effect_chorus.h b/servers/audio/effects/audio_effect_chorus.h index e0da4c1e30..61305ea4af 100644 --- a/servers/audio/effects/audio_effect_chorus.h +++ b/servers/audio/effects/audio_effect_chorus.h @@ -58,16 +58,14 @@ class AudioEffectChorus : public AudioEffect { friend class AudioEffectChorusInstance; public: - enum { - MAX_DELAY_MS = 50, - MAX_DEPTH_MS = 20, - MAX_WIDTH_MS = 50, - MAX_VOICES = 4, - CYCLES_FRAC = 16, - CYCLES_MASK = (1 << CYCLES_FRAC) - 1, - MAX_CHANNELS = 4, - MS_CUTOFF_MAX = 16000 - }; + static constexpr int32_t MAX_DELAY_MS = 50; + static constexpr int32_t MAX_DEPTH_MS = 20; + static constexpr int32_t MAX_WIDTH_MS = 50; + static constexpr int32_t MAX_VOICES = 4; + static constexpr int32_t CYCLES_FRAC = 16; + static constexpr int32_t CYCLES_MASK = (1 << CYCLES_FRAC) - 1; + static constexpr int32_t MAX_CHANNELS = 4; + static constexpr int32_t MS_CUTOFF_MAX = 16000; private: struct Voice {