Merge remote-tracking branch 'scrawl/master'

celladd
Marc Zinnschlag 10 years ago
commit 056bc66c6c

@ -23,7 +23,7 @@ Getting Started
* [Testing the game](https://wiki.openmw.org/index.php?title=Testing) * [Testing the game](https://wiki.openmw.org/index.php?title=Testing)
* [How to contribute](https://wiki.openmw.org/index.php?title=Contribution_Wanted) * [How to contribute](https://wiki.openmw.org/index.php?title=Contribution_Wanted)
* [Report a bug](http://bugs.openmw.org/projects/openmw) - read the [guidelines](https://wiki.openmw.org/index.php?title=Bug_Reporting_Guidelines) before submitting your first bug! * [Report a bug](http://bugs.openmw.org/projects/openmw) - read the [guidelines](https://wiki.openmw.org/index.php?title=Bug_Reporting_Guidelines) before submitting your first bug!
* [Known issues] (http://bugs.openmw.org/projects/openmw/issues?utf8=%E2%9C%93&set_filter=1&f%5B%5D=status_id&op%5Bstatus_id%5D=%3D&v%5Bstatus_id%5D%5B%5D=7&f%5B%5D=tracker_id&op%5Btracker_id%5D=%3D&v%5Btracker_id%5D%5B%5D=1&f%5B%5D=&c%5B%5D=project&c%5B%5D=tracker&c%5B%5D=status&c%5B%5D=priority&c%5B%5D=subject&c%5B%5D=assigned_to&c%5B%5D=updated_on&group_by=tracker) * [Known issues](http://bugs.openmw.org/projects/openmw/issues?utf8=%E2%9C%93&set_filter=1&f%5B%5D=status_id&op%5Bstatus_id%5D=%3D&v%5Bstatus_id%5D%5B%5D=7&f%5B%5D=tracker_id&op%5Btracker_id%5D=%3D&v%5Btracker_id%5D%5B%5D=1&f%5B%5D=&c%5B%5D=project&c%5B%5D=tracker&c%5B%5D=status&c%5B%5D=priority&c%5B%5D=subject&c%5B%5D=assigned_to&c%5B%5D=updated_on&group_by=tracker)
The data path The data path
------------- -------------

@ -6,6 +6,9 @@
#include <boost/format.hpp> #include <boost/format.hpp>
namespace
{
void printAIPackage(ESM::AIPackage p) void printAIPackage(ESM::AIPackage p)
{ {
std::cout << " AI Type: " << aiTypeLabel(p.mType) std::cout << " AI Type: " << aiTypeLabel(p.mType)
@ -149,6 +152,26 @@ void printEffectList(ESM::EffectList effects)
} }
} }
void printTransport(const std::vector<ESM::Transport::Dest>& transport)
{
std::vector<ESM::Transport::Dest>::const_iterator dit;
for (dit = transport.begin(); dit != transport.end(); ++dit)
{
std::cout << " Destination Position: "
<< boost::format("%12.3f") % dit->mPos.pos[0] << ","
<< boost::format("%12.3f") % dit->mPos.pos[1] << ","
<< boost::format("%12.3f") % dit->mPos.pos[2] << ")" << std::endl;
std::cout << " Destination Rotation: "
<< boost::format("%9.6f") % dit->mPos.rot[0] << ","
<< boost::format("%9.6f") % dit->mPos.rot[1] << ","
<< boost::format("%9.6f") % dit->mPos.rot[2] << ")" << std::endl;
if (dit->mCellName != "")
std::cout << " Destination Cell: " << dit->mCellName << std::endl;
}
}
}
namespace EsmTool { namespace EsmTool {
RecordBase * RecordBase *
@ -631,6 +654,8 @@ void Record<ESM::Creature>::print()
for (sit = mData.mSpells.mList.begin(); sit != mData.mSpells.mList.end(); ++sit) for (sit = mData.mSpells.mList.begin(); sit != mData.mSpells.mList.end(); ++sit)
std::cout << " Spell: " << *sit << std::endl; std::cout << " Spell: " << *sit << std::endl;
printTransport(mData.getTransport());
std::cout << " Artifical Intelligence: " << mData.mHasAI << std::endl; std::cout << " Artifical Intelligence: " << mData.mHasAI << std::endl;
std::cout << " AI Hello:" << (int)mData.mAiData.mHello << std::endl; std::cout << " AI Hello:" << (int)mData.mAiData.mHello << std::endl;
std::cout << " AI Fight:" << (int)mData.mAiData.mFight << std::endl; std::cout << " AI Fight:" << (int)mData.mAiData.mFight << std::endl;
@ -1042,20 +1067,7 @@ void Record<ESM::NPC>::print()
for (sit = mData.mSpells.mList.begin(); sit != mData.mSpells.mList.end(); ++sit) for (sit = mData.mSpells.mList.begin(); sit != mData.mSpells.mList.end(); ++sit)
std::cout << " Spell: " << *sit << std::endl; std::cout << " Spell: " << *sit << std::endl;
std::vector<ESM::NPC::Dest>::iterator dit; printTransport(mData.getTransport());
for (dit = mData.mTransport.begin(); dit != mData.mTransport.end(); ++dit)
{
std::cout << " Destination Position: "
<< boost::format("%12.3f") % dit->mPos.pos[0] << ","
<< boost::format("%12.3f") % dit->mPos.pos[1] << ","
<< boost::format("%12.3f") % dit->mPos.pos[2] << ")" << std::endl;
std::cout << " Destination Rotation: "
<< boost::format("%9.6f") % dit->mPos.rot[0] << ","
<< boost::format("%9.6f") % dit->mPos.rot[1] << ","
<< boost::format("%9.6f") % dit->mPos.rot[2] << ")" << std::endl;
if (dit->mCellName != "")
std::cout << " Destination Cell: " << dit->mCellName << std::endl;
}
std::cout << " Artifical Intelligence: " << mData.mHasAI << std::endl; std::cout << " Artifical Intelligence: " << mData.mHasAI << std::endl;
std::cout << " AI Hello:" << (int)mData.mAiData.mHello << std::endl; std::cout << " AI Hello:" << (int)mData.mAiData.mHello << std::endl;

@ -197,9 +197,6 @@ OMW::Engine::Engine(Files::ConfigurationManager& configurationManager)
Uint32 flags = SDL_INIT_VIDEO|SDL_INIT_NOPARACHUTE|SDL_INIT_GAMECONTROLLER|SDL_INIT_JOYSTICK; Uint32 flags = SDL_INIT_VIDEO|SDL_INIT_NOPARACHUTE|SDL_INIT_GAMECONTROLLER|SDL_INIT_JOYSTICK;
if(SDL_WasInit(flags) == 0) if(SDL_WasInit(flags) == 0)
{ {
//kindly ask SDL not to trash our OGL context
//might this be related to http://bugzilla.libsdl.org/show_bug.cgi?id=748 ?
SDL_SetHint(SDL_HINT_RENDER_DRIVER, "software");
SDL_SetMainReady(); SDL_SetMainReady();
if(SDL_Init(flags) != 0) if(SDL_Init(flags) != 0)
{ {

@ -149,17 +149,14 @@ namespace MWBase
/// \todo investigate, if we really need to expose every single lousy UI element to the outside world /// \todo investigate, if we really need to expose every single lousy UI element to the outside world
virtual MWGui::DialogueWindow* getDialogueWindow() = 0; virtual MWGui::DialogueWindow* getDialogueWindow() = 0;
virtual MWGui::ContainerWindow* getContainerWindow() = 0;
virtual MWGui::InventoryWindow* getInventoryWindow() = 0; virtual MWGui::InventoryWindow* getInventoryWindow() = 0;
virtual MWGui::BookWindow* getBookWindow() = 0;
virtual MWGui::ScrollWindow* getScrollWindow() = 0;
virtual MWGui::CountDialog* getCountDialog() = 0; virtual MWGui::CountDialog* getCountDialog() = 0;
virtual MWGui::ConfirmationDialog* getConfirmationDialog() = 0; virtual MWGui::ConfirmationDialog* getConfirmationDialog() = 0;
virtual MWGui::TradeWindow* getTradeWindow() = 0; virtual MWGui::TradeWindow* getTradeWindow() = 0;
virtual MWGui::SpellBuyingWindow* getSpellBuyingWindow() = 0;
virtual MWGui::TravelWindow* getTravelWindow() = 0; virtual void updateSpellWindow() = 0;
virtual MWGui::SpellWindow* getSpellWindow() = 0;
virtual MWGui::Console* getConsole() = 0; virtual void setConsoleSelectedObject(const MWWorld::Ptr& object) = 0;
virtual void wmUpdateFps(float fps, unsigned int triangleCount, unsigned int batchCount) = 0; virtual void wmUpdateFps(float fps, unsigned int triangleCount, unsigned int batchCount) = 0;
@ -181,12 +178,6 @@ namespace MWBase
virtual void configureSkills (const SkillList& major, const SkillList& minor) = 0; virtual void configureSkills (const SkillList& major, const SkillList& minor) = 0;
///< configure skill groups, each set contains the skill ID for that group. ///< configure skill groups, each set contains the skill ID for that group.
virtual void setReputation (int reputation) = 0;
///< set the current reputation value
virtual void setBounty (int bounty) = 0;
///< set the current bounty value
virtual void updateSkillArea() = 0; virtual void updateSkillArea() = 0;
///< update display of skills, factions, birth sign, reputation and bounty ///< update display of skills, factions, birth sign, reputation and bounty
@ -303,6 +294,12 @@ namespace MWBase
virtual void startTraining(MWWorld::Ptr actor) = 0; virtual void startTraining(MWWorld::Ptr actor) = 0;
virtual void startRepair(MWWorld::Ptr actor) = 0; virtual void startRepair(MWWorld::Ptr actor) = 0;
virtual void startRepairItem(MWWorld::Ptr item) = 0; virtual void startRepairItem(MWWorld::Ptr item) = 0;
virtual void startTravel(const MWWorld::Ptr& actor) = 0;
virtual void startSpellBuying(const MWWorld::Ptr& actor) = 0;
virtual void startTrade(const MWWorld::Ptr& actor) = 0;
virtual void openContainer(const MWWorld::Ptr& container, bool loot) = 0;
virtual void showBook(const MWWorld::Ptr& item, bool showTakeButton) = 0;
virtual void showScroll(const MWWorld::Ptr& item, bool showTakeButton) = 0;
virtual void showSoulgemDialog (MWWorld::Ptr item) = 0; virtual void showSoulgemDialog (MWWorld::Ptr item) = 0;
@ -332,9 +329,8 @@ namespace MWBase
/// Does the current stack of GUI-windows permit saving? /// Does the current stack of GUI-windows permit saving?
virtual bool isSavingAllowed() const = 0; virtual bool isSavingAllowed() const = 0;
/// Returns the current Modal /// Send exit command to active Modal window
/** Used to send exit command to active Modal when Esc is pressed **/ virtual void exitCurrentModal() = 0;
virtual MWGui::WindowModal* getCurrentModal() const = 0;
/// Sets the current Modal /// Sets the current Modal
/** Used to send exit command to active Modal when Esc is pressed **/ /** Used to send exit command to active Modal when Esc is pressed **/

@ -205,10 +205,8 @@ namespace MWBase
///< Return a pointer to a liveCellRef which contains \a ptr. ///< Return a pointer to a liveCellRef which contains \a ptr.
/// \note Search is limited to the active cells. /// \note Search is limited to the active cells.
/// \todo enable reference in the OGRE scene
virtual void enable (const MWWorld::Ptr& ptr) = 0; virtual void enable (const MWWorld::Ptr& ptr) = 0;
/// \todo disable reference in the OGRE scene
virtual void disable (const MWWorld::Ptr& ptr) = 0; virtual void disable (const MWWorld::Ptr& ptr) = 0;
virtual void advanceTime (double hours) = 0; virtual void advanceTime (double hours) = 0;

@ -249,7 +249,7 @@ namespace MWClass
float hitchance = MWMechanics::getHitChance(ptr, victim, ref->mBase->mData.mCombat); float hitchance = MWMechanics::getHitChance(ptr, victim, ref->mBase->mData.mCombat);
if((::rand()/(RAND_MAX+1.0)) > hitchance/100.0f) if((::rand()/(RAND_MAX+1.0)) >= hitchance/100.0f)
{ {
victim.getClass().onHit(victim, 0.0f, false, MWWorld::Ptr(), ptr, false); victim.getClass().onHit(victim, 0.0f, false, MWWorld::Ptr(), ptr, false);
MWMechanics::reduceWeaponCondition(0.f, false, weapon, ptr); MWMechanics::reduceWeaponCondition(0.f, false, weapon, ptr);
@ -288,9 +288,7 @@ namespace MWClass
if(attack) if(attack)
{ {
damage = attack[0] + ((attack[1]-attack[0])*stats.getAttackStrength()); damage = attack[0] + ((attack[1]-attack[0])*stats.getAttackStrength());
damage *= gmst.find("fDamageStrengthBase")->getFloat() + MWMechanics::adjustWeaponDamage(damage, weapon, ptr);
(stats.getAttribute(ESM::Attribute::Strength).getModified() * gmst.find("fDamageStrengthMult")->getFloat() * 0.1f);
MWMechanics::adjustWeaponDamage(damage, weapon);
MWMechanics::reduceWeaponCondition(damage, true, weapon, ptr); MWMechanics::reduceWeaponCondition(damage, true, weapon, ptr);
} }
@ -355,7 +353,7 @@ namespace MWClass
if(!object.isEmpty()) if(!object.isEmpty())
getCreatureStats(ptr).setLastHitObject(object.getClass().getId(object)); getCreatureStats(ptr).setLastHitObject(object.getClass().getId(object));
if(setOnPcHitMe && !attacker.isEmpty() && attacker.getRefData().getHandle() == "player") if(setOnPcHitMe && !attacker.isEmpty() && attacker == MWBase::Environment::get().getWorld()->getPlayerPtr())
{ {
const std::string &script = ptr.get<ESM::Creature>()->mBase->mScript; const std::string &script = ptr.get<ESM::Creature>()->mBase->mScript;
/* Set the OnPCHitMe script variable. The script is responsible for clearing it. */ /* Set the OnPCHitMe script variable. The script is responsible for clearing it. */

@ -279,8 +279,6 @@ namespace MWClass
gmst.fKnockDownMult = store.find("fKnockDownMult"); gmst.fKnockDownMult = store.find("fKnockDownMult");
gmst.iKnockDownOddsMult = store.find("iKnockDownOddsMult"); gmst.iKnockDownOddsMult = store.find("iKnockDownOddsMult");
gmst.iKnockDownOddsBase = store.find("iKnockDownOddsBase"); gmst.iKnockDownOddsBase = store.find("iKnockDownOddsBase");
gmst.fDamageStrengthBase = store.find("fDamageStrengthBase");
gmst.fDamageStrengthMult = store.find("fDamageStrengthMult");
gmst.fCombatArmorMinMult = store.find("fCombatArmorMinMult"); gmst.fCombatArmorMinMult = store.find("fCombatArmorMinMult");
inited = true; inited = true;
@ -507,7 +505,7 @@ namespace MWClass
if(otherstats.isDead()) // Can't hit dead actors if(otherstats.isDead()) // Can't hit dead actors
return; return;
if(ptr.getRefData().getHandle() == "player") if(ptr == MWBase::Environment::get().getWorld()->getPlayerPtr())
MWBase::Environment::get().getWindowManager()->setEnemy(victim); MWBase::Environment::get().getWindowManager()->setEnemy(victim);
int weapskill = ESM::Skill::HandToHand; int weapskill = ESM::Skill::HandToHand;
@ -516,7 +514,7 @@ namespace MWClass
float hitchance = MWMechanics::getHitChance(ptr, victim, ptr.getClass().getSkill(ptr, weapskill)); float hitchance = MWMechanics::getHitChance(ptr, victim, ptr.getClass().getSkill(ptr, weapskill));
if((::rand()/(RAND_MAX+1.0)) > hitchance/100.0f) if((::rand()/(RAND_MAX+1.0)) >= hitchance/100.0f)
{ {
othercls.onHit(victim, 0.0f, false, weapon, ptr, false); othercls.onHit(victim, 0.0f, false, weapon, ptr, false);
MWMechanics::reduceWeaponCondition(0.f, false, weapon, ptr); MWMechanics::reduceWeaponCondition(0.f, false, weapon, ptr);
@ -538,10 +536,8 @@ namespace MWClass
if(attack) if(attack)
{ {
damage = attack[0] + ((attack[1]-attack[0])*stats.getAttackStrength()); damage = attack[0] + ((attack[1]-attack[0])*stats.getAttackStrength());
damage *= gmst.fDamageStrengthBase->getFloat() +
(stats.getAttribute(ESM::Attribute::Strength).getModified() * gmst.fDamageStrengthMult->getFloat() * 0.1f);
} }
MWMechanics::adjustWeaponDamage(damage, weapon); MWMechanics::adjustWeaponDamage(damage, weapon, ptr);
MWMechanics::reduceWeaponCondition(damage, true, weapon, ptr); MWMechanics::reduceWeaponCondition(damage, true, weapon, ptr);
healthdmg = true; healthdmg = true;
} }
@ -549,7 +545,7 @@ namespace MWClass
{ {
MWMechanics::getHandToHandDamage(ptr, victim, damage, healthdmg); MWMechanics::getHandToHandDamage(ptr, victim, damage, healthdmg);
} }
if(ptr.getRefData().getHandle() == "player") if(ptr == MWBase::Environment::get().getWorld()->getPlayerPtr())
{ {
skillUsageSucceeded(ptr, weapskill, 0); skillUsageSucceeded(ptr, weapskill, 0);
@ -625,7 +621,7 @@ namespace MWClass
if(!object.isEmpty()) if(!object.isEmpty())
getCreatureStats(ptr).setLastHitObject(object.getClass().getId(object)); getCreatureStats(ptr).setLastHitObject(object.getClass().getId(object));
if(setOnPcHitMe && !attacker.isEmpty() && attacker.getRefData().getHandle() == "player") if(setOnPcHitMe && !attacker.isEmpty() && attacker == MWBase::Environment::get().getWorld()->getPlayerPtr())
{ {
const std::string &script = ptr.getClass().getScript(ptr); const std::string &script = ptr.getClass().getScript(ptr);
/* Set the OnPCHitMe script variable. The script is responsible for clearing it. */ /* Set the OnPCHitMe script variable. The script is responsible for clearing it. */
@ -708,7 +704,7 @@ namespace MWClass
if (armorhealth == 0) if (armorhealth == 0)
armor = *inv.unequipItem(armor, ptr); armor = *inv.unequipItem(armor, ptr);
if (ptr.getRefData().getHandle() == "player") if (ptr == MWBase::Environment::get().getWorld()->getPlayerPtr())
skillUsageSucceeded(ptr, armor.getClass().getEquipmentSkill(armor), 0); skillUsageSucceeded(ptr, armor.getClass().getEquipmentSkill(armor), 0);
switch(armor.getClass().getEquipmentSkill(armor)) switch(armor.getClass().getEquipmentSkill(armor))
@ -724,7 +720,7 @@ namespace MWClass
break; break;
} }
} }
else if(ptr.getRefData().getHandle() == "player") else if(ptr == MWBase::Environment::get().getWorld()->getPlayerPtr())
skillUsageSucceeded(ptr, ESM::Skill::Unarmored, 0); skillUsageSucceeded(ptr, ESM::Skill::Unarmored, 0);
} }
} }
@ -737,7 +733,7 @@ namespace MWClass
if(damage > 0.0f) if(damage > 0.0f)
{ {
sndMgr->playSound3D(ptr, "Health Damage", 1.0f, 1.0f); sndMgr->playSound3D(ptr, "Health Damage", 1.0f, 1.0f);
if (ptr.getRefData().getHandle() == "player") if (ptr == MWBase::Environment::get().getWorld()->getPlayerPtr())
MWBase::Environment::get().getWindowManager()->activateHitOverlay(); MWBase::Environment::get().getWindowManager()->activateHitOverlay();
} }
float health = getCreatureStats(ptr).getHealth().getCurrent() - damage; float health = getCreatureStats(ptr).getHealth().getCurrent() - damage;
@ -815,7 +811,7 @@ namespace MWClass
const MWWorld::Ptr& actor) const const MWWorld::Ptr& actor) const
{ {
// player got activated by another NPC // player got activated by another NPC
if(ptr.getRefData().getHandle() == "player") if(ptr == MWBase::Environment::get().getWorld()->getPlayerPtr())
return boost::shared_ptr<MWWorld::Action>(new MWWorld::ActionTalk(actor)); return boost::shared_ptr<MWWorld::Action>(new MWWorld::ActionTalk(actor));
// Werewolfs can't activate NPCs // Werewolfs can't activate NPCs

@ -38,8 +38,6 @@ namespace MWClass
const ESM::GameSetting *fKnockDownMult; const ESM::GameSetting *fKnockDownMult;
const ESM::GameSetting *iKnockDownOddsMult; const ESM::GameSetting *iKnockDownOddsMult;
const ESM::GameSetting *iKnockDownOddsBase; const ESM::GameSetting *iKnockDownOddsBase;
const ESM::GameSetting *fDamageStrengthBase;
const ESM::GameSetting *fDamageStrengthMult;
const ESM::GameSetting *fCombatArmorMinMult; const ESM::GameSetting *fCombatArmorMinMult;
}; };

@ -179,10 +179,7 @@ namespace MWDialogue
bool isCompanion = !mActor.getClass().getScript(mActor).empty() bool isCompanion = !mActor.getClass().getScript(mActor).empty()
&& mActor.getRefData().getLocals().getIntVar(mActor.getClass().getScript(mActor), "companion"); && mActor.getRefData().getLocals().getIntVar(mActor.getClass().getScript(mActor), "companion");
if (isCompanion) if (isCompanion)
{
MWBase::Environment::get().getWindowManager()->pushGuiMode(MWGui::GM_Companion);
MWBase::Environment::get().getWindowManager()->showCompanionWindow(mActor); MWBase::Environment::get().getWindowManager()->showCompanionWindow(mActor);
}
} }
bool DialogueManager::compile (const std::string& cmd,std::vector<Interpreter::Type_Code>& code) bool DialogueManager::compile (const std::string& cmd,std::vector<Interpreter::Type_Code>& code)
@ -383,7 +380,8 @@ namespace MWDialogue
|| services & ESM::NPC::Misc) || services & ESM::NPC::Misc)
windowServices |= MWGui::DialogueWindow::Service_Trade; windowServices |= MWGui::DialogueWindow::Service_Trade;
if(mActor.getTypeName() == typeid(ESM::NPC).name() && !mActor.get<ESM::NPC>()->mBase->mTransport.empty()) if((mActor.getTypeName() == typeid(ESM::NPC).name() && !mActor.get<ESM::NPC>()->mBase->getTransport().empty())
|| (mActor.getTypeName() == typeid(ESM::Creature).name() && !mActor.get<ESM::Creature>()->mBase->getTransport().empty()))
windowServices |= MWGui::DialogueWindow::Service_Travel; windowServices |= MWGui::DialogueWindow::Service_Travel;
if (services & ESM::NPC::Spells) if (services & ESM::NPC::Spells)

@ -73,7 +73,7 @@ namespace MWGui
mPages.clear(); mPages.clear();
} }
void BookWindow::open (MWWorld::Ptr book) void BookWindow::open (MWWorld::Ptr book, bool showTakeButton)
{ {
mBook = book; mBook = book;
@ -90,7 +90,7 @@ namespace MWGui
updatePages(); updatePages();
setTakeButtonShow(true); setTakeButtonShow(showTakeButton);
} }
void BookWindow::exit() void BookWindow::exit()

@ -16,10 +16,7 @@ namespace MWGui
virtual void exit(); virtual void exit();
void open(MWWorld::Ptr book); void open(MWWorld::Ptr book, bool showTakeButton);
void setTakeButtonShow(bool show);
void nextPage();
void prevPage();
void setInventoryAllowed(bool allowed); void setInventoryAllowed(bool allowed);
protected: protected:
@ -28,6 +25,10 @@ namespace MWGui
void onCloseButtonClicked (MyGUI::Widget* sender); void onCloseButtonClicked (MyGUI::Widget* sender);
void onTakeButtonClicked (MyGUI::Widget* sender); void onTakeButtonClicked (MyGUI::Widget* sender);
void onMouseWheel(MyGUI::Widget* _sender, int _rel); void onMouseWheel(MyGUI::Widget* _sender, int _rel);
void setTakeButtonShow(bool show);
void nextPage();
void prevPage();
void updatePages(); void updatePages();
void clearPages(); void clearPages();

@ -330,20 +330,7 @@ namespace MWGui
updatePlayerHealth(); updatePlayerHealth();
//TODO This bit gets repeated a few times; wrap it in a function handleDialogDone(CSE_ClassChosen, GM_Birth);
MWBase::Environment::get().getWindowManager()->popGuiMode();
if (mCreationStage == CSE_ReviewNext)
{
MWBase::Environment::get().getWindowManager()->pushGuiMode(GM_Review);
}
else if (mCreationStage >= CSE_ClassChosen)
{
MWBase::Environment::get().getWindowManager()->pushGuiMode(GM_Birth);
}
else
{
mCreationStage = CSE_ClassChosen;
}
} }
void CharacterCreation::onPickClassDialogBack() void CharacterCreation::onPickClassDialogBack()
@ -397,19 +384,7 @@ namespace MWGui
mNameDialog = 0; mNameDialog = 0;
} }
MWBase::Environment::get().getWindowManager()->popGuiMode(); handleDialogDone(CSE_NameChosen, GM_Race);
if (mCreationStage == CSE_ReviewNext)
{
MWBase::Environment::get().getWindowManager()->pushGuiMode(GM_Review);
}
else if (mCreationStage >= CSE_NameChosen)
{
MWBase::Environment::get().getWindowManager()->pushGuiMode(GM_Race);
}
else
{
mCreationStage = CSE_NameChosen;
}
} }
void CharacterCreation::onRaceDialogBack() void CharacterCreation::onRaceDialogBack()
@ -456,19 +431,7 @@ namespace MWGui
updatePlayerHealth(); updatePlayerHealth();
MWBase::Environment::get().getWindowManager()->popGuiMode(); handleDialogDone(CSE_RaceChosen, GM_Class);
if (mCreationStage == CSE_ReviewNext)
{
MWBase::Environment::get().getWindowManager()->pushGuiMode(GM_Review);
}
else if (mCreationStage >= CSE_RaceChosen)
{
MWBase::Environment::get().getWindowManager()->pushGuiMode(GM_Class);
}
else
{
mCreationStage = CSE_RaceChosen;
}
} }
void CharacterCreation::onBirthSignDialogDone(WindowBase* parWindow) void CharacterCreation::onBirthSignDialogDone(WindowBase* parWindow)
@ -484,15 +447,7 @@ namespace MWGui
updatePlayerHealth(); updatePlayerHealth();
MWBase::Environment::get().getWindowManager()->popGuiMode(); handleDialogDone(CSE_BirthSignChosen, GM_Review);
if (mCreationStage >= CSE_BirthSignChosen)
{
MWBase::Environment::get().getWindowManager()->pushGuiMode(GM_Review);
}
else
{
mCreationStage = CSE_BirthSignChosen;
}
} }
void CharacterCreation::onBirthSignDialogBack() void CharacterCreation::onBirthSignDialogBack()
@ -543,19 +498,7 @@ namespace MWGui
updatePlayerHealth(); updatePlayerHealth();
MWBase::Environment::get().getWindowManager()->popGuiMode(); handleDialogDone(CSE_ClassChosen, GM_Birth);
if (mCreationStage == CSE_ReviewNext)
{
MWBase::Environment::get().getWindowManager()->pushGuiMode(GM_Review);
}
else if (mCreationStage >= CSE_ClassChosen)
{
MWBase::Environment::get().getWindowManager()->pushGuiMode(GM_Birth);
}
else
{
mCreationStage = CSE_ClassChosen;
}
} }
void CharacterCreation::onCreateClassDialogBack() void CharacterCreation::onCreateClassDialogBack()
@ -711,19 +654,7 @@ namespace MWGui
updatePlayerHealth(); updatePlayerHealth();
MWBase::Environment::get().getWindowManager()->popGuiMode(); handleDialogDone(CSE_ClassChosen, GM_Birth);
if (mCreationStage == CSE_ReviewNext)
{
MWBase::Environment::get().getWindowManager()->pushGuiMode(GM_Review);
}
else if (mCreationStage >= CSE_ClassChosen)
{
MWBase::Environment::get().getWindowManager()->pushGuiMode(GM_Birth);
}
else
{
mCreationStage = CSE_ClassChosen;
}
} }
CharacterCreation::~CharacterCreation() CharacterCreation::~CharacterCreation()
@ -739,4 +670,20 @@ namespace MWGui
delete mReviewDialog; delete mReviewDialog;
} }
void CharacterCreation::handleDialogDone(CSE currentStage, int nextMode)
{
MWBase::Environment::get().getWindowManager()->popGuiMode();
if (mCreationStage == CSE_ReviewNext)
{
MWBase::Environment::get().getWindowManager()->pushGuiMode(GM_Review);
}
else if (mCreationStage >= currentStage)
{
MWBase::Environment::get().getWindowManager()->pushGuiMode((GuiMode)nextMode);
}
else
{
mCreationStage = currentStage;
}
}
} }

@ -104,6 +104,8 @@ namespace MWGui
}; };
CSE mCreationStage; // Which state the character creating is in, controls back/next/ok buttons CSE mCreationStage; // Which state the character creating is in, controls back/next/ok buttons
void handleDialogDone(CSE currentStage, int nextMode);
}; };
} }

@ -7,12 +7,14 @@
#include <MyGUI_ProgressBar.h> #include <MyGUI_ProgressBar.h>
#include <components/widgets/list.hpp> #include <components/widgets/list.hpp>
#include <components/translation/translation.hpp>
#include "../mwbase/environment.hpp" #include "../mwbase/environment.hpp"
#include "../mwbase/windowmanager.hpp" #include "../mwbase/windowmanager.hpp"
#include "../mwbase/mechanicsmanager.hpp" #include "../mwbase/mechanicsmanager.hpp"
#include "../mwbase/world.hpp" #include "../mwbase/world.hpp"
#include "../mwbase/soundmanager.hpp" #include "../mwbase/soundmanager.hpp"
#include "../mwbase/dialoguemanager.hpp"
#include "../mwmechanics/npcstats.hpp" #include "../mwmechanics/npcstats.hpp"
@ -20,12 +22,7 @@
#include "../mwworld/containerstore.hpp" #include "../mwworld/containerstore.hpp"
#include "../mwworld/esmstore.hpp" #include "../mwworld/esmstore.hpp"
#include "../mwdialogue/dialoguemanagerimp.hpp"
#include "widgets.hpp" #include "widgets.hpp"
#include "tradewindow.hpp"
#include "spellbuyingwindow.hpp"
#include "travelwindow.hpp"
#include "bookpage.hpp" #include "bookpage.hpp"
#include "journalbooks.hpp" // to_utf8_span #include "journalbooks.hpp" // to_utf8_span
@ -337,51 +334,25 @@ namespace MWGui
MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>(); MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>();
if (topic == gmst.find("sPersuasion")->getString()) if (topic == gmst.find("sPersuasion")->getString())
{
mPersuasionDialog.setVisible(true); mPersuasionDialog.setVisible(true);
}
else if (topic == gmst.find("sCompanionShare")->getString()) else if (topic == gmst.find("sCompanionShare")->getString())
{
MWBase::Environment::get().getWindowManager()->pushGuiMode(GM_Companion);
MWBase::Environment::get().getWindowManager()->showCompanionWindow(mPtr); MWBase::Environment::get().getWindowManager()->showCompanionWindow(mPtr);
}
else if (!MWBase::Environment::get().getDialogueManager()->checkServiceRefused()) else if (!MWBase::Environment::get().getDialogueManager()->checkServiceRefused())
{ {
if (topic == gmst.find("sBarter")->getString()) if (topic == gmst.find("sBarter")->getString())
{ MWBase::Environment::get().getWindowManager()->startTrade(mPtr);
MWBase::Environment::get().getWindowManager()->pushGuiMode(GM_Barter);
MWBase::Environment::get().getWindowManager()->getTradeWindow()->startTrade(mPtr);
}
else if (topic == gmst.find("sSpells")->getString()) else if (topic == gmst.find("sSpells")->getString())
{ MWBase::Environment::get().getWindowManager()->startSpellBuying(mPtr);
MWBase::Environment::get().getWindowManager()->pushGuiMode(GM_SpellBuying);
MWBase::Environment::get().getWindowManager()->getSpellBuyingWindow()->startSpellBuying(mPtr);
}
else if (topic == gmst.find("sTravel")->getString()) else if (topic == gmst.find("sTravel")->getString())
{ MWBase::Environment::get().getWindowManager()->startTravel(mPtr);
MWBase::Environment::get().getWindowManager()->pushGuiMode(GM_Travel);
MWBase::Environment::get().getWindowManager()->getTravelWindow()->startTravel(mPtr);
}
else if (topic == gmst.find("sSpellMakingMenuTitle")->getString()) else if (topic == gmst.find("sSpellMakingMenuTitle")->getString())
{
MWBase::Environment::get().getWindowManager()->pushGuiMode(GM_SpellCreation);
MWBase::Environment::get().getWindowManager()->startSpellMaking (mPtr); MWBase::Environment::get().getWindowManager()->startSpellMaking (mPtr);
}
else if (topic == gmst.find("sEnchanting")->getString()) else if (topic == gmst.find("sEnchanting")->getString())
{
MWBase::Environment::get().getWindowManager()->pushGuiMode(GM_Enchanting);
MWBase::Environment::get().getWindowManager()->startEnchanting (mPtr); MWBase::Environment::get().getWindowManager()->startEnchanting (mPtr);
}
else if (topic == gmst.find("sServiceTrainingTitle")->getString()) else if (topic == gmst.find("sServiceTrainingTitle")->getString())
{
MWBase::Environment::get().getWindowManager()->pushGuiMode(GM_Training);
MWBase::Environment::get().getWindowManager()->startTraining (mPtr); MWBase::Environment::get().getWindowManager()->startTraining (mPtr);
}
else if (topic == gmst.find("sRepair")->getString()) else if (topic == gmst.find("sRepair")->getString())
{
MWBase::Environment::get().getWindowManager()->pushGuiMode(GM_MerchantRepair);
MWBase::Environment::get().getWindowManager()->startRepair (mPtr); MWBase::Environment::get().getWindowManager()->startRepair (mPtr);
}
} }
} }
} }
@ -440,8 +411,6 @@ namespace MWGui
bool isCompanion = !mPtr.getClass().getScript(mPtr).empty() bool isCompanion = !mPtr.getClass().getScript(mPtr).empty()
&& mPtr.getRefData().getLocals().getIntVar(mPtr.getClass().getScript(mPtr), "companion"); && mPtr.getRefData().getLocals().getIntVar(mPtr.getClass().getScript(mPtr), "companion");
bool anyService = mServices > 0 || isCompanion || mPtr.getTypeName() == typeid(ESM::NPC).name();
const MWWorld::Store<ESM::GameSetting> &gmst = const MWWorld::Store<ESM::GameSetting> &gmst =
MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>(); MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>();
@ -472,7 +441,7 @@ namespace MWGui
if (isCompanion) if (isCompanion)
mTopicsList->addItem(gmst.find("sCompanionShare")->getString()); mTopicsList->addItem(gmst.find("sCompanionShare")->getString());
if (anyService) if (mTopicsList->getItemCount() > 0)
mTopicsList->addSeparator(); mTopicsList->addSeparator();

@ -24,7 +24,6 @@
#include "../mwmechanics/npcstats.hpp" #include "../mwmechanics/npcstats.hpp"
#include "inventorywindow.hpp" #include "inventorywindow.hpp"
#include "console.hpp"
#include "spellicons.hpp" #include "spellicons.hpp"
#include "itemmodel.hpp" #include "itemmodel.hpp"
#include "draganddrop.hpp" #include "draganddrop.hpp"
@ -309,7 +308,7 @@ namespace MWGui
MWWorld::Ptr object = MWBase::Environment::get().getWorld()->getFacedObject(); MWWorld::Ptr object = MWBase::Environment::get().getWorld()->getFacedObject();
if (mode == GM_Console) if (mode == GM_Console)
MWBase::Environment::get().getWindowManager()->getConsole()->setSelectedObject(object); MWBase::Environment::get().getWindowManager()->setConsoleSelectedObject(object);
else if ((mode == GM_Container) || (mode == GM_Inventory)) else if ((mode == GM_Container) || (mode == GM_Inventory))
{ {
// pick up object // pick up object

@ -23,9 +23,6 @@
#include "../mwbase/scriptmanager.hpp" #include "../mwbase/scriptmanager.hpp"
#include "../mwrender/characterpreview.hpp" #include "../mwrender/characterpreview.hpp"
#include "bookwindow.hpp"
#include "scrollwindow.hpp"
#include "spellwindow.hpp"
#include "itemview.hpp" #include "itemview.hpp"
#include "inventoryitemmodel.hpp" #include "inventoryitemmodel.hpp"
#include "sortfilteritemmodel.hpp" #include "sortfilteritemmodel.hpp"
@ -317,8 +314,7 @@ namespace MWGui
void InventoryWindow::updateItemView() void InventoryWindow::updateItemView()
{ {
if (MWBase::Environment::get().getWindowManager()->getSpellWindow()) MWBase::Environment::get().getWindowManager()->updateSpellWindow();
MWBase::Environment::get().getWindowManager()->getSpellWindow()->updateSpells();
mItemView->update(); mItemView->update();
mPreviewDirty = true; mPreviewDirty = true;
@ -432,13 +428,6 @@ namespace MWGui
action->execute (MWBase::Environment::get().getWorld()->getPlayerPtr()); action->execute (MWBase::Environment::get().getWorld()->getPlayerPtr());
// this is necessary for books/scrolls: if they are already in the player's inventory,
// the "Take" button should not be visible.
// NOTE: the take button is "reset" when the window opens, so we can safely do the following
// without screwing up future book windows
MWBase::Environment::get().getWindowManager()->getBookWindow()->setTakeButtonShow(false);
MWBase::Environment::get().getWindowManager()->getScrollWindow()->setTakeButtonShow(false);
mSkippedToEquip = MWWorld::Ptr(); mSkippedToEquip = MWWorld::Ptr();
} }
else else
@ -568,8 +557,7 @@ namespace MWGui
void InventoryWindow::notifyContentChanged() void InventoryWindow::notifyContentChanged()
{ {
// update the spell window just in case new enchanted items were added to inventory // update the spell window just in case new enchanted items were added to inventory
if (MWBase::Environment::get().getWindowManager()->getSpellWindow()) MWBase::Environment::get().getWindowManager()->updateSpellWindow();
MWBase::Environment::get().getWindowManager()->getSpellWindow()->updateSpells();
MWBase::Environment::get().getMechanicsManager()->updateMagicEffects( MWBase::Environment::get().getMechanicsManager()->updateMagicEffects(
MWBase::Environment::get().getWorld()->getPlayerPtr()); MWBase::Environment::get().getWorld()->getPlayerPtr());
@ -626,8 +614,7 @@ namespace MWGui
MWBase::Environment::get().getMechanicsManager()->itemTaken(player, newObject, MWWorld::Ptr(), count); MWBase::Environment::get().getMechanicsManager()->itemTaken(player, newObject, MWWorld::Ptr(), count);
if (MWBase::Environment::get().getWindowManager()->getSpellWindow()) MWBase::Environment::get().getWindowManager()->updateSpellWindow();
MWBase::Environment::get().getWindowManager()->getSpellWindow()->updateSpells();
} }
void InventoryWindow::cycle(bool next) void InventoryWindow::cycle(bool next)

@ -94,12 +94,24 @@ namespace MWGui
while (key->getChildCount()) // Destroy number label while (key->getChildCount()) // Destroy number label
MyGUI::Gui::getInstance().destroyWidget(key->getChildAt(0)); MyGUI::Gui::getInstance().destroyWidget(key->getChildAt(0));
mAssigned[index] = Type_Unassigned; if (index == 9)
{
mAssigned[index] = Type_HandToHand;
MyGUI::ImageBox* image = key->createWidget<MyGUI::ImageBox>("ImageBox",
MyGUI::IntCoord(14, 13, 32, 32), MyGUI::Align::Default);
image->setImageTexture("icons\\k\\stealth_handtohand.dds");
image->setNeedMouseFocus(false);
}
else
{
mAssigned[index] = Type_Unassigned;
MyGUI::TextBox* textBox = key->createWidgetReal<MyGUI::TextBox>("SandText", MyGUI::FloatCoord(0,0,1,1), MyGUI::Align::Default); MyGUI::TextBox* textBox = key->createWidgetReal<MyGUI::TextBox>("SandText", MyGUI::FloatCoord(0,0,1,1), MyGUI::Align::Default);
textBox->setTextAlign (MyGUI::Align::Center); textBox->setTextAlign (MyGUI::Align::Center);
textBox->setCaption (MyGUI::utility::toString(index+1)); textBox->setCaption (MyGUI::utility::toString(index+1));
textBox->setNeedMouseFocus (false); textBox->setNeedMouseFocus (false);
}
} }
void QuickKeysMenu::onQuickKeyButtonClicked(MyGUI::Widget* sender) void QuickKeysMenu::onQuickKeyButtonClicked(MyGUI::Widget* sender)
@ -338,6 +350,11 @@ namespace MWGui
store.setSelectedEnchantItem(it); store.setSelectedEnchantItem(it);
MWBase::Environment::get().getWorld()->getPlayer().setDrawState(MWMechanics::DrawState_Spell); MWBase::Environment::get().getWorld()->getPlayer().setDrawState(MWMechanics::DrawState_Spell);
} }
else if (type == Type_HandToHand)
{
store.unequipSlot(MWWorld::InventoryStore::Slot_CarriedRight, player);
MWBase::Environment::get().getWorld()->getPlayer().setDrawState(MWMechanics::DrawState_Weapon);
}
} }
// --------------------------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------------------------
@ -409,6 +426,7 @@ namespace MWGui
switch (type) switch (type)
{ {
case Type_Unassigned: case Type_Unassigned:
case Type_HandToHand:
break; break;
case Type_Item: case Type_Item:
case Type_MagicItem: case Type_MagicItem:
@ -489,6 +507,7 @@ namespace MWGui
break; break;
} }
case Type_Unassigned: case Type_Unassigned:
case Type_HandToHand:
unassign(button, i); unassign(button, i);
break; break;
} }

@ -37,15 +37,16 @@ namespace MWGui
void activateQuickKey(int index); void activateQuickKey(int index);
/// @note This enum is serialized, so don't move the items around!
enum QuickKeyType enum QuickKeyType
{ {
Type_Item, Type_Item,
Type_Magic, Type_Magic,
Type_MagicItem, Type_MagicItem,
Type_Unassigned Type_Unassigned,
Type_HandToHand
}; };
void write (ESM::ESMWriter& writer); void write (ESM::ESMWriter& writer);
void readRecord (ESM::ESMReader& reader, uint32_t type); void readRecord (ESM::ESMReader& reader, uint32_t type);
void clear(); void clear();

@ -48,7 +48,7 @@ namespace MWGui
center(); center();
} }
void ScrollWindow::open (MWWorld::Ptr scroll) void ScrollWindow::open (MWWorld::Ptr scroll, bool showTakeButton)
{ {
// no 3d sounds because the object could be in a container. // no 3d sounds because the object could be in a container.
MWBase::Environment::get().getSoundManager()->playSound ("scroll", 1.0, 1.0); MWBase::Environment::get().getSoundManager()->playSound ("scroll", 1.0, 1.0);
@ -71,7 +71,7 @@ namespace MWGui
mTextView->setViewOffset(MyGUI::IntPoint(0,0)); mTextView->setViewOffset(MyGUI::IntPoint(0,0));
setTakeButtonShow(true); setTakeButtonShow(showTakeButton);
} }
void ScrollWindow::exit() void ScrollWindow::exit()

@ -17,14 +17,14 @@ namespace MWGui
public: public:
ScrollWindow (); ScrollWindow ();
void open (MWWorld::Ptr scroll); void open (MWWorld::Ptr scroll, bool showTakeButton);
virtual void exit(); virtual void exit();
void setTakeButtonShow(bool show);
void setInventoryAllowed(bool allowed); void setInventoryAllowed(bool allowed);
protected: protected:
void onCloseButtonClicked (MyGUI::Widget* _sender); void onCloseButtonClicked (MyGUI::Widget* _sender);
void onTakeButtonClicked (MyGUI::Widget* _sender); void onTakeButtonClicked (MyGUI::Widget* _sender);
void setTakeButtonShow(bool show);
private: private:
Gui::ImageButton* mCloseButton; Gui::ImageButton* mCloseButton;

@ -111,20 +111,26 @@ namespace MWGui
mPtr = actor; mPtr = actor;
clearDestinations(); clearDestinations();
for(unsigned int i = 0;i<mPtr.get<ESM::NPC>()->mBase->mTransport.size();i++) std::vector<ESM::Transport::Dest> transport;
if (mPtr.getClass().isNpc())
transport = mPtr.get<ESM::NPC>()->mBase->getTransport();
else if (mPtr.getTypeName() == typeid(ESM::Creature).name())
transport = mPtr.get<ESM::Creature>()->mBase->getTransport();
for(unsigned int i = 0;i<transport.size();i++)
{ {
std::string cellname = mPtr.get<ESM::NPC>()->mBase->mTransport[i].mCellName; std::string cellname = transport[i].mCellName;
bool interior = true; bool interior = true;
int x,y; int x,y;
MWBase::Environment::get().getWorld()->positionToIndex(mPtr.get<ESM::NPC>()->mBase->mTransport[i].mPos.pos[0], MWBase::Environment::get().getWorld()->positionToIndex(transport[i].mPos.pos[0],
mPtr.get<ESM::NPC>()->mBase->mTransport[i].mPos.pos[1],x,y); transport[i].mPos.pos[1],x,y);
if (cellname == "") if (cellname == "")
{ {
MWWorld::CellStore* cell = MWBase::Environment::get().getWorld()->getExterior(x,y); MWWorld::CellStore* cell = MWBase::Environment::get().getWorld()->getExterior(x,y);
cellname = MWBase::Environment::get().getWorld()->getCellName(cell); cellname = MWBase::Environment::get().getWorld()->getCellName(cell);
interior = false; interior = false;
} }
addDestination(cellname,mPtr.get<ESM::NPC>()->mBase->mTransport[i].mPos,interior); addDestination(cellname,transport[i].mPos,interior);
} }
updateLabels(); updateLabels();

@ -715,16 +715,6 @@ namespace MWGui
mPlayerMinorSkills = minor; mPlayerMinorSkills = minor;
} }
void WindowManager::setReputation (int reputation)
{
mStatsWindow->setReputation (reputation);
}
void WindowManager::setBounty (int bounty)
{
mStatsWindow->setBounty (bounty);
}
void WindowManager::updateSkillArea() void WindowManager::updateSkillArea()
{ {
mStatsWindow->updateSkillArea(); mStatsWindow->updateSkillArea();
@ -1287,17 +1277,10 @@ namespace MWGui
} }
MWGui::DialogueWindow* WindowManager::getDialogueWindow() { return mDialogueWindow; } MWGui::DialogueWindow* WindowManager::getDialogueWindow() { return mDialogueWindow; }
MWGui::ContainerWindow* WindowManager::getContainerWindow() { return mContainerWindow; }
MWGui::InventoryWindow* WindowManager::getInventoryWindow() { return mInventoryWindow; } MWGui::InventoryWindow* WindowManager::getInventoryWindow() { return mInventoryWindow; }
MWGui::BookWindow* WindowManager::getBookWindow() { return mBookWindow; }
MWGui::ScrollWindow* WindowManager::getScrollWindow() { return mScrollWindow; }
MWGui::CountDialog* WindowManager::getCountDialog() { return mCountDialog; } MWGui::CountDialog* WindowManager::getCountDialog() { return mCountDialog; }
MWGui::ConfirmationDialog* WindowManager::getConfirmationDialog() { return mConfirmationDialog; } MWGui::ConfirmationDialog* WindowManager::getConfirmationDialog() { return mConfirmationDialog; }
MWGui::TradeWindow* WindowManager::getTradeWindow() { return mTradeWindow; } MWGui::TradeWindow* WindowManager::getTradeWindow() { return mTradeWindow; }
MWGui::SpellBuyingWindow* WindowManager::getSpellBuyingWindow() { return mSpellBuyingWindow; }
MWGui::TravelWindow* WindowManager::getTravelWindow() { return mTravelWindow; }
MWGui::SpellWindow* WindowManager::getSpellWindow() { return mSpellWindow; }
MWGui::Console* WindowManager::getConsole() { return mConsole; }
bool WindowManager::isAllowed (GuiWindow wnd) const bool WindowManager::isAllowed (GuiWindow wnd) const
{ {
@ -1459,11 +1442,13 @@ namespace MWGui
void WindowManager::startSpellMaking(MWWorld::Ptr actor) void WindowManager::startSpellMaking(MWWorld::Ptr actor)
{ {
pushGuiMode(GM_SpellCreation);
mSpellCreationDialog->startSpellMaking (actor); mSpellCreationDialog->startSpellMaking (actor);
} }
void WindowManager::startEnchanting (MWWorld::Ptr actor) void WindowManager::startEnchanting (MWWorld::Ptr actor)
{ {
pushGuiMode(GM_Enchanting);
mEnchantingDialog->startEnchanting (actor); mEnchantingDialog->startEnchanting (actor);
} }
@ -1474,16 +1459,19 @@ namespace MWGui
void WindowManager::startTraining(MWWorld::Ptr actor) void WindowManager::startTraining(MWWorld::Ptr actor)
{ {
pushGuiMode(GM_Training);
mTrainingWindow->startTraining(actor); mTrainingWindow->startTraining(actor);
} }
void WindowManager::startRepair(MWWorld::Ptr actor) void WindowManager::startRepair(MWWorld::Ptr actor)
{ {
pushGuiMode(GM_MerchantRepair);
mMerchantRepair->startRepair(actor); mMerchantRepair->startRepair(actor);
} }
void WindowManager::startRepairItem(MWWorld::Ptr item) void WindowManager::startRepairItem(MWWorld::Ptr item)
{ {
pushGuiMode(MWGui::GM_Repair);
mRepair->startRepairItem(item); mRepair->startRepairItem(item);
} }
@ -1494,6 +1482,7 @@ namespace MWGui
void WindowManager::showCompanionWindow(MWWorld::Ptr actor) void WindowManager::showCompanionWindow(MWWorld::Ptr actor)
{ {
pushGuiMode(MWGui::GM_Companion);
mCompanionWindow->open(actor); mCompanionWindow->open(actor);
} }
@ -1744,12 +1733,10 @@ namespace MWGui
mVideoWidget->autoResize(stretch); mVideoWidget->autoResize(stretch);
} }
WindowModal* WindowManager::getCurrentModal() const void WindowManager::exitCurrentModal()
{ {
if(!mCurrentModals.empty()) if (!mCurrentModals.empty())
return mCurrentModals.top(); mCurrentModals.top()->exit();
else
return NULL;
} }
void WindowManager::removeCurrentModal(WindowModal* input) void WindowManager::removeCurrentModal(WindowModal* input)
@ -1874,4 +1861,51 @@ namespace MWGui
mInventoryWindow->cycle(next); mInventoryWindow->cycle(next);
} }
void WindowManager::setConsoleSelectedObject(const MWWorld::Ptr &object)
{
mConsole->setSelectedObject(object);
}
void WindowManager::updateSpellWindow()
{
if (mSpellWindow)
mSpellWindow->updateSpells();
}
void WindowManager::startTravel(const MWWorld::Ptr &actor)
{
pushGuiMode(GM_Travel);
mTravelWindow->startTravel(actor);
}
void WindowManager::startSpellBuying(const MWWorld::Ptr &actor)
{
pushGuiMode(GM_SpellBuying);
mSpellBuyingWindow->startSpellBuying(actor);
}
void WindowManager::startTrade(const MWWorld::Ptr &actor)
{
pushGuiMode(GM_Barter);
mTradeWindow->startTrade(actor);
}
void WindowManager::openContainer(const MWWorld::Ptr &container, bool loot)
{
pushGuiMode(GM_Container);
mContainerWindow->open(container, loot);
}
void WindowManager::showBook(const MWWorld::Ptr &item, bool showTakeButton)
{
pushGuiMode(GM_Book);
mBookWindow->open(item, showTakeButton);
}
void WindowManager::showScroll(const MWWorld::Ptr &item, bool showTakeButton)
{
pushGuiMode(GM_Scroll);
mScrollWindow->open(item, showTakeButton);
}
} }

@ -154,17 +154,14 @@ namespace MWGui
/// \todo investigate, if we really need to expose every single lousy UI element to the outside world /// \todo investigate, if we really need to expose every single lousy UI element to the outside world
virtual MWGui::DialogueWindow* getDialogueWindow(); virtual MWGui::DialogueWindow* getDialogueWindow();
virtual MWGui::ContainerWindow* getContainerWindow();
virtual MWGui::InventoryWindow* getInventoryWindow(); virtual MWGui::InventoryWindow* getInventoryWindow();
virtual MWGui::BookWindow* getBookWindow();
virtual MWGui::ScrollWindow* getScrollWindow();
virtual MWGui::CountDialog* getCountDialog(); virtual MWGui::CountDialog* getCountDialog();
virtual MWGui::ConfirmationDialog* getConfirmationDialog(); virtual MWGui::ConfirmationDialog* getConfirmationDialog();
virtual MWGui::TradeWindow* getTradeWindow(); virtual MWGui::TradeWindow* getTradeWindow();
virtual MWGui::SpellBuyingWindow* getSpellBuyingWindow();
virtual MWGui::TravelWindow* getTravelWindow(); virtual void updateSpellWindow();
virtual MWGui::SpellWindow* getSpellWindow();
virtual MWGui::Console* getConsole(); virtual void setConsoleSelectedObject(const MWWorld::Ptr& object);
virtual void wmUpdateFps(float fps, unsigned int triangleCount, unsigned int batchCount); virtual void wmUpdateFps(float fps, unsigned int triangleCount, unsigned int batchCount);
@ -182,8 +179,6 @@ namespace MWGui
virtual void setPlayerClass (const ESM::Class &class_); ///< set current class of player virtual void setPlayerClass (const ESM::Class &class_); ///< set current class of player
virtual void configureSkills (const SkillList& major, const SkillList& minor); ///< configure skill groups, each set contains the skill ID for that group. virtual void configureSkills (const SkillList& major, const SkillList& minor); ///< configure skill groups, each set contains the skill ID for that group.
virtual void setReputation (int reputation); ///< set the current reputation value
virtual void setBounty (int bounty); ///< set the current bounty value
virtual void updateSkillArea(); ///< update display of skills, factions, birth sign, reputation and bounty virtual void updateSkillArea(); ///< update display of skills, factions, birth sign, reputation and bounty
virtual void changeCell(MWWorld::CellStore* cell); ///< change the active cell virtual void changeCell(MWWorld::CellStore* cell); ///< change the active cell
@ -292,6 +287,12 @@ namespace MWGui
virtual void startRepair(MWWorld::Ptr actor); virtual void startRepair(MWWorld::Ptr actor);
virtual void startRepairItem(MWWorld::Ptr item); virtual void startRepairItem(MWWorld::Ptr item);
virtual void startRecharge(MWWorld::Ptr soulgem); virtual void startRecharge(MWWorld::Ptr soulgem);
virtual void startTravel(const MWWorld::Ptr& actor);
virtual void startSpellBuying(const MWWorld::Ptr &actor);
virtual void startTrade(const MWWorld::Ptr &actor);
virtual void openContainer(const MWWorld::Ptr &container, bool loot);
virtual void showBook(const MWWorld::Ptr& item, bool showTakeButton);
virtual void showScroll(const MWWorld::Ptr& item, bool showTakeButton);
virtual void frameStarted(float dt); virtual void frameStarted(float dt);
@ -317,9 +318,8 @@ namespace MWGui
/// Does the current stack of GUI-windows permit saving? /// Does the current stack of GUI-windows permit saving?
virtual bool isSavingAllowed() const; virtual bool isSavingAllowed() const;
/// Returns the current Modal /// Send exit command to active Modal window **/
/** Used to send exit command to active Modal when Esc is pressed **/ virtual void exitCurrentModal();
virtual WindowModal* getCurrentModal() const;
/// Sets the current Modal /// Sets the current Modal
/** Used to send exit command to active Modal when Esc is pressed **/ /** Used to send exit command to active Modal when Esc is pressed **/

@ -33,8 +33,6 @@
#include "../mwdialogue/dialoguemanagerimp.hpp" #include "../mwdialogue/dialoguemanagerimp.hpp"
#include "../mwgui/windowbase.hpp"
#include <iostream> #include <iostream>
using namespace ICS; using namespace ICS;
@ -898,7 +896,7 @@ namespace MWInput
void InputManager::toggleMainMenu() void InputManager::toggleMainMenu()
{ {
if (MyGUI::InputManager::getInstance().isModalAny()) { if (MyGUI::InputManager::getInstance().isModalAny()) {
MWBase::Environment::get().getWindowManager()->getCurrentModal()->exit(); MWBase::Environment::get().getWindowManager()->exitCurrentModal();
return; return;
} }
@ -1072,7 +1070,7 @@ namespace MWInput
} }
else if (MWBase::Environment::get().getWindowManager()->getMode () == MWGui::GM_QuickKeysMenu) { else if (MWBase::Environment::get().getWindowManager()->getMode () == MWGui::GM_QuickKeysMenu) {
while(MyGUI::InputManager::getInstance().isModalAny()) { //Handle any open Modal windows while(MyGUI::InputManager::getInstance().isModalAny()) { //Handle any open Modal windows
MWBase::Environment::get().getWindowManager()->getCurrentModal()->exit(); MWBase::Environment::get().getWindowManager()->exitCurrentModal();
} }
MWBase::Environment::get().getWindowManager()->exitCurrentGuiMode(); //And handle the actual main window MWBase::Environment::get().getWindowManager()->exitCurrentGuiMode(); //And handle the actual main window
} }

@ -54,9 +54,17 @@ void adjustBoundItem (const std::string& item, bool bound, const MWWorld::Ptr& a
{ {
if (actor.getClass().getContainerStore(actor).count(item) == 0) if (actor.getClass().getContainerStore(actor).count(item) == 0)
{ {
MWWorld::Ptr newPtr = *actor.getClass().getContainerStore(actor).add(item, 1, actor); MWWorld::InventoryStore& store = actor.getClass().getInventoryStore(actor);
MWWorld::Ptr newPtr = *store.MWWorld::ContainerStore::add(item, 1, actor);
MWWorld::ActionEquip action(newPtr); MWWorld::ActionEquip action(newPtr);
action.execute(actor); action.execute(actor);
MWWorld::ContainerStoreIterator rightHand = store.getSlot(MWWorld::InventoryStore::Slot_CarriedRight);
// change draw state only if the item is in player's right hand
if (actor == MWBase::Environment::get().getWorld()->getPlayerPtr()
&& rightHand != store.end() && newPtr == *rightHand)
{
MWBase::Environment::get().getWorld()->getPlayer().setDrawState(MWMechanics::DrawState_Weapon);
}
} }
} }
else else
@ -91,7 +99,7 @@ bool disintegrateSlot (MWWorld::Ptr ptr, int slot, float disintegrate)
if (charge == 0) if (charge == 0)
{ {
// Will unequip the broken item and try to find a replacement // Will unequip the broken item and try to find a replacement
if (ptr.getRefData().getHandle() != "player") if (ptr != MWBase::Environment::get().getWorld()->getPlayerPtr())
inv.autoEquip(ptr); inv.autoEquip(ptr);
else else
inv.unequipItem(*item, ptr); inv.unequipItem(*item, ptr);
@ -146,6 +154,7 @@ void adjustCommandedActor (const MWWorld::Ptr& actor)
if (check.mCommanded && !hasCommandPackage) if (check.mCommanded && !hasCommandPackage)
{ {
// FIXME: don't use refid string
MWMechanics::AiFollow package("player", true); MWMechanics::AiFollow package("player", true);
stats.getAiSequence().stack(package, actor); stats.getAiSequence().stack(package, actor);
} }
@ -236,7 +245,7 @@ namespace MWMechanics
gem->getContainerStore()->unstack(*gem, caster); gem->getContainerStore()->unstack(*gem, caster);
gem->getCellRef().setSoul(mCreature.getCellRef().getRefId()); gem->getCellRef().setSoul(mCreature.getCellRef().getRefId());
if (caster.getRefData().getHandle() == "player") if (caster == MWBase::Environment::get().getWorld()->getPlayerPtr())
MWBase::Environment::get().getWindowManager()->messageBox("#{sSoultrapSuccess}"); MWBase::Environment::get().getWindowManager()->messageBox("#{sSoultrapSuccess}");
const ESM::Static* fx = MWBase::Environment::get().getWorld()->getStore().get<ESM::Static>() const ESM::Static* fx = MWBase::Environment::get().getWorld()->getStore().get<ESM::Static>()
@ -425,7 +434,7 @@ namespace MWMechanics
int intelligence = creatureStats.getAttribute(ESM::Attribute::Intelligence).getModified(); int intelligence = creatureStats.getAttribute(ESM::Attribute::Intelligence).getModified();
float base = 1.f; float base = 1.f;
if (ptr.getCellRef().getRefId() == "player") if (ptr == MWBase::Environment::get().getWorld()->getPlayerPtr())
base = MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>().find("fPCbaseMagickaMult")->getFloat(); base = MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>().find("fPCbaseMagickaMult")->getFloat();
else else
base = MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>().find("fNPCbaseMagickaMult")->getFloat(); base = MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>().find("fNPCbaseMagickaMult")->getFloat();
@ -515,8 +524,8 @@ namespace MWMechanics
for(int i = 0;i < ESM::Attribute::Length;++i) for(int i = 0;i < ESM::Attribute::Length;++i)
{ {
AttributeValue stat = creatureStats.getAttribute(i); AttributeValue stat = creatureStats.getAttribute(i);
stat.setModifiers(effects.get(EffectKey(ESM::MagicEffect::FortifyAttribute, i)).getMagnitude(), stat.setModifier(effects.get(EffectKey(ESM::MagicEffect::FortifyAttribute, i)).getMagnitude() -
effects.get(EffectKey(ESM::MagicEffect::DrainAttribute, i)).getMagnitude(), effects.get(EffectKey(ESM::MagicEffect::DrainAttribute, i)).getMagnitude() -
effects.get(EffectKey(ESM::MagicEffect::AbsorbAttribute, i)).getMagnitude()); effects.get(EffectKey(ESM::MagicEffect::AbsorbAttribute, i)).getMagnitude());
stat.damage(effects.get(EffectKey(ESM::MagicEffect::DamageAttribute, i)).getMagnitude() * duration); stat.damage(effects.get(EffectKey(ESM::MagicEffect::DamageAttribute, i)).getMagnitude() * duration);
@ -535,7 +544,7 @@ namespace MWMechanics
{ {
spells.worsenCorprus(it->first); spells.worsenCorprus(it->first);
if (ptr.getRefData().getHandle() == "player") if (ptr == MWBase::Environment::get().getWorld()->getPlayerPtr())
MWBase::Environment::get().getWindowManager()->messageBox("#{sMagicCorprusWorsens}"); MWBase::Environment::get().getWindowManager()->messageBox("#{sMagicCorprusWorsens}");
} }
} }
@ -547,7 +556,9 @@ namespace MWMechanics
{ {
DynamicStat<float> stat = creatureStats.getDynamic(i); DynamicStat<float> stat = creatureStats.getDynamic(i);
stat.setModifier(effects.get(ESM::MagicEffect::FortifyHealth+i).getMagnitude() - stat.setModifier(effects.get(ESM::MagicEffect::FortifyHealth+i).getMagnitude() -
effects.get(ESM::MagicEffect::DrainHealth+i).getMagnitude()); effects.get(ESM::MagicEffect::DrainHealth+i).getMagnitude(),
// Fatigue can be decreased below zero meaning the actor will be knocked out
i == 2);
float currentDiff = creatureStats.getMagicEffects().get(ESM::MagicEffect::RestoreHealth+i).getMagnitude() float currentDiff = creatureStats.getMagicEffects().get(ESM::MagicEffect::RestoreHealth+i).getMagnitude()
@ -655,7 +666,7 @@ namespace MWMechanics
} }
} }
if (receivedMagicDamage && ptr.getRefData().getHandle() == "player") if (receivedMagicDamage && ptr == MWBase::Environment::get().getWorld()->getPlayerPtr())
MWBase::Environment::get().getWindowManager()->activateHitOverlay(false); MWBase::Environment::get().getWindowManager()->activateHitOverlay(false);
creatureStats.setHealth(health); creatureStats.setHealth(health);
@ -782,8 +793,8 @@ namespace MWMechanics
for(int i = 0;i < ESM::Skill::Length;++i) for(int i = 0;i < ESM::Skill::Length;++i)
{ {
SkillValue& skill = npcStats.getSkill(i); SkillValue& skill = npcStats.getSkill(i);
skill.setModifiers(effects.get(EffectKey(ESM::MagicEffect::FortifySkill, i)).getMagnitude(), skill.setModifier(effects.get(EffectKey(ESM::MagicEffect::FortifySkill, i)).getMagnitude() -
effects.get(EffectKey(ESM::MagicEffect::DrainSkill, i)).getMagnitude(), effects.get(EffectKey(ESM::MagicEffect::DrainSkill, i)).getMagnitude() -
effects.get(EffectKey(ESM::MagicEffect::AbsorbSkill, i)).getMagnitude()); effects.get(EffectKey(ESM::MagicEffect::AbsorbSkill, i)).getMagnitude());
skill.damage(effects.get(EffectKey(ESM::MagicEffect::DamageSkill, i)).getMagnitude() * duration); skill.damage(effects.get(EffectKey(ESM::MagicEffect::DamageSkill, i)).getMagnitude() * duration);
@ -838,7 +849,7 @@ namespace MWMechanics
void Actors::updateEquippedLight (const MWWorld::Ptr& ptr, float duration) void Actors::updateEquippedLight (const MWWorld::Ptr& ptr, float duration)
{ {
bool isPlayer = ptr.getRefData().getHandle()=="player"; bool isPlayer = (ptr == MWBase::Environment::get().getWorld()->getPlayerPtr());
MWWorld::InventoryStore &inventoryStore = ptr.getClass().getInventoryStore(ptr); MWWorld::InventoryStore &inventoryStore = ptr.getClass().getInventoryStore(ptr);
MWWorld::ContainerStoreIterator heldIter = MWWorld::ContainerStoreIterator heldIter =
@ -1147,7 +1158,7 @@ namespace MWMechanics
// Handle player last, in case a cell transition occurs by casting a teleportation spell // Handle player last, in case a cell transition occurs by casting a teleportation spell
// (would invalidate the iterator) // (would invalidate the iterator)
if (iter->first.getCellRef().getRefId() == "player") if (iter->first == MWBase::Environment::get().getWorld()->getPlayerPtr())
{ {
playerCharacter = iter->second->getCharacterController(); playerCharacter = iter->second->getCharacterController();
continue; continue;

@ -1010,7 +1010,7 @@ bool CharacterController::updateWeaponState()
// For the player, set the spell we want to cast // For the player, set the spell we want to cast
// This has to be done at the start of the casting animation, // This has to be done at the start of the casting animation,
// *not* when selecting a spell in the GUI (otherwise you could change the spell mid-animation) // *not* when selecting a spell in the GUI (otherwise you could change the spell mid-animation)
if (mPtr.getRefData().getHandle() == "player") if (mPtr == MWBase::Environment::get().getWorld()->getPlayerPtr())
{ {
std::string selectedSpell = MWBase::Environment::get().getWindowManager()->getSelectedSpell(); std::string selectedSpell = MWBase::Environment::get().getWindowManager()->getSelectedSpell();
stats.getSpells().setSelectedSpell(selectedSpell); stats.getSpells().setSelectedSpell(selectedSpell);
@ -1094,7 +1094,7 @@ bool CharacterController::updateWeaponState()
mAttackType = "shoot"; mAttackType = "shoot";
else else
{ {
if(isWeapon && mPtr.getRefData().getHandle() == "player" && if(isWeapon && mPtr == MWBase::Environment::get().getWorld()->getPlayerPtr() &&
Settings::Manager::getBool("best attack", "Game")) Settings::Manager::getBool("best attack", "Game"))
{ {
MWWorld::ContainerStoreIterator weapon = mPtr.getClass().getInventoryStore(mPtr).getSlot(MWWorld::InventoryStore::Slot_CarriedRight); MWWorld::ContainerStoreIterator weapon = mPtr.getClass().getInventoryStore(mPtr).getSlot(MWWorld::InventoryStore::Slot_CarriedRight);
@ -1421,7 +1421,7 @@ void CharacterController::update(float duration)
// advance athletics // advance athletics
if(mHasMovedInXY && mPtr.getRefData().getHandle() == "player") if(mHasMovedInXY && mPtr == MWBase::Environment::get().getWorld()->getPlayerPtr())
{ {
if(inwater) if(inwater)
{ {
@ -1521,7 +1521,7 @@ void CharacterController::update(float duration)
} }
// advance acrobatics // advance acrobatics
if (mPtr.getRefData().getHandle() == "player") if (mPtr == MWBase::Environment::get().getWorld()->getPlayerPtr())
cls.skillUsageSucceeded(mPtr, ESM::Skill::Acrobatics, 0); cls.skillUsageSucceeded(mPtr, ESM::Skill::Acrobatics, 0);
// decrease fatigue // decrease fatigue
@ -1564,7 +1564,7 @@ void CharacterController::update(float duration)
else else
{ {
// report acrobatics progression // report acrobatics progression
if (mPtr.getRefData().getHandle() == "player") if (mPtr == MWBase::Environment::get().getWorld()->getPlayerPtr())
cls.skillUsageSucceeded(mPtr, ESM::Skill::Acrobatics, 1); cls.skillUsageSucceeded(mPtr, ESM::Skill::Acrobatics, 1);
} }
} }
@ -1797,7 +1797,7 @@ bool CharacterController::kill()
{ {
if( isDead() ) if( isDead() )
{ {
if( mPtr.getRefData().getHandle()=="player" && !isAnimPlaying(mCurrentDeath) ) if( mPtr == MWBase::Environment::get().getWorld()->getPlayerPtr() && !isAnimPlaying(mCurrentDeath) )
{ {
//player's death animation is over //player's death animation is over
MWBase::Environment::get().getStateManager()->askLoadRecent(); MWBase::Environment::get().getStateManager()->askLoadRecent();
@ -1813,7 +1813,7 @@ bool CharacterController::kill()
mCurrentIdle.clear(); mCurrentIdle.clear();
// Play Death Music if it was the player dying // Play Death Music if it was the player dying
if(mPtr.getRefData().getHandle()=="player") if(mPtr == MWBase::Environment::get().getWorld()->getPlayerPtr())
MWBase::Environment::get().getSoundManager()->streamMusic("Special/MW_Death.mp3"); MWBase::Environment::get().getSoundManager()->streamMusic("Special/MW_Death.mp3");
return true; return true;
@ -1854,7 +1854,7 @@ void CharacterController::updateMagicEffects()
float alpha = 1.f; float alpha = 1.f;
if (mPtr.getClass().getCreatureStats(mPtr).getMagicEffects().get(ESM::MagicEffect::Invisibility).getMagnitude()) if (mPtr.getClass().getCreatureStats(mPtr).getMagicEffects().get(ESM::MagicEffect::Invisibility).getMagnitude())
{ {
if (mPtr.getRefData().getHandle() == "player") if (mPtr == MWBase::Environment::get().getWorld()->getPlayerPtr())
alpha = 0.4f; alpha = 0.4f;
else else
alpha = 0.f; alpha = 0.f;

@ -133,7 +133,7 @@ namespace MWMechanics
blockerStats.setBlock(true); blockerStats.setBlock(true);
if (blocker.getCellRef().getRefId() == "player") if (blocker == MWBase::Environment::get().getWorld()->getPlayerPtr())
blocker.getClass().skillUsageSucceeded(blocker, ESM::Skill::Block, 0); blocker.getClass().skillUsageSucceeded(blocker, ESM::Skill::Block, 0);
return true; return true;
@ -157,7 +157,7 @@ namespace MWMechanics
&& actor.getClass().isNpc() && actor.getClass().getNpcStats(actor).isWerewolf()) && actor.getClass().isNpc() && actor.getClass().getNpcStats(actor).isWerewolf())
damage *= MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>().find("fWereWolfSilverWeaponDamageMult")->getFloat(); damage *= MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>().find("fWereWolfSilverWeaponDamageMult")->getFloat();
if (damage == 0 && attacker.getRefData().getHandle() == "player") if (damage == 0 && attacker == MWBase::Environment::get().getWorld()->getPlayerPtr())
MWBase::Environment::get().getWindowManager()->messageBox("#{sMagicTargetResistsWeapons}"); MWBase::Environment::get().getWindowManager()->messageBox("#{sMagicTargetResistsWeapons}");
} }
@ -176,7 +176,7 @@ namespace MWMechanics
return; return;
} }
if(attacker.getRefData().getHandle() == "player") if(attacker == MWBase::Environment::get().getWorld()->getPlayerPtr())
MWBase::Environment::get().getWindowManager()->setEnemy(victim); MWBase::Environment::get().getWindowManager()->setEnemy(victim);
int weapskill = ESM::Skill::Marksman; int weapskill = ESM::Skill::Marksman;
@ -186,32 +186,26 @@ namespace MWMechanics
int skillValue = attacker.getClass().getSkill(attacker, int skillValue = attacker.getClass().getSkill(attacker,
weapon.getClass().getEquipmentSkill(weapon)); weapon.getClass().getEquipmentSkill(weapon));
if((::rand()/(RAND_MAX+1.0)) > getHitChance(attacker, victim, skillValue)/100.0f) if((::rand()/(RAND_MAX+1.0)) >= getHitChance(attacker, victim, skillValue)/100.0f)
{ {
victim.getClass().onHit(victim, 0.0f, false, projectile, attacker, false); victim.getClass().onHit(victim, 0.0f, false, projectile, attacker, false);
MWMechanics::reduceWeaponCondition(0.f, false, weapon, attacker); MWMechanics::reduceWeaponCondition(0.f, false, weapon, attacker);
return; return;
} }
float fDamageStrengthBase = gmst.find("fDamageStrengthBase")->getFloat();
float fDamageStrengthMult = gmst.find("fDamageStrengthMult")->getFloat();
const unsigned char* attack = weapon.get<ESM::Weapon>()->mBase->mData.mChop; const unsigned char* attack = weapon.get<ESM::Weapon>()->mBase->mData.mChop;
float damage = attack[0] + ((attack[1]-attack[0])*attackerStats.getAttackStrength()); // Bow/crossbow damage float damage = attack[0] + ((attack[1]-attack[0])*attackerStats.getAttackStrength()); // Bow/crossbow damage
if (weapon != projectile)
{
// Arrow/bolt damage
attack = projectile.get<ESM::Weapon>()->mBase->mData.mChop;
damage += attack[0] + ((attack[1]-attack[0])*attackerStats.getAttackStrength());
}
damage *= fDamageStrengthBase + // Arrow/bolt damage
(attackerStats.getAttribute(ESM::Attribute::Strength).getModified() * fDamageStrengthMult * 0.1f); // NB in case of thrown weapons, we are applying the damage twice since projectile == weapon
attack = projectile.get<ESM::Weapon>()->mBase->mData.mChop;
damage += attack[0] + ((attack[1]-attack[0])*attackerStats.getAttackStrength());
adjustWeaponDamage(damage, weapon); adjustWeaponDamage(damage, weapon, attacker);
reduceWeaponCondition(damage, true, weapon, attacker); reduceWeaponCondition(damage, true, weapon, attacker);
if(attacker.getRefData().getHandle() == "player") if(attacker == MWBase::Environment::get().getWorld()->getPlayerPtr())
attacker.getClass().skillUsageSucceeded(attacker, weapskill, 0); attacker.getClass().skillUsageSucceeded(attacker, weapskill, 0);
if (victim.getClass().getCreatureStats(victim).getKnockedDown()) if (victim.getClass().getCreatureStats(victim).getKnockedDown())
@ -241,14 +235,39 @@ namespace MWMechanics
{ {
MWMechanics::CreatureStats &stats = attacker.getClass().getCreatureStats(attacker); MWMechanics::CreatureStats &stats = attacker.getClass().getCreatureStats(attacker);
const MWMechanics::MagicEffects &mageffects = stats.getMagicEffects(); const MWMechanics::MagicEffects &mageffects = stats.getMagicEffects();
float hitchance = skillValue +
MWBase::World *world = MWBase::Environment::get().getWorld();
const MWWorld::Store<ESM::GameSetting> &gmst = world->getStore().get<ESM::GameSetting>();
float defenseTerm = 0;
if (victim.getClass().getCreatureStats(victim).getFatigue().getCurrent() >= 0)
{
MWMechanics::CreatureStats& victimStats = victim.getClass().getCreatureStats(victim);
// Maybe we should keep an aware state for actors updated every so often instead of testing every time
bool unaware = (!victimStats.getAiSequence().isInCombat())
&& (attacker == MWBase::Environment::get().getWorld()->getPlayerPtr())
&& (!MWBase::Environment::get().getMechanicsManager()->awarenessCheck(attacker, victim));
if (!(victimStats.getKnockedDown() ||
victimStats.getMagicEffects().get(ESM::MagicEffect::Paralyze).getMagnitude() > 0
|| unaware ))
{
defenseTerm = victimStats.getEvasion();
}
defenseTerm += std::min(100.f,
gmst.find("fCombatInvisoMult")->getFloat() *
victimStats.getMagicEffects().get(ESM::MagicEffect::Chameleon).getMagnitude());
defenseTerm += std::min(100.f,
gmst.find("fCombatInvisoMult")->getFloat() *
victimStats.getMagicEffects().get(ESM::MagicEffect::Invisibility).getMagnitude());
}
float attackTerm = skillValue +
(stats.getAttribute(ESM::Attribute::Agility).getModified() / 5.0f) + (stats.getAttribute(ESM::Attribute::Agility).getModified() / 5.0f) +
(stats.getAttribute(ESM::Attribute::Luck).getModified() / 10.0f); (stats.getAttribute(ESM::Attribute::Luck).getModified() / 10.0f);
hitchance *= stats.getFatigueTerm(); attackTerm *= stats.getFatigueTerm();
hitchance += mageffects.get(ESM::MagicEffect::FortifyAttack).getMagnitude() - attackTerm += mageffects.get(ESM::MagicEffect::FortifyAttack).getMagnitude() -
mageffects.get(ESM::MagicEffect::Blind).getMagnitude(); mageffects.get(ESM::MagicEffect::Blind).getMagnitude();
hitchance -= victim.getClass().getCreatureStats(victim).getEvasion();
return hitchance; return static_cast<int>((attackTerm - defenseTerm) + 0.5f);
} }
void applyElementalShields(const MWWorld::Ptr &attacker, const MWWorld::Ptr &victim) void applyElementalShields(const MWWorld::Ptr &attacker, const MWWorld::Ptr &victim)
@ -322,7 +341,7 @@ namespace MWMechanics
} }
} }
void adjustWeaponDamage(float &damage, const MWWorld::Ptr &weapon) void adjustWeaponDamage(float &damage, const MWWorld::Ptr &weapon, const MWWorld::Ptr& attacker)
{ {
if (weapon.isEmpty()) if (weapon.isEmpty())
return; return;
@ -334,6 +353,13 @@ namespace MWMechanics
int weapmaxhealth = weapon.getClass().getItemMaxHealth(weapon); int weapmaxhealth = weapon.getClass().getItemMaxHealth(weapon);
damage *= (float(weaphealth) / weapmaxhealth); damage *= (float(weaphealth) / weapmaxhealth);
} }
static const float fDamageStrengthBase = MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>()
.find("fDamageStrengthBase")->getFloat();
static const float fDamageStrengthMult = MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>()
.find("fDamageStrengthMult")->getFloat();
damage *= fDamageStrengthBase +
(attacker.getClass().getCreatureStats(attacker).getAttribute(ESM::Attribute::Strength).getModified() * fDamageStrengthMult * 0.1f);
} }
void getHandToHandDamage(const MWWorld::Ptr &attacker, const MWWorld::Ptr &victim, float &damage, bool &healthdmg) void getHandToHandDamage(const MWWorld::Ptr &attacker, const MWWorld::Ptr &victim, float &damage, bool &healthdmg)

@ -30,7 +30,7 @@ void applyElementalShields(const MWWorld::Ptr& attacker, const MWWorld::Ptr& vic
void reduceWeaponCondition (float damage, bool hit, MWWorld::Ptr& weapon, const MWWorld::Ptr& attacker); void reduceWeaponCondition (float damage, bool hit, MWWorld::Ptr& weapon, const MWWorld::Ptr& attacker);
/// Adjust weapon damage based on its condition. A used weapon will be less effective. /// Adjust weapon damage based on its condition. A used weapon will be less effective.
void adjustWeaponDamage (float& damage, const MWWorld::Ptr& weapon); void adjustWeaponDamage (float& damage, const MWWorld::Ptr& weapon, const MWWorld::Ptr& attacker);
void getHandToHandDamage (const MWWorld::Ptr& attacker, const MWWorld::Ptr& victim, float& damage, bool& healthdmg); void getHandToHandDamage (const MWWorld::Ptr& attacker, const MWWorld::Ptr& victim, float& damage, bool& healthdmg);

@ -336,7 +336,7 @@ namespace MWMechanics
float evasion = (getAttribute(ESM::Attribute::Agility).getModified() / 5.0f) + float evasion = (getAttribute(ESM::Attribute::Agility).getModified() / 5.0f) +
(getAttribute(ESM::Attribute::Luck).getModified() / 10.0f); (getAttribute(ESM::Attribute::Luck).getModified() / 10.0f);
evasion *= getFatigueTerm(); evasion *= getFatigueTerm();
evasion += mMagicEffects.get(ESM::MagicEffect::Sanctuary).getMagnitude(); evasion += std::min(100.f, mMagicEffects.get(ESM::MagicEffect::Sanctuary).getMagnitude());
return evasion; return evasion;
} }

@ -180,7 +180,7 @@ namespace MWMechanics
int actorLuck = stats.getAttribute(ESM::Attribute::Luck).getModified(); int actorLuck = stats.getAttribute(ESM::Attribute::Luck).getModified();
float castChance = (lowestSkill - spell->mData.mCost + castBonus + 0.2f * actorWillpower + 0.1f * actorLuck) * stats.getFatigueTerm(); float castChance = (lowestSkill - spell->mData.mCost + castBonus + 0.2f * actorWillpower + 0.1f * actorLuck) * stats.getFatigueTerm();
if (MWBase::Environment::get().getWorld()->getGodModeState() && actor.getRefData().getHandle() == "player") if (MWBase::Environment::get().getWorld()->getGodModeState() && actor == MWBase::Environment::get().getWorld()->getPlayerPtr())
castChance = 100; castChance = 100;
if (!cap) if (!cap)
@ -387,7 +387,7 @@ namespace MWMechanics
if (roll <= x) if (roll <= x)
{ {
// Fully resisted, show message // Fully resisted, show message
if (target.getRefData().getHandle() == "player") if (target == MWBase::Environment::get().getWorld()->getPlayerPtr())
MWBase::Environment::get().getWindowManager()->messageBox("#{sMagicPCResisted}"); MWBase::Environment::get().getWindowManager()->messageBox("#{sMagicPCResisted}");
return; return;
} }
@ -405,7 +405,7 @@ namespace MWMechanics
if (target.getClass().isActor()) if (target.getClass().isActor())
targetEffects += target.getClass().getCreatureStats(target).getMagicEffects(); targetEffects += target.getClass().getCreatureStats(target).getMagicEffects();
bool castByPlayer = (!caster.isEmpty() && caster.getRefData().getHandle() == "player"); bool castByPlayer = (!caster.isEmpty() && caster == MWBase::Environment::get().getWorld()->getPlayerPtr());
// Try absorbing if it's a spell // Try absorbing if it's a spell
// NOTE: Vanilla does this once per effect source instead of adding the % from all sources together, not sure // NOTE: Vanilla does this once per effect source instead of adding the % from all sources together, not sure
@ -482,7 +482,7 @@ namespace MWMechanics
if (magnitudeMult == 0) if (magnitudeMult == 0)
{ {
// Fully resisted, show message // Fully resisted, show message
if (target.getRefData().getHandle() == "player") if (target == MWBase::Environment::get().getWorld()->getPlayerPtr())
MWBase::Environment::get().getWindowManager()->messageBox("#{sMagicPCResisted}"); MWBase::Environment::get().getWindowManager()->messageBox("#{sMagicPCResisted}");
else if (castByPlayer) else if (castByPlayer)
MWBase::Environment::get().getWindowManager()->messageBox("#{sMagicTargetResisted}"); MWBase::Environment::get().getWindowManager()->messageBox("#{sMagicTargetResisted}");
@ -611,7 +611,7 @@ namespace MWMechanics
{ {
if (target.getCellRef().getLockLevel() < magnitude) //If the door is not already locked to a higher value, lock it to spell magnitude if (target.getCellRef().getLockLevel() < magnitude) //If the door is not already locked to a higher value, lock it to spell magnitude
{ {
if (caster.getRefData().getHandle() == "player") if (caster == MWBase::Environment::get().getWorld()->getPlayerPtr())
MWBase::Environment::get().getWindowManager()->messageBox("#{sMagicLockSuccess}"); MWBase::Environment::get().getWindowManager()->messageBox("#{sMagicLockSuccess}");
target.getCellRef().setLockLevel(static_cast<int>(magnitude)); target.getCellRef().setLockLevel(static_cast<int>(magnitude));
} }
@ -626,7 +626,7 @@ namespace MWMechanics
if (!caster.isEmpty() && caster.getClass().isActor()) if (!caster.isEmpty() && caster.getClass().isActor())
MWBase::Environment::get().getMechanicsManager()->objectOpened(caster, target); MWBase::Environment::get().getMechanicsManager()->objectOpened(caster, target);
if (caster.getRefData().getHandle() == "player") if (caster == MWBase::Environment::get().getWorld()->getPlayerPtr())
MWBase::Environment::get().getWindowManager()->messageBox("#{sMagicOpenSuccess}"); MWBase::Environment::get().getWindowManager()->messageBox("#{sMagicOpenSuccess}");
} }
target.getCellRef().setLockLevel(-abs(target.getCellRef().getLockLevel())); target.getCellRef().setLockLevel(-abs(target.getCellRef().getLockLevel()));
@ -652,7 +652,7 @@ namespace MWMechanics
else if (effectId == ESM::MagicEffect::RemoveCurse) else if (effectId == ESM::MagicEffect::RemoveCurse)
target.getClass().getCreatureStats(target).getSpells().purgeCurses(); target.getClass().getCreatureStats(target).getSpells().purgeCurses();
if (target.getRefData().getHandle() != "player") if (target != MWBase::Environment::get().getWorld()->getPlayerPtr())
return; return;
if (!MWBase::Environment::get().getWorld()->isTeleportingEnabled()) if (!MWBase::Environment::get().getWorld()->isTeleportingEnabled())
return; return;
@ -728,7 +728,7 @@ namespace MWMechanics
if (item.getCellRef().getEnchantmentCharge() < castCost) if (item.getCellRef().getEnchantmentCharge() < castCost)
{ {
if (mCaster.getRefData().getHandle() == "player") if (mCaster == MWBase::Environment::get().getWorld()->getPlayerPtr())
MWBase::Environment::get().getWindowManager()->messageBox("#{sMagicInsufficientCharge}"); MWBase::Environment::get().getWindowManager()->messageBox("#{sMagicInsufficientCharge}");
// Failure sound // Failure sound
@ -752,14 +752,14 @@ namespace MWMechanics
if (enchantment->mData.mType == ESM::Enchantment::WhenUsed) if (enchantment->mData.mType == ESM::Enchantment::WhenUsed)
{ {
if (mCaster.getRefData().getHandle() == "player") if (mCaster == MWBase::Environment::get().getWorld()->getPlayerPtr())
mCaster.getClass().skillUsageSucceeded (mCaster, ESM::Skill::Enchant, 1); mCaster.getClass().skillUsageSucceeded (mCaster, ESM::Skill::Enchant, 1);
} }
if (enchantment->mData.mType == ESM::Enchantment::CastOnce) if (enchantment->mData.mType == ESM::Enchantment::CastOnce)
item.getContainerStore()->remove(item, 1, mCaster); item.getContainerStore()->remove(item, 1, mCaster);
else if (enchantment->mData.mType != ESM::Enchantment::WhenStrikes) else if (enchantment->mData.mType != ESM::Enchantment::WhenStrikes)
{ {
if (mCaster.getRefData().getHandle() == "player") if (mCaster == MWBase::Environment::get().getWorld()->getPlayerPtr())
{ {
mCaster.getClass().skillUsageSucceeded (mCaster, ESM::Skill::Enchant, 3); mCaster.getClass().skillUsageSucceeded (mCaster, ESM::Skill::Enchant, 3);
} }
@ -827,7 +827,7 @@ namespace MWMechanics
int roll = static_cast<int>(std::rand() / (static_cast<double> (RAND_MAX)+1) * 100); // [0, 99] int roll = static_cast<int>(std::rand() / (static_cast<double> (RAND_MAX)+1) * 100); // [0, 99]
if (!fail && roll >= successChance) if (!fail && roll >= successChance)
{ {
if (mCaster.getRefData().getHandle() == "player") if (mCaster == MWBase::Environment::get().getWorld()->getPlayerPtr())
MWBase::Environment::get().getWindowManager()->messageBox("#{sMagicSkillFail}"); MWBase::Environment::get().getWindowManager()->messageBox("#{sMagicSkillFail}");
fail = true; fail = true;
} }
@ -845,7 +845,7 @@ namespace MWMechanics
} }
} }
if (mCaster.getRefData().getHandle() == "player" && spellIncreasesSkill(spell)) if (mCaster == MWBase::Environment::get().getWorld()->getPlayerPtr() && spellIncreasesSkill(spell))
mCaster.getClass().skillUsageSucceeded(mCaster, mCaster.getClass().skillUsageSucceeded(mCaster,
spellSchoolToSkill(school), 0); spellSchoolToSkill(school), 0);

@ -15,12 +15,6 @@ void MWMechanics::AttributeValue::readState (const ESM::StatState<int>& state)
mDamage = state.mDamage; mDamage = state.mDamage;
} }
void MWMechanics::AttributeValue::setModifiers(float fortify, float drain, float absorb)
{
mFortified = static_cast<int>(fortify);
mModifier = mFortified - static_cast<int>(drain + absorb);
}
void MWMechanics::SkillValue::writeState (ESM::StatState<int>& state) const void MWMechanics::SkillValue::writeState (ESM::StatState<int>& state) const
{ {
AttributeValue::writeState (state); AttributeValue::writeState (state);

@ -170,10 +170,10 @@ namespace MWMechanics
} }
/// Change modified relatively. /// Change modified relatively.
void modify (const T& diff) void modify (const T& diff, bool allowCurrentDecreaseBelowZero=false)
{ {
mStatic.modify (diff); mStatic.modify (diff);
setCurrent (getCurrent()+diff); setCurrent (getCurrent()+diff, allowCurrentDecreaseBelowZero);
} }
void setCurrent (const T& value, bool allowDecreaseBelowZero = false) void setCurrent (const T& value, bool allowDecreaseBelowZero = false)
@ -198,11 +198,11 @@ namespace MWMechanics
} }
} }
void setModifier (const T& modifier) void setModifier (const T& modifier, bool allowCurrentDecreaseBelowZero=false)
{ {
T diff = modifier - mStatic.getModifier(); T diff = modifier - mStatic.getModifier();
mStatic.setModifier (modifier); mStatic.setModifier (modifier);
setCurrent (getCurrent()+diff); setCurrent (getCurrent()+diff, allowCurrentDecreaseBelowZero);
} }
void writeState (ESM::StatState<T>& state) const void writeState (ESM::StatState<T>& state) const
@ -235,28 +235,31 @@ namespace MWMechanics
class AttributeValue class AttributeValue
{ {
int mBase; int mBase;
int mFortified; int mModifier;
int mModifier; // net effect of Fortified, Drain & Absorb
float mDamage; // needs to be float to allow continuous damage float mDamage; // needs to be float to allow continuous damage
public: public:
AttributeValue() : mBase(0), mFortified(0), mModifier(0), mDamage(0) {} AttributeValue() : mBase(0), mModifier(0), mDamage(0) {}
int getModified() const { return std::max(0, mBase - (int) mDamage + mModifier); } int getModified() const { return std::max(0, mBase - (int) mDamage + mModifier); }
int getBase() const { return mBase; } int getBase() const { return mBase; }
int getModifier() const { return mModifier; } int getModifier() const { return mModifier; }
void setBase(int base) { mBase = std::max(0, base); } void setBase(int base) { mBase = std::max(0, base); }
void setModifiers(float fortify, float drain, float absorb);
void damage(float damage) { mDamage = std::min(mDamage + damage, (float)(mBase + mFortified)); } void setModifier(int mod) { mModifier = mod; }
// Maximum attribute damage is limited to the modified value.
// Note: I think MW applies damage directly to mModified, since you can also
// "restore" drained attributes. We need to rewrite the magic effect system to support this.
void damage(float damage) { mDamage += std::min(damage, (float)getModified()); }
void restore(float amount) { mDamage -= std::min(mDamage, amount); } void restore(float amount) { mDamage -= std::min(mDamage, amount); }
float getDamage() const { return mDamage; }
void writeState (ESM::StatState<int>& state) const; void writeState (ESM::StatState<int>& state) const;
void readState (const ESM::StatState<int>& state); void readState (const ESM::StatState<int>& state);
friend bool operator== (const AttributeValue& left, const AttributeValue& right);
}; };
class SkillValue : public AttributeValue class SkillValue : public AttributeValue
@ -270,16 +273,13 @@ namespace MWMechanics
void writeState (ESM::StatState<int>& state) const; void writeState (ESM::StatState<int>& state) const;
void readState (const ESM::StatState<int>& state); void readState (const ESM::StatState<int>& state);
friend bool operator== (const SkillValue& left, const SkillValue& right);
}; };
inline bool operator== (const AttributeValue& left, const AttributeValue& right) inline bool operator== (const AttributeValue& left, const AttributeValue& right)
{ {
return left.getBase() == right.getBase() return left.getBase() == right.getBase()
&& left.mFortified == right.mFortified
&& left.getModifier() == right.getModifier() && left.getModifier() == right.getModifier()
&& left.mDamage == right.mDamage; && left.getDamage() == right.getDamage();
} }
inline bool operator!= (const AttributeValue& left, const AttributeValue& right) inline bool operator!= (const AttributeValue& left, const AttributeValue& right)
{ {
@ -288,8 +288,9 @@ namespace MWMechanics
inline bool operator== (const SkillValue& left, const SkillValue& right) inline bool operator== (const SkillValue& left, const SkillValue& right)
{ {
// delegate to base class for most of the work return left.getBase() == right.getBase()
return (static_cast<const AttributeValue&>(left) == right) && left.getModifier() == right.getModifier()
&& left.getDamage() == right.getDamage()
&& left.getProgress() == right.getProgress(); && left.getProgress() == right.getProgress();
} }
inline bool operator!= (const SkillValue& left, const SkillValue& right) inline bool operator!= (const SkillValue& left, const SkillValue& right)

@ -321,7 +321,7 @@ void RenderingManager::updatePlayerPtr(const MWWorld::Ptr &ptr)
void RenderingManager::rebuildPtr(const MWWorld::Ptr &ptr) void RenderingManager::rebuildPtr(const MWWorld::Ptr &ptr)
{ {
NpcAnimation *anim = NULL; NpcAnimation *anim = NULL;
if(ptr.getRefData().getHandle() == "player") if(ptr == MWBase::Environment::get().getWorld()->getPlayerPtr())
anim = mPlayerAnimation; anim = mPlayerAnimation;
else if(ptr.getClass().isActor()) else if(ptr.getClass().isActor())
anim = dynamic_cast<NpcAnimation*>(mActors->getAnimation(ptr)); anim = dynamic_cast<NpcAnimation*>(mActors->getAnimation(ptr));
@ -955,7 +955,7 @@ Animation* RenderingManager::getAnimation(const MWWorld::Ptr &ptr)
{ {
Animation *anim = mActors->getAnimation(ptr); Animation *anim = mActors->getAnimation(ptr);
if(!anim && ptr.getRefData().getHandle() == "player") if(!anim && ptr == MWBase::Environment::get().getWorld()->getPlayerPtr())
anim = mPlayerAnimation; anim = mPlayerAnimation;
if (!anim) if (!anim)

@ -175,7 +175,7 @@ namespace MWScript
MWWorld::ActionEquip action (*it); MWWorld::ActionEquip action (*it);
action.execute(ptr); action.execute(ptr);
if (ptr.getRefData().getHandle() == "player" && !ptr.getClass().getScript(ptr).empty()) if (ptr == MWBase::Environment::get().getWorld()->getPlayerPtr() && !ptr.getClass().getScript(ptr).empty())
ptr.getRefData().getLocals().setVarByInt(ptr.getClass().getScript(ptr), "onpcequip", 1); ptr.getRefData().getLocals().setVarByInt(ptr.getClass().getScript(ptr), "onpcequip", 1);
} }
}; };

@ -212,7 +212,7 @@ namespace MWScript
if (!ptr.isInCell()) if (!ptr.isInCell())
return; return;
if (ptr.getRefData().getHandle() == "player") if (ptr == MWBase::Environment::get().getWorld()->getPlayerPtr())
{ {
MWBase::Environment::get().getWorld()->getPlayer().setTeleported(true); MWBase::Environment::get().getWorld()->getPlayer().setTeleported(true);
} }
@ -287,7 +287,7 @@ namespace MWScript
if (ptr.getContainerStore()) if (ptr.getContainerStore())
return; return;
if (ptr.getRefData().getHandle() == "player") if (ptr == MWBase::Environment::get().getWorld()->getPlayerPtr())
{ {
MWBase::Environment::get().getWorld()->getPlayer().setTeleported(true); MWBase::Environment::get().getWorld()->getPlayer().setTeleported(true);
} }
@ -352,7 +352,7 @@ namespace MWScript
if (!ptr.isInCell()) if (!ptr.isInCell())
return; return;
if (ptr.getRefData().getHandle() == "player") if (ptr == MWBase::Environment::get().getWorld()->getPlayerPtr())
{ {
MWBase::Environment::get().getWorld()->getPlayer().setTeleported(true); MWBase::Environment::get().getWorld()->getPlayer().setTeleported(true);
} }
@ -371,7 +371,7 @@ namespace MWScript
// another morrowind oddity: player will be moved to the exterior cell at this location, // another morrowind oddity: player will be moved to the exterior cell at this location,
// non-player actors will move within the cell they are in. // non-player actors will move within the cell they are in.
MWWorld::Ptr updated; MWWorld::Ptr updated;
if (ptr.getRefData().getHandle() == "player") if (ptr == MWBase::Environment::get().getWorld()->getPlayerPtr())
{ {
MWWorld::CellStore* cell = MWBase::Environment::get().getWorld()->getExterior(cx,cy); MWWorld::CellStore* cell = MWBase::Environment::get().getWorld()->getExterior(cx,cy);
MWBase::Environment::get().getWorld()->moveObject(ptr,cell,x,y,z); MWBase::Environment::get().getWorld()->moveObject(ptr,cell,x,y,z);

@ -477,7 +477,7 @@ namespace MWSound
while(snditer != mActiveSounds.end()) while(snditer != mActiveSounds.end())
{ {
if(snditer->second.first != MWWorld::Ptr() && if(snditer->second.first != MWWorld::Ptr() &&
snditer->second.first.getCellRef().getRefId() != "player" && snditer->second.first != MWBase::Environment::get().getWorld()->getPlayerPtr() &&
snditer->second.first.getCell() == cell) snditer->second.first.getCell() == cell)
{ {
snditer->first->stop(); snditer->first->stop();

@ -20,7 +20,7 @@ void MWWorld::Action::execute (const Ptr& actor)
{ {
if (!mSoundId.empty()) if (!mSoundId.empty())
{ {
if (mKeepSound && actor.getRefData().getHandle()=="player") if (mKeepSound && actor == MWBase::Environment::get().getWorld()->getPlayerPtr())
MWBase::Environment::get().getSoundManager()->playSound(mSoundId, 1.0, 1.0, MWBase::Environment::get().getSoundManager()->playSound(mSoundId, 1.0, 1.0,
MWBase::SoundManager::Play_TypeSfx, MWBase::SoundManager::Play_Normal,mSoundOffset); MWBase::SoundManager::Play_TypeSfx, MWBase::SoundManager::Play_Normal,mSoundOffset);
else else

@ -3,8 +3,6 @@
#include "../mwbase/environment.hpp" #include "../mwbase/environment.hpp"
#include "../mwbase/windowmanager.hpp" #include "../mwbase/windowmanager.hpp"
#include "../mwgui/container.hpp"
#include "../mwmechanics/disease.hpp" #include "../mwmechanics/disease.hpp"
#include "class.hpp" #include "class.hpp"
@ -25,7 +23,6 @@ namespace MWWorld
MWMechanics::diseaseContact(actor, getTarget()); MWMechanics::diseaseContact(actor, getTarget());
MWBase::Environment::get().getWindowManager()->pushGuiMode(MWGui::GM_Container); MWBase::Environment::get().getWindowManager()->openContainer(getTarget(), mLoot);
MWBase::Environment::get().getWindowManager()->getContainerWindow()->open(getTarget(), mLoot);
} }
} }

@ -4,13 +4,8 @@
#include "../mwbase/windowmanager.hpp" #include "../mwbase/windowmanager.hpp"
#include "../mwbase/world.hpp" #include "../mwbase/world.hpp"
#include "../mwworld/player.hpp"
#include "../mwmechanics/npcstats.hpp" #include "../mwmechanics/npcstats.hpp"
#include "../mwgui/bookwindow.hpp"
#include "../mwgui/scrollwindow.hpp"
#include "player.hpp" #include "player.hpp"
#include "class.hpp" #include "class.hpp"
#include "esmstore.hpp" #include "esmstore.hpp"
@ -33,27 +28,22 @@ namespace MWWorld
return; return;
} }
bool showTakeButton = (getTarget().getContainerStore() != &actor.getClass().getContainerStore(actor));
LiveCellRef<ESM::Book> *ref = getTarget().get<ESM::Book>(); LiveCellRef<ESM::Book> *ref = getTarget().get<ESM::Book>();
if (ref->mBase->mData.mIsScroll) if (ref->mBase->mData.mIsScroll)
{ MWBase::Environment::get().getWindowManager()->showScroll(getTarget(), showTakeButton);
MWBase::Environment::get().getWindowManager()->pushGuiMode(MWGui::GM_Scroll);
MWBase::Environment::get().getWindowManager()->getScrollWindow()->open(getTarget());
}
else else
{ MWBase::Environment::get().getWindowManager()->showBook(getTarget(), showTakeButton);
MWBase::Environment::get().getWindowManager()->pushGuiMode(MWGui::GM_Book);
MWBase::Environment::get().getWindowManager()->getBookWindow()->open(getTarget());
}
MWWorld::Ptr player = MWBase::Environment::get().getWorld ()->getPlayerPtr(); MWMechanics::NpcStats& npcStats = actor.getClass().getNpcStats (actor);
MWMechanics::NpcStats& npcStats = player.getClass().getNpcStats (player);
// Skill gain from books // Skill gain from books
if (ref->mBase->mData.mSkillID >= 0 && ref->mBase->mData.mSkillID < ESM::Skill::Length if (ref->mBase->mData.mSkillID >= 0 && ref->mBase->mData.mSkillID < ESM::Skill::Length
&& !npcStats.hasBeenUsed (ref->mBase->mId)) && !npcStats.hasBeenUsed (ref->mBase->mId))
{ {
MWWorld::LiveCellRef<ESM::NPC> *playerRef = player.get<ESM::NPC>(); MWWorld::LiveCellRef<ESM::NPC> *playerRef = actor.get<ESM::NPC>();
const ESM::Class *class_ = const ESM::Class *class_ =
MWBase::Environment::get().getWorld()->getStore().get<ESM::Class>().find ( MWBase::Environment::get().getWorld()->getStore().get<ESM::Class>().find (

@ -19,7 +19,6 @@ namespace MWWorld
return; return;
} }
MWBase::Environment::get().getWindowManager()->pushGuiMode(MWGui::GM_Repair);
MWBase::Environment::get().getWindowManager()->startRepairItem(getTarget()); MWBase::Environment::get().getWindowManager()->startRepairItem(getTarget());
} }
} }

@ -210,7 +210,7 @@ MWWorld::ContainerStoreIterator MWWorld::ContainerStore::add(const std::string &
{ {
MWWorld::ManualRef ref(MWBase::Environment::get().getWorld()->getStore(), id, count); MWWorld::ManualRef ref(MWBase::Environment::get().getWorld()->getStore(), id, count);
// a bit pointless to set owner for the player // a bit pointless to set owner for the player
if (actorPtr.getRefData().getHandle() != "player") if (actorPtr != MWBase::Environment::get().getWorld()->getPlayerPtr())
return add(ref.getPtr(), count, actorPtr, true); return add(ref.getPtr(), count, actorPtr, true);
else else
return add(ref.getPtr(), count, actorPtr, false); return add(ref.getPtr(), count, actorPtr, false);

@ -13,7 +13,7 @@ namespace MWWorld
void FailedAction::executeImp(const Ptr &actor) void FailedAction::executeImp(const Ptr &actor)
{ {
if(actor.getRefData().getHandle() == "player" && !mMessage.empty()) if(actor == MWBase::Environment::get().getWorld()->getPlayerPtr() && !mMessage.empty())
MWBase::Environment::get().getWindowManager()->messageBox(mMessage); MWBase::Environment::get().getWindowManager()->messageBox(mMessage);
} }
} }

@ -133,7 +133,7 @@ MWWorld::ContainerStoreIterator MWWorld::InventoryStore::add(const Ptr& itemPtr,
const MWWorld::ContainerStoreIterator& retVal = MWWorld::ContainerStore::add(itemPtr, count, actorPtr, setOwner); const MWWorld::ContainerStoreIterator& retVal = MWWorld::ContainerStore::add(itemPtr, count, actorPtr, setOwner);
// Auto-equip items if an armor/clothing or weapon item is added, but not for the player nor werewolves // Auto-equip items if an armor/clothing or weapon item is added, but not for the player nor werewolves
if (actorPtr.getRefData().getHandle() != "player" if (actorPtr != MWBase::Environment::get().getWorld()->getPlayerPtr()
&& !(actorPtr.getClass().isNpc() && actorPtr.getClass().getNpcStats(actorPtr).isWerewolf())) && !(actorPtr.getClass().isNpc() && actorPtr.getClass().getNpcStats(actorPtr).isWerewolf()))
{ {
std::string type = itemPtr.getTypeName(); std::string type = itemPtr.getTypeName();
@ -503,7 +503,7 @@ int MWWorld::InventoryStore::remove(const Ptr& item, int count, const Ptr& actor
// If an armor/clothing item is removed, try to find a replacement, // If an armor/clothing item is removed, try to find a replacement,
// but not for the player nor werewolves. // but not for the player nor werewolves.
if ((actor.getRefData().getHandle() != "player") if ((actor != MWBase::Environment::get().getWorld()->getPlayerPtr())
&& !(actor.getClass().isNpc() && actor.getClass().getNpcStats(actor).isWerewolf())) && !(actor.getClass().isNpc() && actor.getClass().getNpcStats(actor).isWerewolf()))
{ {
std::string type = item.getTypeName(); std::string type = item.getTypeName();
@ -535,7 +535,7 @@ MWWorld::ContainerStoreIterator MWWorld::InventoryStore::unequipSlot(int slot, c
{ {
retval = restack(*it); retval = restack(*it);
if (actor.getRefData().getHandle() == "player") if (actor == MWBase::Environment::get().getWorld()->getPlayerPtr())
{ {
// Unset OnPCEquip Variable on item's script, if it has a script with that variable declared // Unset OnPCEquip Variable on item's script, if it has a script with that variable declared
const std::string& script = it->getClass().getScript(*it); const std::string& script = it->getClass().getScript(*it);

@ -1406,7 +1406,7 @@ namespace MWWorld
PtrVelocityList::const_iterator player(results.end()); PtrVelocityList::const_iterator player(results.end());
for(PtrVelocityList::const_iterator iter(results.begin());iter != results.end();++iter) for(PtrVelocityList::const_iterator iter(results.begin());iter != results.end();++iter)
{ {
if(iter->first.getRefData().getHandle() == "player") if(iter->first == getPlayerPtr())
{ {
/* Handle player last, in case a cell transition occurs */ /* Handle player last, in case a cell transition occurs */
player = iter; player = iter;
@ -2228,7 +2228,7 @@ namespace MWWorld
if (healthPerSecond > 0.0f) if (healthPerSecond > 0.0f)
{ {
if (actor.getRefData().getHandle() == "player") if (actor == getPlayerPtr())
MWBase::Environment::get().getWindowManager()->activateHitOverlay(false); MWBase::Environment::get().getWindowManager()->activateHitOverlay(false);
if (!MWBase::Environment::get().getSoundManager()->getSoundPlaying(actor, "Health Damage")) if (!MWBase::Environment::get().getSoundManager()->getSoundPlaying(actor, "Health Damage"))
@ -2259,7 +2259,7 @@ namespace MWWorld
if (healthPerSecond > 0.0f) if (healthPerSecond > 0.0f)
{ {
if (actor.getRefData().getHandle() == "player") if (actor == getPlayerPtr())
MWBase::Environment::get().getWindowManager()->activateHitOverlay(false); MWBase::Environment::get().getWindowManager()->activateHitOverlay(false);
if (!MWBase::Environment::get().getSoundManager()->getSoundPlaying(actor, "Health Damage")) if (!MWBase::Environment::get().getSoundManager()->getSoundPlaying(actor, "Health Damage"))
@ -2516,7 +2516,7 @@ namespace MWWorld
// the following is just for reattaching the camera properly. // the following is just for reattaching the camera properly.
mRendering->rebuildPtr(actor); mRendering->rebuildPtr(actor);
if(actor.getRefData().getHandle() == "player") if(actor == getPlayerPtr())
{ {
// Update the GUI only when called on the player // Update the GUI only when called on the player
MWBase::WindowManager* windowManager = MWBase::Environment::get().getWindowManager(); MWBase::WindowManager* windowManager = MWBase::Environment::get().getWindowManager();
@ -3167,7 +3167,7 @@ namespace MWWorld
void World::spawnBloodEffect(const Ptr &ptr, const Vector3 &worldPosition) void World::spawnBloodEffect(const Ptr &ptr, const Vector3 &worldPosition)
{ {
if (ptr.getRefData().getHandle() == "player" && Settings::Manager::getBool("hit fader", "GUI")) if (ptr == getPlayerPtr() && Settings::Manager::getBool("hit fader", "GUI"))
return; return;
int type = ptr.getClass().getBloodTexture(ptr); int type = ptr.getClass().getBloodTexture(ptr);

@ -62,7 +62,7 @@ add_component_dir (esm
loadweap records aipackage effectlist spelllist variant variantimp loadtes3 cellref filter loadweap records aipackage effectlist spelllist variant variantimp loadtes3 cellref filter
savedgame journalentry queststate locals globalscript player objectstate cellid cellstate globalmap inventorystate containerstate npcstate creaturestate dialoguestate statstate savedgame journalentry queststate locals globalscript player objectstate cellid cellstate globalmap inventorystate containerstate npcstate creaturestate dialoguestate statstate
npcstats creaturestats weatherstate quickkeys fogstate spellstate activespells creaturelevliststate doorstate projectilestate debugprofile npcstats creaturestats weatherstate quickkeys fogstate spellstate activespells creaturelevliststate doorstate projectilestate debugprofile
aisequence magiceffects util custommarkerstate stolenitems aisequence magiceffects util custommarkerstate stolenitems transport
) )
add_component_dir (esmterrain add_component_dir (esmterrain

@ -15,6 +15,7 @@ namespace ESM {
mAiPackage.mList.clear(); mAiPackage.mList.clear();
mInventory.mList.clear(); mInventory.mList.clear();
mSpells.mList.clear(); mSpells.mList.clear();
mTransport.mList.clear();
mScale = 1.f; mScale = 1.f;
mHasAI = false; mHasAI = false;
@ -59,6 +60,10 @@ namespace ESM {
esm.getHExact(&mAiData, sizeof(mAiData)); esm.getHExact(&mAiData, sizeof(mAiData));
mHasAI = true; mHasAI = true;
break; break;
case ESM::FourCC<'D','O','D','T'>::value:
case ESM::FourCC<'D','N','A','M'>::value:
mTransport.add(esm);
break;
case AI_Wander: case AI_Wander:
case AI_Activate: case AI_Activate:
case AI_Escort: case AI_Escort:
@ -94,6 +99,7 @@ namespace ESM {
if (mHasAI) { if (mHasAI) {
esm.writeHNT("AIDT", mAiData, sizeof(mAiData)); esm.writeHNT("AIDT", mAiData, sizeof(mAiData));
} }
mTransport.save(esm);
mAiPackage.save(esm); mAiPackage.save(esm);
} }
@ -120,5 +126,11 @@ namespace ESM {
mAiData.blank(); mAiData.blank();
mAiData.mServices = 0; mAiData.mServices = 0;
mAiPackage.mList.clear(); mAiPackage.mList.clear();
mTransport.mList.clear();
}
const std::vector<Transport::Dest>& Creature::getTransport() const
{
return mTransport.mList;
} }
} }

@ -6,6 +6,7 @@
#include "loadcont.hpp" #include "loadcont.hpp"
#include "spelllist.hpp" #include "spelllist.hpp"
#include "aipackage.hpp" #include "aipackage.hpp"
#include "transport.hpp"
namespace ESM namespace ESM
{ {
@ -92,6 +93,9 @@ struct Creature
bool mHasAI; bool mHasAI;
AIData mAiData; AIData mAiData;
AIPackageList mAiPackage; AIPackageList mAiPackage;
Transport mTransport;
const std::vector<Transport::Dest>& getTransport() const;
void load(ESMReader &esm); void load(ESMReader &esm);
void save(ESMWriter &esm) const; void save(ESMWriter &esm) const;

@ -12,7 +12,7 @@ class ESMReader;
class ESMWriter; class ESMWriter;
/* /*
* Game setting, with automatic cleaning of "dirty" entries. * Game setting
* *
*/ */

@ -14,7 +14,7 @@ namespace ESM
mSpells.mList.clear(); mSpells.mList.clear();
mInventory.mList.clear(); mInventory.mList.clear();
mTransport.clear(); mTransport.mList.clear();
mAiPackage.mList.clear(); mAiPackage.mList.clear();
bool hasNpdt = false; bool hasNpdt = false;
@ -81,14 +81,8 @@ namespace ESM
mHasAI= true; mHasAI= true;
break; break;
case ESM::FourCC<'D','O','D','T'>::value: case ESM::FourCC<'D','O','D','T'>::value:
{
Dest dodt;
esm.getHExact(&dodt.mPos, 24);
mTransport.push_back(dodt);
break;
}
case ESM::FourCC<'D','N','A','M'>::value: case ESM::FourCC<'D','N','A','M'>::value:
mTransport.back().mCellName = esm.getHString(); mTransport.add(esm);
break; break;
case AI_Wander: case AI_Wander:
case AI_Activate: case AI_Activate:
@ -131,11 +125,8 @@ namespace ESM
esm.writeHNT("AIDT", mAiData, sizeof(mAiData)); esm.writeHNT("AIDT", mAiData, sizeof(mAiData));
} }
typedef std::vector<Dest>::const_iterator DestIter; mTransport.save(esm);
for (DestIter it = mTransport.begin(); it != mTransport.end(); ++it) {
esm.writeHNT("DODT", it->mPos, sizeof(it->mPos));
esm.writeHNOCString("DNAM", it->mCellName);
}
mAiPackage.save(esm); mAiPackage.save(esm);
} }
@ -177,7 +168,7 @@ namespace ESM
mSpells.mList.clear(); mSpells.mList.clear();
mAiData.blank(); mAiData.blank();
mHasAI = false; mHasAI = false;
mTransport.clear(); mTransport.mList.clear();
mAiPackage.mList.clear(); mAiPackage.mList.clear();
mName.clear(); mName.clear();
mModel.clear(); mModel.clear();
@ -198,4 +189,9 @@ namespace ESM
else // NPC_DEFAULT else // NPC_DEFAULT
return mNpdt52.mRank; return mNpdt52.mRank;
} }
const std::vector<Transport::Dest>& NPC::getTransport() const
{
return mTransport.mList;
}
} }

@ -9,6 +9,7 @@
#include "aipackage.hpp" #include "aipackage.hpp"
#include "spelllist.hpp" #include "spelllist.hpp"
#include "loadskil.hpp" #include "loadskil.hpp"
#include "transport.hpp"
namespace ESM { namespace ESM {
@ -98,12 +99,6 @@ struct NPC
char mUnknown1, mUnknown2, mUnknown3; char mUnknown1, mUnknown2, mUnknown3;
int mGold; int mGold;
}; // 12 bytes }; // 12 bytes
struct Dest
{
Position mPos;
std::string mCellName;
};
#pragma pack(pop) #pragma pack(pop)
unsigned char mNpdtType; unsigned char mNpdtType;
@ -122,7 +117,10 @@ struct NPC
AIData mAiData; AIData mAiData;
bool mHasAI; bool mHasAI;
std::vector<Dest> mTransport; Transport mTransport;
const std::vector<Transport::Dest>& getTransport() const;
AIPackageList mAiPackage; AIPackageList mAiPackage;
std::string mId, mName, mModel, mRace, mClass, mFaction, mScript; std::string mId, mName, mModel, mRace, mClass, mFaction, mScript;

@ -0,0 +1,33 @@
#include "transport.hpp"
#include <components/esm/esmreader.hpp>
#include <components/esm/esmwriter.hpp>
namespace ESM
{
void Transport::add(ESMReader &esm)
{
if (esm.retSubName().val == ESM::FourCC<'D','O','D','T'>::value)
{
Dest dodt;
esm.getHExact(&dodt.mPos, 24);
mList.push_back(dodt);
}
else if (esm.retSubName().val == ESM::FourCC<'D','N','A','M'>::value)
{
mList.back().mCellName = esm.getHString();
}
}
void Transport::save(ESMWriter &esm) const
{
typedef std::vector<Dest>::const_iterator DestIter;
for (DestIter it = mList.begin(); it != mList.end(); ++it)
{
esm.writeHNT("DODT", it->mPos, sizeof(it->mPos));
esm.writeHNOCString("DNAM", it->mCellName);
}
}
}

@ -0,0 +1,36 @@
#ifndef OPENMW_COMPONENTS_ESM_TRANSPORT_H
#define OPENMW_COMPONENTS_ESM_TRANSPORT_H
#include <string>
#include <vector>
#include "defs.hpp"
namespace ESM
{
class ESMReader;
class ESMWriter;
/// List of travel service destination. Shared by CREA and NPC_ records.
struct Transport
{
struct Dest
{
Position mPos;
std::string mCellName;
};
std::vector<Dest> mList;
/// Load one destination, assumes the subrecord name was already read
void add(ESMReader &esm);
void save(ESMWriter &esm) const;
};
}
#endif

@ -20,12 +20,12 @@ namespace
{ {
size_t i = 0; size_t i = 0;
unsigned long unicode; unsigned long unicode;
size_t todo; size_t numbytes;
unsigned char ch = utf8[i++]; unsigned char ch = utf8[i++];
if (ch <= 0x7F) if (ch <= 0x7F)
{ {
unicode = ch; unicode = ch;
todo = 0; numbytes = 0;
} }
else if (ch <= 0xBF) else if (ch <= 0xBF)
{ {
@ -34,23 +34,23 @@ namespace
else if (ch <= 0xDF) else if (ch <= 0xDF)
{ {
unicode = ch&0x1F; unicode = ch&0x1F;
todo = 1; numbytes = 1;
} }
else if (ch <= 0xEF) else if (ch <= 0xEF)
{ {
unicode = ch&0x0F; unicode = ch&0x0F;
todo = 2; numbytes = 2;
} }
else if (ch <= 0xF7) else if (ch <= 0xF7)
{ {
unicode = ch&0x07; unicode = ch&0x07;
todo = 3; numbytes = 3;
} }
else else
{ {
throw std::logic_error("not a UTF-8 string"); throw std::logic_error("not a UTF-8 string");
} }
for (size_t j = 0; j < todo; ++j) for (size_t j = 0; j < numbytes; ++j)
{ {
unsigned char ch = utf8[i++]; unsigned char ch = utf8[i++];
if (ch < 0x80 || ch > 0xBF) if (ch < 0x80 || ch > 0xBF)

@ -84,11 +84,11 @@ std::string Utf8Encoder::getUtf8(const char* input, size_t size)
// is also ok.) // is also ok.)
assert(input[size] == 0); assert(input[size] == 0);
// TODO: The rest of this function is designed for single-character // Note: The rest of this function is designed for single-character
// input encodings only. It also assumes that the input the input // input encodings only. It also assumes that the input the input
// encoding shares its first 128 values (0-127) with ASCII. These // encoding shares its first 128 values (0-127) with ASCII. There are
// conditions must be checked again if you add more input encodings // no plans to add more encodings to this module (we are using utf8
// later. // for new content files), so that shouldn't be an issue.
// Compute output length, and check for pure ascii input at the same // Compute output length, and check for pure ascii input at the same
// time. // time.

@ -258,13 +258,12 @@ namespace Physic
const Ogre::Vector3 &position, float scale, const Ogre::Quaternion &rotation); const Ogre::Vector3 &position, float scale, const Ogre::Quaternion &rotation);
/** /**
* Remove a character from the scene. TODO:delete it! for now, a small memory leak^^ done? * Remove a character from the scene.
*/ */
void removeCharacter(const std::string &name); void removeCharacter(const std::string &name);
/** /**
* Return a pointer to a character * Return a pointer to a character
* TODO:check if the actor exist...
*/ */
PhysicActor* getCharacter(const std::string &name); PhysicActor* getCharacter(const std::string &name);

@ -451,7 +451,6 @@ public:
mRenderSystem->_setSceneBlending(Ogre::SBF_SOURCE_ALPHA, Ogre::SBF_ONE_MINUS_SOURCE_ALPHA); mRenderSystem->_setSceneBlending(Ogre::SBF_SOURCE_ALPHA, Ogre::SBF_ONE_MINUS_SOURCE_ALPHA);
// always use wireframe // always use wireframe
// TODO: add option to enable wireframe mode in platform
mRenderSystem->_setPolygonMode(Ogre::PM_SOLID); mRenderSystem->_setPolygonMode(Ogre::PM_SOLID);
} }

Loading…
Cancel
Save