[Scummvm-cvs-logs] CVS: residual actor.cpp,1.15,1.16 lua.cpp,1.32,1.33 walkplane.cpp,1.5,1.6 walkplane.h,1.3,1.4

James Brown ender at users.sourceforge.net
Sun Oct 12 06:07:02 CEST 2003


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

Modified Files:
	actor.cpp lua.cpp walkplane.cpp walkplane.h 
Log Message:
Add sector on/off function. Need to work out why elevator doesn't work properly.


Index: actor.cpp
===================================================================
RCS file: /cvsroot/scummvm/residual/actor.cpp,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- actor.cpp	11 Oct 2003 09:18:05 -0000	1.15
+++ actor.cpp	12 Oct 2003 13:04:46 -0000	1.16
@@ -65,7 +65,6 @@
   //       Possibly use a box-aware TraceLine function instead of just checking dest point
   Vector3d tempVec = pos_ + (forwardVec * dist);
   int numSectors = Engine::instance()->currScene()->getSectorCount();
-  printf("%f\n", dist);
 
   for (int i = 0; i < numSectors; i++) {
     Sector *sector = Engine::instance()->currScene()->getSectorBase(i);

Index: lua.cpp
===================================================================
RCS file: /cvsroot/scummvm/residual/lua.cpp,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -d -r1.32 -r1.33
--- lua.cpp	10 Oct 2003 14:20:02 -0000	1.32
+++ lua.cpp	12 Oct 2003 13:04:46 -0000	1.33
@@ -679,6 +679,46 @@
   lua_pushnil();
 }
 
+static void MakeSectorActive(void) {
+ lua_Object sectorName = lua_getparam(1);
+ bool visible = !lua_isnil(lua_getparam(2));
+ int i = 0, numSectors;
+
+ // FIXME: This happens on initial load. Are we initting something in the wrong order?
+ if (!Engine::instance()->currScene()) {
+	warning("!!!! Trying to call MakeSectorActive without a scene!");
+	return;
+ }
+
+ numSectors = Engine::instance()->currScene()->getSectorCount();
+
+ if (lua_isstring(sectorName)) {
+  char *name = luaL_check_string(1);
+
+  for (i=0; i<numSectors; i++) {
+   Sector *sector = Engine::instance()->currScene()->getSectorBase(i);
+   if (strstr(sector->name(), name)) {
+     sector->setVisible(visible);
+     return;
+   }     
+  }
+
+ } else if (lua_isnumber(sectorName)) {
+  int id = check_int(1);
+
+  for (i=0; i<numSectors; i++) {
+   Sector *sector = Engine::instance()->currScene()->getSectorBase(i);
+   if (sector->id() == id) {
+     sector->setVisible(visible);
+     return;
+   }     
+  }
+ } else {
+  warning("MakeSectorActive Parameter is not a sector ID or Name");
+  return;
+ }
+}
+
 // Scene functions
 
 static void MakeCurrentSet() {
@@ -1113,7 +1153,6 @@
   "PrintActorCostumes",
   "SpewStartup",
   "PreRender",
-  "MakeSectorActive",
   "GetSectorOppositeEdge",
   "FileFindDispose",
   "FileFindNext",
@@ -1390,6 +1429,7 @@
   { "IsMessageGoing", IsMessageGoing },
   { "GetActorSector", GetActorSector },
   { "IsActorInSector", IsActorInSector },
+  { "MakeSectorActive", MakeSectorActive },
   { "MakeCurrentSet", MakeCurrentSet },
   { "MakeCurrentSetup", MakeCurrentSetup },
   { "GetCurrentSetup", GetCurrentSetup },

Index: walkplane.cpp
===================================================================
RCS file: /cvsroot/scummvm/residual/walkplane.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- walkplane.cpp	24 Aug 2003 17:56:03 -0000	1.5
+++ walkplane.cpp	12 Oct 2003 13:04:46 -0000	1.6
@@ -82,6 +82,10 @@
   vertices_[numVertices_] = vertices_[0];
 }
 
+void Sector::setVisible(bool visible) {
+ visible_ = visible;
+}
+
 bool Sector::isPointInSector(Vector3d point) const {
   // The algorithm: for each edge A->B, check whether the z-component
   // of (B-A) x (P-A) is >= 0.  Then the point is at least in the

Index: walkplane.h
===================================================================
RCS file: /cvsroot/scummvm/residual/walkplane.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- walkplane.h	21 Aug 2003 09:15:52 -0000	1.3
+++ walkplane.h	12 Oct 2003 13:04:46 -0000	1.4
@@ -31,6 +31,8 @@
     void load(TextSplitter &ts);
     void load0(TextSplitter &ts, char *name, int id);
 
+    void setVisible(bool visible);
+
     const char *name() const { return name_.c_str(); }
     const int id() const { return id_; }
     const int type() const { return type_; } // FIXME: Implement type de-masking





More information about the Scummvm-git-logs mailing list