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

View File

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

View File

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

View File

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

View File

@ -84,15 +84,15 @@ static const byte *ParseScript(const byte *lpBuf, LPMPALSCRIPT lpmsScript) {
lpBuf++; lpBuf++;
switch (lpmsScript->_command[curCmd].type) { switch (lpmsScript->_command[curCmd].type) {
case 1: case 1:
lpmsScript->_command[curCmd].nCf = READ_LE_UINT16(lpBuf); lpmsScript->_command[curCmd]._nCf = READ_LE_UINT16(lpBuf);
lpBuf += 2; lpBuf += 2;
lpmsScript->_command[curCmd].arg1 = (int32)READ_LE_UINT32(lpBuf); lpmsScript->_command[curCmd]._arg1 = (int32)READ_LE_UINT32(lpBuf);
lpBuf += 4; lpBuf += 4;
lpmsScript->_command[curCmd].arg2 = (int32)READ_LE_UINT32(lpBuf); lpmsScript->_command[curCmd]._arg2 = (int32)READ_LE_UINT32(lpBuf);
lpBuf += 4; lpBuf += 4;
lpmsScript->_command[curCmd].arg3 = (int32)READ_LE_UINT32(lpBuf); lpmsScript->_command[curCmd]._arg3 = (int32)READ_LE_UINT32(lpBuf);
lpBuf += 4; lpBuf += 4;
lpmsScript->_command[curCmd].arg4 = (int32)READ_LE_UINT32(lpBuf); lpmsScript->_command[curCmd]._arg4 = (int32)READ_LE_UINT32(lpBuf);
lpBuf += 4; lpBuf += 4;
break; break;
@ -197,15 +197,15 @@ static const byte *parseDialog(const byte *lpBuf, LPMPALDIALOG lpmdDialog) {
switch (lpmdDialog->_command[curCmd].type) { switch (lpmdDialog->_command[curCmd].type) {
// Call custom function // Call custom function
case 1: case 1:
lpmdDialog->_command[curCmd].nCf = READ_LE_UINT16(lpBuf); lpmdDialog->_command[curCmd]._nCf = READ_LE_UINT16(lpBuf);
lpBuf += 2; lpBuf += 2;
lpmdDialog->_command[curCmd].arg1 = READ_LE_UINT32(lpBuf); lpmdDialog->_command[curCmd]._arg1 = READ_LE_UINT32(lpBuf);
lpBuf += 4; lpBuf += 4;
lpmdDialog->_command[curCmd].arg2 = READ_LE_UINT32(lpBuf); lpmdDialog->_command[curCmd]._arg2 = READ_LE_UINT32(lpBuf);
lpBuf += 4; lpBuf += 4;
lpmdDialog->_command[curCmd].arg3 = READ_LE_UINT32(lpBuf); lpmdDialog->_command[curCmd]._arg3 = READ_LE_UINT32(lpBuf);
lpBuf += 4; lpBuf += 4;
lpmdDialog->_command[curCmd].arg4 = READ_LE_UINT32(lpBuf); lpmdDialog->_command[curCmd]._arg4 = READ_LE_UINT32(lpBuf);
lpBuf += 4; lpBuf += 4;
break; break;
@ -398,15 +398,15 @@ static const byte *parseItem(const byte *lpBuf, LPMPALITEM lpmiItem) {
lpBuf++; lpBuf++;
switch (lpmiItem->_command[curCmd].type) { switch (lpmiItem->_command[curCmd].type) {
case 1: // Call custom function case 1: // Call custom function
lpmiItem->_command[curCmd].nCf = READ_LE_UINT16(lpBuf); lpmiItem->_command[curCmd]._nCf = READ_LE_UINT16(lpBuf);
lpBuf += 2; lpBuf += 2;
lpmiItem->_command[curCmd].arg1 = (int32)READ_LE_UINT32(lpBuf); lpmiItem->_command[curCmd]._arg1 = (int32)READ_LE_UINT32(lpBuf);
lpBuf += 4; lpBuf += 4;
lpmiItem->_command[curCmd].arg2 = (int32)READ_LE_UINT32(lpBuf); lpmiItem->_command[curCmd]._arg2 = (int32)READ_LE_UINT32(lpBuf);
lpBuf += 4; lpBuf += 4;
lpmiItem->_command[curCmd].arg3 = (int32)READ_LE_UINT32(lpBuf); lpmiItem->_command[curCmd]._arg3 = (int32)READ_LE_UINT32(lpBuf);
lpBuf += 4; lpBuf += 4;
lpmiItem->_command[curCmd].arg4 = (int32)READ_LE_UINT32(lpBuf); lpmiItem->_command[curCmd]._arg4 = (int32)READ_LE_UINT32(lpBuf);
lpBuf += 4; lpBuf += 4;
break; break;
@ -535,58 +535,58 @@ bool ParseMpc(const byte *lpBuf) {
return false; return false;
lpBuf += 4; lpBuf += 4;
GLOBALS.nVars = READ_LE_UINT16(lpBuf); GLOBALS._nVars = READ_LE_UINT16(lpBuf);
lpBuf += 2; lpBuf += 2;
GLOBALS.hVars = globalAllocate(GMEM_MOVEABLE | GMEM_ZEROINIT, sizeof(MPALVAR) * (uint32)GLOBALS.nVars); GLOBALS._hVars = globalAllocate(GMEM_MOVEABLE | GMEM_ZEROINIT, sizeof(MPALVAR) * (uint32)GLOBALS._nVars);
if (GLOBALS.hVars == NULL) if (GLOBALS._hVars == NULL)
return false; 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; wLen = *(const byte *)lpBuf;
lpBuf++; lpBuf++;
copyMemory(GLOBALS.lpmvVars->lpszVarName, lpBuf, MIN(wLen, (uint16)32)); copyMemory(GLOBALS._lpmvVars->lpszVarName, lpBuf, MIN(wLen, (uint16)32));
lpBuf += wLen; lpBuf += wLen;
GLOBALS.lpmvVars->dwVal = READ_LE_UINT32(lpBuf); GLOBALS._lpmvVars->dwVal = READ_LE_UINT32(lpBuf);
lpBuf += 4; lpBuf += 4;
lpBuf++; // Salta 'ext' lpBuf++; // Salta 'ext'
GLOBALS.lpmvVars++; GLOBALS._lpmvVars++;
} }
globalUnlock(GLOBALS.hVars); globalUnlock(GLOBALS._hVars);
/* 2. Messages */ /* 2. Messages */
if (lpBuf[0] != 'M' || lpBuf[1] != 'S' || lpBuf[2] != 'G' || lpBuf[3] != 'S') if (lpBuf[0] != 'M' || lpBuf[1] != 'S' || lpBuf[2] != 'G' || lpBuf[3] != 'S')
return false; return false;
lpBuf += 4; lpBuf += 4;
GLOBALS.nMsgs = READ_LE_UINT16(lpBuf); GLOBALS._nMsgs = READ_LE_UINT16(lpBuf);
lpBuf += 2; lpBuf += 2;
#ifdef NEED_LOCK_MSGS #ifdef NEED_LOCK_MSGS
GLOBALS.hMsgs = globalAllocate(GMEM_MOVEABLE | GMEM_ZEROINIT, sizeof(MPALMSG) * (uint32)GLOBALS.nMsgs); GLOBALS._hMsgs = globalAllocate(GMEM_MOVEABLE | GMEM_ZEROINIT, sizeof(MPALMSG) * (uint32)GLOBALS._nMsgs);
if (GLOBALS.hMsgs == NULL) if (GLOBALS._hMsgs == NULL)
return false; return false;
GLOBALS.lpmmMsgs = (LPMPALMSG)globalLock(GLOBALS.hMsgs); GLOBALS._lpmmMsgs = (LPMPALMSG)globalLock(GLOBALS._hMsgs);
#else #else
GLOBALS.lpmmMsgs=(LPMPALMSG)GlobalAlloc(GMEM_FIXED|GMEM_ZEROINIT,sizeof(MPALMSG)*(uint32)GLOBALS.nMsgs); GLOBALS._lpmmMsgs=(LPMPALMSG)globalAlloc(GMEM_FIXED | GMEM_ZEROINIT, sizeof(MPALMSG) * (uint32)GLOBALS._nMsgs);
if (GLOBALS.lpmmMsgs==NULL) if (GLOBALS._lpmmMsgs==NULL)
return false; return false;
#endif #endif
for (i = 0; i < GLOBALS.nMsgs; i++) { for (i = 0; i < GLOBALS._nMsgs; i++) {
GLOBALS.lpmmMsgs->wNum = READ_LE_UINT16(lpBuf); GLOBALS._lpmmMsgs->_wNum = READ_LE_UINT16(lpBuf);
lpBuf += 2; lpBuf += 2;
for (j = 0; lpBuf[j] != 0;) for (j = 0; lpBuf[j] != 0;)
j += lpBuf[j] + 1; j += lpBuf[j] + 1;
GLOBALS.lpmmMsgs->hText = globalAllocate(GMEM_MOVEABLE | GMEM_ZEROINIT, j + 1); GLOBALS._lpmmMsgs->_hText = globalAllocate(GMEM_MOVEABLE | GMEM_ZEROINIT, j + 1);
lpTemp2 = lpTemp = (byte *)globalLock(GLOBALS.lpmmMsgs->hText); lpTemp2 = lpTemp = (byte *)globalLock(GLOBALS._lpmmMsgs->_hText);
for (j = 0; lpBuf[j] != 0;) { for (j = 0; lpBuf[j] != 0;) {
copyMemory(lpTemp, &lpBuf[j + 1], lpBuf[j]); copyMemory(lpTemp, &lpBuf[j + 1], lpBuf[j]);
@ -598,12 +598,12 @@ bool ParseMpc(const byte *lpBuf) {
lpBuf += j + 1; lpBuf += j + 1;
*lpTemp = '\0'; *lpTemp = '\0';
globalUnlock(GLOBALS.lpmmMsgs->hText); globalUnlock(GLOBALS._lpmmMsgs->_hText);
GLOBALS.lpmmMsgs++; GLOBALS._lpmmMsgs++;
} }
#ifdef NEED_LOCK_MSGS #ifdef NEED_LOCK_MSGS
globalUnlock(GLOBALS.hMsgs); globalUnlock(GLOBALS._hMsgs);
#endif #endif
/* 3. Objects */ /* 3. Objects */
@ -611,86 +611,89 @@ bool ParseMpc(const byte *lpBuf) {
return false; return false;
lpBuf += 4; lpBuf += 4;
GLOBALS.nObjs = READ_LE_UINT16(lpBuf); GLOBALS._nObjs = READ_LE_UINT16(lpBuf);
lpBuf += 2; lpBuf += 2;
// Check out the dialogs // Check out the dialogs
GLOBALS.nDialogs = 0; GLOBALS._nDialogs = 0;
GLOBALS.hDialogs = GLOBALS.lpmdDialogs = NULL; GLOBALS._hDialogs = GLOBALS._lpmdDialogs = NULL;
if (*((const byte *)lpBuf + 2) == 6 && strncmp((const char *)lpBuf + 3, "Dialog", 6) == 0) { 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)); GLOBALS._hDialogs = globalAllocate(GMEM_MOVEABLE | GMEM_ZEROINIT, (uint32)GLOBALS._nDialogs * sizeof(MPALDIALOG));
if (GLOBALS.hDialogs == NULL) if (GLOBALS._hDialogs == NULL)
return false; return false;
GLOBALS.lpmdDialogs = (LPMPALDIALOG)globalLock(GLOBALS.hDialogs); GLOBALS._lpmdDialogs = (LPMPALDIALOG)globalLock(GLOBALS._hDialogs);
for (i = 0;i < GLOBALS.nDialogs; i++) 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; return false;
globalUnlock(GLOBALS.hDialogs); globalUnlock(GLOBALS._hDialogs);
} }
// Check the items // Check the items
GLOBALS.nItems = 0; GLOBALS._nItems = 0;
GLOBALS.hItems = GLOBALS.lpmiItems = NULL; GLOBALS._hItems = GLOBALS._lpmiItems = NULL;
if (*(lpBuf + 2) == 4 && strncmp((const char *)lpBuf + 3, "Item", 4)==0) { if (*(lpBuf + 2) == 4 && strncmp((const char *)lpBuf + 3, "Item", 4) == 0) {
GLOBALS.nItems = READ_LE_UINT16(lpBuf); GLOBALS._nItems = READ_LE_UINT16(lpBuf);
lpBuf += 2; lpBuf += 2;
// Allocate memory and read them in // Allocate memory and read them in
GLOBALS.hItems = globalAllocate(GMEM_MOVEABLE | GMEM_ZEROINIT, (uint32)GLOBALS.nItems * sizeof(MPALITEM)); GLOBALS._hItems = globalAllocate(GMEM_MOVEABLE | GMEM_ZEROINIT, (uint32)GLOBALS._nItems * sizeof(MPALITEM));
if (GLOBALS.hItems == NULL) if (GLOBALS._hItems == NULL)
return false; return false;
GLOBALS.lpmiItems = (LPMPALITEM)globalLock(GLOBALS.hItems); GLOBALS._lpmiItems = (LPMPALITEM)globalLock(GLOBALS._hItems);
for (i = 0; i < GLOBALS.nItems; i++) 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; return false;
}
globalUnlock(GLOBALS.hItems); globalUnlock(GLOBALS._hItems);
} }
// Check the locations // Check the locations
GLOBALS.nLocations = 0; GLOBALS._nLocations = 0;
GLOBALS.hLocations = GLOBALS.lpmlLocations = NULL; GLOBALS._hLocations = GLOBALS._lpmlLocations = NULL;
if (*(lpBuf + 2) == 8 && strncmp((const char *)lpBuf + 3, "Location", 8) == 0) { 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; lpBuf += 2;
// Allocate memory and read them in // Allocate memory and read them in
GLOBALS.hLocations = globalAllocate(GMEM_MOVEABLE | GMEM_ZEROINIT, (uint32)GLOBALS.nLocations*sizeof(MPALLOCATION)); GLOBALS._hLocations = globalAllocate(GMEM_MOVEABLE | GMEM_ZEROINIT, (uint32)GLOBALS._nLocations * sizeof(MPALLOCATION));
if (GLOBALS.hLocations == NULL) if (GLOBALS._hLocations == NULL)
return false; return false;
GLOBALS.lpmlLocations = (LPMPALLOCATION)globalLock(GLOBALS.hLocations); GLOBALS._lpmlLocations = (LPMPALLOCATION)globalLock(GLOBALS._hLocations);
for (i = 0; i < GLOBALS.nLocations; i++) for (i = 0; i < GLOBALS._nLocations; i++) {
if ((lpBuf = ParseLocation(lpBuf + 9, &GLOBALS.lpmlLocations[i])) == NULL) if ((lpBuf = ParseLocation(lpBuf + 9, &GLOBALS._lpmlLocations[i])) == NULL)
return false; return false;
}
globalUnlock(GLOBALS.hLocations); globalUnlock(GLOBALS._hLocations);
} }
// Check the scripts // Check the scripts
GLOBALS.nScripts = 0; GLOBALS._nScripts = 0;
GLOBALS.hScripts = GLOBALS.lpmsScripts = NULL; GLOBALS._hScripts = GLOBALS._lpmsScripts = NULL;
if (*(lpBuf + 2) == 6 && strncmp((const char *)lpBuf + 3, "Script", 6) == 0) { 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; lpBuf += 2;
// Allocate memory // Allocate memory
GLOBALS.hScripts = globalAllocate(GMEM_MOVEABLE | GMEM_ZEROINIT, (uint32)GLOBALS.nScripts * sizeof(MPALSCRIPT)); GLOBALS._hScripts = globalAllocate(GMEM_MOVEABLE | GMEM_ZEROINIT, (uint32)GLOBALS._nScripts * sizeof(MPALSCRIPT));
if (GLOBALS.hScripts == NULL) if (GLOBALS._hScripts == NULL)
return false; return false;
GLOBALS.lpmsScripts = (LPMPALSCRIPT)globalLock(GLOBALS.hScripts); GLOBALS._lpmsScripts = (LPMPALSCRIPT)globalLock(GLOBALS._hScripts);
for (i = 0; i < GLOBALS.nScripts; i++) { for (i = 0; i < GLOBALS._nScripts; i++) {
if ((lpBuf = ParseScript(lpBuf + 7, &GLOBALS.lpmsScripts[i])) == NULL) if ((lpBuf = ParseScript(lpBuf + 7, &GLOBALS._lpmsScripts[i])) == NULL)
return false; return false;
// Sort the various moments of the script // 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') if (lpBuf[0] != 'E' || lpBuf[1] != 'N' || lpBuf[2] != 'D' || lpBuf[3] != '0')
@ -745,51 +748,51 @@ void FreeMpc() {
int i; int i;
// Free variables // Free variables
globalFree(GLOBALS.hVars); globalFree(GLOBALS._hVars);
// Free messages // Free messages
LPMPALMSG lpmmMsgs = (LPMPALMSG)globalLock(GLOBALS.hMsgs); LPMPALMSG lpmmMsgs = (LPMPALMSG)globalLock(GLOBALS._hMsgs);
for (i = 0; i < GLOBALS.nMsgs; i++, ++lpmmMsgs) for (i = 0; i < GLOBALS._nMsgs; i++, ++lpmmMsgs)
globalFree(lpmmMsgs->hText); globalFree(lpmmMsgs->_hText);
globalUnlock(GLOBALS.hMsgs); globalUnlock(GLOBALS._hMsgs);
globalFree(GLOBALS.hMsgs); globalFree(GLOBALS._hMsgs);
// Free objects // Free objects
if (GLOBALS.hDialogs) { if (GLOBALS._hDialogs) {
LPMPALDIALOG lpmdDialogs = (LPMPALDIALOG)globalLock(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); freeDialog(lpmdDialogs);
globalFree(GLOBALS.hDialogs); globalFree(GLOBALS._hDialogs);
} }
// Free items // Free items
if (GLOBALS.hItems) { if (GLOBALS._hItems) {
LPMPALITEM lpmiItems = (LPMPALITEM)globalLock(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); freeItem(lpmiItems);
globalUnlock(GLOBALS.hItems); globalUnlock(GLOBALS._hItems);
globalFree(GLOBALS.hItems); globalFree(GLOBALS._hItems);
} }
// Free the locations // Free the locations
if (GLOBALS.hLocations) { if (GLOBALS._hLocations) {
globalFree(GLOBALS.hLocations); globalFree(GLOBALS._hLocations);
} }
// Free the scripts // Free the scripts
if (GLOBALS.hScripts) { if (GLOBALS._hScripts) {
LPMPALSCRIPT lpmsScripts = (LPMPALSCRIPT)globalLock(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); 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 * MPAL Messages
*/ */
struct MPALMSG { struct MPALMSG {
HGLOBAL hText; // Handle to the message text HGLOBAL _hText; // Handle to the message text
uint16 wNum; // Message number uint16 _wNum; // Message number
} PACKED_STRUCT; } PACKED_STRUCT;
typedef MPALMSG *LPMPALMSG; typedef MPALMSG *LPMPALMSG;
typedef LPMPALMSG *LPLPMPALMSG; typedef LPMPALMSG *LPLPMPALMSG;
@ -124,17 +124,17 @@ struct command {
byte type; // Type of control byte type; // Type of control
union { union {
int32 nCf; // Custom function call [#1] int32 _nCf; // Custom function call [#1]
char *lpszVarName; // Variable name [#2] char *lpszVarName; // Variable name [#2]
int32 nChoice; // Number of choice you make [#3] int32 nChoice; // Number of choice you make [#3]
}; };
union { union {
int32 arg1; // Argument for custom function [#1] int32 _arg1; // Argument for custom function [#1]
HGLOBAL expr; // Expression to assign to a variable [#2] 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; } 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 // and kill the scheudler and all the processes, including this one
for (;;) { for (;;) {
// If a savegame needs to be loaded, then do so // 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); _ctx->fn = getSaveStateFileName(_vm->_loadSlotNumber);
CORO_INVOKE_1(GLOBALS.GfxEngine->loadState, _ctx->fn); CORO_INVOKE_1(GLOBALS._gfxEngine->loadState, _ctx->fn);
_vm->_loadSlotNumber = -1; _vm->_loadSlotNumber = -1;
} }
@ -605,10 +605,10 @@ uint32 TonyEngine::getTime() {
} }
bool TonyEngine::canLoadGameStateCurrently() { bool TonyEngine::canLoadGameStateCurrently() {
return GLOBALS.GfxEngine != NULL && GLOBALS.GfxEngine->canLoadSave(); return GLOBALS._gfxEngine != NULL && GLOBALS._gfxEngine->canLoadSave();
} }
bool TonyEngine::canSaveGameStateCurrently() { bool TonyEngine::canSaveGameStateCurrently() {
return GLOBALS.GfxEngine != NULL && GLOBALS.GfxEngine->canLoadSave(); return GLOBALS._gfxEngine != NULL && GLOBALS._gfxEngine->canLoadSave();
} }
Common::Error TonyEngine::loadGameState(int slot) { 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) { Common::Error TonyEngine::saveGameState(int slot, const Common::String &desc) {
if (!GLOBALS.GfxEngine) if (!GLOBALS._gfxEngine)
return Common::kUnknownError; return Common::kUnknownError;
RMSnapshot s; 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; return Common::kNoError;
} }