diff options
author | madmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2013-03-26 22:06:12 +0100 |
---|---|---|
committer | madmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2013-03-26 22:06:12 +0100 |
commit | 8dc54301a4f0c1d92d9775c3f97901acbf0230f6 (patch) | |
tree | c5c5fa436e823f7f49644b35f22249f46ecda5b9 /source/Blocks/BlockTorch.h | |
parent | cBlockArea: Fixed type / meta copypasta errors in mirroring and rotation code (diff) | |
download | cuberite-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 'source/Blocks/BlockTorch.h')
-rw-r--r-- | source/Blocks/BlockTorch.h | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/source/Blocks/BlockTorch.h b/source/Blocks/BlockTorch.h index 3cc487421..97e31533b 100644 --- a/source/Blocks/BlockTorch.h +++ b/source/Blocks/BlockTorch.h @@ -132,6 +132,67 @@ public: {
return "step.wood";
}
+
+
+ virtual NIBBLETYPE MetaRotateCCW(NIBBLETYPE a_Meta) override
+ {
+ // Bit 4 stays, the rest is swapped around according to a table:
+ NIBBLETYPE TopBits = (a_Meta & 0x08);
+ switch (a_Meta & 0x07)
+ {
+ case 0x01: return TopBits | 0x04; // East -> North
+ case 0x02: return TopBits | 0x03; // West -> South
+ case 0x03: return TopBits | 0x01; // South -> East
+ case 0x04: return TopBits | 0x02; // North -> West
+ default: return a_Meta; // Floor -> Floor
+ }
+ }
+
+
+ virtual NIBBLETYPE MetaRotateCW(NIBBLETYPE a_Meta) override
+ {
+ // Bit 4 stays, the rest is swapped around according to a table:
+ NIBBLETYPE TopBits = (a_Meta & 0x08);
+ switch (a_Meta & 0x07)
+ {
+ case 0x01: return TopBits | 0x03; // East -> South
+ case 0x02: return TopBits | 0x04; // West -> North
+ case 0x03: return TopBits | 0x02; // South -> West
+ case 0x04: return TopBits | 0x01; // North -> East
+ default: return a_Meta; // Floor -> Floor
+ }
+ }
+
+
+ virtual NIBBLETYPE MetaMirrorXY(NIBBLETYPE a_Meta) override
+ {
+ // Bit 4 stays, the rest is swapped around according to a table:
+ NIBBLETYPE TopBits = (a_Meta & 0x08);
+ switch (a_Meta & 0x07)
+ {
+ case 0x03: return TopBits | 0x04; // South -> North
+ case 0x04: return TopBits | 0x03; // North -> South
+ default: return a_Meta; // Keep the rest
+ }
+ }
+
+
+ // Mirroring around the XZ plane doesn't make sense for floor torches,
+ // the others stay the same, so let's keep all the metas the same.
+ // The base class does tht for us, no need to override MetaMirrorXZ()
+
+
+ virtual NIBBLETYPE MetaMirrorYZ(NIBBLETYPE a_Meta) override
+ {
+ // Bit 4 stays, the rest is swapped around according to a table:
+ NIBBLETYPE TopBits = (a_Meta & 0x08);
+ switch (a_Meta & 0x07)
+ {
+ case 0x01: return TopBits | 0x02; // East -> West
+ case 0x02: return TopBits | 0x01; // West -> East
+ default: return a_Meta; // Keep the rest
+ }
+ }
} ;
|