aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/illusions/actor.cpp34
-rw-r--r--engines/illusions/bbdou/bbdou_bubble.cpp15
-rw-r--r--engines/illusions/bbdou/bbdou_cursor.cpp9
-rw-r--r--engines/illusions/bbdou/bbdou_inventory.cpp27
-rw-r--r--engines/illusions/bbdou/bbdou_specialcode.cpp15
-rw-r--r--engines/illusions/bbdou/illusions_bbdou.cpp6
-rw-r--r--engines/illusions/bbdou/scriptopcodes_bbdou.cpp6
-rw-r--r--engines/illusions/dictionary.h3
-rw-r--r--engines/illusions/duckman/duckman_inventory.cpp9
-rw-r--r--engines/illusions/duckman/illusions_duckman.cpp3
-rw-r--r--engines/illusions/duckman/menusystem_duckman.cpp6
-rw-r--r--engines/illusions/duckman/propertytimers.cpp3
-rw-r--r--engines/illusions/duckman/scriptopcodes_duckman.cpp6
-rw-r--r--engines/illusions/gamarchive.cpp6
-rw-r--r--engines/illusions/graphics.cpp3
-rw-r--r--engines/illusions/input.cpp3
-rw-r--r--engines/illusions/menusystem.cpp6
-rw-r--r--engines/illusions/pathfinder.cpp3
-rw-r--r--engines/illusions/resources/actorresource.cpp18
-rw-r--r--engines/illusions/resources/backgroundresource.cpp27
-rw-r--r--engines/illusions/resources/fontresource.cpp3
-rw-r--r--engines/illusions/resources/scriptresource.cpp33
-rw-r--r--engines/illusions/resources/soundresource.cpp3
-rw-r--r--engines/illusions/resources/talkresource.cpp6
-rw-r--r--engines/illusions/resourcesystem.cpp3
-rw-r--r--engines/illusions/saveload.cpp3
-rw-r--r--engines/illusions/screen.cpp9
-rw-r--r--engines/illusions/screentext.cpp3
-rw-r--r--engines/illusions/scriptstack.cpp3
-rw-r--r--engines/illusions/sequenceopcodes.cpp6
-rw-r--r--engines/illusions/sound.cpp3
-rw-r--r--engines/illusions/thread.cpp6
-rw-r--r--engines/illusions/updatefunctions.cpp9
33 files changed, 197 insertions, 101 deletions
diff --git a/engines/illusions/actor.cpp b/engines/illusions/actor.cpp
index eaf603f70b..568a1cca5e 100644
--- a/engines/illusions/actor.cpp
+++ b/engines/illusions/actor.cpp
@@ -84,8 +84,9 @@ Actor::Actor(IllusionsEngine *vm)
_parentObjectId = 0;
_linkIndex = 0;
_linkIndex2 = 0;
- for (uint i = 0; i < kSubObjectsCount; ++i)
+ for (uint i = 0; i < kSubObjectsCount; ++i) {
_subobjects[i] = 0;
+ }
_notifyThreadId1 = 0;
_notifyThreadId2 = 0;
_surfaceTextFlag = 0;
@@ -231,7 +232,6 @@ void Control::pause() {
}
void Control::unpause() {
-
_vm->_dict->setObjectControl(_objectId, this);
if (_objectId == Illusions::CURSOR_OBJECT_ID)
@@ -246,7 +246,6 @@ void Control::unpause() {
surfInfo = _actor->_surfInfo;
_actor->createSurface(surfInfo);
}
-
}
void Control::appearActor() {
@@ -264,15 +263,17 @@ void Control::appearActor() {
if (_objectId == Illusions::CURSOR_OBJECT_ID) {
_vm->showCursor();
} else {
- if (_actor->_frameIndex || _actorTypeId == 0x50004)
+ if (_actor->_frameIndex || _actorTypeId == 0x50004) {
_actor->_flags |= Illusions::ACTOR_FLAG_IS_VISIBLE;
- else
+ } else {
_actor->_flags |= Illusions::ACTOR_FLAG_1000;
- for (uint i = 0; i < kSubObjectsCount; ++i)
+ }
+ for (uint i = 0; i < kSubObjectsCount; ++i) {
if (_actor->_subobjects[i]) {
Control *subControl = _vm->_dict->getObjectControl(_actor->_subobjects[i]);
subControl->appearActor();
}
+ }
}
}
}
@@ -287,11 +288,12 @@ void Control::disappearActor() {
} else {
_actor->_flags &= ~Illusions::ACTOR_FLAG_IS_VISIBLE;
_actor->_flags &= ~Illusions::ACTOR_FLAG_1000;
- for (uint i = 0; i < kSubObjectsCount; ++i)
+ for (uint i = 0; i < kSubObjectsCount; ++i) {
if (_actor->_subobjects[i]) {
Control *subControl = _vm->_dict->getObjectControl(_actor->_subobjects[i]);
subControl->disappearActor();
}
+ }
}
}
}
@@ -303,22 +305,24 @@ bool Control::isActorVisible() {
void Control::activateObject() {
_flags |= 1;
if (_actor) {
- for (uint i = 0; i < kSubObjectsCount; ++i)
+ for (uint i = 0; i < kSubObjectsCount; ++i) {
if (_actor->_subobjects[i]) {
Control *subControl = _vm->_dict->getObjectControl(_actor->_subobjects[i]);
subControl->activateObject();
}
+ }
}
}
void Control::deactivateObject() {
_flags &= ~1;
if (_actor) {
- for (uint i = 0; i < kSubObjectsCount; ++i)
+ for (uint i = 0; i < kSubObjectsCount; ++i) {
if (_actor->_subobjects[i]) {
Control *subControl = _vm->_dict->getObjectControl(_actor->_subobjects[i]);
subControl->deactivateObject();
}
+ }
}
}
@@ -354,20 +358,22 @@ Common::Point Control::getActorPosition() {
void Control::setActorScale(int scale) {
_actor->_scale = scale;
- for (uint i = 0; i < kSubObjectsCount; ++i)
+ for (uint i = 0; i < kSubObjectsCount; ++i) {
if (_actor->_subobjects[i]) {
Control *subControl = _vm->_dict->getObjectControl(_actor->_subobjects[i]);
subControl->setActorScale(scale);
}
+ }
}
void Control::faceActor(uint facing) {
_actor->_facing = facing;
- for (uint i = 0; i < kSubObjectsCount; ++i)
+ for (uint i = 0; i < kSubObjectsCount; ++i) {
if (_actor->_subobjects[i]) {
Control *subControl = _vm->_dict->getObjectControl(_actor->_subobjects[i]);
subControl->faceActor(facing);
}
+ }
}
void Control::linkToObject(uint32 parentObjectId, uint32 linkedObjectValue) {
@@ -385,13 +391,14 @@ void Control::clearNotifyThreadId1() {
}
void Control::clearNotifyThreadId2() {
- for (uint i = 0; i < kSubObjectsCount; ++i)
+ for (uint i = 0; i < kSubObjectsCount; ++i) {
if (_actor->_subobjects[i]) {
Control *subControl = _vm->_dict->getObjectControl(_actor->_subobjects[i]);
subControl->_actor->_flags &= ~Illusions::ACTOR_FLAG_80;
subControl->_actor->_entryTblPtr = 0;
subControl->_actor->_notifyThreadId2 = 0;
}
+ }
_actor->_flags &= ~Illusions::ACTOR_FLAG_80;
_actor->_entryTblPtr = 0;
_actor->_notifyThreadId2 = 0;
@@ -583,11 +590,12 @@ void Control::stopSequenceActor() {
_actor->_flags |= Illusions::ACTOR_FLAG_1000;
}
}
- for (uint i = 0; i < kSubObjectsCount; ++i)
+ for (uint i = 0; i < kSubObjectsCount; ++i) {
if (_actor->_subobjects[i]) {
Control *subControl = _vm->_dict->getObjectControl(_actor->_subobjects[i]);
subControl->stopSequenceActor();
}
+ }
}
void Control::startTalkActor(uint32 sequenceId, byte *entryTblPtr, uint32 threadId) {
diff --git a/engines/illusions/bbdou/bbdou_bubble.cpp b/engines/illusions/bbdou/bbdou_bubble.cpp
index c631a22109..cba0dcc4a4 100644
--- a/engines/illusions/bbdou/bbdou_bubble.cpp
+++ b/engines/illusions/bbdou/bbdou_bubble.cpp
@@ -63,8 +63,9 @@ void BbdouBubble::init() {
_objectId1414 = 0x4005B;
_objectId1418 = 0x4005C;
- for (uint i = 0; i < 32; ++i)
+ for (uint i = 0; i < 32; ++i) {
_objectIds[i] = kObjectIds3[i];
+ }
for (uint i = 0; i < 32; ++i) {
_items[i]._objectId = kObjectIds2[i];
@@ -92,8 +93,9 @@ void BbdouBubble::addItem0(uint32 sequenceId1, uint32 sequenceId2, uint32 progRe
item0._progResKeywordId = progResKeywordId;
item0._baseNamedPointId = namedPointId;
item0._count = count;
- for (int16 i = 0; i < count; ++i)
+ for (int16 i = 0; i < count; ++i) {
item0._namedPointIds[i] = FROM_LE_32(namedPointIds[i]);
+ }
item0._objectId = 0;
item0._pt.x = 0;
item0._pt.y = 0;
@@ -148,8 +150,9 @@ void BbdouBubble::hide() {
}
void BbdouBubble::setup(int16 minCount, Common::Point pt1, Common::Point pt2, uint32 progResKeywordId) {
- for (uint i = 0; i < 32; ++i)
+ for (uint i = 0; i < 32; ++i) {
_items[i]._enabled = 0;
+ }
int16 maxCount = 32;
for (uint i = 0; i < _item0s.size(); ++i) {
Item0 *item0 = &_item0s[i];
@@ -202,8 +205,9 @@ void BbdouBubble::calcBubbles(Common::Point &pt1, Common::Point &pt2) {
control->startSequenceActor(0x00060056, 2, 0);
}
- for (int i = 0; i < kSequenceIdsCount; ++i)
+ for (int i = 0; i < kSequenceIdsCount; ++i) {
sequenceCounters[i] = 0;
+ }
if (pt2.y >= pt1.y) {
swapY = true;
@@ -231,8 +235,9 @@ void BbdouBubble::calcBubbles(Common::Point &pt1, Common::Point &pt2) {
int pointsCount = (int)(arcLength / kDistanceBetweenPoints);
float partAngle = ABS(kDistanceBetweenPoints / radius);
- for (int i = 0; i < pointsCount; ++i)
+ for (int i = 0; i < pointsCount; ++i) {
++sequenceCounters[kIndexTbl[i % kSequenceIdsCount]];
+ }
if (!swapY) {
if (pt2.y < pt1.y) {
diff --git a/engines/illusions/bbdou/bbdou_cursor.cpp b/engines/illusions/bbdou/bbdou_cursor.cpp
index 3a098b9f1e..2d546def04 100644
--- a/engines/illusions/bbdou/bbdou_cursor.cpp
+++ b/engines/illusions/bbdou/bbdou_cursor.cpp
@@ -132,18 +132,20 @@ void BbdouCursor::reset(uint32 objectId) {
}
void BbdouCursor::addCursorSequenceId(uint32 objectId, uint32 sequenceId) {
- for (uint i = 0; i < kMaxCursorSequences; ++i)
+ for (uint i = 0; i < kMaxCursorSequences; ++i) {
if (_cursorSequences[i]._objectId == 0) {
_cursorSequences[i]._objectId = objectId;
_cursorSequences[i]._sequenceId = sequenceId;
break;
}
+ }
}
uint32 BbdouCursor::findCursorSequenceId(uint32 objectId) {
- for (uint i = 0; i < kMaxCursorSequences; ++i)
+ for (uint i = 0; i < kMaxCursorSequences; ++i) {
if (_cursorSequences[i]._objectId == objectId)
return _cursorSequences[i]._sequenceId;
+ }
return 0;
}
@@ -332,8 +334,9 @@ bool BbdouCursor::getTrackingCursorSequenceId(Control *control, uint32 &outSeque
}
void BbdouCursor::resetActiveVerbs() {
- for (uint i = 0; i < 32; ++i)
+ for (uint i = 0; i < 32; ++i) {
_data._verbState._verbActive[i] = false;
+ }
if (_data._verbState._cursorState == 1) {
_data._verbState._verbActive[1] = true;
_data._verbState._verbActive[2] = true;
diff --git a/engines/illusions/bbdou/bbdou_inventory.cpp b/engines/illusions/bbdou/bbdou_inventory.cpp
index e35a2e82ad..14c2d769dd 100644
--- a/engines/illusions/bbdou/bbdou_inventory.cpp
+++ b/engines/illusions/bbdou/bbdou_inventory.cpp
@@ -59,11 +59,12 @@ void InventoryBag::registerInventorySlot(uint32 namedPointId) {
bool InventoryBag::addInventoryItem(InventoryItem *inventoryItem, InventorySlot *inventorySlot) {
// NOTE Skipped support for multiple items per slot, not used in BBDOU
if (!inventorySlot) {
- for (InventorySlotsIterator it = _inventorySlots.begin(); it != _inventorySlots.end(); ++it)
+ for (InventorySlotsIterator it = _inventorySlots.begin(); it != _inventorySlots.end(); ++it) {
if (!(*it)->_inventoryItem) {
inventorySlot = *it;
break;
}
+ }
}
if (inventorySlot) {
inventorySlot->_inventoryItem = inventoryItem;
@@ -73,9 +74,10 @@ bool InventoryBag::addInventoryItem(InventoryItem *inventoryItem, InventorySlot
}
void InventoryBag::removeInventoryItem(InventoryItem *inventoryItem) {
- for (InventorySlotsIterator it = _inventorySlots.begin(); it != _inventorySlots.end(); ++it)
+ for (InventorySlotsIterator it = _inventorySlots.begin(); it != _inventorySlots.end(); ++it) {
if ((*it)->_inventoryItem && (*it)->_inventoryItem->_objectId == inventoryItem->_objectId)
(*it)->_inventoryItem = 0;
+ }
}
bool InventoryBag::hasInventoryItem(uint32 objectId) {
@@ -111,9 +113,10 @@ void InventoryBag::clear() {
}
InventorySlot *InventoryBag::getInventorySlot(uint32 objectId) {
- for (uint i = 0; i < _inventorySlots.size(); ++i)
+ for (uint i = 0; i < _inventorySlots.size(); ++i) {
if (_inventorySlots[i]->_objectId == objectId)
return _inventorySlots[i];
+ }
return 0;
}
@@ -159,9 +162,10 @@ void BbdouInventory::addInventoryItem(uint32 objectId) {
bool assigned = inventoryItem->_assigned;
inventoryItem->_assigned = true;
if (!assigned && !inventoryItem->_flag) {
- for (uint i = 0; i < _inventoryBags.size(); ++i)
+ for (uint i = 0; i < _inventoryBags.size(); ++i) {
if (!_inventoryBags[i]->addInventoryItem(inventoryItem, 0))
inventoryItem->_assigned = false;
+ }
}
if (_activeInventorySceneId)
refresh();
@@ -181,10 +185,11 @@ void BbdouInventory::removeInventoryItem(uint32 objectId) {
}
bool BbdouInventory::hasInventoryItem(uint32 objectId) {
- for (uint i = 0; i < _inventoryItems.size(); ++i)
+ for (uint i = 0; i < _inventoryItems.size(); ++i) {
if (_inventoryItems[i]->_objectId == objectId &&
_inventoryItems[i]->_assigned)
return true;
+ }
return false;
}
@@ -234,16 +239,18 @@ void BbdouInventory::close() {
}
InventoryBag *BbdouInventory::getInventoryBag(uint32 sceneId) {
- for (uint i = 0; i < _inventoryBags.size(); ++i)
+ for (uint i = 0; i < _inventoryBags.size(); ++i) {
if (_inventoryBags[i]->_sceneId == sceneId)
return _inventoryBags[i];
+ }
return 0;
}
InventoryItem *BbdouInventory::getInventoryItem(uint32 objectId) {
- for (uint i = 0; i < _inventoryItems.size(); ++i)
+ for (uint i = 0; i < _inventoryItems.size(); ++i) {
if (_inventoryItems[i]->_objectId == objectId)
return _inventoryItems[i];
+ }
return 0;
}
@@ -266,8 +273,9 @@ void BbdouInventory::refresh() {
}
void BbdouInventory::buildItems(InventoryBag *inventoryBag) {
- for (InventoryItemsIterator it = _inventoryItems.begin(); it != _inventoryItems.end(); ++it)
+ for (InventoryItemsIterator it = _inventoryItems.begin(); it != _inventoryItems.end(); ++it) {
(*it)->_timesPresent = 0;
+ }
inventoryBag->buildItems();
for (InventoryItemsIterator it = _inventoryItems.begin(); it != _inventoryItems.end(); ++it) {
InventoryItem *inventoryItem = *it;
@@ -284,8 +292,9 @@ void BbdouInventory::clear() {
inventoryItem->_assigned = false;
inventoryItem->_flag = false;
}
- for (uint i = 0; i < _inventoryBags.size(); ++i)
+ for (uint i = 0; i < _inventoryBags.size(); ++i) {
_inventoryBags[i]->clear();
+ }
}
void BbdouInventory::cause0x1B0001(TriggerFunction *triggerFunction, uint32 callingThreadId) {
diff --git a/engines/illusions/bbdou/bbdou_specialcode.cpp b/engines/illusions/bbdou/bbdou_specialcode.cpp
index 89f94419ef..2d8df43f23 100644
--- a/engines/illusions/bbdou/bbdou_specialcode.cpp
+++ b/engines/illusions/bbdou/bbdou_specialcode.cpp
@@ -101,8 +101,9 @@ void RadarMicrophoneThread::addZone(uint32 threadId) {
}
void RadarMicrophoneThread::initZones() {
- for (uint i = 0; i < _zonesCount; ++i)
+ for (uint i = 0; i < _zonesCount; ++i) {
_zones[i]._x = (i + 1) * 640 / _zonesCount;
+ }
_zones[_zonesCount]._x = 640;
_currZoneIndex = 0;
}
@@ -114,17 +115,19 @@ ObjectInteractModeMap::ObjectInteractModeMap() {
void ObjectInteractModeMap::setObjectInteractMode(uint32 objectId, int value) {
ObjectInteractMode *objectInteractMode = 0;
- for (uint i = 0; i < ARRAYSIZE(_objectVerbs); ++i)
+ for (uint i = 0; i < ARRAYSIZE(_objectVerbs); ++i) {
if (_objectVerbs[i]._objectId == objectId) {
objectInteractMode = &_objectVerbs[i];
break;
}
+ }
if (!objectInteractMode) {
- for (uint i = 0; i < ARRAYSIZE(_objectVerbs); ++i)
+ for (uint i = 0; i < ARRAYSIZE(_objectVerbs); ++i) {
if (_objectVerbs[i]._objectId == 0) {
objectInteractMode = &_objectVerbs[i];
break;
}
+ }
}
if (value != 11) {
objectInteractMode->_objectId = objectId;
@@ -136,9 +139,10 @@ void ObjectInteractModeMap::setObjectInteractMode(uint32 objectId, int value) {
}
int ObjectInteractModeMap::getObjectInteractMode(uint32 objectId) {
- for (uint i = 0; i < ARRAYSIZE(_objectVerbs); ++i)
+ for (uint i = 0; i < ARRAYSIZE(_objectVerbs); ++i) {
if (_objectVerbs[i]._objectId == objectId)
return _objectVerbs[i]._interactMode;
+ }
return 11;
}
@@ -974,9 +978,10 @@ bool BbdouSpecialCode::testVerbId(uint32 verbId, uint32 holdingObjectId, uint32
verbIds = kVerbIdsEE;
}
- for (; *verbIds; ++verbIds)
+ for (; *verbIds; ++verbIds) {
if (*verbIds == verbId)
return true;
+ }
return false;
}
diff --git a/engines/illusions/bbdou/illusions_bbdou.cpp b/engines/illusions/bbdou/illusions_bbdou.cpp
index 0074036f56..0c16ad5959 100644
--- a/engines/illusions/bbdou/illusions_bbdou.cpp
+++ b/engines/illusions/bbdou/illusions_bbdou.cpp
@@ -113,9 +113,10 @@ uint32 ActiveScenes::getCurrentScene() {
}
bool ActiveScenes::isSceneActive(uint32 sceneId) {
- for (uint i = 0; i < _stack.size(); ++i)
+ for (uint i = 0; i < _stack.size(); ++i) {
if (_stack[i]._sceneId == sceneId && _stack[i]._pauseCtr <= 0)
return true;
+ }
return false;
}
@@ -493,8 +494,9 @@ void IllusionsEngine_BBDOU::newScriptThread(uint32 threadId, uint32 callingThrea
scriptThread->pause();
if (_doScriptThreadInit) {
int updateResult = kTSRun;
- while (scriptThread->_pauseCtr <= 0 && updateResult != kTSTerminate && updateResult != kTSYield)
+ while (scriptThread->_pauseCtr <= 0 && updateResult != kTSTerminate && updateResult != kTSYield) {
updateResult = scriptThread->update();
+ }
}
}
diff --git a/engines/illusions/bbdou/scriptopcodes_bbdou.cpp b/engines/illusions/bbdou/scriptopcodes_bbdou.cpp
index 09395831ea..e6a3dd6c2c 100644
--- a/engines/illusions/bbdou/scriptopcodes_bbdou.cpp
+++ b/engines/illusions/bbdou/scriptopcodes_bbdou.cpp
@@ -54,8 +54,9 @@ typedef Common::Functor2Mem<ScriptThread*, OpCall&, void, ScriptOpcodes_BBDOU> S
void ScriptOpcodes_BBDOU::initOpcodes() {
// First clear everything
- for (uint i = 0; i < 256; ++i)
+ for (uint i = 0; i < 256; ++i) {
_opcodes[i] = 0;
+ }
// Register opcodes
OPCODE(2, opSuspend);
OPCODE(3, opYield);
@@ -177,8 +178,9 @@ void ScriptOpcodes_BBDOU::initOpcodes() {
#undef OPCODE
void ScriptOpcodes_BBDOU::freeOpcodes() {
- for (uint i = 0; i < 256; ++i)
+ for (uint i = 0; i < 256; ++i) {
delete _opcodes[i];
+ }
}
// Opcodes
diff --git a/engines/illusions/dictionary.h b/engines/illusions/dictionary.h
index 667042cf45..c0d60a9bb7 100644
--- a/engines/illusions/dictionary.h
+++ b/engines/illusions/dictionary.h
@@ -44,8 +44,9 @@ protected:
public:
~DictionaryHashMap() {
- for (MapIterator it = _map.begin(); it != _map.end(); ++it)
+ for (MapIterator it = _map.begin(); it != _map.end(); ++it) {
delete it->_value;
+ }
}
void add(uint32 id, T *value) {
diff --git a/engines/illusions/duckman/duckman_inventory.cpp b/engines/illusions/duckman/duckman_inventory.cpp
index 1f863b5869..e1ab1ffbd7 100644
--- a/engines/illusions/duckman/duckman_inventory.cpp
+++ b/engines/illusions/duckman/duckman_inventory.cpp
@@ -112,9 +112,10 @@ void DuckmanInventory::addInventoryItem(uint32 objectId) {
}
void DuckmanInventory::clearInventorySlot(uint32 objectId) {
- for (uint i = 0; i < _inventorySlots.size(); ++i)
+ for (uint i = 0; i < _inventorySlots.size(); ++i) {
if (_inventorySlots[i]._objectId == objectId)
_inventorySlots[i]._objectId = 0;
+ }
}
void DuckmanInventory::putBackInventoryItem() {
@@ -140,16 +141,18 @@ void DuckmanInventory::putBackInventoryItem() {
}
DMInventorySlot *DuckmanInventory::findInventorySlot(uint32 objectId) {
- for (uint i = 0; i < _inventorySlots.size(); ++i)
+ for (uint i = 0; i < _inventorySlots.size(); ++i) {
if (_inventorySlots[i]._objectId == objectId)
return &_inventorySlots[i];
+ }
return 0;
}
DMInventoryItem *DuckmanInventory::findInventoryItem(uint32 objectId) {
- for (uint i = 0; i < _inventoryItems.size(); ++i)
+ for (uint i = 0; i < _inventoryItems.size(); ++i) {
if (_inventoryItems[i]._objectId == objectId)
return &_inventoryItems[i];
+ }
return 0;
}
diff --git a/engines/illusions/duckman/illusions_duckman.cpp b/engines/illusions/duckman/illusions_duckman.cpp
index e08d1b0096..56c997dd1f 100644
--- a/engines/illusions/duckman/illusions_duckman.cpp
+++ b/engines/illusions/duckman/illusions_duckman.cpp
@@ -881,8 +881,9 @@ bool IllusionsEngine_Duckman::loadScene(uint32 sceneId) {
uint resourcesCount;
uint32 *resources;
sceneInfo->getResources(resourcesCount, resources);
- for (uint i = 0; i < resourcesCount; ++i)
+ for (uint i = 0; i < resourcesCount; ++i) {
_resSys->loadResource(resources[i], sceneId, 0);
+ }
return true;
}
diff --git a/engines/illusions/duckman/menusystem_duckman.cpp b/engines/illusions/duckman/menusystem_duckman.cpp
index 3a10ec3f0a..367eb28312 100644
--- a/engines/illusions/duckman/menusystem_duckman.cpp
+++ b/engines/illusions/duckman/menusystem_duckman.cpp
@@ -56,13 +56,15 @@ void DuckmanMenuSystem::runMenu(MenuChoiceOffsets menuChoiceOffsets, int16 *menu
}
void DuckmanMenuSystem::clearMenus() {
- for (int i = 0; i < kDuckmanLastMenuIndex; ++i)
+ for (int i = 0; i < kDuckmanLastMenuIndex; ++i) {
_menus[i] = 0;
+ }
}
void DuckmanMenuSystem::freeMenus() {
- for (int i = 0; i < kDuckmanLastMenuIndex; ++i)
+ for (int i = 0; i < kDuckmanLastMenuIndex; ++i) {
delete _menus[i];
+ }
}
BaseMenu *DuckmanMenuSystem::getMenuById(int menuId) {
diff --git a/engines/illusions/duckman/propertytimers.cpp b/engines/illusions/duckman/propertytimers.cpp
index cdfdd927a3..c74b9dbc24 100644
--- a/engines/illusions/duckman/propertytimers.cpp
+++ b/engines/illusions/duckman/propertytimers.cpp
@@ -73,11 +73,12 @@ void PropertyTimers::removePropertyTimer(uint32 propertyId) {
}
bool PropertyTimers::findPropertyTimer(uint32 propertyId, PropertyTimer *&propertyTimer) {
- for (uint i = 0; i < kPropertyTimersCount; ++i)
+ for (uint i = 0; i < kPropertyTimersCount; ++i) {
if (_propertyTimers[i]._propertyId == propertyId) {
propertyTimer = &_propertyTimers[i];
return true;
}
+ }
return false;
}
diff --git a/engines/illusions/duckman/scriptopcodes_duckman.cpp b/engines/illusions/duckman/scriptopcodes_duckman.cpp
index 6b76a65686..e6f286ca9c 100644
--- a/engines/illusions/duckman/scriptopcodes_duckman.cpp
+++ b/engines/illusions/duckman/scriptopcodes_duckman.cpp
@@ -57,8 +57,9 @@ typedef Common::Functor2Mem<ScriptThread*, OpCall&, void, ScriptOpcodes_Duckman>
void ScriptOpcodes_Duckman::initOpcodes() {
// First clear everything
- for (uint i = 0; i < 256; ++i)
+ for (uint i = 0; i < 256; ++i) {
_opcodes[i] = 0;
+ }
// Register opcodes
OPCODE(1, opNop);
OPCODE(2, opSuspend);
@@ -164,8 +165,9 @@ void ScriptOpcodes_Duckman::initOpcodes() {
#undef OPCODE
void ScriptOpcodes_Duckman::freeOpcodes() {
- for (uint i = 0; i < 256; ++i)
+ for (uint i = 0; i < 256; ++i) {
delete _opcodes[i];
+ }
}
// Opcodes
diff --git a/engines/illusions/gamarchive.cpp b/engines/illusions/gamarchive.cpp
index 5c0debb27e..cda7859386 100644
--- a/engines/illusions/gamarchive.cpp
+++ b/engines/illusions/gamarchive.cpp
@@ -75,16 +75,18 @@ void GamArchive::loadDictionary() {
}
const GamGroupEntry *GamArchive::getGroupEntry(uint32 sceneId) {
- for (uint i = 0; i < _groupCount; ++i)
+ for (uint i = 0; i < _groupCount; ++i) {
if (_groups[i]._id == sceneId)
return &_groups[i];
+ }
return 0;
}
const GamFileEntry *GamArchive::getFileEntry(const GamGroupEntry *groupEntry, uint32 resId) {
- for (uint i = 0; i < groupEntry->_fileCount; ++i)
+ for (uint i = 0; i < groupEntry->_fileCount; ++i) {
if (groupEntry->_files[i]._id == resId)
return &groupEntry->_files[i];
+ }
return 0;
}
diff --git a/engines/illusions/graphics.cpp b/engines/illusions/graphics.cpp
index 24721375cf..772d6271be 100644
--- a/engines/illusions/graphics.cpp
+++ b/engines/illusions/graphics.cpp
@@ -54,11 +54,12 @@ void NamedPoint::load(Common::SeekableReadStream &stream) {
// NamedPoints
bool NamedPoints::findNamedPoint(uint32 namedPointId, Common::Point &pt) {
- for (ItemsIterator it = _namedPoints.begin(); it != _namedPoints.end(); ++it)
+ for (ItemsIterator it = _namedPoints.begin(); it != _namedPoints.end(); ++it) {
if ((*it)._namedPointId == namedPointId) {
pt = (*it)._pt;
return true;
}
+ }
return false;
}
diff --git a/engines/illusions/input.cpp b/engines/illusions/input.cpp
index 712f417a19..12d8436e86 100644
--- a/engines/illusions/input.cpp
+++ b/engines/illusions/input.cpp
@@ -173,8 +173,9 @@ InputEvent& Input::setInputEvent(uint evt, uint bitMask) {
}
void Input::handleKey(Common::KeyCode key, int mouseButton, bool down) {
- for (uint i = 0; i < kEventMax; ++i)
+ for (uint i = 0; i < kEventMax; ++i) {
_newKeys |= _inputEvents[i].handle(key, mouseButton, down);
+ }
uint prevButtonStates = _buttonStates;
_buttonStates |= _newKeys;
_newKeys = 0;
diff --git a/engines/illusions/menusystem.cpp b/engines/illusions/menusystem.cpp
index b33da1333b..6d8359199d 100644
--- a/engines/illusions/menusystem.cpp
+++ b/engines/illusions/menusystem.cpp
@@ -59,8 +59,9 @@ BaseMenu::BaseMenu(BaseMenuSystem *menuSystem, uint32 fontId, byte backgroundCol
}
BaseMenu::~BaseMenu() {
- for (MenuItems::iterator it = _menuItems.begin(); it != _menuItems.end(); ++it)
+ for (MenuItems::iterator it = _menuItems.begin(); it != _menuItems.end(); ++it) {
delete *it;
+ }
}
void BaseMenu::addText(const Common::String text) {
@@ -585,8 +586,9 @@ MenuTextBuilder::MenuTextBuilder() : _pos(0) {
}
void MenuTextBuilder::appendString(const Common::String &value) {
- for (uint i = 0; i < value.size(); ++i)
+ for (uint i = 0; i < value.size(); ++i) {
_text[_pos++] = value[i];
+ }
}
void MenuTextBuilder::appendNewLine() {
diff --git a/engines/illusions/pathfinder.cpp b/engines/illusions/pathfinder.cpp
index e3ea07b095..936e855cdb 100644
--- a/engines/illusions/pathfinder.cpp
+++ b/engines/illusions/pathfinder.cpp
@@ -82,9 +82,10 @@ PointArray *PathFinder::findPathInternal(Common::Point sourcePt, Common::Point d
}
bool PathFinder::isLineBlocked(PathLine &line) {
- for (uint i = 0; i < _walkRects->size(); ++i)
+ for (uint i = 0; i < _walkRects->size(); ++i) {
if (calcLineStatus(line, (*_walkRects)[i], 0) != 3)
return true;
+ }
return false;
}
diff --git a/engines/illusions/resources/actorresource.cpp b/engines/illusions/resources/actorresource.cpp
index 13c8abc481..04e6c9dc67 100644
--- a/engines/illusions/resources/actorresource.cpp
+++ b/engines/illusions/resources/actorresource.cpp
@@ -162,9 +162,10 @@ void ActorResource::load(Resource *resource) {
}
bool ActorResource::containsSequence(Sequence *sequence) {
- for (uint i = 0; i < _sequences.size(); ++i)
+ for (uint i = 0; i < _sequences.size(); ++i) {
if (sequence == &_sequences[i])
return true;
+ }
return false;
}
@@ -243,10 +244,12 @@ void ActorInstance::registerResources() {
}
void ActorInstance::unregisterResources() {
- for (uint i = 0; i < _actorResource->_actorTypes.size(); ++i)
+ for (uint i = 0; i < _actorResource->_actorTypes.size(); ++i) {
_vm->_dict->removeActorType(_actorResource->_actorTypes[i]._actorTypeId);
- for (uint i = 0; i < _actorResource->_sequences.size(); ++i)
+ }
+ for (uint i = 0; i < _actorResource->_sequences.size(); ++i) {
_vm->_dict->removeSequence(_actorResource->_sequences[i]._sequenceId);
+ }
}
// ActorInstanceList
@@ -270,15 +273,17 @@ void ActorInstanceList::removeActorInstance(ActorInstance *actorInstance) {
}
void ActorInstanceList::pauseBySceneId(uint32 sceneId) {
- for (ItemsIterator it = _items.begin(); it != _items.end(); ++it)
+ for (ItemsIterator it = _items.begin(); it != _items.end(); ++it) {
if ((*it)->_sceneId == sceneId)
(*it)->pause();
+ }
}
void ActorInstanceList::unpauseBySceneId(uint32 sceneId) {
- for (ItemsIterator it = _items.begin(); it != _items.end(); ++it)
+ for (ItemsIterator it = _items.begin(); it != _items.end(); ++it) {
if ((*it)->_sceneId == sceneId)
(*it)->unpause();
+ }
}
FramesList *ActorInstanceList::findSequenceFrames(Sequence *sequence) {
@@ -291,9 +296,10 @@ FramesList *ActorInstanceList::findSequenceFrames(Sequence *sequence) {
}
ActorInstance *ActorInstanceList::findActorByResource(ActorResource *actorResource) {
- for (ItemsIterator it = _items.begin(); it != _items.end(); ++it)
+ for (ItemsIterator it = _items.begin(); it != _items.end(); ++it) {
if ((*it)->_actorResource == actorResource)
return (*it);
+ }
return 0;
}
diff --git a/engines/illusions/resources/backgroundresource.cpp b/engines/illusions/resources/backgroundresource.cpp
index 27d73a70b9..2a37bba4a8 100644
--- a/engines/illusions/resources/backgroundresource.cpp
+++ b/engines/illusions/resources/backgroundresource.cpp
@@ -281,8 +281,9 @@ void BackgroundResource::load(byte *data, uint32 dataSize) {
stream.seek(0x48);
uint32 regionSequencesOffs = stream.readUint32LE();
stream.seek(regionSequencesOffs);
- for (uint i = 0; i < _regionSequencesCount; ++i)
+ for (uint i = 0; i < _regionSequencesCount; ++i) {
_regionSequences[i].load(data, stream);
+ }
// Load background objects
stream.seek(0x1C);
@@ -344,8 +345,9 @@ void BackgroundResource::load(byte *data, uint32 dataSize) {
int BackgroundResource::findMasterBgIndex() {
int index = 1;
- while (!(_bgInfos[index - 1]._flags & 1)) //TODO check if this is correct
+ while (!(_bgInfos[index - 1]._flags & 1)) { // TODO check if this is correct
++index;
+ }
return index;
}
@@ -394,8 +396,9 @@ void BackgroundInstance::load(Resource *resource) {
initSurface();
// Insert background objects
- for (uint i = 0; i < backgroundResource->_backgroundObjectsCount; ++i)
+ for (uint i = 0; i < backgroundResource->_backgroundObjectsCount; ++i) {
_vm->_controls->placeBackgroundObject(&backgroundResource->_backgroundObjects[i]);
+ }
registerResources();
@@ -460,8 +463,9 @@ void BackgroundInstance::unregisterResources() {
}
void BackgroundInstance::initSurface() {
- for (uint i = 0; i < kMaxBackgroundItemSurfaces; ++i)
+ for (uint i = 0; i < kMaxBackgroundItemSurfaces; ++i) {
_surfaces[i] = 0;
+ }
for (uint i = 0; i < _bgRes->_bgInfosCount; ++i) {
BgInfo *bgInfo = &_bgRes->_bgInfos[i];
_panPoints[i] = bgInfo->_panPoint;
@@ -481,12 +485,13 @@ void BackgroundInstance::initSurface() {
}
void BackgroundInstance::freeSurface() {
- for (uint i = 0; i < _bgRes->_bgInfosCount; ++i)
+ for (uint i = 0; i < _bgRes->_bgInfosCount; ++i) {
if (_surfaces[i]) {
_surfaces[i]->free();
delete _surfaces[i];
_surfaces[i] = 0;
}
+ }
}
void BackgroundInstance::drawTiles(Graphics::Surface *surface, TileMap &tileMap, byte *tilePixels) {
@@ -572,28 +577,32 @@ void BackgroundInstanceList::removeBackgroundInstance(BackgroundInstance *backgr
}
void BackgroundInstanceList::pauseBySceneId(uint32 sceneId) {
- for (ItemsIterator it = _items.begin(); it != _items.end(); ++it)
+ for (ItemsIterator it = _items.begin(); it != _items.end(); ++it) {
if ((*it)->_sceneId == sceneId)
(*it)->pause();
+ }
}
void BackgroundInstanceList::unpauseBySceneId(uint32 sceneId) {
- for (ItemsIterator it = _items.begin(); it != _items.end(); ++it)
+ for (ItemsIterator it = _items.begin(); it != _items.end(); ++it) {
if ((*it)->_sceneId == sceneId)
(*it)->unpause();
+ }
}
BackgroundInstance *BackgroundInstanceList::findActiveBackgroundInstance() {
- for (ItemsIterator it = _items.begin(); it != _items.end(); ++it)
+ for (ItemsIterator it = _items.begin(); it != _items.end(); ++it) {
if ((*it)->_pauseCtr == 0)
return (*it);
+ }
return 0;
}
BackgroundInstance *BackgroundInstanceList::findBackgroundByResource(BackgroundResource *backgroundResource) {
- for (ItemsIterator it = _items.begin(); it != _items.end(); ++it)
+ for (ItemsIterator it = _items.begin(); it != _items.end(); ++it) {
if ((*it)->_bgRes == backgroundResource)
return (*it);
+ }
return 0;
}
diff --git a/engines/illusions/resources/fontresource.cpp b/engines/illusions/resources/fontresource.cpp
index 4c89708fbc..8d11e92b48 100644
--- a/engines/illusions/resources/fontresource.cpp
+++ b/engines/illusions/resources/fontresource.cpp
@@ -104,9 +104,10 @@ void FontResource::load(Resource *resource) {
}
CharInfo *FontResource::getCharInfo(uint16 c) {
- for (uint i = 0; i < _charRangesCount; ++i)
+ for (uint i = 0; i < _charRangesCount; ++i) {
if (_charRanges[i].containsChar(c))
return _charRanges[i].getCharInfo(c);
+ }
return 0;
}
diff --git a/engines/illusions/resources/scriptresource.cpp b/engines/illusions/resources/scriptresource.cpp
index 08433fe71c..760273c669 100644
--- a/engines/illusions/resources/scriptresource.cpp
+++ b/engines/illusions/resources/scriptresource.cpp
@@ -51,8 +51,9 @@ void Properties::init(uint count, byte *properties) {
void Properties::clear() {
uint32 size = getSize();
- for (uint32 i = 0; i < size; ++i)
+ for (uint32 i = 0; i < size; ++i) {
_properties[i] = 0;
+ }
}
bool Properties::get(uint32 propertyId) {
@@ -108,8 +109,9 @@ void BlockCounters::init(uint count, byte *blockCounters) {
}
void BlockCounters::clear() {
- for (uint i = 0; i < _count; ++i)
+ for (uint i = 0; i < _count; ++i) {
_blockCounters[i] = 0;
+ }
}
byte BlockCounters::get(uint index) {
@@ -177,8 +179,9 @@ void TriggerObject::load(byte *dataStart, Common::SeekableReadStream &stream) {
debug(2, "TriggerObject::load() _objectId: %08X; _causesCount: %d",
_objectId, _causesCount);
_causes = new TriggerCause[_causesCount];
- for (uint i = 0; i < _causesCount; ++i)
+ for (uint i = 0; i < _causesCount; ++i) {
_causes[i].load(stream);
+ }
}
bool TriggerObject::findTriggerCause(uint32 verbId, uint32 objectId2, uint32 &codeOffs) {
@@ -191,18 +194,20 @@ bool TriggerObject::findTriggerCause(uint32 verbId, uint32 objectId2, uint32 &co
}
}
} else {
- for (uint i = 0; i < _causesCount; ++i)
+ for (uint i = 0; i < _causesCount; ++i) {
if (_causes[i]._verbId == verbId && _causes[i]._objectId2 == objectId2) {
codeOffs = _causes[i]._codeOffs;
return true;
}
+ }
}
return false;
}
void TriggerObject::fixupSceneInfosDuckman() {
- for (uint i = 0; i < _causesCount; ++i)
+ for (uint i = 0; i < _causesCount; ++i) {
_causes[i]._verbId &= 0xFFFF;
+ }
}
// SceneInfo
@@ -229,8 +234,9 @@ void SceneInfo::load(byte *dataStart, Common::SeekableReadStream &stream) {
uint32 triggerObjectsListOffs = stream.readUint32LE();
if (_resourcesCount > 0) {
_resources = new uint32[_resourcesCount];
- for (uint i = 0; i < _resourcesCount; ++i)
+ for (uint i = 0; i < _resourcesCount; ++i) {
_resources[i] = stream.readUint32LE();
+ }
}
if (_triggerObjectsCount > 0) {
_triggerObjects = new TriggerObject[_triggerObjectsCount];
@@ -256,15 +262,17 @@ void SceneInfo::getResources(uint &resourcesCount, uint32 *&resources) {
}
TriggerObject *SceneInfo::findTriggerObject(uint32 objectId) {
- for (uint i = 0; i < _triggerObjectsCount; ++i)
+ for (uint i = 0; i < _triggerObjectsCount; ++i) {
if (_triggerObjects[i]._objectId == objectId)
return &_triggerObjects[i];
+ }
return 0;
}
void SceneInfo::fixupSceneInfosDuckman() {
- for (uint i = 0; i < _triggerObjectsCount; ++i)
+ for (uint i = 0; i < _triggerObjectsCount; ++i) {
_triggerObjects[i].fixupSceneInfosDuckman();
+ }
}
// ScriptResource
@@ -290,8 +298,9 @@ void ScriptResource::load(Resource *resource) {
if (resource->_gameId == kGameIdBBDOU) {
sceneInfosOffs = 0x18;
} else if (resource->_gameId == kGameIdDuckman) {
- for (uint i = 0; i < 27; ++i)
+ for (uint i = 0; i < 27; ++i) {
_soundIds[i] = stream.readUint32LE();
+ }
sceneInfosOffs = 0x8C;
}
@@ -326,8 +335,9 @@ void ScriptResource::load(Resource *resource) {
_codeOffsets = new uint32[_codeCount];
stream.seek(codeTblOffs);
- for (uint i = 0; i < _codeCount; ++i)
+ for (uint i = 0; i < _codeCount; ++i) {
_codeOffsets[i] = stream.readUint32LE();
+ }
_sceneInfos = new SceneInfo[_sceneInfosCount];
for (uint i = 0; i < _sceneInfosCount; ++i) {
@@ -378,8 +388,9 @@ uint32 ScriptResource::getObjectActorTypeId(uint32 objectId) {
}
void ScriptResource::fixupSceneInfosDuckman() {
- for (uint i = 0; i < _sceneInfosCount; ++i)
+ for (uint i = 0; i < _sceneInfosCount; ++i) {
_sceneInfos[i].fixupSceneInfosDuckman();
+ }
}
// ScriptInstance
diff --git a/engines/illusions/resources/soundresource.cpp b/engines/illusions/resources/soundresource.cpp
index 5cfa240db6..030a4cc3a9 100644
--- a/engines/illusions/resources/soundresource.cpp
+++ b/engines/illusions/resources/soundresource.cpp
@@ -73,8 +73,9 @@ void SoundGroupResource::load(byte *data, uint32 dataSize) {
debug(1, "_soundEffectsCount: %d; soundEffectsOffs: %08X", _soundEffectsCount, soundEffectsOffs);
_soundEffects = new SoundEffect[_soundEffectsCount];
stream.seek(soundEffectsOffs);
- for (uint i = 0; i < _soundEffectsCount; ++i)
+ for (uint i = 0; i < _soundEffectsCount; ++i) {
_soundEffects[i].load(stream);
+ }
}
diff --git a/engines/illusions/resources/talkresource.cpp b/engines/illusions/resources/talkresource.cpp
index a75c3700f2..4b2f67897d 100644
--- a/engines/illusions/resources/talkresource.cpp
+++ b/engines/illusions/resources/talkresource.cpp
@@ -142,16 +142,18 @@ void TalkInstanceList::removeTalkInstance(TalkInstance *talkInstance) {
}
TalkInstance *TalkInstanceList::findTalkItem(uint32 talkId) {
- for (ItemsIterator it = _items.begin(); it != _items.end(); ++it)
+ for (ItemsIterator it = _items.begin(); it != _items.end(); ++it) {
if ((*it)->_talkId == talkId)
return (*it);
+ }
return 0;
}
TalkInstance *TalkInstanceList::findTalkItemBySceneId(uint32 sceneId) {
- for (ItemsIterator it = _items.begin(); it != _items.end(); ++it)
+ for (ItemsIterator it = _items.begin(); it != _items.end(); ++it) {
if ((*it)->_sceneId == sceneId)
return (*it);
+ }
return 0;
}
diff --git a/engines/illusions/resourcesystem.cpp b/engines/illusions/resourcesystem.cpp
index bf43db7204..d09f4f1af2 100644
--- a/engines/illusions/resourcesystem.cpp
+++ b/engines/illusions/resourcesystem.cpp
@@ -66,8 +66,9 @@ ResourceSystem::ResourceSystem(IllusionsEngine *vm)
ResourceSystem::~ResourceSystem() {
// Delete all registered resource loaders
- for (ResourceLoadersMapIterator it = _resourceLoaders.begin(); it != _resourceLoaders.end(); ++it)
+ for (ResourceLoadersMapIterator it = _resourceLoaders.begin(); it != _resourceLoaders.end(); ++it) {
delete (*it)._value;
+ }
}
void ResourceSystem::addResourceLoader(uint32 resTypeId, BaseResourceLoader *resourceLoader) {
diff --git a/engines/illusions/saveload.cpp b/engines/illusions/saveload.cpp
index cc63b18f90..233771af2a 100644
--- a/engines/illusions/saveload.cpp
+++ b/engines/illusions/saveload.cpp
@@ -39,8 +39,9 @@ IllusionsEngine::kReadSaveHeaderError IllusionsEngine::readSaveHeader(Common::Se
byte descriptionLen = in->readByte();
header.description = "";
- while (descriptionLen--)
+ while (descriptionLen--) {
header.description += (char)in->readByte();
+ }
if (loadThumbnail) {
Graphics::loadThumbnail(*in, header.thumbnail);
diff --git a/engines/illusions/screen.cpp b/engines/illusions/screen.cpp
index b2a970c12c..6a991cd782 100644
--- a/engines/illusions/screen.cpp
+++ b/engines/illusions/screen.cpp
@@ -533,8 +533,9 @@ void Screen8Bit::drawSurface(Common::Rect &dstRect, Graphics::Surface *surface,
}
void Screen8Bit::drawText(FontResource *font, Graphics::Surface *surface, int16 x, int16 y, uint16 *text, uint count) {
- for (uint i = 0; i < count; ++i)
+ for (uint i = 0; i < count; ++i) {
x += font->_widthC + drawChar(font, surface, x, y, *text++);
+ }
}
void Screen8Bit::fillSurface(Graphics::Surface *surface, byte color) {
@@ -553,9 +554,10 @@ int16 Screen8Bit::drawChar(FontResource *font, Graphics::Surface *surface, int16
byte *dst = (byte*)surface->getBasePtr(x, y);
byte *pixels = charInfo->_pixels;
for (int16 yc = 0; yc < font->_charHeight; ++yc) {
- for (int16 xc = 0; xc < charWidth; ++xc)
+ for (int16 xc = 0; xc < charWidth; ++xc) {
if (pixels[xc])
dst[xc] = pixels[xc];
+ }
dst += surface->pitch;
pixels += charWidth;
}
@@ -731,8 +733,9 @@ void Screen16Bit::drawSurface(Common::Rect &dstRect, Graphics::Surface *surface,
}
void Screen16Bit::drawText(FontResource *font, Graphics::Surface *surface, int16 x, int16 y, uint16 *text, uint count) {
- for (uint i = 0; i < count; ++i)
+ for (uint i = 0; i < count; ++i) {
x += font->_widthC + drawChar(font, surface, x, y, *text++);
+ }
}
void Screen16Bit::fillSurface(Graphics::Surface *surface, byte color) {
diff --git a/engines/illusions/screentext.cpp b/engines/illusions/screentext.cpp
index 0f811df08d..206272dd27 100644
--- a/engines/illusions/screentext.cpp
+++ b/engines/illusions/screentext.cpp
@@ -135,8 +135,9 @@ bool ScreenText::insertText(uint16 *text, uint32 fontId, WidthHeight dimensions,
_vm->_screenPalette->setPaletteEntry(font->getColorIndex(), screenText->_info._colorR, screenText->_info._colorG, screenText->_info._colorB);
uint16 *textPart = screenText->_text;
- while (text != outTextPtr)
+ while (text != outTextPtr) {
*textPart++ = *text++;
+ }
*textPart = 0;
updateTextInfoPosition(Common::Point(160, 100));
diff --git a/engines/illusions/scriptstack.cpp b/engines/illusions/scriptstack.cpp
index 36cd3cb8e5..0bad714657 100644
--- a/engines/illusions/scriptstack.cpp
+++ b/engines/illusions/scriptstack.cpp
@@ -32,8 +32,9 @@ ScriptStack::ScriptStack() {
}
void ScriptStack::clear() {
- for (uint i = 0; i < 256; ++i)
+ for (uint i = 0; i < 256; ++i) {
_stack[i] = (int16)0xEEEE;
+ }
_stackPos = 256;
}
diff --git a/engines/illusions/sequenceopcodes.cpp b/engines/illusions/sequenceopcodes.cpp
index f2de9f2b2d..765247137f 100644
--- a/engines/illusions/sequenceopcodes.cpp
+++ b/engines/illusions/sequenceopcodes.cpp
@@ -56,8 +56,9 @@ typedef Common::Functor2Mem<Control*, OpCall&, void, SequenceOpcodes> SequenceOp
void SequenceOpcodes::initOpcodes() {
// First clear everything
- for (uint i = 0; i < 256; ++i)
+ for (uint i = 0; i < 256; ++i) {
_opcodes[i] = 0;
+ }
// Register opcodes
OPCODE(1, opYield);
OPCODE(2, opSetFrameIndex);
@@ -111,8 +112,9 @@ void SequenceOpcodes::initOpcodes() {
#undef OPCODE
void SequenceOpcodes::freeOpcodes() {
- for (uint i = 0; i < 256; ++i)
+ for (uint i = 0; i < 256; ++i) {
delete _opcodes[i];
+ }
}
// Opcodes
diff --git a/engines/illusions/sound.cpp b/engines/illusions/sound.cpp
index aed389a24d..d976069beb 100644
--- a/engines/illusions/sound.cpp
+++ b/engines/illusions/sound.cpp
@@ -356,9 +356,10 @@ void SoundMan::unloadSounds(uint32 soundGroupId) {
}
Sound *SoundMan::getSound(uint32 soundEffectId) {
- for (SoundListIterator it = _sounds.begin(); it != _sounds.end(); ++it)
+ for (SoundListIterator it = _sounds.begin(); it != _sounds.end(); ++it) {
if ((*it)->_soundEffectId == soundEffectId)
return *it;
+ }
return 0;
}
diff --git a/engines/illusions/thread.cpp b/engines/illusions/thread.cpp
index 3c327bab21..afc3a6d2d4 100644
--- a/engines/illusions/thread.cpp
+++ b/engines/illusions/thread.cpp
@@ -152,8 +152,9 @@ void ThreadList::updateThreads() {
it = _threads.erase(it);
} else {
int status = kTSRun;
- while (!thread->_terminated && status != kTSTerminate && status != kTSYield)
+ while (!thread->_terminated && status != kTSTerminate && status != kTSYield) {
status = thread->update();
+ }
++it;
}
}
@@ -165,9 +166,10 @@ void ThreadList::updateThreads() {
}
Thread *ThreadList::findThread(uint32 threadId) {
- for (Iterator it = _threads.begin(); it != _threads.end(); ++it)
+ for (Iterator it = _threads.begin(); it != _threads.end(); ++it) {
if ((*it)->_threadId == threadId && !(*it)->_terminated)
return (*it);
+ }
return 0;
}
diff --git a/engines/illusions/updatefunctions.cpp b/engines/illusions/updatefunctions.cpp
index 7317508249..ae14a0ccab 100644
--- a/engines/illusions/updatefunctions.cpp
+++ b/engines/illusions/updatefunctions.cpp
@@ -35,8 +35,9 @@ UpdateFunctions::UpdateFunctions() {
UpdateFunctions::~UpdateFunctions() {
// Free update functions
- for (UpdateFunctionListIterator it = _updateFunctions.begin(); it != _updateFunctions.end(); ++it)
+ for (UpdateFunctionListIterator it = _updateFunctions.begin(); it != _updateFunctions.end(); ++it) {
delete *it;
+ }
}
void UpdateFunctions::add(int priority, uint32 sceneId, UpdateFunctionCallback *callback) {
@@ -51,8 +52,9 @@ void UpdateFunctions::add(int priority, uint32 sceneId, UpdateFunctionCallback *
void UpdateFunctions::update() {
// Avoid running updates multiple times in the current time slice
- while (_lastTimerUpdateTime == getCurrentTime())
+ while (_lastTimerUpdateTime == getCurrentTime()) {
g_system->delayMillis(10); // CHECKME Timer resolution
+ }
_lastTimerUpdateTime = getCurrentTime();
UpdateFunctionListIterator it = _updateFunctions.begin();
while (it != _updateFunctions.end()) {
@@ -72,9 +74,10 @@ void UpdateFunctions::update() {
}
void UpdateFunctions::terminateByScene(uint32 sceneId) {
- for (UpdateFunctionListIterator it = _updateFunctions.begin(); it != _updateFunctions.end(); ++it)
+ for (UpdateFunctionListIterator it = _updateFunctions.begin(); it != _updateFunctions.end(); ++it) {
if ((*it)->_sceneId == sceneId)
(*it)->terminate();
+ }
}
} // End of namespace Illusions