[Scummvm-cvs-logs] SF.net SVN: scummvm:[42120] scummvm/trunk/engines/gob
drmccoy at users.sourceforge.net
drmccoy at users.sourceforge.net
Sun Jul 5 13:26:43 CEST 2009
Revision: 42120
http://scummvm.svn.sourceforge.net/scummvm/?rev=42120&view=rev
Author: drmccoy
Date: 2009-07-05 11:26:42 +0000 (Sun, 05 Jul 2009)
Log Message:
-----------
Commenting prepareStr a bit and renaming it to cleanupStr
Modified Paths:
--------------
scummvm/trunk/engines/gob/game_v1.cpp
scummvm/trunk/engines/gob/game_v2.cpp
scummvm/trunk/engines/gob/game_v6.cpp
scummvm/trunk/engines/gob/inter.h
scummvm/trunk/engines/gob/inter_v1.cpp
scummvm/trunk/engines/gob/util.cpp
scummvm/trunk/engines/gob/util.h
Modified: scummvm/trunk/engines/gob/game_v1.cpp
===================================================================
--- scummvm/trunk/engines/gob/game_v1.cpp 2009-07-05 11:26:23 UTC (rev 42119)
+++ scummvm/trunk/engines/gob/game_v1.cpp 2009-07-05 11:26:42 UTC (rev 42120)
@@ -928,7 +928,7 @@
strncpy0(_tempStr, GET_VARO_STR(_collisionAreas[i].key), 255);
if ((_collisionAreas[i].flags & 0x0F) < 7)
- _vm->_util->prepareStr(_tempStr);
+ _vm->_util->cleanupStr(_tempStr);
int16 pos = 0;
do {
@@ -938,7 +938,7 @@
str += strlen(str) + 1;
if ((_collisionAreas[i].flags & 0x0F) < 7)
- _vm->_util->prepareStr(_collStr);
+ _vm->_util->cleanupStr(_collStr);
if (strcmp(_tempStr, _collStr) == 0) {
WRITE_VAR(17, VAR(17) + 1);
Modified: scummvm/trunk/engines/gob/game_v2.cpp
===================================================================
--- scummvm/trunk/engines/gob/game_v2.cpp 2009-07-05 11:26:23 UTC (rev 42119)
+++ scummvm/trunk/engines/gob/game_v2.cpp 2009-07-05 11:26:42 UTC (rev 42120)
@@ -935,7 +935,7 @@
strncpy0(_tempStr, GET_VARO_STR(_collisionAreas[i].key), 255);
if ((_collisionAreas[i].flags & 0x0F) < 7)
- _vm->_util->prepareStr(_tempStr);
+ _vm->_util->cleanupStr(_tempStr);
int16 pos = 0;
do {
@@ -945,7 +945,7 @@
str += strlen(str) + 1;
if ((_collisionAreas[i].flags & 0x0F) < 7)
- _vm->_util->prepareStr(_collStr);
+ _vm->_util->cleanupStr(_collStr);
if (strcmp(_tempStr, _collStr) == 0) {
WRITE_VAR(17, VAR(17) + 1);
Modified: scummvm/trunk/engines/gob/game_v6.cpp
===================================================================
--- scummvm/trunk/engines/gob/game_v6.cpp 2009-07-05 11:26:23 UTC (rev 42119)
+++ scummvm/trunk/engines/gob/game_v6.cpp 2009-07-05 11:26:42 UTC (rev 42120)
@@ -839,7 +839,7 @@
strncpy0(_tempStr, GET_VARO_STR(_collisionAreas[i].key), 255);
if ((_collisionAreas[i].flags & 0x0F) < 7)
- _vm->_util->prepareStr(_tempStr);
+ _vm->_util->cleanupStr(_tempStr);
int16 pos = 0;
do {
@@ -849,7 +849,7 @@
str += strlen(str) + 1;
if ((_collisionAreas[i].flags & 0x0F) < 7)
- _vm->_util->prepareStr(_collStr);
+ _vm->_util->cleanupStr(_collStr);
if (strcmp(_tempStr, _collStr) == 0) {
WRITE_VAR(17, VAR(17) + 1);
Modified: scummvm/trunk/engines/gob/inter.h
===================================================================
--- scummvm/trunk/engines/gob/inter.h 2009-07-05 11:26:23 UTC (rev 42119)
+++ scummvm/trunk/engines/gob/inter.h 2009-07-05 11:26:42 UTC (rev 42120)
@@ -238,7 +238,7 @@
bool o1_playComposition(OpFuncParams ¶ms);
bool o1_getFreeMem(OpFuncParams ¶ms);
bool o1_checkData(OpFuncParams ¶ms);
- bool o1_prepareStr(OpFuncParams ¶ms);
+ bool o1_cleanupStr(OpFuncParams ¶ms);
bool o1_insertStr(OpFuncParams ¶ms);
bool o1_cutStr(OpFuncParams ¶ms);
bool o1_strstr(OpFuncParams ¶ms);
Modified: scummvm/trunk/engines/gob/inter_v1.cpp
===================================================================
--- scummvm/trunk/engines/gob/inter_v1.cpp 2009-07-05 11:26:23 UTC (rev 42119)
+++ scummvm/trunk/engines/gob/inter_v1.cpp 2009-07-05 11:26:42 UTC (rev 42120)
@@ -147,7 +147,7 @@
OPCODEFUNC(0x3E, o1_getFreeMem);
OPCODEFUNC(0x3F, o1_checkData);
- OPCODEFUNC(0x41, o1_prepareStr);
+ OPCODEFUNC(0x41, o1_cleanupStr);
OPCODEFUNC(0x42, o1_insertStr);
OPCODEFUNC(0x43, o1_cutStr);
@@ -1601,11 +1601,11 @@
return false;
}
-bool Inter_v1::o1_prepareStr(OpFuncParams ¶ms) {
+bool Inter_v1::o1_cleanupStr(OpFuncParams ¶ms) {
int16 strVar;
strVar = _vm->_game->_script->readVarIndex();
- _vm->_util->prepareStr(GET_VARO_FSTR(strVar));
+ _vm->_util->cleanupStr(GET_VARO_FSTR(strVar));
return false;
}
Modified: scummvm/trunk/engines/gob/util.cpp
===================================================================
--- scummvm/trunk/engines/gob/util.cpp 2009-07-05 11:26:23 UTC (rev 42119)
+++ scummvm/trunk/engines/gob/util.cpp 2009-07-05 11:26:42 UTC (rev 42120)
@@ -452,7 +452,7 @@
" ";
static const char trStr3[] = " ";
-void Util::prepareStr(char *str) {
+void Util::cleanupStr(char *str) {
char *start, *end;
char buf[300];
@@ -460,17 +460,20 @@
strcat(buf, trStr2);
strcat(buf, trStr3);
+ // Translating "wrong" characters
for (size_t i = 0; i < strlen(str); i++)
- str[i] = buf[str[i] - 32];
+ str[i] = buf[MIN<int>(str[i] - 32, 32)];
+ // Trim spaces left
while (str[0] == ' ')
cutFromStr(str, 0, 1);
+ // Trim spaces right
while ((strlen(str) > 0) && (str[strlen(str) - 1] == ' '))
cutFromStr(str, strlen(str) - 1, 1);
+ // Merge double spaces
start = strchr(str, ' ');
-
while (start) {
if (start[1] == ' ') {
cutFromStr(str, start - str, 1);
Modified: scummvm/trunk/engines/gob/util.h
===================================================================
--- scummvm/trunk/engines/gob/util.h 2009-07-05 11:26:23 UTC (rev 42119)
+++ scummvm/trunk/engines/gob/util.h 2009-07-05 11:26:42 UTC (rev 42120)
@@ -92,7 +92,7 @@
static void insertStr(const char *str1, char *str2, int16 pos);
static void cutFromStr(char *str, int16 from, int16 cutlen);
- static void prepareStr(char *str);
+ static void cleanupStr(char *str);
static void replaceChar(char *str, char c1, char c2);
static void listInsertFront(List *list, void *data);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list