diff options
| author | daoge_cmd <3523206925@qq.com> | 2026-03-01 12:16:08 +0800 |
|---|---|---|
| committer | daoge_cmd <3523206925@qq.com> | 2026-03-01 12:16:08 +0800 |
| commit | b691c43c44ff180d10e7d4a9afc83b98551ff586 (patch) | |
| tree | 3e9849222cbc6ba49f2f1fc6e5fe7179632c7390 /Minecraft.World/Direction.cpp | |
| parent | def8cb415354ac390b7e89052a50605285f1aca9 (diff) | |
Initial commit
Diffstat (limited to 'Minecraft.World/Direction.cpp')
| -rw-r--r-- | Minecraft.World/Direction.cpp | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/Minecraft.World/Direction.cpp b/Minecraft.World/Direction.cpp new file mode 100644 index 00000000..408bbab5 --- /dev/null +++ b/Minecraft.World/Direction.cpp @@ -0,0 +1,62 @@ +#include "stdafx.h" +#include "Direction.h" +#include "Facing.h" + +const int Direction::STEP_X[] = +{ + 0, -1, 0, 1 +}; + +const int Direction::STEP_Z[] = +{ + 1, 0, -1, 0 +}; + +// for [direction] it gives [tile-face] +int Direction::DIRECTION_FACING[4] = +{ + Facing::SOUTH, Facing::WEST, Facing::NORTH, Facing::EAST +}; + +// for [facing] it gives [direction] +int Direction::FACING_DIRECTION[] = +{ + UNDEFINED, UNDEFINED, NORTH, SOUTH, WEST, EAST +}; + +int Direction::DIRECTION_OPPOSITE[4] = +{ + Direction::NORTH, Direction::EAST, Direction::SOUTH, Direction::WEST +}; + +// for [direction] it gives [90 degrees clockwise direction] +int Direction::DIRECTION_CLOCKWISE[] = +{ + Direction::WEST, Direction::NORTH, Direction::EAST, Direction::SOUTH +}; + +// for [direction] it gives [90 degrees counter clockwise direction] +int Direction::DIRECTION_COUNTER_CLOCKWISE[] = +{ + Direction::EAST, Direction::SOUTH, Direction::WEST, Direction::NORTH +}; + +int Direction::RELATIVE_DIRECTION_FACING[4][6] = +{ + // south + { + Facing::UP, Facing::DOWN, Facing::SOUTH, Facing::NORTH, Facing::EAST, Facing::WEST + }, + // west + { + Facing::UP, Facing::DOWN, Facing::EAST, Facing::WEST, Facing::NORTH, Facing::SOUTH + }, + // north + { + Facing::UP, Facing::DOWN, Facing::NORTH, Facing::SOUTH, Facing::WEST, Facing::EAST + }, + // east + { + Facing::UP, Facing::DOWN, Facing::WEST, Facing::EAST, Facing::SOUTH, Facing::NORTH + } +}; |
