aboutsummaryrefslogtreecommitdiff
path: root/engines/tony/mpal/mpal.cpp
diff options
context:
space:
mode:
authorPaul Gilbert2012-05-08 08:25:33 +1000
committerPaul Gilbert2012-05-08 08:25:33 +1000
commit8527302057052e784c3ea32ca8eebb0220bf15e6 (patch)
tree6de91ecaacd51a1182bd44f21c94edfac4daa4b1 /engines/tony/mpal/mpal.cpp
parent0b8974ec4ab37ef056ac50c098d3fe8045ec172b (diff)
downloadscummvm-rg350-8527302057052e784c3ea32ca8eebb0220bf15e6.tar.gz
scummvm-rg350-8527302057052e784c3ea32ca8eebb0220bf15e6.tar.bz2
scummvm-rg350-8527302057052e784c3ea32ca8eebb0220bf15e6.zip
TONY: Added support for threading events to scheduler, converted more procs to coroutines
Diffstat (limited to 'engines/tony/mpal/mpal.cpp')
-rw-r--r--engines/tony/mpal/mpal.cpp27
1 files changed, 14 insertions, 13 deletions
diff --git a/engines/tony/mpal/mpal.cpp b/engines/tony/mpal/mpal.cpp
index 592c4788df..c5ded67c81 100644
--- a/engines/tony/mpal/mpal.cpp
+++ b/engines/tony/mpal/mpal.cpp
@@ -141,8 +141,8 @@ uint32 nPollingLocations[MAXPOLLINGLOCATIONS];
HANDLE hEndPollingLocations[MAXPOLLINGLOCATIONS];
uint32 PollingThreads[MAXPOLLINGLOCATIONS];
-HANDLE hAskChoice;
-HANDLE hDoneChoice;
+uint32 hAskChoice;
+uint32 hDoneChoice;
uint32 nExecutingAction;
@@ -1349,7 +1349,7 @@ void ShutUpDialogThread(CORO_PARAM, const void *param) {
nExecutingDialog = 0;
nExecutingChoice = 0;
- SetEvent(hAskChoice);
+ _vm->_scheduler.setEvent(hAskChoice);
CORO_KILL_SELF();
@@ -1501,9 +1501,9 @@ void DoChoice(CORO_PARAM, uint32 nChoice) {
/* Avvertiamo il gioco che c'e' una scelta da far fare all'utente,
e restiamo in attesa della risposta */
- ResetEvent(hDoneChoice);
- SetEvent(hAskChoice);
- WaitForSingleObject(hDoneChoice, INFINITE);
+ _vm->_scheduler.resetEvent(hDoneChoice);
+ _vm->_scheduler.setEvent(hAskChoice);
+ CORO_INVOKE_2(_vm->_scheduler.waitForSingleObject, hDoneChoice, INFINITE);
/* Ora che la scelta e' stata effettuata, possiamo eseguire _ctx->i gruppi
associati con la scelta */
@@ -1644,8 +1644,8 @@ static uint32 DoDialog(uint32 nDlgOrd, uint32 nGroup) {
// Enables the flag to indicate that there is' a running dialogue
bExecutingDialog = true;
- ResetEvent(hAskChoice);
- ResetEvent(hDoneChoice);
+ _vm->_scheduler.resetEvent(hAskChoice);
+ _vm->_scheduler.resetEvent(hDoneChoice);
// Create a thread that performs the dialogue group
@@ -1690,7 +1690,7 @@ bool DoSelection(uint32 i, uint32 dwData) {
return false;
nSelectedChoice = j;
- SetEvent(hDoneChoice);
+ _vm->_scheduler.setEvent(hDoneChoice);
return true;
}
@@ -1867,8 +1867,8 @@ bool mpalInit(const char *lpszMpcFileName, const char *lpszMprFileName,
/* Crea l'evento che verra' utilizzato per avvertire il gioco che c'e'
da effettuare una scelta */
- hAskChoice = CreateEvent(NULL, true, false, NULL);
- hDoneChoice = CreateEvent(NULL, true, false, NULL);
+ hAskChoice = _vm->_scheduler.createEvent(true, false);
+ hDoneChoice = _vm->_scheduler.createEvent(true, false);
return true;
}
@@ -2031,8 +2031,9 @@ void mpalQueryInner(CORO_PARAM, uint16 wQueryType, uint32 *dwRet, va_list v) {
/*
* void mpalQuery(MPQ_DIALOG_WAITFORCHOICE);
*/
- WaitForSingleObject(hAskChoice, INFINITE);
- ResetEvent(hAskChoice);
+ CORO_INVOKE_2(_vm->_scheduler.waitForSingleObject, hAskChoice, INFINITE);
+
+ _vm->_scheduler.resetEvent(hAskChoice);
if (bExecutingDialog)
*dwRet = (uint32)nExecutingChoice;