[Scummvm-cvs-logs] CVS: residual TODO,1.16,1.17 README,1.9,1.10 lua.cpp,1.31,1.32

James Brown ender at users.sourceforge.net
Fri Oct 10 07:23:02 CEST 2003


Update of /cvsroot/scummvm/residual
In directory sc8-pr-cvs1:/tmp/cvs-serv30632

Modified Files:
	TODO README lua.cpp 
Log Message:
Rewrite LUA TextObject change parser gizmo.


Index: TODO
===================================================================
RCS file: /cvsroot/scummvm/residual/TODO,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- TODO	21 Sep 2003 09:51:59 -0000	1.16
+++ TODO	10 Oct 2003 14:20:02 -0000	1.17
@@ -1,8 +1,9 @@
 Residual in-progress items (in rough order of priority):
 -------------------------------------------------------0
  * Add SMUSH (low-priority, but important) - Assigned to aquadran
- * Implement limiting actor to walkplane boundries - Assigned to daniel
- * Implement text fonts (conversations, etc) - Assigned to Ender
+ * Implement limiting actor to walkplane boundries - Assigned to daniel (MAYBE)
+ * Add LAF font support to replace existing hack   ]______
+ * .. meanwhile add Win32 support for said hack :) ]        Ender
 
 Residual TODO list (in rough order of priority):
 ------------------------------------------------ 

Index: README
===================================================================
RCS file: /cvsroot/scummvm/residual/README,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- README	21 Sep 2003 09:51:59 -0000	1.9
+++ README	10 Oct 2003 14:20:02 -0000	1.10
@@ -1,5 +1,5 @@
 Residual: A LucasArts 3D game interpreter            Version 0.01-CVS
-(C) 2003- The ScummVM-Residual team                  Last Updated: 21st Sept 2003
+(C) 2003- The ScummVM-Residual team                  Last Updated: 10th Oct 2003
 --------------------------------------------------------------------------------
 
 What is Residual?
@@ -47,16 +47,26 @@
 We do have a possible solution (-screenblocks), however it is experimental
 untested, and currently will thrash memory and potentially crash.
 
-What is the state of Residual?
--------------------------------
-Many features are not yet supported. 2D graphics and text are not yet drawn,
-although you can interact with objects that do not appear (eg, the mail tube)
-It may crash. You can walk off the screen and into places you should not be
-able to. There is no lighting. Basically, not all that great.
+What is the state of Residual? 
+------------------------------- 
+Many features are not yet supported. 2D graphics are not yet drawn, nor do we
+use the built-in fonts. You can, however, still interact with objects that are
+not drawn (such as the mail tube). It may crash. You can walk off the screen and
+into places you should not be able to. There is no lighting.
 
-However, the game itself is in a fairly decent state. You can (using the
-default Grim keys, such as 'e' for examine, 'u' to use, 'p' to pickup and
-'i' for inventory) interact with things and actually 'play' it.
+The game itself is in a fairly decent state, and you can play at least up until
+you retrieve your first customer. The default Grim keys 
+use, 'p' to pickup and 'i' for inventory) will let you interact with things and
+actually 'play' it.
+
+What are the default keys?
+--------------------------
+Arrow keys : Movement
+e,u,p,i    : Examine, Use, Pickup, Inventory
+Shift      : Hold while moving, to 'Run'
+Enter      : Selects items in inventory, conversation, etc
+Escape     : Exits out of some screens
+q          : Quit 
 
 How do I report bugs?
 ---------------------
@@ -73,9 +83,9 @@
 ScummVM-Residual Team Credits:
  Daniel Schepler         Initial engine codebase & LUA upgrades
  James Brown          	 ScummVM project leader, core engine developer
- Vincent Hamm            Core engine developer
+ Vincent Hamm            Some core engine code
  Lionel Ulmer            OpenGL optimisations
- Pawel Kolodziejski      SMUSH/iMUSE implemention
+ Pawel Kolodziejski      Future SMUSH/iMUSE implemention
 
 Special Thanks To:
 ------------------ 

Index: lua.cpp
===================================================================
RCS file: /cvsroot/scummvm/residual/lua.cpp,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -d -r1.31 -r1.32
--- lua.cpp	5 Oct 2003 17:45:46 -0000	1.31
+++ lua.cpp	10 Oct 2003 14:20:02 -0000	1.32
@@ -896,7 +896,6 @@
 
  textID = lua_getstring(lua_getparam(1));
 
- warning("killTextObject(%s)", textID);
  for (Engine::text_list_type::const_iterator i = Engine::instance()->textsBegin();
       i != Engine::instance()->textsEnd(); i++) {
    TextObject *textO = *i;
@@ -909,9 +908,48 @@
  }
 }
 
+// Called from both Callback and Main CTO functions. This routine is NOT
+// thread safe.
+static void ChangeTextObject_Real(char *keyName, void *data) {
+ static TextObject *modifyObject = NULL; // Set by main CTO call 'object'
+ lua_Object *keyValue = NULL;
+
+ if (strstr(keyName, "object")) {
+  modifyObject = (TextObject*)data;
+  return;
+ }
+
+ if (!modifyObject)	// We *need* a modify object for remaining calls
+  return;
+
+ keyValue = (lua_Object*)data;
+
+// FIXME: X/Y sets depend on GetTextObjectDimensions
+
+ if (strstr(keyName, "fgcolor"))
+   modifyObject->setColor(check_color(2));
+ else if (strstr(keyName, "x"))
+  ; // modifyObject->setX( atoi(lua_getstring(keyValue)) );
+ else if (strstr(keyName, "y")) 
+  ; // modifyObject->setY( atoi(lua_getstring(keyValue)) );
+ else 
+  printf("ChangeTextObject() - Unknown key %s\n", keyName);
+}
+
+// Callback from table walk method in Main CTO function
+static void ChangeTextObject_CB(void) {
+ char *keyName = NULL;
+ lua_Object keyValue;
+
+ keyName = lua_getstring(lua_getparam(1));
+ keyValue = lua_getresult(2);
+ ChangeTextObject_Real(keyName, &keyValue);
+};
+
+// Main CTO handler and LUA interface
 static void ChangeTextObject() {
- char *textID = lua_getstring(lua_getparam(1)), *keyText = NULL;
- lua_Object tableObj = lua_getparam(2), tableKey;
+ char *textID = lua_getstring(lua_getparam(1));
+ lua_Object tableObj = lua_getparam(2);
  TextObject *modifyObject = NULL;
 
  for (Engine::text_list_type::const_iterator i = Engine::instance()->textsBegin();
@@ -927,25 +965,13 @@
  if (!modifyObject)
   error("ChangeTextObject(%s): Cannot find active text object", textID);
 
- while(1) {
-   lua_pushobject(tableObj);
-   if (keyText) lua_pushobject(tableKey); else lua_pushnil();
-   lua_call("next");
-   tableKey=lua_getresult(1);
-   if (lua_isnil(tableKey)) 
-    break;
-
-   keyText=lua_getstring(tableKey);
+ if (!lua_istable(tableObj))
+  return;
 
-   if (strstr(keyText, "fgcolor"))
-    modifyObject->setColor(check_color(2));
-   else if (strstr(keyText, "x"))
-    ; // modifyObject->setX(atoi(lua_getstring(lua_getresult(2))));
-   else if (strstr(keyText, "y"))
-    ; // modifyObject->setY(atoi(lua_getstring(lua_getresult(2))));
-   else 
-    printf("ChangeTextObject(%s) - Unknown key %s\n", textID, keyText);
- }
+ ChangeTextObject_Real("object", modifyObject);
+ lua_pushobject(tableObj);
+ lua_pushcfunction(ChangeTextObject_CB);	// Callback handler
+ lua_call("foreach");
 }
 
 static void GetTextObjectDimensions() {





More information about the Scummvm-git-logs mailing list