Add preliminary implementation of PayFine, PayFineThief and GoToJail instructions

actorid
scrawl 11 years ago
parent baf55df7a1
commit 6f9113fe88

@ -431,11 +431,10 @@ namespace MWBase
virtual bool findInteriorPositionInWorldSpace(MWWorld::CellStore* cell, Ogre::Vector3& result) = 0; virtual bool findInteriorPositionInWorldSpace(MWWorld::CellStore* cell, Ogre::Vector3& result) = 0;
/// Teleports \a ptr to the reference of \a id (e.g. DivineMarker, PrisonMarker, TempleMarker) /// Teleports \a ptr to the closest reference of \a id (e.g. DivineMarker, PrisonMarker, TempleMarker)
/// closest to \a worldPos.
/// @note id must be lower case /// @note id must be lower case
virtual void teleportToClosestMarker (const MWWorld::Ptr& ptr, virtual void teleportToClosestMarker (const MWWorld::Ptr& ptr,
const std::string& id, Ogre::Vector3 worldPos) = 0; const std::string& id) = 0;
enum DetectionType enum DetectionType
{ {

@ -10,6 +10,7 @@ namespace MWGui
MessageBoxManager::MessageBoxManager () MessageBoxManager::MessageBoxManager ()
{ {
// TODO: fMessageTimePerChar
mMessageBoxSpeed = 0.1; mMessageBoxSpeed = 0.1;
mInterMessageBoxe = NULL; mInterMessageBoxe = NULL;
mStaticMessageBox = NULL; mStaticMessageBox = NULL;

@ -287,17 +287,13 @@ namespace MWMechanics
if (!MWBase::Environment::get().getWorld()->isTeleportingEnabled()) if (!MWBase::Environment::get().getWorld()->isTeleportingEnabled())
return; return;
Ogre::Vector3 worldPos;
if (!MWBase::Environment::get().getWorld()->findInteriorPositionInWorldSpace(target.getCell(), worldPos))
worldPos = MWBase::Environment::get().getWorld()->getPlayer().getLastKnownExteriorPosition();
if (effectId == ESM::MagicEffect::DivineIntervention) if (effectId == ESM::MagicEffect::DivineIntervention)
{ {
MWBase::Environment::get().getWorld()->teleportToClosestMarker(target, "divinemarker", worldPos); MWBase::Environment::get().getWorld()->teleportToClosestMarker(target, "divinemarker");
} }
else if (effectId == ESM::MagicEffect::AlmsiviIntervention) else if (effectId == ESM::MagicEffect::AlmsiviIntervention)
{ {
MWBase::Environment::get().getWorld()->teleportToClosestMarker(target, "templemarker", worldPos); MWBase::Environment::get().getWorld()->teleportToClosestMarker(target, "templemarker");
} }
else if (effectId == ESM::MagicEffect::Mark) else if (effectId == ESM::MagicEffect::Mark)

@ -228,6 +228,7 @@ namespace MWRender
void Camera::setSneakOffset() void Camera::setSneakOffset()
{ {
// TODO: iFirstPersonSneakDelta
if(mAnimation) if(mAnimation)
mAnimation->addFirstPersonOffset(Ogre::Vector3(0.f, 0.f, -9.8f)); mAnimation->addFirstPersonOffset(Ogre::Vector3(0.f, 0.f, -9.8f));
} }

@ -372,5 +372,8 @@ op 0x2000231: GetSpellReadied
op 0x2000232: GetSpellReadied, explicit op 0x2000232: GetSpellReadied, explicit
op 0x2000233: GetPcJumping op 0x2000233: GetPcJumping
op 0x2000234: ShowRestMenu, explicit op 0x2000234: ShowRestMenu, explicit
opcodes 0x2000235-0x3ffffff unused op 0x2000235: GoToJail
op 0x2000236: PayFine
op 0x2000237: PayFineThief
opcodes 0x2000238-0x3ffffff unused

@ -762,6 +762,43 @@ namespace MWScript
} }
}; };
class OpGoToJail : public Interpreter::Opcode0
{
public:
virtual void execute (Interpreter::Runtime& runtime)
{
MWBase::World* world = MWBase::Environment::get().getWorld();
MWWorld::Ptr player = world->getPlayerPtr();
world->teleportToClosestMarker(player, "prisonmarker");
player.getClass().getNpcStats(player).setBounty(0);
// TODO: pass time, change skills, show messagebox
// TODO: move stolen items to closest evidence chest
// iDaysinPrisonMod
}
};
class OpPayFine : public Interpreter::Opcode0
{
public:
virtual void execute(Interpreter::Runtime &runtime)
{
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
player.getClass().getNpcStats(player).setBounty(0);
// TODO: move stolen items to closest evidence chest
}
};
class OpPayFineThief : public Interpreter::Opcode0
{
public:
virtual void execute(Interpreter::Runtime &runtime)
{
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
player.getClass().getNpcStats(player).setBounty(0);
}
};
void installOpcodes (Interpreter::Interpreter& interpreter) void installOpcodes (Interpreter::Interpreter& interpreter)
{ {
interpreter.installSegment5 (Compiler::Misc::opcodeXBox, new OpXBox); interpreter.installSegment5 (Compiler::Misc::opcodeXBox, new OpXBox);
@ -785,6 +822,9 @@ namespace MWScript
interpreter.installSegment5 (Compiler::Misc::opcodeGetPcJumping, new OpGetPcJumping); interpreter.installSegment5 (Compiler::Misc::opcodeGetPcJumping, new OpGetPcJumping);
interpreter.installSegment5 (Compiler::Misc::opcodeWakeUpPc, new OpWakeUpPc); interpreter.installSegment5 (Compiler::Misc::opcodeWakeUpPc, new OpWakeUpPc);
interpreter.installSegment5 (Compiler::Misc::opcodePlayBink, new OpPlayBink); interpreter.installSegment5 (Compiler::Misc::opcodePlayBink, new OpPlayBink);
interpreter.installSegment5 (Compiler::Misc::opcodePayFine, new OpPayFine);
interpreter.installSegment5 (Compiler::Misc::opcodePayFineThief, new OpPayFineThief);
interpreter.installSegment5 (Compiler::Misc::opcodeGoToJail, new OpGoToJail);
interpreter.installSegment5 (Compiler::Misc::opcodeGetLocked, new OpGetLocked<ImplicitRef>); interpreter.installSegment5 (Compiler::Misc::opcodeGetLocked, new OpGetLocked<ImplicitRef>);
interpreter.installSegment5 (Compiler::Misc::opcodeGetLockedExplicit, new OpGetLocked<ExplicitRef>); interpreter.installSegment5 (Compiler::Misc::opcodeGetLockedExplicit, new OpGetLocked<ExplicitRef>);
interpreter.installSegment5 (Compiler::Misc::opcodeGetEffect, new OpGetEffect<ImplicitRef>); interpreter.installSegment5 (Compiler::Misc::opcodeGetEffect, new OpGetEffect<ImplicitRef>);

@ -2273,6 +2273,8 @@ namespace MWWorld
bool World::findInteriorPositionInWorldSpace(MWWorld::CellStore* cell, Ogre::Vector3& result) bool World::findInteriorPositionInWorldSpace(MWWorld::CellStore* cell, Ogre::Vector3& result)
{ {
if (cell->isExterior())
return false;
MWWorld::CellRefList<ESM::Door>& doors = cell->mDoors; MWWorld::CellRefList<ESM::Door>& doors = cell->mDoors;
CellRefList<ESM::Door>::List& refList = doors.mList; CellRefList<ESM::Door>::List& refList = doors.mList;
@ -2293,8 +2295,12 @@ namespace MWWorld
} }
void World::teleportToClosestMarker (const MWWorld::Ptr& ptr, void World::teleportToClosestMarker (const MWWorld::Ptr& ptr,
const std::string& id, Ogre::Vector3 worldPos) const std::string& id)
{ {
Ogre::Vector3 worldPos;
if (!findInteriorPositionInWorldSpace(ptr.getCell(), worldPos))
worldPos = mPlayer->getLastKnownExteriorPosition();
MWWorld::Ptr closestMarker; MWWorld::Ptr closestMarker;
float closestDistance = FLT_MAX; float closestDistance = FLT_MAX;

@ -522,11 +522,10 @@ namespace MWWorld
virtual bool findInteriorPositionInWorldSpace(MWWorld::CellStore* cell, Ogre::Vector3& result); virtual bool findInteriorPositionInWorldSpace(MWWorld::CellStore* cell, Ogre::Vector3& result);
/// Teleports \a ptr to the reference of \a id (e.g. DivineMarker, PrisonMarker, TempleMarker) /// Teleports \a ptr to the closest reference of \a id (e.g. DivineMarker, PrisonMarker, TempleMarker)
/// closest to \a worldPos.
/// @note id must be lower case /// @note id must be lower case
virtual void teleportToClosestMarker (const MWWorld::Ptr& ptr, virtual void teleportToClosestMarker (const MWWorld::Ptr& ptr,
const std::string& id, Ogre::Vector3 worldPos); const std::string& id);
/// List all references (filtered by \a type) detected by \a ptr. The range /// List all references (filtered by \a type) detected by \a ptr. The range
/// is determined by the current magnitude of the "Detect X" magic effect belonging to \a type. /// is determined by the current magnitude of the "Detect X" magic effect belonging to \a type.

@ -244,6 +244,9 @@ namespace Compiler
extensions.registerFunction ("getpcjumping", 'l', "", opcodeGetPcJumping); extensions.registerFunction ("getpcjumping", 'l', "", opcodeGetPcJumping);
extensions.registerInstruction ("wakeuppc", "", opcodeWakeUpPc); extensions.registerInstruction ("wakeuppc", "", opcodeWakeUpPc);
extensions.registerInstruction ("playbink", "Sl", opcodePlayBink); extensions.registerInstruction ("playbink", "Sl", opcodePlayBink);
extensions.registerInstruction ("payfine", "", opcodePayFine);
extensions.registerInstruction ("payfinethief", "", opcodePayFineThief);
extensions.registerInstruction ("gotojail", "", opcodeGoToJail);
extensions.registerFunction ("getlocked", 'l', "", opcodeGetLocked, opcodeGetLockedExplicit); extensions.registerFunction ("getlocked", 'l', "", opcodeGetLocked, opcodeGetLockedExplicit);
extensions.registerFunction ("geteffect", 'l', "S", opcodeGetEffect, opcodeGetEffectExplicit); extensions.registerFunction ("geteffect", 'l', "S", opcodeGetEffect, opcodeGetEffectExplicit);
extensions.registerInstruction ("addsoulgem", "cc", opcodeAddSoulGem, opcodeAddSoulGemExplicit); extensions.registerInstruction ("addsoulgem", "cc", opcodeAddSoulGem, opcodeAddSoulGemExplicit);

@ -223,6 +223,9 @@ namespace Compiler
const int opcodeGetStandingActorExplicit = 0x200020f; const int opcodeGetStandingActorExplicit = 0x200020f;
const int opcodeGetWindSpeed = 0x2000212; const int opcodeGetWindSpeed = 0x2000212;
const int opcodePlayBink = 0x20001f7; const int opcodePlayBink = 0x20001f7;
const int opcodeGoToJail = 0x2000235;
const int opcodePayFine = 0x2000236;
const int opcodePayFineThief = 0x2000237;
const int opcodeHitOnMe = 0x2000213; const int opcodeHitOnMe = 0x2000213;
const int opcodeHitOnMeExplicit = 0x2000214; const int opcodeHitOnMeExplicit = 0x2000214;
const int opcodeDisableTeleporting = 0x2000215; const int opcodeDisableTeleporting = 0x2000215;

Loading…
Cancel
Save