1 | diff --git a/engines/illusions/duckman/duckman_credits.cpp b/engines/illusions/duckman/duckman_credits.cpp
|
---|
2 | index f6e7bee300..3a6f15a2fb 100644
|
---|
3 | --- a/engines/illusions/duckman/duckman_credits.cpp
|
---|
4 | +++ b/engines/illusions/duckman/duckman_credits.cpp
|
---|
5 | @@ -189,7 +189,9 @@ Common::Point DuckmanCredits::getItemPosition(int index) {
|
---|
6 |
|
---|
7 | void DuckmanCredits::charToWChar(char *text, uint16 *wtext, uint size) {
|
---|
8 | while (*text != 0 && size > 1) {
|
---|
9 | - *wtext++ = (byte)*text++;
|
---|
10 | + WRITE_LE_UINT16(wtext, (byte)*text);
|
---|
11 | + wtext++;
|
---|
12 | + text++;
|
---|
13 | --size;
|
---|
14 | }
|
---|
15 | *wtext++ = 0;
|
---|
16 | diff --git a/engines/illusions/menusystem.cpp b/engines/illusions/menusystem.cpp
|
---|
17 | index e4d230a167..afc458cf3e 100644
|
---|
18 | --- a/engines/illusions/menusystem.cpp
|
---|
19 | +++ b/engines/illusions/menusystem.cpp
|
---|
20 | @@ -443,7 +443,7 @@ uint BaseMenuSystem::drawMenuText(BaseMenu *menu) {
|
---|
21 | if (!_vm->_screenText->insertText(text, menu->_fontId, dimensions, textPt, flags, menu->_backgroundColor, menu->_borderColor, 0xFF, 0xFF, 0xFF, outTextPtr)) {
|
---|
22 | --lineCount;
|
---|
23 | for ( ; *outTextPtr; ++outTextPtr) {
|
---|
24 | - if (*outTextPtr == 13)
|
---|
25 | + if (*outTextPtr == CONSTANT_LE_16(13))
|
---|
26 | --lineCount;
|
---|
27 | }
|
---|
28 | }
|
---|
29 | @@ -606,16 +606,19 @@ MenuTextBuilder::MenuTextBuilder() : _pos(0) {
|
---|
30 |
|
---|
31 | void MenuTextBuilder::appendString(const Common::String &value) {
|
---|
32 | for (uint i = 0; i < value.size(); ++i) {
|
---|
33 | - _text[_pos++] = value[i];
|
---|
34 | + WRITE_LE_UINT16(&_text[_pos], value[i]);
|
---|
35 | + _pos++;
|
---|
36 | }
|
---|
37 | }
|
---|
38 |
|
---|
39 | void MenuTextBuilder::appendNewLine() {
|
---|
40 | - _text[_pos++] = '\r';
|
---|
41 | + WRITE_LE_UINT16(&_text[_pos], '\r');
|
---|
42 | + _pos++;
|
---|
43 | }
|
---|
44 |
|
---|
45 | void MenuTextBuilder::finalize() {
|
---|
46 | - _text[_pos] = '\0';
|
---|
47 | + WRITE_LE_UINT16(&_text[_pos], '\0');
|
---|
48 | + _pos++;
|
---|
49 | }
|
---|
50 |
|
---|
51 | // BaseMenuAction
|
---|
52 | diff --git a/engines/illusions/resources/fontresource.cpp b/engines/illusions/resources/fontresource.cpp
|
---|
53 | index 8d11e92b48..15e29a9537 100644
|
---|
54 | --- a/engines/illusions/resources/fontresource.cpp
|
---|
55 | +++ b/engines/illusions/resources/fontresource.cpp
|
---|
56 | @@ -67,11 +67,11 @@ void CharRange::load(byte *dataStart, Common::SeekableReadStream &stream) {
|
---|
57 | }
|
---|
58 |
|
---|
59 | CharInfo *CharRange::getCharInfo(uint16 c) {
|
---|
60 | - return &_charInfos[c - _firstChar];
|
---|
61 | + return &_charInfos[TO_LE_16(c) - _firstChar];
|
---|
62 | }
|
---|
63 |
|
---|
64 | bool CharRange::containsChar(uint16 c) {
|
---|
65 | - return c >= _firstChar && c <= _lastChar;
|
---|
66 | + return c >= _firstChar && TO_LE_16(c) <= _lastChar;
|
---|
67 | }
|
---|
68 |
|
---|
69 | // FontResource
|
---|
70 | diff --git a/engines/illusions/resources/talkresource.cpp b/engines/illusions/resources/talkresource.cpp
|
---|
71 | index 83ff98a9a7..9c9c525249 100644
|
---|
72 | --- a/engines/illusions/resources/talkresource.cpp
|
---|
73 | +++ b/engines/illusions/resources/talkresource.cpp
|
---|
74 | @@ -50,13 +50,6 @@ void TalkEntry::load(byte *dataStart, Common::SeekableReadStream &stream) {
|
---|
75 | _voiceName = dataStart + voiceNameOffs;
|
---|
76 | debug(0, "TalkEntry::load() _talkId: %08X; textOffs: %08X; tblOffs: %08X; voiceNameOffs: %08X",
|
---|
77 | _talkId, textOffs, tblOffs, voiceNameOffs);
|
---|
78 | -
|
---|
79 | -#if defined(SCUMM_BIG_ENDIAN)
|
---|
80 | - for (byte *ptr = (byte *)_text; ptr != _tblPtr; ptr += 2) {
|
---|
81 | - WRITE_UINT16(ptr, SWAP_BYTES_16(READ_UINT16(ptr)));
|
---|
82 | - }
|
---|
83 | -#endif
|
---|
84 | -
|
---|
85 | }
|
---|
86 |
|
---|
87 | // TalkResource
|
---|
88 | diff --git a/engines/illusions/textdrawer.cpp b/engines/illusions/textdrawer.cpp
|
---|
89 | index f626316066..82bd19cdbb 100644
|
---|
90 | --- a/engines/illusions/textdrawer.cpp
|
---|
91 | +++ b/engines/illusions/textdrawer.cpp
|
---|
92 | @@ -84,7 +84,7 @@ bool TextDrawer::wrapTextIntern(int16 x, int16 y, int16 maxWidth, int16 maxHeigh
|
---|
93 |
|
---|
94 | bool lineBreak = false;
|
---|
95 | bool done = false;
|
---|
96 | - bool hasChar13 = textHasChar(13);
|
---|
97 | + bool hasChar13 = textHasChar(CONSTANT_LE_16(13));
|
---|
98 |
|
---|
99 | uint16 *lineStartText = _text;
|
---|
100 | uint16 *currText = _text;
|
---|
101 | @@ -104,7 +104,7 @@ bool TextDrawer::wrapTextIntern(int16 x, int16 y, int16 maxWidth, int16 maxHeigh
|
---|
102 | currWordWidth += getCharWidth(*currText);
|
---|
103 | ++currText;
|
---|
104 | ++currWordLen;
|
---|
105 | - } while (*currText != 32 && *(currText - 1) != 32 && !hasChar13 && *currText != 13 && *currText);
|
---|
106 | + } while (*currText != CONSTANT_LE_16(32) && *(currText - 1) != CONSTANT_LE_16(32) && !hasChar13 && *currText != CONSTANT_LE_16(13) && *currText);
|
---|
107 |
|
---|
108 | if (currWordWidth - _font->_widthC > maxWidth) {
|
---|
109 | while (currWordWidth + currLineWidth - _font->_widthC > maxWidth) {
|
---|
110 | @@ -120,7 +120,7 @@ bool TextDrawer::wrapTextIntern(int16 x, int16 y, int16 maxWidth, int16 maxHeigh
|
---|
111 | } else {
|
---|
112 | currLineWidth += currWordWidth;
|
---|
113 | currLineLen += currWordLen;
|
---|
114 | - if (*currText == 0 || *currText == 13)
|
---|
115 | + if (*currText == CONSTANT_LE_16(0) || *currText == CONSTANT_LE_16(13))
|
---|
116 | lineBreak = true;
|
---|
117 | if (lineBreak) {
|
---|
118 | currWordLen = 0;
|
---|
119 | @@ -146,13 +146,13 @@ bool TextDrawer::wrapTextIntern(int16 x, int16 y, int16 maxWidth, int16 maxHeigh
|
---|
120 |
|
---|
121 | _textLines.push_back(TextLine(lineStartText, currLineLen, textPosX, textPosY));
|
---|
122 |
|
---|
123 | - if (*currText == 13) {
|
---|
124 | + if (*currText == CONSTANT_LE_16(13)) {
|
---|
125 | ++currText;
|
---|
126 | - if (*currText == 10)
|
---|
127 | + if (*currText == CONSTANT_LE_16(10))
|
---|
128 | ++currText;
|
---|
129 | - while (*currText == 13) {
|
---|
130 | + while (*currText == CONSTANT_LE_16(13)) {
|
---|
131 | ++currText;
|
---|
132 | - if (*currText == 10)
|
---|
133 | + if (*currText == CONSTANT_LE_16(10))
|
---|
134 | ++currText;
|
---|
135 | _textLines.push_back(TextLine());
|
---|
136 | textPosY += _font->_lineIncr + _font->_charHeight;
|
---|
137 | @@ -160,7 +160,7 @@ bool TextDrawer::wrapTextIntern(int16 x, int16 y, int16 maxWidth, int16 maxHeigh
|
---|
138 | lineStartText = currText;
|
---|
139 | } else {
|
---|
140 | lineStartText = currText - currWordLen;
|
---|
141 | - if (*lineStartText == 32) {
|
---|
142 | + if (*lineStartText == CONSTANT_LE_16(32)) {
|
---|
143 | ++lineStartText;
|
---|
144 | --currWordLen;
|
---|
145 | currWordWidth -= spaceWidth;
|
---|
146 | @@ -205,7 +205,7 @@ bool TextDrawer::textHasChar(uint16 c) {
|
---|
147 | }
|
---|
148 |
|
---|
149 | int16 TextDrawer::getSpaceWidth() {
|
---|
150 | - return getCharWidth(32);
|
---|
151 | + return getCharWidth(CONSTANT_LE_16(32));
|
---|
152 | }
|
---|
153 |
|
---|
154 | int16 TextDrawer::getCharWidth(uint16 c) {
|
---|