[Scummvm-cvs-logs] SF.net SVN: scummvm:[44394] scummvm/trunk/engines/sci/engine/kstring.cpp
wjpalenstijn at users.sourceforge.net
wjpalenstijn at users.sourceforge.net
Sun Sep 27 13:14:01 CEST 2009
Revision: 44394
http://scummvm.svn.sourceforge.net/scummvm/?rev=44394&view=rev
Author: wjpalenstijn
Date: 2009-09-27 11:14:01 +0000 (Sun, 27 Sep 2009)
Log Message:
-----------
SCI: clean up kStrAt
Modified Paths:
--------------
scummvm/trunk/engines/sci/engine/kstring.cpp
Modified: scummvm/trunk/engines/sci/engine/kstring.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/kstring.cpp 2009-09-27 10:36:45 UTC (rev 44393)
+++ scummvm/trunk/engines/sci/engine/kstring.cpp 2009-09-27 11:14:01 UTC (rev 44394)
@@ -305,25 +305,35 @@
return NULL_REG;
}
- byte* dest;
+ byte value;
+ byte newvalue = 0;
+ unsigned int offset = argv[1].toUint16();
+ if (argc > 2)
+ newvalue = argv[2].toSint16();
if (dest_r.isRaw) {
- dest = (byte*)dest_r.raw + argv[1].toUint16();
+ value = dest_r.raw[offset];
+ if (argc > 2) /* Request to modify this char */
+ dest_r.raw[offset] = newvalue;
} else {
-#ifndef SCUMM_BIG_ENDIAN
- int odd = argv[1].toUint16() & 1;
-#else
- int odd = !(argv[1].toUint16() & 1);
-#endif
- reg_t *tmp = dest_r.reg + (argv[1].toUint16() / 2);
- dest = ((byte *)(&tmp->offset)) + odd;
+ reg_t &tmp = dest_r.reg[offset / 2];
+ if (!(offset & 1)) {
+ value = tmp.offset & 0x00ff;
+ if (argc > 2) { /* Request to modify this char */
+ tmp.offset &= 0xff00;
+ tmp.offset |= newvalue;
+ }
+ } else {
+ value = tmp.offset >> 8;
+ if (argc > 2) { /* Request to modify this char */
+ tmp.offset &= 0x00ff;
+ tmp.offset |= newvalue << 8;
+ }
+ }
}
- s->r_acc = make_reg(0, *dest);
+ s->r_acc = make_reg(0, value);
- if (argc > 2)
- *dest = argv[2].toSint16(); /* Request to modify this char */
-
return s->r_acc;
}
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