BlockArea: Finished rotation and mirroring with meta. Implemented example meta handling for vines, stairs and torches.
git-svn-id: http://mc-server.googlecode.com/svn/trunk@1319 0a769ca7-a7f5-676a-18bf-c427514a06d6
This commit is contained in:
@@ -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;
|
||||
}
|
||||
} ;
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user