fix for bug #2040484: TOUCHE: Graphic glitch with long answer options

svn-id: r33691
This commit is contained in:
Gregory Montoir 2008-08-07 21:50:12 +00:00
parent 303333352a
commit 52650efb6a
4 changed files with 16 additions and 7 deletions

View File

@ -76,10 +76,13 @@ int Graphics::getCharWidth16(uint8 chr) {
return chrData[2];
}
void Graphics::drawString16(uint8 *dst, int dstPitch, uint16 color, int x, int y, const char *str) {
void Graphics::drawString16(uint8 *dst, int dstPitch, uint16 color, int x, int y, const char *str, int xmax) {
while (*str) {
uint8 chr = (uint8)*str++;
x += drawChar16(dst, dstPitch, chr, x, y, color);
if (xmax != 0 && x > xmax) {
break;
}
}
}

View File

@ -40,7 +40,7 @@ public:
static void setupFont(Common::Language language);
static int getStringWidth16(const char *str);
static int getCharWidth16(uint8 chr);
static void drawString16(uint8 *dst, int dstPitch, uint16 color, int x, int y, const char *str);
static void drawString16(uint8 *dst, int dstPitch, uint16 color, int x, int y, const char *str, int xmax = 0);
static int drawChar16(uint8 *dst, int dstPitch, uint8 chr, int x, int y, uint16 color);
static void fillRect(uint8 *dst, int dstPitch, int x, int y, int w, int h, uint8 color);
static void drawRect(uint8 *dst, int dstPitch, int x, int y, int w, int h, uint8 color1, uint8 color2);

View File

@ -1248,10 +1248,11 @@ int ToucheEngine::getStringWidth(int num) const {
return Graphics::getStringWidth16(str);
}
void ToucheEngine::drawString(uint16 color, int x, int y, int16 num) {
void ToucheEngine::drawString(uint16 color, int x, int y, int16 num, StringType strType) {
const int xmax = (_language == Common::ES_ESP && strType == kStringTypeConversation) ? kScreenWidth - 20 : 0;
if (num) {
const char *str = getString(num);
Graphics::drawString16(_offscreenBuffer, kScreenWidth, color, x, y, str);
Graphics::drawString16(_offscreenBuffer, kScreenWidth, color, x, y, str, xmax);
}
}
@ -2414,7 +2415,7 @@ void ToucheEngine::drawCharacterConversation() {
}
drawConversationPanel();
for (int i = 0; i < 4; ++i) {
drawString(214, 42, 328 + i * kTextHeight, _conversationChoicesTable[_scrollConversationChoiceOffset + i].msg);
drawString(214, 42, 328 + i * kTextHeight, _conversationChoicesTable[_scrollConversationChoiceOffset + i].msg, kStringTypeConversation);
}
updateScreenArea(0, 320, kScreenWidth, kScreenHeight - 320);
_conversationAreaCleared = false;
@ -2422,7 +2423,7 @@ void ToucheEngine::drawCharacterConversation() {
void ToucheEngine::drawConversationString(int num, uint16 color) {
const int y = 328 + num * kTextHeight;
drawString(color, 42, y, _conversationChoicesTable[num + _scrollConversationChoiceOffset].msg);
drawString(color, 42, y, _conversationChoicesTable[num + _scrollConversationChoiceOffset].msg, kStringTypeConversation);
updateScreenArea(0, y, kScreenWidth, kTextHeight);
}

View File

@ -331,6 +331,11 @@ enum {
kMaxSaveStates = 100
};
enum StringType {
kStringTypeDefault,
kStringTypeConversation
};
class MidiPlayer;
class ToucheEngine: public Engine {
@ -399,7 +404,7 @@ protected:
void setKeyCharMoney();
const char *getString(int num) const;
int getStringWidth(int num) const;
void drawString(uint16 color, int x, int y, int16 num);
void drawString(uint16 color, int x, int y, int16 num, StringType strType = kStringTypeDefault);
void drawGameString(uint16 color, int x1, int y, const char *str);
int restartKeyCharScriptOnAction(int action, int obj1, int obj2);
void buildSpriteScalingTable(int z1, int z2);