[Scummvm-cvs-logs] SF.net SVN: scummvm:[47872] scummvm/trunk/engines/teenagent
megath at users.sourceforge.net
megath at users.sourceforge.net
Thu Feb 4 08:44:14 CET 2010
Revision: 47872
http://scummvm.svn.sourceforge.net/scummvm/?rev=47872&view=rev
Author: megath
Date: 2010-02-04 07:44:13 +0000 (Thu, 04 Feb 2010)
Log Message:
-----------
added fading in certain areas (bush in forest)
Modified Paths:
--------------
scummvm/trunk/engines/teenagent/scene.cpp
scummvm/trunk/engines/teenagent/scene.h
Modified: scummvm/trunk/engines/teenagent/scene.cpp
===================================================================
--- scummvm/trunk/engines/teenagent/scene.cpp 2010-02-04 00:12:00 UTC (rev 47871)
+++ scummvm/trunk/engines/teenagent/scene.cpp 2010-02-04 07:44:13 UTC (rev 47872)
@@ -41,7 +41,7 @@
orientation(kActorRight), actor_talking(false),
message_timer(0), message_first_frame(0), message_last_frame(0), message_animation(NULL),
current_event(SceneEvent::kNone), hide_actor(false), callback(0), callback_timer(0),
- _fade_timer(0), _fade_type(0), _idle_timer(0) {}
+ _fade_timer(0), _idle_timer(0) {}
void Scene::warp(const Common::Point &_point, byte o) {
Common::Point point(_point);
@@ -197,7 +197,6 @@
_system = system;
_fade_timer = 0;
- _fade_type = 0;
memset(palette, 0, sizeof(palette));
@@ -532,6 +531,30 @@
}
+void Scene::paletteEffect(byte step) {
+ Resources *res = Resources::instance();
+ byte *src = res->dseg.ptr(0x6609);
+ byte *dst = palette + 3 * 0xf2;
+ for(byte i = 0; i < 0xd; ++i) {
+ for(byte c = 0; c < 3; ++c, ++src)
+ *dst++ = *src > step? *src - step: 0;
+ }
+}
+
+byte Scene::findFade() const {
+ if (_id <= 0)
+ return 0;
+
+ const Common::Array<FadeType> &scene_fades = fades[_id - 1];
+ for(uint i = 0; i < scene_fades.size(); ++i) {
+ const FadeType &fade = scene_fades[i];
+ if (fade.rect.in(position)) {
+ return fade.value;
+ }
+ }
+ return 0;
+}
+
bool Scene::render(bool tick_game, bool tick_mark, uint32 delta) {
Resources *res = Resources::instance();
bool busy;
@@ -683,6 +706,16 @@
} else if (!hide_actor) {
actor_animation.free();
uint zoom = lookupZoom(position.y);
+ {
+ byte fade = findFade();
+ static byte old_fade = 0;
+ if (fade != old_fade) {
+ old_fade = fade;
+ paletteEffect(fade);
+ if (_fade_timer == 0)
+ setPalette(4);
+ }
+ }
if (!path.empty()) {
const Common::Point &destination = path.front();
@@ -1044,18 +1077,6 @@
case SceneEvent::kFade:
_fade_timer = current_event.orientation != 0? 5: -5;
- _fade_type = 0;
- if (_id > 0) {
- Common::Array<FadeType> &scene_fades = fades[_id - 1];
- for(uint i = 0; i < scene_fades.size(); ++i) {
- const FadeType &fade = scene_fades[i];
- if (fade.rect.in(position)) {
- debug(0, "found fade type %u", fade.value);
- _fade_type = fade.value;
- break;
- }
- }
- }
current_event.clear();
break;
@@ -1084,6 +1105,7 @@
}
void Scene::setPalette(unsigned mul) {
+ //debug(0, "setPalette(%u)", mul);
byte p[1024];
memset(p, 0, 1024);
Modified: scummvm/trunk/engines/teenagent/scene.h
===================================================================
--- scummvm/trunk/engines/teenagent/scene.h 2010-02-04 00:12:00 UTC (rev 47871)
+++ scummvm/trunk/engines/teenagent/scene.h 2010-02-04 07:44:13 UTC (rev 47872)
@@ -169,6 +169,9 @@
void playActorAnimation(uint id, bool loop, bool ignore);
byte palette[768];
+ void paletteEffect(byte step);
+ byte findFade() const;
+
static Common::Point messagePosition(const Common::String &str, Common::Point position);
static uint messageDuration(const Common::String &str);
@@ -220,7 +223,6 @@
uint16 callback, callback_timer;
int _fade_timer;
- int _fade_type;
uint _idle_timer;
struct Sound {
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