[Scummvm-cvs-logs] CVS: residual lua.cpp,1.1,1.2 scene.cpp,1.2,1.3 scene.h,1.1,1.2

James Brown ender at users.sourceforge.net
Fri Aug 15 23:48:04 CEST 2003


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

Modified Files:
	lua.cpp scene.cpp scene.h 
Log Message:
A few random incomplete sector thingies. still have to add a cvsignore for grimdialog :P


Index: lua.cpp
===================================================================
RCS file: /cvsroot/scummvm/residual/lua.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- lua.cpp	15 Aug 2003 19:41:26 -0000	1.1
+++ lua.cpp	16 Aug 2003 06:41:37 -0000	1.2
@@ -428,6 +428,43 @@
   }
 }
 
+// Sector functions
+static void GetActorSector(void) {
+  Actor *act = check_actor(1);
+  int sectorType = check_int(2);
+
+  warning("GetActorSector(%s, %d): STUB", act->name(), sectorType);
+
+  if (0) {
+   lua_pushnumber(0); // id
+   lua_pushstring(""); // name
+   lua_pushnumber(0); // type
+  } else {
+   lua_pushnil();
+  }
+}
+
+static void IsActorInSector(void) {
+  Actor *act = check_actor(1);
+  const char *name = luaL_check_string(2);
+  int i, numSectors = Engine::instance()->currScene()->getSectorCount();
+
+  warning("IsActorInSector(%s, %s): STUB", act->name(), name);
+
+  for (i=0; i<numSectors; i++) {
+   if (strstr(Engine::instance()->currScene()->getSectorName(i), name)) {
+    warning("found sector!");
+    if (Engine::instance()->currScene()->isPointInSector(i, act->pos())) {
+      lua_pushnumber(Engine::instance()->currScene()->getSectorID(i));
+      lua_pushstring((char*)Engine::instance()->currScene()->getSectorName(i));
+      lua_pushnumber(Engine::instance()->currScene()->getSectorType(i));
+    }
+   }
+  } 
+
+  lua_pushnil();
+}
+
 // Scene functions
 
 static void MakeCurrentSet() {
@@ -723,8 +760,6 @@
   "GetActorRot",
   "GetPointSector",
   "IsPointInSector",
-  "GetActorSector",
-  "IsActorInSector",
   "SetActorFrustrumCull",
   "ShutUpActor",
   "SetActorFollowBoxes",
@@ -979,6 +1014,8 @@
   { "GetVisibleThings", GetVisibleThings },
   { "SayLine", SayLine },
   { "IsMessageGoing", IsMessageGoing },
+  { "GetActorSector", GetActorSector },
+  { "IsActorInSector", IsActorInSector },
   { "MakeCurrentSet", MakeCurrentSet },
   { "MakeCurrentSetup", MakeCurrentSetup },
   { "GetCurrentSetup", GetCurrentSetup },

Index: scene.cpp
===================================================================
RCS file: /cvsroot/scummvm/residual/scene.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- scene.cpp	15 Aug 2003 20:47:16 -0000	1.2
+++ scene.cpp	16 Aug 2003 06:41:37 -0000	1.3
@@ -90,7 +90,21 @@
   name_ = name;
   id_ = id;
   ts.scanString(" type %256s", 1, buf);
-  type_ = buf;
+
+  // FIXME: I don't think these are right (see grim loc_4A7D19, result is var_200?)
+  if (strstr(buf, "walk"))
+   type_ = 1;
+  else if (strstr(buf, "funnel"))
+   type_ = 3; // ??
+  else if (strstr(buf, "camera"))
+   type_ = 2;
+  else if (strstr(buf, "special"))
+   type_ = 4;
+  else if (strstr(buf, "chernobyl"))
+   type_ = 0;
+  else
+   error("Unknown sector type '%s' in room setup", buf);
+
   ts.scanString(" default visibility %256s", 1, buf);
   visibility_ = buf;
   ts.scanString(" height %f", 1, &height_);

Index: scene.h
===================================================================
RCS file: /cvsroot/scummvm/residual/scene.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- scene.h	15 Aug 2003 19:41:26 -0000	1.1
+++ scene.h	16 Aug 2003 06:41:37 -0000	1.2
@@ -52,6 +52,13 @@
   void setSetup(int num) { currSetup_ = setups_ + num; }
   int setup() const { return currSetup_ - setups_; }
 
+  // Sector access functions
+  int getSectorCount() { return numSectors_; }
+  const char *getSectorName(int id) const { return sectors_[id].name_.c_str(); }
+  int getSectorType(int id) { return sectors_[id].type_; }
+  int getSectorID(int id) { return sectors_[id].id_; }
+  bool isPointInSector(int id, Vector3d point) { return false; } // FIXME: Need pointInPoly func
+
 private:
   struct Setup {		// Camera setup data
     void load(TextSplitter &ts);
@@ -76,7 +83,7 @@
     void load0(TextSplitter &ts, char *name, int id);
     int numVertices_, id_;
     std::string name_;
-    std::string type_;
+    int type_;
     std::string visibility_;
     Vector3d *vertices_;
     float height_;





More information about the Scummvm-git-logs mailing list