Rough implementation of sector visibility.

This commit is contained in:
Daniel Schepler 2003-08-21 09:15:52 +00:00
parent a56876c1b7
commit 118f717394
3 changed files with 10 additions and 4 deletions

View File

@ -496,7 +496,7 @@ static void GetActorSector(void) {
int numSectors = Engine::instance()->currScene()->getSectorCount();
for (int i = 0; i < numSectors; i++) {
Sector *sector = Engine::instance()->currScene()->getSectorBase(i);
if (sector->type() & sectorFlag) {
if (sector->visible() && (sector->type() & sectorFlag)) {
if (sector->isPointInSector(act->pos())) {
lua_pushnumber(sector->id());
lua_pushstring(const_cast<char *>(sector->name()));
@ -517,7 +517,7 @@ static void IsActorInSector(void) {
for (i=0; i<numSectors; i++) {
Sector *sector = Engine::instance()->currScene()->getSectorBase(i);
if (strstr(sector->name(), name)) {
if (sector->visible() && strstr(sector->name(), name)) {
if (sector->isPointInSector(act->pos())) {
lua_pushnumber(sector->id());
lua_pushstring((char*)sector->name());

View File

@ -62,7 +62,12 @@ void Sector::load0(TextSplitter &ts, char *name, int id) {
error("Unknown sector type '%s' in room setup", buf);
ts.scanString(" default visibility %256s", 1, buf);
visibility_ = buf;
if (strcmp(buf, "visible") == 0)
visible_ = true;
else if (strcmp(buf, "invisible") == 0)
visible_ = false;
else
error("Invalid visibility spec: %s\n", buf);
ts.scanString(" height %f", 1, &height_);
ts.scanString(" numvertices %d", 1, &numVertices_);
vertices_ = new Vector3d[numVertices_ + 1];

View File

@ -34,6 +34,7 @@ public:
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
bool visible() const { return visible_; }
bool isPointInSector(Vector3d point) const;
private:
@ -41,7 +42,7 @@ private:
std::string name_;
int type_;
std::string visibility_;
bool visible_;
Vector3d *vertices_;
float height_;
};