[Scummvm-cvs-logs] CVS: residual README,1.10,1.11 TODO,1.17,1.18 actor.cpp,1.13,1.14 actor.h,1.7,1.8

James Brown ender at users.sourceforge.net
Sat Oct 11 01:29:05 CEST 2003


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

Modified Files:
	README TODO actor.cpp actor.h 
Log Message:
Add quick'n'dirty actor constrain-to-walkbox code


Index: README
===================================================================
RCS file: /cvsroot/scummvm/residual/README,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- README	10 Oct 2003 14:20:02 -0000	1.10
+++ README	11 Oct 2003 08:28:32 -0000	1.11
@@ -1,5 +1,5 @@
 Residual: A LucasArts 3D game interpreter            Version 0.01-CVS
-(C) 2003- The ScummVM-Residual team                  Last Updated: 10th Oct 2003
+(C) 2003- The ScummVM-Residual team                  Last Updated: 11th Oct 2003
 --------------------------------------------------------------------------------
 
 What is Residual?
@@ -51,8 +51,8 @@
 ------------------------------- 
 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.
+not drawn (such as the mail tube). It may crash. Walking is not quite right.
+There is no lighting.
 
 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 

Index: TODO
===================================================================
RCS file: /cvsroot/scummvm/residual/TODO,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- TODO	10 Oct 2003 14:20:02 -0000	1.17
+++ TODO	11 Oct 2003 08:28:32 -0000	1.18
@@ -1,7 +1,6 @@
 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 (MAYBE)
  * Add LAF font support to replace existing hack   ]______
  * .. meanwhile add Win32 support for said hack :) ]        Ender
 

Index: actor.cpp
===================================================================
RCS file: /cvsroot/scummvm/residual/actor.cpp,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- actor.cpp	28 Aug 2003 01:55:48 -0000	1.13
+++ actor.cpp	11 Oct 2003 08:28:32 -0000	1.14
@@ -49,7 +49,7 @@
   // For now, this is just the ignoring-boxes version (which afaict
   // isn't even in the original).  This will eventually need a
   // following-boxes version also.
-
+  printf("walkto\n");
   if (p == pos_)
     walking_ = false;
   else {
@@ -61,13 +61,31 @@
   }
 }
 
+bool Actor::validBoxVector(Vector3d forwardVec, float dist) {
+  // TODO: Obey Actor 'constrain' flags. Verify if any other sector flags allow walking
+  //       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);
+    if ((sector->type() & 0x1000) && sector->visible()) {
+     if (sector->isPointInSector(tempVec))
+       return true;
+    }
+  }
+  return false;
+}
+
 void Actor::walkForward() {
   float dist = Engine::instance()->perSecond(walkRate_);
   float yaw_rad = yaw_ * (M_PI / 180), pitch_rad = pitch_ * (M_PI / 180);
   Vector3d forwardVec(-std::sin(yaw_rad) * std::cos(pitch_rad),
 		      std::cos(yaw_rad) * std::cos(pitch_rad),
 		      std::sin(pitch_rad));
-  pos_ += forwardVec * dist;
+  if (validBoxVector(forwardVec, dist)) 
+    pos_ += forwardVec * dist;
 }
 
 void Actor::turn(int dir) {

Index: actor.h
===================================================================
RCS file: /cvsroot/scummvm/residual/actor.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- actor.h	26 Aug 2003 09:36:47 -0000	1.7
+++ actor.h	11 Oct 2003 08:28:32 -0000	1.8
@@ -59,6 +59,8 @@
   float angleTo(const Actor &a) const;
   float yawTo(Vector3d p) const;
 
+  bool validBoxVector(Vector3d forwardVec, float dist);
+
   bool inSet(const char *name) const {
     return setName_ == name;
   }





More information about the Scummvm-git-logs mailing list