From 2506c16bf5b10095a056a8b37b102100a4292871 Mon Sep 17 00:00:00 2001 From: scrawl Date: Mon, 30 Jun 2014 17:49:01 +0200 Subject: [PATCH] Add a dummy GetStat function returning 0 (Fixes #1589) --- apps/openmw/mwscript/docs/vmformat.txt | 4 +++- apps/openmw/mwscript/statsextensions.cpp | 13 +++++++++++++ components/compiler/extensions0.cpp | 2 ++ components/compiler/opcodes.hpp | 3 +++ 4 files changed, 21 insertions(+), 1 deletion(-) diff --git a/apps/openmw/mwscript/docs/vmformat.txt b/apps/openmw/mwscript/docs/vmformat.txt index 319feee0e..8c9d6e480 100644 --- a/apps/openmw/mwscript/docs/vmformat.txt +++ b/apps/openmw/mwscript/docs/vmformat.txt @@ -403,5 +403,7 @@ op 0x200024a: OnMurder, explicit op 0x200024b: ToggleMenus op 0x200024c: Face op 0x200024d: Face, explicit +op 0x200024e: GetStat (dummy function) +op 0x200024f: GetStat (dummy function), explicit -opcodes 0x200024e-0x3ffffff unused +opcodes 0x2000250-0x3ffffff unused diff --git a/apps/openmw/mwscript/statsextensions.cpp b/apps/openmw/mwscript/statsextensions.cpp index 5c47dea0f..e54cdd09d 100644 --- a/apps/openmw/mwscript/statsextensions.cpp +++ b/apps/openmw/mwscript/statsextensions.cpp @@ -1165,6 +1165,17 @@ namespace MWScript } }; + template + class OpGetStat : public Interpreter::Opcode0 + { + public: + virtual void execute (Interpreter::Runtime& runtime) + { + // dummy + runtime.push(0); + } + }; + void installOpcodes (Interpreter::Interpreter& interpreter) { for (int i=0; i); interpreter.installSegment5 (Compiler::Stats::opcodeSetWerewolfAcrobatics, new OpSetWerewolfAcrobatics); interpreter.installSegment5 (Compiler::Stats::opcodeSetWerewolfAcrobaticsExplicit, new OpSetWerewolfAcrobatics); + interpreter.installSegment5 (Compiler::Stats::opcodeGetStat, new OpGetStat); + interpreter.installSegment5 (Compiler::Stats::opcodeGetStatExplicit, new OpGetStat); } } } diff --git a/components/compiler/extensions0.cpp b/components/compiler/extensions0.cpp index e095958d1..ef4fe4fbd 100644 --- a/components/compiler/extensions0.cpp +++ b/components/compiler/extensions0.cpp @@ -431,6 +431,8 @@ namespace Compiler extensions.registerInstruction("setlevel", "l", opcodeSetLevel, opcodeSetLevelExplicit); extensions.registerFunction("getlevel", 'l', "", opcodeGetLevel, opcodeGetLevelExplicit); + extensions.registerFunction("getstat", 'l', "c", opcodeGetStat, opcodeGetStatExplicit); + extensions.registerFunction ("getdeadcount", 'l', "c", opcodeGetDeadCount); extensions.registerFunction ("getpcfacrep", 'l', "/c", opcodeGetPCFacRep, opcodeGetPCFacRepExplicit); diff --git a/components/compiler/opcodes.hpp b/components/compiler/opcodes.hpp index 85ac578f3..9f3ed3574 100644 --- a/components/compiler/opcodes.hpp +++ b/components/compiler/opcodes.hpp @@ -410,6 +410,9 @@ namespace Compiler const int opcodeRemoveEffectsExplicit = 0x200022e; const int opcodeResurrect = 0x200022f; const int opcodeResurrectExplicit = 0x2000230; + + const int opcodeGetStat = 0x200024e; + const int opcodeGetStatExplicit = 0x200024f; } namespace Transformation