From 8301d0dbb19395e2ec4ed29c185dcba6a960fc74 Mon Sep 17 00:00:00 2001 From: Eric Fry Date: Fri, 7 Feb 2020 08:34:58 +1100 Subject: [PATCH] DRAGONS: Compile fixes + formatting --- engines/dragons/actor.cpp | 16 ++++---- engines/dragons/actorresource.cpp | 4 +- engines/dragons/background.cpp | 22 +++++------ engines/dragons/bag.cpp | 4 +- engines/dragons/bigfile.cpp | 2 +- engines/dragons/credits.cpp | 2 +- engines/dragons/cursor.cpp | 6 +-- engines/dragons/cutscene.cpp | 6 +-- engines/dragons/dragonflg.cpp | 4 +- engines/dragons/dragonimg.cpp | 2 +- engines/dragons/dragonini.cpp | 2 +- engines/dragons/dragonrms.cpp | 2 +- engines/dragons/dragons.cpp | 58 ++++++++++++++--------------- engines/dragons/font.cpp | 2 +- engines/dragons/inventory.cpp | 8 ++-- engines/dragons/minigame1.cpp | 2 +- engines/dragons/minigame2.cpp | 2 +- engines/dragons/minigame3.cpp | 2 +- engines/dragons/minigame4.cpp | 2 +- engines/dragons/minigame5.cpp | 4 +- engines/dragons/scene.cpp | 12 +++--- engines/dragons/scriptopcodes.cpp | 8 ++-- engines/dragons/sequenceopcodes.cpp | 2 +- engines/dragons/sound.cpp | 2 +- engines/dragons/talk.cpp | 6 +-- 25 files changed, 91 insertions(+), 91 deletions(-) diff --git a/engines/dragons/actor.cpp b/engines/dragons/actor.cpp index 505ffd02b71..75c0bcf8fb9 100644 --- a/engines/dragons/actor.cpp +++ b/engines/dragons/actor.cpp @@ -41,7 +41,7 @@ ActorManager::ActorManager(ActorResourceLoader *actorResourceLoader) : _actorRes Actor *ActorManager::loadActor(uint32 resourceId, uint32 sequenceId, int16 x, int16 y, uint16 priorityLayer) { Actor *actor = loadActor(resourceId, sequenceId, x, y); - if(actor) { + if (actor) { actor->priorityLayer = priorityLayer; } return actor; @@ -82,7 +82,7 @@ Actor *ActorManager::getActor(uint16 actorId) { void ActorManager::clearActorFlags(uint16 startingActorId) { assert(startingActorId < DRAGONS_ENGINE_NUM_ACTORS); - for(uint16 i = startingActorId; i < DRAGONS_ENGINE_NUM_ACTORS; i++) { + for (uint16 i = startingActorId; i < DRAGONS_ENGINE_NUM_ACTORS; i++) { _actors[i]._flags = 0; } } @@ -100,7 +100,7 @@ ActorResource *ActorManager::getActorResource(uint32 resourceId) { void ActorManager::updateActorDisplayOrder() { bool shouldContinue = true; - while(shouldContinue) { + while (shouldContinue) { shouldContinue = false; for (int i = 0; i < DRAGONS_ENGINE_NUM_ACTORS - 1; i++) { Actor *curActor = getActor(_displayOrder[i]); @@ -482,7 +482,7 @@ void Actor::stopWalk() { } void Actor::waitUntilFlag4IsSet() { - while(!isFlagSet(ACTOR_FLAG_4)) { + while (!isFlagSet(ACTOR_FLAG_4)) { getEngine()->waitForFrames(1); } } @@ -492,7 +492,7 @@ void Actor::waitUntilFlag8IsSet() { return; } - while(!(_flags & Dragons::ACTOR_FLAG_8)) { + while (!(_flags & Dragons::ACTOR_FLAG_8)) { getEngine()->waitForFrames(1); } } @@ -586,7 +586,7 @@ uint16 Actor::canWalkLine(int16 actor_x, int16 actor_y, int16 target_x, int16 ta // 0x80034d28 int32 x = actor_x << 0x10; int32 y = actor_y << 0x10; - for(;;) { + for (;;) { if ((x+0x8000) >> 0x10 == target_x && (y+0x8000) >> 0x10 == target_y) { return 1; } @@ -728,7 +728,7 @@ int Actor::startMoveToPoint(int destX, int destY) { } // 0x8001bcc8 int direction = startMoveToPoint(_walkDestX, _walkDestY); - if(direction != -1 && !isFlagSet(ACTOR_FLAG_800)) { + if (direction != -1 && !isFlagSet(ACTOR_FLAG_800)) { _sequenceID2 = direction; } if (_sequenceID != _sequenceID2 + 8 && _sequenceID2 != -1 && !isFlagSet(ACTOR_FLAG_800)) { @@ -767,7 +767,7 @@ bool Actor::actorSetSequenceAndWaitAllowSkip(uint16 newSequenceID) { } bool Actor::waitUntilFlag4IsSetAllowSkip() { - while(!isFlagSet(ACTOR_FLAG_4)) { + while (!isFlagSet(ACTOR_FLAG_4)) { getEngine()->waitForFrames(1); if (getEngine()->checkForActionButtonRelease()) { return true; diff --git a/engines/dragons/actorresource.cpp b/engines/dragons/actorresource.cpp index b778230c579..2346020143d 100644 --- a/engines/dragons/actorresource.cpp +++ b/engines/dragons/actorresource.cpp @@ -110,7 +110,7 @@ Graphics::Surface *ActorResource::loadFrame(ActorFrame &actorFrame, byte *palett byte *data = actorFrame.frameDataOffset; - while(blockSize > 0) { + while (blockSize > 0) { int32 size = READ_BE_INT32(data); data += 4; if (size >= 0) { @@ -131,7 +131,7 @@ Graphics::Surface *ActorResource::loadFrame(ActorFrame &actorFrame, byte *palett } blockSize -= size; if (size != 0) { - for(int32 i = size; i != 0; i--) { + for (int32 i = size; i != 0; i--) { memcpy(pixels, data, 4); pixels += 4; } diff --git a/engines/dragons/background.cpp b/engines/dragons/background.cpp index f87649448ee..ee423115bdd 100644 --- a/engines/dragons/background.cpp +++ b/engines/dragons/background.cpp @@ -97,7 +97,7 @@ Background::Background() : _priorityLayer(0), _points2(0), _data(0) { } Background::~Background() { - if(_data) { + if (_data) { delete _data; } @@ -125,7 +125,7 @@ bool Background::load(byte *dataStart, uint32 size) { stream.seek(0x308); uint32 tilemapOffset = 0x324; - for(int i=0;i< 3;i++) { + for (int i=0;i< 3;i++) { _tileMap[i].w = stream.readUint16LE(); _tileMap[i].h = stream.readUint16LE(); _tileMap[i].size = stream.readUint32LE(); @@ -156,7 +156,7 @@ bool Background::load(byte *dataStart, uint32 size) { debug("Tiles: %X", tilesOffset); debug("tileIndexOffset: %d", _tileMap[0].tileIndexOffset); - for(int i = 0; i < 3; i++) { + for (int i = 0; i < 3; i++) { _layerSurface[i] = initGfxLayer(_tileMap[i]); loadGfxLayer(_layerSurface[i], _tileMap[i], _tileDataOffset); } @@ -186,8 +186,8 @@ Graphics::Surface *Background::initGfxLayer(TileMap &tileMap) { } void Background::loadGfxLayer(Graphics::Surface *surface, TileMap &tileMap, byte *tiles) { - for(int y = 0; y < tileMap.h; y++) { - for(int x = 0; x < tileMap.w; x++) { + for (int y = 0; y < tileMap.h; y++) { + for (int x = 0; x < tileMap.w; x++) { uint16 idx = READ_LE_UINT16(&tileMap.map[(y * tileMap.w + x) * 2]) + tileMap.tileIndexOffset; //debug("tileIdx: %d", idx); drawTileToSurface(surface, _palette, tiles + idx * 0x100, x * TILE_WIDTH, y * TILE_HEIGHT); @@ -198,8 +198,8 @@ void Background::loadGfxLayer(Graphics::Surface *surface, TileMap &tileMap, byte void drawTileToSurface(Graphics::Surface *surface, byte *palette, byte *tile, uint32 x, uint32 y) { byte *pixels = (byte *)surface->getPixels(); if (surface->format.bpp() == 16) { - for(int ty = 0; ty < TILE_HEIGHT; ty++) { - for(int tx = 0; tx < TILE_WIDTH; tx++) { + for (int ty = 0; ty < TILE_HEIGHT; ty++) { + for (int tx = 0; tx < TILE_WIDTH; tx++) { uint32 cidx = *tile; uint32 offset = (y + ty) * surface->pitch + (x + tx) * 2; pixels[offset] = palette[cidx * 2]; @@ -239,8 +239,8 @@ int16 Background::getPriorityAtPoint(Common::Point pos) { } void Background::overlayImage(uint16 layerNum, byte *data, int16 x, int16 y, int16 w, int16 h) { - for(int i = 0; i < h; i++ ) { - for(int j = 0; j < w; j++ ) { + for (int i = 0; i < h; i++ ) { + for (int j = 0; j < w; j++ ) { int16 idx = READ_LE_UINT16(data) + _tileMap[layerNum].tileIndexOffset; drawTileToSurface(_layerSurface[layerNum], _palette, @@ -255,8 +255,8 @@ void Background::overlayImage(uint16 layerNum, byte *data, int16 x, int16 y, int void Background::restoreTiles(uint16 layerNum, int16 x, int16 y, int16 w, int16 h) { int16 tmw = x + w; int16 tmh = y + h; - for(int y = 0; y < tmh; y++) { - for(int x = 0; x < tmw; x++) { + for (int y = 0; y < tmh; y++) { + for (int x = 0; x < tmw; x++) { uint16 idx = READ_LE_UINT16(&_tileMap[layerNum].map[(y * _tileMap[layerNum].w + x) * 2]) + _tileMap[layerNum].tileIndexOffset; //debug("tileIdx: %d", idx); drawTileToSurface(_layerSurface[layerNum], _palette, _tileDataOffset + idx * 0x100, x * TILE_WIDTH, y * TILE_HEIGHT); diff --git a/engines/dragons/bag.cpp b/engines/dragons/bag.cpp index 3b79568b1b5..c548a52d96e 100644 --- a/engines/dragons/bag.cpp +++ b/engines/dragons/bag.cpp @@ -87,8 +87,8 @@ void Bag::load(BigfileArchive *bigFileArchive) { Graphics::PixelFormat pixelFormat16(2, 5, 5, 5, 1, 10, 5, 0, 15); //TODO move this to a better location. _surface->create(320, 200, pixelFormat16); - for(int y = 0; y < TILEMAP_HEIGHT; y++) { - for(int x = 0; x < TILEMAP_WIDTH; x++) { + for (int y = 0; y < TILEMAP_HEIGHT; y++) { + for (int x = 0; x < TILEMAP_WIDTH; x++) { uint16 idx = READ_LE_UINT16(&tilemap[(y * TILEMAP_WIDTH + x) * 2]); //debug("tileIdx: %d", idx); drawTileToSurface(_surface, pal, tiles + idx * 0x100, x * 32, y * 8); diff --git a/engines/dragons/bigfile.cpp b/engines/dragons/bigfile.cpp index 03b9e5cdd05..c012d7d1389 100644 --- a/engines/dragons/bigfile.cpp +++ b/engines/dragons/bigfile.cpp @@ -610,7 +610,7 @@ FileInfo fileInfo[TOTAL_FILES] = { }; uint32 getResourceId(const char *filename) { - for(uint32 i=0; i < TOTAL_FILES; i++) { + for (uint32 i=0; i < TOTAL_FILES; i++) { if (scumm_stricmp(fileInfo[i].filename, filename) == 0) { return i; } diff --git a/engines/dragons/credits.cpp b/engines/dragons/credits.cpp index 19f28ef986f..87c05c303e9 100644 --- a/engines/dragons/credits.cpp +++ b/engines/dragons/credits.cpp @@ -57,7 +57,7 @@ bool Credits::isRunning() { } void Credits::draw() { - if(_running) { + if (_running) { _vm->_screen->copyRectToSurface8bppWrappedY(*_surface, _vm->_screen->getPalette(2), _yOffset); } } diff --git a/engines/dragons/cursor.cpp b/engines/dragons/cursor.cpp index 20f87966423..33e40d7afb3 100644 --- a/engines/dragons/cursor.cpp +++ b/engines/dragons/cursor.cpp @@ -205,7 +205,7 @@ int16 Cursor::updateIniFromScene() { int16 cursorTileY = cursorY / 8; int16 data_80072890_orig = data_80072890; int16 data_800728b0_cursor_seqID_orig = data_800728b0_cursor_seqID; - for(int i=0;i <_vm->_dragonINIResource->totalRecords(); i++) { + for (int i=0;i <_vm->_dragonINIResource->totalRecords(); i++) { DragonINI *ini = _vm->_dragonINIResource->getRecord(i); if (ini->sceneId != _vm->_scene->getSceneId()) { // 0x80028be4 @@ -246,7 +246,7 @@ int16 Cursor::updateIniFromScene() { if (ini->field_1a_flags_maybe & 0x800) { data_80072890 = cursorOverIni; uint32 newSeqId = 1; - for(int idx=0; idx < 5; idx++) { + for (int idx=0; idx < 5; idx++) { data_800728b0_cursor_seqID = idx; byte *obd = _vm->_dragonOBD->getFromOpt(cursorOverIni - 1); //_dragonRMS->getObdDataFieldC(sceneId); ScriptOpCall scriptOpCall(obd + 8, READ_LE_UINT32(obd)); @@ -281,7 +281,7 @@ int16 Cursor::updateIniFromScene() { // local_48 = dragon_Obd_Offset + *(int *)(uVar16 * 8 + dragon_Opt_Offset + -8) + 8; // local_44 = read_int32(); // local_44 = local_44 + local_48; - if(executeScript(scriptOpCall, 0)) { + if (executeScript(scriptOpCall, 0)) { _iniUnderCursor = cursorOverIni; data_80072890 = data_80072890_orig; data_800728b0_cursor_seqID = data_800728b0_cursor_seqID_orig; diff --git a/engines/dragons/cutscene.cpp b/engines/dragons/cutscene.cpp index 737d5fe3258..1649740cc96 100644 --- a/engines/dragons/cutscene.cpp +++ b/engines/dragons/cutscene.cpp @@ -641,7 +641,7 @@ void CutScene::knightsSavedBackAtCastle() { //DisableVSyncEvent(); // file_read_to_buffer(s_cursor.act_80011c44,actor_dictionary); //EnableVSyncEvent(); - if(isFlag0x10Set) { + if (isFlag0x10Set) { _vm->setFlags(ENGINE_FLAG_10); } _vm->clearFlags(ENGINE_FLAG_20000); @@ -731,7 +731,7 @@ void CutScene::flameReturnsCutScene() { // file_read_to_buffer(s_cursor.act_80011c44,actor_dictionary); // EnableVSyncEvent(); _vm->clearFlags(ENGINE_FLAG_20000); - if(engineFlag10Set) { + if (engineFlag10Set) { _vm->setFlags(ENGINE_FLAG_10); } _vm->_dragonINIResource->setFlickerRecord(uVar1); @@ -811,7 +811,7 @@ void CutScene::knightsSavedAgain() { // file_read_to_buffer(s_cursor.act_80011c44,actor_dictionary); // EnableVSyncEvent(); _vm->clearFlags(ENGINE_FLAG_20000); - if(engineFlag10Set) { + if (engineFlag10Set) { _vm->setFlags(ENGINE_FLAG_10); } _vm->_dragonINIResource->setFlickerRecord(flicker); diff --git a/engines/dragons/dragonflg.cpp b/engines/dragons/dragonflg.cpp index 3e12b9beecc..ddc6f12a6ef 100644 --- a/engines/dragons/dragonflg.cpp +++ b/engines/dragons/dragonflg.cpp @@ -31,7 +31,7 @@ namespace Dragons { Properties::Properties(uint count) : _count(count) { _properties = (byte *)malloc(getSize()); - if(!_properties) { + if (!_properties) { error("Failed to allocate mem for properties"); } memset(_properties, 0, getSize()); @@ -89,7 +89,7 @@ void Properties::save(uint numberToWrite, Common::WriteStream *out) { void Properties::print(char *prefix) { char *str = new char[_count + 1]; int i = 0; - for(; i < _count; i++) { + for (; i < _count; i++) { str[i] = get(i) ? '1' : '0'; } str[i] = 0; diff --git a/engines/dragons/dragonimg.cpp b/engines/dragons/dragonimg.cpp index 3fa1fc405e8..5c919728304 100644 --- a/engines/dragons/dragonimg.cpp +++ b/engines/dragons/dragonimg.cpp @@ -38,7 +38,7 @@ DragonIMG::DragonIMG(BigfileArchive *bigfileArchive) { _imgObjects = new IMG[_count]; - for(int i=0; i < _count; i++) { + for (int i=0; i < _count; i++) { imgReadStream->seek(iptReadStream->readUint32LE()); _imgObjects[i].x = imgReadStream->readUint16LE(); _imgObjects[i].y = imgReadStream->readUint16LE(); diff --git a/engines/dragons/dragonini.cpp b/engines/dragons/dragonini.cpp index 9fd43f23972..10a8888de17 100644 --- a/engines/dragons/dragonini.cpp +++ b/engines/dragons/dragonini.cpp @@ -40,7 +40,7 @@ void DragonINIResource::reset() { _dragonINI = new DragonINI[_count]; } - for(int i=0; i < _count; i++) { + for (int i=0; i < _count; i++) { _dragonINI[i].id = (uint16)i; _dragonINI[i].iptIndex_maybe = readStream->readSint16LE(); _dragonINI[i].field_2 = readStream->readSint16LE(); diff --git a/engines/dragons/dragonrms.cpp b/engines/dragons/dragonrms.cpp index d6ffb29c3ff..12bcdc7dc26 100644 --- a/engines/dragons/dragonrms.cpp +++ b/engines/dragons/dragonrms.cpp @@ -37,7 +37,7 @@ DragonRMS::DragonRMS(BigfileArchive *bigfileArchive, DragonOBD *dragonOBD) : _dr _rmsObjects = new RMS[_count]; - for(int i=0; i < _count; i++) { + for (int i=0; i < _count; i++) { _rmsObjects[i]._field0 = readStream->readSint32LE(); readStream->read(_rmsObjects[i]._sceneName, 4); _rmsObjects[i]._obdOffset = readStream->readSint32LE(); diff --git a/engines/dragons/dragons.cpp b/engines/dragons/dragons.cpp index 75c64232441..2b8af2e45cf 100644 --- a/engines/dragons/dragons.cpp +++ b/engines/dragons/dragons.cpp @@ -133,53 +133,53 @@ void DragonsEngine::updateEvents() { _rightMouseButtonUp = true; break; case Common::EVENT_KEYUP: - if (event.kbd.keycode == Common::KeyCode::KEYCODE_i) { + if (event.kbd.keycode == Common::KEYCODE_i) { _iKeyUp = true; - } else if (event.kbd.keycode == Common::KeyCode::KEYCODE_DOWN) { + } else if (event.kbd.keycode == Common::KEYCODE_DOWN) { _downKeyUp = true; - } else if (event.kbd.keycode == Common::KeyCode::KEYCODE_UP) { + } else if (event.kbd.keycode == Common::KEYCODE_UP) { _upKeyUp = true; - } else if (event.kbd.keycode == Common::KeyCode::KEYCODE_RETURN || - event.kbd.keycode == Common::KeyCode::KEYCODE_KP_ENTER) { + } else if (event.kbd.keycode == Common::KEYCODE_RETURN || + event.kbd.keycode == Common::KEYCODE_KP_ENTER) { _enterKeyUp = true; - } else if (event.kbd.keycode == Common::KeyCode::KEYCODE_LEFT) { + } else if (event.kbd.keycode == Common::KEYCODE_LEFT) { _leftKeyUp = true; _leftKeyDown = false; - } else if (event.kbd.keycode == Common::KeyCode::KEYCODE_RIGHT) { + } else if (event.kbd.keycode == Common::KEYCODE_RIGHT) { _rightKeyUp = true; _rightKeyDown = false; - } else if (event.kbd.keycode == Common::KeyCode::KEYCODE_w) { + } else if (event.kbd.keycode == Common::KEYCODE_w) { _wKeyDown = false; - } else if (event.kbd.keycode == Common::KeyCode::KEYCODE_a) { + } else if (event.kbd.keycode == Common::KEYCODE_a) { _aKeyDown = false; - } else if (event.kbd.keycode == Common::KeyCode::KEYCODE_s) { + } else if (event.kbd.keycode == Common::KEYCODE_s) { _sKeyDown = false; - } else if (event.kbd.keycode == Common::KeyCode::KEYCODE_d) { + } else if (event.kbd.keycode == Common::KEYCODE_d) { _dKeyDown = false; - } else if (event.kbd.keycode == Common::KeyCode::KEYCODE_o) { + } else if (event.kbd.keycode == Common::KEYCODE_o) { _oKeyDown = false; - } else if (event.kbd.keycode == Common::KeyCode::KEYCODE_p) { + } else if (event.kbd.keycode == Common::KEYCODE_p) { _pKeyDown = false; } break; case Common::EVENT_KEYDOWN: - if (event.kbd.keycode == Common::KeyCode::KEYCODE_LEFT) { + if (event.kbd.keycode == Common::KEYCODE_LEFT) { _leftKeyDown = true; - } else if (event.kbd.keycode == Common::KeyCode::KEYCODE_RIGHT) { + } else if (event.kbd.keycode == Common::KEYCODE_RIGHT) { _rightKeyDown = true; - } else if (event.kbd.keycode == Common::KeyCode::KEYCODE_w) { + } else if (event.kbd.keycode == Common::KEYCODE_w) { _wKeyDown = true; - } else if (event.kbd.keycode == Common::KeyCode::KEYCODE_a) { + } else if (event.kbd.keycode == Common::KEYCODE_a) { _aKeyDown = true; - } else if (event.kbd.keycode == Common::KeyCode::KEYCODE_s) { + } else if (event.kbd.keycode == Common::KEYCODE_s) { _sKeyDown = true; - } else if (event.kbd.keycode == Common::KeyCode::KEYCODE_d) { + } else if (event.kbd.keycode == Common::KEYCODE_d) { _dKeyDown = true; - } else if (event.kbd.keycode == Common::KeyCode::KEYCODE_o) { + } else if (event.kbd.keycode == Common::KEYCODE_o) { _oKeyDown = true; - } else if (event.kbd.keycode == Common::KeyCode::KEYCODE_p) { + } else if (event.kbd.keycode == Common::KEYCODE_p) { _pKeyDown = true; - } else if (event.kbd.keycode == Common::KeyCode::KEYCODE_TAB) { + } else if (event.kbd.keycode == Common::KEYCODE_TAB) { _debugMode = !_debugMode; } break; @@ -191,7 +191,7 @@ void DragonsEngine::updateEvents() { Common::Error DragonsEngine::run() { _screen = new Screen(); - _bigfileArchive = new BigfileArchive("bigfile.dat", Common::Language::EN_ANY); + _bigfileArchive = new BigfileArchive("bigfile.dat", Common::EN_ANY); _talk = new Talk(this, _bigfileArchive); _dragonFLG = new DragonFLG(_bigfileArchive); _dragonIMG = new DragonIMG(_bigfileArchive); @@ -245,7 +245,7 @@ uint16 DragonsEngine::ipt_img_file_related() int16 tileX = flicker->actor->x_pos / 32; int16 tileY = flicker->actor->y_pos / 8; - for(int i=0;i < _dragonINIResource->totalRecords(); i++) { + for (int i=0;i < _dragonINIResource->totalRecords(); i++) { ini = getINI(i); if ((ini->sceneId == getCurrentSceneId()) && (ini->field_1a_flags_maybe == 0)) { IMG *img = _dragonIMG->getIMG(ini->field_2); @@ -273,7 +273,7 @@ void DragonsEngine::gameLoop() setFlags(ENGINE_FLAG_8); actorId = 0; - while(!shouldQuit()) { + while (!shouldQuit()) { _scene->draw(); _screen->updateScreen(); wait(); @@ -318,7 +318,7 @@ void DragonsEngine::gameLoop() byte *obd = _dragonOBD->getFromOpt(actorId_00 - 1); ScriptOpCall scriptOpCall(obd + 8, READ_LE_UINT32(obd)); - if(_scriptOpcodes->runScript4(scriptOpCall)) { + if (_scriptOpcodes->runScript4(scriptOpCall)) { scriptOpCall._codeEnd = scriptOpCall._code + 4 + READ_LE_UINT16(scriptOpCall._code + 2); scriptOpCall._code += 4; _scriptOpcodes->runScript(scriptOpCall); @@ -444,7 +444,7 @@ void DragonsEngine::gameLoop() } } else { - if(_inventory->addItem(_cursor->iniItemInHand)) { + if (_inventory->addItem(_cursor->iniItemInHand)) { _cursor->_sequenceID = 1; waitForFrames(1); _cursor->iniItemInHand = 0; @@ -1273,7 +1273,7 @@ void DragonsEngine::loadScene(uint16 sceneId) { _inventory->loadInventoryItemsFromSave(); - if(getINI(0)->sceneId == 0) { + if (getINI(0)->sceneId == 0) { getINI(0)->sceneId = sceneId; //TODO } else { _scene->setSceneId(getINI(0)->sceneId); @@ -1291,7 +1291,7 @@ void DragonsEngine::reset() { videoFlags = 0; data_800633fa = 0; - for(int i = 0; i < 8; i++) { + for (int i = 0; i < 8; i++) { _paletteCyclingTbl[i].paletteType = 0; _paletteCyclingTbl[i].startOffset = 0; _paletteCyclingTbl[i].endOffset = 0; diff --git a/engines/dragons/font.cpp b/engines/dragons/font.cpp index d612089f673..6f4cb30a6ea 100644 --- a/engines/dragons/font.cpp +++ b/engines/dragons/font.cpp @@ -205,7 +205,7 @@ void FontManager::updatePalette() { // if (( != 0 && ((engine_flags_maybe & 0x200) != 0))) { uint16 *palette_f2_font_maybe = (uint16 *)_screen->getPalette(2); uint16 cursor3 = 0x14a5 | 0x8000; - if(_vm->isFlagSet(ENGINE_FLAG_200)) { + if (_vm->isFlagSet(ENGINE_FLAG_200)) { if (!_vm->isUnkFlagSet(ENGINE_UNK1_FLAG_1)) { updatePalEntry(palette_f2_font_maybe, 16, cursor3); } else { diff --git a/engines/dragons/inventory.cpp b/engines/dragons/inventory.cpp index ec42bcae70a..537a472b4fe 100644 --- a/engines/dragons/inventory.cpp +++ b/engines/dragons/inventory.cpp @@ -90,7 +90,7 @@ void Inventory::init(ActorManager *actorManager, BackgroundResourceLoader *backg _old_showing_value = 0; _bag = bag; - for(int i = 0; i < DRAGONS_MAX_INVENTORY_ITEMS; i++) { + for (int i = 0; i < DRAGONS_MAX_INVENTORY_ITEMS; i++) { actorManager->loadActor(0, i + ACTOR_INVENTORY_OFFSET); // TODO need to share resource between inventory item actors. } @@ -166,7 +166,7 @@ void Inventory::openInventory() { //TODO 0x800310e0 update cursor position. - for(int i = 0; i < DRAGONS_MAX_INVENTORY_ITEMS; i++) { + for (int i = 0; i < DRAGONS_MAX_INVENTORY_ITEMS; i++) { Actor *item = _vm->_actorManager->getActor(i + ACTOR_INVENTORY_OFFSET); item->x_pos = item->_walkDestX = invXPosTable[i] + 0x10; @@ -252,7 +252,7 @@ void Inventory::closeInventory() { } void Inventory::draw() { - if(_bag) { + if (_bag) { _bag->draw(); } } @@ -390,7 +390,7 @@ bool Inventory::addItemIfPositionIsEmpty(uint16 iniId, uint16 x, uint16 y) { bool Inventory::clearItem(uint16 iniId) { for (int i = 0; i < DRAGONS_MAX_INVENTORY_ITEMS; i++) { - if(inventoryItemTbl[i] == iniId) { + if (inventoryItemTbl[i] == iniId) { inventoryItemTbl[i] = 0; } } diff --git a/engines/dragons/minigame1.cpp b/engines/dragons/minigame1.cpp index 6e467753b44..ce37357d104 100644 --- a/engines/dragons/minigame1.cpp +++ b/engines/dragons/minigame1.cpp @@ -886,7 +886,7 @@ void Minigame1::run() { _vm->getINI(DAT_80063a40 - 1)->actor->clearFlag(ACTOR_FLAG_100); break; } - } while( true ); + } while ( true ); //TODO callMaybeResetData(); flickerActor->updateSequence(0x15); diff --git a/engines/dragons/minigame2.cpp b/engines/dragons/minigame2.cpp index f489c67e00a..40a929f39a5 100644 --- a/engines/dragons/minigame2.cpp +++ b/engines/dragons/minigame2.cpp @@ -765,7 +765,7 @@ void Minigame2::run(int16 param_1, uint16 param_2, int16 param_3) { } } - } while( true ); + } while ( true ); } diff --git a/engines/dragons/minigame3.cpp b/engines/dragons/minigame3.cpp index f874013739b..6bf3e8db55e 100644 --- a/engines/dragons/minigame3.cpp +++ b/engines/dragons/minigame3.cpp @@ -351,7 +351,7 @@ void Minigame3::run() { tearBlinkActorTbl[0]->updateSequence(0); tearBlinkActorTbl[1]->updateSequence(1); local_1c2 = 0; - while( true ) { + while ( true ) { _vm->waitForFrames(1); switch(currentState) { case 1: diff --git a/engines/dragons/minigame4.cpp b/engines/dragons/minigame4.cpp index 2855ea8c347..1ee2cac6c72 100644 --- a/engines/dragons/minigame4.cpp +++ b/engines/dragons/minigame4.cpp @@ -198,7 +198,7 @@ uint16 Minigame4::runDanceBattle() { resetActors(); actorTalk(bruteActor,0x3321, 0x4B6A); currentStep = 0; - while( true ) { + while ( true ) { if (0x11 < currentStep) { _vm->_talk->loadText(0x4C0C, auStack2192, 1000); _vm->_talk->displayDialogAroundPoint(auStack2192, 0x27,0xc,0x3321,0,0x4C0C); diff --git a/engines/dragons/minigame5.cpp b/engines/dragons/minigame5.cpp index 88c37dcaed7..f52b1508bf5 100644 --- a/engines/dragons/minigame5.cpp +++ b/engines/dragons/minigame5.cpp @@ -166,8 +166,8 @@ void Minigame5::run() { currentState = 1; local_66 = 0; local_50 = 0; - while( true ) { - while( true ) { + while ( true ) { + while ( true ) { do { _vm->waitForFrames(1); if ((uint)currentState - 1 < 8) { diff --git a/engines/dragons/scene.cpp b/engines/dragons/scene.cpp index 993060d9293..ea8d6296a3e 100644 --- a/engines/dragons/scene.cpp +++ b/engines/dragons/scene.cpp @@ -87,7 +87,7 @@ void Scene::loadSceneData(uint32 sceneId, uint32 cameraPointId) { _vm->setUnkFlags(Dragons::ENGINE_UNK1_FLAG_2 | Dragons::ENGINE_UNK1_FLAG_8); - for(int i=0;i < _dragonINIResource->totalRecords(); i++) { + for (int i=0;i < _dragonINIResource->totalRecords(); i++) { DragonINI *ini = _dragonINIResource->getRecord(i); ini->field_10 = -1; ini->field_1a_flags_maybe &= ~Dragons::INI_FLAG_10; @@ -157,7 +157,7 @@ void Scene::loadSceneData(uint32 sceneId, uint32 cameraPointId) { stagePalette[i * 2 + 1] = cursorPalette[(i-0xc0) * 2 + 1]; } } - for(int i = 1; i < 0x100; i ++) { + for (int i = 1; i < 0x100; i ++) { byte *stagePalette = _stage->getPalette(); uint16 c = READ_LE_INT16(stagePalette + i * 2); if ((c & 0x7fff) == 0) { @@ -166,7 +166,7 @@ void Scene::loadSceneData(uint32 sceneId, uint32 cameraPointId) { } _screen->loadPalette(0, _stage->getPalette()); - for(int i = 1; i < 0x100; i ++) { + for (int i = 1; i < 0x100; i ++) { byte *stagePalette = _stage->getPalette(); uint16 c = READ_LE_INT16(stagePalette + i * 2); if ((c & 0x7fff) == 0) { @@ -219,7 +219,7 @@ void Scene::loadSceneData(uint32 sceneId, uint32 cameraPointId) { _vm->data_800633fc = 0; // TODO 0x8002fff0 - for(int i=0;i < _dragonINIResource->totalRecords(); i++) { + for (int i=0;i < _dragonINIResource->totalRecords(); i++) { DragonINI *ini = _dragonINIResource->getRecord(i); if (ini->sceneId == sceneIdStripped) { if (ini->field_1a_flags_maybe & 1) { @@ -339,7 +339,7 @@ void Scene::draw() { Common::Rect rect(_camera.x, _camera.y, _camera.x + 320, _camera.y + 200); _vm->_screen->clearScreen(); - for(uint16 priority = 1; priority < 16; priority++) { + for (uint16 priority = 1; priority < 16; priority++) { if (priority == 7 && _vm->isFlagSet(ENGINE_FLAG_200)) { _vm->_fontManager->updatePalette(); } @@ -483,7 +483,7 @@ void Scene::drawActorNumber(int16 x, int16 y, uint16 actorId) { sprintf(text8, "%d", actorId); - for(int i = 0; i < strlen(text8); i++) { + for (int i = 0; i < strlen(text8); i++) { text[i] = text8[i]; } _vm->_fontManager->addText(x, y, text, strlen(text8), 1); diff --git a/engines/dragons/scriptopcodes.cpp b/engines/dragons/scriptopcodes.cpp index 10c1ac33bb9..cbc769abde3 100644 --- a/engines/dragons/scriptopcodes.cpp +++ b/engines/dragons/scriptopcodes.cpp @@ -327,7 +327,7 @@ void ScriptOpcodes::opUnk6(ScriptOpCall &scriptOpCall) { _vm->_cursor->_iniUnderCursor = field4; _vm->_cursor->_sequenceID = 0; - for(int16 i = field2 >> 1; i != 0; i = i >> 1) { + for (int16 i = field2 >> 1; i != 0; i = i >> 1) { _vm->_cursor->_sequenceID++; } @@ -472,7 +472,7 @@ bool ScriptOpcodes::evaluateExpression(ScriptOpCall &scriptOpCall) { int16 t2 = 0; int16 t0 = 0; - for(;;) { + for (;;) { byte value = 0; if (*codePtrOffsetA & 1) { uint32 propId = READ_LE_UINT16(codePtrOffset2) * 8 + READ_LE_UINT16(codePtrOffsetA - 6); @@ -625,7 +625,7 @@ void ScriptOpcodes::opUnkE(ScriptOpCall &scriptOpCall) { bool isFlicker = _vm->_dragonINIResource->isFlicker(ini); ini->actor->startWalk(point.x, point.y, isFlicker ? 0 : 1); - if(s3 == 0) { + if (s3 == 0) { while (ini->actor->_flags & Dragons::ACTOR_FLAG_10) { _vm->waitForFrames(1); } @@ -678,7 +678,7 @@ void ScriptOpcodes::opUnkF(ScriptOpCall &scriptOpCall) { bool isFlicker = _vm->_dragonINIResource->isFlicker(ini); ini->actor->startWalk(field8, fieldA, isFlicker ? 0 : 1); - if(s3 == 0) { + if (s3 == 0) { while (ini->actor->_flags & Dragons::ACTOR_FLAG_10) { _vm->waitForFrames(1); } diff --git a/engines/dragons/sequenceopcodes.cpp b/engines/dragons/sequenceopcodes.cpp index a3683d2e7ec..5e5ffc77a7a 100644 --- a/engines/dragons/sequenceopcodes.cpp +++ b/engines/dragons/sequenceopcodes.cpp @@ -200,7 +200,7 @@ void SequenceOpcodes::opSetField7a(Actor *actor, OpCall &opCall) { } void SequenceOpcodes::opUpdateFlags(Actor *actor, OpCall &opCall) { - if(actor->isFlagSet(ACTOR_FLAG_1000)) { + if (actor->isFlagSet(ACTOR_FLAG_1000)) { actor->setFlag(ACTOR_FLAG_4); } updateReturn(opCall, 0); diff --git a/engines/dragons/sound.cpp b/engines/dragons/sound.cpp index 674c1d6a581..0fb1550a62d 100644 --- a/engines/dragons/sound.cpp +++ b/engines/dragons/sound.cpp @@ -139,7 +139,7 @@ bool SoundManager::getSpeechLocation(uint32 talkId, struct SpeechLocation *locat void SoundManager::PauseCDMusic() { //TODO check PauseCDMusic() to see if we need any more logic. - if(isSpeechPlaying()) { + if (isSpeechPlaying()) { _vm->_mixer->stopHandle(_speechHandle); _vm->clearFlags(ENGINE_FLAG_8000); } diff --git a/engines/dragons/talk.cpp b/engines/dragons/talk.cpp index 7ddeb23c849..5de370b9f6b 100644 --- a/engines/dragons/talk.cpp +++ b/engines/dragons/talk.cpp @@ -514,10 +514,10 @@ void Talk::displayDialogAroundActor(Actor *actor, uint16 param_2, uint16 *dialog } void Talk::copyTextToBuffer(uint16 *destBuffer, byte *src, uint32 destBufferLength) { - for(int i = 0; i < destBufferLength - 1; i++) { + for (int i = 0; i < destBufferLength - 1; i++) { destBuffer[i] = READ_LE_UINT16(src); src += 2; - if(destBuffer[i] == 0) { + if (destBuffer[i] == 0) { return; } } @@ -527,7 +527,7 @@ void Talk::copyTextToBuffer(uint16 *destBuffer, byte *src, uint32 destBufferLeng uint32 Talk::wideStrLen(uint16 *text) { int i = 0; - while(text[i] != 0) { + while (text[i] != 0) { i++; } return i;