aboutsummaryrefslogtreecommitdiff
path: root/saga
diff options
context:
space:
mode:
authorEugene Sandulenko2005-07-29 17:58:00 +0000
committerEugene Sandulenko2005-07-29 17:58:00 +0000
commitec4f7d3d7c0ba9292d268195cd64c2de26b73220 (patch)
treec9a0e3d9e24c5ea8eb0796ddd6c7066ccbfce894 /saga
parent618572ff13f3392568793443a7fc11f5248021c7 (diff)
downloadscummvm-rg350-ec4f7d3d7c0ba9292d268195cd64c2de26b73220.tar.gz
scummvm-rg350-ec4f7d3d7c0ba9292d268195cd64c2de26b73220.tar.bz2
scummvm-rg350-ec4f7d3d7c0ba9292d268195cd64c2de26b73220.zip
Whitespaces
svn-id: r18595
Diffstat (limited to 'saga')
-rw-r--r--saga/actor.cpp168
-rw-r--r--saga/animation.cpp22
-rw-r--r--saga/events.cpp14
-rw-r--r--saga/font.cpp24
-rw-r--r--saga/game.cpp42
-rw-r--r--saga/gfx.cpp10
-rw-r--r--saga/image.cpp4
-rw-r--r--saga/interface.cpp214
-rw-r--r--saga/isomap.cpp106
-rw-r--r--saga/ite_introproc.cpp12
-rw-r--r--saga/itedata.cpp6
-rw-r--r--saga/music.cpp20
-rw-r--r--saga/objectmap.cpp16
-rw-r--r--saga/puzzle.cpp6
-rw-r--r--saga/render.cpp8
-rw-r--r--saga/rscfile.cpp16
-rw-r--r--saga/saga.cpp30
-rw-r--r--saga/saveload.cpp18
-rw-r--r--saga/scene.cpp46
-rw-r--r--saga/script.cpp51
-rw-r--r--saga/sfuncs.cpp58
-rw-r--r--saga/sndres.cpp10
-rw-r--r--saga/sound.cpp4
-rw-r--r--saga/sprite.cpp18
-rw-r--r--saga/sthread.cpp58
25 files changed, 490 insertions, 491 deletions
diff --git a/saga/actor.cpp b/saga/actor.cpp
index 6dc1d2c8fc..1e5be15044 100644
--- a/saga/actor.cpp
+++ b/saga/actor.cpp
@@ -191,7 +191,7 @@ Actor::Actor(SagaEngine *vm) : _vm(vm) {
_pathListIndex = _pathNodeListIndex = _newPathNodeListIndex = -1;
_pathDirectionListCount = 0;
_pathDirectionListAlloced = 0;
-
+
_centerActor = _protagonist = NULL;
_protagState = 0;
_lastTickMsec = 0;
@@ -200,7 +200,7 @@ Actor::Actor(SagaEngine *vm) : _vm(vm) {
_xCellCount = _vm->getDisplayWidth();
_pathCell = (int8 *)malloc(_yCellCount * _xCellCount * sizeof(*_pathCell));
-
+
_pathRect.left = 0;
_pathRect.right = _vm->getDisplayWidth();
_pathRect.top = _vm->getDisplayInfo().pathStartY;
@@ -212,9 +212,9 @@ Actor::Actor(SagaEngine *vm) : _vm(vm) {
if (_actorContext == NULL) {
error("Actor::Actor() resource context not found");
}
-
+
_vm->_resource->loadResource(_actorContext, _vm->getResourceDescription()->actorsStringsResourceId, stringsPointer, stringsLength);
-
+
_vm->loadStrings(_actorsStrings, stringsPointer, stringsLength);
free(stringsPointer);
} else {
@@ -327,7 +327,7 @@ bool Actor::loadActorResources(ActorData *actor) {
framesCount = resourceLength / 16;
debug(9, "Frame resource contains %d frames", framesCount);
-
+
framesPointer = (ActorFrameSequence *)malloc(sizeof(ActorFrameSequence) * framesCount);
if (framesPointer == NULL) {
memoryError("Actor::loadActorResources");
@@ -392,7 +392,7 @@ void Actor::stepZoneAction(ActorData *actor, const HitZone *hitZone, bool exit,
if (((hitZone->getFlags() & kHitZoneTerminus) && !stopped) || (!(hitZone->getFlags() & kHitZoneTerminus) && stopped)) {
return;
}
-
+
if (!exit) {
if (hitZone->getFlags() & kHitZoneAutoWalk) {
actor->currentAction = kActionWalkDir;
@@ -432,7 +432,7 @@ void Actor::realLocation(Location &location, uint16 objectId, uint16 walkFlags)
angle = (location.x + 2) & 15;
distance = location.y;
- location.u() = (angleLUT[angle][0] * distance) >> 8;
+ location.u() = (angleLUT[angle][0] * distance) >> 8;
location.v() = (angleLUT[angle][1] * distance) >> 8;
} else {
angle = location.x & 15;
@@ -459,7 +459,7 @@ void Actor::actorFaceTowardsPoint(uint16 actorId, const Location &toLocation) {
Location delta;
//debug (8, "Actor::actorFaceTowardsPoint actorId=%i", actorId);
actor = getActor(actorId);
-
+
toLocation.delta(actor->location, delta);
if (_vm->_scene->getFlags() & kSceneFlagISO) {
@@ -493,7 +493,7 @@ void Actor::actorFaceTowardsObject(uint16 actorId, uint16 objectId) {
ObjectData *Actor::getObj(uint16 objId) {
ObjectData *obj;
-
+
if (!validObjId(objId))
error("Actor::getObj Wrong objId 0x%X", objId);
@@ -529,14 +529,14 @@ ActorData *Actor::getActor(uint16 actorId) {
}
bool Actor::validFollowerLocation(const Location &location) {
- Point point;
+ Point point;
location.toScreenPointXY(point);
-
+
if ((point.x < 5) || (point.x >= _vm->getDisplayWidth() - 5) ||
(point.y < 0) || (point.y > _vm->getSceneHeight())) {
return false;
}
-
+
return (_vm->_scene->canWalk(point));
}
@@ -552,7 +552,7 @@ void Actor::updateActorsScene(int actorsEntrance) {
Location possibleLocation;
Point delta;
const SceneEntry *sceneEntry;
-
+
if (_vm->getGameType() == GType_IHNM) {
warning("Actors aren't implemented for IHNM yet");
return;
@@ -588,9 +588,9 @@ void Actor::updateActorsScene(int actorsEntrance) {
actor->actionCycle = (_vm->_rnd.getRandomNumber(7) & 0x7) * 4; // 1/8th chance
}
}
-
+
assert(_protagonist);
-
+
if ((actorsEntrance >= 0) && (_vm->_scene->_entryList.entryListCount > 0)) {
if (_vm->_scene->_entryList.entryListCount <= actorsEntrance) {
actorsEntrance = 0; //OCEAN bug
@@ -619,19 +619,19 @@ void Actor::updateActorsScene(int actorsEntrance) {
calcScreenPosition(_protagonist);
for (i = 0; i < _actorsCount; i++) {
- actor = _actors[i];
+ actor = _actors[i];
if (actor->flags & (kFollower)) {
actor->facingDirection = actor->actionDirection = _protagonist->facingDirection;
actor->currentAction = kActionWait;
actor->walkStepsCount = actor->walkStepIndex = 0;
actor->location.z = _protagonist->location.z;
-
+
if (_vm->_scene->getFlags() & kSceneFlagISO) {
_vm->_isoMap->placeOnTileMap(_protagonist->location, actor->location, 3, followerDirection & 0x07);
} else {
followerDirection &= 0x07;
-
+
possibleLocation = _protagonist->location;
@@ -643,7 +643,7 @@ void Actor::updateActorsScene(int actorsEntrance) {
tempLocation = possibleLocation;
tempLocation.x += delta.x;
tempLocation.y += delta.y;
-
+
if (validFollowerLocation( tempLocation)) {
possibleLocation = tempLocation;
} else {
@@ -686,7 +686,7 @@ ActorFrameRange *Actor::getActorFrameRange(uint16 actorId, int frameType) {
if (frameType >= actor->framesCount)
error("Actor::getActorFrameRange Wrong frameType 0x%X actorId 0x%X", frameType, actorId);
-
+
if ((actor->facingDirection < kDirUp) || (actor->facingDirection > kDirUpLeft))
error("Actor::getActorFrameRange Wrong direction 0x%X actorId 0x%X", actor->facingDirection, actorId);
@@ -716,7 +716,7 @@ void Actor::handleSpeech(int msec) {
removeFirst = true;
} else {
removeFirst = true;
- }
+ }
_activeSpeech.playing = false;
if (_activeSpeech.actorIds[0] != 0) {
actor = getActor(_activeSpeech.actorIds[0]);
@@ -748,7 +748,7 @@ void Actor::handleSpeech(int msec) {
if (_vm->_script->_skipSpeeches) {
_activeSpeech.stringsCount = 0;
- _vm->_script->wakeUpThreads(kWaitTypeSpeech);
+ _vm->_script->wakeUpThreads(kWaitTypeSpeech);
}
if (_activeSpeech.stringsCount == 0) {
@@ -799,7 +799,7 @@ void Actor::handleSpeech(int msec) {
}
_activeSpeech.speechBox.setWidth(width);
-
+
if (_activeSpeech.actorIds[0] != 0) {
actor = getActor(_activeSpeech.actorIds[0]);
_activeSpeech.speechBox.setHeight(height);
@@ -818,9 +818,9 @@ void Actor::handleSpeech(int msec) {
}
_activeSpeech.drawRect.setWidth(width);
_activeSpeech.drawRect.setHeight(height);
- }
+ }
- _activeSpeech.playing = true;
+ _activeSpeech.playing = true;
}
void Actor::handleActions(int msec, bool setup) {
@@ -841,7 +841,7 @@ void Actor::handleActions(int msec, bool setup) {
actor = _actors[i];
if (!actor->inScene)
continue;
-
+
if ((_vm->getGameType() == GType_ITE) && (i == ACTOR_DRAGON_INDEX)) {
moveDragon(actor);
continue;
@@ -894,7 +894,7 @@ void Actor::handleActions(int msec, bool setup) {
case kActionWalkToLink:
if (_vm->_scene->getFlags() & kSceneFlagISO) {
actor->partialTarget.delta(actor->location, delta);
-
+
while ((delta.u() == 0) && (delta.v() == 0)) {
if ((actor == _protagonist) && (_vm->mouseButtonPressed())) {
@@ -936,7 +936,7 @@ void Actor::handleActions(int msec, bool setup) {
addDelta.u() += (addDelta.u() > 0) ? (delta.v() / 2) : (-delta.v() / 2);
addDelta.u() /= delta.v();
}
- } else {
+ } else {
addDelta.u() = clamp( -speed, delta.u(), speed );
if (addDelta.u() == delta.u()) {
addDelta.v() = delta.v();
@@ -977,7 +977,7 @@ void Actor::handleActions(int msec, bool setup) {
speed = 1;
}
- if ((actor->actionDirection == kDirUp) || (actor->actionDirection == kDirDown)) {
+ if ((actor->actionDirection == kDirUp) || (actor->actionDirection == kDirDown)) {
addDelta.y = clamp(-speed, delta.y, speed);
if (addDelta.y == delta.y) {
addDelta.x = delta.x;
@@ -987,7 +987,7 @@ void Actor::handleActions(int msec, bool setup) {
addDelta.x /= delta.y;
actor->facingDirection = actor->actionDirection;
}
- } else {
+ } else {
addDelta.x = clamp(-2 * speed, delta.x, 2 * speed);
if (addDelta.x == delta.x) {
addDelta.y = delta.y;
@@ -1080,7 +1080,7 @@ void Actor::handleActions(int msec, bool setup) {
actor->actionCycle++;
frameRange = getActorFrameRange(actor->id, actor->cycleFrameSequence);
-
+
if (actor->currentAction == kActionPongFrames) {
if (actor->actionCycle >= frameRange->frameCount * 2 - 2) {
if (actor->actorFlags & kActorContinuous) {
@@ -1132,7 +1132,7 @@ void Actor::handleActions(int msec, bool setup) {
actor->location = actor->finalTarget;
actor->currentAction = kActionFreeze;
_vm->_script->wakeUpActorThread(kWaitTypeWalk, actor);
- }
+ }
break;
case kActionClimb:
@@ -1237,7 +1237,7 @@ bool Actor::calcScreenPosition(CommonObjectData *commonObjectData) {
commonObjectData->location.toScreenPointXYZ(commonObjectData->screenPosition);
}
- result = commonObjectData->screenPosition.x > -64 &&
+ result = commonObjectData->screenPosition.x > -64 &&
commonObjectData->screenPosition.x < _vm->getDisplayWidth() + 64 &&
commonObjectData->screenPosition.y > -64 &&
commonObjectData->screenPosition.y < _vm->getSceneHeight() + 64;
@@ -1295,7 +1295,7 @@ void Actor::createDrawOrderList() {
actor = _actors[i];
if (!actor->inScene)
continue;
-
+
if (calcScreenPosition(actor)) {
_drawOrderList.pushBack(actor, compareFunction);
}
@@ -1308,7 +1308,7 @@ void Actor::createDrawOrderList() {
if (obj->sceneNumber != _vm->_scene->currentSceneNumber())
continue;
-
+
if (calcScreenPosition(obj)) {
_drawOrderList.pushBack(obj, compareFunction);
}
@@ -1321,7 +1321,7 @@ bool Actor::getSpriteParams(CommonObjectData *commonObjectData, int &frameNumber
// warning("not protagonist");
return false;
}
- frameNumber = 8;
+ frameNumber = 8;
spriteList = &_vm->_sprite->_mainSprites;
} else if (validActorId(commonObjectData->id)) {
spriteList = &((ActorData *)commonObjectData)->spriteList;
@@ -1364,7 +1364,7 @@ void Actor::drawActors() {
if (!getSpriteParams(drawObject, frameNumber, spriteList)) {
continue;
}
-
+
if (_vm->_scene->getFlags() & kSceneFlagISO) {
_vm->_isoMap->drawSprite(backBuffer, *spriteList, frameNumber, drawObject->location, drawObject->screenPosition, drawObject->screenScale);
} else {
@@ -1400,7 +1400,7 @@ void Actor::drawSpeech(void) {
if (_activeSpeech.actorsCount > 1) {
height = _vm->_font->getHeight(kMediumFont);
width = _vm->_font->getStringWidth(kMediumFont, _activeSpeech.strings[0], 0, kFontNormal);
-
+
for (i = 0; i < _activeSpeech.actorsCount; i++) {
actor = getActor(_activeSpeech.actorIds[i]);
calcScreenPosition(actor);
@@ -1408,7 +1408,7 @@ void Actor::drawSpeech(void) {
textPoint.x = clamp( 10, actor->screenPosition.x - width / 2, _vm->getDisplayWidth() - 10 - width);
textPoint.y = clamp( 10, actor->screenPosition.y - 58, _vm->getSceneHeight() - 10 - height);
- _vm->_font->textDraw(kMediumFont, backBuffer, _activeSpeech.strings[0], textPoint,
+ _vm->_font->textDraw(kMediumFont, backBuffer, _activeSpeech.strings[0], textPoint,
_activeSpeech.speechColor[i], _activeSpeech.outlineColor[i], _activeSpeech.getFontFlags(i));
}
} else {
@@ -1429,7 +1429,7 @@ bool Actor::followProtagonist(ActorData *actor) {
int16 prefV;
int16 newU;
int16 newV;
-
+
assert(_protagonist);
actor->flags &= ~(kFaster | kFastest);
@@ -1470,7 +1470,7 @@ bool Actor::followProtagonist(ActorData *actor) {
return actorWalkTo(actor->id, newLocation);
}
- } else {
+ } else {
prefer1.x = (100 * _protagonist->screenScale) >> 8;
prefer1.y = (50 * _protagonist->screenScale) >> 8;
@@ -1485,14 +1485,14 @@ bool Actor::followProtagonist(ActorData *actor) {
if (prefer1.y < 8) {
prefer1.y = 8;
}
-
+
prefer2.x = prefer1.x * 2;
prefer2.y = prefer1.y * 2;
prefer3.x = prefer1.x + prefer1.x / 2;
prefer3.y = prefer1.y + prefer1.y / 2;
actor->location.delta(protagonistLocation, delta);
-
+
protagonistBGMaskType = 0;
if (_vm->_scene->isBGMaskPresent() && _vm->_scene->validBGMaskPoint(_protagonist->screenPosition)) {
protagonistBGMaskType = _vm->_scene->getBGMaskType(_protagonist->screenPosition);
@@ -1634,7 +1634,7 @@ bool Actor::actorWalkTo(uint16 actorId, const Location &toLocation) {
return false;
}
} else {
-
+
actor->location.toScreenPointXY(pointFrom);
pointFrom.x &= ~1;
@@ -1681,7 +1681,7 @@ bool Actor::actorWalkTo(uint16 actorId, const Location &toLocation) {
if (!(actor->actorFlags & kActorNoCollide)) {
collision.x = ACTOR_COLLISION_WIDTH * actor->screenScale / (256 * 2);
collision.y = ACTOR_COLLISION_HEIGHT * actor->screenScale / (256 * 2);
-
+
_barrierCount = 0;
for (i = 0; (i < _actorsCount) && (_barrierCount < ACTOR_BARRIERS_MAX); i++) {
@@ -1704,7 +1704,7 @@ bool Actor::actorWalkTo(uint16 actorId, const Location &toLocation) {
if (testBox2.contains(pointFrom)) {
if (pointFrom.x > anotherActorScreenPosition.x + 4) {
testBox.right = pointFrom.x - 1;
- } else if (pointFrom.x < anotherActorScreenPosition.x - 4) {
+ } else if (pointFrom.x < anotherActorScreenPosition.x - 4) {
testBox.left = pointFrom.x + 2;
} else if (pointFrom.y > anotherActorScreenPosition.y) {
testBox.bottom = pointFrom.y;
@@ -1755,7 +1755,7 @@ bool Actor::actorWalkTo(uint16 actorId, const Location &toLocation) {
if (pointBest == pointFrom) {
actor->walkStepsCount = 0;
- }
+ }
} else {
actor->walkStepsCount = 0;
actor->addWalkStepPoint(pointTo);
@@ -1771,7 +1771,7 @@ bool Actor::actorWalkTo(uint16 actorId, const Location &toLocation) {
if (actor->flags & kProtagonist) {
_actors[1]->actorFlags &= ~kActorNoFollow; // TODO: mark all actors with kFollower flag, not only 1 and 2
_actors[2]->actorFlags &= ~kActorNoFollow;
- }
+ }
actor->currentAction = (actor->walkStepsCount >= ACTOR_MAX_STEPS_COUNT) ? kActionWalkToLink : kActionWalkToPoint;
actor->walkFrameSequence = kFrameWalk;
}
@@ -1795,7 +1795,7 @@ void Actor::actorSpeech(uint16 actorId, const char **strings, int stringsCount,
for (i = 0; i < stringsCount; i++) {
_activeSpeech.strings[i] = strings[i];
}
-
+
_activeSpeech.stringsCount = stringsCount;
_activeSpeech.speechFlags = speechFlags;
_activeSpeech.actorsCount = 1;
@@ -1813,18 +1813,18 @@ void Actor::actorSpeech(uint16 actorId, const char **strings, int stringsCount,
_activeSpeech.speechBox.right = actor->screenPosition.x + dist;
if (_activeSpeech.speechBox.left < 10) {
- _activeSpeech.speechBox.right += 10 - _activeSpeech.speechBox.left;
- _activeSpeech.speechBox.left = 10;
+ _activeSpeech.speechBox.right += 10 - _activeSpeech.speechBox.left;
+ _activeSpeech.speechBox.left = 10;
}
if (_activeSpeech.speechBox.right > _vm->getDisplayWidth() - 10) {
_activeSpeech.speechBox.left -= _activeSpeech.speechBox.right - _vm->getDisplayWidth() - 10;
- _activeSpeech.speechBox.right = _vm->getDisplayWidth() - 10;
- }
+ _activeSpeech.speechBox.right = _vm->getDisplayWidth() - 10;
+ }
}
void Actor::nonActorSpeech(const Common::Rect &box, const char **strings, int stringsCount, int sampleResourceId, int speechFlags) {
int i;
-
+
_vm->_script->wakeUpThreads(kWaitTypeSpeech);
for (i = 0; i < stringsCount; i++) {
@@ -1842,7 +1842,7 @@ void Actor::nonActorSpeech(const Common::Rect &box, const char **strings, int st
void Actor::simulSpeech(const char *string, uint16 *actorIds, int actorIdsCount, int speechFlags, int sampleResourceId) {
int i;
-
+
if (_vm->getGameType() == GType_IHNM) {
warning("Actors aren't implemented for IHNM yet");
return;
@@ -1863,7 +1863,7 @@ void Actor::simulSpeech(const char *string, uint16 *actorIds, int actorIdsCount,
_activeSpeech.sampleResourceId = sampleResourceId;
_activeSpeech.playing = false;
_activeSpeech.slowModeCharIndex = 0;
-
+
// caller should call thread->wait(kWaitTypeSpeech) by itself
}
@@ -1890,7 +1890,7 @@ void Actor::moveDragon(ActorData *actor) {
if ((actor->actionCycle < 0) ||
((actor->actionCycle == 0) && (actor->dragonMoveType >= ACTOR_DRAGON_TURN_MOVES))) {
-
+
moveType = kDragonMoveInvalid;
if (actor->location.distance(_protagonist->location) < 24) {
if (_dragonHunt && (_protagonist->currentAction != kActionFall)) {
@@ -1911,7 +1911,7 @@ void Actor::moveDragon(ActorData *actor) {
} else {
_dragonHunt = true;
}
-
+
if (actor->walkStepIndex + 2 > actor->walkStepsCount) {
_vm->_isoMap->findDragonTilePath(actor, actor->location, _protagonist->location, actor->actionDirection);
@@ -2065,7 +2065,7 @@ void Actor::moveDragon(ActorData *actor) {
break;
}
}
-
+
actor->dragonMoveType = moveType;
if (moveType >= ACTOR_DRAGON_TURN_MOVES) {
@@ -2111,7 +2111,7 @@ void Actor::moveDragon(ActorData *actor) {
dragonMove = &dragonMoveTable[actor->dragonMoveType];
actor->dragonBaseFrame = dragonMove->baseFrame;
-
+
actor->location.u() = actor->partialTarget.u() - dragonMove->offset[actor->actionCycle][0];
actor->location.v() = actor->partialTarget.v() - dragonMove->offset[actor->actionCycle][1];
@@ -2130,7 +2130,7 @@ void Actor::findActorPath(ActorData *actor, const Point &fromPoint, const Point
int maskType;
int i;
Rect intersect;
-
+
#ifdef ACTOR_DEBUG
_debugPointsCount = 0;
#endif
@@ -2148,7 +2148,7 @@ void Actor::findActorPath(ActorData *actor, const Point &fromPoint, const Point
setPathCell(iteratorPoint, _vm->_scene->getDoorState(maskType) ? kPathCellBarrier : kPathCellEmpty);
} else {
setPathCell(iteratorPoint, kPathCellBarrier);
- }
+ }
}
}
@@ -2164,7 +2164,7 @@ void Actor::findActorPath(ActorData *actor, const Point &fromPoint, const Point
}
}
}
-
+
#ifdef ACTOR_DEBUG
for (iteratorPoint.y = 0; iteratorPoint.y < _yCellCount; iteratorPoint.y++) {
for (iteratorPoint.x = 0; iteratorPoint.x < _xCellCount; iteratorPoint.x++) {
@@ -2180,7 +2180,7 @@ void Actor::findActorPath(ActorData *actor, const Point &fromPoint, const Point
actor->addWalkStepPoint(toPoint);
return;
}
-
+
i = fillPathArray(fromPoint, toPoint, bestPoint);
if (fromPoint == bestPoint) {
@@ -2204,7 +2204,7 @@ bool Actor::scanPathLine(const Point &point1, const Point &point2) {
int s1;
int s2;
int i;
-
+
point = point1;
delta.x = ABS(point1.x - point2.x);
delta.y = ABS(point1.y - point2.y);
@@ -2254,7 +2254,7 @@ int Actor::fillPathArray(const Point &fromPoint, const Point &toPoint, Point &be
int i;
Point bestPath;
int pointCounter;
- int startDirection;
+ int startDirection;
PathDirectionData *pathDirection;
PathDirectionData *newPathDirection;
const PathDirectionData *samplePathDirection;
@@ -2265,7 +2265,7 @@ int Actor::fillPathArray(const Point &fromPoint, const Point &toPoint, Point &be
pointCounter = 0;
bestRating = quickDistance(fromPoint, toPoint);
bestPath = fromPoint;
-
+
for (startDirection = 0; startDirection < 4; startDirection++) {
newPathDirection = addPathDirectionListData();
newPathDirection->x = fromPoint.x;
@@ -2275,12 +2275,12 @@ int Actor::fillPathArray(const Point &fromPoint, const Point &toPoint, Point &be
if (validPathCellPoint(fromPoint)) {
setPathCell(fromPoint, kDirUp);
-
+
#ifdef ACTOR_DEBUG
addDebugPoint(fromPoint, 24+36);
#endif
- }
-
+ }
+
i = 0;
do {
@@ -2289,7 +2289,7 @@ int Actor::fillPathArray(const Point &fromPoint, const Point &toPoint, Point &be
samplePathDirection = &pathDirectionLUT[pathDirection->direction][directionCount];
nextPoint.x = samplePathDirection->x + pathDirection->x;
nextPoint.y = samplePathDirection->y + pathDirection->y;
-
+
if (!validPathCellPoint(nextPoint)) {
continue;
}
@@ -2350,10 +2350,10 @@ void Actor::setActorPath(ActorData *actor, const Point &fromPoint, const Point &
}
pathToNode();
- removeNodes();
+ removeNodes();
nodeToPath();
removePathPoints();
-
+
for (i = 0; i <= _pathNodeListIndex; i++) {
actor->addWalkStepPoint(_pathNodeList[i].point);
}
@@ -2365,7 +2365,7 @@ void Actor::pathToNode() {
int i;
Point *point;
- point= &_pathList[_pathListIndex];
+ point= &_pathList[_pathListIndex];
direction = 0;
_pathNodeListIndex = -1;
@@ -2381,13 +2381,13 @@ void Actor::pathToNode() {
direction++;
}
if ((point1.x + delta.x != point2.x) || (point1.y + delta.y != point2.y)) {
- addPathNodeListPoint(point1);
+ addPathNodeListPoint(point1);
direction--;
i++;
point++;
}
}
- addPathNodeListPoint(*_pathList);
+ addPathNodeListPoint(*_pathList);
}
int pathLine(Point *pointList, const Point &point1, const Point &point2) {
@@ -2466,7 +2466,7 @@ void Actor::removeNodes() {
int i, j, k;
PathNode *iNode, *jNode, *kNode, *fNode;
fNode = &_pathNodeList[_pathNodeListIndex];
-
+
if (scanPathLine(_pathNodeList[0].point, fNode->point)) {
_pathNodeList[1] = *fNode;
_pathNodeListIndex = 1;
@@ -2523,7 +2523,7 @@ void Actor::removeNodes() {
void Actor::condenseNodeList() {
int i, j, count;
PathNode *iNode, *jNode;
-
+
count = _pathNodeListIndex;
for (i = 1, iNode = _pathNodeList + 1; i < _pathNodeListIndex; i++, iNode++) {
@@ -2557,14 +2557,14 @@ void Actor::removePathPoints() {
_newPathNodeListIndex = -1;
addNewPathNodeListPoint(_pathNodeList[0]);
-
+
for (i = 1, node = _pathNodeList + 1; i < _pathNodeListIndex; i++, node++) {
addNewPathNodeListPoint(*node);
for (j = 5; j > 0; j--) {
start = node->link - j;
end = node->link + j;
-
+
if (start < 0 || end > _pathListIndex) {
continue;
}
@@ -2574,14 +2574,14 @@ void Actor::removePathPoints() {
if ((point1.x == PATH_NODE_EMPTY) || (point2.x == PATH_NODE_EMPTY)) {
continue;
}
-
+
if (scanPathLine(point1, point2)) {
for (l = 1; l <= _newPathNodeListIndex; l++) {
if (start <= _newPathNodeList[l].link) {
_newPathNodeListIndex = l;
_newPathNodeList[_newPathNodeListIndex].point = point1;
_newPathNodeList[_newPathNodeListIndex].link = start;
- incrementNewPathNodeListIndex();
+ incrementNewPathNodeListIndex();
break;
}
}
@@ -2595,7 +2595,7 @@ void Actor::removePathPoints() {
}
}
}
-
+
addNewPathNodeListPoint(_pathNodeList[_pathNodeListIndex]);
for (i = 0, j = 0; i <= _newPathNodeListIndex; i++) {
@@ -2623,7 +2623,7 @@ void Actor::drawPathTest() {
void Actor::saveState(Common::OutSaveFile *out) {
uint16 i;
-
+
out->writeSint16LE(getProtagState());
for (i = 0; i < _actorsCount; i++) {
diff --git a/saga/animation.cpp b/saga/animation.cpp
index 3657324079..81d80ebeb2 100644
--- a/saga/animation.cpp
+++ b/saga/animation.cpp
@@ -97,7 +97,7 @@ void Anim::load(uint16 animId, const byte *animResourceData, size_t animResource
anim->frameTime = DEFAULT_FRAME_TIME;
anim->flags = 0;
anim->linkId = -1;
- anim->state = ANIM_PAUSE;
+ anim->state = ANIM_PAUSE;
}
void Anim::link(int16 animId1, int16 animId2) {
@@ -120,7 +120,7 @@ void Anim::setCycles(uint16 animId, int cycles) {
AnimationData *anim;
anim = getAnimation(animId);
-
+
anim->cycles = cycles;
}
@@ -162,7 +162,7 @@ void Anim::play(uint16 animId, int vectorTime, bool playing) {
if (anim->currentFrame > anim->maxFrame) {
anim->currentFrame = anim->loopFrame;
-
+
if (anim->flags & ANIM_STOPPING || anim->currentFrame == -1) {
anim->state = ANIM_PAUSE;
}
@@ -237,7 +237,7 @@ void Anim::resume(uint16 animId, int cycles) {
AnimationData *anim;
anim = getAnimation(animId);
-
+
anim->cycles += cycles;
play(animId, 0, true);
}
@@ -281,7 +281,7 @@ int16 Anim::getCurrentFrame(uint16 animId) {
AnimationData *anim;
anim = getAnimation(animId);
-
+
return anim->currentFrame;
}
@@ -323,7 +323,7 @@ void Anim::decodeFrame(AnimationData *anim, size_t frameOffset, byte *buf, size_
error("VALIDATE_WRITE_POINTER: writePointer=%x buf=%x", writePointer, buf); \
}
#else
-#define VALIDATE_WRITE_POINTER
+#define VALIDATE_WRITE_POINTER
#endif
@@ -351,7 +351,7 @@ void Anim::decodeFrame(AnimationData *anim, size_t frameOffset, byte *buf, size_
case SAGA_FRAME_NOOP: // Does nothing
readS.readByte();
readS.readByte();
- readS.readByte();
+ readS.readByte();
continue;
break;
case SAGA_FRAME_LONG_UNCOMPRESSED_RUN: // Long Unencoded Run
@@ -377,7 +377,7 @@ void Anim::decodeFrame(AnimationData *anim, size_t frameOffset, byte *buf, size_
break;
case SAGA_FRAME_ROW_END: // End of row
xVector = readS.readSint16BE();
-
+
if (longData)
newRow = readS.readSint16BE();
else
@@ -451,17 +451,17 @@ void Anim::fillFrameOffsets(AnimationData *anim) {
int i;
bool longData = isLongData();
- MemoryReadStreamEndian readS(anim->resourceData, anim->resourceLength, _vm->isBigEndian());
+ MemoryReadStreamEndian readS(anim->resourceData, anim->resourceLength, _vm->isBigEndian());
readS.seek(12);
-
+
readS._bigEndian = !_vm->isBigEndian(); // RLE has inversion BE<>LE
for (currentFrame = 0; currentFrame <= anim->maxFrame; currentFrame++) {
anim->frameOffsets[currentFrame] = readS.pos();
// For some strange reason, the animation header is in little
- // endian format, but the actual RLE encoded frame data,
+ // endian format, but the actual RLE encoded frame data,
// including the frame header, is in big endian format. */
do {
markByte = readS.readByte();
diff --git a/saga/events.cpp b/saga/events.cpp
index c11cecfc0b..ebc959ed9a 100644
--- a/saga/events.cpp
+++ b/saga/events.cpp
@@ -52,7 +52,7 @@ Events::~Events(void) {
freeList();
}
-// Function to process event list once per frame.
+// Function to process event list once per frame.
// First advances event times, then processes each event with the appropriate
// handler depending on the type of event.
int Events::handleEvents(long msec) {
@@ -93,20 +93,20 @@ int Events::handleEvents(long msec) {
break;
}
- // Process the event appropriately based on result code from
+ // Process the event appropriately based on result code from
// handler
if ((result == EVENT_DELETE) || (result == EVENT_INVALIDCODE)) {
// If there is no event chain, delete the base event.
if (event_p->chain == NULL) {
eventi=_eventList.eraseAndPrev(eventi);
} else {
- // If there is an event chain present, move the next event
- // in the chain up, adjust it by the previous delta time,
+ // If there is an event chain present, move the next event
+ // in the chain up, adjust it by the previous delta time,
// and reprocess the event */
delta_time = event_p->time;
EVENT *from_chain=event_p->chain;
memcpy(event_p, from_chain,sizeof(*event_p));
- free(from_chain);
+ free(from_chain);
event_p->time += delta_time;
--eventi;
@@ -184,7 +184,7 @@ int Events::handleContinuous(EVENT *event) {
rect.top = (_vm->getDisplayHeight() - h) / 2;
rect.setWidth(w);
rect.setHeight(h);
-
+
backGroundSurface->transitionDissolve( maskBuffer, rect, 1, event_pc);
break;
default:
@@ -410,7 +410,7 @@ int Events::handleOneShot(EVENT *event) {
case EVENT_EXEC_BLOCKING:
case EVENT_EXEC_NONBLOCKING:
debug(6, "Exec module number %d script entry number %d", event->param, event->param2);
-
+
sthread = _vm->_script->createThread(event->param, event->param2);
if (sthread == NULL) {
_vm->_console->DebugPrintf("Thread creation failed.\n");
diff --git a/saga/font.cpp b/saga/font.cpp
index 37ca014b1d..a678d5789c 100644
--- a/saga/font.cpp
+++ b/saga/font.cpp
@@ -34,7 +34,7 @@ namespace Saga {
Font::Font(SagaEngine *vm) : _vm(vm), _initialized(false) {
int i;
- // Load font module resource context
+ // Load font module resource context
assert(_vm->getFontsCount() > 0);
@@ -89,7 +89,7 @@ void Font::loadFont(uint32 fontResourceId) {
// Create new font structure
font = (FontData *)malloc(sizeof(*font));
-
+
// Read font header
font->normal.header.charHeight = readS.readUint16();
font->normal.header.charWidth = readS.readUint16();
@@ -129,9 +129,9 @@ void Font::loadFont(uint32 fontResourceId) {
// Create outline font style
createOutline(font);
-
- // Set font data
- _fonts[_loadedFonts++] = font;
+
+ // Set font data
+ _fonts[_loadedFonts++] = font;
}
@@ -152,7 +152,7 @@ void Font::createOutline(FontData *font) {
unsigned char charRep;
- // Populate new font style character data
+ // Populate new font style character data
for (i = 0; i < FONT_CHARCOUNT; i++) {
newByteWidth = 0;
oldByteWidth = 0;
@@ -186,10 +186,10 @@ void Font::createOutline(FontData *font) {
font->outline.header.charHeight += 2;
font->outline.header.rowLength = newRowLength;
- // Allocate new font representation storage
+ // Allocate new font representation storage
font->outline.font = (unsigned char *)calloc(newRowLength, font->outline.header.charHeight);
-
+
// Generate outline font representation
for (i = 0; i < FONT_CHARCOUNT; i++) {
for (row = 0; row < font->normal.header.charHeight; row++) {
@@ -233,7 +233,7 @@ void Font::createOutline(FontData *font) {
}
}
}
- }
+ }
}
// Returns the horizontal length in pixels of the graphical representation
@@ -287,7 +287,7 @@ void Font::draw(FontId fontId, Surface *ds, const char *text, size_t count, cons
font = _fonts[fontId];
- if (flags & kFontOutline) {
+ if (flags & kFontOutline) {
offsetPoint.x--;
offsetPoint.y--;
outFont(font->outline, ds, text, count, offsetPoint, effectColor, flags);
@@ -329,7 +329,7 @@ void Font::outFont(const FontStyle & drawFont, Surface *ds, const char *text, si
textPointer = (const byte *) text;
ct = count;
- // Draw string one character at a time, maximum of 'draw_str'_ct
+ // Draw string one character at a time, maximum of 'draw_str'_ct
// characters, or no limit if 'draw_str_ct' is 0
for (; *textPointer && (!count || ct); textPointer++, ct--) {
c_code = *textPointer & 0xFFU;
@@ -470,7 +470,7 @@ int Font::getHeight(FontId fontId, const char *text, int width, FontEffectFlags
textPoint.x = (fitWidth / 2);
textPoint.y = 0;
- if (fitWidth >= textWidth) {
+ if (fitWidth >= textWidth) {
return h;
}
diff --git a/saga/game.cpp b/saga/game.cpp
index 52ceb17c25..ed2bb6c168 100644
--- a/saga/game.cpp
+++ b/saga/game.cpp
@@ -45,7 +45,7 @@ static int detectGame(const FSList &fslist, bool mode = false, int start = -1);
static PanelButton ITE_MainPanelButtons[] = {
{kPanelButtonVerb, 52,4, 57,10, kVerbWalkTo,'w',0, 0,1,0},
{kPanelButtonVerb, 52,15, 57,10, kVerbLookAt,'l',0, 2,3,0},
- {kPanelButtonVerb, 52,26, 57,10, kVerbPickUp,'p',0, 4,5,0},
+ {kPanelButtonVerb, 52,26, 57,10, kVerbPickUp,'p',0, 4,5,0},
{kPanelButtonVerb, 52,37, 57,10, kVerbTalkTo,'t',0, 0,1,0},
{kPanelButtonVerb, 110,4, 56,10, kVerbOpen,'o',0, 6,7,0},
{kPanelButtonVerb, 110,15, 56,10, kVerbClose,'c',0, 8,9,0},
@@ -53,7 +53,7 @@ static PanelButton ITE_MainPanelButtons[] = {
{kPanelButtonVerb, 110,37, 56,10, kVerbGive,'g',0, 12,13,0},
{kPanelButtonArrow, 306,6, 8,5, -1,'U',0, 0,4,2},
{kPanelButtonArrow, 306,41, 8,5, 1,'D',0, 1,5,3},
-
+
{kPanelButtonInventory, 181 + 32*0,6, 27,18, 0,'-',0, 0,0,0},
{kPanelButtonInventory, 181 + 32*1,6, 27,18, 1,'-',0, 0,0,0},
{kPanelButtonInventory, 181 + 32*2,6, 27,18, 2,'-',0, 0,0,0},
@@ -71,7 +71,7 @@ static PanelButton ITE_ConversePanelButtons[] = {
{kPanelButtonConverseText, 52,6 + CONVERSE_TEXT_HEIGHT * 2, CONVERSE_MAX_TEXT_WIDTH,CONVERSE_TEXT_HEIGHT, 2,'3',0, 0,0,0},
{kPanelButtonConverseText, 52,6 + CONVERSE_TEXT_HEIGHT * 3, CONVERSE_MAX_TEXT_WIDTH,CONVERSE_TEXT_HEIGHT, 3,'4',0, 0,0,0},
{kPanelButtonArrow, 257,6, 9,6, -1,'u',0, 0,4,2},
- {kPanelButtonArrow, 257,41, 9,6, 1,'d',0, 1,5,3},
+ {kPanelButtonArrow, 257,41, 9,6, 1,'d',0, 1,5,3},
};
static PanelButton ITE_OptionPanelButtons[] = {
@@ -116,10 +116,10 @@ static PanelButton ITE_ProtectionPanelButtons[] = {
static GameDisplayInfo ITE_DisplayInfo = {
320, 200, // logical width&height
-
+
35, // scene path y offset
137, // scene height
-
+
0, // status x offset
137, // status y offset
320, // status width
@@ -134,7 +134,7 @@ static GameDisplayInfo ITE_DisplayInfo = {
147, // verb text color
15, // verb text shadow color
96, // verb text active color
-
+
5, 4, // left portrait x, y offset
274, 4, // right portrait x, y offset
@@ -149,7 +149,7 @@ static GameDisplayInfo ITE_DisplayInfo = {
0, 148, // converse panel offsets
ARRAYSIZE(ITE_ConversePanelButtons),
ITE_ConversePanelButtons,
-
+
8, 0, // save file index
8, // optionSaveFileVisible
8, 8, // option panel offsets
@@ -197,7 +197,7 @@ static GameFileDescription ITEDEMO_GameFiles[] = {
static GameFontDescription ITEDEMO_GameFonts[] = {
{0},
{1}
-};
+};
static GameSoundInfo ITEDEMO_GameSound = {
kSoundVOC,
@@ -219,7 +219,7 @@ static GameFileDescription ITEWINDEMO_GameFiles[] = {
static GameFontDescription ITEWINDEMO_GameFonts[] = {
{2},
{0}
-};
+};
static GameSoundInfo ITEWINDEMO1_GameSound = {
kSoundPCM,
@@ -366,9 +366,9 @@ static GameFontDescription ITEDISK_GameFonts[] = {
};
static GameSoundInfo ITEDISK_GameSound = {
- kSoundVOC,
- -1,
- -1,
+ kSoundVOC,
+ -1,
+ -1,
false,
false,
true
@@ -508,7 +508,7 @@ static PanelButton IHNM_SavePanelButtons[] = {
static GameDisplayInfo IHNM_DisplayInfo = { //TODO: fill it all
640, 480, // logical width&height
-
+
0, // scene path y offset
304, // scene height
@@ -542,7 +542,7 @@ static GameDisplayInfo IHNM_DisplayInfo = { //TODO: fill it all
0, 0, // converse panel offsets
ARRAYSIZE(IHNM_ConversePanelButtons),
IHNM_ConversePanelButtons,
-
+
-1, -1, // save file index
0, // optionSaveFileVisible
0, 0, // option panel offsets
@@ -870,7 +870,7 @@ static GameDescription gameDescriptions[] = {
ITELinPatch_Files,
GF_WYRMKEEP | GF_CD_FX
},
-
+
// Inherit the earth - Win32 Demo version
{
"ite-demo",
@@ -891,7 +891,7 @@ static GameDescription gameDescriptions[] = {
ITEWinPatch2_Files,
GF_WYRMKEEP | GF_CD_FX
},
-
+
// Inherit the earth - early Win32 Demo version
{
"ite-demo",
@@ -934,7 +934,7 @@ static GameDescription gameDescriptions[] = {
NULL,
GF_WYRMKEEP | GF_CD_FX
},
-
+
// Inherit the earth - Wyrmkeep Linux CD version
// should be before GID_ITE_CD_G
// sound unchecked
@@ -1169,8 +1169,8 @@ bool SagaEngine::initGame(void) {
_gameNumber = gameNumber;
_gameDescription = &gameDescriptions[gameNumber];
_gameDisplayInfo = *_gameDescription->gameDisplayInfo;
- _displayClip.right = _gameDisplayInfo.logicalWidth;
- _displayClip.bottom = _gameDisplayInfo.logicalHeight;
+ _displayClip.right = _gameDisplayInfo.logicalWidth;
+ _displayClip.bottom = _gameDisplayInfo.logicalHeight;
if (!_resource->createContexts()) {
return false;
@@ -1232,7 +1232,7 @@ int detectGame(const FSList &fslist, bool mode, int start) {
// makes tstr1 lowercase as well
tstr1 = Common::String(file->displayName().c_str());
tstr.toLowercase();
-
+
if (filesList.contains(tstr) || filesList.contains(tstr1)) {
if (Common::md5_file(file->path().c_str(), md5sum, NULL, FILE_MD5_BYTES)) {
for (int j = 0; j < 16; j++) {
@@ -1274,7 +1274,7 @@ int detectGame(const FSList &fslist, bool mode, int start) {
}
}
- // Try the next game, couldn't find all files for the current
+ // Try the next game, couldn't find all files for the current
// game
if (file_missing) {
continue;
diff --git a/saga/gfx.cpp b/saga/gfx.cpp
index 74f02728dd..afc1a75ea0 100644
--- a/saga/gfx.cpp
+++ b/saga/gfx.cpp
@@ -80,7 +80,7 @@ void Surface::drawPalette() {
void Surface::blit(const Common::Rect &destRect, const byte *sourceBuffer) {
const byte *readPointer;
byte *writePointer;
- int row;
+ int row;
ClipData clipData;
clipData.sourceRect.left = 0;
@@ -94,13 +94,13 @@ void Surface::blit(const Common::Rect &destRect, const byte *sourceBuffer) {
clipData.destRect.right = w;
clipData.destRect.top = 0;
clipData.destRect.bottom = h;
-
+
if (!clipData.calcClip()) {
return;
}
-
+
// Transfer buffer data to surface
- readPointer = (sourceBuffer + clipData.drawSource.x) +
+ readPointer = (sourceBuffer + clipData.drawSource.x) +
(clipData.sourceRect.right * clipData.drawSource.y);
writePointer = ((byte *)pixels + clipData.drawDest.x) + (pitch * clipData.drawDest.y);
@@ -205,7 +205,7 @@ void Gfx::palToBlack(PalEntry *src_pal, double percent) {
fpercent = 1.0 - fpercent;
- // Use the correct percentage change per frame for each palette entry
+ // Use the correct percentage change per frame for each palette entry
for (i = 0, ppal = _currentPal; i < PAL_ENTRIES; i++, ppal += 4) {
new_entry = (int)(src_pal[i].red * fpercent);
diff --git a/saga/image.cpp b/saga/image.cpp
index 1cf527ac43..79550e24ea 100644
--- a/saga/image.cpp
+++ b/saga/image.cpp
@@ -187,7 +187,7 @@ int SagaEngine::decodeBGImageRLE(const byte *inbuf, size_t inbuf_len, byte *outb
break;
case 0x40: // 0100 0000
- // Repeat decoded sequence from output stream:
+ // Repeat decoded sequence from output stream:
// Max runlength 10
runcount = ((mark_byte >> 3) & 0x07U) + 3;
@@ -372,7 +372,7 @@ int SagaEngine::unbankBGImage(byte *dst_buf, const byte *src_buf, int columns, i
dstptr4[x] = srcptr4[temp];
}
- // This is to avoid generating invalid pointers -
+ // This is to avoid generating invalid pointers -
// usually innocuous, but undefined
if (y < quadruple_rows - 4) {
dstptr1 += rowjump_dest;
diff --git a/saga/interface.cpp b/saga/interface.cpp
index ba652f9f0a..b0486a1bf0 100644
--- a/saga/interface.cpp
+++ b/saga/interface.cpp
@@ -68,21 +68,21 @@ Interface::Interface(SagaEngine *vm) : _vm(vm) {
byte *resource;
size_t resourceLength;
int i;
-
+
// Load interface module resource file context
_interfaceContext = _vm->_resource->getContext(GAME_RESOURCEFILE);
if (_interfaceContext == NULL) {
error("Interface::Interface() resource context not found");
}
-
+
_mainPanel.buttons = _vm->getDisplayInfo().mainPanelButtons;
_mainPanel.buttonsCount = _vm->getDisplayInfo().mainPanelButtonsCount;
for (i = 0; i < kVerbTypesMax; i++) {
_verbTypeToPanelButton[i] = NULL;
}
-
+
for (i = 0; i < _mainPanel.buttonsCount; i++) {
if (_mainPanel.buttons[i].type == kPanelButtonVerb) {
_verbTypeToPanelButton[_mainPanel.buttons[i].id] = &_mainPanel.buttons[i];
@@ -92,7 +92,7 @@ Interface::Interface(SagaEngine *vm) : _vm(vm) {
_vm->_resource->loadResource(_interfaceContext, _vm->getResourceDescription()->mainPanelResourceId, resource, resourceLength);
_vm->decodeBGImage(resource, resourceLength, &_mainPanel.image,
&_mainPanel.imageLength, &_mainPanel.imageWidth, &_mainPanel.imageHeight);
-
+
free(resource);
_conversePanel.buttons = _vm->getDisplayInfo().conversePanelButtons;
@@ -125,7 +125,7 @@ Interface::Interface(SagaEngine *vm) : _vm(vm) {
_mainPanel.currentButton = NULL;
_inventoryUpButton = _mainPanel.getButton(_vm->getDisplayInfo().inventoryUpButtonIndex);
_inventoryDownButton = _mainPanel.getButton(_vm->getDisplayInfo().inventoryDownButtonIndex);
-
+
_conversePanel.x = _vm->getDisplayInfo().conversePanelXOffset;
_conversePanel.y = _vm->getDisplayInfo().conversePanelYOffset;
@@ -199,7 +199,7 @@ Interface::Interface(SagaEngine *vm) : _vm(vm) {
Interface::~Interface(void) {
free(_inventory);
-
+
_mainPanel.sprites.freeMem();
_defPortraits.freeMem();
_scenePortraits.freeMem();
@@ -235,7 +235,7 @@ int Interface::deactivate() {
void Interface::rememberMode() {
assert (_savedMode == -1);
- _savedMode = _panelMode;
+ _savedMode = _panelMode;
}
void Interface::restoreMode() {
@@ -255,12 +255,12 @@ void Interface::setMode(int mode) {
} else {
if (mode == kPanelConverse) {
_inMainMode = false;
- }
+ }
_saveReminderState = 0;
}
_panelMode = mode;
-
+
switch (_panelMode) {
case kPanelMain:
if (_vm->getGameType() == GType_IHNM)
@@ -402,10 +402,10 @@ bool Interface::processAscii(uint16 ascii, bool synthetic) {
if (panelButton->ascii == ascii) {
if (panelButton->type == kPanelButtonVerb) {
_vm->_script->setVerb(panelButton->id);
- }
+ }
if (panelButton->type == kPanelButtonArrow) {
inventoryChangePos(panelButton->id);
- }
+ }
return true;
}
}
@@ -464,7 +464,7 @@ bool Interface::processAscii(uint16 ascii, bool synthetic) {
void Interface::textInputRepeatCallback(void *refCon) {
((Interface *)refCon)->textInputRepeat();
-}
+}
void Interface::textInputStartRepeat(uint16 ascii) {
if (!_textInputRepeatPhase) {
@@ -502,7 +502,7 @@ void Interface::setStatusText(const char *text, int statusColor) {
strncpy(_statusText, text, STATUS_TEXT_LEN);
_statusOnceColor = statusColor;
- drawStatusBar();
+ drawStatusBar();
}
void Interface::loadScenePortraits(int resourceId) {
@@ -547,7 +547,7 @@ void Interface::draw() {
int i;
Point leftPortraitPoint;
- Point rightPortraitPoint;
+ Point rightPortraitPoint;
Rect rect;
backBuffer = _vm->_gfx->getBackBuffer();
@@ -565,7 +565,7 @@ void Interface::draw() {
drawStatusBar();
if (_panelMode == kPanelMain) {
- _mainPanel.getRect(rect);
+ _mainPanel.getRect(rect);
backBuffer->blit(rect, _mainPanel.image);
for (i = 0; i < kVerbTypesMax; i++) {
@@ -573,7 +573,7 @@ void Interface::draw() {
drawVerbPanel(backBuffer, _verbTypeToPanelButton[i]);
}
}
- } else if (_panelMode == kPanelConverse) {
+ } else if (_panelMode == kPanelConverse) {
_conversePanel.getRect(rect);
backBuffer->blit(rect, _conversePanel.image);
converseDisplayTextLines(backBuffer);
@@ -606,7 +606,7 @@ void Interface::draw() {
void Interface::calcOptionSaveSlider() {
int totalFiles = _vm->getSaveFilesCount();
- int visibleFiles = _vm->getDisplayInfo().optionSaveFileVisible;
+ int visibleFiles = _vm->getDisplayInfo().optionSaveFileVisible;
int height = _optionSaveFileSlider->height;
int sliderHeight;
int pos;
@@ -654,7 +654,7 @@ void Interface::drawPanelText(Surface *ds, InterfacePanel *panel, PanelButton *p
textPoint.x = rect.left;
textPoint.y = rect.top + 1;
-
+
_vm->_font->textDraw(kMediumFont, ds, text, textPoint,
_vm->getDisplayInfo().verbTextColor, _vm->getDisplayInfo().verbTextShadowColor, kFontShadow);
}
@@ -677,20 +677,20 @@ void Interface::drawOption() {
_optionPanel.getRect(rect);
backBuffer->blit(rect, _optionPanel.image);
- for (i = 0; i < _optionPanel.buttonsCount; i++) {
+ for (i = 0; i < _optionPanel.buttonsCount; i++) {
panelButton = &_optionPanel.buttons[i];
if (panelButton->type == kPanelButtonOption) {
drawPanelButtonText(backBuffer, &_optionPanel, panelButton);
- }
+ }
if (panelButton->type == kPanelButtonOptionText) {
- drawPanelText(backBuffer, &_optionPanel, panelButton);
- }
- }
+ drawPanelText(backBuffer, &_optionPanel, panelButton);
+ }
+ }
if (_optionSaveRectTop.height() > 0) {
backBuffer->drawRect(_optionSaveRectTop, kITEColorDarkGrey);
}
-
+
drawButtonBox(backBuffer, _optionSaveRectSlider, kSlider, _optionSaveFileSlider->state > 0);
if (_optionSaveRectBottom.height() > 0) {
@@ -704,7 +704,7 @@ void Interface::drawOption() {
for (j = 0; j < _vm->getDisplayInfo().optionSaveFileVisible; j++) {
bgColor = kITEColorDarkGrey0C;
fgColor = kITEColorBrightWhite;
-
+
idx = j + _optionSaveFileTop;
if (idx == _optionSaveFileTitleNumber) {
SWAP(bgColor, fgColor);
@@ -732,21 +732,21 @@ void Interface::drawQuit() {
_quitPanel.getRect(rect);
drawButtonBox(backBuffer, rect, kButton, false);
- for (i = 0; i < _quitPanel.buttonsCount; i++) {
+ for (i = 0; i < _quitPanel.buttonsCount; i++) {
panelButton = &_quitPanel.buttons[i];
if (panelButton->type == kPanelButtonQuit) {
drawPanelButtonText(backBuffer, &_quitPanel, panelButton);
- }
+ }
if (panelButton->type == kPanelButtonQuitText) {
drawPanelText(backBuffer, &_quitPanel, panelButton);
- }
+ }
}
}
void Interface::handleQuitUpdate(const Point& mousePoint) {
bool releasedButton;
- _quitPanel.currentButton = quitHitTest(mousePoint);
+ _quitPanel.currentButton = quitHitTest(mousePoint);
releasedButton = (_quitPanel.currentButton != NULL) && (_quitPanel.currentButton->state > 0) && (!_vm->mouseButtonPressed());
if (!_vm->mouseButtonPressed()) {
@@ -754,7 +754,7 @@ void Interface::handleQuitUpdate(const Point& mousePoint) {
}
if (releasedButton) {
- setQuit(_quitPanel.currentButton);
+ setQuit(_quitPanel.currentButton);
}
}
@@ -792,21 +792,21 @@ void Interface::drawLoad() {
_loadPanel.getRect(rect);
drawButtonBox(backBuffer, rect, kButton, false);
- for (i = 0; i < _loadPanel.buttonsCount; i++) {
+ for (i = 0; i < _loadPanel.buttonsCount; i++) {
panelButton = &_loadPanel.buttons[i];
if (panelButton->type == kPanelButtonLoad) {
drawPanelButtonText(backBuffer, &_loadPanel, panelButton);
- }
+ }
if (panelButton->type == kPanelButtonLoadText) {
drawPanelText(backBuffer, &_loadPanel, panelButton);
- }
+ }
}
}
void Interface::handleLoadUpdate(const Point& mousePoint) {
bool releasedButton;
- _loadPanel.currentButton = loadHitTest(mousePoint);
+ _loadPanel.currentButton = loadHitTest(mousePoint);
releasedButton = (_loadPanel.currentButton != NULL) && (_loadPanel.currentButton->state > 0) && (!_vm->mouseButtonPressed());
if (!_vm->mouseButtonPressed()) {
@@ -814,7 +814,7 @@ void Interface::handleLoadUpdate(const Point& mousePoint) {
}
if (releasedButton) {
- setLoad(_loadPanel.currentButton);
+ setLoad(_loadPanel.currentButton);
}
}
@@ -833,7 +833,7 @@ void Interface::handleLoadClick(const Point& mousePoint) {
void Interface::setLoad(PanelButton *panelButton) {
_loadPanel.currentButton = NULL;
switch (panelButton->id) {
- case kTextOK:
+ case kTextOK:
setMode(kPanelMain);
break;
}
@@ -863,7 +863,7 @@ void Interface::processStatusTextInput(uint16 ascii) {
if (_statusTextInputPos >= STATUS_TEXT_INPUT_MAX) {
break;
}
- if (((ascii >= 'a') && (ascii <='z')) ||
+ if (((ascii >= 'a') && (ascii <='z')) ||
((ascii >= '0') && (ascii <='9')) ||
((ascii >= 'A') && (ascii <='Z')) ||
(ascii == ' ')) {
@@ -897,7 +897,7 @@ bool Interface::processTextInput(uint16 ascii) {
case 127: // del
if (_textInputPos <= _textInputStringLength) {
if (_textInputPos != 1) {
- strncpy(tempString, _textInputString, _textInputPos - 1);
+ strncpy(tempString, _textInputString, _textInputPos - 1);
}
if (_textInputPos != _textInputStringLength) {
strncat(tempString, &_textInputString[_textInputPos], _textInputStringLength - _textInputPos);
@@ -917,7 +917,7 @@ bool Interface::processTextInput(uint16 ascii) {
}
break;
default:
- if (((ascii >= 'a') && (ascii <='z')) ||
+ if (((ascii >= 'a') && (ascii <='z')) ||
((ascii >= '0') && (ascii <='9')) ||
((ascii >= 'A') && (ascii <='Z')) ||
(ascii == ' ')) {
@@ -938,7 +938,7 @@ bool Interface::processTextInput(uint16 ascii) {
if ((_textInputStringLength != 0) && (_textInputPos != _textInputStringLength)) {
strncat(tempString, &_textInputString[_textInputPos - 1], _textInputStringLength - _textInputPos + 1);
}
-
+
strcpy(_textInputString, tempString);
_textInputStringLength = strlen(_textInputString);
_textInputPos++;
@@ -959,23 +959,23 @@ void Interface::drawTextInput(Surface *ds, InterfacePanel *panel, PanelButton *p
ch[1] = 0;
panel->calcPanelButtonRect(panelButton, rect);
drawButtonBox(ds, rect, kEdit, _textInput);
- rect.left += 4;
+ rect.left += 4;
rect.top += 4;
rect.setHeight(_vm->_font->getHeight(kSmallFont));
- i = 0;
+ i = 0;
while ((ch[0] = _textInputString[i++]) != 0) {
rect.setWidth(_vm->_font->getStringWidth(kSmallFont, ch, 0, kFontNormal));
if ((i == _textInputPos) && _textInput) {
- fgColor = kITEColorBlack;
+ fgColor = kITEColorBlack;
ds->fillRect(rect, kITEColorWhite);
} else {
- fgColor = kITEColorWhite;
+ fgColor = kITEColorWhite;
}
textPoint.x = rect.left;
textPoint.y = rect.top + 1;
- _vm->_font->textDraw(kSmallFont, ds, ch, textPoint, fgColor, 0, kFontNormal);
+ _vm->_font->textDraw(kSmallFont, ds, ch, textPoint, fgColor, 0, kFontNormal);
rect.left += rect.width();
}
if (_textInput && (_textInputPos >= i)) {
@@ -995,14 +995,14 @@ void Interface::drawSave() {
_savePanel.getRect(rect);
drawButtonBox(backBuffer, rect, kButton, false);
- for (i = 0; i < _savePanel.buttonsCount; i++) {
+ for (i = 0; i < _savePanel.buttonsCount; i++) {
panelButton = &_savePanel.buttons[i];
if (panelButton->type == kPanelButtonSave) {
drawPanelButtonText(backBuffer, &_savePanel, panelButton);
- }
+ }
if (panelButton->type == kPanelButtonSaveText) {
drawPanelText(backBuffer, &_savePanel, panelButton);
- }
+ }
}
drawTextInput(backBuffer, &_savePanel, _saveEdit);
@@ -1011,11 +1011,11 @@ void Interface::drawSave() {
void Interface::handleSaveUpdate(const Point& mousePoint) {
bool releasedButton;
- _savePanel.currentButton = saveHitTest(mousePoint);
+ _savePanel.currentButton = saveHitTest(mousePoint);
validateSaveButtons();
- releasedButton = (_savePanel.currentButton != NULL) &&
+ releasedButton = (_savePanel.currentButton != NULL) &&
(_savePanel.currentButton->state > 0) && (!_vm->mouseButtonPressed());
if (!_vm->mouseButtonPressed()) {
@@ -1023,17 +1023,17 @@ void Interface::handleSaveUpdate(const Point& mousePoint) {
}
if (releasedButton) {
- setSave(_savePanel.currentButton);
+ setSave(_savePanel.currentButton);
}
}
void Interface::handleSaveClick(const Point& mousePoint) {
_savePanel.currentButton = saveHitTest(mousePoint);
-
+
validateSaveButtons();
- _savePanel.zeroAllButtonState();
-
+ _savePanel.zeroAllButtonState();
+
if (_savePanel.currentButton == NULL) {
_textInput = false;
return;
@@ -1079,11 +1079,11 @@ void Interface::setSave(PanelButton *panelButton) {
void Interface::handleOptionUpdate(const Point& mousePoint) {
int16 mouseY;
- Rect rect;
+ Rect rect;
int totalFiles = _vm->getSaveFilesCount();
- int visibleFiles = _vm->getDisplayInfo().optionSaveFileVisible;
+ int visibleFiles = _vm->getDisplayInfo().optionSaveFileVisible;
bool releasedButton;
-
+
if (_vm->mouseButtonPressed()) {
if (_optionSaveFileSlider->state > 0) {
_optionPanel.calcPanelButtonRect(_optionSaveFileSlider, rect);
@@ -1102,7 +1102,7 @@ void Interface::handleOptionUpdate(const Point& mousePoint) {
}
}
- _optionPanel.currentButton = optionHitTest(mousePoint);
+ _optionPanel.currentButton = optionHitTest(mousePoint);
validateOptionButtons();
@@ -1113,7 +1113,7 @@ void Interface::handleOptionUpdate(const Point& mousePoint) {
}
if (releasedButton) {
- setOption(_optionPanel.currentButton);
+ setOption(_optionPanel.currentButton);
}
}
@@ -1129,8 +1129,8 @@ void Interface::handleOptionClick(const Point& mousePoint) {
if (_optionPanel.currentButton == NULL) {
return;
}
-
- if (_optionPanel.currentButton == _optionSaveFileSlider) {
+
+ if (_optionPanel.currentButton == _optionSaveFileSlider) {
if ((_optionSaveRectTop.height() > 0) && (mousePoint.y < _optionSaveRectTop.bottom)) {
_optionSaveFileTop -= _vm->getDisplayInfo().optionSaveFileVisible;
} else {
@@ -1150,7 +1150,7 @@ void Interface::handleOptionClick(const Point& mousePoint) {
if (_optionPanel.currentButton == _optionSaveFilePanel) {
_optionPanel.calcPanelButtonRect(_optionSaveFilePanel, rect);
_optionSaveFileTitleNumber = (mousePoint.y - rect.top) / (_vm->_font->getHeight(kSmallFont) + 1);
-
+
if (_optionSaveFileTitleNumber >= _vm->getDisplayInfo().optionSaveFileVisible) {
_optionSaveFileTitleNumber = _vm->getDisplayInfo().optionSaveFileVisible - 1;
}
@@ -1175,7 +1175,7 @@ void Interface::setOption(PanelButton *panelButton) {
case kTextQuitGame:
setMode(kPanelQuit);
break;
- case kTextLoad:
+ case kTextLoad:
if (_vm->getSaveFilesCount() > 0) {
if (_vm->isSaveListFull() || (_optionSaveFileTitleNumber > 0)) {
fileName = _vm->calcSaveFileName(_vm->getSaveFile(_optionSaveFileTitleNumber)->slotNumber);
@@ -1196,7 +1196,7 @@ void Interface::setOption(PanelButton *panelButton) {
}
void Interface::update(const Point& mousePoint, int updateFlag) {
-
+
if (_vm->_scene->isInDemo() || _fadeMode == kFadeOut || !_active) {
return;
}
@@ -1224,7 +1224,7 @@ void Interface::update(const Point& mousePoint, int updateFlag) {
if (updateFlag & UPDATE_MOUSECLICK) {
if (mousePoint.y < _vm->getSceneHeight()) {
- _vm->_script->playfieldClick(mousePoint, (updateFlag & UPDATE_LEFTBUTTONCLICK) != 0);
+ _vm->_script->playfieldClick(mousePoint, (updateFlag & UPDATE_LEFTBUTTONCLICK) != 0);
} else {
handleMainClick(mousePoint);
}
@@ -1368,10 +1368,10 @@ void Interface::drawStatusBar() {
if (_saveReminderState > 0) {
rect.left = _vm->getDisplayInfo().saveReminderXOffset;
rect.top = _vm->getDisplayInfo().saveReminderYOffset;
-
+
rect.right = rect.left + _vm->getDisplayInfo().saveReminderWidth;
rect.bottom = rect.top + _vm->getDisplayInfo().saveReminderHeight;
- _vm->_sprite->draw(backBuffer, _vm->getDisplayClip(), _vm->_sprite->_mainSprites,
+ _vm->_sprite->draw(backBuffer, _vm->getDisplayClip(), _vm->_sprite->_mainSprites,
_saveReminderState == 1 ? _vm->getDisplayInfo().saveReminderFirstSpriteNumber : _vm->getDisplayInfo().saveReminderSecondSpriteNumber,
rect, 256);
@@ -1404,7 +1404,7 @@ void Interface::handleMainClick(const Point& mousePoint) {
_vm->_actor->_protagonist->currentAction = kActionWait;
_vm->_script->doVerb();
}
- }
+ }
} else {
if (_saveReminderState > 0) {
Rect rect;
@@ -1431,10 +1431,10 @@ void Interface::handleMainUpdate(const Point& mousePoint) {
}
}
if (panelButton) {
- setVerbState(panelButton->id, 1);
+ setVerbState(panelButton->id, 1);
}
}
-
+
if (panelButton) {
_mainPanel.currentButton = panelButton;
return;
@@ -1449,7 +1449,7 @@ void Interface::handleMainUpdate(const Point& mousePoint) {
}
panelButton = _mainPanel.hitTest(mousePoint, kPanelAllButtons);
-
+
bool changed = false;
if ((panelButton != NULL) && (panelButton->type == kPanelButtonArrow)) {
@@ -1459,14 +1459,14 @@ void Interface::handleMainUpdate(const Point& mousePoint) {
}
changed = true;
} else {
- _vm->_script->whichObject(mousePoint);
+ _vm->_script->whichObject(mousePoint);
}
changed = changed || (panelButton != _mainPanel.currentButton);
_mainPanel.currentButton = panelButton;
if (changed) {
draw();
- }
+ }
}
@@ -1483,7 +1483,7 @@ void Interface::inventorySetPos(int key) {
_inventoryBox = key - '1';
_inventoryPos = _inventoryStart + _inventoryBox;
if (_inventoryPos >= _inventoryCount)
- _inventoryPos = -1;
+ _inventoryPos = -1;
}
void Interface::updateInventory(int pos) {
@@ -1498,18 +1498,18 @@ void Interface::updateInventory(int pos) {
if (_inventoryStart < 0) {
_inventoryStart = 0;
}
-
+
_inventoryEnd = (_inventoryCount - 1 - cols) / cols * cols;
if (_inventoryEnd < 0) {
_inventoryEnd = 0;
- }
+ }
}
void Interface::addToInventory(int objectId) {
if (_inventoryCount >= _inventorySize) {
return;
}
-
+
for (int i = _inventoryCount; i > 0; i--) {
_inventory[i] = _inventory[i - 1];
}
@@ -1565,10 +1565,10 @@ void Interface::drawInventory(Surface *backBuffer) {
ObjectData *obj;
ci = _inventoryStart;
if (_inventoryStart != 0) {
- drawPanelButtonArrow(backBuffer, &_mainPanel, _inventoryUpButton);
+ drawPanelButtonArrow(backBuffer, &_mainPanel, _inventoryUpButton);
}
if (_inventoryStart != _inventoryEnd) {
- drawPanelButtonArrow(backBuffer, &_mainPanel, _inventoryDownButton);
+ drawPanelButtonArrow(backBuffer, &_mainPanel, _inventoryDownButton);
}
for (i = 0; i < _mainPanel.buttonsCount; i++) {
@@ -1579,12 +1579,12 @@ void Interface::drawInventory(Surface *backBuffer) {
// TODO: Different colour for IHNM, probably.
backBuffer->drawRect(rect, kITEColorDarkGrey);
-
+
if (ci < _inventoryCount) {
obj = _vm->_actor->getObj(_inventory[ci]);
_vm->_sprite->draw(backBuffer, _vm->getDisplayClip(), _vm->_sprite->_mainSprites, obj->spriteListResourceId, rect, 256);
}
-
+
ci++;
}
}
@@ -1593,12 +1593,12 @@ void Interface::setVerbState(int verb, int state) {
PanelButton * panelButton = getPanelButtonByVerbType(verb);
if (state == 2) {
state = (_mainPanel.currentButton == panelButton) ? 1 : 0;
- }
+ }
panelButton->state = state;
draw();
}
-void Interface::drawButtonBox(Surface *ds, const Rect& rect, ButtonKind kind, bool down) {
+void Interface::drawButtonBox(Surface *ds, const Rect& rect, ButtonKind kind, bool down) {
byte cornerColor;
byte frameColor;
byte fillColor;
@@ -1705,13 +1705,13 @@ void Interface::drawPanelButtonText(Surface *ds, InterfacePanel *panel, PanelBut
switch(panelButton->id) {
case kTextReadingSpeed:
textId = kTextFast;
- break;
+ break;
case kTextMusic:
textId = kTextOn;
- break;
+ break;
case kTextSound:
textId = kTextOn;
- break;
+ break;
}
text = _vm->getTextString(textId);
@@ -1730,7 +1730,7 @@ void Interface::drawPanelButtonText(Surface *ds, InterfacePanel *panel, PanelBut
panel->calcPanelButtonRect(panelButton, rect);
drawButtonBox(ds, rect, kButton, panelButton->state > 0);
- _vm->_font->textDraw(kMediumFont, ds, text, point,
+ _vm->_font->textDraw(kMediumFont, ds, text, point,
textColor, _vm->getDisplayInfo().verbTextShadowColor, kFontShadow);
}
@@ -1747,7 +1747,7 @@ void Interface::drawPanelButtonArrow(Surface *ds, InterfacePanel *panel, PanelBu
} else {
spriteNumber = panelButton->upSpriteNumber;
}
-
+
point.x = panel->x + panelButton->xOffset;
point.y = panel->y + panelButton->yOffset;
@@ -1759,14 +1759,14 @@ void Interface::drawVerbPanelText(Surface *ds, PanelButton *panelButton, int tex
int textWidth;
Point point;
int textId;
-
+
textId = verbTypeToTextStringsIdLUT[panelButton->id];
-
+
if (textId == -1)
error("textId == -1");
text = _vm->getTextString(textId);
-
+
textWidth = _vm->_font->getStringWidth(kSmallFont, text, 0, kFontNormal);
point.x = _mainPanel.x + panelButton->xOffset + 1 + (panelButton->width - 1 - textWidth) / 2;
@@ -1774,7 +1774,7 @@ void Interface::drawVerbPanelText(Surface *ds, PanelButton *panelButton, int tex
_vm->_font->textDraw(kSmallFont, ds, text, point, textColor, textShadowColor, (textShadowColor != 0) ? kFontShadow : kFontNormal);
}
-
+
// Converse stuff
void Interface::converseInit(void) {
@@ -1820,7 +1820,7 @@ bool Interface::converseAddText(const char *text, int replyId, byte replyFlags,
if ((c == ' ' || c == '\0') && (_vm->_font->getStringWidth(kSmallFont, _converseWorkString, i, kFontNormal) <= CONVERSE_MAX_TEXT_WIDTH)) {
break;
- }
+ }
}
if (i < 0) {
return true;
@@ -1843,7 +1843,7 @@ bool Interface::converseAddText(const char *text, int replyId, byte replyFlags,
_converseTextCount++;
count++;
- if (len == i)
+ if (len == i)
break;
strncpy(_converseWorkString, &_converseWorkString[i + 1], len - i);
@@ -1855,7 +1855,7 @@ bool Interface::converseAddText(const char *text, int replyId, byte replyFlags,
}
void Interface::converseDisplayText() {
- int end;
+ int end;
_converseStartPos = 0;
@@ -1887,21 +1887,21 @@ void Interface::converseDisplayTextLines(Surface *ds) {
byte bulletBackgnd;
const char *str;
char bullet[2] = {
- (char)0xb7, 0
+ (char)0xb7, 0
};
Rect rect(8, CONVERSE_TEXT_LINES * CONVERSE_TEXT_HEIGHT);
Point textPoint;
-
+
assert(_conversePanel.buttonsCount >= 6);
bulletForegnd = kITEColorGreen;
bulletBackgnd = kITEColorBlack;
-
- rect.moveTo(_conversePanel.x + _conversePanel.buttons[0].xOffset,
+
+ rect.moveTo(_conversePanel.x + _conversePanel.buttons[0].xOffset,
_conversePanel.y + _conversePanel.buttons[0].yOffset);
ds->drawRect(rect, kITEColorDarkGrey); //fill bullet place
-
+
for (int i = 0; i < CONVERSE_TEXT_LINES; i++) {
relPos = _converseStartPos + i;
@@ -1975,7 +1975,7 @@ void Interface::handleConverseUpdate(const Point& mousePoint) {
bool changed;
PanelButton *last = _conversePanel.currentButton;
-
+
if (!_vm->mouseButtonPressed()) { // remove pressed flag
if (_converseUpButton) {
_converseUpButton->state = 0;
@@ -1985,7 +1985,7 @@ void Interface::handleConverseUpdate(const Point& mousePoint) {
_conversePanel.currentButton = converseHitTest(mousePoint);
changed = last != _conversePanel.currentButton;
-
+
if (_conversePanel.currentButton == NULL) {
_conversePos = -1;
@@ -1998,14 +1998,14 @@ void Interface::handleConverseUpdate(const Point& mousePoint) {
if (_conversePanel.currentButton->type == kPanelButtonConverseText) {
converseSetTextLines(_conversePanel.currentButton->id);
}
-
+
if (_conversePanel.currentButton->type == kPanelButtonArrow) {
if (_conversePanel.currentButton->state == 1) {
//TODO: insert timeout catchup
converseChangePos(_conversePanel.currentButton->id);
}
draw();
- }
+ }
}
@@ -2023,7 +2023,7 @@ void Interface::handleConverseClick(const Point& mousePoint) {
if (_conversePanel.currentButton->type == kPanelButtonArrow) {
_conversePanel.currentButton->state = 1;
converseChangePos(_conversePanel.currentButton->id);
- }
+ }
}
@@ -2041,7 +2041,7 @@ void Interface::loadState(Common::InSaveFile *in) {
for (int i = 0; i < _inventoryCount; i++) {
_inventory[i] = in->readUint16LE();
}
-
+
updateInventory(0);
}
@@ -2083,7 +2083,7 @@ void Interface::mapPanelShow() {
for (i = 0; i < PAL_ENTRIES; i++) {
cPal[i].red = *pal++;
cPal[i].green = *pal++;
- cPal[i].blue = *pal++;
+ cPal[i].blue = *pal++;
}
rect.setWidth(imageWidth);
diff --git a/saga/isomap.cpp b/saga/isomap.cpp
index 7852f0adc8..31369b99d1 100644
--- a/saga/isomap.cpp
+++ b/saga/isomap.cpp
@@ -113,7 +113,7 @@ void IsoMap::loadImages(const byte *resourcePointer, size_t resourceLength) {
_tileData = (byte*)malloc(resourceLength);
_tileDataLength = resourceLength;
memcpy(_tileData, resourcePointer, resourceLength);
-
+
MemoryReadStreamEndian readS(_tileData, _tileDataLength, _vm->isBigEndian());
readS.readUint16(); // skip
_tilesCount = readS.readUint16();
@@ -244,7 +244,7 @@ void IsoMap::loadMulti(const byte * resourcePointer, size_t resourceLength) {
multiTileEntryData->currentState = readS.readByte();
readS.readByte();//skip
}
-
+
offsetDiff = (readS.pos() - 2);
for (i = 0; i < _multiCount; i++) {
@@ -281,7 +281,7 @@ void IsoMap::adjustScroll(bool jump) {
Point playerPoint;
Point minScrollPos;
Point maxScrollPos;
-
+
tileCoordsToScreenPoint(_vm->_actor->_centerActor->location, playerPoint);
@@ -348,16 +348,16 @@ int16 IsoMap::findMulti(int16 tileIndex, int16 absU, int16 absV, int16 absH) {
rv = (tileIndex >> 11) & 0x03;
mu = absU - ru;
mv = absV - rv;
-
+
tileIndex = 0;
for (i = 0; i < _multiCount; i++) {
multiTileEntryData = &_multiTable[i];
- if ((multiTileEntryData->u == mu) &&
- (multiTileEntryData->v == mv) &&
+ if ((multiTileEntryData->u == mu) &&
+ (multiTileEntryData->v == mv) &&
(multiTileEntryData->h == absH)) {
state = multiTileEntryData->currentState;
-
+
offset = (ru + state * multiTileEntryData->uSize) * multiTileEntryData->vSize + rv;
offset *= sizeof(*_multiTableData);
offset += multiTileEntryData->offset;
@@ -373,12 +373,12 @@ int16 IsoMap::findMulti(int16 tileIndex, int16 absU, int16 absV, int16 absH) {
return tileIndex;
}
}
-
+
return 1;
}
void IsoMap::draw(Surface *ds) {
-
+
_tileClip = _vm->_scene->getSceneClip();
ds->drawRect(_tileClip, 0);
drawTiles(ds, NULL);
@@ -432,7 +432,7 @@ void IsoMap::drawTiles(Surface *ds, const Location *location) {
Point tileScroll;
Point metaTileY;
Point metaTileX;
- int16 u0, v0,
+ int16 u0, v0,
u1, v1,
u2, v2,
uc, vc;
@@ -452,7 +452,7 @@ void IsoMap::drawTiles(Surface *ds, const Location *location) {
u0 = ((view1.y + 64) * 2 + view1.x) >> 4;
v0 = ((view1.y + 64) * 2 - view1.x) >> 4;
-
+
metaTileY.x = (u0 - v0) * 128 - (view1.x * 16 + fineScroll.x);
metaTileY.y = (view1.y * 16 - fineScroll.y) - (u0 + v0) * 64;
@@ -467,15 +467,15 @@ void IsoMap::drawTiles(Surface *ds, const Location *location) {
uc = u2 & (SAGA_TILEMAP_W - 1);
vc = v2 & (SAGA_TILEMAP_W - 1);
- if (uc != u2 || vc != v2) {
+ if (uc != u2 || vc != v2) {
metaTileIndex = 0;
- switch ( _tileMap.edgeType) {
- case kEdgeTypeBlack:
+ switch ( _tileMap.edgeType) {
+ case kEdgeTypeBlack:
continue;
- case kEdgeTypeFill0:
+ case kEdgeTypeFill0:
break;
case kEdgeTypeFill1:
- metaTileIndex = 1;
+ metaTileIndex = 1;
break;
case kEdgeTypeRpt:
uc = clamp( 0, u2, SAGA_TILEMAP_W - 1);
@@ -513,13 +513,13 @@ void IsoMap::drawTiles(Surface *ds, const Location *location) {
if (uc != u2 || vc != v2) {
metaTileIndex = 0;
- switch ( _tileMap.edgeType) {
- case kEdgeTypeBlack:
+ switch ( _tileMap.edgeType) {
+ case kEdgeTypeBlack:
continue;
- case kEdgeTypeFill0:
+ case kEdgeTypeFill0:
break;
case kEdgeTypeFill1:
- metaTileIndex = 1;
+ metaTileIndex = 1;
break;
case kEdgeTypeRpt:
uc = clamp( 0, u2, SAGA_TILEMAP_W - 1);
@@ -572,7 +572,7 @@ void IsoMap::drawSpriteMetaTile(Surface *ds, uint16 metaTileIndex, const Point &
if (platformIndex >= 0) {
drawSpritePlatform( ds, platformIndex, platformPoint, location, absU, absV, high );
}
- }
+ }
}
void IsoMap::drawMetaTile(Surface *ds, uint16 metaTileIndex, const Point &point, int16 absU, int16 absV) {
@@ -599,7 +599,7 @@ void IsoMap::drawMetaTile(Surface *ds, uint16 metaTileIndex, const Point &point,
if (platformIndex >= 0) {
drawPlatform( ds, platformIndex, platformPoint, absU, absV, high );
}
- }
+ }
}
void IsoMap::drawSpritePlatform(Surface *ds, uint16 platformIndex, const Point &point, const Location &location, int16 absU, int16 absV, int16 absH) {
@@ -639,8 +639,8 @@ void IsoMap::drawSpritePlatform(Surface *ds, uint16 platformIndex, const Point &
s = s0;
for (u = SAGA_PLATFORM_W - 1,
- copyLocation.u() = location.u() - ((SAGA_PLATFORM_W - 1) << 4);
- u >= 0 && s.x + 32 > _tileClip.left && s.y - SAGA_MAX_TILE_H < _tileClip.bottom;
+ copyLocation.u() = location.u() - ((SAGA_PLATFORM_W - 1) << 4);
+ u >= 0 && s.x + 32 > _tileClip.left && s.y - SAGA_MAX_TILE_H < _tileClip.bottom;
u--, copyLocation.u() += 16, s.x -= 16, s.y += 8 ) {
if (s.x < _tileClip.right && s.y > _tileClip.top) {
@@ -673,7 +673,7 @@ void IsoMap::drawPlatform(Surface *ds, uint16 platformIndex, const Point &point,
if ((point.y <= _tileClip.top) || (point.y - SAGA_MAX_TILE_H - SAGA_PLATFORM_W * SAGA_TILE_NOMINAL_H >= _tileClip.bottom)) {
return;
}
-
+
s0 = point;
s0.y -= (((SAGA_PLATFORM_W - 1) + (SAGA_PLATFORM_W - 1)) * 8);
@@ -695,7 +695,7 @@ void IsoMap::drawPlatform(Surface *ds, uint16 platformIndex, const Point &point,
u >= 0 && s.x + 32 > _tileClip.left && s.y - SAGA_MAX_TILE_H < _tileClip.bottom;
u--, s.x -= 16, s.y += 8 ) {
if (s.x < _tileClip.right && s.y > _tileClip.top) {
-
+
tileIndex = tilePlatform->tiles[u][v];
if (tileIndex > 1) {
if (tileIndex & SAGA_MULTI_TILE) {
@@ -774,17 +774,17 @@ void IsoMap::drawTile(Surface *ds, uint16 tileIndex, const Point &point, const L
break;
case kMaskRuleUMIN:
if (location->u() < THRESH0) {
- return;
+ return;
}
break;
- case kMaskRuleUMID:
+ case kMaskRuleUMID:
if (location->u() < THRESH8) {
return;
}
break;
case kMaskRuleUMAX:
if (location->u() < THRESH16) {
- return;
+ return;
}
break;
case kMaskRuleVMIN:
@@ -794,12 +794,12 @@ void IsoMap::drawTile(Surface *ds, uint16 tileIndex, const Point &point, const L
break;
case kMaskRuleVMID:
if (location->v() < THRESH8) {
- return;
+ return;
}
break;
case kMaskRuleVMAX:
if (location->v() < THRESH16) {
- return;
+ return;
}
break;
case kMaskRuleYMIN:
@@ -860,7 +860,7 @@ void IsoMap::drawTile(Surface *ds, uint16 tileIndex, const Point &point, const L
col += bgRunCount;
fgRunCount = *readPointer++;
widthCount += fgRunCount;
-
+
count = 0;
while ((col < _tileClip.left) && (count < fgRunCount)) {
count++;
@@ -887,7 +887,7 @@ void IsoMap::drawTile(Surface *ds, uint16 tileIndex, const Point &point, const L
fgRunCount = *readPointer++;
widthCount += fgRunCount;
-
+
readPointer += fgRunCount;
}
}
@@ -897,11 +897,11 @@ void IsoMap::drawTile(Surface *ds, uint16 tileIndex, const Point &point, const L
bool IsoMap::checkDragonPoint(int16 u, int16 v, uint16 direction) {
DragonPathCell *pathCell;
-
+
if ((u < 1) || (u >= SAGA_DRAGON_SEARCH_DIAMETER - 1) || (v < 1) || (v >= SAGA_DRAGON_SEARCH_DIAMETER - 1)) {
return false;
}
-
+
pathCell = _dragonSearchArray.getPathCell(u, v);
if (pathCell->visited) {
@@ -916,11 +916,11 @@ bool IsoMap::checkDragonPoint(int16 u, int16 v, uint16 direction) {
void IsoMap::pushDragonPoint(int16 u, int16 v, uint16 direction) {
DragonTilePoint *tilePoint;
DragonPathCell *pathCell;
-
+
if ((u < 1) || (u >= SAGA_DRAGON_SEARCH_DIAMETER - 1) || (v < 1) || (v >= SAGA_DRAGON_SEARCH_DIAMETER - 1)) {
return;
}
-
+
pathCell = _dragonSearchArray.getPathCell(u, v);
if (pathCell->visited) {
@@ -947,14 +947,14 @@ void IsoMap::pushPoint(int16 u, int16 v, uint16 cost, uint16 direction) {
int16 mid;
TilePoint *tilePoint;
PathCell *pathCell;
-
+
upper = _queueCount;
lower = 0;
if ((u < 1) || (u >= SAGA_SEARCH_DIAMETER - 1) || (v < 1) || (v >= SAGA_SEARCH_DIAMETER - 1)) {
return;
}
-
+
pathCell = _searchArray.getPathCell(u, v);
if ((pathCell->visited) && (pathCell->cost <= cost)) {
@@ -1015,12 +1015,12 @@ int16 IsoMap::getTileIndex(int16 u, int16 v, int16 z) {
if ((uc != mtileU) || (vc != mtileV)) {
metaTileIndex = 0;
switch ( _tileMap.edgeType) {
- case kEdgeTypeBlack:
+ case kEdgeTypeBlack:
return 0;
- case kEdgeTypeFill0:
+ case kEdgeTypeFill0:
break;
case kEdgeTypeFill1:
- metaTileIndex = 1;
+ metaTileIndex = 1;
break;
case kEdgeTypeRpt:
uc = clamp( 0, mtileU, SAGA_TILEMAP_W - 1);
@@ -1099,7 +1099,7 @@ void IsoMap::testPossibleDirections(int16 u, int16 v, uint16 terraComp[8], int s
}
#define TEST_TILE_END }
-
+
TEST_TILE_PROLOG(0, 0)
if (skipCenter) {
if ((mask & 0x0660) && (fgdMask & SAGA_IMPASSABLE)) {
@@ -1109,7 +1109,7 @@ void IsoMap::testPossibleDirections(int16 u, int16 v, uint16 terraComp[8], int s
bgdMask = 0;
}
}
-
+
FILL_MASK(0, 0xcc00)
FILL_MASK(1, 0x6600)
FILL_MASK(2, 0x3300)
@@ -1203,7 +1203,7 @@ void IsoMap::placeOnTileMap(const Location &start, Location &result, int16 dista
u = (actor->location.u() >> 4) - uBase;
v = (actor->location.v() >> 4) - vBase;
if ((u >= 0) && (u < SAGA_SEARCH_DIAMETER) &&
- (v >= 0) && (v < SAGA_SEARCH_DIAMETER) &&
+ (v >= 0) && (v < SAGA_SEARCH_DIAMETER) &&
((u != SAGA_SEARCH_CENTER) || (v != SAGA_SEARCH_CENTER))) {
_searchArray.getPathCell(u, v)->visited = 1;
}
@@ -1212,7 +1212,7 @@ void IsoMap::placeOnTileMap(const Location &start, Location &result, int16 dista
_queueCount = 0;
pushPoint(SAGA_SEARCH_CENTER, SAGA_SEARCH_CENTER, 0, 0);
- while (_queueCount > 0) {
+ while (_queueCount > 0) {
_queueCount--;
tilePoint = *_searchArray.getQueue(_queueCount);
@@ -1366,7 +1366,7 @@ void IsoMap::findDragonTilePath(ActorData* actor,const Location &start, const Lo
for (u = 0; u < SAGA_DRAGON_SEARCH_CENTER; u++) {
for (v = 0; v < SAGA_DRAGON_SEARCH_CENTER; v++) {
-
+
pcell = _dragonSearchArray.getPathCell(u, v);
u1 = uBase + u;
@@ -1403,7 +1403,7 @@ void IsoMap::findDragonTilePath(ActorData* actor,const Location &start, const Lo
dist = ABS(tilePoint->u - uFinish) + ABS(tilePoint->v - vFinish);
-
+
if (dist < bestDistance) {
bestU = tilePoint->u;
@@ -1522,7 +1522,7 @@ void IsoMap::findTilePath(ActorData* actor, const Location &start, const Locatio
memset( &_searchArray, 0, sizeof(_searchArray));
- if (!(actor->actorFlags & kActorNoCollide) &&
+ if (!(actor->actorFlags & kActorNoCollide) &&
(_vm->_scene->currentSceneResourceId() != RID_ITE_OVERMAP_SCENE)) {
for (i = 0; i < _vm->_actor->_actorsCount; i++) {
other = _vm->_actor->_actors[i];
@@ -1532,7 +1532,7 @@ void IsoMap::findTilePath(ActorData* actor, const Location &start, const Locatio
u = (other->location.u() >> 4) - uBase;
v = (other->location.v() >> 4) - vBase;
if ((u >= 1) && (u < SAGA_SEARCH_DIAMETER) &&
- (v >= 1) && (v < SAGA_SEARCH_DIAMETER) &&
+ (v >= 1) && (v < SAGA_SEARCH_DIAMETER) &&
((u != SAGA_SEARCH_CENTER) || (v != SAGA_SEARCH_CENTER))) {
_searchArray.getPathCell(u, v)->visited = 1;
}
@@ -1543,7 +1543,7 @@ void IsoMap::findTilePath(ActorData* actor, const Location &start, const Locatio
pushPoint(SAGA_SEARCH_CENTER, SAGA_SEARCH_CENTER, 0, 0);
- while (_queueCount > 0) {
+ while (_queueCount > 0) {
_queueCount--;
tilePoint = *_searchArray.getQueue(_queueCount);
@@ -1562,7 +1562,7 @@ void IsoMap::findTilePath(ActorData* actor, const Location &start, const Locatio
}
}
- testPossibleDirections(uBase + tilePoint.u, vBase + tilePoint.v, terraComp,
+ testPossibleDirections(uBase + tilePoint.u, vBase + tilePoint.v, terraComp,
(tilePoint.u == SAGA_SEARCH_CENTER && tilePoint.v == SAGA_SEARCH_CENTER));
for (dir = 0; dir < 8; dir++) {
@@ -1620,7 +1620,7 @@ void IsoMap::setTileDoorState(int doorNumber, int doorState) {
if ((doorNumber < 0) || (doorNumber >= _multiCount)) {
error("setTileDoorState: doorNumber >= _multiCount");
}
-
+
multiTileEntryData = &_multiTable[doorNumber];
multiTileEntryData->currentState = doorState;
}
diff --git a/saga/ite_introproc.cpp b/saga/ite_introproc.cpp
index a42a715233..4ea8c783de 100644
--- a/saga/ite_introproc.cpp
+++ b/saga/ite_introproc.cpp
@@ -581,7 +581,7 @@ int Scene::ITEIntroCave3Proc(int param) {
};
int n_dialogues = ARRAYSIZE(dialogue[lang]);
-
+
switch (param) {
case SCENE_BEGIN:
// Start 'dissolve' transition to new scene background
@@ -674,7 +674,7 @@ int Scene::ITEIntroCave4Proc(int param) {
};
int n_dialogues = ARRAYSIZE(dialogue[lang]);
-
+
switch (param) {
case SCENE_BEGIN:
// Start 'dissolve' transition to new scene background
@@ -741,7 +741,7 @@ int Scene::ITEIntroValleyProc(int param) {
switch (param) {
case SCENE_BEGIN:
- // Begin title screen background animation
+ // Begin title screen background animation
_vm->_anim->setCycles(0, -1);
event.type = ONESHOT_EVENT;
@@ -761,7 +761,7 @@ int Scene::ITEIntroValleyProc(int param) {
event.param2 = MUSIC_NORMAL;
event.op = EVENT_PLAY;
event.time = 0;
-
+
q_event = _vm->_events->chain(q_event, &event);
// Pause animation before logo
@@ -875,7 +875,7 @@ int Scene::ITEIntroTreeHouseProc(int param) {
q_event = _vm->_events->queue(&event);
- // Begin title screen background animation
+ // Begin title screen background animation
_vm->_anim->setFrameTime(0, 100);
event.type = ONESHOT_EVENT;
@@ -953,7 +953,7 @@ int Scene::ITEIntroFairePathProc(int param) {
q_event = _vm->_events->queue(&event);
- // Begin title screen background animation
+ // Begin title screen background animation
_vm->_anim->setCycles(0, -1);
event.type = ONESHOT_EVENT;
diff --git a/saga/itedata.cpp b/saga/itedata.cpp
index 0d56173ce6..73515483dc 100644
--- a/saga/itedata.cpp
+++ b/saga/itedata.cpp
@@ -28,11 +28,11 @@
namespace Saga {
ActorTableData ITE_ActorTable[ITE_ACTORCOUNT] = {
- // Original used so called permanent actors for first three and that was designed by
- // EXTENDED object flag. They contained frames in more than one resource. We use
+ // Original used so called permanent actors for first three and that was designed by
+ // EXTENDED object flag. They contained frames in more than one resource. We use
// different technique here see "Apppending to sprite list" in loadActorResources()
-// flags name scene x y z spr frm scp col
+// flags name scene x y z spr frm scp col
// ------------ ---- ---- ---- ----- ---- ---- ---- --- ---- -- -- --
{ kProtagonist | kExtended,
0, 1, 0, 0, 0, 37, 135, 0, 1, 0, 0, 0}, // map party
diff --git a/saga/music.cpp b/saga/music.cpp
index 7f58027592..4e8e3fd633 100644
--- a/saga/music.cpp
+++ b/saga/music.cpp
@@ -71,10 +71,10 @@ public:
RAWInputStream::RAWInputStream(SagaEngine *vm, ResourceContext *context, uint32 resourceId, bool looping)
: _context(context), _finished(false), _looping(looping), _bufferEnd(_buf + BUFFER_SIZE) {
-
+
ResourceData * resourceData;
- resourceData = vm->_resource->getResourceData(context, resourceId);
+ resourceData = vm->_resource->getResourceData(context, resourceId);
_file = context->getFile(resourceData);
_musicInfo = vm->getMusicInfo();
@@ -112,7 +112,7 @@ void RAWInputStream::refill() {
uint32 lengthLeft;
byte *ptr = (byte *) _buf;
-
+
_file->seek(_filePos, SEEK_SET);
@@ -127,12 +127,12 @@ void RAWInputStream::refill() {
if (len & 1)
len--;
- if (_context->isBigEndian) {
+ if (_context->isBigEndian) {
uint16 *ptr16 = (uint16 *)ptr;
for (uint32 i = 0; i < (len / 2); i++)
ptr16[i] = TO_BE_16(ptr16[i]);
}
-
+
lengthLeft -= len;
ptr += len;
@@ -309,7 +309,7 @@ Music::~Music() {
void Music::musicVolumeGaugeCallback(void *refCon) {
((Music *)refCon)->musicVolumeGauge();
-}
+}
void Music::musicVolumeGauge() {
int volume;
@@ -411,7 +411,7 @@ void Music::play(uint32 resourceId, MusicFlags flags) {
// I've listened to music from both the FM and the GM
// file, and I've tentatively reached the conclusion
// that they are both General MIDI. My guess is that
- // the FM file has been reorchestrated to sound better
+ // the FM file has been reorchestrated to sound better
// on Adlib and other FM synths.
//
// Sev says the Adlib music does not sound like in the
@@ -440,8 +440,8 @@ void Music::play(uint32 resourceId, MusicFlags flags) {
_player->setGM(true);
- _vm->_resource->loadResource(context, resourceId, resourceData, resourceSize);
-
+ _vm->_resource->loadResource(context, resourceId, resourceData, resourceSize);
+
if (resourceSize < 4) {
error("Music::play() wrong music resource size");
}
@@ -450,7 +450,7 @@ void Music::play(uint32 resourceId, MusicFlags flags) {
parser = xmidiParser;
} else {
if (smfParser->loadMusic(resourceData, resourceSize)) {
- parser = smfParser;
+ parser = smfParser;
} else {
error("Music::play() wrong music resource");
}
diff --git a/saga/objectmap.cpp b/saga/objectmap.cpp
index 1d79f078ea..849dfa4f0f 100644
--- a/saga/objectmap.cpp
+++ b/saga/objectmap.cpp
@@ -21,7 +21,7 @@
*
*/
-// Object map / Object click-area module
+// Object map / Object click-area module
// Polygon Hit Test code ( HitTestPoly() ) adapted from code (C) Eric Haines
// appearing in Graphics Gems IV, "Point in Polygon Strategies."
@@ -61,7 +61,7 @@ HitZone::HitZone(MemoryReadStreamEndian *readStream, int index): _index(index) {
for (i = 0; i < _clickAreasCount; i++) {
clickArea = &_clickAreas[i];
clickArea->pointsCount = readStream->readUint16LE();
-
+
assert(clickArea->pointsCount);
clickArea->points = (Point *)malloc(clickArea->pointsCount * sizeof(*(clickArea->points)));
@@ -113,7 +113,7 @@ bool HitZone::hitTest(const Point &testPoint) {
if (pointsCount == 2) {
// Hit-test a box region
- if ((testPoint.x >= points[0].x) &&
+ if ((testPoint.x >= points[0].x) &&
(testPoint.x <= points[1].x) &&
(testPoint.y >= points[0].y) &&
(testPoint.y <= points[1].y)) {
@@ -124,7 +124,7 @@ bool HitZone::hitTest(const Point &testPoint) {
// Hit-test a polygon
if (hitTestPoly(points, pointsCount, testPoint)) {
return true;
- }
+ }
}
}
}
@@ -147,7 +147,7 @@ void HitZone::draw(SagaEngine *vm, Surface *ds, int color) {
location.v() = clickArea->points[j].y;
location.z = 0;
vm->_isoMap->tileCoordsToScreenPoint(location, points[j]);
- }
+ }
} else {
points = clickArea->points;
}
@@ -169,7 +169,7 @@ void HitZone::draw(SagaEngine *vm, Surface *ds, int color) {
}
-// Loads an object map resource ( objects ( clickareas ( points ) ) )
+// Loads an object map resource ( objects ( clickareas ( points ) ) )
void ObjectMap::load(const byte *resourcePointer, size_t resourceLength) {
int i;
@@ -234,11 +234,11 @@ void ObjectMap::draw(Surface *ds, const Point& testPoint, int color, int color2)
hitZoneIndex = hitTest(pickPoint);
- for (i = 0; i < _hitZoneListCount; i++) {
+ for (i = 0; i < _hitZoneListCount; i++) {
_hitZoneList[i]->draw(_vm, ds, (hitZoneIndex == i) ? color2 : color);
}
- if (hitZoneIndex != -1) {
+ if (hitZoneIndex != -1) {
snprintf(txtBuf, sizeof(txtBuf), "hitZone %d", hitZoneIndex);
textPoint.x = 2;
textPoint.y = 2;
diff --git a/saga/puzzle.cpp b/saga/puzzle.cpp
index 3fda0eccc2..a8fdc5cfaa 100644
--- a/saga/puzzle.cpp
+++ b/saga/puzzle.cpp
@@ -202,7 +202,7 @@ Puzzle::Puzzle(SagaEngine *vm) : _vm(vm), _solved(false), _active(false) {
Point(0, 0), Point(0, 31), Point(31, 31), Point(31, 0), Point(0, 0), Point(0, 0));
}
-void Puzzle::initPieceInfo(int i, int16 curX, int16 curY, byte offX, byte offY, int16 trgX,
+void Puzzle::initPieceInfo(int i, int16 curX, int16 curY, byte offX, byte offY, int16 trgX,
int16 trgY, uint8 flag, uint8 count, Point point0, Point point1,
Point point2, Point point3, Point point4, Point point5) {
_pieceInfo[i].curX = curX;
@@ -280,7 +280,7 @@ void Puzzle::drawCurrentPiece() {
ActorData *puzzle = _vm->_actor->getActor(_vm->_actor->actorIndexToId(ITE_ACTOR_PUZZLE));
Surface *backBuffer = _vm->_gfx->getBackBuffer();
- _vm->_sprite->draw(backBuffer, _vm->_scene->getSceneClip(), puzzle->spriteList, _puzzlePiece,
+ _vm->_sprite->draw(backBuffer, _vm->_scene->getSceneClip(), puzzle->spriteList, _puzzlePiece,
Point(_pieceInfo[_puzzlePiece].curX, _pieceInfo[_puzzlePiece].curY), 256);
}
@@ -318,7 +318,7 @@ void Puzzle::handleClick(Point mousePt) {
if (!_active)
return; // we won
-
+
drawCurrentPiece();
_puzzlePiece = -1;
diff --git a/saga/render.cpp b/saga/render.cpp
index 45f364155a..f23ae46ceb 100644
--- a/saga/render.cpp
+++ b/saga/render.cpp
@@ -111,7 +111,7 @@ void Render::drawScene() {
if (_flags & RF_MAP)
_vm->_interface->mapPanelDrawCrossHair();
- if ((_vm->_interface->getMode() == kPanelOption) ||
+ if ((_vm->_interface->getMode() == kPanelOption) ||
(_vm->_interface->getMode() == kPanelQuit) ||
(_vm->_interface->getMode() == kPanelLoad) ||
(_vm->_interface->getMode() == kPanelSave)) {
@@ -137,7 +137,7 @@ void Render::drawScene() {
// Display rendering information
if (_flags & RF_SHOW_FPS) {
sprintf(txtBuffer, "%d", _fps);
- textPoint.x = backBufferSurface->w - _vm->_font->getStringWidth(kSmallFont, txtBuffer, 0, kFontOutline);
+ textPoint.x = backBufferSurface->w - _vm->_font->getStringWidth(kSmallFont, txtBuffer, 0, kFontOutline);
textPoint.y = 2;
_vm->_font->textDraw(kSmallFont, backBufferSurface, txtBuffer, textPoint, kITEColorBrightWhite, kITEColorBlack, kFontOutline);
@@ -145,7 +145,7 @@ void Render::drawScene() {
// Display "paused game" message, if applicable
if (_flags & RF_RENDERPAUSE) {
- textPoint.x = (backBufferSurface->w - _vm->_font->getStringWidth(kBigFont, pauseString, 0, kFontOutline)) / 2;
+ textPoint.x = (backBufferSurface->w - _vm->_font->getStringWidth(kBigFont, pauseString, 0, kFontOutline)) / 2;
textPoint.y = 90;
_vm->_font->textDraw(kBigFont, backBufferSurface, pauseString, textPoint, kITEColorBrightWhite, kITEColorBlack, kFontOutline);
@@ -166,7 +166,7 @@ void Render::drawScene() {
backBufferSurface->drawPalette();
}
- _system->copyRectToScreen((byte *)backBufferSurface->pixels, backBufferSurface->w, 0, 0,
+ _system->copyRectToScreen((byte *)backBufferSurface->pixels, backBufferSurface->w, 0, 0,
backBufferSurface->w, backBufferSurface->h);
_system->updateScreen();
diff --git a/saga/rscfile.cpp b/saga/rscfile.cpp
index 12fce1fb64..c93bbcd980 100644
--- a/saga/rscfile.cpp
+++ b/saga/rscfile.cpp
@@ -42,7 +42,7 @@ bool Resource::loadContext(ResourceContext *context) {
size_t i;
int j;
bool result;
- byte tableInfo[RSC_TABLEINFO_SIZE];
+ byte tableInfo[RSC_TABLEINFO_SIZE];
uint32 resourceTableOffset;
GamePatchDescription *patchDescription;
ResourceData *resourceData;
@@ -52,9 +52,9 @@ bool Resource::loadContext(ResourceContext *context) {
if (!context->file->open(context->fileName)) {
return false;
}
-
+
context->isBigEndian = _vm->isBigEndian();
-
+
if (context->file->size() < RSC_MIN_FILESIZE) {
return false;
}
@@ -102,7 +102,7 @@ bool Resource::loadContext(ResourceContext *context) {
}
free(tableBuffer);
-
+
//process patch files
if (result) {
for (j = 0; j < _vm->getGameDescription()->patchsCount; j++) {
@@ -151,7 +151,7 @@ bool Resource::createContexts() {
break;
}
}
-
+
if (!loadContext(context)) {
return false;
}
@@ -181,7 +181,7 @@ void Resource::clearContexts() {
}
uint32 Resource::convertResourceId(uint32 resourceId) {
-
+
if ((_vm->getGameType() == GType_ITE) && (_vm->getFeatures() & GF_MAC_RESOURCES)) {
if (resourceId > 1537) {
return resourceId - 2;
@@ -201,9 +201,9 @@ void Resource::loadResource(ResourceContext *context, uint32 resourceId, byte*&r
ResourceData *resourceData;
debug(8, "loadResource %d", resourceId);
-
+
resourceData = getResourceData(context, resourceId);
-
+
file = context->getFile(resourceData);
resourceOffset = resourceData->offset;
diff --git a/saga/saga.cpp b/saga/saga.cpp
index b7de2492d4..e79f9c18b3 100644
--- a/saga/saga.cpp
+++ b/saga/saga.cpp
@@ -269,7 +269,7 @@ int SagaEngine::init(GameDetector &detector) {
debug(1, "Music disabled.");
}
-
+
_render = new Render(this, _system);
if (!_render->initialized()) {
return FAILURE;
@@ -294,7 +294,7 @@ int SagaEngine::go() {
_previousTicks = _system->getMillis();
- if (ConfMan.hasKey("start_scene")) {
+ if (ConfMan.hasKey("start_scene")) {
_scene->changeScene(ConfMan.getInt("start_scene"), 0, kTransitionNoFade);
}
else
@@ -350,7 +350,7 @@ int SagaEngine::go() {
_render->drawScene();
_system->delayMillis(10);
}
-
+
return 0;
}
@@ -358,7 +358,7 @@ void SagaEngine::loadStrings(StringsTable &stringsTable, const byte *stringsPoin
uint16 stringsCount;
size_t offset;
int i;
-
+
if (stringsLength == 0) {
error("SagaEngine::loadStrings() Error loading strings list resource");
}
@@ -366,13 +366,13 @@ void SagaEngine::loadStrings(StringsTable &stringsTable, const byte *stringsPoin
stringsTable.stringsPointer = (byte*)malloc(stringsLength);
memcpy(stringsTable.stringsPointer, stringsPointer, stringsLength);
-
+
MemoryReadStreamEndian scriptS(stringsTable.stringsPointer, stringsLength, isBigEndian()); //TODO: get endianess from context
offset = scriptS.readUint16();
stringsCount = offset / 2;
stringsTable.strings = (const char **)malloc(stringsCount * sizeof(*stringsTable.strings));
- i = 0;
+ i = 0;
scriptS.seek(0);
while (i < stringsCount) {
offset = scriptS.readUint16();
@@ -400,8 +400,8 @@ const char *SagaEngine::getObjectName(uint16 objectId) {
obj = _actor->getObj(objectId);
return _script->_mainStrings.getString(obj->nameIndex);
break;
- case kGameObjectActor:
- actor = _actor->getActor(objectId);
+ case kGameObjectActor:
+ actor = _actor->getActor(objectId);
return _actor->_actorsStrings.getString(actor->nameIndex);
break;
case kGameObjectHitZone:
@@ -430,20 +430,20 @@ void SagaEngine::getExcuseInfo(int verb, const char *&textString, int &soundReso
textString = "I can't pick that up.";
soundResourceId = RID_BOAR_VOICE_007;
break;
- case kVerbLookAt:
- textString = "I see nothing special about it.";
+ case kVerbLookAt:
+ textString = "I see nothing special about it.";
soundResourceId = RID_BOAR_VOICE_006;
break;
- case kVerbOpen:
+ case kVerbOpen:
textString = "There's no place to open it.";
soundResourceId = RID_BOAR_VOICE_000;
break;
- case kVerbClose:
- textString = "There's no opening to close.";
+ case kVerbClose:
+ textString = "There's no opening to close.";
soundResourceId = RID_BOAR_VOICE_002;
break;
- case kVerbUse:
- textString = "I don't know how to do that.";
+ case kVerbUse:
+ textString = "I don't know how to do that.";
soundResourceId = RID_BOAR_VOICE_005;
break;
}
diff --git a/saga/saveload.cpp b/saga/saveload.cpp
index 73a7836e50..669a0ae377 100644
--- a/saga/saveload.cpp
+++ b/saga/saveload.cpp
@@ -46,7 +46,7 @@ static SaveFileData emptySlot = {
"[New Save Game]", 0
};
-//TODO:
+//TODO:
// - delete savegame
char* SagaEngine::calcSaveFileName(uint slotNumber) {
@@ -63,7 +63,7 @@ SaveFileData *SagaEngine::getSaveFile(uint idx) {
return &_saveFiles[_saveFilesCount - idx - 1];
} else {
return (idx == 0) ? &emptySlot : &_saveFiles[_saveFilesCount - idx];
- }
+ }
}
bool SagaEngine::locateSaveFile(char *saveName, uint &titleNumber) {
@@ -109,7 +109,7 @@ void SagaEngine::fillSaveList() {
int i;
Common::InSaveFile *in;
char *name;
-
+
name = calcSaveFileName(MAX_SAVES);
name[strlen(name) - 2] = 0;
_saveFileMan->listSavefiles(name, _saveMarks, MAX_SAVES);
@@ -121,10 +121,10 @@ void SagaEngine::fillSaveList() {
}
_saveFiles[i].name[0] = 0;
_saveFiles[i].slotNumber = (uint)-1;
- }
-
+ }
+
_saveFilesCount = 0;
-
+
i = 0;
while (i < MAX_SAVES) {
if (_saveMarks[i]) {
@@ -177,7 +177,7 @@ void SagaEngine::save(const char *fileName, const char *saveName) {
_interface->saveState(out);
_actor->saveState(out);
-
+
out->writeSint16LE(_script->_commonBufferSize);
out->write(_script->_commonBuffer, _script->_commonBufferSize);
@@ -203,7 +203,7 @@ void SagaEngine::load(const char *fileName) {
if (_saveHeader.type != MKID('SAGA')) {
error("SagaEngine::load wrong format");
}
-
+
// Surrounding scene
sceneNumber = in->readSint32LE();
@@ -213,7 +213,7 @@ void SagaEngine::load(const char *fileName) {
_interface->loadState(in);
_actor->loadState(in);
-
+
commonBufferSize = in->readSint16LE();
in->read(_script->_commonBuffer, commonBufferSize);
diff --git a/saga/scene.cpp b/saga/scene.cpp
index 2b1dec3b90..ad73950792 100644
--- a/saga/scene.cpp
+++ b/saga/scene.cpp
@@ -49,7 +49,7 @@
namespace Saga {
static int initSceneDoors[SCENE_DOORS_MAX] = {
- 0, 0xff, 0, 0, 0, 0, 0, 0, 0, 0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
+ 0, 0xff, 0, 0, 0, 0, 0, 0, 0, 0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
};
static SAGAResourceTypes ITESceneResourceTypes[26] = {
@@ -152,7 +152,7 @@ Scene::Scene(SagaEngine *vm) : _vm(vm) {
debug(3, "First scene set to %d.", _firstScene);
- debug(3, "LUT has %d entries.", _sceneCount);
+ debug(3, "LUT has %d entries.", _sceneCount);
_sceneLoaded = false;
_sceneNumber = 0;
@@ -186,7 +186,7 @@ void Scene::drawTextList(Surface *ds) {
_vm->_font->textDrawRect(entry->fontId, ds, entry->text, entry->rect, entry->color, entry->effectColor, entry->flags);
} else {
_vm->_font->textDraw(entry->fontId, ds, entry->text, entry->point, entry->color, entry->effectColor, entry->flags);
- }
+ }
}
}
}
@@ -226,7 +226,7 @@ void Scene::startScene() {
// Load the head in scene queue
queueIterator = _sceneQueue.begin();
if (queueIterator == _sceneQueue.end()) {
- return;
+ return;
}
sceneQueue = queueIterator.operator->();
@@ -253,7 +253,7 @@ void Scene::nextScene() {
if (queueIterator == _sceneQueue.end()) {
return;
}
-
+
queueIterator = _sceneQueue.erase(queueIterator);
if (queueIterator == _sceneQueue.end()) {
@@ -313,7 +313,7 @@ static struct SceneSubstitutes {
const char *title;
const char *image;
} sceneSubstitutes[] = {
- {
+ {
7,
"Tycho says he knows much about the northern lands. Can Rif convince "
"the Dog to share this knowledge?",
@@ -365,7 +365,7 @@ void Scene::changeScene(uint16 sceneNumber, int actorsEntrance, SceneTransitionT
// This is used for latter demos where all places on world map except
// Tent Faire are substituted with LBM picture and short description
for (int i = 0; i < ARRAYSIZE(sceneSubstitutes); i++) {
-
+
if (sceneSubstitutes[i].sceneId == sceneNumber) {
Surface *backBuffer = _vm->_gfx->getBackBuffer();
Surface bbmBuffer;
@@ -388,15 +388,15 @@ void Scene::changeScene(uint16 sceneNumber, int actorsEntrance, SceneTransitionT
}
free(colors);
_vm->_gfx->setPalette(cPal);
-
+
_vm->_interface->setStatusText("Click or Press Return to continue. Press Q to quit.");
_vm->_font->textDrawRect(kMediumFont, backBuffer, sceneSubstitutes[i].title,
Common::Rect(0, 7, _vm->getDisplayWidth(), 27), 1, 15, kFontOutline);
_vm->_font->textDrawRect(kMediumFont, backBuffer, sceneSubstitutes[i].message,
Common::Rect(24, _vm->getSceneHeight() - 33, _vm->getDisplayWidth() - 11,
_vm->getSceneHeight()), 1, 15, kFontOutline);
+ return;
}
- return;
}
}
@@ -415,7 +415,7 @@ void Scene::changeScene(uint16 sceneNumber, int actorsEntrance, SceneTransitionT
}
void Scene::getSlopes(int &beginSlope, int &endSlope) {
- beginSlope = _vm->getSceneHeight() - _sceneDescription.beginSlope;
+ beginSlope = _vm->getSceneHeight() - _sceneDescription.beginSlope;
endSlope = _vm->getSceneHeight() - _sceneDescription.endSlope;
}
@@ -556,7 +556,7 @@ void Scene::loadScene(LoadSceneParams *loadSceneParams) {
_resourceListCount = loadSceneParams->sceneDescription->resourceListCount;
break;
}
-
+
debug(3, "Loading scene number %u:", _sceneNumber);
// Load scene descriptor and resource list resources
@@ -597,15 +597,15 @@ void Scene::loadScene(LoadSceneParams *loadSceneParams) {
}
_sceneLoaded = true;
-
+
q_event = NULL;
- //fix placard bug
+ //fix placard bug
//i guess we should remove RF_PLACARD flag - and use _interface->getMode()
event.type = ONESHOT_EVENT;
event.code = GRAPHICS_EVENT;
event.op = EVENT_CLEARFLAG;
- event.param = RF_PLACARD;
+ event.param = RF_PLACARD;
q_event = _vm->_events->chain(q_event, &event);
@@ -818,12 +818,12 @@ void Scene::loadSceneResourceList(uint32 resourceId) {
MemoryReadStreamEndian readS(resourceListData, resourceListDataLength, _sceneContext->isBigEndian);
- // Allocate memory for scene resource list
+ // Allocate memory for scene resource list
_resourceListCount = resourceListDataLength / SAGA_RESLIST_ENTRY_LEN;
debug(3, "Scene resource list contains %i entries", _resourceListCount);
_resourceList = (SceneResourceData *)calloc(_resourceListCount, sizeof(*_resourceList));
- // Load scene resource list from raw scene
+ // Load scene resource list from raw scene
// resource table
debug(3, "Loading scene resource list");
@@ -861,7 +861,7 @@ void Scene::processSceneResources() {
}
resourceData = _resourceList[i].buffer;
resourceDataLength = _resourceList[i].size;
-
+
if (_resourceList[i].resourceType >= typesCount) {
error("Scene::processSceneResources() wrong resource type %i", _resourceList[i].resourceType);
}
@@ -928,7 +928,7 @@ void Scene::processSceneResources() {
break;
case SAGA_OBJECT_MAP:
debug(3, "Loading object map resource...");
- _objectMap->load(resourceData, resourceDataLength);
+ _objectMap->load(resourceData, resourceDataLength);
break;
case SAGA_ACTION_MAP:
debug(3, "Loading action map resource...");
@@ -969,7 +969,7 @@ void Scene::processSceneResources() {
debug(3, "Loading isometric metatiles resource.");
_vm->_isoMap->loadMetaTiles(resourceData, resourceDataLength);
- break;
+ break;
case SAGA_ANIM:
{
uint16 animId = _resourceList[i].resourceType - 14;
@@ -991,7 +991,7 @@ void Scene::processSceneResources() {
debug(3, "Loading isometric multi resource.");
_vm->_isoMap->loadMulti(resourceData, resourceDataLength);
- break;
+ break;
case SAGA_PAL_ANIM:
debug(3, "Loading palette animation resource.");
_vm->_palanim->loadPalAnim(resourceData, resourceDataLength);
@@ -1094,7 +1094,7 @@ void Scene::endScene() {
_vm->_anim->reset();
_vm->_palanim->freePalAnim();
-
+
_objectMap->freeMem();
_actionMap->freeMem();
_entryList.freeMem();
@@ -1132,9 +1132,9 @@ void Scene::cmdObjectMapInfo() {
}
-void Scene::loadSceneEntryList(const byte* resourcePointer, size_t resourceLength) {
+void Scene::loadSceneEntryList(const byte* resourcePointer, size_t resourceLength) {
int i;
-
+
_entryList.entryListCount = resourceLength / 8;
MemoryReadStreamEndian readS(resourcePointer, resourceLength, _sceneContext->isBigEndian);
diff --git a/saga/script.cpp b/saga/script.cpp
index 0b724e418f..afc8ea6828 100644
--- a/saga/script.cpp
+++ b/saga/script.cpp
@@ -66,12 +66,12 @@ Script::Script(SagaEngine *vm) : _vm(vm) {
_leftButtonVerb = kVerbNone;
_rightButtonVerb = kVerbNone;
_pointerObject = ID_NOTHING;
-
+
_staticSize = 0;
_commonBufferSize = COMMON_BUFFER_SIZE;
_commonBuffer = (byte*)malloc(_commonBufferSize);
memset(_commonBuffer, 0, _commonBufferSize);
-
+
debug(8, "Initializing scripting subsystem");
// Load script resource file context
_scriptContext = _vm->_resource->getContext(GAME_SCRIPTFILE);
@@ -86,7 +86,7 @@ Script::Script(SagaEngine *vm) : _vm(vm) {
debug(3, "Loading module LUT from resource %i", _vm->getResourceDescription()->moduleLUTResourceId);
_vm->_resource->loadResource(resourceContext, _vm->getResourceDescription()->moduleLUTResourceId, resourcePointer, resourceLength);
-
+
// Create logical script LUT from resource
if (resourceLength % S_LUT_ENTRYLEN_ITECD == 0) {
@@ -101,7 +101,7 @@ Script::Script(SagaEngine *vm) : _vm(vm) {
_modulesCount = resourceLength / _modulesLUTEntryLen;
debug(3, "LUT has %i entries", _modulesCount);
-
+
// Allocate space for logical LUT
_modules = (ModuleData *)malloc(_modulesCount * sizeof(*_modules));
if (_modules == NULL) {
@@ -121,8 +121,8 @@ Script::Script(SagaEngine *vm) : _vm(vm) {
if (_modules[i].voicesResourceId > 0) {
_voiceLUTPresent = true;
}
-
-
+
+
// Skip the unused portion of the structure
for (j = scriptS.pos(); j < prevTell + _modulesLUTEntryLen; j++) {
if (scriptS.readByte() != 0)
@@ -156,12 +156,12 @@ Script::Script(SagaEngine *vm) : _vm(vm) {
Script::~Script() {
debug(8, "Shutting down scripting subsystem.");
-
+
_mainStrings.freeMem();
freeModules();
free(_modules);
-
+
free(_commonBuffer);
}
@@ -240,21 +240,21 @@ void Script::loadModuleBase(ModuleData &module, const byte *resourcePointer, siz
if (module.entryPointsCount > SCRIPT_MAX) {
error("Script::loadModuleBase()Script limit exceeded");
}
-
+
module.entryPoints = (EntryPoint *)malloc(module.entryPointsCount * sizeof(*module.entryPoints));
if (module.entryPoints == NULL) {
memoryError("Script::loadModuleBase");
}
// Read in the entrypoint table
-
- module.staticSize = scriptS.readUint16();
+
+ module.staticSize = scriptS.readUint16();
while (scriptS.pos() < module.entryPointsTableOffset)
scriptS.readByte();
for (i = 0; i < module.entryPointsCount; i++) {
// First uint16 is the offset of the entrypoint name from the start
- // of the bytecode resource, second uint16 is the offset of the
+ // of the bytecode resource, second uint16 is the offset of the
// bytecode itself for said entrypoint
module.entryPoints[i].nameOffset = scriptS.readUint16();
module.entryPoints[i].offset = scriptS.readUint16();
@@ -271,7 +271,7 @@ void Script::loadModuleVoiceLUT(ModuleData &module, const byte *resourcePointer,
module.voiceLUT.voicesCount = resourceLength / 2;
if (module.voiceLUT.voicesCount != module.strings.stringsCount) {
- error("Script::loadModuleVoiceLUT() Voice LUT entries do not match strings entries");
+ error("Script::loadModuleVoiceLUT() Voice LUT entries do not match strings entries");
}
module.voiceLUT.voices = (uint16 *)malloc(module.voiceLUT.voicesCount * sizeof(*module.voiceLUT.voices));
@@ -293,12 +293,11 @@ void Script::showVerb(int statusColor) {
const char *object2Name;
char statusString[STATUS_TEXT_LEN];
-
if (_leftButtonVerb == kVerbNone) {
_vm->_interface->setStatusText("");
return;
}
-
+
verbName = _mainStrings.getString(_leftButtonVerb - 1);
if (objectTypeId(_currentObject[0]) == kGameObjectNone) {
@@ -314,7 +313,7 @@ void Script::showVerb(int statusColor) {
return;
}
-
+
if (objectTypeId(_currentObject[1]) != kGameObjectNone) {
object2Name = _vm->getObjectName(_currentObject[1]);
} else {
@@ -426,7 +425,7 @@ void Script::doVerb() {
}
if (scriptEntrypointNumber > 0) {
-
+
event.type = ONESHOT_EVENT;
event.code = SCRIPT_EVENT;
event.op = EVENT_EXEC_NONBLOCKING;
@@ -442,8 +441,8 @@ void Script::doVerb() {
} else {
_vm->getExcuseInfo(_pendingVerb, excuseText, excuseSampleResourceId);
- if (excuseText)
- _vm->_actor->actorSpeech(ID_PROTAG, &excuseText, 1, excuseSampleResourceId, 0);
+ if (excuseText)
+ _vm->_actor->actorSpeech(ID_PROTAG, &excuseText, 1, excuseSampleResourceId, 0);
}
if ((_currentVerb == kVerbWalkTo) || (_currentVerb == kVerbLookAt)) {
@@ -515,7 +514,7 @@ void Script::hitObject(bool leftButton) {
else
showVerb();
}
-
+
}
void Script::playfieldClick(const Point& mousePoint, bool leftButton) {
@@ -558,13 +557,13 @@ void Script::playfieldClick(const Point& mousePoint, bool leftButton) {
hitZone = _vm->_scene->_objectMap->getHitZone(objectIdToIndex(_pendingObject[0]));
} else {
if ((_pendingVerb == kVerbUse) && (objectTypeId(_pendingObject[1]) == kGameObjectHitZone)) {
- hitZone = _vm->_scene->_objectMap->getHitZone(objectIdToIndex(_pendingObject[1]));
+ hitZone = _vm->_scene->_objectMap->getHitZone(objectIdToIndex(_pendingObject[1]));
}
}
if (hitZone != NULL) {
if (hitZone->getFlags() & kHitZoneNoWalk) {
- _vm->_actor->actorFaceTowardsPoint(ID_PROTAG, pickLocation);
+ _vm->_actor->actorFaceTowardsPoint(ID_PROTAG, pickLocation);
doVerb();
return;
}
@@ -573,7 +572,7 @@ void Script::playfieldClick(const Point& mousePoint, bool leftButton) {
if (!hitZone->getSpecialPoint(specialPoint)) {
error("Script::playfieldClick SpecialPoint not found");
}
-
+
// tiled stuff
if (_vm->_scene->getFlags() & kSceneFlagISO) {
pickLocation.u() = specialPoint.x;
@@ -658,7 +657,7 @@ void Script::whichObject(const Point& mousePoint) {
}
}
- if (newObjectId == ID_NOTHING) {
+ if (newObjectId == ID_NOTHING) {
pickPoint = mousePoint;
@@ -703,7 +702,7 @@ void Script::whichObject(const Point& mousePoint) {
if ((_leftButtonVerb == kVerbUse) && (hitZone->getRightButtonVerb() & 0x80)) {
objectFlags = kObjUseWith;
- }
+ }
}
}
} else {
@@ -712,7 +711,7 @@ void Script::whichObject(const Point& mousePoint) {
} else {
panelButton = _vm->_interface->inventoryHitTest(mousePoint);
if (panelButton) {
- objectId = _vm->_interface->getInventoryContentByPanelButton(panelButton);
+ objectId = _vm->_interface->getInventoryContentByPanelButton(panelButton);
if (objectId != 0) {
obj = _vm->_actor->getObj(objectId);
newRightButtonVerb = kVerbLookAt;
diff --git a/saga/sfuncs.cpp b/saga/sfuncs.cpp
index d96daf63e7..a8d9eee34c 100644
--- a/saga/sfuncs.cpp
+++ b/saga/sfuncs.cpp
@@ -291,8 +291,8 @@ void Script::sfIsCarried(SCRIPTFUNC_PARAMS) {
} else {
thread->_returnValue = 0;
}
-
-
+
+
}
// Script function #4 (0x04) nonblocking
@@ -328,10 +328,10 @@ void Script::sfScriptWalkTo(SCRIPTFUNC_PARAMS) {
actorId = thread->pop();
actorLocation.x = thread->pop();
actorLocation.y = thread->pop();
-
+
actor = _vm->_actor->getActor(actorId);
actorLocation.z = actor->location.z;
-
+
actor->flags &= ~kFollower;
if (_vm->_actor->actorWalkTo(actorId, actorLocation)) {
@@ -368,16 +368,16 @@ void Script::sfScriptDoAction(SCRIPTFUNC_PARAMS) {
if (scriptEntryPointNumber <= 0) {
return;
}
- moduleNumber = 0;
+ moduleNumber = 0;
break;
- case kGameObjectActor:
- actor = _vm->_actor->getActor(objectId);
+ case kGameObjectActor:
+ actor = _vm->_actor->getActor(objectId);
scriptEntryPointNumber = actor->scriptEntrypointNumber;
if (scriptEntryPointNumber <= 0) {
return;
}
if (actor->flags & (kProtagonist | kFollower)) {
- moduleNumber = 0;
+ moduleNumber = 0;
} else {
moduleNumber = _vm->_scene->getScriptModuleNumber();
}
@@ -390,7 +390,7 @@ void Script::sfScriptDoAction(SCRIPTFUNC_PARAMS) {
hitZone = _vm->_scene->_actionMap->getHitZone(objectIdToIndex(objectId));
}
scriptEntryPointNumber = hitZone->getScriptNumber();
- moduleNumber = _vm->_scene->getScriptModuleNumber();
+ moduleNumber = _vm->_scene->getScriptModuleNumber();
break;
default:
error("Script::sfScriptDoAction wrong object type");
@@ -449,7 +449,7 @@ void Script::sfStopBgdAnim(SCRIPTFUNC_PARAMS) {
// Script function #11 (0x0B) nonblocking
// If the parameter is true, the user interface is disabled while script
-// continues to run. If the parameter is false, the user interface is
+// continues to run. If the parameter is false, the user interface is
// reenabled.
// Param1: boolean
void Script::sfLockUser(SCRIPTFUNC_PARAMS) {
@@ -474,7 +474,7 @@ void Script::sfPreDialog(SCRIPTFUNC_PARAMS) {
_vm->_interface->setMode(kPanelConverse);
else
_vm->_interface->converseDisplayText();
-
+
_vm->_interface->setMode(kPanelNull);
}
@@ -524,7 +524,7 @@ void Script::sfSetFollower(SCRIPTFUNC_PARAMS) {
targetObject = thread->pop();
debug(1, "sfSetFollower(%d, %d) [%d]", actorId, targetObject, _vm->_actor->actorIdToIndex(actorId));
-
+
actor = _vm->_actor->getActor(actorId);
actor->targetObject = targetObject;
if (targetObject != ID_NOTHING) {
@@ -624,7 +624,7 @@ void Script::sfGetNumber(SCRIPTFUNC_PARAMS) {
} else {
thread->_returnValue = atoi(_vm->_interface->_statusTextInputString);
}
-
+
_vm->_interface->_statusTextInputState = kStatusTextInputFirstRun;
}
}
@@ -682,7 +682,7 @@ void Script::sfDoCenterActor(SCRIPTFUNC_PARAMS) {
}
// Script function #26 (0x1A) nonblocking
-// Starts the specified animation
+// Starts the specified animation
void Script::sfStartBgdAnimSpeed(SCRIPTFUNC_PARAMS) {
int16 animId = thread->pop();
int16 cycles = thread->pop();
@@ -791,7 +791,7 @@ void Script::sfSceneEq(SCRIPTFUNC_PARAMS) {
if (_vm->_scene->getSceneResourceId(sceneNumber) == _vm->_scene->currentSceneResourceId())
thread->_returnValue = 1;
- else
+ else
thread->_returnValue = 0;
}
@@ -888,7 +888,7 @@ void Script::sfSimulSpeech(SCRIPTFUNC_PARAMS) {
for (i = 0; i < actorsCount; i++)
actorsIds[i] = thread->pop();
-
+
string = thread->_strings->getString(stringId);
if (thread->_voiceLUT->voices) {
@@ -1069,7 +1069,7 @@ void Script::sfScriptSpecialWalk(SCRIPTFUNC_PARAMS) {
_vm->_actor->actorWalkTo(actorId, actorLocation);
- actor->walkFrameSequence = walkFrameSequence;
+ actor->walkFrameSequence = walkFrameSequence;
}
// Script function #43 (0x2B) nonblocking
@@ -1095,7 +1095,7 @@ void Script::sfPlaceActor(SCRIPTFUNC_PARAMS) {
frameType = thread->pop();
frameOffset = thread->pop();
- debug(1, "sfPlaceActor(id = %d, x=%d, y=%d, dir=%d, frameType=%d, frameOffset=%d)", actorId, actorLocation.x,
+ debug(1, "sfPlaceActor(id = %d, x=%d, y=%d, dir=%d, frameType=%d, frameOffset=%d)", actorId, actorLocation.x,
actorLocation.y, actorDirection, frameType, frameOffset);
if (_vm->getGameType() == GType_IHNM) {
@@ -1110,7 +1110,7 @@ void Script::sfPlaceActor(SCRIPTFUNC_PARAMS) {
if (frameType >= 0) {
frameRange = _vm->_actor->getActorFrameRange(actorId, frameType);
-
+
if (frameRange->frameCount <= frameOffset) {
error("Wrong frameOffset 0x%X", frameOffset);
}
@@ -1126,8 +1126,8 @@ void Script::sfPlaceActor(SCRIPTFUNC_PARAMS) {
}
// Script function #44 (0x2C) nonblocking
-// Checks to see if the user has interrupted a currently playing
-// game cinematic. Pushes a zero or positive value if the game
+// Checks to see if the user has interrupted a currently playing
+// game cinematic. Pushes a zero or positive value if the game
// has not been interrupted.
void Script::sfCheckUserInterrupt(SCRIPTFUNC_PARAMS) {
thread->_returnValue = (_skipSpeeches == true);
@@ -1167,7 +1167,7 @@ void Script::sfScriptWalkRelative(SCRIPTFUNC_PARAMS) {
actor->actorFlags |= kActorBackwards;
}
- actor->actorFlags = (actor->actorFlags & ~kActorFacingMask) | (walkFlags & kActorFacingMask);
+ actor->actorFlags = (actor->actorFlags & ~kActorFacingMask) | (walkFlags & kActorFacingMask);
}
// Script function #46 (0x2E)
@@ -1218,7 +1218,7 @@ void Script::sfSimulSpeech2(SCRIPTFUNC_PARAMS) {
for (i = 0; i < actorsCount; i++)
actorsIds[i] = thread->pop();
-
+
string = thread->_strings->getString(stringId);
if (thread->_voiceLUT->voices) {
@@ -1449,7 +1449,7 @@ void Script::sfThrowActor(SCRIPTFUNC_PARAMS) {
actorId = thread->pop();
location.x = thread->pop();
location.y = thread->pop();
- thread->pop();
+ thread->pop();
actionCycle = thread->pop();
flags = thread->pop();
@@ -1595,7 +1595,7 @@ void Script::sfScriptText(SCRIPTFUNC_PARAMS) {
text = thread->_strings->getString(stringId);
width = _vm->_font->getStringWidth(kMediumFont, text, 0, kFontOutline);
rect.top = point.y - 6;
- rect.setHeight(12);
+ rect.setHeight(12);
rect.left = point.x - width / 2;
rect.setWidth(width);
@@ -1612,7 +1612,7 @@ void Script::sfGetActorX(SCRIPTFUNC_PARAMS) {
actorId = thread->pop();
actor = _vm->_actor->getActor(actorId);
- thread->_returnValue = actor->location.x >> 2;
+ thread->_returnValue = actor->location.x >> 2;
}
// Script function #61 (0x3D)
@@ -1624,7 +1624,7 @@ void Script::sfGetActorY(SCRIPTFUNC_PARAMS) {
actorId = thread->pop();
actor = _vm->_actor->getActor(actorId);
- thread->_returnValue = actor->location.y >> 2;
+ thread->_returnValue = actor->location.y >> 2;
}
// Script function #62 (0x3E)
@@ -1867,7 +1867,7 @@ void Script::sfProtectResult(SCRIPTFUNC_PARAMS) {
//cheating
protectHash = thread->pop();
thread->push(protectHash);
- thread->_returnValue = protectHash;
+ thread->_returnValue = protectHash;
}
// Script function #75 (0x4b)
@@ -1986,7 +1986,7 @@ void Script::sfVsetTrack(SCRIPTFUNC_PARAMS) {
void Script::sfDebugShowData(SCRIPTFUNC_PARAMS) {
int16 param = thread->pop();
char buf[50];
-
+
snprintf(buf, 50, "Reached breakpoint %d", param);
_vm->_interface->setStatusText(buf);
diff --git a/saga/sndres.cpp b/saga/sndres.cpp
index cb10f57627..1cb7815571 100644
--- a/saga/sndres.cpp
+++ b/saga/sndres.cpp
@@ -62,7 +62,7 @@ void SndRes::setVoiceBank(int serial)
error("SndRes::SndRes resource context not found");
}
-
+
}
void SndRes::playSound(uint32 resourceId, int volume, bool loop) {
@@ -119,14 +119,14 @@ bool SndRes::load(ResourceContext *context, uint32 resourceId, SoundBuffer &buff
if (context->table[resourceId].patchData != NULL) {
if (context->table[resourceId].patchData->_patchDescription->soundInfo != NULL) {
soundInfo = context->table[resourceId].patchData->_patchDescription->soundInfo;
- }
- }
+ }
+ }
MemoryReadStream readS(soundResource, soundResourceLength);
resourceType = soundInfo->resourceType;
buffer.isBigEndian = soundInfo->isBigEndian;
-
+
if (soundResourceLength >= 8) {
if (!memcmp(&soundResource, "Creative", 8)) {
resourceType = kSoundVOC;
@@ -217,7 +217,7 @@ int SndRes::getVoiceLength(uint32 resourceId) {
bool voiceFile = false;
double msDouble;
SoundBuffer buffer;
-
+
if (!load(_voiceContext, resourceId, buffer, true)) {
return -1;
}
diff --git a/saga/sound.cpp b/saga/sound.cpp
index 963305feed..a5bcc4a24f 100644
--- a/saga/sound.cpp
+++ b/saga/sound.cpp
@@ -30,7 +30,7 @@
namespace Saga {
-Sound::Sound(SagaEngine *vm, Audio::Mixer *mixer, int enabled) :
+Sound::Sound(SagaEngine *vm, Audio::Mixer *mixer, int enabled) :
_vm(vm), _mixer(mixer), _enabled(enabled), _voxStream(0) {
}
@@ -57,7 +57,7 @@ void Sound::playSoundBuffer(Audio::SoundHandle *handle, SoundBuffer &buffer, int
if (!buffer.isSigned)
flags |= Audio::Mixer::FLAG_UNSIGNED;
- _mixer->playRaw(handle, buffer.buffer, buffer.size, buffer.frequency, flags, -1, volume);
+ _mixer->playRaw(handle, buffer.buffer, buffer.size, buffer.frequency, flags, -1, volume);
}
void Sound::playSound(SoundBuffer &buffer, int volume, bool loop) {
diff --git a/saga/sprite.cpp b/saga/sprite.cpp
index 26843ae486..6a4b94c441 100644
--- a/saga/sprite.cpp
+++ b/saga/sprite.cpp
@@ -88,7 +88,7 @@ void Sprite::loadList(int resourceId, SpriteList &spriteList) {
spriteList.infoList = (SpriteInfo *)realloc(spriteList.infoList, newSpriteCount * sizeof(*spriteList.infoList));
if (spriteList.infoList == NULL) {
- memoryError("Sprite::loadList");
+ memoryError("Sprite::loadList");
}
spriteList.spriteCount = newSpriteCount;
@@ -181,7 +181,7 @@ void Sprite::drawClip(Surface *ds, const Rect &clipRect, const Point &spritePoin
jo = 0;
io = 0;
if (spritePointer.x < clipRect.left) {
- jo = clipRect.left - spritePointer.x;
+ jo = clipRect.left - spritePointer.x;
}
if (spritePointer.y < clipRect.top) {
io = clipRect.top - spritePointer.y;
@@ -214,7 +214,7 @@ void Sprite::draw(Surface *ds, const Rect &clipRect, SpriteList &spriteList, int
Point spritePointer;
getScaledSpriteBuffer(spriteList, spriteNumber, scale, width, height, xAlign, yAlign, spriteBuffer);
-
+
spritePointer.x = screenCoord.x + xAlign;
spritePointer.y = screenCoord.y + yAlign;
drawClip(ds, clipRect, spritePointer, width, height, spriteBuffer);
@@ -227,7 +227,7 @@ void Sprite::draw(Surface *ds, const Rect &clipRect, SpriteList &spriteList, int
int xAlign, spw;
int yAlign, sph;
Point spritePointer;
-
+
getScaledSpriteBuffer(spriteList, spriteNumber, scale, width, height, xAlign, yAlign, spriteBuffer);
spw = (screenRect.width() - width) / 2;
@@ -268,7 +268,7 @@ bool Sprite::hitTest(SpriteList &spriteList, int spriteNumber, const Point &scre
i = testPoint.y - spritePointer.y;
j = testPoint.x - spritePointer.x;
srcRowPointer = spriteBuffer + j + i * width;
- return *srcRowPointer != 0;
+ return *srcRowPointer != 0;
}
void Sprite::drawOccluded(Surface *ds, const Rect &clipRect, SpriteList &spriteList, int spriteNumber, const Point &screenCoord, int scale, int depth) {
@@ -306,7 +306,7 @@ void Sprite::drawOccluded(Surface *ds, const Rect &clipRect, SpriteList &spriteL
clipData.destPoint.x = screenCoord.x + xAlign;
clipData.destPoint.y = screenCoord.y + yAlign;
-
+
clipData.sourceRect.left = 0;
clipData.sourceRect.top = 0;
clipData.sourceRect.right = width;
@@ -320,7 +320,7 @@ void Sprite::drawOccluded(Surface *ds, const Rect &clipRect, SpriteList &spriteL
// Finally, draw the occluded sprite
sourceRowPointer = spriteBuffer + clipData.drawSource.x + (clipData.drawSource.y * width);
-
+
destRowPointer = (byte *)ds->pixels + clipData.drawDest.x + (clipData.drawDest.y * ds->pitch);
maskRowPointer = maskBuffer + clipData.drawDest.x + (clipData.drawDest.y * maskWidth);
@@ -355,7 +355,7 @@ void Sprite::decodeRLEBuffer(const byte *inputBuffer, size_t inLength, size_t ou
if (outLength > _decodeBufLen) { // TODO: may we should make dynamic growing?
error("Sprite::decodeRLEBuffer outLength > _decodeBufLen");
}
-
+
outPointer = _decodeBuf;
outPointerEnd = _decodeBuf + outLength;
outPointerEnd--;
@@ -401,7 +401,7 @@ void Sprite::scaleBuffer(const byte *src, int width, int height, int scale) {
for (int j = 0; j < width; j++) {
*dst++ = *src++;
-
+
hskip += skip;
if (hskip < skip) // overflow
dst--;
diff --git a/saga/sthread.cpp b/saga/sthread.cpp
index 285032987c..15af37012c 100644
--- a/saga/sthread.cpp
+++ b/saga/sthread.cpp
@@ -44,18 +44,18 @@ ScriptThread *Script::createThread(uint16 scriptModuleNumber, uint16 scriptEntry
if (_modules[scriptModuleNumber].entryPointsCount <= scriptEntryPointNumber) {
error("Script::createThread wrong scriptEntryPointNumber");
}
-
+
newThread = _threadList.pushFront().operator->();
newThread->_flags = kTFlagNone;
newThread->_stackSize = DEFAULT_THREAD_STACK_SIZE;
newThread->_stackBuf = (uint16 *)malloc(newThread->_stackSize * sizeof(*newThread->_stackBuf));
- newThread->_stackTopIndex = newThread->_stackSize - 2;
+ newThread->_stackTopIndex = newThread->_stackSize - 2;
newThread->_instructionOffset = _modules[scriptModuleNumber].entryPoints[scriptEntryPointNumber].offset;
newThread->_commonBase = _commonBuffer;
newThread->_staticBase = _commonBuffer + _modules[scriptModuleNumber].staticOffset;
newThread->_moduleBase = _modules[scriptModuleNumber].moduleBase;
newThread->_moduleBaseSize = _modules[scriptModuleNumber].moduleBaseSize;
-
+
newThread->_strings = &_modules[scriptModuleNumber].strings;
newThread->_voiceLUT = &_modules[scriptModuleNumber].voiceLUT;
@@ -77,7 +77,7 @@ void Script::wakeUpActorThread(int waitType, void *threadObj) {
void Script::wakeUpThreads(int waitType) {
ScriptThread *thread;
ScriptThreadList::iterator threadIterator;
-
+
for (threadIterator = _threadList.begin(); threadIterator != _threadList.end(); ++threadIterator) {
thread = threadIterator.operator->();
if ((thread->_flags & kTFlagWaiting) && (thread->_waitType == waitType)) {
@@ -116,13 +116,13 @@ void Script::executeThreads(uint msec) {
if (thread->_flags & (kTFlagFinished | kTFlagAborted)) {
if (thread->_flags & kTFlagFinished)
setPointerVerb();
-
+
threadIterator = _threadList.erase(threadIterator);
continue;
}
if (thread->_flags & kTFlagWaiting) {
-
+
if (thread->_waitType == kWaitTypeDelay) {
if (thread->_sleepTime < msec) {
thread->_sleepTime = 0;
@@ -131,13 +131,13 @@ void Script::executeThreads(uint msec) {
}
if (thread->_sleepTime == 0)
- thread->_flags &= ~kTFlagWaiting;
+ thread->_flags &= ~kTFlagWaiting;
} else {
if (thread->_waitType == kWaitTypeWalk) {
ActorData *actor;
actor = (ActorData *)thread->_threadObj;
if (actor->currentAction == kActionWait) {
- thread->_flags &= ~kTFlagWaiting;
+ thread->_flags &= ~kTFlagWaiting;
}
}
}
@@ -192,7 +192,7 @@ bool Script::runThread(ScriptThread *thread, uint instructionLimit) {
int operandChar;
int i;
-
+
MemoryReadStream scriptS(thread->_moduleBase, thread->_moduleBaseSize);
scriptS.seek(thread->_instructionOffset);
@@ -211,7 +211,7 @@ bool Script::runThread(ScriptThread *thread, uint instructionLimit) {
debug(8, operandName); \
_vm->_console->DebugPrintf("%s\n", operandName); \
}
-
+
// debug(8, "Executing thread offset: %lu (%x) stack: %d", thread->_instructionOffset, operandChar, thread->pushedSize());
operandName="";
switch (operandChar) {
@@ -241,7 +241,7 @@ bool Script::runThread(ScriptThread *thread, uint instructionLimit) {
debug(8, "0x%X", iparam1);
break;
-// DATA INSTRUCTIONS
+// DATA INSTRUCTIONS
CASEOP(opGetFlag)
addr = thread->baseAddress(scriptS.readByte());
iparam1 = scriptS.readSint16LE();
@@ -291,7 +291,7 @@ bool Script::runThread(ScriptThread *thread, uint instructionLimit) {
*(uint16*)addr = thread->pop();
break;
-// FUNCTION CALL INSTRUCTIONS
+// FUNCTION CALL INSTRUCTIONS
CASEOP(opCall)
argumentsCount = scriptS.readByte();
iparam1 = scriptS.readByte();
@@ -311,13 +311,13 @@ bool Script::runThread(ScriptThread *thread, uint instructionLimit) {
// NOTE2: program counter is 32bit - so we should "emulate" it size - because kAddressStack relies on it
thread->push(0);
thread->_instructionOffset = iparam1;
-
+
break;
CASEOP(opCcall)
CASEOP(opCcallV)
argumentsCount = scriptS.readByte();
functionNumber = scriptS.readUint16LE();
- if (functionNumber >= ((_vm->getGameType() == GType_IHNM) ?
+ if (functionNumber >= ((_vm->getGameType() == GType_IHNM) ?
IHNM_SCRIPT_FUNCTION_MAX : ITE_SCRIPT_FUNCTION_MAX)) {
error("Script::runThread() Invalid script function number (%d)", functionNumber);
}
@@ -372,7 +372,7 @@ bool Script::runThread(ScriptThread *thread, uint instructionLimit) {
}
break;
-// BRANCH INSTRUCTIONS
+// BRANCH INSTRUCTIONS
CASEOP(opJmp)
jmpOffset1 = scriptS.readUint16LE();
thread->_instructionOffset = jmpOffset1;
@@ -424,7 +424,7 @@ bool Script::runThread(ScriptThread *thread, uint instructionLimit) {
while (1) {
iparam2 = scriptS.readSint16LE();
thread->_instructionOffset = scriptS.readUint16LE();
-
+
iparam1 -= iparam2;
if (iparam1 < 0) {
break;
@@ -470,7 +470,7 @@ bool Script::runThread(ScriptThread *thread, uint instructionLimit) {
*(uint16*)addr -= 1;
break;
-// ARITHMETIC INSTRUCTIONS
+// ARITHMETIC INSTRUCTIONS
CASEOP(opAdd)
iparam2 = thread->pop();
iparam1 = thread->pop();
@@ -502,7 +502,7 @@ bool Script::runThread(ScriptThread *thread, uint instructionLimit) {
thread->push(iparam1);
break;
-// COMPARISION INSTRUCTIONS
+// COMPARISION INSTRUCTIONS
CASEOP(opEq)
iparam2 = thread->pop();
iparam1 = thread->pop();
@@ -535,7 +535,7 @@ bool Script::runThread(ScriptThread *thread, uint instructionLimit) {
thread->push((iparam1 <= iparam2) ? 1 : 0);
break;
-// SHIFT INSTRUCTIONS
+// SHIFT INSTRUCTIONS
CASEOP(opRsh)
iparam2 = thread->pop();
iparam1 = thread->pop();
@@ -549,7 +549,7 @@ bool Script::runThread(ScriptThread *thread, uint instructionLimit) {
thread->push(iparam1);
break;
-// BITWISE INSTRUCTIONS
+// BITWISE INSTRUCTIONS
CASEOP(opAnd)
iparam2 = thread->pop();
iparam1 = thread->pop();
@@ -569,7 +569,7 @@ bool Script::runThread(ScriptThread *thread, uint instructionLimit) {
thread->push(iparam1);
break;
-// LOGICAL INSTRUCTIONS
+// LOGICAL INSTRUCTIONS
CASEOP(opLAnd)
iparam2 = thread->pop();
iparam1 = thread->pop();
@@ -582,11 +582,11 @@ bool Script::runThread(ScriptThread *thread, uint instructionLimit) {
break;
CASEOP(opLXor)
iparam2 = thread->pop();
- iparam1 = thread->pop();
+ iparam1 = thread->pop();
thread->push(((iparam1 && !iparam2) || (!iparam1 && iparam2)) ? 1 : 0);
break;
-// GAME INSTRUCTIONS
+// GAME INSTRUCTIONS
CASEOP(opSpeak) {
int stringsCount;
uint16 actorId;
@@ -604,13 +604,13 @@ bool Script::runThread(ScriptThread *thread, uint instructionLimit) {
actorId = scriptS.readUint16LE();
speechFlags = scriptS.readByte();
scriptS.readUint16LE(); // x,y skip
-
+
if (stringsCount == 0)
error("opSpeak stringsCount == 0");
if (stringsCount > ACTOR_SPEECH_STRING_MAX)
error("opSpeak stringsCount=0x%X exceed ACTOR_SPEECH_STRING_MAX", stringsCount);
-
+
iparam1 = first = thread->stackTop();
for (i = 0; i < stringsCount; i++) {
iparam1 = thread->pop();
@@ -619,7 +619,7 @@ bool Script::runThread(ScriptThread *thread, uint instructionLimit) {
// now data contains last string index
if (_vm->getGameId() == GID_ITE_DISK_G) { // special ITE dos
- if ((_vm->_scene->currentSceneNumber() == ITE_DEFAULT_SCENE) &&
+ if ((_vm->_scene->currentSceneNumber() == ITE_DEFAULT_SCENE) &&
(iparam1 >= 288) && (iparam1 <= (RID_SCENE1_VOICE_138 - RID_SCENE1_VOICE_009 + 288))) {
sampleResourceId = RID_SCENE1_VOICE_009 + iparam1 - 288;
}
@@ -629,7 +629,7 @@ bool Script::runThread(ScriptThread *thread, uint instructionLimit) {
}
}
- _vm->_actor->actorSpeech(actorId, strings, stringsCount, sampleResourceId, speechFlags);
+ _vm->_actor->actorSpeech(actorId, strings, stringsCount, sampleResourceId, speechFlags);
if (!(speechFlags & kSpeakAsync)) {
thread->wait(kWaitTypeSpeech);
@@ -686,7 +686,7 @@ bool Script::runThread(ScriptThread *thread, uint instructionLimit) {
if (thread->_flags & (kTFlagFinished | kTFlagAborted)) {
error("Wrong flags %d in thread", thread->_flags);
- }
+ }
// Set instruction offset only if a previous instruction didn't branch
if (savedInstructionOffset == thread->_instructionOffset) {
@@ -697,7 +697,7 @@ bool Script::runThread(ScriptThread *thread, uint instructionLimit) {
}
scriptS.seek(thread->_instructionOffset);
- }
+ }
}
return false;
}