Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/openmw-36' into HEAD
Browse files Browse the repository at this point in the history
  • Loading branch information
scrawl committed May 16, 2015
2 parents 60a835c + 5cf5022 commit ddc8896
Show file tree
Hide file tree
Showing 19 changed files with 68 additions and 42 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

Bug #923: Editor: Operations-Multithreading is broken
Bug #1317: Erene Llenim in Seyda Neen does not walk around
Bug #1405: Water rendering glitch near Seyda Neen lighthouse
Bug #1621: "Error Detecting Morrowind Installation" in the default directory
Bug #2216: Creating a clone of the player stops you moving.
Bug #2387: Casting bound weapon spell doesn't switch to "ready weapon" mode
Expand All @@ -23,6 +24,10 @@
Bug #2475: cumulative stacks of 100 point fortify skill speechcraft boosts do not apply correctly
Bug #2498: Editor: crash when issuing undo command after the table subview is closed
Bug #2500: Editor: object table - can't undo delete record
Bug #2518: OpenMW detect spell returns false positives
Bug #2521: NPCs don't react to stealing when inventory menu is open.
Bug #2525: Can't click on red dialogue choice [rise of house telvanni][60fffec]
Bug #2530: GetSpellEffects not working as in vanilla
Feature #139: Editor: Global Search & Replace
Feature #1219: Editor: Add dialogue mode only columns
Feature #2024: Hotkey for hand to hand (i.e. unequip any weapon)
Expand All @@ -34,6 +39,7 @@
Feature #2505: Editor: optionally show a line number column in the script editor
Feature #2512: Editor: Offer use of monospace fonts in the script editor as an option
Feature #2514: Editor: focus on ID input field on clone/add
Feature #2519: it is not possible to change icons that appear on the map after casting the Detect <animal | enchantment | key> spells
Task #2460: OS X: Use Application Support directory as user data path
Task #2516: Editor: Change References / Referenceables terminology

Expand Down
2 changes: 1 addition & 1 deletion apps/openmw/mwclass/creature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ namespace MWClass

float hitchance = MWMechanics::getHitChance(ptr, victim, ref->mBase->mData.mCombat);

if(OEngine::Misc::Rng::rollProbability() >= hitchance/100.0f)
if(OEngine::Misc::Rng::roll0to99() >= hitchance)
{
victim.getClass().onHit(victim, 0.0f, false, MWWorld::Ptr(), ptr, false);
MWMechanics::reduceWeaponCondition(0.f, false, weapon, ptr);
Expand Down
2 changes: 1 addition & 1 deletion apps/openmw/mwclass/npc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -515,7 +515,7 @@ namespace MWClass

float hitchance = MWMechanics::getHitChance(ptr, victim, ptr.getClass().getSkill(ptr, weapskill));

if (OEngine::Misc::Rng::rollProbability() >= hitchance / 100.0f)
if (OEngine::Misc::Rng::roll0to99() >= hitchance)
{
othercls.onHit(victim, 0.0f, false, weapon, ptr, false);
MWMechanics::reduceWeaponCondition(0.f, false, weapon, ptr);
Expand Down
6 changes: 6 additions & 0 deletions apps/openmw/mwdialogue/dialoguemanagerimp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -485,6 +485,12 @@ namespace MWDialogue

executeScript (info->mResultScript);
}
else
{
mChoice = -1;
mIsInChoice = false;
MWBase::Environment::get().getWindowManager()->getDialogueWindow()->clearChoices();
}
}
}

Expand Down
4 changes: 2 additions & 2 deletions apps/openmw/mwgui/inventorywindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -594,6 +594,8 @@ namespace MWGui
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
MWBase::Environment::get().getWorld()->breakInvisibility(player);

MWBase::Environment::get().getMechanicsManager()->itemTaken(player, object, MWWorld::Ptr(), count);

// add to player inventory
// can't use ActionTake here because we need an MWWorld::Ptr to the newly inserted object
MWWorld::Ptr newObject = *player.getClass().getContainerStore (player).add (object, object.getRefData().getCount(), player);
Expand All @@ -612,8 +614,6 @@ namespace MWGui
throw std::runtime_error("Added item not found");
mDragAndDrop->startDrag(i, mSortModel, mTradeModel, mItemView, count);

MWBase::Environment::get().getMechanicsManager()->itemTaken(player, newObject, MWWorld::Ptr(), count);

MWBase::Environment::get().getWindowManager()->updateSpellWindow();
}

Expand Down
24 changes: 10 additions & 14 deletions apps/openmw/mwgui/mapwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -300,17 +300,17 @@ namespace MWGui
MarkerUserData markerPos;
MyGUI::IntPoint widgetPos = getMarkerPosition(marker.mWorldX, marker.mWorldY, markerPos);

MyGUI::IntCoord widgetCoord(widgetPos.left - 4,
widgetPos.top - 4,
8, 8);
MarkerWidget* markerWidget = mLocalMap->createWidget<MarkerWidget>("MarkerButton",
MyGUI::IntCoord widgetCoord(widgetPos.left - 8,
widgetPos.top - 8,
16, 16);
MarkerWidget* markerWidget = mLocalMap->createWidget<MarkerWidget>("CustomMarkerButton",
widgetCoord, MyGUI::Align::Default);
markerWidget->setDepth(Local_MarkerAboveFogLayer);
markerWidget->setUserString("ToolTipType", "Layout");
markerWidget->setUserString("ToolTipLayout", "TextToolTipOneLine");
markerWidget->setUserString("Caption_TextOneLine", MyGUI::TextIterator::toTagsString(marker.mNote));
markerWidget->setNormalColour(MyGUI::Colour(1.0f, 0.3f, 0.3f));
markerWidget->setHoverColour(MyGUI::Colour(1.0f, 0.5f, 0.5f));
markerWidget->setNormalColour(MyGUI::Colour(0.6f, 0.6f, 0.6f));
markerWidget->setHoverColour(MyGUI::Colour(1.0f, 1.0f, 1.0f));
markerWidget->setUserData(marker);
markerWidget->setNeedMouseFocus(true);
customMarkerCreated(markerWidget);
Expand Down Expand Up @@ -468,21 +468,17 @@ namespace MWGui
return;

std::string markerTexture;
MyGUI::Colour markerColour;
if (type == MWBase::World::Detect_Creature)
{
markerTexture = "textures\\menu_map_dcreature.dds";
markerColour = MyGUI::Colour(1,0,0,1);
markerTexture = "textures\\detect_animal_icon.dds";
}
if (type == MWBase::World::Detect_Key)
{
markerTexture = "textures\\menu_map_dkey.dds";
markerColour = MyGUI::Colour(0,1,0,1);
markerTexture = "textures\\detect_key_icon.dds";
}
if (type == MWBase::World::Detect_Enchantment)
{
markerTexture = "textures\\menu_map_dmagic.dds";
markerColour = MyGUI::Colour(0,0,1,1);
markerTexture = "textures\\detect_enchantment_icon.dds";
}

int counter = 0;
Expand All @@ -499,7 +495,7 @@ namespace MWGui
widgetCoord, MyGUI::Align::Default);
markerWidget->setDepth(Local_MarkerAboveFogLayer);
markerWidget->setImageTexture(markerTexture);
markerWidget->setColour(markerColour);
markerWidget->setImageCoord(MyGUI::IntCoord(0,0,8,8));
markerWidget->setNeedMouseFocus(false);
mMagicMarkerWidgets.push_back(markerWidget);
}
Expand Down
2 changes: 1 addition & 1 deletion apps/openmw/mwgui/pickpocketitemmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ namespace MWGui
{
for (size_t i = 0; i<mSourceModel->getItemCount(); ++i)
{
if (chance <= OEngine::Misc::Rng::roll0to99())
if (OEngine::Misc::Rng::roll0to99() > chance)
mHiddenItems.push_back(mSourceModel->getItem(i));
}
}
Expand Down
8 changes: 1 addition & 7 deletions apps/openmw/mwgui/spellbuyingwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,13 +127,7 @@ namespace MWGui
bool SpellBuyingWindow::playerHasSpell(const std::string &id)
{
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
MWMechanics::Spells& playerSpells = player.getClass().getCreatureStats (player).getSpells();
for (MWMechanics::Spells::TIterator it = playerSpells.begin(); it != playerSpells.end(); ++it)
{
if (Misc::StringUtils::ciEqual(id, it->first))
return true;
}
return false;
return player.getClass().getCreatureStats(player).getSpells().hasSpell(id);
}

void SpellBuyingWindow::onSpellButtonClick(MyGUI::Widget* _sender)
Expand Down
3 changes: 2 additions & 1 deletion apps/openmw/mwgui/waitdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,9 @@ namespace MWGui
if (!region->mSleepList.empty())
{
// figure out if player will be woken while sleeping
int x = OEngine::Misc::Rng::rollDice(hoursToWait);
float fSleepRandMod = world->getStore().get<ESM::GameSetting>().find("fSleepRandMod")->getFloat();
if (OEngine::Misc::Rng::rollProbability() > fSleepRandMod)
if (x > fSleepRandMod * hoursToWait)
{
float fSleepRestMod = world->getStore().get<ESM::GameSetting>().find("fSleepRestMod")->getFloat();
mInterruptAt = hoursToWait - int(fSleepRestMod * hoursToWait);
Expand Down
2 changes: 1 addition & 1 deletion apps/openmw/mwmechanics/combat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ namespace MWMechanics
int skillValue = attacker.getClass().getSkill(attacker,
weapon.getClass().getEquipmentSkill(weapon));

if (OEngine::Misc::Rng::rollProbability() >= getHitChance(attacker, victim, skillValue) / 100.0f)
if (OEngine::Misc::Rng::roll0to99() >= getHitChance(attacker, victim, skillValue))
{
victim.getClass().onHit(victim, 0.0f, false, projectile, attacker, false);
MWMechanics::reduceWeaponCondition(0.f, false, weapon, attacker);
Expand Down
2 changes: 1 addition & 1 deletion apps/openmw/mwmechanics/mechanicsmanagerimp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -737,7 +737,7 @@ namespace MWMechanics
float x = 0;
float y = 0;

float roll = OEngine::Misc::Rng::rollClosedProbability() * 100;
int roll = OEngine::Misc::Rng::roll0to99();

if (type == PT_Admire)
{
Expand Down
14 changes: 14 additions & 0 deletions apps/openmw/mwmechanics/spells.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,20 @@ namespace MWMechanics
return mSelectedSpell;
}

bool Spells::isSpellActive(const std::string &id) const
{
TContainer::const_iterator found = mSpells.find(id);
if (found != mSpells.end())
{
const ESM::Spell *spell =
MWBase::Environment::get().getWorld()->getStore().get<ESM::Spell>().find (id);

return (spell->mData.mType==ESM::Spell::ST_Ability || spell->mData.mType==ESM::Spell::ST_Blight ||
spell->mData.mType==ESM::Spell::ST_Disease || spell->mData.mType==ESM::Spell::ST_Curse);
}
return false;
}

bool Spells::hasCommonDisease() const
{
for (TIterator iter = mSpells.begin(); iter!=mSpells.end(); ++iter)
Expand Down
3 changes: 3 additions & 0 deletions apps/openmw/mwmechanics/spells.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,9 @@ namespace MWMechanics
const std::string getSelectedSpell() const;
///< May return an empty string.

bool isSpellActive(const std::string& id) const;
///< Are we under the effects of the given spell ID?

bool hasCommonDisease() const;

bool hasBlightDisease() const;
Expand Down
3 changes: 2 additions & 1 deletion apps/openmw/mwscript/miscextensions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -595,7 +595,8 @@ namespace MWScript
std::string id = runtime.getStringLiteral(runtime[0].mInteger);
runtime.pop();

runtime.push(ptr.getClass().getCreatureStats(ptr).getActiveSpells().isSpellActive(id));
const MWMechanics::CreatureStats& stats = ptr.getClass().getCreatureStats(ptr);
runtime.push(stats.getActiveSpells().isSpellActive(id) || stats.getSpells().isSpellActive(id));
}
};

Expand Down
10 changes: 2 additions & 8 deletions apps/openmw/mwscript/statsextensions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -515,14 +515,8 @@ namespace MWScript

Interpreter::Type_Integer value = 0;

for (MWMechanics::Spells::TIterator iter (
ptr.getClass().getCreatureStats (ptr).getSpells().begin());
iter!=ptr.getClass().getCreatureStats (ptr).getSpells().end(); ++iter)
if (iter->first==id)
{
value = 1;
break;
}
if (ptr.getClass().getCreatureStats(ptr).getSpells().hasSpell(id))
value = 1;

runtime.push (value);
}
Expand Down
1 change: 1 addition & 0 deletions apps/openmw/mwworld/cellstore.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ namespace MWWorld

/// Call functor (ref) for each reference. functor must return a bool. Returning
/// false will abort the iteration.
/// \attention This function also lists deleted (count 0) objects!
/// \return Iteration completed?
///
/// \note Creatures and NPCs are handled last.
Expand Down
7 changes: 4 additions & 3 deletions apps/openmw/mwworld/scene.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -256,12 +256,13 @@ namespace MWWorld
insertCell (*cell, true, loadingListener);

mRendering.cellAdded (cell);
bool waterEnabled = cell->getCell()->hasWater();
bool waterEnabled = cell->getCell()->hasWater() || cell->isExterior();
mRendering.setWaterEnabled(waterEnabled);
float waterLevel = cell->isExterior() ? -1.f : cell->getWaterLevel();
if (waterEnabled)
{
mPhysics->enableWater(cell->getWaterLevel());
mRendering.setWaterHeight(cell->getWaterLevel());
mPhysics->enableWater(waterLevel);
mRendering.setWaterHeight(waterLevel);
}
else
mPhysics->disableWater();
Expand Down
2 changes: 1 addition & 1 deletion apps/openmw/mwworld/worldimp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2956,7 +2956,7 @@ namespace MWWorld
Ogre::Vector3(mDetector.getRefData().getPosition().pos)) >= mSquaredDist)
return true;

if (!ptr.getRefData().isEnabled())
if (!ptr.getRefData().isEnabled() || ptr.getRefData().isDeleted())
return true;

// Consider references inside containers as well (except if we are looking for a Creature, they cannot be in containers)
Expand Down
9 changes: 9 additions & 0 deletions files/mygui/openmw_resources.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,15 @@
</BasisSkin>
</Resource>

<Resource type="ResourceLayout" name="CustomMarkerButton" version="3.2.0">
<Widget type="Widget" skin="" position="0 0 16 16" name="Root">
<Widget type="ImageBox" skin="ImageBox" position="0 0 16 16" align="Stretch">
<Property key="ImageTexture" value="icons\map_marker_red.dds"/>
<Property key="NeedMouse" value="false"/>
</Widget>
</Widget>
</Resource>

<Resource type="ResourceLayout" name="TabControl" version="3.2.0">
<Widget type="Widget" skin="" position="5 5 89 60" name="Root">
<UserString key="ButtonSkin" value="MW_Button_RightPadding"/>
Expand Down

0 comments on commit ddc8896

Please sign in to comment.