TONY: Rename variables in globals.h

This commit is contained in:
Strangerke 2012-06-10 22:02:31 +02:00
parent f64700b27f
commit 2b02a45ce1
9 changed files with 706 additions and 704 deletions

File diff suppressed because it is too large Load Diff

View File

@ -359,10 +359,10 @@ void RMGfxEngine::initCustomDll(void) {
void RMGfxEngine::itemIrq(uint32 dwItem, int nPattern, int nStatus) {
RMItem *item;
assert(GLOBALS.GfxEngine);
assert(GLOBALS._gfxEngine);
if (GLOBALS.GfxEngine->_bLocationLoaded) {
item = GLOBALS.GfxEngine->_loc.getItemFromCode(dwItem);
if (GLOBALS._gfxEngine->_bLocationLoaded) {
item = GLOBALS._gfxEngine->_loc.getItemFromCode(dwItem);
if (item != NULL) {
if (nPattern != -1) {
if (GLOBALS._bPatIrqFreeze)
@ -497,7 +497,7 @@ void RMGfxEngine::init() {
_csMainLoop = g_system->createMutex();
// Initialise the IRQ function for items for MPAL
GLOBALS.GfxEngine = this;
GLOBALS._gfxEngine = this;
mpalInstallItemIrq(itemIrq);
// Initialise the input

View File

@ -35,13 +35,13 @@ Globals::Globals() {
_curBackText = NULL;
_bTonyIsSpeaking = false;
_curChangedHotspot = 0;
Tony = NULL;
Pointer = NULL;
Boxes = NULL;
Loc = NULL;
Inventory = NULL;
Input = NULL;
GfxEngine = NULL;
_tony = NULL;
_pointer = NULL;
_boxes = NULL;
_loc = NULL;
_inventory = NULL;
_input = NULL;
_gfxEngine = NULL;
LoadLocation = NULL;
UnloadLocation = NULL;
LinkGraphicTask = NULL;
@ -56,9 +56,9 @@ Globals::Globals() {
DisableGUI = NULL;
SetPalesati = NULL;
dwTonyNumTexts = 0;
bTonyInTexts = false;
bStaticTalk = false;
_dwTonyNumTexts = 0;
_bTonyInTexts = false;
_bStaticTalk = false;
_bPatIrqFreeze = false;
_bCfgInvLocked = false;
_bCfgInvNoScroll = false;
@ -86,52 +86,52 @@ Globals::Globals() {
_bFadeOutStop = false;
// OSystem::MutexRef vdb;
Common::fill(&mut[0], &mut[10], 0);
bSkipIdle = false;
hSkipIdle = 0;
lastMusic = 0;
lastTappeto = 0;
Common::fill(&tappeti[0], &tappeti[200], 0);
Common::fill(&_mut[0], &_mut[10], 0);
_bSkipIdle = false;
_hSkipIdle = 0;
_lastMusic = 0;
_lastTappeto = 0;
Common::fill(&_tappeti[0], &_tappeti[200], 0);
SFM_nLoc = 0;
// MPAL global variables
mpalError = 0;
lpiifCustom = NULL;
lplpFunctions = NULL;
lplpFunctionStrings = NULL;
nObjs = 0;
nVars = 0;
hVars = NULL;
lpmvVars = NULL;
nMsgs = 0;
hMsgs = NULL;
lpmmMsgs = NULL;
nDialogs = 0;
hDialogs = NULL;
lpmdDialogs = NULL;
nItems = 0;
hItems = NULL;
lpmiItems = NULL;
nLocations = 0;
hLocations = NULL;
lpmlLocations = NULL;
nScripts = 0;
hScripts = NULL;
lpmsScripts = NULL;
nResources = 0;
lpResources = NULL;
bExecutingAction = false;
bExecutingDialog = false;
Common::fill(&nPollingLocations[0], &nPollingLocations[MAXPOLLINGLOCATIONS], 0);
Common::fill(&hEndPollingLocations[0], &hEndPollingLocations[MAXPOLLINGLOCATIONS], 0);
Common::fill(&PollingThreads[0], &PollingThreads[MAXPOLLINGLOCATIONS], 0);
hAskChoice = 0;
hDoneChoice = 0;
nExecutingAction = 0;
nExecutingDialog = 0;
nExecutingChoice = 0;
nSelectedChoice = 0;
nTonyNextTalkType = RMTony::TALK_NORMAL;
_mpalError = 0;
_lpiifCustom = NULL;
_lplpFunctions = NULL;
_lplpFunctionStrings = NULL;
_nObjs = 0;
_nVars = 0;
_hVars = NULL;
_lpmvVars = NULL;
_nMsgs = 0;
_hMsgs = NULL;
_lpmmMsgs = NULL;
_nDialogs = 0;
_hDialogs = NULL;
_lpmdDialogs = NULL;
_nItems = 0;
_hItems = NULL;
_lpmiItems = NULL;
_nLocations = 0;
_hLocations = NULL;
_lpmlLocations = NULL;
_nScripts = 0;
_hScripts = NULL;
_lpmsScripts = NULL;
_nResources = 0;
_lpResources = NULL;
_bExecutingAction = false;
_bExecutingDialog = false;
Common::fill(&_nPollingLocations[0], &_nPollingLocations[MAXPOLLINGLOCATIONS], 0);
Common::fill(&_hEndPollingLocations[0], &_hEndPollingLocations[MAXPOLLINGLOCATIONS], 0);
Common::fill(&_pollingThreads[0], &_pollingThreads[MAXPOLLINGLOCATIONS], 0);
_hAskChoice = 0;
_hDoneChoice = 0;
_nExecutingAction = 0;
_nExecutingDialog = 0;
_nExecutingChoice = 0;
_nSelectedChoice = 0;
_nTonyNextTalkType = RMTony::TALK_NORMAL;
_saveTonyLoc = 0;
for (int i = 0; i < 16; ++i)

View File

@ -151,9 +151,9 @@ struct ChangedHotspotStruct {
* Description of a call to a custom function.
*/
typedef struct {
int nCf;
int _nCf;
int arg1, arg2, arg3, arg4;
int _arg1, _arg2, _arg3, _arg4;
} CFCALL;
typedef CFCALL *LPCFCALL;
typedef LPCFCALL *LPLPCFCALL;
@ -212,13 +212,13 @@ public:
int _curSonoriz;
bool _bFadeOutStop;
RMTony *Tony;
RMPointer *Pointer;
RMGameBoxes *Boxes;
RMLocation *Loc;
RMInventory *Inventory;
RMInput *Input;
RMGfxEngine *GfxEngine;
RMTony *_tony;
RMPointer *_pointer;
RMGameBoxes *_boxes;
RMLocation *_loc;
RMInventory *_inventory;
RMInput *_input;
RMGfxEngine *_gfxEngine;
uint32(*LoadLocation)(int, RMPoint, RMPoint start);
void (*UnloadLocation)(CORO_PARAM, bool bDoOnExit, uint32 *result);
@ -234,21 +234,21 @@ public:
void (*DisableGUI)(void);
void (*SetPalesati)(bool bpal);
uint32 dwTonyNumTexts;
bool bTonyInTexts;
bool bStaticTalk;
RMTony::TALKTYPE nTonyNextTalkType;
uint32 _dwTonyNumTexts;
bool _bTonyInTexts;
bool _bStaticTalk;
RMTony::TALKTYPE _nTonyNextTalkType;
RMPoint StartLocPos[256];
OSystem::MutexRef cs[10];
uint32 mut[10];
RMPoint _startLocPos[256];
OSystem::MutexRef _cs[10];
uint32 _mut[10];
bool bSkipIdle;
uint32 hSkipIdle;
bool _bSkipIdle;
uint32 _hSkipIdle;
int lastMusic, lastTappeto;
int _lastMusic, _lastTappeto;
int tappeti[200];
int _tappeti[200];
RMPoint SFM_pt;
int SFM_nLoc;
@ -256,43 +256,43 @@ public:
* @defgroup MPAL variables
*
*/
uint32 mpalError;
LPITEMIRQFUNCTION lpiifCustom;
LPLPCUSTOMFUNCTION lplpFunctions;
Common::String *lplpFunctionStrings;
uint16 nObjs;
uint16 nVars;
HGLOBAL hVars;
LPMPALVAR lpmvVars;
uint16 nMsgs;
HGLOBAL hMsgs;
LPMPALMSG lpmmMsgs;
uint16 nDialogs;
HGLOBAL hDialogs;
LPMPALDIALOG lpmdDialogs;
uint16 nItems;
HGLOBAL hItems;
LPMPALITEM lpmiItems;
uint16 nLocations;
HGLOBAL hLocations;
LPMPALLOCATION lpmlLocations;
uint16 nScripts;
HGLOBAL hScripts;
LPMPALSCRIPT lpmsScripts;
Common::File hMpr;
uint16 nResources;
uint32 *lpResources;
bool bExecutingAction;
bool bExecutingDialog;
uint32 nPollingLocations[MAXPOLLINGLOCATIONS];
uint32 hEndPollingLocations[MAXPOLLINGLOCATIONS];
uint32 PollingThreads[MAXPOLLINGLOCATIONS];
uint32 hAskChoice;
uint32 hDoneChoice;
uint32 nExecutingAction;
uint32 nExecutingDialog;
uint32 nExecutingChoice;
uint32 nSelectedChoice;
uint32 _mpalError;
LPITEMIRQFUNCTION _lpiifCustom;
LPLPCUSTOMFUNCTION _lplpFunctions;
Common::String *_lplpFunctionStrings;
uint16 _nObjs;
uint16 _nVars;
HGLOBAL _hVars;
LPMPALVAR _lpmvVars;
uint16 _nMsgs;
HGLOBAL _hMsgs;
LPMPALMSG _lpmmMsgs;
uint16 _nDialogs;
HGLOBAL _hDialogs;
LPMPALDIALOG _lpmdDialogs;
uint16 _nItems;
HGLOBAL _hItems;
LPMPALITEM _lpmiItems;
uint16 _nLocations;
HGLOBAL _hLocations;
LPMPALLOCATION _lpmlLocations;
uint16 _nScripts;
HGLOBAL _hScripts;
LPMPALSCRIPT _lpmsScripts;
Common::File _hMpr;
uint16 _nResources;
uint32 *_lpResources;
bool _bExecutingAction;
bool _bExecutingDialog;
uint32 _nPollingLocations[MAXPOLLINGLOCATIONS];
uint32 _hEndPollingLocations[MAXPOLLINGLOCATIONS];
uint32 _pollingThreads[MAXPOLLINGLOCATIONS];
uint32 _hAskChoice;
uint32 _hDoneChoice;
uint32 _nExecutingAction;
uint32 _nExecutingDialog;
uint32 _nExecutingChoice;
uint32 _nSelectedChoice;
};
} // End of namespace Tony

View File

@ -171,7 +171,7 @@ static int Compute(int a, int b, byte symbol) {
case OP_OR:
return a || b;
default:
GLOBALS.mpalError = 1;
GLOBALS._mpalError = 1;
break;
}

View File

@ -84,15 +84,15 @@ static const byte *ParseScript(const byte *lpBuf, LPMPALSCRIPT lpmsScript) {
lpBuf++;
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;
@ -197,15 +197,15 @@ static const byte *parseDialog(const byte *lpBuf, LPMPALDIALOG lpmdDialog) {
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;
@ -398,15 +398,15 @@ static const byte *parseItem(const byte *lpBuf, LPMPALITEM lpmiItem) {
lpBuf++;
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;
@ -535,58 +535,58 @@ bool ParseMpc(const byte *lpBuf) {
return false;
lpBuf += 4;
GLOBALS.nVars = READ_LE_UINT16(lpBuf);
GLOBALS._nVars = READ_LE_UINT16(lpBuf);
lpBuf += 2;
GLOBALS.hVars = globalAllocate(GMEM_MOVEABLE | GMEM_ZEROINIT, sizeof(MPALVAR) * (uint32)GLOBALS.nVars);
if (GLOBALS.hVars == NULL)
GLOBALS._hVars = globalAllocate(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++) {
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);
GLOBALS._lpmvVars->dwVal = READ_LE_UINT32(lpBuf);
lpBuf += 4;
lpBuf++; // Salta 'ext'
GLOBALS.lpmvVars++;
GLOBALS._lpmvVars++;
}
globalUnlock(GLOBALS.hVars);
globalUnlock(GLOBALS._hVars);
/* 2. Messages */
if (lpBuf[0] != 'M' || lpBuf[1] != 'S' || lpBuf[2] != 'G' || lpBuf[3] != 'S')
return false;
lpBuf += 4;
GLOBALS.nMsgs = READ_LE_UINT16(lpBuf);
GLOBALS._nMsgs = READ_LE_UINT16(lpBuf);
lpBuf += 2;
#ifdef NEED_LOCK_MSGS
GLOBALS.hMsgs = globalAllocate(GMEM_MOVEABLE | GMEM_ZEROINIT, sizeof(MPALMSG) * (uint32)GLOBALS.nMsgs);
if (GLOBALS.hMsgs == NULL)
GLOBALS._hMsgs = globalAllocate(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)
GLOBALS._lpmmMsgs=(LPMPALMSG)globalAlloc(GMEM_FIXED | GMEM_ZEROINIT, sizeof(MPALMSG) * (uint32)GLOBALS._nMsgs);
if (GLOBALS._lpmmMsgs==NULL)
return false;
#endif
for (i = 0; i < GLOBALS.nMsgs; i++) {
GLOBALS.lpmmMsgs->wNum = READ_LE_UINT16(lpBuf);
for (i = 0; i < GLOBALS._nMsgs; i++) {
GLOBALS._lpmmMsgs->_wNum = READ_LE_UINT16(lpBuf);
lpBuf += 2;
for (j = 0; lpBuf[j] != 0;)
j += lpBuf[j] + 1;
GLOBALS.lpmmMsgs->hText = globalAllocate(GMEM_MOVEABLE | GMEM_ZEROINIT, j + 1);
lpTemp2 = lpTemp = (byte *)globalLock(GLOBALS.lpmmMsgs->hText);
GLOBALS._lpmmMsgs->_hText = globalAllocate(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]);
@ -598,12 +598,12 @@ bool ParseMpc(const byte *lpBuf) {
lpBuf += j + 1;
*lpTemp = '\0';
globalUnlock(GLOBALS.lpmmMsgs->hText);
GLOBALS.lpmmMsgs++;
globalUnlock(GLOBALS._lpmmMsgs->_hText);
GLOBALS._lpmmMsgs++;
}
#ifdef NEED_LOCK_MSGS
globalUnlock(GLOBALS.hMsgs);
globalUnlock(GLOBALS._hMsgs);
#endif
/* 3. Objects */
@ -611,86 +611,89 @@ bool ParseMpc(const byte *lpBuf) {
return false;
lpBuf += 4;
GLOBALS.nObjs = READ_LE_UINT16(lpBuf);
GLOBALS._nObjs = READ_LE_UINT16(lpBuf);
lpBuf += 2;
// Check out the dialogs
GLOBALS.nDialogs = 0;
GLOBALS.hDialogs = GLOBALS.lpmdDialogs = NULL;
GLOBALS._nDialogs = 0;
GLOBALS._hDialogs = GLOBALS._lpmdDialogs = NULL;
if (*((const byte *)lpBuf + 2) == 6 && strncmp((const char *)lpBuf + 3, "Dialog", 6) == 0) {
GLOBALS.nDialogs = READ_LE_UINT16(lpBuf); lpBuf += 2;
GLOBALS._nDialogs = READ_LE_UINT16(lpBuf);
lpBuf += 2;
GLOBALS.hDialogs = globalAllocate(GMEM_MOVEABLE | GMEM_ZEROINIT, (uint32)GLOBALS.nDialogs * sizeof(MPALDIALOG));
if (GLOBALS.hDialogs == NULL)
GLOBALS._hDialogs = globalAllocate(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)
for (i = 0;i < GLOBALS._nDialogs; i++)
if ((lpBuf = parseDialog(lpBuf + 7, &GLOBALS._lpmdDialogs[i])) == NULL)
return false;
globalUnlock(GLOBALS.hDialogs);
globalUnlock(GLOBALS._hDialogs);
}
// Check the items
GLOBALS.nItems = 0;
GLOBALS.hItems = GLOBALS.lpmiItems = NULL;
if (*(lpBuf + 2) == 4 && strncmp((const char *)lpBuf + 3, "Item", 4)==0) {
GLOBALS.nItems = READ_LE_UINT16(lpBuf);
GLOBALS._nItems = 0;
GLOBALS._hItems = GLOBALS._lpmiItems = NULL;
if (*(lpBuf + 2) == 4 && strncmp((const char *)lpBuf + 3, "Item", 4) == 0) {
GLOBALS._nItems = READ_LE_UINT16(lpBuf);
lpBuf += 2;
// Allocate memory and read them in
GLOBALS.hItems = globalAllocate(GMEM_MOVEABLE | GMEM_ZEROINIT, (uint32)GLOBALS.nItems * sizeof(MPALITEM));
if (GLOBALS.hItems == NULL)
GLOBALS._hItems = globalAllocate(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)
for (i = 0; i < GLOBALS._nItems; i++) {
if ((lpBuf = parseItem(lpBuf + 5, &GLOBALS._lpmiItems[i])) == NULL)
return false;
}
globalUnlock(GLOBALS.hItems);
globalUnlock(GLOBALS._hItems);
}
// Check the locations
GLOBALS.nLocations = 0;
GLOBALS.hLocations = GLOBALS.lpmlLocations = NULL;
GLOBALS._nLocations = 0;
GLOBALS._hLocations = GLOBALS._lpmlLocations = NULL;
if (*(lpBuf + 2) == 8 && strncmp((const char *)lpBuf + 3, "Location", 8) == 0) {
GLOBALS.nLocations = READ_LE_UINT16(lpBuf);
GLOBALS._nLocations = READ_LE_UINT16(lpBuf);
lpBuf += 2;
// Allocate memory and read them in
GLOBALS.hLocations = globalAllocate(GMEM_MOVEABLE | GMEM_ZEROINIT, (uint32)GLOBALS.nLocations*sizeof(MPALLOCATION));
if (GLOBALS.hLocations == NULL)
GLOBALS._hLocations = globalAllocate(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)
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
GLOBALS.nScripts = 0;
GLOBALS.hScripts = GLOBALS.lpmsScripts = NULL;
GLOBALS._nScripts = 0;
GLOBALS._hScripts = GLOBALS._lpmsScripts = NULL;
if (*(lpBuf + 2) == 6 && strncmp((const char *)lpBuf + 3, "Script", 6) == 0) {
GLOBALS.nScripts = READ_LE_UINT16(lpBuf);
GLOBALS._nScripts = READ_LE_UINT16(lpBuf);
lpBuf += 2;
// Allocate memory
GLOBALS.hScripts = globalAllocate(GMEM_MOVEABLE | GMEM_ZEROINIT, (uint32)GLOBALS.nScripts * sizeof(MPALSCRIPT));
if (GLOBALS.hScripts == NULL)
GLOBALS._hScripts = globalAllocate(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)
for (i = 0; i < GLOBALS._nScripts; i++) {
if ((lpBuf = ParseScript(lpBuf + 7, &GLOBALS._lpmsScripts[i])) == NULL)
return false;
// Sort the various moments of the script
@ -702,7 +705,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')
@ -745,51 +748,51 @@ void FreeMpc() {
int i;
// Free variables
globalFree(GLOBALS.hVars);
globalFree(GLOBALS._hVars);
// Free messages
LPMPALMSG lpmmMsgs = (LPMPALMSG)globalLock(GLOBALS.hMsgs);
for (i = 0; i < GLOBALS.nMsgs; i++, ++lpmmMsgs)
globalFree(lpmmMsgs->hText);
LPMPALMSG lpmmMsgs = (LPMPALMSG)globalLock(GLOBALS._hMsgs);
for (i = 0; i < GLOBALS._nMsgs; i++, ++lpmmMsgs)
globalFree(lpmmMsgs->_hText);
globalUnlock(GLOBALS.hMsgs);
globalFree(GLOBALS.hMsgs);
globalUnlock(GLOBALS._hMsgs);
globalFree(GLOBALS._hMsgs);
// Free objects
if (GLOBALS.hDialogs) {
LPMPALDIALOG lpmdDialogs = (LPMPALDIALOG)globalLock(GLOBALS.hDialogs);
if (GLOBALS._hDialogs) {
LPMPALDIALOG lpmdDialogs = (LPMPALDIALOG)globalLock(GLOBALS._hDialogs);
for (i = 0; i < GLOBALS.nDialogs; i++, ++lpmdDialogs)
for (i = 0; i < GLOBALS._nDialogs; i++, ++lpmdDialogs)
freeDialog(lpmdDialogs);
globalFree(GLOBALS.hDialogs);
globalFree(GLOBALS._hDialogs);
}
// Free items
if (GLOBALS.hItems) {
LPMPALITEM lpmiItems = (LPMPALITEM)globalLock(GLOBALS.hItems);
if (GLOBALS._hItems) {
LPMPALITEM lpmiItems = (LPMPALITEM)globalLock(GLOBALS._hItems);
for (i = 0; i < GLOBALS.nItems; ++i, ++lpmiItems)
for (i = 0; i < GLOBALS._nItems; ++i, ++lpmiItems)
freeItem(lpmiItems);
globalUnlock(GLOBALS.hItems);
globalFree(GLOBALS.hItems);
globalUnlock(GLOBALS._hItems);
globalFree(GLOBALS._hItems);
}
// Free the locations
if (GLOBALS.hLocations) {
globalFree(GLOBALS.hLocations);
if (GLOBALS._hLocations) {
globalFree(GLOBALS._hLocations);
}
// Free the scripts
if (GLOBALS.hScripts) {
LPMPALSCRIPT lpmsScripts = (LPMPALSCRIPT)globalLock(GLOBALS.hScripts);
if (GLOBALS._hScripts) {
LPMPALSCRIPT lpmsScripts = (LPMPALSCRIPT)globalLock(GLOBALS._hScripts);
for (i = 0; i < GLOBALS.nScripts; ++i, ++lpmsScripts) {
for (i = 0; i < GLOBALS._nScripts; ++i, ++lpmsScripts) {
FreeScript(lpmsScripts);
}
globalUnlock(GLOBALS.hScripts);
globalUnlock(GLOBALS._hScripts);
}
}

File diff suppressed because it is too large Load Diff

View File

@ -89,8 +89,8 @@ typedef LPMPALVAR *LPLPMPALVAR;
* MPAL Messages
*/
struct MPALMSG {
HGLOBAL hText; // Handle to the message text
uint16 wNum; // Message number
HGLOBAL _hText; // Handle to the message text
uint16 _wNum; // Message number
} PACKED_STRUCT;
typedef MPALMSG *LPMPALMSG;
typedef LPMPALMSG *LPLPMPALMSG;
@ -124,17 +124,17 @@ struct command {
byte type; // Type of control
union {
int32 nCf; // Custom function call [#1]
int32 _nCf; // Custom function call [#1]
char *lpszVarName; // Variable name [#2]
int32 nChoice; // Number of choice you make [#3]
};
union {
int32 arg1; // Argument for custom function [#1]
int32 _arg1; // Argument for custom function [#1]
HGLOBAL 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;

View File

@ -517,9 +517,9 @@ void TonyEngine::playProcess(CORO_PARAM, const void *param) {
// and kill the scheudler and all the processes, including this one
for (;;) {
// If a savegame needs to be loaded, then do so
if (_vm->_loadSlotNumber != -1 && GLOBALS.GfxEngine != NULL) {
if (_vm->_loadSlotNumber != -1 && GLOBALS._gfxEngine != NULL) {
_ctx->fn = getSaveStateFileName(_vm->_loadSlotNumber);
CORO_INVOKE_1(GLOBALS.GfxEngine->loadState, _ctx->fn);
CORO_INVOKE_1(GLOBALS._gfxEngine->loadState, _ctx->fn);
_vm->_loadSlotNumber = -1;
}
@ -605,10 +605,10 @@ uint32 TonyEngine::getTime() {
}
bool TonyEngine::canLoadGameStateCurrently() {
return GLOBALS.GfxEngine != NULL && GLOBALS.GfxEngine->canLoadSave();
return GLOBALS._gfxEngine != NULL && GLOBALS._gfxEngine->canLoadSave();
}
bool TonyEngine::canSaveGameStateCurrently() {
return GLOBALS.GfxEngine != NULL && GLOBALS.GfxEngine->canLoadSave();
return GLOBALS._gfxEngine != NULL && GLOBALS._gfxEngine->canLoadSave();
}
Common::Error TonyEngine::loadGameState(int slot) {
@ -617,13 +617,13 @@ Common::Error TonyEngine::loadGameState(int slot) {
}
Common::Error TonyEngine::saveGameState(int slot, const Common::String &desc) {
if (!GLOBALS.GfxEngine)
if (!GLOBALS._gfxEngine)
return Common::kUnknownError;
RMSnapshot s;
s.grabScreenshot(*GLOBALS.GfxEngine, 4, _curThumbnail);
s.grabScreenshot(*GLOBALS._gfxEngine, 4, _curThumbnail);
GLOBALS.GfxEngine->saveState(getSaveStateFileName(slot), (byte *)_curThumbnail, desc);
GLOBALS._gfxEngine->saveState(getSaveStateFileName(slot), (byte *)_curThumbnail, desc);
return Common::kNoError;
}