PRINCE: O_SETSTRING(), O_INITDIALOG() update
This commit is contained in:
parent
a9a8eb0c98
commit
54d3dc903e
2 changed files with 54 additions and 66 deletions
|
@ -400,6 +400,7 @@ public:
|
||||||
|
|
||||||
uint32 _dialogDatSize;
|
uint32 _dialogDatSize;
|
||||||
byte *_dialogDat;
|
byte *_dialogDat;
|
||||||
|
byte *_dialogData; // on, off flags for lines of dialog text
|
||||||
|
|
||||||
bool _dialogFlag;
|
bool _dialogFlag;
|
||||||
int _dialogWidth;
|
int _dialogWidth;
|
||||||
|
|
|
@ -875,7 +875,8 @@ void Interpreter::O_SETSTRING() {
|
||||||
debugInterpreter("GetVaria %s", _string);
|
debugInterpreter("GetVaria %s", _string);
|
||||||
}
|
}
|
||||||
else if (offset < 2000) {
|
else if (offset < 2000) {
|
||||||
//dialogDat -> dialogData
|
_vm->_dialogData = &_vm->_dialogDat[offset * 4 - 4];
|
||||||
|
|
||||||
uint32 of = READ_LE_UINT32(_vm->_talkTxt + offset * 4);
|
uint32 of = READ_LE_UINT32(_vm->_talkTxt + offset * 4);
|
||||||
const char *txt = (const char *)&_vm->_talkTxt[of];
|
const char *txt = (const char *)&_vm->_talkTxt[of];
|
||||||
_string = &_vm->_talkTxt[of];
|
_string = &_vm->_talkTxt[of];
|
||||||
|
@ -1363,19 +1364,18 @@ int Interpreter::checkSeq(byte *string) {
|
||||||
void Interpreter::O_INITDIALOG() {
|
void Interpreter::O_INITDIALOG() {
|
||||||
debugInterpreter("O_INITDIALOG");
|
debugInterpreter("O_INITDIALOG");
|
||||||
if (_string[0] == 255) {
|
if (_string[0] == 255) {
|
||||||
byte *stringESI = _string;
|
byte *stringCurrOff = _string;
|
||||||
byte *stringEBP = _string;
|
byte *string = _string;
|
||||||
stringESI++;
|
stringCurrOff++;
|
||||||
int32 adressOfFirstSequence = *stringESI; // eax
|
int32 adressOfFirstSequence = (int)READ_UINT16(stringCurrOff);
|
||||||
stringESI += 2;
|
stringCurrOff += 2;
|
||||||
_string = stringEBP + adressOfFirstSequence;
|
_string = string + adressOfFirstSequence;
|
||||||
|
|
||||||
for (uint i = 0; i < _vm->_dialogBoxList.size(); i++) {
|
for (uint i = 0; i < _vm->_dialogBoxList.size(); i++) {
|
||||||
_vm->_dialogBoxList[i].clear();
|
_vm->_dialogBoxList[i].clear();
|
||||||
}
|
}
|
||||||
_vm->_dialogBoxList.clear();
|
_vm->_dialogBoxList.clear();
|
||||||
|
|
||||||
// to global
|
|
||||||
byte *dialogBoxAddr[32]; // adresses of dialog windows
|
byte *dialogBoxAddr[32]; // adresses of dialog windows
|
||||||
byte *dialogOptAddr[32]; // adresses of dialog options
|
byte *dialogOptAddr[32]; // adresses of dialog options
|
||||||
int dialogOptLines[4 * 32]; // numbers of initial dialog lines
|
int dialogOptLines[4 * 32]; // numbers of initial dialog lines
|
||||||
|
@ -1389,83 +1389,70 @@ void Interpreter::O_INITDIALOG() {
|
||||||
dialogOptLines[i] = 0;
|
dialogOptLines[i] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
//loop_1
|
int16 off;
|
||||||
int16 c;
|
byte *line;
|
||||||
byte *eax;
|
|
||||||
int edi = 0;
|
int dialogBox = 0;
|
||||||
while (1) {
|
while ((off = (int)READ_UINT16(stringCurrOff)) != -1) {
|
||||||
c = (int)READ_UINT16(stringESI);
|
stringCurrOff += 2;
|
||||||
stringESI += 2;
|
if (off) {
|
||||||
if (c == -1) {
|
line = string + off;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
if (c != 0) {
|
dialogBoxAddr[dialogBox] = line;
|
||||||
eax = stringEBP + c;
|
dialogBox++;
|
||||||
}
|
|
||||||
dialogBoxAddr[edi] = eax;
|
|
||||||
edi++;
|
|
||||||
}
|
}
|
||||||
//box_done:
|
stringCurrOff += 2;
|
||||||
edi = 0;
|
|
||||||
while (1) {
|
int dialogOpt = 0;
|
||||||
c = (int)READ_UINT16(stringESI);
|
while ((off = (int)READ_UINT16(stringCurrOff)) != -1) {
|
||||||
stringESI += 2;
|
stringCurrOff += 2;
|
||||||
if (c == -1) {
|
if (off) {
|
||||||
break;
|
line = string + off;
|
||||||
}
|
}
|
||||||
if (c != 0) {
|
dialogOptAddr[dialogOpt] = line;
|
||||||
eax = stringEBP + c;
|
dialogOpt++;
|
||||||
}
|
|
||||||
dialogOptAddr[edi] = eax;
|
|
||||||
edi++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int i = 0;
|
dialogBox = 0;
|
||||||
|
byte c;
|
||||||
|
int sentenceNumber;
|
||||||
|
DialogLine tempDialogLine;
|
||||||
Common::Array<DialogLine> tempDialogBox;
|
Common::Array<DialogLine> tempDialogBox;
|
||||||
while (dialogBoxAddr[i] != 0) {
|
|
||||||
|
while (dialogBoxAddr[dialogBox]) {
|
||||||
tempDialogBox.clear();
|
tempDialogBox.clear();
|
||||||
byte *boxAddr = dialogBoxAddr[i];
|
byte *boxAddr = dialogBoxAddr[dialogBox];
|
||||||
|
int dialogDataValue = (int)READ_UINT32(_vm->_dialogData);
|
||||||
byte *stream = boxAddr;
|
while ((sentenceNumber = *boxAddr) != 0xFF) {
|
||||||
int streamSize = 0;
|
boxAddr++;
|
||||||
while (*stream != 0xFF) {
|
if (!(dialogDataValue & (1 << sentenceNumber))) {
|
||||||
stream++;
|
tempDialogLine._line.clear();
|
||||||
streamSize++;
|
tempDialogLine._nr = sentenceNumber;
|
||||||
}
|
while ((c = *boxAddr)) {
|
||||||
streamSize++;
|
tempDialogLine._line += c;
|
||||||
//int dialogDataValueEDI = (int)READ_UINT32(dialogData);
|
boxAddr++;
|
||||||
byte c;
|
}
|
||||||
int sentenceNumber;
|
boxAddr++;
|
||||||
DialogLine tempDialogLine;
|
tempDialogBox.push_back(tempDialogLine);
|
||||||
Common::MemoryReadStream dialogStream(boxAddr, streamSize);
|
} else {
|
||||||
while ((sentenceNumber = dialogStream.readSByte()) != -1) {
|
do {
|
||||||
tempDialogLine._line.clear();
|
c = *boxAddr;
|
||||||
//bt edi, eax
|
boxAddr++;
|
||||||
//jc skip_zdanko
|
} while (c);
|
||||||
// skip_sentence - TODO
|
|
||||||
tempDialogLine._nr = sentenceNumber;
|
|
||||||
|
|
||||||
while ((c = dialogStream.readByte())) {
|
|
||||||
tempDialogLine._line += c;
|
|
||||||
}
|
}
|
||||||
tempDialogBox.push_back(tempDialogLine);
|
|
||||||
}
|
}
|
||||||
_vm->_dialogBoxList.push_back(tempDialogBox);
|
_vm->_dialogBoxList.push_back(tempDialogBox);
|
||||||
i++;
|
dialogBox++;
|
||||||
}
|
}
|
||||||
|
|
||||||
//opt_done
|
// TODO - dialogOptAddr, dialogOptLines
|
||||||
int freeASlot = 0;
|
|
||||||
int freeBSlot = 0;
|
|
||||||
_flags->setFlagValue(Flags::VOICE_A_LINE, 0);
|
_flags->setFlagValue(Flags::VOICE_A_LINE, 0);
|
||||||
_flags->setFlagValue(Flags::VOICE_B_LINE, 0); // bx in original?
|
_flags->setFlagValue(Flags::VOICE_B_LINE, 0); // bx in original?
|
||||||
|
|
||||||
int freeHSlot = 0;
|
int freeHSlot = 0;
|
||||||
//check
|
|
||||||
for (int i = 31; i >= 0; i--) {
|
for (int i = 31; i >= 0; i--) {
|
||||||
if (dialogOptAddr[i] != 0) {
|
if (dialogOptAddr[i] != 0) {
|
||||||
i++;
|
i++;
|
||||||
debug("%s", (char *)dialogOptAddr[i]);
|
|
||||||
freeHSlot = i;
|
freeHSlot = i;
|
||||||
_flags->setFlagValue(Flags::VOICE_H_LINE, i);
|
_flags->setFlagValue(Flags::VOICE_H_LINE, i);
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue