34 static const char *
kLetters28 =
"abcdefghijklmnopqrstuvwxyz'-";
35 static const char *
kLetters26 =
"abcdefghijklmnopqrstuvwxyz";
56 int firstLetterIndex = 0;
57 int secondLetterIndex = 0;
61 "Invalid maximal letters. A name has to be at least 4 letters, %i given",
62 static_cast<int>(maxLetters));
65 probability =
static_cast<float>(std::rand())/RAND_MAX;
75 probability =
static_cast<float>(std::rand())/RAND_MAX;
79 secondLetterIndex = i;
84 probability =
static_cast<float>(std::rand())/RAND_MAX;
86 if (
_tripleLetters[firstLetterIndex][secondLetterIndex].start[i] > probability) {
88 firstLetterIndex = secondLetterIndex;
89 secondLetterIndex = i;
95 const size_t length = (maxLetters > 4) ? (std::rand() % (maxLetters - 3)) : 0;
97 for (
size_t i = 0; i < length; ++i) {
98 probability =
static_cast<float>(std::rand())/RAND_MAX;
100 if (
_tripleLetters[firstLetterIndex][secondLetterIndex].mid[j] > probability) {
102 firstLetterIndex = secondLetterIndex;
103 secondLetterIndex = j;
110 probability =
static_cast<float>(std::rand())/RAND_MAX;
112 if (
_tripleLetters[firstLetterIndex][secondLetterIndex].end[j] > probability) {
#define ResMan
Shortcut for accessing the sound manager.
#define MKTAG(a0, a1, a2, a3)
A wrapper macro used around four character constants, like 'DATA', to ensure portability.
static const char * kLetters26
A class holding an UTF-8 string.
static const char * kLetters28
Common::ScopedArray< float > mid
Common::ScopedArray< float > end
void reset(PointerType o=0)
Resets the pointer with the new value.
static const uint32 kVersion10
Utility templates and functions for working with strings and streams.
static void readHeader(Common::ReadStream &stream, uint32 &id, uint32 &version, bool &utf16le)
Read the header out of a stream.
Letter combo probability information.
Common::ScopedArray< Common::ScopedArray< LetterSet > > _tripleLetters
Common::UString generateRandomName(size_t maxLetters) const
Generate a random name from the ltr file.
uint32 _id
The file's ID.
LTRFile(const Common::UString <r)
uint32 _version
The file's version.
FORCEINLINE float readIEEEFloatLE()
Read a 32-bit IEEE float stored in little endian (LSB first) order from the stream and return it...
PointerType get() const
Returns the plain pointer value.
Common::ScopedArray< float > start
UString debugTag(uint32 tag, bool trim)
Create an elaborate string from an integer tag, for debugging purposes.
Common::ScopedArray< char > _alphabet
size_t getLetterCount() const
Get the letter count utilized by the ltr file.
static const uint32 kVersion10
A scoped array pointer, allowing array-y access and array deletion.
void load(Common::SeekableReadStream &stream)
UString toUpper() const
Return an uppercased copy of the string.
static const uint32 kLTRID
Interface for a seekable & readable data stream.
Common::ScopedArray< LetterSet > _doubleLetters
byte readByte()
Read an unsigned byte from the stream and return it.
File for creating random names in the character generation.
The global resource manager for Aurora resources.