mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-26 18:35:20 +00:00
added GetInterior script function
This commit is contained in:
parent
a724de2429
commit
18b8cdce29
@ -8,6 +8,7 @@
|
|||||||
#include <components/interpreter/opcodes.hpp>
|
#include <components/interpreter/opcodes.hpp>
|
||||||
|
|
||||||
#include "../mwworld/world.hpp"
|
#include "../mwworld/world.hpp"
|
||||||
|
#include "../mwworld/player.hpp"
|
||||||
|
|
||||||
#include "interpretercontext.hpp"
|
#include "interpretercontext.hpp"
|
||||||
|
|
||||||
@ -84,9 +85,27 @@ namespace MWScript
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class OpGetInterior : public Interpreter::Opcode0
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
virtual void execute (Interpreter::Runtime& runtime)
|
||||||
|
{
|
||||||
|
InterpreterContext& context
|
||||||
|
= static_cast<InterpreterContext&> (runtime.getContext());
|
||||||
|
|
||||||
|
bool interior =
|
||||||
|
context.getWorld().getPlayer().getPlayer().getCell()->cell->data.flags &
|
||||||
|
ESM::Cell::Interior;
|
||||||
|
|
||||||
|
runtime.push (interior ? 1 : 0);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
const int opcodeCellChanged = 0x2000000;
|
const int opcodeCellChanged = 0x2000000;
|
||||||
const int opcodeCOC = 0x2000026;
|
const int opcodeCOC = 0x2000026;
|
||||||
const int opcodeCOE = 0x200008e;
|
const int opcodeCOE = 0x200008e;
|
||||||
|
const int opcodeGetInterior = 0x2000131;
|
||||||
|
|
||||||
void registerExtensions (Compiler::Extensions& extensions)
|
void registerExtensions (Compiler::Extensions& extensions)
|
||||||
{
|
{
|
||||||
@ -95,6 +114,7 @@ namespace MWScript
|
|||||||
extensions.registerInstruction ("centeroncell", "S", opcodeCOC);
|
extensions.registerInstruction ("centeroncell", "S", opcodeCOC);
|
||||||
extensions.registerInstruction ("coe", "ll", opcodeCOE);
|
extensions.registerInstruction ("coe", "ll", opcodeCOE);
|
||||||
extensions.registerInstruction ("centeronexterior", "ll", opcodeCOE);
|
extensions.registerInstruction ("centeronexterior", "ll", opcodeCOE);
|
||||||
|
extensions.registerFunction ("getinterior", 'l', "", opcodeGetInterior);
|
||||||
}
|
}
|
||||||
|
|
||||||
void installOpcodes (Interpreter::Interpreter& interpreter)
|
void installOpcodes (Interpreter::Interpreter& interpreter)
|
||||||
@ -102,6 +122,7 @@ namespace MWScript
|
|||||||
interpreter.installSegment5 (opcodeCellChanged, new OpCellChanged);
|
interpreter.installSegment5 (opcodeCellChanged, new OpCellChanged);
|
||||||
interpreter.installSegment5 (opcodeCOC, new OpCOC);
|
interpreter.installSegment5 (opcodeCOC, new OpCOC);
|
||||||
interpreter.installSegment5 (opcodeCOE, new OpCOE);
|
interpreter.installSegment5 (opcodeCOE, new OpCOE);
|
||||||
|
interpreter.installSegment5 (opcodeGetInterior, new OpGetInterior);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -102,4 +102,5 @@ op 0x20000df-0x20000f9: SetSkill, explicit reference
|
|||||||
op 0x20000fa-0x2000114: ModSkill
|
op 0x20000fa-0x2000114: ModSkill
|
||||||
op 0x2000115-0x200012f: ModSKill, explicit reference
|
op 0x2000115-0x200012f: ModSKill, explicit reference
|
||||||
op 0x2000130: ToggleCollision
|
op 0x2000130: ToggleCollision
|
||||||
opcodes 0x2000131-0x3ffffff unused
|
op 0x2000131: GetInterior
|
||||||
|
opcodes 0x2000132-0x3ffffff unused
|
||||||
|
Loading…
x
Reference in New Issue
Block a user