mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-15 14:18:37 +00:00
SUPERNOVA: Implement most dialog related functions
This commit is contained in:
parent
f4b10b7a83
commit
21899d8716
@ -1581,20 +1581,20 @@ bool ArsanoEntrance::interact(Action verb, Object &obj1, Object &obj2) {
|
||||
do {
|
||||
if (_gm->_state._shoes == 1) {
|
||||
_dialog2[2] = kStringArsanoEntrance2;
|
||||
_gm->addSentence(2, 2);
|
||||
addSentence(2, 2);
|
||||
} else if (_gm->_state._shoes > 1) {
|
||||
_gm->removeSentence(2, 2);
|
||||
removeSentence(2, 2);
|
||||
}
|
||||
switch (e = _gm->dialog(5, row2, _dialog2, 2)) {
|
||||
case 0:
|
||||
_gm->reply(kStringArsanoEntrance3, 1, _gm->invertSection(1));
|
||||
_gm->reply(kStringArsanoEntrance4, 1, _gm->invertSection(1));
|
||||
_gm->reply(kStringArsanoEntrance5, 1, _gm->invertSection(1));
|
||||
_gm->removeSentence(1, 1);
|
||||
removeSentence(1, 1);
|
||||
break;
|
||||
case 1:
|
||||
_gm->reply(kStringArsanoEntrance6, 1, _gm->invertSection(1));
|
||||
_gm->addSentence(1, 2);
|
||||
addSentence(1, 2);
|
||||
break;
|
||||
case 2:
|
||||
if (_gm->_state._shoes == 1) {
|
||||
@ -1643,7 +1643,7 @@ bool ArsanoEntrance::interact(Action verb, Object &obj1, Object &obj2) {
|
||||
_gm->reply(kStringArsanoEntrance3, 1, 1 + 128);
|
||||
_gm->reply(kStringArsanoEntrance4, 1, 1 + 128);
|
||||
_gm->reply(kStringArsanoEntrance5, 1, 1 + 128);
|
||||
_gm->removeSentence(0, 2);
|
||||
removeSentence(0, 2);
|
||||
break;
|
||||
case 2:
|
||||
_gm->reply(kStringArsanoEntrance7, 1, 1 + 128);
|
||||
@ -1661,7 +1661,7 @@ bool ArsanoEntrance::interact(Action verb, Object &obj1, Object &obj2) {
|
||||
_gm->drawImage(_gm->invertSection(3));
|
||||
break;
|
||||
}
|
||||
_gm->removeSentence(0, 1);
|
||||
removeSentence(0, 1);
|
||||
}
|
||||
} else {
|
||||
_gm->dialog(2, row3, _dialog3, 0);
|
||||
@ -1689,8 +1689,8 @@ bool ArsanoEntrance::interact(Action verb, Object &obj1, Object &obj2) {
|
||||
if (_gm->_state._shoes == 2) {
|
||||
_vm->renderMessage(kStringArsanoEntrance17);
|
||||
_gm->_state._shoes = 3;
|
||||
_gm->removeSentence(2, 2);
|
||||
_gm->removeSentence(3, 2);
|
||||
removeSentence(2, 2);
|
||||
removeSentence(3, 2);
|
||||
} else if (_gm->_state._shoes == 3) {
|
||||
_vm->renderMessage(kStringArsanoEntrance18);
|
||||
_gm->_state._shoes = 2;
|
||||
@ -2326,7 +2326,7 @@ bool ArsanoMeetup3::interact(Action verb, Object &obj1, Object &obj2) {
|
||||
_gm->reply(kStringArsanoMeetup3_24, 1, 1 + 128);
|
||||
_gm->reply(kStringArsanoMeetup3_25, 1, 1 + 128);
|
||||
}
|
||||
_gm->removeSentence(2, 2);
|
||||
removeSentence(2, 2);
|
||||
} while (_shown[kMaxSection - 2] != 15);
|
||||
_gm->say(kStringArsanoMeetup3_26);
|
||||
_gm->reply(kStringArsanoMeetup3_27, 1, 1 + 128);
|
||||
@ -2583,8 +2583,8 @@ bool AxacussCorridor5::handleMoneyDialog() {
|
||||
_gm->reply(kStringAxacussCorridor5_5, 1, 1 + 128);
|
||||
setSectionVisible(kMaxSection - 2, false);
|
||||
if (_gm->_state._money == 0) {
|
||||
_gm->removeSentence(2, 2);
|
||||
_gm->removeSentence(3, 2);
|
||||
removeSentence(2, 2);
|
||||
removeSentence(3, 2);
|
||||
} else {
|
||||
// TODO: Handle string manipulation in dialogs
|
||||
// _dialog3[2] and _dialog3[3] are both using kStringDialogAxacussCorridor5_7
|
||||
|
@ -61,6 +61,23 @@ public:
|
||||
bool isSectionVisible(uint index) const {
|
||||
return _shown[index] == kShownTrue;
|
||||
}
|
||||
|
||||
void removeSentence(int sentence, int number) {
|
||||
if (number > 0)
|
||||
_shown[kMaxSection - number] |= (1 << sentence);
|
||||
}
|
||||
|
||||
void addSentence(int sentence, int number) {
|
||||
if (number > 0)
|
||||
_shown[kMaxSection - number] &= ~(1 << sentence);
|
||||
}
|
||||
|
||||
bool sentencedRemoved(int sentence, int number) {
|
||||
if (number <= 0)
|
||||
return false;
|
||||
return (_shown[kMaxSection - number] & (1 << sentence));
|
||||
}
|
||||
|
||||
Object *getObject(uint index) {
|
||||
return &_objectState[index];
|
||||
}
|
||||
|
@ -319,6 +319,14 @@ void GameManager::initState() {
|
||||
_timer1 = 0;
|
||||
_animationTimer = 0;
|
||||
|
||||
_currentSentence = -1;
|
||||
for (int i = 0 ; i < 6 ; ++i) {
|
||||
_sentenceNumber[i] = -1;
|
||||
_texts[i] = kNoString;
|
||||
_rows[i] = 0;
|
||||
_rowsStart[i] = 0;
|
||||
}
|
||||
|
||||
_state._time = ticksToMsec(916364); // 2 pm
|
||||
_state._timeSleep = 0;
|
||||
_state._timeAlarm = ticksToMsec(458182); // 7 am
|
||||
@ -775,33 +783,119 @@ void GameManager::shipStart() {
|
||||
// STUB
|
||||
}
|
||||
|
||||
void GameManager::removeSentence(int sentence, int number) {
|
||||
// STUB
|
||||
}
|
||||
|
||||
void GameManager::addSentence(int sentence, int number) {
|
||||
// STUB
|
||||
void GameManager::sentence(int number, bool brightness) {
|
||||
if (number < 0)
|
||||
return;
|
||||
_vm->renderBox(0, 141 + _rowsStart[number] * 10, 320, _rows[number] * 10 - 1, brightness ? kColorWhite44 : kColorWhite25);
|
||||
if (_texts[_rowsStart[number]] == kStringDialogSeparator)
|
||||
_vm->renderText(kStringConversationEnd, 1, 142 + _rowsStart[number] * 10, brightness ? kColorRed : kColorDarkRed);
|
||||
else {
|
||||
for (int r = _rowsStart[number]; r < _rowsStart[number] + _rows[number]; ++r)
|
||||
_vm->renderText(_texts[r], 1, 142 + r * 10, brightness ? kColorGreen : kColorDarkGreen);
|
||||
}
|
||||
}
|
||||
|
||||
void GameManager::say(StringID textId) {
|
||||
// STUB
|
||||
Common::String str = _vm->getGameString(textId);
|
||||
if (!str.empty())
|
||||
say(str.c_str());
|
||||
}
|
||||
|
||||
void GameManager::say(const char *text) {
|
||||
// STUB
|
||||
Common::String t(text);
|
||||
char *row[6];
|
||||
Common::String::iterator p = t.begin();
|
||||
uint numRows = 0;
|
||||
while (*p) {
|
||||
row[numRows++] = p;
|
||||
while ((*p != '\0') && (*p != '|')) {
|
||||
++p;
|
||||
}
|
||||
if (*p == '|') {
|
||||
*p = 0;
|
||||
++p;
|
||||
}
|
||||
}
|
||||
|
||||
_vm->renderBox(0, 138, 320, 62, kColorBlack);
|
||||
_vm->renderBox(0, 141, 320, numRows * 10 - 1, kColorWhite25);
|
||||
for (int r = 0; r < numRows; ++r)
|
||||
_vm->renderText(row[r], 1, 142 + r * 10, kColorDarkGreen);
|
||||
mouseWait((t.size() + 20) * _vm->_textSpeed / 10);
|
||||
_vm->renderBox(0, 138, 320, 62, kColorBlack);
|
||||
}
|
||||
|
||||
void GameManager::reply(StringID textId, int aus1, int aus2) {
|
||||
// STUB
|
||||
Common::String str = _vm->getGameString(textId);
|
||||
if (!str.empty())
|
||||
reply(str.c_str(), aus1, aus2);
|
||||
}
|
||||
|
||||
void GameManager::reply(const char *text, int aus1, int aus2) {
|
||||
// STUB
|
||||
if (*text != '|')
|
||||
_vm->renderMessage(text, kMessageTop);
|
||||
|
||||
for (int z = (strlen(text) + 20) * _vm->_textSpeed / 40; z > 0; --z) {
|
||||
drawImage(aus1);
|
||||
mouseWait(2);
|
||||
if (_keyPressed) // ?? origin: key != -1, need to check what mouseWait does...
|
||||
z = 1;
|
||||
drawImage(aus2);
|
||||
mouseWait(2);
|
||||
if (_keyPressed)
|
||||
z = 1;
|
||||
}
|
||||
if (*text != '|')
|
||||
_vm->removeMessage();
|
||||
}
|
||||
|
||||
int GameManager::dialog(int num, byte rowLength[6], StringID text[6], int number) {
|
||||
// STUB
|
||||
return 0;
|
||||
bool remove[6];
|
||||
for (int i = 0; i < 5; ++i)
|
||||
remove[i] = _currentRoom->sentencedRemoved(i, number);
|
||||
// The original does not initialize remove[5]!!!
|
||||
// Set it to false/0. But maybe the loop above should use 6 instead of 5?
|
||||
remove[5] = false;
|
||||
|
||||
_vm->renderBox(0, 138, 320, 62, kColorBlack);
|
||||
|
||||
for (int i = 0; i < 6 ; ++i)
|
||||
_sentenceNumber[i] = -1;
|
||||
|
||||
int r = 0, rq = 0;
|
||||
for (int i = 0; i < num; ++i) {
|
||||
if (!remove[i]) {
|
||||
_rowsStart[i] = r;
|
||||
_rows[i] = rowLength[i];
|
||||
for (int j = 0; j < _rows[i]; ++j, ++r, ++rq) {
|
||||
_texts[r] = text[rq];
|
||||
_sentenceNumber[r] = i;
|
||||
}
|
||||
sentence(i, false);
|
||||
} else
|
||||
rq += rowLength[i];
|
||||
}
|
||||
|
||||
_currentSentence = -1;
|
||||
do {
|
||||
mouseInput3();
|
||||
} while (_currentSentence == -1);
|
||||
|
||||
_vm->renderBox(0, 138, 320, 62, kColorBlack);
|
||||
|
||||
if (number && _texts[_rowsStart[_currentSentence]] != kStringDialogSeparator)
|
||||
_currentRoom->removeSentence(_currentSentence, number);
|
||||
|
||||
return _currentSentence;
|
||||
}
|
||||
|
||||
void GameManager::mousePosDialog(int x, int y) {
|
||||
int a = y < 141 ? -1 : _sentenceNumber[(y - 141) / 10];
|
||||
if (a != _currentSentence) {
|
||||
sentence(_currentSentence, false);
|
||||
_currentSentence = a;
|
||||
sentence(_currentSentence, true);
|
||||
}
|
||||
}
|
||||
|
||||
void GameManager::turnOff() {
|
||||
|
@ -132,6 +132,12 @@ public:
|
||||
GuiElement _guiInventoryArrow[2];
|
||||
// 0 PC Speaker | 1 SoundBlaster | 2 No Sound
|
||||
int _soundDevice;
|
||||
// Dialog
|
||||
int _currentSentence;
|
||||
int _sentenceNumber[6];
|
||||
StringID _texts[6];
|
||||
byte _rows[6];
|
||||
byte _rowsStart[6];
|
||||
|
||||
void takeObject(Object &obj);
|
||||
|
||||
@ -182,12 +188,11 @@ public:
|
||||
void dead(StringID messageId);
|
||||
int dialog(int num, byte rowLength[6], StringID text[6], int number);
|
||||
void sentence(int number, bool brightness);
|
||||
void removeSentence(int sentence, int number);
|
||||
void addSentence(int sentence, int number);
|
||||
void say(StringID textId);
|
||||
void say(const char *text);
|
||||
void reply(StringID textId, int aus1, int aus2);
|
||||
void reply(const char *text, int aus1, int aus2);
|
||||
void mousePosDialog(int x, int y);
|
||||
void shipStart();
|
||||
void shot(int a, int b);
|
||||
void takeMoney(int amount);
|
||||
|
Loading…
Reference in New Issue
Block a user