mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2025-09-11 06:45:59 +00:00
ru:: intxy
This commit is contained in:
@@ -78,6 +78,12 @@ struct bbox {
|
||||
|
||||
bool intersect(bbox a, bbox b);
|
||||
|
||||
struct intxy {
|
||||
int x, y;
|
||||
intxy() {}
|
||||
intxy(int x, int y) : x(x), y(y) {}
|
||||
};
|
||||
|
||||
struct room {
|
||||
// texture::texture_data *room_texture;
|
||||
string roomname;
|
||||
@@ -95,6 +101,8 @@ struct room {
|
||||
eWall at(int x, int y) {
|
||||
return eWall(block_at[y][x] >> 3);
|
||||
}
|
||||
|
||||
eWall at(intxy xy) { return at(xy.x, xy.y); }
|
||||
|
||||
void clear() {
|
||||
for(int y=0; y<room_y; y++) for(int x=0; x<room_x; x++) block_at[y][x] = 0;
|
||||
@@ -146,6 +154,8 @@ struct room {
|
||||
add_revert(fountain_revert, [this, x, y, orig] { replace_block(x, y, orig); });
|
||||
}
|
||||
|
||||
void replace_block_frev(intxy xy, eWall w) { replace_block_frev(xy.x, xy.y, w); }
|
||||
|
||||
void generate();
|
||||
|
||||
void reveal(int cx, int cy);
|
||||
|
@@ -26,6 +26,9 @@ hyperpoint to_hyper(ld x, ld y) {
|
||||
|
||||
hyperpoint to_hyper(xy xy) { return to_hyper(xy.x, xy.y); }
|
||||
|
||||
hyperpoint block_to_hyper(intxy xy) { return to_hyper((xy.x+.5) * block_x, (xy.y+.5) * block_y); }
|
||||
|
||||
intxy xy_to_block(xy xy) { return intxy{ int(floor(xy.x / block_x)), int(floor(xy.y / block_y)) }; }
|
||||
|
||||
xy from_hyper(hyperpoint h) {
|
||||
if(non_hyperbolic) return {h[0], h[1]};
|
||||
|
Reference in New Issue
Block a user