aboutsummaryrefslogtreecommitdiff
path: root/engines/cge
diff options
context:
space:
mode:
authorStrangerke2011-07-09 00:25:09 +0200
committerStrangerke2011-07-09 00:25:09 +0200
commit0b27de942b9dcb9cd3ea75955c02bb1bf813ddd8 (patch)
tree5f5eceac88bcf142ddfa8b772b6f171c3f6141f1 /engines/cge
parent080d7cf7f082b5faa245da965211a099ed37fd2b (diff)
downloadscummvm-rg350-0b27de942b9dcb9cd3ea75955c02bb1bf813ddd8.tar.gz
scummvm-rg350-0b27de942b9dcb9cd3ea75955c02bb1bf813ddd8.tar.bz2
scummvm-rg350-0b27de942b9dcb9cd3ea75955c02bb1bf813ddd8.zip
CGE: replace some 'tricky replicate lines' memcpy by two, in order to avoid overlapping
Diffstat (limited to 'engines/cge')
-rw-r--r--engines/cge/events.h1
-rw-r--r--engines/cge/talk.cpp29
2 files changed, 23 insertions, 7 deletions
diff --git a/engines/cge/events.h b/engines/cge/events.h
index 374c28aebc..90b8ed1db0 100644
--- a/engines/cge/events.h
+++ b/engines/cge/events.h
@@ -108,7 +108,6 @@ public:
~Mouse();
void on();
void off();
- void tick();
void newMouse(Common::Event &event);
private:
CGEEngine *_vm;
diff --git a/engines/cge/talk.cpp b/engines/cge/talk.cpp
index 7c0f9563a6..61de47e48a 100644
--- a/engines/cge/talk.cpp
+++ b/engines/cge/talk.cpp
@@ -248,13 +248,22 @@ void Talk::putLine(int line, const char *text) {
// clear whole rectangle
p = v; // assume blanked line above text
- memcpy(p, p - lsiz, rsiz);
+
+ byte *tmpBuf = new byte[rsiz];
+
+ memcpy(tmpBuf, p - lsiz, rsiz);
+ memcpy(p, tmpBuf, rsiz);
p += psiz; // tricky replicate lines for plane 0
- memcpy(p, p - lsiz, rsiz);
+ memcpy(tmpBuf, p - lsiz, rsiz);
+ memcpy(p, tmpBuf, rsiz);
p += psiz; // same for plane 1
- memcpy(p, p - lsiz, rsiz);
+ memcpy(tmpBuf, p - lsiz, rsiz);
+ memcpy(p, tmpBuf, rsiz);
p += psiz; // same for plane 2
- memcpy(p, p - lsiz, rsiz); // same for plane 3
+ memcpy(tmpBuf, p - lsiz, rsiz);
+ memcpy(p, tmpBuf, rsiz);
+
+ delete[] tmpBuf;
// paint text line
if (text) {
@@ -302,10 +311,18 @@ void InfoLine::update(const char *tx) {
uint16 size = 4 * psiz; // whole map size
// clear whole rectangle
+ byte *tmpBuf = new byte[size];
memset(v + 2, TEXT_BG, dsiz); // data bytes
- memcpy(v + lsiz, v, psiz - lsiz); // tricky replicate lines
+
+ memcpy(tmpBuf, v, psiz - lsiz);
+ memcpy(v + lsiz, tmpBuf, psiz - lsiz);
+
*(uint16 *)(v + psiz - 2) = EOI; // plane trailer uint16
- memcpy(v + psiz, v, 3 * psiz); // tricky replicate planes
+
+ memcpy(tmpBuf, v, 3 * psiz);
+ memcpy(v + psiz, tmpBuf, 3 * psiz);
+
+ delete[] tmpBuf;
// paint text line
if (tx) {