aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/tony/font.cpp8
-rw-r--r--engines/tony/font.h4
-rw-r--r--engines/tony/game.cpp32
-rw-r--r--engines/tony/gfxcore.cpp280
-rw-r--r--engines/tony/gfxcore.h40
-rw-r--r--engines/tony/gfxengine.cpp24
-rw-r--r--engines/tony/inventory.cpp47
-rw-r--r--engines/tony/loc.cpp360
-rw-r--r--engines/tony/loc.h8
9 files changed, 353 insertions, 450 deletions
diff --git a/engines/tony/font.cpp b/engines/tony/font.cpp
index f4594f080d..2d665abdb4 100644
--- a/engines/tony/font.cpp
+++ b/engines/tony/font.cpp
@@ -718,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);
}
@@ -934,8 +934,8 @@ RMDialogChoice::~RMDialogChoice() {
CoroScheduler.closeEvent(_hUnreg);
}
-void RMDialogChoice::Unregister() {
- RMGfxWoodyBuffer::Unregister();
+void RMDialogChoice::unregister() {
+ RMGfxWoodyBuffer::unregister();
assert(!_nInList);
CoroScheduler.pulseEvent(_hUnreg);
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 5b586611c9..1a19f2836c 100644
--- a/engines/tony/game.cpp
+++ b/engines/tony/game.cpp
@@ -287,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;
}
@@ -500,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];
@@ -690,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;
@@ -1342,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];
@@ -1354,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);
@@ -1409,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;
@@ -1435,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;
@@ -1445,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;
@@ -1466,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 abc9e03617..59fb024622 100644
--- a/engines/tony/gfxengine.cpp
+++ b/engines/tony/gfxengine.cpp
@@ -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())
@@ -537,20 +534,17 @@ void RMGfxEngine::disableMouse() {
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';
@@ -566,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());
@@ -597,10 +591,8 @@ 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);
@@ -723,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);
@@ -732,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();
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..b8c106a225 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);
@@ -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)
@@ -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..b77c34be6b 100644
--- a/engines/tony/loc.h
+++ b/engines/tony/loc.h
@@ -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();
};