Ticket #2539: verbs.txt

File verbs.txt, 3.2 KB (added by Kirben, 18 years ago)

Patch for issue

Line 
1Index: engines/scumm/intern.h
2===================================================================
3--- engines/scumm/intern.h (revision 22289)
4+++ engines/scumm/intern.h (working copy)
5@@ -822,7 +822,7 @@
6 int32 offset;
7 };
8
9- int _verbCharset;
10+ int _verbCharset, _verbLineSpacing;
11 bool _existLanguageFile;
12 char *_languageBuffer;
13 LangIndexNode *_languageIndex;
14Index: engines/scumm/scumm.cpp
15===================================================================
16--- engines/scumm/scumm.cpp (revision 22289)
17+++ engines/scumm/scumm.cpp (working copy)
18@@ -908,6 +908,7 @@
19 ScummEngine_v7::ScummEngine_v7(OSystem *syst, const DetectorResult &dr)
20 : ScummEngine_v6(syst, dr) {
21 _verbCharset = 0;
22+ _verbLineSpacing = 0;
23 _existLanguageFile = false;
24 _languageBuffer = NULL;
25 _languageIndex = NULL;
26Index: engines/scumm/verbs.cpp
27===================================================================
28--- engines/scumm/verbs.cpp (revision 22289)
29+++ engines/scumm/verbs.cpp (working copy)
30@@ -685,25 +685,43 @@
31 while (*msg == 0xFF)
32 msg += 4;
33
34- enqueueText(msg, vs->curRect.left, vs->curRect.top, color, vs->charset_nr, vs->center);
35-
36 // Set the specified charset id
37 _charset->setCurID(vs->charset_nr);
38
39 // Compute the text rect
40 vs->curRect.right = 0;
41 vs->curRect.bottom = 0;
42- while (*msg) {
43- const int charWidth = _charset->getCharWidth(*msg);
44- const int charHeight = _charset->getCharHeight(*msg);
45+ const byte *msg2 = msg;
46+ while (*msg2) {
47+ const int charWidth = _charset->getCharWidth(*msg2);
48+ const int charHeight = _charset->getCharHeight(*msg2);
49 vs->curRect.right += charWidth;
50 if (vs->curRect.bottom < charHeight)
51 vs->curRect.bottom = charHeight;
52- msg++;
53+ msg2++;
54 }
55 vs->curRect.right += vs->curRect.left;
56 vs->curRect.bottom += vs->curRect.top;
57 vs->oldRect = vs->curRect;
58+
59+ int maxWidth = _screenWidth - vs->curRect.left;
60+ if (_charset->getStringWidth(0, msg) > maxWidth) {
61+ byte tmpBuf[384];
62+ memcpy(tmpBuf, msg, 384);
63+
64+ int len = resStrLen(msg);
65+ while (_charset->getStringWidth(0, tmpBuf) > maxWidth) {
66+ while(tmpBuf[len] != ' ')
67+ len--;
68+ tmpBuf[len] = 0;
69+ }
70+
71+ enqueueText(tmpBuf, vs->curRect.left, vs->curRect.top, color, vs->charset_nr, vs->center);
72+ enqueueText(msg + len, vs->curRect.left, vs->curRect.top + _verbLineSpacing, color, vs->charset_nr, vs->center);
73+ vs->curRect.bottom += _verbLineSpacing;
74+ } else {
75+ enqueueText(msg, vs->curRect.left, vs->curRect.top, color, vs->charset_nr, vs->center);
76+ }
77 }
78 }
79 #endif
80Index: engines/scumm/script_v8.cpp
81===================================================================
82--- engines/scumm/script_v8.cpp (revision 22289)
83+++ engines/scumm/script_v8.cpp (working copy)
84@@ -1148,12 +1148,7 @@
85 vs->charset_nr = pop();
86 break;
87 case 0xA7: // SO_VERB_LINE_SPACING Choose linespacing for verb
88- // FIXME - TODO
89- // Note: it seems that var596 stores the "line spacing". It is used by various
90- // scripts that place verbs for that.
91- // Also, var595 contains the vertical position at which to start placing verbs (330)
92- a = pop();
93- debug(0, "SO_VERB_LINE_SPACING %d: not yet implemented", a);
94+ _verbLineSpacing = pop();
95 break;
96 default:
97 error("o8_verbops: default case 0x%x", subOp);