[Scummvm-cvs-logs] SF.net SVN: scummvm:[42902] scummvm/branches/gsoc2009-draci/engines/draci
dkasak13 at users.sourceforge.net
dkasak13 at users.sourceforge.net
Wed Jul 29 21:41:30 CEST 2009
Revision: 42902
http://scummvm.svn.sourceforge.net/scummvm/?rev=42902&view=rev
Author: dkasak13
Date: 2009-07-29 19:41:30 +0000 (Wed, 29 Jul 2009)
Log Message:
-----------
* Implemented the StartPlay and Play GPL commands properly
* Changed Script::load() to use the new animation callbacks
Modified Paths:
--------------
scummvm/branches/gsoc2009-draci/engines/draci/script.cpp
scummvm/branches/gsoc2009-draci/engines/draci/script.h
Modified: scummvm/branches/gsoc2009-draci/engines/draci/script.cpp
===================================================================
--- scummvm/branches/gsoc2009-draci/engines/draci/script.cpp 2009-07-29 19:39:10 UTC (rev 42901)
+++ scummvm/branches/gsoc2009-draci/engines/draci/script.cpp 2009-07-29 19:41:30 UTC (rev 42902)
@@ -46,7 +46,7 @@
{ 3, 1, "if", 2, { 4, 3 }, &Script::c_If },
{ 4, 1, "Start", 2, { 3, 2 }, &Script::start },
{ 5, 1, "Load", 2, { 3, 2 }, &Script::load },
- { 5, 2, "StartPlay", 2, { 3, 2 }, &Script::start },
+ { 5, 2, "StartPlay", 2, { 3, 2 }, &Script::startPlay },
{ 5, 3, "JustTalk", 0, { 0 }, NULL },
{ 5, 4, "JustStay", 0, { 0 }, NULL },
{ 6, 1, "Talk", 2, { 3, 2 }, NULL },
@@ -289,7 +289,15 @@
/* GPL commands */
void Script::play(Common::Queue<int> ¶ms) {
+ if (_vm->_game->getLoopStatus() == kStatusInventory) {
+ return;
+ }
+
+ _vm->_game->setLoopStatus(kStatusStrange);
+ _vm->_game->setExitLoop(true);
_vm->_game->loop();
+ _vm->_game->setExitLoop(false);
+ _vm->_game->setLoopStatus(kStatusOrdinary);
}
void Script::load(Common::Queue<int> ¶ms) {
@@ -338,6 +346,15 @@
GameObject *obj = _vm->_game->getObject(objID);
+ // Stop all animation that the object owns
+
+ for (uint i = 0; i < obj->_anims.size(); ++i) {
+ _vm->_anims->stop(obj->_anims[i]);
+ }
+
+ Animation *anim = _vm->_anims->getAnimation(animID);
+ anim->registerCallback(&Animation::stopAnimation);
+
bool visible = (objID == kDragonObject || obj->_visible);
if (visible && (obj->_location == _vm->_game->getRoomNum())) {
@@ -345,6 +362,41 @@
}
}
+void Script::startPlay(Common::Queue<int> ¶ms) {
+ if (_vm->_game->getLoopStatus() == kStatusInventory) {
+ return;
+ }
+
+ int objID = params.pop() - 1;
+ int animID = params.pop() - 1;
+
+ GameObject *obj = _vm->_game->getObject(objID);
+
+ // Stop all animation that the object owns
+
+ for (uint i = 0; i < obj->_anims.size(); ++i) {
+ _vm->_anims->stop(obj->_anims[i]);
+ }
+
+ Animation *anim = _vm->_anims->getAnimation(animID);
+ anim->registerCallback(&Animation::exitGameLoop);
+
+ _vm->_game->setLoopStatus(kStatusStrange);
+ _vm->_anims->play(animID);
+ _vm->_game->loop();
+ _vm->_game->setExitLoop(false);
+ _vm->_anims->stop(animID);
+ _vm->_game->setLoopStatus(kStatusOrdinary);
+
+ anim->registerCallback(&Animation::doNothing);
+
+ bool visible = (objID == kDragonObject || obj->_visible);
+
+ if (visible && (obj->_location == _vm->_game->getRoomNum())) {
+ _vm->_anims->play(animID);
+ }
+}
+
void Script::c_If(Common::Queue<int> ¶ms) {
int expression = params.pop();
int jump = params.pop();
@@ -567,7 +619,12 @@
/**
* @brief Find the current command in the internal table
*
- * @param num Command number
+ * @param G_LoopStatus=Inventory then Exit;
+ G_LoopSubStatus:= Strange;
+ G_QuitLoop:= True;
+ Loop;
+ G_QuitLoop:= False;
+ G_LoopSubStatus:= Ordinary; num Command number
* @param subnum Command subnumer
*
* @return NULL if command is not found. Otherwise, a pointer to a GPL2Command
Modified: scummvm/branches/gsoc2009-draci/engines/draci/script.h
===================================================================
--- scummvm/branches/gsoc2009-draci/engines/draci/script.h 2009-07-29 19:39:10 UTC (rev 42901)
+++ scummvm/branches/gsoc2009-draci/engines/draci/script.h 2009-07-29 19:41:30 UTC (rev 42902)
@@ -113,6 +113,7 @@
void execUse(Common::Queue<int> ¶ms);
void walkOn(Common::Queue<int> ¶ms);
void play(Common::Queue<int> ¶ms);
+ void startPlay(Common::Queue<int> ¶ms);
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