Comply to our coding conventions

svn-id: r17975
This commit is contained in:
Max Horn 2005-05-08 21:49:52 +00:00
parent 013e30eb38
commit cca744f69a
53 changed files with 149 additions and 149 deletions

View file

@ -81,7 +81,7 @@ ConfigManager::ConfigManager() {
void ConfigManager::loadDefaultConfigFile() {
char configFile[MAXPATHLEN];
#if defined(UNIX)
if(getenv("HOME") != NULL)
if (getenv("HOME") != NULL)
sprintf(configFile,"%s/%s", getenv("HOME"), DEFAULT_CONFIG_FILE);
else
strcpy(configFile, DEFAULT_CONFIG_FILE);

View file

@ -182,7 +182,7 @@ public:
static_cast<Node<T> *>(i._node)->_data = static_cast<Node<T> *>(j._node)->_data;
}
if(i == end())
if (i == end())
insert(i, j, list.end());
else
erase(i, end());

View file

@ -171,7 +171,7 @@ void md5_update( md5_context *ctx, const uint8 *input, uint32 length )
{
uint32 left, fill;
if( ! length ) return;
if ( ! length ) return;
left = ctx->total[0] & 0x3F;
fill = 64 - left;
@ -179,10 +179,10 @@ void md5_update( md5_context *ctx, const uint8 *input, uint32 length )
ctx->total[0] += length;
ctx->total[0] &= 0xFFFFFFFF;
if( ctx->total[0] < length )
if ( ctx->total[0] < length )
ctx->total[1]++;
if( left && length >= fill )
if ( left && length >= fill )
{
memcpy( (void *) (ctx->buffer + left),
(const void *) input, fill );
@ -192,14 +192,14 @@ void md5_update( md5_context *ctx, const uint8 *input, uint32 length )
left = 0;
}
while( length >= 64 )
while ( length >= 64 )
{
md5_process( ctx, input );
length -= 64;
input += 64;
}
if( length )
if ( length )
{
memcpy( (void *) (ctx->buffer + left),
(const void *) input, length );
@ -249,28 +249,28 @@ bool md5_file( const char *name, uint8 digest[16], const char *directory, uint32
int readlen;
f.open(name, File::kFileReadMode, directory);
if( ! f.isOpen() )
if ( ! f.isOpen() )
{
warning( "md5_file couldn't open '%s'", name );
return false;
}
if( ! restricted || sizeof( buf ) <= length )
if ( ! restricted || sizeof( buf ) <= length )
readlen = sizeof( buf );
else
readlen = length;
md5_starts( &ctx );
while( ( i = f.read( buf, readlen ) ) > 0 )
while ( ( i = f.read( buf, readlen ) ) > 0 )
{
md5_update( &ctx, buf, i );
length -= i;
if( restricted && length == 0 )
if ( restricted && length == 0 )
break;
if( restricted && sizeof( buf ) > length )
if ( restricted && sizeof( buf ) > length )
readlen = length;
}
@ -317,11 +317,11 @@ int main( int argc, char *argv[] )
md5_context ctx;
unsigned char md5sum[16];
if( argc < 2 )
if ( argc < 2 )
{
printf( "\n MD5 Validation Tests:\n\n" );
for( i = 0; i < 7; i++ )
for ( i = 0; i < 7; i++ )
{
printf( " Test %d ", i + 1 );
@ -329,12 +329,12 @@ int main( int argc, char *argv[] )
md5_update( &ctx, (const uint8 *) msg[i], strlen( msg[i] ) );
md5_finish( &ctx, md5sum );
for( j = 0; j < 16; j++ )
for ( j = 0; j < 16; j++ )
{
sprintf( output + j * 2, "%02x", md5sum[j] );
}
if( memcmp( output, val[i], 32 ) )
if ( memcmp( output, val[i], 32 ) )
{
printf( "failed!\n" );
return( 1 );
@ -347,10 +347,10 @@ int main( int argc, char *argv[] )
}
else
{
for( i = 1; i < argc; i++ )
for ( i = 1; i < argc; i++ )
{
md5_file( argv[i], md5sum );
for( j = 0; j < 16; j++ )
for ( j = 0; j < 16; j++ )
{
printf( "%02x", md5sum[j] );
}

View file

@ -69,7 +69,7 @@ public:
fh = ::fopen(filename, (saveOrLoad? "wb" : "rb"));
}
~StdioSaveFile() {
if(fh)
if (fh)
::fclose(fh);
}
@ -99,7 +99,7 @@ public:
fh = ::gzopen(filename, (saveOrLoad? "wb" : "rb"));
}
~GzipSaveFile() {
if(fh)
if (fh)
::gzclose(fh);
}

View file

@ -49,7 +49,7 @@ static bool isAltiVecAvailable() {
int hasVectorUnit = 0;
size_t length = sizeof(hasVectorUnit);
int error = sysctl(selectors, 2, &hasVectorUnit, &length, NULL, 0);
if( 0 == error )
if ( 0 == error )
return hasVectorUnit != 0;
return false;
}

View file

@ -49,7 +49,7 @@ static bool isAltiVecAvailable() {
int hasVectorUnit = 0;
size_t length = sizeof(hasVectorUnit);
int error = sysctl(selectors, 2, &hasVectorUnit, &length, NULL, 0);
if( 0 == error )
if ( 0 == error )
return hasVectorUnit != 0;
return false;
}

View file

@ -604,7 +604,7 @@ void draw_animateCursor(int16 cursor) {
draw_cursorAnim++;
draw_cursorTimeKey = util_getTimeKey();
} else {
/* if(draw_noInvalidated &&
/* if (draw_noInvalidated &&
inter_mouseX == draw_cursorX && inter_mouseY == draw_cursorY)
return;*/
}
@ -696,7 +696,7 @@ void draw_interPalLoad(void) {
draw_unusedPalette1[i] = *inter_execPtr;
continue;
}
//if(*inter_execPtr != 0)
//if (*inter_execPtr != 0)
// var_B = 0;
ind1 = *inter_execPtr >> 4;

View file

@ -1688,7 +1688,7 @@ void game_loadExtTable(void) {
game_extTable->itemsCount = FROM_LE_16(game_extTable->itemsCount);
data_readData(game_extHandle, (char *)&game_extTable->unknown, 1);
for(i = 0; i < count; i++) {
for (i = 0; i < count; i++) {
data_readData(game_extHandle, (char *)&game_extTable->items[i].offset, 4);
game_extTable->items[i].offset = FROM_LE_32(game_extTable->items[i].offset);
data_readData(game_extHandle, (char *)&game_extTable->items[i].size, 2);

View file

@ -47,7 +47,7 @@ int32 unpackData(char *sourceBuf, char *destBuf) {
* Don't need this anymore :)
*/
/*
* if(realSize < 65000)
* if (realSize < 65000)
* {
* asm_unpackData(sourceBuf, destBuf, tmpBuf);
* free(tmpBuf);

View file

@ -331,7 +331,7 @@ int16 parse_parseExpr(char arg_0, byte *arg_2) {
if (operation != arg_0)
break;
} // if(operPtr[-2] == 9 && ...)
} // if (operPtr[-2] == 9 && ...)
for (brackStart = stkPos - 2; brackStart > 0 &&
operStack[brackStart] < 30 &&
@ -535,7 +535,7 @@ int16 parse_parseExpr(char arg_0, byte *arg_2) {
if (var_1A != 0)
break;
} // while(stkPos >= 2)
} // while (stkPos >= 2)
if (operation == 30 || operation == 31) {
if (operPtr[-1] == 20) {
@ -696,7 +696,7 @@ void parse_skipExpr(char arg_0) {
parse_skipExpr(10);
}
continue;
} // if(operation >= 19 && operation <= 29)
} // if (operation >= 19 && operation <= 29)
if (operation == 9) {
num++;
@ -844,7 +844,7 @@ int16 parse_parseValExpr() {
valPtr[0] &= valPtr[2];
break;
}
} // if(stkPos > 0 && cmdPtr[-1] > 4 && cmdPtr[-1] < 9)
} // if (stkPos > 0 && cmdPtr[-1] > 4 && cmdPtr[-1] < 9)
continue;
}
@ -1102,7 +1102,7 @@ void parse_printExpr(char arg_0) {
break;
}
continue;
} // if(operation >= 19 && operation <= 29)
} // if (operation >= 19 && operation <= 29)
switch (operation) {
case 9:
debug(5, "(");

View file

@ -381,7 +381,7 @@ void ListWidget::startEditMode() {
}
void ListWidget::endEditMode() {
if(!_editMode)
if (!_editMode)
return;
// send a message that editing finished with a return/enter key press
_editMode = false;

View file

@ -75,7 +75,7 @@ void NewGui::updateColors() {
}
void NewGui::updateScaleFactor() {
if(!_scaleEnable) {
if (!_scaleEnable) {
_scaleFactor = 1;
} else {
enum {
@ -477,9 +477,9 @@ void NewGui::drawBitmap(uint32 *bitmap, int tx, int ty, OverlayColor color, int
if (ty + y < 0 || ty + y >= _screen.h)
continue;
for (int x = 0; x < 8 * _scaleFactor; x++) {
if(!(x % 2) && _scaleFactor != 1 && x != 0)
if (!(x % 2) && _scaleFactor != 1 && x != 0)
mask >>= 4;
else if(_scaleFactor == 1)
else if (_scaleFactor == 1)
mask >>= 4;
if (tx + x < 0 || tx + x >= _screen.w)

View file

@ -61,7 +61,7 @@ CPSImage::CPSImage(uint8* buffer, uint32 size) {
_cpsHeader._pal = bufferstream.readUint32LE();
// lets check a bit
if(_cpsHeader._pal == 0x3000000) {
if (_cpsHeader._pal == 0x3000000) {
// if this was a compressed palette you should have strange graphics
uint8* palbuffer = new uint8[768];
@ -79,9 +79,9 @@ CPSImage::CPSImage(uint8* buffer, uint32 size) {
uint8* imagebuffer = &buffer[bufferstream.pos()];
assert(imagebuffer);
if(_cpsHeader._format == 4) {
if (_cpsHeader._format == 4) {
Compression::decode80(imagebuffer, _image);
} else if(_cpsHeader._format == 3) {
} else if (_cpsHeader._format == 3) {
Compression::decode3(imagebuffer, _image, _cpsHeader._imagesize);
} else {
error("unknown CPS format %d", _cpsHeader._format);
@ -89,7 +89,7 @@ CPSImage::CPSImage(uint8* buffer, uint32 size) {
int16 width = getWidthFromCPSRes(_cpsHeader._imagesize);
if(width == -1) {
if (width == -1) {
warning("unknown CPS width(imagesize: %d)", _cpsHeader._imagesize);
delete [] buffer;
return;

View file

@ -55,7 +55,7 @@ Font::Font(uint8* buffer, uint32 size) {
_fontHeader._height = bufferstream.readByte();
// tests for the magic values
if(_fontHeader._magic1 != FontHeader_Magic1 || _fontHeader._magic2 != FontHeader_Magic2 ||
if (_fontHeader._magic1 != FontHeader_Magic1 || _fontHeader._magic2 != FontHeader_Magic2 ||
_fontHeader._magic3 != FontHeader_Magic3) {
error("magic vars in the fontheader are corrupt\n"
"_magic1 = 0x%x, _magic2 = 0x%x, _magic3 = 0x%x",

View file

@ -235,7 +235,7 @@ int KyraEngine::go() {
_midiDriver->playTrack(3);
}
while(true) {
while (true) {
OSystem::Event event;
//if (_debugger->isAttached())
// _debugger->onFrame();

View file

@ -212,7 +212,7 @@ PAKFile::PAKFile(/*const Common::String &path, */const Common::String& file) {
// saves the name
chunk->_name = reinterpret_cast<const char*>(_buffer + pos);
pos += strlen(chunk->_name) + 1;
if(!(*chunk->_name))
if (!(*chunk->_name))
break;
endoffset = READ_LE_UINT32(_buffer + pos);

View file

@ -122,7 +122,7 @@ public:
// only for testing :)
uint8 getColor(uint16 x, uint16 y) { return _image[y * _width + x]; }
uint8& operator[](uint16 index) { if(index > _width * _height) return _image[0]; return _image[index]; }
uint8& operator[](uint16 index) { if (index > _width * _height) return _image[0]; return _image[index]; }
protected:

View file

@ -504,12 +504,12 @@ uint32 VMContext::contScript(void) {
uint32 scriptStateAtStart = _scriptState;
// runs the script
while(true) {
while (true) {
if ((uint32)_instructionPos > _chunks[kData]._size) {
debug("_instructionPos( = %d) > _chunks[kData]._size( = %d)", _instructionPos, _chunks[kData]._size);
_error = true;
break;
} else if(_instructionPos >= _nextScriptPos) {
} else if (_instructionPos >= _nextScriptPos) {
_scriptState = kScriptStopped;
break;
}

View file

@ -954,7 +954,7 @@ void Command::openOrCloseAssociatedObject(Verb action, int16 otherObj) {
int16 Command::setConditions(uint16 command, bool lastCmd) {
debug(9, "Command::setConditions(%d, %d)", command, lastCmd);
// Test conditions, if FAIL write && exit, Return -1
// if(Joe speaks before he returns, -2 is returned
// if (Joe speaks before he returns, -2 is returned
// This way a -1 return will allow Joe to speak normal description
uint16 temp[21];

View file

@ -350,7 +350,7 @@ void Cutaway::changeRooms(CutawayObject &object) {
}
}
} // for()
} // for ()
}
// set coordinates for Joe if he is on screen
@ -686,7 +686,7 @@ const byte *Cutaway::handleAnimation(const byte *ptr, CutawayObject &object) {
if (objAnim[i].song > 0)
_vm->sound()->playSong(objAnim[i].song);
} // for()
} // for ()
}
bool moving = true;
@ -886,7 +886,7 @@ void Cutaway::run(char *nextFilename) {
_roomFade = false;
}
} // for()
} // for ()
_vm->display()->clearTexts(0, 198);
// XXX lines 1887-1895 in cutaway.c
@ -1086,7 +1086,7 @@ void Cutaway::stop() {
}
}
}
} // for()
} // for ()
int16 specialMove = (int16)READ_BE_INT16(ptr); ptr += 2;
if (specialMove > 0)
@ -1162,7 +1162,7 @@ void Cutaway::updateGameState() {
}
}
} // for()
} // for ()
}
void Cutaway::talk(char *nextFilename) {

View file

@ -721,9 +721,9 @@ void Display::blit(uint8 *dstBuf, uint16 dstPitch, uint16 x, uint16 y, const uin
}
} else if (!xflip) { // Masked bitmap unflipped
while (h--) {
for(int i = 0; i < w; ++i) {
for (int i = 0; i < w; ++i) {
uint8 b = *(srcBuf + i);
if(b != 0) {
if (b != 0) {
*(dstBuf + i) = b;
}
}
@ -732,9 +732,9 @@ void Display::blit(uint8 *dstBuf, uint16 dstPitch, uint16 x, uint16 y, const uin
}
} else { // Masked bitmap flipped
while (h--) {
for(int i = 0; i < w; ++i) {
for (int i = 0; i < w; ++i) {
uint8 b = *(srcBuf + i);
if(b != 0) {
if (b != 0) {
*(dstBuf - i) = b;
}
}

View file

@ -156,7 +156,7 @@ void Talk::talk(const char *filename, int personInRoom, char *cutawayFilename) {
sprintf(_joeVoiceFilePrefix[i], "%2d%4xJ", _talkKey, _dialogueTree[level][i].head);
}
// Check to see if(all the dialogue options have been selected.
// Check to see if (all the dialogue options have been selected.
// if this is the case, and the last one left is the exit option,
// then automatically set S to that and exit.
@ -495,7 +495,7 @@ int Talk::getSpeakCommand(const Person *person, const char *sentence, unsigned &
else
_vm->walk()->movePerson(person, x, y, _vm->graphics()->numFrames(), 0);
index += 11;
// if(JOEWALK==3) CUTQUIT=0;
// if (JOEWALK==3) CUTQUIT=0;
// XXX personWalking = true;
}
break;
@ -1312,7 +1312,7 @@ int16 Talk::selectSentence() {
selectedSentence = zone;
}
} // while()
} // while ()
}
}

View file

@ -314,12 +314,12 @@ public:
out.writeSint32LE(frameNumber);
out.writeSint32LE(tileDirectionsAlloced);
for(int i = 0; i < tileDirectionsAlloced; i++) {
for (int i = 0; i < tileDirectionsAlloced; i++) {
out.writeByte(tileDirections[i]);
}
out.writeSint32LE(walkStepsAlloced);
for(int i = 0; i < walkStepsAlloced; i++) {
for (int i = 0; i < walkStepsAlloced; i++) {
out.writeSint16LE(walkStepsPoints[i].x);
out.writeSint16LE(walkStepsPoints[i].y);
}
@ -349,12 +349,12 @@ public:
setTileDirectionsSize(in.readSint32LE(), true);
for(int i = 0; i < tileDirectionsAlloced; i++) {
for (int i = 0; i < tileDirectionsAlloced; i++) {
tileDirections[i] = in.readByte();
}
setWalkStepsPointsSize(in.readSint32LE(), true);
for(int i = 0; i < walkStepsAlloced; i++) {
for (int i = 0; i < walkStepsAlloced; i++) {
walkStepsPoints[i].x = in.readSint16LE();
walkStepsPoints[i].y = in.readSint16LE();
}

View file

@ -923,7 +923,7 @@ void IsoMap::pushPoint(int16 u, int16 v, uint16 cost, uint16 direction) {
return;
}
while(1) {
while (1) {
mid = (upper + lower) / 2;
tilePoint = _searchArray.getQueue(mid);
@ -1300,10 +1300,10 @@ void IsoMap::findTilePath(ActorData* actor, const Location &start, const Locatio
if (terrainMask & SAGA_IMPASSABLE) {
continue;
} else {
if(terrainMask & (1 << kTerrRough)) {
if (terrainMask & (1 << kTerrRough)) {
tdir = &hardDirTable[ dir ];
} else {
if(terrainMask & (1 << kTerrNone)) {
if (terrainMask & (1 << kTerrNone)) {
tdir = &normalDirTable[ dir ];
} else {
tdir = &easyDirTable[ dir ];

View file

@ -130,7 +130,7 @@ public:
void remove(const T* val) {
for (iterator i = Common::List<T>::begin(); i != Common::List<T>::end(); ++i)
if(val == i.operator->()) {
if (val == i.operator->()) {
erase(i);
return;
}

View file

@ -296,7 +296,7 @@ int SagaEngine::go() {
_scene->startScene();
uint32 currentTicks;
while(!_quit) {
while (!_quit) {
if (_console->isAttached())
_console->onFrame();

View file

@ -101,7 +101,7 @@ int Script::SDebugPrintInstr(ScriptThread *thread) {
sprintf(tmp_buf, "%02X", param);
SD_ADDTXT(tmp_buf);
/*
if((param >= 0) && (param < diag_list->n_dialogue)) {
if ((param >= 0) && (param < diag_list->n_dialogue)) {
debug(2, " ; \"%.*s\"", SCRIPT_STRINGLIMIT, diag_list->str[param]);
}
else {

View file

@ -186,7 +186,7 @@ void Script::sfTakeObject(SCRIPTFUNC_PARAMS) {
obj = _vm->_actor->getObj(objectId);
if (obj->sceneNumber != ITE_SCENE_INV) {
obj->sceneNumber = ITE_SCENE_INV;
//4debug for(int j=0;j<17;j++)
//4debug for (int j=0;j<17;j++)
_vm->_interface->addToInventory(objectId);
}
}

View file

@ -432,7 +432,7 @@ void Sprite::scaleBuffer(const byte *src, int width, int height, int scale) {
for (int i = 0; i < height; i++) {
vskip += skip;
if(vskip < skip) { // We had an overflow
if (vskip < skip) { // We had an overflow
src += width;
} else {
hskip = 0x80;

View file

@ -251,14 +251,14 @@ void CharsetRendererV3::setCurID(byte id) {
}
int CharsetRendererCommon::getFontHeight() {
if(_vm->_useCJKMode)
if (_vm->_useCJKMode)
return MAX(_vm->_2byteHeight + 1, (int)_fontPtr[1]);
else
return _fontPtr[1];
}
int CharsetRendererV3::getFontHeight() {
if(_vm->_useCJKMode)
if (_vm->_useCJKMode)
return MAX(_vm->_2byteHeight + 1, 8);
else
return 8;
@ -289,7 +289,7 @@ int CharsetRenderer::getStringWidth(int arg, const byte *text) {
if (_vm->_heversion >= 72 && chr == code) {
chr = text[pos++];
if (chr == 84) { // Strings of speech offset/size
while(chr != code)
while (chr != code)
chr = text[pos++];
continue;
}
@ -303,7 +303,7 @@ int CharsetRenderer::getStringWidth(int arg, const byte *text) {
break;
if (chr == 254 || chr == 255) {
//process in LE
if(chr == 254 && checkKSCode(text[pos], chr) && _vm->_useCJKMode) {
if (chr == 254 && checkKSCode(text[pos], chr) && _vm->_useCJKMode) {
goto loc_avoid_ks_fe;
}
chr = text[pos++];
@ -354,7 +354,7 @@ void CharsetRenderer::addLinebreaks(int a, byte *str, int pos, int maxwidth) {
if (_vm->_heversion >= 72 && chr == code) {
chr = str[pos++];
if (chr == 84) { // Strings of speech offset/size
while(chr != code)
while (chr != code)
chr = str[pos++];
continue;
}
@ -370,7 +370,7 @@ void CharsetRenderer::addLinebreaks(int a, byte *str, int pos, int maxwidth) {
continue;
if (chr == 254 || chr == 255) {
//process in LE
if(chr == 254 && checkKSCode(str[pos], chr) && _vm->_useCJKMode) {
if (chr == 254 && checkKSCode(str[pos], chr) && _vm->_useCJKMode) {
goto loc_avoid_ks_fe;
}
chr = str[pos++];

View file

@ -546,7 +546,7 @@ bool ScummDebugger::Cmd_Debug(int argc, const char **argv) {
if ((argc == 1) && (_vm->_debugFlags > 0)) {
for (int i = 0; i < numChannels; i++) {
if(_vm->_debugFlags & debugChannels[i].flag)
if (_vm->_debugFlags & debugChannels[i].flag)
DebugPrintf("%s - %s\n", debugChannels[i].channel,
debugChannels[i].desc);
}
@ -570,7 +570,7 @@ bool ScummDebugger::Cmd_Debug(int argc, const char **argv) {
// Identify flag
const char *realFlag = argv[1] + 1;
for (int i = 0; i < numChannels; i++) {
if((scumm_stricmp(debugChannels[i].channel, realFlag)) == 0) {
if ((scumm_stricmp(debugChannels[i].channel, realFlag)) == 0) {
if (setFlag) {
_vm->_debugFlags |= debugChannels[i].flag;
DebugPrintf("Enable ");

View file

@ -60,7 +60,7 @@ int ScummHelp::numPages(byte gameId) {
}
}
#define ADD_BIND(k,d) do { key[i] = k; dsc[i] = d; i++; } while(0)
#define ADD_BIND(k,d) do { key[i] = k; dsc[i] = d; i++; } while (0)
#define ADD_TEXT(d) ADD_BIND("",d)
#define ADD_LINE ADD_BIND("","")

View file

@ -371,7 +371,7 @@ int32 IMuseDigital::getCurMusicLipSyncHeight(int syncId) {
void IMuseDigital::stopAllSounds() {
debug(5, "IMuseDigital::stopAllSounds");
for(;;) {
for (;;) {
bool foundNotRemoved = false;
for (int l = 0; l < MAX_DIGITAL_TRACKS + MAX_DIGITAL_FADETRACKS; l++) {
Track *track = _track[l];

View file

@ -71,17 +71,17 @@ class ScummEngine;
////////////////////////////////////////
inline int clamp(int val, int min, int max) {
if(val < min)
if (val < min)
return min;
if(val > max)
if (val > max)
return max;
return val;
}
inline int transpose_clamp(int a, int b, int c) {
if(b > a)
if (b > a)
a += (b - a + 11) / 12 * 12;
if(c < a)
if (c < a)
a -= (a - c + 11) / 12 * 12;
return a;
}

View file

@ -1368,7 +1368,7 @@ bool MacResExtractor::init(File in) {
// Length check
int sumlen = MBI_INFOHDR + data_size_pad + rsrc_size_pad;
if(sumlen == filelen)
if (sumlen == filelen)
_resOffset = MBI_INFOHDR + data_size_pad;
}
@ -1581,7 +1581,7 @@ void MacResExtractor::convertIcons(byte *data, int datasize, byte **cursor, int
palette = (byte *)malloc(ctSize * 4);
// Read just high byte of 16-bit color
for(int c = 0; c < ctSize; c++) {
for (int c = 0; c < ctSize; c++) {
// We just use indices 0..ctSize, so ignore color ID
dis.readUint16BE(); // colorID[c]
@ -1608,7 +1608,7 @@ void MacResExtractor::convertIcons(byte *data, int datasize, byte **cursor, int
// build a mask to make sure the pixels are properly shifted out
bitmask = 0;
for(int m = 0; m < bpp; m++) {
for (int m = 0; m < bpp; m++) {
bitmask <<= 1;
bitmask |= 1;
}

View file

@ -2055,7 +2055,7 @@ void ScummEngine_v72he::copyArray(int array1, int a1_dim2start, int a1_dim2end,
for (; a1_dim2start <= a1_dim2end; ++a1_dim2start, ++a2_dim2start) {
int a2dim1 = a2_dim1start;
int a1dim1 = a1_dim1start;
for(; a1dim1 <= a1_dim1end; ++a1dim1, ++a2dim1) {
for (; a1dim1 <= a1_dim1end; ++a1dim1, ++a2dim1) {
int val = readArray(array2, a2_dim2start, a2dim1);
writeArray(array1, a1_dim2start, a1dim1, val);
}

View file

@ -44,7 +44,7 @@ int SmushFont::getStringWidth(const char *str) {
int width = 0;
while (*str) {
if(*str & 0x80 && _vm->_useCJKMode) {
if (*str & 0x80 && _vm->_useCJKMode) {
width += _vm->_2byteWidth + 1;
str += 2;
} else

View file

@ -1145,7 +1145,7 @@ void SmushPlayer::insanity(bool flag) {
void SmushPlayer::seekSan(const char *file, int32 pos, int32 contFrame) {
Common::StackLock lock(_mutex);
if(_smixer)
if (_smixer)
_smixer->stop();
if (file) {

View file

@ -203,7 +203,7 @@ int ScummEngine_v90he::findSpriteWithClassOf(int x_pos, int y_pos, int spriteGro
y += h / 2;
}
if(isWizPixelNonTransparent(resId, resState, x, y, spi->curImgFlags))
if (isWizPixelNonTransparent(resId, resState, x, y, spi->curImgFlags))
return spi->id;
}
}

View file

@ -255,7 +255,7 @@ void ScummEngine::CHARSET_1() {
i = 0;
memset(value, 0, 32);
c = *buffer++;
while(c != 44) {
while (c != 44) {
value[i] = c;
c = *buffer++;
i++;
@ -266,7 +266,7 @@ void ScummEngine::CHARSET_1() {
i = 0;
memset(value, 0, 32);
c = *buffer++;
while(c != code) {
while (c != code) {
value[i] = c;
c = *buffer++;
i++;
@ -286,7 +286,7 @@ void ScummEngine::CHARSET_1() {
i = 0;
memset(value, 0, 32);
c = *buffer++;
while(c != code) {
while (c != code) {
value[i] = c;
c = *buffer++;
i++;
@ -307,7 +307,7 @@ void ScummEngine::CHARSET_1() {
}
} else if (c == 0xFE || c == 0xFF) {
// WORKAROUND to avoid korean code 0xfe treated as charset message code.
if(c == 0xFE && checkKSCode(*(buffer + 1), c) && _useCJKMode) {
if (c == 0xFE && checkKSCode(*(buffer + 1), c) && _useCJKMode) {
goto loc_avoid_ks_fe;
}
c = *buffer++;
@ -387,7 +387,7 @@ loc_avoid_ks_fe:
c = 0x20; //not in S-JIS
} else {
c += *buffer++ * 256; //LE
if(_gameId == GID_CMI) { //HACK: This fixes korean text position in COMI (off by 6 pixel)
if (_gameId == GID_CMI) { //HACK: This fixes korean text position in COMI (off by 6 pixel)
cmi_pos_hack = true;
_charset->_top += 6;
}
@ -407,7 +407,7 @@ loc_avoid_ks_fe:
} else
_charset->printChar(c);
}
if(cmi_pos_hack) {
if (cmi_pos_hack) {
cmi_pos_hack = false;
_charset->_top -= 6;
}
@ -554,7 +554,7 @@ void ScummEngine::drawString(int a, const byte *msg) {
c = 0x20; //not in S-JIS
} else {
c += buf[i++] * 256;
if(_gameId == GID_CMI) {
if (_gameId == GID_CMI) {
cmi_pos_hack = true;
_charset->_top += 6;
}
@ -563,7 +563,7 @@ void ScummEngine::drawString(int a, const byte *msg) {
_charset->printChar(c);
_charset->_blitAlso = false;
if(cmi_pos_hack) {
if (cmi_pos_hack) {
cmi_pos_hack = false;
_charset->_top -= 6;
}

View file

@ -409,7 +409,7 @@ void SimonEngine::dump_vga_bitmaps(const byte *vga, byte *vga1, int res) {
i = 538;
for(i = 1; ; i++) {
for (i = 1; ; i++) {
p2 = vga + i * 8;
offs = READ_BE_UINT32(p2);

View file

@ -71,7 +71,7 @@ int SimonEngine::display_savegame_list(int curpos, bool load, char *dst) {
slot = curpos;
while (curpos + 6 > slot) {
if(!(in = _saveFileMan->openForLoading(gen_savename(slot))))
if (!(in = _saveFileMan->openForLoading(gen_savename(slot))))
break;
in->read(dst, 18);
@ -95,7 +95,7 @@ int SimonEngine::display_savegame_list(int curpos, bool load, char *dst) {
}
} else {
if (curpos + 6 == slot) {
if((in = _saveFileMan->openForLoading(gen_savename(slot)))) {
if ((in = _saveFileMan->openForLoading(gen_savename(slot)))) {
slot++;
delete in;
}

View file

@ -3560,17 +3560,17 @@ void SimonEngine::talk_with_text(uint vgaSpriteId, uint color, const char *strin
} \
(var) = bb & 1; \
bb >>= 1; \
}while(0)
}while (0)
#define SD_GETBITS(var, nbits) do { \
bc = (nbits); \
(var) = 0; \
while(bc--) { \
while (bc--) { \
(var) <<= 1; \
SD_GETBIT(bit); \
(var) |= bit; \
} \
}while(0)
}while (0)
#define SD_TYPE_LITERAL (0)
#define SD_TYPE_MATCH (1)

View file

@ -605,7 +605,7 @@ void Screen::doSprites(uint8 layer) {
drawListNum++;
drawList = (uint16 *)_skyCompact->fetchCpt(idNum);
while(drawList[0]) {
while (drawList[0]) {
// new_draw_list:
while ((drawList[0] != 0) && (drawList[0] != 0xFFFF)) {
// back_loop:

View file

@ -328,7 +328,7 @@ void Text::getText(uint32 textNr) { //load text #"textNr" into textBuffer
do {
textChar = getTextChar();
*dest++ = textChar;
} while(textChar);
} while (textChar);
}
void Text::fnPointerText(uint32 pointedId, uint16 mouseX, uint16 mouseY) {

View file

@ -148,16 +148,16 @@ int16 ADPCMInputStream::okiADPCMDecode(byte code) {
samp = _status.last + diff;
// Clip the values to +/- 2^11 (supposed to be 12 bits)
if(samp > 2048)
if (samp > 2048)
samp = 2048;
if(samp < -2048)
if (samp < -2048)
samp = -2048;
_status.last = samp;
_status.stepIndex += stepAdjust(code);
if(_status.stepIndex < 0)
if (_status.stepIndex < 0)
_status.stepIndex = 0;
if(_status.stepIndex > 48)
if (_status.stepIndex > 48)
_status.stepIndex = 48;
return samp;
@ -200,16 +200,16 @@ int16 ADPCMInputStream::imaADPCMDecode(byte code) {
diff = (code & 0x08) ? -E : E;
samp = _status.last + diff;
if(samp < -32768)
if (samp < -32768)
samp = -32768;
else if(samp > 32767)
else if (samp > 32767)
samp = 32767;
_status.last = samp;
_status.stepIndex += stepAdjust(code);
if(_status.stepIndex < 0)
if (_status.stepIndex < 0)
_status.stepIndex = 0;
if(_status.stepIndex > 88)
if (_status.stepIndex > 88)
_status.stepIndex = 88;
return samp;

View file

@ -159,7 +159,7 @@ void SoundMixer::insertChannel(SoundHandle *handle, Channel *chan) {
break;
}
}
if(index == -1) {
if (index == -1) {
warning("SoundMixer::out of mixer slots");
delete chan;
return;

View file

@ -158,7 +158,7 @@ void revmodel::mute() {
void revmodel::processreplace(float *inputL, float *inputR, float *outputL, float *outputR, long numsamples, int skip) {
float outL, outR, input;
while(numsamples-- > 0) {
while (numsamples-- > 0) {
int i;
outL = outR = 0;

View file

@ -669,9 +669,9 @@ Bit32s Partial::getFiltEnvelope() {
tStat->envsize = synth->tables.envTime[(int)patchCache->filtEnv.envtime[tStat->envstat]];
} else {
Bit32u envTime = (int)patchCache->filtEnv.envtime[tStat->envstat];
if(tStat->envstat > 1) {
if (tStat->envstat > 1) {
int envDiff = abs(patchCache->filtEnv.envlevel[tStat->envstat] - patchCache->filtEnv.envlevel[tStat->envstat - 1]);
if(envTime > synth->tables.envDeltaMaxTime[envDiff]) {
if (envTime > synth->tables.envDeltaMaxTime[envDiff]) {
envTime = synth->tables.envDeltaMaxTime[envDiff];
}
}

View file

@ -161,11 +161,11 @@ void Tables::initEnvelopes(float samplerate) {
envTime[lf] = samples;
// Cap on envelope times depending on the level delta
if(elf == 0) {
if (elf == 0) {
envDeltaMaxTime[lf] = 63;
} else {
float cap = 11 * log(elf) + 64;
if(cap > 100.0f) {
if (cap > 100.0f) {
cap = 100.0f;
}
envDeltaMaxTime[lf] = (int)cap;
@ -380,7 +380,7 @@ void Tables::initMT32ConstantTables(Synth *synth) {
// Distance of full volume reduction
amplog = (float)(12.0f / (float)lf) * 24.0f;
if(distval > amplog) {
if (distval > amplog) {
tvaBiasMult[lf][distval] = 0;
} else {
dval = (amplog - (float)distval) / amplog;

View file

@ -245,7 +245,7 @@ void Logic::processLogic(Object *compact, uint32 id) {
error("Fatal error: compact %d's logic == %X!", id, compact->o_logic);
break;
}
} while(logicRet);
} while (logicRet);
}
int Logic::logicWaitTalk(Object *compact) {

View file

@ -190,7 +190,7 @@ int32 Router::routeFinder(int32 id, Object *megaObject, int32 x, int32 y, int32
solidFlag = SolidWalkAnimator(megaObject->o_route);
}
if(!solidFlag)
if (!solidFlag)
{
SlidyPath();
SlidyWalkAnimator(megaObject->o_route);
@ -247,7 +247,7 @@ int32 Router::GetRoute()
changed = Scan(level);
level =level + 1;
}
while(changed == 1);
while (changed == 1);
// Check to see if the route reached the target
if (node[nnodes].dist < 9999)
@ -869,7 +869,7 @@ void Router::SlidyWalkAnimator(WalkData *walkAnim)
step += 1;
module += 1;
}
while( module < moduleEnd) ;
while ( module < moduleEnd) ;
stepX = modX[modularPath[p].dir];
stepY = modY[modularPath[p].dir];
errorX = modularPath[p].x - moduleX;
@ -923,7 +923,7 @@ void Router::SlidyWalkAnimator(WalkData *walkAnim)
frameCount += 1;
walkAnim[lastCount + frameCount - 1].x += errorX*frameCount/frames;
}
while(frameCount<frames);
while (frameCount<frames);
}
if (errorY != 0)
{
@ -934,7 +934,7 @@ void Router::SlidyWalkAnimator(WalkData *walkAnim)
frameCount += 1;
walkAnim[lastCount + frameCount-1].y += errorY*frameCount/frames;
}
while(frameCount<frames);
while (frameCount<frames);
}
// Now is the time to put in the turn frames for the last turn
if (frames < framesPerStep)
@ -954,7 +954,7 @@ void Router::SlidyWalkAnimator(WalkData *walkAnim)
walkAnim[frame].frame += 104;//turning left
frame += 1;
}
while(frame < lastCount );
while (frame < lastCount );
}
if (((lastDir == 1) || (lastDir == -7)) || ((lastDir == 2) || (lastDir == -6)))
{
@ -965,7 +965,7 @@ void Router::SlidyWalkAnimator(WalkData *walkAnim)
walkAnim[frame].frame += 200; //was 60 now 116
frame += 1;
}
while(frame < lastCount );
while (frame < lastCount );
}
lastDir = currentDir;
}
@ -1359,7 +1359,7 @@ int32 Router::SolidWalkAnimator(WalkData *walkAnim)
do
{
while(modularPath[p].num > 0)
while (modularPath[p].num > 0)
{
currentDir = modularPath[p].dir;
if (currentDir< NO_DIRECTIONS)
@ -1388,7 +1388,7 @@ int32 Router::SolidWalkAnimator(WalkData *walkAnim)
module += 1;
step += 1;
}
while( module < moduleEnd) ;
while ( module < moduleEnd) ;
errorX = modularPath[p].x - moduleX;
errorX = errorX * modX[modularPath[p].dir];
errorY = modularPath[p].y - moduleY;
@ -1432,7 +1432,7 @@ int32 Router::SolidWalkAnimator(WalkData *walkAnim)
walkAnim[frame].frame += 104;//turning left
frame += 1;
}
while(frame < lastCount );
while (frame < lastCount );
}
if (((lastDir == 1) || (lastDir == -7)) || ((lastDir == 2) || (lastDir == -6)))
{
@ -1443,7 +1443,7 @@ int32 Router::SolidWalkAnimator(WalkData *walkAnim)
walkAnim[frame].frame += 200; //was 60 now 116
frame += 1;
}
while(frame < lastCount );
while (frame < lastCount );
}
}
// all turns checked
@ -1474,7 +1474,7 @@ int32 Router::SolidWalkAnimator(WalkData *walkAnim)
walkAnim[frame].frame += 278;//stopping right
frame += 1;
}
while(frame < lastCount );
while (frame < lastCount );
walkAnim[stepCount].frame = 308;
walkAnim[stepCount].step = 7;
walkAnim[stepCount].dir = currentDir;
@ -1489,7 +1489,7 @@ int32 Router::SolidWalkAnimator(WalkData *walkAnim)
walkAnim[frame].frame += 279;//stopping right
frame += 1;
}
while(frame < lastCount );
while (frame < lastCount );
walkAnim[stepCount].frame = 315;
walkAnim[stepCount].step = 7;
walkAnim[stepCount].dir = currentDir;
@ -1510,7 +1510,7 @@ int32 Router::SolidWalkAnimator(WalkData *walkAnim)
walkAnim[frame].frame += 244;//stopping left
frame += 1;
}
while(frame < lastCount );
while (frame < lastCount );
walkAnim[stepCount].frame = 322;
walkAnim[stepCount].step = 7;
walkAnim[stepCount].dir = currentDir;
@ -1525,7 +1525,7 @@ int32 Router::SolidWalkAnimator(WalkData *walkAnim)
walkAnim[frame].frame += 245;//stopping left
frame += 1;
}
while(frame < lastCount );
while (frame < lastCount );
walkAnim[stepCount].frame = 329;
walkAnim[stepCount].step = 7;
walkAnim[stepCount].dir = currentDir;
@ -1565,7 +1565,7 @@ int32 Router::SolidWalkAnimator(WalkData *walkAnim)
#endif
i += 1;
}
while(i<p-1);
while (i<p-1);
if (p != 0)
{
targetDir = modularPath[p-1].dir;
@ -1646,11 +1646,11 @@ int32 Router::Scan(int32 level)
}
k-=1;
}
while(k > 0);
while (k > 0);
}
i=i+1;
}
while(i < nnodes);
while (i < nnodes);
return changed;
}
@ -2046,7 +2046,7 @@ int32 Router::LineCheck(int32 x1 , int32 y1 , int32 x2 ,int32 y2)
}
i = i + 1;
}
while((i < nbars) && linesCrossed);
while ((i < nbars) && linesCrossed);
return linesCrossed;
}
@ -2100,7 +2100,7 @@ int32 Router::HorizCheck(int32 x1 , int32 y , int32 x2)
}
i = i + 1;
}
while((i < nbars) && linesCrossed);
while ((i < nbars) && linesCrossed);
return linesCrossed;
}
@ -2153,7 +2153,7 @@ int32 Router::VertCheck(int32 x, int32 y1, int32 y2)
}
i = i + 1;
}
while((i < nbars) && linesCrossed);
while ((i < nbars) && linesCrossed);
return linesCrossed;
}
@ -2229,7 +2229,7 @@ int32 Router::CheckTarget(int32 x , int32 y)
}
i = i + 1;
}
while((i < nbars) && (onLine == 0));
while ((i < nbars) && (onLine == 0));
return onLine;
}
@ -2313,7 +2313,7 @@ int32 Router::LoadWalkResources(Object *megaObject, int32 x, int32 y, int32 dir)
fPolygrid += 2*sizeof(int16);
j ++;
}
while(j < nnodes);//array starts at 0*/
while (j < nnodes);//array starts at 0*/
for (cnt = 1; cnt < nnodes; cnt++) {
node[cnt].x = READ_LE_UINT16(fPolygrid); fPolygrid += 2;
node[cnt].y = READ_LE_UINT16(fPolygrid); fPolygrid += 2;
@ -2338,7 +2338,7 @@ int32 Router::LoadWalkResources(Object *megaObject, int32 x, int32 y, int32 dir)
// copy any extra nodes from extraNode array
j = 0;
while(j < _numExtraNodes)//array starts at 0
while (j < _numExtraNodes)//array starts at 0
{
node[nnodes+j].x = _extraNodes[j].x ;
node[nnodes+j].y = _extraNodes[j].y ;

View file

@ -64,7 +64,7 @@ uint32 Text::lowTextManager(uint8 *ascii, int32 width, uint8 pen) {
uint32 textObjId = (TEXT_sect * ITM_PER_SEC) - 1;
do {
textObjId++;
} while(_objMan->fetchObject(textObjId)->o_status);
} while (_objMan->fetchObject(textObjId)->o_status);
// okay, found a free text object
_objMan->fetchObject(textObjId)->o_status = STAT_FORE;
@ -128,7 +128,7 @@ uint16 Text::analyzeSentence(uint8 *text, uint16 maxWidth, LineInfo *line) {
text++;
wordWidth += OVERLAP; // no overlap on final letter of word!
if( firstWord ) { // first word on first line, so no separating SPACE needed
if ( firstWord ) { // first word on first line, so no separating SPACE needed
line[0].width = wordWidth;
line[0].length = wordLength;
firstWord = false;