[Scummvm-cvs-logs] CVS: scummvm/queen command.cpp,1.73,1.74 command.h,1.20,1.21 journal.cpp,1.35,1.36 logic.cpp,1.197,1.198 talk.cpp,1.96,1.97 talk.h,1.32,1.33
Gregory Montoir
cyx at users.sourceforge.net
Sat Apr 3 10:12:03 CEST 2004
- Previous message: [Scummvm-cvs-logs] CVS: scummvm/scumm string.cpp,1.209,1.210
- Next message: [Scummvm-cvs-logs] CVS: scummvm/scumm saveload.cpp,1.149,1.150 script_v2.cpp,2.244,2.245 script_v5.cpp,1.233,1.234 script_v6.cpp,1.326,1.327 script_v6he.cpp,2.41,2.42 script_v8.cpp,2.244,2.245 scumm.cpp,1.15,1.16 scumm.h,1.391,1.392 string.cpp,1.210,1.211
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/scummvm/scummvm/queen
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13226/queen
Modified Files:
command.cpp command.h journal.cpp logic.cpp talk.cpp talk.h
Log Message:
patch #910779 (with minor tweaks), fotaq hebrew support :
- reversed button captions in journal
- reversed command text in pinnacle room
- reverse order of lines in dialogue chooser
thanks Ori Avtalion !
Index: command.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/command.cpp,v
retrieving revision 1.73
retrieving revision 1.74
diff -u -d -r1.73 -r1.74
--- command.cpp 14 Mar 2004 13:26:01 -0000 1.73
+++ command.cpp 3 Apr 2004 17:58:58 -0000 1.74
@@ -35,16 +35,21 @@
namespace Queen {
+CmdText::CmdText(bool reversed, uint8 y, QueenEngine *vm)
+ : _isReversed(reversed), _y(y), _vm(vm) {
+ clear();
+}
+
void CmdText::clear() {
memset(_command, 0, sizeof(_command));
}
void CmdText::display(uint8 color) {
_vm->display()->textCurrentColor(color);
- _vm->display()->setTextCentered(COMMAND_Y_POS, _command, false);
+ _vm->display()->setTextCentered(_y, _command, false);
}
-void CmdText::displayTemp(uint8 color, Verb v, const char *name) {
+void CmdText::displayTemp(uint8 color, Verb v, const char *name, bool outlined) {
char temp[MAX_COMMAND_LEN] = "";
if (_isReversed) {
if (name != NULL)
@@ -58,17 +63,17 @@
}
}
_vm->display()->textCurrentColor(color);
- _vm->display()->setTextCentered(COMMAND_Y_POS, temp, false);
+ _vm->display()->setTextCentered(_y, temp, outlined);
}
-void CmdText::displayTemp(uint8 color, const char *name) {
+void CmdText::displayTemp(uint8 color, const char *name, bool outlined) {
char temp[MAX_COMMAND_LEN];
if (_isReversed)
sprintf(temp, "%s %s", name, _command);
else
sprintf(temp, "%s %s", _command, name);
_vm->display()->textCurrentColor(color);
- _vm->display()->setTextCentered(COMMAND_Y_POS, temp, false);
+ _vm->display()->setTextCentered(_y, temp, outlined);
}
void CmdText::setVerb(Verb v) {
@@ -117,9 +122,7 @@
}
Command::Command(QueenEngine *vm)
- : _vm(vm) {
- _cmdText._isReversed = (vm->resource()->getLanguage() == HEBREW);
- _cmdText._vm = vm;
+ : _cmdText((vm->resource()->getLanguage() == HEBREW), CmdText::COMMAND_Y_POS, vm), _vm(vm) {
}
void Command::clear(bool clearTexts) {
Index: command.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/command.h,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -d -r1.20 -r1.21
--- command.h 14 Mar 2004 00:53:24 -0000 1.20
+++ command.h 3 Apr 2004 17:58:58 -0000 1.21
@@ -32,10 +32,12 @@
struct CmdText {
+ CmdText(bool reversed, uint8 y, QueenEngine *vm);
+
void clear();
void display(uint8 color);
- void displayTemp(uint8 color, Verb v, const char *name = NULL);
- void displayTemp(uint8 color, const char *name);
+ void displayTemp(uint8 color, Verb v, const char *name = NULL, bool outlined = false);
+ void displayTemp(uint8 color, const char *name, bool outlined = false);
void setVerb(Verb v);
void addLinkWord(Verb v);
void addObject(const char *objName);
@@ -46,6 +48,7 @@
COMMAND_Y_POS = 151
};
+ uint8 _y;
bool _isReversed;
char _command[MAX_COMMAND_LEN];
QueenEngine *_vm;
Index: journal.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/journal.cpp,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -d -r1.35 -r1.36
--- journal.cpp 25 Mar 2004 21:40:35 -0000 1.35
+++ journal.cpp 3 Apr 2004 17:58:58 -0000 1.36
@@ -353,8 +353,13 @@
_panelTextY[_panelTextCount++] = y;
} else {
*p++ = '\0';
- drawPanelText(y - 5, s);
- drawPanelText(y + 5, p);
+ if (_vm->resource()->getLanguage() == HEBREW) {
+ drawPanelText(y - 5, p);
+ drawPanelText(y + 5, s);
+ } else {
+ drawPanelText(y - 5, s);
+ drawPanelText(y + 5, p);
+ }
}
}
Index: logic.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/logic.cpp,v
retrieving revision 1.197
retrieving revision 1.198
diff -u -d -r1.197 -r1.198
--- logic.cpp 26 Mar 2004 18:00:13 -0000 1.197
+++ logic.cpp 3 Apr 2004 17:58:58 -0000 1.198
@@ -1196,10 +1196,11 @@
_vm->update();
_vm->display()->palFadeIn(0, 223, ROOM_JUNGLE_PINNACLE, joe->active, joe->x, joe->y);
- _vm->display()->textCurrentColor(INK_PINNACLE_ROOM);
_entryObj = 0;
uint16 prevObj = 0;
+ CmdText cmdText((_vm->resource()->getLanguage() == HEBREW), 5, _vm);
+ cmdText.setVerb(VERB_WALK_TO);
while (_vm->input()->mouseButton() == 0 || _entryObj == 0) {
_vm->update();
@@ -1222,9 +1223,7 @@
ObjectData *objData = objectData(curObj);
if (objData->name > 0) {
_entryObj = objData->entryObj;
- char textCmd[CmdText::MAX_COMMAND_LEN];
- sprintf(textCmd, "%s %s", verbName(VERB_WALK_TO), objectName(objData->name));
- _vm->display()->setTextCentered(5, textCmd);
+ cmdText.displayTemp(INK_PINNACLE_ROOM, objectName(objData->name), true);
}
prevObj = curObj;
}
Index: talk.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/talk.cpp,v
retrieving revision 1.96
retrieving revision 1.97
diff -u -d -r1.96 -r1.97
--- talk.cpp 23 Mar 2004 20:34:19 -0000 1.96
+++ talk.cpp 3 Apr 2004 17:58:58 -0000 1.97
@@ -1185,15 +1185,69 @@
int Talk::splitOption(const char *str, char optionText[5][MAX_STRING_SIZE]) {
debug(6, "Talk::splitOption(%s)", str);
- // Check to see if option fits on one line, and exit early
+ int lines;
+ memset(optionText, 0, 5 * MAX_STRING_SIZE);
if (_vm->resource()->getLanguage() == ENGLISH ||
_vm->display()->textWidth(str) <= MAX_TEXT_WIDTH) {
strcpy(optionText[0], str);
- return 1;
+ lines = 1;
+ } else if (_vm->resource()->getLanguage() == HEBREW) {
+ lines = splitOptionHebrew(str, optionText);
+ } else {
+ lines = splitOptionDefault(str, optionText);
+ }
+ return lines;
+}
+
+int Talk::splitOptionHebrew(const char *str, char optionText[5][MAX_STRING_SIZE]) {
+ char tmpString[MAX_STRING_SIZE] = "";
+ uint16 len = 0;
+ uint16 spaceCharWidth = _vm->display()->textWidth(" ");
+ uint16 width = 0;
+ uint16 optionLines = 0;
+ uint16 maxTextLen = MAX_TEXT_WIDTH;
+ char *p = strchr(str, '\0');
+ while (p != str - 1) {
+ while (*p != ' ' && p != str - 1) {
+ --p;
+ ++len;
+ }
+ if (p != str - 1) {
+ uint16 wordWidth = _vm->display()->textWidth(p, len);
+ width += wordWidth;
+ if (width > maxTextLen) {
+ ++optionLines;
+ strncpy(optionText[optionLines], p, len);
+ optionText[optionLines][len] = '\0';
+ width = wordWidth;
+ maxTextLen = MAX_TEXT_WIDTH - OPTION_TEXT_MARGIN;
+ } else {
+ strcpy(tmpString, optionText[optionLines]);
+ strncpy(optionText[optionLines], p, len);
+ optionText[optionLines][len] = '\0';
+ strcat(optionText[optionLines], tmpString);
+ }
+ --p;
+ len = 1;
+ width += spaceCharWidth;
+ } else {
+ if (len > 1) {
+ if (width + _vm->display()->textWidth(p + 1, len) > maxTextLen) {
+ ++optionLines;
+ }
+ strcpy(tmpString, optionText[optionLines]);
+ strncpy(optionText[optionLines], p + 1, len);
+ optionText[optionLines][len] = '\0';
+ strcat(optionText[optionLines], tmpString);
+ }
+ ++optionLines;
+ }
}
+ return optionLines;
+}
+int Talk::splitOptionDefault(const char *str, char optionText[5][MAX_STRING_SIZE]) {
// Split up multiple line option at closest space character
- memset(optionText, 0, 5 * MAX_STRING_SIZE);
uint16 spaceCharWidth = _vm->display()->textWidth(" ");
uint16 width = 0;
uint16 optionLines = 0;
@@ -1205,7 +1259,7 @@
uint16 len = p - str;
uint16 wordWidth = _vm->display()->textWidth(str, len);
width += wordWidth;
- if (width> maxTextLen) {
+ if (width > maxTextLen) {
++optionLines;
strncpy(optionText[optionLines], str, len + 1);
width = wordWidth;
Index: talk.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/talk.h,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -d -r1.32 -r1.33
--- talk.h 17 Mar 2004 14:10:51 -0000 1.32
+++ talk.h 3 Apr 2004 17:58:58 -0000 1.33
@@ -238,7 +238,10 @@
int faceDirection);
int splitOption(const char *str, char optionText[5][MAX_STRING_SIZE]);
+
+ int splitOptionHebrew(const char *str, char optionText[5][MAX_STRING_SIZE]);
+ int splitOptionDefault(const char *str, char optionText[5][MAX_STRING_SIZE]);
};
- Previous message: [Scummvm-cvs-logs] CVS: scummvm/scumm string.cpp,1.209,1.210
- Next message: [Scummvm-cvs-logs] CVS: scummvm/scumm saveload.cpp,1.149,1.150 script_v2.cpp,2.244,2.245 script_v5.cpp,1.233,1.234 script_v6.cpp,1.326,1.327 script_v6he.cpp,2.41,2.42 script_v8.cpp,2.244,2.245 scumm.cpp,1.15,1.16 scumm.h,1.391,1.392 string.cpp,1.210,1.211
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Scummvm-git-logs
mailing list