diff options
71 files changed, 652 insertions, 652 deletions
diff --git a/base/main.cpp b/base/main.cpp index 097eb04e73..acba304c9e 100644 --- a/base/main.cpp +++ b/base/main.cpp @@ -137,7 +137,7 @@ static Common::Error runGame(const EnginePlugin *plugin, OSystem &system, const // Verify that the game path refers to an actual directory if (!(dir.exists() && dir.isDirectory())) err = Common::kInvalidPathError; - + // Create the game engine if (err == Common::kNoError) err = (*plugin)->createInstance(&system, &engine); diff --git a/base/plugins.cpp b/base/plugins.cpp index cea8232e59..a751afc1b4 100644 --- a/base/plugins.cpp +++ b/base/plugins.cpp @@ -125,7 +125,7 @@ public: #endif #if PLUGIN_ENABLED_STATIC(MADE) LINK_PLUGIN(MADE) - #endif + #endif #if PLUGIN_ENABLED_STATIC(PARALLACTION) LINK_PLUGIN(PARALLACTION) #endif diff --git a/base/plugins.h b/base/plugins.h index bb99818648..faf256c6b5 100644 --- a/base/plugins.h +++ b/base/plugins.h @@ -194,7 +194,7 @@ public: /** * Abstract base class for Plugin factories. Subclasses of this - * are responsible for creating plugin objects, e.g. by loading + * are responsible for creating plugin objects, e.g. by loading * loadable modules from storage media; by creating "fake" plugins * from static code; or whatever other means. */ @@ -226,7 +226,7 @@ public: * Return a list of Plugin objects loaded via createPlugin from disk. * For this, a list of directories is searched for plugin objects: * The current dir and its "plugins" subdirectory (if present), a list - * of custom search dirs (see addCustomDirectories) and finally the + * of custom search dirs (see addCustomDirectories) and finally the * directory specified via the "pluginspath" config variable (if any). * * @return a list of Plugin instances @@ -258,7 +258,7 @@ protected: * plugins by getPlugins(). * * @param dirs the reference to the list of directories to be used when - * searching for plugins. + * searching for plugins. */ virtual void addCustomDirectories(Common::FSList &dirs) const; }; diff --git a/common/advancedDetector.cpp b/common/advancedDetector.cpp index 3acf44f067..e3637e81c9 100644 --- a/common/advancedDetector.cpp +++ b/common/advancedDetector.cpp @@ -445,7 +445,7 @@ static ADGameDescList detectGame(const FSList &fslist, const Common::ADParams &p if (matched.empty()) { if (!filesSizeMD5.empty()) reportUnknown(filesSizeMD5); - + // Filename based fallback if (params.fileBasedFallback != 0) matched = detectGameFilebased(allFiles, params); @@ -484,11 +484,11 @@ static ADGameDescList detectGameFilebased(const FileMap &allFiles, const Common: if (!fileMissing) { debug(4, "Matched: %s", agdesc->gameid); - + if (numMatchedFiles > maxNumMatchedFiles) { matchedDesc = agdesc; maxNumMatchedFiles = numMatchedFiles; - + debug(4, "and overriden"); } } diff --git a/common/algorithm.h b/common/algorithm.h index 3b6c63d55c..2b02dbc016 100644 --- a/common/algorithm.h +++ b/common/algorithm.h @@ -45,7 +45,7 @@ Out copy(In first, In last, Out dst) { * Copies data from the range [first, last) to [dst - (last - first), dst). * It requires the range [dst - (last - first), dst) to be valid. * It also requires dst not to be in the range [first, last). - * + * * Unlike copy copy_backward copies the data from the end to the beginning. */ template<class In, class Out> diff --git a/common/archive.cpp b/common/archive.cpp index 8a3e08bf78..b4f4dcd3a6 100644 --- a/common/archive.cpp +++ b/common/archive.cpp @@ -70,7 +70,7 @@ int Archive::listMatchingMembers(ArchiveMemberList &list, const String &pattern) * by FSDirectory. It is right now a light wrapper or FSNode. */ class FSDirectoryMember : public ArchiveMember { - FSNode _node; + FSNode _node; public: FSDirectoryMember(FSNode &node) : _node(node) { diff --git a/common/archive.h b/common/archive.h index 0085e997ab..5e331052b2 100644 --- a/common/archive.h +++ b/common/archive.h @@ -275,13 +275,13 @@ public: bool hasArchive(const String &name) const; /** - * Empties the searchable set. - */ + * Empties the searchable set. + */ virtual void clear(); /** - * Change the order of searches. - */ + * Change the order of searches. + */ void setPriority(const String& name, int priority); virtual bool hasFile(const String &name); diff --git a/common/config-file.cpp b/common/config-file.cpp index c3764a02da..a05a9ee0d3 100644 --- a/common/config-file.cpp +++ b/common/config-file.cpp @@ -135,7 +135,7 @@ bool ConfigFile::loadFromStream(SeekableReadStream &stream) { assert(isValidName(section.name)); } else { // This line should be a line with a 'key=value' pair, or an empty one. - + // Skip leading whitespaces const char *t = line.c_str(); while (isspace(*t)) @@ -158,7 +158,7 @@ bool ConfigFile::loadFromStream(SeekableReadStream &stream) { // Extract the key/value pair kv.key = String(t, p); kv.value = String(p + 1); - + // Trim of spaces kv.key.trim(); kv.value.trim(); diff --git a/common/config-manager.cpp b/common/config-manager.cpp index 13abe085e2..e0a8dfa56b 100644 --- a/common/config-manager.cpp +++ b/common/config-manager.cpp @@ -68,7 +68,7 @@ void ConfigManager::loadDefaultConfigFile() { // ... load it, if available ... if (stream) loadFromStream(*stream); - + // ... and close it again. delete stream; @@ -142,7 +142,7 @@ void ConfigManager::loadFromStream(SeekableReadStream &stream) { _domainSaveOrder.push_back(domain); } else { // This line should be a line with a 'key=value' pair, or an empty one. - + // Skip leading whitespaces const char *t = line.c_str(); while (isspace(*t)) @@ -165,7 +165,7 @@ void ConfigManager::loadFromStream(SeekableReadStream &stream) { // Extract the key/value pair String key(t, p); String value(p + 1); - + // Trim of spaces key.trim(); value.trim(); @@ -202,7 +202,7 @@ void ConfigManager::flushToDisk() { delete dump; return; } - + stream = dump; } diff --git a/common/error.h b/common/error.h index 1f5fed7ea6..23305a5c2e 100644 --- a/common/error.h +++ b/common/error.h @@ -48,11 +48,11 @@ enum Error { kInvalidPathError, //!< Engine initialization: Invalid game path was passed kNoGameDataFoundError, //!< Engine initialization: No game data was found in the specified location kUnsupportedGameidError, //!< Engine initialization: Gameid not supported by this (Meta)Engine - - + + kReadPermissionDenied, //!< Unable to read data due to missing read permission kWritePermissionDenied, //!< Unable to write data due to missing write permission - + // The following three overlap a bit with kInvalidPathError and each other. Which to keep? kPathDoesNotExist, //!< The specified path does not exist kPathNotDirectory, //!< The specified path does not point to a directory diff --git a/common/events.h b/common/events.h index dd45ca18c1..c1655a17f3 100644 --- a/common/events.h +++ b/common/events.h @@ -122,7 +122,7 @@ struct Event { * screen area as defined by the most recent call to initSize(). */ Common::Point mouse; - + Event() : type(EVENT_INVALID), synthetic(false) {} }; diff --git a/common/file.cpp b/common/file.cpp index 76a9f94505..51736ccd67 100644 --- a/common/file.cpp +++ b/common/file.cpp @@ -69,7 +69,7 @@ bool File::open(const String &filename, Archive &archive) { debug(3, "Opening hashed: %s.", filename.c_str()); stream = archive.openFile(filename + "."); } - + return open(stream, filename); } @@ -110,7 +110,7 @@ bool File::exists(const String &filename) { // sometimes instead of "GAMEPC" we get "GAMEPC." (note trailing dot) return true; } - + return false; } diff --git a/common/file.h b/common/file.h index 43392ba7fa..28c99e0e38 100644 --- a/common/file.h +++ b/common/file.h @@ -86,7 +86,7 @@ public: /** * Try to open the file corresponding to the give node. Will check whether the - * node actually refers to an existing file (and not a directory), and handle + * node actually refers to an existing file (and not a directory), and handle * those cases gracefully. * @note Must not be called if this file already is open (i.e. if isOpen returns true). * diff --git a/common/fs.cpp b/common/fs.cpp index 497e961680..de553d42b7 100644 --- a/common/fs.cpp +++ b/common/fs.cpp @@ -32,14 +32,14 @@ namespace Common { FSNode::FSNode() { } -FSNode::FSNode(AbstractFSNode *realNode) +FSNode::FSNode(AbstractFSNode *realNode) : _realNode(realNode) { } FSNode::FSNode(const Common::String &p) { FilesystemFactory *factory = g_system->getFilesystemFactory(); AbstractFSNode *tmp = 0; - + if (p.empty() || p == ".") tmp = factory->makeCurrentDirectoryFileNode(); else diff --git a/common/hashmap.cpp b/common/hashmap.cpp index b8f2608901..0fb03ec3f8 100644 --- a/common/hashmap.cpp +++ b/common/hashmap.cpp @@ -74,7 +74,7 @@ void updateHashCollisionStats(int collisions, int lookups, int arrsize, int nele g_capacity += arrsize; g_size += nele; g_totalHashmaps++; - + if (3*nele <= 2*8) g_stats[0]++; if (3*nele <= 2*16) @@ -83,7 +83,7 @@ void updateHashCollisionStats(int collisions, int lookups, int arrsize, int nele g_stats[2]++; if (3*nele <= 2*64) g_stats[3]++; - + g_max_capacity = MAX(g_max_capacity, arrsize); g_max_size = MAX(g_max_size, nele); @@ -95,9 +95,9 @@ void updateHashCollisionStats(int collisions, int lookups, int arrsize, int nele g_size / g_totalHashmaps, g_max_size, g_capacity / g_totalHashmaps, g_max_capacity); fprintf(stdout, " %d less than %d; %d less than %d; %d less than %d; %d less than %d\n", - g_stats[0], 2*8/3, - g_stats[1],2*16/3, - g_stats[2],2*32/3, + g_stats[0], 2*8/3, + g_stats[1],2*16/3, + g_stats[2],2*32/3, g_stats[3],2*64/3); // TODO: diff --git a/common/hashmap.h b/common/hashmap.h index bbc227b3ae..d45280133b 100644 --- a/common/hashmap.h +++ b/common/hashmap.h @@ -78,15 +78,15 @@ public: enum { HASHMAP_PERTURB_SHIFT = 5, HASHMAP_MIN_CAPACITY = 16, - - // The quotient of the next two constants controls how much the + + // The quotient of the next two constants controls how much the // internal storage of the hashmap may fill up before being // increased automatically. // Note: the quotient of these two must be between and different // from 0 and 1. HASHMAP_LOADFACTOR_NUMERATOR = 2, HASHMAP_LOADFACTOR_DENOMINATOR = 3, - + HASHMAP_MEMORYPOOL_SIZE = HASHMAP_MIN_CAPACITY * HASHMAP_LOADFACTOR_NUMERATOR / HASHMAP_LOADFACTOR_DENOMINATOR }; @@ -95,7 +95,7 @@ public: Node *allocNode(const Key &key) { return new (_nodePool) Node(key); - } + } void freeNode(Node *node) { _nodePool.deleteChunk(node); @@ -283,7 +283,7 @@ HashMap<Key, Val, HashFunc, EqualFunc>::HashMap() : * to heap buffers for the internal storage. */ template<class Key, class Val, class HashFunc, class EqualFunc> -HashMap<Key, Val, HashFunc, EqualFunc>::HashMap(const HM_t &map) : +HashMap<Key, Val, HashFunc, EqualFunc>::HashMap(const HM_t &map) : _defaultVal() { assign(map); } diff --git a/common/md5.cpp b/common/md5.cpp index 107990481f..daaf176b7c 100644 --- a/common/md5.cpp +++ b/common/md5.cpp @@ -257,7 +257,7 @@ bool md5_file(const FSNode &file, uint8 digest[16], uint32 length) { warning("md5_file: using a directory FSNode"); return false; } - + ReadStream *stream = file.openForReading(); if (!stream) { warning("md5_file: failed to open '%s'", file.getPath().c_str()); diff --git a/common/memorypool.cpp b/common/memorypool.cpp index 59772f6a03..68da830cf2 100644 --- a/common/memorypool.cpp +++ b/common/memorypool.cpp @@ -41,7 +41,7 @@ MemoryPool::MemoryPool(size_t chunkSize) { _chunkSize = (_chunkSize + sizeof(void*) - 1) & (~(sizeof(void*) - 1)); _next = NULL; - + _chunksPerPage = INITIAL_CHUNKS_PER_PAGE; } @@ -51,8 +51,8 @@ MemoryPool::~MemoryPool() { } void MemoryPool::allocPage() { - Page page; - + Page page; + // Allocate a new page page.numChunks = _chunksPerPage; assert(page.numChunks * _chunkSize < 16*1024*1024); // Refuse to allocate pages bigger than 16 MB @@ -61,10 +61,10 @@ void MemoryPool::allocPage() { assert(page.start); _pages.push_back(page); - + // Next time, we'll alocate a page twice as big as this one. _chunksPerPage *= 2; - + // Add the page to the pool of free chunk addPageToPool(page); } @@ -79,7 +79,7 @@ void MemoryPool::addPageToPool(const Page &page) { current = next; } - + // Last chunk points to the old _next *(void**)current = _next; diff --git a/common/memorypool.h b/common/memorypool.h index 22326941f3..cb4d6b7180 100644 --- a/common/memorypool.h +++ b/common/memorypool.h @@ -36,7 +36,7 @@ class MemoryPool { protected: MemoryPool(const MemoryPool&); MemoryPool& operator=(const MemoryPool&); - + struct Page { void *start; size_t numChunks; @@ -55,11 +55,11 @@ public: MemoryPool(size_t chunkSize); ~MemoryPool(); - void *allocChunk(); - void freeChunk(void *ptr); + void *allocChunk(); + void freeChunk(void *ptr); void freeUnusedPages(); - + size_t getChunkSize() const { return _chunkSize; } }; diff --git a/common/ptr.h b/common/ptr.h index 99bc82a2d3..21656ad32a 100644 --- a/common/ptr.h +++ b/common/ptr.h @@ -70,7 +70,7 @@ private: * To achieve that the object implements an internal reference counting. * Thus you should try to avoid using the plain pointer after assigning * it to a SharedPtr object for the first time. If you still use the - * plain pointer be sure you do not delete it on your own. You may also + * plain pointer be sure you do not delete it on your own. You may also * not use the plain pointer to create a new SharedPtr object, since that * would result in a double deletion of the pointer sooner or later. * @@ -95,7 +95,7 @@ private: * * The class has implicit upcast support, so if you got a class B derived * from class A, you can assign a pointer to B without any problems to a - * SharedPtr object with template parameter A. The very same applies to + * SharedPtr object with template parameter A. The very same applies to * assignment of a SharedPtr<B> object to a SharedPtr<A> object. * * There are also operators != and == to compare two SharedPtr objects diff --git a/common/str.cpp b/common/str.cpp index 00e88bfc3b..d3522a665a 100644 --- a/common/str.cpp +++ b/common/str.cpp @@ -28,7 +28,7 @@ #include "common/memorypool.h" -#if !defined(__SYMBIAN32__) +#if !defined(__SYMBIAN32__) #include <new> #endif @@ -559,12 +559,12 @@ Common::String lastPathComponent(const Common::String &path, const char sep) { // Path consisted of only slashes -> return empty string if (last == str) return Common::String(); - + // Now scan the whole component const char *first = last - 1; while (first >= str && *first != sep) --first; - + if (*first == sep) first++; @@ -584,15 +584,15 @@ Common::String normalizePath(const Common::String &path, const char sep) { while (*cur == sep) ++cur; } - + // Scan till the end of the String while (*cur != 0) { const char *start = cur; - + // Scan till the next path separator resp. the end of the string while (*cur != sep && *cur != 0) cur++; - + const Common::String component(start, cur); // Skip empty components and dot components, add all others diff --git a/common/str.h b/common/str.h index c3e773c3e4..43b75edc5b 100644 --- a/common/str.h +++ b/common/str.h @@ -104,13 +104,13 @@ public: /** Construct a new string containing exactly len characters read from address str. */ String(const char *str, uint32 len); - + /** Construct a new string containing the characters between beginP (including) and endP (excluding). */ String(const char *beginP, const char *endP); - + /** Construct a copy of the given string. */ String(const String &str); - + /** Construct a string consisting of the given character. */ explicit String(char c); @@ -186,7 +186,7 @@ public: /** Remove the last character from the string. */ void deleteLastChar(); - + /** Remove the character at position p from the string. */ void deleteChar(uint32 p); @@ -204,7 +204,7 @@ public: /** Convert all characters in the string to uppercase. */ void toUppercase(); - + /** * Removes trailing and leading whitespaces. Uses isspace() to decide * what is whitespace and what not. diff --git a/common/stream.cpp b/common/stream.cpp index e17a745ef1..1cdcd50723 100644 --- a/common/stream.cpp +++ b/common/stream.cpp @@ -85,7 +85,7 @@ bool MemoryReadStream::seek(int32 offs, int whence) { assert(_pos <= _size); // Reset end-of-stream flag on a successful seek - _eos = false; + _eos = false; return true; // FIXME: STREAM REWRITE } @@ -101,7 +101,7 @@ char *SeekableReadStream::readLine_NEW(char *buf, size_t bufSize) { char c = 0; // If end-of-file occurs before any characters are read, return NULL - // and the buffer contents remain unchanged. + // and the buffer contents remain unchanged. if (eos() || err()) { return 0; } @@ -147,7 +147,7 @@ char *SeekableReadStream::readLine_NEW(char *buf, size_t bufSize) { // Treat CR & CR/LF as plain LF c = LF; } - + *p++ = c; len++; } @@ -166,7 +166,7 @@ String SeekableReadStream::readLine() { break; line += buf; } - + if (line.lastChar() == '\n') line.deleteLastChar(); @@ -256,7 +256,7 @@ uint32 BufferedReadStream::read(void *dataPtr, uint32 dataSize) { dataPtr = (byte *)dataPtr + bufBytesLeft; dataSize -= bufBytesLeft; } - + // At this point the buffer is empty. Now if the read request // exceeds the buffer size, just satisfy it directly. if (dataSize > _bufSize) @@ -299,7 +299,7 @@ bool BufferedSeekableReadStream::seek(int32 offset, int whence) { _pos = _bufSize; _parentStream->seek(offset, whence); } - + return true; // FIXME: STREAM REWRITE } diff --git a/common/stream.h b/common/stream.h index 7dd1b8283e..f98ad6aa92 100644 --- a/common/stream.h +++ b/common/stream.h @@ -206,7 +206,7 @@ public: * Read a signed byte from the stream and return it. * Performs no error checking. The return value is undefined * if a read error occurred (for which client code can check by - * calling err() and eos() ). + * calling err() and eos() ). */ int8 readSByte() { int8 b = 0; diff --git a/common/system.h b/common/system.h index 91bb091166..f7849a9d17 100644 --- a/common/system.h +++ b/common/system.h @@ -403,7 +403,7 @@ public: * @see endGFXTransaction */ enum TransactionError { - kTransactionSuccess = 0, /**< Everything fine (use EQUAL check for this one!) */ + kTransactionSuccess = 0, /**< Everything fine (use EQUAL check for this one!) */ kTransactionAspectRatioFailed = (1 << 0), /**< Failed switchting aspect ratio correction mode */ kTransactionFullscreenFailed = (1 << 1), /**< Failed switchting fullscreen mode */ kTransactionModeSwitchFailed = (1 << 2), /**< Failed switchting the GFX graphics mode (setGraphicsMode) */ diff --git a/common/unarj.cpp b/common/unarj.cpp index 8725321a7a..e69869a720 100644 --- a/common/unarj.cpp +++ b/common/unarj.cpp @@ -95,7 +95,7 @@ public: ArjDecoder(const ArjHeader *hdr) { _compsize = hdr->compSize; } - + ~ArjDecoder() { delete _compressed; delete _outstream; @@ -117,7 +117,7 @@ public: void init_getbits(); void fillbuf(int n); uint16 getbits(int n); - + void make_table(int nchar, byte *bitlen, int tablebits, uint16 *table, int tablesize); void read_pt_len(int nn, int nbit, int i_special); @@ -332,8 +332,8 @@ ArjHeader *readHeader(SeekableReadStream &stream) { strncpy(header.comment, (const char *)&headData[header.firstHdrSize + strlen(header.filename) + 1], ARJ_COMMENT_MAX); - // Process extended headers, if any - uint16 extHeaderSize; + // Process extended headers, if any + uint16 extHeaderSize; while ((extHeaderSize = stream.readUint16LE()) != 0) stream.seek((long)(extHeaderSize + 4), SEEK_CUR); @@ -366,8 +366,8 @@ bool ArjFile::open(const Common::String &filename) { archiveFile.seek(hdr->pos, SEEK_SET); if (hdr->method == 0) { // store - int32 len = archiveFile.read(uncompressedData, hdr->origSize); - assert(len == hdr->origSize); + int32 len = archiveFile.read(uncompressedData, hdr->origSize); + assert(len == hdr->origSize); } else { ArjDecoder *decoder = new ArjDecoder(hdr); @@ -381,7 +381,7 @@ bool ArjFile::open(const Common::String &filename) { decoder->decode(hdr->origSize); else if (hdr->method == 4) decoder->decode_f(hdr->origSize); - + delete decoder; } @@ -434,7 +434,7 @@ void ArjDecoder::init_getbits() { } // -// Source for fillbuf, getbits: decode.c +// Source for fillbuf, getbits: decode.c // void ArjDecoder::fillbuf(int n) { @@ -734,7 +734,7 @@ int16 ArjDecoder::decode_ptr() { int16 pwr; plus = 0; - pwr = 1 << 9; + pwr = 1 << 9; for (width = 9; width < 13; width++) { c = getbits(1); if (c == 0) diff --git a/common/unzip.h b/common/unzip.h index 9a6d957d57..309310ade1 100644 --- a/common/unzip.h +++ b/common/unzip.h @@ -42,7 +42,7 @@ public: ZipArchive(const FSNode &node); ZipArchive(SeekableReadStream *stream); ~ZipArchive(); - + bool isOpen() const; virtual bool hasFile(const String &name); diff --git a/common/xmlparser.cpp b/common/xmlparser.cpp index 3671feec2d..516f4bfcdf 100644 --- a/common/xmlparser.cpp +++ b/common/xmlparser.cpp @@ -36,21 +36,21 @@ using namespace Graphics; bool XMLParser::parserError(const char *errorString, ...) { _state = kParserError; - + const int startPosition = _stream->pos(); int currentPosition = startPosition; int lineCount = 1; char c = 0; - + _stream->seek(0, SEEK_SET); - + while (currentPosition--) { c = _stream->readByte(); - + if (c == '\n' || c == '\r') lineCount++; } - + assert(_stream->pos() == startPosition); currentPosition = startPosition; @@ -75,9 +75,9 @@ bool XMLParser::parserError(const char *errorString, ...) { if (c == '>') keyClosing = currentPosition; } - + fprintf(stderr, "\n File <%s>, line %d:\n", _fileName.c_str(), lineCount); - + currentPosition = (keyClosing - keyOpening); _stream->seek(keyOpening, SEEK_SET); @@ -98,16 +98,16 @@ bool XMLParser::parserError(const char *errorString, ...) { bool XMLParser::parseXMLHeader(ParserNode *node) { assert(node->header); - + if (_activeKey.size() != 1) return parserError("XML Header is expected in the global scope."); - + if (!node->values.contains("version")) return parserError("Missing XML version in XML header."); - + if (node->values["version"] != "1.0") return parserError("Unsupported XML version."); - + return true; } @@ -116,30 +116,30 @@ bool XMLParser::parseActiveKey(bool closed) { assert(_activeKey.empty() == false); ParserNode *key = _activeKey.top(); - + if (key->name == "xml" && key->header == true) { assert(closed); return parseXMLHeader(key) && closeKey(); } - + XMLKeyLayout *layout = (_activeKey.size() == 1) ? _XMLkeys : getParentNode(key)->layout; - + if (layout->children.contains(key->name)) { key->layout = layout->children[key->name]; - + Common::StringMap localMap = key->values; int keyCount = localMap.size(); - + for (Common::List<XMLKeyLayout::XMLKeyProperty>::const_iterator i = key->layout->properties.begin(); i != key->layout->properties.end(); ++i) { if (i->required && !localMap.contains(i->name)) return parserError("Missing required property '%s' inside key '%s'", i->name.c_str(), key->name.c_str()); else if (localMap.contains(i->name)) keyCount--; } - + if (keyCount > 0) return parserError("Unhandled property inside key '%s'.", key->name.c_str()); - + } else { return parserError("Unexpected key in the active scope ('%s').", key->name.c_str()); } @@ -157,10 +157,10 @@ bool XMLParser::parseActiveKey(bool closed) { // We set it manually in that case. if (_state != kParserError) parserError("Unhandled exception when parsing '%s' key.", key->name.c_str()); - + return false; } - + if (closed) return closeKey(); @@ -201,17 +201,17 @@ bool XMLParser::parseKeyValue(Common::String keyName) { bool XMLParser::closeKey() { bool ignore = false; bool result = true; - + for (int i = _activeKey.size() - 1; i >= 0; --i) { if (_activeKey[i]->ignore) ignore = true; } - + if (ignore == false) result = closedKeyCallback(_activeKey.top()); - + freeNode(_activeKey.pop()); - + return result; } @@ -219,7 +219,7 @@ bool XMLParser::parse() { if (_stream == 0) return parserError("XML stream not ready for reading."); - + if (_XMLkeys == 0) buildLayout(); @@ -236,7 +236,7 @@ bool XMLParser::parse() { _activeKey.clear(); _char = _stream->readByte(); - + while (_char && _state != kParserError) { if (skipSpaces()) continue; @@ -262,7 +262,7 @@ bool XMLParser::parse() { parserError("Expecting XML header."); break; } - + _char = _stream->readByte(); activeHeader = true; } else if (_char == '/') { @@ -303,7 +303,7 @@ bool XMLParser::parse() { case kParserNeedPropertyName: if (activeClosure) { if (!closeKey()) { - parserError("Missing data when closing key '%s'.", _activeKey.top()->name.c_str()); + parserError("Missing data when closing key '%s'.", _activeKey.top()->name.c_str()); break; } @@ -311,13 +311,13 @@ bool XMLParser::parse() { if (_char != '>') parserError("Invalid syntax in key closure."); - else + else _state = kParserNeedKey; _char = _stream->readByte(); break; } - + selfClosure = false; if (_char == '/' || (_char == '?' && activeHeader)) { @@ -332,33 +332,33 @@ bool XMLParser::parse() { _char = _stream->readByte(); _state = kParserNeedKey; } - + activeHeader = false; break; } - + if (selfClosure) parserError("Expecting key closure after '/' symbol."); - else if (!parseToken()) + else if (!parseToken()) parserError("Error when parsing key value."); - else + else _state = kParserNeedPropertyOperator; break; case kParserNeedPropertyOperator: - if (_char != '=') + if (_char != '=') parserError("Syntax error after key name."); - else + else _state = kParserNeedPropertyValue; _char = _stream->readByte(); break; case kParserNeedPropertyValue: - if (!parseKeyValue(_token)) + if (!parseKeyValue(_token)) parserError("Invalid key value."); - else + else _state = kParserNeedPropertyName; break; diff --git a/common/xmlparser.h b/common/xmlparser.h index ca01c4df0e..435e7c7e0c 100644 --- a/common/xmlparser.h +++ b/common/xmlparser.h @@ -39,7 +39,7 @@ namespace Common { - + /* XMLParser.cpp/h -- Generic XML Parser ===================================== @@ -49,14 +49,14 @@ namespace Common { */ #define MAX_XML_DEPTH 8 - + #define XML_KEY(keyName) {\ lay = new CustomXMLKeyLayout;\ lay->callback = (&kLocalParserName::parserCallback_##keyName);\ layout.top()->children[#keyName] = lay;\ layout.push(lay); \ _layoutList.push_back(lay); - + #define XML_KEY_RECURSIVE(keyName) {\ layout.top()->children[#keyName] = layout.top();\ layout.push(layout.top());\ @@ -68,9 +68,9 @@ namespace Common { prop.name = #propName; \ prop.required = req; \ layout.top()->properties.push_back(prop); } - - + + #define CUSTOM_XML_PARSER(parserName) \ protected: \ typedef parserName kLocalParserName; \ @@ -85,7 +85,7 @@ namespace Common { XMLKeyLayout::XMLKeyProperty prop; \ _XMLkeys = new CustomXMLKeyLayout; \ layout.push(_XMLkeys); - + #define PARSER_END() layout.clear(); } /** @@ -132,29 +132,29 @@ public: kParserError }; - + struct XMLKeyLayout; struct ParserNode; - + typedef Common::HashMap<Common::String, XMLParser::XMLKeyLayout*, Common::IgnoreCase_Hash, Common::IgnoreCase_EqualTo> ChildMap; - + /** nested struct representing the layout of the XML file */ struct XMLKeyLayout { struct XMLKeyProperty { Common::String name; bool required; }; - + Common::List<XMLKeyProperty> properties; ChildMap children; - + virtual bool doCallback(XMLParser *parent, ParserNode *node) = 0; - + virtual ~XMLKeyLayout() { properties.clear(); } }; - + XMLKeyLayout *_XMLkeys; /** Struct representing a parsed node */ @@ -166,12 +166,12 @@ public: int depth; XMLKeyLayout *layout; }; - + ObjectPool<ParserNode, MAX_XML_DEPTH> _nodePool; ParserNode *allocNode() { return new (_nodePool) ParserNode; - } + } void freeNode(ParserNode *node) { _nodePool.deleteChunk(node); @@ -192,12 +192,12 @@ public: _fileName = filename; return true; } - + bool loadFile(const FSNode &node) { _stream = node.openForReading(); if (!_stream) return false; - + _fileName = node.getName(); return true; } @@ -218,13 +218,13 @@ public: _fileName = "Memory Stream"; return true; } - + bool loadStream(Common::SeekableReadStream *stream) { _stream = stream; _fileName = "File Stream"; return true; } - + void close() { delete _stream; _stream = 0; @@ -255,7 +255,7 @@ public: } protected: - + /** * The buildLayout function builds the layout for the parser to use * based on a series of helper macros. This function is automatically @@ -264,10 +264,10 @@ protected: * See the documentation regarding XML layouts. */ virtual void buildLayout() = 0; - + /** * The keycallback function is automatically overloaded on custom parsers - * when using the CUSTOM_XML_PARSER() macro. + * when using the CUSTOM_XML_PARSER() macro. * * Its job is to call the corresponding Callback function for the given node. * A function for each key type must be declared separately. See the custom @@ -301,7 +301,7 @@ protected: virtual bool closedKeyCallback(ParserNode *node) { return true; } - + /** * Called when a node is closed. Manages its cleanup and calls the * closing callback function if needed. @@ -354,10 +354,10 @@ protected: _char = '<'; return false; } - + if (_stream->readByte() != '-' || _stream->readByte() != '-') return parserError("Malformed comment syntax."); - + _char = _stream->readByte(); bool dash = false; @@ -367,13 +367,13 @@ protected: _char = _stream->readByte(); return true; } - + dash = !dash; } - + _char = _stream->readByte(); } - + return parserError("Comment has no closure."); } @@ -448,12 +448,12 @@ protected: va_end(args); return (*key == 0); } - + bool parseXMLHeader(ParserNode *node); /** * Overload if your parser needs to support parsing the same file - * several times, so you can clean up the internal state of the + * several times, so you can clean up the internal state of the * parser before each parse. */ virtual void cleanup() {} diff --git a/common/zlib.cpp b/common/zlib.cpp index 4ed233b4b0..519b7c4806 100644 --- a/common/zlib.cpp +++ b/common/zlib.cpp @@ -161,7 +161,7 @@ public: case SEEK_CUR: newPos = _pos + offset; } - + assert(newPos >= 0); if ((uint32)newPos < _pos) { @@ -189,7 +189,7 @@ public: while (!err() && offset > 0) { offset -= read(tmpBuf, MIN((int32)sizeof(tmpBuf), offset)); } - + _eos = false; return true; // FIXME: STREAM REWRITE } @@ -242,7 +242,7 @@ public: Z_DEFLATED, MAX_WBITS + 16, 8, - Z_DEFAULT_STRATEGY); + Z_DEFAULT_STRATEGY); assert(_zlibErr == Z_OK); _stream.next_out = _buf; diff --git a/common/zlib.h b/common/zlib.h index 5fd13e842d..4da357d23c 100644 --- a/common/zlib.h +++ b/common/zlib.h @@ -37,7 +37,7 @@ namespace Common { * Thin wrapper around zlib's uncompress() function. This wrapper makes * it possible to uncompress data in engines without being forced to link * them against zlib, thus simplifying the build system. - * + * * @return true on success (i.e. Z_OK), false otherwise */ bool uncompress(byte *dst, unsigned long *dstLen, const byte *src, unsigned long srcLen); diff --git a/graphics/VectorRenderer.cpp b/graphics/VectorRenderer.cpp index 8c7f9662cf..e67f81a363 100644 --- a/graphics/VectorRenderer.cpp +++ b/graphics/VectorRenderer.cpp @@ -58,12 +58,12 @@ void VectorRenderer::drawStep(const Common::Rect &area, const DrawStep &step, ui if (step.fgColor.set) setFgColor(step.fgColor.r, step.fgColor.g, step.fgColor.b); - + if (step.bevelColor.set) setBevelColor(step.bevelColor.r, step.bevelColor.g, step.bevelColor.b); if (step.gradColor1.set && step.gradColor2.set) - setGradientColors(step.gradColor1.r, step.gradColor1.g, step.gradColor1.b, + setGradientColors(step.gradColor1.r, step.gradColor1.g, step.gradColor1.b, step.gradColor2.r, step.gradColor2.g, step.gradColor2.b); setShadowOffset(_disableShadows ? 0 : step.shadow); @@ -71,7 +71,7 @@ void VectorRenderer::drawStep(const Common::Rect &area, const DrawStep &step, ui setGradientFactor(step.factor); setStrokeWidth(step.stroke); setFillMode((FillMode)step.fillMode); - + _dynamicData = extra; (this->*(step.drawingCall))(area, step); @@ -94,25 +94,25 @@ int VectorRenderer::stepGetRadius(const DrawStep &step, const Common::Rect &area void VectorRenderer::stepGetPositions(const DrawStep &step, const Common::Rect &area, uint16 &in_x, uint16 &in_y, uint16 &in_w, uint16 &in_h) { if (!step.autoWidth) { in_w = step.w == -1 ? area.height() : step.w; - + switch(step.xAlign) { case Graphics::DrawStep::kVectorAlignManual: if (step.x >= 0) in_x = area.left + step.x; else in_x = area.left + area.width() + step.x; // value relative to the opposite corner. break; - + case Graphics::DrawStep::kVectorAlignCenter: - in_x = area.left + (area.width() / 2) - (in_w / 2); + in_x = area.left + (area.width() / 2) - (in_w / 2); break; - + case Graphics::DrawStep::kVectorAlignLeft: in_x = area.left; break; - + case Graphics::DrawStep::kVectorAlignRight: in_x = area.left + area.width() - in_w; break; - + default: error("Vertical alignment in horizontal data."); } @@ -120,28 +120,28 @@ void VectorRenderer::stepGetPositions(const DrawStep &step, const Common::Rect & in_x = area.left; in_w = area.width(); } - + if (!step.autoHeight) { in_h = step.h == -1 ? area.width() : step.h; - + switch(step.yAlign) { case Graphics::DrawStep::kVectorAlignManual: if (step.y >= 0) in_y = area.top + step.y; else in_y = area.top + area.height() + step.y; // relative break; - + case Graphics::DrawStep::kVectorAlignCenter: - in_y = area.top + (area.height() / 2) - (in_h / 2); + in_y = area.top + (area.height() / 2) - (in_h / 2); break; - + case Graphics::DrawStep::kVectorAlignTop: in_y = area.top; break; - + case Graphics::DrawStep::kVectorAlignBottom: in_y = area.top + area.height() - in_h; break; - + default: error("Horizontal alignment in vertical data."); } diff --git a/graphics/VectorRenderer.h b/graphics/VectorRenderer.h index f0c319fe76..ca61720d06 100644 --- a/graphics/VectorRenderer.h +++ b/graphics/VectorRenderer.h @@ -56,7 +56,7 @@ struct DrawStep { bool autoWidth, autoHeight; int16 x, y, w, h; /**< width, height and position, if not measured automatically. - negative values mean counting from the opposite direction */ + negative values mean counting from the opposite direction */ enum VectorAlignment { kVectorAlignManual, diff --git a/graphics/VectorRendererSpec.cpp b/graphics/VectorRendererSpec.cpp index 36dfba19a0..f4e9d6b098 100644 --- a/graphics/VectorRendererSpec.cpp +++ b/graphics/VectorRendererSpec.cpp @@ -22,7 +22,7 @@ * $Id$ * */ - + #include "common/util.h" #include "common/system.h" #include "common/events.h" @@ -61,7 +61,7 @@ inline uint32 fp_sqroot(uint32 x) { } /* - HELPER MACROS for Bresenham's circle drawing algorithm + HELPER MACROS for Bresenham's circle drawing algorithm Note the proper spelling on this header. */ #define __BE_ALGORITHM() { \ @@ -125,7 +125,7 @@ inline uint32 fp_sqroot(uint32 x) { } \ ptr_right += pitch; \ ptr_left += pitch; - + /** HELPER MACROS for WU's circle drawing algorithm **/ #define __WU_DRAWCIRCLE(ptr1,ptr2,ptr3,ptr4,x,y,px,py,a) { \ blendPixelPtr(ptr1 + (y) - (px), color, a); \ @@ -154,7 +154,7 @@ inline uint32 fp_sqroot(uint32 x) { extern int gBitFormat; namespace Graphics { - + VectorRenderer *createRenderer(int mode) { #ifdef DISABLE_FANCY_THEMES assert(mode == GUI::ThemeEngine::kGfxStandard16bit); @@ -190,7 +190,7 @@ VectorRenderer *createRenderer(int mode) { #undef CREATE_RENDERER_16 #endif } - + #ifndef DISABLE_FANCY_THEMES template <typename PixelType, typename PixelFormat> void VectorRendererSpec<PixelType, PixelFormat>:: @@ -199,31 +199,31 @@ areaConvolution(const Common::Rect &area, const int filter[3][3], int filterDiv, int newR, newG, newB; uint8 r, g, b; int yVal; - + for (int y = area.top; y < area.bottom; ++y) { for (int x = area.left; x < area.right; ++x) { newR = newG = newB = 0; for (int j = 0; j < 3; ++j) { yVal = MIN(MAX(y - 1 + j, 0), area.bottom - 1); - + for (int i = 0; i < 3; ++i) { ptr = (PixelType *)Base::_activeSurface->getBasePtr(MIN(MAX(x - 1 + j, 0), area.right - 1), yVal); colorToRGB<PixelFormat>((uint32)*ptr, r, g, b); - + newR += r * filter[j][i]; newG += g * filter[j][i]; newB += b * filter[j][i]; } } - + newR = (newR / filterDiv) + offset; newG = (newG / filterDiv) + offset; newB = (newB / filterDiv) + offset; - + ptr = (PixelType *)Base::_activeSurface->getBasePtr(x, y); *ptr = RGBToColor<PixelFormat>(CLIP(newR, 0, 255), CLIP(newG, 0, 255), CLIP(newB, 0, 255)); - } + } } } #endif @@ -268,12 +268,12 @@ copyFrame(OSystem *sys, const Common::Rect &r) { sys->copyRectToOverlay( #ifdef OVERLAY_MULTIPLE_DEPTHS - (const PixelType*) + (const PixelType*) #else (const OverlayColor*) #endif - _activeSurface->getBasePtr(r.left, r.top), _activeSurface->w, + _activeSurface->getBasePtr(r.left, r.top), _activeSurface->w, r.left, r.top, r.width(), r.height() ); } @@ -282,7 +282,7 @@ template <typename PixelType, typename PixelFormat> void VectorRendererSpec<PixelType, PixelFormat>:: blitSurface(const Graphics::Surface *source, const Common::Rect &r) { assert(source->w == _activeSurface->w && source->h == _activeSurface->h); - + PixelType *dst_ptr = (PixelType *)_activeSurface->getBasePtr(r.left, r.top); PixelType *src_ptr = (PixelType *)source->getBasePtr(r.left, r.top); @@ -303,12 +303,12 @@ void VectorRendererSpec<PixelType, PixelFormat>:: blitSubSurface(const Graphics::Surface *source, const Common::Rect &r) { PixelType *dst_ptr = (PixelType *)_activeSurface->getBasePtr(r.left, r.top); PixelType *src_ptr = (PixelType *)source->getBasePtr(0, 0); - + int dst_pitch = surfacePitch(); int src_pitch = source->pitch / source->bytesPerPixel; - + int h = r.height(), w = r.width(); - + while (h--) { memcpy(dst_ptr, src_ptr, w * sizeof(PixelType)); dst_ptr += dst_pitch; @@ -321,32 +321,32 @@ void VectorRendererSpec<PixelType, PixelFormat>:: blitAlphaBitmap(const Graphics::Surface *source, const Common::Rect &r) { int16 x = r.left; int16 y = r.top; - + if (r.width() > source->w) x = x + (r.width() >> 1) - (source->w >> 1); - + if (r.height() > source->h) y = y + (r.height() >> 1) - (source->h >> 1); - + PixelType *dst_ptr = (PixelType *)_activeSurface->getBasePtr(x, y); PixelType *src_ptr = (PixelType *)source->getBasePtr(0, 0); - + int dst_pitch = surfacePitch(); int src_pitch = source->pitch / source->bytesPerPixel; - + int w, h = source->h; - + while (h--) { w = source->w; - + while (w--) { if (*src_ptr != _bitmapAlphaColor) *dst_ptr = *src_ptr; - + dst_ptr++; src_ptr++; } - + dst_ptr = dst_ptr - source->w + dst_pitch; src_ptr = src_ptr - source->w + src_pitch; } @@ -361,15 +361,15 @@ applyScreenShading(GUI::ThemeEngine::ShadingStyle shadingStyle) { uint lum; const uint32 shiftMask = (uint32)~( - (1 << PixelFormat::kGreenShift) | - (1 << PixelFormat::kRedShift) | + (1 << PixelFormat::kGreenShift) | + (1 << PixelFormat::kRedShift) | (1 << PixelFormat::kBlueShift)) >> 1; - + if (shadingStyle == GUI::ThemeEngine::kShadingDim) { int n = (pixels + 7) >> 3; switch (pixels % 8) { - case 0: do { + case 0: do { *ptr = (*ptr >> 1) & shiftMask; ++ptr; case 7: *ptr = (*ptr >> 1) & shiftMask; ++ptr; case 6: *ptr = (*ptr >> 1) & shiftMask; ++ptr; @@ -413,7 +413,7 @@ inline PixelType VectorRendererSpec<PixelType, PixelFormat>:: calcGradient(uint32 pos, uint32 max) { PixelType output = 0; pos = (MIN(pos * Base::_gradientFactor, max) << 12) / max; - + output |= (_gradientStart + ((Base::_gradientBytes[0] * pos) >> 12)) & PixelFormat::kRedMask; output |= (_gradientStart + ((Base::_gradientBytes[1] * pos) >> 12)) & PixelFormat::kGreenMask; output |= (_gradientStart + ((Base::_gradientBytes[2] * pos) >> 12)) & PixelFormat::kBlueMask; @@ -428,7 +428,7 @@ colorFill(PixelType *first, PixelType *last, PixelType color) { register int count = (last - first); register int n = (count + 7) >> 3; switch (count % 8) { - case 0: do { + case 0: do { *first++ = color; case 7: *first++ = color; case 6: *first++ = color; @@ -448,11 +448,11 @@ colorFill(PixelType *first, PixelType *last, PixelType color) { ********************************************************************/ template <typename PixelType, typename PixelFormat> void VectorRendererSpec<PixelType, PixelFormat>:: -drawString(const Graphics::Font *font, const Common::String &text, const Common::Rect &area, +drawString(const Graphics::Font *font, const Common::String &text, const Common::Rect &area, Graphics::TextAlign alignH, GUI::ThemeEngine::TextAlignVertical alignV, int deltax, bool ellipsis) { int offset = area.top; - + if (font->getFontHeight() < area.height()) { switch (alignV) { case GUI::ThemeEngine::kTextAlignVCenter: @@ -465,7 +465,7 @@ drawString(const Graphics::Font *font, const Common::String &text, const Common: break; } } - + font->drawString(_activeSurface, text, area.left, offset, area.width(), _fgColor, alignH, deltax, ellipsis); } @@ -488,7 +488,7 @@ drawLine(int x1, int y1, int x2, int y2) { int dy = ABS(y2 - y1); // this is a point, not a line. stoopid. - if (dy == 0 && dx == 0) + if (dy == 0 && dx == 0) return; if (Base::_strokeWidth == 0) @@ -501,7 +501,7 @@ drawLine(int x1, int y1, int x2, int y2) { if (dy == 0) { // horizontal lines // these can be filled really fast with a single memset. colorFill(ptr, ptr + dx + 1, (PixelType)_fgColor); - + for (int i = 0, p = pitch; i < st; ++i, p += pitch) { colorFill(ptr + p, ptr + dx + 1 + p, (PixelType)_fgColor); colorFill(ptr - p, ptr + dx + 1 - p, (PixelType)_fgColor); @@ -536,7 +536,7 @@ drawCircle(int x, int y, int r) { x - r < 0 || y - r < 0 || x == 0 || y == 0 || r <= 0) return; - if (Base::_fillMode != kFillDisabled && Base::_shadowOffset + if (Base::_fillMode != kFillDisabled && Base::_shadowOffset && x + r + Base::_shadowOffset < Base::_activeSurface->w && y + r + Base::_shadowOffset < Base::_activeSurface->h) { drawCircleAlg(x + Base::_shadowOffset + 1, y + Base::_shadowOffset + 1, r, 0, kFillForeground); @@ -611,7 +611,7 @@ drawRoundedSquare(int x, int y, int r, int w, int h) { if (x + w > Base::_activeSurface->w || y + h > Base::_activeSurface->h || w <= 0 || h <= 0 || x < 0 || y < 0 || r <= 0) return; - + if ((r << 1) > w || (r << 1) > h) r = MIN(w >> 1, h >> 1); @@ -639,7 +639,7 @@ drawRoundedSquare(int x, int y, int r, int w, int h) { case kFillGradient: if (Base::_strokeWidth > 1) { drawRoundedSquareAlg(x, y, r, w, h, _fgColor, kFillForeground); - VectorRendererSpec::drawRoundedSquareAlg(x + Base::_strokeWidth/2, y + Base::_strokeWidth/2, + VectorRendererSpec::drawRoundedSquareAlg(x + Base::_strokeWidth/2, y + Base::_strokeWidth/2, r - Base::_strokeWidth/2, w - Base::_strokeWidth, h - Base::_strokeWidth, 0, kFillGradient); } else { VectorRendererSpec::drawRoundedSquareAlg(x, y, r, w, h, 0, kFillGradient); @@ -648,7 +648,7 @@ drawRoundedSquare(int x, int y, int r, int w, int h) { } break; } - + if (Base::_bevel) drawRoundedSquareFakeBevel(x, y, r, w, h, Base::_bevel); } @@ -659,25 +659,25 @@ drawTab(int x, int y, int r, int w, int h) { if (x + w > Base::_activeSurface->w || y + h > Base::_activeSurface->h || w <= 0 || h <= 0 || x < 0 || y < 0 || r > w || r > h) return; - + if (r == 0 && Base::_bevel > 0) { drawBevelTabAlg(x, y, w, h, Base::_bevel, _bevelColor, _fgColor, (Base::_dynamicData >> 16), (Base::_dynamicData & 0xFFFF)); return; } - + if (r == 0) return; - + switch (Base::_fillMode) { case kFillDisabled: return; - + case kFillGradient: case kFillBackground: drawTabAlg(x, y, w, h, r, (Base::_fillMode == kFillBackground) ? _bgColor : _fgColor, Base::_fillMode); if (Base::_strokeWidth) drawTabAlg(x, y, w, h, r, _fgColor, kFillDisabled, (Base::_dynamicData >> 16), (Base::_dynamicData & 0xFFFF)); break; - + case kFillForeground: drawTabAlg(x, y, w, h, r, (Base::_fillMode == kFillBackground) ? _bgColor : _fgColor, Base::_fillMode); break; @@ -687,7 +687,7 @@ drawTab(int x, int y, int r, int w, int h) { template<typename PixelType, typename PixelFormat> void VectorRendererSpec<PixelType, PixelFormat>:: drawTriangle(int x, int y, int w, int h, TriangleOrientation orient) { - + if (x + w > Base::_activeSurface->w || y + h > Base::_activeSurface->h) return; @@ -703,10 +703,10 @@ drawTriangle(int x, int y, int w, int h, TriangleOrientation orient) { return; color = _fgColor; } - + if (Base::_dynamicData != 0) orient = (TriangleOrientation)Base::_dynamicData; - + int newW = w / 2; if (newW % 2) newW++; @@ -745,7 +745,7 @@ drawTabAlg(int x1, int y1, int w, int h, int r, PixelType color, VectorRenderer: int x, y, px, py; int pitch = Base::surfacePitch(); int sw = 0, sp = 0, hp = 0; - + PixelType *ptr_tl = (PixelType *)Base::_activeSurface->getBasePtr(x1 + r, y1 + r); PixelType *ptr_tr = (PixelType *)Base::_activeSurface->getBasePtr(x1 + w - r, y1 + r); PixelType *ptr_fill = (PixelType *)Base::_activeSurface->getBasePtr(x1, y1); @@ -762,7 +762,7 @@ drawTabAlg(int x1, int y1, int w, int h, int r, PixelType color, VectorRenderer: __BE_RESET(); r--; - + while (x++ < y) { __BE_ALGORITHM(); *(ptr_tr + (y) - (px)) = color; @@ -776,7 +776,7 @@ drawTabAlg(int x1, int y1, int w, int h, int r, PixelType color, VectorRenderer: *(ptr_tl - (x) - (py)) = color; *(ptr_tl - (y) - (px - pitch)) = color; } - } + } } ptr_fill += pitch * real_radius; @@ -785,7 +785,7 @@ drawTabAlg(int x1, int y1, int w, int h, int r, PixelType color, VectorRenderer: colorFill(ptr_fill + w - Base::_strokeWidth + 1, ptr_fill + w + 1, color); ptr_fill += pitch; } - + if (baseLeft) { sw = 0; ptr_fill = (PixelType *)Base::_activeSurface->getBasePtr(x1, y1 + h + 1); @@ -794,7 +794,7 @@ drawTabAlg(int x1, int y1, int w, int h, int r, PixelType color, VectorRenderer: ptr_fill += pitch; } } - + if (baseRight) { sw = 0; ptr_fill = (PixelType *)Base::_activeSurface->getBasePtr(x1 + w, y1 + h + 1); @@ -808,24 +808,24 @@ drawTabAlg(int x1, int y1, int w, int h, int r, PixelType color, VectorRenderer: PixelType color1, color2; color1 = color2 = color; - + while (x++ < y) { __BE_ALGORITHM(); - + if (fill_m == kFillGradient) { color1 = calcGradient(real_radius - x, long_h); color2 = calcGradient(real_radius - y, long_h); } - + colorFill(ptr_tl - x - py, ptr_tr + x - py, color2); colorFill(ptr_tl - y - px, ptr_tr + y - px, color1); - + *(ptr_tr + (y) - (px)) = color1; *(ptr_tr + (x) - (py)) = color2; *(ptr_tl - (x) - (py)) = color2; *(ptr_tl - (y) - (px)) = color1; } - + ptr_fill += pitch * r; while (short_h--) { if (fill_m == kFillGradient) @@ -843,9 +843,9 @@ void VectorRendererSpec<PixelType, PixelFormat>:: drawBevelTabAlg(int x, int y, int w, int h, int bevel, PixelType top_color, PixelType bottom_color, int baseLeft, int baseRight) { int pitch = Base::surfacePitch(); int i, j; - + PixelType *ptr_left = (PixelType *)_activeSurface->getBasePtr(x, y); - + i = bevel; while (i--) { colorFill(ptr_left, ptr_left + w, top_color); @@ -869,12 +869,12 @@ drawBevelTabAlg(int x, int y, int w, int h, int bevel, PixelType top_color, Pixe if (j > 0) j--; ptr_left += pitch; } - + i = bevel; ptr_left = (PixelType *)_activeSurface->getBasePtr(x + w - bevel, y + h - bevel); while (i--) { colorFill(ptr_left, ptr_left + baseRight + bevel, bottom_color); - + if (baseLeft) colorFill(ptr_left - w - baseLeft + bevel, ptr_left - w + bevel + bevel, top_color); ptr_left += pitch; @@ -888,7 +888,7 @@ drawSquareAlg(int x, int y, int w, int h, PixelType color, VectorRenderer::FillM PixelType *ptr = (PixelType *)_activeSurface->getBasePtr(x, y); int pitch = Base::surfacePitch(); int max_h = h; - + if (fill_m != kFillDisabled) { while (h--) { if (fill_m == kFillGradient) @@ -919,25 +919,25 @@ template<typename PixelType, typename PixelFormat> void VectorRendererSpec<PixelType, PixelFormat>:: drawBevelSquareAlg(int x, int y, int w, int h, int bevel, PixelType top_color, PixelType bottom_color, bool fill) { int pitch = Base::surfacePitch(); - + int height = h; PixelType *ptr_fill = (PixelType *)_activeSurface->getBasePtr(x, y); - + if (fill) { while (height--) { blendFill(ptr_fill, ptr_fill + w, _bgColor, 200); ptr_fill += pitch; } } - + int i, j; x = MAX(x - bevel, 0); y = MAX(y - bevel, 0); h += bevel << 1; w += bevel << 1; - + PixelType *ptr_left = (PixelType *)_activeSurface->getBasePtr(x, y); - + i = bevel; while (i--) { colorFill(ptr_left, ptr_left + w, top_color); @@ -1105,9 +1105,9 @@ drawTriangleFast(int x1, int y1, int size, bool inverted, PixelType color, Vecto int pitch = Base::surfacePitch(); int hstep = 0, dy = size; bool grad = (fill_m == kFillGradient); - + PixelType *ptr_right = 0, *ptr_left = 0; - + if (inverted) { ptr_left = (PixelType *)_activeSurface->getBasePtr(x1, y1); ptr_right = (PixelType *)_activeSurface->getBasePtr(x1 + size, y1); @@ -1116,7 +1116,7 @@ drawTriangleFast(int x1, int y1, int size, bool inverted, PixelType color, Vecto ptr_right = (PixelType *)_activeSurface->getBasePtr(x1 + size, y1 + size); pitch = -pitch; } - + if (fill_m == kFillDisabled) { while (ptr_left < ptr_right) { *ptr_left = color; @@ -1136,7 +1136,7 @@ drawTriangleFast(int x1, int y1, int size, bool inverted, PixelType color, Vecto if (hstep++ % 2) { ptr_left++; ptr_right--; - } + } } } } @@ -1149,7 +1149,7 @@ drawRoundedSquareAlg(int x1, int y1, int r, int w, int h, PixelType color, Vecto int x, y, px, py; int pitch = Base::surfacePitch(); int sw = 0, sp = 0, hp = h * pitch; - + PixelType *ptr_tl = (PixelType *)Base::_activeSurface->getBasePtr(x1 + r, y1 + r); PixelType *ptr_tr = (PixelType *)Base::_activeSurface->getBasePtr(x1 + w - r, y1 + r); PixelType *ptr_bl = (PixelType *)Base::_activeSurface->getBasePtr(x1 + r, y1 + h - r); @@ -1168,7 +1168,7 @@ drawRoundedSquareAlg(int x1, int y1, int r, int w, int h, PixelType color, Vecto __BE_RESET(); r--; - + while (x++ < y) { __BE_ALGORITHM(); __BE_DRAWCIRCLE(ptr_tr, ptr_tl, ptr_bl, ptr_br, x, y, px, py); @@ -1177,7 +1177,7 @@ drawRoundedSquareAlg(int x1, int y1, int r, int w, int h, PixelType color, Vecto __BE_DRAWCIRCLE(ptr_tr, ptr_tl, ptr_bl, ptr_br, x - 1, y, px, py); __BE_DRAWCIRCLE(ptr_tr, ptr_tl, ptr_bl, ptr_br, x, y, px - pitch, py); } - } + } } ptr_fill += pitch * real_radius; @@ -1189,27 +1189,27 @@ drawRoundedSquareAlg(int x1, int y1, int r, int w, int h, PixelType color, Vecto } else { __BE_RESET(); PixelType color1, color2, color3, color4; - + if (fill_m == kFillGradient) { while (x++ < y) { __BE_ALGORITHM(); - + color1 = calcGradient(real_radius - x, long_h); color2 = calcGradient(real_radius - y, long_h); color3 = calcGradient(long_h - r + x, long_h); color4 = calcGradient(long_h - r + y, long_h); - + colorFill(ptr_tl - x - py, ptr_tr + x - py, color2); colorFill(ptr_tl - y - px, ptr_tr + y - px, color1); colorFill(ptr_bl - x + py, ptr_br + x + py, color4); colorFill(ptr_bl - y + px, ptr_br + y + px, color3); - + __BE_DRAWCIRCLE_XCOLOR(ptr_tr, ptr_tl, ptr_bl, ptr_br, x, y, px, py); } } else { while (x++ < y) { - __BE_ALGORITHM(); + __BE_ALGORITHM(); colorFill(ptr_tl - x - py, ptr_tr + x - py, color); colorFill(ptr_tl - y - px, ptr_tr + y - px, color); @@ -1378,7 +1378,7 @@ drawRoundedSquareFakeBevel(int x1, int y1, int r, int w, int h, int amount) { uint32 rsq = (r * r) << 16; uint32 T = 0, oldT; uint8 a1, a2; - + PixelType color = _bevelColor; //RGBToColor<PixelFormat>(63, 60, 17); PixelType *ptr_tl = (PixelType *)Base::_activeSurface->getBasePtr(x1 + r, y1 + r); @@ -1387,14 +1387,14 @@ drawRoundedSquareFakeBevel(int x1, int y1, int r, int w, int h, int amount) { PixelType *ptr_fill = (PixelType *)Base::_activeSurface->getBasePtr(x1, y1); int short_h = h - 2 * r; - + while (sw++ < amount) { colorFill(ptr_fill + sp + r, ptr_fill + w + 1 + sp - r, color); sp += p; x = r - (sw - 1); y = 0; T = 0; px = p * x; py = 0; - + while (x > y++) { __WU_ALGORITHM(); @@ -1404,14 +1404,14 @@ drawRoundedSquareFakeBevel(int x1, int y1, int r, int w, int h, int amount) { blendPixelPtr(ptr_tl - (y) - (px - p), color, a2); blendPixelPtr(ptr_bl - (y) + (px - p), color, a2); blendPixelPtr(ptr_bl - (x - 1) + (py), color, a2); - + blendPixelPtr(ptr_tr + (y) - (px), color, a1); blendPixelPtr(ptr_tr + (x) - (py), color, a1); blendPixelPtr(ptr_tl - (x) - (py), color, a1); blendPixelPtr(ptr_tl - (y) - (px), color, a1); blendPixelPtr(ptr_bl - (y) + (px), color, a1); blendPixelPtr(ptr_bl - (x) + (py), color, a1); - } + } } ptr_fill += p * r; @@ -1520,7 +1520,7 @@ drawRoundedSquareAlg(int x1, int y1, int r, int w, int h, PixelType color, Vecto x = r - (sw - 1); y = 0; T = 0; px = p * x; py = 0; - + while (x > y++) { __WU_ALGORITHM(); @@ -1529,7 +1529,7 @@ drawRoundedSquareAlg(int x1, int y1, int r, int w, int h, PixelType color, Vecto __WU_DRAWCIRCLE(ptr_tr, ptr_tl, ptr_bl, ptr_br, (x - 1), y, (px - p), py, a2); __WU_DRAWCIRCLE(ptr_tr, ptr_tl, ptr_bl, ptr_br, x, y, px, py, a1); - } + } } ptr_fill += p * r; @@ -1537,11 +1537,11 @@ drawRoundedSquareAlg(int x1, int y1, int r, int w, int h, PixelType color, Vecto colorFill(ptr_fill, ptr_fill + Base::_strokeWidth, color); colorFill(ptr_fill + w - Base::_strokeWidth + 1, ptr_fill + w + 1, color); ptr_fill += p; - } + } } else { x = r; y = 0; T = 0; px = p * x; py = 0; - + while (x > 1 + y++) { __WU_ALGORITHM(); @@ -1607,12 +1607,12 @@ drawCircleAlg(int x1, int y1, int r, PixelType color, VectorRenderer::FillMode f colorFill(ptr - x - py, ptr + x - py, color); colorFill(ptr - y + px, ptr + y + px, color); colorFill(ptr - y - px, ptr + y - px, color); - + __WU_DRAWCIRCLE(ptr, ptr, ptr, ptr, x, y, px, py, a1); - } + } } } #endif - + } diff --git a/graphics/VectorRendererSpec.h b/graphics/VectorRendererSpec.h index fdeb9f9989..f1bcd1854e 100644 --- a/graphics/VectorRendererSpec.h +++ b/graphics/VectorRendererSpec.h @@ -22,7 +22,7 @@ * $Id$ * */ - + #ifndef VECTOR_RENDERER_SPEC_H #define VECTOR_RENDERER_SPEC_H @@ -44,7 +44,7 @@ namespace Graphics { * * @param PixelFormat Defines the type of the PixelFormat struct which contains all * the actual information of the pixels being used, as declared in "graphics/colormasks.h" - * + * * TODO: Expand documentation. * * @see VectorRenderer @@ -57,7 +57,7 @@ public: VectorRendererSpec() { _bitmapAlphaColor = RGBToColor<PixelFormat>(255, 0, 255); } - + void drawLine(int x1, int y1, int x2, int y2); void drawCircle(int x, int y, int r); void drawSquare(int x, int y, int w, int h); @@ -67,24 +67,24 @@ public: void drawBeveledSquare(int x, int y, int w, int h, int bevel) { drawBevelSquareAlg(x, y, w, h, bevel, _bevelColor, _fgColor, Base::_fillMode != kFillDisabled); } - void drawString(const Graphics::Font *font, const Common::String &text, + void drawString(const Graphics::Font *font, const Common::String &text, const Common::Rect &area, Graphics::TextAlign alignH, GUI::ThemeEngine::TextAlignVertical alignV, int deltax, bool elipsis); void setFgColor(uint8 r, uint8 g, uint8 b) { _fgColor = RGBToColor<PixelFormat>(r, g, b); } void setBgColor(uint8 r, uint8 g, uint8 b) { _bgColor = RGBToColor<PixelFormat>(r, g, b); } void setBevelColor(uint8 r, uint8 g, uint8 b) { _bevelColor = RGBToColor<PixelFormat>(r, g, b); } - void setGradientColors(uint8 r1, uint8 g1, uint8 b1, uint8 r2, uint8 g2, uint8 b2); - - void copyFrame(OSystem *sys, const Common::Rect &r); - void copyWholeFrame(OSystem *sys) { copyFrame(sys, Common::Rect(0, 0, _activeSurface->w, _activeSurface->h)); } - - void fillSurface(); - void blitSurface(const Graphics::Surface *source, const Common::Rect &r); - void blitSubSurface(const Graphics::Surface *source, const Common::Rect &r); - void blitAlphaBitmap(const Graphics::Surface *source, const Common::Rect &r); - - void applyScreenShading(GUI::ThemeEngine::ShadingStyle shadingStyle); + void setGradientColors(uint8 r1, uint8 g1, uint8 b1, uint8 r2, uint8 g2, uint8 b2); + + void copyFrame(OSystem *sys, const Common::Rect &r); + void copyWholeFrame(OSystem *sys) { copyFrame(sys, Common::Rect(0, 0, _activeSurface->w, _activeSurface->h)); } + + void fillSurface(); + void blitSurface(const Graphics::Surface *source, const Common::Rect &r); + void blitSubSurface(const Graphics::Surface *source, const Common::Rect &r); + void blitAlphaBitmap(const Graphics::Surface *source, const Common::Rect &r); + + void applyScreenShading(GUI::ThemeEngine::ShadingStyle shadingStyle); protected: @@ -117,7 +117,7 @@ protected: /** * Blends a single pixel on the surface in the given pixel pointer, using supplied color * and Alpha intensity. - * + * * This is implemented to prevent blendPixel() to calculate the surface pointer on each call. * Optimized drawing algorithms should call this function when possible. * @@ -126,7 +126,7 @@ protected: * @param color Color of the pixel * @param alpha Alpha intensity of the pixel (0-255) */ - inline void blendPixelPtr(PixelType *ptr, PixelType color, uint8 alpha); + inline void blendPixelPtr(PixelType *ptr, PixelType color, uint8 alpha); /** * PRIMITIVE DRAWING ALGORITHMS @@ -139,33 +139,33 @@ protected: * @see VectorRendererAA::drawLineAlg * @see VectorRendererAA::drawCircleAlg */ - virtual void drawLineAlg(int x1, int y1, int x2, int y2, + virtual void drawLineAlg(int x1, int y1, int x2, int y2, int dx, int dy, PixelType color); - - virtual void drawCircleAlg(int x, int y, int r, + + virtual void drawCircleAlg(int x, int y, int r, PixelType color, FillMode fill_m); - - virtual void drawRoundedSquareAlg(int x1, int y1, int r, int w, int h, + + virtual void drawRoundedSquareAlg(int x1, int y1, int r, int w, int h, PixelType color, FillMode fill_m); - - virtual void drawSquareAlg(int x, int y, int w, int h, + + virtual void drawSquareAlg(int x, int y, int w, int h, PixelType color, FillMode fill_m); - - virtual void drawTriangleVertAlg(int x, int y, int w, int h, + + virtual void drawTriangleVertAlg(int x, int y, int w, int h, bool inverted, PixelType color, FillMode fill_m); - - virtual void drawTriangleFast(int x, int y, int size, + + virtual void drawTriangleFast(int x, int y, int size, bool inverted, PixelType color, FillMode fill_m); - - virtual void drawBevelSquareAlg(int x, int y, int w, int h, + + virtual void drawBevelSquareAlg(int x, int y, int w, int h, int bevel, PixelType top_color, PixelType bottom_color, bool fill); - - virtual void drawTabAlg(int x, int y, int w, int h, int r, - PixelType color, VectorRenderer::FillMode fill_m, + + virtual void drawTabAlg(int x, int y, int w, int h, int r, + PixelType color, VectorRenderer::FillMode fill_m, int baseLeft = 0, int baseRight = 0); - - virtual void drawBevelTabAlg(int x, int y, int w, int h, - int bevel, PixelType topColor, PixelType bottomColor, + + virtual void drawBevelTabAlg(int x, int y, int w, int h, + int bevel, PixelType topColor, PixelType bottomColor, int baseLeft = 0, int baseRight = 0); /** @@ -191,7 +191,7 @@ protected: * @param max Maximum amount of the progress. * @return Composite color of the gradient at the given "progress" amount. */ - inline PixelType calcGradient(uint32 pos, uint32 max); + inline PixelType calcGradient(uint32 pos, uint32 max); /** * Fills several pixels in a row with a given color and the specified alpha blending. @@ -216,15 +216,15 @@ protected: * for portable platforms with platform-specific assembly code. * * This fill operation is extensively used throughout the renderer, so this - * counts as one of the main bottlenecks. Please replace it with assembly + * counts as one of the main bottlenecks. Please replace it with assembly * when possible! * * @param first Pointer to the first pixel to fill. * @param last Pointer to the last pixel to fill. * @param color Color of the pixel */ - inline void colorFill(PixelType *first, PixelType *last, PixelType color); - + inline void colorFill(PixelType *first, PixelType *last, PixelType color); + #ifndef DISABLE_FANCY_THEMES void areaConvolution(const Common::Rect &area, const int filter[3][3], int filterDiv, int offset); #endif @@ -234,7 +234,7 @@ protected: PixelType _gradientStart; /**< Start color for the fill gradient */ PixelType _gradientEnd; /**< End color for the fill gradient */ - + PixelType _bevelColor; PixelType _bitmapAlphaColor; }; @@ -247,7 +247,7 @@ protected: * This templated class inherits all the functionality of the VectorRendererSpec * class but uses better looking yet slightly slower AA algorithms for drawing * most primitives. May be used in faster platforms. - * + * * TODO: Expand documentation. * * @see VectorRenderer @@ -287,14 +287,14 @@ protected: * @see VectorRenderer::drawRoundedAlg() */ virtual void drawRoundedSquareAlg(int x1, int y1, int r, int w, int h, PixelType color, VectorRenderer::FillMode fill_m); - + virtual void drawRoundedSquareShadow(int x, int y, int r, int w, int h, int blur) { Base::drawRoundedSquareShadow(x, y, r, w, h, blur); -// VectorRenderer::applyConvolutionMatrix(VectorRenderer::kConvolutionHardBlur, +// VectorRenderer::applyConvolutionMatrix(VectorRenderer::kConvolutionHardBlur, // Common::Rect(x, y, x + w + blur * 2, y + h + blur * 2)); } }; #endif - + } #endif diff --git a/graphics/cursorman.h b/graphics/cursorman.h index bf05ab762b..bc38466eda 100644 --- a/graphics/cursorman.h +++ b/graphics/cursorman.h @@ -81,7 +81,7 @@ public: /** * Pop all of the cursors and cursor palettes from their respective stacks. - * The purpose is to ensure that all unecessary cursors are removed from the + * The purpose is to ensure that all unecessary cursors are removed from the * stack when returning to the launcher from an engine. * */ diff --git a/graphics/font.cpp b/graphics/font.cpp index 34b1b13581..f896b3c94e 100644 --- a/graphics/font.cpp +++ b/graphics/font.cpp @@ -65,7 +65,7 @@ void drawCharIntern(byte *ptr, uint pitch, const bitmap_t *src, int h, int minX, tmp++; buffer <<= 1; } - + ptr += pitch; } } diff --git a/graphics/imageman.cpp b/graphics/imageman.cpp index 04c732028b..ab99ae256c 100644 --- a/graphics/imageman.cpp +++ b/graphics/imageman.cpp @@ -61,7 +61,7 @@ bool ImageManager::addArchive(const Common::String &name) { #endif } else { Common::FSDirectory *dir = new Common::FSDirectory(node); - if (!dir || !dir->getFSNode().isDirectory()) + if (!dir || !dir->getFSNode().isDirectory()) return false; arch = dir; diff --git a/graphics/scaler.cpp b/graphics/scaler.cpp index 9e8e58180d..e1f3775eac 100644 --- a/graphics/scaler.cpp +++ b/graphics/scaler.cpp @@ -127,11 +127,11 @@ void DestroyScalers(){ */ void Normal1x(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch, int width, int height) { - // Spot the case when it can all be done in 1 hit - if (((int)srcPitch == 2 * width) && ((int)dstPitch == 2 * width)) { - width *= height; - height = 1; - } + // Spot the case when it can all be done in 1 hit + if (((int)srcPitch == 2 * width) && ((int)dstPitch == 2 * width)) { + width *= height; + height = 1; + } while (height--) { memcpy(dstPtr, srcPtr, 2 * width); srcPtr += srcPitch; diff --git a/graphics/surface.h b/graphics/surface.h index 747bda9a26..2d168a10dd 100644 --- a/graphics/surface.h +++ b/graphics/surface.h @@ -35,10 +35,10 @@ namespace Graphics { * operations, font rendering, etc. */ struct Surface { - /** - * ARM code relies on the layout of the first 3 of these fields. Do - * not change them. - */ + /** + * ARM code relies on the layout of the first 3 of these fields. Do + * not change them. + */ uint16 w; uint16 h; uint16 pitch; diff --git a/graphics/thumbnail.cpp b/graphics/thumbnail.cpp index 709ba9ea54..1d88dc5147 100644 --- a/graphics/thumbnail.cpp +++ b/graphics/thumbnail.cpp @@ -75,7 +75,7 @@ bool checkThumbnailHeader(Common::SeekableReadStream &in) { ThumbnailHeader header; bool hasHeader = loadHeader(in, header, false); - + in.seek(position, SEEK_SET); return hasHeader; diff --git a/graphics/video/smk_player.cpp b/graphics/video/smk_player.cpp index 458a8c0d12..b0e79792d8 100644 --- a/graphics/video/smk_player.cpp +++ b/graphics/video/smk_player.cpp @@ -39,10 +39,10 @@ namespace Graphics { enum SmkBlockTypes { - SMK_BLOCK_MONO = 0, - SMK_BLOCK_FULL = 1, - SMK_BLOCK_SKIP = 2, - SMK_BLOCK_FILL = 3 + SMK_BLOCK_MONO = 0, + SMK_BLOCK_FULL = 1, + SMK_BLOCK_SKIP = 2, + SMK_BLOCK_FILL = 3 }; /* @@ -446,7 +446,7 @@ bool SMKPlayer::loadFile(const char *fileName) { // * bit 28 - 1 = stereo audio; 0 = mono audio // * bits 27-26 - if both set to zero - use v2 sound decompression // * bits 25-24 - unused - // * bits 23-0 - audio sample rate + // * bits 23-0 - audio sample rate audioInfo = _fileStream->readUint32LE(); _header.audioInfo[i].isCompressed = audioInfo & 0x80000000; _header.audioInfo[i].hasAudio = audioInfo & 0x40000000; @@ -570,7 +570,7 @@ bool SMKPlayer::decodeNextFrame() { if (_header.audioInfo[i].hasAudio && chunkSize > 0 && i == 0) { // If it's track 0, play the audio data byte *soundBuffer = new byte[chunkSize]; - + _fileStream->read(soundBuffer, chunkSize); if (_header.audioInfo[i].isCompressed) { diff --git a/gui/Actions.h b/gui/Actions.h index b68a391dd2..67faa03cba 100644 --- a/gui/Actions.h +++ b/gui/Actions.h @@ -58,7 +58,7 @@ public: bool saveMapping(); unsigned int getMapping(ActionType action); void setMapping(ActionType action, unsigned int keyCode); - Key& getKeyAction(ActionType action); + Key& getKeyAction(ActionType action); // Action domain virtual Common::String domain() = 0; diff --git a/gui/ListWidget.cpp b/gui/ListWidget.cpp index 37cbd668ce..cb0ef54888 100644 --- a/gui/ListWidget.cpp +++ b/gui/ListWidget.cpp @@ -374,7 +374,7 @@ void ListWidget::drawWidget() { if (_hasFocus) inverted = true; else - g_gui.theme()->drawWidgetBackground(Common::Rect(_x, y - 1, _x + _w - 1, y + fontHeight - 1), + g_gui.theme()->drawWidgetBackground(Common::Rect(_x, y - 1, _x + _w - 1, y + fontHeight - 1), 0, ThemeEngine::kWidgetBackgroundBorderSmall); } @@ -386,7 +386,7 @@ void ListWidget::drawWidget() { char temp[10]; sprintf(temp, "%2d. ", (pos + _numberingMode)); buffer = temp; - g_gui.theme()->drawText(Common::Rect(_x, y, _x + r.left + _leftPadding, y + fontHeight - 2), + g_gui.theme()->drawText(Common::Rect(_x, y, _x + r.left + _leftPadding, y + fontHeight - 2), buffer, _state, Graphics::kTextAlignLeft, inverted, _leftPadding); pad = 0; } @@ -397,7 +397,7 @@ void ListWidget::drawWidget() { buffer = _editString; adjustOffset(); width = _w - r.left - _hlRightPadding - _leftPadding - scrollbarW; - g_gui.theme()->drawText(Common::Rect(_x + r.left, y, _x + r.left + width, y + fontHeight-2), + g_gui.theme()->drawText(Common::Rect(_x + r.left, y, _x + r.left + width, y + fontHeight-2), buffer, _state, Graphics::kTextAlignLeft, inverted, pad); } else { int maxWidth = _textWidth[i]; @@ -410,7 +410,7 @@ void ListWidget::drawWidget() { width = _w - r.left - _hlRightPadding - scrollbarW; if (width > maxWidth) maxWidth = width; - g_gui.theme()->drawText(Common::Rect(_x + r.left, y, _x + r.left + maxWidth, y + fontHeight-2), + g_gui.theme()->drawText(Common::Rect(_x + r.left, y, _x + r.left + maxWidth, y + fontHeight-2), buffer, _state, Graphics::kTextAlignLeft, inverted, pad); } @@ -499,12 +499,12 @@ void ListWidget::reflowLayout() { // We do a rough rounding on the decimal places of Entries Per Page, // to add another entry even if it goes a tad over the padding. _entriesPerPage = ((_h - _topPadding - _bottomPadding) << 16) / kLineHeight; - + if ((uint)(_entriesPerPage & 0xFFFF) >= 0xF000) _entriesPerPage += (1 << 16); _entriesPerPage >>= 16; - + assert(_entriesPerPage > 0); delete[] _textWidth; diff --git a/gui/TabWidget.h b/gui/TabWidget.h index 3dffcd2afe..973d65dddb 100644 --- a/gui/TabWidget.h +++ b/gui/TabWidget.h @@ -85,7 +85,7 @@ public: * Widgets are always added to the active tab. */ void setActiveTab(int tabID); - + void setTabTitle(int tabID, const String &title) { assert(0 <= tabID && tabID < (int)_tabs.size()); _tabs[tabID].title = title; diff --git a/gui/ThemeData.cpp b/gui/ThemeData.cpp index d1593a0642..e05ca7f988 100644 --- a/gui/ThemeData.cpp +++ b/gui/ThemeData.cpp @@ -41,57 +41,57 @@ namespace GUI { * Data definitions for theme engine elements *********************************************************/ const ThemeEngine::DrawDataInfo ThemeEngine::kDrawDataDefaults[] = { - {kDDMainDialogBackground, "mainmenu_bg", true, kDDNone}, - {kDDSpecialColorBackground, "special_bg", true, kDDNone}, - {kDDPlainColorBackground, "plain_bg", true, kDDNone}, - {kDDDefaultBackground, "default_bg", true, kDDNone}, - {kDDTextSelectionBackground, "text_selection", false, kDDNone}, + {kDDMainDialogBackground, "mainmenu_bg", true, kDDNone}, + {kDDSpecialColorBackground, "special_bg", true, kDDNone}, + {kDDPlainColorBackground, "plain_bg", true, kDDNone}, + {kDDDefaultBackground, "default_bg", true, kDDNone}, + {kDDTextSelectionBackground, "text_selection", false, kDDNone}, - {kDDWidgetBackgroundDefault, "widget_default", true, kDDNone}, - {kDDWidgetBackgroundSmall, "widget_small", true, kDDNone}, - {kDDWidgetBackgroundEditText, "widget_textedit", true, kDDNone}, - {kDDWidgetBackgroundSlider, "widget_slider", true, kDDNone}, + {kDDWidgetBackgroundDefault, "widget_default", true, kDDNone}, + {kDDWidgetBackgroundSmall, "widget_small", true, kDDNone}, + {kDDWidgetBackgroundEditText, "widget_textedit", true, kDDNone}, + {kDDWidgetBackgroundSlider, "widget_slider", true, kDDNone}, - {kDDButtonIdle, "button_idle", true, kDDWidgetBackgroundSlider}, - {kDDButtonHover, "button_hover", false, kDDButtonIdle}, - {kDDButtonDisabled, "button_disabled", true, kDDNone}, + {kDDButtonIdle, "button_idle", true, kDDWidgetBackgroundSlider}, + {kDDButtonHover, "button_hover", false, kDDButtonIdle}, + {kDDButtonDisabled, "button_disabled", true, kDDNone}, - {kDDSliderFull, "slider_full", false, kDDNone}, - {kDDSliderHover, "slider_hover", false, kDDNone}, - {kDDSliderDisabled, "slider_disabled", true, kDDNone}, + {kDDSliderFull, "slider_full", false, kDDNone}, + {kDDSliderHover, "slider_hover", false, kDDNone}, + {kDDSliderDisabled, "slider_disabled", true, kDDNone}, - {kDDCheckboxDefault, "checkbox_default", true, kDDNone}, - {kDDCheckboxDisabled, "checkbox_disabled", true, kDDNone}, - {kDDCheckboxSelected, "checkbox_selected", false, kDDCheckboxDefault}, + {kDDCheckboxDefault, "checkbox_default", true, kDDNone}, + {kDDCheckboxDisabled, "checkbox_disabled", true, kDDNone}, + {kDDCheckboxSelected, "checkbox_selected", false, kDDCheckboxDefault}, - {kDDTabActive, "tab_active", false, kDDTabInactive}, - {kDDTabInactive, "tab_inactive", true, kDDNone}, - {kDDTabBackground, "tab_background", true, kDDNone}, + {kDDTabActive, "tab_active", false, kDDTabInactive}, + {kDDTabInactive, "tab_inactive", true, kDDNone}, + {kDDTabBackground, "tab_background", true, kDDNone}, - {kDDScrollbarBase, "scrollbar_base", true, kDDNone}, + {kDDScrollbarBase, "scrollbar_base", true, kDDNone}, - {kDDScrollbarButtonIdle, "scrollbar_button_idle", true, kDDNone}, - {kDDScrollbarButtonHover, "scrollbar_button_hover", false, kDDScrollbarButtonIdle}, + {kDDScrollbarButtonIdle, "scrollbar_button_idle", true, kDDNone}, + {kDDScrollbarButtonHover, "scrollbar_button_hover", false, kDDScrollbarButtonIdle}, - {kDDScrollbarHandleIdle, "scrollbar_handle_idle", false, kDDNone}, - {kDDScrollbarHandleHover, "scrollbar_handle_hover", false, kDDScrollbarBase}, + {kDDScrollbarHandleIdle, "scrollbar_handle_idle", false, kDDNone}, + {kDDScrollbarHandleHover, "scrollbar_handle_hover", false, kDDScrollbarBase}, - {kDDPopUpIdle, "popup_idle", true, kDDNone}, - {kDDPopUpHover, "popup_hover", false, kDDPopUpIdle}, - {kDDPopUpDisabled, "popup_disabled", true, kDDNone}, + {kDDPopUpIdle, "popup_idle", true, kDDNone}, + {kDDPopUpHover, "popup_hover", false, kDDPopUpIdle}, + {kDDPopUpDisabled, "popup_disabled", true, kDDNone}, - {kDDCaret, "caret", false, kDDNone}, - {kDDSeparator, "separator", true, kDDNone}, + {kDDCaret, "caret", false, kDDNone}, + {kDDSeparator, "separator", true, kDDNone}, }; const ThemeEngine::TextDataInfo ThemeEngine::kTextDataDefaults[] = { - {kTextDataDefault, "text_default"}, - {kTextDataHover, "text_hover"}, - {kTextDataDisabled, "text_disabled"}, - {kTextDataInverted, "text_inverted"}, - {kTextDataButton, "text_button"}, - {kTextDataButtonHover, "text_button_hover"}, - {kTextDataNormalFont, "text_normal"} + {kTextDataDefault, "text_default"}, + {kTextDataHover, "text_hover"}, + {kTextDataDisabled, "text_disabled"}, + {kTextDataInverted, "text_inverted"}, + {kTextDataButton, "text_button"}, + {kTextDataButtonHover, "text_button_hover"}, + {kTextDataNormalFont, "text_normal"} }; diff --git a/gui/ThemeEngine.cpp b/gui/ThemeEngine.cpp index 839f351aa7..06f36a50d2 100644 --- a/gui/ThemeEngine.cpp +++ b/gui/ThemeEngine.cpp @@ -55,7 +55,7 @@ ThemeEngine::ThemeEngine(Common::String fileName, GraphicsMode mode) : _buffering(false), _bytesPerPixel(0), _graphicsMode(kGfxDisabled), _font(0), _initOk(false), _themeOk(false), _enabled(false), _cursor(0), _loadedThemeX(0), _loadedThemeY(0) { - + _system = g_system; _parser = new ThemeParser(this); _themeEval = new GUI::ThemeEval(); @@ -514,7 +514,7 @@ bool ThemeEngine::loadThemeXML(const Common::String &themeName) { #endif } else if (node.isDirectory()) { -// FIXME: This warning makes no sense whatsoever. Who added this? +// FIXME: This warning makes no sense whatsoever. Who added this? // warning("Don't know how to open theme '%s'", themeName.c_str()); archive = new Common::FSDirectory(node); } @@ -1090,7 +1090,7 @@ const Graphics::Font *ThemeEngine::loadFontFromArchive(const Common::String &fil #endif } else { Common::FSDirectory *dir = new Common::FSDirectory(node); - if (!dir || !dir->getFSNode().isDirectory()) + if (!dir || !dir->getFSNode().isDirectory()) return 0; arch = dir; @@ -1163,7 +1163,7 @@ Common::String ThemeEngine::genCacheFilename(const char *filename) { * Static Theme XML functions *********************************************************/ -bool ThemeEngine::themeConfigParseHeader(Common::String header, Common::String &themeName) { +bool ThemeEngine::themeConfigParseHeader(Common::String header, Common::String &themeName) { header.trim(); if (header.empty()) @@ -1197,7 +1197,7 @@ bool ThemeEngine::themeConfigUseable(const Common::FSNode &node, Common::String stream.open("THEMERC", zipArchive); } #endif - } else if (node.isDirectory()) { + } else if (node.isDirectory()) { Common::FSNode headerfile = node.getChild("THEMERC"); if (!headerfile.exists() || !headerfile.isReadable() || headerfile.isDirectory()) return false; diff --git a/gui/ThemeEngine.h b/gui/ThemeEngine.h index 43f2a8c8eb..8eac37e251 100644 --- a/gui/ThemeEngine.h +++ b/gui/ThemeEngine.h @@ -114,10 +114,10 @@ protected: * @see kDrawDataDefaults[] for implementation. */ static const struct DrawDataInfo { - DrawData id; /** The actual ID of the DrawData item. */ - const char *name; /** The name of the DrawData item as it appears in the Theme Description files */ - bool buffer; /** Sets whether this item is buffered on the backbuffer or drawn directly to the screen. */ - DrawData parent; /** Parent DrawData item, for items that overlay. E.g. kButtonIdle -> kButtonHover */ + DrawData id; /** The actual ID of the DrawData item. */ + const char *name; /** The name of the DrawData item as it appears in the Theme Description files */ + bool buffer; /** Sets whether this item is buffered on the backbuffer or drawn directly to the screen. */ + DrawData parent; /** Parent DrawData item, for items that overlay. E.g. kButtonIdle -> kButtonHover */ } kDrawDataDefaults[]; @@ -155,7 +155,7 @@ public: kWidgetBackgroundEditText, //!< Background used for edit text fields kWidgetBackgroundSlider //!< Background used for sliders }; - + //! Dialog background type enum DialogBackground { kDialogBackgroundMain, @@ -198,13 +198,13 @@ public: kShadingDim, //!< Dimming unused areas kShadingLuminance //!< Converting colors to luminance for unused areas }; - + //! Special image ids for images used in the GUI enum kThemeImages { kImageLogo = 0, //!< ScummVM Logo used in the launcher kImageLogoSmall //!< ScummVM logo used in the GMM }; - + /** Graphics mode enumeration. * Each item represents a set of BPP and Renderer modes for a given * surface. @@ -214,7 +214,7 @@ public: kGfxStandard16bit, /** 2BPP with the standard (aliased) renderer. */ kGfxAntialias16bit /** 2BPP with the optimized AA renderer. */ }; - + /** Constant value to expand dirty rectangles, to make sure they are fully copied */ static const int kDirtyRectangleThreshold = 1; @@ -276,7 +276,7 @@ public: void closeAllDialogs() {} /** Drawing area has been removed: it was too hackish. A workaround is on the works. - TODO: finish the workaround for the credits dialog + TODO: finish the workaround for the credits dialog TODO: remove this from the original GUI::Theme API */ void resetDrawArea() {} @@ -345,7 +345,7 @@ public: /** * Actual implementation of a Dirty Rect drawing routine. - * Dirty rectangles are queued on a list and are later merged/calculated + * Dirty rectangles are queued on a list and are later merged/calculated * before the actual drawing. * * @param r Area of the dirty rect. @@ -412,7 +412,7 @@ public: * filename. * * @param fontName Identifier name for the font. - * @param file Name of the font file. + * @param file Name of the font file. * @param r, g, b Color of the font. */ bool addFont(const Common::String &fontName, const Common::String &file, int r, int g, int b); @@ -420,7 +420,7 @@ public: /** * Interface for the ThemeParser class: Loads a bitmap file to use on the GUI. - * The filename is also used as its identifier. + * The filename is also used as its identifier. * * @param filename Name of the bitmap file. */ @@ -483,7 +483,7 @@ public: * bitmap and sets it as the active cursor. * * @param filename File name of the bitmap to load. - * @param hotspotX X Coordinate of the bitmap which does the cursor click. + * @param hotspotX X Coordinate of the bitmap which does the cursor click. * @param hotspotY Y Coordinate of the bitmap which does the cursor click. * @param scale Scale at which the bitmap is supposed to be used. */ @@ -617,22 +617,22 @@ protected: void debugWidgetPosition(const char *name, const Common::Rect &r); public: - + /** * LEGACY: Old GUI::Theme API */ - - bool needThemeReload() { + + bool needThemeReload() { return ((_loadedThemeX != g_system->getOverlayWidth()) || - (_loadedThemeY != g_system->getOverlayHeight())); + (_loadedThemeY != g_system->getOverlayHeight())); } const Graphics::Font *loadFont(const Common::String &filename); const Graphics::Font *loadFontFromArchive(const Common::String &filename); Common::String genCacheFilename(const char *filename); - + bool isThemeLoadingRequired(); - + static bool themeConfigUseable(const Common::FSNode &node, Common::String &themeName); static bool themeConfigParseHeader(Common::String header, Common::String &themeName); diff --git a/gui/ThemeEval.cpp b/gui/ThemeEval.cpp index 753455e799..5d841c6ad7 100644 --- a/gui/ThemeEval.cpp +++ b/gui/ThemeEval.cpp @@ -44,45 +44,45 @@ void ThemeEval::reset() { _vars.clear(); _curDialog.clear(); _curLayout.clear(); - + for (LayoutsMap::iterator i = _layouts.begin(); i != _layouts.end(); ++i) delete i->_value; - + _layouts.clear(); } bool ThemeEval::getWidgetData(const Common::String &widget, int16 &x, int16 &y, uint16 &w, uint16 &h) { Common::StringTokenizer tokenizer(widget, "."); - + if (widget.hasPrefix("Dialog.")) tokenizer.nextToken(); Common::String dialogName = "Dialog." + tokenizer.nextToken(); Common::String widgetName = tokenizer.nextToken(); - - if (!_layouts.contains(dialogName)) + + if (!_layouts.contains(dialogName)) return false; if (widgetName.empty()) return _layouts[dialogName]->getDialogData(x, y, w, h); - + return _layouts[dialogName]->getWidgetData(widgetName, x, y, w, h); } -void ThemeEval::addWidget(const Common::String &name, int w, int h, const Common::String &type, bool enabled) { +void ThemeEval::addWidget(const Common::String &name, int w, int h, const Common::String &type, bool enabled) { int typeW = -1; int typeH = -1; - + if (!type.empty()) { typeW = getVar("Globals." + type + ".Width", -1); typeH = getVar("Globals." + type + ".Height", -1); } - - ThemeLayoutWidget *widget = new ThemeLayoutWidget(_curLayout.top(), name, - typeW == -1 ? w : typeW, + + ThemeLayoutWidget *widget = new ThemeLayoutWidget(_curLayout.top(), name, + typeW == -1 ? w : typeW, typeH == -1 ? h : typeH); - + _curLayout.top()->addChild(widget); setVar(_curDialog + "." + name + ".Enabled", enabled ? 1 : 0); } @@ -90,9 +90,9 @@ void ThemeEval::addWidget(const Common::String &name, int w, int h, const Common void ThemeEval::addDialog(const Common::String &name, const Common::String &overlays, bool enabled, int inset) { int16 x, y; uint16 w, h; - + ThemeLayout *layout = 0; - + if (overlays == "screen") { layout = new ThemeLayoutMain(inset, inset, g_system->getOverlayWidth() - 2 * inset, g_system->getOverlayHeight() - 2 * inset); } else if (overlays == "screen_center") { @@ -100,13 +100,13 @@ void ThemeEval::addDialog(const Common::String &name, const Common::String &over } else if (getWidgetData(overlays, x, y, w, h)) { layout = new ThemeLayoutMain(x + inset, y + inset, w - 2 * inset, h - 2 * inset); } - + if (!layout) error("Error when loading dialog position for '%s'", overlays.c_str()); - + if (_layouts.contains(name)) delete _layouts[name]; - + _layouts[name] = layout; layout->setPadding( @@ -115,7 +115,7 @@ void ThemeEval::addDialog(const Common::String &name, const Common::String &over getVar("Globals.Padding.Top", 0), getVar("Globals.Padding.Bottom", 0) ); - + _curLayout.push(layout); _curDialog = name; setVar(name + ".Enabled", enabled ? 1 : 0); @@ -123,24 +123,24 @@ void ThemeEval::addDialog(const Common::String &name, const Common::String &over void ThemeEval::addLayout(ThemeLayout::LayoutType type, int spacing, bool center) { ThemeLayout *layout = 0; - + if (spacing == -1) spacing = getVar("Globals.Layout.Spacing", 4); - + if (type == ThemeLayout::kLayoutVertical) layout = new ThemeLayoutVertical(_curLayout.top(), spacing, center); else if (type == ThemeLayout::kLayoutHorizontal) layout = new ThemeLayoutHorizontal(_curLayout.top(), spacing, center); assert(layout); - + layout->setPadding( getVar("Globals.Padding.Left", 0), getVar("Globals.Padding.Right", 0), getVar("Globals.Padding.Top", 0), getVar("Globals.Padding.Bottom", 0) ); - + _curLayout.top()->addChild(layout); _curLayout.push(layout); } @@ -153,7 +153,7 @@ void ThemeEval::addSpace(int size) { bool ThemeEval::addImportedLayout(const Common::String &name) { if (!_layouts.contains(name)) return false; - + _curLayout.top()->importLayout(_layouts[name]); return true; } diff --git a/gui/ThemeEval.h b/gui/ThemeEval.h index 5fe0e73bd3..07242e890e 100644 --- a/gui/ThemeEval.h +++ b/gui/ThemeEval.h @@ -34,57 +34,57 @@ #include "gui/ThemeLayout.h" namespace GUI { - + class ThemeEval { typedef Common::HashMap<Common::String, int> VariablesMap; typedef Common::HashMap<Common::String, ThemeLayout *> LayoutsMap; - + public: ThemeEval() { buildBuiltinVars(); } - + ~ThemeEval(); - + void buildBuiltinVars(); - + int getVar(const Common::String &s) { if (_vars.contains(s)) return _vars[s]; - + if (_builtin.contains(s)) return _builtin[s]; error("CRITICAL: Missing variable: '%s'", s.c_str()); - return -13375; //EVAL_UNDEF_VAR + return -13375; //EVAL_UNDEF_VAR } - + int getVar(const Common::String &s, int def) { if (_vars.contains(s)) return _vars[s]; - + if (_builtin.contains(s)) return _builtin[s]; return def; } - + void setVar(const Common::String &name, int val) { _vars[name] = val; } - + bool hasVar(const Common::String &name) { return _vars.contains(name) || _builtin.contains(name); } - + void addDialog(const Common::String &name, const Common::String &overlays, bool enabled = true, int inset = 0); void addLayout(ThemeLayout::LayoutType type, int spacing, bool center = false); void addWidget(const Common::String &name, int w, int h, const Common::String &type, bool enabled = true); bool addImportedLayout(const Common::String &name); void addSpace(int size); - + void addPadding(int16 l, int16 r, int16 t, int16 b) { _curLayout.top()->setPadding(l, r, t, b); } - + void closeLayout() { _curLayout.pop(); } void closeDialog() { _curLayout.pop()->reflowLayout(); _curDialog.clear(); } - + bool getWidgetData(const Common::String &widget, int16 &x, int16 &y, uint16 &w, uint16 &h); #ifdef LAYOUT_DEBUG_DIALOG @@ -92,13 +92,13 @@ public: _layouts[LAYOUT_DEBUG_DIALOG]->debugDraw(screen, font); } #endif - + void reset(); - + private: VariablesMap _vars; VariablesMap _builtin; - + LayoutsMap _layouts; Common::Stack<ThemeLayout *> _curLayout; Common::String _curDialog; diff --git a/gui/ThemeLayout.cpp b/gui/ThemeLayout.cpp index 676fa0789b..415a77ef0d 100644 --- a/gui/ThemeLayout.cpp +++ b/gui/ThemeLayout.cpp @@ -37,17 +37,17 @@ namespace GUI { void ThemeLayout::importLayout(ThemeLayout *layout) { assert(layout->getLayoutType() == kLayoutMain); - + if (layout->_children.size() == 0) return; - + layout = layout->_children[0]; - + if (getLayoutType() == layout->getLayoutType()) { for (uint i = 0; i < layout->_children.size(); ++i) - _children.push_back(layout->_children[i]->makeClone()); + _children.push_back(layout->_children[i]->makeClone()); } else { - _children.push_back(layout->makeClone()); + _children.push_back(layout->makeClone()); } } @@ -56,14 +56,14 @@ bool ThemeLayout::getWidgetData(const Common::String &name, int16 &x, int16 &y, if (_children[i]->getWidgetData(name, x, y, w, h)) return true; } - + return false; } int16 ThemeLayout::getParentW() { ThemeLayout *p = _parent; int width = 0; - + while (p && p->getLayoutType() != kLayoutMain) { width += p->_paddingRight + p->_paddingLeft; if (p->getLayoutType() == kLayoutHorizontal) { @@ -72,14 +72,14 @@ int16 ThemeLayout::getParentW() { } p = p->_parent; } - + return p->getWidth() - width; } int16 ThemeLayout::getParentH() { ThemeLayout *p = _parent; int height = 0; - + while (p && p->getLayoutType() != kLayoutMain) { height += p->_paddingBottom + p->_paddingTop; if (p->getLayoutType() == kLayoutVertical) { @@ -88,7 +88,7 @@ int16 ThemeLayout::getParentH() { } p = p->_parent; } - + return p->getHeight() - height; } @@ -99,28 +99,28 @@ bool ThemeLayoutWidget::getWidgetData(const Common::String &name, int16 &x, int1 w = _w; h = _h; return true; } - + return false; } void ThemeLayoutMain::reflowLayout() { assert(_children.size() <= 1); - + if (_children.size()) { _children[0]->resetLayout(); _children[0]->setWidth(_w); _children[0]->setHeight(_h); _children[0]->reflowLayout(); - + if (_w == -1) _w = _children[0]->getWidth(); - + if (_h == -1) _h = _children[0]->getHeight(); - + if (_y == -1) _y = (g_system->getOverlayHeight() >> 1) - (_h >> 1); - + if (_x == -1) _x = (g_system->getOverlayWidth() >> 1) - (_w >> 1); } @@ -130,41 +130,41 @@ void ThemeLayoutVertical::reflowLayout() { int curX, curY; int resize[8]; int rescount = 0; - + curX = _paddingLeft; curY = _paddingTop; _h = _paddingTop + _paddingBottom; - + for (uint i = 0; i < _children.size(); ++i) { - + _children[i]->resetLayout(); _children[i]->reflowLayout(); if (_children[i]->getWidth() == -1) _children[i]->setWidth((_w == -1 ? getParentW() : _w) - _paddingLeft - _paddingRight); - + if (_children[i]->getHeight() == -1) { resize[rescount++] = i; _children[i]->setHeight(0); } - + _children[i]->setY(curY); - + if (_centered && _children[i]->getWidth() < _w && _w != -1) { _children[i]->setX((_w >> 1) - (_children[i]->getWidth() >> 1)); } else _children[i]->setX(curX); - curY += _children[i]->getHeight() + _spacing; + curY += _children[i]->getHeight() + _spacing; _w = MAX(_w, (int16)(_children[i]->getWidth() + _paddingLeft + _paddingRight)); _h += _children[i]->getHeight() + _spacing; } - + _h -= _spacing; - + if (rescount) { int newh = (getParentH() - _h - _paddingBottom) / rescount; - + for (int i = 0; i < rescount; ++i) { _children[resize[i]]->setHeight(newh); _h += newh; @@ -182,12 +182,12 @@ void ThemeLayoutHorizontal::reflowLayout() { curX = _paddingLeft; curY = _paddingTop; _w = _paddingLeft + _paddingRight; - + for (uint i = 0; i < _children.size(); ++i) { - + _children[i]->resetLayout(); _children[i]->reflowLayout(); - + if (_children[i]->getHeight() == -1) _children[i]->setHeight((_h == -1 ? getParentH() : _h) - _paddingTop - _paddingBottom); @@ -195,24 +195,24 @@ void ThemeLayoutHorizontal::reflowLayout() { resize[rescount++] = i; _children[i]->setWidth(0); } - + _children[i]->setX(curX); - + if (_centered && _children[i]->getHeight() < _h && _h != -1) _children[i]->setY((_h >> 1) - (_children[i]->getHeight() >> 1)); else _children[i]->setY(curY); - + curX += (_children[i]->getWidth() + _spacing); _w += _children[i]->getWidth() + _spacing; _h = MAX(_h, (int16)(_children[i]->getHeight() + _paddingTop + _paddingBottom)); } - + _w -= _spacing; - + if (rescount) { int neww = (getParentW() - _w - _paddingRight) / rescount; - + for (int i = 0; i < rescount; ++i) { _children[resize[i]]->setWidth(neww); _w += neww; diff --git a/gui/ThemeLayout.h b/gui/ThemeLayout.h index 2d119023ad..39675686f1 100644 --- a/gui/ThemeLayout.h +++ b/gui/ThemeLayout.h @@ -158,7 +158,7 @@ protected: class ThemeLayoutVertical : public ThemeLayout { public: ThemeLayoutVertical(ThemeLayout *p, int spacing, bool center) : - ThemeLayout(p, "") { + ThemeLayout(p, "") { _spacing = spacing; _centered = center; } diff --git a/gui/ThemeParser.cpp b/gui/ThemeParser.cpp index bbcfc6302e..1a82671c7b 100644 --- a/gui/ThemeParser.cpp +++ b/gui/ThemeParser.cpp @@ -38,8 +38,8 @@ namespace GUI { -ThemeParser::ThemeParser(ThemeEngine *parent) : XMLParser() { - +ThemeParser::ThemeParser(ThemeEngine *parent) : XMLParser() { + _drawFunctions["circle"] = &Graphics::VectorRenderer::drawCallback_CIRCLE; _drawFunctions["square"] = &Graphics::VectorRenderer::drawCallback_SQUARE; _drawFunctions["roundedsq"] = &Graphics::VectorRenderer::drawCallback_ROUNDSQ; @@ -75,7 +75,7 @@ void ThemeParser::cleanup() { Graphics::DrawStep *ThemeParser::defaultDrawStep() { Graphics::DrawStep *step = new Graphics::DrawStep; - + memset(step, 0, sizeof(Graphics::DrawStep)); step->xAlign = Graphics::DrawStep::kVectorAlignManual; @@ -121,9 +121,9 @@ bool ThemeParser::parserCallback_defaults(ParserNode *node) { return parseDrawStep(node, step, false); } -bool ThemeParser::parserCallback_font(ParserNode *node) { +bool ThemeParser::parserCallback_font(ParserNode *node) { int red, green, blue; - + if (resolutionCheck(node->values["resolution"]) == false) { node->ignore = true; return true; @@ -133,15 +133,15 @@ bool ThemeParser::parserCallback_font(ParserNode *node) { getPaletteColor(node->values["color"], red, green, blue); else if (!parseIntegerKey(node->values["color"].c_str(), 3, &red, &green, &blue)) return parserError("Error parsing color value for font definition."); - + if (!_theme->addFont(node->values["id"], node->values["file"], red, green, blue)) return parserError("Error loading Font in theme engine."); - + return true; } -bool ThemeParser::parserCallback_fonts(ParserNode *node) { - return true; +bool ThemeParser::parserCallback_fonts(ParserNode *node) { + return true; } bool ThemeParser::parserCallback_cursor(ParserNode *node) { @@ -149,18 +149,18 @@ bool ThemeParser::parserCallback_cursor(ParserNode *node) { node->ignore = true; return true; } - + int spotx, spoty, scale; - + if (!parseIntegerKey(node->values["hotspot"].c_str(), 2, &spotx, &spoty)) return parserError("Error parsing cursor Hot Spot coordinates."); - + if (!parseIntegerKey(node->values["scale"].c_str(), 1, &scale)) return parserError("Error parsing cursor scale."); - + if (!_theme->createCursor(node->values["file"], spotx, spoty, scale)) return parserError("Error creating Bitmap Cursor."); - + return true; } @@ -169,17 +169,17 @@ bool ThemeParser::parserCallback_bitmap(ParserNode *node) { node->ignore = true; return true; } - + if (!_theme->addBitmap(node->values["filename"])) return parserError("Error loading Bitmap file '%s'", node->values["filename"].c_str()); - + return true; } -bool ThemeParser::parserCallback_text(ParserNode *node) { +bool ThemeParser::parserCallback_text(ParserNode *node) { Graphics::TextAlign alignH; GUI::ThemeEngine::TextAlignVertical alignV; - + if (node->values["horizontal_align"] == "left") alignH = Graphics::kTextAlignLeft; else if (node->values["horizontal_align"] == "right") @@ -187,7 +187,7 @@ bool ThemeParser::parserCallback_text(ParserNode *node) { else if (node->values["horizontal_align"] == "center") alignH = Graphics::kTextAlignCenter; else return parserError("Invalid value for text alignment."); - + if (node->values["vertical_align"] == "top") alignV = GUI::ThemeEngine::kTextAlignVTop; else if (node->values["vertical_align"] == "center") @@ -195,7 +195,7 @@ bool ThemeParser::parserCallback_text(ParserNode *node) { else if (node->values["vertical_align"] == "bottom") alignV = GUI::ThemeEngine::kTextAlignVBottom; else return parserError("Invalid value for text alignment."); - + if (!_theme->addTextData(getParentNode(node)->values["id"], node->values["font"], alignH, alignV)) return parserError("Error adding Text Data for '%s'.", getParentNode(node)->values["id"].c_str()); @@ -205,14 +205,14 @@ bool ThemeParser::parserCallback_text(ParserNode *node) { bool ThemeParser::parserCallback_render_info(ParserNode *node) { if (resolutionCheck(node->values["resolution"]) == false) node->ignore = true; - + return true; } bool ThemeParser::parserCallback_layout_info(ParserNode *node) { if (resolutionCheck(node->values["resolution"]) == false) node->ignore = true; - + return true; } @@ -243,7 +243,7 @@ bool ThemeParser::parserCallback_color(ParserNode *node) { bool ThemeParser::parserCallback_drawstep(ParserNode *node) { Graphics::DrawStep *drawstep = newDrawStep(); - Common::String functionName = node->values["func"]; + Common::String functionName = node->values["func"]; if (_drawFunctions.contains(functionName) == false) return parserError("%s is not a valid drawing function name", functionName.c_str()); @@ -261,14 +261,14 @@ bool ThemeParser::parserCallback_drawstep(ParserNode *node) { bool ThemeParser::parserCallback_drawdata(ParserNode *node) { bool cached = false; - + if (resolutionCheck(node->values["resolution"]) == false) { node->ignore = true; return true; } if (node->values.contains("cache")) { - if (node->values["cache"] == "true") + if (node->values["cache"] == "true") cached = true; else if (node->values["cache"] == "false") cached = false; @@ -350,13 +350,13 @@ bool ThemeParser::parseDrawStep(ParserNode *stepNode, Graphics::DrawStep *drawst if (functionSpecific) { assert(stepNode->values.contains("func")); Common::String functionName = stepNode->values["func"]; - + if (functionName == "bitmap") { if (!stepNode->values.contains("file")) return parserError("Need to specify a filename for Bitmap blitting."); - + drawstep->blitSrc = _theme->getBitmap(stepNode->values["file"]); - + if (!drawstep->blitSrc) return parserError("The given filename hasn't been loaded into the GUI."); } @@ -391,20 +391,20 @@ bool ThemeParser::parseDrawStep(ParserNode *stepNode, Graphics::DrawStep *drawst if (stepNode->values.contains("size")) { warning("The <size> keyword has been deprecated. Use <width> and <height> instead"); } - + if (stepNode->values.contains("width") && stepNode->values["width"] != "auto") { drawstep->autoWidth = false; - + val = stepNode->values["width"]; if (parseIntegerKey(val.c_str(), 1, &x)) drawstep->w = x; else if (val == "height") drawstep->w = -1; else return parserError("Invalid value for vector width."); - + if (stepNode->values.contains("xpos")) { val = stepNode->values["xpos"]; - + if (parseIntegerKey(val.c_str(), 1, &x)) drawstep->x = x; else if (val == "center") @@ -413,16 +413,16 @@ bool ThemeParser::parseDrawStep(ParserNode *stepNode, Graphics::DrawStep *drawst drawstep->xAlign = Graphics::DrawStep::kVectorAlignLeft; else if (val == "right") drawstep->xAlign = Graphics::DrawStep::kVectorAlignRight; - else + else return parserError("Invalid value for X Position"); } else { return parserError("When width is not set to 'auto', a <xpos> tag must be included."); } } - + if (stepNode->values.contains("height") && stepNode->values["height"] != "auto") { drawstep->autoHeight = false; - + val = stepNode->values["height"]; if (parseIntegerKey(val.c_str(), 1, &x)) drawstep->h = x; @@ -432,7 +432,7 @@ bool ThemeParser::parseDrawStep(ParserNode *stepNode, Graphics::DrawStep *drawst if (stepNode->values.contains("ypos")) { val = stepNode->values["ypos"]; - + if (parseIntegerKey(val.c_str(), 1, &x)) drawstep->y = x; else if (val == "center") @@ -441,13 +441,13 @@ bool ThemeParser::parseDrawStep(ParserNode *stepNode, Graphics::DrawStep *drawst drawstep->yAlign = Graphics::DrawStep::kVectorAlignTop; else if (val == "bottom") drawstep->yAlign = Graphics::DrawStep::kVectorAlignBottom; - else + else return parserError("Invalid value for Y Position"); } else { return parserError("When height is not set to 'auto', a <ypos> tag must be included."); } } - + if (drawstep->h == -1 && drawstep->w == -1) return parserError("Cross-reference in Vector Size: Height is set to width and width is set to height."); } @@ -477,30 +477,30 @@ bool ThemeParser::parserCallback_def(ParserNode *node) { node->ignore = true; return true; } - + Common::String var = "Globals." + node->values["var"]; int value; - + if (_theme->getEvaluator()->hasVar(node->values["value"]) == true) value = _theme->getEvaluator()->getVar(node->values["value"]); - + else if (!parseIntegerKey(node->values["value"].c_str(), 1, &value)) return parserError("Invalid definition for '%s'.", var.c_str()); - + _theme->getEvaluator()->setVar(var, value); - return true; + return true; } bool ThemeParser::parserCallback_widget(ParserNode *node) { Common::String var; - + if (getParentNode(node)->name == "globals") { - + if (resolutionCheck(node->values["resolution"]) == false) { node->ignore = true; return true; } - + var = "Globals." + node->values["name"] + "."; if (!parseCommonLayoutProps(node, var)) return parserError("Error parsing Layout properties of '%s'.", var.c_str()); @@ -517,24 +517,24 @@ bool ThemeParser::parserCallback_widget(ParserNode *node) { else if (node->values["enabled"] != "true") return parserError("Invalid value for Widget enabling (expecting true/false)"); } - + if (node->values.contains("width")) { if (_theme->getEvaluator()->hasVar(node->values["width"]) == true) width = _theme->getEvaluator()->getVar(node->values["width"]); - + else if (!parseIntegerKey(node->values["width"].c_str(), 1, &width)) return parserError("Corrupted width value in key for %s", var.c_str()); } - + if (node->values.contains("height")) { if (_theme->getEvaluator()->hasVar(node->values["height"]) == true) height = _theme->getEvaluator()->getVar(node->values["height"]); - + else if (!parseIntegerKey(node->values["height"].c_str(), 1, &height)) return parserError("Corrupted height value in key for %s", var.c_str()); } - - _theme->getEvaluator()->addWidget(var, width, height, node->values["type"], enabled); + + _theme->getEvaluator()->addWidget(var, width, height, node->values["type"], enabled); } return true; @@ -544,26 +544,26 @@ bool ThemeParser::parserCallback_dialog(ParserNode *node) { Common::String var = "Dialog." + node->values["name"]; bool enabled = true; int inset = 0; - + if (resolutionCheck(node->values["resolution"]) == false) { node->ignore = true; return true; } - + if (node->values.contains("enabled")) { if (node->values["enabled"] == "false") enabled = false; else if (node->values["enabled"] != "true") return parserError("Invalid value for Dialog enabling (expecting true/false)"); } - + if (node->values.contains("inset")) { if (!parseIntegerKey(node->values["inset"].c_str(), 1, &inset)) return false; } - + _theme->getEvaluator()->addDialog(var, node->values["overlays"], enabled, inset); - + if (node->values.contains("shading")) { int shading = 0; if (node->values["shading"] == "dim") @@ -571,15 +571,15 @@ bool ThemeParser::parserCallback_dialog(ParserNode *node) { else if (node->values["shading"] == "luminance") shading = 2; else return parserError("Invalid value for Dialog background shading."); - + _theme->getEvaluator()->setVar(var + ".Shading", shading); } - + return true; } bool ThemeParser::parserCallback_import(ParserNode *node) { - + if (!_theme->getEvaluator()->addImportedLayout(node->values["layout"])) return parserError("Error importing external layout"); return true; @@ -587,12 +587,12 @@ bool ThemeParser::parserCallback_import(ParserNode *node) { bool ThemeParser::parserCallback_layout(ParserNode *node) { int spacing = -1; - + if (node->values.contains("spacing")) { if (!parseIntegerKey(node->values["spacing"].c_str(), 1, &spacing)) return false; } - + if (node->values["type"] == "vertical") _theme->getEvaluator()->addLayout(GUI::ThemeLayout::kLayoutVertical, spacing, node->values["center"] == "true"); else if (node->values["type"] == "horizontal") @@ -603,27 +603,27 @@ bool ThemeParser::parserCallback_layout(ParserNode *node) { if (node->values.contains("padding")) { int paddingL, paddingR, paddingT, paddingB; - + if (!parseIntegerKey(node->values["padding"].c_str(), 4, &paddingL, &paddingR, &paddingT, &paddingB)) return false; - + _theme->getEvaluator()->addPadding(paddingL, paddingR, paddingT, paddingB); } - + return true; } bool ThemeParser::parserCallback_space(ParserNode *node) { int size = -1; - + if (node->values.contains("size")) { if (_theme->getEvaluator()->hasVar(node->values["size"])) size = _theme->getEvaluator()->getVar(node->values["size"]); - + else if (!parseIntegerKey(node->values["size"].c_str(), 1, &size)) return parserError("Invalid value for Spacing size."); } - + _theme->getEvaluator()->addSpace(size); return true; } @@ -633,151 +633,151 @@ bool ThemeParser::closedKeyCallback(ParserNode *node) { _theme->getEvaluator()->closeLayout(); else if (node->name == "dialog") _theme->getEvaluator()->closeDialog(); - + return true; } bool ThemeParser::parseCommonLayoutProps(ParserNode *node, const Common::String &var) { if (node->values.contains("size")) { int width, height; - + if (!parseIntegerKey(node->values["size"].c_str(), 2, &width, &height)) { Common::StringTokenizer tokenizer(node->values["size"], " ,"); Common::String wtoken, htoken; char *parseEnd; - + wtoken = tokenizer.nextToken(); - + if (_theme->getEvaluator()->hasVar(wtoken)) { width = _theme->getEvaluator()->getVar(wtoken); } else { width = strtol(wtoken.c_str(), &parseEnd, 10); - + if (*parseEnd != 0 && !(*parseEnd == '%' && *(parseEnd + 1) == 0)) return false; - + if (wtoken.lastChar() == '%') width = g_system->getOverlayWidth() * width / 100; } - + htoken = tokenizer.nextToken(); - + if (_theme->getEvaluator()->hasVar(htoken)) { height = _theme->getEvaluator()->getVar(htoken); } else { height = strtol(htoken.c_str(), &parseEnd, 10); - + if (*parseEnd != 0 && !(*parseEnd == '%' && *(parseEnd + 1) == 0)) return false; - + if (htoken.lastChar() == '%') height = g_system->getOverlayHeight() * height / 100; } - + if (!tokenizer.empty()) return false; } - - + + _theme->getEvaluator()->setVar(var + "Width", width); _theme->getEvaluator()->setVar(var + "Height", height); } - + if (node->values.contains("pos")) { int x, y; - + if (!parseIntegerKey(node->values["pos"].c_str(), 2, &x, &y)) { Common::StringTokenizer tokenizer(node->values["pos"], " ,"); Common::String xpos, ypos; char *parseEnd; - + xpos = tokenizer.nextToken(); - + if (xpos == "center") { if (!_theme->getEvaluator()->hasVar(var + "Width")) return false; - + x = (g_system->getOverlayWidth() / 2) - (_theme->getEvaluator()->getVar(var + "Width") / 2); - + } else if (_theme->getEvaluator()->hasVar(xpos)) { x = _theme->getEvaluator()->getVar(xpos); } else { x = strtol(xpos.c_str(), &parseEnd, 10); - + if (*parseEnd != 0 && !(*parseEnd == 'r' && *(parseEnd + 1) == 0)) return false; - + if (xpos.lastChar() == 'r') x = g_system->getOverlayWidth() - x; - } - + } + ypos = tokenizer.nextToken(); - + if (ypos == "center") { if (!_theme->getEvaluator()->hasVar(var + "Height")) return false; - + y = (g_system->getOverlayHeight() / 2) - (_theme->getEvaluator()->getVar(var + "Height") / 2); - + } else if (_theme->getEvaluator()->hasVar(ypos)) { y = _theme->getEvaluator()->getVar(ypos); } else { y = strtol(ypos.c_str(), &parseEnd, 10); - + if (*parseEnd != 0 && !(*parseEnd == 'b' && *(parseEnd + 1) == 0)) return false; - + if (ypos.lastChar() == 'b') y = g_system->getOverlayHeight() - y; } - + if (!tokenizer.empty()) return false; } - + _theme->getEvaluator()->setVar(var + "X", x); _theme->getEvaluator()->setVar(var + "Y", y); } - + if (node->values.contains("padding")) { int paddingL, paddingR, paddingT, paddingB; - + if (!parseIntegerKey(node->values["padding"].c_str(), 4, &paddingL, &paddingR, &paddingT, &paddingB)) return false; - + _theme->getEvaluator()->setVar(var + "Padding.Left", paddingL); _theme->getEvaluator()->setVar(var + "Padding.Right", paddingR); _theme->getEvaluator()->setVar(var + "Padding.Top", paddingT); _theme->getEvaluator()->setVar(var + "Padding.Bottom", paddingB); } - + return true; } bool ThemeParser::resolutionCheck(const Common::String &resolution) { if (resolution.empty()) return true; - + Common::StringTokenizer globTokenizer(resolution, ", "); Common::String cur, w, h; bool definedRes = false; - + while (!globTokenizer.empty()) { bool ignore = false; cur = globTokenizer.nextToken(); - + if (cur[0] == '-') { ignore = true; cur.deleteChar(0); } else { definedRes = true; } - + Common::StringTokenizer resTokenizer(cur, "x"); w = resTokenizer.nextToken(); h = resTokenizer.nextToken(); - if ((w == "X" || atoi(w.c_str()) == g_system->getOverlayWidth()) && + if ((w == "X" || atoi(w.c_str()) == g_system->getOverlayWidth()) && (h == "Y" || atoi(h.c_str()) == g_system->getOverlayHeight())) return !ignore; } diff --git a/gui/ThemeParser.h b/gui/ThemeParser.h index 58812a7907..520b319a06 100644 --- a/gui/ThemeParser.h +++ b/gui/ThemeParser.h @@ -32,30 +32,30 @@ namespace GUI { -class ThemeEngine; +class ThemeEngine; class ThemeParser : public Common::XMLParser { typedef void (Graphics::VectorRenderer::*DrawingFunctionCallback)(const Common::Rect &, const Graphics::DrawStep &); public: ThemeParser(ThemeEngine *parent); - + virtual ~ThemeParser(); - + bool getPaletteColor(const Common::String &name, int &r, int &g, int &b) { if (!_palette.contains(name)) return false; - + r = _palette[name].r; g = _palette[name].g; b = _palette[name].b; - + return true; } protected: ThemeEngine *_theme; - + CUSTOM_XML_PARSER(ThemeParser) { XML_KEY(render_info) XML_PROP(resolution, false) @@ -74,14 +74,14 @@ protected: XML_PROP(resolution, false) KEY_END() KEY_END() - + XML_KEY(bitmaps) XML_KEY(bitmap) XML_PROP(filename, true) XML_PROP(resolution, false) KEY_END() KEY_END() - + XML_KEY(cursor) XML_PROP(file, true) XML_PROP(hotspot, true) @@ -162,7 +162,7 @@ protected: XML_PROP(value, true) XML_PROP(resolution, false) KEY_END() - + XML_KEY(widget) XML_PROP(name, true) XML_PROP(size, false) @@ -171,7 +171,7 @@ protected: XML_PROP(resolution, false) KEY_END() KEY_END() - + XML_KEY(dialog) XML_PROP(name, true) XML_PROP(overlays, true) @@ -184,11 +184,11 @@ protected: XML_PROP(center, false) XML_PROP(padding, false) XML_PROP(spacing, false) - + XML_KEY(import) XML_PROP(layout, true) KEY_END() - + XML_KEY(widget) XML_PROP(name, true) XML_PROP(width, false) @@ -196,18 +196,18 @@ protected: XML_PROP(type, false) XML_PROP(enabled, false) KEY_END() - + XML_KEY(space) XML_PROP(size, false) KEY_END() - + XML_KEY_RECURSIVE(layout) KEY_END() KEY_END() - KEY_END() - + KEY_END() + } PARSER_END(); - + /** Render info callbacks */ bool parserCallback_render_info(ParserNode *node); bool parserCallback_defaults(ParserNode *node); @@ -221,8 +221,8 @@ protected: bool parserCallback_bitmaps(ParserNode *node) { return true; } bool parserCallback_bitmap(ParserNode *node); bool parserCallback_cursor(ParserNode *node); - - + + /** Layout info callbacks */ bool parserCallback_layout_info(ParserNode *node); bool parserCallback_globals(ParserNode *node) { return true; } @@ -232,11 +232,11 @@ protected: bool parserCallback_layout(ParserNode *node); bool parserCallback_space(ParserNode *node); bool parserCallback_import(ParserNode *node); - + bool closedKeyCallback(ParserNode *node); - + bool resolutionCheck(const Common::String &resolution); - + void cleanup(); Graphics::DrawStep *newDrawStep(); diff --git a/gui/console.cpp b/gui/console.cpp index 92e5132c22..5ad4051e16 100644 --- a/gui/console.cpp +++ b/gui/console.cpp @@ -109,7 +109,7 @@ void ConsoleDialog::init() { // Calculate the real width/height (rounded to char/line multiples) _w = (uint16)(_widthPercent * screenW); _h = (uint16)((_heightPercent * screenH - 2) / kConsoleLineHeight); - + _w = _w - _w / 20; _h = _h * kConsoleLineHeight + 2; @@ -142,7 +142,7 @@ void ConsoleDialog::open() { // Calculate the real width/height (rounded to char/line multiples) uint16 w = (uint16)(_widthPercent * screenW); uint16 h = (uint16)((_heightPercent * screenH - 2) / kConsoleLineHeight); - + h = h * kConsoleLineHeight + 2; w = w - w / 20; @@ -202,7 +202,7 @@ void ConsoleDialog::drawLine(int line, bool restoreBg) { g_gui.theme()->drawChar(Common::Rect(x, y, x+kConsoleCharWidth, y+kConsoleLineHeight), c, _font); x += kConsoleCharWidth; } - + g_gui.theme()->updateScreen(); } diff --git a/gui/dialog.cpp b/gui/dialog.cpp index ce3e5d609c..dc2e270f44 100644 --- a/gui/dialog.cpp +++ b/gui/dialog.cpp @@ -44,7 +44,7 @@ namespace GUI { Dialog::Dialog(int x, int y, int w, int h) : GuiObject(x, y, w, h), - _mouseWidget(0), _focusedWidget(0), _dragWidget(0), _visible(false), + _mouseWidget(0), _focusedWidget(0), _dragWidget(0), _visible(false), _backgroundType(GUI::ThemeEngine::kDialogBackgroundDefault) {} Dialog::Dialog(const Common::String &name) @@ -144,7 +144,7 @@ void Dialog::drawDialog() { // Draw all children Widget *w = _firstWidget; while (w) { - //if (w->_debugVisible) + //if (w->_debugVisible) w->draw(); w = w->_next; } diff --git a/gui/dialog.h b/gui/dialog.h index 0aa52c4972..726ba85cd0 100644 --- a/gui/dialog.h +++ b/gui/dialog.h @@ -48,7 +48,7 @@ protected: Widget *_focusedWidget; Widget *_dragWidget; bool _visible; - + ThemeEngine::DialogBackground _backgroundType; private: diff --git a/gui/launcher.cpp b/gui/launcher.cpp index a484638338..d28e322d15 100644 --- a/gui/launcher.cpp +++ b/gui/launcher.cpp @@ -256,7 +256,7 @@ EditGameDialog::EditGameDialog(const String &domain, const String &desc) if (savePath.empty() || !ConfMan.hasKey("savepath", _domain)) { _savePathWidget->setLabel("Default"); } - + // Activate the first tab tab->setActiveTab(0); _tabWidget = tab; @@ -815,7 +815,7 @@ void LauncherDialog::loadGame(int item) { target.toLowercase(); if (plugin) { - if ((*plugin)->hasFeature(MetaEngine::kSupportsListSaves) && + if ((*plugin)->hasFeature(MetaEngine::kSupportsListSaves) && (*plugin)->hasFeature(MetaEngine::kSupportsLoadingDuringStartup)) { int slot = _loadDialog->runModal(plugin, target); if (slot >= 0) { diff --git a/gui/launcher.h b/gui/launcher.h index 9d75c9a435..b9a76c80ca 100644 --- a/gui/launcher.h +++ b/gui/launcher.h @@ -74,7 +74,7 @@ protected: void removeGame(int item); void editGame(int item); void loadGame(int item); - + void selectGame(const String &name); }; diff --git a/gui/massadd.cpp b/gui/massadd.cpp index db94d4308b..ae37db46f9 100644 --- a/gui/massadd.cpp +++ b/gui/massadd.cpp @@ -76,7 +76,7 @@ MassAddDialog::MassAddDialog(const Common::FSNode &startDir) _gameProgressText = new StaticTextWidget(this, "MassAdd.GameProgressText", "... progress ..."); - + _dirProgressText->setAlign(Graphics::kTextAlignCenter); _gameProgressText->setAlign(Graphics::kTextAlignCenter); @@ -186,7 +186,7 @@ void MassAddDialog::handleTickle() { assert(dom); if ((*dom)["gameid"] == result["gameid"] && - (*dom)["platform"] == result["platform"] && + (*dom)["platform"] == result["platform"] && (*dom)["language"] == result["language"]) { duplicate = true; break; diff --git a/gui/newgui.cpp b/gui/newgui.cpp index aa778b834c..900ac21d36 100644 --- a/gui/newgui.cpp +++ b/gui/newgui.cpp @@ -72,7 +72,7 @@ NewGui::NewGui() : _redrawStatus(kRedrawDisabled), Common::String themefile(ConfMan.get("gui_theme")); if (themefile.compareToIgnoreCase("default") == 0) themefile = "builtin"; - + ConfMan.registerDefault("gui_renderer", ThemeEngine::findModeConfigName(ThemeEngine::_defaultRendererMode)); ThemeEngine::GraphicsMode gfxMode = (ThemeEngine::GraphicsMode)ThemeEngine::findMode(ConfMan.get("gui_renderer")); @@ -87,9 +87,9 @@ NewGui::~NewGui() { bool NewGui::loadNewTheme(Common::String filename, ThemeEngine::GraphicsMode gfx) { if (_theme && filename == _theme->getThemeFileName() && gfx == _theme->getGraphicsMode()) return true; - + Common::String oldTheme = (_theme != 0) ? _theme->getThemeFileName() : ""; - + if (gfx == ThemeEngine::kGfxDisabled) gfx = ThemeEngine::_defaultRendererMode; @@ -122,7 +122,7 @@ void NewGui::redraw() { if (_redrawStatus == kRedrawDisabled) return; - + if (_dialogStack.empty()) return; @@ -134,7 +134,7 @@ void NewGui::redraw() { _theme->openDialog(true); for (i = 0; i < _dialogStack.size() - 1; i++) { - _dialogStack[i]->drawDialog(); + _dialogStack[i]->drawDialog(); } _theme->finishBuffering(); @@ -195,13 +195,13 @@ void NewGui::runLoop() { animateCursor(); // _theme->updateScreen(); // _system->updateScreen(); - + if (lastRedraw + waitTime < _system->getMillis()) { _theme->updateScreen(); _system->updateScreen(); lastRedraw = _system->getMillis(); } - + Common::Event event; while (eventMan->pollEvent(event)) { @@ -224,7 +224,7 @@ void NewGui::runLoop() { _redrawStatus = kRedrawFull; redraw(); } - + if (lastRedraw + waitTime < _system->getMillis()) { _theme->updateScreen(); _system->updateScreen(); @@ -314,10 +314,10 @@ void NewGui::restoreState() { _stateIsSaved = false; } -void NewGui::openDialog(Dialog *dialog) { +void NewGui::openDialog(Dialog *dialog) { _dialogStack.push(dialog); _redrawStatus = kRedrawOpenDialog; - + // We reflow the dialog just before opening it. If the screen changed // since the last time we looked, also refresh the loaded theme, // and reflow all other open dialogs, too. diff --git a/gui/newgui.h b/gui/newgui.h index 29eb58638e..cec22d2335 100644 --- a/gui/newgui.h +++ b/gui/newgui.h @@ -74,7 +74,7 @@ public: bool loadNewTheme(Common::String file, ThemeEngine::GraphicsMode gfx = ThemeEngine::kGfxDisabled); ThemeEngine *theme() { return _theme; } - + ThemeEval *xmlEval() { return _theme->getEvaluator(); } const Graphics::Font &getFont(ThemeEngine::FontStyle style = ThemeEngine::kFontStyleBold) const { return *(_theme->getFont(style)); } diff --git a/gui/options.cpp b/gui/options.cpp index 8ac1720e25..9a53a425ec 100644 --- a/gui/options.cpp +++ b/gui/options.cpp @@ -648,7 +648,7 @@ void OptionsDialog::reflowLayout() { Dialog::reflowLayout(); int labelWidth = g_gui.xmlEval()->getVar("Globals.TabLabelWidth"); - + if (_graphicsTabId != -1 && _tabWidget) _tabWidget->setTabTitle(_graphicsTabId, g_system->getOverlayWidth() > 320 ? "Graphics" : "GFX"); @@ -724,15 +724,15 @@ GlobalOptionsDialog::GlobalOptionsDialog() new ButtonWidget(tab, "GlobalOptions_Misc.ThemeButton", "Theme:", kChooseThemeCmd, 0); _curTheme = new StaticTextWidget(tab, "GlobalOptions_Misc.CurTheme", g_gui.theme()->getThemeName()); - + int labelWidth = g_gui.xmlEval()->getVar("Globals.TabLabelWidth"); - + _rendererPopUp = new PopUpWidget(tab, "GlobalOptions_Misc.Renderer", "GUI Renderer:", labelWidth); - + for (uint i = 1; i < GUI::ThemeEngine::_rendererModesSize; ++i) _rendererPopUp->appendEntry(GUI::ThemeEngine::_rendererModes[i].name, GUI::ThemeEngine::_rendererModes[i].mode); - + _autosavePeriodPopUp = new PopUpWidget(tab, "GlobalOptions_Misc.AutosavePeriod", "Autosave:", labelWidth); for (int i = 0; savePeriodLabels[i]; i++) { @@ -809,7 +809,7 @@ void GlobalOptionsDialog::open() { if (value == savePeriodValues[i]) _autosavePeriodPopUp->setSelected(i); } - + ThemeEngine::GraphicsMode mode = ThemeEngine::findMode(ConfMan.get("gui_renderer")); if (mode == ThemeEngine::kGfxDisabled) mode = ThemeEngine::_defaultRendererMode; @@ -843,7 +843,7 @@ void GlobalOptionsDialog::close() { #endif ConfMan.setInt("autosave_period", _autosavePeriodPopUp->getSelectedTag(), _domain); - + GUI::ThemeEngine::GraphicsMode selected = (GUI::ThemeEngine::GraphicsMode)_rendererPopUp->getSelectedTag(); const char *cfg = GUI::ThemeEngine::findModeConfigName(selected); if (!ConfMan.get("gui_renderer").equalsIgnoreCase(cfg)) { diff --git a/gui/options.h b/gui/options.h index 187e163b79..63caf68c32 100644 --- a/gui/options.h +++ b/gui/options.h @@ -81,7 +81,7 @@ protected: void setMIDISettingsState(bool enabled); void setVolumeSettingsState(bool enabled); void setSubtitleSettingsState(bool enabled); - + TabWidget *_tabWidget; int _graphicsTabId; diff --git a/gui/saveload.cpp b/gui/saveload.cpp index bce0df3583..dd75e5f7b1 100644 --- a/gui/saveload.cpp +++ b/gui/saveload.cpp @@ -53,7 +53,7 @@ SaveLoadChooser::SaveLoadChooser(const String &title, const String &buttonLabel) _list = new GUI::ListWidget(this, "ScummSaveLoad.List"); _list->setNumberingMode(GUI::kListNumberingZero); setSaveMode(false); - + _gfxWidget = new GUI::GraphicsWidget(this, 0, 0, 10, 10); _date = new StaticTextWidget(this, 0, 0, 10, 10, "No date saved", Graphics::kTextAlignCenter); @@ -143,7 +143,7 @@ void SaveLoadChooser::handleCommand(CommandSender *sender, uint32 cmd, uint32 da break; case kDelCmd: if (selItem >= 0 && _delSupport) { - MessageDialog alert("Do you really want to delete this savegame?", + MessageDialog alert("Do you really want to delete this savegame?", "Delete", "Cancel"); if (alert.runModal() == GUI::kMessageOK) { (*_plugin)->removeSaveState(_target.c_str(), atoi(_saveList[selItem].save_slot().c_str())); @@ -167,11 +167,11 @@ void SaveLoadChooser::reflowLayout() { if (g_gui.xmlEval()->getVar("Globals.ScummSaveLoad.ExtInfo.Visible") == 1 && _thumbnailSupport) { int16 x, y; uint16 w, h; - + if (!g_gui.xmlEval()->getWidgetData("ScummSaveLoad.Thumbnail", x, y, w, h)) error("Error when loading position data for Save/Load Thumbnails."); - - int thumbW = kThumbnailWidth; + + int thumbW = kThumbnailWidth; int thumbH = ((g_system->getHeight() % 200 && g_system->getHeight() != 350) ? kThumbnailHeight2 : kThumbnailHeight1); int thumbX = x + (w >> 1) - (thumbW >> 1); int thumbY = y + kLineHeight; @@ -183,7 +183,7 @@ void SaveLoadChooser::reflowLayout() { textLines++; _container->resize(x, y, w, h - (kLineHeight * textLines)); - _gfxWidget->resize(thumbX, thumbY, thumbW, thumbH); + _gfxWidget->resize(thumbX, thumbY, thumbW, thumbH); int height = thumbY + thumbH + kLineHeight; diff --git a/gui/themebrowser.cpp b/gui/themebrowser.cpp index c7b255cc1e..a1091ee70d 100644 --- a/gui/themebrowser.cpp +++ b/gui/themebrowser.cpp @@ -150,11 +150,11 @@ void ThemeBrowser::addDir(ThList &list, const Common::FSNode &node) { fslist.push_back(node); // Yup, also scan the dir itself for (Common::FSList::const_iterator i = fslist.begin(); i != fslist.end(); ++i) { - + Entry th; if (isTheme(*i, th)) { bool add = true; - + for (ThList::const_iterator p = list.begin(); p != list.end(); ++p) { if (p->name == th.name || p->file == th.file) { add = false; @@ -163,14 +163,14 @@ void ThemeBrowser::addDir(ThList &list, const Common::FSNode &node) { } if (add) - list.push_back(th); + list.push_back(th); } } } bool ThemeBrowser::isTheme(const Common::FSNode &node, Entry &out) { - out.file = node.getPath(); - + out.file = node.getPath(); + #ifdef USE_ZLIB if (!out.file.hasSuffix(".zip") && !node.isDirectory()) return false; @@ -178,7 +178,7 @@ bool ThemeBrowser::isTheme(const Common::FSNode &node, Entry &out) { if (!node.isDirectory()) return false; #endif - + if (!ThemeEngine::themeConfigUseable(node, out.name)) return false; diff --git a/sound/adpcm.cpp b/sound/adpcm.cpp index d3ec7df9a0..1140089910 100644 --- a/sound/adpcm.cpp +++ b/sound/adpcm.cpp @@ -370,7 +370,7 @@ int ADPCMInputStream::readBufferTinsel6(int channels, int16 *buffer, const int n _blockPos++; break; } - + } } diff --git a/sound/mididrv.cpp b/sound/mididrv.cpp index 473612f6bc..8e85b5a5f8 100644 --- a/sound/mididrv.cpp +++ b/sound/mididrv.cpp @@ -47,7 +47,7 @@ static const MidiDriverDescription s_musicDrivers[] = { #endif #if defined(__MINT__) - {"stmidi", "Atari ST MIDI", MD_STMIDI, MDT_MIDI}, + {"stmidi", "Atari ST MIDI", MD_STMIDI, MDT_MIDI}, #endif #if defined(UNIX) && !defined(__BEOS__) && !defined(MACOSX) && !defined(__MAEMO__) && !defined(__MINT__) @@ -252,7 +252,7 @@ MidiDriver *MidiDriver::createMidi(int midiDriver) { case MD_WINDOWS: return MidiDriver_WIN_create(g_system->getMixer()); #endif #if defined(__MINT__) - case MD_STMIDI: return MidiDriver_STMIDI_create(g_system->getMixer()); + case MD_STMIDI: return MidiDriver_STMIDI_create(g_system->getMixer()); #endif #if defined(UNIX) && !defined(__BEOS__) && !defined(MACOSX) && !defined(__MAEMO__) && !defined(__MINT__) case MD_SEQ: return MidiDriver_SEQ_create(g_system->getMixer()); diff --git a/sound/mixer.cpp b/sound/mixer.cpp index 4826d2b044..5cf6e6d512 100644 --- a/sound/mixer.cpp +++ b/sound/mixer.cpp @@ -214,7 +214,7 @@ void MixerImpl::mixCallback(byte *samples, uint len) { assert(samples); Common::StackLock lock(_mutex); - + int16 *buf = (int16 *)samples; len >>= 2; diff --git a/sound/mixer_intern.h b/sound/mixer_intern.h index 46ba97e66c..d74fc70a1c 100644 --- a/sound/mixer_intern.h +++ b/sound/mixer_intern.h @@ -135,7 +135,7 @@ public: * setOutputRate() has been called). */ void setReady(bool ready); - + /** * Set the output sample rate. * diff --git a/sound/mp3.cpp b/sound/mp3.cpp index 0249032e2f..ba21436de4 100644 --- a/sound/mp3.cpp +++ b/sound/mp3.cpp @@ -117,7 +117,7 @@ MP3InputStream::MP3InputStream(Common::SeekableReadStream *inStream, bool dispos // Calculate play time mad_timer_t length; - mad_timer_set(&length, 0, 0, 1000); + mad_timer_set(&length, 0, 0, 1000); mad_timer_add(&length, start); mad_timer_negate(&length); @@ -175,7 +175,7 @@ MP3InputStream::MP3InputStream(Common::SeekableReadStream *inStream, bool dispos } _totalPlayTime = mad_timer_count(length, MAD_UNITS_MILLISECONDS); - + if (numLoops && mad_timer_sign(length) >= 0) _totalPlayTime *= numLoops; else |