mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-29 21:45:32 +00:00
Implement Disable/EnableLevitation script functions
Totally copied on Disable/EnableTeleporting implementation. Thanks KittyCat!
This commit is contained in:
parent
1363e86828
commit
496f786c2a
7 changed files with 44 additions and 2 deletions
|
@ -389,6 +389,12 @@ namespace MWBase
|
|||
/// Returns true if teleport spell effects are allowed.
|
||||
virtual bool isTeleportingEnabled() const = 0;
|
||||
|
||||
/// Enables or disables use of levitation spell effect.
|
||||
virtual void enableLevitation(bool enable) = 0;
|
||||
|
||||
/// Returns true if levitation spell effect is allowed.
|
||||
virtual bool isLevitationEnabled() const = 0;
|
||||
|
||||
/// Turn actor into werewolf or normal form.
|
||||
virtual void setWerewolf(const MWWorld::Ptr& actor, bool werewolf) = 0;
|
||||
|
||||
|
|
|
@ -352,5 +352,7 @@ op 0x200021c: SetWerewolfAcrobaticsExplicit
|
|||
op 0x200021d: ShowVars
|
||||
op 0x200021e: ShowVarsExplicit
|
||||
op 0x200021f: ToggleGodMode
|
||||
op 0x2000220: DisableLevitation
|
||||
op 0x2000221: EnableLevitation
|
||||
|
||||
opcodes 0x2000220-0x3ffffff unused
|
||||
opcodes 0x2000222-0x3ffffff unused
|
||||
|
|
|
@ -635,7 +635,18 @@ namespace MWScript
|
|||
world->enableTeleporting(Enable);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
template <bool Enable>
|
||||
class OpEnableLevitation : public Interpreter::Opcode0
|
||||
{
|
||||
public:
|
||||
|
||||
virtual void execute (Interpreter::Runtime& runtime)
|
||||
{
|
||||
MWBase::World *world = MWBase::Environment::get().getWorld();
|
||||
world->enableLevitation(Enable);
|
||||
}
|
||||
};
|
||||
|
||||
template <class R>
|
||||
class OpShowVars : public Interpreter::Opcode0
|
||||
|
@ -789,6 +800,8 @@ namespace MWScript
|
|||
interpreter.installSegment5 (Compiler::Misc::opcodeShowVars, new OpShowVars<ImplicitRef>);
|
||||
interpreter.installSegment5 (Compiler::Misc::opcodeShowVarsExplicit, new OpShowVars<ExplicitRef>);
|
||||
interpreter.installSegment5 (Compiler::Misc::opcodeToggleGodMode, new OpToggleGodMode);
|
||||
interpreter.installSegment5 (Compiler::Misc::opcodeDisableLevitation, new OpEnableLevitation<false>);
|
||||
interpreter.installSegment5 (Compiler::Misc::opcodeEnableLevitation, new OpEnableLevitation<true>);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1877,6 +1877,16 @@ namespace MWWorld
|
|||
return mTeleportEnabled;
|
||||
}
|
||||
|
||||
void World::enableLevitation(bool enable)
|
||||
{
|
||||
mLevitationEnabled = enable;
|
||||
}
|
||||
|
||||
bool World::isLevitationEnabled() const
|
||||
{
|
||||
return mLevitationEnabled;
|
||||
}
|
||||
|
||||
void World::setWerewolf(const MWWorld::Ptr& actor, bool werewolf)
|
||||
{
|
||||
MWMechanics::NpcStats& npcStats = Class::get(actor).getNpcStats(actor);
|
||||
|
|
|
@ -116,6 +116,7 @@ namespace MWWorld
|
|||
int mPlayIntro;
|
||||
|
||||
bool mTeleportEnabled;
|
||||
bool mLevitationEnabled;
|
||||
|
||||
public:
|
||||
|
||||
|
@ -438,6 +439,12 @@ namespace MWWorld
|
|||
/// Returns true if teleport spell effects are allowed.
|
||||
virtual bool isTeleportingEnabled() const;
|
||||
|
||||
/// Enables or disables use of levitation spell effect.
|
||||
virtual void enableLevitation(bool enable);
|
||||
|
||||
/// Returns true if levitation spell effect is allowed.
|
||||
virtual bool isLevitationEnabled() const;
|
||||
|
||||
virtual void setWerewolf(const MWWorld::Ptr& actor, bool werewolf);
|
||||
|
||||
virtual void applyWerewolfAcrobatics(const MWWorld::Ptr& actor);
|
||||
|
|
|
@ -260,6 +260,8 @@ namespace Compiler
|
|||
extensions.registerInstruction ("sv", "", opcodeShowVars, opcodeShowVarsExplicit);
|
||||
extensions.registerInstruction("tgm", "", opcodeToggleGodMode);
|
||||
extensions.registerInstruction("togglegodmode", "", opcodeToggleGodMode);
|
||||
extensions.registerInstruction ("disablelevitation", "", opcodeDisableLevitation);
|
||||
extensions.registerInstruction ("enablelevitation", "", opcodeEnableLevitation);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -222,6 +222,8 @@ namespace Compiler
|
|||
const int opcodeShowVars = 0x200021d;
|
||||
const int opcodeShowVarsExplicit = 0x200021e;
|
||||
const int opcodeToggleGodMode = 0x200021f;
|
||||
const int opcodeDisableLevitation = 0x2000220;
|
||||
const int opcodeEnableLevitation = 0x2000221;
|
||||
}
|
||||
|
||||
namespace Sky
|
||||
|
|
Loading…
Reference in a new issue