Skip to content

Commit

Permalink
TSAGE: Bugfixes and extra commenting for R2R conversation display
Browse files Browse the repository at this point in the history
  • Loading branch information
dreammaster committed Dec 12, 2011
1 parent 546c6a0 commit 18cfbc6
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 15 deletions.
10 changes: 6 additions & 4 deletions engines/tsage/converse.cpp
Expand Up @@ -552,7 +552,7 @@ void Obj44::load(const byte *dataP) {
s.skip(4);
}

for (int idx = 0; idx < OBJ44_LIST_SIZE; ++idx) {
for (int idx = 0; idx < OBJ0A_LIST_SIZE; ++idx) {
_list[idx]._id = s.readSint16LE();
_list[idx]._scriptOffset = s.readSint16LE();
s.skip(6);
Expand All @@ -565,7 +565,7 @@ void Obj44::synchronize(Serializer &s) {
s.syncAsSint32LE(_id);
for (int idx = 0; idx < OBJ44_LIST_SIZE; ++idx)
s.syncAsSint32LE(_callbackId[idx]);
for (int idx = 0; idx < OBJ44_LIST_SIZE; ++idx)
for (int idx = 0; idx < OBJ0A_LIST_SIZE; ++idx)
_list[idx].synchronize(s);
s.syncAsUint32LE(_speakerOffset);

Expand Down Expand Up @@ -645,10 +645,12 @@ void StripManager::load() {
// Get the object list
byte *obj44List = g_resourceManager->getResource(RES_STRIP, _stripNum, 1);
int dataSize = g_vm->_memoryManager.getSize(obj44List);
assert((dataSize % 0x44) == 0);

int obj44Size = (g_vm->getGameID() == GType_Ringworld2) ? 126 : 68;
assert((dataSize % obj44Size) == 0);

byte *dataP = obj44List;
for (int idx = 0; idx < (dataSize / 0x44); ++idx, dataP += 0x44) {
for (int idx = 0; idx < (dataSize / obj44Size); ++idx, dataP += obj44Size) {
Obj44 obj;
obj.load(dataP);
_obj44List.push_back(obj);
Expand Down
3 changes: 2 additions & 1 deletion engines/tsage/converse.h
Expand Up @@ -178,12 +178,13 @@ class Obj0A : public Serialisable {
};

#define OBJ44_LIST_SIZE 5
#define OBJ0A_LIST_SIZE ((g_vm->getGameID() == GType_Ringworld2) ? 8 : 5)

class Obj44 : public Serialisable {
public:
int _id;
int _callbackId[OBJ44_LIST_SIZE];
Obj0A _list[OBJ44_LIST_SIZE];
Obj0A _list[8];
uint _speakerOffset;

// Return to Ringworld specific field
Expand Down
2 changes: 1 addition & 1 deletion engines/tsage/detection_tables.h
Expand Up @@ -150,7 +150,7 @@ static const tSageGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformPC,
ADGF_CD | ADGF_UNSTABLE,
GUIO2(GUIO_NOSPEECH, GUIO_NOSFX)
GUIO0()
},
GType_Ringworld2,
GF_CD | GF_ALT_REGIONS
Expand Down
2 changes: 1 addition & 1 deletion engines/tsage/globals.cpp
Expand Up @@ -383,7 +383,7 @@ void Ringworld2Globals::reset() {
_v57C2C = 0;
_v58CE2 = 0;
Common::fill(&_v565F1[0], &_v565F1[MAX_CHARACTERS], 0);
_speechSubtitles = 0;
_speechSubtitles = SPEECH_VOICE | SPEECH_TEXT;
_insetUp = 0;

Common::fill(&_v565F1[0], &_v565F1[MAX_CHARACTERS], 0);
Expand Down
3 changes: 3 additions & 0 deletions engines/tsage/globals.h
Expand Up @@ -239,6 +239,9 @@ class BlueForceGlobals: public TsAGE2Globals {

namespace Ringworld2 {

#define SPEECH_TEXT 1
#define SPEECH_VOICE 2

class Ringworld2Globals: public TsAGE2Globals {
public:
ASoundExt _sound1, _sound2, _sound3, _sound4;
Expand Down
4 changes: 2 additions & 2 deletions engines/tsage/ringworld2/ringworld2_scenes0.cpp
Expand Up @@ -774,7 +774,7 @@ void Scene125::signal() {
case 12:
if (_soundCount > 0)
--_soundCount;
if (!_soundCount || (R2_GLOBALS._speechSubtitles & 2)) {
if (!_soundCount || (R2_GLOBALS._speechSubtitles & SPEECH_VOICE)) {
_soundIndex = 0;
R2_GLOBALS._playStream.stop();
} else {
Expand Down Expand Up @@ -1148,7 +1148,7 @@ void Scene125::setDetails(int resNum, int lineNum) {

R2_GLOBALS._sceneObjects->draw();

if ((_soundCount > 0) && (R2_GLOBALS._speechSubtitles & 2)) {
if ((_soundCount > 0) && (R2_GLOBALS._speechSubtitles & SPEECH_VOICE)) {
_sceneMode = 12;
R2_GLOBALS._playStream.play(_soundIndexes[_soundIndex], this);
}
Expand Down
12 changes: 6 additions & 6 deletions engines/tsage/ringworld2/ringworld2_speakers.cpp
Expand Up @@ -110,7 +110,7 @@ void VisualSpeaker::setText(const Common::String &msg) {
Common::String s = msg;
if (s.hasPrefix("!")) {
s.deleteChar(0);
_soundId = atoi(msg.c_str());
_soundId = atoi(s.c_str());

while (!s.empty() && (*s.c_str() >= '0' && *s.c_str() <= '9'))
s.deleteChar(0);
Expand All @@ -123,20 +123,20 @@ void VisualSpeaker::setText(const Common::String &msg) {
_sceneText._width = _textWidth;
_sceneText._fontNumber = _fontNumber;
_sceneText._textMode = _textMode;
_sceneText.setup(msg);
_sceneText.setup(s);

//_sceneText.clone();

_sceneText.setPosition(_textPos);
_sceneText.setPriority(0x100);

// If subtitles are turned off, don't show the text
if (!(R2_GLOBALS._speechSubtitles & 1)) {
if (!(R2_GLOBALS._speechSubtitles & SPEECH_TEXT)) {
_sceneText.hide();
}

// Figure out the text delay if subtitles are turned on, or there's no speech resource specified
if ((R2_GLOBALS._speechSubtitles & 1) || !_soundId) {
if ((R2_GLOBALS._speechSubtitles & SPEECH_TEXT) || !_soundId) {
const char *msgP = s.c_str();
int numWords = 0;
while (*msgP != '\0') {
Expand All @@ -159,10 +159,10 @@ void VisualSpeaker::setText(const Common::String &msg) {


if (_fieldF6) {
if ((R2_GLOBALS._speechSubtitles & 1) || !_soundId)
if ((R2_GLOBALS._speechSubtitles & SPEECH_TEXT) || !_soundId)
_sceneText.hide();
} else {
if ((R2_GLOBALS._speechSubtitles & 2) && _soundId) {
if ((R2_GLOBALS._speechSubtitles & SPEECH_VOICE) && _soundId) {
if (!R2_GLOBALS._playStream.play(_soundId, NULL))
_sceneText.show();
}
Expand Down

0 comments on commit 18cfbc6

Please sign in to comment.