aboutsummaryrefslogtreecommitdiff
path: root/engines/tony
diff options
context:
space:
mode:
authorMatthew Hoops2012-09-12 20:18:13 -0400
committerMatthew Hoops2012-09-12 20:18:13 -0400
commitd5ed8b1901b88e361a2a420a9daf586f6089a36b (patch)
treed19e4dd7baf33b7447d69d8ad8d3c25732a69698 /engines/tony
parentff51a7661d7a2cb296b987edfc3d81727160e627 (diff)
parent8808393b3a3428df2946d7967e52aba084c8ffe5 (diff)
downloadscummvm-rg350-d5ed8b1901b88e361a2a420a9daf586f6089a36b.tar.gz
scummvm-rg350-d5ed8b1901b88e361a2a420a9daf586f6089a36b.tar.bz2
scummvm-rg350-d5ed8b1901b88e361a2a420a9daf586f6089a36b.zip
Merge remote branch 'upstream/master' into pegasus
Conflicts: AUTHORS
Diffstat (limited to 'engines/tony')
-rw-r--r--engines/tony/custom.cpp813
-rw-r--r--engines/tony/custom.h18
-rw-r--r--engines/tony/detection_tables.h33
-rw-r--r--engines/tony/font.cpp69
-rw-r--r--engines/tony/font.h4
-rw-r--r--engines/tony/game.cpp33
-rw-r--r--engines/tony/gfxcore.cpp280
-rw-r--r--engines/tony/gfxcore.h40
-rw-r--r--engines/tony/gfxengine.cpp57
-rw-r--r--engines/tony/inventory.cpp47
-rw-r--r--engines/tony/loc.cpp364
-rw-r--r--engines/tony/loc.h10
-rw-r--r--engines/tony/mpal/expr.cpp92
-rw-r--r--engines/tony/mpal/expr.h61
-rw-r--r--engines/tony/mpal/loadmpc.cpp6
-rw-r--r--engines/tony/mpal/memory.cpp2
-rw-r--r--engines/tony/mpal/memory.h2
-rw-r--r--engines/tony/mpal/mpal.cpp55
-rw-r--r--engines/tony/mpal/mpal.h2
-rw-r--r--engines/tony/sound.cpp246
-rw-r--r--engines/tony/sound.h98
-rw-r--r--engines/tony/tony.cpp6
-rw-r--r--engines/tony/utils.cpp2
23 files changed, 1092 insertions, 1248 deletions
diff --git a/engines/tony/custom.cpp b/engines/tony/custom.cpp
index f0a9197c6d..99debbfa0e 100644
--- a/engines/tony/custom.cpp
+++ b/engines/tony/custom.cpp
@@ -41,7 +41,7 @@
namespace Tony {
-const char *ambianceFile[] = {
+static const char *const kAmbianceFile[] = {
"None",
"1.ADP", // Grilli.WAV
"2.ADP", // Grilli-Ovattati.WAV
@@ -52,66 +52,38 @@ const char *ambianceFile[] = {
"6.ADP" // Mare1.WAV half volume
};
-struct MusicFileEntry {
- const char *name;
- int sync;
-};
-
-const MusicFileEntry musicFiles[] = {
- {"00.ADP", 0}, {"01.ADP", 0},
- {"02.ADP", 0}, {"03.ADP", 0},
- {"04.ADP", 0}, {"05.ADP", 0},
- {"06.ADP", 0}, {"07.ADP", 0},
- {"08.ADP", 2450}, {"09.ADP", 0},
- {"10.ADP", 0}, {"11.ADP", 0},
- {"12.ADP", 0}, {"13.ADP", 0},
- {"14.ADP", 0}, {"15.ADP", 0},
- {"16.ADP", 0}, {"17.ADP", 0},
- {"18.ADP", 0}, {"19.ADP", 0},
- {"20.ADP", 0}, {"21.ADP", 0},
- {"22.ADP", 0}, {"23.ADP", 0},
- {"24.ADP", 0}, {"25.ADP", 0},
- {"26.ADP", 0}, {"27.ADP", 0},
- {"28.ADP", 1670}, {"29.ADP", 0},
- {"30.ADP", 0}, {"31.ADP", 0},
- {"32.ADP", 2900}, {"33.ADP", 0},
- {"34.ADP", 0}, {"35.ADP", 0},
- {"36.ADP", 0}, {"37.ADP", 0},
- {"38.ADP", 0}, {"39.ADP", 0},
- {"40.ADP", 0}, {"41.ADP", 1920},
- {"42.ADP", 1560}, {"43.ADP", 1920},
- {"44.ADP", 1920}, {"45.ADP", 1920},
- {"46.ADP", 1920}, {"47.ADP", 1920},
- {"48.ADP", 1920}, {"49.ADP", 1920},
- {"50.ADP", 1920}, {"51.ADP", 1920},
- {"52.ADP", 1920}, {"53.ADP", 0},
- {"54.ADP", 0}, {"55.ADP", 0},
- {"56.ADP", 0}, {"57.ADP", 0},
- {"58.ADP", 0}, {"59.ADP", 0}
+static const MusicFileEntry kMusicFiles[] = {
+ {"00.ADP", 0}, {"01.ADP", 0}, {"02.ADP", 0}, {"03.ADP", 0},
+ {"04.ADP", 0}, {"05.ADP", 0}, {"06.ADP", 0}, {"07.ADP", 0},
+ {"08.ADP", 2450}, {"09.ADP", 0}, {"10.ADP", 0}, {"11.ADP", 0},
+ {"12.ADP", 0}, {"13.ADP", 0}, {"14.ADP", 0}, {"15.ADP", 0},
+ {"16.ADP", 0}, {"17.ADP", 0}, {"18.ADP", 0}, {"19.ADP", 0},
+ {"20.ADP", 0}, {"21.ADP", 0}, {"22.ADP", 0}, {"23.ADP", 0},
+ {"24.ADP", 0}, {"25.ADP", 0}, {"26.ADP", 0}, {"27.ADP", 0},
+ {"28.ADP", 1670}, {"29.ADP", 0}, {"30.ADP", 0}, {"31.ADP", 0},
+ {"32.ADP", 2900}, {"33.ADP", 0}, {"34.ADP", 0}, {"35.ADP", 0},
+ {"36.ADP", 0}, {"37.ADP", 0}, {"38.ADP", 0}, {"39.ADP", 0},
+ {"40.ADP", 0}, {"41.ADP", 1920}, {"42.ADP", 1560}, {"43.ADP", 1920},
+ {"44.ADP", 1920}, {"45.ADP", 1920}, {"46.ADP", 1920}, {"47.ADP", 1920},
+ {"48.ADP", 1920}, {"49.ADP", 1920}, {"50.ADP", 1920}, {"51.ADP", 1920},
+ {"52.ADP", 1920}, {"53.ADP", 0}, {"54.ADP", 0}, {"55.ADP", 0},
+ {"56.ADP", 0}, {"57.ADP", 0}, {"58.ADP", 0}, {"59.ADP", 0}
};
-const char *jingleFileNames[] = {
- "S00.ADP", "S01.ADP",
- "S02.ADP", "S03.ADP",
- "S04.ADP", "S05.ADP",
- "S06.ADP", "S07.ADP",
- "S08.ADP", "S09.ADP",
- "S10.ADP", "S11.ADP",
- "S12.ADP", "S13.ADP",
- "S14.ADP", "S15.ADP",
- "S16.ADP", "S17.ADP",
- "S18.ADP"
+static const char *const kJingleFileNames[] = {
+ "S00.ADP", "S01.ADP", "S02.ADP", "S03.ADP", "S04.ADP",
+ "S05.ADP", "S06.ADP", "S07.ADP", "S08.ADP", "S09.ADP",
+ "S10.ADP", "S11.ADP", "S12.ADP", "S13.ADP", "S14.ADP",
+ "S15.ADP", "S16.ADP", "S17.ADP", "S18.ADP"
};
-
-void ReapplyChangedHotspot() {
- int i;
- for (i = 0; i < GLOBALS._curChangedHotspot; i++)
+void reapplyChangedHotspot() {
+ for (int i = 0; i < GLOBALS._curChangedHotspot; i++)
GLOBALS._loc->getItemFromCode(GLOBALS._changedHotspot[i]._dwCode)->changeHotspot(RMPoint(GLOBALS._changedHotspot[i]._nX, GLOBALS._changedHotspot[i]._nY));
}
-void SaveChangedHotspot(Common::OutSaveFile *f) {
+void saveChangedHotspot(Common::OutSaveFile *f) {
f->writeByte(GLOBALS._curChangedHotspot);
if (GLOBALS._curChangedHotspot > 0) {
for (int i = 0; i < GLOBALS._curChangedHotspot; ++i)
@@ -119,7 +91,7 @@ void SaveChangedHotspot(Common::OutSaveFile *f) {
}
}
-void LoadChangedHotspot(Common::InSaveFile *f) {
+void loadChangedHotspot(Common::InSaveFile *f) {
GLOBALS._curChangedHotspot = f->readByte();
if (GLOBALS._curChangedHotspot > 0) {
@@ -128,7 +100,6 @@ void LoadChangedHotspot(Common::InSaveFile *f) {
}
}
-
/**
* Classes required for custom functions
*
@@ -139,14 +110,14 @@ void LoadChangedHotspot(Common::InSaveFile *f) {
* AddInventory -> theEngine.AddInventory()
*/
-void MCharResetCodes() {
+void mCharResetCodes() {
for (int i = 0; i < 10; i++)
GLOBALS._mCharacter[i]._item = GLOBALS._loc->getItemFromCode(GLOBALS._mCharacter[i]._code);
for (int i = 0; i < 10; i++)
GLOBALS._character[i]._item = GLOBALS._loc->getItemFromCode(GLOBALS._character[i]._code);
}
-void CharsSaveAll(Common::OutSaveFile *f) {
+void charsSaveAll(Common::OutSaveFile *f) {
for (int i = 0; i < 10; i++) {
f->writeByte(GLOBALS._isMChar[i]);
if (GLOBALS._isMChar[i]) {
@@ -157,7 +128,7 @@ void CharsSaveAll(Common::OutSaveFile *f) {
}
}
-void CharsLoadAll(Common::InSaveFile *f) {
+void charsLoadAll(Common::InSaveFile *f) {
for (int i = 0; i < 10; i++) {
GLOBALS._isMChar[i] = f->readByte();
if (GLOBALS._isMChar[i])
@@ -167,28 +138,28 @@ void CharsLoadAll(Common::InSaveFile *f) {
}
}
-DECLARE_CUSTOM_FUNCTION(FaceToMe)(CORO_PARAM, uint32, uint32, uint32, uint32) {
+void faceToMe(CORO_PARAM, uint32, uint32, uint32, uint32) {
GLOBALS._tony->setPattern(GLOBALS._tony->PAT_STANDDOWN);
}
-DECLARE_CUSTOM_FUNCTION(BackToMe)(CORO_PARAM, uint32, uint32, uint32, uint32) {
+void backToMe(CORO_PARAM, uint32, uint32, uint32, uint32) {
GLOBALS._tony->setPattern(GLOBALS._tony->PAT_STANDUP);
}
-DECLARE_CUSTOM_FUNCTION(LeftToMe)(CORO_PARAM, uint32, uint32, uint32, uint32) {
+void leftToMe(CORO_PARAM, uint32, uint32, uint32, uint32) {
GLOBALS._tony->setPattern(GLOBALS._tony->PAT_STANDLEFT);
}
-DECLARE_CUSTOM_FUNCTION(RightToMe)(CORO_PARAM, uint32, uint32, uint32, uint32) {
+void rightToMe(CORO_PARAM, uint32, uint32, uint32, uint32) {
GLOBALS._tony->setPattern(GLOBALS._tony->PAT_STANDRIGHT);
}
-DECLARE_CUSTOM_FUNCTION(TonySetPerorate)(CORO_PARAM, uint32 bStatus, uint32, uint32, uint32) {
+void tonySetPerorate(CORO_PARAM, uint32 bStatus, uint32, uint32, uint32) {
g_vm->getEngine()->setPerorate(bStatus);
}
-DECLARE_CUSTOM_FUNCTION(MySleep)(CORO_PARAM, uint32 dwTime, uint32, uint32, uint32) {
+void mySleep(CORO_PARAM, uint32 dwTime, uint32, uint32, uint32) {
CORO_BEGIN_CONTEXT;
int i;
CORO_END_CONTEXT(_ctx);
@@ -201,12 +172,12 @@ DECLARE_CUSTOM_FUNCTION(MySleep)(CORO_PARAM, uint32 dwTime, uint32, uint32, uint
CORO_END_CODE;
}
-DECLARE_CUSTOM_FUNCTION(SetAlwaysDisplay)(CORO_PARAM, uint32 val, uint32, uint32, uint32) {
+void setAlwaysDisplay(CORO_PARAM, uint32 val, uint32, uint32, uint32) {
GLOBALS._bAlwaysDisplay = (val != 0);
}
-DECLARE_CUSTOM_FUNCTION(SetPointer)(CORO_PARAM, uint32 dwPointer, uint32, uint32, uint32) {
+void setPointer(CORO_PARAM, uint32 dwPointer, uint32, uint32, uint32) {
switch (dwPointer) {
case 1:
GLOBALS._pointer->setSpecialPointer(GLOBALS._pointer->PTR_ARROWUP);
@@ -230,7 +201,7 @@ DECLARE_CUSTOM_FUNCTION(SetPointer)(CORO_PARAM, uint32 dwPointer, uint32, uint32
}
}
-VoiceHeader *SearchVoiceHeader(uint32 codehi, uint32 codelo) {
+VoiceHeader *searchVoiceHeader(uint32 codehi, uint32 codelo) {
int code = (codehi << 16) | codelo;
if (g_vm->_voices.size() == 0)
@@ -245,7 +216,7 @@ VoiceHeader *SearchVoiceHeader(uint32 codehi, uint32 codelo) {
}
-DECLARE_CUSTOM_FUNCTION(SendTonyMessage)(CORO_PARAM, uint32 dwMessage, uint32 nX, uint32 nY, uint32) {
+void sendTonyMessage(CORO_PARAM, uint32 dwMessage, uint32 nX, uint32 nY, uint32) {
CORO_BEGIN_CONTEXT;
RMMessage msg;
int i;
@@ -266,7 +237,7 @@ DECLARE_CUSTOM_FUNCTION(SendTonyMessage)(CORO_PARAM, uint32 dwMessage, uint32 nX
if (!_ctx->msg.isValid())
return;
- _ctx->curVoc = SearchVoiceHeader(0, dwMessage);
+ _ctx->curVoc = searchVoiceHeader(0, dwMessage);
_ctx->voice = NULL;
if (_ctx->curVoc) {
// Is positioned within the database of entries beginning at the first
@@ -362,12 +333,12 @@ DECLARE_CUSTOM_FUNCTION(SendTonyMessage)(CORO_PARAM, uint32 dwMessage, uint32 nX
CORO_END_CODE;
}
-DECLARE_CUSTOM_FUNCTION(ChangeBoxStatus)(CORO_PARAM, uint32 nLoc, uint32 nBox, uint32 nStatus, uint32) {
+void changeBoxStatus(CORO_PARAM, uint32 nLoc, uint32 nBox, uint32 nStatus, uint32) {
GLOBALS._boxes->changeBoxStatus(nLoc, nBox, nStatus);
}
-DECLARE_CUSTOM_FUNCTION(CustLoadLocation)(CORO_PARAM, uint32 nLoc, uint32 tX, uint32 tY, uint32 bUseStartPos) {
+void custLoadLocation(CORO_PARAM, uint32 nLoc, uint32 tX, uint32 tY, uint32 bUseStartPos) {
CORO_BEGIN_CONTEXT;
uint32 h;
CORO_END_CONTEXT(_ctx);
@@ -390,7 +361,7 @@ DECLARE_CUSTOM_FUNCTION(CustLoadLocation)(CORO_PARAM, uint32 nLoc, uint32 tX, ui
}
-DECLARE_CUSTOM_FUNCTION(SendFullscreenMsgStart)(CORO_PARAM, uint32 nMsg, uint32 nFont, uint32, uint32) {
+void sendFullscreenMsgStart(CORO_PARAM, uint32 nMsg, uint32 nFont, uint32, uint32) {
CORO_BEGIN_CONTEXT;
RMMessage *msg;
RMGfxClearTask clear;
@@ -449,7 +420,7 @@ DECLARE_CUSTOM_FUNCTION(SendFullscreenMsgStart)(CORO_PARAM, uint32 nMsg, uint32
CORO_END_CODE;
}
-DECLARE_CUSTOM_FUNCTION(ClearScreen)(CORO_PARAM, uint32, uint32, uint32, uint32) {
+void clearScreen(CORO_PARAM, uint32, uint32, uint32, uint32) {
CORO_BEGIN_CONTEXT;
char buf[256];
RMGfxClearTask clear;
@@ -469,33 +440,33 @@ DECLARE_CUSTOM_FUNCTION(ClearScreen)(CORO_PARAM, uint32, uint32, uint32, uint32)
CORO_END_CODE;
}
-DECLARE_CUSTOM_FUNCTION(SendFullscreenMsgEnd)(CORO_PARAM, uint32 bNotEnableTony, uint32, uint32, uint32) {
+void sendFullscreenMsgEnd(CORO_PARAM, uint32 bNotEnableTony, uint32, uint32, uint32) {
g_vm->getEngine()->loadLocation(GLOBALS._fullScreenMessageLoc, RMPoint(GLOBALS._fullScreenMessagePt._x, GLOBALS._fullScreenMessagePt._y), RMPoint(-1, -1));
if (!bNotEnableTony)
GLOBALS._tony->show();
- MCharResetCodes();
- ReapplyChangedHotspot();
+ mCharResetCodes();
+ reapplyChangedHotspot();
}
-DECLARE_CUSTOM_FUNCTION(SendFullscreenMessage)(CORO_PARAM, uint32 nMsg, uint32 nFont, uint32, uint32) {
+void sendFullscreenMessage(CORO_PARAM, uint32 nMsg, uint32 nFont, uint32, uint32) {
CORO_BEGIN_CONTEXT;
CORO_END_CONTEXT(_ctx);
CORO_BEGIN_CODE(_ctx);
- CORO_INVOKE_4(SendFullscreenMsgStart, nMsg, nFont, 0, 0);
- CORO_INVOKE_4(SendFullscreenMsgEnd, 0, 0, 0, 0);
+ CORO_INVOKE_4(sendFullscreenMsgStart, nMsg, nFont, 0, 0);
+ CORO_INVOKE_4(sendFullscreenMsgEnd, 0, 0, 0, 0);
CORO_END_CODE;
}
-DECLARE_CUSTOM_FUNCTION(NoBullsEye)(CORO_PARAM, uint32, uint32, uint32, uint32) {
+void noBullsEye(CORO_PARAM, uint32, uint32, uint32, uint32) {
GLOBALS._bNoBullsEye = true;
}
-DECLARE_CUSTOM_FUNCTION(CloseLocation)(CORO_PARAM, uint32, uint32, uint32, uint32) {
+void closeLocation(CORO_PARAM, uint32, uint32, uint32, uint32) {
CORO_BEGIN_CONTEXT;
CORO_END_CONTEXT(_ctx);
@@ -515,7 +486,7 @@ DECLARE_CUSTOM_FUNCTION(CloseLocation)(CORO_PARAM, uint32, uint32, uint32, uint3
}
-DECLARE_CUSTOM_FUNCTION(ChangeLocation)(CORO_PARAM, uint32 nLoc, uint32 tX, uint32 tY, uint32 bUseStartPos) {
+void changeLocation(CORO_PARAM, uint32 nLoc, uint32 tX, uint32 tY, uint32 bUseStartPos) {
CORO_BEGIN_CONTEXT;
uint32 h;
CORO_END_CONTEXT(_ctx);
@@ -543,7 +514,7 @@ DECLARE_CUSTOM_FUNCTION(ChangeLocation)(CORO_PARAM, uint32 nLoc, uint32 tX, uint
if (GLOBALS._lastTappeto != GLOBALS._ambiance[nLoc]) {
GLOBALS._lastTappeto = GLOBALS._ambiance[nLoc];
if (GLOBALS._lastTappeto != 0)
- g_vm->playMusic(4, ambianceFile[GLOBALS._lastTappeto], 0, true, 2000);
+ g_vm->playMusic(4, kAmbianceFile[GLOBALS._lastTappeto], 0, true, 2000);
}
if (!GLOBALS._bNoBullsEye) {
@@ -566,51 +537,49 @@ DECLARE_CUSTOM_FUNCTION(ChangeLocation)(CORO_PARAM, uint32 nLoc, uint32 tX, uint
CORO_END_CODE;
}
-DECLARE_CUSTOM_FUNCTION(SetLocStartPosition)(CORO_PARAM, uint32 nLoc, uint32 lX, uint32 lY, uint32) {
+void setLocStartPosition(CORO_PARAM, uint32 nLoc, uint32 lX, uint32 lY, uint32) {
GLOBALS._startLocPos[nLoc].set(lX, lY);
}
-DECLARE_CUSTOM_FUNCTION(SaveTonyPosition)(CORO_PARAM, uint32, uint32, uint32, uint32) {
+void saveTonyPosition(CORO_PARAM, uint32, uint32, uint32, uint32) {
GLOBALS._saveTonyPos = GLOBALS._tony->position();
GLOBALS._saveTonyLoc = GLOBALS._loc->TEMPGetNumLoc();
}
-DECLARE_CUSTOM_FUNCTION(RestoreTonyPosition)(CORO_PARAM, uint32, uint32, uint32, uint32) {
+void restoreTonyPosition(CORO_PARAM, uint32, uint32, uint32, uint32) {
CORO_BEGIN_CONTEXT;
CORO_END_CONTEXT(_ctx);
CORO_BEGIN_CODE(_ctx);
- CORO_INVOKE_4(ChangeLocation, GLOBALS._saveTonyLoc, GLOBALS._saveTonyPos._x, GLOBALS._saveTonyPos._y, 0);
+ CORO_INVOKE_4(changeLocation, GLOBALS._saveTonyLoc, GLOBALS._saveTonyPos._x, GLOBALS._saveTonyPos._y, 0);
- MCharResetCodes();
+ mCharResetCodes();
CORO_END_CODE;
}
-DECLARE_CUSTOM_FUNCTION(DisableInput)(CORO_PARAM, uint32, uint32, uint32, uint32) {
+void disableInput(CORO_PARAM, uint32, uint32, uint32, uint32) {
g_vm->getEngine()->disableInput();
}
-DECLARE_CUSTOM_FUNCTION(EnableInput)(CORO_PARAM, uint32, uint32, uint32, uint32) {
+void enableInput(CORO_PARAM, uint32, uint32, uint32, uint32) {
g_vm->getEngine()->enableInput();
}
-DECLARE_CUSTOM_FUNCTION(StopTony)(CORO_PARAM, uint32, uint32, uint32, uint32) {
+void stopTony(CORO_PARAM, uint32, uint32, uint32, uint32) {
GLOBALS._tony->stopNoAction(coroParam);
}
-DECLARE_CUSTOM_FUNCTION(CustEnableGUI)(CORO_PARAM, uint32, uint32, uint32, uint32) {
+void custEnableGUI(CORO_PARAM, uint32, uint32, uint32, uint32) {
GLOBALS.EnableGUI();
}
-DECLARE_CUSTOM_FUNCTION(CustDisableGUI)(CORO_PARAM, uint32, uint32, uint32, uint32) {
+void custDisableGUI(CORO_PARAM, uint32, uint32, uint32, uint32) {
GLOBALS.DisableGUI();
}
-
-
-void TonyGenericTake1(CORO_PARAM, uint32 nDirection) {
+void tonyGenericTake1(CORO_PARAM, uint32 nDirection) {
CORO_BEGIN_CONTEXT;
CORO_END_CONTEXT(_ctx);
@@ -624,7 +593,7 @@ void TonyGenericTake1(CORO_PARAM, uint32 nDirection) {
CORO_END_CODE;
}
-void TonyGenericTake2(CORO_PARAM, uint32 nDirection) {
+void tonyGenericTake2(CORO_PARAM, uint32 nDirection) {
CORO_BEGIN_CONTEXT;
CORO_END_CONTEXT(_ctx);
@@ -640,7 +609,7 @@ void TonyGenericTake2(CORO_PARAM, uint32 nDirection) {
CORO_END_CODE;
}
-void TonyGenericPut1(CORO_PARAM, uint32 nDirection) {
+void tonyGenericPut1(CORO_PARAM, uint32 nDirection) {
CORO_BEGIN_CONTEXT;
CORO_END_CONTEXT(_ctx);
@@ -654,7 +623,7 @@ void TonyGenericPut1(CORO_PARAM, uint32 nDirection) {
CORO_END_CODE;
}
-void TonyGenericPut2(CORO_PARAM, uint32 nDirection) {
+void tonyGenericPut2(CORO_PARAM, uint32 nDirection) {
CORO_BEGIN_CONTEXT;
CORO_END_CONTEXT(_ctx);
@@ -671,71 +640,65 @@ void TonyGenericPut2(CORO_PARAM, uint32 nDirection) {
}
-DECLARE_CUSTOM_FUNCTION(TonyTakeUp1)(CORO_PARAM, uint32, uint32, uint32, uint32) {
- TonyGenericTake1(coroParam, 0);
+void tonyTakeUp1(CORO_PARAM, uint32, uint32, uint32, uint32) {
+ tonyGenericTake1(coroParam, 0);
}
-DECLARE_CUSTOM_FUNCTION(TonyTakeMid1)(CORO_PARAM, uint32, uint32, uint32, uint32) {
- TonyGenericTake1(coroParam, 1);
+void tonyTakeMid1(CORO_PARAM, uint32, uint32, uint32, uint32) {
+ tonyGenericTake1(coroParam, 1);
}
-DECLARE_CUSTOM_FUNCTION(TonyTakeDown1)(CORO_PARAM, uint32, uint32, uint32, uint32) {
- TonyGenericTake1(coroParam, 2);
+void tonyTakeDown1(CORO_PARAM, uint32, uint32, uint32, uint32) {
+ tonyGenericTake1(coroParam, 2);
}
-
-
-DECLARE_CUSTOM_FUNCTION(TonyTakeUp2)(CORO_PARAM, uint32, uint32, uint32, uint32) {
- TonyGenericTake2(coroParam, 0);
+void tonyTakeUp2(CORO_PARAM, uint32, uint32, uint32, uint32) {
+ tonyGenericTake2(coroParam, 0);
}
-DECLARE_CUSTOM_FUNCTION(TonyTakeMid2)(CORO_PARAM, uint32, uint32, uint32, uint32) {
- TonyGenericTake2(coroParam, 1);
+void tonyTakeMid2(CORO_PARAM, uint32, uint32, uint32, uint32) {
+ tonyGenericTake2(coroParam, 1);
}
-DECLARE_CUSTOM_FUNCTION(TonyTakeDown2)(CORO_PARAM, uint32, uint32, uint32, uint32) {
- TonyGenericTake2(coroParam, 2);
+void tonyTakeDown2(CORO_PARAM, uint32, uint32, uint32, uint32) {
+ tonyGenericTake2(coroParam, 2);
}
-
-
-DECLARE_CUSTOM_FUNCTION(TonyPutUp1)(CORO_PARAM, uint32, uint32, uint32, uint32) {
- TonyGenericPut1(coroParam, 0);
+void tonyPutUp1(CORO_PARAM, uint32, uint32, uint32, uint32) {
+ tonyGenericPut1(coroParam, 0);
}
-
-DECLARE_CUSTOM_FUNCTION(TonyPutMid1)(CORO_PARAM, uint32, uint32, uint32, uint32) {
- TonyGenericPut1(coroParam, 1);
+void tonyPutMid1(CORO_PARAM, uint32, uint32, uint32, uint32) {
+ tonyGenericPut1(coroParam, 1);
}
-DECLARE_CUSTOM_FUNCTION(TonyPutDown1)(CORO_PARAM, uint32, uint32, uint32, uint32) {
- TonyGenericPut1(coroParam, 2);
+void tonyPutDown1(CORO_PARAM, uint32, uint32, uint32, uint32) {
+ tonyGenericPut1(coroParam, 2);
}
-DECLARE_CUSTOM_FUNCTION(TonyPutUp2)(CORO_PARAM, uint32, uint32, uint32, uint32) {
- TonyGenericPut2(coroParam, 0);
+void tonyPutUp2(CORO_PARAM, uint32, uint32, uint32, uint32) {
+ tonyGenericPut2(coroParam, 0);
}
-
-DECLARE_CUSTOM_FUNCTION(TonyPutMid2)(CORO_PARAM, uint32, uint32, uint32, uint32) {
- TonyGenericPut2(coroParam, 1);
+void tonyPutMid2(CORO_PARAM, uint32, uint32, uint32, uint32) {
+ tonyGenericPut2(coroParam, 1);
}
-DECLARE_CUSTOM_FUNCTION(TonyPutDown2)(CORO_PARAM, uint32, uint32, uint32, uint32) {
- TonyGenericPut2(coroParam, 2);
+void tonyPutDown2(CORO_PARAM, uint32, uint32, uint32, uint32) {
+ tonyGenericPut2(coroParam, 2);
}
-DECLARE_CUSTOM_FUNCTION(TonyOnTheFloor)(CORO_PARAM, uint32 dwParte, uint32, uint32, uint32) {
+void tonyOnTheFloor(CORO_PARAM, uint32 dwParte, uint32, uint32, uint32) {
if (dwParte == 0)
GLOBALS._tony->setPattern(GLOBALS._tony->PAT_ONTHEFLOORLEFT);
else
GLOBALS._tony->setPattern(GLOBALS._tony->PAT_ONTHEFLOORRIGHT);
}
-DECLARE_CUSTOM_FUNCTION(TonyGetUp)(CORO_PARAM, uint32 dwParte, uint32, uint32, uint32) {
+void tonyGetUp(CORO_PARAM, uint32 dwParte, uint32, uint32, uint32) {
CORO_BEGIN_CONTEXT;
CORO_END_CONTEXT(_ctx);
@@ -752,11 +715,11 @@ DECLARE_CUSTOM_FUNCTION(TonyGetUp)(CORO_PARAM, uint32 dwParte, uint32, uint32, u
CORO_END_CODE;
}
-DECLARE_CUSTOM_FUNCTION(TonyShepherdess)(CORO_PARAM, uint32 bIsPast, uint32, uint32, uint32) {
+void tonyShepherdess(CORO_PARAM, uint32 bIsPast, uint32, uint32, uint32) {
GLOBALS._tony->setShepherdess(bIsPast);
}
-DECLARE_CUSTOM_FUNCTION(TonyWhistle)(CORO_PARAM, uint32, uint32, uint32, uint32) {
+void tonyWhistle(CORO_PARAM, uint32, uint32, uint32, uint32) {
CORO_BEGIN_CONTEXT;
CORO_END_CONTEXT(_ctx);
@@ -771,98 +734,97 @@ DECLARE_CUSTOM_FUNCTION(TonyWhistle)(CORO_PARAM, uint32, uint32, uint32, uint32)
CORO_END_CODE;
}
-
-void TonySetNumTexts(uint32 dwText) {
+void tonySetNumTexts(uint32 dwText) {
GLOBALS._dwTonyNumTexts = dwText;
GLOBALS._bTonyInTexts = false;
}
-DECLARE_CUSTOM_FUNCTION(TonyLaugh)(CORO_PARAM, uint32 dwText, uint32, uint32, uint32) {
- TonySetNumTexts(dwText);
+void tonyLaugh(CORO_PARAM, uint32 dwText, uint32, uint32, uint32) {
+ tonySetNumTexts(dwText);
GLOBALS._nTonyNextTalkType = GLOBALS._tony->TALK_LAUGH;
}
-DECLARE_CUSTOM_FUNCTION(TonyGiggle)(CORO_PARAM, uint32 dwText, uint32, uint32, uint32) {
- TonySetNumTexts(dwText);
+void tonyGiggle(CORO_PARAM, uint32 dwText, uint32, uint32, uint32) {
+ tonySetNumTexts(dwText);
GLOBALS._nTonyNextTalkType = GLOBALS._tony->TALK_LAUGH2;
}
-DECLARE_CUSTOM_FUNCTION(TonyHips)(CORO_PARAM, uint32 dwText, uint32, uint32, uint32) {
- TonySetNumTexts(dwText);
+void tonyHips(CORO_PARAM, uint32 dwText, uint32, uint32, uint32) {
+ tonySetNumTexts(dwText);
GLOBALS._nTonyNextTalkType = GLOBALS._tony->TALK_HIPS;
}
-DECLARE_CUSTOM_FUNCTION(TonySing)(CORO_PARAM, uint32 dwText, uint32, uint32, uint32) {
- TonySetNumTexts(dwText);
+void tonySing(CORO_PARAM, uint32 dwText, uint32, uint32, uint32) {
+ tonySetNumTexts(dwText);
GLOBALS._nTonyNextTalkType = GLOBALS._tony->TALK_SING;
}
-DECLARE_CUSTOM_FUNCTION(TonyIndicate)(CORO_PARAM, uint32 dwText, uint32, uint32, uint32) {
- TonySetNumTexts(dwText);
+void tonyIndicate(CORO_PARAM, uint32 dwText, uint32, uint32, uint32) {
+ tonySetNumTexts(dwText);
GLOBALS._nTonyNextTalkType = GLOBALS._tony->TALK_INDICATE;
}
-DECLARE_CUSTOM_FUNCTION(TonyScaredWithHands)(CORO_PARAM, uint32 dwText, uint32, uint32, uint32) {
- TonySetNumTexts(dwText);
+void tonyScaredWithHands(CORO_PARAM, uint32 dwText, uint32, uint32, uint32) {
+ tonySetNumTexts(dwText);
GLOBALS._nTonyNextTalkType = GLOBALS._tony->TALK_SCARED;
}
-DECLARE_CUSTOM_FUNCTION(TonyScaredWithoutHands)(CORO_PARAM, uint32 dwText, uint32, uint32, uint32) {
- TonySetNumTexts(dwText);
+void tonyScaredWithoutHands(CORO_PARAM, uint32 dwText, uint32, uint32, uint32) {
+ tonySetNumTexts(dwText);
GLOBALS._nTonyNextTalkType = GLOBALS._tony->TALK_SCARED2;
}
-DECLARE_CUSTOM_FUNCTION(TonyWithHammer)(CORO_PARAM, uint32 dwText, uint32, uint32, uint32) {
- TonySetNumTexts(dwText);
+void tonyWithHammer(CORO_PARAM, uint32 dwText, uint32, uint32, uint32) {
+ tonySetNumTexts(dwText);
GLOBALS._nTonyNextTalkType = GLOBALS._tony->TALK_WITHHAMMER;
GLOBALS._tony->setPattern(GLOBALS._tony->PAT_WITHHAMMER);
}
-DECLARE_CUSTOM_FUNCTION(TonyWithGlasses)(CORO_PARAM, uint32 dwText, uint32, uint32, uint32) {
- TonySetNumTexts(dwText);
+void tonyWithGlasses(CORO_PARAM, uint32 dwText, uint32, uint32, uint32) {
+ tonySetNumTexts(dwText);
GLOBALS._nTonyNextTalkType = GLOBALS._tony->TALK_WITHGLASSES;
GLOBALS._tony->setPattern(GLOBALS._tony->PAT_WITHGLASSES);
}
-DECLARE_CUSTOM_FUNCTION(TonyWithWorm)(CORO_PARAM, uint32 dwText, uint32, uint32, uint32) {
- TonySetNumTexts(dwText);
+void tonyWithWorm(CORO_PARAM, uint32 dwText, uint32, uint32, uint32) {
+ tonySetNumTexts(dwText);
GLOBALS._nTonyNextTalkType = GLOBALS._tony->TALK_WITHWORM;
GLOBALS._tony->setPattern(GLOBALS._tony->PAT_WITHWORM);
}
-DECLARE_CUSTOM_FUNCTION(TonyWithRope)(CORO_PARAM, uint32 dwText, uint32, uint32, uint32) {
- TonySetNumTexts(dwText);
+void tonyWithRope(CORO_PARAM, uint32 dwText, uint32, uint32, uint32) {
+ tonySetNumTexts(dwText);
GLOBALS._nTonyNextTalkType = GLOBALS._tony->TALK_WITHROPE;
GLOBALS._tony->setPattern(GLOBALS._tony->PAT_WITHROPE);
}
-DECLARE_CUSTOM_FUNCTION(TonyWithSecretary)(CORO_PARAM, uint32 dwText, uint32, uint32, uint32) {
- TonySetNumTexts(dwText);
+void tonyWithSecretary(CORO_PARAM, uint32 dwText, uint32, uint32, uint32) {
+ tonySetNumTexts(dwText);
GLOBALS._nTonyNextTalkType = GLOBALS._tony->TALK_WITHSECRETARY;
GLOBALS._tony->setPattern(GLOBALS._tony->PAT_WITHSECRETARY);
}
-DECLARE_CUSTOM_FUNCTION(TonyWithRabbitANIM)(CORO_PARAM, uint32 dwText, uint32, uint32, uint32) {
- TonySetNumTexts(dwText);
+void tonyWithRabbitANIM(CORO_PARAM, uint32 dwText, uint32, uint32, uint32) {
+ tonySetNumTexts(dwText);
GLOBALS._nTonyNextTalkType = GLOBALS._tony->TALK_WITHRABBIT;
}
-DECLARE_CUSTOM_FUNCTION(TonyWithRecipeANIM)(CORO_PARAM, uint32 dwText, uint32, uint32, uint32) {
- TonySetNumTexts(dwText);
+void tonyWithRecipeANIM(CORO_PARAM, uint32 dwText, uint32, uint32, uint32) {
+ tonySetNumTexts(dwText);
GLOBALS._nTonyNextTalkType = GLOBALS._tony->TALK_WITHRECIPE;
}
-DECLARE_CUSTOM_FUNCTION(TonyWithCardsANIM)(CORO_PARAM, uint32 dwText, uint32, uint32, uint32) {
- TonySetNumTexts(dwText);
+void tonyWithCardsANIM(CORO_PARAM, uint32 dwText, uint32, uint32, uint32) {
+ tonySetNumTexts(dwText);
GLOBALS._nTonyNextTalkType = GLOBALS._tony->TALK_WITHCARDS;
}
-DECLARE_CUSTOM_FUNCTION(TonyWithSnowmanANIM)(CORO_PARAM, uint32 dwText, uint32, uint32, uint32) {
- TonySetNumTexts(dwText);
+void tonyWithSnowmanANIM(CORO_PARAM, uint32 dwText, uint32, uint32, uint32) {
+ tonySetNumTexts(dwText);
GLOBALS._nTonyNextTalkType = GLOBALS._tony->TALK_WITHSNOWMAN;
}
-DECLARE_CUSTOM_FUNCTION(TonyWithSnowmanStart)(CORO_PARAM, uint32, uint32, uint32, uint32) {
+void tonyWithSnowmanStart(CORO_PARAM, uint32, uint32, uint32, uint32) {
CORO_BEGIN_CONTEXT;
CORO_END_CONTEXT(_ctx);
@@ -875,7 +837,7 @@ DECLARE_CUSTOM_FUNCTION(TonyWithSnowmanStart)(CORO_PARAM, uint32, uint32, uint32
CORO_END_CODE;
}
-DECLARE_CUSTOM_FUNCTION(TonyWithSnowmanEnd)(CORO_PARAM, uint32, uint32, uint32, uint32) {
+void tonyWithSnowmanEnd(CORO_PARAM, uint32, uint32, uint32, uint32) {
CORO_BEGIN_CONTEXT;
CORO_END_CONTEXT(_ctx);
@@ -888,7 +850,7 @@ DECLARE_CUSTOM_FUNCTION(TonyWithSnowmanEnd)(CORO_PARAM, uint32, uint32, uint32,
CORO_END_CODE;
}
-DECLARE_CUSTOM_FUNCTION(TonyWithRabbitStart)(CORO_PARAM, uint32, uint32, uint32, uint32) {
+void tonyWithRabbitStart(CORO_PARAM, uint32, uint32, uint32, uint32) {
CORO_BEGIN_CONTEXT;
CORO_END_CONTEXT(_ctx);
@@ -901,7 +863,7 @@ DECLARE_CUSTOM_FUNCTION(TonyWithRabbitStart)(CORO_PARAM, uint32, uint32, uint32,
CORO_END_CODE;
}
-DECLARE_CUSTOM_FUNCTION(TonyWithRabbitEnd)(CORO_PARAM, uint32, uint32, uint32, uint32) {
+void tonyWithRabbitEnd(CORO_PARAM, uint32, uint32, uint32, uint32) {
CORO_BEGIN_CONTEXT;
CORO_END_CONTEXT(_ctx);
@@ -914,7 +876,7 @@ DECLARE_CUSTOM_FUNCTION(TonyWithRabbitEnd)(CORO_PARAM, uint32, uint32, uint32, u
CORO_END_CODE;
}
-DECLARE_CUSTOM_FUNCTION(TonyWithRecipeStart)(CORO_PARAM, uint32, uint32, uint32, uint32) {
+void tonyWithRecipeStart(CORO_PARAM, uint32, uint32, uint32, uint32) {
CORO_BEGIN_CONTEXT;
CORO_END_CONTEXT(_ctx);
@@ -927,7 +889,7 @@ DECLARE_CUSTOM_FUNCTION(TonyWithRecipeStart)(CORO_PARAM, uint32, uint32, uint32,
CORO_END_CODE;
}
-DECLARE_CUSTOM_FUNCTION(TonyWithRecipeEnd)(CORO_PARAM, uint32, uint32, uint32, uint32) {
+void tonyWithRecipeEnd(CORO_PARAM, uint32, uint32, uint32, uint32) {
CORO_BEGIN_CONTEXT;
CORO_END_CONTEXT(_ctx);
@@ -940,7 +902,7 @@ DECLARE_CUSTOM_FUNCTION(TonyWithRecipeEnd)(CORO_PARAM, uint32, uint32, uint32, u
CORO_END_CODE;
}
-DECLARE_CUSTOM_FUNCTION(TonyWithCardsStart)(CORO_PARAM, uint32, uint32, uint32, uint32) {
+void tonyWithCardsStart(CORO_PARAM, uint32, uint32, uint32, uint32) {
CORO_BEGIN_CONTEXT;
CORO_END_CONTEXT(_ctx);
@@ -953,7 +915,7 @@ DECLARE_CUSTOM_FUNCTION(TonyWithCardsStart)(CORO_PARAM, uint32, uint32, uint32,
CORO_END_CODE;
}
-DECLARE_CUSTOM_FUNCTION(TonyWithCardsEnd)(CORO_PARAM, uint32, uint32, uint32, uint32) {
+void tonyWithCardsEnd(CORO_PARAM, uint32, uint32, uint32, uint32) {
CORO_BEGIN_CONTEXT;
CORO_END_CONTEXT(_ctx);
@@ -966,7 +928,7 @@ DECLARE_CUSTOM_FUNCTION(TonyWithCardsEnd)(CORO_PARAM, uint32, uint32, uint32, ui
CORO_END_CODE;
}
-DECLARE_CUSTOM_FUNCTION(TonyWithNotebookStart)(CORO_PARAM, uint32, uint32, uint32, uint32) {
+void tonyWithNotebookStart(CORO_PARAM, uint32, uint32, uint32, uint32) {
CORO_BEGIN_CONTEXT;
CORO_END_CONTEXT(_ctx);
@@ -979,7 +941,7 @@ DECLARE_CUSTOM_FUNCTION(TonyWithNotebookStart)(CORO_PARAM, uint32, uint32, uint3
CORO_END_CODE;
}
-DECLARE_CUSTOM_FUNCTION(TonyWithNotebookEnd)(CORO_PARAM, uint32, uint32, uint32, uint32) {
+void tonyWithNotebookEnd(CORO_PARAM, uint32, uint32, uint32, uint32) {
CORO_BEGIN_CONTEXT;
CORO_END_CONTEXT(_ctx);
@@ -992,7 +954,7 @@ DECLARE_CUSTOM_FUNCTION(TonyWithNotebookEnd)(CORO_PARAM, uint32, uint32, uint32,
CORO_END_CODE;
}
-DECLARE_CUSTOM_FUNCTION(TonyWithMegaphoneStart)(CORO_PARAM, uint32, uint32, uint32, uint32) {
+void tonyWithMegaphoneStart(CORO_PARAM, uint32, uint32, uint32, uint32) {
CORO_BEGIN_CONTEXT;
CORO_END_CONTEXT(_ctx);
@@ -1005,7 +967,7 @@ DECLARE_CUSTOM_FUNCTION(TonyWithMegaphoneStart)(CORO_PARAM, uint32, uint32, uint
CORO_END_CODE;
}
-DECLARE_CUSTOM_FUNCTION(TonyWithMegaphoneEnd)(CORO_PARAM, uint32, uint32, uint32, uint32) {
+void tonyWithMegaphoneEnd(CORO_PARAM, uint32, uint32, uint32, uint32) {
CORO_BEGIN_CONTEXT;
CORO_END_CONTEXT(_ctx);
@@ -1018,7 +980,7 @@ DECLARE_CUSTOM_FUNCTION(TonyWithMegaphoneEnd)(CORO_PARAM, uint32, uint32, uint32
CORO_END_CODE;
}
-DECLARE_CUSTOM_FUNCTION(TonyWithBeardStart)(CORO_PARAM, uint32, uint32, uint32, uint32) {
+void tonyWithBeardStart(CORO_PARAM, uint32, uint32, uint32, uint32) {
CORO_BEGIN_CONTEXT;
CORO_END_CONTEXT(_ctx);
@@ -1031,7 +993,7 @@ DECLARE_CUSTOM_FUNCTION(TonyWithBeardStart)(CORO_PARAM, uint32, uint32, uint32,
CORO_END_CODE;
}
-DECLARE_CUSTOM_FUNCTION(TonyWithBeardEnd)(CORO_PARAM, uint32, uint32, uint32, uint32) {
+void tonyWithBeardEnd(CORO_PARAM, uint32, uint32, uint32, uint32) {
CORO_BEGIN_CONTEXT;
CORO_END_CONTEXT(_ctx);
@@ -1044,7 +1006,7 @@ DECLARE_CUSTOM_FUNCTION(TonyWithBeardEnd)(CORO_PARAM, uint32, uint32, uint32, ui
CORO_END_CODE;
}
-DECLARE_CUSTOM_FUNCTION(TonyScaredStart)(CORO_PARAM, uint32, uint32, uint32, uint32) {
+void tonyScaredStart(CORO_PARAM, uint32, uint32, uint32, uint32) {
CORO_BEGIN_CONTEXT;
CORO_END_CONTEXT(_ctx);
@@ -1057,7 +1019,7 @@ DECLARE_CUSTOM_FUNCTION(TonyScaredStart)(CORO_PARAM, uint32, uint32, uint32, uin
CORO_END_CODE;
}
-DECLARE_CUSTOM_FUNCTION(TonyScaredEnd)(CORO_PARAM, uint32, uint32, uint32, uint32) {
+void tonyScaredEnd(CORO_PARAM, uint32, uint32, uint32, uint32) {
CORO_BEGIN_CONTEXT;
CORO_END_CONTEXT(_ctx);
@@ -1071,12 +1033,12 @@ DECLARE_CUSTOM_FUNCTION(TonyScaredEnd)(CORO_PARAM, uint32, uint32, uint32, uint3
}
-DECLARE_CUSTOM_FUNCTION(TonyDisgusted)(CORO_PARAM, uint32 dwText, uint32, uint32, uint32) {
- TonySetNumTexts(dwText);
+void tonyDisgusted(CORO_PARAM, uint32 dwText, uint32, uint32, uint32) {
+ tonySetNumTexts(dwText);
GLOBALS._nTonyNextTalkType = GLOBALS._tony->TALK_DISGUSTED;
}
-DECLARE_CUSTOM_FUNCTION(TonySniffLeft)(CORO_PARAM, uint32, uint32, uint32, uint32) {
+void tonySniffLeft(CORO_PARAM, uint32, uint32, uint32, uint32) {
CORO_BEGIN_CONTEXT;
CORO_END_CONTEXT(_ctx);
@@ -1084,12 +1046,12 @@ DECLARE_CUSTOM_FUNCTION(TonySniffLeft)(CORO_PARAM, uint32, uint32, uint32, uint3
GLOBALS._tony->setPattern(GLOBALS._tony->PAT_SNIFF_LEFT);
CORO_INVOKE_0(GLOBALS._tony->waitForEndPattern);
- CORO_INVOKE_4(LeftToMe, 0, 0, 0, 0);
+ CORO_INVOKE_4(leftToMe, 0, 0, 0, 0);
CORO_END_CODE;
}
-DECLARE_CUSTOM_FUNCTION(TonySniffRight)(CORO_PARAM, uint32, uint32, uint32, uint32) {
+void tonySniffRight(CORO_PARAM, uint32, uint32, uint32, uint32) {
CORO_BEGIN_CONTEXT;
CORO_END_CONTEXT(_ctx);
@@ -1097,17 +1059,17 @@ DECLARE_CUSTOM_FUNCTION(TonySniffRight)(CORO_PARAM, uint32, uint32, uint32, uint
GLOBALS._tony->setPattern(GLOBALS._tony->PAT_SNIFF_RIGHT);
CORO_INVOKE_0(GLOBALS._tony->waitForEndPattern);
- CORO_INVOKE_4(RightToMe, 0, 0, 0, 0);
+ CORO_INVOKE_4(rightToMe, 0, 0, 0, 0);
CORO_END_CODE;
}
-DECLARE_CUSTOM_FUNCTION(TonySarcastic)(CORO_PARAM, uint32 dwText, uint32, uint32, uint32) {
- TonySetNumTexts(dwText);
+void tonySarcastic(CORO_PARAM, uint32 dwText, uint32, uint32, uint32) {
+ tonySetNumTexts(dwText);
GLOBALS._nTonyNextTalkType = GLOBALS._tony->TALK_SARCASTIC;
}
-DECLARE_CUSTOM_FUNCTION(TonyMacbeth)(CORO_PARAM, uint32 nPos, uint32, uint32, uint32) {
+void tonyMacbeth(CORO_PARAM, uint32 nPos, uint32, uint32, uint32) {
switch (nPos) {
case 1:
GLOBALS._nTonyNextTalkType = GLOBALS._tony->TALK_MACBETH1;
@@ -1140,15 +1102,15 @@ DECLARE_CUSTOM_FUNCTION(TonyMacbeth)(CORO_PARAM, uint32 nPos, uint32, uint32, ui
}
-DECLARE_CUSTOM_FUNCTION(EnableTony)(CORO_PARAM, uint32, uint32, uint32, uint32) {
+void enableTony(CORO_PARAM, uint32, uint32, uint32, uint32) {
GLOBALS._tony->show();
}
-DECLARE_CUSTOM_FUNCTION(DisableTony)(CORO_PARAM, uint32 bShowShadow, uint32, uint32, uint32) {
+void disableTony(CORO_PARAM, uint32 bShowShadow, uint32, uint32, uint32) {
GLOBALS._tony->hide(bShowShadow);
}
-DECLARE_CUSTOM_FUNCTION(WaitForPatternEnd)(CORO_PARAM, uint32 nItem, uint32, uint32, uint32) {
+void waitForPatternEnd(CORO_PARAM, uint32 nItem, uint32, uint32, uint32) {
CORO_BEGIN_CONTEXT;
RMItem *item;
CORO_END_CONTEXT(_ctx);
@@ -1164,11 +1126,11 @@ DECLARE_CUSTOM_FUNCTION(WaitForPatternEnd)(CORO_PARAM, uint32 nItem, uint32, uin
}
-DECLARE_CUSTOM_FUNCTION(SetTonyPosition)(CORO_PARAM, uint32 nX, uint32 nY, uint32 nLoc, uint32) {
+void setTonyPosition(CORO_PARAM, uint32 nX, uint32 nY, uint32 nLoc, uint32) {
GLOBALS._tony->setPosition(RMPoint(nX, nY), nLoc);
}
-DECLARE_CUSTOM_FUNCTION(MoveTonyAndWait)(CORO_PARAM, uint32 nX, uint32 nY, uint32, uint32) {
+void moveTonyAndWait(CORO_PARAM, uint32 nX, uint32 nY, uint32, uint32) {
CORO_BEGIN_CONTEXT;
CORO_END_CONTEXT(_ctx);
@@ -1187,11 +1149,11 @@ DECLARE_CUSTOM_FUNCTION(MoveTonyAndWait)(CORO_PARAM, uint32 nX, uint32 nY, uint3
CORO_END_CODE;
}
-DECLARE_CUSTOM_FUNCTION(MoveTony)(CORO_PARAM, uint32 nX, uint32 nY, uint32, uint32) {
+void moveTony(CORO_PARAM, uint32 nX, uint32 nY, uint32, uint32) {
GLOBALS._tony->move(coroParam, RMPoint(nX, nY));
}
-DECLARE_CUSTOM_FUNCTION(ScrollLocation)(CORO_PARAM, uint32 nX, uint32 nY, uint32 sX, uint32 sY) {
+void scrollLocation(CORO_PARAM, uint32 nX, uint32 nY, uint32 sX, uint32 sY) {
CORO_BEGIN_CONTEXT;
int lx, ly;
RMPoint pt;
@@ -1239,7 +1201,7 @@ DECLARE_CUSTOM_FUNCTION(ScrollLocation)(CORO_PARAM, uint32 nX, uint32 nY, uint32
CORO_END_CODE;
}
-DECLARE_CUSTOM_FUNCTION(SyncScrollLocation)(CORO_PARAM, uint32 nX, uint32 nY, uint32 sX, uint32 sY) {
+void syncScrollLocation(CORO_PARAM, uint32 nX, uint32 nY, uint32 sX, uint32 sY) {
CORO_BEGIN_CONTEXT;
int lx, ly;
RMPoint pt, startpt;
@@ -1321,7 +1283,7 @@ DECLARE_CUSTOM_FUNCTION(SyncScrollLocation)(CORO_PARAM, uint32 nX, uint32 nY, ui
}
-DECLARE_CUSTOM_FUNCTION(ChangeHotspot)(CORO_PARAM, uint32 dwCode, uint32 nX, uint32 nY, uint32) {
+void changeHotspot(CORO_PARAM, uint32 dwCode, uint32 nX, uint32 nY, uint32) {
int i;
for (i = 0; i < GLOBALS._curChangedHotspot; i++) {
@@ -1343,15 +1305,15 @@ DECLARE_CUSTOM_FUNCTION(ChangeHotspot)(CORO_PARAM, uint32 dwCode, uint32 nX, uin
}
-DECLARE_CUSTOM_FUNCTION(AutoSave)(CORO_PARAM, uint32, uint32, uint32, uint32) {
+void autoSave(CORO_PARAM, uint32, uint32, uint32, uint32) {
g_vm->autoSave(coroParam);
}
-DECLARE_CUSTOM_FUNCTION(AbortGame)(CORO_PARAM, uint32, uint32, uint32, uint32) {
+void abortGame(CORO_PARAM, uint32, uint32, uint32, uint32) {
g_vm->abortGame();
}
-DECLARE_CUSTOM_FUNCTION(ShakeScreen)(CORO_PARAM, uint32 nScosse, uint32, uint32, uint32) {
+void shakeScreen(CORO_PARAM, uint32 nScosse, uint32, uint32, uint32) {
CORO_BEGIN_CONTEXT;
uint32 i;
uint32 curTime;
@@ -1389,7 +1351,7 @@ DECLARE_CUSTOM_FUNCTION(ShakeScreen)(CORO_PARAM, uint32 nScosse, uint32, uint32,
* Characters
*/
-DECLARE_CUSTOM_FUNCTION(CharSetCode)(CORO_PARAM, uint32 nChar, uint32 nCode, uint32, uint32) {
+void charSetCode(CORO_PARAM, uint32 nChar, uint32 nCode, uint32, uint32) {
assert(nChar < 16);
GLOBALS._character[nChar]._code = nCode;
GLOBALS._character[nChar]._item = GLOBALS._loc->getItemFromCode(nCode);
@@ -1404,26 +1366,26 @@ DECLARE_CUSTOM_FUNCTION(CharSetCode)(CORO_PARAM, uint32 nChar, uint32 nCode, uin
GLOBALS._isMChar[nChar] = false;
}
-DECLARE_CUSTOM_FUNCTION(CharSetColor)(CORO_PARAM, uint32 nChar, uint32 r, uint32 g, uint32 b) {
+void charSetColor(CORO_PARAM, uint32 nChar, uint32 r, uint32 g, uint32 b) {
assert(nChar < 16);
GLOBALS._character[nChar]._r = r;
GLOBALS._character[nChar]._g = g;
GLOBALS._character[nChar]._b = b;
}
-DECLARE_CUSTOM_FUNCTION(CharSetTalkPattern)(CORO_PARAM, uint32 nChar, uint32 tp, uint32 sp, uint32) {
+void charSetTalkPattern(CORO_PARAM, uint32 nChar, uint32 tp, uint32 sp, uint32) {
assert(nChar < 16);
GLOBALS._character[nChar]._talkPattern = tp;
GLOBALS._character[nChar]._standPattern = sp;
}
-DECLARE_CUSTOM_FUNCTION(CharSetStartEndTalkPattern)(CORO_PARAM, uint32 nChar, uint32 sp, uint32 ep, uint32) {
+void charSetStartEndTalkPattern(CORO_PARAM, uint32 nChar, uint32 sp, uint32 ep, uint32) {
assert(nChar < 16);
GLOBALS._character[nChar]._startTalkPattern = sp;
GLOBALS._character[nChar]._endTalkPattern = ep;
}
-DECLARE_CUSTOM_FUNCTION(CharSendMessage)(CORO_PARAM, uint32 nChar, uint32 dwMessage, uint32 bIsBack, uint32) {
+void charSendMessage(CORO_PARAM, uint32 nChar, uint32 dwMessage, uint32 bIsBack, uint32) {
CORO_BEGIN_CONTEXT;
RMMessage *msg;
int i;
@@ -1450,7 +1412,7 @@ DECLARE_CUSTOM_FUNCTION(CharSendMessage)(CORO_PARAM, uint32 nChar, uint32 dwMess
GLOBALS._character[nChar]._item->setPattern(GLOBALS._character[nChar]._talkPattern);
- _ctx->curVoc = SearchVoiceHeader(0, dwMessage);
+ _ctx->curVoc = searchVoiceHeader(0, dwMessage);
_ctx->voice = NULL;
if (_ctx->curVoc) {
// Position within the database of entries, beginning at the first
@@ -1530,15 +1492,15 @@ DECLARE_CUSTOM_FUNCTION(CharSendMessage)(CORO_PARAM, uint32 nChar, uint32 dwMess
CORO_END_CODE;
}
-DECLARE_CUSTOM_FUNCTION(AddInventory)(CORO_PARAM, uint32 dwCode, uint32, uint32, uint32) {
+void addInventory(CORO_PARAM, uint32 dwCode, uint32, uint32, uint32) {
GLOBALS._inventory->addItem(dwCode);
}
-DECLARE_CUSTOM_FUNCTION(RemoveInventory)(CORO_PARAM, uint32 dwCode, uint32, uint32, uint32) {
+void removeInventory(CORO_PARAM, uint32 dwCode, uint32, uint32, uint32) {
GLOBALS._inventory->removeItem(dwCode);
}
-DECLARE_CUSTOM_FUNCTION(ChangeInventoryStatus)(CORO_PARAM, uint32 dwCode, uint32 dwStatus, uint32, uint32) {
+void changeInventoryStatus(CORO_PARAM, uint32 dwCode, uint32 dwStatus, uint32, uint32) {
GLOBALS._inventory->changeItemStatus(dwCode, dwStatus);
}
@@ -1547,7 +1509,7 @@ DECLARE_CUSTOM_FUNCTION(ChangeInventoryStatus)(CORO_PARAM, uint32 dwCode, uint32
* Master Characters
*/
-DECLARE_CUSTOM_FUNCTION(MCharSetCode)(CORO_PARAM, uint32 nChar, uint32 nCode, uint32, uint32) {
+void mCharSetCode(CORO_PARAM, uint32 nChar, uint32 nCode, uint32, uint32) {
assert(nChar < 10);
GLOBALS._mCharacter[nChar]._code = nCode;
if (nCode == 0)
@@ -1569,56 +1531,52 @@ DECLARE_CUSTOM_FUNCTION(MCharSetCode)(CORO_PARAM, uint32 nChar, uint32 nCode, ui
GLOBALS._isMChar[nChar] = true;
}
-DECLARE_CUSTOM_FUNCTION(MCharResetCode)(CORO_PARAM, uint32 nChar, uint32, uint32, uint32) {
+void mCharResetCode(CORO_PARAM, uint32 nChar, uint32, uint32, uint32) {
GLOBALS._mCharacter[nChar]._item = GLOBALS._loc->getItemFromCode(GLOBALS._mCharacter[nChar]._code);
}
-DECLARE_CUSTOM_FUNCTION(MCharSetPosition)(CORO_PARAM, uint32 nChar, uint32 nX, uint32 nY, uint32) {
+void mCharSetPosition(CORO_PARAM, uint32 nChar, uint32 nX, uint32 nY, uint32) {
assert(nChar < 10);
GLOBALS._mCharacter[nChar]._x = nX;
GLOBALS._mCharacter[nChar]._y = nY;
}
-
-DECLARE_CUSTOM_FUNCTION(MCharSetColor)(CORO_PARAM, uint32 nChar, uint32 r, uint32 g, uint32 b) {
+void mCharSetColor(CORO_PARAM, uint32 nChar, uint32 r, uint32 g, uint32 b) {
assert(nChar < 10);
GLOBALS._mCharacter[nChar]._r = r;
GLOBALS._mCharacter[nChar]._g = g;
GLOBALS._mCharacter[nChar]._b = b;
}
-
-DECLARE_CUSTOM_FUNCTION(MCharSetNumTalksInGroup)(CORO_PARAM, uint32 nChar, uint32 nGroup, uint32 nTalks, uint32) {
+void mCharSetNumTalksInGroup(CORO_PARAM, uint32 nChar, uint32 nGroup, uint32 nTalks, uint32) {
assert(nChar < 10);
assert(nGroup < 10);
GLOBALS._mCharacter[nChar]._numTalks[nGroup] = nTalks;
}
-
-DECLARE_CUSTOM_FUNCTION(MCharSetCurrentGroup)(CORO_PARAM, uint32 nChar, uint32 nGroup, uint32, uint32) {
+void mCharSetCurrentGroup(CORO_PARAM, uint32 nChar, uint32 nGroup, uint32, uint32) {
assert(nChar < 10);
assert(nGroup < 10);
GLOBALS._mCharacter[nChar]._curGroup = nGroup;
}
-DECLARE_CUSTOM_FUNCTION(MCharSetNumTexts)(CORO_PARAM, uint32 nChar, uint32 nTexts, uint32, uint32) {
+void mCharSetNumTexts(CORO_PARAM, uint32 nChar, uint32 nTexts, uint32, uint32) {
assert(nChar < 10);
GLOBALS._mCharacter[nChar]._numTexts = nTexts - 1;
GLOBALS._mCharacter[nChar]._bInTexts = false;
}
-DECLARE_CUSTOM_FUNCTION(MCharSetAlwaysBack)(CORO_PARAM, uint32 nChar, uint32 bAlwaysBack, uint32, uint32) {
+void mCharSetAlwaysBack(CORO_PARAM, uint32 nChar, uint32 bAlwaysBack, uint32, uint32) {
assert(nChar < 10);
GLOBALS._mCharacter[nChar]._bAlwaysBack = bAlwaysBack;
}
-
-DECLARE_CUSTOM_FUNCTION(MCharSendMessage)(CORO_PARAM, uint32 nChar, uint32 dwMessage, uint32 bIsBack, uint32 nFont) {
+void mCharSendMessage(CORO_PARAM, uint32 nChar, uint32 dwMessage, uint32 bIsBack, uint32 nFont) {
CORO_BEGIN_CONTEXT;
RMMessage *msg;
int i;
@@ -1658,11 +1616,10 @@ DECLARE_CUSTOM_FUNCTION(MCharSendMessage)(CORO_PARAM, uint32 nChar, uint32 dwMes
}
}
- _ctx->curVoc = SearchVoiceHeader(0, dwMessage);
+ _ctx->curVoc = searchVoiceHeader(0, dwMessage);
_ctx->voice = NULL;
if (_ctx->curVoc) {
// Position within the database of entries, beginning at the first
- // fseek(g_vm->m_vdbFP, curVoc->offset, SEEK_SET);
g_vm->_vdbFP.seek(_ctx->curVoc->_offset);
_ctx->curOffset = _ctx->curVoc->_offset;
}
@@ -1744,9 +1701,7 @@ DECLARE_CUSTOM_FUNCTION(MCharSendMessage)(CORO_PARAM, uint32 nChar, uint32 dwMes
* Dialogs
*/
-int g_curDialog;
-
-DECLARE_CUSTOM_FUNCTION(SendDialogMessage)(CORO_PARAM, uint32 nPers, uint32 nMsg, uint32, uint32) {
+void sendDialogMessage(CORO_PARAM, uint32 nPers, uint32 nMsg, uint32, uint32) {
CORO_BEGIN_CONTEXT;
char *string;
RMTextDialog *text;
@@ -1766,7 +1721,7 @@ DECLARE_CUSTOM_FUNCTION(SendDialogMessage)(CORO_PARAM, uint32 nPers, uint32 nMsg
if (nPers != 0 && GLOBALS._isMChar[nPers] && GLOBALS._mCharacter[nPers]._bAlwaysBack)
_ctx->bIsBack = true;
- _ctx->curVoc = SearchVoiceHeader(g_curDialog, nMsg);
+ _ctx->curVoc = searchVoiceHeader(GLOBALS._curDialog, nMsg);
_ctx->voice = NULL;
if (_ctx->curVoc) {
@@ -1927,7 +1882,7 @@ DECLARE_CUSTOM_FUNCTION(SendDialogMessage)(CORO_PARAM, uint32 nPers, uint32 nMsg
// @@@@ This cannot be skipped!!!!!!!!!!!!!!!!!!!
-DECLARE_CUSTOM_FUNCTION(StartDialog)(CORO_PARAM, uint32 nDialog, uint32 nStartGroup, uint32, uint32) {
+void startDialog(CORO_PARAM, uint32 nDialog, uint32 nStartGroup, uint32, uint32) {
CORO_BEGIN_CONTEXT;
uint32 nChoice;
uint32 *sl;
@@ -1939,7 +1894,7 @@ DECLARE_CUSTOM_FUNCTION(StartDialog)(CORO_PARAM, uint32 nDialog, uint32 nStartGr
CORO_BEGIN_CODE(_ctx);
- g_curDialog = nDialog;
+ GLOBALS._curDialog = nDialog;
// Call MPAL to start the dialog
mpalQueryDoDialog(nDialog, nStartGroup);
@@ -2010,7 +1965,7 @@ DECLARE_CUSTOM_FUNCTION(StartDialog)(CORO_PARAM, uint32 nDialog, uint32 nStartGr
* Sync between idle and mpal
*/
-DECLARE_CUSTOM_FUNCTION(TakeOwnership)(CORO_PARAM, uint32 num, uint32, uint32, uint32) {
+void takeOwnership(CORO_PARAM, uint32 num, uint32, uint32, uint32) {
CORO_BEGIN_CONTEXT;
CORO_END_CONTEXT(_ctx);
@@ -2028,7 +1983,7 @@ DECLARE_CUSTOM_FUNCTION(TakeOwnership)(CORO_PARAM, uint32 num, uint32, uint32, u
CORO_END_CODE;
}
-DECLARE_CUSTOM_FUNCTION(ReleaseOwnership)(CORO_PARAM, uint32 num, uint32, uint32, uint32) {
+void releaseOwnership(CORO_PARAM, uint32 num, uint32, uint32, uint32) {
if (!GLOBALS._mut[num]._lockCount) {
warning("ReleaseOwnership tried to release mutex %d, which isn't held", num);
return;
@@ -2058,7 +2013,7 @@ DECLARE_CUSTOM_FUNCTION(ReleaseOwnership)(CORO_PARAM, uint32 num, uint32, uint32
*
*/
-void ThreadFadeInMusic(CORO_PARAM, const void *nMusic) {
+void threadFadeInMusic(CORO_PARAM, const void *nMusic) {
CORO_BEGIN_CONTEXT;
int i;
CORO_END_CONTEXT(_ctx);
@@ -2083,7 +2038,7 @@ void ThreadFadeInMusic(CORO_PARAM, const void *nMusic) {
CORO_END_CODE;
}
-void ThreadFadeOutMusic(CORO_PARAM, const void *nMusic) {
+void threadFadeOutMusic(CORO_PARAM, const void *nMusic) {
CORO_BEGIN_CONTEXT;
int i;
int startVolume;
@@ -2114,52 +2069,52 @@ void ThreadFadeOutMusic(CORO_PARAM, const void *nMusic) {
CORO_END_CODE;
}
-DECLARE_CUSTOM_FUNCTION(FadeInSoundEffect)(CORO_PARAM, uint32, uint32, uint32, uint32) {
- CoroScheduler.createProcess(ThreadFadeInMusic, &GLOBALS._curSoundEffect, sizeof(int));
+void fadeInSoundEffect(CORO_PARAM, uint32, uint32, uint32, uint32) {
+ CoroScheduler.createProcess(threadFadeInMusic, &GLOBALS._curSoundEffect, sizeof(int));
}
-DECLARE_CUSTOM_FUNCTION(FadeOutSoundEffect)(CORO_PARAM, uint32, uint32, uint32, uint32) {
+void fadeOutSoundEffect(CORO_PARAM, uint32, uint32, uint32, uint32) {
GLOBALS._bFadeOutStop = false;
- CoroScheduler.createProcess(ThreadFadeOutMusic, &GLOBALS._curSoundEffect, sizeof(int));
+ CoroScheduler.createProcess(threadFadeOutMusic, &GLOBALS._curSoundEffect, sizeof(int));
}
-DECLARE_CUSTOM_FUNCTION(FadeOutJingle)(CORO_PARAM, uint32, uint32, uint32, uint32) {
+void fadeOutJingle(CORO_PARAM, uint32, uint32, uint32, uint32) {
GLOBALS._bFadeOutStop = false;
int channel = 2;
- CoroScheduler.createProcess(ThreadFadeOutMusic, &channel, sizeof(int));
+ CoroScheduler.createProcess(threadFadeOutMusic, &channel, sizeof(int));
}
-DECLARE_CUSTOM_FUNCTION(FadeInJingle)(CORO_PARAM, uint32, uint32, uint32, uint32) {
+void fadeInJingle(CORO_PARAM, uint32, uint32, uint32, uint32) {
int channel = 2;
- CoroScheduler.createProcess(ThreadFadeInMusic, &channel, sizeof(int));
+ CoroScheduler.createProcess(threadFadeInMusic, &channel, sizeof(int));
}
-DECLARE_CUSTOM_FUNCTION(StopSoundEffect)(CORO_PARAM, uint32, uint32, uint32, uint32) {
+void stopSoundEffect(CORO_PARAM, uint32, uint32, uint32, uint32) {
g_vm->stopMusic(GLOBALS._curSoundEffect);
}
-DECLARE_CUSTOM_FUNCTION(StopJingle)(CORO_PARAM, uint32, uint32, uint32, uint32) {
+void stopJingle(CORO_PARAM, uint32, uint32, uint32, uint32) {
g_vm->stopMusic(2);
}
-DECLARE_CUSTOM_FUNCTION(MuteSoundEffect)(CORO_PARAM, uint32, uint32, uint32, uint32) {
+void muteSoundEffect(CORO_PARAM, uint32, uint32, uint32, uint32) {
g_vm->setMusicVolume(GLOBALS._curSoundEffect, 0);
}
-DECLARE_CUSTOM_FUNCTION(DemuteSoundEffect)(CORO_PARAM, uint32, uint32, uint32, uint32) {
+void demuteSoundEffect(CORO_PARAM, uint32, uint32, uint32, uint32) {
GLOBALS._bFadeOutStop = true;
g_vm->setMusicVolume(GLOBALS._curSoundEffect, 64);
}
-DECLARE_CUSTOM_FUNCTION(MuteJingle)(CORO_PARAM, uint32, uint32, uint32, uint32) {
+void muteJingle(CORO_PARAM, uint32, uint32, uint32, uint32) {
g_vm->setMusicVolume(2, 0);
}
-DECLARE_CUSTOM_FUNCTION(DemuteJingle)(CORO_PARAM, uint32, uint32, uint32, uint32) {
+void demuteJingle(CORO_PARAM, uint32, uint32, uint32, uint32) {
g_vm->setMusicVolume(2, 64);
}
-void CustPlayMusic(uint32 nChannel, const char *mFN, uint32 nFX, bool bLoop, int nSync = 0) {
+void custPlayMusic(uint32 nChannel, const char *mFN, uint32 nFX, bool bLoop, int nSync = 0) {
if (nSync == 0)
nSync = 2000;
debugC(DEBUG_INTERMEDIATE, kTonyDebugMusic, "Start CustPlayMusic");
@@ -2167,21 +2122,21 @@ void CustPlayMusic(uint32 nChannel, const char *mFN, uint32 nFX, bool bLoop, int
debugC(DEBUG_INTERMEDIATE, kTonyDebugMusic, "End CustPlayMusic");
}
-DECLARE_CUSTOM_FUNCTION(PlaySoundEffect)(CORO_PARAM, uint32 nMusic, uint32 nFX, uint32 bNoLoop, uint32) {
+void playSoundEffect(CORO_PARAM, uint32 nMusic, uint32 nFX, uint32 bNoLoop, uint32) {
if (nFX == 0 || nFX == 1 || nFX == 2) {
debugC(DEBUG_INTERMEDIATE, kTonyDebugSound, "PlaySoundEffect stop fadeout");
GLOBALS._bFadeOutStop = true;
}
GLOBALS._lastMusic = nMusic;
- CustPlayMusic(GLOBALS._curSoundEffect, musicFiles[nMusic].name, nFX, bNoLoop ? false : true, musicFiles[nMusic].sync);
+ custPlayMusic(GLOBALS._curSoundEffect, kMusicFiles[nMusic]._name, nFX, bNoLoop ? false : true, kMusicFiles[nMusic]._sync);
}
-DECLARE_CUSTOM_FUNCTION(PlayJingle)(CORO_PARAM, uint32 nMusic, uint32 nFX, uint32 bLoop, uint32) {
- CustPlayMusic(2, jingleFileNames[nMusic], nFX, bLoop);
+void playJingle(CORO_PARAM, uint32 nMusic, uint32 nFX, uint32 bLoop, uint32) {
+ custPlayMusic(2, kJingleFileNames[nMusic], nFX, bLoop);
}
-DECLARE_CUSTOM_FUNCTION(PlayItemSfx)(CORO_PARAM, uint32 nItem, uint32 nSFX, uint32, uint32) {
+void playItemSfx(CORO_PARAM, uint32 nItem, uint32 nSFX, uint32, uint32) {
if (nItem == 0) {
GLOBALS._tony->playSfx(nSFX);
} else {
@@ -2191,76 +2146,71 @@ DECLARE_CUSTOM_FUNCTION(PlayItemSfx)(CORO_PARAM, uint32 nItem, uint32 nSFX, uint
}
}
-
-void RestoreMusic(CORO_PARAM) {
+void restoreMusic(CORO_PARAM) {
CORO_BEGIN_CONTEXT;
CORO_END_CONTEXT(_ctx);
CORO_BEGIN_CODE(_ctx);
- CORO_INVOKE_4(PlaySoundEffect, GLOBALS._lastMusic, 0, 0, 0);
+ CORO_INVOKE_4(playSoundEffect, GLOBALS._lastMusic, 0, 0, 0);
if (GLOBALS._lastTappeto != 0)
- CustPlayMusic(4, ambianceFile[GLOBALS._lastTappeto], 0, true);
+ custPlayMusic(4, kAmbianceFile[GLOBALS._lastTappeto], 0, true);
CORO_END_CODE;
}
-void SaveMusic(Common::OutSaveFile *f) {
+void saveMusic(Common::OutSaveFile *f) {
f->writeByte(GLOBALS._lastMusic);
f->writeByte(GLOBALS._lastTappeto);
}
-void LoadMusic(Common::InSaveFile *f) {
+void loadMusic(Common::InSaveFile *f) {
GLOBALS._lastMusic = f->readByte();
GLOBALS._lastTappeto = f->readByte();
}
-
-DECLARE_CUSTOM_FUNCTION(JingleFadeStart)(CORO_PARAM, uint32 nJingle, uint32 bLoop, uint32, uint32) {
+void jingleFadeStart(CORO_PARAM, uint32 nJingle, uint32 bLoop, uint32, uint32) {
CORO_BEGIN_CONTEXT;
CORO_END_CONTEXT(_ctx);
CORO_BEGIN_CODE(_ctx);
- CORO_INVOKE_4(FadeOutSoundEffect, 0, 0, 0, 0);
- CORO_INVOKE_4(MuteJingle, 0, 0, 0, 0);
- CORO_INVOKE_4(PlayJingle, nJingle, 0, bLoop, 0);
- CORO_INVOKE_4(FadeInJingle, 0, 0, 0, 0);
+ CORO_INVOKE_4(fadeOutSoundEffect, 0, 0, 0, 0);
+ CORO_INVOKE_4(muteJingle, 0, 0, 0, 0);
+ CORO_INVOKE_4(playJingle, nJingle, 0, bLoop, 0);
+ CORO_INVOKE_4(fadeInJingle, 0, 0, 0, 0);
CORO_END_CODE;
}
-DECLARE_CUSTOM_FUNCTION(JingleFadeEnd)(CORO_PARAM, uint32 nJingle, uint32 bLoop, uint32, uint32) {
+void jingleFadeEnd(CORO_PARAM, uint32 nJingle, uint32 bLoop, uint32, uint32) {
CORO_BEGIN_CONTEXT;
CORO_END_CONTEXT(_ctx);
CORO_BEGIN_CODE(_ctx);
- CORO_INVOKE_4(FadeOutJingle, 0, 0, 0, 0);
- CORO_INVOKE_4(FadeInSoundEffect, 0, 0, 0, 0);
+ CORO_INVOKE_4(fadeOutJingle, 0, 0, 0, 0);
+ CORO_INVOKE_4(fadeInSoundEffect, 0, 0, 0, 0);
CORO_END_CODE;
}
-
-
-
-DECLARE_CUSTOM_FUNCTION(MustSkipIdleStart)(CORO_PARAM, uint32, uint32, uint32, uint32) {
+void mustSkipIdleStart(CORO_PARAM, uint32, uint32, uint32, uint32) {
GLOBALS._bSkipIdle = true;
CoroScheduler.setEvent(GLOBALS._hSkipIdle);
}
-DECLARE_CUSTOM_FUNCTION(MustSkipIdleEnd)(CORO_PARAM, uint32, uint32, uint32, uint32) {
+void mustSkipIdleEnd(CORO_PARAM, uint32, uint32, uint32, uint32) {
GLOBALS._bSkipIdle = false;
CoroScheduler.resetEvent(GLOBALS._hSkipIdle);
}
-DECLARE_CUSTOM_FUNCTION(PatIrqFreeze)(CORO_PARAM, uint32 bStatus, uint32, uint32, uint32) {
+void patIrqFreeze(CORO_PARAM, uint32 bStatus, uint32, uint32, uint32) {
// Unused in ScummVM.
}
-DECLARE_CUSTOM_FUNCTION(OpenInitLoadMenu)(CORO_PARAM, uint32, uint32, uint32, uint32) {
+void openInitLoadMenu(CORO_PARAM, uint32, uint32, uint32, uint32) {
CORO_BEGIN_CONTEXT;
CORO_END_CONTEXT(_ctx);
@@ -2271,7 +2221,7 @@ DECLARE_CUSTOM_FUNCTION(OpenInitLoadMenu)(CORO_PARAM, uint32, uint32, uint32, ui
CORO_END_CODE;
}
-DECLARE_CUSTOM_FUNCTION(OpenInitOptions)(CORO_PARAM, uint32, uint32, uint32, uint32) {
+void openInitOptions(CORO_PARAM, uint32, uint32, uint32, uint32) {
CORO_BEGIN_CONTEXT;
CORO_END_CONTEXT(_ctx);
@@ -2282,8 +2232,7 @@ DECLARE_CUSTOM_FUNCTION(OpenInitOptions)(CORO_PARAM, uint32, uint32, uint32, uin
CORO_END_CODE;
}
-
-DECLARE_CUSTOM_FUNCTION(DoCredits)(CORO_PARAM, uint32 nMsg, uint32 dwTime, uint32, uint32) {
+void doCredits(CORO_PARAM, uint32 nMsg, uint32 dwTime, uint32, uint32) {
CORO_BEGIN_CONTEXT;
RMMessage *msg;
RMTextDialog *text;
@@ -2355,159 +2304,157 @@ DECLARE_CUSTOM_FUNCTION(DoCredits)(CORO_PARAM, uint32 nMsg, uint32 dwTime, uint3
CORO_END_CODE;
}
-
-
BEGIN_CUSTOM_FUNCTION_MAP()
-ASSIGN(1, CustLoadLocation)
-ASSIGN(2, MySleep)
-ASSIGN(3, SetPointer)
-ASSIGN(5, MoveTony)
-ASSIGN(6, FaceToMe)
-ASSIGN(7, BackToMe)
-ASSIGN(8, LeftToMe)
-ASSIGN(9, RightToMe)
-ASSIGN(10, SendTonyMessage)
-ASSIGN(11, ChangeBoxStatus)
-ASSIGN(12, ChangeLocation)
-ASSIGN(13, DisableTony)
-ASSIGN(14, EnableTony)
-ASSIGN(15, WaitForPatternEnd)
-ASSIGN(16, SetLocStartPosition)
-ASSIGN(17, ScrollLocation)
-ASSIGN(18, MoveTonyAndWait)
-ASSIGN(19, ChangeHotspot)
-ASSIGN(20, AddInventory)
-ASSIGN(21, RemoveInventory)
-ASSIGN(22, ChangeInventoryStatus)
-ASSIGN(23, SetTonyPosition)
-ASSIGN(24, SendFullscreenMessage)
-ASSIGN(25, SaveTonyPosition)
-ASSIGN(26, RestoreTonyPosition)
-ASSIGN(27, DisableInput)
-ASSIGN(28, EnableInput)
-ASSIGN(29, StopTony)
-
-ASSIGN(30, TonyTakeUp1)
-ASSIGN(31, TonyTakeMid1)
-ASSIGN(32, TonyTakeDown1)
-ASSIGN(33, TonyTakeUp2)
-ASSIGN(34, TonyTakeMid2)
-ASSIGN(35, TonyTakeDown2)
-
-ASSIGN(72, TonyPutUp1)
-ASSIGN(73, TonyPutMid1)
-ASSIGN(74, TonyPutDown1)
-ASSIGN(75, TonyPutUp2)
-ASSIGN(76, TonyPutMid2)
-ASSIGN(77, TonyPutDown2)
-
-ASSIGN(36, TonyOnTheFloor)
-ASSIGN(37, TonyGetUp)
-ASSIGN(38, TonyShepherdess)
-ASSIGN(39, TonyWhistle)
-
-ASSIGN(40, TonyLaugh)
-ASSIGN(41, TonyHips)
-ASSIGN(42, TonySing)
-ASSIGN(43, TonyIndicate)
-ASSIGN(44, TonyScaredWithHands)
-ASSIGN(49, TonyScaredWithoutHands)
-ASSIGN(45, TonyWithGlasses)
-ASSIGN(46, TonyWithWorm)
-ASSIGN(47, TonyWithHammer)
-ASSIGN(48, TonyWithRope)
-ASSIGN(90, TonyWithRabbitANIM)
-ASSIGN(91, TonyWithRecipeANIM)
-ASSIGN(92, TonyWithCardsANIM)
-ASSIGN(93, TonyWithSnowmanANIM)
-ASSIGN(94, TonyWithSnowmanStart)
-ASSIGN(95, TonyWithSnowmanEnd)
-ASSIGN(96, TonyWithRabbitStart)
-ASSIGN(97, TonyWithRabbitEnd)
-ASSIGN(98, TonyWithRecipeStart)
-ASSIGN(99, TonyWithRecipeEnd)
-ASSIGN(100, TonyWithCardsStart)
-ASSIGN(101, TonyWithCardsEnd)
-ASSIGN(102, TonyWithNotebookStart)
-ASSIGN(103, TonyWithNotebookEnd)
-ASSIGN(104, TonyWithMegaphoneStart)
-ASSIGN(105, TonyWithMegaphoneEnd)
-ASSIGN(106, TonyWithBeardStart)
-ASSIGN(107, TonyWithBeardEnd)
-ASSIGN(108, TonyGiggle)
-ASSIGN(109, TonyDisgusted)
-ASSIGN(110, TonySarcastic)
-ASSIGN(111, TonyMacbeth)
-ASSIGN(112, TonySniffLeft)
-ASSIGN(113, TonySniffRight)
-ASSIGN(114, TonyScaredStart)
-ASSIGN(115, TonyScaredEnd)
-ASSIGN(116, TonyWithSecretary)
-
-ASSIGN(50, CharSetCode)
-ASSIGN(51, CharSetColor)
-ASSIGN(52, CharSetTalkPattern)
-ASSIGN(53, CharSendMessage)
-ASSIGN(54, CharSetStartEndTalkPattern)
-
-ASSIGN(60, MCharSetCode)
-ASSIGN(61, MCharSetColor)
-ASSIGN(62, MCharSetCurrentGroup)
-ASSIGN(63, MCharSetNumTalksInGroup)
-ASSIGN(64, MCharSetNumTexts)
-ASSIGN(65, MCharSendMessage)
-ASSIGN(66, MCharSetPosition)
-ASSIGN(67, MCharSetAlwaysBack)
-ASSIGN(68, MCharResetCode)
-
-ASSIGN(70, StartDialog)
-ASSIGN(71, SendDialogMessage)
-
-ASSIGN(80, TakeOwnership)
-ASSIGN(81, ReleaseOwnership)
-
-ASSIGN(86, PlaySoundEffect)
-ASSIGN(87, PlayJingle)
-ASSIGN(88, FadeInSoundEffect)
-ASSIGN(89, FadeOutSoundEffect)
-ASSIGN(123, FadeInJingle)
-ASSIGN(124, FadeOutJingle)
-ASSIGN(125, MuteSoundEffect)
-ASSIGN(126, DemuteSoundEffect)
-ASSIGN(127, MuteJingle)
-ASSIGN(128, DemuteJingle)
-ASSIGN(84, StopSoundEffect)
-ASSIGN(85, StopJingle)
-ASSIGN(83, PlayItemSfx)
-ASSIGN(129, JingleFadeStart)
-ASSIGN(130, JingleFadeEnd)
-
-ASSIGN(120, ShakeScreen)
-ASSIGN(121, AutoSave)
-ASSIGN(122, AbortGame)
-ASSIGN(131, NoBullsEye)
-ASSIGN(132, SendFullscreenMsgStart)
-ASSIGN(133, SendFullscreenMsgEnd)
-ASSIGN(134, CustEnableGUI)
-ASSIGN(135, CustDisableGUI)
-ASSIGN(136, ClearScreen)
-ASSIGN(137, PatIrqFreeze)
-ASSIGN(138, TonySetPerorate)
-ASSIGN(139, OpenInitLoadMenu)
-ASSIGN(140, OpenInitOptions)
-ASSIGN(141, SyncScrollLocation)
-ASSIGN(142, CloseLocation)
-ASSIGN(143, SetAlwaysDisplay)
-ASSIGN(144, DoCredits)
-
-ASSIGN(200, MustSkipIdleStart);
-ASSIGN(201, MustSkipIdleEnd);
+ASSIGN(1, custLoadLocation)
+ASSIGN(2, mySleep)
+ASSIGN(3, setPointer)
+ASSIGN(5, moveTony)
+ASSIGN(6, faceToMe)
+ASSIGN(7, backToMe)
+ASSIGN(8, leftToMe)
+ASSIGN(9, rightToMe)
+ASSIGN(10, sendTonyMessage)
+ASSIGN(11, changeBoxStatus)
+ASSIGN(12, changeLocation)
+ASSIGN(13, disableTony)
+ASSIGN(14, enableTony)
+ASSIGN(15, waitForPatternEnd)
+ASSIGN(16, setLocStartPosition)
+ASSIGN(17, scrollLocation)
+ASSIGN(18, moveTonyAndWait)
+ASSIGN(19, changeHotspot)
+ASSIGN(20, addInventory)
+ASSIGN(21, removeInventory)
+ASSIGN(22, changeInventoryStatus)
+ASSIGN(23, setTonyPosition)
+ASSIGN(24, sendFullscreenMessage)
+ASSIGN(25, saveTonyPosition)
+ASSIGN(26, restoreTonyPosition)
+ASSIGN(27, disableInput)
+ASSIGN(28, enableInput)
+ASSIGN(29, stopTony)
+
+ASSIGN(30, tonyTakeUp1)
+ASSIGN(31, tonyTakeMid1)
+ASSIGN(32, tonyTakeDown1)
+ASSIGN(33, tonyTakeUp2)
+ASSIGN(34, tonyTakeMid2)
+ASSIGN(35, tonyTakeDown2)
+
+ASSIGN(72, tonyPutUp1)
+ASSIGN(73, tonyPutMid1)
+ASSIGN(74, tonyPutDown1)
+ASSIGN(75, tonyPutUp2)
+ASSIGN(76, tonyPutMid2)
+ASSIGN(77, tonyPutDown2)
+
+ASSIGN(36, tonyOnTheFloor)
+ASSIGN(37, tonyGetUp)
+ASSIGN(38, tonyShepherdess)
+ASSIGN(39, tonyWhistle)
+
+ASSIGN(40, tonyLaugh)
+ASSIGN(41, tonyHips)
+ASSIGN(42, tonySing)
+ASSIGN(43, tonyIndicate)
+ASSIGN(44, tonyScaredWithHands)
+ASSIGN(49, tonyScaredWithoutHands)
+ASSIGN(45, tonyWithGlasses)
+ASSIGN(46, tonyWithWorm)
+ASSIGN(47, tonyWithHammer)
+ASSIGN(48, tonyWithRope)
+ASSIGN(90, tonyWithRabbitANIM)
+ASSIGN(91, tonyWithRecipeANIM)
+ASSIGN(92, tonyWithCardsANIM)
+ASSIGN(93, tonyWithSnowmanANIM)
+ASSIGN(94, tonyWithSnowmanStart)
+ASSIGN(95, tonyWithSnowmanEnd)
+ASSIGN(96, tonyWithRabbitStart)
+ASSIGN(97, tonyWithRabbitEnd)
+ASSIGN(98, tonyWithRecipeStart)
+ASSIGN(99, tonyWithRecipeEnd)
+ASSIGN(100, tonyWithCardsStart)
+ASSIGN(101, tonyWithCardsEnd)
+ASSIGN(102, tonyWithNotebookStart)
+ASSIGN(103, tonyWithNotebookEnd)
+ASSIGN(104, tonyWithMegaphoneStart)
+ASSIGN(105, tonyWithMegaphoneEnd)
+ASSIGN(106, tonyWithBeardStart)
+ASSIGN(107, tonyWithBeardEnd)
+ASSIGN(108, tonyGiggle)
+ASSIGN(109, tonyDisgusted)
+ASSIGN(110, tonySarcastic)
+ASSIGN(111, tonyMacbeth)
+ASSIGN(112, tonySniffLeft)
+ASSIGN(113, tonySniffRight)
+ASSIGN(114, tonyScaredStart)
+ASSIGN(115, tonyScaredEnd)
+ASSIGN(116, tonyWithSecretary)
+
+ASSIGN(50, charSetCode)
+ASSIGN(51, charSetColor)
+ASSIGN(52, charSetTalkPattern)
+ASSIGN(53, charSendMessage)
+ASSIGN(54, charSetStartEndTalkPattern)
+
+ASSIGN(60, mCharSetCode)
+ASSIGN(61, mCharSetColor)
+ASSIGN(62, mCharSetCurrentGroup)
+ASSIGN(63, mCharSetNumTalksInGroup)
+ASSIGN(64, mCharSetNumTexts)
+ASSIGN(65, mCharSendMessage)
+ASSIGN(66, mCharSetPosition)
+ASSIGN(67, mCharSetAlwaysBack)
+ASSIGN(68, mCharResetCode)
+
+ASSIGN(70, startDialog)
+ASSIGN(71, sendDialogMessage)
+
+ASSIGN(80, takeOwnership)
+ASSIGN(81, releaseOwnership)
+
+ASSIGN(86, playSoundEffect)
+ASSIGN(87, playJingle)
+ASSIGN(88, fadeInSoundEffect)
+ASSIGN(89, fadeOutSoundEffect)
+ASSIGN(123, fadeInJingle)
+ASSIGN(124, fadeOutJingle)
+ASSIGN(125, muteSoundEffect)
+ASSIGN(126, demuteSoundEffect)
+ASSIGN(127, muteJingle)
+ASSIGN(128, demuteJingle)
+ASSIGN(84, stopSoundEffect)
+ASSIGN(85, stopJingle)
+ASSIGN(83, playItemSfx)
+ASSIGN(129, jingleFadeStart)
+ASSIGN(130, jingleFadeEnd)
+
+ASSIGN(120, shakeScreen)
+ASSIGN(121, autoSave)
+ASSIGN(122, abortGame)
+ASSIGN(131, noBullsEye)
+ASSIGN(132, sendFullscreenMsgStart)
+ASSIGN(133, sendFullscreenMsgEnd)
+ASSIGN(134, custEnableGUI)
+ASSIGN(135, custDisableGUI)
+ASSIGN(136, clearScreen)
+ASSIGN(137, patIrqFreeze)
+ASSIGN(138, tonySetPerorate)
+ASSIGN(139, openInitLoadMenu)
+ASSIGN(140, openInitOptions)
+ASSIGN(141, syncScrollLocation)
+ASSIGN(142, closeLocation)
+ASSIGN(143, setAlwaysDisplay)
+ASSIGN(144, doCredits)
+
+ASSIGN(200, mustSkipIdleStart);
+ASSIGN(201, mustSkipIdleEnd);
END_CUSTOM_FUNCTION_MAP()
void processKilledCallback(Common::PROCESS *p) {
- for (uint i = 0; i < 10; i++)
+ for (uint i = 0; i < 10; i++) {
if (GLOBALS._mut[i]._ownerPid == p->pid) {
// Handle scripts which don't call ReleaseOwnership, such as
// the one in loc37's vEnter when Tony is chasing the mouse.
@@ -2517,6 +2464,7 @@ void processKilledCallback(Common::PROCESS *p) {
GLOBALS._mut[i]._lockCount = 0;
CoroScheduler.setEvent(GLOBALS._mut[i]._eventId);
}
+ }
}
void setupGlobalVars(RMTony *tony, RMPointer *ptr, RMGameBoxes *box, RMLocation *loc, RMInventory *inv, RMInput *input) {
@@ -2531,13 +2479,12 @@ void setupGlobalVars(RMTony *tony, RMPointer *ptr, RMGameBoxes *box, RMLocation
GLOBALS.EnableGUI = mainEnableGUI;
GLOBALS._bAlwaysDisplay = false;
- int i;
CoroScheduler.setResourceCallback(processKilledCallback);
- for (i = 0; i < 10; i++)
+ for (int i = 0; i < 10; i++)
GLOBALS._mut[i]._eventId = CoroScheduler.createEvent(false, true);
- for (i = 0; i < 200; i++)
+ for (int i = 0; i < 200; i++)
GLOBALS._ambiance[i] = 0;
GLOBALS._ambiance[6] = AMBIANCE_CRICKETS;
diff --git a/engines/tony/custom.h b/engines/tony/custom.h
index 524ab14aab..0f1061e8cd 100644
--- a/engines/tony/custom.h
+++ b/engines/tony/custom.h
@@ -36,9 +36,12 @@ namespace Tony {
using namespace MPAL;
-#define INIT_CUSTOM_FUNCTION MapCustomFunctions
+struct MusicFileEntry {
+ const char *_name;
+ int _sync;
+};
-#define DECLARE_CUSTOM_FUNCTION(x) void x
+#define INIT_CUSTOM_FUNCTION MapCustomFunctions
#define BEGIN_CUSTOM_FUNCTION_MAP() \
static void AssignError(int num) { \
@@ -63,6 +66,17 @@ class RMLocation;
class RMInventory;
class RMInput;
+void charsSaveAll(Common::OutSaveFile *f);
+void charsLoadAll(Common::InSaveFile *f);
+void mCharResetCodes();
+void saveChangedHotspot(Common::OutSaveFile *f);
+void loadChangedHotspot(Common::InSaveFile *f);
+void reapplyChangedHotspot();
+
+void restoreMusic(CORO_PARAM);
+void saveMusic(Common::OutSaveFile *f);
+void loadMusic(Common::InSaveFile *f);
+
void INIT_CUSTOM_FUNCTION(LPCUSTOMFUNCTION *lpMap, Common::String *lpStrMap);
void setupGlobalVars(RMTony *tony, RMPointer *ptr, RMGameBoxes *box, RMLocation *loc, RMInventory *inv, RMInput *input);
diff --git a/engines/tony/detection_tables.h b/engines/tony/detection_tables.h
index f9881c29f2..d2bd81f083 100644
--- a/engines/tony/detection_tables.h
+++ b/engines/tony/detection_tables.h
@@ -139,6 +139,39 @@ static const TonyGameDescription gameDescriptions[] = {
GUIO1(GUIO_NONE)
},
},
+ {
+ // Tony Tough German "Gamestar" provided in bug #3566035
+ {
+ "tony",
+ 0,
+ {
+ {"roasted.mpr", 0, "06203dbbc85fdd1e6dc8fc211c1a6207", 135911071},
+ {"roasted.mpc", 0, "187de6f88f4083808cb66342ab55a7fd", 389904},
+ AD_LISTEND
+ },
+ Common::DE_DEU,
+ Common::kPlatformWindows,
+ ADGF_NO_FLAGS,
+ GUIO1(GUIO_NONE)
+ },
+ },
+ {
+ // Tony Tough Czech provided in bug #3565765
+ {
+ "tony",
+ 0,
+ {
+ // {"data1.cab", 0, "c6d5dd8f0c1241a6e3f7861b7f27bf7b", 4350},
+ {"roasted.mpr", 0, "06203dbbc85fdd1e6dc8fc211c1a6207", 135911071},
+ {"roasted.mpc", 0, "a8283a101878f3ca105f1f83f07e2c40", 386491},
+ AD_LISTEND
+ },
+ Common::CZ_CZE,
+ Common::kPlatformWindows,
+ ADGF_NO_FLAGS,
+ GUIO1(GUIO_NONE)
+ },
+ },
{ AD_TABLE_END_MARKER }
};
diff --git a/engines/tony/font.cpp b/engines/tony/font.cpp
index 927adf9006..c8919dbdb5 100644
--- a/engines/tony/font.cpp
+++ b/engines/tony/font.cpp
@@ -84,10 +84,9 @@ void RMFont::unload() {
RMGfxPrimitive *RMFont::makeLetterPrimitive(byte bChar, int &nLength) {
RMFontPrimitive *prim;
- int nLett;
// Convert from character to glyph index
- nLett = convertToLetter(bChar);
+ int nLett = convertToLetter(bChar);
assert(nLett < _nLetters);
// Create primitive font
@@ -120,12 +119,11 @@ void RMFont::close() {
}
int RMFont::stringLen(const Common::String &text) {
- uint len, i;
-
if (text.empty())
return letterLength('\0');
- len = 0;
+ uint len = 0;
+ uint i;
for (i = 0; i < text.size() - 1; i++)
len += letterLength(text[i], text[i + 1]);
len += letterLength(text[i]);
@@ -157,7 +155,6 @@ void RMFontColor::setBaseColor(byte r1, byte g1, byte b1) {
int gstep = g / 14;
int bstep = b / 14;
- int i;
byte pal[768 * 3];
// Check if we are already on the right color
@@ -169,7 +166,7 @@ void RMFontColor::setBaseColor(byte r1, byte g1, byte b1) {
_fontB = b1;
// Constructs a new palette for the font
- for (i = 1; i < 16; i++) {
+ for (int i = 1; i < 16; i++) {
pal[i * 3 + 0] = r >> 16;
pal[i * 3 + 1] = g >> 16;
pal[i * 3 + 2] = b >> 16;
@@ -184,7 +181,7 @@ void RMFontColor::setBaseColor(byte r1, byte g1, byte b1) {
pal[15 * 3 + 2] += 8;
// Puts in all the letters
- for (i = 0; i < _nLetters; i++)
+ for (int i = 0; i < _nLetters; i++)
_letter[i].loadPaletteWA(pal);
}
@@ -204,8 +201,6 @@ int RMFontWithTables::letterLength(int nChar, int nNext) {
\****************************************************************************/
void RMFontDialog::init() {
- int i;
-
// bernie: Number of characters in the font
int nchars =
112 // base
@@ -222,7 +217,7 @@ void RMFontDialog::init() {
_hDefault = 18;
Common::fill(&_l2Table[0][0], &_l2Table[0][0] + (256 * 256), '\0');
- for (i = 0; i < 256; i++) {
+ for (int i = 0; i < 256; i++) {
_cTable[i] = g_vm->_cTableDialog[i];
_lTable[i] = g_vm->_lTableDialog[i];
}
@@ -234,8 +229,6 @@ void RMFontDialog::init() {
\****************************************************************************/
void RMFontMacc::init() {
- int i;
-
// bernie: Number of characters in the font
int nchars =
102 // base
@@ -245,7 +238,6 @@ void RMFontMacc::init() {
+ 8 // francais
+ 5; // deutsch
-
load(RES_F_MACC, nchars, 11, 16);
// Default
@@ -253,7 +245,7 @@ void RMFontMacc::init() {
_hDefault = 17;
Common::fill(&_l2Table[0][0], &_l2Table[0][0] + (256 * 256), '\0');
- for (i = 0; i < 256; i++) {
+ for (int i = 0; i < 256; i++) {
_cTable[i] = g_vm->_cTableMacc[i];
_lTable[i] = g_vm->_lTableMacc[i];
}
@@ -264,8 +256,6 @@ void RMFontMacc::init() {
\****************************************************************************/
void RMFontCredits::init() {
- int i;
-
// bernie: Number of characters in the font
int nchars =
112 // base
@@ -275,7 +265,6 @@ void RMFontCredits::init() {
+ 8 // french
+ 2; // deutsch
-
load(RES_F_CREDITS, nchars, 27, 28, RES_F_CPAL);
// Default
@@ -283,7 +272,7 @@ void RMFontCredits::init() {
_hDefault = 28;
Common::fill(&_l2Table[0][0], &_l2Table[0][0] + (256 * 256), '\0');
- for (i = 0; i < 256; i++) {
+ for (int i = 0; i < 256; i++) {
_cTable[i] = g_vm->_cTableCred[i];
_lTable[i] = g_vm->_lTableCred[i];
}
@@ -305,10 +294,7 @@ void RMFontObj::setBothCase(int nChar, int nNext, signed char spiazz) {
_l2Table[TOLOWER(nChar)][TOLOWER(nNext)] = spiazz;
}
-
void RMFontObj::init() {
- int i;
-
//bernie: Number of characters in the font (solo maiuscolo)
int nchars =
85 // base
@@ -318,7 +304,6 @@ void RMFontObj::init() {
+ 0 // francais (no uppercase chars)
+ 1; // deutsch
-
load(RES_F_OBJ, nchars, 25, 30);
// Initialize the font table
@@ -326,7 +311,7 @@ void RMFontObj::init() {
_hDefault = 30;
Common::fill(&_l2Table[0][0], &_l2Table[0][0] + (256 * 256), '\0');
- for (i = 0; i < 256; i++) {
+ for (int i = 0; i < 256; i++) {
_cTable[i] = g_vm->_cTableObj[i];
_lTable[i] = g_vm->_lTableObj[i];
}
@@ -345,7 +330,6 @@ void RMFontObj::init() {
setBothCase('R', 'U', 3);
}
-
/****************************************************************************\
* RMText Methods
\****************************************************************************/
@@ -409,11 +393,6 @@ void RMText::writeText(const Common::String &text, int nFont, int *time) {
void RMText::writeText(Common::String text, RMFontColor *font, int *time) {
RMGfxPrimitive *prim;
- uint p, old_p;
- int j, x, y;
- int len;
- int numchar;
- int width, height;
// Set the base color
font->setBaseColor(_textR, _textG, _textB);
@@ -428,8 +407,9 @@ void RMText::writeText(Common::String text, RMFontColor *font, int *time) {
// Divide the words into lines. In this cycle, X contains the maximum length reached by a line,
// and the number of lines
Common::Array<Common::String> lines;
- p = 0;
- j = x = 0;
+ uint p = 0;
+ int j = 0;
+ int x = 0;
while (p < text.size()) {
j += font->stringLen(text[p]);
if (j > (((_aHorType == HLEFTPAR) && (lines.size() > 0)) ? _maxLineLength - 25 : _maxLineLength)) {
@@ -443,7 +423,7 @@ void RMText::writeText(Common::String text, RMFontColor *font, int *time) {
// width of a line caused discontinuation of the whole sentence.
// This workaround has the partial word broken up so it will still display
//
- old_p = p;
+ uint old_p = p;
while (text[p] != ' ' && text[p] != '-' && p > 0)
p--;
@@ -475,8 +455,8 @@ void RMText::writeText(Common::String text, RMFontColor *font, int *time) {
x += 8;
// Starting position for the surface: X1, Y
- width = x;
- height = (lines.size() - 1) * font->letterHeight() + font->_fontDimy;
+ int width = x;
+ int height = (lines.size() - 1) * font->letterHeight() + font->_fontDimy;
// Create the surface
create(width, height);
@@ -484,8 +464,8 @@ void RMText::writeText(Common::String text, RMFontColor *font, int *time) {
p = 0;
- y = 0;
- numchar = 0;
+ int y = 0;
+ int numchar = 0;
for (uint i = 0; i < lines.size(); ++i) {
const Common::String &line = lines[i];
@@ -522,6 +502,7 @@ void RMText::writeText(Common::String text, RMFontColor *font, int *time) {
continue;
}
+ int len;
prim = font->makeLetterPrimitive(line[p], len);
prim->getDst()._x1 = x;
prim->getDst()._y1 = y;
@@ -737,8 +718,8 @@ void RMTextDialog::removeThis(CORO_PARAM, bool &result) {
CORO_END_CODE;
}
-void RMTextDialog::Unregister() {
- RMGfxTask::Unregister();
+void RMTextDialog::unregister() {
+ RMGfxTask::unregister();
assert(_nInList == 0);
CoroScheduler.setEvent(_hEndDisplay);
}
@@ -908,7 +889,7 @@ RMPoint RMTextItemName::getHotspot() {
if (_item == NULL)
return _mpos + _curscroll;
else
- return _item->hotspot();
+ return _item->getHotspot();
}
RMItem *RMTextItemName::getSelectedItem() {
@@ -953,8 +934,8 @@ RMDialogChoice::~RMDialogChoice() {
CoroScheduler.closeEvent(_hUnreg);
}
-void RMDialogChoice::Unregister() {
- RMGfxWoodyBuffer::Unregister();
+void RMDialogChoice::unregister() {
+ RMGfxWoodyBuffer::unregister();
assert(!_nInList);
CoroScheduler.pulseEvent(_hUnreg);
@@ -987,8 +968,6 @@ void RMDialogChoice::close() {
}
void RMDialogChoice::setNumChoices(int num) {
- int i;
-
_numChoices = num;
_curAdded = 0;
@@ -997,7 +976,7 @@ void RMDialogChoice::setNumChoices(int num) {
_ptDrawStrings = new RMPoint[num];
// Initialization
- for (i = 0; i < _numChoices; i++) {
+ for (int i = 0; i < _numChoices; i++) {
_drawedStrings[i].setColor(0, 255, 0);
_drawedStrings[i].setAlignType(RMText::HLEFTPAR, RMText::VTOP);
_drawedStrings[i].setMaxLineLength(600);
diff --git a/engines/tony/font.h b/engines/tony/font.h
index 99b20571b1..13c1ddf268 100644
--- a/engines/tony/font.h
+++ b/engines/tony/font.h
@@ -252,7 +252,7 @@ public:
virtual void removeThis(CORO_PARAM, bool &result);
// Overloaded de-registration
- virtual void Unregister();
+ virtual void unregister();
// Overloading of the Draw to center the text, if necessary
virtual void draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim);
@@ -344,7 +344,7 @@ protected:
public:
virtual void removeThis(CORO_PARAM, bool &result);
virtual void draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim);
- void Unregister();
+ void unregister();
public:
// Initialization
diff --git a/engines/tony/game.cpp b/engines/tony/game.cpp
index 2bcfdc7fc2..1a19f2836c 100644
--- a/engines/tony/game.cpp
+++ b/engines/tony/game.cpp
@@ -34,7 +34,6 @@
#include "tony/mpal/memory.h"
#include "tony/mpal/mpal.h"
#include "tony/mpal/mpalutils.h"
-#include "tony/custom.h"
#include "tony/game.h"
#include "tony/gfxengine.h"
#include "tony/tony.h"
@@ -288,9 +287,7 @@ RMOptionScreen::RMOptionScreen() {
_buttonSave_ArrowRight = NULL;
_bEditSaveName = false;
- int i;
-
- for (i = 0; i < 6; i++) {
+ for (int i = 0; i < 6; i++) {
_curThumb[i] = NULL;
_buttonSave_States[i] = NULL;
}
@@ -501,9 +498,7 @@ void RMOptionScreen::refreshAll(CORO_PARAM) {
}
void RMOptionScreen::refreshThumbnails() {
- int i;
-
- for (i = 0; i < 6; i++) {
+ for (int i = 0; i < 6; i++) {
if (_curThumb[i])
delete _curThumb[i];
@@ -691,9 +686,7 @@ void RMOptionScreen::closeState() {
_buttonExit = NULL;
if (_nState == MENULOAD || _nState == MENUSAVE) {
- int i;
-
- for (i = 0; i < 6; i++) {
+ for (int i = 0; i < 6; i++) {
if (_curThumb[i] != NULL) {
delete _curThumb[i];
_curThumb[i] = NULL;
@@ -1343,9 +1336,7 @@ void RMOptionScreen::removeThis(CORO_PARAM, bool &result) {
bool RMOptionScreen::loadThumbnailFromSaveState(int nState, byte *lpDestBuf, Common::String &name, byte &diff) {
- Common::String buf;
char namebuf[256];
- int i;
Common::InSaveFile *f;
char id[4];
@@ -1355,7 +1346,7 @@ bool RMOptionScreen::loadThumbnailFromSaveState(int nState, byte *lpDestBuf, Com
diff = 10;
// Get the savegame filename for the given slot
- buf = g_vm->getSaveStateFileName(nState);
+ Common::String buf = g_vm->getSaveStateFileName(nState);
// Try and open the savegame
f = g_system->getSavefileManager()->openForLoading(buf);
@@ -1410,9 +1401,9 @@ bool RMOptionScreen::loadThumbnailFromSaveState(int nState, byte *lpDestBuf, Com
return true;
}
- i = f->readByte();
- f->read(namebuf, i);
- namebuf[i] = '\0';
+ int bufSize = f->readByte();
+ f->read(namebuf, bufSize);
+ namebuf[bufSize] = '\0';
name = namebuf;
delete f;
@@ -1436,9 +1427,7 @@ RMPointer::~RMPointer() {
}
void RMPointer::init() {
- int i;
-
- for (i = 0; i < 5; i++) {
+ for (int i = 0; i < 5; i++) {
RMResRaw res(RES_P_GO + i);
_pointer[i] = new RMGfxSourceBuffer8RLEByteAA;
@@ -1446,7 +1435,7 @@ void RMPointer::init() {
_pointer[i]->loadPaletteWA(RES_P_PAL);
}
- for (i = 0; i < 5; i++) {
+ for (int i = 0; i < 5; i++) {
RMRes res(RES_P_PAP1 + i);
Common::SeekableReadStream *ds = res.getReadStream();
_specialPointer[i] = new RMItem;
@@ -1467,9 +1456,7 @@ void RMPointer::init() {
}
void RMPointer::close() {
- int i;
-
- for (i = 0; i < 5; i++) {
+ for (int i = 0; i < 5; i++) {
if (_pointer[i] != NULL) {
delete _pointer[i];
_pointer[i] = NULL;
diff --git a/engines/tony/gfxcore.cpp b/engines/tony/gfxcore.cpp
index 71bf31396c..25ea10d417 100644
--- a/engines/tony/gfxcore.cpp
+++ b/engines/tony/gfxcore.cpp
@@ -56,7 +56,7 @@ void RMGfxTask::Register() {
_nInList++;
}
-void RMGfxTask::Unregister() {
+void RMGfxTask::unregister() {
_nInList--;
assert(_nInList >= 0);
}
@@ -269,7 +269,7 @@ void RMGfxTargetBuffer::clearOT() {
cur = _otlist;
while (cur != NULL) {
- cur->_prim->_task->Unregister();
+ cur->_prim->_task->unregister();
delete cur->_prim;
n = cur->_next;
delete cur;
@@ -303,7 +303,7 @@ void RMGfxTargetBuffer::drawOT(CORO_PARAM) {
CORO_INVOKE_1(_ctx->cur->_prim->_task->removeThis, _ctx->result);
if (_ctx->result) {
// De-register the task
- _ctx->cur->_prim->_task->Unregister();
+ _ctx->cur->_prim->_task->unregister();
// Delete task, freeing the memory
delete _ctx->cur->_prim;
@@ -507,9 +507,7 @@ int RMGfxSourceBufferPal::loadPaletteWA(const byte *buf, bool bSwapped) {
}
int RMGfxSourceBufferPal::loadPalette(const byte *buf) {
- int i;
-
- for (i = 0; i < 256; i++)
+ for (int i = 0; i < 256; i++)
memcpy(_pal + i * 3, buf + i * 4, 3);
preparePalette();
@@ -518,9 +516,7 @@ int RMGfxSourceBufferPal::loadPalette(const byte *buf) {
}
void RMGfxSourceBufferPal::preparePalette() {
- int i;
-
- for (i = 0; i < 256; i++) {
+ for (int i = 0; i < 256; i++) {
_palFinal[i] = (((int)_pal[i * 3 + 0] >> 3) << 10) |
(((int)_pal[i * 3 + 1] >> 3) << 5) |
(((int)_pal[i * 3 + 2] >> 3) << 0);
@@ -528,10 +524,8 @@ void RMGfxSourceBufferPal::preparePalette() {
}
int RMGfxSourceBufferPal::init(const byte *buf, int dimx, int dimy, bool bLoadPalette) {
- int read;
-
// Load the RAW image
- read = RMGfxSourceBuffer::init(buf, dimx, dimy);
+ int read = RMGfxSourceBuffer::init(buf, dimx, dimy);
// Load the palette if necessary
if (bLoadPalette)
@@ -596,7 +590,7 @@ RMGfxSourceBuffer8::~RMGfxSourceBuffer8() {
}
void RMGfxSourceBuffer8::draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim) {
- int x, y, width, height, u, v;
+ int width, height, u, v;
int bufx = bigBuf.getDimx();
uint16 *buf = bigBuf;
byte *raw = _buf;
@@ -623,10 +617,10 @@ void RMGfxSourceBuffer8::draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimit
// Normal step
if (_bTrasp0) {
- for (y = 0; y < height; y++) {
+ for (int y = 0; y < height; y++) {
raw = _buf + (y + v) * _dimx + u;
- for (x = 0; x < width; x++) {
+ for (int x = 0; x < width; x++) {
if (*raw)
*buf = _palFinal[*raw];
buf++;
@@ -636,10 +630,10 @@ void RMGfxSourceBuffer8::draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimit
buf += bufx - width;
}
} else {
- for (y = 0; y < height; y++) {
+ for (int y = 0; y < height; y++) {
raw = _buf + (y + v) * _dimx + u;
- for (x = 0; x < width; x += 2) {
+ for (int x = 0; x < width; x += 2) {
buf[0] = _palFinal[raw[0]];
buf[1] = _palFinal[raw[1]];
@@ -693,11 +687,9 @@ RMGfxSourceBuffer8AB::~RMGfxSourceBuffer8AB() {
}
int RMGfxSourceBuffer8AB::calcTrasp(int fore, int back) {
- int r, g, b;
-
- r = (GETRED(fore) >> 2) + (GETRED(back) >> 1);
- g = (GETGREEN(fore) >> 2) + (GETGREEN(back) >> 1);
- b = (GETBLUE(fore) >> 2) + (GETBLUE(back) >> 1);
+ int r = (GETRED(fore) >> 2) + (GETRED(back) >> 1);
+ int g = (GETGREEN(fore) >> 2) + (GETGREEN(back) >> 1);
+ int b = (GETBLUE(fore) >> 2) + (GETBLUE(back) >> 1);
if (r > 0x1F)
r = 0x1F;
@@ -713,7 +705,7 @@ int RMGfxSourceBuffer8AB::calcTrasp(int fore, int back) {
void RMGfxSourceBuffer8AB::draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim) {
- int x, y, width, height, u, v;
+ int width, height, u, v;
int bufx = bigBuf.getDimx();
uint16 *buf = bigBuf;
byte *raw = _buf;
@@ -740,10 +732,10 @@ void RMGfxSourceBuffer8AB::draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrim
// Passaggio normale
if (_bTrasp0) {
- for (y = 0; y < height; y++) {
+ for (int y = 0; y < height; y++) {
raw = _buf + (y + v) * _dimx + u;
- for (x = 0; x < width; x++) {
+ for (int x = 0; x < width; x++) {
if (*raw)
*buf = calcTrasp(_palFinal[*raw], *buf);
@@ -754,10 +746,10 @@ void RMGfxSourceBuffer8AB::draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrim
buf += bufx - width;
}
} else {
- for (y = 0; y < height; y++) {
+ for (int y = 0; y < height; y++) {
raw = _buf + (y + v) * _dimx + u;
- for (x = 0; x < width; x += 2) {
+ for (int x = 0; x < width; x += 2) {
buf[0] = calcTrasp(_palFinal[raw[0]], buf[0]);
buf[1] = calcTrasp(_palFinal[raw[1]], buf[1]);
@@ -809,9 +801,7 @@ void RMGfxSourceBuffer8RLE::init(Common::ReadStream &ds, int dimx, int dimy, boo
if (_bNeedRLECompress) {
RMGfxSourceBufferPal::init(ds, dimx, dimy, bLoadPalette);
} else {
- int size;
-
- size = ds.readSint32LE();
+ int size = ds.readSint32LE();
_buf = new byte[size];
ds.read(_buf, size);
@@ -845,7 +835,6 @@ void RMGfxSourceBuffer8RLE::setAlreadyCompressed() {
}
void RMGfxSourceBuffer8RLE::compressRLE() {
- int x, y;
byte *startline;
byte *cur;
byte curdata;
@@ -856,7 +845,7 @@ void RMGfxSourceBuffer8RLE::compressRLE() {
// Perform RLE compression for lines
cur = _megaRLEBuf;
src = _buf;
- for (y = 0; y < _dimy; y++) {
+ for (int y = 0; y < _dimy; y++) {
// Save the beginning of the line
startline = cur;
@@ -867,7 +856,7 @@ void RMGfxSourceBuffer8RLE::compressRLE() {
curdata = 0;
rep = 0;
startsrc = src;
- for (x = 0; x < _dimx;) {
+ for (int x = 0; x < _dimx;) {
if ((curdata == 0 && *src == 0) || (curdata == 1 && *src == _alphaBlendColor)
|| (curdata == 2 && (*src != _alphaBlendColor && *src != 0))) {
src++;
@@ -875,13 +864,13 @@ void RMGfxSourceBuffer8RLE::compressRLE() {
x++;
} else {
if (curdata == 0) {
- RLEWriteTrasp(cur, rep);
+ rleWriteTrasp(cur, rep);
curdata++;
} else if (curdata == 1) {
- RLEWriteAlphaBlend(cur, rep);
+ rleWriteAlphaBlend(cur, rep);
curdata++;
} else {
- RLEWriteData(cur, rep, startsrc);
+ rleWriteData(cur, rep, startsrc);
curdata = 0;
}
@@ -892,16 +881,16 @@ void RMGfxSourceBuffer8RLE::compressRLE() {
// Pending data?
if (curdata == 1) {
- RLEWriteAlphaBlend(cur, rep);
- RLEWriteData(cur, 0, NULL);
+ rleWriteAlphaBlend(cur, rep);
+ rleWriteData(cur, 0, NULL);
}
if (curdata == 2) {
- RLEWriteData(cur, rep, startsrc);
+ rleWriteData(cur, rep, startsrc);
}
// End of line
- RLEWriteEOL(cur);
+ rleWriteEOL(cur);
// Write the length of the line
WRITE_LE_UINT16(startline, (uint16)(cur - startline));
@@ -911,26 +900,25 @@ void RMGfxSourceBuffer8RLE::compressRLE() {
delete[] _buf;
// Copy the compressed image
- x = cur - _megaRLEBuf;
- _buf = new byte[x];
- Common::copy(_megaRLEBuf, _megaRLEBuf + x, _buf);
+ int bufSize = cur - _megaRLEBuf;
+ _buf = new byte[bufSize];
+ Common::copy(_megaRLEBuf, _megaRLEBuf + bufSize, _buf);
}
void RMGfxSourceBuffer8RLE::draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim) {
- int y;
byte *src;
uint16 *buf = bigBuf;
- int x1, y1, u, v, width, height;
+ int u, v, width, height;
// Clipping
- x1 = prim->getDst()._x1;
- y1 = prim->getDst()._y1;
+ int x1 = prim->getDst()._x1;
+ int y1 = prim->getDst()._y1;
if (!clip2D(x1, y1, u, v, width, height, false, &bigBuf))
return;
// Go forward through the RLE lines
src = _buf;
- for (y = 0; y < v; y++)
+ for (int y = 0; y < v; y++)
src += READ_LE_UINT16(src);
// Calculate the position in the destination buffer
@@ -952,9 +940,9 @@ void RMGfxSourceBuffer8RLE::draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPri
// Specify the drawn area
bigBuf.addDirtyRect(Common::Rect(x1 - width, y1, x1 + 1, y1 + height));
- for (y = 0; y < height; y++) {
+ for (int y = 0; y < height; y++) {
// Decompression
- RLEDecompressLineFlipped(buf + x1, src + 2, u, width);
+ rleDecompressLineFlipped(buf + x1, src + 2, u, width);
// Next line
src += READ_LE_UINT16(src);
@@ -966,9 +954,9 @@ void RMGfxSourceBuffer8RLE::draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPri
// Specify the drawn area
bigBuf.addDirtyRect(Common::Rect(x1, y1, x1 + width, y1 + height));
- for (y = 0; y < height; y++) {
+ for (int y = 0; y < height; y++) {
// Decompression
- RLEDecompressLine(buf + x1, src + 2, u, width);
+ rleDecompressLine(buf + x1, src + 2, u, width);
// Next line
src += READ_LE_UINT16(src);
@@ -985,20 +973,19 @@ void RMGfxSourceBuffer8RLE::draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPri
\****************************************************************************/
RMGfxSourceBuffer8RLEByte::~RMGfxSourceBuffer8RLEByte() {
-
}
-void RMGfxSourceBuffer8RLEByte::RLEWriteTrasp(byte *&cur, int rep) {
+void RMGfxSourceBuffer8RLEByte::rleWriteTrasp(byte *&cur, int rep) {
assert(rep < 255);
*cur ++ = rep;
}
-void RMGfxSourceBuffer8RLEByte::RLEWriteAlphaBlend(byte *&cur, int rep) {
+void RMGfxSourceBuffer8RLEByte::rleWriteAlphaBlend(byte *&cur, int rep) {
assert(rep < 255);
*cur ++ = rep;
}
-void RMGfxSourceBuffer8RLEByte::RLEWriteData(byte *&cur, int rep, byte *src) {
+void RMGfxSourceBuffer8RLEByte::rleWriteData(byte *&cur, int rep, byte *src) {
assert(rep < 256);
*cur ++ = rep;
@@ -1011,13 +998,12 @@ void RMGfxSourceBuffer8RLEByte::RLEWriteData(byte *&cur, int rep, byte *src) {
return;
}
-void RMGfxSourceBuffer8RLEByte::RLEWriteEOL(byte *&cur) {
+void RMGfxSourceBuffer8RLEByte::rleWriteEOL(byte *&cur) {
*cur ++ = 0xFF;
}
-void RMGfxSourceBuffer8RLEByte::RLEDecompressLine(uint16 *dst, byte *src, int nStartSkip, int nLength) {
- int i, n;
- int r, g, b;
+void RMGfxSourceBuffer8RLEByte::rleDecompressLine(uint16 *dst, byte *src, int nStartSkip, int nLength) {
+ int n;
if (nStartSkip == 0)
goto RLEByteDoTrasp;
@@ -1086,10 +1072,10 @@ RLEByteDoAlpha:
RLEByteDoAlpha2:
if (n > nLength)
n = nLength;
- for (i = 0; i < n; i++) {
- r = (*dst >> 10) & 0x1F;
- g = (*dst >> 5) & 0x1F;
- b = *dst & 0x1F;
+ for (int i = 0; i < n; i++) {
+ int r = (*dst >> 10) & 0x1F;
+ int g = (*dst >> 5) & 0x1F;
+ int b = *dst & 0x1F;
r = (r >> 2) + (_alphaR >> 1);
g = (g >> 2) + (_alphaG >> 1);
@@ -1111,7 +1097,7 @@ RLEByteDoCopy2:
if (n > nLength)
n = nLength;
- for (i = 0; i < n; i++)
+ for (int i = 0; i < n; i++)
*dst ++ = _palFinal[*src++];
nLength -= n;
@@ -1121,9 +1107,8 @@ RLEByteDoCopy2:
}
}
-void RMGfxSourceBuffer8RLEByte::RLEDecompressLineFlipped(uint16 *dst, byte *src, int nStartSkip, int nLength) {
- int i, n;
- int r, g, b;
+void RMGfxSourceBuffer8RLEByte::rleDecompressLineFlipped(uint16 *dst, byte *src, int nStartSkip, int nLength) {
+ int n;
if (nStartSkip == 0)
goto RLEByteFlippedDoTrasp;
@@ -1192,10 +1177,10 @@ RLEByteFlippedDoAlpha:
RLEByteFlippedDoAlpha2:
if (n > nLength)
n = nLength;
- for (i = 0; i < n; i++) {
- r = (*dst >> 10) & 0x1F;
- g = (*dst >> 5) & 0x1F;
- b = *dst & 0x1F;
+ for (int i = 0; i < n; i++) {
+ int r = (*dst >> 10) & 0x1F;
+ int g = (*dst >> 5) & 0x1F;
+ int b = *dst & 0x1F;
r = (r >> 2) + (_alphaR >> 1);
g = (g >> 2) + (_alphaG >> 1);
@@ -1217,7 +1202,7 @@ RLEByteFlippedDoCopy2:
if (n > nLength)
n = nLength;
- for (i = 0; i < n; i++)
+ for (int i = 0; i < n; i++)
*dst-- = _palFinal[*src++];
nLength -= n;
@@ -1236,17 +1221,17 @@ RMGfxSourceBuffer8RLEWord::~RMGfxSourceBuffer8RLEWord() {
}
-void RMGfxSourceBuffer8RLEWord::RLEWriteTrasp(byte *&cur, int rep) {
+void RMGfxSourceBuffer8RLEWord::rleWriteTrasp(byte *&cur, int rep) {
WRITE_LE_UINT16(cur, rep);
cur += 2;
}
-void RMGfxSourceBuffer8RLEWord::RLEWriteAlphaBlend(byte *&cur, int rep) {
+void RMGfxSourceBuffer8RLEWord::rleWriteAlphaBlend(byte *&cur, int rep) {
WRITE_LE_UINT16(cur, rep);
cur += 2;
}
-void RMGfxSourceBuffer8RLEWord::RLEWriteData(byte *&cur, int rep, byte *src) {
+void RMGfxSourceBuffer8RLEWord::rleWriteData(byte *&cur, int rep, byte *src) {
WRITE_LE_UINT16(cur, rep);
cur += 2;
@@ -1257,14 +1242,13 @@ void RMGfxSourceBuffer8RLEWord::RLEWriteData(byte *&cur, int rep, byte *src) {
}
}
-void RMGfxSourceBuffer8RLEWord::RLEWriteEOL(byte *&cur) {
+void RMGfxSourceBuffer8RLEWord::rleWriteEOL(byte *&cur) {
*cur ++ = 0xFF;
*cur ++ = 0xFF;
}
-void RMGfxSourceBuffer8RLEWord::RLEDecompressLine(uint16 *dst, byte *src, int nStartSkip, int nLength) {
- int i, n;
- int r, g, b;
+void RMGfxSourceBuffer8RLEWord::rleDecompressLine(uint16 *dst, byte *src, int nStartSkip, int nLength) {
+ int n;
if (nStartSkip == 0)
goto RLEWordDoTrasp;
@@ -1341,10 +1325,10 @@ RLEWordDoAlpha2:
if (n > nLength)
n = nLength;
- for (i = 0; i < n; i++) {
- r = (*dst >> 10) & 0x1F;
- g = (*dst >> 5) & 0x1F;
- b = *dst & 0x1F;
+ for (int i = 0; i < n; i++) {
+ int r = (*dst >> 10) & 0x1F;
+ int g = (*dst >> 5) & 0x1F;
+ int b = *dst & 0x1F;
r = (r >> 2) + (_alphaR >> 1);
g = (g >> 2) + (_alphaG >> 1);
@@ -1368,7 +1352,7 @@ RLEWordDoCopy2:
if (n > nLength)
n = nLength;
- for (i = 0; i < n; i++)
+ for (int i = 0; i < n; i++)
*dst++ = _palFinal[*src++];
nLength -= n;
@@ -1380,9 +1364,8 @@ RLEWordDoCopy2:
}
}
-void RMGfxSourceBuffer8RLEWord::RLEDecompressLineFlipped(uint16 *dst, byte *src, int nStartSkip, int nLength) {
- int i, n;
- int r, g, b;
+void RMGfxSourceBuffer8RLEWord::rleDecompressLineFlipped(uint16 *dst, byte *src, int nStartSkip, int nLength) {
+ int n;
if (nStartSkip == 0)
goto RLEWordFlippedDoTrasp;
@@ -1459,10 +1442,10 @@ RLEWordFlippedDoAlpha2:
if (n > nLength)
n = nLength;
- for (i = 0; i < n; i++) {
- r = (*dst >> 10) & 0x1F;
- g = (*dst >> 5) & 0x1F;
- b = *dst & 0x1F;
+ for (int i = 0; i < n; i++) {
+ int r = (*dst >> 10) & 0x1F;
+ int g = (*dst >> 5) & 0x1F;
+ int b = *dst & 0x1F;
r = (r >> 2) + (_alphaR >> 1);
g = (g >> 2) + (_alphaG >> 1);
@@ -1486,7 +1469,7 @@ RLEWordFlippedDoCopy2:
if (n > nLength)
n = nLength;
- for (i = 0; i < n; i++)
+ for (int i = 0; i < n; i++)
*dst-- = _palFinal[*src++];
nLength -= n;
@@ -1505,12 +1488,11 @@ RMGfxSourceBuffer8RLEWordAB::~RMGfxSourceBuffer8RLEWordAB() {
}
-void RMGfxSourceBuffer8RLEWordAB::RLEDecompressLine(uint16 *dst, byte *src, int nStartSkip, int nLength) {
- int i, n;
- int r, g, b, r2, g2, b2;
+void RMGfxSourceBuffer8RLEWordAB::rleDecompressLine(uint16 *dst, byte *src, int nStartSkip, int nLength) {
+ int n;
if (!GLOBALS._bCfgTransparence) {
- RMGfxSourceBuffer8RLEWord::RLEDecompressLine(dst, src, nStartSkip, nLength);
+ RMGfxSourceBuffer8RLEWord::rleDecompressLine(dst, src, nStartSkip, nLength);
return;
}
@@ -1590,10 +1572,10 @@ RLEWordDoAlpha2:
n = nLength;
// @@@ SHOULD NOT BE THERE !!!!!
- for (i = 0; i < n; i++) {
- r = (*dst >> 10) & 0x1F;
- g = (*dst >> 5) & 0x1F;
- b = *dst & 0x1F;
+ for (int i = 0; i < n; i++) {
+ int r = (*dst >> 10) & 0x1F;
+ int g = (*dst >> 5) & 0x1F;
+ int b = *dst & 0x1F;
r = (r >> 2) + (_alphaR >> 1);
g = (g >> 2) + (_alphaG >> 1);
@@ -1617,14 +1599,14 @@ RLEWordDoCopy2:
if (n > nLength)
n = nLength;
- for (i = 0; i < n; i++) {
- r = (*dst >> 10) & 0x1F;
- g = (*dst >> 5) & 0x1F;
- b = *dst & 0x1F;
+ for (int i = 0; i < n; i++) {
+ int r = (*dst >> 10) & 0x1F;
+ int g = (*dst >> 5) & 0x1F;
+ int b = *dst & 0x1F;
- r2 = (_palFinal[*src] >> 10) & 0x1F;
- g2 = (_palFinal[*src] >> 5) & 0x1F;
- b2 = _palFinal[*src] & 0x1F;
+ int r2 = (_palFinal[*src] >> 10) & 0x1F;
+ int g2 = (_palFinal[*src] >> 5) & 0x1F;
+ int b2 = _palFinal[*src] & 0x1F;
r = (r >> 1) + (r2 >> 1);
g = (g >> 1) + (g2 >> 1);
@@ -1658,7 +1640,6 @@ void RMGfxSourceBuffer8AA::prepareImage() {
}
void RMGfxSourceBuffer8AA::calculateAA() {
- int x, y;
byte *src, *srcaa;
// First pass: fill the edges
@@ -1666,8 +1647,8 @@ void RMGfxSourceBuffer8AA::calculateAA() {
src = _buf;
srcaa = _megaAABuf;
- for (y = 0; y < _dimy; y++) {
- for (x = 0; x < _dimx; x++) {
+ for (int y = 0; y < _dimy; y++) {
+ for (int x = 0; x < _dimx; x++) {
if (*src == 0) {
if ((y > 0 && src[-_dimx] != 0) ||
(y < _dimy - 1 && src[_dimx] != 0) ||
@@ -1683,8 +1664,8 @@ void RMGfxSourceBuffer8AA::calculateAA() {
src = _buf;
srcaa = _megaAABuf;
- for (y = 0; y < _dimy; y++) {
- for (x = 0; x < _dimx; x++) {
+ for (int y = 0; y < _dimy; y++) {
+ for (int x = 0; x < _dimx; x++) {
if (*src != 0) {
if ((y > 0 && srcaa[-_dimx] == 1) ||
(y < _dimy - 1 && srcaa[_dimx] == 1) ||
@@ -1715,23 +1696,20 @@ RMGfxSourceBuffer8AA::~RMGfxSourceBuffer8AA() {
}
void RMGfxSourceBuffer8AA::drawAA(RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim) {
- int x, y;
byte *src;
uint16 *mybuf;
uint16 *buf;
- int x1, y1, u, v, width, height;
- int r, g, b;
- int step;
+ int u, v, width, height;
// Clip the sprite
- x1 = prim->getDst()._x1;
- y1 = prim->getDst()._y1;
+ int x1 = prim->getDst()._x1;
+ int y1 = prim->getDst()._y1;
if (!clip2D(x1, y1, u, v, width, height, false, &bigBuf))
return;
// Go forward through the RLE lines
src = _buf;
- for (y = 0; y < v; y++)
+ for (int y = 0; y < v; y++)
src += READ_LE_UINT16(src);
// Eliminate horizontal clipping
@@ -1758,6 +1736,7 @@ void RMGfxSourceBuffer8AA::drawAA(RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *pri
buf = bigBuf;
buf += y1 * bigBuf.getDimx();
+ int step;
if (prim->isFlipped())
step = -1;
else
@@ -1765,17 +1744,17 @@ void RMGfxSourceBuffer8AA::drawAA(RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *pri
// Loop
buf += bigBuf.getDimx(); // Skip the first line
- for (y = 1; y < height - 1; y++) {
+ for (int y = 1; y < height - 1; y++) {
// if (prim->IsFlipped())
// mybuf=&buf[x1+m_dimx-1];
// else
mybuf = &buf[x1];
- for (x = 0; x < width; x++, mybuf += step) {
+ for (int x = 0; x < width; x++, mybuf += step) {
if (_aabuf[(y + v) * _dimx + x + u] == 2 && x != 0 && x != width - 1) {
- r = GETRED(mybuf[1]) + GETRED(mybuf[-1]) + GETRED(mybuf[-bigBuf.getDimx()]) + GETRED(mybuf[bigBuf.getDimx()]);
- g = GETGREEN(mybuf[1]) + GETGREEN(mybuf[-1]) + GETGREEN(mybuf[-bigBuf.getDimx()]) + GETGREEN(mybuf[bigBuf.getDimx()]);
- b = GETBLUE(mybuf[1]) + GETBLUE(mybuf[-1]) + GETBLUE(mybuf[-bigBuf.getDimx()]) + GETBLUE(mybuf[bigBuf.getDimx()]);
+ int r = GETRED(mybuf[1]) + GETRED(mybuf[-1]) + GETRED(mybuf[-bigBuf.getDimx()]) + GETRED(mybuf[bigBuf.getDimx()]);
+ int g = GETGREEN(mybuf[1]) + GETGREEN(mybuf[-1]) + GETGREEN(mybuf[-bigBuf.getDimx()]) + GETGREEN(mybuf[bigBuf.getDimx()]);
+ int b = GETBLUE(mybuf[1]) + GETBLUE(mybuf[-1]) + GETBLUE(mybuf[-bigBuf.getDimx()]) + GETBLUE(mybuf[bigBuf.getDimx()]);
r += GETRED(mybuf[0]);
g += GETGREEN(mybuf[0]);
@@ -1785,9 +1764,12 @@ void RMGfxSourceBuffer8AA::drawAA(RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *pri
g /= 5;
b /= 5;
- if (r > 31) r = 31;
- if (g > 31) g = 31;
- if (b > 31) b = 31;
+ if (r > 31)
+ r = 31;
+ if (g > 31)
+ g = 31;
+ if (b > 31)
+ b = 31;
mybuf[0] = (r << 10) | (g << 5) | b;
}
@@ -1803,17 +1785,17 @@ void RMGfxSourceBuffer8AA::drawAA(RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *pri
// Looppone
buf += bigBuf.getDimx();
- for (y = 1; y < height - 1; y++) {
+ for (int y = 1; y < height - 1; y++) {
// if (prim->IsFlipped())
// mybuf=&buf[x1+m_dimx-1];
// else
mybuf = &buf[x1];
- for (x = 0; x < width; x++, mybuf += step) {
+ for (int x = 0; x < width; x++, mybuf += step) {
if (_aabuf[(y + v) * _dimx + x + u] == 1 && x != 0 && x != width - 1) {
- r = GETRED(mybuf[1]) + GETRED(mybuf[-1]) + GETRED(mybuf[-bigBuf.getDimx()]) + GETRED(mybuf[bigBuf.getDimx()]);
- g = GETGREEN(mybuf[1]) + GETGREEN(mybuf[-1]) + GETGREEN(mybuf[-bigBuf.getDimx()]) + GETGREEN(mybuf[bigBuf.getDimx()]);
- b = GETBLUE(mybuf[1]) + GETBLUE(mybuf[-1]) + GETBLUE(mybuf[-bigBuf.getDimx()]) + GETBLUE(mybuf[bigBuf.getDimx()]);
+ int r = GETRED(mybuf[1]) + GETRED(mybuf[-1]) + GETRED(mybuf[-bigBuf.getDimx()]) + GETRED(mybuf[bigBuf.getDimx()]);
+ int g = GETGREEN(mybuf[1]) + GETGREEN(mybuf[-1]) + GETGREEN(mybuf[-bigBuf.getDimx()]) + GETGREEN(mybuf[bigBuf.getDimx()]);
+ int b = GETBLUE(mybuf[1]) + GETBLUE(mybuf[-1]) + GETBLUE(mybuf[-bigBuf.getDimx()]) + GETBLUE(mybuf[bigBuf.getDimx()]);
r += GETRED(mybuf[0]) * 2;
g += GETGREEN(mybuf[0]) * 2;
@@ -1823,9 +1805,12 @@ void RMGfxSourceBuffer8AA::drawAA(RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *pri
g /= 6;
b /= 6;
- if (r > 31) r = 31;
- if (g > 31) g = 31;
- if (b > 31) b = 31;
+ if (r > 31)
+ r = 31;
+ if (g > 31)
+ g = 31;
+ if (b > 31)
+ b = 31;
mybuf[0] = (r << 10) | (g << 5) | b;
}
@@ -1941,16 +1926,13 @@ RMGfxSourceBuffer16::~RMGfxSourceBuffer16() {
void RMGfxSourceBuffer16::draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim) {
uint16 *buf = bigBuf;
uint16 *raw = (uint16 *)_buf;
- int dimx, dimy;
- int u, v;
- int x1, y1;
- dimx = _dimx;
- dimy = _dimy;
- u = 0;
- v = 0;
- x1 = 0;
- y1 = 0;
+ int dimx = _dimx;
+ int dimy = _dimy;
+ int u = 0;
+ int v = 0;
+ int x1 = 0;
+ int y1 = 0;
if (prim->haveSrc()) {
u = prim->getSrc()._x1;
@@ -1999,10 +1981,9 @@ void RMGfxSourceBuffer16::draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimi
void RMGfxSourceBuffer16::prepareImage() {
// Color space conversion if necessary!
- int i;
uint16 *buf = (uint16 *)_buf;
- for (i = 0; i < _dimx * _dimy; i++)
+ for (int i = 0; i < _dimx * _dimy; i++)
WRITE_LE_UINT16(&buf[i], FROM_LE_16(buf[i]) & 0x7FFF);
}
@@ -2041,7 +2022,6 @@ void RMGfxBox::setColor(byte r, byte g, byte b) {
}
void RMGfxBox::draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim) {
- int i, j;
uint16 *buf = bigBuf;
RMRect rcDst;
@@ -2050,8 +2030,8 @@ void RMGfxBox::draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim)
buf += rcDst._y1 * bigBuf.getDimx() + rcDst._x1;
// Loop through the pixels
- for (j = 0; j < rcDst.height(); j++) {
- for (i = 0; i < rcDst.width(); i++)
+ for (int j = 0; j < rcDst.height(); j++) {
+ for (int i = 0; i < rcDst.width(); i++)
*buf++ = _wFillColor;
buf += bigBuf.getDimx() - rcDst.width();
diff --git a/engines/tony/gfxcore.h b/engines/tony/gfxcore.h
index ac4eee05e4..f0deed83ee 100644
--- a/engines/tony/gfxcore.h
+++ b/engines/tony/gfxcore.h
@@ -146,7 +146,7 @@ public:
// Registration
virtual void Register();
- virtual void Unregister();
+ virtual void unregister();
};
@@ -303,12 +303,12 @@ protected:
protected:
static byte _megaRLEBuf[];
- virtual void RLEWriteTrasp(byte *&cur, int rep) = 0;
- virtual void RLEWriteData(byte *&cur, int rep, byte *src) = 0;
- virtual void RLEWriteEOL(byte *&cur) = 0;
- virtual void RLEWriteAlphaBlend(byte *&cur, int rep) = 0;
- virtual void RLEDecompressLine(uint16 *dst, byte *src, int nStartSkip, int nLength) = 0;
- virtual void RLEDecompressLineFlipped(uint16 *dst, byte *src, int nStartSkip, int nLength) = 0;
+ virtual void rleWriteTrasp(byte *&cur, int rep) = 0;
+ virtual void rleWriteData(byte *&cur, int rep, byte *src) = 0;
+ virtual void rleWriteEOL(byte *&cur) = 0;
+ virtual void rleWriteAlphaBlend(byte *&cur, int rep) = 0;
+ virtual void rleDecompressLine(uint16 *dst, byte *src, int nStartSkip, int nLength) = 0;
+ virtual void rleDecompressLineFlipped(uint16 *dst, byte *src, int nStartSkip, int nLength) = 0;
// Perform image compression in RLE
void compressRLE();
@@ -338,12 +338,12 @@ public:
class RMGfxSourceBuffer8RLEByte : public RMGfxSourceBuffer8RLE {
protected:
- void RLEWriteTrasp(byte * &cur, int rep);
- void RLEWriteAlphaBlend(byte * &cur, int rep);
- void RLEWriteData(byte * &cur, int rep, byte *src);
- void RLEWriteEOL(byte * &cur);
- void RLEDecompressLine(uint16 *dst, byte *src, int nStartSkip, int nLength);
- void RLEDecompressLineFlipped(uint16 *dst, byte *src, int nStartSkip, int nLength);
+ void rleWriteTrasp(byte * &cur, int rep);
+ void rleWriteAlphaBlend(byte * &cur, int rep);
+ void rleWriteData(byte * &cur, int rep, byte *src);
+ void rleWriteEOL(byte * &cur);
+ void rleDecompressLine(uint16 *dst, byte *src, int nStartSkip, int nLength);
+ void rleDecompressLineFlipped(uint16 *dst, byte *src, int nStartSkip, int nLength);
public:
virtual ~RMGfxSourceBuffer8RLEByte();
@@ -351,12 +351,12 @@ public:
class RMGfxSourceBuffer8RLEWord : public RMGfxSourceBuffer8RLE {
protected:
- void RLEWriteTrasp(byte * &cur, int rep);
- void RLEWriteAlphaBlend(byte * &cur, int rep);
- void RLEWriteData(byte * &cur, int rep, byte *src);
- void RLEWriteEOL(byte * &cur);
- virtual void RLEDecompressLine(uint16 *dst, byte *src, int nStartSkip, int nLength);
- virtual void RLEDecompressLineFlipped(uint16 *dst, byte *src, int nStartSkip, int nLength);
+ void rleWriteTrasp(byte * &cur, int rep);
+ void rleWriteAlphaBlend(byte * &cur, int rep);
+ void rleWriteData(byte * &cur, int rep, byte *src);
+ void rleWriteEOL(byte * &cur);
+ virtual void rleDecompressLine(uint16 *dst, byte *src, int nStartSkip, int nLength);
+ virtual void rleDecompressLineFlipped(uint16 *dst, byte *src, int nStartSkip, int nLength);
public:
virtual ~RMGfxSourceBuffer8RLEWord();
@@ -364,7 +364,7 @@ public:
class RMGfxSourceBuffer8RLEWordAB : public RMGfxSourceBuffer8RLEWord {
protected:
- virtual void RLEDecompressLine(uint16 *dst, byte *src, int nStartSkip, int nLength);
+ virtual void rleDecompressLine(uint16 *dst, byte *src, int nStartSkip, int nLength);
public:
virtual ~RMGfxSourceBuffer8RLEWordAB();
diff --git a/engines/tony/gfxengine.cpp b/engines/tony/gfxengine.cpp
index 5c038e154d..59fb024622 100644
--- a/engines/tony/gfxengine.cpp
+++ b/engines/tony/gfxengine.cpp
@@ -40,7 +40,7 @@ namespace Tony {
* RMGfxEngine Methods
\****************************************************************************/
-void ExitAllIdles(CORO_PARAM, const void *param) {
+void exitAllIdles(CORO_PARAM, const void *param) {
CORO_BEGIN_CONTEXT;
CORO_END_CONTEXT(_ctx);
@@ -129,7 +129,7 @@ void RMGfxEngine::openOptionScreen(CORO_PARAM, int type) {
GLOBALS._bIdleExited = false;
- CoroScheduler.createProcess(ExitAllIdles, &_nCurLoc, sizeof(int));
+ CoroScheduler.createProcess(exitAllIdles, &_nCurLoc, sizeof(int));
}
}
@@ -394,13 +394,10 @@ void RMGfxEngine::initForNewLocation(int nLoc, RMPoint ptTonyStart, RMPoint star
}
uint32 RMGfxEngine::loadLocation(int nLoc, RMPoint ptTonyStart, RMPoint start) {
- bool bLoaded;
- int i;
-
_nCurLoc = nLoc;
- bLoaded = false;
- for (i = 0; i < 5; i++) {
+ bool bLoaded = false;
+ for (int i = 0; i < 5; i++) {
// Try the loading of the location
RMRes res(_nCurLoc);
if (!res.isValid())
@@ -532,36 +529,22 @@ void RMGfxEngine::disableMouse() {
_bAlwaysDrawMouse = false;
}
-void CharsSaveAll(Common::OutSaveFile *f);
-void CharsLoadAll(Common::InSaveFile *f);
-void MCharResetCodes();
-void SaveChangedHotspot(Common::OutSaveFile *f);
-void LoadChangedHotspot(Common::InSaveFile *f);
-void ReapplyChangedHotspot();
-
-void RestoreMusic(CORO_PARAM);
-void SaveMusic(Common::OutSaveFile *f);
-void LoadMusic(Common::InSaveFile *f);
-
#define TONY_SAVEGAME_VERSION 8
void RMGfxEngine::saveState(const Common::String &fn, byte *curThumb, const Common::String &name) {
Common::OutSaveFile *f;
byte *state;
- uint thumbsize;
- uint size;
- int i;
char buf[4];
RMPoint tp = _tony.position();
// Saving: MPAL variables, current location, and Tony inventory position
// For now, we only save the MPAL state
- size = mpalGetSaveStateSize();
+ uint size = mpalGetSaveStateSize();
state = new byte[size];
mpalSaveState(state);
- thumbsize = 160 * 120 * 2;
+ uint thumbsize = 160 * 120 * 2;
buf[0] = 'R';
buf[1] = 'M';
@@ -577,7 +560,7 @@ void RMGfxEngine::saveState(const Common::String &fn, byte *curThumb, const Comm
f->write(curThumb, thumbsize);
// Difficulty level
- i = mpalQueryGlobalVar("VERSIONEFACILE");
+ int i = mpalQueryGlobalVar("VERSIONEFACILE");
f->writeByte(i);
i = strlen(name.c_str());
@@ -608,16 +591,14 @@ void RMGfxEngine::saveState(const Common::String &fn, byte *curThumb, const Comm
delete[] state;
// New Ver5
- bool bStat;
-
// Saves the state of the shepherdess and show yourself
- bStat = _tony.getShepherdess();
+ bool bStat = _tony.getShepherdess();
f->writeByte(bStat);
bStat = _inter.getPerorate();
f->writeByte(bStat);
// Save the chars
- CharsSaveAll(f);
+ charsSaveAll(f);
// Save the options
f->writeByte(GLOBALS._bCfgInvLocked);
@@ -639,10 +620,10 @@ void RMGfxEngine::saveState(const Common::String &fn, byte *curThumb, const Comm
f->writeByte(GLOBALS._nCfgSFXVolume);
// Save the hotspots
- SaveChangedHotspot(f);
+ saveChangedHotspot(f);
// Save the music
- SaveMusic(f);
+ saveMusic(f);
f->finalize();
delete f;
@@ -734,7 +715,7 @@ void RMGfxEngine::loadState(CORO_PARAM, const Common::String &fn) {
_inv.loadState(_ctx->state);
delete[] _ctx->state;
- if (_ctx->ver >= 0x2) { // Versione 2: box please
+ if (_ctx->ver >= 0x2) { // Version 2: box please
_ctx->size = _ctx->f->readUint32LE();
_ctx->state = new byte[_ctx->size];
_ctx->f->read(_ctx->state, _ctx->size);
@@ -743,7 +724,7 @@ void RMGfxEngine::loadState(CORO_PARAM, const Common::String &fn) {
}
if (_ctx->ver >= 5) {
- // Versione 5
+ // Version 5
bool bStat = false;
bStat = _ctx->f->readByte();
@@ -751,7 +732,7 @@ void RMGfxEngine::loadState(CORO_PARAM, const Common::String &fn) {
bStat = _ctx->f->readByte();
_inter.setPerorate(bStat);
- CharsLoadAll(_ctx->f);
+ charsLoadAll(_ctx->f);
}
if (_ctx->ver >= 6) {
@@ -775,11 +756,11 @@ void RMGfxEngine::loadState(CORO_PARAM, const Common::String &fn) {
GLOBALS._nCfgSFXVolume = _ctx->f->readByte();
// Load hotspots
- LoadChangedHotspot(_ctx->f);
+ loadChangedHotspot(_ctx->f);
}
if (_ctx->ver >= 7) {
- LoadMusic(_ctx->f);
+ loadMusic(_ctx->f);
}
delete _ctx->f;
@@ -793,13 +774,13 @@ void RMGfxEngine::loadState(CORO_PARAM, const Common::String &fn) {
mpalQueryDoAction(0, _ctx->loc, 0);
else {
// In the new ones, we just reset the mcode
- MCharResetCodes();
+ mCharResetCodes();
}
if (_ctx->ver >= 6)
- ReapplyChangedHotspot();
+ reapplyChangedHotspot();
- CORO_INVOKE_0(RestoreMusic);
+ CORO_INVOKE_0(restoreMusic);
_bGUIInterface = true;
_bGUIInventory = true;
diff --git a/engines/tony/inventory.cpp b/engines/tony/inventory.cpp
index 81d62a035c..d758c3ff74 100644
--- a/engines/tony/inventory.cpp
+++ b/engines/tony/inventory.cpp
@@ -73,9 +73,6 @@ bool RMInventory::checkPointInside(const RMPoint &pt) {
void RMInventory::init() {
- int i, j;
- int curres;
-
// Create the main buffer
create(RM_SX, 68);
setPriority(185);
@@ -89,10 +86,10 @@ void RMInventory::init() {
_nItems = 78; // @@@ Number of takeable items
_items = new RMInventoryItem[_nItems + 1];
- curres = 10500;
+ int curres = 10500;
// Loop through the items
- for (i = 0; i <= _nItems; i++) {
+ for (int i = 0; i <= _nItems; i++) {
// Load the items from the resource
RMRes res(curres);
assert(res.isValid());
@@ -115,7 +112,7 @@ void RMInventory::init() {
_items[i]._pointer = new RMGfxSourceBuffer8RLEByteAA[_items[i]._icon.numPattern()];
- for (j = 0; j < _items[i]._icon.numPattern(); j++) {
+ for (int j = 0; j < _items[i]._icon.numPattern(); j++) {
RMResRaw raw(curres);
assert(raw.isValid());
@@ -232,9 +229,7 @@ void RMInventory::removeThis(CORO_PARAM, bool &result) {
}
void RMInventory::removeItem(int code) {
- int i;
-
- for (i = 0; i < _nInv; i++)
+ for (int i = 0; i < _nInv; i++) {
if (_inv[i] == code - 10000) {
g_system->lockMutex(_csModifyInterface);
@@ -247,6 +242,7 @@ void RMInventory::removeItem(int code) {
g_system->unlockMutex(_csModifyInterface);
return;
}
+ }
}
void RMInventory::addItem(int code) {
@@ -286,9 +282,7 @@ void RMInventory::changeItemStatus(uint32 code, uint32 dwStatus) {
void RMInventory::prepare() {
- int i;
-
- for (i = 1; i < RM_SX / 64 - 1; i++) {
+ for (int i = 1; i < RM_SX / 64 - 1; i++) {
if (i - 1 + _curPos < _nInv)
addPrim(new RMGfxPrimitive(&_items[_inv[i - 1 + _curPos]]._icon, RMPoint(i * 64, 0)));
else
@@ -325,10 +319,8 @@ void RMInventory::endCombine() {
}
bool RMInventory::leftClick(const RMPoint &mpos, int &nCombineObj) {
- int n;
-
// The left click picks an item from your inventory to use it with the background
- n = mpos._x / 64;
+ int n = mpos._x / 64;
if (_state == OPENED) {
if (n > 0 && n < RM_SX / 64 - 1 && _inv[n - 1 + _curPos] != 0) {
@@ -679,18 +671,17 @@ RMItem *RMInventory::whichItemIsIn(const RMPoint &mpt) {
int RMInventory::getSaveStateSize() {
// m_inv pattern m_nInv
- return 256 * 4 + 256 * 4 + 4 ;
+ return 256 * 4 + 256 * 4 + 4;
}
void RMInventory::saveState(byte *state) {
- int i, x;
-
WRITE_LE_UINT32(state, _nInv);
state += 4;
Common::copy(_inv, _inv + 256, (uint32 *)state);
state += 256 * 4;
- for (i = 0; i < 256; i++) {
+ int x;
+ for (int i = 0; i < 256; i++) {
if (i < _nItems)
x = _items[i]._status;
else
@@ -702,14 +693,13 @@ void RMInventory::saveState(byte *state) {
}
int RMInventory::loadState(byte *state) {
- int i, x;
-
_nInv = READ_LE_UINT32(state);
state += 4;
Common::copy((uint32 *)state, (uint32 *)state + 256, _inv);
state += 256 * 4;
- for (i = 0; i < 256; i++) {
+ int x;
+ for (int i = 0; i < 256; i++) {
x = READ_LE_UINT32(state);
state += 4;
@@ -768,17 +758,15 @@ bool RMInterface::active() {
}
int RMInterface::onWhichBox(RMPoint pt) {
- int max, i;
-
pt -= _openStart;
// Check how many verbs you have to consider
- max = 4;
+ int max = 4;
if (_bPerorate)
max = 5;
// Find the verb
- for (i = 0; i < max; i++) {
+ for (int i = 0; i < max; i++) {
if (_hotbbox[i].ptInRect(pt))
return i;
}
@@ -895,7 +883,6 @@ bool RMInterface::getPerorate() {
}
void RMInterface::init() {
- int i;
RMResRaw inter(RES_I_INTERFACE);
RMRes pal(RES_I_INTERPPAL);
@@ -904,7 +891,7 @@ void RMInterface::init() {
RMGfxSourceBuffer::init(inter, inter.width(), inter.height());
loadPaletteWA(RES_I_INTERPAL);
- for (i = 0; i < 5; i++) {
+ for (int i = 0; i < 5; i++) {
RMResRaw part(RES_I_INTERP1 + i);
_hotzone[i].init(part, part.width(), part.height());
@@ -942,11 +929,9 @@ void RMInterface::init() {
}
void RMInterface::close() {
- int i;
-
destroy();
- for (i = 0; i < 5; i++)
+ for (int i = 0; i < 5; i++)
_hotzone[i].destroy();
}
diff --git a/engines/tony/loc.cpp b/engines/tony/loc.cpp
index 4fe19594f9..665afa9180 100644
--- a/engines/tony/loc.cpp
+++ b/engines/tony/loc.cpp
@@ -51,10 +51,8 @@ void RMPalette::readFromStream(Common::ReadStream &ds) {
\****************************************************************************/
void RMPattern::RMSlot::readFromStream(Common::ReadStream &ds, bool bLOX) {
- byte type;
-
// Type
- type = ds.readByte();
+ byte type = ds.readByte();
_type = (RMPattern::RMSlotType)type;
// Data
@@ -73,8 +71,6 @@ void RMPattern::RMSlot::readFromStream(Common::ReadStream &ds, bool bLOX) {
\****************************************************************************/
void RMPattern::readFromStream(Common::ReadStream &ds, bool bLOX) {
- int i;
-
// Pattern name
if (!bLOX)
_name = readString(ds);
@@ -94,7 +90,7 @@ void RMPattern::readFromStream(Common::ReadStream &ds, bool bLOX) {
// Create and read the slots
_slots = new RMSlot[_nSlots];
- for (i = 0; i < _nSlots && !ds.err(); i++) {
+ for (int i = 0; i < _nSlots && !ds.err(); i++) {
if (bLOX)
_slots[i].readFromStream(ds, true);
else
@@ -118,14 +114,12 @@ void RMPattern::stopSfx(RMSfx *sfx) {
}
int RMPattern::init(RMSfx *sfx, bool bPlayP0, byte *bFlag) {
- int i;
-
// Read the current time
_nStartTime = g_vm->getTime();
_nCurSlot = 0;
// Find the first frame of the pattern
- i = 0;
+ int i = 0;
while (_slots[i]._type != SPRITE) {
assert(i + 1 < _nSlots);
i++;
@@ -297,15 +291,13 @@ void RMSprite::getSizeFromStream(Common::SeekableReadStream &ds, int *dimx, int
}
void RMSprite::readFromStream(Common::SeekableReadStream &ds, bool bLOX) {
- int dimx, dimy;
-
// Sprite name
if (!bLOX)
_name = readString(ds);
// Dimensions
- dimx = ds.readSint32LE();
- dimy = ds.readSint32LE();
+ int dimx = ds.readSint32LE();
+ int dimy = ds.readSint32LE();
// Bounding box
_rcBox.readFromStream(ds);
@@ -343,12 +335,10 @@ RMSprite::~RMSprite() {
\****************************************************************************/
void RMSfx::readFromStream(Common::ReadStream &ds, bool bLOX) {
- int size;
-
// sfx name
_name = readString(ds);
- size = ds.readSint32LE();
+ int size = ds.readSint32LE();
// Read the entire buffer into a MemoryReadStream
byte *buffer = (byte *)malloc(size);
@@ -390,7 +380,7 @@ void RMSfx::setVolume(int vol) {
void RMSfx::pause(bool bPause) {
if (_fx) {
- _fx->pause(bPause);
+ _fx->setPause(bPause);
}
}
@@ -463,9 +453,6 @@ bool RMItem::isIn(const RMPoint &pt, int *size) {
}
void RMItem::readFromStream(Common::SeekableReadStream &ds, bool bLOX) {
- int i, dimx, dimy;
- byte cm;
-
// MPAL code
_mpalCode = ds.readSint32LE();
@@ -490,7 +477,7 @@ void RMItem::readFromStream(Common::SeekableReadStream &ds, bool bLOX) {
_nPatterns = ds.readSint32LE();
// Color mode
- cm = ds.readByte();
+ byte cm = ds.readByte();
_cm = (RMColorMode)cm;
// Flag for the presence of custom palette differences
@@ -519,9 +506,10 @@ void RMItem::readFromStream(Common::SeekableReadStream &ds, bool bLOX) {
_sfx = new RMSfx[_nSfx];
_patterns = new RMPattern[_nPatterns + 1];
+ int dimx, dimy;
// Read in class data
- if (!ds.err())
- for (i = 0; i < _nSprites && !ds.err(); i++) {
+ if (!ds.err()) {
+ for (int i = 0; i < _nSprites && !ds.err(); i++) {
// Download the sprites
if (bLOX) {
_sprites[i].LOXGetSizeFromStream(ds, &dimx, &dimy);
@@ -536,23 +524,26 @@ void RMItem::readFromStream(Common::SeekableReadStream &ds, bool bLOX) {
if (_cm == CM_256 && _bPal)
_sprites[i].setPalette(_pal._data);
}
+ }
- if (!ds.err())
- for (i = 0; i < _nSfx && !ds.err(); i++) {
+ if (!ds.err()) {
+ for (int i = 0; i < _nSfx && !ds.err(); i++) {
if (bLOX)
_sfx[i].readFromStream(ds, true);
else
_sfx[i].readFromStream(ds, false);
}
+ }
// Read the pattern from pattern 1
- if (!ds.err())
- for (i = 1; i <= _nPatterns && !ds.err(); i++) {
+ if (!ds.err()) {
+ for (int i = 1; i <= _nPatterns && !ds.err(); i++) {
if (bLOX)
_patterns[i].readFromStream(ds, true);
else
_patterns[i].readFromStream(ds, false);
}
+ }
// Initialize the current pattern
if (_bInitCurPattern)
@@ -662,7 +653,7 @@ void RMItem::setStatus(int nStatus) {
_bIsActive = (nStatus > 0);
}
-RMPoint RMItem::hotspot() {
+RMPoint RMItem::getHotspot() {
return _hot;
}
@@ -789,14 +780,11 @@ void RMItem::playSfx(int nSfx) {
}
void RMItem::pauseSound(bool bPause) {
- int i;
-
- for (i = 0; i < _nSfx; i++)
+ for (int i = 0; i < _nSfx; i++)
_sfx[i].pause(bPause);
}
-
/****************************************************************************\
* RMWipe Methods
\****************************************************************************/
@@ -823,8 +811,8 @@ int RMWipe::priority() {
return 200;
}
-void RMWipe::Unregister() {
- RMGfxTask::Unregister();
+void RMWipe::unregister() {
+ RMGfxTask::unregister();
assert(_nInList == 0);
CoroScheduler.setEvent(_hUnregistered);
}
@@ -952,7 +940,7 @@ short RMCharacter::findPath(short source, short destination) {
error = 1; // Possible error
// 1st cycle: explore possible new nodes
- for (int i = 0; i < cur->_numbBox; i++)
+ for (int i = 0; i < cur->_numbBox; i++) {
if (valid[i] == 1) {
error = 0; // Failure de-bunked
int j = 0;
@@ -967,12 +955,13 @@ short RMCharacter::findPath(short source, short destination) {
minCost = nodeCost[i] + 1;
}
}
+ }
if (error)
finish = true; // All nodes saturated
// 2nd cycle: adding new nodes that were found, saturate old nodes
- for (int i = 0; i < cur->_numbBox; i++)
+ for (int i = 0; i < cur->_numbBox; i++) {
if ((valid[i] == 1) && ((nodeCost[i] + 1) == minCost)) {
box[i]._adj[nextNode[i]] = 2;
nodeCost[nextNode[i]] = minCost;
@@ -984,6 +973,7 @@ short RMCharacter::findPath(short source, short destination) {
if (nextNode[i] == destination)
finish = true;
}
+ }
}
// Remove the path from the adjacent modified matrixes
@@ -1079,91 +1069,91 @@ void RMCharacter::goTo(CORO_PARAM, RMPoint destcoord, bool bReversed) {
}
-RMPoint RMCharacter::searching(char UP, char DOWN, char RIGHT, char LEFT, RMPoint punto) {
- short passi, minimo;
- RMPoint nuovo, trovato;
- minimo = 32000;
+RMPoint RMCharacter::searching(char UP, char DOWN, char RIGHT, char LEFT, RMPoint point) {
+ short steps;
+ RMPoint newPt, foundPt;
+ short minStep = 32000;
if (UP) {
- nuovo = punto;
- passi = 0;
- while ((inWhichBox(nuovo) == -1) && (nuovo._y >= 0)) {
- nuovo._y--;
- passi++;
+ newPt = point;
+ steps = 0;
+ while ((inWhichBox(newPt) == -1) && (newPt._y >= 0)) {
+ newPt._y--;
+ steps++;
}
- if ((inWhichBox(nuovo) != -1) && (passi < minimo) &&
- findPath(inWhichBox(_pos), inWhichBox(nuovo))) {
- minimo = passi;
- nuovo._y--; // to avoid error?
- trovato = nuovo;
+ if ((inWhichBox(newPt) != -1) && (steps < minStep) &&
+ findPath(inWhichBox(_pos), inWhichBox(newPt))) {
+ minStep = steps;
+ newPt._y--; // to avoid error?
+ foundPt = newPt;
}
}
if (DOWN) {
- nuovo = punto;
- passi = 0;
- while ((inWhichBox(nuovo) == -1) && (nuovo._y < 480)) {
- nuovo._y++;
- passi++;
+ newPt = point;
+ steps = 0;
+ while ((inWhichBox(newPt) == -1) && (newPt._y < 480)) {
+ newPt._y++;
+ steps++;
}
- if ((inWhichBox(nuovo) != -1) && (passi < minimo) &&
- findPath(inWhichBox(_pos), inWhichBox(nuovo))) {
- minimo = passi;
- nuovo._y++; // to avoid error?
- trovato = nuovo;
+ if ((inWhichBox(newPt) != -1) && (steps < minStep) &&
+ findPath(inWhichBox(_pos), inWhichBox(newPt))) {
+ minStep = steps;
+ newPt._y++; // to avoid error?
+ foundPt = newPt;
}
}
if (RIGHT) {
- nuovo = punto;
- passi = 0;
- while ((inWhichBox(nuovo) == -1) && (nuovo._x < 640)) {
- nuovo._x++;
- passi++;
+ newPt = point;
+ steps = 0;
+ while ((inWhichBox(newPt) == -1) && (newPt._x < 640)) {
+ newPt._x++;
+ steps++;
}
- if ((inWhichBox(nuovo) != -1) && (passi < minimo) &&
- findPath(inWhichBox(_pos), inWhichBox(nuovo))) {
- minimo = passi;
- nuovo._x++; // to avoid error?
- trovato = nuovo;
+ if ((inWhichBox(newPt) != -1) && (steps < minStep) &&
+ findPath(inWhichBox(_pos), inWhichBox(newPt))) {
+ minStep = steps;
+ newPt._x++; // to avoid error?
+ foundPt = newPt;
}
}
if (LEFT) {
- nuovo = punto;
- passi = 0;
- while ((inWhichBox(nuovo) == -1) && (nuovo._x >= 0)) {
- nuovo._x--;
- passi++;
+ newPt = point;
+ steps = 0;
+ while ((inWhichBox(newPt) == -1) && (newPt._x >= 0)) {
+ newPt._x--;
+ steps++;
}
- if ((inWhichBox(nuovo) != -1) && (passi < minimo) &&
- findPath(inWhichBox(_pos), inWhichBox(nuovo))) {
- minimo = passi;
- nuovo._x--; // to avoid error?
- trovato = nuovo;
+ if ((inWhichBox(newPt) != -1) && (steps < minStep) &&
+ findPath(inWhichBox(_pos), inWhichBox(newPt))) {
+ minStep = steps;
+ newPt._x--; // to avoid error?
+ foundPt = newPt;
}
}
- if (minimo == 32000)
- trovato = punto;
+ if (minStep == 32000)
+ foundPt = point;
- return trovato;
+ return foundPt;
}
-RMPoint RMCharacter::nearestPoint(const RMPoint &punto) {
- return searching(1, 1, 1, 1, punto);
+RMPoint RMCharacter::nearestPoint(const RMPoint &point) {
+ return searching(1, 1, 1, 1, point);
}
-short RMCharacter::scanLine(const RMPoint &punto) {
+short RMCharacter::scanLine(const RMPoint &point) {
int Ldx, Ldy, Lcount;
float Lfx, Lfy, Lslope;
RMPoint Lstart, Lend, Lscan;
signed char Lspeed, Lstatus;
Lstart = _pos;
- Lend = punto;
+ Lend = point;
Ldx = Lstart._x - Lend._x;
Ldy = Lstart._y - Lend._y;
Lfx = Ldx;
@@ -1209,60 +1199,60 @@ short RMCharacter::scanLine(const RMPoint &punto) {
/**
* Calculates intersections between the straight line and the closest BBOX
*/
-RMPoint RMCharacter::invScanLine(const RMPoint &punto) {
- int Ldx, Ldy, Lcount;
- float Lfx, Lfy, Lslope;
- RMPoint Lstart, Lend, Lscan;
- signed char Lspeed, Lstatus, Lbox = -1;
-
- Lstart = punto; // Exchange!
- Lend = _pos; // :-)
- Ldx = Lstart._x - Lend._x;
- Ldy = Lstart._y - Lend._y;
- Lfx = Ldx;
- Lfy = Ldy;
- Ldx = ABS(Ldx);
- Ldy = ABS(Ldy);
- Lspeed = 1;
- Lcount = 0;
-
- if (Ldx > Ldy) {
- Lslope = Lfy / Lfx;
- if (Lend._x < Lstart._x)
- Lspeed = -Lspeed;
- Lstatus = 1;
+RMPoint RMCharacter::invScanLine(const RMPoint &point) {
+ RMPoint lStart = point; // Exchange!
+ RMPoint lEnd = _pos; // :-)
+ int lDx = lStart._x - lEnd._x;
+ int lDy = lStart._y - lEnd._y;
+ float lFx = lDx;
+ float lFy = lDy;
+ lDx = ABS(lDx);
+ lDy = ABS(lDy);
+ signed char lSpeed = 1;
+ int lCount = 0;
+
+ signed char lStatus;
+ float lSlope;
+
+ if (lDx > lDy) {
+ lSlope = lFy / lFx;
+ if (lEnd._x < lStart._x)
+ lSpeed = -lSpeed;
+ lStatus = 1;
} else {
- Lslope = Lfx / Lfy;
- if (Lend._y < Lstart._y)
- Lspeed = -Lspeed;
- Lstatus = 0;
+ lSlope = lFx / lFy;
+ if (lEnd._y < lStart._y)
+ lSpeed = -lSpeed;
+ lStatus = 0;
}
- Lscan = Lstart;
+
+ RMPoint lScan = lStart;
+ signed char lBox = -1;
for (;;) {
- if (inWhichBox(Lscan) != -1) {
- if (inWhichBox(Lscan) != Lbox) {
- if (inWhichBox(_pos) == inWhichBox(Lscan) || findPath(inWhichBox(_pos), inWhichBox(Lscan)))
- return Lscan;
+ if (inWhichBox(lScan) != -1) {
+ if (inWhichBox(lScan) != lBox) {
+ if (inWhichBox(_pos) == inWhichBox(lScan) || findPath(inWhichBox(_pos), inWhichBox(lScan)))
+ return lScan;
else
- Lbox = inWhichBox(Lscan);
+ lBox = inWhichBox(lScan);
}
}
- Lcount++;
- if (Lstatus) {
- Ldx = Lspeed * Lcount;
- Ldy = (int)(Lslope * Ldx);
+ lCount++;
+ if (lStatus) {
+ lDx = lSpeed * lCount;
+ lDy = (int)(lSlope * lDx);
} else {
- Ldy = Lspeed * Lcount;
- Ldx = (int)(Lslope * Ldy);
+ lDy = lSpeed * lCount;
+ lDx = (int)(lSlope * lDy);
}
- Lscan._x = Lstart._x + Ldx;
- Lscan._y = Lstart._y + Ldy;
+ lScan._x = lStart._x + lDx;
+ lScan._y = lStart._y + lDy;
// WORKAROUND: Handles cases where the points never fall inside a bounding box
- if (Lscan._x < -100 || Lscan._y < -100 || Lscan._x >= 1000 || Lscan._y >= 1000)
- return punto;
+ if (lScan._x < -100 || lScan._y < -100 || lScan._x >= 1000 || lScan._y >= 1000)
+ return point;
}
}
@@ -1272,25 +1262,24 @@ RMPoint RMCharacter::invScanLine(const RMPoint &punto) {
*/
RMPoint RMCharacter::nearestHotSpot(int sourcebox, int destbox) {
- RMPoint puntocaldo;
- short cc;
- int x, y, distanzaminima;
- distanzaminima = 10000000;
+ RMPoint hotspot;
+ int x, y;
+ int minDist = 10000000;
RMBoxLoc *cur = _theBoxes->getBoxes(_curLocation);
- for (cc = 0; cc < cur->_boxes[sourcebox]._numHotspot; cc++)
+ for (short cc = 0; cc < cur->_boxes[sourcebox]._numHotspot; cc++)
if ((cur->_boxes[sourcebox]._hotspot[cc]._destination) == destbox) {
x = ABS(cur->_boxes[sourcebox]._hotspot[cc]._hotx - _pos._x);
y = ABS(cur->_boxes[sourcebox]._hotspot[cc]._hoty - _pos._y);
- if ((x * x + y * y) < distanzaminima) {
- distanzaminima = x * x + y * y;
- puntocaldo._x = cur->_boxes[sourcebox]._hotspot[cc]._hotx;
- puntocaldo._y = cur->_boxes[sourcebox]._hotspot[cc]._hoty;
+ if ((x * x + y * y) < minDist) {
+ minDist = x * x + y * y;
+ hotspot._x = cur->_boxes[sourcebox]._hotspot[cc]._hotx;
+ hotspot._y = cur->_boxes[sourcebox]._hotspot[cc]._hoty;
}
}
- return puntocaldo;
+ return hotspot;
}
void RMCharacter::draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim) {
@@ -1310,13 +1299,12 @@ void RMCharacter::draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *pr
void RMCharacter::newBoxEntered(int nBox) {
RMBoxLoc *cur;
- bool bOldReverse;
// Recall on ExitBox
mpalQueryDoAction(3, _curLocation, _curBox);
cur = _theBoxes->getBoxes(_curLocation);
- bOldReverse = cur->_boxes[_curBox]._bReversed;
+ bool bOldReverse = cur->_boxes[_curBox]._bReversed;
_curBox = nBox;
// If Z is changed, we must remove it from the OT
@@ -1693,10 +1681,6 @@ void RMCharacter::linkToBoxes(RMGameBoxes *boxes) {
\****************************************************************************/
void RMBox::readFromStream(Common::ReadStream &ds) {
- uint16 w;
- int i;
- byte b;
-
// Bbox
_left = ds.readSint32LE();
_top = ds.readSint32LE();
@@ -1704,24 +1688,25 @@ void RMBox::readFromStream(Common::ReadStream &ds) {
_bottom = ds.readSint32LE();
// Adjacency
- for (i = 0; i < MAXBOXES; i++) {
+ for (int i = 0; i < MAXBOXES; i++) {
_adj[i] = ds.readSint32LE();
}
// Misc
_numHotspot = ds.readSint32LE();
_destZ = ds.readByte();
- b = ds.readByte();
+ byte b = ds.readByte();
_bActive = b;
b = ds.readByte();
_bReversed = b;
// Reversed expansion space
- for (i = 0; i < 30; i++)
+ for (int i = 0; i < 30; i++)
ds.readByte();
+ uint16 w;
// Hotspots
- for (i = 0; i < _numHotspot; i++) {
+ for (int i = 0; i < _numHotspot; i++) {
w = ds.readUint16LE();
_hotspot[i]._hotx = w;
w = ds.readUint16LE();
@@ -1745,14 +1730,12 @@ RMBoxLoc::~RMBoxLoc() {
}
void RMBoxLoc::readFromStream(Common::ReadStream &ds) {
- int i;
char buf[2];
- byte ver;
// ID and version
buf[0] = ds.readByte();
buf[1] = ds.readByte();
- ver = ds.readByte();
+ byte ver = ds.readByte();
assert(buf[0] == 'B' && buf[1] == 'X');
assert(ver == 3);
@@ -1763,19 +1746,18 @@ void RMBoxLoc::readFromStream(Common::ReadStream &ds) {
_boxes = new RMBox[_numbBox];
// Read in boxes
- for (i = 0; i < _numbBox; i++)
+ for (int i = 0; i < _numbBox; i++)
_boxes[i].readFromStream(ds);
}
void RMBoxLoc::recalcAllAdj() {
- int i, j;
-
- for (i = 0; i < _numbBox; i++) {
+ for (int i = 0; i < _numbBox; i++) {
Common::fill(_boxes[i]._adj, _boxes[i]._adj + MAXBOXES, 0);
- for (j = 0; j < _boxes[i]._numHotspot; j++)
+ for (int j = 0; j < _boxes[i]._numHotspot; j++) {
if (_boxes[_boxes[i]._hotspot[j]._destination]._bActive)
_boxes[i]._adj[_boxes[i]._hotspot[j]._destination] = 1;
+ }
}
}
@@ -1794,11 +1776,9 @@ RMGameBoxes::~RMGameBoxes() {
}
void RMGameBoxes::init() {
- int i;
-
// Load boxes from disk
_nLocBoxes = 130;
- for (i = 1; i <= _nLocBoxes; i++) {
+ for (int i = 1; i <= _nLocBoxes; i++) {
RMRes res(10000 + i);
Common::SeekableReadStream *ds = res.getReadStream();
@@ -1834,13 +1814,12 @@ bool RMGameBoxes::isInBox(int nLoc, int nBox, const RMPoint &pt) {
}
int RMGameBoxes::whichBox(int nLoc, const RMPoint &punto) {
- int i;
RMBoxLoc *cur = getBoxes(nLoc);
if (!cur)
return -1;
- for (i = 0; i < cur->_numbBox; i++) {
+ for (int i = 0; i < cur->_numbBox; i++) {
if (cur->_boxes[i]._bActive) {
if ((punto._x >= cur->_boxes[i]._left) && (punto._x <= cur->_boxes[i]._right) &&
(punto._y >= cur->_boxes[i]._top) && (punto._y <= cur->_boxes[i]._bottom))
@@ -1857,12 +1836,9 @@ void RMGameBoxes::changeBoxStatus(int nLoc, int nBox, int status) {
}
int RMGameBoxes::getSaveStateSize() {
- int size;
- int i;
+ int size = 4;
- size = 4;
-
- for (i = 1; i <= _nLocBoxes; i++) {
+ for (int i = 1; i <= _nLocBoxes; i++) {
size += 4;
size += _allBoxes[i]->_numbBox;
}
@@ -1871,38 +1847,34 @@ int RMGameBoxes::getSaveStateSize() {
}
void RMGameBoxes::saveState(byte *state) {
- int i, j;
-
// Save the number of locations with boxes
WRITE_LE_UINT32(state, _nLocBoxes);
state += 4;
// For each location, write out the number of boxes and their status
- for (i = 1; i <= _nLocBoxes; i++) {
+ for (int i = 1; i <= _nLocBoxes; i++) {
WRITE_LE_UINT32(state, _allBoxes[i]->_numbBox);
state += 4;
- for (j = 0; j < _allBoxes[i]->_numbBox; j++)
+ for (int j = 0; j < _allBoxes[i]->_numbBox; j++)
*state++ = _allBoxes[i]->_boxes[j]._bActive;
}
}
void RMGameBoxes::loadState(byte *state) {
- int i, j;
- int nloc, nbox;
-
// Load number of items
- nloc = READ_LE_UINT32(state);
+ int nloc = READ_LE_UINT32(state);
state += 4;
assert(nloc <= _nLocBoxes);
+ int nbox;
// For each location, read the number of boxes and their status
- for (i = 1; i <= nloc; i++) {
+ for (int i = 1; i <= nloc; i++) {
nbox = READ_LE_UINT32(state);
state += 4;
- for (j = 0; j < nbox ; j++) {
+ for (int j = 0; j < nbox ; j++) {
if (j < _allBoxes[i]->_numbBox)
_allBoxes[i]->_boxes[j]._bActive = *state;
@@ -1944,10 +1916,6 @@ int RMLocation::TEMPGetNumLoc() {
*/
bool RMLocation::load(Common::SeekableReadStream &ds) {
char id[3];
- int dimx, dimy;
- byte ver;
- byte cm;
- int i;
// Reset dirty rectangling
_prevScroll.set(-1, -1);
@@ -1965,7 +1933,7 @@ bool RMLocation::load(Common::SeekableReadStream &ds) {
return false;
// Version
- ver = ds.readByte();
+ byte ver = ds.readByte();
assert(ver == 6);
// Location name
@@ -1981,12 +1949,12 @@ bool RMLocation::load(Common::SeekableReadStream &ds) {
ds.skip(1);
// Location dimensions
- dimx = ds.readSint32LE();
- dimy = ds.readSint32LE();
+ int dimx = ds.readSint32LE();
+ int dimy = ds.readSint32LE();
_curScroll.set(0, 0);
// Read the color mode
- cm = ds.readByte();
+ byte cm = ds.readByte();
_cmode = (RMColorMode)cm;
// Initialize the source buffer and read the location
@@ -2019,7 +1987,7 @@ bool RMLocation::load(Common::SeekableReadStream &ds) {
g_vm->freezeTime();
- for (i = 0; i < _nItems && !ds.err(); i++)
+ for (int i = 0; i < _nItems && !ds.err(); i++)
_items[i].readFromStream(ds);
g_vm->unfreezeTime();
@@ -2028,12 +1996,8 @@ bool RMLocation::load(Common::SeekableReadStream &ds) {
bool RMLocation::loadLOX(Common::SeekableReadStream &ds) {
- int dimx, dimy;
- byte ver;
- int i;
-
// Version
- ver = ds.readByte();
+ byte ver = ds.readByte();
assert(ver == 1);
// Location name
@@ -2045,8 +2009,8 @@ bool RMLocation::loadLOX(Common::SeekableReadStream &ds) {
TEMPTonyStart._y = ds.readSint32LE();
// Dimensions
- dimx = ds.readSint32LE();
- dimy = ds.readSint32LE();
+ int dimx = ds.readSint32LE();
+ int dimy = ds.readSint32LE();
_curScroll.set(0, 0);
// It's always 65K (16-bit) mode
@@ -2063,7 +2027,7 @@ bool RMLocation::loadLOX(Common::SeekableReadStream &ds) {
if (_nItems > 0)
_items = new RMItem[_nItems];
- for (i = 0; i < _nItems && !ds.err(); i++)
+ for (int i = 0; i < _nItems && !ds.err(); i++)
_items[i].readFromStream(ds, true);
return ds.err();
@@ -2111,22 +2075,18 @@ void RMLocation::draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *pri
* Prepare a frame, adding the location to the OT list, and all the items that have changed animation frame.
*/
void RMLocation::doFrame(RMGfxTargetBuffer *bigBuf) {
- int i;
-
// If the location is not in the OT list, add it in
if (!_nInList)
bigBuf->addPrim(new RMGfxPrimitive(this));
// Process all the location items
- for (i = 0; i < _nItems; i++)
+ for (int i = 0; i < _nItems; i++)
_items[i].doFrame(bigBuf);
}
RMItem *RMLocation::getItemFromCode(uint32 dwCode) {
- int i;
-
- for (i = 0; i < _nItems; i++) {
+ for (int i = 0; i < _nItems; i++) {
if (_items[i].mpalCode() == (int)dwCode)
return &_items[i];
}
@@ -2239,9 +2199,7 @@ void RMLocation::setScrollPosition(const RMPoint &scroll) {
void RMLocation::pauseSound(bool bPause) {
- int i;
-
- for (i = 0; i < _nItems; i++)
+ for (int i = 0; i < _nItems; i++)
_items[i].pauseSound(bPause);
}
diff --git a/engines/tony/loc.h b/engines/tony/loc.h
index 61eece2440..04ba772458 100644
--- a/engines/tony/loc.h
+++ b/engines/tony/loc.h
@@ -256,7 +256,7 @@ public:
void setStatus(int nStatus);
bool isIn(const RMPoint &pt, int *size = NULL);
- RMPoint hotspot();
+ RMPoint getHotspot();
bool getName(Common::String &name);
int mpalCode();
@@ -403,12 +403,12 @@ private:
int inWhichBox(const RMPoint &pt);
short findPath(short source, short destination);
- RMPoint searching(char UP, char DOWN, char RIGHT, char LEFT, RMPoint punto);
+ RMPoint searching(char UP, char DOWN, char RIGHT, char LEFT, RMPoint point);
RMPoint nearestPoint(const RMPoint &punto);
void goTo(CORO_PARAM, RMPoint destcoord, bool bReversed = false);
- short scanLine(const RMPoint &punto);
- RMPoint invScanLine(const RMPoint &punto);
+ short scanLine(const RMPoint &point);
+ RMPoint invScanLine(const RMPoint &point);
RMPoint nearestHotSpot(int sourcebox, int destbox);
void newBoxEntered(int nBox);
@@ -478,7 +478,7 @@ public:
void closeFade();
void waitForFadeEnd(CORO_PARAM);
- virtual void Unregister();
+ virtual void unregister();
virtual void removeThis(CORO_PARAM, bool &result);
virtual int priority();
};
diff --git a/engines/tony/mpal/expr.cpp b/engines/tony/mpal/expr.cpp
index 7923d263c0..824cd91651 100644
--- a/engines/tony/mpal/expr.cpp
+++ b/engines/tony/mpal/expr.cpp
@@ -35,68 +35,6 @@ namespace Tony {
namespace MPAL {
-/**
- * @defgroup Mathamatical operations
- */
-//@{
-
-#define OP_MUL ((1 << 4) | 0)
-#define OP_DIV ((1 << 4) | 1)
-#define OP_MODULE ((1 << 4) | 2)
-#define OP_ADD ((2 << 4) | 0)
-#define OP_SUB ((2 << 4) | 1)
-#define OP_SHL ((3 << 4) | 0)
-#define OP_SHR ((3 << 4) | 1)
-#define OP_MINOR ((4 << 4) | 0)
-#define OP_MAJOR ((4 << 4) | 1)
-#define OP_MINEQ ((4 << 4) | 2)
-#define OP_MAJEQ ((4 << 4) | 3)
-#define OP_EQUAL ((5 << 4) | 0)
-#define OP_NOEQUAL ((5 << 4) | 1)
-#define OP_BITAND ((6 << 4) | 0)
-#define OP_BITXOR ((7 << 4) | 0)
-#define OP_BITOR ((8 << 4) | 0)
-#define OP_AND ((9 << 4) | 0)
-#define OP_OR ((10 << 4) | 0)
-
-
-/**
- * Object types that can be contained in an EXPRESSION structure
- */
-enum ExprListTypes {
- ELT_NUMBER = 1,
- ELT_VAR = 2,
- ELT_PARENTH = 3,
- ELT_PARENTH2 = 4
-};
-
-//@}
-
-/**
- * @defgroup Structures
- */
-//@{
-
-/**
- * Mathamatical framework to manage operations
- */
-typedef struct {
- byte _type; // Tipo di oggetto (vedi enum ExprListTypes)
- byte _unary; // Unary operatore (NON SUPPORTATO)
-
- union {
- int _num; // Numero (se type==ELT_NUMBER)
- char *_name; // Nome variabile (se type==ELT_VAR)
- MpalHandle _son; // Handle a espressione (type==ELT_PARENTH)
- byte *_pson; // Handle lockato (type==ELT_PARENTH2)
- } _val;
-
- byte _symbol; // Simbolo matematico (vedi #define OP_*)
-
-} Expression;
-typedef Expression *LpExpression;
-
-//@}
/**
* Duplicate a mathematical expression.
@@ -106,15 +44,14 @@ typedef Expression *LpExpression;
*/
static byte *duplicateExpression(MpalHandle h) {
byte *orig, *clone;
- LpExpression one, two;
orig = (byte *)globalLock(h);
int num = *(byte *)orig;
- one = (LpExpression)(orig+1);
+ LpExpression one = (LpExpression)(orig+1);
clone = (byte *)globalAlloc(GMEM_FIXED, sizeof(Expression) * num + 1);
- two = (LpExpression)(clone + 1);
+ LpExpression two = (LpExpression)(clone + 1);
memcpy(clone, orig, sizeof(Expression) * num + 1);
@@ -180,7 +117,6 @@ static int Compute(int a, int b, byte symbol) {
static void solve(LpExpression one, int num) {
LpExpression two, three;
- int j;
while (num > 1) {
two = one + 1;
@@ -189,7 +125,7 @@ static void solve(LpExpression one, int num) {
memmove(one, two, (num - 1) * sizeof(Expression));
--num;
} else {
- j = 1;
+ int j = 1;
three = two + 1;
while ((three->_symbol != 0) && (two->_symbol & 0xF0) > (three->_symbol & 0xF0)) {
++two;
@@ -213,13 +149,11 @@ static void solve(LpExpression one, int num) {
* @returns Value
*/
static int evaluateAndFreeExpression(byte *expr) {
- LpExpression one, cur;
-
int num = *expr;
- one = (LpExpression)(expr + 1);
+ LpExpression one = (LpExpression)(expr + 1);
// 1) Substitutions of variables
- cur = one;
+ LpExpression cur = one;
for (int i = 0; i < num; i++, cur++) {
if (cur->_type == ELT_VAR) {
cur->_type = ELT_NUMBER;
@@ -254,7 +188,6 @@ static int evaluateAndFreeExpression(byte *expr) {
* @returns Pointer to the buffer immediately after the expression, or NULL if error.
*/
const byte *parseExpression(const byte *lpBuf, MpalHandle *h) {
- LpExpression cur;
byte *start;
uint32 num = *lpBuf;
@@ -270,12 +203,14 @@ const byte *parseExpression(const byte *lpBuf, MpalHandle *h) {
start = (byte *)globalLock(*h);
*start = (byte)num;
- cur = (LpExpression)(start + 1);
+ LpExpression cur = (LpExpression)(start + 1);
for (uint32 i = 0;i < num; i++) {
cur->_type = *(lpBuf);
- cur->_unary = *(lpBuf + 1);
+
+ // *(lpBuf + 1) contains the unary operator, unused => skipped
lpBuf += 2;
+
switch (cur->_type) {
case ELT_NUMBER:
cur->_val._num = (int32)READ_LE_UINT32(lpBuf);
@@ -322,10 +257,8 @@ const byte *parseExpression(const byte *lpBuf, MpalHandle *h) {
* @returns Numeric value
*/
int evaluateExpression(MpalHandle h) {
- int ret;
-
lockVar();
- ret = evaluateAndFreeExpression(duplicateExpression(h));
+ int ret = evaluateAndFreeExpression(duplicateExpression(h));
unlockVar();
return ret;
@@ -339,7 +272,6 @@ int evaluateExpression(MpalHandle h) {
*/
bool compareExpressions(MpalHandle h1, MpalHandle h2) {
byte *e1, *e2;
- LpExpression one, two;
e1 = (byte *)globalLock(h1);
e2 = (byte *)globalLock(h2);
@@ -353,8 +285,8 @@ bool compareExpressions(MpalHandle h1, MpalHandle h2) {
return false;
}
- one = (LpExpression)(e1 + 1);
- two = (LpExpression)(e2 + 1);
+ LpExpression one = (LpExpression)(e1 + 1);
+ LpExpression two = (LpExpression)(e2 + 1);
for (int i = 0; i < num1; i++) {
if (one->_type != two->_type || (i != num1 - 1 && one->_symbol != two->_symbol)) {
diff --git a/engines/tony/mpal/expr.h b/engines/tony/mpal/expr.h
index 9036099993..405624b4fe 100644
--- a/engines/tony/mpal/expr.h
+++ b/engines/tony/mpal/expr.h
@@ -35,6 +35,67 @@ namespace Tony {
namespace MPAL {
+/**
+ * @defgroup Mathamatical operations
+ */
+//@{
+
+#define OP_MUL ((1 << 4) | 0)
+#define OP_DIV ((1 << 4) | 1)
+#define OP_MODULE ((1 << 4) | 2)
+#define OP_ADD ((2 << 4) | 0)
+#define OP_SUB ((2 << 4) | 1)
+#define OP_SHL ((3 << 4) | 0)
+#define OP_SHR ((3 << 4) | 1)
+#define OP_MINOR ((4 << 4) | 0)
+#define OP_MAJOR ((4 << 4) | 1)
+#define OP_MINEQ ((4 << 4) | 2)
+#define OP_MAJEQ ((4 << 4) | 3)
+#define OP_EQUAL ((5 << 4) | 0)
+#define OP_NOEQUAL ((5 << 4) | 1)
+#define OP_BITAND ((6 << 4) | 0)
+#define OP_BITXOR ((7 << 4) | 0)
+#define OP_BITOR ((8 << 4) | 0)
+#define OP_AND ((9 << 4) | 0)
+#define OP_OR ((10 << 4) | 0)
+
+//@}
+
+/**
+ * @defgroup Structures
+ */
+
+//@{
+/**
+ * Mathamatical framework to manage operations
+ */
+typedef struct {
+ byte _type; // Object Type (see enum ExprListTypes)
+
+ union {
+ int _num; // Identifier (if type == ELT_NUMBER)
+ char *_name; // Variable name (if type == ELT_VAR)
+ MpalHandle _son; // Handle expressions (if type == ELT_PARENTH)
+ byte *_pson; // Handle lockato (if type == ELT_PARENTH2)
+ } _val;
+
+ byte _symbol; // Mathematic symbols (see #define OP_*)
+
+} Expression;
+typedef Expression *LpExpression;
+
+//@}
+
+/**
+ * Object types that can be contained in an EXPRESSION structure
+ */
+enum ExprListTypes {
+ ELT_NUMBER = 1,
+ ELT_VAR = 2,
+ ELT_PARENTH = 3,
+ ELT_PARENTH2 = 4
+};
+
/****************************************************************************\
* Function Prototypes
\****************************************************************************/
diff --git a/engines/tony/mpal/loadmpc.cpp b/engines/tony/mpal/loadmpc.cpp
index 953820be74..9c45cdf982 100644
--- a/engines/tony/mpal/loadmpc.cpp
+++ b/engines/tony/mpal/loadmpc.cpp
@@ -139,7 +139,6 @@ static void FreeScript(LpMpalScript lpmsScript) {
* @returns Pointer to the buffer after the item, or NULL on failure.
*/
static const byte *parseDialog(const byte *lpBuf, LpMpalDialog lpmdDialog) {
- uint32 num2, num3;
byte *lpLock;
lpmdDialog->_nObj = READ_LE_UINT32(lpBuf);
@@ -266,7 +265,7 @@ static const byte *parseDialog(const byte *lpBuf, LpMpalDialog lpmdDialog) {
lpmdDialog->_choice[i]._nChoice = READ_LE_UINT16(lpBuf);
lpBuf += 2;
- num2 = *lpBuf++;
+ uint32 num2 = *lpBuf++;
if (num2 >= MAX_SELECTS_PER_CHOICE)
error("Too much selects in choice #%d in dialog #%d", lpmdDialog->_choice[i]._nChoice, lpmdDialog->_nObj);
@@ -296,7 +295,7 @@ static const byte *parseDialog(const byte *lpBuf, LpMpalDialog lpmdDialog) {
lpBuf += 4;
// PlayGroup
- num3 = *lpBuf++;
+ uint32 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);
@@ -365,7 +364,6 @@ static const byte *parseItem(const byte *lpBuf, LpMpalItem lpmiItem) {
lpBuf++;
}
-
if (*lpBuf == 0) {
lpBuf++;
lpmiItem->_action[i]._when = NULL;
diff --git a/engines/tony/mpal/memory.cpp b/engines/tony/mpal/memory.cpp
index 78b036e657..dfbf16e789 100644
--- a/engines/tony/mpal/memory.cpp
+++ b/engines/tony/mpal/memory.cpp
@@ -33,8 +33,6 @@ namespace MPAL {
* MemoryManager methods
\****************************************************************************/
-const uint32 BLOCK_ID = 0x12345678;
-
/**
* Allocates a new memory block
* @return Returns a MemoryItem instance for the new block
diff --git a/engines/tony/mpal/memory.h b/engines/tony/mpal/memory.h
index ba7865938f..9c21cc20e6 100644
--- a/engines/tony/mpal/memory.h
+++ b/engines/tony/mpal/memory.h
@@ -69,6 +69,8 @@ public:
#define GMEM_MOVEABLE 2
#define GMEM_ZEROINIT 4
+const uint32 BLOCK_ID = 0x12345678;
+
} // end of namespace MPAL
} // end of namespace Tony
diff --git a/engines/tony/mpal/mpal.cpp b/engines/tony/mpal/mpal.cpp
index 10f5753540..8d83363c24 100644
--- a/engines/tony/mpal/mpal.cpp
+++ b/engines/tony/mpal/mpal.cpp
@@ -39,19 +39,6 @@ namespace Tony {
namespace MPAL {
-#define GETARG(type) va_arg(v, type)
-
-/****************************************************************************\
-* Copyright
-\****************************************************************************/
-
-const char *mpalCopyright =
- "\n\nMPAL - MultiPurpose Adventure Language for Windows 95\n"
- "Copyright 1997-98 Giovanni Bajo and Luca Giusti\n"
- "ALL RIGHTS RESERVED\n"
- "\n"
- "\n";
-
/****************************************************************************\
* Internal functions
\****************************************************************************/
@@ -363,24 +350,22 @@ static char *duplicateDialogPeriod(uint32 nPeriod) {
MpalHandle resLoad(uint32 dwId) {
MpalHandle h;
char head[4];
- uint32 nBytesRead;
- uint32 nSizeComp, nSizeDecomp;
byte *temp, *buf;
for (int i = 0; i < GLOBALS._nResources; i++)
if (GLOBALS._lpResources[i * 2] == dwId) {
GLOBALS._hMpr.seek(GLOBALS._lpResources[i * 2 + 1]);
- nBytesRead = GLOBALS._hMpr.read(head, 4);
+ uint32 nBytesRead = GLOBALS._hMpr.read(head, 4);
if (nBytesRead != 4)
return NULL;
if (head[0] != 'R' || head[1] != 'E' || head[2] != 'S' || head[3] != 'D')
return NULL;
- nSizeDecomp = GLOBALS._hMpr.readUint32LE();
+ uint32 nSizeDecomp = GLOBALS._hMpr.readUint32LE();
if (GLOBALS._hMpr.err())
return NULL;
- nSizeComp = GLOBALS._hMpr.readUint32LE();
+ uint32 nSizeComp = GLOBALS._hMpr.readUint32LE();
if (GLOBALS._hMpr.err())
return NULL;
@@ -463,18 +448,16 @@ static uint32 *GetItemList(uint32 nLoc) {
static LpItem getItemData(uint32 nOrdItem) {
LpMpalItem curitem = GLOBALS._lpmiItems + nOrdItem;
- LpItem ret;
- MpalHandle hDat;
char *dat;
char *patlength;
// Zeroing out the allocated memory is required!!!
- ret = (LpItem)globalAlloc(GMEM_FIXED | GMEM_ZEROINIT, sizeof(Item));
+ LpItem ret = (LpItem)globalAlloc(GMEM_FIXED | GMEM_ZEROINIT, sizeof(Item));
if (ret == NULL)
return NULL;
ret->_speed = 150;
- hDat = resLoad(curitem->_dwRes);
+ MpalHandle hDat = resLoad(curitem->_dwRes);
dat = (char *)globalLock(hDat);
if (dat[0] == 'D' && dat[1] == 'A' && dat[2] == 'T') {
@@ -659,6 +642,9 @@ void ScriptThread(CORO_PARAM, const void *param) {
CORO_KILL_SELF();
return;
}
+
+ // WORKAROUND: Wait for events to pulse.
+ CORO_SLEEP(1);
}
}
@@ -727,6 +713,9 @@ void ActionThread(CORO_PARAM, const void *param) {
GLOBALS._mpalError = 1;
break;
}
+
+ // WORKAROUND: Wait for events to pulse.
+ CORO_SLEEP(1);
}
globalDestroy(_ctx->item);
@@ -1138,6 +1127,9 @@ void GroupThread(CORO_PARAM, const void *param) {
CORO_KILL_SELF();
return;
}
+
+ // WORKAROUND: Wait for events to pulse.
+ CORO_SLEEP(1);
}
// The gruop is finished, so we can return to the calling function.
@@ -1403,11 +1395,7 @@ bool doSelection(uint32 i, uint32 dwData) {
*/
bool mpalInit(const char *lpszMpcFileName, const char *lpszMprFileName,
LPLPCUSTOMFUNCTION lplpcfArray, Common::String *lpcfStrings) {
- Common::File hMpc;
byte buf[5];
- uint32 nBytesRead;
- bool bCompress;
- uint32 dwSizeDecomp, dwSizeComp;
byte *cmpbuf;
// Save the array of custom functions
@@ -1415,21 +1403,22 @@ bool mpalInit(const char *lpszMpcFileName, const char *lpszMprFileName,
GLOBALS._lplpFunctionStrings = lpcfStrings;
// OPen the MPC file for reading
+ Common::File hMpc;
if (!hMpc.open(lpszMpcFileName))
return false;
// Read and check the header
- nBytesRead = hMpc.read(buf, 5);
+ uint32 nBytesRead = hMpc.read(buf, 5);
if (nBytesRead != 5)
return false;
if (buf[0] != 'M' || buf[1] != 'P' || buf[2] != 'C' || buf[3] != 0x20)
return false;
- bCompress = buf[4];
+ bool bCompress = buf[4];
// Reads the size of the uncompressed file, and allocate memory
- dwSizeDecomp = hMpc.readUint32LE();
+ uint32 dwSizeDecomp = hMpc.readUint32LE();
if (hMpc.err())
return false;
@@ -1439,7 +1428,7 @@ bool mpalInit(const char *lpszMpcFileName, const char *lpszMprFileName,
if (bCompress) {
// Get the compressed size and read the data in
- dwSizeComp = hMpc.readUint32LE();
+ uint32 dwSizeComp = hMpc.readUint32LE();
if (hMpc.err())
return false;
@@ -1480,7 +1469,7 @@ bool mpalInit(const char *lpszMpcFileName, const char *lpszMprFileName,
// Seek to the end of the file to read overall information
GLOBALS._hMpr.seek(-12, SEEK_END);
- dwSizeComp = GLOBALS._hMpr.readUint32LE();
+ uint32 dwSizeComp = GLOBALS._hMpr.readUint32LE();
if (GLOBALS._hMpr.err())
return false;
@@ -1958,11 +1947,9 @@ uint32 mpalGetError() {
* @returns TRUE if the script 'was launched, FALSE on failure
*/
bool mpalExecuteScript(int nScript) {
- LpMpalScript s;
-
LockScripts();
int n = scriptGetOrderFromNum(nScript);
- s = (LpMpalScript)globalAlloc(GMEM_FIXED | GMEM_ZEROINIT, sizeof(MpalScript));
+ LpMpalScript s = (LpMpalScript)globalAlloc(GMEM_FIXED | GMEM_ZEROINIT, sizeof(MpalScript));
if (s == NULL)
return false;
diff --git a/engines/tony/mpal/mpal.h b/engines/tony/mpal/mpal.h
index c5f505063f..5e1b02b3fc 100644
--- a/engines/tony/mpal/mpal.h
+++ b/engines/tony/mpal/mpal.h
@@ -102,6 +102,8 @@ namespace MPAL {
#define MAXPATTERN 40 // pattern of animation of an object
#define MAXPOLLINGLOCATIONS 64
+#define GETARG(type) va_arg(v, type)
+
/**
* Macro for use with queries that may refer to X and Y co-ordinates
*/
diff --git a/engines/tony/sound.cpp b/engines/tony/sound.cpp
index 2c2c280eb2..2844e0d925 100644
--- a/engines/tony/sound.cpp
+++ b/engines/tony/sound.cpp
@@ -45,7 +45,7 @@ namespace Tony {
*
*/
FPSound::FPSound() {
- _bSoundSupported = false;
+ _soundSupported = false;
}
/**
@@ -54,8 +54,8 @@ FPSound::FPSound() {
* @returns True is everything is OK, False otherwise
*/
bool FPSound::init() {
- _bSoundSupported = g_system->getMixer()->isReady();
- return _bSoundSupported;
+ _soundSupported = g_system->getMixer()->isReady();
+ return _soundSupported;
}
/**
@@ -69,55 +69,55 @@ FPSound::~FPSound() {
/**
* Allocates an object of type FPStream, and return its pointer
*
- * @param lplpStream Will contain a pointer to the object you just created.
+ * @param streamPtr Will contain a pointer to the object you just created.
*
* @returns True is everything is OK, False otherwise
*/
-bool FPSound::createStream(FPStream **lplpStream) {
- (*lplpStream) = new FPStream(_bSoundSupported);
+bool FPSound::createStream(FPStream **streamPtr) {
+ (*streamPtr) = new FPStream(_soundSupported);
- return (*lplpStream != NULL);
+ return (*streamPtr != NULL);
}
/**
* Allocates an object of type FpSfx, and return its pointer
*
- * @param lplpSfx Will contain a pointer to the object you just created.
+ * @param soundPtr Will contain a pointer to the object you just created.
*
* @returns True is everything is OK, False otherwise
*/
-bool FPSound::createSfx(FPSfx **lplpSfx) {
- (*lplpSfx) = new FPSfx(_bSoundSupported);
+bool FPSound::createSfx(FPSfx **sfxPtr) {
+ (*sfxPtr) = new FPSfx(_soundSupported);
- return (*lplpSfx != NULL);
+ return (*sfxPtr != NULL);
}
/**
* Set the general volume
*
- * @param dwVolume Volume to set (0-63)
+ * @param volume Volume to set (0-63)
*/
-void FPSound::setMasterVolume(int dwVolume) {
- if (!_bSoundSupported)
+void FPSound::setMasterVolume(int volume) {
+ if (!_soundSupported)
return;
- g_system->getMixer()->setVolumeForSoundType(Audio::Mixer::kPlainSoundType, CLIP<int>(dwVolume, 0, 63) * Audio::Mixer::kMaxChannelVolume / 63);
+ g_system->getMixer()->setVolumeForSoundType(Audio::Mixer::kPlainSoundType, CLIP<int>(volume, 0, 63) * Audio::Mixer::kMaxChannelVolume / 63);
}
/**
* Get the general volume
*
- * @param lpdwVolume Variable that will contain the volume (0-63)
+ * @param volumePtr Variable that will contain the volume (0-63)
*/
-void FPSound::getMasterVolume(int *lpdwVolume) {
- if (!_bSoundSupported)
+void FPSound::getMasterVolume(int *volumePtr) {
+ if (!_soundSupported)
return;
- *lpdwVolume = g_system->getMixer()->getVolumeForSoundType(Audio::Mixer::kPlainSoundType) * 63 / Audio::Mixer::kMaxChannelVolume;
+ *volumePtr = g_system->getMixer()->getVolumeForSoundType(Audio::Mixer::kPlainSoundType) * 63 / Audio::Mixer::kMaxChannelVolume;
}
/**
@@ -128,15 +128,15 @@ void FPSound::getMasterVolume(int *lpdwVolume) {
*
*/
-FPSfx::FPSfx(bool bSoundOn) {
- _bSoundSupported = bSoundOn;
- _bFileLoaded = false;
+FPSfx::FPSfx(bool soundOn) {
+ _soundSupported = soundOn;
+ _fileLoaded = false;
_lastVolume = 63;
_hEndOfBuffer = CoroScheduler.createEvent(true, false);
- _bIsVoice = false;
+ _isVoice = false;
_loopStream = 0;
_rewindableStream = 0;
- _bPaused = false;
+ _paused = false;
g_vm->_activeSfx.push_back(this);
}
@@ -150,7 +150,7 @@ FPSfx::FPSfx(bool bSoundOn) {
*/
FPSfx::~FPSfx() {
- if (!_bSoundSupported)
+ if (!_soundSupported)
return;
g_system->getMixer()->stopHandle(_handle);
@@ -187,22 +187,22 @@ bool FPSfx::loadWave(Common::SeekableReadStream *stream) {
if (!_rewindableStream)
return false;
- _bFileLoaded = true;
+ _fileLoaded = true;
setVolume(_lastVolume);
return true;
}
bool FPSfx::loadVoiceFromVDB(Common::File &vdbFP) {
- if (!_bSoundSupported)
+ if (!_soundSupported)
return true;
uint32 size = vdbFP.readUint32LE();
uint32 rate = vdbFP.readUint32LE();
- _bIsVoice = true;
+ _isVoice = true;
_rewindableStream = Audio::makeADPCMStream(vdbFP.readStream(size), DisposeAfterUse::YES, 0, Audio::kADPCMDVI, rate, 1);
- _bFileLoaded = true;
+ _fileLoaded = true;
setVolume(62);
return true;
}
@@ -210,18 +210,18 @@ bool FPSfx::loadVoiceFromVDB(Common::File &vdbFP) {
/**
* Opens a file and loads a sound effect.
*
- * @param lpszFileName Sfx filename
- * @param dwCodec CODEC used to uncompress the samples
+ * @param fileName Sfx filename
+ * @param codec CODEC used to uncompress the samples
*
* @returns True is everything is OK, False otherwise
*/
-bool FPSfx::loadFile(const char *lpszFileName, uint32 dwCodec) {
- if (!_bSoundSupported)
+bool FPSfx::loadFile(const char *fileName, uint32 codec) {
+ if (!_soundSupported)
return true;
Common::File file;
- if (!file.open(lpszFileName)) {
+ if (!file.open(fileName)) {
warning("FPSfx::LoadFile(): Cannot open sfx file!");
return false;
}
@@ -236,7 +236,7 @@ bool FPSfx::loadFile(const char *lpszFileName, uint32 dwCodec) {
Common::SeekableReadStream *buffer = file.readStream(file.size() - file.pos());
- if (dwCodec == FPCODEC_ADPCM) {
+ if (codec == FPCODEC_ADPCM) {
_rewindableStream = Audio::makeADPCMStream(buffer, DisposeAfterUse::YES, 0, Audio::kADPCMDVI, rate, channels);
} else {
byte flags = Audio::FLAG_16BITS | Audio::FLAG_LITTLE_ENDIAN;
@@ -247,7 +247,7 @@ bool FPSfx::loadFile(const char *lpszFileName, uint32 dwCodec) {
_rewindableStream = Audio::makeRawStream(buffer, rate, flags, DisposeAfterUse::YES);
}
- _bFileLoaded = true;
+ _fileLoaded = true;
return true;
}
@@ -260,14 +260,14 @@ bool FPSfx::loadFile(const char *lpszFileName, uint32 dwCodec) {
bool FPSfx::play() {
stop(); // sanity check
- if (_bFileLoaded) {
+ if (_fileLoaded) {
CoroScheduler.resetEvent(_hEndOfBuffer);
_rewindableStream->rewind();
Audio::AudioStream *stream = _rewindableStream;
- if (_bLoop) {
+ if (_loop) {
if (!_loopStream)
_loopStream = Audio::makeLoopingAudioStream(_rewindableStream, 0);
@@ -279,7 +279,7 @@ bool FPSfx::play() {
setVolume(_lastVolume);
- if (_bPaused)
+ if (_paused)
g_system->getMixer()->pauseHandle(_handle, true);
}
@@ -293,9 +293,9 @@ bool FPSfx::play() {
*/
bool FPSfx::stop() {
- if (_bFileLoaded) {
+ if (_fileLoaded) {
g_system->getMixer()->stopHandle(_handle);
- _bPaused = false;
+ _paused = false;
}
return true;
@@ -304,15 +304,15 @@ bool FPSfx::stop() {
/**
* Enables or disables the Sfx loop.
*
- * @param _bLoop True to enable the loop, False to disable
+ * @param loop True to enable the loop, False to disable
*
* @remarks The loop must be activated BEFORE the sfx starts
* playing. Any changes made during the play will have
* no effect until the sfx is stopped then played again.
*/
-void FPSfx::setLoop(bool bLop) {
- _bLoop = bLop;
+void FPSfx::setLoop(bool loop) {
+ _loop = loop;
}
/**
@@ -320,65 +320,65 @@ void FPSfx::setLoop(bool bLop) {
*
*/
-void FPSfx::pause(bool bPause) {
- if (_bFileLoaded) {
- if (g_system->getMixer()->isSoundHandleActive(_handle) && (bPause ^ _bPaused))
- g_system->getMixer()->pauseHandle(_handle, bPause);
+void FPSfx::setPause(bool pause) {
+ if (_fileLoaded) {
+ if (g_system->getMixer()->isSoundHandleActive(_handle) && (pause ^ _paused))
+ g_system->getMixer()->pauseHandle(_handle, pause);
- _bPaused = bPause;
+ _paused = pause;
}
}
/**
* Change the volume of Sfx
*
- * @param dwVolume Volume to be set (0-63)
+ * @param volume Volume to be set (0-63)
*
*/
-void FPSfx::setVolume(int dwVolume) {
- if (dwVolume > 63)
- dwVolume = 63;
+void FPSfx::setVolume(int volume) {
+ if (volume > 63)
+ volume = 63;
- if (dwVolume < 0)
- dwVolume = 0;
+ if (volume < 0)
+ volume = 0;
- _lastVolume = dwVolume;
+ _lastVolume = volume;
- if (_bIsVoice) {
+ if (_isVoice) {
if (!GLOBALS._bCfgDubbing)
- dwVolume = 0;
+ volume = 0;
else {
- dwVolume -= (10 - GLOBALS._nCfgDubbingVolume) * 2;
- if (dwVolume < 0)
- dwVolume = 0;
+ volume -= (10 - GLOBALS._nCfgDubbingVolume) * 2;
+ if (volume < 0)
+ volume = 0;
}
} else {
if (!GLOBALS._bCfgSFX)
- dwVolume = 0;
+ volume = 0;
else {
- dwVolume -= (10 - GLOBALS._nCfgSFXVolume) * 2;
- if (dwVolume < 0)
- dwVolume = 0;
+ volume -= (10 - GLOBALS._nCfgSFXVolume) * 2;
+ if (volume < 0)
+ volume = 0;
}
}
if (g_system->getMixer()->isSoundHandleActive(_handle))
- g_system->getMixer()->setChannelVolume(_handle, dwVolume * Audio::Mixer::kMaxChannelVolume / 63);
+ g_system->getMixer()->setChannelVolume(_handle, volume * Audio::Mixer::kMaxChannelVolume / 63);
}
/**
* Gets the Sfx volume
*
- * @param lpdwVolume Will contain the current Sfx volume
+ * @param volumePtr Will contain the current Sfx volume
*
*/
-void FPSfx::getVolume(int *lpdwVolume) {
+void FPSfx::getVolume(int *volumePtr) {
if (g_system->getMixer()->isSoundHandleActive(_handle))
- *lpdwVolume = g_system->getMixer()->getChannelVolume(_handle) * 63 / Audio::Mixer::kMaxChannelVolume;
+ *volumePtr = g_system->getMixer()->getChannelVolume(_handle) * 63 / Audio::Mixer::kMaxChannelVolume;
else
- *lpdwVolume = 0;
+ *volumePtr = 0;
}
/**
@@ -421,14 +421,14 @@ void FPSfx::soundCheckProcess(CORO_PARAM, const void *param) {
* @remarks Do *NOT* declare an object directly, but rather
* create it using FPSound::CreateStream()
*/
-FPStream::FPStream(bool bSoundOn) {
- _bSoundSupported = bSoundOn;
- _bFileLoaded = false;
- _bPaused = false;
- _bLoop = false;
- _bDoFadeOut = false;
- _bSyncExit = false;
- _dwBufferSize = _dwSize = 0;
+FPStream::FPStream(bool soundOn) {
+ _soundSupported = soundOn;
+ _fileLoaded = false;
+ _paused = false;
+ _loop = false;
+ _doFadeOut = false;
+ _syncExit = false;
+ _bufferSize = _size = 0;
_lastVolume = 0;
_syncToPlay = NULL;
_loopStream = NULL;
@@ -442,13 +442,13 @@ FPStream::FPStream(bool bSoundOn) {
*/
FPStream::~FPStream() {
- if (!_bSoundSupported)
+ if (!_soundSupported)
return;
if (g_system->getMixer()->isSoundHandleActive(_handle))
stop();
- if (_bFileLoaded)
+ if (_fileLoaded)
unloadFile();
_syncToPlay = NULL;
@@ -470,19 +470,19 @@ void FPStream::release() {
* Opens a file stream
*
* @param fileName Filename to be opened
- * @param dwCodec CODEC to be used to uncompress samples
+ * @param codec CODEC to be used to uncompress samples
*
* @returns True is everything is OK, False otherwise
*/
-bool FPStream::loadFile(const Common::String &fileName, uint32 dwCodType, int nBufSize) {
- if (!_bSoundSupported)
+bool FPStream::loadFile(const Common::String &fileName, uint32 codec, int bufSize) {
+ if (!_soundSupported)
return true;
- if (_bFileLoaded)
+ if (_fileLoaded)
unloadFile();
// Save the codec type
- _dwCodec = dwCodType;
+ _codec = codec;
// Open the file stream for reading
if (!_file.open(fileName)) {
@@ -492,9 +492,9 @@ bool FPStream::loadFile(const Common::String &fileName, uint32 dwCodType, int nB
}
// Save the size of the stream
- _dwSize = _file.size();
+ _size = _file.size();
- switch (_dwCodec) {
+ switch (_codec) {
case FPCODEC_RAW:
_rewindableStream = Audio::makeRawStream(&_file, 44100, Audio::FLAG_16BITS | Audio::FLAG_LITTLE_ENDIAN | Audio::FLAG_STEREO, DisposeAfterUse::NO);
break;
@@ -509,8 +509,8 @@ bool FPStream::loadFile(const Common::String &fileName, uint32 dwCodType, int nB
}
// All done
- _bFileLoaded = true;
- _bPaused = false;
+ _fileLoaded = true;
+ _paused = false;
setVolume(63);
@@ -527,7 +527,7 @@ bool FPStream::loadFile(const Common::String &fileName, uint32 dwCodType, int nB
* memory used by the stream.
*/
bool FPStream::unloadFile() {
- if (!_bSoundSupported || !_bFileLoaded)
+ if (!_soundSupported || !_fileLoaded)
return true;
assert(!g_system->getMixer()->isSoundHandleActive(_handle));
@@ -540,7 +540,7 @@ bool FPStream::unloadFile() {
_file.close();
// Flag that the file is no longer in memory
- _bFileLoaded = false;
+ _fileLoaded = false;
return true;
}
@@ -552,7 +552,7 @@ bool FPStream::unloadFile() {
*/
bool FPStream::play() {
- if (!_bSoundSupported || !_bFileLoaded)
+ if (!_soundSupported || !_fileLoaded)
return false;
stop();
@@ -561,7 +561,7 @@ bool FPStream::play() {
Audio::AudioStream *stream = _rewindableStream;
- if (_bLoop) {
+ if (_loop) {
if (!_loopStream)
_loopStream = new Audio::LoopingAudioStream(_rewindableStream, 0, DisposeAfterUse::NO);
@@ -571,7 +571,7 @@ bool FPStream::play() {
// FIXME: Should this be kMusicSoundType or KPlainSoundType?
g_system->getMixer()->playStream(Audio::Mixer::kMusicSoundType, &_handle, stream, -1, Audio::Mixer::kMaxChannelVolume, 0, DisposeAfterUse::NO);
setVolume(_lastVolume);
- _bPaused = false;
+ _paused = false;
return true;
}
@@ -584,10 +584,10 @@ bool FPStream::play() {
*/
bool FPStream::stop() {
- if (!_bSoundSupported)
+ if (!_soundSupported)
return true;
- if (!_bFileLoaded)
+ if (!_fileLoaded)
return false;
if (!g_system->getMixer()->isSoundHandleActive(_handle))
@@ -595,49 +595,49 @@ bool FPStream::stop() {
g_system->getMixer()->stopHandle(_handle);
- _bPaused = false;
+ _paused = false;
return true;
}
-void FPStream::waitForSync(FPStream *toplay) {
+void FPStream::waitForSync(FPStream *toPlay) {
// FIXME: The idea here is that you wait for this stream to reach
// a buffer which is a multiple of nBufSize/nSync, and then the
// thread stops it and immediately starts the 'toplay' stream.
stop();
- toplay->play();
+ toPlay->play();
}
/**
* Unables or disables stream loop.
*
- * @param _bLoop True enable loop, False disables it
+ * @param loop True enable loop, False disables it
*
* @remarks The loop must be activated BEFORE the stream starts
* playing. Any changes made during the play will have no
* effect until the stream is stopped then played again.
*/
void FPStream::setLoop(bool loop) {
- _bLoop = loop;
+ _loop = loop;
}
/**
* Pause sound effect
*
- * @param bPause True enables pause, False disables it
+ * @param pause True enables pause, False disables it
*/
-void FPStream::pause(bool bPause) {
- if (!_bFileLoaded)
+void FPStream::setPause(bool pause) {
+ if (!_fileLoaded)
return;
- if (bPause == _bPaused)
+ if (pause == _paused)
return;
if (g_system->getMixer()->isSoundHandleActive(_handle))
- g_system->getMixer()->pauseHandle(_handle, bPause);
+ g_system->getMixer()->pauseHandle(_handle, pause);
- _bPaused = bPause;
+ _paused = pause;
// Trick to reset the volume after a possible new sound configuration
setVolume(_lastVolume);
@@ -646,43 +646,43 @@ void FPStream::pause(bool bPause) {
/**
* Change the volume of the stream
*
- * @param dwVolume Volume to be set (0-63)
+ * @param volume Volume to be set (0-63)
*
*/
-void FPStream::setVolume(int dwVolume) {
- if (dwVolume > 63)
- dwVolume = 63;
+void FPStream::setVolume(int volume) {
+ if (volume > 63)
+ volume = 63;
- if (dwVolume < 0)
- dwVolume = 0;
+ if (volume < 0)
+ volume = 0;
- _lastVolume = dwVolume;
+ _lastVolume = volume;
if (!GLOBALS._bCfgMusic)
- dwVolume = 0;
+ volume = 0;
else {
- dwVolume -= (10 - GLOBALS._nCfgMusicVolume) * 2;
- if (dwVolume < 0)
- dwVolume = 0;
+ volume -= (10 - GLOBALS._nCfgMusicVolume) * 2;
+ if (volume < 0)
+ volume = 0;
}
if (g_system->getMixer()->isSoundHandleActive(_handle))
- g_system->getMixer()->setChannelVolume(_handle, dwVolume * Audio::Mixer::kMaxChannelVolume / 63);
+ g_system->getMixer()->setChannelVolume(_handle, volume * Audio::Mixer::kMaxChannelVolume / 63);
}
/**
* Gets the volume of the stream
*
- * @param lpdwVolume Variable that will contain the current volume
+ * @param volumePtr Variable that will contain the current volume
*
*/
-void FPStream::getVolume(int *lpdwVolume) {
+void FPStream::getVolume(int *volumePtr) {
if (g_system->getMixer()->isSoundHandleActive(_handle))
- *lpdwVolume = g_system->getMixer()->getChannelVolume(_handle) * 63 / Audio::Mixer::kMaxChannelVolume;
+ *volumePtr = g_system->getMixer()->getChannelVolume(_handle) * 63 / Audio::Mixer::kMaxChannelVolume;
else
- *lpdwVolume = 0;
+ *volumePtr = 0;
}
} // End of namespace Tony
diff --git a/engines/tony/sound.h b/engines/tony/sound.h
index c859f781f4..7422de02b3 100644
--- a/engines/tony/sound.h
+++ b/engines/tony/sound.h
@@ -55,7 +55,7 @@ enum SoundCodecs {
class FPSound {
private:
- bool _bSoundSupported;
+ bool _soundSupported;
public:
/**
@@ -83,49 +83,49 @@ public:
/**
* Allocates an object of type FPStream, and return its pointer
*
- * @param lplpStream Will contain a pointer to the object you just created.
+ * @param streamPtr Will contain a pointer to the object you just created.
*
* @returns True is everything is OK, False otherwise
*/
- bool createStream(FPStream **lplpStream);
+ bool createStream(FPStream **streamPtr);
/**
* Allocates an object of type FpSfx, and return its pointer
*
- * @param lplpSfx Will contain a pointer to the object you just created.
+ * @param sfxPtr Will contain a pointer to the object you just created.
*
* @returns True is everything is OK, False otherwise
*/
- bool createSfx(FPSfx **lplpSfx);
+ bool createSfx(FPSfx **sfxPtr);
/**
* Set the general volume
*
- * @param dwVolume Volume to set (0-63)
+ * @param volume Volume to set (0-63)
*/
- void setMasterVolume(int dwVolume);
+ void setMasterVolume(int volume);
/**
* Get the general volume
*
- * @param lpdwVolume Variable that will contain the volume (0-63)
+ * @param volume Variable that will contain the volume (0-63)
*/
- void getMasterVolume(int *lpdwVolume);
+ void getMasterVolume(int *volume);
};
class FPSfx {
private:
- bool _bSoundSupported; // True if the sound is active
- bool _bFileLoaded; // True is a file is opened
- bool _bLoop; // True is sound effect should loop
+ bool _soundSupported; // True if the sound is active
+ bool _fileLoaded; // True is a file is opened
+ bool _loop; // True is sound effect should loop
int _lastVolume;
- bool _bIsVoice;
- bool _bPaused;
+ bool _isVoice;
+ bool _paused;
Audio::AudioStream *_loopStream;
Audio::RewindableAudioStream *_rewindableStream;
@@ -147,7 +147,7 @@ public:
*
*/
- FPSfx(bool bSoundOn);
+ FPSfx(bool soundOn);
/**
* Default Destructor.
@@ -173,13 +173,13 @@ public:
/**
* Opens a file and loads a sound effect.
*
- * @param lpszFileName Sfx filename
- * @param dwCodec CODEC used to uncompress the samples
+ * @param fileName Sfx filename
+ * @param codec CODEC used to uncompress the samples
*
* @returns True is everything is OK, False otherwise
*/
- bool loadFile(const char *lpszFileName, uint32 dwCodec = FPCODEC_RAW);
+ bool loadFile(const char *fileName, uint32 codec = FPCODEC_RAW);
bool loadWave(Common::SeekableReadStream *stream);
bool loadVoiceFromVDB(Common::File &vdbFP);
@@ -204,37 +204,37 @@ public:
*
*/
- void pause(bool bPause);
+ void setPause(bool pause);
/**
* Enables or disables the Sfx loop.
*
- * @param bLoop True to enable the loop, False to disable
+ * @param loop True to enable the loop, False to disable
*
* @remarks The loop must be activated BEFORE the sfx starts
* playing. Any changes made during the play will have
* no effect until the sfx is stopped then played again.
*/
- void setLoop(bool bLoop);
+ void setLoop(bool loop);
/**
* Change the volume of Sfx
*
- * @param dwVolume Volume to be set (0-63)
+ * @param volume Volume to be set (0-63)
*
*/
- void setVolume(int dwVolume);
+ void setVolume(int volume);
/**
* Gets the Sfx volume
*
- * @param lpdwVolume Will contain the current Sfx volume
+ * @param volumePtr Will contain the current Sfx volume
*
*/
- void getVolume(int *lpdwVolume);
+ void getVolume(int *volumePtr);
/**
* Returns true if the underlying sound has ended
@@ -244,18 +244,18 @@ public:
class FPStream {
private:
- uint32 _dwBufferSize; // Buffer size (bytes)
- uint32 _dwSize; // Stream size (bytes)
- uint32 _dwCodec; // CODEC used
-
- Common::File _file; // File handle used for the stream
-
- bool _bSoundSupported; // True if the sound is active
- bool _bFileLoaded; // True if the file is open
- bool _bLoop; // True if the stream should loop
- bool _bDoFadeOut; // True if fade out is required
- bool _bSyncExit;
- bool _bPaused;
+ uint32 _bufferSize; // Buffer size (bytes)
+ uint32 _size; // Stream size (bytes)
+ uint32 _codec; // CODEC used
+
+ Common::File _file; // File handle used for the stream
+
+ bool _soundSupported; // True if the sound is active
+ bool _fileLoaded; // True if the file is open
+ bool _loop; // True if the stream should loop
+ bool _doFadeOut; // True if fade out is required
+ bool _syncExit;
+ bool _paused;
int _lastVolume;
FPStream *_syncToPlay;
@@ -272,7 +272,7 @@ public:
* create it using FPSound::CreateStream()
*/
- FPStream(bool bSoundOn);
+ FPStream(bool soundOn);
/**
* Default destructor.
@@ -297,12 +297,12 @@ public:
* Opens a file stream
*
* @param fileName Filename to be opened
- * @param dwCodec CODEC to be used to uncompress samples
+ * @param codec CODEC to be used to uncompress samples
*
* @returns True is everything is OK, False otherwise
*/
- bool loadFile(const Common::String &fileName, uint32 dwCodec = FPCODEC_RAW, int nSync = 2000);
+ bool loadFile(const Common::String &fileName, uint32 codec = FPCODEC_RAW, int sync = 2000);
/**
* Closes a file stream (opened or not).
@@ -332,44 +332,44 @@ public:
*/
bool stop();
- void waitForSync(FPStream *toplay);
+ void waitForSync(FPStream *toPlay);
/**
* Pause sound effect
*
- * @param bPause True enables pause, False disables it
+ * @param pause True enables pause, False disables it
*/
- void pause(bool bPause);
+ void setPause(bool pause);
/**
* Unables or disables stream loop.
*
- * @param bLoop True enable loop, False disables it
+ * @param loop True enable loop, False disables it
*
* @remarks The loop must be activated BEFORE the stream starts
* playing. Any changes made during the play will have no
* effect until the stream is stopped then played again.
*/
- void setLoop(bool bLoop);
+ void setLoop(bool loop);
/**
* Change the volume of the stream
*
- * @param dwVolume Volume to be set (0-63)
+ * @param volume Volume to be set (0-63)
*/
- void setVolume(int dwVolume);
+ void setVolume(int volume);
/**
* Gets the volume of the stream
*
- * @param lpdwVolume Variable that will contain the current volume
+ * @param volumePtr Variable that will contain the current volume
*
*/
- void getVolume(int *lpdwVolume);
+ void getVolume(int *volumePtr);
};
} // End of namespace Tony
diff --git a/engines/tony/tony.cpp b/engines/tony/tony.cpp
index 4ffb84ced8..6503c09aa8 100644
--- a/engines/tony/tony.cpp
+++ b/engines/tony/tony.cpp
@@ -513,13 +513,13 @@ void TonyEngine::pauseSound(bool bPause) {
for (uint i = 0; i < 6; i++)
if (_stream[i])
- _stream[i]->pause(bPause);
+ _stream[i]->setPause(bPause);
for (uint i = 0; i < MAX_SFX_CHANNELS; i++) {
if (_sfx[i])
- _sfx[i]->pause(bPause);
+ _sfx[i]->setPause(bPause);
if (_utilSfx[i])
- _utilSfx[i]->pause(bPause);
+ _utilSfx[i]->setPause(bPause);
}
}
diff --git a/engines/tony/utils.cpp b/engines/tony/utils.cpp
index 3cc09a1454..81060146b7 100644
--- a/engines/tony/utils.cpp
+++ b/engines/tony/utils.cpp
@@ -383,7 +383,7 @@ void RMResUpdate::init(const Common::String &fileName) {
// It doesn't exist, so exit immediately
return;
- uint8 version = _hFile.readByte();
+ _hFile.readByte(); // Version, unused
_numUpd = _hFile.readUint32LE();