aboutsummaryrefslogtreecommitdiff
path: root/engines/illusions/bbdou
diff options
context:
space:
mode:
authorEric Fry2018-06-28 22:20:36 +1000
committerEugene Sandulenko2018-07-20 06:43:33 +0000
commitfee1f3d8cb065182322bc80aba39a66a1b4b0cfb (patch)
treef152dd04ca1313d799d6edcc1d20ba5f789b52e0 /engines/illusions/bbdou
parent608f2f1f1ae524fd6ffc656dfcef3985988adaa9 (diff)
downloadscummvm-rg350-fee1f3d8cb065182322bc80aba39a66a1b4b0cfb.tar.gz
scummvm-rg350-fee1f3d8cb065182322bc80aba39a66a1b4b0cfb.tar.bz2
scummvm-rg350-fee1f3d8cb065182322bc80aba39a66a1b4b0cfb.zip
ILLUSIONS: always use braces for loops
Diffstat (limited to 'engines/illusions/bbdou')
-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
6 files changed, 52 insertions, 26 deletions
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