2017-02-25 21:40:29 +01:00
|
|
|
/* ScummVM - Graphic Adventure Engine
|
|
|
|
*
|
|
|
|
* ScummVM is the legal property of its developers, whose names
|
|
|
|
* are too numerous to list here. Please refer to the COPYRIGHT
|
|
|
|
* file distributed with this source distribution.
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef DIRECTOR_UTIL_H
|
|
|
|
#define DIRECTOR_UTIL_H
|
|
|
|
|
|
|
|
namespace Common {
|
|
|
|
class String;
|
|
|
|
}
|
|
|
|
|
|
|
|
namespace Director {
|
|
|
|
|
|
|
|
int castNumToNum(const char *str);
|
|
|
|
char *numToCastNum(int num);
|
|
|
|
|
2020-05-10 10:54:37 +08:00
|
|
|
Common::String toLowercaseMac(const Common::String &s);
|
2017-02-25 21:40:29 +01:00
|
|
|
|
2017-03-29 08:35:33 +02:00
|
|
|
Common::String convertPath(Common::String &path);
|
|
|
|
|
2020-08-05 14:13:17 -04:00
|
|
|
Common::String unixToMacPath(const Common::String &path);
|
|
|
|
|
2020-01-01 15:15:27 +01:00
|
|
|
Common::String getPath(Common::String path, Common::String cwd);
|
2020-01-01 14:50:53 +01:00
|
|
|
|
2020-08-05 11:14:29 -04:00
|
|
|
bool testPath(Common::String &path, bool directory = false);
|
2020-07-30 21:50:43 +02:00
|
|
|
|
2020-08-05 11:14:29 -04:00
|
|
|
Common::String pathMakeRelative(Common::String path, bool recursive = true, bool addexts = true, bool directory = false);
|
2020-02-20 22:56:04 +01:00
|
|
|
|
2020-08-05 00:43:39 -04:00
|
|
|
Common::String testExtensions(Common::String component, Common::String initialPath, Common::String convPath);
|
2020-08-04 23:52:28 -04:00
|
|
|
|
2020-07-20 15:15:44 -04:00
|
|
|
Common::String getFileName(Common::String path);
|
|
|
|
|
2020-05-16 14:50:03 +08:00
|
|
|
Common::String stripMacPath(const char *name);
|
|
|
|
|
2020-02-25 00:54:57 +01:00
|
|
|
Common::String convertMacFilename(const char *name);
|
|
|
|
|
2020-05-24 17:16:23 +02:00
|
|
|
Common::String dumpScriptName(const char *prefix, int type, int id, const char *ext);
|
|
|
|
|
2020-03-27 00:09:44 +01:00
|
|
|
bool processQuitEvent(bool click = false); // events.cpp
|
2017-03-09 09:14:24 +01:00
|
|
|
|
2020-07-11 23:21:16 +02:00
|
|
|
class RandomState {
|
|
|
|
public:
|
2021-04-15 21:20:04 +02:00
|
|
|
uint32 _seed;
|
|
|
|
uint32 _mask;
|
|
|
|
uint32 _len;
|
2020-07-11 23:21:16 +02:00
|
|
|
|
2021-04-15 21:20:04 +02:00
|
|
|
RandomState() {
|
|
|
|
_seed = _mask = _len = 0;
|
|
|
|
}
|
2020-07-11 23:21:16 +02:00
|
|
|
|
2021-04-15 21:20:04 +02:00
|
|
|
void setSeed(int seed);
|
|
|
|
uint32 getSeed() { return _seed; }
|
|
|
|
int32 getRandom(int32 range);
|
2020-07-11 23:21:16 +02:00
|
|
|
|
|
|
|
private:
|
2021-04-15 21:20:04 +02:00
|
|
|
void init(int len);
|
|
|
|
int32 genNextRandom();
|
|
|
|
int32 perlin(int32 val);
|
2020-07-11 23:21:16 +02:00
|
|
|
};
|
|
|
|
|
2020-08-11 21:03:38 -04:00
|
|
|
uint32 readVarInt(Common::SeekableReadStream &stream);
|
|
|
|
|
2020-08-12 10:35:40 -04:00
|
|
|
Common::SeekableReadStreamEndian *readZlibData(Common::SeekableReadStream &stream, unsigned long len, unsigned long *outLen, bool bigEndian);
|
2020-08-11 21:06:05 -04:00
|
|
|
|
2021-06-07 13:02:07 -04:00
|
|
|
uint16 humanVersion(uint16 ver);
|
|
|
|
|
2017-02-25 21:40:29 +01:00
|
|
|
} // End of namespace Director
|
|
|
|
|
|
|
|
#endif
|