[Scummvm-cvs-logs] SF.net SVN: scummvm:[45960] scummvm/trunk/engines/teenagent
megath at users.sourceforge.net
megath at users.sourceforge.net
Tue Nov 17 22:42:56 CET 2009
Revision: 45960
http://scummvm.svn.sourceforge.net/scummvm/?rev=45960&view=rev
Author: megath
Date: 2009-11-17 21:42:56 +0000 (Tue, 17 Nov 2009)
Log Message:
-----------
added SurfaceList, ported overlay to it, fixed many z-order issues. (found meaning of the flags in overlay resources)
Modified Paths:
--------------
scummvm/trunk/engines/teenagent/module.mk
scummvm/trunk/engines/teenagent/scene.cpp
scummvm/trunk/engines/teenagent/scene.h
scummvm/trunk/engines/teenagent/surface.cpp
scummvm/trunk/engines/teenagent/surface.h
Added Paths:
-----------
scummvm/trunk/engines/teenagent/surface_list.cpp
scummvm/trunk/engines/teenagent/surface_list.h
Modified: scummvm/trunk/engines/teenagent/module.mk
===================================================================
--- scummvm/trunk/engines/teenagent/module.mk 2009-11-17 21:00:28 UTC (rev 45959)
+++ scummvm/trunk/engines/teenagent/module.mk 2009-11-17 21:42:56 UTC (rev 45960)
@@ -10,6 +10,7 @@
animation.o \
font.o \
surface.o \
+ surface_list.o \
actor.o \
callbacks.o \
inventory.o \
Modified: scummvm/trunk/engines/teenagent/scene.cpp
===================================================================
--- scummvm/trunk/engines/teenagent/scene.cpp 2009-11-17 21:00:28 UTC (rev 45959)
+++ scummvm/trunk/engines/teenagent/scene.cpp 2009-11-17 21:42:56 UTC (rev 45960)
@@ -442,7 +442,7 @@
sub_hack = 2;
}
}
- on.load(stream, Surface::kTypeOn, sub_hack);
+ on.load(stream, SurfaceList::kTypeOn, sub_hack);
delete stream;
loadOns();
@@ -649,9 +649,9 @@
}
}
- if (on.pixels != NULL && on.y + on.h < actor_animation_position.bottom && debug_features.feature[DebugFeatures::kShowOn]) {
+ if (debug_features.feature[DebugFeatures::kShowOn]) {
if (_id != 16 || getOns(16)[0] != 0) {
- on.render(surface); //do not render boat on isle. I double checked all callbacks, there's no code switching off the boat :(
+ on.render(surface, actor_animation_position.bottom, false); //do not render boat on isle. I double checked all callbacks, there's no code switching off the boat :(
}
}
@@ -710,9 +710,9 @@
}
//render on
- if (on.pixels != NULL && on.y + on.h >= actor_animation_position.bottom && debug_features.feature[DebugFeatures::kShowOn]) {
+ if (debug_features.feature[DebugFeatures::kShowOn]) {
if (_id != 16 || getOns(16)[0] != 0) {
- on.render(surface); //do not render boat on isle. I double checked all callbacks, there's no code switching off the boat :(
+ on.render(surface, actor_animation_position.bottom, true); //do not render boat on isle. I double checked all callbacks, there's no code switching off the boat :(
}
}
Modified: scummvm/trunk/engines/teenagent/scene.h
===================================================================
--- scummvm/trunk/engines/teenagent/scene.h 2009-11-17 21:00:28 UTC (rev 45959)
+++ scummvm/trunk/engines/teenagent/scene.h 2009-11-17 21:42:56 UTC (rev 45960)
@@ -30,6 +30,8 @@
#include "common/system.h"
#include "common/list.h"
#include "teenagent/objects.h"
+#include "teenagent/surface.h"
+#include "teenagent/surface_list.h"
namespace TeenAgent {
@@ -176,7 +178,7 @@
int _id;
Graphics::Surface background;
- Surface on;
+ SurfaceList on;
Surface *ons;
uint32 ons_count;
Animation actor_animation, animation[4], custom_animation[4];
Modified: scummvm/trunk/engines/teenagent/surface.cpp
===================================================================
--- scummvm/trunk/engines/teenagent/surface.cpp 2009-11-17 21:00:28 UTC (rev 45959)
+++ scummvm/trunk/engines/teenagent/surface.cpp 2009-11-17 21:42:56 UTC (rev 45960)
@@ -30,30 +30,14 @@
namespace TeenAgent {
Surface::Surface() : x(0), y(0) {
- memset(flags, 0, sizeof(flags));
}
-void Surface::load(Common::SeekableReadStream *stream, Type type, int sub_hack) {
+void Surface::load(Common::SeekableReadStream *stream, Type type) {
//debug(0, "load()");
free();
x = y = 0;
- memset(flags, 0, sizeof(flags));
- if (type == kTypeOn) {
- byte fn = stream->readByte();
- if (stream->eos())
- return;
-
- byte i;
- for (i = 0; i < fn - sub_hack; ++i) {
- flags[i] = stream->readUint16LE();
- debug(0, "flags[%u] = %u (0x%04x)", i, flags[i], flags[i]);
- }
- for(; i < fn; ++i)
- debug(0, "*hack* skipping flag %04x", stream->readUint16LE());
- }
-
uint16 w_ = stream->readUint16LE();
uint16 h_ = stream->readUint16LE();
@@ -78,7 +62,7 @@
stream->read(pixels, w_ * h_);
}
-Common::Rect Surface::render(Graphics::Surface *surface, int dx, int dy, bool mirror, Common::Rect src_rect) {
+Common::Rect Surface::render(Graphics::Surface *surface, int dx, int dy, bool mirror, Common::Rect src_rect) const {
if (src_rect.isEmpty()) {
src_rect = Common::Rect(0, 0, w, h);
} else if (src_rect.right > w)
Modified: scummvm/trunk/engines/teenagent/surface.h
===================================================================
--- scummvm/trunk/engines/teenagent/surface.h 2009-11-17 21:00:28 UTC (rev 45959)
+++ scummvm/trunk/engines/teenagent/surface.h 2009-11-17 21:42:56 UTC (rev 45960)
@@ -22,8 +22,8 @@
* $Id$
*/
-#ifndef TAGET_SURFACE_H
-#define TAGET_SURFACE_H
+#ifndef TEENAGENT_SURFACE_H
+#define TEENAGENT_SURFACE_H
#include "graphics/surface.h"
#include "common/stream.h"
@@ -33,14 +33,13 @@
class Pack;
class Surface : public Graphics::Surface {
public:
- enum Type {kTypeOn, kTypeOns, kTypeLan};
+ enum Type {kTypeOns, kTypeLan};
- uint16 flags[255];
uint16 x, y;
Surface();
- void load(Common::SeekableReadStream *stream, Type type, int sub_hack = 0);
- Common::Rect render(Graphics::Surface *surface, int dx = 0, int dy = 0, bool mirror = false, Common::Rect src_rect = Common::Rect());
+ void load(Common::SeekableReadStream *stream, Type type);
+ Common::Rect render(Graphics::Surface *surface, int dx = 0, int dy = 0, bool mirror = false, Common::Rect src_rect = Common::Rect()) const;
bool empty() const { return pixels == NULL; }
};
Added: scummvm/trunk/engines/teenagent/surface_list.cpp
===================================================================
--- scummvm/trunk/engines/teenagent/surface_list.cpp (rev 0)
+++ scummvm/trunk/engines/teenagent/surface_list.cpp 2009-11-17 21:42:56 UTC (rev 45960)
@@ -0,0 +1,77 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * $URL$
+ * $Id$
+ */
+
+#include "teenagent/surface.h"
+#include "teenagent/surface_list.h"
+
+namespace TeenAgent {
+
+SurfaceList::SurfaceList() : surfaces(NULL) {}
+
+void SurfaceList::load(Common::SeekableReadStream *stream, Type type, int sub_hack) {
+ free();
+
+ byte fn = stream->readByte();
+ if (stream->eos() || fn == 0)
+ return;
+
+ debug(0, "loading %u surfaces from list (skip %d)", fn, sub_hack);
+
+ surfaces_n = fn - sub_hack;
+ surfaces = new Surface[surfaces_n];
+
+ byte i;
+ for (i = 0; i < surfaces_n; ++i) {
+ uint offset = stream->readUint16LE();
+ uint pos = stream->pos();
+ stream->seek(offset);
+ surfaces[i].load(stream, Surface::kTypeOns);
+ stream->seek(pos);
+ }
+ //for(; i < fn; ++i)
+ // debug(0, "*hack* skipping flag %04x", stream->readUint16LE());
+}
+
+void SurfaceList::free() {
+ delete[] surfaces;
+ surfaces = NULL;
+ surfaces_n = 0;
+}
+
+Common::Rect SurfaceList::render(Graphics::Surface *surface, int horizont, bool second_pass) const {
+ Common::Rect dirty;
+ for(uint i = 0; i < surfaces_n; ++i) {
+ const Surface &s = surfaces[i];
+ if (second_pass) {
+ if (s.y + s.h >= horizont)
+ dirty.extend(s.render(surface));
+ } else {
+ if (s.y + s.h < horizont)
+ dirty.extend(s.render(surface));
+ }
+ }
+ return dirty;
+}
+
+}
Property changes on: scummvm/trunk/engines/teenagent/surface_list.cpp
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: svn:keywords
+ Date Rev Author URL Id
Added: svn:eol-style
+ native
Added: scummvm/trunk/engines/teenagent/surface_list.h
===================================================================
--- scummvm/trunk/engines/teenagent/surface_list.h (rev 0)
+++ scummvm/trunk/engines/teenagent/surface_list.h 2009-11-17 21:42:56 UTC (rev 45960)
@@ -0,0 +1,50 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * $URL$
+ * $Id$
+ */
+
+#ifndef TEENAGENT_SURFACE_LIST_H__
+#define TEENAGENT_SURFACE_LIST_H__
+
+#include "common/stream.h"
+
+namespace TeenAgent {
+class Surface;
+
+class SurfaceList {
+public:
+ enum Type { kTypeOn };
+
+ SurfaceList();
+ void load(Common::SeekableReadStream *stream, Type type, int sub_hack = 0);
+ void free();
+ Common::Rect render(Graphics::Surface *surface, int horizont, bool second_pass) const;
+
+protected:
+ Surface * surfaces;
+ uint surfaces_n;
+};
+
+}
+
+#endif
+
Property changes on: scummvm/trunk/engines/teenagent/surface_list.h
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: svn:keywords
+ Date Rev Author URL Id
Added: svn:eol-style
+ native
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