WINTERMUTE: "if(" -> "if ("

This commit is contained in:
Einar Johan Trøan Sømåen 2012-07-25 21:21:55 +02:00
parent fa96c9ea18
commit 1ad859a468
23 changed files with 63 additions and 70 deletions

View file

@ -650,7 +650,7 @@ bool AdEntity::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack
if (_theora && DID_SUCCEED(_theora->initialize(filename))) {
if (!valAlpha->isNULL()) _theora->setAlphaImage(valAlpha->getString());
_theora->play(VID_PLAY_POS, 0, 0, false, false, looping, startTime, _scale >= 0.0f ? _scale : -1.0f, _sFXVolume);
//if(m_Scale>=0) m_Theora->m_PlayZoom = m_Scale;
//if (_scale>=0) _theora->_playZoom = _scale;
stack->pushBool(true);
} else {
script->runtimeError("Entity.PlayTheora - error playing video '%s'", filename);

View file

@ -335,7 +335,7 @@ bool AdGame::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack,
//bool ret = ChangeScene(stack->pop()->getString());
//if(DID_FAIL(ret)) stack->pushBool(false);
//if (DID_FAIL(ret)) stack->pushBool(false);
//else stack->pushBool(true);
return STATUS_OK;
@ -821,7 +821,7 @@ ScValue *AdGame::scGetProperty(const char *name) {
// SelectedItem
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "SelectedItem") == 0) {
//if(_selectedItem) _scValue->setString(_selectedItem->_name);
//if (_selectedItem) _scValue->setString(_selectedItem->_name);
if (_selectedItem) _scValue->setNative(_selectedItem, true);
else _scValue->setNULL();

View file

@ -2491,7 +2491,7 @@ bool AdScene::persistState(bool saving) {
nodeState = state->getNodeState(node->_entity->getName(), saving);
if (nodeState) {
nodeState->transferEntity(node->_entity, _persistentStateSprites, saving);
//if(Saving) NodeState->_active = node->_entity->_active;
//if (Saving) NodeState->_active = node->_entity->_active;
//else node->_entity->_active = NodeState->_active;
}
break;
@ -2517,7 +2517,7 @@ bool AdScene::persistState(bool saving) {
nodeState = state->getNodeState(_objects[i]->getName(), saving);
if (nodeState) {
nodeState->transferEntity((AdEntity *)_objects[i], _persistentStateSprites, saving);
//if(Saving) NodeState->_active = _objects[i]->_active;
//if (Saving) NodeState->_active = _objects[i]->_active;
//else _objects[i]->_active = NodeState->_active;
}
}
@ -2684,7 +2684,7 @@ bool AdScene::getSceneObjects(BaseArray<AdObject *, AdObject *> &objects, bool i
}
if (!found) objects.add(regionObj[newIndex]);
}
//if(RegionObj.getSize() > 0) Objects.Append(RegionObj);
//if (RegionObj.getSize() > 0) Objects.Append(RegionObj);
}
break;
default:

View file

@ -320,7 +320,7 @@ bool AdTalkHolder::scSetProperty(const char *name, ScValue *value) {
//////////////////////////////////////////////////////////////////////////
// Item
//////////////////////////////////////////////////////////////////////////
if(strcmp(name, "Item")==0){
if (strcmp(name, "Item")==0){
SetItem(value->getString());
return STATUS_OK;
}

View file

@ -3242,7 +3242,7 @@ bool BaseGame::loadGame(const char *filename) {
BasePersistenceManager *pm = new BasePersistenceManager(_gameRef);
if (DID_FAIL(ret = pm->initLoad(filename))) goto load_finish;
//if(DID_FAIL(ret = cleanup())) goto load_finish;
//if (DID_FAIL(ret = cleanup())) goto load_finish;
if (DID_FAIL(ret = SystemClassRegistry::getInstance()->loadTable(_gameRef, pm))) goto load_finish;
if (DID_FAIL(ret = SystemClassRegistry::getInstance()->loadInstances(_gameRef, pm))) goto load_finish;
@ -3873,7 +3873,7 @@ bool BaseGame::setActiveObject(BaseObject *obj) {
if (obj == _activeObject) return STATUS_OK;
if (_activeObject) _activeObject->applyEvent("MouseLeave");
//if(ValidObject(_activeObject)) _activeObject->applyEvent("MouseLeave");
//if (ValidObject(_activeObject)) _activeObject->applyEvent("MouseLeave");
_activeObject = obj;
if (_activeObject) {
_activeObject->applyEvent("MouseEntry");

View file

@ -215,7 +215,7 @@ bool BaseKeyboardState::readKey(Common::Event *event) {
//////////////////////////////////////////////////////////////////////////
bool BaseKeyboardState::persist(BasePersistenceManager *persistMgr) {
//if(!persistMgr->getIsSaving()) cleanup();
//if (!persistMgr->getIsSaving()) cleanup();
BaseScriptable::persist(persistMgr);
persistMgr->transfer(TMEMBER(_currentAlt));

View file

@ -49,7 +49,7 @@ BaseScriptable::BaseScriptable(BaseGame *inGame, bool noValue, bool persistable)
//////////////////////////////////////////////////////////////////////////
BaseScriptable::~BaseScriptable() {
//if(_refCount>0) _gameRef->LOG(0, "Warning: Destroying object, _refCount=%d", _refCount);
//if (_refCount>0) _gameRef->LOG(0, "Warning: Destroying object, _refCount=%d", _refCount);
delete _scValue;
delete _scProp;
_scValue = NULL;

View file

@ -329,7 +329,7 @@ void BaseSprite::reset() {
//////////////////////////////////////////////////////////////////////
bool BaseSprite::GetCurrentFrame(float zoomX, float zoomY) {
//if(_owner && _owner->_freezable && _gameRef->_state == GAME_FROZEN) return true;
//if (_owner && _owner->_freezable && _gameRef->_state == GAME_FROZEN) return true;
if (_currentFrame == -1) return false;

View file

@ -189,7 +189,7 @@ bool BaseSubFrame::loadBuffer(byte *buffer, int lifeTime, bool keepLoaded) {
if (custoTrans) _transparent = BYTETORGBA(r, g, b, 0xFF);
/*
if(_surface == NULL)
if (_surface == NULL)
{
_gameRef->LOG(0, "Error parsing sub-frame. Image not set.");
return STATUS_FAILED;
@ -217,7 +217,7 @@ bool BaseSubFrame::draw(int x, int y, BaseObject *registerOwner, float zoomX, fl
bool res;
//if(Alpha==0xFFFFFFFF) Alpha = _alpha; // TODO: better (combine owner's and self alpha)
//if (Alpha==0xFFFFFFFF) Alpha = _alpha; // TODO: better (combine owner's and self alpha)
if (_alpha != 0xFFFFFFFF) alpha = _alpha;
if (rotate != 0.0f) {

View file

@ -147,7 +147,7 @@ bool BaseSurfaceStorage::restoreAll() {
bool BaseSurfaceStorage::persist(BasePersistenceManager *persistMgr)
{
if(!persistMgr->getIsSaving()) cleanup(false);
if (!persistMgr->getIsSaving()) cleanup(false);
persistMgr->transfer(TMEMBER(_gameRef));

View file

@ -73,7 +73,7 @@ int BaseFont::getTextWidth(byte *text, int maxLength) {
bool BaseFont::loadFile(const char * Filename)
{
BYTE* Buffer = _gameRef->_fileManager->readWholeFile(filename);
if(Buffer==NULL){
if (Buffer==NULL){
_gameRef->LOG(0, "BaseFont::LoadFile failed for file '%s'", filename);
return STATUS_FAILED;
}
@ -83,7 +83,7 @@ bool BaseFont::loadFile(const char * Filename)
_filename = new char [strlen(filename)+1];
strcpy(_filename, filename);
if(DID_FAIL(ret = loadBuffer(Buffer))) _gameRef->LOG(0, "Error parsing FONT file '%s'", filename);
if (DID_FAIL(ret = loadBuffer(Buffer))) _gameRef->LOG(0, "Error parsing FONT file '%s'", filename);
delete[] Buffer;
@ -105,7 +105,7 @@ bool BaseFont::loadBuffer(byte * Buffer)
int cmd;
BaseParser parser(_gameRef);
if(parser.GetCommand ((char**)&Buffer, commands, (char**)&params)!=TOKEN_FONT){
if (parser.GetCommand ((char**)&Buffer, commands, (char**)&params)!=TOKEN_FONT){
_gameRef->LOG(0, "'FONT' keyword expected.");
return STATUS_FAILED;
}

View file

@ -591,11 +591,11 @@ bool ScScript::executeInstruction() {
}
/*
ScValue* val = var->getProp(MethodName);
if(val){
if (val){
dw = GetFuncPos(val->getString());
if(dw==0){
if (dw==0){
TExternalFunction* f = GetExternal(val->getString());
if(f){
if (f){
ExternalCall(_stack, _thisStack, f);
}
else{
@ -776,7 +776,7 @@ bool ScScript::executeInstruction() {
case II_JMP_FALSE: {
dw = getDWORD();
//if(!_stack->pop()->getBool()) _iP = dw;
//if (!_stack->pop()->getBool()) _iP = dw;
ScValue *val = _stack->pop();
if (!val) {
runtimeError("Script corruption detected. Did you use '=' instead of '==' for comparison?");
@ -864,7 +864,7 @@ bool ScScript::executeInstruction() {
case II_NOT:
op1 = _stack->pop();
//if(op1->isNULL()) _operand->setNULL();
//if (op1->isNULL()) _operand->setNULL();
if (op1->isNULL()) _operand->setBool(true);
else _operand->setBool(!op1->getBool());
_stack->push(_operand);
@ -900,14 +900,14 @@ bool ScScript::executeInstruction() {
op1 = _stack->pop();
/*
if((op1->isNULL() && !op2->isNULL()) || (!op1->isNULL() && op2->isNULL())) _operand->setBool(false);
else if(op1->isNative() && op2->isNative()){
if ((op1->isNULL() && !op2->isNULL()) || (!op1->isNULL() && op2->isNULL())) _operand->setBool(false);
else if (op1->isNative() && op2->isNative()){
_operand->setBool(op1->getNative() == op2->getNative());
}
else if(op1->getType()==VAL_STRING || op2->getType()==VAL_STRING){
else if (op1->getType()==VAL_STRING || op2->getType()==VAL_STRING){
_operand->setBool(scumm_stricmp(op1->getString(), op2->getString())==0);
}
else if(op1->getType()==VAL_FLOAT && op2->getType()==VAL_FLOAT){
else if (op1->getType()==VAL_FLOAT && op2->getType()==VAL_FLOAT){
_operand->setBool(op1->getFloat() == op2->getFloat());
}
else{
@ -924,14 +924,14 @@ bool ScScript::executeInstruction() {
op1 = _stack->pop();
/*
if((op1->isNULL() && !op2->isNULL()) || (!op1->isNULL() && op2->isNULL())) _operand->setBool(true);
else if(op1->isNative() && op2->isNative()){
if ((op1->isNULL() && !op2->isNULL()) || (!op1->isNULL() && op2->isNULL())) _operand->setBool(true);
else if (op1->isNative() && op2->isNative()){
_operand->setBool(op1->getNative() != op2->getNative());
}
else if(op1->getType()==VAL_STRING || op2->getType()==VAL_STRING){
else if (op1->getType()==VAL_STRING || op2->getType()==VAL_STRING){
_operand->setBool(scumm_stricmp(op1->getString(), op2->getString())!=0);
}
else if(op1->getType()==VAL_FLOAT && op2->getType()==VAL_FLOAT){
else if (op1->getType()==VAL_FLOAT && op2->getType()==VAL_FLOAT){
_operand->setBool(op1->getFloat() != op2->getFloat());
}
else{
@ -948,7 +948,7 @@ bool ScScript::executeInstruction() {
op1 = _stack->pop();
/*
if(op1->getType()==VAL_FLOAT && op2->getType()==VAL_FLOAT){
if (op1->getType()==VAL_FLOAT && op2->getType()==VAL_FLOAT){
_operand->setBool(op1->getFloat() < op2->getFloat());
}
else _operand->setBool(op1->getInt() < op2->getInt());
@ -963,7 +963,7 @@ bool ScScript::executeInstruction() {
op1 = _stack->pop();
/*
if(op1->getType()==VAL_FLOAT && op2->getType()==VAL_FLOAT){
if (op1->getType()==VAL_FLOAT && op2->getType()==VAL_FLOAT){
_operand->setBool(op1->getFloat() > op2->getFloat());
}
else _operand->setBool(op1->getInt() > op2->getInt());
@ -978,7 +978,7 @@ bool ScScript::executeInstruction() {
op1 = _stack->pop();
/*
if(op1->getType()==VAL_FLOAT && op2->getType()==VAL_FLOAT){
if (op1->getType()==VAL_FLOAT && op2->getType()==VAL_FLOAT){
_operand->setBool(op1->getFloat() <= op2->getFloat());
}
else _operand->setBool(op1->getInt() <= op2->getInt());
@ -993,7 +993,7 @@ bool ScScript::executeInstruction() {
op1 = _stack->pop();
/*
if(op1->getType()==VAL_FLOAT && op2->getType()==VAL_FLOAT){
if (op1->getType()==VAL_FLOAT && op2->getType()==VAL_FLOAT){
_operand->setBool(op1->getFloat() >= op2->getFloat());
}
else _operand->setBool(op1->getInt() >= op2->getInt());
@ -1257,7 +1257,7 @@ bool ScScript::persist(BasePersistenceManager *persistMgr) {
//////////////////////////////////////////////////////////////////////////
ScScript *ScScript::invokeEventHandler(const char *eventName, bool unbreakable) {
//if(_state!=SCRIPT_PERSISTENT) return NULL;
//if (_state!=SCRIPT_PERSISTENT) return NULL;
uint32 pos = getEventPos(eventName);
if (!pos) return NULL;

View file

@ -257,14 +257,14 @@ bool ScEngine::tick() {
bool obj_found=false;
for(int j=0; j<_gameRef->_regObjects.getSize(); j++)
{
if(_gameRef->_regObjects[j] == _scripts[i]->_waitObject)
if (_gameRef->_regObjects[j] == _scripts[i]->_waitObject)
{
if(_gameRef->_regObjects[j]->IsReady()) _scripts[i]->Run();
if (_gameRef->_regObjects[j]->IsReady()) _scripts[i]->Run();
obj_found = true;
break;
}
}
if(!obj_found) _scripts[i]->finish(); // _waitObject no longer exists
if (!obj_found) _scripts[i]->finish(); // _waitObject no longer exists
*/
if (_gameRef->validObject(_scripts[i]->_waitObject)) {
if (_scripts[i]->_waitObject->isReady()) _scripts[i]->run();

View file

@ -228,7 +228,7 @@ bool SXDate::scSetProperty(const char *name, ScValue *value) {
//////////////////////////////////////////////////////////////////////////
// Name
//////////////////////////////////////////////////////////////////////////
if(strcmp(name, "Name")==0){
if (strcmp(name, "Name")==0){
setName(value->getString());
return STATUS_OK;
}

View file

@ -663,12 +663,12 @@ bool SXFile::scSetProperty(const char *name, ScValue *value) {
//////////////////////////////////////////////////////////////////////////
// Length
//////////////////////////////////////////////////////////////////////////
if(strcmp(name, "Length")==0){
if (strcmp(name, "Length")==0){
int OrigLength = _length;
_length = max(value->getInt(0), 0);
char PropName[20];
if(_length < OrigLength){
if (_length < OrigLength){
for(int i=_length; i<OrigLength; i++){
sprintf(PropName, "%d", i);
_values->DeleteProp(PropName);

View file

@ -462,12 +462,12 @@ bool SXMemBuffer::scSetProperty(const char *name, ScValue *value) {
//////////////////////////////////////////////////////////////////////////
// Length
//////////////////////////////////////////////////////////////////////////
if(strcmp(name, "Length")==0){
if (strcmp(name, "Length")==0){
int OrigLength = _length;
_length = max(value->getInt(0), 0);
char PropName[20];
if(_length < OrigLength){
if (_length < OrigLength){
for(int i=_length; i<OrigLength; i++){
sprintf(PropName, "%d", i);
_values->DeleteProp(PropName);

View file

@ -240,7 +240,7 @@ bool ScValue::setProp(const char *name, ScValue *val, bool copyWhole, bool setAs
val->_isConstVar = SetAsConst;
_valObject[Name] = val;
if(_type!=VAL_NATIVE) _type = VAL_OBJECT;
if (_type!=VAL_NATIVE) _type = VAL_OBJECT;
*/
}

View file

@ -148,22 +148,22 @@ bool BaseSoundBuffer::loadFromFile(const char *filename, bool forceReload) {
bool res;
bool NewlyCreated = false;
if(!_soundBuffer || ForceReload || _streamed){
if(!_file) _file = _gameRef->_fileManager->openFile(filename);
if(!_file){
if (!_soundBuffer || ForceReload || _streamed){
if (!_file) _file = _gameRef->_fileManager->openFile(filename);
if (!_file){
_gameRef->LOG(0, "Error opening sound file '%s'", filename);
return STATUS_FAILED;
}
// switch to streamed for big files
if(!_streamed && (_file->GetSize() > MAX_NONSTREAMED_FILE_SIZE && !_gameRef->_forceNonStreamedSounds)) SetStreaming(true);
if (!_streamed && (_file->GetSize() > MAX_NONSTREAMED_FILE_SIZE && !_gameRef->_forceNonStreamedSounds)) SetStreaming(true);
}
// create buffer
if(!_soundBuffer){
if (!_soundBuffer){
NewlyCreated = true;
res = InitializeBuffer(_file);
if(DID_FAIL(res)){
if (DID_FAIL(res)){
_gameRef->LOG(res, "Error creating sound buffer for file '%s'", filename);
return res;
}
@ -172,13 +172,13 @@ bool BaseSoundBuffer::loadFromFile(const char *filename, bool forceReload) {
// store filename
if(!_filename){
if (!_filename){
_filename = new char[strlen(filename)+1];
strcpy(_filename, filename);
}
// close file (if not streaming)
if(!_streamed && _file){
if (!_streamed && _file){
_gameRef->_fileManager->closeFile(_file);
_file = NULL;
}

View file

@ -48,11 +48,4 @@
#define COMPRESSED_FILE_MAGIC 0x504D435A // ZCMP
#ifdef GetClassName
#undef GetClassName
#endif
// macros
#define RELEASE(obj) if(obj) { obj->Release(); obj = NULL; } else 0
#endif // _DCGF_H_

View file

@ -627,7 +627,7 @@ bool UIButton::display(int offsetX, int offsetY) {
}
if (back) back->display(offsetX + _posX, offsetY + _posY, _width, _height);
//if(image) image->Draw(ImageX +((_press||_oneTimePress)&&back?1:0), ImageY +((_press||_oneTimePress)&&back?1:0), NULL);
//if (image) image->Draw(ImageX +((_press||_oneTimePress)&&back?1:0), ImageY +((_press||_oneTimePress)&&back?1:0), NULL);
if (image) image->draw(imageX + ((_press || _oneTimePress) && back ? 1 : 0), imageY + ((_press || _oneTimePress) && back ? 1 : 0), _pixelPerfect ? this : NULL);
if (font && _text) {

View file

@ -217,11 +217,11 @@ bool VideoPlayer::update() {
DWORD CurrentTime; // current playing time (in ms)
/*
if(m_SoundAvailable && m_Sound){
if (m_SoundAvailable && m_Sound){
CurrentTime = m_Sound->GetPosition(); // in samples
CurrentTime /= (m_Sound->m_Format.wf.nSamplesPerSec / 1000);
if(!m_Sound->IsPlaying()) CurrentTime = m_TotalVideoTime;
if (!m_Sound->IsPlaying()) CurrentTime = m_TotalVideoTime;
}
else
CurrentTime = timeGetTime() - m_StartTime;

View file

@ -547,7 +547,7 @@ bool VideoTheoraPlayer::update() {
// If playback has begun, top audio buffer off immediately.
//if(m_Sound) WriteAudio();
//if (m_Sound) WriteAudio();
// are we at or past time for this video frame?
if (m_PlaybackStarted && m_VideoFrameReady && (!m_FrameRendered || m_VideobufTime <= GetMovieTime())) {

View file

@ -165,7 +165,7 @@ int WinterMuteEngine::init() {
bool windowedMode = !ConfMan.getBool("fullscreen");
// parse command line
char *SaveGame = NULL;
char *saveGame = NULL;
/* for (int i = 0; i < argc; i++) {
strcpy(param, argv[i]);
@ -268,9 +268,9 @@ int WinterMuteEngine::init() {
_game->loadGame(str.c_str());
}
if (SaveGame) {
_game->loadGame(SaveGame);
delete[] SaveGame;
if (saveGame) {
_game->loadGame(saveGame);
delete[] saveGame;
}
// all set, ready to go
@ -314,9 +314,9 @@ int WinterMuteEngine::messageLoop() {
if (_game) {
// remember previous window position
/*
if(_game->_renderer && _game->_renderer->_windowed)
if (_game->_renderer && _game->_renderer->_windowed)
{
if(!::IsIconic(_game->_renderer->_window))
if (!::IsIconic(_game->_renderer->_window))
{
int PosX = _game->_renderer->_windowRect.left;
int PosY = _game->_renderer->_windowRect.top;