[Scummvm-cvs-logs] scummvm master -> 69a026192e30c544379cf938efa6b545a62e3a08

dhewg dhewg at wiibrew.org
Sat Mar 5 11:03:53 CET 2011


This automated email contains information about 4 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
68378150be ANDROID: Remove some vtable overhead on textures
4ee0a9f43a ANDROID: Merge updateTexture()
83b00526d0 ANDROID: Reduce mem usage of fillBuffer()
69a026192e AGI: Kill the timer based counter


Commit: 68378150beb96159db7d959d9625107b721eef57
    https://github.com/scummvm/scummvm/commit/68378150beb96159db7d959d9625107b721eef57
Author: dhewg (dhewg at wiibrew.org)
Date: 2011-03-05T02:00:36-08:00

Commit Message:
ANDROID: Remove some vtable overhead on textures

Changed paths:
    backends/platform/android/android.cpp
    backends/platform/android/android.h
    backends/platform/android/texture.cpp
    backends/platform/android/texture.h



diff --git a/backends/platform/android/android.cpp b/backends/platform/android/android.cpp
index 239ecd4..43b618d 100644
--- a/backends/platform/android/android.cpp
+++ b/backends/platform/android/android.cpp
@@ -326,9 +326,9 @@ void OSystem_Android::initBackend() {
 	initSurface();
 	initViewport();
 
-	_game_texture = new GLESPaletteTexture();
+	_game_texture = new GLESPalette888Texture();
 	_overlay_texture = new GLES4444Texture();
-	_mouse_texture = new GLESPaletteATexture();
+	_mouse_texture = new GLESPalette8888Texture();
 
 	// renice this thread to boost the audio thread
 	if (setpriority(PRIO_PROCESS, 0, 19) < 0)
diff --git a/backends/platform/android/android.h b/backends/platform/android/android.h
index bf72f98..3ccc84b 100644
--- a/backends/platform/android/android.h
+++ b/backends/platform/android/android.h
@@ -103,7 +103,7 @@ private:
 	bool _force_redraw;
 
 	// Game layer
-	GLESPaletteTexture *_game_texture;
+	GLESPalette888Texture *_game_texture;
 	int _shake_offset;
 	Common::Rect _focus_rect;
 
@@ -112,7 +112,7 @@ private:
 	bool _show_overlay;
 
 	// Mouse layer
-	GLESPaletteATexture *_mouse_texture;
+	GLESPalette8888Texture *_mouse_texture;
 	Common::Point _mouse_hotspot;
 	int _mouse_targetscale;
 	bool _show_mouse;
diff --git a/backends/platform/android/texture.cpp b/backends/platform/android/texture.cpp
index 7d87c14..f715f7b 100644
--- a/backends/platform/android/texture.cpp
+++ b/backends/platform/android/texture.cpp
@@ -82,7 +82,12 @@ void GLESTexture::initGLExtensions() {
 	}
 }
 
-GLESTexture::GLESTexture() :
+GLESTexture::GLESTexture(byte bytesPerPixel, GLenum glFormat, GLenum glType,
+		size_t paletteSize) :
+	_bytesPerPixel(bytesPerPixel),
+	_glFormat(glFormat),
+	_glType(glType),
+	_paletteSize(paletteSize),
 	_texture_width(0),
 	_texture_height(0),
 	_all_dirty(true)
@@ -92,7 +97,7 @@ GLESTexture::GLESTexture() :
 	// This all gets reset later in allocBuffer:
 	_surface.w = 0;
 	_surface.h = 0;
-	_surface.pitch = _texture_width;
+	_surface.pitch = 0;
 	_surface.pixels = 0;
 	_surface.bytesPerPixel = 0;
 }
@@ -109,7 +114,7 @@ void GLESTexture::release() {
 void GLESTexture::reinit() {
 	GLCALL(glGenTextures(1, &_texture_name));
 
-	if (paletteSize()) {
+	if (_paletteSize) {
 		// paletted textures are in a local buffer, don't wipe it
 		initSize();
 	} else {
@@ -132,16 +137,15 @@ void GLESTexture::initSize() {
 	GLCALL(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST));
 	GLCALL(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE));
 	GLCALL(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE));
-	GLCALL(glTexImage2D(GL_TEXTURE_2D, 0, glFormat(),
+	GLCALL(glTexImage2D(GL_TEXTURE_2D, 0, _glFormat,
 						_texture_width, _texture_height,
-						0, glFormat(), glType(), 0));
+						0, _glFormat, _glType, 0));
 }
 
 void GLESTexture::allocBuffer(GLuint w, GLuint h) {
-	int bpp = bytesPerPixel();
 	_surface.w = w;
 	_surface.h = h;
-	_surface.bytesPerPixel = bpp;
+	_surface.bytesPerPixel = _bytesPerPixel;
 
 	// Already allocated a sufficiently large buffer?
 	if (w <= _texture_width && h <= _texture_height)
@@ -155,7 +159,7 @@ void GLESTexture::allocBuffer(GLuint w, GLuint h) {
 		_texture_height = nextHigher2(_surface.h);
 	}
 
-	_surface.pitch = _texture_width * bpp;
+	_surface.pitch = _texture_width * _bytesPerPixel;
 
 	initSize();
 }
@@ -169,14 +173,14 @@ void GLESTexture::updateBuffer(GLuint x, GLuint y, GLuint w, GLuint h,
 
 	setDirtyRect(Common::Rect(x, y, x + w, y + h));
 
-	if (static_cast<int>(w) * bytesPerPixel() == pitch) {
+	if (static_cast<int>(w) * _bytesPerPixel == pitch) {
 		GLCALL(glTexSubImage2D(GL_TEXTURE_2D, 0, x, y, w, h,
-								glFormat(), glType(), buf));
+								_glFormat, _glType, buf));
 	} else {
 		// GLES removed the ability to specify pitch, so we
 		// have to do this ourselves.
 #if TEXSUBIMAGE_IS_EXPENSIVE
-		byte *tmp = new byte[w * h * bytesPerPixel()];
+		byte *tmp = new byte[w * h * _bytesPerPixel];
 		assert(tmp);
 
 		const byte *src = static_cast<const byte *>(buf);
@@ -184,13 +188,13 @@ void GLESTexture::updateBuffer(GLuint x, GLuint y, GLuint w, GLuint h,
 		GLuint count = h;
 
 		do {
-			memcpy(dst, src, w * bytesPerPixel());
-			dst += w * bytesPerPixel();
+			memcpy(dst, src, w * _bytesPerPixel);
+			dst += w * _bytesPerPixel;
 			src += pitch;
 		} while (--count);
 
 		GLCALL(glTexSubImage2D(GL_TEXTURE_2D, 0, x, y, w, h,
-								glFormat(), glType(), tmp));
+								_glFormat, _glType, tmp));
 
 		delete[] tmp;
 #else
@@ -199,7 +203,7 @@ void GLESTexture::updateBuffer(GLuint x, GLuint y, GLuint w, GLuint h,
 		const byte *src = static_cast<const byte *>(buf);
 		do {
 			GLCALL(glTexSubImage2D(GL_TEXTURE_2D, 0, x, y,
-									w, 1, glFormat(), glType(), src));
+									w, 1, _glFormat, _glType, src));
 			++y;
 			src += pitch;
 		} while (--h);
@@ -208,7 +212,7 @@ void GLESTexture::updateBuffer(GLuint x, GLuint y, GLuint w, GLuint h,
 }
 
 void GLESTexture::fillBuffer(byte x) {
-	uint rowbytes = _surface.w * bytesPerPixel();
+	uint rowbytes = _surface.w * _bytesPerPixel;
 
 	byte *tmp = new byte[_surface.h * rowbytes];
 	assert(tmp);
@@ -225,7 +229,7 @@ void GLESTexture::drawTexture(GLshort x, GLshort y, GLshort w, GLshort h) {
 #ifdef GL_OES_draw_texture
 	// Great extension, but only works under specific conditions.
 	// Still a work-in-progress - disabled for now.
-	if (false && draw_tex_supported && paletteSize() == 0) {
+	if (false && draw_tex_supported && _paletteSize == 0) {
 		//GLCALL(glTexEnvx(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE));
 		const GLint crop[4] = { 0, _surface.h, _surface.w, -_surface.h };
 
@@ -266,8 +270,23 @@ void GLESTexture::drawTexture(GLshort x, GLshort y, GLshort w, GLshort h) {
 	_dirty_rect = Common::Rect();
 }
 
-GLESPaletteTexture::GLESPaletteTexture() :
-	GLESTexture(),
+GLES4444Texture::GLES4444Texture() :
+	GLESTexture(2, GL_RGBA, GL_UNSIGNED_SHORT_4_4_4_4, 0) {
+}
+
+GLES4444Texture::~GLES4444Texture() {
+}
+
+GLES565Texture::GLES565Texture() :
+	GLESTexture(2, GL_RGB, GL_UNSIGNED_SHORT_5_6_5, 0) {
+}
+
+GLES565Texture::~GLES565Texture() {
+}
+
+GLESPaletteTexture::GLESPaletteTexture(byte bytesPerPixel, GLenum glFormat,
+										GLenum glType, size_t paletteSize) :
+	GLESTexture(bytesPerPixel, glFormat, glType, paletteSize),
 	_texture(0)
 {
 }
@@ -277,10 +296,9 @@ GLESPaletteTexture::~GLESPaletteTexture() {
 }
 
 void GLESPaletteTexture::allocBuffer(GLuint w, GLuint h) {
-	int bpp = bytesPerPixel();
 	_surface.w = w;
 	_surface.h = h;
-	_surface.bytesPerPixel = bpp;
+	_surface.bytesPerPixel = _bytesPerPixel;
 
 	// Already allocated a sufficiently large buffer?
 	if (w <= _texture_width && h <= _texture_height)
@@ -293,20 +311,20 @@ void GLESPaletteTexture::allocBuffer(GLuint w, GLuint h) {
 		_texture_width = nextHigher2(_surface.w);
 		_texture_height = nextHigher2(_surface.h);
 	}
-	_surface.pitch = _texture_width * bpp;
+	_surface.pitch = _texture_width * _bytesPerPixel;
 
 	// Texture gets uploaded later (from drawTexture())
 
-	byte *new_buffer = new byte[paletteSize() +
-		_texture_width * _texture_height * bytesPerPixel()];
+	byte *new_buffer = new byte[_paletteSize +
+		_texture_width * _texture_height * _bytesPerPixel];
 	if (_texture) {
 		// preserve palette
-		memcpy(new_buffer, _texture, paletteSize());
+		memcpy(new_buffer, _texture, _paletteSize);
 		delete[] _texture;
 	}
 
 	_texture = new_buffer;
-	_surface.pixels = _texture + paletteSize();
+	_surface.pixels = _texture + _paletteSize;
 }
 
 void GLESPaletteTexture::fillBuffer(byte x) {
@@ -324,7 +342,7 @@ void GLESPaletteTexture::updateBuffer(GLuint x, GLuint y,
 	byte *dst = static_cast<byte *>(_surface.getBasePtr(x, y));
 
 	do {
-		memcpy(dst, src, w * bytesPerPixel());
+		memcpy(dst, src, w * _bytesPerPixel);
 		dst += _surface.pitch;
 		src += pitch;
 	} while (--h);
@@ -332,9 +350,9 @@ void GLESPaletteTexture::updateBuffer(GLuint x, GLuint y,
 
 void GLESPaletteTexture::uploadTexture() const {
 	const size_t texture_size =
-		paletteSize() + _texture_width * _texture_height * bytesPerPixel();
+		_paletteSize + _texture_width * _texture_height * _bytesPerPixel;
 
-	GLCALL(glCompressedTexImage2D(GL_TEXTURE_2D, 0, glType(),
+	GLCALL(glCompressedTexImage2D(GL_TEXTURE_2D, 0, _glType,
 									_texture_width, _texture_height,
 									0, texture_size, _texture));
 }
@@ -358,5 +376,19 @@ void GLESPaletteTexture::drawTexture(GLshort x, GLshort y, GLshort w,
 	GLESTexture::drawTexture(x, y, w, h);
 }
 
+GLESPalette888Texture::GLESPalette888Texture() :
+	GLESPaletteTexture(1, GL_RGB, GL_PALETTE8_RGB8_OES, 256 * 3) {
+}
+
+GLESPalette888Texture::~GLESPalette888Texture() {
+}
+
+GLESPalette8888Texture::GLESPalette8888Texture() :
+	GLESPaletteTexture(1, GL_RGBA, GL_PALETTE8_RGBA8_OES, 256 * 4) {
+}
+
+GLESPalette8888Texture::~GLESPalette8888Texture() {
+}
+
 #endif
 
diff --git a/backends/platform/android/texture.h b/backends/platform/android/texture.h
index cc1f4e3..f1bc46e 100644
--- a/backends/platform/android/texture.h
+++ b/backends/platform/android/texture.h
@@ -39,9 +39,12 @@ class GLESTexture {
 public:
 	static void initGLExtensions();
 
-	GLESTexture();
+protected:
+	GLESTexture(byte bytesPerPixel, GLenum glFormat, GLenum glType,
+				size_t paletteSize);
 	virtual ~GLESTexture();
 
+public:
 	void release();
 	void reinit();
 	void initSize();
@@ -80,14 +83,6 @@ public:
 	}
 
 protected:
-	virtual byte bytesPerPixel() const = 0;
-	virtual GLenum glFormat() const = 0;
-	virtual GLenum glType() const = 0;
-
-	virtual size_t paletteSize() const {
-		return 0;
-	}
-
 	inline void setDirty() {
 		_all_dirty = true;
 		_dirty_rect = Common::Rect();
@@ -102,6 +97,11 @@ protected:
 		}
 	}
 
+	byte _bytesPerPixel;
+	GLenum _glFormat;
+	GLenum _glType;
+	size_t _paletteSize;
+
 	GLuint _texture_name;
 	Graphics::Surface _surface;
 	GLuint _texture_width;
@@ -114,42 +114,25 @@ protected:
 
 // RGBA4444 texture
 class GLES4444Texture : public GLESTexture {
-protected:
-	virtual byte bytesPerPixel() const {
-		return 2;
-	}
-
-	virtual GLenum glFormat() const {
-		return GL_RGBA;
-	}
-
-	virtual GLenum glType() const {
-		return GL_UNSIGNED_SHORT_4_4_4_4;
-	}
+public:
+	GLES4444Texture();
+	virtual ~GLES4444Texture();
 };
 
 // RGB565 texture
 class GLES565Texture : public GLESTexture {
-protected:
-	virtual byte bytesPerPixel() const {
-		return 2;
-	}
-
-	virtual GLenum glFormat() const {
-		return GL_RGB;
-	}
-
-	virtual GLenum glType() const {
-		return GL_UNSIGNED_SHORT_5_6_5;
-	}
+public:
+	GLES565Texture();
+	virtual ~GLES565Texture();
 };
 
-// RGB888 256-entry paletted texture
 class GLESPaletteTexture : public GLESTexture {
-public:
-	GLESPaletteTexture();
+protected:
+	GLESPaletteTexture(byte bytesPerPixel, GLenum glFormat, GLenum glType,
+						size_t paletteSize);
 	virtual ~GLESPaletteTexture();
 
+public:
 	virtual void allocBuffer(GLuint width, GLuint height);
 	virtual void updateBuffer(GLuint x, GLuint y, GLuint width, GLuint height,
 								const void *buf, int pitch);
@@ -171,41 +154,23 @@ public:
 	};
 
 protected:
-	virtual byte bytesPerPixel() const {
-		return 1;
-	}
-
-	virtual GLenum glFormat() const {
-		return GL_RGB;
-	}
-
-	virtual GLenum glType() const {
-		return GL_PALETTE8_RGB8_OES;
-	}
-
-	virtual size_t paletteSize() const {
-		return 256 * 3;
-	}
-
 	void uploadTexture() const;
 
 	byte *_texture;
 };
 
-// RGBA8888 256-entry paletted texture
-class GLESPaletteATexture : public GLESPaletteTexture {
-protected:
-	virtual GLenum glFormat() const {
-		return GL_RGBA;
-	}
-
-	virtual GLenum glType() const {
-		return GL_PALETTE8_RGBA8_OES;
-	}
+// RGB888 256-entry paletted texture
+class GLESPalette888Texture : public GLESPaletteTexture {
+public:
+	GLESPalette888Texture();
+	virtual ~GLESPalette888Texture();
+};
 
-	virtual size_t paletteSize() const {
-		return 256 * 4;
-	}
+// RGBA8888 256-entry paletted texture
+class GLESPalette8888Texture : public GLESPaletteTexture {
+public:
+	GLESPalette8888Texture();
+	virtual ~GLESPalette8888Texture();
 };
 
 #endif


Commit: 4ee0a9f43a3ccb70872b059a753485349529166d
    https://github.com/scummvm/scummvm/commit/4ee0a9f43a3ccb70872b059a753485349529166d
Author: dhewg (dhewg at wiibrew.org)
Date: 2011-03-05T02:00:36-08:00

Commit Message:
ANDROID: Merge updateTexture()

Changed paths:
    backends/platform/android/texture.cpp
    backends/platform/android/texture.h



diff --git a/backends/platform/android/texture.cpp b/backends/platform/android/texture.cpp
index f715f7b..6e31bc0 100644
--- a/backends/platform/android/texture.cpp
+++ b/backends/platform/android/texture.cpp
@@ -348,15 +348,6 @@ void GLESPaletteTexture::updateBuffer(GLuint x, GLuint y,
 	} while (--h);
 }
 
-void GLESPaletteTexture::uploadTexture() const {
-	const size_t texture_size =
-		_paletteSize + _texture_width * _texture_height * _bytesPerPixel;
-
-	GLCALL(glCompressedTexImage2D(GL_TEXTURE_2D, 0, _glType,
-									_texture_width, _texture_height,
-									0, texture_size, _texture));
-}
-
 void GLESPaletteTexture::drawTexture(GLshort x, GLshort y, GLshort w,
 										GLshort h) {
 	if (_all_dirty) {
@@ -369,7 +360,14 @@ void GLESPaletteTexture::drawTexture(GLshort x, GLshort y, GLshort w,
 								GL_CLAMP_TO_EDGE));
 		GLCALL(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T,
 								GL_CLAMP_TO_EDGE));
-		uploadTexture();
+
+		const size_t texture_size =
+			_paletteSize + _texture_width * _texture_height * _bytesPerPixel;
+
+		GLCALL(glCompressedTexImage2D(GL_TEXTURE_2D, 0, _glType,
+										_texture_width, _texture_height,
+										0, texture_size, _texture));
+
 		_all_dirty = false;
 	}
 
diff --git a/backends/platform/android/texture.h b/backends/platform/android/texture.h
index f1bc46e..38a6228 100644
--- a/backends/platform/android/texture.h
+++ b/backends/platform/android/texture.h
@@ -57,6 +57,10 @@ public:
 
 	virtual void drawTexture(GLshort x, GLshort y, GLshort w, GLshort h);
 
+	inline void drawTexture() {
+		drawTexture(0, 0, _surface.w, _surface.h);
+	}
+
 	inline GLuint width() const {
 		return _surface.w;
 	}
@@ -78,10 +82,6 @@ public:
 		return _all_dirty || !_dirty_rect.isEmpty();
 	}
 
-	inline void drawTexture() {
-		drawTexture(0, 0, _surface.w, _surface.h);
-	}
-
 protected:
 	inline void setDirty() {
 		_all_dirty = true;
@@ -154,8 +154,6 @@ public:
 	};
 
 protected:
-	void uploadTexture() const;
-
 	byte *_texture;
 };
 


Commit: 83b00526d0da2265eef8d59767cafd16190ec092
    https://github.com/scummvm/scummvm/commit/83b00526d0da2265eef8d59767cafd16190ec092
Author: dhewg (dhewg at wiibrew.org)
Date: 2011-03-05T02:00:36-08:00

Commit Message:
ANDROID: Reduce mem usage of fillBuffer()

Changed paths:
    backends/platform/android/texture.cpp



diff --git a/backends/platform/android/texture.cpp b/backends/platform/android/texture.cpp
index 6e31bc0..05c5518 100644
--- a/backends/platform/android/texture.cpp
+++ b/backends/platform/android/texture.cpp
@@ -214,13 +214,21 @@ void GLESTexture::updateBuffer(GLuint x, GLuint y, GLuint w, GLuint h,
 void GLESTexture::fillBuffer(byte x) {
 	uint rowbytes = _surface.w * _bytesPerPixel;
 
-	byte *tmp = new byte[_surface.h * rowbytes];
+	byte *tmp = new byte[rowbytes];
 	assert(tmp);
 
-	memset(tmp, x, _surface.h * rowbytes);
-	updateBuffer(0, 0, _surface.w, _surface.h, tmp, rowbytes);
+	memset(tmp, x, rowbytes);
+
+	GLCALL(glBindTexture(GL_TEXTURE_2D, _texture_name));
+	GLCALL(glPixelStorei(GL_UNPACK_ALIGNMENT, 1));
+
+	for (GLuint y = 0; y < _surface.h; ++y)
+		GLCALL(glTexSubImage2D(GL_TEXTURE_2D, 0, 0, y, _surface.w, 1,
+								_glFormat, _glType, tmp));
 
 	delete[] tmp;
+
+	setDirty();
 }
 
 void GLESTexture::drawTexture(GLshort x, GLshort y, GLshort w, GLshort h) {
@@ -311,12 +319,14 @@ void GLESPaletteTexture::allocBuffer(GLuint w, GLuint h) {
 		_texture_width = nextHigher2(_surface.w);
 		_texture_height = nextHigher2(_surface.h);
 	}
+
 	_surface.pitch = _texture_width * _bytesPerPixel;
 
 	// Texture gets uploaded later (from drawTexture())
 
 	byte *new_buffer = new byte[_paletteSize +
 		_texture_width * _texture_height * _bytesPerPixel];
+
 	if (_texture) {
 		// preserve palette
 		memcpy(new_buffer, _texture, _paletteSize);
@@ -367,8 +377,6 @@ void GLESPaletteTexture::drawTexture(GLshort x, GLshort y, GLshort w,
 		GLCALL(glCompressedTexImage2D(GL_TEXTURE_2D, 0, _glType,
 										_texture_width, _texture_height,
 										0, texture_size, _texture));
-
-		_all_dirty = false;
 	}
 
 	GLESTexture::drawTexture(x, y, w, h);


Commit: 69a026192e30c544379cf938efa6b545a62e3a08
    https://github.com/scummvm/scummvm/commit/69a026192e30c544379cf938efa6b545a62e3a08
Author: dhewg (dhewg at wiibrew.org)
Date: 2011-03-05T02:00:37-08:00

Commit Message:
AGI: Kill the timer based counter

Using the timer mechanism for just a simple counter is not just
overkill, its also inaccurate. When using a call frequency of x,
and waiting for y callbacks, the passed time will not be x*y.
The problem amplifies on slower platforms and/or fair thread
schedulers.
Use absolute times instead. Most notably, the walking speed of
the avatar is now smooth on android, but probably on all other
handhelds we support too.

Changed paths:
    engines/agi/agi.cpp
    engines/agi/agi.h
    engines/agi/preagi.cpp



diff --git a/engines/agi/agi.cpp b/engines/agi/agi.cpp
index fdc05f0..c5a1f81 100644
--- a/engines/agi/agi.cpp
+++ b/engines/agi/agi.cpp
@@ -273,23 +273,16 @@ void AgiEngine::processEvents() {
 }
 
 void AgiEngine::pollTimer() {
-	uint32 dm;
+	_lastTick += 50;
 
-	if (_tickTimer < _lastTickTimer)
-		_lastTickTimer = 0;
-
-	while ((dm = _tickTimer - _lastTickTimer) < 5) {
+	while (_system->getMillis() < _lastTick) {
 		processEvents();
 		_console->onFrame();
 		_system->delayMillis(10);
 		_system->updateScreen();
 	}
-	_lastTickTimer = _tickTimer;
-}
 
-void AgiEngine::agiTimerFunctionLow(void *refCon) {
-	AgiEngine *self = (AgiEngine *)refCon;
-	self->_tickTimer++;
+	_lastTick = _system->getMillis();
 }
 
 void AgiEngine::pause(uint32 msec) {
@@ -532,9 +525,6 @@ AgiEngine::AgiEngine(OSystem *syst, const AGIGameDescription *gameDesc) : AgiBas
 
 	_allowSynthetic = false;
 
-	_tickTimer = 0;
-	_lastTickTimer = 0;
-
 	_intobj = NULL;
 
 	_menu = NULL;
@@ -646,11 +636,10 @@ void AgiEngine::initialize() {
 
 	_lastSaveTime = 0;
 
-	_timer->installTimerProc(agiTimerFunctionLow, 10 * 1000, this);
+	_lastTick = _system->getMillis();
 
 	debugC(2, kDebugLevelMain, "Detect game");
 
-
 	if (agiDetectGame() == errOK) {
 		_game.state = STATE_LOADED;
 		debugC(2, kDebugLevelMain, "game loaded");
@@ -662,8 +651,6 @@ void AgiEngine::initialize() {
 }
 
 AgiEngine::~AgiEngine() {
-	_timer->removeTimerProc(agiTimerFunctionLow);
-
 	// If the engine hasn't been initialized yet via AgiEngine::initialize(), don't attempt to free any resources,
 	// as they haven't been allocated. Fixes bug #1742432 - AGI: Engine crashes if no game is detected
 	if (_game.state == STATE_INIT) {
@@ -719,7 +706,7 @@ void AgiEngine::parseFeatures() {
 	/* FIXME: Seems this method doesn't really do anything. It might
 	   be a leftover that could be removed, except that some of its
 	   intended purpose may still need to be reimplemented.
-	   
+
 	[0:29] <Fingolfin> can you tell me what the point behind AgiEngine::parseFeatures() is?
 	[0:30] <_sev> when games are created with WAGI studio
 	[0:31] <_sev> it creates .wag site with game-specific features such as full game title, whether to use AGIMOUSE etc
diff --git a/engines/agi/agi.h b/engines/agi/agi.h
index 89b116d..df19f55 100644
--- a/engines/agi/agi.h
+++ b/engines/agi/agi.h
@@ -810,9 +810,7 @@ public:
 	Common::Error saveGameState(int slot, const char *desc);
 
 private:
-
-	uint32 _tickTimer;
-	uint32 _lastTickTimer;
+	uint32 _lastTick;
 
 	int _keyQueue[KEY_QUEUE_SIZE];
 	int _keyQueueStart;
@@ -883,7 +881,6 @@ public:
 	virtual bool isKeypress();
 	virtual void clearKeyQueue();
 
-	static void agiTimerFunctionLow(void *refCon);
 	void initPriTable();
 
 	void newInputMode(InputMode mode);
diff --git a/engines/agi/preagi.cpp b/engines/agi/preagi.cpp
index fe864d7..1aa6ef5 100644
--- a/engines/agi/preagi.cpp
+++ b/engines/agi/preagi.cpp
@@ -122,9 +122,6 @@ void PreAgiEngine::initialize() {
 	_mixer->playStream(Audio::Mixer::kSFXSoundType, &_speakerHandle,
 							_speakerStream, -1, Audio::Mixer::kMaxChannelVolume, 0, DisposeAfterUse::NO, true);
 
-
-	//_timer->installTimerProc(agiTimerFunctionLow, 10 * 1000, NULL);
-
 	debugC(2, kDebugLevelMain, "Detect game");
 
 	// clear all resources and events






More information about the Scummvm-git-logs mailing list