summaryrefslogtreecommitdiff
path: root/common/piece.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'common/piece.cpp')
-rw-r--r--common/piece.cpp26
1 files changed, 24 insertions, 2 deletions
diff --git a/common/piece.cpp b/common/piece.cpp
index 2b304b0..df8f3b4 100644
--- a/common/piece.cpp
+++ b/common/piece.cpp
@@ -89,7 +89,6 @@ Piece::Piece(PieceInfo* pPieceInfo)
if (m_pPieceInfo != NULL)
{
- m_nBoxList = m_pPieceInfo->AddRef();
if (m_pPieceInfo->m_nConnectionCount > 0)
{
m_pConnections = (CONNECTION*)malloc(sizeof(CONNECTION)*(m_pPieceInfo->m_nConnectionCount));
@@ -132,7 +131,6 @@ Piece::~Piece()
void Piece::SetPieceInfo(PieceInfo* pPieceInfo)
{
m_pPieceInfo = pPieceInfo;
- m_nBoxList = m_pPieceInfo->AddRef();
if (m_pPieceInfo->m_nConnectionCount > 0)
{
@@ -1130,6 +1128,30 @@ void Piece::BuildDrawInfo()
}
}
+void Piece::RenderBox(bool bHilite, float fLineWidth)
+{
+ glPushMatrix();
+ glTranslatef(m_fPosition[0], m_fPosition[1], m_fPosition[2]);
+ glRotatef(m_fRotation[3], m_fRotation[0], m_fRotation[1], m_fRotation[2]);
+
+ if (bHilite && ((m_nState & LC_PIECE_SELECTED) != 0))
+ {
+ glColor3ubv(FlatColorArray[m_nState & LC_PIECE_FOCUSED ? LC_COL_FOCUSED : LC_COL_SELECTED]);
+ glLineWidth(2*fLineWidth);
+ glPushAttrib(GL_POLYGON_BIT);
+ glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
+ glCallList(m_pPieceInfo->GetBoxDisplayList());
+ glPopAttrib();
+ glLineWidth(fLineWidth);
+ }
+ else
+ {
+ glColor3ubv(FlatColorArray[m_nColor]);
+ glCallList(m_pPieceInfo->GetBoxDisplayList());
+ }
+ glPopMatrix();
+}
+
void Piece::Render(bool bLighting, bool bEdges, unsigned char* nLastColor, bool* bTrans)
{
glPushMatrix();