aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTravis Howell2006-04-07 01:46:43 +0000
committerTravis Howell2006-04-07 01:46:43 +0000
commit38bf0af540fcdefa2844666734026c8bf47a989b (patch)
treeda91c262fdc852eb0f7bf8582d460f707094eef8
parent15cc2e628d4831c6c2ff4478b7549121dc444c9c (diff)
downloadscummvm-rg350-38bf0af540fcdefa2844666734026c8bf47a989b.tar.gz
scummvm-rg350-38bf0af540fcdefa2844666734026c8bf47a989b.tar.bz2
scummvm-rg350-38bf0af540fcdefa2844666734026c8bf47a989b.zip
Add some work on text output in FF
svn-id: r21656
-rw-r--r--engines/simon/charset.cpp39
-rw-r--r--engines/simon/items.cpp29
-rw-r--r--engines/simon/module.mk1
-rw-r--r--engines/simon/simon.cpp94
-rw-r--r--engines/simon/simon.h16
-rw-r--r--engines/simon/string.cpp311
-rw-r--r--engines/simon/verb.cpp71
7 files changed, 398 insertions, 163 deletions
diff --git a/engines/simon/charset.cpp b/engines/simon/charset.cpp
index dea54a41a6..50563177de 100644
--- a/engines/simon/charset.cpp
+++ b/engines/simon/charset.cpp
@@ -89,7 +89,7 @@ void SimonEngine::print_char_helper_6(uint i) {
}
}
-void SimonEngine::render_string_amiga(uint vga_sprite_id, uint color, uint width, uint height, const char *txt) {
+void SimonEngine::renderStringAmiga(uint vga_sprite_id, uint color, uint width, uint height, const char *txt) {
VgaPointersEntry *vpe = &_vgaBufferPointers[2];
byte *src, *dst, *dst_org, chr;
uint count;
@@ -180,9 +180,10 @@ void SimonEngine::render_string_amiga(uint vga_sprite_id, uint color, uint width
}
}
-void SimonEngine::render_string(uint vga_sprite_id, uint color, uint width, uint height, const char *txt) {
+void SimonEngine::renderString(uint vga_sprite_id, uint color, uint width, uint height, const char *txt) {
VgaPointersEntry *vpe = &_vgaBufferPointers[2];
byte *src, *dst, *p, *dst_org, chr;
+ const int textHeight = (getGameType() == GType_FF) ? 15: 10;
uint count;
if (vga_sprite_id >= 100) {
@@ -198,10 +199,15 @@ void SimonEngine::render_string(uint vga_sprite_id, uint color, uint width, uint
p = dst + vga_sprite_id * 8;
- WRITE_BE_UINT16(p + 4, height);
- WRITE_BE_UINT16(p + 6, width);
-
- dst += READ_BE_UINT32(p);
+ if (getGameType() == GType_FF) {
+ WRITE_LE_UINT16(p + 4, height);
+ WRITE_LE_UINT16(p + 6, width);
+ dst += READ_LE_UINT32(p);
+ } else {
+ WRITE_BE_UINT16(p + 4, height);
+ WRITE_BE_UINT16(p + 6, width);
+ dst += READ_BE_UINT32(p);
+ }
memset(dst, 0, count);
if (_language == Common::HB_ISR)
@@ -210,15 +216,26 @@ void SimonEngine::render_string(uint vga_sprite_id, uint color, uint width, uint
dst_org = dst;
while ((chr = *txt++) != 0) {
if (chr == 10) {
- dst_org += width * 10;
+ dst_org += width * textHeight;
dst = dst_org;
} else if ((chr -= ' ') == 0) {
dst += (_language == Common::HB_ISR ? -6 : 6); // Hebrew moves to the left, all others to the right
} else {
- byte *img_hdr = src + 48 + chr * 4;
- uint img_height = img_hdr[2];
- uint img_width = img_hdr[3], i;
- byte *img = src + READ_LE_UINT16(img_hdr);
+ byte *img_hdr, *img;
+ uint i, img_width, img_height;
+
+ if (getGameType() == GType_FF) {
+ img_hdr = src + 96 + chr * 8;
+ img_height = READ_LE_UINT16(img_hdr + 4);
+ img_width = READ_LE_UINT16(img_hdr + 6);
+ img = src + READ_LE_UINT32(img_hdr);
+ } else {
+ img_hdr = src + 48 + chr * 4;
+ img_height = img_hdr[2];
+ img_width = img_hdr[3];
+ img = src + READ_LE_UINT16(img_hdr);
+ }
+
if (_language == Common::HB_ISR)
dst -= img_width - 1; // For Hebrew, move from right edge to left edge of image.
byte *cur_dst = dst;
diff --git a/engines/simon/items.cpp b/engines/simon/items.cpp
index 2ac85484d3..386f656227 100644
--- a/engines/simon/items.cpp
+++ b/engines/simon/items.cpp
@@ -1255,7 +1255,7 @@ void SimonEngine::o1_scnTxtLongText(bool &cond, int &ret) {
if (_speech && speechId != 0)
playSpeech(speechId, vgaSpriteId);
if (string_ptr != NULL && _subtitles)
- printText(vgaSpriteId, color, string_ptr, tl->x, tl->y, tl->width);
+ printScreenText(vgaSpriteId, color, string_ptr, tl->x, tl->y, tl->width);
}
void SimonEngine::o1_mouseOn(bool &cond, int &ret) {
@@ -1318,7 +1318,14 @@ void SimonEngine::o2_printLongText(bool &cond, int &ret) {
void SimonEngine::o2_rescan(bool &cond, int &ret) {
// 83: restart subroutine
- o_83_helper();
+ if (_exitCutscene) {
+ if (getBitFlag(9)) {
+ endCutscene();
+ }
+ } else {
+ processSpecialKeys();
+ }
+
ret = -10;
}
@@ -1379,9 +1386,9 @@ void SimonEngine::o3_jumpOut(bool &cond, int &ret) {
void SimonEngine::o3_printLongText(bool &cond, int &ret) {
// 70: show string from array
- int tmp = getVarOrByte();
- const char *str = (const char *)getStringPtrByID(_stringIdArray3[tmp]);
- showMessageFormat("%d. %s\n", tmp, str);
+ int num = getVarOrByte();
+ const char *str = (const char *)getStringPtrByID(_stringIdArray3[num]);
+ printInteractText(num, str);
}
void SimonEngine::o3_oracleTextDown(bool &cond, int &ret) {
@@ -1644,16 +1651,6 @@ bool SimonEngine::checkIfToRunSubroutineLine(SubroutineLine *sl, Subroutine *sub
return true;
}
-void SimonEngine::o_83_helper() {
- if (_exitCutscene) {
- if (getBitFlag(9)) {
- endCutscene();
- }
- } else {
- processSpecialKeys();
- }
-}
-
void SimonEngine::o_waitForMark(uint i) {
_exitCutscene = false;
while (!(_marks & (1 << i))) {
@@ -1781,7 +1778,7 @@ void SimonEngine::o_inventory_descriptions() {
string_ptr = buf;
}
if (string_ptr != NULL)
- printText(vgaSpriteId, color, string_ptr, tl->x, tl->y, tl->width);
+ printScreenText(vgaSpriteId, color, string_ptr, tl->x, tl->y, tl->width);
}
}
diff --git a/engines/simon/module.mk b/engines/simon/module.mk
index ef347080e8..3af9057f63 100644
--- a/engines/simon/module.mk
+++ b/engines/simon/module.mk
@@ -15,6 +15,7 @@ MODULE_OBJS := \
saveload.o \
simon.o \
sound.o \
+ string.o \
verb.o \
vga.o \
diff --git a/engines/simon/simon.cpp b/engines/simon/simon.cpp
index 906bdb578b..39b75609f9 100644
--- a/engines/simon/simon.cpp
+++ b/engines/simon/simon.cpp
@@ -252,6 +252,7 @@ SimonEngine::SimonEngine(OSystem *syst)
_speech = true;
_subtitles = true;
_fade = true;
+ _animatePointer = 0;
_mouseCursor = 0;
_mouseAnim = 0;
_mouseAnimMax = 0;
@@ -444,6 +445,7 @@ SimonEngine::SimonEngine(OSystem *syst)
_saveLoadFlag = false;
_hyperLink = 0;
+ _interactY = 0;
_oracleMaxScrollY = 0;
_noOracleScroll = 0;
@@ -1586,7 +1588,7 @@ void SimonEngine::setup_cond_c_helper() {
animMax = 9;
}
- //_animatePointer = 0;
+ _animatePointer = 0;
_mouseCursor = cursor;
_mouseAnimMax = animMax;
_mouseAnim = 1;
@@ -2151,7 +2153,7 @@ void SimonEngine::o_printStr() {
o_kill_sprite_simon2(2, vgaSpriteId + 2);
if (string_ptr != NULL && (speech_id == 0 || _subtitles))
- printText(vgaSpriteId, color, (const char *)string_ptr, tl->x, tl->y, tl->width);
+ printScreenText(vgaSpriteId, color, (const char *)string_ptr, tl->x, tl->y, tl->width);
}
@@ -3345,94 +3347,6 @@ void SimonEngine::playSpeech(uint speech_id, uint vgaSpriteId) {
}
}
-void SimonEngine::printText(uint vgaSpriteId, uint color, const char *string, int16 x, int16 y, int16 width) {
- // FIXME
- if (getGameType() == GType_FF)
- return;
-
- char convertedString[320];
- char *convertedString2 = convertedString;
- int16 height, talkDelay;
- int stringLength = strlen(string);
- int padding, lettersPerRow, lettersPerRowJustified;
- const int textHeight = 10;
-
- height = textHeight;
- lettersPerRow = width / 6;
- lettersPerRowJustified = stringLength / (stringLength / lettersPerRow + 1) + 1;
-
- talkDelay = (stringLength + 3) / 3;
- if ((getGameType() == GType_SIMON1) && (getFeatures() & GF_TALKIE)) {
- if (_variableArray[141] == 0)
- _variableArray[141] = 9;
- _variableArray[85] = _variableArray[141] * talkDelay;
- } else {
- if (_variableArray[86] == 0)
- talkDelay /= 2;
- if (_variableArray[86] == 2)
- talkDelay *= 2;
- _variableArray[85] = talkDelay * 5;
- }
-
- assert(stringLength > 0);
- while (stringLength > 0) {
- int pos = 0;
- if (stringLength > lettersPerRow) {
- int removeLastWord = 0;
- if (lettersPerRow > lettersPerRowJustified) {
- pos = lettersPerRowJustified;
- while (string[pos] != ' ')
- pos++;
- if (pos > lettersPerRow)
- removeLastWord = 1;
- }
- if (lettersPerRow <= lettersPerRowJustified || removeLastWord) {
- pos = lettersPerRow;
- while (string[pos] != ' ' && pos > 0)
- pos--;
- }
- height += textHeight;
- y -= textHeight;
- } else
- pos = stringLength;
- padding = (lettersPerRow - pos) % 2 ?
- (lettersPerRow - pos) / 2 + 1 : (lettersPerRow - pos) / 2;
- while (padding--)
- *convertedString2++ = ' ';
- stringLength -= pos;
- while (pos--)
- *convertedString2++ = *string++;
- *convertedString2++ = '\n';
- string++; // skip space
- stringLength--; // skip space
- }
- *(convertedString2 - 1) = '\0';
-
- if (getGameType() == GType_SIMON1)
- o_kill_sprite_simon1(vgaSpriteId + 199);
- else
- o_kill_sprite_simon2(2, vgaSpriteId);
-
- color = color * 3 + 192;
- if (getPlatform() == Common::kPlatformAmiga)
- render_string_amiga(vgaSpriteId, color, width, height, convertedString);
- else
- render_string(vgaSpriteId, color, width, height, convertedString);
-
- int b = 4;
- if (!getBitFlag(133))
- b = 3;
-
- x /= 8;
- if (y < 2)
- y = 2;
-
- if (getGameType() == GType_SIMON1)
- loadSprite(b, 2, vgaSpriteId + 199, x, y, 12);
- else
- loadSprite(b, 2, vgaSpriteId, x, y, 12);
-}
-
// Thanks to Stuart Caie for providing the original
// C conversion upon which this decruncher is based.
diff --git a/engines/simon/simon.h b/engines/simon/simon.h
index 8c6b2042b2..d63abf15b8 100644
--- a/engines/simon/simon.h
+++ b/engines/simon/simon.h
@@ -259,6 +259,7 @@ protected:
bool _speech;
bool _subtitles;
bool _fade;
+ byte _animatePointer;
byte _mouseCursor;
byte _mouseAnim;
byte _mouseAnimMax;
@@ -273,7 +274,8 @@ protected:
uint16 _hyperLink, _newLines;
uint16 _oracleMaxScrollY, _noOracleScroll;
-
+ uint16 _interactY;
+
int16 _scriptVerb, _scriptNoun1, _scriptNoun2;
int16 _scriptAdj1, _scriptAdj2;
@@ -648,6 +650,7 @@ protected:
void printVerbOf(uint hitarea_id);
HitArea *findHitAreaByID(uint hitarea_id);
+ void printInteractText(uint16 num, const char *string);
void showActionString(const byte *string);
void videoPutchar(WindowBlock *window, byte c, byte b = 0);
void clearWindow(WindowBlock *window);
@@ -659,8 +662,8 @@ protected:
void setup_hitarea_from_pos(uint x, uint y, uint mode);
void displayName(HitArea * ha);
- bool printTextOf(uint a);
- bool printNameOf(Item *item);
+ bool printTextOf(uint a, uint x, uint y);
+ bool printNameOf(Item *item, uint x, uint y);
void displayBoxStars();
void hitarea_stuff();
@@ -695,11 +698,11 @@ protected:
void loadSprite(uint windowNum, uint vga_res, uint vga_sprite_id, uint x, uint y, uint palette);
void o_defineWindow(uint a, uint b, uint c, uint d, uint e, uint f, uint g, uint h);
void playSpeech(uint speech_id, uint vga_sprite_id);
- void printText(uint vga_sprite_id, uint color, const char *string_ptr, int16 x, int16 y, int16 width);
+ void printScreenText(uint vga_sprite_id, uint color, const char *string_ptr, int16 x, int16 y, int16 width);
WindowBlock *openWindow(uint x, uint y, uint w, uint h, uint flags, uint fill_color, uint text_color);
- void render_string_amiga(uint vga_sprite_id, uint color, uint width, uint height, const char *txt);
- void render_string(uint vga_sprite_id, uint color, uint width, uint height, const char *txt);
+ void renderStringAmiga(uint vga_sprite_id, uint color, uint width, uint height, const char *txt);
+ void renderString(uint vga_sprite_id, uint color, uint width, uint height, const char *txt);
void setArrowHitAreas(WindowBlock *window, uint num);
@@ -1082,7 +1085,6 @@ protected:
void delay(uint delay);
void pause();
- void o_83_helper();
void o_waitForMark(uint i);
void scrollEvent();
diff --git a/engines/simon/string.cpp b/engines/simon/string.cpp
new file mode 100644
index 0000000000..5a7e6b975f
--- /dev/null
+++ b/engines/simon/string.cpp
@@ -0,0 +1,311 @@
+/* ScummVM - Scumm Interpreter
+ * Copyright (C) 2001-2006 The ScummVM project
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * $URL$
+ * $Id$
+ *
+ */
+
+#include "common/stdafx.h"
+
+#include "simon/simon.h"
+#include "simon/intern.h"
+
+namespace Simon {
+
+static const byte charWidth[226] = {
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 6, 2, 4, 8, 6,10, 9, 2,
+ 4, 4, 6, 6, 3, 4, 2, 3, 6, 4,
+ 6, 6, 7, 6, 6, 6, 6, 6, 2, 3,
+ 7, 7, 7, 6,11, 8, 7, 8, 8, 7,
+ 6, 9, 8, 2, 6, 7, 6,10, 8, 9,
+ 7, 9, 7, 7, 8, 8, 8,12, 8, 8,
+ 7, 3, 3, 3, 6, 8, 3, 7, 7, 6,
+ 7, 7, 4, 7, 6, 2, 3, 6, 2,10,
+ 6, 7, 7, 7, 5, 6, 4, 7, 7,10,
+ 6, 6, 6, 0, 0, 0, 0, 0, 8, 6,
+ 7, 7, 7, 7, 7, 6, 7, 7, 7, 4,
+ 4, 3, 8, 8, 7, 0, 0, 7, 7, 7,
+ 6, 6, 6, 9, 8, 0, 0, 0, 0, 0,
+ 7, 3, 7, 6, 6, 8, 0, 6, 0, 0,
+ 0, 0, 0, 2, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 7
+};
+
+static int getPixelLength(const char *string, int16 width) {
+ int pixels = 0;
+ while (*string != 0) {
+ byte chr = *string;
+ if ((pixels + charWidth[chr]) > width)
+ break;
+ pixels += charWidth[chr];
+ }
+ return pixels;
+}
+
+bool SimonEngine::printTextOf(uint a, uint x, uint y) {
+ const byte *stringPtr;
+
+ if (getGameType() == GType_SIMON2) {
+ if (getBitFlag(79)) {
+ Subroutine *sub;
+ _variableArray[84] = a;
+ sub = getSubroutineByID(5003);
+ if (sub != NULL)
+ startSubroutineEx(sub);
+ return true;
+ }
+ }
+
+ if (a >= 20)
+ return false;
+
+
+ stringPtr = getStringPtrByID(_stringIdArray2[a]);
+ if (getGameType() == GType_FF) {
+ uint w = getPixelLength((const char *)stringPtr, 400) + 1;
+ x -= w / 2;
+ printScreenText(6, 0, (const char *)stringPtr, x, y, w);
+ } else {
+ showActionString(stringPtr);
+ }
+
+ return true;
+}
+
+bool SimonEngine::printNameOf(Item *item, uint x, uint y) {
+ SubObject *subObject;
+ const byte *stringPtr;
+
+ if (item == 0 || item == _dummyItem2 || item == _dummyItem3)
+ return false;
+
+ subObject = (SubObject *)findChildOfType(item, 2);
+ if (subObject == NULL)
+ return false;
+
+ stringPtr = getStringPtrByID(subObject->objectName);
+ if (getGameType() == GType_FF) {
+ uint w = getPixelLength((const char *)stringPtr, 400) + 1;
+ x -= w / 2;
+ printScreenText(6, 0, (const char *)stringPtr, x, y, w);
+ } else {
+ showActionString(stringPtr);
+ }
+
+ return true;
+}
+
+void SimonEngine::printInteractText(uint16 num, const char *string) {
+ printf("printInteractText: num %d, string %s\n", num, string);
+
+ char convertedString[320];
+ char *convertedString2 = convertedString;
+ const char *string2 = string;
+ uint16 height = 15;
+ uint16 w = 620;
+ uint16 b;
+ uint16 x;
+ int pixels = 0;
+
+ while (1) {
+ pixels = getPixelLength(string, 620);
+ string2 += pixels;
+ if (*string2 == 0x00) {
+ if (w == 620)
+ w = pixels;
+ strcpy(convertedString2, string);
+ break;
+ }
+ while (*string2 != ' ') {
+ byte chr = *string2;
+ pixels -= charWidth[chr];
+ string2--;
+ }
+ if (w == 620)
+ w = pixels;
+ b = string2 - string;
+ strncpy(convertedString2, string, b);
+ convertedString2 += b;
+ *convertedString2++ = '\n';
+ height += 15;
+ string = string2;
+ }
+
+ // ScrollX
+ x = _variableArray[251];
+ x += 20;
+
+ if (num == 1)
+ _interactY = 385;
+
+ // Returned values for box definition
+ _variableArray[51] = x;
+ _variableArray[52] = _interactY;
+ _variableArray[53] = w;
+ _variableArray[54] = height;
+
+ o_kill_sprite_simon2(2, num + 6);
+ renderString(num, 0, w, height, convertedString);
+ loadSprite(4, 2, num + 6, x, _interactY, 12);
+
+ _interactY += height;
+}
+
+void SimonEngine::printScreenText(uint vgaSpriteId, uint color, const char *string, int16 x, int16 y, int16 width) {
+ char convertedString[320];
+ char *convertedString2 = convertedString;
+ const char *string2 = string;
+ int16 height, talkDelay;
+ int stringLength = strlen(string);
+ int padding, lettersPerRow, lettersPerRowJustified;
+ const int textHeight = (getGameType() == GType_FF) ? 15: 10;
+
+ height = textHeight;
+ lettersPerRow = width / 6;
+ lettersPerRowJustified = stringLength / (stringLength / lettersPerRow + 1) + 1;
+
+ talkDelay = (stringLength + 3) / 3;
+ if ((getGameType() == GType_SIMON1) && (getFeatures() & GF_TALKIE)) {
+ if (_variableArray[141] == 0)
+ _variableArray[141] = 9;
+ _variableArray[85] = _variableArray[141] * talkDelay;
+ } else {
+ if (_variableArray[86] == 0)
+ talkDelay /= 2;
+ if (_variableArray[86] == 2)
+ talkDelay *= 2;
+ _variableArray[85] = talkDelay * 5;
+ }
+
+ assert(stringLength > 0);
+
+ if (getGameType() == GType_FF) {
+ uint16 b, spaces;
+ uint16 len = width, pixels = 0;
+
+ while (1) {
+ pixels = getPixelLength(string, len);
+ string2 += pixels;
+ if (*string2 == 0) {
+ spaces = (width - pixels) / 12;
+ if (spaces != 0)
+ spaces--;
+ while (spaces) {
+ *convertedString2++=' ';
+ spaces--;
+ }
+ strcpy(convertedString2, string);
+ break;
+ }
+ while (*string2 != ' ') {
+ byte chr = *string2;
+ pixels -= charWidth[chr];
+ string2--;
+ }
+ spaces = (width - pixels) / 12;
+ if (spaces != 0)
+ spaces--;
+ while (spaces) {
+ *convertedString2++ = ' ';
+ spaces--;
+ }
+ b = string2 - string;
+ strncpy(convertedString2, string, b);
+ convertedString2 += b;
+ *convertedString2++ = '\n';
+ height += textHeight;
+ y -= textHeight;
+ if (y < 2)
+ y = 2;
+ len = pixels;
+ string = string2;
+ }
+ } else {
+ while (stringLength > 0) {
+ int pos = 0;
+ if (stringLength > lettersPerRow) {
+ int removeLastWord = 0;
+ if (lettersPerRow > lettersPerRowJustified) {
+ pos = lettersPerRowJustified;
+ while (string[pos] != ' ')
+ pos++;
+ if (pos > lettersPerRow)
+ removeLastWord = 1;
+ }
+ if (lettersPerRow <= lettersPerRowJustified || removeLastWord) {
+ pos = lettersPerRow;
+ while (string[pos] != ' ' && pos > 0)
+ pos--;
+ }
+ height += textHeight;
+ y -= textHeight;
+ } else
+ pos = stringLength;
+ padding = (lettersPerRow - pos) % 2 ?
+ (lettersPerRow - pos) / 2 + 1 : (lettersPerRow - pos) / 2;
+ while (padding--)
+ *convertedString2++ = ' ';
+ stringLength -= pos;
+ while (pos--)
+ *convertedString2++ = *string++;
+ *convertedString2++ = '\n';
+ string++; // skip space
+ stringLength--; // skip space
+ }
+ *(convertedString2 - 1) = '\0';
+ }
+
+ if (getGameType() == GType_SIMON1)
+ o_kill_sprite_simon1(vgaSpriteId + 199);
+ else
+ o_kill_sprite_simon2(2, vgaSpriteId);
+
+ if (getGameType() == GType_FF) {
+ renderStringAmiga(1, color, width, height, convertedString);
+ } else {
+ color = color * 3 + 192;
+ if (getPlatform() == Common::kPlatformAmiga)
+ renderStringAmiga(vgaSpriteId, color, width, height, convertedString);
+ else
+ renderString(vgaSpriteId, color, width, height, convertedString);
+ }
+
+ int b = 4;
+ if (getGameType() == GType_SIMON1 || getGameType() == GType_SIMON2) {
+ if (!getBitFlag(133))
+ b = 3;
+
+ x /= 8;
+ if (y < 2)
+ y = 2;
+ }
+
+ if (getGameType() == GType_SIMON1)
+ loadSprite(b, 2, vgaSpriteId + 199, x, y, 12);
+ else
+ loadSprite(b, 2, vgaSpriteId, x, y, 12);
+}
+
+} // End of namespace Simon
diff --git a/engines/simon/verb.cpp b/engines/simon/verb.cpp
index f0aa72e012..293569220b 100644
--- a/engines/simon/verb.cpp
+++ b/engines/simon/verb.cpp
@@ -195,7 +195,7 @@ void SimonEngine::clearName() {
if (getGameType() == GType_FF) {
o_kill_sprite_simon2(2, 6);
_lastNameOn = NULL;
- //_animatePointer = 0;
+ _animatePointer = 0;
_mouseAnim = 1;
return;
}
@@ -692,51 +692,44 @@ void SimonEngine::setup_hitarea_from_pos(uint x, uint y, uint mode) {
void SimonEngine::displayName(HitArea *ha) {
bool result;
+ int x = 0, y = 0;
- resetNameWindow();
- if (ha->flags & kBFTextBox) {
- result = printTextOf(ha->flags / 256);
- } else {
- result = printNameOf(ha->item_ptr);
- }
-
- if (result)
- _lastNameOn = ha;
-}
-
-bool SimonEngine::printTextOf(uint a) {
- if (getGameType() == GType_SIMON2) {
- if (getBitFlag(79)) {
- Subroutine *sub;
- _variableArray[84] = a;
- sub = getSubroutineByID(5003);
- if (sub != NULL)
- startSubroutineEx(sub);
- return true;
+ if (getGameType() == GType_FF) {
+ if (ha->flags & kBFHyperBox) {
+ _lastNameOn = ha;
+ return;
}
- }
-
- if (a >= 20)
- return false;
-
- showActionString(getStringPtrByID(_stringIdArray2[a]));
-
- return true;
-}
+ if (findHitAreaByID(50))
+ return;
-bool SimonEngine::printNameOf(Item *item) {
- SubObject *child2;
+ if (getBitFlag(99))
+ _animatePointer = ((ha->flags & kBFTextBox) != 0);
+ else
+ _animatePointer = 1;
- if (item == 0 || item == _dummyItem2 || item == _dummyItem3)
- return false;
+ if (!getBitFlag(99))
+ return;
- child2 = (SubObject *)findChildOfType(item, 2);
- if (child2 == NULL)
- return false;
+ y = ha->y;
+ if (getBitFlag(99) && y > 288)
+ y = 288;
+ y -= 17;
+ if (y < 0)
+ y = 0;
+ y += 2;
+ x = ha->width / 2 + ha->x;
+ } else {
+ resetNameWindow();
+ }
- showActionString(getStringPtrByID(child2->objectName));
+ if (ha->flags & kBFTextBox) {
+ result = printTextOf(ha->flags / 256, x, y);
+ } else {
+ result = printNameOf(ha->item_ptr, x, y);
+ }
- return true;
+ if (result)
+ _lastNameOn = ha;
}
} // End of namespace Simon