[Scummvm-cvs-logs] CVS: residual bits.h,1.12,1.13 blocky16.cpp,1.1,1.2 blocky16.h,1.1,1.2 color.h,1.2,1.3 colormap.h,1.2,1.3 costume.cpp,1.11,1.12 costume.h,1.6,1.7 debug.cpp,1.3,1.4 debug.h,1.3,1.4 driver_gl.cpp,1.4,1.5 driver_gl.h,1.3,1.4 engine.cpp,1.15,1.16 engine.h,1.5,1.6 keyframe.cpp,1.4,1.5 keyframe.h,1.1,1.2 lab.cpp,1.6,1.7 lab.h,1.3,1.4 localize.cpp,1.2,1.3 localize.h,1.2,1.3 lua.cpp,1.40,1.41 lua.h,1.1,1.2 main.cpp,1.19,1.20 material.cpp,1.6,1.7 material.h,1.2,1.3

Pawel Kolodziejski aquadran at users.sourceforge.net
Tue Feb 24 13:25:06 CET 2004


Update of /cvsroot/scummvm/residual
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22122

Modified Files:
	bits.h blocky16.cpp blocky16.h color.h colormap.h costume.cpp 
	costume.h debug.cpp debug.h driver_gl.cpp driver_gl.h 
	engine.cpp engine.h keyframe.cpp keyframe.h lab.cpp lab.h 
	localize.cpp localize.h lua.cpp lua.h main.cpp material.cpp 
	material.h 
Log Message:
update copyright date, some formating stuff, rest later

Index: bits.h
===================================================================
RCS file: /cvsroot/scummvm/residual/bits.h,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- bits.h	22 Feb 2004 18:40:29 -0000	1.12
+++ bits.h	24 Feb 2004 21:09:53 -0000	1.13
@@ -1,5 +1,5 @@
 // Residual - Virtual machine to run LucasArts' 3D adventure games
-// Copyright (C) 2003 The ScummVM-Residual Team (www.scummvm.org)
+// Copyright (C) 2003-2004 The ScummVM-Residual Team (www.scummvm.org)
 //
 //  This library is free software; you can redistribute it and/or
 //  modify it under the terms of the GNU Lesser General Public
@@ -355,24 +355,24 @@
 #if SDL_BYTEORDER == SDL_BIG_ENDIAN
 
 inline float get_float(const char *data) {
-  const unsigned char *udata = reinterpret_cast<const unsigned char *>(data);
-  unsigned char fdata[4];
-  fdata[0] = udata[3];
-  fdata[1] = udata[2];
-  fdata[2] = udata[1];
-  fdata[3] = udata[0];
-  return *(reinterpret_cast<const float *>(fdata));
+	const unsigned char *udata = reinterpret_cast<const unsigned char *>(data);
+	unsigned char fdata[4];
+	fdata[0] = udata[3];
+	fdata[1] = udata[2];
+	fdata[2] = udata[1];
+	fdata[3] = udata[0];
+	return *(reinterpret_cast<const float *>(fdata));
 }
 
 #else
 
 inline float get_float(const char *data) {
-  return *(reinterpret_cast<const float *>(data));
+	return *(reinterpret_cast<const float *>(data));
 }
 #endif
 
 inline Vector3d get_vector3d(const char *data) {
-  return Vector3d(get_float(data), get_float(data + 4), get_float(data + 8));
+	return Vector3d(get_float(data), get_float(data + 4), get_float(data + 8));
 }
 
 #endif

Index: blocky16.cpp
===================================================================
RCS file: /cvsroot/scummvm/residual/blocky16.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- blocky16.cpp	12 Dec 2003 08:39:07 -0000	1.1
+++ blocky16.cpp	24 Feb 2004 21:09:53 -0000	1.2
@@ -1,5 +1,5 @@
 // Residual - Virtual machine to run LucasArts' 3D adventure games
-// Copyright (C) 2003 The ScummVM-Residual Team (www.scummvm.org)
+// Copyright (C) 2003-2004 The ScummVM-Residual Team (www.scummvm.org)
 //
 //  This library is free software; you can redistribute it and/or
 //  modify it under the terms of the GNU Lesser General Public

Index: blocky16.h
===================================================================
RCS file: /cvsroot/scummvm/residual/blocky16.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- blocky16.h	12 Dec 2003 08:39:07 -0000	1.1
+++ blocky16.h	24 Feb 2004 21:09:53 -0000	1.2
@@ -1,5 +1,5 @@
 // Residual - Virtual machine to run LucasArts' 3D adventure games
-// Copyright (C) 2003 The ScummVM-Residual Team (www.scummvm.org)
+// Copyright (C) 2003-2004 The ScummVM-Residual Team (www.scummvm.org)
 //
 //  This library is free software; you can redistribute it and/or
 //  modify it under the terms of the GNU Lesser General Public

Index: color.h
===================================================================
RCS file: /cvsroot/scummvm/residual/color.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- color.h	5 Oct 2003 17:45:46 -0000	1.2
+++ color.h	24 Feb 2004 21:09:53 -0000	1.3
@@ -1,5 +1,5 @@
 // Residual - Virtual machine to run LucasArts' 3D adventure games
-// Copyright (C) 2003 The ScummVM-Residual Team (www.scummvm.org)
+// Copyright (C) 2003-2004 The ScummVM-Residual Team (www.scummvm.org)
 //
 //  This library is free software; you can redistribute it and/or
 //  modify it under the terms of the GNU Lesser General Public
@@ -18,33 +18,35 @@
 #ifndef COLOR_H
 #define COLOR_H
 
+#include "bits.h"
+
 class Color {
 public:
-  unsigned char vals_[3];
+	byte vals_[3];
 
-  Color() { }
-  Color(unsigned char r, unsigned char g, unsigned char b) {
-    vals_[0] = r; vals_[1] = g; vals_[2] = b;
-  }
-  Color(const Color& c) {
-    vals_[0] = c.vals_[0]; vals_[1] = c.vals_[1]; vals_[2] = c.vals_[2];
-  }
-  unsigned char &red() { return vals_[0]; }
-  unsigned char red() const { return vals_[0]; }
-  unsigned char &green() { return vals_[1]; }
-  unsigned char green() const { return vals_[1]; }
-  unsigned char &blue() { return vals_[2]; }
-  unsigned char blue() const { return vals_[2]; }
+	Color() {}
+	Color(byte r, byte g, byte b) {
+		vals_[0] = r; vals_[1] = g; vals_[2] = b;
+	}
+	Color(const Color& c) {
+		vals_[0] = c.vals_[0]; vals_[1] = c.vals_[1]; vals_[2] = c.vals_[2];
+	}
+	byte &red() { return vals_[0]; }
+	byte red() const { return vals_[0]; }
+	byte &green() { return vals_[1]; }
+	byte green() const { return vals_[1]; }
+	byte &blue() { return vals_[2]; }
+	byte blue() const { return vals_[2]; }
 
-  Color& operator =(const Color &c) {
-    vals_[0] = c.vals_[0]; vals_[1] = c.vals_[1]; vals_[2] = c.vals_[2];
-    return *this;
-  }
+	Color& operator =(const Color &c) {
+		vals_[0] = c.vals_[0]; vals_[1] = c.vals_[1]; vals_[2] = c.vals_[2];
+	return *this;
+}
 
-  Color& operator =(Color *c) {
-    vals_[0] = c->vals_[0]; vals_[1] = c->vals_[1]; vals_[2] = c->vals_[2];
-    return *this;
-  }
+	Color& operator =(Color *c) {
+		vals_[0] = c->vals_[0]; vals_[1] = c->vals_[1]; vals_[2] = c->vals_[2];
+		return *this;
+	}
 };
 
 #endif

Index: colormap.h
===================================================================
RCS file: /cvsroot/scummvm/residual/colormap.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- colormap.h	5 Oct 2003 17:45:46 -0000	1.2
+++ colormap.h	24 Feb 2004 21:09:53 -0000	1.3
@@ -1,5 +1,5 @@
 // Residual - Virtual machine to run LucasArts' 3D adventure games
-// Copyright (C) 2003 The ScummVM-Residual Team (www.scummvm.org)
+// Copyright (C) 2003-2004 The ScummVM-Residual Team (www.scummvm.org)
 //
 //  This library is free software; you can redistribute it and/or
 //  modify it under the terms of the GNU Lesser General Public
@@ -24,17 +24,16 @@
 
 class CMap : public Resource {
 public:
-  // Load a colormap from the given data.
-  CMap(const char *filename, const char *data, int len) :
-    Resource(filename)
-  {
-    if (len < 4 || std::memcmp(data, "CMP ", 4) != 0)
-      error("Invalid magic loading colormap\n");
-    std::memcpy(colors, data + 64, sizeof(colors));
-  }
+	// Load a colormap from the given data.
+	CMap(const char *filename, const char *data, int len) :
+		Resource(filename) {
+	if (len < 4 || std::memcmp(data, "CMP ", 4) != 0)
+		error("Invalid magic loading colormap\n");
+		std::memcpy(colors, data + 64, sizeof(colors));
+	}
 
-  // The color data, in RGB format
-  char colors[256 * 3];
+	// The color data, in RGB format
+	char colors[256 * 3];
 };
 
 #endif

Index: costume.cpp
===================================================================
RCS file: /cvsroot/scummvm/residual/costume.cpp,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- costume.cpp	12 Dec 2003 21:17:31 -0000	1.11
+++ costume.cpp	24 Feb 2004 21:09:53 -0000	1.12
@@ -1,5 +1,5 @@
 // Residual - Virtual machine to run LucasArts' 3D adventure games
-// Copyright (C) 2003 The ScummVM-Residual Team (www.scummvm.org)
+// Copyright (C) 2003-2004 The ScummVM-Residual Team (www.scummvm.org)
 //
 //  This library is free software; you can redistribute it and/or
 //  modify it under the terms of the GNU Lesser General Public
@@ -85,683 +85,654 @@
 
 class BitmapComponent : public Costume::Component {
 public:
-  BitmapComponent(Costume::Component *parent, int parentID,
[...1097 lines suppressed...]
+		}
 	}
 }
 
-void Costume::setHead( int joint1, int joint2, int joint3, float maxRoll, float maxPitch, float maxYaw )
-{
+void Costume::setHead( int joint1, int joint2, int joint3, float maxRoll, float maxPitch, float maxYaw ) {
 	head_.joint1 = joint1;
 	head_.joint2 = joint2;
 	head_.joint3 = joint3;
@@ -770,8 +741,7 @@
 	head_.maxYaw = maxYaw;
 }
 
-void Costume::setPosRotate( Vector3d pos_, float pitch_, float yaw_, float roll_ )
-{
+void Costume::setPosRotate( Vector3d pos_, float pitch_, float yaw_, float roll_ ) {
 	matrix_.pos_ = pos_;
 	matrix_.rot_.buildFromPitchYawRoll( pitch_, yaw_, roll_ );
 }

Index: costume.h
===================================================================
RCS file: /cvsroot/scummvm/residual/costume.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- costume.h	28 Aug 2003 01:55:48 -0000	1.6
+++ costume.h	24 Feb 2004 21:09:53 -0000	1.7
@@ -1,5 +1,5 @@
 // Residual - Virtual machine to run LucasArts' 3D adventure games
-// Copyright (C) 2003 The ScummVM-Residual Team (www.scummvm.org)
+// Copyright (C) 2003-2004 The ScummVM-Residual Team (www.scummvm.org)
 //
 //  This library is free software; you can redistribute it and/or
 //  modify it under the terms of the GNU Lesser General Public
@@ -27,109 +27,107 @@
 
 class Costume {
 public:
-  Costume(const char *filename, const char *data, int len,
-	  Costume *prevCost);
+	Costume(const char *filename, const char *data, int len, Costume *prevCost);
 
-  ~Costume();
+	~Costume();
 
-  const char *filename() const { return fname_.c_str(); }
+	const char *filename() const { return fname_.c_str(); }
 
-  void playChore(int num) { chores_[num].play(); }
-  void playChoreLooping(int num) { chores_[num].playLooping(); }
-  void setChoreLooping(int num, bool val) { chores_[num].setLooping(val); }
-  void stopChore(int num) { chores_[num].stop(); }
-  void stopChores();
-  int isChoring(int num, bool excludeLooping);
-  int isChoring(bool excludeLooping);
+	void playChore(int num) { chores_[num].play(); }
+	void playChoreLooping(int num) { chores_[num].playLooping(); }
+	void setChoreLooping(int num, bool val) { chores_[num].setLooping(val); }
+	void stopChore(int num) { chores_[num].stop(); }
+	void stopChores();
+	int isChoring(int num, bool excludeLooping);
+	int isChoring(bool excludeLooping);
 
-  void playTalkChores();
-  void stopTalkChores();
-  void setTalkChore(int index, int chore);
+	void playTalkChores();
+	void stopTalkChores();
+	void setTalkChore(int index, int chore);
 
-  void setHead( int joint1, int joint2, int joint3, float maxRoll, float maxPitch, float maxYaw );
+	void setHead( int joint1, int joint2, int joint3, float maxRoll, float maxPitch, float maxYaw );
 
-  void update();
-  void draw();
-  void setPosRotate( Vector3d pos_, float pitch_, float yaw_, float roll_ );
+	void update();
+	void draw();
+	void setPosRotate( Vector3d pos_, float pitch_, float yaw_, float roll_ );
 
-  class Component {
-  public:
-    Component(Component *parent, int parentID);
+	class Component {
+	public:
+		Component(Component *parent, int parentID);
 
-	virtual void setMatrix( Matrix4 matrix ) { };
-    virtual void init() { }
-    virtual void setKey(int /* val */) { }
-    virtual void update() { }
-    virtual void draw() { }
-    virtual void reset() { }
-    virtual ~Component() { }
+		virtual void setMatrix( Matrix4 matrix ) { };
+		virtual void init() { }
+		virtual void setKey(int /* val */) { }
+		virtual void update() { }
+		virtual void draw() { }
+		virtual void reset() { }
+		virtual ~Component() { }
 
-  protected:
-    int parentID_;
-    Component *parent_, *child_, *sibling_;
-	Matrix4 matrix_;
-    void setParent(Component *newParent);
+	protected:
+		int parentID_;
+		Component *parent_, *child_, *sibling_;
+		Matrix4 matrix_;
+		void setParent(Component *newParent);
 
-    friend class Costume;
-  };
+		friend class Costume;
+	};
 
 private:
-  Component *loadComponent(char tag[4], Component *parent, int parentID,
-			   const char *name);
+	Component *loadComponent(char tag[4], Component *parent, int parentID, const char *name);
 
-  std::string fname_;
+	std::string fname_;
 
-  int numComponents_;
-  Component **components_;
+	int numComponents_;
+	Component **components_;
 
-  struct TrackKey {
-    int time_, value_;
-  };
+	struct TrackKey {
+		int time_, value_;
+	};
 
-  struct ChoreTrack {
-    int compID_;
-    int numKeys_;
-    TrackKey *keys_;
-  };
+	struct ChoreTrack {
+		int compID_;
+		int numKeys_;
+		TrackKey *keys_;
+	};
 
-  struct Head {
-	  int joint1;
-	  int joint2;
-	  int joint3;
-	  float maxRoll;
-	  float maxPitch;
-	  float maxYaw;
-  } head_;
+	struct Head {
+		int joint1;
+		int joint2;
+		int joint3;
+		float maxRoll;
+		float maxPitch;
+		float maxYaw;
+	} head_;
 
-  class Chore {
-  public:
-    void load(Costume *owner, TextSplitter &ts);
-    void play();
-    void playLooping();
-    void setLooping(bool val) { looping_ = val; }
-    void stop();
-    void update();
+	class Chore {
+	public:
+		void load(Costume *owner, TextSplitter &ts);
+		void play();
+		void playLooping();
+		void setLooping(bool val) { looping_ = val; }
+		void stop();
+		void update();
 
-  private:
-    Costume *owner_;
+	private:
+		Costume *owner_;
 
-    int length_;
-    int numTracks_;
-    ChoreTrack *tracks_;
-    char name_[32];
+		int length_;
+		int numTracks_;
+		ChoreTrack *tracks_;
+		char name_[32];
 
-    bool hasPlayed_, playing_, looping_;
-    int currTime_;
+		bool hasPlayed_, playing_, looping_;
+		int currTime_;
 
-    void setKeys(int startTime, int stopTime);
+		void setKeys(int startTime, int stopTime);
 
-    friend class Costume;
-  };
+		friend class Costume;
+	};
 
-  int numChores_;
-  Chore *chores_;
-  int talkChores_[MAX_TALK_CHORES];
-  Matrix4 matrix_;
+	int numChores_;
+	Chore *chores_;
+	int talkChores_[MAX_TALK_CHORES];
+	Matrix4 matrix_;
 };
 
 #endif

Index: debug.cpp
===================================================================
RCS file: /cvsroot/scummvm/residual/debug.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- debug.cpp	1 Feb 2004 12:38:33 -0000	1.3
+++ debug.cpp	24 Feb 2004 21:09:53 -0000	1.4
@@ -1,5 +1,5 @@
 // Residual - Virtual machine to run LucasArts' 3D adventure games
-// Copyright (C) 2003 The ScummVM-Residual Team (www.scummvm.org)
+// Copyright (C) 2003-2004 The ScummVM-Residual Team (www.scummvm.org)
 //
 //  This library is free software; you can redistribute it and/or
 //  modify it under the terms of the GNU Lesser General Public
@@ -23,85 +23,85 @@
 #include <SDL.h>
 
 const char *tag2str(uint32 tag) {
-  static char str[5];
-  str[0] = (char)(tag >> 24);
-  str[1] = (char)(tag >> 16);
-  str[2] = (char)(tag >> 8);
-  str[3] = (char)tag;
-  str[4] = '\0';
-  return str;
+	static char str[5];
+	str[0] = (char)(tag >> 24);
+	str[1] = (char)(tag >> 16);
+	str[2] = (char)(tag >> 8);
+	str[3] = (char)tag;
+	str[4] = '\0';
+	return str;
 }
 
 void hexdump(const byte * data, int len, int bytesPerLine) {
-        assert(1 <= bytesPerLine && bytesPerLine <= 32);
-        int i;
-        byte c;
-        int offset = 0;
-        while (len >= bytesPerLine) {
-                printf("%06x: ", offset);
-                for (i = 0; i < bytesPerLine; i++) {
-                        printf("%02x ", data[i]);
-                        if (i % 4 == 3)
-                                printf(" ");
-                }
-                printf(" |");
-                for (i = 0; i < bytesPerLine; i++) {
-                        c = data[i];
-                        if (c < 32 || c >= 127)
-                                c = '.';
-                        printf("%c", c);
-                }
-                printf("|\n");
-                data += bytesPerLine;
-                len -= bytesPerLine;
-                offset += bytesPerLine;
-        }
+	assert(1 <= bytesPerLine && bytesPerLine <= 32);
+	int i;
+	byte c;
+	int offset = 0;
+	while (len >= bytesPerLine) {
+		printf("%06x: ", offset);
+		for (i = 0; i < bytesPerLine; i++) {
+			printf("%02x ", data[i]);
+			if (i % 4 == 3)
+				printf(" ");
+		}
+		printf(" |");
+		for (i = 0; i < bytesPerLine; i++) {
+			c = data[i];
+			if (c < 32 || c >= 127)
+				c = '.';
+			printf("%c", c);
+		}
+		printf("|\n");
+		data += bytesPerLine;
+		len -= bytesPerLine;
+		offset += bytesPerLine;
+	}
 
-        if (len <= 0)
-                return;
+	if (len <= 0)
+		return;
 
-        printf("%06x: ", offset);
-        for (i = 0; i < bytesPerLine; i++) {
-                if (i < len)
-                        printf("%02x ", data[i]);
-                else
-                        printf("   ");
-                if (i % 4 == 3)
-                        printf(" ");
-        }
-        printf(" |");
-        for (i = 0; i < len; i++) {
-                c = data[i];
-                if (c < 32 || c >= 127)
-                        c = '.';
-                printf("%c", c);
-        }
-        for (; i < bytesPerLine; i++)
-                printf(" ");
-        printf("|\n");
+	printf("%06x: ", offset);
+	for (i = 0; i < bytesPerLine; i++) {
+		if (i < len)
+			printf("%02x ", data[i]);
+		else
+			printf("   ");
+		if (i % 4 == 3)
+			printf(" ");
+	}
+	printf(" |");
+	for (i = 0; i < len; i++) {
+		c = data[i];
+		if (c < 32 || c >= 127)
+			c = '.';
+		printf("%c", c);
+	}
+	for (; i < bytesPerLine; i++)
+		printf(" ");
+	printf("|\n");
 }
 
 void warning(const char *fmt, ...) {
-  std::fprintf(stderr, "WARNING: ");
+	std::fprintf(stderr, "WARNING: ");
 
-  std::va_list va;
+	std::va_list va;
 
-  va_start(va, fmt);
-  std::vfprintf(stderr, fmt, va);
-  va_end(va);
-  std::fprintf(stderr, "\n");
+	va_start(va, fmt);
+	std::vfprintf(stderr, fmt, va);
+	va_end(va);
+	std::fprintf(stderr, "\n");
 }
 
 void error(const char *fmt, ...) {
-  std::fprintf(stderr, "ERROR: ");
+	std::fprintf(stderr, "ERROR: ");
 
-  std::va_list va;
+	std::va_list va;
 
-  va_start(va, fmt);
-  std::vfprintf(stderr, fmt, va);
-  va_end(va);
-  std::fprintf(stderr, "\n");
+	va_start(va, fmt);
+	std::vfprintf(stderr, fmt, va);
+	va_end(va);
+	std::fprintf(stderr, "\n");
 
-  SDL_Quit();
-  exit(1);
+	SDL_Quit();
+	exit(1);
 }

Index: debug.h
===================================================================
RCS file: /cvsroot/scummvm/residual/debug.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- debug.h	1 Feb 2004 12:38:33 -0000	1.3
+++ debug.h	24 Feb 2004 21:09:53 -0000	1.4
@@ -1,5 +1,5 @@
 // Residual - Virtual machine to run LucasArts' 3D adventure games
-// Copyright (C) 2003 The ScummVM-Residual Team (www.scummvm.org)
+// Copyright (C) 2003-2004 The ScummVM-Residual Team (www.scummvm.org)
 //
 //  This library is free software; you can redistribute it and/or
 //  modify it under the terms of the GNU Lesser General Public

Index: driver_gl.cpp
===================================================================
RCS file: /cvsroot/scummvm/residual/driver_gl.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- driver_gl.cpp	24 Feb 2004 07:04:50 -0000	1.4
+++ driver_gl.cpp	24 Feb 2004 21:09:53 -0000	1.5
@@ -1,3 +1,20 @@
+// Residual - Virtual machine to run LucasArts' 3D adventure games
+// Copyright (C) 2003-2004 The ScummVM-Residual Team (www.scummvm.org)
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License, or (at your option) any later version.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
+
 #include "driver_gl.h"		// Driver interface
 #include "debug.h"		// error(), warning(), etc
 
@@ -5,241 +22,241 @@
 
 // Hacky includes for temporary font rendering
 #ifndef WIN32
- #include <GL/glx.h>
- #include <X11/Xlib.h>
+	#include <GL/glx.h>
+	#include <X11/Xlib.h>
 #else
- #include <SDL_syswm.h>
- #include <windows.h>
+	#include <SDL_syswm.h>
+	#include <windows.h>
 #endif
 
 // Constructor. Should create the driver and open screens, etc.
 Driver::Driver(int screenW, int screenH, int screenBPP) {
-  char  GLDriver[1024];
+	char GLDriver[1024];
 
-  SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 5);
-  SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 5);
-  SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 5);
-  SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 16);
-  SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
+	SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 5);
+	SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 5);
+	SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 5);
+	SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 16);
+	SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
 
-  if (SDL_SetVideoMode(screenW, screenH, screenBPP, SDL_OPENGL) == 0)
-    error("Could not initialize video");
+	if (SDL_SetVideoMode(screenW, screenH, screenBPP, SDL_OPENGL) == 0)
+		error("Could not initialize video");
 
-  sprintf(GLDriver, "Residual: %s/%s", glGetString(GL_VENDOR), glGetString(GL_RENDERER));
-  SDL_WM_SetCaption(GLDriver, "Residual");
+	sprintf(GLDriver, "Residual: %s/%s", glGetString(GL_VENDOR), glGetString(GL_RENDERER));
+	SDL_WM_SetCaption(GLDriver, "Residual");
 
-  // FIXME: Hacky temporary font renderer code
-  hackFont = glGenLists(256);
-  #ifdef WIN32
-  {
-        HDC   hDC;
-        HFONT font;
-        SDL_SysWMinfo wmi;
-        SDL_VERSION(&wmi.version);
-        SDL_GetWMInfo(&wmi);
+	// FIXME: Hacky temporary font renderer code
+	hackFont = glGenLists(256);
+#ifdef WIN32
+	{
+		HDC   hDC;
+		HFONT font;
+		SDL_SysWMinfo wmi;
+		SDL_VERSION(&wmi.version);
+		SDL_GetWMInfo(&wmi);
 
-        hDC = GetDC(wmi.window);
-        font = CreateFont(0, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, ANSI_CHARSET,
-                          OUT_TT_PRECIS, CLIP_DEFAULT_PRECIS, 0 ,
-                          FF_DONTCARE|DEFAULT_PITCH, "Courier New");
-        SelectObject(hDC, font);
-        wglUseFontBitmaps(hDC, 0, 256, hackFont);
-  }
-  #else
-  {
-//        Display *dpy = XOpenDisplay(NULL);
-//        XFontStruct *XFont = XLoadQueryFont(dpy, "-misc-fixed-medium-r-*-*-20-*-*-*-*-*-*-*" );
-//        glXUseXFont(XFont->fid, 0, 256, hackFont);
-//        XFreeFont(dpy, XFont);
-//        XCloseDisplay(dpy);
-  }
-  #endif
+		hDC = GetDC(wmi.window);
+		font = CreateFont(0, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, ANSI_CHARSET,
+			OUT_TT_PRECIS, CLIP_DEFAULT_PRECIS, 0 , FF_DONTCARE|DEFAULT_PITCH, "Courier New");
+		SelectObject(hDC, font);
+		wglUseFontBitmaps(hDC, 0, 256, hackFont);
+	}
+#else
+	{
+		//Display *dpy = XOpenDisplay(NULL);
+		//XFontStruct *XFont = XLoadQueryFont(dpy, "-misc-fixed-medium-r-*-*-20-*-*-*-*-*-*-*" );
+		//glXUseXFont(XFont->fid, 0, 256, hackFont);
+		//XFreeFont(dpy, XFont);
+		//XCloseDisplay(dpy);
+	}
+#endif
 
-}
+	}
 
 void Driver::setupCamera(float fov, float nclip, float fclip, float roll) {
-  // Set perspective transformation
-  glMatrixMode(GL_PROJECTION);
-  glLoadIdentity();
-  //  gluPerspective(std::atan(std::tan(fov_ / 2 * (M_PI/180)) * 0.75) * 2 * (180/M_PI), 4.0f / 3, nclip_, fclip_);
+	// Set perspective transformation
+	glMatrixMode(GL_PROJECTION);
+	glLoadIdentity();
+	//gluPerspective(std::atan(std::tan(fov_ / 2 * (M_PI / 180)) * 0.75) * 2 * (180 / M_PI), 4.0f / 3, nclip_, fclip_);
 
-  float right = nclip * std::tan(fov / 2 * (M_PI/180));
-  glFrustum(-right, right, -right * 0.75, right * 0.75, nclip, fclip);
+	float right = nclip * std::tan(fov / 2 * (M_PI / 180));
+	glFrustum(-right, right, -right * 0.75, right * 0.75, nclip, fclip);
 
-  glMatrixMode(GL_MODELVIEW);
-  glLoadIdentity();
+	glMatrixMode(GL_MODELVIEW);
+	glLoadIdentity();
 
-  Vector3d up_vec(0, 0, 1);
-  glRotatef(roll, 0, 0, -1);
-}
+	Vector3d up_vec(0, 0, 1);
+	glRotatef(roll, 0, 0, -1);
+	}
 
 void Driver::positionCamera(Vector3d pos, Vector3d interest) {
-  Vector3d up_vec(0, 0, 1);
+	Vector3d up_vec(0, 0, 1);
 
-  if (pos.x() == interest.x() && pos.y() == interest.y())
-    up_vec = Vector3d(0, 1, 0);
+	if (pos.x() == interest.x() && pos.y() == interest.y())
+		up_vec = Vector3d(0, 1, 0);
 
-  gluLookAt(pos.x(), pos.y(), pos.z(),
-            interest.x(), interest.y(), interest.z(),
-            up_vec.x(), up_vec.y(), up_vec.z());
+	gluLookAt(pos.x(), pos.y(), pos.z(), 
+		interest.x(), interest.y(), interest.z(),
+		up_vec.x(), up_vec.y(), up_vec.z());
 
 }
 
 void Driver::clearScreen() {
-    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
+	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
 }
 
 void Driver::flipBuffer() {
-  SDL_GL_SwapBuffers();
+	SDL_GL_SwapBuffers();
 }
 
 void Driver::startActorDraw(Vector3d pos, float yaw, float pitch, float roll) {
-    glMatrixMode(GL_MODELVIEW);
-    glPushMatrix();
-    glTranslatef(pos.x(), pos.y(), pos.z());
-    glRotatef(yaw, 0, 0, 1);
-    glRotatef(pitch, 1, 0, 0);
-    glRotatef(roll, 0, 1, 0);
+	glMatrixMode(GL_MODELVIEW);
+	glPushMatrix();
+	glTranslatef(pos.x(), pos.y(), pos.z());
+	glRotatef(yaw, 0, 0, 1);
+	glRotatef(pitch, 1, 0, 0);
+	glRotatef(roll, 0, 1, 0);
 }
 
 void Driver::finishActorDraw() {
-    glPopMatrix();
+	glPopMatrix();
 }
 
 void Driver::drawDepthBitmap(int num, int x, int y, int w, int h, char **data) {
-    if (num != 0) {
-      warning("Animation not handled yet in GL texture path !\n");
-    }
+	if (num != 0) {
+		warning("Animation not handled yet in GL texture path !\n");
+	}
 
-    glRasterPos2i(x, y);
-    glEnable(GL_DEPTH_TEST);
-    glDepthFunc(GL_ALWAYS);
-    glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE);
-    glDepthMask(GL_TRUE);
+	glRasterPos2i(x, y);
+	glEnable(GL_DEPTH_TEST);
+	glDepthFunc(GL_ALWAYS);
+	glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE);
+	glDepthMask(GL_TRUE);
 
-    /* This loop here is to prevent using PixelZoom that may be unoptimized for the 1.0 / -1.0 case
-       in some drivers...
-    */
-    for (int row = 0; row < h; row++) {
-      glRasterPos2i(x, y + row + 1);
-//      glDrawPixels(w, 1, GL_DEPTH_COMPONENT, GL_UNSIGNED_SHORT, data[num] + (2 * row * w));
-    }
-    glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
-    glDepthFunc(GL_LESS);
-  }
+	// This loop here is to prevent using PixelZoom that may be unoptimized for the 1.0 / -1.0 case
+	// in some drivers...
+
+	for (int row = 0; row < h; row++) {
+		glRasterPos2i(x, y + row + 1);
+		//glDrawPixels(w, 1, GL_DEPTH_COMPONENT, GL_UNSIGNED_SHORT, data[num] + (2 * row * w));
+	}
+	glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
+	glDepthFunc(GL_LESS);
+}
 
 void Driver::drawHackFont(int x, int y, const char *text, Color &fgColor) {
-  glMatrixMode(GL_PROJECTION);
-  glPushMatrix();
-  glLoadIdentity();
-  glOrtho(0, 640, 480, 0, 0, 1);
+	glMatrixMode(GL_PROJECTION);
+	glPushMatrix();
+	glLoadIdentity();
+	glOrtho(0, 640, 480, 0, 0, 1);
 
-  glMatrixMode(GL_MODELVIEW);
-  glLoadIdentity();
+	glMatrixMode(GL_MODELVIEW);
+	glLoadIdentity();
 
-  glColor3f(fgColor.red(), fgColor.green(), fgColor.blue());
-  glRasterPos2i(x, y);
+	glColor3f(fgColor.red(), fgColor.green(), fgColor.blue());
+	glRasterPos2i(x, y);
 
-  glListBase(hackFont);
-  glCallLists(strlen(strrchr(text, '/')) - 1, GL_UNSIGNED_BYTE, strrchr(text, '/') + 1);
+	glListBase(hackFont);
+	glCallLists(strlen(strrchr(text, '/')) - 1, GL_UNSIGNED_BYTE, strrchr(text, '/') + 1);
 
-  glMatrixMode( GL_PROJECTION );
-  glPopMatrix();
+	glMatrixMode( GL_PROJECTION );
+	glPopMatrix();
 }
 
 // drawSMUSHframe, used for quickly pushing full-screen images from cutscenes
 void Driver::drawSMUSHframe(int offsetX, int offsetY, int _width, int _height, uint8 *_dst) {
-        int num_tex_;
-        GLuint *tex_ids_;
+	int num_tex_;
+	GLuint *tex_ids_;
 
-        // create texture
-        num_tex_ = ((_width + (BITMAP_TEXTURE_SIZE - 1)) / BITMAP_TEXTURE_SIZE) *
-                                ((_height + (BITMAP_TEXTURE_SIZE - 1)) / BITMAP_TEXTURE_SIZE);
-        tex_ids_ = new GLuint[num_tex_];
-        glGenTextures(num_tex_, tex_ids_);
-        for (int i = 0; i < num_tex_; i++) {
-                glBindTexture(GL_TEXTURE_2D, tex_ids_[i]);
-                glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
-                glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
-                glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
-                glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
-                glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB,
-                                   BITMAP_TEXTURE_SIZE, BITMAP_TEXTURE_SIZE, 0,
-                                   GL_RGB, GL_UNSIGNED_SHORT_5_6_5, NULL);
-    }
+	// create texture
+	num_tex_ = ((_width + (BITMAP_TEXTURE_SIZE - 1)) / BITMAP_TEXTURE_SIZE) *
+		((_height + (BITMAP_TEXTURE_SIZE - 1)) / BITMAP_TEXTURE_SIZE);
+	tex_ids_ = new GLuint[num_tex_];
+	glGenTextures(num_tex_, tex_ids_);
+	for (int i = 0; i < num_tex_; i++) {
+		glBindTexture(GL_TEXTURE_2D, tex_ids_[i]);
+		glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
+		glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
+		glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
+		glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
+		glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB,
+			BITMAP_TEXTURE_SIZE, BITMAP_TEXTURE_SIZE, 0,
+			GL_RGB, GL_UNSIGNED_SHORT_5_6_5, NULL);
+	}
 
-        glPixelStorei(GL_UNPACK_ALIGNMENT, 2);
-        glPixelStorei(GL_UNPACK_ROW_LENGTH, _width);
-        glPixelStorei(GL_UNPACK_ROW_LENGTH, _width);
+	glPixelStorei(GL_UNPACK_ALIGNMENT, 2);
+	glPixelStorei(GL_UNPACK_ROW_LENGTH, _width);
+	glPixelStorei(GL_UNPACK_ROW_LENGTH, _width);
 
-        int cur_tex_idx = 0;
-        for (int y = 0; y < _height; y += BITMAP_TEXTURE_SIZE) {
-                for (int x = 0; x < _width; x += BITMAP_TEXTURE_SIZE) {
-                        int width = (x + BITMAP_TEXTURE_SIZE >= _width) ? (_width - x) : BITMAP_TEXTURE_SIZE;
-                        int height = (y + BITMAP_TEXTURE_SIZE >= _height) ? (_height - y) : BITMAP_TEXTURE_SIZE;
-                        glBindTexture(GL_TEXTURE_2D, tex_ids_[cur_tex_idx]);
-                        glTexSubImage2D(GL_TEXTURE_2D,
-                                                        0,
-                                                        0, 0,
-                                                        width, height,
-                                                        GL_RGB,
-                                                        GL_UNSIGNED_SHORT_5_6_5,
-                                                        _dst + (y * 2 * _width) + (2 * x));
-                        cur_tex_idx++;
-              }
-        }
-        glPixelStorei(GL_UNPACK_ALIGNMENT, 4);
-        glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
+	int cur_tex_idx = 0;
+	for (int y = 0; y < _height; y += BITMAP_TEXTURE_SIZE) {
+		for (int x = 0; x < _width; x += BITMAP_TEXTURE_SIZE) {
+			int width = (x + BITMAP_TEXTURE_SIZE >= _width) ? (_width - x) : BITMAP_TEXTURE_SIZE;
+			int height = (y + BITMAP_TEXTURE_SIZE >= _height) ? (_height - y) : BITMAP_TEXTURE_SIZE;
+			glBindTexture(GL_TEXTURE_2D, tex_ids_[cur_tex_idx]);
+			glTexSubImage2D(GL_TEXTURE_2D, 
+				0,
+				0, 0,
+				width, height,
+				GL_RGB,
+				GL_UNSIGNED_SHORT_5_6_5,
+				_dst + (y * 2 * _width) + (2 * x));
+			cur_tex_idx++;
+		}
+	}
+	glPixelStorei(GL_UNPACK_ALIGNMENT, 4);
+	glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
 
-        glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
+	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
 
-        // prepare view
-        glMatrixMode(GL_PROJECTION);
-        glLoadIdentity();
-        glOrtho(0, 640, 480, 0, 0, 1);
-        glMatrixMode(GL_MODELVIEW);
-        glLoadIdentity();
-        glMatrixMode(GL_TEXTURE);
-        glLoadIdentity();
-        // A lot more may need to be put there : disabling Alpha test, blending, ...
-        // For now, just keep this here :-)
+	// prepare view
+	glMatrixMode(GL_PROJECTION);
+	glLoadIdentity();
+	glOrtho(0, 640, 480, 0, 0, 1);
+	glMatrixMode(GL_MODELVIEW);
+	glLoadIdentity();
+	glMatrixMode(GL_TEXTURE);
+	glLoadIdentity();
+	// A lot more may need to be put there : disabling Alpha test, blending, ...
+	// For now, just keep this here :-)
 
-        glDisable(GL_LIGHTING);
-        glEnable(GL_TEXTURE_2D);
+	glDisable(GL_LIGHTING);
+	glEnable(GL_TEXTURE_2D);
 
-        // draw
-        glDisable(GL_DEPTH_TEST);
-        glDepthMask(GL_FALSE);
-        glEnable(GL_SCISSOR_TEST);
+	// draw
+	glDisable(GL_DEPTH_TEST);
+	glDepthMask(GL_FALSE);
+	glEnable(GL_SCISSOR_TEST);
 
-        offsetY = 480 - offsetY - _height;
-        cur_tex_idx = 0;
-        for (int y = 0; y < _height; y += BITMAP_TEXTURE_SIZE) {
-                for (int x = 0; x < _width; x += BITMAP_TEXTURE_SIZE) {
-                        int width = (x + BITMAP_TEXTURE_SIZE >= _width) ? (_width - x) : BITMAP_TEXTURE_SIZE;
-                        int height = (y + BITMAP_TEXTURE_SIZE >= _height) ? (_height - y) : BITMAP_TEXTURE_SIZE;
-                        glBindTexture(GL_TEXTURE_2D, tex_ids_[cur_tex_idx]);
-                        glScissor(x, 480 - (y + height), x + width, 480 - y);
-                        glBegin(GL_QUADS);
-                        glTexCoord2f(0, 0);
+	offsetY = 480 - offsetY - _height;
+	cur_tex_idx = 0;
+	for (int y = 0; y < _height; y += BITMAP_TEXTURE_SIZE) {
+		for (int x = 0; x < _width; x += BITMAP_TEXTURE_SIZE) {
+			int width = (x + BITMAP_TEXTURE_SIZE >= _width) ? (_width - x) : BITMAP_TEXTURE_SIZE;
+			int height = (y + BITMAP_TEXTURE_SIZE >= _height) ? (_height - y) : BITMAP_TEXTURE_SIZE;
+			glBindTexture(GL_TEXTURE_2D, tex_ids_[cur_tex_idx]);
+			glScissor(x, 480 - (y + height), x + width, 480 - y);
+			glBegin(GL_QUADS);
+			glTexCoord2f(0, 0);
 
-                        glVertex2i(x, y);
-                        glTexCoord2f(1.0, 0.0);
-                        glVertex2i(x + BITMAP_TEXTURE_SIZE, y);
-                        glTexCoord2f(1.0, 1.0);
-                        glVertex2i(x + BITMAP_TEXTURE_SIZE, y + BITMAP_TEXTURE_SIZE);
-                        glTexCoord2f(0.0, 1.0);
-                        glVertex2i(x, y + BITMAP_TEXTURE_SIZE);
-                        glEnd();
-                        cur_tex_idx++;
-                }
-        }
-        glDisable(GL_SCISSOR_TEST);
-        glDisable(GL_TEXTURE_2D);
-        glDepthMask(GL_TRUE);
-        glEnable(GL_DEPTH_TEST);
+			glVertex2i(x, y);
+			glTexCoord2f(1.0, 0.0);
+			glVertex2i(x + BITMAP_TEXTURE_SIZE, y);
+			glTexCoord2f(1.0, 1.0);
+			glVertex2i(x + BITMAP_TEXTURE_SIZE, y + BITMAP_TEXTURE_SIZE);
+			glTexCoord2f(0.0, 1.0);
+			glVertex2i(x, y + BITMAP_TEXTURE_SIZE);
+			glEnd();
+			cur_tex_idx++;
+		}
+	}
 
-        // remove
-        glDeleteTextures(num_tex_, tex_ids_);
-        delete[] tex_ids_;
+	glDisable(GL_SCISSOR_TEST);
+	glDisable(GL_TEXTURE_2D);
+	glDepthMask(GL_TRUE);
+	glEnable(GL_DEPTH_TEST);
+
+	// remove
+	glDeleteTextures(num_tex_, tex_ids_);
+	delete[] tex_ids_;
 }

Index: driver_gl.h
===================================================================
RCS file: /cvsroot/scummvm/residual/driver_gl.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- driver_gl.h	21 Feb 2004 22:00:13 -0000	1.3
+++ driver_gl.h	24 Feb 2004 21:09:53 -0000	1.4
@@ -1,3 +1,20 @@
+// Residual - Virtual machine to run LucasArts' 3D adventure games
+// Copyright (C) 2003-2004 The ScummVM-Residual Team (www.scummvm.org)
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License, or (at your option) any later version.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
+
 // Driver:
 #include <SDL.h>
 #include <SDL_opengl.h>

Index: engine.cpp
===================================================================
RCS file: /cvsroot/scummvm/residual/engine.cpp,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- engine.cpp	24 Feb 2004 07:04:50 -0000	1.15
+++ engine.cpp	24 Feb 2004 21:09:53 -0000	1.16
@@ -1,5 +1,5 @@
 // Residual - Virtual machine to run LucasArts' 3D adventure games
-// Copyright (C) 2003 The ScummVM-Residual Team (www.scummvm.org)
+// Copyright (C) 2003-2004 The ScummVM-Residual Team (www.scummvm.org)
 //
 //  This library is free software; you can redistribute it and/or
 //  modify it under the terms of the GNU Lesser General Public
@@ -32,149 +32,142 @@
 Engine *Engine::instance_ = NULL;
 
 Engine::Engine() :
-  currScene_(NULL), selectedActor_(NULL)
-{
-  for (int i = 0; i < SDLK_EXTRA_LAST; i++)
-    controlsEnabled_[i] = false;
+		currScene_(NULL), selectedActor_(NULL) {
+	for (int i = 0; i < SDLK_EXTRA_LAST; i++)
+		controlsEnabled_[i] = false;
 }
 
 void Engine::mainLoop() {
-  frameTime_ = 0;
-  frameStart_ = SDL_GetTicks();
+	frameTime_ = 0;
+	frameStart_ = SDL_GetTicks();
 
-  for (;;) {
-    // Process events
-    SDL_Event event;
-    while (SDL_PollEvent(&event)) {
-      if (event.type == SDL_KEYDOWN &&
-	  controlsEnabled_[event.key.keysym.sym]) {
-	lua_beginblock();
-	lua_Object handler = getEventHandler("buttonHandler");
-	if (handler != LUA_NOOBJECT) {
-	  lua_pushnumber(event.key.keysym.sym);
-	  lua_pushnumber(1);
-	  lua_pushnil();
-	  lua_callfunction(handler);
-	}
-	lua_endblock();
-      }
-      if (event.type == SDL_KEYUP &&
-	  controlsEnabled_[event.key.keysym.sym]) {
-	lua_beginblock();
-	lua_Object handler = getEventHandler("buttonHandler");
-	if (handler != LUA_NOOBJECT) {
-	  lua_pushnumber(event.key.keysym.sym);
-	  lua_pushnil();
-	  lua_pushnil();
-	  lua_callfunction(handler);
+	for (;;) {
+		// Process events
+		SDL_Event event;
+		while (SDL_PollEvent(&event)) {
+			if (event.type == SDL_KEYDOWN && controlsEnabled_[event.key.keysym.sym]) {
+				lua_beginblock();
+				lua_Object handler = getEventHandler("buttonHandler");
+				if (handler != LUA_NOOBJECT) {
+					lua_pushnumber(event.key.keysym.sym);
+					lua_pushnumber(1);
+					lua_pushnil();
+					lua_callfunction(handler);
+				}
+				lua_endblock();
+			}
+			if (event.type == SDL_KEYUP && controlsEnabled_[event.key.keysym.sym]) {
+				lua_beginblock();
+				lua_Object handler = getEventHandler("buttonHandler");
+				if (handler != LUA_NOOBJECT) {
+					lua_pushnumber(event.key.keysym.sym);
+					lua_pushnil();
+					lua_pushnil();
+					lua_callfunction(handler);
+				}
+				lua_endblock();
+			}
+			if (event.type == SDL_QUIT) {
+				lua_beginblock();
+				lua_Object handler = getEventHandler("exitHandler");
+				if (handler != LUA_NOOBJECT)
+					lua_callfunction(handler);
+				lua_endblock();
+			}
+			if (event.type == SDL_KEYDOWN) {
+				if (event.key.keysym.sym == SDLK_q)
+					return;
+		}
 	}
-	lua_endblock();
-      }
-      if (event.type == SDL_QUIT) {
-	lua_beginblock();
-	lua_Object handler = getEventHandler("exitHandler");
-	if (handler != LUA_NOOBJECT)
-	  lua_callfunction(handler);
-	lua_endblock();
-      }
-      if (event.type == SDL_KEYDOWN) {
-	if (event.key.keysym.sym == SDLK_q)
-	  return;
-      }
-    }
-
-    // Run asynchronous tasks
-    lua_runtasks();
-    if (SCREENBLOCKS_GLOBAL == 1)
-	screenBlocksReset();
 
-    // Draw the screen
-    g_driver->clearScreen();
+	// Run asynchronous tasks
+	lua_runtasks();
+	if (SCREENBLOCKS_GLOBAL == 1)
+		screenBlocksReset();
 
-    Bitmap::prepareDraw();
-    if (currScene_ != NULL)
-      currScene_->drawBackground();
+	// Draw the screen
+	g_driver->clearScreen();
 
-    glEnable(GL_DEPTH_TEST);
-    if (currScene_ != NULL)
-    currScene_->setupCamera();
+	Bitmap::prepareDraw();
+	if (currScene_ != NULL)
+		currScene_->drawBackground();
 
-    glMatrixMode(GL_MODELVIEW);
-    // Update actor costumes
-    for (actor_list_type::iterator i = actors_.begin();
-	 i != actors_.end(); i++) {
-      Actor *a = *i;
-      assert(currScene_);
-      if (a->inSet(currScene_->name()) && a->visible())
-		a->update();
-    }
+	glEnable(GL_DEPTH_TEST);
+	if (currScene_ != NULL)
+		currScene_->setupCamera();
 
-    // Draw actors
-    glEnable(GL_TEXTURE_2D);
-    for (actor_list_type::iterator i = actors_.begin();
-	 i != actors_.end(); i++) {
-      Actor *a = *i;
-      if (a->inSet(currScene_->name()) && a->visible())
-		a->draw();
-    }
-    glDisable(GL_TEXTURE_2D);
+	glMatrixMode(GL_MODELVIEW);
+	// Update actor costumes
+	for (actor_list_type::iterator i = actors_.begin(); i != actors_.end(); i++) {
+		Actor *a = *i;
+		assert(currScene_);
+		if (a->inSet(currScene_->name()) && a->visible())
+			a->update();
+	}
 
-    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
-    if (SCREENBLOCKS_GLOBAL == 1)
-	screenBlocksBlitDirtyBlocks();
+	// Draw actors
+	glEnable(GL_TEXTURE_2D);
+	for (actor_list_type::iterator i = actors_.begin(); i != actors_.end(); i++) {
+		Actor *a = *i;
+		if (a->inSet(currScene_->name()) && a->visible())
+			a->draw();
+	}
+	glDisable(GL_TEXTURE_2D);
 
-    Bitmap::prepareDraw();
-    if (currScene_ != NULL)
-      currScene_->drawBackground();
+	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
+	if (SCREENBLOCKS_GLOBAL == 1)
+		screenBlocksBlitDirtyBlocks();
 
 	if (g_smush->isPlaying()) {
 		if (g_smush->isUpdateNeeded()) {
 			g_driver->drawSMUSHframe(g_smush->getX(), g_smush->getY(), g_smush->getWidth(), g_smush->getHeight(), g_smush->getDstPtr());
-			g_smush->setUpdateNeeded();
+			g_smush->clearUpdateNeeded();
 		}
+	} else {
+		Bitmap::prepareDraw();
+		if (currScene_ != NULL)
+			currScene_->drawBackground();
 	}
 
-    glEnable(GL_DEPTH_TEST);
-    if (currScene_ != NULL)
-    currScene_->setupCamera();
-
-    // Draw actors
-    glEnable(GL_TEXTURE_2D);
-    for (actor_list_type::iterator i = actors_.begin();
-	 i != actors_.end(); i++) {
-      Actor *a = *i;
-      if (a->inSet(currScene_->name()) && a->visible())
-		a->draw();
-    }
-    glDisable(GL_TEXTURE_2D);
+	glEnable(GL_DEPTH_TEST);
+	if (currScene_ != NULL)
+		currScene_->setupCamera();
 
-//	screenBlocksDrawDebug();
+	// Draw actors
+	glEnable(GL_TEXTURE_2D);
+	for (actor_list_type::iterator i = actors_.begin(); i != actors_.end(); i++) {
+		Actor *a = *i;
+		if (a->inSet(currScene_->name()) && a->visible())
+			a->draw();
+	}
+	glDisable(GL_TEXTURE_2D);
 
+	//screenBlocksDrawDebug();
 
 	// Draw text
-    for (text_list_type::iterator i = textObjects_.begin();
-	 i != textObjects_.end(); i++) {
-      (*i)->draw();
-    }
+	for (text_list_type::iterator i = textObjects_.begin();
+		i != textObjects_.end(); i++) {
+			(*i)->draw();
+		}
 
-    g_driver->flipBuffer();
+		g_driver->flipBuffer();
 
-    // Update timing information
-    unsigned newStart = SDL_GetTicks();
-    frameTime_ = newStart - frameStart_;
-    frameStart_ = newStart;
+		// Update timing information
+		unsigned newStart = SDL_GetTicks();
+		frameTime_ = newStart - frameStart_;
+		frameStart_ = newStart;
 
-    lua_beginblock();
-    set_frameTime(frameTime_);
-    lua_endblock();
-  }
+		lua_beginblock();
+		set_frameTime(frameTime_);
+		lua_endblock();
+	}
 }
 
 void Engine::setScene(const char *name) {
-  Block *b = ResourceLoader::instance()->getFileBlock(name);
-  if (b == NULL)
-    warning("Could not find scene file %s\n", name);
-  delete currScene_;
-  currScene_ = new Scene(name, b->data(), b->len());
-  delete b;
+	Block *b = ResourceLoader::instance()->getFileBlock(name);
+	if (b == NULL)
+		warning("Could not find scene file %s\n", name);
+	delete currScene_;
+	currScene_ = new Scene(name, b->data(), b->len());
+	delete b;
 }

Index: engine.h
===================================================================
RCS file: /cvsroot/scummvm/residual/engine.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- engine.h	23 Jan 2004 11:10:46 -0000	1.5
+++ engine.h	24 Feb 2004 21:09:53 -0000	1.6
@@ -1,5 +1,5 @@
 // Residual - Virtual machine to run LucasArts' 3D adventure games
-// Copyright (C) 2003 The ScummVM-Residual Team (www.scummvm.org)
+// Copyright (C) 2003-2004 The ScummVM-Residual Team (www.scummvm.org)
 //
 //  This library is free software; you can redistribute it and/or
 //  modify it under the terms of the GNU Lesser General Public
@@ -28,124 +28,123 @@
 
 // Fake SDLK_* values for joystick and mouse events
 enum {
-  SDLK_JOY1_B1 = SDLK_LAST,
-  SDLK_JOY1_B2,
-  SDLK_JOY1_B3,
-  SDLK_JOY1_B4,
-  SDLK_JOY1_B5,
-  SDLK_JOY1_B6,
-  SDLK_JOY1_B7,
-  SDLK_JOY1_B8,
-  SDLK_JOY1_B9,
-  SDLK_JOY1_B10,
-  SDLK_JOY1_HLEFT,
-  SDLK_JOY1_HUP,
-  SDLK_JOY1_HRIGHT,
-  SDLK_JOY1_HDOWN,
-  SDLK_JOY2_B1,
-  SDLK_JOY2_B2,
-  SDLK_JOY2_B3,
-  SDLK_JOY2_B4,
-  SDLK_JOY2_B5,
-  SDLK_JOY2_B6,
-  SDLK_JOY2_B7,
-  SDLK_JOY2_B8,
-  SDLK_JOY2_B9,
-  SDLK_JOY2_B10,
-  SDLK_JOY2_HLEFT,
-  SDLK_JOY2_HUP,
-  SDLK_JOY2_HRIGHT,
-  SDLK_JOY2_HDOWN,
-  SDLK_MOUSE_B1,
-  SDLK_MOUSE_B2,
-  SDLK_MOUSE_B3,
-  SDLK_MOUSE_B4,
-  SDLK_AXIS_JOY1_X,
-  SDLK_AXIS_JOY1_Y,
-  SDLK_AXIS_JOY1_Z,
-  SDLK_AXIS_JOY1_R,
-  SDLK_AXIS_JOY1_U,
-  SDLK_AXIS_JOY1_V,
-  SDLK_AXIS_JOY2_X,
-  SDLK_AXIS_JOY2_Y,
-  SDLK_AXIS_JOY2_Z,
-  SDLK_AXIS_JOY2_R,
-  SDLK_AXIS_JOY2_U,
-  SDLK_AXIS_JOY2_V,
-  SDLK_AXIS_MOUSE_X,
-  SDLK_AXIS_MOUSE_Y,
-  SDLK_AXIS_MOUSE_Z,
-  SDLK_EXTRA_LAST
-};
+	SDLK_JOY1_B1 = SDLK_LAST,
+	SDLK_JOY1_B2,
+	SDLK_JOY1_B3,
+	SDLK_JOY1_B4,
+	SDLK_JOY1_B5,
+	SDLK_JOY1_B6,
+	SDLK_JOY1_B7,
+	SDLK_JOY1_B8,
+	SDLK_JOY1_B9,
+	SDLK_JOY1_B10,
+	SDLK_JOY1_HLEFT,
+	SDLK_JOY1_HUP,
+	SDLK_JOY1_HRIGHT,
+	SDLK_JOY1_HDOWN,
+	SDLK_JOY2_B1,
+	SDLK_JOY2_B2,
+	SDLK_JOY2_B3,
+	SDLK_JOY2_B4,
+	SDLK_JOY2_B5,
+	SDLK_JOY2_B6,
+	SDLK_JOY2_B7,
+	SDLK_JOY2_B8,
+	SDLK_JOY2_B9,
+	SDLK_JOY2_B10,
+	SDLK_JOY2_HLEFT,
+	SDLK_JOY2_HUP,
+	SDLK_JOY2_HRIGHT,
+	SDLK_JOY2_HDOWN,
+	SDLK_MOUSE_B1,
+	SDLK_MOUSE_B2,
+	SDLK_MOUSE_B3,
+	SDLK_MOUSE_B4,
+	SDLK_AXIS_JOY1_X,
+	SDLK_AXIS_JOY1_Y,
+	SDLK_AXIS_JOY1_Z,
+	SDLK_AXIS_JOY1_R,
+	SDLK_AXIS_JOY1_U,
+	SDLK_AXIS_JOY1_V,
+	SDLK_AXIS_JOY2_X,
+	SDLK_AXIS_JOY2_Y,
+	SDLK_AXIS_JOY2_Z,
+	SDLK_AXIS_JOY2_R,
+	SDLK_AXIS_JOY2_U,
+	SDLK_AXIS_JOY2_V,
+	SDLK_AXIS_MOUSE_X,
+	SDLK_AXIS_MOUSE_Y,
+	SDLK_AXIS_MOUSE_Z,
+	SDLK_EXTRA_LAST
+	};
 
 class Engine {
 public:
-  static Engine *instance() {
-    if (instance_ == NULL)
-      instance_ = new Engine;
-    return instance_;
-  }
-
-  void mainLoop();
-  unsigned frameStart() const { return frameStart_; }
-  unsigned frameTime() const { return frameTime_; }
+	static Engine *instance() {
+		if (instance_ == NULL)
+			instance_ = new Engine;
+		return instance_;
+	}
 
-  float perSecond(float rate) const { return rate * frameTime_ / 1000; }
+	void mainLoop();
+	unsigned frameStart() const { return frameStart_; }
+	unsigned frameTime() const { return frameTime_; }
 
-  void enableControl(int num) { controlsEnabled_[num] = true; }
-  void disableControl(int num) { controlsEnabled_[num] = false; }
+	float perSecond(float rate) const { return rate * frameTime_ / 1000; }
 
-  void registerActor(Actor *a) { actors_.push_back(a); }
+	void enableControl(int num) { controlsEnabled_[num] = true; }
+	void disableControl(int num) { controlsEnabled_[num] = false; }
 
-  void setScene(const char *name);
-  Scene *currScene() { return currScene_; }
-  const char *sceneName() const { return currScene_->name(); }
+	void registerActor(Actor *a) { actors_.push_back(a); }
 
-  typedef std::list<Actor *> actor_list_type;
-  actor_list_type::const_iterator actorsBegin() const {
-    return actors_.begin();
-  }
-  actor_list_type::const_iterator actorsEnd() const {
-    return actors_.end();
-  }
+	void setScene(const char *name);
+	Scene *currScene() { return currScene_; }
+	const char *sceneName() const { return currScene_->name(); }
 
-  void setSelectedActor(Actor *a) { selectedActor_ = a; }
-  Actor *selectedActor() { return selectedActor_; }
+	typedef std::list<Actor *> actor_list_type;
+	actor_list_type::const_iterator actorsBegin() const {
+		return actors_.begin();
+	}
+	actor_list_type::const_iterator actorsEnd() const {
+		return actors_.end();
+	}
 
-  typedef std::list<TextObject *> text_list_type;
-  text_list_type::const_iterator textsBegin() const {
-    return textObjects_.begin();
-  }
-  text_list_type::const_iterator textsEnd() const {
-    return textObjects_.end();
-  }
-  void registerTextObject(TextObject *a) { textObjects_.push_back(a); }
-  void killTextObject(TextObject *a) {
-	textObjects_.remove(a);
-  }
-  void killTextObjects() {
-   while (!textObjects_.empty()) {
-    delete textObjects_.back();
-    textObjects_.pop_back();
-   }
-  }
+	void setSelectedActor(Actor *a) { selectedActor_ = a; }
+	Actor *selectedActor() { return selectedActor_; }
 
+	typedef std::list<TextObject *> text_list_type;
+	text_list_type::const_iterator textsBegin() const {
+		return textObjects_.begin();
+	}
+	text_list_type::const_iterator textsEnd() const {
+		return textObjects_.end();
+	}
+	void registerTextObject(TextObject *a) { textObjects_.push_back(a); }
+	void killTextObject(TextObject *a) {
+		textObjects_.remove(a);
+	}
+	void killTextObjects() {
+		while (!textObjects_.empty()) {
+			delete textObjects_.back();
+			textObjects_.pop_back();
+		}
+	}
 
 private:
-  static Engine *instance_;
+	static Engine *instance_;
 
-  Engine();
-  ~Engine() { }
+	Engine();
+	~Engine() { }
 
-  Scene *currScene_;
+	Scene *currScene_;
 
-  unsigned frameStart_, frameTime_;
+	unsigned frameStart_, frameTime_;
 
-  bool controlsEnabled_[SDLK_EXTRA_LAST];
+	bool controlsEnabled_[SDLK_EXTRA_LAST];
 
-  actor_list_type actors_;
-  Actor *selectedActor_;
-  text_list_type textObjects_;
+	actor_list_type actors_;
+	Actor *selectedActor_;
+	text_list_type textObjects_;
 };
 
 #endif

Index: keyframe.cpp
===================================================================
RCS file: /cvsroot/scummvm/residual/keyframe.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- keyframe.cpp	12 Dec 2003 08:39:07 -0000	1.4
+++ keyframe.cpp	24 Feb 2004 21:09:53 -0000	1.5
@@ -1,5 +1,5 @@
 // Residual - Virtual machine to run LucasArts' 3D adventure games
-// Copyright (C) 2003 The ScummVM-Residual Team (www.scummvm.org)
+// Copyright (C) 2003-2004 The ScummVM-Residual Team (www.scummvm.org)
 //
 //  This library is free software; you can redistribute it and/or
 //  modify it under the terms of the GNU Lesser General Public
@@ -23,187 +23,182 @@
 #include <cstring>
 
 KeyframeAnim::KeyframeAnim(const char *filename, const char *data, int len) :
-  Resource(filename) {
-  if (len >= 4 && std::memcmp(data, "FYEK", 4) == 0)
-    loadBinary(data, len);
-  else {
-    TextSplitter ts(data, len);
-    loadText(ts);
-  }
+		Resource(filename) {
+	if (len >= 4 && std::memcmp(data, "FYEK", 4) == 0)
+		loadBinary(data, len);
+	else {
+		TextSplitter ts(data, len);
+		loadText(ts);
+	}
 }
 
 void KeyframeAnim::loadBinary(const char *data, int len) {
-  flags_ = READ_LE_UINT32(data + 40);
-  type_ = READ_LE_UINT32(data + 48);
-  fps_ = get_float(data + 52);
-  numFrames_ = READ_LE_UINT32(data + 56);
-  numJoints_ = READ_LE_UINT32(data + 60);
-  numMarkers_ = READ_LE_UINT32(data + 68);
-  markers_ = new Marker[numMarkers_];
-  for (int i = 0; i < numMarkers_; i++) {
-    markers_[i].frame_ = get_float(data + 72 + 4 * i);
-    markers_[i].val_ = READ_LE_UINT32(data + 104 + 4 * i);
-  }
+	flags_ = READ_LE_UINT32(data + 40);
+	type_ = READ_LE_UINT32(data + 48);
+	fps_ = get_float(data + 52);
+	numFrames_ = READ_LE_UINT32(data + 56);
+	numJoints_ = READ_LE_UINT32(data + 60);
+	numMarkers_ = READ_LE_UINT32(data + 68);
+	markers_ = new Marker[numMarkers_];
+	for (int i = 0; i < numMarkers_; i++) {
+		markers_[i].frame_ = get_float(data + 72 + 4 * i);
+		markers_[i].val_ = READ_LE_UINT32(data + 104 + 4 * i);
+	}
 
-  nodes_ = new KeyframeNode*[numJoints_];
-  for (int i = 0; i < numJoints_; i++)
-    nodes_[i] = NULL;
-  const char *dataEnd = data + len;
-  data += 180;
-  while (data < dataEnd) {
-    int nodeNum = READ_LE_UINT32(data + 32);
-    nodes_[nodeNum] = new KeyframeNode;
-    nodes_[nodeNum]->loadBinary(data);
-  }
+	nodes_ = new KeyframeNode*[numJoints_];
+	for (int i = 0; i < numJoints_; i++)
+		nodes_[i] = NULL;
+	const char *dataEnd = data + len;
+	data += 180;
+	while (data < dataEnd) {
+		int nodeNum = READ_LE_UINT32(data + 32);
+		nodes_[nodeNum] = new KeyframeNode;
+		nodes_[nodeNum]->loadBinary(data);
+	}
 }
 
 void KeyframeAnim::loadText(TextSplitter &ts) {
-  ts.expectString("section: header");
-  ts.scanString("flags %i", 1, &flags_);
-  ts.scanString("type %i", 1, &type_);
-  ts.scanString("frames %d", 1, &numFrames_);
-  ts.scanString("fps %f", 1, &fps_);
-  ts.scanString("joints %d", 1, &numJoints_);
+	ts.expectString("section: header");
+	ts.scanString("flags %i", 1, &flags_);
+	ts.scanString("type %i", 1, &type_);
+	ts.scanString("frames %d", 1, &numFrames_);
+	ts.scanString("fps %f", 1, &fps_);
+	ts.scanString("joints %d", 1, &numJoints_);
 
-  if (std::strcmp(ts.currentLine(), "section: markers") == 0) {
-    ts.nextLine();
-    ts.scanString("markers %d", 1, &numMarkers_);
-    markers_ = new Marker[numMarkers_];
-    for (int i = 0; i < numMarkers_; i++)
-      ts.scanString("%f %d", 2, &markers_[i].frame_, &markers_[i].val_);
-  }
-  else {
-    numMarkers_ = 0;
-    markers_ = NULL;
-  }
+	if (std::strcmp(ts.currentLine(), "section: markers") == 0) {
+		ts.nextLine();
+		ts.scanString("markers %d", 1, &numMarkers_);
+		markers_ = new Marker[numMarkers_];
+		for (int i = 0; i < numMarkers_; i++)
+			ts.scanString("%f %d", 2, &markers_[i].frame_, &markers_[i].val_);
+	} else {
+		numMarkers_ = 0;
+		markers_ = NULL;
+	}
 
-  ts.expectString("section: keyframe nodes");
-  int numNodes;
-  ts.scanString("nodes %d", 1, &numNodes);
-  nodes_ = new KeyframeNode*[numJoints_];
-  for (int i = 0; i < numJoints_; i++)
-    nodes_[i] = NULL;
-  for (int i = 0; i < numNodes; i++) {
-    int which;
-    ts.scanString("node %d", 1, &which);
-    nodes_[which] = new KeyframeNode;
-    nodes_[which]->loadText(ts);
-  }
+	ts.expectString("section: keyframe nodes");
+	int numNodes;
+	ts.scanString("nodes %d", 1, &numNodes);
+	nodes_ = new KeyframeNode*[numJoints_];
+	for (int i = 0; i < numJoints_; i++)
+		nodes_[i] = NULL;
+	for (int i = 0; i < numNodes; i++) {
+		int which;
+		ts.scanString("node %d", 1, &which);
+		nodes_[which] = new KeyframeNode;
+		nodes_[which]->loadText(ts);
+	}
 }
 
 KeyframeAnim::~KeyframeAnim() {
-  for (int i = 0; i < numJoints_; i++)
-    delete nodes_[i];
-  delete[] markers_;
+	for (int i = 0; i < numJoints_; i++)
+		delete nodes_[i];
+	delete[] markers_;
 }
 
-void KeyframeAnim::animate(Model::HierNode *nodes, float time,
-			   int priority1, int priority2) const {
-  float frame = time * fps_;
-  if (frame > numFrames_)
-    frame = numFrames_;
-  for (int i = 0; i < numJoints_; i++)
-    if (nodes_[i] != NULL)
-      nodes_[i]->animate(nodes[i], frame,
-			 ((type_ & nodes[i].type_) != 0 ?
-			  priority2 : priority1));
+void KeyframeAnim::animate(Model::HierNode *nodes, float time, int priority1, int priority2) const {
+	float frame = time * fps_;
+	if (frame > numFrames_)
+		frame = numFrames_;
+	for (int i = 0; i < numJoints_; i++)
+		if (nodes_[i] != NULL)
+	nodes_[i]->animate(nodes[i], frame, ((type_ & nodes[i].type_) != 0 ? priority2 : priority1));
 }
 
 void KeyframeAnim::KeyframeEntry::loadBinary(const char *&data) {
-  frame_ = get_float(data);
-  flags_ = READ_LE_UINT32(data + 4);
-  pos_ = get_vector3d(data + 8);
-  pitch_ = get_float(data + 20);
-  yaw_ = get_float(data + 24);
-  roll_ = get_float(data + 28);
-  dpos_ = get_vector3d(data + 32);
-  dpitch_ = get_float(data + 44);
-  dyaw_ = get_float(data + 48);
-  droll_ = get_float(data + 52);
-  data += 56;
+	frame_ = get_float(data);
+	flags_ = READ_LE_UINT32(data + 4);
+	pos_ = get_vector3d(data + 8);
+	pitch_ = get_float(data + 20);
+	yaw_ = get_float(data + 24);
+	roll_ = get_float(data + 28);
+	dpos_ = get_vector3d(data + 32);
+	dpitch_ = get_float(data + 44);
+	dyaw_ = get_float(data + 48);
+	droll_ = get_float(data + 52);
+	data += 56;
 }
 
 void KeyframeAnim::KeyframeNode::loadBinary(const char *&data) {
-  std::memcpy(meshName_, data, 32);
-  numEntries_ = READ_LE_UINT32(data + 36);
-  data += 44;
-  entries_ = new KeyframeEntry[numEntries_];
-  for (int i = 0; i < numEntries_; i++)
-    entries_[i].loadBinary(data);
-}
+	std::memcpy(meshName_, data, 32);
+	numEntries_ = READ_LE_UINT32(data + 36);
+	data += 44;
+	entries_ = new KeyframeEntry[numEntries_];
+	for (int i = 0; i < numEntries_; i++)
+		entries_[i].loadBinary(data);
+	}
 
 void KeyframeAnim::KeyframeNode::loadText(TextSplitter &ts) {
-  ts.scanString("mesh name %s", 1, meshName_);
-  ts.scanString("entries %d", 1, &numEntries_);
-  entries_ = new KeyframeEntry[numEntries_];
-  for (int i = 0; i < numEntries_; i++) {
-    int which, flags;
-    float frame, x, y, z, p, yaw, r, dx, dy, dz, dp, dyaw, dr;
-    ts.scanString(" %d: %f %i %f %f %f %f %f %f", 9, &which, &frame, &flags,
-		  &x, &y, &z, &p, &yaw, &r);
-    ts.scanString(" %f %f %f %f %f %f", 6, &dx, &dy, &dz, &dp, &dyaw, &dr);
-    entries_[which].frame_ = frame;
-    entries_[which].flags_ = flags;
-    entries_[which].pos_ = Vector3d(x, y, z);
-    entries_[which].dpos_ = Vector3d(dx, dy, dz);
-    entries_[which].pitch_ = p;
-    entries_[which].yaw_ = yaw;
-    entries_[which].roll_ = r;
-    entries_[which].dpitch_ = dp;
-    entries_[which].dyaw_ = dyaw;
-    entries_[which].droll_ = dr;
-  }
+	ts.scanString("mesh name %s", 1, meshName_);
+	ts.scanString("entries %d", 1, &numEntries_);
+	entries_ = new KeyframeEntry[numEntries_];
+	for (int i = 0; i < numEntries_; i++) {
+		int which, flags;
+		float frame, x, y, z, p, yaw, r, dx, dy, dz, dp, dyaw, dr;
+		ts.scanString(" %d: %f %i %f %f %f %f %f %f", 9, &which, &frame, &flags,
+			&x, &y, &z, &p, &yaw, &r);
+		ts.scanString(" %f %f %f %f %f %f", 6, &dx, &dy, &dz, &dp, &dyaw, &dr);
+		entries_[which].frame_ = frame;
+		entries_[which].flags_ = flags;
+		entries_[which].pos_ = Vector3d(x, y, z);
+		entries_[which].dpos_ = Vector3d(dx, dy, dz);
+		entries_[which].pitch_ = p;
+		entries_[which].yaw_ = yaw;
+		entries_[which].roll_ = r;
+		entries_[which].dpitch_ = dp;
+		entries_[which].dyaw_ = dyaw;
+		entries_[which].droll_ = dr;
+	}
 }
 
 KeyframeAnim::KeyframeNode::~KeyframeNode() {
-  delete[] entries_;
+	delete[] entries_;
 }
 
 void KeyframeAnim::KeyframeNode::animate(Model::HierNode &node,
-					 float frame, int priority) const {
-  if (numEntries_ == 0)
-    return;
-  if (priority < node.priority_)
-    return;
+	float frame, int priority) const {
+	if (numEntries_ == 0)
+		return;
+	if (priority < node.priority_)
+		return;
 
-  // Do a binary search for the nearest previous frame
-  // Loop invariant: entries_[low].frame_ <= frame < entries_[high].frame_
-  int low = 0, high = numEntries_;
-  while (high > low + 1) {
-    int mid = (low + high) / 2;
-    if (entries_[mid].frame_ <= frame)
-      low = mid;
-    else
-      high = mid;
-  }
+	// Do a binary search for the nearest previous frame
+	// Loop invariant: entries_[low].frame_ <= frame < entries_[high].frame_
+	int low = 0, high = numEntries_;
+	while (high > low + 1) {
+		int mid = (low + high) / 2;
+		if (entries_[mid].frame_ <= frame)
+			low = mid;
+		else
+			high = mid;
+	}
 
-  float dt = frame - entries_[low].frame_;
-  Vector3d pos = entries_[low].pos_ + dt * entries_[low].dpos_;
-  float pitch = entries_[low].pitch_ + dt * entries_[low].dpitch_;
-  float yaw = entries_[low].yaw_ + dt * entries_[low].dyaw_;
-  float roll = entries_[low].roll_ + dt * entries_[low].droll_;
-  if (pitch > 180)
-    pitch -= 360;
-  if (yaw > 180)
-    yaw -= 360;
-  if (roll > 180)
-    roll -= 360;
+	float dt = frame - entries_[low].frame_;
+	Vector3d pos = entries_[low].pos_ + dt * entries_[low].dpos_;
+	float pitch = entries_[low].pitch_ + dt * entries_[low].dpitch_;
+	float yaw = entries_[low].yaw_ + dt * entries_[low].dyaw_;
+	float roll = entries_[low].roll_ + dt * entries_[low].droll_;
+	if (pitch > 180)
+		pitch -= 360;
+	if (yaw > 180)
+		yaw -= 360;
+	if (roll > 180)
+		roll -= 360;
 
-  if (priority > node.priority_) {
-    node.priority_ = priority;
-    node.totalWeight_ = 1;
-    node.animPos_ = pos;
-    node.animPitch_ = pitch;
-    node.animYaw_ = yaw;
-    node.animRoll_ = roll;
-  }
-  else {			// priority == node.priority_
-    node.totalWeight_++;
-    node.animPos_ += pos;
-    node.animPitch_ += pitch;
-    node.animYaw_ += yaw;
-    node.animRoll_ += roll;
-  }
+	if (priority > node.priority_) {
+		node.priority_ = priority;
+		node.totalWeight_ = 1;
+		node.animPos_ = pos;
+		node.animPitch_ = pitch;
+		node.animYaw_ = yaw;
+		node.animRoll_ = roll;
+	} else { // priority == node.priority_
+		node.totalWeight_++;
+		node.animPos_ += pos;
+		node.animPitch_ += pitch;
+		node.animYaw_ += yaw;
+		node.animRoll_ += roll;
+	}
 
-//  node
+	//  node
 }

Index: keyframe.h
===================================================================
RCS file: /cvsroot/scummvm/residual/keyframe.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- keyframe.h	15 Aug 2003 19:41:26 -0000	1.1
+++ keyframe.h	24 Feb 2004 21:09:53 -0000	1.2
@@ -1,5 +1,5 @@
 // Residual - Virtual machine to run LucasArts' 3D adventure games
-// Copyright (C) 2003 The ScummVM-Residual Team (www.scummvm.org)
+// Copyright (C) 2003-2004 The ScummVM-Residual Team (www.scummvm.org)
 //
 //  This library is free software; you can redistribute it and/or
 //  modify it under the terms of the GNU Lesser General Public
@@ -26,48 +26,48 @@
 
 class KeyframeAnim : public Resource {
 public:
-  KeyframeAnim(const char *filename, const char *data, int len);
-  ~KeyframeAnim();
+	KeyframeAnim(const char *filename, const char *data, int len);
+	~KeyframeAnim();
 
-  void loadBinary(const char *data, int len);
-  void loadText(TextSplitter &ts);
-  void animate(Model::HierNode *nodes, float time,
-	       int priority1 = 1, int priority2 = 5) const;
+	void loadBinary(const char *data, int len);
+	void loadText(TextSplitter &ts);
+	void animate(Model::HierNode *nodes, float time,
+		int priority1 = 1, int priority2 = 5) const;
 
-  float length() const { return numFrames_ / fps_; }
+	float length() const { return numFrames_ / fps_; }
 
 private:
-  int flags_, type_, numFrames_, numJoints_;
-  float fps_;
-  int numMarkers_;
+	int flags_, type_, numFrames_, numJoints_;
+	float fps_;
+	int numMarkers_;
 
-  struct Marker {
-    float frame_;
-    int val_;
-  };
-  Marker *markers_;
+	struct Marker {
+		float frame_;
+		int val_;
+	};
+	Marker *markers_;
 
-  struct KeyframeEntry {
-    void loadBinary(const char *&data);
+	struct KeyframeEntry {
+		void loadBinary(const char *&data);
 
-    float frame_;
-    int flags_;
-    Vector3d pos_, dpos_;
-    float pitch_, yaw_, roll_, dpitch_, dyaw_, droll_;
-  };
+		float frame_;
+		int flags_;
+		Vector3d pos_, dpos_;
+		float pitch_, yaw_, roll_, dpitch_, dyaw_, droll_;
+	};
 
-  struct KeyframeNode {
-    void loadBinary(const char *&data);
-    void loadText(TextSplitter &ts);
-    ~KeyframeNode();
+	struct KeyframeNode {
+		void loadBinary(const char *&data);
+		void loadText(TextSplitter &ts);
+		~KeyframeNode();
 
-    void animate(Model::HierNode &node, float frame, int priority) const;
-    char meshName_[32];
-    int numEntries_;
-    KeyframeEntry *entries_;
-  };
+		void animate(Model::HierNode &node, float frame, int priority) const;
+		char meshName_[32];
+		int numEntries_;
+		KeyframeEntry *entries_;
+	};
 
-  KeyframeNode **nodes_;
+	KeyframeNode **nodes_;
 };
 
 #endif

Index: lab.cpp
===================================================================
RCS file: /cvsroot/scummvm/residual/lab.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- lab.cpp	21 Feb 2004 15:50:49 -0000	1.6
+++ lab.cpp	24 Feb 2004 21:09:53 -0000	1.7
@@ -1,5 +1,5 @@
 // Residual - Virtual machine to run LucasArts' 3D adventure games
-// Copyright (C) 2003 The ScummVM-Residual Team (www.scummvm.org)
+// Copyright (C) 2003-2004 The ScummVM-Residual Team (www.scummvm.org)
 //
 //  This library is free software; you can redistribute it and/or
 //  modify it under the terms of the GNU Lesser General Public
@@ -23,96 +23,95 @@
 #include <cctype>
 
 bool Lab::open(const char *filename) {
-  close();
-  f_ = std::fopen(filename, "rb");
-  if (! isOpen())
-    return false;
+	close();
+	f_ = std::fopen(filename, "rb");
+	if (!isOpen())
+		return false;
 
-  char header[16];
-  if (std::fread(header, 1, sizeof(header), f_) < sizeof(header)) {
-    close();
-    return false;
-  }
-  if (std::memcmp(header, "LABN", 4) != 0) {
-    close();
-    return false;
-  }
+	char header[16];
+	if (std::fread(header, 1, sizeof(header), f_) < sizeof(header)) {
+		close();
+		return false;
+	}
+	if (std::memcmp(header, "LABN", 4) != 0) {
+		close();
+		return false;
+	}
 
-  int num_entries = READ_LE_UINT32(header + 8);
-  int string_table_size = READ_LE_UINT32(header + 12);
+	int num_entries = READ_LE_UINT32(header + 8);
+	int string_table_size = READ_LE_UINT32(header + 12);
 
-  char *string_table = new char[string_table_size];
-  std::fseek(f_, 16 * (num_entries + 1), SEEK_SET);
-  std::fread(string_table, 1, string_table_size, f_);
+	char *string_table = new char[string_table_size];
+	std::fseek(f_, 16 * (num_entries + 1), SEEK_SET);
+	std::fread(string_table, 1, string_table_size, f_);
 
-  std::fseek(f_, 16, SEEK_SET);
-  char binary_entry[16];
-  for (int i = 0; i < num_entries; i++) {
-    std::fread(binary_entry, 1, 16, f_);
-    int fname_offset = READ_LE_UINT32(binary_entry);
-    int start = READ_LE_UINT32(binary_entry + 4);
-    int size = READ_LE_UINT32(binary_entry + 8);
+	std::fseek(f_, 16, SEEK_SET);
+	char binary_entry[16];
+	for (int i = 0; i < num_entries; i++) {
+		std::fread(binary_entry, 1, 16, f_);
+		int fname_offset = READ_LE_UINT32(binary_entry);
+		int start = READ_LE_UINT32(binary_entry + 4);
+		int size = READ_LE_UINT32(binary_entry + 8);
 
-    std::string fname = string_table + fname_offset;
-    std::transform(fname.begin(), fname.end(), fname.begin(), tolower);
+		std::string fname = string_table + fname_offset;
+		std::transform(fname.begin(), fname.end(), fname.begin(), tolower);
 
-    file_map_.insert(std::make_pair(fname, LabEntry(start, size)));
-    file_map_.size();
-  }
+		file_map_.insert(std::make_pair(fname, LabEntry(start, size)));
+		file_map_.size();
+	}
 
-  delete [] string_table;
-  return true;
+	delete [] string_table;
+	return true;
 }
 
 bool Lab::fileExists(const char *filename) const {
-  return find_filename(filename) != file_map_.end();
+	return find_filename(filename) != file_map_.end();
 }
 
 Block *Lab::getFileBlock(const char *filename) const {
-  file_map_type::const_iterator i = find_filename(filename);
-  if (i == file_map_.end())
-    return NULL;
+	file_map_type::const_iterator i = find_filename(filename);
+	if (i == file_map_.end())
+		return NULL;
 
-  std::fseek(f_, i->second.offset, SEEK_SET);
+	std::fseek(f_, i->second.offset, SEEK_SET);
 
-  // The sound decoder reads up to two bytes past the end of data
-  // (but shouldn't actually use those bytes).  So allocate two extra bytes
-  // to be safe against crashes.
-  char *data = new char[i->second.len + 2];
-  std::fread(data, 1, i->second.len, f_);
-  data[i->second.len] = '\0';	// For valgrind cleanness
-  data[i->second.len + 1] = '\0';
-  return new Block(data, i->second.len);
-}
+	// The sound decoder reads up to two bytes past the end of data
+	// (but shouldn't actually use those bytes).  So allocate two extra bytes
+	// to be safe against crashes.
+	char *data = new char[i->second.len + 2];
+	std::fread(data, 1, i->second.len, f_);
+	data[i->second.len] = '\0';	// For valgrind cleanness
+	data[i->second.len + 1] = '\0';
+	return new Block(data, i->second.len);
+	}
 
 std::FILE *Lab::openNewStream(const char *filename) const {
-  file_map_type::const_iterator i = find_filename(filename);
-  if (i == file_map_.end())
-    return NULL;
+	file_map_type::const_iterator i = find_filename(filename);
+	if (i == file_map_.end())
+		return NULL;
 
-  std::fseek(f_, i->second.offset, SEEK_SET);
+	std::fseek(f_, i->second.offset, SEEK_SET);
 
-  return f_;
+	return f_;
 }
 
 int Lab::fileLength(const char *filename) const {
-  file_map_type::const_iterator i = find_filename(filename);
-  if (i == file_map_.end())
-    return -1;
+	file_map_type::const_iterator i = find_filename(filename);
+	if (i == file_map_.end())
+		return -1;
 
-  return i->second.len;
+	return i->second.len;
 }
 
-Lab::file_map_type::const_iterator
-Lab::find_filename(const char *filename) const {
-  std::string s = filename;
-  std::transform(s.begin(), s.end(), s.begin(), tolower);
-  return file_map_.find(s);
+Lab::file_map_type::const_iterator Lab::find_filename(const char *filename) const {
+	std::string s = filename;
+	std::transform(s.begin(), s.end(), s.begin(), tolower);
+	return file_map_.find(s);
 }
 
 void Lab::close() {
-  if (f_ != NULL)
-    std::fclose(f_);
-  f_ = NULL;
-  file_map_.clear();
+	if (f_ != NULL)
+		std::fclose(f_);
+	f_ = NULL;
+	file_map_.clear();
 }

Index: lab.h
===================================================================
RCS file: /cvsroot/scummvm/residual/lab.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- lab.h	21 Feb 2004 15:20:00 -0000	1.3
+++ lab.h	24 Feb 2004 21:09:53 -0000	1.4
@@ -1,5 +1,5 @@
 // Residual - Virtual machine to run LucasArts' 3D adventure games
-// Copyright (C) 2003 The ScummVM-Residual Team (www.scummvm.org)
+// Copyright (C) 2003-2004 The ScummVM-Residual Team (www.scummvm.org)
 //
 //  This library is free software; you can redistribute it and/or
 //  modify it under the terms of the GNU Lesser General Public
@@ -24,46 +24,45 @@
 
 class Block {
 public:
-  Block(const char *data, int len) :
-    data_(data), len_(len) { }
-  const char *data() const { return data_; }
-  int len() const { return len_; }
+	Block(const char *data, int len) : data_(data), len_(len) {}
+	const char *data() const { return data_; }
+	int len() const { return len_; }
 
-  ~Block() { delete[] data_; }
+	~Block() { delete[] data_; }
 
 private:
-  Block();
-  const char *data_;
-  int len_;
-  bool owner_;
+	Block();
+	const char *data_;
+	int len_;
+	bool owner_;
 };
 
 class Lab {
 public:
-  Lab() : f_(NULL) { }
-  explicit Lab(const char *filename) : f_(NULL) { open(filename); }
-  bool open(const char *filename);
-  bool isOpen() const { return f_ != NULL; }
-  void close();
-  bool fileExists(const char *filename) const;
-  Block *getFileBlock(const char *filename) const;
-  std::FILE *openNewStream(const char *filename) const;
-  int fileLength(const char *filename) const;
+	Lab() : f_(NULL) { }
+	explicit Lab(const char *filename) : f_(NULL) { open(filename); }
+	bool open(const char *filename);
+	bool isOpen() const { return f_ != NULL; }
+	void close();
+	bool fileExists(const char *filename) const;
+	Block *getFileBlock(const char *filename) const;
+	std::FILE *openNewStream(const char *filename) const;
+	int fileLength(const char *filename) const;
 
-  ~Lab() { close(); }
+	~Lab() { close(); }
 
 private:
-  struct LabEntry {
-    LabEntry(int the_offset, int the_len) :
-      offset(the_offset), len(the_len) { }
-    int offset, len;
-  };
+	struct LabEntry {
+		LabEntry(int the_offset, int the_len) :
+		offset(the_offset), len(the_len) {}
+		int offset, len;
+	};
 
-  std::FILE *f_;
-  typedef std::map<std::string, LabEntry> file_map_type;
-  file_map_type file_map_;
+	std::FILE *f_;
+	typedef std::map<std::string, LabEntry> file_map_type;
+	file_map_type file_map_;
 
-  file_map_type::const_iterator find_filename(const char *filename) const;
+	file_map_type::const_iterator find_filename(const char *filename) const;
 };
 
 #endif

Index: localize.cpp
===================================================================
RCS file: /cvsroot/scummvm/residual/localize.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- localize.cpp	24 Aug 2003 17:56:03 -0000	1.2
+++ localize.cpp	24 Feb 2004 21:09:53 -0000	1.3
@@ -1,5 +1,5 @@
 // Residual - Virtual machine to run LucasArts' 3D adventure games
-// Copyright (C) 2003 The ScummVM-Residual Team (www.scummvm.org)
+// Copyright (C) 2003-2004 The ScummVM-Residual Team (www.scummvm.org)
 //
 //  This library is free software; you can redistribute it and/or
 //  modify it under the terms of the GNU Lesser General Public
@@ -25,74 +25,74 @@
 Localizer *Localizer::instance_ = NULL;
 
 Localizer *Localizer::instance() {
-  if (instance_ == NULL)
-    instance_ = new Localizer;
-  return instance_;
+	if (instance_ == NULL)
+		instance_ = new Localizer;
+	return instance_;
 }
 
 Localizer::Localizer() {
-  std::FILE *f;
-  const char *namesToTry[] = { "/GRIM.TAB", "/Grim.tab", "/grim.tab" };
+	std::FILE *f;
+	const char *namesToTry[] = { "/GRIM.TAB", "/Grim.tab", "/grim.tab" };
 
-  for (unsigned i = 0; i < sizeof(namesToTry) / sizeof(namesToTry[0]); i++) {
-    const char *datadir = Registry::instance()->get("DataDir");
-    std::string fname = (datadir != NULL ? datadir : ".");
-    fname += namesToTry[i];
-    f = std::fopen(fname.c_str(), "rb");
-    if (f != NULL)
-      break;
-  }
-  if (f == NULL)
-    return;
+	for (unsigned i = 0; i < sizeof(namesToTry) / sizeof(namesToTry[0]); i++) {
+		const char *datadir = Registry::instance()->get("DataDir");
+		std::string fname = (datadir != NULL ? datadir : ".");
+		fname += namesToTry[i];
+		f = std::fopen(fname.c_str(), "rb");
+		if (f != NULL)
+			break;
+	}
+	if (f == NULL)
+		return;
 
-  // Get the file size
-  std::fseek(f, 0, SEEK_END);
-  long filesize = std::ftell(f);
-  std::fseek(f, 0, SEEK_SET);
+	// Get the file size
+	std::fseek(f, 0, SEEK_END);
+	long filesize = std::ftell(f);
+	std::fseek(f, 0, SEEK_SET);
 
-  // Read in the data
-  char *data = new char[filesize + 1];
-  std::fread(data, 1, filesize, f);
-  data[filesize] = '\0';
-  std::fclose(f);
+	// Read in the data
+	char *data = new char[filesize + 1];
+	std::fread(data, 1, filesize, f);
+	data[filesize] = '\0';
+	std::fclose(f);
 
-  if (filesize < 4 || std::memcmp(data, "RCNE", 4) != 0)
-    error("Invalid magic reading grim.tab\n");
+	if (filesize < 4 || std::memcmp(data, "RCNE", 4) != 0)
+		error("Invalid magic reading grim.tab\n");
 
-  // Decode the data
-  for (int i = 4; i < filesize; i++)
-    data[i] ^= '\xdd';
+	// Decode the data
+	for (int i = 4; i < filesize; i++)
+		data[i] ^= '\xdd';
 
-  char *nextline;
-  for (char *line = data + 4; line != NULL && *line != '\0'; line = nextline) {
-    nextline = std::strchr(line, '\n');
-    if (nextline != NULL) {
-      if (nextline[-1] == '\r')
-	nextline[-1] = '\0';
-      nextline++;
-    }
-    char *tab = std::strchr(line, '\t');
-    if (tab == NULL)
-      continue;
-    std::string key(line, tab - line);
-    std::string val = tab + 1;
-    entries_[key] = val;
-  }
+	char *nextline;
+	for (char *line = data + 4; line != NULL && *line != '\0'; line = nextline) {
+		nextline = std::strchr(line, '\n');
+		if (nextline != NULL) {
+			if (nextline[-1] == '\r')
+				nextline[-1] = '\0';
+			nextline++;
+		}
+		char *tab = std::strchr(line, '\t');
+		if (tab == NULL)
+			continue;
+		std::string key(line, tab - line);
+		std::string val = tab + 1;
+		entries_[key] = val;
+	}
 
-  delete[] data;
+	delete[] data;
 }
 
 std::string Localizer::localize(const char *str) const {
-  if (str[0] != '/')
-    return str;
-  const char *slash2 = std::strchr(str + 1, '/');
-  if (slash2 == NULL)
-    return str;
+	if (str[0] != '/')
+		return str;
+	const char *slash2 = std::strchr(str + 1, '/');
+	if (slash2 == NULL)
+		return str;
 
-  std::string key(str + 1, slash2 - str - 1);
-  string_map::const_iterator i = entries_.find(key);
-  if (i == entries_.end())
-    return str;
+	std::string key(str + 1, slash2 - str - 1);
+	string_map::const_iterator i = entries_.find(key);
+	if (i == entries_.end())
+		return str;
 
-  return "/" + key + '/' + i->second;
+	return "/" + key + '/' + i->second;
 }

Index: localize.h
===================================================================
RCS file: /cvsroot/scummvm/residual/localize.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- localize.h	21 Feb 2004 15:20:00 -0000	1.2
+++ localize.h	24 Feb 2004 21:09:53 -0000	1.3
@@ -1,5 +1,5 @@
 // Residual - Virtual machine to run LucasArts' 3D adventure games
-// Copyright (C) 2003 The ScummVM-Residual Team (www.scummvm.org)
+// Copyright (C) 20032004 The ScummVM-Residual Team (www.scummvm.org)
 //
 //  This library is free software; you can redistribute it and/or
 //  modify it under the terms of the GNU Lesser General Public
@@ -23,18 +23,18 @@
 
 class Localizer {
 public:
-  static Localizer *instance();
+	static Localizer *instance();
 
-  std::string localize(const char *str) const;
+	std::string localize(const char *str) const;
 
 private:
-  Localizer();
-  ~Localizer() { }
+	Localizer();
+	~Localizer() { }
 
-  static Localizer *instance_;
+	static Localizer *instance_;
 
-  typedef std::map<std::string, std::string> string_map;
-  string_map entries_;
+	typedef std::map<std::string, std::string> string_map;
+	string_map entries_;
 };
 
 #endif

Index: lua.cpp
===================================================================
RCS file: /cvsroot/scummvm/residual/lua.cpp,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -d -r1.40 -r1.41
--- lua.cpp	22 Feb 2004 18:40:29 -0000	1.40
+++ lua.cpp	24 Feb 2004 21:09:53 -0000	1.41
@@ -1,5 +1,5 @@
 // Residual - Virtual machine to run LucasArts' 3D adventure games
-// Copyright (C) 2003 The ScummVM-Residual Team (www.scummvm.org)
+// Copyright (C) 2003-2004 The ScummVM-Residual Team (www.scummvm.org)
 //
 //  This library is free software; you can redistribute it and/or
 //  modify it under the terms of the GNU Lesser General Public
@@ -58,422 +58,421 @@
 // Helper functions to ensure the arguments we get are what we expect
 
 static inline Actor *check_actor(int num) {
-  if (lua_tag(lua_getparam(num)) != actor_tag)
[...2461 lines suppressed...]
-  if (! lua_isfunction(handler)) {
-    warning("Invalid event handler %s", name);
-    return LUA_NOOBJECT;
-  }
-  return handler;
+	if (lua_istable(handler)) {
+		lua_pushobject(handler);	// Push handler object
+
+		lua_pushobject(handler);	// For gettable
+		lua_pushstring(const_cast<char *>(name));
+		handler = lua_gettable();
+		if (lua_isnil(handler))
+			return LUA_NOOBJECT;
+	}
+	if (! lua_isfunction(handler)) {
+		warning("Invalid event handler %s", name);
+		return LUA_NOOBJECT;
+	}
+	return handler;
 }

Index: lua.h
===================================================================
RCS file: /cvsroot/scummvm/residual/lua.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- lua.h	15 Aug 2003 19:41:26 -0000	1.1
+++ lua.h	24 Feb 2004 21:09:53 -0000	1.2
@@ -1,5 +1,5 @@
 // Residual - Virtual machine to run LucasArts' 3D adventure games
-// Copyright (C) 2003 The ScummVM-Residual Team (www.scummvm.org)
+// Copyright (C) 2003-2004 The ScummVM-Residual Team (www.scummvm.org)
 //
 //  This library is free software; you can redistribute it and/or
 //  modify it under the terms of the GNU Lesser General Public

Index: main.cpp
===================================================================
RCS file: /cvsroot/scummvm/residual/main.cpp,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -d -r1.19 -r1.20
--- main.cpp	21 Feb 2004 22:00:13 -0000	1.19
+++ main.cpp	24 Feb 2004 21:09:53 -0000	1.20
@@ -1,5 +1,5 @@
 // Residual - Virtual machine to run LucasArts' 3D adventure games
-// Copyright (C) 2003 The ScummVM-Residual Team (www.scummvm.org)
+// Copyright (C) 2003-2004 The ScummVM-Residual Team (www.scummvm.org)
 //
 //  This library is free software; you can redistribute it and/or
 //  modify it under the terms of the GNU Lesser General Public
@@ -38,11 +38,11 @@
 int ZBUFFER_GLOBAL, SCREENBLOCKS_GLOBAL;
 
 static void saveRegistry() {
-  Registry::instance()->save();
+	Registry::instance()->save();
 }
 
 #ifdef __MINGW32__
-	int PASCAL WinMain(HINSTANCE /*hInst*/, HINSTANCE /*hPrevInst*/,  LPSTR /*lpCmdLine*/, int /*iShowCmd*/) {
+int PASCAL WinMain(HINSTANCE /*hInst*/, HINSTANCE /*hPrevInst*/,  LPSTR /*lpCmdLine*/, int /*iShowCmd*/) {
 	return main(0, NULL);
 }
 #endif
@@ -51,83 +51,83 @@
 extern Timer *g_timer;
 
 int main(int argc, char *argv[]) {
-  int i;
+	int i;
 
-  // Parse command line
-  ZBUFFER_GLOBAL = 0;
-  SCREENBLOCKS_GLOBAL = 0;
-  for (i=1;i<argc;i++) {
-	if (strcmp(argv[i], "-zbuffer") == 0)
-		ZBUFFER_GLOBAL = 1;
-	else if (strcmp(argv[i], "-screenblocks") ==0)
-		SCREENBLOCKS_GLOBAL = 1;
-	else {
-		printf("Residual CVS Version\n");
-		printf("--------------------\n");
-		printf("Recognised options:\n");
-		printf("\t-zbuffer\t\tEnable ZBuffers (Very slow on older cards)\n");
-		printf("\t-screenblocks\t\tEnable Screenblocks (Experimental zbuffer speedup on older cards - BROKEN!!\n");
-		exit(-1);
+	// Parse command line
+	ZBUFFER_GLOBAL = 0;
+	SCREENBLOCKS_GLOBAL = 0;
+	for (i=1;i<argc;i++) {
+		if (strcmp(argv[i], "-zbuffer") == 0)
+			ZBUFFER_GLOBAL = 1;
+		else if (strcmp(argv[i], "-screenblocks") ==0)
+			SCREENBLOCKS_GLOBAL = 1;
+		else {
+			printf("Residual CVS Version\n");
+			printf("--------------------\n");
+			printf("Recognised options:\n");
+			printf("\t-zbuffer\t\tEnable ZBuffers (Very slow on older cards)\n");
+			printf("\t-screenblocks\t\tEnable Screenblocks (Experimental zbuffer speedup on older cards - BROKEN!!\n");
+			exit(-1);
+		}
 	}
-  }
 
-  if (SDL_Init(SDL_INIT_EVERYTHING) < 0)
-    return 1;
+	if (SDL_Init(SDL_INIT_EVERYTHING) < 0)
+		return 1;
 
-  g_driver = new Driver(640, 480, 24);
+	g_driver = new Driver(640, 480, 24);
 
-  atexit(SDL_Quit);
-  atexit(saveRegistry);
-  
-  g_mixer = new SoundMixer();
-  g_timer = new Timer();
-  g_smush = new Smush();
+	atexit(SDL_Quit);
+	atexit(saveRegistry);
 
-  Mixer::instance()->start();
+	g_mixer = new SoundMixer();
+	g_timer = new Timer();
+	g_smush = new Smush();
 
-  Bitmap *splash_bm = ResourceLoader::instance()->loadBitmap("splash.bm");
+	Mixer::instance()->start();
 
-  SDL_Event event;
-  while (SDL_PollEvent(&event)) {
-    if (event.type == SDL_VIDEOEXPOSE) {
-      g_driver->clearScreen();
+	Bitmap *splash_bm = ResourceLoader::instance()->loadBitmap("splash.bm");
 
-      Bitmap::prepareDraw();
-      splash_bm->draw();
+	SDL_Event event;
+	while (SDL_PollEvent(&event)) {
+		if (event.type == SDL_VIDEOEXPOSE) {
+			g_driver->clearScreen();
 
-      g_driver->flipBuffer();
-    }
-  }
+			Bitmap::prepareDraw();
+			splash_bm->draw();
 
-  lua_open();
+			g_driver->flipBuffer();
+		}
+	}
 
-  lua_beginblock();
-  lua_iolibopen();
-  lua_strlibopen();
-  lua_mathlibopen();
-  lua_endblock();
+	lua_open();
 
-  lua_beginblock();
-  register_lua();
-  lua_endblock();
+	lua_beginblock();
+	lua_iolibopen();
+	lua_strlibopen();
+	lua_mathlibopen();
+	lua_endblock();
 
-  lua_beginblock();
-  bundle_dofile("_system.lua");
-  lua_endblock();
+	lua_beginblock();
+	register_lua();
+	lua_endblock();
 
-  lua_beginblock();
-  lua_pushnil();		// resumeSave
-  lua_pushnumber(0);		// bootParam
-  lua_call("BOOT");
-  lua_endblock();
+	lua_beginblock();
+	bundle_dofile("_system.lua");
+	lua_endblock();
 
-  Engine::instance()->mainLoop();
+	lua_beginblock();
+	lua_pushnil();		// resumeSave
+	lua_pushnumber(0);		// bootParam
+	lua_call("BOOT");
+	lua_endblock();
 
-  delete g_smush;
-  delete g_timer;
-  delete g_mixer;
+	Engine::instance()->mainLoop();
 
-  return 0;
+	delete g_smush;
+	delete g_timer;
+	delete g_mixer;
+
+	return 0;
 }
 
 StackLock::StackLock(MutexRef mutex)

Index: material.cpp
===================================================================
RCS file: /cvsroot/scummvm/residual/material.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- material.cpp	12 Dec 2003 08:39:07 -0000	1.6
+++ material.cpp	24 Feb 2004 21:09:53 -0000	1.7
@@ -1,5 +1,5 @@
 // Residual - Virtual machine to run LucasArts' 3D adventure games
-// Copyright (C) 2003 The ScummVM-Residual Team (www.scummvm.org)
+// Copyright (C) 2003-2004 The ScummVM-Residual Team (www.scummvm.org)
 //
 //  This library is free software; you can redistribute it and/or
 //  modify it under the terms of the GNU Lesser General Public
@@ -22,62 +22,61 @@
 #include "debug.h"
 
 Material::Material(const char *filename, const char *data, int len,
-		   const CMap &cmap) :
-  Resource(filename)
-{
-  if (len < 4 || memcmp(data, "MAT ", 4) != 0)
-    error("invalid magic loading texture\n");
+				const CMap &cmap) :
+		Resource(filename) {
+	if (len < 4 || memcmp(data, "MAT ", 4) != 0)
+		error("invalid magic loading texture\n");
 
-  num_images_ = READ_LE_UINT32(data + 12);
-  curr_image_ = 0;
-  textures_ = new GLuint[num_images_];
-  glGenTextures(num_images_, textures_);
-  width_ = READ_LE_UINT32(data + 76 + num_images_ * 40);
-  height_ = READ_LE_UINT32(data + 80 + num_images_ * 40);
+	num_images_ = READ_LE_UINT32(data + 12);
+	curr_image_ = 0;
+	textures_ = new GLuint[num_images_];
+	glGenTextures(num_images_, textures_);
+	width_ = READ_LE_UINT32(data + 76 + num_images_ * 40);
+	height_ = READ_LE_UINT32(data + 80 + num_images_ * 40);
 
-  if ((width_ == 0) || (height_ == 0)) {
-    warning("bad texture size (%dx%d) for texture %s\n", width_, height_, filename);
-  }
+	if ((width_ == 0) || (height_ == 0)) {
+		warning("bad texture size (%dx%d) for texture %s\n", width_, height_, filename);
+	}
 
-  data += 100 + num_images_ * 40;
-  char *texdata = new char[width_ * height_ * 4];
-  for (int i = 0; i < num_images_; i++) {
-    char *texdatapos = texdata;
-    for (int y = 0; y < height_; y++) {
-      for (int x = 0; x < width_; x++) {
-	int col = *(uint8 *)(data);
-	if (col == 0)
-	  memset(texdatapos, 0, 4); // transparent
-	else {
-	  memcpy(texdatapos, cmap.colors + 3 * *(uint8 *)(data), 3);
-	  texdatapos[3] = '\xff'; // fully opaque
+	data += 100 + num_images_ * 40;
+	char *texdata = new char[width_ * height_ * 4];
+	for (int i = 0; i < num_images_; i++) {
+		char *texdatapos = texdata;
+		for (int y = 0; y < height_; y++) {
+			for (int x = 0; x < width_; x++) {
+				int col = *(uint8 *)(data);
+				if (col == 0)
+					memset(texdatapos, 0, 4); // transparent
+				else {
+					memcpy(texdatapos, cmap.colors + 3 * *(uint8 *)(data), 3);
+					texdatapos[3] = '\xff'; // fully opaque
+				}
+				texdatapos += 4;
+				data++;
+			}
+		}
+		glBindTexture(GL_TEXTURE_2D, textures_[i]);
+		glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
+		glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
+		glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
+		glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
+		glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
+		glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width_, height_, 0,
+			GL_RGBA, GL_UNSIGNED_BYTE, texdata);
+		data += 24;
 	}
-	texdatapos += 4;
-	data++;
-      }
-    }
-    glBindTexture(GL_TEXTURE_2D, textures_[i]);
-    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
-    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
-    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
-    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
-    glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
-    glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width_, height_, 0,
-		 GL_RGBA, GL_UNSIGNED_BYTE, texdata);
-    data += 24;
-  }
 
-  delete[] texdata;
+	delete[] texdata;
 }
 
 void Material::select() const {
-  glBindTexture(GL_TEXTURE_2D, textures_[curr_image_]);
-  glMatrixMode(GL_TEXTURE);
-  glLoadIdentity();
-  glScalef(1.0f / width_, 1.0f / height_, 1);
+	glBindTexture(GL_TEXTURE_2D, textures_[curr_image_]);
+	glMatrixMode(GL_TEXTURE);
+	glLoadIdentity();
+	glScalef(1.0f / width_, 1.0f / height_, 1);
 }
 
 Material::~Material() {
-  glDeleteTextures(num_images_, textures_);
-  delete[] textures_;
+	glDeleteTextures(num_images_, textures_);
+	delete[] textures_;
 }

Index: material.h
===================================================================
RCS file: /cvsroot/scummvm/residual/material.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- material.h	5 Oct 2003 17:45:46 -0000	1.2
+++ material.h	24 Feb 2004 21:09:53 -0000	1.3
@@ -1,5 +1,5 @@
 // Residual - Virtual machine to run LucasArts' 3D adventure games
-// Copyright (C) 2003 The ScummVM-Residual Team (www.scummvm.org)
+// Copyright (C) 2003-2004 The ScummVM-Residual Team (www.scummvm.org)
 //
 //  This library is free software; you can redistribute it and/or
 //  modify it under the terms of the GNU Lesser General Public
@@ -27,25 +27,24 @@
 
 class Material : public Resource {
 public:
-  // Load a texture from the given data.
-  Material(const char *filename, const char *data, int len,
-	   const CMap &cmap);
+	// Load a texture from the given data.
+	Material(const char *filename, const char *data, int len, const CMap &cmap);
 
-  // Load this texture into the GL context
-  void select() const;
+	// Load this texture into the GL context
+	void select() const;
 
-  // Set which image in an animated texture to use
-  void setNumber(int n) { curr_image_ = n; }
+	// Set which image in an animated texture to use
+	void setNumber(int n) { curr_image_ = n; }
 
-  int numImages() const { return num_images_; }
-  int currentImage() const { return curr_image_; }
+	int numImages() const { return num_images_; }
+	int currentImage() const { return curr_image_; }
 
-  ~Material();
+	~Material();
 
 private:
-  int num_images_, curr_image_;
-  int width_, height_;
-  GLuint *textures_;
+	int num_images_, curr_image_;
+	int width_, height_;
+	GLuint *textures_;
 };
 
 #endif





More information about the Scummvm-git-logs mailing list