45 lines
1.0 KiB
C++
45 lines
1.0 KiB
C++
#pragma once
|
|
|
|
#include "Tile_SPU.h"
|
|
#include "Facing_SPU.h"
|
|
|
|
class RotatedPillarTile_SPU : public Tile_SPU
|
|
{
|
|
public:
|
|
static const int MASK_TYPE = 0x3;
|
|
static const int MASK_FACING = 0xC;
|
|
static const int FACING_Y = 0 << 2;
|
|
static const int FACING_X = 1 << 2;
|
|
static const int FACING_Z = 2 << 2;
|
|
|
|
protected:
|
|
RotatedPillarTile_SPU(int id) : Tile_SPU(id) {}
|
|
|
|
public:
|
|
virtual int getRenderShape() { return Tile_SPU::SHAPE_TREE; };
|
|
|
|
virtual Icon_SPU *getTexture(int face, int data) {
|
|
int dir = data & MASK_FACING;
|
|
int type = data & MASK_TYPE;
|
|
|
|
if (dir == FACING_Y && (face == Facing::UP || face == Facing::DOWN))
|
|
{
|
|
return getTopTexture(type);
|
|
}
|
|
else if (dir == FACING_X && (face == Facing::EAST || face == Facing::WEST))
|
|
{
|
|
return getTopTexture(type);
|
|
}
|
|
else if (dir == FACING_Z && (face == Facing::NORTH || face == Facing::SOUTH))
|
|
{
|
|
return getTopTexture(type);
|
|
}
|
|
|
|
return getTypeTexture(type);
|
|
};
|
|
|
|
protected:
|
|
virtual Icon_SPU *getTypeTexture(int type) = 0;
|
|
|
|
virtual Icon_SPU *getTopTexture(int type) = 0;
|
|
}; |