diff options
| author | daoge <3523206925@qq.com> | 2026-03-03 03:04:10 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-03-03 03:04:10 +0800 |
| commit | b3feddfef372618c8a9d7a0abcaf18cfad866c18 (patch) | |
| tree | 267761c3bb39241ba5c347bfbe2254d06686e287 /Minecraft.World/Pos.cpp | |
| parent | 84c31a2331f7a0ec85b9d438992e244f60e5020f (diff) | |
feat: TU19 (Dec 2014) Features & Content (#155)
* try to resolve merge conflict
* feat: TU19 (Dec 2014) Features & Content (#32)
* December 2014 files
* Working release build
* Fix compilation issues
* Add sound to Windows64Media
* Add DLC content and force Tutorial DLC
* Revert "Add DLC content and force Tutorial DLC"
This reverts commit 97a43994725008e35fceb984d5549df9c8cea470.
* Disable broken light packing
* Disable breakpoint during DLC texture map load
Allows DLC loading but the DLC textures are still broken
* Fix post build not working
* ...
* fix vs2022 build
* fix cmake build
---------
Co-authored-by: Loki <lokirautio@gmail.com>
Diffstat (limited to 'Minecraft.World/Pos.cpp')
| -rw-r--r-- | Minecraft.World/Pos.cpp | 67 |
1 files changed, 36 insertions, 31 deletions
diff --git a/Minecraft.World/Pos.cpp b/Minecraft.World/Pos.cpp index 3fad76e8..e673ecc3 100644 --- a/Minecraft.World/Pos.cpp +++ b/Minecraft.World/Pos.cpp @@ -18,9 +18,9 @@ Pos::Pos(int x, int y, int z) Pos::Pos(Pos *position) { - this->x = position->x; - this->y = position->y; - this->z = position->z; + x = position->x; + y = position->y; + z = position->z; } //@Override @@ -71,9 +71,9 @@ void Pos::set(int x, int y, int z) void Pos::set(Pos *pos) { - this->x = pos->x; - this->y = pos->y; - this->z = pos->z; + x = pos->x; + y = pos->y; + z = pos->z; } Pos *Pos::above() @@ -145,93 +145,93 @@ void Pos::move(int x, int y, int z) void Pos::move(Pos pos) { - this->x += pos.x; - this->y += pos.y; - this->z += pos.z; + x += pos.x; + y += pos.y; + z += pos.z; } void Pos::moveX(int steps) { - this->x += steps; + x += steps; } void Pos::moveY(int steps) { - this->y += steps; + y += steps; } void Pos::moveZ(int steps) { - this->z += steps; + z += steps; } void Pos::moveUp(int steps) { - this->y += steps; + y += steps; } void Pos::moveUp() { - this->y++; + y++; } void Pos::moveDown(int steps) { - this->y -= steps; + y -= steps; } void Pos::moveDown() { - this->y--; + y--; } void Pos::moveEast(int steps) { - this->x += steps; + x += steps; } void Pos::moveEast() { - this->x++; + x++; } void Pos::moveWest(int steps) { - this->x -= steps; + x -= steps; } void Pos::moveWest() { - this->x--; + x--; } void Pos::moveNorth(int steps) { - this->z -= steps; + z -= steps; } void Pos::moveNorth() { - this->z--; + z--; } void Pos::moveSouth(int steps) { - this->z += steps; + z += steps; } void Pos::moveSouth() { - this->z++; + z++; } double Pos::dist(int x, int y, int z) { - int dx = this->x - x; - int dy = this->y - y; - int dz = this->z - z; + double dx = this->x - x; + double dy = this->y - y; + double dz = this->z - z; - return sqrt( (double) dx * dx + dy * dy + dz * dz); + return sqrt( dx * dx + dy * dy + dz * dz); } double Pos::dist(Pos *pos) @@ -241,8 +241,13 @@ double Pos::dist(Pos *pos) float Pos::distSqr(int x, int y, int z) { - int dx = this->x - x; - int dy = this->y - y; - int dz = this->z - z; + float dx = this->x - x; + float dy = this->y - y; + float dz = this->z - z; return dx * dx + dy * dy + dz * dz; +} + +float Pos::distSqr(Pos *pos) +{ + return distSqr(pos->x, pos->y, pos->z); }
\ No newline at end of file |
