Skip to content

armgit / godot

Public Imported from GitHub
0

Godot Engine – Multi-platform 2D and 3D game engine

Fix first tile not being randomized

kobewiea2cc82451e6
diff --git a/editor/scene/2d/tiles/tile_map_layer_editor.cpp b/editor/scene/2d/tiles/tile_map_layer_editor.cpp
index ca776224e14..9cf29c22181 100644
--- a/editor/scene/2d/tiles/tile_map_layer_editor.cpp
+++ b/editor/scene/2d/tiles/tile_map_layer_editor.cpp
@@ -657,8 +657,8 @@ bool TileMapLayerEditorTilesPlugin::forward_canvas_gui_input(const Ref<InputEven
Vector2 mpos = xform.affine_inverse().xform(mm->get_position());
if (edited_layer->local_to_map(drag_last_mouse_pos) != edited_layer->local_to_map(mpos)) {
- pattern_rng.seed(Math::rand());
- rng_base_state = Math::rand();
+ pattern_rng.randomize();
+ rng_base_state = pattern_rng.get_state();
}
switch (drag_type) {
diff --git a/editor/scene/2d/tiles/tile_map_layer_editor.h b/editor/scene/2d/tiles/tile_map_layer_editor.h
index 081816f7aa0..f3bb4825b73 100644
--- a/editor/scene/2d/tiles/tile_map_layer_editor.h
+++ b/editor/scene/2d/tiles/tile_map_layer_editor.h
@@ -183,7 +183,7 @@ private:
RBSet<TileMapCell> tile_set_selection;
RandomPCG pattern_rng;
- uint32_t rng_base_state = 0;
+ uint64_t rng_base_state = 0;
void _update_selection_pattern_from_tilemap_selection();
void _update_selection_pattern_from_tileset_tiles_selection();