Skip to content

Commit

Permalink
ENGINES: Refactor GUI for KotOR games
Browse files Browse the repository at this point in the history
  • Loading branch information
vkremianskii authored and DrMcCoy committed Feb 28, 2019
1 parent cfcca34 commit aca58a6
Show file tree
Hide file tree
Showing 43 changed files with 900 additions and 810 deletions.
73 changes: 7 additions & 66 deletions src/engines/kotor/gui/dialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,82 +22,23 @@
* Dialog GUI for Star Wars: Knights of the Old Republic.
*/

#include "src/common/configman.h"

#include "src/events/types.h"

#include "src/graphics/windowman.h"
#include "src/graphics/aurora/cursorman.h"

#include "src/sound/sound.h"

#include "src/engines/aurora/util.h"
#include "src/engines/aurora/satellitecamera.h"

#include "src/engines/odyssey/label.h"
#include "src/engines/odyssey/listbox.h"
#include "src/engines/odyssey/scrollbar.h"

#include "src/engines/kotorbase/creature.h"
#include "src/engines/kotorbase/module.h"
#include "src/engines/kotorbase/area.h"

#include "src/engines/kotor/gui/dialog.h"

namespace Engines {

namespace KotOR {

DialogGUI::DialogGUI(KotORBase::Module &module) :
KotORBase::DialogGUI(false),
_module(module) {
}

void DialogGUI::makeLookAtPC(const Common::UString &tag) {
KotORBase::Creature *pc = _module.getPC();
if (!pc)
return;

KotORBase::Object *o = _module.getCurrentArea()->getObjectByTag(tag);
if (!o)
return;

// Only creatures should orient themselves to the pc.
KotORBase::Creature *creature = KotORBase::ObjectContainer::toCreature(o);
if (creature)
creature->makeLookAt(pc);

pc->makeLookAt(o);

float x, y, z, a;
pc->getOrientation(x, y, z, a);
SatelliteCam.setYaw(Common::deg2rad(a - 15.0f));
DialogGUI::DialogGUI(KotORBase::Module &module) : KotORBase::DialogGUI(module) {
load("dialog");
update(WindowMan.getWindowWidth(), WindowMan.getWindowHeight());
}

void DialogGUI::playDefaultAnimations(const Common::UString &tag) {
KotORBase::Object *o = _module.getCurrentArea()->getObjectByTag(tag);
if (!o)
return;

KotORBase::Creature *creature = KotORBase::ObjectContainer::toCreature(o);
if (!creature)
return;

creature->playDefaultHeadAnimation();
creature->playDefaultAnimation();
}

void DialogGUI::playTalkAnimations(const Common::UString &tag) {
KotORBase::Object *o = _module.getCurrentArea()->getObjectByTag(tag);
if (!o)
return;

KotORBase::Creature *creature = KotORBase::ObjectContainer::toCreature(o);
if (!creature)
return;

creature->playAnimation("tlknorm", true, -1.0f);
creature->playHeadAnimation("talk", true, -1.0f, 0.25f);
void DialogGUI::getTextColor(float &r, float &g, float &b) const {
r = 0.0f;
g = 0.648438f;
b = 0.968750f;
}

} // End of namespace KotOR
Expand Down
7 changes: 1 addition & 6 deletions src/engines/kotor/gui/dialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,7 @@ class DialogGUI : public KotORBase::DialogGUI {
DialogGUI(KotORBase::Module &module);

protected:
void makeLookAtPC(const Common::UString &tag);
void playDefaultAnimations(const Common::UString &tag);
void playTalkAnimations(const Common::UString &tag);

private:
KotORBase::Module &_module;
void getTextColor(float &r, float &g, float &b) const;
};

} // End of namespace KotOR
Expand Down

0 comments on commit aca58a6

Please sign in to comment.