mirror of
https://github.com/Relintai/pandemonium_engine.git
synced 2025-01-09 12:29:35 +01:00
Ported: TileMap: Use const ref for all Vector2 parameters - akien-mga
2834332591
This commit is contained in:
parent
9071569b3b
commit
a9df89703c
@ -207,7 +207,7 @@ Ref<RTileSet> RTileMap::get_tileset() const {
|
|||||||
return tile_set;
|
return tile_set;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RTileMap::set_cell_size(Size2 p_size) {
|
void RTileMap::set_cell_size(const Size2 &p_size) {
|
||||||
ERR_FAIL_COND(p_size.x < 1 || p_size.y < 1);
|
ERR_FAIL_COND(p_size.x < 1 || p_size.y < 1);
|
||||||
|
|
||||||
_clear_quadrants();
|
_clear_quadrants();
|
||||||
@ -885,7 +885,7 @@ void RTileMap::_set_celld(const Vector2 &p_pos, const Dictionary &p_data) {
|
|||||||
call("set_cell", args, 7, ce);
|
call("set_cell", args, 7, ce);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RTileMap::set_cell(int p_x, int p_y, int p_tile, bool p_flip_x, bool p_flip_y, bool p_transpose, Vector2 p_autotile_coord) {
|
void RTileMap::set_cell(int p_x, int p_y, int p_tile, bool p_flip_x, bool p_flip_y, bool p_transpose, const Vector2 &p_autotile_coord) {
|
||||||
PosKey pk(p_x, p_y);
|
PosKey pk(p_x, p_y);
|
||||||
|
|
||||||
Map<PosKey, Cell>::Element *E = tile_map.find(pk);
|
Map<PosKey, Cell>::Element *E = tile_map.find(pk);
|
||||||
|
@ -259,7 +259,7 @@ public:
|
|||||||
void set_tileset(const Ref<RTileSet> &p_tileset);
|
void set_tileset(const Ref<RTileSet> &p_tileset);
|
||||||
Ref<RTileSet> get_tileset() const;
|
Ref<RTileSet> get_tileset() const;
|
||||||
|
|
||||||
void set_cell_size(Size2 p_size);
|
void set_cell_size(const Size2 &p_size);
|
||||||
Size2 get_cell_size() const;
|
Size2 get_cell_size() const;
|
||||||
|
|
||||||
void set_quadrant_size(int p_size);
|
void set_quadrant_size(int p_size);
|
||||||
@ -268,7 +268,7 @@ public:
|
|||||||
void set_use_rao(bool p_rao);
|
void set_use_rao(bool p_rao);
|
||||||
bool get_use_rao() const;
|
bool get_use_rao() const;
|
||||||
|
|
||||||
void set_cell(int p_x, int p_y, int p_tile, bool p_flip_x = false, bool p_flip_y = false, bool p_transpose = false, Vector2 p_autotile_coord = Vector2());
|
void set_cell(int p_x, int p_y, int p_tile, bool p_flip_x = false, bool p_flip_y = false, bool p_transpose = false, const Vector2 &p_autotile_coord = Vector2());
|
||||||
int get_cell(int p_x, int p_y) const;
|
int get_cell(int p_x, int p_y) const;
|
||||||
bool is_cell_x_flipped(int p_x, int p_y) const;
|
bool is_cell_x_flipped(int p_x, int p_y) const;
|
||||||
bool is_cell_y_flipped(int p_x, int p_y) const;
|
bool is_cell_y_flipped(int p_x, int p_y) const;
|
||||||
|
@ -469,7 +469,7 @@ RTileSet::TileMode RTileSet::tile_get_tile_mode(int p_id) const {
|
|||||||
return tile_map[p_id].tile_mode;
|
return tile_map[p_id].tile_mode;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RTileSet::autotile_set_icon_coordinate(int p_id, Vector2 coord) {
|
void RTileSet::autotile_set_icon_coordinate(int p_id, const Vector2 &coord) {
|
||||||
ERR_FAIL_COND_MSG(!tile_map.has(p_id), vformat("The RTileSet doesn't have a tile with ID '%d'.", p_id));
|
ERR_FAIL_COND_MSG(!tile_map.has(p_id), vformat("The RTileSet doesn't have a tile with ID '%d'.", p_id));
|
||||||
tile_map[p_id].autotile_data.icon_coord = coord;
|
tile_map[p_id].autotile_data.icon_coord = coord;
|
||||||
emit_changed();
|
emit_changed();
|
||||||
@ -492,7 +492,7 @@ int RTileSet::autotile_get_spacing(int p_id) const {
|
|||||||
return tile_map[p_id].autotile_data.spacing;
|
return tile_map[p_id].autotile_data.spacing;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RTileSet::autotile_set_size(int p_id, Size2 p_size) {
|
void RTileSet::autotile_set_size(int p_id, const Size2 &p_size) {
|
||||||
ERR_FAIL_COND_MSG(!tile_map.has(p_id), vformat("The RTileSet doesn't have a tile with ID '%d'.", p_id));
|
ERR_FAIL_COND_MSG(!tile_map.has(p_id), vformat("The RTileSet doesn't have a tile with ID '%d'.", p_id));
|
||||||
ERR_FAIL_COND(p_size.x <= 0 || p_size.y <= 0);
|
ERR_FAIL_COND(p_size.x <= 0 || p_size.y <= 0);
|
||||||
tile_map[p_id].autotile_data.size = p_size;
|
tile_map[p_id].autotile_data.size = p_size;
|
||||||
@ -550,7 +550,7 @@ const Map<Vector2, int> &RTileSet::autotile_get_z_index_map(int p_id) const {
|
|||||||
return tile_map[p_id].autotile_data.z_index_map;
|
return tile_map[p_id].autotile_data.z_index_map;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RTileSet::autotile_set_bitmask(int p_id, Vector2 p_coord, uint32_t p_flag) {
|
void RTileSet::autotile_set_bitmask(int p_id, const Vector2 &p_coord, uint32_t p_flag) {
|
||||||
ERR_FAIL_COND_MSG(!tile_map.has(p_id), vformat("The RTileSet doesn't have a tile with ID '%d'.", p_id));
|
ERR_FAIL_COND_MSG(!tile_map.has(p_id), vformat("The RTileSet doesn't have a tile with ID '%d'.", p_id));
|
||||||
if (p_flag == 0) {
|
if (p_flag == 0) {
|
||||||
if (tile_map[p_id].autotile_data.flags.has(p_coord)) {
|
if (tile_map[p_id].autotile_data.flags.has(p_coord)) {
|
||||||
@ -561,7 +561,7 @@ void RTileSet::autotile_set_bitmask(int p_id, Vector2 p_coord, uint32_t p_flag)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t RTileSet::autotile_get_bitmask(int p_id, Vector2 p_coord) {
|
uint32_t RTileSet::autotile_get_bitmask(int p_id, const Vector2 &p_coord) {
|
||||||
ERR_FAIL_COND_V_MSG(!tile_map.has(p_id), 0, vformat("The RTileSet doesn't have a tile with ID '%d'.", p_id));
|
ERR_FAIL_COND_V_MSG(!tile_map.has(p_id), 0, vformat("The RTileSet doesn't have a tile with ID '%d'.", p_id));
|
||||||
if (!tile_map[p_id].autotile_data.flags.has(p_coord)) {
|
if (!tile_map[p_id].autotile_data.flags.has(p_coord)) {
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -174,13 +174,13 @@ public:
|
|||||||
void tile_set_tile_mode(int p_id, TileMode p_tile_mode);
|
void tile_set_tile_mode(int p_id, TileMode p_tile_mode);
|
||||||
TileMode tile_get_tile_mode(int p_id) const;
|
TileMode tile_get_tile_mode(int p_id) const;
|
||||||
|
|
||||||
void autotile_set_icon_coordinate(int p_id, Vector2 coord);
|
void autotile_set_icon_coordinate(int p_id, const Vector2 &coord);
|
||||||
Vector2 autotile_get_icon_coordinate(int p_id) const;
|
Vector2 autotile_get_icon_coordinate(int p_id) const;
|
||||||
|
|
||||||
void autotile_set_spacing(int p_id, int p_spacing);
|
void autotile_set_spacing(int p_id, int p_spacing);
|
||||||
int autotile_get_spacing(int p_id) const;
|
int autotile_get_spacing(int p_id) const;
|
||||||
|
|
||||||
void autotile_set_size(int p_id, Size2 p_size);
|
void autotile_set_size(int p_id, const Size2 &p_size);
|
||||||
Size2 autotile_get_size(int p_id) const;
|
Size2 autotile_get_size(int p_id) const;
|
||||||
|
|
||||||
void autotile_clear_bitmask_map(int p_id);
|
void autotile_clear_bitmask_map(int p_id);
|
||||||
@ -192,8 +192,8 @@ public:
|
|||||||
int autotile_get_z_index(int p_id, const Vector2 &p_coord);
|
int autotile_get_z_index(int p_id, const Vector2 &p_coord);
|
||||||
const Map<Vector2, int> &autotile_get_z_index_map(int p_id) const;
|
const Map<Vector2, int> &autotile_get_z_index_map(int p_id) const;
|
||||||
|
|
||||||
void autotile_set_bitmask(int p_id, Vector2 p_coord, uint32_t p_flag);
|
void autotile_set_bitmask(int p_id, const Vector2 &p_coord, uint32_t p_flag);
|
||||||
uint32_t autotile_get_bitmask(int p_id, Vector2 p_coord);
|
uint32_t autotile_get_bitmask(int p_id, const Vector2 &p_coord);
|
||||||
const Map<Vector2, uint32_t> &autotile_get_bitmask_map(int p_id);
|
const Map<Vector2, uint32_t> &autotile_get_bitmask_map(int p_id);
|
||||||
Vector2 autotile_get_subtile_for_bitmask(int p_id, uint16_t p_bitmask, const Node *p_tilemap_node = nullptr, const Vector2 &p_tile_location = Vector2());
|
Vector2 autotile_get_subtile_for_bitmask(int p_id, uint16_t p_bitmask, const Node *p_tilemap_node = nullptr, const Vector2 &p_tile_location = Vector2());
|
||||||
Vector2 atlastile_get_subtile_by_priority(int p_id, const Node *p_tilemap_node = nullptr, const Vector2 &p_tile_location = Vector2());
|
Vector2 atlastile_get_subtile_by_priority(int p_id, const Node *p_tilemap_node = nullptr, const Vector2 &p_tile_location = Vector2());
|
||||||
|
Loading…
Reference in New Issue
Block a user