aboutsummaryrefslogtreecommitdiff
path: root/engines/tony/mpal
diff options
context:
space:
mode:
authorStrangerke2012-06-07 21:14:59 +0200
committerStrangerke2012-06-07 21:14:59 +0200
commitcd15e483ed64274049142a2e6838962d794c3ff5 (patch)
tree33a1487e084aa4066a648fe46d599dc95d458f7c /engines/tony/mpal
parenta7a619e1b41b771726b6fb611ddb640e38a78185 (diff)
downloadscummvm-rg350-cd15e483ed64274049142a2e6838962d794c3ff5.tar.gz
scummvm-rg350-cd15e483ed64274049142a2e6838962d794c3ff5.tar.bz2
scummvm-rg350-cd15e483ed64274049142a2e6838962d794c3ff5.zip
TONY: Some more renaming
Diffstat (limited to 'engines/tony/mpal')
-rw-r--r--engines/tony/mpal/expr.cpp78
-rw-r--r--engines/tony/mpal/expr.h6
-rw-r--r--engines/tony/mpal/loadmpc.cpp184
-rw-r--r--engines/tony/mpal/memory.cpp12
-rw-r--r--engines/tony/mpal/memory.h20
-rw-r--r--engines/tony/mpal/mpal.cpp482
-rw-r--r--engines/tony/mpal/mpal.h4
-rw-r--r--engines/tony/mpal/mpaldll.h16
-rw-r--r--engines/tony/mpal/mpalutils.cpp8
9 files changed, 405 insertions, 405 deletions
diff --git a/engines/tony/mpal/expr.cpp b/engines/tony/mpal/expr.cpp
index ae6dfac482..0b51724330 100644
--- a/engines/tony/mpal/expr.cpp
+++ b/engines/tony/mpal/expr.cpp
@@ -103,32 +103,32 @@ typedef EXPRESSION *LPEXPRESSION;
* @param h Handle to the original expression
* @retruns Pointer to the cloned expression
*/
-static byte *DuplicateExpression(HGLOBAL h) {
+static byte *duplicateExpression(HGLOBAL h) {
int i, num;
byte *orig, *clone;
LPEXPRESSION one, two;
- orig = (byte *)GlobalLock(h);
+ orig = (byte *)globalLock(h);
num = *(byte *)orig;
one = (LPEXPRESSION)(orig+1);
- clone = (byte *)GlobalAlloc(GMEM_FIXED, sizeof(EXPRESSION) * num + 1);
+ clone = (byte *)globalAlloc(GMEM_FIXED, sizeof(EXPRESSION) * num + 1);
two = (LPEXPRESSION)(clone + 1);
- CopyMemory(clone, orig, sizeof(EXPRESSION) * num + 1);
+ copyMemory(clone, orig, sizeof(EXPRESSION) * num + 1);
for (i = 0; i < num; i++) {
if (one->type == ELT_PARENTH) {
two->type = ELT_PARENTH2;
- two->val.pson = DuplicateExpression(two->val.son);
+ two->val.pson = duplicateExpression(two->val.son);
}
one++;
two++;
}
- GlobalUnlock(h);
+ globalUnlock(h);
return clone;
}
@@ -178,7 +178,7 @@ static int Compute(int a, int b, byte symbol) {
return 0;
}
-static void Solve(LPEXPRESSION one, int num) {
+static void solve(LPEXPRESSION one, int num) {
LPEXPRESSION two, three;
int j;
@@ -186,7 +186,7 @@ static void Solve(LPEXPRESSION one, int num) {
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);
- CopyMemory(one, two, (num - 1) * sizeof(EXPRESSION));
+ copyMemory(one, two, (num - 1) * sizeof(EXPRESSION));
num--;
} else {
j = 1;
@@ -198,7 +198,7 @@ static void Solve(LPEXPRESSION one, int num) {
}
three->val.num = Compute(two->val.num, three->val.num, two->symbol);
- CopyMemory(two, three, (num - j - 1) * sizeof(EXPRESSION));
+ copyMemory(two, three, (num - j - 1) * sizeof(EXPRESSION));
num--;
}
}
@@ -212,7 +212,7 @@ static void Solve(LPEXPRESSION one, int num) {
* @param expr Pointer to an expression duplicated by DuplicateExpression
* @returns Value
*/
-static int EvaluateAndFreeExpression(byte *expr) {
+static int evaluateAndFreeExpression(byte *expr) {
int i,num,val;
LPEXPRESSION one,cur;
@@ -231,14 +231,14 @@ static int EvaluateAndFreeExpression(byte *expr) {
for (i = 0, cur = one; i < num; i++, cur++) {
if (cur->type == ELT_PARENTH2) {
cur->type = ELT_NUMBER;
- cur->val.num = EvaluateAndFreeExpression(cur->val.pson);
+ cur->val.num = evaluateAndFreeExpression(cur->val.pson);
}
}
// 3) Risoluzione algebrica
- Solve(one, num);
+ solve(one, num);
val = one->val.num;
- GlobalFree(expr);
+ globalFree(expr);
return val;
}
@@ -252,7 +252,7 @@ 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) {
+const byte *parseExpression(const byte *lpBuf, HGLOBAL *h) {
LPEXPRESSION cur;
byte *start;
uint32 num, i;
@@ -263,11 +263,11 @@ const byte *ParseExpression(const byte *lpBuf, HGLOBAL *h) {
if (num == 0)
return NULL;
- *h = GlobalAlloc(GMEM_MOVEABLE | GMEM_ZEROINIT, num * sizeof(EXPRESSION) + 1);
+ *h = globalAlloc(GMEM_MOVEABLE | GMEM_ZEROINIT, num * sizeof(EXPRESSION) + 1);
if (*h == NULL)
return NULL;
- start = (byte *)GlobalLock(*h);
+ start = (byte *)globalLock(*h);
*start = (byte)num;
cur = (LPEXPRESSION)(start + 1);
@@ -283,15 +283,15 @@ const byte *ParseExpression(const byte *lpBuf, HGLOBAL *h) {
break;
case ELT_VAR:
- cur->val.name = (char *)GlobalAlloc(GMEM_FIXED | GMEM_ZEROINIT, (*lpBuf) + 1);
+ cur->val.name = (char *)globalAlloc(GMEM_FIXED | GMEM_ZEROINIT, (*lpBuf) + 1);
if (cur->val.name == NULL)
return NULL;
- CopyMemory(cur->val.name, lpBuf + 1, *lpBuf);
+ copyMemory(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;
@@ -321,12 +321,12 @@ const byte *ParseExpression(const byte *lpBuf, HGLOBAL *h) {
* @param h Handle to the expression
* @returns Numeric value
*/
-int EvaluateExpression(HGLOBAL h) {
+int evaluateExpression(HGLOBAL h) {
int ret;
- LockVar();
- ret=EvaluateAndFreeExpression(DuplicateExpression(h));
- UnlockVar();
+ lockVar();
+ ret = evaluateAndFreeExpression(duplicateExpression(h));
+ unlockVar();
return ret;
}
@@ -337,20 +337,20 @@ int EvaluateExpression(HGLOBAL h) {
* @param h1 Expression to be compared
* @param h2 Expression to be compared
*/
-bool CompareExpressions(HGLOBAL h1, HGLOBAL h2) {
+bool compareExpressions(HGLOBAL h1, HGLOBAL h2) {
int i, num1, num2;
byte *e1, *e2;
LPEXPRESSION one, two;
- e1 = (byte *)GlobalLock(h1);
- e2 = (byte *)GlobalLock(h2);
+ e1 = (byte *)globalLock(h1);
+ e2 = (byte *)globalLock(h2);
num1 = *(byte *)e1;
num2 = *(byte *)e2;
if (num1 != num2) {
- GlobalUnlock(h1);
- GlobalUnlock(h2);
+ globalUnlock(h1);
+ globalUnlock(h2);
return false;
}
@@ -359,32 +359,32 @@ bool CompareExpressions(HGLOBAL h1, HGLOBAL h2) {
for (i = 0; i < num1; i++) {
if (one->type != two->type || (i != num1 - 1 && one->symbol != two->symbol)) {
- GlobalUnlock(h1);
- GlobalUnlock(h2);
+ globalUnlock(h1);
+ globalUnlock(h2);
return false;
}
switch (one->type) {
case ELT_NUMBER:
if (one->val.num != two->val.num) {
- GlobalUnlock(h1);
- GlobalUnlock(h2);
+ globalUnlock(h1);
+ globalUnlock(h2);
return false;
}
break;
case ELT_VAR:
if (strcmp(one->val.name, two->val.name) != 0) {
- GlobalUnlock(h1);
- GlobalUnlock(h2);
+ globalUnlock(h1);
+ globalUnlock(h2);
return false;
}
break;
case ELT_PARENTH:
- if (!CompareExpressions(one->val.son, two->val.son)) {
- GlobalUnlock(h1);
- GlobalUnlock(h2);
+ if (!compareExpressions(one->val.son, two->val.son)) {
+ globalUnlock(h1);
+ globalUnlock(h2);
return false;
}
break;
@@ -394,8 +394,8 @@ bool CompareExpressions(HGLOBAL h1, HGLOBAL h2) {
two++;
}
- GlobalUnlock(h1);
- GlobalUnlock(h2);
+ globalUnlock(h1);
+ globalUnlock(h2);
return true;
}
diff --git a/engines/tony/mpal/expr.h b/engines/tony/mpal/expr.h
index 17e9c1264b..7d33e5c8ca 100644
--- a/engines/tony/mpal/expr.h
+++ b/engines/tony/mpal/expr.h
@@ -45,7 +45,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, HGLOBAL *h);
/**
* Calculate the value of a mathamatical expression
@@ -53,7 +53,7 @@ const byte *ParseExpression(const byte *lpBuf, HGLOBAL *h);
* @param h Handle to the expression
* @returns Numeric value
*/
-int EvaluateExpression(HGLOBAL h);
+int evaluateExpression(HGLOBAL h);
/**
* Compare two mathematical expressions together
@@ -61,7 +61,7 @@ int EvaluateExpression(HGLOBAL h);
* @param h1 Expression to be compared
* @param h2 Expression to be compared
*/
-bool CompareExpressions(HGLOBAL h1, HGLOBAL h2);
+bool compareExpressions(HGLOBAL h1, HGLOBAL h2);
} // end of namespace MPAL
diff --git a/engines/tony/mpal/loadmpc.cpp b/engines/tony/mpal/loadmpc.cpp
index 02571bd30f..8f07102aa3 100644
--- a/engines/tony/mpal/loadmpc.cpp
+++ b/engines/tony/mpal/loadmpc.cpp
@@ -42,10 +42,10 @@ namespace MPAL {
* Funzioni statiche
\****************************************************************************/
-static bool CompareCommands(struct command *cmd1, struct command *cmd2) {
+static bool compareCommands(struct command *cmd1, struct command *cmd2) {
if (cmd1->type == 2 && cmd2->type == 2) {
if (strcmp(cmd1->lpszVarName, cmd2->lpszVarName) == 0 &&
- CompareExpressions(cmd1->expr, cmd2->expr))
+ compareExpressions(cmd1->expr, cmd2->expr))
return true;
else
return false;
@@ -80,32 +80,32 @@ static const byte *ParseScript(const byte *lpBuf, LPMPALSCRIPT lpmsScript) {
lpBuf++;
for (j = 0; j < lpmsScript->Moment[i].nCmds; j++) {
- lpmsScript->Command[curCmd].type = *lpBuf;
+ lpmsScript->_command[curCmd].type = *lpBuf;
lpBuf++;
- switch (lpmsScript->Command[curCmd].type) {
+ switch (lpmsScript->_command[curCmd].type) {
case 1:
- lpmsScript->Command[curCmd].nCf = READ_LE_UINT16(lpBuf);
+ lpmsScript->_command[curCmd].nCf = READ_LE_UINT16(lpBuf);
lpBuf += 2;
- lpmsScript->Command[curCmd].arg1 = (int32)READ_LE_UINT32(lpBuf);
+ lpmsScript->_command[curCmd].arg1 = (int32)READ_LE_UINT32(lpBuf);
lpBuf += 4;
- lpmsScript->Command[curCmd].arg2 = (int32)READ_LE_UINT32(lpBuf);
+ lpmsScript->_command[curCmd].arg2 = (int32)READ_LE_UINT32(lpBuf);
lpBuf += 4;
- lpmsScript->Command[curCmd].arg3 = (int32)READ_LE_UINT32(lpBuf);
+ lpmsScript->_command[curCmd].arg3 = (int32)READ_LE_UINT32(lpBuf);
lpBuf += 4;
- lpmsScript->Command[curCmd].arg4 = (int32)READ_LE_UINT32(lpBuf);
+ lpmsScript->_command[curCmd].arg4 = (int32)READ_LE_UINT32(lpBuf);
lpBuf += 4;
break;
case 2: // Variable assign
len = *lpBuf;
lpBuf++;
- lpmsScript->Command[curCmd].lpszVarName = (char *)GlobalAlloc(GMEM_FIXED | GMEM_ZEROINIT, len + 1);
- if (lpmsScript->Command[curCmd].lpszVarName == NULL)
+ lpmsScript->_command[curCmd].lpszVarName = (char *)globalAlloc(GMEM_FIXED | GMEM_ZEROINIT, len + 1);
+ if (lpmsScript->_command[curCmd].lpszVarName == NULL)
return NULL;
- CopyMemory(lpmsScript->Command[curCmd].lpszVarName, lpBuf, len);
+ copyMemory(lpmsScript->_command[curCmd].lpszVarName, lpBuf, len);
lpBuf += len;
- lpBuf = ParseExpression(lpBuf, &lpmsScript->Command[curCmd].expr);
+ lpBuf = parseExpression(lpBuf, &lpmsScript->_command[curCmd].expr);
if (lpBuf == NULL)
return NULL;
break;
@@ -129,7 +129,7 @@ static const byte *ParseScript(const byte *lpBuf, LPMPALSCRIPT lpmsScript) {
* data of the dialog.
* @returns Pointer to the buffer after the item, or NULL on failure.
*/
-static const byte *ParseDialog(const byte *lpBuf, LPMPALDIALOG lpmdDialog) {
+static const byte *parseDialog(const byte *lpBuf, LPMPALDIALOG lpmdDialog) {
uint32 i, j, z, kk;
uint32 num, num2, num3;
byte *lpLock;
@@ -147,17 +147,17 @@ static const byte *ParseDialog(const byte *lpBuf, LPMPALDIALOG lpmdDialog) {
error("Too much periods in dialog #%d", lpmdDialog->nObj);
for (i = 0; i < num; i++) {
- lpmdDialog->PeriodNums[i] = READ_LE_UINT16(lpBuf);
+ lpmdDialog->_periodNums[i] = READ_LE_UINT16(lpBuf);
lpBuf += 2;
- lpmdDialog->Periods[i] = GlobalAlloc(GMEM_MOVEABLE | GMEM_ZEROINIT, *lpBuf + 1);
- lpLock = (byte *)GlobalLock(lpmdDialog->Periods[i]);
+ lpmdDialog->_periods[i] = globalAlloc(GMEM_MOVEABLE | GMEM_ZEROINIT, *lpBuf + 1);
+ lpLock = (byte *)globalLock(lpmdDialog->_periods[i]);
Common::copy(lpBuf + 1, lpBuf + 1 + *lpBuf, lpLock);
- GlobalUnlock(lpmdDialog->Periods[i]);
+ globalUnlock(lpmdDialog->_periods[i]);
lpBuf += (*lpBuf) + 1;
}
- lpmdDialog->PeriodNums[i] = 0;
- lpmdDialog->Periods[i] = NULL;
+ lpmdDialog->_periodNums[i] = 0;
+ lpmdDialog->_periods[i] = NULL;
/* Gruppi */
num = READ_LE_UINT16(lpBuf);
@@ -168,29 +168,29 @@ static const byte *ParseDialog(const byte *lpBuf, LPMPALDIALOG lpmdDialog) {
error("Too much groups in dialog #%d", lpmdDialog->nObj);
for (i = 0; i < num; i++) {
- lpmdDialog->Group[i].num = READ_LE_UINT16(lpBuf);
+ lpmdDialog->_group[i].num = READ_LE_UINT16(lpBuf);
lpBuf += 2;
- lpmdDialog->Group[i].nCmds = *lpBuf; lpBuf++;
+ lpmdDialog->_group[i].nCmds = *lpBuf; lpBuf++;
- if (lpmdDialog->Group[i].nCmds >= MAX_COMMANDS_PER_GROUP)
- error("Too much commands in group #%d in dialog #%d",lpmdDialog->Group[i].num,lpmdDialog->nObj);
+ if (lpmdDialog->_group[i].nCmds >= MAX_COMMANDS_PER_GROUP)
+ error("Too much commands in group #%d in dialog #%d",lpmdDialog->_group[i].num,lpmdDialog->nObj);
- for (j = 0; j < lpmdDialog->Group[i].nCmds; j++) {
- lpmdDialog->Command[curCmd].type = *lpBuf;
+ for (j = 0; j < lpmdDialog->_group[i].nCmds; j++) {
+ lpmdDialog->_command[curCmd].type = *lpBuf;
lpBuf++;
- switch (lpmdDialog->Command[curCmd].type) {
+ switch (lpmdDialog->_command[curCmd].type) {
// Call custom function
case 1:
- lpmdDialog->Command[curCmd].nCf = READ_LE_UINT16(lpBuf);
+ lpmdDialog->_command[curCmd].nCf = READ_LE_UINT16(lpBuf);
lpBuf += 2;
- lpmdDialog->Command[curCmd].arg1 = READ_LE_UINT32(lpBuf);
+ lpmdDialog->_command[curCmd].arg1 = READ_LE_UINT32(lpBuf);
lpBuf += 4;
- lpmdDialog->Command[curCmd].arg2 = READ_LE_UINT32(lpBuf);
+ lpmdDialog->_command[curCmd].arg2 = READ_LE_UINT32(lpBuf);
lpBuf += 4;
- lpmdDialog->Command[curCmd].arg3 = READ_LE_UINT32(lpBuf);
+ lpmdDialog->_command[curCmd].arg3 = READ_LE_UINT32(lpBuf);
lpBuf += 4;
- lpmdDialog->Command[curCmd].arg4 = READ_LE_UINT32(lpBuf);
+ lpmdDialog->_command[curCmd].arg4 = READ_LE_UINT32(lpBuf);
lpBuf += 4;
break;
@@ -198,21 +198,21 @@ static const byte *ParseDialog(const byte *lpBuf, LPMPALDIALOG lpmdDialog) {
case 2:
len = *lpBuf;
lpBuf++;
- lpmdDialog->Command[curCmd].lpszVarName = (char *)GlobalAlloc(GMEM_FIXED | GMEM_ZEROINIT, len + 1);
- if (lpmdDialog->Command[curCmd].lpszVarName == NULL)
+ lpmdDialog->_command[curCmd].lpszVarName = (char *)globalAlloc(GMEM_FIXED | GMEM_ZEROINIT, len + 1);
+ if (lpmdDialog->_command[curCmd].lpszVarName == NULL)
return NULL;
- Common::copy(lpBuf, lpBuf + len, lpmdDialog->Command[curCmd].lpszVarName);
+ Common::copy(lpBuf, lpBuf + len, lpmdDialog->_command[curCmd].lpszVarName);
lpBuf += len;
- lpBuf = ParseExpression(lpBuf, &lpmdDialog->Command[curCmd].expr);
+ lpBuf = parseExpression(lpBuf, &lpmdDialog->_command[curCmd].expr);
if (lpBuf == NULL)
return NULL;
break;
// Do Choice
case 3:
- lpmdDialog->Command[curCmd].nChoice = READ_LE_UINT16(lpBuf);
+ lpmdDialog->_command[curCmd].nChoice = READ_LE_UINT16(lpBuf);
lpBuf += 2;
break;
@@ -221,14 +221,14 @@ static const byte *ParseDialog(const byte *lpBuf, LPMPALDIALOG lpmdDialog) {
}
for (kk = 0;kk < curCmd; kk++) {
- if (CompareCommands(&lpmdDialog->Command[kk], &lpmdDialog->Command[curCmd])) {
- lpmdDialog->Group[i].CmdNum[j] = kk;
+ if (compareCommands(&lpmdDialog->_command[kk], &lpmdDialog->_command[curCmd])) {
+ lpmdDialog->_group[i].CmdNum[j] = kk;
break;
}
}
if (kk == curCmd) {
- lpmdDialog->Group[i].CmdNum[j] = curCmd;
+ lpmdDialog->_group[i].CmdNum[j] = curCmd;
curCmd++;
}
}
@@ -245,23 +245,23 @@ static const byte *ParseDialog(const byte *lpBuf, LPMPALDIALOG lpmdDialog) {
error("Too much choices in dialog #%d",lpmdDialog->nObj);
for (i = 0; i < num; i++) {
- lpmdDialog->Choice[i].nChoice = READ_LE_UINT16(lpBuf);
+ lpmdDialog->_choice[i].nChoice = READ_LE_UINT16(lpBuf);
lpBuf += 2;
num2 = *lpBuf++;
if (num2 >= MAX_SELECTS_PER_CHOICE)
- error("Too much selects in choice #%d in dialog #%d",lpmdDialog->Choice[i].nChoice,lpmdDialog->nObj);
+ error("Too much selects in choice #%d in dialog #%d", lpmdDialog->_choice[i].nChoice, lpmdDialog->nObj);
for (j = 0; j < num2; j++) {
// When
switch (*lpBuf++) {
case 0:
- lpmdDialog->Choice[i].Select[j].when = NULL;
+ lpmdDialog->_choice[i]._select[j].when = NULL;
break;
case 1:
- lpBuf = ParseExpression(lpBuf,&lpmdDialog->Choice[i].Select[j].when);
+ lpBuf = parseExpression(lpBuf, &lpmdDialog->_choice[i]._select[j].when);
if (lpBuf == NULL)
return NULL;
break;
@@ -271,31 +271,31 @@ static const byte *ParseDialog(const byte *lpBuf, LPMPALDIALOG lpmdDialog) {
}
// Attrib
- lpmdDialog->Choice[i].Select[j].attr = *lpBuf++;
+ lpmdDialog->_choice[i]._select[j].attr = *lpBuf++;
// Data
- lpmdDialog->Choice[i].Select[j].dwData = READ_LE_UINT32(lpBuf);
+ lpmdDialog->_choice[i]._select[j].dwData = READ_LE_UINT32(lpBuf);
lpBuf += 4;
// PlayGroup
num3 = *lpBuf++;
if (num3 >= MAX_PLAYGROUPS_PER_SELECT)
- error("Too much playgroups in select #%d in choice #%d in dialog #%d", j, lpmdDialog->Choice[i].nChoice, lpmdDialog->nObj);
+ error("Too much playgroups in select #%d in choice #%d in dialog #%d", j, lpmdDialog->_choice[i].nChoice, lpmdDialog->nObj);
for (z = 0; z < num3; z++) {
- lpmdDialog->Choice[i].Select[j].wPlayGroup[z] = READ_LE_UINT16(lpBuf);
+ lpmdDialog->_choice[i]._select[j].wPlayGroup[z] = READ_LE_UINT16(lpBuf);
lpBuf += 2;
}
- lpmdDialog->Choice[i].Select[j].wPlayGroup[num3] = 0;
+ lpmdDialog->_choice[i]._select[j].wPlayGroup[num3] = 0;
}
// Mark the last selection
- lpmdDialog->Choice[i].Select[num2].dwData = 0;
+ lpmdDialog->_choice[i]._select[num2].dwData = 0;
}
- lpmdDialog->Choice[num].nChoice = 0;
+ lpmdDialog->_choice[num].nChoice = 0;
return lpBuf;
}
@@ -311,7 +311,7 @@ static const byte *ParseDialog(const byte *lpBuf, LPMPALDIALOG lpmdDialog) {
* @remarks It's necessary that the structure that is passed has been
* completely initialised to 0 beforehand.
*/
-static const byte *ParseItem(const byte *lpBuf, LPMPALITEM lpmiItem) {
+static const byte *parseItem(const byte *lpBuf, LPMPALITEM lpmiItem) {
byte len;
uint32 i, j, kk;
uint32 curCmd;
@@ -321,7 +321,7 @@ static const byte *ParseItem(const byte *lpBuf, LPMPALITEM lpmiItem) {
len = *lpBuf;
lpBuf++;
- CopyMemory(lpmiItem->lpszDescribe, lpBuf, MIN((byte)127, len));
+ copyMemory(lpmiItem->lpszDescribe, lpBuf, MIN((byte)127, len));
lpBuf += len;
if (len >= MAX_DESCRIBE_SIZE)
@@ -332,7 +332,7 @@ static const byte *ParseItem(const byte *lpBuf, LPMPALITEM lpmiItem) {
/* Alloca le azioni */
if (lpmiItem->nActions > 0)
- lpmiItem->Action = (ItemAction *)GlobalAlloc(GMEM_FIXED | GMEM_ZEROINIT, sizeof(struct ItemAction) * (int)lpmiItem->nActions);
+ lpmiItem->Action = (ItemAction *)globalAlloc(GMEM_FIXED | GMEM_ZEROINIT, sizeof(struct ItemAction) * (int)lpmiItem->nActions);
curCmd = 0;
@@ -357,7 +357,7 @@ static const byte *ParseItem(const byte *lpBuf, LPMPALITEM lpmiItem) {
lpmiItem->Action[i].when = NULL;
} else {
lpBuf++;
- lpBuf = ParseExpression(lpBuf,&lpmiItem->Action[i].when);
+ lpBuf = parseExpression(lpBuf,&lpmiItem->Action[i].when);
if (lpBuf == NULL)
return NULL;
}
@@ -369,32 +369,32 @@ static const byte *ParseItem(const byte *lpBuf, LPMPALITEM lpmiItem) {
error("Too much commands in action #%d in item #%d",lpmiItem->Action[i].num,lpmiItem->nObj);
for (j = 0; j < lpmiItem->Action[i].nCmds; j++) {
- lpmiItem->Command[curCmd].type = *lpBuf;
+ lpmiItem->_command[curCmd].type = *lpBuf;
lpBuf++;
- switch (lpmiItem->Command[curCmd].type) {
+ switch (lpmiItem->_command[curCmd].type) {
case 1: // Call custom function
- lpmiItem->Command[curCmd].nCf = READ_LE_UINT16(lpBuf);
+ lpmiItem->_command[curCmd].nCf = READ_LE_UINT16(lpBuf);
lpBuf += 2;
- lpmiItem->Command[curCmd].arg1 = (int32)READ_LE_UINT32(lpBuf);
+ lpmiItem->_command[curCmd].arg1 = (int32)READ_LE_UINT32(lpBuf);
lpBuf += 4;
- lpmiItem->Command[curCmd].arg2 = (int32)READ_LE_UINT32(lpBuf);
+ lpmiItem->_command[curCmd].arg2 = (int32)READ_LE_UINT32(lpBuf);
lpBuf += 4;
- lpmiItem->Command[curCmd].arg3 = (int32)READ_LE_UINT32(lpBuf);
+ lpmiItem->_command[curCmd].arg3 = (int32)READ_LE_UINT32(lpBuf);
lpBuf += 4;
- lpmiItem->Command[curCmd].arg4 = (int32)READ_LE_UINT32(lpBuf);
+ lpmiItem->_command[curCmd].arg4 = (int32)READ_LE_UINT32(lpBuf);
lpBuf += 4;
break;
case 2: // Variable assign
len = *lpBuf;
lpBuf++;
- lpmiItem->Command[curCmd].lpszVarName = (char *)GlobalAlloc(GMEM_FIXED | GMEM_ZEROINIT, len + 1);
- if (lpmiItem->Command[curCmd].lpszVarName == NULL)
+ lpmiItem->_command[curCmd].lpszVarName = (char *)globalAlloc(GMEM_FIXED | GMEM_ZEROINIT, len + 1);
+ if (lpmiItem->_command[curCmd].lpszVarName == NULL)
return NULL;
- CopyMemory(lpmiItem->Command[curCmd].lpszVarName, lpBuf, len);
+ copyMemory(lpmiItem->_command[curCmd].lpszVarName, lpBuf, len);
lpBuf += len;
- lpBuf=ParseExpression(lpBuf, &lpmiItem->Command[curCmd].expr);
+ lpBuf = parseExpression(lpBuf, &lpmiItem->_command[curCmd].expr);
if (lpBuf == NULL)
return NULL;
break;
@@ -404,7 +404,7 @@ static const byte *ParseItem(const byte *lpBuf, LPMPALITEM lpmiItem) {
}
for (kk = 0; kk < curCmd; kk++) {
- if (CompareCommands(&lpmiItem->Command[kk],&lpmiItem->Command[curCmd])) {
+ if (compareCommands(&lpmiItem->_command[kk], &lpmiItem->_command[curCmd])) {
lpmiItem->Action[i].CmdNum[j] = kk;
break;
}
@@ -478,16 +478,16 @@ bool ParseMpc(const byte *lpBuf) {
GLOBALS.nVars = READ_LE_UINT16(lpBuf);
lpBuf += 2;
- GLOBALS.hVars = GlobalAlloc(GMEM_MOVEABLE | GMEM_ZEROINIT, sizeof(MPALVAR) * (uint32)GLOBALS.nVars);
+ GLOBALS.hVars = globalAlloc(GMEM_MOVEABLE | GMEM_ZEROINIT, sizeof(MPALVAR) * (uint32)GLOBALS.nVars);
if (GLOBALS.hVars == NULL)
return false;
- GLOBALS.lpmvVars = (LPMPALVAR)GlobalLock(GLOBALS.hVars);
+ GLOBALS.lpmvVars = (LPMPALVAR)globalLock(GLOBALS.hVars);
for (i = 0; i < GLOBALS.nVars; i++) {
wLen = *(const byte *)lpBuf;
lpBuf++;
- CopyMemory(GLOBALS.lpmvVars->lpszVarName, lpBuf, MIN(wLen, (uint16)32));
+ copyMemory(GLOBALS.lpmvVars->lpszVarName, lpBuf, MIN(wLen, (uint16)32));
lpBuf += wLen;
GLOBALS.lpmvVars->dwVal = READ_LE_UINT32(lpBuf);
lpBuf += 4;
@@ -496,7 +496,7 @@ bool ParseMpc(const byte *lpBuf) {
GLOBALS.lpmvVars++;
}
- GlobalUnlock(GLOBALS.hVars);
+ globalUnlock(GLOBALS.hVars);
/* 2. Messages */
if (lpBuf[0] != 'M' || lpBuf[1] != 'S' || lpBuf[2] != 'G' || lpBuf[3] != 'S')
@@ -507,11 +507,11 @@ bool ParseMpc(const byte *lpBuf) {
lpBuf += 2;
#ifdef NEED_LOCK_MSGS
- GLOBALS.hMsgs = GlobalAlloc(GMEM_MOVEABLE | GMEM_ZEROINIT, sizeof(MPALMSG) * (uint32)GLOBALS.nMsgs);
+ GLOBALS.hMsgs = globalAlloc(GMEM_MOVEABLE | GMEM_ZEROINIT, sizeof(MPALMSG) * (uint32)GLOBALS.nMsgs);
if (GLOBALS.hMsgs == NULL)
return false;
- GLOBALS.lpmmMsgs = (LPMPALMSG)GlobalLock(GLOBALS.hMsgs);
+ GLOBALS.lpmmMsgs = (LPMPALMSG)globalLock(GLOBALS.hMsgs);
#else
GLOBALS.lpmmMsgs=(LPMPALMSG)GlobalAlloc(GMEM_FIXED|GMEM_ZEROINIT,sizeof(MPALMSG)*(uint32)GLOBALS.nMsgs);
if (GLOBALS.lpmmMsgs==NULL)
@@ -525,11 +525,11 @@ bool ParseMpc(const byte *lpBuf) {
for (j = 0; lpBuf[j] != 0;)
j += lpBuf[j] + 1;
- GLOBALS.lpmmMsgs->hText = GlobalAlloc(GMEM_MOVEABLE | GMEM_ZEROINIT, j + 1);
- lpTemp2 = lpTemp = (byte *)GlobalLock(GLOBALS.lpmmMsgs->hText);
+ GLOBALS.lpmmMsgs->hText = globalAlloc(GMEM_MOVEABLE | GMEM_ZEROINIT, j + 1);
+ lpTemp2 = lpTemp = (byte *)globalLock(GLOBALS.lpmmMsgs->hText);
for (j = 0; lpBuf[j] != 0;) {
- CopyMemory(lpTemp, &lpBuf[j + 1], lpBuf[j]);
+ copyMemory(lpTemp, &lpBuf[j + 1], lpBuf[j]);
lpTemp += lpBuf[j];
*lpTemp ++= '\0';
j += lpBuf[j] + 1;
@@ -538,12 +538,12 @@ bool ParseMpc(const byte *lpBuf) {
lpBuf += j + 1;
*lpTemp = '\0';
- GlobalUnlock(GLOBALS.lpmmMsgs->hText);
+ globalUnlock(GLOBALS.lpmmMsgs->hText);
GLOBALS.lpmmMsgs++;
}
#ifdef NEED_LOCK_MSGS
- GlobalUnlock(GLOBALS.hMsgs);
+ globalUnlock(GLOBALS.hMsgs);
#endif
/* 3. Objects */
@@ -560,17 +560,17 @@ bool ParseMpc(const byte *lpBuf) {
if (*((const byte *)lpBuf + 2) == 6 && strncmp((const char *)lpBuf + 3, "Dialog", 6) == 0) {
GLOBALS.nDialogs = READ_LE_UINT16(lpBuf); lpBuf += 2;
- GLOBALS.hDialogs = GlobalAlloc(GMEM_MOVEABLE | GMEM_ZEROINIT, (uint32)GLOBALS.nDialogs * sizeof(MPALDIALOG));
+ GLOBALS.hDialogs = globalAlloc(GMEM_MOVEABLE | GMEM_ZEROINIT, (uint32)GLOBALS.nDialogs * sizeof(MPALDIALOG));
if (GLOBALS.hDialogs == NULL)
return false;
- GLOBALS.lpmdDialogs = (LPMPALDIALOG)GlobalLock(GLOBALS.hDialogs);
+ GLOBALS.lpmdDialogs = (LPMPALDIALOG)globalLock(GLOBALS.hDialogs);
for (i = 0;i < GLOBALS.nDialogs; i++)
- if ((lpBuf = ParseDialog(lpBuf + 7, &GLOBALS.lpmdDialogs[i])) == NULL)
+ if ((lpBuf = parseDialog(lpBuf + 7, &GLOBALS.lpmdDialogs[i])) == NULL)
return false;
- GlobalUnlock(GLOBALS.hDialogs);
+ globalUnlock(GLOBALS.hDialogs);
}
// Check the items
@@ -581,17 +581,17 @@ bool ParseMpc(const byte *lpBuf) {
lpBuf += 2;
// Allocate memory and read them in
- GLOBALS.hItems = GlobalAlloc(GMEM_MOVEABLE | GMEM_ZEROINIT, (uint32)GLOBALS.nItems * sizeof(MPALITEM));
+ GLOBALS.hItems = globalAlloc(GMEM_MOVEABLE | GMEM_ZEROINIT, (uint32)GLOBALS.nItems * sizeof(MPALITEM));
if (GLOBALS.hItems == NULL)
return false;
- GLOBALS.lpmiItems = (LPMPALITEM)GlobalLock(GLOBALS.hItems);
+ GLOBALS.lpmiItems = (LPMPALITEM)globalLock(GLOBALS.hItems);
for (i = 0; i < GLOBALS.nItems; i++)
- if ((lpBuf = ParseItem(lpBuf + 5, &GLOBALS.lpmiItems[i])) == NULL)
+ if ((lpBuf = parseItem(lpBuf + 5, &GLOBALS.lpmiItems[i])) == NULL)
return false;
- GlobalUnlock(GLOBALS.hItems);
+ globalUnlock(GLOBALS.hItems);
}
// Check the locations
@@ -602,17 +602,17 @@ bool ParseMpc(const byte *lpBuf) {
lpBuf += 2;
// Allocate memory and read them in
- GLOBALS.hLocations=GlobalAlloc(GMEM_MOVEABLE | GMEM_ZEROINIT, (uint32)GLOBALS.nLocations*sizeof(MPALLOCATION));
+ GLOBALS.hLocations = globalAlloc(GMEM_MOVEABLE | GMEM_ZEROINIT, (uint32)GLOBALS.nLocations*sizeof(MPALLOCATION));
if (GLOBALS.hLocations == NULL)
return false;
- GLOBALS.lpmlLocations = (LPMPALLOCATION)GlobalLock(GLOBALS.hLocations);
+ GLOBALS.lpmlLocations = (LPMPALLOCATION)globalLock(GLOBALS.hLocations);
for (i = 0; i < GLOBALS.nLocations; i++)
if ((lpBuf = ParseLocation(lpBuf + 9, &GLOBALS.lpmlLocations[i])) == NULL)
return false;
- GlobalUnlock(GLOBALS.hLocations);
+ globalUnlock(GLOBALS.hLocations);
}
// Check the scripts
@@ -623,11 +623,11 @@ bool ParseMpc(const byte *lpBuf) {
lpBuf += 2;
// Allocate memory
- GLOBALS.hScripts = GlobalAlloc(GMEM_MOVEABLE | GMEM_ZEROINIT, (uint32)GLOBALS.nScripts * sizeof(MPALSCRIPT));
+ GLOBALS.hScripts = globalAlloc(GMEM_MOVEABLE | GMEM_ZEROINIT, (uint32)GLOBALS.nScripts * sizeof(MPALSCRIPT));
if (GLOBALS.hScripts == NULL)
return false;
- GLOBALS.lpmsScripts = (LPMPALSCRIPT)GlobalLock(GLOBALS.hScripts);
+ GLOBALS.lpmsScripts = (LPMPALSCRIPT)globalLock(GLOBALS.hScripts);
for (i = 0; i < GLOBALS.nScripts; i++) {
if ((lpBuf = ParseScript(lpBuf + 7, &GLOBALS.lpmsScripts[i])) == NULL)
@@ -642,7 +642,7 @@ bool ParseMpc(const byte *lpBuf) {
//);
}
- GlobalUnlock(GLOBALS.hScripts);
+ globalUnlock(GLOBALS.hScripts);
}
if (lpBuf[0] != 'E' || lpBuf[1] != 'N' || lpBuf[2] != 'D' || lpBuf[3] != '0')
diff --git a/engines/tony/mpal/memory.cpp b/engines/tony/mpal/memory.cpp
index 04cb906431..b5bd77f838 100644
--- a/engines/tony/mpal/memory.cpp
+++ b/engines/tony/mpal/memory.cpp
@@ -53,7 +53,7 @@ MemoryItem::~MemoryItem() {
* Returns a pointer to the resource
*/
MemoryItem::operator void *() {
- return DataPointer();
+ return dataPointer();
}
/****************************************************************************\
@@ -81,7 +81,7 @@ MemoryManager::~MemoryManager() {
MemoryItem &MemoryManager::allocate(uint32 size, uint flags) {
MemoryItem *newItem = new MemoryItem(size);
if ((flags & GMEM_ZEROINIT) != 0) {
- byte *dataP = (byte *)newItem->DataPointer();
+ byte *dataP = (byte *)newItem->dataPointer();
Common::fill(dataP, dataP + size, 0);
}
@@ -96,7 +96,7 @@ MemoryItem &MemoryManager::allocate(uint32 size, uint flags) {
*/
HGLOBAL MemoryManager::alloc(uint32 size, uint flags) {
MemoryItem &newItem = allocate(size, flags);
- return (HGLOBAL)newItem.DataPointer();
+ return (HGLOBAL)newItem.dataPointer();
}
/**
@@ -107,7 +107,7 @@ MemoryItem &MemoryManager::getItem(HGLOBAL handle) {
Common::List<MemoryItem *>::iterator i;
for (i = _memoryBlocks.begin(); i != _memoryBlocks.end(); ++i) {
MemoryItem *item = *i;
- if (item->DataPointer() == handle)
+ if (item->dataPointer() == handle)
return *item;
}
@@ -127,7 +127,7 @@ MemoryItem &MemoryManager::operator[](HGLOBAL handle) {
*/
uint32 MemoryManager::getSize(HGLOBAL handle) {
MemoryItem &item = getItem(handle);
- return item.Size();
+ return item.size();
}
/**
@@ -150,7 +150,7 @@ void MemoryManager::erase(HGLOBAL handle) {
* Stand-alone methods
\****************************************************************************/
-void CopyMemory(void *dst, const void *first, int size) {
+void copyMemory(void *dst, const void *first, int size) {
Common::copy((const byte *)first, (const byte *)first + size, (byte *)dst);
}
diff --git a/engines/tony/mpal/memory.h b/engines/tony/mpal/memory.h
index 8d8411c6a1..7f95f8d86f 100644
--- a/engines/tony/mpal/memory.h
+++ b/engines/tony/mpal/memory.h
@@ -42,9 +42,9 @@ public:
MemoryItem(uint32 size);
virtual ~MemoryItem();
- uint32 Size() { return _size; }
- void *DataPointer() { return (void *)_buffer; }
- bool IsValid() { return _buffer != NULL; }
+ uint32 size() { return _size; }
+ void *dataPointer() { return (void *)_buffer; }
+ bool isValid() { return _buffer != NULL; }
// Casting for access to data
operator void *();
@@ -68,19 +68,19 @@ public:
};
// defines
-#define GlobalAlloc(flags, size) _vm->_memoryManager.alloc(size, flags)
-#define GlobalAllocate(size) _vm->_memoryManager.allocate(size, 0)
-#define GlobalFree(handle) _vm->_memoryManager.erase(handle)
-#define GlobalLock(handle) (_vm->_memoryManager.getItem(handle).DataPointer())
-#define GlobalUnlock(handle) {}
-#define GlobalSize(handle) (_vm->_memoryManager.getItem(handle).Size())
+#define globalAlloc(flags, size) _vm->_memoryManager.alloc(size, flags)
+#define globalAllocate(size) _vm->_memoryManager.allocate(size, 0)
+#define globalFree(handle) _vm->_memoryManager.erase(handle)
+#define globalLock(handle) (_vm->_memoryManager.getItem(handle).dataPointer())
+#define globalUnlock(handle) {}
+#define globalSize(handle) (_vm->_memoryManager.getItem(handle).size())
#define GMEM_FIXED 1
#define GMEM_MOVEABLE 2
#define GMEM_ZEROINIT 4
// Stand-alone methods
-extern void CopyMemory(void *dst, const void *first, int size);
+extern void copyMemory(void *dst, const void *first, int size);
} // end of namespace MPAL
diff --git a/engines/tony/mpal/mpal.cpp b/engines/tony/mpal/mpal.cpp
index 16c530206c..95c0b067d5 100644
--- a/engines/tony/mpal/mpal.cpp
+++ b/engines/tony/mpal/mpal.cpp
@@ -59,16 +59,16 @@ const char *mpalCopyright =
/**
* Locks the variables for access
*/
-void LockVar(void) {
- GLOBALS.lpmvVars = (LPMPALVAR)GlobalLock(GLOBALS.hVars);
+void lockVar(void) {
+ GLOBALS.lpmvVars = (LPMPALVAR)globalLock(GLOBALS.hVars);
}
/**
* Unlocks variables after use
*/
-void UnlockVar(void) {
- GlobalUnlock(GLOBALS.hVars);
+void unlockVar(void) {
+ globalUnlock(GLOBALS.hVars);
}
@@ -77,7 +77,7 @@ void UnlockVar(void) {
*/
static void LockMsg(void) {
#ifdef NEED_LOCK_MSGS
- GLOBALS.lpmmMsgs = (LPMPALMSG)GlobalLock(GLOBALS.hMsgs);
+ GLOBALS.lpmmMsgs = (LPMPALMSG)globalLock(GLOBALS.hMsgs);
#endif
}
@@ -87,7 +87,7 @@ static void LockMsg(void) {
*/
static void UnlockMsg(void) {
#ifdef NEED_LOCK_MSGS
- GlobalUnlock(GLOBALS.hMsgs);
+ globalUnlock(GLOBALS.hMsgs);
#endif
}
@@ -95,48 +95,48 @@ static void UnlockMsg(void) {
/**
* Locks the dialogs for access
*/
-static void LockDialogs(void) {
- GLOBALS.lpmdDialogs = (LPMPALDIALOG)GlobalLock(GLOBALS.hDialogs);
+static void lockDialogs(void) {
+ GLOBALS.lpmdDialogs = (LPMPALDIALOG)globalLock(GLOBALS.hDialogs);
}
/**
* Unlocks the dialogs after use
*/
-static void UnlockDialogs(void) {
- GlobalUnlock(GLOBALS.hDialogs);
+static void unlockDialogs(void) {
+ globalUnlock(GLOBALS.hDialogs);
}
/**
* Locks the location data structures for access
*/
-static void LockLocations(void) {
- GLOBALS.lpmlLocations = (LPMPALLOCATION)GlobalLock(GLOBALS.hLocations);
+static void lockLocations(void) {
+ GLOBALS.lpmlLocations = (LPMPALLOCATION)globalLock(GLOBALS.hLocations);
}
/**
* Unlocks the location structures after use
*/
-static void UnlockLocations(void) {
- GlobalUnlock(GLOBALS.hLocations);
+static void unlockLocations(void) {
+ globalUnlock(GLOBALS.hLocations);
}
/**
* Locks the items structures for use
*/
-static void LockItems(void) {
- GLOBALS.lpmiItems = (LPMPALITEM)GlobalLock(GLOBALS.hItems);
+static void lockItems(void) {
+ GLOBALS.lpmiItems = (LPMPALITEM)globalLock(GLOBALS.hItems);
}
/**
* Unlocks the items structures after use
*/
-static void UnlockItems(void) {
- GlobalUnlock(GLOBALS.hItems);
+static void unlockItems(void) {
+ globalUnlock(GLOBALS.hItems);
}
@@ -144,15 +144,15 @@ static void UnlockItems(void) {
* Locks the script data structures for use
*/
static void LockScripts(void) {
- GLOBALS.lpmsScripts = (LPMPALSCRIPT)GlobalLock(GLOBALS.hScripts);
+ GLOBALS.lpmsScripts = (LPMPALSCRIPT)globalLock(GLOBALS.hScripts);
}
/**
* Unlocks the script data structures after use
*/
-static void UnlockScripts(void) {
- GlobalUnlock(GLOBALS.hScripts);
+static void unlockScripts(void) {
+ globalUnlock(GLOBALS.hScripts);
}
@@ -161,7 +161,7 @@ static void UnlockScripts(void) {
*
* @param lpszVarName Name of the variable
* @returns Current value
- * @remarks Before using this method, you must call LockVar() to
+ * @remarks Before using this method, you must call lockVar() to
* lock the global variablves for use. Then afterwards, you will
* need to remember to call UnlockVar()
*/
@@ -316,19 +316,19 @@ static char *DuplicateMessage(uint32 nMsgOrd) {
if (nMsgOrd == (uint32)-1)
return NULL;
- origmsg = (const char *)GlobalLock(GLOBALS.lpmmMsgs[nMsgOrd].hText);
+ origmsg = (const char *)globalLock(GLOBALS.lpmmMsgs[nMsgOrd].hText);
j = 0;
while (origmsg[j] != '\0' || origmsg[j + 1] != '\0')
j++;
j += 2;
- clonemsg = (char *)GlobalAlloc(GMEM_FIXED | GMEM_ZEROINIT, j);
+ clonemsg = (char *)globalAlloc(GMEM_FIXED | GMEM_ZEROINIT, j);
if (clonemsg == NULL)
return NULL;
- CopyMemory(clonemsg, origmsg, j);
- GlobalUnlock(GLOBALS.lpmmMsgs[nMsgOrd].hText);
+ copyMemory(clonemsg, origmsg, j);
+ globalUnlock(GLOBALS.lpmmMsgs[nMsgOrd].hText);
return clonemsg;
}
@@ -341,28 +341,28 @@ static char *DuplicateMessage(uint32 nMsgOrd) {
* @returns Pointer to the duplicated phrase. Remember to free it
* when done with it.
*/
-static char *DuplicateDialogPeriod(uint32 nPeriod) {
+static char *duplicateDialogPeriod(uint32 nPeriod) {
const char *origmsg;
char *clonemsg;
LPMPALDIALOG dialog = GLOBALS.lpmdDialogs + GLOBALS.nExecutingDialog;
int i, j;
- for (j = 0; dialog->Periods[j] != NULL; j++)
- if (dialog->PeriodNums[j] == nPeriod) {
+ for (j = 0; dialog->_periods[j] != NULL; j++)
+ if (dialog->_periodNums[j] == nPeriod) {
/* Found the phrase, it should be duplicated */
- origmsg = (const char *)GlobalLock(dialog->Periods[j]);
+ origmsg = (const char *)globalLock(dialog->_periods[j]);
/* Calculate the length and allocate memory */
i = 0;
while (origmsg[i] != '\0') i++;
- clonemsg = (char *)GlobalAlloc(GMEM_FIXED | GMEM_ZEROINIT, i + 1);
+ clonemsg = (char *)globalAlloc(GMEM_FIXED | GMEM_ZEROINIT, i + 1);
if (clonemsg == NULL)
return NULL;
- CopyMemory(clonemsg, origmsg, i);
+ copyMemory(clonemsg, origmsg, i);
- GlobalUnlock(dialog->Periods[j]);
+ globalUnlock(dialog->_periods[j]);
return clonemsg;
}
@@ -402,9 +402,9 @@ HGLOBAL resLoad(uint32 dwId) {
if (GLOBALS.hMpr.err())
return NULL;
- h = GlobalAlloc(GMEM_MOVEABLE | GMEM_ZEROINIT, nSizeDecomp + (nSizeDecomp / 1024) * 16);
- buf = (byte *)GlobalLock(h);
- temp = (byte *)GlobalAlloc(GMEM_FIXED | GMEM_ZEROINIT,nSizeComp);
+ h = globalAlloc(GMEM_MOVEABLE | GMEM_ZEROINIT, nSizeDecomp + (nSizeDecomp / 1024) * 16);
+ buf = (byte *)globalLock(h);
+ temp = (byte *)globalAlloc(GMEM_FIXED | GMEM_ZEROINIT,nSizeComp);
nBytesRead = GLOBALS.hMpr.read(temp, nSizeComp);
if (nBytesRead != nSizeComp)
@@ -414,38 +414,38 @@ HGLOBAL resLoad(uint32 dwId) {
if (nBytesRead != nSizeDecomp)
return NULL;
- GlobalFree(temp);
- GlobalUnlock(h);
+ globalFree(temp);
+ globalUnlock(h);
return h;
}
return NULL;
}
-static uint32 *GetSelectList(uint32 i) {
+static uint32 *getSelectList(uint32 i) {
uint32 *sl;
- int j,k,num;
- LPMPALDIALOG dialog=GLOBALS.lpmdDialogs+GLOBALS.nExecutingDialog;
+ int j, k, num;
+ LPMPALDIALOG dialog = GLOBALS.lpmdDialogs+GLOBALS.nExecutingDialog;
/* Count how many are active selects */
num = 0;
- for (j = 0; dialog->Choice[i].Select[j].dwData != 0; j++)
- if (dialog->Choice[i].Select[j].curActive)
+ for (j = 0; dialog->_choice[i]._select[j].dwData != 0; j++)
+ if (dialog->_choice[i]._select[j].curActive)
num++;
/* If there are 0, it's a mistake */
if (num == 0)
return NULL;
- sl= (uint32 *)GlobalAlloc(GMEM_FIXED | GMEM_ZEROINIT, sizeof(uint32) * (num + 1));
+ sl= (uint32 *)globalAlloc(GMEM_FIXED | GMEM_ZEROINIT, sizeof(uint32) * (num + 1));
if (sl == NULL)
return NULL;
/* Copy all the data inside the active select list */
k = 0;
- for (j = 0; dialog->Choice[i].Select[j].dwData != 0; j++)
- if (dialog->Choice[i].Select[j].curActive)
- sl[k++] = dialog->Choice[i].Select[j].dwData;
+ for (j = 0; dialog->_choice[i]._select[j].dwData != 0; j++)
+ if (dialog->_choice[i]._select[j].curActive)
+ sl[k++] = dialog->_choice[i]._select[j].dwData;
sl[k] = (uint32)NULL;
return sl;
@@ -462,7 +462,7 @@ static uint32 *GetItemList(uint32 nLoc) {
num++;
}
- il = (uint32 *)GlobalAlloc(GMEM_FIXED | GMEM_ZEROINIT, sizeof(uint32) * (num + 1));
+ il = (uint32 *)globalAlloc(GMEM_FIXED | GMEM_ZEROINIT, sizeof(uint32) * (num + 1));
if (il == NULL)
return NULL;
@@ -479,7 +479,7 @@ 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;
@@ -489,13 +489,13 @@ static LPITEM GetItemData(uint32 nOrdItem) {
uint32 dim;
// 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;
hDat = resLoad(curitem->dwRes);
- dat = (char *)GlobalLock(hDat);
+ dat = (char *)globalLock(hDat);
if (dat[0] == 'D' && dat[1] == 'A' && dat[2] == 'T') {
i = dat[3]; // For version 1.0!!
@@ -556,11 +556,11 @@ static LPITEM GetItemData(uint32 nOrdItem) {
for (i = 1; i < ret->numframe; i++) {
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;
- CopyMemory(ret->frames[i], dat, dim);
+ copyMemory(ret->frames[i], dat, dim);
dat += dim;
}
@@ -569,8 +569,8 @@ static LPITEM GetItemData(uint32 nOrdItem) {
if (i != 0xABCD)
return NULL;
- GlobalUnlock(hDat);
- GlobalFree(hDat);
+ globalUnlock(hDat);
+ globalFree(hDat);
return ret;
}
@@ -594,7 +594,7 @@ void CustomThread(CORO_PARAM, const void *param) {
CORO_INVOKE_4(GLOBALS.lplpFunctions[_ctx->p->nCf], _ctx->p->arg1, _ctx->p->arg2, _ctx->p->arg3, _ctx->p->arg4);
- GlobalFree(_ctx->p);
+ globalFree(_ctx->p);
CORO_END_CODE;
}
@@ -642,8 +642,8 @@ void ScriptThread(CORO_PARAM, const void *param) {
for (_ctx->j = 0; _ctx->j < s->Moment[_ctx->i].nCmds; _ctx->j++) {
_ctx->k = s->Moment[_ctx->i].CmdNum[_ctx->j];
- if (s->Command[_ctx->k].type == 1) {
- _ctx->p = (LPCFCALL)GlobalAlloc(GMEM_FIXED, sizeof(CFCALL));
+ if (s->_command[_ctx->k].type == 1) {
+ _ctx->p = (LPCFCALL)globalAlloc(GMEM_FIXED, sizeof(CFCALL));
if (_ctx->p == NULL) {
GLOBALS.mpalError = 1;
@@ -651,11 +651,11 @@ void ScriptThread(CORO_PARAM, const void *param) {
return;
}
- _ctx->p->nCf=s->Command[_ctx->k].nCf;
- _ctx->p->arg1=s->Command[_ctx->k].arg1;
- _ctx->p->arg2=s->Command[_ctx->k].arg2;
- _ctx->p->arg3=s->Command[_ctx->k].arg3;
- _ctx->p->arg4=s->Command[_ctx->k].arg4;
+ _ctx->p->nCf=s->_command[_ctx->k].nCf;
+ _ctx->p->arg1=s->_command[_ctx->k].arg1;
+ _ctx->p->arg2=s->_command[_ctx->k].arg2;
+ _ctx->p->arg3=s->_command[_ctx->k].arg3;
+ _ctx->p->arg4=s->_command[_ctx->k].arg4;
// !!! New process management
if ((cfHandles[_ctx->numHandles++] = CoroScheduler.createProcess(CustomThread, &_ctx->p, sizeof(LPCFCALL))) == 0) {
@@ -664,17 +664,17 @@ void ScriptThread(CORO_PARAM, const void *param) {
CORO_KILL_SELF();
return;
}
- } else if (s->Command[_ctx->k].type == 2) {
- LockVar();
+ } else if (s->_command[_ctx->k].type == 2) {
+ lockVar();
varSetValue(
- s->Command[_ctx->k].lpszVarName,
- EvaluateExpression(s->Command[_ctx->k].expr)
+ s->_command[_ctx->k].lpszVarName,
+ evaluateExpression(s->_command[_ctx->k].expr)
);
- UnlockVar();
+ unlockVar();
} else {
GLOBALS.mpalError = 1;
- GlobalFree(s);
+ globalFree(s);
CORO_KILL_SELF();
return;
@@ -682,7 +682,7 @@ void ScriptThread(CORO_PARAM, const void *param) {
}
}
- GlobalFree(s);
+ globalFree(s);
CORO_KILL_SELF();
@@ -711,29 +711,29 @@ void ActionThread(CORO_PARAM, const void *param) {
for (_ctx->j = 0; _ctx->j < item->Action[item->dwRes].nCmds; _ctx->j++) {
_ctx->k = item->Action[item->dwRes].CmdNum[_ctx->j];
- if (item->Command[_ctx->k].type == 1) {
+ if (item->_command[_ctx->k].type == 1) {
// Custom function
debugC(DEBUG_DETAILED, kTonyDebugActions, "Action Process %d Call=%s params=%d,%d,%d,%d",
- CoroScheduler.getCurrentPID(), GLOBALS.lplpFunctionStrings[item->Command[_ctx->k].nCf].c_str(),
- item->Command[_ctx->k].arg1, item->Command[_ctx->k].arg2,
- item->Command[_ctx->k].arg3, item->Command[_ctx->k].arg4
+ CoroScheduler.getCurrentPID(), GLOBALS.lplpFunctionStrings[item->_command[_ctx->k].nCf].c_str(),
+ item->_command[_ctx->k].arg1, item->_command[_ctx->k].arg2,
+ item->_command[_ctx->k].arg3, item->_command[_ctx->k].arg4
);
- CORO_INVOKE_4(GLOBALS.lplpFunctions[item->Command[_ctx->k].nCf],
- item->Command[_ctx->k].arg1,
- item->Command[_ctx->k].arg2,
- item->Command[_ctx->k].arg3,
- item->Command[_ctx->k].arg4
+ CORO_INVOKE_4(GLOBALS.lplpFunctions[item->_command[_ctx->k].nCf],
+ item->_command[_ctx->k].arg1,
+ item->_command[_ctx->k].arg2,
+ item->_command[_ctx->k].arg3,
+ item->_command[_ctx->k].arg4
);
- } else if (item->Command[_ctx->k].type == 2) {
+ } else if (item->_command[_ctx->k].type == 2) {
// Variable assign
debugC(DEBUG_DETAILED, kTonyDebugActions, "Action Process %d Variable=%s",
- CoroScheduler.getCurrentPID(), item->Command[_ctx->k].lpszVarName);
+ CoroScheduler.getCurrentPID(), item->_command[_ctx->k].lpszVarName);
- LockVar();
- varSetValue(item->Command[_ctx->k].lpszVarName, EvaluateExpression(item->Command[_ctx->k].expr));
- UnlockVar();
+ lockVar();
+ varSetValue(item->_command[_ctx->k].lpszVarName, evaluateExpression(item->_command[_ctx->k].expr));
+ unlockVar();
} else {
GLOBALS.mpalError = 1;
@@ -741,7 +741,7 @@ void ActionThread(CORO_PARAM, const void *param) {
}
}
- GlobalFree(item);
+ globalFree(item);
debugC(DEBUG_DETAILED, kTonyDebugActions, "Action Process %d ended", CoroScheduler.getCurrentPID());
@@ -832,7 +832,7 @@ void LocationPollThread(CORO_PARAM, const void *param) {
;
/* We look for items without idle actions, and eliminate them from the list */
- LockItems();
+ lockItems();
_ctx->nIdleActions = 0;
_ctx->nRealItems = 0;
for (_ctx->i = 0; _ctx->i < _ctx->numitems; _ctx->i++) {
@@ -855,18 +855,18 @@ void LocationPollThread(CORO_PARAM, const void *param) {
else
_ctx->nRealItems++;
}
- UnlockItems();
+ unlockItems();
/* If there is nothing left, we can exit */
if (_ctx->nRealItems == 0) {
- GlobalFree(_ctx->il);
+ globalFree(_ctx->il);
CORO_KILL_SELF();
return;
}
- _ctx->MyThreads = (MYTHREAD *)GlobalAlloc(GMEM_FIXED | GMEM_ZEROINIT, _ctx->nRealItems * sizeof(MYTHREAD));
+ _ctx->MyThreads = (MYTHREAD *)globalAlloc(GMEM_FIXED | GMEM_ZEROINIT, _ctx->nRealItems * sizeof(MYTHREAD));
if (_ctx->MyThreads == NULL) {
- GlobalFree(_ctx->il);
+ globalFree(_ctx->il);
CORO_KILL_SELF();
return;
}
@@ -874,15 +874,15 @@ void LocationPollThread(CORO_PARAM, const void *param) {
/* We have established that there is at least one item that contains idle actions.
Now we created the mirrored copies of the idle actions. */
- _ctx->MyActions = (MYACTION *)GlobalAlloc(GMEM_FIXED | GMEM_ZEROINIT, _ctx->nIdleActions * sizeof(MYACTION));
+ _ctx->MyActions = (MYACTION *)globalAlloc(GMEM_FIXED | GMEM_ZEROINIT, _ctx->nIdleActions * sizeof(MYACTION));
if (_ctx->MyActions == NULL) {
- GlobalFree(_ctx->MyThreads);
- GlobalFree(_ctx->il);
+ globalFree(_ctx->MyThreads);
+ globalFree(_ctx->il);
CORO_KILL_SELF();
return;
}
- LockItems();
+ lockItems();
_ctx->k = 0;
for (_ctx->i = 0; _ctx->i < _ctx->numitems; _ctx->i++) {
@@ -900,7 +900,7 @@ void LocationPollThread(CORO_PARAM, const void *param) {
_ctx->MyActions[_ctx->k].perc = _ctx->curItem->Action[_ctx->j].perc;
_ctx->MyActions[_ctx->k].when = _ctx->curItem->Action[_ctx->j].when;
_ctx->MyActions[_ctx->k].nCmds = _ctx->curItem->Action[_ctx->j].nCmds;
- CopyMemory(_ctx->MyActions[_ctx->k].CmdNum, _ctx->curItem->Action[_ctx->j].CmdNum,
+ copyMemory(_ctx->MyActions[_ctx->k].CmdNum, _ctx->curItem->Action[_ctx->j].CmdNum,
MAX_COMMANDS_PER_ACTION * sizeof(uint16));
_ctx->MyActions[_ctx->k].dwLastTime = _vm->getTime();
@@ -908,10 +908,10 @@ void LocationPollThread(CORO_PARAM, const void *param) {
}
}
- UnlockItems();
+ unlockItems();
/* We don't need the item list anymore */
- GlobalFree(_ctx->il);
+ globalFree(_ctx->il);
/* Here's the main loop */
@@ -967,33 +967,33 @@ void LocationPollThread(CORO_PARAM, const void *param) {
continue;
/* Ok, we are the only ones :) */
- LockItems();
+ lockItems();
_ctx->curItem=GLOBALS.lpmiItems+itemGetOrderFromNum(_ctx->MyActions[_ctx->k].nItem);
/* Check if there is a WhenExecute expression */
_ctx->j=_ctx->MyActions[_ctx->k].nAction;
if (_ctx->curItem->Action[_ctx->j].when != NULL)
- if (!EvaluateExpression(_ctx->curItem->Action[_ctx->j].when)) {
- UnlockItems();
+ if (!evaluateExpression(_ctx->curItem->Action[_ctx->j].when)) {
+ unlockItems();
continue;
}
/* Ok, we can perform the action. For convenience, we do it in a new process */
- _ctx->newItem = (LPMPALITEM)GlobalAlloc(GMEM_FIXED | GMEM_ZEROINIT, sizeof(MPALITEM));
+ _ctx->newItem = (LPMPALITEM)globalAlloc(GMEM_FIXED | GMEM_ZEROINIT, sizeof(MPALITEM));
if (_ctx->newItem == false) {
- GlobalFree(_ctx->MyThreads);
- GlobalFree(_ctx->MyActions);
+ globalFree(_ctx->MyThreads);
+ globalFree(_ctx->MyActions);
CORO_KILL_SELF();
return;
}
- CopyMemory(_ctx->newItem,_ctx->curItem, sizeof(MPALITEM));
- UnlockItems();
+ copyMemory(_ctx->newItem,_ctx->curItem, sizeof(MPALITEM));
+ unlockItems();
/* We copy the action in #0 */
// _ctx->newItem->Action[0].nCmds = _ctx->curItem->Action[_ctx->j].nCmds;
-// CopyMemory(_ctx->newItem->Action[0].CmdNum,_ctx->curItem->Action[_ctx->j].CmdNum,_ctx->newItem->Action[0].nCmds*sizeof(_ctx->newItem->Action[0].CmdNum[0]));
+// copyMemory(_ctx->newItem->Action[0].CmdNum,_ctx->curItem->Action[_ctx->j].CmdNum,_ctx->newItem->Action[0].nCmds*sizeof(_ctx->newItem->Action[0].CmdNum[0]));
_ctx->newItem->dwRes=_ctx->j;
/* We will create an action, and will provide the necessary details */
@@ -1006,9 +1006,9 @@ 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)
- GlobalFree(_ctx->newItem);
- GlobalFree(_ctx->MyThreads);
- GlobalFree(_ctx->MyActions);
+ globalFree(_ctx->newItem);
+ globalFree(_ctx->MyThreads);
+ globalFree(_ctx->MyActions);
CORO_KILL_SELF();
return;
@@ -1039,8 +1039,8 @@ void LocationPollThread(CORO_PARAM, const void *param) {
CORO_INVOKE_4(GLOBALS.lplpFunctions[201], 0, 0, 0, 0);
/* We're finished */
- GlobalFree(_ctx->MyThreads);
- GlobalFree(_ctx->MyActions);
+ globalFree(_ctx->MyThreads);
+ globalFree(_ctx->MyActions);
CORO_KILL_SELF();
@@ -1078,7 +1078,7 @@ void ShutUpDialogThread(CORO_PARAM, const void *param) {
CORO_END_CODE;
}
-void DoChoice(CORO_PARAM, uint32 nChoice);
+void doChoice(CORO_PARAM, uint32 nChoice);
/**
@@ -1097,41 +1097,41 @@ void GroupThread(CORO_PARAM, const void *param) {
CORO_BEGIN_CODE(_ctx);
// Lock the _ctx->dialog
- LockDialogs();
+ lockDialogs();
// Find the pointer to the current _ctx->dialog
_ctx->dialog = GLOBALS.lpmdDialogs + GLOBALS.nExecutingDialog;
// Search inside the group requesting the _ctx->dialog
- for (_ctx->i = 0; _ctx->dialog->Group[_ctx->i].num != 0; _ctx->i++) {
- if (_ctx->dialog->Group[_ctx->i].num == nGroup) {
+ for (_ctx->i = 0; _ctx->dialog->_group[_ctx->i].num != 0; _ctx->i++) {
+ if (_ctx->dialog->_group[_ctx->i].num == nGroup) {
// Cycle through executing the commands of the group
- for (_ctx->j = 0; _ctx->j < _ctx->dialog->Group[_ctx->i].nCmds; _ctx->j++) {
- _ctx->k = _ctx->dialog->Group[_ctx->i].CmdNum[_ctx->j];
+ for (_ctx->j = 0; _ctx->j < _ctx->dialog->_group[_ctx->i].nCmds; _ctx->j++) {
+ _ctx->k = _ctx->dialog->_group[_ctx->i].CmdNum[_ctx->j];
- _ctx->type = _ctx->dialog->Command[_ctx->k].type;
+ _ctx->type = _ctx->dialog->_command[_ctx->k].type;
if (_ctx->type == 1) {
// Call custom function
- CORO_INVOKE_4(GLOBALS.lplpFunctions[_ctx->dialog->Command[_ctx->k].nCf],
- _ctx->dialog->Command[_ctx->k].arg1,
- _ctx->dialog->Command[_ctx->k].arg2,
- _ctx->dialog->Command[_ctx->k].arg3,
- _ctx->dialog->Command[_ctx->k].arg4
+ CORO_INVOKE_4(GLOBALS.lplpFunctions[_ctx->dialog->_command[_ctx->k].nCf],
+ _ctx->dialog->_command[_ctx->k].arg1,
+ _ctx->dialog->_command[_ctx->k].arg2,
+ _ctx->dialog->_command[_ctx->k].arg3,
+ _ctx->dialog->_command[_ctx->k].arg4
);
} else if (_ctx->type == 2) {
// Set a variable
- LockVar();
- varSetValue(_ctx->dialog->Command[_ctx->k].lpszVarName, EvaluateExpression(_ctx->dialog->Command[_ctx->k].expr));
- UnlockVar();
+ lockVar();
+ varSetValue(_ctx->dialog->_command[_ctx->k].lpszVarName, evaluateExpression(_ctx->dialog->_command[_ctx->k].expr));
+ unlockVar();
} else if (_ctx->type == 3) {
// DoChoice: call the chosen function
- CORO_INVOKE_1(DoChoice, (uint32)_ctx->dialog->Command[_ctx->k].nChoice);
+ CORO_INVOKE_1(doChoice, (uint32)_ctx->dialog->_command[_ctx->k].nChoice);
} else {
GLOBALS.mpalError = 1;
- UnlockDialogs();
+ unlockDialogs();
CORO_KILL_SELF();
return;
@@ -1148,7 +1148,7 @@ void GroupThread(CORO_PARAM, const void *param) {
/* If we are here, it means that we have not found the requested group */
GLOBALS.mpalError = 1;
- UnlockDialogs();
+ unlockDialogs();
CORO_KILL_SELF();
@@ -1161,7 +1161,7 @@ void GroupThread(CORO_PARAM, const void *param) {
*
* @param nChoice Number of choice to perform
*/
-void DoChoice(CORO_PARAM, uint32 nChoice) {
+void doChoice(CORO_PARAM, uint32 nChoice) {
CORO_BEGIN_CONTEXT;
LPMPALDIALOG dialog;
int i, j, k;
@@ -1171,21 +1171,21 @@ void DoChoice(CORO_PARAM, uint32 nChoice) {
CORO_BEGIN_CODE(_ctx);
/* Lock the dialogs */
- LockDialogs();
+ lockDialogs();
/* Get a pointer to the current dialog */
_ctx->dialog = GLOBALS.lpmdDialogs + GLOBALS.nExecutingDialog;
/* Search the choice between those required in the dialog */
- for (_ctx->i = 0; _ctx->dialog->Choice[_ctx->i].nChoice != 0; _ctx->i++)
- if (_ctx->dialog->Choice[_ctx->i].nChoice == nChoice)
+ for (_ctx->i = 0; _ctx->dialog->_choice[_ctx->i].nChoice != 0; _ctx->i++)
+ if (_ctx->dialog->_choice[_ctx->i].nChoice == nChoice)
break;
/* If nothing has been found, exit with an error */
- if (_ctx->dialog->Choice[_ctx->i].nChoice == 0) {
+ if (_ctx->dialog->_choice[_ctx->i].nChoice == 0) {
/* If we're here, we did not find the required choice */
GLOBALS.mpalError = 1;
- UnlockDialogs();
+ unlockDialogs();
CORO_KILL_SELF();
return;
@@ -1199,19 +1199,19 @@ void DoChoice(CORO_PARAM, uint32 nChoice) {
_ctx->k = 0;
/* Calculate the expression of each selection, to see if they're active or inactive */
- for (_ctx->j = 0; _ctx->dialog->Choice[_ctx->i].Select[_ctx->j].dwData != 0; _ctx->j++)
- if (_ctx->dialog->Choice[_ctx->i].Select[_ctx->j].when == NULL) {
- _ctx->dialog->Choice[_ctx->i].Select[_ctx->j].curActive = 1;
+ for (_ctx->j = 0; _ctx->dialog->_choice[_ctx->i]._select[_ctx->j].dwData != 0; _ctx->j++)
+ if (_ctx->dialog->_choice[_ctx->i]._select[_ctx->j].when == NULL) {
+ _ctx->dialog->_choice[_ctx->i]._select[_ctx->j].curActive = 1;
_ctx->k++;
- } else if (EvaluateExpression(_ctx->dialog->Choice[_ctx->i].Select[_ctx->j].when)) {
- _ctx->dialog->Choice[_ctx->i].Select[_ctx->j].curActive = 1;
+ } else if (evaluateExpression(_ctx->dialog->_choice[_ctx->i]._select[_ctx->j].when)) {
+ _ctx->dialog->_choice[_ctx->i]._select[_ctx->j].curActive = 1;
_ctx->k++;
} else
- _ctx->dialog->Choice[_ctx->i].Select[_ctx->j].curActive = 0;
+ _ctx->dialog->_choice[_ctx->i]._select[_ctx->j].curActive = 0;
/* If there are no choices activated, then the dialog is finished. */
if (_ctx->k == 0) {
- UnlockDialogs();
+ unlockDialogs();
break;
}
@@ -1223,21 +1223,21 @@ void DoChoice(CORO_PARAM, uint32 nChoice) {
/* Now that the choice has been made, we can run the groups associated with the choice tbontbtitq
*/
_ctx->j = GLOBALS.nSelectedChoice;
- for (_ctx->k = 0; _ctx->dialog->Choice[_ctx->i].Select[_ctx->j].wPlayGroup[_ctx->k] != 0; _ctx->k++) {
- _ctx->nGroup = _ctx->dialog->Choice[_ctx->i].Select[_ctx->j].wPlayGroup[_ctx->k];
+ for (_ctx->k = 0; _ctx->dialog->_choice[_ctx->i]._select[_ctx->j].wPlayGroup[_ctx->k] != 0; _ctx->k++) {
+ _ctx->nGroup = _ctx->dialog->_choice[_ctx->i]._select[_ctx->j].wPlayGroup[_ctx->k];
CORO_INVOKE_1(GroupThread, &_ctx->nGroup);
}
/* Control attribute */
- if (_ctx->dialog->Choice[_ctx->i].Select[_ctx->j].attr & (1 << 0)) {
+ if (_ctx->dialog->_choice[_ctx->i]._select[_ctx->j].attr & (1 << 0)) {
/* Bit 0 set: the end of the choice */
- UnlockDialogs();
+ unlockDialogs();
break;
}
- if (_ctx->dialog->Choice[_ctx->i].Select[_ctx->j].attr & (1 << 1)) {
+ if (_ctx->dialog->_choice[_ctx->i]._select[_ctx->j].attr & (1 << 1)) {
/* Bit 1 set: the end of the dialog */
- UnlockDialogs();
+ unlockDialogs();
CORO_KILL_SELF();
return;
@@ -1265,7 +1265,7 @@ void DoChoice(CORO_PARAM, uint32 nChoice) {
* the itemGetOrderFromNum() function. The items list must first be locked
* by calling LockItem().
*/
-static uint32 DoAction(uint32 nAction, uint32 ordItem, uint32 dwParam) {
+static uint32 doAction(uint32 nAction, uint32 ordItem, uint32 dwParam) {
LPMPALITEM item = GLOBALS.lpmiItems;
int i;
LPMPALITEM newitem;
@@ -1284,20 +1284,20 @@ static uint32 DoAction(uint32 nAction, uint32 ordItem, uint32 dwParam) {
continue;
if (item->Action[i].when != NULL) {
- if (!EvaluateExpression(item->Action[i].when))
+ if (!evaluateExpression(item->Action[i].when))
continue;
}
// Now we find the right action to be performed
// Duplicate the item and copy the current action in #i into #0
- newitem = (LPMPALITEM)GlobalAlloc(GMEM_FIXED | GMEM_ZEROINIT, sizeof(MPALITEM));
+ newitem = (LPMPALITEM)globalAlloc(GMEM_FIXED | GMEM_ZEROINIT, sizeof(MPALITEM));
if (newitem == NULL)
return CORO_INVALID_PID_VALUE;
// 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;
- CopyMemory(newitem->Action[0].CmdNum,item->Action[i].CmdNum,newitem->Action[0].nCmds*sizeof(newitem->Action[0].CmdNum[0]));
+ copyMemory(newitem->Action[0].CmdNum,item->Action[i].CmdNum,newitem->Action[0].nCmds*sizeof(newitem->Action[0].CmdNum[0]));
*/
newitem->dwRes = i;
@@ -1331,7 +1331,7 @@ static uint32 DoAction(uint32 nAction, uint32 ordItem, uint32 dwParam) {
* so that must inform through an event and when 'necessary to you make a choice.
* The data on the choices may be obtained through various queries.
*/
-static uint32 DoDialog(uint32 nDlgOrd, uint32 nGroup) {
+static uint32 doDialog(uint32 nDlgOrd, uint32 nGroup) {
uint32 h;
// Store the running dialog in a global variable
@@ -1368,15 +1368,15 @@ static uint32 DoDialog(uint32 nDlgOrd, uint32 nGroup) {
* @param dwData Since combined with select selection
* @returns True if everything is OK, false on failure
*/
-bool DoSelection(uint32 i, uint32 dwData) {
+bool doSelection(uint32 i, uint32 dwData) {
LPMPALDIALOG dialog = GLOBALS.lpmdDialogs+GLOBALS.nExecutingDialog;
int j;
- for (j = 0; dialog->Choice[i].Select[j].dwData != 0; j++)
- if (dialog->Choice[i].Select[j].dwData == dwData && dialog->Choice[i].Select[j].curActive != 0)
+ for (j = 0; dialog->_choice[i]._select[j].dwData != 0; j++)
+ if (dialog->_choice[i]._select[j].dwData == dwData && dialog->_choice[i]._select[j].curActive != 0)
break;
- if (dialog->Choice[i].Select[j].dwData == 0)
+ if (dialog->_choice[i]._select[j].dwData == 0)
return false;
GLOBALS.nSelectedChoice = j;
@@ -1433,7 +1433,7 @@ bool mpalInit(const char *lpszMpcFileName, const char *lpszMprFileName,
if (hMpc.err())
return false;
- byte *lpMpcImage = (byte *)GlobalAlloc(GMEM_FIXED, dwSizeDecomp + 16);
+ byte *lpMpcImage = (byte *)globalAlloc(GMEM_FIXED, dwSizeDecomp + 16);
if (lpMpcImage == NULL)
return false;
@@ -1443,7 +1443,7 @@ bool mpalInit(const char *lpszMpcFileName, const char *lpszMprFileName,
if (hMpc.err())
return false;
- cmpbuf = (byte *)GlobalAlloc(GMEM_FIXED, dwSizeComp);
+ cmpbuf = (byte *)globalAlloc(GMEM_FIXED, dwSizeComp);
if (cmpbuf == NULL)
return false;
@@ -1456,7 +1456,7 @@ bool mpalInit(const char *lpszMpcFileName, const char *lpszMprFileName,
if (nBytesRead != dwSizeDecomp)
return false;
- GlobalFree(cmpbuf);
+ globalFree(cmpbuf);
} else {
/* If the file is not compressed, we directly read in the data */
nBytesRead = hMpc.read(lpMpcImage, dwSizeDecomp);
@@ -1471,7 +1471,7 @@ bool mpalInit(const char *lpszMpcFileName, const char *lpszMprFileName,
if (ParseMpc(lpMpcImage) == false)
return false;
- GlobalFree(lpMpcImage);
+ globalFree(lpMpcImage);
/* Calculate memory usage */
/*
@@ -1513,11 +1513,11 @@ bool mpalInit(const char *lpszMpcFileName, const char *lpszMprFileName,
/* Move to the start of the resources header */
GLOBALS.hMpr.seek(-(12 + (int)dwSizeComp), SEEK_END);
- GLOBALS.lpResources = (uint32 *)GlobalAlloc(GMEM_FIXED | GMEM_ZEROINIT, GLOBALS.nResources * 8);
+ GLOBALS.lpResources = (uint32 *)globalAlloc(GMEM_FIXED | GMEM_ZEROINIT, GLOBALS.nResources * 8);
if (GLOBALS.lpResources == NULL)
return false;
- cmpbuf = (byte *)GlobalAlloc(GMEM_FIXED | GMEM_ZEROINIT, dwSizeComp);
+ cmpbuf = (byte *)globalAlloc(GMEM_FIXED | GMEM_ZEROINIT, dwSizeComp);
if (cmpbuf == NULL)
return false;
@@ -1529,7 +1529,7 @@ bool mpalInit(const char *lpszMpcFileName, const char *lpszMprFileName,
if (nBytesRead != (uint32)GLOBALS.nResources * 8)
return false;
- GlobalFree(cmpbuf);
+ globalFree(cmpbuf);
/* Reset back to the start of the file, leaving it open */
GLOBALS.hMpr.seek(0, SEEK_SET);
@@ -1580,9 +1580,9 @@ uint32 mpalQueryDWORD(uint16 wQueryType, ...) {
/*
* uint32 mpalQuery(MPQ_GLOBAL_VAR, char * lpszVarName);
*/
- LockVar();
+ lockVar();
dwRet = (uint32)varGetValue(GETARG(char *));
- UnlockVar();
+ unlockVar();
} else if (wQueryType == MPQ_MESSAGE) {
/*
@@ -1595,16 +1595,16 @@ uint32 mpalQueryDWORD(uint16 wQueryType, ...) {
/*
* uint32 mpalQuery(MPQ_ITEM_PATTERN, uint32 nItem);
*/
- LockVar();
+ lockVar();
buf = Common::String::format("Pattern.%u", GETARG(uint32));
dwRet = (uint32)varGetValue(buf.c_str());
- UnlockVar();
+ unlockVar();
} else if (wQueryType == MPQ_LOCATION_SIZE) {
/*
* uint32 mpalQuery(MPQ_LOCATION_SIZE, uint32 nLoc, uint32 dwCoord);
*/
- LockLocations();
+ lockLocations();
x = locGetOrderFromNum(GETARG(uint32));
y = GETARG(uint32);
if (x != -1) {
@@ -1617,7 +1617,7 @@ uint32 mpalQueryDWORD(uint16 wQueryType, ...) {
} else
GLOBALS.mpalError = 1;
- UnlockLocations();
+ unlockLocations();
} else if (wQueryType == MPQ_LOCATION_IMAGE) {
/*
@@ -1647,7 +1647,7 @@ uint32 mpalQueryDWORD(uint16 wQueryType, ...) {
/*
* bool mpalQuery(MPQ_ITEM_IS_ACTIVE, uint32 nItem);
*/
- LockVar();
+ lockVar();
x = GETARG(uint32);
buf = Common::String::format("Status.%u", x);
if (varGetValue(buf.c_str()) <= 0)
@@ -1655,26 +1655,26 @@ uint32 mpalQueryDWORD(uint16 wQueryType, ...) {
else
dwRet = (uint32)true;
- UnlockVar();
+ unlockVar();
} else if (wQueryType == MPQ_ITEM_NAME) {
/*
* uint32 mpalQuery(MPQ_ITEM_NAME, uint32 nItem, char * lpszName);
*/
- LockVar();
+ lockVar();
x = GETARG(uint32);
n = GETARG(char *);
buf = Common::String::format("Status.%u", x);
if (varGetValue(buf.c_str()) <= 0)
n[0]='\0';
else {
- LockItems();
+ lockItems();
y = itemGetOrderFromNum(x);
- CopyMemory(n, (char *)(GLOBALS.lpmiItems + y)->lpszDescribe, MAX_DESCRIBE_SIZE);
- UnlockItems();
+ copyMemory(n, (char *)(GLOBALS.lpmiItems + y)->lpszDescribe, MAX_DESCRIBE_SIZE);
+ unlockItems();
}
- UnlockVar();
+ unlockVar();
} else if (wQueryType == MPQ_DIALOG_PERIOD) {
/*
@@ -1698,43 +1698,43 @@ uint32 mpalQueryDWORD(uint16 wQueryType, ...) {
/*
* bool mpalQuery(MPQ_DIALOG_SELECTION, uint32 nChoice, uint32 dwData);
*/
- LockDialogs();
+ lockDialogs();
x = GETARG(uint32);
y = GETARG(uint32);
- dwRet = (uint32)DoSelection(x, y);
+ dwRet = (uint32)doSelection(x, y);
- UnlockDialogs();
+ unlockDialogs();
} else if (wQueryType == MPQ_DO_ACTION) {
/*
* int mpalQuery(MPQ_DO_ACTION, uint32 nAction, uint32 nItem, uint32 dwParam);
*/
- LockItems();
- LockVar();
+ lockItems();
+ lockVar();
x = GETARG(uint32);
z = GETARG(uint32);
y = itemGetOrderFromNum(z);
if (y != -1) {
- dwRet = DoAction(x, y, GETARG(uint32));
+ dwRet = doAction(x, y, GETARG(uint32));
} else {
dwRet = CORO_INVALID_PID_VALUE;
GLOBALS.mpalError = 1;
}
- UnlockVar();
- UnlockItems();
+ unlockVar();
+ unlockItems();
} else if (wQueryType == MPQ_DO_DIALOG) {
/*
* int mpalQuery(MPQ_DO_DIALOG, uint32 nDialog, uint32 nGroup);
*/
if (!GLOBALS.bExecutingDialog) {
- LockDialogs();
+ lockDialogs();
x = dialogGetOrderFromNum(GETARG(uint32));
y = GETARG(uint32);
- dwRet = DoDialog(x, y);
- UnlockDialogs();
+ dwRet = doDialog(x, y);
+ unlockDialogs();
}
} else {
/*
@@ -1802,10 +1802,10 @@ HANDLE mpalQueryHANDLE(uint16 wQueryType, ...) {
/*
* HGLOBAL mpalQuery(MPQ_LOCATION_IMAGE, uint32 nLoc);
*/
- LockLocations();
+ lockLocations();
x = locGetOrderFromNum(GETARG(uint32));
hRet = resLoad(GLOBALS.lpmlLocations[x].dwPicRes);
- UnlockLocations();
+ unlockLocations();
} else if (wQueryType == MPQ_RESOURCE) {
/*
@@ -1817,17 +1817,17 @@ HANDLE mpalQueryHANDLE(uint16 wQueryType, ...) {
/*
* uint32 mpalQuery(MPQ_ITEM_LIST, uint32 nLoc);
*/
- LockVar();
+ lockVar();
hRet = GetItemList(GETARG(uint32));
- LockVar();
+ lockVar();
} else if (wQueryType == MPQ_ITEM_DATA) {
/*
* LPITEM mpalQuery(MPQ_ITEM_DATA, uint32 nItem);
*/
- LockItems();
- hRet = GetItemData(itemGetOrderFromNum(GETARG(uint32)));
- UnlockItems();
+ lockItems();
+ hRet = getItemData(itemGetOrderFromNum(GETARG(uint32)));
+ unlockItems();
} else if (wQueryType == MPQ_ITEM_IS_ACTIVE) {
/*
@@ -1839,29 +1839,29 @@ HANDLE mpalQueryHANDLE(uint16 wQueryType, ...) {
/*
* uint32 mpalQuery(MPQ_ITEM_NAME, uint32 nItem, char *lpszName);
*/
- LockVar();
+ lockVar();
x = GETARG(uint32);
n = GETARG(char *);
buf = Common::String::format("Status.%u", x);
if (varGetValue(buf.c_str()) <= 0)
n[0] = '\0';
else {
- LockItems();
+ lockItems();
y = itemGetOrderFromNum(x);
- CopyMemory(n, (char *)(GLOBALS.lpmiItems + y)->lpszDescribe, MAX_DESCRIBE_SIZE);
- UnlockItems();
+ copyMemory(n, (char *)(GLOBALS.lpmiItems + y)->lpszDescribe, MAX_DESCRIBE_SIZE);
+ unlockItems();
}
- UnlockVar();
+ unlockVar();
} else if (wQueryType == MPQ_DIALOG_PERIOD) {
/*
* char * mpalQuery(MPQ_DIALOG_PERIOD, uint32 nDialog, uint32 nPeriod);
*/
- LockDialogs();
+ lockDialogs();
y = GETARG(uint32);
- hRet = DuplicateDialogPeriod(y);
- UnlockDialogs();
+ hRet = duplicateDialogPeriod(y);
+ unlockDialogs();
} else if (wQueryType == MPQ_DIALOG_WAITFORCHOICE) {
/*
@@ -1873,9 +1873,9 @@ HANDLE mpalQueryHANDLE(uint16 wQueryType, ...) {
/*
* uint32 *mpalQuery(MPQ_DIALOG_SELECTLIST, uint32 nChoice);
*/
- LockDialogs();
- hRet = GetSelectList(GETARG(uint32));
- UnlockDialogs();
+ lockDialogs();
+ hRet = getSelectList(GETARG(uint32));
+ unlockDialogs();
} else if (wQueryType == MPQ_DIALOG_SELECTION) {
/*
@@ -1969,12 +1969,12 @@ bool mpalExecuteScript(int nScript) {
LockScripts();
n = scriptGetOrderFromNum(nScript);
- s = (LPMPALSCRIPT)GlobalAlloc(GMEM_FIXED | GMEM_ZEROINIT, sizeof(MPALSCRIPT));
+ s = (LPMPALSCRIPT)globalAlloc(GMEM_FIXED | GMEM_ZEROINIT, sizeof(MPALSCRIPT));
if (s == NULL)
return false;
- CopyMemory(s, GLOBALS.lpmsScripts + n, sizeof(MPALSCRIPT));
- UnlockScripts();
+ copyMemory(s, GLOBALS.lpmsScripts + n, sizeof(MPALSCRIPT));
+ unlockScripts();
// !!! New process management
if (CoroScheduler.createProcess(ScriptThread, &s, sizeof(LPMPALSCRIPT)) == CORO_INVALID_PID_VALUE)
@@ -2082,10 +2082,10 @@ int mpalGetSaveStateSize(void) {
* @param buf Buffer where to store the state
*/
void mpalSaveState(byte *buf) {
- LockVar();
+ lockVar();
WRITE_LE_UINT32(buf, GLOBALS.nVars);
- CopyMemory(buf + 4, (byte *)GLOBALS.lpmvVars, GLOBALS.nVars * sizeof(MPALVAR));
- UnlockVar();
+ copyMemory(buf + 4, (byte *)GLOBALS.lpmvVars, GLOBALS.nVars * sizeof(MPALVAR));
+ unlockVar();
}
@@ -2097,14 +2097,14 @@ void mpalSaveState(byte *buf) {
*/
int mpalLoadState(byte *buf) {
// We must destroy and recreate all the variables
- GlobalFree(GLOBALS.hVars);
+ globalFree(GLOBALS.hVars);
GLOBALS.nVars = READ_LE_UINT32(buf);
- GLOBALS.hVars = GlobalAlloc(GMEM_ZEROINIT | GMEM_MOVEABLE, GLOBALS.nVars * sizeof(MPALVAR));
- LockVar();
- CopyMemory((byte *)GLOBALS.lpmvVars, buf + 4, GLOBALS.nVars * sizeof(MPALVAR));
- UnlockVar();
+ GLOBALS.hVars = globalAlloc(GMEM_ZEROINIT | GMEM_MOVEABLE, GLOBALS.nVars * sizeof(MPALVAR));
+ lockVar();
+ copyMemory((byte *)GLOBALS.lpmvVars, buf + 4, GLOBALS.nVars * sizeof(MPALVAR));
+ unlockVar();
return GLOBALS.nVars * sizeof(MPALVAR) + 4;
}
@@ -2170,7 +2170,7 @@ const MsgCommentsStruct MsgComments[] = {
{ 0, 0, NULL }
};
-void OutputStartMsgComment(uint16 wNum, Common::OutSaveFile *f) {
+void outputStartMsgComment(uint16 wNum, Common::OutSaveFile *f) {
int i;
for (i = 0; MsgComments[i].wStart != 0; i++)
@@ -2225,7 +2225,7 @@ int OutputStartOther(uint16 wNum, Common::OutSaveFile *f) {
}
-void OutputEndOther(uint16 wNum, Common::OutSaveFile *f) {
+void outputEndOther(uint16 wNum, Common::OutSaveFile *f) {
int i;
for (i = 0; MsgComments[i].wStart != 0; i++)
@@ -2258,7 +2258,7 @@ void mpalDumpMessages(void) {
f->writeString("<HTML>\n<BODY>\n<TABLE WIDTH = 100%% BORDER = 1>\n");
for (i = 0; i < GLOBALS.nMsgs; i++) {
- lpMessage = (char*)GlobalLock(GLOBALS.lpmmMsgs[i].hText);
+ lpMessage = (char *)globalLock(GLOBALS.lpmmMsgs[i].hText);
if (*lpMessage != '\0') {
// bernie: debug
/*if (GLOBALS.lpmmMsgs[i].wNum == 1950) {
@@ -2266,9 +2266,9 @@ void mpalDumpMessages(void) {
}*/
nPeriods = 1;
- p=lpPeriods[0] = lpMessage;
+ p = lpPeriods[0] = lpMessage;
- OutputStartMsgComment(GLOBALS.lpmmMsgs[i].wNum, f);
+ outputStartMsgComment(GLOBALS.lpmmMsgs[i].wNum, f);
while (1) {
// Find the end of the current period
@@ -2313,7 +2313,7 @@ void mpalDumpMessages(void) {
OutputEndMsgComment(GLOBALS.lpmmMsgs[i].wNum, f);
- GlobalUnlock(GLOBALS.lpmmMsgs[i].hText);
+ globalUnlock(GLOBALS.lpmmMsgs[i].hText);
}
}
@@ -2351,10 +2351,10 @@ void mpalDumpOthers(void) {
f->writeString("<HTML>\n<BODY>\n");
for (i = 0; i < GLOBALS.nMsgs; i++) {
- lpMessage = (char*)GlobalLock(GLOBALS.lpmmMsgs[i].hText);
+ lpMessage = (char *)globalLock(GLOBALS.lpmmMsgs[i].hText);
if (*lpMessage != '\0') {
nPeriods = 1;
- p=lpPeriods[0] = lpMessage;
+ p = lpPeriods[0] = lpMessage;
if (OutputStartOther(GLOBALS.lpmmMsgs[i].wNum, f)) {
while (1) {
@@ -2399,9 +2399,9 @@ void mpalDumpOthers(void) {
}
}
- OutputEndOther(GLOBALS.lpmmMsgs[i].wNum, f);
+ outputEndOther(GLOBALS.lpmmMsgs[i].wNum, f);
- GlobalUnlock(GLOBALS.lpmmMsgs[i].hText);
+ globalUnlock(GLOBALS.lpmmMsgs[i].hText);
}
}
@@ -2735,7 +2735,7 @@ case num: \
return DLG##num[nPers];
-const char *GetPersonName(uint16 nDlg, int nPers) {
+const char *getPersonName(uint16 nDlg, int nPers) {
switch (nDlg) {
HANDLE_DIALOG(10);
HANDLE_DIALOG(51);
@@ -2821,11 +2821,11 @@ void mpalDumpDialog(LPMPALDIALOG dlg) {
f->writeString("<HTML>\n<BODY>\n");
- for (g = 0;dlg->Group[g].num != 0; g++) {
+ for (g = 0; dlg->_group[g].num != 0; g++) {
bAtLeastOne = false;
- for (c = 0; c<dlg->Group[g].nCmds; c++) {
- curCmd = &dlg->Command[dlg->Group[g].CmdNum[c]];
+ for (c = 0; c<dlg->_group[g].nCmds; c++) {
+ curCmd = &dlg->_command[dlg->_group[g].CmdNum[c]];
if (curCmd->type == 1 && curCmd->nCf == 71) {
bAtLeastOne = true;
break;
@@ -2838,23 +2838,23 @@ void mpalDumpDialog(LPMPALDIALOG dlg) {
f->writeString(Common::String::format("<P>\n<H3>Group %d</H3>\n<P>\n", g));
f->writeString("<TABLE WIDTH = 100%% BORDER = 1>\n");
- for (c = 0;c<dlg->Group[g].nCmds; c++) {
- curCmd = &dlg->Command[dlg->Group[g].CmdNum[c]];
+ for (c = 0; c < dlg->_group[g].nCmds; c++) {
+ curCmd = &dlg->_command[dlg->_group[g].CmdNum[c]];
// If it's a custom function, call SendDialogMessage(nPers, nMsg)
if (curCmd->type == 1 && curCmd->nCf == 71) {
sprintf(fname, "%03d-%05d.WAV", dlg->nObj, curCmd->arg2);
- for (j = 0; dlg->Periods[j] != NULL; j++)
- if (dlg->PeriodNums[j] == curCmd->arg2)
+ for (j = 0; dlg->_periods[j] != NULL; j++)
+ if (dlg->_periodNums[j] == curCmd->arg2)
break;
- if (dlg->Periods[j] == NULL)
+ if (dlg->_periods[j] == NULL)
warning("ERROR: Dialog %d, Period %d not found!", (int)dlg->nObj, (int)curCmd->arg2);
else {
- frase = (char *)GlobalLock(dlg->Periods[j]);
+ frase = (char *)globalLock(dlg->_periods[j]);
strcpy(copia, frase);
- GlobalUnlock(dlg->Periods[j]);
+ globalUnlock(dlg->_periods[j]);
while ((p = strchr(copia,'^')) != NULL)
*p = '\"';
@@ -2869,7 +2869,7 @@ void mpalDumpDialog(LPMPALDIALOG dlg) {
f->writeString("\t<TR>\n");
f->writeString(Common::String::format("\t\t<TD WIDTH=20%%> %s </TD>\n", fname));
f->writeString(Common::String::format("\t\t<TD WIDTH = 13%%> <B> %s </B> </TD>\n",
- GetPersonName(dlg->nObj, curCmd->arg1)));
+ getPersonName(dlg->nObj, curCmd->arg1)));
f->writeString(Common::String::format("\t\t<TD> %s </TD>\n",copia));
f->writeString("\t</TR>\n");
//fprintf(f, "(%s) <%s> %s\n", fname, GetPersonName(dlg->nObj, curCmd->arg1), copia);
@@ -2890,12 +2890,12 @@ void mpalDumpDialog(LPMPALDIALOG dlg) {
void mpalDumpDialogs(void) {
int i;
- LockDialogs();
+ lockDialogs();
for (i = 0; i < GLOBALS.nDialogs; i++)
mpalDumpDialog(&GLOBALS.lpmdDialogs[i]);
- UnlockDialogs();
+ unlockDialogs();
}
} // end of namespace MPAL
diff --git a/engines/tony/mpal/mpal.h b/engines/tony/mpal/mpal.h
index 1bf19ef1bb..fb3d019051 100644
--- a/engines/tony/mpal/mpal.h
+++ b/engines/tony/mpal/mpal.h
@@ -519,13 +519,13 @@ int mpalGetSaveStateSize(void);
/**
* Locks the variables for access
*/
-void LockVar(void);
+void lockVar(void);
/**
* Unlocks variables after use
*/
-void UnlockVar(void);
+void unlockVar(void);
} // end of namespace MPAL
diff --git a/engines/tony/mpal/mpaldll.h b/engines/tony/mpal/mpaldll.h
index 44d817d748..e331335315 100644
--- a/engines/tony/mpal/mpaldll.h
+++ b/engines/tony/mpal/mpaldll.h
@@ -144,7 +144,7 @@ struct command {
struct MPALDIALOG {
uint32 nObj; // Dialog number
- struct command Command[MAX_COMMANDS_PER_DIALOG];
+ struct command _command[MAX_COMMANDS_PER_DIALOG];
struct {
uint16 num;
@@ -152,7 +152,7 @@ struct MPALDIALOG {
byte nCmds;
uint16 CmdNum[MAX_COMMANDS_PER_GROUP];
- } Group[MAX_GROUPS_PER_DIALOG];
+ } _group[MAX_GROUPS_PER_DIALOG];
struct {
// The last choice has nChoice == 0
@@ -170,12 +170,12 @@ struct MPALDIALOG {
// Modified at run-time: 0 if the select is currently disabled,
// and 1 if currently active
byte curActive;
- } Select[MAX_SELECTS_PER_CHOICE];
+ } _select[MAX_SELECTS_PER_CHOICE];
- } Choice[MAX_CHOICES_PER_DIALOG];
+ } _choice[MAX_CHOICES_PER_DIALOG];
- uint16 PeriodNums[MAX_PERIODS_PER_DIALOG];
- HGLOBAL Periods[MAX_PERIODS_PER_DIALOG];
+ uint16 _periodNums[MAX_PERIODS_PER_DIALOG];
+ HGLOBAL _periods[MAX_PERIODS_PER_DIALOG];
} PACKED_STRUCT;
typedef MPALDIALOG *LPMPALDIALOG;
@@ -204,7 +204,7 @@ struct MPALITEM {
byte nActions; // Number of managed actions
uint32 dwRes; // Resource that contains frames and patterns
- struct command Command[MAX_COMMANDS_PER_ITEM];
+ struct command _command[MAX_COMMANDS_PER_ITEM];
// Pointer to array of structures containing various managed activities. In practice, of
// every action we know what commands to run, including those defined in structures above
@@ -223,7 +223,7 @@ struct MPALSCRIPT {
uint32 nMoments;
- struct command Command[MAX_COMMANDS_PER_SCRIPT];
+ struct command _command[MAX_COMMANDS_PER_SCRIPT];
struct {
int32 dwTime;
diff --git a/engines/tony/mpal/mpalutils.cpp b/engines/tony/mpal/mpalutils.cpp
index edc6e65ca1..bce623e43c 100644
--- a/engines/tony/mpal/mpalutils.cpp
+++ b/engines/tony/mpal/mpalutils.cpp
@@ -41,7 +41,7 @@ RMRes::RMRes(uint32 resID) {
if (_h == NULL)
_h = mpalQueryResource(resID);
if (_h != NULL)
- _buf = (byte *)GlobalLock(_h);
+ _buf = (byte *)globalLock(_h);
}
/**
@@ -49,8 +49,8 @@ RMRes::RMRes(uint32 resID) {
*/
RMRes::~RMRes() {
if (_h != NULL) {
- GlobalUnlock(_h);
- GlobalFree(_h);
+ globalUnlock(_h);
+ globalFree(_h);
}
}
@@ -72,7 +72,7 @@ RMRes::operator const byte *() {
* Returns the size of the resource
*/
unsigned int RMRes::size() {
- return GlobalSize(_h);
+ return globalSize(_h);
}
/****************************************************************************\