Merge branch 'hidden_markers' into 'master'

Use common implementation to filter hidden markers

See merge request OpenMW/openmw!1132
pull/3097/head
Alexei Dobrohotov 3 years ago
commit 839cf36bdd

@ -510,8 +510,8 @@ namespace MWRender
continue;
}
if (ref.mRefID == "prisonmarker" || ref.mRefID == "divinemarker" || ref.mRefID == "templemarker" || ref.mRefID == "northmarker")
continue; // marker objects that have a hardcoded function in the game logic, should be hidden from the player
if (Misc::ResourceHelpers::isHiddenMarker(ref.mRefID))
continue;
int type = store.findStatic(ref.mRefID);
std::string model = getModel(type, ref.mRefID, store);

@ -94,14 +94,12 @@ namespace
std::string getModel(const MWWorld::Ptr &ptr, const VFS::Manager *vfs)
{
if (Misc::ResourceHelpers::isHiddenMarker(ptr.getCellRef().getRefId()))
return {};
bool useAnim = ptr.getClass().useAnim();
std::string model = ptr.getClass().getModel(ptr);
if (useAnim)
model = Misc::ResourceHelpers::correctActorModelPath(model, vfs);
const std::string &id = ptr.getCellRef().getRefId();
if (id == "prisonmarker" || id == "divinemarker" || id == "templemarker" || id == "northmarker")
model = ""; // marker objects that have a hardcoded function in the game logic, should be hidden from the player
return model;
}

@ -1,6 +1,7 @@
#include "resourcehelpers.hpp"
#include <sstream>
#include <string_view>
#include <components/misc/stringops.hpp>
@ -138,3 +139,8 @@ std::string Misc::ResourceHelpers::correctActorModelPath(const std::string &resP
}
return mdlname;
}
bool Misc::ResourceHelpers::isHiddenMarker(std::string_view id)
{
return id == "prisonmarker" || id == "divinemarker" || id == "templemarker" || id == "northmarker";
}

@ -2,6 +2,7 @@
#define MISC_RESOURCEHELPERS_H
#include <string>
#include <string_view>
namespace VFS
{
@ -23,6 +24,9 @@ namespace Misc
std::string correctBookartPath(const std::string &resPath, int width, int height, const VFS::Manager* vfs);
/// Use "xfoo.nif" instead of "foo.nif" if available
std::string correctActorModelPath(const std::string &resPath, const VFS::Manager* vfs);
/// marker objects that have a hardcoded function in the game logic, should be hidden from the player
bool isHiddenMarker(std::string_view id);
}
}

Loading…
Cancel
Save