aboutsummaryrefslogtreecommitdiff
path: root/engines/teenagent/animation.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'engines/teenagent/animation.cpp')
-rw-r--r--engines/teenagent/animation.cpp28
1 files changed, 14 insertions, 14 deletions
diff --git a/engines/teenagent/animation.cpp b/engines/teenagent/animation.cpp
index e945bda1e5..56107b67ca 100644
--- a/engines/teenagent/animation.cpp
+++ b/engines/teenagent/animation.cpp
@@ -106,11 +106,11 @@ void Animation::free() {
index = 0;
}
-void Animation::load(Common::SeekableReadStream *s, Type type) {
+void Animation::load(Common::SeekableReadStream &s, Type type) {
//fixme: do not reload the same animation each time
free();
- if (s == NULL || s->size() <= 1) {
+ if (s.size() <= 1) {
debug(1, "empty animation");
return;
}
@@ -119,29 +119,29 @@ void Animation::load(Common::SeekableReadStream *s, Type type) {
int off = 0;
switch (type) {
case kTypeLan:
- data_size = s->readUint16LE();
- if (s->eos()) {
+ data_size = s.readUint16LE();
+ if (s.eos()) {
debug(1, "empty animation");
return;
}
data_size -= 2;
data = new byte[data_size];
- data_size = s->read(data, data_size);
+ data_size = s.read(data, data_size);
/* for (int i = 0; i < data_size; ++i) {
debug(0, "%02x ", data[i]);
}
debug(0, ", %u frames", data_size / 3);
*/
- frames_count = s->readByte();
+ frames_count = s.readByte();
debug(1, "%u physical frames", frames_count);
if (frames_count == 0)
return;
frames = new Surface[frames_count];
- s->skip(frames_count * 2 - 2); //sizes
- /*pos = */s->readUint16LE();
+ s.skip(frames_count * 2 - 2); //sizes
+ /*pos = */s.readUint16LE();
//debug(0, "pos?: %04x", pos);
for (uint16 i = 0; i < frames_count; ++i) {
@@ -152,15 +152,15 @@ void Animation::load(Common::SeekableReadStream *s, Type type) {
break;
case kTypeInventory: {
- data_size = 3 * s->readByte();
+ data_size = 3 * s.readByte();
data = new byte[data_size];
frames_count = 0;
for (byte i = 0; i < data_size / 3; ++i) {
int idx = i * 3;
/* byte unk = */
- s->readByte();
- data[idx] = s->readByte();
+ s.readByte();
+ data[idx] = s.readByte();
if (data[idx] == 0)
data[idx] = 1; //fixme: investigate
if (data[idx] > frames_count)
@@ -179,17 +179,17 @@ void Animation::load(Common::SeekableReadStream *s, Type type) {
break;
case kTypeVaria:
- frames_count = s->readByte();
+ frames_count = s.readByte();
debug(1, "loading varia resource, %u physical frames", frames_count);
uint16 offset[255];
for (byte i = 0; i < frames_count; ++i) {
- offset[i] = s->readUint16LE();
+ offset[i] = s.readUint16LE();
//debug(0, "%u: %04x", i, offset[i]);
}
frames = new Surface[frames_count];
for (uint16 i = 0; i < frames_count; ++i) {
//debug(0, "%04x", offset[i]);
- s->seek(offset[i] + off);
+ s.seek(offset[i] + off);
frames[i].load(s, Surface::kTypeOns);
}