aboutsummaryrefslogtreecommitdiff
path: root/scumm/actor.cpp
diff options
context:
space:
mode:
authorEugene Sandulenko2005-03-11 01:10:06 +0000
committerEugene Sandulenko2005-03-11 01:10:06 +0000
commit154c4af8dc2d561050a5a963e2b45403cda618dc (patch)
tree0c4b41ed77afeb42036fdba990805b180edc7c24 /scumm/actor.cpp
parent3cf691e9f9d0aafad14b76272201a0cfac2e8a76 (diff)
downloadscummvm-rg350-154c4af8dc2d561050a5a963e2b45403cda618dc.tar.gz
scummvm-rg350-154c4af8dc2d561050a5a963e2b45403cda618dc.tar.bz2
scummvm-rg350-154c4af8dc2d561050a5a963e2b45403cda618dc.zip
Mass-renamed all variables of Actor object according to our current code
formatting standards. Earlier we had half of vars named with leading underscore and half without it. Now code in actor.cpp is considerably more readable. svn-id: r17068
Diffstat (limited to 'scumm/actor.cpp')
-rw-r--r--scumm/actor.cpp888
1 files changed, 444 insertions, 444 deletions
diff --git a/scumm/actor.cpp b/scumm/actor.cpp
index 987cf752e5..c6d1497efc 100644
--- a/scumm/actor.cpp
+++ b/scumm/actor.cpp
@@ -47,7 +47,7 @@ void Actor::initActorClass(ScummEngine *scumm) {
Actor::Actor() {
assert(_vm != 0);
- number = 0;
+ _number = 0;
initActor(-1);
}
@@ -55,53 +55,53 @@ Actor::Actor() {
void Actor::initActor(int mode) {
if (mode == -1) {
_offsX = _offsY = 0;
- top = bottom = 0;
- needRedraw = needBgReset = costumeNeedsInit = visible = false;
- flip = false;
- speedx = 8;
- speedy = 2;
- frame = 0;
+ _top = _bottom = 0;
+ _needRedraw = _needBgReset = _costumeNeedsInit = _visible = false;
+ _flip = false;
+ _speedx = 8;
+ _speedy = 2;
+ _frame = 0;
_walkbox = 0;
- animProgress = 0;
- heSkipLimbs = false;
- drawToBackBuf = false;
- memset(animVariable, 0, sizeof(animVariable));
- memset(palette, 0, sizeof(palette));
- memset(sound, 0, sizeof(sound));
- memset(&cost, 0, sizeof(CostumeData));
- memset(&walkdata, 0, sizeof(ActorWalkData));
- walkdata.point3.x = 32000;
- walkScript = 0;
- memset(heTalkQueue, 0, sizeof(heTalkQueue));
+ _animProgress = 0;
+ _heSkipLimbs = false;
+ _drawToBackBuf = false;
+ memset(_animVariable, 0, sizeof(_animVariable));
+ memset(_palette, 0, sizeof(_palette));
+ memset(_sound, 0, sizeof(_sound));
+ memset(&_cost, 0, sizeof(CostumeData));
+ memset(&_walkdata, 0, sizeof(ActorWalkData));
+ _walkdata.point3.x = 32000;
+ _walkScript = 0;
+ memset(_heTalkQueue, 0, sizeof(_heTalkQueue));
mode = 1;
}
if (mode == 1) {
- costume = 0;
- room = 0;
+ _costume = 0;
+ _room = 0;
_pos.x = 0;
_pos.y = 0;
- facing = 180;
- heCondMask = 1;
- heNoTalkAnimation = 0;
+ _facing = 180;
+ _heCondMask = 1;
+ _heNoTalkAnimation = 0;
if (_vm->_version >= 7)
- visible = false;
- heSkipLimbs = false;
+ _visible = false;
+ _heSkipLimbs = false;
} else if (mode == 2) {
- facing = 180;
- heCondMask = 1;
- heSkipLimbs = false;
+ _facing = 180;
+ _heCondMask = 1;
+ _heSkipLimbs = false;
}
_elevation = 0;
- width = 24;
- talkColor = 15;
- talkPosX = 0;
- talkPosY = -80;
- boxscale = scaley = scalex = 0xFF;
- charset = 0;
- memset(sound, 0, sizeof(sound));
- targetFacing = facing;
+ _width = 24;
+ _talkColor = 15;
+ _talkPosX = 0;
+ _talkPosY = -80;
+ _boxscale = _scaley = _scalex = 0xFF;
+ _charset = 0;
+ memset(_sound, 0, sizeof(_sound));
+ _targetFacing = _facing;
stopActorMoving();
@@ -109,20 +109,20 @@ void Actor::initActor(int mode) {
_layer = 0;
setActorWalkSpeed(8, 2);
- animSpeed = 0;
+ _animSpeed = 0;
if (_vm->_version >= 6)
- animProgress = 0;
+ _animProgress = 0;
- ignoreBoxes = false;
- forceClip = (_vm->_version >= 7) ? 100 : 0;
- ignoreTurns = false;
+ _ignoreBoxes = false;
+ _forceClip = (_vm->_version >= 7) ? 100 : 0;
+ _ignoreTurns = false;
if (_vm->_features & GF_HUMONGOUS)
- flip = 0;
+ _flip = 0;
- talkFrequency = 256;
- talkPan = 64;
- talkVolume = 127;
+ _talkFrequency = 256;
+ _talkPan = 64;
+ _talkVolume = 127;
if (_vm->_version <= 2) {
_initFrame = 2;
@@ -139,32 +139,32 @@ void Actor::initActor(int mode) {
}
_heTalking = false;
- walkScript = 0;
- talkScript = 0;
+ _walkScript = 0;
+ _talkScript = 0;
_clipOverride = _vm->_actorClipOverride;
- auxBlock.visible = false;
- hePaletteNum = 0;
+ _auxBlock.visible = false;
+ _hePaletteNum = 0;
- _vm->_classData[number] = (_vm->_version >= 7) ? _vm->_classData[0] : 0;
+ _vm->_classData[_number] = (_vm->_version >= 7) ? _vm->_classData[0] : 0;
}
void Actor::stopActorMoving() {
- if (walkScript)
- _vm->stopScript(walkScript);
- moving = 0;
+ if (_walkScript)
+ _vm->stopScript(_walkScript);
+ _moving = 0;
}
void Actor::setActorWalkSpeed(uint newSpeedX, uint newSpeedY) {
- if (newSpeedX == speedx && newSpeedY == speedy)
+ if (newSpeedX == _speedx && newSpeedY == _speedy)
return;
- speedx = newSpeedX;
- speedy = newSpeedY;
+ _speedx = newSpeedX;
+ _speedy = newSpeedY;
- if (moving) {
- calcMovementFactor(walkdata.next);
+ if (_moving) {
+ calcMovementFactor(_walkdata.next);
}
}
@@ -186,16 +186,16 @@ int ScummEngine::getAngleFromPos(int x, int y) const {
}
int Actor::calcMovementFactor(const Common::Point& next) {
- Common::Point actorPos(_pos);
+ Common::Point _actorPos(_pos);
int diffX, diffY;
int32 deltaXFactor, deltaYFactor;
- if (actorPos == next)
+ if (_actorPos == next)
return 0;
- diffX = next.x - actorPos.x;
- diffY = next.y - actorPos.y;
- deltaYFactor = speedy << 16;
+ diffX = next.x - _actorPos.x;
+ diffY = next.y - _actorPos.y;
+ deltaYFactor = _speedy << 16;
if (diffY < 0)
deltaYFactor = -deltaYFactor;
@@ -207,8 +207,8 @@ int Actor::calcMovementFactor(const Common::Point& next) {
deltaYFactor = 0;
}
- if ((uint) abs((int)(deltaXFactor >> 16)) > speedx) {
- deltaXFactor = speedx << 16;
+ if ((uint) abs((int)(deltaXFactor >> 16)) > _speedx) {
+ deltaXFactor = _speedx << 16;
if (diffX < 0)
deltaXFactor = -deltaXFactor;
@@ -220,14 +220,14 @@ int Actor::calcMovementFactor(const Common::Point& next) {
}
}
- walkdata.cur = actorPos;
- walkdata.next = next;
- walkdata.deltaXFactor = deltaXFactor;
- walkdata.deltaYFactor = deltaYFactor;
- walkdata.xfrac = 0;
- walkdata.yfrac = 0;
+ _walkdata.cur = _actorPos;
+ _walkdata.next = next;
+ _walkdata.deltaXFactor = deltaXFactor;
+ _walkdata.deltaYFactor = deltaYFactor;
+ _walkdata.xfrac = 0;
+ _walkdata.yfrac = 0;
- targetFacing = _vm->getAngleFromPos(deltaXFactor, deltaYFactor);
+ _targetFacing = _vm->getAngleFromPos(deltaXFactor, deltaYFactor);
return actorWalkStep();
}
@@ -239,7 +239,7 @@ int Actor::remapDirection(int dir, bool is_walking) {
bool flipY;
// FIXME - It seems that at least in The Dig the original code does
- // check ignoreBoxes here. However, it breaks some animations in Loom,
+ // check _ignoreBoxes here. However, it breaks some animations in Loom,
// causing Bobbin to face towards the camera instead of away from it
// in some places: After the tree has been destroyed by lightning, and
// when entering the dark tunnels beyond the dragon's lair at the very
@@ -249,7 +249,7 @@ int Actor::remapDirection(int dir, bool is_walking) {
// not necessary here because we never call the function unless the
// actor is in the current room anyway.
- if (!ignoreBoxes || (_vm->_gameId == GID_LOOM || _vm->_gameId == GID_LOOM256)) {
+ if (!_ignoreBoxes || (_vm->_gameId == GID_LOOM || _vm->_gameId == GID_LOOM256)) {
specdir = _vm->_extraBoxFlags[_walkbox];
if (specdir) {
if (specdir & 0x8000) {
@@ -265,8 +265,8 @@ int Actor::remapDirection(int dir, bool is_walking) {
flags = _vm->getBoxFlags(_walkbox);
- flipX = (walkdata.deltaXFactor > 0);
- flipY = (walkdata.deltaYFactor > 0);
+ flipX = (_walkdata.deltaXFactor > 0);
+ flipY = (_walkdata.deltaYFactor > 0);
// Check for X-Flip
if ((flags & kBoxXFlip) || isInClass(kObjectClassXFlip)) {
@@ -324,13 +324,13 @@ int Actor::updateActorDirection(bool is_walking) {
int dir;
bool shouldInterpolate;
- if ((_vm->_version == 6) && ignoreTurns)
- return facing;
+ if ((_vm->_version == 6) && _ignoreTurns)
+ return _facing;
- dirType = (_vm->_version >= 7) ? _vm->akos_hasManyDirections(costume) : false;
+ dirType = (_vm->_version >= 7) ? _vm->akos_hasManyDirections(_costume) : false;
- from = toSimpleDir(dirType, facing);
- dir = remapDirection(targetFacing, is_walking);
+ from = toSimpleDir(dirType, _facing);
+ dir = remapDirection(_targetFacing, is_walking);
if (_vm->_version >= 7)
// Direction interpolation interfers with walk scripts in Dig; they perform
@@ -368,51 +368,51 @@ void Actor::setBox(int box) {
int Actor::actorWalkStep() {
int tmpX, tmpY;
- Common::Point actorPos;
+ Common::Point _actorPos;
int distX, distY;
int nextFacing;
- needRedraw = true;
+ _needRedraw = true;
nextFacing = updateActorDirection(true);
- if (!(moving & MF_IN_LEG) || facing != nextFacing) {
- if (_walkFrame != frame || facing != nextFacing) {
+ if (!(_moving & MF_IN_LEG) || _facing != nextFacing) {
+ if (_walkFrame != _frame || _facing != nextFacing) {
startWalkAnim(1, nextFacing);
}
- moving |= MF_IN_LEG;
+ _moving |= MF_IN_LEG;
}
- actorPos = _pos;
+ _actorPos = _pos;
- if (_walkbox != walkdata.curbox && _vm->checkXYInBoxBounds(walkdata.curbox, actorPos.x, actorPos.y)) {
- setBox(walkdata.curbox);
+ if (_walkbox != _walkdata.curbox && _vm->checkXYInBoxBounds(_walkdata.curbox, _actorPos.x, _actorPos.y)) {
+ setBox(_walkdata.curbox);
}
- distX = abs(walkdata.next.x - walkdata.cur.x);
- distY = abs(walkdata.next.y - walkdata.cur.y);
+ distX = abs(_walkdata.next.x - _walkdata.cur.x);
+ distY = abs(_walkdata.next.y - _walkdata.cur.y);
- if (abs(actorPos.x - walkdata.cur.x) >= distX && abs(actorPos.y - walkdata.cur.y) >= distY) {
- moving &= ~MF_IN_LEG;
+ if (abs(_actorPos.x - _walkdata.cur.x) >= distX && abs(_actorPos.y - _walkdata.cur.y) >= distY) {
+ _moving &= ~MF_IN_LEG;
return 0;
}
- tmpX = (actorPos.x << 16) + walkdata.xfrac + (walkdata.deltaXFactor >> 8) * scalex;
- walkdata.xfrac = (uint16)tmpX;
- actorPos.x = (tmpX >> 16);
+ tmpX = (_actorPos.x << 16) + _walkdata.xfrac + (_walkdata.deltaXFactor >> 8) * _scalex;
+ _walkdata.xfrac = (uint16)tmpX;
+ _actorPos.x = (tmpX >> 16);
- tmpY = (actorPos.y << 16) + walkdata.yfrac + (walkdata.deltaYFactor >> 8) * scaley;
- walkdata.yfrac = (uint16)tmpY;
- actorPos.y = (tmpY >> 16);
+ tmpY = (_actorPos.y << 16) + _walkdata.yfrac + (_walkdata.deltaYFactor >> 8) * _scaley;
+ _walkdata.yfrac = (uint16)tmpY;
+ _actorPos.y = (tmpY >> 16);
- if (abs(actorPos.x - walkdata.cur.x) > distX) {
- actorPos.x = walkdata.next.x;
+ if (abs(_actorPos.x - _walkdata.cur.x) > distX) {
+ _actorPos.x = _walkdata.next.x;
}
- if (abs(actorPos.y - walkdata.cur.y) > distY) {
- actorPos.y = walkdata.next.y;
+ if (abs(_actorPos.y - _walkdata.cur.y) > distY) {
+ _actorPos.y = _walkdata.next.y;
}
- _pos = actorPos;
+ _pos = _actorPos;
return 1;
}
@@ -420,12 +420,12 @@ int Actor::actorWalkStep() {
void Actor::setupActorScale() {
if (_vm->_features & GF_NO_SCALING) {
- scalex = 0xFF;
- scaley = 0xFF;
+ _scalex = 0xFF;
+ _scaley = 0xFF;
return;
}
- if (ignoreBoxes)
+ if (_ignoreBoxes)
return;
// For some boxes, we ignore the scaling and use whatever values the
@@ -434,12 +434,12 @@ void Actor::setupActorScale() {
if (_vm->_gameId == GID_SAMNMAX && (_vm->getBoxFlags(_walkbox) & kBoxIgnoreScale))
return;
- boxscale = _vm->getBoxScale(_walkbox);
+ _boxscale = _vm->getBoxScale(_walkbox);
uint16 scale = _vm->getScale(_walkbox, _pos.x, _pos.y);
assert(scale <= 0xFF);
- scalex = scaley = (byte)scale;
+ _scalex = _scaley = (byte)scale;
}
void Actor::startAnimActor(int f) {
@@ -462,13 +462,13 @@ void Actor::startAnimActor(int f) {
break;
}
- if (costume != 0) {
- animProgress = 0;
- needRedraw = true;
+ if (_costume != 0) {
+ _animProgress = 0;
+ _needRedraw = true;
if (f == _initFrame)
- cost.reset();
+ _cost.reset();
_vm->akos_decodeData(this, f, (uint) - 1);
- frame = f;
+ _frame = f;
}
} else {
switch (f) {
@@ -491,21 +491,21 @@ void Actor::startAnimActor(int f) {
assert(f != 0x3E);
- if (isInCurrentRoom() && costume != 0) {
- animProgress = 0;
- cost.animCounter = 0;
- needRedraw = true;
- // V1 - V2 games don't seem to need a cost.reset() at this point.
+ if (isInCurrentRoom() && _costume != 0) {
+ _animProgress = 0;
+ _cost.animCounter = 0;
+ _needRedraw = true;
+ // V1 - V2 games don't seem to need a _cost.reset() at this point.
// Causes Zak to lose his body in several scenes, see bug #771508
if (_vm->_version >= 3 && f == _initFrame) {
- cost.reset();
- auxBlock.visible = false;
+ _cost.reset();
+ _auxBlock.visible = false;
}
if (_vm->_features & GF_NEW_COSTUMES)
_vm->akos_decodeData(this, f, (uint) - 1);
else
_vm->cost_decodeData(this, f, (uint) - 1);
- frame = f;
+ _frame = f;
}
}
}
@@ -537,7 +537,7 @@ void Actor::animateActor(int anim) {
stopActorMoving();
break;
case 3: // change direction immediatly
- moving &= ~MF_TURN;
+ _moving &= ~MF_TURN;
setDirection(dir);
break;
case 4: // turn to new direction
@@ -557,20 +557,20 @@ void Actor::setDirection(int direction) {
uint16 vald;
// Do nothing if actor is already facing in the given direction
- if (facing == direction)
+ if (_facing == direction)
return;
// Normalize the angle
- facing = normalizeAngle(direction);
+ _facing = normalizeAngle(direction);
// If there is no costume set for this actor, we are finished
- if (costume == 0)
+ if (_costume == 0)
return;
// Update the costume for the new direction (and mark the actor for redraw)
aMask = 0x8000;
for (i = 0; i < 16; i++, aMask >>= 1) {
- vald = cost.frame[i];
+ vald = _cost.frame[i];
if (vald == 0xFFFF)
continue;
if (_vm->_features & GF_NEW_COSTUMES)
@@ -579,32 +579,32 @@ void Actor::setDirection(int direction) {
_vm->cost_decodeData(this, vald, (_vm->_version <= 2) ? 0xFFFF : aMask);
}
- needRedraw = true;
+ _needRedraw = true;
}
void Actor::putActor(int dstX, int dstY, byte newRoom) {
- if (visible && _vm->_currentRoom != newRoom && _vm->getTalkingActor() == number) {
+ if (_visible && _vm->_currentRoom != newRoom && _vm->getTalkingActor() == _number) {
_vm->stopTalk();
}
// WORKAROUND: The green transparency of the tank in the Hall of Oddities is
// is positioned one pixel too far to the left. This appears to be a
// bug in the original game as well.
- if (_vm->_gameId == GID_SAMNMAX && newRoom == 16 && number == 5 && dstX == 235 && dstY == 236)
+ if (_vm->_gameId == GID_SAMNMAX && newRoom == 16 && _number == 5 && dstX == 235 && dstY == 236)
dstX++;
_pos.x = dstX;
_pos.y = dstY;
- room = newRoom;
- needRedraw = true;
+ _room = newRoom;
+ _needRedraw = true;
- if (_vm->VAR(_vm->VAR_EGO) == number) {
+ if (_vm->VAR(_vm->VAR_EGO) == _number) {
_vm->_egoPositioned = true;
}
- if (visible) {
+ if (_visible) {
if (isInCurrentRoom()) {
- if (moving) {
+ if (_moving) {
stopActorMoving();
startAnimActor(_standFrame);
}
@@ -642,7 +642,7 @@ AdjustBoxResult Actor::adjustXYToBeInBox(int dstX, int dstY) {
abr.y = dstY;
abr.box = kInvalidBox;
- if (ignoreBoxes)
+ if (_ignoreBoxes)
return abr;
for (int tIdx = 0; tIdx < ARRAYSIZE(thresholdTable); tIdx++) {
@@ -716,19 +716,19 @@ void Actor::adjustActorPos() {
_pos.x = abr.x;
_pos.y = abr.y;
- walkdata.destbox = abr.box;
+ _walkdata.destbox = abr.box;
setBox(abr.box);
- walkdata.dest.x = -1;
+ _walkdata.dest.x = -1;
stopActorMoving();
- cost.soundCounter = 0;
+ _cost.soundCounter = 0;
if (_walkbox != kInvalidBox) {
byte flags = _vm->getBoxFlags(_walkbox);
if (flags & 7) {
- turnToDirection(facing);
+ turnToDirection(_facing);
}
}
}
@@ -747,59 +747,59 @@ void Actor::faceToObject(int obj) {
}
void Actor::turnToDirection(int newdir) {
- if (newdir == -1 || ignoreTurns)
+ if (newdir == -1 || _ignoreTurns)
return;
- moving &= ~MF_TURN;
+ _moving &= ~MF_TURN;
- if (newdir != facing) {
+ if (newdir != _facing) {
if (_vm->_version <= 3)
- moving = MF_TURN;
+ _moving = MF_TURN;
else
- moving |= MF_TURN;
- targetFacing = newdir;
+ _moving |= MF_TURN;
+ _targetFacing = newdir;
}
}
void Actor::hideActor() {
- if (!visible)
+ if (!_visible)
return;
- if (moving) {
+ if (_moving) {
stopActorMoving();
startAnimActor(_standFrame);
}
- visible = false;
- cost.soundCounter = 0;
- needRedraw = false;
- needBgReset = true;
- auxBlock.visible = false;
+ _visible = false;
+ _cost.soundCounter = 0;
+ _needRedraw = false;
+ _needBgReset = true;
+ _auxBlock.visible = false;
}
void Actor::showActor() {
- if (_vm->_currentRoom == 0 || visible)
+ if (_vm->_currentRoom == 0 || _visible)
return;
adjustActorPos();
- _vm->ensureResourceLoaded(rtCostume, costume);
+ _vm->ensureResourceLoaded(rtCostume, _costume);
- if (costumeNeedsInit) {
+ if (_costumeNeedsInit) {
startAnimActor(_initFrame);
if (_vm->_version <= 2) {
startAnimActor(_standFrame);
startAnimActor(_talkStopFrame);
}
- costumeNeedsInit = false;
+ _costumeNeedsInit = false;
}
// FIXME: Evil hack to work around bug #770717
- if (!moving && _vm->_version <= 2)
+ if (!_moving && _vm->_version <= 2)
startAnimActor(_standFrame);
stopActorMoving();
- visible = true;
- needRedraw = true;
+ _visible = true;
+ _needRedraw = true;
}
// V1 Maniac doesn't have a ScummVar for VAR_TALK_ACTOR, and just uses
@@ -825,7 +825,7 @@ void ScummEngine::putActors() {
for (i = 1; i < _numActors; i++) {
a = &_actors[i];
if (a && a->isInCurrentRoom())
- a->putActor(a->_pos.x, a->_pos.y, a->room);
+ a->putActor(a->_pos.x, a->_pos.y, a->_room);
}
}
@@ -837,7 +837,7 @@ void ScummEngine::setupV1ActorTalkColor() {
int i;
for (i = 1; i < _numActors; i++)
- _actors[i].talkColor = v1MMActorTalkColor[i];
+ _actors[i]._talkColor = v1MMActorTalkColor[i];
}
void ScummEngine::showActors() {
@@ -866,11 +866,11 @@ void ScummEngine::playActorSounds() {
int i;
for (i = 1; i < _numActors; i++) {
- if (_actors[i].cost.soundCounter && _actors[i].isInCurrentRoom() && _actors[i].sound) {
+ if (_actors[i]._cost.soundCounter && _actors[i].isInCurrentRoom() && _actors[i]._sound) {
_currentScript = 0xFF;
- _sound->addSoundToQueue(_actors[i].sound[0]);
+ _sound->addSoundToQueue(_actors[i]._sound[0]);
for (i = 1; i < _numActors; i++) {
- _actors[i].cost.soundCounter = 0;
+ _actors[i]._cost.soundCounter = 0;
}
return;
}
@@ -882,7 +882,7 @@ Actor *ScummEngine::derefActor(int id, const char *errmsg) const {
debugC(DEBUG_ACTORS, "derefActor(0, \"%s\") in script %d, opcode 0x%x",
errmsg, vm.slot[_curExecScript].number, _opcode);
- if (id < 0 || id >= _numActors || _actors[id].number != id) {
+ if (id < 0 || id >= _numActors || _actors[id]._number != id) {
if (errmsg)
error("Invalid actor %d in %s", id, errmsg);
else
@@ -896,7 +896,7 @@ Actor *ScummEngine::derefActorSafe(int id, const char *errmsg) const {
debugC(DEBUG_ACTORS, "derefActorSafe(0, \"%s\") in script %d, opcode 0x%x",
errmsg, vm.slot[_curExecScript].number, _opcode);
- if (id < 0 || id >= _numActors || _actors[id].number != id) {
+ if (id < 0 || id >= _numActors || _actors[id]._number != id) {
debugC(DEBUG_ACTORS, "Invalid actor %d in %s (script %d, opcode 0x%x)",
id, errmsg, vm.slot[_curExecScript].number, _opcode);
return NULL;
@@ -928,7 +928,7 @@ static int compareDrawOrder(const void* a, const void* b)
// Would be interesting if somebody could check the disassembly (see also the
// comment on the above mentioned tracker item).
if (g_scumm->_gameId == GID_TENTACLE) {
- diff = actor1->forceClip - actor2->forceClip;
+ diff = actor1->_forceClip - actor2->_forceClip;
if (diff < 0)
return -1;
if (diff > 0)
@@ -940,7 +940,7 @@ static int compareDrawOrder(const void* a, const void* b)
// actor number as tie-breaker. This is needed for the Sam & Max intro,
// and possibly other cases as well. See bug #758167.
- return actor1->number - actor2->number;
+ return actor1->_number - actor2->_number;
}
void ScummEngine::processActors() {
@@ -957,7 +957,7 @@ void ScummEngine::processActors() {
for (int i = 1; i < _numActors; i++) {
if (_version == 8 && _actors[i]._layer < 0)
continue;
- if (_actors[i].isInCurrentRoom() && _actors[i].costume)
+ if (_actors[i].isInCurrentRoom() && _actors[i]._costume)
actors[numactors++] = &_actors[i];
}
if (!numactors) {
@@ -992,7 +992,7 @@ void ScummEngine::processUpperActors() {
int i;
for (i = 1; i < _numActors; i++) {
- if (_actors[i].isInCurrentRoom() && _actors[i].costume && _actors[i]._layer < 0) {
+ if (_actors[i].isInCurrentRoom() && _actors[i]._costume && _actors[i]._layer < 0) {
CHECK_HEAP
_actors[i].drawActorCostume();
CHECK_HEAP
@@ -1003,17 +1003,17 @@ void ScummEngine::processUpperActors() {
void Actor::drawActorCostume(bool hitTestMode) {
if (!hitTestMode) {
- if (!needRedraw)
+ if (!_needRedraw)
return;
- needRedraw = false;
+ _needRedraw = false;
}
setupActorScale();
BaseCostumeRenderer* bcr = _vm->_costumeRenderer;
- bcr->_actorID = number;
+ bcr->_actorID = _number;
bcr->_actorX = _pos.x + _offsX - _vm->virtscr[0].xstart;
bcr->_actorY = _pos.y + _offsY - _elevation;
@@ -1025,7 +1025,7 @@ void Actor::drawActorCostume(bool hitTestMode) {
// actor is facing left (270 degree).
// V1 games are once again slightly different, here we only have
// to adjust the 270 degree case...
- if (facing == 270)
+ if (_facing == 270)
bcr->_actorX += 16;
else if (_vm->_version == 2)
bcr->_actorX += 8;
@@ -1033,11 +1033,11 @@ void Actor::drawActorCostume(bool hitTestMode) {
bcr->_clipOverride = _clipOverride;
- if (_vm->_version == 4 && boxscale & 0x8000) {
- bcr->_scaleX = bcr->_scaleY = _vm->getScaleFromSlot((boxscale & 0x7fff) + 1, _pos.x, _pos.y);
+ if (_vm->_version == 4 && _boxscale & 0x8000) {
+ bcr->_scaleX = bcr->_scaleY = _vm->getScaleFromSlot((_boxscale & 0x7fff) + 1, _pos.x, _pos.y);
} else {
- bcr->_scaleX = scalex;
- bcr->_scaleY = scaley;
+ bcr->_scaleX = _scalex;
+ bcr->_scaleY = _scaley;
}
bcr->_shadow_mode = _shadowMode;
@@ -1048,13 +1048,13 @@ void Actor::drawActorCostume(bool hitTestMode) {
else
bcr->_shadow_table = _vm->_shadowPalette;
- bcr->setCostume(costume);
- bcr->setPalette(palette);
+ bcr->setCostume(_costume);
+ bcr->setPalette(_palette);
bcr->setFacing(this);
if (_vm->_version >= 7) {
- bcr->_zbuf = forceClip;
+ bcr->_zbuf = _forceClip;
if (bcr->_zbuf == 100) {
bcr->_zbuf = _vm->getMaskFromBox(_walkbox);
if (bcr->_zbuf > _vm->gdi._numZBuffer-1)
@@ -1062,8 +1062,8 @@ void Actor::drawActorCostume(bool hitTestMode) {
}
} else {
- if (forceClip)
- bcr->_zbuf = forceClip;
+ if (_forceClip)
+ bcr->_zbuf = _forceClip;
else if (isInClass(kObjectClassNeverClip))
bcr->_zbuf = 0;
else {
@@ -1077,31 +1077,31 @@ void Actor::drawActorCostume(bool hitTestMode) {
bcr->_draw_top = 0x7fffffff;
bcr->_draw_bottom = 0;
- bcr->_skipLimbs = (heSkipLimbs != 0);
- bcr->_paletteNum = hePaletteNum;
+ bcr->_skipLimbs = (_heSkipLimbs != 0);
+ bcr->_paletteNum = _hePaletteNum;
- if (_vm->_heversion >= 80 && heNoTalkAnimation == 0) {
- heCondMask &= 0xFFFFFC00;
- heCondMask |= 1;
- if (_vm->getTalkingActor() == number) {
+ if (_vm->_heversion >= 80 && _heNoTalkAnimation == 0) {
+ _heCondMask &= 0xFFFFFC00;
+ _heCondMask |= 1;
+ if (_vm->getTalkingActor() == _number) {
// Checks if talk sound is active?
// Otherwise just do rand animation
int rnd = _vm->_rnd.getRandomNumberRng(1, 10);
setTalkCondition(rnd);
}
}
- heNoTalkAnimation = 0;
+ _heNoTalkAnimation = 0;
// If the actor is partially hidden, redraw it next frame.
// Only done for pre-AKOS, though.
- if (bcr->drawCostume(_vm->virtscr[0], _vm->gdi._numStrips, this, drawToBackBuf) & 1) {
- needRedraw = (_vm->_version <= 6);
+ if (bcr->drawCostume(_vm->virtscr[0], _vm->gdi._numStrips, this, _drawToBackBuf) & 1) {
+ _needRedraw = (_vm->_version <= 6);
}
if (!hitTestMode) {
// Record the vertical extent of the drawn actor
- top = bcr->_draw_top;
- bottom = bcr->_draw_bottom;
+ _top = bcr->_draw_top;
+ _bottom = bcr->_draw_bottom;
}
}
@@ -1121,24 +1121,24 @@ bool Actor::actorHitTest(int x, int y) {
}
void Actor::animateCostume() {
- if (costume == 0)
+ if (_costume == 0)
return;
- animProgress++;
- if (animProgress >= animSpeed) {
- animProgress = 0;
+ _animProgress++;
+ if (_animProgress >= _animSpeed) {
+ _animProgress = 0;
if (_vm->_features & GF_NEW_COSTUMES) {
- byte *akos = _vm->getResourceAddress(rtCostume, costume);
+ byte *akos = _vm->getResourceAddress(rtCostume, _costume);
assert(akos);
if (_vm->akos_increaseAnims(akos, this)) {
- needRedraw = true;
+ _needRedraw = true;
}
} else {
LoadedCostume lc(_vm);
- lc.loadCostume(costume);
+ lc.loadCostume(_costume);
if (lc.increaseAnims(this)) {
- needRedraw = true;
+ _needRedraw = true;
}
}
}
@@ -1152,16 +1152,16 @@ void Actor::animateLimb(int limb, int f) {
if (!f)
return;
- animProgress++;
- if (animProgress >= animSpeed) {
- animProgress = 0;
+ _animProgress++;
+ if (_animProgress >= _animSpeed) {
+ _animProgress = 0;
- if (costume == 0)
+ if (_costume == 0)
return;
const byte *aksq, *akfo;
uint size;
- byte *akos = _vm->getResourceAddress(rtCostume, costume);
+ byte *akos = _vm->getResourceAddress(rtCostume, _costume);
assert(akos);
aksq = _vm->findResourceData(MKID('AKSQ'), akos);
@@ -1170,12 +1170,12 @@ void Actor::animateLimb(int limb, int f) {
size = _vm->getResourceDataSize(akfo) / 2;
while (f--) {
- if (cost.active[limb] != 0)
+ if (_cost.active[limb] != 0)
_vm->akos_increaseAnim(this, limb, aksq, (const uint16 *)akfo, size);
}
-// needRedraw = true;
-// needBgReset = true;
+// _needRedraw = true;
+// _needBgReset = true;
}
}
@@ -1184,7 +1184,7 @@ void ScummEngine::setActorRedrawFlags() {
if (_fullRedraw) {
for (j = 1; j < _numActors; j++) {
- _actors[j].needRedraw = true;
+ _actors[j]._needRedraw = true;
}
} else {
for (i = 0; i < gdi._numStrips; i++) {
@@ -1192,7 +1192,7 @@ void ScummEngine::setActorRedrawFlags() {
if (testGfxAnyUsageBits(strip)) {
for (j = 1; j < _numActors; j++) {
if (testGfxUsageBit(strip, j) && testGfxOtherUsageBits(strip, j)) {
- _actors[j].needRedraw = true;
+ _actors[j]._needRedraw = true;
}
}
}
@@ -1209,16 +1209,16 @@ void ScummEngine::resetActorBgs() {
clearGfxUsageBit(strip, USAGE_BIT_RESTORED);
for (j = 1; j < _numActors; j++) {
if (testGfxUsageBit(strip, j) &&
- ((_actors[j].top != 0x7fffffff && _actors[j].needRedraw) || _actors[j].needBgReset)) {
+ ((_actors[j]._top != 0x7fffffff && _actors[j]._needRedraw) || _actors[j]._needBgReset)) {
clearGfxUsageBit(strip, j);
- if ((_actors[j].bottom - _actors[j].top) >= 0)
- gdi.resetBackground(_actors[j].top, _actors[j].bottom, i);
+ if ((_actors[j]._bottom - _actors[j]._top) >= 0)
+ gdi.resetBackground(_actors[j]._top, _actors[j]._bottom, i);
}
}
}
for (i = 1; i < _numActors; i++) {
- _actors[i].needBgReset = false;
+ _actors[i]._needBgReset = false;
}
}
@@ -1229,7 +1229,7 @@ int ScummEngine::getActorFromPos(int x, int y) {
return 0;
for (i = 1; i < _numActors; i++) {
if (testGfxUsageBit(x / 8, i) && !getClass(i, kObjectClassUntouchable)
- && y >= _actors[i].top && y <= _actors[i].bottom) {
+ && y >= _actors[i]._top && y <= _actors[i]._bottom) {
if (_version > 2 || i != VAR(VAR_EGO))
return i;
}
@@ -1272,7 +1272,7 @@ void ScummEngine::actorTalk(const byte *msg) {
} else {
if ((_version <= 7 && !_keepText) || (_version == 8 && VAR(VAR_HAVE_MSG)))
stopTalk();
- setTalkingActor(a->number);
+ setTalkingActor(a->_number);
a->_heTalking = true;
if (!_string[0].no_talk_anim) {
a->runActorTalkScript(a->_talkStartFrame);
@@ -1288,7 +1288,7 @@ void ScummEngine::actorTalk(const byte *msg) {
_charsetColor = (byte)_string[0].color;
} else {
a = derefActor(getTalkingActor(), "actorTalk(2)");
- _charsetColor = a->talkColor;
+ _charsetColor = a->_talkColor;
}
_charsetBufPos = 0;
_talkDelay = 0;
@@ -1304,16 +1304,16 @@ void Actor::runActorTalkScript(int f) {
if (_vm->_version == 8 && _vm->VAR(_vm->VAR_HAVE_MSG) == 2)
return;
- if (talkScript) {
- int script = talkScript;
+ if (_talkScript) {
+ int script = _talkScript;
int args[16];
memset(args, 0, sizeof(args));
args[1] = f;
- args[0] = number;
+ args[0] = _number;
_vm->runScript(script, 1, 0, args);
} else {
- if (frame != f)
+ if (_frame != f)
startAnimActor(f);
}
}
@@ -1350,8 +1350,8 @@ void Actor::setActorCostume(int c) {
int i;
if ((_vm->_features & GF_HUMONGOUS) && (c == -1 || c == -2)) {
- heSkipLimbs = (c == -1);
- needRedraw = true;
+ _heSkipLimbs = (c == -1);
+ _needRedraw = true;
return;
}
@@ -1360,32 +1360,32 @@ void Actor::setActorCostume(int c) {
if (_vm->_heversion == 60)
c &= 0xff;
- costumeNeedsInit = true;
+ _costumeNeedsInit = true;
if (_vm->_features & GF_NEW_COSTUMES) {
- cost.reset();
- auxBlock.visible = false;
- memset(animVariable, 0, sizeof(animVariable));
- costume = c;
+ _cost.reset();
+ _auxBlock.visible = false;
+ memset(_animVariable, 0, sizeof(_animVariable));
+ _costume = c;
if (_vm->_heversion >= 71)
_vm->queueAuxBlock(this);
- if (visible) {
- if (costume) {
- _vm->ensureResourceLoaded(rtCostume, costume);
+ if (_visible) {
+ if (_costume) {
+ _vm->ensureResourceLoaded(rtCostume, _costume);
}
startAnimActor(_initFrame);
}
} else {
- if (visible) {
+ if (_visible) {
hideActor();
- cost.reset();
- costume = c;
+ _cost.reset();
+ _costume = c;
showActor();
} else {
- costume = c;
- cost.reset();
+ _costume = c;
+ _cost.reset();
}
}
@@ -1396,19 +1396,19 @@ void Actor::setActorCostume(int c) {
if (_vm->_features & GF_NEW_COSTUMES) {
for (i = 0; i < 256; i++)
- palette[i] = 0xFF;
+ _palette[i] = 0xFF;
} else if (_vm->_features & GF_OLD_BUNDLE) {
for (i = 0; i < 16; i++)
- palette[i] = i;
+ _palette[i] = i;
// Make stuff more visible on CGA. Based on disassembly
if (_vm->_renderMode == Common::kRenderCGA && _vm->_version > 2) {
- palette[6] = 5;
- palette[7] = 15;
+ _palette[6] = 5;
+ _palette[7] = 15;
}
} else {
for (i = 0; i < 32; i++)
- palette[i] = 0xFF;
+ _palette[i] = 0xFF;
}
}
@@ -1425,21 +1425,21 @@ void Actor::startWalkActor(int destX, int destY, int dir) {
if (!isInCurrentRoom()) {
_pos.x = abr.x;
_pos.y = abr.y;
- if (!(_vm->_version == 6 && ignoreTurns) && dir != -1)
+ if (!(_vm->_version == 6 && _ignoreTurns) && dir != -1)
setDirection(dir);
return;
}
- if (ignoreBoxes) {
+ if (_ignoreBoxes) {
abr.box = kInvalidBox;
_walkbox = kInvalidBox;
} else {
- if (_vm->checkXYInBoxBounds(walkdata.destbox, abr.x, abr.y)) {
- abr.box = walkdata.destbox;
+ if (_vm->checkXYInBoxBounds(_walkdata.destbox, abr.x, abr.y)) {
+ abr.box = _walkdata.destbox;
} else {
abr = adjustXYToBeInBox(abr.x, abr.y);
}
- if (moving && walkdata.destdir == dir && walkdata.dest.x == abr.x && walkdata.dest.y == abr.y)
+ if (_moving && _walkdata.destdir == dir && _walkdata.dest.x == abr.x && _walkdata.dest.y == abr.y)
return;
}
@@ -1448,30 +1448,30 @@ void Actor::startWalkActor(int destX, int destY, int dir) {
return;
}
- walkdata.dest.x = abr.x;
- walkdata.dest.y = abr.y;
- walkdata.destbox = abr.box;
- walkdata.destdir = dir;
- moving = (moving & MF_IN_LEG) | MF_NEW_LEG;
- walkdata.point3.x = 32000;
+ _walkdata.dest.x = abr.x;
+ _walkdata.dest.y = abr.y;
+ _walkdata.destbox = abr.box;
+ _walkdata.destdir = dir;
+ _moving = (_moving & MF_IN_LEG) | MF_NEW_LEG;
+ _walkdata.point3.x = 32000;
- walkdata.curbox = _walkbox;
+ _walkdata.curbox = _walkbox;
}
void Actor::startWalkAnim(int cmd, int angle) {
if (angle == -1)
- angle = facing;
+ angle = _facing;
/* Note: walk scripts aren't required to make the Dig
* work as usual
*/
- if (walkScript) {
+ if (_walkScript) {
int args[16];
memset(args, 0, sizeof(args));
- args[0] = number;
+ args[0] = _number;
args[1] = cmd;
args[2] = angle;
- _vm->runScript(walkScript, 1, 0, args);
+ _vm->runScript(_walkScript, 1, 0, args);
} else {
switch (cmd) {
case 1: /* start walk */
@@ -1494,77 +1494,77 @@ void Actor::walkActor() {
Common::Point foundPath;
if (_vm->_version >= 7) {
- if (moving & MF_FROZEN) {
- if (moving & MF_TURN) {
+ if (_moving & MF_FROZEN) {
+ if (_moving & MF_TURN) {
new_dir = updateActorDirection(false);
- if (facing != new_dir)
+ if (_facing != new_dir)
setDirection(new_dir);
else
- moving &= ~MF_TURN;
+ _moving &= ~MF_TURN;
}
return;
}
}
- if (!moving)
+ if (!_moving)
return;
- if (!(moving & MF_NEW_LEG)) {
- if (moving & MF_IN_LEG && actorWalkStep())
+ if (!(_moving & MF_NEW_LEG)) {
+ if (_moving & MF_IN_LEG && actorWalkStep())
return;
- if (moving & MF_LAST_LEG) {
- moving = 0;
- setBox(walkdata.destbox);
- startWalkAnim(3, walkdata.destdir);
+ if (_moving & MF_LAST_LEG) {
+ _moving = 0;
+ setBox(_walkdata.destbox);
+ startWalkAnim(3, _walkdata.destdir);
return;
}
- if (moving & MF_TURN) {
+ if (_moving & MF_TURN) {
new_dir = updateActorDirection(false);
- if (facing != new_dir)
+ if (_facing != new_dir)
setDirection(new_dir);
else
- moving = 0;
+ _moving = 0;
return;
}
- setBox(walkdata.curbox);
- moving &= MF_IN_LEG;
+ setBox(_walkdata.curbox);
+ _moving &= MF_IN_LEG;
}
- moving &= ~MF_NEW_LEG;
+ _moving &= ~MF_NEW_LEG;
do {
if (_walkbox == kInvalidBox) {
- setBox(walkdata.destbox);
- walkdata.curbox = walkdata.destbox;
+ setBox(_walkdata.destbox);
+ _walkdata.curbox = _walkdata.destbox;
break;
}
- if (_walkbox == walkdata.destbox)
+ if (_walkbox == _walkdata.destbox)
break;
- next_box = _vm->getPathToDestBox(_walkbox, walkdata.destbox);
+ next_box = _vm->getPathToDestBox(_walkbox, _walkdata.destbox);
if (next_box < 0) {
- walkdata.destbox = _walkbox;
- moving |= MF_LAST_LEG;
+ _walkdata.destbox = _walkbox;
+ _moving |= MF_LAST_LEG;
return;
}
- walkdata.curbox = next_box;
+ _walkdata.curbox = next_box;
- if (findPathTowards(_walkbox, next_box, walkdata.destbox, foundPath))
+ if (findPathTowards(_walkbox, next_box, _walkdata.destbox, foundPath))
break;
if (calcMovementFactor(foundPath))
return;
- setBox(walkdata.curbox);
+ setBox(_walkdata.curbox);
} while (1);
- moving |= MF_LAST_LEG;
- calcMovementFactor(walkdata.dest);
+ _moving |= MF_LAST_LEG;
+ calcMovementFactor(_walkdata.dest);
}
/*
@@ -1572,45 +1572,45 @@ void Actor::walkActorV12() {
Common::Point foundPath, tmp;
int new_dir, next_box;
- if (moving & MF_TURN) {
+ if (_moving & MF_TURN) {
new_dir = updateActorDirection(false);
- if (facing != new_dir)
+ if (_facing != new_dir)
setDirection(new_dir);
else
- moving = 0;
+ _moving = 0;
return;
}
- if (!moving)
+ if (!_moving)
return;
- if (moving & MF_IN_LEG) {
+ if (_moving & MF_IN_LEG) {
actorWalkStep();
} else {
- if (moving & MF_LAST_LEG) {
- moving = 0;
- startWalkAnim(3, walkdata.destdir);
+ if (_moving & MF_LAST_LEG) {
+ _moving = 0;
+ startWalkAnim(3, _walkdata.destdir);
} else {
- setBox(walkdata.curbox);
- if (_walkbox == walkdata.destbox) {
- foundPath = walkdata.dest;
- moving |= MF_LAST_LEG;
+ setBox(_walkdata.curbox);
+ if (_walkbox == _walkdata.destbox) {
+ foundPath = _walkdata.dest;
+ _moving |= MF_LAST_LEG;
} else {
- next_box = _vm->getPathToDestBox(_walkbox, walkdata.destbox);
+ next_box = _vm->getPathToDestBox(_walkbox, _walkdata.destbox);
if (next_box < 0) {
- moving |= MF_LAST_LEG;
+ _moving |= MF_LAST_LEG;
return;
}
// Can't walk through locked boxes
int flags = _vm->getBoxFlags(next_box);
if (flags & kBoxLocked && !(flags & kBoxPlayerOnly && !isPlayer())) {
- moving |= MF_LAST_LEG;
+ _moving |= MF_LAST_LEG;
}
- walkdata.curbox = next_box;
+ _walkdata.curbox = next_box;
- _vm->getClosestPtOnBox(walkdata.curbox, x, y, tmp.x, tmp.y);
+ _vm->getClosestPtOnBox(_walkdata.curbox, x, y, tmp.x, tmp.y);
_vm->getClosestPtOnBox(_walkbox, tmp.x, tmp.y, foundPath.x, foundPath.y);
}
calcMovementFactor(foundPath);
@@ -1623,91 +1623,91 @@ void Actor::walkActorOld() {
Common::Point p2, p3; // Gate locations
int new_dir, next_box, loopCtr = 0;
- if (!moving)
+ if (!_moving)
return;
- if (!(moving & MF_NEW_LEG)) {
- if (moving & MF_IN_LEG && actorWalkStep())
+ if (!(_moving & MF_NEW_LEG)) {
+ if (_moving & MF_IN_LEG && actorWalkStep())
return;
- if (moving & MF_LAST_LEG) {
- moving = 0;
- startWalkAnim(3, walkdata.destdir);
+ if (_moving & MF_LAST_LEG) {
+ _moving = 0;
+ startWalkAnim(3, _walkdata.destdir);
return;
}
- if (moving & MF_TURN) {
+ if (_moving & MF_TURN) {
new_dir = updateActorDirection(false);
- if (facing != new_dir)
+ if (_facing != new_dir)
setDirection(new_dir);
else
- moving = 0;
+ _moving = 0;
return;
}
- if (walkdata.point3.x != 32000) {
- if (calcMovementFactor(walkdata.point3)) {
- walkdata.point3.x = 32000;
+ if (_walkdata.point3.x != 32000) {
+ if (calcMovementFactor(_walkdata.point3)) {
+ _walkdata.point3.x = 32000;
return;
}
- walkdata.point3.x = 32000;
+ _walkdata.point3.x = 32000;
}
- setBox(walkdata.curbox);
- moving &= MF_IN_LEG;
+ setBox(_walkdata.curbox);
+ _moving &= MF_IN_LEG;
}
- moving &= ~MF_NEW_LEG;
+ _moving &= ~MF_NEW_LEG;
do {
loopCtr++;
if (_walkbox == kInvalidBox) {
- setBox(walkdata.destbox);
- walkdata.curbox = walkdata.destbox;
+ setBox(_walkdata.destbox);
+ _walkdata.curbox = _walkdata.destbox;
break;
}
- if (_walkbox == walkdata.destbox)
+ if (_walkbox == _walkdata.destbox)
break;
- next_box = _vm->getPathToDestBox(_walkbox, walkdata.destbox);
+ next_box = _vm->getPathToDestBox(_walkbox, _walkdata.destbox);
// WORKAROUND: To fully fix bug #774783, we add a special case
// here, resulting in a different next_box value for Hitler.
- if ((_vm->_gameId == GID_INDY3) && _vm->_roomResource == 46 && _walkbox == 1 && walkdata.destbox == 0 && number == 9)
+ if ((_vm->_gameId == GID_INDY3) && _vm->_roomResource == 46 && _walkbox == 1 && _walkdata.destbox == 0 && _number == 9)
next_box = 1;
if (next_box < 0) {
- moving |= MF_LAST_LEG;
+ _moving |= MF_LAST_LEG;
return;
}
// Can't walk through locked boxes
int flags = _vm->getBoxFlags(next_box);
if (flags & kBoxLocked && !(flags & kBoxPlayerOnly && !isPlayer())) {
- moving |= MF_LAST_LEG;
+ _moving |= MF_LAST_LEG;
// FIXME: Work in progress
-// walkdata.destdir = facing;
+// _walkdata.destdir = _facing;
return;
}
- walkdata.curbox = next_box;
+ _walkdata.curbox = next_box;
if (_vm->_version <= 2) {
- _vm->getClosestPtOnBox(walkdata.curbox, _pos.x, _pos.y, p2.x, p2.y);
+ _vm->getClosestPtOnBox(_walkdata.curbox, _pos.x, _pos.y, p2.x, p2.y);
_vm->getClosestPtOnBox(_walkbox, p2.x, p2.y, p3.x, p3.y);
// FIXME: Work in progress
// calcMovementFactor(p3);
// return;
} else {
- findPathTowardsOld(_walkbox, next_box, walkdata.destbox, p2, p3);
+ findPathTowardsOld(_walkbox, next_box, _walkdata.destbox, p2, p3);
if (p2.x == 32000 && p3.x == 32000) {
break;
}
if (p2.x != 32000) {
if (calcMovementFactor(p2)) {
- walkdata.point3 = p3;
+ _walkdata.point3 = p3;
return;
}
}
@@ -1715,24 +1715,24 @@ void Actor::walkActorOld() {
if (calcMovementFactor(p3))
return;
- setBox(walkdata.destbox);
+ setBox(_walkdata.destbox);
// FIXME: Ender added this recursion counter as a hack around
// a infinite loop in Maniac V1 - see bug #862245
if (loopCtr > 100) {
- moving |= MF_LAST_LEG;
+ _moving |= MF_LAST_LEG;
return;
}
} while (1);
- moving |= MF_LAST_LEG;
- calcMovementFactor(walkdata.dest);
+ _moving |= MF_LAST_LEG;
+ calcMovementFactor(_walkdata.dest);
}
byte *Actor::getActorName() {
- byte *ptr = _vm->getResourceAddress(rtActorName, number);
+ byte *ptr = _vm->getResourceAddress(rtActorName, _number);
if (ptr == NULL) {
- warning("Failed to find name of actor %d", number);
+ warning("Failed to find name of actor %d", _number);
}
return ptr;
}
@@ -1742,15 +1742,15 @@ void Actor::remapActorPaletteColor(int color, int new_color) {
int akpl_size, i;
byte akpl_color;
- akos = _vm->getResourceAddress(rtCostume, costume);
+ akos = _vm->getResourceAddress(rtCostume, _costume);
if (!akos) {
- warning("Can't remap actor %d, costume %d not found", number, costume);
+ warning("Can't remap actor %d, costume %d not found", _number, _costume);
return;
}
akpl = _vm->findResourceData(MKID('AKPL'), akos);
if (!akpl) {
- warning("Can't remap actor %d, costume %d doesn't contain an AKPL block", number, costume);
+ warning("Can't remap actor %d, costume %d doesn't contain an AKPL block", _number, _costume);
return;
}
@@ -1760,7 +1760,7 @@ void Actor::remapActorPaletteColor(int color, int new_color) {
for (i = 0; i < akpl_size; i++) {
akpl_color = *akpl++;
if (akpl_color == color) {
- palette[i] = new_color;
+ _palette[i] = new_color;
return;
}
}
@@ -1773,22 +1773,22 @@ void Actor::remapActorPalette(int r_fact, int g_fact, int b_fact, int threshold)
byte akpl_color;
if (!isInCurrentRoom()) {
- debugC(DEBUG_ACTORS, "Remap actor %d not in current room", number);
+ debugC(DEBUG_ACTORS, "Remap actor %d not in current room", _number);
return;
- } else if (costume < 1 || costume >= _vm->_numCostumes - 1) {
- debugC(DEBUG_ACTORS, "Remap actor %d invalid costume %d", number, costume);
+ } else if (_costume < 1 || _costume >= _vm->_numCostumes - 1) {
+ debugC(DEBUG_ACTORS, "Remap actor %d invalid costume %d", _number, _costume);
return;
}
- akos = _vm->getResourceAddress(rtCostume, costume);
+ akos = _vm->getResourceAddress(rtCostume, _costume);
if (!akos) {
- warning("Can't remap actor %d, costume %d not found", number, costume);
+ warning("Can't remap actor %d, costume %d not found", _number, _costume);
return;
}
akpl = _vm->findResourceData(MKID('AKPL'), akos);
if (!akpl) {
- warning("Can't remap actor %d, costume %d doesn't contain an AKPL block", number, costume);
+ warning("Can't remap actor %d, costume %d doesn't contain an AKPL block", _number, _costume);
return;
}
@@ -1798,7 +1798,7 @@ void Actor::remapActorPalette(int r_fact, int g_fact, int b_fact, int threshold)
rgbs = _vm->findResourceData(MKID('RGBS'), akos);
if (!rgbs) {
- debugC(DEBUG_ACTORS, "Can't remap actor %d costume %d doesn't contain an RGB block", number, costume);
+ debugC(DEBUG_ACTORS, "Can't remap actor %d costume %d doesn't contain an RGB block", _number, _costume);
return;
}
@@ -1814,25 +1814,25 @@ void Actor::remapActorPalette(int r_fact, int g_fact, int b_fact, int threshold)
r = (r * r_fact) >> 8;
g = (g * g_fact) >> 8;
b = (b * b_fact) >> 8;
- palette[i] = _vm->remapPaletteColor(r, g, b, threshold);
+ _palette[i] = _vm->remapPaletteColor(r, g, b, threshold);
}
}
}
void Actor::classChanged(int cls, bool value) {
if (cls == kObjectClassAlwaysClip)
- forceClip = value;
+ _forceClip = value;
if (cls == kObjectClassIgnoreBoxes)
- ignoreBoxes = value;
+ _ignoreBoxes = value;
}
bool Actor::isInClass(int cls) {
- return _vm->getClass(number, cls);
+ return _vm->getClass(_number, cls);
}
bool Actor::isPlayer() {
if (_vm->_version <= 2)
- return _vm->VAR(42) <= number && number <= _vm->VAR(43);
+ return _vm->VAR(42) <= _number && _number <= _vm->VAR(43);
else
return isInClass(kObjectClassPlayer);
}
@@ -1841,39 +1841,39 @@ void Actor::setUserCondition(int slot, int set) {
debug(1, "Actor::setUserCondition(%d, %d)", slot, set);
assert(slot >= 1 && slot <= 0x20);
if (set == 0) {
- heCondMask &= ~(1 << (slot + 0xF));
+ _heCondMask &= ~(1 << (slot + 0xF));
} else {
- heCondMask |= 1 << (slot + 0xF);
+ _heCondMask |= 1 << (slot + 0xF);
}
- if (heCondMask & 0x3FF) {
- heCondMask &= ~1;
+ if (_heCondMask & 0x3FF) {
+ _heCondMask &= ~1;
} else {
- heCondMask |= 1;
+ _heCondMask |= 1;
}
}
bool Actor::isUserConditionSet(int slot) const {
assert(slot >= 1 && slot <= 0x20);
- return (heCondMask & (1 << (slot + 0xF))) != 0;
+ return (_heCondMask & (1 << (slot + 0xF))) != 0;
}
void Actor::setTalkCondition(int slot) {
debug(1, "Actor::setTalkCondition(%d)", slot);
assert(slot >= 1 && slot <= 0x10);
- heCondMask = (heCondMask & ~0x3FF) | 1;
+ _heCondMask = (_heCondMask & ~0x3FF) | 1;
if (slot != 1) {
- heCondMask |= 1 << (slot - 1);
- if (heCondMask & 0x3FF) {
- heCondMask &= ~1;
+ _heCondMask |= 1 << (slot - 1);
+ if (_heCondMask & 0x3FF) {
+ _heCondMask &= ~1;
} else {
- heCondMask |= 1;
+ _heCondMask |= 1;
}
}
}
bool Actor::isTalkConditionSet(int slot) const {
assert(slot >= 1 && slot <= 0x10);
- return (heCondMask & (1 << (slot - 1))) != 0;
+ return (_heCondMask & (1 << (slot - 1))) != 0;
}
void ScummEngine::preProcessAuxQueue() {
@@ -1895,7 +1895,7 @@ void ScummEngine::postProcessAuxQueue() {
AuxEntry *ae = &_auxEntries[i];
if (ae->actorNum != -1) {
Actor *a = derefActor(ae->actorNum, "postProcessAuxQueue");
- const uint8 *cost = getResourceAddress(rtCostume, a->costume);
+ const uint8 *cost = getResourceAddress(rtCostume, a->_costume);
int dy = a->_offsY + a->_pos.y - a->getElevation();
int dx = a->_offsX + a->_pos.x;
@@ -1946,11 +1946,11 @@ void ScummEngine::postProcessAuxQueue() {
}
const uint8 *axer = findResourceData(MKID('AXER'), auxd);
if (axer) {
- a->auxBlock.visible = true;
- a->auxBlock.r.left = (int16)READ_LE_UINT16(axer + 0) + dx;
- a->auxBlock.r.top = (int16)READ_LE_UINT16(axer + 2) + dy;
- a->auxBlock.r.right = (int16)READ_LE_UINT16(axer + 4) + dx;
- a->auxBlock.r.bottom = (int16)READ_LE_UINT16(axer + 6) + dy;
+ a->_auxBlock.visible = true;
+ a->_auxBlock.r.left = (int16)READ_LE_UINT16(axer + 0) + dx;
+ a->_auxBlock.r.top = (int16)READ_LE_UINT16(axer + 2) + dy;
+ a->_auxBlock.r.right = (int16)READ_LE_UINT16(axer + 4) + dx;
+ a->_auxBlock.r.bottom = (int16)READ_LE_UINT16(axer + 6) + dy;
}
}
}
@@ -1959,11 +1959,11 @@ void ScummEngine::postProcessAuxQueue() {
}
void ScummEngine::queueAuxBlock(Actor *a) {
- if (!a->auxBlock.visible)
+ if (!a->_auxBlock.visible)
return;
assert(_auxBlocksNum < ARRAYSIZE(_auxBlocks));
- _auxBlocks[_auxBlocksNum] = a->auxBlock;
+ _auxBlocks[_auxBlocksNum] = a->_auxBlock;
++_auxBlocksNum;
}
@@ -1982,95 +1982,95 @@ const SaveLoadEntry *Actor::getSaveLoadEntries() {
MKLINE(Actor, _pos.y, sleInt16, VER(8)),
MKLINE(Actor, _offsX, sleInt16, VER(32)),
MKLINE(Actor, _offsY, sleInt16, VER(32)),
- MKLINE(Actor, top, sleInt16, VER(8)),
- MKLINE(Actor, bottom, sleInt16, VER(8)),
+ MKLINE(Actor, _top, sleInt16, VER(8)),
+ MKLINE(Actor, _bottom, sleInt16, VER(8)),
MKLINE(Actor, _elevation, sleInt16, VER(8)),
- MKLINE(Actor, width, sleUint16, VER(8)),
- MKLINE(Actor, facing, sleUint16, VER(8)),
- MKLINE(Actor, costume, sleUint16, VER(8)),
- MKLINE(Actor, room, sleByte, VER(8)),
- MKLINE(Actor, talkColor, sleByte, VER(8)),
- MKLINE(Actor, talkFrequency, sleInt16, VER(16)),
- MKLINE(Actor, talkPan, sleInt16, VER(24)),
- MKLINE(Actor, talkVolume, sleInt16, VER(29)),
- MKLINE(Actor, boxscale, sleUint16, VER(34)),
- MKLINE(Actor, scalex, sleByte, VER(8)),
- MKLINE(Actor, scaley, sleByte, VER(8)),
- MKLINE(Actor, charset, sleByte, VER(8)),
+ MKLINE(Actor, _width, sleUint16, VER(8)),
+ MKLINE(Actor, _facing, sleUint16, VER(8)),
+ MKLINE(Actor, _costume, sleUint16, VER(8)),
+ MKLINE(Actor, _room, sleByte, VER(8)),
+ MKLINE(Actor, _talkColor, sleByte, VER(8)),
+ MKLINE(Actor, _talkFrequency, sleInt16, VER(16)),
+ MKLINE(Actor, _talkPan, sleInt16, VER(24)),
+ MKLINE(Actor, _talkVolume, sleInt16, VER(29)),
+ MKLINE(Actor, _boxscale, sleUint16, VER(34)),
+ MKLINE(Actor, _scalex, sleByte, VER(8)),
+ MKLINE(Actor, _scaley, sleByte, VER(8)),
+ MKLINE(Actor, _charset, sleByte, VER(8)),
// Actor sound grew from 8 to 32 bytes
- MKARRAY_OLD(Actor, sound[0], sleByte, 8, VER(8), VER(36)),
- MKARRAY(Actor, sound[0], sleByte, 32, VER(37)),
+ MKARRAY_OLD(Actor, _sound[0], sleByte, 8, VER(8), VER(36)),
+ MKARRAY(Actor, _sound[0], sleByte, 32, VER(37)),
// Actor animVariable grew from 8 to 27
- MKARRAY_OLD(Actor, animVariable[0], sleUint16, 8, VER(8), VER(40)),
- MKARRAY(Actor, animVariable[0], sleUint16, 27, VER(41)),
+ MKARRAY_OLD(Actor, _animVariable[0], sleUint16, 8, VER(8), VER(40)),
+ MKARRAY(Actor, _animVariable[0], sleUint16, 27, VER(41)),
- MKLINE(Actor, targetFacing, sleUint16, VER(8)),
- MKLINE(Actor, moving, sleByte, VER(8)),
- MKLINE(Actor, ignoreBoxes, sleByte, VER(8)),
- MKLINE(Actor, forceClip, sleByte, VER(8)),
+ MKLINE(Actor, _targetFacing, sleUint16, VER(8)),
+ MKLINE(Actor, _moving, sleByte, VER(8)),
+ MKLINE(Actor, _ignoreBoxes, sleByte, VER(8)),
+ MKLINE(Actor, _forceClip, sleByte, VER(8)),
MKLINE(Actor, _initFrame, sleByte, VER(8)),
MKLINE(Actor, _walkFrame, sleByte, VER(8)),
MKLINE(Actor, _standFrame, sleByte, VER(8)),
MKLINE(Actor, _talkStartFrame, sleByte, VER(8)),
MKLINE(Actor, _talkStopFrame, sleByte, VER(8)),
- MKLINE(Actor, speedx, sleUint16, VER(8)),
- MKLINE(Actor, speedy, sleUint16, VER(8)),
- MKLINE(Actor, cost.animCounter, sleUint16, VER(8)),
- MKLINE(Actor, cost.soundCounter, sleByte, VER(8)),
- MKLINE(Actor, drawToBackBuf, sleByte, VER(32)),
- MKLINE(Actor, flip, sleByte, VER(32)),
- MKLINE(Actor, heSkipLimbs, sleByte, VER(32)),
+ MKLINE(Actor, _speedx, sleUint16, VER(8)),
+ MKLINE(Actor, _speedy, sleUint16, VER(8)),
+ MKLINE(Actor, _cost.animCounter, sleUint16, VER(8)),
+ MKLINE(Actor, _cost.soundCounter, sleByte, VER(8)),
+ MKLINE(Actor, _drawToBackBuf, sleByte, VER(32)),
+ MKLINE(Actor, _flip, sleByte, VER(32)),
+ MKLINE(Actor, _heSkipLimbs, sleByte, VER(32)),
// Actor palette grew from 64 to 256 bytes
- MKARRAY_OLD(Actor, palette[0], sleByte, 64, VER(8), VER(9)),
- MKARRAY(Actor, palette[0], sleByte, 256, VER(10)),
+ MKARRAY_OLD(Actor, _palette[0], sleByte, 64, VER(8), VER(9)),
+ MKARRAY(Actor, _palette[0], sleByte, 256, VER(10)),
- MK_OBSOLETE(Actor, mask, sleByte, VER(8), VER(9)),
+ MK_OBSOLETE(Actor, _mask, sleByte, VER(8), VER(9)),
MKLINE(Actor, _shadowMode, sleByte, VER(8)),
- MKLINE(Actor, visible, sleByte, VER(8)),
- MKLINE(Actor, frame, sleByte, VER(8)),
- MKLINE(Actor, animSpeed, sleByte, VER(8)),
- MKLINE(Actor, animProgress, sleByte, VER(8)),
+ MKLINE(Actor, _visible, sleByte, VER(8)),
+ MKLINE(Actor, _frame, sleByte, VER(8)),
+ MKLINE(Actor, _animSpeed, sleByte, VER(8)),
+ MKLINE(Actor, _animProgress, sleByte, VER(8)),
MKLINE(Actor, _walkbox, sleByte, VER(8)),
- MKLINE(Actor, needRedraw, sleByte, VER(8)),
- MKLINE(Actor, needBgReset, sleByte, VER(8)),
- MKLINE(Actor, costumeNeedsInit, sleByte, VER(8)),
- MKLINE(Actor, heCondMask, sleUint32, VER(38)),
-
- MKLINE(Actor, talkPosY, sleInt16, VER(8)),
- MKLINE(Actor, talkPosX, sleInt16, VER(8)),
- MKLINE(Actor, ignoreTurns, sleByte, VER(8)),
+ MKLINE(Actor, _needRedraw, sleByte, VER(8)),
+ MKLINE(Actor, _needBgReset, sleByte, VER(8)),
+ MKLINE(Actor, _costumeNeedsInit, sleByte, VER(8)),
+ MKLINE(Actor, _heCondMask, sleUint32, VER(38)),
+
+ MKLINE(Actor, _talkPosY, sleInt16, VER(8)),
+ MKLINE(Actor, _talkPosX, sleInt16, VER(8)),
+ MKLINE(Actor, _ignoreTurns, sleByte, VER(8)),
MKLINE(Actor, _layer, sleByte, VER(8)),
- MKLINE(Actor, talkScript, sleUint16, VER(8)),
- MKLINE(Actor, walkScript, sleUint16, VER(8)),
-
- MKLINE(Actor, walkdata.dest.x, sleInt16, VER(8)),
- MKLINE(Actor, walkdata.dest.y, sleInt16, VER(8)),
- MKLINE(Actor, walkdata.destbox, sleByte, VER(8)),
- MKLINE(Actor, walkdata.destdir, sleUint16, VER(8)),
- MKLINE(Actor, walkdata.curbox, sleByte, VER(8)),
- MKLINE(Actor, walkdata.cur.x, sleInt16, VER(8)),
- MKLINE(Actor, walkdata.cur.y, sleInt16, VER(8)),
- MKLINE(Actor, walkdata.next.x, sleInt16, VER(8)),
- MKLINE(Actor, walkdata.next.y, sleInt16, VER(8)),
- MKLINE(Actor, walkdata.deltaXFactor, sleInt32, VER(8)),
- MKLINE(Actor, walkdata.deltaYFactor, sleInt32, VER(8)),
- MKLINE(Actor, walkdata.xfrac, sleUint16, VER(8)),
- MKLINE(Actor, walkdata.yfrac, sleUint16, VER(8)),
-
- MKLINE(Actor, walkdata.point3.x, sleUint16, VER(42)),
- MKLINE(Actor, walkdata.point3.y, sleUint16, VER(42)),
+ MKLINE(Actor, _talkScript, sleUint16, VER(8)),
+ MKLINE(Actor, _walkScript, sleUint16, VER(8)),
+
+ MKLINE(Actor, _walkdata.dest.x, sleInt16, VER(8)),
+ MKLINE(Actor, _walkdata.dest.y, sleInt16, VER(8)),
+ MKLINE(Actor, _walkdata.destbox, sleByte, VER(8)),
+ MKLINE(Actor, _walkdata.destdir, sleUint16, VER(8)),
+ MKLINE(Actor, _walkdata.curbox, sleByte, VER(8)),
+ MKLINE(Actor, _walkdata.cur.x, sleInt16, VER(8)),
+ MKLINE(Actor, _walkdata.cur.y, sleInt16, VER(8)),
+ MKLINE(Actor, _walkdata.next.x, sleInt16, VER(8)),
+ MKLINE(Actor, _walkdata.next.y, sleInt16, VER(8)),
+ MKLINE(Actor, _walkdata.deltaXFactor, sleInt32, VER(8)),
+ MKLINE(Actor, _walkdata.deltaYFactor, sleInt32, VER(8)),
+ MKLINE(Actor, _walkdata.xfrac, sleUint16, VER(8)),
+ MKLINE(Actor, _walkdata.yfrac, sleUint16, VER(8)),
+
+ MKLINE(Actor, _walkdata.point3.x, sleUint16, VER(42)),
+ MKLINE(Actor, _walkdata.point3.y, sleUint16, VER(42)),
- MKARRAY(Actor, cost.active[0], sleByte, 16, VER(8)),
- MKLINE(Actor, cost.stopped, sleUint16, VER(8)),
- MKARRAY(Actor, cost.curpos[0], sleUint16, 16, VER(8)),
- MKARRAY(Actor, cost.start[0], sleUint16, 16, VER(8)),
- MKARRAY(Actor, cost.end[0], sleUint16, 16, VER(8)),
- MKARRAY(Actor, cost.frame[0], sleUint16, 16, VER(8)),
+ MKARRAY(Actor, _cost.active[0], sleByte, 16, VER(8)),
+ MKLINE(Actor, _cost.stopped, sleUint16, VER(8)),
+ MKARRAY(Actor, _cost.curpos[0], sleUint16, 16, VER(8)),
+ MKARRAY(Actor, _cost.start[0], sleUint16, 16, VER(8)),
+ MKARRAY(Actor, _cost.end[0], sleUint16, 16, VER(8)),
+ MKARRAY(Actor, _cost.frame[0], sleUint16, 16, VER(8)),
MKEND()
};