mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-26 04:35:16 +00:00
Added word-wrapping to Drascula's conversation options. Fixes bug #2826607.
svn-id: r42755
This commit is contained in:
parent
ddd2b29bee
commit
2e13d89233
@ -143,6 +143,7 @@ void DrasculaEngine::converse(int index) {
|
||||
game3 = kDialogOptionUnselected;
|
||||
char phrase1[78], phrase2[78], phrase3[78], phrase4[78];
|
||||
char sound1[13], sound2[13], sound3[13], sound4[13];
|
||||
int phrase1_bottom, phrase2_bottom, phrase3_bottom, phrase4_bottom;
|
||||
int answer1, answer2, answer3;
|
||||
char buffer[256];
|
||||
|
||||
@ -207,12 +208,12 @@ void DrasculaEngine::converse(int index) {
|
||||
|
||||
updateEvents();
|
||||
|
||||
print_abc_opc(phrase1, 2, game1);
|
||||
print_abc_opc(phrase2, 10, game2);
|
||||
print_abc_opc(phrase3, 18, game3);
|
||||
print_abc_opc(phrase4, 26, kDialogOptionUnselected);
|
||||
phrase1_bottom = 8 * print_abc_opc(phrase1, 2, game1);
|
||||
phrase2_bottom = phrase1_bottom + 8 * print_abc_opc(phrase2, phrase1_bottom + 2, game2);
|
||||
phrase3_bottom = phrase2_bottom + 8 * print_abc_opc(phrase3, phrase2_bottom + 2, game3);
|
||||
phrase4_bottom = phrase3_bottom + 8 * print_abc_opc(phrase4, phrase3_bottom + 2, kDialogOptionUnselected);
|
||||
|
||||
if (mouseY > 0 && mouseY < 9) {
|
||||
if (mouseY > 0 && mouseY < phrase1_bottom) {
|
||||
if (game1 == kDialogOptionClicked && _color != kColorWhite)
|
||||
color_abc(kColorWhite);
|
||||
else if (game1 != kDialogOptionClicked && _color != kColorLightGreen)
|
||||
@ -226,13 +227,13 @@ void DrasculaEngine::converse(int index) {
|
||||
talk(phrase1, sound1);
|
||||
response(answer1);
|
||||
}
|
||||
} else if (mouseY > 8 && mouseY < 17) {
|
||||
} else if (mouseY > phrase1_bottom && mouseY < phrase2_bottom) {
|
||||
if (game2 == kDialogOptionClicked && _color != kColorWhite)
|
||||
color_abc(kColorWhite);
|
||||
else if (game2 != kDialogOptionClicked && _color != kColorLightGreen)
|
||||
color_abc(kColorLightGreen);
|
||||
|
||||
print_abc_opc(phrase2, 10, kDialogOptionSelected);
|
||||
print_abc_opc(phrase2, phrase1_bottom + 2, kDialogOptionSelected);
|
||||
|
||||
if (leftMouseButton == 1) {
|
||||
delay(100);
|
||||
@ -240,13 +241,13 @@ void DrasculaEngine::converse(int index) {
|
||||
talk(phrase2, sound2);
|
||||
response(answer2);
|
||||
}
|
||||
} else if (mouseY > 16 && mouseY < 25) {
|
||||
} else if (mouseY > phrase2_bottom && mouseY < phrase3_bottom) {
|
||||
if (game3 == kDialogOptionClicked && _color != kColorWhite)
|
||||
color_abc(kColorWhite);
|
||||
else if (game3 != kDialogOptionClicked && _color != kColorLightGreen)
|
||||
color_abc(kColorLightGreen);
|
||||
|
||||
print_abc_opc(phrase3, 18, kDialogOptionSelected);
|
||||
print_abc_opc(phrase3, phrase2_bottom + 2, kDialogOptionSelected);
|
||||
|
||||
if (leftMouseButton == 1) {
|
||||
delay(100);
|
||||
@ -254,8 +255,8 @@ void DrasculaEngine::converse(int index) {
|
||||
talk(phrase3, sound3);
|
||||
response(answer3);
|
||||
}
|
||||
} else if (mouseY > 24 && mouseY < 33) {
|
||||
print_abc_opc(phrase4, 26, kDialogOptionSelected);
|
||||
} else if (mouseY > phrase3_bottom && mouseY < phrase4_bottom) {
|
||||
print_abc_opc(phrase4, phrase3_bottom + 2, kDialogOptionSelected);
|
||||
|
||||
if (leftMouseButton == 1) {
|
||||
delay(100);
|
||||
|
@ -564,7 +564,7 @@ public:
|
||||
void playTalkSequence(int sequence);
|
||||
void doTalkSequenceCommand(TalkSequenceCommand cmd);
|
||||
void converse(int);
|
||||
void print_abc_opc(const char *, int, int);
|
||||
int print_abc_opc(const char *, int, int);
|
||||
void response(int);
|
||||
void activatePendulum();
|
||||
|
||||
|
@ -235,13 +235,30 @@ void DrasculaEngine::print_abc(const char *said, int screenX, int screenY) {
|
||||
} // for
|
||||
}
|
||||
|
||||
void DrasculaEngine::print_abc_opc(const char *said, int screenY, int game) {
|
||||
int DrasculaEngine::print_abc_opc(const char *said, int screenY, int game) {
|
||||
int signY, letterY, letterX = 0;
|
||||
uint len = strlen(said);
|
||||
|
||||
int screenX = 1;
|
||||
int lines = 1;
|
||||
|
||||
for (uint h = 0; h < len; h++) {
|
||||
int wordLength;
|
||||
|
||||
// Look ahead to the end of the word.
|
||||
wordLength = 0;
|
||||
int pos = h;
|
||||
while (said[pos] && said[pos] != ' ') {
|
||||
wordLength++;
|
||||
pos++;
|
||||
}
|
||||
|
||||
if (screenX + wordLength * CHAR_WIDTH_OPC > 317) {
|
||||
screenX = 0;
|
||||
screenY += (CHAR_HEIGHT + 2);
|
||||
lines++;
|
||||
}
|
||||
|
||||
if (game == 1) {
|
||||
letterY = 6;
|
||||
signY = 15;
|
||||
@ -281,6 +298,8 @@ void DrasculaEngine::print_abc_opc(const char *said, int screenY, int game) {
|
||||
|
||||
screenX = screenX + CHAR_WIDTH_OPC;
|
||||
}
|
||||
|
||||
return lines;
|
||||
}
|
||||
|
||||
bool DrasculaEngine::textFitsCentered(char *text, int x) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user