aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorTravis Howell2006-04-07 03:03:20 +0000
committerTravis Howell2006-04-07 03:03:20 +0000
commit50983a3721dbd7c0cfee08cf9b7cac4d81588c27 (patch)
tree26e64d1fc0ca28ab7fbb070c4473cb2d18cdd38f /engines
parent26587faff789412721786c6276933624dda92557 (diff)
downloadscummvm-rg350-50983a3721dbd7c0cfee08cf9b7cac4d81588c27.tar.gz
scummvm-rg350-50983a3721dbd7c0cfee08cf9b7cac4d81588c27.tar.bz2
scummvm-rg350-50983a3721dbd7c0cfee08cf9b7cac4d81588c27.zip
Fix subtitle output in FF
svn-id: r21659
Diffstat (limited to 'engines')
-rw-r--r--engines/simon/items.cpp8
-rw-r--r--engines/simon/simon.h10
-rw-r--r--engines/simon/string.cpp35
-rw-r--r--engines/simon/verb.cpp4
4 files changed, 34 insertions, 23 deletions
diff --git a/engines/simon/items.cpp b/engines/simon/items.cpp
index 386f656227..5a9612fe9e 100644
--- a/engines/simon/items.cpp
+++ b/engines/simon/items.cpp
@@ -317,7 +317,7 @@ void SimonEngine::setupOpcodes() {
opcode_table[171] = &SimonEngine::o3_hyperLinkOn;
opcode_table[172] = &SimonEngine::o3_hyperLinkOff;
opcode_table[173] = &SimonEngine::o3_checkPaths;
- opcode_table[181] = &SimonEngine::o2_mouseOff;
+ opcode_table[181] = &SimonEngine::o3_mouseOff;
opcode_table[182] = &SimonEngine::o3_loadSmack;
opcode_table[183] = &SimonEngine::o3_playSmack;
opcode_table[185] = NULL;
@@ -1452,6 +1452,12 @@ void SimonEngine::o3_checkPaths(bool &cond, int &ret) {
warning("STUB: script opcode 173");
}
+void SimonEngine::o3_mouseOff(bool &cond, int &ret) {
+ // 181: force mouseOff
+ o_mouseOff();
+ clearName();
+}
+
void SimonEngine::o3_loadSmack(bool &cond, int &ret) {
// 182: load video file
debug(1,"Load video file: %s", getStringPtrByID(getNextStringID()));
diff --git a/engines/simon/simon.h b/engines/simon/simon.h
index d63abf15b8..382669506e 100644
--- a/engines/simon/simon.h
+++ b/engines/simon/simon.h
@@ -650,7 +650,6 @@ 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);
@@ -662,8 +661,6 @@ protected:
void setup_hitarea_from_pos(uint x, uint y, uint mode);
void displayName(HitArea * ha);
- bool printTextOf(uint a, uint x, uint y);
- bool printNameOf(Item *item, uint x, uint y);
void displayBoxStars();
void hitarea_stuff();
@@ -698,9 +695,13 @@ 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 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);
+ bool printTextOf(uint a, uint x, uint y);
+ bool printNameOf(Item *item, uint x, uint y);
+ void printInteractText(uint16 num, const char *string);
+ void printScreenText(uint vga_sprite_id, uint color, const char *string_ptr, int16 x, int16 y, int16 width);
+
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);
@@ -969,6 +970,7 @@ public:
void o3_hyperLinkOn(bool &cond, int &ret);
void o3_hyperLinkOff(bool &cond, int &ret);
void o3_checkPaths(bool &cond, int &ret);
+ void o3_mouseOff(bool &cond, int &ret);
void o3_loadSmack(bool &cond, int &ret);
void o3_playSmack(bool &cond, int &ret);
void o3_centreScroll(bool &cond, int &ret);
diff --git a/engines/simon/string.cpp b/engines/simon/string.cpp
index 1a9400e394..6382f2e433 100644
--- a/engines/simon/string.cpp
+++ b/engines/simon/string.cpp
@@ -53,19 +53,23 @@ static const byte charWidth[226] = {
0, 0, 0, 0, 0, 7
};
-static int getPixelLength(const char *string, int16 width) {
- int pixels = 0;
+const char *getPixelLength(const char *string, uint16 maxWidth, uint16 &pixels) {
+ pixels = 0;
+
while (*string != 0) {
byte chr = *string;
- if ((pixels + charWidth[chr]) > width)
+ if ((pixels + charWidth[chr]) > maxWidth)
break;
pixels += charWidth[chr];
+ string++;
}
- return pixels;
+
+ return string;
}
bool SimonEngine::printTextOf(uint a, uint x, uint y) {
const byte *stringPtr;
+ uint16 pixels, w;
if (getGameType() == GType_SIMON2) {
if (getBitFlag(79)) {
@@ -84,7 +88,8 @@ bool SimonEngine::printTextOf(uint a, uint x, uint y) {
stringPtr = getStringPtrByID(_stringIdArray2[a]);
if (getGameType() == GType_FF) {
- uint w = getPixelLength((const char *)stringPtr, 400) + 1;
+ getPixelLength((const char *)stringPtr, 400, pixels);
+ w = pixels + 1;
x -= w / 2;
printScreenText(6, 0, (const char *)stringPtr, x, y, w);
} else {
@@ -97,6 +102,7 @@ bool SimonEngine::printTextOf(uint a, uint x, uint y) {
bool SimonEngine::printNameOf(Item *item, uint x, uint y) {
SubObject *subObject;
const byte *stringPtr;
+ uint16 pixels, w;
if (item == 0 || item == _dummyItem2 || item == _dummyItem3)
return false;
@@ -107,7 +113,8 @@ bool SimonEngine::printNameOf(Item *item, uint x, uint y) {
stringPtr = getStringPtrByID(subObject->objectName);
if (getGameType() == GType_FF) {
- uint w = getPixelLength((const char *)stringPtr, 400) + 1;
+ getPixelLength((const char *)stringPtr, 400, pixels);
+ w = pixels + 1;
x -= w / 2;
printScreenText(6, 0, (const char *)stringPtr, x, y, w);
} else {
@@ -125,13 +132,10 @@ void SimonEngine::printInteractText(uint16 num, const char *string) {
const char *string2 = string;
uint16 height = 15;
uint16 w = 620;
- uint16 b;
- uint16 x;
- int pixels = 0;
+ uint16 b, pixels, x;
while (1) {
- pixels = getPixelLength(string, 620);
- string2 += pixels;
+ string2 = getPixelLength(string, 620, pixels);
if (*string2 == 0x00) {
if (w == 620)
w = pixels;
@@ -202,12 +206,11 @@ void SimonEngine::printScreenText(uint vgaSpriteId, uint color, const char *stri
assert(stringLength > 0);
if (getGameType() == GType_FF) {
- uint16 b, spaces;
- uint16 len = width, pixels = 0;
+ uint16 b, pixels, spaces;
+ uint16 curWdth = width;
while (1) {
- pixels = getPixelLength(string, len);
- string2 += pixels;
+ string2 = getPixelLength(string, curWdth, pixels);
if (*string2 == 0) {
spaces = (width - pixels) / 12;
if (spaces != 0)
@@ -239,7 +242,7 @@ void SimonEngine::printScreenText(uint vgaSpriteId, uint color, const char *stri
y -= textHeight;
if (y < 2)
y = 2;
- len = pixels;
+ curWdth = pixels;
string = string2;
}
} else {
diff --git a/engines/simon/verb.cpp b/engines/simon/verb.cpp
index 293569220b..1fa3aa54fc 100644
--- a/engines/simon/verb.cpp
+++ b/engines/simon/verb.cpp
@@ -707,8 +707,8 @@ void SimonEngine::displayName(HitArea *ha) {
else
_animatePointer = 1;
- if (!getBitFlag(99))
- return;
+ //if (!getBitFlag(73))
+ // return;
y = ha->y;
if (getBitFlag(99) && y > 288)