summaryrefslogtreecommitdiffstats
path: root/src/Blocks/BlockDoor.cpp
diff options
context:
space:
mode:
authornarroo <narroo@vt.edu>2014-03-24 03:11:01 +0100
committernarroo <narroo@vt.edu>2014-03-24 03:11:01 +0100
commit2343b0dfbe12f6db76de1b4ed03cd902975d77b3 (patch)
treed4e7ae6bf16ec620f6b9dda016a3918fee33f431 /src/Blocks/BlockDoor.cpp
parentFixed missing comment terminator. (diff)
downloadcuberite-2343b0dfbe12f6db76de1b4ed03cd902975d77b3.tar
cuberite-2343b0dfbe12f6db76de1b4ed03cd902975d77b3.tar.gz
cuberite-2343b0dfbe12f6db76de1b4ed03cd902975d77b3.tar.bz2
cuberite-2343b0dfbe12f6db76de1b4ed03cd902975d77b3.tar.lz
cuberite-2343b0dfbe12f6db76de1b4ed03cd902975d77b3.tar.xz
cuberite-2343b0dfbe12f6db76de1b4ed03cd902975d77b3.tar.zst
cuberite-2343b0dfbe12f6db76de1b4ed03cd902975d77b3.zip
Diffstat (limited to 'src/Blocks/BlockDoor.cpp')
-rw-r--r--src/Blocks/BlockDoor.cpp75
1 files changed, 75 insertions, 0 deletions
diff --git a/src/Blocks/BlockDoor.cpp b/src/Blocks/BlockDoor.cpp
index 4e38ef334..c027daed2 100644
--- a/src/Blocks/BlockDoor.cpp
+++ b/src/Blocks/BlockDoor.cpp
@@ -110,3 +110,78 @@ const char * cBlockDoorHandler::GetStepSound(void)
+
+NIBBLETYPE cBlockDoorHandler::MetaRotateCCW(NIBBLETYPE a_Meta)
+{
+ if (a_Meta & 0x08)
+ {
+ return a_Meta;
+ }
+ else
+ {
+ return super::MetaRotateCCW(a_Meta);
+ }
+}
+
+
+
+NIBBLETYPE cBlockDoorHandler::MetaRotateCW(NIBBLETYPE a_Meta)
+{
+ if (a_Meta & 0x08)
+ {
+ return a_Meta;
+ }
+ else
+ {
+ return super::MetaRotateCW(a_Meta);
+ }
+}
+
+
+
+NIBBLETYPE cBlockDoorHandler::MetaMirrorXY(NIBBLETYPE a_Meta)
+{
+ // Top bit (0x08) contains door panel type (Top/Bottom panel) Only Bottom panels contain position data
+ // Return a_Meta if panel is a top panel (0x08 bit is set to 1)
+ LOG("Test MirrorXY");
+ if (a_Meta & 0x08) return a_Meta;
+
+ // Holds open/closed meta data. 0x0C == 1100.
+ NIBBLETYPE OtherMeta = a_Meta & 0x0C;
+
+ // Mirrors according to a table. 0x03 == 0011.
+ switch (a_Meta & 0x03)
+ {
+ case 0x03: return 0x01 + OtherMeta; // South -> North
+ case 0x01: return 0x03 + OtherMeta; // North -> South
+ }
+
+ // Not Facing North or South; No change.
+ return a_Meta;
+}
+
+
+
+NIBBLETYPE cBlockDoorHandler::MetaMirrorYZ(NIBBLETYPE a_Meta)
+{
+ // Top bit (0x08) contains door panel type (Top/Bottom panel) Only Bottom panels contain position data
+ // Return a_Meta if panel is a top panel (0x08 bit is set to 1)
+ LOG("Test MirrorYZ");
+ if (a_Meta & 0x08) return a_Meta;
+
+ // Holds open/closed meta data. 0x0C == 1100.
+ NIBBLETYPE OtherMeta = a_Meta & 0x0C;
+
+ // Mirrors according to a table. 0x03 == 0011.
+ switch (a_Meta & 0x03)
+ {
+ case 0x00: return 0x02 + OtherMeta; // West -> East
+ case 0x02: return 0x00 + OtherMeta; // East -> West
+ }
+
+ // Not Facing North or South; No change.
+ return a_Meta;
+}
+
+
+