aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTobias Gunkel2012-02-04 14:49:44 +0100
committerTobias Gunkel2012-02-11 08:30:02 +0100
commite14e4ab3b035012781abfbac500e6de88e0ad60b (patch)
treee95fe13af3e829e790e2eaefec7b38d94ce81975
parent434aaaf0c0cdbcc8a1ebc0e461f1e31582126f92 (diff)
downloadscummvm-rg350-e14e4ab3b035012781abfbac500e6de88e0ad60b.tar.gz
scummvm-rg350-e14e4ab3b035012781abfbac500e6de88e0ad60b.tar.bz2
scummvm-rg350-e14e4ab3b035012781abfbac500e6de88e0ad60b.zip
SCUMM: adjust to coding style-guide
-rw-r--r--engines/scumm/actor.cpp80
-rw-r--r--engines/scumm/actor.h28
-rw-r--r--engines/scumm/costume.cpp70
-rw-r--r--engines/scumm/costume.h2
-rw-r--r--engines/scumm/object.h14
-rw-r--r--engines/scumm/script.cpp4
-rw-r--r--engines/scumm/script_v0.cpp28
-rw-r--r--engines/scumm/script_v2.cpp2
-rw-r--r--engines/scumm/verbs.cpp3
9 files changed, 110 insertions, 121 deletions
diff --git a/engines/scumm/actor.cpp b/engines/scumm/actor.cpp
index 6f6c1d21db..c5d2a2b9fb 100644
--- a/engines/scumm/actor.cpp
+++ b/engines/scumm/actor.cpp
@@ -235,8 +235,8 @@ void Actor::stopActorMoving() {
_vm->stopScript(_walkScript);
_moving = 0;
- if( _vm->_game.version == 0 )
- ((ActorC64*)this)->setDirection( _facing );
+ if(_vm->_game.version == 0)
+ ((ActorC64 *)this)->setDirection(_facing);
}
void Actor::setActorWalkSpeed(uint newSpeedX, uint newSpeedY) {
@@ -324,13 +324,12 @@ int Actor::actorWalkStep() {
int distX, distY;
int nextFacing;
- if( _vm->_game.version == 0 )
- ((ActorC64*) this)->_animFrameRepeat = -1;
+ if(_vm->_game.version == 0)
+ ((ActorC64 *)this)->_animFrameRepeat = -1;
_needRedraw = true;
nextFacing = updateActorDirection(true);
-
if (!(_moving & MF_IN_LEG) || _facing != nextFacing) {
if (_walkFrame != _frame || _facing != nextFacing) {
startWalkAnim(1, nextFacing);
@@ -370,7 +369,6 @@ int Actor::actorWalkStep() {
_moving &= ~MF_IN_LEG;
return 0;
}
-
return 1;
}
@@ -398,11 +396,9 @@ void Actor::startWalkActor(int destX, int destY, int dir) {
}
if (_vm->_game.version <= 2) {
-
abr = adjustXYToBeInBox(abr.x, abr.y);
if (_pos.x == abr.x && _pos.y == abr.y && (dir == -1 || _facing == dir))
return;
-
} else {
if (_ignoreBoxes) {
abr.box = kInvalidBox;
@@ -449,7 +445,6 @@ void Actor::startWalkAnim(int cmd, int angle) {
args[2] = angle;
_vm->runScript(_walkScript, 1, 0, args);
} else {
-
switch (cmd) {
case 1: /* start walk */
setDirection(angle);
@@ -573,9 +568,8 @@ void Actor_v2::walkActor() {
if (_moving & MF_IN_LEG) {
actorWalkStep();
- if( _vm->_game.version == 0 )
- ((ActorC64*) this)->animateActor( newDirToOldDir( _facing ) );
-
+ if(_vm->_game.version == 0)
+ ((ActorC64 *)this)->animateActor(newDirToOldDir(_facing));
} else {
if (_moving & MF_LAST_LEG) {
_moving = 0;
@@ -886,24 +880,24 @@ void Actor::setDirection(int direction) {
void ActorC64::setDirection(int direction) {
int dir = newDirToOldDir( direction );
- int res = 0;
+ int res = 0;
switch (dir) {
case 0:
res = 4; // Left
- break;
+ break;
case 1:
res = 5; // Right
- break;
+ break;
case 2:
res = 6; // Face Away
- break;
+ break;
- default:
+ default:
res = 7; // Face Camera
- break;
+ break;
}
_animFrameRepeat = -1;
@@ -935,12 +929,10 @@ void Actor::turnToDirection(int newdir) {
} else {
_moving &= ~MF_TURN;
if (newdir != _facing) {
-
_moving |= MF_TURN;
_targetFacing = newdir;
}
}
-
}
@@ -982,14 +974,11 @@ void Actor::putActor(int dstX, int dstY, int newRoom) {
if (_visible) {
if (isInCurrentRoom()) {
-
if (_moving) {
stopActorMoving();
startAnimActor(_standFrame);
}
-
adjustActorPos();
-
} else {
#ifdef ENABLE_HE
if (_vm->_game.heversion >= 71)
@@ -1003,8 +992,8 @@ void Actor::putActor(int dstX, int dstY, int newRoom) {
}
// V0 always sets the actor to face the camera upon entering a room
- if( _vm->_game.version == 0 )
- setDirection( oldDirToNewDir(2));
+ if(_vm->_game.version == 0)
+ setDirection(oldDirToNewDir(2));
}
static bool inBoxQuickReject(const BoxCoords &box, int x, int y, int threshold) {
@@ -1139,6 +1128,7 @@ AdjustBoxResult Actor_v2::adjustXYToBeInBox(const int dstX, const int dstY) {
abr.x = foundX;
abr.y = foundY;
abr.box = box;
+
break;
}
if (dist < bestDist) {
@@ -1324,20 +1314,19 @@ void Actor::showActor() {
_vm->ensureResourceLoaded(rtCostume, _costume);
if (_vm->_game.version == 0) {
-
- ActorC64 *a = ((ActorC64*) this);
+ ActorC64 *a = ((ActorC64 *)this);
a->_costCommand = a->_costCommandNew = 0xFF;
- for( int i = 0; i < 8; ++i ) {
+ for(int i = 0; i < 8; ++i) {
a->_limbFrameRepeat[i] = 0;
a->_limbFrameRepeatNew[i] = 0;
}
_cost.reset();
- // 0x39DF
- a->_animFrameRepeat = 1;
+ // 0x39DF
+ a->_animFrameRepeat = 1;
a->_speaking = 0;
startAnimActor(_standFrame);
@@ -1880,10 +1869,10 @@ void ActorC64::startAnimActor(int f) {
return;
}
- if( f == _standFrame )
- setDirection( _facing );
+ if(f == _standFrame)
+ setDirection(_facing);
else
- animateActor( newDirToOldDir(_facing) );
+ animateActor(newDirToOldDir(_facing));
}
void Actor::animateActor(int anim) {
@@ -1898,6 +1887,7 @@ void Actor::animateActor(int anim) {
dir = anim % 1000;
} else {
+
cmd = anim / 4;
dir = oldDirToNewDir(anim % 4);
@@ -1970,7 +1960,7 @@ void ActorC64::animateCostume() {
speakCheck();
- for( _limb_current = 0; _limb_current < 8; ++_limb_current ) {
+ for(_limb_current = 0; _limb_current < 8; ++_limb_current) {
limbFrameCheck();
if (_vm->_costumeLoader->increaseAnims(this))
@@ -1983,15 +1973,15 @@ void ActorC64::speakCheck() {
if (v0ActorTalkArray[_number] & 0x80)
return;
- int cmd = newDirToOldDir( _facing );
+ int cmd = newDirToOldDir(_facing);
if (_speaking & 0x80)
cmd += 0x0C;
else
cmd += 0x10;
- _animFrameRepeat = -1;
- animateActor( cmd );
+ _animFrameRepeat = -1;
+ animateActor(cmd);
}
#ifdef ENABLE_SCUMM_7_8
@@ -2622,7 +2612,7 @@ bool Actor::isPlayer() {
}
bool Actor_v2::isPlayer() {
- // isPlayer() is not supported by v0
+ // isPlayer() is not supported by v0
assert(_vm->_game.version != 0);
return _vm->VAR(42) <= _number && _number <= _vm->VAR(43);
}
@@ -2781,7 +2771,7 @@ void ScummEngine_v71he::queueAuxEntry(int actorNum, int subIndex) {
void ActorC64::animateActor(int anim) {
int dir = -1;
- switch( anim ) {
+ switch (anim) {
case 0x00:
case 0x04:
dir = 0;
@@ -2806,21 +2796,21 @@ void ActorC64::animateActor(int anim) {
break;
}
- if( isInCurrentRoom() ) {
+ if(isInCurrentRoom()) {
_costCommandNew = anim;
_vm->_costumeLoader->costumeDecodeData(this, 0, 0);
- if( dir == -1 )
+ if(dir == -1)
return;
- _facing = normalizeAngle( oldDirToNewDir(dir) );
+ _facing = normalizeAngle(oldDirToNewDir(dir));
} else {
- if( anim > 4 && anim <= 7 )
- _facing = normalizeAngle( oldDirToNewDir(dir) );
- }
+ if(anim > 4 && anim <= 7)
+ _facing = normalizeAngle(oldDirToNewDir(dir));
+ }
}
void ActorC64::saveLoadWithSerializer(Serializer *ser) {
diff --git a/engines/scumm/actor.h b/engines/scumm/actor.h
index 4e251d0e3c..c82bd641bd 100644
--- a/engines/scumm/actor.h
+++ b/engines/scumm/actor.h
@@ -352,41 +352,41 @@ public:
byte _miscflags;
byte _speaking;
- int8 _animFrameRepeat;
- int8 _limbFrameRepeatNew[8], _limbFrameRepeat[8];
+ int8 _animFrameRepeat;
+ int8 _limbFrameRepeatNew[8], _limbFrameRepeat[8];
- byte _limb_current;
+ byte _limb_current;
bool _limb_flipped[8];
public:
ActorC64(ScummEngine *scumm, int id) : Actor_v2(scumm, id) {
- _costCommand = 0xFF;
- _speaking = 0;
- _animFrameRepeat = 0;
- _costCommandNew = 0xFF;
+ _costCommand = 0xFF;
+ _speaking = 0;
+ _animFrameRepeat = 0;
+ _costCommandNew = 0xFF;
- for( int i = 0; i < 8; ++i ) {
+ for(int i = 0; i < 8; ++i) {
_limbFrameRepeatNew[i] = 0;
_limbFrameRepeat[i] = 0;
_limb_flipped[i] = false;
}
}
+
virtual void initActor(int mode) {
Actor_v2::initActor(mode);
if (mode == -1) {
_miscflags = 0;
}
-
}
- virtual void animateActor(int anim);
+ virtual void animateActor(int anim);
virtual void animateCostume();
- void limbFrameCheck();
+ void limbFrameCheck();
- void speakCheck();
- virtual void setDirection(int direction);
- void startAnimActor(int f);
+ void speakCheck();
+ virtual void setDirection(int direction);
+ void startAnimActor(int f);
// Used by the save/load system:
virtual void saveLoadWithSerializer(Serializer *ser);
diff --git a/engines/scumm/costume.cpp b/engines/scumm/costume.cpp
index 489c1f46e7..0b22cf38e2 100644
--- a/engines/scumm/costume.cpp
+++ b/engines/scumm/costume.cpp
@@ -1190,11 +1190,11 @@ byte C64CostumeRenderer::drawLimb(const Actor *a, int limb) {
}
// Invalid current position?
- if( a->_cost.curpos[limb] == 0xFFFF )
+ if(a->_cost.curpos[limb] == 0xFFFF)
return 0;
- _loaded.loadCostume( a->_costume );
- byte frame = _loaded._frameOffsets[ a->_cost.curpos[limb] + a->_cost.active[limb] ];
+ _loaded.loadCostume(a->_costume);
+ byte frame = _loaded._frameOffsets[a->_cost.curpos[limb] + a->_cost.active[limb]];
// Get the frame ptr
byte ptrLow = _loaded._baseptr[frame];
@@ -1224,7 +1224,7 @@ byte C64CostumeRenderer::drawLimb(const Actor *a, int limb) {
if (!width || !height)
return 0;
- int xpos = _actorX + (A->_limb_flipped[ limb ] ? -1 : +1) * (offsetX * 8 - a->_width / 2);
+ int xpos = _actorX + (A->_limb_flipped[limb] ? -1 : +1) * (offsetX * 8 - a->_width / 2);
// +1 as we appear to be 1 pixel away from the original interpreter
int ypos = _actorY - offsetY + 1;
@@ -1234,13 +1234,13 @@ byte C64CostumeRenderer::drawLimb(const Actor *a, int limb) {
byte color = data[y * width + x];
byte pcolor;
- int destX = xpos + (A->_limb_flipped[ limb ] ? -(x + 1) : x) * 8;
+ int destX = xpos + (A->_limb_flipped[limb] ? -(x + 1) : x) * 8;
int destY = ypos + y;
if (destY >= 0 && destY < _out.h && destX >= 0 && destX < _out.w) {
byte *dst = (byte *)_out.pixels + destY * _out.pitch + destX;
byte *mask = _vm->getMaskBuffer(0, destY, _zbuf);
- if (A->_limb_flipped[ limb ]) {
+ if (A->_limb_flipped[limb]) {
LINE(0, 0); LINE(2, 2); LINE(4, 4); LINE(6, 6);
} else {
LINE(6, 0); LINE(4, 2); LINE(2, 4); LINE(0, 6);
@@ -1251,7 +1251,7 @@ byte C64CostumeRenderer::drawLimb(const Actor *a, int limb) {
_draw_top = MIN(_draw_top, ypos);
_draw_bottom = MAX(_draw_bottom, ypos + height);
- if (A->_limb_flipped[ limb ])
+ if (A->_limb_flipped[limb])
_vm->markRectAsDirty(kMainVirtScreen, xpos - (width * 8), xpos, ypos, ypos + height, _actorID);
else
_vm->markRectAsDirty(kMainVirtScreen, xpos, xpos + (width * 8), ypos, ypos + height, _actorID);
@@ -1291,7 +1291,7 @@ void C64CostumeLoader::costumeDecodeData(Actor *a, int frame, uint usemask) {
loadCostume(a->_costume);
// Invalid costume command?
- if( A->_costCommandNew == 0xFF || (A->_costCommand == A->_costCommandNew) )
+ if(A->_costCommandNew == 0xFF || (A->_costCommand == A->_costCommandNew))
return;
A->_costCommand = A->_costCommandNew;
@@ -1308,41 +1308,41 @@ void C64CostumeLoader::costumeDecodeData(Actor *a, int frame, uint usemask) {
limbFrameNumber = ((_animCmds + cmd)[limb]);
// Is this limb flipped?
- if( limbFrameNumber & 0x80 ) {
+ if(limbFrameNumber & 0x80) {
// Invalid frame?
- if( limbFrameNumber == 0xFF )
+ if(limbFrameNumber == 0xFF)
continue;
// Store the limb frame number (clear the flipped status)
- a->_cost.frame[limb] = (limbFrameNumber & 0x7f);
+ a->_cost.frame[limb] = (limbFrameNumber & 0x7f);
- if( A->_limb_flipped[limb] != true )
+ if(A->_limb_flipped[limb] != true)
a->_cost.start[limb] = 0xFFFF;
A->_limb_flipped[limb] = true;
} else {
//Store the limb frame number
- a->_cost.frame[limb] = limbFrameNumber;
+ a->_cost.frame[limb] = limbFrameNumber;
- if( A->_limb_flipped[limb] != false )
+ if(A->_limb_flipped[limb] != false)
a->_cost.start[limb] = 0xFFFF;
A->_limb_flipped[limb] = false;
}
// Set the repeat value
- A->_limbFrameRepeatNew[limb] = A->_animFrameRepeat;
+ A->_limbFrameRepeatNew[limb] = A->_animFrameRepeat;
}
}
-byte C64CostumeLoader::getFrame( ActorC64 *A ) {
+byte C64CostumeLoader::getFrame(ActorC64 *A) {
loadCostume(A->_costume);
// Get the frame number for the current limb / Command
- return _frameOffsets[ _frameOffsets[A->_limb_current] + A->_cost.start[ A->_limb_current ] ];
+ return _frameOffsets[_frameOffsets[A->_limb_current] + A->_cost.start[A->_limb_current]];
}
byte C64CostumeLoader::increaseAnims(Actor *a) {
@@ -1352,39 +1352,39 @@ byte C64CostumeLoader::increaseAnims(Actor *a) {
loadCostume(a->_costume);
- // 0x2543
- byte frame = _frameOffsets[ a->_cost.curpos[A->_limb_current] + a->_cost.active[A->_limb_current] ];
+ // 0x2543
+ byte frame = _frameOffsets[a->_cost.curpos[A->_limb_current] + a->_cost.active[A->_limb_current]];
// Is this frame invalid?
- if ( frame == 0xFF ) {
+ if (frame == 0xFF) {
- // Repeat timer has reached 0?
- if( A->_limbFrameRepeat[A->_limb_current] == 0 ) {
+ // Repeat timer has reached 0?
+ if(A->_limbFrameRepeat[A->_limb_current] == 0) {
- // Use the previous frame
- --A->_cost.curpos[A->_limb_current];
+ // Use the previous frame
+ --A->_cost.curpos[A->_limb_current];
// Reset the comstume command
- A->_costCommandNew = 0xFF;
- A->_costCommand = 0xFF;
-
- // Set the frame/start to invalid
+ A->_costCommandNew = 0xFF;
+ A->_costCommand = 0xFF;
+
+ // Set the frame/start to invalid
A->_cost.frame[A->_limb_current] = 0xFFFF;
A->_cost.start[A->_limb_current] = 0xFFFF;
- } else {
+ } else {
// Repeat timer enabled?
- if( A->_limbFrameRepeat[A->_limb_current] != -1 )
- --A->_limbFrameRepeat[A->_limb_current];
+ if(A->_limbFrameRepeat[A->_limb_current] != -1)
+ --A->_limbFrameRepeat[A->_limb_current];
// No, restart at frame 0
- a->_cost.curpos[A->_limb_current] = 0;
- }
- }
+ a->_cost.curpos[A->_limb_current] = 0;
+ }
+ }
// Limb frame has changed?
- if( limbPrevious == a->_cost.curpos[A->_limb_current] )
+ if(limbPrevious == a->_cost.curpos[A->_limb_current])
return 0;
return 1;
diff --git a/engines/scumm/costume.h b/engines/scumm/costume.h
index 4600cc5670..50f23dbacf 100644
--- a/engines/scumm/costume.h
+++ b/engines/scumm/costume.h
@@ -74,7 +74,7 @@ public:
void costumeDecodeData(Actor *a, int frame, uint usemask);
byte increaseAnims(Actor *a);
- byte getFrame( ActorC64 *A );
+ byte getFrame(ActorC64 *A);
protected:
diff --git a/engines/scumm/object.h b/engines/scumm/object.h
index 37ccc4eef6..8212075e43 100644
--- a/engines/scumm/object.h
+++ b/engines/scumm/object.h
@@ -33,14 +33,14 @@ static inline int OBJECT_V0(int id, byte type) {
enum ObjectV0Type {
kObjectV0TypeFG = 0, // foreground object
- // - with owner/state, might (but has not to) be pickupable
- // -> with entry in _objectOwner/StateTable
- // -> all objects in _inventory have this type
- // - image can be exchanged (background overlay)
+ // - with owner/state, might (but has not to) be pickupable
+ // -> with entry in _objectOwner/StateTable
+ // -> all objects in _inventory have this type
+ // - image can be exchanged (background overlay)
kObjectV0TypeBG = 1, // background object
- // - without owner/state, not pickupable (room only)
- // -> without entry in _objectOwner/StateTable
- // - image cannot be exchanged (part of background image)
+ // - without owner/state, not pickupable (room only)
+ // -> without entry in _objectOwner/StateTable
+ // - image cannot be exchanged (part of background image)
kObjectV0TypeActor = 2 // object is an actor
};
diff --git a/engines/scumm/script.cpp b/engines/scumm/script.cpp
index 8880963698..3bd70d0e24 100644
--- a/engines/scumm/script.cpp
+++ b/engines/scumm/script.cpp
@@ -1000,7 +1000,7 @@ void ScummEngine::killScriptsAndResources() {
for (i = 0; i < _numNewNames; i++) {
const int obj = _newNames[i];
if (obj) {
- const int owner = getOwner( (_game.version != 0 ? obj : OBJECT_V0_ID(obj) ) );
+ const int owner = getOwner((_game.version != 0 ? obj : OBJECT_V0_ID(obj)));
// We can delete custom name resources if either the object is
// no longer in use (i.e. not owned by anyone anymore); or if
// it is an object which is owned by a room.
@@ -1234,7 +1234,7 @@ void ScummEngine_v0::checkAndRunSentenceScript() {
// If two objects are involved, at least one must be in the actors inventory
if (st.objectB &&
(OBJECT_V0_TYPE(st.objectA) != kObjectV0TypeFG || _objectOwnerTable[st.objectA] != VAR(VAR_EGO)) &&
- (OBJECT_V0_TYPE(st.objectB) != kObjectV0TypeFG || _objectOwnerTable[st.objectB] != VAR(VAR_EGO)))
+ (OBJECT_V0_TYPE(st.objectB) != kObjectV0TypeFG || _objectOwnerTable[st.objectB] != VAR(VAR_EGO)))
{
if (getVerbEntrypoint(st.objectA, kVerbPickUp))
doSentence(kVerbPickUp, st.objectA, 0);
diff --git a/engines/scumm/script_v0.cpp b/engines/scumm/script_v0.cpp
index 8de95858f2..07be151ce2 100644
--- a/engines/scumm/script_v0.cpp
+++ b/engines/scumm/script_v0.cpp
@@ -687,24 +687,24 @@ void ScummEngine_v0::o_animateActor() {
ActorC64 *a = (ActorC64*) derefActor(act, "o_animateActor");
- a->_animFrameRepeat = repeat;
+ a->_animFrameRepeat = repeat;
- switch( anim ) {
+ switch (anim) {
- case 0xFE:
- // 0x6993
- a->_speaking = 0x80; // Enabled, but not switching
- return;
+ case 0xFE:
+ // 0x6993
+ a->_speaking = 0x80; // Enabled, but not switching
+ return;
- case 0xFD:
- // 0x69A3
- a->_speaking = 0x00;
- return;
+ case 0xFD:
+ // 0x69A3
+ a->_speaking = 0x00;
+ return;
- case 0xFF:
- a->stopActorMoving();
- return;
- }
+ case 0xFF:
+ a->stopActorMoving();
+ return;
+ }
a->animateActor(anim);
a->animateCostume();
diff --git a/engines/scumm/script_v2.cpp b/engines/scumm/script_v2.cpp
index 6857f8635b..1b8dc965e0 100644
--- a/engines/scumm/script_v2.cpp
+++ b/engines/scumm/script_v2.cpp
@@ -994,7 +994,7 @@ void ScummEngine_v2::o2_drawSentence() {
int slot = getVerbSlot(VAR(VAR_SENTENCE_VERB), 0);
if (!((_userState & USERSTATE_IFACE_SENTENCE) ||
- (_game.platform == Common::kPlatformNES && (_userState & USERSTATE_IFACE_ALL))))
+ (_game.platform == Common::kPlatformNES && (_userState & USERSTATE_IFACE_ALL))))
return;
if (getResourceAddress(rtVerb, slot))
diff --git a/engines/scumm/verbs.cpp b/engines/scumm/verbs.cpp
index 2b9d2342bc..88a1283067 100644
--- a/engines/scumm/verbs.cpp
+++ b/engines/scumm/verbs.cpp
@@ -476,7 +476,6 @@ void ScummEngine_v2::handleMouseOver(bool updateInventory) {
}
void ScummEngine_v0::handleMouseOver(bool updateInventory) {
- //drawSentence();
ScummEngine_v2::handleMouseOver(updateInventory);
}
@@ -695,7 +694,7 @@ void ScummEngine_v0::verbExec() {
if (_activeVerb == kVerbWhatIs)
return;
- if (!(_activeVerb == kVerbWalkTo && _activeObject == 0)) {
+ if (!(_activeVerb == kVerbWalkTo && _activeObject == 0)) {
doSentence(_activeVerb, _activeObject, _activeObject2);
if (_activeVerb != kVerbWalkTo) {
_activeVerb = kVerbWalkTo;