Skip to content

Commit

Permalink
NWN: Show PC model
Browse files Browse the repository at this point in the history
  • Loading branch information
DrMcCoy committed Jun 18, 2013
1 parent 0101232 commit ef09977
Showing 1 changed file with 16 additions and 7 deletions.
23 changes: 16 additions & 7 deletions src/engines/nwn/module.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
*/

#include "common/util.h"
#include "common/maths.h"
#include "common/error.h"
#include "common/configman.h"

Expand Down Expand Up @@ -303,6 +304,18 @@ bool Module::enter() {
return false;
}

float entryX, entryY, entryZ, entryDirX, entryDirY;
_ifo.getEntryPosition(entryX, entryY, entryZ);
_ifo.getEntryDirection(entryDirX, entryDirY);

float orientX, orientY, orientZ;
Common::vector2orientation(entryDirX, entryDirY, orientX, orientY, orientZ);

_pc->setPosition(entryX, entryY, entryZ);
_pc->setOrientation(orientX, orientY, orientZ);

_pc->loadModel();

runScript(kScriptModuleLoad , this, _pc);
runScript(kScriptModuleStart, this, _pc);
runScript(kScriptEnter , this, _pc);
Expand All @@ -316,15 +329,8 @@ bool Module::enter() {

CameraMan.reset();

float entryX, entryY, entryZ;
_ifo.getEntryPosition(entryX, entryY, entryZ);

// Roughly head position
CameraMan.setPosition(entryX, entryZ + 2.0, entryY);

float entryDirX, entryDirY;
_ifo.getEntryDirection(entryDirX, entryDirY);

CameraMan.setOrientation(entryDirX, entryDirY);

return true;
Expand All @@ -337,6 +343,8 @@ void Module::enterArea() {
_ingameGUI->stopConversation();

if (_currentArea) {
_pc->hide();

_currentArea->runScript(kScriptExit, _currentArea, _pc);
_currentArea->hide();

Expand All @@ -358,6 +366,7 @@ void Module::enterArea() {
_currentArea = area->second;

_currentArea->show();
_pc->show();

EventMan.flushEvents();

Expand Down

0 comments on commit ef09977

Please sign in to comment.