[Scummvm-cvs-logs] SF.net SVN: scummvm:[44005] scummvm/trunk/engines/teenagent
megath at users.sourceforge.net
megath at users.sourceforge.net
Mon Sep 7 22:38:02 CEST 2009
Revision: 44005
http://scummvm.svn.sourceforge.net/scummvm/?rev=44005&view=rev
Author: megath
Date: 2009-09-07 20:38:02 +0000 (Mon, 07 Sep 2009)
Log Message:
-----------
play animation only when hovered
Modified Paths:
--------------
scummvm/trunk/engines/teenagent/animation.cpp
scummvm/trunk/engines/teenagent/animation.h
scummvm/trunk/engines/teenagent/inventory.cpp
Modified: scummvm/trunk/engines/teenagent/animation.cpp
===================================================================
--- scummvm/trunk/engines/teenagent/animation.cpp 2009-09-07 20:12:17 UTC (rev 44004)
+++ scummvm/trunk/engines/teenagent/animation.cpp 2009-09-07 20:38:02 UTC (rev 44005)
@@ -30,6 +30,10 @@
Animation::Animation() : id(0), x(0), y(0), loop(true), data(0), data_size(0), frames_count(0), frames(0), index(0) {
}
+Surface * Animation::firstFrame() const {
+ return frames != NULL? frames: NULL;
+}
+
Surface * Animation::currentFrame(int dt) {
if (frames == NULL || frames_count == 0)
return NULL;
Modified: scummvm/trunk/engines/teenagent/animation.h
===================================================================
--- scummvm/trunk/engines/teenagent/animation.h 2009-09-07 20:12:17 UTC (rev 44004)
+++ scummvm/trunk/engines/teenagent/animation.h 2009-09-07 20:38:02 UTC (rev 44005)
@@ -41,7 +41,10 @@
void load(Common::SeekableReadStream * s, Type type = TypeLan);
void free();
+ Surface * firstFrame() const;
Surface * currentFrame(int dt = 1);
+ uint16 currentIndex() const { return index; }
+
~Animation();
bool empty() const { return frames == NULL; }
Modified: scummvm/trunk/engines/teenagent/inventory.cpp
===================================================================
--- scummvm/trunk/engines/teenagent/inventory.cpp 2009-09-07 20:12:17 UTC (rev 44004)
+++ scummvm/trunk/engines/teenagent/inventory.cpp 2009-09-07 20:38:02 UTC (rev 44005)
@@ -237,9 +237,17 @@
inventory->items->seek(inventory->offset[obj->id - 1]);
animation.load(inventory->items, Animation::TypeInventory);
}
- Surface * s = animation.currentFrame();
- if (s != NULL)
- s->render(dst, rect.left + 1, rect.top + 1);
+ if (hovered) {
+ Surface * s = animation.currentFrame();
+ if (animation.currentIndex() == 0)
+ s = animation.currentFrame();
+ if (s != NULL)
+ s->render(dst, rect.left + 1, rect.top + 1);
+ } else {
+ Surface * s = animation.firstFrame();
+ if (s != NULL)
+ s->render(dst, rect.left + 1, rect.top + 1);
+ }
} else {
if (surface.empty()) {
debug(0, "loading item %d from offset %x", obj->id, inventory->offset[obj->id - 1]);
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