From 9193f3b0aea4047551cce8e20bd947f7e52a8bc3 Mon Sep 17 00:00:00 2001 From: Marc Zinnschlag Date: Fri, 16 Nov 2012 13:32:40 +0100 Subject: [PATCH] implemented getCommon/BlightDisease script instructions --- apps/openmw/mwscript/docs/vmformat.txt | 10 ++++-- apps/openmw/mwscript/statsextensions.cpp | 40 ++++++++++++++++++++++++ 2 files changed, 47 insertions(+), 3 deletions(-) diff --git a/apps/openmw/mwscript/docs/vmformat.txt b/apps/openmw/mwscript/docs/vmformat.txt index 4ec9cfb99..5a939b5db 100644 --- a/apps/openmw/mwscript/docs/vmformat.txt +++ b/apps/openmw/mwscript/docs/vmformat.txt @@ -204,9 +204,9 @@ op 0x2000197: Position Explicit op 0x2000198: PositionCell op 0x2000199: PositionCell Explicit op 0x200019a: PlaceItemCell -op 0x200019b: PlaceItem +op 0x200019b: PlaceItem op 0x200019c: PlaceAtPc -op 0x200019d: PlaceAtMe +op 0x200019d: PlaceAtMe op 0x200019e: PlaceAtMe Explicit op 0x200019f: GetPcSleep op 0x20001a0: ShowMap @@ -217,5 +217,9 @@ op 0x20001a4: SetDisposition op 0x20001a5: SetDisposition, Explicit op 0x20001a6: GetDisposition op 0x20001a7: GetDisposition, Explicit -opcodes 0x20001a8-0x3ffffff unused +op 0x20001a8: CommonDisease +op 0x20001a9: CommonDisease, explicit reference +op 0x20001aa: BlightDisease +op 0x20001ab: BlightDisease, explicit reference +opcodes 0x20001ac-0x3ffffff unused diff --git a/apps/openmw/mwscript/statsextensions.cpp b/apps/openmw/mwscript/statsextensions.cpp index 9bd517ba6..f6a31dd7f 100644 --- a/apps/openmw/mwscript/statsextensions.cpp +++ b/apps/openmw/mwscript/statsextensions.cpp @@ -754,6 +754,32 @@ namespace MWScript } }; + template + class OpGetCommonDisease : public Interpreter::Opcode0 + { + public: + + virtual void execute (Interpreter::Runtime& runtime) + { + MWWorld::Ptr ptr = R()(runtime); + + runtime.push (MWWorld::Class::get (ptr).getCreatureStats (ptr).hasCommonDisease()); + } + }; + + template + class OpGetBlightDisease : public Interpreter::Opcode0 + { + public: + + virtual void execute (Interpreter::Runtime& runtime) + { + MWWorld::Ptr ptr = R()(runtime); + + runtime.push (MWWorld::Class::get (ptr).getCreatureStats (ptr).hasBlightDisease()); + } + }; + const int numberOfAttributes = 8; @@ -819,6 +845,10 @@ namespace MWScript const int opcodeModPCFacRep = 0x20016; const int opcodeModPCFacRepExplicit = 0x20017; + const int opcodeGetCommonDisease = 0x20001a8; + const int opcodeGetCommonDiseaseExplicit = 0x20001a9; + const int opcodeGetBlightDisease = 0x20001aa; + const int opcodeGetBlightDiseaseExplicit = 0x20001ab; void registerExtensions (Compiler::Extensions& extensions) { @@ -915,6 +945,11 @@ namespace MWScript extensions.registerFunction ("getpcfacrep", 'l', "/c", opcodeGetPCFacRep, opcodeGetPCFacRepExplicit); extensions.registerInstruction ("setpcfacrep", "l/c", opcodeSetPCFacRep, opcodeSetPCFacRepExplicit); extensions.registerInstruction ("modpcfacrep", "l/c", opcodeModPCFacRep, opcodeModPCFacRepExplicit); + + extensions.registerFunction ("getcommondisease", 'l', "", opcodeGetCommonDisease, + opcodeGetCommonDiseaseExplicit); + extensions.registerFunction ("getblightdisease", 'l', "", opcodeGetBlightDisease, + opcodeGetBlightDiseaseExplicit); } void installOpcodes (Interpreter::Interpreter& interpreter) @@ -1005,6 +1040,11 @@ namespace MWScript interpreter.installSegment3 (opcodeSetPCFacRepExplicit, new OpSetPCFacRep); interpreter.installSegment3 (opcodeModPCFacRep, new OpModPCFacRep); interpreter.installSegment3 (opcodeModPCFacRepExplicit, new OpModPCFacRep); + + interpreter.installSegment5 (opcodeGetCommonDisease, new OpGetCommonDisease); + interpreter.installSegment5 (opcodeGetCommonDiseaseExplicit, new OpGetCommonDisease); + interpreter.installSegment5 (opcodeGetBlightDisease, new OpGetBlightDisease); + interpreter.installSegment5 (opcodeGetBlightDiseaseExplicit, new OpGetBlightDisease); } } }