summaryrefslogtreecommitdiffstats
path: root/source/Blocks/BlockStairs.h
diff options
context:
space:
mode:
authormadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2013-03-26 22:06:12 +0100
committermadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2013-03-26 22:06:12 +0100
commit8dc54301a4f0c1d92d9775c3f97901acbf0230f6 (patch)
treec5c5fa436e823f7f49644b35f22249f46ecda5b9 /source/Blocks/BlockStairs.h
parentcBlockArea: Fixed type / meta copypasta errors in mirroring and rotation code (diff)
downloadcuberite-8dc54301a4f0c1d92d9775c3f97901acbf0230f6.tar
cuberite-8dc54301a4f0c1d92d9775c3f97901acbf0230f6.tar.gz
cuberite-8dc54301a4f0c1d92d9775c3f97901acbf0230f6.tar.bz2
cuberite-8dc54301a4f0c1d92d9775c3f97901acbf0230f6.tar.lz
cuberite-8dc54301a4f0c1d92d9775c3f97901acbf0230f6.tar.xz
cuberite-8dc54301a4f0c1d92d9775c3f97901acbf0230f6.tar.zst
cuberite-8dc54301a4f0c1d92d9775c3f97901acbf0230f6.zip
Diffstat (limited to '')
-rw-r--r--source/Blocks/BlockStairs.h71
1 files changed, 71 insertions, 0 deletions
diff --git a/source/Blocks/BlockStairs.h b/source/Blocks/BlockStairs.h
index 6fcbc2cba..9f135b37d 100644
--- a/source/Blocks/BlockStairs.h
+++ b/source/Blocks/BlockStairs.h
@@ -49,6 +49,77 @@ public:
}
// TODO: step sound
+
+
+ virtual NIBBLETYPE MetaRotateCCW(NIBBLETYPE a_Meta) override
+ {
+ // Bits 3 and 4 stay, the rest is swapped around according to a table:
+ NIBBLETYPE TopBits = (a_Meta & 0x0c);
+ switch (a_Meta & 0x03)
+ {
+ case 0x00: return TopBits | 0x03; // East -> North
+ case 0x01: return TopBits | 0x02; // West -> South
+ case 0x02: return TopBits | 0x00; // South -> East
+ case 0x03: return TopBits | 0x01; // North -> West
+ }
+ // Not reachable, but to avoid a compiler warning:
+ return 0;
+ }
+
+
+ virtual NIBBLETYPE MetaRotateCW(NIBBLETYPE a_Meta) override
+ {
+ // Bits 3 and 4 stay, the rest is swapped around according to a table:
+ NIBBLETYPE TopBits = (a_Meta & 0x0c);
+ switch (a_Meta & 0x03)
+ {
+ case 0x00: return TopBits | 0x02; // East -> South
+ case 0x01: return TopBits | 0x03; // West -> North
+ case 0x02: return TopBits | 0x01; // South -> West
+ case 0x03: return TopBits | 0x00; // North -> East
+ }
+ // Not reachable, but to avoid a compiler warning:
+ return 0;
+ }
+
+
+ virtual NIBBLETYPE MetaMirrorXY(NIBBLETYPE a_Meta) override
+ {
+ // Bits 3 and 4 stay, the rest is swapped around according to a table:
+ NIBBLETYPE TopBits = (a_Meta & 0x0c);
+ switch (a_Meta & 0x03)
+ {
+ case 0x00: return TopBits | 0x00; // East -> East
+ case 0x01: return TopBits | 0x01; // West -> West
+ case 0x02: return TopBits | 0x03; // South -> North
+ case 0x03: return TopBits | 0x02; // North -> South
+ }
+ // Not reachable, but to avoid a compiler warning:
+ return 0;
+ }
+
+
+ virtual NIBBLETYPE MetaMirrorXZ(NIBBLETYPE a_Meta) override
+ {
+ // Toggle bit 3:
+ return (a_Meta & 0x0b) | ((~a_Meta) & 0x04);
+ }
+
+
+ virtual NIBBLETYPE MetaMirrorYZ(NIBBLETYPE a_Meta) override
+ {
+ // Bits 3 and 4 stay, the rest is swapped around according to a table:
+ NIBBLETYPE TopBits = (a_Meta & 0x0c);
+ switch (a_Meta & 0x03)
+ {
+ case 0x00: return TopBits | 0x01; // East -> West
+ case 0x01: return TopBits | 0x00; // West -> East
+ case 0x02: return TopBits | 0x02; // South -> South
+ case 0x03: return TopBits | 0x03; // North -> North
+ }
+ // Not reachable, but to avoid a compiler warning:
+ return 0;
+ }
} ;