mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-03-29 19:36:43 +00:00
Merge branch 'master' into graphics
This commit is contained in:
commit
246c6493df
65 changed files with 613 additions and 282 deletions
|
@ -8,7 +8,9 @@
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
||||||
MwIniImporter::MwIniImporter() {
|
MwIniImporter::MwIniImporter()
|
||||||
|
: mVerbose(false)
|
||||||
|
{
|
||||||
const char *map[][2] =
|
const char *map[][2] =
|
||||||
{
|
{
|
||||||
{ "fps", "General:Show FPS" },
|
{ "fps", "General:Show FPS" },
|
||||||
|
@ -124,9 +126,9 @@ MwIniImporter::multistrmap MwIniImporter::loadCfgFile(std::string filename) {
|
||||||
void MwIniImporter::merge(multistrmap &cfg, multistrmap &ini) {
|
void MwIniImporter::merge(multistrmap &cfg, multistrmap &ini) {
|
||||||
multistrmap::iterator cfgIt;
|
multistrmap::iterator cfgIt;
|
||||||
multistrmap::iterator iniIt;
|
multistrmap::iterator iniIt;
|
||||||
for(strmap::iterator it=mMergeMap.begin(); it!=mMergeMap.end(); it++) {
|
for(strmap::iterator it=mMergeMap.begin(); it!=mMergeMap.end(); ++it) {
|
||||||
if((iniIt = ini.find(it->second)) != ini.end()) {
|
if((iniIt = ini.find(it->second)) != ini.end()) {
|
||||||
for(std::vector<std::string>::iterator vc = iniIt->second.begin(); vc != iniIt->second.end(); vc++) {
|
for(std::vector<std::string>::iterator vc = iniIt->second.begin(); vc != iniIt->second.end(); ++vc) {
|
||||||
cfg.erase(it->first);
|
cfg.erase(it->first);
|
||||||
insertMultistrmap(cfg, it->first, *vc);
|
insertMultistrmap(cfg, it->first, *vc);
|
||||||
}
|
}
|
||||||
|
@ -139,9 +141,9 @@ void MwIniImporter::mergeFallback(multistrmap &cfg, multistrmap &ini) {
|
||||||
|
|
||||||
multistrmap::iterator cfgIt;
|
multistrmap::iterator cfgIt;
|
||||||
multistrmap::iterator iniIt;
|
multistrmap::iterator iniIt;
|
||||||
for(std::vector<std::string>::iterator it=mMergeFallback.begin(); it!=mMergeFallback.end(); it++) {
|
for(std::vector<std::string>::iterator it=mMergeFallback.begin(); it!=mMergeFallback.end(); ++it) {
|
||||||
if((iniIt = ini.find(*it)) != ini.end()) {
|
if((iniIt = ini.find(*it)) != ini.end()) {
|
||||||
for(std::vector<std::string>::iterator vc = iniIt->second.begin(); vc != iniIt->second.end(); vc++) {
|
for(std::vector<std::string>::iterator vc = iniIt->second.begin(); vc != iniIt->second.end(); ++vc) {
|
||||||
std::string value(*it);
|
std::string value(*it);
|
||||||
std::replace( value.begin(), value.end(), ' ', '_' );
|
std::replace( value.begin(), value.end(), ' ', '_' );
|
||||||
std::replace( value.begin(), value.end(), ':', '_' );
|
std::replace( value.begin(), value.end(), ':', '_' );
|
||||||
|
@ -176,7 +178,7 @@ void MwIniImporter::importGameFiles(multistrmap &cfg, multistrmap &ini) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
for(std::vector<std::string>::iterator entry = it->second.begin(); entry!=it->second.end(); entry++) {
|
for(std::vector<std::string>::iterator entry = it->second.begin(); entry!=it->second.end(); ++entry) {
|
||||||
std::string filetype(entry->substr(entry->length()-4, 3));
|
std::string filetype(entry->substr(entry->length()-4, 3));
|
||||||
std::transform(filetype.begin(), filetype.end(), filetype.begin(), ::tolower);
|
std::transform(filetype.begin(), filetype.end(), filetype.begin(), ::tolower);
|
||||||
|
|
||||||
|
@ -194,22 +196,22 @@ void MwIniImporter::importGameFiles(multistrmap &cfg, multistrmap &ini) {
|
||||||
cfg.erase("master");
|
cfg.erase("master");
|
||||||
cfg.insert( std::make_pair<std::string, std::vector<std::string> > ("master", std::vector<std::string>() ) );
|
cfg.insert( std::make_pair<std::string, std::vector<std::string> > ("master", std::vector<std::string>() ) );
|
||||||
|
|
||||||
for(std::vector<std::string>::iterator it=esmFiles.begin(); it!=esmFiles.end(); it++) {
|
for(std::vector<std::string>::iterator it=esmFiles.begin(); it!=esmFiles.end(); ++it) {
|
||||||
cfg["master"].push_back(*it);
|
cfg["master"].push_back(*it);
|
||||||
}
|
}
|
||||||
|
|
||||||
cfg.erase("plugin");
|
cfg.erase("plugin");
|
||||||
cfg.insert( std::make_pair<std::string, std::vector<std::string> > ("plugin", std::vector<std::string>() ) );
|
cfg.insert( std::make_pair<std::string, std::vector<std::string> > ("plugin", std::vector<std::string>() ) );
|
||||||
|
|
||||||
for(std::vector<std::string>::iterator it=espFiles.begin(); it!=espFiles.end(); it++) {
|
for(std::vector<std::string>::iterator it=espFiles.begin(); it!=espFiles.end(); ++it) {
|
||||||
cfg["plugin"].push_back(*it);
|
cfg["plugin"].push_back(*it);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MwIniImporter::writeToFile(boost::iostreams::stream<boost::iostreams::file_sink> &out, multistrmap &cfg) {
|
void MwIniImporter::writeToFile(boost::iostreams::stream<boost::iostreams::file_sink> &out, multistrmap &cfg) {
|
||||||
|
|
||||||
for(multistrmap::iterator it=cfg.begin(); it != cfg.end(); it++) {
|
for(multistrmap::iterator it=cfg.begin(); it != cfg.end(); ++it) {
|
||||||
for(std::vector<std::string>::iterator entry=it->second.begin(); entry != it->second.end(); entry++) {
|
for(std::vector<std::string>::iterator entry=it->second.begin(); entry != it->second.end(); ++entry) {
|
||||||
out << (it->first) << "=" << (*entry) << std::endl;
|
out << (it->first) << "=" << (*entry) << std::endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
|
|
||||||
#include "../mwworld/ptr.hpp"
|
#include "../mwworld/ptr.hpp"
|
||||||
#include "../mwworld/actiontake.hpp"
|
#include "../mwworld/actiontake.hpp"
|
||||||
|
#include "../mwworld/actionequip.hpp"
|
||||||
#include "../mwworld/nullaction.hpp"
|
#include "../mwworld/nullaction.hpp"
|
||||||
#include "../mwworld/inventorystore.hpp"
|
#include "../mwworld/inventorystore.hpp"
|
||||||
#include "../mwworld/world.hpp"
|
#include "../mwworld/world.hpp"
|
||||||
|
@ -176,4 +177,11 @@ namespace MWClass
|
||||||
|
|
||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boost::shared_ptr<MWWorld::Action> Light::use (const MWWorld::Ptr& ptr) const
|
||||||
|
{
|
||||||
|
MWBase::Environment::get().getSoundManager()->playSound (getUpSoundId(ptr), 1.0, 1.0);
|
||||||
|
|
||||||
|
return boost::shared_ptr<MWWorld::Action>(new MWWorld::ActionEquip(ptr));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,6 +48,10 @@ namespace MWClass
|
||||||
|
|
||||||
virtual std::string getInventoryIcon (const MWWorld::Ptr& ptr) const;
|
virtual std::string getInventoryIcon (const MWWorld::Ptr& ptr) const;
|
||||||
///< Return name of inventory icon.
|
///< Return name of inventory icon.
|
||||||
|
|
||||||
|
virtual boost::shared_ptr<MWWorld::Action> use (const MWWorld::Ptr& ptr)
|
||||||
|
const;
|
||||||
|
///< Generate action for using via inventory menu
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
|
|
||||||
#include "../mwworld/ptr.hpp"
|
#include "../mwworld/ptr.hpp"
|
||||||
#include "../mwworld/actiontake.hpp"
|
#include "../mwworld/actiontake.hpp"
|
||||||
|
#include "../mwworld/actionequip.hpp"
|
||||||
#include "../mwworld/inventorystore.hpp"
|
#include "../mwworld/inventorystore.hpp"
|
||||||
#include "../mwworld/world.hpp"
|
#include "../mwworld/world.hpp"
|
||||||
#include "../mwgui/window_manager.hpp"
|
#include "../mwgui/window_manager.hpp"
|
||||||
|
@ -155,4 +156,11 @@ namespace MWClass
|
||||||
|
|
||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boost::shared_ptr<MWWorld::Action> Lockpick::use (const MWWorld::Ptr& ptr) const
|
||||||
|
{
|
||||||
|
MWBase::Environment::get().getSoundManager()->playSound (getUpSoundId(ptr), 1.0, 1.0);
|
||||||
|
|
||||||
|
return boost::shared_ptr<MWWorld::Action>(new MWWorld::ActionEquip(ptr));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,6 +48,10 @@ namespace MWClass
|
||||||
|
|
||||||
virtual std::string getInventoryIcon (const MWWorld::Ptr& ptr) const;
|
virtual std::string getInventoryIcon (const MWWorld::Ptr& ptr) const;
|
||||||
///< Return name of inventory icon.
|
///< Return name of inventory icon.
|
||||||
|
|
||||||
|
virtual boost::shared_ptr<MWWorld::Action> use (const MWWorld::Ptr& ptr)
|
||||||
|
const;
|
||||||
|
///< Generate action for using via inventory menu
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
|
|
||||||
#include "../mwworld/ptr.hpp"
|
#include "../mwworld/ptr.hpp"
|
||||||
#include "../mwworld/actiontake.hpp"
|
#include "../mwworld/actiontake.hpp"
|
||||||
|
#include "../mwworld/actionequip.hpp"
|
||||||
#include "../mwworld/inventorystore.hpp"
|
#include "../mwworld/inventorystore.hpp"
|
||||||
#include "../mwworld/world.hpp"
|
#include "../mwworld/world.hpp"
|
||||||
#include "../mwgui/window_manager.hpp"
|
#include "../mwgui/window_manager.hpp"
|
||||||
|
@ -154,4 +155,11 @@ namespace MWClass
|
||||||
|
|
||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boost::shared_ptr<MWWorld::Action> Probe::use (const MWWorld::Ptr& ptr) const
|
||||||
|
{
|
||||||
|
MWBase::Environment::get().getSoundManager()->playSound (getUpSoundId(ptr), 1.0, 1.0);
|
||||||
|
|
||||||
|
return boost::shared_ptr<MWWorld::Action>(new MWWorld::ActionEquip(ptr));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,6 +48,10 @@ namespace MWClass
|
||||||
|
|
||||||
virtual std::string getInventoryIcon (const MWWorld::Ptr& ptr) const;
|
virtual std::string getInventoryIcon (const MWWorld::Ptr& ptr) const;
|
||||||
///< Return name of inventory icon.
|
///< Return name of inventory icon.
|
||||||
|
|
||||||
|
virtual boost::shared_ptr<MWWorld::Action> use (const MWWorld::Ptr& ptr)
|
||||||
|
const;
|
||||||
|
///< Generate action for using via inventory menu
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -607,7 +607,7 @@ namespace MWDialogue
|
||||||
void DialogueManager::parseText(std::string text)
|
void DialogueManager::parseText(std::string text)
|
||||||
{
|
{
|
||||||
std::list<std::string>::iterator it;
|
std::list<std::string>::iterator it;
|
||||||
for(it = actorKnownTopics.begin();it != actorKnownTopics.end();it++)
|
for(it = actorKnownTopics.begin();it != actorKnownTopics.end();++it)
|
||||||
{
|
{
|
||||||
size_t pos = find_str_ci(text,*it,0);
|
size_t pos = find_str_ci(text,*it,0);
|
||||||
if(pos !=std::string::npos)
|
if(pos !=std::string::npos)
|
||||||
|
|
|
@ -117,6 +117,7 @@ CharacterCreation::CharacterCreation(WindowManager* _wm)
|
||||||
, mCreateClassDialog(0)
|
, mCreateClassDialog(0)
|
||||||
, mBirthSignDialog(0)
|
, mBirthSignDialog(0)
|
||||||
, mReviewDialog(0)
|
, mReviewDialog(0)
|
||||||
|
, mGenerateClassStep(0)
|
||||||
, mWM(_wm)
|
, mWM(_wm)
|
||||||
{
|
{
|
||||||
mCreationStage = CSE_NotStarted;
|
mCreationStage = CSE_NotStarted;
|
||||||
|
|
|
@ -581,8 +581,7 @@ void CreateClassDialog::onDialogCancel()
|
||||||
|
|
||||||
void CreateClassDialog::onSpecializationClicked(MyGUI::WidgetPtr _sender)
|
void CreateClassDialog::onSpecializationClicked(MyGUI::WidgetPtr _sender)
|
||||||
{
|
{
|
||||||
if (specDialog)
|
delete specDialog;
|
||||||
delete specDialog;
|
|
||||||
specDialog = new SelectSpecializationDialog(mWindowManager);
|
specDialog = new SelectSpecializationDialog(mWindowManager);
|
||||||
specDialog->eventCancel += MyGUI::newDelegate(this, &CreateClassDialog::onDialogCancel);
|
specDialog->eventCancel += MyGUI::newDelegate(this, &CreateClassDialog::onDialogCancel);
|
||||||
specDialog->eventItemSelected += MyGUI::newDelegate(this, &CreateClassDialog::onSpecializationSelected);
|
specDialog->eventItemSelected += MyGUI::newDelegate(this, &CreateClassDialog::onSpecializationSelected);
|
||||||
|
@ -613,8 +612,7 @@ void CreateClassDialog::setSpecialization(int id)
|
||||||
|
|
||||||
void CreateClassDialog::onAttributeClicked(Widgets::MWAttributePtr _sender)
|
void CreateClassDialog::onAttributeClicked(Widgets::MWAttributePtr _sender)
|
||||||
{
|
{
|
||||||
if (attribDialog)
|
delete attribDialog;
|
||||||
delete attribDialog;
|
|
||||||
attribDialog = new SelectAttributeDialog(mWindowManager);
|
attribDialog = new SelectAttributeDialog(mWindowManager);
|
||||||
attribDialog->setAffectedWidget(_sender);
|
attribDialog->setAffectedWidget(_sender);
|
||||||
attribDialog->eventCancel += MyGUI::newDelegate(this, &CreateClassDialog::onDialogCancel);
|
attribDialog->eventCancel += MyGUI::newDelegate(this, &CreateClassDialog::onDialogCancel);
|
||||||
|
@ -645,8 +643,7 @@ void CreateClassDialog::onAttributeSelected()
|
||||||
|
|
||||||
void CreateClassDialog::onSkillClicked(Widgets::MWSkillPtr _sender)
|
void CreateClassDialog::onSkillClicked(Widgets::MWSkillPtr _sender)
|
||||||
{
|
{
|
||||||
if (skillDialog)
|
delete skillDialog;
|
||||||
delete skillDialog;
|
|
||||||
skillDialog = new SelectSkillDialog(mWindowManager);
|
skillDialog = new SelectSkillDialog(mWindowManager);
|
||||||
skillDialog->setAffectedWidget(_sender);
|
skillDialog->setAffectedWidget(_sender);
|
||||||
skillDialog->eventCancel += MyGUI::newDelegate(this, &CreateClassDialog::onDialogCancel);
|
skillDialog->eventCancel += MyGUI::newDelegate(this, &CreateClassDialog::onDialogCancel);
|
||||||
|
|
|
@ -138,6 +138,7 @@ namespace MWGui
|
||||||
void Console::disable()
|
void Console::disable()
|
||||||
{
|
{
|
||||||
setVisible(false);
|
setVisible(false);
|
||||||
|
setSelectedObject(MWWorld::Ptr());
|
||||||
// Remove keyboard focus from the console input whenever the
|
// Remove keyboard focus from the console input whenever the
|
||||||
// console is turned off
|
// console is turned off
|
||||||
MyGUI::InputManager::getInstance().setKeyFocusWidget(NULL);
|
MyGUI::InputManager::getInstance().setKeyFocusWidget(NULL);
|
||||||
|
@ -240,7 +241,7 @@ namespace MWGui
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
ConsoleInterpreterContext interpreterContext (*this, MWWorld::Ptr());
|
ConsoleInterpreterContext interpreterContext (*this, mPtr);
|
||||||
Interpreter::Interpreter interpreter;
|
Interpreter::Interpreter interpreter;
|
||||||
MWScript::installOpcodes (interpreter);
|
MWScript::installOpcodes (interpreter);
|
||||||
std::vector<Interpreter::Type_Code> code;
|
std::vector<Interpreter::Type_Code> code;
|
||||||
|
@ -267,7 +268,7 @@ namespace MWGui
|
||||||
/* Are there quotation marks? */
|
/* Are there quotation marks? */
|
||||||
if( tmp.find('"') != string::npos ) {
|
if( tmp.find('"') != string::npos ) {
|
||||||
int numquotes=0;
|
int numquotes=0;
|
||||||
for(string::iterator it=tmp.begin(); it < tmp.end(); it++) {
|
for(string::iterator it=tmp.begin(); it < tmp.end(); ++it) {
|
||||||
if( *it == '"' )
|
if( *it == '"' )
|
||||||
numquotes++;
|
numquotes++;
|
||||||
}
|
}
|
||||||
|
@ -310,7 +311,7 @@ namespace MWGui
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Iterate through the vector. */
|
/* Iterate through the vector. */
|
||||||
for(vector<string>::iterator it=mNames.begin(); it < mNames.end();it++) {
|
for(vector<string>::iterator it=mNames.begin(); it < mNames.end();++it) {
|
||||||
bool string_different=false;
|
bool string_different=false;
|
||||||
|
|
||||||
/* Is the string shorter than the input string? If yes skip it. */
|
/* Is the string shorter than the input string? If yes skip it. */
|
||||||
|
@ -358,7 +359,7 @@ namespace MWGui
|
||||||
int i = tmp.length();
|
int i = tmp.length();
|
||||||
|
|
||||||
for(string::iterator iter=matches.front().begin()+tmp.length(); iter < matches.front().end(); iter++, i++) {
|
for(string::iterator iter=matches.front().begin()+tmp.length(); iter < matches.front().end(); iter++, i++) {
|
||||||
for(vector<string>::iterator it=matches.begin(); it < matches.end();it++) {
|
for(vector<string>::iterator it=matches.begin(); it < matches.end();++it) {
|
||||||
if( tolower((*it)[i]) != tolower(*iter) ) {
|
if( tolower((*it)[i]) != tolower(*iter) ) {
|
||||||
/* Append the longest match to the end of the output string*/
|
/* Append the longest match to the end of the output string*/
|
||||||
output.append(matches.front().substr( 0, i));
|
output.append(matches.front().substr( 0, i));
|
||||||
|
@ -375,4 +376,19 @@ namespace MWGui
|
||||||
{
|
{
|
||||||
setCoord(10,10, width-10, height/2);
|
setCoord(10,10, width-10, height/2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Console::setSelectedObject(const MWWorld::Ptr& object)
|
||||||
|
{
|
||||||
|
mPtr = object;
|
||||||
|
if (!mPtr.isEmpty())
|
||||||
|
setTitle("#{sConsoleTitle} (" + mPtr.getCellRef().refID + ")");
|
||||||
|
else
|
||||||
|
setTitle("#{sConsoleTitle}");
|
||||||
|
MyGUI::InputManager::getInstance().setKeyFocusWidget(command);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Console::onReferenceUnavailable()
|
||||||
|
{
|
||||||
|
setSelectedObject(MWWorld::Ptr());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,9 +16,11 @@
|
||||||
#include "../mwscript/compilercontext.hpp"
|
#include "../mwscript/compilercontext.hpp"
|
||||||
#include "../mwscript/interpretercontext.hpp"
|
#include "../mwscript/interpretercontext.hpp"
|
||||||
|
|
||||||
|
#include "referenceinterface.hpp"
|
||||||
|
|
||||||
namespace MWGui
|
namespace MWGui
|
||||||
{
|
{
|
||||||
class Console : private OEngine::GUI::Layout, private Compiler::ErrorHandler
|
class Console : private OEngine::GUI::Layout, private Compiler::ErrorHandler, public ReferenceInterface
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
@ -39,7 +41,17 @@ namespace MWGui
|
||||||
/// \note The list may contain duplicates (if a name is a keyword and an identifier at the same
|
/// \note The list may contain duplicates (if a name is a keyword and an identifier at the same
|
||||||
/// time).
|
/// time).
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
void setSelectedObject(const MWWorld::Ptr& object);
|
||||||
|
///< Set the implicit object for script execution
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
virtual void onReferenceUnavailable();
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
MyGUI::EditPtr command;
|
MyGUI::EditPtr command;
|
||||||
MyGUI::EditPtr history;
|
MyGUI::EditPtr history;
|
||||||
|
|
||||||
|
|
|
@ -361,9 +361,6 @@ void ContainerBase::drawItems()
|
||||||
int y = 0;
|
int y = 0;
|
||||||
int maxHeight = mItemView->getSize().height - 58;
|
int maxHeight = mItemView->getSize().height - 58;
|
||||||
|
|
||||||
int index = 0;
|
|
||||||
|
|
||||||
|
|
||||||
bool onlyMagic = false;
|
bool onlyMagic = false;
|
||||||
int categories;
|
int categories;
|
||||||
if (mFilter == Filter_All)
|
if (mFilter == Filter_All)
|
||||||
|
@ -384,7 +381,7 @@ void ContainerBase::drawItems()
|
||||||
categories = MWWorld::ContainerStore::Type_Miscellaneous + MWWorld::ContainerStore::Type_Book
|
categories = MWWorld::ContainerStore::Type_Miscellaneous + MWWorld::ContainerStore::Type_Book
|
||||||
+ MWWorld::ContainerStore::Type_Ingredient + MWWorld::ContainerStore::Type_Repair
|
+ MWWorld::ContainerStore::Type_Ingredient + MWWorld::ContainerStore::Type_Repair
|
||||||
+ MWWorld::ContainerStore::Type_Lockpick + MWWorld::ContainerStore::Type_Light
|
+ MWWorld::ContainerStore::Type_Lockpick + MWWorld::ContainerStore::Type_Light
|
||||||
+ MWWorld::ContainerStore::Type_Apparatus;
|
+ MWWorld::ContainerStore::Type_Apparatus + MWWorld::ContainerStore::Type_Probe;
|
||||||
}
|
}
|
||||||
else if (mFilter == Filter_Ingredients)
|
else if (mFilter == Filter_Ingredients)
|
||||||
categories = MWWorld::ContainerStore::Type_Ingredient;
|
categories = MWWorld::ContainerStore::Type_Ingredient;
|
||||||
|
@ -459,7 +456,6 @@ void ContainerBase::drawItems()
|
||||||
for (std::vector< std::pair<MWWorld::Ptr, ItemState> >::const_iterator it=items.begin();
|
for (std::vector< std::pair<MWWorld::Ptr, ItemState> >::const_iterator it=items.begin();
|
||||||
it != items.end(); ++it)
|
it != items.end(); ++it)
|
||||||
{
|
{
|
||||||
index++;
|
|
||||||
const MWWorld::Ptr* iter = &((*it).first);
|
const MWWorld::Ptr* iter = &((*it).first);
|
||||||
|
|
||||||
int displayCount = iter->getRefData().getCount();
|
int displayCount = iter->getRefData().getCount();
|
||||||
|
@ -470,7 +466,7 @@ void ContainerBase::drawItems()
|
||||||
if(displayCount > 0 && !(onlyMagic && it->second != ItemState_Barter && MWWorld::Class::get(*iter).getEnchantment(*iter) == "" && iter->getTypeName() != typeid(ESM::Potion).name()))
|
if(displayCount > 0 && !(onlyMagic && it->second != ItemState_Barter && MWWorld::Class::get(*iter).getEnchantment(*iter) == "" && iter->getTypeName() != typeid(ESM::Potion).name()))
|
||||||
{
|
{
|
||||||
std::string path = std::string("icons\\");
|
std::string path = std::string("icons\\");
|
||||||
path+=MWWorld::Class::get(*iter).getInventoryIcon(*iter);
|
path += MWWorld::Class::get(*iter).getInventoryIcon(*iter);
|
||||||
|
|
||||||
// background widget (for the "equipped" frame and magic item background image)
|
// background widget (for the "equipped" frame and magic item background image)
|
||||||
bool isMagic = (MWWorld::Class::get(*iter).getEnchantment(*iter) != "");
|
bool isMagic = (MWWorld::Class::get(*iter).getEnchantment(*iter) != "");
|
||||||
|
|
|
@ -140,7 +140,6 @@ void DialogueWindow::startDialogue(MWWorld::Ptr actor, std::string npcName)
|
||||||
setTitle(npcName);
|
setTitle(npcName);
|
||||||
|
|
||||||
topicsList->clear();
|
topicsList->clear();
|
||||||
pTopicsText.clear();
|
|
||||||
history->eraseText(0,history->getTextLength());
|
history->eraseText(0,history->getTextLength());
|
||||||
updateOptions();
|
updateOptions();
|
||||||
}
|
}
|
||||||
|
@ -157,7 +156,7 @@ void DialogueWindow::setKeywords(std::list<std::string> keyWords)
|
||||||
if (anyService)
|
if (anyService)
|
||||||
topicsList->addSeparator();
|
topicsList->addSeparator();
|
||||||
|
|
||||||
for(std::list<std::string>::iterator it = keyWords.begin(); it != keyWords.end(); it++)
|
for(std::list<std::string>::iterator it = keyWords.begin(); it != keyWords.end(); ++it)
|
||||||
{
|
{
|
||||||
topicsList->addItem(*it);
|
topicsList->addItem(*it);
|
||||||
}
|
}
|
||||||
|
@ -169,7 +168,6 @@ void DialogueWindow::removeKeyword(std::string keyWord)
|
||||||
if(topicsList->hasItem(keyWord))
|
if(topicsList->hasItem(keyWord))
|
||||||
{
|
{
|
||||||
topicsList->removeItem(keyWord);
|
topicsList->removeItem(keyWord);
|
||||||
pTopicsText.erase(keyWord);
|
|
||||||
}
|
}
|
||||||
topicsList->adjustSize();
|
topicsList->adjustSize();
|
||||||
}
|
}
|
||||||
|
@ -245,7 +243,6 @@ void DialogueWindow::updateOptions()
|
||||||
{
|
{
|
||||||
//Clear the list of topics
|
//Clear the list of topics
|
||||||
topicsList->clear();
|
topicsList->clear();
|
||||||
pTopicsText.clear();
|
|
||||||
history->eraseText(0,history->getTextLength());
|
history->eraseText(0,history->getTextLength());
|
||||||
|
|
||||||
pDispositionBar->setProgressRange(100);
|
pDispositionBar->setProgressRange(100);
|
||||||
|
|
|
@ -77,7 +77,6 @@ namespace MWGui
|
||||||
Widgets::MWList* topicsList;
|
Widgets::MWList* topicsList;
|
||||||
MyGUI::ProgressPtr pDispositionBar;
|
MyGUI::ProgressPtr pDispositionBar;
|
||||||
MyGUI::EditPtr pDispositionText;
|
MyGUI::EditPtr pDispositionText;
|
||||||
std::map<std::string,std::string> pTopicsText;// this map links keyword and "real" text.
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -12,8 +12,10 @@
|
||||||
#include "../mwworld/world.hpp"
|
#include "../mwworld/world.hpp"
|
||||||
#include "../mwworld/player.hpp"
|
#include "../mwworld/player.hpp"
|
||||||
|
|
||||||
|
#include "inventorywindow.hpp"
|
||||||
#include "window_manager.hpp"
|
#include "window_manager.hpp"
|
||||||
#include "container.hpp"
|
#include "container.hpp"
|
||||||
|
#include "console.hpp"
|
||||||
|
|
||||||
using namespace MWGui;
|
using namespace MWGui;
|
||||||
|
|
||||||
|
@ -46,6 +48,7 @@ HUD::HUD(int width, int height, int fpsLevel, DragAndDrop* dragAndDrop)
|
||||||
, mMapVisible(true)
|
, mMapVisible(true)
|
||||||
, mWeaponVisible(true)
|
, mWeaponVisible(true)
|
||||||
, mSpellVisible(true)
|
, mSpellVisible(true)
|
||||||
|
, mWorldMouseOver(false)
|
||||||
{
|
{
|
||||||
setCoord(0,0, width, height);
|
setCoord(0,0, width, height);
|
||||||
|
|
||||||
|
@ -264,6 +267,33 @@ void HUD::onWorldClicked(MyGUI::Widget* _sender)
|
||||||
mDragAndDrop->mDraggedWidget = 0;
|
mDragAndDrop->mDraggedWidget = 0;
|
||||||
|
|
||||||
MWBase::Environment::get().getWindowManager()->setDragDrop(false);
|
MWBase::Environment::get().getWindowManager()->setDragDrop(false);
|
||||||
|
MWBase::Environment::get().getWindowManager()->getInventoryWindow()->drawItems();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
GuiMode mode = MWBase::Environment::get().getWindowManager()->getMode();
|
||||||
|
|
||||||
|
if ( (mode != GM_Console) && (mode != GM_Container) && (mode != GM_Inventory) )
|
||||||
|
return;
|
||||||
|
|
||||||
|
std::string handle = MWBase::Environment::get().getWorld()->getFacedHandle();
|
||||||
|
MWWorld::Ptr object;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
object = MWBase::Environment::get().getWorld()->getPtrViaHandle(handle);
|
||||||
|
}
|
||||||
|
catch (std::exception& e)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mode == GM_Console)
|
||||||
|
MWBase::Environment::get().getWindowManager()->getConsole()->setSelectedObject(object);
|
||||||
|
else if ((mode == GM_Container) || (mode == GM_Inventory))
|
||||||
|
{
|
||||||
|
// pick up object
|
||||||
|
MWBase::Environment::get().getWindowManager()->getInventoryWindow()->pickUpObject(object);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -271,6 +301,8 @@ void HUD::onWorldMouseOver(MyGUI::Widget* _sender, int x, int y)
|
||||||
{
|
{
|
||||||
if (mDragAndDrop->mIsOnDragAndDrop)
|
if (mDragAndDrop->mIsOnDragAndDrop)
|
||||||
{
|
{
|
||||||
|
mWorldMouseOver = false;
|
||||||
|
|
||||||
MyGUI::IntSize viewSize = MyGUI::RenderManager::getInstance().getViewSize();
|
MyGUI::IntSize viewSize = MyGUI::RenderManager::getInstance().getViewSize();
|
||||||
MyGUI::IntPoint cursorPosition = MyGUI::InputManager::getInstance().getMousePosition();
|
MyGUI::IntPoint cursorPosition = MyGUI::InputManager::getInstance().getMousePosition();
|
||||||
float mouseX = cursorPosition.left / float(viewSize.width);
|
float mouseX = cursorPosition.left / float(viewSize.width);
|
||||||
|
@ -290,13 +322,14 @@ void HUD::onWorldMouseOver(MyGUI::Widget* _sender, int x, int y)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
MyGUI::PointerManager::getInstance().setPointer("arrow");
|
MyGUI::PointerManager::getInstance().setPointer("arrow");
|
||||||
/// \todo make it possible to pick up objects with the mouse, if inventory or container window is open
|
mWorldMouseOver = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void HUD::onWorldMouseLostFocus(MyGUI::Widget* _sender, MyGUI::Widget* _new)
|
void HUD::onWorldMouseLostFocus(MyGUI::Widget* _sender, MyGUI::Widget* _new)
|
||||||
{
|
{
|
||||||
MyGUI::PointerManager::getInstance().setPointer("arrow");
|
MyGUI::PointerManager::getInstance().setPointer("arrow");
|
||||||
|
mWorldMouseOver = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void HUD::onHMSClicked(MyGUI::Widget* _sender)
|
void HUD::onHMSClicked(MyGUI::Widget* _sender)
|
||||||
|
|
|
@ -33,6 +33,8 @@ namespace MWGui
|
||||||
|
|
||||||
void setCellName(const std::string& cellName);
|
void setCellName(const std::string& cellName);
|
||||||
|
|
||||||
|
bool getWorldMouseOver() { return mWorldMouseOver; }
|
||||||
|
|
||||||
MyGUI::ProgressPtr health, magicka, stamina;
|
MyGUI::ProgressPtr health, magicka, stamina;
|
||||||
MyGUI::Widget* mHealthFrame;
|
MyGUI::Widget* mHealthFrame;
|
||||||
MyGUI::Widget *weapBox, *spellBox;
|
MyGUI::Widget *weapBox, *spellBox;
|
||||||
|
@ -70,6 +72,8 @@ namespace MWGui
|
||||||
bool mWeaponVisible;
|
bool mWeaponVisible;
|
||||||
bool mSpellVisible;
|
bool mSpellVisible;
|
||||||
|
|
||||||
|
bool mWorldMouseOver;
|
||||||
|
|
||||||
void onWorldClicked(MyGUI::Widget* _sender);
|
void onWorldClicked(MyGUI::Widget* _sender);
|
||||||
void onWorldMouseOver(MyGUI::Widget* _sender, int x, int y);
|
void onWorldMouseOver(MyGUI::Widget* _sender, int x, int y);
|
||||||
void onWorldMouseLostFocus(MyGUI::Widget* _sender, MyGUI::Widget* _new);
|
void onWorldMouseLostFocus(MyGUI::Widget* _sender, MyGUI::Widget* _new);
|
||||||
|
|
|
@ -15,6 +15,8 @@
|
||||||
#include "../mwworld/player.hpp"
|
#include "../mwworld/player.hpp"
|
||||||
#include "../mwbase/environment.hpp"
|
#include "../mwbase/environment.hpp"
|
||||||
#include "../mwworld/manualref.hpp"
|
#include "../mwworld/manualref.hpp"
|
||||||
|
#include "../mwworld/actiontake.hpp"
|
||||||
|
#include "../mwsound/soundmanager.hpp"
|
||||||
|
|
||||||
#include "window_manager.hpp"
|
#include "window_manager.hpp"
|
||||||
#include "widgets.hpp"
|
#include "widgets.hpp"
|
||||||
|
@ -276,13 +278,72 @@ namespace MWGui
|
||||||
if (mWindowManager.getSpellWindow())
|
if (mWindowManager.getSpellWindow())
|
||||||
mWindowManager.getSpellWindow()->updateSpells();
|
mWindowManager.getSpellWindow()->updateSpells();
|
||||||
|
|
||||||
// update selected weapon icon
|
// update selected weapon icon
|
||||||
MWWorld::InventoryStore& invStore = MWWorld::Class::get(mPtr).getInventoryStore(mPtr);
|
MWWorld::InventoryStore& invStore = MWWorld::Class::get(mPtr).getInventoryStore(mPtr);
|
||||||
MWWorld::ContainerStoreIterator weaponSlot = invStore.getSlot(MWWorld::InventoryStore::Slot_CarriedRight);
|
MWWorld::ContainerStoreIterator weaponSlot = invStore.getSlot(MWWorld::InventoryStore::Slot_CarriedRight);
|
||||||
if (weaponSlot == invStore.end())
|
if (weaponSlot == invStore.end())
|
||||||
mWindowManager.unsetSelectedWeapon();
|
mWindowManager.unsetSelectedWeapon();
|
||||||
else
|
else
|
||||||
mWindowManager.setSelectedWeapon(*weaponSlot, 100); /// \todo track weapon durability
|
mWindowManager.setSelectedWeapon(*weaponSlot, 100); /// \todo track weapon durability
|
||||||
|
}
|
||||||
|
|
||||||
|
void InventoryWindow::pickUpObject (MWWorld::Ptr object)
|
||||||
|
{
|
||||||
|
/// \todo scripts
|
||||||
|
|
||||||
|
// make sure the object is of a type that can be picked up
|
||||||
|
std::string type = object.getTypeName();
|
||||||
|
if ( (type != typeid(ESM::Apparatus).name())
|
||||||
|
&& (type != typeid(ESM::Armor).name())
|
||||||
|
&& (type != typeid(ESM::Book).name())
|
||||||
|
&& (type != typeid(ESM::Clothing).name())
|
||||||
|
&& (type != typeid(ESM::Ingredient).name())
|
||||||
|
&& (type != typeid(ESM::Light).name())
|
||||||
|
&& (type != typeid(ESM::Miscellaneous).name())
|
||||||
|
&& (type != typeid(ESM::Tool).name())
|
||||||
|
&& (type != typeid(ESM::Probe).name())
|
||||||
|
&& (type != typeid(ESM::Repair).name())
|
||||||
|
&& (type != typeid(ESM::Weapon).name())
|
||||||
|
&& (type != typeid(ESM::Potion).name()))
|
||||||
|
return;
|
||||||
|
|
||||||
|
// sound
|
||||||
|
std::string sound = MWWorld::Class::get(object).getUpSoundId(object);
|
||||||
|
MWBase::Environment::get().getSoundManager()->playSound(sound, 1, 1);
|
||||||
|
|
||||||
|
int count = object.getRefData().getCount();
|
||||||
|
|
||||||
|
// add to player inventory
|
||||||
|
// can't use ActionTake here because we need an MWWorld::Ptr to the newly inserted object
|
||||||
|
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer();
|
||||||
|
MWWorld::Ptr newObject = *MWWorld::Class::get (player).getContainerStore (player).add (object);
|
||||||
|
// remove from world
|
||||||
|
MWBase::Environment::get().getWorld()->deleteObject (object);
|
||||||
|
|
||||||
|
mDragAndDrop->mIsOnDragAndDrop = true;
|
||||||
|
mDragAndDrop->mDraggedCount = count;
|
||||||
|
|
||||||
|
std::string path = std::string("icons\\");
|
||||||
|
path += MWWorld::Class::get(newObject).getInventoryIcon(newObject);
|
||||||
|
MyGUI::ImageBox* baseWidget = mContainerWidget->createWidget<ImageBox>("ImageBox", MyGUI::IntCoord(0, 0, 42, 42), MyGUI::Align::Default);
|
||||||
|
baseWidget->detachFromWidget();
|
||||||
|
baseWidget->attachToWidget(mDragAndDrop->mDragAndDropWidget);
|
||||||
|
baseWidget->setUserData(newObject);
|
||||||
|
mDragAndDrop->mDraggedWidget = baseWidget;
|
||||||
|
ImageBox* image = baseWidget->createWidget<ImageBox>("ImageBox", MyGUI::IntCoord(5, 5, 32, 32), MyGUI::Align::Default);
|
||||||
|
int pos = path.rfind(".");
|
||||||
|
path.erase(pos);
|
||||||
|
path.append(".dds");
|
||||||
|
image->setImageTexture(path);
|
||||||
|
image->setNeedMouseFocus(false);
|
||||||
|
|
||||||
|
// text widget that shows item count
|
||||||
|
MyGUI::TextBox* text = image->createWidget<MyGUI::TextBox>("SandBrightText", MyGUI::IntCoord(0, 14, 32, 18), MyGUI::Align::Default, std::string("Label"));
|
||||||
|
text->setTextAlign(MyGUI::Align::Right);
|
||||||
|
text->setNeedMouseFocus(false);
|
||||||
|
text->setTextShadow(true);
|
||||||
|
text->setTextShadowColour(MyGUI::Colour(0,0,0));
|
||||||
|
text->setCaption(getCountString(count));
|
||||||
|
mDragAndDrop->mDraggedFrom = this;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,6 +18,8 @@ namespace MWGui
|
||||||
|
|
||||||
void onFrame();
|
void onFrame();
|
||||||
|
|
||||||
|
void pickUpObject (MWWorld::Ptr object);
|
||||||
|
|
||||||
int getPlayerGold();
|
int getPlayerGold();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
|
@ -131,7 +131,7 @@ void MWGui::JournalWindow::open()
|
||||||
book journal;
|
book journal;
|
||||||
journal.endLine = 0;
|
journal.endLine = 0;
|
||||||
|
|
||||||
for(std::deque<MWDialogue::StampedJournalEntry>::const_iterator it = MWBase::Environment::get().getJournal()->begin();it!=MWBase::Environment::get().getJournal()->end();it++)
|
for(std::deque<MWDialogue::StampedJournalEntry>::const_iterator it = MWBase::Environment::get().getJournal()->begin();it!=MWBase::Environment::get().getJournal()->end();++it)
|
||||||
{
|
{
|
||||||
std::string a = it->getText(MWBase::Environment::get().getWorld()->getStore());
|
std::string a = it->getText(MWBase::Environment::get().getWorld()->getStore());
|
||||||
journal = formatText(a,journal,10,17);
|
journal = formatText(a,journal,10,17);
|
||||||
|
@ -141,7 +141,7 @@ void MWGui::JournalWindow::open()
|
||||||
//std::string a = MWBase::Environment::get().getJournal()->begin()->getText(MWBase::Environment::get().getWorld()->getStore());
|
//std::string a = MWBase::Environment::get().getJournal()->begin()->getText(MWBase::Environment::get().getWorld()->getStore());
|
||||||
//std::list<std::string> journal = formatText(a,10,20,1);
|
//std::list<std::string> journal = formatText(a,10,20,1);
|
||||||
bool left = true;
|
bool left = true;
|
||||||
for(std::list<std::string>::iterator it = journal.pages.begin(); it != journal.pages.end();it++)
|
for(std::list<std::string>::iterator it = journal.pages.begin(); it != journal.pages.end();++it)
|
||||||
{
|
{
|
||||||
if(left)
|
if(left)
|
||||||
{
|
{
|
||||||
|
|
|
@ -257,7 +257,7 @@ void ReviewDialog::addGroup(const std::string &label, MyGUI::IntCoord &coord1, M
|
||||||
coord2.top += lineHeight;
|
coord2.top += lineHeight;
|
||||||
}
|
}
|
||||||
|
|
||||||
MyGUI::TextBox* ReviewDialog::addValueItem(const std::string text, const std::string &value, const std::string& state, MyGUI::IntCoord &coord1, MyGUI::IntCoord &coord2)
|
MyGUI::TextBox* ReviewDialog::addValueItem(const std::string& text, const std::string &value, const std::string& state, MyGUI::IntCoord &coord1, MyGUI::IntCoord &coord2)
|
||||||
{
|
{
|
||||||
MyGUI::TextBox* skillNameWidget;
|
MyGUI::TextBox* skillNameWidget;
|
||||||
MyGUI::TextBox* skillValueWidget;
|
MyGUI::TextBox* skillValueWidget;
|
||||||
|
@ -280,7 +280,7 @@ MyGUI::TextBox* ReviewDialog::addValueItem(const std::string text, const std::st
|
||||||
return skillValueWidget;
|
return skillValueWidget;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ReviewDialog::addItem(const std::string text, MyGUI::IntCoord &coord1, MyGUI::IntCoord &coord2)
|
void ReviewDialog::addItem(const std::string& text, MyGUI::IntCoord &coord1, MyGUI::IntCoord &coord2)
|
||||||
{
|
{
|
||||||
MyGUI::TextBox* skillNameWidget;
|
MyGUI::TextBox* skillNameWidget;
|
||||||
|
|
||||||
|
|
|
@ -74,8 +74,8 @@ namespace MWGui
|
||||||
void addSkills(const SkillList &skills, const std::string &titleId, const std::string &titleDefault, MyGUI::IntCoord &coord1, MyGUI::IntCoord &coord2);
|
void addSkills(const SkillList &skills, const std::string &titleId, const std::string &titleDefault, MyGUI::IntCoord &coord1, MyGUI::IntCoord &coord2);
|
||||||
void addSeparator(MyGUI::IntCoord &coord1, MyGUI::IntCoord &coord2);
|
void addSeparator(MyGUI::IntCoord &coord1, MyGUI::IntCoord &coord2);
|
||||||
void addGroup(const std::string &label, MyGUI::IntCoord &coord1, MyGUI::IntCoord &coord2);
|
void addGroup(const std::string &label, MyGUI::IntCoord &coord1, MyGUI::IntCoord &coord2);
|
||||||
MyGUI::TextBox* addValueItem(const std::string text, const std::string &value, const std::string& state, MyGUI::IntCoord &coord1, MyGUI::IntCoord &coord2);
|
MyGUI::TextBox* addValueItem(const std::string& text, const std::string &value, const std::string& state, MyGUI::IntCoord &coord1, MyGUI::IntCoord &coord2);
|
||||||
void addItem(const std::string text, MyGUI::IntCoord &coord1, MyGUI::IntCoord &coord2);
|
void addItem(const std::string& text, MyGUI::IntCoord &coord1, MyGUI::IntCoord &coord2);
|
||||||
void updateScroller();
|
void updateScroller();
|
||||||
void updateSkillArea();
|
void updateSkillArea();
|
||||||
|
|
||||||
|
|
|
@ -89,6 +89,16 @@ namespace MWGui
|
||||||
|
|
||||||
bool allowSelectedItem = true;
|
bool allowSelectedItem = true;
|
||||||
|
|
||||||
|
// make sure that the item is still in the player inventory, otherwise it can't be selected
|
||||||
|
bool found = false;
|
||||||
|
for (MWWorld::ContainerStoreIterator it(store.begin()); it != store.end(); ++it)
|
||||||
|
{
|
||||||
|
if (*it == selectedItem)
|
||||||
|
found = true;
|
||||||
|
}
|
||||||
|
if (!found)
|
||||||
|
allowSelectedItem = false;
|
||||||
|
|
||||||
// if the selected item can be equipped, make sure that it actually is equipped
|
// if the selected item can be equipped, make sure that it actually is equipped
|
||||||
std::pair<std::vector<int>, bool> slots;
|
std::pair<std::vector<int>, bool> slots;
|
||||||
slots = MWWorld::Class::get(selectedItem).getEquipmentSlots(selectedItem);
|
slots = MWWorld::Class::get(selectedItem).getEquipmentSlots(selectedItem);
|
||||||
|
|
|
@ -340,7 +340,7 @@ MyGUI::TextBox* StatsWindow::addValueItem(const std::string& text, const std::st
|
||||||
return skillValueWidget;
|
return skillValueWidget;
|
||||||
}
|
}
|
||||||
|
|
||||||
MyGUI::Widget* StatsWindow::addItem(const std::string text, MyGUI::IntCoord &coord1, MyGUI::IntCoord &coord2)
|
MyGUI::Widget* StatsWindow::addItem(const std::string& text, MyGUI::IntCoord &coord1, MyGUI::IntCoord &coord2)
|
||||||
{
|
{
|
||||||
MyGUI::TextBox* skillNameWidget;
|
MyGUI::TextBox* skillNameWidget;
|
||||||
|
|
||||||
|
|
|
@ -47,7 +47,7 @@ namespace MWGui
|
||||||
void addSeparator(MyGUI::IntCoord &coord1, MyGUI::IntCoord &coord2);
|
void addSeparator(MyGUI::IntCoord &coord1, MyGUI::IntCoord &coord2);
|
||||||
void addGroup(const std::string &label, MyGUI::IntCoord &coord1, MyGUI::IntCoord &coord2);
|
void addGroup(const std::string &label, MyGUI::IntCoord &coord1, MyGUI::IntCoord &coord2);
|
||||||
MyGUI::TextBox* addValueItem(const std::string& text, const std::string &value, const std::string& state, MyGUI::IntCoord &coord1, MyGUI::IntCoord &coord2);
|
MyGUI::TextBox* addValueItem(const std::string& text, const std::string &value, const std::string& state, MyGUI::IntCoord &coord1, MyGUI::IntCoord &coord2);
|
||||||
MyGUI::Widget* addItem(const std::string text, MyGUI::IntCoord &coord1, MyGUI::IntCoord &coord2);
|
MyGUI::Widget* addItem(const std::string& text, MyGUI::IntCoord &coord1, MyGUI::IntCoord &coord2);
|
||||||
void updateScroller();
|
void updateScroller();
|
||||||
|
|
||||||
void setFactions (const FactionList& factions);
|
void setFactions (const FactionList& factions);
|
||||||
|
|
|
@ -67,158 +67,192 @@ void ToolTips::onFrame(float frameDuration)
|
||||||
if (!mGameMode)
|
if (!mGameMode)
|
||||||
{
|
{
|
||||||
const MyGUI::IntPoint& mousePos = InputManager::getInstance().getMousePosition();
|
const MyGUI::IntPoint& mousePos = InputManager::getInstance().getMousePosition();
|
||||||
const MyGUI::IntPoint& lastPressed = InputManager::getInstance().getLastPressedPosition(MyGUI::MouseButton::Left);
|
|
||||||
|
|
||||||
if (mousePos == lastPressed) // mouseclick makes tooltip disappear
|
if (mWindowManager->getWorldMouseOver() && ((mWindowManager->getMode() == GM_Console)
|
||||||
return;
|
|| (mWindowManager->getMode() == GM_Container)
|
||||||
|
|| (mWindowManager->getMode() == GM_Inventory)))
|
||||||
if (mousePos.left == mLastMouseX && mousePos.top == mLastMouseY)
|
|
||||||
{
|
{
|
||||||
mRemainingDelay -= frameDuration;
|
std::string handle = MWBase::Environment::get().getWorld()->getFacedHandle();
|
||||||
|
try
|
||||||
|
{
|
||||||
|
mFocusObject = MWBase::Environment::get().getWorld()->getPtrViaHandle(handle);
|
||||||
|
}
|
||||||
|
catch (std::exception& e)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
MyGUI::IntSize tooltipSize = getToolTipViaPtr(true);
|
||||||
|
|
||||||
|
IntPoint tooltipPosition = InputManager::getInstance().getMousePosition() + IntPoint(0, 24);
|
||||||
|
|
||||||
|
// make the tooltip stay completely in the viewport
|
||||||
|
if ((tooltipPosition.left + tooltipSize.width) > viewSize.width)
|
||||||
|
{
|
||||||
|
tooltipPosition.left = viewSize.width - tooltipSize.width;
|
||||||
|
}
|
||||||
|
if ((tooltipPosition.top + tooltipSize.height) > viewSize.height)
|
||||||
|
{
|
||||||
|
tooltipPosition.top = viewSize.height - tooltipSize.height;
|
||||||
|
}
|
||||||
|
|
||||||
|
setCoord(tooltipPosition.left, tooltipPosition.top, tooltipSize.width, tooltipSize.height);
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
mRemainingDelay = mDelay;
|
const MyGUI::IntPoint& lastPressed = InputManager::getInstance().getLastPressedPosition(MyGUI::MouseButton::Left);
|
||||||
}
|
|
||||||
mLastMouseX = mousePos.left;
|
|
||||||
mLastMouseY = mousePos.top;
|
|
||||||
|
|
||||||
if (mRemainingDelay > 0)
|
if (mousePos == lastPressed) // mouseclick makes tooltip disappear
|
||||||
return;
|
|
||||||
|
|
||||||
Widget* focus = InputManager::getInstance().getMouseFocusWidget();
|
|
||||||
if (focus == 0)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
IntSize tooltipSize;
|
|
||||||
|
|
||||||
// try to go 1 level up until there is a widget that has tooltip
|
|
||||||
// this is necessary because some skin elements are actually separate widgets
|
|
||||||
int i=0;
|
|
||||||
while (!focus->isUserString("ToolTipType"))
|
|
||||||
{
|
|
||||||
focus = focus->getParent();
|
|
||||||
if (!focus)
|
|
||||||
return;
|
return;
|
||||||
++i;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string type = focus->getUserString("ToolTipType");
|
if (mousePos.left == mLastMouseX && mousePos.top == mLastMouseY)
|
||||||
std::string text = focus->getUserString("ToolTipText");
|
|
||||||
|
|
||||||
ToolTipInfo info;
|
|
||||||
if (type == "")
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
else if (type == "ItemPtr")
|
|
||||||
{
|
|
||||||
mFocusObject = *focus->getUserData<MWWorld::Ptr>();
|
|
||||||
tooltipSize = getToolTipViaPtr(false);
|
|
||||||
}
|
|
||||||
else if (type == "Spell")
|
|
||||||
{
|
|
||||||
ToolTipInfo info;
|
|
||||||
const ESM::Spell *spell = MWBase::Environment::get().getWorld()->getStore().spells.find(focus->getUserString("Spell"));
|
|
||||||
info.caption = spell->name;
|
|
||||||
Widgets::SpellEffectList effects;
|
|
||||||
std::vector<ESM::ENAMstruct>::const_iterator end = spell->effects.list.end();
|
|
||||||
for (std::vector<ESM::ENAMstruct>::const_iterator it = spell->effects.list.begin(); it != end; ++it)
|
|
||||||
{
|
{
|
||||||
Widgets::SpellEffectParams params;
|
mRemainingDelay -= frameDuration;
|
||||||
params.mEffectID = it->effectID;
|
|
||||||
params.mSkill = it->skill;
|
|
||||||
params.mAttribute = it->attribute;
|
|
||||||
params.mDuration = it->duration;
|
|
||||||
params.mMagnMin = it->magnMin;
|
|
||||||
params.mMagnMax = it->magnMax;
|
|
||||||
params.mRange = it->range;
|
|
||||||
params.mIsConstant = (spell->data.type == ESM::Spell::ST_Ability);
|
|
||||||
effects.push_back(params);
|
|
||||||
}
|
|
||||||
info.effects = effects;
|
|
||||||
tooltipSize = createToolTip(info);
|
|
||||||
}
|
|
||||||
else if (type == "Layout")
|
|
||||||
{
|
|
||||||
// tooltip defined in the layout
|
|
||||||
MyGUI::Widget* tooltip;
|
|
||||||
getWidget(tooltip, focus->getUserString("ToolTipLayout"));
|
|
||||||
|
|
||||||
tooltip->setVisible(true);
|
|
||||||
if (!tooltip->isUserString("DontResize"))
|
|
||||||
{
|
|
||||||
tooltip->setCoord(0, 0, 450, 300); // this is the maximum width of the tooltip before it starts word-wrapping
|
|
||||||
|
|
||||||
tooltipSize = MyGUI::IntSize(0, tooltip->getSize().height);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
tooltipSize = tooltip->getSize();
|
|
||||||
|
|
||||||
std::map<std::string, std::string> userStrings = focus->getUserStrings();
|
|
||||||
for (std::map<std::string, std::string>::iterator it = userStrings.begin();
|
|
||||||
it != userStrings.end(); ++it)
|
|
||||||
{
|
{
|
||||||
if (it->first == "ToolTipType"
|
mRemainingDelay = mDelay;
|
||||||
|| it->first == "ToolTipLayout")
|
}
|
||||||
continue;
|
mLastMouseX = mousePos.left;
|
||||||
|
mLastMouseY = mousePos.top;
|
||||||
|
|
||||||
|
if (mRemainingDelay > 0)
|
||||||
|
return;
|
||||||
|
|
||||||
size_t underscorePos = it->first.find("_");
|
Widget* focus = InputManager::getInstance().getMouseFocusWidget();
|
||||||
std::string propertyKey = it->first.substr(0, underscorePos);
|
if (focus == 0)
|
||||||
std::string widgetName = it->first.substr(underscorePos+1, it->first.size()-(underscorePos+1));
|
{
|
||||||
|
return;
|
||||||
MyGUI::Widget* w;
|
|
||||||
getWidget(w, widgetName);
|
|
||||||
w->setProperty(propertyKey, it->second);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (unsigned int i=0; i<tooltip->getChildCount(); ++i)
|
IntSize tooltipSize;
|
||||||
|
|
||||||
|
// try to go 1 level up until there is a widget that has tooltip
|
||||||
|
// this is necessary because some skin elements are actually separate widgets
|
||||||
|
int i=0;
|
||||||
|
while (!focus->isUserString("ToolTipType"))
|
||||||
{
|
{
|
||||||
MyGUI::Widget* w = tooltip->getChildAt(i);
|
focus = focus->getParent();
|
||||||
|
if (!focus)
|
||||||
if (w->isUserString("AutoResizeHorizontal"))
|
return;
|
||||||
{
|
++i;
|
||||||
MyGUI::TextBox* text = w->castType<MyGUI::TextBox>();
|
|
||||||
tooltipSize.width = std::max(tooltipSize.width, w->getLeft() + text->getTextSize().width + 8);
|
|
||||||
}
|
|
||||||
else if (!tooltip->isUserString("DontResize"))
|
|
||||||
tooltipSize.width = std::max(tooltipSize.width, w->getLeft() + w->getWidth() + 8);
|
|
||||||
|
|
||||||
if (w->isUserString("AutoResizeVertical"))
|
|
||||||
{
|
|
||||||
MyGUI::TextBox* text = w->castType<MyGUI::TextBox>();
|
|
||||||
int height = text->getTextSize().height;
|
|
||||||
if (height > w->getHeight())
|
|
||||||
{
|
|
||||||
tooltipSize += MyGUI::IntSize(0, height - w->getHeight());
|
|
||||||
}
|
|
||||||
if (height < w->getHeight())
|
|
||||||
{
|
|
||||||
tooltipSize -= MyGUI::IntSize(0, w->getHeight() - height);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
tooltip->setCoord(0, 0, tooltipSize.width, tooltipSize.height);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
throw std::runtime_error ("unknown tooltip type");
|
|
||||||
|
|
||||||
IntPoint tooltipPosition = InputManager::getInstance().getMousePosition() + IntPoint(0, 24);
|
std::string type = focus->getUserString("ToolTipType");
|
||||||
|
std::string text = focus->getUserString("ToolTipText");
|
||||||
|
|
||||||
// make the tooltip stay completely in the viewport
|
if (type == "")
|
||||||
if ((tooltipPosition.left + tooltipSize.width) > viewSize.width)
|
{
|
||||||
{
|
return;
|
||||||
tooltipPosition.left = viewSize.width - tooltipSize.width;
|
}
|
||||||
}
|
else if (type == "ItemPtr")
|
||||||
if ((tooltipPosition.top + tooltipSize.height) > viewSize.height)
|
{
|
||||||
{
|
mFocusObject = *focus->getUserData<MWWorld::Ptr>();
|
||||||
tooltipPosition.top = viewSize.height - tooltipSize.height;
|
tooltipSize = getToolTipViaPtr(false);
|
||||||
}
|
}
|
||||||
|
else if (type == "Spell")
|
||||||
|
{
|
||||||
|
ToolTipInfo info;
|
||||||
|
const ESM::Spell *spell = MWBase::Environment::get().getWorld()->getStore().spells.find(focus->getUserString("Spell"));
|
||||||
|
info.caption = spell->name;
|
||||||
|
Widgets::SpellEffectList effects;
|
||||||
|
std::vector<ESM::ENAMstruct>::const_iterator end = spell->effects.list.end();
|
||||||
|
for (std::vector<ESM::ENAMstruct>::const_iterator it = spell->effects.list.begin(); it != end; ++it)
|
||||||
|
{
|
||||||
|
Widgets::SpellEffectParams params;
|
||||||
|
params.mEffectID = it->effectID;
|
||||||
|
params.mSkill = it->skill;
|
||||||
|
params.mAttribute = it->attribute;
|
||||||
|
params.mDuration = it->duration;
|
||||||
|
params.mMagnMin = it->magnMin;
|
||||||
|
params.mMagnMax = it->magnMax;
|
||||||
|
params.mRange = it->range;
|
||||||
|
params.mIsConstant = (spell->data.type == ESM::Spell::ST_Ability);
|
||||||
|
effects.push_back(params);
|
||||||
|
}
|
||||||
|
info.effects = effects;
|
||||||
|
tooltipSize = createToolTip(info);
|
||||||
|
}
|
||||||
|
else if (type == "Layout")
|
||||||
|
{
|
||||||
|
// tooltip defined in the layout
|
||||||
|
MyGUI::Widget* tooltip;
|
||||||
|
getWidget(tooltip, focus->getUserString("ToolTipLayout"));
|
||||||
|
|
||||||
setCoord(tooltipPosition.left, tooltipPosition.top, tooltipSize.width, tooltipSize.height);
|
tooltip->setVisible(true);
|
||||||
|
if (!tooltip->isUserString("DontResize"))
|
||||||
|
{
|
||||||
|
tooltip->setCoord(0, 0, 450, 300); // this is the maximum width of the tooltip before it starts word-wrapping
|
||||||
|
|
||||||
|
tooltipSize = MyGUI::IntSize(0, tooltip->getSize().height);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
tooltipSize = tooltip->getSize();
|
||||||
|
|
||||||
|
std::map<std::string, std::string> userStrings = focus->getUserStrings();
|
||||||
|
for (std::map<std::string, std::string>::iterator it = userStrings.begin();
|
||||||
|
it != userStrings.end(); ++it)
|
||||||
|
{
|
||||||
|
if (it->first == "ToolTipType"
|
||||||
|
|| it->first == "ToolTipLayout")
|
||||||
|
continue;
|
||||||
|
|
||||||
|
|
||||||
|
size_t underscorePos = it->first.find("_");
|
||||||
|
std::string propertyKey = it->first.substr(0, underscorePos);
|
||||||
|
std::string widgetName = it->first.substr(underscorePos+1, it->first.size()-(underscorePos+1));
|
||||||
|
|
||||||
|
MyGUI::Widget* w;
|
||||||
|
getWidget(w, widgetName);
|
||||||
|
w->setProperty(propertyKey, it->second);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (unsigned int i=0; i<tooltip->getChildCount(); ++i)
|
||||||
|
{
|
||||||
|
MyGUI::Widget* w = tooltip->getChildAt(i);
|
||||||
|
|
||||||
|
if (w->isUserString("AutoResizeHorizontal"))
|
||||||
|
{
|
||||||
|
MyGUI::TextBox* text = w->castType<MyGUI::TextBox>();
|
||||||
|
tooltipSize.width = std::max(tooltipSize.width, w->getLeft() + text->getTextSize().width + 8);
|
||||||
|
}
|
||||||
|
else if (!tooltip->isUserString("DontResize"))
|
||||||
|
tooltipSize.width = std::max(tooltipSize.width, w->getLeft() + w->getWidth() + 8);
|
||||||
|
|
||||||
|
if (w->isUserString("AutoResizeVertical"))
|
||||||
|
{
|
||||||
|
MyGUI::TextBox* text = w->castType<MyGUI::TextBox>();
|
||||||
|
int height = text->getTextSize().height;
|
||||||
|
if (height > w->getHeight())
|
||||||
|
{
|
||||||
|
tooltipSize += MyGUI::IntSize(0, height - w->getHeight());
|
||||||
|
}
|
||||||
|
if (height < w->getHeight())
|
||||||
|
{
|
||||||
|
tooltipSize -= MyGUI::IntSize(0, w->getHeight() - height);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
tooltip->setCoord(0, 0, tooltipSize.width, tooltipSize.height);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
throw std::runtime_error ("unknown tooltip type");
|
||||||
|
|
||||||
|
IntPoint tooltipPosition = InputManager::getInstance().getMousePosition() + IntPoint(0, 24);
|
||||||
|
|
||||||
|
// make the tooltip stay completely in the viewport
|
||||||
|
if ((tooltipPosition.left + tooltipSize.width) > viewSize.width)
|
||||||
|
{
|
||||||
|
tooltipPosition.left = viewSize.width - tooltipSize.width;
|
||||||
|
}
|
||||||
|
if ((tooltipPosition.top + tooltipSize.height) > viewSize.height)
|
||||||
|
{
|
||||||
|
tooltipPosition.top = viewSize.height - tooltipSize.height;
|
||||||
|
}
|
||||||
|
|
||||||
|
setCoord(tooltipPosition.left, tooltipPosition.top, tooltipSize.width, tooltipSize.height);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -300,6 +300,8 @@ namespace MWGui
|
||||||
services = ref->base->AI.services;
|
services = ref->base->AI.services;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// \todo what about potions, there doesn't seem to be a flag for them??
|
||||||
|
|
||||||
if (item.getTypeName() == typeid(ESM::Weapon).name())
|
if (item.getTypeName() == typeid(ESM::Weapon).name())
|
||||||
return services & ESM::NPC::Weapon;
|
return services & ESM::NPC::Weapon;
|
||||||
else if (item.getTypeName() == typeid(ESM::Armor).name())
|
else if (item.getTypeName() == typeid(ESM::Armor).name())
|
||||||
|
|
|
@ -767,7 +767,7 @@ void MWDynamicStat::setValue(int cur, int max_)
|
||||||
static_cast<MyGUI::TextBox*>(barTextWidget)->setCaption("");
|
static_cast<MyGUI::TextBox*>(barTextWidget)->setCaption("");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void MWDynamicStat::setTitle(const std::string text)
|
void MWDynamicStat::setTitle(const std::string& text)
|
||||||
{
|
{
|
||||||
if (textWidget)
|
if (textWidget)
|
||||||
static_cast<MyGUI::TextBox*>(textWidget)->setCaption(text);
|
static_cast<MyGUI::TextBox*>(textWidget)->setCaption(text);
|
||||||
|
|
|
@ -54,9 +54,20 @@ namespace MWGui
|
||||||
|
|
||||||
bool operator==(const SpellEffectParams& other) const
|
bool operator==(const SpellEffectParams& other) const
|
||||||
{
|
{
|
||||||
return (other.mEffectID == mEffectID
|
if (mEffectID != other.mEffectID)
|
||||||
&& other.mSkill == mSkill
|
return false;
|
||||||
&& other.mAttribute == mAttribute);
|
|
||||||
|
bool involvesAttribute = (mEffectID == 74 // restore attribute
|
||||||
|
|| mEffectID == 85 // absorb attribute
|
||||||
|
|| mEffectID == 17 // drain attribute
|
||||||
|
|| mEffectID == 79 // fortify attribute
|
||||||
|
|| mEffectID == 22); // damage attribute
|
||||||
|
bool involvesSkill = (mEffectID == 78 // restore skill
|
||||||
|
|| mEffectID == 89 // absorb skill
|
||||||
|
|| mEffectID == 21 // drain skill
|
||||||
|
|| mEffectID == 83 // fortify skill
|
||||||
|
|| mEffectID == 26); // damage skill
|
||||||
|
return ((other.mSkill == mSkill) || !involvesSkill) && ((other.mAttribute == mAttribute) && !involvesAttribute);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -271,7 +282,7 @@ namespace MWGui
|
||||||
MWDynamicStat();
|
MWDynamicStat();
|
||||||
|
|
||||||
void setValue(int value, int max);
|
void setValue(int value, int max);
|
||||||
void setTitle(const std::string text);
|
void setTitle(const std::string& text);
|
||||||
|
|
||||||
int getValue() const { return value; }
|
int getValue() const { return value; }
|
||||||
int getMax() const { return max; }
|
int getMax() const { return max; }
|
||||||
|
|
|
@ -39,7 +39,7 @@
|
||||||
using namespace MWGui;
|
using namespace MWGui;
|
||||||
|
|
||||||
WindowManager::WindowManager(
|
WindowManager::WindowManager(
|
||||||
const Compiler::Extensions& extensions, int fpsLevel, bool newGame, OEngine::Render::OgreRenderer *mOgre, const std::string logpath)
|
const Compiler::Extensions& extensions, int fpsLevel, bool newGame, OEngine::Render::OgreRenderer *mOgre, const std::string& logpath)
|
||||||
: mGuiManager(NULL)
|
: mGuiManager(NULL)
|
||||||
, hud(NULL)
|
, hud(NULL)
|
||||||
, map(NULL)
|
, map(NULL)
|
||||||
|
@ -487,6 +487,7 @@ void WindowManager::onFrame (float frameDuration)
|
||||||
mDialogueWindow->checkReferenceAvailable();
|
mDialogueWindow->checkReferenceAvailable();
|
||||||
mTradeWindow->checkReferenceAvailable();
|
mTradeWindow->checkReferenceAvailable();
|
||||||
mContainerWindow->checkReferenceAvailable();
|
mContainerWindow->checkReferenceAvailable();
|
||||||
|
console->checkReferenceAvailable();
|
||||||
}
|
}
|
||||||
|
|
||||||
const ESMS::ESMStore& WindowManager::getStore() const
|
const ESMS::ESMStore& WindowManager::getStore() const
|
||||||
|
@ -637,6 +638,7 @@ void WindowManager::processChangedSettings(const Settings::CategorySettingVector
|
||||||
hud->onResChange(x, y);
|
hud->onResChange(x, y);
|
||||||
console->onResChange(x, y);
|
console->onResChange(x, y);
|
||||||
mSettingsWindow->center();
|
mSettingsWindow->center();
|
||||||
|
mDragAndDrop->mDragAndDropWidget->setSize(MyGUI::IntSize(x, y));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -655,7 +657,7 @@ void WindowManager::pushGuiMode(GuiMode mode)
|
||||||
|
|
||||||
void WindowManager::popGuiMode()
|
void WindowManager::popGuiMode()
|
||||||
{
|
{
|
||||||
if (mGuiModes.size())
|
if (!mGuiModes.empty())
|
||||||
mGuiModes.pop_back();
|
mGuiModes.pop_back();
|
||||||
|
|
||||||
bool gameMode = !isGuiMode();
|
bool gameMode = !isGuiMode();
|
||||||
|
@ -708,3 +710,25 @@ void WindowManager::unsetSelectedWeapon()
|
||||||
hud->unsetSelectedWeapon();
|
hud->unsetSelectedWeapon();
|
||||||
mInventoryWindow->setTitle("#{sSkillHandtohand}");
|
mInventoryWindow->setTitle("#{sSkillHandtohand}");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void WindowManager::getMousePosition(int &x, int &y)
|
||||||
|
{
|
||||||
|
const MyGUI::IntPoint& pos = MyGUI::InputManager::getInstance().getMousePosition();
|
||||||
|
x = pos.left;
|
||||||
|
y = pos.top;
|
||||||
|
}
|
||||||
|
|
||||||
|
void WindowManager::getMousePosition(float &x, float &y)
|
||||||
|
{
|
||||||
|
const MyGUI::IntPoint& pos = MyGUI::InputManager::getInstance().getMousePosition();
|
||||||
|
x = pos.left;
|
||||||
|
y = pos.top;
|
||||||
|
const MyGUI::IntSize& viewSize = MyGUI::RenderManager::getInstance().getViewSize();
|
||||||
|
x /= viewSize.width;
|
||||||
|
y /= viewSize.height;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool WindowManager::getWorldMouseOver()
|
||||||
|
{
|
||||||
|
return hud->getWorldMouseOver();
|
||||||
|
}
|
||||||
|
|
|
@ -98,7 +98,7 @@ namespace MWGui
|
||||||
typedef std::vector<Faction> FactionList;
|
typedef std::vector<Faction> FactionList;
|
||||||
typedef std::vector<int> SkillList;
|
typedef std::vector<int> SkillList;
|
||||||
|
|
||||||
WindowManager(const Compiler::Extensions& extensions, int fpsLevel, bool newGame, OEngine::Render::OgreRenderer *mOgre, const std::string logpath);
|
WindowManager(const Compiler::Extensions& extensions, int fpsLevel, bool newGame, OEngine::Render::OgreRenderer *mOgre, const std::string& logpath);
|
||||||
virtual ~WindowManager();
|
virtual ~WindowManager();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -141,7 +141,7 @@ namespace MWGui
|
||||||
updateVisible();
|
updateVisible();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isAllowed(GuiWindow wnd)
|
bool isAllowed(GuiWindow wnd) const
|
||||||
{
|
{
|
||||||
return allowed & wnd;
|
return allowed & wnd;
|
||||||
}
|
}
|
||||||
|
@ -155,6 +155,7 @@ namespace MWGui
|
||||||
MWGui::ConfirmationDialog* getConfirmationDialog() {return mConfirmationDialog;}
|
MWGui::ConfirmationDialog* getConfirmationDialog() {return mConfirmationDialog;}
|
||||||
MWGui::TradeWindow* getTradeWindow() {return mTradeWindow;}
|
MWGui::TradeWindow* getTradeWindow() {return mTradeWindow;}
|
||||||
MWGui::SpellWindow* getSpellWindow() {return mSpellWindow;}
|
MWGui::SpellWindow* getSpellWindow() {return mSpellWindow;}
|
||||||
|
MWGui::Console* getConsole() {return console;}
|
||||||
|
|
||||||
MyGUI::Gui* getGui() const { return gui; }
|
MyGUI::Gui* getGui() const { return gui; }
|
||||||
|
|
||||||
|
@ -188,7 +189,10 @@ namespace MWGui
|
||||||
void setFocusObjectScreenCoords(float min_x, float min_y, float max_x, float max_y);
|
void setFocusObjectScreenCoords(float min_x, float min_y, float max_x, float max_y);
|
||||||
|
|
||||||
void setMouseVisible(bool visible);
|
void setMouseVisible(bool visible);
|
||||||
|
void getMousePosition(int &x, int &y);
|
||||||
|
void getMousePosition(float &x, float &y);
|
||||||
void setDragDrop(bool dragDrop);
|
void setDragDrop(bool dragDrop);
|
||||||
|
bool getWorldMouseOver();
|
||||||
|
|
||||||
void toggleFogOfWar();
|
void toggleFogOfWar();
|
||||||
void toggleFullHelp(); ///< show extra info in item tooltips (owner, script)
|
void toggleFullHelp(); ///< show extra info in item tooltips (owner, script)
|
||||||
|
|
|
@ -68,7 +68,7 @@ ManualObject *Debugging::createPathgridLines(const ESM::Pathgrid *pathgrid)
|
||||||
result->begin(PATHGRID_LINE_MATERIAL, RenderOperation::OT_LINE_LIST);
|
result->begin(PATHGRID_LINE_MATERIAL, RenderOperation::OT_LINE_LIST);
|
||||||
for(ESM::Pathgrid::EdgeList::const_iterator it = pathgrid->edges.begin();
|
for(ESM::Pathgrid::EdgeList::const_iterator it = pathgrid->edges.begin();
|
||||||
it != pathgrid->edges.end();
|
it != pathgrid->edges.end();
|
||||||
it++)
|
++it)
|
||||||
{
|
{
|
||||||
const ESM::Pathgrid::Edge &edge = *it;
|
const ESM::Pathgrid::Edge &edge = *it;
|
||||||
const ESM::Pathgrid::Point &p1 = pathgrid->points[edge.v0], &p2 = pathgrid->points[edge.v1];
|
const ESM::Pathgrid::Point &p1 = pathgrid->points[edge.v0], &p2 = pathgrid->points[edge.v1];
|
||||||
|
@ -197,7 +197,7 @@ void Debugging::togglePathgrid()
|
||||||
|
|
||||||
// add path grid meshes to already loaded cells
|
// add path grid meshes to already loaded cells
|
||||||
mPathGridRoot = mMwRoot->createChildSceneNode();
|
mPathGridRoot = mMwRoot->createChildSceneNode();
|
||||||
for(CellList::iterator it = mActiveCells.begin(); it != mActiveCells.end(); it++)
|
for(CellList::iterator it = mActiveCells.begin(); it != mActiveCells.end(); ++it)
|
||||||
{
|
{
|
||||||
enableCellPathgrid(*it);
|
enableCellPathgrid(*it);
|
||||||
}
|
}
|
||||||
|
@ -205,7 +205,7 @@ void Debugging::togglePathgrid()
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// remove path grid meshes from already loaded cells
|
// remove path grid meshes from already loaded cells
|
||||||
for(CellList::iterator it = mActiveCells.begin(); it != mActiveCells.end(); it++)
|
for(CellList::iterator it = mActiveCells.begin(); it != mActiveCells.end(); ++it)
|
||||||
{
|
{
|
||||||
disableCellPathgrid(*it);
|
disableCellPathgrid(*it);
|
||||||
}
|
}
|
||||||
|
|
|
@ -528,7 +528,7 @@ void NpcAnimation::insertFootPart(int type, const std::string &mesh){
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
std::pair<Ogre::Entity*, std::vector<Nif::NiTriShapeCopy>*> NpcAnimation::insertFreePart(const std::string &mesh, const std::string suffix){
|
std::pair<Ogre::Entity*, std::vector<Nif::NiTriShapeCopy>*> NpcAnimation::insertFreePart(const std::string &mesh, const std::string& suffix){
|
||||||
|
|
||||||
std::string meshNumbered = mesh + getUniqueID(mesh + suffix) + suffix;
|
std::string meshNumbered = mesh + getUniqueID(mesh + suffix) + suffix;
|
||||||
NIFLoader::load(meshNumbered);
|
NIFLoader::load(meshNumbered);
|
||||||
|
|
|
@ -84,7 +84,7 @@ private:
|
||||||
NpcAnimation(const MWWorld::Ptr& ptr, OEngine::Render::OgreRenderer& _rend, MWWorld::InventoryStore& _inv);
|
NpcAnimation(const MWWorld::Ptr& ptr, OEngine::Render::OgreRenderer& _rend, MWWorld::InventoryStore& _inv);
|
||||||
virtual ~NpcAnimation();
|
virtual ~NpcAnimation();
|
||||||
Ogre::Entity* insertBoundedPart(const std::string &mesh, std::string bonename);
|
Ogre::Entity* insertBoundedPart(const std::string &mesh, std::string bonename);
|
||||||
std::pair<Ogre::Entity*, std::vector<Nif::NiTriShapeCopy>*> insertFreePart(const std::string &mesh, const std::string suffix);
|
std::pair<Ogre::Entity*, std::vector<Nif::NiTriShapeCopy>*> insertFreePart(const std::string &mesh, const std::string& suffix);
|
||||||
void insertFootPart(int type, const std::string &mesh);
|
void insertFootPart(int type, const std::string &mesh);
|
||||||
virtual void runAnimation(float timepassed);
|
virtual void runAnimation(float timepassed);
|
||||||
void updateParts();
|
void updateParts();
|
||||||
|
|
|
@ -39,7 +39,8 @@ struct LightInfo
|
||||||
|
|
||||||
LightInfo() :
|
LightInfo() :
|
||||||
flickerVariation(0), resetTime(0.5),
|
flickerVariation(0), resetTime(0.5),
|
||||||
flickerSlowVariation(0), time(0), interior(true)
|
flickerSlowVariation(0), time(0), interior(true),
|
||||||
|
type(LT_Normal), radius(1.0)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -68,7 +69,7 @@ class Objects{
|
||||||
///< Remove all movable objects from \a node.
|
///< Remove all movable objects from \a node.
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Objects(OEngine::Render::OgreRenderer& renderer): mRenderer (renderer) {}
|
Objects(OEngine::Render::OgreRenderer& renderer): mRenderer (renderer), mIsStatic(false) {}
|
||||||
~Objects(){}
|
~Objects(){}
|
||||||
void insertBegin (const MWWorld::Ptr& ptr, bool enabled, bool static_);
|
void insertBegin (const MWWorld::Ptr& ptr, bool enabled, bool static_);
|
||||||
void insertMesh (const MWWorld::Ptr& ptr, const std::string& mesh);
|
void insertMesh (const MWWorld::Ptr& ptr, const std::string& mesh);
|
||||||
|
|
|
@ -6,4 +6,22 @@ namespace MWRender
|
||||||
Player::Player (Ogre::Camera *camera, Ogre::SceneNode* node)
|
Player::Player (Ogre::Camera *camera, Ogre::SceneNode* node)
|
||||||
: mCamera (camera), mNode (node)
|
: mCamera (camera), mNode (node)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
void Player::setRot(float x, float y, float z)
|
||||||
|
{
|
||||||
|
Ogre::SceneNode *sceneNode = mNode;
|
||||||
|
Ogre::Node* yawNode = sceneNode->getChildIterator().getNext();
|
||||||
|
Ogre::Node* pitchNode = yawNode->getChildIterator().getNext();
|
||||||
|
|
||||||
|
// we are only interested in X and Y rotation
|
||||||
|
|
||||||
|
// Rotate around X axis
|
||||||
|
Ogre::Quaternion xr(Ogre::Radian(x), Ogre::Vector3::UNIT_X);
|
||||||
|
|
||||||
|
// Rotate around Y axis
|
||||||
|
Ogre::Quaternion yr(Ogre::Radian(-z), Ogre::Vector3::UNIT_Y);
|
||||||
|
|
||||||
|
pitchNode->setOrientation(xr);
|
||||||
|
yawNode->setOrientation(yr);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,6 +23,9 @@ namespace MWRender
|
||||||
|
|
||||||
Ogre::Camera *getCamera() { return mCamera; }
|
Ogre::Camera *getCamera() { return mCamera; }
|
||||||
|
|
||||||
|
/// Set where the player is looking at. Uses Morrowind (euler) angles
|
||||||
|
void setRot(float x, float y, float z);
|
||||||
|
|
||||||
std::string getHandle() const { return mNode->getName(); }
|
std::string getHandle() const { return mNode->getName(); }
|
||||||
Ogre::SceneNode* getNode() {return mNode;}
|
Ogre::SceneNode* getNode() {return mNode;}
|
||||||
};
|
};
|
||||||
|
|
|
@ -97,7 +97,6 @@ RenderingManager::RenderingManager (OEngine::Render::OgreRenderer& _rend, const
|
||||||
|
|
||||||
mTerrainManager = new TerrainManager(mRendering.getScene(), this);
|
mTerrainManager = new TerrainManager(mRendering.getScene(), this);
|
||||||
|
|
||||||
//mSkyManager = 0;
|
|
||||||
mSkyManager = new SkyManager(mMwRoot, mRendering.getCamera());
|
mSkyManager = new SkyManager(mMwRoot, mRendering.getCamera());
|
||||||
|
|
||||||
mOcclusionQuery = new OcclusionQuery(&mRendering, mSkyManager->getSunNode());
|
mOcclusionQuery = new OcclusionQuery(&mRendering, mSkyManager->getSunNode());
|
||||||
|
@ -116,10 +115,13 @@ RenderingManager::~RenderingManager ()
|
||||||
delete mPlayer;
|
delete mPlayer;
|
||||||
delete mSkyManager;
|
delete mSkyManager;
|
||||||
delete mDebugging;
|
delete mDebugging;
|
||||||
|
delete mShaderHelper;
|
||||||
|
delete mShadows;
|
||||||
delete mTerrainManager;
|
delete mTerrainManager;
|
||||||
delete mLocalMap;
|
delete mLocalMap;
|
||||||
delete mOcclusionQuery;
|
delete mOcclusionQuery;
|
||||||
delete mCompositors;
|
delete mCompositors;
|
||||||
|
delete mWater;
|
||||||
}
|
}
|
||||||
|
|
||||||
MWRender::SkyManager* RenderingManager::getSkyManager()
|
MWRender::SkyManager* RenderingManager::getSkyManager()
|
||||||
|
|
|
@ -167,7 +167,7 @@ namespace Ogre
|
||||||
class ShaderHelper : public TerrainAlloc
|
class ShaderHelper : public TerrainAlloc
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ShaderHelper() {}
|
ShaderHelper() : mShadowSamplerStartHi(0), mShadowSamplerStartLo(0) {}
|
||||||
virtual ~ShaderHelper() {}
|
virtual ~ShaderHelper() {}
|
||||||
virtual HighLevelGpuProgramPtr generateVertexProgram(const SM2Profile* prof, const Terrain* terrain, TechniqueType tt);
|
virtual HighLevelGpuProgramPtr generateVertexProgram(const SM2Profile* prof, const Terrain* terrain, TechniqueType tt);
|
||||||
virtual HighLevelGpuProgramPtr generateFragmentProgram(const SM2Profile* prof, const Terrain* terrain, TechniqueType tt);
|
virtual HighLevelGpuProgramPtr generateFragmentProgram(const SM2Profile* prof, const Terrain* terrain, TechniqueType tt);
|
||||||
|
|
|
@ -146,4 +146,5 @@ op 0x200014f: ForceGreeting
|
||||||
op 0x2000150: ForceGreeting, explicit reference
|
op 0x2000150: ForceGreeting, explicit reference
|
||||||
op 0x2000151: ToggleFullHelp
|
op 0x2000151: ToggleFullHelp
|
||||||
op 0x2000152: Goodbye
|
op 0x2000152: Goodbye
|
||||||
|
op 0x2000153: DontSaveObject (left unimplemented)
|
||||||
opcodes 0x2000154-0x3ffffff unused
|
opcodes 0x2000154-0x3ffffff unused
|
||||||
|
|
|
@ -194,6 +194,17 @@ namespace MWScript
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class OpDontSaveObject : public Interpreter::Opcode0
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
virtual void execute (Interpreter::Runtime& runtime)
|
||||||
|
{
|
||||||
|
// We are ignoring the DontSaveObject statement for now. Probably not worth
|
||||||
|
/// bothering with. The incompatibility we are creating should be marginal at most.
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
const int opcodeXBox = 0x200000c;
|
const int opcodeXBox = 0x200000c;
|
||||||
const int opcodeOnActivate = 0x200000d;
|
const int opcodeOnActivate = 0x200000d;
|
||||||
const int opcodeActivate = 0x2000075;
|
const int opcodeActivate = 0x2000075;
|
||||||
|
@ -208,6 +219,7 @@ namespace MWScript
|
||||||
const int opcodeFadeTo = 0x200013e;
|
const int opcodeFadeTo = 0x200013e;
|
||||||
const int opcodeToggleWater = 0x2000144;
|
const int opcodeToggleWater = 0x2000144;
|
||||||
const int opcodeTogglePathgrid = 0x2000146;
|
const int opcodeTogglePathgrid = 0x2000146;
|
||||||
|
const int opcodeDontSaveObject = 0x2000153;
|
||||||
|
|
||||||
void registerExtensions (Compiler::Extensions& extensions)
|
void registerExtensions (Compiler::Extensions& extensions)
|
||||||
{
|
{
|
||||||
|
@ -229,6 +241,7 @@ namespace MWScript
|
||||||
extensions.registerInstruction ("twa", "", opcodeToggleWater);
|
extensions.registerInstruction ("twa", "", opcodeToggleWater);
|
||||||
extensions.registerInstruction ("togglepathgrid", "", opcodeTogglePathgrid);
|
extensions.registerInstruction ("togglepathgrid", "", opcodeTogglePathgrid);
|
||||||
extensions.registerInstruction ("tpg", "", opcodeTogglePathgrid);
|
extensions.registerInstruction ("tpg", "", opcodeTogglePathgrid);
|
||||||
|
extensions.registerInstruction ("dontsaveobject", "", opcodeDontSaveObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
void installOpcodes (Interpreter::Interpreter& interpreter)
|
void installOpcodes (Interpreter::Interpreter& interpreter)
|
||||||
|
@ -247,6 +260,7 @@ namespace MWScript
|
||||||
interpreter.installSegment5 (opcodeFadeTo, new OpFadeTo);
|
interpreter.installSegment5 (opcodeFadeTo, new OpFadeTo);
|
||||||
interpreter.installSegment5 (opcodeTogglePathgrid, new OpTogglePathgrid);
|
interpreter.installSegment5 (opcodeTogglePathgrid, new OpTogglePathgrid);
|
||||||
interpreter.installSegment5 (opcodeToggleWater, new OpToggleWater);
|
interpreter.installSegment5 (opcodeToggleWater, new OpToggleWater);
|
||||||
|
interpreter.installSegment5 (opcodeDontSaveObject, new OpDontSaveObject);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,7 +46,7 @@ namespace MWSound
|
||||||
public:
|
public:
|
||||||
virtual ~Sound_Output() { }
|
virtual ~Sound_Output() { }
|
||||||
|
|
||||||
bool isInitialized() { return mInitialized; }
|
bool isInitialized() const { return mInitialized; }
|
||||||
|
|
||||||
friend class OpenAL_Output;
|
friend class OpenAL_Output;
|
||||||
friend class SoundManager;
|
friend class SoundManager;
|
||||||
|
|
|
@ -32,6 +32,7 @@ namespace MWWorld
|
||||||
PhysicsSystem::~PhysicsSystem()
|
PhysicsSystem::~PhysicsSystem()
|
||||||
{
|
{
|
||||||
delete mEngine;
|
delete mEngine;
|
||||||
|
delete playerphysics;
|
||||||
|
|
||||||
}
|
}
|
||||||
OEngine::Physic::PhysicEngine* PhysicsSystem::getEngine()
|
OEngine::Physic::PhysicEngine* PhysicsSystem::getEngine()
|
||||||
|
@ -66,7 +67,23 @@ namespace MWWorld
|
||||||
|
|
||||||
return mEngine->rayTest2(from,to);
|
return mEngine->rayTest2(from,to);
|
||||||
}
|
}
|
||||||
void PhysicsSystem::setCurrentWater(bool hasWater, int waterHeight){
|
|
||||||
|
std::vector < std::pair <float, std::string> > PhysicsSystem::getFacedObjects (float mouseX, float mouseY)
|
||||||
|
{
|
||||||
|
Ray ray = mRender.getCamera()->getCameraToViewportRay(mouseX, mouseY);
|
||||||
|
Ogre::Vector3 from = ray.getOrigin();
|
||||||
|
Ogre::Vector3 to = ray.getPoint(500); /// \todo make this distance (ray length) configurable
|
||||||
|
|
||||||
|
btVector3 _from, _to;
|
||||||
|
// OGRE to MW coordinates
|
||||||
|
_from = btVector3(from.x, -from.z, from.y);
|
||||||
|
_to = btVector3(to.x, -to.z, to.y);
|
||||||
|
|
||||||
|
return mEngine->rayTest2(_from,_to);
|
||||||
|
}
|
||||||
|
|
||||||
|
void PhysicsSystem::setCurrentWater(bool hasWater, int waterHeight)
|
||||||
|
{
|
||||||
playerphysics->hasWater = hasWater;
|
playerphysics->hasWater = hasWater;
|
||||||
if(hasWater){
|
if(hasWater){
|
||||||
playerphysics->waterHeight = waterHeight;
|
playerphysics->waterHeight = waterHeight;
|
||||||
|
@ -84,6 +101,14 @@ namespace MWWorld
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
btVector3 PhysicsSystem::getRayPoint(float extent, float mouseX, float mouseY)
|
||||||
|
{
|
||||||
|
//get a ray pointing to the center of the viewport
|
||||||
|
Ray centerRay = mRender.getCamera()->getCameraToViewportRay(mouseX, mouseY);
|
||||||
|
btVector3 result(centerRay.getPoint(500*extent).x,-centerRay.getPoint(500*extent).z,centerRay.getPoint(500*extent).y); /// \todo make this distance (ray length) configurable
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
bool PhysicsSystem::castRay(const Vector3& from, const Vector3& to)
|
bool PhysicsSystem::castRay(const Vector3& from, const Vector3& to)
|
||||||
{
|
{
|
||||||
btVector3 _from, _to;
|
btVector3 _from, _to;
|
||||||
|
|
|
@ -47,9 +47,12 @@ namespace MWWorld
|
||||||
std::pair<std::string, float> getFacedHandle (MWWorld::World& world);
|
std::pair<std::string, float> getFacedHandle (MWWorld::World& world);
|
||||||
|
|
||||||
btVector3 getRayPoint(float extent);
|
btVector3 getRayPoint(float extent);
|
||||||
|
btVector3 getRayPoint(float extent, float mouseX, float mouseY);
|
||||||
|
|
||||||
std::vector < std::pair <float, std::string> > getFacedObjects ();
|
std::vector < std::pair <float, std::string> > getFacedObjects ();
|
||||||
|
|
||||||
|
std::vector < std::pair <float, std::string> > getFacedObjects (float mouseX, float mouseY);
|
||||||
|
|
||||||
// cast ray, return true if it hit something
|
// cast ray, return true if it hit something
|
||||||
bool castRay(const Ogre::Vector3& from, const Ogre::Vector3& to);
|
bool castRay(const Ogre::Vector3& from, const Ogre::Vector3& to);
|
||||||
|
|
||||||
|
|
|
@ -40,6 +40,11 @@ namespace MWWorld
|
||||||
mWorld.moveObject (getPlayer(), x, y, z);
|
mWorld.moveObject (getPlayer(), x, y, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Player::setRot(float x, float y, float z)
|
||||||
|
{
|
||||||
|
mRenderer->setRot(x, y, z);
|
||||||
|
}
|
||||||
|
|
||||||
void Player::setClass (const ESM::Class& class_)
|
void Player::setClass (const ESM::Class& class_)
|
||||||
{
|
{
|
||||||
ESM::Class *new_class = new ESM::Class (class_);
|
ESM::Class *new_class = new ESM::Class (class_);
|
||||||
|
|
|
@ -42,6 +42,9 @@ namespace MWWorld
|
||||||
/// Set the player position. Uses Morrowind coordinates.
|
/// Set the player position. Uses Morrowind coordinates.
|
||||||
void setPos(float x, float y, float z);
|
void setPos(float x, float y, float z);
|
||||||
|
|
||||||
|
/// Set where the player is looking at. Uses Morrowind (euler) angles
|
||||||
|
void setRot(float x, float y, float z);
|
||||||
|
|
||||||
void setCell (MWWorld::Ptr::CellStore *cellStore)
|
void setCell (MWWorld::Ptr::CellStore *cellStore)
|
||||||
{
|
{
|
||||||
mCellStore = cellStore;
|
mCellStore = cellStore;
|
||||||
|
@ -104,7 +107,7 @@ namespace MWWorld
|
||||||
return *mClass;
|
return *mClass;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool getAutoMove()
|
bool getAutoMove() const
|
||||||
{
|
{
|
||||||
return mAutoMove;
|
return mAutoMove;
|
||||||
}
|
}
|
||||||
|
|
|
@ -145,10 +145,13 @@ namespace MWWorld
|
||||||
bool hasWater = cell->cell->data.flags & cell->cell->HasWater;
|
bool hasWater = cell->cell->data.flags & cell->cell->HasWater;
|
||||||
mPhysics->setCurrentWater(hasWater, cell->cell->water);
|
mPhysics->setCurrentWater(hasWater, cell->cell->water);
|
||||||
if (adjustPlayerPos)
|
if (adjustPlayerPos)
|
||||||
|
{
|
||||||
mWorld->getPlayer().setPos (position.pos[0], position.pos[1], position.pos[2]);
|
mWorld->getPlayer().setPos (position.pos[0], position.pos[1], position.pos[2]);
|
||||||
|
mWorld->getPlayer().setRot (position.rot[0], position.rot[1], position.rot[2]);
|
||||||
|
}
|
||||||
|
|
||||||
mWorld->getPlayer().setCell (cell);
|
mWorld->getPlayer().setCell (cell);
|
||||||
// TODO orientation
|
|
||||||
MWBase::Environment::get().getMechanicsManager()->addActor (mWorld->getPlayer().getPlayer());
|
MWBase::Environment::get().getMechanicsManager()->addActor (mWorld->getPlayer().getPlayer());
|
||||||
MWBase::Environment::get().getMechanicsManager()->watchActor (mWorld->getPlayer().getPlayer());
|
MWBase::Environment::get().getMechanicsManager()->watchActor (mWorld->getPlayer().getPlayer());
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,8 @@ const float WeatherGlobals::mThunderSoundDelay = 0.25;
|
||||||
|
|
||||||
WeatherManager::WeatherManager(MWRender::RenderingManager* rendering) :
|
WeatherManager::WeatherManager(MWRender::RenderingManager* rendering) :
|
||||||
mHour(14), mCurrentWeather("clear"), mFirstUpdate(true), mWeatherUpdateTime(0),
|
mHour(14), mCurrentWeather("clear"), mFirstUpdate(true), mWeatherUpdateTime(0),
|
||||||
mThunderFlash(0), mThunderChance(0), mThunderChanceNeeded(50), mThunderSoundDelay(0)
|
mThunderFlash(0), mThunderChance(0), mThunderChanceNeeded(50), mThunderSoundDelay(0),
|
||||||
|
mRemainingTransitionTime(0), mMonth(0), mDay(0)
|
||||||
{
|
{
|
||||||
mRendering = rendering;
|
mRendering = rendering;
|
||||||
|
|
||||||
|
|
|
@ -818,7 +818,15 @@ namespace MWWorld
|
||||||
|
|
||||||
// send new query
|
// send new query
|
||||||
// figure out which object we want to test against
|
// figure out which object we want to test against
|
||||||
std::vector < std::pair < float, std::string > > results = mPhysics->getFacedObjects();
|
std::vector < std::pair < float, std::string > > results;
|
||||||
|
if (MWBase::Environment::get().getWindowManager()->isGuiMode())
|
||||||
|
{
|
||||||
|
float x, y;
|
||||||
|
MWBase::Environment::get().getWindowManager()->getMousePosition(x, y);
|
||||||
|
results = mPhysics->getFacedObjects(x, y);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
results = mPhysics->getFacedObjects();
|
||||||
|
|
||||||
// ignore the player and other things we're not interested in
|
// ignore the player and other things we're not interested in
|
||||||
std::vector < std::pair < float, std::string > >::iterator it = results.begin();
|
std::vector < std::pair < float, std::string > >::iterator it = results.begin();
|
||||||
|
@ -843,7 +851,15 @@ namespace MWWorld
|
||||||
mFaced1Name = results.front().second;
|
mFaced1Name = results.front().second;
|
||||||
mNumFacing = 1;
|
mNumFacing = 1;
|
||||||
|
|
||||||
btVector3 p = mPhysics->getRayPoint(results.front().first);
|
btVector3 p;
|
||||||
|
if (MWBase::Environment::get().getWindowManager()->isGuiMode())
|
||||||
|
{
|
||||||
|
float x, y;
|
||||||
|
MWBase::Environment::get().getWindowManager()->getMousePosition(x, y);
|
||||||
|
p = mPhysics->getRayPoint(results.front().first, x, y);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
p = mPhysics->getRayPoint(results.front().first);
|
||||||
Ogre::Vector3 pos(p.x(), p.z(), -p.y());
|
Ogre::Vector3 pos(p.x(), p.z(), -p.y());
|
||||||
Ogre::SceneNode* node = mFaced1.getRefData().getBaseNode();
|
Ogre::SceneNode* node = mFaced1.getRefData().getBaseNode();
|
||||||
|
|
||||||
|
@ -860,7 +876,15 @@ namespace MWWorld
|
||||||
mFaced2 = getPtrViaHandle(results[1].second);
|
mFaced2 = getPtrViaHandle(results[1].second);
|
||||||
mNumFacing = 2;
|
mNumFacing = 2;
|
||||||
|
|
||||||
btVector3 p = mPhysics->getRayPoint(results[1].first);
|
btVector3 p;
|
||||||
|
if (MWBase::Environment::get().getWindowManager()->isGuiMode())
|
||||||
|
{
|
||||||
|
float x, y;
|
||||||
|
MWBase::Environment::get().getWindowManager()->getMousePosition(x, y);
|
||||||
|
p = mPhysics->getRayPoint(results[1].first, x, y);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
p = mPhysics->getRayPoint(results[1].first);
|
||||||
Ogre::Vector3 pos(p.x(), p.z(), -p.y());
|
Ogre::Vector3 pos(p.x(), p.z(), -p.y());
|
||||||
Ogre::SceneNode* node1 = mFaced1.getRefData().getBaseNode();
|
Ogre::SceneNode* node1 = mFaced1.getRefData().getBaseNode();
|
||||||
Ogre::SceneNode* node2 = mFaced2.getRefData().getBaseNode();
|
Ogre::SceneNode* node2 = mFaced2.getRefData().getBaseNode();
|
||||||
|
|
|
@ -93,12 +93,12 @@ class DirArchive: public Ogre::FileSystemArchive
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
std::string folder;
|
std::string folder;
|
||||||
int delimiter = 0;
|
//int delimiter = 0;
|
||||||
size_t lastSlash = copy.rfind('/');
|
size_t lastSlash = copy.rfind('/');
|
||||||
if (lastSlash != std::string::npos)
|
if (lastSlash != std::string::npos)
|
||||||
{
|
{
|
||||||
folder = copy.substr(0, lastSlash);
|
folder = copy.substr(0, lastSlash);
|
||||||
delimiter = lastSlash+1;
|
//delimiter = lastSlash+1;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<std::string> current;
|
std::vector<std::string> current;
|
||||||
|
|
|
@ -727,7 +727,7 @@ namespace Compiler
|
||||||
opStopScript (code);
|
opStopScript (code);
|
||||||
}
|
}
|
||||||
|
|
||||||
void getDistance (CodeContainer& code, Literals& literals, const std::string id)
|
void getDistance (CodeContainer& code, Literals& literals, const std::string& id)
|
||||||
{
|
{
|
||||||
if (id.empty())
|
if (id.empty())
|
||||||
{
|
{
|
||||||
|
@ -746,7 +746,7 @@ namespace Compiler
|
||||||
opGetSecondsPassed (code);
|
opGetSecondsPassed (code);
|
||||||
}
|
}
|
||||||
|
|
||||||
void getDisabled (CodeContainer& code, Literals& literals, const std::string id)
|
void getDisabled (CodeContainer& code, Literals& literals, const std::string& id)
|
||||||
{
|
{
|
||||||
if (id.empty())
|
if (id.empty())
|
||||||
{
|
{
|
||||||
|
@ -760,7 +760,7 @@ namespace Compiler
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void enable (CodeContainer& code, Literals& literals, const std::string id)
|
void enable (CodeContainer& code, Literals& literals, const std::string& id)
|
||||||
{
|
{
|
||||||
if (id.empty())
|
if (id.empty())
|
||||||
{
|
{
|
||||||
|
@ -774,7 +774,7 @@ namespace Compiler
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void disable (CodeContainer& code, Literals& literals, const std::string id)
|
void disable (CodeContainer& code, Literals& literals, const std::string& id)
|
||||||
{
|
{
|
||||||
if (id.empty())
|
if (id.empty())
|
||||||
{
|
{
|
||||||
|
|
|
@ -109,15 +109,15 @@ namespace Compiler
|
||||||
|
|
||||||
void stopScript (CodeContainer& code);
|
void stopScript (CodeContainer& code);
|
||||||
|
|
||||||
void getDistance (CodeContainer& code, Literals& literals, const std::string id);
|
void getDistance (CodeContainer& code, Literals& literals, const std::string& id);
|
||||||
|
|
||||||
void getSecondsPassed (CodeContainer& code);
|
void getSecondsPassed (CodeContainer& code);
|
||||||
|
|
||||||
void getDisabled (CodeContainer& code, Literals& literals, const std::string id);
|
void getDisabled (CodeContainer& code, Literals& literals, const std::string& id);
|
||||||
|
|
||||||
void enable (CodeContainer& code, Literals& literals, const std::string id);
|
void enable (CodeContainer& code, Literals& literals, const std::string& id);
|
||||||
|
|
||||||
void disable (CodeContainer& code, Literals& literals, const std::string id);
|
void disable (CodeContainer& code, Literals& literals, const std::string& id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -368,8 +368,10 @@ namespace Compiler
|
||||||
special = S_cmpEQ;
|
special = S_cmpEQ;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
special = S_cmpEQ;
|
||||||
putback (c);
|
putback (c);
|
||||||
return false;
|
// return false;
|
||||||
|
// Allow = as synonym for ==. \todo optionally disable for post-1.0 scripting improvements.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -152,15 +152,15 @@ public:
|
||||||
*
|
*
|
||||||
*************************************************************************/
|
*************************************************************************/
|
||||||
|
|
||||||
int getVer() { return mCtx.header.version; }
|
int getVer() const { return mCtx.header.version; }
|
||||||
float getFVer() { if(mCtx.header.version == VER_12) return 1.2; else return 1.3; }
|
float getFVer() { if(mCtx.header.version == VER_12) return 1.2; else return 1.3; }
|
||||||
int getSpecial() { return mSpf; }
|
int getSpecial() const { return mSpf; }
|
||||||
const std::string getAuthor() { return mCtx.header.author.toString(); }
|
const std::string getAuthor() { return mCtx.header.author.toString(); }
|
||||||
const std::string getDesc() { return mCtx.header.desc.toString(); }
|
const std::string getDesc() { return mCtx.header.desc.toString(); }
|
||||||
const SaveData &getSaveData() { return mSaveData; }
|
const SaveData &getSaveData() const { return mSaveData; }
|
||||||
const MasterList &getMasters() { return mMasters; }
|
const MasterList &getMasters() { return mMasters; }
|
||||||
const NAME &retSubName() { return mCtx.subName; }
|
const NAME &retSubName() { return mCtx.subName; }
|
||||||
uint32_t getSubSize() { return mCtx.leftSub; }
|
uint32_t getSubSize() const { return mCtx.leftSub; }
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
*
|
*
|
||||||
|
@ -323,8 +323,8 @@ public:
|
||||||
void getRecHeader() { uint32_t u; getRecHeader(u); }
|
void getRecHeader() { uint32_t u; getRecHeader(u); }
|
||||||
void getRecHeader(uint32_t &flags);
|
void getRecHeader(uint32_t &flags);
|
||||||
|
|
||||||
bool hasMoreRecs() { return mCtx.leftFile > 0; }
|
bool hasMoreRecs() const { return mCtx.leftFile > 0; }
|
||||||
bool hasMoreSubs() { return mCtx.leftRec > 0; }
|
bool hasMoreSubs() const { return mCtx.leftRec > 0; }
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
|
|
|
@ -11,7 +11,7 @@ namespace Files
|
||||||
bool containsVectorString(const StringVector& list, const std::string& str)
|
bool containsVectorString(const StringVector& list, const std::string& str)
|
||||||
{
|
{
|
||||||
for (StringVector::const_iterator iter = list.begin();
|
for (StringVector::const_iterator iter = list.begin();
|
||||||
iter != list.end(); iter++)
|
iter != list.end(); ++iter)
|
||||||
{
|
{
|
||||||
if (*iter == str)
|
if (*iter == str)
|
||||||
return true;
|
return true;
|
||||||
|
@ -112,7 +112,7 @@ namespace Files
|
||||||
void FileLibrary::printSections()
|
void FileLibrary::printSections()
|
||||||
{
|
{
|
||||||
for(StringPathContMap::const_iterator mapIter = mMap.begin();
|
for(StringPathContMap::const_iterator mapIter = mMap.begin();
|
||||||
mapIter != mMap.end(); mapIter++)
|
mapIter != mMap.end(); ++mapIter)
|
||||||
{
|
{
|
||||||
std::cout << mapIter->first <<std::endl;
|
std::cout << mapIter->first <<std::endl;
|
||||||
}
|
}
|
||||||
|
|
|
@ -684,11 +684,11 @@ void NIFLoader::handleNiTriShape(NiTriShape *shape, int flags, BoundsFinder &bou
|
||||||
Property *pr = &list[i];
|
Property *pr = &list[i];
|
||||||
|
|
||||||
if (pr->recType == RC_NiTexturingProperty)
|
if (pr->recType == RC_NiTexturingProperty)
|
||||||
t = (NiTexturingProperty*)pr;
|
t = static_cast<NiTexturingProperty*>(pr);
|
||||||
else if (pr->recType == RC_NiMaterialProperty)
|
else if (pr->recType == RC_NiMaterialProperty)
|
||||||
m = (NiMaterialProperty*)pr;
|
m = static_cast<NiMaterialProperty*>(pr);
|
||||||
else if (pr->recType == RC_NiAlphaProperty)
|
else if (pr->recType == RC_NiAlphaProperty)
|
||||||
a = (NiAlphaProperty*)pr;
|
a = static_cast<NiAlphaProperty*>(pr);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Texture
|
// Texture
|
||||||
|
|
|
@ -1,41 +1,6 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|
||||||
<MyGUI type="Skin">
|
<MyGUI type="Skin">
|
||||||
<Skin name = "MW_ConsoleWindow" size = "256 54">
|
|
||||||
<Property key="TextAlign" value = "ALIGN_CENTER" />
|
|
||||||
<Property key="TextColour" value = "0.8 0.8 0.8" />
|
|
||||||
<Property key="Snap" value = "true" />
|
|
||||||
|
|
||||||
<Child type="Widget" skin="BlackBG" offset = "4 4 248 46" align = "ALIGN_STRETCH" name = "Client"/>
|
|
||||||
|
|
||||||
<!-- Outer borders -->
|
|
||||||
<Child type="Widget" skin="TB_T" offset="4 0 248 4" align="ALIGN_TOP ALIGN_HSTRETCH" name="Action">
|
|
||||||
<Property key="Scale" value = "0 1 0 -1"/>
|
|
||||||
</Child>
|
|
||||||
<Child type="Widget" skin="TB_L" offset="0 4 4 46" align="ALIGN_LEFT ALIGN_VSTRETCH" name="Action">
|
|
||||||
<Property key="Scale" value = "1 0 -1 0"/>
|
|
||||||
</Child>
|
|
||||||
<Child type="Widget" skin="TB_B" offset="4 50 248 4" align="ALIGN_BOTTOM ALIGN_HSTRETCH" name="Action">
|
|
||||||
<Property key="Scale" value = "0 0 0 1"/>
|
|
||||||
</Child>
|
|
||||||
<Child type="Widget" skin="TB_R" offset="252 4 4 46" align="ALIGN_RIGHT ALIGN_VSTRETCH" name="Action">
|
|
||||||
<Property key="Scale" value = "0 0 1 0"/>
|
|
||||||
</Child>
|
|
||||||
|
|
||||||
<Child type="Widget" skin="TB_BR" offset="252 50 4 4" align="ALIGN_RIGHT ALIGN_BOTTOM" name="Action">
|
|
||||||
<Property key="Scale" value = "0 0 1 1"/>
|
|
||||||
</Child>
|
|
||||||
<Child type="Widget" skin="TB_BL" offset="0 50 4 4" align="ALIGN_LEFT ALIGN_BOTTOM" name="Action">
|
|
||||||
<Property key="Scale" value = "1 0 -1 1"/>
|
|
||||||
</Child>
|
|
||||||
<Child type="Widget" skin="TB_TR" offset="252 0 4 4" align="ALIGN_RIGHT ALIGN_TOP" name="Action">
|
|
||||||
<Property key="Scale" value = "0 1 1 -1"/>
|
|
||||||
</Child>
|
|
||||||
<Child type="Widget" skin="TB_TL" offset="0 0 4 4" align="ALIGN_LEFT ALIGN_TOP" name="Action">
|
|
||||||
<Property key="Scale" value = "1 1 -1 -1"/>
|
|
||||||
</Child>
|
|
||||||
</Skin>
|
|
||||||
|
|
||||||
<Skin name = "MW_LogClient" size = "10 10">
|
<Skin name = "MW_LogClient" size = "10 10">
|
||||||
<Property key="FontName" value = "MonoFont" />
|
<Property key="FontName" value = "MonoFont" />
|
||||||
<Property key="TextAlign" value = "Left Top" />
|
<Property key="TextAlign" value = "Left Top" />
|
||||||
|
|
|
@ -1,17 +1,17 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<MyGUI type="Layout">
|
<MyGUI type="Layout">
|
||||||
<Widget type="Window" skin="MW_ConsoleWindow" position="0 0 400 400" layer="Console" name="_Main">
|
<Widget type="Window" skin="MW_Window" position="0 0 400 400" layer="Console" name="_Main">
|
||||||
<Property key="Caption" value="Console"/>
|
<Property key="Caption" value="#{sConsoleTitle}"/>
|
||||||
<Property key="MinSize" value="200 100"/>
|
<Property key="MinSize" value="200 100"/>
|
||||||
<Property key="MaxSize" value="2000 2000"/>
|
<Property key="MaxSize" value="2000 2000"/>
|
||||||
|
|
||||||
<!-- Log window -->
|
<!-- Log window -->
|
||||||
<Widget type="EditBox" skin="MW_ConsoleLog" position="5 5 390 360" align="Stretch" name="list_History">
|
<Widget type="EditBox" skin="MW_ConsoleLog" position="5 5 380 330" align="Stretch" name="list_History">
|
||||||
<Property key="MultiLine" value="1"/>
|
<Property key="MultiLine" value="1"/>
|
||||||
</Widget>
|
</Widget>
|
||||||
|
|
||||||
<!-- Command line -->
|
<!-- Command line -->
|
||||||
<Widget type="EditBox" skin="MW_ConsoleCommand" position="0 365 392 28" align="HStretch Bottom" name="edit_Command"/>
|
<Widget type="EditBox" skin="MW_ConsoleCommand" position="0 335 382 28" align="HStretch Bottom" name="edit_Command"/>
|
||||||
|
|
||||||
</Widget>
|
</Widget>
|
||||||
</MyGUI>
|
</MyGUI>
|
||||||
|
|
|
@ -121,8 +121,7 @@ OISDriver::OISDriver(Ogre::RenderWindow *window, bool exclusive)
|
||||||
OISDriver::~OISDriver()
|
OISDriver::~OISDriver()
|
||||||
{
|
{
|
||||||
// Delete the listener object
|
// Delete the listener object
|
||||||
if(listener)
|
delete listener;
|
||||||
delete listener;
|
|
||||||
|
|
||||||
if(inputMgr == NULL) return;
|
if(inputMgr == NULL) return;
|
||||||
|
|
||||||
|
|
|
@ -11,6 +11,8 @@ namespace Physic
|
||||||
{
|
{
|
||||||
|
|
||||||
CMotionState::CMotionState(PhysicEngine* eng,std::string name)
|
CMotionState::CMotionState(PhysicEngine* eng,std::string name)
|
||||||
|
: isPC(false)
|
||||||
|
, isNPC(true)
|
||||||
{
|
{
|
||||||
pEng = eng;
|
pEng = eng;
|
||||||
tr.setIdentity();
|
tr.setIdentity();
|
||||||
|
|
|
@ -300,7 +300,13 @@ namespace Physic
|
||||||
body->collide = true;
|
body->collide = true;
|
||||||
body->getWorldTransform().setOrigin(btVector3( (x+0.5)*triSize*(sqrtVerts-1), (y+0.5)*triSize*(sqrtVerts-1), (maxh+minh)/2.f));
|
body->getWorldTransform().setOrigin(btVector3( (x+0.5)*triSize*(sqrtVerts-1), (y+0.5)*triSize*(sqrtVerts-1), (maxh+minh)/2.f));
|
||||||
|
|
||||||
addRigidBody(body);
|
HeightField hf;
|
||||||
|
hf.mBody = body;
|
||||||
|
hf.mShape = hfShape;
|
||||||
|
|
||||||
|
mHeightFieldMap [name] = hf;
|
||||||
|
|
||||||
|
dynamicsWorld->addRigidBody(body,COL_WORLD,COL_WORLD|COL_ACTOR_INTERNAL|COL_ACTOR_EXTERNAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PhysicEngine::removeHeightField(int x, int y)
|
void PhysicEngine::removeHeightField(int x, int y)
|
||||||
|
@ -309,8 +315,11 @@ namespace Physic
|
||||||
+ boost::lexical_cast<std::string>(x) + "_"
|
+ boost::lexical_cast<std::string>(x) + "_"
|
||||||
+ boost::lexical_cast<std::string>(y);
|
+ boost::lexical_cast<std::string>(y);
|
||||||
|
|
||||||
removeRigidBody(name);
|
HeightField hf = mHeightFieldMap [name];
|
||||||
deleteRigidBody(name);
|
|
||||||
|
dynamicsWorld->removeRigidBody(hf.mBody);
|
||||||
|
delete hf.mShape;
|
||||||
|
delete hf.mBody;
|
||||||
}
|
}
|
||||||
|
|
||||||
RigidBody* PhysicEngine::createRigidBody(std::string mesh,std::string name,float scale)
|
RigidBody* PhysicEngine::createRigidBody(std::string mesh,std::string name,float scale)
|
||||||
|
|
|
@ -15,6 +15,7 @@ class btSequentialImpulseConstraintSolver;
|
||||||
class btCollisionDispatcher;
|
class btCollisionDispatcher;
|
||||||
class btDiscreteDynamicsWorld;
|
class btDiscreteDynamicsWorld;
|
||||||
class btKinematicCharacterController;
|
class btKinematicCharacterController;
|
||||||
|
class btHeightfieldTerrainShape;
|
||||||
|
|
||||||
namespace BtOgre
|
namespace BtOgre
|
||||||
{
|
{
|
||||||
|
@ -115,6 +116,12 @@ namespace Physic
|
||||||
bool collide;
|
bool collide;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct HeightField
|
||||||
|
{
|
||||||
|
btHeightfieldTerrainShape* mShape;
|
||||||
|
RigidBody* mBody;
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The PhysicEngine class contain everything which is needed for Physic.
|
* The PhysicEngine class contain everything which is needed for Physic.
|
||||||
* It's needed that Ogre Resources are set up before the PhysicEngine is created.
|
* It's needed that Ogre Resources are set up before the PhysicEngine is created.
|
||||||
|
@ -240,6 +247,9 @@ namespace Physic
|
||||||
//the NIF file loader.
|
//the NIF file loader.
|
||||||
BulletShapeLoader* mShapeLoader;
|
BulletShapeLoader* mShapeLoader;
|
||||||
|
|
||||||
|
typedef std::map<std::string, HeightField> HeightFieldContainer;
|
||||||
|
HeightFieldContainer mHeightFieldMap;
|
||||||
|
|
||||||
typedef std::map<std::string,RigidBody*> RigidBodyContainer;
|
typedef std::map<std::string,RigidBody*> RigidBodyContainer;
|
||||||
RigidBodyContainer RigidBodyMap;
|
RigidBodyContainer RigidBodyMap;
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,7 @@ void MyGUIManager::setup(Ogre::RenderWindow *wnd, Ogre::SceneManager *mgr, bool
|
||||||
|
|
||||||
void MyGUIManager::shutdown()
|
void MyGUIManager::shutdown()
|
||||||
{
|
{
|
||||||
if(mGui) delete mGui;
|
delete mGui;
|
||||||
if(mPlatform)
|
if(mPlatform)
|
||||||
{
|
{
|
||||||
mPlatform->shutdown();
|
mPlatform->shutdown();
|
||||||
|
|
|
@ -10,17 +10,17 @@
|
||||||
#include "OgreHardwarePixelBuffer.h"
|
#include "OgreHardwarePixelBuffer.h"
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
#include <stdexcept>
|
||||||
|
|
||||||
using namespace Ogre;
|
using namespace Ogre;
|
||||||
using namespace OEngine::Render;
|
using namespace OEngine::Render;
|
||||||
|
|
||||||
void OgreRenderer::cleanup()
|
void OgreRenderer::cleanup()
|
||||||
{
|
{
|
||||||
if (mFader)
|
delete mFader;
|
||||||
delete mFader;
|
mFader = NULL;
|
||||||
|
|
||||||
if(mRoot)
|
OGRE_DELETE mRoot;
|
||||||
delete mRoot;
|
|
||||||
mRoot = NULL;
|
mRoot = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@ void OgreRenderer::start()
|
||||||
mRoot->startRendering();
|
mRoot->startRendering();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool OgreRenderer::loadPlugins()
|
bool OgreRenderer::loadPlugins() const
|
||||||
{
|
{
|
||||||
#ifdef ENABLE_PLUGIN_GL
|
#ifdef ENABLE_PLUGIN_GL
|
||||||
mGLPlugin = new Ogre::GLPlugin();
|
mGLPlugin = new Ogre::GLPlugin();
|
||||||
|
@ -124,7 +124,7 @@ void OgreRenderer::createWindow(const std::string &title, const WindowSettings&
|
||||||
Ogre::TU_DYNAMIC_WRITE_ONLY_DISCARDABLE);
|
Ogre::TU_DYNAMIC_WRITE_ONLY_DISCARDABLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void OgreRenderer::createScene(const std::string camName, float fov, float nearClip)
|
void OgreRenderer::createScene(const std::string& camName, float fov, float nearClip)
|
||||||
{
|
{
|
||||||
assert(mRoot);
|
assert(mRoot);
|
||||||
assert(mWindow);
|
assert(mWindow);
|
||||||
|
|
|
@ -119,7 +119,7 @@ namespace OEngine
|
||||||
void createWindow(const std::string &title, const WindowSettings& settings);
|
void createWindow(const std::string &title, const WindowSettings& settings);
|
||||||
|
|
||||||
/// Set up the scene manager, camera and viewport
|
/// Set up the scene manager, camera and viewport
|
||||||
void createScene(const std::string camName="Camera",// Camera name
|
void createScene(const std::string& camName="Camera",// Camera name
|
||||||
float fov=55, // Field of view angle
|
float fov=55, // Field of view angle
|
||||||
float nearClip=5 // Near clip distance
|
float nearClip=5 // Near clip distance
|
||||||
);
|
);
|
||||||
|
@ -132,7 +132,7 @@ namespace OEngine
|
||||||
/// Start the main rendering loop
|
/// Start the main rendering loop
|
||||||
void start();
|
void start();
|
||||||
|
|
||||||
bool loadPlugins();
|
bool loadPlugins() const;
|
||||||
|
|
||||||
void update(float dt);
|
void update(float dt);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue