CGE2: Add workaround for the missing dialogs in room 21 (concert)
This commit is contained in:
parent
21a4c44bea
commit
c5855b4293
2 changed files with 10 additions and 6 deletions
|
@ -38,16 +38,19 @@ Text::Text(CGE2Engine *vm, const char *fname) : _vm(vm) {
|
||||||
_vm->mergeExt(_fileName, fname, kSayExt);
|
_vm->mergeExt(_fileName, fname, kSayExt);
|
||||||
if (!_vm->_resman->exist(_fileName))
|
if (!_vm->_resman->exist(_fileName))
|
||||||
error("No talk (%s)", _fileName);
|
error("No talk (%s)", _fileName);
|
||||||
int16 txtCount = count() + 1;
|
_txtCount = count();
|
||||||
if (!txtCount)
|
if (_txtCount == -1)
|
||||||
error("Unable to read dialog file %s", _fileName);
|
error("Unable to read dialog file %s", _fileName);
|
||||||
|
|
||||||
_cache = new Handler[txtCount];
|
_txtCount += 2;
|
||||||
for (_size = 0; _size < txtCount; _size++) {
|
_cache = new Handler[_txtCount];
|
||||||
|
for (_size = 0; _size < _txtCount; _size++) {
|
||||||
_cache[_size]._ref = 0;
|
_cache[_size]._ref = 0;
|
||||||
_cache[_size]._text = nullptr;
|
_cache[_size]._text = nullptr;
|
||||||
}
|
}
|
||||||
load();
|
load();
|
||||||
|
_cache[_txtCount - 1]._ref = 0;
|
||||||
|
_cache[_txtCount - 1]._text = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
Text::~Text() {
|
Text::~Text() {
|
||||||
|
@ -127,8 +130,8 @@ char *Text::getText(int ref) {
|
||||||
if (i < _size)
|
if (i < _size)
|
||||||
return _cache[i]._text;
|
return _cache[i]._text;
|
||||||
|
|
||||||
warning("getText: Unable to find ref %d", ref);
|
warning("getText: Unable to find ref %d:%d", ref / 256, ref % 256);
|
||||||
return NULL;
|
return _cache[_txtCount - 1]._text;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Text::say(const char *text, Sprite *spr) {
|
void Text::say(const char *text, Sprite *spr) {
|
||||||
|
|
|
@ -48,6 +48,7 @@ class Text {
|
||||||
char *_text;
|
char *_text;
|
||||||
} *_cache;
|
} *_cache;
|
||||||
int _size;
|
int _size;
|
||||||
|
int16 _txtCount;
|
||||||
char _fileName[kPathMax];
|
char _fileName[kPathMax];
|
||||||
void load();
|
void load();
|
||||||
int16 count();
|
int16 count();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue