aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/tony/custom.cpp2
-rw-r--r--engines/tony/custom.h3
-rw-r--r--engines/tony/game.cpp2
-rw-r--r--engines/tony/game.h2
-rw-r--r--engines/tony/gfxengine.cpp2
-rw-r--r--engines/tony/globals.h34
-rw-r--r--engines/tony/mpal/expr.cpp128
-rw-r--r--engines/tony/mpal/expr.h8
-rw-r--r--engines/tony/mpal/loadmpc.cpp6
-rw-r--r--engines/tony/mpal/lzo.cpp32
-rw-r--r--engines/tony/mpal/memory.cpp16
-rw-r--r--engines/tony/mpal/memory.h17
-rw-r--r--engines/tony/mpal/mpal.cpp62
-rw-r--r--engines/tony/mpal/mpal.h24
-rw-r--r--engines/tony/mpal/mpaldll.h26
-rw-r--r--engines/tony/mpal/mpalutils.h2
-rw-r--r--engines/tony/utils.cpp4
-rw-r--r--engines/tony/utils.h2
18 files changed, 182 insertions, 190 deletions
diff --git a/engines/tony/custom.cpp b/engines/tony/custom.cpp
index 9aef809826..4171691e87 100644
--- a/engines/tony/custom.cpp
+++ b/engines/tony/custom.cpp
@@ -1749,7 +1749,7 @@ int g_curDialog;
DECLARE_CUSTOM_FUNCTION(SendDialogMessage)(CORO_PARAM, uint32 nPers, uint32 nMsg, uint32, uint32) {
CORO_BEGIN_CONTEXT;
- LPSTR string;
+ char *string;
RMTextDialog *text;
int parm;
uint32 h;
diff --git a/engines/tony/custom.h b/engines/tony/custom.h
index 9e18ae2090..524ab14aab 100644
--- a/engines/tony/custom.h
+++ b/engines/tony/custom.h
@@ -36,10 +36,7 @@ namespace Tony {
using namespace MPAL;
-typedef uint32 HWND;
-
#define INIT_CUSTOM_FUNCTION MapCustomFunctions
-#define INIT_CUSTOM_FUNCTION_STRING "MapCustomFunctions"
#define DECLARE_CUSTOM_FUNCTION(x) void x
diff --git a/engines/tony/game.cpp b/engines/tony/game.cpp
index 224427d10f..3031dabf3c 100644
--- a/engines/tony/game.cpp
+++ b/engines/tony/game.cpp
@@ -1039,7 +1039,7 @@ void RMOptionScreen::doFrame(CORO_PARAM, RMInput *input) {
}
#define KEYPRESS(c) (g_vm->getEngine()->getInput().getAsyncKeyState(c))
-#define PROCESS_CHAR(cod,c) if (KEYPRESS(cod)) { \
+#define PROCESS_CHAR(cod, c) if (KEYPRESS(cod)) { \
_editName[strlen(_editName) + 1] = '\0'; _editName[strlen(_editName)] = c; _ctx->bRefresh = true; }
// State Buttons
diff --git a/engines/tony/game.h b/engines/tony/game.h
index 9c58f28714..626ec73afb 100644
--- a/engines/tony/game.h
+++ b/engines/tony/game.h
@@ -42,7 +42,7 @@ namespace Tony {
assert(raw->isValid()); \
assert((buf16) == NULL); \
(buf16) = new RMGfxSourceBuffer16(false); \
- (buf16)->init(*raw,raw->width(),raw->height()); \
+ (buf16)->init(*raw, raw->width(), raw->height()); \
delete raw;
#define INIT_GFX8_FROMRAW(raw, dwRes, buf8) \
diff --git a/engines/tony/gfxengine.cpp b/engines/tony/gfxengine.cpp
index da8218fa99..6f976ef37c 100644
--- a/engines/tony/gfxengine.cpp
+++ b/engines/tony/gfxengine.cpp
@@ -424,7 +424,7 @@ uint32 RMGfxEngine::loadLocation(int nLoc, RMPoint ptTonyStart, RMPoint start) {
_bLocationLoaded = true;
// On entering the location
- return CORO_INVALID_PID_VALUE; //mpalQueryDoAction(0,m_nCurLoc,0);
+ return CORO_INVALID_PID_VALUE; //mpalQueryDoAction(0, m_nCurLoc, 0);
}
void RMGfxEngine::unloadLocation(CORO_PARAM, bool bDoOnExit, uint32 *result) {
diff --git a/engines/tony/globals.h b/engines/tony/globals.h
index 6966bd7264..eda99eeee2 100644
--- a/engines/tony/globals.h
+++ b/engines/tony/globals.h
@@ -150,9 +150,9 @@ typedef struct {
int _nCf;
int _arg1, _arg2, _arg3, _arg4;
-} CFCALL;
-typedef CFCALL *LPCFCALL;
-typedef LPCFCALL *LPLPCFCALL;
+} CfCall;
+typedef CfCall *LpCfCall;
+typedef LpCfCall *LPLPCFCALL;
struct CoroutineMutex {
@@ -176,20 +176,20 @@ public:
Common::String _nextMusic;
bool _nextLoop;
- int _nextChannel;
- int _nextSync;
- int _curChannel;
- int _flipflop;
+ int _nextChannel;
+ int _nextSync;
+ int _curChannel;
+ int _flipflop;
CharacterStruct _character[16];
MCharacterStruct _mCharacter[10];
ChangedHotspotStruct _changedHotspot[256];
bool _isMChar[16];
bool _bAlwaysDisplay;
RMPoint _saveTonyPos;
- int _saveTonyLoc;
+ int _saveTonyLoc;
RMTextDialog *_curBackText;
bool _bTonyIsSpeaking;
- int _curChangedHotspot;
+ int _curChangedHotspot;
bool _bCfgInvLocked;
bool _bCfgInvNoScroll;
bool _bCfgTimerizedText;
@@ -210,8 +210,8 @@ public:
bool _bSkipSfxNoLoop;
bool _bIdleExited;
bool _bNoBullsEye;
- int _curDialog;
- int _curSoundEffect;
+ int _curDialog;
+ int _curSoundEffect;
bool _bFadeOutStop;
RMTony *_tony;
@@ -251,22 +251,22 @@ public:
Common::String *_lplpFunctionStrings;
uint16 _nObjs;
uint16 _nVars;
- HGLOBAL _hVars;
+ MpalHandle _hVars;
LpMpalVar _lpmvVars;
uint16 _nMsgs;
- HGLOBAL _hMsgs;
+ MpalHandle _hMsgs;
LpMpalMsg _lpmmMsgs;
uint16 _nDialogs;
- HGLOBAL _hDialogs;
+ MpalHandle _hDialogs;
LpMpalDialog _lpmdDialogs;
uint16 _nItems;
- HGLOBAL _hItems;
+ MpalHandle _hItems;
LpMpalItem _lpmiItems;
uint16 _nLocations;
- HGLOBAL _hLocations;
+ MpalHandle _hLocations;
LpMpalLocation _lpmlLocations;
uint16 _nScripts;
- HGLOBAL _hScripts;
+ MpalHandle _hScripts;
LpMpalScript _lpmsScripts;
Common::File _hMpr;
uint16 _nResources;
diff --git a/engines/tony/mpal/expr.cpp b/engines/tony/mpal/expr.cpp
index 31abeb0810..7923d263c0 100644
--- a/engines/tony/mpal/expr.cpp
+++ b/engines/tony/mpal/expr.cpp
@@ -81,20 +81,20 @@ enum ExprListTypes {
* Mathamatical framework to manage operations
*/
typedef struct {
- byte type; // Tipo di oggetto (vedi enum ExprListTypes)
- byte unary; // Unary operatore (NON SUPPORTATO)
+ byte _type; // Tipo di oggetto (vedi enum ExprListTypes)
+ byte _unary; // Unary operatore (NON SUPPORTATO)
union {
- int num; // Numero (se type==ELT_NUMBER)
- char *name; // Nome variabile (se type==ELT_VAR)
- HGLOBAL son; // Handle a espressione (type==ELT_PARENTH)
- byte *pson; // Handle lockato (type==ELT_PARENTH2)
- } val;
+ int _num; // Numero (se type==ELT_NUMBER)
+ char *_name; // Nome variabile (se type==ELT_VAR)
+ MpalHandle _son; // Handle a espressione (type==ELT_PARENTH)
+ byte *_pson; // Handle lockato (type==ELT_PARENTH2)
+ } _val;
- byte symbol; // Simbolo matematico (vedi #define OP_*)
+ byte _symbol; // Simbolo matematico (vedi #define OP_*)
-} EXPRESSION;
-typedef EXPRESSION *LPEXPRESSION;
+} Expression;
+typedef Expression *LpExpression;
//@}
@@ -104,24 +104,24 @@ typedef EXPRESSION *LPEXPRESSION;
* @param h Handle to the original expression
* @retruns Pointer to the cloned expression
*/
-static byte *duplicateExpression(HGLOBAL h) {
+static byte *duplicateExpression(MpalHandle h) {
byte *orig, *clone;
- LPEXPRESSION one, two;
+ LpExpression one, two;
orig = (byte *)globalLock(h);
int num = *(byte *)orig;
- one = (LPEXPRESSION)(orig+1);
+ one = (LpExpression)(orig+1);
- clone = (byte *)globalAlloc(GMEM_FIXED, sizeof(EXPRESSION) * num + 1);
- two = (LPEXPRESSION)(clone + 1);
+ clone = (byte *)globalAlloc(GMEM_FIXED, sizeof(Expression) * num + 1);
+ two = (LpExpression)(clone + 1);
- memcpy(clone, orig, sizeof(EXPRESSION) * num + 1);
+ memcpy(clone, orig, sizeof(Expression) * num + 1);
for (int i = 0; i < num; i++) {
- if (one->type == ELT_PARENTH) {
- two->type = ELT_PARENTH2;
- two->val.pson = duplicateExpression(two->val.son);
+ if (one->_type == ELT_PARENTH) {
+ two->_type = ELT_PARENTH2;
+ two->_val._pson = duplicateExpression(two->_val._son);
}
++one;
@@ -178,27 +178,27 @@ static int Compute(int a, int b, byte symbol) {
return 0;
}
-static void solve(LPEXPRESSION one, int num) {
- LPEXPRESSION two, three;
+static void solve(LpExpression one, int num) {
+ LpExpression two, three;
int j;
while (num > 1) {
two = one + 1;
- if ((two->symbol == 0) || (one->symbol & 0xF0) <= (two->symbol & 0xF0)) {
- two->val.num = Compute(one->val.num, two->val.num, one->symbol);
- memmove(one, two, (num - 1) * sizeof(EXPRESSION));
+ if ((two->_symbol == 0) || (one->_symbol & 0xF0) <= (two->_symbol & 0xF0)) {
+ two->_val._num = Compute(one->_val._num, two->_val._num, one->_symbol);
+ memmove(one, two, (num - 1) * sizeof(Expression));
--num;
} else {
j = 1;
three = two + 1;
- while ((three->symbol != 0) && (two->symbol & 0xF0) > (three->symbol & 0xF0)) {
+ while ((three->_symbol != 0) && (two->_symbol & 0xF0) > (three->_symbol & 0xF0)) {
++two;
++three;
++j;
}
- three->val.num = Compute(two->val.num, three->val.num, two->symbol);
- memmove(two, three, (num - j - 1) * sizeof(EXPRESSION));
+ three->_val._num = Compute(two->_val._num, three->_val._num, two->_symbol);
+ memmove(two, three, (num - j - 1) * sizeof(Expression));
--num;
}
}
@@ -213,32 +213,32 @@ static void solve(LPEXPRESSION one, int num) {
* @returns Value
*/
static int evaluateAndFreeExpression(byte *expr) {
- LPEXPRESSION one, cur;
+ LpExpression one, cur;
int num = *expr;
- one = (LPEXPRESSION)(expr + 1);
+ one = (LpExpression)(expr + 1);
// 1) Substitutions of variables
cur = one;
for (int i = 0; i < num; i++, cur++) {
- if (cur->type == ELT_VAR) {
- cur->type = ELT_NUMBER;
- cur->val.num = varGetValue(cur->val.name);
+ if (cur->_type == ELT_VAR) {
+ cur->_type = ELT_NUMBER;
+ cur->_val._num = varGetValue(cur->_val._name);
}
}
// 2) Replacement of brackets (using recursive calls)
cur = one;
for (int i = 0; i < num; i++, cur++) {
- if (cur->type == ELT_PARENTH2) {
- cur->type = ELT_NUMBER;
- cur->val.num = evaluateAndFreeExpression(cur->val.pson);
+ if (cur->_type == ELT_PARENTH2) {
+ cur->_type = ELT_NUMBER;
+ cur->_val._num = evaluateAndFreeExpression(cur->_val._pson);
}
}
// 3) algebraic resolution
solve(one, num);
- int val = one->val.num;
+ int val = one->_val._num;
globalDestroy(expr);
return val;
@@ -253,8 +253,8 @@ static int evaluateAndFreeExpression(byte *expr) {
* will point to the area of memory containing the parsed expression
* @returns Pointer to the buffer immediately after the expression, or NULL if error.
*/
-const byte *parseExpression(const byte *lpBuf, HGLOBAL *h) {
- LPEXPRESSION cur;
+const byte *parseExpression(const byte *lpBuf, MpalHandle *h) {
+ LpExpression cur;
byte *start;
uint32 num = *lpBuf;
@@ -263,35 +263,35 @@ const byte *parseExpression(const byte *lpBuf, HGLOBAL *h) {
if (num == 0)
return NULL;
- *h = globalAllocate(GMEM_MOVEABLE | GMEM_ZEROINIT, num * sizeof(EXPRESSION) + 1);
+ *h = globalAllocate(GMEM_MOVEABLE | GMEM_ZEROINIT, num * sizeof(Expression) + 1);
if (*h == NULL)
return NULL;
start = (byte *)globalLock(*h);
*start = (byte)num;
- cur = (LPEXPRESSION)(start + 1);
+ cur = (LpExpression)(start + 1);
for (uint32 i = 0;i < num; i++) {
- cur->type = *(lpBuf);
- cur->unary = *(lpBuf + 1);
+ cur->_type = *(lpBuf);
+ cur->_unary = *(lpBuf + 1);
lpBuf += 2;
- switch (cur->type) {
+ switch (cur->_type) {
case ELT_NUMBER:
- cur->val.num = (int32)READ_LE_UINT32(lpBuf);
+ cur->_val._num = (int32)READ_LE_UINT32(lpBuf);
lpBuf += 4;
break;
case ELT_VAR:
- cur->val.name = (char *)globalAlloc(GMEM_FIXED | GMEM_ZEROINIT, (*lpBuf) + 1);
- if (cur->val.name == NULL)
+ cur->_val._name = (char *)globalAlloc(GMEM_FIXED | GMEM_ZEROINIT, (*lpBuf) + 1);
+ if (cur->_val._name == NULL)
return NULL;
- memcpy(cur->val.name, lpBuf + 1, *lpBuf);
+ memcpy(cur->_val._name, lpBuf + 1, *lpBuf);
lpBuf += *lpBuf + 1;
break;
case ELT_PARENTH:
- lpBuf = parseExpression(lpBuf, &cur->val.son);
+ lpBuf = parseExpression(lpBuf, &cur->_val._son);
if (lpBuf == NULL)
return NULL;
break;
@@ -300,7 +300,7 @@ const byte *parseExpression(const byte *lpBuf, HGLOBAL *h) {
return NULL;
}
- cur->symbol = *lpBuf;
+ cur->_symbol = *lpBuf;
lpBuf++;
cur++;
@@ -321,7 +321,7 @@ const byte *parseExpression(const byte *lpBuf, HGLOBAL *h) {
* @param h Handle to the expression
* @returns Numeric value
*/
-int evaluateExpression(HGLOBAL h) {
+int evaluateExpression(MpalHandle h) {
int ret;
lockVar();
@@ -337,9 +337,9 @@ int evaluateExpression(HGLOBAL h) {
* @param h1 Expression to be compared
* @param h2 Expression to be compared
*/
-bool compareExpressions(HGLOBAL h1, HGLOBAL h2) {
+bool compareExpressions(MpalHandle h1, MpalHandle h2) {
byte *e1, *e2;
- LPEXPRESSION one, two;
+ LpExpression one, two;
e1 = (byte *)globalLock(h1);
e2 = (byte *)globalLock(h2);
@@ -353,19 +353,19 @@ bool compareExpressions(HGLOBAL h1, HGLOBAL h2) {
return false;
}
- one = (LPEXPRESSION)(e1 + 1);
- two = (LPEXPRESSION)(e2 + 1);
+ one = (LpExpression)(e1 + 1);
+ two = (LpExpression)(e2 + 1);
for (int i = 0; i < num1; i++) {
- if (one->type != two->type || (i != num1 - 1 && one->symbol != two->symbol)) {
+ if (one->_type != two->_type || (i != num1 - 1 && one->_symbol != two->_symbol)) {
globalUnlock(h1);
globalUnlock(h2);
return false;
}
- switch (one->type) {
+ switch (one->_type) {
case ELT_NUMBER:
- if (one->val.num != two->val.num) {
+ if (one->_val._num != two->_val._num) {
globalUnlock(h1);
globalUnlock(h2);
return false;
@@ -373,7 +373,7 @@ bool compareExpressions(HGLOBAL h1, HGLOBAL h2) {
break;
case ELT_VAR:
- if (strcmp(one->val.name, two->val.name) != 0) {
+ if (strcmp(one->_val._name, two->_val._name) != 0) {
globalUnlock(h1);
globalUnlock(h2);
return false;
@@ -381,7 +381,7 @@ bool compareExpressions(HGLOBAL h1, HGLOBAL h2) {
break;
case ELT_PARENTH:
- if (!compareExpressions(one->val.son, two->val.son)) {
+ if (!compareExpressions(one->_val._son, two->_val._son)) {
globalUnlock(h1);
globalUnlock(h2);
return false;
@@ -404,19 +404,19 @@ bool compareExpressions(HGLOBAL h1, HGLOBAL h2) {
*
* @param h Handle for the expression
*/
-void freeExpression(HGLOBAL h) {
+void freeExpression(MpalHandle h) {
byte *data = (byte *)globalLock(h);
int num = *data;
- LPEXPRESSION cur = (LPEXPRESSION)(data + 1);
+ LpExpression cur = (LpExpression)(data + 1);
for (int i = 0; i < num; ++i, ++cur) {
- switch (cur->type) {
+ switch (cur->_type) {
case ELT_VAR:
- globalDestroy(cur->val.name);
+ globalDestroy(cur->_val._name);
break;
case ELT_PARENTH:
- freeExpression(cur->val.son);
+ freeExpression(cur->_val._son);
break;
default:
diff --git a/engines/tony/mpal/expr.h b/engines/tony/mpal/expr.h
index f9c8a7c48f..9036099993 100644
--- a/engines/tony/mpal/expr.h
+++ b/engines/tony/mpal/expr.h
@@ -47,7 +47,7 @@ namespace MPAL {
* will point to the area of memory containing the parsed expression
* @returns Pointer to the buffer immediately after the expression, or NULL if error.
*/
-const byte *parseExpression(const byte *lpBuf, HGLOBAL *h);
+const byte *parseExpression(const byte *lpBuf, MpalHandle *h);
/**
* Calculate the value of a mathamatical expression
@@ -55,7 +55,7 @@ const byte *parseExpression(const byte *lpBuf, HGLOBAL *h);
* @param h Handle to the expression
* @returns Numeric value
*/
-int evaluateExpression(HGLOBAL h);
+int evaluateExpression(MpalHandle h);
/**
* Compare two mathematical expressions together
@@ -63,14 +63,14 @@ int evaluateExpression(HGLOBAL h);
* @param h1 Expression to be compared
* @param h2 Expression to be compared
*/
-bool compareExpressions(HGLOBAL h1, HGLOBAL h2);
+bool compareExpressions(MpalHandle h1, MpalHandle h2);
/**
* Frees an expression that was previously parsed
*
* @param h Handle for the expression
*/
-void freeExpression(HGLOBAL h);
+void freeExpression(MpalHandle h);
} // end of namespace MPAL
diff --git a/engines/tony/mpal/loadmpc.cpp b/engines/tony/mpal/loadmpc.cpp
index b3c4193414..953820be74 100644
--- a/engines/tony/mpal/loadmpc.cpp
+++ b/engines/tony/mpal/loadmpc.cpp
@@ -253,14 +253,14 @@ static const byte *parseDialog(const byte *lpBuf, LpMpalDialog lpmdDialog) {
}
if (curCmd >= MAX_COMMANDS_PER_DIALOG)
- error("Too much commands in dialog #%d",lpmdDialog->_nObj);
+ error("Too much commands in dialog #%d", lpmdDialog->_nObj);
// Choices
num = READ_LE_UINT16(lpBuf);
lpBuf += 2;
if (num >= MAX_CHOICES_PER_DIALOG)
- error("Too much choices in dialog #%d",lpmdDialog->_nObj);
+ error("Too much choices in dialog #%d", lpmdDialog->_nObj);
for (i = 0; i < num; i++) {
lpmdDialog->_choice[i]._nChoice = READ_LE_UINT16(lpBuf);
@@ -380,7 +380,7 @@ static const byte *parseItem(const byte *lpBuf, LpMpalItem lpmiItem) {
lpBuf++;
if (lpmiItem->_action[i]._nCmds >= MAX_COMMANDS_PER_ACTION)
- error("Too much commands in action #%d in item #%d",lpmiItem->_action[i]._num, lpmiItem->_nObj);
+ error("Too much commands in action #%d in item #%d", lpmiItem->_action[i]._num, lpmiItem->_nObj);
for (uint32 j = 0; j < lpmiItem->_action[i]._nCmds; j++) {
lpmiItem->_command[curCmd]._type = *lpBuf;
diff --git a/engines/tony/mpal/lzo.cpp b/engines/tony/mpal/lzo.cpp
index 48a0d8ea87..3d0751a5ca 100644
--- a/engines/tony/mpal/lzo.cpp
+++ b/engines/tony/mpal/lzo.cpp
@@ -69,10 +69,10 @@ namespace Tony {
namespace MPAL {
-#define pd(a,b) ((uint32) ((a)-(b)))
+#define pd(a, b) ((uint32) ((a) - (b)))
#define TEST_IP (ip < ip_end)
-#define TEST_OP 1
+#define TEST_OP 1
#define NEED_IP(x) ((void) 0)
#define NEED_OP(x) ((void) 0)
#define TEST_LB(m_pos) ((void) 0)
@@ -83,7 +83,7 @@ namespace MPAL {
/**
* Decompresses an LZO compressed resource
*/
-int lzo1x_decompress(const byte *in , uint32 in_len, byte *out, uint32 *out_len) {
+int lzo1x_decompress(const byte *in, uint32 in_len, byte *out, uint32 *out_len) {
register byte *op;
register const byte *ip;
register uint32 t = 0;
@@ -155,12 +155,12 @@ int lzo1x_decompress(const byte *in , uint32 in_len, byte *out, uint32 *out_len)
t += 3;
if (t >= 8) do
{
- UA_COPY64(op,ip);
+ UA_COPY64(op, ip);
op += 8; ip += 8; t -= 8;
} while (t >= 8);
if (t >= 4)
{
- UA_COPY32(op,ip);
+ UA_COPY32(op, ip);
op += 4; ip += 4; t -= 4;
}
if (t > 0)
@@ -170,17 +170,17 @@ int lzo1x_decompress(const byte *in , uint32 in_len, byte *out, uint32 *out_len)
}
#elif defined(LZO_UNALIGNED_OK_4) || defined(LZO_ALIGNED_OK_4)
#if !defined(LZO_UNALIGNED_OK_4)
- if (PTR_ALIGNED2_4(op,ip))
+ if (PTR_ALIGNED2_4(op, ip))
{
#endif
- UA_COPY32(op,ip);
+ UA_COPY32(op, ip);
op += 4; ip += 4;
if (--t > 0)
{
if (t >= 4)
{
do {
- UA_COPY32(op,ip);
+ UA_COPY32(op, ip);
op += 4; ip += 4; t -= 4;
} while (t >= 4);
if (t > 0) do *op++ = *ip++; while (--t > 0);
@@ -213,7 +213,7 @@ first_literal_run:
m_off = (1 + M2_MAX_OFFSET) + (t >> 2) + (*ip++ << 2);
#endif
NEED_OP(3);
- t = 3; COPY_DICT(t,m_off)
+ t = 3; COPY_DICT(t, m_off)
#else
#if defined(LZO1Z)
t = (1 + M2_MAX_OFFSET) + (t << 6) + (*ip++ >> 2);
@@ -382,7 +382,7 @@ match:
m_off = 1 + (t >> 2) + (*ip++ << 2);
#endif
NEED_OP(2);
- t = 2; COPY_DICT(t,m_off)
+ t = 2; COPY_DICT(t, m_off)
#else
#if defined(LZO1Z)
t = 1 + (t << 6) + (*ip++ >> 2);
@@ -402,7 +402,7 @@ match:
#if defined(COPY_DICT)
NEED_OP(t+3-1);
- t += 3-1; COPY_DICT(t,m_off)
+ t += 3-1; COPY_DICT(t, m_off)
#else
@@ -413,12 +413,12 @@ match:
t += (3 - 1);
if (t >= 8) do
{
- UA_COPY64(op,m_pos);
+ UA_COPY64(op, m_pos);
op += 8; m_pos += 8; t -= 8;
} while (t >= 8);
if (t >= 4)
{
- UA_COPY32(op,m_pos);
+ UA_COPY32(op, m_pos);
op += 4; m_pos += 4; t -= 4;
}
if (t > 0)
@@ -430,17 +430,17 @@ match:
else
#elif defined(LZO_UNALIGNED_OK_4) || defined(LZO_ALIGNED_OK_4)
#if !defined(LZO_UNALIGNED_OK_4)
- if (t >= 2 * 4 - (3 - 1) && PTR_ALIGNED2_4(op,m_pos))
+ if (t >= 2 * 4 - (3 - 1) && PTR_ALIGNED2_4(op, m_pos))
{
assert((op - m_pos) >= 4);
#else
if (t >= 2 * 4 - (3 - 1) && (op - m_pos) >= 4)
{
#endif
- UA_COPY32(op,m_pos);
+ UA_COPY32(op, m_pos);
op += 4; m_pos += 4; t -= 4 - (3 - 1);
do {
- UA_COPY32(op,m_pos);
+ UA_COPY32(op, m_pos);
op += 4; m_pos += 4; t -= 4;
} while (t >= 4);
if (t > 0) do *op++ = *m_pos++; while (--t > 0);
diff --git a/engines/tony/mpal/memory.cpp b/engines/tony/mpal/memory.cpp
index 3a68ecb559..428c07b3b7 100644
--- a/engines/tony/mpal/memory.cpp
+++ b/engines/tony/mpal/memory.cpp
@@ -39,7 +39,7 @@ const uint32 BLOCK_ID = 0x12345678;
* Allocates a new memory block
* @return Returns a MemoryItem instance for the new block
*/
-HANDLE MemoryManager::allocate(uint32 size, uint flags) {
+MpalHandle MemoryManager::allocate(uint32 size, uint flags) {
MemoryItem *newItem = (MemoryItem *)malloc(sizeof(MemoryItem) + size);
newItem->_id = BLOCK_ID;
newItem->_size = size;
@@ -51,7 +51,7 @@ HANDLE MemoryManager::allocate(uint32 size, uint flags) {
Common::fill(dataP, dataP + size, 0);
}
- return (HANDLE)newItem;
+ return (MpalHandle)newItem;
}
/**
@@ -70,7 +70,7 @@ void *MemoryManager::alloc(uint32 size, uint flags) {
* Returns a reference to the MemoryItem for a gien byte pointer
* @param block Byte pointer
*/
-MemoryItem *MemoryManager::getItem(HGLOBAL handle) {
+MemoryItem *MemoryManager::getItem(MpalHandle handle) {
MemoryItem *rec = (MemoryItem *)((byte *)handle - OFFSETOF(MemoryItem, _data));
assert(rec->_id == BLOCK_ID);
return rec;
@@ -79,7 +79,7 @@ MemoryItem *MemoryManager::getItem(HGLOBAL handle) {
/**
* Returns a size of a memory block given its pointer
*/
-uint32 MemoryManager::getSize(HANDLE handle) {
+uint32 MemoryManager::getSize(MpalHandle handle) {
MemoryItem *item = (MemoryItem *)handle;
assert(item->_id == BLOCK_ID);
return item->_size;
@@ -88,7 +88,7 @@ uint32 MemoryManager::getSize(HANDLE handle) {
/**
* Erases a given item
*/
-void MemoryManager::freeBlock(HANDLE handle) {
+void MemoryManager::freeBlock(MpalHandle handle) {
MemoryItem *item = (MemoryItem *)handle;
assert(item->_id == BLOCK_ID);
free(item);
@@ -97,7 +97,7 @@ void MemoryManager::freeBlock(HANDLE handle) {
/**
* Erases a given item
*/
-void MemoryManager::destroyItem(HANDLE handle) {
+void MemoryManager::destroyItem(MpalHandle handle) {
MemoryItem *item = getItem(handle);
assert(item->_id == BLOCK_ID);
free(item);
@@ -106,7 +106,7 @@ void MemoryManager::destroyItem(HANDLE handle) {
/**
* Locks an item for access
*/
-byte *MemoryManager::lockItem(HANDLE handle) {
+byte *MemoryManager::lockItem(MpalHandle handle) {
MemoryItem *item = (MemoryItem *)handle;
assert(item->_id == BLOCK_ID);
++item->_lockCount;
@@ -116,7 +116,7 @@ byte *MemoryManager::lockItem(HANDLE handle) {
/**
* Unlocks a locked item
*/
-void MemoryManager::unlockItem(HANDLE handle) {
+void MemoryManager::unlockItem(MpalHandle handle) {
MemoryItem *item = (MemoryItem *)handle;
assert(item->_id == BLOCK_ID);
assert(item->_lockCount > 0);
diff --git a/engines/tony/mpal/memory.h b/engines/tony/mpal/memory.h
index c7e4896cf9..b557743512 100644
--- a/engines/tony/mpal/memory.h
+++ b/engines/tony/mpal/memory.h
@@ -31,8 +31,7 @@ namespace Tony {
namespace MPAL {
-typedef void *HANDLE;
-typedef HANDLE HGLOBAL;
+typedef void *MpalHandle;
struct MemoryItem {
uint32 _id;
@@ -46,15 +45,15 @@ struct MemoryItem {
class MemoryManager {
private:
- static MemoryItem *getItem(HGLOBAL handle);
+ static MemoryItem *getItem(MpalHandle handle);
public:
- static HANDLE allocate(uint32 size, uint flags);
+ static MpalHandle allocate(uint32 size, uint flags);
static void *alloc(uint32 size, uint flags);
- static void freeBlock(HANDLE handle);
- static void destroyItem(HANDLE handle);
- static uint32 getSize(HANDLE handle);
- static byte *lockItem(HANDLE handle);
- static void unlockItem(HANDLE handle);
+ static void freeBlock(MpalHandle handle);
+ static void destroyItem(MpalHandle handle);
+ static uint32 getSize(MpalHandle handle);
+ static byte *lockItem(MpalHandle handle);
+ static void unlockItem(MpalHandle handle);
};
// defines
diff --git a/engines/tony/mpal/mpal.cpp b/engines/tony/mpal/mpal.cpp
index 9a92fd7766..533a4d22b9 100644
--- a/engines/tony/mpal/mpal.cpp
+++ b/engines/tony/mpal/mpal.cpp
@@ -360,8 +360,8 @@ static char *duplicateDialogPeriod(uint32 nPeriod) {
* @param dwId ID of the resource to load
* @returns Handle to the loaded resource
*/
-HGLOBAL resLoad(uint32 dwId) {
- HGLOBAL h;
+MpalHandle resLoad(uint32 dwId) {
+ MpalHandle h;
char head[4];
uint32 nBytesRead;
uint32 nSizeComp, nSizeDecomp;
@@ -461,15 +461,15 @@ static uint32 *GetItemList(uint32 nLoc) {
return il;
}
-static LPITEM getItemData(uint32 nOrdItem) {
+static LpItem getItemData(uint32 nOrdItem) {
LpMpalItem curitem = GLOBALS._lpmiItems + nOrdItem;
- LPITEM ret;
- HGLOBAL hDat;
+ LpItem ret;
+ MpalHandle hDat;
char *dat;
char *patlength;
// Zeroing out the allocated memory is required!!!
- ret = (LPITEM)globalAlloc(GMEM_FIXED | GMEM_ZEROINIT, sizeof(ITEM));
+ ret = (LpItem)globalAlloc(GMEM_FIXED | GMEM_ZEROINIT, sizeof(Item));
if (ret == NULL)
return NULL;
ret->_speed = 150;
@@ -536,7 +536,7 @@ static LPITEM getItemData(uint32 nOrdItem) {
for (int i = 1; i < ret->_numframe; i++) {
uint32 dim = (uint32)(ret->_frameslocations[i].right - ret->_frameslocations[i].left) *
(uint32)(ret->_frameslocations[i].bottom - ret->_frameslocations[i].top);
- ret->_frames[i] = (char *)globalAlloc(GMEM_FIXED,dim);
+ ret->_frames[i] = (char *)globalAlloc(GMEM_FIXED, dim);
if (ret->_frames[i] == NULL)
return NULL;
@@ -565,12 +565,12 @@ static LPITEM getItemData(uint32 nOrdItem) {
*/
void CustomThread(CORO_PARAM, const void *param) {
CORO_BEGIN_CONTEXT;
- LPCFCALL p;
+ LpCfCall p;
CORO_END_CONTEXT(_ctx);
CORO_BEGIN_CODE(_ctx);
- _ctx->p = *(LPCFCALL *)param;
+ _ctx->p = *(LpCfCall *)param;
CORO_INVOKE_4(GLOBALS._lplpFunctions[_ctx->p->_nCf], _ctx->p->_arg1, _ctx->p->_arg2, _ctx->p->_arg3, _ctx->p->_arg4);
@@ -593,7 +593,7 @@ void ScriptThread(CORO_PARAM, const void *param) {
uint32 dwCurTime;
uint32 dwId;
int numHandles;
- LPCFCALL p;
+ LpCfCall p;
CORO_END_CONTEXT(_ctx);
static uint32 cfHandles[MAX_COMMANDS_PER_MOMENT];
@@ -604,7 +604,7 @@ void ScriptThread(CORO_PARAM, const void *param) {
_ctx->dwStartTime = g_vm->getTime();
_ctx->numHandles = 0;
-// debugC(DEBUG_BASIC, kTonyDebugMPAL, "PlayScript(): Moments: %u\n",s->nMoments);
+// debugC(DEBUG_BASIC, kTonyDebugMPAL, "PlayScript(): Moments: %u\n", s->_nMoments);
for (_ctx->i = 0; _ctx->i < s->_nMoments; _ctx->i++) {
// Sleep for the required time
if (s->_moment[_ctx->i]._dwTime == -1) {
@@ -613,8 +613,8 @@ void ScriptThread(CORO_PARAM, const void *param) {
} else {
_ctx->dwCurTime = g_vm->getTime();
if (_ctx->dwCurTime < _ctx->dwStartTime + (s->_moment[_ctx->i]._dwTime * 100)) {
- // debugC(DEBUG_BASIC, kTonyDebugMPAL, "PlayScript(): Sleeping %lums\n",_ctx->dwStartTime+(s->Moment[_ctx->i].dwTime*100)-_ctx->dwCurTime);
- CORO_INVOKE_1(CoroScheduler.sleep, _ctx->dwStartTime+(s->_moment[_ctx->i]._dwTime * 100) - _ctx->dwCurTime);
+ // debugC(DEBUG_BASIC, kTonyDebugMPAL, "PlayScript(): Sleeping %lums\n",_ctx->dwStartTime + (s->_moment[_ctx->i]._dwTime*100) - _ctx->dwCurTime);
+ CORO_INVOKE_1(CoroScheduler.sleep, _ctx->dwStartTime + (s->_moment[_ctx->i]._dwTime * 100) - _ctx->dwCurTime);
}
}
@@ -623,7 +623,7 @@ void ScriptThread(CORO_PARAM, const void *param) {
_ctx->k = s->_moment[_ctx->i]._cmdNum[_ctx->j];
if (s->_command[_ctx->k]._type == 1) {
- _ctx->p = (LPCFCALL)globalAlloc(GMEM_FIXED, sizeof(CFCALL));
+ _ctx->p = (LpCfCall)globalAlloc(GMEM_FIXED, sizeof(CfCall));
if (_ctx->p == NULL) {
GLOBALS._mpalError = 1;
@@ -638,7 +638,7 @@ void ScriptThread(CORO_PARAM, const void *param) {
_ctx->p->_arg4 = s->_command[_ctx->k]._arg4;
// !!! New process management
- if ((cfHandles[_ctx->numHandles++] = CoroScheduler.createProcess(CustomThread, &_ctx->p, sizeof(LPCFCALL))) == 0) {
+ if ((cfHandles[_ctx->numHandles++] = CoroScheduler.createProcess(CustomThread, &_ctx->p, sizeof(LpCfCall))) == 0) {
GLOBALS._mpalError = 1;
CORO_KILL_SELF();
@@ -775,14 +775,14 @@ void ShutUpActionThread(CORO_PARAM, const void *param) {
*/
void LocationPollThread(CORO_PARAM, const void *param) {
typedef struct {
- uint32 _nItem, _nAction;
-
- uint16 _wTime;
- byte _perc;
- HGLOBAL _when;
- byte _nCmds;
- uint16 _cmdNum[MAX_COMMANDS_PER_ACTION];
- uint32 _dwLastTime;
+ uint32 _nItem, _nAction;
+
+ uint16 _wTime;
+ byte _perc;
+ MpalHandle _when;
+ byte _nCmds;
+ uint16 _cmdNum[MAX_COMMANDS_PER_ACTION];
+ uint32 _dwLastTime;
} MYACTION;
typedef struct {
@@ -795,7 +795,7 @@ void LocationPollThread(CORO_PARAM, const void *param) {
int i, j, k;
int numitems;
int nRealItems;
- LpMpalItem curItem,newItem;
+ LpMpalItem curItem, newItem;
int nIdleActions;
uint32 curTime;
uint32 dwSleepTime;
@@ -1012,7 +1012,7 @@ void LocationPollThread(CORO_PARAM, const void *param) {
// Create the process
if ((_ctx->myThreads[_ctx->i]._hThread = CoroScheduler.createProcess(ActionThread, &_ctx->newItem, sizeof(LpMpalItem))) == CORO_INVALID_PID_VALUE) {
- //if ((_ctx->myThreads[_ctx->i]._hThread = (void*)_beginthread(ActionThread, 10240,(void *)_ctx->newItem)) == (void*)-1)
+ //if ((_ctx->myThreads[_ctx->i]._hThread = (void*)_beginthread(ActionThread, 10240, (void *)_ctx->newItem)) == (void*)-1)
globalDestroy(_ctx->newItem);
globalDestroy(_ctx->myThreads);
globalDestroy(_ctx->myActions);
@@ -1298,8 +1298,8 @@ static uint32 doAction(uint32 nAction, uint32 ordItem, uint32 dwParam) {
// In the new version number of the action in writing dwRes
Common::copy((byte *)item, (byte *)item + sizeof(MpalItem), (byte *)newitem);
- //newitem->Action[0].nCmds=item->Action[i].nCmds;
- //memcpy(newitem->Action[0].CmdNum,item->Action[i].CmdNum,newitem->Action[0].nCmds*sizeof(newitem->Action[0].CmdNum[0]));
+ //newitem->_action[0]._nCmds=item->_action[i]._nCmds;
+ //memcpy(newitem->_action[0]._cmdNum, item->_action[i]._cmdNum, newitem->Action[0].nCmds * sizeof(newitem->_action[0]._cmdNum[0]));
newitem->_dwRes = i;
@@ -1630,7 +1630,7 @@ uint32 mpalQueryDWORD(uint16 wQueryType, ...) {
} else if (wQueryType == MPQ_ITEM_DATA) {
/*
- * LPITEM mpalQuery(MPQ_ITEM_DATA, uint32 nItem);
+ * LpItem mpalQuery(MPQ_ITEM_DATA, uint32 nItem);
*/
error("mpalQuery(MPQ_ITEM_DATA, uint32 nItem) used incorrect variant");
@@ -1747,7 +1747,7 @@ uint32 mpalQueryDWORD(uint16 wQueryType, ...) {
* @remarks This is the specialised version of the original single mpalQuery
* method that returns a pointer or handle.
*/
-HANDLE mpalQueryHANDLE(uint16 wQueryType, ...) {
+MpalHandle mpalQueryHANDLE(uint16 wQueryType, ...) {
char *n;
Common::String buf;
va_list v;
@@ -1813,7 +1813,7 @@ HANDLE mpalQueryHANDLE(uint16 wQueryType, ...) {
} else if (wQueryType == MPQ_ITEM_DATA) {
/*
- * LPITEM mpalQuery(MPQ_ITEM_DATA, uint32 nItem);
+ * LpItem mpalQuery(MPQ_ITEM_DATA, uint32 nItem);
*/
lockItems();
hRet = getItemData(itemGetOrderFromNum(GETARG(uint32)));
@@ -2008,7 +2008,7 @@ bool mpalStartIdlePoll(int nLoc) {
GLOBALS._hEndPollingLocations[i] = CoroScheduler.createEvent(true, false);
// !!! New process management
if ((GLOBALS._pollingThreads[i] = CoroScheduler.createProcess(LocationPollThread, &i, sizeof(uint32))) == CORO_INVALID_PID_VALUE)
-// if ((GLOBALS.hEndPollingLocations[i] = (void*)_beginthread(LocationPollThread, 10240,(void *)i))= = (void*)-1)
+// if ((GLOBALS.hEndPollingLocations[i] = (void*)_beginthread(LocationPollThread, 10240, (void *)i))= = (void*)-1)
return false;
return true;
diff --git a/engines/tony/mpal/mpal.h b/engines/tony/mpal/mpal.h
index 1af0f2c9e9..c5f505063f 100644
--- a/engines/tony/mpal/mpal.h
+++ b/engines/tony/mpal/mpal.h
@@ -100,11 +100,8 @@ namespace MPAL {
#define MAXFRAMES 400 // frame animation of an object
#define MAXPATTERN 40 // pattern of animation of an object
-
#define MAXPOLLINGLOCATIONS 64
-#define LPSTR char *
-
/**
* Macro for use with queries that may refer to X and Y co-ordinates
*/
@@ -113,7 +110,6 @@ enum QueryCoordinates {
MPQ_Y
};
-
/**
* Query can be used with mpalQuery methods. In practice corresponds all claims
* that can do at the library
@@ -164,8 +160,8 @@ typedef struct {
short _destX, _destY;
signed char _destZ;
short _objectID;
-} ITEM;
-typedef ITEM *LPITEM;
+} Item;
+typedef Item *LpItem;
/**
@@ -228,7 +224,7 @@ typedef LPITEMIRQFUNCTION* LPLPITEMIRQFUNCTION;
* after use. The message will be in ASCIIZ format.
*/
#define mpalQueryMessage(nMsg) \
- (LPSTR)mpalQueryHANDLE(MPQ_MESSAGE, (uint32)(nMsg))
+ (char *)mpalQueryHANDLE(MPQ_MESSAGE, (uint32)(nMsg))
/**
@@ -246,7 +242,7 @@ typedef LPITEMIRQFUNCTION* LPLPITEMIRQFUNCTION;
* @param dwCoord MPQ_X or MPQ_Y coordinate to retrieve
* @returns Size
*/
-#define mpalQueryLocationSize(nLoc,dwCoord) \
+#define mpalQueryLocationSize(nLoc, dwCoord) \
mpalQueryDWORD(MPQ_LOCATION_SIZE, (uint32)(nLoc), (uint32)(dwCoord))
@@ -268,7 +264,7 @@ typedef LPITEMIRQFUNCTION* LPLPITEMIRQFUNCTION;
* @returns Structure filled with requested information
*/
#define mpalQueryItemData(nItem) \
- (LPITEM)mpalQueryHANDLE(MPQ_ITEM_DATA, (uint32)(nItem))
+ (LpItem)mpalQueryHANDLE(MPQ_ITEM_DATA, (uint32)(nItem))
/**
@@ -302,7 +298,7 @@ typedef LPITEMIRQFUNCTION* LPLPITEMIRQFUNCTION;
* is less than or equal to 0), the string will be empty.
*/
#define mpalQueryItemName(nItem, lpszName) \
- mpalQueryHANDLE(MPQ_ITEM_NAME, (uint32)(nItem), (LPSTR)(lpszName))
+ mpalQueryHANDLE(MPQ_ITEM_NAME, (uint32)(nItem), (char *)(lpszName))
/**
@@ -316,7 +312,7 @@ typedef LPITEMIRQFUNCTION* LPLPITEMIRQFUNCTION;
* string terminated with 0.
*/
#define mpalQueryDialogPeriod(nPeriod) \
- (LPSTR)mpalQueryHANDLE(MPQ_DIALOG_PERIOD, (uint32)(nPeriod))
+ (char *)mpalQueryHANDLE(MPQ_DIALOG_PERIOD, (uint32)(nPeriod))
/**
@@ -379,8 +375,8 @@ typedef LPITEMIRQFUNCTION* LPLPITEMIRQFUNCTION;
* @returns Handle to the thread that is running the box, or
* CORO_INVALID_PID_VALUE if the dialogue does not exist.
*/
-#define mpalQueryDoDialog(nDialog,nGroup) \
- mpalQueryDWORD(MPQ_DO_DIALOG, (uint32)(nDialog),(uint32)(nGroup))
+#define mpalQueryDoDialog(nDialog, nGroup) \
+ mpalQueryDWORD(MPQ_DO_DIALOG, (uint32)(nDialog), (uint32)(nGroup))
/**
* @defgroup Functions exported to the main game
@@ -422,7 +418,7 @@ uint32 mpalQueryDWORD(uint16 wQueryType, ...);
* @remarks This is the specialised version of the original single mpalQuery
* method that returns a pointer or handle.
*/
-HANDLE mpalQueryHANDLE(uint16 wQueryType, ...);
+MpalHandle mpalQueryHANDLE(uint16 wQueryType, ...);
/**
* This is a general function to communicate with the library, to request information
diff --git a/engines/tony/mpal/mpaldll.h b/engines/tony/mpal/mpaldll.h
index 853b5b2dac..8897096f51 100644
--- a/engines/tony/mpal/mpaldll.h
+++ b/engines/tony/mpal/mpaldll.h
@@ -82,8 +82,8 @@ typedef MpalVar *LpMpalVar;
* MPAL Messages
*/
struct MpalMsg {
- HGLOBAL _hText; // Handle to the message text
- uint16 _wNum; // Message number
+ MpalHandle _hText; // Handle to the message text
+ uint16 _wNum; // Message number
} PACKED_STRUCT;
typedef MpalMsg *LpMpalMsg;
@@ -110,7 +110,7 @@ struct Command {
* #3 -> Making a choice (DIALOG)
*
*/
- byte _type; // Type of control
+ byte _type; // Type of control
union {
int32 _nCf; // Custom function call [#1]
@@ -120,10 +120,10 @@ struct Command {
union {
int32 _arg1; // Argument for custom function [#1]
- HGLOBAL _expr; // Expression to assign to a variable [#2]
+ MpalHandle _expr; // Expression to assign to a variable [#2]
};
- int32 _arg2, _arg3, _arg4; // Arguments for custom function [#1]
+ int32 _arg2, _arg3, _arg4; // Arguments for custom function [#1]
} PACKED_STRUCT;
@@ -148,7 +148,7 @@ struct MpalDialog {
// The select number (we're pretty stingy with RAM). The last select has dwData == 0
struct {
- HGLOBAL _when;
+ MpalHandle _when;
uint32 _dwData;
uint16 _wPlayGroup[MAX_PLAYGROUPS_PER_SELECT];
@@ -163,7 +163,7 @@ struct MpalDialog {
} _choice[MAX_CHOICES_PER_DIALOG];
uint16 _periodNums[MAX_PERIODS_PER_DIALOG];
- HGLOBAL _periods[MAX_PERIODS_PER_DIALOG];
+ MpalHandle _periods[MAX_PERIODS_PER_DIALOG];
} PACKED_STRUCT;
typedef MpalDialog *LpMpalDialog;
@@ -175,20 +175,20 @@ struct ItemAction {
byte _num; // Action number
uint16 _wTime; // If idle, the time which must pass
byte _perc; // Percentage of the idle run
- HGLOBAL _when; // Expression to compute. If != 0, then
- // action can be done
+ MpalHandle _when; // Expression to compute. If != 0, then
+ // action can be done
uint16 _wParm; // Parameter for action
- byte _nCmds; // Number of commands to be executed
+ byte _nCmds; // Number of commands to be executed
uint32 _cmdNum[MAX_COMMANDS_PER_ACTION]; // Commands to execute
} PACKED_STRUCT;
struct MpalItem {
- uint32 _nObj; // Item number
+ uint32 _nObj; // Item number
byte _lpszDescribe[MAX_DESCRIBE_SIZE]; // Name
- byte _nActions; // Number of managed actions
- uint32 _dwRes; // Resource that contains frames and patterns
+ byte _nActions; // Number of managed actions
+ uint32 _dwRes; // Resource that contains frames and patterns
struct Command _command[MAX_COMMANDS_PER_ITEM];
diff --git a/engines/tony/mpal/mpalutils.h b/engines/tony/mpal/mpalutils.h
index 19e4fa7778..8bc3e1d7c6 100644
--- a/engines/tony/mpal/mpalutils.h
+++ b/engines/tony/mpal/mpalutils.h
@@ -37,7 +37,7 @@ namespace MPAL {
class RMRes {
protected:
- HGLOBAL _h;
+ MpalHandle _h;
byte *_buf;
public:
diff --git a/engines/tony/utils.cpp b/engines/tony/utils.cpp
index db83c2910b..99ba84ab19 100644
--- a/engines/tony/utils.cpp
+++ b/engines/tony/utils.cpp
@@ -370,7 +370,7 @@ void RMResUpdate::init(const Common::String &fileName) {
}
}
-HGLOBAL RMResUpdate::queryResource(uint32 dwRes) {
+MpalHandle RMResUpdate::queryResource(uint32 dwRes) {
// If there isn't an update file, return NULL
if (!_hFile.isOpen())
return NULL;
@@ -400,7 +400,7 @@ HGLOBAL RMResUpdate::queryResource(uint32 dwRes) {
}
// Allocate space for the output resource
- HGLOBAL destBuf = globalAllocate(0, info._size);
+ MpalHandle destBuf = globalAllocate(0, info._size);
byte *lpDestBuf = (byte *)globalLock(destBuf);
uint32 dwSize;
diff --git a/engines/tony/utils.h b/engines/tony/utils.h
index d3f93e06ef..a24e11f2b6 100644
--- a/engines/tony/utils.h
+++ b/engines/tony/utils.h
@@ -173,7 +173,7 @@ public:
~RMResUpdate();
void init(const Common::String &fileName);
- HGLOBAL queryResource(uint32 dwRes);
+ MpalHandle queryResource(uint32 dwRes);
};
} // End of namespace Tony