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

dkasak13 at users.sourceforge.net dkasak13 at users.sourceforge.net
Mon Jul 13 21:53:53 CEST 2009


Revision: 42452
          http://scummvm.svn.sourceforge.net/scummvm/?rev=42452&view=rev
Author:   dkasak13
Date:     2009-07-13 19:53:53 +0000 (Mon, 13 Jul 2009)

Log Message:
-----------
* Implemented the following GPL functions: IsIcoOn, IcoStat, IsObjOn, IsObjOff, IsObjAway
* Changed GameObject::_location to an int since we sometimes use location -1.
* Some more uint <-> int changes to prevent comparisons between signed and unsigned.

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-07-13 19:45:25 UTC (rev 42451)
+++ scummvm/branches/gsoc2009-draci/engines/draci/game.cpp	2009-07-13 19:53:53 UTC (rev 42452)
@@ -144,7 +144,7 @@
 	changeRoom(0);
 }
 
-void Game::loadRoom(uint roomNum) {
+void Game::loadRoom(int roomNum) {
 
 	BAFile *f;
 	f = _vm->_roomsArchive->getFile(roomNum * 4);
@@ -208,7 +208,7 @@
 	BAFile *animFile = _vm->_animationsArchive->getFile(animNum);
 	Common::MemoryReadStream animationReader(animFile->_data, animFile->_length);	
 
-	int numFrames = animationReader.readByte();
+	uint numFrames = animationReader.readByte();
 
 	// FIXME: handle these properly
 	animationReader.readByte(); // Memory logic field, not used
@@ -356,6 +356,10 @@
 	_variables[numVar] = value;
 }
 
+int Game::getIconStatus(int iconID) {
+	return _iconStatus[iconID];
+}
+
 Game::~Game() {
 	delete[] _persons;
 	delete[] _variables;

Modified: scummvm/branches/gsoc2009-draci/engines/draci/game.h
===================================================================
--- scummvm/branches/gsoc2009-draci/engines/draci/game.h	2009-07-13 19:45:25 UTC (rev 42451)
+++ scummvm/branches/gsoc2009-draci/engines/draci/game.h	2009-07-13 19:53:53 UTC (rev 42452)
@@ -58,7 +58,7 @@
 	Common::Array<int> _anims;
 	GPL2Program _program;
 	byte *_title;
-	byte _location;
+	int _location;
 	bool _visible;
 };
 
@@ -132,7 +132,7 @@
 		_currentRoom._roomNum = n;
 	}
 
-	void loadRoom(uint roomNum);
+	void loadRoom(int roomNum);
 	int loadAnimation(uint animNum, uint z);
 	void loadOverlays();
 	void loadObject(uint numObj);
@@ -142,6 +142,8 @@
 	int getVariable(int varNum);
 	void setVariable(int varNum, int value);	
 
+	int getIconStatus(int iconID);
+
 private:
 	DraciEngine *_vm;
 	int *_variables;

Modified: scummvm/branches/gsoc2009-draci/engines/draci/script.cpp
===================================================================
--- scummvm/branches/gsoc2009-draci/engines/draci/script.cpp	2009-07-13 19:45:25 UTC (rev 42451)
+++ scummvm/branches/gsoc2009-draci/engines/draci/script.cpp	2009-07-13 19:53:53 UTC (rev 42452)
@@ -118,13 +118,13 @@
 	static const GPL2Function gplFunctions[] = {
 		{ "Not", 		&Script::funcNot },
 		{ "Random", 	&Script::funcRandom },
-		{ "IsIcoOn", 	NULL },
+		{ "IsIcoOn", 	&Script::funcIsIcoOn },
 		{ "IsIcoAct", 	NULL },
-		{ "IcoStat", 	NULL },
+		{ "IcoStat", 	&Script::funcIcoStat },
 		{ "ActIco", 	NULL },
-		{ "IsObjOn", 	NULL },
-		{ "IsObjOff", 	NULL },
-		{ "IsObjAway", 	NULL },
+		{ "IsObjOn", 	&Script::funcIsObjOn },
+		{ "IsObjOff", 	&Script::funcIsObjOff },
+		{ "IsObjAway", 	&Script::funcIsObjAway },
 		{ "ObjStat", 	NULL },
 		{ "LastBlock", 	NULL },
 		{ "AtBegin", 	NULL },
@@ -222,6 +222,46 @@
 	return !n;
 }
 
+int Script::funcIsIcoOn(int iconID) {
+	iconID -= 1;
+
+	return _vm->_game->getIconStatus(iconID) == 1;
+} 
+
+int Script::funcIcoStat(int iconID) {
+	iconID -= 1;
+
+	int status = _vm->_game->getIconStatus(iconID);
+	return (status == 1) ? 1 : 2;
+}
+
+int Script::funcIsObjOn(int objID) {
+	objID -= 1;
+
+	GameObject *obj = _vm->_game->getObject(objID);
+
+	return obj->_visible;
+}
+
+int Script::funcIsObjOff(int objID) {
+	objID -= 1;
+
+	GameObject *obj = _vm->_game->getObject(objID);
+
+	// We index locations from 0 (as opposed to the original player where it was from 1)
+	// That's why the "invalid" location 0 from the data files is converted to -1
+	return !obj->_visible && obj->_location != -1;
+}
+
+int Script::funcIsObjAway(int objID) {
+	objID -= 1;
+
+	GameObject *obj = _vm->_game->getObject(objID);
+
+	// see Script::funcIsObjOff
+	return !obj->_visible && obj->_location == -1;
+}
+
 /* GPL commands */
 
 void Script::load(Common::Queue<int> &params) {

Modified: scummvm/branches/gsoc2009-draci/engines/draci/script.h
===================================================================
--- scummvm/branches/gsoc2009-draci/engines/draci/script.h	2009-07-13 19:45:25 UTC (rev 42451)
+++ scummvm/branches/gsoc2009-draci/engines/draci/script.h	2009-07-13 19:53:53 UTC (rev 42452)
@@ -122,7 +122,13 @@
 
 	int funcRandom(int n);
 	int funcNot(int n);
+	int funcIsIcoOn(int iconID);
+	int funcIcoStat(int iconID);
+	int funcIsObjOn(int objID);
+	int funcIsObjOff(int objID);
+	int funcIsObjAway(int objID);
 
+
 	void setupCommandList();
 	const GPL2Command *findCommand(byte num, byte subnum);
 	int handleMathExpression(Common::MemoryReadStream &reader);


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