JANITORIAL: Fix formatting

This commit is contained in:
Adrian Frühwirth 2018-04-22 00:49:39 +02:00
parent dd425413b5
commit a20f90cbb7
30 changed files with 89 additions and 92 deletions

View File

@ -166,7 +166,8 @@ void MidiDriver_DMEDIA::send(uint32 b) {
if (mdSend(_midiPort, &event, 1) != 1) {
warning("failed sending MIDI event (dump follows...)");
warning("MIDI Event (len=%u):", event.msglen);
for (int i = 0; i < event.msglen; i++) warning("%02x ", (int)event.msg[i]);
for (int i = 0; i < event.msglen; i++)
warning("%02x ", (int)event.msg[i]);
}
}
@ -186,7 +187,8 @@ void MidiDriver_DMEDIA::sysEx (const byte *msg, uint16 length) {
if (mdSend(_midiPort, &event, 1) != 1) {
fprintf(stderr, "failed sending MIDI SYSEX event (dump follows...)\n");
for (int i = 0; i < event.msglen; i++) warning("%02x ", (int)event.msg[i]);
for (int i = 0; i < event.msglen; i++)
warning("%02x ", (int)event.msg[i]);
}
}

View File

@ -141,7 +141,8 @@ In find_if(In first, In last, Pred p) {
*/
template<class In, class Op>
Op for_each(In first, In last, Op f) {
while (first != last) f(*first++);
while (first != last)
f(*first++);
return f;
}

View File

@ -152,7 +152,7 @@ void Scripts::searchForSequence() {
_data->seek(0);
int sequenceId;
do {
while (_data->readByte() != SCRIPT_START_BYTE);
while (_data->readByte() != SCRIPT_START_BYTE) {}
sequenceId = _data->readUint16LE();
} while (sequenceId != _sequence);
}

View File

@ -350,7 +350,7 @@ void GraphicsMan_v2::fillAt(Common::Point p, const byte pattern) {
const bool stopBit = !_display.getPixelBit(p);
// Move up into the open space above p
while (--p.y >= _bounds.top && canFillAt(p, stopBit));
while (--p.y >= _bounds.top && canFillAt(p, stopBit)) {}
// Then fill by moving down
while (++p.y < _bounds.bottom && canFillAt(p, stopBit))

View File

@ -684,9 +684,9 @@ void DropDownMenu::update() {
Common::Point cursorPos = _vm->getMousePos();
while (!_activeMenuItem._activeNow && (cursorPos.y <= 21) && _vm->_holdLeftMouse) {
_menuBar.chooseMenuItem(cursorPos.x);
do
do {
_vm->updateEvents();
while (_vm->_holdLeftMouse && !_vm->shouldQuit());
} while (_vm->_holdLeftMouse && !_vm->shouldQuit());
while (!_vm->shouldQuit()) {
do {

View File

@ -354,8 +354,7 @@ bool AIScriptGenericWalkerA::prepareWalker() {
} else {
model = Random_Query(0, 5);
}
}
while (model == Global_Variable_Query(kVariableGenericWalkerBModel) || model == Global_Variable_Query(kVariableGenericWalkerCModel));
} while (model == Global_Variable_Query(kVariableGenericWalkerBModel) || model == Global_Variable_Query(kVariableGenericWalkerCModel));
Global_Variable_Set(kVariableGenericWalkerAModel, model);
Game_Flag_Set(kFlagGenericWalkerWaiting);

View File

@ -330,8 +330,7 @@ bool AIScriptGenericWalkerB::prepareWalker() {
} else {
model = Random_Query(0, 5);
}
}
while (model == Global_Variable_Query(kVariableGenericWalkerAModel) || model == Global_Variable_Query(kVariableGenericWalkerCModel));
} while (model == Global_Variable_Query(kVariableGenericWalkerAModel) || model == Global_Variable_Query(kVariableGenericWalkerCModel));
Global_Variable_Set(kVariableGenericWalkerBModel, model);
Game_Flag_Set(kFlagGenericWalkerWaiting);

View File

@ -331,9 +331,8 @@ bool AIScriptGenericWalkerC::prepareWalker() {
} else {
model = Random_Query(0, 5);
}
}
// Here is probably bug in original code, because it not using kVariableGenericWalkerBModel but kVariableGenericWalkerCModel
while (model == Global_Variable_Query(kVariableGenericWalkerAModel) || model == Global_Variable_Query(kVariableGenericWalkerBModel));
} while (model == Global_Variable_Query(kVariableGenericWalkerAModel) || model == Global_Variable_Query(kVariableGenericWalkerBModel));
Global_Variable_Set(kVariableGenericWalkerCModel, model);

View File

@ -490,8 +490,7 @@ void UIScrollBox::draw(Graphics::Surface &surface) {
y2 += kLineHeight;
y += kLineHeight;
++i;
}
while (i < lastLineVisible);
} while (i < lastLineVisible);
}
// draw scroll up button

View File

@ -2321,7 +2321,7 @@ void EdenGame::my_bulle() {
} else if (c >= 0x80 && c < 0x90)
SysBeep(1);
else if (c >= 0x90 && c < 0xA0) {
while (*textPtr++ != 0xFF);
while (*textPtr++ != 0xFF) {}
textPtr--;
} else if (c >= 0xA0 && c < 0xC0)
_globals->_textToken1 = c & 0xF;

View File

@ -102,7 +102,7 @@ void HnmPlayer::waitLoop() {
_nextFrameTime = _expectedFrameTime - _timeDrift;
if (_useSoundSync && _vm->_timerTicks > 1000.0 + _nextFrameTime)
_useSound = false;
while (_vm->_timerTicks < _nextFrameTime) ; // waste time
while (_vm->_timerTicks < _nextFrameTime) {} // waste time
_timeDrift = _vm->_timerTicks - _nextFrameTime;
}

View File

@ -733,9 +733,9 @@ Spell *MenuMan::getSpellFromSymbols(byte *symbols) {
if (*(symbols + 1)) {
int16 bitShiftCount = 24;
int32 curSymbols = 0;
do
do {
curSymbols |= (long)*symbols++ << bitShiftCount;
while (*symbols && ((bitShiftCount -= 8) >= 0));
} while (*symbols && ((bitShiftCount -= 8) >= 0));
Spell *curSpell = SpellsArray;
int16 spellIndex = 25;
while (spellIndex--) {

View File

@ -918,9 +918,9 @@ void ComputerManager::getScoreName() {
char score[16];
sprintf(score, "%d", _breakoutScore);
int scoreLen = 0;
do
do {
++scoreLen;
while (score[scoreLen]);
} while (score[scoreLen]);
for (int i = scoreLen - 1, scorePos = 8; i >= 0; i--) {
_score[scoreLine]._score.setChar(score[i], scorePos--);

View File

@ -448,9 +448,9 @@ void DialogsManager::showInventory() {
_vm->_script->_tempObjectFl = false;
if (_vm->_soundMan->_voiceOffFl) {
do
do {
_vm->_events->refreshScreenAndEvents();
while (!_vm->_globals->_exitId && _vm->_events->getMouseButton() != 1);
} while (!_vm->_globals->_exitId && _vm->_events->getMouseButton() != 1);
_vm->_fontMan->hideText(9);
}
if (_vm->_globals->_exitId) {

View File

@ -281,9 +281,9 @@ void FontManager::box(int idx, int messageId, const Common::String &filename, in
int ptrb = _boxWidth - 4;
for (;;) {
lineSize = curLineSize;
do
do {
curChar = _tempText[tempTextIdx + curLineSize++];
while (curChar != ' ' && curChar != '%');
} while (curChar != ' ' && curChar != '%');
if (curLineSize >= ptrb / _fontFixedWidth) {
if (curChar == '%')
curChar = ' ';

View File

@ -314,9 +314,9 @@ bool HopkinsEngine::runWin95Demo() {
_graphicsMan->loadImage("ENDUK");
_graphicsMan->fadeInLong();
_events->mouseOn();
do
do {
_events->refreshScreenAndEvents();
while (_events->getMouseButton() != 1);
} while (_events->getMouseButton() != 1);
_graphicsMan->fadeOutLong();
restoreSystem();
} else
@ -2047,9 +2047,9 @@ void HopkinsEngine::playUnderwaterBaseCutscene() {
_graphicsMan->fadeInLong();
_objectsMan->enableHidingBehavior();
do
do {
_events->refreshScreenAndEvents();
while (!shouldQuit() && _objectsMan->getBobAnimDataIdx(8) != 22);
} while (!shouldQuit() && _objectsMan->getBobAnimDataIdx(8) != 22);
if (!shouldQuit()) {
_graphicsMan->fadeOutLong();
@ -2092,9 +2092,9 @@ void HopkinsEngine::playEnding() {
_graphicsMan->fadeInLong();
_globals->_eventMode = EVENTMODE_IGNORE;
do
do {
_events->refreshScreenAndEvents();
while (_objectsMan->getBobAnimDataIdx(6) != 54);
} while (_objectsMan->getBobAnimDataIdx(6) != 54);
_globals->_introSpeechOffFl = true;
_talkMan->startAnimatedCharacterDialogue("GM4.PE2");
@ -2104,38 +2104,38 @@ void HopkinsEngine::playEnding() {
_objectsMan->setBobAnimation(9);
_objectsMan->setBobAnimation(7);
do
do {
_events->refreshScreenAndEvents();
while (_objectsMan->getBobAnimDataIdx(7) != 54);
} while (_objectsMan->getBobAnimDataIdx(7) != 54);
_soundMan->playSample(1);
do
do {
_events->refreshScreenAndEvents();
while (_objectsMan->getBobAnimDataIdx(7) != 65);
} while (_objectsMan->getBobAnimDataIdx(7) != 65);
_globals->_introSpeechOffFl = true;
_talkMan->startAnimatedCharacterDialogue("DUELB4.PE2");
_events->mouseOff();
_globals->_disableInventFl = true;
do
do {
_events->refreshScreenAndEvents();
while (_objectsMan->getBobAnimDataIdx(7) != 72);
} while (_objectsMan->getBobAnimDataIdx(7) != 72);
_globals->_introSpeechOffFl = true;
_talkMan->startAnimatedCharacterDialogue("DUELH1.PE2");
do
do {
_events->refreshScreenAndEvents();
while (_objectsMan->getBobAnimDataIdx(7) != 81);
} while (_objectsMan->getBobAnimDataIdx(7) != 81);
_globals->_introSpeechOffFl = true;
_talkMan->startAnimatedCharacterDialogue("DUELB5.PE2");
do
do {
_events->refreshScreenAndEvents();
while (_objectsMan->getBobAnimDataIdx(7) != 120);
} while (_objectsMan->getBobAnimDataIdx(7) != 120);
_objectsMan->stopBobAnimation(7);
if (_globals->_saveData->_data[svGameWonFl] == 1) {
@ -2150,9 +2150,9 @@ void HopkinsEngine::playEnding() {
_events->_rateCounter = 0;
if (!_events->_escKeyFl) {
do
do {
_events->refreshEvents();
while (_events->_rateCounter < 2000 / _globals->_speed && !_events->_escKeyFl);
} while (_events->_rateCounter < 2000 / _globals->_speed && !_events->_escKeyFl);
}
_events->_escKeyFl = false;
_graphicsMan->fadeOutLong();
@ -2184,15 +2184,15 @@ void HopkinsEngine::playEnding() {
_talkMan->startAnimatedCharacterDialogue("GM5.PE2");
_globals->_disableInventFl = true;
do
do {
_events->refreshScreenAndEvents();
while (_objectsMan->getBobAnimDataIdx(8) != 5);
} while (_objectsMan->getBobAnimDataIdx(8) != 5);
_soundMan->directPlayWav("SOUND41.WAV");
do
do {
_events->refreshScreenAndEvents();
while (_objectsMan->getBobAnimDataIdx(8) != 21);
} while (_objectsMan->getBobAnimDataIdx(8) != 21);
_graphicsMan->fadeOutLong();
_graphicsMan->endDisplayBob();

View File

@ -2761,9 +2761,9 @@ void ObjectsManager::handleSpecialGames() {
break;
_vm->_globals->_disableInventFl = true;
do
do {
_vm->_events->refreshScreenAndEvents();
while (getBobAnimDataIdx(8) != 3);
} while (getBobAnimDataIdx(8) != 3);
_vm->_globals->_introSpeechOffFl = true;
_vm->_talkMan->startAnimatedCharacterDialogue("GM3.PE2");
stopBobAnimation(8);

View File

@ -120,9 +120,9 @@ void TalkManager::startAnimatedCharacterDialogue(const Common::String &filename)
if (_vm->_globals->_introSpeechOffFl) {
int idx = 1;
int answer;
do
do {
answer = dialogAnswer(idx++, false);
while (answer != -1);
} while (answer != -1);
}
clearCharacterAnim();
_vm->_globals->_introSpeechOffFl = false;
@ -208,9 +208,9 @@ void TalkManager::startStaticCharacterDialogue(const Common::String &filename) {
if (_vm->_globals->_introSpeechOffFl) {
int idx = 1;
int answer;
do
do {
answer = dialogAnswer(idx++, true);
while (answer != -1);
} while (answer != -1);
}
_characterBuffer = _vm->_globals->freeMemory(_characterBuffer);
@ -879,9 +879,9 @@ void TalkManager::handleForestAnswser(int zone, int verb) {
_vm->_objectsMan->setBobAnimation(6);
_vm->_soundMan->playSample(1);
_vm->_objectsMan->showSpecialActionAnimation(_vm->_objectsMan->_forestSprite, "13,14,15,14,13,12,13,14,15,16,-1,", 4);
do
do {
_vm->_events->refreshScreenAndEvents();
while (_vm->_objectsMan->getBobAnimDataIdx(6) < 12);
} while (_vm->_objectsMan->getBobAnimDataIdx(6) < 12);
_vm->_objectsMan->stopBobAnimation(6);
_vm->_objectsMan->setBobAnimation(8);
@ -927,9 +927,9 @@ void TalkManager::handleForestAnswser(int zone, int verb) {
_vm->_objectsMan->setBobAnimation(5);
_vm->_soundMan->playSample(1);
_vm->_objectsMan->showSpecialActionAnimation(_vm->_objectsMan->_forestSprite, "13,14,15,14,13,12,13,14,15,16,-1,", 4);
do
do {
_vm->_events->refreshScreenAndEvents();
while (_vm->_objectsMan->getBobAnimDataIdx(5) < 12);
} while (_vm->_objectsMan->getBobAnimDataIdx(5) < 12);
_vm->_objectsMan->stopBobAnimation(5);
_vm->_objectsMan->setBobAnimation(7);
switch (_vm->_globals->_screenId) {

View File

@ -1231,8 +1231,7 @@ void LilliputScript::listAllTexts() {
warning("Text 0x%x variant %d : %s", i, j, _vm->_displayStringBuf);
do {
++it;
}
while (_vm->_packedStrings[index + variantCount + it] != 0x5B);
} while (_vm->_packedStrings[index + variantCount + it] != 0x5B);
}
} else {*/
decodePackedText(&_vm->_packedStrings[index + variantCount]);
@ -1259,9 +1258,9 @@ void LilliputScript::startSpeech(int speechId) {
int tmpVal = _vm->_rnd->getRandomNumber(count);
if (tmpVal != 0) {
for (int j = 0; j < tmpVal; j++) {
do
do {
++i;
while (_vm->_packedStrings[index + count + i] != ']');
} while (_vm->_packedStrings[index + count + i] != ']');
++i;
}
}

View File

@ -418,7 +418,7 @@ SciEvent EventManager::getSciEvent(SciEventType mask) {
void EventManager::flushEvents() {
Common::EventManager *em = g_system->getEventManager();
Common::Event event;
while (em->pollEvent(event));
while (em->pollEvent(event)) {}
_events.clear();
}

View File

@ -137,9 +137,9 @@ Common::Error SherlockEngine::run() {
_saves->loadGame(_loadGameSlot);
_loadGameSlot = -1;
} else {
do
do {
showOpening();
while (!shouldQuit() && !_interactiveFl);
} while (!shouldQuit() && !_interactiveFl);
}
while (!shouldQuit()) {

View File

@ -911,7 +911,8 @@ int playMovie(int fileNumber) {
glBindFramebuffer(GL_FRAMEBUFFER, old_fbo);
movieIsPlaying = nothing;
for (int i = 0; i < 10; i++) Wait_Frame();
for (int i = 0; i < 10; i++)
Wait_Frame();
huntKillFreeSound(fileNumber);
if (vpx_codec_destroy(&codec))

View File

@ -876,9 +876,9 @@ void GameManager::telomat(int nr) {
_vm->renderBox(0, 0, 320, 200, kColorDarkBlue);
_vm->renderText(kStringTelomat12, 50, 80, kColorGreen);
_vm->renderText(kStringTelomat13, 50, 91, kColorGreen);
do
do {
edit(input, 50, 105, 30);
while ((_key.keycode != Common::KEYCODE_RETURN) && (_key.keycode != Common::KEYCODE_ESCAPE));
} while ((_key.keycode != Common::KEYCODE_RETURN) && (_key.keycode != Common::KEYCODE_ESCAPE));
if (_key.keycode == Common::KEYCODE_ESCAPE) {
_vm->renderBox(0, 0, 320, 200, kColorBlack);
@ -966,9 +966,9 @@ void GameManager::telomat(int nr) {
_vm->renderBox(0, 0, 320, 200, kColorDarkBlue);
_vm->renderText(kStringTelomat21, 100, 90, kColorGreen);
input = "";
do
do {
edit(input, 100, 105, 30);
while ((_key.keycode != Common::KEYCODE_RETURN) && (_key.keycode != Common::KEYCODE_ESCAPE));
} while ((_key.keycode != Common::KEYCODE_RETURN) && (_key.keycode != Common::KEYCODE_ESCAPE));
if (_key.keycode == Common::KEYCODE_RETURN) {
_vm->renderText(kStringShipSleepCabin9, 100, 120, kColorGreen);

View File

@ -122,8 +122,7 @@ void MultiDeleteObject(OBJECT **pObjList, OBJECT *pMultiObj) {
// next obj in list
pMultiObj = pMultiObj->pSlave;
}
while (pMultiObj != NULL);
} while (pMultiObj != NULL);
}
/**
@ -180,8 +179,7 @@ void MultiVerticalFlip(OBJECT *pFlipObj) {
// next obj in list
pFlipObj = pFlipObj->pSlave;
}
while (pFlipObj != NULL);
} while (pFlipObj != NULL);
}
/**
@ -351,8 +349,7 @@ void MultiSetZPosition(OBJECT *pMultiObj, int newZ) {
// next obj in list
pMultiObj = pMultiObj->pSlave;
}
while (pMultiObj != NULL);
} while (pMultiObj != NULL);
}
/**

View File

@ -94,9 +94,9 @@ int lzo1x_decompress(const byte *in, uint32 in_len, byte *out, uint32 *out_len)
if (t < 4)
goto match_next;
assert(t > 0);
do
do {
*op++ = *ip++;
while (--t > 0);
} while (--t > 0);
goto first_literal_run;
}
@ -116,9 +116,9 @@ int lzo1x_decompress(const byte *in, uint32 in_len, byte *out, uint32 *out_len)
*op++ = *ip++;
*op++ = *ip++;
*op++ = *ip++;
do
do {
*op++ = *ip++;
while (--t > 0);
} while (--t > 0);
first_literal_run:
t = *ip++;
@ -186,9 +186,9 @@ match:
copy_match:
*op++ = *m_pos++;
*op++ = *m_pos++;
do
do {
*op++ = *m_pos++;
while (--t > 0);
} while (--t > 0);
}
match_done:

View File

@ -86,8 +86,7 @@ int32 CharacterFlux::fixFacingForAnimation(int32 originalFacing, int32 animation
}
v5 >>= 1;
v6 <<= 1;
}
while (!facingMask);
} while (!facingMask);
int32 finalFacing = 0;
for (finalFacing = 0; ; ++finalFacing) {

View File

@ -1370,7 +1370,8 @@ int ToucheEngine::getStringWidth(int num) const {
debug("stringwidth: %s", str);
debugN("raw:");
const char *p = str;
while (*p) debugN(" %02X", (unsigned char)*p++);
while (*p)
debugN(" %02X", (unsigned char)*p++);
debugN("\n");
}
return Graphics::getStringWidth16(str);

View File

@ -864,7 +864,7 @@ const byte *ThreadResource::cardPerform(const byte *card) {
if (cardPerform2(card, id)) {
card += subId;
card = cardPerform(card);
while (*card++ != 61);
while (*card++ != 61) {}
} else {
card += subId;
while (*card != 61 && *card != 29)

View File

@ -1202,28 +1202,28 @@ bool Party::giveTake(int takeMode, uint takeVal, int giveMode, uint giveVal, int
_questItems[giveVal - MISC_END]++;
}
if (giveVal < WEAPONS_END || giveVal >= MISC_END) {
for (idx = 0; idx < MAX_TREASURE_ITEMS && !_treasure._weapons[idx].empty(); ++idx);
for (idx = 0; idx < MAX_TREASURE_ITEMS && !_treasure._weapons[idx].empty(); ++idx) {}
if (idx < MAX_TREASURE_ITEMS) {
_treasure._weapons[idx]._id = giveVal;
_treasure._hasItems = true;
return false;
}
} else if (giveVal < ARMOR_END) {
for (idx = 0; idx < MAX_TREASURE_ITEMS && !_treasure._armor[idx].empty(); ++idx);
for (idx = 0; idx < MAX_TREASURE_ITEMS && !_treasure._armor[idx].empty(); ++idx) {}
if (idx < MAX_TREASURE_ITEMS) {
_treasure._armor[idx]._id = giveVal - WEAPONS_END;
_treasure._hasItems = true;
return false;
}
} else if (giveVal < ACCESSORIES_END) {
for (idx = 0; idx < MAX_TREASURE_ITEMS && !_treasure._accessories[idx].empty(); ++idx);
for (idx = 0; idx < MAX_TREASURE_ITEMS && !_treasure._accessories[idx].empty(); ++idx) {}
if (idx < MAX_TREASURE_ITEMS) {
_treasure._accessories[idx]._id = giveVal - ARMOR_END;
_treasure._hasItems = true;
return false;
}
} else {
for (idx = 0; idx < MAX_TREASURE_ITEMS && _treasure._misc[idx]._material; ++idx);
for (idx = 0; idx < MAX_TREASURE_ITEMS && _treasure._misc[idx]._material; ++idx) {}
if (idx < MAX_TREASURE_ITEMS) {
_treasure._accessories[idx]._material = giveVal - ACCESSORIES_END;
_treasure._hasItems = true;
@ -1357,7 +1357,7 @@ bool Party::giveTake(int takeMode, uint takeVal, int giveMode, uint giveVal, int
Character &tempChar = _itemsCharacter;
int idx = -1;
if (scripts._itemType != 0) {
for (idx = 0; idx < 10 && _treasure._misc[idx]._material; ++idx);
for (idx = 0; idx < 10 && _treasure._misc[idx]._material; ++idx) {}
if (idx == 10)
return true;
}
@ -1368,7 +1368,7 @@ bool Party::giveTake(int takeMode, uint takeVal, int giveMode, uint giveVal, int
XeenItem *trItems = _treasure[itemCat];
// Check for a free treasure slot
for (idx = 0; idx < 10 && trItems[idx]._id; ++idx);
for (idx = 0; idx < 10 && trItems[idx]._id; ++idx) {}
if (idx == 10)
return true;

View File

@ -289,7 +289,8 @@ protected:
* @param alpha Alpha intensity of the pixel (0-255)
*/
inline void blendFill(PixelType *first, PixelType *last, PixelType color, uint8 alpha) {
while (first != last) blendPixelPtr(first++, color, alpha);
while (first != last)
blendPixelPtr(first++, color, alpha);
}
inline void blendFillClip(PixelType *first, PixelType *last, PixelType color, uint8 alpha, int realX, int realY) {