12 true,
true,
true,
true,
true,
true,
13 false,
true,
true,
false,
true,
false,
14 true,
false,
false,
false,
true,
true,
15 true,
true,
true,
false,
false
46 if (f.
open(file) != 0)
52 for (
int i = 0; i < 256; i++)
56 uint16_t gameflowSize = f.
readU16();
125 uint16_t* offset =
new uint16_t[n];
126 for (
unsigned int i = 0; i < n; i++)
129 uint16_t numBytes = f.
readU16();
131 char* list =
new char[numBytes];
132 for (uint16_t i = 0; i < numBytes; i++) {
139 for (
unsigned int i = 0; i < n; i++) {
140 std::string tmp(list + offset[i]);
150 uint16_t* offset =
new uint16_t[n];
151 for (
unsigned int i = 0; i < n; i++) {
156 uint16_t numBytes = f.
readU16();
159 uint16_t* list =
new uint16_t[(numBytes + 6) / 2];
160 for (uint16_t i = 0; i < (numBytes / 2); i++) {
171 if (((hack[0] == 19) && (hack[1] == 20) && (hack[2] == 21))
172 || ((hack[0] == 21) && (hack[1] == 22) && (hack[2] == 23))) {
173 list[numBytes / 2] = hack[0];
174 list[(numBytes / 2) + 1] = hack[1];
175 list[(numBytes / 2) + 2] = hack[2];
186 if ((hack[0] == 1) && (hack[1] == 0) && (hack[2] == 864)) {
189 }
else if ((hack[0] == 1) && (hack[1] == 0) && (hack[2] == 817)) {
197 for (
unsigned int i = 0; i < n; i++) {
198 unsigned int end = offset[i] / 2;
204 bool readingOperand =
false;
205 while (readingOperand || (list[end] !=
OP_END)) {
206 if (readingOperand) {
207 readingOperand =
false;
211 readingOperand =
true;
218 std::vector<uint16_t> tmp;
219 for (
unsigned int a = (offset[i] / 2); a < end; a++)
220 tmp.push_back(list[a]);
312 return keys.at(i).at(j);
322 std::vector<uint16_t> s =
script.at(level);
324 for (
unsigned int i = 0; i < s.size(); i++) {
325 uint16_t opcode = s.at(i);
330 uint16_t operand = 0;
332 if ((i + 1) >= s.size())
352 return "English (UK)";
358 return "English (US)";
int runScript(unsigned int level)
unsigned int titleCount()
std::vector< std::string > gameStrings
std::string getTitleFilename(unsigned int i)
Strings XORed with cypherCode.
std::string getLevelFilename(unsigned int i)
std::string getLevelName(unsigned int i)
std::vector< std::vector< std::string > > keys
static const bool opcodeHasOperand[OP_UNKNOWN]
virtual void seek(long long pos=0)
std::vector< std::string > pcStrings
std::function< int(bool, uint16_t)> scriptHandlers[OP_UNKNOWN]
static void error(char *msg)
unsigned int gameStringCount()
unsigned int pictureCount()
Tomb Raider 2/3 Script Loader.
std::vector< std::string > titleFilenames
std::vector< std::string > pictureFilenames
void readScriptPackage(BinaryFile &f, std::vector< std::vector< uint16_t >> &v, unsigned int n)
virtual uint16_t readU16()
std::string getPickupString(unsigned int i, unsigned int j)
std::vector< std::string > cutsceneFilenames
std::string getPuzzleString(unsigned int i, unsigned int j)
unsigned int videoCount()
std::string getLanguage()
std::vector< std::string > levelFilenames
std::vector< std::string > levelNames
std::vector< std::vector< uint16_t > > script
#define assertEqual(x, y)
virtual uint32_t readU32()
int load(std::string file)
std::string getKeyString(unsigned int i, unsigned int j)
std::vector< std::vector< std::string > > pickups
void readStringPackage(BinaryFile &f, std::vector< std::string > &v, unsigned int n)
std::string getGameString(unsigned int i)
unsigned int pcStringCount()
std::vector< std::string > fmvFilenames
unsigned int cutsceneCount()
std::string getPictureFilename(unsigned int i)
std::vector< std::vector< std::string > > puzzles
#define assertLessThan(x, y)
unsigned int levelCount()
std::string getCutsceneFilename(unsigned int i)
std::string getPCString(unsigned int i)
std::string getVideoFilename(unsigned int i)
void registerScriptHandler(ScriptOpCode op, std::function< int(bool, uint16_t)> func)
int open(std::string f="")