Skip to content

Commit

Permalink
NWN: Start adding back creatures
Browse files Browse the repository at this point in the history
No creatures of model type P (segmented models) yet.
  • Loading branch information
DrMcCoy committed Jan 29, 2014
1 parent 86d9545 commit 21debaa
Show file tree
Hide file tree
Showing 5 changed files with 957 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/engines/nwn/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ noinst_HEADERS = \
situated.h \
door.h \
placeable.h \
creature.h \
$(EMPTY)

libnwn_la_SOURCES = \
Expand All @@ -33,4 +34,5 @@ libnwn_la_SOURCES = \
situated.cpp \
door.cpp \
placeable.cpp \
creature.cpp \
$(EMPTY)
13 changes: 13 additions & 0 deletions src/engines/nwn/area.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
#include "engines/nwn/waypoint.h"
#include "engines/nwn/door.h"
#include "engines/nwn/placeable.h"
#include "engines/nwn/creature.h"

namespace Engines {

Expand Down Expand Up @@ -287,6 +288,10 @@ void Area::loadGIT(const Aurora::GFFStruct &git) {
// Doors
if (git.hasField("Door List"))
loadDoors(git.getList("Door List"));

// Creatures
if (git.hasField("Creature List"))
loadCreatures(git.getList("Creature List"));
}

void Area::loadProperties(const Aurora::GFFStruct &props) {
Expand Down Expand Up @@ -484,6 +489,14 @@ void Area::loadDoors(const Aurora::GFFList &list) {
}
}

void Area::loadCreatures(const Aurora::GFFList &list) {
for (Aurora::GFFList::const_iterator c = list.begin(); c != list.end(); ++c) {
Creature *creature = new Creature(**c);

loadObject(*creature);
}
}

Engines::NWN::Object *Area::getObjectAt(int x, int y, float &distance) const {
Graphics::Aurora::Renderable *r = SceneMan.getRenderableAt(x, y, Graphics::Aurora::kSelectableRenderable, distance);
if (!r)
Expand Down
1 change: 1 addition & 0 deletions src/engines/nwn/area.h
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ class Area : public Aurora::NWScript::Object {
void loadWaypoints (const Aurora::GFFList &list);
void loadPlaceables(const Aurora::GFFList &list);
void loadDoors (const Aurora::GFFList &list);
void loadCreatures (const Aurora::GFFList &list);

// Model loading/unloading helpers

Expand Down

0 comments on commit 21debaa

Please sign in to comment.