Skip to content

Commit

Permalink
NWN2: Check for 'natural', 'underground' and 'interior' area bit flags
Browse files Browse the repository at this point in the history
  • Loading branch information
rjshae authored and DrMcCoy committed Nov 23, 2018
1 parent af934b3 commit a2b2fa2
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/engines/nwn2/area.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,21 @@ Common::UString Area::getName(const Common::UString &resRef) {
return "";
}

bool Area::getIsAreaNatural() const {
// Bit flag for a natural area
return (_flags & (1 << 2));
}

bool Area::getIsAreaAboveGround() const {
// Bit flag for an underground area
return !(_flags & (1 << 1));
}

bool Area::getIsAreaInterior() const {
// Bit flag for an interior area
return (_flags & 1);
}

const Common::UString &Area::getResRef() {
return _resRef;
}
Expand Down Expand Up @@ -293,6 +308,8 @@ void Area::loadARE(const Aurora::GFF3Struct &are) {
_width = are.getUint("Width");
_height = are.getUint("Height");

_flags = are.getUint("Flags");

if (_hasTerrain)
loadTerrain();

Expand Down
8 changes: 8 additions & 0 deletions src/engines/nwn2/area.h
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,12 @@ class Area : public NWN2::Object, public Events::Notifyable {

/** Return the localized name of an area. */
static Common::UString getName(const Common::UString &resRef);
/** Return true if the Natural flag is set. */
bool getIsAreaNatural() const;
/** Return true if the Underground flag is unset. */
bool getIsAreaAboveGround() const;
/** Return true if the Interior flag is set. */
bool getIsAreaInterior() const;


protected:
Expand Down Expand Up @@ -177,6 +183,8 @@ class Area : public NWN2::Object, public Events::Notifyable {

bool _visible; ///< Is the area currently visible?

uint32 _flags; ///< Natural/Underground bit flags.

Sound::ChannelHandle _ambientSound; ///< Sound handle of the currently playing sound.
Sound::ChannelHandle _ambientMusic; ///< Sound handle of the currently playing music.

Expand Down

0 comments on commit a2b2fa2

Please sign in to comment.