Permalink
Browse files

JANITORIAL: Removing trailing spaces after int casts

  • Loading branch information...
dreammaster committed Aug 18, 2018
1 parent c8d3af3 commit 11e33ba3fc1b65789358485fa50cdbc0cf26aac7
@@ -83,7 +83,7 @@ int XAStream::readBuffer(int16 *buffer, const int numSamples) {
_samples[i] = _samples[i] + _s1 * s_xaDataTable[_predictor][0] + _s2 * s_xaDataTable[_predictor][1];
_s2 = _s1;
_s1 = _samples[i];
int16 d = (int) (_samples[i] + 0.5);
int16 d = (int)(_samples[i] + 0.5);
buffer[samplesDecoded] = d;
samplesDecoded++;
_samplesRemaining--;
@@ -129,7 +129,7 @@ int XAStream::readBuffer(int16 *buffer, const int numSamples) {
_samples[i] = _samples[i] + _s1 * s_xaDataTable[_predictor][0] + _s2 * s_xaDataTable[_predictor][1];
_s2 = _s1;
_s1 = _samples[i];
int16 d = (int) (_samples[i] + 0.5);
int16 d = (int)(_samples[i] + 0.5);
buffer[samplesDecoded] = d;
samplesDecoded++;
}
@@ -328,7 +328,7 @@ void ProtrackerStream::updateRow() {
_speed = exy;
} else {
_bpm = exy;
setInterruptFreq((int) (getRate() / (_bpm * 0.4)));
setInterruptFreq((int)(getRate() / (_bpm * 0.4)));
}
break;
default:
@@ -135,7 +135,7 @@ Game::Game(DraciEngine *vm) : _vm(vm), _walkingState(vm) {
}

_dialogueVars = new int[curOffset];
memset(_dialogueVars, 0, sizeof (int) * curOffset);
memset(_dialogueVars, 0, sizeof(int) * curOffset);

// Read in game info
file = initArchive->getFile(3);
@@ -257,7 +257,7 @@ class Game {

int getItemStatus(int itemID) const { return _itemStatus[itemID]; }
void setItemStatus(int itemID, int status) { _itemStatus[itemID] = status; }
GameItem *getItem(int id) { return id >= 0 && id < (int) _info._numItems ? &_items[id] : NULL; }
GameItem *getItem(int id) { return id >= 0 && id < (int)_info._numItems ? &_items[id] : NULL; }
GameItem *getCurrentItem() const { return _currentItem; }
void setCurrentItem(GameItem *item) { _currentItem = item; }
int getPreviousItemPosition() const { return _previousItemPosition; }
@@ -151,7 +151,7 @@ void LegacySoundArchive::clearCache() {
*/
SoundSample *LegacySoundArchive::getSample(int i, uint freq) {
// Check whether requested file exists
if (i < 0 || i >= (int) _sampleCount) {
if (i < 0 || i >= (int)_sampleCount) {
return NULL;
}

@@ -230,7 +230,7 @@ void ZipSoundArchive::clearCache() {
}

SoundSample *ZipSoundArchive::getSample(int i, uint freq) {
if (i < 0 || i >= (int) _sampleCount) {
if (i < 0 || i >= (int)_sampleCount) {
return NULL;
}
debugCN(2, kDraciArchiverDebugLevel, "Accessing sample %d.%s from archive %s (format %d@%d, capacity %d): ",
@@ -151,7 +151,7 @@ const Gob::GOBGameDescription *GobMetaEngine::detectOnceUponATime(const Common::

if ((gameType == Gob::kOnceUponATimeInvalid) || (platform == Gob::kOnceUponATimePlatformInvalid)) {
warning("GobMetaEngine::detectOnceUponATime(): Detection failed (%d, %d)",
(int) gameType, (int) platform);
(int)gameType, (int)platform);
return 0;
}

@@ -796,7 +796,7 @@ int16 Game::checkKeys(int16 *pMouseX, int16 *pMouseY,

if (_vm->_mult->_multData && _vm->_inter->_variables &&
(VAR(58) != 0)) {
if (_vm->_mult->_multData->frameStart != (int) VAR(58) - 1)
if (_vm->_mult->_multData->frameStart != (int)VAR(58) - 1)
_vm->_mult->_multData->frameStart++;
else
_vm->_mult->_multData->frameStart = 0;
@@ -724,8 +724,8 @@ void Goblin::adjustDest(int16 posX, int16 posY) {
}

}
_pressedMapX = CLIP((int) _pressedMapX, 0, _vm->_map->getMapWidth() - 1);
_pressedMapY = CLIP((int) _pressedMapY, 0, _vm->_map->getMapHeight() - 1);
_pressedMapX = CLIP((int)_pressedMapX, 0, _vm->_map->getMapWidth() - 1);
_pressedMapY = CLIP((int)_pressedMapY, 0, _vm->_map->getMapHeight() - 1);
}

void Goblin::adjustTarget() {
@@ -745,8 +745,8 @@ void Goblin::adjustTarget() {
_pressedMapX++;
}
}
_pressedMapX = CLIP((int) _pressedMapX, 0, _vm->_map->getMapWidth() - 1);
_pressedMapY = CLIP((int) _pressedMapY, 0, _vm->_map->getMapHeight() - 1);
_pressedMapX = CLIP((int)_pressedMapX, 0, _vm->_map->getMapWidth() - 1);
_pressedMapY = CLIP((int)_pressedMapY, 0, _vm->_map->getMapHeight() - 1);
}

void Goblin::targetDummyItem(Gob_Object *gobDesc) {
@@ -896,8 +896,8 @@ void Goblin::targetItem() {
}
}
}
_pressedMapX = CLIP((int) _pressedMapX, 0, _vm->_map->getMapWidth() - 1);
_pressedMapY = CLIP((int) _pressedMapY, 0, _vm->_map->getMapHeight() - 1);
_pressedMapX = CLIP((int)_pressedMapX, 0, _vm->_map->getMapWidth() - 1);
_pressedMapY = CLIP((int)_pressedMapY, 0, _vm->_map->getMapHeight() - 1);
}

void Goblin::moveFindItem(int16 posX, int16 posY) {
@@ -872,24 +872,24 @@ void Inter_v2::o2_scroll() {
int16 curX;
int16 curY;

startX = CLIP((int) _vm->_game->_script->readValExpr(), 0,
startX = CLIP((int)_vm->_game->_script->readValExpr(), 0,
_vm->_video->_surfWidth - _vm->_width);
startY = CLIP((int) _vm->_game->_script->readValExpr(), 0,
startY = CLIP((int)_vm->_game->_script->readValExpr(), 0,
_vm->_video->_surfHeight - _vm->_height);
endX = CLIP((int) _vm->_game->_script->readValExpr(), 0,
endX = CLIP((int)_vm->_game->_script->readValExpr(), 0,
_vm->_video->_surfWidth - _vm->_width);
endY = CLIP((int) _vm->_game->_script->readValExpr(), 0,
endY = CLIP((int)_vm->_game->_script->readValExpr(), 0,
_vm->_video->_surfHeight - _vm->_height);
stepX = _vm->_game->_script->readValExpr();
stepY = _vm->_game->_script->readValExpr();

curX = startX;
curY = startY;
while (!_vm->shouldQuit() && ((curX != endX) || (curY != endY))) {
curX = stepX > 0 ? MIN(curX + stepX, (int) endX) :
MAX(curX + stepX, (int) endX);
curY = stepY > 0 ? MIN(curY + stepY, (int) endY) :
MAX(curY + stepY, (int) endY);
curX = stepX > 0 ? MIN(curX + stepX, (int)endX) :
MAX(curX + stepX, (int)endX);
curY = stepY > 0 ? MIN(curY + stepY, (int)endY) :
MAX(curY + stepY, (int)endY);

_vm->_draw->_scrollOffsetX = curX;
_vm->_draw->_scrollOffsetY = curY;
@@ -86,7 +86,7 @@ void SoundMixer::stop(int16 fadeLength) {

_fade = true;
_fadeVol = 65536;
_fadeSamples = (int) (fadeLength * (((double) _rate) / 10.0));
_fadeSamples = (int)(fadeLength * (((double) _rate) / 10.0));
_fadeVolStep = MAX((int32) 1, (int32) (65536 / _fadeSamples));
_curFadeSamples = 0;
}
@@ -133,7 +133,7 @@ void SoundMixer::setSample(SoundDesc &sndDesc, int16 repCount, int16 frequency,
} else {
_fade = true;
_fadeVol = 0;
_fadeSamples = (int) (fadeLength * (((double) _rate) / 10.0));
_fadeSamples = (int)(fadeLength * (((double) _rate) / 10.0));
_fadeVolStep = - MAX((int32) 1, (int32) (65536 / _fadeSamples));
}
}
@@ -766,7 +766,7 @@ bool Surface::loadImage(Common::SeekableReadStream &stream, ImageType type) {
return loadJPEG(stream);

default:
warning("Surface::loadImage(): Unknown image type: %d", (int) type);
warning("Surface::loadImage(): Unknown image type: %d", (int)type);
return false;
}

@@ -496,7 +496,7 @@ void Util::setScrollOffset(int16 x, int16 y) {
void Util::insertStr(const char *str1, char *str2, int16 pos) {
int len1 = strlen(str1);
int len2 = strlen(str2);
int from = MIN((int) pos, len2);
int from = MIN((int)pos, len2);

for (int i = len2; i >= from; i--)
str2[len1 + i] = str2[i];
@@ -385,7 +385,7 @@ SeqPlayer_HOF::SeqPlayer_HOF(KyraEngine_v1 *vm, Screen_v2 *screen, OSystem *syst
_sequenceStrings = _vm->staticres()->loadStrings(k2SeqplayStrings, tempSize);
uint8 multiplier = (_vm->gameFlags().platform == Common::kPlatformFMTowns || _vm->gameFlags().platform == Common::kPlatformPC98) ? 12 : 8;
for (int i = 0; i < MIN(33, tempSize); i++)
_textDuration[i] = (int) strlen(_sequenceStrings[i]) * multiplier;
_textDuration[i] = (int)strlen(_sequenceStrings[i]) * multiplier;

if (_sequenceSoundList) {
for (int i = 0; i < _sequenceSoundListSize; i++) {
@@ -38,7 +38,7 @@ bool LoLEngine::snd_playCharacterSpeech(int id, int8 speaker, int) {

if (speaker < 65) {
if (_characters[speaker].flags & 1)
speaker = (int) _characters[speaker].name[0];
speaker = (int)_characters[speaker].name[0];
else
speaker = 0;
}
@@ -601,8 +601,8 @@ void SoundTownsPC98_v2::playTrack(uint8 track) {
int trackNum = -1;
if (_vm->gameFlags().platform == Common::kPlatformFMTowns) {
for (uint i = 0; i < res()->cdaTableSize; i++) {
if (track == (uint8) READ_LE_UINT16(&res()->cdaTable[i * 2])) {
trackNum = (int) READ_LE_UINT16(&res()->cdaTable[i * 2 + 1]) - 1;
if (track == (uint8)READ_LE_UINT16(&res()->cdaTable[i * 2])) {
trackNum = (int)READ_LE_UINT16(&res()->cdaTable[i * 2 + 1]) - 1;
break;
}
}
@@ -509,7 +509,7 @@ void Hotspot::endAction() {
_voiceCtr = 0;
setActionCtr(0);
if (_hotspotId == PLAYER_ID)
room.setCursorState((CursorState) ((int) room.cursorState() & 2));
room.setCursorState((CursorState) ((int)room.cursorState() & 2));

if (currentActions().top().hasSupportData()) {
CharacterScheduleEntry *rec = currentActions().top().supportData().next();
@@ -704,7 +704,7 @@ bool Hotspot::walkingStep() {
++_pathFinder.stepCtr();
} else {
warning("Hotspot %xh dir frame not found: currentFrame=%d, dir=%s",
_hotspotId, frameNumber(), directionList[(int) _pathFinder.top().direction()]);
_hotspotId, frameNumber(), directionList[(int)_pathFinder.top().direction()]);
}

return false;
@@ -2781,7 +2781,7 @@ void HotspotTickHandlers::standardCharacterAnimHandler(Hotspot &h) {
assert(newEntry);

// Increment the blocked state
h.setBlockedState((BlockedState) ((int) h.blockedState() + 1));
h.setBlockedState((BlockedState) ((int)h.blockedState() + 1));
if (!h.blockedFlag()) {
// Not already handling blocked, so add a new dummy action so that the new
// action set below will not replace the existing one
@@ -3095,7 +3095,7 @@ void HotspotTickHandlers::playerAnimHandler(Hotspot &h) {
h.tempDest().position.x = h.destX();
h.tempDest().position.y = h.destY();
h.tempDest().counter = 1;
h.setBlockedState((BlockedState) ((int) h.blockedState() + 1));
h.setBlockedState((BlockedState) ((int)h.blockedState() + 1));
h.setRandomDest();
return;
}
@@ -4703,7 +4703,7 @@ void Support::characterChangeRoom(Hotspot &h, uint16 roomNumber,
h.tempDest().counter = 1;
Room::getReference().setCursorState(CS_BUMPED);
h.setActionCtr(0);
h.setBlockedState((BlockedState) ((int) h.blockedState() + 1));
h.setBlockedState((BlockedState) ((int)h.blockedState() + 1));
h.setDestHotspot(0);
h.setRandomDest();
p.roomNumber = 0;
@@ -861,8 +861,8 @@ class StringList {
const char *getString(int index) {
return _entries[index].c_str();
}
const char *getString(Action action) { return getString((int) action - 1); }
const char *getString(StringEnum sEnum) { return getString((int) sEnum); }
const char *getString(Action action) { return getString((int)action - 1); }
const char *getString(StringEnum sEnum) { return getString((int)sEnum); }
void setString(Action action, const Common::String &s) { _entries[(int)action - 1] = s; }
};

@@ -420,7 +420,7 @@ void Surface::wordWrap(char *text, uint16 width, char **&lines, uint8 &numLines)
wordEnd = strchr(wordStart, '\0') - 1;
}

int wordBytes = (int) (wordEnd - s + 1);
int wordBytes = (int)(wordEnd - s + 1);
uint16 wordSize = (wordBytes == 0) ? 0 : textWidth(s, wordBytes);
if (gDebugLevel >= ERROR_DETAILED) {
char wordBuffer[MAX_DESC_SIZE];
@@ -888,7 +888,7 @@ void GameNebular::step() {
else
++_globals[kTimebombTimer];

_globals[kTimebombClock] = (int) _scene._frameStartTime;
_globals[kTimebombClock] = (int)_scene._frameStartTime;
}
}

@@ -320,7 +320,7 @@ bool DialogManager::showKnowledgeCheck() {
int prevChoice = 1;
for (int j = firstOption; j <= lastOption; ++j, ++prevChoice) {
tmpStr = _vm->getString(j);
if ((int) tmpStr.size() > maxLength)
if ((int)tmpStr.size() > maxLength)
maxLength = tmpStr.size();
_vm->_text->displayStr(tmpStr, 100, optionPosY, 100, 1, 0);
choiceArray[prevChoice] = tmpStr;
@@ -2491,7 +2491,7 @@ int MortevielleEngine::getAnimOffset(int frameNum, int animNum) {
*/
void MortevielleEngine::displayTextInDescriptionBar(int x, int y, int nb, int mesgId) {
Common::String tmpStr = getString(mesgId);
if ((y == 182) && ((int) tmpStr.size() > nb))
if ((y == 182) && ((int)tmpStr.size() > nb))
y = 176;
_text->displayStr(tmpStr, x, y, nb, 20, _textColor);
}
@@ -2504,7 +2504,7 @@ void MortevielleEngine::handleDescriptionText(int f, int mesgId) {
if ((mesgId > 499) && (mesgId < 563)) {
Common::String tmpStr = getString(mesgId - 501 + kInventoryStringIndex);

if ((int) tmpStr.size() > ((58 + (kResolutionScaler - 1) * 37) << 1))
if ((int)tmpStr.size() > ((58 + (kResolutionScaler - 1) * 37) << 1))
_largestClearScreen = true;
else
_largestClearScreen = false;
@@ -184,15 +184,15 @@ struct Anim {
case kAnimX:
return _x;
default:
error("getAnimData() - Wrong offset type: %d", (int) offset);
error("getAnimData() - Wrong offset type: %d", (int)offset);
}
}

void setAnimData(Anim::AnimOffsets offset, int16 value) {
if (offset == kAnimX) {
_x = value;
} else {
error("setAnimData() - Wrong offset: %d, value: %d", (int) offset, value);
error("setAnimData() - Wrong offset: %d, value: %d", (int)offset, value);
}
}
};
@@ -250,7 +250,7 @@ byte *loadShortenFromStream(Common::ReadStream &stream, int &size, int &rate, by

// Get block size
if (version > 0) {
blockSize = gReader->getUint32((int) (log((double) DEFAULT_BLOCK_SIZE) / M_LN2));
blockSize = gReader->getUint32((int)(log((double) DEFAULT_BLOCK_SIZE) / M_LN2));
maxLPC = gReader->getUint32(2);
mean = gReader->getUint32(0);
uint32 skipBytes = gReader->getUint32(1);
@@ -1808,7 +1808,7 @@ void Gdi::drawBitmap(const byte *ptr, VirtScreen *vs, int x, const int y, const
// It was added as a kind of hack to fix some corner cases, but it compares
// the room width to the virtual screen width; but the former should always
// be bigger than the latter (except for MM NES, maybe)... strange
int limit = MAX(_vm->_roomWidth, (int) vs->w) / 8 - x;
int limit = MAX(_vm->_roomWidth, (int)vs->w) / 8 - x;
if (limit > numstrip)
limit = numstrip;
if (limit > _numStrips - sx)
@@ -878,9 +878,9 @@ void ScummEngine::setShadowPalette(int redScale, int greenScale, int blueScale,
}

for (i = start; i < end; i++) {
int r = (int) ((pal[0] >> 2) * redScale) >> 8;
int g = (int) ((pal[1] >> 2) * greenScale) >> 8;
int b = (int) ((pal[2] >> 2) * blueScale) >> 8;
int r = (int)((pal[0] >> 2) * redScale) >> 8;
int g = (int)((pal[1] >> 2) * greenScale) >> 8;
int b = (int)((pal[2] >> 2) * blueScale) >> 8;
pal += 3;

uint8 bestitem = 0;
@@ -416,7 +416,7 @@ void Player_V1::nextPCjrCmd() {
switch (_channels[i].hull_counter) {
case 1:
_channels[i].volume -= _channels[i].attack;
if ((int) _channels[i].volume <= 0) {
if ((int)_channels[i].volume <= 0) {
_channels[i].volume = 0;
_channels[i].hull_counter++;
}
@@ -432,7 +432,7 @@ void Player_V1::nextPCjrCmd() {
if (--_channels[i].sustctr < 0) {
_channels[i].sustctr = _channels[i].sustain_2;
_channels[i].volume += _channels[i].sustain_1;
if ((int) _channels[i].volume >= 15) {
if ((int)_channels[i].volume >= 15) {
_channels[i].volume = 15;
_channels[i].hull_counter++;
}
@@ -85,7 +85,7 @@ void Player_V2::setMusicVolume (int vol) {
if (out > 0xffff)
_volumetable[i] = 0xffff;
else
_volumetable[i] = (int) out;
_volumetable[i] = (int)out;

out /= 1.258925412; /* = 10 ^ (2/20) = 2dB */
}
@@ -191,7 +191,7 @@ int Player_V2::readBuffer(int16 *data, const int numSamples) {

void Player_V2::lowPassFilter(int16 *sample, uint len) {
for (uint i = 0; i < len; i++) {
_level = (int) (_level * _decay
_level = (int)(_level * _decay
+ sample[0] * (0x10000 - _decay)) >> 16;
sample[0] = sample[1] = _level;
sample += 2;
Oops, something went wrong.

0 comments on commit 11e33ba

Please sign in to comment.