[Scummvm-cvs-logs] SF.net SVN: scummvm:[46358] scummvm/trunk/engines/kyra

athrxx at users.sourceforge.net athrxx at users.sourceforge.net
Sun Dec 13 16:19:56 CET 2009


Revision: 46358
          http://scummvm.svn.sourceforge.net/scummvm/?rev=46358&view=rev
Author:   athrxx
Date:     2009-12-13 15:19:56 +0000 (Sun, 13 Dec 2009)

Log Message:
-----------
LOL: some cleanup for recent code changes

Modified Paths:
--------------
    scummvm/trunk/engines/kyra/animator_tim.cpp
    scummvm/trunk/engines/kyra/script_lol.cpp
    scummvm/trunk/engines/kyra/script_tim.cpp
    scummvm/trunk/engines/kyra/script_tim.h
    scummvm/trunk/engines/kyra/sequences_lol.cpp

Modified: scummvm/trunk/engines/kyra/animator_tim.cpp
===================================================================
--- scummvm/trunk/engines/kyra/animator_tim.cpp	2009-12-13 00:08:16 UTC (rev 46357)
+++ scummvm/trunk/engines/kyra/animator_tim.cpp	2009-12-13 15:19:56 UTC (rev 46358)
@@ -97,13 +97,13 @@
 	}
 }
 
-void TimAnimator::displayFrame(int animIndex, int page, int frame) {
+void TimAnimator::displayFrame(int animIndex, int page, int frame, int flags) {
 	TimAnimator::Animation *anim = &_animations[animIndex];
 	if ((anim->wsaCopyParams & 0x4000) != 0)
 		page = 2;
 	// WORKAROUND for some bugged scripts that will try to display frames of non-existent animations
 	if (anim->wsa)
-		anim->wsa->displayFrame(frame, page, anim->x, anim->y, anim->wsaCopyParams & 0xF0FF, 0, 0);
+		anim->wsa->displayFrame(frame, page, anim->x, anim->y, (flags == -1) ? (anim->wsaCopyParams & 0xF0FF) : flags, 0, 0);
 	if (!page)
 		_screen->updateScreen();
 }

Modified: scummvm/trunk/engines/kyra/script_lol.cpp
===================================================================
--- scummvm/trunk/engines/kyra/script_lol.cpp	2009-12-13 00:08:16 UTC (rev 46357)
+++ scummvm/trunk/engines/kyra/script_lol.cpp	2009-12-13 15:19:56 UTC (rev 46358)
@@ -2393,21 +2393,23 @@
 int LoLEngine::tlol_processWsaFrame(const TIM *tim, const uint16 *param) {
 	debugC(3, kDebugLevelScriptFuncs, "LoLEngine::tlol_processWsaFrame(%p, %p) (%d, %d, %d, %d, %d)",
 		(const void *)tim, (const void *)param, param[0], param[1], param[2], param[3], param[4]);
-	TimAnimator::Animation *anim = (TimAnimator::Animation *) tim->wsa[param[0]].anim;
+
+	const int animIndex = tim->wsa[param[0]].anim - 1;
 	const int frame = param[1];
 	const int x2 = param[2];
 	const int y2 = param[3];
 	const int factor = MAX<int>(0, (int16)param[4]);
 
-	const int x1 = anim->x;
-	const int y1 = anim->y;
+	const int x1 = _animator->getAnimX(animIndex);
+	const int y1 = _animator->getAnimY(animIndex);
+	const Movie *wsa = _animator->getWsaCPtr(animIndex);
 
-	int w1 = anim->wsa->width();
-	int h1 = anim->wsa->height();
+	int w1 = wsa->width();
+	int h1 = wsa->height();
 	int w2 = (w1 * factor) / 100;
 	int h2 = (h1 * factor) / 100;
 
-	anim->wsa->displayFrame(frame, 2, x1, y1, anim->wsaCopyParams & 0xF0FF, 0, 0);
+	_animator->displayFrame(animIndex, 2, frame);
 	_screen->wsaFrameAnimationStep(x1, y1, x2, y2, w1, h1, w2, h2, 2, _flags.isDemo && _flags.platform != Common::kPlatformPC98 ? 0 : 8, 0);
 	if (!_flags.isDemo && _flags.platform != Common::kPlatformPC98)
 		_screen->checkedPageUpdate(8, 4);
@@ -2665,12 +2667,14 @@
 int LoLEngine::tlol_displayAnimFrame(const TIM *tim, const uint16 *param) {
 	debugC(3, kDebugLevelScriptFuncs, "LoLEngine::tlol_displayAnimFrame(%p, %p) (%d, %d)", (const void *)tim, (const void *)param, param[0], param[1]);
 
-	TimAnimator::Animation *anim = (TimAnimator::Animation *)tim->wsa[param[0]].anim;
+	const int animIndex = tim->wsa[param[0]].anim - 1;
+	const Movie *wsa = _animator->getWsaCPtr(animIndex);
+
 	if (param[1] == 0xFFFF) {
 		_screen->copyRegion(0, 0, 0, 0, 320, 200, 0, 2, Screen::CR_NO_P_CHECK);
 	} else {
-		anim->wsa->displayFrame(param[1], 2, anim->x, anim->y, 0, 0, 0);
-		_screen->copyRegion(anim->wsa->xAdd(), anim->wsa->yAdd(), anim->wsa->xAdd(), anim->wsa->yAdd(), anim->wsa->width(), anim->wsa->height(), 2, 0);
+		_animator->displayFrame(animIndex, 2, param[1], 0);
+		_screen->copyRegion(wsa->xAdd(), wsa->yAdd(), wsa->xAdd(), wsa->yAdd(), wsa->width(), wsa->height(), 2, 0);
 	}
 
 	return 1;

Modified: scummvm/trunk/engines/kyra/script_tim.cpp
===================================================================
--- scummvm/trunk/engines/kyra/script_tim.cpp	2009-12-13 00:08:16 UTC (rev 46357)
+++ scummvm/trunk/engines/kyra/script_tim.cpp	2009-12-13 15:19:56 UTC (rev 46358)
@@ -465,7 +465,7 @@
 	}
 }
 
-TimAnimator::Animation *TIMInterpreter::initAnimStruct(int index, const char *filename, int x, int y, int, int offscreenBuffer, uint16 wsaFlags) {
+int TIMInterpreter::initAnimStruct(int index, const char *filename, int x, int y, int, int offscreenBuffer, uint16 wsaFlags) {
 	Movie *wsa = 0;
 
 	const bool isLoLDemo = _vm->gameFlags().isDemo && _vm->gameFlags().gameID == GI_LOL;
@@ -572,7 +572,7 @@
 
 	_animator->init(index, wsa, x, y, wsaFlags, 0);
 
-	return _animator->getAnimPtr(index);
+	return index + 1;
 }
 
 int TIMInterpreter::freeAnimStruct(int index) {
@@ -920,7 +920,7 @@
 	_dialogueButtonPosX = _dialogueButtonPosY = _dialogueNumButtons = _dialogueButtonXoffs = _dialogueHighlightedButton = 0;
 }
 
-TimAnimator::Animation *TIMInterpreter_LoL::initAnimStruct(int index, const char *filename, int x, int y, int frameDelay, int, uint16 wsaFlags) {
+int TIMInterpreter_LoL::initAnimStruct(int index, const char *filename, int x, int y, int frameDelay, int, uint16 wsaFlags) {
 	Movie *wsa = 0;
 	uint16 wsaOpenFlags = 0;
 	if (wsaFlags & 0x10)
@@ -962,7 +962,7 @@
 
 	_animator->init(index, wsa, x, y, wsaFlags, frameDelay);
 
-	return _animator->getAnimPtr(index);
+	return index + 1;
 }
 
 int TIMInterpreter_LoL::freeAnimStruct(int index) {

Modified: scummvm/trunk/engines/kyra/script_tim.h
===================================================================
--- scummvm/trunk/engines/kyra/script_tim.h	2009-12-13 00:08:16 UTC (rev 46357)
+++ scummvm/trunk/engines/kyra/script_tim.h	2009-12-13 15:19:56 UTC (rev 46358)
@@ -73,13 +73,15 @@
 #endif
 	~TimAnimator();
 
-	Animation *getAnimPtr(int index) { return (index >= 0 && index < 6) ? &_animations[index] : 0; }
-
 	void init(int animIndex, Movie *wsa, int x, int y, int wsaCopyParams, int frameDelay);
 	void reset(int animIndex, bool clearStruct);
 
-	void displayFrame(int animIndex, int page, int frame);
+	void displayFrame(int animIndex, int page, int frame, int flags = -1);
 
+	const Movie *getWsaCPtr(int animIndex) { return (animIndex >= 0 && animIndex < 6) ? _animations[animIndex].wsa : 0; }
+	int getAnimX(int animIndex) { return (animIndex >= 0 && animIndex < 6) ? _animations[animIndex].x : 0; }
+	int getAnimY(int animIndex) { return (animIndex >= 0 && animIndex < 6) ? _animations[animIndex].y : 0; }
+
 #ifdef ENABLE_LOL
 	void setupPart(int animIndex, int part, int firstFrame, int lastFrame, int cycles, int nextPart, int partDelay, int f, int sfxIndex, int sfxFrame);
 	void start(int animIndex, int part);
@@ -136,7 +138,7 @@
 	};
 
 	struct WSASlot {
-		void *anim;
+		int anim;
 
 		int16 x, y;
 		uint16 wsaFlags;
@@ -164,7 +166,7 @@
 
 	bool callback(Common::IFFChunk &chunk);
 
-	virtual TimAnimator::Animation *initAnimStruct(int index, const char *filename, int x, int y, int, int offscreenBuffer, uint16 wsaFlags);
+	virtual int initAnimStruct(int index, const char *filename, int x, int y, int, int offscreenBuffer, uint16 wsaFlags);
 	virtual int freeAnimStruct(int index);
 	TimAnimator *animator() { return _animator; }
 
@@ -270,7 +272,7 @@
 public:
 	TIMInterpreter_LoL(LoLEngine *engine, Screen_v2 *screen_v2, OSystem *system);
 
-	TimAnimator::Animation *initAnimStruct(int index, const char *filename, int x, int y, int frameDelay, int, uint16 wsaCopyParams);
+	int initAnimStruct(int index, const char *filename, int x, int y, int frameDelay, int, uint16 wsaCopyParams);
 	int freeAnimStruct(int index);
 
 	void drawDialogueBox(int numStr, const char *s1, const char *s2, const char *s3);

Modified: scummvm/trunk/engines/kyra/sequences_lol.cpp
===================================================================
--- scummvm/trunk/engines/kyra/sequences_lol.cpp	2009-12-13 00:08:16 UTC (rev 46357)
+++ scummvm/trunk/engines/kyra/sequences_lol.cpp	2009-12-13 15:19:56 UTC (rev 46358)
@@ -195,6 +195,7 @@
 void LoLEngine::showIntro() {
 	_tim = new TIMInterpreter(this, _screen, _system);
 	assert(_tim);
+	_animator = _tim->animator();
 
 	if (_flags.platform == Common::kPlatformPC98)
 		showStarcraftLogo();
@@ -261,6 +262,7 @@
 int LoLEngine::chooseCharacter() {
 	_tim = new TIMInterpreter(this, _screen, _system);
 	assert(_tim);
+	_animator = _tim->animator();
 
 	_tim->setLangData("LOLINTRO.DIP");
 
@@ -1046,6 +1048,7 @@
 	setupEpilogueData(true);
 	TIMInterpreter *timBackUp = _tim;
 	_tim = new TIMInterpreter(this, _screen, _system);
+	_animator = _tim->animator();
 
 	_screen->getPalette(0).clear();
 	_screen->setScreenPalette(_screen->getPalette(0));


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list