diff options
author | Dennis Peeten <dpeeten@onsneteindhoven.nl> | 2008-05-24 09:59:48 (GMT) |
---|---|---|
committer | Dennis Peeten <dpeeten@onsneteindhoven.nl> | 2008-05-24 09:59:48 (GMT) |
commit | f11312d1d84e102bb29a44dedce4c60a5ae25e56 (patch) | |
tree | ae9928f07d7a3fdafcf341d91ca57c17236ad80b /MatchBloxEngine/MatchBloxEngine/C_MatchBloxEngine.cpp | |
parent | fbe326b9f9fc8f6d0e3034a81c2d8efcb2859ce2 (diff) | |
download | 2iv55-f11312d1d84e102bb29a44dedce4c60a5ae25e56.zip 2iv55-f11312d1d84e102bb29a44dedce4c60a5ae25e56.tar.gz 2iv55-f11312d1d84e102bb29a44dedce4c60a5ae25e56.tar.bz2 |
Diffstat (limited to 'MatchBloxEngine/MatchBloxEngine/C_MatchBloxEngine.cpp')
-rw-r--r-- | MatchBloxEngine/MatchBloxEngine/C_MatchBloxEngine.cpp | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/MatchBloxEngine/MatchBloxEngine/C_MatchBloxEngine.cpp b/MatchBloxEngine/MatchBloxEngine/C_MatchBloxEngine.cpp index 80767b8..dafa6a5 100644 --- a/MatchBloxEngine/MatchBloxEngine/C_MatchBloxEngine.cpp +++ b/MatchBloxEngine/MatchBloxEngine/C_MatchBloxEngine.cpp @@ -376,7 +376,7 @@ void C_MatchBloxEngine::LoadTexture(const char* f_BmpName, GLuint &f_uiTexHandle glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
}
-void C_MatchBloxEngine::CursorMove(Vect3D_t f_NewCursorPos)
+void C_MatchBloxEngine::CursorMove(Vect3D_t &f_NewCursorPos)
{
//check the state to see what 3d object currently has to be considered to
//be the cursor currently is and which bounding box we need to check for overlap
@@ -436,13 +436,14 @@ void C_MatchBloxEngine::CursorMove(Vect3D_t f_NewCursorPos) }
-GameResult_t C_MatchBloxEngine::CursorMove_PutBlock(Vect3D_t &f_CursPos, BoundingBox_t &f_CusrBBox)
+bool C_MatchBloxEngine::CursorMove_PutBlock(Vect3D_t &f_CursPos, BoundingBox_t &f_CursBBox)
{
//check if the block is being put in the right hole
//by testing whether the position of the cursor is close
//enough to the center of the correct hole
//note that the hole positions are relative to the position
//of the box
+ bool l_bCollision = false;
Vect3D_t l_AbsHolePos = m_pBox[m_CurrentBox]->GetPos() +
m_pTiles[m_CurrentBlock]->GetPos();
Vect3D_t l_PosDif = l_AbsHolePos - f_CursPos;
@@ -456,27 +457,31 @@ GameResult_t C_MatchBloxEngine::CursorMove_PutBlock(Vect3D_t &f_CursPos, Boundin //?? would it not be better to check for bounding box intersection with hole?
l_bCollision = !(m_pTiles[m_CurrentBlock]->GetAbsBoundBox() +
- m_pBox[m_CurrentBox]->GetPos())->Overlap(f_CursBBox);
+ m_pBox[m_CurrentBox]->GetPos()).Overlap(f_CursBBox);
//now check if the block is far enough in the hole to count as a point
if (l_PosDif.z > m_GameSettings.m_dHoleDepth)
{
//yipee!! we have got a winner!!
- m_CurrentBlock = m_pGameSession->NewTurn();
+ m_CurrentBlock = m_pCurrentSession->NewTurn();
- m_GameState
+ //m_GameState
}
+
}
+
+ return false;
}
-GameResult_t C_MatchBloxEngine::CursorMove_GrabBlock(Vect3D_t &f_CursPos, BoundingBox_t &f_CusrBBox)
+bool C_MatchBloxEngine::CursorMove_GrabBlock(Vect3D_t &f_CursPos, BoundingBox_t &f_CursBBox)
{
//grabbing a block: just check for bounding box intersection
- if (m_pBlock[(int)m_CurrentBlock)->GetAbsBoundBox().Overlap(f_CursBBox))
+ if (m_pBlock[(int)m_CurrentBlock]->GetAbsBoundBox().Overlap(f_CursBBox))
{
}
+ return true;
}
|