TONY: Rename variables in loc.h and mpal.h

This commit is contained in:
Strangerke 2012-06-10 23:56:37 +02:00
parent 2b02a45ce1
commit 44ee26e6c9
6 changed files with 302 additions and 302 deletions

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 // 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 // position for Tony that will be in the walkable areas
RMBoxLoc *box = _vm->_theBoxes.getBoxes(sceneNumber); 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 // Set up a process to change the scene

View file

@ -951,19 +951,19 @@ short RMCharacter::findPath(short source, short destination) {
short i, j, k, costominimo, fine, errore = 0; short i, j, k, costominimo, fine, errore = 0;
RMBoxLoc *cur; RMBoxLoc *cur;
g_system->lockMutex(csMove); g_system->lockMutex(_csMove);
if (source == -1 || destination == -1) { if (source == -1 || destination == -1) {
g_system->unlockMutex(csMove); g_system->unlockMutex(_csMove);
return 0; return 0;
} }
// Get the boxes // Get the boxes
cur = theBoxes->getBoxes(curLocation); cur = _theBoxes->getBoxes(_curLocation);
// Make a backup copy to work on // Make a backup copy to work on
for (i = 0; i < cur->numbbox; i++) for (i = 0; i < cur->numbbox; i++)
memcpy(&BOX[i], &cur->boxes[i], sizeof(RMBox)); memcpy(&BOX[i], &cur->_boxes[i], sizeof(RMBox));
// Invalidate all nodes // Invalidate all nodes
for (i = 0; i < cur->numbbox; i++) for (i = 0; i < cur->numbbox; i++)
@ -984,7 +984,7 @@ short RMCharacter::findPath(short source, short destination) {
if (VALIDO[i] == 1) { if (VALIDO[i] == 1) {
errore = 0; // Failure de-bunked errore = 0; // Failure de-bunked
j = 0; j = 0;
while (((BOX[i].adj[j]) != 1) && (j < cur->numbbox)) while (((BOX[i]._adj[j]) != 1) && (j < cur->numbbox))
j++; j++;
if (j >= cur->numbbox) if (j >= cur->numbbox)
@ -1002,12 +1002,12 @@ short RMCharacter::findPath(short source, short destination) {
// 2nd cycle: adding new nodes that were found, saturate old nodes // 2nd cycle: adding new nodes that were found, saturate old nodes
for (i = 0; i < cur->numbbox; i++) for (i = 0; i < cur->numbbox; i++)
if ((VALIDO[i] == 1) && ((COSTO[i] + 1) == costominimo)) { if ((VALIDO[i] == 1) && ((COSTO[i] + 1) == costominimo)) {
BOX[i].adj[NEXT[i]] = 2; BOX[i]._adj[NEXT[i]] = 2;
COSTO[NEXT[i]] = costominimo; COSTO[NEXT[i]] = costominimo;
VALIDO[NEXT[i]] = 1; VALIDO[NEXT[i]] = 1;
for (j = 0; j < cur->numbbox; j++) for (j = 0; j < cur->numbbox; j++)
if (BOX[j].adj[NEXT[i]] == 1) if (BOX[j]._adj[NEXT[i]] == 1)
BOX[j].adj[NEXT[i]] = 0; BOX[j]._adj[NEXT[i]] = 0;
if (NEXT[i] == destination) if (NEXT[i] == destination)
fine = 1; fine = 1;
@ -1016,22 +1016,22 @@ short RMCharacter::findPath(short source, short destination) {
// Remove the path from the adjacent modified matrixes // Remove the path from the adjacent modified matrixes
if (!errore) { if (!errore) {
pathlenght = COSTO[destination]; _pathLength = COSTO[destination];
k = pathlenght; k = _pathLength;
path[k] = destination; _path[k] = destination;
while (path[k] != source) { while (_path[k] != source) {
i = 0; i = 0;
while (BOX[i].adj[path[k]] != 2) while (BOX[i]._adj[_path[k]] != 2)
i++; i++;
k--; k--;
path[k] = i; _path[k] = i;
} }
pathlenght++; _pathLength++;
} }
g_system->unlockMutex(csMove); g_system->unlockMutex(_csMove);
return !errore; return !errore;
} }
@ -1044,24 +1044,24 @@ void RMCharacter::goTo(CORO_PARAM, RMPoint destcoord, bool bReversed) {
CORO_BEGIN_CODE(_ctx); CORO_BEGIN_CODE(_ctx);
if (_pos == destcoord) { if (_pos == destcoord) {
if (minpath == 0) { if (_minPath == 0) {
CORO_INVOKE_0(stop); CORO_INVOKE_0(stop);
CoroScheduler.pulseEvent(hEndOfPath); CoroScheduler.pulseEvent(_hEndOfPath);
return; return;
} }
} }
status = WALK; _status = WALK;
linestart = _pos; _lineStart = _pos;
lineend = destcoord; _lineEnd = destcoord;
dx = linestart.x - lineend.x; _dx = _lineStart.x - _lineEnd.x;
dy = linestart.y - lineend.y; _dy = _lineStart.y - _lineEnd.y;
fx = dx; _fx = _dx;
fy = dy; _fy = _dy;
dx = ABS(dx); _dx = ABS(_dx);
dy = ABS(dy); _dy = ABS(_dy);
walkspeed = curSpeed; _walkSpeed = _curSpeed;
walkcount = 0; _walkCount = 0;
if (bReversed) { if (bReversed) {
while (0) ; while (0) ;
@ -1069,15 +1069,15 @@ void RMCharacter::goTo(CORO_PARAM, RMPoint destcoord, bool bReversed) {
int nPatt = getCurPattern(); int nPatt = getCurPattern();
if (dx > dy) { if (_dx > _dy) {
slope = fy / fx; _slope = _fy / _fx;
if (lineend.x < linestart.x) if (_lineEnd.x < _lineStart.x)
walkspeed = -walkspeed; _walkSpeed = -_walkSpeed;
walkstatus = 1; _walkStatus = 1;
// Change the pattern for the new direction // Change the pattern for the new direction
bNeedToStop = true; _bNeedToStop = true;
if ((walkspeed < 0 && !bReversed) || (walkspeed >= 0 && bReversed)) { if ((_walkSpeed < 0 && !bReversed) || (_walkSpeed >= 0 && bReversed)) {
if (nPatt != PAT_WALKLEFT) if (nPatt != PAT_WALKLEFT)
setPattern(PAT_WALKLEFT); setPattern(PAT_WALKLEFT);
} else { } else {
@ -1085,13 +1085,13 @@ void RMCharacter::goTo(CORO_PARAM, RMPoint destcoord, bool bReversed) {
setPattern(PAT_WALKRIGHT); setPattern(PAT_WALKRIGHT);
} }
} else { } else {
slope = fx / fy; _slope = _fx / _fy;
if (lineend.y < linestart.y) if (_lineEnd.y < _lineStart.y)
walkspeed = -walkspeed; _walkSpeed = -_walkSpeed;
walkstatus = 0; _walkStatus = 0;
bNeedToStop = true; _bNeedToStop = true;
if ((walkspeed < 0 && !bReversed) || (walkspeed >= 0 && bReversed)) { if ((_walkSpeed < 0 && !bReversed) || (_walkSpeed >= 0 && bReversed)) {
if (nPatt != PAT_WALKUP) if (nPatt != PAT_WALKUP)
setPattern(PAT_WALKUP); setPattern(PAT_WALKUP);
} else { } else {
@ -1100,8 +1100,8 @@ void RMCharacter::goTo(CORO_PARAM, RMPoint destcoord, bool bReversed) {
} }
} }
olddx = dx; _olddx = _dx;
olddy = dy; _olddy = _dy;
CORO_END_CODE; CORO_END_CODE;
} }
@ -1297,17 +1297,17 @@ RMPoint RMCharacter::nearestHotSpot(int sourcebox, int destbox) {
short cc; short cc;
int x, y, distanzaminima; int x, y, distanzaminima;
distanzaminima = 10000000; distanzaminima = 10000000;
RMBoxLoc *cur = theBoxes->getBoxes(curLocation); RMBoxLoc *cur = _theBoxes->getBoxes(_curLocation);
for (cc = 0; cc < cur->boxes[sourcebox].numhotspot; cc++) for (cc = 0; cc < cur->_boxes[sourcebox]._numHotspot; cc++)
if ((cur->boxes[sourcebox].hotspot[cc].destination) == destbox) { if ((cur->_boxes[sourcebox]._hotspot[cc]._destination) == destbox) {
x = ABS(cur->boxes[sourcebox].hotspot[cc].hotx - _pos.x); x = ABS(cur->_boxes[sourcebox]._hotspot[cc]._hotx - _pos.x);
y = ABS(cur->boxes[sourcebox].hotspot[cc].hoty - _pos.y); y = ABS(cur->_boxes[sourcebox]._hotspot[cc]._hoty - _pos.y);
if ((x * x + y * y) < distanzaminima) { if ((x * x + y * y) < distanzaminima) {
distanzaminima = x * x + y * y; distanzaminima = x * x + y * y;
puntocaldo.x = cur->boxes[sourcebox].hotspot[cc].hotx; puntocaldo.x = cur->_boxes[sourcebox]._hotspot[cc]._hotx;
puntocaldo.y = cur->boxes[sourcebox].hotspot[cc].hoty; puntocaldo.y = cur->_boxes[sourcebox]._hotspot[cc]._hoty;
} }
} }
@ -1320,7 +1320,7 @@ void RMCharacter::draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *pr
CORO_BEGIN_CODE(_ctx); CORO_BEGIN_CODE(_ctx);
if (bDrawNow) { if (_bDrawNow) {
prim->getDst() += _fixedScroll; prim->getDst() += _fixedScroll;
CORO_INVOKE_2(RMItem::draw, bigBuf, prim); CORO_INVOKE_2(RMItem::draw, bigBuf, prim);
@ -1334,22 +1334,22 @@ void RMCharacter::newBoxEntered(int nBox) {
bool bOldReverse; bool bOldReverse;
// Recall on ExitBox // Recall on ExitBox
mpalQueryDoAction(3, curLocation, curbox); mpalQueryDoAction(3, _curLocation, _curBox);
cur = theBoxes->getBoxes(curLocation); cur = _theBoxes->getBoxes(_curLocation);
bOldReverse = cur->boxes[curbox].bReversed; bOldReverse = cur->_boxes[_curBox]._bReversed;
curbox = nBox; _curBox = nBox;
// If Z is changed, we must remove it from the OT // If Z is changed, we must remove it from the OT
if (cur->boxes[curbox].Zvalue != _z) { if (cur->_boxes[_curBox]._destZ != _z) {
bRemoveFromOT = true; _bRemoveFromOT = true;
_z = cur->boxes[curbox].Zvalue; _z = cur->_boxes[_curBox]._destZ;
} }
// Movement management is reversed, only if we are not in the shortest path. If we are in the shortest // Movement management is reversed, only if we are not in the shortest path. If we are in the shortest
// path, directly do the DoFrame // path, directly do the DoFrame
if (bMovingWithoutMinpath) { if (_bMovingWithoutMinpath) {
if ((cur->boxes[curbox].bReversed && !bOldReverse) || (!cur->boxes[curbox].bReversed && bOldReverse)) { if ((cur->_boxes[_curBox]._bReversed && !bOldReverse) || (!cur->_boxes[_curBox]._bReversed && bOldReverse)) {
switch (getCurPattern()) { switch (getCurPattern()) {
case PAT_WALKUP: case PAT_WALKUP:
setPattern(PAT_WALKDOWN); setPattern(PAT_WALKDOWN);
@ -1368,7 +1368,7 @@ void RMCharacter::newBoxEntered(int nBox) {
} }
// Recall On EnterBox // Recall On EnterBox
mpalQueryDoAction(2, curLocation, curbox); mpalQueryDoAction(2, _curLocation, _curBox);
} }
void RMCharacter::doFrame(CORO_PARAM, RMGfxTargetBuffer *bigBuf, int loc) { void RMCharacter::doFrame(CORO_PARAM, RMGfxTargetBuffer *bigBuf, int loc) {
@ -1380,105 +1380,105 @@ void RMCharacter::doFrame(CORO_PARAM, RMGfxTargetBuffer *bigBuf, int loc) {
CORO_BEGIN_CODE(_ctx); CORO_BEGIN_CODE(_ctx);
_ctx->bEndNow = false; _ctx->bEndNow = false;
bEndOfPath = false; _bEndOfPath = false;
bDrawNow = (curLocation == loc); _bDrawNow = (_curLocation == loc);
g_system->lockMutex(csMove); g_system->lockMutex(_csMove);
// If we're walking.. // If we're walking..
if (status != STAND) { if (_status != STAND) {
// If we are going horizontally // If we are going horizontally
if (walkstatus == 1) { if (_walkStatus == 1) {
dx = walkspeed * walkcount; _dx = _walkSpeed * _walkCount;
dy = (int)(slope * dx); _dy = (int)(_slope * _dx);
_pos.x = linestart.x + dx; _pos.x = _lineStart.x + _dx;
_pos.y = linestart.y + dy; _pos.y = _lineStart.y + _dy;
// Right // Right
if (((walkspeed > 0) && (_pos.x > lineend.x)) || ((walkspeed < 0) && (_pos.x < lineend.x))) { if (((_walkSpeed > 0) && (_pos.x > _lineEnd.x)) || ((_walkSpeed < 0) && (_pos.x < _lineEnd.x))) {
_pos = lineend; _pos = _lineEnd;
status = STAND; _status = STAND;
_ctx->bEndNow = true; _ctx->bEndNow = true;
} }
} }
// If we are going vertical // If we are going vertical
if (walkstatus == 0) { if (_walkStatus == 0) {
dy = walkspeed * walkcount; _dy = _walkSpeed * _walkCount;
dx = (int)(slope * dy); _dx = (int)(_slope * _dy);
_pos.x = linestart.x + dx; _pos.x = _lineStart.x + _dx;
_pos.y = linestart.y + dy; _pos.y = _lineStart.y + _dy;
// Down // Down
if (((walkspeed > 0) && (_pos.y > lineend.y)) || ((walkspeed < 0) && (_pos.y < lineend.y))) { if (((_walkSpeed > 0) && (_pos.y > _lineEnd.y)) || ((_walkSpeed < 0) && (_pos.y < _lineEnd.y))) {
_pos = lineend; _pos = _lineEnd;
status = STAND; _status = STAND;
_ctx->bEndNow = true; _ctx->bEndNow = true;
} }
} }
// Check if the character came out of the BOX in error, in which case he returns immediately // Check if the character came out of the BOX in error, in which case he returns immediately
if (inWhichBox(_pos) == -1) { if (inWhichBox(_pos) == -1) {
_pos.x = linestart.x + olddx; _pos.x = _lineStart.x + _olddx;
_pos.y = linestart.y + olddy; _pos.y = _lineStart.y + _olddy;
} }
// If we have just moved to a temporary location, and is over the shortest path, we stop permanently // If we have just moved to a temporary location, and is over the shortest path, we stop permanently
if (_ctx->bEndNow && minpath == 0) { if (_ctx->bEndNow && _minPath == 0) {
if (!bEndOfPath) if (!_bEndOfPath)
CORO_INVOKE_0(stop); CORO_INVOKE_0(stop);
bEndOfPath = true; _bEndOfPath = true;
CoroScheduler.pulseEvent(hEndOfPath); CoroScheduler.pulseEvent(_hEndOfPath);
} }
walkcount++; _walkCount++;
// Update the character Z. @@@ Should remove only if the Z was changed // Update the character Z. @@@ Should remove only if the Z was changed
// Check if the box was changed // Check if the box was changed
if (!theBoxes->isInBox(curLocation, curbox, _pos)) if (!_theBoxes->isInBox(_curLocation, _curBox, _pos))
newBoxEntered(inWhichBox(_pos)); newBoxEntered(inWhichBox(_pos));
// Update the old coordinates // Update the old coordinates
olddx = dx; _olddx = _dx;
olddy = dy; _olddy = _dy;
} }
// If we stop // If we stop
if (status == STAND) { if (_status == STAND) {
// Check if there is still the shortest path to calculate // Check if there is still the shortest path to calculate
if (minpath == 1) { if (_minPath == 1) {
_ctx->cur = theBoxes->getBoxes(curLocation); _ctx->cur = _theBoxes->getBoxes(_curLocation);
// If we still have to go through a box // If we still have to go through a box
if (pathcount < pathlenght) { if (_pathCount < _pathLength) {
// Check if the box we're going into is active // Check if the box we're going into is active
if (_ctx->cur->boxes[path[pathcount - 1]].attivo) { if (_ctx->cur->_boxes[_path[_pathCount - 1]]._attivo) {
// Move in a straight line towards the nearest hotspot, taking into account the reversing // Move in a straight line towards the nearest hotspot, taking into account the reversing
// NEWBOX = path[pathcount-1] // NEWBOX = path[pathcount-1]
CORO_INVOKE_2(goTo, nearestHotSpot(path[pathcount - 1], path[pathcount]), _ctx->cur->boxes[path[pathcount - 1]].bReversed); CORO_INVOKE_2(goTo, nearestHotSpot(_path[_pathCount - 1], _path[_pathCount]), _ctx->cur->_boxes[_path[_pathCount - 1]]._bReversed);
pathcount++; _pathCount++;
} else { } else {
// If the box is off, we can only block all // If the box is off, we can only block all
// @@@ Whilst this should not happen, because have improved // @@@ Whilst this should not happen, because have improved
// the search for the minimum path // the search for the minimum path
minpath = 0; _minPath = 0;
if (!bEndOfPath) if (!_bEndOfPath)
CORO_INVOKE_0(stop); CORO_INVOKE_0(stop);
bEndOfPath = true; _bEndOfPath = true;
CoroScheduler.pulseEvent(hEndOfPath); CoroScheduler.pulseEvent(_hEndOfPath);
} }
} else { } else {
// If we have already entered the last box, we just have to move in a straight line towards the // If we have already entered the last box, we just have to move in a straight line towards the
// point of arrival // point of arrival
// NEWBOX = InWhichBox(pathend) // NEWBOX = InWhichBox(pathend)
minpath = 0; _minPath = 0;
CORO_INVOKE_2(goTo, pathend, _ctx->cur->boxes[inWhichBox(pathend)].bReversed); CORO_INVOKE_2(goTo, _pathEnd, _ctx->cur->_boxes[inWhichBox(_pathEnd)]._bReversed);
} }
} }
} }
g_system->unlockMutex(csMove); g_system->unlockMutex(_csMove);
// Invoke the DoFrame of the item // Invoke the DoFrame of the item
RMItem::doFrame(bigBuf); RMItem::doFrame(bigBuf);
@ -1492,16 +1492,16 @@ void RMCharacter::stop(CORO_PARAM) {
CORO_BEGIN_CODE(_ctx); CORO_BEGIN_CODE(_ctx);
bMoving = false; _bMoving = false;
// You never know.. // You never know..
status = STAND; _status = STAND;
minpath = 0; _minPath = 0;
if (!bNeedToStop) if (!_bNeedToStop)
return; return;
bNeedToStop = false; _bNeedToStop = false;
switch (getCurPattern()) { switch (getCurPattern()) {
case PAT_WALKUP: case PAT_WALKUP:
@ -1529,7 +1529,7 @@ void RMCharacter::stop(CORO_PARAM) {
} }
inline int RMCharacter::inWhichBox(const RMPoint &pt) { inline int RMCharacter::inWhichBox(const RMPoint &pt) {
return theBoxes->whichBox(curLocation, pt); return _theBoxes->whichBox(_curLocation, pt);
} }
@ -1542,12 +1542,12 @@ void RMCharacter::move(CORO_PARAM, RMPoint pt, bool *result) {
CORO_BEGIN_CODE(_ctx); CORO_BEGIN_CODE(_ctx);
bMoving = true; _bMoving = true;
// 0, 0 does not do anything, just stops the character // 0, 0 does not do anything, just stops the character
if (pt.x == 0 && pt.y == 0) { if (pt.x == 0 && pt.y == 0) {
minpath = 0; _minPath = 0;
status = STAND; _status = STAND;
CORO_INVOKE_0(stop); CORO_INVOKE_0(stop);
if (result) if (result)
*result = true; *result = true;
@ -1568,18 +1568,18 @@ void RMCharacter::move(CORO_PARAM, RMPoint pt, bool *result) {
_ctx->numbox = inWhichBox(pt); _ctx->numbox = inWhichBox(pt);
} }
_ctx->cur = theBoxes->getBoxes(curLocation); _ctx->cur = _theBoxes->getBoxes(_curLocation);
minpath = 0; _minPath = 0;
status = STAND; _status = STAND;
bMovingWithoutMinpath = true; _bMovingWithoutMinpath = true;
if (scanLine(pt)) if (scanLine(pt))
CORO_INVOKE_2(goTo, pt, _ctx->cur->boxes[_ctx->numbox].bReversed); CORO_INVOKE_2(goTo, pt, _ctx->cur->_boxes[_ctx->numbox]._bReversed);
else if (findPath(inWhichBox(_pos), inWhichBox(pt))) { else if (findPath(inWhichBox(_pos), inWhichBox(pt))) {
bMovingWithoutMinpath = false; _bMovingWithoutMinpath = false;
minpath = 1; _minPath = 1;
pathcount = 1; _pathCount = 1;
pathend = pt; _pathEnd = pt;
} else { } else {
// @@@ This case is whether a hotspot is inside a box, but there is // @@@ This case is whether a hotspot is inside a box, but there is
// a path to get there. We use the InvScanLine to search around a point // a path to get there. We use the InvScanLine to search around a point
@ -1587,12 +1587,12 @@ void RMCharacter::move(CORO_PARAM, RMPoint pt, bool *result) {
pt = _ctx->dest; pt = _ctx->dest;
if (scanLine(pt)) if (scanLine(pt))
CORO_INVOKE_2(goTo, pt, _ctx->cur->boxes[_ctx->numbox].bReversed); CORO_INVOKE_2(goTo, pt, _ctx->cur->_boxes[_ctx->numbox]._bReversed);
else if (findPath(inWhichBox(_pos), inWhichBox(pt))) { else if (findPath(inWhichBox(_pos), inWhichBox(pt))) {
bMovingWithoutMinpath = false; _bMovingWithoutMinpath = false;
minpath = 1; _minPath = 1;
pathcount = 1; _pathCount = 1;
pathend = pt; _pathEnd = pt;
if (result) if (result)
*result = true; *result = true;
} else { } else {
@ -1612,19 +1612,19 @@ void RMCharacter::move(CORO_PARAM, RMPoint pt, bool *result) {
void RMCharacter::setPosition(const RMPoint &pt, int newloc) { void RMCharacter::setPosition(const RMPoint &pt, int newloc) {
RMBoxLoc *box; RMBoxLoc *box;
minpath = 0; _minPath = 0;
status = STAND; _status = STAND;
_pos = pt; _pos = pt;
if (newloc != -1) if (newloc != -1)
curLocation = newloc; _curLocation = newloc;
// Update the character's Z value // Update the character's Z value
box = theBoxes->getBoxes(curLocation); box = _theBoxes->getBoxes(_curLocation);
curbox = inWhichBox(_pos); _curBox = inWhichBox(_pos);
assert(curbox != -1); assert(_curBox != -1);
_z = box->boxes[curbox].Zvalue; _z = box->_boxes[_curBox]._destZ;
bRemoveFromOT = true; _bRemoveFromOT = true;
} }
void RMCharacter::waitForEndMovement(CORO_PARAM) { void RMCharacter::waitForEndMovement(CORO_PARAM) {
@ -1633,8 +1633,8 @@ void RMCharacter::waitForEndMovement(CORO_PARAM) {
CORO_BEGIN_CODE(_ctx); CORO_BEGIN_CODE(_ctx);
if (bMoving) if (_bMoving)
CORO_INVOKE_2(CoroScheduler.waitForSingleObject, hEndOfPath, CORO_INFINITE); CORO_INVOKE_2(CoroScheduler.waitForSingleObject, _hEndOfPath, CORO_INFINITE);
CORO_END_CODE; CORO_END_CODE;
} }
@ -1645,7 +1645,7 @@ void RMCharacter::removeThis(CORO_PARAM, bool &result) {
CORO_BEGIN_CODE(_ctx); CORO_BEGIN_CODE(_ctx);
if (bRemoveFromOT) if (_bRemoveFromOT)
result = true; result = true;
else else
CORO_INVOKE_1(RMItem::removeThis, result); CORO_INVOKE_1(RMItem::removeThis, result);
@ -1654,38 +1654,38 @@ void RMCharacter::removeThis(CORO_PARAM, bool &result) {
} }
RMCharacter::RMCharacter() { RMCharacter::RMCharacter() {
csMove = g_system->createMutex(); _csMove = g_system->createMutex();
hEndOfPath = CoroScheduler.createEvent(false, false); _hEndOfPath = CoroScheduler.createEvent(false, false);
minpath = 0; _minPath = 0;
curSpeed = 3; _curSpeed = 3;
bRemoveFromOT = false; _bRemoveFromOT = false;
bMoving = false; _bMoving = false;
curLocation = 0; _curLocation = 0;
curbox = 0; _curBox = 0;
dx = dy = 0; _dx = _dy = 0;
olddx = olddy = 0; _olddx = _olddy = 0;
fx = fy = slope = 0; _fx = _fy = _slope = 0;
walkspeed = walkstatus = 0; _walkSpeed = _walkStatus = 0;
nextbox = 0; _nextBox = 0;
pathlenght = pathcount = 0; _pathLength = _pathCount = 0;
status = STAND; _status = STAND;
theBoxes = NULL; _theBoxes = NULL;
walkcount = 0; _walkCount = 0;
bEndOfPath = false; _bEndOfPath = false;
bMovingWithoutMinpath = false; _bMovingWithoutMinpath = false;
bDrawNow = false; _bDrawNow = false;
bNeedToStop = false; _bNeedToStop = false;
_pos.set(0, 0); _pos.set(0, 0);
} }
RMCharacter::~RMCharacter() { RMCharacter::~RMCharacter() {
g_system->deleteMutex(csMove); g_system->deleteMutex(_csMove);
CoroScheduler.closeEvent(hEndOfPath); CoroScheduler.closeEvent(_hEndOfPath);
} }
void RMCharacter::linkToBoxes(RMGameBoxes *boxes) { void RMCharacter::linkToBoxes(RMGameBoxes *boxes) {
theBoxes = boxes; _theBoxes = boxes;
} }
/****************************************************************************\ /****************************************************************************\
@ -1698,35 +1698,35 @@ void RMBox::readFromStream(RMDataStream &ds) {
byte b; byte b;
// Bbox // Bbox
ds >> left; ds >> _left;
ds >> top; ds >> _top;
ds >> right; ds >> _right;
ds >> bottom; ds >> _bottom;
// Adjacency // Adjacency
for (i = 0; i < MAXBOXES; i++) { for (i = 0; i < MAXBOXES; i++) {
ds >> adj[i]; ds >> _adj[i];
} }
// Misc // Misc
ds >> numhotspot; ds >> _numHotspot;
ds >> Zvalue; ds >> _destZ;
ds >> b; ds >> b;
attivo = b; _attivo = b;
ds >> b; ds >> b;
bReversed = b; _bReversed = b;
// Reversed expansion space // Reversed expansion space
ds += 30; ds += 30;
// Hotspots // Hotspots
for (i = 0; i < numhotspot; i++) { for (i = 0; i < _numHotspot; i++) {
ds >> w; ds >> w;
hotspot[i].hotx = w; _hotspot[i]._hotx = w;
ds >> w; ds >> w;
hotspot[i].hoty = w; _hotspot[i]._hoty = w;
ds >> w; ds >> w;
hotspot[i].destination = w; _hotspot[i]._destination = w;
} }
} }
@ -1741,11 +1741,11 @@ RMDataStream &operator>>(RMDataStream &ds, RMBox &box) {
\****************************************************************************/ \****************************************************************************/
RMBoxLoc::RMBoxLoc() { RMBoxLoc::RMBoxLoc() {
boxes = NULL; _boxes = NULL;
} }
RMBoxLoc::~RMBoxLoc() { RMBoxLoc::~RMBoxLoc() {
delete[] boxes; delete[] _boxes;
} }
void RMBoxLoc::readFromStream(RMDataStream &ds) { void RMBoxLoc::readFromStream(RMDataStream &ds) {
@ -1762,11 +1762,11 @@ void RMBoxLoc::readFromStream(RMDataStream &ds) {
ds >> numbbox; ds >> numbbox;
// Allocate memory for the boxes // Allocate memory for the boxes
boxes = new RMBox[numbbox]; _boxes = new RMBox[numbbox];
// Read in boxes // Read in boxes
for (i = 0; i < numbbox; i++) for (i = 0; i < numbbox; i++)
ds >> boxes[i]; ds >> _boxes[i];
} }
@ -1774,11 +1774,11 @@ void RMBoxLoc::recalcAllAdj(void) {
int i, j; int i, j;
for (i = 0; i < numbbox; i++) { for (i = 0; i < numbbox; i++) {
Common::fill(boxes[i].adj, boxes[i].adj + MAXBOXES, 0); Common::fill(_boxes[i]._adj, _boxes[i]._adj + MAXBOXES, 0);
for (j = 0; j < boxes[i].numhotspot; j++) for (j = 0; j < _boxes[i]._numHotspot; j++)
if (boxes[boxes[i].hotspot[j].destination].attivo) if (_boxes[_boxes[i]._hotspot[j]._destination]._attivo)
boxes[i].adj[boxes[i].hotspot[j].destination] = 1; _boxes[i]._adj[_boxes[i]._hotspot[j]._destination] = 1;
} }
} }
@ -1833,8 +1833,8 @@ RMBoxLoc *RMGameBoxes::getBoxes(int nLoc) {
bool RMGameBoxes::isInBox(int nLoc, int nBox, const RMPoint &pt) { bool RMGameBoxes::isInBox(int nLoc, int nBox, const RMPoint &pt) {
RMBoxLoc *cur = getBoxes(nLoc); RMBoxLoc *cur = getBoxes(nLoc);
if ((pt.x >= cur->boxes[nBox].left) && (pt.x <= cur->boxes[nBox].right) && if ((pt.x >= cur->_boxes[nBox]._left) && (pt.x <= cur->_boxes[nBox]._right) &&
(pt.y >= cur->boxes[nBox].top) && (pt.y <= cur->boxes[nBox].bottom)) (pt.y >= cur->_boxes[nBox]._top) && (pt.y <= cur->_boxes[nBox]._bottom))
return true; return true;
else else
return false; return false;
@ -1848,16 +1848,16 @@ int RMGameBoxes::whichBox(int nLoc, const RMPoint &punto) {
return -1; return -1;
for (i = 0; i < cur->numbbox; i++) for (i = 0; i < cur->numbbox; i++)
if (cur->boxes[i].attivo) if (cur->_boxes[i]._attivo)
if ((punto.x >= cur->boxes[i].left) && (punto.x <= cur->boxes[i].right) && 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)) (punto.y >= cur->_boxes[i]._top) && (punto.y <= cur->_boxes[i]._bottom))
return i; return i;
return -1; return -1;
} }
void RMGameBoxes::changeBoxStatus(int nLoc, int nBox, int status) { void RMGameBoxes::changeBoxStatus(int nLoc, int nBox, int status) {
_allBoxes[nLoc]->boxes[nBox].attivo = status; _allBoxes[nLoc]->_boxes[nBox]._attivo = status;
_allBoxes[nLoc]->recalcAllAdj(); _allBoxes[nLoc]->recalcAllAdj();
} }
@ -1889,7 +1889,7 @@ void RMGameBoxes::saveState(byte *state) {
state += 4; state += 4;
for (j = 0; j < _allBoxes[i]->numbbox; j++) for (j = 0; j < _allBoxes[i]->numbbox; j++)
*state++ = _allBoxes[i]->boxes[j].attivo; *state++ = _allBoxes[i]->_boxes[j]._attivo;
} }
} }
@ -1910,7 +1910,7 @@ void RMGameBoxes::loadState(byte *state) {
for (j = 0; j < nbox ; j++) { for (j = 0; j < nbox ; j++) {
if (j < _allBoxes[i]->numbbox) if (j < _allBoxes[i]->numbbox)
_allBoxes[i]->boxes[j].attivo = *state; _allBoxes[i]->_boxes[j]._attivo = *state;
state++; state++;
} }
@ -2288,29 +2288,29 @@ RMMessage::RMMessage(uint32 dwId) {
} }
RMMessage::RMMessage() { RMMessage::RMMessage() {
lpMessage = NULL; _lpMessage = NULL;
} }
RMMessage::~RMMessage() { RMMessage::~RMMessage() {
if (lpMessage) if (_lpMessage)
globalDestroy(lpMessage); globalDestroy(_lpMessage);
} }
void RMMessage::load(uint32 dwId) { void RMMessage::load(uint32 dwId) {
lpMessage = mpalQueryMessage(dwId); _lpMessage = mpalQueryMessage(dwId);
assert(lpMessage != NULL); assert(_lpMessage != NULL);
if (lpMessage) if (_lpMessage)
parseMessage(); parseMessage();
} }
void RMMessage::parseMessage(void) { void RMMessage::parseMessage(void) {
char *p; char *p;
assert(lpMessage != NULL); assert(_lpMessage != NULL);
nPeriods = 1; _nPeriods = 1;
p = lpPeriods[0] = lpMessage; p = _lpPeriods[0] = _lpMessage;
for (;;) { for (;;) {
// Find the end of the current period // Find the end of the current period
@ -2323,7 +2323,7 @@ void RMMessage::parseMessage(void) {
break; break;
// Otherwise there is another line, and remember it's start // Otherwise there is another line, and remember it's start
lpPeriods[nPeriods++] = p; _lpPeriods[_nPeriods++] = p;
} }
} }

View file

@ -315,19 +315,19 @@ protected:
class RMBox { class RMBox {
public: public:
struct T_HOTSPOT { struct T_HOTSPOT {
int hotx, hoty; // Hotspot coordinates int _hotx, _hoty; // Hotspot coordinates
int destination; // Hotspot destination int _destination; // Hotspot destination
}; };
public: public:
int left, top, right, bottom; // Vertici bounding boxes int _left, _top, _right, _bottom; // Vertici bounding boxes
int adj[MAXBOXES]; // List of adjacent bounding boxes int _adj[MAXBOXES]; // List of adjacent bounding boxes
int numhotspot; // Hotspot number int _numHotspot; // Hotspot number
uint8 Zvalue; // Z value for the bounding box uint8 _destZ; // Z value for the bounding box
T_HOTSPOT hotspot[MAXHOTSPOT]; // List of hotspots T_HOTSPOT _hotspot[MAXHOTSPOT]; // List of hotspots
bool attivo; bool _attivo;
bool bReversed; bool _bReversed;
private: private:
void readFromStream(RMDataStream &ds); void readFromStream(RMDataStream &ds);
@ -340,7 +340,7 @@ public:
class RMBoxLoc { class RMBoxLoc {
public: public:
int numbbox; int numbbox;
RMBox *boxes; RMBox *_boxes;
private: private:
void readFromStream(RMDataStream &ds); void readFromStream(RMDataStream &ds);
@ -405,26 +405,26 @@ private:
WALK WALK
}; };
signed short walkcount; signed short _walkCount;
int dx, dy, olddx, olddy; int _dx, _dy, _olddx, _olddy;
float fx, fy, slope; float _fx, _fy, _slope;
RMPoint linestart, lineend, pathend; RMPoint _lineStart, _lineEnd, _pathEnd;
signed char walkspeed, walkstatus; signed char _walkSpeed, _walkStatus;
char minpath; char _minPath;
short nextbox; short _nextBox;
short path[MAXBOXES]; short _path[MAXBOXES];
short pathlenght, pathcount; short _pathLength, _pathCount;
int curbox; int _curBox;
STATUS status; STATUS _status;
int curSpeed; int _curSpeed;
bool bEndOfPath; bool _bEndOfPath;
uint32 hEndOfPath; uint32 _hEndOfPath;
OSystem::MutexRef csMove; OSystem::MutexRef _csMove;
int curLocation; int _curLocation;
bool bRemoveFromOT; bool _bRemoveFromOT;
bool bMovingWithoutMinpath; bool _bMovingWithoutMinpath;
RMGameBoxes *theBoxes; RMGameBoxes *_theBoxes;
RMPoint _fixedScroll; RMPoint _fixedScroll;
@ -443,9 +443,9 @@ private:
void newBoxEntered(int nBox); void newBoxEntered(int nBox);
protected: protected:
bool bMoving; bool _bMoving;
bool bDrawNow; bool _bDrawNow;
bool bNeedToStop; bool _bNeedToStop;
// virtual RMGfxPrimitive *NewItemPrimitive(); // virtual RMGfxPrimitive *NewItemPrimitive();
public: public:
@ -464,7 +464,7 @@ public:
// TRUE if you just stopped // TRUE if you just stopped
bool endOfPath() { bool endOfPath() {
return bEndOfPath; return _bEndOfPath;
} }
// Change the pattern of a character to STOP // Change the pattern of a character to STOP
@ -472,7 +472,7 @@ public:
// Check if the character is moving // Check if the character is moving
bool isMoving() { bool isMoving() {
return bMoving; return _bMoving;
} }
// Move the character to a certain position // Move the character to a certain position
@ -488,7 +488,7 @@ public:
_fixedScroll = fix; _fixedScroll = fix;
} }
void setSpeed(int speed) { void setSpeed(int speed) {
curSpeed = speed; _curSpeed = speed;
} }
}; };
@ -601,9 +601,9 @@ public:
*/ */
class RMMessage { class RMMessage {
private: private:
char *lpMessage; char *_lpMessage;
char *lpPeriods[256]; char *_lpPeriods[256];
int nPeriods; int _nPeriods;
private: private:
void parseMessage(void); void parseMessage(void);
@ -615,16 +615,16 @@ public:
void load(uint32 dwId); void load(uint32 dwId);
bool isValid() { bool isValid() {
return lpMessage != NULL; return _lpMessage != NULL;
} }
int numPeriods() { int numPeriods() {
return nPeriods; return _nPeriods;
} }
char *period(int num) { char *period(int num) {
return lpPeriods[num]; return _lpPeriods[num];
} }
char *operator[](int num) { char *operator[](int num) {
return lpPeriods[num]; return _lpPeriods[num];
} }
}; };

View file

@ -490,7 +490,7 @@ static LPITEM getItemData(uint32 nOrdItem) {
ret = (LPITEM)globalAlloc(GMEM_FIXED | GMEM_ZEROINIT, sizeof(ITEM)); ret = (LPITEM)globalAlloc(GMEM_FIXED | GMEM_ZEROINIT, sizeof(ITEM));
if (ret == NULL) if (ret == NULL)
return NULL; return NULL;
ret->speed = 150; ret->_speed = 150;
hDat = resLoad(curitem->dwRes); hDat = resLoad(curitem->dwRes);
dat = (char *)globalLock(hDat); dat = (char *)globalLock(hDat);
@ -500,65 +500,65 @@ static LPITEM getItemData(uint32 nOrdItem) {
dat += 4; dat += 4;
if (i >= 0x10) { // From 1.0, there's a destination point for each object if (i >= 0x10) { // From 1.0, there's a destination point for each object
ret->destX = (int16)READ_LE_UINT16(dat); ret->_destX = (int16)READ_LE_UINT16(dat);
ret->destY = (int16)READ_LE_UINT16(dat + 2); ret->_destY = (int16)READ_LE_UINT16(dat + 2);
dat += 4; dat += 4;
} }
if (i >= 0x11) { // From 1.1, there's animation speed if (i >= 0x11) { // From 1.1, there's animation speed
ret->speed = READ_LE_UINT16(dat); ret->_speed = READ_LE_UINT16(dat);
dat += 2; dat += 2;
} else } else
ret->speed = 150; ret->_speed = 150;
} }
ret->numframe = *dat++; ret->_numframe = *dat++;
ret->numpattern = *dat++; ret->_numpattern = *dat++;
ret->Zvalue = *dat++; ret->_destZ = *dat++;
// Upload the left & top co-ordinates of each frame // Upload the left & top co-ordinates of each frame
for (i = 0; i < ret->numframe; i++) { for (i = 0; i < ret->_numframe; i++) {
ret->frameslocations[i].left = (int16)READ_LE_UINT16(dat); ret->_frameslocations[i].left = (int16)READ_LE_UINT16(dat);
ret->frameslocations[i].top = (int16)READ_LE_UINT16(dat + 2); ret->_frameslocations[i].top = (int16)READ_LE_UINT16(dat + 2);
dat += 4; dat += 4;
} }
// Upload the size of each frame and calculate the right & bottom // Upload the size of each frame and calculate the right & bottom
for (i = 0; i < ret->numframe; i++) { for (i = 0; i < ret->_numframe; i++) {
ret->frameslocations[i].right = (int16)READ_LE_UINT16(dat) + ret->frameslocations[i].left; ret->_frameslocations[i].right = (int16)READ_LE_UINT16(dat) + ret->_frameslocations[i].left;
ret->frameslocations[i].bottom = (int16)READ_LE_UINT16(dat + 2) + ret->frameslocations[i].top; ret->_frameslocations[i].bottom = (int16)READ_LE_UINT16(dat + 2) + ret->_frameslocations[i].top;
dat += 4; dat += 4;
} }
// Upload the bounding boxes of each frame // Upload the bounding boxes of each frame
for (i = 0; i < ret->numframe; i++) { for (i = 0; i < ret->_numframe; i++) {
ret->bbox[i].left = (int16)READ_LE_UINT16(dat); ret->_bbox[i].left = (int16)READ_LE_UINT16(dat);
ret->bbox[i].top = (int16)READ_LE_UINT16(dat + 2); ret->_bbox[i].top = (int16)READ_LE_UINT16(dat + 2);
ret->bbox[i].right = (int16)READ_LE_UINT16(dat + 4); ret->_bbox[i].right = (int16)READ_LE_UINT16(dat + 4);
ret->bbox[i].bottom = (int16)READ_LE_UINT16(dat + 6); ret->_bbox[i].bottom = (int16)READ_LE_UINT16(dat + 6);
dat += 8; dat += 8;
} }
// Load the animation pattern // Load the animation pattern
patlength = dat; patlength = dat;
dat += ret->numpattern; dat += ret->_numpattern;
for (i = 1; i < ret->numpattern; i++) { for (i = 1; i < ret->_numpattern; i++) {
for (j = 0; j < patlength[i]; j++) for (j = 0; j < patlength[i]; j++)
ret->pattern[i][j] = dat[j]; ret->_pattern[i][j] = dat[j];
ret->pattern[i][(int)patlength[i]] = 255; // Terminate pattern ret->_pattern[i][(int)patlength[i]] = 255; // Terminate pattern
dat += patlength[i]; dat += patlength[i];
} }
// Upload the individual frames of animations // Upload the individual frames of animations
for (i = 1; i < ret->numframe; i++) { for (i = 1; i < ret->_numframe; i++) {
dim = (uint32)(ret->frameslocations[i].right-ret->frameslocations[i].left) * dim = (uint32)(ret->_frameslocations[i].right - ret->_frameslocations[i].left) *
(uint32)(ret->frameslocations[i].bottom-ret->frameslocations[i].top); (uint32)(ret->_frameslocations[i].bottom - ret->_frameslocations[i].top);
ret->frames[i] = (char *)globalAlloc(GMEM_FIXED,dim); ret->_frames[i] = (char *)globalAlloc(GMEM_FIXED,dim);
if (ret->frames[i] == NULL) if (ret->_frames[i] == NULL)
return NULL; return NULL;
copyMemory(ret->frames[i], dat, dim); copyMemory(ret->_frames[i], dat, dim);
dat += dim; dat += dim;
} }

View file

@ -152,19 +152,19 @@ enum QueryTypes {
* Framework to manage the animation of an item * Framework to manage the animation of an item
*/ */
typedef struct { typedef struct {
char *frames[MAXFRAMES]; char *_frames[MAXFRAMES];
Common::Rect frameslocations[MAXFRAMES]; Common::Rect _frameslocations[MAXFRAMES];
Common::Rect bbox[MAXFRAMES]; Common::Rect _bbox[MAXFRAMES];
short pattern[MAXPATTERN][MAXFRAMES]; short _pattern[MAXPATTERN][MAXFRAMES];
short speed; short _speed;
char numframe; char _numframe;
char numpattern; char _numpattern;
char curframe; char _curframe;
char curpattern; char _curpattern;
short destX, destY; short _destX, _destY;
signed char Zvalue; signed char _destZ;
short objectID; short _objectID;
char TAG; // char TAG;
} ITEM; } ITEM;
typedef ITEM *LPITEM; typedef ITEM *LPITEM;

View file

@ -178,7 +178,7 @@ void RMTony::draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim) {
CORO_BEGIN_CODE(_ctx); CORO_BEGIN_CODE(_ctx);
// Call the Draw() of the parent class if Tony is visible // Call the Draw() of the parent class if Tony is visible
if (_bShow && bDrawNow) { if (_bShow && _bDrawNow) {
if (_bCorpoDavanti) { if (_bCorpoDavanti) {
prim->getDst().setEmpty(); prim->getDst().setEmpty();
prim->getDst().offset(-44, -134); prim->getDst().offset(-44, -134);
@ -317,8 +317,8 @@ void RMTony::stop(CORO_PARAM) {
if (_ctx->pid == CORO_INVALID_PID_VALUE) if (_ctx->pid == CORO_INVALID_PID_VALUE)
CORO_INVOKE_0(RMCharacter::stop); CORO_INVOKE_0(RMCharacter::stop);
else { else {
bNeedToStop = false; // If we make the OnWhichDirection, we don't need at least after the Stop(). _bNeedToStop = false; // If we make the OnWhichDirection, we don't need at least after the Stop().
bMoving = false; _bMoving = false;
CORO_INVOKE_2(CoroScheduler.waitForSingleObject, _ctx->pid, CORO_INFINITE); // @@@ Put an assert after 10 seconds CORO_INVOKE_2(CoroScheduler.waitForSingleObject, _ctx->pid, CORO_INFINITE); // @@@ Put an assert after 10 seconds
} }
} else { } else {