2010-07-26 23:09:37 +02:00
|
|
|
#include "statsextensions.hpp"
|
|
|
|
|
2012-07-09 20:42:45 +02:00
|
|
|
#include <cmath>
|
|
|
|
|
2022-12-01 17:07:10 +01:00
|
|
|
#include <components/esm3/loadcrea.hpp>
|
2022-01-22 15:58:41 +01:00
|
|
|
#include <components/esm3/loadnpc.hpp>
|
2012-07-09 20:42:45 +02:00
|
|
|
|
2012-10-01 19:17:04 +04:00
|
|
|
#include "../mwworld/esmstore.hpp"
|
2012-07-03 15:53:42 +02:00
|
|
|
|
2013-08-06 20:38:41 -04:00
|
|
|
#include <components/compiler/opcodes.hpp>
|
2018-08-14 23:05:43 +04:00
|
|
|
#include <components/debug/debuglog.hpp>
|
2022-09-05 19:35:15 +02:00
|
|
|
#include <components/esm3/loadfact.hpp>
|
2010-07-26 23:09:37 +02:00
|
|
|
#include <components/interpreter/interpreter.hpp>
|
|
|
|
#include <components/interpreter/opcodes.hpp>
|
2022-09-05 19:35:15 +02:00
|
|
|
#include <components/interpreter/runtime.hpp>
|
|
|
|
|
|
|
|
#include <components/esm3/loadmgef.hpp>
|
2010-07-26 23:09:37 +02:00
|
|
|
|
2012-04-23 15:27:03 +02:00
|
|
|
#include "../mwbase/environment.hpp"
|
2012-10-27 11:33:18 +02:00
|
|
|
#include "../mwbase/mechanicsmanager.hpp"
|
2018-07-26 19:54:08 +03:00
|
|
|
#include "../mwbase/statemanager.hpp"
|
2014-02-11 16:34:23 +01:00
|
|
|
#include "../mwbase/windowmanager.hpp"
|
2015-02-09 17:45:48 +01:00
|
|
|
#include "../mwbase/world.hpp"
|
2012-04-23 15:27:03 +02:00
|
|
|
|
2010-08-03 11:49:12 +02:00
|
|
|
#include "../mwworld/class.hpp"
|
2014-10-25 21:09:37 +02:00
|
|
|
#include "../mwworld/player.hpp"
|
2010-08-03 11:49:12 +02:00
|
|
|
|
2015-08-21 21:12:39 +12:00
|
|
|
#include "../mwmechanics/actorutil.hpp"
|
2010-08-03 13:32:37 +02:00
|
|
|
#include "../mwmechanics/creaturestats.hpp"
|
2012-01-25 16:56:49 +01:00
|
|
|
#include "../mwmechanics/npcstats.hpp"
|
2010-08-03 13:32:37 +02:00
|
|
|
|
2010-12-31 19:09:25 +01:00
|
|
|
#include "ref.hpp"
|
2010-07-26 23:09:37 +02:00
|
|
|
|
2012-11-10 14:31:58 +01:00
|
|
|
namespace
|
|
|
|
{
|
2023-02-20 23:18:05 +01:00
|
|
|
ESM::RefId getDialogueActorFaction(const MWWorld::ConstPtr& actor)
|
2012-11-10 14:31:58 +01:00
|
|
|
{
|
2023-02-20 23:18:05 +01:00
|
|
|
ESM::RefId factionId = actor.getClass().getPrimaryFaction(actor);
|
2015-01-27 17:32:21 +01:00
|
|
|
if (factionId.empty())
|
2012-11-10 14:31:58 +01:00
|
|
|
throw std::runtime_error("failed to determine dialogue actors faction (because actor is factionless)");
|
2012-11-13 16:11:03 +01:00
|
|
|
|
2015-01-27 17:32:21 +01:00
|
|
|
return factionId;
|
2012-11-10 14:31:58 +01:00
|
|
|
}
|
2021-11-20 00:15:18 +01:00
|
|
|
|
|
|
|
void modStat(MWMechanics::AttributeValue& stat, float amount)
|
|
|
|
{
|
2022-07-12 19:59:18 +02:00
|
|
|
const float base = stat.getBase();
|
|
|
|
const float modifier = stat.getModifier() - stat.getDamage();
|
|
|
|
const float modified = base + modifier;
|
|
|
|
// Clamp to 100 unless base < 100 and we have a fortification going
|
|
|
|
if ((modifier <= 0.f || base >= 100.f) && amount > 0.f)
|
2021-11-20 00:15:18 +01:00
|
|
|
amount = std::clamp(100.f - modified, 0.f, amount);
|
2022-07-12 19:59:18 +02:00
|
|
|
// Clamp the modified value in a way that doesn't properly account for negative numbers
|
|
|
|
float newModified = modified + amount;
|
|
|
|
if (newModified < 0.f)
|
|
|
|
{
|
|
|
|
if (modified >= 0.f)
|
|
|
|
newModified = 0.f;
|
|
|
|
else if (newModified < modified)
|
|
|
|
newModified = modified;
|
|
|
|
}
|
|
|
|
// Calculate damage/fortification based on the clamped base value
|
|
|
|
stat.setBase(std::clamp(base + amount, 0.f, 100.f), true);
|
|
|
|
stat.setModifier(newModified - stat.getBase());
|
2021-11-20 00:15:18 +01:00
|
|
|
}
|
2022-12-01 17:07:10 +01:00
|
|
|
|
|
|
|
template <class T>
|
|
|
|
void updateBaseRecord(MWWorld::Ptr& ptr)
|
|
|
|
{
|
2023-04-20 21:07:53 +02:00
|
|
|
const auto& store = *MWBase::Environment::get().getESMStore();
|
2022-12-01 17:07:10 +01:00
|
|
|
const T* base = store.get<T>().find(ptr.getCellRef().getRefId());
|
|
|
|
ptr.get<T>()->mBase = base;
|
|
|
|
}
|
2012-11-10 14:31:58 +01:00
|
|
|
}
|
2012-04-04 22:14:38 +02:00
|
|
|
|
2010-07-26 23:09:37 +02:00
|
|
|
namespace MWScript
|
|
|
|
{
|
|
|
|
namespace Stats
|
|
|
|
{
|
2012-09-15 17:12:42 +02:00
|
|
|
template <class R>
|
|
|
|
class OpGetLevel : public Interpreter::Opcode0
|
|
|
|
{
|
|
|
|
public:
|
2020-10-16 22:18:54 +04:00
|
|
|
void execute(Interpreter::Runtime& runtime) override
|
2012-09-15 17:12:42 +02:00
|
|
|
{
|
|
|
|
MWWorld::Ptr ptr = R()(runtime);
|
|
|
|
|
|
|
|
Interpreter::Type_Integer value = ptr.getClass().getCreatureStats(ptr).getLevel();
|
|
|
|
|
|
|
|
runtime.push(value);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
template <class R>
|
|
|
|
class OpSetLevel : public Interpreter::Opcode0
|
|
|
|
{
|
|
|
|
public:
|
2020-10-16 22:18:54 +04:00
|
|
|
void execute(Interpreter::Runtime& runtime) override
|
2012-09-15 17:12:42 +02:00
|
|
|
{
|
|
|
|
MWWorld::Ptr ptr = R()(runtime);
|
|
|
|
|
|
|
|
Interpreter::Type_Integer value = runtime[0].mInteger;
|
|
|
|
runtime.pop();
|
|
|
|
|
|
|
|
ptr.getClass().getCreatureStats(ptr).setLevel(value);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2010-12-31 19:09:25 +01:00
|
|
|
template <class R>
|
2010-07-26 23:09:37 +02:00
|
|
|
class OpGetAttribute : public Interpreter::Opcode0
|
|
|
|
{
|
|
|
|
int mIndex;
|
2010-07-28 18:27:46 +02:00
|
|
|
|
2010-07-26 23:09:37 +02:00
|
|
|
public:
|
|
|
|
OpGetAttribute(int index)
|
|
|
|
: mIndex(index)
|
|
|
|
{
|
|
|
|
}
|
2010-07-28 18:27:46 +02:00
|
|
|
|
2020-10-16 22:18:54 +04:00
|
|
|
void execute(Interpreter::Runtime& runtime) override
|
2010-07-26 23:09:37 +02:00
|
|
|
{
|
2010-12-31 19:09:25 +01:00
|
|
|
MWWorld::Ptr ptr = R()(runtime);
|
2010-08-03 11:49:12 +02:00
|
|
|
|
2018-12-23 15:18:33 +04:00
|
|
|
Interpreter::Type_Float value = ptr.getClass().getCreatureStats(ptr).getAttribute(mIndex).getModified();
|
2010-07-28 18:27:46 +02:00
|
|
|
|
|
|
|
runtime.push(value);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2010-12-31 19:09:25 +01:00
|
|
|
template <class R>
|
2010-07-26 23:09:37 +02:00
|
|
|
class OpSetAttribute : public Interpreter::Opcode0
|
|
|
|
{
|
|
|
|
int mIndex;
|
2010-07-28 18:27:46 +02:00
|
|
|
|
2010-07-26 23:09:37 +02:00
|
|
|
public:
|
|
|
|
OpSetAttribute(int index)
|
|
|
|
: mIndex(index)
|
|
|
|
{
|
|
|
|
}
|
2010-07-28 18:27:46 +02:00
|
|
|
|
2020-10-16 22:18:54 +04:00
|
|
|
void execute(Interpreter::Runtime& runtime) override
|
2010-07-26 23:09:37 +02:00
|
|
|
{
|
2010-12-31 19:09:25 +01:00
|
|
|
MWWorld::Ptr ptr = R()(runtime);
|
2010-07-28 18:27:46 +02:00
|
|
|
|
2018-12-23 15:18:33 +04:00
|
|
|
Interpreter::Type_Float value = runtime[0].mFloat;
|
2010-07-26 23:09:37 +02:00
|
|
|
runtime.pop();
|
2010-07-28 18:27:46 +02:00
|
|
|
|
2014-01-03 01:59:15 +01:00
|
|
|
MWMechanics::AttributeValue attribute = ptr.getClass().getCreatureStats(ptr).getAttribute(mIndex);
|
2021-11-20 00:15:18 +01:00
|
|
|
attribute.setBase(value, true);
|
2013-12-28 17:19:35 +01:00
|
|
|
ptr.getClass().getCreatureStats(ptr).setAttribute(mIndex, attribute);
|
2010-07-28 18:27:46 +02:00
|
|
|
}
|
2010-07-26 23:09:37 +02:00
|
|
|
};
|
2010-07-28 18:27:46 +02:00
|
|
|
|
2010-12-31 19:09:25 +01:00
|
|
|
template <class R>
|
2010-07-26 23:09:37 +02:00
|
|
|
class OpModAttribute : public Interpreter::Opcode0
|
|
|
|
{
|
|
|
|
int mIndex;
|
2010-07-28 18:27:46 +02:00
|
|
|
|
2010-07-26 23:09:37 +02:00
|
|
|
public:
|
|
|
|
OpModAttribute(int index)
|
|
|
|
: mIndex(index)
|
|
|
|
{
|
|
|
|
}
|
2010-07-28 18:27:46 +02:00
|
|
|
|
2020-10-16 22:18:54 +04:00
|
|
|
void execute(Interpreter::Runtime& runtime) override
|
2010-07-26 23:09:37 +02:00
|
|
|
{
|
2010-12-31 19:09:25 +01:00
|
|
|
MWWorld::Ptr ptr = R()(runtime);
|
2010-07-28 18:27:46 +02:00
|
|
|
|
2018-12-23 15:18:33 +04:00
|
|
|
Interpreter::Type_Float value = runtime[0].mFloat;
|
2010-07-26 23:09:37 +02:00
|
|
|
runtime.pop();
|
2010-07-28 18:27:46 +02:00
|
|
|
|
2014-05-22 20:37:22 +02:00
|
|
|
MWMechanics::AttributeValue attribute = ptr.getClass().getCreatureStats(ptr).getAttribute(mIndex);
|
2021-11-20 00:15:18 +01:00
|
|
|
modStat(attribute, value);
|
2013-12-28 17:19:35 +01:00
|
|
|
ptr.getClass().getCreatureStats(ptr).setAttribute(mIndex, attribute);
|
2010-07-28 18:27:46 +02:00
|
|
|
}
|
|
|
|
};
|
2010-07-26 23:09:37 +02:00
|
|
|
|
2010-12-31 19:09:25 +01:00
|
|
|
template <class R>
|
2010-07-28 18:27:46 +02:00
|
|
|
class OpGetDynamic : public Interpreter::Opcode0
|
|
|
|
{
|
|
|
|
int mIndex;
|
|
|
|
|
|
|
|
public:
|
|
|
|
OpGetDynamic(int index)
|
|
|
|
: mIndex(index)
|
2022-09-22 21:26:05 +03:00
|
|
|
{
|
|
|
|
}
|
2010-07-28 18:27:46 +02:00
|
|
|
|
|
|
|
void execute(Interpreter::Runtime& runtime) override
|
|
|
|
{
|
|
|
|
MWWorld::Ptr ptr = R()(runtime);
|
|
|
|
Interpreter::Type_Float value;
|
|
|
|
|
2020-10-16 22:18:54 +04:00
|
|
|
if (mIndex == 0 && ptr.getClass().hasItemHealth(ptr))
|
2010-07-28 18:27:46 +02:00
|
|
|
{
|
2010-07-28 19:38:14 +02:00
|
|
|
// health is a special case
|
2015-03-08 13:07:29 +13:00
|
|
|
value = static_cast<Interpreter::Type_Float>(ptr.getClass().getItemMaxHealth(ptr));
|
2012-07-22 18:29:54 +04:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
value = ptr.getClass().getCreatureStats(ptr).getDynamic(mIndex).getCurrent();
|
2021-02-07 11:58:23 +01:00
|
|
|
// GetMagicka shouldn't return negative values
|
|
|
|
if (mIndex == 1 && value < 0)
|
|
|
|
value = 0;
|
2010-07-28 18:27:46 +02:00
|
|
|
}
|
|
|
|
runtime.push(value);
|
2022-09-22 21:26:05 +03:00
|
|
|
}
|
2010-07-28 18:27:46 +02:00
|
|
|
};
|
|
|
|
|
2010-12-31 19:09:25 +01:00
|
|
|
template <class R>
|
2010-07-28 18:27:46 +02:00
|
|
|
class OpSetDynamic : public Interpreter::Opcode0
|
|
|
|
{
|
|
|
|
int mIndex;
|
|
|
|
|
|
|
|
public:
|
|
|
|
OpSetDynamic(int index)
|
|
|
|
: mIndex(index)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2020-10-16 22:18:54 +04:00
|
|
|
void execute(Interpreter::Runtime& runtime) override
|
2010-07-28 18:27:46 +02:00
|
|
|
{
|
2010-12-31 19:09:25 +01:00
|
|
|
MWWorld::Ptr ptr = R()(runtime);
|
2010-07-28 18:27:46 +02:00
|
|
|
|
2012-10-19 18:01:45 +02:00
|
|
|
Interpreter::Type_Float value = runtime[0].mFloat;
|
2010-07-28 18:27:46 +02:00
|
|
|
runtime.pop();
|
|
|
|
|
2014-05-22 20:37:22 +02:00
|
|
|
MWMechanics::DynamicStat<float> stat(ptr.getClass().getCreatureStats(ptr).getDynamic(mIndex));
|
2012-10-19 13:10:06 +02:00
|
|
|
|
2022-02-10 20:31:27 +01:00
|
|
|
stat.setBase(value);
|
2022-02-10 20:46:20 +01:00
|
|
|
stat.setCurrent(stat.getModified(false), true, true);
|
2012-11-13 16:11:03 +01:00
|
|
|
|
2014-05-22 20:37:22 +02:00
|
|
|
ptr.getClass().getCreatureStats(ptr).setDynamic(mIndex, stat);
|
2010-07-28 18:27:46 +02:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2010-12-31 19:09:25 +01:00
|
|
|
template <class R>
|
2010-07-28 18:27:46 +02:00
|
|
|
class OpModDynamic : public Interpreter::Opcode0
|
|
|
|
{
|
|
|
|
int mIndex;
|
|
|
|
|
|
|
|
public:
|
|
|
|
OpModDynamic(int index)
|
|
|
|
: mIndex(index)
|
2022-09-22 21:26:05 +03:00
|
|
|
{
|
|
|
|
}
|
2010-07-28 18:27:46 +02:00
|
|
|
|
|
|
|
void execute(Interpreter::Runtime& runtime) override
|
|
|
|
{
|
|
|
|
int peek = R::implicit ? 0 : runtime[0].mInteger;
|
|
|
|
|
2014-10-15 16:27:03 +02:00
|
|
|
MWWorld::Ptr ptr = R()(runtime);
|
2014-10-15 16:12:57 +02:00
|
|
|
|
2010-12-31 19:09:25 +01:00
|
|
|
Interpreter::Type_Float diff = runtime[0].mFloat;
|
|
|
|
runtime.pop();
|
2010-07-28 18:27:46 +02:00
|
|
|
|
2012-10-19 18:01:45 +02:00
|
|
|
// workaround broken endgame scripts that kill dagoth ur
|
2022-10-18 09:26:55 +02:00
|
|
|
if (!R::implicit && ptr.getCellRef().getRefId() == "dagoth_ur_1")
|
2022-09-22 21:26:05 +03:00
|
|
|
{
|
2010-07-28 18:27:46 +02:00
|
|
|
runtime.push(peek);
|
|
|
|
|
2015-09-24 15:21:42 +02:00
|
|
|
if (R()(runtime, false, true).isEmpty())
|
2014-10-15 16:12:57 +02:00
|
|
|
{
|
|
|
|
Log(Debug::Warning) << "Warning: Compensating for broken script in Morrowind.esm by "
|
|
|
|
<< "ignoring remote access to dagoth_ur_1";
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
2022-09-22 21:26:05 +03:00
|
|
|
}
|
2014-10-15 14:59:34 +02:00
|
|
|
|
2022-02-10 20:31:27 +01:00
|
|
|
MWMechanics::CreatureStats& stats = ptr.getClass().getCreatureStats(ptr);
|
2010-07-28 18:27:46 +02:00
|
|
|
|
2022-02-10 20:31:27 +01:00
|
|
|
MWMechanics::DynamicStat<float> stat = stats.getDynamic(mIndex);
|
2010-07-28 18:27:46 +02:00
|
|
|
|
2022-02-10 20:31:27 +01:00
|
|
|
float current = stat.getCurrent();
|
|
|
|
float base = diff + stat.getBase();
|
|
|
|
if (mIndex != 2)
|
|
|
|
base = std::max(base, 0.f);
|
|
|
|
stat.setBase(base);
|
2022-02-10 20:46:20 +01:00
|
|
|
stat.setCurrent(diff + current, true, true);
|
2012-10-19 13:10:06 +02:00
|
|
|
|
2022-02-10 20:31:27 +01:00
|
|
|
stats.setDynamic(mIndex, stat);
|
2010-07-28 18:27:46 +02:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2010-12-31 19:09:25 +01:00
|
|
|
template <class R>
|
2010-07-28 19:00:54 +02:00
|
|
|
class OpModCurrentDynamic : public Interpreter::Opcode0
|
|
|
|
{
|
|
|
|
int mIndex;
|
|
|
|
|
2022-09-22 21:26:05 +03:00
|
|
|
public:
|
2020-10-16 22:18:54 +04:00
|
|
|
OpModCurrentDynamic(int index)
|
2010-07-28 19:00:54 +02:00
|
|
|
: mIndex(index)
|
|
|
|
{
|
2022-09-22 21:26:05 +03:00
|
|
|
}
|
2010-07-28 19:00:54 +02:00
|
|
|
|
2012-10-19 18:01:45 +02:00
|
|
|
void execute(Interpreter::Runtime& runtime) override
|
2022-09-22 21:26:05 +03:00
|
|
|
{
|
2010-07-28 19:00:54 +02:00
|
|
|
MWWorld::Ptr ptr = R()(runtime);
|
|
|
|
|
2014-05-22 20:37:22 +02:00
|
|
|
Interpreter::Type_Float diff = runtime[0].mFloat;
|
|
|
|
runtime.pop();
|
2010-07-28 19:00:54 +02:00
|
|
|
|
2012-10-19 18:01:45 +02:00
|
|
|
MWMechanics::CreatureStats& stats = ptr.getClass().getCreatureStats(ptr);
|
2010-07-28 19:00:54 +02:00
|
|
|
|
2014-05-22 20:37:22 +02:00
|
|
|
Interpreter::Type_Float current = stats.getDynamic(mIndex).getCurrent();
|
2012-10-19 13:10:06 +02:00
|
|
|
|
2020-02-21 00:05:13 +03:00
|
|
|
MWMechanics::DynamicStat<float> stat(ptr.getClass().getCreatureStats(ptr).getDynamic(mIndex));
|
2012-10-19 13:10:06 +02:00
|
|
|
|
2020-02-21 00:05:13 +03:00
|
|
|
bool allowDecreaseBelowZero = false;
|
2014-05-22 20:37:22 +02:00
|
|
|
if (mIndex == 2) // Fatigue-specific logic
|
2022-09-22 21:26:05 +03:00
|
|
|
{
|
2014-05-22 20:37:22 +02:00
|
|
|
// For fatigue, a negative current value is allowed and means the actor will be knocked down
|
2020-02-21 00:05:13 +03:00
|
|
|
allowDecreaseBelowZero = true;
|
|
|
|
// Knock down the actor immediately if a non-positive new value is the case
|
2014-05-22 20:37:22 +02:00
|
|
|
if (diff + current <= 0.f)
|
|
|
|
ptr.getClass().getCreatureStats(ptr).setKnockedDown(true);
|
2010-07-28 19:00:54 +02:00
|
|
|
}
|
2014-11-28 14:48:03 +01:00
|
|
|
stat.setCurrent(diff + current, allowDecreaseBelowZero);
|
2022-09-22 21:26:05 +03:00
|
|
|
|
2022-02-10 22:10:46 +01:00
|
|
|
ptr.getClass().getCreatureStats(ptr).setDynamic(mIndex, stat);
|
2022-09-22 21:26:05 +03:00
|
|
|
}
|
2010-07-28 19:00:54 +02:00
|
|
|
};
|
|
|
|
|
2010-12-31 19:09:25 +01:00
|
|
|
template <class R>
|
2010-07-28 19:12:50 +02:00
|
|
|
class OpGetDynamicGetRatio : public Interpreter::Opcode0
|
|
|
|
{
|
|
|
|
int mIndex;
|
|
|
|
|
|
|
|
public:
|
|
|
|
OpGetDynamicGetRatio(int index)
|
|
|
|
: mIndex(index)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2020-10-16 22:18:54 +04:00
|
|
|
void execute(Interpreter::Runtime& runtime) override
|
2010-07-28 19:12:50 +02:00
|
|
|
{
|
2010-12-31 19:09:25 +01:00
|
|
|
MWWorld::Ptr ptr = R()(runtime);
|
2022-02-10 22:10:46 +01:00
|
|
|
const MWMechanics::CreatureStats& stats = ptr.getClass().getCreatureStats(ptr);
|
2010-08-03 11:49:12 +02:00
|
|
|
|
2022-02-10 22:10:46 +01:00
|
|
|
runtime.push(stats.getDynamic(mIndex).getRatio());
|
2010-07-28 19:12:50 +02:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2010-12-31 19:09:25 +01:00
|
|
|
template <class R>
|
2010-10-20 11:31:42 +02:00
|
|
|
class OpGetSkill : public Interpreter::Opcode0
|
|
|
|
{
|
2023-06-05 21:21:30 +02:00
|
|
|
ESM::RefId mId;
|
2010-10-20 11:31:42 +02:00
|
|
|
|
|
|
|
public:
|
2023-06-05 21:21:30 +02:00
|
|
|
OpGetSkill(ESM::RefId id)
|
|
|
|
: mId(id)
|
2010-10-20 11:31:42 +02:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2020-10-16 22:18:54 +04:00
|
|
|
void execute(Interpreter::Runtime& runtime) override
|
2010-10-20 11:31:42 +02:00
|
|
|
{
|
2010-12-31 19:09:25 +01:00
|
|
|
MWWorld::Ptr ptr = R()(runtime);
|
2010-10-20 11:31:42 +02:00
|
|
|
|
2023-06-05 21:21:30 +02:00
|
|
|
Interpreter::Type_Float value = ptr.getClass().getSkill(ptr, mId);
|
2010-10-20 11:31:42 +02:00
|
|
|
|
|
|
|
runtime.push(value);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2010-12-31 19:09:25 +01:00
|
|
|
template <class R>
|
2010-10-20 11:31:42 +02:00
|
|
|
class OpSetSkill : public Interpreter::Opcode0
|
|
|
|
{
|
2023-06-05 21:21:30 +02:00
|
|
|
ESM::RefId mId;
|
2010-10-20 11:31:42 +02:00
|
|
|
|
|
|
|
public:
|
2023-06-05 21:21:30 +02:00
|
|
|
OpSetSkill(ESM::RefId id)
|
|
|
|
: mId(id)
|
2010-10-20 11:31:42 +02:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2020-10-16 22:18:54 +04:00
|
|
|
void execute(Interpreter::Runtime& runtime) override
|
2010-10-20 11:31:42 +02:00
|
|
|
{
|
2010-12-31 19:09:25 +01:00
|
|
|
MWWorld::Ptr ptr = R()(runtime);
|
2010-10-20 11:31:42 +02:00
|
|
|
|
2018-12-23 15:18:33 +04:00
|
|
|
Interpreter::Type_Float value = runtime[0].mFloat;
|
2010-10-20 11:31:42 +02:00
|
|
|
runtime.pop();
|
|
|
|
|
2014-05-22 20:37:22 +02:00
|
|
|
MWMechanics::NpcStats& stats = ptr.getClass().getNpcStats(ptr);
|
2012-07-09 20:42:45 +02:00
|
|
|
|
2023-06-05 21:21:30 +02:00
|
|
|
stats.getSkill(mId).setBase(value, true);
|
2010-10-20 11:31:42 +02:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2010-12-31 19:09:25 +01:00
|
|
|
template <class R>
|
2010-10-20 11:31:42 +02:00
|
|
|
class OpModSkill : public Interpreter::Opcode0
|
|
|
|
{
|
2023-06-05 21:21:30 +02:00
|
|
|
ESM::RefId mId;
|
2010-10-20 11:31:42 +02:00
|
|
|
|
|
|
|
public:
|
2023-06-05 21:21:30 +02:00
|
|
|
OpModSkill(ESM::RefId id)
|
|
|
|
: mId(id)
|
2010-10-20 11:31:42 +02:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2020-10-16 22:18:54 +04:00
|
|
|
void execute(Interpreter::Runtime& runtime) override
|
2010-10-20 11:31:42 +02:00
|
|
|
{
|
2010-12-31 19:09:25 +01:00
|
|
|
MWWorld::Ptr ptr = R()(runtime);
|
2010-10-20 11:31:42 +02:00
|
|
|
|
2018-12-23 15:18:33 +04:00
|
|
|
Interpreter::Type_Float value = runtime[0].mFloat;
|
2010-10-20 11:31:42 +02:00
|
|
|
runtime.pop();
|
|
|
|
|
2023-06-05 21:21:30 +02:00
|
|
|
MWMechanics::SkillValue& skill = ptr.getClass().getNpcStats(ptr).getSkill(mId);
|
2021-11-20 00:15:18 +01:00
|
|
|
modStat(skill, value);
|
2010-10-20 11:31:42 +02:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2012-12-28 22:26:21 +00:00
|
|
|
class OpGetPCCrimeLevel : public Interpreter::Opcode0
|
|
|
|
{
|
|
|
|
public:
|
2020-10-16 22:18:54 +04:00
|
|
|
void execute(Interpreter::Runtime& runtime) override
|
2012-12-28 22:26:21 +00:00
|
|
|
{
|
|
|
|
MWBase::World* world = MWBase::Environment::get().getWorld();
|
2014-01-08 18:39:44 +01:00
|
|
|
MWWorld::Ptr player = world->getPlayerPtr();
|
2014-05-22 20:37:22 +02:00
|
|
|
runtime.push(static_cast<Interpreter::Type_Float>(player.getClass().getNpcStats(player).getBounty()));
|
2012-12-28 22:26:21 +00:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
class OpSetPCCrimeLevel : public Interpreter::Opcode0
|
|
|
|
{
|
|
|
|
public:
|
2020-10-16 22:18:54 +04:00
|
|
|
void execute(Interpreter::Runtime& runtime) override
|
2012-12-28 22:26:21 +00:00
|
|
|
{
|
|
|
|
MWBase::World* world = MWBase::Environment::get().getWorld();
|
2014-01-08 18:39:44 +01:00
|
|
|
MWWorld::Ptr player = world->getPlayerPtr();
|
2012-12-28 22:26:21 +00:00
|
|
|
|
2015-03-08 13:07:29 +13:00
|
|
|
int bounty = static_cast<int>(runtime[0].mFloat);
|
2012-12-28 22:26:21 +00:00
|
|
|
runtime.pop();
|
2014-10-25 21:09:37 +02:00
|
|
|
player.getClass().getNpcStats(player).setBounty(bounty);
|
|
|
|
|
|
|
|
if (bounty == 0)
|
|
|
|
MWBase::Environment::get().getWorld()->getPlayer().recordCrimeId();
|
2012-12-28 22:26:21 +00:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
class OpModPCCrimeLevel : public Interpreter::Opcode0
|
|
|
|
{
|
|
|
|
public:
|
2020-10-16 22:18:54 +04:00
|
|
|
void execute(Interpreter::Runtime& runtime) override
|
2012-12-28 22:26:21 +00:00
|
|
|
{
|
|
|
|
MWBase::World* world = MWBase::Environment::get().getWorld();
|
2014-01-08 18:39:44 +01:00
|
|
|
MWWorld::Ptr player = world->getPlayerPtr();
|
2012-12-28 22:26:21 +00:00
|
|
|
|
2015-03-08 13:07:29 +13:00
|
|
|
player.getClass().getNpcStats(player).setBounty(
|
|
|
|
static_cast<int>(runtime[0].mFloat) + player.getClass().getNpcStats(player).getBounty());
|
2012-12-28 22:26:21 +00:00
|
|
|
runtime.pop();
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2012-04-13 11:12:53 +02:00
|
|
|
template <class R>
|
|
|
|
class OpAddSpell : public Interpreter::Opcode0
|
|
|
|
{
|
|
|
|
public:
|
2020-10-16 22:18:54 +04:00
|
|
|
void execute(Interpreter::Runtime& runtime) override
|
2012-04-13 11:12:53 +02:00
|
|
|
{
|
|
|
|
MWWorld::Ptr ptr = R()(runtime);
|
|
|
|
|
Initial commit: In ESM structures, replace the string members that are RefIds to other records, to a new strong type
The strong type is actually just a string underneath, but this will help in the future to have a distinction so it's easier to search and replace when we use an integer ID
Slowly going through all the changes to make, still hundreds of errors
a lot of functions/structures use std::string or stringview to designate an ID. So it takes time
Continues slowly replacing ids. There are technically more and more compilation errors
I have good hope that there is a point where the amount of errors will dramatically go down as all the main functions use the ESM::RefId type
Continue moving forward, changes to the stores
slowly moving along
Starting to see the fruit of those changes.
still many many error, but more and more Irun into a situation where a function is sandwiched between two functions that use the RefId type.
More replacements. Things are starting to get easier
I can see more and more often the issue is that the function is awaiting a RefId, but is given a string
there is less need to go down functions and to fix a long list of them.
Still moving forward, and for the first time error count is going down!
Good pace, not sure about topics though, mId and mName are actually the same thing and are used interchangeably
Cells are back to using string for the name, haven't fixed everything yet. Many other changes
Under the bar of 400 compilation errors.
more good progress <100 compile errors!
More progress
Game settings store can use string for find, it was a bit absurd how every use of it required to create refId from string
some more progress on other fronts
Mostly game settings clean
one error opened a lot of other errors. Down to 18, but more will prbably appear
only link errors left??
Fixed link errors
OpenMW compiles, and launches, with some issues, but still!
2022-09-25 13:17:09 +02:00
|
|
|
ESM::RefId id = ESM::RefId::stringRefId(runtime.getStringLiteral(runtime[0].mInteger));
|
2012-04-13 11:12:53 +02:00
|
|
|
runtime.pop();
|
|
|
|
|
2023-04-20 21:07:53 +02:00
|
|
|
const ESM::Spell* spell = MWBase::Environment::get().getESMStore()->get<ESM::Spell>().find(id);
|
2012-07-02 14:25:46 +02:00
|
|
|
|
2019-04-20 09:38:32 +04:00
|
|
|
MWMechanics::CreatureStats& creatureStats = ptr.getClass().getCreatureStats(ptr);
|
2022-05-21 01:21:55 +02:00
|
|
|
creatureStats.getSpells().add(spell);
|
2019-04-20 09:38:32 +04:00
|
|
|
ESM::Spell::SpellType type = static_cast<ESM::Spell::SpellType>(spell->mData.mType);
|
|
|
|
if (type != ESM::Spell::ST_Spell && type != ESM::Spell::ST_Power)
|
|
|
|
{
|
2021-08-27 20:07:50 +02:00
|
|
|
// Add spell effect to *this actor's* queue immediately
|
|
|
|
creatureStats.getActiveSpells().addSpell(spell, ptr);
|
2019-04-20 09:38:32 +04:00
|
|
|
// Apply looping particles immediately for constant effects
|
|
|
|
MWBase::Environment::get().getWorld()->applyLoopingParticles(ptr);
|
2012-04-13 11:12:53 +02:00
|
|
|
}
|
2022-09-22 21:26:05 +03:00
|
|
|
}
|
2012-04-13 11:12:53 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
template <class R>
|
|
|
|
class OpRemoveSpell : public Interpreter::Opcode0
|
|
|
|
{
|
|
|
|
public:
|
2020-10-16 22:18:54 +04:00
|
|
|
void execute(Interpreter::Runtime& runtime) override
|
2012-04-13 11:12:53 +02:00
|
|
|
{
|
|
|
|
MWWorld::Ptr ptr = R()(runtime);
|
|
|
|
|
Initial commit: In ESM structures, replace the string members that are RefIds to other records, to a new strong type
The strong type is actually just a string underneath, but this will help in the future to have a distinction so it's easier to search and replace when we use an integer ID
Slowly going through all the changes to make, still hundreds of errors
a lot of functions/structures use std::string or stringview to designate an ID. So it takes time
Continues slowly replacing ids. There are technically more and more compilation errors
I have good hope that there is a point where the amount of errors will dramatically go down as all the main functions use the ESM::RefId type
Continue moving forward, changes to the stores
slowly moving along
Starting to see the fruit of those changes.
still many many error, but more and more Irun into a situation where a function is sandwiched between two functions that use the RefId type.
More replacements. Things are starting to get easier
I can see more and more often the issue is that the function is awaiting a RefId, but is given a string
there is less need to go down functions and to fix a long list of them.
Still moving forward, and for the first time error count is going down!
Good pace, not sure about topics though, mId and mName are actually the same thing and are used interchangeably
Cells are back to using string for the name, haven't fixed everything yet. Many other changes
Under the bar of 400 compilation errors.
more good progress <100 compile errors!
More progress
Game settings store can use string for find, it was a bit absurd how every use of it required to create refId from string
some more progress on other fronts
Mostly game settings clean
one error opened a lot of other errors. Down to 18, but more will prbably appear
only link errors left??
Fixed link errors
OpenMW compiles, and launches, with some issues, but still!
2022-09-25 13:17:09 +02:00
|
|
|
ESM::RefId id = ESM::RefId::stringRefId(runtime.getStringLiteral(runtime[0].mInteger));
|
2012-04-13 11:12:53 +02:00
|
|
|
runtime.pop();
|
|
|
|
|
2019-11-27 17:15:48 +03:00
|
|
|
MWMechanics::CreatureStats& creatureStats = ptr.getClass().getCreatureStats(ptr);
|
2022-05-22 09:29:03 +02:00
|
|
|
creatureStats.getSpells().remove(id);
|
2014-02-11 16:34:23 +01:00
|
|
|
|
|
|
|
MWBase::WindowManager* wm = MWBase::Environment::get().getWindowManager();
|
|
|
|
|
2015-08-21 21:12:39 +12:00
|
|
|
if (ptr == MWMechanics::getPlayer() && id == wm->getSelectedSpell())
|
2014-02-11 16:34:23 +01:00
|
|
|
{
|
|
|
|
wm->unsetSelectedSpell();
|
2012-04-13 11:12:53 +02:00
|
|
|
}
|
2022-09-22 21:26:05 +03:00
|
|
|
}
|
2012-04-13 11:12:53 +02:00
|
|
|
};
|
|
|
|
|
2014-01-03 04:56:54 +01:00
|
|
|
template <class R>
|
|
|
|
class OpRemoveSpellEffects : public Interpreter::Opcode0
|
|
|
|
{
|
|
|
|
public:
|
2020-10-16 22:18:54 +04:00
|
|
|
void execute(Interpreter::Runtime& runtime) override
|
2014-01-03 04:56:54 +01:00
|
|
|
{
|
|
|
|
MWWorld::Ptr ptr = R()(runtime);
|
|
|
|
|
Initial commit: In ESM structures, replace the string members that are RefIds to other records, to a new strong type
The strong type is actually just a string underneath, but this will help in the future to have a distinction so it's easier to search and replace when we use an integer ID
Slowly going through all the changes to make, still hundreds of errors
a lot of functions/structures use std::string or stringview to designate an ID. So it takes time
Continues slowly replacing ids. There are technically more and more compilation errors
I have good hope that there is a point where the amount of errors will dramatically go down as all the main functions use the ESM::RefId type
Continue moving forward, changes to the stores
slowly moving along
Starting to see the fruit of those changes.
still many many error, but more and more Irun into a situation where a function is sandwiched between two functions that use the RefId type.
More replacements. Things are starting to get easier
I can see more and more often the issue is that the function is awaiting a RefId, but is given a string
there is less need to go down functions and to fix a long list of them.
Still moving forward, and for the first time error count is going down!
Good pace, not sure about topics though, mId and mName are actually the same thing and are used interchangeably
Cells are back to using string for the name, haven't fixed everything yet. Many other changes
Under the bar of 400 compilation errors.
more good progress <100 compile errors!
More progress
Game settings store can use string for find, it was a bit absurd how every use of it required to create refId from string
some more progress on other fronts
Mostly game settings clean
one error opened a lot of other errors. Down to 18, but more will prbably appear
only link errors left??
Fixed link errors
OpenMW compiles, and launches, with some issues, but still!
2022-09-25 13:17:09 +02:00
|
|
|
ESM::RefId spellid = ESM::RefId::stringRefId(runtime.getStringLiteral(runtime[0].mInteger));
|
2014-01-03 04:56:54 +01:00
|
|
|
runtime.pop();
|
|
|
|
|
2021-08-27 20:07:50 +02:00
|
|
|
ptr.getClass().getCreatureStats(ptr).getActiveSpells().removeEffects(ptr, spellid);
|
2014-01-03 04:56:54 +01:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2014-01-03 05:19:10 +01:00
|
|
|
template <class R>
|
|
|
|
class OpRemoveEffects : public Interpreter::Opcode0
|
|
|
|
{
|
|
|
|
public:
|
2020-10-16 22:18:54 +04:00
|
|
|
void execute(Interpreter::Runtime& runtime) override
|
2014-01-03 05:19:10 +01:00
|
|
|
{
|
|
|
|
MWWorld::Ptr ptr = R()(runtime);
|
|
|
|
|
|
|
|
Interpreter::Type_Integer effectId = runtime[0].mInteger;
|
|
|
|
runtime.pop();
|
|
|
|
|
2021-08-27 20:07:50 +02:00
|
|
|
ptr.getClass().getCreatureStats(ptr).getActiveSpells().purgeEffect(ptr, effectId);
|
2014-01-03 05:19:10 +01:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2012-04-13 13:17:57 +02:00
|
|
|
template <class R>
|
|
|
|
class OpGetSpell : public Interpreter::Opcode0
|
|
|
|
{
|
|
|
|
public:
|
2020-10-16 22:18:54 +04:00
|
|
|
void execute(Interpreter::Runtime& runtime) override
|
2012-04-13 13:17:57 +02:00
|
|
|
{
|
2012-04-13 14:49:37 +02:00
|
|
|
|
2012-04-13 13:17:57 +02:00
|
|
|
MWWorld::Ptr ptr = R()(runtime);
|
|
|
|
|
Initial commit: In ESM structures, replace the string members that are RefIds to other records, to a new strong type
The strong type is actually just a string underneath, but this will help in the future to have a distinction so it's easier to search and replace when we use an integer ID
Slowly going through all the changes to make, still hundreds of errors
a lot of functions/structures use std::string or stringview to designate an ID. So it takes time
Continues slowly replacing ids. There are technically more and more compilation errors
I have good hope that there is a point where the amount of errors will dramatically go down as all the main functions use the ESM::RefId type
Continue moving forward, changes to the stores
slowly moving along
Starting to see the fruit of those changes.
still many many error, but more and more Irun into a situation where a function is sandwiched between two functions that use the RefId type.
More replacements. Things are starting to get easier
I can see more and more often the issue is that the function is awaiting a RefId, but is given a string
there is less need to go down functions and to fix a long list of them.
Still moving forward, and for the first time error count is going down!
Good pace, not sure about topics though, mId and mName are actually the same thing and are used interchangeably
Cells are back to using string for the name, haven't fixed everything yet. Many other changes
Under the bar of 400 compilation errors.
more good progress <100 compile errors!
More progress
Game settings store can use string for find, it was a bit absurd how every use of it required to create refId from string
some more progress on other fronts
Mostly game settings clean
one error opened a lot of other errors. Down to 18, but more will prbably appear
only link errors left??
Fixed link errors
OpenMW compiles, and launches, with some issues, but still!
2022-09-25 13:17:09 +02:00
|
|
|
ESM::RefId id = ESM::RefId::stringRefId(runtime.getStringLiteral(runtime[0].mInteger));
|
2012-04-13 13:17:57 +02:00
|
|
|
runtime.pop();
|
|
|
|
|
|
|
|
Interpreter::Type_Integer value = 0;
|
|
|
|
|
2022-05-22 09:29:03 +02:00
|
|
|
if (ptr.getClass().isActor() && ptr.getClass().getCreatureStats(ptr).getSpells().hasSpell(id))
|
2015-05-10 13:09:22 +02:00
|
|
|
value = 1;
|
2012-04-13 13:17:57 +02:00
|
|
|
|
|
|
|
runtime.push(value);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2014-04-26 12:04:37 +02:00
|
|
|
template <class R>
|
2012-04-09 14:30:42 +02:00
|
|
|
class OpPCJoinFaction : public Interpreter::Opcode1
|
2012-03-28 11:45:46 +02:00
|
|
|
{
|
|
|
|
public:
|
2020-10-16 22:18:54 +04:00
|
|
|
void execute(Interpreter::Runtime& runtime, unsigned int arg0) override
|
2012-03-28 11:45:46 +02:00
|
|
|
{
|
2015-12-18 16:33:54 +01:00
|
|
|
MWWorld::ConstPtr actor = R()(runtime, false);
|
2014-08-23 18:45:06 +02:00
|
|
|
|
Initial commit: In ESM structures, replace the string members that are RefIds to other records, to a new strong type
The strong type is actually just a string underneath, but this will help in the future to have a distinction so it's easier to search and replace when we use an integer ID
Slowly going through all the changes to make, still hundreds of errors
a lot of functions/structures use std::string or stringview to designate an ID. So it takes time
Continues slowly replacing ids. There are technically more and more compilation errors
I have good hope that there is a point where the amount of errors will dramatically go down as all the main functions use the ESM::RefId type
Continue moving forward, changes to the stores
slowly moving along
Starting to see the fruit of those changes.
still many many error, but more and more Irun into a situation where a function is sandwiched between two functions that use the RefId type.
More replacements. Things are starting to get easier
I can see more and more often the issue is that the function is awaiting a RefId, but is given a string
there is less need to go down functions and to fix a long list of them.
Still moving forward, and for the first time error count is going down!
Good pace, not sure about topics though, mId and mName are actually the same thing and are used interchangeably
Cells are back to using string for the name, haven't fixed everything yet. Many other changes
Under the bar of 400 compilation errors.
more good progress <100 compile errors!
More progress
Game settings store can use string for find, it was a bit absurd how every use of it required to create refId from string
some more progress on other fronts
Mostly game settings clean
one error opened a lot of other errors. Down to 18, but more will prbably appear
only link errors left??
Fixed link errors
OpenMW compiles, and launches, with some issues, but still!
2022-09-25 13:17:09 +02:00
|
|
|
ESM::RefId factionID;
|
2012-04-23 15:27:03 +02:00
|
|
|
|
2012-04-09 14:30:42 +02:00
|
|
|
if (arg0 == 0)
|
|
|
|
{
|
2014-04-26 12:04:37 +02:00
|
|
|
factionID = getDialogueActorFaction(actor);
|
2012-04-09 14:30:42 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
Initial commit: In ESM structures, replace the string members that are RefIds to other records, to a new strong type
The strong type is actually just a string underneath, but this will help in the future to have a distinction so it's easier to search and replace when we use an integer ID
Slowly going through all the changes to make, still hundreds of errors
a lot of functions/structures use std::string or stringview to designate an ID. So it takes time
Continues slowly replacing ids. There are technically more and more compilation errors
I have good hope that there is a point where the amount of errors will dramatically go down as all the main functions use the ESM::RefId type
Continue moving forward, changes to the stores
slowly moving along
Starting to see the fruit of those changes.
still many many error, but more and more Irun into a situation where a function is sandwiched between two functions that use the RefId type.
More replacements. Things are starting to get easier
I can see more and more often the issue is that the function is awaiting a RefId, but is given a string
there is less need to go down functions and to fix a long list of them.
Still moving forward, and for the first time error count is going down!
Good pace, not sure about topics though, mId and mName are actually the same thing and are used interchangeably
Cells are back to using string for the name, haven't fixed everything yet. Many other changes
Under the bar of 400 compilation errors.
more good progress <100 compile errors!
More progress
Game settings store can use string for find, it was a bit absurd how every use of it required to create refId from string
some more progress on other fronts
Mostly game settings clean
one error opened a lot of other errors. Down to 18, but more will prbably appear
only link errors left??
Fixed link errors
OpenMW compiles, and launches, with some issues, but still!
2022-09-25 13:17:09 +02:00
|
|
|
factionID = ESM::RefId::stringRefId(runtime.getStringLiteral(runtime[0].mInteger));
|
2012-04-09 14:30:42 +02:00
|
|
|
runtime.pop();
|
|
|
|
}
|
2014-05-27 13:54:25 +02:00
|
|
|
// Make sure this faction exists
|
2023-04-20 21:07:53 +02:00
|
|
|
MWBase::Environment::get().getESMStore()->get<ESM::Faction>().find(factionID);
|
2014-05-27 13:54:25 +02:00
|
|
|
|
2022-06-13 18:21:29 +02:00
|
|
|
if (!factionID.empty())
|
2012-04-09 14:30:42 +02:00
|
|
|
{
|
2015-08-21 21:12:39 +12:00
|
|
|
MWWorld::Ptr player = MWMechanics::getPlayer();
|
2014-10-05 16:47:55 +02:00
|
|
|
player.getClass().getNpcStats(player).joinFaction(factionID);
|
2012-03-28 11:45:46 +02:00
|
|
|
}
|
2022-09-22 21:26:05 +03:00
|
|
|
}
|
2012-03-28 11:45:46 +02:00
|
|
|
};
|
|
|
|
|
2014-04-26 12:04:37 +02:00
|
|
|
template <class R>
|
2012-04-09 13:24:19 +02:00
|
|
|
class OpPCRaiseRank : public Interpreter::Opcode1
|
2012-03-28 11:45:46 +02:00
|
|
|
{
|
|
|
|
public:
|
2020-10-16 22:18:54 +04:00
|
|
|
void execute(Interpreter::Runtime& runtime, unsigned int arg0) override
|
2022-09-22 21:26:05 +03:00
|
|
|
{
|
2015-12-18 16:33:54 +01:00
|
|
|
MWWorld::ConstPtr actor = R()(runtime, false);
|
2012-03-28 11:45:46 +02:00
|
|
|
|
Initial commit: In ESM structures, replace the string members that are RefIds to other records, to a new strong type
The strong type is actually just a string underneath, but this will help in the future to have a distinction so it's easier to search and replace when we use an integer ID
Slowly going through all the changes to make, still hundreds of errors
a lot of functions/structures use std::string or stringview to designate an ID. So it takes time
Continues slowly replacing ids. There are technically more and more compilation errors
I have good hope that there is a point where the amount of errors will dramatically go down as all the main functions use the ESM::RefId type
Continue moving forward, changes to the stores
slowly moving along
Starting to see the fruit of those changes.
still many many error, but more and more Irun into a situation where a function is sandwiched between two functions that use the RefId type.
More replacements. Things are starting to get easier
I can see more and more often the issue is that the function is awaiting a RefId, but is given a string
there is less need to go down functions and to fix a long list of them.
Still moving forward, and for the first time error count is going down!
Good pace, not sure about topics though, mId and mName are actually the same thing and are used interchangeably
Cells are back to using string for the name, haven't fixed everything yet. Many other changes
Under the bar of 400 compilation errors.
more good progress <100 compile errors!
More progress
Game settings store can use string for find, it was a bit absurd how every use of it required to create refId from string
some more progress on other fronts
Mostly game settings clean
one error opened a lot of other errors. Down to 18, but more will prbably appear
only link errors left??
Fixed link errors
OpenMW compiles, and launches, with some issues, but still!
2022-09-25 13:17:09 +02:00
|
|
|
ESM::RefId factionID;
|
2014-08-23 18:50:53 +02:00
|
|
|
|
2012-11-13 16:11:03 +01:00
|
|
|
if (arg0 == 0)
|
2022-09-22 21:26:05 +03:00
|
|
|
{
|
2022-06-13 18:21:29 +02:00
|
|
|
factionID = getDialogueActorFaction(actor);
|
2022-09-22 21:26:05 +03:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
Initial commit: In ESM structures, replace the string members that are RefIds to other records, to a new strong type
The strong type is actually just a string underneath, but this will help in the future to have a distinction so it's easier to search and replace when we use an integer ID
Slowly going through all the changes to make, still hundreds of errors
a lot of functions/structures use std::string or stringview to designate an ID. So it takes time
Continues slowly replacing ids. There are technically more and more compilation errors
I have good hope that there is a point where the amount of errors will dramatically go down as all the main functions use the ESM::RefId type
Continue moving forward, changes to the stores
slowly moving along
Starting to see the fruit of those changes.
still many many error, but more and more Irun into a situation where a function is sandwiched between two functions that use the RefId type.
More replacements. Things are starting to get easier
I can see more and more often the issue is that the function is awaiting a RefId, but is given a string
there is less need to go down functions and to fix a long list of them.
Still moving forward, and for the first time error count is going down!
Good pace, not sure about topics though, mId and mName are actually the same thing and are used interchangeably
Cells are back to using string for the name, haven't fixed everything yet. Many other changes
Under the bar of 400 compilation errors.
more good progress <100 compile errors!
More progress
Game settings store can use string for find, it was a bit absurd how every use of it required to create refId from string
some more progress on other fronts
Mostly game settings clean
one error opened a lot of other errors. Down to 18, but more will prbably appear
only link errors left??
Fixed link errors
OpenMW compiles, and launches, with some issues, but still!
2022-09-25 13:17:09 +02:00
|
|
|
factionID = ESM::RefId::stringRefId(runtime.getStringLiteral(runtime[0].mInteger));
|
2012-04-09 13:24:19 +02:00
|
|
|
runtime.pop();
|
2022-09-22 21:26:05 +03:00
|
|
|
}
|
2022-06-13 18:21:29 +02:00
|
|
|
// Make sure this faction exists
|
2023-04-20 21:07:53 +02:00
|
|
|
MWBase::Environment::get().getESMStore()->get<ESM::Faction>().find(factionID);
|
2012-04-23 15:27:03 +02:00
|
|
|
|
2012-04-09 13:24:19 +02:00
|
|
|
if (!factionID.empty())
|
2022-09-22 21:26:05 +03:00
|
|
|
{
|
2015-08-21 21:12:39 +12:00
|
|
|
MWWorld::Ptr player = MWMechanics::getPlayer();
|
2022-06-13 18:21:29 +02:00
|
|
|
if (!player.getClass().getNpcStats(player).isInFaction(factionID))
|
2012-04-09 13:24:19 +02:00
|
|
|
{
|
2014-04-26 12:04:37 +02:00
|
|
|
player.getClass().getNpcStats(player).joinFaction(factionID);
|
2012-04-09 13:24:19 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2023-06-14 03:38:22 +08:00
|
|
|
int currentRank = player.getClass().getNpcStats(player).getFactionRank(factionID);
|
|
|
|
player.getClass().getNpcStats(player).setFactionRank(factionID, currentRank + 1);
|
2012-04-04 22:14:38 +02:00
|
|
|
}
|
2012-03-28 11:45:46 +02:00
|
|
|
}
|
2022-09-22 21:26:05 +03:00
|
|
|
}
|
2012-03-28 11:45:46 +02:00
|
|
|
};
|
2012-04-13 14:49:37 +02:00
|
|
|
|
2014-04-26 12:04:37 +02:00
|
|
|
template <class R>
|
2012-04-09 14:26:53 +02:00
|
|
|
class OpPCLowerRank : public Interpreter::Opcode1
|
|
|
|
{
|
|
|
|
public:
|
2020-10-16 22:18:54 +04:00
|
|
|
void execute(Interpreter::Runtime& runtime, unsigned int arg0) override
|
2012-04-09 14:26:53 +02:00
|
|
|
{
|
2015-12-18 16:33:54 +01:00
|
|
|
MWWorld::ConstPtr actor = R()(runtime, false);
|
2014-08-23 18:50:53 +02:00
|
|
|
|
Initial commit: In ESM structures, replace the string members that are RefIds to other records, to a new strong type
The strong type is actually just a string underneath, but this will help in the future to have a distinction so it's easier to search and replace when we use an integer ID
Slowly going through all the changes to make, still hundreds of errors
a lot of functions/structures use std::string or stringview to designate an ID. So it takes time
Continues slowly replacing ids. There are technically more and more compilation errors
I have good hope that there is a point where the amount of errors will dramatically go down as all the main functions use the ESM::RefId type
Continue moving forward, changes to the stores
slowly moving along
Starting to see the fruit of those changes.
still many many error, but more and more Irun into a situation where a function is sandwiched between two functions that use the RefId type.
More replacements. Things are starting to get easier
I can see more and more often the issue is that the function is awaiting a RefId, but is given a string
there is less need to go down functions and to fix a long list of them.
Still moving forward, and for the first time error count is going down!
Good pace, not sure about topics though, mId and mName are actually the same thing and are used interchangeably
Cells are back to using string for the name, haven't fixed everything yet. Many other changes
Under the bar of 400 compilation errors.
more good progress <100 compile errors!
More progress
Game settings store can use string for find, it was a bit absurd how every use of it required to create refId from string
some more progress on other fronts
Mostly game settings clean
one error opened a lot of other errors. Down to 18, but more will prbably appear
only link errors left??
Fixed link errors
OpenMW compiles, and launches, with some issues, but still!
2022-09-25 13:17:09 +02:00
|
|
|
ESM::RefId factionID;
|
2012-04-23 15:27:03 +02:00
|
|
|
|
2012-04-09 14:26:53 +02:00
|
|
|
if (arg0 == 0)
|
|
|
|
{
|
2014-04-26 12:04:37 +02:00
|
|
|
factionID = getDialogueActorFaction(actor);
|
2012-04-09 14:26:53 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
Initial commit: In ESM structures, replace the string members that are RefIds to other records, to a new strong type
The strong type is actually just a string underneath, but this will help in the future to have a distinction so it's easier to search and replace when we use an integer ID
Slowly going through all the changes to make, still hundreds of errors
a lot of functions/structures use std::string or stringview to designate an ID. So it takes time
Continues slowly replacing ids. There are technically more and more compilation errors
I have good hope that there is a point where the amount of errors will dramatically go down as all the main functions use the ESM::RefId type
Continue moving forward, changes to the stores
slowly moving along
Starting to see the fruit of those changes.
still many many error, but more and more Irun into a situation where a function is sandwiched between two functions that use the RefId type.
More replacements. Things are starting to get easier
I can see more and more often the issue is that the function is awaiting a RefId, but is given a string
there is less need to go down functions and to fix a long list of them.
Still moving forward, and for the first time error count is going down!
Good pace, not sure about topics though, mId and mName are actually the same thing and are used interchangeably
Cells are back to using string for the name, haven't fixed everything yet. Many other changes
Under the bar of 400 compilation errors.
more good progress <100 compile errors!
More progress
Game settings store can use string for find, it was a bit absurd how every use of it required to create refId from string
some more progress on other fronts
Mostly game settings clean
one error opened a lot of other errors. Down to 18, but more will prbably appear
only link errors left??
Fixed link errors
OpenMW compiles, and launches, with some issues, but still!
2022-09-25 13:17:09 +02:00
|
|
|
factionID = ESM::RefId::stringRefId(runtime.getStringLiteral(runtime[0].mInteger));
|
2012-04-09 14:26:53 +02:00
|
|
|
runtime.pop();
|
|
|
|
}
|
2014-05-27 13:54:25 +02:00
|
|
|
// Make sure this faction exists
|
2023-04-20 21:07:53 +02:00
|
|
|
MWBase::Environment::get().getESMStore()->get<ESM::Faction>().find(factionID);
|
2014-05-27 13:54:25 +02:00
|
|
|
|
2022-06-13 18:21:29 +02:00
|
|
|
if (!factionID.empty())
|
2012-04-09 14:26:53 +02:00
|
|
|
{
|
2015-08-21 21:12:39 +12:00
|
|
|
MWWorld::Ptr player = MWMechanics::getPlayer();
|
2023-06-14 03:38:22 +08:00
|
|
|
int currentRank = player.getClass().getNpcStats(player).getFactionRank(factionID);
|
|
|
|
player.getClass().getNpcStats(player).setFactionRank(factionID, currentRank - 1);
|
2012-04-09 14:26:53 +02:00
|
|
|
}
|
2022-09-22 21:26:05 +03:00
|
|
|
}
|
2012-04-09 14:26:53 +02:00
|
|
|
};
|
|
|
|
|
2012-04-15 12:05:46 +02:00
|
|
|
template <class R>
|
|
|
|
class OpGetPCRank : public Interpreter::Opcode1
|
|
|
|
{
|
|
|
|
public:
|
2020-10-16 22:18:54 +04:00
|
|
|
void execute(Interpreter::Runtime& runtime, unsigned int arg0) override
|
2022-09-22 21:26:05 +03:00
|
|
|
{
|
2015-12-18 16:33:54 +01:00
|
|
|
MWWorld::ConstPtr ptr = R()(runtime, false);
|
2012-04-15 12:05:46 +02:00
|
|
|
|
Initial commit: In ESM structures, replace the string members that are RefIds to other records, to a new strong type
The strong type is actually just a string underneath, but this will help in the future to have a distinction so it's easier to search and replace when we use an integer ID
Slowly going through all the changes to make, still hundreds of errors
a lot of functions/structures use std::string or stringview to designate an ID. So it takes time
Continues slowly replacing ids. There are technically more and more compilation errors
I have good hope that there is a point where the amount of errors will dramatically go down as all the main functions use the ESM::RefId type
Continue moving forward, changes to the stores
slowly moving along
Starting to see the fruit of those changes.
still many many error, but more and more Irun into a situation where a function is sandwiched between two functions that use the RefId type.
More replacements. Things are starting to get easier
I can see more and more often the issue is that the function is awaiting a RefId, but is given a string
there is less need to go down functions and to fix a long list of them.
Still moving forward, and for the first time error count is going down!
Good pace, not sure about topics though, mId and mName are actually the same thing and are used interchangeably
Cells are back to using string for the name, haven't fixed everything yet. Many other changes
Under the bar of 400 compilation errors.
more good progress <100 compile errors!
More progress
Game settings store can use string for find, it was a bit absurd how every use of it required to create refId from string
some more progress on other fronts
Mostly game settings clean
one error opened a lot of other errors. Down to 18, but more will prbably appear
only link errors left??
Fixed link errors
OpenMW compiles, and launches, with some issues, but still!
2022-09-25 13:17:09 +02:00
|
|
|
ESM::RefId factionID;
|
2020-10-16 22:18:54 +04:00
|
|
|
if (arg0 > 0)
|
2012-04-15 12:05:46 +02:00
|
|
|
{
|
Initial commit: In ESM structures, replace the string members that are RefIds to other records, to a new strong type
The strong type is actually just a string underneath, but this will help in the future to have a distinction so it's easier to search and replace when we use an integer ID
Slowly going through all the changes to make, still hundreds of errors
a lot of functions/structures use std::string or stringview to designate an ID. So it takes time
Continues slowly replacing ids. There are technically more and more compilation errors
I have good hope that there is a point where the amount of errors will dramatically go down as all the main functions use the ESM::RefId type
Continue moving forward, changes to the stores
slowly moving along
Starting to see the fruit of those changes.
still many many error, but more and more Irun into a situation where a function is sandwiched between two functions that use the RefId type.
More replacements. Things are starting to get easier
I can see more and more often the issue is that the function is awaiting a RefId, but is given a string
there is less need to go down functions and to fix a long list of them.
Still moving forward, and for the first time error count is going down!
Good pace, not sure about topics though, mId and mName are actually the same thing and are used interchangeably
Cells are back to using string for the name, haven't fixed everything yet. Many other changes
Under the bar of 400 compilation errors.
more good progress <100 compile errors!
More progress
Game settings store can use string for find, it was a bit absurd how every use of it required to create refId from string
some more progress on other fronts
Mostly game settings clean
one error opened a lot of other errors. Down to 18, but more will prbably appear
only link errors left??
Fixed link errors
OpenMW compiles, and launches, with some issues, but still!
2022-09-25 13:17:09 +02:00
|
|
|
factionID = ESM::RefId::stringRefId(runtime.getStringLiteral(runtime[0].mInteger));
|
2012-04-15 12:05:46 +02:00
|
|
|
runtime.pop();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2015-01-27 17:32:21 +01:00
|
|
|
factionID = ptr.getClass().getPrimaryFaction(ptr);
|
2012-04-15 12:05:46 +02:00
|
|
|
}
|
2014-05-27 13:54:25 +02:00
|
|
|
// Make sure this faction exists
|
2023-04-20 21:07:53 +02:00
|
|
|
MWBase::Environment::get().getESMStore()->get<ESM::Faction>().find(factionID);
|
2014-05-27 13:54:25 +02:00
|
|
|
|
2022-06-13 18:21:29 +02:00
|
|
|
if (!factionID.empty())
|
2012-04-15 12:05:46 +02:00
|
|
|
{
|
2022-06-13 18:21:29 +02:00
|
|
|
MWWorld::Ptr player = MWMechanics::getPlayer();
|
|
|
|
runtime.push(player.getClass().getNpcStats(player).getFactionRank(factionID));
|
2012-04-15 12:05:46 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
runtime.push(-1);
|
|
|
|
}
|
2022-09-22 21:26:05 +03:00
|
|
|
}
|
2012-04-15 12:05:46 +02:00
|
|
|
};
|
2012-04-23 15:27:03 +02:00
|
|
|
|
2012-04-13 14:54:13 +02:00
|
|
|
template <class R>
|
2012-04-09 13:24:19 +02:00
|
|
|
class OpModDisposition : public Interpreter::Opcode0
|
|
|
|
{
|
|
|
|
public:
|
2020-10-16 22:18:54 +04:00
|
|
|
void execute(Interpreter::Runtime& runtime) override
|
2012-04-09 13:24:19 +02:00
|
|
|
{
|
2012-04-13 14:54:13 +02:00
|
|
|
MWWorld::Ptr ptr = R()(runtime);
|
|
|
|
|
2012-11-13 14:19:43 +01:00
|
|
|
Interpreter::Type_Integer value = runtime[0].mInteger;
|
2012-04-13 14:54:13 +02:00
|
|
|
runtime.pop();
|
2012-04-09 13:24:19 +02:00
|
|
|
|
2014-06-22 00:34:32 +02:00
|
|
|
if (ptr.getClass().isNpc())
|
|
|
|
ptr.getClass().getNpcStats(ptr).setBaseDisposition(
|
|
|
|
ptr.getClass().getNpcStats(ptr).getBaseDisposition() + value);
|
|
|
|
|
|
|
|
// else: must not throw exception (used by an Almalexia dialogue script)
|
2012-04-09 13:24:19 +02:00
|
|
|
}
|
|
|
|
};
|
2012-11-13 14:29:00 +01:00
|
|
|
|
|
|
|
template <class R>
|
|
|
|
class OpSetDisposition : public Interpreter::Opcode0
|
|
|
|
{
|
|
|
|
public:
|
2020-10-16 22:18:54 +04:00
|
|
|
void execute(Interpreter::Runtime& runtime) override
|
2012-11-13 14:29:00 +01:00
|
|
|
{
|
|
|
|
MWWorld::Ptr ptr = R()(runtime);
|
|
|
|
|
|
|
|
Interpreter::Type_Integer value = runtime[0].mInteger;
|
|
|
|
runtime.pop();
|
|
|
|
|
2014-06-22 00:34:32 +02:00
|
|
|
if (ptr.getClass().isNpc())
|
|
|
|
ptr.getClass().getNpcStats(ptr).setBaseDisposition(value);
|
2012-11-13 14:29:00 +01:00
|
|
|
}
|
2012-11-13 16:11:03 +01:00
|
|
|
};
|
2012-11-13 14:29:00 +01:00
|
|
|
|
|
|
|
template <class R>
|
|
|
|
class OpGetDisposition : public Interpreter::Opcode0
|
|
|
|
{
|
|
|
|
public:
|
2020-10-16 22:18:54 +04:00
|
|
|
void execute(Interpreter::Runtime& runtime) override
|
2012-11-13 14:29:00 +01:00
|
|
|
{
|
|
|
|
MWWorld::Ptr ptr = R()(runtime);
|
|
|
|
|
2014-06-22 00:34:32 +02:00
|
|
|
if (!ptr.getClass().isNpc())
|
|
|
|
runtime.push(0);
|
|
|
|
else
|
|
|
|
runtime.push(MWBase::Environment::get().getMechanicsManager()->getDerivedDisposition(ptr));
|
2012-11-13 14:29:00 +01:00
|
|
|
}
|
2012-11-13 16:11:03 +01:00
|
|
|
};
|
|
|
|
|
2012-10-27 11:33:18 +02:00
|
|
|
class OpGetDeadCount : public Interpreter::Opcode0
|
|
|
|
{
|
|
|
|
public:
|
2020-10-16 22:18:54 +04:00
|
|
|
void execute(Interpreter::Runtime& runtime) override
|
2012-10-27 11:33:18 +02:00
|
|
|
{
|
Initial commit: In ESM structures, replace the string members that are RefIds to other records, to a new strong type
The strong type is actually just a string underneath, but this will help in the future to have a distinction so it's easier to search and replace when we use an integer ID
Slowly going through all the changes to make, still hundreds of errors
a lot of functions/structures use std::string or stringview to designate an ID. So it takes time
Continues slowly replacing ids. There are technically more and more compilation errors
I have good hope that there is a point where the amount of errors will dramatically go down as all the main functions use the ESM::RefId type
Continue moving forward, changes to the stores
slowly moving along
Starting to see the fruit of those changes.
still many many error, but more and more Irun into a situation where a function is sandwiched between two functions that use the RefId type.
More replacements. Things are starting to get easier
I can see more and more often the issue is that the function is awaiting a RefId, but is given a string
there is less need to go down functions and to fix a long list of them.
Still moving forward, and for the first time error count is going down!
Good pace, not sure about topics though, mId and mName are actually the same thing and are used interchangeably
Cells are back to using string for the name, haven't fixed everything yet. Many other changes
Under the bar of 400 compilation errors.
more good progress <100 compile errors!
More progress
Game settings store can use string for find, it was a bit absurd how every use of it required to create refId from string
some more progress on other fronts
Mostly game settings clean
one error opened a lot of other errors. Down to 18, but more will prbably appear
only link errors left??
Fixed link errors
OpenMW compiles, and launches, with some issues, but still!
2022-09-25 13:17:09 +02:00
|
|
|
ESM::RefId id = ESM::RefId::stringRefId(runtime.getStringLiteral(runtime[0].mInteger));
|
2022-05-22 09:29:03 +02:00
|
|
|
runtime[0].mInteger = MWBase::Environment::get().getMechanicsManager()->countDeaths(id);
|
2012-10-27 11:33:18 +02:00
|
|
|
}
|
2012-11-13 16:11:03 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
template <class R>
|
|
|
|
class OpGetPCFacRep : public Interpreter::Opcode1
|
|
|
|
{
|
|
|
|
public:
|
2020-10-16 22:18:54 +04:00
|
|
|
void execute(Interpreter::Runtime& runtime, unsigned int arg0) override
|
2012-11-13 16:11:03 +01:00
|
|
|
{
|
2015-12-18 16:33:54 +01:00
|
|
|
MWWorld::ConstPtr ptr = R()(runtime, false);
|
2014-08-23 18:50:53 +02:00
|
|
|
|
Initial commit: In ESM structures, replace the string members that are RefIds to other records, to a new strong type
The strong type is actually just a string underneath, but this will help in the future to have a distinction so it's easier to search and replace when we use an integer ID
Slowly going through all the changes to make, still hundreds of errors
a lot of functions/structures use std::string or stringview to designate an ID. So it takes time
Continues slowly replacing ids. There are technically more and more compilation errors
I have good hope that there is a point where the amount of errors will dramatically go down as all the main functions use the ESM::RefId type
Continue moving forward, changes to the stores
slowly moving along
Starting to see the fruit of those changes.
still many many error, but more and more Irun into a situation where a function is sandwiched between two functions that use the RefId type.
More replacements. Things are starting to get easier
I can see more and more often the issue is that the function is awaiting a RefId, but is given a string
there is less need to go down functions and to fix a long list of them.
Still moving forward, and for the first time error count is going down!
Good pace, not sure about topics though, mId and mName are actually the same thing and are used interchangeably
Cells are back to using string for the name, haven't fixed everything yet. Many other changes
Under the bar of 400 compilation errors.
more good progress <100 compile errors!
More progress
Game settings store can use string for find, it was a bit absurd how every use of it required to create refId from string
some more progress on other fronts
Mostly game settings clean
one error opened a lot of other errors. Down to 18, but more will prbably appear
only link errors left??
Fixed link errors
OpenMW compiles, and launches, with some issues, but still!
2022-09-25 13:17:09 +02:00
|
|
|
ESM::RefId factionId;
|
2012-11-13 16:11:03 +01:00
|
|
|
|
|
|
|
if (arg0 == 1)
|
|
|
|
{
|
Initial commit: In ESM structures, replace the string members that are RefIds to other records, to a new strong type
The strong type is actually just a string underneath, but this will help in the future to have a distinction so it's easier to search and replace when we use an integer ID
Slowly going through all the changes to make, still hundreds of errors
a lot of functions/structures use std::string or stringview to designate an ID. So it takes time
Continues slowly replacing ids. There are technically more and more compilation errors
I have good hope that there is a point where the amount of errors will dramatically go down as all the main functions use the ESM::RefId type
Continue moving forward, changes to the stores
slowly moving along
Starting to see the fruit of those changes.
still many many error, but more and more Irun into a situation where a function is sandwiched between two functions that use the RefId type.
More replacements. Things are starting to get easier
I can see more and more often the issue is that the function is awaiting a RefId, but is given a string
there is less need to go down functions and to fix a long list of them.
Still moving forward, and for the first time error count is going down!
Good pace, not sure about topics though, mId and mName are actually the same thing and are used interchangeably
Cells are back to using string for the name, haven't fixed everything yet. Many other changes
Under the bar of 400 compilation errors.
more good progress <100 compile errors!
More progress
Game settings store can use string for find, it was a bit absurd how every use of it required to create refId from string
some more progress on other fronts
Mostly game settings clean
one error opened a lot of other errors. Down to 18, but more will prbably appear
only link errors left??
Fixed link errors
OpenMW compiles, and launches, with some issues, but still!
2022-09-25 13:17:09 +02:00
|
|
|
factionId = ESM::RefId::stringRefId(runtime.getStringLiteral(runtime[0].mInteger));
|
2012-11-13 16:11:03 +01:00
|
|
|
runtime.pop();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2015-01-27 17:32:21 +01:00
|
|
|
factionId = getDialogueActorFaction(ptr);
|
2012-11-13 16:11:03 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if (factionId.empty())
|
|
|
|
throw std::runtime_error("failed to determine faction");
|
|
|
|
|
2015-08-21 21:12:39 +12:00
|
|
|
MWWorld::Ptr player = MWMechanics::getPlayer();
|
2014-05-22 20:37:22 +02:00
|
|
|
runtime.push(player.getClass().getNpcStats(player).getFactionReputation(factionId));
|
2012-11-13 16:11:03 +01:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
template <class R>
|
|
|
|
class OpSetPCFacRep : public Interpreter::Opcode1
|
|
|
|
{
|
|
|
|
public:
|
2020-10-16 22:18:54 +04:00
|
|
|
void execute(Interpreter::Runtime& runtime, unsigned int arg0) override
|
2012-11-13 16:11:03 +01:00
|
|
|
{
|
2015-12-18 16:33:54 +01:00
|
|
|
MWWorld::ConstPtr ptr = R()(runtime, false);
|
2014-08-23 18:50:53 +02:00
|
|
|
|
2012-11-13 16:11:03 +01:00
|
|
|
Interpreter::Type_Integer value = runtime[0].mInteger;
|
|
|
|
runtime.pop();
|
|
|
|
|
Initial commit: In ESM structures, replace the string members that are RefIds to other records, to a new strong type
The strong type is actually just a string underneath, but this will help in the future to have a distinction so it's easier to search and replace when we use an integer ID
Slowly going through all the changes to make, still hundreds of errors
a lot of functions/structures use std::string or stringview to designate an ID. So it takes time
Continues slowly replacing ids. There are technically more and more compilation errors
I have good hope that there is a point where the amount of errors will dramatically go down as all the main functions use the ESM::RefId type
Continue moving forward, changes to the stores
slowly moving along
Starting to see the fruit of those changes.
still many many error, but more and more Irun into a situation where a function is sandwiched between two functions that use the RefId type.
More replacements. Things are starting to get easier
I can see more and more often the issue is that the function is awaiting a RefId, but is given a string
there is less need to go down functions and to fix a long list of them.
Still moving forward, and for the first time error count is going down!
Good pace, not sure about topics though, mId and mName are actually the same thing and are used interchangeably
Cells are back to using string for the name, haven't fixed everything yet. Many other changes
Under the bar of 400 compilation errors.
more good progress <100 compile errors!
More progress
Game settings store can use string for find, it was a bit absurd how every use of it required to create refId from string
some more progress on other fronts
Mostly game settings clean
one error opened a lot of other errors. Down to 18, but more will prbably appear
only link errors left??
Fixed link errors
OpenMW compiles, and launches, with some issues, but still!
2022-09-25 13:17:09 +02:00
|
|
|
ESM::RefId factionId;
|
2012-11-13 16:11:03 +01:00
|
|
|
|
|
|
|
if (arg0 == 1)
|
|
|
|
{
|
Initial commit: In ESM structures, replace the string members that are RefIds to other records, to a new strong type
The strong type is actually just a string underneath, but this will help in the future to have a distinction so it's easier to search and replace when we use an integer ID
Slowly going through all the changes to make, still hundreds of errors
a lot of functions/structures use std::string or stringview to designate an ID. So it takes time
Continues slowly replacing ids. There are technically more and more compilation errors
I have good hope that there is a point where the amount of errors will dramatically go down as all the main functions use the ESM::RefId type
Continue moving forward, changes to the stores
slowly moving along
Starting to see the fruit of those changes.
still many many error, but more and more Irun into a situation where a function is sandwiched between two functions that use the RefId type.
More replacements. Things are starting to get easier
I can see more and more often the issue is that the function is awaiting a RefId, but is given a string
there is less need to go down functions and to fix a long list of them.
Still moving forward, and for the first time error count is going down!
Good pace, not sure about topics though, mId and mName are actually the same thing and are used interchangeably
Cells are back to using string for the name, haven't fixed everything yet. Many other changes
Under the bar of 400 compilation errors.
more good progress <100 compile errors!
More progress
Game settings store can use string for find, it was a bit absurd how every use of it required to create refId from string
some more progress on other fronts
Mostly game settings clean
one error opened a lot of other errors. Down to 18, but more will prbably appear
only link errors left??
Fixed link errors
OpenMW compiles, and launches, with some issues, but still!
2022-09-25 13:17:09 +02:00
|
|
|
factionId = ESM::RefId::stringRefId(runtime.getStringLiteral(runtime[0].mInteger));
|
2012-11-13 16:11:03 +01:00
|
|
|
runtime.pop();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2015-01-27 17:32:21 +01:00
|
|
|
factionId = getDialogueActorFaction(ptr);
|
2012-11-13 16:11:03 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if (factionId.empty())
|
|
|
|
throw std::runtime_error("failed to determine faction");
|
|
|
|
|
2015-08-21 21:12:39 +12:00
|
|
|
MWWorld::Ptr player = MWMechanics::getPlayer();
|
2014-05-22 20:37:22 +02:00
|
|
|
player.getClass().getNpcStats(player).setFactionReputation(factionId, value);
|
2012-11-13 16:11:03 +01:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
template <class R>
|
|
|
|
class OpModPCFacRep : public Interpreter::Opcode1
|
|
|
|
{
|
|
|
|
public:
|
2020-10-16 22:18:54 +04:00
|
|
|
void execute(Interpreter::Runtime& runtime, unsigned int arg0) override
|
2012-11-13 16:11:03 +01:00
|
|
|
{
|
2015-12-18 16:33:54 +01:00
|
|
|
MWWorld::ConstPtr ptr = R()(runtime, false);
|
2014-08-23 18:50:53 +02:00
|
|
|
|
2012-11-13 16:11:03 +01:00
|
|
|
Interpreter::Type_Integer value = runtime[0].mInteger;
|
|
|
|
runtime.pop();
|
|
|
|
|
Initial commit: In ESM structures, replace the string members that are RefIds to other records, to a new strong type
The strong type is actually just a string underneath, but this will help in the future to have a distinction so it's easier to search and replace when we use an integer ID
Slowly going through all the changes to make, still hundreds of errors
a lot of functions/structures use std::string or stringview to designate an ID. So it takes time
Continues slowly replacing ids. There are technically more and more compilation errors
I have good hope that there is a point where the amount of errors will dramatically go down as all the main functions use the ESM::RefId type
Continue moving forward, changes to the stores
slowly moving along
Starting to see the fruit of those changes.
still many many error, but more and more Irun into a situation where a function is sandwiched between two functions that use the RefId type.
More replacements. Things are starting to get easier
I can see more and more often the issue is that the function is awaiting a RefId, but is given a string
there is less need to go down functions and to fix a long list of them.
Still moving forward, and for the first time error count is going down!
Good pace, not sure about topics though, mId and mName are actually the same thing and are used interchangeably
Cells are back to using string for the name, haven't fixed everything yet. Many other changes
Under the bar of 400 compilation errors.
more good progress <100 compile errors!
More progress
Game settings store can use string for find, it was a bit absurd how every use of it required to create refId from string
some more progress on other fronts
Mostly game settings clean
one error opened a lot of other errors. Down to 18, but more will prbably appear
only link errors left??
Fixed link errors
OpenMW compiles, and launches, with some issues, but still!
2022-09-25 13:17:09 +02:00
|
|
|
ESM::RefId factionId;
|
2012-11-13 16:11:03 +01:00
|
|
|
|
|
|
|
if (arg0 == 1)
|
|
|
|
{
|
Initial commit: In ESM structures, replace the string members that are RefIds to other records, to a new strong type
The strong type is actually just a string underneath, but this will help in the future to have a distinction so it's easier to search and replace when we use an integer ID
Slowly going through all the changes to make, still hundreds of errors
a lot of functions/structures use std::string or stringview to designate an ID. So it takes time
Continues slowly replacing ids. There are technically more and more compilation errors
I have good hope that there is a point where the amount of errors will dramatically go down as all the main functions use the ESM::RefId type
Continue moving forward, changes to the stores
slowly moving along
Starting to see the fruit of those changes.
still many many error, but more and more Irun into a situation where a function is sandwiched between two functions that use the RefId type.
More replacements. Things are starting to get easier
I can see more and more often the issue is that the function is awaiting a RefId, but is given a string
there is less need to go down functions and to fix a long list of them.
Still moving forward, and for the first time error count is going down!
Good pace, not sure about topics though, mId and mName are actually the same thing and are used interchangeably
Cells are back to using string for the name, haven't fixed everything yet. Many other changes
Under the bar of 400 compilation errors.
more good progress <100 compile errors!
More progress
Game settings store can use string for find, it was a bit absurd how every use of it required to create refId from string
some more progress on other fronts
Mostly game settings clean
one error opened a lot of other errors. Down to 18, but more will prbably appear
only link errors left??
Fixed link errors
OpenMW compiles, and launches, with some issues, but still!
2022-09-25 13:17:09 +02:00
|
|
|
factionId = ESM::RefId::stringRefId(runtime.getStringLiteral(runtime[0].mInteger));
|
2012-11-13 16:11:03 +01:00
|
|
|
runtime.pop();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2015-01-27 17:32:21 +01:00
|
|
|
factionId = getDialogueActorFaction(ptr);
|
2012-11-13 16:11:03 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if (factionId.empty())
|
|
|
|
throw std::runtime_error("failed to determine faction");
|
|
|
|
|
2015-08-21 21:12:39 +12:00
|
|
|
MWWorld::Ptr player = MWMechanics::getPlayer();
|
2014-05-22 20:37:22 +02:00
|
|
|
player.getClass().getNpcStats(player).setFactionReputation(
|
|
|
|
factionId, player.getClass().getNpcStats(player).getFactionReputation(factionId) + value);
|
2012-11-13 16:11:03 +01:00
|
|
|
}
|
|
|
|
};
|
2012-04-09 13:24:19 +02:00
|
|
|
|
2012-11-16 13:32:40 +01:00
|
|
|
template <class R>
|
|
|
|
class OpGetCommonDisease : public Interpreter::Opcode0
|
|
|
|
{
|
|
|
|
public:
|
2020-10-16 22:18:54 +04:00
|
|
|
void execute(Interpreter::Runtime& runtime) override
|
2012-11-16 13:32:40 +01:00
|
|
|
{
|
|
|
|
MWWorld::Ptr ptr = R()(runtime);
|
|
|
|
|
2014-05-22 20:37:22 +02:00
|
|
|
runtime.push(ptr.getClass().getCreatureStats(ptr).hasCommonDisease());
|
2012-11-16 13:32:40 +01:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
template <class R>
|
|
|
|
class OpGetBlightDisease : public Interpreter::Opcode0
|
|
|
|
{
|
|
|
|
public:
|
2020-10-16 22:18:54 +04:00
|
|
|
void execute(Interpreter::Runtime& runtime) override
|
2012-11-16 13:32:40 +01:00
|
|
|
{
|
|
|
|
MWWorld::Ptr ptr = R()(runtime);
|
|
|
|
|
2014-05-22 20:37:22 +02:00
|
|
|
runtime.push(ptr.getClass().getCreatureStats(ptr).hasBlightDisease());
|
2012-11-16 13:32:40 +01:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2012-11-25 01:26:29 +01:00
|
|
|
template <class R>
|
|
|
|
class OpGetRace : public Interpreter::Opcode0
|
|
|
|
{
|
|
|
|
public:
|
2020-10-16 22:18:54 +04:00
|
|
|
void execute(Interpreter::Runtime& runtime) override
|
2012-11-25 01:26:29 +01:00
|
|
|
{
|
2015-12-18 16:33:54 +01:00
|
|
|
MWWorld::ConstPtr ptr = R()(runtime);
|
2012-11-25 01:26:29 +01:00
|
|
|
|
Initial commit: In ESM structures, replace the string members that are RefIds to other records, to a new strong type
The strong type is actually just a string underneath, but this will help in the future to have a distinction so it's easier to search and replace when we use an integer ID
Slowly going through all the changes to make, still hundreds of errors
a lot of functions/structures use std::string or stringview to designate an ID. So it takes time
Continues slowly replacing ids. There are technically more and more compilation errors
I have good hope that there is a point where the amount of errors will dramatically go down as all the main functions use the ESM::RefId type
Continue moving forward, changes to the stores
slowly moving along
Starting to see the fruit of those changes.
still many many error, but more and more Irun into a situation where a function is sandwiched between two functions that use the RefId type.
More replacements. Things are starting to get easier
I can see more and more often the issue is that the function is awaiting a RefId, but is given a string
there is less need to go down functions and to fix a long list of them.
Still moving forward, and for the first time error count is going down!
Good pace, not sure about topics though, mId and mName are actually the same thing and are used interchangeably
Cells are back to using string for the name, haven't fixed everything yet. Many other changes
Under the bar of 400 compilation errors.
more good progress <100 compile errors!
More progress
Game settings store can use string for find, it was a bit absurd how every use of it required to create refId from string
some more progress on other fronts
Mostly game settings clean
one error opened a lot of other errors. Down to 18, but more will prbably appear
only link errors left??
Fixed link errors
OpenMW compiles, and launches, with some issues, but still!
2022-09-25 13:17:09 +02:00
|
|
|
ESM::RefId race = ESM::RefId::stringRefId(runtime.getStringLiteral(runtime[0].mInteger));
|
2012-11-25 01:26:29 +01:00
|
|
|
runtime.pop();
|
|
|
|
|
Initial commit: In ESM structures, replace the string members that are RefIds to other records, to a new strong type
The strong type is actually just a string underneath, but this will help in the future to have a distinction so it's easier to search and replace when we use an integer ID
Slowly going through all the changes to make, still hundreds of errors
a lot of functions/structures use std::string or stringview to designate an ID. So it takes time
Continues slowly replacing ids. There are technically more and more compilation errors
I have good hope that there is a point where the amount of errors will dramatically go down as all the main functions use the ESM::RefId type
Continue moving forward, changes to the stores
slowly moving along
Starting to see the fruit of those changes.
still many many error, but more and more Irun into a situation where a function is sandwiched between two functions that use the RefId type.
More replacements. Things are starting to get easier
I can see more and more often the issue is that the function is awaiting a RefId, but is given a string
there is less need to go down functions and to fix a long list of them.
Still moving forward, and for the first time error count is going down!
Good pace, not sure about topics though, mId and mName are actually the same thing and are used interchangeably
Cells are back to using string for the name, haven't fixed everything yet. Many other changes
Under the bar of 400 compilation errors.
more good progress <100 compile errors!
More progress
Game settings store can use string for find, it was a bit absurd how every use of it required to create refId from string
some more progress on other fronts
Mostly game settings clean
one error opened a lot of other errors. Down to 18, but more will prbably appear
only link errors left??
Fixed link errors
OpenMW compiles, and launches, with some issues, but still!
2022-09-25 13:17:09 +02:00
|
|
|
const ESM::RefId& npcRace = ptr.get<ESM::NPC>()->mBase->mRace;
|
2012-11-25 01:26:29 +01:00
|
|
|
|
2022-10-18 09:26:55 +02:00
|
|
|
runtime.push(race == npcRace);
|
2012-11-25 01:26:29 +01:00
|
|
|
}
|
|
|
|
};
|
2012-05-29 15:57:13 +02:00
|
|
|
|
2012-11-27 06:54:13 +01:00
|
|
|
class OpGetWerewolfKills : public Interpreter::Opcode0
|
|
|
|
{
|
|
|
|
public:
|
2020-10-16 22:18:54 +04:00
|
|
|
void execute(Interpreter::Runtime& runtime) override
|
2012-11-27 06:54:13 +01:00
|
|
|
{
|
2014-01-08 18:39:44 +01:00
|
|
|
MWWorld::Ptr ptr = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
2012-11-27 06:54:13 +01:00
|
|
|
|
2014-05-22 20:37:22 +02:00
|
|
|
runtime.push(ptr.getClass().getNpcStats(ptr).getWerewolfKills());
|
2012-11-27 06:54:13 +01:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2012-11-28 02:15:34 +01:00
|
|
|
template <class R>
|
|
|
|
class OpPcExpelled : public Interpreter::Opcode1
|
|
|
|
{
|
|
|
|
public:
|
2020-10-16 22:18:54 +04:00
|
|
|
void execute(Interpreter::Runtime& runtime, unsigned int arg0) override
|
2022-09-22 21:26:05 +03:00
|
|
|
{
|
2015-12-18 16:33:54 +01:00
|
|
|
MWWorld::ConstPtr ptr = R()(runtime, false);
|
2012-11-28 02:15:34 +01:00
|
|
|
|
Initial commit: In ESM structures, replace the string members that are RefIds to other records, to a new strong type
The strong type is actually just a string underneath, but this will help in the future to have a distinction so it's easier to search and replace when we use an integer ID
Slowly going through all the changes to make, still hundreds of errors
a lot of functions/structures use std::string or stringview to designate an ID. So it takes time
Continues slowly replacing ids. There are technically more and more compilation errors
I have good hope that there is a point where the amount of errors will dramatically go down as all the main functions use the ESM::RefId type
Continue moving forward, changes to the stores
slowly moving along
Starting to see the fruit of those changes.
still many many error, but more and more Irun into a situation where a function is sandwiched between two functions that use the RefId type.
More replacements. Things are starting to get easier
I can see more and more often the issue is that the function is awaiting a RefId, but is given a string
there is less need to go down functions and to fix a long list of them.
Still moving forward, and for the first time error count is going down!
Good pace, not sure about topics though, mId and mName are actually the same thing and are used interchangeably
Cells are back to using string for the name, haven't fixed everything yet. Many other changes
Under the bar of 400 compilation errors.
more good progress <100 compile errors!
More progress
Game settings store can use string for find, it was a bit absurd how every use of it required to create refId from string
some more progress on other fronts
Mostly game settings clean
one error opened a lot of other errors. Down to 18, but more will prbably appear
only link errors left??
Fixed link errors
OpenMW compiles, and launches, with some issues, but still!
2022-09-25 13:17:09 +02:00
|
|
|
ESM::RefId factionID;
|
2020-10-16 22:18:54 +04:00
|
|
|
if (arg0 > 0)
|
2012-11-28 02:15:34 +01:00
|
|
|
{
|
Initial commit: In ESM structures, replace the string members that are RefIds to other records, to a new strong type
The strong type is actually just a string underneath, but this will help in the future to have a distinction so it's easier to search and replace when we use an integer ID
Slowly going through all the changes to make, still hundreds of errors
a lot of functions/structures use std::string or stringview to designate an ID. So it takes time
Continues slowly replacing ids. There are technically more and more compilation errors
I have good hope that there is a point where the amount of errors will dramatically go down as all the main functions use the ESM::RefId type
Continue moving forward, changes to the stores
slowly moving along
Starting to see the fruit of those changes.
still many many error, but more and more Irun into a situation where a function is sandwiched between two functions that use the RefId type.
More replacements. Things are starting to get easier
I can see more and more often the issue is that the function is awaiting a RefId, but is given a string
there is less need to go down functions and to fix a long list of them.
Still moving forward, and for the first time error count is going down!
Good pace, not sure about topics though, mId and mName are actually the same thing and are used interchangeably
Cells are back to using string for the name, haven't fixed everything yet. Many other changes
Under the bar of 400 compilation errors.
more good progress <100 compile errors!
More progress
Game settings store can use string for find, it was a bit absurd how every use of it required to create refId from string
some more progress on other fronts
Mostly game settings clean
one error opened a lot of other errors. Down to 18, but more will prbably appear
only link errors left??
Fixed link errors
OpenMW compiles, and launches, with some issues, but still!
2022-09-25 13:17:09 +02:00
|
|
|
factionID = ESM::RefId::stringRefId(runtime.getStringLiteral(runtime[0].mInteger));
|
2012-11-28 02:15:34 +01:00
|
|
|
runtime.pop();
|
|
|
|
}
|
2022-09-22 21:26:05 +03:00
|
|
|
else
|
|
|
|
{
|
2015-01-27 17:32:21 +01:00
|
|
|
factionID = ptr.getClass().getPrimaryFaction(ptr);
|
2022-09-22 21:26:05 +03:00
|
|
|
}
|
2015-08-21 21:12:39 +12:00
|
|
|
MWWorld::Ptr player = MWMechanics::getPlayer();
|
2022-06-13 18:21:29 +02:00
|
|
|
if (!factionID.empty())
|
2022-09-22 21:26:05 +03:00
|
|
|
{
|
2014-01-08 18:59:00 +01:00
|
|
|
runtime.push(player.getClass().getNpcStats(player).getExpelled(factionID));
|
2022-09-22 21:26:05 +03:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-11-28 02:15:34 +01:00
|
|
|
runtime.push(0);
|
2022-09-22 21:26:05 +03:00
|
|
|
}
|
|
|
|
}
|
2012-11-28 02:15:34 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
template <class R>
|
|
|
|
class OpPcExpell : public Interpreter::Opcode1
|
|
|
|
{
|
|
|
|
public:
|
2020-10-16 22:18:54 +04:00
|
|
|
void execute(Interpreter::Runtime& runtime, unsigned int arg0) override
|
2022-09-22 21:26:05 +03:00
|
|
|
{
|
2015-12-18 16:33:54 +01:00
|
|
|
MWWorld::ConstPtr ptr = R()(runtime, false);
|
2012-11-28 02:15:34 +01:00
|
|
|
|
Initial commit: In ESM structures, replace the string members that are RefIds to other records, to a new strong type
The strong type is actually just a string underneath, but this will help in the future to have a distinction so it's easier to search and replace when we use an integer ID
Slowly going through all the changes to make, still hundreds of errors
a lot of functions/structures use std::string or stringview to designate an ID. So it takes time
Continues slowly replacing ids. There are technically more and more compilation errors
I have good hope that there is a point where the amount of errors will dramatically go down as all the main functions use the ESM::RefId type
Continue moving forward, changes to the stores
slowly moving along
Starting to see the fruit of those changes.
still many many error, but more and more Irun into a situation where a function is sandwiched between two functions that use the RefId type.
More replacements. Things are starting to get easier
I can see more and more often the issue is that the function is awaiting a RefId, but is given a string
there is less need to go down functions and to fix a long list of them.
Still moving forward, and for the first time error count is going down!
Good pace, not sure about topics though, mId and mName are actually the same thing and are used interchangeably
Cells are back to using string for the name, haven't fixed everything yet. Many other changes
Under the bar of 400 compilation errors.
more good progress <100 compile errors!
More progress
Game settings store can use string for find, it was a bit absurd how every use of it required to create refId from string
some more progress on other fronts
Mostly game settings clean
one error opened a lot of other errors. Down to 18, but more will prbably appear
only link errors left??
Fixed link errors
OpenMW compiles, and launches, with some issues, but still!
2022-09-25 13:17:09 +02:00
|
|
|
ESM::RefId factionID;
|
2020-10-16 22:18:54 +04:00
|
|
|
if (arg0 > 0)
|
2012-11-28 02:15:34 +01:00
|
|
|
{
|
Initial commit: In ESM structures, replace the string members that are RefIds to other records, to a new strong type
The strong type is actually just a string underneath, but this will help in the future to have a distinction so it's easier to search and replace when we use an integer ID
Slowly going through all the changes to make, still hundreds of errors
a lot of functions/structures use std::string or stringview to designate an ID. So it takes time
Continues slowly replacing ids. There are technically more and more compilation errors
I have good hope that there is a point where the amount of errors will dramatically go down as all the main functions use the ESM::RefId type
Continue moving forward, changes to the stores
slowly moving along
Starting to see the fruit of those changes.
still many many error, but more and more Irun into a situation where a function is sandwiched between two functions that use the RefId type.
More replacements. Things are starting to get easier
I can see more and more often the issue is that the function is awaiting a RefId, but is given a string
there is less need to go down functions and to fix a long list of them.
Still moving forward, and for the first time error count is going down!
Good pace, not sure about topics though, mId and mName are actually the same thing and are used interchangeably
Cells are back to using string for the name, haven't fixed everything yet. Many other changes
Under the bar of 400 compilation errors.
more good progress <100 compile errors!
More progress
Game settings store can use string for find, it was a bit absurd how every use of it required to create refId from string
some more progress on other fronts
Mostly game settings clean
one error opened a lot of other errors. Down to 18, but more will prbably appear
only link errors left??
Fixed link errors
OpenMW compiles, and launches, with some issues, but still!
2022-09-25 13:17:09 +02:00
|
|
|
factionID = ESM::RefId::stringRefId(runtime.getStringLiteral(runtime[0].mInteger));
|
2012-11-28 02:15:34 +01:00
|
|
|
runtime.pop();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2015-01-27 17:32:21 +01:00
|
|
|
factionID = ptr.getClass().getPrimaryFaction(ptr);
|
2012-11-28 02:15:34 +01:00
|
|
|
}
|
2015-08-21 21:12:39 +12:00
|
|
|
MWWorld::Ptr player = MWMechanics::getPlayer();
|
2022-06-13 18:21:29 +02:00
|
|
|
if (!factionID.empty())
|
2012-11-28 02:15:34 +01:00
|
|
|
{
|
2014-01-08 18:59:00 +01:00
|
|
|
player.getClass().getNpcStats(player).expell(factionID);
|
2012-11-28 02:15:34 +01:00
|
|
|
}
|
2022-09-22 21:26:05 +03:00
|
|
|
}
|
2012-11-28 02:15:34 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
template <class R>
|
|
|
|
class OpPcClearExpelled : public Interpreter::Opcode1
|
|
|
|
{
|
|
|
|
public:
|
2020-10-16 22:18:54 +04:00
|
|
|
void execute(Interpreter::Runtime& runtime, unsigned int arg0) override
|
2022-09-22 21:26:05 +03:00
|
|
|
{
|
2015-12-18 16:33:54 +01:00
|
|
|
MWWorld::ConstPtr ptr = R()(runtime, false);
|
2012-11-28 02:15:34 +01:00
|
|
|
|
Initial commit: In ESM structures, replace the string members that are RefIds to other records, to a new strong type
The strong type is actually just a string underneath, but this will help in the future to have a distinction so it's easier to search and replace when we use an integer ID
Slowly going through all the changes to make, still hundreds of errors
a lot of functions/structures use std::string or stringview to designate an ID. So it takes time
Continues slowly replacing ids. There are technically more and more compilation errors
I have good hope that there is a point where the amount of errors will dramatically go down as all the main functions use the ESM::RefId type
Continue moving forward, changes to the stores
slowly moving along
Starting to see the fruit of those changes.
still many many error, but more and more Irun into a situation where a function is sandwiched between two functions that use the RefId type.
More replacements. Things are starting to get easier
I can see more and more often the issue is that the function is awaiting a RefId, but is given a string
there is less need to go down functions and to fix a long list of them.
Still moving forward, and for the first time error count is going down!
Good pace, not sure about topics though, mId and mName are actually the same thing and are used interchangeably
Cells are back to using string for the name, haven't fixed everything yet. Many other changes
Under the bar of 400 compilation errors.
more good progress <100 compile errors!
More progress
Game settings store can use string for find, it was a bit absurd how every use of it required to create refId from string
some more progress on other fronts
Mostly game settings clean
one error opened a lot of other errors. Down to 18, but more will prbably appear
only link errors left??
Fixed link errors
OpenMW compiles, and launches, with some issues, but still!
2022-09-25 13:17:09 +02:00
|
|
|
ESM::RefId factionID;
|
2020-10-16 22:18:54 +04:00
|
|
|
if (arg0 > 0)
|
2012-11-28 02:15:34 +01:00
|
|
|
{
|
Initial commit: In ESM structures, replace the string members that are RefIds to other records, to a new strong type
The strong type is actually just a string underneath, but this will help in the future to have a distinction so it's easier to search and replace when we use an integer ID
Slowly going through all the changes to make, still hundreds of errors
a lot of functions/structures use std::string or stringview to designate an ID. So it takes time
Continues slowly replacing ids. There are technically more and more compilation errors
I have good hope that there is a point where the amount of errors will dramatically go down as all the main functions use the ESM::RefId type
Continue moving forward, changes to the stores
slowly moving along
Starting to see the fruit of those changes.
still many many error, but more and more Irun into a situation where a function is sandwiched between two functions that use the RefId type.
More replacements. Things are starting to get easier
I can see more and more often the issue is that the function is awaiting a RefId, but is given a string
there is less need to go down functions and to fix a long list of them.
Still moving forward, and for the first time error count is going down!
Good pace, not sure about topics though, mId and mName are actually the same thing and are used interchangeably
Cells are back to using string for the name, haven't fixed everything yet. Many other changes
Under the bar of 400 compilation errors.
more good progress <100 compile errors!
More progress
Game settings store can use string for find, it was a bit absurd how every use of it required to create refId from string
some more progress on other fronts
Mostly game settings clean
one error opened a lot of other errors. Down to 18, but more will prbably appear
only link errors left??
Fixed link errors
OpenMW compiles, and launches, with some issues, but still!
2022-09-25 13:17:09 +02:00
|
|
|
factionID = ESM::RefId::stringRefId(runtime.getStringLiteral(runtime[0].mInteger));
|
2012-11-28 02:15:34 +01:00
|
|
|
runtime.pop();
|
|
|
|
}
|
2022-09-22 21:26:05 +03:00
|
|
|
else
|
|
|
|
{
|
2015-01-27 17:32:21 +01:00
|
|
|
factionID = ptr.getClass().getPrimaryFaction(ptr);
|
2022-09-22 21:26:05 +03:00
|
|
|
}
|
2015-08-21 21:12:39 +12:00
|
|
|
MWWorld::Ptr player = MWMechanics::getPlayer();
|
2022-06-13 18:21:29 +02:00
|
|
|
if (!factionID.empty())
|
2014-01-08 18:59:00 +01:00
|
|
|
player.getClass().getNpcStats(player).clearExpelled(factionID);
|
2022-09-22 21:26:05 +03:00
|
|
|
}
|
2012-11-28 02:15:34 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
template <class R>
|
|
|
|
class OpRaiseRank : public Interpreter::Opcode0
|
|
|
|
{
|
|
|
|
public:
|
2020-10-16 22:18:54 +04:00
|
|
|
void execute(Interpreter::Runtime& runtime) override
|
2012-11-28 02:15:34 +01:00
|
|
|
{
|
|
|
|
MWWorld::Ptr ptr = R()(runtime);
|
|
|
|
|
2022-12-01 20:02:39 +01:00
|
|
|
const ESM::RefId& factionID = ptr.getClass().getPrimaryFaction(ptr);
|
2015-01-27 17:32:21 +01:00
|
|
|
if (factionID.empty())
|
2012-11-28 02:15:34 +01:00
|
|
|
return;
|
2015-01-27 17:32:21 +01:00
|
|
|
|
2015-08-21 21:12:39 +12:00
|
|
|
MWWorld::Ptr player = MWMechanics::getPlayer();
|
2012-11-28 02:15:34 +01:00
|
|
|
|
|
|
|
// no-op when executed on the player
|
|
|
|
if (ptr == player)
|
|
|
|
return;
|
|
|
|
|
2019-05-14 10:12:40 +04:00
|
|
|
// If we already changed rank for this NPC, modify current rank in the NPC stats.
|
|
|
|
// Otherwise take rank from base NPC record, increase it and put it to NPC data.
|
|
|
|
int currentRank = ptr.getClass().getNpcStats(ptr).getFactionRank(factionID);
|
|
|
|
if (currentRank >= 0)
|
2023-06-14 03:38:22 +08:00
|
|
|
ptr.getClass().getNpcStats(ptr).setFactionRank(factionID, currentRank + 1);
|
2022-09-22 21:26:05 +03:00
|
|
|
else
|
|
|
|
{
|
2019-05-14 10:12:40 +04:00
|
|
|
int rank = ptr.getClass().getPrimaryFactionRank(ptr);
|
|
|
|
ptr.getClass().getNpcStats(ptr).joinFaction(factionID);
|
2023-06-14 03:38:22 +08:00
|
|
|
ptr.getClass().getNpcStats(ptr).setFactionRank(factionID, rank + 1);
|
2012-11-28 02:15:34 +01:00
|
|
|
}
|
2022-09-22 21:26:05 +03:00
|
|
|
}
|
2012-11-28 02:15:34 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
template <class R>
|
|
|
|
class OpLowerRank : public Interpreter::Opcode0
|
|
|
|
{
|
|
|
|
public:
|
2020-10-16 22:18:54 +04:00
|
|
|
void execute(Interpreter::Runtime& runtime) override
|
2012-11-28 02:15:34 +01:00
|
|
|
{
|
|
|
|
MWWorld::Ptr ptr = R()(runtime);
|
2015-01-27 17:32:21 +01:00
|
|
|
|
2022-12-01 20:02:39 +01:00
|
|
|
const ESM::RefId& factionID = ptr.getClass().getPrimaryFaction(ptr);
|
2015-01-27 17:32:21 +01:00
|
|
|
if (factionID.empty())
|
2022-09-22 21:26:05 +03:00
|
|
|
return;
|
2012-11-28 02:15:34 +01:00
|
|
|
|
|
|
|
MWWorld::Ptr player = MWMechanics::getPlayer();
|
|
|
|
|
|
|
|
// no-op when executed on the player
|
2015-08-21 21:12:39 +12:00
|
|
|
if (ptr == player)
|
2022-09-22 21:26:05 +03:00
|
|
|
return;
|
|
|
|
|
2019-05-14 10:12:40 +04:00
|
|
|
// If we already changed rank for this NPC, modify current rank in the NPC stats.
|
|
|
|
// Otherwise take rank from base NPC record, decrease it and put it to NPC data.
|
|
|
|
int currentRank = ptr.getClass().getNpcStats(ptr).getFactionRank(factionID);
|
|
|
|
if (currentRank == 0)
|
|
|
|
return;
|
|
|
|
else if (currentRank > 0)
|
2023-06-14 03:38:22 +08:00
|
|
|
ptr.getClass().getNpcStats(ptr).setFactionRank(factionID, currentRank - 1);
|
2019-05-14 10:12:40 +04:00
|
|
|
else
|
|
|
|
{
|
|
|
|
int rank = ptr.getClass().getPrimaryFactionRank(ptr);
|
|
|
|
ptr.getClass().getNpcStats(ptr).joinFaction(factionID);
|
2023-06-14 03:38:22 +08:00
|
|
|
ptr.getClass().getNpcStats(ptr).setFactionRank(factionID, std::max(0, rank - 1));
|
2012-11-28 02:15:34 +01:00
|
|
|
}
|
2022-09-22 21:26:05 +03:00
|
|
|
}
|
2012-11-28 02:15:34 +01:00
|
|
|
};
|
|
|
|
|
2013-04-26 02:08:53 +02:00
|
|
|
template <class R>
|
2013-03-18 11:04:47 +01:00
|
|
|
class OpOnDeath : public Interpreter::Opcode0
|
|
|
|
{
|
|
|
|
public:
|
2020-10-16 22:18:54 +04:00
|
|
|
void execute(Interpreter::Runtime& runtime) override
|
2013-03-18 11:04:47 +01:00
|
|
|
{
|
2013-04-26 02:08:53 +02:00
|
|
|
MWWorld::Ptr ptr = R()(runtime);
|
2013-03-18 11:04:47 +01:00
|
|
|
|
2014-05-22 20:37:22 +02:00
|
|
|
Interpreter::Type_Integer value = ptr.getClass().getCreatureStats(ptr).hasDied();
|
2013-03-18 11:04:47 +01:00
|
|
|
|
|
|
|
if (value)
|
2014-05-22 20:37:22 +02:00
|
|
|
ptr.getClass().getCreatureStats(ptr).clearHasDied();
|
2013-03-18 11:04:47 +01:00
|
|
|
|
|
|
|
runtime.push(value);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2014-06-17 03:54:41 +02:00
|
|
|
template <class R>
|
|
|
|
class OpOnMurder : public Interpreter::Opcode0
|
|
|
|
{
|
|
|
|
public:
|
2020-10-16 22:18:54 +04:00
|
|
|
void execute(Interpreter::Runtime& runtime) override
|
2014-06-17 03:54:41 +02:00
|
|
|
{
|
|
|
|
MWWorld::Ptr ptr = R()(runtime);
|
|
|
|
|
|
|
|
Interpreter::Type_Integer value = ptr.getClass().getCreatureStats(ptr).hasBeenMurdered();
|
|
|
|
|
|
|
|
if (value)
|
|
|
|
ptr.getClass().getCreatureStats(ptr).clearHasBeenMurdered();
|
|
|
|
|
|
|
|
runtime.push(value);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2014-04-27 20:54:22 -04:00
|
|
|
template <class R>
|
|
|
|
class OpOnKnockout : public Interpreter::Opcode0
|
|
|
|
{
|
|
|
|
public:
|
2020-10-16 22:18:54 +04:00
|
|
|
void execute(Interpreter::Runtime& runtime) override
|
2014-04-27 20:54:22 -04:00
|
|
|
{
|
|
|
|
MWWorld::Ptr ptr = R()(runtime);
|
|
|
|
|
2014-05-22 20:37:22 +02:00
|
|
|
Interpreter::Type_Integer value = ptr.getClass().getCreatureStats(ptr).getKnockedDownOneFrame();
|
2014-04-27 20:54:22 -04:00
|
|
|
|
|
|
|
runtime.push(value);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2013-03-30 13:20:51 -07:00
|
|
|
template <class R>
|
|
|
|
class OpIsWerewolf : public Interpreter::Opcode0
|
|
|
|
{
|
|
|
|
public:
|
2020-10-16 22:18:54 +04:00
|
|
|
void execute(Interpreter::Runtime& runtime) override
|
2013-03-30 13:20:51 -07:00
|
|
|
{
|
|
|
|
MWWorld::Ptr ptr = R()(runtime);
|
2014-05-22 20:37:22 +02:00
|
|
|
runtime.push(ptr.getClass().getNpcStats(ptr).isWerewolf());
|
2013-03-30 13:20:51 -07:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2013-08-05 23:24:48 +02:00
|
|
|
template <class R, bool set>
|
|
|
|
class OpSetWerewolf : public Interpreter::Opcode0
|
|
|
|
{
|
|
|
|
public:
|
2020-10-16 22:18:54 +04:00
|
|
|
void execute(Interpreter::Runtime& runtime) override
|
2013-08-05 23:24:48 +02:00
|
|
|
{
|
|
|
|
MWWorld::Ptr ptr = R()(runtime);
|
2015-12-26 18:22:21 +01:00
|
|
|
MWBase::Environment::get().getMechanicsManager()->setWerewolf(ptr, set);
|
2013-08-05 23:24:48 +02:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2013-08-09 05:37:56 -07:00
|
|
|
template <class R>
|
|
|
|
class OpSetWerewolfAcrobatics : public Interpreter::Opcode0
|
|
|
|
{
|
|
|
|
public:
|
2020-10-16 22:18:54 +04:00
|
|
|
void execute(Interpreter::Runtime& runtime) override
|
2013-08-09 05:37:56 -07:00
|
|
|
{
|
2013-08-13 00:25:39 -07:00
|
|
|
MWWorld::Ptr ptr = R()(runtime);
|
2015-12-26 18:22:21 +01:00
|
|
|
MWBase::Environment::get().getMechanicsManager()->applyWerewolfAcrobatics(ptr);
|
2013-08-09 05:37:56 -07:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2014-01-03 15:54:23 +01:00
|
|
|
template <class R>
|
|
|
|
class OpResurrect : public Interpreter::Opcode0
|
|
|
|
{
|
|
|
|
public:
|
2022-09-05 20:21:19 +02:00
|
|
|
void execute(Interpreter::Runtime& runtime) override
|
2022-09-22 21:26:05 +03:00
|
|
|
{
|
2014-01-03 15:54:23 +01:00
|
|
|
MWWorld::Ptr ptr = R()(runtime);
|
|
|
|
|
2020-10-16 22:18:54 +04:00
|
|
|
if (ptr == MWMechanics::getPlayer())
|
2014-01-03 15:54:23 +01:00
|
|
|
{
|
|
|
|
MWBase::Environment::get().getMechanicsManager()->resurrect(ptr);
|
2015-08-21 21:12:39 +12:00
|
|
|
if (MWBase::Environment::get().getStateManager()->getState() == MWBase::StateManager::State_Ended)
|
2018-07-26 19:54:08 +03:00
|
|
|
MWBase::Environment::get().getStateManager()->resumeGame();
|
2022-09-22 21:26:05 +03:00
|
|
|
}
|
2015-08-21 21:12:39 +12:00
|
|
|
else if (ptr.getClass().getCreatureStats(ptr).isDead())
|
2022-09-22 21:26:05 +03:00
|
|
|
{
|
2016-01-04 20:27:38 +01:00
|
|
|
bool wasEnabled = ptr.getRefData().isEnabled();
|
2014-12-06 21:08:18 +01:00
|
|
|
MWBase::Environment::get().getWorld()->undeleteObject(ptr);
|
2015-08-21 21:12:39 +12:00
|
|
|
auto windowManager = MWBase::Environment::get().getWindowManager();
|
2021-12-01 18:21:21 +01:00
|
|
|
bool wasOpen = windowManager->containsMode(MWGui::GM_Container);
|
2015-08-21 21:12:39 +12:00
|
|
|
windowManager->onDeleteCustomData(ptr);
|
|
|
|
// HACK: disable/enable object to re-add it to the scene properly (need a new Animation).
|
2016-01-04 20:27:38 +01:00
|
|
|
MWBase::Environment::get().getWorld()->disable(ptr);
|
2022-12-01 17:07:10 +01:00
|
|
|
// The actor's base record may have changed after this specific reference was created.
|
|
|
|
// So we need to update to the current version
|
|
|
|
if (ptr.getClass().isNpc())
|
|
|
|
updateBaseRecord<ESM::NPC>(ptr);
|
|
|
|
else
|
|
|
|
updateBaseRecord<ESM::Creature>(ptr);
|
2021-12-01 18:21:21 +01:00
|
|
|
if (wasOpen && !windowManager->containsMode(MWGui::GM_Container))
|
2018-07-26 19:54:08 +03:00
|
|
|
{
|
2021-12-02 20:36:42 +01:00
|
|
|
// Reopen the loot GUI if it was closed because we resurrected the actor we were looting
|
2019-09-21 20:22:45 +04:00
|
|
|
MWBase::Environment::get().getMechanicsManager()->resurrect(ptr);
|
2018-07-26 19:54:08 +03:00
|
|
|
windowManager->forceLootMode(ptr);
|
|
|
|
}
|
2014-12-06 19:53:24 +01:00
|
|
|
else
|
|
|
|
{
|
2014-12-06 21:08:18 +01:00
|
|
|
MWBase::Environment::get().getWorld()->removeContainerScripts(ptr);
|
2021-12-02 20:36:42 +01:00
|
|
|
// resets runtime state such as inventory, stats and AI. does not reset position in the world
|
|
|
|
ptr.getRefData().setCustomData(nullptr);
|
2014-12-06 19:53:24 +01:00
|
|
|
}
|
2021-12-02 20:36:42 +01:00
|
|
|
if (wasEnabled)
|
|
|
|
MWBase::Environment::get().getWorld()->enable(ptr);
|
2014-01-03 15:54:23 +01:00
|
|
|
}
|
2022-09-22 21:26:05 +03:00
|
|
|
}
|
2014-01-03 15:54:23 +01:00
|
|
|
};
|
|
|
|
|
2014-06-30 17:49:01 +02:00
|
|
|
template <class R>
|
|
|
|
class OpGetStat : public Interpreter::Opcode0
|
|
|
|
{
|
|
|
|
public:
|
2020-10-16 22:18:54 +04:00
|
|
|
void execute(Interpreter::Runtime& runtime) override
|
2014-06-30 17:49:01 +02:00
|
|
|
{
|
|
|
|
// dummy
|
2022-04-30 16:45:45 +02:00
|
|
|
runtime.pop();
|
2014-06-30 17:49:01 +02:00
|
|
|
runtime.push(0);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2014-08-17 03:57:26 +02:00
|
|
|
template <class R>
|
|
|
|
class OpGetMagicEffect : public Interpreter::Opcode0
|
|
|
|
{
|
|
|
|
int mPositiveEffect;
|
|
|
|
int mNegativeEffect;
|
|
|
|
|
|
|
|
public:
|
|
|
|
OpGetMagicEffect(int positiveEffect, int negativeEffect)
|
|
|
|
: mPositiveEffect(positiveEffect)
|
|
|
|
, mNegativeEffect(negativeEffect)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2020-10-16 22:18:54 +04:00
|
|
|
void execute(Interpreter::Runtime& runtime) override
|
2014-08-17 03:57:26 +02:00
|
|
|
{
|
|
|
|
MWWorld::Ptr ptr = R()(runtime);
|
|
|
|
|
2015-08-20 18:17:02 +12:00
|
|
|
const MWMechanics::MagicEffects& effects = ptr.getClass().getCreatureStats(ptr).getMagicEffects();
|
2023-05-23 19:06:08 +02:00
|
|
|
float currentValue = effects.getOrDefault(mPositiveEffect).getMagnitude();
|
2014-08-17 03:57:26 +02:00
|
|
|
if (mNegativeEffect != -1)
|
2023-05-23 19:06:08 +02:00
|
|
|
currentValue -= effects.getOrDefault(mNegativeEffect).getMagnitude();
|
2014-08-17 03:57:26 +02:00
|
|
|
|
2017-09-10 14:21:05 +04:00
|
|
|
// GetResist* should take in account elemental shields
|
|
|
|
if (mPositiveEffect == ESM::MagicEffect::ResistFire)
|
2023-05-23 19:06:08 +02:00
|
|
|
currentValue += effects.getOrDefault(ESM::MagicEffect::FireShield).getMagnitude();
|
2017-09-10 14:21:05 +04:00
|
|
|
if (mPositiveEffect == ESM::MagicEffect::ResistShock)
|
2023-05-23 19:06:08 +02:00
|
|
|
currentValue += effects.getOrDefault(ESM::MagicEffect::LightningShield).getMagnitude();
|
2017-09-10 14:21:05 +04:00
|
|
|
if (mPositiveEffect == ESM::MagicEffect::ResistFrost)
|
2023-05-23 19:06:08 +02:00
|
|
|
currentValue += effects.getOrDefault(ESM::MagicEffect::FrostShield).getMagnitude();
|
2017-09-10 14:21:05 +04:00
|
|
|
|
2014-08-17 03:57:26 +02:00
|
|
|
int ret = static_cast<int>(currentValue);
|
|
|
|
runtime.push(ret);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
template <class R>
|
|
|
|
class OpSetMagicEffect : public Interpreter::Opcode0
|
|
|
|
{
|
|
|
|
int mPositiveEffect;
|
|
|
|
int mNegativeEffect;
|
|
|
|
|
|
|
|
public:
|
|
|
|
OpSetMagicEffect(int positiveEffect, int negativeEffect)
|
|
|
|
: mPositiveEffect(positiveEffect)
|
|
|
|
, mNegativeEffect(negativeEffect)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2020-10-16 22:18:54 +04:00
|
|
|
void execute(Interpreter::Runtime& runtime) override
|
2014-08-17 03:57:26 +02:00
|
|
|
{
|
|
|
|
MWWorld::Ptr ptr = R()(runtime);
|
2015-08-20 18:17:02 +12:00
|
|
|
MWMechanics::MagicEffects& effects = ptr.getClass().getCreatureStats(ptr).getMagicEffects();
|
2023-05-23 19:06:08 +02:00
|
|
|
float currentValue = effects.getOrDefault(mPositiveEffect).getMagnitude();
|
2014-08-17 03:57:26 +02:00
|
|
|
if (mNegativeEffect != -1)
|
2023-05-23 19:06:08 +02:00
|
|
|
currentValue -= effects.getOrDefault(mNegativeEffect).getMagnitude();
|
2014-08-17 03:57:26 +02:00
|
|
|
|
2017-09-10 14:21:05 +04:00
|
|
|
// SetResist* should take in account elemental shields
|
|
|
|
if (mPositiveEffect == ESM::MagicEffect::ResistFire)
|
2023-05-23 19:06:08 +02:00
|
|
|
currentValue += effects.getOrDefault(ESM::MagicEffect::FireShield).getMagnitude();
|
2017-09-10 14:21:05 +04:00
|
|
|
if (mPositiveEffect == ESM::MagicEffect::ResistShock)
|
2023-05-23 19:06:08 +02:00
|
|
|
currentValue += effects.getOrDefault(ESM::MagicEffect::LightningShield).getMagnitude();
|
2017-09-10 14:21:05 +04:00
|
|
|
if (mPositiveEffect == ESM::MagicEffect::ResistFrost)
|
2023-05-23 19:06:08 +02:00
|
|
|
currentValue += effects.getOrDefault(ESM::MagicEffect::FrostShield).getMagnitude();
|
2017-09-10 14:21:05 +04:00
|
|
|
|
2014-08-17 03:57:26 +02:00
|
|
|
int arg = runtime[0].mInteger;
|
|
|
|
runtime.pop();
|
2015-08-20 18:17:02 +12:00
|
|
|
effects.modifyBase(mPositiveEffect, (arg - static_cast<int>(currentValue)));
|
2014-08-17 03:57:26 +02:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
template <class R>
|
|
|
|
class OpModMagicEffect : public Interpreter::Opcode0
|
|
|
|
{
|
|
|
|
int mPositiveEffect;
|
|
|
|
int mNegativeEffect;
|
|
|
|
|
|
|
|
public:
|
|
|
|
OpModMagicEffect(int positiveEffect, int negativeEffect)
|
|
|
|
: mPositiveEffect(positiveEffect)
|
|
|
|
, mNegativeEffect(negativeEffect)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2020-10-16 22:18:54 +04:00
|
|
|
void execute(Interpreter::Runtime& runtime) override
|
2014-08-17 03:57:26 +02:00
|
|
|
{
|
|
|
|
MWWorld::Ptr ptr = R()(runtime);
|
|
|
|
MWMechanics::CreatureStats& stats = ptr.getClass().getCreatureStats(ptr);
|
|
|
|
|
|
|
|
int arg = runtime[0].mInteger;
|
|
|
|
runtime.pop();
|
|
|
|
stats.getMagicEffects().modifyBase(mPositiveEffect, arg);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2022-09-05 20:21:19 +02:00
|
|
|
class OpGetPCVisionBonus : public Interpreter::Opcode0
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
void execute(Interpreter::Runtime& runtime) override
|
|
|
|
{
|
|
|
|
MWWorld::Ptr player = MWMechanics::getPlayer();
|
|
|
|
MWMechanics::EffectParam nightEye
|
2023-05-23 19:06:08 +02:00
|
|
|
= player.getClass().getCreatureStats(player).getMagicEffects().getOrDefault(
|
|
|
|
ESM::MagicEffect::NightEye);
|
2022-09-05 20:21:19 +02:00
|
|
|
runtime.push(std::clamp(nightEye.getMagnitude() / 100.f, 0.f, 1.f));
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
class OpSetPCVisionBonus : public Interpreter::Opcode0
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
void execute(Interpreter::Runtime& runtime) override
|
|
|
|
{
|
|
|
|
float arg = runtime[0].mFloat;
|
|
|
|
runtime.pop();
|
|
|
|
MWWorld::Ptr player = MWMechanics::getPlayer();
|
|
|
|
auto& effects = player.getClass().getCreatureStats(player).getMagicEffects();
|
2023-05-23 19:06:08 +02:00
|
|
|
float delta = std::clamp(arg * 100.f, 0.f, 100.f)
|
|
|
|
- effects.getOrDefault(ESM::MagicEffect::NightEye).getMagnitude();
|
2022-09-05 20:21:19 +02:00
|
|
|
effects.modifyBase(ESM::MagicEffect::NightEye, static_cast<int>(delta));
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
class OpModPCVisionBonus : public Interpreter::Opcode0
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
void execute(Interpreter::Runtime& runtime) override
|
|
|
|
{
|
|
|
|
float arg = runtime[0].mFloat;
|
|
|
|
runtime.pop();
|
|
|
|
MWWorld::Ptr player = MWMechanics::getPlayer();
|
|
|
|
auto& effects = player.getClass().getCreatureStats(player).getMagicEffects();
|
2023-05-23 19:06:08 +02:00
|
|
|
const MWMechanics::EffectParam nightEye = effects.getOrDefault(ESM::MagicEffect::NightEye);
|
2022-09-05 20:21:19 +02:00
|
|
|
float newBase = std::clamp(nightEye.getMagnitude() + arg * 100.f, 0.f, 100.f);
|
|
|
|
newBase -= nightEye.getModifier();
|
|
|
|
float delta = std::clamp(newBase, 0.f, 100.f) - nightEye.getMagnitude();
|
|
|
|
effects.modifyBase(ESM::MagicEffect::NightEye, static_cast<int>(delta));
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2014-08-17 03:57:26 +02:00
|
|
|
struct MagicEffect
|
|
|
|
{
|
|
|
|
int mPositiveEffect;
|
|
|
|
int mNegativeEffect;
|
|
|
|
};
|
|
|
|
|
2010-07-26 23:09:37 +02:00
|
|
|
void installOpcodes(Interpreter::Interpreter& interpreter)
|
|
|
|
{
|
2013-08-06 20:38:41 -04:00
|
|
|
for (int i = 0; i < Compiler::Stats::numberOfAttributes; ++i)
|
2010-07-26 23:09:37 +02:00
|
|
|
{
|
2022-01-27 19:18:57 +00:00
|
|
|
interpreter.installSegment5<OpGetAttribute<ImplicitRef>>(Compiler::Stats::opcodeGetAttribute + i, i);
|
|
|
|
interpreter.installSegment5<OpGetAttribute<ExplicitRef>>(
|
|
|
|
Compiler::Stats::opcodeGetAttributeExplicit + i, i);
|
2010-07-28 18:27:46 +02:00
|
|
|
|
2022-01-27 19:18:57 +00:00
|
|
|
interpreter.installSegment5<OpSetAttribute<ImplicitRef>>(Compiler::Stats::opcodeSetAttribute + i, i);
|
|
|
|
interpreter.installSegment5<OpSetAttribute<ExplicitRef>>(
|
|
|
|
Compiler::Stats::opcodeSetAttributeExplicit + i, i);
|
2010-07-28 18:27:46 +02:00
|
|
|
|
2022-01-27 19:18:57 +00:00
|
|
|
interpreter.installSegment5<OpModAttribute<ImplicitRef>>(Compiler::Stats::opcodeModAttribute + i, i);
|
|
|
|
interpreter.installSegment5<OpModAttribute<ExplicitRef>>(
|
|
|
|
Compiler::Stats::opcodeModAttributeExplicit + i, i);
|
2010-07-26 23:09:37 +02:00
|
|
|
}
|
2010-07-28 18:27:46 +02:00
|
|
|
|
2013-08-06 20:38:41 -04:00
|
|
|
for (int i = 0; i < Compiler::Stats::numberOfDynamics; ++i)
|
2010-07-28 18:27:46 +02:00
|
|
|
{
|
2022-01-27 19:18:57 +00:00
|
|
|
interpreter.installSegment5<OpGetDynamic<ImplicitRef>>(Compiler::Stats::opcodeGetDynamic + i, i);
|
|
|
|
interpreter.installSegment5<OpGetDynamic<ExplicitRef>>(
|
|
|
|
Compiler::Stats::opcodeGetDynamicExplicit + i, i);
|
|
|
|
|
|
|
|
interpreter.installSegment5<OpSetDynamic<ImplicitRef>>(Compiler::Stats::opcodeSetDynamic + i, i);
|
|
|
|
interpreter.installSegment5<OpSetDynamic<ExplicitRef>>(
|
|
|
|
Compiler::Stats::opcodeSetDynamicExplicit + i, i);
|
|
|
|
|
|
|
|
interpreter.installSegment5<OpModDynamic<ImplicitRef>>(Compiler::Stats::opcodeModDynamic + i, i);
|
|
|
|
interpreter.installSegment5<OpModDynamic<ExplicitRef>>(
|
|
|
|
Compiler::Stats::opcodeModDynamicExplicit + i, i);
|
2022-09-22 21:26:05 +03:00
|
|
|
|
2022-01-27 19:18:57 +00:00
|
|
|
interpreter.installSegment5<OpModCurrentDynamic<ImplicitRef>>(
|
|
|
|
Compiler::Stats::opcodeModCurrentDynamic + i, i);
|
|
|
|
interpreter.installSegment5<OpModCurrentDynamic<ExplicitRef>>(
|
|
|
|
Compiler::Stats::opcodeModCurrentDynamicExplicit + i, i);
|
2022-09-22 21:26:05 +03:00
|
|
|
|
2022-01-27 19:18:57 +00:00
|
|
|
interpreter.installSegment5<OpGetDynamicGetRatio<ImplicitRef>>(
|
|
|
|
Compiler::Stats::opcodeGetDynamicGetRatio + i, i);
|
|
|
|
interpreter.installSegment5<OpGetDynamicGetRatio<ExplicitRef>>(
|
|
|
|
Compiler::Stats::opcodeGetDynamicGetRatioExplicit + i, i);
|
2010-07-28 18:27:46 +02:00
|
|
|
}
|
2010-10-20 11:31:42 +02:00
|
|
|
|
2013-08-06 20:38:41 -04:00
|
|
|
for (int i = 0; i < Compiler::Stats::numberOfSkills; ++i)
|
2010-10-20 11:31:42 +02:00
|
|
|
{
|
2023-06-05 21:21:30 +02:00
|
|
|
ESM::RefId id = ESM::Skill::indexToRefId(i);
|
|
|
|
interpreter.installSegment5<OpGetSkill<ImplicitRef>>(Compiler::Stats::opcodeGetSkill + i, id);
|
|
|
|
interpreter.installSegment5<OpGetSkill<ExplicitRef>>(Compiler::Stats::opcodeGetSkillExplicit + i, id);
|
2010-10-20 11:31:42 +02:00
|
|
|
|
2023-06-05 21:21:30 +02:00
|
|
|
interpreter.installSegment5<OpSetSkill<ImplicitRef>>(Compiler::Stats::opcodeSetSkill + i, id);
|
|
|
|
interpreter.installSegment5<OpSetSkill<ExplicitRef>>(Compiler::Stats::opcodeSetSkillExplicit + i, id);
|
2010-10-20 11:31:42 +02:00
|
|
|
|
2023-06-05 21:21:30 +02:00
|
|
|
interpreter.installSegment5<OpModSkill<ImplicitRef>>(Compiler::Stats::opcodeModSkill + i, id);
|
|
|
|
interpreter.installSegment5<OpModSkill<ExplicitRef>>(Compiler::Stats::opcodeModSkillExplicit + i, id);
|
2010-10-20 11:31:42 +02:00
|
|
|
}
|
2012-04-13 11:12:53 +02:00
|
|
|
|
2022-01-27 19:18:57 +00:00
|
|
|
interpreter.installSegment5<OpGetPCCrimeLevel>(Compiler::Stats::opcodeGetPCCrimeLevel);
|
|
|
|
interpreter.installSegment5<OpSetPCCrimeLevel>(Compiler::Stats::opcodeSetPCCrimeLevel);
|
|
|
|
interpreter.installSegment5<OpModPCCrimeLevel>(Compiler::Stats::opcodeModPCCrimeLevel);
|
|
|
|
|
|
|
|
interpreter.installSegment5<OpAddSpell<ImplicitRef>>(Compiler::Stats::opcodeAddSpell);
|
|
|
|
interpreter.installSegment5<OpAddSpell<ExplicitRef>>(Compiler::Stats::opcodeAddSpellExplicit);
|
|
|
|
interpreter.installSegment5<OpRemoveSpell<ImplicitRef>>(Compiler::Stats::opcodeRemoveSpell);
|
|
|
|
interpreter.installSegment5<OpRemoveSpell<ExplicitRef>>(Compiler::Stats::opcodeRemoveSpellExplicit);
|
|
|
|
interpreter.installSegment5<OpRemoveSpellEffects<ImplicitRef>>(Compiler::Stats::opcodeRemoveSpellEffects);
|
|
|
|
interpreter.installSegment5<OpRemoveSpellEffects<ExplicitRef>>(
|
|
|
|
Compiler::Stats::opcodeRemoveSpellEffectsExplicit);
|
|
|
|
interpreter.installSegment5<OpResurrect<ImplicitRef>>(Compiler::Stats::opcodeResurrect);
|
|
|
|
interpreter.installSegment5<OpResurrect<ExplicitRef>>(Compiler::Stats::opcodeResurrectExplicit);
|
|
|
|
interpreter.installSegment5<OpRemoveEffects<ImplicitRef>>(Compiler::Stats::opcodeRemoveEffects);
|
|
|
|
interpreter.installSegment5<OpRemoveEffects<ExplicitRef>>(Compiler::Stats::opcodeRemoveEffectsExplicit);
|
|
|
|
|
|
|
|
interpreter.installSegment5<OpGetSpell<ImplicitRef>>(Compiler::Stats::opcodeGetSpell);
|
|
|
|
interpreter.installSegment5<OpGetSpell<ExplicitRef>>(Compiler::Stats::opcodeGetSpellExplicit);
|
|
|
|
|
|
|
|
interpreter.installSegment3<OpPCRaiseRank<ImplicitRef>>(Compiler::Stats::opcodePCRaiseRank);
|
|
|
|
interpreter.installSegment3<OpPCLowerRank<ImplicitRef>>(Compiler::Stats::opcodePCLowerRank);
|
|
|
|
interpreter.installSegment3<OpPCJoinFaction<ImplicitRef>>(Compiler::Stats::opcodePCJoinFaction);
|
|
|
|
interpreter.installSegment3<OpPCRaiseRank<ExplicitRef>>(Compiler::Stats::opcodePCRaiseRankExplicit);
|
|
|
|
interpreter.installSegment3<OpPCLowerRank<ExplicitRef>>(Compiler::Stats::opcodePCLowerRankExplicit);
|
|
|
|
interpreter.installSegment3<OpPCJoinFaction<ExplicitRef>>(Compiler::Stats::opcodePCJoinFactionExplicit);
|
|
|
|
interpreter.installSegment3<OpGetPCRank<ImplicitRef>>(Compiler::Stats::opcodeGetPCRank);
|
|
|
|
interpreter.installSegment3<OpGetPCRank<ExplicitRef>>(Compiler::Stats::opcodeGetPCRankExplicit);
|
|
|
|
|
|
|
|
interpreter.installSegment5<OpModDisposition<ImplicitRef>>(Compiler::Stats::opcodeModDisposition);
|
|
|
|
interpreter.installSegment5<OpModDisposition<ExplicitRef>>(Compiler::Stats::opcodeModDispositionExplicit);
|
|
|
|
interpreter.installSegment5<OpSetDisposition<ImplicitRef>>(Compiler::Stats::opcodeSetDisposition);
|
|
|
|
interpreter.installSegment5<OpSetDisposition<ExplicitRef>>(Compiler::Stats::opcodeSetDispositionExplicit);
|
|
|
|
interpreter.installSegment5<OpGetDisposition<ImplicitRef>>(Compiler::Stats::opcodeGetDisposition);
|
|
|
|
interpreter.installSegment5<OpGetDisposition<ExplicitRef>>(Compiler::Stats::opcodeGetDispositionExplicit);
|
|
|
|
|
|
|
|
interpreter.installSegment5<OpGetLevel<ImplicitRef>>(Compiler::Stats::opcodeGetLevel);
|
|
|
|
interpreter.installSegment5<OpGetLevel<ExplicitRef>>(Compiler::Stats::opcodeGetLevelExplicit);
|
|
|
|
interpreter.installSegment5<OpSetLevel<ImplicitRef>>(Compiler::Stats::opcodeSetLevel);
|
|
|
|
interpreter.installSegment5<OpSetLevel<ExplicitRef>>(Compiler::Stats::opcodeSetLevelExplicit);
|
|
|
|
|
|
|
|
interpreter.installSegment5<OpGetDeadCount>(Compiler::Stats::opcodeGetDeadCount);
|
|
|
|
|
|
|
|
interpreter.installSegment3<OpGetPCFacRep<ImplicitRef>>(Compiler::Stats::opcodeGetPCFacRep);
|
|
|
|
interpreter.installSegment3<OpGetPCFacRep<ExplicitRef>>(Compiler::Stats::opcodeGetPCFacRepExplicit);
|
|
|
|
interpreter.installSegment3<OpSetPCFacRep<ImplicitRef>>(Compiler::Stats::opcodeSetPCFacRep);
|
|
|
|
interpreter.installSegment3<OpSetPCFacRep<ExplicitRef>>(Compiler::Stats::opcodeSetPCFacRepExplicit);
|
|
|
|
interpreter.installSegment3<OpModPCFacRep<ImplicitRef>>(Compiler::Stats::opcodeModPCFacRep);
|
|
|
|
interpreter.installSegment3<OpModPCFacRep<ExplicitRef>>(Compiler::Stats::opcodeModPCFacRepExplicit);
|
|
|
|
|
|
|
|
interpreter.installSegment5<OpGetCommonDisease<ImplicitRef>>(Compiler::Stats::opcodeGetCommonDisease);
|
|
|
|
interpreter.installSegment5<OpGetCommonDisease<ExplicitRef>>(
|
|
|
|
Compiler::Stats::opcodeGetCommonDiseaseExplicit);
|
|
|
|
interpreter.installSegment5<OpGetBlightDisease<ImplicitRef>>(Compiler::Stats::opcodeGetBlightDisease);
|
|
|
|
interpreter.installSegment5<OpGetBlightDisease<ExplicitRef>>(
|
|
|
|
Compiler::Stats::opcodeGetBlightDiseaseExplicit);
|
|
|
|
|
|
|
|
interpreter.installSegment5<OpGetRace<ImplicitRef>>(Compiler::Stats::opcodeGetRace);
|
|
|
|
interpreter.installSegment5<OpGetRace<ExplicitRef>>(Compiler::Stats::opcodeGetRaceExplicit);
|
|
|
|
interpreter.installSegment5<OpGetWerewolfKills>(Compiler::Stats::opcodeGetWerewolfKills);
|
|
|
|
|
|
|
|
interpreter.installSegment3<OpPcExpelled<ImplicitRef>>(Compiler::Stats::opcodePcExpelled);
|
|
|
|
interpreter.installSegment3<OpPcExpelled<ExplicitRef>>(Compiler::Stats::opcodePcExpelledExplicit);
|
|
|
|
interpreter.installSegment3<OpPcExpell<ImplicitRef>>(Compiler::Stats::opcodePcExpell);
|
|
|
|
interpreter.installSegment3<OpPcExpell<ExplicitRef>>(Compiler::Stats::opcodePcExpellExplicit);
|
|
|
|
interpreter.installSegment3<OpPcClearExpelled<ImplicitRef>>(Compiler::Stats::opcodePcClearExpelled);
|
|
|
|
interpreter.installSegment3<OpPcClearExpelled<ExplicitRef>>(Compiler::Stats::opcodePcClearExpelledExplicit);
|
|
|
|
interpreter.installSegment5<OpRaiseRank<ImplicitRef>>(Compiler::Stats::opcodeRaiseRank);
|
|
|
|
interpreter.installSegment5<OpRaiseRank<ExplicitRef>>(Compiler::Stats::opcodeRaiseRankExplicit);
|
|
|
|
interpreter.installSegment5<OpLowerRank<ImplicitRef>>(Compiler::Stats::opcodeLowerRank);
|
|
|
|
interpreter.installSegment5<OpLowerRank<ExplicitRef>>(Compiler::Stats::opcodeLowerRankExplicit);
|
|
|
|
|
|
|
|
interpreter.installSegment5<OpOnDeath<ImplicitRef>>(Compiler::Stats::opcodeOnDeath);
|
|
|
|
interpreter.installSegment5<OpOnDeath<ExplicitRef>>(Compiler::Stats::opcodeOnDeathExplicit);
|
|
|
|
interpreter.installSegment5<OpOnMurder<ImplicitRef>>(Compiler::Stats::opcodeOnMurder);
|
|
|
|
interpreter.installSegment5<OpOnMurder<ExplicitRef>>(Compiler::Stats::opcodeOnMurderExplicit);
|
|
|
|
interpreter.installSegment5<OpOnKnockout<ImplicitRef>>(Compiler::Stats::opcodeOnKnockout);
|
|
|
|
interpreter.installSegment5<OpOnKnockout<ExplicitRef>>(Compiler::Stats::opcodeOnKnockoutExplicit);
|
|
|
|
|
|
|
|
interpreter.installSegment5<OpIsWerewolf<ImplicitRef>>(Compiler::Stats::opcodeIsWerewolf);
|
|
|
|
interpreter.installSegment5<OpIsWerewolf<ExplicitRef>>(Compiler::Stats::opcodeIsWerewolfExplicit);
|
|
|
|
|
|
|
|
interpreter.installSegment5<OpSetWerewolf<ImplicitRef, true>>(Compiler::Stats::opcodeBecomeWerewolf);
|
|
|
|
interpreter.installSegment5<OpSetWerewolf<ExplicitRef, true>>(
|
|
|
|
Compiler::Stats::opcodeBecomeWerewolfExplicit);
|
|
|
|
interpreter.installSegment5<OpSetWerewolf<ImplicitRef, false>>(Compiler::Stats::opcodeUndoWerewolf);
|
|
|
|
interpreter.installSegment5<OpSetWerewolf<ExplicitRef, false>>(Compiler::Stats::opcodeUndoWerewolfExplicit);
|
|
|
|
interpreter.installSegment5<OpSetWerewolfAcrobatics<ImplicitRef>>(
|
|
|
|
Compiler::Stats::opcodeSetWerewolfAcrobatics);
|
|
|
|
interpreter.installSegment5<OpSetWerewolfAcrobatics<ExplicitRef>>(
|
|
|
|
Compiler::Stats::opcodeSetWerewolfAcrobaticsExplicit);
|
|
|
|
interpreter.installSegment5<OpGetStat<ImplicitRef>>(Compiler::Stats::opcodeGetStat);
|
|
|
|
interpreter.installSegment5<OpGetStat<ExplicitRef>>(Compiler::Stats::opcodeGetStatExplicit);
|
2014-08-17 03:57:26 +02:00
|
|
|
|
|
|
|
static const MagicEffect sMagicEffects[] = {
|
|
|
|
{ ESM::MagicEffect::ResistMagicka, ESM::MagicEffect::WeaknessToMagicka },
|
|
|
|
{ ESM::MagicEffect::ResistFire, ESM::MagicEffect::WeaknessToFire },
|
|
|
|
{ ESM::MagicEffect::ResistFrost, ESM::MagicEffect::WeaknessToFrost },
|
|
|
|
{ ESM::MagicEffect::ResistShock, ESM::MagicEffect::WeaknessToShock },
|
|
|
|
{ ESM::MagicEffect::ResistCommonDisease, ESM::MagicEffect::WeaknessToCommonDisease },
|
|
|
|
{ ESM::MagicEffect::ResistBlightDisease, ESM::MagicEffect::WeaknessToBlightDisease },
|
|
|
|
{ ESM::MagicEffect::ResistCorprusDisease, ESM::MagicEffect::WeaknessToCorprusDisease },
|
|
|
|
{ ESM::MagicEffect::ResistPoison, ESM::MagicEffect::WeaknessToPoison },
|
|
|
|
{ ESM::MagicEffect::ResistParalysis, -1 },
|
|
|
|
{ ESM::MagicEffect::ResistNormalWeapons, ESM::MagicEffect::WeaknessToNormalWeapons },
|
|
|
|
{ ESM::MagicEffect::WaterBreathing, -1 },
|
|
|
|
{ ESM::MagicEffect::Chameleon, -1 },
|
|
|
|
{ ESM::MagicEffect::WaterWalking, -1 },
|
|
|
|
{ ESM::MagicEffect::SwiftSwim, -1 },
|
|
|
|
{ ESM::MagicEffect::Jump, -1 },
|
|
|
|
{ ESM::MagicEffect::Levitate, -1 },
|
|
|
|
{ ESM::MagicEffect::Shield, -1 },
|
|
|
|
{ ESM::MagicEffect::Sound, -1 },
|
|
|
|
{ ESM::MagicEffect::Silence, -1 },
|
|
|
|
{ ESM::MagicEffect::Blind, -1 },
|
|
|
|
{ ESM::MagicEffect::Paralyze, -1 },
|
|
|
|
{ ESM::MagicEffect::Invisibility, -1 },
|
|
|
|
{ ESM::MagicEffect::FortifyAttack, -1 },
|
|
|
|
{ ESM::MagicEffect::Sanctuary, -1 },
|
|
|
|
};
|
|
|
|
|
|
|
|
for (int i = 0; i < 24; ++i)
|
|
|
|
{
|
|
|
|
int positive = sMagicEffects[i].mPositiveEffect;
|
|
|
|
int negative = sMagicEffects[i].mNegativeEffect;
|
|
|
|
|
2022-01-27 19:18:57 +00:00
|
|
|
interpreter.installSegment5<OpGetMagicEffect<ImplicitRef>>(
|
|
|
|
Compiler::Stats::opcodeGetMagicEffect + i, positive, negative);
|
|
|
|
interpreter.installSegment5<OpGetMagicEffect<ExplicitRef>>(
|
|
|
|
Compiler::Stats::opcodeGetMagicEffectExplicit + i, positive, negative);
|
2014-08-17 03:57:26 +02:00
|
|
|
|
2022-01-27 19:18:57 +00:00
|
|
|
interpreter.installSegment5<OpSetMagicEffect<ImplicitRef>>(
|
|
|
|
Compiler::Stats::opcodeSetMagicEffect + i, positive, negative);
|
|
|
|
interpreter.installSegment5<OpSetMagicEffect<ExplicitRef>>(
|
|
|
|
Compiler::Stats::opcodeSetMagicEffectExplicit + i, positive, negative);
|
2014-08-17 03:57:26 +02:00
|
|
|
|
2022-01-27 19:18:57 +00:00
|
|
|
interpreter.installSegment5<OpModMagicEffect<ImplicitRef>>(
|
|
|
|
Compiler::Stats::opcodeModMagicEffect + i, positive, negative);
|
|
|
|
interpreter.installSegment5<OpModMagicEffect<ExplicitRef>>(
|
|
|
|
Compiler::Stats::opcodeModMagicEffectExplicit + i, positive, negative);
|
2014-08-17 03:57:26 +02:00
|
|
|
}
|
2022-09-05 20:21:19 +02:00
|
|
|
|
|
|
|
interpreter.installSegment5<OpGetPCVisionBonus>(Compiler::Stats::opcodeGetPCVisionBonus);
|
|
|
|
interpreter.installSegment5<OpSetPCVisionBonus>(Compiler::Stats::opcodeSetPCVisionBonus);
|
|
|
|
interpreter.installSegment5<OpModPCVisionBonus>(Compiler::Stats::opcodeModPCVisionBonus);
|
2010-07-28 18:27:46 +02:00
|
|
|
}
|
2010-07-26 23:09:37 +02:00
|
|
|
}
|
|
|
|
}
|