[Scummvm-cvs-logs] SF.net SVN: scummvm:[43391] scummvm/branches/gsoc2009-draci/engines/draci

dkasak13 at users.sourceforge.net dkasak13 at users.sourceforge.net
Sat Aug 15 04:42:34 CEST 2009


Revision: 43391
          http://scummvm.svn.sourceforge.net/scummvm/?rev=43391&view=rev
Author:   dkasak13
Date:     2009-08-15 02:42:34 +0000 (Sat, 15 Aug 2009)

Log Message:
-----------
* Implemented LoadPalette, SetPalette and BlackPalette GPL commands.
* Used a more natural condition (whether the scheduled room number is different from the current room number) instead of the _roomChange hack.

Modified Paths:
--------------
    scummvm/branches/gsoc2009-draci/engines/draci/game.cpp
    scummvm/branches/gsoc2009-draci/engines/draci/game.h
    scummvm/branches/gsoc2009-draci/engines/draci/script.cpp
    scummvm/branches/gsoc2009-draci/engines/draci/script.h

Modified: scummvm/branches/gsoc2009-draci/engines/draci/game.cpp
===================================================================
--- scummvm/branches/gsoc2009-draci/engines/draci/game.cpp	2009-08-15 00:28:59 UTC (rev 43390)
+++ scummvm/branches/gsoc2009-draci/engines/draci/game.cpp	2009-08-15 02:42:34 UTC (rev 43391)
@@ -217,6 +217,7 @@
 void Game::init() {
 	_shouldQuit = false;
 	_shouldExitLoop = false;
+	_scheduledPalette = 0;
 
 	_animUnderCursor = kOverlayImage;
 
@@ -437,7 +438,7 @@
 		_vm->_system->delayMillis(20);
 
 		// HACK: Won't be needed once the game loop is implemented properly
-		_shouldExitLoop = _shouldExitLoop || (_roomChange && 
+		_shouldExitLoop = _shouldExitLoop || (_newRoom != _currentRoom._roomNum && 
 						(_loopStatus == kStatusOrdinary || _loopStatus == kStatusGate));
 
 	} while (!shouldExitLoop());
@@ -1160,6 +1161,14 @@
 	return _currentRoom._escRoom;
 }
 
+void Game::schedulePalette(int paletteID) {
+	_scheduledPalette = paletteID;
+}
+
+int Game::getScheduledPalette() {
+	return _scheduledPalette;
+}
+
 /**
  * The GPL command Mark sets the animation index (which specifies the order in which 
  * animations were loaded in) which is then used by the Release command to delete

Modified: scummvm/branches/gsoc2009-draci/engines/draci/game.h
===================================================================
--- scummvm/branches/gsoc2009-draci/engines/draci/game.h	2009-08-15 00:28:59 UTC (rev 43390)
+++ scummvm/branches/gsoc2009-draci/engines/draci/game.h	2009-08-15 02:42:34 UTC (rev 43391)
@@ -73,6 +73,10 @@
 	kNoDialogue = -1, kDialogueLines = 4
 };
 
+enum {
+	kBlackPalette = -1
+};
+
 enum SpeechConstants {
 	kBaseSpeechDuration = 200,
 	kSpeechTimeUnit = 400
@@ -293,6 +297,9 @@
 	void dialogueDone();
 	void runDialogueProg(GPL2Program, int offset);
 
+	void schedulePalette(int paletteID);
+	int getScheduledPalette();
+
 	bool _roomChange;
 
 private:
@@ -341,6 +348,8 @@
 	int _animUnderCursor;
 
 	int _markedAnimationIndex; //!< Used by the Mark GPL command
+
+	int _scheduledPalette;
 };
 
 } // End of namespace Draci

Modified: scummvm/branches/gsoc2009-draci/engines/draci/script.cpp
===================================================================
--- scummvm/branches/gsoc2009-draci/engines/draci/script.cpp	2009-08-15 00:28:59 UTC (rev 43390)
+++ scummvm/branches/gsoc2009-draci/engines/draci/script.cpp	2009-08-15 02:42:34 UTC (rev 43391)
@@ -61,9 +61,9 @@
 		{ 10, 1, "WalkOn", 				3, { 1, 1, 3 }, &Script::walkOn },
 		{ 10, 2, "StayOn", 				3, { 1, 1, 3 }, &Script::walkOn }, // HACK: not a proper implementation
 		{ 10, 3, "WalkOnPlay", 			3, { 1, 1, 3 }, &Script::walkOnPlay },
-		{ 11, 1, "LoadPalette", 		1, { 2 }, NULL },
-		{ 12, 1, "SetPalette", 			0, { 0 }, NULL },
-		{ 12, 2, "BlackPalette", 		0, { 0 }, NULL },
+		{ 11, 1, "LoadPalette", 		1, { 2 }, &Script::loadPalette },
+		{ 12, 1, "SetPalette", 			0, { 0 }, &Script::setPalette },
+		{ 12, 2, "BlackPalette", 		0, { 0 }, &Script::blackPalette },
 		{ 13, 1, "FadePalette", 		3, { 1, 1, 1 }, NULL },
 		{ 13, 2, "FadePalettePlay", 	3, { 1, 1, 1 }, NULL },
 		{ 14, 1, "NewRoom", 			2, { 3, 1 }, &Script::newRoom },
@@ -716,6 +716,28 @@
 	_vm->_game->loadWalkingMap();
 }
 
+void Script::loadPalette(Common::Queue<int> &params) {
+	int palette = params.pop() - 1;	
+
+	_vm->_game->schedulePalette(palette);
+}
+
+void Script::blackPalette(Common::Queue<int> &params) {
+
+	_vm->_game->schedulePalette(kBlackPalette);
+}
+
+void Script::setPalette(Common::Queue<int> &params) {
+
+	if (_vm->_game->getScheduledPalette() == -1) {
+		_vm->_screen->setPaletteEmpty();
+	} else {
+		BAFile *f;		
+		f = _vm->_paletteArchive->getFile(_vm->_game->getScheduledPalette());
+		_vm->_screen->setPalette(f->_data, 0, kNumColours);
+	}
+}
+
 void Script::endCurrentProgram() {
 	_endProgram = true;
 }

Modified: scummvm/branches/gsoc2009-draci/engines/draci/script.h
===================================================================
--- scummvm/branches/gsoc2009-draci/engines/draci/script.h	2009-08-15 00:28:59 UTC (rev 43390)
+++ scummvm/branches/gsoc2009-draci/engines/draci/script.h	2009-08-15 02:42:34 UTC (rev 43391)
@@ -127,6 +127,9 @@
 	void resetDialogue(Common::Queue<int> &params);
 	void resetDialogueFrom(Common::Queue<int> &params);
 	void resetBlock(Common::Queue<int> &params);
+	void setPalette(Common::Queue<int> &params);
+	void blackPalette(Common::Queue<int> &params);
+	void loadPalette(Common::Queue<int> &params);
 
 	int operAnd(int op1, int op2);
 	int operOr(int op1, int op2);


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