[Scummvm-cvs-logs] SF.net SVN: scummvm:[44101] scummvm/trunk/engines/teenagent

fingolfin at users.sourceforge.net fingolfin at users.sourceforge.net
Tue Sep 15 10:54:06 CEST 2009


Revision: 44101
          http://scummvm.svn.sourceforge.net/scummvm/?rev=44101&view=rev
Author:   fingolfin
Date:     2009-09-15 08:54:06 +0000 (Tue, 15 Sep 2009)

Log Message:
-----------
TEEN: More code formatting & whitespace changes (automatically generated with astyle)

Modified Paths:
--------------
    scummvm/trunk/engines/teenagent/actor.cpp
    scummvm/trunk/engines/teenagent/actor.h
    scummvm/trunk/engines/teenagent/animation.cpp
    scummvm/trunk/engines/teenagent/animation.h
    scummvm/trunk/engines/teenagent/callbacks.cpp
    scummvm/trunk/engines/teenagent/detection.cpp
    scummvm/trunk/engines/teenagent/dialog.cpp
    scummvm/trunk/engines/teenagent/dialog.h
    scummvm/trunk/engines/teenagent/font.cpp
    scummvm/trunk/engines/teenagent/font.h
    scummvm/trunk/engines/teenagent/inventory.cpp
    scummvm/trunk/engines/teenagent/inventory.h
    scummvm/trunk/engines/teenagent/music.cpp
    scummvm/trunk/engines/teenagent/music.h
    scummvm/trunk/engines/teenagent/objects.cpp
    scummvm/trunk/engines/teenagent/objects.h
    scummvm/trunk/engines/teenagent/pack.cpp
    scummvm/trunk/engines/teenagent/pack.h
    scummvm/trunk/engines/teenagent/resources.cpp
    scummvm/trunk/engines/teenagent/resources.h
    scummvm/trunk/engines/teenagent/scene.cpp
    scummvm/trunk/engines/teenagent/scene.h
    scummvm/trunk/engines/teenagent/segment.h
    scummvm/trunk/engines/teenagent/surface.cpp
    scummvm/trunk/engines/teenagent/surface.h
    scummvm/trunk/engines/teenagent/teenagent.cpp
    scummvm/trunk/engines/teenagent/teenagent.h

Modified: scummvm/trunk/engines/teenagent/actor.cpp
===================================================================
--- scummvm/trunk/engines/teenagent/actor.cpp	2009-09-15 08:51:16 UTC (rev 44100)
+++ scummvm/trunk/engines/teenagent/actor.cpp	2009-09-15 08:54:06 UTC (rev 44101)
@@ -27,45 +27,45 @@
 
 namespace TeenAgent {
 
-void Actor::render(Graphics::Surface *surface, const Common::Point & position, uint8 orientation, int delta_frame) {
+void Actor::render(Graphics::Surface *surface, const Common::Point &position, uint8 orientation, int delta_frame) {
 	const uint8 frames_left_right[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
 	const uint8 frames_up[] = {18, 19, 20, 21, 22, 23, 24, 25, };
 	const uint8 frames_down[] = {10, 11, 12, 13, 14, 15, 16, 17, };
-	
+
 	Surface *s = NULL;
-	
+
 	if (delta_frame == 0) {
 		index = 0; //static animation
 	}
 	int dx, dy;
-	switch(orientation) {
+	switch (orientation) {
 	case Object::ActorLeft:
 	case Object::ActorRight:
-		if (index >= sizeof(frames_left_right)) 
+		if (index >= sizeof(frames_left_right))
 			index = 1;
 		s = frames + frames_left_right[index];
 		dx = 11;
 		dy = 62;
 		break;
 	case Object::ActorUp:
-		if (index >= sizeof(frames_up)) 
+		if (index >= sizeof(frames_up))
 			index = 1;
 		s = frames + frames_up[index];
 		dx = 29;
 		dy = 67;
 		break;
 	case Object::ActorDown:
-		if (index >= sizeof(frames_down)) 
+		if (index >= sizeof(frames_down))
 			index = 1;
 		s = frames + frames_down[index];
 		dx = 29;
 		dy = 67;
 		break;
-	default: 
+	default:
 		return;
 	}
 	index += delta_frame;
-	
+
 	int xp = position.x - dx, yp = position.y - dy;
 	if (xp < 0)
 		xp = 0;
@@ -76,7 +76,7 @@
 		yp = 0;
 	if (yp + s->h > 200)
 		yp = 200 - s->h;
-	
+
 	if (s != NULL)
 		s->render(surface, xp, yp, orientation == Object::ActorLeft);
 }

Modified: scummvm/trunk/engines/teenagent/actor.h
===================================================================
--- scummvm/trunk/engines/teenagent/actor.h	2009-09-15 08:51:16 UTC (rev 44100)
+++ scummvm/trunk/engines/teenagent/actor.h	2009-09-15 08:54:06 UTC (rev 44101)
@@ -28,8 +28,8 @@
 namespace TeenAgent {
 
 class Actor : public Animation {
-public: 
-	void render(Graphics::Surface *surface, const Common::Point & position, uint8 orientation, int delta_frame);
+public:
+	void render(Graphics::Surface *surface, const Common::Point &position, uint8 orientation, int delta_frame);
 };
 
 } // End of namespace TeenAgent

Modified: scummvm/trunk/engines/teenagent/animation.cpp
===================================================================
--- scummvm/trunk/engines/teenagent/animation.cpp	2009-09-15 08:51:16 UTC (rev 44100)
+++ scummvm/trunk/engines/teenagent/animation.cpp	2009-09-15 08:54:06 UTC (rev 44101)
@@ -30,10 +30,10 @@
 Animation::Animation() : id(0), x(0), y(0), loop(true), paused(false), data(0), data_size(0), frames_count(0), frames(0), index(0) {
 }
 
-Surface *Animation::firstFrame(){
+Surface *Animation::firstFrame() {
 	if (frames == NULL || frames_count == 0)
 		return NULL;
-	
+
 	Surface *r = frames;
 	uint16 pos = READ_LE_UINT16(data + 1);
 	if (pos != 0) {
@@ -46,26 +46,26 @@
 Surface *Animation::currentFrame(int dt) {
 	if (paused)
 		return firstFrame();
-	
+
 	if (frames == NULL || frames_count == 0)
 		return NULL;
-	
+
 	Surface *r;
-	
+
 	if (data != NULL) {
 		uint32 frame = 3 * index;
 		//debug(0, "%u/%u", index, data_size / 3);
 		index += dt;
-		
+
 		if (!loop && index >= data_size / 3) {
 			return NULL;
 		}
-		
+
 		if (data[frame] - 1 >= frames_count) {
 			warning("invalid frame %u(0x%x) (max %u) index %u, mod %u", frame, frame, frames_count, index - 1, data_size / 3);
 			return NULL;
 		}
-	
+
 		r = frames + data[frame] - 1;
 		uint16 pos = READ_LE_UINT16(data + frame + 1);
 		index %= (data_size / 3);
@@ -90,22 +90,22 @@
 	x = y = 0;
 	loop = true;
 	paused = false;
-	
+
 	delete[] data;
 	data = NULL;
-	data_size = 0;	
+	data_size = 0;
 
 	frames_count = 0;
 	delete[] frames;
 	frames = NULL;
-	
+
 	index = 0;
 }
 
 void Animation::load(Common::SeekableReadStream *s, Type type) {
 	//fixme: do not reload the same animation each time
 	free();
-	
+
 	if (s == NULL && s->size() <= 1) {
 		debug(0, "empty animation");
 		return;
@@ -113,7 +113,7 @@
 
 	uint16 pos = 0;
 	int off = 0;
-	switch(type) {
+	switch (type) {
 	case TypeLan:
 		data_size = s->readUint16LE();
 		if (s->eos()) {
@@ -124,22 +124,22 @@
 		data_size -= 2;
 		data = new byte[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);
-*/	
+		/*		for (int i = 0; i < data_size; ++i) {
+					debug(0, "%02x ", data[i]);
+				}
+				debug(0, ", %u frames", data_size / 3);
+		*/
 		frames_count = s->readByte();
 		debug(0, "%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();
 		//debug(0, "pos?: %04x", pos);
-			
+
 		for (uint16 i = 0; i < frames_count; ++i) {
 			frames[i].load(s, Surface::TypeLan);
 			frames[i].x = 0;
@@ -154,7 +154,8 @@
 		frames_count = 0;
 		for (byte i = 0; i < data_size / 3; ++i) {
 			int idx = i * 3;
-			/* byte unk = */ s->readByte();
+			/* byte unk = */
+			s->readByte();
 			data[idx] = s->readByte();
 			if (data[idx] == 0)
 				data[idx] = 1; //fixme: investigate
@@ -164,15 +165,15 @@
 			data[idx + 2] = 0;
 			//debug(0, "frame #%u", data[idx]);
 		}
-		
+
 		frames = new Surface[frames_count];
-		
+
 		for (uint16 i = 0; i < frames_count; ++i) {
 			frames[i].load(s, Surface::TypeOns);
 		}
 	}
 	break;
-	
+
 	case TypeVaria:
 		frames_count = s->readByte();
 		debug(0, "loading varia resource, %u physical frames", frames_count);
@@ -189,10 +190,10 @@
 			frames[i].x = 0;
 			frames[i].y = 0;
 		}
-		
+
 		break;
 	}
-	
+
 	debug(0, "%u frames", data_size / 3);
 }
 

Modified: scummvm/trunk/engines/teenagent/animation.h
===================================================================
--- scummvm/trunk/engines/teenagent/animation.h	2009-09-15 08:51:16 UTC (rev 44100)
+++ scummvm/trunk/engines/teenagent/animation.h	2009-09-15 08:54:06 UTC (rev 44101)
@@ -31,31 +31,31 @@
 namespace TeenAgent {
 
 class Animation  {
-public: 
+public:
 	uint16 id, x, y;
 	bool loop, paused;
-	
+
 	enum Type {TypeLan, TypeVaria, TypeInventory};
-	
+
 	Animation();
 	void load(Common::SeekableReadStream *s, Type type = TypeLan);
 	void free();
-	
+
 	Surface *firstFrame();
 	Surface *currentFrame(int dt = 1);
 	uint16 currentIndex() const { return index; }
-	
+
 	~Animation();
-	
+
 	bool empty() const { return frames == NULL; }
-	
+
 	//uint16 width() const { return frames? frames[0].w: 0; }
 	//uint16 height() const { return frames? frames[0].h: 0; }
 
 protected:
 	byte *data;
 	uint16 data_size;
-	
+
 	uint16 frames_count;
 	Surface *frames;
 	uint16 index;

Modified: scummvm/trunk/engines/teenagent/callbacks.cpp
===================================================================
--- scummvm/trunk/engines/teenagent/callbacks.cpp	2009-09-15 08:51:16 UTC (rev 44100)
+++ scummvm/trunk/engines/teenagent/callbacks.cpp	2009-09-15 08:54:06 UTC (rev 44101)
@@ -45,7 +45,7 @@
 bool TeenAgentEngine::processCallback(uint16 addr) {
 	if (addr == 0)
 		return false;
-	
+
 	Resources * res = Resources::instance();
 	debug(0, "processCallback(%04x)", addr);
 	byte * code = res->cseg.ptr(addr);
@@ -57,8 +57,8 @@
 		uint16 func = 6 + addr + READ_LE_UINT16(code + 4);
 		debug(0, "call %04x", func);
 		//debug(0, "trivial callback, showing message %s", (const char *)res->dseg.ptr(addr));
-		switch(func) {
-		case 0x11c5: 
+		switch (func) {
+		case 0x11c5:
 			Dialog::show(scene, msg);
 			return true;
 		case 0xa055:
@@ -66,7 +66,7 @@
 			return true;
 		}
 	}
-	
+
 	if (code[0] == 0xe8 && code[3] == 0xc3) {
 		uint func = 3 + addr + READ_LE_UINT16(code + 1);
 		debug(0, "call %04x and return", func);
@@ -75,19 +75,19 @@
 			return true;
 		}
 	}
-	
-	if (code[0] == 0xc7 && code[1] == 0x06 && code[2] == 0xf3 && code[3] == 0xb4 && 
-		code[6] == 0xb8 && code[9] == 0xbb && code[12] == 0xbf &&
-		code[22] == 0xe8 && code[25] == 0xc3) {
+
+	if (code[0] == 0xc7 && code[1] == 0x06 && code[2] == 0xf3 && code[3] == 0xb4 &&
+	        code[6] == 0xb8 && code[9] == 0xbb && code[12] == 0xbf &&
+	        code[22] == 0xe8 && code[25] == 0xc3) {
 		loadScene(code[4], Common::Point(
-			(READ_LE_UINT16(code + 7) + READ_LE_UINT16(code + 13) + 1) / 2 , 
-			READ_LE_UINT16(code + 10)));
-			scene->setOrientation(code[21]);
-			return true;
+		              (READ_LE_UINT16(code + 7) + READ_LE_UINT16(code + 13) + 1) / 2 ,
+		              READ_LE_UINT16(code + 10)));
+		scene->setOrientation(code[21]);
+		return true;
 	}
-	
-	switch(addr) {
-	
+
+	switch (addr) {
+
 	case 0x024c: //intro
 		hideActor();
 
@@ -107,14 +107,14 @@
 		playAnimation(916, 1);
 		playSound(40, 18);
 		playSound(40, 22);
-		for(byte i = 27; i < 37; i += 2)
+		for (byte i = 27; i < 37; i += 2)
 			playSound(40, i);
 		playSound(29, 44);
 		playAnimation(918, 0, true);
 		playAnimation(917, 1, true);
 		waitAnimation();
 		displayCredits(0xe3e6);
-		
+
 		loadScene(40, 139, 156, 3);
 		playMusic(3);
 		Dialog::show(scene, 0x750d, 920, 924, 0xe7, 0xeb); //as i told you, our organization...
@@ -122,9 +122,9 @@
 		playAnimation(925, 0, true);
 		playAnimation(926, 1, true);
 		waitAnimation();
-		Dialog::show(scene, 0x78a6, 920, 927, 0xeb, 0xeb); 
+		Dialog::show(scene, 0x78a6, 920, 927, 0xeb, 0xeb);
 		displayCredits(0xe3ff);
-		
+
 		loadScene(39, 139, 156, 3);
 		playMusic(11);
 		playSound(81, 2);
@@ -166,9 +166,9 @@
 		playActorAnimation(934, true);
 		waitAnimation();
 		loadScene(10, 136, 153);
-		
+
 		return true;
-	
+
 	case 0x4021:
 		//pulling out mysterious object
 		if (CHECK_FLAG(0xdbe1, 1)) {
@@ -180,7 +180,7 @@
 			displayMessage(0x570f);
 		}
 		return true;
-		
+
 	case 0x4094: //climbing to the pole near mudpool
 		if (CHECK_FLAG(0xDBE4, 1)) {
 			displayMessage(0x57b2);
@@ -192,7 +192,7 @@
 			//InventoryObject *obj = inventory->selectedObject();
 			//if (obj != NULL && obj->id == 0x55) {
 
-			//implement pause and using real object: 
+			//implement pause and using real object:
 			if (inventory->has(0x55)) {
 				playSound(5, 4);
 				playActorAnimation(867);
@@ -202,14 +202,14 @@
 				playActorAnimation(868);
 				SET_FLAG(0xDBE4, 1);
 			} else {
-				//fail! 
-				moveTo(86, 195, 1, true); 
+				//fail!
+				moveTo(86, 195, 1, true);
 				playActorAnimation(868);
 				Dialog::pop(scene, 0xDB72);
 			}
 			return true;
 		}
-		
+
 	case 0x419c: //getting the bird
 		setOns(0, 0);
 		playSound(56, 10);
@@ -217,9 +217,9 @@
 		disableObject(6);
 		inventory->add(0x5c);
 		return true;
-		
-		
-	case 0x41ce: 
+
+
+	case 0x41ce:
 		moveTo(197, 159, 4);
 		setOns(0, 0);
 		playSound(71, 8);
@@ -228,7 +228,7 @@
 		inventory->add(0x4e);
 		disableObject(3);
 		return true;
-		
+
 	case 0x4267:
 		playSound(23, 8);
 		setOns(1, 0);
@@ -248,7 +248,7 @@
 		inventory->add(0x51);
 		displayMessage(0x5646);
 		return true;
-	
+
 	case 0x4388:
 		playSound(80);
 		loadScene(8, 155, 199);
@@ -299,7 +299,7 @@
 		disableObject(1);
 		return true;
 
-	case 0x44cb: 
+	case 0x44cb:
 		if (CHECK_FLAG(0xDBE5, 1)) {
 			scene->displayMessage((const char *)res->dseg.ptr(0x57c0));
 		} else {
@@ -310,7 +310,7 @@
 			SET_FLAG(0xDBE5, 1);
 		}
 		return true;
-		
+
 	case 0x4539: //prison cell: use crates
 		if (CHECK_FLAG(0xdbdd, 2)) {
 			//finished the meal - trap
@@ -321,9 +321,9 @@
 			playSound(71, 4);
 			playActorAnimation(823);
 
-			playSound(74, 1); 
-			playSound(74, 3); 
-			playSound(74, 6); 
+			playSound(74, 1);
+			playSound(74, 3);
+			playSound(74, 6);
 			loadScene(5, scene->getPosition());
 			playActorAnimation(826);
 			loadScene(6, scene->getPosition());
@@ -334,7 +334,7 @@
 		} else {
 			if (Dialog::pop(scene, 0xdb5c) != 0x636b) //not 'im getting hungry'
 				return true;
-			
+
 			playSound(52, 8);
 			playAnimation(820, 1);
 			setOns(3, 0x59);
@@ -344,7 +344,7 @@
 			SET_FLAG(0xdbdc, 1);
 		}
 		return true;
-		
+
 	case 0x4662:
 		if (CHECK_FLAG(0xDBDD, 3)) {
 			if (CHECK_FLAG(0xDBDE, 1)) {
@@ -357,11 +357,11 @@
 				inventory->add(0x4d);
 				SET_FLAG(0xDBDE, 1);
 			}
-		} else 
+		} else
 			displayMessage(0x5905);
 		return true;
-		
-	case 0x46af: //prison cell: use live cable 
+
+	case 0x46af: //prison cell: use live cable
 		if (CHECK_FLAG(0xdbdc, 1)) {
 			displayMessage(0x555d);
 			setOns(2, 0);
@@ -373,10 +373,10 @@
 			displayMessage(0x5577);
 			disableObject(5);
 			SET_FLAG(0xdbdd, 1);
-		} else 
+		} else
 			displayMessage(0x5528);
 		return true;
-	
+
 	case 0x4705:  //prison: getting lamp bulb
 		moveTo(144, 185, 4);
 		playSound(56, 15);
@@ -385,13 +385,13 @@
 		playAnimation(817, 1, true);
 		waitAnimation();
 		setOns(0, 87);
-		
+
 		playSound(34, 1);
 		playSound(5, 15);
 		playActorAnimation(818, true);
 		playAnimation(819, 1, true);
 		waitAnimation();
-		
+
 		moveTo(160, 188, 1, true);
 		setOns(2, 88);
 
@@ -399,7 +399,7 @@
 		enableObject(5);
 		inventory->add(0x4c);
 		return true;
-	
+
 	case 0x4794: //prison cell door
 		if (res->dseg.get_byte(0xDBDF) >= 2) {
 			loadScene(5, 287, 143);
@@ -407,14 +407,14 @@
 			displayMessage(0x592f);
 		}
 		return true;
-	
+
 	case 0x47bc: //prison: examining trash can
 		playSound(79, 5);
 		playSound(1, 14);
 		playActorAnimation(966);
 		displayMessage(0x5955);
 		return true;
-		
+
 	case 0x47db: //prison: use switch
 		if (CHECK_FLAG(0xDBDF, 1)) {
 			playSound(71, 4);
@@ -433,12 +433,12 @@
 			displayMessage(0x52f6);
 		}
 		return true;
-		
-	case 0x4871: 
+
+	case 0x4871:
 		playActorAnimation(965);
 		displayMessage(0x5511);
 		return true;
-		
+
 	case 0x4893: //taking pills
 		if (CHECK_FLAG(0xDBE6, 1)) {
 			SET_FLAG(0xDBE6, 2);
@@ -452,7 +452,7 @@
 			displayMessage(0x5511);
 		}
 		return true;
-	
+
 	case 0x4918: //talking with barmen
 		if (CHECK_FLAG(0xDBE7, 1)) {
 			moveTo(140, 152, 1);
@@ -468,7 +468,7 @@
 				disableObject(1);
 				disableObject(2);
 				SET_FLAG(0xDBE9, 1);
-			} else 
+			} else
 				displayMessage(0x5855);
 		} else {
 			if (CHECK_FLAG(0xDBDF, 3)) {
@@ -491,43 +491,43 @@
 			}
 		}
 		return true;
-		
+
 	case 0x4f14: //use the hollow
-		displayMessage(CHECK_FLAG(0xDBA1, 1)? 0x370f: 0x36c2);
+		displayMessage(CHECK_FLAG(0xDBA1, 1) ? 0x370f : 0x36c2);
 		return true;
-		
-	case 0x4a64: 
+
+	case 0x4a64:
 		if (CHECK_FLAG(0xDBF0, 1)) {
 			displayMessage(0x5e25);
 		} else {
 			loadScene(5, 35, 162);
 		}
 		return true;
-		
-	case 0x4bf5: 
+
+	case 0x4bf5:
 		playActorAnimation(959);
 		loadScene(8, 40, 152, 3);
 		return true;
-	
+
 	case 0x483a:
 		Dialog::pop(scene, 0xdb82);
 		return true;
-		
+
 	case 0x4844:
 		playSound(80, 4);
 		playActorAnimation(963);
 		loadScene(5, 166, 158);
 		return true;
-		
-	case 0x48ea: 
+
+	case 0x48ea:
 		setOns(0, 0);
 		playSound(5, 9);
 		playActorAnimation(836);
 		inventory->add(0x4f);
 		disableObject(12);
 		return true;
-		
-	case 0x4a8c: 
+
+	case 0x4a8c:
 		if (CHECK_FLAG(0xDBE9, 1)) {
 			playSound(89, 5);
 			playActorAnimation(958);
@@ -538,7 +538,7 @@
 			Dialog::pop(scene, 0xDB8A, 857);
 		}
 		return true;
-		
+
 	case 0x4af4: //taking the crumbs
 		setOns(0, 0);
 		playActorAnimation(861);
@@ -546,7 +546,7 @@
 		inventory->add(0x57);
 		disableObject(6);
 		return true;
-		
+
 	case 0x4b35:
 		playSound(15, 7);
 		playActorAnimation(884);
@@ -587,16 +587,16 @@
 			return true;
 		} else {
 			displayMessage(0x5722);
-	
+
 			scene->displayMessage("He's totally addicted.");
 		}
 		return true;
-		
+
 	case 0x4c1c:
 		playActorAnimation(960);
 		displayMessage(0x5511);
 		return true;
-		
+
 	case 0x4cac:
 		if (CHECK_FLAG(0xdbda, 1)) { //papers are shown
 			loadScene(5, 124, 199);
@@ -608,7 +608,7 @@
 		}
 		return true;
 
-	case 0x4cf1: { //talking with mansion guard 
+	case 0x4cf1: { //talking with mansion guard
 		SET_FLAG(0xda96, 1);
 		if (Dialog::pop(scene, 0xdaa6, 529) != 0x1b4)
 			return true;
@@ -626,9 +626,9 @@
 		inventory->add(0x13);
 		playAnimation(529, 1);
 		Dialog::pop(scene, 0xdaa6);
-		}
-		return true;
-		
+	}
+	return true;
+
 	case 0x4d94: //talking with fatso
 		Dialog::show(scene, 0x33bd);
 		displayMessage(0x49ae);
@@ -646,11 +646,11 @@
 		enableObject(15);
 		disableObject(8);
 		return true;
-	
+
 	case 0x4e61:
 		loadScene(14, 280, 198);
 		return true;
-		
+
 	case 0x4ee5:
 		setOns(2, 0);
 		playSound(5, 12);
@@ -667,8 +667,8 @@
 		playSound(5, 12);
 		playActorAnimation(547);
 		return true;
-	
-	
+
+
 	case 0x4eb9://Pick up wrapper
 		playSound(5, 12);
 		playSound(5, 18);
@@ -682,7 +682,7 @@
 		playActorAnimation(967);
 		displayMessage(0x3542);
 		return true;
-		
+
 	case 0x4f32: //use tree near the mansion
 		if (CHECK_FLAG(0xDBA1, 1)) {
 			if (CHECK_FLAG(0xDBA2, 1)) {
@@ -709,13 +709,13 @@
 			playSound(56, 8);
 			playSound(56, 12);
 			playSound(49, 10);
-			//there's some black magic here! investigate! 
+			//there's some black magic here! investigate!
 			playActorAnimation(587);
 			displayMessage(0x4652);
 			displayMessage(0x3668);
 		}
 		return true;
-		
+
 	case 0x500d: //picking up wild plant
 		if (CHECK_FLAG(0xDB9E, 1)) {
 			displayMessage(0x35E8); //there are no more
@@ -727,13 +727,13 @@
 			inventory->add(0x14);
 		}
 		return true;
-		
+
 	case 0x5104:
 		loadScene(11, 319, 198, 4); //orientation: left
-		if (CHECK_FLAG(0xDB9C, 1)) 
+		if (CHECK_FLAG(0xDB9C, 1))
 			return true;
 
-		SET_FLAG(0xDB9C, 1); //guard's drinking, boo! 
+		SET_FLAG(0xDB9C, 1); //guard's drinking, boo!
 		playAnimation(544, 1);
 		displayMessage(0x3563);
 		playSound(17);
@@ -745,7 +745,7 @@
 		SET_FLAG(0xDA96, 1);
 		SET_FLAG(0xDA97, 0);
 		return true;
-		
+
 	case 0x51f0:
 		setOns(0, 0);
 		playSound(5, 11);
@@ -753,28 +753,28 @@
 		disableObject(7);
 		inventory->add(49);
 		return true;
-		
+
 	case 0x5217:
-		displayMessage(CHECK_FLAG(0xDB9F, 1)? 0x402e: 0x34e1);
+		displayMessage(CHECK_FLAG(0xDB9F, 1) ? 0x402e : 0x34e1);
 		return true;
-		
+
 	case 0x5237:
 		if (!CHECK_FLAG(0xDB9F, 1)) {
 			displayMessage(0x34e1);
-		} else if (CHECK_FLAG(0xDBA0, 1)) 
+		} else if (CHECK_FLAG(0xDBA0, 1))
 			displayMessage(0x3E31);
 		else {
 			moveTo(173, 138, 2);
 			playSound(28, 5);
 			playActorAnimation(583);
 			playActorAnimation(584);
-			
+
 			debug(0, "FIXME: darken whole screen");
-			
+
 			playSound(72, 18);
 			playSound(73, 39);
 			playActorAnimation(585);
-			
+
 			loadScene(11, 194, 160, 2);
 			playSound(28, 2);
 			moveTo(138, 163, 3);
@@ -783,30 +783,30 @@
 			processCallback(0x9d45); //another mansion try
 		}
 		return true;
-		
+
 	case 0x55a8: {
-			uint16 d = Dialog::pop(scene, 0xdb08);
-			if (d == 0x2c5d) {
-				setOns(0, 0);
-				playSound(52, 9);
-				playSound(52, 11);
-				playSound(52, 13);
-				playSound(53, 32);
-				playAnimation(570, 1);
-				displayMessage(0x551f);
-				disableObject(5);
-				SET_FLAG(0xDBB0, 1);
-			} else if (d != 0x2c9b) {
-				playSound(52, 9);
-				playSound(52, 11);
-				playSound(52, 13);
-				playAnimation(569, 1);
-			}
-		} 
-		return true;
-		
+		uint16 d = Dialog::pop(scene, 0xdb08);
+		if (d == 0x2c5d) {
+			setOns(0, 0);
+			playSound(52, 9);
+			playSound(52, 11);
+			playSound(52, 13);
+			playSound(53, 32);
+			playAnimation(570, 1);
+			displayMessage(0x551f);
+			disableObject(5);
+			SET_FLAG(0xDBB0, 1);
+		} else if (d != 0x2c9b) {
+			playSound(52, 9);
+			playSound(52, 11);
+			playSound(52, 13);
+			playAnimation(569, 1);
+		}
+	}
+	return true;
+
 	case 0x5663:
-		displayMessage(CHECK_FLAG(0xDBB0, 1)? 0x41b1: 0x417e);
+		displayMessage(CHECK_FLAG(0xDBB0, 1) ? 0x41b1 : 0x417e);
 		return true;
 
 	case 0x569c:
@@ -814,14 +814,14 @@
 		playActorAnimation(983);
 		displayMessage(0x5955);
 		return true;
-		
+
 	case 0x56b7:
 		playSound(66, 5);
 		playSound(67, 11);
 		playActorAnimation(984);
 		displayMessage(0x5955);
 		return true;
-		
+
 	case 0x5728:
 		inventory->add(0x0d);
 		disableObject(14);
@@ -829,7 +829,7 @@
 		playSound(5, 10);
 		playActorAnimation(566);
 		return true;
-		
+
 	case 0x5793:
 		if (!CHECK_FLAG(0xDB94, 1)) {
 			displayMessage(0x3e63);
@@ -844,7 +844,7 @@
 			inventory->add(3);
 		}
 		return true;
-	
+
 	case 0x5d88:
 		if (CHECK_FLAG(0xDBA5, 1)) { //dry laundry
 			SET_FLAG(0xDBA5, 2);
@@ -866,7 +866,7 @@
 				displayMessage(0x34d5); //+orientation = 3
 		}
 		return true;
-		
+
 	case 0x5ff3: //get duster
 		if (CHECK_FLAG(0xDB9A, 0)) {
 			Dialog::pop(scene, 0xdaf6);
@@ -883,42 +883,42 @@
 	case 0x6205:
 		if (CHECK_FLAG(0xDBA4, 1))
 			displayMessage(0x450e);
-		else 
+		else
 			processCallback(0x61fe);
 		return true;
 
 	case 0x6217:
 		if (CHECK_FLAG(0xDBA4, 1))
 			displayMessage(0x44d6);
-		else 
+		else
 			processCallback(0x61fe);
 		return true;
-		
+
 	case 0x62c1:
 		if (CHECK_FLAG(0xDBA4, 1))
 			return false;
-		
+
 		processCallback(0x61fe);
 		return true;
-		
+
 	case 0x63bc:
 		playMusic(6);
 		loadScene(25, 151, 156, 2);
 		return true;
-		
+
 	case 0x646e:
 	case 0x6475:
 		Dialog::show(scene, 0x32C1);
 		return true;
-		
+
 	case 0x6507:
 		if (CHECK_FLAG(0xDB96, 1)) {
 			rejectMessage();
-		} else 
+		} else
 			displayMessage(0x47e7);
 		return true;
-		
-	case 0x65c3: 
+
+	case 0x65c3:
 		if (CHECK_FLAG(0xDBA9, 1)) {
 			playActorAnimation(635);
 			setOns(5, 0);
@@ -932,7 +932,7 @@
 			displayMessage(0x3b83);
 			SET_FLAG(0xDBA9, 2);
 			SET_FLAG(0xDBA8, 0);
-		} else 
+		} else
 			displayMessage(0x4808);
 		return true;
 
@@ -940,66 +940,66 @@
 		if (CHECK_FLAG(0xdbdd, 3)) {
 			displayMessage(0x55ff);
 			return true;
-		} else 
+		} else
 			return false;
 
 	case 0x7878: {
 		byte v = res->dseg.get_byte(0xDBDB) + 1;
 		if (v <= 6)
 			SET_FLAG(0xDBDB, v);
-		
-		switch(v) {
-		case 1: 
+
+		switch (v) {
+		case 1:
 			displayMessage(0x5411);
 			return true;
-		case 2: 
+		case 2:
 			displayMessage(0x5463);
 			return true;
-		case 3: 
+		case 3:
 			displayMessage(0x5475);
 			return true;
-		case 4: 
+		case 4:
 			displayMessage(0x5484);
 			return true;
-		case 5: 
+		case 5:
 			displayMessage(0x54c4);
 			return true;
-		default: 
+		default:
 			displayMessage(0x54d5);
 			return true;
 		}
 	}
-	
+
 	case 0x78a9:
 		if (CHECK_FLAG(0xDBE6, 1)) {
 			displayMessage(0x5827);
 			return true;
 		} else
 			return false;
-		
+
 	case 0x78bb:
 		if (CHECK_FLAG(0xDBE8, 1)) {
 			displayMessage(0x58b0);
 			return true;
 		} else
 			return false;
-		
+
 	case 0x78ce:
 		if (!CHECK_FLAG(0xDBA1, 1)) {
 			displayMessage(0x3694);
 			return true;
-		} else 
+		} else
 			return false;
-			
+
 	case 0x792b: //left click on ann
 		moveTo(245, 198, 1);
-		if (CHECK_FLAG(0xDBAF, 1)) 
+		if (CHECK_FLAG(0xDBAF, 1))
 			return false;
-		
+
 		Dialog::show(scene, 0x2193);
 		SET_FLAG(0xDBAF, 1);
 		return true;
-		
+
 	case 0x79c3:
 		if (CHECK_FLAG(0xDBA4, 1))
 			return false;
@@ -1017,7 +1017,7 @@
 		disableObject(4);
 		SET_FLAG(0xDBE1, 1);
 		return true;
-		
+
 	case 0x7b89: //digging mysterious object
 		if (CHECK_FLAG(0xDBE1, 1)) {
 			playActorAnimation(844);
@@ -1031,10 +1031,10 @@
 			disableObject(3);
 			inventory->add(0x52);
 			inventory->remove(0x51);
-		} else 
+		} else
 			displayMessage(0x56da);
 		return true;
-		
+
 	case 0x7bfd:
 		playSound(76, 18);
 		playSound(76, 22);
@@ -1057,7 +1057,7 @@
 		enableObject(6);
 		disableObject(1);
 		return true;
-	
+
 	case 0x7ce5: //put spring on the solid ground
 		playSound(5, 2);
 		playActorAnimation(840);
@@ -1090,11 +1090,11 @@
 			setLan(1, 1);
 
 			Dialog::show(scene, 0x6406, 832);
-			
+
 			//playAnimation(831, 1);
-			
+
 			SET_FLAG(0xDBDF, 2);
-			
+
 		} else
 			displayMessage(0x52f6);
 		return true;
@@ -1107,14 +1107,14 @@
 			playActorAnimation(834, true);
 			playAnimation(835, 1, true);
 			waitAnimation();
-			
+
 			setOns(0, 94);
 			Dialog::show(scene, 0x65e9, 832);
 			enableObject(12);
 			SET_FLAG(0xdbe0, 1);
 		}
 		return true;
-		
+
 	case 0x7e4f: //giving magazine to captain
 		playSound(5, 3);
 		Dialog::show(scene, 0x66c0);
@@ -1137,14 +1137,14 @@
 		SET_FLAG(0xDBF0, 1);
 		loadScene(8, 155, 199);
 		return true;
-		
+
 	case 0x7fbd: //using bird & bartender
 		playSound(5, 3);
 		playActorAnimation(876);
 		setOns(1, 0);
 		playAnimation(877, 2);
 		playAnimation(880, 2, true);
-		
+
 		Dialog::show(scene, 0x6f0e, 857);
 		setOns(2, 0x6a);
 		reloadLan();
@@ -1154,7 +1154,7 @@
 		enableObject(1);
 		SET_FLAG(0xDBE7, 1);
 		return true;
-		
+
 	case 0x8047:
 		playSound(32, 5);
 		playActorAnimation(881);
@@ -1164,7 +1164,7 @@
 		SET_FLAG(0xDBE8, 1);
 		return true;
 
-	case 0x808b: 
+	case 0x808b:
 		if (CHECK_FLAG(0xDBDA, 1)) {
 			//alredy shown
 			displayMessage(0x53F2);
@@ -1177,14 +1177,14 @@
 			SET_FLAG(0xDBDA, 1);
 		}
 		return true;
-		
+
 	case 0x80c3: //show kaleydoscope to the guard
 		Dialog::show(scene, 0x6811, 809);
 		playSound(5, 3);
 		playActorAnimation(849, true);
 		playAnimation(851, 1, true);
 		waitAnimation();
-		
+
 		playAnimation(850, 1);
 		reloadLan();
 		inventory->add(0x53);
@@ -1193,8 +1193,8 @@
 		SET_FLAG(0xDBE2, 1);
 		return true;
 
-	//Shore
-	
+		//Shore
+
 	case 0x5348:
 		if (CHECK_FLAG(0xdb99, 1)) { //got broken paddle from boat
 			displayMessage(0x351f);
@@ -1211,7 +1211,7 @@
 		if (CHECK_FLAG(0xdbb2, 1)) { //spoken to man in well
 			displayMessage(0x411d);
 		} else {
-			SET_FLAG(0xDBB2, 1);	
+			SET_FLAG(0xDBB2, 1);
 			displayMessage(0x408a);
 			displayMessage(0x4091);
 			displayMessage(0x4098);
@@ -1222,26 +1222,26 @@
 			displayMessage(0x410f);
 		}
 		return true;
-	
-	
+
+
 	case 0x5458: {
 		setOns(2, 0);
 		playSound(34, 7);
 		playActorAnimation(535);
 		inventory->add(11);
 		disableObject(1);
-		
+
 		byte * scene_15_ons = scene->getOns(15); //patch ons for the scene 15
 		scene_15_ons[0] = 0;
-		
+
 		byte f = GET_FLAG(0xDB98) + 1;
 		SET_FLAG(0xDB98, f);
 		if (f >= 2) {
 			//disable object boat for scene 15!!
 			scene->getObject(1, 15)->enabled = 0;
 		}
-		}
-		return true;
+	}
+	return true;
 
 	case 0x54b3: {
 		setOns(1, 0);
@@ -1260,9 +1260,9 @@
 			//disable object boat for scene 15!!
 			scene->getObject(1, 15)->enabled = 0;
 		}
-		}
-		return true;
-		
+	}
+	return true;
+
 	case 0x5502:
 		setOns(0, 0);
 		loadScene(15, 115, 180, 1);
@@ -1274,15 +1274,15 @@
 		processCallback(0x557e);
 		loadScene(19, 223, 119, 1);
 		return true;
-	
+
 	case 0x557e:
 		//scaled moveTo
 		if (scene->getPosition().y <= 149)
 			moveTo(94, 115, 4);
-		else 
+		else
 			moveTo(51, 149, 4);
 		return true;
-		
+
 	case 0x563b:
 		playSound(5, 10);
 		setOns(1, 0);
@@ -1290,7 +1290,7 @@
 		inventory->add(26);
 		disableObject(6);
 		return true;
-		
+
 	case 0x56f6:
 		playSound(32, 7);
 		setOns(1, 0);
@@ -1321,15 +1321,15 @@
 		playActorAnimation(509);
 		displayMessage(0x5dce);
 		return true;
-		
+
 	case 0x58a2:
 		Dialog::pop(scene, 0xdaba);
 		strcpy(scene->getObject(13)->name, (const char *)res->dseg.ptr(0x92e5));
 		return true;
-	
+
 	case 0x58b7://Get comb from car
 		disableObject(14);
-		setOns(4,0);
+		setOns(4, 0);
 		playSound(5, 7);
 		playActorAnimation(521);
 		setOns(4, 0);
@@ -1342,23 +1342,23 @@
 		setOns(3, 6);
 		playActorAnimation(515);
 		return true;
-	
+
 	case 0x593e://Enter annes house
 		playSound(89, 4);
 		playActorAnimation(980);
 		loadScene(23, 76, 199, 1);
-		if (CHECK_FLAG(0xDBEE, 1)) 
+		if (CHECK_FLAG(0xDBEE, 1))
 			playMusic(7);
 		return true;
-		
+
 	case 0x5994:
 		processCallback(0x599b);
 		processCallback(0x5a21);
 		return true;
-		
+
 	case 0x599b:
 		return true;
-		
+
 	case 0x5a21:
 		loadScene(24, 230, 170, 1);
 		playSound(52, 3);
@@ -1402,7 +1402,7 @@
 	case 0x5b3a://Click on dog
 		Dialog::pop(scene, 0xDB14);
 		return true;
-		
+
 	case 0x5b59: //picking up the rope
 		Dialog::show(scene, 0x2cbd);
 		Dialog::show(scene, 0x2dc2);
@@ -1423,21 +1423,21 @@
 	case 0x5be1://Talk to grandpa
 		Dialog::pop(scene, 0xDAC4);
 		return true;
-	
+
 	case 0x5c0d: //grandpa - drawers
 		if (CHECK_FLAG(0xDBA7, 1)) {
 			displayMessage(0x3bac);
 		} else {
 			if (!CHECK_FLAG(0xDB92, 1))
 				Dialog::show(scene, 0x15a0); //can I search your drawers?
-			
+
 			playSound(66);
 			playActorAnimation(631);
 			inventory->add(47);
 			SET_FLAG(0xDBA7, 1);
 		}
 		return true;
-		
+
 	case 0x5c84:
 		if (CHECK_FLAG(0xDB92, 1)) {
 			inventory->add(2);
@@ -1449,13 +1449,13 @@
 			Dialog::pop(scene, 0xDACE);
 		}
 		return true;
-	
+
 	case 0x5cf0://Exit basketball house
 		playSound(88, 5);
 		playActorAnimation(981);
 		loadScene(20, 161, 165);
 		return true;
-		
+
 	case 0x5d24: //getting the fan
 		if (CHECK_FLAG(0xDB92, 1)) {
 			setLan(2, 0);
@@ -1467,7 +1467,7 @@
 			Dialog::pop(scene, 0xDAD4);
 		}
 		return true;
-		
+
 	case 0x5e4d: //right click on ann
 		if (!CHECK_FLAG(0xDB97, 0)) {
 			displayMessage(0x3d59);
@@ -1475,15 +1475,15 @@
 			moveTo(245, 198, 1);
 			Dialog::show(scene, 0x21d7);
 			SET_FLAG(0xDB97, 1);
-			for(byte i = 10; i <= 20; i += 2)
+			for (byte i = 10; i <= 20; i += 2)
 				playSound(13, i);
 			playAnimation(528, 1);
 			playMusic(7);
 			SET_FLAG(0xDBEE, 1);
-			for(byte i = 3; i <= 17; i += 2)
+			for (byte i = 3; i <= 17; i += 2)
 				playSound(56, i);
 			playActorAnimation(525);
-			for(byte i = 1; i <= 13; i += 2)
+			for (byte i = 1; i <= 13; i += 2)
 				playSound(56, i);
 			playSound(40, 15);
 			playSound(40, 18);
@@ -1503,7 +1503,7 @@
 		loadScene(21, 161, 165);
 
 		return true;
-		
+
 	case 0x5fba:
 		if (CHECK_FLAG(0xDBB1, 1)) {
 			displayMessage(0x4380);
@@ -1511,7 +1511,7 @@
 			Dialog::pop(scene, 0xDAFC);
 		}
 		return true;
-		
+
 	case 0x607f:
 		processCallback(0x60b5);
 		return true;
@@ -1526,7 +1526,7 @@
 		} else
 			processCallback(0x60b5);
 		return true;
-		
+
 	case 0x60b5:
 		if (CHECK_FLAG(0xDBAE, 1)) {
 			processCallback(0x60d9);
@@ -1537,15 +1537,15 @@
 			Dialog::show(scene, 0x2e6d);
 		}
 		return true;
-		
+
 	case 0x60d9: {
-			Object *obj = scene->getObject(3);
-			moveTo(obj);
-			processCallback(0x612b);
-			moveTo(48, 190, 3);
-		}
-		return true;
-	
+		Object *obj = scene->getObject(3);
+		moveTo(obj);
+		processCallback(0x612b);
+		moveTo(48, 190, 3);
+	}
+	return true;
+
 	case 0x612b:
 		playSound(52, 10);
 		playSound(52, 14);
@@ -1557,7 +1557,7 @@
 		playActorAnimation(600);
 		loadScene(21, 297, 178, 3);
 		return true;
-		
+
 	case 0x6176:
 		if (CHECK_FLAG(0xDBA4, 1)) {
 			displayMessage(0x3801);
@@ -1572,22 +1572,22 @@
 		disableObject(1);
 		SET_FLAG(0xDBA4, 1);
 		loadScene(24, scene->getPosition());
-		
+
 		return true;
-		
+
 	case 0x61e9:
 		if (CHECK_FLAG(0xDBA4, 1)) {
 			Dialog::pop(scene, 0xdb1e);
 		} else
 			processCallback(0x61fe);
-		
+
 		return true;
-		
+
 	case 0x6229: //shelves in cellar
 		if (CHECK_FLAG(0xDBA4, 1)) {
 			Common::Point p = scene->getPosition();
 			byte v = GET_FLAG(0xDBB4);
-			switch(v) {
+			switch (v) {
 			case 0:
 				displayMessage(0x4532);
 				moveRel(-34, 0, 1);
@@ -1609,11 +1609,11 @@
 			default:
 				displayMessage(0x4603);
 			}
-		} else 
+		} else
 			processCallback(0x61fe);
-		
+
 		return true;
-		
+
 	case 0x6480: //dive mask
 		if (CHECK_FLAG(0xDB96, 1)) {
 			setOns(3, 36);
@@ -1623,10 +1623,10 @@
 			inventory->add(39);
 			disableObject(5);
 			displayMessage(0x387c);
-		} else 
+		} else
 			displayMessage(0x3eb2);
 		return true;
-	
+
 	case 0x64c4: //flippers
 		if (CHECK_FLAG(0xDB96, 1)) {
 			setOns(2, 35);
@@ -1635,7 +1635,7 @@
 			playActorAnimation(612);
 			inventory->add(40);
 			disableObject(6);
-		} else 
+		} else
 			displayMessage(0x3eb2);
 		return true;
 
@@ -1643,7 +1643,7 @@
 		if (CHECK_FLAG(0xdb94, 1)) {//Already pulled lever?
 			displayMessage(0x3e4f);
 			return true;
-		} else 
+		} else
 			return false;
 
 	case 0x62d0://Get bone from under rock
@@ -1663,10 +1663,10 @@
 		if (CHECK_FLAG(0xdaca, 1)) { //cave bush is cut down
 			playMusic(8);
 			loadScene(26, 319, 169, 4);
-		} else 
-			displayMessage(0x3bd2);			
+		} else
+			displayMessage(0x3bd2);
 		return true;
-		
+
 	case 0x63ea:
 		playSound(5, 10);
 		setOns(0, 0);
@@ -1691,13 +1691,13 @@
 			displayMessage(0x3df4);
 			return true;
 		}
-	
+
 	case 0x6592: //Rake
 		setOns(1, 0);
 		playSound(18, 10);
 		playActorAnimation(553);
 		inventory->add(0x15);
-		displayMessage(0x3605);	
+		displayMessage(0x3605);
 		disableObject(11);
 		return true;
 
@@ -1706,7 +1706,7 @@
 		playActorAnimation(969);
 		loadScene(33, 319, 181, 4);
 		return true;
-	
+
 	case 0x6519://Sickle
 		setOns(4, 0);
 		playSound(5, 11);
@@ -1714,7 +1714,7 @@
 		inventory->add(0x2c);
 		disableObject(8);
 		return true;
-	
+
 	case 0x655b://Get needle from haystack
 		if (CHECK_FLAG(0xdabb, 1)) { //already have needle
 			displayMessage(0x356a);
@@ -1734,29 +1734,29 @@
 		playActorAnimation(511);
 		inventory->add(1);
 		disableObject(15);
-		return true;	
+		return true;
 
 	case 0x667c:
 		playSound(70, 4);
 		playActorAnimation(972);
 		loadScene(29, 160, 199, 1);
 		return true;
-		
+
 	case 0x66a9:
 		displayMessage(0x4a7e);
 		disableObject(4);
 		return true;
-		
+
 	case 0x66e2:
 		playSound(88, 4);
 		playActorAnimation(970);
 		loadScene(35, 160, 199, 1);
 		return true;
-		
+
 	case 0x70bb:
 		Dialog::pop(scene, 0xdb24, 709);
 		return true;
-		
+
 	case 0x71ae:
 		if (CHECK_FLAG(0xDBCD, 1)) {
 			if (CHECK_FLAG(0xDBCE, 1)) {
@@ -1771,14 +1771,14 @@
 		} else
 			Dialog::show(scene, 0x3c9d);
 		return true;
-		
+
 	case 0x70c8:
 		if (!processCallback(0x70e0))
 			return true;
 		moveTo(81, 160, 4);
 		displayMessage(0x5cac);
 		return true;
-		
+
 	case 0x70e0:
 		if (!CHECK_FLAG(0xDBCC, 1)) {
 			displayMessage(0x4ece);
@@ -1791,20 +1791,20 @@
 			return true;
 		displayMessage(0x5046);
 		return true;
-		
+
 	case 0x70f9:
 		if (inventory->has(68)) {
 			inventory->remove(68);
 			loadScene(29, 40, 176, 2);
 			displayMessage(0x500a);
-		} else 
+		} else
 			loadScene(29, 40, 176, 2);
 		return true;
-		
+
 	case 0x712c:
 		if (!processCallback(0x70e0))
 			return true;
-		
+
 		if (CHECK_FLAG(0xDBCF, 1)) {
 			playSound(89, 4);
 			playActorAnimation(719);
@@ -1822,7 +1822,7 @@
 			SET_FLAG(0xDBCF, 1);
 		}
 		return true;
-		
+
 	case 0x71eb:
 		setOns(2, 0);
 		playSound(32, 7);
@@ -1831,13 +1831,13 @@
 		disableObject(7);
 		enableObject(8);
 		return true;
-		
+
 	case 0x7244:
 		if (!processCallback(0x70e0))
 			return true;
 		displayMessage(0x5c60);
 		return true;
-		
+
 	case 0x7255:
 		if (CHECK_FLAG(0xDBD0, 1)) {
 			setOns(4, 69);
@@ -1850,7 +1850,7 @@
 			displayMessage(0x505e);
 		}
 		return true;
-		
+
 	case 0x721c:
 		setOns(3, 0);
 		playSound(32, 7);
@@ -1858,7 +1858,7 @@
 		inventory->add(63);
 		disableObject(9);
 		return true;
-		
+
 	case 0x7336:
 		setOns(1, 0);
 		playSound(5, 42);
@@ -1867,11 +1867,11 @@
 		inventory->add(56);
 		disableObject(1);
 		return true;
-		
+
 	case 0x73a3:
 		if (CHECK_FLAG(0xdbc5, 1)) {
 			SET_FLAG(0xdbc5, 0);
-			
+
 			//call 73e6
 			playSound(71, 3);
 			playActorAnimation(700);
@@ -1881,23 +1881,23 @@
 
 			//call 73e6
 			playSound(71, 3);
-			playActorAnimation(700);		
+			playActorAnimation(700);
 
-			playAnimation(CHECK_FLAG(0xDBC6, 0)? 701:702, 1);
-			
+			playAnimation(CHECK_FLAG(0xDBC6, 0) ? 701 : 702, 1);
+
 			if (CHECK_FLAG(0xDBC6, 1)) {
 				displayMessage(0x4da6);
 			}
 		}
 		return true;
-		
+
 	case 0x7381:
 		playSound(5, 12);
 		playActorAnimation(704);
 		disableObject(2);
 		inventory->add(58);
 		return true;
-		
+
 	case 0x7408:
 		if (CHECK_FLAG(0xDBC4, 1)) {
 			displayMessage(0x4d2a);
@@ -1917,7 +1917,7 @@
 			SET_FLAG(0xDBC4, 1);
 		}
 		return true;
-		
+
 	case 0x7476:
 		if (CHECK_FLAG(0xDBC9, 1)) {
 			displayMessage(0x4dbb);
@@ -1931,7 +1931,7 @@
 			inventory->add(59);
 		}
 		return true;
-		
+
 	case 0x74d1:
 		setOns(2, 0);
 		playSound(5, 12);
@@ -1967,8 +1967,8 @@
 				playActorAnimation(779, true);
 				playAnimation(780, 1, true);
 				waitAnimation();
-				
-				for(byte i = 1; i <= 6; ++i)
+
+				for (byte i = 1; i <= 6; ++i)
 					playSound(58, i);
 				playSound(58, 10);
 				playSound(2, 7);
@@ -1979,7 +1979,7 @@
 				waitAnimation();
 				setOns(1, 75);
 				setOns(2, 76);
-				for(byte i = 1; i <= 6; ++i)
+				for (byte i = 1; i <= 6; ++i)
 					playSound(58, i);
 				playSound(58, 9);
 				playSound(2, 7);
@@ -1996,7 +1996,7 @@
 				playAnimation(785, 2, true);
 				playAnimation(786, 3, true);
 				waitAnimation();
-				
+
 				moveTo(112, 183, 2);
 				setOns(3, 79);
 				setOns(0, 0);
@@ -2011,11 +2011,11 @@
 				playAnimation(789, 2, true);
 				playAnimation(790, 3, true);
 				waitAnimation();
-				
+
 				setOns(0, 80);
 				Dialog::show(scene, 0x5665);
 				playAnimation(792, 3);
-				
+
 				moveTo(40, 171, 4);
 				setOns(3, 81, 35);
 				enableObject(12, 35);
@@ -2025,14 +2025,14 @@
 			} else {
 				displayMessage(0x52fe);
 			}
-		} else 
+		} else
 			displayMessage(0x52cb);
 		return true;
-		
+
 	case 0x783d:
 		Dialog::pop(scene, 0xdb36, 797);
 		return true;
-		
+
 	case 0x7ad0:
 	case 0x7ad7:
 		return !processCallback(0x70e0);
@@ -2063,18 +2063,17 @@
 			displayMessage(0x5de2);
 		}
 		return true;
-		
-	case 0x505c:
-		{
-			//suspicious stuff
-			Common::Point p = scene->getPosition();
-			if (p.x != 203 && p.y != 171) 
-				moveTo(203, 169, 2);
-			else 
-				moveTo(203, 169, 1);
-		}
-		return true;
-		
+
+	case 0x505c: {
+		//suspicious stuff
+		Common::Point p = scene->getPosition();
+		if (p.x != 203 && p.y != 171)
+			moveTo(203, 169, 2);
+		else
+			moveTo(203, 169, 1);
+	}
+	return true;
+
 	case 0x509a:
 		processCallback(0x505c);
 		setOns(1, 0);
@@ -2083,10 +2082,10 @@
 		inventory->add(15);
 		disableObject(9);
 		return true;
-		
+
 	case 0x7802:
 		if (CHECK_FLAG(0xDBD7, 1)) {
-			if (CHECK_FLAG(0xDBD8, 1)) 
+			if (CHECK_FLAG(0xDBD8, 1))
 				displayMessage(0x52f6);
 			else {
 				playSound(71, 4);
@@ -2094,10 +2093,10 @@
 				setLan(1, 0);
 				SET_FLAG(0xDBD8, 1);
 			}
-		} else 
+		} else
 			displayMessage(0x52cb);
 		return true;
-		
+
 	case 0x78e0:
 		processCallback(0x50c5);
 		return false;
@@ -2109,20 +2108,20 @@
 	case 0x78ee:
 		processCallback(0x557e);
 		return false;
-		
+
 	case 0x78f5:
 		if (CHECK_FLAG(0xDB95, 1)) {
 			displayMessage(0x3575);
 			return true;
 		} else
 			return false;
-		
+
 	case 0x7919:
 		if (!CHECK_FLAG(0xDBA5, 1))
 			return false;
 		displayMessage(0x3E98);
 		return true;
-		
+
 	case 0x7950:
 		if (!CHECK_FLAG(0xDBB1, 1))
 			return false;
@@ -2143,12 +2142,12 @@
 		if (CHECK_FLAG(0xDBA4, 1))
 			return false;
 		return processCallback(0x61fe);
-		
+
 	case 0x7af0:
 		if (!processCallback(0x70e0))
 			return true;
 		return false;
-		
+
 	case 0x8117:
 		Dialog::show(scene, 0x0a41, 529);
 		playSound(5, 2);
@@ -2163,7 +2162,7 @@
 		inventory->remove(50);
 		processCallback(0x9d45);
 		return true;
-		
+
 	case 0x8174:
 		setOns(0, 0);
 		playSound(5, 2);
@@ -2176,7 +2175,7 @@
 		disableObject(3);
 		enableObject(9);
 		return true;
-		
+
 	case 0x81c2:
 		playSound(56, 11);
 		playSound(36, 13);
@@ -2198,11 +2197,11 @@
 
 	case 0x823d: //grappling hook on the wall
 		playSound(5, 3);
-		for(byte i = 16; i <= 28; i += 2)
+		for (byte i = 16; i <= 28; i += 2)
 			playSound(65, i);
 		playSound(47, 33);
 		playActorAnimation(620);
-		for(byte i = 3; i <= 18; i += 3)
+		for (byte i = 3; i <= 18; i += 3)
 			playSound(56, i);
 		playActorAnimation(621, true);
 		playAnimation(623, 1, true);
@@ -2214,8 +2213,8 @@
 		inventory->remove(43);
 		processCallback(0x9d45);
 		return true;
-		
-		
+
+
 	case 0x8312: //hedgehog + plastic apple
 		Dialog::show(scene, 0x3000);
 		setLan(1, 0);
@@ -2232,13 +2231,13 @@
 		playActorAnimation(562, true);
 		playAnimation(563, 1, true);
 		waitAnimation();
-		
+
 		disableObject(6);
 		displayMessage(0x363f);
 		inventory->remove(27);
 		inventory->add(28);
 		return true;
-		
+
 	case 0x839f:
 		inventory->remove(32);
 		playSound(37, 14);
@@ -2253,7 +2252,7 @@
 		playAnimation(571, 1);
 		playAnimation(572, 1);
 		playAnimation(573, 1);
-		for(byte i = 1; i <= 7; i += 2)
+		for (byte i = 1; i <= 7; i += 2)
 			playSound(40, i);
 		playAnimation(574, 1);
 		setLan(1, 0);
@@ -2268,7 +2267,7 @@
 		disableObject(2);
 		SET_FLAG(0xDB9F, 1);
 		return true;
-		
+
 	case 0x84c7:
 		playSound(20, 9);
 		playActorAnimation(530);
@@ -2281,7 +2280,7 @@
 		moveTo(236, 95, 1, true);
 		playMusic(9);
 		return true;
-	
+
 	case 0x8538://Sharpen sickle on well
 		moveTo(236, 190, 0);
 		setOns(2, 0);
@@ -2296,7 +2295,7 @@
 		inventory->remove(0x2c);
 		inventory->add(0x2e);
 		return true;
-		
+
 	case 0x85eb:
 		if (CHECK_FLAG(0xDBB0, 1)) {
 			enableObject(6);
@@ -2306,9 +2305,9 @@
 			playActorAnimation(559);
 			setOns(1, 23);
 			SET_FLAG(0xDBB0, 2);
-		} else 
+		} else
 			displayMessage(0x3d86);
-		
+
 		return true;
 
 	case 0x863d:
@@ -2328,7 +2327,7 @@
 		inventory->remove(12);
 		inventory->add(33);
 		return true;
-		
+
 	case 0x86a9: //correcting height of the pole with spanner
 		if (CHECK_FLAG(0xDB92, 1)) {
 			displayMessage(0x3d40);
@@ -2386,7 +2385,7 @@
 			scene->getObject(8)->actor_rect.top = 171;
 		}
 		return true;
-		
+
 	case 0x88c9: //give flower to old lady
 		if (CHECK_FLAG(0xDB9A, 1))
 			return processCallback(0x890b);
@@ -2403,7 +2402,7 @@
 		playAnimation(538, 1);
 		Dialog::show(scene, 0x1BE0, 523);
 		return true;
-	
+
 	case 0x890b:
 		Dialog::pop(scene, 0xDAF0);
 		return true;
@@ -2411,12 +2410,12 @@
 	case 0x8918://give flower to old lady
 		if (CHECK_FLAG(0xDB9A, 1))
 			return processCallback(0x890B);
-		
+
 		inventory->remove(11);
 		SET_FLAG(0xDB9A, 1);
 		processCallback(0x88DE);
 		return true;
-		
+
 	case 0x892d:
 		if (CHECK_FLAG(0xDB9B, 1))
 			return processCallback(0x89aa);
@@ -2425,7 +2424,7 @@
 		inventory->remove(10);
 		SET_FLAG(0xDB9B, 1);
 		return true;
-	
+
 	case 0x8942:
 		Dialog::show(scene, 0x2293);
 		playSound(5, 10);
@@ -2438,20 +2437,20 @@
 		moveTo(scene->getPosition().x, scene->getPosition().y + 1, 0);
 		Dialog::show(scene, 0x2570);
 		return true;
-	
+
 	case 0x89aa:
 		Dialog::pop(scene, 0xdb02);
 		return true;
-		
+
 	case 0x89b7:
-		if (CHECK_FLAG(0xDB9B, 1)) 
+		if (CHECK_FLAG(0xDB9B, 1))
 			return processCallback(0x89aa);
-		
+
 		processCallback(0x8942);
 		inventory->remove(11);
 		SET_FLAG(0xDB9B, 1);
 		return true;
-		
+
 	case 0x89cc:
 		inventory->remove(23);
 		playSound(5, 6);
@@ -2461,11 +2460,11 @@
 		waitAnimation();
 		playActorAnimation(557, true);
 		playAnimation(558, 1, true);
-		waitAnimation();		
+		waitAnimation();
 		Dialog::show(scene, 0x2971);
 		inventory->add(24);
 		return true;
-		
+
 	case 0x8a22:
 		playSound(45, 16);
 		playActorAnimation(560);
@@ -2475,7 +2474,7 @@
 		Dialog::show(scene, 0x1f09);
 		SET_FLAG(0xDBB1, 1);
 		return true;
-		
+
 	case 0x8a6f: //banknote + ann
 		if (CHECK_FLAG(0xDBB5, 1)) {
 			Dialog::show(scene, 0x2992);
@@ -2505,7 +2504,7 @@
 		} else
 			displayMessage(0x4a29);
 		return true;
-		
+
 	case 0x8b82: //use fan on laundry
 		setOns(0, 0);
 		playSound(5);
@@ -2522,15 +2521,15 @@
 		playActorAnimation(657, true);
 		playAnimation(658, 1, true);
 		waitAnimation();
-		
+
 		playAnimation(659, 1);
-		
+
 		displayMessage(0x3c3d);
 		inventory->remove(36);
 		SET_FLAG(0xDBAD, 1);
 		//TODO:Adjust Walkboxes
 		return true;
-	
+
 	case 0x8c6e://Use car jack on rock
 		playSound(5, 3);
 		playActorAnimation(592);
@@ -2560,14 +2559,14 @@
 		inventory->remove(0x2e);
 		disableObject(2);
 		return true;
-		
+
 	case 0x8d57:
 		playSound(5, 2);
 		playSound(15, 12);
 		playActorAnimation(638);
 		inventory->remove(48);
 		//fixme: add time challenge here!
-		
+
 		/*
 		inventory->add(48);
 		playSound(24, 26);
@@ -2579,7 +2578,7 @@
 		playSound(52, 13);
 		setOns(1, 46);
 		inventory->remove(49);
-		
+
 		//third part
 		playActorAnimation(649);
 		setOns(1, 47);
@@ -2591,13 +2590,13 @@
 		disableObject(5);
 		SET_FLAG(0xDBAB, 1);
 		return true;
-		
+
 	case 0x8f1d:
 		Dialog::show(scene, 0x2dd6);
 		setLan(3, 0);
 		setLan(4, 0);
 		displayMessage(0x34c7);
-		for(uint i = 16; i <= 30; i += 2) 
+		for (uint i = 16; i <= 30; i += 2)
 			playSound(56, i);
 		playSound(2, 64);
 		playSound(3, 74);
@@ -2610,7 +2609,7 @@
 		inventory->remove(2);
 		SET_FLAG(0xDB96, 1);
 		return true;
-		
+
 	case 0x8fc8:
 		displayMessage(0x3b2f);
 		playSound(5, 3);
@@ -2635,7 +2634,7 @@
 			displayMessage(0x3b59);
 		}
 		return true;
-		
+
 	case 0x9054: //mouse hole
 		if (CHECK_FLAG(0xDBAB, 1)) {
 			displayMessage(0x3c0b);
@@ -2655,7 +2654,7 @@
 			}
 		}
 		return true;
-		
+
 	case 0x933d:
 		if (!processCallback(0x70e0))
 			return true;
@@ -2664,7 +2663,7 @@
 			displayMessage(0x4f3d);
 			return true;
 		}
-		
+
 		setOns(1, 0);
 		playSound(5, 3);
 		playSound(5, 33);
@@ -2679,7 +2678,7 @@
 		setOns(1, 66);
 		SET_FLAG(0xDBCD, 1);
 		return true;
-		
+
 	case 0x93af: //sheet + hot plate
 		if (!processCallback(0x70e0))
 			return true;
@@ -2689,7 +2688,7 @@
 		inventory->add(68);
 		inventory->remove(55);
 		return true;
-		
+
 	case 0x93d5: //burning sheet + plate
 		setOns(4, 0);
 		playSound(87, 7);
@@ -2725,7 +2724,7 @@
 		return true;
 
 
-	//very last part of the game: 
+		//very last part of the game:
 	case 0x671d:
 		moveTo(153, 163, 4);
 		playActorAnimation(973);
@@ -2734,13 +2733,13 @@
 		}
 		loadScene(30, 18, 159, 2);
 		return true;
-		
+
 	case 0x67a6:
 		loadScene(29, 149, 163, 1);
 		playActorAnimation(974);
 		moveTo(160, 188, 0);
 		return true;
-		
+
 	case 0x6805:
 		processCallback(0x6849);
 		playActorAnimation(694);
@@ -2751,17 +2750,16 @@
 		inventory->add(54);
 		disableObject(4);
 		return true;
-		
-	case 0x6849:
-		{
-			Common::Point p = scene->getPosition();
-			if (p.x == 208 && p.y == 151) {
-				moveRel(0, 0, 2);
-			} else 
-				moveTo(208, 151, 1);
-		}
-		return true;
-		
+
+	case 0x6849: {
+		Common::Point p = scene->getPosition();
+		if (p.x == 208 && p.y == 151) {
+			moveRel(0, 0, 2);
+		} else
+			moveTo(208, 151, 1);
+	}
+	return true;
+
 	case 0x687a: //using the book
 		if (CHECK_FLAG(0xDBC2, 1)) {
 			displayMessage(0x4ca0);
@@ -2784,21 +2782,20 @@
 			}
 		}
 		return true;
-		
-	case 0x68e6: //checking drawers
-		{
-			uint16 v = GET_FLAG(0xDBC1) - 1;
-			uint bx = 0xDBB7;
-			if (GET_FLAG(bx + v) != 1)
-				return false;
 
-			uint16 sum = 0;
-			for(uint i = 0; i < 6; ++i) {
-				sum += GET_FLAG(bx + i);
-			}
-			return sum == 1;
+	case 0x68e6: { //checking drawers
+		uint16 v = GET_FLAG(0xDBC1) - 1;
+		uint bx = 0xDBB7;
+		if (GET_FLAG(bx + v) != 1)
+			return false;
+
+		uint16 sum = 0;
+		for (uint i = 0; i < 6; ++i) {
+			sum += GET_FLAG(bx + i);
 		}
-		
+		return sum == 1;
+	}
+
 	case 0x6918:
 		if (inventory->has(55)) {
 			displayMessage(0x4cd9);
@@ -2809,12 +2806,12 @@
 			Dialog::show(scene, 0x386a);
 			SET_FLAG(0xDBC3, 1);
 		}
-		
+
 		playSound(5, 11);
 		playActorAnimation(696);
 		inventory->add(55);
 		return true;
-		
+
 	case 0x6962:
 		if (CHECK_FLAG(0xDBB7, 1)) {
 			setOns(0, 0);
@@ -2830,7 +2827,7 @@
 			SET_FLAG(0xDBB7, 1);
 		}
 		return true;
-		
+
 	case 0x69b8:
 		if (CHECK_FLAG(0xDBB8, 1)) {
 			setOns(1, 0);
@@ -2848,7 +2845,7 @@
 			SET_FLAG(0xDBB8, 1);
 		}
 		return true;
-		
+
 	case 0x6a1b:
 		if (CHECK_FLAG(0xDBB9, 1)) {
 			setOns(2, 0);
@@ -2864,7 +2861,7 @@
 			SET_FLAG(0xDBB9, 1);
 		}
 		return true;
-		
+
 	case 0x6a73:
 		if (CHECK_FLAG(0xDBBA, 1)) {
 			setOns(3, 0);
@@ -2897,7 +2894,7 @@
 			SET_FLAG(0xDBBB, 1);
 		}
 		return true;
-	
+
 	case 0x6b2e:
 		if (CHECK_FLAG(0xdbbc, 1)) {
 			setOns(5, 0);
@@ -2913,8 +2910,8 @@
 			SET_FLAG(0xDBBC, 1);
 		}
 		return true;
-		
-		
+
+
 	case 0x6b86:
 		if (CHECK_FLAG(0xDBBD, 1)) {
 			displayMessage(0x4b39);
@@ -2940,19 +2937,19 @@
 		playActorAnimation(971);
 		loadScene(32, 139, 199, 1);
 		return true;
-		
+
 	case 0x6c45:
 		playSound(89, 6);
-		playActorAnimation(CHECK_FLAG(0xDBEF, 1)?985: 806);
+		playActorAnimation(CHECK_FLAG(0xDBEF, 1) ? 985 : 806);
 		loadScene(34, 40, 133, 2);
 		return true;
-		
+
 	case 0x6c83:
 		Dialog::pop(scene, 0xdb2e);
 		strcpy(scene->getObject(1)->name, (const char *)res->dseg.ptr(0xaa94));
 		SET_FLAG(0xDBD1, 1);
 		return true;
-		
+
 	case 0x6c9d: //getting jar
 		setOns(0, 71);
 		playSound(32, 5);
@@ -2960,7 +2957,7 @@
 		disableObject(2);
 		inventory->add(72);
 		return true;
-		
+
 	case 0x6cc4:
 		playActorAnimation(754);
 		displayMessage(0x517b); //position 30430
@@ -3000,7 +2997,7 @@
 		playAnimation(745, 1, true);
 		waitAnimation();
 		Dialog::show(scene, 0x4873, 733, 734);
-		
+
 		playActorAnimation(746, true);
 		playAnimation(747, 1, true);
 		waitAnimation();
@@ -3014,7 +3011,7 @@
 		playSound(26, 10);
 		playActorAnimation(755);
 		moveRel(0, 0, 3);
-		
+
 		Dialog::show(scene, 0x51bf);
 		loadScene(31, scene->getPosition());
 		Dialog::show(scene, 0x539f, 763, 764);
@@ -3025,7 +3022,7 @@
 
 		SET_FLAG(0xDBD5, 1);
 		return true;
-		
+
 	case 0x6f20:
 		if (CHECK_FLAG(0xDBD5, 1)) {
 			displayMessage(0x51a7);
@@ -3033,7 +3030,7 @@
 			rejectMessage();
 		}
 		return true;
-		
+
 	case 0x6f75: //hiding in left corner
 		moveRel(0, 0, 3);
 		playActorAnimation(756);
@@ -3075,7 +3072,7 @@
 			loadScene(31, 139, 172, 3);
 		}
 		return true;
-		
+
 	case 0x6f32:
 		if (CHECK_FLAG(0xDBD5, 1)) {
 			displayMessage(0x51a7);
@@ -3084,7 +3081,7 @@
 			displayMessage(0x5511);
 		}
 		return true;
-		
+
 	case 0x7096:
 		playSound(32, 5);
 		playActorAnimation(767);
@@ -3092,13 +3089,13 @@
 		inventory->add(73);
 		disableObject(8);
 		return true;
-		
+
 	case 0x7291:
 		playSound(89, 3);
 		playActorAnimation(975);
 		loadScene(31, 298, 177, 4);
 		return true;
-		
+
 	case 0x72c2:
 		if (CHECK_FLAG(0xDBD6, 2)) {
 			displayMessage(0x522c);
@@ -3109,26 +3106,26 @@
 			if (CHECK_FLAG(0xDBD6, 1)) {
 				displayMessage(0x538d);
 				SET_FLAG(0xDBD6, 2);
-			} else 
+			} else
 				displayMessage(0x5372);
 		}
 		return true;
-		
+
 	case 0x7309:
 		playSound(66, 5);
 		playSound(67, 11);
 		playActorAnimation(976);
 		displayMessage(0x5955);
 		return true;
-		
+
 	case 0x79e4:
 		processCallback(0x6849);
 		return false;
-		
+
 	case 0x79eb: //color of the book
 		displayMessage(res->dseg.get_word(0x5f3c + GET_FLAG(0xDBC1) * 2 - 2));
 		return true;
-		
+
 	case 0x79fd:
 		if (CHECK_FLAG(0xDBB7, 1)) {
 			displayMessage(0x4b6c);
@@ -3184,22 +3181,21 @@
 			return true;
 		} else
 			return false;
-			
-	case 0x7b09:
-		{
-			byte v = GET_FLAG(0xDBD6);
-			switch(v) {
-			case 1:
-				displayMessage(0x51f8);
-				return true;
-			case 2:
-				displayMessage(0x538d);
-				return true;
-			default:
-				return false;
-			}
+
+	case 0x7b09: {
+		byte v = GET_FLAG(0xDBD6);
+		switch (v) {
+		case 1:
+			displayMessage(0x51f8);
+			return true;
+		case 2:
+			displayMessage(0x538d);
+			return true;
+		default:
+			return false;
 		}
-		
+	}
+
 	case 0x9166:
 		if (CHECK_FLAG(0xDBD1, 1)) {
 			return true;
@@ -3219,7 +3215,7 @@
 		enableObject(2);
 		enableObject(3);
 		return true;
-		
+
 	case 0x90bc: //handle on the hole
 		playSound(5, 3);
 		playSound(6, 9);
@@ -3230,9 +3226,9 @@
 		enableObject(3);
 		SET_FLAG(0xDBEF, 1);
 		return true;
-		
+
 	case 0x90fc: //dictaphone on robot
-		if (!processCallback(0x9166)) 
+		if (!processCallback(0x9166))
 			return true;
 
 		if (CHECK_FLAG(0xDBD2, 1)) {
@@ -3257,7 +3253,7 @@
 		return true;
 
 	case 0x91cb: //use socks on robot
-		if (!processCallback(0x9166)) 
+		if (!processCallback(0x9166))
 			return true;
 
 		if (CHECK_FLAG(0xDBD3, 1)) {
@@ -3272,9 +3268,9 @@
 		SET_FLAG(0xDBD3, 1);
 		processCallback(0x9175);
 		return true;
-		
+
 	case 0x9209: //photo on robot
-		if (!processCallback(0x9166)) 
+		if (!processCallback(0x9166))
 			return true;
 
 		if (CHECK_FLAG(0xDBD4, 1)) {
@@ -3289,7 +3285,7 @@
 		SET_FLAG(0xDBD4, 1);
 		processCallback(0x9175);
 		return true;
-		
+
 	case 0x924e:
 		setOns(2, 64);
 		playSound(5, 3);
@@ -3319,7 +3315,7 @@
 		scene->getObject(10)->actor_orientation = 1;
 		SET_FLAG(0xDBCC, 1);
 		return true;
-		
+
 	case 0x9472:
 		playSound(5, 4);
 		playSound(19, 14);
@@ -3328,7 +3324,7 @@
 		inventory->remove(60);
 		SET_FLAG(0xDBD6, 1);
 		return true;
-		
+
 	case 0x9449: //meat + stew
 		playSound(5, 4);
 		playSound(63, 12);
@@ -3337,8 +3333,8 @@
 		inventory->remove(69);
 		inventory->add(70);
 		return true;
-		
-	case 0x949b: 
+
+	case 0x949b:
 		if (CHECK_FLAG(0xDBD6, 2)) {
 			playSound(5, 4);
 			playSound(5, 25);
@@ -3347,10 +3343,10 @@
 			inventory->remove(62);
 			inventory->add(74);
 			inventory->add(65);
-		} else 
+		} else
 			displayMessage(0x524f);
 		return true;
-		
+
 	case 0x94d4:
 		if (inventory->has(70)) {
 			setOns(0, 0);
@@ -3361,17 +3357,17 @@
 			disableObject(7);
 			inventory->remove(70);
 			inventory->add(71);
-		} else 
+		} else
 			displayMessage(0x53ad);
 		return true;
-		
+
 	case 0x951b:
 		playSound(5, 4);
 		playSound(5, 22);
 		playActorAnimation(804);
 		displayMessage(0x528b);
 		return true;
-		
+
 	case 0x9537: //using remote on VCR
 		playSound(5, 3);
 		playSound(5, 16);
@@ -3379,7 +3375,7 @@
 		if (CHECK_FLAG(0xDBC8, 1)) {
 			if (CHECK_FLAG(0xDBC6, 0)) {
 				if (CHECK_FLAG(0xDBC5, 1)) { //tv on
-					if (!CHECK_FLAG(0xDBC7, 1)) 
+					if (!CHECK_FLAG(0xDBC7, 1))
 						displayMessage(0x4d93); //the tape started
 					playAnimation(702, 1); //fixme: we need some overlay animation support
 					SET_FLAG(0xDBC6, 1);
@@ -3388,19 +3384,19 @@
 						SET_FLAG(0xDBC7, 1);
 					}
 					reloadLan();
-				} else 
+				} else
 					displayMessage(0x4d5b);
 			} else {
 				SET_FLAG(0xDBC6, 0);
 				if (CHECK_FLAG(0xDBC5, 1)) { //tv on
 					playAnimation(701, 1);
-					displayMessage(0x4da6); //much better! 
+					displayMessage(0x4da6); //much better!
 				}
 			}
-		} else 
+		} else
 			displayMessage(0x4D80); //nothing happened
 		return true;
-		
+
 	case 0x95eb: //polaroid + tv
 		if (CHECK_FLAG(0xDBC6, 1)) {
 			if (CHECK_FLAG(0xDBCA, 1)) {
@@ -3413,7 +3409,7 @@
 				inventory->add(61);
 				SET_FLAG(0xDBCA, 1);
 			}
-		} else 
+		} else
 			displayMessage(0x4ea5);
 		return true;
 
@@ -3428,11 +3424,11 @@
 				playActorAnimation(708);
 				SET_FLAG(0xDBCB, 1);
 			}
-		} else 
+		} else
 			displayMessage(0x4ea5);
 		return true;
 
-		
+
 	case 0x95c8:
 		playSound(5, 3);
 		playSound(91, 12);
@@ -3440,7 +3436,7 @@
 		inventory->remove(54);
 		SET_FLAG(0xDBC8, 1);
 		return true;
-		
+
 	case 0x9673:
 		playSound(5, 3);
 		playSound(24, 10);
@@ -3476,17 +3472,17 @@
 		playAnimation(937, 1, true);
 		playActorAnimation(945, true);
 		waitAnimation();
-		
+
 		playAnimation(945, 1);
 		Dialog::show(scene, 0x844f);
 		playAnimation(946, 1);
 		Dialog::show(scene, 0x87c7);
-		
+
 		playSound(24, 7);
 		playAnimation(948, 1, true);
 		playActorAnimation(947, true);
 		waitAnimation();
-		
+
 		loadScene(40, 198, 186, 1);
 		Dialog::show(scene, 0x8890);
 		Dialog::show(scene, 0x8a2f);
@@ -3498,14 +3494,14 @@
 		moveTo(192, 177, 0);
 		playAnimation(949, 1);
 		Dialog::show(scene, 0x8af6, 950);
-		
+
 		playSound(32, 5);
 		playSound(40, 14);
 
 		playAnimation(951, 1, true);
 		playActorAnimation(952, true);
 		waitAnimation();
-		
+
 		playMusic(11);
 		loadScene(39, 192, 177, 0);
 		Dialog::show(scene, 0x8b4d, 953);
@@ -3513,56 +3509,55 @@
 		playAnimation(954, 1);
 		Dialog::show(scene, 0x8b7a, 955);
 		playMusic(2);
-		
+
 		displayMessage("THE END");
 		debug(0, "FIXME: THE END + CREDITS");
 		scene->push(SceneEvent(SceneEvent::Quit));
-		
+
 		return true;
 
-	case 0x9921:
-		{
-			int id = scene->getId();
-			Common::Point p = scene->getPosition();
-			if (id != 15) {
-				displayMessage(id == 16? 0x38ce: 0x38a7);
-			} else {
-				moveTo(156, 180, 3);
-				playSound(5, 3);
-				playSound(38, 16);
-				playSound(38, 22);
-				playActorAnimation(614);
-				playSound(5, 3);
-				playSound(44, 10);
-				playSound(20, 26);
-				playActorAnimation(615);
-				loadScene(17, p);
+	case 0x9921: {
+		int id = scene->getId();
+		Common::Point p = scene->getPosition();
+		if (id != 15) {
+			displayMessage(id == 16 ? 0x38ce : 0x38a7);
+		} else {
+			moveTo(156, 180, 3);
+			playSound(5, 3);
+			playSound(38, 16);
+			playSound(38, 22);
+			playActorAnimation(614);
+			playSound(5, 3);
+			playSound(44, 10);
+			playSound(20, 26);
+			playActorAnimation(615);
+			loadScene(17, p);
+			playSound(64, 7);
+			playSound(64, 21);
+			playSound(64, 42);
+			playSound(64, 63);
+			playActorAnimation(617);
+			//another time challenge!
+			if (true) {
 				playSound(64, 7);
-				playSound(64, 21);
-				playSound(64, 42);
-				playSound(64, 63);
-				playActorAnimation(617);
-				//another time challenge! 
-				if (true) {
-					playSound(64, 7);
-					playActorAnimation(618);
-					disableObject(5);
-					setOns(0, 0);
-					playSound(31);
-					playActorAnimation(619);
-					inventory->add(42);
-					displayMessage(0x3989);
-				}
-				loadScene(id, p);
+				playActorAnimation(618);
+				disableObject(5);
+				setOns(0, 0);
+				playSound(31);
+				playActorAnimation(619);
+				inventory->add(42);
+				displayMessage(0x3989);
 			}
+			loadScene(id, p);
 		}
-		return true;
-		
+	}
+	return true;
+
 	case 0x9aca:
 		if (scene->getId() == 13) {
 			moveTo(172, 181, 1);
 			playSound(26, 19);
-			for(uint i = 0; i < 8; ++i)
+			for (uint i = 0; i < 8; ++i)
 				playSound(26, 30 + i * 11);
 			playActorAnimation(661);
 			//cutscene 3c80 at 30484
@@ -3570,16 +3565,16 @@
 			playSound(56, 21);
 
 			playSound(8, 48);
-			for(uint i = 0; i < 7; ++i)
+			for (uint i = 0; i < 7; ++i)
 				playSound(26, 117 + i * 11);
-				
+
 			moveRel(-20, 0, 0, true);
 			playActorAnimation(662, true);
 			playAnimation(663, 2, true);
 			waitAnimation();
 			setOns(1, 49);
-			
-			//cutscene 0x3c9a at 30453 
+
+			//cutscene 0x3c9a at 30453
 			moveTo(162, 184, 0, true);
 			playSound(26, 6);
 			playSound(26, 17);
@@ -3594,10 +3589,10 @@
 			displayMessage(0x3cea);
 			inventory->remove(37);
 			processCallback(0x9d45); //another mansion try
-		} else 
+		} else
 			displayMessage(0x3c58);
 		return true;
-		
+
 	case 0x9c6d:
 		displayMessage(0x49d1);
 		SET_FLAG(0xDBB5, 1);
@@ -3623,7 +3618,7 @@
 			moveTo(220, 198, 4);
 			//scene->getWalkbox(0)->rect.top = 200;
 			setLan(1, 0xff);
-			
+
 			Dialog::show(scene, 0x58a9);
 
 			Object * obj = scene->getObject(1);
@@ -3636,93 +3631,93 @@
 			SET_FLAG(0xDBD7, 1);
 		}
 		return true;
-		
-		case 0x9d45: {
-			byte tries = ++ *(res->dseg.ptr(0xDBEA));
-			debug(0, "another mansion try: %u", tries);
-			if (tries >= 7)
-				return false;
-		
-			uint16 ptr = res->dseg.get_word((tries - 2) * 2 + 0x6035);
-			byte id = scene->getId();
-	
-			playMusic(11);
-			debug(0, "FIXME: cutscene: meanwhile in a mansion #%u, %04x", tries, ptr);
-			processCallback(ptr);
-			playMusic(6);
-			if (scene->getId() == 11 && CHECK_FLAG(0xDBEC, 1))
-				return true;
-			//some effect
-			loadScene(id, scene->getPosition());
-			}
-			return true;
-		
-		case 0x9d90:
-			loadScene(34, scene->getPosition());
-			Dialog::show(scene, 0x6f60, 987, 986);
-			playActorAnimation(990, true);
-			playAnimation(991, 1, true);
-			waitAnimation();
-			return true;
-			
-		case 0x9de5:
-			loadScene(30, scene->getPosition());
-			playAnimation(887, 1, true);
-			playAnimation(888, 2, true);
-			waitAnimation();
-			Dialog::show(scene, 0x6fb8);
-			playSound(26, 3);
-			playAnimation(891, 1, true);
-			playAnimation(892, 2, true);
-			waitAnimation();
-			Dialog::show(scene, 0x6ff0);
-			return true;
-			
-		case 0x9e54:
-			loadScene(32, scene->getPosition());
-			playAnimation(894, 1, true);
-			playAnimation(893, 2, true);
-			waitAnimation();
-			Dialog::show(scene, 0x706e);
-			playSound(75, 9);
-			playAnimation(898, 1, true);
-			playAnimation(897, 2, true);
-			Dialog::show(scene, 0x7096);
-			return true;
-			
-		case 0x9ec3:
-			loadScene(29, scene->getPosition());
-			playActorAnimation(901, true);
-			playAnimation(900, 1, true);
-			waitAnimation();
-			Dialog::show(scene, 0x7161, 902, 903);
-			for (byte i = 3; i <= 9; i += 2)
-				playSound(56, i);
 
-			playActorAnimation(905, true);
-			playAnimation(904, 1, true);
-			Dialog::show(scene, 0x71c6, 902, 903);
+	case 0x9d45: {
+		byte tries = ++ *(res->dseg.ptr(0xDBEA));
+		debug(0, "another mansion try: %u", tries);
+		if (tries >= 7)
+			return false;
+
+		uint16 ptr = res->dseg.get_word((tries - 2) * 2 + 0x6035);
+		byte id = scene->getId();
+
+		playMusic(11);
+		debug(0, "FIXME: cutscene: meanwhile in a mansion #%u, %04x", tries, ptr);
+		processCallback(ptr);
+		playMusic(6);
+		if (scene->getId() == 11 && CHECK_FLAG(0xDBEC, 1))
 			return true;
-			
-		case 0x9f3e:
-			loadScene(35, scene->getPosition());
-			playAnimation(907, 1, true);
-			playAnimation(906, 2, true);
-			waitAnimation();
-			//Dialog::show(scene, 0x7243, 908, 909);
-			Dialog::show(scene, 0x7243);
-			//Dialog::show(scene, 0x7318, 908, 910); //fixme: implement better synchronization
-			Dialog::show(scene, 0x7318);
-			loadScene(11, scene->getPosition());
-			setOns(3, 51);
-			playAnimation(911, 1);
-			playAnimation(899, 1);
-			enableObject(8);
-			setLan(2, 8);
-			SET_FLAG(0xDBEC, 1);
-			return true;
+		//some effect
+		loadScene(id, scene->getPosition());
 	}
-		
+	return true;
+
+	case 0x9d90:
+		loadScene(34, scene->getPosition());
+		Dialog::show(scene, 0x6f60, 987, 986);
+		playActorAnimation(990, true);
+		playAnimation(991, 1, true);
+		waitAnimation();
+		return true;
+
+	case 0x9de5:
+		loadScene(30, scene->getPosition());
+		playAnimation(887, 1, true);
+		playAnimation(888, 2, true);
+		waitAnimation();
+		Dialog::show(scene, 0x6fb8);
+		playSound(26, 3);
+		playAnimation(891, 1, true);
+		playAnimation(892, 2, true);
+		waitAnimation();
+		Dialog::show(scene, 0x6ff0);
+		return true;
+
+	case 0x9e54:
+		loadScene(32, scene->getPosition());
+		playAnimation(894, 1, true);
+		playAnimation(893, 2, true);
+		waitAnimation();
+		Dialog::show(scene, 0x706e);
+		playSound(75, 9);
+		playAnimation(898, 1, true);
+		playAnimation(897, 2, true);
+		Dialog::show(scene, 0x7096);
+		return true;
+
+	case 0x9ec3:
+		loadScene(29, scene->getPosition());
+		playActorAnimation(901, true);
+		playAnimation(900, 1, true);
+		waitAnimation();
+		Dialog::show(scene, 0x7161, 902, 903);
+		for (byte i = 3; i <= 9; i += 2)
+			playSound(56, i);
+
+		playActorAnimation(905, true);
+		playAnimation(904, 1, true);
+		Dialog::show(scene, 0x71c6, 902, 903);
+		return true;
+
+	case 0x9f3e:
+		loadScene(35, scene->getPosition());
+		playAnimation(907, 1, true);
+		playAnimation(906, 2, true);
+		waitAnimation();
+		//Dialog::show(scene, 0x7243, 908, 909);
+		Dialog::show(scene, 0x7243);
+		//Dialog::show(scene, 0x7318, 908, 910); //fixme: implement better synchronization
+		Dialog::show(scene, 0x7318);
+		loadScene(11, scene->getPosition());
+		setOns(3, 51);
+		playAnimation(911, 1);
+		playAnimation(899, 1);
+		enableObject(8);
+		setLan(2, 8);
+		SET_FLAG(0xDBEC, 1);
+		return true;
+	}
+
 	//error("invalid callback %04x called", addr);
 	warning("invalid callback %04x called", addr);
 	return true;

Modified: scummvm/trunk/engines/teenagent/detection.cpp
===================================================================
--- scummvm/trunk/engines/teenagent/detection.cpp	2009-09-15 08:51:16 UTC (rev 44100)
+++ scummvm/trunk/engines/teenagent/detection.cpp	2009-09-15 08:54:06 UTC (rev 44101)
@@ -50,13 +50,13 @@
 			{"sam_mmm.res", 0, NULL, -1},
 			{"sam_sam.res", 0, NULL, -1},
 			{NULL, 0, NULL, 0}
-		}, 
+		},
 		Common::EN_ANY,
 		Common::kPlatformPC,
 		ADGF_NO_FLAGS,
 		Common::GUIO_NONE
-	}, 
-	AD_TABLE_END_MARKER, 
+	},
+	AD_TABLE_END_MARKER,
 };
 
 static const ADParams detectionParams = {
@@ -91,7 +91,7 @@
 		case kSupportsListSaves:
 		case kSupportsDeleteSave:
 		case kSupportsLoadingDuringStartup:
-		//case kSavesSupportThumbnail:
+			//case kSavesSupportThumbnail:
 			return true;
 		default:
 			return false;
@@ -118,7 +118,7 @@
 	virtual SaveStateList listSaves(const char *target) const {
 		Common::String pattern = target;
 		pattern += ".*";
-		
+
 		Common::StringList filenames = g_system->getSavefileManager()->listSavefiles(pattern);
 		bool slotsTable[MAX_SAVES];
 		memset(slotsTable, 0, sizeof(slotsTable));
@@ -155,7 +155,7 @@
 };
 
 #if PLUGIN_ENABLED_DYNAMIC(TEENAGENT)
-	REGISTER_PLUGIN_DYNAMIC(TEENAGENT, PLUGIN_TYPE_ENGINE, TeenAgentMetaEngine);
+REGISTER_PLUGIN_DYNAMIC(TEENAGENT, PLUGIN_TYPE_ENGINE, TeenAgentMetaEngine);
 #else
-	REGISTER_PLUGIN_STATIC(TEENAGENT, PLUGIN_TYPE_ENGINE, TeenAgentMetaEngine);
+REGISTER_PLUGIN_STATIC(TEENAGENT, PLUGIN_TYPE_ENGINE, TeenAgentMetaEngine);
 #endif

Modified: scummvm/trunk/engines/teenagent/dialog.cpp
===================================================================
--- scummvm/trunk/engines/teenagent/dialog.cpp	2009-09-15 08:51:16 UTC (rev 44100)
+++ scummvm/trunk/engines/teenagent/dialog.cpp	2009-09-15 08:54:06 UTC (rev 44101)
@@ -36,7 +36,7 @@
 	int n = 0;
 	Common::String message;
 	byte color = color1;
-	
+
 	if (animation1 != 0) {
 		SceneEvent e(SceneEvent::PlayAnimation);
 		e.animation = animation1;
@@ -50,22 +50,22 @@
 		e.color = 0xc0 | slot2; //looped, paused
 		scene->push(e);
 	}
-	
+
 	while (n < 4) {
 		byte c = res->eseg.get_byte(addr++);
 		//debug(0, "%02x: %c", c, c > 0x20? c: '.');
-		
-		switch(c) {
+
+		switch (c) {
 		case 0:
 			++n;
-			switch(n) {
-			case 1: 
+			switch (n) {
+			case 1:
 				//debug(0, "new line\n");
 				message += '\n';
 				break;
-			case 2: 
+			case 2:
 				//debug(0, "displaymessage\n");
-				
+
 				if (color == color2 && animation2 != 0) {
 					//pause animation in other slot
 					{
@@ -93,7 +93,7 @@
 						scene->push(e);
 					}
 				}
-				
+
 				{
 					SceneEvent e(SceneEvent::Message);
 					e.message = message;
@@ -103,19 +103,18 @@
 				}
 				break;
 
-			case 3: 
-				color = color == color1? color2: color1;
+			case 3:
+				color = color == color1 ? color2 : color1;
 				//debug(0, "changing color to %02x", color);
 				break;
 			}
 			break;
-		
-		case 0xff:
-			{
-				//fixme : wait for the next cycle of the animation
-			}
-			break;
-		
+
+		case 0xff: {
+			//fixme : wait for the next cycle of the animation
+		}
+		break;
+
 		default:
 			message += c;
 			n = 0;

Modified: scummvm/trunk/engines/teenagent/dialog.h
===================================================================
--- scummvm/trunk/engines/teenagent/dialog.h	2009-09-15 08:51:16 UTC (rev 44100)
+++ scummvm/trunk/engines/teenagent/dialog.h	2009-09-15 08:54:06 UTC (rev 44101)
@@ -32,7 +32,7 @@
 
 class Scene;
 class Dialog {
-public: 
+public:
 	static uint16 pop(Scene *scene, uint16 addr, uint16 animation1 = 0, uint16 animation2 = 0, byte color1 = 0xd1, byte color2 = 0xd0, byte slot1 = 1, byte slot2 = 2);
 	static void show(Scene *scene, uint16 addr, uint16 animation1 = 0, uint16 animation2 = 0, byte color1 = 0xd1, byte color2 = 0xd0, byte slot1 = 1, byte slot2 = 2);
 };

Modified: scummvm/trunk/engines/teenagent/font.cpp
===================================================================
--- scummvm/trunk/engines/teenagent/font.cpp	2009-09-15 08:51:16 UTC (rev 44100)
+++ scummvm/trunk/engines/teenagent/font.cpp	2009-09-15 08:54:06 UTC (rev 44101)
@@ -33,7 +33,7 @@
 void Font::load(int id) {
 	delete[] data;
 	data = NULL;
-	
+
 	Common::SeekableReadStream * s = Resources::instance()->varia.getStream(id);
 	if (s == NULL)
 		error("loading font %d failed", id);
@@ -62,11 +62,11 @@
 	for (uint i = 0; i < h; ++i) {
 		for (uint j = 0; j < w; ++j) {
 			byte v = *glyph++;
-			switch(v) {
+			switch (v) {
 			case 1:
 				dst[j] = shadow_color;
 				break;
-			case 2: 
+			case 2:
 				dst[j] = color;
 				break;
 			}
@@ -86,19 +86,19 @@
 		uint max_w = render(NULL, 0, 0, str, false);
 		if (show_grid)
 			grid(surface, x - 4, y - 2, max_w + 8, 8 + 6, grid_color);
-			
+
 		uint i = 0, j;
 		do {
 			j = find_in_str(str, '\n', i);
 			Common::String line(str.c_str() + i, j - i);
 			//debug(0, "line: %s", line.c_str());
-			
+
 			uint w = render(NULL, 0, 0, line, false);
 			int xp = x + (max_w - w) / 2;
 			for (uint k = 0; k < line.size(); ++k) {
 				xp += render(surface, xp, y, line[k]);
 			}
-			
+
 			y += height;
 			i = j + 1;
 		} while (i < str.size());
@@ -119,7 +119,7 @@
 		}
 		if (w > max_w)
 			max_w = w;
-	
+
 		return max_w;
 	}
 }

Modified: scummvm/trunk/engines/teenagent/font.h
===================================================================
--- scummvm/trunk/engines/teenagent/font.h	2009-09-15 08:51:16 UTC (rev 44100)
+++ scummvm/trunk/engines/teenagent/font.h	2009-09-15 08:54:06 UTC (rev 44101)
@@ -30,18 +30,18 @@
 namespace TeenAgent {
 
 class Font {
-public: 
+public:
 	byte grid_color, color, shadow_color;
 	byte height, width_pack;
-	
+
 	Font();
 	void load(int id);
 	uint render(Graphics::Surface *surface, int x, int y, const Common::String &str, bool grid = false);
 	uint render(Graphics::Surface *surface, int x, int y, char c);
 	static void grid(Graphics::Surface *surface, int x, int y, int w, int h, byte color);
-	
+
 	~Font();
-private: 
+private:
 	byte *data;
 };
 

Modified: scummvm/trunk/engines/teenagent/inventory.cpp
===================================================================
--- scummvm/trunk/engines/teenagent/inventory.cpp	2009-09-15 08:51:16 UTC (rev 44100)
+++ scummvm/trunk/engines/teenagent/inventory.cpp	2009-09-15 08:54:06 UTC (rev 44101)
@@ -35,15 +35,15 @@
 	_engine = engine;
 	_active = false;
 	Resources *res = Resources::instance();
-	
+
 	Common::SeekableReadStream *s = res->varia.getStream(3);
 	assert(s != NULL);
 	debug(0, "loading inventory background...");
 	background.load(s, Surface::TypeOns);
-	
+
 	items = res->varia.getStream(4);
 	assert(items != NULL);
-	
+
 	byte offsets = items->readByte();
 	assert(offsets == 92);
 	for (byte i = 0; i < offsets; ++i) {
@@ -51,8 +51,8 @@
 	}
 	objects = res->dseg.ptr(0xc4a4);
 	inventory = res->dseg.ptr(0xc48d);
-	
-	for (int y = 0; y < 4; ++y) 
+
+	for (int y = 0; y < 4; ++y)
 		for (int x = 0; x < 6; ++x) {
 			int i = y * 6 + x;
 			graphics[i].rect.left = 28 + 45 * x - 1;
@@ -60,13 +60,13 @@
 			graphics[i].rect.right = graphics[i].rect.left + 40;
 			graphics[i].rect.bottom = graphics[i].rect.top + 26;
 		}
-		
+
 	hovered_obj = selected_obj = NULL;
 }
 
 bool Inventory::has(byte item) const {
 	for (int i = 0; i < 24; ++i) {
-		if (inventory[i] == item) 
+		if (inventory[i] == item)
 			return true;
 	}
 	return false;
@@ -112,8 +112,8 @@
 
 bool Inventory::processEvent(const Common::Event &event) {
 	Resources *res = Resources::instance();
-	
-	switch(event.type) {
+
+	switch (event.type) {
 	case Common::EVENT_MOUSEMOVE:
 		mouse = event.mouse;
 		if (!active() && event.mouse.y < 5) {
@@ -125,17 +125,17 @@
 			activate(false);
 			return _active;
 		}
-		
+
 		if (!_active)
 			return false;
-			
+
 		hovered_obj = NULL;
-		
+
 		for (int i = 0; i < 24; ++i) {
 			byte item = inventory[i];
 			if (item == 0)
 				continue;
-			
+
 			graphics[i].hovered = graphics[i].rect.in(mouse);
 			if (graphics[i].hovered)
 				hovered_obj = (InventoryObject *)res->dseg.ptr(READ_LE_UINT16(objects + item * 2));
@@ -160,8 +160,8 @@
 		byte *table = res->dseg.ptr(0xC335);
 		while (table[0] != 0 && table[1] != 0) {
 			if (
-				(id1 == table[0] && id2 == table[1]) ||
-				(id2 == table[0] && id1 == table[1])
+			    (id1 == table[0] && id2 == table[1]) ||
+			    (id2 == table[0] && id1 == table[1])
 			) {
 				remove(id1);
 				remove(id2);
@@ -179,18 +179,18 @@
 		activate(false);
 		resetSelectedObject();
 		return true;
-		}
-		
+	}
+
 	case Common::EVENT_RBUTTONDOWN:
 		if (!_active)
 			return false;
-			
+
 		if (hovered_obj != NULL) {
 			byte id = hovered_obj->id;
 			debug(0, "rclick object %u", id);
 			uint i = 0;
 			for (byte *table = res->dseg.ptr(0xBB6F + 3); //original offset + 3 bytes.
-				table[0] != 0 && i < 7; table += 3, ++i) {
+			        table[0] != 0 && i < 7; table += 3, ++i) {
 				if (table[0] == id) {
 					resetSelectedObject();
 					activate(false);
@@ -199,7 +199,7 @@
 				}
 			}
 		}
-		
+
 		selected_obj = hovered_obj;
 		if (selected_obj)
 			debug(0, "selected object %s", selected_obj->name);
@@ -215,8 +215,8 @@
 	case Common::EVENT_LBUTTONUP:
 	case Common::EVENT_RBUTTONUP:
 		return _active;
-		
-	default: 
+
+	default:
 		return false;
 	}
 }
@@ -229,8 +229,8 @@
 
 void Inventory::Item::render(Inventory *inventory, InventoryObject *obj, Graphics::Surface *dst) {
 	Resources *res = Resources::instance();
-	
-	rect.render(dst, hovered? 233: 234);
+
+	rect.render(dst, hovered ? 233 : 234);
 	if (obj->animated) {
 		if (animation.empty()) {
 			debug(0, "loading item %d from offset %x", obj->id, inventory->offset[obj->id - 1]);
@@ -263,7 +263,7 @@
 		name += " & ";
 	}
 	name += obj->name;
-	
+
 	if (hovered) {
 		int w = res->font7.render(NULL, 0, 0, name, true);
 		res->font7.render(dst, (320 - w) / 2, 180, name, true);
@@ -276,16 +276,16 @@
 
 	background.render(surface);
 	Resources *res = Resources::instance();
-	
+
 	for (int y = 0; y < 4; y++) {
 		for (int x = 0; x < 6; x++) {
 			int idx = x + 6 * y;
 			byte item = inventory[idx];
 			if (item == 0)
 				continue;
-			
+
 			//debug(0, "%d,%d -> %u", x0, y0, item);
-			
+
 			InventoryObject *obj = (InventoryObject *)res->dseg.ptr(READ_LE_UINT16(objects + item * 2));
 			graphics[idx].render(this, obj, surface);
 		}

Modified: scummvm/trunk/engines/teenagent/inventory.h
===================================================================
--- scummvm/trunk/engines/teenagent/inventory.h	2009-09-15 08:51:16 UTC (rev 44100)
+++ scummvm/trunk/engines/teenagent/inventory.h	2009-09-15 08:54:06 UTC (rev 44101)
@@ -47,7 +47,7 @@
 
 	void activate(bool a) { _active = a; }
 	bool active() const { return _active; }
-	
+
 	bool processEvent(const Common::Event &event);
 
 	InventoryObject *selectedObject() { return selected_obj; }
@@ -58,7 +58,7 @@
 	Surface background;
 	Common::SeekableReadStream *items;
 	uint16 offset[92];
-	
+
 	byte *objects;
 	byte *inventory;
 	struct Item {
@@ -66,12 +66,12 @@
 		Surface surface;
 		Rect rect;
 		bool hovered;
-		
+
 		Item() : hovered(false) {}
 		void free();
 		void render(Inventory *inventory, InventoryObject *obj, Graphics::Surface *surface);
 	} graphics[24];
-	
+
 	bool _active;
 	Common::Point mouse;
 	int hovered;

Modified: scummvm/trunk/engines/teenagent/music.cpp
===================================================================
--- scummvm/trunk/engines/teenagent/music.cpp	2009-09-15 08:51:16 UTC (rev 44100)
+++ scummvm/trunk/engines/teenagent/music.cpp	2009-09-15 08:54:06 UTC (rev 44101)
@@ -46,11 +46,11 @@
 	Common::SeekableReadStream *stream	= res->mmm.getStream(id);
 	if (stream == NULL)
 		return false;
-	
+
 	char header[4];
 	stream->read(header, 4);
-	//check header? 
-	
+	//check header?
+
 	memset(_samples, 0, sizeof(_samples));
 
 	// Load the samples
@@ -67,14 +67,14 @@
 		debug(0, "currSample = %d, sample = 0x%02x, resource: %d", currSample, sample, sampleResource);
 		uint32 sampleSize = res->sam_mmm.get_size(sampleResource);
 		Common::SeekableReadStream *in = res->sam_mmm.getStream(sampleResource);
-		
+
 		if (in == 0) {
 			warning("load: invalid sample %d (0x%02x)", sample, sample);
 			_samples[sample].data = NULL;
 			_samples[sample].size = 0;
 			continue;
 		}
-		
+
 		byte *sampleData = new byte[sampleSize];
 		in->read(sampleData, sampleSize);
 
@@ -90,7 +90,7 @@
 	// Load the music data
 
 	_rows.clear();
-	
+
 	Row row;
 	row.channels[0].sample = 0;
 	row.channels[1].sample = 0;
@@ -132,7 +132,7 @@
 
 void MusicPlayer::interrupt() {
 	_currRow %= _rows.size();
-	
+
 	Row *row = &_rows[_currRow];
 	for (int chn = 0; chn < 3; ++chn) {
 		setChannelVolume(chn, row->channels[chn].volume);

Modified: scummvm/trunk/engines/teenagent/music.h
===================================================================
--- scummvm/trunk/engines/teenagent/music.h	2009-09-15 08:51:16 UTC (rev 44100)
+++ scummvm/trunk/engines/teenagent/music.h	2009-09-15 08:54:06 UTC (rev 44101)
@@ -46,7 +46,7 @@
 	int _id;
 
 	struct Row {
-		struct Channel{
+		struct Channel {
 			byte sample;
 			byte volume;
 			byte note;

Modified: scummvm/trunk/engines/teenagent/objects.cpp
===================================================================
--- scummvm/trunk/engines/teenagent/objects.cpp	2009-09-15 08:51:16 UTC (rev 44100)
+++ scummvm/trunk/engines/teenagent/objects.cpp	2009-09-15 08:54:06 UTC (rev 44101)
@@ -35,25 +35,25 @@
 }
 
 void Walkbox::dump() {
-	debug(0, "walkbox %02x %02x [%d, %d, %d, %d] %02x %02x %02x %02x  ", 
-		unk00, orientation, 
-		rect.left, rect.right, rect.top, rect.bottom, 
-		unk0a, unk0b, unk0c, unk0d);
+	debug(0, "walkbox %02x %02x [%d, %d, %d, %d] %02x %02x %02x %02x  ",
+	      unk00, orientation,
+	      rect.left, rect.right, rect.top, rect.bottom,
+	      unk0a, unk0b, unk0c, unk0d);
 }
 
 void Object::dump() {
-	debug(0, "object: %u %u [%u,%u,%u,%u], actor: [%u,%u,%u,%u], orientation: %u, name: %s", id, enabled, 
-		rect.left, rect.top, rect.right, rect.bottom, 
-		actor_rect.left, actor_rect.top, actor_rect.right, actor_rect.bottom, 
-		actor_orientation, name
-	); 
+	debug(0, "object: %u %u [%u,%u,%u,%u], actor: [%u,%u,%u,%u], orientation: %u, name: %s", id, enabled,
+	      rect.left, rect.top, rect.right, rect.bottom,
+	      actor_rect.left, actor_rect.top, actor_rect.right, actor_rect.bottom,
+	      actor_orientation, name
+	     );
 }
 
 Common::String Object::description(const char *name) {
 	const char *desc = name + strlen(name) + 1;
 	if (*desc == 0)
 		return Common::String();
-		
+
 	Common::String result;
 
 	while (*desc != 1 && *desc != 0) {
@@ -62,17 +62,17 @@
 			//debug(0, "%02x ", *desc);
 			line += *desc++;
 		}
-		
+
 		if (line.empty())
 			break;
-		
+
 		++desc;
 		result += line;
 		result += '\n';
 	}
 	if (!result.empty())
 		result.deleteLastChar();
-	else 
+	else
 		result = "Cool.";
 	return result;
 }

Modified: scummvm/trunk/engines/teenagent/objects.h
===================================================================
--- scummvm/trunk/engines/teenagent/objects.h	2009-09-15 08:51:16 UTC (rev 44100)
+++ scummvm/trunk/engines/teenagent/objects.h	2009-09-15 08:54:06 UTC (rev 44101)
@@ -40,7 +40,7 @@
 
 	inline Rect() : left(0), top(0), right(0), bottom(0) {}
 	inline Rect(uint16 l, uint16 t, uint16 r, uint16 b) : left(l), top(t), right(r), bottom(b) {}
-	
+
 	inline bool in(const Common::Point &point) const {
 		return point.x >= left && point.x <= right && point.y >= top && point.y <= bottom;
 	}
@@ -54,7 +54,7 @@
 	void dump() {
 		debug(0, "rect[%u, %u, %u, %u]", left, top, right, bottom);
 	}
-	
+
 	void clear() {
 		left = top = right = bottom = 0;
 	}

Modified: scummvm/trunk/engines/teenagent/pack.cpp
===================================================================
--- scummvm/trunk/engines/teenagent/pack.cpp	2009-09-15 08:51:16 UTC (rev 44100)
+++ scummvm/trunk/engines/teenagent/pack.cpp	2009-09-15 08:54:06 UTC (rev 44101)
@@ -51,10 +51,10 @@
 		offsets[i] = file.readUint32LE();
 		//debug(0, "%d: %06x", i, offsets[i]);
 	}
-/*	for (uint32 i = 0; i < count; ++i) {
-		debug(0, "%d: len = %d", i, offsets[i + 1] - offsets[i]);
-	}
-*/
+	/*	for (uint32 i = 0; i < count; ++i) {
+			debug(0, "%d: len = %d", i, offsets[i + 1] - offsets[i]);
+		}
+	*/
 }
 
 uint32 Pack::get_size(uint32 id) const {

Modified: scummvm/trunk/engines/teenagent/pack.h
===================================================================
--- scummvm/trunk/engines/teenagent/pack.h	2009-09-15 08:51:16 UTC (rev 44100)
+++ scummvm/trunk/engines/teenagent/pack.h	2009-09-15 08:54:06 UTC (rev 44101)
@@ -34,7 +34,7 @@
 	uint32 count;
 	uint32 *offsets;
 
-public: 
+public:
 	Pack();
 	~Pack();
 	void open(const Common::String &filename);

Modified: scummvm/trunk/engines/teenagent/resources.cpp
===================================================================
--- scummvm/trunk/engines/teenagent/resources.cpp	2009-09-15 08:51:16 UTC (rev 44100)
+++ scummvm/trunk/engines/teenagent/resources.cpp	2009-09-15 08:54:06 UTC (rev 44101)
@@ -77,7 +77,7 @@
 	font7.height = 10;
 	font8.load(8);
 	font8.height = 31;
-	
+
 	return true;
 }
 
@@ -97,14 +97,14 @@
 }
 
 Common::SeekableReadStream *Resources::loadLan(uint32 id) const {
-	return id <= 500? loadLan000(id): lan500.getStream(id - 500);
+	return id <= 500 ? loadLan000(id) : lan500.getStream(id - 500);
 }
 
 Common::SeekableReadStream *Resources::loadLan000(uint32 id) const {
-	switch(id) {
+	switch (id) {
 
 	case 81:
-		if (dseg.get_byte(0xDBAD)) 
+		if (dseg.get_byte(0xDBAD))
 			return lan500.getStream(160);
 		break;
 
@@ -112,25 +112,25 @@
 		if (dseg.get_byte(0xDBC5) == 1) {
 			if (dseg.get_byte(0xDBC6) == 1)
 				return lan500.getStream(203);
-			else 
+			else
 				return lan500.getStream(202);
 		}
 		break;
 
-	case 25: 
+	case 25:
 		if (dseg.get_byte(0xDBDF) == 2) {
 			return lan500.getStream(332);
 		}
 		break;
 
-	case 37: 
+	case 37:
 		if (dseg.get_byte(0xdbe2) == 1) {
 			return lan500.getStream(351);
 		} else if (dseg.get_byte(0xdbe2) == 2) {
 			return lan500.getStream(364);
 		}
 		break;
-	
+
 	case 29:
 		if (dseg.get_byte(0xDBE7) == 1) {
 			return lan500.getStream(380);

Modified: scummvm/trunk/engines/teenagent/resources.h
===================================================================
--- scummvm/trunk/engines/teenagent/resources.h	2009-09-15 08:51:16 UTC (rev 44100)
+++ scummvm/trunk/engines/teenagent/resources.h	2009-09-15 08:54:06 UTC (rev 44101)
@@ -37,7 +37,7 @@
 class Resources {
 protected:
 	Resources();
-public: 
+public:
 	static Resources *instance();
 	bool loadArchives(const ADGameDescription *gd);
 	void deinit();

Modified: scummvm/trunk/engines/teenagent/scene.cpp
===================================================================
--- scummvm/trunk/engines/teenagent/scene.cpp	2009-09-15 08:51:16 UTC (rev 44100)
+++ scummvm/trunk/engines/teenagent/scene.cpp	2009-09-15 08:54:06 UTC (rev 44101)
@@ -33,21 +33,22 @@
 
 namespace TeenAgent {
 
-Scene::Scene() : intro(false), _engine(NULL), 
-	_system(NULL), 
-	_id(0), ons(0), walkboxes(0), 
-	orientation(Object::ActorRight), 
-	current_event(SceneEvent::None), hide_actor(false) {}
+Scene::Scene() : intro(false), _engine(NULL),
+		_system(NULL),
+		_id(0), ons(0), walkboxes(0),
+		orientation(Object::ActorRight),
+		current_event(SceneEvent::None), hide_actor(false) {}
 
-void Scene::warp(const Common::Point & _point, byte o) { 
+void Scene::warp(const Common::Point &_point, byte o) {
 	Common::Point point(_point);
-	destination = position = position0 = point; 
-	progress = 0; progress_total = 1; 
+	destination = position = position0 = point;
+	progress = 0;
+	progress_total = 1;
 	if (o)
 		orientation = o;
 }
 
-void Scene::moveTo(const Common::Point & _point, byte orient, bool validate) {
+void Scene::moveTo(const Common::Point &_point, byte orient, bool validate) {
 	Common::Point point(_point);
 	debug(0, "moveTo(%d, %d, %u)", point.x, point.y, orient);
 	if (validate) {
@@ -56,11 +57,11 @@
 			if (w->rect.in(point)) {
 				debug(0, "bumped into walkbox %u", i);
 				byte o = w->orientation;
-				switch(o) {
+				switch (o) {
 				case 1:
 					point.y = w->rect.top - 1;
 					break;
-				case 2: 
+				case 2:
 					point.x = w->rect.right + 1;
 					break;
 				case 3:
@@ -83,8 +84,8 @@
 	}
 	destination = point;
 	orientation = orient;
-	position0 = position; 
-	progress_total = 1 + (int)(sqrt((float)position.sqrDist(destination)) / 10); 
+	position0 = position;
+	progress_total = 1 + (int)(sqrt((float)position.sqrDist(destination)) / 10);
 	progress = 0;
 }
 
@@ -92,7 +93,7 @@
 void Scene::init(TeenAgentEngine *engine, OSystem *system) {
 	_engine = engine;
 	_system = system;
-	
+
 	Resources *res = Resources::instance();
 	Common::SeekableReadStream *s = res->varia.getStream(1);
 	if (s == NULL)
@@ -101,11 +102,11 @@
 	teenagent.load(s, Animation::TypeVaria);
 	if (teenagent.empty())
 		error("invalid mark animation");
-	
+
 	s = res->varia.getStream(2);
 	if (s == NULL)
 		error("invalid resource data");
-	
+
 	teenagent_idle.load(s, Animation::TypeVaria);
 	if (teenagent_idle.empty())
 		error("invalid mark animation");
@@ -127,7 +128,7 @@
 
 	uint16 addr = res->dseg.get_word(0xb4f5 + (_id - 1) * 2);
 	//debug(0, "ons index: %04x", addr);
-	
+
 	ons_count = 0;
 	byte b;
 	byte on_id[16];
@@ -142,7 +143,7 @@
 
 	delete[] ons;
 	ons = NULL;
-	
+
 	if (ons_count > 0) {
 		ons = new Surface[ons_count];
 		for (uint32 i = 0; i < ons_count; ++i) {
@@ -157,10 +158,10 @@
 	debug(0, "loading lans animation");
 	Resources *res = Resources::instance();
 	//load lan000
-	
+
 	for (int i = 0; i < 4; ++i) {
 		animations[i].free();
-		
+
 		uint16 bx = 0xd89e + (_id - 1) * 4 + i;
 		byte bxv = res->dseg.get_byte(bx);
 		uint16 res_id = 4 * (_id - 1) + i + 1;
@@ -171,11 +172,11 @@
 		Common::SeekableReadStream *s = res->loadLan000(res_id);
 		if (s != NULL) {
 			animations[i].load(s, Animation::TypeLan);
-			if (bxv != 0 && bxv != 0xff) 
+			if (bxv != 0 && bxv != 0xff)
 				animations[i].id = bxv;
 			delete s;
 		}
-		
+
 		//uint16 bp = res->dseg.get_word();
 	}
 
@@ -184,10 +185,10 @@
 void Scene::init(int id, const Common::Point &pos) {
 	debug(0, "init(%d)", id);
 	_id = id;
-	
+
 	if (background.pixels == NULL)
 		background.create(320, 200, 1);
-		
+
 	warp(pos);
 
 	Resources *res = Resources::instance();
@@ -198,10 +199,10 @@
 			//dim down palette
 			uint i;
 			for (i = 0; i < 624; ++i) {
-				palette[i] = palette[i] > 0x20? palette[i] - 0x20: 0;
+				palette[i] = palette[i] > 0x20 ? palette[i] - 0x20 : 0;
 			}
 			for (i = 726; i < 768; ++i) {
-				palette[i] = palette[i] > 0x20? palette[i] - 0x20: 0;
+				palette[i] = palette[i] > 0x20 ? palette[i] - 0x20 : 0;
 			}
 		}
 	}
@@ -213,7 +214,7 @@
 
 	loadOns();
 	loadLans();
-	
+
 	byte *walkboxes_base = res->dseg.ptr(READ_LE_UINT16(res->dseg.ptr(0x6746 + (id - 1) * 2)));
 	walkboxes = *walkboxes_base++;
 
@@ -222,11 +223,11 @@
 		walkbox[i] = (Walkbox *)(walkboxes_base + 14 * i);
 		walkbox[i]->dump();
 	}
-	
+
 	//check music
 	int now_playing = _engine->music->getId();
-	
-	if (now_playing != res->dseg.get_byte(0xDB90)) 
+
+	if (now_playing != res->dseg.get_byte(0xDB90))
 		_engine->music->load(res->dseg.get_byte(0xDB90));
 }
 
@@ -257,9 +258,9 @@
 }
 
 bool Scene::processEvent(const Common::Event &event) {
-	switch(event.type) {
+	switch (event.type) {
 	case Common::EVENT_LBUTTONDOWN:
-	case Common::EVENT_RBUTTONDOWN: 
+	case Common::EVENT_RBUTTONDOWN:
 		if (!message.empty()) {
 			message.clear();
 			nextEvent();
@@ -275,7 +276,7 @@
 			sounds.clear();
 			current_event.clear();
 			message_color = 0xd1;
-			for(int i = 0; i < 4; ++i)
+			for (int i = 0; i < 4; ++i)
 				custom_animations[i].free();
 			_engine->playMusic(4);
 			init(10, Common::Point(136, 153));
@@ -299,7 +300,7 @@
 		system->unlockScreen();
 		return true;
 	}
-	
+
 	bool busy;
 	bool restart;
 
@@ -364,9 +365,9 @@
 					Common::Point dp(destination.x - position0.x, destination.y - position0.y);
 					int o;
 					if (ABS(dp.x) > ABS(dp.y))
-						o = dp.x > 0? Object::ActorRight: Object::ActorLeft;
+						o = dp.x > 0 ? Object::ActorRight : Object::ActorLeft;
 					else
-						o = dp.y > 0? Object::ActorDown: Object::ActorUp;
+						o = dp.y > 0 ? Object::ActorDown : Object::ActorUp;
 
 					position.x = position0.x + dp.x * progress / progress_total;
 					position.y = position0.y + dp.y * progress / progress_total;
@@ -412,9 +413,9 @@
 		}
 		*/
 
-	} while(restart);
-	
-	for(Sounds::iterator i = sounds.begin(); i != sounds.end(); ) {
+	} while (restart);
+
+	for (Sounds::iterator i = sounds.begin(); i != sounds.end();) {
 		Sound &sound = *i;
 		if (sound.delay == 0) {
 			debug(0, "sound %u started", sound.id);
@@ -425,7 +426,7 @@
 			++i;
 		}
 	}
-	
+
 	return busy;
 }
 
@@ -434,32 +435,35 @@
 		//debug(0, "processing next event");
 		current_event = events.front();
 		events.pop_front();
-		switch(current_event.type) {
-		
+		switch (current_event.type) {
+
 		case SceneEvent::SetOn: {
-			byte *ptr = getOns(current_event.scene == 0? _id: current_event.scene);
+			byte *ptr = getOns(current_event.scene == 0 ? _id : current_event.scene);
 			debug(0, "on[%u] = %02x", current_event.ons - 1, current_event.color);
 			ptr[current_event.ons - 1] = current_event.color;
 			loadOns();
 			current_event.clear();
-		} break;
-		
+		}
+		break;
+
 		case SceneEvent::SetLan: {
 			if (current_event.lan != 0) {
 				debug(0, "lan[%u] = %02x", current_event.lan - 1, current_event.color);
-				byte *ptr = getLans(current_event.scene == 0? _id: current_event.scene);
+				byte *ptr = getLans(current_event.scene == 0 ? _id : current_event.scene);
 				ptr[current_event.lan - 1] = current_event.color;
 			}
 			loadLans();
 			current_event.clear();
-		} break;
-		
+		}
+		break;
+
 		case SceneEvent::LoadScene: {
 			init(current_event.scene, current_event.dst);
 			sounds.clear();
 			current_event.clear();
-		} break;
-		
+		}
+		break;
+
 		case SceneEvent::Walk: {
 			Common::Point dst = current_event.dst;
 			if ((current_event.color & 2) != 0) { //relative move
@@ -471,17 +475,18 @@
 				current_event.clear();
 			} else
 				moveTo(dst, current_event.orientation);
-		} break;
-		
-		case SceneEvent::CreditsMessage: 
-		case SceneEvent::Message: 
+		}
+		break;
+
+		case SceneEvent::CreditsMessage:
+		case SceneEvent::Message:
 			//debug(0, "pop(%04x)", current_event.message);
 			message = current_event.message;
 			message_pos = messagePosition(message, position);
 			message_color = current_event.color;
 			break;
-		
-		case SceneEvent::PlayAnimation: 
+
+		case SceneEvent::PlayAnimation:
 			debug(0, "playing animation %u", current_event.animation);
 			playAnimation(current_event.color & 0x3 /*slot actually :)*/, current_event.animation, (current_event.color & 0x80) != 0, (current_event.color & 0x40) != 0);
 			current_event.clear();
@@ -494,17 +499,17 @@
 			break;
 
 		case SceneEvent::ClearAnimations:
-			for(byte i = 0; i < 4; ++i) 
+			for (byte i = 0; i < 4; ++i)
 				custom_animations[i].free();
 			current_event.clear();
 			break;
-		
-		case SceneEvent::PlayActorAnimation: 
+
+		case SceneEvent::PlayActorAnimation:
 			debug(0, "playing actor animation %u", current_event.animation);
 			playActorAnimation(current_event.animation, (current_event.color & 0x80) != 0);
 			current_event.clear();
 			break;
-			
+
 		case SceneEvent::PlayMusic:
 			debug(0, "setting music %u", current_event.music);
 			_engine->setMusic(current_event.music);
@@ -521,30 +526,30 @@
 			}
 			current_event.clear();
 			break;
-		
+
 		case SceneEvent::EnableObject: {
-				debug(0, "%s object #%u", current_event.color?"enabling":"disabling", current_event.object - 1);
-				Object *obj = getObject(current_event.object - 1, current_event.scene == 0? _id: current_event.scene);
-				obj->enabled = current_event.color;
-				current_event.clear();
-			}
-			break;
-		
+			debug(0, "%s object #%u", current_event.color ? "enabling" : "disabling", current_event.object - 1);
+			Object *obj = getObject(current_event.object - 1, current_event.scene == 0 ? _id : current_event.scene);
+			obj->enabled = current_event.color;
+			current_event.clear();
+		}
+		break;
+
 		case SceneEvent::HideActor:
 			hide_actor = current_event.color != 0;
 			current_event.clear();
 			break;
-		
+
 		case SceneEvent::WaitForAnimation:
 			debug(0, "waiting for the animation");
 			break;
-			
+
 		case SceneEvent::Quit:
 			debug(0, "quit!");
 			_engine->quitGame();
 			break;
-		
-		default: 
+
+		default:
 			error("empty/unhandler event[%d]", (int)current_event.type);
 		}
 	}
@@ -560,7 +565,7 @@
 
 	memset(p, 0, 1024);
 	for (int i = 0; i < 256; ++i) {
-		for (int c = 0; c < 3; ++c) 
+		for (int c = 0; c < 3; ++c)
 			p[i * 4 + c] = buf[i * 3 + c] * mul;
 	}
 
@@ -570,7 +575,7 @@
 Object *Scene::getObject(int id, int scene_id) {
 	if (scene_id == 0)
 		scene_id = _id;
-	
+
 	Resources *res = Resources::instance();
 	uint16 addr = res->dseg.get_word(0x7254 + (scene_id - 1) * 2);
 	//debug(0, "object base: %04x, x: %d, %d", addr, point.x, point.y);
@@ -580,7 +585,7 @@
 	return obj;
 }
 
-Common::Point Scene::messagePosition(const Common::String &str, const Common::Point & position) {
+Common::Point Scene::messagePosition(const Common::String &str, const Common::Point &position) {
 	Resources *res = Resources::instance();
 	uint w = res->font7.render(NULL, 0, 0, str);
 	Common::Point message_pos = position;

Modified: scummvm/trunk/engines/teenagent/scene.h
===================================================================
--- scummvm/trunk/engines/teenagent/scene.h	2009-09-15 08:51:16 UTC (rev 44100)
+++ scummvm/trunk/engines/teenagent/scene.h	2009-09-15 08:54:06 UTC (rev 44101)
@@ -39,11 +39,11 @@
 class Dialog;
 
 struct SceneEvent {
-	enum Type { 
-		None, Message, Walk, PlayAnimation, PlayActorAnimation, PauseAnimation, ClearAnimations, 
-		LoadScene, SetOn, SetLan, PlayMusic, 
-		PlaySound, EnableObject, HideActor, 
-		WaitForAnimation, CreditsMessage, 
+	enum Type {
+		None, Message, Walk, PlayAnimation, PlayActorAnimation, PauseAnimation, ClearAnimations,
+		LoadScene, SetOn, SetLan, PlayMusic,
+		PlaySound, EnableObject, HideActor,
+		WaitForAnimation, CreditsMessage,
 		Quit
 	} type;
 
@@ -59,9 +59,9 @@
 	byte sound;
 	byte object;
 
-	SceneEvent(Type type_) : 
-		type(type_), message(), color(0xd1), animation(0), orientation(0), dst(), 
-		scene(0), ons(0), lan(0), music(0), sound(0), object(0) {}
+	SceneEvent(Type type_) :
+			type(type_), message(), color(0xd1), animation(0), orientation(0), dst(),
+			scene(0), ons(0), lan(0), music(0), sound(0), object(0) {}
 
 	void clear() {
 		type = None;
@@ -77,47 +77,47 @@
 		sound = 0;
 		object = 0;
 	}
-	
+
 	inline bool empty() const {
 		return type == None;
 	}
-	
+
 	void dump() const {
-		debug(0, "event[%d]: \"%s\"[%02x], animation: %u, dst: (%d, %d) [%u], scene: %u, ons: %u, lan: %u, object: %u, music: %u, sound: %u", 
-			(int)type, message.c_str(), color, animation, dst.x, dst.y, orientation, scene, ons, lan, object, music, sound
-		);
+		debug(0, "event[%d]: \"%s\"[%02x], animation: %u, dst: (%d, %d) [%u], scene: %u, ons: %u, lan: %u, object: %u, music: %u, sound: %u",
+		      (int)type, message.c_str(), color, animation, dst.x, dst.y, orientation, scene, ons, lan, object, music, sound
+		     );
 	}
 };
 
 class Scene {
-public: 
-	bool intro; 
-	
+public:
+	bool intro;
+
 	Scene();
-	
+
 	void init(TeenAgentEngine *engine, OSystem *system);
 	void init(int id, const Common::Point &pos);
 	bool render(OSystem *system);
 	int getId() const { return _id; }
-	
-	void warp(const Common::Point & point, byte orientation = 0);
-	
-	void moveTo(const Common::Point & point, byte orientation = 0, bool validate = 0);
+
+	void warp(const Common::Point &point, byte orientation = 0);
+
+	void moveTo(const Common::Point &point, byte orientation = 0, bool validate = 0);
 	Common::Point getPosition() const { return position; }
-	
+
 	void displayMessage(const Common::String &str, byte color = 0xd1);
 	void setOrientation(uint8 o) { orientation = o; }
 	void push(const SceneEvent &event);
 
 	bool processEvent(const Common::Event &event);
-	
+
 	void clear();
-	
+
 	byte *getOns(int id);
 	byte *getLans(int id);
-	
+
 	bool eventRunning() const { return !current_event.empty(); }
-	
+
 	Walkbox *getWalkbox(byte id) { return walkbox[id]; }
 	Object *getObject(int id, int scene_id = 0);
 
@@ -127,20 +127,20 @@
 
 	void playAnimation(byte idx, uint id, bool loop, bool paused);
 	void playActorAnimation(uint id, bool loop);
-	
+
 	byte palette[768];
 	void setPalette(OSystem *system, const byte *palette, unsigned mul = 1);
-	static Common::Point messagePosition(const Common::String &str, const Common::Point & position);
+	static Common::Point messagePosition(const Common::String &str, const Common::Point &position);
 
 	bool processEventQueue();
 	inline bool nextEvent() {
 		current_event.clear();
 		return processEventQueue();
 	}
-	
+
 	TeenAgentEngine *_engine;
 	OSystem *_system;
-	
+
 	int _id;
 	Graphics::Surface background;
 	Surface on;
@@ -152,19 +152,19 @@
 	Common::Point position0, position, destination;
 	int progress, progress_total;
 	uint8 orientation;
-	
+
 	byte walkboxes;
 	Walkbox *walkbox[255];
 
 	Common::String message;
 	Common::Point message_pos;
 	byte message_color;
-	
+
 	typedef Common::List<SceneEvent> EventList;
 	EventList events;
 	SceneEvent current_event;
 	bool hide_actor;
-	
+
 	struct Sound {
 		byte id, delay;
 		Sound(byte i, byte d): id(i), delay(d) {}

Modified: scummvm/trunk/engines/teenagent/segment.h
===================================================================
--- scummvm/trunk/engines/teenagent/segment.h	2009-09-15 08:51:16 UTC (rev 44100)
+++ scummvm/trunk/engines/teenagent/segment.h	2009-09-15 08:54:06 UTC (rev 44101)
@@ -34,12 +34,12 @@
 	uint32 _size;
 	byte *_data;
 
-public: 
+public:
 	Segment() : _size(0), _data(0) {}
 	~Segment();
-	
+
 	void read(Common::ReadStream *s, uint32 _size);
-	
+
 	inline byte get_byte(uint32 offset) const {
 		assert(offset < _size);
 		return _data[offset];
@@ -64,7 +64,7 @@
 		assert(offset + 3 < _size);
 		return WRITE_LE_UINT32(_data + offset, v);
 	}
-	
+
 	const byte *ptr(uint32 addr) const {
 		assert(addr < _size);
 		return _data + addr;

Modified: scummvm/trunk/engines/teenagent/surface.cpp
===================================================================
--- scummvm/trunk/engines/teenagent/surface.cpp	2009-09-15 08:51:16 UTC (rev 44100)
+++ scummvm/trunk/engines/teenagent/surface.cpp	2009-09-15 08:54:06 UTC (rev 44101)
@@ -36,24 +36,24 @@
 void Surface::load(Common::SeekableReadStream *stream, Type type) {
 	//debug(0, "load()");
 	free();
-	
+
 	x = y = 0;
 	memset(flags, 0, sizeof(flags));
-	
+
 	if (type == TypeOn) {
 		byte fn = stream->readByte();
 		if (stream->eos())
 			return;
-		
+
 		for (byte i = 0; i < fn; ++i) {
 			flags[i] = stream->readUint16LE();
 			debug(0, "flags[%u] = %u (0x%04x)", i, flags[i], flags[i]);
 		}
 	}
-	
+
 	uint16 w_ = stream->readUint16LE();
 	uint16 h_ = stream->readUint16LE();
-	
+
 	if (type != TypeLan) {
 		uint16 pos = stream->readUint16LE();
 		x = pos % 320;
@@ -63,7 +63,7 @@
 	//debug(0, "declared info: %ux%u (%04xx%04x) -> %u,%u", w_, h_, w_, h_, x, y);
 	if (stream->eos() || w_ == 0)
 		return;
-		
+
 	if (w_ * h_ > stream->size()) {//rough but working
 		debug(0, "invalid surface %ux%u -> %u,%u", w_, h_, x, y);
 		return;
@@ -81,7 +81,7 @@
 
 	byte *src = (byte *)pixels;
 	byte *dst = (byte *)surface->getBasePtr(dx + x, dy + y);
-	
+
 	for (int i = 0; i < h; ++i) {
 		for (int j = 0; j < w; ++j) {
 			byte p = src[j];

Modified: scummvm/trunk/engines/teenagent/surface.h
===================================================================
--- scummvm/trunk/engines/teenagent/surface.h	2009-09-15 08:51:16 UTC (rev 44100)
+++ scummvm/trunk/engines/teenagent/surface.h	2009-09-15 08:54:06 UTC (rev 44101)
@@ -37,7 +37,7 @@
 
 	uint16 flags[255];
 	uint16 x, y;
-	
+
 	Surface();
 	void load(Common::SeekableReadStream *stream, Type type);
 	void render(Graphics::Surface *surface, int dx = 0, int dy = 0, bool mirror = false);

Modified: scummvm/trunk/engines/teenagent/teenagent.cpp
===================================================================
--- scummvm/trunk/engines/teenagent/teenagent.cpp	2009-09-15 08:51:16 UTC (rev 44100)
+++ scummvm/trunk/engines/teenagent/teenagent.cpp	2009-09-15 08:54:06 UTC (rev 44101)
@@ -56,40 +56,39 @@
 			scene->displayMessage(desc);
 			//debug(0, "%s[%u]: description: %s", current_object->name, current_object->id, desc.c_str());
 		}
-		}
-		break;
-	case ActionUse:
-		{
-			InventoryObject *inv = inventory->selectedObject();
-			if (inv != NULL) {
-				byte *dcall = res->dseg.ptr(0xbb87);
-				dcall = res->dseg.ptr(READ_LE_UINT16(dcall + scene->getId() * 2 - 2));
-				for (UseObject *obj = (UseObject *)dcall; obj->inventory_id != 0; ++obj) {
-					if (obj->inventory_id == inv->id && dst_object->id == obj->object_id) {
-						debug(0, "combine! %u,%u", obj->x, obj->y);
-						//moveTo(Common::Point(obj->x, obj->y), NULL, Examine);
-						inventory->resetSelectedObject();
-						if (!processCallback(obj->callback)) 
-							debug(0, "fixme! display proper description");
-						return;
-					}
+	}
+	break;
+	case ActionUse: {
+		InventoryObject *inv = inventory->selectedObject();
+		if (inv != NULL) {
+			byte *dcall = res->dseg.ptr(0xbb87);
+			dcall = res->dseg.ptr(READ_LE_UINT16(dcall + scene->getId() * 2 - 2));
+			for (UseObject *obj = (UseObject *)dcall; obj->inventory_id != 0; ++obj) {
+				if (obj->inventory_id == inv->id && dst_object->id == obj->object_id) {
+					debug(0, "combine! %u,%u", obj->x, obj->y);
+					//moveTo(Common::Point(obj->x, obj->y), NULL, Examine);
+					inventory->resetSelectedObject();
+					if (!processCallback(obj->callback))
+						debug(0, "fixme! display proper description");
+					return;
 				}
-				
-				//error
-				inventory->resetSelectedObject();
-				displayMessage(0x3457);
-				
-				break;
-			} else {
-				byte *dcall = res->dseg.ptr(0xb89c);
-				dcall = res->dseg.ptr(READ_LE_UINT16(dcall + scene->getId() * 2 - 2));
-				dcall += 2 * dst_object->id - 2;
-				uint16 callback = READ_LE_UINT16(dcall);
-				if (!processCallback(callback)) 
-					scene->displayMessage(dst_object->description());
 			}
+
+			//error
+			inventory->resetSelectedObject();
+			displayMessage(0x3457);
+
+			break;
+		} else {
+			byte *dcall = res->dseg.ptr(0xb89c);
+			dcall = res->dseg.ptr(READ_LE_UINT16(dcall + scene->getId() * 2 - 2));
+			dcall += 2 * dst_object->id - 2;
+			uint16 callback = READ_LE_UINT16(dcall);
+			if (!processCallback(callback))
+				scene->displayMessage(dst_object->description());
 		}
-		break;
+	}
+	break;
 
 	case ActionNone:
 		break;
@@ -104,7 +103,7 @@
 	dst_object = object;
 	object->rect.dump();
 	object->actor_rect.dump();
-	
+
 	if (object->actor_rect.valid())
 		scene->moveTo(Common::Point(object->actor_rect.right, object->actor_rect.bottom), object->actor_orientation);
 	if (object->actor_orientation > 0)
@@ -115,7 +114,7 @@
 void TeenAgentEngine::examine(const Common::Point &point, Object *object) {
 	if (scene->eventRunning())
 		return;
-	
+
 	if (object != NULL) {
 		Common::Point dst = object->actor_rect.center();
 		debug(0, "click %d, %d, object %d, %d", point.x, point.y, dst.x, dst.y);
@@ -158,11 +157,11 @@
 		delete in;
 		return Common::kReadingFailed;
 	}
-	
+
 	delete in;
-	
+
 	memcpy(res->dseg.ptr(0x6478), data, sizeof(data));
-	
+
 	scene->clear();
 
 	setMusic(Resources::instance()->dseg.get_byte(0xDB90));
@@ -198,25 +197,25 @@
 	Resources *res = Resources::instance();
 	if (!res->loadArchives(_gameDescription))
 		return Common::kUnknownError;
-	
+
 	Common::EventManager *_event = _system->getEventManager();
 
 	initGraphics(320, 200, false);
-	
+
 	scene = new Scene;
 	inventory = new Inventory;
-	
+
 	scene->init(this, _system);
 	inventory->init(this);
 
 	_system->setMouseCursor(res->dseg.ptr(0x00da), 8, 12, 0, 0, 1);
 
 	syncSoundSettings();
-	
+
 	music->load(1);
 	_mixer->playInputStream(Audio::Mixer::kMusicSoundType, &_musicHandle, music, -1, 255, 0, true, false);
 	music->start();
-	
+
 	{
 		int load_slot = Common::ConfigManager::instance().getInt("save_slot");
 		debug(0, "slot: %d", load_slot);
@@ -230,26 +229,26 @@
 	}
 
 	uint32 frame = 0;
-	
+
 	Common::Event event;
 	Common::Point mouse;
-	
+
 	do {
 		_system->showMouse(true);
 		uint32 t0 = _system->getMillis();
 		Object *current_object = findObject(scene->getId(), mouse);
-		
+
 		while (_event->pollEvent(event)) {
 			if (event.type == Common::EVENT_RTL) {
 				deinit();
 				return Common::kNoError;
 			}
-		
-			if ((!scene_busy && inventory->processEvent(event)) || scene->processEvent(event)) 
+
+			if ((!scene_busy && inventory->processEvent(event)) || scene->processEvent(event))
 				continue;
-			
+
 			//debug(0, "event");
-			switch(event.type) {
+			switch (event.type) {
 			case Common::EVENT_LBUTTONDOWN:
 				examine(event.mouse, current_object);
 				break;
@@ -259,10 +258,11 @@
 			case Common::EVENT_MOUSEMOVE:
 				mouse = event.mouse;
 				break;
-			default:;
+			default:
+				;
 			}
 		}
-		
+
 		uint32 f0 = frame * 10 / 25, f1 = (frame + 1) * 10 / 25;
 		if (f0 != f1) {
 			bool b = scene->render(_system);
@@ -274,7 +274,7 @@
 			}
 		}
 		bool busy = inventory->active() || scene_busy;
-		
+

@@ Diff output truncated at 100000 characters. @@

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