summaryrefslogtreecommitdiffstats
path: root/matchblox/engine/C_MatchBloxEngine.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'matchblox/engine/C_MatchBloxEngine.cpp')
-rw-r--r--matchblox/engine/C_MatchBloxEngine.cpp49
1 files changed, 38 insertions, 11 deletions
diff --git a/matchblox/engine/C_MatchBloxEngine.cpp b/matchblox/engine/C_MatchBloxEngine.cpp
index a78e649..6984239 100644
--- a/matchblox/engine/C_MatchBloxEngine.cpp
+++ b/matchblox/engine/C_MatchBloxEngine.cpp
@@ -16,6 +16,7 @@
#include "bitmap.h"
#include "message_queue.h"
#include "message_input.h"
+#include "menu_msg.h"
#include "wiimote_utils.h"
#include "C_Smoother.h"
#include "C_MatchBloxEngine.h"
@@ -87,23 +88,49 @@ GameResult C_MatchBloxEngine::ProcessMsgs(void)
{
switch(message->sender)
{
+ case MESSAGE_MENU:
+ int l_iAction;
+ int l_iGameMode;
+ menu_payload *l_pMsg1;
+ l_pMsg1 = (menu_payload*)message->payload;
+
+ l_iAction = l_pMsg1->action;
+
+ switch (l_iAction)
+ {
+ case ACTION_PAUSE:
+ Pause();
+ break;
+ case ACTION_START:
+ l_iGameMode = l_pMsg1->gamemode;
+ StartGame();
+ break;
+ case ACTION_RESUME:
+ Resume();
+ break;
+ case ACTION_ABORT:
+ Abort();
+ break;
+ }
+ break;
case MESSAGE_INPUT_KEYBOARD:
break;
case MESSAGE_INPUT_MOUSE:
break;
case MESSAGE_INPUT_WIIMOTE:
- input_payload_wiimote *l_pMsg;
- l_pMsg = (input_payload_wiimote*)message->payload;
+ input_payload_wiimote *l_pMsg2;
+ l_pMsg2 = (input_payload_wiimote*)message->payload;
+
switch (m_State)
{
case ES_GET_READY:
- if (l_pMsg->btns & WIIMOTE_BUTTON_A &&
- l_pMsg->btns & WIIMOTE_BUTTON_B &&
- l_pMsg->posDataValid)
+ if (l_pMsg2->btns & WIIMOTE_BUTTON_A &&
+ l_pMsg2->btns & WIIMOTE_BUTTON_B &&
+ l_pMsg2->posDataValid)
{
//the 3d mouse position data is valid and A+B are pressed
//init the z depth and start the game
- m_dInitialWiimoteDist = l_pMsg->Zdist;
+ m_dInitialWiimoteDist = l_pMsg2->Zdist;
if (!StartGame())
{
l_Result = GR_ERROR;
@@ -112,7 +139,7 @@ GameResult C_MatchBloxEngine::ProcessMsgs(void)
break;
case ES_FINISHED:
- if (l_pMsg->btns & WIIMOTE_BUTTON_ALL)
+ if (l_pMsg2->btns & WIIMOTE_BUTTON_ALL)
{
//any button is pressed
//delete session and return GAME_FINISHED
@@ -127,16 +154,16 @@ GameResult C_MatchBloxEngine::ProcessMsgs(void)
break;
default:
- if (l_pMsg->posDataValid)
+ if (l_pMsg2->posDataValid)
{
m_uiLastPosValid = m_uiCurrentTime;
Vect3D_t l_WorldPos;
- if (l_pMsg->btns & WIIMOTE_BUTTON_A)
+ if (l_pMsg2->btns & WIIMOTE_BUTTON_A)
{
int i = 0; //debug break
}
- if (ConvertWiimoteToWorld(l_pMsg, &l_WorldPos))
+ if (ConvertWiimoteToWorld(l_pMsg2, &l_WorldPos))
{
CursorMove(l_WorldPos);
}
@@ -740,4 +767,4 @@ void C_MatchBloxEngine::GameFinished()
//save session results to database
-} \ No newline at end of file
+}