From a33ae35e9487913454e87797425307375dc8aefb Mon Sep 17 00:00:00 2001 From: scrawl Date: Fri, 13 Apr 2012 13:28:31 +0200 Subject: [PATCH 01/13] some fixes --- apps/openmw/mwrender/renderingmanager.cpp | 3 ++- apps/openmw/mwrender/terrainmaterial.cpp | 6 ++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/apps/openmw/mwrender/renderingmanager.cpp b/apps/openmw/mwrender/renderingmanager.cpp index ee60407b2..984b7ddc9 100644 --- a/apps/openmw/mwrender/renderingmanager.cpp +++ b/apps/openmw/mwrender/renderingmanager.cpp @@ -56,6 +56,8 @@ RenderingManager::RenderingManager (OEngine::Render::OgreRenderer& _rend, const const RenderSystemCapabilities* caps = Root::getSingleton().getRenderSystem()->getCapabilities(); if (caps->getNumMultiRenderTargets() < 2) Settings::Manager::setBool("shader", "Water", false); + if (!caps->isShaderProfileSupported("fp40") && !caps->isShaderProfileSupported("ps_4_0")) + Settings::Manager::setBool("enabled", "Shadows", false); // note that the order is important here if (useMRT()) @@ -108,7 +110,6 @@ RenderingManager::RenderingManager (OEngine::Render::OgreRenderer& _rend, const RenderingManager::~RenderingManager () { - //TODO: destroy mSun? delete mPlayer; delete mSkyManager; delete mDebugging; diff --git a/apps/openmw/mwrender/terrainmaterial.cpp b/apps/openmw/mwrender/terrainmaterial.cpp index 57bea5388..c69ed3a61 100644 --- a/apps/openmw/mwrender/terrainmaterial.cpp +++ b/apps/openmw/mwrender/terrainmaterial.cpp @@ -1339,7 +1339,13 @@ namespace Ogre // diffuse lighting for (int i=0; igetNumberOfLightsSupported(); ++i) + { + // shadows only for first light (directional) + if (i==0) outStream << " outputCol.rgb += litRes"<isLayerSpecularMappingEnabled()) From 226f312163593db2d46dce2c1886b8b365e03650 Mon Sep 17 00:00:00 2001 From: k1ll Date: Fri, 13 Apr 2012 17:36:31 +0200 Subject: [PATCH 02/13] Set the version in the openmw.desktop file via CMake --- CMakeLists.txt | 3 +++ files/openmw.desktop | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f3ca740af..286d0f743 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -244,6 +244,9 @@ endif (WIN32) if (${CMAKE_SYSTEM_NAME} MATCHES "Linux") configure_file(${OpenMW_SOURCE_DIR}/files/plugins.cfg.linux "${OpenMW_BINARY_DIR}/plugins.cfg") + + configure_file(${OpenMW_SOURCE_DIR}/files/openmw.desktop + "${OpenMW_BINARY_DIR}/openmw.desktop") endif() if (APPLE) diff --git a/files/openmw.desktop b/files/openmw.desktop index 8643d4b13..234f660c6 100644 --- a/files/openmw.desktop +++ b/files/openmw.desktop @@ -1,5 +1,5 @@ [Desktop Entry] -Version=0.11 +Version=${OPENMW_VERSION} Type=Application Name=OpenMW Launcher GenericName=Role Playing Game From dc2751f4ec40cec649797e76c7e002a371d965fb Mon Sep 17 00:00:00 2001 From: k1ll Date: Fri, 13 Apr 2012 17:39:46 +0200 Subject: [PATCH 03/13] Moved Build options to the top. I need this for my tar.gz packages but i think this is a good idea in general. --- CMakeLists.txt | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 286d0f743..d67d3eb5f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -27,6 +27,11 @@ configure_file ("${OpenMW_SOURCE_DIR}/Docs/mainpage.hpp.cmake" "${OpenMW_SOURCE_ option(MYGUI_STATIC "Link static build of Mygui into the binaries" FALSE) option(OGRE_STATIC "Link static build of Ogre and Ogre Plugins into the binaries" FALSE) +# Apps and tools +option(BUILD_ESMTOOL "build ESM inspector" ON) +option(BUILD_LAUNCHER "build Launcher" ON) +option(BUILD_MWINIIMPORTER "build MWiniImporter" ON) + # Sound source selection option(USE_FFMPEG "use ffmpeg for sound" OFF) option(USE_AUDIERE "use audiere for sound" OFF) @@ -416,17 +421,14 @@ add_subdirectory (components) # Apps and tools add_subdirectory( apps/openmw ) -option(BUILD_ESMTOOL "build ESM inspector" ON) if (BUILD_ESMTOOL) add_subdirectory( apps/esmtool ) endif() -option(BUILD_LAUNCHER "build Launcher inspector" ON) if (BUILD_LAUNCHER) add_subdirectory( apps/launcher ) endif() -option(BUILD_MWINIIMPORTER "build MWiniImporter inspector" ON) if (BUILD_MWINIIMPORTER) add_subdirectory( apps/mwiniimporter ) endif() From 2d6cd162966f69501ebc8c5f428f8ca4fa382400 Mon Sep 17 00:00:00 2001 From: k1ll Date: Fri, 13 Apr 2012 17:53:01 +0200 Subject: [PATCH 04/13] Now Debian Packages install the configured openmw.desktop file. --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d67d3eb5f..9969747d3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -315,7 +315,7 @@ if(DPKG_PROGRAM) endif() #Install icon and desktop file - INSTALL(FILES "${OpenMW_SOURCE_DIR}/files/openmw.desktop" DESTINATION "share/applications/" PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ COMPONENT "openmw") + INSTALL(FILES "${OpenMW_BINARY_DIR}/files/openmw.desktop" DESTINATION "share/applications/" PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ COMPONENT "openmw") INSTALL(FILES "${OpenMW_SOURCE_DIR}/apps/launcher/resources/images/openmw.png" DESTINATION "share/pixmaps/" PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ COMPONENT "openmw") #Install global configuration files From 8156e9e5c4022db029213f04e5e62eb8958dac8a Mon Sep 17 00:00:00 2001 From: k1ll Date: Fri, 13 Apr 2012 18:20:49 +0200 Subject: [PATCH 05/13] Fixed install search path for openmw.desktop. It's directly in the binary dir. --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9969747d3..442710a02 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -315,7 +315,7 @@ if(DPKG_PROGRAM) endif() #Install icon and desktop file - INSTALL(FILES "${OpenMW_BINARY_DIR}/files/openmw.desktop" DESTINATION "share/applications/" PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ COMPONENT "openmw") + INSTALL(FILES "${OpenMW_BINARY_DIR}/openmw.desktop" DESTINATION "share/applications/" PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ COMPONENT "openmw") INSTALL(FILES "${OpenMW_SOURCE_DIR}/apps/launcher/resources/images/openmw.png" DESTINATION "share/pixmaps/" PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ COMPONENT "openmw") #Install global configuration files From 52b0b28c78f1423c463cfbb390bb1a1f3f6d2161 Mon Sep 17 00:00:00 2001 From: scrawl Date: Fri, 13 Apr 2012 19:20:59 +0200 Subject: [PATCH 06/13] fixed the mygui output on console --- libs/openengine/gui/manager.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/libs/openengine/gui/manager.cpp b/libs/openengine/gui/manager.cpp index 2d84ac804..1bf8ec325 100644 --- a/libs/openengine/gui/manager.cpp +++ b/libs/openengine/gui/manager.cpp @@ -18,7 +18,6 @@ void MyGUIManager::setup(Ogre::RenderWindow *wnd, Ogre::SceneManager *mgr, bool // manager before the main gui system itself, otherwise the main // object will get the chance to spit out a few messages before we // can able to disable it. - /// \todo - can't avoid this with MyGUI 3.2? std::string theLogFile = std::string(MYGUI_PLATFORM_LOG_FILENAME); if(!logDir.empty()) @@ -26,9 +25,9 @@ void MyGUIManager::setup(Ogre::RenderWindow *wnd, Ogre::SceneManager *mgr, bool // Set up OGRE platform. We might make this more generic later. mPlatform = new OgrePlatform(); + LogManager::getInstance().setSTDOutputEnabled(logging); mPlatform->initialise(wnd, mgr, "General", theLogFile); - LogManager::getInstance().setSTDOutputEnabled(logging); // Create GUI mGui = new Gui(); From e04d127f30817dfbe02eebe9cc65f358515cfe59 Mon Sep 17 00:00:00 2001 From: scrawl Date: Sat, 14 Apr 2012 15:10:26 +0200 Subject: [PATCH 07/13] terrain shader fixes --- apps/openmw/mwrender/terrainmaterial.cpp | 68 +++++++++--------------- 1 file changed, 26 insertions(+), 42 deletions(-) diff --git a/apps/openmw/mwrender/terrainmaterial.cpp b/apps/openmw/mwrender/terrainmaterial.cpp index 331bb47e3..7ed2a703b 100644 --- a/apps/openmw/mwrender/terrainmaterial.cpp +++ b/apps/openmw/mwrender/terrainmaterial.cpp @@ -540,7 +540,6 @@ namespace Ogre params->setNamedAutoConstant("viewProjMatrix", GpuProgramParameters::ACT_VIEWPROJ_MATRIX); params->setNamedAutoConstant("lodMorph", GpuProgramParameters::ACT_CUSTOM, Terrain::LOD_MORPH_CUSTOM_PARAM); - params->setNamedAutoConstant("fogParams", GpuProgramParameters::ACT_FOG_PARAMS); if (prof->isShadowingEnabled(tt, terrain)) { @@ -576,7 +575,7 @@ namespace Ogre { params->setNamedAutoConstant("lightPosObjSpace"+StringConverter::toString(i), GpuProgramParameters::ACT_LIGHT_POSITION_OBJECT_SPACE, i); params->setNamedAutoConstant("lightDiffuseColour"+StringConverter::toString(i), GpuProgramParameters::ACT_LIGHT_DIFFUSE_COLOUR, i); - if (prof->getNumberOfLightsSupported() > 1) + if (i > 0) params->setNamedAutoConstant("lightAttenuation"+StringConverter::toString(i), GpuProgramParameters::ACT_LIGHT_ATTENUATION, i); //params->setNamedAutoConstant("lightSpecularColour"+StringConverter::toString(i), GpuProgramParameters::ACT_LIGHT_SPECULAR_COLOUR, i); } @@ -586,6 +585,7 @@ namespace Ogre params->setNamedAutoConstant("eyePosObjSpace", GpuProgramParameters::ACT_CAMERA_POSITION_OBJECT_SPACE); params->setNamedAutoConstant("fogColour", GpuProgramParameters::ACT_FOG_COLOUR); + params->setNamedAutoConstant("fogParams", GpuProgramParameters::ACT_FOG_PARAMS); if (prof->isShadowingEnabled(tt, terrain)) { @@ -813,11 +813,11 @@ namespace Ogre outStream << "out float4 oPos : POSITION,\n" - "out float4 oPosObj : COLOR \n"; + "out float4 oPosObj : TEXCOORD0 \n"; - uint texCoordSet = 0; + uint texCoordSet = 1; outStream << - ", out float4 oUVMisc : TEXCOORD" << texCoordSet++ <<" // xy = uv, z = camDepth\n"; + ", out float4 oUVMisc : COLOR0 // xy = uv, z = camDepth\n"; // layer UV's premultiplied, packed as xy/zw uint numUVSets = numLayers / 2; @@ -837,14 +837,6 @@ namespace Ogre outStream << ", out float2 lodInfo : TEXCOORD" << texCoordSet++ << "\n"; } - bool fog = terrain->getSceneManager()->getFogMode() != FOG_NONE && tt != RENDER_COMPOSITE_MAP; - if (fog) - { - outStream << - ", uniform float4 fogParams\n"; - //", out float fogVal : COLOR\n"; - } - if (prof->isShadowingEnabled(tt, terrain)) { texCoordSet = generateVpDynamicShadowsParams(texCoordSet, prof, terrain, tt, outStream); @@ -940,11 +932,11 @@ namespace Ogre outStream << "void main_fp(\n" - "float4 position : COLOR,\n"; + "float4 position : TEXCOORD0,\n"; - uint texCoordSet = 0; + uint texCoordSet = 1; outStream << - "float4 uvMisc : TEXCOORD" << texCoordSet++ << ",\n"; + "float4 uvMisc : COLOR0,\n"; // UV's premultiplied, packed as xy/zw uint maxLayers = prof->getMaxLayers(terrain); @@ -971,8 +963,8 @@ namespace Ogre if (fog) { outStream << + "uniform float4 fogParams, \n" "uniform float3 fogColour, \n"; - //"float fogVal : COLOR,\n"; } uint currentSamplerIdx = 0; @@ -991,7 +983,7 @@ namespace Ogre //"uniform float3 lightSpecularColour"<getNumberOfLightsSupported() > 1) + if (i > 0) outStream << "uniform float4 lightAttenuation"<getNumberOfLightsSupported() > 1) + if (i > 0) outStream << // pre-multiply light color with attenuation factor "d = length( lightDir"<getSceneManager()->getFogMode() != FOG_NONE && tt != RENDER_COMPOSITE_MAP; - if (fog) - { - if (terrain->getSceneManager()->getFogMode() == FOG_LINEAR) - { - outStream << - " float fogVal = saturate((oPos.z - fogParams.y) * fogParams.w);\n"; - } - else - { - outStream << - " float fogVal = saturate(1 / (exp(oPos.z * fogParams.x)));\n"; - } - outStream << - " oPosObj.w = fogVal; \n"; - } + " oPosObj.w = oPos.z;\n"; if (prof->isShadowingEnabled(tt, terrain)) generateVpDynamicShadows(prof, terrain, tt, outStream); @@ -1369,6 +1343,16 @@ namespace Ogre bool fog = terrain->getSceneManager()->getFogMode() != FOG_NONE && tt != RENDER_COMPOSITE_MAP; if (fog) { + if (terrain->getSceneManager()->getFogMode() == FOG_LINEAR) + { + outStream << + " float fogVal = saturate((position.w - fogParams.y) * fogParams.w);\n"; + } + else + { + outStream << + " float fogVal = saturate(1 / (exp(position.w * fogParams.x)));\n"; + } outStream << " outputCol.rgb = lerp(outputCol.rgb, fogColour, fogVal);\n"; } @@ -1376,7 +1360,7 @@ namespace Ogre outStream << " oColor = outputCol;\n"; if (MWRender::RenderingManager::useMRT()) outStream << - " oColor1 = float4(uvMisc.z / far, 0, 0, 1); \n"; + " oColor1 = float4(position.w / far, 0, 0, 1); \n"; outStream << "}\n"; @@ -1585,7 +1569,7 @@ namespace Ogre { uint numTextures = prof->getReceiveDynamicShadowsPSSM()->getSplitCount(); outStream << - " float camDepth = uvMisc.z;\n"; + " float camDepth = position.w;\n"; if (prof->getReceiveDynamicShadowsDepth()) { @@ -1629,8 +1613,8 @@ namespace Ogre outStream << " float fadeRange = shadowFar_fadeStart.x - shadowFar_fadeStart.y; \n" - " float fade = 1-((uvMisc.z - shadowFar_fadeStart.y) / fadeRange); \n" - " rtshadow = (uvMisc.z > shadowFar_fadeStart.x) ? 1 : ((uvMisc.z > shadowFar_fadeStart.y) ? 1-((1-rtshadow)*fade) : rtshadow); \n" + " float fade = 1-((position.w - shadowFar_fadeStart.y) / fadeRange); \n" + " rtshadow = (position.w > shadowFar_fadeStart.x) ? 1 : ((position.w > shadowFar_fadeStart.y) ? 1-((1-rtshadow)*fade) : rtshadow); \n" " rtshadow = (1-(1-rtshadow)*0.6); \n" // make the shadow a little less intensive " shadow = min(shadow, rtshadow);\n"; From fa5a1432c9817238245be20ec3ee17ec3107c3f9 Mon Sep 17 00:00:00 2001 From: scrawl Date: Sat, 14 Apr 2012 15:58:58 +0200 Subject: [PATCH 08/13] map lighting tweak, default settings tweak --- apps/openmw/mwrender/renderingmanager.cpp | 2 ++ files/settings-default.cfg | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/apps/openmw/mwrender/renderingmanager.cpp b/apps/openmw/mwrender/renderingmanager.cpp index 984b7ddc9..c1462807f 100644 --- a/apps/openmw/mwrender/renderingmanager.cpp +++ b/apps/openmw/mwrender/renderingmanager.cpp @@ -482,11 +482,13 @@ void RenderingManager::preCellChange(MWWorld::Ptr::CellStore* cell) void RenderingManager::disableLights() { mObjects.disableLights(); + sunDisable(); } void RenderingManager::enableLights() { mObjects.enableLights(); + sunEnable(); } const bool RenderingManager::useMRT() diff --git a/files/settings-default.cfg b/files/settings-default.cfg index 4d2d46fca..553a82e49 100644 --- a/files/settings-default.cfg +++ b/files/settings-default.cfg @@ -93,7 +93,7 @@ rtt size = 512 reflect terrain = true reflect statics = false reflect small statics = false -reflect actors = true +reflect actors = false reflect misc = false # Enable underwater effect. It is not resource intensive, so only disable it if you have problems. From 4b0099fb5b1c90214a14e0d387d52a2ed2668c0f Mon Sep 17 00:00:00 2001 From: scrawl Date: Sat, 14 Apr 2012 16:10:47 +0200 Subject: [PATCH 09/13] npc visibility flags fix --- apps/openmw/mwrender/npcanimation.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/apps/openmw/mwrender/npcanimation.cpp b/apps/openmw/mwrender/npcanimation.cpp index 9de5705e3..a231e8fe7 100644 --- a/apps/openmw/mwrender/npcanimation.cpp +++ b/apps/openmw/mwrender/npcanimation.cpp @@ -240,6 +240,7 @@ Ogre::Entity* NpcAnimation::insertBoundedPart(const std::string &mesh, std::stri NIFLoader::load(mesh); Entity* ent = mRend.getScene()->createEntity(mesh); + ent->setVisibilityFlags(RV_Actors); base->attachObjectToBone(bonename, ent); return ent; @@ -249,9 +250,7 @@ void NpcAnimation::insertFreePart(const std::string &mesh, const std::string suf NIFLoader::load(meshNumbered); Ogre::Entity* ent = mRend.getScene()->createEntity(meshNumbered); - - - + ent->setVisibilityFlags(RV_Actors); insert->attachObject(ent); entityparts.push_back(ent); From 45a5877b235e6e41841e83554ada94b0186b9000 Mon Sep 17 00:00:00 2001 From: gugus Date: Sun, 15 Apr 2012 12:05:46 +0200 Subject: [PATCH 10/13] implement getPCRank. Does not work yet. --- apps/openmw/mwscript/docs/vmformat.txt | 6 ++- apps/openmw/mwscript/statsextensions.cpp | 53 ++++++++++++++++++++++++ 2 files changed, 57 insertions(+), 2 deletions(-) diff --git a/apps/openmw/mwscript/docs/vmformat.txt b/apps/openmw/mwscript/docs/vmformat.txt index fda8d1954..c38ff611c 100644 --- a/apps/openmw/mwscript/docs/vmformat.txt +++ b/apps/openmw/mwscript/docs/vmformat.txt @@ -26,8 +26,10 @@ op 0x20009: LoopAnim, explicit reference op 0x2000a: Choice op 0x2000b: PCRaiseRank op 0x2000c: PCLowerRank -op x20000d: PCJoinFaction -opcodes 0x2000e-0x3ffff unused +op 0x2000d: PCJoinFaction +op 0x2000e: PCGetRank implicit +op 0x2000f: PCGetRank explicit +opcodes 0x20010-0x3ffff unused Segment 4: (not implemented yet) diff --git a/apps/openmw/mwscript/statsextensions.cpp b/apps/openmw/mwscript/statsextensions.cpp index 9d3009870..727b2d0e1 100644 --- a/apps/openmw/mwscript/statsextensions.cpp +++ b/apps/openmw/mwscript/statsextensions.cpp @@ -435,6 +435,54 @@ namespace MWScript } }; + template + class OpGetPCRank : public Interpreter::Opcode1 + { + public: + + virtual void execute (Interpreter::Runtime& runtime, unsigned int arg0) + { + MWWorld::Ptr ptr = R()(runtime); + runtime.pop(); + + std::string factionID = ""; + if(arg0 >0) + { + factionID = runtime.getStringLiteral (runtime[0].mInteger); + runtime.pop(); + } + else + { + if(MWWorld::Class::get(ptr).getNpcStats(ptr).mFactionRank.empty()) + { + //throw exception? + } + else + { + factionID = MWWorld::Class::get(ptr).getNpcStats(ptr).mFactionRank.begin()->first; + } + } + MWScript::InterpreterContext& context + = static_cast (runtime.getContext()); + MWWorld::Ptr player = context.getEnvironment().mWorld->getPlayer().getPlayer(); + if(factionID!="") + { + if(MWWorld::Class::get(player).getNpcStats(player).mFactionRank.find(factionID) != MWWorld::Class::get(player).getNpcStats(player).mFactionRank.end()) + { + runtime.push(MWWorld::Class::get(player).getNpcStats(player).mFactionRank[factionID]); + } + else + { + runtime.push(-1); + } + } + else + { + runtime.push(-1); + } + } + }; + template class OpModDisposition : public Interpreter::Opcode0 { @@ -492,6 +540,8 @@ namespace MWScript const int opcodePCRaiseRank = 0x2000b; const int opcodePCLowerRank = 0x2000c; const int opcodePCJoinFaction = 0x2000d; + const int opcodeGetPCRank = 0x2000e; + const int opcodeGetPCRankExplicit = 0x2000f; const int opcodeModDisposition = 0x200014d; const int opcodeModDispositionExplicit = 0x200014e; @@ -576,6 +626,7 @@ namespace MWScript extensions.registerInstruction("pcjoinfaction","/S",opcodePCJoinFaction); extensions.registerInstruction("moddisposition","l",opcodeModDisposition, opcodeModDispositionExplicit); + extensions.registerFunction("getpcrank",'l',"/S",opcodeGetPCRank,opcodeGetPCRankExplicit); } void installOpcodes (Interpreter::Interpreter& interpreter) @@ -645,6 +696,8 @@ namespace MWScript interpreter.installSegment3(opcodePCJoinFaction,new OpPCJoinFaction); interpreter.installSegment5(opcodeModDisposition,new OpModDisposition); interpreter.installSegment5(opcodeModDispositionExplicit,new OpModDisposition); + interpreter.installSegment3(opcodeGetPCRank,new OpGetPCRank); + interpreter.installSegment3(opcodeGetPCRankExplicit,new OpGetPCRank); } } } From f68248e0d0800d37a18afde61fa2380ec79dccd4 Mon Sep 17 00:00:00 2001 From: gugus Date: Sun, 15 Apr 2012 14:20:08 +0200 Subject: [PATCH 11/13] corrected a bug in getPCRank --- apps/openmw/mwscript/statsextensions.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/apps/openmw/mwscript/statsextensions.cpp b/apps/openmw/mwscript/statsextensions.cpp index 727b2d0e1..239f8d768 100644 --- a/apps/openmw/mwscript/statsextensions.cpp +++ b/apps/openmw/mwscript/statsextensions.cpp @@ -443,7 +443,6 @@ namespace MWScript virtual void execute (Interpreter::Runtime& runtime, unsigned int arg0) { MWWorld::Ptr ptr = R()(runtime); - runtime.pop(); std::string factionID = ""; if(arg0 >0) From c24a85848f0d162b76c320465e524883e8124d07 Mon Sep 17 00:00:00 2001 From: gugus Date: Sun, 15 Apr 2012 15:56:36 +0200 Subject: [PATCH 12/13] forceGreeting script instruction --- apps/openmw/mwscript/dialogueextensions.cpp | 17 +++++++++++++++++ apps/openmw/mwscript/docs/vmformat.txt | 3 ++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/apps/openmw/mwscript/dialogueextensions.cpp b/apps/openmw/mwscript/dialogueextensions.cpp index 0cca028e2..178485f78 100644 --- a/apps/openmw/mwscript/dialogueextensions.cpp +++ b/apps/openmw/mwscript/dialogueextensions.cpp @@ -11,6 +11,7 @@ #include "../mwdialogue/dialoguemanager.hpp" #include "interpretercontext.hpp" +#include "ref.hpp" namespace MWScript { @@ -115,12 +116,26 @@ namespace MWScript } }; + template + class OpForceGreeting : public Interpreter::Opcode0 + { + public: + + virtual void execute (Interpreter::Runtime& runtime) + { + MWWorld::Ptr ptr = R()(runtime); + MWScript::InterpreterContext& context + = static_cast (runtime.getContext()); + context.getEnvironment().mDialogueManager->startDialogue (ptr); + } + }; const int opcodeJournal = 0x2000133; const int opcodeSetJournalIndex = 0x2000134; const int opcodeGetJournalIndex = 0x2000135; const int opcodeAddTopic = 0x200013a; const int opcodeChoice = 0x2000a; + const int opcodeForceGreeting = 0x200014f; void registerExtensions (Compiler::Extensions& extensions) { @@ -129,6 +144,7 @@ namespace MWScript extensions.registerFunction ("getjournalindex", 'l', "c", opcodeGetJournalIndex); extensions.registerInstruction ("addtopic", "S" , opcodeAddTopic); extensions.registerInstruction ("choice", "/SlSlSlSlSlSlSlSlSlSlSlSlSlSlSlSl", opcodeChoice); + extensions.registerInstruction("forcegreeting","",-1,opcodeForceGreeting); } void installOpcodes (Interpreter::Interpreter& interpreter) @@ -138,6 +154,7 @@ namespace MWScript interpreter.installSegment5 (opcodeGetJournalIndex, new OpGetJournalIndex); interpreter.installSegment5 (opcodeAddTopic, new OpAddTopic); interpreter.installSegment3 (opcodeChoice,new OpChoice); + interpreter.installSegment5 (opcodeForceGreeting, new OpForceGreeting); } } diff --git a/apps/openmw/mwscript/docs/vmformat.txt b/apps/openmw/mwscript/docs/vmformat.txt index c38ff611c..9155746ed 100644 --- a/apps/openmw/mwscript/docs/vmformat.txt +++ b/apps/openmw/mwscript/docs/vmformat.txt @@ -142,4 +142,5 @@ op 0x200014b: GetSpell op 0x200014c: GetSpell, explicit reference op 0x200014d: ModDisposition op 0x200014e: ModDisposition, explicit reference -opcodes 0x200014f-0x3ffffff unused +op 0x200014f: ForceGreeting +opcodes 0x200015-0x3ffffff unused From b5d12d0723731a39ef6ce1bf61c669bf47957bc1 Mon Sep 17 00:00:00 2001 From: Marc Zinnschlag Date: Sun, 15 Apr 2012 17:08:22 +0200 Subject: [PATCH 13/13] fixed ForceGreeting --- apps/openmw/mwscript/dialogueextensions.cpp | 8 ++++++-- apps/openmw/mwscript/docs/vmformat.txt | 3 ++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/apps/openmw/mwscript/dialogueextensions.cpp b/apps/openmw/mwscript/dialogueextensions.cpp index 178485f78..fec539d3e 100644 --- a/apps/openmw/mwscript/dialogueextensions.cpp +++ b/apps/openmw/mwscript/dialogueextensions.cpp @@ -136,6 +136,7 @@ namespace MWScript const int opcodeAddTopic = 0x200013a; const int opcodeChoice = 0x2000a; const int opcodeForceGreeting = 0x200014f; + const int opcodeForceGreetingExplicit = 0x2000150; void registerExtensions (Compiler::Extensions& extensions) { @@ -144,7 +145,9 @@ namespace MWScript extensions.registerFunction ("getjournalindex", 'l', "c", opcodeGetJournalIndex); extensions.registerInstruction ("addtopic", "S" , opcodeAddTopic); extensions.registerInstruction ("choice", "/SlSlSlSlSlSlSlSlSlSlSlSlSlSlSlSl", opcodeChoice); - extensions.registerInstruction("forcegreeting","",-1,opcodeForceGreeting); + extensions.registerInstruction("forcegreeting","",opcodeForceGreeting); + extensions.registerInstruction("forcegreeting","",opcodeForceGreeting, + opcodeForceGreetingExplicit); } void installOpcodes (Interpreter::Interpreter& interpreter) @@ -154,7 +157,8 @@ namespace MWScript interpreter.installSegment5 (opcodeGetJournalIndex, new OpGetJournalIndex); interpreter.installSegment5 (opcodeAddTopic, new OpAddTopic); interpreter.installSegment3 (opcodeChoice,new OpChoice); - interpreter.installSegment5 (opcodeForceGreeting, new OpForceGreeting); + interpreter.installSegment5 (opcodeForceGreeting, new OpForceGreeting); + interpreter.installSegment5 (opcodeForceGreetingExplicit, new OpForceGreeting); } } diff --git a/apps/openmw/mwscript/docs/vmformat.txt b/apps/openmw/mwscript/docs/vmformat.txt index 9155746ed..58960aac4 100644 --- a/apps/openmw/mwscript/docs/vmformat.txt +++ b/apps/openmw/mwscript/docs/vmformat.txt @@ -143,4 +143,5 @@ op 0x200014c: GetSpell, explicit reference op 0x200014d: ModDisposition op 0x200014e: ModDisposition, explicit reference op 0x200014f: ForceGreeting -opcodes 0x200015-0x3ffffff unused +op 0x2000150: ForceGreeting, explicit reference +opcodes 0x2000151-0x3ffffff unused