[Scummvm-cvs-logs] CVS: residual README,1.2,1.3 lua.cpp,1.4,1.5 scene.cpp,1.4,1.5 scene.h,1.2,1.3
James Brown
ender at users.sourceforge.net
Sun Aug 17 01:13:01 CEST 2003
Update of /cvsroot/scummvm/residual
In directory sc8-pr-cvs1:/tmp/cvs-serv10541
Modified Files:
README lua.cpp scene.cpp scene.h
Log Message:
If somebody can explain what stupid thing I have done to make 0 > 11 = true... Please tell me! (getSectorName in scene.h)
Index: README
===================================================================
RCS file: /cvsroot/scummvm/residual/README,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- README 15 Aug 2003 23:23:33 -0000 1.2
+++ README 17 Aug 2003 08:11:59 -0000 1.3
@@ -20,12 +20,12 @@
Exit with 'q', and don't press f1 or the inventory... as things go a bit weird.
Notes -
- Won't compile in MSVC (see TODO), but will on MingW32. However under
- Windows you must put .exe in the DataDir and set it to '.' in residual.ini
- Windows-style path slashing isn't parsed yet.
-
- Seems to run in Software GL for several people - need to debug opengl
- setup/usage and figure out why. See TODO for other stuff.
+ * Will run extremely slow on anything but fairly recent cards (due to use of
+ glDrawPixels). Requires OpenGL in all cases.
+ * Won't compile in MSVC (see TODO), but will on MingW32.
+ * Windows you must put .exe in the DataDir and set it to '.' in residual.ini,
+ Windows-style path slashing isn't parsed yet.
+ * See TODO for other stuff
ScummVM-Residual Team Credits:
Daniel Schepler Initial engine codebase & LUA upgrades
Index: lua.cpp
===================================================================
RCS file: /cvsroot/scummvm/residual/lua.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- lua.cpp 16 Aug 2003 20:12:02 -0000 1.4
+++ lua.cpp 17 Aug 2003 08:11:59 -0000 1.5
@@ -461,9 +461,10 @@
int i, numSectors = Engine::instance()->currScene()->getSectorCount();
warning("IsActorInSector(%s, %s): STUB", act->name(), name);
-
+ printf("Looping over %d sectors\n", numSectors);
for (i=0; i<numSectors; i++) {
- if (strstr(Engine::instance()->currScene()->getSectorName(i), name)) {
+ const char *sector_name = Engine::instance()->currScene()->getSectorName(i);
+ if (sector_name && strstr(sector_name, name)) {
warning("found sector!");
if (Engine::instance()->currScene()->isPointInSector(i, act->pos())) {
lua_pushnumber(Engine::instance()->currScene()->getSectorID(i));
Index: scene.cpp
===================================================================
RCS file: /cvsroot/scummvm/residual/scene.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- scene.cpp 17 Aug 2003 00:12:02 -0000 1.4
+++ scene.cpp 17 Aug 2003 08:11:59 -0000 1.5
@@ -54,6 +54,7 @@
lights_[i].load(ts);
// Calculate the number of sectors
+ numSectors_ = -1;
ts.expectString("section: sectors");
if (ts.eof()) // Sometimes there ARE no sectors (eg, inv room)
return;
@@ -71,7 +72,8 @@
delete [] cmaps_;
delete [] setups_;
delete [] lights_;
- delete [] sectors_; // Endy<-yaz: if I remember well, sometime sectors aren't allocated... (inventory room)
+ if (sectors_)
+ delete [] sectors_;
}
void Scene::Sector::load(TextSplitter &ts) {
Index: scene.h
===================================================================
RCS file: /cvsroot/scummvm/residual/scene.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- scene.h 16 Aug 2003 06:41:37 -0000 1.2
+++ scene.h 17 Aug 2003 08:11:59 -0000 1.3
@@ -54,9 +54,21 @@
// 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_; }
+ const char *getSectorName(int id) const {
+ // FIXME: Will someone explain to me why my machine thinks 0 > 11?!?
+ if (id > numSectors_) {
+ return sectors_[id].name_.c_str();
+ } else {
+ printf("Sector %d > %d\n", id, numSectors_);
+ return NULL;
+ }
+ }
+ int getSectorType(int id) {
+ if (id > numSectors_) return sectors_[id].type_; else return -1;
+ }
+ int getSectorID(int id) {
+ if (id > numSectors_) return sectors_[id].id_; else return -1;
+ }
bool isPointInSector(int id, Vector3d point) { return false; } // FIXME: Need pointInPoly func
private:
More information about the Scummvm-git-logs
mailing list