TONY: Rename variables and functions in utils.h

This commit is contained in:
Strangerke 2012-06-07 08:42:35 +02:00
parent 53bd99ce87
commit f12ab3e521
18 changed files with 481 additions and 481 deletions

View file

@ -574,7 +574,7 @@ DECLARE_CUSTOM_FUNCTION(ChangeLocation)(CORO_PARAM, uint32 nLoc, uint32 tX, uint
}
DECLARE_CUSTOM_FUNCTION(SetLocStartPosition)(CORO_PARAM, uint32 nLoc, uint32 lX, uint32 lY, uint32) {
GLOBALS.StartLocPos[nLoc].Set(lX, lY);
GLOBALS.StartLocPos[nLoc].set(lX, lY);
}
DECLARE_CUSTOM_FUNCTION(SaveTonyPosition)(CORO_PARAM, uint32, uint32, uint32, uint32) {
@ -1223,21 +1223,21 @@ DECLARE_CUSTOM_FUNCTION(ScrollLocation)(CORO_PARAM, uint32 nX, uint32 nY, uint32
if (_ctx->lx > 0) {
_ctx->lx -= (int32)sX;
if (_ctx->lx < 0) _ctx->lx = 0;
_ctx->pt.Offset((int32)sX, 0);
_ctx->pt.offset((int32)sX, 0);
} else if (_ctx->lx < 0) {
_ctx->lx += (int32)sX;
if (_ctx->lx > 0) _ctx->lx = 0;
_ctx->pt.Offset(-(int32)sX, 0);
_ctx->pt.offset(-(int32)sX, 0);
}
if (_ctx->ly > 0) {
_ctx->ly -= sY;
if (_ctx->ly < 0) _ctx->ly = 0;
_ctx->pt.Offset(0, sY);
_ctx->pt.offset(0, sY);
} else if (_ctx->ly < 0) {
_ctx->ly += sY;
if (_ctx->ly > 0) _ctx->ly = 0;
_ctx->pt.Offset(0, -(int32)sY);
_ctx->pt.offset(0, -(int32)sY);
}
CORO_INVOKE_0(GLOBALS.WaitFrame);

View file

@ -100,7 +100,7 @@ bool Debugger::Cmd_Scene(int argc, const char **argv) {
// Get the box areas for the scene, and choose one so as to have a default
// position for Tony that will be in the walkable areas
RMBoxLoc *box = _vm->_theBoxes.getBoxes(sceneNumber);
scenePos.Set(box->boxes[0].hotspot[0].hotx, box->boxes[0].hotspot[0].hoty);
scenePos.set(box->boxes[0].hotspot[0].hotx, box->boxes[0].hotspot[0].hoty);
}
// Set up a process to change the scene

View file

@ -82,8 +82,8 @@ void RMFont::load(const byte *buf, int nChars, int dimx, int dimy, uint32 palRes
void RMFont::load(uint32 resID, int nChars, int dimx, int dimy, uint32 palResID) {
RMRes res(resID);
if ((int)res.Size() < nChars * (dimy * dimx + 8))
nChars = res.Size() / (dimy * dimx + 8);
if ((int)res.size() < nChars * (dimy * dimx + 8))
nChars = res.size() / (dimy * dimx + 8);
load(res, nChars, dimx, dimy, palResID);
}
@ -137,7 +137,7 @@ int RMFont::stringLen(const RMString &text) {
int len, i;
len = 0;
for (i = 0; i < text.Length() - 1; i++)
for (i = 0; i < text.length() - 1; i++)
len += letterLength(text[i], text[i + 1]);
len += letterLength(text[i]);
@ -1968,9 +1968,9 @@ void RMText::draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim) {
CORO_BEGIN_CODE(_ctx);
// Horizontally
if (aHorType == HCENTER)
prim->Dst().TopLeft() -= RMPoint(_dimx / 2, 0);
prim->Dst().topLeft() -= RMPoint(_dimx / 2, 0);
else if (aHorType == HRIGHT)
prim->Dst().TopLeft() -= RMPoint(_dimx, 0);
prim->Dst().topLeft() -= RMPoint(_dimx, 0);
// Vertically
@ -2146,7 +2146,7 @@ void RMTextDialog::draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *p
if (_bShowed) {
if (GLOBALS.bCfgSottotitoli || _bAlwaysDisplay) {
prim->Dst().TopLeft() = dst;
prim->Dst().topLeft() = dst;
CORO_INVOKE_2(RMText::draw, bigBuf, prim);
}
}
@ -2285,7 +2285,7 @@ void RMTextItemName::draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive
return;
// Set the destination coordinates of the mouse
prim->Dst().TopLeft() = _mpos - RMPoint(0, 30);
prim->Dst().topLeft() = _mpos - RMPoint(0, 30);
CORO_INVOKE_2(RMText::draw, bigBuf, prim);
@ -2308,7 +2308,7 @@ bool RMTextItemName::isItemSelected() {
}
bool RMTextItemName::isNormalItemSelected() {
return _item != NULL && _itemName.Length() > 0;
return _item != NULL && _itemName.length() > 0;
}
@ -2321,8 +2321,8 @@ RMDialogChoice::RMDialogChoice() {
RMResRaw dlg2(RES_I_DLGTEXTLINE);
RMRes dlgpal(RES_I_DLGTEXTPAL);
DlgText.init(dlg1, dlg1.Width(), dlg1.Height());
DlgTextLine.init(dlg2, dlg2.Width(), dlg2.Height());
DlgText.init(dlg1, dlg1.width(), dlg1.height());
DlgTextLine.init(dlg2, dlg2.width(), dlg2.height());
DlgText.loadPaletteWA(dlgpal);
DlgTextLine.loadPaletteWA(dlgpal);
@ -2407,18 +2407,18 @@ void RMDialogChoice::prepare(CORO_PARAM) {
addPrim(new RMGfxPrimitive(&DlgTextLine, RMPoint(0, 155 + 83 + 83)));
addPrim(new RMGfxPrimitive(&DlgTextLine, RMPoint(0, 155 + 83 + 83 + 83)));
_ctx->ptPos.Set(20, 90);
_ctx->ptPos.set(20, 90);
for (_ctx->i = 0; _ctx->i < _numChoices; _ctx->i++) {
addPrim(new RMGfxPrimitive(&_drawedStrings[_ctx->i], _ctx->ptPos));
_ptDrawStrings[_ctx->i] = _ctx->ptPos;
_ctx->ptPos.Offset(0, _drawedStrings[_ctx->i].getDimy() + 15);
_ctx->ptPos.offset(0, _drawedStrings[_ctx->i].getDimy() + 15);
}
CORO_INVOKE_0(drawOT);
clearOT();
_ptDrawPos.Set(0, 480 - _ctx->ptPos.y);
_ptDrawPos.set(0, 480 - _ctx->ptPos.y);
CORO_END_CODE;
}
@ -2438,8 +2438,8 @@ void RMDialogChoice::setSelected(CORO_PARAM, int pos) {
if (_curSelection != -1) {
_ctx->box.SetColor(0xCC, 0xCC, 0xFF);
_ctx->rc.TopLeft() = RMPoint(18, _ptDrawStrings[_curSelection].y);
_ctx->rc.BottomRight() = _ctx->rc.TopLeft() + RMPoint(597, _drawedStrings[_curSelection].getDimy());
_ctx->rc.topLeft() = RMPoint(18, _ptDrawStrings[_curSelection].y);
_ctx->rc.bottomRight() = _ctx->rc.topLeft() + RMPoint(597, _drawedStrings[_curSelection].getDimy());
addPrim(new RMGfxPrimitive(&_ctx->box, _ctx->rc));
addPrim(new RMGfxPrimitive(&_drawedStrings[_curSelection], _ptDrawStrings[_curSelection]));
@ -2449,8 +2449,8 @@ void RMDialogChoice::setSelected(CORO_PARAM, int pos) {
if (pos != -1) {
_ctx->box.SetColor(100, 100, 100);
_ctx->rc.TopLeft() = RMPoint(18, _ptDrawStrings[pos].y);
_ctx->rc.BottomRight() = _ctx->rc.TopLeft() + RMPoint(597, _drawedStrings[pos].getDimy());
_ctx->rc.topLeft() = RMPoint(18, _ptDrawStrings[pos].y);
_ctx->rc.bottomRight() = _ctx->rc.topLeft() + RMPoint(597, _drawedStrings[pos].getDimy());
addPrim(new RMGfxPrimitive(&_ctx->box, _ctx->rc));
addPrim(new RMGfxPrimitive(&_drawedStrings[pos], _ptDrawStrings[pos]));
}
@ -2485,7 +2485,7 @@ void RMDialogChoice::show(CORO_PARAM, RMGfxTargetBuffer *bigBuf) {
_ctx->starttime = _vm->getTime();
_ctx->deltay = 480 - _ptDrawPos.y;
_ctx->destpt = _ptDrawPos;
_ptDrawPos.Set(0, 480);
_ptDrawPos.set(0, 480);
if (!_nInList && bigBuf != NULL)
bigBuf->addPrim(new RMGfxPrimitive(this));

View file

@ -124,11 +124,11 @@ void mainSetPalesati(bool bPalesati) {
RMOptionButton::RMOptionButton(uint32 dwRes, RMPoint pt, bool bDoubleState) {
RMResRaw raw(dwRes);
assert(raw.IsValid());
assert(raw.isValid());
_buf = new RMGfxSourceBuffer16(false);
_buf->init(raw, raw.Width(), raw.Height());
_buf->init(raw, raw.width(), raw.height());
_rect.SetRect(pt.x, pt.y, pt.x + raw.Width() - 1, pt.y + raw.Height() - 1);
_rect.setRect(pt.x, pt.y, pt.x + raw.width() - 1, pt.y + raw.height() - 1);
_bActive = false;
_bHasGfx = true;
_bDoubleState = bDoubleState;
@ -149,7 +149,7 @@ RMOptionButton::~RMOptionButton() {
bool RMOptionButton::doFrame(const RMPoint &mousePos, bool bLeftClick, bool bRightClick) {
if (!_bDoubleState) {
if (_rect.PtInRect(mousePos)) {
if (_rect.ptInRect(mousePos)) {
if (!_bActive) {
_bActive = true;
return true;
@ -161,7 +161,7 @@ bool RMOptionButton::doFrame(const RMPoint &mousePos, bool bLeftClick, bool bRig
}
}
} else {
if (bLeftClick && _rect.PtInRect(mousePos)) {
if (bLeftClick && _rect.ptInRect(mousePos)) {
_bActive = !_bActive;
return true;
}
@ -511,12 +511,12 @@ void RMOptionScreen::refreshAll(CORO_PARAM) {
RMString s;
if (_bEditSaveName && _nEditPos == _ctx->i)
s.Format("%02d)%s*", _statePos + _ctx->i, _EditName);
s.format("%02d)%s*", _statePos + _ctx->i, _EditName);
else {
if (_statePos == 0 && _ctx->i == 0)
s.Format("Autosave");
s.format("Autosave");
else
s.Format("%02d)%s", _statePos + _ctx->i, (const char *)_curThumbName[_ctx->i]);
s.format("%02d)%s", _statePos + _ctx->i, (const char *)_curThumbName[_ctx->i]);
}
_ctx->num[_ctx->i] = new RMText;
@ -585,10 +585,10 @@ void RMOptionScreen::initState(CORO_PARAM) {
error("Invalid state");
}
assert(_ctx->raw->IsValid());
assert(_ctx->raw->isValid());
assert(_menu == NULL);
_menu = new RMGfxSourceBuffer16(false);
_menu->init(*_ctx->raw, _ctx->raw->Width(), _ctx->raw->Height());
_menu->init(*_ctx->raw, _ctx->raw->width(), _ctx->raw->height());
delete _ctx->raw;
if (_nState == MENULOAD || _nState == MENUSAVE) {
@ -647,10 +647,10 @@ void RMOptionScreen::initState(CORO_PARAM) {
_ButtonSoundMenu = new RMOptionButton(RMRect(212, 32, 306, 64));
_ctx->raw = new RMResRaw(20021);
assert(_ctx->raw->IsValid());
assert(_ctx->raw->isValid());
assert(_QuitConfirm == NULL);
_QuitConfirm = new RMGfxSourceBuffer16(false);
_QuitConfirm->init(*_ctx->raw, _ctx->raw->Width(), _ctx->raw->Height());
_QuitConfirm->init(*_ctx->raw, _ctx->raw->width(), _ctx->raw->height());
delete _ctx->raw;
assert(_ButtonQuitYes == NULL);
@ -662,10 +662,10 @@ void RMOptionScreen::initState(CORO_PARAM) {
if (_bNoLoadSave) {
_ctx->raw = new RMResRaw(20028);
assert(_ctx->raw->IsValid());
assert(_ctx->raw->isValid());
assert(_HideLoadSave == NULL);
_HideLoadSave = new RMGfxSourceBuffer16(false);
_HideLoadSave->init(*_ctx->raw, _ctx->raw->Width(), _ctx->raw->Height());
_HideLoadSave->init(*_ctx->raw, _ctx->raw->width(), _ctx->raw->height());
delete _ctx->raw;
}
@ -1485,7 +1485,7 @@ void RMPointer::init(void) {
RMResRaw res(RES_P_GO + i);
_pointer[i] = new RMGfxSourceBuffer8RLEByteAA;
_pointer[i]->init(res, res.Width(), res.Height(), false);
_pointer[i]->init(res, res.width(), res.height(), false);
_pointer[i]->loadPaletteWA(RES_P_PAL);
}
@ -1493,17 +1493,17 @@ void RMPointer::init(void) {
RMRes res(RES_P_PAP1 + i);
RMDataStream ds;
ds.OpenBuffer(res);
ds.openBuffer(res);
_specialPointer[i] = new RMItem;
ds >> *_specialPointer[i];
}
//m_hotspot[0].Set(19,5);
_hotspot[0].Set(5, 1);
_hotspot[1].Set(32, 28);
_hotspot[2].Set(45, 23);
_hotspot[3].Set(35, 25);
_hotspot[4].Set(32, 28);
//m_hotspot[0].set(19,5);
_hotspot[0].set(5, 1);
_hotspot[1].set(32, 28);
_hotspot[2].set(45, 23);
_hotspot[3].set(35, 25);
_hotspot[4].set(32, 28);
// Default=GO
_nCurPointer = 0;

View file

@ -39,18 +39,18 @@ namespace Tony {
#define INIT_GFX16_FROMRAW(dwRes, buf16) \
raw = new RMResRaw(dwRes); \
assert(raw->IsValid()); \
assert(raw->isValid()); \
assert((buf16) == NULL); \
(buf16) = new RMGfxSourceBuffer16(false); \
(buf16)->init(*raw,raw->Width(),raw->Height()); \
(buf16)->init(*raw,raw->width(),raw->height()); \
delete raw;
#define INIT_GFX8_FROMRAW(raw, dwRes, buf8) \
raw = new RMResRaw(dwRes); \
assert(raw->IsValid()); \
assert(raw->isValid()); \
assert((buf8) == NULL); \
(buf8) = new RMGfxSourceBuffer8RLEByte(); \
(buf8)->init(*raw, raw->Width(), raw->Height(), true); \
(buf8)->init(*raw, raw->width(), raw->height(), true); \
delete raw;

View file

@ -146,7 +146,7 @@ int RMGfxSourceBuffer::init(const byte *buf, int dimx, int dimy, bool bLoadPalet
void RMGfxSourceBuffer::init(RMDataStream &ds, int dimx, int dimy, bool bLoadPalette) {
create(dimx, dimy, Bpp());
ds.Read(_buf, dimx * dimy * Bpp() / 8);
ds.read(_buf, dimx * dimy * Bpp() / 8);
// Invokes the method for preparing the surface (inherited)
prepareImage();
@ -448,7 +448,7 @@ void RMGfxSourceBufferPal::init(RMDataStream &ds, int dimx, int dimy, bool bLoad
// Load the palette if necessary
if (bLoadPalette) {
byte *suxpal = new byte[256 * 3];
ds.Read(suxpal, 256 * 3);
ds.read(suxpal, 256 * 3);
loadPaletteWA(suxpal);
delete[] suxpal;
}
@ -512,8 +512,8 @@ void RMGfxSourceBuffer8::draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimit
u = prim->Src().x1;
v = prim->Src().y1;
width = prim->Src().Width();
height = prim->Src().Height();
width = prim->Src().width();
height = prim->Src().height();
}
if (!clip2D(dst.x1, dst.y1, u, v, width, height, prim->haveSrc(), &bigBuf))
@ -620,8 +620,8 @@ void RMGfxSourceBuffer8AB::draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrim
u = prim->Src().x1;
v = prim->Src().y1;
width = prim->Src().Width();
height = prim->Src().Height();
width = prim->Src().width();
height = prim->Src().height();
}
if (!clip2D(dst.x1, dst.y1, u, v, width, height, prim->haveSrc(), &bigBuf))
@ -702,7 +702,7 @@ void RMGfxSourceBuffer8RLE::init(RMDataStream &ds, int dimx, int dimy, bool bLoa
ds >> size;
_buf = new byte[size];
ds.Read(_buf, size);
ds.read(_buf, size);
_dimx = dimx;
_dimy = dimy;
@ -1767,7 +1767,7 @@ void RMGfxSourceBuffer8RLEByteAA::init(RMDataStream &ds, int dimx, int dimy, boo
if (!bNeedRLECompress) {
// Load the anti-aliasing mask
_aabuf = new byte[dimx * dimy];
ds.Read(_aabuf, dimx * dimy);
ds.read(_aabuf, dimx * dimy);
}
}
@ -1805,7 +1805,7 @@ void RMGfxSourceBuffer8RLEWordAA::init(RMDataStream &ds, int dimx, int dimy, boo
if (!bNeedRLECompress) {
// Load the anti-aliasing mask
_aabuf = new byte[dimx * dimy];
ds.Read(_aabuf, dimx * dimy);
ds.read(_aabuf, dimx * dimy);
}
}
@ -1839,8 +1839,8 @@ void RMGfxSourceBuffer16::draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimi
if (prim->haveSrc()) {
u = prim->Src().x1;
v = prim->Src().y1;
dimx = prim->Src().Width();
dimy = prim->Src().Height();
dimx = prim->Src().width();
dimy = prim->Src().height();
}
if (prim->haveDst()) {
@ -1932,11 +1932,11 @@ 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 (j = 0; j < rcDst.height(); j++) {
for (i = 0; i < rcDst.width(); i++)
*buf ++ = wFillColor;
buf += bigBuf.getDimx() - rcDst.Width();
buf += bigBuf.getDimx() - rcDst.width();
}
}

View file

@ -110,8 +110,8 @@ public:
RMGfxPrimitive() {
_bFlag = 0;
_task = NULL;
_src.SetEmpty();
_dst.SetEmpty();
_src.setEmpty();
_dst.setEmpty();
}
RMGfxPrimitive(RMGfxTask *task) {
@ -124,41 +124,41 @@ public:
_src = src;
_dst = dst;
_bFlag = 0;
_bStretch = (src.Width() != dst.Width() || src.Height() != dst.Height());
_bStretch = (src.width() != dst.width() || src.height() != dst.height());
}
RMGfxPrimitive(RMGfxTask *task, const RMPoint &src, RMRect &dst) {
_task = task;
_src.TopLeft() = src;
_src.topLeft() = src;
_dst = dst;
_bFlag = 0;
}
RMGfxPrimitive(RMGfxTask *task, const RMPoint &src, RMPoint &dst) {
_task = task;
_src.TopLeft() = src;
_dst.TopLeft() = dst;
_src.topLeft() = src;
_dst.topLeft() = dst;
_bFlag = 0;
}
RMGfxPrimitive(RMGfxTask *task, const RMRect &src, RMPoint &dst) {
_task = task;
_src = src;
_dst.TopLeft() = dst;
_dst.topLeft() = dst;
_bFlag = 0;
}
RMGfxPrimitive(RMGfxTask *task, const RMRect &dst) {
_task = task;
_dst = dst;
_src.SetEmpty();
_src.setEmpty();
_bFlag = 0;
}
RMGfxPrimitive(RMGfxTask *task, const RMPoint &dst) {
_task = task;
_dst.TopLeft() = dst;
_src.SetEmpty();
_dst.topLeft() = dst;
_src.setEmpty();
_bFlag = 0;
}
@ -174,27 +174,27 @@ public:
_src = src;
}
void setSrc(const RMPoint &src) {
_src.TopLeft() = src;
_src.topLeft() = src;
}
void setDst(const RMRect &dst) {
_dst = dst;
}
void setDst(const RMPoint &dst) {
_dst.TopLeft() = dst;
_dst.topLeft() = dst;
}
void setStrecth(bool bStretch) {
_bStretch = bStretch;
}
bool haveDst() {
return !_dst.IsEmpty();
return !_dst.isEmpty();
}
RMRect &Dst() {
return _dst;
}
bool haveSrc() {
return !_src.IsEmpty();
return !_src.isEmpty();
}
RMRect &Src() {
return _src;

View file

@ -412,7 +412,7 @@ uint32 RMGfxEngine::loadLocation(int nLoc, RMPoint ptTonyStart, RMPoint start) {
for (i = 0; i < 5; i++) {
// Try the loading of the location
RMRes res(_nCurLoc);
if (!res.IsValid())
if (!res.isValid())
continue;
_loc.load(res);

View file

@ -34,7 +34,7 @@ namespace Tony {
RMInput::RMInput() {
// Setup mouse fields
_clampMouse = false;
_mousePos.Set(0, 0);
_mousePos.set(0, 0);
_leftButton = _rightButton = false;
_leftClickMouse = _leftReleaseMouse = false;
_rightClickMouse = _rightReleaseMouse = false;
@ -60,7 +60,7 @@ void RMInput::poll(void) {
case Common::EVENT_LBUTTONUP:
case Common::EVENT_RBUTTONDOWN:
case Common::EVENT_RBUTTONUP:
_mousePos.Set(_event.mouse.x, _event.mouse.y);
_mousePos.set(_event.mouse.x, _event.mouse.y);
if (_event.type == Common::EVENT_LBUTTONDOWN) {
_leftButton = true;

View file

@ -97,13 +97,13 @@ void RMInventory::init(void) {
RMRes res(curres);
RMDataStream ds;
assert(res.IsValid());
assert(res.isValid());
// Initialise the MPAL inventory item by reading it in.
_items[i].icon.setInitCurPattern(false);
ds.OpenBuffer(res);
ds.openBuffer(res);
ds >> _items[i].icon;
ds.Close();
ds.close();
// Puts in the default pattern 1
_items[i].pointer = NULL;
@ -120,9 +120,9 @@ void RMInventory::init(void) {
for (j = 0; j < _items[i].icon.numPattern(); j++) {
RMResRaw raw(curres);
assert(raw.IsValid());
assert(raw.isValid());
_items[i].pointer[j].init((const byte *)raw, raw.Width(), raw.Height(), true);
_items[i].pointer[j].init((const byte *)raw, raw.width(), raw.height(), true);
curres++;
}
}
@ -133,11 +133,11 @@ void RMInventory::init(void) {
// Download interface
RMDataStream ds;
RMRes res(RES_I_MINIINTER);
assert(res.IsValid());
ds.OpenBuffer(res);
assert(res.isValid());
ds.openBuffer(res);
ds >> miniInterface;
miniInterface.setPattern(1);
ds.Close();
ds.close();
// Create the text for hints on the mini interface
_hints[0].setAlignType(RMText::HCENTER, RMText::VTOP);
@ -202,11 +202,11 @@ void RMInventory::draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *pr
if (_state == SELECTING) {
if (!GLOBALS.bCfgInvUp) {
_ctx->pos.Set((_nSelectObj + 1) * 64 - 20, RM_SY - 113);
_ctx->pos2.Set((_nSelectObj + 1) * 64 + 34, RM_SY - 150);
_ctx->pos.set((_nSelectObj + 1) * 64 - 20, RM_SY - 113);
_ctx->pos2.set((_nSelectObj + 1) * 64 + 34, RM_SY - 150);
} else {
_ctx->pos.Set((_nSelectObj + 1) * 64 - 20, 72 - 4); // The brown part is at the top :(
_ctx->pos2.Set((_nSelectObj + 1) * 64 + 34, 119 - 4);
_ctx->pos.set((_nSelectObj + 1) * 64 - 20, 72 - 4); // The brown part is at the top :(
_ctx->pos2.set((_nSelectObj + 1) * 64 + 34, 119 - 4);
}
_ctx->p = new RMGfxPrimitive(prim->_task, _ctx->pos);
@ -774,7 +774,7 @@ int RMInterface::onWhichBox(RMPoint pt) {
// Find the verb
for (i = 0; i < max; i++)
if (_hotbbox[i].PtInRect(pt))
if (_hotbbox[i].ptInRect(pt))
return i;
// Found no verb
@ -788,13 +788,13 @@ void RMInterface::draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *pr
CORO_BEGIN_CODE(_ctx);
prim->Dst().TopLeft() = _openStart;
prim->Dst().topLeft() = _openStart;
CORO_INVOKE_2(RMGfxSourceBuffer8RLEByte::draw, bigBuf, prim);
// Check if there is a draw hot zone
_ctx->h = onWhichBox(_mpos);
if (_ctx->h != -1) {
prim->Dst().TopLeft() = _openStart;
prim->Dst().topLeft() = _openStart;
CORO_INVOKE_2(_hotzone[_ctx->h].draw, bigBuf, prim);
if (_lastHotZone != _ctx->h) {
@ -803,7 +803,7 @@ void RMInterface::draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *pr
}
if (GLOBALS.bCfgInterTips) {
prim->Dst().TopLeft() = _openStart + RMPoint(70, 177);
prim->Dst().topLeft() = _openStart + RMPoint(70, 177);
CORO_INVOKE_2(_hints[_ctx->h].draw, bigBuf, prim);
}
} else
@ -896,21 +896,21 @@ void RMInterface::init(void) {
setPriority(191);
RMGfxSourceBuffer::init(inter, inter.Width(), inter.Height());
RMGfxSourceBuffer::init(inter, inter.width(), inter.height());
loadPaletteWA(RES_I_INTERPAL);
for (i = 0; i < 5; i++) {
RMResRaw part(RES_I_INTERP1 + i);
_hotzone[i].init(part, part.Width(), part.Height());
_hotzone[i].init(part, part.width(), part.height());
_hotzone[i].loadPaletteWA(pal);
}
_hotbbox[0].SetRect(126, 123, 159, 208); // Take
_hotbbox[1].SetRect(90, 130, 125, 186); // About
_hotbbox[2].SetRect(110, 60, 152, 125);
_hotbbox[3].SetRect(56, 51, 93, 99);
_hotbbox[4].SetRect(51, 105, 82, 172);
_hotbbox[0].setRect(126, 123, 159, 208); // Take
_hotbbox[1].setRect(90, 130, 125, 186); // About
_hotbbox[2].setRect(110, 60, 152, 125);
_hotbbox[3].setRect(56, 51, 93, 99);
_hotbbox[4].setRect(51, 105, 82, 172);
_hints[0].setAlignType(RMText::HRIGHT, RMText::VTOP);
_hints[1].setAlignType(RMText::HRIGHT, RMText::VTOP);

View file

@ -50,7 +50,7 @@ using namespace ::Tony::MPAL;
* @returns Reference to the data stream
*/
RMDataStream &operator>>(RMDataStream &ds, RMPalette &pal) {
ds.Read(pal._data, 1024);
ds.read(pal._data, 1024);
return ds;
}
@ -129,7 +129,7 @@ void RMPattern::readFromStream(RMDataStream &ds, bool bLOX) {
// Create and read the slots
_slots = new RMSlot[_nSlots];
for (i = 0; i < _nSlots && !ds.IsError(); i++) {
for (i = 0; i < _nSlots && !ds.isError(); i++) {
if (bLOX)
_slots[i].readFromStream(ds, true);
else
@ -319,20 +319,20 @@ void RMSprite::init(RMGfxSourceBuffer *buf) {
}
void RMSprite::LOXGetSizeFromStream(RMDataStream &ds, int *dimx, int *dimy) {
int pos = ds.Pos();
int pos = ds.pos();
ds >> *dimx >> *dimy;
ds.Seek(pos, ds.START);
ds.seek(pos, ds.START);
}
void RMSprite::getSizeFromStream(RMDataStream &ds, int *dimx, int *dimy) {
int pos = ds.Pos();
int pos = ds.pos();
ds >> _name;
ds >> *dimx >> *dimy;
ds.Seek(pos, ds.START);
ds.seek(pos, ds.START);
}
void RMSprite::readFromStream(RMDataStream &ds, bool bLOX) {
@ -404,7 +404,7 @@ void RMSfx::readFromStream(RMDataStream &ds, bool bLOX) {
ds >> size;
// Upload the sound effect identifier from the buffer
ds.Read(id, 4);
ds.read(id, 4);
// Ensure it's a RIFF
assert(id[0] == 'R' && id[1] == 'I' && id[2] == 'F' && id[3] == 'F');
@ -414,7 +414,7 @@ void RMSfx::readFromStream(RMDataStream &ds, bool bLOX) {
// Read the raw WAV data
raw = new byte[size];
ds.Read(raw, size);
ds.read(raw, size);
// Create the sound effect
_fx = _vm->createSFX(raw);
@ -522,18 +522,18 @@ bool RMItem::isIn(const RMPoint &pt, int *size) {
return false;
// Search for the right bounding box to use - use the sprite's if it has one, otherwise use the generic one
if (_nCurPattern != 0 && !_sprites[_nCurSprite]._rcBox.IsEmpty())
if (_nCurPattern != 0 && !_sprites[_nCurSprite]._rcBox.isEmpty())
rc = _sprites[_nCurSprite]._rcBox + calculatePos();
else if (!_rcBox.IsEmpty())
else if (!_rcBox.isEmpty())
rc = _rcBox;
// If no box, return immediately
else
return false;
if (size != NULL)
*size = rc.Size();
*size = rc.size();
return rc.PtInRect(pt + _curScroll);
return rc.ptInRect(pt + _curScroll);
}
void RMItem::readFromStream(RMDataStream &ds, bool bLOX) {
@ -592,8 +592,8 @@ void RMItem::readFromStream(RMDataStream &ds, bool bLOX) {
_patterns = new RMPattern[_nPatterns + 1];
// Read in class data
if (!ds.IsError())
for (i = 0; i < _nSprites && !ds.IsError(); i++) {
if (!ds.isError())
for (i = 0; i < _nSprites && !ds.isError(); i++) {
// Download the sprites
if (bLOX) {
_sprites[i].LOXGetSizeFromStream(ds, &dimx, &dimy);
@ -609,8 +609,8 @@ void RMItem::readFromStream(RMDataStream &ds, bool bLOX) {
_sprites[i].setPalette(_pal._data);
}
if (!ds.IsError())
for (i = 0; i < _nSfx && !ds.IsError(); i++) {
if (!ds.isError())
for (i = 0; i < _nSfx && !ds.isError(); i++) {
if (bLOX)
_sfx[i].readFromStream(ds, true);
else
@ -618,8 +618,8 @@ void RMItem::readFromStream(RMDataStream &ds, bool bLOX) {
}
// Read the pattern from pattern 1
if (!ds.IsError())
for (i = 1; i <= _nPatterns && !ds.IsError(); i++) {
if (!ds.isError())
for (i = 1; i <= _nPatterns && !ds.isError(); i++) {
if (bLOX)
_patterns[i].readFromStream(ds, true);
else
@ -695,11 +695,11 @@ void RMItem::draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim) {
prim->setFlag(_bCurFlag);
// Offset direction for scrolling
prim->Dst().Offset(-_curScroll);
prim->Dst().offset(-_curScroll);
// We must offset the cordinates of the item inside the primitive
// It is estimated as nonno + (babbo + figlio)
prim->Dst().Offset(calculatePos());
prim->Dst().offset(calculatePos());
// No stretching, please
prim->setStrecth(false);
@ -781,7 +781,7 @@ RMItem::RMItem() {
_patterns = NULL;
_sprites = NULL;
_sfx = NULL;
_curScroll.Set(0, 0);
_curScroll.set(0, 0);
_bInitCurPattern = true;
_nCurPattern = 0;
_z = 0;
@ -904,9 +904,9 @@ void RMWipe::initFade(int type) {
RMRes res(RES_W_CERCHIO);
RMDataStream ds;
ds.OpenBuffer(res);
ds.openBuffer(res);
ds >> _wip0r;
ds.Close();
ds.close();
_wip0r.setPattern(1);
@ -1688,7 +1688,7 @@ RMCharacter::RMCharacter() {
bDrawNow = false;
bNeedToStop = false;
_pos.Set(0, 0);
_pos.set(0, 0);
}
RMCharacter::~RMCharacter() {
@ -1824,14 +1824,14 @@ void RMGameBoxes::init(void) {
for (i = 1; i <= _nLocBoxes; i++) {
RMRes res(10000 + i);
ds.OpenBuffer(res);
ds.openBuffer(res);
_allBoxes[i] = new RMBoxLoc();
ds >> *_allBoxes[i];
_allBoxes[i]->recalcAllAdj();
ds.Close();
ds.close();
}
}
@ -1985,9 +1985,9 @@ bool RMLocation::load(Common::File &file) {
RMFileStreamSlow fs;
fs.OpenFile(file);
fs.openFile(file);
bRet = load(fs);
fs.Close();
fs.close();
return bRet;
}
@ -1997,9 +1997,9 @@ bool RMLocation::load(const byte *buf) {
RMDataStream ds;
bool bRet;
ds.OpenBuffer(buf);
ds.openBuffer(buf);
bRet = load(ds);
ds.Close();
ds.close();
return bRet;
}
@ -2045,7 +2045,7 @@ bool RMLocation::load(RMDataStream &ds) {
// Location dimensions
ds >> dimx >> dimy;
_curScroll.Set(0, 0);
_curScroll.set(0, 0);
// Read the colour mode
ds >> cm;
@ -2081,11 +2081,11 @@ bool RMLocation::load(RMDataStream &ds) {
_vm->freezeTime();
for (i = 0; i < _nItems && !ds.IsError(); i++)
for (i = 0; i < _nItems && !ds.isError(); i++)
ds >> _items[i];
_vm->unfreezeTime();
return ds.IsError();
return ds.isError();
}
@ -2107,7 +2107,7 @@ bool RMLocation::loadLOX(RMDataStream &ds) {
// Dimensions
ds >> dimx >> dimy;
_curScroll.Set(0, 0);
_curScroll.set(0, 0);
// It's always 65K (16-bit) mode
_cmode = CM_65K;
@ -2123,10 +2123,10 @@ bool RMLocation::loadLOX(RMDataStream &ds) {
if (_nItems > 0)
_items = new RMItem[_nItems];
for (i = 0; i < _nItems && !ds.IsError(); i++)
for (i = 0; i < _nItems && !ds.isError(); i++)
_items[i].readFromStream(ds, true);
return ds.IsError();
return ds.isError();
}

View file

@ -37,42 +37,42 @@ namespace MPAL {
* @param resId MPAL resource to open
*/
RMRes::RMRes(uint32 resID) {
m_h = _vm->_resUpdate.QueryResource(resID);
if (m_h == NULL)
m_h = mpalQueryResource(resID);
if (m_h != NULL)
m_buf = (byte *)GlobalLock(m_h);
_h = _vm->_resUpdate.queryResource(resID);
if (_h == NULL)
_h = mpalQueryResource(resID);
if (_h != NULL)
_buf = (byte *)GlobalLock(_h);
}
/**
* Destructor
*/
RMRes::~RMRes() {
if (m_h != NULL) {
GlobalUnlock(m_h);
GlobalFree(m_h);
if (_h != NULL) {
GlobalUnlock(_h);
GlobalFree(_h);
}
}
/**
* Returns a pointer to the resource
*/
const byte *RMRes::DataPointer() {
return m_buf;
const byte *RMRes::dataPointer() {
return _buf;
}
/**
* Returns a pointer to the resource
*/
RMRes::operator const byte *() {
return DataPointer();
return dataPointer();
}
/**
* Returns the size of the resource
*/
unsigned int RMRes::Size() {
return GlobalSize(m_h);
unsigned int RMRes::size() {
return GlobalSize(_h);
}
/****************************************************************************\
@ -86,19 +86,19 @@ RMResRaw::~RMResRaw() {
}
const byte *RMResRaw::DataPointer() {
return m_buf + 8;
return _buf + 8;
}
RMResRaw::operator const byte *() {
return DataPointer();
}
int RMResRaw::Width() {
return READ_LE_UINT16(m_buf + 4);
int RMResRaw::width() {
return READ_LE_UINT16(_buf + 4);
}
int RMResRaw::Height() {
return READ_LE_UINT16(m_buf + 6);
int RMResRaw::height() {
return READ_LE_UINT16(_buf + 6);
}
} // end of namespace MPAL

View file

@ -33,17 +33,17 @@ namespace MPAL {
class RMRes {
protected:
HGLOBAL m_h;
byte *m_buf;
HGLOBAL _h;
byte *_buf;
public:
RMRes(uint32 resID);
virtual ~RMRes();
// Attributes
unsigned int Size();
const byte *DataPointer();
bool IsValid() { return m_h != NULL; }
unsigned int size();
const byte *dataPointer();
bool isValid() { return _h != NULL; }
// Casting for access to data
operator const byte*();
@ -57,8 +57,8 @@ public:
const byte *DataPointer();
operator const byte*();
int Width();
int Height();
int width();
int height();
};
} // end of namespace MPAL

View file

@ -127,7 +127,7 @@ Common::ErrorCode TonyEngine::init() {
return Common::kUnknownError;
// Initialise the update resources
_resUpdate.Init("ROASTED.MPU");
_resUpdate.init("ROASTED.MPU");
// Initialise the music
initMusic();

View file

@ -105,18 +105,18 @@ void RMTony::init(void) {
_bIsStaticTalk = false;
// Opens the buffer
ds.OpenBuffer(tony);
ds.openBuffer(tony);
// Reads his details from the stream
readFromStream(ds, true);
// Closes the buffer
ds.Close();
ds.close();
// Reads Tony's body
ds.OpenBuffer(body);
ds.openBuffer(body);
_body.readFromStream(ds, true);
ds.Close();
ds.close();
_body.setPattern(0);
_nTimeLastStep = _vm->getTime();
@ -180,28 +180,28 @@ void RMTony::draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim) {
// Call the Draw() of the parent class if Tony is visible
if (_bShow && bDrawNow) {
if (_bCorpoDavanti) {
prim->Dst().SetEmpty();
prim->Dst().Offset(-44, -134);
prim->Dst().setEmpty();
prim->Dst().offset(-44, -134);
if (_bPastorella)
prim->Dst().Offset(1, 4);
prim->Dst().offset(1, 4);
CORO_INVOKE_2(RMCharacter::draw, bigBuf, prim);
}
if (_bIsTalking || _bIsStaticTalk) {
// Offest direction from scrolling
prim->Dst().SetEmpty();
prim->Dst().Offset(-_curScroll);
prim->Dst().Offset(_pos);
prim->Dst().Offset(-44, -134);
prim->Dst().setEmpty();
prim->Dst().offset(-_curScroll);
prim->Dst().offset(_pos);
prim->Dst().offset(-44, -134);
prim->Dst() += _nBodyOffset;
CORO_INVOKE_2(_body.draw, bigBuf, prim);
}
if (!_bCorpoDavanti) {
prim->Dst().SetEmpty();
prim->Dst().Offset(-44, -134);
prim->Dst().setEmpty();
prim->Dst().offset(-44, -134);
if (_bPastorella)
prim->Dst().Offset(0, 3);
prim->Dst().offset(0, 3);
CORO_INVOKE_2(RMCharacter::draw, bigBuf, prim);
}
}
@ -630,25 +630,25 @@ bool RMTony::startTalkCalculate(TALKTYPE nTalkType, int &headStartPat, int &body
case DOWN:
headLoopPat = PAT_TALK_DOWN;
bodyLoopPat = BPAT_STANDDOWN;
_nBodyOffset.Set(4, 53);
_nBodyOffset.set(4, 53);
break;
case LEFT:
headLoopPat = PAT_TALK_LEFT;
bodyLoopPat = BPAT_STANDLEFT;
_nBodyOffset.Set(6, 56);
_nBodyOffset.set(6, 56);
break;
case RIGHT:
headLoopPat = PAT_TALK_RIGHT;
bodyLoopPat = BPAT_STANDRIGHT;
_nBodyOffset.Set(6, 56);
_nBodyOffset.set(6, 56);
break;
case UP:
headLoopPat = PAT_TALK_UP;
bodyLoopPat = BPAT_STANDUP;
_nBodyOffset.Set(6, 53);
_nBodyOffset.set(6, 53);
break;
}
break;
@ -657,7 +657,7 @@ bool RMTony::startTalkCalculate(TALKTYPE nTalkType, int &headStartPat, int &body
_bCorpoDavanti = false;
switch (_TalkDirection) {
case UP:
_nBodyOffset.Set(2, 42);
_nBodyOffset.set(2, 42);
headStartPat = PAT_TESTA_UP;
bodyStartPat = BPAT_FIANCHIUP_START;
headLoopPat = PAT_TALK_UP;
@ -665,7 +665,7 @@ bool RMTony::startTalkCalculate(TALKTYPE nTalkType, int &headStartPat, int &body
break;
case DOWN:
_nBodyOffset.Set(2, 48);
_nBodyOffset.set(2, 48);
headStartPat = PAT_TESTA_DOWN;
bodyStartPat = BPAT_FIANCHIDOWN_START;
headLoopPat = PAT_TALK_DOWN;
@ -673,7 +673,7 @@ bool RMTony::startTalkCalculate(TALKTYPE nTalkType, int &headStartPat, int &body
break;
case LEFT:
_nBodyOffset.Set(-3, 53);
_nBodyOffset.set(-3, 53);
headStartPat = PAT_TESTA_LEFT;
bodyStartPat = BPAT_FIANCHILEFT_START;
headLoopPat = PAT_TALK_LEFT;
@ -681,7 +681,7 @@ bool RMTony::startTalkCalculate(TALKTYPE nTalkType, int &headStartPat, int &body
break;
case RIGHT:
_nBodyOffset.Set(2, 53);
_nBodyOffset.set(2, 53);
headStartPat = PAT_TESTA_RIGHT;
bodyStartPat = BPAT_FIANCHIRIGHT_START;
headLoopPat = PAT_TALK_RIGHT;
@ -692,7 +692,7 @@ bool RMTony::startTalkCalculate(TALKTYPE nTalkType, int &headStartPat, int &body
case TALK_CANTA:
_nBodyOffset.Set(-10, 25);
_nBodyOffset.set(-10, 25);
headStartPat = PAT_TESTA_LEFT;
bodyStartPat = BPAT_CANTALEFT_START;
headLoopPat = PAT_TALK_LEFT;
@ -705,7 +705,7 @@ bool RMTony::startTalkCalculate(TALKTYPE nTalkType, int &headStartPat, int &body
case UP:
case DOWN:
case LEFT:
_nBodyOffset.Set(6, 56);
_nBodyOffset.set(6, 56);
headStartPat = PAT_RIDELEFT_START;
bodyStartPat = BPAT_STANDLEFT;
headLoopPat = PAT_RIDELEFT_LOOP;
@ -713,7 +713,7 @@ bool RMTony::startTalkCalculate(TALKTYPE nTalkType, int &headStartPat, int &body
break;
case RIGHT:
_nBodyOffset.Set(6, 56);
_nBodyOffset.set(6, 56);
headStartPat = PAT_RIDERIGHT_START;
bodyStartPat = BPAT_STANDRIGHT;
headLoopPat = PAT_RIDERIGHT_LOOP;
@ -728,14 +728,14 @@ bool RMTony::startTalkCalculate(TALKTYPE nTalkType, int &headStartPat, int &body
case UP:
case DOWN:
case LEFT:
_nBodyOffset.Set(6, 56);
_nBodyOffset.set(6, 56);
headStartPat = PAT_RIDELEFT_START;
bodyStartPat = BPAT_STANDLEFT;
headLoopPat = PAT_RIDELEFT_LOOP;
break;
case RIGHT:
_nBodyOffset.Set(6, 56);
_nBodyOffset.set(6, 56);
headStartPat = PAT_RIDERIGHT_START;
bodyStartPat = BPAT_STANDRIGHT;
headLoopPat = PAT_RIDERIGHT_LOOP;
@ -750,13 +750,13 @@ bool RMTony::startTalkCalculate(TALKTYPE nTalkType, int &headStartPat, int &body
case UP:
case DOWN:
case LEFT:
_nBodyOffset.Set(-4, 40);
_nBodyOffset.set(-4, 40);
headLoopPat = PAT_TALK_LEFT;
bodyLoopPat = BPAT_SIINDICALEFT;
break;
case RIGHT:
_nBodyOffset.Set(5, 40);
_nBodyOffset.set(5, 40);
headLoopPat = PAT_TALK_RIGHT;
bodyLoopPat = BPAT_SIINDICARIGHT;
break;
@ -766,7 +766,7 @@ bool RMTony::startTalkCalculate(TALKTYPE nTalkType, int &headStartPat, int &body
case TALK_SPAVENTATO:
switch (_TalkDirection) {
case UP:
_nBodyOffset.Set(-4, -11);
_nBodyOffset.set(-4, -11);
headStartPat = PAT_TESTA_UP;
bodyStartPat = BPAT_SPAVENTOUP_START;
headLoopPat = PAT_TALK_UP;
@ -774,7 +774,7 @@ bool RMTony::startTalkCalculate(TALKTYPE nTalkType, int &headStartPat, int &body
break;
case DOWN:
_nBodyOffset.Set(-5, 45);
_nBodyOffset.set(-5, 45);
headStartPat = PAT_SPAVENTODOWN_START;
bodyStartPat = BPAT_SPAVENTODOWN_START;
headLoopPat = PAT_SPAVENTODOWN_LOOP;
@ -782,7 +782,7 @@ bool RMTony::startTalkCalculate(TALKTYPE nTalkType, int &headStartPat, int &body
break;
case RIGHT:
_nBodyOffset.Set(-4, 41);
_nBodyOffset.set(-4, 41);
headStartPat = PAT_SPAVENTORIGHT_START;
bodyStartPat = BPAT_SPAVENTORIGHT_START;
headLoopPat = PAT_SPAVENTORIGHT_LOOP;
@ -790,7 +790,7 @@ bool RMTony::startTalkCalculate(TALKTYPE nTalkType, int &headStartPat, int &body
break;
case LEFT:
_nBodyOffset.Set(-10, 41);
_nBodyOffset.set(-10, 41);
headStartPat = PAT_SPAVENTOLEFT_START;
bodyStartPat = BPAT_SPAVENTOLEFT_START;
headLoopPat = PAT_SPAVENTOLEFT_LOOP;
@ -805,7 +805,7 @@ bool RMTony::startTalkCalculate(TALKTYPE nTalkType, int &headStartPat, int &body
case UP:
bodyStartPat = BPAT_STANDUP;
bodyLoopPat = BPAT_STANDUP;
_nBodyOffset.Set(6, 53);
_nBodyOffset.set(6, 53);
headStartPat = PAT_TESTA_UP;
headLoopPat = PAT_TALK_UP;
@ -814,7 +814,7 @@ bool RMTony::startTalkCalculate(TALKTYPE nTalkType, int &headStartPat, int &body
case DOWN:
bodyStartPat = BPAT_STANDDOWN;
bodyLoopPat = BPAT_STANDDOWN;
_nBodyOffset.Set(4, 53);
_nBodyOffset.set(4, 53);
headStartPat = PAT_SPAVENTODOWN_START;
headLoopPat = PAT_SPAVENTODOWN_LOOP;
@ -823,7 +823,7 @@ bool RMTony::startTalkCalculate(TALKTYPE nTalkType, int &headStartPat, int &body
case RIGHT:
bodyStartPat = BPAT_STANDRIGHT;
bodyLoopPat = BPAT_STANDRIGHT;
_nBodyOffset.Set(6, 56);
_nBodyOffset.set(6, 56);
headStartPat = PAT_SPAVENTORIGHT_START;
headLoopPat = PAT_SPAVENTORIGHT_LOOP;
@ -832,7 +832,7 @@ bool RMTony::startTalkCalculate(TALKTYPE nTalkType, int &headStartPat, int &body
case LEFT:
bodyStartPat = BPAT_STANDLEFT;
bodyLoopPat = BPAT_STANDLEFT;
_nBodyOffset.Set(6, 56);
_nBodyOffset.set(6, 56);
headStartPat = PAT_SPAVENTOLEFT_START;
headLoopPat = PAT_SPAVENTOLEFT_LOOP;
@ -841,27 +841,27 @@ bool RMTony::startTalkCalculate(TALKTYPE nTalkType, int &headStartPat, int &body
break;
case TALK_CONBICCHIERE:
_nBodyOffset.Set(4, 53);
_nBodyOffset.set(4, 53);
headLoopPat = PAT_TALK_DOWN;
bodyLoopPat = BPAT_BICCHIERE;
break;
case TALK_CONVERME:
_nBodyOffset.Set(9, 56);
_nBodyOffset.set(9, 56);
headLoopPat = PAT_TALK_RIGHT;
bodyLoopPat = BPAT_VERME;
break;
case TALK_CONMARTELLO:
_nBodyOffset.Set(6, 56);
_nBodyOffset.set(6, 56);
headLoopPat = PAT_TALK_LEFT;
bodyLoopPat = BPAT_MARTELLO;
break;
case TALK_CONCORDA:
_nBodyOffset.Set(-3, 38);
_nBodyOffset.set(-3, 38);
headLoopPat = PAT_TALK_RIGHT;
bodyLoopPat = BPAT_CORDA;
break;
case TALK_CONSEGRETARIA:
_nBodyOffset.Set(-17, 12);
_nBodyOffset.set(-17, 12);
headLoopPat = PAT_TALK_RIGHT;
bodyLoopPat = BPAT_CONSEGRETARIA;
break;
@ -870,7 +870,7 @@ bool RMTony::startTalkCalculate(TALKTYPE nTalkType, int &headStartPat, int &body
switch (_TalkDirection) {
case LEFT:
case UP:
_nBodyOffset.Set(-21, -5);
_nBodyOffset.set(-21, -5);
bodyStartPat = BPAT_CONCONIGLIOLEFT_START;
headLoopPat = PAT_TALK_LEFT;
bodyLoopPat = BPAT_CONCONIGLIOLEFT_LOOP;
@ -878,7 +878,7 @@ bool RMTony::startTalkCalculate(TALKTYPE nTalkType, int &headStartPat, int &body
case DOWN:
case RIGHT:
_nBodyOffset.Set(-4, -5);
_nBodyOffset.set(-4, -5);
bodyStartPat = BPAT_CONCONIGLIORIGHT_START;
headLoopPat = PAT_TALK_RIGHT;
bodyLoopPat = BPAT_CONCONIGLIORIGHT_LOOP;
@ -890,7 +890,7 @@ bool RMTony::startTalkCalculate(TALKTYPE nTalkType, int &headStartPat, int &body
switch (_TalkDirection) {
case LEFT:
case UP:
_nBodyOffset.Set(-61, -7);
_nBodyOffset.set(-61, -7);
bodyStartPat = BPAT_CONRICETTALEFT_START;
headLoopPat = PAT_TALK_LEFT;
bodyLoopPat = BPAT_CONRICETTALEFT_LOOP;
@ -898,7 +898,7 @@ bool RMTony::startTalkCalculate(TALKTYPE nTalkType, int &headStartPat, int &body
case DOWN:
case RIGHT:
_nBodyOffset.Set(-5, -7);
_nBodyOffset.set(-5, -7);
bodyStartPat = BPAT_CONRICETTARIGHT_START;
headLoopPat = PAT_TALK_RIGHT;
bodyLoopPat = BPAT_CONRICETTARIGHT_LOOP;
@ -910,7 +910,7 @@ bool RMTony::startTalkCalculate(TALKTYPE nTalkType, int &headStartPat, int &body
switch (_TalkDirection) {
case LEFT:
case UP:
_nBodyOffset.Set(-34, -2);
_nBodyOffset.set(-34, -2);
bodyStartPat = BPAT_CONCARTELEFT_START;
headLoopPat = PAT_TALK_LEFT;
bodyLoopPat = BPAT_CONCARTELEFT_LOOP;
@ -918,7 +918,7 @@ bool RMTony::startTalkCalculate(TALKTYPE nTalkType, int &headStartPat, int &body
case DOWN:
case RIGHT:
_nBodyOffset.Set(-4, -2);
_nBodyOffset.set(-4, -2);
bodyStartPat = BPAT_CONCARTERIGHT_START;
headLoopPat = PAT_TALK_RIGHT;
bodyLoopPat = BPAT_CONCARTERIGHT_LOOP;
@ -930,7 +930,7 @@ bool RMTony::startTalkCalculate(TALKTYPE nTalkType, int &headStartPat, int &body
switch (_TalkDirection) {
case LEFT:
case UP:
_nBodyOffset.Set(-35, 2);
_nBodyOffset.set(-35, 2);
bodyStartPat = BPAT_CONPUPAZZOLEFT_START;
headLoopPat = PAT_TALK_LEFT;
bodyLoopPat = BPAT_CONPUPAZZOLEFT_LOOP;
@ -938,7 +938,7 @@ bool RMTony::startTalkCalculate(TALKTYPE nTalkType, int &headStartPat, int &body
case DOWN:
case RIGHT:
_nBodyOffset.Set(-14, 2);
_nBodyOffset.set(-14, 2);
bodyStartPat = BPAT_CONPUPAZZORIGHT_START;
headLoopPat = PAT_TALK_RIGHT;
bodyLoopPat = BPAT_CONPUPAZZORIGHT_LOOP;
@ -972,14 +972,14 @@ bool RMTony::startTalkCalculate(TALKTYPE nTalkType, int &headStartPat, int &body
case UP:
headLoopPat = PAT_TALKBARBA_LEFT;
bodyLoopPat = BPAT_STANDLEFT;
_nBodyOffset.Set(6, 56);
_nBodyOffset.set(6, 56);
break;
case DOWN:
case RIGHT:
headLoopPat = PAT_TALKBARBA_RIGHT;
bodyLoopPat = BPAT_STANDRIGHT;
_nBodyOffset.Set(6, 56);
_nBodyOffset.set(6, 56);
break;
}
break;
@ -988,7 +988,7 @@ bool RMTony::startTalkCalculate(TALKTYPE nTalkType, int &headStartPat, int &body
switch (_TalkDirection) {
case LEFT:
case UP:
_nBodyOffset.Set(6, 56);
_nBodyOffset.set(6, 56);
headStartPat = PAT_SCHIFATOLEFT_START;
bodyStartPat = BPAT_STANDLEFT;
headLoopPat = PAT_SCHIFATOLEFT_LOOP;
@ -996,7 +996,7 @@ bool RMTony::startTalkCalculate(TALKTYPE nTalkType, int &headStartPat, int &body
case DOWN:
case RIGHT:
_nBodyOffset.Set(6, 56);
_nBodyOffset.set(6, 56);
headStartPat = PAT_SCHIFATORIGHT_START;
bodyStartPat = BPAT_STANDRIGHT;
headLoopPat = PAT_SCHIFATORIGHT_LOOP;
@ -1008,7 +1008,7 @@ bool RMTony::startTalkCalculate(TALKTYPE nTalkType, int &headStartPat, int &body
switch (_TalkDirection) {
case LEFT:
case UP:
_nBodyOffset.Set(6, 56);
_nBodyOffset.set(6, 56);
headStartPat = PAT_NAAHLEFT_START;
bodyStartPat = BPAT_STANDLEFT;
headLoopPat = PAT_NAAHLEFT_LOOP;
@ -1016,7 +1016,7 @@ bool RMTony::startTalkCalculate(TALKTYPE nTalkType, int &headStartPat, int &body
case DOWN:
case RIGHT:
_nBodyOffset.Set(6, 56);
_nBodyOffset.set(6, 56);
headStartPat = PAT_NAAHRIGHT_START;
bodyStartPat = BPAT_STANDRIGHT;
headLoopPat = PAT_NAAHRIGHT_LOOP;
@ -1025,47 +1025,47 @@ bool RMTony::startTalkCalculate(TALKTYPE nTalkType, int &headStartPat, int &body
break;
case TALK_MACBETH1:
_nBodyOffset.Set(-33, -1);
_nBodyOffset.set(-33, -1);
headLoopPat = PAT_TALK_LEFT;
bodyLoopPat = BPAT_MACBETH1;
break;
case TALK_MACBETH2:
_nBodyOffset.Set(-33, -1);
_nBodyOffset.set(-33, -1);
headLoopPat = PAT_TALK_LEFT;
bodyLoopPat = BPAT_MACBETH2;
break;
case TALK_MACBETH3:
_nBodyOffset.Set(-33, -1);
_nBodyOffset.set(-33, -1);
headLoopPat = PAT_TALK_LEFT;
bodyLoopPat = BPAT_MACBETH3;
break;
case TALK_MACBETH4:
_nBodyOffset.Set(-33, -1);
_nBodyOffset.set(-33, -1);
headLoopPat = PAT_TALK_LEFT;
bodyLoopPat = BPAT_MACBETH4;
break;
case TALK_MACBETH5:
_nBodyOffset.Set(-33, -1);
_nBodyOffset.set(-33, -1);
headLoopPat = PAT_TALK_LEFT;
bodyLoopPat = BPAT_MACBETH5;
break;
case TALK_MACBETH6:
_nBodyOffset.Set(-33, -1);
_nBodyOffset.set(-33, -1);
headLoopPat = PAT_TALK_LEFT;
bodyLoopPat = BPAT_MACBETH6;
break;
case TALK_MACBETH7:
_nBodyOffset.Set(-33, -1);
_nBodyOffset.set(-33, -1);
headLoopPat = PAT_TALK_LEFT;
bodyLoopPat = BPAT_MACBETH7;
break;
case TALK_MACBETH8:
_nBodyOffset.Set(-33, -1);
_nBodyOffset.set(-33, -1);
headLoopPat = PAT_TALK_LEFT;
bodyLoopPat = BPAT_MACBETH8;
break;
case TALK_MACBETH9:
_nBodyOffset.Set(-33, -1);
_nBodyOffset.set(-33, -1);
headLoopPat = PAT_TALK_LEFT;
bodyLoopPat = BPAT_MACBETH9;
break;
@ -1076,7 +1076,7 @@ bool RMTony::startTalkCalculate(TALKTYPE nTalkType, int &headStartPat, int &body
case DOWN:
bodyStartPat = BPAT_STANDDOWN;
bodyLoopPat = BPAT_STANDDOWN;
_nBodyOffset.Set(4, 53);
_nBodyOffset.set(4, 53);
headStartPat = PAT_SPAVENTODOWN_STAND;
headLoopPat = PAT_SPAVENTODOWN_LOOP;
@ -1085,7 +1085,7 @@ bool RMTony::startTalkCalculate(TALKTYPE nTalkType, int &headStartPat, int &body
case RIGHT:
bodyStartPat = BPAT_STANDRIGHT;
bodyLoopPat = BPAT_STANDRIGHT;
_nBodyOffset.Set(6, 56);
_nBodyOffset.set(6, 56);
headStartPat = PAT_SPAVENTORIGHT_STAND;
headLoopPat = PAT_SPAVENTORIGHT_LOOP;
@ -1094,7 +1094,7 @@ bool RMTony::startTalkCalculate(TALKTYPE nTalkType, int &headStartPat, int &body
case LEFT:
bodyStartPat = BPAT_STANDLEFT;
bodyLoopPat = BPAT_STANDLEFT;
_nBodyOffset.Set(6, 56);
_nBodyOffset.set(6, 56);
headStartPat = PAT_SPAVENTOLEFT_STAND;
headLoopPat = PAT_SPAVENTOLEFT_LOOP;
@ -1450,10 +1450,10 @@ void RMTony::endTalk(CORO_PARAM) {
setPattern(0);
if (_TalkDirection == UP || _TalkDirection == LEFT) {
_body.setPattern(BPAT_CONBARBALEFT_STATIC);
_nBodyOffset.Set(-41, -14);
_nBodyOffset.set(-41, -14);
} else if (_TalkDirection == DOWN || _TalkDirection == RIGHT) {
_body.setPattern(BPAT_CONBARBARIGHT_STATIC);
_nBodyOffset.Set(-26, -14);
_nBodyOffset.set(-26, -14);
}
mainUnfreeze();
} else {
@ -1564,14 +1564,14 @@ void RMTony::startStaticCalculate(TALKTYPE nTalk, int &headPat, int &headLoopPat
switch (_TalkDirection) {
case UP:
case LEFT:
_nBodyOffset.Set(-21, -5);
_nBodyOffset.set(-21, -5);
bodyStartPat = BPAT_CONCONIGLIOLEFT_START;
bodyLoopPat = BPAT_CONCONIGLIOLEFT_LOOP;
break;
case DOWN:
case RIGHT:
_nBodyOffset.Set(-4, -5);
_nBodyOffset.set(-4, -5);
bodyStartPat = BPAT_CONCONIGLIORIGHT_START;
bodyLoopPat = BPAT_CONCONIGLIORIGHT_LOOP;
break;
@ -1582,14 +1582,14 @@ void RMTony::startStaticCalculate(TALKTYPE nTalk, int &headPat, int &headLoopPat
switch (_TalkDirection) {
case UP:
case LEFT:
_nBodyOffset.Set(-34, -2);
_nBodyOffset.set(-34, -2);
bodyStartPat = BPAT_CONCARTELEFT_START;
bodyLoopPat = BPAT_CONCARTELEFT_LOOP;
break;
case DOWN:
case RIGHT:
_nBodyOffset.Set(-4, -2);
_nBodyOffset.set(-4, -2);
bodyStartPat = BPAT_CONCARTERIGHT_START;
bodyLoopPat = BPAT_CONCARTERIGHT_LOOP;
break;
@ -1600,14 +1600,14 @@ void RMTony::startStaticCalculate(TALKTYPE nTalk, int &headPat, int &headLoopPat
switch (_TalkDirection) {
case UP:
case LEFT:
_nBodyOffset.Set(-61, -7);
_nBodyOffset.set(-61, -7);
bodyStartPat = BPAT_CONRICETTALEFT_START;
bodyLoopPat = BPAT_CONRICETTALEFT_LOOP;
break;
case DOWN:
case RIGHT:
_nBodyOffset.Set(-5, -7);
_nBodyOffset.set(-5, -7);
bodyStartPat = BPAT_CONRICETTARIGHT_START;
bodyLoopPat = BPAT_CONRICETTARIGHT_LOOP;
break;
@ -1618,14 +1618,14 @@ void RMTony::startStaticCalculate(TALKTYPE nTalk, int &headPat, int &headLoopPat
switch (_TalkDirection) {
case UP:
case LEFT:
_nBodyOffset.Set(-35, 2);
_nBodyOffset.set(-35, 2);
bodyStartPat = BPAT_CONPUPAZZOLEFT_START;
bodyLoopPat = BPAT_CONPUPAZZOLEFT_LOOP;
break;
case DOWN:
case RIGHT:
_nBodyOffset.Set(-14, 2);
_nBodyOffset.set(-14, 2);
bodyStartPat = BPAT_CONPUPAZZORIGHT_START;
bodyLoopPat = BPAT_CONPUPAZZORIGHT_LOOP;
break;
@ -1636,14 +1636,14 @@ void RMTony::startStaticCalculate(TALKTYPE nTalk, int &headPat, int &headLoopPat
switch (_TalkDirection) {
case UP:
case LEFT:
_nBodyOffset.Set(-16, -9);
_nBodyOffset.set(-16, -9);
bodyStartPat = BPAT_CONTACCUINOLEFT_START;
bodyLoopPat = BPAT_CONTACCUINOLEFT_LOOP;
break;
case DOWN:
case RIGHT:
_nBodyOffset.Set(-6, -9);
_nBodyOffset.set(-6, -9);
bodyStartPat = BPAT_CONTACCUINORIGHT_START;
bodyLoopPat = BPAT_CONTACCUINORIGHT_LOOP;
break;
@ -1654,14 +1654,14 @@ void RMTony::startStaticCalculate(TALKTYPE nTalk, int &headPat, int &headLoopPat
switch (_TalkDirection) {
case UP:
case LEFT:
_nBodyOffset.Set(-41, -8);
_nBodyOffset.set(-41, -8);
bodyStartPat = BPAT_CONMEGAFONOLEFT_START;
bodyLoopPat = BPAT_CONMEGAFONOLEFT_LOOP;
break;
case DOWN:
case RIGHT:
_nBodyOffset.Set(-14, -8);
_nBodyOffset.set(-14, -8);
bodyStartPat = BPAT_CONMEGAFONORIGHT_START;
bodyLoopPat = BPAT_CONMEGAFONORIGHT_LOOP;
break;
@ -1672,7 +1672,7 @@ void RMTony::startStaticCalculate(TALKTYPE nTalk, int &headPat, int &headLoopPat
switch (_TalkDirection) {
case UP:
case LEFT:
_nBodyOffset.Set(-41, -14);
_nBodyOffset.set(-41, -14);
bodyStartPat = BPAT_CONBARBALEFT_START;
bodyLoopPat = BPAT_STANDLEFT;
headLoopPat = PAT_TALKBARBA_LEFT;
@ -1681,7 +1681,7 @@ void RMTony::startStaticCalculate(TALKTYPE nTalk, int &headPat, int &headLoopPat
case DOWN:
case RIGHT:
_nBodyOffset.Set(-26, -14);
_nBodyOffset.set(-26, -14);
bodyStartPat = BPAT_CONBARBARIGHT_START;
bodyLoopPat = BPAT_STANDRIGHT;
headLoopPat = PAT_TALKBARBA_RIGHT;
@ -1697,7 +1697,7 @@ void RMTony::startStaticCalculate(TALKTYPE nTalk, int &headPat, int &headLoopPat
bodyLoopPat = BPAT_STANDDOWN;
bodyStartPat = BPAT_STANDDOWN;
headLoopPat = PAT_SPAVENTODOWN_STAND;
_nBodyOffset.Set(4, 53);
_nBodyOffset.set(4, 53);
break;
case LEFT:
@ -1705,7 +1705,7 @@ void RMTony::startStaticCalculate(TALKTYPE nTalk, int &headPat, int &headLoopPat
bodyLoopPat = BPAT_STANDLEFT;
bodyStartPat = BPAT_STANDLEFT;
headLoopPat = PAT_SPAVENTOLEFT_STAND;
_nBodyOffset.Set(6, 56);
_nBodyOffset.set(6, 56);
break;
case RIGHT:
@ -1713,7 +1713,7 @@ void RMTony::startStaticCalculate(TALKTYPE nTalk, int &headPat, int &headLoopPat
bodyLoopPat = BPAT_STANDRIGHT;
bodyStartPat = BPAT_STANDRIGHT;
headLoopPat = PAT_SPAVENTORIGHT_STAND;
_nBodyOffset.Set(6, 56);
_nBodyOffset.set(6, 56);
break;
default:

View file

@ -40,17 +40,17 @@ namespace Tony {
* Constructor
*/
RMString::RMString() {
m_string = NULL;
m_length = 0;
m_realLength = 0;
_string = NULL;
_length = 0;
_realLength = 0;
}
/**
* Destructor
*/
RMString::~RMString() {
if (m_string != NULL)
delete[] m_string;
if (_string != NULL)
delete[] _string;
}
/**
@ -58,9 +58,9 @@ RMString::~RMString() {
*/
RMString::RMString(const RMString &str) {
// Richiama l'overload su '=' per copiare
m_string = NULL;
m_length = 0;
m_realLength = 0;
_string = NULL;
_length = 0;
_realLength = 0;
*this = str;
}
@ -69,9 +69,9 @@ RMString::RMString(const RMString &str) {
*/
RMString::RMString(const char *str) {
// Use the overloaded '=' when copying
m_string = NULL;
m_length = 0;
m_realLength = 0;
_string = NULL;
_length = 0;
_realLength = 0;
*this = str;
}
@ -80,9 +80,9 @@ RMString::RMString(const char *str) {
*/
RMString::RMString(const int ch) {
// Use the overloaded '=' when copying
m_string = NULL;
m_length = 0;
m_realLength = 0;
_string = NULL;
_length = 0;
_realLength = 0;
*this = ch;
}
@ -90,8 +90,8 @@ RMString::RMString(const int ch) {
* Returns the length of the string
* @returns Length
*/
int RMString::Length() const {
return m_length;
int RMString::length() const {
return _length;
}
/**
@ -99,9 +99,9 @@ int RMString::Length() const {
* @param nIndex Position of the character to return
* @returns Character
*/
char RMString::GetAt(int nIndex) {
assert(nIndex < m_length);
return m_string[nIndex];
char RMString::getAt(int nIndex) {
assert(nIndex < _length);
return _string[nIndex];
}
/**
@ -109,9 +109,9 @@ char RMString::GetAt(int nIndex) {
* @param nIndex Position of the character to change
* @param c Character
*/
void RMString::SetAt(int nIndex, char c) {
assert(nIndex < m_length);
m_string[nIndex] = c;
void RMString::setAt(int nIndex, char c) {
assert(nIndex < _length);
_string[nIndex] = c;
}
/**
@ -120,8 +120,8 @@ void RMString::SetAt(int nIndex, char c) {
* @params Reference to the character
*/
char &RMString::operator[](int nIndex) {
assert(nIndex < m_length);
return m_string[nIndex];
assert(nIndex < _length);
return _string[nIndex];
}
/**
@ -131,21 +131,21 @@ char &RMString::operator[](int nIndex) {
*/
const RMString &RMString::operator=(const RMString &str) {
// Set the new length
m_length = str.m_length;
_length = str._length;
// If the source is empty, then destroy the current string buffer
if (m_length == 0) {
if (m_realLength > 0) {
delete[] m_string;
m_string = NULL;
m_realLength = 0;
if (_length == 0) {
if (_realLength > 0) {
delete[] _string;
_string = NULL;
_realLength = 0;
}
} else {
// Resize if necessary
Resize(m_length + 1);
resize(_length + 1);
// Copy the string
Common::copy(str.m_string, str.m_string + m_length + 1, m_string);
Common::copy(str._string, str._string + _length + 1, _string);
}
return *this;
@ -159,20 +159,20 @@ const RMString &RMString::operator=(const RMString &str) {
const RMString &RMString::operator=(const char *str) {
// If the source is empty, then destroy the current string buffer
if (str == NULL) {
if (m_realLength > 0) {
delete[] m_string;
m_string = NULL;
m_realLength = m_length = 0;
if (_realLength > 0) {
delete[] _string;
_string = NULL;
_realLength = _length = 0;
}
} else {
// Calculate the new length
m_length = strlen(str);
_length = strlen(str);
// Resize if necessary
Resize(m_length + 1);
resize(_length + 1);
// Copy the string
Common::copy(str, str + m_length + 1, m_string);
Common::copy(str, str + _length + 1, _string);
}
return *this;
@ -186,18 +186,18 @@ const RMString &RMString::operator=(const char *str) {
const RMString &RMString::operator=(const int ch) {
if (ch == '\0') {
// Destroy the current string
if (m_realLength > 0) {
delete [] m_string;
m_string = NULL;
m_length = m_realLength = 0;
if (_realLength > 0) {
delete [] _string;
_string = NULL;
_length = _realLength = 0;
}
} else {
// Resize if necessary
Resize(2);
resize(2);
m_string[0] = ch;
m_string[1] = '\0';
m_length = 1;
_string[0] = ch;
_string[1] = '\0';
_length = 1;
}
return *this;
@ -208,21 +208,21 @@ const RMString &RMString::operator=(const int ch) {
* @param str String to concatenate
* @param size Length of the string
*/
void RMString::Connect(const char *str, int size) {
void RMString::connect(const char *str, int size) {
int nlen;
if (size > 0) {
// Calculate the new lenght
nlen = m_length + size;
nlen = _length + size;
// Resize
Resize(nlen + 1, true);
resize(nlen + 1, true);
// Linkage with '\0'
Common::copy(str, str + size + 1, m_string + m_length);
Common::copy(str, str + size + 1, _string + _length);
// Save the new length
m_length = nlen;
_length = nlen;
}
}
@ -232,7 +232,7 @@ void RMString::Connect(const char *str, int size) {
* @returns Refrence to our string
*/
const RMString &RMString::operator+=(RMString &str) {
Connect(str, str.Length());
connect(str, str.length());
return *this;
}
@ -242,7 +242,7 @@ const RMString &RMString::operator+=(RMString &str) {
* @returns Refrence to our string
*/
const RMString &RMString::operator+=(const char *str) {
Connect(str, strlen(str));
connect(str, strlen(str));
return *this;
}
@ -258,7 +258,7 @@ const RMString &RMString::operator+=(const int ch) {
str[0] = ch;
str[1] = '\0';
Connect(str, 1);
connect(str, 1);
return *this;
}
@ -267,7 +267,7 @@ const RMString &RMString::operator+=(const int ch) {
* @returns char * reference to string
*/
RMString::operator char *() const {
return m_string;
return _string;
}
/**
@ -276,21 +276,21 @@ RMString::operator char *() const {
* @param bMaintain If true we must keep the original string,
if false we can destroy.
*/
void RMString::Resize(int size, bool bMantain) {
if (m_realLength == 0) {
m_string = new char[size];
m_realLength = size;
} else if (size > m_realLength) {
void RMString::resize(int size, bool bMantain) {
if (_realLength == 0) {
_string = new char[size];
_realLength = size;
} else if (size > _realLength) {
if (bMantain) {
char *app;
app = new char[size];
Common::copy(m_string, m_string + m_length + 1, app);
delete[] m_string;
m_string = app;
Common::copy(_string, _string + _length + 1, app);
delete[] _string;
_string = app;
} else {
delete[] m_string;
m_string = new char[size];
delete[] _string;
_string = new char[size];
}
}
}
@ -298,15 +298,15 @@ void RMString::Resize(int size, bool bMantain) {
/**
* Compacts the string to occupy less memory if possible.
*/
void RMString::Compact(void) {
if (m_realLength + 1 > m_length) {
void RMString::compact(void) {
if (_realLength + 1 > _length) {
char *app;
app = new char[m_length + 1];
Common::copy(m_string, m_string + m_length + 1, app);
app = new char[_length + 1];
Common::copy(_string, _string + _length + 1, app);
delete[] m_string;
m_string = app;
delete[] _string;
_string = app;
}
}
@ -359,14 +359,14 @@ RMDataStream &operator>>(RMDataStream &df, RMString &var) {
int i;
df >> len;
var.Resize(len + 1);
var.m_length = len + 1;
var.resize(len + 1);
var._length = len + 1;
for (i = 0; i < len; i++)
df >> var[i];
var[i] = '\0';
var.m_length = len;
var._length = len;
return df;
}
@ -374,7 +374,7 @@ RMDataStream &operator>>(RMDataStream &df, RMString &var) {
/**
* Formats a string
*/
void RMString::Format(const char *str, ...) {
void RMString::format(const char *str, ...) {
static char buf[2048];
va_list argList;
@ -393,29 +393,29 @@ RMFileStreamSlow::RMFileStreamSlow() : RMDataStream() {
}
RMFileStreamSlow::~RMFileStreamSlow() {
Close();
close();
}
void RMFileStreamSlow::Close() {
void RMFileStreamSlow::close() {
delete _stream;
}
bool RMFileStreamSlow::OpenFile(Common::File &file) {
bool RMFileStreamSlow::openFile(Common::File &file) {
_stream = file.readStream(file.size());
m_length = _stream->pos();
_length = _stream->pos();
return true;
}
bool RMFileStreamSlow::OpenFile(const char *lpFN) {
bool RMFileStreamSlow::openFile(const char *lpFN) {
// Open file for reading
Common::File f;
if (!f.open(lpFN))
return false;
m_length = f.size();
_length = f.size();
_stream = f.readStream(f.size());
return true;
@ -423,20 +423,20 @@ bool RMFileStreamSlow::OpenFile(const char *lpFN) {
RMDataStream &RMFileStreamSlow::operator+=(int nBytes) {
Seek(nBytes);
seek(nBytes);
return *this;
}
int RMFileStreamSlow::Pos() {
int RMFileStreamSlow::pos() {
return _stream->pos();
}
bool RMFileStreamSlow::IsEOF() {
return (Pos() >= m_length);
bool RMFileStreamSlow::isEOF() {
return (pos() >= _length);
}
int RMFileStreamSlow::Seek(int nBytes, RMDSPos where) {
int RMFileStreamSlow::seek(int nBytes, RMDSPos where) {
switch (where) {
case START:
return _stream->seek(nBytes);
@ -453,7 +453,7 @@ int RMFileStreamSlow::Seek(int nBytes, RMDSPos where) {
}
bool RMFileStreamSlow::Read(void *buf, int size) {
bool RMFileStreamSlow::read(void *buf, int size) {
uint32 dwRead;
dwRead = _stream->read(buf, size);
@ -462,39 +462,39 @@ bool RMFileStreamSlow::Read(void *buf, int size) {
RMFileStreamSlow &operator>>(RMFileStreamSlow &df, char &var) {
df.Read(&var, 1);
df.read(&var, 1);
return df;
}
RMFileStreamSlow &operator>>(RMFileStreamSlow &df, byte &var) {
df.Read(&var, 1);
df.read(&var, 1);
return df;
}
RMFileStreamSlow &operator>>(RMFileStreamSlow &df, uint16 &var) {
uint16 v;
df.Read(&v, 2);
df.read(&v, 2);
v = FROM_LE_16(v);
return df;
}
RMFileStreamSlow &operator>>(RMFileStreamSlow &df, int16 &var) {
uint16 v;
df.Read(&v, 2);
df.read(&v, 2);
var = (int16)FROM_LE_16(v);
return df;
}
RMFileStreamSlow &operator>>(RMFileStreamSlow &df, int &var) {
int v;
df.Read(&v, 4);
df.read(&v, 4);
var = FROM_LE_32(v);
return df;
}
RMFileStreamSlow &operator>>(RMFileStreamSlow &df, uint32 &var) {
uint32 v;
df.Read(&v, 4);
df.read(&v, 4);
var = FROM_LE_32(v);
return df;
}
@ -508,24 +508,24 @@ RMFileStreamSlow &operator>>(RMFileStreamSlow &df, uint32 &var) {
* Constructor
*/
RMDataStream::RMDataStream() {
m_length = 0;
m_pos = 0;
m_bError = false;
_length = 0;
_pos = 0;
_bError = false;
}
/**
* Destructor
*/
RMDataStream::~RMDataStream() {
Close();
close();
}
/**
* Close a stream
*/
void RMDataStream::Close(void) {
m_length = 0;
m_pos = 0;
void RMDataStream::close(void) {
_length = 0;
_pos = 0;
}
/**
@ -535,27 +535,27 @@ void RMDataStream::Close(void) {
* @remarks If the length of the buffer is not known, and cannot be
* specified, then EOF() and Seek() to end won't work.
*/
void RMDataStream::OpenBuffer(const byte *lpBuf, int size) {
m_length = size;
m_buf = lpBuf;
m_bError = false;
m_pos = 0;
void RMDataStream::openBuffer(const byte *lpBuf, int size) {
_length = size;
_buf = lpBuf;
_bError = false;
_pos = 0;
}
/**
* Returns the length of the stream
* @returns Stream length
*/
int RMDataStream::Length() {
return m_length;
int RMDataStream::length() {
return _length;
}
/**
* Determines if the end of the stream has been reached
* @returns true if end of stream reached, false if not
*/
bool RMDataStream::IsEOF() {
return (m_pos >= m_length);
bool RMDataStream::isEOF() {
return (_pos >= _length);
}
/**
@ -565,7 +565,7 @@ bool RMDataStream::IsEOF() {
* @returns Value read from the stream
*/
RMDataStream &operator>>(RMDataStream &df, char &var) {
df.Read(&var, 1);
df.read(&var, 1);
return df;
}
@ -576,7 +576,7 @@ RMDataStream &operator>>(RMDataStream &df, char &var) {
* @returns Value read from the stream
*/
RMDataStream &operator>>(RMDataStream &df, uint8 &var) {
df.Read(&var, 1);
df.read(&var, 1);
return df;
}
@ -588,7 +588,7 @@ RMDataStream &operator>>(RMDataStream &df, uint8 &var) {
*/
RMDataStream &operator>>(RMDataStream &df, uint16 &var) {
uint16 v;
df.Read(&v, 2);
df.read(&v, 2);
var = FROM_LE_16(v);
return df;
@ -602,7 +602,7 @@ RMDataStream &operator>>(RMDataStream &df, uint16 &var) {
*/
RMDataStream &operator>>(RMDataStream &df, int16 &var) {
uint16 v;
df.Read(&v, 2);
df.read(&v, 2);
var = (int16)FROM_LE_16(v);
return df;
@ -616,7 +616,7 @@ RMDataStream &operator>>(RMDataStream &df, int16 &var) {
*/
RMDataStream &operator>>(RMDataStream &df, int &var) {
uint32 v;
df.Read(&v, 4);
df.read(&v, 4);
var = (int)FROM_LE_32(v);
return df;
@ -630,7 +630,7 @@ RMDataStream &operator>>(RMDataStream &df, int &var) {
*/
RMDataStream &operator>>(RMDataStream &df, uint32 &var) {
uint32 v;
df.Read(&v, 4);
df.read(&v, 4);
var = FROM_LE_32(v);
return df;
@ -642,17 +642,17 @@ RMDataStream &operator>>(RMDataStream &df, uint32 &var) {
* @param size Size of the buffer
* @returns true if we have reached the end, false if not
*/
bool RMDataStream::Read(void *lpBuf, int size) {
bool RMDataStream::read(void *lpBuf, int size) {
byte *dest = (byte *)lpBuf;
if ((m_pos + size) > m_length) {
Common::copy(m_buf + m_pos, m_buf + m_pos + (m_length - m_pos), dest);
if ((_pos + size) > _length) {
Common::copy(_buf + _pos, _buf + _pos + (_length - _pos), dest);
return true;
} else {
Common::copy(m_buf + m_pos, m_buf + m_pos + size, dest);
Common::copy(_buf + _pos, _buf + _pos + size, dest);
m_pos += size;
_pos += size;
return false;
}
}
@ -663,7 +663,7 @@ bool RMDataStream::Read(void *lpBuf, int size) {
* @returns The stream
*/
RMDataStream &RMDataStream::operator+=(int nBytes) {
m_pos += nBytes;
_pos += nBytes;
return *this;
}
@ -673,57 +673,57 @@ RMDataStream &RMDataStream::operator+=(int nBytes) {
* @param origin Origin to do offset from
* @returns The absolute current position in bytes
*/
int RMDataStream::Seek(int nBytes, RMDSPos origin) {
int RMDataStream::seek(int nBytes, RMDSPos origin) {
switch (origin) {
case CUR:
break;
case START:
m_pos = 0;
_pos = 0;
break;
case END:
if (m_length == SIZENOTKNOWN)
return m_pos;
m_pos = m_length;
if (_length == SIZENOTKNOWN)
return _pos;
_pos = _length;
break;
}
m_pos += nBytes;
return m_pos;
_pos += nBytes;
return _pos;
}
/**
* Returns the current position of the stream
* @returns The current position
*/
int RMDataStream::Pos() {
return m_pos;
int RMDataStream::pos() {
return _pos;
}
/**
* Check if an error occurred during reading the stream
* @returns true if there was an error, false otherwise
*/
bool RMDataStream::IsError() {
return m_bError;
bool RMDataStream::isError() {
return _bError;
}
/**
* Sets an error code for the stream
* @param code Error code
*/
void RMDataStream::SetError(int code) {
m_bError = true;
m_ecode = code;
void RMDataStream::setError(int code) {
_bError = true;
_ecode = code;
}
/**
* Returns the error code for the stream
* @returns Error code
*/
int RMDataStream::GetError() {
return m_ecode;
int RMDataStream::getError() {
return _ecode;
}
/****************************************************************************\
@ -766,7 +766,7 @@ RMPoint &RMPoint::operator=(RMPoint p) {
/**
* Offsets the point by another point
*/
void RMPoint::Offset(const RMPoint &p) {
void RMPoint::offset(const RMPoint &p) {
x += p.x;
y += p.y;
}
@ -774,7 +774,7 @@ void RMPoint::Offset(const RMPoint &p) {
/**
* Offsets the point by a specified offset
*/
void RMPoint::Offset(int xOff, int yOff) {
void RMPoint::offset(int xOff, int yOff) {
x += xOff;
y += yOff;
}
@ -801,7 +801,7 @@ RMPoint operator-(RMPoint p1, RMPoint p2) {
* Sum (offset) of a point
*/
RMPoint &RMPoint::operator+=(RMPoint p) {
Offset(p);
offset(p);
return *this;
}
@ -809,7 +809,7 @@ RMPoint &RMPoint::operator+=(RMPoint p) {
* Subtract (offset) of a point
*/
RMPoint &RMPoint::operator-=(RMPoint p) {
Offset(-p);
offset(-p);
return *this;
}
@ -852,93 +852,93 @@ RMDataStream &operator>>(RMDataStream &ds, RMPoint &p) {
\****************************************************************************/
RMRect::RMRect() {
SetEmpty();
setEmpty();
}
void RMRect::SetEmpty(void) {
void RMRect::setEmpty(void) {
x1 = y1 = x2 = y2 = 0;
}
RMRect::RMRect(const RMPoint &p1, const RMPoint &p2) {
SetRect(p1, p2);
setRect(p1, p2);
}
RMRect::RMRect(int X1, int Y1, int X2, int Y2) {
SetRect(X1, Y1, X2, Y2);
setRect(X1, Y1, X2, Y2);
}
RMRect::RMRect(const RMRect &rc) {
CopyRect(rc);
copyRect(rc);
}
void RMRect::SetRect(const RMPoint &p1, const RMPoint &p2) {
void RMRect::setRect(const RMPoint &p1, const RMPoint &p2) {
x1 = p1.x;
y1 = p1.y;
x2 = p2.x;
y2 = p2.y;
}
void RMRect::SetRect(int X1, int Y1, int X2, int Y2) {
void RMRect::setRect(int X1, int Y1, int X2, int Y2) {
x1 = X1;
y1 = Y1;
x2 = X2;
y2 = Y2;
}
void RMRect::SetRect(const RMRect &rc) {
CopyRect(rc);
void RMRect::setRect(const RMRect &rc) {
copyRect(rc);
}
void RMRect::CopyRect(const RMRect &rc) {
void RMRect::copyRect(const RMRect &rc) {
x1 = rc.x1;
y1 = rc.y1;
x2 = rc.x2;
y2 = rc.y2;
}
RMPoint &RMRect::TopLeft() {
RMPoint &RMRect::topLeft() {
// FIXME: This seems very bad
return *((RMPoint *)this);
}
RMPoint &RMRect::BottomRight() {
RMPoint &RMRect::bottomRight() {
// FIXME: This seems very bad
return *((RMPoint *)this + 1);
}
RMPoint RMRect::Center() {
RMPoint RMRect::center() {
return RMPoint((x2 - x1) / 2, (y2 - y1) / 2);
}
int RMRect::Width() const {
int RMRect::width() const {
return x2 - x1;
}
int RMRect::Height() const {
int RMRect::height() const {
return y2 - y1;
}
int RMRect::Size() const {
return Width() * Height();
int RMRect::size() const {
return width() * height();
}
bool RMRect::IsEmpty() const {
bool RMRect::isEmpty() const {
return (x1 == 0 && y1 == 0 && x2 == 0 && y2 == 0);
}
const RMRect &RMRect::operator=(const RMRect &rc) {
CopyRect(rc);
copyRect(rc);
return *this;
}
void RMRect::Offset(int xOff, int yOff) {
void RMRect::offset(int xOff, int yOff) {
x1 += xOff;
y1 += yOff;
x2 += xOff;
y2 += yOff;
}
void RMRect::Offset(const RMPoint &p) {
void RMRect::offset(const RMPoint &p) {
x1 += p.x;
y1 += p.y;
x2 += p.x;
@ -946,12 +946,12 @@ void RMRect::Offset(const RMPoint &p) {
}
const RMRect &RMRect::operator+=(RMPoint p) {
Offset(p);
offset(p);
return *this;
}
const RMRect &RMRect::operator-=(RMPoint p) {
Offset(-p);
offset(-p);
return *this;
}
@ -986,8 +986,8 @@ bool RMRect::operator!=(const RMRect &rc) {
return ((x1 != rc.x1) || (y1 != rc.y1) || (x2 != rc.x2) || (y2 != rc.y2));
}
void RMRect::NormalizeRect(void) {
SetRect(MIN(x1, x2), MIN(y1, y2), MAX(x1, x2), MAX(y1, y2));
void RMRect::normalizeRect(void) {
setRect(MIN(x1, x2), MIN(y1, y2), MAX(x1, x2), MAX(y1, y2));
}
RMDataStream &operator>>(RMDataStream &ds, RMRect &rc) {
@ -1014,7 +1014,7 @@ RMResUpdate::~RMResUpdate() {
_hFile.close();
}
void RMResUpdate::Init(const Common::String &fileName) {
void RMResUpdate::init(const Common::String &fileName) {
// Open the resource update file
if (!_hFile.open(fileName))
// It doesn't exist, so exit immediately
@ -1039,7 +1039,7 @@ void RMResUpdate::Init(const Common::String &fileName) {
}
}
HGLOBAL RMResUpdate::QueryResource(uint32 dwRes) {
HGLOBAL RMResUpdate::queryResource(uint32 dwRes) {
// If there isn't an update file, return NULL
if (!_hFile.isOpen())
return NULL;

View file

@ -44,11 +44,11 @@ using namespace ::Tony::MPAL;
*/
class RMDataStream {
protected:
const byte *m_buf;
int m_length;
int m_pos;
bool m_bError;
int m_ecode;
const byte *_buf;
int _length;
int _pos;
bool _bError;
int _ecode;
public:
enum RMDSPos {
@ -68,15 +68,15 @@ public:
virtual ~RMDataStream();
// Loading buffer
void OpenBuffer(const byte *buf, int size = SIZENOTKNOWN);
void Close(void);
void openBuffer(const byte *buf, int size = SIZENOTKNOWN);
void close(void);
// Attributei
int Length();
virtual int Pos();
int length();
virtual int pos();
// EOF
virtual bool IsEOF();
virtual bool isEOF();
// Read methods
friend RMDataStream &operator>>(RMDataStream &df, char &var);
@ -87,16 +87,16 @@ public:
friend RMDataStream &operator>>(RMDataStream &df, uint32 &var);
// General read
virtual bool Read(void *buf, int size);
virtual bool read(void *buf, int size);
// Skipping & Seeking
virtual RMDataStream &operator+=(int nBytes);
virtual int Seek(int nBytes, RMDSPos origin = CUR);
virtual int seek(int nBytes, RMDSPos origin = CUR);
// Error handling
void SetError(int ecode);
int GetError();
bool IsError();
void setError(int ecode);
int getError();
bool isError();
};
@ -105,17 +105,17 @@ public:
*/
class RMFileStream : public RMDataStream {
private:
byte *m_buf;
byte *_buf;
public:
RMFileStream();
virtual ~RMFileStream();
// Methods for opening file
bool OpenFile(const char *lpFN);
bool OpenFile(Common::File &file);
bool openFile(const char *lpFN);
bool openFile(Common::File &file);
void Close(void);
void close(void);
};
@ -126,18 +126,18 @@ public:
RMFileStreamSlow();
virtual ~RMFileStreamSlow();
bool OpenFile(const char *lpFN);
bool OpenFile(Common::File &file);
bool openFile(const char *lpFN);
bool openFile(Common::File &file);
void Close(void);
void close(void);
RMDataStream &operator+=(int nBytes);
int Seek(int nBytes, RMDSPos where = CUR);
int seek(int nBytes, RMDSPos where = CUR);
int Pos();
virtual bool IsEOF();
int pos();
virtual bool isEOF();
bool Read(void *buf, int size);
bool read(void *buf, int size);
friend RMFileStreamSlow &operator>>(RMFileStreamSlow &df, char &var);
friend RMFileStreamSlow &operator>>(RMFileStreamSlow &df, byte &var);
@ -152,9 +152,9 @@ public:
*/
class RMString {
private:
char *m_string;
int m_length;
int m_realLength;
char *_string;
int _length;
int _realLength;
public:
RMString();
@ -166,12 +166,12 @@ public:
RMString(const int ch);
// General methods
int Length() const;
void Compact();
int length() const;
void compact();
// Access characters within string
char GetAt(int nIndex);
void SetAt(int nIndex, char c);
char getAt(int nIndex);
void setAt(int nIndex, char c);
char &operator[](int nIndex);
// String cast
@ -200,11 +200,11 @@ public:
friend RMDataStream &operator>>(RMDataStream &df, RMString &var);
// String formatting
void Format(const char *str, ...);
void format(const char *str, ...);
private:
void Resize(int size, bool bMantain = false);
void Connect(const char *str, int size);
void resize(int size, bool bMantain = false);
void connect(const char *str, int size);
};
/**
@ -224,14 +224,14 @@ public:
RMPoint &operator=(RMPoint p);
// Set
void Set(int x1, int y1) {
void set(int x1, int y1) {
x = x1;
y = y1;
}
// Offset
void Offset(int xOff, int yOff);
void Offset(const RMPoint &p);
void offset(int xOff, int yOff);
void offset(const RMPoint &p);
friend RMPoint operator+(RMPoint p1, RMPoint p2);
friend RMPoint operator-(RMPoint p1, RMPoint p2);
RMPoint &operator+=(RMPoint p);
@ -261,27 +261,27 @@ public:
RMRect(const RMRect &rc);
// Attributes
RMPoint &TopLeft();
RMPoint &BottomRight();
RMPoint Center();
int Width() const;
int Height() const;
bool IsEmpty() const;
int Size() const;
RMPoint &topLeft();
RMPoint &bottomRight();
RMPoint center();
int width() const;
int height() const;
bool isEmpty() const;
int size() const;
// Set
void SetRect(int x1, int y1, int x2, int y2);
void SetRect(const RMPoint &p1, const RMPoint &p2);
void SetEmpty(void);
void setRect(int x1, int y1, int x2, int y2);
void setRect(const RMPoint &p1, const RMPoint &p2);
void setEmpty(void);
// Copiers
void SetRect(const RMRect &rc);
void CopyRect(const RMRect &rc);
void setRect(const RMRect &rc);
void copyRect(const RMRect &rc);
const RMRect &operator=(const RMRect &rc);
// Offset
void Offset(int xOff, int yOff);
void Offset(const RMPoint &p);
void offset(int xOff, int yOff);
void offset(const RMPoint &p);
friend RMRect operator+(const RMRect &rc, RMPoint p);
friend RMRect operator-(const RMRect &rc, RMPoint p);
friend RMRect operator+(RMPoint p, const RMRect &rc);
@ -294,10 +294,10 @@ public:
bool operator!=(const RMRect &rc);
// Normalise
void NormalizeRect();
void normalizeRect();
// Point in rect
bool PtInRect(const RMPoint &pt) {
bool ptInRect(const RMPoint &pt) {
return (pt.x >= x1 && pt.x <= x2 && pt.y >= y1 && pt.y <= y2);
}
@ -324,8 +324,8 @@ public:
RMResUpdate();
~RMResUpdate();
void Init(const Common::String &fileName);
HGLOBAL QueryResource(uint32 dwRes);
void init(const Common::String &fileName);
HGLOBAL queryResource(uint32 dwRes);
};
} // End of namespace Tony

View file

@ -57,8 +57,8 @@ private:
void plotLines(const byte *lpBuf, const Common::Point &center, int x, int y);
protected:
void * /*LPDIRECTDRAWCLIPPER*/ m_MainClipper;
void * /*LPDIRECTDRAWCLIPPER*/ m_BackClipper;
// void * /*LPDIRECTDRAWCLIPPER*/ _MainClipper;
// void * /*LPDIRECTDRAWCLIPPER*/ _BackClipper;
int fps, fcount;
int lastsecond, lastfcount;