Example #1
0
void CursorManager::changeCursor(const Common::String &cursorName, bool pushed) {
	if (_currentCursor.equals(cursorName) && _cursorIsPushed == pushed)
		return;

	if (_cursorIsPushed != pushed)
		_cursorIsPushed = pushed;

	if (cursorName == "idle" && !pushed) {
		CursorMan.replaceCursor(_idleCursor.getSurface(), _idleCursor.getWidth(), _idleCursor.getHeight(), _idleCursor.getHotspotX(), _idleCursor.getHotspotY(), _idleCursor.getKeyColor(), false, _pixelFormat);
		return;
	}

	for (int i = 0; i < NUM_CURSORS; ++i) {
		if (_engine->getGameId() == GID_NEMESIS) {
			if (cursorName.equals(_cursorNames[i])) {
				_currentCursor = cursorName;

				// ZNem uses a/b at the end of the file to signify not pushed/pushed respectively
				Common::String pushedFlag = pushed ? "b" : "a";
				Common::String name = Common::String::format("%s%s.zcr", _zNemCursorFileNames[i], pushedFlag.c_str());

				changeCursor(ZorkCursor(name));
				return;
			}
		} else if (_engine->getGameId() == GID_GRANDINQUISITOR) {
			if (cursorName.equals(_cursorNames[i])) {
				_currentCursor = cursorName;

				if (!pushed) {
					changeCursor(ZorkCursor(_zgiCursorFileNames[i]));
				} else {
					// ZGI flips not pushed/pushed between a/c and b/d
					// It flips the 4th character of the name
					char buffer[25];
					strcpy(buffer, _zgiCursorFileNames[i]);
					buffer[3] += 2;
					changeCursor(ZorkCursor(buffer));
				}
				return;
			}
		}
	}

	// If we get here, something went wrong
	warning("No cursor found for identifier %s", cursorName.c_str());
}
Example #2
0
MidiDriver::DeviceHandle MidiDriver::getDeviceHandle(const Common::String &identifier) {
    const MusicPlugin::List p = MusicMan.getPlugins();

    if (p.begin() == p.end())
        error("Music plugins must be loaded prior to calling this method");

    for (MusicPlugin::List::const_iterator m = p.begin(); m != p.end(); m++) {
        MusicDevices i = (**m)->getDevices();
        for (MusicDevices::iterator d = i.begin(); d != i.end(); d++) {
            // The music driver id isn't unique, but it will match
            // driver's first device. This is useful when selecting
            // the driver from the command line.
            if (identifier.equals(d->getMusicDriverId()) || identifier.equals(d->getCompleteId()) || identifier.equals(d->getCompleteName())) {
                return d->getHandle();
            }
        }
    }

    return 0;
}
Example #3
0
bool SaveGametests::readAndVerifyData(const char *fileName, const char *expected) {
	Common::SaveFileManager *saveFileMan = g_system->getSavefileManager();
	Common::InSaveFile *loadFile = saveFileMan->openForLoading(fileName);

	if (!loadFile) {
		Testsuite::logDetailedPrintf("Can't open save File to load\n");
		return false;
	}

	Common::String lineToRead = loadFile->readLine();
	delete loadFile;

	if (lineToRead.equals(expected)) {
		return true;
	}

	return false;
}