GROOVIE: code review feedback

fixes for MusicPlayerTlc

optimizations and cleanup in roq.cpp

lots of cleanup in tlcgame.cpp
This commit is contained in:
Die4Ever 2021-09-10 23:51:22 -05:00 committed by Filippos Karapetis
parent f1890553ed
commit 1dd7a5f66a
12 changed files with 118 additions and 119 deletions

View File

@ -20,12 +20,12 @@
*
*/
#include "clangame.h"
#include "groovie/clangame.h"
namespace Groovie {
// This a list of files for background music. These list is hard-coded in the TLC player.
const Common::String kClanMusicFiles[] = {"mbf_arb1.mpg", "mbf_arm1.mpg", "mbf_bal1.mpg", "mbf_c2p2.mpg", "act18mus.mpg", "act15mus.mpg", "act21mus.mpg",
const char * kClanMusicFiles[] = {"mbf_arb1.mpg", "mbf_arm1.mpg", "mbf_bal1.mpg", "mbf_c2p2.mpg", "act18mus.mpg", "act15mus.mpg", "act21mus.mpg",
"act05mus.mpg", "act04mus.mpg", "act23mus.mpg", "act17mus.mpg", "act03mus.mpg", "act06mus.mpg", "act19mus.mpg",
"act07mus.mpg", "mbf_mne1.mpg", "act24mus.mpg", "act24mus.mpg", "act14mus.mpg", "act20mus.mpg", "act15mus.mpg",
"act13mus.mpg", "act08mus.mpg", "mbf_uph1.mpg", "mbf_uph1.mpg", "act19mus.mpg", "mbf_bol1.mpg", "mbf_cbk1.mpg",
@ -36,7 +36,7 @@ const Common::String kClanMusicFiles[] = {"mbf_arb1.mpg", "mbf_arm1.mpg", "mbf_b
"mbf_c3p2.mpg", "mbf_c3p1.mpg", "act25mus.mpg", "mbf_c4p2.mpg", "mbf_c4p1.mpg"};
// Gets the filename of the background music file.
Common::String ClanGame::getClanMusicFilename(int musicId) {
const char* ClanGame::getClanMusicFilename(int musicId) {
return kClanMusicFiles[musicId];
}

View File

@ -23,13 +23,11 @@
#ifndef GROOVIE_CLANGAME_H
#define GROOVIE_CLANGAME_H
#include "common/str.h"
namespace Groovie {
class ClanGame {
public:
static Common::String getClanMusicFilename(int musicId);
static const char* getClanMusicFilename(int musicId);
};
} // namespace Groovie

View File

@ -18,10 +18,10 @@ MODULE_OBJS := \
ifdef ENABLE_GROOVIE2
MODULE_OBJS += \
clangame.o \
roq.o \
tlcgame.o \
t11hgame.o \
clangame.o
tlcgame.o
endif
# This module can be built as a plugin

View File

@ -751,6 +751,7 @@ bool MusicPlayerIOS::load(uint32 fileref, bool loop) {
MusicPlayerTlc::MusicPlayerTlc(GroovieEngine *vm) : MusicPlayer(vm) {
_file = NULL;
vm->getTimerManager()->installTimerProc(&onTimer, 50 * 1000, this, "groovieMusic");
}
@ -767,6 +768,10 @@ void MusicPlayerTlc::unload() {
MusicPlayer::unload();
_vm->_system->getMixer()->stopHandle(_handle);
if (_file) {
delete _file;
}
_file = NULL;
}
Common::String MusicPlayerTlc::getFilename(uint32 fileref) {
@ -774,18 +779,18 @@ Common::String MusicPlayerTlc::getFilename(uint32 fileref) {
}
bool MusicPlayerTlc::load(uint32 fileref, bool loop) {
// Find correct filename
Common::String filename;
Common::File *fileHandle = new Common::File();
Audio::SeekableAudioStream *seekStream = NULL;
unload();
_file = new Common::File();
// Create the audio stream from fileref
filename = getFilename(fileref);
fileHandle->open(filename);
if (fileHandle->isOpen()) {
seekStream = Audio::makeMP3Stream(fileHandle, DisposeAfterUse::YES);
Common::String filename = getFilename(fileref);
_file->open(filename);
Audio::SeekableAudioStream *seekStream = NULL;
if (_file->isOpen()) {
seekStream = Audio::makeMP3Stream(_file, DisposeAfterUse::NO);
} else {
delete fileHandle;
delete _file;
_file = NULL;
}
if (!seekStream) {
@ -796,6 +801,9 @@ bool MusicPlayerTlc::load(uint32 fileref, bool loop) {
Audio::AudioStream *audStream = seekStream;
// TODO: Loop if requested
if (!loop)
warning("TODO: MusicPlayerTlc::load with loop == false");
if (loop || 1)
audStream = Audio::makeLoopingAudioStream(seekStream, 0);

View File

@ -25,6 +25,7 @@
#include "common/array.h"
#include "common/mutex.h"
#include "common/file.h"
#include "audio/mididrv.h"
#include "audio/mididrv_ms.h"
#include "audio/mixer.h"
@ -218,6 +219,7 @@ protected:
private:
Audio::SoundHandle _handle;
Common::File *_file;
};
class MusicPlayerClan : public MusicPlayerTlc {

View File

@ -114,7 +114,7 @@ void VideoPlayer::waitFrame() {
uint32 millisDiff = currTime - _lastFrameTime;
float fMillis = _millisBetweenFrames + _frameTimeDrift;
// use floorf instead of roundf, because delayMillis often slightly over-sleeps
uint32 millisSleep = fmaxf( 0.0f, floorf(fMillis) - float(millisDiff));
uint32 millisSleep = fmaxf(0.0f, floorf(fMillis) - float(millisDiff));
if (millisSleep > 0) {
debugC(7, kDebugVideo, "Groovie::Player: Delaying %d (currTime=%d, _lastFrameTime=%d, millisDiff=%d, _millisBetweenFrame=%.2f, _frameTimeDrift=%.2f)",

View File

@ -61,25 +61,19 @@ static const int kRIndex = 0;
namespace Groovie {
// Overwrites one pixel of destination regardless of the alpha value
static inline void copyPixelIfAlpha(byte *dst, byte *src) {
static inline void copyPixel(byte *dst, const byte *src) {
*(uint32 *)dst = *(const uint32 *)src;
}
// Overwrites one pixel of destination regardless of the alpha value
static inline void copyPixelIfAlpha(byte *dst, const byte *src) {
if (src[kAIndex] > 0) {
dst[kAIndex] = src[kAIndex];
dst[kRIndex] = src[kRIndex];
dst[kGIndex] = src[kGIndex];
dst[kBIndex] = src[kBIndex];
copyPixel(dst, src);
}
}
// Overwrites one pixel of destination regardless of the alpha value
static inline void copyPixel(byte *dst, byte *src) {
dst[kAIndex] = src[kAIndex];
dst[kRIndex] = src[kRIndex];
dst[kGIndex] = src[kGIndex];
dst[kBIndex] = src[kBIndex];
}
// Copies one pixel to destination but respects the alpha value of the source
static inline void copyPixelWithA(byte *dst, byte *src) {
static inline void copyPixelWithA(byte *dst, const byte *src) {
if (src[kAIndex] == 255) {
copyPixel(dst, src);
} else {
@ -223,11 +217,15 @@ void ROQPlayer::buildShowBuf() {
if (!_restoreArea->isEmpty()) {
int width = _restoreArea->right - _restoreArea->left;
Graphics::Surface *screen = _vm->_system->lockScreen();
assert(screen->format == _bg->format);
assert(screen->format.bytesPerPixel == 4);
for (int line = _restoreArea->top; line < _restoreArea->bottom; line++) {
byte *dst = (byte *)screen->getBasePtr(_restoreArea->left, line + screenOffset);
byte *src = (byte *)_bg->getBasePtr(_restoreArea->left, line);
byte *prv = (byte *)_prevBuf->getBasePtr((_restoreArea->left - _origX) / _scaleX, (line - _origY) / _scaleY);
byte *ovr = (byte *)_overBuf->getBasePtr(_restoreArea->left, line);
//memcpy(dst, src, width * _bg->format.bytesPerPixel);
for (int i = 0; i < width; i++) {
if (prv[kAIndex] != 0) {
copyPixel(dst, src);
@ -274,17 +272,14 @@ void ROQPlayer::buildShowBuf() {
byte *in = (byte *)_currBuf->getBasePtr(MAX(0, -_origX) / _scaleX, (line - _origY) / _scaleY);
byte *inOvr = (byte *)_overBuf->getBasePtr(startX, line);
byte *out = (byte *)destBuf->getBasePtr(startX, line + destOffset);
assert(destBuf->format == _currBuf->format);
assert(destBuf->format.bytesPerPixel == 4);
for (int x = startX; x < stopX; x++) {
if (destBuf == _overBuf) {
copyPixelIfAlpha(out, in);
} else {
if (_interlacedVideo && (line % 2) && 0) {
byte blackPixel[4] = { 0, 0, 0, 0 };
copyPixel(out, blackPixel);
} else {
copyPixelWithA(out, in);
}
copyPixelWithA(out, in);
}
if (_alpha && in[kAIndex] != 0 && destBuf != _overBuf) {

View File

@ -790,7 +790,7 @@ bool Script::playBackgroundSound(uint32 fileref, uint32 loops) {
if (_soundFile) {
_vm->_soundQueue.queue(_soundFile, loops);
} else {
error("Groovie::Script: Couldn't open file");
warning("Groovie::Script: Couldn't open file");
return false;
}
@ -1155,7 +1155,8 @@ void Script::o_strcmpnejmp_var() { // 0x21
void Script::o_copybgtofg() { // 0x22
debugC(1, kDebugScript, "Groovie::Script: COPY_BG_TO_FG");
debugC(2, kDebugVideo, "Groovie::Script: @0x%04X: COPY_BG_TO_FG", _currentInstruction - 1);
memcpy(_vm->_graphicsMan->_foreground.getPixels(), _vm->_graphicsMan->_background.getPixels(), 640 * _vm->_graphicsMan->_foreground.h * _vm->_graphicsMan->_foreground.format.bytesPerPixel);
size_t len = _vm->_graphicsMan->_foreground.pitch * _vm->_graphicsMan->_foreground.h;
memcpy(_vm->_graphicsMan->_foreground.getPixels(), _vm->_graphicsMan->_background.getPixels(), len);
}
void Script::o2_copybgtofg() { // 0x22
@ -1889,6 +1890,7 @@ void Script::o2_midicontrol() {
uint16 arg1 = readScript16bits();
uint16 arg2 = readScript16bits();
// TODO: see if we need to revisit the commented code here, maybe @Alphard-o can help
switch (arg1) {
case 0:
// Stop Playback

View File

@ -33,31 +33,6 @@
namespace Groovie {
/* Links between the pieces in the Gallery challenge */
byte kGalleryLinks[21][10] = {
{ 2, 4, 5, 0, 0, 0, 0, 0, 0, 0 }, // 1
{ 1, 5, 3, 0, 0, 0, 0, 0, 0, 0 }, // 2
{ 2, 5, 9, 12, 0, 0, 0, 0, 0, 0 }, // 3
{ 1, 5, 6, 7, 8, 0, 0, 0, 0, 0 }, // 4
{ 1, 2, 3, 4, 7, 8, 9, 0, 0, 0 }, // 5
{ 4, 7, 10, 11, 13, 14, 15, 16, 18, 0 }, // 6
{ 4, 5, 6, 8, 9, 10, 0, 0, 0, 0 }, // 7
{ 4, 5, 7, 0, 0, 0, 0, 0, 0, 0 }, // 8
{ 3, 5, 7, 10, 11, 12, 18, 0, 0, 0 }, // 9
{ 6, 7, 9, 11, 0, 0, 0, 0, 0, 0 }, // 10
{ 6, 9, 10, 18, 0, 0, 0, 0, 0, 0 }, // 11
{ 3, 9, 18, 21, 0, 0, 0, 0, 0, 0 }, // 12
{ 6, 14, 17, 19, 0, 0, 0, 0, 0, 0 }, // 13
{ 6, 13, 15, 17, 19, 20, 21, 0, 0, 0 }, // 14
{ 6, 14, 16, 18, 21, 0, 0, 0, 0, 0 }, // 15
{ 6, 15, 0, 0, 0, 0, 0, 0, 0, 0 }, // 16
{13, 14, 19, 0, 0, 0, 0, 0, 0, 0 }, // 17
{ 6, 9, 11, 12, 15, 21, 0, 0, 0, 0 }, // 18
{13, 14, 17, 20, 0, 0, 0, 0, 0, 0 }, // 19
{14, 19, 21, 0, 0, 0, 0, 0, 0, 0 }, // 20
{12, 14, 15, 18, 20, 0, 0, 0, 0, 0 } // 21
};
T11hGame::T11hGame() :
_random("GroovieT11hGame"), _scriptVariables(NULL) {
}
@ -151,6 +126,32 @@ void T11hGame::opPente() {
* | | 20/2D | 21/2E |
* +-----------+--------+-----------------------------------------+
*/
/* Links between the pieces in the Gallery challenge */
const byte T11hGame::kGalleryLinks[21][10] = {
{ 2, 4, 5, 0, 0, 0, 0, 0, 0, 0 }, // 1
{ 1, 5, 3, 0, 0, 0, 0, 0, 0, 0 }, // 2
{ 2, 5, 9, 12, 0, 0, 0, 0, 0, 0 }, // 3
{ 1, 5, 6, 7, 8, 0, 0, 0, 0, 0 }, // 4
{ 1, 2, 3, 4, 7, 8, 9, 0, 0, 0 }, // 5
{ 4, 7, 10, 11, 13, 14, 15, 16, 18, 0 }, // 6
{ 4, 5, 6, 8, 9, 10, 0, 0, 0, 0 }, // 7
{ 4, 5, 7, 0, 0, 0, 0, 0, 0, 0 }, // 8
{ 3, 5, 7, 10, 11, 12, 18, 0, 0, 0 }, // 9
{ 6, 7, 9, 11, 0, 0, 0, 0, 0, 0 }, // 10
{ 6, 9, 10, 18, 0, 0, 0, 0, 0, 0 }, // 11
{ 3, 9, 18, 21, 0, 0, 0, 0, 0, 0 }, // 12
{ 6, 14, 17, 19, 0, 0, 0, 0, 0, 0 }, // 13
{ 6, 13, 15, 17, 19, 20, 21, 0, 0, 0 }, // 14
{ 6, 14, 16, 18, 21, 0, 0, 0, 0, 0 }, // 15
{ 6, 15, 0, 0, 0, 0, 0, 0, 0, 0 }, // 16
{13, 14, 19, 0, 0, 0, 0, 0, 0, 0 }, // 17
{ 6, 9, 11, 12, 15, 21, 0, 0, 0, 0 }, // 18
{13, 14, 17, 20, 0, 0, 0, 0, 0, 0 }, // 19
{14, 19, 21, 0, 0, 0, 0, 0, 0, 0 }, // 20
{12, 14, 15, 18, 20, 0, 0, 0, 0, 0 } // 21
};
void T11hGame::opGallery() {
byte field1[21];
@ -224,6 +225,7 @@ void T11hGame::opGallery() {
byte T11hGame::opGallerySub(int one, byte* field) {
// TODO
warning("STUB: T11hGame::opGallerySub()");
return 0;
}

View File

@ -30,8 +30,7 @@ namespace Groovie {
class GroovieEngine;
class T11hGame
{
class T11hGame {
public:
T11hGame();
~T11hGame();
@ -55,7 +54,7 @@ private:
void inline setScriptVar16(uint16 var, uint16 value);
uint16 inline getScriptVar16(uint16 var);
byte *_scriptVariables;
static const byte kGalleryLinks[21][10];
};
} // End of Groovie namespace

View File

@ -34,7 +34,12 @@
namespace Groovie {
// This a list of files for background music. These list is hard-coded in the TLC player.
const Common::String kTlcMusicFiles[] = {"ep01epm.mpg", "ep01tatm.mpg", "amb_hs.mpg", "amb_mr.mpg", "amb_kr.mpg", "amb_mo.mpg", "music_rc.mpg", "amb_ds.mpg", "amb_ds3.mpg", "amb_jr.mpg", "amb_mr4.mpg", "amb_jr4.mpg", "amb_jr2.mpg", "amb_kr2.mpg", "amb_mr2.mpg", "amb_br.mpg", "amb_ds2.mpg", "amb_jr3.mpg", "amb_ds4.mpg", "amb_kr3.mpg", "amb_to1.mpg", "amb_to2.mpg", "ep02epm.mpg", "ep02tatm.mpg", "ep03epm.mpg", "ep03tatm.mpg", "ep04epm.mpg", "ep04tatm.mpg", "ep05epm.mpg", "ep05tatm.mpg", "ep06epm.mpg", "ep06tatm.mpg", "ep07epm.mpg", "ep07tatm.mpg", "ep08epm.mpg", "ep08tatm.mpg", "ep09epm.mpg", "ep09tatm.mpg", "ep10epm.mpg", "ep10tatm.mpg", "ep11epm.mpg", "ep11tatm.mpg", "ep12epm.mpg", "ep12tatm.mpg", "ep13epm.mpg", "ep13tatm.mpg", "ep14epm.mpg", "ep14tatm.mpg", "ep15epm.mpg", "ep15tatm.mpg" };
const char * kTlcMusicFiles[] = {"ep01epm.mpg", "ep01tatm.mpg", "amb_hs.mpg", "amb_mr.mpg", "amb_kr.mpg", "amb_mo.mpg", "music_rc.mpg", "amb_ds.mpg", "amb_ds3.mpg",
"amb_jr.mpg", "amb_mr4.mpg", "amb_jr4.mpg", "amb_jr2.mpg", "amb_kr2.mpg", "amb_mr2.mpg", "amb_br.mpg", "amb_ds2.mpg", "amb_jr3.mpg",
"amb_ds4.mpg", "amb_kr3.mpg", "amb_to1.mpg", "amb_to2.mpg", "ep02epm.mpg", "ep02tatm.mpg", "ep03epm.mpg", "ep03tatm.mpg", "ep04epm.mpg",
"ep04tatm.mpg", "ep05epm.mpg", "ep05tatm.mpg", "ep06epm.mpg", "ep06tatm.mpg", "ep07epm.mpg", "ep07tatm.mpg", "ep08epm.mpg", "ep08tatm.mpg",
"ep09epm.mpg", "ep09tatm.mpg", "ep10epm.mpg", "ep10tatm.mpg", "ep11epm.mpg", "ep11tatm.mpg", "ep12epm.mpg", "ep12tatm.mpg", "ep13epm.mpg",
"ep13tatm.mpg", "ep14epm.mpg", "ep14tatm.mpg", "ep15epm.mpg", "ep15tatm.mpg" };
const uint8 kTlcEpQuestToPlay[] = { 0x0E, 0x0F, 0x0B, 0x10, 0x11, 0x12, 0x0C, 0x0C, 0x09, 0x06, 0x0F, 0x0C, 0x0B, 0x0D, 0x0D };
@ -79,7 +84,7 @@ uint16 inline TlcGame::getScriptVar16(uint16 var) {
}
// Gets the filename of the background music file.
Common::String TlcGame::getTlcMusicFilename(int musicId) {
const char* TlcGame::getTlcMusicFilename(int musicId) {
return kTlcMusicFiles[musicId];
}
@ -139,37 +144,33 @@ void TlcGame::regionsInit() {
// Loads the specific regions for one questions.
void TlcGame::regionsLoad() {
Common::SeekableReadStream *regionsfile = 0;
int nameLen;
int i;
char questName[sizeof(TlcRegionsHeader::name)];
// Check if initRegions was called before
if (_regionHeader == NULL) {
error("TLC:RegionsLoad: initRegions was not called.");
}
// Open regions.rle
regionsfile = SearchMan.createReadStreamForMember("SYSTEM/REGIONS.RLE");
Common::SeekableReadStream *regionsfile = SearchMan.createReadStreamForMember("SYSTEM/REGIONS.RLE");
if (!regionsfile) {
error("TLC:RegionsLoad: Could not open 'SYSTEM/REGIONS.RLE'");
}
// Get length of question name from variables
nameLen = _scriptVariables[0x1B] * 10 + _scriptVariables[0x1C];
int nameLen = _scriptVariables[0x1B] * 10 + _scriptVariables[0x1C];
if (nameLen >= sizeof(TlcRegionsHeader::name)) {
error("TLC:RegionsLoad: Name to long for loadRegions!");
}
// Decoded and copy name from variables
for (i = 0; i < nameLen; i++) {
char questName[sizeof(TlcRegionsHeader::name)];
for (int i = 0; i < nameLen; i++) {
setScriptVar(0x1D + i, _scriptVariables[0x1D + i] + 0x30);
questName[i] = _scriptVariables[0x1D + i];
}
questName[i] = '\0';
questName[nameLen] = '\0';
// Search for the question entry
for (i = 0; i <= _numRegionHeaders; i++) {
for (int i = 0; i <= _numRegionHeaders; i++) {
if (strcmp(questName, _regionHeader[i].name) == 0) {
// move to coordinates for this question
@ -630,28 +631,21 @@ void TlcGame::epResultEpisode() {
/* Select next stream according to which bin(s) are still >0. */
if (_epScoreBin[1] != 0 && _epScoreBin[2] == 0 && _epScoreBin[3] == 0) {
setScriptVar(3, 1);
}
else if (_epScoreBin[1] == 0 && _epScoreBin[2] != 0 && _epScoreBin[3] == 0) {
} else if (_epScoreBin[1] == 0 && _epScoreBin[2] != 0 && _epScoreBin[3] == 0) {
setScriptVar(3, 2);
}
else if (_epScoreBin[1] == 0 && _epScoreBin[2] == 0 && _epScoreBin[3] != 0) {
} else if (_epScoreBin[1] == 0 && _epScoreBin[2] == 0 && _epScoreBin[3] != 0) {
setScriptVar(3, 3);
}
else if (_epScoreBin[1] != 0 && _epScoreBin[2] != 0 && _epScoreBin[3] == 0) {
} else if (_epScoreBin[1] != 0 && _epScoreBin[2] != 0 && _epScoreBin[3] == 0) {
setScriptVar(3, _random.getRandomNumberRng(1, 2));
}
else if (_epScoreBin[1] != 0 && _epScoreBin[2] == 0 && _epScoreBin[3] != 0) {
} else if (_epScoreBin[1] != 0 && _epScoreBin[2] == 0 && _epScoreBin[3] != 0) {
setScriptVar(3, (_random.getRandomNumberRng(0, 1) * 2) + 1);
}
else if (_epScoreBin[1] == 0 && _epScoreBin[2] != 0 && _epScoreBin[3] != 0) {
} else if (_epScoreBin[1] == 0 && _epScoreBin[2] != 0 && _epScoreBin[3] != 0) {
setScriptVar(3, _random.getRandomNumberRng(2, 3));
}
else if (_epScoreBin[1] != 0 && _epScoreBin[2] != 0 && _epScoreBin[3] != 0) {
} else if (_epScoreBin[1] != 0 && _epScoreBin[2] != 0 && _epScoreBin[3] != 0) {
setScriptVar(3, _random.getRandomNumberRng(1, 3));
}
else {
} else {
error("Tlc:EpResultEpisode: Stream selection failed. bins[0..5] = %d, %d, %d, %d, %d, %d",
_epScoreBin[0], _epScoreBin[1], _epScoreBin[2], _epScoreBin[3], _epScoreBin[4], _epScoreBin[5]);
_epScoreBin[0], _epScoreBin[1], _epScoreBin[2], _epScoreBin[3], _epScoreBin[4], _epScoreBin[5]);
}
debugC(1, kDebugTlcGame, "Selected stream [1..3] = %d ", _scriptVariables[3]);
@ -701,26 +695,11 @@ void TlcGame::opFlags() {
_tatFlags[x][y] = 1;
debugC(1, kDebugTlcGame, "Tlc:TatFlags: Set x=%d, y=%d to 1", x, y);
debugC(5, kDebugTlcGame, "Tlc:TatFlags: %d%d%d%d%d%d%d%d%d%d%d%d%d%d %d%d%d%d%d%d%d%d%d%d%d%d%d%d",
_tatFlags[0][0], _tatFlags[1][0], _tatFlags[2][0], _tatFlags[ 3][0], _tatFlags[ 4][0], _tatFlags[ 5][0], _tatFlags[ 6][0],
_tatFlags[7][0], _tatFlags[8][0], _tatFlags[9][0], _tatFlags[10][0], _tatFlags[11][0], _tatFlags[12][0], _tatFlags[13][0],
_tatFlags[0][1], _tatFlags[1][1], _tatFlags[2][1], _tatFlags[ 3][1], _tatFlags[ 4][1], _tatFlags[ 5][1], _tatFlags[ 6][1],
_tatFlags[7][1], _tatFlags[8][1], _tatFlags[9][1], _tatFlags[10][1], _tatFlags[11][1], _tatFlags[12][1], _tatFlags[13][1]);
debugC(5, kDebugTlcGame, "Tlc:TatFlags: %d%d%d%d%d%d%d%d%d%d%d%d%d%d %d%d%d%d%d%d%d%d%d%d%d%d%d%d",
_tatFlags[0][2], _tatFlags[1][2], _tatFlags[2][2], _tatFlags[ 3][2], _tatFlags[ 4][2], _tatFlags[ 5][2], _tatFlags[ 6][2],
_tatFlags[7][2], _tatFlags[8][2], _tatFlags[9][2], _tatFlags[10][2], _tatFlags[11][2], _tatFlags[12][2], _tatFlags[13][2],
_tatFlags[0][3], _tatFlags[1][3], _tatFlags[2][3], _tatFlags[ 3][3], _tatFlags[ 4][3], _tatFlags[ 5][3], _tatFlags[ 6][3],
_tatFlags[7][3], _tatFlags[8][3], _tatFlags[9][3], _tatFlags[10][3], _tatFlags[11][3], _tatFlags[12][3], _tatFlags[13][3]);
debugC(5, kDebugTlcGame, "Tlc:TatFlags: %d%d%d%d%d%d%d%d%d%d%d%d%d%d %d%d%d%d%d%d%d%d%d%d%d%d%d%d",
_tatFlags[0][4], _tatFlags[1][4], _tatFlags[2][4], _tatFlags[ 3][4], _tatFlags[ 4][4], _tatFlags[ 5][4], _tatFlags[ 6][4],
_tatFlags[7][4], _tatFlags[8][4], _tatFlags[9][4], _tatFlags[10][4], _tatFlags[11][4], _tatFlags[12][4], _tatFlags[13][4],
_tatFlags[0][5], _tatFlags[1][5], _tatFlags[2][5], _tatFlags[ 3][5], _tatFlags[ 4][5], _tatFlags[ 5][5], _tatFlags[ 6][5],
_tatFlags[7][5], _tatFlags[8][5], _tatFlags[9][5], _tatFlags[10][5], _tatFlags[11][5], _tatFlags[12][5], _tatFlags[13][5]);
debugC(5, kDebugTlcGame, "Tlc:TatFlags: %d%d%d%d%d%d%d%d%d%d%d%d%d%d %d%d%d%d%d%d%d%d%d%d%d%d%d%d",
_tatFlags[0][6], _tatFlags[1][6], _tatFlags[2][6], _tatFlags[ 3][6], _tatFlags[ 4][6], _tatFlags[ 5][6], _tatFlags[ 6][6],
_tatFlags[7][6], _tatFlags[8][6], _tatFlags[9][6], _tatFlags[10][6], _tatFlags[11][6], _tatFlags[12][6], _tatFlags[13][6],
_tatFlags[0][7], _tatFlags[1][7], _tatFlags[2][7], _tatFlags[ 3][7], _tatFlags[ 4][7], _tatFlags[ 5][7], _tatFlags[ 6][7],
_tatFlags[7][7], _tatFlags[8][7], _tatFlags[9][7], _tatFlags[10][7], _tatFlags[11][7], _tatFlags[12][7], _tatFlags[13][7]);
debugTatFlags(0, 1);
debugTatFlags(2, 3);
debugTatFlags(4, 5);
debugTatFlags(6, 7);
}
else {
setScriptVar(0x01, 1);
@ -730,6 +709,21 @@ void TlcGame::opFlags() {
}
void TlcGame::debugTatFlags(int y, int y2) {
Common::String s = "Tlc:TatFlags: ";
for (int x = 0; x < 14; x++) {
s += int(_tatFlags[x][y]);
}
y = y2;
s += " ";
for (int x = 0; x < 14; x++) {
s += int(_tatFlags[x][y]);
}
debugC(5, kDebugTlcGame, s.c_str());
}
void TlcGame::opTat() {
switch (_scriptVariables[0x40]) {
case 1:
@ -761,9 +755,7 @@ void TlcGame::opTat() {
void TlcGame::tatInitRegs() {
int i;
for (i = 0; i < 0x10; i++) {
for (int i = 0; i < 0x10; i++) {
setScriptVar(0x4D + i, 0);
setScriptVar16(0x5D + i*2, 0);
}

View File

@ -74,7 +74,7 @@ public:
TlcGame();
~TlcGame();
static Common::String getTlcMusicFilename(int musicId);
static const char* getTlcMusicFilename(int musicId);
/**
* Sets a pointer to the script variables. This makes it easier if we want
@ -182,6 +182,7 @@ private:
void tatResultQuest();
void tatResultEpisode();
void tatGetProfile();
void debugTatFlags(int y, int y2);
// Variables for TAT handling
int _tatEpisodes;