2010-07-05 13:15:49 +02:00
# include "miscextensions.hpp"
2013-08-13 19:18:21 -07:00
# include <cstdlib>
2020-01-03 08:45:53 +04:00
# include <iomanip>
2022-06-07 02:08:50 +03:00
# include <chrono>
2022-06-27 21:32:46 +02:00
# include <sstream>
2013-08-13 19:18:21 -07:00
2021-07-07 18:48:25 +02:00
# include <components/compiler/extensions.hpp>
2013-08-06 20:38:41 -04:00
# include <components/compiler/opcodes.hpp>
2013-08-13 04:36:20 -07:00
# include <components/compiler/locals.hpp>
2010-07-05 13:15:49 +02:00
2020-01-03 08:45:53 +04:00
# include <components/debug/debuglog.hpp>
2010-07-05 13:15:49 +02:00
# include <components/interpreter/interpreter.hpp>
# include <components/interpreter/runtime.hpp>
# include <components/interpreter/opcodes.hpp>
2020-05-17 22:34:54 +02:00
# include <components/misc/rng.hpp>
2020-12-29 21:45:59 +01:00
# include <components/misc/resourcehelpers.hpp>
# include <components/resource/resourcesystem.hpp>
2020-05-17 22:34:54 +02:00
2022-01-22 15:58:41 +01:00
# include <components/esm3/loadmgef.hpp>
# include <components/esm3/loadcrea.hpp>
2014-02-23 20:11:05 +01:00
2020-12-29 21:45:59 +01:00
# include <components/vfs/manager.hpp>
2012-04-23 15:27:03 +02:00
# include "../mwbase/environment.hpp"
2012-09-19 03:11:23 +02:00
# include "../mwbase/windowmanager.hpp"
2021-08-07 10:06:56 +02:00
# include "../mwbase/mechanicsmanager.hpp"
2013-08-13 04:36:20 -07:00
# include "../mwbase/scriptmanager.hpp"
2019-04-28 22:56:22 +03:00
# include "../mwbase/soundmanager.hpp"
2015-02-09 17:45:48 +01:00
# include "../mwbase/world.hpp"
2021-04-12 03:15:17 +02:00
# include "../mwbase/luamanager.hpp"
2012-04-23 15:27:03 +02:00
2010-08-30 12:30:34 +02:00
# include "../mwworld/class.hpp"
2014-04-05 10:26:14 -04:00
# include "../mwworld/player.hpp"
2013-01-07 18:16:50 +00:00
# include "../mwworld/containerstore.hpp"
2016-01-18 19:58:19 -06:00
# include "../mwworld/inventorystore.hpp"
2014-02-23 20:11:05 +01:00
# include "../mwworld/esmstore.hpp"
2014-07-01 21:41:23 +02:00
# include "../mwworld/cellstore.hpp"
2019-04-28 22:56:22 +03:00
# include "../mwworld/manualref.hpp"
2012-11-24 02:02:49 +01:00
2018-06-28 16:58:51 +04:00
# include "../mwmechanics/aicast.hpp"
2012-11-24 02:02:49 +01:00
# include "../mwmechanics/npcstats.hpp"
2012-11-24 02:15:55 +01:00
# include "../mwmechanics/creaturestats.hpp"
2014-01-03 04:09:52 +01:00
# include "../mwmechanics/spellcasting.hpp"
2015-08-21 21:12:39 +12:00
# include "../mwmechanics/actorutil.hpp"
2010-08-30 12:30:34 +02:00
2022-08-18 05:04:51 +03:00
# include "../mwrender/animation.hpp"
2010-12-31 19:09:25 +01:00
# include "interpretercontext.hpp"
# include "ref.hpp"
2014-12-17 01:05:32 +01:00
namespace
{
2022-05-21 01:21:55 +02:00
void addToLevList ( ESM : : LevelledListBase * list , std : : string_view itemId , int level )
2014-12-17 01:05:32 +01:00
{
2020-07-30 20:57:25 +04:00
for ( auto & levelItem : list - > mList )
2014-12-17 01:05:32 +01:00
{
2020-07-30 20:57:25 +04:00
if ( levelItem . mLevel = = level & & itemId = = levelItem . mId )
2014-12-17 01:05:32 +01:00
return ;
}
2015-02-01 00:26:06 +01:00
ESM : : LevelledListBase : : LevelItem item ;
2022-08-23 16:59:03 +02:00
item . mId = itemId ;
2014-12-17 01:05:32 +01:00
item . mLevel = level ;
list - > mList . push_back ( item ) ;
}
2022-05-21 01:21:55 +02:00
void removeFromLevList ( ESM : : LevelledListBase * list , std : : string_view itemId , int level )
2014-12-17 01:05:32 +01:00
{
// level of -1 removes all items with that itemId
2015-02-01 00:26:06 +01:00
for ( std : : vector < ESM : : LevelledListBase : : LevelItem > : : iterator it = list - > mList . begin ( ) ; it ! = list - > mList . end ( ) ; )
2014-12-17 01:05:32 +01:00
{
if ( level ! = - 1 & & it - > mLevel ! = level )
{
+ + it ;
continue ;
}
if ( Misc : : StringUtils : : ciEqual ( itemId , it - > mId ) )
it = list - > mList . erase ( it ) ;
else
+ + it ;
}
}
}
2010-07-05 13:15:49 +02:00
namespace MWScript
{
namespace Misc
{
2020-05-17 22:34:54 +02:00
class OpMenuMode : public Interpreter : : Opcode0
{
public :
2020-10-16 22:18:54 +04:00
void execute ( Interpreter : : Runtime & runtime ) override
2020-05-17 22:34:54 +02:00
{
runtime . push ( MWBase : : Environment : : get ( ) . getWindowManager ( ) - > isGuiMode ( ) ) ;
}
} ;
class OpRandom : public Interpreter : : Opcode0
{
public :
2020-10-16 22:18:54 +04:00
void execute ( Interpreter : : Runtime & runtime ) override
2020-05-17 22:34:54 +02:00
{
Interpreter : : Type_Integer limit = runtime [ 0 ] . mInteger ;
runtime . pop ( ) ;
if ( limit < 0 )
throw std : : runtime_error (
" random: argument out of range (Don't be so negative!) " ) ;
2022-03-06 21:56:02 +02:00
auto & prng = MWBase : : Environment : : get ( ) . getWorld ( ) - > getPrng ( ) ;
runtime . push ( static_cast < Interpreter : : Type_Float > ( : : Misc : : Rng : : rollDice ( limit , prng ) ) ) ; // [o, limit)
2020-05-17 22:34:54 +02:00
}
} ;
2020-05-13 21:17:08 +02:00
template < class R >
class OpStartScript : public Interpreter : : Opcode0
{
public :
2020-10-16 22:18:54 +04:00
void execute ( Interpreter : : Runtime & runtime ) override
2020-05-13 21:17:08 +02:00
{
2020-05-26 19:01:33 +02:00
MWWorld : : Ptr target = R ( ) ( runtime , false ) ;
2022-05-21 01:21:55 +02:00
std : : string_view name = runtime . getStringLiteral ( runtime [ 0 ] . mInteger ) ;
2020-05-13 21:17:08 +02:00
runtime . pop ( ) ;
MWBase : : Environment : : get ( ) . getScriptManager ( ) - > getGlobalScripts ( ) . addScript ( name , target ) ;
}
} ;
class OpScriptRunning : public Interpreter : : Opcode0
{
public :
2020-10-16 22:18:54 +04:00
void execute ( Interpreter : : Runtime & runtime ) override
2020-05-13 21:17:08 +02:00
{
2022-05-21 01:21:55 +02:00
std : : string_view name = runtime . getStringLiteral ( runtime [ 0 ] . mInteger ) ;
2020-05-13 21:17:08 +02:00
runtime . pop ( ) ;
runtime . push ( MWBase : : Environment : : get ( ) . getScriptManager ( ) - > getGlobalScripts ( ) . isRunning ( name ) ) ;
}
} ;
class OpStopScript : public Interpreter : : Opcode0
{
public :
2020-10-16 22:18:54 +04:00
void execute ( Interpreter : : Runtime & runtime ) override
2020-05-13 21:17:08 +02:00
{
2022-05-21 01:21:55 +02:00
std : : string_view name = runtime . getStringLiteral ( runtime [ 0 ] . mInteger ) ;
2020-05-13 21:17:08 +02:00
runtime . pop ( ) ;
MWBase : : Environment : : get ( ) . getScriptManager ( ) - > getGlobalScripts ( ) . removeScript ( name ) ;
}
} ;
2020-05-17 22:34:54 +02:00
class OpGetSecondsPassed : public Interpreter : : Opcode0
{
public :
2020-10-16 22:18:54 +04:00
void execute ( Interpreter : : Runtime & runtime ) override
2020-05-17 22:34:54 +02:00
{
runtime . push ( MWBase : : Environment : : get ( ) . getFrameDuration ( ) ) ;
}
} ;
2020-05-13 21:17:08 +02:00
template < class R >
class OpEnable : public Interpreter : : Opcode0
{
public :
2020-10-16 22:18:54 +04:00
void execute ( Interpreter : : Runtime & runtime ) override
2020-05-13 21:17:08 +02:00
{
MWWorld : : Ptr ptr = R ( ) ( runtime ) ;
MWBase : : Environment : : get ( ) . getWorld ( ) - > enable ( ptr ) ;
}
} ;
template < class R >
class OpDisable : public Interpreter : : Opcode0
{
public :
2020-10-16 22:18:54 +04:00
void execute ( Interpreter : : Runtime & runtime ) override
2020-05-13 21:17:08 +02:00
{
MWWorld : : Ptr ptr = R ( ) ( runtime ) ;
MWBase : : Environment : : get ( ) . getWorld ( ) - > disable ( ptr ) ;
}
} ;
template < class R >
class OpGetDisabled : public Interpreter : : Opcode0
{
public :
2020-10-16 22:18:54 +04:00
void execute ( Interpreter : : Runtime & runtime ) override
2020-05-13 21:17:08 +02:00
{
MWWorld : : Ptr ptr = R ( ) ( runtime ) ;
runtime . push ( ! ptr . getRefData ( ) . isEnabled ( ) ) ;
}
} ;
2012-09-25 02:35:50 +02:00
class OpPlayBink : public Interpreter : : Opcode0
{
public :
2020-10-16 22:18:54 +04:00
void execute ( Interpreter : : Runtime & runtime ) override
2012-09-25 02:35:50 +02:00
{
2022-08-28 17:20:49 +02:00
std : : string_view name = runtime . getStringLiteral ( runtime [ 0 ] . mInteger ) ;
2012-09-25 02:35:50 +02:00
runtime . pop ( ) ;
2015-03-06 23:19:57 +13:00
bool allowSkipping = runtime [ 0 ] . mInteger ! = 0 ;
2013-01-07 13:19:52 +01:00
runtime . pop ( ) ;
2022-05-22 09:29:03 +02:00
MWBase : : Environment : : get ( ) . getWindowManager ( ) - > playVideo ( name , allowSkipping ) ;
2012-09-25 02:35:50 +02:00
}
} ;
2012-09-19 03:11:23 +02:00
class OpGetPcSleep : public Interpreter : : Opcode0
{
public :
2020-10-16 22:18:54 +04:00
void execute ( Interpreter : : Runtime & runtime ) override
2012-09-19 03:11:23 +02:00
{
runtime . push ( MWBase : : Environment : : get ( ) . getWindowManager ( ) - > getPlayerSleeping ( ) ) ;
}
} ;
2014-01-05 19:08:12 +01:00
class OpGetPcJumping : public Interpreter : : Opcode0
{
public :
2020-10-16 22:18:54 +04:00
void execute ( Interpreter : : Runtime & runtime ) override
2014-01-05 19:08:12 +01:00
{
MWBase : : World * world = MWBase : : Environment : : get ( ) . getWorld ( ) ;
2018-09-15 19:38:21 +04:00
runtime . push ( world - > getPlayer ( ) . getJumping ( ) ) ;
2014-01-05 19:08:12 +01:00
}
} ;
2012-09-29 09:41:34 +02:00
class OpWakeUpPc : public Interpreter : : Opcode0
{
public :
2020-10-16 22:18:54 +04:00
void execute ( Interpreter : : Runtime & runtime ) override
2012-09-29 09:41:34 +02:00
{
MWBase : : Environment : : get ( ) . getWindowManager ( ) - > wakeUpPlayer ( ) ;
}
} ;
2010-07-05 13:15:49 +02:00
class OpXBox : public Interpreter : : Opcode0
{
public :
2010-08-03 22:43:53 +02:00
2020-10-16 22:18:54 +04:00
void execute ( Interpreter : : Runtime & runtime ) override
2010-07-05 13:15:49 +02:00
{
runtime . push ( 0 ) ;
2010-08-03 22:43:53 +02:00
}
2010-07-05 13:15:49 +02:00
} ;
2010-08-03 22:43:53 +02:00
2017-10-24 00:40:17 +02:00
template < class R >
2010-07-06 10:25:42 +02:00
class OpOnActivate : public Interpreter : : Opcode0
{
public :
2010-08-03 22:43:53 +02:00
2020-10-16 22:18:54 +04:00
void execute ( Interpreter : : Runtime & runtime ) override
2010-07-06 10:25:42 +02:00
{
2017-10-24 00:40:17 +02:00
MWWorld : : Ptr ptr = R ( ) ( runtime ) ;
2010-08-03 22:43:53 +02:00
2016-02-26 12:59:35 +01:00
runtime . push ( ptr . getRefData ( ) . onActivate ( ) ) ;
2010-08-03 22:43:53 +02:00
}
2010-07-06 10:25:42 +02:00
} ;
2010-08-03 22:43:53 +02:00
2014-05-28 19:23:50 +02:00
template < class R >
2010-08-05 15:52:07 +02:00
class OpActivate : public Interpreter : : Opcode0
{
public :
2020-10-16 22:18:54 +04:00
void execute ( Interpreter : : Runtime & runtime ) override
2010-08-05 15:52:07 +02:00
{
InterpreterContext & context =
static_cast < InterpreterContext & > ( runtime . getContext ( ) ) ;
2014-05-28 19:23:50 +02:00
MWWorld : : Ptr ptr = R ( ) ( runtime ) ;
2021-05-01 14:07:29 +02:00
if ( ptr . getRefData ( ) . activateByScript ( ) | | ptr . getContainerStore ( ) )
2016-02-26 12:59:35 +01:00
context . executeActivation ( ptr , MWMechanics : : getPlayer ( ) ) ;
2010-08-05 15:52:07 +02:00
}
} ;
2010-12-31 19:09:25 +01:00
template < class R >
2010-08-30 12:30:34 +02:00
class OpLock : public Interpreter : : Opcode1
{
public :
2020-10-16 22:18:54 +04:00
void execute ( Interpreter : : Runtime & runtime , unsigned int arg0 ) override
2010-08-30 12:30:34 +02:00
{
2010-12-31 19:09:25 +01:00
MWWorld : : Ptr ptr = R ( ) ( runtime ) ;
2010-08-30 12:30:34 +02:00
2014-05-25 14:13:07 +02:00
Interpreter : : Type_Integer lockLevel = ptr . getCellRef ( ) . getLockLevel ( ) ;
2014-04-23 13:02:51 -04:00
if ( lockLevel = = 0 ) { //no lock level was ever set, set to 100 as default
2014-04-23 05:19:34 -04:00
lockLevel = 100 ;
}
2010-08-30 12:30:34 +02:00
if ( arg0 = = 1 )
{
lockLevel = runtime [ 0 ] . mInteger ;
runtime . pop ( ) ;
}
2019-09-17 20:30:37 +02:00
ptr . getCellRef ( ) . lock ( lockLevel ) ;
2014-07-22 17:55:54 +02:00
// Instantly reset door to closed state
// This is done when using Lock in scripts, but not when using Lock spells.
2021-10-11 11:46:21 +00:00
if ( ptr . getType ( ) = = ESM : : Door : : sRecordId & & ! ptr . getCellRef ( ) . getTeleport ( ) )
2014-07-22 17:55:54 +02:00
{
2019-08-25 15:20:14 +02:00
MWBase : : Environment : : get ( ) . getWorld ( ) - > activateDoor ( ptr , MWWorld : : DoorState : : Idle ) ;
2014-07-22 17:55:54 +02:00
}
2010-08-30 12:30:34 +02:00
}
} ;
2010-12-31 19:09:25 +01:00
template < class R >
2010-08-30 12:30:34 +02:00
class OpUnlock : public Interpreter : : Opcode0
{
public :
2020-10-16 22:18:54 +04:00
void execute ( Interpreter : : Runtime & runtime ) override
2010-08-30 12:30:34 +02:00
{
2010-12-31 19:09:25 +01:00
MWWorld : : Ptr ptr = R ( ) ( runtime ) ;
2010-08-30 12:30:34 +02:00
2019-09-17 20:30:37 +02:00
ptr . getCellRef ( ) . unlock ( ) ;
2010-08-30 12:30:34 +02:00
}
} ;
2011-03-16 09:09:45 +01:00
class OpToggleCollisionDebug : public Interpreter : : Opcode0
{
public :
2020-10-16 22:18:54 +04:00
void execute ( Interpreter : : Runtime & runtime ) override
2011-03-16 09:09:45 +01:00
{
2011-04-26 21:38:21 +02:00
bool enabled =
2015-05-02 22:45:27 +02:00
MWBase : : Environment : : get ( ) . getWorld ( ) - > toggleRenderMode ( MWRender : : Render_CollisionDebug ) ;
2011-04-26 21:38:21 +02:00
2015-03-03 23:46:53 +01:00
runtime . getContext ( ) . report ( enabled ?
2012-02-18 16:06:03 +01:00
" Collision Mesh Rendering -> On " : " Collision Mesh Rendering -> Off " ) ;
}
} ;
2012-03-08 01:03:46 +04:00
2012-11-20 02:20:54 +01:00
class OpToggleCollisionBoxes : public Interpreter : : Opcode0
{
public :
2020-10-16 22:18:54 +04:00
void execute ( Interpreter : : Runtime & runtime ) override
2012-11-20 02:20:54 +01:00
{
bool enabled =
2017-02-08 18:50:37 +01:00
MWBase : : Environment : : get ( ) . getWorld ( ) - > toggleRenderMode ( MWRender : : Render_CollisionDebug ) ;
2012-11-20 02:20:54 +01:00
2015-03-03 23:46:53 +01:00
runtime . getContext ( ) . report ( enabled ?
2017-02-08 18:50:37 +01:00
" Collision Mesh Rendering -> On " : " Collision Mesh Rendering -> Off " ) ;
2012-11-20 02:20:54 +01:00
}
} ;
2012-02-18 16:06:03 +01:00
class OpToggleWireframe : public Interpreter : : Opcode0
{
public :
2020-10-16 22:18:54 +04:00
void execute ( Interpreter : : Runtime & runtime ) override
2012-02-18 16:06:03 +01:00
{
bool enabled =
2015-05-02 22:45:27 +02:00
MWBase : : Environment : : get ( ) . getWorld ( ) - > toggleRenderMode ( MWRender : : Render_Wireframe ) ;
2012-02-18 16:06:03 +01:00
2015-03-03 23:46:53 +01:00
runtime . getContext ( ) . report ( enabled ?
2012-02-18 16:06:03 +01:00
" Wireframe Rendering -> On " : " Wireframe Rendering -> Off " ) ;
2011-03-16 09:09:45 +01:00
}
} ;
2012-03-08 01:03:46 +04:00
2018-06-13 01:48:31 +02:00
class OpToggleBorders : public Interpreter : : Opcode0
{
public :
2020-10-16 22:18:54 +04:00
void execute ( Interpreter : : Runtime & runtime ) override
2018-06-13 01:48:31 +02:00
{
bool enabled =
MWBase : : Environment : : get ( ) . getWorld ( ) - > toggleBorders ( ) ;
runtime . getContext ( ) . report ( enabled ?
" Border Rendering -> On " : " Border Rendering -> Off " ) ;
}
} ;
2012-03-08 01:09:06 +04:00
class OpTogglePathgrid : public Interpreter : : Opcode0
2012-03-08 01:03:46 +04:00
{
public :
2020-10-16 22:18:54 +04:00
void execute ( Interpreter : : Runtime & runtime ) override
2012-03-08 01:03:46 +04:00
{
bool enabled =
2015-05-02 22:45:27 +02:00
MWBase : : Environment : : get ( ) . getWorld ( ) - > toggleRenderMode ( MWRender : : Render_Pathgrid ) ;
2012-03-08 01:03:46 +04:00
2015-03-03 23:46:53 +01:00
runtime . getContext ( ) . report ( enabled ?
2012-03-08 01:03:46 +04:00
" Path Grid rendering -> On " : " Path Grid Rendering -> Off " ) ;
}
} ;
2012-02-18 18:25:28 +01:00
class OpFadeIn : public Interpreter : : Opcode0
{
public :
2020-10-16 22:18:54 +04:00
void execute ( Interpreter : : Runtime & runtime ) override
2012-02-18 18:25:28 +01:00
{
Interpreter : : Type_Float time = runtime [ 0 ] . mFloat ;
runtime . pop ( ) ;
2012-03-08 01:03:46 +04:00
2014-12-01 19:13:04 +01:00
MWBase : : Environment : : get ( ) . getWindowManager ( ) - > fadeScreenIn ( time , false ) ;
2012-02-18 18:25:28 +01:00
}
} ;
2012-03-08 01:03:46 +04:00
2012-02-18 18:25:28 +01:00
class OpFadeOut : public Interpreter : : Opcode0
{
public :
2020-10-16 22:18:54 +04:00
void execute ( Interpreter : : Runtime & runtime ) override
2012-02-18 18:25:28 +01:00
{
Interpreter : : Type_Float time = runtime [ 0 ] . mFloat ;
runtime . pop ( ) ;
2012-03-08 01:03:46 +04:00
2014-12-01 19:13:04 +01:00
MWBase : : Environment : : get ( ) . getWindowManager ( ) - > fadeScreenOut ( time , false ) ;
2012-02-18 18:25:28 +01:00
}
} ;
2012-03-08 01:03:46 +04:00
2012-02-18 18:25:28 +01:00
class OpFadeTo : public Interpreter : : Opcode0
{
public :
2020-10-16 22:18:54 +04:00
void execute ( Interpreter : : Runtime & runtime ) override
2012-02-18 18:25:28 +01:00
{
Interpreter : : Type_Float alpha = runtime [ 0 ] . mFloat ;
runtime . pop ( ) ;
2012-03-08 01:03:46 +04:00
2012-02-18 18:25:28 +01:00
Interpreter : : Type_Float time = runtime [ 0 ] . mFloat ;
runtime . pop ( ) ;
2012-03-08 01:03:46 +04:00
2015-03-08 13:07:29 +13:00
MWBase : : Environment : : get ( ) . getWindowManager ( ) - > fadeScreenTo ( static_cast < int > ( alpha ) , time , false ) ;
2012-02-18 18:25:28 +01:00
}
} ;
2010-08-30 12:30:34 +02:00
2012-03-29 18:33:08 +02:00
class OpToggleWater : public Interpreter : : Opcode0
{
public :
2020-10-16 22:18:54 +04:00
void execute ( Interpreter : : Runtime & runtime ) override
2012-03-29 18:33:08 +02:00
{
2014-05-16 09:21:08 +02:00
runtime . getContext ( ) . report ( MWBase : : Environment : : get ( ) . getWorld ( ) - > toggleWater ( ) ? " Water -> On "
: " Water -> Off " ) ;
2012-03-29 18:33:08 +02:00
}
} ;
2014-09-30 15:53:27 +02:00
class OpToggleWorld : public Interpreter : : Opcode0
{
public :
2020-10-16 22:18:54 +04:00
void execute ( Interpreter : : Runtime & runtime ) override
2014-09-30 15:53:27 +02:00
{
runtime . getContext ( ) . report ( MWBase : : Environment : : get ( ) . getWorld ( ) - > toggleWorld ( ) ? " World -> On "
: " World -> Off " ) ;
}
} ;
2012-06-07 12:36:51 +02:00
class OpDontSaveObject : public Interpreter : : Opcode0
{
public :
2020-10-16 22:18:54 +04:00
void execute ( Interpreter : : Runtime & runtime ) override
2012-06-07 12:36:51 +02:00
{
// We are ignoring the DontSaveObject statement for now. Probably not worth
2014-04-23 05:12:07 -04:00
// bothering with. The incompatibility we are creating should be marginal at most.
2012-06-07 12:36:51 +02:00
}
} ;
2014-12-11 20:57:25 +01:00
class OpPcForce1stPerson : public Interpreter : : Opcode0
{
public :
2020-10-16 22:18:54 +04:00
void execute ( Interpreter : : Runtime & runtime ) override
2014-12-11 20:57:25 +01:00
{
if ( ! MWBase : : Environment : : get ( ) . getWorld ( ) - > isFirstPerson ( ) )
2019-09-19 21:48:43 +04:00
MWBase : : Environment : : get ( ) . getWorld ( ) - > togglePOV ( true ) ;
2014-12-11 20:57:25 +01:00
}
} ;
class OpPcForce3rdPerson : public Interpreter : : Opcode0
{
2020-10-16 22:18:54 +04:00
void execute ( Interpreter : : Runtime & runtime ) override
2014-12-11 20:57:25 +01:00
{
if ( MWBase : : Environment : : get ( ) . getWorld ( ) - > isFirstPerson ( ) )
2019-09-19 21:48:43 +04:00
MWBase : : Environment : : get ( ) . getWorld ( ) - > togglePOV ( true ) ;
2014-12-11 20:57:25 +01:00
}
} ;
class OpPcGet3rdPerson : public Interpreter : : Opcode0
{
public :
2020-10-16 22:18:54 +04:00
void execute ( Interpreter : : Runtime & runtime ) override
2014-12-11 20:57:25 +01:00
{
runtime . push ( ! MWBase : : Environment : : get ( ) . getWorld ( ) - > isFirstPerson ( ) ) ;
}
} ;
2012-08-18 18:05:10 +04:00
class OpToggleVanityMode : public Interpreter : : Opcode0
{
2012-08-19 10:37:51 +04:00
static bool sActivate ;
2012-08-18 18:05:10 +04:00
public :
2013-01-08 11:17:19 +01:00
2020-10-16 22:18:54 +04:00
void execute ( Interpreter : : Runtime & runtime ) override
2012-08-18 18:05:10 +04:00
{
MWBase : : World * world =
MWBase : : Environment : : get ( ) . getWorld ( ) ;
2013-04-27 01:24:36 -07:00
if ( world - > toggleVanityMode ( sActivate ) ) {
2015-03-03 23:46:53 +01:00
runtime . getContext ( ) . report ( sActivate ? " Vanity Mode -> On " : " Vanity Mode -> Off " ) ;
2012-08-19 10:37:51 +04:00
sActivate = ! sActivate ;
2012-08-18 18:05:10 +04:00
} else {
2015-03-03 23:46:53 +01:00
runtime . getContext ( ) . report ( " Vanity Mode -> No " ) ;
2012-08-18 18:05:10 +04:00
}
}
} ;
2012-08-19 10:37:51 +04:00
bool OpToggleVanityMode : : sActivate = true ;
2012-08-18 18:05:10 +04:00
2012-11-23 21:31:10 +01:00
template < class R >
class OpGetLocked : public Interpreter : : Opcode0
{
public :
2020-10-16 22:18:54 +04:00
void execute ( Interpreter : : Runtime & runtime ) override
2012-11-23 21:31:10 +01:00
{
MWWorld : : Ptr ptr = R ( ) ( runtime ) ;
2014-05-25 14:13:07 +02:00
runtime . push ( ptr . getCellRef ( ) . getLockLevel ( ) > 0 ) ;
2012-11-23 21:31:10 +01:00
}
} ;
2012-11-24 02:15:55 +01:00
template < class R >
class OpGetEffect : public Interpreter : : Opcode0
{
public :
2020-10-16 22:18:54 +04:00
void execute ( Interpreter : : Runtime & runtime ) override
2012-11-24 02:15:55 +01:00
{
MWWorld : : Ptr ptr = R ( ) ( runtime ) ;
2022-05-21 01:21:55 +02:00
std : : string_view effect = runtime . getStringLiteral ( runtime [ 0 ] . mInteger ) ;
2012-11-24 02:15:55 +01:00
runtime . pop ( ) ;
2019-01-06 21:04:24 +03:00
if ( ! ptr . getClass ( ) . isActor ( ) )
{
runtime . push ( 0 ) ;
return ;
}
2013-08-13 19:18:21 -07:00
char * end ;
2022-05-21 01:21:55 +02:00
long key = strtol ( effect . data ( ) , & end , 10 ) ;
2013-08-13 19:18:21 -07:00
if ( key < 0 | | key > 32767 | | * end ! = ' \0 ' )
2022-05-22 09:29:03 +02:00
key = ESM : : MagicEffect : : effectStringToId ( { effect } ) ;
2013-08-13 19:18:21 -07:00
2019-07-31 01:06:06 +03:00
const MWMechanics : : CreatureStats & stats = ptr . getClass ( ) . getCreatureStats ( ptr ) ;
2021-08-27 20:07:50 +02:00
const MWMechanics : : MagicEffects & effects = stats . getMagicEffects ( ) ;
2019-07-31 01:06:06 +03:00
2020-08-07 09:58:36 +03:00
for ( const auto & activeEffect : effects )
2015-12-03 21:12:58 +01:00
{
2020-08-07 09:58:36 +03:00
if ( activeEffect . first . mId = = key & & activeEffect . second . getModifier ( ) > 0 )
2015-12-03 21:12:58 +01:00
{
runtime . push ( 1 ) ;
return ;
}
}
runtime . push ( 0 ) ;
}
2012-11-24 02:15:55 +01:00
} ;
2013-01-07 18:16:50 +00:00
template < class R >
class OpAddSoulGem : public Interpreter : : Opcode0
2013-01-08 11:17:19 +01:00
{
2013-01-07 18:16:50 +00:00
public :
2020-10-16 22:18:54 +04:00
void execute ( Interpreter : : Runtime & runtime ) override
2013-01-08 11:17:19 +01:00
{
2013-01-07 18:16:50 +00:00
MWWorld : : Ptr ptr = R ( ) ( runtime ) ;
2022-08-27 13:07:59 +02:00
std : : string_view creature = runtime . getStringLiteral ( runtime [ 0 ] . mInteger ) ;
2013-01-07 18:16:50 +00:00
runtime . pop ( ) ;
2013-01-08 11:17:19 +01:00
2022-05-21 01:21:55 +02:00
std : : string_view gem = runtime . getStringLiteral ( runtime [ 0 ] . mInteger ) ;
2013-01-07 18:16:50 +00:00
runtime . pop ( ) ;
2013-01-08 11:17:19 +01:00
2019-04-28 22:56:22 +03:00
if ( ! ptr . getClass ( ) . hasInventoryStore ( ptr ) )
return ;
2013-01-07 21:08:04 +00:00
const MWWorld : : ESMStore & store = MWBase : : Environment : : get ( ) . getWorld ( ) - > getStore ( ) ;
store . get < ESM : : Creature > ( ) . find ( creature ) ; // This line throws an exception if it can't find the creature
2013-01-07 18:16:50 +00:00
2022-05-22 09:29:03 +02:00
MWWorld : : Ptr item = * ptr . getClass ( ) . getContainerStore ( ptr ) . add ( gem , 1 , ptr ) ;
2018-03-09 21:49:27 +04:00
// Set the soul on just one of the gems, not the whole stack
item . getContainerStore ( ) - > unstack ( item , ptr ) ;
2014-05-25 14:13:07 +02:00
item . getCellRef ( ) . setSoul ( creature ) ;
2018-03-09 21:49:27 +04:00
// Restack the gem with other gems with the same soul
item . getContainerStore ( ) - > restack ( item ) ;
2013-01-08 11:17:19 +01:00
}
2013-01-07 18:16:50 +00:00
} ;
2012-11-24 02:15:55 +01:00
2013-01-07 21:08:04 +00:00
template < class R >
2014-02-13 09:52:44 +01:00
class OpRemoveSoulGem : public Interpreter : : Opcode1
2013-01-08 11:17:19 +01:00
{
2013-01-07 21:08:04 +00:00
public :
2020-10-16 22:18:54 +04:00
void execute ( Interpreter : : Runtime & runtime , unsigned int arg0 ) override
2013-01-08 11:17:19 +01:00
{
2013-01-07 21:08:04 +00:00
MWWorld : : Ptr ptr = R ( ) ( runtime ) ;
2022-05-21 01:21:55 +02:00
std : : string_view soul = runtime . getStringLiteral ( runtime [ 0 ] . mInteger ) ;
2013-01-07 21:08:04 +00:00
runtime . pop ( ) ;
2014-02-13 09:52:44 +01:00
// throw away additional arguments
for ( unsigned int i = 0 ; i < arg0 ; + + i )
runtime . pop ( ) ;
2019-04-28 22:56:22 +03:00
if ( ! ptr . getClass ( ) . hasInventoryStore ( ptr ) )
return ;
MWWorld : : InventoryStore & store = ptr . getClass ( ) . getInventoryStore ( ptr ) ;
2014-01-14 06:13:30 +01:00
for ( MWWorld : : ContainerStoreIterator it = store . begin ( ) ; it ! = store . end ( ) ; + + it )
{
2014-05-25 14:13:07 +02:00
if ( : : Misc : : StringUtils : : ciEqual ( it - > getCellRef ( ) . getSoul ( ) , soul ) )
2014-01-14 06:13:30 +01:00
{
store . remove ( * it , 1 , ptr ) ;
return ;
}
}
2013-01-08 11:17:19 +01:00
}
2013-01-07 21:08:04 +00:00
} ;
2013-01-09 21:16:45 +00:00
template < class R >
class OpDrop : public Interpreter : : Opcode0
{
public :
2020-10-16 22:18:54 +04:00
void execute ( Interpreter : : Runtime & runtime ) override
2013-01-09 21:16:45 +00:00
{
MWWorld : : Ptr ptr = R ( ) ( runtime ) ;
2022-05-21 01:21:55 +02:00
std : : string_view item = runtime . getStringLiteral ( runtime [ 0 ] . mInteger ) ;
2013-01-09 21:16:45 +00:00
runtime . pop ( ) ;
2013-01-09 22:55:28 +00:00
Interpreter : : Type_Integer amount = runtime [ 0 ] . mInteger ;
runtime . pop ( ) ;
2013-04-06 19:25:29 +02:00
if ( amount < 0 )
throw std : : runtime_error ( " amount must be non-negative " ) ;
// no-op
if ( amount = = 0 )
return ;
2019-04-28 22:56:22 +03:00
if ( ! ptr . getClass ( ) . isActor ( ) )
return ;
2016-01-18 19:58:19 -06:00
2019-04-28 22:56:22 +03:00
if ( ptr . getClass ( ) . hasInventoryStore ( ptr ) )
{
// Prefer dropping unequipped items first; re-stack if possible by unequipping items before dropping them.
MWWorld : : InventoryStore & store = ptr . getClass ( ) . getInventoryStore ( ptr ) ;
int numNotEquipped = store . count ( item ) ;
2016-01-18 19:58:19 -06:00
for ( int slot = 0 ; slot < MWWorld : : InventoryStore : : Slots ; + + slot )
{
2019-04-28 22:56:22 +03:00
MWWorld : : ConstContainerStoreIterator it = store . getSlot ( slot ) ;
if ( it ! = store . end ( ) & & : : Misc : : StringUtils : : ciEqual ( it - > getCellRef ( ) . getRefId ( ) , item ) )
2016-01-18 19:58:19 -06:00
{
numNotEquipped - = it - > getRefData ( ) . getCount ( ) ;
}
}
2013-01-09 21:16:45 +00:00
2016-01-18 19:58:19 -06:00
for ( int slot = 0 ; slot < MWWorld : : InventoryStore : : Slots & & amount > numNotEquipped ; + + slot )
{
2019-04-28 22:56:22 +03:00
MWWorld : : ContainerStoreIterator it = store . getSlot ( slot ) ;
if ( it ! = store . end ( ) & & : : Misc : : StringUtils : : ciEqual ( it - > getCellRef ( ) . getRefId ( ) , item ) )
2016-01-18 19:58:19 -06:00
{
2019-04-28 22:56:22 +03:00
int numToRemove = std : : min ( amount - numNotEquipped , it - > getRefData ( ) . getCount ( ) ) ;
store . unequipItemQuantity ( * it , ptr , numToRemove ) ;
2016-01-18 19:58:19 -06:00
numNotEquipped + = numToRemove ;
}
}
2013-01-09 21:16:45 +00:00
2019-04-28 22:56:22 +03:00
for ( MWWorld : : ContainerStoreIterator iter ( store . begin ( ) ) ; iter ! = store . end ( ) ; + + iter )
2013-01-09 21:16:45 +00:00
{
2019-04-28 22:56:22 +03:00
if ( : : Misc : : StringUtils : : ciEqual ( iter - > getCellRef ( ) . getRefId ( ) , item ) & & ! store . isEquipped ( * iter ) )
{
int removed = store . remove ( * iter , amount , ptr ) ;
MWWorld : : Ptr dropped = MWBase : : Environment : : get ( ) . getWorld ( ) - > dropObjectOnGround ( ptr , * iter , removed ) ;
dropped . getCellRef ( ) . setOwner ( " " ) ;
2013-01-09 22:55:28 +00:00
2019-04-28 22:56:22 +03:00
amount - = removed ;
2013-08-13 01:19:33 +02:00
2019-04-28 22:56:22 +03:00
if ( amount < = 0 )
break ;
}
}
}
MWWorld : : ManualRef ref ( MWBase : : Environment : : get ( ) . getWorld ( ) - > getStore ( ) , item , 1 ) ;
MWWorld : : Ptr itemPtr ( ref . getPtr ( ) ) ;
if ( amount > 0 )
{
if ( itemPtr . getClass ( ) . getScript ( itemPtr ) . empty ( ) )
{
MWBase : : Environment : : get ( ) . getWorld ( ) - > dropObjectOnGround ( ptr , itemPtr , amount ) ;
}
else
{
// Dropping one item per time to prevent making stacks of scripted items
for ( int i = 0 ; i < amount ; i + + )
MWBase : : Environment : : get ( ) . getWorld ( ) - > dropObjectOnGround ( ptr , itemPtr , 1 ) ;
2013-01-09 21:16:45 +00:00
}
}
2019-04-28 22:56:22 +03:00
MWBase : : Environment : : get ( ) . getSoundManager ( ) - > playSound3D ( ptr , itemPtr . getClass ( ) . getDownSoundId ( itemPtr ) , 1.f , 1.f ) ;
2013-01-09 21:16:45 +00:00
}
} ;
template < class R >
class OpDropSoulGem : public Interpreter : : Opcode0
{
public :
2020-10-16 22:18:54 +04:00
void execute ( Interpreter : : Runtime & runtime ) override
2013-01-09 21:16:45 +00:00
{
MWWorld : : Ptr ptr = R ( ) ( runtime ) ;
2022-05-21 01:21:55 +02:00
std : : string_view soul = runtime . getStringLiteral ( runtime [ 0 ] . mInteger ) ;
2013-01-09 21:16:45 +00:00
runtime . pop ( ) ;
2019-04-28 22:56:22 +03:00
if ( ! ptr . getClass ( ) . hasInventoryStore ( ptr ) )
return ;
2013-01-09 21:16:45 +00:00
2019-04-28 22:56:22 +03:00
MWWorld : : InventoryStore & store = ptr . getClass ( ) . getInventoryStore ( ptr ) ;
2013-01-09 21:16:45 +00:00
for ( MWWorld : : ContainerStoreIterator iter ( store . begin ( ) ) ; iter ! = store . end ( ) ; + + iter )
{
2014-05-25 14:13:07 +02:00
if ( : : Misc : : StringUtils : : ciEqual ( iter - > getCellRef ( ) . getSoul ( ) , soul ) )
2013-01-09 21:16:45 +00:00
{
2013-08-13 01:19:33 +02:00
MWBase : : Environment : : get ( ) . getWorld ( ) - > dropObjectOnGround ( ptr , * iter , 1 ) ;
store . remove ( * iter , 1 , ptr ) ;
2013-01-09 21:16:45 +00:00
break ;
}
}
}
} ;
2012-11-24 02:48:53 +01:00
template < class R >
class OpGetAttacked : public Interpreter : : Opcode0
{
public :
2020-10-16 22:18:54 +04:00
void execute ( Interpreter : : Runtime & runtime ) override
2012-11-24 02:48:53 +01:00
{
MWWorld : : Ptr ptr = R ( ) ( runtime ) ;
2014-05-22 20:37:22 +02:00
runtime . push ( ptr . getClass ( ) . getCreatureStats ( ptr ) . getAttacked ( ) ) ;
2012-11-24 02:48:53 +01:00
}
} ;
2012-11-24 03:04:26 +01:00
template < class R >
class OpGetWeaponDrawn : public Interpreter : : Opcode0
{
public :
2020-10-16 22:18:54 +04:00
void execute ( Interpreter : : Runtime & runtime ) override
2012-11-24 03:04:26 +01:00
{
MWWorld : : Ptr ptr = R ( ) ( runtime ) ;
2022-08-18 05:04:51 +03:00
auto & cls = ptr . getClass ( ) ;
if ( ! cls . hasInventoryStore ( ptr ) & & ! cls . isBipedal ( ptr ) )
{
runtime . push ( 0 ) ;
return ;
}
if ( cls . getCreatureStats ( ptr ) . getDrawState ( ) ! = MWMechanics : : DrawState : : Weapon )
{
runtime . push ( 0 ) ;
return ;
}
2012-11-24 03:04:26 +01:00
2022-08-18 05:04:51 +03:00
MWRender : : Animation * anim = MWBase : : Environment : : get ( ) . getWorld ( ) - > getAnimation ( ptr ) ;
runtime . push ( anim & & anim - > getWeaponsShown ( ) ) ;
2014-01-03 22:55:17 +01:00
}
} ;
template < class R >
class OpGetSpellReadied : public Interpreter : : Opcode0
{
public :
2020-10-16 22:18:54 +04:00
void execute ( Interpreter : : Runtime & runtime ) override
2014-01-03 22:55:17 +01:00
{
MWWorld : : Ptr ptr = R ( ) ( runtime ) ;
2022-07-17 19:36:48 +03:00
runtime . push ( ptr . getClass ( ) . getCreatureStats ( ptr ) . getDrawState ( ) = = MWMechanics : : DrawState : : Spell ) ;
2012-11-24 03:04:26 +01:00
}
} ;
2012-11-25 01:26:29 +01:00
template < class R >
class OpGetSpellEffects : public Interpreter : : Opcode0
{
public :
2020-10-16 22:18:54 +04:00
void execute ( Interpreter : : Runtime & runtime ) override
2012-11-25 01:26:29 +01:00
{
MWWorld : : Ptr ptr = R ( ) ( runtime ) ;
2022-05-21 01:21:55 +02:00
std : : string_view id = runtime . getStringLiteral ( runtime [ 0 ] . mInteger ) ;
2012-11-25 01:26:29 +01:00
runtime . pop ( ) ;
2019-01-06 21:04:24 +03:00
if ( ! ptr . getClass ( ) . isActor ( ) )
{
runtime . push ( 0 ) ;
return ;
}
2015-05-10 13:04:50 +02:00
const MWMechanics : : CreatureStats & stats = ptr . getClass ( ) . getCreatureStats ( ptr ) ;
2021-08-27 20:07:50 +02:00
runtime . push ( stats . getActiveSpells ( ) . isSpellActive ( id ) ) ;
2012-11-25 01:26:29 +01:00
}
} ;
2012-11-25 01:54:37 +01:00
class OpGetCurrentTime : public Interpreter : : Opcode0
{
public :
2020-10-16 22:18:54 +04:00
void execute ( Interpreter : : Runtime & runtime ) override
2012-11-25 01:54:37 +01:00
{
runtime . push ( MWBase : : Environment : : get ( ) . getWorld ( ) - > getTimeStamp ( ) . getHour ( ) ) ;
}
} ;
2012-11-27 06:54:13 +01:00
template < class R >
class OpSetDelete : public Interpreter : : Opcode0
{
public :
2020-10-16 22:18:54 +04:00
void execute ( Interpreter : : Runtime & runtime ) override
2012-11-27 06:54:13 +01:00
{
MWWorld : : Ptr ptr = R ( ) ( runtime ) ;
2012-11-28 01:30:18 +01:00
int parameter = runtime [ 0 ] . mInteger ;
runtime . pop ( ) ;
if ( parameter = = 1 )
2013-10-16 18:39:29 +02:00
MWBase : : Environment : : get ( ) . getWorld ( ) - > deleteObject ( ptr ) ;
2014-12-06 21:08:18 +01:00
else if ( parameter = = 0 )
MWBase : : Environment : : get ( ) . getWorld ( ) - > undeleteObject ( ptr ) ;
else
throw std : : runtime_error ( " SetDelete: unexpected parameter " ) ;
2012-11-27 06:54:13 +01:00
}
} ;
class OpGetSquareRoot : public Interpreter : : Opcode0
{
public :
2020-10-16 22:18:54 +04:00
void execute ( Interpreter : : Runtime & runtime ) override
2012-11-27 06:54:13 +01:00
{
float param = runtime [ 0 ] . mFloat ;
runtime . pop ( ) ;
2021-09-19 19:53:38 +02:00
if ( param < 0 )
throw std : : runtime_error ( " square root of negative number (we aren't that imaginary) " ) ;
2012-11-27 06:54:13 +01:00
runtime . push ( std : : sqrt ( param ) ) ;
}
} ;
2013-04-28 11:13:21 +02:00
template < class R >
class OpFall : public Interpreter : : Opcode0
{
public :
2020-10-16 22:18:54 +04:00
void execute ( Interpreter : : Runtime & runtime ) override
2013-04-28 11:13:21 +02:00
{
}
} ;
2013-05-01 11:15:43 +02:00
template < class R >
class OpGetStandingPc : public Interpreter : : Opcode0
{
public :
2020-10-16 22:18:54 +04:00
void execute ( Interpreter : : Runtime & runtime ) override
2013-05-01 11:15:43 +02:00
{
MWWorld : : Ptr ptr = R ( ) ( runtime ) ;
runtime . push ( MWBase : : Environment : : get ( ) . getWorld ( ) - > getPlayerStandingOn ( ptr ) ) ;
}
} ;
template < class R >
class OpGetStandingActor : public Interpreter : : Opcode0
{
public :
2020-10-16 22:18:54 +04:00
void execute ( Interpreter : : Runtime & runtime ) override
2013-05-01 11:15:43 +02:00
{
MWWorld : : Ptr ptr = R ( ) ( runtime ) ;
runtime . push ( MWBase : : Environment : : get ( ) . getWorld ( ) - > getActorStandingOn ( ptr ) ) ;
}
} ;
2014-07-29 19:01:40 +02:00
template < class R >
class OpGetCollidingPc : public Interpreter : : Opcode0
{
public :
2020-10-16 22:18:54 +04:00
void execute ( Interpreter : : Runtime & runtime ) override
2014-07-29 19:01:40 +02:00
{
MWWorld : : Ptr ptr = R ( ) ( runtime ) ;
2014-09-26 14:16:46 +02:00
runtime . push ( MWBase : : Environment : : get ( ) . getWorld ( ) - > getPlayerCollidingWith ( ptr ) ) ;
2014-07-29 19:01:40 +02:00
}
} ;
template < class R >
class OpGetCollidingActor : public Interpreter : : Opcode0
{
public :
2020-10-16 22:18:54 +04:00
void execute ( Interpreter : : Runtime & runtime ) override
2014-07-29 19:01:40 +02:00
{
MWWorld : : Ptr ptr = R ( ) ( runtime ) ;
2014-09-26 14:16:46 +02:00
runtime . push ( MWBase : : Environment : : get ( ) . getWorld ( ) - > getActorCollidingWith ( ptr ) ) ;
2014-07-29 19:01:40 +02:00
}
} ;
template < class R >
class OpHurtStandingActor : public Interpreter : : Opcode0
{
public :
2020-10-16 22:18:54 +04:00
void execute ( Interpreter : : Runtime & runtime ) override
2014-07-29 19:01:40 +02:00
{
MWWorld : : Ptr ptr = R ( ) ( runtime ) ;
float healthDiffPerSecond = runtime [ 0 ] . mFloat ;
runtime . pop ( ) ;
MWBase : : Environment : : get ( ) . getWorld ( ) - > hurtStandingActors ( ptr , healthDiffPerSecond ) ;
}
} ;
template < class R >
class OpHurtCollidingActor : public Interpreter : : Opcode0
{
public :
2020-10-16 22:18:54 +04:00
void execute ( Interpreter : : Runtime & runtime ) override
2014-07-29 19:01:40 +02:00
{
MWWorld : : Ptr ptr = R ( ) ( runtime ) ;
float healthDiffPerSecond = runtime [ 0 ] . mFloat ;
runtime . pop ( ) ;
MWBase : : Environment : : get ( ) . getWorld ( ) - > hurtCollidingActors ( ptr , healthDiffPerSecond ) ;
}
} ;
2013-05-01 11:42:24 +02:00
class OpGetWindSpeed : public Interpreter : : Opcode0
{
public :
2020-10-16 22:18:54 +04:00
void execute ( Interpreter : : Runtime & runtime ) override
2013-05-01 11:42:24 +02:00
{
runtime . push ( MWBase : : Environment : : get ( ) . getWorld ( ) - > getWindSpeed ( ) ) ;
}
} ;
2013-07-26 08:08:52 -07:00
template < class R >
class OpHitOnMe : public Interpreter : : Opcode0
{
public :
2020-10-16 22:18:54 +04:00
void execute ( Interpreter : : Runtime & runtime ) override
2013-07-26 08:08:52 -07:00
{
MWWorld : : Ptr ptr = R ( ) ( runtime ) ;
2022-05-21 01:21:55 +02:00
std : : string_view objectID = runtime . getStringLiteral ( runtime [ 0 ] . mInteger ) ;
2013-07-26 08:08:52 -07:00
runtime . pop ( ) ;
2014-05-22 20:37:22 +02:00
MWMechanics : : CreatureStats & stats = ptr . getClass ( ) . getCreatureStats ( ptr ) ;
2022-03-28 11:40:46 +00:00
bool hit = : : Misc : : StringUtils : : ciEqual ( objectID , stats . getLastHitObject ( ) ) ;
runtime . push ( hit ) ;
if ( hit )
stats . clearLastHitObject ( ) ;
2013-07-26 08:08:52 -07:00
}
} ;
2014-12-11 22:25:41 +01:00
template < class R >
class OpHitAttemptOnMe : public Interpreter : : Opcode0
{
public :
2020-10-16 22:18:54 +04:00
void execute ( Interpreter : : Runtime & runtime ) override
2014-12-11 22:25:41 +01:00
{
MWWorld : : Ptr ptr = R ( ) ( runtime ) ;
2022-05-21 01:21:55 +02:00
std : : string_view objectID = runtime . getStringLiteral ( runtime [ 0 ] . mInteger ) ;
2014-12-11 22:25:41 +01:00
runtime . pop ( ) ;
MWMechanics : : CreatureStats & stats = ptr . getClass ( ) . getCreatureStats ( ptr ) ;
2022-04-30 18:32:10 +02:00
bool hit = : : Misc : : StringUtils : : ciEqual ( objectID , stats . getLastHitAttemptObject ( ) ) ;
runtime . push ( hit ) ;
if ( hit )
stats . clearLastHitAttemptObject ( ) ;
2014-12-11 22:25:41 +01:00
}
} ;
2013-07-27 00:14:55 -07:00
template < bool Enable >
class OpEnableTeleporting : public Interpreter : : Opcode0
{
public :
2020-10-16 22:18:54 +04:00
void execute ( Interpreter : : Runtime & runtime ) override
2013-07-27 00:14:55 -07:00
{
MWBase : : World * world = MWBase : : Environment : : get ( ) . getWorld ( ) ;
world - > enableTeleporting ( Enable ) ;
}
} ;
2013-10-02 15:12:41 +02:00
template < bool Enable >
class OpEnableLevitation : public Interpreter : : Opcode0
{
public :
2020-10-16 22:18:54 +04:00
void execute ( Interpreter : : Runtime & runtime ) override
2013-10-02 15:12:41 +02:00
{
MWBase : : World * world = MWBase : : Environment : : get ( ) . getWorld ( ) ;
world - > enableLevitation ( Enable ) ;
}
} ;
2010-08-03 22:43:53 +02:00
2016-02-27 13:40:53 +01:00
template < class R >
class OpShow : public Interpreter : : Opcode0
{
public :
2020-10-16 22:18:54 +04:00
void execute ( Interpreter : : Runtime & runtime ) override
2016-02-27 13:40:53 +01:00
{
MWWorld : : Ptr ptr = R ( ) ( runtime , false ) ;
2022-05-21 01:21:55 +02:00
std : : string_view var = runtime . getStringLiteral ( runtime [ 0 ] . mInteger ) ;
2016-02-27 13:40:53 +01:00
runtime . pop ( ) ;
std : : stringstream output ;
if ( ! ptr . isEmpty ( ) )
{
2022-08-11 22:51:55 +02:00
std : : string_view script = ptr . getClass ( ) . getScript ( ptr ) ;
2020-02-09 15:08:44 +03:00
if ( ! script . empty ( ) )
2016-02-27 13:40:53 +01:00
{
const Compiler : : Locals & locals =
MWBase : : Environment : : get ( ) . getScriptManager ( ) - > getLocals ( script ) ;
char type = locals . getType ( var ) ;
2020-02-09 20:10:24 +03:00
std : : string refId = ptr . getCellRef ( ) . getRefId ( ) ;
if ( refId . find ( ' ' ) ! = std : : string : : npos )
refId = ' " ' + refId + ' " ' ;
2016-02-27 13:40:53 +01:00
switch ( type )
{
case ' l ' :
case ' s ' :
2020-02-09 20:10:24 +03:00
output < < refId < < " . " < < var < < " = " < < ptr . getRefData ( ) . getLocals ( ) . getIntVar ( script , var ) ;
2016-02-27 13:40:53 +01:00
break ;
case ' f ' :
2020-02-09 20:10:24 +03:00
output < < refId < < " . " < < var < < " = " < < ptr . getRefData ( ) . getLocals ( ) . getFloatVar ( script , var ) ;
2016-02-27 13:40:53 +01:00
break ;
}
}
}
2020-02-09 15:08:44 +03:00
if ( output . rdbuf ( ) - > in_avail ( ) = = 0 )
2016-02-27 13:40:53 +01:00
{
MWBase : : World * world = MWBase : : Environment : : get ( ) . getWorld ( ) ;
char type = world - > getGlobalVariableType ( var ) ;
switch ( type )
{
case ' s ' :
2020-02-09 20:10:24 +03:00
output < < var < < " = " < < runtime . getContext ( ) . getGlobalShort ( var ) ;
2016-02-27 13:40:53 +01:00
break ;
case ' l ' :
2020-02-09 20:10:24 +03:00
output < < var < < " = " < < runtime . getContext ( ) . getGlobalLong ( var ) ;
2016-02-27 13:40:53 +01:00
break ;
case ' f ' :
2020-02-09 20:10:24 +03:00
output < < var < < " = " < < runtime . getContext ( ) . getGlobalFloat ( var ) ;
2016-02-27 13:40:53 +01:00
break ;
default :
2020-02-09 15:08:44 +03:00
output < < " unknown variable " ;
2016-02-27 13:40:53 +01:00
}
}
runtime . getContext ( ) . report ( output . str ( ) ) ;
}
} ;
2013-08-13 17:31:15 -07:00
template < class R >
class OpShowVars : public Interpreter : : Opcode0
2013-08-13 04:36:20 -07:00
{
void printLocalVars ( Interpreter : : Runtime & runtime , const MWWorld : : Ptr & ptr )
{
std : : stringstream str ;
2022-08-11 22:51:55 +02:00
std : : string_view script = ptr . getClass ( ) . getScript ( ptr ) ;
2013-08-13 04:36:20 -07:00
if ( script . empty ( ) )
2019-03-10 17:12:43 +03:00
str < < ptr . getCellRef ( ) . getRefId ( ) < < " does not have a script. " ;
2013-08-13 04:36:20 -07:00
else
{
2015-05-12 03:02:15 +02:00
str < < " Local variables for " < < ptr . getCellRef ( ) . getRefId ( ) ;
2013-08-13 04:36:20 -07:00
const Locals & locals = ptr . getRefData ( ) . getLocals ( ) ;
const Compiler : : Locals & complocals = MWBase : : Environment : : get ( ) . getScriptManager ( ) - > getLocals ( script ) ;
const std : : vector < std : : string > * names = & complocals . get ( ' s ' ) ;
for ( size_t i = 0 ; i < names - > size ( ) ; + + i )
{
if ( i > = locals . mShorts . size ( ) )
break ;
str < < std : : endl < < " " < < ( * names ) [ i ] < < " = " < < locals . mShorts [ i ] < < " (short) " ;
}
names = & complocals . get ( ' l ' ) ;
for ( size_t i = 0 ; i < names - > size ( ) ; + + i )
{
if ( i > = locals . mLongs . size ( ) )
break ;
str < < std : : endl < < " " < < ( * names ) [ i ] < < " = " < < locals . mLongs [ i ] < < " (long) " ;
}
names = & complocals . get ( ' f ' ) ;
for ( size_t i = 0 ; i < names - > size ( ) ; + + i )
{
if ( i > = locals . mFloats . size ( ) )
break ;
str < < std : : endl < < " " < < ( * names ) [ i ] < < " = " < < locals . mFloats [ i ] < < " (float) " ;
}
}
runtime . getContext ( ) . report ( str . str ( ) ) ;
}
void printGlobalVars ( Interpreter : : Runtime & runtime )
{
std : : stringstream str ;
str < < " Global variables: " ;
MWBase : : World * world = MWBase : : Environment : : get ( ) . getWorld ( ) ;
2015-03-03 23:46:53 +01:00
std : : vector < std : : string > names = runtime . getContext ( ) . getGlobals ( ) ;
2013-08-13 04:36:20 -07:00
for ( size_t i = 0 ; i < names . size ( ) ; + + i )
{
2013-11-28 09:10:38 +01:00
char type = world - > getGlobalVariableType ( names [ i ] ) ;
str < < std : : endl < < " " < < names [ i ] < < " = " ;
switch ( type )
{
case ' s ' :
2015-03-03 23:46:53 +01:00
str < < runtime . getContext ( ) . getGlobalShort ( names [ i ] ) < < " (short) " ;
2013-11-28 09:10:38 +01:00
break ;
case ' l ' :
2015-03-03 23:46:53 +01:00
str < < runtime . getContext ( ) . getGlobalLong ( names [ i ] ) < < " (long) " ;
2013-11-28 09:10:38 +01:00
break ;
case ' f ' :
2015-03-03 23:46:53 +01:00
str < < runtime . getContext ( ) . getGlobalFloat ( names [ i ] ) < < " (float) " ;
2013-11-28 09:10:38 +01:00
break ;
default :
str < < " <unknown type> " ;
}
2013-08-13 04:36:20 -07:00
}
2015-03-03 23:46:53 +01:00
runtime . getContext ( ) . report ( str . str ( ) ) ;
2013-08-13 04:36:20 -07:00
}
public :
2020-10-16 22:18:54 +04:00
void execute ( Interpreter : : Runtime & runtime ) override
2013-08-13 04:36:20 -07:00
{
2014-01-09 02:14:08 +01:00
MWWorld : : Ptr ptr = R ( ) ( runtime , false ) ;
if ( ! ptr . isEmpty ( ) )
2013-08-13 04:36:20 -07:00
printLocalVars ( runtime , ptr ) ;
2014-01-09 02:14:08 +01:00
else
{
2013-08-13 04:36:20 -07:00
// No reference, no problem.
printGlobalVars ( runtime ) ;
}
}
} ;
2015-02-10 20:25:57 +01:00
class OpToggleScripts : public Interpreter : : Opcode0
{
public :
2020-10-16 22:18:54 +04:00
void execute ( Interpreter : : Runtime & runtime ) override
2015-02-10 20:25:57 +01:00
{
bool enabled = MWBase : : Environment : : get ( ) . getWorld ( ) - > toggleScripts ( ) ;
2015-03-03 23:46:53 +01:00
runtime . getContext ( ) . report ( enabled ? " Scripts -> On " : " Scripts -> Off " ) ;
2015-02-10 20:25:57 +01:00
}
} ;
2013-08-24 21:19:12 -04:00
class OpToggleGodMode : public Interpreter : : Opcode0
{
public :
2020-10-16 22:18:54 +04:00
void execute ( Interpreter : : Runtime & runtime ) override
2013-08-24 21:19:12 -04:00
{
bool enabled = MWBase : : Environment : : get ( ) . getWorld ( ) - > toggleGodMode ( ) ;
2015-03-03 23:46:53 +01:00
runtime . getContext ( ) . report ( enabled ? " God Mode -> On " : " God Mode -> Off " ) ;
2013-08-24 21:19:12 -04:00
}
} ;
2014-01-03 04:09:52 +01:00
template < class R >
class OpCast : public Interpreter : : Opcode0
{
public :
2020-10-16 22:18:54 +04:00
void execute ( Interpreter : : Runtime & runtime ) override
2014-01-03 04:09:52 +01:00
{
MWWorld : : Ptr ptr = R ( ) ( runtime ) ;
2022-06-13 18:21:29 +02:00
std : : string_view spellId = runtime . getStringLiteral ( runtime [ 0 ] . mInteger ) ;
2014-01-03 04:09:52 +01:00
runtime . pop ( ) ;
2022-05-21 01:21:55 +02:00
std : : string targetId = : : Misc : : StringUtils : : lowerCase ( runtime . getStringLiteral ( runtime [ 0 ] . mInteger ) ) ;
2014-01-03 04:09:52 +01:00
runtime . pop ( ) ;
2022-05-22 09:29:03 +02:00
const ESM : : Spell * spell = MWBase : : Environment : : get ( ) . getWorld ( ) - > getStore ( ) . get < ESM : : Spell > ( ) . search ( spellId ) ;
2018-09-04 12:37:43 +04:00
if ( ! spell )
{
2022-06-13 18:21:29 +02:00
runtime . getContext ( ) . report ( " spellcasting failed: cannot find spell \" " + std : : string ( spellId ) + " \" " ) ;
2018-09-04 12:37:43 +04:00
return ;
}
2019-06-08 17:06:34 +03:00
if ( ptr = = MWMechanics : : getPlayer ( ) )
{
2022-05-21 01:21:55 +02:00
MWBase : : Environment : : get ( ) . getWorld ( ) - > getPlayer ( ) . setSelectedSpell ( spell - > mId ) ;
2019-06-08 17:06:34 +03:00
return ;
}
if ( ptr . getClass ( ) . isActor ( ) )
2018-06-28 16:58:51 +04:00
{
2021-08-07 10:06:56 +02:00
if ( ! MWBase : : Environment : : get ( ) . getMechanicsManager ( ) - > isCastingSpell ( ptr ) )
{
2022-05-21 01:21:55 +02:00
MWMechanics : : AiCast castPackage ( targetId , spell - > mId , true ) ;
2021-08-07 10:06:56 +02:00
ptr . getClass ( ) . getCreatureStats ( ptr ) . getAiSequence ( ) . stack ( castPackage , ptr ) ;
}
2018-06-28 16:58:51 +04:00
return ;
}
2019-12-01 14:00:24 +03:00
MWWorld : : Ptr target = MWBase : : Environment : : get ( ) . getWorld ( ) - > searchPtr ( targetId , false , false ) ;
if ( target . isEmpty ( ) )
return ;
2014-01-03 04:09:52 +01:00
2018-06-28 16:58:51 +04:00
MWMechanics : : CastSpell cast ( ptr , target , false , true ) ;
2022-09-04 15:42:40 +02:00
cast . playSpellCastingEffects ( spell ) ;
2015-06-01 21:41:13 +02:00
cast . mHitPosition = target . getRefData ( ) . getPosition ( ) . asVec3 ( ) ;
2014-10-09 01:39:35 +02:00
cast . mAlwaysSucceed = true ;
2014-01-03 04:09:52 +01:00
cast . cast ( spell ) ;
}
} ;
2013-08-13 04:36:20 -07:00
2014-01-03 04:44:50 +01:00
template < class R >
class OpExplodeSpell : public Interpreter : : Opcode0
{
public :
2020-10-16 22:18:54 +04:00
void execute ( Interpreter : : Runtime & runtime ) override
2014-01-03 04:44:50 +01:00
{
MWWorld : : Ptr ptr = R ( ) ( runtime ) ;
2022-06-13 18:21:29 +02:00
std : : string_view spellId = runtime . getStringLiteral ( runtime [ 0 ] . mInteger ) ;
2014-01-03 04:44:50 +01:00
runtime . pop ( ) ;
2022-05-22 09:29:03 +02:00
const ESM : : Spell * spell = MWBase : : Environment : : get ( ) . getWorld ( ) - > getStore ( ) . get < ESM : : Spell > ( ) . search ( spellId ) ;
2020-01-04 16:07:59 +03:00
if ( ! spell )
{
2022-06-13 18:21:29 +02:00
runtime . getContext ( ) . report ( " spellcasting failed: cannot find spell \" " + std : : string ( spellId ) + " \" " ) ;
2020-01-04 16:07:59 +03:00
return ;
}
if ( ptr = = MWMechanics : : getPlayer ( ) )
{
2022-05-21 01:21:55 +02:00
MWBase : : Environment : : get ( ) . getWorld ( ) - > getPlayer ( ) . setSelectedSpell ( spell - > mId ) ;
2020-01-04 16:07:59 +03:00
return ;
}
if ( ptr . getClass ( ) . isActor ( ) )
{
2021-08-07 10:06:56 +02:00
if ( ! MWBase : : Environment : : get ( ) . getMechanicsManager ( ) - > isCastingSpell ( ptr ) )
{
2022-05-21 01:21:55 +02:00
MWMechanics : : AiCast castPackage ( ptr . getCellRef ( ) . getRefId ( ) , spell - > mId , true ) ;
2021-08-07 10:06:56 +02:00
ptr . getClass ( ) . getCreatureStats ( ptr ) . getAiSequence ( ) . stack ( castPackage , ptr ) ;
}
2020-01-04 16:07:59 +03:00
return ;
}
2018-06-28 16:58:51 +04:00
MWMechanics : : CastSpell cast ( ptr , ptr , false , true ) ;
2015-06-01 21:41:13 +02:00
cast . mHitPosition = ptr . getRefData ( ) . getPosition ( ) . asVec3 ( ) ;
2014-10-09 01:39:35 +02:00
cast . mAlwaysSucceed = true ;
2014-01-03 04:44:50 +01:00
cast . cast ( spell ) ;
}
} ;
2014-01-09 01:49:58 +01:00
class OpGoToJail : public Interpreter : : Opcode0
{
public :
2020-10-16 22:18:54 +04:00
void execute ( Interpreter : : Runtime & runtime ) override
2014-01-09 01:49:58 +01:00
{
MWBase : : World * world = MWBase : : Environment : : get ( ) . getWorld ( ) ;
2014-01-11 06:47:58 +01:00
world - > goToJail ( ) ;
2014-01-09 01:49:58 +01:00
}
} ;
class OpPayFine : public Interpreter : : Opcode0
{
public :
2020-10-16 22:18:54 +04:00
void execute ( Interpreter : : Runtime & runtime ) override
2014-01-09 01:49:58 +01:00
{
2015-08-21 21:12:39 +12:00
MWWorld : : Ptr player = MWMechanics : : getPlayer ( ) ;
2014-01-09 01:49:58 +01:00
player . getClass ( ) . getNpcStats ( player ) . setBounty ( 0 ) ;
2014-04-19 19:03:31 -04:00
MWBase : : Environment : : get ( ) . getWorld ( ) - > confiscateStolenItems ( player ) ;
2014-04-05 10:26:14 -04:00
MWBase : : Environment : : get ( ) . getWorld ( ) - > getPlayer ( ) . recordCrimeId ( ) ;
2014-01-09 01:49:58 +01:00
}
} ;
class OpPayFineThief : public Interpreter : : Opcode0
{
public :
2020-10-16 22:18:54 +04:00
void execute ( Interpreter : : Runtime & runtime ) override
2014-01-09 01:49:58 +01:00
{
2015-08-21 21:12:39 +12:00
MWWorld : : Ptr player = MWMechanics : : getPlayer ( ) ;
2014-01-09 01:49:58 +01:00
player . getClass ( ) . getNpcStats ( player ) . setBounty ( 0 ) ;
2014-04-05 10:26:14 -04:00
MWBase : : Environment : : get ( ) . getWorld ( ) - > getPlayer ( ) . recordCrimeId ( ) ;
2014-01-09 01:49:58 +01:00
}
} ;
2014-02-02 15:35:18 +01:00
class OpGetPcInJail : public Interpreter : : Opcode0
{
public :
2020-10-16 22:18:54 +04:00
void execute ( Interpreter : : Runtime & runtime ) override
2014-02-02 15:35:18 +01:00
{
2016-01-05 23:27:42 +01:00
runtime . push ( MWBase : : Environment : : get ( ) . getWorld ( ) - > isPlayerInJail ( ) ) ;
2014-02-02 15:35:18 +01:00
}
} ;
class OpGetPcTraveling : public Interpreter : : Opcode0
{
public :
2020-10-16 22:18:54 +04:00
void execute ( Interpreter : : Runtime & runtime ) override
2014-02-02 15:35:18 +01:00
{
2018-08-13 08:30:50 +04:00
runtime . push ( MWBase : : Environment : : get ( ) . getWorld ( ) - > isPlayerTraveling ( ) ) ;
2014-02-02 15:35:18 +01:00
}
} ;
2014-06-15 15:15:59 +02:00
template < class R >
2015-06-25 21:45:59 +02:00
class OpBetaComment : public Interpreter : : Opcode1
2014-06-15 15:15:59 +02:00
{
public :
2020-10-16 22:18:54 +04:00
void execute ( Interpreter : : Runtime & runtime , unsigned int arg0 ) override
2014-06-15 15:15:59 +02:00
{
MWWorld : : Ptr ptr = R ( ) ( runtime ) ;
std : : stringstream msg ;
2020-01-03 08:45:53 +04:00
msg < < " Report time: " ;
std : : time_t currentTime = std : : chrono : : system_clock : : to_time_t ( std : : chrono : : system_clock : : now ( ) ) ;
2020-01-06 11:27:11 +04:00
msg < < std : : put_time ( std : : gmtime ( & currentTime ) , " %Y.%m.%d %T UTC " ) < < std : : endl ;
2020-01-03 08:45:53 +04:00
2021-08-12 02:02:22 +02:00
msg < < " Content file: " < < ptr . getCellRef ( ) . getRefNum ( ) . mContentFile ;
2014-06-15 15:15:59 +02:00
2015-01-11 12:20:22 +13:00
if ( ! ptr . getCellRef ( ) . hasContentFile ( ) )
2021-08-12 02:02:22 +02:00
msg < < " [None] " < < std : : endl ;
2014-06-15 15:15:59 +02:00
else
{
std : : vector < std : : string > contentFiles = MWBase : : Environment : : get ( ) . getWorld ( ) - > getContentFiles ( ) ;
2014-06-27 08:37:41 +02:00
2021-08-12 02:02:22 +02:00
msg < < " [ " < < contentFiles . at ( ptr . getCellRef ( ) . getRefNum ( ) . mContentFile ) < < " ] " < < std : : endl ;
2014-06-15 15:15:59 +02:00
}
2021-08-12 02:02:22 +02:00
msg < < " RefNum: " < < ptr . getCellRef ( ) . getRefNum ( ) . mIndex < < std : : endl ;
2015-12-17 20:15:44 +01:00
if ( ptr . getRefData ( ) . isDeletedByContentFile ( ) )
msg < < " [Deleted by content file] " < < std : : endl ;
if ( ! ptr . getRefData ( ) . getCount ( ) )
msg < < " [Deleted] " < < std : : endl ;
2014-06-15 15:15:59 +02:00
msg < < " RefID: " < < ptr . getCellRef ( ) . getRefId ( ) < < std : : endl ;
2020-02-02 20:49:39 +01:00
msg < < " Memory address: " < < ptr . getBase ( ) < < std : : endl ;
2014-06-15 15:15:59 +02:00
if ( ptr . isInCell ( ) )
{
MWWorld : : CellStore * cell = ptr . getCell ( ) ;
msg < < " Cell: " < < MWBase : : Environment : : get ( ) . getWorld ( ) - > getCellName ( cell ) < < std : : endl ;
2014-07-01 21:41:23 +02:00
if ( cell - > getCell ( ) - > isExterior ( ) )
msg < < " Grid: " < < cell - > getCell ( ) - > getGridX ( ) < < " " < < cell - > getCell ( ) - > getGridY ( ) < < std : : endl ;
2015-06-03 21:37:21 +02:00
osg : : Vec3f pos ( ptr . getRefData ( ) . getPosition ( ) . asVec3 ( ) ) ;
msg < < " Coordinates: " < < pos . x ( ) < < " " < < pos . y ( ) < < " " < < pos . z ( ) < < std : : endl ;
2020-12-29 21:45:59 +01:00
auto vfs = MWBase : : Environment : : get ( ) . getResourceSystem ( ) - > getVFS ( ) ;
std : : string model = : : Misc : : ResourceHelpers : : correctActorModelPath ( ptr . getClass ( ) . getModel ( ptr ) , vfs ) ;
msg < < " Model: " < < model < < std : : endl ;
if ( ! model . empty ( ) )
{
const std : : string archive = vfs - > getArchive ( model ) ;
if ( ! archive . empty ( ) )
msg < < " ( " < < archive < < " ) " < < std : : endl ;
}
2014-11-28 16:02:43 +01:00
if ( ! ptr . getClass ( ) . getScript ( ptr ) . empty ( ) )
msg < < " Script: " < < ptr . getClass ( ) . getScript ( ptr ) < < std : : endl ;
2014-06-15 15:15:59 +02:00
}
2015-06-25 21:45:59 +02:00
while ( arg0 > 0 )
{
2022-05-21 01:21:55 +02:00
std : : string_view notes = runtime . getStringLiteral ( runtime [ 0 ] . mInteger ) ;
2015-06-25 21:45:59 +02:00
runtime . pop ( ) ;
if ( ! notes . empty ( ) )
msg < < " Notes: " < < notes < < std : : endl ;
- - arg0 ;
}
2014-06-15 15:15:59 +02:00
2020-01-03 08:45:53 +04:00
Log ( Debug : : Warning ) < < " \n " < < msg . str ( ) ;
2014-06-15 15:15:59 +02:00
runtime . getContext ( ) . report ( msg . str ( ) ) ;
}
} ;
2014-12-17 01:05:32 +01:00
class OpAddToLevCreature : public Interpreter : : Opcode0
{
public :
2020-10-16 22:18:54 +04:00
void execute ( Interpreter : : Runtime & runtime ) override
2014-12-17 01:05:32 +01:00
{
2022-06-13 18:21:29 +02:00
std : : string_view levId = runtime . getStringLiteral ( runtime [ 0 ] . mInteger ) ;
2014-12-17 01:05:32 +01:00
runtime . pop ( ) ;
2022-05-21 01:21:55 +02:00
std : : string_view creatureId = runtime . getStringLiteral ( runtime [ 0 ] . mInteger ) ;
2014-12-17 01:05:32 +01:00
runtime . pop ( ) ;
int level = runtime [ 0 ] . mInteger ;
runtime . pop ( ) ;
2022-05-22 09:29:03 +02:00
ESM : : CreatureLevList listCopy = * MWBase : : Environment : : get ( ) . getWorld ( ) - > getStore ( ) . get < ESM : : CreatureLevList > ( ) . find ( levId ) ;
2014-12-17 01:05:32 +01:00
addToLevList ( & listCopy , creatureId , level ) ;
MWBase : : Environment : : get ( ) . getWorld ( ) - > createOverrideRecord ( listCopy ) ;
}
} ;
class OpRemoveFromLevCreature : public Interpreter : : Opcode0
{
public :
2020-10-16 22:18:54 +04:00
void execute ( Interpreter : : Runtime & runtime ) override
2014-12-17 01:05:32 +01:00
{
2022-06-13 18:21:29 +02:00
std : : string_view levId = runtime . getStringLiteral ( runtime [ 0 ] . mInteger ) ;
2014-12-17 01:05:32 +01:00
runtime . pop ( ) ;
2022-05-21 01:21:55 +02:00
std : : string_view creatureId = runtime . getStringLiteral ( runtime [ 0 ] . mInteger ) ;
2014-12-17 01:05:32 +01:00
runtime . pop ( ) ;
int level = runtime [ 0 ] . mInteger ;
runtime . pop ( ) ;
2022-05-22 09:29:03 +02:00
ESM : : CreatureLevList listCopy = * MWBase : : Environment : : get ( ) . getWorld ( ) - > getStore ( ) . get < ESM : : CreatureLevList > ( ) . find ( levId ) ;
2014-12-17 01:05:32 +01:00
removeFromLevList ( & listCopy , creatureId , level ) ;
MWBase : : Environment : : get ( ) . getWorld ( ) - > createOverrideRecord ( listCopy ) ;
}
} ;
class OpAddToLevItem : public Interpreter : : Opcode0
{
public :
2020-10-16 22:18:54 +04:00
void execute ( Interpreter : : Runtime & runtime ) override
2014-12-17 01:05:32 +01:00
{
2022-06-13 18:21:29 +02:00
std : : string_view levId = runtime . getStringLiteral ( runtime [ 0 ] . mInteger ) ;
2014-12-17 01:05:32 +01:00
runtime . pop ( ) ;
2022-05-21 01:21:55 +02:00
std : : string_view itemId = runtime . getStringLiteral ( runtime [ 0 ] . mInteger ) ;
2014-12-17 01:05:32 +01:00
runtime . pop ( ) ;
int level = runtime [ 0 ] . mInteger ;
runtime . pop ( ) ;
2022-05-22 09:29:03 +02:00
ESM : : ItemLevList listCopy = * MWBase : : Environment : : get ( ) . getWorld ( ) - > getStore ( ) . get < ESM : : ItemLevList > ( ) . find ( levId ) ;
2014-12-17 01:05:32 +01:00
addToLevList ( & listCopy , itemId , level ) ;
MWBase : : Environment : : get ( ) . getWorld ( ) - > createOverrideRecord ( listCopy ) ;
}
} ;
class OpRemoveFromLevItem : public Interpreter : : Opcode0
{
public :
2020-10-16 22:18:54 +04:00
void execute ( Interpreter : : Runtime & runtime ) override
2014-12-17 01:05:32 +01:00
{
2022-06-13 18:21:29 +02:00
std : : string_view levId = runtime . getStringLiteral ( runtime [ 0 ] . mInteger ) ;
2014-12-17 01:05:32 +01:00
runtime . pop ( ) ;
2022-05-21 01:21:55 +02:00
std : : string_view itemId = runtime . getStringLiteral ( runtime [ 0 ] . mInteger ) ;
2014-12-17 01:05:32 +01:00
runtime . pop ( ) ;
int level = runtime [ 0 ] . mInteger ;
runtime . pop ( ) ;
2022-05-22 09:29:03 +02:00
ESM : : ItemLevList listCopy = * MWBase : : Environment : : get ( ) . getWorld ( ) - > getStore ( ) . get < ESM : : ItemLevList > ( ) . find ( levId ) ;
2014-12-17 01:05:32 +01:00
removeFromLevList ( & listCopy , itemId , level ) ;
MWBase : : Environment : : get ( ) . getWorld ( ) - > createOverrideRecord ( listCopy ) ;
}
} ;
2017-02-01 03:00:33 +01:00
template < class R >
class OpShowSceneGraph : public Interpreter : : Opcode1
{
public :
2020-10-16 22:18:54 +04:00
void execute ( Interpreter : : Runtime & runtime , unsigned int arg0 ) override
2017-02-01 03:00:33 +01:00
{
MWWorld : : Ptr ptr = R ( ) ( runtime , false ) ;
int confirmed = 0 ;
if ( arg0 = = 1 )
{
confirmed = runtime [ 0 ] . mInteger ;
runtime . pop ( ) ;
}
if ( ptr . isEmpty ( ) & & ! confirmed )
runtime . getContext ( ) . report ( " Exporting the entire scene graph will result in a large file. Confirm this action using 'showscenegraph 1' or select an object instead. " ) ;
else
{
const std : : string & filename = MWBase : : Environment : : get ( ) . getWorld ( ) - > exportSceneGraph ( ptr ) ;
runtime . getContext ( ) . report ( " Wrote ' " + filename + " ' " ) ;
}
}
} ;
2018-04-07 16:11:23 +03:00
class OpToggleNavMesh : public Interpreter : : Opcode0
{
public :
2020-10-16 22:18:54 +04:00
void execute ( Interpreter : : Runtime & runtime ) override
2018-04-07 16:11:23 +03:00
{
bool enabled =
MWBase : : Environment : : get ( ) . getWorld ( ) - > toggleRenderMode ( MWRender : : Render_NavMesh ) ;
runtime . getContext ( ) . report ( enabled ?
" Navigation Mesh Rendering -> On " : " Navigation Mesh Rendering -> Off " ) ;
}
} ;
2018-07-21 13:37:02 +03:00
class OpToggleActorsPaths : public Interpreter : : Opcode0
{
public :
2020-10-16 22:18:54 +04:00
void execute ( Interpreter : : Runtime & runtime ) override
2018-07-21 13:37:02 +03:00
{
bool enabled =
MWBase : : Environment : : get ( ) . getWorld ( ) - > toggleRenderMode ( MWRender : : Render_ActorsPaths ) ;
runtime . getContext ( ) . report ( enabled ?
" Agents Paths Rendering -> On " : " Agents Paths Rendering -> Off " ) ;
}
} ;
2018-08-31 01:39:44 +03:00
class OpSetNavMeshNumberToRender : public Interpreter : : Opcode0
{
public :
2020-10-16 22:18:54 +04:00
void execute ( Interpreter : : Runtime & runtime ) override
2018-08-31 01:39:44 +03:00
{
const auto navMeshNumber = runtime [ 0 ] . mInteger ;
runtime . pop ( ) ;
if ( navMeshNumber < 0 )
{
runtime . getContext ( ) . report ( " Invalid navmesh number: use not less than zero values " ) ;
return ;
}
MWBase : : Environment : : get ( ) . getWorld ( ) - > setNavMeshNumberToRender ( static_cast < std : : size_t > ( navMeshNumber ) ) ;
}
} ;
2019-06-03 02:14:29 +03:00
template < class R >
class OpRepairedOnMe : public Interpreter : : Opcode0
{
public :
2020-10-16 22:18:54 +04:00
void execute ( Interpreter : : Runtime & runtime ) override
2019-06-03 02:14:29 +03:00
{
// Broken in vanilla and deliberately no-op.
runtime . push ( 0 ) ;
}
} ;
2019-11-27 23:45:01 +01:00
class OpToggleRecastMesh : public Interpreter : : Opcode0
{
public :
2020-10-16 22:18:54 +04:00
void execute ( Interpreter : : Runtime & runtime ) override
2019-11-27 23:45:01 +01:00
{
bool enabled =
MWBase : : Environment : : get ( ) . getWorld ( ) - > toggleRenderMode ( MWRender : : Render_RecastMesh ) ;
runtime . getContext ( ) . report ( enabled ?
" Recast Mesh Rendering -> On " : " Recast Mesh Rendering -> Off " ) ;
}
} ;
2021-07-07 18:48:25 +02:00
class OpHelp : public Interpreter : : Opcode0
{
public :
void execute ( Interpreter : : Runtime & runtime ) override
{
std : : stringstream message ;
message < < MWBase : : Environment : : get ( ) . getWindowManager ( ) - > getVersionDescription ( ) < < " \n \n " ;
std : : vector < std : : string > commands ;
MWBase : : Environment : : get ( ) . getScriptManager ( ) - > getExtensions ( ) . listKeywords ( commands ) ;
for ( const auto & command : commands )
message < < command < < " \n " ;
runtime . getContext ( ) . report ( message . str ( ) ) ;
}
} ;
2021-04-12 03:15:17 +02:00
class OpReloadLua : public Interpreter : : Opcode0
{
public :
void execute ( Interpreter : : Runtime & runtime ) override
{
MWBase : : Environment : : get ( ) . getLuaManager ( ) - > reloadAllScripts ( ) ;
runtime . getContext ( ) . report ( " All Lua scripts are reloaded " ) ;
}
} ;
2010-07-05 13:15:49 +02:00
void installOpcodes ( Interpreter : : Interpreter & interpreter )
{
2022-01-27 19:18:57 +00:00
interpreter . installSegment5 < OpMenuMode > ( Compiler : : Misc : : opcodeMenuMode ) ;
interpreter . installSegment5 < OpRandom > ( Compiler : : Misc : : opcodeRandom ) ;
interpreter . installSegment5 < OpScriptRunning > ( Compiler : : Misc : : opcodeScriptRunning ) ;
interpreter . installSegment5 < OpStartScript < ImplicitRef > > ( Compiler : : Misc : : opcodeStartScript ) ;
interpreter . installSegment5 < OpStartScript < ExplicitRef > > ( Compiler : : Misc : : opcodeStartScriptExplicit ) ;
interpreter . installSegment5 < OpStopScript > ( Compiler : : Misc : : opcodeStopScript ) ;
interpreter . installSegment5 < OpGetSecondsPassed > ( Compiler : : Misc : : opcodeGetSecondsPassed ) ;
interpreter . installSegment5 < OpEnable < ImplicitRef > > ( Compiler : : Misc : : opcodeEnable ) ;
interpreter . installSegment5 < OpEnable < ExplicitRef > > ( Compiler : : Misc : : opcodeEnableExplicit ) ;
interpreter . installSegment5 < OpDisable < ImplicitRef > > ( Compiler : : Misc : : opcodeDisable ) ;
interpreter . installSegment5 < OpDisable < ExplicitRef > > ( Compiler : : Misc : : opcodeDisableExplicit ) ;
interpreter . installSegment5 < OpGetDisabled < ImplicitRef > > ( Compiler : : Misc : : opcodeGetDisabled ) ;
interpreter . installSegment5 < OpGetDisabled < ExplicitRef > > ( Compiler : : Misc : : opcodeGetDisabledExplicit ) ;
interpreter . installSegment5 < OpXBox > ( Compiler : : Misc : : opcodeXBox ) ;
interpreter . installSegment5 < OpOnActivate < ImplicitRef > > ( Compiler : : Misc : : opcodeOnActivate ) ;
interpreter . installSegment5 < OpOnActivate < ExplicitRef > > ( Compiler : : Misc : : opcodeOnActivateExplicit ) ;
interpreter . installSegment5 < OpActivate < ImplicitRef > > ( Compiler : : Misc : : opcodeActivate ) ;
interpreter . installSegment5 < OpActivate < ExplicitRef > > ( Compiler : : Misc : : opcodeActivateExplicit ) ;
interpreter . installSegment3 < OpLock < ImplicitRef > > ( Compiler : : Misc : : opcodeLock ) ;
interpreter . installSegment3 < OpLock < ExplicitRef > > ( Compiler : : Misc : : opcodeLockExplicit ) ;
interpreter . installSegment5 < OpUnlock < ImplicitRef > > ( Compiler : : Misc : : opcodeUnlock ) ;
interpreter . installSegment5 < OpUnlock < ExplicitRef > > ( Compiler : : Misc : : opcodeUnlockExplicit ) ;
interpreter . installSegment5 < OpToggleCollisionDebug > ( Compiler : : Misc : : opcodeToggleCollisionDebug ) ;
interpreter . installSegment5 < OpToggleCollisionBoxes > ( Compiler : : Misc : : opcodeToggleCollisionBoxes ) ;
interpreter . installSegment5 < OpToggleWireframe > ( Compiler : : Misc : : opcodeToggleWireframe ) ;
interpreter . installSegment5 < OpFadeIn > ( Compiler : : Misc : : opcodeFadeIn ) ;
interpreter . installSegment5 < OpFadeOut > ( Compiler : : Misc : : opcodeFadeOut ) ;
interpreter . installSegment5 < OpFadeTo > ( Compiler : : Misc : : opcodeFadeTo ) ;
interpreter . installSegment5 < OpTogglePathgrid > ( Compiler : : Misc : : opcodeTogglePathgrid ) ;
interpreter . installSegment5 < OpToggleWater > ( Compiler : : Misc : : opcodeToggleWater ) ;
interpreter . installSegment5 < OpToggleWorld > ( Compiler : : Misc : : opcodeToggleWorld ) ;
interpreter . installSegment5 < OpDontSaveObject > ( Compiler : : Misc : : opcodeDontSaveObject ) ;
interpreter . installSegment5 < OpPcForce1stPerson > ( Compiler : : Misc : : opcodePcForce1stPerson ) ;
interpreter . installSegment5 < OpPcForce3rdPerson > ( Compiler : : Misc : : opcodePcForce3rdPerson ) ;
interpreter . installSegment5 < OpPcGet3rdPerson > ( Compiler : : Misc : : opcodePcGet3rdPerson ) ;
interpreter . installSegment5 < OpToggleVanityMode > ( Compiler : : Misc : : opcodeToggleVanityMode ) ;
interpreter . installSegment5 < OpGetPcSleep > ( Compiler : : Misc : : opcodeGetPcSleep ) ;
interpreter . installSegment5 < OpGetPcJumping > ( Compiler : : Misc : : opcodeGetPcJumping ) ;
interpreter . installSegment5 < OpWakeUpPc > ( Compiler : : Misc : : opcodeWakeUpPc ) ;
interpreter . installSegment5 < OpPlayBink > ( Compiler : : Misc : : opcodePlayBink ) ;
interpreter . installSegment5 < OpPayFine > ( Compiler : : Misc : : opcodePayFine ) ;
interpreter . installSegment5 < OpPayFineThief > ( Compiler : : Misc : : opcodePayFineThief ) ;
interpreter . installSegment5 < OpGoToJail > ( Compiler : : Misc : : opcodeGoToJail ) ;
interpreter . installSegment5 < OpGetLocked < ImplicitRef > > ( Compiler : : Misc : : opcodeGetLocked ) ;
interpreter . installSegment5 < OpGetLocked < ExplicitRef > > ( Compiler : : Misc : : opcodeGetLockedExplicit ) ;
interpreter . installSegment5 < OpGetEffect < ImplicitRef > > ( Compiler : : Misc : : opcodeGetEffect ) ;
interpreter . installSegment5 < OpGetEffect < ExplicitRef > > ( Compiler : : Misc : : opcodeGetEffectExplicit ) ;
interpreter . installSegment5 < OpAddSoulGem < ImplicitRef > > ( Compiler : : Misc : : opcodeAddSoulGem ) ;
interpreter . installSegment5 < OpAddSoulGem < ExplicitRef > > ( Compiler : : Misc : : opcodeAddSoulGemExplicit ) ;
interpreter . installSegment3 < OpRemoveSoulGem < ImplicitRef > > ( Compiler : : Misc : : opcodeRemoveSoulGem ) ;
interpreter . installSegment3 < OpRemoveSoulGem < ExplicitRef > > ( Compiler : : Misc : : opcodeRemoveSoulGemExplicit ) ;
interpreter . installSegment5 < OpDrop < ImplicitRef > > ( Compiler : : Misc : : opcodeDrop ) ;
interpreter . installSegment5 < OpDrop < ExplicitRef > > ( Compiler : : Misc : : opcodeDropExplicit ) ;
interpreter . installSegment5 < OpDropSoulGem < ImplicitRef > > ( Compiler : : Misc : : opcodeDropSoulGem ) ;
interpreter . installSegment5 < OpDropSoulGem < ExplicitRef > > ( Compiler : : Misc : : opcodeDropSoulGemExplicit ) ;
interpreter . installSegment5 < OpGetAttacked < ImplicitRef > > ( Compiler : : Misc : : opcodeGetAttacked ) ;
interpreter . installSegment5 < OpGetAttacked < ExplicitRef > > ( Compiler : : Misc : : opcodeGetAttackedExplicit ) ;
interpreter . installSegment5 < OpGetWeaponDrawn < ImplicitRef > > ( Compiler : : Misc : : opcodeGetWeaponDrawn ) ;
interpreter . installSegment5 < OpGetWeaponDrawn < ExplicitRef > > ( Compiler : : Misc : : opcodeGetWeaponDrawnExplicit ) ;
interpreter . installSegment5 < OpGetSpellReadied < ImplicitRef > > ( Compiler : : Misc : : opcodeGetSpellReadied ) ;
interpreter . installSegment5 < OpGetSpellReadied < ExplicitRef > > ( Compiler : : Misc : : opcodeGetSpellReadiedExplicit ) ;
interpreter . installSegment5 < OpGetSpellEffects < ImplicitRef > > ( Compiler : : Misc : : opcodeGetSpellEffects ) ;
interpreter . installSegment5 < OpGetSpellEffects < ExplicitRef > > ( Compiler : : Misc : : opcodeGetSpellEffectsExplicit ) ;
interpreter . installSegment5 < OpGetCurrentTime > ( Compiler : : Misc : : opcodeGetCurrentTime ) ;
interpreter . installSegment5 < OpSetDelete < ImplicitRef > > ( Compiler : : Misc : : opcodeSetDelete ) ;
interpreter . installSegment5 < OpSetDelete < ExplicitRef > > ( Compiler : : Misc : : opcodeSetDeleteExplicit ) ;
interpreter . installSegment5 < OpGetSquareRoot > ( Compiler : : Misc : : opcodeGetSquareRoot ) ;
interpreter . installSegment5 < OpFall < ImplicitRef > > ( Compiler : : Misc : : opcodeFall ) ;
interpreter . installSegment5 < OpFall < ExplicitRef > > ( Compiler : : Misc : : opcodeFallExplicit ) ;
interpreter . installSegment5 < OpGetStandingPc < ImplicitRef > > ( Compiler : : Misc : : opcodeGetStandingPc ) ;
interpreter . installSegment5 < OpGetStandingPc < ExplicitRef > > ( Compiler : : Misc : : opcodeGetStandingPcExplicit ) ;
interpreter . installSegment5 < OpGetStandingActor < ImplicitRef > > ( Compiler : : Misc : : opcodeGetStandingActor ) ;
interpreter . installSegment5 < OpGetStandingActor < ExplicitRef > > ( Compiler : : Misc : : opcodeGetStandingActorExplicit ) ;
interpreter . installSegment5 < OpGetCollidingPc < ImplicitRef > > ( Compiler : : Misc : : opcodeGetCollidingPc ) ;
interpreter . installSegment5 < OpGetCollidingPc < ExplicitRef > > ( Compiler : : Misc : : opcodeGetCollidingPcExplicit ) ;
interpreter . installSegment5 < OpGetCollidingActor < ImplicitRef > > ( Compiler : : Misc : : opcodeGetCollidingActor ) ;
interpreter . installSegment5 < OpGetCollidingActor < ExplicitRef > > ( Compiler : : Misc : : opcodeGetCollidingActorExplicit ) ;
interpreter . installSegment5 < OpHurtStandingActor < ImplicitRef > > ( Compiler : : Misc : : opcodeHurtStandingActor ) ;
interpreter . installSegment5 < OpHurtStandingActor < ExplicitRef > > ( Compiler : : Misc : : opcodeHurtStandingActorExplicit ) ;
interpreter . installSegment5 < OpHurtCollidingActor < ImplicitRef > > ( Compiler : : Misc : : opcodeHurtCollidingActor ) ;
interpreter . installSegment5 < OpHurtCollidingActor < ExplicitRef > > ( Compiler : : Misc : : opcodeHurtCollidingActorExplicit ) ;
interpreter . installSegment5 < OpGetWindSpeed > ( Compiler : : Misc : : opcodeGetWindSpeed ) ;
interpreter . installSegment5 < OpHitOnMe < ImplicitRef > > ( Compiler : : Misc : : opcodeHitOnMe ) ;
interpreter . installSegment5 < OpHitOnMe < ExplicitRef > > ( Compiler : : Misc : : opcodeHitOnMeExplicit ) ;
interpreter . installSegment5 < OpHitAttemptOnMe < ImplicitRef > > ( Compiler : : Misc : : opcodeHitAttemptOnMe ) ;
interpreter . installSegment5 < OpHitAttemptOnMe < ExplicitRef > > ( Compiler : : Misc : : opcodeHitAttemptOnMeExplicit ) ;
interpreter . installSegment5 < OpEnableTeleporting < false > > ( Compiler : : Misc : : opcodeDisableTeleporting ) ;
interpreter . installSegment5 < OpEnableTeleporting < true > > ( Compiler : : Misc : : opcodeEnableTeleporting ) ;
interpreter . installSegment5 < OpShowVars < ImplicitRef > > ( Compiler : : Misc : : opcodeShowVars ) ;
interpreter . installSegment5 < OpShowVars < ExplicitRef > > ( Compiler : : Misc : : opcodeShowVarsExplicit ) ;
interpreter . installSegment5 < OpShow < ImplicitRef > > ( Compiler : : Misc : : opcodeShow ) ;
interpreter . installSegment5 < OpShow < ExplicitRef > > ( Compiler : : Misc : : opcodeShowExplicit ) ;
interpreter . installSegment5 < OpToggleGodMode > ( Compiler : : Misc : : opcodeToggleGodMode ) ;
interpreter . installSegment5 < OpToggleScripts > ( Compiler : : Misc : : opcodeToggleScripts ) ;
interpreter . installSegment5 < OpEnableLevitation < false > > ( Compiler : : Misc : : opcodeDisableLevitation ) ;
interpreter . installSegment5 < OpEnableLevitation < true > > ( Compiler : : Misc : : opcodeEnableLevitation ) ;
interpreter . installSegment5 < OpCast < ImplicitRef > > ( Compiler : : Misc : : opcodeCast ) ;
interpreter . installSegment5 < OpCast < ExplicitRef > > ( Compiler : : Misc : : opcodeCastExplicit ) ;
interpreter . installSegment5 < OpExplodeSpell < ImplicitRef > > ( Compiler : : Misc : : opcodeExplodeSpell ) ;
interpreter . installSegment5 < OpExplodeSpell < ExplicitRef > > ( Compiler : : Misc : : opcodeExplodeSpellExplicit ) ;
interpreter . installSegment5 < OpGetPcInJail > ( Compiler : : Misc : : opcodeGetPcInJail ) ;
interpreter . installSegment5 < OpGetPcTraveling > ( Compiler : : Misc : : opcodeGetPcTraveling ) ;
interpreter . installSegment3 < OpBetaComment < ImplicitRef > > ( Compiler : : Misc : : opcodeBetaComment ) ;
interpreter . installSegment3 < OpBetaComment < ExplicitRef > > ( Compiler : : Misc : : opcodeBetaCommentExplicit ) ;
interpreter . installSegment5 < OpAddToLevCreature > ( Compiler : : Misc : : opcodeAddToLevCreature ) ;
interpreter . installSegment5 < OpRemoveFromLevCreature > ( Compiler : : Misc : : opcodeRemoveFromLevCreature ) ;
interpreter . installSegment5 < OpAddToLevItem > ( Compiler : : Misc : : opcodeAddToLevItem ) ;
interpreter . installSegment5 < OpRemoveFromLevItem > ( Compiler : : Misc : : opcodeRemoveFromLevItem ) ;
interpreter . installSegment3 < OpShowSceneGraph < ImplicitRef > > ( Compiler : : Misc : : opcodeShowSceneGraph ) ;
interpreter . installSegment3 < OpShowSceneGraph < ExplicitRef > > ( Compiler : : Misc : : opcodeShowSceneGraphExplicit ) ;
interpreter . installSegment5 < OpToggleBorders > ( Compiler : : Misc : : opcodeToggleBorders ) ;
interpreter . installSegment5 < OpToggleNavMesh > ( Compiler : : Misc : : opcodeToggleNavMesh ) ;
interpreter . installSegment5 < OpToggleActorsPaths > ( Compiler : : Misc : : opcodeToggleActorsPaths ) ;
interpreter . installSegment5 < OpSetNavMeshNumberToRender > ( Compiler : : Misc : : opcodeSetNavMeshNumberToRender ) ;
interpreter . installSegment5 < OpRepairedOnMe < ImplicitRef > > ( Compiler : : Misc : : opcodeRepairedOnMe ) ;
interpreter . installSegment5 < OpRepairedOnMe < ExplicitRef > > ( Compiler : : Misc : : opcodeRepairedOnMeExplicit ) ;
interpreter . installSegment5 < OpToggleRecastMesh > ( Compiler : : Misc : : opcodeToggleRecastMesh ) ;
interpreter . installSegment5 < OpHelp > ( Compiler : : Misc : : opcodeHelp ) ;
interpreter . installSegment5 < OpReloadLua > ( Compiler : : Misc : : opcodeReloadLua ) ;
2010-08-03 22:43:53 +02:00
}
}
2010-07-05 13:15:49 +02:00
}