mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-21 09:53:52 +00:00
added force/clearforce instructions for run and sneak
This commit is contained in:
parent
0795730a19
commit
3167ae9473
2 changed files with 96 additions and 1 deletions
|
@ -11,7 +11,10 @@
|
|||
|
||||
#include "../mwworld/player.hpp"
|
||||
|
||||
#include "../mwmechanics/npcstats.hpp"
|
||||
|
||||
#include "interpretercontext.hpp"
|
||||
#include "ref.hpp"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
|
@ -54,11 +57,71 @@ namespace MWScript
|
|||
}
|
||||
};
|
||||
|
||||
template<class R>
|
||||
class OpClearForceRun : public Interpreter::Opcode0
|
||||
{
|
||||
public:
|
||||
|
||||
virtual void execute (Interpreter::Runtime& runtime)
|
||||
{
|
||||
MWWorld::Ptr ptr = R()(runtime);
|
||||
|
||||
MWWorld::Class::get (ptr).getNpcStats (ptr).mForceRun = false;
|
||||
}
|
||||
};
|
||||
|
||||
template<class R>
|
||||
class OpForceRun : public Interpreter::Opcode0
|
||||
{
|
||||
public:
|
||||
|
||||
virtual void execute (Interpreter::Runtime& runtime)
|
||||
{
|
||||
MWWorld::Ptr ptr = R()(runtime);
|
||||
|
||||
MWWorld::Class::get (ptr).getNpcStats (ptr).mForceRun = true;
|
||||
}
|
||||
};
|
||||
|
||||
template<class R>
|
||||
class OpClearForceSneak : public Interpreter::Opcode0
|
||||
{
|
||||
public:
|
||||
|
||||
virtual void execute (Interpreter::Runtime& runtime)
|
||||
{
|
||||
MWWorld::Ptr ptr = R()(runtime);
|
||||
|
||||
MWWorld::Class::get (ptr).getNpcStats (ptr).mForceSneak = false;
|
||||
}
|
||||
};
|
||||
|
||||
template<class R>
|
||||
class OpForceSneak : public Interpreter::Opcode0
|
||||
{
|
||||
public:
|
||||
|
||||
virtual void execute (Interpreter::Runtime& runtime)
|
||||
{
|
||||
MWWorld::Ptr ptr = R()(runtime);
|
||||
|
||||
MWWorld::Class::get (ptr).getNpcStats (ptr).mForceSneak = true;
|
||||
}
|
||||
};
|
||||
|
||||
const int numberOfControls = 7;
|
||||
|
||||
const int opcodeEnable = 0x200007e;
|
||||
const int opcodeDisable = 0x2000085;
|
||||
const int opcodeToggleCollision = 0x2000130;
|
||||
const int opcodeClearForceRun = 0x2000154;
|
||||
const int opcodeClearForceRunExplicit = 0x2000155;
|
||||
const int opcodeForceRun = 0x2000156;
|
||||
const int opcodeForceRunExplicit = 0x2000157;
|
||||
const int opcodeClearForceSneak = 0x2000158;
|
||||
const int opcodeClearForceSneakExplicit = 0x2000159;
|
||||
const int opcodeForceSneak = 0x200015a;
|
||||
const int opcodeForceSneakExplicit = 0x200015b;
|
||||
|
||||
const char *controls[numberOfControls] =
|
||||
{
|
||||
|
@ -79,6 +142,16 @@ namespace MWScript
|
|||
|
||||
extensions.registerInstruction ("togglecollision", "", opcodeToggleCollision);
|
||||
extensions.registerInstruction ("tcl", "", opcodeToggleCollision);
|
||||
|
||||
extensions.registerInstruction ("clearforcerun", "", opcodeClearForceRun,
|
||||
opcodeClearForceRunExplicit);
|
||||
extensions.registerInstruction ("forcerun", "", opcodeForceRun,
|
||||
opcodeForceRunExplicit);
|
||||
|
||||
extensions.registerInstruction ("clearforcesneak", "", opcodeClearForceSneak,
|
||||
opcodeClearForceSneakExplicit);
|
||||
extensions.registerInstruction ("forcesneak", "", opcodeForceSneak,
|
||||
opcodeForceSneakExplicit);
|
||||
}
|
||||
|
||||
void installOpcodes (Interpreter::Interpreter& interpreter)
|
||||
|
@ -90,6 +163,20 @@ namespace MWScript
|
|||
}
|
||||
|
||||
interpreter.installSegment5 (opcodeToggleCollision, new OpToggleCollision);
|
||||
|
||||
interpreter.installSegment5 (opcodeClearForceRun, new OpClearForceRun<ImplicitRef>);
|
||||
interpreter.installSegment5 (opcodeForceRun, new OpForceRun<ImplicitRef>);
|
||||
interpreter.installSegment5 (opcodeClearForceSneak, new OpClearForceSneak<ImplicitRef>);
|
||||
interpreter.installSegment5 (opcodeForceSneak, new OpForceSneak<ImplicitRef>);
|
||||
|
||||
interpreter.installSegment5 (opcodeClearForceRunExplicit,
|
||||
new OpClearForceRun<ExplicitRef>);
|
||||
interpreter.installSegment5 (opcodeForceRunExplicit,
|
||||
new OpForceRun<ExplicitRef>);
|
||||
interpreter.installSegment5 (opcodeClearForceSneakExplicit,
|
||||
new OpClearForceSneak<ExplicitRef>);
|
||||
interpreter.installSegment5 (opcodeForceSneakExplicit,
|
||||
new OpForceSneak<ExplicitRef>);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -147,4 +147,12 @@ op 0x2000150: ForceGreeting, explicit reference
|
|||
op 0x2000151: ToggleFullHelp
|
||||
op 0x2000152: Goodbye
|
||||
op 0x2000153: DontSaveObject (left unimplemented)
|
||||
opcodes 0x2000154-0x3ffffff unused
|
||||
op 0x2000154: ClearForceRun
|
||||
op 0x2000155: ClearForceRun, explicit reference
|
||||
op 0x2000156: ForceRun
|
||||
op 0x2000156: ForceRun, explicit reference
|
||||
op 0x2000157: ClearForceSneak
|
||||
op 0x2000158: ClearForceSneak, explicit reference
|
||||
op 0x2000159: ForceSneak
|
||||
op 0x200015a: ForceSneak, explicit reference
|
||||
opcodes 0x200015b-0x3ffffff unused
|
||||
|
|
Loading…
Reference in a new issue