[Scummvm-cvs-logs] SF.net SVN: scummvm: [31654] scummvm/trunk/engines/made

thebluegr at users.sourceforge.net thebluegr at users.sourceforge.net
Tue Apr 22 09:40:28 CEST 2008


Revision: 31654
          http://scummvm.svn.sourceforge.net/scummvm/?rev=31654&view=rev
Author:   thebluegr
Date:     2008-04-22 00:40:28 -0700 (Tue, 22 Apr 2008)

Log Message:
-----------
Added palette locking and some wip sound playing code. Some cleanup

Modified Paths:
--------------
    scummvm/trunk/engines/made/screen.cpp
    scummvm/trunk/engines/made/screen.h
    scummvm/trunk/engines/made/scriptfuncs.cpp

Modified: scummvm/trunk/engines/made/screen.cpp
===================================================================
--- scummvm/trunk/engines/made/screen.cpp	2008-04-22 07:38:49 UTC (rev 31653)
+++ scummvm/trunk/engines/made/screen.cpp	2008-04-22 07:40:28 UTC (rev 31654)
@@ -33,29 +33,25 @@
 
 	_screen1 = new Graphics::Surface();
 	_screen1->create(320, 200, 1);
-	_clipInfo1.x = 0;
-	_clipInfo1.y = 0;
-	_clipInfo1.w = 320;
-	_clipInfo1.h = 200;
-	_clipInfo1.destSurface = _screen1;
-
 	_screen2 = new Graphics::Surface();
 	_screen2->create(320, 200, 1);
-	_clipInfo2.x = 0;
-	_clipInfo2.y = 0;
-	_clipInfo2.w = 320;
-	_clipInfo2.h = 200;
-	_clipInfo2.destSurface = _screen2;
 
+	_clipInfo1.x = _clipInfo2.x = 0;
+	_clipInfo1.y = _clipInfo2.y = 0;
+	_clipInfo1.w = _clipInfo2.w = 320;
+	_clipInfo1.h = _clipInfo2.h = 200;
+
+	_clipInfo1.destSurface = _screen1;
+	_clipInfo2.destSurface = _screen2;
 	_clipArea.destSurface = _screen2;
 	
-	_excludeClipAreaEnabled[0] = false;
-	_excludeClipAreaEnabled[1] = false;
-	_excludeClipAreaEnabled[2] = false;
-	_excludeClipAreaEnabled[3] = false;
+	for (int i = 0; i <= 3; i++)
+		_excludeClipAreaEnabled[i] = false;
 
+	_screenLock = false;
+	_paletteLock = false;
+
 	clearChannels();
-	
 }
 
 Screen::~Screen() {
@@ -135,19 +131,16 @@
 
 void Screen::drawSpriteChannels(const ClipInfo &clipInfo, int16 includeStateMask, int16 excludeStateMask) {
 
-	_excludeClipArea[0].destSurface = clipInfo.destSurface;
-	_excludeClipArea[1].destSurface = clipInfo.destSurface;
-	_excludeClipArea[2].destSurface = clipInfo.destSurface;
-	_excludeClipArea[3].destSurface = clipInfo.destSurface;
+	for (int i = 0; i <= 3; i++)
+		_excludeClipArea[i].destSurface = clipInfo.destSurface;
+
 	_clipArea.destSurface = clipInfo.destSurface;
 	
 	for (uint16 i = 0; i < _channelsUsedCount; i++) {
 	
 		debug(2, "drawSpriteChannels() i = %d\n", i);
 	
-		if (((_channels[i].state & includeStateMask) == includeStateMask) && (_channels[i].state & excludeStateMask) == 0)
-		{
-
+		if (((_channels[i].state & includeStateMask) == includeStateMask) && (_channels[i].state & excludeStateMask) == 0) {
 			uint16 flag1 = _channels[i].state & 0x10;
 			uint16 flag2 = _channels[i].state & 0x20;
 			
@@ -203,18 +196,15 @@
 }
 
 void Screen::updateSprites() {
+	// TODO: This needs some more work, dirty rectangles are currently not used
 
-	// TODO: This needs some more work, I don't use dirty rectangles for now
-
 	memcpy(_screen2->pixels, _screen1->pixels, 64000);
 
 	//drawSpriteChannels(_clipInfo1, 3, 0x40);//CHECKME
-
 	drawSpriteChannels(_clipInfo1, 3, 0);//CHECKME
 	drawSpriteChannels(_clipInfo2, 1, 2);//CHECKME
 
 	_vm->_system->copyRectToScreen((const byte*)_screen2->pixels, _screen2->pitch, 0, 0, _screen2->w, _screen2->h);
-
 }
 
 void Screen::clearChannels() {
@@ -287,7 +277,6 @@
 	}
 
 	_vm->_res->freeResource(anim);
-	
 }
 
 uint16 Screen::drawPic(uint16 index, int16 x, int16 y, uint16 flag1, uint16 flag2) {
@@ -304,11 +293,10 @@
 	return 0;
 }
 
-uint16 Screen::addSprite(uint16 spriteIndex) {
+void Screen::addSprite(uint16 spriteIndex) {
 	bool oldScreenLock = _screenLock;
 	drawFlex(spriteIndex, 0, 0, 0, 0, _clipInfo1);
 	_screenLock = oldScreenLock;
-	return 0;
 }
 
 uint16 Screen::drawSprite(uint16 flexIndex, int16 x, int16 y) {

Modified: scummvm/trunk/engines/made/screen.h
===================================================================
--- scummvm/trunk/engines/made/screen.h	2008-04-22 07:38:49 UTC (rev 31653)
+++ scummvm/trunk/engines/made/screen.h	2008-04-22 07:40:28 UTC (rev 31654)
@@ -63,6 +63,8 @@
 	void drawSurface(Graphics::Surface *source, int x, int y);
 	void loadRGBPalette(byte *palRGB, int count = 256);
 	void setRGBPalette(byte *palRGB, int start = 0, int count = 256);
+	bool isPaletteLocked() { return _paletteLock; }
+	void setPaletteLock(bool lock) { _paletteLock = lock; }
 
 	uint16 updateChannel(uint16 channelIndex);
 	void deleteChannel(uint16 channelIndex);
@@ -81,7 +83,7 @@
 	uint16 drawPic(uint16 index, int16 x, int16 y, uint16 flag1, uint16 flag2);
 	uint16 drawAnimPic(uint16 animIndex, int16 x, int16 y, int16 frameNum, uint16 flag1, uint16 flag2);
 	
-	uint16 addSprite(uint16 spriteIndex);
+	void addSprite(uint16 spriteIndex);
 	
 	uint16 drawSprite(uint16 flexIndex, int16 x, int16 y);
 	uint16 placeSprite(uint16 channelIndex, uint16 flexIndex, int16 x, int16 y);
@@ -106,7 +108,8 @@
 	MadeEngine *_vm;
 	
 	bool _screenLock;
-	
+	bool _paletteLock;
+
 	uint16 _clip, _exclude, _ground;
 	
 	Graphics::Surface *_screen1, *_screen2;

Modified: scummvm/trunk/engines/made/scriptfuncs.cpp
===================================================================
--- scummvm/trunk/engines/made/scriptfuncs.cpp	2008-04-22 07:38:49 UTC (rev 31653)
+++ scummvm/trunk/engines/made/scriptfuncs.cpp	2008-04-22 07:40:28 UTC (rev 31654)
@@ -190,7 +190,8 @@
 }
 
 int16 ScriptFunctionsRtz::o1_SHOWPAGE(int16 argc, int16 *argv) {
-	_vm->_system->setPalette(_vm->_screen->_screenPalette, 0, 256);
+	if (!_vm->_screen->isPaletteLocked())
+		_vm->_system->setPalette(_vm->_screen->_screenPalette, 0, 256);
 	_vm->_screen->show();
 	return 0;
 }
@@ -274,6 +275,11 @@
 }
 
 int16 ScriptFunctionsRtz::o1_PLAYSND(int16 argc, int16 *argv) {
+	/*
+	Audio::SoundHandle audioStreamHandle;
+	_vm->_mixer->playInputStream(Audio::Mixer::kPlainSoundType, &audioStreamHandle, 
+								 _vm->_res->getSound(argv[0])->getAudioStream());
+	*/
 	return 0;
 }
 
@@ -332,6 +338,7 @@
 }
 
 int16 ScriptFunctionsRtz::o1_ADDSPRITE(int16 argc, int16 *argv) {
+	//_vm->_screen->addSprite(argv[0]);
 	g_system->delayMillis(5000);
 	return 0;
 }
@@ -381,7 +388,7 @@
 }
 
 int16 ScriptFunctionsRtz::o1_PALETTELOCK(int16 argc, int16 *argv) {
-	//g_system->delayMillis(1000);
+	_vm->_screen->setPaletteLock(argv[0] != 0);
 	return 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